ccsettings
v0.9.0
Published
CLI tool for applying Claude Code configuration templates on a per-project basis
Maintainers
Readme
ccsettings - Claude Code Settings Manager
A CLI tool for applying Claude Code configuration templates on a per-project basis. It allows developers to apply standardized configuration templates to their project's .claude/settings.json file and achieves intelligent merging with existing settings.
Getting Started
# Apply casual template
npx ccsettings apply --template casualFeatures
- 🎯 4 Built-in Templates: casual, strict, node,etc.
- 🔗 Multiple Configuration Sources: Built-in, local files, URLs (GitHub support)
- 🧠 Smart Merge: Integrates templates while preserving existing settings
- 🔍 Preview Function: Preview changes with dry-run before applying
- 💾 Backup Function: Automatically saves settings before changes
- 🌐 User-friendly Interface: Clear and intuitive messages
Installation
npm install -g ccsettings
# or
pnpm add -g ccsettings
# or
yarn global add ccsettingsBasic Usage
1. Check Available Templates
ccsettings list2. Apply Template (Dry Run)
ccsettings apply --template casual --dry-run3. Apply Template
ccsettings apply --template strict4. Show Current Settings
ccsettings showCommand Reference
apply command
Apply a template to the current project.
ccsettings apply [options]Options
-t, --template <name>- Specify built-in template-f, --file <path>- Load template from local file-u, --url <url>- Fetch template from URL--dry-run- Show preview only without making actual changes--backup- Backup settings before changes--force- Apply changes without confirmation
Usage Examples
# Apply default template
ccsettings apply
# Apply strict template
ccsettings apply --template strict
# Apply template from local file
ccsettings apply --file ./my-template.json
# Apply template from GitHub URL
ccsettings apply --url https://github.com/user/repo/blob/main/template.json
# Force apply with backup
ccsettings apply --template strict --backup --force
# Preview changes with dry run
ccsettings apply --template strict --dry-runlist command
List available built-in templates.
ccsettings listshow command
Display current project settings.
ccsettings showTemplate File Format
Custom templates can be created in the following JSON format:
{
"name": "my-template",
"description": "Description of custom template",
"settings": {
"permissions": {
"allow": [
"Read(src/**)",
"Edit(src/**)",
"Bash(npm run test)"
],
"deny": [
"Bash(rm -rf *)",
"Write(/etc/**)"
],
"defaultMode": "acceptEdits"
},
}
}Merge Strategy
ccsettings merges existing settings with templates using the following strategy:
- Existing Settings Priority: Existing setting values are preserved
- Array Merge: Arrays like
allowanddenyare combined with duplicates removed - Deep Merge: Nested objects are recursively merged
- New Additions: Items present in template but not in existing settings are added
Merge Example
Existing settings:
{
"permissions": {
"allow": ["Read(src/**)"],
"defaultMode": "acceptEdits"
}
}Template:
{
"permissions": {
"allow": ["Read(src/**)", "Edit(src/**)"],
"deny": ["Bash(rm -rf *)"],
"defaultMode": "default"
}
}Merge result:
{
"permissions": {
"allow": ["Read(src/**)", "Edit(src/**)"],
"deny": ["Bash(rm -rf *)"],
"defaultMode": "acceptEdits"
}
}GitHub URL Support
Template files on GitHub are automatically converted to raw file URLs:
# Regular GitHub URLs like this...
ccsettings apply --url https://github.com/user/repo/blob/main/template.json
# Are automatically converted to raw URLs
# https://raw.githubusercontent.com/user/repo/main/template.jsonError Handling
- 📁 Clear error messages when files are not found
- 🔍 Specific problem identification for invalid JSON format
- 🌐 Proper handling of network errors
- ✅ Template schema validation
License
MIT
Contributing
Pull requests and issues are welcome. For bug reports or feature requests, please use GitHub Issues.
