Skip to content

Commit 62592a6

Browse files
authored
feat: improve Claude Code settings schema validation and documentation (SchemaStore#5018)
Co-authored-by: bogini <[email protected]>
1 parent c0ad931 commit 62592a6

File tree

6 files changed

+76
-38
lines changed

6 files changed

+76
-38
lines changed

src/schemas/json/claude-code-settings.json

Lines changed: 70 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
},
1616
"command": {
1717
"type": "string",
18-
"description": "Shell command to execute"
18+
"description": "Shell command to execute",
19+
"minLength": 1
1920
},
2021
"timeout": {
2122
"type": "number",
@@ -32,7 +33,7 @@
3233
"properties": {
3334
"matcher": {
3435
"type": "string",
35-
"description": "String (e.g. Write) to match values related to the hook event, e.g. tool names"
36+
"description": "Optional pattern to match tool names, case-sensitive (only applicable for PreToolUse and PostToolUse)"
3637
},
3738
"hooks": {
3839
"type": "array",
@@ -46,18 +47,18 @@
4647
"permissionRule": {
4748
"type": "string",
4849
"description": "Tool permission rule",
49-
"pattern": "^((Bash|Edit|Glob|Grep|MultiEdit|NotebookEdit|NotebookRead|Read|SlashCommand|Task|TodoWrite|WebFetch|WebSearch|Write)\\(?|^mcp__)",
50+
"pattern": "^((Bash|BashOutput|Edit|ExitPlanMode|Glob|Grep|KillShell|NotebookEdit|Read|SlashCommand|Task|TodoWrite|WebFetch|WebSearch|Write)\\(?|^mcp__)",
5051
"examples": [
51-
"Bash(npm run lint)",
52-
"Bash(npm run test:*)",
53-
"Bash(git push:*)",
54-
"Bash(curl:*)",
55-
"Read(~/.zshrc)",
56-
"Read(./.env)",
57-
"Read(./secrets/**)",
52+
"Bash(git commit:*)",
53+
"Bash(npm run lint:*)",
54+
"Edit(/src/**/*.ts)",
55+
"mcp__github__search_repositories",
56+
"Read(*.env)",
57+
"Read(//Users/alice/secrets/**)",
58+
"Read(~/Documents/*.pdf)",
59+
"WebFetch",
5860
"WebFetch(domain:github.com)",
59-
"Edit(~/projects/**)",
60-
"mcp__github__search_repositories"
61+
"Read(//tmp/**/*)"
6162
]
6263
}
6364
},
@@ -73,6 +74,7 @@
7374
"apiKeyHelper": {
7475
"type": "string",
7576
"description": "Custom script path to generate an auth value",
77+
"minLength": 1,
7678
"examples": ["/bin/generate_temp_api_key.sh"]
7779
},
7880
"cleanupPeriodDays": {
@@ -87,12 +89,18 @@
8789
"description": "Environment variables applied to every session",
8890
"additionalProperties": false,
8991
"patternProperties": {
90-
"^[A-Z_]+$": {
92+
"^[A-Z_][A-Z0-9_]*$": {
9193
"type": "string",
9294
"description": "Environment variable value"
9395
}
9496
},
95-
"default": {}
97+
"default": {},
98+
"examples": [
99+
{
100+
"ANTHROPIC_MODEL": "claude-opus-4-1",
101+
"ANTHROPIC_SMALL_FAST_MODEL": "claude-3-5-haiku-latest"
102+
}
103+
]
96104
},
97105
"includeCoAuthoredBy": {
98106
"type": "boolean",
@@ -107,6 +115,14 @@
107115
"type": "object",
108116
"description": "Tool permissions",
109117
"additionalProperties": false,
118+
"examples": [
119+
{
120+
"allow": ["Bash(git add:*)"],
121+
"ask": ["Bash(gh pr create:*)", "Bash(git commit:*)"],
122+
"deny": ["Read(*.env)", "Bash(rm:*)", "Bash(curl:*)"],
123+
"defaultMode": "default"
124+
}
125+
],
110126
"properties": {
111127
"allow": {
112128
"type": "array",
@@ -140,9 +156,11 @@
140156
"type": "array",
141157
"description": "Paths to additional directories Claude can access beyond the working directory",
142158
"items": {
143-
"type": "string"
159+
"type": "string",
160+
"minLength": 1
144161
},
145-
"uniqueItems": true
162+
"uniqueItems": true,
163+
"examples": [["//Users/alice/Documents", "~/projects"]]
146164
}
147165
}
148166
},
@@ -155,22 +173,40 @@
155173
"type": "array",
156174
"description": "List of allowed MCP servers from .mcp.json",
157175
"items": {
158-
"type": "string"
176+
"type": "string",
177+
"minLength": 1
159178
},
160179
"examples": [["memory", "github"]]
161180
},
162181
"disabledMcpjsonServers": {
163182
"type": "array",
164183
"description": "List of denied MCP servers from .mcp.json",
165184
"items": {
166-
"type": "string"
185+
"type": "string",
186+
"minLength": 1
167187
},
168188
"examples": [["filesystem"]]
169189
},
170190
"hooks": {
171191
"type": "object",
172192
"description": "Hooks configuration for executing commands at specific points in Claude Code's lifecycle",
173193
"additionalProperties": false,
194+
"examples": [
195+
{
196+
"PostToolUse": [
197+
{
198+
"matcher": "Edit|Write",
199+
"hooks": [
200+
{
201+
"type": "command",
202+
"command": "prettier --write",
203+
"timeout": 5
204+
}
205+
]
206+
}
207+
]
208+
}
209+
],
174210
"properties": {
175211
"PreToolUse": {
176212
"type": "array",
@@ -229,17 +265,27 @@
229265
"type": "boolean",
230266
"description": "Disable all hooks"
231267
},
268+
"spinnerTipsEnabled": {
269+
"type": "boolean",
270+
"description": "Whether to show tips in the spinner"
271+
},
272+
"alwaysThinkingEnabled": {
273+
"type": "boolean",
274+
"description": "Whether extended thinking is always enabled (default: false)"
275+
},
232276
"statusLine": {
233277
"type": "object",
234278
"description": "Custom status line configuration",
279+
"additionalProperties": false,
235280
"properties": {
236281
"type": {
237282
"type": "string",
238283
"const": "command"
239284
},
240285
"command": {
241286
"type": "string",
242-
"description": "Shell command to execute to generate the status line"
287+
"description": "Shell command to execute to generate the status line",
288+
"minLength": 1
243289
},
244290
"padding": {
245291
"type": "number",
@@ -252,21 +298,26 @@
252298
"outputStyle": {
253299
"type": "string",
254300
"description": "The output style to use. Can be 'default', 'explanatory', 'learning', or a custom style name.",
301+
"minLength": 1,
255302
"examples": ["default", "explanatory", "learning"]
256303
},
257304
"forceLoginOrgUUID": {
258305
"type": "string",
306+
"format": "uuid",
259307
"description": "Force login with a specific organization UUID",
308+
"minLength": 1,
260309
"examples": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"]
261310
},
262311
"awsAuthRefresh": {
263312
"type": "string",
264313
"description": "Command to refresh AWS credentials.",
314+
"minLength": 1,
265315
"examples": ["aws sso login --profile myprofile"]
266316
},
267317
"awsCredentialExport": {
268318
"type": "string",
269319
"description": "Command to export AWS credentials as JSON.",
320+
"minLength": 1,
270321
"examples": ["/bin/generate_aws_grant.sh"]
271322
}
272323
}

src/test/claude-code-settings/complete-config.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"apiKeyHelper": "/usr/local/bin/claude-auth",
3-
"autoUpdaterStatus": "enabled",
43
"cleanupPeriodDays": 30,
54
"env": {
65
"DEBUG_MODE": "true",
@@ -15,15 +14,12 @@
1514
"Bash(git log:*)",
1615
"WebFetch(domain:anthropic.com)"
1716
],
18-
"ask": ["Write(/tmp/**)", "WebFetch(domain:trusted.example.com)"],
17+
"ask": ["Write(//tmp/**)", "WebFetch(domain:trusted.example.com)"],
1918
"deny": [
2019
"Bash(rm:*)",
2120
"Bash(curl:*)",
2221
"Bash(wget:*)",
2322
"WebFetch(domain:bad.actor.com)"
2423
]
25-
},
26-
"preferredNotifChannel": "iterm2",
27-
"theme": "dark",
28-
"verbose": false
24+
}
2925
}

src/test/claude-code-settings/edge-cases.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"apiKeyHelper": "",
32
"cleanupPeriodDays": 0,
43
"env": {},
54
"permissions": {

src/test/claude-code-settings/modern-complete-config.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
"Edit",
4545
"Glob",
4646
"Grep",
47-
"MultiEdit",
4847
"NotebookEdit",
4948
"Read",
5049
"TodoWrite",
@@ -53,7 +52,7 @@
5352
"Write",
5453
"mcp__*"
5554
],
56-
"ask": ["NotebookRead", "Bash(pip:*)", "Write(~/.cache/**)"],
55+
"ask": ["Bash(pip:*)", "Write(~/.cache/**)"],
5756
"defaultMode": "plan",
5857
"deny": [
5958
"Bash(sudo:*)",

src/test/claude-code-settings/permissions-advanced.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
{
22
"permissions": {
3-
"additionalDirectories": [
4-
"~/Documents/shared-projects",
5-
"/opt/company/resources"
6-
],
3+
"additionalDirectories": ["~/Documents/shared-projects", "//tmp"],
74
"allow": [
85
"Glob",
96
"Grep",
107
"Read(~/projects/**)",
118
"Edit(~/projects/**)",
12-
"MultiEdit",
139
"NotebookEdit",
1410
"TodoWrite",
1511
"WebFetch(domain:github.com)",
1612
"WebSearch",
1713
"mcp__ide__getDiagnostics",
1814
"mcp__ide__executeCode"
1915
],
20-
"ask": ["Write(~/projects/**)", "NotebookRead", "Bash(make:*)"],
16+
"ask": ["Write(~/projects/**)", "Bash(make:*)"],
2117
"defaultMode": "acceptEdits",
2218
"deny": ["Bash(rm:*)", "Write(/etc/**)", "WebFetch(domain:malicious.com)"],
2319
"disableBypassPermissionsMode": "disable"
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
{
2-
"autoUpdaterStatus": "disabled",
3-
"theme": "light-daltonized"
4-
}
1+
{}

0 commit comments

Comments
 (0)