فهرست منبع

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

* 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.

* fix(shellcheck): use read -ra for word-split array assignment (SC2206)

Replace local arr=($var) with read -ra arr <<< "$var" in
install-context.sh to satisfy ShellCheck SC2206 and unblock CI.
Darren Hinde 5 ماه پیش
والد
کامیت
10682353e9
2فایلهای تغییر یافته به همراه12 افزوده شده و 3 حذف شده
  1. 8 1
      install.sh
  2. 4 2
      plugins/claude-code/scripts/install-context.sh

+ 8 - 1
install.sh

@@ -313,7 +313,14 @@ resolve_component_path() {
     registry_key=$(get_registry_key "$component_type")
 
     if [ "$component_type" = "context" ] && [[ "$component_id" == */* ]]; then
-        jq_exec "first(.components.contexts[]? | select(.path == \".opencode/context/${component_id}.md\") | .path)" "$TEMP_DIR/registry.json"
+        # Try .md extension first (most context files), then fall back to the
+        # path as-is for non-markdown files (e.g. paths.json). Fixes #251.
+        local result
+        result=$(jq_exec "first(.components.contexts[]? | select(.path == \".opencode/context/${component_id}.md\") | .path)" "$TEMP_DIR/registry.json")
+        if [ -z "$result" ] || [ "$result" = "null" ]; then
+            result=$(jq_exec "first(.components.contexts[]? | select(.path == \".opencode/context/${component_id}\") | .path)" "$TEMP_DIR/registry.json")
+        fi
+        echo "$result"
         return
     fi
 

+ 4 - 2
plugins/claude-code/scripts/install-context.sh

@@ -72,7 +72,8 @@ check_dependencies() {
 }
 
 download_context() {
-  local categories=($1)
+  local categories
+  read -ra categories <<< "$1"
   local temp_dir
   temp_dir="$(mktemp -d)"
   # shellcheck disable=SC2064
@@ -113,7 +114,8 @@ download_context() {
 
 write_manifest() {
   local profile="$1"
-  local categories=($2)
+  local categories
+  read -ra categories <<< "$2"
   local commit="$3"
   local timestamp
   timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")