mirror of
https://github.com/xr843/Master-skill.git
synced 2026-05-10 13:26:25 +00:00
f3472d6254
Add support for 5 platforms beyond NPX: - Claude Code: .claude-plugin/plugin.json + marketplace.json - Cursor: .cursor-plugin/plugin.json + hooks-cursor.json - Codex CLI: .codex/INSTALL.md with symlink setup - OpenCode: .opencode/INSTALL.md with plugin config - Gemini CLI: gemini-extension.json + GEMINI.md Infrastructure: - SessionStart hook with platform detection (Claude Code, Cursor, Copilot CLI) that injects available masters list - Cross-platform run-hook.cmd polyglot wrapper (Windows + Unix) - .version-bump.json for unified version management across all platform config files - Update README/README_EN with multi-platform install instructions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
48 lines
1.7 KiB
Bash
Executable File
48 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Master-skill session-start hook
|
|
# Injects available masters list into conversation context on session start.
|
|
# Compatible with Claude Code, Cursor, and Copilot CLI.
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PLUGIN_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
|
|
# Build masters list from prebuilt/ directory
|
|
MASTERS_LIST=""
|
|
for dir in "$PLUGIN_ROOT"/prebuilt/*/; do
|
|
[ -d "$dir" ] || continue
|
|
name=$(basename "$dir")
|
|
[ "$name" = "compare" ] && continue
|
|
skill_file="$dir/SKILL.md"
|
|
if [ -f "$skill_file" ]; then
|
|
# Extract lineage from frontmatter
|
|
lineage=$(grep '^lineage:' "$skill_file" 2>/dev/null | head -1 | sed 's/^lineage: *//' || echo "")
|
|
if [ -n "$lineage" ]; then
|
|
MASTERS_LIST="${MASTERS_LIST} /${name} — ${lineage}\n"
|
|
fi
|
|
fi
|
|
done
|
|
|
|
# Build the context message
|
|
CONTEXT="Master-skill plugin loaded. Available Buddhist masters:
|
|
${MASTERS_LIST} /compare-masters — multi-tradition comparison
|
|
/create-master — generate new master from FoJin knowledge graph
|
|
|
|
All doctrinal responses include CBETA citations linked to fojin.app."
|
|
|
|
# Escape for JSON embedding
|
|
CONTEXT_ESCAPED=$(echo "$CONTEXT" | python3 -c "import sys,json; print(json.dumps(sys.stdin.read()))" 2>/dev/null || echo "\"$CONTEXT\"")
|
|
|
|
# Platform detection and output format
|
|
if [ -n "${CURSOR_PLUGIN_ROOT:-}" ]; then
|
|
# Cursor format
|
|
echo "{\"additional_context\": $CONTEXT_ESCAPED}"
|
|
elif [ -n "${CLAUDE_PLUGIN_ROOT:-}" ] && [ -z "${COPILOT_CLI:-}" ]; then
|
|
# Claude Code format
|
|
echo "{\"hookSpecificOutput\": {\"additionalContext\": $CONTEXT_ESCAPED}}"
|
|
else
|
|
# Copilot CLI / SDK standard format
|
|
echo "{\"additionalContext\": $CONTEXT_ESCAPED}"
|
|
fi
|