fix: plugin registration and reload survival
- plugin.json: flatten repository to string, remove extra fields that failed CC schema validation (caused 'Unknown skill' on reload) - hooks.json: remove escaped quotes from command paths (matched hookify reference implementation) - install.sh: register 'local' marketplace in known_marketplaces.json so CC doesn't GC the cache symlink on /reload-plugins
This commit is contained in:
parent
804d1f3887
commit
b81f39bfcd
3 changed files with 46 additions and 11 deletions
|
|
@ -1,16 +1,11 @@
|
||||||
{
|
{
|
||||||
"name": "buddymon",
|
"name": "buddymon",
|
||||||
"version": "0.1.0",
|
|
||||||
"description": "Collectible creatures discovered through coding — commit streaks, bug fights, and session challenges",
|
"description": "Collectible creatures discovered through coding — commit streaks, bug fights, and session challenges",
|
||||||
|
"version": "0.1.0",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "CircuitForge LLC",
|
"name": "CircuitForge LLC",
|
||||||
"email": "hello@circuitforge.tech",
|
"email": "hello@circuitforge.tech"
|
||||||
"url": "https://circuitforge.tech"
|
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": "https://git.opensourcesolarpunk.com/Circuit-Forge/buddymon"
|
||||||
"primary": "https://git.opensourcesolarpunk.com/Circuit-Forge/buddymon",
|
|
||||||
"github": "https://github.com/CircuitForgeLLC/buddymon",
|
|
||||||
"codeberg": "https://codeberg.org/CircuitForge/buddymon"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
"hooks": [
|
"hooks": [
|
||||||
{
|
{
|
||||||
"type": "command",
|
"type": "command",
|
||||||
"command": "bash \"${CLAUDE_PLUGIN_ROOT}/hooks-handlers/session-start.sh\"",
|
"command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks-handlers/session-start.sh",
|
||||||
"timeout": 10
|
"timeout": 10
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
"hooks": [
|
"hooks": [
|
||||||
{
|
{
|
||||||
"type": "command",
|
"type": "command",
|
||||||
"command": "python3 \"${CLAUDE_PLUGIN_ROOT}/hooks-handlers/post-tool-use.py\"",
|
"command": "python3 ${CLAUDE_PLUGIN_ROOT}/hooks-handlers/post-tool-use.py",
|
||||||
"timeout": 10
|
"timeout": 10
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
"hooks": [
|
"hooks": [
|
||||||
{
|
{
|
||||||
"type": "command",
|
"type": "command",
|
||||||
"command": "bash \"${CLAUDE_PLUGIN_ROOT}/hooks-handlers/session-stop.sh\"",
|
"command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks-handlers/session-stop.sh",
|
||||||
"timeout": 10
|
"timeout": 10
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
40
install.sh
40
install.sh
|
|
@ -82,6 +82,13 @@ if key in d.get('enabledPlugins', {}):
|
||||||
PYEOF
|
PYEOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Remove marketplace plugin symlink
|
||||||
|
MARKETPLACE_PLUGIN_DIR="${PLUGINS_DIR}/marketplaces/${MARKETPLACE}/plugins/${PLUGIN_NAME}"
|
||||||
|
if [[ -L "${MARKETPLACE_PLUGIN_DIR}/${PLUGIN_NAME}" ]]; then
|
||||||
|
rm "${MARKETPLACE_PLUGIN_DIR}/${PLUGIN_NAME}"
|
||||||
|
ok "Removed marketplace symlink"
|
||||||
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "✓ ${PLUGIN_KEY} uninstalled. Restart Claude Code to apply."
|
echo "✓ ${PLUGIN_KEY} uninstalled. Restart Claude Code to apply."
|
||||||
}
|
}
|
||||||
|
|
@ -100,6 +107,39 @@ 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
|
||||||
|
KNOWN_MARKETPLACES="${PLUGINS_DIR}/known_marketplaces.json"
|
||||||
|
MARKETPLACE_DIR="${PLUGINS_DIR}/marketplaces/${MARKETPLACE}"
|
||||||
|
python3 << PYEOF
|
||||||
|
import json, os
|
||||||
|
from datetime import datetime, timezone
|
||||||
|
|
||||||
|
f = '${KNOWN_MARKETPLACES}'
|
||||||
|
try:
|
||||||
|
d = json.load(open(f))
|
||||||
|
except FileNotFoundError:
|
||||||
|
d = {}
|
||||||
|
|
||||||
|
if 'local' not in d:
|
||||||
|
d['local'] = {
|
||||||
|
"source": {"source": "local", "path": '${MARKETPLACE_DIR}'},
|
||||||
|
"installLocation": '${MARKETPLACE_DIR}',
|
||||||
|
"lastUpdated": datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%S.000Z'),
|
||||||
|
}
|
||||||
|
json.dump(d, open(f, 'w'), indent=2)
|
||||||
|
print(" Registered 'local' marketplace")
|
||||||
|
else:
|
||||||
|
print(" 'local' marketplace already registered")
|
||||||
|
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