diff --git a/adapters/claude-code/adapter.sh b/adapters/claude-code/adapter.sh index 57a65ad..38e7ff9 100755 --- a/adapters/claude-code/adapter.sh +++ b/adapters/claude-code/adapter.sh @@ -211,10 +211,9 @@ adapter_translate_agents() { local caps; caps="$(parse_capabilities "$agent")" # Build tools allowlist by expanding each capability. - # read → Read (only); Glob and Grep are appended at the end if read is present. - local tools="" has_read=0 + # read → Read, Glob, Grep; other capabilities follow. + local tools="" for cap in $caps; do - [[ "$cap" == "read" ]] && has_read=1 local expansion; expansion="$(cc_capability_to_tools "$cap")" [[ -n "$expansion" ]] || continue for tool in $expansion; do @@ -224,11 +223,11 @@ adapter_translate_agents() { tools="$tools, $tool" fi done + # If this was "read", immediately append Glob and Grep + if [[ "$cap" == "read" ]]; then + tools="$tools, Glob, Grep" + fi done - # Append Glob and Grep after all other tools when read capability is present - if [[ $has_read -eq 1 ]]; then - tools="$tools, Glob, Grep" - fi local out_file="$out_dir/$(basename "$agent")" { diff --git a/adapters/opencode/adapter.sh b/adapters/opencode/adapter.sh index 1f13a46..8aab33f 100755 --- a/adapters/opencode/adapter.sh +++ b/adapters/opencode/adapter.sh @@ -7,7 +7,7 @@ # opencode expects in the user's vault. # ============================================================================= -FRAMEWORK="opencode" +OC_FRAMEWORK="opencode" # Capability → opencode permission key. Returns the permission key to set to # "allow" for each capability, or empty string for capabilities that have no @@ -85,7 +85,7 @@ adapter_translate_references() { mkdir -p "$out" for f in "$src"/*.md; do [[ -f "$f" ]] || continue - should_include "$f" "$FRAMEWORK" || continue + should_include "$f" "$OC_FRAMEWORK" || continue cp "$f" "$out/" done } @@ -97,7 +97,7 @@ adapter_translate_skills() { [[ -d "$src" ]] || return 0 for skill_dir in "$src"/*/; do [[ -f "${skill_dir}SKILL.md" ]] || continue - should_include "${skill_dir}SKILL.md" "$FRAMEWORK" || continue + should_include "${skill_dir}SKILL.md" "$OC_FRAMEWORK" || continue local name; name="$(basename "$skill_dir")" local out="$dst/.opencode/skills/$name" mkdir -p "$out" @@ -148,7 +148,7 @@ adapter_translate_agents() { while IFS= read -r agent; do [[ -f "$agent" ]] || continue - should_include "$agent" "$FRAMEWORK" || continue + should_include "$agent" "$OC_FRAMEWORK" || continue local model_raw; model_raw="$(parse_frontmatter "$agent" model)" local mode_raw; mode_raw="$(parse_frontmatter "$agent" mode)" @@ -202,7 +202,7 @@ _oc_hook_registry_json() { local entries='[]' while IFS= read -r yaml; do [[ -f "$yaml" ]] || continue - should_include "$yaml" "$FRAMEWORK" || continue + should_include "$yaml" "$OC_FRAMEWORK" || continue local meta; meta="$(parse_hook_yaml "$yaml")" local name; name="$(echo "$meta" | grep '^name=' | head -1 | cut -d= -f2-)" local script; script="$(echo "$meta" | grep '^script=' | head -1 | cut -d= -f2-)" @@ -246,7 +246,7 @@ adapter_translate_hooks() { local have_any=0 while IFS= read -r yaml; do [[ -f "$yaml" ]] || continue - should_include "$yaml" "$FRAMEWORK" || continue + should_include "$yaml" "$OC_FRAMEWORK" || continue local meta; meta="$(parse_hook_yaml "$yaml")" local script; script="$(echo "$meta" | grep '^script=' | head -1 | cut -d= -f2-)" [[ -f "$src/$script" ]] || continue