fix(install): include agent metadata config in profile installs (#280)

Co-authored-by: Leslie <leslie@Mac-mini.local>
This commit is contained in:
Liang Xiao 2026-03-25 06:15:33 +08:00 committed by GitHub
parent 659cd61cc8
commit 70b7d362dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 52 additions and 2 deletions

View file

@ -3089,6 +3089,20 @@
"dependencies": [], "dependencies": [],
"category": "essential" "category": "essential"
}, },
{
"id": "agent-metadata",
"name": "Agent Metadata",
"type": "config",
"path": ".opencode/config/agent-metadata.json",
"description": "Centralized agent metadata used for runtime resolution, registry management, and dependency discovery",
"tags": [
"config",
"agents",
"metadata"
],
"dependencies": [],
"category": "essential"
},
{ {
"id": "readme", "id": "readme",
"name": "README", "name": "README",
@ -3133,7 +3147,8 @@
"context:workflows-review", "context:workflows-review",
"context:system-context-guide", "context:system-context-guide",
"context:adding-skill-basics", "context:adding-skill-basics",
"config:env-example" "config:env-example",
"config:agent-metadata"
] ]
}, },
"developer": { "developer": {
@ -3179,6 +3194,7 @@
"context:clean-code", "context:clean-code",
"context:api-design", "context:api-design",
"config:env-example", "config:env-example",
"config:agent-metadata",
"config:readme", "config:readme",
"context:openagents-repo/*" "context:openagents-repo/*"
] ]
@ -3210,6 +3226,7 @@
"context:project-intelligence/*", "context:project-intelligence/*",
"context:adding-skill-basics", "context:adding-skill-basics",
"config:env-example", "config:env-example",
"config:agent-metadata",
"config:readme" "config:readme"
] ]
}, },
@ -3264,6 +3281,7 @@
"context:clean-code", "context:clean-code",
"context:api-design", "context:api-design",
"config:env-example", "config:env-example",
"config:agent-metadata",
"config:readme", "config:readme",
"context:openagents-repo/*" "context:openagents-repo/*"
] ]
@ -3338,6 +3356,7 @@
"context:frontmatter", "context:frontmatter",
"context:codebase-references", "context:codebase-references",
"config:env-example", "config:env-example",
"config:agent-metadata",
"config:readme" "config:readme"
], ],
"additionalPaths": [ "additionalPaths": [
@ -3347,7 +3366,7 @@
} }
}, },
"metadata": { "metadata": {
"lastUpdated": "2026-01-31", "lastUpdated": "2026-03-21",
"schemaVersion": "1.0.0" "schemaVersion": "1.0.0"
}, },
"subagents": { "subagents": {

View file

@ -62,6 +62,7 @@ test_essential_profile() {
"agent/subagents/core/documentation.md" "agent/subagents/core/documentation.md"
"command/context.md" "command/context.md"
"command/clean.md" "command/clean.md"
"config/agent-metadata.json"
"context/core/essential-patterns.md" "context/core/essential-patterns.md"
"context/project/project-context.md" "context/project/project-context.md"
) )
@ -96,6 +97,7 @@ test_developer_profile() {
"agent/subagents/code/build-agent.md" "agent/subagents/code/build-agent.md"
"command/commit.md" "command/commit.md"
"command/test.md" "command/test.md"
"config/agent-metadata.json"
"context/core/standards/code.md" "context/core/standards/code.md"
) )
@ -113,6 +115,29 @@ test_developer_profile() {
fi fi
} }
test_agent_metadata_installed() {
echo -e "\n${BOLD}Test: Agent Metadata Config Installation${NC}"
local install_dir="$TEST_DIR/metadata-test/.opencode"
bash "$REPO_ROOT/install.sh" developer --install-dir="$install_dir" > "$TEST_DIR/metadata.log" 2>&1
local metadata_file="$install_dir/config/agent-metadata.json"
if [ -f "$metadata_file" ]; then
pass "Installed agent metadata config"
else
fail "Missing agent metadata config"
return
fi
if command -v jq &> /dev/null && jq -e '.agents.openagent.name == "OpenAgent"' "$metadata_file" > /dev/null; then
pass "Agent metadata file contains expected agent entries"
else
fail "Agent metadata file missing expected OpenAgent entry"
fi
}
test_custom_install_dir() { test_custom_install_dir() {
echo -e "\n${BOLD}Test: Custom Installation Directory${NC}" echo -e "\n${BOLD}Test: Custom Installation Directory${NC}"
@ -264,6 +289,7 @@ main() {
test_help_and_list test_help_and_list
test_essential_profile test_essential_profile
test_developer_profile test_developer_profile
test_agent_metadata_installed
test_custom_install_dir test_custom_install_dir
test_skip_existing_files test_skip_existing_files
test_file_content_validity test_file_content_validity

View file

@ -81,6 +81,11 @@ test_fresh_install_piped() {
if echo "" | bash "$REPO_ROOT/install.sh" essential --install-dir="$install_dir" 2>&1 | grep -q "Installation complete"; then if echo "" | bash "$REPO_ROOT/install.sh" essential --install-dir="$install_dir" 2>&1 | grep -q "Installation complete"; then
if [ -d "$install_dir" ]; then if [ -d "$install_dir" ]; then
pass "Fresh install completed successfully via pipe" pass "Fresh install completed successfully via pipe"
if [ -f "$install_dir/config/agent-metadata.json" ]; then
pass "Fresh piped install included agent metadata config"
else
fail "Fresh piped install missing agent metadata config"
fi
else else
fail "Install reported success but directory not created" fail "Install reported success but directory not created"
fi fi