From 10682353e94b4387c014f6eb953ab61f836738b0 Mon Sep 17 00:00:00 2001 From: Darren Hinde <107584450+darrenhinde@users.noreply.github.com> Date: Wed, 11 Mar 2026 18:56:58 +0000 Subject: [PATCH] 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. --- install.sh | 9 ++++++++- plugins/claude-code/scripts/install-context.sh | 6 ++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 4c8a853..c08b37b 100755 --- a/install.sh +++ b/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 diff --git a/plugins/claude-code/scripts/install-context.sh b/plugins/claude-code/scripts/install-context.sh index 9c6b1e9..34cc2ba 100755 --- a/plugins/claude-code/scripts/install-context.sh +++ b/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")