fix: correct hook output schemas and marketplace registration
Stop hook was emitting hookSpecificOutput with hookEventName=Stop, which is not a valid hookSpecificOutput type (only PreToolUse, PostToolUse, UserPromptSubmit are). Changed to systemMessage. SessionStart still uses additionalContext (confirmed working). Stale /buddymon-fight and /buddymon-catch references in session-start.sh updated to /buddymon fight and /buddymon catch. install.sh now creates a full circuitforge marketplace with marketplace.json so CC can validate the plugin name against the index before loading. Removed invalid extraKnownMarketplaces local source (only github/git valid).
This commit is contained in:
parent
9440c8c0b2
commit
507a2fc4a9
3 changed files with 55 additions and 35 deletions
|
|
@ -93,10 +93,10 @@ if ch:
|
||||||
enc_display=$(echo "${enc}" | python3 -c "import json,sys; print(json.load(sys.stdin).get('display','?'))")
|
enc_display=$(echo "${enc}" | python3 -c "import json,sys; print(json.load(sys.stdin).get('display','?'))")
|
||||||
enc_strength=$(echo "${enc}" | python3 -c "import json,sys; print(json.load(sys.stdin).get('current_strength',100))")
|
enc_strength=$(echo "${enc}" | python3 -c "import json,sys; print(json.load(sys.stdin).get('current_strength',100))")
|
||||||
ctx+="⚠️ **Unresolved encounter from last session:** ${enc_display} (strength: ${enc_strength}%)\n"
|
ctx+="⚠️ **Unresolved encounter from last session:** ${enc_display} (strength: ${enc_strength}%)\n"
|
||||||
ctx+="Run \`/buddymon-fight\` or \`/buddymon-catch\` to resolve it.\n\n"
|
ctx+="Run \`/buddymon fight\` or \`/buddymon catch\` to resolve it.\n\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ctx+="*Bug monsters appear from error output. Use \`/buddymon-fight\` or \`/buddymon-catch\`.*"
|
ctx+="*Bug monsters appear from error output. Use \`/buddymon fight\` or \`/buddymon catch\`.*"
|
||||||
|
|
||||||
echo "${ctx}"
|
echo "${ctx}"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,6 @@ ACTIVE_ID=$(buddymon_get_active)
|
||||||
SESSION_XP=$(buddymon_get_session_xp)
|
SESSION_XP=$(buddymon_get_session_xp)
|
||||||
|
|
||||||
if [[ -z "${ACTIVE_ID}" ]] || [[ "${SESSION_XP}" -eq 0 ]]; then
|
if [[ -z "${ACTIVE_ID}" ]] || [[ "${SESSION_XP}" -eq 0 ]]; then
|
||||||
# Nothing to report
|
|
||||||
cat << 'EOF'
|
|
||||||
{"hookSpecificOutput": {"hookEventName": "Stop", "additionalContext": ""}}
|
|
||||||
EOF
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -107,12 +103,7 @@ SUMMARY_JSON=$(python3 -c "import json,sys; print(json.dumps(sys.argv[1]))" "${S
|
||||||
[[ -z "${SUMMARY_JSON}" ]] && SUMMARY_JSON='""'
|
[[ -z "${SUMMARY_JSON}" ]] && SUMMARY_JSON='""'
|
||||||
|
|
||||||
cat << EOF
|
cat << EOF
|
||||||
{
|
{"systemMessage": ${SUMMARY_JSON}}
|
||||||
"hookSpecificOutput": {
|
|
||||||
"hookEventName": "Stop",
|
|
||||||
"additionalContext": ${SUMMARY_JSON}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
||||||
75
install.sh
75
install.sh
|
|
@ -9,7 +9,7 @@
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
PLUGIN_NAME="buddymon"
|
PLUGIN_NAME="buddymon"
|
||||||
MARKETPLACE="local"
|
MARKETPLACE="circuitforge"
|
||||||
VERSION="0.1.1"
|
VERSION="0.1.1"
|
||||||
REPO_DIR="$(cd "$(dirname "$0")" && pwd)"
|
REPO_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
|
|
||||||
|
|
@ -82,11 +82,18 @@ if key in d.get('enabledPlugins', {}):
|
||||||
PYEOF
|
PYEOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove marketplace plugin symlink
|
# Remove from known_marketplaces.json
|
||||||
MARKETPLACE_PLUGIN_DIR="${PLUGINS_DIR}/marketplaces/${MARKETPLACE}/plugins/${PLUGIN_NAME}"
|
KNOWN_MARKETPLACES="${PLUGINS_DIR}/known_marketplaces.json"
|
||||||
if [[ -L "${MARKETPLACE_PLUGIN_DIR}/${PLUGIN_NAME}" ]]; then
|
if [[ -f "${KNOWN_MARKETPLACES}" ]]; then
|
||||||
rm "${MARKETPLACE_PLUGIN_DIR}/${PLUGIN_NAME}"
|
python3 << PYEOF
|
||||||
ok "Removed marketplace symlink"
|
import json
|
||||||
|
f = '${KNOWN_MARKETPLACES}'
|
||||||
|
d = json.load(open(f))
|
||||||
|
if '${MARKETPLACE}' in d:
|
||||||
|
del d['${MARKETPLACE}']
|
||||||
|
json.dump(d, open(f, 'w'), indent=2)
|
||||||
|
print(" Removed '${MARKETPLACE}' from known_marketplaces.json")
|
||||||
|
PYEOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
@ -107,39 +114,61 @@ install() {
|
||||||
[[ -f "${REPO_DIR}/hooks/hooks.json" ]] \
|
[[ -f "${REPO_DIR}/hooks/hooks.json" ]] \
|
||||||
|| die "Missing hooks/hooks.json"
|
|| die "Missing hooks/hooks.json"
|
||||||
|
|
||||||
# Register 'local' marketplace so CC doesn't GC the cache entry on reload
|
# Create circuitforge marketplace (CC validates plugin name against marketplace index)
|
||||||
KNOWN_MARKETPLACES="${PLUGINS_DIR}/known_marketplaces.json"
|
|
||||||
MARKETPLACE_DIR="${PLUGINS_DIR}/marketplaces/${MARKETPLACE}"
|
MARKETPLACE_DIR="${PLUGINS_DIR}/marketplaces/${MARKETPLACE}"
|
||||||
|
mkdir -p "${MARKETPLACE_DIR}/.claude-plugin"
|
||||||
|
mkdir -p "${MARKETPLACE_DIR}/plugins"
|
||||||
|
|
||||||
|
if [[ ! -f "${MARKETPLACE_DIR}/.claude-plugin/marketplace.json" ]]; then
|
||||||
|
python3 << PYEOF
|
||||||
|
import json
|
||||||
|
f = '${MARKETPLACE_DIR}/.claude-plugin/marketplace.json'
|
||||||
|
d = {
|
||||||
|
"\$schema": "https://anthropic.com/claude-code/marketplace.schema.json",
|
||||||
|
"name": "${MARKETPLACE}",
|
||||||
|
"description": "CircuitForge LLC Claude Code plugins",
|
||||||
|
"owner": {"name": "CircuitForge LLC", "email": "hello@circuitforge.tech"},
|
||||||
|
"plugins": [{
|
||||||
|
"name": "${PLUGIN_NAME}",
|
||||||
|
"description": "Collectible creatures discovered through coding — commit streaks, bug fights, and session challenges",
|
||||||
|
"author": {"name": "CircuitForge LLC", "email": "hello@circuitforge.tech"},
|
||||||
|
"source": "./plugins/${PLUGIN_NAME}",
|
||||||
|
"category": "productivity",
|
||||||
|
"homepage": "https://git.opensourcesolarpunk.com/Circuit-Forge/buddymon"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
json.dump(d, open(f, 'w'), indent=2)
|
||||||
|
PYEOF
|
||||||
|
ok "Created ${MARKETPLACE} marketplace"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Symlink repo into marketplace plugins dir
|
||||||
|
if [[ ! -L "${MARKETPLACE_DIR}/plugins/${PLUGIN_NAME}" ]]; then
|
||||||
|
ln -sf "${REPO_DIR}" "${MARKETPLACE_DIR}/plugins/${PLUGIN_NAME}"
|
||||||
|
ok "Linked into marketplace plugins dir"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Register marketplace in known_marketplaces.json
|
||||||
python3 << PYEOF
|
python3 << PYEOF
|
||||||
import json, os
|
import json, os
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
|
f = '${PLUGINS_DIR}/known_marketplaces.json'
|
||||||
f = '${KNOWN_MARKETPLACES}'
|
|
||||||
try:
|
try:
|
||||||
d = json.load(open(f))
|
d = json.load(open(f))
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
d = {}
|
d = {}
|
||||||
|
if '${MARKETPLACE}' not in d:
|
||||||
if 'local' not in d:
|
d['${MARKETPLACE}'] = {
|
||||||
d['local'] = {
|
|
||||||
"source": {"source": "local", "path": '${MARKETPLACE_DIR}'},
|
"source": {"source": "local", "path": '${MARKETPLACE_DIR}'},
|
||||||
"installLocation": '${MARKETPLACE_DIR}',
|
"installLocation": '${MARKETPLACE_DIR}',
|
||||||
"lastUpdated": datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%S.000Z'),
|
"lastUpdated": datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%S.000Z'),
|
||||||
}
|
}
|
||||||
json.dump(d, open(f, 'w'), indent=2)
|
json.dump(d, open(f, 'w'), indent=2)
|
||||||
print(" Registered 'local' marketplace")
|
print(" Registered '${MARKETPLACE}' in known_marketplaces.json")
|
||||||
else:
|
else:
|
||||||
print(" 'local' marketplace already registered")
|
print(" '${MARKETPLACE}' marketplace already registered")
|
||||||
PYEOF
|
PYEOF
|
||||||
|
|
||||||
# Symlink repo into marketplace plugins dir (so CC can discover it)
|
|
||||||
MARKETPLACE_PLUGIN_DIR="${MARKETPLACE_DIR}/plugins/${PLUGIN_NAME}"
|
|
||||||
mkdir -p "${MARKETPLACE_PLUGIN_DIR}"
|
|
||||||
if [[ ! -L "${MARKETPLACE_PLUGIN_DIR}/${PLUGIN_NAME}" ]]; then
|
|
||||||
ln -sf "${REPO_DIR}" "${MARKETPLACE_PLUGIN_DIR}/${PLUGIN_NAME}"
|
|
||||||
ok "Linked into marketplace dir"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create cache parent dir
|
# Create cache parent dir
|
||||||
mkdir -p "$(dirname "${CACHE_DIR}")"
|
mkdir -p "$(dirname "${CACHE_DIR}")"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue