Skip to content

Commit 7aead13

Browse files
committed
fix: use limactl copy for .claude.json since Lima mounts require directories
1 parent 9126f4a commit 7aead13

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

cmd/cw/lima_backend.go

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,6 @@ func limaCreateCommandArgs(instance *cwconfig.LocalInstance) []string {
177177
strconv.Quote(claudeDir),
178178
)
179179
}
180-
claudeJSON := filepath.Join(homeDir, ".claude.json")
181-
if _, err := localOsStat(claudeJSON); err == nil {
182-
mounts += fmt.Sprintf(
183-
`,{"location":%s,"mountPoint":"/home/{{.User}}.guest/.claude.json","writable":true}`,
184-
strconv.Quote(claudeJSON),
185-
)
186-
}
187180

188181
mountSet := ".mounts=[" + mounts + "]"
189182

@@ -297,10 +290,6 @@ func createLocalLimaInstance(instance *cwconfig.LocalInstance) error {
297290
if _, statErr := localOsStat(hostClaude); statErr == nil {
298291
dockerArgs = append(dockerArgs, "-v", claudeDir+":/home/codewire/.claude")
299292
}
300-
hostClaudeJSON := filepath.Join(homeDir, ".claude.json")
301-
if _, statErr := localOsStat(hostClaudeJSON); statErr == nil {
302-
dockerArgs = append(dockerArgs, "-v", filepath.Join(vmHome, ".claude.json")+":/home/codewire/.claude.json")
303-
}
304293
}
305294
dockerArgs = append(dockerArgs,
306295
"-v", filepath.Join(vmHome, ".config", "gh")+":/home/codewire/.config/gh:ro",
@@ -315,6 +304,19 @@ func createLocalLimaInstance(instance *cwconfig.LocalInstance) error {
315304
return fmt.Errorf("docker run: %v", err)
316305
}
317306

307+
// Copy ~/.claude.json into the container (Lima mounts only support directories).
308+
if homeDir, err := localUserHomeDir(); err == nil {
309+
claudeJSON := filepath.Join(homeDir, ".claude.json")
310+
if _, statErr := localOsStat(claudeJSON); statErr == nil {
311+
vmTmp := "/tmp/claude.json"
312+
if _, cpErr := localRunCommand("limactl", "copy", claudeJSON, name+":"+vmTmp); cpErr == nil {
313+
_, _ = localRunCommand("limactl", "shell", "--workdir", "/", name,
314+
"docker", "cp", vmTmp, limaContainerName+":/home/codewire/.claude.json")
315+
_, _ = localRunCommand("limactl", "shell", "--workdir", "/", name, "rm", "-f", vmTmp)
316+
}
317+
}
318+
}
319+
318320
cleanup = false
319321
return nil
320322
}

0 commit comments

Comments
 (0)