claude_code_settings/enums.rs
1//! The string enums. Each has an `Other` variant that keeps a value this
2//! crate doesn't know (one a newer Claude Code added) as it was written.
3
4use alloc::borrow::ToOwned;
5use alloc::string::String;
6use core::fmt;
7
8/// Defines a string enum: its variants, their JSON spellings and an
9/// `Other(String)` for the rest, with `as_str`, `is_known`, `From<&str>`,
10/// `Display` and serde as a plain string.
11macro_rules! string_enum {
12 (
13 $(#[$meta:meta])*
14 pub enum $name:ident {
15 $($(#[$vmeta:meta])* $variant:ident = $value:literal,)*
16 }
17 ) => {
18 $(#[$meta])*
19 #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
20 #[non_exhaustive]
21 pub enum $name {
22 $($(#[$vmeta])* $variant,)*
23 /// A value this crate doesn't know, as written.
24 Other(String),
25 }
26
27 impl $name {
28 /// The value as Claude Code spells it.
29 pub fn as_str(&self) -> &str {
30 match self {
31 $(Self::$variant => $value,)*
32 Self::Other(s) => s,
33 }
34 }
35
36 /// Whether this is a value this crate knows (not `Other`).
37 pub fn is_known(&self) -> bool {
38 !matches!(self, Self::Other(_))
39 }
40 }
41
42 impl From<&str> for $name {
43 fn from(s: &str) -> Self {
44 match s {
45 $($value => Self::$variant,)*
46 other => Self::Other(other.to_owned()),
47 }
48 }
49 }
50
51 impl From<String> for $name {
52 fn from(s: String) -> Self {
53 match Self::from(s.as_str()) {
54 Self::Other(_) => Self::Other(s),
55 known => known,
56 }
57 }
58 }
59
60 impl AsRef<str> for $name {
61 fn as_ref(&self) -> &str {
62 self.as_str()
63 }
64 }
65
66 impl fmt::Display for $name {
67 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
68 f.write_str(self.as_str())
69 }
70 }
71
72 impl ::serde::Serialize for $name {
73 fn serialize<S: ::serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
74 s.serialize_str(self.as_str())
75 }
76 }
77
78 impl<'de> ::serde::Deserialize<'de> for $name {
79 fn deserialize<D: ::serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
80 String::deserialize(d).map(Self::from)
81 }
82 }
83
84 impl $crate::walk::Key for $name {
85 fn key(&self) -> &str {
86 self.as_str()
87 }
88
89 fn is_known(&self) -> bool {
90 $name::is_known(self)
91 }
92 }
93 };
94}
95
96string_enum! {
97 /// `permissions.defaultMode`: the permission mode a session starts in.
98 ///
99 /// Docs: [`permissions.defaultMode`](https://code.claude.com/docs/en/settings-reference#permissions-defaultmode).
100 pub enum PermissionMode {
101 /// Claude Code runs only reads without asking.
102 Default = "default",
103 /// Claude Code also runs file edits and common filesystem commands such as `mkdir` and
104 /// `mv` without asking.
105 AcceptEdits = "acceptEdits",
106 /// Claude Code reads and plans but blocks edits until you approve a plan.
107 Plan = "plan",
108 /// Claude Code auto-denies every call that would otherwise prompt, though a
109 /// [mod](https://code.claude.com/docs/en/plugins/mods/overview) you installed can still
110 /// approve [some of those
111 /// calls](https://code.claude.com/docs/en/permissions#precedence-among-rules-hooks-and-mods).
112 /// File reads inside your working directories, other actions that need no approval, and
113 /// pre-approved tools still run, apart from reads from [network
114 /// paths](https://code.claude.com/docs/en/permissions#network-paths).
115 DontAsk = "dontAsk",
116 /// Claude Code runs everything without asking.
117 BypassPermissions = "bypassPermissions",
118 /// Claude Code runs without routine prompts; before actions such as shell commands and
119 /// network requests run, a background classifier checks that they align with your
120 /// request.
121 Auto = "auto",
122 /// In the schema; Claude Code 2.1.322 rejects it.
123 Delegate = "delegate",
124 /// An alias for `"default"`.
125 Manual = "manual",
126 }
127}
128
129string_enum! {
130 /// The one value of the `disable*` keys that turn a feature off
131 /// (`permissions.disableBypassPermissionsMode`, `disableAutoMode`,
132 /// `disableDeepLinkRegistration`).
133 ///
134 /// Docs: [`permissions.disableBypassPermissionsMode`](https://code.claude.com/docs/en/settings-reference#permissions-disablebypasspermissionsmode).
135 pub enum DisableFlag {
136 /// Turn it off.
137 Disable = "disable",
138 }
139}
140
141string_enum! {
142 /// `browserExternalPageTools`.
143 ///
144 /// Docs: [`browserExternalPageTools`](https://code.claude.com/docs/en/settings-reference#browserexternalpagetools).
145 pub enum DisabledFlag {
146 /// Turn the tools off.
147 Disabled = "disabled",
148 }
149}
150
151string_enum! {
152 /// `autoUpdatesChannel`.
153 ///
154 /// Docs: [`autoUpdatesChannel`](https://code.claude.com/docs/en/settings-reference#autoupdateschannel).
155 pub enum UpdatesChannel {
156 /// Updates follow a version that is typically about one week old and skips releases
157 /// with major regressions.
158 Stable = "stable",
159 /// Updates follow the most recent release.
160 Latest = "latest",
161 /// Release candidates (accepted by Claude Code 2.1.322, not in the
162 /// schema).
163 Rc = "rc",
164 }
165}
166
167string_enum! {
168 /// `effortLevel`, `maxEffortLevel` and `modelSettings.*.effortLevel`.
169 /// `max` is valid only as a cap.
170 ///
171 /// Docs: [`effortLevel`](https://code.claude.com/docs/en/settings-reference#effortlevel).
172 pub enum EffortLevel {
173 /// The least reasoning, for short, scoped, latency-sensitive tasks that aren't
174 /// intelligence-sensitive.
175 Low = "low",
176 /// Reduces token usage for cost-sensitive work that can trade off some intelligence.
177 Medium = "medium",
178 /// Balances token usage and intelligence.
179 High = "high",
180 /// Deeper reasoning at higher token spend.
181 Xhigh = "xhigh",
182 /// No cap (`maxEffortLevel` only).
183 Max = "max",
184 }
185}
186
187string_enum! {
188 /// `forceLoginMethod`.
189 ///
190 /// Docs: [`forceLoginMethod`](https://code.claude.com/docs/en/settings-reference#forceloginmethod).
191 pub enum LoginMethod {
192 /// Claude.ai sign-in.
193 ClaudeAi = "claudeai",
194 /// Claude Console sign-in.
195 Console = "console",
196 /// Claude Code sends people to a cloud gateway instead of a first-party login.
197 Gateway = "gateway",
198 }
199}
200
201string_enum! {
202 /// `teammateMode`: how agent-team teammates are shown.
203 ///
204 /// Docs: [`teammateMode`](https://code.claude.com/docs/en/settings-reference#teammatemode).
205 pub enum TeammateMode {
206 /// Split panes when you're running inside tmux, or inside iTerm2 with `it2` on your
207 /// `PATH` or tmux installed; in-process otherwise.
208 Auto = "auto",
209 /// Teammates run inside your main terminal pane.
210 InProcess = "in-process",
211 /// Split panes using tmux or iTerm2, detected from your terminal.
212 Tmux = "tmux",
213 /// ITerm2 native split panes through the `it2` CLI.
214 Iterm2 = "iterm2",
215 }
216}
217
218string_enum! {
219 /// `parentSettingsBehavior` and `managedSourcesBehavior`.
220 ///
221 /// Docs: [`parentSettingsBehavior`](https://code.claude.com/docs/en/settings-reference#parentsettingsbehavior).
222 pub enum SourcesBehavior {
223 /// Claude Code drops the host-supplied settings when an admin-deployed managed tier is
224 /// present.
225 FirstWins = "first-wins",
226 /// Claude Code applies the host-supplied settings under the admin tier through a
227 /// restrictive-only filter.
228 Merge = "merge",
229 }
230}
231
232string_enum! {
233 /// `defaultShell` and a command hook's `shell`.
234 ///
235 /// Docs: [`defaultShell`](https://code.claude.com/docs/en/settings-reference#defaultshell).
236 pub enum Shell {
237 /// Claude Code runs your `!` commands in Bash.
238 Bash = "bash",
239 /// Claude Code runs your `!` commands in PowerShell.
240 Powershell = "powershell",
241 }
242}
243
244string_enum! {
245 /// `tui`.
246 ///
247 /// Docs: [`tui`](https://code.claude.com/docs/en/settings-reference#tui).
248 pub enum Tui {
249 /// The flicker-free alt-screen renderer with virtualized scrollback.
250 Fullscreen = "fullscreen",
251 /// The classic main-screen renderer.
252 Default = "default",
253 }
254}
255
256string_enum! {
257 /// `viewMode`.
258 ///
259 /// Docs: [`viewMode`](https://code.claude.com/docs/en/settings-reference#viewmode).
260 pub enum ViewMode {
261 /// The normal transcript with truncated tool output.
262 Default = "default",
263 /// The transcript with full tool output.
264 Verbose = "verbose",
265 /// Only your last prompt, a one-line summary of tool calls with edit diffstats, and the
266 /// final response. Focus view needs the [fullscreen
267 /// renderer](https://code.claude.com/docs/en/settings-reference#tui).
268 Focus = "focus",
269 }
270}
271
272string_enum! {
273 /// `editorMode`.
274 ///
275 /// Docs: [`editorMode`](https://code.claude.com/docs/en/settings-reference#editormode).
276 pub enum EditorMode {
277 /// Standard key bindings in the prompt input.
278 Normal = "normal",
279 /// Vim-style editing with NORMAL, INSERT, and VISUAL modes.
280 Vim = "vim",
281 }
282}
283
284string_enum! {
285 /// `preferredNotifChannel`.
286 ///
287 /// Docs: [`preferredNotifChannel`](https://code.claude.com/docs/en/settings-reference#preferrednotifchannel).
288 pub enum NotifChannel {
289 /// Claude Code sends a desktop notification when it detects iTerm2, Ghostty, or Kitty,
290 /// rings the bell in Terminal.app only when its audible bell is off, and does nothing
291 /// elsewhere.
292 Auto = "auto",
293 /// Claude Code rings the bell character in any terminal.
294 TerminalBell = "terminal_bell",
295 /// Claude Code sends an iTerm2 desktop notification.
296 Iterm2 = "iterm2",
297 /// Claude Code sends an iTerm2 desktop notification and rings the bell.
298 Iterm2WithBell = "iterm2_with_bell",
299 /// Claude Code sends a Kitty desktop notification.
300 Kitty = "kitty",
301 /// Claude Code sends a Ghostty desktop notification.
302 Ghostty = "ghostty",
303 /// Claude Code sends no notification.
304 NotificationsDisabled = "notifications_disabled",
305 }
306}
307
308string_enum! {
309 /// `theme`. A custom theme's name is `Other`.
310 ///
311 /// Docs: [`theme`](https://code.claude.com/docs/en/settings-reference#theme).
312 pub enum Theme {
313 /// Matches your terminal's light or dark background.
314 Auto = "auto",
315 /// The dark theme.
316 Dark = "dark",
317 /// The light theme.
318 Light = "light",
319 /// The dark theme with colorblind-friendly colors.
320 DarkDaltonized = "dark-daltonized",
321 /// The light theme with colorblind-friendly colors.
322 LightDaltonized = "light-daltonized",
323 /// The dark theme using only your terminal's ANSI color palette.
324 DarkAnsi = "dark-ansi",
325 /// The light theme using only your terminal's ANSI color palette.
326 LightAnsi = "light-ansi",
327 }
328}
329
330string_enum! {
331 /// `askUserQuestionTimeout` and `dialogExpiry`.
332 ///
333 /// Docs: [`askUserQuestionTimeout`](https://code.claude.com/docs/en/settings-reference#askuserquestiontimeout).
334 pub enum DialogTimeout {
335 /// 60 seconds.
336 Seconds60 = "60s",
337 /// 5 minutes.
338 Minutes5 = "5m",
339 /// 10 minutes.
340 Minutes10 = "10m",
341 /// No deadline.
342 Never = "never",
343 }
344}
345
346string_enum! {
347 /// `workflowSizeGuideline`.
348 ///
349 /// Docs: [`workflowSizeGuideline`](https://code.claude.com/docs/en/settings-reference#workflowsizeguideline).
350 pub enum WorkflowSize {
351 /// No guideline, so Claude sizes the workflow to the task.
352 Unrestricted = "unrestricted",
353 /// Claude aims for fewer than 5 agents.
354 Small = "small",
355 /// Claude aims for fewer than 10 agents.
356 Medium = "medium",
357 /// Claude aims for fewer than 50 agents.
358 Large = "large",
359 }
360}
361
362string_enum! {
363 /// `diffTool`.
364 ///
365 /// Docs: [`diffTool`](https://code.claude.com/docs/en/settings-reference#difftool).
366 pub enum DiffTool {
367 /// Claude Code opens the diff in the IDE's diff viewer when a VS Code or JetBrains IDE
368 /// is connected.
369 Auto = "auto",
370 /// Claude Code keeps the diff in the terminal.
371 Terminal = "terminal",
372 }
373}
374
375string_enum! {
376 /// A value of `skillOverrides`.
377 ///
378 /// Docs: [`skillOverrides`](https://code.claude.com/docs/en/settings-reference#skilloverrides).
379 pub enum SkillOverride {
380 /// Claude sees the skill and you can type `/name`.
381 On = "on",
382 /// Claude sees the skill by name without its description.
383 NameOnly = "name-only",
384 /// Claude doesn't see the skill, but you can still type `/name`.
385 UserInvocableOnly = "user-invocable-only",
386 /// Claude doesn't see the skill and `/name` is hidden from autocomplete.
387 Off = "off",
388 }
389}
390
391string_enum! {
392 /// `spinnerVerbs.mode`.
393 ///
394 /// Docs: [`spinnerVerbs`](https://code.claude.com/docs/en/settings-reference#spinnerverbs).
395 pub enum SpinnerVerbsMode {
396 /// Claude Code adds your verbs to the built-in set.
397 Append = "append",
398 /// Claude Code shows only your verbs.
399 Replace = "replace",
400 }
401}
402
403string_enum! {
404 /// `worktree.baseRef`.
405 ///
406 /// Docs: [`worktree.baseRef`](https://code.claude.com/docs/en/settings-reference#worktree-baseref).
407 pub enum WorktreeBaseRef {
408 /// New worktrees branch from `origin/<default-branch>`.
409 Fresh = "fresh",
410 /// New worktrees branch from your current local `HEAD`, including unpushed commits.
411 Head = "head",
412 }
413}
414
415string_enum! {
416 /// `worktree.bgIsolation`.
417 ///
418 /// Docs: [`worktree.bgIsolation`](https://code.claude.com/docs/en/settings-reference#worktree-bgisolation).
419 pub enum BgIsolation {
420 /// Claude Code blocks `Edit` and `Write` in the main checkout until the session calls
421 /// `EnterWorktree`.
422 Worktree = "worktree",
423 /// Background jobs edit the working copy directly.
424 None = "none",
425 }
426}
427
428string_enum! {
429 /// `sandbox.enabledPlatforms`.
430 pub enum Platform {
431 /// macOS.
432 Macos = "macos",
433 /// Linux.
434 Linux = "linux",
435 /// WSL.
436 Wsl = "wsl",
437 /// Windows.
438 Windows = "windows",
439 }
440}
441
442string_enum! {
443 /// `sandbox.credentials.*.mode`.
444 ///
445 /// Docs: [`sandbox.credentials.files`](https://code.claude.com/docs/en/settings-reference#sandbox-credentials-files).
446 pub enum CredentialMode {
447 /// Hide it from sandboxed commands.
448 Deny = "deny",
449 /// Show sandboxed commands a placeholder.
450 Mask = "mask",
451 }
452}
453
454string_enum! {
455 /// `voice.mode`.
456 ///
457 /// Docs: [`voice`](https://code.claude.com/docs/en/settings-reference#voice).
458 pub enum VoiceMode {
459 /// You hold the dictation key while speaking and release it to stop.
460 Hold = "hold",
461 /// You tap the key once to start recording and again to send.
462 Tap = "tap",
463 }
464}
465
466string_enum! {
467 /// An entry of `strictPluginOnlyCustomization`.
468 ///
469 /// Docs: [`strictPluginOnlyCustomization`](https://code.claude.com/docs/en/settings-reference#strictpluginonlycustomization).
470 pub enum CustomizationKind {
471 /// Skills.
472 Skills = "skills",
473 /// Agents.
474 Agents = "agents",
475 /// Hooks.
476 Hooks = "hooks",
477 /// MCP servers.
478 Mcp = "mcp",
479 }
480}
481
482string_enum! {
483 /// `availableModelsMatch`.
484 ///
485 /// Docs: [`availableModelsMatch`](https://code.claude.com/docs/en/settings-reference#availablemodelsmatch).
486 pub enum ModelMatch {
487 /// A model ID entry permits its version and any model ID that extends it with another
488 /// segment.
489 Prefix = "prefix",
490 /// A model ID entry permits only the version it names, so `"claude-opus-5"` permits
491 /// Opus 5 but not `claude-opus-5-5`. An entry such as `"claude-opus-4-5"` also permits
492 /// its dated Anthropic model ID `claude-opus-4-5-20251101`. A family alias such as
493 /// `"opus"` still permits the whole family, and `best`, `opusplan`, and `default`
494 /// entries are ignored.
495 Exact = "exact",
496 }
497}
498
499string_enum! {
500 /// `promptCacheTtl` and `subagentPromptCacheTtl`.
501 ///
502 /// Docs: [`promptCacheTtl`](https://code.claude.com/docs/en/settings-reference#promptcachettl).
503 pub enum CacheTtl {
504 /// The cache holds for five minutes.
505 Minutes5 = "5m",
506 /// The cache holds for an hour.
507 Hour1 = "1h",
508 }
509}
510
511string_enum! {
512 /// `keybindingFlavor`.
513 ///
514 /// Docs: [`keybindingFlavor`](https://code.claude.com/docs/en/settings-reference#keybindingflavor).
515 pub enum KeybindingFlavor {
516 /// Claude Code's own bindings.
517 Classic = "classic",
518 /// readline bindings.
519 Readline = "readline",
520 }
521}
522
523string_enum! {
524 /// `timeFormat`. A strftime pattern (any value with a `%`) is `Other`.
525 ///
526 /// Docs: [`timeFormat`](https://code.claude.com/docs/en/settings-reference#timeformat).
527 pub enum TimeFormat {
528 /// The same as unset; each time keeps its built-in format, which follows your locale on
529 /// the turn duration message.
530 Auto = "auto",
531 /// A 12-hour clock.
532 Hour12 = "12-hour",
533 /// A 24-hour clock.
534 Hour24 = "24-hour",
535 /// A 24-hour clock in UTC with `Z` after the minutes, such as `18:05Z`; Claude Code
536 /// ignores [`timeZone`](https://code.claude.com/docs/en/settings-reference#timezone)
537 /// for this preset.
538 Hour24Utc = "24-hour-utc",
539 }
540}
541
542string_enum! {
543 /// `crossSessionInbound`.
544 ///
545 /// Docs: [`crossSessionInbound`](https://code.claude.com/docs/en/settings-reference#crosssessioninbound).
546 pub enum InboundMode {
547 /// Claude Code delivers the message to Claude.
548 Accept = "accept",
549 /// Claude Code shows a notice for the message without delivering it.
550 Hold = "hold",
551 /// Claude Code drops the message.
552 Refuse = "refuse",
553 }
554}
555
556string_enum! {
557 /// `feedbackDrafts`.
558 ///
559 /// Docs: [`feedbackDrafts`](https://code.claude.com/docs/en/settings-reference#feedbackdrafts).
560 pub enum FeedbackDrafts {
561 /// Claude Code shows a card above the prompt when Claude queues a draft, up to [three
562 /// cards in a
563 /// session](https://code.claude.com/docs/en/tools-reference#what-you-see-when-claude-drafts)
564 /// by default.
565 Notify = "notify",
566 /// Claude drafts without a card. You see the count of queued drafts in the prompt
567 /// footer and review them in `/feedback`.
568 Quiet = "quiet",
569 /// Claude Code removes the SendFeedback tool, so Claude can't queue drafts.
570 Off = "off",
571 }
572}
573
574string_enum! {
575 /// An entry of `allowedProviders`.
576 ///
577 /// Docs: [`allowedProviders`](https://code.claude.com/docs/en/settings-reference#allowedproviders).
578 pub enum Provider {
579 /// The Anthropic API on Anthropic's own host, through a claude.ai or Console sign-in or
580 /// an API key. Pair it with
581 /// [`forceLoginMethod`](https://code.claude.com/docs/en/settings-reference#forceloginmethod)
582 /// or
583 /// [`forceLoginOrgUUID`](https://code.claude.com/docs/en/settings-reference#forceloginorguuid)
584 /// to also restrict the sign-in.
585 Anthropic = "anthropic",
586 /// [Amazon Bedrock](https://code.claude.com/docs/en/amazon-bedrock).
587 Bedrock = "bedrock",
588 /// [Google Cloud's Agent Platform](https://code.claude.com/docs/en/google-vertex-ai),
589 /// formerly Vertex AI.
590 Vertex = "vertex",
591 /// [Microsoft Foundry](https://code.claude.com/docs/en/microsoft-foundry).
592 Foundry = "foundry",
593 /// [Claude Platform on AWS](https://code.claude.com/docs/en/claude-platform-on-aws).
594 AnthropicAws = "anthropicAws",
595 /// The Amazon Bedrock [Mantle
596 /// endpoint](https://code.claude.com/docs/en/amazon-bedrock#use-the-mantle-endpoint). A
597 /// session that [runs Mantle alongside the Invoke
598 /// API](https://code.claude.com/docs/en/amazon-bedrock#run-mantle-alongside-the-invoke-api)
599 /// uses both providers, so list `"bedrock"` and `"mantle"` together for it.
600 Mantle = "mantle",
601 /// The Anthropic API or a cloud provider's API sent to another host, such as an [LLM
602 /// gateway](https://code.claude.com/docs/en/llm-gateway) named by `ANTHROPIC_BASE_URL`
603 /// or by a provider's endpoint variable such as `ANTHROPIC_BEDROCK_BASE_URL`. Claude
604 /// Code admits it only for the exact value a managed
605 /// [`env`](https://code.claude.com/docs/en/settings-reference#env) block pins.
606 CustomEndpoint = "customEndpoint",
607 /// A [Cloud gateway](https://code.claude.com/docs/en/claude-apps-gateway) sign-in.
608 Gateway = "gateway",
609 }
610}
611
612string_enum! {
613 /// `spellcheck.checker`.
614 ///
615 /// Docs: [`spellcheck`](https://code.claude.com/docs/en/settings-reference#spellcheck).
616 pub enum SpellChecker {
617 /// The first one found on `PATH`.
618 Auto = "auto",
619 /// aspell.
620 Aspell = "aspell",
621 /// hunspell.
622 Hunspell = "hunspell",
623 /// ispell.
624 Ispell = "ispell",
625 }
626}
627
628string_enum! {
629 /// A marketplace or plugin source's `source`.
630 ///
631 /// Docs: [`extraKnownMarketplaces`](https://code.claude.com/docs/en/settings-reference#extraknownmarketplaces).
632 pub enum SourceKind {
633 /// A URL to a marketplace file.
634 Url = "url",
635 /// Any marketplace on matching hosts.
636 HostPattern = "hostPattern",
637 /// Any marketplace at matching paths.
638 PathPattern = "pathPattern",
639 /// A GitHub repository.
640 Github = "github",
641 /// A git repository.
642 Git = "git",
643 /// A subdirectory of a git repository (plugins).
644 GitSubdir = "git-subdir",
645 /// An npm package.
646 Npm = "npm",
647 /// A local marketplace file.
648 File = "file",
649 /// A local directory.
650 Directory = "directory",
651 /// A marketplace declared inline in settings.
652 Settings = "settings",
653 /// The skills directory.
654 SkillsDir = "skills-dir",
655 }
656}
657
658string_enum! {
659 /// A hook event: a key of `hooks`.
660 ///
661 /// Docs: [settings reference](https://code.claude.com/docs/en/hooks#hook-events).
662 pub enum HookEvent {
663 /// Runs after Claude creates tool parameters and before processing the tool call.
664 ///
665 /// Docs: [`PreToolUse`](https://code.claude.com/docs/en/hooks#pretooluse).
666 PreToolUse = "PreToolUse",
667 /// Runs immediately after a tool completes successfully.
668 ///
669 /// Docs: [`PostToolUse`](https://code.claude.com/docs/en/hooks#posttooluse).
670 PostToolUse = "PostToolUse",
671 /// Runs when a tool that started executing fails: the tool threw an error, or an MCP
672 /// tool returned an error result.
673 ///
674 /// Docs: [`PostToolUseFailure`](https://code.claude.com/docs/en/hooks#posttoolusefailure).
675 PostToolUseFailure = "PostToolUseFailure",
676 /// Runs once after every tool call in a batch has resolved, before Claude Code sends
677 /// the next request to the model.
678 ///
679 /// Docs: [`PostToolBatch`](https://code.claude.com/docs/en/hooks#posttoolbatch).
680 PostToolBatch = "PostToolBatch",
681 /// Runs when Claude Code is about to ask you for permission to use a tool.
682 ///
683 /// Docs: [`PermissionRequest`](https://code.claude.com/docs/en/hooks#permissionrequest).
684 PermissionRequest = "PermissionRequest",
685 /// Runs when [auto
686 /// mode](https://code.claude.com/docs/en/permission-modes#eliminate-prompts-with-auto-mode)
687 /// denies a tool call, including when it denies without a classifier verdict because [a
688 /// safety check separate from auto mode refused the classifier's own
689 /// request](https://code.claude.com/docs/en/errors#auto-mode-cannot-determine-the-safety-of-an-action)
690 /// or its response didn't parse.
691 ///
692 /// Docs: [`PermissionDenied`](https://code.claude.com/docs/en/hooks#permissiondenied).
693 PermissionDenied = "PermissionDenied",
694 /// Runs when Claude Code sends notifications.
695 ///
696 /// Docs: [`Notification`](https://code.claude.com/docs/en/hooks#notification).
697 Notification = "Notification",
698 /// Runs when a prompt is submitted, before Claude processes it.
699 ///
700 /// Docs: [`UserPromptSubmit`](https://code.claude.com/docs/en/hooks#userpromptsubmit).
701 UserPromptSubmit = "UserPromptSubmit",
702 /// Runs when a user-typed command expands into a prompt before reaching Claude.
703 ///
704 /// Docs: [`UserPromptExpansion`](https://code.claude.com/docs/en/hooks#userpromptexpansion).
705 UserPromptExpansion = "UserPromptExpansion",
706 /// Runs when the main Claude Code agent has finished responding.
707 ///
708 /// Docs: [`Stop`](https://code.claude.com/docs/en/hooks#stop).
709 Stop = "Stop",
710 /// Runs instead of [Stop](https://code.claude.com/docs/en/hooks#stop) when the turn
711 /// ends due to an API error.
712 ///
713 /// Docs: [`StopFailure`](https://code.claude.com/docs/en/hooks#stopfailure).
714 StopFailure = "StopFailure",
715 /// Runs when Claude spawns a subagent with the Agent tool, when Claude [resumes a
716 /// subagent](https://code.claude.com/docs/en/sub-agents#resume-subagents), and each
717 /// time an in-process [agent team](https://code.claude.com/docs/en/agent-teams)
718 /// teammate handles a new message.
719 ///
720 /// Docs: [`SubagentStart`](https://code.claude.com/docs/en/hooks#subagentstart).
721 SubagentStart = "SubagentStart",
722 /// Runs when a Claude Code subagent has finished responding.
723 ///
724 /// Docs: [`SubagentStop`](https://code.claude.com/docs/en/hooks#subagentstop).
725 SubagentStop = "SubagentStop",
726 /// Runs before Claude Code is about to run a compact operation.
727 ///
728 /// Docs: [`PreCompact`](https://code.claude.com/docs/en/hooks#precompact).
729 PreCompact = "PreCompact",
730 /// Runs after Claude Code completes a compact operation.
731 ///
732 /// Docs: [`PostCompact`](https://code.claude.com/docs/en/hooks#postcompact).
733 PostCompact = "PostCompact",
734 /// Runs when an MCP server requests user input mid-task.
735 ///
736 /// Docs: [`Elicitation`](https://code.claude.com/docs/en/hooks#elicitation).
737 Elicitation = "Elicitation",
738 /// Runs after a user responds to an MCP elicitation.
739 ///
740 /// Docs: [`ElicitationResult`](https://code.claude.com/docs/en/hooks#elicitationresult).
741 ElicitationResult = "ElicitationResult",
742 /// Runs when an [agent team](https://code.claude.com/docs/en/agent-teams) teammate is
743 /// about to go idle after finishing its turn.
744 ///
745 /// Docs: [`TeammateIdle`](https://code.claude.com/docs/en/hooks#teammateidle).
746 TeammateIdle = "TeammateIdle",
747 /// Runs when a task is being created via the `TaskCreate` tool.
748 ///
749 /// Docs: [`TaskCreated`](https://code.claude.com/docs/en/hooks#taskcreated).
750 TaskCreated = "TaskCreated",
751 /// Runs when a task is being marked as completed.
752 ///
753 /// Docs: [`TaskCompleted`](https://code.claude.com/docs/en/hooks#taskcompleted).
754 TaskCompleted = "TaskCompleted",
755 /// Fires only when you launch Claude Code with `--init-only`, or with `--init` or
756 /// `--maintenance` in [non-interactive mode](https://code.claude.com/docs/en/headless)
757 /// with the `-p` flag.
758 ///
759 /// Docs: [`Setup`](https://code.claude.com/docs/en/hooks#setup).
760 Setup = "Setup",
761 /// Fires when a `CLAUDE.md` or `.claude/rules/*.md` file is loaded into context.
762 ///
763 /// Docs: [`InstructionsLoaded`](https://code.claude.com/docs/en/hooks#instructionsloaded).
764 InstructionsLoaded = "InstructionsLoaded",
765 /// Runs when a shell command in the main conversation changes the working directory,
766 /// for example when Claude executes a `cd` command.
767 ///
768 /// Docs: [`CwdChanged`](https://code.claude.com/docs/en/hooks#cwdchanged).
769 CwdChanged = "CwdChanged",
770 /// Runs when a watched file changes on disk.
771 ///
772 /// Docs: [`FileChanged`](https://code.claude.com/docs/en/hooks#filechanged).
773 FileChanged = "FileChanged",
774 /// Runs when a configuration file changes during a session.
775 ///
776 /// Docs: [`ConfigChange`](https://code.claude.com/docs/en/hooks#configchange).
777 ConfigChange = "ConfigChange",
778 /// Runs when Claude Code creates a worktree in cases such as these:
779 ///
780 /// Docs: [`WorktreeCreate`](https://code.claude.com/docs/en/hooks#worktreecreate).
781 WorktreeCreate = "WorktreeCreate",
782 /// Runs when Claude Code cleans up a worktree that your
783 /// [`WorktreeCreate`](https://code.claude.com/docs/en/hooks#worktreecreate) hook
784 /// created.
785 ///
786 /// Docs: [`WorktreeRemove`](https://code.claude.com/docs/en/hooks#worktreeremove).
787 WorktreeRemove = "WorktreeRemove",
788 /// Runs when Claude Code starts a new session or resumes an existing session.
789 ///
790 /// Docs: [`SessionStart`](https://code.claude.com/docs/en/hooks#sessionstart).
791 SessionStart = "SessionStart",
792 /// Runs when a Claude Code session ends.
793 ///
794 /// Docs: [`SessionEnd`](https://code.claude.com/docs/en/hooks#sessionend).
795 SessionEnd = "SessionEnd",
796 /// Runs before Claude Code applies a model switch that you or a client requested.
797 ///
798 /// Docs: [`PreModelSwitch`](https://code.claude.com/docs/en/hooks#premodelswitch).
799 PreModelSwitch = "PreModelSwitch",
800 /// Runs after the session's model changes.
801 ///
802 /// Docs: [`PostModelSwitch`](https://code.claude.com/docs/en/hooks#postmodelswitch).
803 PostModelSwitch = "PostModelSwitch",
804 /// Runs while an assistant message streams to the screen.
805 ///
806 /// Docs: [`MessageDisplay`](https://code.claude.com/docs/en/hooks#messagedisplay).
807 MessageDisplay = "MessageDisplay",
808 /// Runs after you add a working directory mid-session with the `/add-dir` command, or
809 /// after an SDK client adds one with the `register_repo_root` control request.
810 ///
811 /// Docs: [`DirectoryAdded`](https://code.claude.com/docs/en/hooks#directoryadded).
812 DirectoryAdded = "DirectoryAdded",
813 }
814}
815
816string_enum! {
817 /// A hook's `onFailure`.
818 ///
819 /// Docs: [`hook.command.onFailure`](https://code.claude.com/docs/en/hooks#command-hook-fields).
820 pub enum HookOnFailure {
821 /// The action goes ahead.
822 Continue = "continue",
823 /// The action is blocked.
824 Block = "block",
825 }
826}
827
828string_enum! {
829 /// A credential's `onExtractNoMatch`.
830 ///
831 /// Docs: [`sandbox.credentials.files.onExtractNoMatch`](https://code.claude.com/docs/en/settings-reference#mask-fields-for-files).
832 pub enum ExtractNoMatch {
833 /// Leave it unmasked.
834 Warn = "warn",
835 /// Hide it.
836 Deny = "deny",
837 /// Stop sandbox setup.
838 Error = "error",
839 }
840}
841
842string_enum! {
843 /// A credential's `decode`.
844 ///
845 /// Docs: [`sandbox.credentials.files.decode`](https://code.claude.com/docs/en/settings-reference#mask-fields-for-files).
846 pub enum TokenDecode {
847 /// JSON Web Tokens.
848 Jwt = "jwt",
849 }
850}
851
852string_enum! {
853 /// A value of `sandbox.credentials.sigv4`.
854 ///
855 /// Docs: [`sandbox.credentials.sigv4`](https://code.claude.com/docs/en/settings-reference#sandbox-credentials-sigv4).
856 pub enum Sigv4Action {
857 /// The proxy fails the request.
858 Deny = "deny",
859 /// The proxy forwards the request signed with the masked placeholder, so the tool
860 /// receives AWS's own rejection.
861 Passthrough = "passthrough",
862 }
863}