mirror of
https://github.com/lukaszraczylo/claude-mnemonic.git
synced 2026-06-09 23:59:40 +00:00
general improvements (#17)
* refactor(hooks): simplify hook execution with shared context - [x] Extract BaseInput struct to eliminate duplicate fields across hooks - [x] Create RunHook handler pattern for session-start and user-prompt - [x] Create RunStatuslineHook for fast statusline rendering without worker startup - [x] Add HookContext struct to pass port, project, CWD, SessionID to handlers - [x] Add db/interface.go with ObservationReader/Writer interfaces - [x] Add comprehensive conflict management tests in sqlite/conflict_test.go - [x] Add vector client tests for Count, ModelVersion, NeedsRebuild, GetStaleVectors - [x] Add FilterByThreshold helper tests for query result filtering - [x] Make handlers_test more robust for network-dependent update checks - [x] Update package versions in UI * Move to GORM + general cleanup * feat(mcp): add observation relations discovery and scoring integration - [x] Add find_related_observations MCP tool for discovering related observations by confidence - [x] Integrate scoring calculator and recalculator into MCP server initialization - [x] Add pattern, relation, and session stores to MCP server dependencies - [x] Register MCP server in Claude Code settings during plugin installation - [x] Update install scripts (bash, PowerShell) to configure MCP server settings - [x] Switch plugin manifest files to template-based versioning (plugin.json.tpl, marketplace.json.tpl) - [x] Update all MCP server tests to pass new dependency parameters
This commit is contained in:
@@ -9,9 +9,14 @@ if [ -n "$GORELEASER_CURRENT_TAG" ]; then
|
||||
VERSION="${GORELEASER_CURRENT_TAG#v}"
|
||||
echo "Using version from GORELEASER_CURRENT_TAG: $VERSION"
|
||||
else
|
||||
# Fallback for local testing
|
||||
VERSION="0.0.0-dev"
|
||||
echo "GORELEASER_CURRENT_TAG not set, using fallback version: $VERSION"
|
||||
# Fallback: Use latest git tag instead of 0.0.0-dev
|
||||
# This prevents version mismatch when Claude installs from GitHub
|
||||
LATEST_TAG=$(git tag --sort=-v:refname | head -1 || echo "v0.0.0-dev")
|
||||
if [ -z "$LATEST_TAG" ]; then
|
||||
LATEST_TAG="v0.0.0-dev"
|
||||
fi
|
||||
VERSION="${LATEST_TAG#v}"
|
||||
echo "GORELEASER_CURRENT_TAG not set, using latest git tag: $VERSION"
|
||||
fi
|
||||
|
||||
# Source and destination directories
|
||||
|
||||
@@ -186,6 +186,34 @@ function Register-Plugin {
|
||||
$Marketplaces | Add-Member -NotePropertyName "claude-mnemonic" -NotePropertyValue $MarketplaceEntry -Force
|
||||
$Marketplaces | ConvertTo-Json -Depth 10 | Out-File -Encoding UTF8 $MarketplacesFile
|
||||
Write-Success "Marketplace registered in known_marketplaces.json"
|
||||
|
||||
# Register MCP server in settings.json
|
||||
$McpBinary = Join-Path $InstallDir "mcp-server.exe"
|
||||
if (Test-Path $McpBinary) {
|
||||
Write-Info "Registering MCP server in settings.json..."
|
||||
|
||||
# Reload settings to include any previous updates
|
||||
$Settings = Get-Content $SettingsFile -Raw | ConvertFrom-Json
|
||||
|
||||
# Ensure mcpServers object exists
|
||||
if (-not $Settings.mcpServers) {
|
||||
$Settings | Add-Member -NotePropertyName "mcpServers" -NotePropertyValue @{} -Force
|
||||
}
|
||||
|
||||
# Add MCP server entry
|
||||
$McpEntry = @{
|
||||
command = $McpBinary
|
||||
args = @("--project", "`${CLAUDE_PROJECT}")
|
||||
env = @{}
|
||||
}
|
||||
|
||||
$Settings.mcpServers | Add-Member -NotePropertyName "claude-mnemonic" -NotePropertyValue $McpEntry -Force
|
||||
|
||||
$Settings | ConvertTo-Json -Depth 10 | Out-File -Encoding UTF8 $SettingsFile
|
||||
Write-Success "MCP server registered successfully"
|
||||
} else {
|
||||
Write-Warn "MCP server binary not found at $McpBinary, skipping MCP registration"
|
||||
}
|
||||
} catch {
|
||||
Write-Warn "Plugin registration encountered an error: $_"
|
||||
}
|
||||
@@ -282,6 +310,10 @@ function Uninstall-ClaudeMnemonic {
|
||||
if ($Settings.statusLine -and $Settings.statusLine.command -match "claude-mnemonic") {
|
||||
$Settings.PSObject.Properties.Remove("statusLine")
|
||||
}
|
||||
# Remove MCP server entry
|
||||
if ($Settings.mcpServers) {
|
||||
$Settings.mcpServers.PSObject.Properties.Remove("claude-mnemonic")
|
||||
}
|
||||
$Settings | ConvertTo-Json -Depth 10 | Out-File -Encoding UTF8 $SettingsFile
|
||||
}
|
||||
if (Test-Path $MarketplacesFile) {
|
||||
|
||||
+35
-2
@@ -297,6 +297,37 @@ EOF
|
||||
&& mv "${MARKETPLACES_FILE}.tmp" "$MARKETPLACES_FILE"
|
||||
|
||||
success "Marketplace registered in known_marketplaces.json"
|
||||
|
||||
# Register MCP server in settings.json
|
||||
local mcp_binary="$INSTALL_DIR/mcp-server"
|
||||
if [[ -f "$mcp_binary" ]]; then
|
||||
info "Registering MCP server in settings.json..."
|
||||
|
||||
# MCP server entry - note the escaped ${CLAUDE_PROJECT}
|
||||
local mcp_entry
|
||||
mcp_entry=$(cat <<'EOF'
|
||||
{
|
||||
"command": "MCP_BINARY_PLACEHOLDER",
|
||||
"args": ["--project", "${CLAUDE_PROJECT}"],
|
||||
"env": {}
|
||||
}
|
||||
EOF
|
||||
)
|
||||
# Replace placeholder with actual path
|
||||
mcp_entry=$(echo "$mcp_entry" | sed "s|MCP_BINARY_PLACEHOLDER|$mcp_binary|g")
|
||||
|
||||
# Add or update mcpServers field
|
||||
if jq --arg key "claude-mnemonic" --argjson entry "$mcp_entry" \
|
||||
'.mcpServers //= {} | .mcpServers[$key] = $entry' "$SETTINGS_FILE" > "${SETTINGS_FILE}.tmp"; then
|
||||
mv "${SETTINGS_FILE}.tmp" "$SETTINGS_FILE"
|
||||
success "MCP server registered successfully"
|
||||
else
|
||||
warn "Failed to register MCP server (jq error)"
|
||||
rm -f "${SETTINGS_FILE}.tmp"
|
||||
fi
|
||||
else
|
||||
warn "MCP server binary not found at $mcp_binary, skipping MCP registration"
|
||||
fi
|
||||
}
|
||||
|
||||
# Start the worker service
|
||||
@@ -479,8 +510,10 @@ if [[ "${1:-}" == "--uninstall" ]]; then
|
||||
jq 'del(.plugins["'"$PLUGIN_KEY"'"])' "$PLUGINS_FILE" > "${PLUGINS_FILE}.tmp" && mv "${PLUGINS_FILE}.tmp" "$PLUGINS_FILE"
|
||||
fi
|
||||
if [[ -f "$SETTINGS_FILE" ]]; then
|
||||
# Remove plugin from enabled plugins and remove statusline if it's ours
|
||||
jq 'del(.enabledPlugins["'"$PLUGIN_KEY"'"]) | if .statusLine.command | test("claude-mnemonic") then del(.statusLine) else . end' "$SETTINGS_FILE" > "${SETTINGS_FILE}.tmp" && mv "${SETTINGS_FILE}.tmp" "$SETTINGS_FILE"
|
||||
# Remove plugin from enabled plugins, remove statusline if it's ours, and remove MCP server entry
|
||||
jq 'del(.enabledPlugins["'"$PLUGIN_KEY"'"]) |
|
||||
if .statusLine.command | test("claude-mnemonic") then del(.statusLine) else . end |
|
||||
del(.mcpServers["claude-mnemonic"])' "$SETTINGS_FILE" > "${SETTINGS_FILE}.tmp" && mv "${SETTINGS_FILE}.tmp" "$SETTINGS_FILE"
|
||||
fi
|
||||
if [[ -f "$MARKETPLACES_FILE" ]]; then
|
||||
jq 'del(.["claude-mnemonic"])' "$MARKETPLACES_FILE" > "${MARKETPLACES_FILE}.tmp" && mv "${MARKETPLACES_FILE}.tmp" "$MARKETPLACES_FILE"
|
||||
|
||||
@@ -107,6 +107,37 @@ EOF
|
||||
&& mv "${MARKETPLACES_FILE}.tmp" "$MARKETPLACES_FILE"
|
||||
|
||||
echo "Marketplace registered in known_marketplaces.json"
|
||||
|
||||
# Register MCP server in settings.json
|
||||
MCP_BINARY="$MARKETPLACE_PATH/mcp-server"
|
||||
if [ -f "$MCP_BINARY" ]; then
|
||||
echo "Registering MCP server in settings.json..."
|
||||
|
||||
# MCP server entry - note the escaped ${CLAUDE_PROJECT}
|
||||
MCP_ENTRY=$(cat <<'EOF'
|
||||
{
|
||||
"command": "MCP_BINARY_PLACEHOLDER",
|
||||
"args": ["--project", "${CLAUDE_PROJECT}"],
|
||||
"env": {}
|
||||
}
|
||||
EOF
|
||||
)
|
||||
# Replace placeholder with actual path
|
||||
MCP_ENTRY=$(echo "$MCP_ENTRY" | sed "s|MCP_BINARY_PLACEHOLDER|$MCP_BINARY|g")
|
||||
|
||||
# Add or update mcpServers field
|
||||
if jq --arg key "claude-mnemonic" --argjson entry "$MCP_ENTRY" \
|
||||
'.mcpServers //= {} | .mcpServers[$key] = $entry' "$SETTINGS_FILE" > "${SETTINGS_FILE}.tmp"; then
|
||||
mv "${SETTINGS_FILE}.tmp" "$SETTINGS_FILE"
|
||||
echo "MCP server registered successfully"
|
||||
else
|
||||
echo "Warning: Failed to register MCP server (jq error)"
|
||||
rm -f "${SETTINGS_FILE}.tmp"
|
||||
fi
|
||||
else
|
||||
echo "MCP server binary not found at $MCP_BINARY, skipping MCP registration"
|
||||
fi
|
||||
|
||||
echo "Plugin registered successfully using jq"
|
||||
else
|
||||
echo "ERROR: jq is required for plugin registration"
|
||||
|
||||
Reference in New Issue
Block a user