mirror of
https://github.com/lukaszraczylo/claude-mnemonic.git
synced 2026-06-05 23:03:55 +00:00
Add the statusline. Fix the installation.
This commit is contained in:
@@ -9,13 +9,22 @@ MARKETPLACES_FILE="$HOME/.claude/plugins/known_marketplaces.json"
|
||||
PLUGIN_KEY="claude-mnemonic@claude-mnemonic"
|
||||
MARKETPLACE_NAME="claude-mnemonic"
|
||||
MARKETPLACE_PATH="$HOME/.claude/plugins/marketplaces/claude-mnemonic"
|
||||
CACHE_PATH="$HOME/.claude/plugins/cache/claude-mnemonic/claude-mnemonic/1.0.0"
|
||||
VERSION="1.0.0"
|
||||
|
||||
# Get version from git tags (same as Makefile), or use argument if provided
|
||||
VERSION="${1:-$(git describe --tags --always --dirty 2>/dev/null || echo "dev")}"
|
||||
CACHE_BASE="$HOME/.claude/plugins/cache/claude-mnemonic/claude-mnemonic"
|
||||
CACHE_PATH="$CACHE_BASE/$VERSION"
|
||||
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%S.000Z")
|
||||
|
||||
# Ensure plugins directory exists
|
||||
mkdir -p "$HOME/.claude/plugins"
|
||||
|
||||
# Clean up old cache versions to prevent stale binaries
|
||||
if [ -d "$CACHE_BASE" ]; then
|
||||
echo "Cleaning up old cache versions..."
|
||||
find "$CACHE_BASE" -mindepth 1 -maxdepth 1 -type d ! -name "$VERSION" -exec rm -rf {} \; 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Create installed_plugins.json if it doesn't exist
|
||||
if [ ! -f "$PLUGINS_FILE" ]; then
|
||||
echo '{"version": 2, "plugins": {}}' > "$PLUGINS_FILE"
|
||||
@@ -60,13 +69,24 @@ EOF
|
||||
|
||||
echo "Plugin registered in installed_plugins.json"
|
||||
|
||||
# Enable the plugin in settings.json
|
||||
# Enable the plugin in settings.json and configure statusline
|
||||
# First ensure enabledPlugins object exists, then add our plugin
|
||||
jq --arg key "$PLUGIN_KEY" \
|
||||
'.enabledPlugins //= {} | .enabledPlugins[$key] = true' "$SETTINGS_FILE" > "${SETTINGS_FILE}.tmp" \
|
||||
STATUSLINE_CMD="$MARKETPLACE_PATH/hooks/statusline"
|
||||
STATUSLINE_ENTRY=$(cat <<EOF
|
||||
{
|
||||
"type": "command",
|
||||
"command": "$STATUSLINE_CMD",
|
||||
"padding": 0
|
||||
}
|
||||
EOF
|
||||
)
|
||||
|
||||
jq --arg key "$PLUGIN_KEY" --argjson statusline "$STATUSLINE_ENTRY" \
|
||||
'.enabledPlugins //= {} | .enabledPlugins[$key] = true | .statusLine = $statusline' "$SETTINGS_FILE" > "${SETTINGS_FILE}.tmp" \
|
||||
&& mv "${SETTINGS_FILE}.tmp" "$SETTINGS_FILE"
|
||||
|
||||
echo "Plugin enabled in settings.json"
|
||||
echo "Statusline configured in settings.json"
|
||||
|
||||
# Register the marketplace in known_marketplaces.json
|
||||
MARKETPLACE_ENTRY=$(cat <<EOF
|
||||
|
||||
Reference in New Issue
Block a user