mirror of
https://github.com/gnekt/My-Brain-Is-Full-Crew.git
synced 2026-09-17 10:14:04 +00:00
Fix claude-specific references in agents, skills and references
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
# =============================================================================
|
||||
|
||||
CC_PLATFORM="claude-code"
|
||||
CC_FW_DIR="claude"
|
||||
CC_DISPATCHER="CLAUDE.md"
|
||||
|
||||
# Capability → CC tools mapping. Each capability expands into one or more
|
||||
# Claude Code tool names. The expansion is order-preserving.
|
||||
@@ -168,6 +170,7 @@ adapter_translate_hooks() {
|
||||
# Copy the bash script
|
||||
cp "$src/$script" "$out_dir/$script"
|
||||
chmod +x "$out_dir/$script"
|
||||
rewrite_platform_paths "$out_dir/$script" "$CC_FW_DIR" "$CC_DISPATCHER"
|
||||
|
||||
# Generate the wrapper
|
||||
local wrapper_file="$out_dir/${name}-wrapper.sh"
|
||||
@@ -253,6 +256,7 @@ adapter_translate_agents() {
|
||||
echo "---"
|
||||
agent_body "$agent"
|
||||
} > "$out_file"
|
||||
rewrite_platform_paths "$out_file" "$CC_FW_DIR" "$CC_DISPATCHER"
|
||||
done < <(enumerate_agents "$src")
|
||||
}
|
||||
|
||||
@@ -268,6 +272,7 @@ adapter_translate_skills() {
|
||||
local out="$dst/.claude/skills/$name"
|
||||
mkdir -p "$out"
|
||||
cp "${skill_dir}SKILL.md" "$out/SKILL.md"
|
||||
rewrite_platform_paths "$out/SKILL.md" "$CC_FW_DIR" "$CC_DISPATCHER"
|
||||
done
|
||||
}
|
||||
|
||||
@@ -282,6 +287,7 @@ adapter_translate_references() {
|
||||
[[ -f "$f" ]] || continue
|
||||
should_include "$f" "$CC_PLATFORM" || continue
|
||||
cp "$f" "$out/"
|
||||
rewrite_platform_paths "$out/$(basename "$f")" "$CC_FW_DIR" "$CC_DISPATCHER"
|
||||
done
|
||||
}
|
||||
|
||||
@@ -292,6 +298,7 @@ adapter_translate_dispatcher() {
|
||||
[[ -f "$src" ]] || return 0
|
||||
mkdir -p "$dst"
|
||||
cp "$src" "$dst/CLAUDE.md"
|
||||
rewrite_platform_paths "$dst/CLAUDE.md" "$CC_FW_DIR" "$CC_DISPATCHER"
|
||||
}
|
||||
|
||||
# adapter_build <source_dir> <dest_dir>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# =============================================================================
|
||||
|
||||
GEMINI_PLATFORM="gemini-cli"
|
||||
GEMINI_FW_DIR=".gemini"
|
||||
GEMINI_FW_DIR="gemini"
|
||||
GEMINI_DISPATCHER="GEMINI.md"
|
||||
|
||||
# Capability → Gemini CLI tool names. Returns space-separated tool names.
|
||||
@@ -72,18 +72,20 @@ adapter_translate_dispatcher() {
|
||||
[[ -f "$src" ]] || return 0
|
||||
mkdir -p "$dst"
|
||||
cp "$src" "$dst/$GEMINI_DISPATCHER"
|
||||
rewrite_platform_paths "$dst/$GEMINI_DISPATCHER" "$GEMINI_FW_DIR" "$GEMINI_DISPATCHER"
|
||||
}
|
||||
|
||||
# adapter_translate_references <source_refs_dir> <dest_root>
|
||||
adapter_translate_references() {
|
||||
local src="$1" dst="$2"
|
||||
[[ -d "$src" ]] || return 0
|
||||
local out="$dst/$GEMINI_FW_DIR/references"
|
||||
local out="$dst/.$GEMINI_FW_DIR/references"
|
||||
mkdir -p "$out"
|
||||
for f in "$src"/*.md; do
|
||||
[[ -f "$f" ]] || continue
|
||||
should_include "$f" "$GEMINI_PLATFORM" || continue
|
||||
cp "$f" "$out/"
|
||||
rewrite_platform_paths "$out/$(basename "$f")" "$GEMINI_FW_DIR" "$GEMINI_DISPATCHER"
|
||||
done
|
||||
}
|
||||
|
||||
@@ -95,9 +97,10 @@ adapter_translate_skills() {
|
||||
[[ -f "${skill_dir}SKILL.md" ]] || continue
|
||||
should_include "${skill_dir}SKILL.md" "$GEMINI_PLATFORM" || continue
|
||||
local name; name="$(basename "$skill_dir")"
|
||||
local out="$dst/$GEMINI_FW_DIR/skills/$name"
|
||||
local out="$dst/.$GEMINI_FW_DIR/skills/$name"
|
||||
mkdir -p "$out"
|
||||
cp "${skill_dir}SKILL.md" "$out/SKILL.md"
|
||||
rewrite_platform_paths "$out/SKILL.md" "$GEMINI_FW_DIR" "$GEMINI_DISPATCHER"
|
||||
done
|
||||
}
|
||||
|
||||
@@ -105,7 +108,7 @@ adapter_translate_skills() {
|
||||
adapter_translate_agents() {
|
||||
local src="$1" dst="$2"
|
||||
[[ -d "$src" ]] || return 0
|
||||
local out_dir="$dst/$GEMINI_FW_DIR/agents"
|
||||
local out_dir="$dst/.$GEMINI_FW_DIR/agents"
|
||||
mkdir -p "$out_dir"
|
||||
|
||||
while IFS= read -r agent; do
|
||||
@@ -147,6 +150,7 @@ adapter_translate_agents() {
|
||||
echo "---"
|
||||
agent_body "$agent"
|
||||
} > "$out_file"
|
||||
rewrite_platform_paths "$out_file" "$GEMINI_FW_DIR" "$GEMINI_DISPATCHER"
|
||||
done < <(enumerate_agents "$src")
|
||||
}
|
||||
|
||||
@@ -155,7 +159,7 @@ adapter_translate_hooks() {
|
||||
local src="$1" dst="$2"
|
||||
[[ -d "$src" ]] || return 0
|
||||
|
||||
local hooks_out="$dst/$GEMINI_FW_DIR/hooks"
|
||||
local hooks_out="$dst/.$GEMINI_FW_DIR/hooks"
|
||||
mkdir -p "$hooks_out"
|
||||
|
||||
local tpl_dir; tpl_dir="$(dirname "${BASH_SOURCE[0]}")/templates"
|
||||
@@ -177,6 +181,7 @@ adapter_translate_hooks() {
|
||||
# Copy the hook script
|
||||
cp "$src/$script" "$hooks_out/$script"
|
||||
chmod +x "$hooks_out/$script"
|
||||
rewrite_platform_paths "$hooks_out/$script" "$GEMINI_FW_DIR" "$GEMINI_DISPATCHER"
|
||||
|
||||
# Generate wrapper script from template
|
||||
local wrapper_name="${hook_name}-wrapper.sh"
|
||||
@@ -199,7 +204,7 @@ adapter_translate_hooks() {
|
||||
fi
|
||||
|
||||
# Add to hooks JSON
|
||||
local hook_cmd="bash $GEMINI_FW_DIR/hooks/$wrapper_name"
|
||||
local hook_cmd="bash .$GEMINI_FW_DIR/hooks/$wrapper_name"
|
||||
if [[ -n "$matcher" ]]; then
|
||||
hooks_json="$(echo "$hooks_json" | jq \
|
||||
--arg ev "$gemini_event" \
|
||||
@@ -220,7 +225,7 @@ adapter_translate_hooks() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "$hooks_json" | jq '.' > "$dst/$GEMINI_FW_DIR/_hooks.json"
|
||||
echo "$hooks_json" | jq '.' > "$dst/.$GEMINI_FW_DIR/_hooks.json"
|
||||
}
|
||||
|
||||
# adapter_translate_mcp <source_mcp_dir> <dest_root>
|
||||
@@ -229,7 +234,7 @@ adapter_translate_mcp() {
|
||||
local yaml="$src/servers.yaml"
|
||||
[[ -f "$yaml" ]] || return 0
|
||||
|
||||
mkdir -p "$dst/$GEMINI_FW_DIR"
|
||||
mkdir -p "$dst/.$GEMINI_FW_DIR"
|
||||
|
||||
local json='{}'
|
||||
local current_name="" current_cmd="" current_url="" current_type=""
|
||||
@@ -268,14 +273,14 @@ adapter_translate_mcp() {
|
||||
done < "$yaml"
|
||||
_gemini_flush_mcp
|
||||
|
||||
echo "$json" | jq '.' > "$dst/$GEMINI_FW_DIR/_mcp.json"
|
||||
echo "$json" | jq '.' > "$dst/.$GEMINI_FW_DIR/_mcp.json"
|
||||
unset -f _gemini_flush_mcp
|
||||
}
|
||||
|
||||
# adapter_finalize <source_root> <dest_root>
|
||||
adapter_finalize() {
|
||||
local src="$1" dst="$2"
|
||||
local gemini_dir="$dst/$GEMINI_FW_DIR"
|
||||
local gemini_dir="$dst/.$GEMINI_FW_DIR"
|
||||
local hooks_tmp="$gemini_dir/_hooks.json"
|
||||
local mcp_tmp="$gemini_dir/_mcp.json"
|
||||
local settings="$gemini_dir/settings.json"
|
||||
|
||||
@@ -20,19 +20,16 @@ MODEL_VOCAB="low mid high"
|
||||
|
||||
# ── Path rewriting ───────────────────────────────────────────────────────────
|
||||
|
||||
# rewrite_framework_paths <file> <target_fw_dir> <target_dispatcher>
|
||||
# Rewrites source-canonical framework path references in a text file in-place.
|
||||
# Source files use .claude/ and CLAUDE.md as the canonical form.
|
||||
# Call this after copying any text file from source to dist for non-CC frameworks.
|
||||
# No-op when target_fw_dir is "claude" (i.e. building for claude-code, whose
|
||||
# canonical output paths already match the source form — no rewrite needed).
|
||||
rewrite_framework_paths() {
|
||||
local file="$1" tgt_dir="$2" tgt_dispatcher="$3"
|
||||
[[ "$tgt_dir" == "claude" && "$tgt_dispatcher" == "CLAUDE.md" ]] && return 0
|
||||
sed -i \
|
||||
-e "s|\.claude/|.${tgt_dir}/|g" \
|
||||
-e "s|CLAUDE\.md|${tgt_dispatcher}|g" \
|
||||
"$file"
|
||||
# rewrite_platform_paths <file> <platform_dir> <dispatcher_name>
|
||||
# Rewrites platform-neutral path references in a text file.
|
||||
# Source files use .platform/ and DISPATCHER.md as neutral placeholders.
|
||||
# Each adapter calls this after copying any text file from source to dist,
|
||||
# passing its platform-specific directory name and dispatcher filename.
|
||||
rewrite_platform_paths() {
|
||||
local file="$1" platform_dir="$2" dispatcher="$3"
|
||||
local tmp; tmp="$(mktemp)"
|
||||
sed "s|\.platform/|.${platform_dir}/|g; s|DISPATCHER\.md|${dispatcher}|g" "$file" > "$tmp"
|
||||
mv "$tmp" "$file"
|
||||
}
|
||||
|
||||
# ── Parsing helpers ──────────────────────────────────────────────────────────
|
||||
|
||||
@@ -79,7 +79,7 @@ adapter_translate_dispatcher() {
|
||||
[[ -f "$src" ]] || return 0
|
||||
mkdir -p "$dst"
|
||||
cp "$src" "$dst/AGENTS.md"
|
||||
rewrite_framework_paths "$dst/AGENTS.md" "$OC_FW_DIR" "$OC_DISPATCHER"
|
||||
rewrite_platform_paths "$dst/AGENTS.md" "$OC_FW_DIR" "$OC_DISPATCHER"
|
||||
}
|
||||
|
||||
# adapter_translate_references <source_refs_dir> <dest_root>
|
||||
@@ -93,7 +93,7 @@ adapter_translate_references() {
|
||||
[[ -f "$f" ]] || continue
|
||||
should_include "$f" "$OC_PLATFORM" || continue
|
||||
cp "$f" "$out/"
|
||||
rewrite_framework_paths "$out/$(basename "$f")" "$OC_FW_DIR" "$OC_DISPATCHER"
|
||||
rewrite_platform_paths "$out/$(basename "$f")" "$OC_FW_DIR" "$OC_DISPATCHER"
|
||||
done
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ adapter_translate_skills() {
|
||||
local out="$dst/.opencode/skills/$name"
|
||||
mkdir -p "$out"
|
||||
cp "${skill_dir}SKILL.md" "$out/SKILL.md"
|
||||
rewrite_framework_paths "$out/SKILL.md" "$OC_FW_DIR" "$OC_DISPATCHER"
|
||||
rewrite_platform_paths "$out/SKILL.md" "$OC_FW_DIR" "$OC_DISPATCHER"
|
||||
done
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ adapter_translate_agents() {
|
||||
echo ""
|
||||
agent_body "$agent"
|
||||
} > "$out_file"
|
||||
rewrite_framework_paths "$out_file" "$OC_FW_DIR" "$OC_DISPATCHER"
|
||||
rewrite_platform_paths "$out_file" "$OC_FW_DIR" "$OC_DISPATCHER"
|
||||
done < <(enumerate_agents "$src")
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ adapter_translate_hooks() {
|
||||
[[ -f "$src/$script" ]] || continue
|
||||
cp "$src/$script" "$hooks_out/$script"
|
||||
chmod +x "$hooks_out/$script"
|
||||
rewrite_framework_paths "$hooks_out/$script" "$OC_FW_DIR" "$OC_DISPATCHER"
|
||||
rewrite_platform_paths "$hooks_out/$script" "$OC_FW_DIR" "$OC_DISPATCHER"
|
||||
have_any=1
|
||||
done < <(enumerate_hooks "$src")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user