claude_code_settings/types.rs
1//! The other objects: attribution, status line, spinner, worktree, SSH,
2//! voice, footer links, policy helper, spellcheck, remote.
3
4use alloc::collections::BTreeMap;
5use alloc::string::String;
6use alloc::vec::Vec;
7
8use serde::{Deserialize, Serialize};
9
10use crate::Extra;
11use crate::enums::{BgIsolation, SpellChecker, SpinnerVerbsMode, VoiceMode, WorktreeBaseRef};
12use crate::walk::{Unknown, walk};
13
14/// `attribution`: what Claude Code adds to commits and pull requests.
15///
16/// Customize the attribution Claude Code adds to git commits and pull requests. Commits get a
17/// [git trailer](https://git-scm.com/docs/git-interpret-trailers) such as `Co-Authored-By` by
18/// default; pull request descriptions get plain text.
19///
20/// Docs: [`attribution`](https://code.claude.com/docs/en/settings-reference#attribution).
21#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
22#[serde(rename_all = "camelCase")]
23#[non_exhaustive]
24pub struct Attribution {
25 /// Set the attribution text Claude Code adds to git commits, including any trailers. Set it
26 /// to an empty string to hide commit attribution.
27 ///
28 /// - **Values**: string
29 /// - **Default**: unset, so Claude Code adds `Co-Authored-By: <name>
30 /// <noreply@anthropic.com>`. The name is the model in use when the commit is made, such
31 /// as `Claude Sonnet 5`. When a [subagent](https://code.claude.com/docs/en/sub-agents)
32 /// makes the commit, the trailer names the subagent's model. * When Claude Code
33 /// recognizes the model as a Claude model but can't confirm its exact version, it writes
34 /// `Claude` alone. * When it can't match the model ID to any Claude model, such as a
35 /// third-party model served through a custom
36 /// [`ANTHROPIC_BASE_URL`](https://code.claude.com/docs/en/env-vars), it writes `Claude
37 /// Code`.
38 /// - **Scope**: any settings file.
39 ///
40 /// Docs: [`commit`](https://code.claude.com/docs/en/settings-reference#attribution-commit).
41 #[serde(skip_serializing_if = "Option::is_none")]
42 pub commit: Option<String>,
43 /// Set the attribution text Claude Code adds to pull request descriptions. Set it to an
44 /// empty string to hide pull request attribution.
45 ///
46 /// - **Values**: string
47 /// - **Default**: unset, so Claude Code adds `🤖 Generated with [Claude
48 /// Code](https://claude.com/claude-code)`
49 /// - **Scope**: any settings file.
50 ///
51 /// Docs: [`pr`](https://code.claude.com/docs/en/settings-reference#attribution-pr).
52 #[serde(skip_serializing_if = "Option::is_none")]
53 pub pr: Option<String>,
54 /// Choose whether Claude Code appends the claude.ai session link when it commits or opens a
55 /// pull request from a [cloud](https://code.claude.com/docs/en/claude-code-on-the-web) or
56 /// [Remote Control](https://code.claude.com/docs/en/remote-control) session. Claude Code
57 /// adds the link as a `Claude-Session` trailer on commits and as a link in pull request
58 /// descriptions. Set it to `false` to omit the link.
59 ///
60 /// - **Values**: Boolean
61 /// - `true`: Claude Code appends the claude.ai session link when it commits or opens a
62 /// pull request from a cloud or Remote Control session
63 /// - `false`: Claude Code omits the link
64 /// - **Default**: `true`
65 /// - **Scope**: any settings file.
66 ///
67 /// Docs: [`sessionUrl`](https://code.claude.com/docs/en/settings-reference#attribution-sessionurl).
68 #[serde(skip_serializing_if = "Option::is_none")]
69 pub session_url: Option<bool>,
70 /// Keys Claude Code accepts here that this crate doesn't model (newer or
71 /// undocumented ones), kept as written so the document round-trips.
72 #[serde(flatten)]
73 pub extra: Extra,
74}
75
76/// `attribution`: the object, or `false` to hide all attribution.
77#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
78#[serde(untagged)]
79#[non_exhaustive]
80pub enum AttributionSetting {
81 /// `false` hides all attribution.
82 Flag(bool),
83 /// What to add.
84 Custom(Attribution),
85}
86
87impl Unknown for AttributionSetting {
88 fn unknown(&self, path: &str, out: &mut Vec<String>) {
89 if let Self::Custom(a) = self {
90 a.unknown(path, out);
91 }
92 }
93}
94
95/// `statusLine`: a command that prints the status line from the session
96/// JSON on its stdin.
97///
98/// Run your own command to render a [status line](https://code.claude.com/docs/en/statusline)
99/// below the prompt with context such as the model, cost, or git branch. Optional fields adjust
100/// spacing, add periodic re-runs, and hide the built-in vim mode indicator when your script
101/// renders `vim.mode` itself.
102///
103/// Docs: [`statusLine`](https://code.claude.com/docs/en/settings-reference#statusline).
104#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
105#[serde(rename_all = "camelCase")]
106#[non_exhaustive]
107pub struct StatusLine {
108 /// The type of status line handler; must be set to "command" to run a custom shell script
109 /// that receives JSON session data via stdin.
110 ///
111 /// - **Values**: string
112 /// - **Default**: unset
113 ///
114 /// Docs: [`type`](https://code.claude.com/docs/en/settings-reference#statusline).
115 #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
116 pub kind: Option<String>,
117 /// A shell command or path to a script that displays session information (context usage,
118 /// costs, git status, etc.) by reading JSON data from stdin and writing output to stdout.
119 ///
120 /// - **Values**: string
121 /// - **Default**: unset
122 ///
123 /// Docs: [`command`](https://code.claude.com/docs/en/settings-reference#statusline).
124 #[serde(skip_serializing_if = "Option::is_none")]
125 pub command: Option<String>,
126 /// Optional number of extra horizontal spacing characters added to the status line content;
127 /// defaults to 0.
128 ///
129 /// - **Values**: a number
130 /// - **Default**: unset
131 ///
132 /// Docs: [`padding`](https://code.claude.com/docs/en/settings-reference#statusline).
133 #[serde(skip_serializing_if = "Option::is_none")]
134 pub padding: Option<f64>,
135 /// Re-run the status line command every N seconds in addition to event-driven updates.
136 /// Leave unset to run only on events. Useful for time-based data like clocks, or when
137 /// background subagents change git state while the main session is idle.
138 ///
139 /// - **Values**: a whole number, minimum `1`
140 /// - **Default**: unset
141 ///
142 /// Docs: [`refreshInterval`](https://code.claude.com/docs/en/settings-reference#statusline).
143 #[serde(skip_serializing_if = "Option::is_none")]
144 pub refresh_interval: Option<u64>,
145 /// Set to true when your status line script renders the vim mode indicator itself, to
146 /// suppress the built-in vim mode display.
147 ///
148 /// - **Values**: Boolean
149 /// - **Default**: unset
150 ///
151 /// Docs: [`hideVimModeIndicator`](https://code.claude.com/docs/en/settings-reference#statusline).
152 #[serde(skip_serializing_if = "Option::is_none")]
153 pub hide_vim_mode_indicator: Option<bool>,
154 /// Keys Claude Code accepts here that this crate doesn't model (newer or
155 /// undocumented ones), kept as written so the document round-trips.
156 #[serde(flatten)]
157 pub extra: Extra,
158}
159
160impl StatusLine {
161 /// A `command` status line.
162 pub fn command(command: impl Into<String>) -> Self {
163 Self {
164 kind: Some("command".into()),
165 command: Some(command.into()),
166 ..Self::default()
167 }
168 }
169}
170
171/// `fileSuggestion` and `subagentStatusLine`: a `command` handler.
172///
173/// Run your own command to supply `@` file path autocomplete instead of the built-in file
174/// suggestion. The built-in suggestion uses fast filesystem traversal; a large monorepo may do
175/// better with project-specific indexing such as a pre-built file index.
176///
177/// Docs: [`fileSuggestion`](https://code.claude.com/docs/en/settings-reference#filesuggestion).
178#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
179#[serde(rename_all = "camelCase")]
180#[non_exhaustive]
181pub struct CommandSetting {
182 /// The type of file suggestion handler; must be set to "command" to execute a custom shell
183 /// script that generates file suggestions for the @ file picker.
184 ///
185 /// - **Values**: string
186 /// - **Default**: unset
187 ///
188 /// Docs: [`type`](https://code.claude.com/docs/en/settings-reference#filesuggestion).
189 #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
190 pub kind: Option<String>,
191 /// Shell command to execute for file suggestions.
192 ///
193 /// - **Values**: string
194 /// - **Default**: unset
195 ///
196 /// Docs: [`command`](https://code.claude.com/docs/en/settings-reference#filesuggestion).
197 #[serde(skip_serializing_if = "Option::is_none")]
198 pub command: Option<String>,
199 /// Keys Claude Code accepts here that this crate doesn't model (newer or
200 /// undocumented ones), kept as written so the document round-trips.
201 #[serde(flatten)]
202 pub extra: Extra,
203}
204
205impl CommandSetting {
206 /// A `command` handler.
207 pub fn command(command: impl Into<String>) -> Self {
208 Self {
209 kind: Some("command".into()),
210 command: Some(command.into()),
211 ..Self::default()
212 }
213 }
214}
215
216/// `spinnerVerbs`.
217///
218/// While a turn is in progress, the spinner shows a rotating verb such as "Accomplishing",
219/// "Architecting", or "Baking". Use this key to add your own verbs to that rotation or replace
220/// the built-in list with yours.
221///
222/// Docs: [`spinnerVerbs`](https://code.claude.com/docs/en/settings-reference#spinnerverbs).
223#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
224#[serde(rename_all = "camelCase")]
225#[non_exhaustive]
226pub struct SpinnerVerbs {
227 /// How to combine custom verbs with default spinner verbs: 'append' adds custom verbs to
228 /// the default list, 'replace' uses only custom verbs.
229 ///
230 /// - **Values**: `"append"`, `"replace"`
231 /// - **Default**: unset
232 ///
233 /// Docs: [`mode`](https://code.claude.com/docs/en/settings-reference#spinnerverbs).
234 #[serde(skip_serializing_if = "Option::is_none")]
235 pub mode: Option<SpinnerVerbsMode>,
236 /// Custom verbs used in spinner progress text.
237 ///
238 /// - **Values**: array of strings
239 /// - **Default**: unset
240 ///
241 /// Docs: [`verbs`](https://code.claude.com/docs/en/settings-reference#spinnerverbs).
242 #[serde(skip_serializing_if = "Option::is_none")]
243 pub verbs: Option<Vec<String>>,
244 /// Keys Claude Code accepts here that this crate doesn't model (newer or
245 /// undocumented ones), kept as written so the document round-trips.
246 #[serde(flatten)]
247 pub extra: Extra,
248}
249
250/// `spinnerTipsOverride`.
251///
252/// Add your own tips to the [spinner
253/// tips](https://code.claude.com/docs/en/settings-reference#spinnertipsenabled) that Claude
254/// Code shows while Claude works, or replace the built-in tips with yours. Claude Code puts
255/// your tips in the same rotation as the built-in ones.
256///
257/// Docs: [`spinnerTipsOverride`](https://code.claude.com/docs/en/settings-reference#spinnertipsoverride).
258#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
259#[serde(rename_all = "camelCase")]
260#[non_exhaustive]
261pub struct SpinnerTips {
262 /// If true, only show custom tips. If false or absent, custom tips merge with built-in
263 /// tips.
264 ///
265 /// - **Values**: Boolean
266 /// - **Default**: `false`
267 ///
268 /// Docs: [`excludeDefault`](https://code.claude.com/docs/en/settings-reference#spinnertipsoverride).
269 #[serde(skip_serializing_if = "Option::is_none")]
270 pub exclude_default: Option<bool>,
271 /// Custom tip strings to display in the spinner.
272 ///
273 /// - **Values**: array of strings
274 /// - **Default**: unset
275 ///
276 /// Docs: [`tips`](https://code.claude.com/docs/en/settings-reference#spinnertipsoverride).
277 #[serde(skip_serializing_if = "Option::is_none")]
278 pub tips: Option<Vec<SpinnerTip>>,
279 /// A local JSON file holding an array of tips (or an object with a `tips` array), up to 256
280 /// KB. Claude Code reads it once per process. Not settable through server-managed settings.
281 ///
282 /// - **Values**: string, an absolute or `~/` path
283 /// - **Default**: unset
284 ///
285 /// Docs: [`tipsFile`](None).
286 #[serde(skip_serializing_if = "Option::is_none")]
287 pub tips_file: Option<String>,
288 /// The prefix shown before tips from user, `--settings`, and managed settings; tips from
289 /// project and local settings always use `Tip`.
290 ///
291 /// - **Values**: string, up to 40 characters
292 /// - **Default**: `"Tip"`
293 ///
294 /// Docs: [`label`](None).
295 #[serde(skip_serializing_if = "Option::is_none")]
296 pub label: Option<String>,
297 /// Keys Claude Code accepts here that this crate doesn't model (newer or
298 /// undocumented ones), kept as written so the document round-trips.
299 #[serde(flatten)]
300 pub extra: Extra,
301}
302
303/// An entry of `spinnerTipsOverride.tips`.
304#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
305#[serde(untagged)]
306#[non_exhaustive]
307pub enum SpinnerTip {
308 /// The tip's text.
309 Text(String),
310 /// A tip with an id, a cooldown and a priority.
311 Entry(TipEntry),
312}
313
314impl Unknown for SpinnerTip {
315 fn unknown(&self, path: &str, out: &mut Vec<String>) {
316 if let Self::Entry(t) = self {
317 t.unknown(path, out);
318 }
319 }
320}
321
322/// A tip object.
323///
324/// Docs: [`spinnerTipsOverride.tips`](https://code.claude.com/docs/en/settings-reference#spinnertipsoverride).
325#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
326#[serde(rename_all = "camelCase")]
327#[non_exhaustive]
328pub struct TipEntry {
329 /// Up to 64 letters, digits, `.`, `_`, or `-`. Claude Code keys the tip's show history on
330 /// it, so the tip's cooldown survives reordering the list. Of two entries with the same id,
331 /// Claude Code uses the first.
332 ///
333 /// - **Values**: string, up to 64 letters, digits, `.`, `_`, or `-` (required)
334 /// - **Default**: a position-based id
335 ///
336 /// Docs: [`id`](https://code.claude.com/docs/en/settings-reference#spinnertipsoverride).
337 #[serde(skip_serializing_if = "Option::is_none")]
338 pub id: Option<String>,
339 /// The tip, one line of up to 500 characters. Claude Code strips ANSI escapes and control
340 /// characters and collapses whitespace.
341 ///
342 /// - **Values**: string, one line of up to 500 characters (required)
343 /// - **Default**: none: required
344 ///
345 /// Docs: [`text`](https://code.claude.com/docs/en/settings-reference#spinnertipsoverride).
346 #[serde(skip_serializing_if = "Option::is_none")]
347 pub text: Option<String>,
348 /// Sessions Claude Code waits before showing the tip again, `0` to `1000`, default `0`.
349 ///
350 /// - **Values**: a whole number, `0` to `1000`
351 /// - **Default**: `0`
352 ///
353 /// Docs: [`cooldownSessions`](https://code.claude.com/docs/en/settings-reference#spinnertipsoverride).
354 #[serde(skip_serializing_if = "Option::is_none")]
355 pub cooldown_sessions: Option<u64>,
356 /// Order among tips that have gone unshown equally long, higher first, `-10` to `10`,
357 /// default `0`.
358 ///
359 /// - **Values**: a whole number, `-10` to `10`
360 /// - **Default**: `0`
361 ///
362 /// Docs: [`priority`](https://code.claude.com/docs/en/settings-reference#spinnertipsoverride).
363 #[serde(skip_serializing_if = "Option::is_none")]
364 pub priority: Option<i64>,
365 /// Keys Claude Code accepts here that this crate doesn't model (newer or
366 /// undocumented ones), kept as written so the document round-trips.
367 #[serde(flatten)]
368 pub extra: Extra,
369}
370
371/// `managedMcpServers`: MCP server configurations, by name or as a list.
372#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
373#[serde(untagged)]
374#[non_exhaustive]
375pub enum ManagedMcpServers {
376 /// Server name → its `.mcp.json` configuration.
377 ByName(BTreeMap<String, Extra>),
378 /// A list of configurations.
379 List(Vec<Extra>),
380}
381
382/// `worktree`.
383///
384/// Configure how Claude Code creates and manages [git
385/// worktrees](https://code.claude.com/docs/en/worktrees) for `--worktree`, the `EnterWorktree`
386/// tool, and isolated subagents and background sessions.
387///
388/// Docs: [`worktree`](https://code.claude.com/docs/en/settings-reference#worktree).
389#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
390#[serde(rename_all = "camelCase")]
391#[non_exhaustive]
392pub struct Worktree {
393 /// Check out only the listed directories in each worktree through git sparse-checkout.
394 /// Claude Code writes only those directories plus root-level files to disk, which is faster
395 /// in large monorepos; see [Check out only the directories you
396 /// need](https://code.claude.com/docs/en/large-codebases#check-out-only-the-directories-you-need).
397 ///
398 /// - **Values**: array of strings, directory paths relative to the repository root
399 /// - **Default**: unset, so each worktree checks out the whole tree
400 /// - **Scope**: any settings file.
401 ///
402 /// Docs: [`sparsePaths`](https://code.claude.com/docs/en/settings-reference#worktree-sparsepaths).
403 #[serde(skip_serializing_if = "Option::is_none")]
404 pub sparse_paths: Option<Vec<String>>,
405 /// Choose which ref new worktrees branch from. `"fresh"` branches from
406 /// `origin/<default-branch>` for a clean tree matching the remote; `"head"` branches from
407 /// your current local `HEAD`, so unpushed commits and feature-branch state are present in
408 /// the worktree.
409 ///
410 /// - **Values**: string, one of:
411 /// - `"fresh"`: new worktrees branch from `origin/<default-branch>`
412 /// - `"head"`: new worktrees branch from your current local `HEAD`, including unpushed
413 /// commits
414 /// - **Default**: `"fresh"`
415 /// - **Scope**: any settings file.
416 ///
417 /// Docs: [`baseRef`](https://code.claude.com/docs/en/settings-reference#worktree-baseref).
418 #[serde(skip_serializing_if = "Option::is_none")]
419 pub base_ref: Option<WorktreeBaseRef>,
420 /// Choose how [background
421 /// sessions](https://code.claude.com/docs/en/agent-view#how-file-edits-are-isolated)
422 /// isolate their file edits. If you moved a session to the background with `←` or
423 /// `/background`, that session edits files in place whatever this key says. With
424 /// `"worktree"`, Claude Code blocks `Edit` and `Write` in the main checkout until the
425 /// session calls `EnterWorktree`; with `"none"`, background jobs edit the working copy
426 /// directly.
427 ///
428 /// - **Values**: string, one of:
429 /// - `"worktree"`: Claude Code blocks `Edit` and `Write` in the main checkout until the
430 /// session calls `EnterWorktree`
431 /// - `"none"`: background jobs edit the working copy directly
432 /// - **Default**: `"worktree"`
433 /// - **Scope**: any settings file.
434 ///
435 /// Docs: [`bgIsolation`](https://code.claude.com/docs/en/settings-reference#worktree-bgisolation).
436 #[serde(skip_serializing_if = "Option::is_none")]
437 pub bg_isolation: Option<BgIsolation>,
438 /// Symlink directories from the main repository into each worktree so you don't duplicate
439 /// large directories on disk.
440 ///
441 /// - **Values**: array of strings, directory paths relative to the repository root
442 /// - **Default**: unset, so Claude Code symlinks no directories
443 /// - **Scope**: any settings file.
444 ///
445 /// Docs: [`symlinkDirectories`](https://code.claude.com/docs/en/settings-reference#worktree-symlinkdirectories).
446 #[serde(skip_serializing_if = "Option::is_none")]
447 pub symlink_directories: Option<Vec<String>>,
448 /// Choose the folder on a remote machine where [Desktop SSH
449 /// sessions](https://code.claude.com/docs/en/desktop#choose-where-ssh-session-worktrees-go)
450 /// create their worktrees, instead of `<project-root>/.claude/worktrees/`. Only the desktop
451 /// app reads this key: `--worktree`, the `EnterWorktree` tool, isolated subagents, and
452 /// background sessions ignore it. Requires Claude Desktop v1.44121.0 or later.
453 ///
454 /// - **Values**: string, an absolute path or one that starts with `~/`
455 /// - **Default**: unset, so worktrees go inside the project
456 /// - **Scope**: user, in `~/.claude/settings.json` on the remote machine.
457 ///
458 /// Docs: [`location`](https://code.claude.com/docs/en/settings-reference#worktree-location).
459 #[serde(skip_serializing_if = "Option::is_none")]
460 pub location: Option<String>,
461 /// Keys Claude Code accepts here that this crate doesn't model (newer or
462 /// undocumented ones), kept as written so the document round-trips.
463 #[serde(flatten)]
464 pub extra: Extra,
465}
466
467/// An entry of `sshConfigs`.
468///
469/// Add SSH connections to the
470/// [Desktop](https://code.claude.com/docs/en/desktop#pre-configure-ssh-connections-for-your-team)
471/// environment selector. Administrators use `sshConfigs` to distribute shared connections to a
472/// team.
473///
474/// Docs: [`sshConfigs`](https://code.claude.com/docs/en/settings-reference#sshconfigs).
475#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
476#[serde(rename_all = "camelCase")]
477#[non_exhaustive]
478pub struct SshConfig {
479 /// Unique identifier for this SSH config, used to match configs across settings sources.
480 ///
481 /// - **Values**: string
482 /// - **Default**: unset
483 ///
484 /// Docs: [`id`](https://code.claude.com/docs/en/settings-reference#sshconfigs).
485 #[serde(skip_serializing_if = "Option::is_none")]
486 pub id: Option<String>,
487 /// Display name for the SSH connection.
488 ///
489 /// - **Values**: string
490 /// - **Default**: unset
491 ///
492 /// Docs: [`name`](https://code.claude.com/docs/en/settings-reference#sshconfigs).
493 #[serde(skip_serializing_if = "Option::is_none")]
494 pub name: Option<String>,
495 /// SSH host in the form "user@hostname" or "hostname", or a host alias from ~/.ssh/config.
496 ///
497 /// - **Values**: string
498 /// - **Default**: unset
499 ///
500 /// Docs: [`sshHost`](https://code.claude.com/docs/en/settings-reference#sshconfigs).
501 #[serde(skip_serializing_if = "Option::is_none")]
502 pub ssh_host: Option<String>,
503 /// SSH port (default 22).
504 ///
505 /// - **Values**: a whole number
506 /// - **Default**: unset
507 ///
508 /// Docs: [`sshPort`](https://code.claude.com/docs/en/settings-reference#sshconfigs).
509 #[serde(skip_serializing_if = "Option::is_none")]
510 pub ssh_port: Option<u16>,
511 /// Path to the SSH identity file (private key).
512 ///
513 /// - **Values**: string
514 /// - **Default**: unset
515 ///
516 /// Docs: [`sshIdentityFile`](https://code.claude.com/docs/en/settings-reference#sshconfigs).
517 #[serde(skip_serializing_if = "Option::is_none")]
518 pub ssh_identity_file: Option<String>,
519 /// Default working directory on the remote host; supports tilde expansion. Defaults to the
520 /// remote user home directory.
521 ///
522 /// - **Values**: string
523 /// - **Default**: unset
524 ///
525 /// Docs: [`startDirectory`](https://code.claude.com/docs/en/settings-reference#sshconfigs).
526 #[serde(skip_serializing_if = "Option::is_none")]
527 pub start_directory: Option<String>,
528 /// Keys Claude Code accepts here that this crate doesn't model (newer or
529 /// undocumented ones), kept as written so the document round-trips.
530 #[serde(flatten)]
531 pub extra: Extra,
532}
533
534/// An entry of `sshHostCommands`: a desktop SSH connection opened by a
535/// command.
536///
537/// Add SSH connections whose host comes from a command to the
538/// [Desktop](https://code.claude.com/docs/en/desktop#create-an-ssh-connection-from-a-command)
539/// environment selector. When you create a connection or create another machine for it, Desktop
540/// runs the entry's command on your computer and connects to the host that the command prints.
541///
542/// Docs: [`sshHostCommands`](https://code.claude.com/docs/en/settings-reference#sshhostcommands).
543#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
544#[serde(rename_all = "camelCase")]
545#[non_exhaustive]
546pub struct SshHostCommand {
547 /// The connection's identifier.
548 ///
549 /// - **Values**: string (required)
550 /// - **Default**: unset
551 ///
552 /// Docs: [`id`](None).
553 #[serde(skip_serializing_if = "Option::is_none")]
554 pub id: Option<String>,
555 /// The connection's display name.
556 ///
557 /// - **Values**: string (required)
558 /// - **Default**: unset
559 ///
560 /// Docs: [`name`](None).
561 #[serde(skip_serializing_if = "Option::is_none")]
562 pub name: Option<String>,
563 /// The program and its arguments that open the connection. The desktop app does not read it
564 /// as shell syntax: no pipes or variables.
565 ///
566 /// - **Values**: string (required)
567 /// - **Default**: unset
568 ///
569 /// Docs: [`command`](None).
570 #[serde(skip_serializing_if = "Option::is_none")]
571 pub command: Option<String>,
572 /// The private key to use.
573 ///
574 /// - **Values**: string, a path
575 /// - **Default**: unset
576 ///
577 /// Docs: [`sshIdentityFile`](None).
578 #[serde(skip_serializing_if = "Option::is_none")]
579 pub ssh_identity_file: Option<String>,
580 /// The working directory on the remote host.
581 ///
582 /// - **Values**: string, a path
583 /// - **Default**: unset
584 ///
585 /// Docs: [`startDirectory`](None).
586 #[serde(skip_serializing_if = "Option::is_none")]
587 pub start_directory: Option<String>,
588 /// Keys Claude Code accepts here that this crate doesn't model (newer or
589 /// undocumented ones), kept as written so the document round-trips.
590 #[serde(flatten)]
591 pub extra: Extra,
592}
593
594/// `voice`.
595///
596/// Turn on [voice dictation](https://code.claude.com/docs/en/voice-dictation) and choose how
597/// the dictation key behaves. Claude Code writes this object for you when you run `/voice`.
598///
599/// Docs: [`voice`](https://code.claude.com/docs/en/settings-reference#voice).
600#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
601#[serde(rename_all = "camelCase")]
602#[non_exhaustive]
603pub struct Voice {
604 /// Enable push-to-talk voice dictation input.
605 ///
606 /// - **Values**: Boolean
607 /// - **Default**: unset
608 ///
609 /// Docs: [`enabled`](https://code.claude.com/docs/en/settings-reference#voice).
610 #[serde(skip_serializing_if = "Option::is_none")]
611 pub enabled: Option<bool>,
612 /// Recording mode: "hold" (default) is push-to-talk; "tap" taps once to start and again to
613 /// stop and submit.
614 ///
615 /// - **Values**: `"hold"`, `"tap"`
616 /// - **Default**: unset
617 ///
618 /// Docs: [`mode`](https://code.claude.com/docs/en/settings-reference#voice).
619 #[serde(skip_serializing_if = "Option::is_none")]
620 pub mode: Option<VoiceMode>,
621 /// In hold mode, auto-submit the prompt on key release when the transcript is at least
622 /// three words long.
623 ///
624 /// - **Values**: Boolean
625 /// - **Default**: unset
626 ///
627 /// Docs: [`autoSubmit`](https://code.claude.com/docs/en/settings-reference#voice).
628 #[serde(skip_serializing_if = "Option::is_none")]
629 pub auto_submit: Option<bool>,
630 /// Keys Claude Code accepts here that this crate doesn't model (newer or
631 /// undocumented ones), kept as written so the document round-trips.
632 #[serde(flatten)]
633 pub extra: Extra,
634}
635
636/// An entry of `footerLinksRegexes`.
637///
638/// Render extra clickable badges in the footer below the input box when a regex matches turn
639/// output: tool results, including file contents and fetched pages, and Claude's own responses.
640/// Use it to turn IDs printed by project CLIs, such as review tools and issue trackers, into
641/// session links.
642///
643/// Docs: [`footerLinksRegexes`](https://code.claude.com/docs/en/settings-reference#footerlinksregexes).
644#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
645#[serde(rename_all = "camelCase")]
646#[non_exhaustive]
647pub struct FooterLink {
648 /// Config variant; "regex" matches turn output and builds a URL from named capture groups.
649 ///
650 /// - **Values**: string
651 /// - **Default**: unset
652 ///
653 /// Docs: [`type`](https://code.claude.com/docs/en/settings-reference#footerlinksregexes).
654 #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
655 pub kind: Option<String>,
656 /// Regex matched against turn output.
657 ///
658 /// - **Values**: string
659 /// - **Default**: unset
660 ///
661 /// Docs: [`pattern`](https://code.claude.com/docs/en/settings-reference#footerlinksregexes).
662 #[serde(skip_serializing_if = "Option::is_none")]
663 pub pattern: Option<String>,
664 /// Link target; {name} placeholders are filled from named regex capture groups.
665 ///
666 /// - **Values**: string
667 /// - **Default**: unset
668 ///
669 /// Docs: [`url`](https://code.claude.com/docs/en/settings-reference#footerlinksregexes).
670 #[serde(skip_serializing_if = "Option::is_none")]
671 pub url: Option<String>,
672 /// Badge text; {name} placeholders filled from named capture groups, defaults to the full
673 /// match.
674 ///
675 /// - **Values**: string
676 /// - **Default**: unset
677 ///
678 /// Docs: [`label`](https://code.claude.com/docs/en/settings-reference#footerlinksregexes).
679 #[serde(skip_serializing_if = "Option::is_none")]
680 pub label: Option<String>,
681 /// Keys Claude Code accepts here that this crate doesn't model (newer or
682 /// undocumented ones), kept as written so the document round-trips.
683 #[serde(flatten)]
684 pub extra: Extra,
685}
686
687/// `policyHelper`: a program that computes managed settings.
688///
689/// Run an executable you deploy that computes managed settings at startup, so you can derive
690/// policy from device posture, identity, or a remote service instead of a static file. Claude
691/// Code runs the helper before it accepts the first prompt and treats the settings it emits as
692/// the managed settings for the session.
693///
694/// Docs: [`policyHelper`](https://code.claude.com/docs/en/settings-reference#policyhelper).
695#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
696#[serde(rename_all = "camelCase")]
697#[non_exhaustive]
698pub struct PolicyHelper {
699 /// Name the helper executable Claude Code runs. For what happens when the path breaks the
700 /// rules below, see [Helper
701 /// failures](https://code.claude.com/docs/en/settings-reference#helper-failures).
702 ///
703 /// - **Values**: string, an absolute path in normalized form, without `.` or `..` segments;
704 /// on Windows, a drive-letter or UNC path that ends in `.exe`
705 /// - **Default**: none; required when `policyHelper` is set
706 /// - **Scope**: managed. Read from the macOS plist, the Windows HKLM registry, or the
707 /// managed settings file, wherever policyhelper is read.
708 ///
709 /// Docs: [`path`](https://code.claude.com/docs/en/settings-reference#policyhelper-path).
710 #[serde(skip_serializing_if = "Option::is_none")]
711 pub path: Option<String>,
712 /// Set how long Claude Code waits for the helper before treating the run as failed. A
713 /// timed-out run fails the same way as a non-zero exit, so at startup Claude Code refuses
714 /// to start.
715 ///
716 /// - **Values**: integer, milliseconds, minimum `1000`
717 /// - **Default**: `10000`
718 /// - **Scope**: managed. Read from the macOS plist, the Windows HKLM registry, or the
719 /// managed settings file, wherever policyhelper is read.
720 ///
721 /// Docs: [`timeoutMs`](https://code.claude.com/docs/en/settings-reference#policyhelper-timeoutms).
722 #[serde(skip_serializing_if = "Option::is_none")]
723 pub timeout_ms: Option<u64>,
724 /// Have Claude Code re-run the helper in the background on an interval so policy changes
725 /// reach a running session. When a refresh succeeds, its output replaces the previous
726 /// managed settings without a restart; when a refresh fails, Claude Code keeps the policy
727 /// it already has.
728 ///
729 /// - **Values**: integer, milliseconds: `0` to disable refresh, otherwise at least `60000`
730 /// - **Default**: unset, so Claude Code runs the helper once at startup
731 /// - **Scope**: managed. Read from the macOS plist, the Windows HKLM registry, or the
732 /// managed settings file, wherever policyhelper is read.
733 ///
734 /// Docs: [`refreshIntervalMs`](https://code.claude.com/docs/en/settings-reference#policyhelper-refreshintervalms).
735 #[serde(skip_serializing_if = "Option::is_none")]
736 pub refresh_interval_ms: Option<u64>,
737 /// Keys Claude Code accepts here that this crate doesn't model (newer or
738 /// undocumented ones), kept as written so the document round-trips.
739 #[serde(flatten)]
740 pub extra: Extra,
741}
742
743/// `spellcheck`.
744///
745/// Underline misspelled words in the prompt input as you type, using a spell checker you
746/// install. Claude Code checks only the text in the input box.
747///
748/// Docs: [`spellcheck`](https://code.claude.com/docs/en/settings-reference#spellcheck).
749#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
750#[serde(rename_all = "camelCase")]
751#[non_exhaustive]
752pub struct Spellcheck {
753 /// Turn spellchecking of the prompt on.
754 ///
755 /// - **Values**: Boolean
756 /// - **Default**: unset
757 ///
758 /// Docs: [`enabled`](None).
759 #[serde(skip_serializing_if = "Option::is_none")]
760 pub enabled: Option<bool>,
761 /// The spellchecker to run.
762 ///
763 /// - **Values**: `"aspell"`, `"hunspell"`, `"ispell"`, or `"auto"` for the first of those
764 /// found on `PATH`
765 /// - **Default**: `"auto"`
766 ///
767 /// Docs: [`checker`](None).
768 #[serde(skip_serializing_if = "Option::is_none")]
769 pub checker: Option<SpellChecker>,
770 /// The dictionary, passed to the checker as its dictionary name, such as `en_GB`.
771 ///
772 /// - **Values**: string
773 /// - **Default**: unset
774 ///
775 /// Docs: [`language`](None).
776 #[serde(skip_serializing_if = "Option::is_none")]
777 pub language: Option<String>,
778 /// The color that marks a misspelled word.
779 ///
780 /// - **Values**: string: a terminal color name, `#rrggbb`, `rgb(r,g,b)`, `ansi256(n)`, or
781 /// `ansi:<name>`
782 /// - **Default**: unset
783 ///
784 /// Docs: [`color`](None).
785 #[serde(skip_serializing_if = "Option::is_none")]
786 pub color: Option<String>,
787 /// Keys Claude Code accepts here that this crate doesn't model (newer or
788 /// undocumented ones), kept as written so the document round-trips.
789 #[serde(flatten)]
790 pub extra: Extra,
791}
792
793/// `remote`: cloud sessions.
794///
795/// Defaults for cloud sessions.
796///
797/// Docs: [`remote`](https://code.claude.com/docs/en/settings-reference#remote-defaultenvironmentid).
798#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
799#[serde(rename_all = "camelCase")]
800#[non_exhaustive]
801pub struct Remote {
802 /// Pick the default [cloud environment](https://code.claude.com/docs/en/cloud-environments)
803 /// for cloud sessions you create from the CLI, such as with `claude --cloud`. Claude Code
804 /// writes this key to your user settings when you pick an environment with
805 /// [`/remote-env`](https://code.claude.com/docs/en/cloud-environments#select-an-environment-from-the-cli).
806 ///
807 /// - **Values**: string, an environment ID such as `env_...` or `ccpool_...`
808 /// - **Default**: unset, so Claude Code uses the Anthropic-hosted environment when your
809 /// list has one, and otherwise the first environment in your list that isn't a [Remote
810 /// Control bridge
811 /// environment](https://code.claude.com/docs/en/cloud-environments#the-default-environment),
812 /// or the first environment when every one is a bridge environment
813 /// - **Scope**: any settings file. For a self-hosted environment ID, user or managed
814 /// settings, or the `--settings` flag only.
815 ///
816 /// Docs: [`defaultEnvironmentId`](https://code.claude.com/docs/en/settings-reference#remote-defaultenvironmentid).
817 #[serde(skip_serializing_if = "Option::is_none")]
818 pub default_environment_id: Option<String>,
819 /// Keys Claude Code accepts here that this crate doesn't model (newer or
820 /// undocumented ones), kept as written so the document round-trips.
821 #[serde(flatten)]
822 pub extra: Extra,
823}
824
825/// `forceLoginOrgUUID`: one organization or several.
826#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
827#[serde(untagged)]
828#[non_exhaustive]
829pub enum OneOrMany {
830 /// One.
831 One(String),
832 /// Several.
833 Many(Vec<String>),
834}
835
836walk!(Attribution {});
837walk!(StatusLine {});
838walk!(CommandSetting {});
839walk!(SpinnerVerbs {});
840walk!(SpinnerTips { tips: "tips" });
841walk!(TipEntry {});
842walk!(Worktree {});
843walk!(SshConfig {});
844walk!(SshHostCommand {});
845walk!(Voice {});
846walk!(FooterLink {});
847walk!(PolicyHelper {});
848walk!(Spellcheck {});
849walk!(Remote {});