Skip to content

fix(install): resolve non-.md context paths like paths.json#252

Open
darrenhinde wants to merge 2 commits intomainfrom
fix/issue-251-paths-json-resolution
Open

fix(install): resolve non-.md context paths like paths.json#252
darrenhinde wants to merge 2 commits intomainfrom
fix/issue-251-paths-json-resolution

Conversation

@darrenhinde
Copy link
Owner

Summary

  • resolve_component_path() in install.sh was unconditionally appending .md to any context ID containing a /, so context:core/config/paths.json was looked up as .opencode/context/core/config/paths.json.md — a path that doesn't exist.
  • This caused the installer to emit ⚠ Could not find path for context:core/config/paths.json and count the component as failed, even though the file is present in both the repo and the registry.
  • Fix: try the .md path first (preserving existing behaviour for all markdown context files), then fall back to the bare path for non-markdown files (e.g. .json).

Root Cause

# Before — always appended .md, broke .json context files
jq_exec "first(.components.contexts[]? | select(.path == \".opencode/context/${component_id}.md\") | .path)" ...

Fix

# After — .md first, then bare path fallback
result=$(jq_exec "first(.components.contexts[]? | select(.path == \".opencode/context/${component_id}.md\") | .path)" ...)
if [ -z "$result" ] || [ "$result" = "null" ]; then
    result=$(jq_exec "first(.components.contexts[]? | select(.path == \".opencode/context/${component_id}\") | .path)" ...)
fi

Testing

Verified with jq directly against registry.json:

  • Old lookup (.md appended) → empty (broken)
  • New fallback (bare path) → ".opencode/context/core/config/paths.json"
  • Normal .md context (core/config/navigation) → still resolves correctly via first branch ✅

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.
Replace local arr=($var) with read -ra arr <<< "$var" in
install-context.sh to satisfy ShellCheck SC2206 and unblock CI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Could not find path

1 participant