-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add chezmoi-development skill and fix settings.json race condition #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors Claude Code marketplace configuration to use chezmoi's .chezmoidata and modify_ script pattern for non-destructive settings management. Instead of overwriting ~/.claude/settings.json, the configuration is now merged with existing user settings.
Key changes:
- Replaced static
dot_claude/settings.jsonwith amodify_script that merges configuration - Moved configuration data to
.chezmoidata/claude.yamlfor better separation of data and logic - Added comprehensive documentation about the pattern in a new skill and reference document
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| dot_claude/settings.json | Removed static configuration file (no longer needed with modify_ approach) |
| dot_claude/modify_settings.json.tmpl | New merge script that combines marketplace config with existing user settings |
| .chezmoidata/claude.yaml | Configuration data extracted from hardcoded JSON |
| .chezmoiscripts/run_before_00_remove-claude-symlink.sh.tmpl | Removed as directory creation is now handled automatically by chezmoi |
| CLAUDE.md | Updated documentation to explain the new merge-based approach |
| .claude/skills/chezmoi-development/SKILL.md | New comprehensive skill documentation for chezmoi development patterns |
| .claude/skills/chezmoi-development/references/chezmoidata-modify-example.md | New reference document with complete working example |
.claude/skills/chezmoi-development/references/chezmoidata-modify-example.md
Show resolved
Hide resolved
- Add comprehensive chezmoi-development skill with documentation for .chezmoidata and modify scripts - Replace dot_claude/settings.json with run_onchange_after_update-claude-settings.sh.tmpl - Add .claude to .chezmoiignore to prevent management conflicts with symlinks - Remove run_before_00_remove-claude-symlink.sh.tmpl that was breaking symlinks - Configure fx/cc marketplace and enable fx-dev@fx-cc plugin by default - Improve install.sh to detect and use local repository for testing - Clear chezmoi state database and use --force flag to avoid prompts - Suppress confusing "Cloning into" message when using local repository This approach allows .claude to remain a symlink in Coder workspaces while still applying settings updates via the run_onchange_after script, which works with both directories and symlinks.
b58f28c to
bf00725
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.
Comments suppressed due to low confidence (1)
.claude/skills/chezmoi-development/SKILL.md:1
- This statement is only true for
modify_scripts, not forrun_onchange_after_scripts which must read from disk. Since this PR usesrun_onchange_after_, this guidance is misleading and contradicts the actual implementation. Consider adding a clear section that explains the differences betweenmodify_andrun_onchange_approaches.
---
.claude/skills/chezmoi-development/references/chezmoidata-modify-example.md
Outdated
Show resolved
Hide resolved
.claude/skills/chezmoi-development/references/chezmoidata-modify-example.md
Show resolved
Hide resolved
…error handling Address Copilot PR review feedback: - Update all documentation to correctly reference run_onchange_after_ instead of modify_ - Add comprehensive section in SKILL.md distinguishing between modify_ (stdin/stdout) and run_onchange_ (disk I/O) approaches - Clarify when to use each approach (symlinked directories require run_onchange_) - Fix install.sh error handling to properly capture chezmoi init failures - Document why --force flag is necessary in install.sh (state cleanup on lines 45-52)
Summary
Adds comprehensive chezmoi development documentation and fixes a race condition with
~/.claude/settings.jsonmanagement.Changes
1. New chezmoi-development Skill
.chezmoidatafor configuration datamodify_scripts for non-destructive file mergingsymlink_prefix for declarative symlinks2. Fix Race Condition with ~/.claude Directory
Problem: The
run_before_00_remove-claude-symlink.sh.tmplscript was creating~/.claudedirectory before chezmoi processed files, preventing symlinking and causing issues.Solution:
run_before_script (chezmoi auto-creates parent directories)modify_script forsettings.jsondot_claude/modify_settings.json.tmplmerges marketplace config with existing user settings3. Preserve User Settings
The new
modify_script:~/.claude(Coder workspaces)Test Results
All tests pass:
~/.claudeFiles Changed
.chezmoidata/claude.yaml- Configuration data for marketplace.chezmoiscripts/run_before_00_remove-claude-symlink.sh.tmpl- No longer needed.claude/skills/chezmoi-development/SKILL.md- Comprehensive documentation.claude/skills/chezmoi-development/references/chezmoidata-modify-example.md- Working exampledot_claude/settings.jsonwithdot_claude/modify_settings.json.tmpl- Non-destructive mergingCLAUDE.md- Document the skill