Skip to content

Commit a17a6b4

Browse files
committed
fix(install): resolve non-.md context paths like paths.json (closes #251)
resolve_component_path() was appending .md to all slash-containing context IDs, so context:core/config/paths.json was looked up as paths.json.md and returned empty, triggering the 'Could not find path' warning on install. Now tries the .md path first (preserving existing behaviour for all markdown context files), then falls back to the bare path for non-markdown files.
1 parent 035dc59 commit a17a6b4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

install.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,14 @@ resolve_component_path() {
313313
registry_key=$(get_registry_key "$component_type")
314314

315315
if [ "$component_type" = "context" ] && [[ "$component_id" == */* ]]; then
316-
jq_exec "first(.components.contexts[]? | select(.path == \".opencode/context/${component_id}.md\") | .path)" "$TEMP_DIR/registry.json"
316+
# Try .md extension first (most context files), then fall back to the
317+
# path as-is for non-markdown files (e.g. paths.json). Fixes #251.
318+
local result
319+
result=$(jq_exec "first(.components.contexts[]? | select(.path == \".opencode/context/${component_id}.md\") | .path)" "$TEMP_DIR/registry.json")
320+
if [ -z "$result" ] || [ "$result" = "null" ]; then
321+
result=$(jq_exec "first(.components.contexts[]? | select(.path == \".opencode/context/${component_id}\") | .path)" "$TEMP_DIR/registry.json")
322+
fi
323+
echo "$result"
317324
return
318325
fi
319326

0 commit comments

Comments
 (0)