Skip to content

Commit 1c65576

Browse files
authored
feat: add chezmoi-development skill and fix settings.json race condition (#4)
1 parent 9e99e66 commit 1c65576

File tree

9 files changed

+920
-32
lines changed

9 files changed

+920
-32
lines changed

.chezmoidata/claude.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
# Claude Code marketplace configuration
3+
# This data is merged into ~/.claude/settings.json via run_onchange_after_ script
4+
5+
marketplace:
6+
extraKnownMarketplaces:
7+
fx-cc:
8+
source:
9+
source: git
10+
url: git@github.com:fx/cc.git
11+
12+
settings:
13+
includeCoAuthoredBy: false
14+
enableAllProjectMcpServers: true
15+
enabledPlugins:
16+
fx-dev@fx-cc: true

.chezmoiignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@ test-*.sh
1111
*.bak
1212

1313
# Note: shared directory stays in source for symlink targets, not installed to home
14-
shared/
14+
shared/
15+
16+
# .claude directory is managed by run_onchange_after_update-claude-settings.sh script
17+
# Not by chezmoi's file management (allows symlinks to work in Coder)
18+
.claude

.chezmoiscripts/run_before_00_remove-claude-symlink.sh.tmpl

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
# Update ~/.claude/settings.json with marketplace configuration
3+
# Works with both real directories and symlinks
4+
5+
{{ if .include_defaults -}}
6+
set -e
7+
8+
# Ensure ~/.claude exists (as directory or symlink)
9+
if [ ! -e "$HOME/.claude" ]; then
10+
mkdir -p "$HOME/.claude"
11+
fi
12+
13+
SETTINGS_FILE="$HOME/.claude/settings.json"
14+
15+
# Read existing settings or start with empty object
16+
if [ -f "$SETTINGS_FILE" ]; then
17+
existing=$(cat "$SETTINGS_FILE")
18+
else
19+
existing='{}'
20+
fi
21+
22+
# Our required settings from .chezmoidata/claude.yaml
23+
required_settings='{{ .settings | toJson }}'
24+
marketplace_config='{{ .marketplace | toJson }}'
25+
26+
# Merge: existing settings + our required settings + marketplace config
27+
# Our settings take precedence (using * operator for recursive merge)
28+
result=$(echo "$existing" | jq --argjson required "$required_settings" \
29+
--argjson marketplace "$marketplace_config" \
30+
'. * $required * $marketplace')
31+
32+
# Write the merged result
33+
echo "$result" > "$SETTINGS_FILE"
34+
35+
echo "✓ Updated $SETTINGS_FILE"
36+
{{ end -}}

0 commit comments

Comments
 (0)