Skip to content

Commit e773c6a

Browse files
committed
Fix install: write skills unconditionally, not gated on claude CLI
Skill files were only written inside installClaudeCode(), which required finding the `claude` CLI binary. In CI (Linux) with no claude installed, skills were never written, causing 4 test failures. Split into installSkills() (always runs) and registerClaudeCodeMCP() (only when claude CLI found).
1 parent 07df6e0 commit e773c6a

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

cmd/codebase-memory-mcp/install.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,15 @@ func runInstall(args []string) int {
4040
// PATH check
4141
ensurePATH(binaryPath, cfg)
4242

43-
// Claude Code
43+
// Skills (always installed — no CLI dependency)
44+
installSkills(cfg)
45+
46+
// Claude Code MCP registration
4447
if claudePath := findCLI("claude"); claudePath != "" {
4548
fmt.Printf("[Claude Code] detected (%s)\n", claudePath)
46-
installClaudeCode(binaryPath, claudePath, cfg)
49+
registerClaudeCodeMCP(binaryPath, claudePath, cfg)
4750
} else {
48-
fmt.Println("[Claude Code] not found — skipping")
51+
fmt.Println("[Claude Code] not found — skipping MCP registration")
4952
}
5053

5154
fmt.Println()
@@ -183,14 +186,16 @@ func detectShellRC() string {
183186
}
184187
}
185188

186-
// installClaudeCode installs skills and registers the MCP server with Claude Code.
187-
func installClaudeCode(binaryPath, claudePath string, cfg installConfig) {
189+
// installSkills writes the 4 skill files to ~/.claude/skills/ and removes old monolithic skill.
190+
func installSkills(cfg installConfig) {
188191
home, err := os.UserHomeDir()
189192
if err != nil {
190193
fmt.Printf(" ⚠ Cannot determine home directory: %v\n", err)
191194
return
192195
}
193196

197+
fmt.Println("[Skills]")
198+
194199
// Remove old monolithic skill if it exists
195200
oldSkillDir := filepath.Join(home, ".claude", "skills", "codebase-memory-mcp")
196201
if info, err := os.Stat(oldSkillDir); err == nil && info.IsDir() {
@@ -230,8 +235,10 @@ func installClaudeCode(binaryPath, claudePath string, cfg installConfig) {
230235
}
231236
fmt.Printf(" ✓ Skill: %s\n", skillFile)
232237
}
238+
}
233239

234-
// Register MCP server — remove first for idempotency
240+
// registerClaudeCodeMCP registers the MCP server with Claude Code CLI.
241+
func registerClaudeCodeMCP(binaryPath, claudePath string, cfg installConfig) {
235242
if cfg.dryRun {
236243
fmt.Printf(" [dry-run] Would run: %s mcp remove codebase-memory-mcp\n", claudePath)
237244
fmt.Printf(" [dry-run] Would run: %s mcp add --scope user codebase-memory-mcp -- %s\n", claudePath, binaryPath)

0 commit comments

Comments
 (0)