Skip to content

Commit 02d3a59

Browse files
fix(claudeconfig): missing comma in base.jsonc, better parse errors
Fixed missing comma after "defaultMode" in permissions block of claude/roles/base.jsonc that was causing claudeconfig.sh to fail silently without identifying the offending file. Updated read_json in claudeconfig.sh to catch JSON parse errors and report the filename so future breakage is easier to diagnose. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 81ede89 commit 02d3a59

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

claude/roles/base.jsonc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
// Permissions: base safety rules
1313
"permissions": {
14-
"defaultMode": "acceptEdits"
14+
"defaultMode": "acceptEdits",
1515
"allow": [
1616
"Bash(rm -rf .DS_Store)",
1717
"Bash(rm -rf .cache)",
@@ -103,16 +103,16 @@
103103
"allowedHosts": ["api.anthropic.com", "code.claude.com"],
104104
// local dev servers, and other things that are weird and listen (clippy
105105
// --fix for some reason??)
106-
"allowLocalBinding": true
106+
"allowLocalBinding": true,
107107
},
108108
"filesystem": {
109109
"allowWrite": [
110110
// interactive terminals for things like lefthook interactive
111111
"/dev/ptmx",
112112
"/dev/ttys*",
113113
// plugin hooks use uv run which needs to create .venv in cache
114-
"~/.claude/plugins/cache"
115-
]
116-
}
114+
"~/.claude/plugins/cache",
115+
],
116+
},
117117
},
118118
}

claudeconfig.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,19 @@ read_json() {
2323
# Node handles JSONC natively with JSON5-like parsing
2424
node -e "
2525
const fs = require('fs');
26-
const content = fs.readFileSync('$file', 'utf8');
26+
const file = '$file';
27+
const content = fs.readFileSync(file, 'utf8');
2728
// Strip comments and trailing commas
2829
const stripped = content
2930
.replace(/\/\/.*$/gm, '') // Remove // comments
3031
.replace(/\/\*[\s\S]*?\*\//g, '') // Remove /* */ comments
3132
.replace(/,(\s*[}\]])/g, '\$1'); // Remove trailing commas
32-
console.log(JSON.stringify(JSON.parse(stripped)));
33+
try {
34+
console.log(JSON.stringify(JSON.parse(stripped)));
35+
} catch (e) {
36+
process.stderr.write('Error parsing ' + file + ': ' + e.message + '\n');
37+
process.exit(1);
38+
}
3339
"
3440
else
3541
# Fallback: simple sed-based stripping (less robust)

0 commit comments

Comments
 (0)