Fix adapters to follow the same template.

fix: restore adapter_build() contract, revert function renames

Both adapters now export adapter_build() and adapter_translate_*() as
the uniform public contract. scripts/build.sh sources one adapter and
calls adapter_build uniformly. Private helpers (_oc_*) and vocabulary
tables (cc_capability_to_tools, oc_capability_to_permission, etc.)
retain their prefixes. CC regression and OC unit tests all pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

fix(tests): restore test_oc_ prefix on adapter_build end-to-end test
This commit is contained in:
nunziati
2026-04-08 22:24:15 +00:00
parent 3f5d89bee3
commit e2767a7399
2 changed files with 12 additions and 13 deletions

View File

@@ -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