claude-code-session-manager 0.142.0 → 0.144.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/README.md +22 -107
  3. package/dist/assets/AppSettings-Z68gQiVE.js +2 -0
  4. package/dist/assets/{History-DpZuJXi1.js → History-C3E6y_7t.js} +2 -2
  5. package/dist/assets/HomeClaudeConfig-Yd1vXzBn.js +5 -0
  6. package/dist/assets/{Panel-BjdJjhqt.js → Panel-CnfWs46Z.js} +1 -1
  7. package/dist/assets/ProjectClaudeConfig-CP0Wsg-H.js +26 -0
  8. package/dist/assets/Scheduler-D8un7N3B.js +16 -0
  9. package/dist/assets/{SkillReferenceGraph-Cqyu4mef.js → SkillReferenceGraph-DRtZV1Al.js} +1 -1
  10. package/dist/assets/{Skills-vv0noNVI.js → Skills-Bg5O2Hyn.js} +23 -23
  11. package/dist/assets/{TiptapBody-CXi8Pvut.js → TiptapBody-BdzoBmqu.js} +27 -27
  12. package/dist/assets/{Toggle-CiYCWLjh.js → Toggle-Dt5K1OXt.js} +1 -1
  13. package/dist/assets/{VoiceButton-4NKKd1sC.js → VoiceButton-CTLyRgdF.js} +1 -1
  14. package/dist/assets/{historyTotals-DDunb8Ch.js → historyTotals-B2_KWBga.js} +1 -1
  15. package/dist/assets/{index-Cn5E9958.js → index-446b69rr.js} +715 -714
  16. package/dist/assets/{index-DVHIHoJf.css → index-BJ5TJvmz.css} +1 -1
  17. package/dist/index.html +2 -2
  18. package/dist-web/app.css +1 -1
  19. package/dist-web/app.js +438 -435
  20. package/package.json +6 -4
  21. package/plugins/session-manager-dev/.claude-plugin/plugin.json +1 -1
  22. package/plugins/session-manager-dev/skills/builder/SKILL.md +5 -0
  23. package/plugins/session-manager-dev/skills/develop/SKILL.md +23 -16
  24. package/plugins/session-manager-dev/skills/maintaining-md-network/SKILL.md +16 -2
  25. package/plugins/session-manager-dev/skills/maintaining-md-network/weekly-consolidation.md +87 -0
  26. package/scripts/README.md +1 -0
  27. package/scripts/scheduler-mcp-server.cjs +381 -6
  28. package/src/main/adminRouteRegistry.cjs +16 -0
  29. package/src/main/agentLibrary.cjs +60 -11
  30. package/src/main/agentsIpc.cjs +19 -0
  31. package/src/main/build-info.json +4 -4
  32. package/src/main/chatRunner.cjs +214 -7
  33. package/src/main/config.cjs +5 -1
  34. package/src/main/health.cjs +92 -14
  35. package/src/main/index.cjs +16 -4
  36. package/src/main/ipcSchemas.cjs +61 -1
  37. package/src/main/lib/claude/agentArmory.cjs +128 -0
  38. package/src/main/lib/claude/agentModelResolve.cjs +3 -2
  39. package/src/main/lib/claude/agentSnapshot.cjs +24 -3
  40. package/src/main/lib/claude/builtinTools.cjs +110 -0
  41. package/src/main/lib/claude/environmentProfiles.cjs +1 -1
  42. package/src/main/lib/claude/headlessMcpServers.cjs +138 -0
  43. package/src/main/lib/claude/jobSandboxPolicy.cjs +8 -2
  44. package/src/main/lib/claude/personaToolScope.cjs +77 -6
  45. package/src/main/lib/demo-video-kit/cast.md +10 -1
  46. package/src/main/lib/demo-video-kit/character.cjs +77 -21
  47. package/src/main/lib/demo-video-kit/kind-tiktok.md +5 -1
  48. package/src/main/lib/demo-video-kit/projectSounds.cjs +191 -0
  49. package/src/main/lib/demo-video-kit/seedKit.cjs +3 -3
  50. package/src/main/lib/demo-video-kit/sound.cjs +166 -9
  51. package/src/main/lib/demo-video-kit/standalone.cjs +231 -0
  52. package/src/main/lib/epic/activeIndexMerge.cjs +5 -0
  53. package/src/main/lib/epic/artifactRetention.cjs +55 -9
  54. package/src/main/lib/epic/artifactStore.cjs +78 -35
  55. package/src/main/lib/epic/delegationReadiness.cjs +10 -3
  56. package/src/main/lib/epic/epicDepsSync.cjs +66 -0
  57. package/src/main/lib/epic/epicEventLog.cjs +45 -1
  58. package/src/main/lib/epic/epicOutsideRead.cjs +38 -1
  59. package/src/main/lib/epic/epicSettle.cjs +48 -4
  60. package/src/main/lib/epic/epicSpawnPlan.cjs +3 -1
  61. package/src/main/lib/epic/epicStateEmitter.cjs +248 -0
  62. package/src/main/lib/epic/epicValidationHook.cjs +22 -3
  63. package/src/main/lib/epic/planReviewInput.cjs +123 -0
  64. package/src/main/lib/epic/restorableSessions.cjs +1 -0
  65. package/src/main/lib/epic/scriptStartedBy.cjs +71 -0
  66. package/src/main/lib/externalContract.cjs +24 -1
  67. package/src/main/lib/feedback-remote/autoStartedSession.cjs +1 -1
  68. package/src/main/lib/feedback-remote/createdProjects.cjs +291 -0
  69. package/src/main/lib/feedback-remote/crossProjectFeedback.cjs +24 -2
  70. package/src/main/lib/feedback-remote/crossProjectReply.cjs +96 -8
  71. package/src/main/lib/feedback-remote/macroAdminRoutes.cjs +54 -3
  72. package/src/main/lib/feedback-remote/pendingReplies.cjs +22 -0
  73. package/src/main/lib/feedback-remote/projectCreate.cjs +415 -0
  74. package/src/main/lib/feedback-remote/projectHomeAdminRoutes.cjs +94 -4
  75. package/src/main/lib/feedback-remote/replyClaims.cjs +168 -0
  76. package/src/main/lib/feedback-remote/serviceMcpSession.cjs +29 -1
  77. package/src/main/lib/feedback-remote/serviceMcpTools.cjs +43 -2
  78. package/src/main/lib/feedback-remote/servicePairLocalRoutes.cjs +91 -0
  79. package/src/main/lib/feedback-remote/servicePairings.cjs +47 -7
  80. package/src/main/lib/feedback-remote/serviceStdioBridge.cjs +99 -1
  81. package/src/main/lib/git/gitWorktree.cjs +8 -0
  82. package/src/main/lib/git/runtimeStateUntrack.cjs +15 -1
  83. package/src/main/lib/git/worktreeDeps.cjs +119 -10
  84. package/src/main/lib/mcpToolCatalog.cjs +144 -12
  85. package/src/main/lib/mcpToolsProbe.cjs +19 -2
  86. package/src/main/lib/opsOwnership.cjs +113 -28
  87. package/src/main/lib/packs/packCatalog.cjs +98 -5
  88. package/src/main/lib/persona-macro/agentPersonaSchema.cjs +6 -0
  89. package/src/main/lib/persona-macro/builtinMacros.cjs +6 -4
  90. package/src/main/lib/persona-macro/personaFrontmatterSchema.cjs +9 -0
  91. package/src/main/lib/persona-macro/personaLoadout.cjs +58 -0
  92. package/src/main/lib/persona-macro/personaMerge.cjs +11 -3
  93. package/src/main/lib/persona-macro/personaUpgrade.cjs +96 -0
  94. package/src/main/lib/persona-macro/projectVideoToolCheck.cjs +1 -1
  95. package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +140 -0
  96. package/src/main/lib/prd/prdCreate.cjs +395 -229
  97. package/src/main/lib/prd/prdCriteria.cjs +7 -4
  98. package/src/main/lib/prd/prdFrontmatter.cjs +5 -2
  99. package/src/main/lib/prd/prdMcpReachWarnings.cjs +44 -0
  100. package/src/main/lib/prd/prdSandboxWarnings.cjs +49 -0
  101. package/src/main/lib/process/peerChatSession.cjs +165 -0
  102. package/src/main/lib/project-pages/videoPressLines.cjs +145 -0
  103. package/src/main/lib/project-pages/videoScriptPress.cjs +266 -0
  104. package/src/main/lib/project-pages/videoScriptRunRoute.cjs +371 -0
  105. package/src/main/lib/project-pages/videoScriptSwitchIpc.cjs +49 -0
  106. package/src/main/lib/project-pages/videoScriptSwitchRoute.cjs +173 -0
  107. package/src/main/lib/promptSessionSchema.cjs +2 -0
  108. package/src/main/lib/scheduler/baselineGate.cjs +31 -2
  109. package/src/main/lib/scheduler/criteriaChecks.cjs +164 -20
  110. package/src/main/lib/scheduler/heldSchedulerTurns.cjs +238 -0
  111. package/src/main/lib/scheduler/jobMemoryStats.cjs +13 -2
  112. package/src/main/lib/scheduler/planRecordHarvest.cjs +215 -55
  113. package/src/main/lib/scheduler/planReleaseRoute.cjs +110 -0
  114. package/src/main/lib/scheduler/planReviewSchema.cjs +182 -0
  115. package/src/main/lib/scheduler/planReviewStats.cjs +63 -0
  116. package/src/main/lib/scheduler/planReviewStore.cjs +128 -0
  117. package/src/main/lib/scheduler/prdOutcomeRecord.cjs +60 -2
  118. package/src/main/lib/scheduler/queueStore.cjs +16 -0
  119. package/src/main/lib/scheduler/rcaReport.cjs +79 -15
  120. package/src/main/lib/scheduler/sandboxEnvironmentLimit.cjs +141 -0
  121. package/src/main/lib/scheduler/scheduleJobSchema.cjs +15 -0
  122. package/src/main/lib/scheduler/schedulerPaths.cjs +9 -0
  123. package/src/main/lib/scheduler/slotsRoute.cjs +101 -87
  124. package/src/main/lib/scheduler/upgradeDrain.cjs +32 -5
  125. package/src/main/lib/scheduler/usageHoldRoute.cjs +97 -0
  126. package/src/main/lib/scheduler/validatorVerdictSchema.cjs +28 -7
  127. package/src/main/lib/tasks/memoryConsolidation.cjs +123 -39
  128. package/src/main/lib/tasks/mitigationReview.cjs +21 -1
  129. package/src/main/lib/tasks/taskAdminRoutes.cjs +104 -17
  130. package/src/main/lib/tasks/taskLedger.cjs +2 -2
  131. package/src/main/lib/tasks/taskRun.cjs +3 -1
  132. package/src/main/lib/tasks/weeklyConsolidationInputs.cjs +178 -0
  133. package/src/main/lib/telemetry/auditEvents.cjs +21 -24
  134. package/src/main/lib/telemetry/auditLog.cjs +6 -2
  135. package/src/main/lib/util/atomicFs.cjs +2 -2
  136. package/src/main/projectPages.cjs +22 -14
  137. package/src/main/promptSessionEvents.cjs +16 -1
  138. package/src/main/pty.cjs +14 -2
  139. package/src/main/queueOps.cjs +1 -1
  140. package/src/main/runVerify.cjs +4 -3
  141. package/src/main/scheduler/planReviewHold.cjs +140 -0
  142. package/src/main/scheduler/prdParser.cjs +1 -0
  143. package/src/main/scheduler/reviewLadder.cjs +2 -0
  144. package/src/main/scheduler/utilizationHold.cjs +101 -6
  145. package/src/main/scheduler.cjs +1055 -107
  146. package/src/main/seedAgentPersonas.cjs +11 -6
  147. package/src/main/seedStatus.cjs +1 -1
  148. package/src/main/templates/PRD_AUTHORING.md +22 -2
  149. package/src/main/webRemote.cjs +47 -7
  150. package/src/preload/api.d.ts +118 -2
  151. package/src/preload/apiSurface.json +42 -0
  152. package/src/preload/index.cjs +11 -0
  153. package/src/seed/agents/architect.md +28 -43
  154. package/src/seed/agents/demo-video-builder.md +15 -8
  155. package/src/seed/agents/dev-lead.md +3 -1
  156. package/src/seed/agents/md-network-curator.md +27 -0
  157. package/src/seed/agents/plan-reviewer.md +47 -0
  158. package/src/seed/agents/validator.md +21 -19
  159. package/dist/assets/AppSettings-BcZgIvvY.js +0 -2
  160. package/dist/assets/HomeClaudeConfig-D32ZJtU-.js +0 -3
  161. package/dist/assets/ProjectClaudeConfig-BTClYV6i.js +0 -26
  162. package/dist/assets/Scheduler-DPobKx1Z.js +0 -16
@@ -1,4 +1,4 @@
1
- import{ad as Ae,aS as u,bb as W,aC as e,b as Ie,aa as Pe,ai as Kt,bl as Rn,aB as In,g as Mn,t as Un,u as $n,W as Bn,j as Fn,k as Hn,an as Gn,bg as G,m as K,am as ss,ak as Wn,b2 as ns,av as qn,a7 as Fs,bm as Oe,c as ye,aD as Vt,ah as Hs,bc as Et,bo as Gs,bv as zt,y as Kn,a9 as Ws,B as Vn,V as qs,x as zn,bz as Ks,U as ze,bx as os,br as Yn,aG as Xn,aK as Jn,b1 as Qn,ay as Vs,J as Zn,at as eo,ao as zs,a_ as to,bh as Ys}from"./index-Cn5E9958.js";import{s as is,T as Me,S as Xs}from"./Toggle-CiYCWLjh.js";import{P as qe}from"./Panel-BjdJjhqt.js";import{b as so,c as no,T as oo}from"./TiptapBody-CXi8Pvut.js";const bt=[{id:"permissions",label:"Permissions",tab:"permissions",keys:["permissions"]},{id:"hooks",label:"Hooks",tab:"hooks",keys:["hooks","disableAllHooks","allowedHttpHookUrls","httpHookAllowedEnvVars"]},{id:"mcp",label:"MCP Servers",tab:null,keys:["enabledMcpjsonServers","disabledMcpjsonServers","enableAllProjectMcpServers"]},{id:"plugins",label:"Plugins",tab:null,keys:["enabledPlugins"]}],rs=new Set(bt.flatMap(t=>t.keys)),Js=[{id:"essentials",title:"Essentials",summary:"The knobs you reach for first.",keys:["model","language","outputStyle"]},{id:"git",title:"Git & Commits",summary:"How Claude writes commits and pull requests on your behalf.",keys:["attribution","includeGitInstructions","includeCoAuthoredBy"]},{id:"memory",title:"Memory & Plans",summary:"Context Claude keeps between sessions and where it files plans.",keys:["autoMemoryEnabled","plansDirectory","claudeMdExcludes","respectGitignore"]},{id:"model",title:"Model & Reasoning",summary:"Model allow/override lists, reasoning depth, and fast-mode toggles — machine-wide, with no per-Epic override yet. An Epic's Agent persona model (Agent Library) still wins over Essentials' plain model default.",advanced:!0,keys:["availableModels","modelOverrides","effortLevel","fastMode","fastModePerSessionOptIn","alwaysThinkingEnabled","fallbackModel","enforceAvailableModels","teammateDefaultModel","advisorModel"]},{id:"interface",title:"Interface",summary:"Visual polish — spinners, progress bars, motion.",keys:["spinnerTipsEnabled","spinnerTipsOverride","spinnerVerbs","terminalProgressBarEnabled","showTurnDuration","prefersReducedMotion","companyAnnouncements","statusLine","teammateMode"]},{id:"updates",title:"Updates & Cleanup",summary:"Release channel and how long transcripts stick around.",keys:["autoUpdatesChannel","cleanupPeriodDays"]},{id:"env",title:"Environment & Auth",summary:"Environment variables and auth-helper scripts.",keys:["env","apiKeyHelper","awsCredentialExport","awsAuthRefresh"]},{id:"hooks",title:"Hooks",summary:"Scripts Claude runs before/after tool use.",keys:["hooks","disableAllHooks","allowedHttpHookUrls","httpHookAllowedEnvVars"]},{id:"mcp",title:"MCP Servers",summary:"External tool providers Claude can talk to.",keys:["enableAllProjectMcpServers","enabledMcpjsonServers","disabledMcpjsonServers"]},{id:"plugins",title:"Plugins",summary:"Installed plugins, marketplaces, and per-plugin configuration.",keys:["enabledPlugins","extraKnownMarketplaces","skippedPlugins","skippedMarketplaces","pluginConfigs"]},{id:"filesystem",title:"File Picker & Sandbox",summary:"How Claude browses files and the sandbox it runs in.",keys:["fileSuggestion","sandbox","worktree"]},{id:"login",title:"Login",summary:"Which login method to force on startup.",keys:["forceLoginMethod","forceLoginOrgUUID"]},{id:"feedback",title:"Feedback",summary:"Session-quality surveys.",keys:["feedbackSurveyRate"]},{id:"advanced",title:"Advanced / Enterprise",summary:"Managed-settings-only keys and enterprise allow/denylists.",advanced:!0,keys:["allowedMcpServers","deniedMcpServers","allowManagedHooksOnly","allowManagedPermissionRulesOnly","allowManagedMcpServersOnly","strictKnownMarketplaces","blockedMarketplaces","pluginTrustMessage","otelHeadersHelper","skipWebFetchPreflight"]}],io={mcp:"MCP",url:"URL",urls:"URLs",http:"HTTP",ui:"UI",id:"ID",uuid:"UUID",api:"API",aws:"AWS",otel:"OTel",json:"JSON"};function Ye(t){return t.replace(/^\$/,"").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").toLowerCase().split(/\s+/).filter(Boolean).map((o,i)=>{const a=io[o];return a||(i===0?o.charAt(0).toUpperCase()+o.slice(1):o)}).join(" ")}function Qs(t){const s=new Set,n=[];for(const i of Js){const a=i.keys.filter(r=>t.has(r)&&!rs.has(r));a.forEach(r=>s.add(r)),a.length!==0&&n.push({id:i.id,title:i.title,summary:i.summary,advanced:!!i.advanced,keys:a})}const o=Array.from(t).filter(i=>!s.has(i)&&i!=="$schema"&&!rs.has(i)).sort();return o.length>0&&n.push({id:"other",title:"Other",summary:"Keys not yet grouped.",advanced:!1,keys:o}),n}function ro(t,s){return Qs(t).map(n=>({id:n.id,title:n.title,advanced:n.advanced,total:n.keys.length,setCount:n.keys.filter(o=>s.has(o)).length}))}const Yt=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/,At="disable-model-invocation",Zs=/^\s*disable-model-invocation\s*:/;function ao(t){const s=t.match(Yt);if(!s)return!1;for(const n of s[1].split(/\r?\n/)){if(!Zs.test(n))continue;const o=n.slice(n.indexOf(":")+1).trim().toLowerCase();return o==="true"||o==="yes"}return!1}function lo(t){const s=t.trim();return s.length>=2&&(s[0]==='"'&&s[s.length-1]==='"'||s[0]==="'"&&s[s.length-1]==="'")?s.slice(1,-1):s}function He(t){return t.length-t.trimStart().length}function it(t){const s=t.match(Yt);if(!s)return{name:null,description:null,body:t};const n=s[1].split(/\r?\n/),o=s[2]??"";let i=null,a=null;for(let r=0;r<n.length;r++){const l=n[r],d=l.match(/^(\s*)(name|description)\s*:(.*)$/);if(!d)continue;const[,,c,p]=d,m=p.trim(),g=He(l);let h;if(m===""||m===">-"||m===">"||m==="|-"||m==="|"){const f=[];let b=r+1;for(;b<n.length&&n[b].trim()!==""&&He(n[b])>g;)f.push(n[b].trim()),b++;h=f.join(" ")}else h=lo(m);c==="name"?i=h:a=h}return{name:i,description:a,body:o}}function co(t,s){const n=t.match(Yt);if(!n){if(!s)return t;const r=t.startsWith(`
1
+ import{ac as Ae,aT as u,bc as W,aD as e,b as Ie,a9 as je,q as Rn,aj as Kt,bm as In,aC as Mn,g as Un,s as $n,t as Bn,V as Fn,j as Hn,k as Gn,ao as Wn,bh as G,m as K,an as ss,al as qn,b3 as ns,aS as Kn,aw as Vn,a6 as Fs,bn as Oe,c as ye,aE as Vt,ai as Hs,bd as Et,bp as Gs,bw as zt,x as zn,a8 as Ws,B as Xn,U as qs,w as Yn,bA as Ks,T as ze,by as os,bs as Jn,aH as Qn,aL as Zn,b2 as eo,az as Vs,J as to,au as so,ap as zs,a$ as no,bi as Xs}from"./index-446b69rr.js";import{s as is,T as Me,S as Ys}from"./Toggle-Dt5K1OXt.js";import{P as qe}from"./Panel-CnfWs46Z.js";import{b as oo,c as io,T as ro}from"./TiptapBody-BdzoBmqu.js";const bt=[{id:"permissions",label:"Permissions",tab:"permissions",keys:["permissions"]},{id:"hooks",label:"Hooks",tab:"hooks",keys:["hooks","disableAllHooks","allowedHttpHookUrls","httpHookAllowedEnvVars"]},{id:"mcp",label:"MCP Servers",tab:null,keys:["enabledMcpjsonServers","disabledMcpjsonServers","enableAllProjectMcpServers"]},{id:"plugins",label:"Plugins",tab:null,keys:["enabledPlugins"]}],rs=new Set(bt.flatMap(t=>t.keys)),Js=[{id:"essentials",title:"Essentials",summary:"The knobs you reach for first.",keys:["model","language","outputStyle"]},{id:"git",title:"Git & Commits",summary:"How Claude writes commits and pull requests on your behalf.",keys:["attribution","includeGitInstructions","includeCoAuthoredBy"]},{id:"memory",title:"Memory & Plans",summary:"Context Claude keeps between sessions and where it files plans.",keys:["autoMemoryEnabled","plansDirectory","claudeMdExcludes","respectGitignore"]},{id:"model",title:"Model & Reasoning",summary:"Model allow/override lists, reasoning depth, and fast-mode toggles — machine-wide, with no per-Epic override yet. An Epic's Agent persona model (Agent Library) still wins over Essentials' plain model default.",advanced:!0,keys:["availableModels","modelOverrides","effortLevel","fastMode","fastModePerSessionOptIn","alwaysThinkingEnabled","fallbackModel","enforceAvailableModels","teammateDefaultModel","advisorModel"]},{id:"interface",title:"Interface",summary:"Visual polish — spinners, progress bars, motion.",keys:["spinnerTipsEnabled","spinnerTipsOverride","spinnerVerbs","terminalProgressBarEnabled","showTurnDuration","prefersReducedMotion","companyAnnouncements","statusLine","teammateMode"]},{id:"updates",title:"Updates & Cleanup",summary:"Release channel and how long transcripts stick around.",keys:["autoUpdatesChannel","cleanupPeriodDays"]},{id:"env",title:"Environment & Auth",summary:"Environment variables and auth-helper scripts.",keys:["env","apiKeyHelper","awsCredentialExport","awsAuthRefresh"]},{id:"hooks",title:"Hooks",summary:"Scripts Claude runs before/after tool use.",keys:["hooks","disableAllHooks","allowedHttpHookUrls","httpHookAllowedEnvVars"]},{id:"mcp",title:"MCP Servers",summary:"External tool providers Claude can talk to.",keys:["enableAllProjectMcpServers","enabledMcpjsonServers","disabledMcpjsonServers"]},{id:"plugins",title:"Plugins",summary:"Installed plugins, marketplaces, and per-plugin configuration.",keys:["enabledPlugins","extraKnownMarketplaces","skippedPlugins","skippedMarketplaces","pluginConfigs"]},{id:"filesystem",title:"File Picker & Sandbox",summary:"How Claude browses files and the sandbox it runs in.",keys:["fileSuggestion","sandbox","worktree"]},{id:"login",title:"Login",summary:"Which login method to force on startup.",keys:["forceLoginMethod","forceLoginOrgUUID"]},{id:"feedback",title:"Feedback",summary:"Session-quality surveys.",keys:["feedbackSurveyRate"]},{id:"advanced",title:"Advanced / Enterprise",summary:"Managed-settings-only keys and enterprise allow/denylists.",advanced:!0,keys:["allowedMcpServers","deniedMcpServers","allowManagedHooksOnly","allowManagedPermissionRulesOnly","allowManagedMcpServersOnly","strictKnownMarketplaces","blockedMarketplaces","pluginTrustMessage","otelHeadersHelper","skipWebFetchPreflight"]}],ao={mcp:"MCP",url:"URL",urls:"URLs",http:"HTTP",ui:"UI",id:"ID",uuid:"UUID",api:"API",aws:"AWS",otel:"OTel",json:"JSON"};function Xe(t){return t.replace(/^\$/,"").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").toLowerCase().split(/\s+/).filter(Boolean).map((o,i)=>{const a=ao[o];return a||(i===0?o.charAt(0).toUpperCase()+o.slice(1):o)}).join(" ")}function Qs(t){const s=new Set,n=[];for(const i of Js){const a=i.keys.filter(r=>t.has(r)&&!rs.has(r));a.forEach(r=>s.add(r)),a.length!==0&&n.push({id:i.id,title:i.title,summary:i.summary,advanced:!!i.advanced,keys:a})}const o=Array.from(t).filter(i=>!s.has(i)&&i!=="$schema"&&!rs.has(i)).sort();return o.length>0&&n.push({id:"other",title:"Other",summary:"Keys not yet grouped.",advanced:!1,keys:o}),n}function lo(t,s){return Qs(t).map(n=>({id:n.id,title:n.title,advanced:n.advanced,total:n.keys.length,setCount:n.keys.filter(o=>s.has(o)).length}))}const Xt=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/,At="disable-model-invocation",Zs=/^\s*disable-model-invocation\s*:/;function co(t){const s=t.match(Xt);if(!s)return!1;for(const n of s[1].split(/\r?\n/)){if(!Zs.test(n))continue;const o=n.slice(n.indexOf(":")+1).trim().toLowerCase();return o==="true"||o==="yes"}return!1}function po(t){const s=t.trim();return s.length>=2&&(s[0]==='"'&&s[s.length-1]==='"'||s[0]==="'"&&s[s.length-1]==="'")?s.slice(1,-1):s}function He(t){return t.length-t.trimStart().length}function it(t){const s=t.match(Xt);if(!s)return{name:null,description:null,body:t};const n=s[1].split(/\r?\n/),o=s[2]??"";let i=null,a=null;for(let r=0;r<n.length;r++){const l=n[r],d=l.match(/^(\s*)(name|description)\s*:(.*)$/);if(!d)continue;const[,,c,p]=d,m=p.trim(),g=He(l);let h;if(m===""||m===">-"||m===">"||m==="|-"||m==="|"){const f=[];let b=r+1;for(;b<n.length&&n[b].trim()!==""&&He(n[b])>g;)f.push(n[b].trim()),b++;h=f.join(" ")}else h=po(m);c==="name"?i=h:a=h}return{name:i,description:a,body:o}}function uo(t,s){const n=t.match(Xt);if(!n){if(!s)return t;const r=t.startsWith(`
2
2
  `)?"":`
3
3
  `;return`---
4
4
  ${At}: true
@@ -7,8 +7,8 @@ ${r}${t}`}const o=n[2]??"",i=n[1].split(/\r?\n/),a=i.findIndex(r=>Zs.test(r));if
7
7
  ${i.join(`
8
8
  `)}
9
9
  ---
10
- ${o}`}const en=/^(---\r?\n)([\s\S]*?\r?\n)---/,tn=/^\s*description\s*:/,po=/^\s*name\s*:/,uo=/^[|>][-+\d]*\s*(?:#.*)?$/;function mo(t){const s=en.exec(t);if(!s)return{frontmatter:null,body:t};const n=t.indexOf(`
11
- `,s[0].length),o=n===-1?t.length:n+1;return{frontmatter:t.slice(0,o),body:t.slice(o)}}function ho(t,s){if(!t||!s||t.endsWith(`
10
+ ${o}`}const en=/^(---\r?\n)([\s\S]*?\r?\n)---/,tn=/^\s*description\s*:/,mo=/^\s*name\s*:/,ho=/^[|>][-+\d]*\s*(?:#.*)?$/;function fo(t){const s=en.exec(t);if(!s)return{frontmatter:null,body:t};const n=t.indexOf(`
11
+ `,s[0].length),o=n===-1?t.length:n+1;return{frontmatter:t.slice(0,o),body:t.slice(o)}}function go(t,s){if(!t||!s||t.endsWith(`
12
12
  `))return(t??"")+s;const n=t.endsWith("\r")?`
13
13
  `:t.startsWith(`---\r
14
14
  `)?`\r
@@ -16,28 +16,28 @@ ${o}`}const en=/^(---\r?\n)([\s\S]*?\r?\n)---/,tn=/^\s*description\s*:/,po=/^\s*
16
16
  `;return t+n+s}function sn(t){const s=en.exec(t);if(!s)return null;const n=s[1],o=s[2],i=o.match(/[^\n]*\n/g)??[],a=i.map(l=>l.replace(/\r?\n$/,""));let r=null;for(const l of a)l.trim()===""||l.trimStart().startsWith("#")||(r===null||He(l)<r.length)&&(r=l.slice(0,He(l)));return{open:n,lines:i,texts:a,pad:r??"",rest:t.slice(n.length+o.length)}}function Pt(t,s){const{texts:n}=t,o=t.pad.length,i=[];for(let a=0;a<n.length;a++){if(He(n[a])!==o||!s.test(n[a]))continue;let r=a+1;for(let l=r;l<n.length;l++)if(n[l].trim()!==""){if(He(n[l])<=o)break;r=l+1}i.push({start:a,end:r}),a=r-1}return i}function as(t){return t.endsWith(`\r
17
17
  `)?`\r
18
18
  `:`
19
- `}const fo=/^(?:true|false|yes|no|on|off|y|n|null|~|[-+]?(?:\d[\d_]*(?:\.[\d_]*)?|\.\d[\d_]*)(?:e[-+]?\d+)?|0x[\da-f_]+|0o[0-7_]+|0b[01_]+|[-+]?\.(?:inf|nan)|\d{4}-\d\d?-\d\d?)$/i,go=/^$|^[-?,[\]{}&*!|>'"%@`]|[\u0000-\u001f\u007f\u0085\u2028\u2029]/,yo={"\\":"\\\\",'"':'\\"',"\n":"\\n","\r":"\\r"," ":"\\t"};function bo(t){return/[:#]|^\s|\s$/.test(t)||go.test(t)||fo.test(t)?`"${t.replace(/[\\"\u0000-\u001f\u007f\u0085\u2028\u2029]/g,o=>yo[o]??`\\u${o.charCodeAt(0).toString(16).padStart(4,"0")}`)}"`:t}function xo(t,s){const n=`description: ${bo(s)}`,o=sn(t);if(!o){const m=t.indexOf(`
19
+ `}const yo=/^(?:true|false|yes|no|on|off|y|n|null|~|[-+]?(?:\d[\d_]*(?:\.[\d_]*)?|\.\d[\d_]*)(?:e[-+]?\d+)?|0x[\da-f_]+|0o[0-7_]+|0b[01_]+|[-+]?\.(?:inf|nan)|\d{4}-\d\d?-\d\d?)$/i,bo=/^$|^[-?,[\]{}&*!|>'"%@`]|[\u0000-\u001f\u007f\u0085\u2028\u2029]/,xo={"\\":"\\\\",'"':'\\"',"\n":"\\n","\r":"\\r"," ":"\\t"};function vo(t){return/[:#]|^\s|\s$/.test(t)||bo.test(t)||yo.test(t)?`"${t.replace(/[\\"\u0000-\u001f\u007f\u0085\u2028\u2029]/g,o=>xo[o]??`\\u${o.charCodeAt(0).toString(16).padStart(4,"0")}`)}"`:t}function wo(t,s){const n=`description: ${vo(s)}`,o=sn(t);if(!o){const m=t.indexOf(`
20
20
  `),g=m>0&&t[m-1]==="\r"?`\r
21
21
  `:`
22
- `;return`---${g}${n}${g}---${g}${t}`}const{open:i,lines:a,texts:r,pad:l,rest:d}=o,[c,...p]=Pt(o,tn);if(c){for(const g of p.reverse())a.splice(g.start,g.end-g.start);const m=a[c.start];a.splice(c.start,c.end-c.start,m.slice(0,He(m))+n+as(m))}else{const[m]=Pt(o,po);let g=m?m.end:r.length;if(!m)for(;g>0&&r[g-1].trim()==="";)g--;a.splice(g,0,l+n+as(g>0?a[g-1]:i))}return i+a.join("")+d}const vo={0:"\0",a:"\x07",b:"\b",t:" "," ":" ",n:`
23
- `,v:"\v",f:"\f",r:"\r",e:"\x1B"," ":" ",'"':'"',"/":"/","\\":"\\",N:"…",_:" ",L:"\u2028",P:"\u2029"};function wo(t){const s=t.trim(),n=/^"((?:[^"\\]|\\[\s\S])*)"/.exec(s);if(n)return n[1].replace(/\\(x[\da-fA-F]{2}|u[\da-fA-F]{4}|U[\da-fA-F]{8}|[\s\S])/g,(a,r)=>{if(r.length===1)return vo[r]??a;const l=parseInt(r.slice(1),16);return l<=1114111?String.fromCodePoint(l):a});const o=/^'((?:[^']|'')*)'/.exec(s);if(o)return o[1].replace(/''/g,"'");const i=s.search(/(?:^|\s)#/);return i===-1?s:s.slice(0,i).trimEnd()}function ko(t){const s=sn(t),n=s?Pt(s,tn)[0]:void 0;if(!s||!n)return null;const[o,...i]=s.texts.slice(n.start,n.end),a=o.slice(o.indexOf(":")+1).trim().replace(/^#.*/,""),r=i.map(l=>l.trim()).filter(Boolean);return uo.test(a)?r.join(" "):wo([a,...r].join(" "))}function Eo(t){return!t||!t.trim()?"default":t.replace(/[^a-zA-Z0-9]/g,"-")}const So=["memory","claude-md","settings","mcp","skills","plugins","agents"],Co=0,_o=1,Ao=2,No=3;function Oo(t,s,n){const o=t.title.toLowerCase(),i=[t.detail??"",...t.keywords??[]].join(`
24
- `).toLowerCase();return n.every(a=>o.includes(a)||i.includes(a))?o===s?Co:o.startsWith(s)?_o:o.includes(s)||n.every(a=>o.includes(a))?Ao:No:null}function jo(t,s,n=5){const o=s.trim().toLowerCase().replace(/\s+/g," ");if(!o)return[];const i=o.split(" "),a=new Map;t.forEach((l,d)=>{const c=Oo(l,o,i);if(c===null)return;const p=a.get(l.tab)??[];p.push({item:l,rank:c,idx:d}),a.set(l.tab,p)});const r=[];for(const l of So){const d=a.get(l);d!=null&&d.length&&(d.sort((c,p)=>c.rank-p.rank||c.idx-p.idx),r.push({tab:l,items:d.slice(0,Math.max(0,n)).map(c=>c.item),total:d.length}))}return r}const xt=t=>!!t&&typeof t=="object"&&!Array.isArray(t);async function _e(t){try{return await t()}catch{return[]}}async function nn(t,s){const n=await t.config.readJson(s);if(n.error)throw new Error(n.error);return n.data}async function ls(t,s){const n=await Promise.all(s.map(r=>t.config.exists(r))),o=s.filter((r,l)=>n[l]),i=await Promise.all(o.map(async r=>{const l={tab:"claude-md",id:`claude-md:${r}`,title:Ae(r),detail:r};let d=[];try{const c=await t.config.parseImports(r);c.ok&&(d=c.imports.map(p=>({tab:"claude-md",id:`claude-md:${r}>${p.path}`,title:Ae(p.path),detail:p.path,keywords:["import",Ae(r)]})))}catch{}return[l,...d]})),a=new Set;return i.flat().filter(r=>a.has(r.id)?!1:(a.add(r.id),!0))}function To(){const t=[];for(const s of Js)for(const n of s.keys)t.push({tab:"settings",id:`settings:${n}`,title:n,detail:s.title,keywords:[Ye(n),s.summary]});for(const s of bt)for(const n of s.keys)t.some(o=>o.title===n)||t.push({tab:"settings",id:`settings:${n}`,title:n,detail:s.label,keywords:[Ye(n)]});return t}async function cs(t,s,n){const o=new Set;for(const i of await Promise.all(s.map(a=>nn(t,a))))xt(i)&&Object.keys(i).forEach(a=>o.add(a));return[...o].filter(i=>!n.has(i)).map(i=>({tab:"settings",id:`settings:${i}`,title:i,detail:"Other",keywords:[Ye(i)]}))}function ds(t,s){return xt(t)?Object.entries(t).map(([n,o])=>{const i=[s];if(xt(o))for(const a of["command","url","type"])typeof o[a]=="string"&&i.push(o[a]);return{tab:"mcp",id:`mcp:${n}`,title:n,detail:"MCP server",keywords:i}}):[]}async function ps(t,s,n){const o=async l=>{const d=await t.config.listDir(l,{dirsOnly:!0});if(!d.ok)throw new Error(d.error??`failed to list ${l}`);return d.entries},i=async(l,d)=>{const c=`${d}/SKILL.md`,p=await t.config.readText(c);if(!p.exists)return null;const m=it(p.text);return{tab:"skills",id:`skills:${c}`,title:m.name??l,detail:m.description??void 0,keywords:["skill",c]}},a=(await Promise.all((await o(s)).map(async l=>{const d=await i(l.name,l.path);return d?[d]:Promise.all((await o(l.path)).map(c=>i(c.name,c.path)))}))).flat().filter(l=>l!==null);let r=[];try{const l=await t.config.listDir(n,{filesOnly:!0});l.ok&&(r=l.entries.filter(d=>d.name.endsWith(".md")).map(d=>({tab:"skills",id:`skills:${d.path}`,title:d.name.replace(/\.md$/,""),detail:"Command",keywords:["command",`/${d.name.replace(/\.md$/,"")}`,d.path]})))}catch{}return[...a,...r]}async function qa({scope:t,cwd:s,api:n}){const o=To(),i=new Set(o.map(p=>p.title));if(t==="home"){let p;try{p=await n.app.homeDir()}catch{return o}const m=`${p}/.claude`,g=await Promise.all([_e(()=>ls(n,[`${m}/CLAUDE.md`])),_e(()=>cs(n,[`${m}/settings.json`],i)),_e(async()=>{var y;return ds((y=(await n.claudeConfig.read({fileId:"claudeJson",scope:"user"})).data)==null?void 0:y.mcpServers,`${p}/.claude.json`)}),_e(()=>ps(n,`${m}/skills`,`${m}/commands`)),_e(async()=>(await n.plugins.list()).map(y=>({tab:"plugins",id:`plugins:${y.key}`,title:y.name,detail:y.marketplace,keywords:[y.key,y.enabled?"enabled":"disabled"]}))),_e(async()=>(await n.agents.listPersonas()).map(y=>({tab:"agents",id:`agents:${y.name}`,title:y.name,detail:y.description??void 0,keywords:y.tags})))]),[h,f,...b]=g;return[...h,...o,...f,...b.flat()]}if(!s)return[];const a=await Promise.all([_e(async()=>{const p=await n.memory.list({workspace:Eo(s),cwd:s});if(p.error)throw new Error(p.error);return p.entries.map(m=>({tab:"memory",id:`memory:${m.path}`,title:m.name,detail:m.path}))}),_e(()=>ls(n,[`${s}/CLAUDE.md`,`${s}/CLAUDE.local.md`])),_e(()=>cs(n,[`${s}/.claude/settings.json`,`${s}/.claude/settings.local.json`],i)),_e(async()=>{const p=await nn(n,`${s}/.mcp.json`);return ds(xt(p)?p.mcpServers:void 0,`${s}/.mcp.json`)}),_e(()=>ps(n,`${s}/.claude/skills`,`${s}/.claude/commands`))]),[r,l,d,...c]=a;return[...r,...l,...o,...d,...c.flat()]}const Lo=236,Do=Math.floor(Lo/7.2);function Po(t,s=Do){if(t.length<=s)return t;const n=t.split(/[\\/]/).filter(l=>l!=="");if(n.length===0)return t;const o=t.indexOf("/"),i=t.indexOf("\\"),a=i!==-1&&(o===-1||i<o)?"\\":"/";let r=n[n.length-1];for(let l=n.length-2;l>=0;l--){const d=`${n[l]}${a}${r}`;if(2+d.length>s)break;r=d}return`…${a}${r}`}const Ro=t=>!!t&&typeof t=="object"&&!Array.isArray(t);function Ka(t){return Object.values(t).some(s=>s.status==="failed"||s.status==="needs-auth")}function Va(t){return t==null?{}:t===0?{count:"missing",warn:!0}:{count:`${t} ${t===1?"file":"files"}`}}async function za(t){if(!await window.api.config.exists(t))return 0;const s=await window.api.config.parseImports(t);if(!s.ok)throw new Error(s.error);return 1+s.imports.filter(n=>n.exists).length}async function Ya(t){const s=await window.api.config.readJson(t);if(s.error)throw new Error(s.error);return Ro(s.data)?Object.keys(s.data).length:0}function Io(t,s){return s?t?"bg-accent/15 text-accent-dark":"bg-accent-muted/15 text-accent-muted":t?"bg-fg text-bg-hi":"bg-bg/10 text-line"}function Xa({eyebrow:t,title:s,scopePath:n,tabs:o,activeKey:i,onSelect:a,onSearch:r,searchQuery:l,onSearchFocus:d,onSearchKeyDown:c,searchPanel:p,searchInputRef:m,onLearn:g}){const h=u.useRef([]),f=u.useRef(null),b=m??f,[y,k]=u.useState(""),w=l??y,[j,P]=u.useState(!1),_=E=>{l===void 0&&k(E),r==null||r(E)};u.useEffect(()=>{const E=T=>{if(T.key!=="/"||T.ctrlKey||T.metaKey||T.altKey||T.defaultPrevented)return;const O=T.target instanceof HTMLElement?T.target:null;O&&(O.tagName==="INPUT"||O.tagName==="TEXTAREA"||O.isContentEditable||O.closest('[contenteditable="true"]'))||b.current&&(T.preventDefault(),b.current.focus())};return document.addEventListener("keydown",E,!0),()=>document.removeEventListener("keydown",E,!0)},[b]);const S=E=>{if(E.key==="Escape"){E.preventDefault(),_(""),E.currentTarget.blur();return}c==null||c(E)},A=j&&w.trim()!==""&&p!=null,L=(E,T)=>{var I;let O=-1;E.key==="ArrowRight"?O=(T+1)%o.length:E.key==="ArrowLeft"?O=(T-1+o.length)%o.length:E.key==="Home"?O=0:E.key==="End"&&(O=o.length-1),!(O<0)&&(E.preventDefault(),(I=h.current[O])==null||I.focus(),a(o[O].key))};return e.jsxs("div",{"data-testid":"config-band",className:"shrink-0 box-border h-[84px] bg-fg text-bg-hi border-b border-fg px-7 py-0 flex items-center gap-[26px] whitespace-nowrap",children:[e.jsxs("div",{"data-testid":"config-band-title",className:"flex flex-col gap-0.5 min-w-[236px] shrink-0",children:[e.jsx("span",{className:"text-[10.5px] font-semibold tracking-[0.1em] text-bg-hi/60",children:t}),e.jsxs("span",{className:"flex items-baseline gap-2.5",children:[e.jsx("span",{className:"font-serif text-[25px] font-medium leading-[1.15] text-bg-hi",children:s}),e.jsx("span",{"data-testid":"config-band-path",title:n,className:"inline-block font-mono text-xs text-rhythm",children:Po(n)})]})]}),e.jsx("div",{role:"tablist","aria-label":s,className:"flex items-center gap-1.5 min-w-0 overflow-x-auto p-1 -m-1",children:o.map((E,T)=>{const O=E.key===i;return e.jsxs("button",{ref:I=>{h.current[T]=I},type:"button",role:"tab","aria-selected":O,tabIndex:O?0:-1,"data-testid":`config-band-tab-${E.key}`,onClick:()=>a(E.key),onKeyDown:I=>L(I,T),className:`h-12 flex items-center gap-2.5 pl-[13px] pr-3.5 rounded-xl border border-transparent focus-visible:outline focus-visible:outline-2 focus-visible:outline-butter ${O?"bg-bg text-fg shadow-sm":"text-bg-elev hover:bg-bg/10"}`,children:[e.jsx(Ie,{name:E.icon,size:18,stroke:1.7,className:O?"text-fg":"text-rhythm"}),e.jsx("span",{className:"text-[14.5px] font-semibold",children:E.label}),E.count!==void 0&&e.jsx("span",{"data-testid":"config-band-count",className:`font-mono text-xs px-[7px] py-0.5 rounded-md ${Io(O,!!E.warn)}`,children:E.count}),E.attention&&e.jsx("span",{"data-testid":"config-band-attention","aria-label":"needs attention",className:"w-[7px] h-[7px] rounded-full bg-butter -ml-1"})]},E.key)})}),e.jsx("span",{className:"flex-1"}),e.jsxs("div",{className:"relative",children:[e.jsxs("label",{className:"flex items-center gap-2.5 w-[250px] h-10 px-3 rounded-[10px] bg-bg/[0.08] border border-bg/[0.14] text-[13px] text-bg-hi/60 focus-within:border-bg/30",children:[e.jsx(Ie,{name:"search",size:15,className:"shrink-0"}),e.jsx("input",{ref:b,type:"search","aria-label":"Search all config",placeholder:"Search all config",value:w,onChange:E=>_(E.target.value),onFocus:()=>{P(!0),d==null||d()},onBlur:()=>P(!1),onKeyDown:S,className:"flex-1 min-w-0 bg-transparent outline-none text-bg-hi placeholder:text-bg-hi/60"}),e.jsx("kbd",{className:"font-mono text-[11px] px-1.5 py-px rounded border border-bg/20",children:"/"})]}),A&&e.jsx("div",{"data-testid":"config-search-panel",onMouseDown:E=>E.preventDefault(),className:`absolute right-0 top-full mt-1.5 w-[380px] max-h-[60vh] overflow-y-auto rounded-xl border border-line bg-bg-hi text-fg shadow-lg whitespace-normal ${Pe.dialog}`,children:p})]}),e.jsx("button",{type:"button",onClick:g,className:"text-[11px] font-semibold tracking-[0.08em] text-butter hover:underline",children:"LEARN"})]})}function Ja({groups:t,loading:s,activeIndex:n,tabs:o,onChoose:i,onHover:a}){if(s)return e.jsx("div",{className:"px-3.5 py-3 text-[12.5px] text-fg-dim",children:"Loading…"});if(t.length===0)return e.jsx("div",{className:"px-3.5 py-3 text-[12.5px] text-fg-dim",children:"No matches"});let r=0;return e.jsx("div",{role:"listbox","aria-label":"Config search results",className:"py-1.5",children:t.map(l=>{var d;return e.jsxs("div",{className:"py-1",children:[e.jsxs("div",{"data-testid":"config-search-group",className:"flex items-center justify-between px-3.5 pt-1 pb-0.5 text-[10.5px] font-semibold tracking-[0.08em] uppercase text-fg-dim",children:[e.jsx("span",{children:((d=o.find(c=>c.key===l.tab))==null?void 0:d.label)??l.tab}),e.jsx("span",{className:"font-mono",children:l.total})]}),l.items.map(c=>{const p=r++,m=p===n;return e.jsxs("button",{type:"button",role:"option","aria-selected":m,onClick:()=>i(c),onMouseEnter:()=>a(p),className:`w-full text-left px-3.5 py-1.5 flex items-baseline gap-2 min-w-0 ${m?"bg-bg-elev":""}`,children:[e.jsx("span",{className:"text-[13px] font-medium text-fg truncate",children:c.title}),c.detail&&e.jsx("span",{className:"text-[11.5px] text-fg-dim truncate",children:c.detail})]},c.id)})]},l.tab)})})}function Qa({load:t,loadKey:s,onChoose:n}){const o=u.useRef(null),[i,a]=u.useState(""),[r,l]=u.useState(0),[d,c]=u.useState(null),p=u.useRef(null),m=d&&d.key===s?d.items:null,g=u.useMemo(()=>m?jo(m,i):[],[m,i]),h=u.useMemo(()=>g.flatMap(w=>w.items),[g]),f=u.useCallback(()=>{p.current!==s&&(p.current=s,t().then(w=>c({key:s,items:w}),w=>{W.error(`Search all config: ${w instanceof Error?w.message:String(w)}`),c({key:s,items:[]})}))},[t,s]),b=u.useCallback(w=>{a(w),l(0)},[]),y=u.useCallback(w=>{var j;n(w),a(""),l(0),(j=o.current)==null||j.blur()},[n]),k=u.useCallback(w=>{if(w.key==="ArrowDown"||w.key==="ArrowUp"){if(w.preventDefault(),h.length===0)return;const j=w.key==="ArrowDown"?1:-1;l(P=>(P+j+h.length)%h.length)}else if(w.key==="Enter"){const j=h[Math.min(r,h.length-1)];if(!j)return;w.preventDefault(),y(j)}},[h,r,y]);return{bandProps:{searchQuery:i,onSearch:b,onSearchFocus:f,onSearchKeyDown:k,searchInputRef:o},panelProps:{groups:g,loading:m===null,activeIndex:r,onChoose:y,onHover:l}}}const Se=Kt(t=>({tab:null,id:null,set:(s,n)=>t({tab:s,id:n}),clear:()=>t({tab:null,id:null})})),Xt="text-[11px] font-semibold uppercase tracking-[0.1em] text-fg-faint";function St({list:t,detail:s}){return e.jsxs("div",{"data-testid":"config-workbench",className:"flex flex-1 min-h-0 min-w-0",children:[e.jsx("div",{"data-testid":"config-workbench-list",className:"w-[318px] shrink-0 bg-bg-elev border-r border-line px-4 py-[18px] flex flex-col gap-3 overflow-y-auto",children:t}),e.jsx("div",{"data-testid":"config-workbench-detail",className:"flex-1 min-w-0 min-h-0 flex flex-col overflow-y-auto",children:s})]})}function on({eyebrow:t,badge:s,path:n,note:o,children:i}){return e.jsxs("div",{"data-testid":"config-file-card",className:"px-4 py-3.5 rounded-[14px] bg-bg-hi border border-line flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`flex-1 min-w-0 truncate ${Xt}`,children:t}),s!==void 0&&e.jsx("span",{className:"text-[11.5px] font-semibold px-2 py-0.5 rounded-full bg-sage/15 text-sage-dark",children:s})]}),e.jsx("span",{"data-testid":"config-file-card-path",className:"font-mono text-[12.5px] text-fg break-all",children:n}),o!==void 0&&e.jsx("span",{className:"text-xs text-fg-faint",children:o}),i]})}function Za({filter:t,onFilterChange:s,placeholder:n,primaryLabel:o,onPrimary:i,secondary:a}){return e.jsxs("div",{className:"flex items-center gap-2 whitespace-nowrap",children:[e.jsxs("label",{className:"flex-1 min-w-0 flex items-center gap-2 h-[38px] px-3 rounded-[10px] bg-bg-hi border border-line text-[13px] text-fg-faint focus-within:border-fg-faint",children:[e.jsx(Ie,{name:"search",size:15,className:"shrink-0"}),e.jsx("input",{type:"search","aria-label":n,placeholder:n,value:t,onChange:r=>s(r.target.value),className:"flex-1 min-w-0 bg-transparent outline-none text-fg placeholder:text-fg-faint"})]}),a,e.jsx("button",{type:"button",onClick:i,className:"h-[38px] px-4 rounded-[10px] bg-accent text-bg-hi hover:bg-accent/90 text-[13.5px] font-semibold focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",children:o})]})}function Mo({title:t,meta:s,trailing:n,selected:o,muted:i,onSelect:a}){return e.jsxs("div",{role:"option","aria-selected":o,tabIndex:0,"data-testid":"config-list-row",onClick:a,onKeyDown:r=>{r.target===r.currentTarget&&(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),a())},className:`px-3 py-2.5 rounded-xl border cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent ${o?"bg-bg-hi border-line shadow-sm":"border-transparent hover:bg-bg-hi/60"} ${i?"opacity-60":""}`,children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:`flex-1 min-w-0 truncate font-mono text-[13px] text-fg ${o?"font-semibold":"font-medium"}`,children:t}),n!==void 0&&e.jsx("span",{className:"shrink-0 text-xs text-fg-faint",children:n})]}),s!==void 0&&e.jsx("div",{className:"mt-0.5 text-xs text-fg-faint truncate",children:s})]})}function Ct({eyebrow:t,title:s,pill:n,actions:o}){return e.jsxs("div",{"data-testid":"config-detail-header",className:"shrink-0 px-9 pt-6 pb-5 border-b border-line flex items-end gap-3 whitespace-nowrap",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:`truncate ${Xt}`,children:t}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2.5 min-w-0",children:[e.jsx("span",{className:"truncate font-mono text-[27px] font-semibold tracking-[-0.015em] text-fg",children:s}),n!==void 0&&e.jsx("span",{className:"shrink-0 text-xs font-semibold px-2 py-0.5 rounded-full bg-sage/15 text-sage-dark",children:n})]})]}),o!==void 0&&e.jsx("div",{className:"shrink-0 flex items-center gap-2",children:o})]})}function Ge({label:t,labelNote:s,action:n,children:o}){return e.jsxs("section",{"data-testid":"config-card",className:"px-[18px] py-3.5 rounded-[14px] bg-bg-hi border border-line",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:`flex-1 min-w-0 truncate ${Xt}`,children:[t,s&&e.jsxs("span",{className:"font-medium",children:[" · ",s]})]}),n]}),e.jsx("div",{className:"mt-1 text-[15px] leading-normal text-fg",children:o})]})}function el({text:t}){return e.jsxs("div",{"data-testid":"config-saved-line",role:"status",className:"flex items-center gap-2 text-[13px] text-fg-dim",children:[e.jsx("span",{"aria-hidden":!0,className:"w-[7px] h-[7px] rounded-full bg-sage"}),t]})}const Uo=[{key:"document",label:"Document"},{key:"markdown",label:"Markdown"}];function $o(t){return t==="edit"||t==="markdown"?"markdown":"document"}function Bo(t,s){const n=t.split(`
25
- `);let o=null,i=0;for(let a=0;a<n.length;a++){const r=/^\s{0,3}(`{3,}|~{3,})/.exec(n[a]);if(r){o===null?o=r[1][0]:r[1][0]===o&&(o=null);continue}if(o===null&&/^\s{0,3}#{1,6}(\s|$)/.test(n[a])){if(i===s)return a+1;i++}}return null}function rn({path:t,value:s,onChange:n,onSave:o,onRevert:i,dirty:a,isNew:r,readOnly:l,defaultMode:d,headerRight:c,hideStatusBar:p,changedFrom:m,emptyState:g}){const h=Rn(),f=In(t),[b,y]=u.useState(()=>$o(d)),[k,w]=u.useState(!1),[j,P]=u.useState(null),_=j??k,S=u.useCallback(()=>{P(null),w(!0)},[]),A=u.useCallback(()=>{P(null),w(!1)},[]),[L,E]=u.useState(null),T=u.useMemo(()=>m===void 0?void 0:so(m,s),[m,s]),O=u.useMemo(()=>m===void 0?void 0:no(m,s),[m,s]),I=u.useRef(null),M=u.useRef(null),ue=u.useCallback(B=>{I.current=B},[]),le=u.useCallback(()=>I.current,[]);u.useEffect(()=>{if(!k)return;const B=z=>{z.key==="Escape"&&A()};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[k,A]);const te=f?b:"markdown",ee=a===void 0&&!r?void 0:a?"dirty":r?"new":"saved",ce=B=>{te!=="document"||l||!o||(B.ctrlKey||B.metaKey)&&B.key.toLowerCase()==="s"&&(B.preventDefault(),o())},J=u.useCallback((B,z)=>{var oe;const se=I.current,Q=Bo(((oe=se==null?void 0:se.getModel())==null?void 0:oe.getValue())??s,z);!se||Q===null||(se.revealLineNearTop(Q),se.setPosition({lineNumber:Q,column:1}),se.focus())},[s]),me=e.jsx(Mn,{path:t,name:Ae(t),value:s,onChange:n,onSave:()=>o==null?void 0:o(),onReady:ue,onCursor:E,readOnly:l,markedLines:T}),V=te==="document"?l?e.jsx(Un,{ref:M,text:s,wideMeasure:h.wideMeasure}):e.jsx("div",{ref:M,className:"h-full min-h-0",children:e.jsx(oo,{value:s,onChange:n,markedBlocks:O,fullScreen:k})}):f?e.jsxs("div",{className:"flex flex-col h-full",children:[!l&&e.jsx($n,{getEditor:le}),e.jsx("div",{className:"flex-1 min-h-0",children:me})]}):me;return e.jsxs("div",{className:k?`fixed inset-0 ${Pe.dialog} flex flex-col min-h-0 bg-bg`:"flex flex-col h-full min-h-0","data-testid":"document-editor-pane","data-mode":te,"data-fullscreen":k?"true":void 0,onKeyDown:ce,children:[e.jsxs("div",{className:"flex items-center gap-2 px-2 h-9 shrink-0 border-b border-line bg-bg-elev",children:[k&&e.jsxs("button",{type:"button",onClick:A,"data-testid":"document-exit-fullscreen",className:"flex items-center gap-1.5 px-2 py-0.5 text-[11px] font-medium text-fg border border-line rounded hover:bg-bg-hi",title:"Exit full screen (Esc)",children:["← Exit full screen",e.jsx("span",{className:"font-mono text-[9px] text-fg-faint",children:"Esc"})]}),e.jsxs("svg",{"aria-hidden":!0,viewBox:"0 0 16 16",className:"w-3.5 h-3.5 shrink-0 text-fg-faint",fill:"none",stroke:"currentColor",strokeWidth:"1.3",children:[e.jsx("path",{d:"M4 1.5h5.5L13 5v9.5H4z"}),e.jsx("path",{d:"M9.5 1.5V5H13"})]}),e.jsx("span",{className:"text-[12px] font-mono font-medium text-fg truncate","data-testid":"document-title",children:Ae(t)}),ee&&e.jsx(Bn,{state:ee}),k&&e.jsx("span",{className:"text-[10px] font-mono text-fg-faint truncate min-w-0",title:t,children:t}),l&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] uppercase tracking-wide text-fg-faint border border-line",children:"read-only"}),e.jsx("div",{className:"flex-1"}),c,f&&e.jsx("button",{type:"button",onClick:()=>P(!_),"data-testid":"document-outline-toggle","aria-pressed":_,className:`px-2 py-0.5 text-[11px] rounded ${_?"bg-bg-hi text-fg":"text-fg-faint hover:text-fg"}`,title:"Toggle document outline",children:"☰ Outline"}),f&&e.jsx("div",{role:"group","aria-label":"Editor mode",className:"flex items-center p-0.5 rounded bg-bg-hi","data-testid":"document-mode-toggle",children:Uo.map(B=>e.jsx("button",{type:"button",onClick:()=>y(B.key),"aria-pressed":te===B.key,className:`px-2.5 py-0.5 text-[11px] rounded transition-colors ${te===B.key?"bg-bg text-fg font-medium shadow-sm":"text-fg-dim hover:text-fg"}`,children:B.label},B.key))}),!k&&e.jsx("button",{type:"button",onClick:S,"data-testid":"document-fullscreen",className:"px-2 py-0.5 text-[11px] text-fg-dim border border-line rounded hover:text-fg hover:bg-bg-hi",title:"Full screen",children:"⤢ Full screen"})]}),e.jsx("div",{className:"flex-1 min-h-0",children:g?e.jsx("div",{className:"h-full min-h-0 overflow-auto","data-testid":"document-empty",children:g}):f?e.jsxs("div",{className:"flex h-full overflow-clip",children:[_&&e.jsx(Fn,{text:s,scrollRef:M,onJump:te==="markdown"?J:void 0,showStats:!0}),e.jsx("div",{className:"flex-1 min-w-0",children:V})]}):V}),!p&&e.jsx(Hn,{text:s,cursor:te==="markdown"?L:null,language:f?"Markdown":Gn(t)||void 0,positionLabel:te==="document"?"Document · saved as Markdown":void 0,saveState:ee,dirty:!!a,isNew:r,onSave:l?void 0:o,onRevert:l?void 0:i})]})}const an="text-[10.5px] font-semibold uppercase tracking-[0.1em] text-fg-faint",Fo="changed on disk since it was loaded. Revert reloads it",Ho=300,ft=t=>t instanceof Error?t.message:String(t);function us(t){return t?t.replace(/\n$/,"").split(`
26
- `).length:0}function Go(t,s){const n=ns(t),o=ns(s);if(!n.length||!o.length||n[0]!==o[0])return t;let i=0;for(;i<n.length&&i<o.length&&n[i]===o[i];)i++;return[...Array(o.length-i).fill(".."),...n.slice(i)].join("/")}function Wo(t,s){switch(t){case"sensitive":return"Read-only: Session Manager never writes credential, SSH or autostart files.";case"ops-root":return"Read-only: this file is inside session-manager-operations/, which only its owning writer may change.";case"outside-boundary":return"Read-only: this file is outside your home folder and the projects open in Session Manager.";case"not-imported":return`Read-only: this file is no longer imported by ${s}.`;case"permission":default:return"Read-only: your system does not allow writing this file."}}function qo(t){const[s,n]=u.useState(null),o=u.useRef(0),i=u.useRef(null),a=G(r=>{var l;return(l=r.files[t])==null?void 0:l.diskRaw});return u.useEffect(()=>{if(o.current+=1,a===void 0)return;const r=i.current!==t;i.current=t;let l=!1;const d=()=>{o.current+=1;const p=o.current;Promise.resolve().then(()=>window.api.config.parseImports(t)).then(m=>{l||o.current!==p||(m.ok?n({path:t,imports:m.imports}):(n({path:t,imports:[]}),W.error(m.error||"failed to parse @-imports")))}).catch(m=>{l||o.current!==p||(n({path:t,imports:[]}),W.error(`Couldn't list the @-imports of ${t}: ${ft(m)}`))})},c=r?null:setTimeout(d,Ho);return r&&d(),()=>{l=!0,c&&clearTimeout(c)}},[t,a]),u.useMemo(()=>s&&s.path===t?{imports:s.imports,ready:!0}:{imports:[],ready:!1},[s,t])}function Ko(t){const[s,n]=u.useState({}),o=t.join(`
27
- `);return u.useEffect(()=>{let i=!0;for(const a of t)Promise.resolve().then(()=>window.api.config.readText(a)).then(r=>{i&&n(l=>({...l,[a]:{exists:!!r.exists,text:r.text??""}}))}).catch(()=>{i&&n(r=>({...r,[a]:{exists:!1,text:""}}))});return()=>{i=!1}},[o]),s}function Vo({on:t}){return e.jsx("span",{"aria-hidden":!0,className:`w-4 h-4 shrink-0 mt-0.5 rounded-full box-border ${t?"border-[5px] border-fg":"border-[1.5px] border-fg-faint"}`})}function ms({name:t,trailing:s,meta:n,selected:o,testId:i,title:a,onSelect:r}){return e.jsxs("button",{type:"button",role:"radio","aria-checked":o,"aria-current":o,"data-testid":i,title:a,onClick:r,className:`w-full text-left flex gap-[11px] p-2.5 rounded-[10px] border focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent ${o?"bg-bg border-line":"border-transparent hover:bg-bg/60"}`,children:[e.jsx(Vo,{on:o}),e.jsxs("span",{className:"flex-1 min-w-0",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`flex-1 min-w-0 truncate font-mono text-[13px] ${o?"font-semibold text-fg":"font-medium text-fg-dim"}`,children:t}),e.jsx("span",{className:"shrink-0 text-[11px] text-fg-faint",children:s})]}),e.jsx("span",{className:"block text-xs text-fg-faint truncate",children:n})]})]})}function zo({scope:t,steps:s}){return e.jsxs("div",{"data-testid":"claude-md-session-loads",className:"flex flex-col px-1",children:[e.jsx("span",{className:`${an} mb-3`,children:t==="user"?"EVERY SESSION LOADS":"A SESSION HERE LOADS"}),s.map((n,o)=>e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("span",{className:`w-2.5 h-2.5 mt-1 rounded-full box-border ${n.here?"border-2 border-accent":"border-[1.5px] border-fg-faint"}`}),o<s.length-1&&e.jsx("span",{className:"w-px flex-1 bg-line my-[3px]"})]}),e.jsxs("div",{className:o<s.length-1?"pb-3.5":"",children:[e.jsx("div",{className:`font-mono text-[12.5px] ${n.here?"font-semibold text-fg":"text-fg-dim"}`,children:n.path}),e.jsx("div",{className:"text-xs text-fg-faint whitespace-nowrap",children:n.note})]})]},n.path))]})}function Yo({children:t}){const[s,n]=u.useState(!1),o=u.useRef(null),i=u.useId();return u.useEffect(()=>{if(!s)return;const a=l=>{var d;(d=o.current)!=null&&d.contains(l.target)||n(!1)},r=l=>{l.key==="Escape"&&n(!1)};return window.addEventListener("mousedown",a),window.addEventListener("keydown",r),()=>{window.removeEventListener("mousedown",a),window.removeEventListener("keydown",r)}},[s]),e.jsxs("div",{ref:o,className:"relative",children:[e.jsx("button",{type:"button","data-testid":"claude-md-more","aria-label":"More actions","aria-haspopup":"menu","aria-expanded":s,"aria-controls":s?i:void 0,onClick:()=>n(a=>!a),className:"h-9 w-9 inline-flex items-center justify-center rounded-[10px] bg-bg-hi border border-line text-fg-dim hover:text-fg hover:border-rule focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",children:"⋯"}),s&&e.jsx("div",{id:i,role:"menu","aria-label":"More actions","data-testid":"claude-md-more-menu",className:`absolute ${Pe.dialog} right-0 top-[42px] min-w-[200px] p-[5px] flex flex-col gap-1 bg-bg-hi border border-line rounded-lg shadow-lg text-[13px] text-fg`,children:t})]})}function tl({home:t,scope:s,roots:n,activeRoot:o,onSelectRoot:i,empty:a,moreMenu:r,testIdPrefix:l="claude-md"}){const d=G(C=>C.files),c=G(C=>C.loadText),p=G(C=>C.setDraft),m=G(C=>C.saveText),g=G(C=>C.watchFile),h=G(C=>C.unwatchFile),{imports:f,ready:b}=qo(o),[y,k]=u.useState(null),w=y&&y.root===o?y.ref:null,j=(w==null?void 0:w.path)??o,[P,_]=u.useState(null),[S,A]=u.useState(null),[L,E]=u.useState({});u.useEffect(()=>{let C=!0;const q=[[o,Promise.resolve().then(()=>window.api.config.canWrite(o))],...f.filter(F=>F.ok&&F.exists).map(F=>[F.path,Promise.resolve().then(()=>window.api.config.canWrite(F.path,{importedBy:o}))])];for(const[F,de]of q)de.then(xe=>{C&&xe&&typeof xe.ok=="boolean"&&E(Te=>({...Te,[F]:xe}))}).catch(()=>{});return()=>{C=!1}},[f,o]),u.useEffect(()=>(c(o,!0).catch(C=>W.error(`Couldn't read ${o}: ${ft(C)}`)),g(o),()=>{h(o)}),[o,c,g,h]),u.useEffect(()=>{if(j!==o)return c(j,!0).catch(C=>W.error(`Couldn't read ${j}: ${ft(C)}`)),g(j),()=>{h(j)}},[j,o,c,g,h]);const T=u.useMemo(()=>n.map(C=>C.path).filter(C=>C!==o),[n,o]),O=u.useMemo(()=>f.filter(C=>C.ok&&C.exists).map(C=>C.path),[f]),I=u.useMemo(()=>[...T,...O],[T,O]),M=Ko(I),ue=u.useCallback(C=>{A(null),k(C?{root:o,ref:C}:null)},[o]),le=u.useCallback(C=>{A(null),k(null),C!==o&&(i==null||i(C))},[o,i]),te=Se(C=>C.tab),ee=Se(C=>C.id),ce=Se(C=>C.clear);u.useEffect(()=>{if(te!=="claude-md"||!ee)return;const C=ee.startsWith("claude-md:")?ee.slice(10):"",q=C.indexOf(">"),F=q===-1?C:C.slice(0,q),de=q===-1?null:C.slice(q+1);if(!n.some(Te=>Te.path===F)||F!==o&&!i){ce();return}if(de===null){le(F),ce();return}if(F!==o){i==null||i(F);return}if(!b)return;const xe=f.find(Te=>Te.path===de);xe&&ue(xe),ce()},[te,ee,n,o,i,b,f,le,ue,ce]);const J=u.useCallback(async()=>{A(null);const C=await m(j,w?{importedBy:o}:void 0);C.ok||A(C.error==="conflict"?Fo:C.error??"save failed")},[j,w,o,m]),me=u.useCallback(()=>{A(null),c(j).catch(C=>W.error(`Couldn't read ${j}: ${ft(C)}`))},[j,c]),V=C=>{const q=d[C];return q?{exists:q.exists,text:q.draftRaw}:M[C]??null},B=d[o];if(!B)return e.jsx(K,{title:"loading…"});const z=d[j],se=(z==null?void 0:z.draftRaw)??"",Q=!!w&&(!w.ok||!w.exists),oe=Q?void 0:L[j],Ue=(oe==null?void 0:oe.ok)===!1,fe=Q||Ue,Ce=!w&&!B.exists,Y=Ce&&se===""&&P!==o,X=ss(B.draftRaw)+O.reduce((C,q)=>{var F;return C+ss(((F=V(q))==null?void 0:F.text)??"")},0),N=Wn(o),Z=C=>{const q=V(C);return q==null?"unknown":q.exists?"present":"missing"},ie=s==="user"?[{path:"~/.claude/CLAUDE.md",note:"this file · every project",here:!0},{path:"<project>/CLAUDE.md",note:"per project · in its Claude config",here:!1},{path:"<project>/CLAUDE.local.md",note:"per project · that machine only",here:!1}]:[{path:"~/.claude/CLAUDE.md",note:"global · edited in Home",here:!1},...n.map(C=>{const q=C.path===o,F=Z(C.path)==="missing",de=q?F?"this file · not created":"this file":F?"not created":"edited here";return{path:Ae(C.path),note:de,here:q}})],re=n.find(C=>C.path===o),we=w?`${is(w.path,t)} · IMPORTED BY ${Ae(o)}`:`${is(o,t)} · ${(re==null?void 0:re.eyebrow)??""}`,je=e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-testid":"claude-md-file-card",role:"radiogroup","aria-label":"Instruction files",className:"px-3.5 pt-3.5 pb-3 rounded-[14px] bg-bg-hi border border-line flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center px-0.5 pb-1",children:[e.jsx("span",{className:`flex-1 ${an}`,children:s==="user"?"FILE + ITS IMPORTS":"INSTRUCTIONS FILE"}),e.jsxs("span",{className:"text-[11.5px] text-fg-faint",children:["~",X.toLocaleString()," tokens"]})]}),n.map(C=>{const q=C.path===o,F=V(C.path),de=F==null?"":F.exists?`${us(F.text)} lines`:"missing";return e.jsx(ms,{name:Ae(C.path),trailing:de,meta:C.label,title:C.path,selected:q&&!w,testId:q?"referenced-file-root":"claude-md-root-row",onSelect:()=>le(C.path)},C.path)}),f.length>0&&e.jsx("div",{"data-testid":"referenced-files-rail",className:"flex flex-col gap-1.5",children:f.map(C=>{var F,de;const q=!C.ok||!C.exists;return e.jsx(ms,{name:Go(C.path,N),trailing:q?e.jsx("span",{"data-testid":"referenced-file-missing",className:"text-amber-400/90",children:"missing"}):`${us(((F=V(C.path))==null?void 0:F.text)??"")} lines`,meta:q||((de=L[C.path])==null?void 0:de.ok)===!1?"Imported · read-only":"Imported · editable here",title:C.path,selected:(w==null?void 0:w.path)===C.path,testId:"referenced-file-row",onSelect:()=>ue(C)},C.path)})})]}),e.jsx(zo,{scope:s,steps:ie})]}),he=typeof r=="function"?r({importSelected:!!w}):r,be=e.jsx("div",{"data-testid":"claude-md-empty",className:"flex justify-center px-10 py-12",children:e.jsxs("div",{className:"w-full max-w-[640px] flex flex-col gap-3.5",children:[e.jsxs("p",{className:"font-serif text-[30px] leading-tight text-fg-faint",children:[a.title,e.jsx("span",{"aria-hidden":!0,className:"inline-block w-0.5 h-7 ml-1 align-[-5px] bg-accent"})]}),e.jsx("p",{className:"max-w-[520px] text-[15px] leading-relaxed text-fg-dim",children:a.body}),e.jsx("div",{className:"mt-1.5 flex gap-2.5",children:e.jsx("button",{type:"button",onClick:()=>_(o),className:"h-[38px] px-4 rounded-[9px] border border-line bg-bg text-sm font-medium text-fg hover:bg-bg-elev focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",children:"Just start typing"})})]})}),ge=e.jsxs(e.Fragment,{children:[e.jsx(Ct,{eyebrow:we,title:Ae(j),pill:w?void 0:Ce?"Not created":"Loaded in every session",actions:he==null||he===!1?void 0:e.jsx(Yo,{children:he})}),e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col px-9 py-5 gap-3",children:[(z==null?void 0:z.loadError)&&e.jsx("div",{role:"alert",className:"shrink-0 text-[11px] text-red-400",children:z.loadError}),S&&e.jsxs("div",{role:"alert","data-testid":`${l}-save-error`,className:"shrink-0 text-[11px] text-red-400",children:[Ae(j)," ",S]}),Q&&e.jsx("div",{"data-testid":`${l}-missing-note`,className:"shrink-0 text-[11px] text-amber-400/90",children:"This import does not resolve to a readable file — the CLI will skip it."}),Ue&&e.jsx("div",{"data-testid":`${l}-readonly-note`,className:"shrink-0 text-[11px] text-amber-400/90",children:Wo(oe==null?void 0:oe.reason,Ae(o))}),e.jsx("div",{className:"flex-1 min-h-[320px] flex flex-col rounded-[14px] border border-line bg-bg-hi overflow-hidden",children:z&&e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(rn,{path:j,value:se,readOnly:fe,defaultMode:"document",dirty:fe?void 0:z.dirty,isNew:!fe&&!z.exists,emptyState:Y?be:void 0,onChange:C=>{A(null),p(j,C)},onSave:fe?void 0:()=>{J()},onRevert:fe?void 0:me},j)})})]})]});return e.jsx(St,{list:je,detail:ge})}function Xo(){return typeof navigator<"u"&&/Mac/.test(navigator.platform)}function _t({dirty:t,busy:s,parseError:n,lastSavedAt:o,onSave:i,onRevert:a,leading:r,cleanLabel:l,shortcutHint:d,scopeRef:c}){const p=t&&!s&&!n;u.useEffect(()=>{if(!d||!c)return;const h=f=>{if(!p||f.defaultPrevented||!(f.ctrlKey||f.metaKey)||f.shiftKey||f.altKey||f.key!=="s"&&f.key!=="S")return;const b=c.current,y=document.activeElement;!b||!y||!b.contains(y)||(f.preventDefault(),i())};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[d,c,p,i]);const m=d?Xo():!1,g=!t&&!n&&!!l;return e.jsxs("div",{className:"px-3 py-1.5 flex items-center gap-2 text-xs",children:[g&&e.jsxs("span",{"data-testid":"savebar-clean",className:"min-w-0 flex items-center gap-[7px] text-fg-faint",children:[e.jsx("span",{"aria-hidden":"true",className:"shrink-0 w-1.5 h-1.5 rounded-full bg-sage"}),e.jsx("span",{className:"truncate",children:l})]}),e.jsx("div",{className:"flex-1 min-w-0 truncate text-fg-faint",children:r}),n&&e.jsx("span",{className:"text-red-400 truncate max-w-xs",title:n,children:n}),!t&&!n&&!l&&o&&e.jsx("span",{className:"text-fg-faint",children:qn(o)}),t&&!n&&e.jsx("span",{className:"text-accent",children:"unsaved"}),e.jsx("button",{onClick:a,disabled:!t||s,className:"px-2 py-0.5 border border-line rounded text-fg-dim hover:text-fg hover:bg-bg-hi disabled:opacity-40 disabled:cursor-not-allowed",children:"Revert"}),e.jsxs("button",{onClick:i,disabled:!p,"aria-keyshortcuts":d&&c?m?"Meta+S":"Control+S":void 0,className:`px-2.5 py-0.5 rounded border ${p?"border-accent bg-accent/15 text-accent hover:bg-accent/25":"border-line text-fg-faint opacity-50 cursor-not-allowed"}`,children:[s?"Saving…":"Save",d&&e.jsx("kbd",{"aria-hidden":"true",className:"ml-2 font-mono text-[10.5px]",children:m?"⌘S":"Ctrl S"})]})]})}function hs({children:t,onClick:s,disabled:n,variant:o="default",tooltip:i,type:a="button",className:r}){const d=`px-2 py-0.5 text-xs rounded border transition-colors disabled:opacity-40 disabled:cursor-not-allowed ${o==="primary"?"text-accent border-accent/50 hover:bg-bg-hi":o==="danger"?"text-red-400 hover:text-red-300 border-line hover:border-red-400/50":"text-fg-dim border-line hover:text-fg hover:bg-bg-hi"} ${r??""}`,c=e.jsx("button",{type:a,title:i,onClick:s,disabled:n,className:d,children:t});return i?e.jsx(Fs,{content:i,align:"bottom-center",children:c}):c}const ln=/<[A-Za-z][A-Za-z0-9_-]*>/g,Jo=/<[A-Za-z][A-Za-z0-9_-]*>/;function Qo(t){return t.match(ln)??[]}function Zo(t){const s=[],n=(i,a)=>{if(typeof i=="string")for(const r of Qo(i))s.push({token:r,label:a})};n(t.command,"command");const o=Array.isArray(t.args)?t.args:[];o.forEach((i,a)=>{if(typeof i!="string")return;const r=o[a-1],l=a>0&&typeof r=="string"&&r.startsWith("-")&&!Jo.test(r)?`${r} ${i}`:i;n(i,l)});for(const[i,a]of Object.entries(t.env??{}))n(a,`env ${i}`);return n(t.url,"url"),s}function Rt(t){const s=new Map;for(const n of Zo(t))s.has(n.token)||s.set(n.token,n);return[...s.values()]}function ei(t,s){const n=i=>i.replace(ln,a=>Object.prototype.hasOwnProperty.call(s,a)?s[a]:a),o={...t};return typeof o.command=="string"&&(o.command=n(o.command)),Array.isArray(o.args)&&(o.args=o.args.map(i=>typeof i=="string"?n(i):i)),o.env&&(o.env=Object.fromEntries(Object.entries(o.env).map(([i,a])=>[i,typeof a=="string"?n(a):a]))),typeof o.url=="string"&&(o.url=n(o.url)),o}const st=t=>typeof t=="object"&&t!==null&&!Array.isArray(t);function ti(t){if(typeof t=="string")return t;if(st(t)){for(const s of["url","repo","path"])if(typeof t[s]=="string")return t[s]}return""}async function si(t,s={}){const n=`${t}/.claude/plugins`,o=s.quiet?{error:()=>{},warn:()=>{}}:W,i=[];let a;try{const r=await window.api.config.readJson(`${n}/known_marketplaces.json`);if(r.parseError||r.error)return o.error(`known_marketplaces.json unreadable: ${r.parseError??r.error}`),i;if(!r.exists)return i;if(!st(r.data))return o.error("known_marketplaces.json is not an object"),i;a=r.data}catch(r){return o.error(`known_marketplaces.json unreadable: ${r instanceof Error?r.message:String(r)}`),i}for(const[r,l]of Object.entries(a)){const c=`${st(l)&&typeof l.installLocation=="string"?l.installLocation:`${n}/marketplaces/${r}`}/.claude-plugin/marketplace.json`;try{const p=await window.api.config.readJson(c);if(!p.exists){o.warn(`Marketplace ${r}: ${c} not found`);continue}if(p.parseError||p.error||!st(p.data)||!Array.isArray(p.data.plugins)){o.error(`Marketplace ${r}: invalid marketplace.json${p.parseError?` — ${p.parseError}`:""}`);continue}for(const m of p.data.plugins)!st(m)||typeof m.name!="string"||!m.name||i.push({marketplace:r,name:m.name,description:typeof m.description=="string"?m.description:"",source:ti(m.source),...typeof m.version=="string"&&m.version?{version:m.version}:{}})}catch(p){o.error(`Marketplace ${r}: ${p instanceof Error?p.message:String(p)}`)}}return i}const It=[{id:"filesystem",name:"Filesystem",description:"Secure file operations with configurable access controls",official:!0,homepage:"https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem",config:{command:"npx",args:["-y","@modelcontextprotocol/server-filesystem","<path>"]},envVars:[]},{id:"fetch",name:"Fetch",description:"Web content fetching and conversion for efficient LLM usage",official:!0,homepage:"https://github.com/modelcontextprotocol/servers/tree/main/src/fetch",config:{command:"uvx",args:["mcp-server-fetch"]},envVars:[]},{id:"memory",name:"Memory",description:"Knowledge graph-based persistent memory system",official:!0,homepage:"https://github.com/modelcontextprotocol/servers/tree/main/src/memory",config:{command:"npx",args:["-y","@modelcontextprotocol/server-memory"]},envVars:[]},{id:"sequential-thinking",name:"Sequential Thinking",description:"Dynamic and reflective problem-solving through thought sequences",official:!0,homepage:"https://github.com/modelcontextprotocol/servers/tree/main/src/sequentialthinking",config:{command:"npx",args:["-y","@modelcontextprotocol/server-sequential-thinking"]},envVars:[]},{id:"git",name:"Git",description:"Tools to read, search, and manipulate Git repositories",official:!0,homepage:"https://github.com/modelcontextprotocol/servers/tree/main/src/git",config:{command:"uvx",args:["mcp-server-git","--repository","<path>"]},envVars:[]},{id:"time",name:"Time",description:"Time and timezone conversion capabilities",official:!0,homepage:"https://github.com/modelcontextprotocol/servers/tree/main/src/time",config:{command:"uvx",args:["mcp-server-time"]},envVars:[]},{id:"everything",name:"Everything",description:"Reference/test server with prompts, resources, and tools",official:!0,homepage:"https://github.com/modelcontextprotocol/servers/tree/main/src/everything",config:{command:"npx",args:["-y","@modelcontextprotocol/server-everything"]},envVars:[]},{id:"github",name:"GitHub",description:"Official GitHub repository, issues, and PR management",official:!1,homepage:"https://github.com/github/github-mcp-server",config:{command:"docker",args:["run","-i","--rm","-e","GITHUB_PERSONAL_ACCESS_TOKEN","ghcr.io/github/github-mcp-server"]},envVars:["GITHUB_PERSONAL_ACCESS_TOKEN"]},{id:"gitlab",name:"GitLab",description:"GitLab API integration for projects, issues, and merge requests",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/gitlab",config:{command:"npx",args:["-y","@modelcontextprotocol/server-gitlab"]},envVars:["GITLAB_PERSONAL_ACCESS_TOKEN","GITLAB_API_URL"]},{id:"postgres",name:"PostgreSQL",description:"Read-only database access with schema inspection",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/postgres",config:{command:"npx",args:["-y","@modelcontextprotocol/server-postgres","<connection-string>"]},envVars:[]},{id:"sqlite",name:"SQLite",description:"Database interaction and business intelligence over SQLite",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/sqlite",config:{command:"uvx",args:["--with","mcp<2","mcp-server-sqlite","--db-path","<path>"]},envVars:[]},{id:"slack",name:"Slack",description:"Channel management and messaging for Slack workspaces",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/slack",config:{command:"npx",args:["-y","@modelcontextprotocol/server-slack"]},envVars:["SLACK_BOT_TOKEN","SLACK_TEAM_ID"]},{id:"google-drive",name:"Google Drive",description:"File access and search for Google Drive",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/gdrive",config:{command:"npx",args:["-y","@modelcontextprotocol/server-gdrive"]},envVars:["GDRIVE_CREDENTIALS_PATH"]},{id:"google-maps",name:"Google Maps",description:"Location services, directions, and place details",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/google-maps",config:{command:"npx",args:["-y","@modelcontextprotocol/server-google-maps"]},envVars:["GOOGLE_MAPS_API_KEY"]},{id:"puppeteer",name:"Puppeteer",description:"Browser automation and web scraping via Puppeteer",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/puppeteer",config:{command:"npx",args:["-y","@modelcontextprotocol/server-puppeteer"]},envVars:[]},{id:"playwright",name:"Playwright",description:"Cross-browser automation for navigation, screenshots, and data extraction",official:!1,homepage:"https://github.com/microsoft/playwright-mcp",config:{command:"npx",args:["-y","@playwright/mcp@latest"]},envVars:[]},{id:"brave-search",name:"Brave Search",description:"Web and local search using the Brave Search API",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/brave-search",config:{command:"npx",args:["-y","@modelcontextprotocol/server-brave-search"]},envVars:["BRAVE_API_KEY"]},{id:"redis",name:"Redis",description:"Interact with Redis key-value stores",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/redis",config:{command:"npx",args:["-y","@modelcontextprotocol/server-redis","<redis-url>"]},envVars:[]},{id:"sentry",name:"Sentry",description:"Retrieve and analyze Sentry error tracking issues",official:!1,homepage:"https://github.com/getsentry/sentry-mcp",config:{command:"npx",args:["-y","@sentry/mcp-server@latest"]},envVars:["SENTRY_AUTH_TOKEN"]},{id:"linear",name:"Linear",description:"Issue tracking and project management for Linear",official:!1,homepage:"https://linear.app/docs/mcp",config:{command:"npx",args:["-y","mcp-remote","https://mcp.linear.app/sse"]},envVars:[]},{id:"notion",name:"Notion",description:"Notion workspace page and database management",official:!1,homepage:"https://github.com/makenotion/notion-mcp-server",config:{command:"npx",args:["-y","@notionhq/notion-mcp-server"]},envVars:["NOTION_API_KEY"]},{id:"stripe",name:"Stripe",description:"Payment processing, customers, and invoices via Stripe API",official:!1,homepage:"https://github.com/stripe/agent-toolkit",config:{command:"npx",args:["-y","@stripe/mcp","--tools=all"]},envVars:["STRIPE_SECRET_KEY"]},{id:"cloudflare",name:"Cloudflare",description:"Manage Cloudflare Workers, KV, R2, D1, and Workers AI",official:!1,homepage:"https://github.com/cloudflare/mcp-server-cloudflare",config:{command:"npx",args:["-y","mcp-remote","https://observability.mcp.cloudflare.com/sse"]},envVars:[]},{id:"context7",name:"Context7",description:"Up-to-date version-specific library docs injected into prompts",official:!1,homepage:"https://github.com/upstash/context7",config:{command:"npx",args:["-y","@upstash/context7-mcp@latest"]},envVars:[]},{id:"tavily",name:"Tavily",description:"AI-optimized web search with clean structured results",official:!1,homepage:"https://github.com/tavily-ai/tavily-mcp",config:{command:"npx",args:["-y","tavily-mcp@latest"]},envVars:["TAVILY_API_KEY"]},{id:"perplexity",name:"Perplexity",description:"Answer-engine search with deep research and reasoning",official:!1,homepage:"https://github.com/ppl-ai/modelcontextprotocol",config:{command:"npx",args:["-y","server-perplexity-ask"]},envVars:["PERPLEXITY_API_KEY"]},{id:"figma",name:"Figma Dev Mode",description:"First-party Figma design-to-code bridge exposing node tree",official:!1,homepage:"https://help.figma.com/hc/en-us/articles/32132100833559",config:{url:"http://127.0.0.1:3845/sse"},envVars:[]},{id:"supabase",name:"Supabase",description:"Manage Supabase projects, tables, and SQL queries",official:!1,homepage:"https://github.com/supabase-community/supabase-mcp",config:{command:"npx",args:["-y","@supabase/mcp-server-supabase@latest"]},envVars:["SUPABASE_ACCESS_TOKEN"]},{id:"atlassian",name:"Atlassian (Jira/Confluence)",description:"Official Jira and Confluence integration",official:!1,homepage:"https://www.atlassian.com/platform/remote-mcp-server",config:{command:"npx",args:["-y","mcp-remote","https://mcp.atlassian.com/v1/sse"]},envVars:[]},{id:"aws",name:"AWS",description:"AWS services access and best-practice guidance",official:!1,homepage:"https://github.com/awslabs/mcp",config:{command:"uvx",args:["awslabs.core-mcp-server@latest"]},envVars:["AWS_PROFILE","AWS_REGION"]},{id:"obsidian",name:"Obsidian",description:"Read and search notes in an Obsidian vault",official:!1,homepage:"https://github.com/MarkusPfundstein/mcp-obsidian",config:{command:"uvx",args:["mcp-obsidian"]},envVars:["OBSIDIAN_API_KEY"]}],vt=[{id:"pdf",name:"PDF",description:"Create, edit, and extract content from PDF documents",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/pdf"},{id:"docx",name:"DOCX",description:"Create and edit Microsoft Word documents",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/docx"},{id:"xlsx",name:"XLSX",description:"Create and edit Excel spreadsheets with formulas and formatting",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/xlsx"},{id:"pptx",name:"PPTX",description:"Create and edit PowerPoint presentations",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/pptx"},{id:"webapp-testing",name:"Webapp Testing",description:"Test web applications using Playwright-driven browser automation",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/webapp-testing"},{id:"playwright-e2e",name:"Playwright E2E",description:"End-to-end browser tests — navigation, forms, assertions, waiting strategies",official:!1,source:"local"},{id:"playwright-visual-testing",name:"Playwright Visual Testing",description:"Visual regression testing — screenshot comparison, pixel diffs, responsive layouts",official:!1,source:"local"},{id:"playwright-accessibility",name:"Playwright Accessibility",description:"Accessibility testing — WCAG compliance, axe-core scans, keyboard navigation",official:!1,source:"local"},{id:"playwright-api-testing",name:"Playwright API Testing",description:"API testing with Playwright request context — REST endpoints, auth flows, contracts",official:!1,source:"local"},{id:"playwright-debug",name:"Playwright Debug",description:"Debug failing tests — trace viewer, inspector, headed mode, flaky test fixes",official:!1,source:"local"},{id:"web-artifacts-builder",name:"Web Artifacts Builder",description:"Build polished interactive web artifacts and demos",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/web-artifacts-builder"},{id:"frontend-design",name:"Frontend Design",description:"Apply frontend UI/UX design patterns and visual polish",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/frontend-design"},{id:"canvas-design",name:"Canvas Design",description:"Canvas-based graphic design and composition techniques",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/canvas-design"},{id:"algorithmic-art",name:"Algorithmic Art",description:"Create generative and algorithmic art",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/algorithmic-art"},{id:"brand-guidelines",name:"Brand Guidelines",description:"Apply brand identity and style guideline specifications",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/brand-guidelines"},{id:"theme-factory",name:"Theme Factory",description:"Generate and customize visual themes",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/theme-factory"},{id:"slack-gif-creator",name:"Slack GIF Creator",description:"Create animated GIFs suitable for Slack",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/slack-gif-creator"},{id:"doc-coauthoring",name:"Doc Coauthoring",description:"Collaborative document authoring and editing workflows",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/doc-coauthoring"},{id:"internal-comms",name:"Internal Comms",description:"Internal communications templates and drafting",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/internal-comms"},{id:"claude-api",name:"Claude API",description:"Build apps with the Claude API and Anthropic SDKs",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/claude-api"},{id:"mcp-builder",name:"MCP Builder",description:"Scaffold and build new Model Context Protocol servers",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/mcp-builder"},{id:"skill-creator",name:"Skill Creator",description:"Scaffold and create new Claude Code skills",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/skill-creator"}],wt=[{id:"prettier-on-write",name:"Prettier on Write",description:"Auto-format JS/TS/JSON/MD files after edit via prettier",event:"PostToolUse",matcher:"Write|Edit",command:"jq -r '.tool_input.file_path // empty' | grep -E '\\.(js|jsx|ts|tsx|json|md|css|html|yaml|yml)$' | xargs -r -I{} npx --no-install prettier --write {} 2>/dev/null || true"},{id:"black-on-write",name:"Black on Write (Python)",description:"Auto-format Python files after edit via black",event:"PostToolUse",matcher:"Write|Edit",command:"jq -r '.tool_input.file_path // empty' | grep -E '\\.py$' | xargs -r black -q 2>/dev/null || true"},{id:"rustfmt-on-write",name:"rustfmt on Write",description:"Auto-format Rust files after edit via rustfmt",event:"PostToolUse",matcher:"Write|Edit",command:"jq -r '.tool_input.file_path // empty' | grep -E '\\.rs$' | xargs -r rustfmt 2>/dev/null || true"},{id:"gofmt-on-write",name:"gofmt on Write",description:"Auto-format Go files after edit via gofmt",event:"PostToolUse",matcher:"Write|Edit",command:"jq -r '.tool_input.file_path // empty' | grep -E '\\.go$' | xargs -r gofmt -w 2>/dev/null || true"},{id:"block-secret-writes",name:"Block Writes to Secrets",description:"Deny edits to .env, credentials, key files",event:"PreToolUse",matcher:"Write|Edit",command:`path=$(jq -r '.tool_input.file_path // empty'); echo "$path" | grep -qE '(^|/)(\\.env|\\.env\\..+|id_rsa|id_ed25519|.*\\.pem|.*\\.key|credentials\\.json|\\.aws/credentials)$' && { echo '{"decision":"block","reason":"refusing to edit secret file"}'; exit 2; } || true`},{id:"notify-on-stop",name:"Desktop Notify on Stop",description:"Send a desktop notification when Claude finishes a turn",event:"Stop",command:`command -v notify-send >/dev/null && notify-send "Claude Code" "Session ready" || (command -v osascript >/dev/null && osascript -e 'display notification "Session ready" with title "Claude Code"') || true`},{id:"bell-on-notification",name:"Terminal Bell on Notification",description:"Ring the terminal bell on permission prompts / idle notifications",event:"Notification",command:"printf '\\a'"},{id:"log-tool-calls",name:"Log Tool Calls (JSONL)",description:"Append every tool call to ~/.claude/logs/tool-calls.jsonl for audit",event:"PreToolUse",command:"mkdir -p ~/.claude/logs && cat >> ~/.claude/logs/tool-calls.jsonl"},{id:"auto-stage-edits",name:"Auto-stage Edited Files",description:"git add each file Claude edits (inside a repo)",event:"PostToolUse",matcher:"Write|Edit",command:`path=$(jq -r '.tool_input.file_path // empty'); [ -n "$path" ] && git -C "$(dirname "$path")" add "$path" 2>/dev/null || true`},{id:"block-dangerous-bash",name:"Block Dangerous Bash",description:"Refuse rm -rf /, fork bombs, curl|sh pipes",event:"PreToolUse",matcher:"Bash",command:`cmd=$(jq -r '.tool_input.command // empty'); echo "$cmd" | grep -qE '(rm -rf /|:\\(\\)\\{.*\\};|curl.*\\|\\s*(bash|sh)|wget.*\\|\\s*(bash|sh)|mkfs\\.|dd if=.*of=/dev/)' && { echo '{"decision":"block","reason":"dangerous command pattern"}'; exit 2; } || true`},{id:"prepend-cwd-to-prompt",name:"Prepend CWD to Prompt",description:"Add cwd context to every user prompt automatically",event:"UserPromptSubmit",command:'echo "{\\"additionalContext\\":\\"cwd: $(pwd)\\"}"'},{id:"archive-transcript",name:"Archive Transcript on SessionEnd",description:"Copy the session jsonl to ~/.claude/archive/ when done",event:"SessionEnd",command:`src=$(jq -r '.transcript_path // empty'); [ -n "$src" ] && mkdir -p ~/.claude/archive && cp "$src" ~/.claude/archive/ 2>/dev/null || true`}],Ee=(t,s,n,o)=>`---
22
+ `;return`---${g}${n}${g}---${g}${t}`}const{open:i,lines:a,texts:r,pad:l,rest:d}=o,[c,...p]=Pt(o,tn);if(c){for(const g of p.reverse())a.splice(g.start,g.end-g.start);const m=a[c.start];a.splice(c.start,c.end-c.start,m.slice(0,He(m))+n+as(m))}else{const[m]=Pt(o,mo);let g=m?m.end:r.length;if(!m)for(;g>0&&r[g-1].trim()==="";)g--;a.splice(g,0,l+n+as(g>0?a[g-1]:i))}return i+a.join("")+d}const ko={0:"\0",a:"\x07",b:"\b",t:" "," ":" ",n:`
23
+ `,v:"\v",f:"\f",r:"\r",e:"\x1B"," ":" ",'"':'"',"/":"/","\\":"\\",N:"…",_:" ",L:"\u2028",P:"\u2029"};function Eo(t){const s=t.trim(),n=/^"((?:[^"\\]|\\[\s\S])*)"/.exec(s);if(n)return n[1].replace(/\\(x[\da-fA-F]{2}|u[\da-fA-F]{4}|U[\da-fA-F]{8}|[\s\S])/g,(a,r)=>{if(r.length===1)return ko[r]??a;const l=parseInt(r.slice(1),16);return l<=1114111?String.fromCodePoint(l):a});const o=/^'((?:[^']|'')*)'/.exec(s);if(o)return o[1].replace(/''/g,"'");const i=s.search(/(?:^|\s)#/);return i===-1?s:s.slice(0,i).trimEnd()}function So(t){const s=sn(t),n=s?Pt(s,tn)[0]:void 0;if(!s||!n)return null;const[o,...i]=s.texts.slice(n.start,n.end),a=o.slice(o.indexOf(":")+1).trim().replace(/^#.*/,""),r=i.map(l=>l.trim()).filter(Boolean);return ho.test(a)?r.join(" "):Eo([a,...r].join(" "))}function Co(t){return!t||!t.trim()?"default":t.replace(/[^a-zA-Z0-9]/g,"-")}const _o=["memory","claude-md","settings","mcp","skills","plugins","agents"],Ao=0,No=1,jo=2,Oo=3;function To(t,s,n){const o=t.title.toLowerCase(),i=[t.detail??"",...t.keywords??[]].join(`
24
+ `).toLowerCase();return n.every(a=>o.includes(a)||i.includes(a))?o===s?Ao:o.startsWith(s)?No:o.includes(s)||n.every(a=>o.includes(a))?jo:Oo:null}function Lo(t,s,n=5){const o=s.trim().toLowerCase().replace(/\s+/g," ");if(!o)return[];const i=o.split(" "),a=new Map;t.forEach((l,d)=>{const c=To(l,o,i);if(c===null)return;const p=a.get(l.tab)??[];p.push({item:l,rank:c,idx:d}),a.set(l.tab,p)});const r=[];for(const l of _o){const d=a.get(l);d!=null&&d.length&&(d.sort((c,p)=>c.rank-p.rank||c.idx-p.idx),r.push({tab:l,items:d.slice(0,Math.max(0,n)).map(c=>c.item),total:d.length}))}return r}const xt=t=>!!t&&typeof t=="object"&&!Array.isArray(t);async function _e(t){try{return await t()}catch{return[]}}async function nn(t,s){const n=await t.config.readJson(s);if(n.error)throw new Error(n.error);return n.data}async function ls(t,s){const n=await Promise.all(s.map(r=>t.config.exists(r))),o=s.filter((r,l)=>n[l]),i=await Promise.all(o.map(async r=>{const l={tab:"claude-md",id:`claude-md:${r}`,title:Ae(r),detail:r};let d=[];try{const c=await t.config.parseImports(r);c.ok&&(d=c.imports.map(p=>({tab:"claude-md",id:`claude-md:${r}>${p.path}`,title:Ae(p.path),detail:p.path,keywords:["import",Ae(r)]})))}catch{}return[l,...d]})),a=new Set;return i.flat().filter(r=>a.has(r.id)?!1:(a.add(r.id),!0))}function Do(){const t=[];for(const s of Js)for(const n of s.keys)t.push({tab:"settings",id:`settings:${n}`,title:n,detail:s.title,keywords:[Xe(n),s.summary]});for(const s of bt)for(const n of s.keys)t.some(o=>o.title===n)||t.push({tab:"settings",id:`settings:${n}`,title:n,detail:s.label,keywords:[Xe(n)]});return t}async function cs(t,s,n){const o=new Set;for(const i of await Promise.all(s.map(a=>nn(t,a))))xt(i)&&Object.keys(i).forEach(a=>o.add(a));return[...o].filter(i=>!n.has(i)).map(i=>({tab:"settings",id:`settings:${i}`,title:i,detail:"Other",keywords:[Xe(i)]}))}function ds(t,s){return xt(t)?Object.entries(t).map(([n,o])=>{const i=[s];if(xt(o))for(const a of["command","url","type"])typeof o[a]=="string"&&i.push(o[a]);return{tab:"mcp",id:`mcp:${n}`,title:n,detail:"MCP server",keywords:i}}):[]}async function ps(t,s,n){const o=async l=>{const d=await t.config.listDir(l,{dirsOnly:!0});if(!d.ok)throw new Error(d.error??`failed to list ${l}`);return d.entries},i=async(l,d)=>{const c=`${d}/SKILL.md`,p=await t.config.readText(c);if(!p.exists)return null;const m=it(p.text);return{tab:"skills",id:`skills:${c}`,title:m.name??l,detail:m.description??void 0,keywords:["skill",c]}},a=(await Promise.all((await o(s)).map(async l=>{const d=await i(l.name,l.path);return d?[d]:Promise.all((await o(l.path)).map(c=>i(c.name,c.path)))}))).flat().filter(l=>l!==null);let r=[];try{const l=await t.config.listDir(n,{filesOnly:!0});l.ok&&(r=l.entries.filter(d=>d.name.endsWith(".md")).map(d=>({tab:"skills",id:`skills:${d.path}`,title:d.name.replace(/\.md$/,""),detail:"Command",keywords:["command",`/${d.name.replace(/\.md$/,"")}`,d.path]})))}catch{}return[...a,...r]}async function Xa({scope:t,cwd:s,api:n}){const o=Do(),i=new Set(o.map(p=>p.title));if(t==="home"){let p;try{p=await n.app.homeDir()}catch{return o}const m=`${p}/.claude`,g=await Promise.all([_e(()=>ls(n,[`${m}/CLAUDE.md`])),_e(()=>cs(n,[`${m}/settings.json`],i)),_e(async()=>{var y;return ds((y=(await n.claudeConfig.read({fileId:"claudeJson",scope:"user"})).data)==null?void 0:y.mcpServers,`${p}/.claude.json`)}),_e(()=>ps(n,`${m}/skills`,`${m}/commands`)),_e(async()=>(await n.plugins.list()).map(y=>({tab:"plugins",id:`plugins:${y.key}`,title:y.name,detail:y.marketplace,keywords:[y.key,y.enabled?"enabled":"disabled"]}))),_e(async()=>(await n.agents.listPersonas()).map(y=>({tab:"agents",id:`agents:${y.name}`,title:y.name,detail:y.description??void 0,keywords:y.tags})))]),[h,f,...b]=g;return[...h,...o,...f,...b.flat()]}if(!s)return[];const a=await Promise.all([_e(async()=>{const p=await n.memory.list({workspace:Co(s),cwd:s});if(p.error)throw new Error(p.error);return p.entries.map(m=>({tab:"memory",id:`memory:${m.path}`,title:m.name,detail:m.path}))}),_e(()=>ls(n,[`${s}/CLAUDE.md`,`${s}/CLAUDE.local.md`])),_e(()=>cs(n,[`${s}/.claude/settings.json`,`${s}/.claude/settings.local.json`],i)),_e(async()=>{const p=await nn(n,`${s}/.mcp.json`);return ds(xt(p)?p.mcpServers:void 0,`${s}/.mcp.json`)}),_e(()=>ps(n,`${s}/.claude/skills`,`${s}/.claude/commands`))]),[r,l,d,...c]=a;return[...r,...l,...o,...d,...c.flat()]}function Po(t,s){if(t.length<=s)return t;const n=t.split(/[\\/]/).filter(l=>l!=="");if(n.length===0)return t;const o=t.indexOf("/"),i=t.indexOf("\\"),a=i!==-1&&(o===-1||i<o)?"\\":"/";let r=n[n.length-1];for(let l=n.length-2;l>=0;l--){const d=`${n[l]}${a}${r}`;if(2+d.length>s)break;r=d}return`…${a}${r}`}const Ro=t=>!!t&&typeof t=="object"&&!Array.isArray(t);function Ya(t){return Object.values(t).some(s=>s.status==="failed"||s.status==="needs-auth")}function Ja(t){return t==null?{}:t===0?{count:"missing",warn:!0}:{count:`${t} ${t===1?"file":"files"}`}}async function Qa(t){if(!await window.api.config.exists(t))return 0;const s=await window.api.config.parseImports(t);if(!s.ok)throw new Error(s.error);return 1+s.imports.filter(n=>n.exists).length}async function Za(t){const s=await window.api.config.readJson(t);if(s.error)throw new Error(s.error);return Ro(s.data)?Object.keys(s.data).length:0}function Io(t,s){return s?t?"bg-accent/15 text-accent-dark":"bg-accent-muted/15 text-accent-muted":t?"bg-fg text-bg-hi":"bg-bg/10 text-line"}function Mo({groups:t,loading:s,activeIndex:n,tabs:o,onChoose:i,onHover:a}){if(s)return e.jsx("div",{className:"px-3.5 py-3 text-[12.5px] text-fg-dim",children:"Loading…"});if(t.length===0)return e.jsx("div",{className:"px-3.5 py-3 text-[12.5px] text-fg-dim",children:"No matches"});let r=0;return e.jsx("div",{role:"listbox","aria-label":"Config search results",className:"py-1.5",children:t.map(l=>{var d;return e.jsxs("div",{className:"py-1",children:[e.jsxs("div",{"data-testid":"config-search-group",className:"flex items-center justify-between px-3.5 pt-1 pb-0.5 text-[10.5px] font-semibold tracking-[0.08em] uppercase text-fg-dim",children:[e.jsx("span",{children:((d=o.find(c=>c.key===l.tab))==null?void 0:d.label)??l.tab}),e.jsx("span",{className:"font-mono",children:l.total})]}),l.items.map(c=>{const p=r++,m=p===n;return e.jsxs("button",{type:"button",role:"option","aria-selected":m,onClick:()=>i(c),onMouseEnter:()=>a(p),className:`w-full text-left px-3.5 py-1.5 flex items-baseline gap-2 min-w-0 overflow-hidden ${m?"bg-bg-elev":""}`,children:[e.jsx("span",{className:"text-[13px] font-medium text-fg shrink-0 max-w-[60%] truncate",title:c.title,children:c.title}),c.detail&&e.jsx("span",{className:"text-[11.5px] text-fg-dim min-w-0 truncate",children:c.detail})]},c.id)})]},l.tab)})})}function el({load:t,loadKey:s,onChoose:n}){const o=u.useRef(null),[i,a]=u.useState(""),[r,l]=u.useState(0),[d,c]=u.useState(null),p=u.useRef(null),m=d&&d.key===s?d.items:null,g=u.useMemo(()=>m?Lo(m,i):[],[m,i]),h=u.useMemo(()=>g.flatMap(w=>w.items),[g]),f=u.useCallback(()=>{p.current!==s&&(p.current=s,t().then(w=>c({key:s,items:w}),w=>{W.error(`Search all config: ${w instanceof Error?w.message:String(w)}`),c({key:s,items:[]})}))},[t,s]),b=u.useCallback(w=>{a(w),l(0)},[]),y=u.useCallback(w=>{var O;n(w),a(""),l(0),(O=o.current)==null||O.blur()},[n]),k=u.useCallback(w=>{if(w.key==="ArrowDown"||w.key==="ArrowUp"){if(w.preventDefault(),h.length===0)return;const O=w.key==="ArrowDown"?1:-1;l(D=>(D+O+h.length)%h.length)}else if(w.key==="Enter"){const O=h[Math.min(r,h.length-1)];if(!O)return;w.preventDefault(),y(O)}},[h,r,y]);return{bandProps:{searchQuery:i,onSearch:b,onSearchFocus:f,onSearchKeyDown:k,searchInputRef:o},panelProps:{groups:g,loading:m===null,activeIndex:r,onChoose:y,onHover:l}}}const Uo=264,$o=20,Bo=Math.floor((Uo-2*$o)/7.2);function tl({testId:t,eyebrow:s,title:n,scopePath:o,tabs:i,activeKey:a,onSelect:r,search:l,learn:d,children:c,drawer:p}){const m=u.useRef([]),[g,h]=u.useState(!1),[f,b]=u.useState(!1),{searchQuery:y,onSearch:k,onSearchFocus:w,onSearchKeyDown:O,searchInputRef:D}=l.bandProps;u.useEffect(()=>{const j=A=>{if(A.key!=="/"||A.ctrlKey||A.metaKey||A.altKey||A.defaultPrevented)return;const L=A.target instanceof HTMLElement?A.target:null;L&&(L.tagName==="INPUT"||L.tagName==="TEXTAREA"||L.isContentEditable||L.closest('[contenteditable="true"]'))||D.current&&(A.preventDefault(),D.current.focus())};return document.addEventListener("keydown",j,!0),()=>document.removeEventListener("keydown",j,!0)},[D]);const C=j=>{if(j.key==="Escape"){j.preventDefault(),k(""),j.currentTarget.blur();return}O(j)},E=(j,A)=>{var T;let L=-1;j.key==="ArrowDown"?L=(A+1)%i.length:j.key==="ArrowUp"?L=(A-1+i.length)%i.length:j.key==="Home"?L=0:j.key==="End"&&(L=i.length-1),!(L<0)&&(j.preventDefault(),(T=m.current[L])==null||T.focus(),r(i[L].key))},_=f&&y.trim()!=="";return e.jsxs("div",{"data-testid":t,className:"h-full w-full flex bg-bg text-fg",children:[e.jsxs("div",{className:"relative shrink-0 h-full",children:[e.jsxs("nav",{"data-testid":"config-rail",className:"w-[264px] shrink-0 h-full bg-fg text-bg-hi flex flex-col",children:[e.jsxs("div",{className:"flex flex-col gap-1 px-5 pt-6 pb-4",children:[e.jsx("span",{className:"text-[10.5px] font-semibold tracking-[0.1em] text-bg-hi/60",children:s}),e.jsx("span",{className:"font-serif text-[22px] font-medium leading-[1.15] text-bg-hi",children:n}),e.jsx("span",{"data-testid":"config-rail-path",title:o,className:"block font-mono text-xs text-rhythm whitespace-nowrap",children:Po(o,Bo)})]}),e.jsx("div",{className:"relative px-5 pb-4",children:e.jsxs("label",{className:"flex items-center gap-2.5 w-full h-10 px-3 rounded-[10px] bg-bg/[0.08] border border-bg/[0.14] text-[13px] text-bg-hi/60 focus-within:border-bg/30",children:[e.jsx(Ie,{name:"search",size:15,className:"shrink-0"}),e.jsx("input",{ref:D,type:"search","aria-label":"Search all config",placeholder:"Search all config",value:y,onChange:j=>k(j.target.value),onFocus:()=>{b(!0),w()},onBlur:()=>b(!1),onKeyDown:C,className:"flex-1 min-w-0 bg-transparent outline-none text-bg-hi placeholder:text-bg-hi/60"}),e.jsx("kbd",{className:"font-mono text-[11px] px-1.5 py-px rounded border border-bg/20",children:"/"})]})}),e.jsx("div",{"data-testid":"config-rail-scroll",className:"flex-1 min-h-0 overflow-y-auto px-5 py-1",children:e.jsx("div",{role:"tablist","aria-orientation":"vertical","aria-label":n,className:"flex flex-col gap-1",children:i.map((j,A)=>{const L=j.key===a;return e.jsxs("button",{ref:T=>{m.current[A]=T},type:"button",role:"tab","aria-selected":L,tabIndex:L?0:-1,"data-testid":`config-rail-tab-${j.key}`,onClick:()=>r(j.key),onKeyDown:T=>E(T,A),className:`w-full h-10 flex items-center gap-2.5 px-3 rounded-xl border border-transparent focus-visible:outline focus-visible:outline-2 focus-visible:outline-butter ${L?"bg-bg text-fg shadow-sm":"text-bg-elev hover:bg-bg/10"}`,children:[e.jsx(Ie,{name:j.icon,size:18,stroke:1.7,className:L?"text-fg":"text-rhythm"}),e.jsx("span",{"data-testid":"config-rail-tab-label",className:"flex-1 min-w-0 truncate text-left text-[14px] font-semibold",children:j.label}),j.count!==void 0&&e.jsx("span",{"data-testid":"config-rail-count",className:`shrink-0 whitespace-nowrap font-mono text-xs px-[7px] py-0.5 rounded-md ${Io(L,!!j.warn)}`,children:j.count}),j.attention&&e.jsx("span",{"data-testid":"config-rail-attention","aria-label":"needs attention",className:"w-[7px] h-[7px] rounded-full bg-butter"})]},j.key)})})}),e.jsx("div",{className:"shrink-0 px-5 pt-2 pb-6",children:e.jsx("button",{type:"button",onClick:()=>h(j=>!j),className:"text-[11px] font-semibold tracking-[0.08em] text-butter hover:underline",children:"LEARN"})})]}),_&&e.jsx("div",{"data-testid":"config-search-panel",onMouseDown:j=>j.preventDefault(),className:`absolute left-full top-4 ml-2 w-[380px] max-h-[60vh] overflow-y-auto rounded-xl border border-line bg-bg-hi text-fg shadow-lg whitespace-normal ${je.dialog}`,children:e.jsx(Mo,{...l.panelProps,tabs:i})})]}),e.jsxs("div",{className:"flex-1 min-w-0 h-full flex flex-col",children:[g&&d&&e.jsx("div",{"data-testid":`${t}-learn`,className:"shrink-0 border-b border-line bg-bg-elev px-7 py-4 max-h-[40vh] overflow-y-auto",children:e.jsx(Rn,{content:d})}),e.jsx("div",{className:"flex-1 min-h-0","data-testid":`${t}-panel-${a}`,children:c}),p]})]})}const Se=Kt(t=>({tab:null,id:null,set:(s,n)=>t({tab:s,id:n}),clear:()=>t({tab:null,id:null})})),Yt="text-[11px] font-semibold uppercase tracking-[0.1em] text-fg-faint";function St({list:t,detail:s}){return e.jsxs("div",{"data-testid":"config-workbench",className:"flex flex-1 min-h-0 min-w-0",children:[e.jsx("div",{"data-testid":"config-workbench-list",className:"w-[318px] shrink-0 bg-bg-elev border-r border-line px-4 py-[18px] flex flex-col gap-3 overflow-y-auto",children:t}),e.jsx("div",{"data-testid":"config-workbench-detail",className:"flex-1 min-w-0 min-h-0 flex flex-col overflow-y-auto",children:s})]})}function on({eyebrow:t,badge:s,path:n,note:o,children:i}){return e.jsxs("div",{"data-testid":"config-file-card",className:"px-4 py-3.5 rounded-[14px] bg-bg-hi border border-line flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`flex-1 min-w-0 truncate ${Yt}`,children:t}),s!==void 0&&e.jsx("span",{className:"text-[11.5px] font-semibold px-2 py-0.5 rounded-full bg-sage/15 text-sage-dark",children:s})]}),e.jsx("span",{"data-testid":"config-file-card-path",className:"font-mono text-[12.5px] text-fg break-all",children:n}),o!==void 0&&e.jsx("span",{className:"text-xs text-fg-faint",children:o}),i]})}function sl({filter:t,onFilterChange:s,placeholder:n,primaryLabel:o,onPrimary:i,secondary:a}){return e.jsxs("div",{className:"flex items-center gap-2 whitespace-nowrap",children:[e.jsxs("label",{className:"flex-1 min-w-0 flex items-center gap-2 h-[38px] px-3 rounded-[10px] bg-bg-hi border border-line text-[13px] text-fg-faint focus-within:border-fg-faint",children:[e.jsx(Ie,{name:"search",size:15,className:"shrink-0"}),e.jsx("input",{type:"search","aria-label":n,placeholder:n,value:t,onChange:r=>s(r.target.value),className:"flex-1 min-w-0 bg-transparent outline-none text-fg placeholder:text-fg-faint"})]}),a,e.jsx("button",{type:"button",onClick:i,className:"h-[38px] px-4 rounded-[10px] bg-accent text-bg-hi hover:bg-accent/90 text-[13.5px] font-semibold focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",children:o})]})}function Fo({title:t,meta:s,trailing:n,selected:o,muted:i,onSelect:a}){return e.jsxs("div",{role:"option","aria-selected":o,tabIndex:0,"data-testid":"config-list-row",onClick:a,onKeyDown:r=>{r.target===r.currentTarget&&(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),a())},className:`px-3 py-2.5 rounded-xl border cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent ${o?"bg-bg-hi border-line shadow-sm":"border-transparent hover:bg-bg-hi/60"} ${i?"opacity-60":""}`,children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:`flex-1 min-w-0 truncate font-mono text-[13px] text-fg ${o?"font-semibold":"font-medium"}`,children:t}),n!==void 0&&e.jsx("span",{className:"shrink-0 text-xs text-fg-faint",children:n})]}),s!==void 0&&e.jsx("div",{className:"mt-0.5 text-xs text-fg-faint truncate",children:s})]})}function Ct({eyebrow:t,title:s,pill:n,actions:o}){return e.jsxs("div",{"data-testid":"config-detail-header",className:"shrink-0 px-9 pt-6 pb-5 border-b border-line flex items-end gap-3 whitespace-nowrap",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:`truncate ${Yt}`,children:t}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2.5 min-w-0",children:[e.jsx("span",{className:"truncate font-mono text-[27px] font-semibold tracking-[-0.015em] text-fg",children:s}),n!==void 0&&e.jsx("span",{className:"shrink-0 text-xs font-semibold px-2 py-0.5 rounded-full bg-sage/15 text-sage-dark",children:n})]})]}),o!==void 0&&e.jsx("div",{className:"shrink-0 flex items-center gap-2",children:o})]})}function Ge({label:t,labelNote:s,action:n,children:o}){return e.jsxs("section",{"data-testid":"config-card",className:"px-[18px] py-3.5 rounded-[14px] bg-bg-hi border border-line",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:`flex-1 min-w-0 truncate ${Yt}`,children:[t,s&&e.jsxs("span",{className:"font-medium",children:[" · ",s]})]}),n]}),e.jsx("div",{className:"mt-1 text-[15px] leading-normal text-fg",children:o})]})}function nl({text:t}){return e.jsxs("div",{"data-testid":"config-saved-line",role:"status",className:"flex items-center gap-2 text-[13px] text-fg-dim",children:[e.jsx("span",{"aria-hidden":!0,className:"w-[7px] h-[7px] rounded-full bg-sage"}),t]})}const Ho=[{key:"document",label:"Document"},{key:"markdown",label:"Markdown"}];function Go(t){return t==="edit"||t==="markdown"?"markdown":"document"}function Wo(t,s){const n=t.split(`
25
+ `);let o=null,i=0;for(let a=0;a<n.length;a++){const r=/^\s{0,3}(`{3,}|~{3,})/.exec(n[a]);if(r){o===null?o=r[1][0]:r[1][0]===o&&(o=null);continue}if(o===null&&/^\s{0,3}#{1,6}(\s|$)/.test(n[a])){if(i===s)return a+1;i++}}return null}function rn({path:t,value:s,onChange:n,onSave:o,onRevert:i,dirty:a,isNew:r,readOnly:l,defaultMode:d,headerRight:c,hideStatusBar:p,changedFrom:m,emptyState:g}){const h=In(),f=Mn(t),[b,y]=u.useState(()=>Go(d)),[k,w]=u.useState(!1),[O,D]=u.useState(null),C=O??k,E=u.useCallback(()=>{D(null),w(!0)},[]),_=u.useCallback(()=>{D(null),w(!1)},[]),[j,A]=u.useState(null),L=u.useMemo(()=>m===void 0?void 0:oo(m,s),[m,s]),T=u.useMemo(()=>m===void 0?void 0:io(m,s),[m,s]),U=u.useRef(null),I=u.useRef(null),ue=u.useCallback(B=>{U.current=B},[]),le=u.useCallback(()=>U.current,[]);u.useEffect(()=>{if(!k)return;const B=z=>{z.key==="Escape"&&_()};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[k,_]);const te=f?b:"markdown",ee=a===void 0&&!r?void 0:a?"dirty":r?"new":"saved",ce=B=>{te!=="document"||l||!o||(B.ctrlKey||B.metaKey)&&B.key.toLowerCase()==="s"&&(B.preventDefault(),o())},J=u.useCallback((B,z)=>{var oe;const se=U.current,Q=Wo(((oe=se==null?void 0:se.getModel())==null?void 0:oe.getValue())??s,z);!se||Q===null||(se.revealLineNearTop(Q),se.setPosition({lineNumber:Q,column:1}),se.focus())},[s]),me=e.jsx(Un,{path:t,name:Ae(t),value:s,onChange:n,onSave:()=>o==null?void 0:o(),onReady:ue,onCursor:A,readOnly:l,markedLines:L}),V=te==="document"?l?e.jsx($n,{ref:I,text:s,wideMeasure:h.wideMeasure}):e.jsx("div",{ref:I,className:"h-full min-h-0",children:e.jsx(ro,{value:s,onChange:n,markedBlocks:T,fullScreen:k})}):f?e.jsxs("div",{className:"flex flex-col h-full",children:[!l&&e.jsx(Bn,{getEditor:le}),e.jsx("div",{className:"flex-1 min-h-0",children:me})]}):me;return e.jsxs("div",{className:k?`fixed inset-0 ${je.dialog} flex flex-col min-h-0 bg-bg`:"flex flex-col h-full min-h-0","data-testid":"document-editor-pane","data-mode":te,"data-fullscreen":k?"true":void 0,onKeyDown:ce,children:[e.jsxs("div",{className:"flex items-center gap-2 px-2 h-9 shrink-0 border-b border-line bg-bg-elev",children:[k&&e.jsxs("button",{type:"button",onClick:_,"data-testid":"document-exit-fullscreen",className:"flex items-center gap-1.5 px-2 py-0.5 text-[11px] font-medium text-fg border border-line rounded hover:bg-bg-hi",title:"Exit full screen (Esc)",children:["← Exit full screen",e.jsx("span",{className:"font-mono text-[9px] text-fg-faint",children:"Esc"})]}),e.jsxs("svg",{"aria-hidden":!0,viewBox:"0 0 16 16",className:"w-3.5 h-3.5 shrink-0 text-fg-faint",fill:"none",stroke:"currentColor",strokeWidth:"1.3",children:[e.jsx("path",{d:"M4 1.5h5.5L13 5v9.5H4z"}),e.jsx("path",{d:"M9.5 1.5V5H13"})]}),e.jsx("span",{className:"text-[12px] font-mono font-medium text-fg truncate","data-testid":"document-title",children:Ae(t)}),ee&&e.jsx(Fn,{state:ee}),k&&e.jsx("span",{className:"text-[10px] font-mono text-fg-faint truncate min-w-0",title:t,children:t}),l&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] uppercase tracking-wide text-fg-faint border border-line",children:"read-only"}),e.jsx("div",{className:"flex-1"}),c,f&&e.jsx("button",{type:"button",onClick:()=>D(!C),"data-testid":"document-outline-toggle","aria-pressed":C,className:`px-2 py-0.5 text-[11px] rounded ${C?"bg-bg-hi text-fg":"text-fg-faint hover:text-fg"}`,title:"Toggle document outline",children:"☰ Outline"}),f&&e.jsx("div",{role:"group","aria-label":"Editor mode",className:"flex items-center p-0.5 rounded bg-bg-hi","data-testid":"document-mode-toggle",children:Ho.map(B=>e.jsx("button",{type:"button",onClick:()=>y(B.key),"aria-pressed":te===B.key,className:`px-2.5 py-0.5 text-[11px] rounded transition-colors ${te===B.key?"bg-bg text-fg font-medium shadow-sm":"text-fg-dim hover:text-fg"}`,children:B.label},B.key))}),!k&&e.jsx("button",{type:"button",onClick:E,"data-testid":"document-fullscreen",className:"px-2 py-0.5 text-[11px] text-fg-dim border border-line rounded hover:text-fg hover:bg-bg-hi",title:"Full screen",children:"⤢ Full screen"})]}),e.jsx("div",{className:"flex-1 min-h-0",children:g?e.jsx("div",{className:"h-full min-h-0 overflow-auto","data-testid":"document-empty",children:g}):f?e.jsxs("div",{className:"flex h-full overflow-clip",children:[C&&e.jsx(Hn,{text:s,scrollRef:I,onJump:te==="markdown"?J:void 0,showStats:!0}),e.jsx("div",{className:"flex-1 min-w-0",children:V})]}):V}),!p&&e.jsx(Gn,{text:s,cursor:te==="markdown"?j:null,language:f?"Markdown":Wn(t)||void 0,positionLabel:te==="document"?"Document · saved as Markdown":void 0,saveState:ee,dirty:!!a,isNew:r,onSave:l?void 0:o,onRevert:l?void 0:i})]})}const an="text-[10.5px] font-semibold uppercase tracking-[0.1em] text-fg-faint",qo="changed on disk since it was loaded. Revert reloads it",Ko=300,ft=t=>t instanceof Error?t.message:String(t);function us(t){return t?t.replace(/\n$/,"").split(`
26
+ `).length:0}function Vo(t,s){const n=ns(t),o=ns(s);if(!n.length||!o.length||n[0]!==o[0])return t;let i=0;for(;i<n.length&&i<o.length&&n[i]===o[i];)i++;return[...Array(o.length-i).fill(".."),...n.slice(i)].join("/")}function zo(t,s){switch(t){case"sensitive":return"Read-only: Session Manager never writes credential, SSH or autostart files.";case"ops-root":return"Read-only: this file is inside session-manager-operations/, which only its owning writer may change.";case"outside-boundary":return"Read-only: this file is outside your home folder and the projects open in Session Manager.";case"not-imported":return`Read-only: this file is no longer imported by ${s}.`;case"permission":default:return"Read-only: your system does not allow writing this file."}}function Xo(t){const[s,n]=u.useState(null),o=u.useRef(0),i=u.useRef(null),a=G(r=>{var l;return(l=r.files[t])==null?void 0:l.diskRaw});return u.useEffect(()=>{if(o.current+=1,a===void 0)return;const r=i.current!==t;i.current=t;let l=!1;const d=()=>{o.current+=1;const p=o.current;Promise.resolve().then(()=>window.api.config.parseImports(t)).then(m=>{l||o.current!==p||(m.ok?n({path:t,imports:m.imports}):(n({path:t,imports:[]}),W.error(m.error||"failed to parse @-imports")))}).catch(m=>{l||o.current!==p||(n({path:t,imports:[]}),W.error(`Couldn't list the @-imports of ${t}: ${ft(m)}`))})},c=r?null:setTimeout(d,Ko);return r&&d(),()=>{l=!0,c&&clearTimeout(c)}},[t,a]),u.useMemo(()=>s&&s.path===t?{imports:s.imports,ready:!0}:{imports:[],ready:!1},[s,t])}function Yo(t){const[s,n]=u.useState({}),o=t.join(`
27
+ `);return u.useEffect(()=>{let i=!0;for(const a of t)Promise.resolve().then(()=>window.api.config.readText(a)).then(r=>{i&&n(l=>({...l,[a]:{exists:!!r.exists,text:r.text??""}}))}).catch(()=>{i&&n(r=>({...r,[a]:{exists:!1,text:""}}))});return()=>{i=!1}},[o]),s}function Jo({on:t}){return e.jsx("span",{"aria-hidden":!0,className:`w-4 h-4 shrink-0 mt-0.5 rounded-full box-border ${t?"border-[5px] border-fg":"border-[1.5px] border-fg-faint"}`})}function ms({name:t,trailing:s,meta:n,selected:o,testId:i,title:a,onSelect:r}){return e.jsxs("button",{type:"button",role:"radio","aria-checked":o,"aria-current":o,"data-testid":i,title:a,onClick:r,className:`w-full text-left flex gap-[11px] p-2.5 rounded-[10px] border focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent ${o?"bg-bg border-line":"border-transparent hover:bg-bg/60"}`,children:[e.jsx(Jo,{on:o}),e.jsxs("span",{className:"flex-1 min-w-0",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`flex-1 min-w-0 truncate font-mono text-[13px] ${o?"font-semibold text-fg":"font-medium text-fg-dim"}`,children:t}),e.jsx("span",{className:"shrink-0 text-[11px] text-fg-faint",children:s})]}),e.jsx("span",{className:"block text-xs text-fg-faint truncate",children:n})]})]})}function Qo({scope:t,steps:s}){return e.jsxs("div",{"data-testid":"claude-md-session-loads",className:"flex flex-col px-1",children:[e.jsx("span",{className:`${an} mb-3`,children:t==="user"?"EVERY SESSION LOADS":"A SESSION HERE LOADS"}),s.map((n,o)=>e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("span",{className:`w-2.5 h-2.5 mt-1 rounded-full box-border ${n.here?"border-2 border-accent":"border-[1.5px] border-fg-faint"}`}),o<s.length-1&&e.jsx("span",{className:"w-px flex-1 bg-line my-[3px]"})]}),e.jsxs("div",{className:o<s.length-1?"pb-3.5":"",children:[e.jsx("div",{className:`font-mono text-[12.5px] ${n.here?"font-semibold text-fg":"text-fg-dim"}`,children:n.path}),e.jsx("div",{className:"text-xs text-fg-faint whitespace-nowrap",children:n.note})]})]},n.path))]})}function Zo({children:t}){const[s,n]=u.useState(!1),o=u.useRef(null),i=u.useId();return u.useEffect(()=>{if(!s)return;const a=l=>{var d;(d=o.current)!=null&&d.contains(l.target)||n(!1)},r=l=>{l.key==="Escape"&&n(!1)};return window.addEventListener("mousedown",a),window.addEventListener("keydown",r),()=>{window.removeEventListener("mousedown",a),window.removeEventListener("keydown",r)}},[s]),e.jsxs("div",{ref:o,className:"relative",children:[e.jsx("button",{type:"button","data-testid":"claude-md-more","aria-label":"More actions","aria-haspopup":"menu","aria-expanded":s,"aria-controls":s?i:void 0,onClick:()=>n(a=>!a),className:"h-9 w-9 inline-flex items-center justify-center rounded-[10px] bg-bg-hi border border-line text-fg-dim hover:text-fg hover:border-rule focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",children:"⋯"}),s&&e.jsx("div",{id:i,role:"menu","aria-label":"More actions","data-testid":"claude-md-more-menu",className:`absolute ${je.dialog} right-0 top-[42px] min-w-[200px] p-[5px] flex flex-col gap-1 bg-bg-hi border border-line rounded-lg shadow-lg text-[13px] text-fg`,children:t})]})}function ol({home:t,scope:s,roots:n,activeRoot:o,onSelectRoot:i,empty:a,moreMenu:r,testIdPrefix:l="claude-md"}){const d=G(S=>S.files),c=G(S=>S.loadText),p=G(S=>S.setDraft),m=G(S=>S.saveText),g=G(S=>S.watchFile),h=G(S=>S.unwatchFile),{imports:f,ready:b}=Xo(o),[y,k]=u.useState(null),w=y&&y.root===o?y.ref:null,O=(w==null?void 0:w.path)??o,[D,C]=u.useState(null),[E,_]=u.useState(null),[j,A]=u.useState({});u.useEffect(()=>{let S=!0;const q=[[o,Promise.resolve().then(()=>window.api.config.canWrite(o))],...f.filter(F=>F.ok&&F.exists).map(F=>[F.path,Promise.resolve().then(()=>window.api.config.canWrite(F.path,{importedBy:o}))])];for(const[F,de]of q)de.then(xe=>{S&&xe&&typeof xe.ok=="boolean"&&A(Le=>({...Le,[F]:xe}))}).catch(()=>{});return()=>{S=!1}},[f,o]),u.useEffect(()=>(c(o,!0).catch(S=>W.error(`Couldn't read ${o}: ${ft(S)}`)),g(o),()=>{h(o)}),[o,c,g,h]),u.useEffect(()=>{if(O!==o)return c(O,!0).catch(S=>W.error(`Couldn't read ${O}: ${ft(S)}`)),g(O),()=>{h(O)}},[O,o,c,g,h]);const L=u.useMemo(()=>n.map(S=>S.path).filter(S=>S!==o),[n,o]),T=u.useMemo(()=>f.filter(S=>S.ok&&S.exists).map(S=>S.path),[f]),U=u.useMemo(()=>[...L,...T],[L,T]),I=Yo(U),ue=u.useCallback(S=>{_(null),k(S?{root:o,ref:S}:null)},[o]),le=u.useCallback(S=>{_(null),k(null),S!==o&&(i==null||i(S))},[o,i]),te=Se(S=>S.tab),ee=Se(S=>S.id),ce=Se(S=>S.clear);u.useEffect(()=>{if(te!=="claude-md"||!ee)return;const S=ee.startsWith("claude-md:")?ee.slice(10):"",q=S.indexOf(">"),F=q===-1?S:S.slice(0,q),de=q===-1?null:S.slice(q+1);if(!n.some(Le=>Le.path===F)||F!==o&&!i){ce();return}if(de===null){le(F),ce();return}if(F!==o){i==null||i(F);return}if(!b)return;const xe=f.find(Le=>Le.path===de);xe&&ue(xe),ce()},[te,ee,n,o,i,b,f,le,ue,ce]);const J=u.useCallback(async()=>{_(null);const S=await m(O,w?{importedBy:o}:void 0);S.ok||_(S.error==="conflict"?qo:S.error??"save failed")},[O,w,o,m]),me=u.useCallback(()=>{_(null),c(O).catch(S=>W.error(`Couldn't read ${O}: ${ft(S)}`))},[O,c]),V=S=>{const q=d[S];return q?{exists:q.exists,text:q.draftRaw}:I[S]??null},B=d[o];if(!B)return e.jsx(K,{title:"loading…"});const z=d[O],se=(z==null?void 0:z.draftRaw)??"",Q=!!w&&(!w.ok||!w.exists),oe=Q?void 0:j[O],Ue=(oe==null?void 0:oe.ok)===!1,fe=Q||Ue,Ce=!w&&!B.exists,X=Ce&&se===""&&D!==o,Y=ss(B.draftRaw)+T.reduce((S,q)=>{var F;return S+ss(((F=V(q))==null?void 0:F.text)??"")},0),N=qn(o),Z=S=>{const q=V(S);return q==null?"unknown":q.exists?"present":"missing"},ie=s==="user"?[{path:"~/.claude/CLAUDE.md",note:"this file · every project",here:!0},{path:"<project>/CLAUDE.md",note:"per project · in its Claude config",here:!1},{path:"<project>/CLAUDE.local.md",note:"per project · that machine only",here:!1}]:[{path:"~/.claude/CLAUDE.md",note:"global · edited in Home",here:!1},...n.map(S=>{const q=S.path===o,F=Z(S.path)==="missing",de=q?F?"this file · not created":"this file":F?"not created":"edited here";return{path:Ae(S.path),note:de,here:q}})],re=n.find(S=>S.path===o),we=w?`${is(w.path,t)} · IMPORTED BY ${Ae(o)}`:`${is(o,t)} · ${(re==null?void 0:re.eyebrow)??""}`,Te=e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-testid":"claude-md-file-card",role:"radiogroup","aria-label":"Instruction files",className:"px-3.5 pt-3.5 pb-3 rounded-[14px] bg-bg-hi border border-line flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center px-0.5 pb-1",children:[e.jsx("span",{className:`flex-1 ${an}`,children:s==="user"?"FILE + ITS IMPORTS":"INSTRUCTIONS FILE"}),e.jsxs("span",{className:"text-[11.5px] text-fg-faint",children:["~",Y.toLocaleString()," tokens"]})]}),n.map(S=>{const q=S.path===o,F=V(S.path),de=F==null?"":F.exists?`${us(F.text)} lines`:"missing";return e.jsx(ms,{name:Ae(S.path),trailing:de,meta:S.label,title:S.path,selected:q&&!w,testId:q?"referenced-file-root":"claude-md-root-row",onSelect:()=>le(S.path)},S.path)}),f.length>0&&e.jsx("div",{"data-testid":"referenced-files-rail",className:"flex flex-col gap-1.5",children:f.map(S=>{var F,de;const q=!S.ok||!S.exists;return e.jsx(ms,{name:Vo(S.path,N),trailing:q?e.jsx("span",{"data-testid":"referenced-file-missing",className:"text-amber-400/90",children:"missing"}):`${us(((F=V(S.path))==null?void 0:F.text)??"")} lines`,meta:q||((de=j[S.path])==null?void 0:de.ok)===!1?"Imported · read-only":"Imported · editable here",title:S.path,selected:(w==null?void 0:w.path)===S.path,testId:"referenced-file-row",onSelect:()=>ue(S)},S.path)})})]}),e.jsx(Qo,{scope:s,steps:ie})]}),he=typeof r=="function"?r({importSelected:!!w}):r,be=e.jsx("div",{"data-testid":"claude-md-empty",className:"flex justify-center px-10 py-12",children:e.jsxs("div",{className:"w-full max-w-[640px] flex flex-col gap-3.5",children:[e.jsxs("p",{className:"font-serif text-[30px] leading-tight text-fg-faint",children:[a.title,e.jsx("span",{"aria-hidden":!0,className:"inline-block w-0.5 h-7 ml-1 align-[-5px] bg-accent"})]}),e.jsx("p",{className:"max-w-[520px] text-[15px] leading-relaxed text-fg-dim",children:a.body}),e.jsx("div",{className:"mt-1.5 flex gap-2.5",children:e.jsx("button",{type:"button",onClick:()=>C(o),className:"h-[38px] px-4 rounded-[9px] border border-line bg-bg text-sm font-medium text-fg hover:bg-bg-elev focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",children:"Just start typing"})})]})}),ge=e.jsxs(e.Fragment,{children:[e.jsx(Ct,{eyebrow:we,title:Ae(O),pill:w?void 0:Ce?"Not created":"Loaded in every session",actions:he==null||he===!1?void 0:e.jsx(Zo,{children:he})}),e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col px-9 py-5 gap-3",children:[(z==null?void 0:z.loadError)&&e.jsx("div",{role:"alert",className:"shrink-0 text-[11px] text-red-400",children:z.loadError}),E&&e.jsxs("div",{role:"alert","data-testid":`${l}-save-error`,className:"shrink-0 text-[11px] text-red-400",children:[Ae(O)," ",E]}),Q&&e.jsx("div",{"data-testid":`${l}-missing-note`,className:"shrink-0 text-[11px] text-amber-400/90",children:"This import does not resolve to a readable file — the CLI will skip it."}),Ue&&e.jsx("div",{"data-testid":`${l}-readonly-note`,className:"shrink-0 text-[11px] text-amber-400/90",children:zo(oe==null?void 0:oe.reason,Ae(o))}),e.jsx("div",{className:"flex-1 min-h-[320px] flex flex-col rounded-[14px] border border-line bg-bg-hi overflow-hidden",children:z&&e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(rn,{path:O,value:se,readOnly:fe,defaultMode:"document",dirty:fe?void 0:z.dirty,isNew:!fe&&!z.exists,emptyState:X?be:void 0,onChange:S=>{_(null),p(O,S)},onSave:fe?void 0:()=>{J()},onRevert:fe?void 0:me},O)})})]})]});return e.jsx(St,{list:Te,detail:ge})}function il({open:t,onClose:s,title:n,sub:o,keyVals:i,tail:a,footer:r,children:l}){const[d,c]=u.useState(!1);if(u.useEffect(()=>{if(!t){c(!1);return}const g=requestAnimationFrame(()=>c(!0));return()=>cancelAnimationFrame(g)},[t]),u.useEffect(()=>{if(!t)return;const g=h=>{h.key==="Escape"&&(h.stopPropagation(),s())};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[t,s]),!t)return null;const p=g=>{g.target===g.currentTarget&&s()},m=e.jsxs("div",{className:`fixed inset-0 ${je.dialog}`,"data-testid":"home-drawer-root",children:[e.jsx("div",{className:`absolute inset-0 bg-black/50 transition-opacity duration-[220ms] ${d?"opacity-100":"opacity-0"}`,onClick:p,"data-testid":"home-drawer-backdrop"}),e.jsxs("aside",{role:"dialog","aria-modal":"true","aria-label":n,className:`absolute top-0 right-0 h-full w-full max-w-[420px] bg-bg-hi border-l border-line shadow-xl flex flex-col transition-transform duration-[220ms] ${d?"translate-x-0":"translate-x-full"}`,style:{transitionTimingFunction:"cubic-bezier(.32,.72,.28,1)"},"data-testid":"home-drawer",children:[e.jsxs("header",{className:"px-5 py-4 border-b border-line flex items-start justify-between gap-3 shrink-0",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{className:"m-0 font-serif text-[18px] font-semibold text-fg truncate",children:n}),o&&e.jsx("div",{className:"text-[12px] text-fg-faint truncate mt-0.5",children:o})]}),e.jsx("button",{onClick:s,className:"shrink-0 rounded-md border border-line bg-bg px-2.5 py-1 text-[12px] font-semibold text-fg-dim hover:bg-bg-elev","aria-label":"Close",children:"Close"})]}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-auto px-5 py-4 grid gap-4 content-start",children:[l,i.length>0&&e.jsx("dl",{className:"m-0 grid gap-2",style:{gridTemplateColumns:"minmax(0,100px) minmax(0,1fr)"},children:i.map(g=>e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"m-0 font-mono text-[11px] uppercase tracking-[0.05em] text-fg-faint",children:g.label}),e.jsx("dd",{className:"m-0 text-[12.5px] text-fg break-words",children:g.value})]},g.label))}),a&&a.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"font-mono text-[11px] uppercase tracking-[0.08em] text-fg-faint mb-2",children:"Live tail"}),e.jsx("div",{className:"grid gap-2",children:a.map(g=>e.jsxs("div",{className:"bg-bg border border-line rounded-lg px-3 py-2",children:[e.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.05em] text-fg-faint mb-1",children:g.role}),e.jsx("div",{className:"text-[12px] text-fg-dim leading-[1.5] whitespace-pre-wrap break-words line-clamp-6",children:g.text})]},g.id))})]})]}),r&&e.jsx("footer",{className:"px-5 py-3.5 border-t border-line flex gap-2 justify-end shrink-0",children:r})]})]});return typeof document<"u"&&document.body?Kn.createPortal(m,document.body):m}function ei(){return typeof navigator<"u"&&/Mac/.test(navigator.platform)}function _t({dirty:t,busy:s,parseError:n,lastSavedAt:o,onSave:i,onRevert:a,leading:r,cleanLabel:l,shortcutHint:d,scopeRef:c}){const p=t&&!s&&!n;u.useEffect(()=>{if(!d||!c)return;const h=f=>{if(!p||f.defaultPrevented||!(f.ctrlKey||f.metaKey)||f.shiftKey||f.altKey||f.key!=="s"&&f.key!=="S")return;const b=c.current,y=document.activeElement;!b||!y||!b.contains(y)||(f.preventDefault(),i())};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[d,c,p,i]);const m=d?ei():!1,g=!t&&!n&&!!l;return e.jsxs("div",{className:"px-3 py-1.5 flex items-center gap-2 text-xs",children:[g&&e.jsxs("span",{"data-testid":"savebar-clean",className:"min-w-0 flex items-center gap-[7px] text-fg-faint",children:[e.jsx("span",{"aria-hidden":"true",className:"shrink-0 w-1.5 h-1.5 rounded-full bg-sage"}),e.jsx("span",{className:"truncate",children:l})]}),e.jsx("div",{className:"flex-1 min-w-0 truncate text-fg-faint",children:r}),n&&e.jsx("span",{className:"text-red-400 truncate max-w-xs",title:n,children:n}),!t&&!n&&!l&&o&&e.jsx("span",{className:"text-fg-faint",children:Vn(o)}),t&&!n&&e.jsx("span",{className:"text-accent",children:"unsaved"}),e.jsx("button",{onClick:a,disabled:!t||s,className:"px-2 py-0.5 border border-line rounded text-fg-dim hover:text-fg hover:bg-bg-hi disabled:opacity-40 disabled:cursor-not-allowed",children:"Revert"}),e.jsxs("button",{onClick:i,disabled:!p,"aria-keyshortcuts":d&&c?m?"Meta+S":"Control+S":void 0,className:`px-2.5 py-0.5 rounded border ${p?"border-accent bg-accent/15 text-accent hover:bg-accent/25":"border-line text-fg-faint opacity-50 cursor-not-allowed"}`,children:[s?"Saving…":"Save",d&&e.jsx("kbd",{"aria-hidden":"true",className:"ml-2 font-mono text-[10.5px]",children:m?"⌘S":"Ctrl S"})]})]})}function hs({children:t,onClick:s,disabled:n,variant:o="default",tooltip:i,type:a="button",className:r}){const d=`px-2 py-0.5 text-xs rounded border transition-colors disabled:opacity-40 disabled:cursor-not-allowed ${o==="primary"?"text-accent border-accent/50 hover:bg-bg-hi":o==="danger"?"text-red-400 hover:text-red-300 border-line hover:border-red-400/50":"text-fg-dim border-line hover:text-fg hover:bg-bg-hi"} ${r??""}`,c=e.jsx("button",{type:a,title:i,onClick:s,disabled:n,className:d,children:t});return i?e.jsx(Fs,{content:i,align:"bottom-center",children:c}):c}const ln=/<[A-Za-z][A-Za-z0-9_-]*>/g,ti=/<[A-Za-z][A-Za-z0-9_-]*>/;function si(t){return t.match(ln)??[]}function ni(t){const s=[],n=(i,a)=>{if(typeof i=="string")for(const r of si(i))s.push({token:r,label:a})};n(t.command,"command");const o=Array.isArray(t.args)?t.args:[];o.forEach((i,a)=>{if(typeof i!="string")return;const r=o[a-1],l=a>0&&typeof r=="string"&&r.startsWith("-")&&!ti.test(r)?`${r} ${i}`:i;n(i,l)});for(const[i,a]of Object.entries(t.env??{}))n(a,`env ${i}`);return n(t.url,"url"),s}function Rt(t){const s=new Map;for(const n of ni(t))s.has(n.token)||s.set(n.token,n);return[...s.values()]}function oi(t,s){const n=i=>i.replace(ln,a=>Object.prototype.hasOwnProperty.call(s,a)?s[a]:a),o={...t};return typeof o.command=="string"&&(o.command=n(o.command)),Array.isArray(o.args)&&(o.args=o.args.map(i=>typeof i=="string"?n(i):i)),o.env&&(o.env=Object.fromEntries(Object.entries(o.env).map(([i,a])=>[i,typeof a=="string"?n(a):a]))),typeof o.url=="string"&&(o.url=n(o.url)),o}const st=t=>typeof t=="object"&&t!==null&&!Array.isArray(t);function ii(t){if(typeof t=="string")return t;if(st(t)){for(const s of["url","repo","path"])if(typeof t[s]=="string")return t[s]}return""}async function ri(t,s={}){const n=`${t}/.claude/plugins`,o=s.quiet?{error:()=>{},warn:()=>{}}:W,i=[];let a;try{const r=await window.api.config.readJson(`${n}/known_marketplaces.json`);if(r.parseError||r.error)return o.error(`known_marketplaces.json unreadable: ${r.parseError??r.error}`),i;if(!r.exists)return i;if(!st(r.data))return o.error("known_marketplaces.json is not an object"),i;a=r.data}catch(r){return o.error(`known_marketplaces.json unreadable: ${r instanceof Error?r.message:String(r)}`),i}for(const[r,l]of Object.entries(a)){const c=`${st(l)&&typeof l.installLocation=="string"?l.installLocation:`${n}/marketplaces/${r}`}/.claude-plugin/marketplace.json`;try{const p=await window.api.config.readJson(c);if(!p.exists){o.warn(`Marketplace ${r}: ${c} not found`);continue}if(p.parseError||p.error||!st(p.data)||!Array.isArray(p.data.plugins)){o.error(`Marketplace ${r}: invalid marketplace.json${p.parseError?` — ${p.parseError}`:""}`);continue}for(const m of p.data.plugins)!st(m)||typeof m.name!="string"||!m.name||i.push({marketplace:r,name:m.name,description:typeof m.description=="string"?m.description:"",source:ii(m.source),...typeof m.version=="string"&&m.version?{version:m.version}:{}})}catch(p){o.error(`Marketplace ${r}: ${p instanceof Error?p.message:String(p)}`)}}return i}const It=[{id:"filesystem",name:"Filesystem",description:"Secure file operations with configurable access controls",official:!0,homepage:"https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem",config:{command:"npx",args:["-y","@modelcontextprotocol/server-filesystem","<path>"]},envVars:[]},{id:"fetch",name:"Fetch",description:"Web content fetching and conversion for efficient LLM usage",official:!0,homepage:"https://github.com/modelcontextprotocol/servers/tree/main/src/fetch",config:{command:"uvx",args:["mcp-server-fetch"]},envVars:[]},{id:"memory",name:"Memory",description:"Knowledge graph-based persistent memory system",official:!0,homepage:"https://github.com/modelcontextprotocol/servers/tree/main/src/memory",config:{command:"npx",args:["-y","@modelcontextprotocol/server-memory"]},envVars:[]},{id:"sequential-thinking",name:"Sequential Thinking",description:"Dynamic and reflective problem-solving through thought sequences",official:!0,homepage:"https://github.com/modelcontextprotocol/servers/tree/main/src/sequentialthinking",config:{command:"npx",args:["-y","@modelcontextprotocol/server-sequential-thinking"]},envVars:[]},{id:"git",name:"Git",description:"Tools to read, search, and manipulate Git repositories",official:!0,homepage:"https://github.com/modelcontextprotocol/servers/tree/main/src/git",config:{command:"uvx",args:["mcp-server-git","--repository","<path>"]},envVars:[]},{id:"time",name:"Time",description:"Time and timezone conversion capabilities",official:!0,homepage:"https://github.com/modelcontextprotocol/servers/tree/main/src/time",config:{command:"uvx",args:["mcp-server-time"]},envVars:[]},{id:"everything",name:"Everything",description:"Reference/test server with prompts, resources, and tools",official:!0,homepage:"https://github.com/modelcontextprotocol/servers/tree/main/src/everything",config:{command:"npx",args:["-y","@modelcontextprotocol/server-everything"]},envVars:[]},{id:"github",name:"GitHub",description:"Official GitHub repository, issues, and PR management",official:!1,homepage:"https://github.com/github/github-mcp-server",config:{command:"docker",args:["run","-i","--rm","-e","GITHUB_PERSONAL_ACCESS_TOKEN","ghcr.io/github/github-mcp-server"]},envVars:["GITHUB_PERSONAL_ACCESS_TOKEN"]},{id:"gitlab",name:"GitLab",description:"GitLab API integration for projects, issues, and merge requests",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/gitlab",config:{command:"npx",args:["-y","@modelcontextprotocol/server-gitlab"]},envVars:["GITLAB_PERSONAL_ACCESS_TOKEN","GITLAB_API_URL"]},{id:"postgres",name:"PostgreSQL",description:"Read-only database access with schema inspection",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/postgres",config:{command:"npx",args:["-y","@modelcontextprotocol/server-postgres","<connection-string>"]},envVars:[]},{id:"sqlite",name:"SQLite",description:"Database interaction and business intelligence over SQLite",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/sqlite",config:{command:"uvx",args:["--with","mcp<2","mcp-server-sqlite","--db-path","<path>"]},envVars:[]},{id:"slack",name:"Slack",description:"Channel management and messaging for Slack workspaces",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/slack",config:{command:"npx",args:["-y","@modelcontextprotocol/server-slack"]},envVars:["SLACK_BOT_TOKEN","SLACK_TEAM_ID"]},{id:"google-drive",name:"Google Drive",description:"File access and search for Google Drive",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/gdrive",config:{command:"npx",args:["-y","@modelcontextprotocol/server-gdrive"]},envVars:["GDRIVE_CREDENTIALS_PATH"]},{id:"google-maps",name:"Google Maps",description:"Location services, directions, and place details",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/google-maps",config:{command:"npx",args:["-y","@modelcontextprotocol/server-google-maps"]},envVars:["GOOGLE_MAPS_API_KEY"]},{id:"puppeteer",name:"Puppeteer",description:"Browser automation and web scraping via Puppeteer",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/puppeteer",config:{command:"npx",args:["-y","@modelcontextprotocol/server-puppeteer"]},envVars:[]},{id:"playwright",name:"Playwright",description:"Cross-browser automation for navigation, screenshots, and data extraction",official:!1,homepage:"https://github.com/microsoft/playwright-mcp",config:{command:"npx",args:["-y","@playwright/mcp@latest"]},envVars:[]},{id:"brave-search",name:"Brave Search",description:"Web and local search using the Brave Search API",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/brave-search",config:{command:"npx",args:["-y","@modelcontextprotocol/server-brave-search"]},envVars:["BRAVE_API_KEY"]},{id:"redis",name:"Redis",description:"Interact with Redis key-value stores",official:!1,homepage:"https://github.com/modelcontextprotocol/servers-archived/tree/main/src/redis",config:{command:"npx",args:["-y","@modelcontextprotocol/server-redis","<redis-url>"]},envVars:[]},{id:"sentry",name:"Sentry",description:"Retrieve and analyze Sentry error tracking issues",official:!1,homepage:"https://github.com/getsentry/sentry-mcp",config:{command:"npx",args:["-y","@sentry/mcp-server@latest"]},envVars:["SENTRY_AUTH_TOKEN"]},{id:"linear",name:"Linear",description:"Issue tracking and project management for Linear",official:!1,homepage:"https://linear.app/docs/mcp",config:{command:"npx",args:["-y","mcp-remote","https://mcp.linear.app/sse"]},envVars:[]},{id:"notion",name:"Notion",description:"Notion workspace page and database management",official:!1,homepage:"https://github.com/makenotion/notion-mcp-server",config:{command:"npx",args:["-y","@notionhq/notion-mcp-server"]},envVars:["NOTION_API_KEY"]},{id:"stripe",name:"Stripe",description:"Payment processing, customers, and invoices via Stripe API",official:!1,homepage:"https://github.com/stripe/agent-toolkit",config:{command:"npx",args:["-y","@stripe/mcp","--tools=all"]},envVars:["STRIPE_SECRET_KEY"]},{id:"cloudflare",name:"Cloudflare",description:"Manage Cloudflare Workers, KV, R2, D1, and Workers AI",official:!1,homepage:"https://github.com/cloudflare/mcp-server-cloudflare",config:{command:"npx",args:["-y","mcp-remote","https://observability.mcp.cloudflare.com/sse"]},envVars:[]},{id:"context7",name:"Context7",description:"Up-to-date version-specific library docs injected into prompts",official:!1,homepage:"https://github.com/upstash/context7",config:{command:"npx",args:["-y","@upstash/context7-mcp@latest"]},envVars:[]},{id:"tavily",name:"Tavily",description:"AI-optimized web search with clean structured results",official:!1,homepage:"https://github.com/tavily-ai/tavily-mcp",config:{command:"npx",args:["-y","tavily-mcp@latest"]},envVars:["TAVILY_API_KEY"]},{id:"perplexity",name:"Perplexity",description:"Answer-engine search with deep research and reasoning",official:!1,homepage:"https://github.com/ppl-ai/modelcontextprotocol",config:{command:"npx",args:["-y","server-perplexity-ask"]},envVars:["PERPLEXITY_API_KEY"]},{id:"figma",name:"Figma Dev Mode",description:"First-party Figma design-to-code bridge exposing node tree",official:!1,homepage:"https://help.figma.com/hc/en-us/articles/32132100833559",config:{url:"http://127.0.0.1:3845/sse"},envVars:[]},{id:"supabase",name:"Supabase",description:"Manage Supabase projects, tables, and SQL queries",official:!1,homepage:"https://github.com/supabase-community/supabase-mcp",config:{command:"npx",args:["-y","@supabase/mcp-server-supabase@latest"]},envVars:["SUPABASE_ACCESS_TOKEN"]},{id:"atlassian",name:"Atlassian (Jira/Confluence)",description:"Official Jira and Confluence integration",official:!1,homepage:"https://www.atlassian.com/platform/remote-mcp-server",config:{command:"npx",args:["-y","mcp-remote","https://mcp.atlassian.com/v1/sse"]},envVars:[]},{id:"aws",name:"AWS",description:"AWS services access and best-practice guidance",official:!1,homepage:"https://github.com/awslabs/mcp",config:{command:"uvx",args:["awslabs.core-mcp-server@latest"]},envVars:["AWS_PROFILE","AWS_REGION"]},{id:"obsidian",name:"Obsidian",description:"Read and search notes in an Obsidian vault",official:!1,homepage:"https://github.com/MarkusPfundstein/mcp-obsidian",config:{command:"uvx",args:["mcp-obsidian"]},envVars:["OBSIDIAN_API_KEY"]}],vt=[{id:"pdf",name:"PDF",description:"Create, edit, and extract content from PDF documents",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/pdf"},{id:"docx",name:"DOCX",description:"Create and edit Microsoft Word documents",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/docx"},{id:"xlsx",name:"XLSX",description:"Create and edit Excel spreadsheets with formulas and formatting",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/xlsx"},{id:"pptx",name:"PPTX",description:"Create and edit PowerPoint presentations",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/pptx"},{id:"webapp-testing",name:"Webapp Testing",description:"Test web applications using Playwright-driven browser automation",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/webapp-testing"},{id:"playwright-e2e",name:"Playwright E2E",description:"End-to-end browser tests — navigation, forms, assertions, waiting strategies",official:!1,source:"local"},{id:"playwright-visual-testing",name:"Playwright Visual Testing",description:"Visual regression testing — screenshot comparison, pixel diffs, responsive layouts",official:!1,source:"local"},{id:"playwright-accessibility",name:"Playwright Accessibility",description:"Accessibility testing — WCAG compliance, axe-core scans, keyboard navigation",official:!1,source:"local"},{id:"playwright-api-testing",name:"Playwright API Testing",description:"API testing with Playwright request context — REST endpoints, auth flows, contracts",official:!1,source:"local"},{id:"playwright-debug",name:"Playwright Debug",description:"Debug failing tests — trace viewer, inspector, headed mode, flaky test fixes",official:!1,source:"local"},{id:"web-artifacts-builder",name:"Web Artifacts Builder",description:"Build polished interactive web artifacts and demos",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/web-artifacts-builder"},{id:"frontend-design",name:"Frontend Design",description:"Apply frontend UI/UX design patterns and visual polish",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/frontend-design"},{id:"canvas-design",name:"Canvas Design",description:"Canvas-based graphic design and composition techniques",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/canvas-design"},{id:"algorithmic-art",name:"Algorithmic Art",description:"Create generative and algorithmic art",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/algorithmic-art"},{id:"brand-guidelines",name:"Brand Guidelines",description:"Apply brand identity and style guideline specifications",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/brand-guidelines"},{id:"theme-factory",name:"Theme Factory",description:"Generate and customize visual themes",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/theme-factory"},{id:"slack-gif-creator",name:"Slack GIF Creator",description:"Create animated GIFs suitable for Slack",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/slack-gif-creator"},{id:"doc-coauthoring",name:"Doc Coauthoring",description:"Collaborative document authoring and editing workflows",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/doc-coauthoring"},{id:"internal-comms",name:"Internal Comms",description:"Internal communications templates and drafting",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/internal-comms"},{id:"claude-api",name:"Claude API",description:"Build apps with the Claude API and Anthropic SDKs",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/claude-api"},{id:"mcp-builder",name:"MCP Builder",description:"Scaffold and build new Model Context Protocol servers",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/mcp-builder"},{id:"skill-creator",name:"Skill Creator",description:"Scaffold and create new Claude Code skills",official:!0,source:"https://github.com/anthropics/skills/tree/main/skills/skill-creator"}],wt=[{id:"prettier-on-write",name:"Prettier on Write",description:"Auto-format JS/TS/JSON/MD files after edit via prettier",event:"PostToolUse",matcher:"Write|Edit",command:"jq -r '.tool_input.file_path // empty' | grep -E '\\.(js|jsx|ts|tsx|json|md|css|html|yaml|yml)$' | xargs -r -I{} npx --no-install prettier --write {} 2>/dev/null || true"},{id:"black-on-write",name:"Black on Write (Python)",description:"Auto-format Python files after edit via black",event:"PostToolUse",matcher:"Write|Edit",command:"jq -r '.tool_input.file_path // empty' | grep -E '\\.py$' | xargs -r black -q 2>/dev/null || true"},{id:"rustfmt-on-write",name:"rustfmt on Write",description:"Auto-format Rust files after edit via rustfmt",event:"PostToolUse",matcher:"Write|Edit",command:"jq -r '.tool_input.file_path // empty' | grep -E '\\.rs$' | xargs -r rustfmt 2>/dev/null || true"},{id:"gofmt-on-write",name:"gofmt on Write",description:"Auto-format Go files after edit via gofmt",event:"PostToolUse",matcher:"Write|Edit",command:"jq -r '.tool_input.file_path // empty' | grep -E '\\.go$' | xargs -r gofmt -w 2>/dev/null || true"},{id:"block-secret-writes",name:"Block Writes to Secrets",description:"Deny edits to .env, credentials, key files",event:"PreToolUse",matcher:"Write|Edit",command:`path=$(jq -r '.tool_input.file_path // empty'); echo "$path" | grep -qE '(^|/)(\\.env|\\.env\\..+|id_rsa|id_ed25519|.*\\.pem|.*\\.key|credentials\\.json|\\.aws/credentials)$' && { echo '{"decision":"block","reason":"refusing to edit secret file"}'; exit 2; } || true`},{id:"notify-on-stop",name:"Desktop Notify on Stop",description:"Send a desktop notification when Claude finishes a turn",event:"Stop",command:`command -v notify-send >/dev/null && notify-send "Claude Code" "Session ready" || (command -v osascript >/dev/null && osascript -e 'display notification "Session ready" with title "Claude Code"') || true`},{id:"bell-on-notification",name:"Terminal Bell on Notification",description:"Ring the terminal bell on permission prompts / idle notifications",event:"Notification",command:"printf '\\a'"},{id:"log-tool-calls",name:"Log Tool Calls (JSONL)",description:"Append every tool call to ~/.claude/logs/tool-calls.jsonl for audit",event:"PreToolUse",command:"mkdir -p ~/.claude/logs && cat >> ~/.claude/logs/tool-calls.jsonl"},{id:"auto-stage-edits",name:"Auto-stage Edited Files",description:"git add each file Claude edits (inside a repo)",event:"PostToolUse",matcher:"Write|Edit",command:`path=$(jq -r '.tool_input.file_path // empty'); [ -n "$path" ] && git -C "$(dirname "$path")" add "$path" 2>/dev/null || true`},{id:"block-dangerous-bash",name:"Block Dangerous Bash",description:"Refuse rm -rf /, fork bombs, curl|sh pipes",event:"PreToolUse",matcher:"Bash",command:`cmd=$(jq -r '.tool_input.command // empty'); echo "$cmd" | grep -qE '(rm -rf /|:\\(\\)\\{.*\\};|curl.*\\|\\s*(bash|sh)|wget.*\\|\\s*(bash|sh)|mkfs\\.|dd if=.*of=/dev/)' && { echo '{"decision":"block","reason":"dangerous command pattern"}'; exit 2; } || true`},{id:"prepend-cwd-to-prompt",name:"Prepend CWD to Prompt",description:"Add cwd context to every user prompt automatically",event:"UserPromptSubmit",command:'echo "{\\"additionalContext\\":\\"cwd: $(pwd)\\"}"'},{id:"archive-transcript",name:"Archive Transcript on SessionEnd",description:"Copy the session jsonl to ~/.claude/archive/ when done",event:"SessionEnd",command:`src=$(jq -r '.transcript_path // empty'); [ -n "$src" ] && mkdir -p ~/.claude/archive && cp "$src" ~/.claude/archive/ 2>/dev/null || true`}],Ee=(t,s,n,o)=>`---
28
28
  name: ${t}
29
29
  description: ${s}
30
30
  tools: ${n}
31
31
  ---
32
32
 
33
33
  ${o}
34
- `,ni=[{id:"code-reviewer",name:"Code Reviewer",description:"Review staged changes for bugs, style, and maintainability",tools:"Read, Grep, Glob, Bash",content:Ee("code-reviewer","Review staged changes for bugs, style, and maintainability","Read, Grep, Glob, Bash",`You are a senior code reviewer. Read the user's staged diff (via \`git diff --staged\`), walk each change, and report:
34
+ `,ai=[{id:"code-reviewer",name:"Code Reviewer",description:"Review staged changes for bugs, style, and maintainability",tools:"Read, Grep, Glob, Bash",content:Ee("code-reviewer","Review staged changes for bugs, style, and maintainability","Read, Grep, Glob, Bash",`You are a senior code reviewer. Read the user's staged diff (via \`git diff --staged\`), walk each change, and report:
35
35
  - correctness issues (bugs, edge cases, race conditions)
36
36
  - security issues (injection, auth, secrets)
37
37
  - maintainability issues (naming, duplication, abstractions)
38
38
  - style / convention deviations vs the rest of the repo
39
39
 
40
- Be specific: cite file:line. Distinguish blocking issues from nits. Do not rewrite — just review.`)},{id:"test-runner",name:"Test Runner",description:"Run the project test suite, report failures, suggest fixes",tools:"Bash, Read, Grep",content:Ee("test-runner","Run the project test suite, report failures, suggest fixes","Bash, Read, Grep","Detect the test framework (jest, vitest, pytest, cargo test, go test, …) from package manifests. Run the suite. For each failure: read the failing test + the code under test, diagnose the cause, and propose a concrete fix. Do not apply fixes yourself.")},{id:"security-auditor",name:"Security Auditor",description:"Scan code for common vulnerabilities and unsafe patterns",tools:"Read, Grep, Glob, Bash",content:Ee("security-auditor","Scan code for common vulnerabilities and unsafe patterns","Read, Grep, Glob, Bash","Audit the codebase for OWASP top-10 and common CWE patterns: SQL injection, XSS, SSRF, path traversal, hardcoded secrets, weak crypto, insecure deserialization, missing authz. Report findings with severity, file:line, and remediation sketch.")},{id:"docs-writer",name:"Docs Writer",description:"Generate or update docstrings and README sections",tools:"Read, Edit, Grep, Glob",content:Ee("docs-writer","Generate or update docstrings and README sections","Read, Edit, Grep, Glob","For each public symbol missing documentation, write a concise doc comment in the project's existing style. For README sections, match the existing tone. Never invent APIs — read the code first.")},{id:"refactorer",name:"Refactorer",description:"Propose structural refactors without changing behavior",tools:"Read, Grep, Glob, Edit",content:Ee("refactorer","Propose structural refactors without changing behavior","Read, Grep, Glob, Edit","Identify extract-method, extract-class, inline, rename, and dead-code opportunities. Prefer small reversible refactors. Always preserve behavior — no feature changes.")},{id:"debugger",name:"Debugger",description:"Diagnose a failing test or runtime error from a stack trace",tools:"Read, Grep, Glob, Bash",content:Ee("debugger","Diagnose a failing test or runtime error from a stack trace","Read, Grep, Glob, Bash","Given a stack trace or failing test, walk the call chain, read the relevant code, form a hypothesis, and propose a minimal fix. Reproduce the bug before fixing when possible.")},{id:"commit-msg-writer",name:"Commit Message Writer",description:"Write a conventional commit message from staged changes",tools:"Bash, Read",content:Ee("commit-msg-writer","Write a conventional commit message from staged changes","Bash, Read","Run `git diff --staged`, summarize the change, and produce a conventional-commit message: `<type>(<scope>): <subject>`. Types: feat, fix, refactor, docs, test, chore, perf. Subject ≤72 chars, imperative, lowercase.")},{id:"perf-profiler",name:"Performance Profiler",description:"Identify hot paths and perf regressions in changed code",tools:"Read, Grep, Glob, Bash",content:Ee("perf-profiler","Identify hot paths and perf regressions in changed code","Read, Grep, Glob, Bash","Look for accidental N+1 loops, quadratic scans, sync IO in hot loops, and unbounded allocations. Rank findings by likely impact; cite file:line. Do not micro-optimize without evidence.")},{id:"sql-reviewer",name:"SQL Reviewer",description:"Review SQL/ORM queries for correctness and performance",tools:"Read, Grep, Glob",content:Ee("sql-reviewer","Review SQL/ORM queries for correctness and performance","Read, Grep, Glob","Inspect SQL and ORM queries for missing indexes, SELECT *, N+1, cartesian joins, SQL injection risk, and transaction boundaries. Report severity + remediation.")},{id:"api-designer",name:"API Designer",description:"Review REST/GraphQL API design for consistency and correctness",tools:"Read, Grep, Glob",content:Ee("api-designer","Review REST/GraphQL API design for consistency and correctness","Read, Grep, Glob","Audit route naming, HTTP verb usage, status codes, pagination, auth, error envelopes, and versioning. Flag inconsistencies against the rest of the surface.")},{id:"migration-planner",name:"Migration Planner",description:"Draft a safe DB migration + rollback plan for a schema change",tools:"Read, Grep, Glob, Bash",content:Ee("migration-planner","Draft a safe DB migration + rollback plan for a schema change","Read, Grep, Glob, Bash","For the requested schema change, produce forward + rollback migrations, a backfill strategy for large tables, and a deploy sequence that keeps the old code running through the transition.")},{id:"dependency-auditor",name:"Dependency Auditor",description:"Audit dependencies for vulnerabilities and stale versions",tools:"Bash, Read",content:Ee("dependency-auditor","Audit dependencies for vulnerabilities and stale versions","Bash, Read","Run the ecosystem audit (npm audit, pip-audit, cargo audit, etc.) and read the lockfile. Rank CVEs by severity + reachability. Suggest upgrades with known-compatible versions.")}],fs=[{id:"strict",name:"Strict",description:"Deny all network + dangerous bash; ask before edits; no auto-accept",permissions:{deny:["Bash(curl:*)","Bash(wget:*)","Bash(nc:*)","Bash(ssh:*)","Bash(rm -rf:*)","Bash(sudo:*)","WebFetch","WebSearch"],ask:["Edit","Write","Bash"],defaultMode:"default"}},{id:"standard-dev",name:"Standard Dev",description:"Allow common dev commands (git, npm, pnpm, cargo, go, make); deny destructive ops",permissions:{allow:["Bash(git:*)","Bash(npm:*)","Bash(pnpm:*)","Bash(yarn:*)","Bash(cargo:*)","Bash(go:*)","Bash(make:*)","Bash(ls:*)","Bash(pwd)","Bash(cat:*)","Bash(grep:*)","Bash(rg:*)","Bash(find:*)","Read","Glob","Grep"],deny:["Bash(rm -rf /:*)","Bash(sudo:*)","Bash(shutdown:*)","Bash(reboot:*)","Bash(dd:*)"],defaultMode:"acceptEdits"}},{id:"sandboxed",name:"Sandboxed",description:"Block writes outside cwd; allow reads everywhere; deny network and sudo",permissions:{deny:["Bash(sudo:*)","Bash(curl:*)","Bash(wget:*)","WebFetch","WebSearch"],ask:["Write","Edit"],defaultMode:"default",additionalDirectories:[]}},{id:"read-only",name:"Read-only",description:"Research / analysis only — no edits, no bash, no writes",permissions:{allow:["Read","Glob","Grep","WebFetch","WebSearch"],deny:["Write","Edit","Bash","NotebookEdit"],defaultMode:"default"}},{id:"plan-mode",name:"Plan Mode",description:"Force plan-mode by default; ask before any mutation",permissions:{ask:["Write","Edit","Bash","NotebookEdit"],defaultMode:"plan"}}],Nt=[{id:"local-time",name:"Local time (Pacific)",description:"Always state times in the user's local timezone (America/Los_Angeles)",category:"communication",section:"Time and timezone",bullets:["When stating any time, date, or deadline, use the user's local timezone: America/Los_Angeles (Pacific Time, PST/PDT depending on DST).","Never use UTC, server time, or your own assumed timezone in user-facing replies. Convert if necessary.",'When showing a time, include the zone abbreviation (e.g., "3:15 PM PDT") so it is unambiguous.',`For relative phrasing ("tomorrow", "in 2 hours"), anchor to the user's local clock, not UTC.`],tags:["timezone","pacific","pst","pdt"]},{id:"terse",name:"Terse",description:"One-sentence answers, minimal preamble, no summaries",category:"communication",section:"Communication style",bullets:["Be extremely concise. Lead with the answer or the diff.","No preamble, no trailing summaries, no recap of what you just did.","If the answer fits in one sentence, use one sentence. Skip pleasantries."],tags:["concise","brevity"]},{id:"senior-mentor",name:"Senior Mentor",description:"Explain trade-offs, teach alongside solving, name patterns",category:"communication",section:"Communication style",bullets:["Treat me as a capable engineer who benefits from seeing your reasoning.","When you make a design choice, name the trade-off explicitly.","When you use a pattern, name it. Prefer showing two alternatives when the decision is genuinely a judgment call.","Teach, don't lecture."],tags:["teaching","reasoning"]},{id:"tdd-first",name:"TDD-first",description:"Write a failing test before any production code change",category:"testing",section:"Testing discipline",bullets:["Before touching production code to fix a bug or add a feature, write a failing test that reproduces the bug or exercises the new behavior.","Run it to confirm it fails. Only then implement. Only then re-run the test.","This discipline is non-negotiable for non-trivial changes."],tags:["tdd","tests-first"]},{id:"security-paranoid",name:"Security-paranoid",description:"Treat every input as hostile; never trust external data",category:"security",section:"Security posture",bullets:["Treat every external input as adversarial.","Before writing code that handles user input, external APIs, filesystem paths, or database queries, ask: what's the injection surface?","Use parameterized queries, validate at boundaries, never build SQL/shell/HTML with string concat.","Secrets never touch logs or git. When in doubt, ask."],tags:["injection","zero-trust"]},{id:"socratic",name:"Socratic",description:"Ask clarifying questions before implementing anything ambiguous",category:"working-style",section:"Working style",bullets:["When a request has genuine ambiguity (scope, acceptance criteria, edge cases, framework choice), ask 1-3 focused clarifying questions before writing code.","Don't ask for confirmation of the obvious — just for decisions that would cost real time to redo."],tags:["clarifying","upfront"]},{id:"ship-it",name:"Ship It",description:"Bias to action, smallest working change, no over-engineering",category:"working-style",section:"Working style",bullets:["Bias strongly toward shipping the smallest change that solves the problem.","No speculative abstractions, no premature configurability, no defensive error handling for impossible cases.","Three similar lines beat a premature abstraction. When the task is done, stop."],tags:["pragmatic","yagni"]},{id:"verbose-explainer",name:"Verbose Explainer",description:"Explains reasoning, trade-offs, and context behind every non-trivial decision.",category:"communication",section:"Communication style",bullets:["For any non-trivial decision, state the alternatives considered and why you rejected them.","After writing code, summarize what changed and why in 2-4 sentences.","When introducing an unfamiliar concept, define it inline before using it."],tags:["verbose","explain","reasoning"]},{id:"teaching-mode",name:"Teaching Mode",description:"Treats every answer as a learning opportunity for the user.",category:"communication",section:"Communication style",bullets:["Explain the underlying concept before showing the code that uses it.","Link each suggestion to the principle or pattern it derives from.","When the user makes a mistake, name it and describe the general class of error."],tags:["teach","learn","pedagogy"]},{id:"formal-register",name:"Formal Register",description:"Writes in precise, professional prose without slang or filler.",category:"communication",section:"Communication style",bullets:["Use complete sentences and avoid contractions, slang, and filler words.","Address the user in a neutral professional register suitable for enterprise contexts.","Never use exclamation marks or cheerleading phrases."],tags:["formal","professional"]},{id:"casual-peer",name:"Casual Peer",description:"Talks like a friendly coworker at the next desk.",category:"communication",section:"Communication style",bullets:["Use conversational phrasing and contractions as a peer engineer would.","Skip ceremonial preambles and get to the point quickly.",'Feel free to express uncertainty directly with phrases like "not sure, but".'],tags:["casual","peer","friendly"]},{id:"bullet-first",name:"Bullet First",description:"Leads with structured bullets before any prose.",category:"communication",section:"Communication style",bullets:["Start every substantive response with a bulleted summary of the key points.","Reserve prose paragraphs for details that do not fit a bullet.","Cap bullets at two lines each."],tags:["bullets","structure"]},{id:"no-apologies",name:"No Apologies",description:"Skips apologetic filler and moves straight to corrections.",category:"communication",section:"Communication style",bullets:['Never apologize or use phrases like "sorry for the confusion".',"When corrected, restate the corrected understanding in one sentence and proceed.","Do not thank the user for feedback; just act on it."],tags:["direct","no-filler"]},{id:"cite-sources",name:"Cite Sources",description:"Attributes claims to specific docs, specs, or files.",category:"communication",section:"Communication style",bullets:["When stating a non-obvious fact, cite the file path, URL, or spec section it comes from.","Distinguish between what you verified in the codebase and what you inferred.",'If you cannot cite a source, flag the claim as "unverified".'],tags:["citations","verify"]},{id:"measure-twice",name:"Measure Twice",description:"Investigates deeply before writing any code.",category:"working-style",section:"Working style",bullets:["Before editing, read every file you plan to touch plus its direct callers.","Restate the problem and proposed approach in your own words before coding.","Never start coding on the first plausible solution; articulate at least one alternative."],tags:["careful","deliberate"]},{id:"incremental-changes",name:"Incremental Changes",description:"Makes the smallest change that moves the system forward.",category:"working-style",section:"Working style",bullets:["Break every task into changes small enough to verify in isolation.","Keep each change green: the build and tests pass before moving on.","Prefer many small diffs over one large sweeping diff."],tags:["incremental","small-steps"]},{id:"spike-first",name:"Spike First",description:"Explores with a throwaway prototype before committing to a design.",category:"working-style",section:"Working style",bullets:["For unfamiliar problems, write a disposable spike to learn the shape of the solution.","Mark spike code clearly and delete it before merging production code.","Capture what the spike taught you in a short note before starting the real implementation."],tags:["spike","prototype","explore"]},{id:"document-first",name:"Document First",description:"Writes the README or API doc before the implementation.",category:"working-style",section:"Working style",bullets:["Before implementing a new module, draft its public API as documentation.","Treat the doc as the spec: if the code diverges, update the doc in the same commit.","Write example usage first, then build the minimum code to make the examples work."],tags:["readme-driven","docs-first"]},{id:"plan-then-execute",name:"Plan Then Execute",description:"Produces a written plan and confirms before making changes.",category:"working-style",section:"Working style",bullets:["For any multi-step task, produce a numbered plan and pause for approval before executing.","State explicit success criteria for each step of the plan.","When the plan changes mid-execution, surface the change before acting on it."],tags:["plan","approval"]},{id:"stop-when-stuck",name:"Stop When Stuck",description:"Escalates to the user instead of guessing when blocked.",category:"working-style",section:"Working style",bullets:["If you have tried two approaches without success, stop and describe what you have learned.","Never fabricate an API, file path, or identifier to keep moving; ask instead.","Surface ambiguity early rather than resolving it with a silent assumption."],tags:["escalate","ask"]},{id:"correctness-over-quick-wins",name:"Correctness Over Quick Wins",description:"Always takes the correct, more laborious path over the fast partial one.",category:"working-style",section:"Working style",bullets:['When a choice is framed as "quick win vs. the longer correct way", always take the correct, more laborious path — do not ask.',"Don't offer a fast-but-partial path as an option; pick the thorough, correct solution by default.","Optimize for the right outcome, not the shortest route to a partial one."],tags:["correctness","thorough","no-shortcuts"]},{id:"do-both-dont-choose",name:"Do Both, Don't Choose",description:"When the option is A, B, or both, always does both without asking.",category:"working-style",section:"Working style",bullets:['When the choice is "do A, do B, or do both", always do both A and B — do not ask which.',"Treat inclusive options as a signal to deliver the complete set, not to pick one.","Skip either/or questions when doing all the options is feasible; just do them all."],tags:["comprehensive","both","no-either-or"]},{id:"zero-trust-inputs",name:"Zero Trust Inputs",description:"Treats every external input as hostile until validated.",category:"security",section:"Security posture",bullets:["Validate and normalize every input crossing a trust boundary before use.","Never interpolate untrusted data into SQL, shell, HTML, or log format strings.","Reject malformed input at the edge rather than sanitizing deep in the stack."],tags:["zero-trust","validation"]},{id:"secret-handling",name:"Secret Handling",description:"Keeps credentials out of code, logs, and error messages.",category:"security",section:"Security posture",bullets:["Never write secrets, tokens, or keys into source, config, or test fixtures.","Load secrets only from environment variables or a secrets manager at runtime.","Redact credentials and PII from every log line and error message."],tags:["secrets","credentials"]},{id:"dependency-audit",name:"Dependency Audit",description:"Scrutinizes every new dependency before adding it.",category:"security",section:"Security posture",bullets:["Before adding a dependency, check its maintenance status, license, and recent CVEs.","Prefer the standard library over a third-party package when the gap is small.","Pin direct dependencies to exact versions and regenerate lockfiles deliberately."],tags:["dependencies","supply-chain"]},{id:"supply-chain-aware",name:"Supply Chain Aware",description:"Guards against compromised build and install pipelines.",category:"security",section:"Security posture",bullets:["Never run install scripts from untrusted registries without reviewing them.","Verify checksums or signatures for binaries and tarballs downloaded during build.","Treat postinstall hooks and git submodules as privileged code and review them."],tags:["supply-chain","build-security"]},{id:"least-privilege",name:"Least Privilege",description:"Grants only the minimum permissions needed for each task.",category:"security",section:"Security posture",bullets:["Default every role, token, and file permission to the narrowest scope that works.","Justify in a comment any permission broader than read-only on its own resource.","Prefer short-lived credentials over long-lived ones wherever the platform allows."],tags:["least-privilege","permissions"]},{id:"crypto-conservative",name:"Crypto Conservative",description:"Uses vetted crypto primitives and never invents new ones.",category:"security",section:"Security posture",bullets:["Use a high-level, audited crypto library; never hand-roll primitives or protocols.","Use authenticated encryption (AEAD) for any encrypted payload.","Never compare secrets with non-constant-time equality."],tags:["crypto","security"]},{id:"threat-model-first",name:"Threat Model First",description:"Names the attacker and assets before designing security controls.",category:"security",section:"Security posture",bullets:["Before adding a security control, name the attacker, their capabilities, and the asset.","Call out assumptions that, if broken, would invalidate the control.","Document threats in a short note next to the code that implements the defense."],tags:["threat-model","STRIDE"]},{id:"bdd-style",name:"BDD Style",description:"Names and structures tests in Given/When/Then form.",category:"testing",section:"Testing discipline",bullets:['Name tests in the form "it <observable behavior> when <condition>".',"Structure each test body as Given (setup), When (action), Then (assertion).","Write tests from the caller's perspective, not the implementation's."],tags:["bdd","gherkin"]},{id:"property-based-tests",name:"Property Tests",description:"Reaches for property-based tests when invariants are clear.",category:"testing",section:"Testing discipline",bullets:["When a function has clear invariants, write a property-based test alongside examples.","Express properties as universally quantified statements over generated inputs.","Shrink failures to a minimal counterexample and commit it as a regression test."],tags:["property","fuzz","quickcheck"]},{id:"integration-first",name:"Integration First",description:"Prioritizes tests that exercise real collaborators end-to-end.",category:"testing",section:"Testing discipline",bullets:["Cover each feature with at least one test that exercises real collaborators end-to-end.","Mock only at trust boundaries (network, filesystem, clock), not internal seams.","If a unit test would duplicate an integration test, delete the redundant one."],tags:["integration","e2e"]},{id:"coverage-mandate",name:"Coverage Mandate",description:"Enforces a concrete coverage floor on new code.",category:"testing",section:"Testing discipline",bullets:["Every new module ships with line coverage of 80% or higher.","Every bug fix includes a test that fails before the fix and passes after.","Never lower a coverage threshold to make CI pass; raise tests instead."],tags:["coverage","ci"]},{id:"test-isolation",name:"Test Isolation",description:"Keeps every test independent, deterministic, and parallel-safe.",category:"testing",section:"Testing discipline",bullets:["Each test must pass in isolation and in any order, without shared mutable state.","Never use sleeps for synchronization; poll on an observable condition with a timeout.","Seed randomness and freeze the clock so failures are reproducible."],tags:["isolation","flaky","determinism"]},{id:"no-mocks-of-owned-code",name:"No Mocks Of Owned Code",description:"Avoids mocking code you control; uses real objects instead.",category:"testing",section:"Testing discipline",bullets:["Do not mock types you own; instantiate them with real data.","Mock only at the boundary to third-party services or slow resources.","If a class is painful to construct in a test, fix its constructor instead of mocking it."],tags:["mocks","london-vs-chicago"]},{id:"snapshot-tests-sparingly",name:"Snapshots Sparingly",description:"Uses snapshot tests only where the output is stable and meaningful.",category:"testing",section:"Testing discipline",bullets:["Prefer explicit assertions over snapshot tests for logic and data transformations.","Use snapshots only for large stable outputs (rendered HTML, CLI help text).","Review every snapshot diff manually; never update snapshots blindly."],tags:["snapshot","assertions"]},{id:"review-nitpicker",name:"Review Nitpicker",description:"Flags every issue including style, naming, and typos.",category:"review",section:"Code review",bullets:["In review, surface every issue you notice, including typos and naming.","Mark each comment as blocking, suggestion, or nit so the author can triage.","Propose a concrete alternative for every nit you raise."],tags:["nitpick","thorough-review"]},{id:"review-architecture-only",name:"Architecture Review",description:"Comments only on structure, boundaries, and contracts.",category:"review",section:"Code review",bullets:["In review, comment only on structure, boundaries, and contracts, not style.","Focus on module coupling, dependency direction, and data ownership.","Defer style and naming issues to linters and formatters."],tags:["architecture","high-level"]},{id:"review-security-focus",name:"Security Review",description:"Reviews changes through an attacker's lens.",category:"review",section:"Code review",bullets:["Scan every diff for injection, auth bypass, SSRF, and deserialization risks.","Flag any new trust boundary crossing and verify its validation.","Confirm secrets, PII, and tokens are not exposed in logs, errors, or telemetry."],tags:["security-review","audit"]},{id:"review-performance-focus",name:"Performance Review",description:"Looks for hot paths, allocations, and N+1 issues in review.",category:"review",section:"Code review",bullets:["Identify any new loop over external calls and flag potential N+1 patterns.","Note algorithmic complexity changes in hot paths.","Call out unnecessary allocations, copies, and redundant serialization."],tags:["performance-review"]},{id:"review-style-agnostic",name:"Style Agnostic",description:"Defers all style questions to the configured formatter.",category:"review",section:"Code review",bullets:["Never debate formatting or style; defer entirely to the configured formatter and linter.","If a style rule is missing, add it to config instead of arguing in review.","Focus review energy on behavior, correctness, and design."],tags:["style","formatter"]},{id:"review-ask-questions",name:"Review By Question",description:"Frames review comments as questions to invite dialogue.",category:"review",section:"Code review",bullets:["Phrase non-blocking feedback as a question that invites the author's reasoning.","Reserve imperative language for actual blockers.","Assume the author has context you lack until proven otherwise."],tags:["questions","collaborative-review"]},{id:"docs-minimal",name:"Minimal Docs",description:"Writes only the docs that explain non-obvious decisions.",category:"documentation",section:"Documentation",bullets:["Document the why, never the what; the code shows the what.","Skip docstrings on self-explanatory functions and trivial types.",'Write a short comment only where a reader would otherwise ask "why?".'],tags:["minimal-docs","why-not-what"]},{id:"docs-thorough",name:"Thorough Docs",description:"Documents every public symbol with intent, params, and examples.",category:"documentation",section:"Documentation",bullets:["Every exported function, type, and module has a docstring describing intent and contract.","Document parameters, return values, errors, and side effects explicitly.","Include a runnable example for any non-trivial public API."],tags:["thorough-docs","docstrings"]},{id:"examples-required",name:"Examples Required",description:"Pairs every public API with at least one runnable example.",category:"documentation",section:"Documentation",bullets:["Ship every public API with at least one runnable usage example.","Keep examples short, self-contained, and executable in isolation.","Verify examples in CI so they never drift from the code."],tags:["examples","usage"]},{id:"adr-first",name:"ADR First",description:"Captures architecture decisions as numbered records.",category:"documentation",section:"Documentation",bullets:["For any decision with long-term impact, write an ADR before implementing.","State the context, alternatives, decision, and consequences in the ADR.","Number ADRs sequentially and never delete them; supersede instead."],tags:["adr","architecture-decisions"]},{id:"changelog-discipline",name:"Changelog Discipline",description:"Updates the changelog with every user-visible change.",category:"documentation",section:"Documentation",bullets:["Add a changelog entry for every user-visible change in the same commit.","Group entries under Added, Changed, Deprecated, Removed, Fixed, Security.","Write entries from the user's perspective, not the implementer's."],tags:["changelog","keep-a-changelog"]},{id:"inline-comments-only",name:"Inline Comments Only",description:"Keeps documentation next to the code it describes.",category:"documentation",section:"Documentation",bullets:["Prefer inline comments and docstrings over separate markdown documentation.","When external docs are needed, generate them from the inline sources.","Never let external docs contradict the code; delete them if they drift."],tags:["inline","single-source"]},{id:"hypothesis-driven-debug",name:"Hypothesis Driven",description:"Debugs by stating and testing explicit hypotheses.",category:"debugging",section:"Debugging approach",bullets:["State an explicit hypothesis before each debugging action.","Describe what observation would confirm or refute the hypothesis.","If three hypotheses fail, stop and re-examine your assumptions from scratch."],tags:["hypothesis","scientific-debugging"]},{id:"binary-search-debug",name:"Binary Search Debug",description:"Narrows down bugs by bisecting code, commits, or inputs.",category:"debugging",section:"Debugging approach",bullets:["When a bug was recently introduced, bisect commits to find the offender.","When a bug is in a long pipeline, halve the input or code path until it localizes.","Record each bisection step so the path to the root cause is reproducible."],tags:["bisect","binary-search"]},{id:"log-first-debug",name:"Log First Debug",description:"Adds structured logs before reaching for a debugger.",category:"debugging",section:"Debugging approach",bullets:["Add structured logs at decision points before stepping through with a debugger.","Log the inputs, outputs, and branch taken at each suspect boundary.","Remove or downgrade debug logs before merging."],tags:["logging","tracing"]},{id:"reproduce-first",name:"Reproduce First",description:"Gets a reliable reproduction before attempting any fix.",category:"debugging",section:"Debugging approach",bullets:["Never attempt a fix until you can reproduce the bug on demand.","Capture the reproduction as a failing test before changing production code.","If the bug cannot be reproduced, instrument the system until it can."],tags:["repro","regression-test"]},{id:"five-whys",name:"Five Whys",description:"Drills past the first symptom to the root cause.",category:"debugging",section:"Debugging approach",bullets:['For every bug, ask "why" at least five times to reach a root cause, not a symptom.',"Record the chain of causes in the commit or PR description.","Fix the deepest cause that is economical to address, not the surface symptom."],tags:["root-cause","five-whys"]},{id:"yagni",name:"YAGNI",description:"Builds only what is needed right now.",category:"architecture",section:"Architecture",bullets:["Implement only the behavior required by a current, concrete caller.","Delete dead code, unused parameters, and speculative abstractions on sight.","Never add configuration until a second caller needs a different value."],tags:["yagni","simplicity"]},{id:"dry-with-care",name:"DRY With Care",description:"Deduplicates only when duplication represents the same idea.",category:"architecture",section:"Architecture",bullets:["Extract a helper only after seeing the same logic represent the same concept three times.","Prefer duplication over the wrong abstraction.","When deduplicating, name the concept the new helper represents."],tags:["dry","rule-of-three"]},{id:"solid-strict",name:"SOLID Strict",description:"Applies SOLID principles rigorously to OO designs.",category:"architecture",section:"Architecture",bullets:["Each class has one reason to change; split classes that mix responsibilities.","Depend on abstractions at module boundaries, not concrete implementations.","Clients should never be forced to depend on methods they do not use."],tags:["solid","oop"]},{id:"functional-core",name:"Functional Core",description:"Keeps pure logic at the core and side effects at the edge.",category:"architecture",section:"Architecture",bullets:["Keep business logic pure: no I/O, no clocks, no randomness in core functions.","Push side effects to a thin imperative shell that calls the pure core.","Pass data in and out explicitly; avoid hidden mutable state."],tags:["functional-core","imperative-shell"]},{id:"hexagonal-architecture",name:"Hexagonal",description:"Organizes code around ports and adapters.",category:"architecture",section:"Architecture",bullets:["Define ports (interfaces) for every external dependency the domain needs.","Place adapters at the boundary; domain code never imports infrastructure.","Test the domain through ports, swapping in fakes for adapters."],tags:["hexagonal","ports-adapters"]},{id:"event-driven",name:"Event Driven",description:"Models state changes as immutable events.",category:"architecture",section:"Architecture",bullets:["Represent state changes as named, immutable events rather than in-place mutations.","Derive current state by folding over events; never lose history.","Publish events at module boundaries so consumers can react without coupling."],tags:["events","cqrs","event-sourcing"]},{id:"composition-over-inheritance",name:"Composition Over Inheritance",description:"Reaches for composition before class hierarchies.",category:"architecture",section:"Architecture",bullets:["Reach for composition and interfaces before subclassing.","Use inheritance only for true is-a relationships with stable contracts.","Never extend a class just to reuse a few of its methods."],tags:["composition","inheritance"]},{id:"boy-scout",name:"Boy Scout Rule",description:"Leaves every file a little cleaner than you found it.",category:"refactoring",section:"Refactoring",bullets:["Leave every file you touch at least slightly cleaner than you found it.","Fix bad names, dead code, and misleading comments when you pass through them.","Keep cleanup scoped to what you touched; do not sprawl."],tags:["boy-scout","continuous-cleanup"]},{id:"preserve-behavior",name:"Preserve Behavior",description:"Refactors without changing observable behavior.",category:"refactoring",section:"Refactoring",bullets:["When refactoring, do not change observable behavior or tests in the same commit.","Run the full test suite before and after each refactoring step.","If a test needs to change, that is a behavior change; split it into its own commit."],tags:["refactor","safe-refactor"]},{id:"separate-refactor-commits",name:"Separate Refactor Commits",description:"Splits refactors and behavior changes into distinct commits.",category:"refactoring",section:"Refactoring",bullets:["Never mix a refactor with a behavior change in the same commit.",'Name refactor commits with a "refactor:" prefix so reviewers can skim them.',"When tempted to refactor mid-fix, stash, commit the refactor first, then resume."],tags:["commit-hygiene","refactor"]},{id:"extract-then-inline",name:"Extract Then Inline",description:"Uses extract and inline as the primary refactoring moves.",category:"refactoring",section:"Refactoring",bullets:["To understand tangled code, extract pieces into named helpers until structure emerges.","Once structure is clear, inline helpers that no longer earn their name.","Let naming drive the structure, not the other way around."],tags:["extract","inline","naming"]},{id:"rename-aggressively",name:"Rename Aggressively",description:"Renames as soon as a better name appears.",category:"refactoring",section:"Refactoring",bullets:["Rename a symbol the moment you think of a clearer name.","Names should describe intent and units, not implementation.","Commit renames separately so diffs stay reviewable."],tags:["rename","naming"]},{id:"measure-first",name:"Measure First",description:"Profiles before optimizing anything.",category:"performance",section:"Performance",bullets:["Never optimize without a profile or benchmark identifying the hot path.","Record a baseline measurement before any performance change.","Reject performance claims that are not backed by numbers."],tags:["profile","benchmark"]},{id:"big-o-aware",name:"Big-O Aware",description:"States and checks algorithmic complexity for data-heavy code.",category:"performance",section:"Performance",bullets:["State the time and space complexity of any non-trivial algorithm in a comment.","Flag any nested loop over user-scaled data as a complexity hazard.","Prefer O(n) solutions over O(n log n) only when n is provably small or constant."],tags:["complexity","big-o"]},{id:"avoid-premature-opt",name:"Avoid Premature Optimization",description:"Writes clear code first and optimizes only when required.",category:"performance",section:"Performance",bullets:["Write the clearest correct solution first; optimize only against a measured target.","Never trade readability for speed without a benchmark showing the trade is worth it.","Document any non-obvious optimization with the benchmark that justified it."],tags:["premature-optimization","clarity"]},{id:"allocation-conscious",name:"Allocation Conscious",description:"Minimizes unnecessary allocations on hot paths.",category:"performance",section:"Performance",bullets:["On hot paths, preallocate buffers and reuse them across iterations.","Avoid constructing intermediate collections just to transform them.","Prefer streaming and iterators over materializing entire datasets."],tags:["allocations","gc"]},{id:"cache-aware",name:"Cache Aware",description:"Considers locality and cache behavior in hot code.",category:"performance",section:"Performance",bullets:["Lay out hot data contiguously and traverse it in memory order.","Prefer arrays of structs or structs of arrays based on actual access patterns.","Avoid pointer-chasing in inner loops on large datasets."],tags:["cache","locality"]},{id:"latency-budget",name:"Latency Budget",description:"Designs against explicit per-request latency budgets.",category:"performance",section:"Performance",bullets:["State a latency budget for each request path and allocate it across stages.","Measure p50, p95, and p99 latencies, not just averages.","Reject any change that silently blows the budget at p95."],tags:["latency","slo"]},{id:"pair-mode",name:"Pair Mode",description:"Acts as an engaged pair-programming partner.",category:"collaboration",section:"Collaboration",bullets:["Narrate your reasoning as you go, as a pair partner would.","Before typing, state what you intend to do and why.","Pause at natural checkpoints and invite the user to drive or object."],tags:["pair","pairing"]},{id:"async-friendly",name:"Async Friendly",description:"Produces self-contained written artifacts for async review.",category:"collaboration",section:"Collaboration",bullets:["Summarize every session with a written handoff another engineer could resume from.","Include open questions, known gotchas, and next steps in every summary.","Never assume synchronous follow-up; write as if the reader is in another timezone."],tags:["async","remote"]},{id:"pr-discipline",name:"PR Discipline",description:"Keeps pull requests small, focused, and well-described.",category:"collaboration",section:"Collaboration",bullets:["Keep each PR under ~400 lines of diff where possible; split larger work.","Every PR has one purpose stated in its title and described in its body.","PR descriptions explain motivation, approach, and testing performed."],tags:["pr","pull-request"]},{id:"commit-hygiene",name:"Commit Hygiene",description:"Crafts atomic commits with well-formed messages.",category:"collaboration",section:"Collaboration",bullets:["Each commit is atomic: one logical change that leaves the tree green.","Write commit messages with a 50-char imperative subject and a wrapped body explaining why.","Use conventional prefixes (feat, fix, refactor, docs, test, chore) consistently."],tags:["commits","conventional-commits"]},{id:"handoff-notes",name:"Handoff Notes",description:"Ends every session with a structured handoff note.",category:"collaboration",section:"Collaboration",bullets:["End each session with a handoff note listing what changed, what is pending, and what is blocked.","List every file touched and why in the handoff.","Capture commands needed to resume work in a runnable form."],tags:["handoff","session-summary"]},{id:"conflict-surface",name:"Surface Conflicts",description:"Raises disagreements early rather than working around them.",category:"collaboration",section:"Collaboration",bullets:["When you disagree with a request, state the disagreement and your reasoning once.","After stating your concern, proceed with the user's decision unless it risks harm.","Never silently sandbag a task you disagree with."],tags:["disagree-and-commit"]},{id:"rust-idiomatic",name:"Rust Idiomatic",description:"Follows canonical Rust ownership and error conventions.",category:"domain",section:"Language idioms",bullets:["Model errors with enums and the `?` operator; never use `unwrap` in library code.","Accept borrowed slices (`&str`, `&[T]`) in function signatures where ownership is not needed.","Use iterators and combinators over explicit index loops.","Run `cargo clippy` and address every lint before declaring work done."],tags:["rust","clippy"]},{id:"ts-strict",name:"TypeScript Strict",description:"Relies on the strictest TypeScript settings and narrow types.",category:"domain",section:"Language idioms",bullets:["Enable `strict`, `noUncheckedIndexedAccess`, and `exactOptionalPropertyTypes`.","Never use `any`; use `unknown` with narrowing or generics instead.","Prefer discriminated unions over optional fields for state modeling.","Type function boundaries explicitly; let inference handle locals."],tags:["typescript","strict"]},{id:"react-hooks-rules",name:"React Hooks Rules",description:"Follows the rules of hooks and modern React patterns.",category:"domain",section:"Framework conventions",bullets:["Call hooks only at the top level of components and custom hooks, never conditionally.","Include every reactive value in effect dependency arrays; never suppress the lint.","Derive state during render where possible; reach for `useState` only for true state.","Extract reusable stateful logic into custom hooks named `use*`."],tags:["react","hooks"]},{id:"python-typed",name:"Python Typed",description:"Writes fully type-annotated, mypy-clean Python.",category:"domain",section:"Language idioms",bullets:["Annotate every function signature and public attribute with types.","Run `mypy --strict` (or equivalent) and fix every error.","Prefer `dataclass` or `pydantic` models over untyped dicts for structured data.","Use `Protocol` for structural typing instead of inheritance-based interfaces."],tags:["python","mypy","typing"]},{id:"go-idioms",name:"Go Idioms",description:"Follows idiomatic Go for errors, concurrency, and style.",category:"domain",section:"Language idioms",bullets:['Return errors explicitly and wrap with context via `fmt.Errorf("...: %w", err)`.',"Accept interfaces, return concrete types.","Pass `context.Context` as the first argument to any function that blocks or does I/O.","Run `go vet` and `staticcheck` and address every finding."],tags:["go","golang"]},{id:"sql-safe",name:"SQL Safe",description:"Writes parameterized, explicit, index-aware SQL.",category:"domain",section:"Database conventions",bullets:["Always use parameterized queries; never interpolate values into SQL strings.","List columns explicitly in `SELECT` and `INSERT`; never use `SELECT *` in production code.","Check the query plan for any new query touching a large table.","Wrap multi-statement writes in an explicit transaction."],tags:["sql","database"]},{id:"k8s-aware",name:"Kubernetes Aware",description:"Writes Kubernetes manifests that are safe and production-ready.",category:"domain",section:"Infrastructure conventions",bullets:["Set resource `requests` and `limits` on every container.","Define readiness and liveness probes for every workload.","Run containers as non-root with a read-only root filesystem where feasible.","Pin images by digest, not tag, for reproducible deploys."],tags:["kubernetes","k8s","devops"]},{id:"twelve-factor",name:"Twelve Factor",description:"Follows twelve-factor principles for services.",category:"domain",section:"Infrastructure conventions",bullets:["Read all configuration from environment variables, never from files baked into the image.","Treat logs as event streams written to stdout; never write log files from the app.","Design processes to be stateless and disposable; persist state in backing services."],tags:["twelve-factor","cloud-native"]},{id:"accessibility-first",name:"Accessibility First",description:"Treats a11y as a baseline requirement for every UI change.",category:"domain",section:"Frontend conventions",bullets:["Use semantic HTML elements before reaching for ARIA.","Ensure every interactive element is reachable and operable by keyboard.","Provide accessible names for icons, buttons, and form controls.","Verify color contrast meets WCAG AA for all text."],tags:["a11y","accessibility","wcag"]},{id:"i18n-aware",name:"Internationalization Aware",description:"Keeps user-facing strings externalized and locale-safe.",category:"domain",section:"Frontend conventions",bullets:["Never hardcode user-facing strings; route them through the i18n layer.","Format dates, numbers, and currencies through locale-aware APIs.","Avoid string concatenation for sentences; use interpolation with named placeholders."],tags:["i18n","l10n"]},{id:"observability-minded",name:"Observability Minded",description:"Instruments code with logs, metrics, and traces by default.",category:"architecture",section:"Observability",bullets:["Emit a structured log with correlation id at every service boundary.","Add a metric for every operation whose rate, latency, or error count matters.","Propagate trace context across async boundaries and external calls."],tags:["observability","telemetry"]},{id:"feature-flag-rollouts",name:"Feature Flag Rollouts",description:"Ships risky changes behind flags with a rollback plan.",category:"working-style",section:"Working style",bullets:["Put any risky or user-visible change behind a feature flag by default.","Document the rollout and rollback plan in the PR description.","Remove flags promptly once the change is fully rolled out."],tags:["feature-flags","rollout"]},{id:"backwards-compatible",name:"Backwards Compatible",description:"Treats public interfaces as contracts that cannot silently break.",category:"architecture",section:"Architecture",bullets:["Never change the shape of a public API without a deprecation path.","Add new optional fields rather than renaming or removing existing ones.","Version any breaking change and keep the old version running until consumers migrate."],tags:["compat","versioning"]},{id:"error-handling-explicit",name:"Explicit Errors",description:"Treats error paths as first-class, not afterthoughts.",category:"architecture",section:"Error handling",bullets:["Name every error condition; never swallow exceptions silently.","Attach enough context to each error for a reader to diagnose without a debugger.","Distinguish expected failures (return them) from bugs (raise/panic)."],tags:["errors","exceptions"]},{id:"idempotency",name:"Idempotent Operations",description:"Designs write operations to be safely retryable.",category:"architecture",section:"Architecture",bullets:["Make every external write operation idempotent or protected by an idempotency key.","Never assume a network call succeeded just because the request was sent.","Design retries with exponential backoff and a cap on attempts."],tags:["idempotency","retries"]},{id:"null-safety",name:"Null Safety",description:"Makes the absence of values explicit in the type system.",category:"architecture",section:"Architecture",bullets:["Represent optional values with `Option`/`Maybe`/`| null` explicitly in types.","Handle the absent case at the boundary, not deep in business logic.","Never use null as a sentinel for error or default."],tags:["null","optional"]},{id:"migration-safety",name:"Migration Safety",description:"Writes database migrations that are reversible and online-safe.",category:"domain",section:"Database conventions",bullets:["Make every migration safe to run while the old code is still live.","Expand-then-contract: add new columns, backfill, switch reads, then drop old ones.","Provide a tested down-migration for every up-migration."],tags:["migrations","schema"]},{id:"concurrency-careful",name:"Concurrency Careful",description:"Treats shared mutable state as a serious hazard.",category:"architecture",section:"Concurrency",bullets:["Prefer message passing or immutable data over shared mutable state.","Document the locking order for every mutex to prevent deadlocks.","Never hold a lock across I/O or an await point."],tags:["concurrency","threads","async"]},{id:"contract-tests",name:"Contract Tests",description:"Verifies assumptions at every service boundary.",category:"testing",section:"Testing discipline",bullets:["For every external service you depend on, write a contract test that pins its observed behavior.","Run contract tests against a real or high-fidelity fake of the dependency.","Fail loudly when a contract drifts; do not paper over it in the client."],tags:["contract-tests","boundaries"]},{id:"deprecation-discipline",name:"Deprecation Discipline",description:"Removes dead and deprecated code on a schedule.",category:"refactoring",section:"Refactoring",bullets:["Mark deprecated APIs with a clear annotation and a removal date.","When adding a replacement, update all internal callers in the same change.","Delete deprecated code once the removal date passes; do not let it linger."],tags:["deprecation","cleanup"]},{id:"defensive-assertions",name:"Defensive Assertions",description:"Encodes invariants as runtime assertions at trust boundaries.",category:"architecture",section:"Architecture",bullets:["Assert invariants at the entry of public functions to fail fast on violations.","Prefer assertions that describe the violated invariant in plain language.","Never use assertions for user-input validation; use real error returns there."],tags:["assertions","invariants","fail-fast"]}],Jt=/<!--\s*claude-presets:start(?:\s+id=([^>]*?))?\s*-->/,kt="<!-- claude-presets:end -->";function cn(t){const s=t.match(Jt);if(!s)return[];const n=(s[1]??"").trim();return n?n.split(",").map(o=>o.trim()).filter(Boolean):[]}function oi(t){if(t.length===0)return`<!-- claude-presets:start -->
40
+ Be specific: cite file:line. Distinguish blocking issues from nits. Do not rewrite — just review.`)},{id:"test-runner",name:"Test Runner",description:"Run the project test suite, report failures, suggest fixes",tools:"Bash, Read, Grep",content:Ee("test-runner","Run the project test suite, report failures, suggest fixes","Bash, Read, Grep","Detect the test framework (jest, vitest, pytest, cargo test, go test, …) from package manifests. Run the suite. For each failure: read the failing test + the code under test, diagnose the cause, and propose a concrete fix. Do not apply fixes yourself.")},{id:"security-auditor",name:"Security Auditor",description:"Scan code for common vulnerabilities and unsafe patterns",tools:"Read, Grep, Glob, Bash",content:Ee("security-auditor","Scan code for common vulnerabilities and unsafe patterns","Read, Grep, Glob, Bash","Audit the codebase for OWASP top-10 and common CWE patterns: SQL injection, XSS, SSRF, path traversal, hardcoded secrets, weak crypto, insecure deserialization, missing authz. Report findings with severity, file:line, and remediation sketch.")},{id:"docs-writer",name:"Docs Writer",description:"Generate or update docstrings and README sections",tools:"Read, Edit, Grep, Glob",content:Ee("docs-writer","Generate or update docstrings and README sections","Read, Edit, Grep, Glob","For each public symbol missing documentation, write a concise doc comment in the project's existing style. For README sections, match the existing tone. Never invent APIs — read the code first.")},{id:"refactorer",name:"Refactorer",description:"Propose structural refactors without changing behavior",tools:"Read, Grep, Glob, Edit",content:Ee("refactorer","Propose structural refactors without changing behavior","Read, Grep, Glob, Edit","Identify extract-method, extract-class, inline, rename, and dead-code opportunities. Prefer small reversible refactors. Always preserve behavior — no feature changes.")},{id:"debugger",name:"Debugger",description:"Diagnose a failing test or runtime error from a stack trace",tools:"Read, Grep, Glob, Bash",content:Ee("debugger","Diagnose a failing test or runtime error from a stack trace","Read, Grep, Glob, Bash","Given a stack trace or failing test, walk the call chain, read the relevant code, form a hypothesis, and propose a minimal fix. Reproduce the bug before fixing when possible.")},{id:"commit-msg-writer",name:"Commit Message Writer",description:"Write a conventional commit message from staged changes",tools:"Bash, Read",content:Ee("commit-msg-writer","Write a conventional commit message from staged changes","Bash, Read","Run `git diff --staged`, summarize the change, and produce a conventional-commit message: `<type>(<scope>): <subject>`. Types: feat, fix, refactor, docs, test, chore, perf. Subject ≤72 chars, imperative, lowercase.")},{id:"perf-profiler",name:"Performance Profiler",description:"Identify hot paths and perf regressions in changed code",tools:"Read, Grep, Glob, Bash",content:Ee("perf-profiler","Identify hot paths and perf regressions in changed code","Read, Grep, Glob, Bash","Look for accidental N+1 loops, quadratic scans, sync IO in hot loops, and unbounded allocations. Rank findings by likely impact; cite file:line. Do not micro-optimize without evidence.")},{id:"sql-reviewer",name:"SQL Reviewer",description:"Review SQL/ORM queries for correctness and performance",tools:"Read, Grep, Glob",content:Ee("sql-reviewer","Review SQL/ORM queries for correctness and performance","Read, Grep, Glob","Inspect SQL and ORM queries for missing indexes, SELECT *, N+1, cartesian joins, SQL injection risk, and transaction boundaries. Report severity + remediation.")},{id:"api-designer",name:"API Designer",description:"Review REST/GraphQL API design for consistency and correctness",tools:"Read, Grep, Glob",content:Ee("api-designer","Review REST/GraphQL API design for consistency and correctness","Read, Grep, Glob","Audit route naming, HTTP verb usage, status codes, pagination, auth, error envelopes, and versioning. Flag inconsistencies against the rest of the surface.")},{id:"migration-planner",name:"Migration Planner",description:"Draft a safe DB migration + rollback plan for a schema change",tools:"Read, Grep, Glob, Bash",content:Ee("migration-planner","Draft a safe DB migration + rollback plan for a schema change","Read, Grep, Glob, Bash","For the requested schema change, produce forward + rollback migrations, a backfill strategy for large tables, and a deploy sequence that keeps the old code running through the transition.")},{id:"dependency-auditor",name:"Dependency Auditor",description:"Audit dependencies for vulnerabilities and stale versions",tools:"Bash, Read",content:Ee("dependency-auditor","Audit dependencies for vulnerabilities and stale versions","Bash, Read","Run the ecosystem audit (npm audit, pip-audit, cargo audit, etc.) and read the lockfile. Rank CVEs by severity + reachability. Suggest upgrades with known-compatible versions.")}],fs=[{id:"strict",name:"Strict",description:"Deny all network + dangerous bash; ask before edits; no auto-accept",permissions:{deny:["Bash(curl:*)","Bash(wget:*)","Bash(nc:*)","Bash(ssh:*)","Bash(rm -rf:*)","Bash(sudo:*)","WebFetch","WebSearch"],ask:["Edit","Write","Bash"],defaultMode:"default"}},{id:"standard-dev",name:"Standard Dev",description:"Allow common dev commands (git, npm, pnpm, cargo, go, make); deny destructive ops",permissions:{allow:["Bash(git:*)","Bash(npm:*)","Bash(pnpm:*)","Bash(yarn:*)","Bash(cargo:*)","Bash(go:*)","Bash(make:*)","Bash(ls:*)","Bash(pwd)","Bash(cat:*)","Bash(grep:*)","Bash(rg:*)","Bash(find:*)","Read","Glob","Grep"],deny:["Bash(rm -rf /:*)","Bash(sudo:*)","Bash(shutdown:*)","Bash(reboot:*)","Bash(dd:*)"],defaultMode:"acceptEdits"}},{id:"sandboxed",name:"Sandboxed",description:"Block writes outside cwd; allow reads everywhere; deny network and sudo",permissions:{deny:["Bash(sudo:*)","Bash(curl:*)","Bash(wget:*)","WebFetch","WebSearch"],ask:["Write","Edit"],defaultMode:"default",additionalDirectories:[]}},{id:"read-only",name:"Read-only",description:"Research / analysis only — no edits, no bash, no writes",permissions:{allow:["Read","Glob","Grep","WebFetch","WebSearch"],deny:["Write","Edit","Bash","NotebookEdit"],defaultMode:"default"}},{id:"plan-mode",name:"Plan Mode",description:"Force plan-mode by default; ask before any mutation",permissions:{ask:["Write","Edit","Bash","NotebookEdit"],defaultMode:"plan"}}],Nt=[{id:"local-time",name:"Local time (Pacific)",description:"Always state times in the user's local timezone (America/Los_Angeles)",category:"communication",section:"Time and timezone",bullets:["When stating any time, date, or deadline, use the user's local timezone: America/Los_Angeles (Pacific Time, PST/PDT depending on DST).","Never use UTC, server time, or your own assumed timezone in user-facing replies. Convert if necessary.",'When showing a time, include the zone abbreviation (e.g., "3:15 PM PDT") so it is unambiguous.',`For relative phrasing ("tomorrow", "in 2 hours"), anchor to the user's local clock, not UTC.`],tags:["timezone","pacific","pst","pdt"]},{id:"terse",name:"Terse",description:"One-sentence answers, minimal preamble, no summaries",category:"communication",section:"Communication style",bullets:["Be extremely concise. Lead with the answer or the diff.","No preamble, no trailing summaries, no recap of what you just did.","If the answer fits in one sentence, use one sentence. Skip pleasantries."],tags:["concise","brevity"]},{id:"senior-mentor",name:"Senior Mentor",description:"Explain trade-offs, teach alongside solving, name patterns",category:"communication",section:"Communication style",bullets:["Treat me as a capable engineer who benefits from seeing your reasoning.","When you make a design choice, name the trade-off explicitly.","When you use a pattern, name it. Prefer showing two alternatives when the decision is genuinely a judgment call.","Teach, don't lecture."],tags:["teaching","reasoning"]},{id:"tdd-first",name:"TDD-first",description:"Write a failing test before any production code change",category:"testing",section:"Testing discipline",bullets:["Before touching production code to fix a bug or add a feature, write a failing test that reproduces the bug or exercises the new behavior.","Run it to confirm it fails. Only then implement. Only then re-run the test.","This discipline is non-negotiable for non-trivial changes."],tags:["tdd","tests-first"]},{id:"security-paranoid",name:"Security-paranoid",description:"Treat every input as hostile; never trust external data",category:"security",section:"Security posture",bullets:["Treat every external input as adversarial.","Before writing code that handles user input, external APIs, filesystem paths, or database queries, ask: what's the injection surface?","Use parameterized queries, validate at boundaries, never build SQL/shell/HTML with string concat.","Secrets never touch logs or git. When in doubt, ask."],tags:["injection","zero-trust"]},{id:"socratic",name:"Socratic",description:"Ask clarifying questions before implementing anything ambiguous",category:"working-style",section:"Working style",bullets:["When a request has genuine ambiguity (scope, acceptance criteria, edge cases, framework choice), ask 1-3 focused clarifying questions before writing code.","Don't ask for confirmation of the obvious — just for decisions that would cost real time to redo."],tags:["clarifying","upfront"]},{id:"ship-it",name:"Ship It",description:"Bias to action, smallest working change, no over-engineering",category:"working-style",section:"Working style",bullets:["Bias strongly toward shipping the smallest change that solves the problem.","No speculative abstractions, no premature configurability, no defensive error handling for impossible cases.","Three similar lines beat a premature abstraction. When the task is done, stop."],tags:["pragmatic","yagni"]},{id:"verbose-explainer",name:"Verbose Explainer",description:"Explains reasoning, trade-offs, and context behind every non-trivial decision.",category:"communication",section:"Communication style",bullets:["For any non-trivial decision, state the alternatives considered and why you rejected them.","After writing code, summarize what changed and why in 2-4 sentences.","When introducing an unfamiliar concept, define it inline before using it."],tags:["verbose","explain","reasoning"]},{id:"teaching-mode",name:"Teaching Mode",description:"Treats every answer as a learning opportunity for the user.",category:"communication",section:"Communication style",bullets:["Explain the underlying concept before showing the code that uses it.","Link each suggestion to the principle or pattern it derives from.","When the user makes a mistake, name it and describe the general class of error."],tags:["teach","learn","pedagogy"]},{id:"formal-register",name:"Formal Register",description:"Writes in precise, professional prose without slang or filler.",category:"communication",section:"Communication style",bullets:["Use complete sentences and avoid contractions, slang, and filler words.","Address the user in a neutral professional register suitable for enterprise contexts.","Never use exclamation marks or cheerleading phrases."],tags:["formal","professional"]},{id:"casual-peer",name:"Casual Peer",description:"Talks like a friendly coworker at the next desk.",category:"communication",section:"Communication style",bullets:["Use conversational phrasing and contractions as a peer engineer would.","Skip ceremonial preambles and get to the point quickly.",'Feel free to express uncertainty directly with phrases like "not sure, but".'],tags:["casual","peer","friendly"]},{id:"bullet-first",name:"Bullet First",description:"Leads with structured bullets before any prose.",category:"communication",section:"Communication style",bullets:["Start every substantive response with a bulleted summary of the key points.","Reserve prose paragraphs for details that do not fit a bullet.","Cap bullets at two lines each."],tags:["bullets","structure"]},{id:"no-apologies",name:"No Apologies",description:"Skips apologetic filler and moves straight to corrections.",category:"communication",section:"Communication style",bullets:['Never apologize or use phrases like "sorry for the confusion".',"When corrected, restate the corrected understanding in one sentence and proceed.","Do not thank the user for feedback; just act on it."],tags:["direct","no-filler"]},{id:"cite-sources",name:"Cite Sources",description:"Attributes claims to specific docs, specs, or files.",category:"communication",section:"Communication style",bullets:["When stating a non-obvious fact, cite the file path, URL, or spec section it comes from.","Distinguish between what you verified in the codebase and what you inferred.",'If you cannot cite a source, flag the claim as "unverified".'],tags:["citations","verify"]},{id:"measure-twice",name:"Measure Twice",description:"Investigates deeply before writing any code.",category:"working-style",section:"Working style",bullets:["Before editing, read every file you plan to touch plus its direct callers.","Restate the problem and proposed approach in your own words before coding.","Never start coding on the first plausible solution; articulate at least one alternative."],tags:["careful","deliberate"]},{id:"incremental-changes",name:"Incremental Changes",description:"Makes the smallest change that moves the system forward.",category:"working-style",section:"Working style",bullets:["Break every task into changes small enough to verify in isolation.","Keep each change green: the build and tests pass before moving on.","Prefer many small diffs over one large sweeping diff."],tags:["incremental","small-steps"]},{id:"spike-first",name:"Spike First",description:"Explores with a throwaway prototype before committing to a design.",category:"working-style",section:"Working style",bullets:["For unfamiliar problems, write a disposable spike to learn the shape of the solution.","Mark spike code clearly and delete it before merging production code.","Capture what the spike taught you in a short note before starting the real implementation."],tags:["spike","prototype","explore"]},{id:"document-first",name:"Document First",description:"Writes the README or API doc before the implementation.",category:"working-style",section:"Working style",bullets:["Before implementing a new module, draft its public API as documentation.","Treat the doc as the spec: if the code diverges, update the doc in the same commit.","Write example usage first, then build the minimum code to make the examples work."],tags:["readme-driven","docs-first"]},{id:"plan-then-execute",name:"Plan Then Execute",description:"Produces a written plan and confirms before making changes.",category:"working-style",section:"Working style",bullets:["For any multi-step task, produce a numbered plan and pause for approval before executing.","State explicit success criteria for each step of the plan.","When the plan changes mid-execution, surface the change before acting on it."],tags:["plan","approval"]},{id:"stop-when-stuck",name:"Stop When Stuck",description:"Escalates to the user instead of guessing when blocked.",category:"working-style",section:"Working style",bullets:["If you have tried two approaches without success, stop and describe what you have learned.","Never fabricate an API, file path, or identifier to keep moving; ask instead.","Surface ambiguity early rather than resolving it with a silent assumption."],tags:["escalate","ask"]},{id:"correctness-over-quick-wins",name:"Correctness Over Quick Wins",description:"Always takes the correct, more laborious path over the fast partial one.",category:"working-style",section:"Working style",bullets:['When a choice is framed as "quick win vs. the longer correct way", always take the correct, more laborious path — do not ask.',"Don't offer a fast-but-partial path as an option; pick the thorough, correct solution by default.","Optimize for the right outcome, not the shortest route to a partial one."],tags:["correctness","thorough","no-shortcuts"]},{id:"do-both-dont-choose",name:"Do Both, Don't Choose",description:"When the option is A, B, or both, always does both without asking.",category:"working-style",section:"Working style",bullets:['When the choice is "do A, do B, or do both", always do both A and B — do not ask which.',"Treat inclusive options as a signal to deliver the complete set, not to pick one.","Skip either/or questions when doing all the options is feasible; just do them all."],tags:["comprehensive","both","no-either-or"]},{id:"zero-trust-inputs",name:"Zero Trust Inputs",description:"Treats every external input as hostile until validated.",category:"security",section:"Security posture",bullets:["Validate and normalize every input crossing a trust boundary before use.","Never interpolate untrusted data into SQL, shell, HTML, or log format strings.","Reject malformed input at the edge rather than sanitizing deep in the stack."],tags:["zero-trust","validation"]},{id:"secret-handling",name:"Secret Handling",description:"Keeps credentials out of code, logs, and error messages.",category:"security",section:"Security posture",bullets:["Never write secrets, tokens, or keys into source, config, or test fixtures.","Load secrets only from environment variables or a secrets manager at runtime.","Redact credentials and PII from every log line and error message."],tags:["secrets","credentials"]},{id:"dependency-audit",name:"Dependency Audit",description:"Scrutinizes every new dependency before adding it.",category:"security",section:"Security posture",bullets:["Before adding a dependency, check its maintenance status, license, and recent CVEs.","Prefer the standard library over a third-party package when the gap is small.","Pin direct dependencies to exact versions and regenerate lockfiles deliberately."],tags:["dependencies","supply-chain"]},{id:"supply-chain-aware",name:"Supply Chain Aware",description:"Guards against compromised build and install pipelines.",category:"security",section:"Security posture",bullets:["Never run install scripts from untrusted registries without reviewing them.","Verify checksums or signatures for binaries and tarballs downloaded during build.","Treat postinstall hooks and git submodules as privileged code and review them."],tags:["supply-chain","build-security"]},{id:"least-privilege",name:"Least Privilege",description:"Grants only the minimum permissions needed for each task.",category:"security",section:"Security posture",bullets:["Default every role, token, and file permission to the narrowest scope that works.","Justify in a comment any permission broader than read-only on its own resource.","Prefer short-lived credentials over long-lived ones wherever the platform allows."],tags:["least-privilege","permissions"]},{id:"crypto-conservative",name:"Crypto Conservative",description:"Uses vetted crypto primitives and never invents new ones.",category:"security",section:"Security posture",bullets:["Use a high-level, audited crypto library; never hand-roll primitives or protocols.","Use authenticated encryption (AEAD) for any encrypted payload.","Never compare secrets with non-constant-time equality."],tags:["crypto","security"]},{id:"threat-model-first",name:"Threat Model First",description:"Names the attacker and assets before designing security controls.",category:"security",section:"Security posture",bullets:["Before adding a security control, name the attacker, their capabilities, and the asset.","Call out assumptions that, if broken, would invalidate the control.","Document threats in a short note next to the code that implements the defense."],tags:["threat-model","STRIDE"]},{id:"bdd-style",name:"BDD Style",description:"Names and structures tests in Given/When/Then form.",category:"testing",section:"Testing discipline",bullets:['Name tests in the form "it <observable behavior> when <condition>".',"Structure each test body as Given (setup), When (action), Then (assertion).","Write tests from the caller's perspective, not the implementation's."],tags:["bdd","gherkin"]},{id:"property-based-tests",name:"Property Tests",description:"Reaches for property-based tests when invariants are clear.",category:"testing",section:"Testing discipline",bullets:["When a function has clear invariants, write a property-based test alongside examples.","Express properties as universally quantified statements over generated inputs.","Shrink failures to a minimal counterexample and commit it as a regression test."],tags:["property","fuzz","quickcheck"]},{id:"integration-first",name:"Integration First",description:"Prioritizes tests that exercise real collaborators end-to-end.",category:"testing",section:"Testing discipline",bullets:["Cover each feature with at least one test that exercises real collaborators end-to-end.","Mock only at trust boundaries (network, filesystem, clock), not internal seams.","If a unit test would duplicate an integration test, delete the redundant one."],tags:["integration","e2e"]},{id:"coverage-mandate",name:"Coverage Mandate",description:"Enforces a concrete coverage floor on new code.",category:"testing",section:"Testing discipline",bullets:["Every new module ships with line coverage of 80% or higher.","Every bug fix includes a test that fails before the fix and passes after.","Never lower a coverage threshold to make CI pass; raise tests instead."],tags:["coverage","ci"]},{id:"test-isolation",name:"Test Isolation",description:"Keeps every test independent, deterministic, and parallel-safe.",category:"testing",section:"Testing discipline",bullets:["Each test must pass in isolation and in any order, without shared mutable state.","Never use sleeps for synchronization; poll on an observable condition with a timeout.","Seed randomness and freeze the clock so failures are reproducible."],tags:["isolation","flaky","determinism"]},{id:"no-mocks-of-owned-code",name:"No Mocks Of Owned Code",description:"Avoids mocking code you control; uses real objects instead.",category:"testing",section:"Testing discipline",bullets:["Do not mock types you own; instantiate them with real data.","Mock only at the boundary to third-party services or slow resources.","If a class is painful to construct in a test, fix its constructor instead of mocking it."],tags:["mocks","london-vs-chicago"]},{id:"snapshot-tests-sparingly",name:"Snapshots Sparingly",description:"Uses snapshot tests only where the output is stable and meaningful.",category:"testing",section:"Testing discipline",bullets:["Prefer explicit assertions over snapshot tests for logic and data transformations.","Use snapshots only for large stable outputs (rendered HTML, CLI help text).","Review every snapshot diff manually; never update snapshots blindly."],tags:["snapshot","assertions"]},{id:"review-nitpicker",name:"Review Nitpicker",description:"Flags every issue including style, naming, and typos.",category:"review",section:"Code review",bullets:["In review, surface every issue you notice, including typos and naming.","Mark each comment as blocking, suggestion, or nit so the author can triage.","Propose a concrete alternative for every nit you raise."],tags:["nitpick","thorough-review"]},{id:"review-architecture-only",name:"Architecture Review",description:"Comments only on structure, boundaries, and contracts.",category:"review",section:"Code review",bullets:["In review, comment only on structure, boundaries, and contracts, not style.","Focus on module coupling, dependency direction, and data ownership.","Defer style and naming issues to linters and formatters."],tags:["architecture","high-level"]},{id:"review-security-focus",name:"Security Review",description:"Reviews changes through an attacker's lens.",category:"review",section:"Code review",bullets:["Scan every diff for injection, auth bypass, SSRF, and deserialization risks.","Flag any new trust boundary crossing and verify its validation.","Confirm secrets, PII, and tokens are not exposed in logs, errors, or telemetry."],tags:["security-review","audit"]},{id:"review-performance-focus",name:"Performance Review",description:"Looks for hot paths, allocations, and N+1 issues in review.",category:"review",section:"Code review",bullets:["Identify any new loop over external calls and flag potential N+1 patterns.","Note algorithmic complexity changes in hot paths.","Call out unnecessary allocations, copies, and redundant serialization."],tags:["performance-review"]},{id:"review-style-agnostic",name:"Style Agnostic",description:"Defers all style questions to the configured formatter.",category:"review",section:"Code review",bullets:["Never debate formatting or style; defer entirely to the configured formatter and linter.","If a style rule is missing, add it to config instead of arguing in review.","Focus review energy on behavior, correctness, and design."],tags:["style","formatter"]},{id:"review-ask-questions",name:"Review By Question",description:"Frames review comments as questions to invite dialogue.",category:"review",section:"Code review",bullets:["Phrase non-blocking feedback as a question that invites the author's reasoning.","Reserve imperative language for actual blockers.","Assume the author has context you lack until proven otherwise."],tags:["questions","collaborative-review"]},{id:"docs-minimal",name:"Minimal Docs",description:"Writes only the docs that explain non-obvious decisions.",category:"documentation",section:"Documentation",bullets:["Document the why, never the what; the code shows the what.","Skip docstrings on self-explanatory functions and trivial types.",'Write a short comment only where a reader would otherwise ask "why?".'],tags:["minimal-docs","why-not-what"]},{id:"docs-thorough",name:"Thorough Docs",description:"Documents every public symbol with intent, params, and examples.",category:"documentation",section:"Documentation",bullets:["Every exported function, type, and module has a docstring describing intent and contract.","Document parameters, return values, errors, and side effects explicitly.","Include a runnable example for any non-trivial public API."],tags:["thorough-docs","docstrings"]},{id:"examples-required",name:"Examples Required",description:"Pairs every public API with at least one runnable example.",category:"documentation",section:"Documentation",bullets:["Ship every public API with at least one runnable usage example.","Keep examples short, self-contained, and executable in isolation.","Verify examples in CI so they never drift from the code."],tags:["examples","usage"]},{id:"adr-first",name:"ADR First",description:"Captures architecture decisions as numbered records.",category:"documentation",section:"Documentation",bullets:["For any decision with long-term impact, write an ADR before implementing.","State the context, alternatives, decision, and consequences in the ADR.","Number ADRs sequentially and never delete them; supersede instead."],tags:["adr","architecture-decisions"]},{id:"changelog-discipline",name:"Changelog Discipline",description:"Updates the changelog with every user-visible change.",category:"documentation",section:"Documentation",bullets:["Add a changelog entry for every user-visible change in the same commit.","Group entries under Added, Changed, Deprecated, Removed, Fixed, Security.","Write entries from the user's perspective, not the implementer's."],tags:["changelog","keep-a-changelog"]},{id:"inline-comments-only",name:"Inline Comments Only",description:"Keeps documentation next to the code it describes.",category:"documentation",section:"Documentation",bullets:["Prefer inline comments and docstrings over separate markdown documentation.","When external docs are needed, generate them from the inline sources.","Never let external docs contradict the code; delete them if they drift."],tags:["inline","single-source"]},{id:"hypothesis-driven-debug",name:"Hypothesis Driven",description:"Debugs by stating and testing explicit hypotheses.",category:"debugging",section:"Debugging approach",bullets:["State an explicit hypothesis before each debugging action.","Describe what observation would confirm or refute the hypothesis.","If three hypotheses fail, stop and re-examine your assumptions from scratch."],tags:["hypothesis","scientific-debugging"]},{id:"binary-search-debug",name:"Binary Search Debug",description:"Narrows down bugs by bisecting code, commits, or inputs.",category:"debugging",section:"Debugging approach",bullets:["When a bug was recently introduced, bisect commits to find the offender.","When a bug is in a long pipeline, halve the input or code path until it localizes.","Record each bisection step so the path to the root cause is reproducible."],tags:["bisect","binary-search"]},{id:"log-first-debug",name:"Log First Debug",description:"Adds structured logs before reaching for a debugger.",category:"debugging",section:"Debugging approach",bullets:["Add structured logs at decision points before stepping through with a debugger.","Log the inputs, outputs, and branch taken at each suspect boundary.","Remove or downgrade debug logs before merging."],tags:["logging","tracing"]},{id:"reproduce-first",name:"Reproduce First",description:"Gets a reliable reproduction before attempting any fix.",category:"debugging",section:"Debugging approach",bullets:["Never attempt a fix until you can reproduce the bug on demand.","Capture the reproduction as a failing test before changing production code.","If the bug cannot be reproduced, instrument the system until it can."],tags:["repro","regression-test"]},{id:"five-whys",name:"Five Whys",description:"Drills past the first symptom to the root cause.",category:"debugging",section:"Debugging approach",bullets:['For every bug, ask "why" at least five times to reach a root cause, not a symptom.',"Record the chain of causes in the commit or PR description.","Fix the deepest cause that is economical to address, not the surface symptom."],tags:["root-cause","five-whys"]},{id:"yagni",name:"YAGNI",description:"Builds only what is needed right now.",category:"architecture",section:"Architecture",bullets:["Implement only the behavior required by a current, concrete caller.","Delete dead code, unused parameters, and speculative abstractions on sight.","Never add configuration until a second caller needs a different value."],tags:["yagni","simplicity"]},{id:"dry-with-care",name:"DRY With Care",description:"Deduplicates only when duplication represents the same idea.",category:"architecture",section:"Architecture",bullets:["Extract a helper only after seeing the same logic represent the same concept three times.","Prefer duplication over the wrong abstraction.","When deduplicating, name the concept the new helper represents."],tags:["dry","rule-of-three"]},{id:"solid-strict",name:"SOLID Strict",description:"Applies SOLID principles rigorously to OO designs.",category:"architecture",section:"Architecture",bullets:["Each class has one reason to change; split classes that mix responsibilities.","Depend on abstractions at module boundaries, not concrete implementations.","Clients should never be forced to depend on methods they do not use."],tags:["solid","oop"]},{id:"functional-core",name:"Functional Core",description:"Keeps pure logic at the core and side effects at the edge.",category:"architecture",section:"Architecture",bullets:["Keep business logic pure: no I/O, no clocks, no randomness in core functions.","Push side effects to a thin imperative shell that calls the pure core.","Pass data in and out explicitly; avoid hidden mutable state."],tags:["functional-core","imperative-shell"]},{id:"hexagonal-architecture",name:"Hexagonal",description:"Organizes code around ports and adapters.",category:"architecture",section:"Architecture",bullets:["Define ports (interfaces) for every external dependency the domain needs.","Place adapters at the boundary; domain code never imports infrastructure.","Test the domain through ports, swapping in fakes for adapters."],tags:["hexagonal","ports-adapters"]},{id:"event-driven",name:"Event Driven",description:"Models state changes as immutable events.",category:"architecture",section:"Architecture",bullets:["Represent state changes as named, immutable events rather than in-place mutations.","Derive current state by folding over events; never lose history.","Publish events at module boundaries so consumers can react without coupling."],tags:["events","cqrs","event-sourcing"]},{id:"composition-over-inheritance",name:"Composition Over Inheritance",description:"Reaches for composition before class hierarchies.",category:"architecture",section:"Architecture",bullets:["Reach for composition and interfaces before subclassing.","Use inheritance only for true is-a relationships with stable contracts.","Never extend a class just to reuse a few of its methods."],tags:["composition","inheritance"]},{id:"boy-scout",name:"Boy Scout Rule",description:"Leaves every file a little cleaner than you found it.",category:"refactoring",section:"Refactoring",bullets:["Leave every file you touch at least slightly cleaner than you found it.","Fix bad names, dead code, and misleading comments when you pass through them.","Keep cleanup scoped to what you touched; do not sprawl."],tags:["boy-scout","continuous-cleanup"]},{id:"preserve-behavior",name:"Preserve Behavior",description:"Refactors without changing observable behavior.",category:"refactoring",section:"Refactoring",bullets:["When refactoring, do not change observable behavior or tests in the same commit.","Run the full test suite before and after each refactoring step.","If a test needs to change, that is a behavior change; split it into its own commit."],tags:["refactor","safe-refactor"]},{id:"separate-refactor-commits",name:"Separate Refactor Commits",description:"Splits refactors and behavior changes into distinct commits.",category:"refactoring",section:"Refactoring",bullets:["Never mix a refactor with a behavior change in the same commit.",'Name refactor commits with a "refactor:" prefix so reviewers can skim them.',"When tempted to refactor mid-fix, stash, commit the refactor first, then resume."],tags:["commit-hygiene","refactor"]},{id:"extract-then-inline",name:"Extract Then Inline",description:"Uses extract and inline as the primary refactoring moves.",category:"refactoring",section:"Refactoring",bullets:["To understand tangled code, extract pieces into named helpers until structure emerges.","Once structure is clear, inline helpers that no longer earn their name.","Let naming drive the structure, not the other way around."],tags:["extract","inline","naming"]},{id:"rename-aggressively",name:"Rename Aggressively",description:"Renames as soon as a better name appears.",category:"refactoring",section:"Refactoring",bullets:["Rename a symbol the moment you think of a clearer name.","Names should describe intent and units, not implementation.","Commit renames separately so diffs stay reviewable."],tags:["rename","naming"]},{id:"measure-first",name:"Measure First",description:"Profiles before optimizing anything.",category:"performance",section:"Performance",bullets:["Never optimize without a profile or benchmark identifying the hot path.","Record a baseline measurement before any performance change.","Reject performance claims that are not backed by numbers."],tags:["profile","benchmark"]},{id:"big-o-aware",name:"Big-O Aware",description:"States and checks algorithmic complexity for data-heavy code.",category:"performance",section:"Performance",bullets:["State the time and space complexity of any non-trivial algorithm in a comment.","Flag any nested loop over user-scaled data as a complexity hazard.","Prefer O(n) solutions over O(n log n) only when n is provably small or constant."],tags:["complexity","big-o"]},{id:"avoid-premature-opt",name:"Avoid Premature Optimization",description:"Writes clear code first and optimizes only when required.",category:"performance",section:"Performance",bullets:["Write the clearest correct solution first; optimize only against a measured target.","Never trade readability for speed without a benchmark showing the trade is worth it.","Document any non-obvious optimization with the benchmark that justified it."],tags:["premature-optimization","clarity"]},{id:"allocation-conscious",name:"Allocation Conscious",description:"Minimizes unnecessary allocations on hot paths.",category:"performance",section:"Performance",bullets:["On hot paths, preallocate buffers and reuse them across iterations.","Avoid constructing intermediate collections just to transform them.","Prefer streaming and iterators over materializing entire datasets."],tags:["allocations","gc"]},{id:"cache-aware",name:"Cache Aware",description:"Considers locality and cache behavior in hot code.",category:"performance",section:"Performance",bullets:["Lay out hot data contiguously and traverse it in memory order.","Prefer arrays of structs or structs of arrays based on actual access patterns.","Avoid pointer-chasing in inner loops on large datasets."],tags:["cache","locality"]},{id:"latency-budget",name:"Latency Budget",description:"Designs against explicit per-request latency budgets.",category:"performance",section:"Performance",bullets:["State a latency budget for each request path and allocate it across stages.","Measure p50, p95, and p99 latencies, not just averages.","Reject any change that silently blows the budget at p95."],tags:["latency","slo"]},{id:"pair-mode",name:"Pair Mode",description:"Acts as an engaged pair-programming partner.",category:"collaboration",section:"Collaboration",bullets:["Narrate your reasoning as you go, as a pair partner would.","Before typing, state what you intend to do and why.","Pause at natural checkpoints and invite the user to drive or object."],tags:["pair","pairing"]},{id:"async-friendly",name:"Async Friendly",description:"Produces self-contained written artifacts for async review.",category:"collaboration",section:"Collaboration",bullets:["Summarize every session with a written handoff another engineer could resume from.","Include open questions, known gotchas, and next steps in every summary.","Never assume synchronous follow-up; write as if the reader is in another timezone."],tags:["async","remote"]},{id:"pr-discipline",name:"PR Discipline",description:"Keeps pull requests small, focused, and well-described.",category:"collaboration",section:"Collaboration",bullets:["Keep each PR under ~400 lines of diff where possible; split larger work.","Every PR has one purpose stated in its title and described in its body.","PR descriptions explain motivation, approach, and testing performed."],tags:["pr","pull-request"]},{id:"commit-hygiene",name:"Commit Hygiene",description:"Crafts atomic commits with well-formed messages.",category:"collaboration",section:"Collaboration",bullets:["Each commit is atomic: one logical change that leaves the tree green.","Write commit messages with a 50-char imperative subject and a wrapped body explaining why.","Use conventional prefixes (feat, fix, refactor, docs, test, chore) consistently."],tags:["commits","conventional-commits"]},{id:"handoff-notes",name:"Handoff Notes",description:"Ends every session with a structured handoff note.",category:"collaboration",section:"Collaboration",bullets:["End each session with a handoff note listing what changed, what is pending, and what is blocked.","List every file touched and why in the handoff.","Capture commands needed to resume work in a runnable form."],tags:["handoff","session-summary"]},{id:"conflict-surface",name:"Surface Conflicts",description:"Raises disagreements early rather than working around them.",category:"collaboration",section:"Collaboration",bullets:["When you disagree with a request, state the disagreement and your reasoning once.","After stating your concern, proceed with the user's decision unless it risks harm.","Never silently sandbag a task you disagree with."],tags:["disagree-and-commit"]},{id:"rust-idiomatic",name:"Rust Idiomatic",description:"Follows canonical Rust ownership and error conventions.",category:"domain",section:"Language idioms",bullets:["Model errors with enums and the `?` operator; never use `unwrap` in library code.","Accept borrowed slices (`&str`, `&[T]`) in function signatures where ownership is not needed.","Use iterators and combinators over explicit index loops.","Run `cargo clippy` and address every lint before declaring work done."],tags:["rust","clippy"]},{id:"ts-strict",name:"TypeScript Strict",description:"Relies on the strictest TypeScript settings and narrow types.",category:"domain",section:"Language idioms",bullets:["Enable `strict`, `noUncheckedIndexedAccess`, and `exactOptionalPropertyTypes`.","Never use `any`; use `unknown` with narrowing or generics instead.","Prefer discriminated unions over optional fields for state modeling.","Type function boundaries explicitly; let inference handle locals."],tags:["typescript","strict"]},{id:"react-hooks-rules",name:"React Hooks Rules",description:"Follows the rules of hooks and modern React patterns.",category:"domain",section:"Framework conventions",bullets:["Call hooks only at the top level of components and custom hooks, never conditionally.","Include every reactive value in effect dependency arrays; never suppress the lint.","Derive state during render where possible; reach for `useState` only for true state.","Extract reusable stateful logic into custom hooks named `use*`."],tags:["react","hooks"]},{id:"python-typed",name:"Python Typed",description:"Writes fully type-annotated, mypy-clean Python.",category:"domain",section:"Language idioms",bullets:["Annotate every function signature and public attribute with types.","Run `mypy --strict` (or equivalent) and fix every error.","Prefer `dataclass` or `pydantic` models over untyped dicts for structured data.","Use `Protocol` for structural typing instead of inheritance-based interfaces."],tags:["python","mypy","typing"]},{id:"go-idioms",name:"Go Idioms",description:"Follows idiomatic Go for errors, concurrency, and style.",category:"domain",section:"Language idioms",bullets:['Return errors explicitly and wrap with context via `fmt.Errorf("...: %w", err)`.',"Accept interfaces, return concrete types.","Pass `context.Context` as the first argument to any function that blocks or does I/O.","Run `go vet` and `staticcheck` and address every finding."],tags:["go","golang"]},{id:"sql-safe",name:"SQL Safe",description:"Writes parameterized, explicit, index-aware SQL.",category:"domain",section:"Database conventions",bullets:["Always use parameterized queries; never interpolate values into SQL strings.","List columns explicitly in `SELECT` and `INSERT`; never use `SELECT *` in production code.","Check the query plan for any new query touching a large table.","Wrap multi-statement writes in an explicit transaction."],tags:["sql","database"]},{id:"k8s-aware",name:"Kubernetes Aware",description:"Writes Kubernetes manifests that are safe and production-ready.",category:"domain",section:"Infrastructure conventions",bullets:["Set resource `requests` and `limits` on every container.","Define readiness and liveness probes for every workload.","Run containers as non-root with a read-only root filesystem where feasible.","Pin images by digest, not tag, for reproducible deploys."],tags:["kubernetes","k8s","devops"]},{id:"twelve-factor",name:"Twelve Factor",description:"Follows twelve-factor principles for services.",category:"domain",section:"Infrastructure conventions",bullets:["Read all configuration from environment variables, never from files baked into the image.","Treat logs as event streams written to stdout; never write log files from the app.","Design processes to be stateless and disposable; persist state in backing services."],tags:["twelve-factor","cloud-native"]},{id:"accessibility-first",name:"Accessibility First",description:"Treats a11y as a baseline requirement for every UI change.",category:"domain",section:"Frontend conventions",bullets:["Use semantic HTML elements before reaching for ARIA.","Ensure every interactive element is reachable and operable by keyboard.","Provide accessible names for icons, buttons, and form controls.","Verify color contrast meets WCAG AA for all text."],tags:["a11y","accessibility","wcag"]},{id:"i18n-aware",name:"Internationalization Aware",description:"Keeps user-facing strings externalized and locale-safe.",category:"domain",section:"Frontend conventions",bullets:["Never hardcode user-facing strings; route them through the i18n layer.","Format dates, numbers, and currencies through locale-aware APIs.","Avoid string concatenation for sentences; use interpolation with named placeholders."],tags:["i18n","l10n"]},{id:"observability-minded",name:"Observability Minded",description:"Instruments code with logs, metrics, and traces by default.",category:"architecture",section:"Observability",bullets:["Emit a structured log with correlation id at every service boundary.","Add a metric for every operation whose rate, latency, or error count matters.","Propagate trace context across async boundaries and external calls."],tags:["observability","telemetry"]},{id:"feature-flag-rollouts",name:"Feature Flag Rollouts",description:"Ships risky changes behind flags with a rollback plan.",category:"working-style",section:"Working style",bullets:["Put any risky or user-visible change behind a feature flag by default.","Document the rollout and rollback plan in the PR description.","Remove flags promptly once the change is fully rolled out."],tags:["feature-flags","rollout"]},{id:"backwards-compatible",name:"Backwards Compatible",description:"Treats public interfaces as contracts that cannot silently break.",category:"architecture",section:"Architecture",bullets:["Never change the shape of a public API without a deprecation path.","Add new optional fields rather than renaming or removing existing ones.","Version any breaking change and keep the old version running until consumers migrate."],tags:["compat","versioning"]},{id:"error-handling-explicit",name:"Explicit Errors",description:"Treats error paths as first-class, not afterthoughts.",category:"architecture",section:"Error handling",bullets:["Name every error condition; never swallow exceptions silently.","Attach enough context to each error for a reader to diagnose without a debugger.","Distinguish expected failures (return them) from bugs (raise/panic)."],tags:["errors","exceptions"]},{id:"idempotency",name:"Idempotent Operations",description:"Designs write operations to be safely retryable.",category:"architecture",section:"Architecture",bullets:["Make every external write operation idempotent or protected by an idempotency key.","Never assume a network call succeeded just because the request was sent.","Design retries with exponential backoff and a cap on attempts."],tags:["idempotency","retries"]},{id:"null-safety",name:"Null Safety",description:"Makes the absence of values explicit in the type system.",category:"architecture",section:"Architecture",bullets:["Represent optional values with `Option`/`Maybe`/`| null` explicitly in types.","Handle the absent case at the boundary, not deep in business logic.","Never use null as a sentinel for error or default."],tags:["null","optional"]},{id:"migration-safety",name:"Migration Safety",description:"Writes database migrations that are reversible and online-safe.",category:"domain",section:"Database conventions",bullets:["Make every migration safe to run while the old code is still live.","Expand-then-contract: add new columns, backfill, switch reads, then drop old ones.","Provide a tested down-migration for every up-migration."],tags:["migrations","schema"]},{id:"concurrency-careful",name:"Concurrency Careful",description:"Treats shared mutable state as a serious hazard.",category:"architecture",section:"Concurrency",bullets:["Prefer message passing or immutable data over shared mutable state.","Document the locking order for every mutex to prevent deadlocks.","Never hold a lock across I/O or an await point."],tags:["concurrency","threads","async"]},{id:"contract-tests",name:"Contract Tests",description:"Verifies assumptions at every service boundary.",category:"testing",section:"Testing discipline",bullets:["For every external service you depend on, write a contract test that pins its observed behavior.","Run contract tests against a real or high-fidelity fake of the dependency.","Fail loudly when a contract drifts; do not paper over it in the client."],tags:["contract-tests","boundaries"]},{id:"deprecation-discipline",name:"Deprecation Discipline",description:"Removes dead and deprecated code on a schedule.",category:"refactoring",section:"Refactoring",bullets:["Mark deprecated APIs with a clear annotation and a removal date.","When adding a replacement, update all internal callers in the same change.","Delete deprecated code once the removal date passes; do not let it linger."],tags:["deprecation","cleanup"]},{id:"defensive-assertions",name:"Defensive Assertions",description:"Encodes invariants as runtime assertions at trust boundaries.",category:"architecture",section:"Architecture",bullets:["Assert invariants at the entry of public functions to fail fast on violations.","Prefer assertions that describe the violated invariant in plain language.","Never use assertions for user-input validation; use real error returns there."],tags:["assertions","invariants","fail-fast"]}],Jt=/<!--\s*claude-presets:start(?:\s+id=([^>]*?))?\s*-->/,kt="<!-- claude-presets:end -->";function cn(t){const s=t.match(Jt);if(!s)return[];const n=(s[1]??"").trim();return n?n.split(",").map(o=>o.trim()).filter(Boolean):[]}function li(t){if(t.length===0)return`<!-- claude-presets:start -->
41
41
  <!-- claude-presets:end -->`;const s=[],n=new Map;for(const a of t){const r=a.section.trim().toLowerCase();let l=n.get(r);l===void 0&&(l=s.length,n.set(r,l),s.push({section:a.section.trim(),bullets:[]})),s[l].bullets.push(...a.bullets)}const o=s.map(a=>`# ${a.section}
42
42
 
43
43
  ${a.bullets.map(r=>`- ${r.trim()}`).join(`
@@ -45,7 +45,7 @@ ${a.bullets.map(r=>`- ${r.trim()}`).join(`
45
45
 
46
46
  `);return`<!-- claude-presets:start id=${t.map(a=>a.id).join(",")} -->
47
47
  ${o}
48
- <!-- claude-presets:end -->`}function ii(t,s){const n=oi(s),o=t.match(Jt);if(o&&o.index!==void 0){const i=o.index,a=t.indexOf(kt,i);if(a>=0){const r=t.slice(0,i),l=t.slice(a+kt.length),d=r.replace(/\s*$/,""),c=l.replace(/^\s*/,"");return`${d}${d?`
48
+ <!-- claude-presets:end -->`}function ci(t,s){const n=li(s),o=t.match(Jt);if(o&&o.index!==void 0){const i=o.index,a=t.indexOf(kt,i);if(a>=0){const r=t.slice(0,i),l=t.slice(a+kt.length),d=r.replace(/\s*$/,""),c=l.replace(/^\s*/,"");return`${d}${d?`
49
49
 
50
50
  `:""}${n}${c?`
51
51
 
@@ -53,15 +53,15 @@ ${o}
53
53
  `}${c}`}}return t.trim()?`${n}
54
54
 
55
55
  ${t.replace(/^\s+/,"")}`:n+`
56
- `}function ri(t,s,n){const o=cn(t),i=o.includes(s)?o.filter(l=>l!==s):[...o,s],a=new Map(n.map(l=>[l.id,l])),r=i.map(l=>a.get(l)).filter(l=>l!==void 0);return ii(t,r)}function ai(t,s){let n=t;const o=n.match(Jt);if(o&&o.index!==void 0){const r=n.indexOf(kt,o.index);r>=0&&(n=n.slice(0,o.index)+n.slice(r+kt.length))}const i=new Set(s.map(r=>r.section.trim().toLowerCase())),a=new Set;for(const r of n.split(`
57
- `)){const l=r.match(/^#\s+(.+?)\s*$/);if(!l)continue;const d=l[1].trim();i.has(d.toLowerCase())&&a.add(d)}return Array.from(a)}function rt(t,...s){if(!t.trim())return!0;const n=t.toLowerCase();return s.some(o=>o.toLowerCase().includes(n))}function Mt(t,s){return t==="user"?{fileId:"claudeJson",scope:"user"}:{fileId:"mcpJson",scope:"project",cwd:s}}function li(t){const s=t.type;return"command"in t?{type:"stdio",...t}:{...t,type:s??"http"}}function sl({scope:t="user",cwd:s=null}={}){const n=Oe(),[o,i]=u.useState(new Set),[a,r]=u.useState(null),[l,d]=u.useState(null),[c,p]=u.useState(null),[m,g]=u.useState(""),[h,f]=u.useState(null),b=t==="user"||!!s,y=async()=>{var S;if(!n||!b){i(new Set);return}try{const L=((S=(await window.api.claudeConfig.read(Mt(t,s))).data)==null?void 0:S.mcpServers)??{};i(new Set(Object.keys(L)))}catch{i(new Set)}};u.useEffect(()=>{y()},[n,t,s]);const k=u.useMemo(()=>It.filter(S=>rt(m,S.id,S.name,S.description)),[m]),w=S=>{const A=Rt(S.config);if(A.length>0){d(null),f({m:S,fields:A,values:{}});return}return P(S,S.config)},j=async(S,A)=>{try{return await window.api.claudeConfig.patch({...Mt(t,s),keyPath:["mcpServers",S],value:A}),null}catch(L){return L.message||"write failed"}},P=async(S,A)=>{if(!n||!b)return;r(S.id),d(null);const L=await j(S.id,li(A));if(r(null),L){d(L);return}f(null),p(`installed ${S.id} (${t})`),setTimeout(()=>p(null),4e3),y()},_=async S=>{if(!n||!b)return;r(S),d(null);const A=await j(S,void 0);if(r(null),A){d(A);return}y()};return n?e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(at,{query:m,onQueryChange:g,count:k.length,total:It.length}),(c||l)&&e.jsx("div",{className:`px-4 py-2 text-xs border-b border-line ${l?"text-red-400 bg-red-950/20":"text-accent bg-bg-elev"}`,children:l??c}),h&&e.jsxs("div",{className:"px-4 py-3 border-b border-line bg-bg-elev space-y-2","data-testid":"mcp-placeholder-form",children:[e.jsxs("div",{className:"text-xs text-fg",children:["Configure ",e.jsx("span",{className:"font-medium",children:h.m.name})," — fill in every value before installing"]}),h.fields.map(S=>e.jsxs("label",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"w-64 shrink-0 text-fg-faint font-mono truncate",title:S.label,children:S.label}),e.jsx("input",{required:!0,"aria-label":S.token,value:h.values[S.token]??"",onChange:A=>{const L=A.target.value;f(E=>E&&{...E,values:{...E.values,[S.token]:L}})},placeholder:S.token,className:"flex-1 bg-bg border border-line rounded px-2 py-1 text-xs text-fg font-mono"})]},S.token)),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(hs,{variant:"primary",disabled:a===h.m.id||h.fields.some(S=>!(h.values[S.token]??"").trim()),onClick:()=>P(h.m,ei(h.m.config,h.values)),children:"install"}),e.jsx(hs,{onClick:()=>f(null),children:"cancel"})]})]}),e.jsxs("div",{className:"flex-1 overflow-auto divide-y divide-line",children:[k.map(S=>{const A=o.has(S.id);return e.jsxs("div",{className:"px-4 py-3 flex items-start gap-3 hover:bg-bg-elev/50",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-fg text-xs font-medium",children:S.name}),S.official&&e.jsx(ye,{children:"official"}),A&&e.jsx(ye,{tone:"accent",children:"installed"}),S.envVars.length>0&&e.jsxs(ye,{tone:"warn",children:[S.envVars.length," env"]})]}),e.jsx("div",{className:"text-fg-dim text-xs mt-0.5",children:S.description}),e.jsx("div",{className:"text-fg-faint text-[10px] font-mono mt-1 truncate",children:"command"in S.config?`${S.config.command} ${(S.config.args??[]).join(" ")}`:S.config.url})]}),e.jsxs("div",{className:"flex gap-1 shrink-0",children:[e.jsx(Qt,{href:S.homepage,children:"docs"}),A?e.jsx("button",{disabled:a===S.id,onClick:()=>_(S.id),className:"px-2 py-0.5 text-xs border border-line rounded text-fg-dim hover:text-red-400",children:"remove"}):e.jsx("button",{disabled:a===S.id,onClick:()=>w(S),className:"px-2 py-0.5 text-xs border border-accent rounded text-accent hover:bg-accent hover:text-bg",children:a===S.id?"…":"install"})]})]},S.id)}),k.length===0&&e.jsx(K,{title:"no matches"})]})]}):e.jsx(K,{title:"loading…"})}function nl(){const t=Oe(),[s,n]=u.useState(new Set),[o,i]=u.useState(""),a=async()=>{if(!t)return;const{entries:l}=await Vt(`${t}/.claude/skills`);n(new Set(l.map(d=>d.name)))};u.useEffect(()=>{a()},[t]);const r=u.useMemo(()=>vt.filter(l=>rt(o,l.id,l.name,l.description)),[o]);return t?e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(at,{query:o,onQueryChange:i,count:r.length,total:vt.length}),e.jsxs("div",{className:"flex-1 overflow-auto divide-y divide-line",children:[r.map(l=>{const d=s.has(l.id),c=l.source==="local",p=c?"":`mkdir -p ~/.claude/skills && cd ~/.claude/skills && git clone --depth 1 --filter=blob:none --sparse https://github.com/anthropics/skills _tmp-${l.id} && cd _tmp-${l.id} && git sparse-checkout set skills/${l.id} && mv skills/${l.id} ../${l.id} && cd .. && rm -rf _tmp-${l.id}`;return e.jsxs("div",{className:"px-4 py-3 flex items-start gap-3 hover:bg-bg-elev/50",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-fg text-xs font-medium",children:l.name}),l.official&&e.jsx(ye,{children:"official"}),c&&e.jsx(ye,{tone:"warn",children:"local"}),d&&e.jsx(ye,{tone:"accent",children:"installed"})]}),e.jsx("div",{className:"text-fg-dim text-xs mt-0.5",children:l.description}),e.jsxs("div",{className:"text-fg-faint text-[10px] font-mono mt-1 truncate",children:["~/.claude/skills/",l.id,"/"]})]}),e.jsxs("div",{className:"flex gap-1 shrink-0",children:[!c&&e.jsx(Qt,{href:l.source,children:"source"}),!c&&e.jsx(dn,{text:p,label:d?"reinstall cmd":"copy install"})]})]},l.id)}),r.length===0&&e.jsx(K,{title:"no matches"})]})]}):e.jsx(K,{title:"loading…"})}function ol(){const t=Oe(),[s,n]=u.useState(new Set),[o,i]=u.useState(""),[a,r]=u.useState([]),l=async()=>{var m,g;if(!t)return;r(await si(t));const c=new Set,p=await window.api.config.listDir(`${t}/.claude/plugins`,{dirsOnly:!0});for(const h of p.entries)c.add(h.name);try{for(const h of await((g=(m=window.api.plugins)==null?void 0:m.list)==null?void 0:g.call(m))??[])h.enabled&&c.add(h.name)}catch{}n(c)};u.useEffect(()=>{l()},[t]);const d=u.useMemo(()=>a.filter(c=>rt(o,c.name,c.marketplace,c.description)),[a,o]);return t?e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(at,{query:o,onQueryChange:i,count:d.length,total:a.length}),e.jsxs("div",{className:"flex-1 overflow-auto divide-y divide-line",children:[d.map(c=>{const p=s.has(c.name),m=`/plugin install ${c.name}@${c.marketplace}`;return e.jsxs("div",{className:"px-4 py-3 flex items-start gap-3 hover:bg-bg-elev/50",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-fg text-xs font-medium",children:c.name}),e.jsx(ye,{tone:"dim",children:c.marketplace}),p&&e.jsx(ye,{tone:"accent",children:"installed"})]}),e.jsx("div",{className:"text-fg-dim text-xs mt-0.5",children:c.description}),e.jsx("div",{className:"text-fg-faint text-[10px] font-mono mt-1 truncate",children:m})]}),e.jsxs("div",{className:"flex gap-1 shrink-0 items-start",children:[/^https?:\/\//.test(c.source)&&e.jsx(Qt,{href:c.source,children:"source"}),e.jsx(dn,{text:m,label:"copy"}),e.jsx(ui,{id:c.name,marketplace:c.marketplace==="session-manager"?{add:"bundled",name:c.marketplace}:void 0,installed:p,onDone:l})]})]},`${c.marketplace}/${c.name}`)}),d.length===0&&e.jsx(K,{title:"no matches"})]})]}):e.jsx(K,{title:"loading…"})}function ci(t,s){return(t[s.event]??[]).some(o=>(o.hooks??[]).some(i=>i.type==="command"&&i.command===s.command))}function di(){const t=Oe(),[s,n]=u.useState({}),[o,i]=u.useState(null),[a,r]=u.useState(null),[l,d]=u.useState(null),[c,p]=u.useState(""),m=t?`${t}/.claude/settings.json`:null,g=async()=>{if(!m)return;const y=await window.api.config.readJson(m),k=(y.data&&typeof y.data=="object"?y.data:{})??{};n(k.hooks??{})};u.useEffect(()=>{g()},[m]);const h=u.useMemo(()=>wt.filter(y=>rt(c,y.id,y.name,y.description,y.event)),[c]),f=async y=>{if(!m)return;i(y.id),d(null);const k=await window.api.config.readJson(m),w=(k.data&&typeof k.data=="object"?k.data:{})??{},j={...w.hooks??{}},P=(j[y.event]??[]).slice();P.push({...y.matcher?{matcher:y.matcher}:{},hooks:[{type:"command",command:y.command,...y.timeout?{timeout:y.timeout}:{}}]}),j[y.event]=P;const _=await window.api.config.writeJson(m,{...w,hooks:j});if(i(null),!_.ok){d(_.error??"write failed");return}r(`installed ${y.id}`),setTimeout(()=>r(null),2500),g()},b=async y=>{if(!m)return;i(y.id),d(null);const k=await window.api.config.readJson(m),w=(k.data&&typeof k.data=="object"?k.data:{})??{},j={...w.hooks??{}},P=(j[y.event]??[]).map(S=>({...S,hooks:(S.hooks??[]).filter(A=>!(A.type==="command"&&A.command===y.command))})).filter(S=>(S.hooks??[]).length>0);P.length?j[y.event]=P:delete j[y.event];const _=await window.api.config.writeJson(m,{...w,hooks:j});if(i(null),!_.ok){d(_.error??"write failed");return}g()};return t?e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(at,{query:c,onQueryChange:p,count:h.length,total:wt.length}),(a||l)&&e.jsx("div",{className:`px-4 py-2 text-xs border-b border-line ${l?"text-red-400 bg-red-950/20":"text-accent bg-bg-elev"}`,children:l??a}),e.jsxs("div",{className:"flex-1 overflow-auto divide-y divide-line",children:[h.map(y=>{const k=ci(s,y);return e.jsxs("div",{className:"px-4 py-3 flex items-start gap-3 hover:bg-bg-elev/50",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-fg text-xs font-medium",children:y.name}),e.jsx(ye,{tone:"dim",children:y.event}),y.matcher&&e.jsxs(ye,{tone:"dim",children:["match: ",y.matcher]}),k&&e.jsx(ye,{tone:"accent",children:"installed"})]}),e.jsx("div",{className:"text-fg-dim text-xs mt-0.5",children:y.description}),e.jsx("div",{className:"text-fg-faint text-[10px] font-mono mt-1 truncate",children:y.command})]}),e.jsx("div",{className:"flex gap-1 shrink-0",children:k?e.jsx("button",{disabled:o===y.id,onClick:()=>b(y),className:"px-2 py-0.5 text-xs border border-line rounded text-fg-dim hover:text-red-400",children:"remove"}):e.jsx("button",{disabled:o===y.id,onClick:()=>f(y),className:"px-2 py-0.5 text-xs border border-accent rounded text-accent hover:bg-accent hover:text-bg",children:o===y.id?"…":"install"})})]},y.id)}),h.length===0&&e.jsx(K,{title:"no matches"})]})]}):e.jsx(K,{title:"loading…"})}function pi(){const t=Oe(),[s,n]=u.useState(""),[o,i]=u.useState(null),[a,r]=u.useState(null),[l,d]=u.useState(null),[c,p]=u.useState(""),m=t?`${t}/.claude/settings.json`:null,g=async()=>{if(!m)return;const b=await window.api.config.readJson(m),y=(b.data&&typeof b.data=="object"?b.data:{})??{};n(JSON.stringify(y.permissions??{}))};u.useEffect(()=>{g()},[m]);const h=u.useMemo(()=>fs.filter(b=>rt(c,b.id,b.name,b.description)),[c]),f=async b=>{if(!m)return;i(b.id),d(null);const y=await window.api.config.readJson(m),k=(y.data&&typeof y.data=="object"?y.data:{})??{},w=await window.api.config.writeJson(m,{...k,permissions:b.permissions});if(i(null),!w.ok){d(w.error??"write failed");return}r(`applied ${b.id} — replaces existing permissions block`),setTimeout(()=>r(null),3e3),g()};return t?e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(at,{query:c,onQueryChange:p,count:h.length,total:fs.length}),(a||l)&&e.jsx("div",{className:`px-4 py-2 text-xs border-b border-line ${l?"text-red-400 bg-red-950/20":"text-accent bg-bg-elev"}`,children:l??a}),e.jsxs("div",{className:"flex-1 overflow-auto divide-y divide-line",children:[h.map(b=>{const y=s===JSON.stringify(b.permissions),k=[];return b.permissions.allow&&k.push(`${b.permissions.allow.length} allow`),b.permissions.deny&&k.push(`${b.permissions.deny.length} deny`),b.permissions.ask&&k.push(`${b.permissions.ask.length} ask`),b.permissions.defaultMode&&k.push(`mode: ${b.permissions.defaultMode}`),e.jsxs("div",{className:"px-4 py-3 flex items-start gap-3 hover:bg-bg-elev/50",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-fg text-xs font-medium",children:b.name}),y&&e.jsx(ye,{tone:"accent",children:"active"}),e.jsx(ye,{tone:"warn",children:"replaces permissions"})]}),e.jsx("div",{className:"text-fg-dim text-xs mt-0.5",children:b.description}),e.jsx("div",{className:"text-fg-faint text-[10px] font-mono mt-1 truncate",children:k.join(" · ")})]}),e.jsx("div",{className:"flex gap-1 shrink-0",children:e.jsx("button",{disabled:o===b.id,onClick:()=>f(b),className:"px-2 py-0.5 text-xs border border-accent rounded text-accent hover:bg-accent hover:text-bg",children:o===b.id?"…":"apply"})})]},b.id)}),h.length===0&&e.jsx(K,{title:"no matches"})]})]}):e.jsx(K,{title:"loading…"})}function il({path:t,disabled:s=!1}){const[n,o]=u.useState(!1),i=G(p=>{var m;return((m=p.files[t])==null?void 0:m.draftRaw)??""}),a=G(p=>p.setDraft),r=u.useMemo(()=>new Set(cn(i)),[i]),l=u.useMemo(()=>ai(i,Nt),[i]),d=l.length>0,c=s||d;return e.jsxs("div",{className:"relative","data-testid":"insert-preset-menu",children:[e.jsx("button",{type:"button","data-testid":"insert-preset-button",disabled:s,onClick:()=>o(p=>!p),className:"px-2 py-0.5 text-xs rounded border border-line text-fg-dim hover:text-fg hover:bg-bg-hi disabled:opacity-50",title:d?"Locked: unmanaged sections collide with presets":"Insert a preset into CLAUDE.md",children:"Insert preset ▾"}),n&&e.jsxs("div",{className:`absolute left-0 top-full mt-1 ${Pe.dialog} w-80 max-h-96 overflow-auto rounded border border-line bg-bg-elev shadow-lg`,children:[d&&e.jsxs("div",{"data-testid":"insert-preset-locked",className:"px-3 py-2 text-[11px] text-yellow-500/90 border-b border-line",children:["Locked — unmanaged sections collide with presets: ",l.map(p=>`# ${p}`).join(" · "),". Remove them from the document first."]}),Nt.map(p=>{const m=r.has(p.id);return e.jsxs("button",{type:"button","data-testid":`insert-preset-${p.id}`,disabled:c,onClick:()=>a(t,ri(i,p.id,Nt)),className:"w-full text-left px-3 py-1.5 text-xs flex items-center gap-2 hover:bg-bg-hi disabled:opacity-50 disabled:hover:bg-transparent",title:p.description,children:[e.jsx("span",{className:"flex-1 truncate text-fg",children:p.name}),e.jsx("span",{className:m?"text-accent":"text-fg-faint",children:m?"on":"off"})]},p.id)})]})]})}function at({query:t,onQueryChange:s,count:n,total:o}){return e.jsxs("div",{className:"shrink-0 border-b border-line bg-bg-elev px-3 py-1.5 flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-fg-faint",children:n===o?`${o} available`:`${n} of ${o}`}),e.jsx("div",{className:"flex-1"}),e.jsx("input",{value:t,onChange:i=>s(i.target.value),placeholder:"filter…",className:"bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg w-48"})]})}function Qt({href:t,children:s}){return e.jsx("a",{href:t,target:"_blank",rel:"noreferrer",className:"px-2 py-0.5 text-xs border border-line rounded text-fg-dim hover:text-fg hover:bg-bg-hi",children:s})}function ui({id:t,marketplace:s,installed:n,onDone:o}){const[i,a]=u.useState("idle"),[r,l]=u.useState([]),[d,c]=u.useState(!1),p=u.useRef(!0);u.useEffect(()=>()=>{p.current=!1},[]),u.useEffect(()=>{const g=window.api.plugins.onInstallProgress(({slug:h,line:f})=>{h===t&&l(b=>{const y=[...b,f];return y.length>200?y.slice(y.length-200):y})});return()=>g()},[t]);const m=async()=>{a("running"),l([]),c(!0);try{const g=await window.api.plugins.install({slug:t,marketplace:s});if(!p.current){g.ok?(W.info(`Installed ${t}`),o()):W.error(`Install failed: ${t} (exit ${g.exitCode})${g.error?` — ${g.error}`:""}`);return}g.ok?(a("idle"),W.info(`Installed ${t}`),o()):(a("error"),W.error(`Install failed: ${t} (exit ${g.exitCode})${g.error?` — ${g.error}`:""}`))}catch(g){if(!p.current){W.error(`Install error: ${t} — ${g instanceof Error?g.message:String(g)}`);return}a("error"),W.error(`Install error: ${t} — ${g instanceof Error?g.message:String(g)}`)}};return n?e.jsx("button",{disabled:!0,className:"px-2 py-0.5 text-xs border border-line rounded text-fg-faint bg-bg-elev cursor-default",children:"installed"}):e.jsxs("div",{className:"flex flex-col items-end gap-1",children:[e.jsx("button",{onClick:m,disabled:i==="running",className:`px-2 py-0.5 text-xs border rounded ${i==="running"?"border-line text-fg-faint bg-bg-elev cursor-not-allowed":"border-accent/50 text-accent hover:bg-accent hover:text-bg"}`,children:i==="running"?"installing…":i==="error"?"retry":"install"}),r.length>0&&e.jsx("button",{onClick:()=>c(g=>!g),className:"text-[10px] text-fg-faint hover:text-fg-dim",children:d?"hide log":"show log"}),d&&r.length>0&&e.jsx("pre",{className:"mt-0.5 max-h-40 w-72 overflow-auto bg-bg-elev border border-line rounded p-2 text-fg-faint font-mono text-[10px] whitespace-pre-wrap text-left",children:r.join(`
58
- `)})]})}function dn({text:t,label:s}){const[n,o]=u.useState(!1);return e.jsx("button",{onClick:()=>{Hs(t).then(i=>{if(!i){W.error("Copy failed");return}o(!0),setTimeout(()=>o(!1),1500)})},className:"px-2 py-0.5 text-xs border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg",children:n?"copied!":s})}const mi="http://json-schema.org/draft-07/schema#",hi="https://json.schemastore.org/claude-code-settings.json",fi={permissionRule:{type:"string",description:`Tool permission rule.
56
+ `}function di(t,s,n){const o=cn(t),i=o.includes(s)?o.filter(l=>l!==s):[...o,s],a=new Map(n.map(l=>[l.id,l])),r=i.map(l=>a.get(l)).filter(l=>l!==void 0);return ci(t,r)}function pi(t,s){let n=t;const o=n.match(Jt);if(o&&o.index!==void 0){const r=n.indexOf(kt,o.index);r>=0&&(n=n.slice(0,o.index)+n.slice(r+kt.length))}const i=new Set(s.map(r=>r.section.trim().toLowerCase())),a=new Set;for(const r of n.split(`
57
+ `)){const l=r.match(/^#\s+(.+?)\s*$/);if(!l)continue;const d=l[1].trim();i.has(d.toLowerCase())&&a.add(d)}return Array.from(a)}function rt(t,...s){if(!t.trim())return!0;const n=t.toLowerCase();return s.some(o=>o.toLowerCase().includes(n))}function Mt(t,s){return t==="user"?{fileId:"claudeJson",scope:"user"}:{fileId:"mcpJson",scope:"project",cwd:s}}function ui(t){const s=t.type;return"command"in t?{type:"stdio",...t}:{...t,type:s??"http"}}function rl({scope:t="user",cwd:s=null}={}){const n=Oe(),[o,i]=u.useState(new Set),[a,r]=u.useState(null),[l,d]=u.useState(null),[c,p]=u.useState(null),[m,g]=u.useState(""),[h,f]=u.useState(null),b=t==="user"||!!s,y=async()=>{var E;if(!n||!b){i(new Set);return}try{const j=((E=(await window.api.claudeConfig.read(Mt(t,s))).data)==null?void 0:E.mcpServers)??{};i(new Set(Object.keys(j)))}catch{i(new Set)}};u.useEffect(()=>{y()},[n,t,s]);const k=u.useMemo(()=>It.filter(E=>rt(m,E.id,E.name,E.description)),[m]),w=E=>{const _=Rt(E.config);if(_.length>0){d(null),f({m:E,fields:_,values:{}});return}return D(E,E.config)},O=async(E,_)=>{try{return await window.api.claudeConfig.patch({...Mt(t,s),keyPath:["mcpServers",E],value:_}),null}catch(j){return j.message||"write failed"}},D=async(E,_)=>{if(!n||!b)return;r(E.id),d(null);const j=await O(E.id,ui(_));if(r(null),j){d(j);return}f(null),p(`installed ${E.id} (${t})`),setTimeout(()=>p(null),4e3),y()},C=async E=>{if(!n||!b)return;r(E),d(null);const _=await O(E,void 0);if(r(null),_){d(_);return}y()};return n?e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(at,{query:m,onQueryChange:g,count:k.length,total:It.length}),(c||l)&&e.jsx("div",{className:`px-4 py-2 text-xs border-b border-line ${l?"text-red-400 bg-red-950/20":"text-accent bg-bg-elev"}`,children:l??c}),h&&e.jsxs("div",{className:"px-4 py-3 border-b border-line bg-bg-elev space-y-2","data-testid":"mcp-placeholder-form",children:[e.jsxs("div",{className:"text-xs text-fg",children:["Configure ",e.jsx("span",{className:"font-medium",children:h.m.name})," — fill in every value before installing"]}),h.fields.map(E=>e.jsxs("label",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"w-64 shrink-0 text-fg-faint font-mono truncate",title:E.label,children:E.label}),e.jsx("input",{required:!0,"aria-label":E.token,value:h.values[E.token]??"",onChange:_=>{const j=_.target.value;f(A=>A&&{...A,values:{...A.values,[E.token]:j}})},placeholder:E.token,className:"flex-1 bg-bg border border-line rounded px-2 py-1 text-xs text-fg font-mono"})]},E.token)),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(hs,{variant:"primary",disabled:a===h.m.id||h.fields.some(E=>!(h.values[E.token]??"").trim()),onClick:()=>D(h.m,oi(h.m.config,h.values)),children:"install"}),e.jsx(hs,{onClick:()=>f(null),children:"cancel"})]})]}),e.jsxs("div",{className:"flex-1 overflow-auto divide-y divide-line",children:[k.map(E=>{const _=o.has(E.id);return e.jsxs("div",{className:"px-4 py-3 flex items-start gap-3 hover:bg-bg-elev/50",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-fg text-xs font-medium",children:E.name}),E.official&&e.jsx(ye,{children:"official"}),_&&e.jsx(ye,{tone:"accent",children:"installed"}),E.envVars.length>0&&e.jsxs(ye,{tone:"warn",children:[E.envVars.length," env"]})]}),e.jsx("div",{className:"text-fg-dim text-xs mt-0.5",children:E.description}),e.jsx("div",{className:"text-fg-faint text-[10px] font-mono mt-1 truncate",children:"command"in E.config?`${E.config.command} ${(E.config.args??[]).join(" ")}`:E.config.url})]}),e.jsxs("div",{className:"flex gap-1 shrink-0",children:[e.jsx(Qt,{href:E.homepage,children:"docs"}),_?e.jsx("button",{disabled:a===E.id,onClick:()=>C(E.id),className:"px-2 py-0.5 text-xs border border-line rounded text-fg-dim hover:text-red-400",children:"remove"}):e.jsx("button",{disabled:a===E.id,onClick:()=>w(E),className:"px-2 py-0.5 text-xs border border-accent rounded text-accent hover:bg-accent hover:text-bg",children:a===E.id?"…":"install"})]})]},E.id)}),k.length===0&&e.jsx(K,{title:"no matches"})]})]}):e.jsx(K,{title:"loading…"})}function al(){const t=Oe(),[s,n]=u.useState(new Set),[o,i]=u.useState(""),a=async()=>{if(!t)return;const{entries:l}=await Vt(`${t}/.claude/skills`);n(new Set(l.map(d=>d.name)))};u.useEffect(()=>{a()},[t]);const r=u.useMemo(()=>vt.filter(l=>rt(o,l.id,l.name,l.description)),[o]);return t?e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(at,{query:o,onQueryChange:i,count:r.length,total:vt.length}),e.jsxs("div",{className:"flex-1 overflow-auto divide-y divide-line",children:[r.map(l=>{const d=s.has(l.id),c=l.source==="local",p=c?"":`mkdir -p ~/.claude/skills && cd ~/.claude/skills && git clone --depth 1 --filter=blob:none --sparse https://github.com/anthropics/skills _tmp-${l.id} && cd _tmp-${l.id} && git sparse-checkout set skills/${l.id} && mv skills/${l.id} ../${l.id} && cd .. && rm -rf _tmp-${l.id}`;return e.jsxs("div",{className:"px-4 py-3 flex items-start gap-3 hover:bg-bg-elev/50",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-fg text-xs font-medium",children:l.name}),l.official&&e.jsx(ye,{children:"official"}),c&&e.jsx(ye,{tone:"warn",children:"local"}),d&&e.jsx(ye,{tone:"accent",children:"installed"})]}),e.jsx("div",{className:"text-fg-dim text-xs mt-0.5",children:l.description}),e.jsxs("div",{className:"text-fg-faint text-[10px] font-mono mt-1 truncate",children:["~/.claude/skills/",l.id,"/"]})]}),e.jsxs("div",{className:"flex gap-1 shrink-0",children:[!c&&e.jsx(Qt,{href:l.source,children:"source"}),!c&&e.jsx(dn,{text:p,label:d?"reinstall cmd":"copy install"})]})]},l.id)}),r.length===0&&e.jsx(K,{title:"no matches"})]})]}):e.jsx(K,{title:"loading…"})}function ll(){const t=Oe(),[s,n]=u.useState(new Set),[o,i]=u.useState(""),[a,r]=u.useState([]),l=async()=>{var m,g;if(!t)return;r(await ri(t));const c=new Set,p=await window.api.config.listDir(`${t}/.claude/plugins`,{dirsOnly:!0});for(const h of p.entries)c.add(h.name);try{for(const h of await((g=(m=window.api.plugins)==null?void 0:m.list)==null?void 0:g.call(m))??[])h.enabled&&c.add(h.name)}catch{}n(c)};u.useEffect(()=>{l()},[t]);const d=u.useMemo(()=>a.filter(c=>rt(o,c.name,c.marketplace,c.description)),[a,o]);return t?e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(at,{query:o,onQueryChange:i,count:d.length,total:a.length}),e.jsxs("div",{className:"flex-1 overflow-auto divide-y divide-line",children:[d.map(c=>{const p=s.has(c.name),m=`/plugin install ${c.name}@${c.marketplace}`;return e.jsxs("div",{className:"px-4 py-3 flex items-start gap-3 hover:bg-bg-elev/50",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-fg text-xs font-medium",children:c.name}),e.jsx(ye,{tone:"dim",children:c.marketplace}),p&&e.jsx(ye,{tone:"accent",children:"installed"})]}),e.jsx("div",{className:"text-fg-dim text-xs mt-0.5",children:c.description}),e.jsx("div",{className:"text-fg-faint text-[10px] font-mono mt-1 truncate",children:m})]}),e.jsxs("div",{className:"flex gap-1 shrink-0 items-start",children:[/^https?:\/\//.test(c.source)&&e.jsx(Qt,{href:c.source,children:"source"}),e.jsx(dn,{text:m,label:"copy"}),e.jsx(gi,{id:c.name,marketplace:c.marketplace==="session-manager"?{add:"bundled",name:c.marketplace}:void 0,installed:p,onDone:l})]})]},`${c.marketplace}/${c.name}`)}),d.length===0&&e.jsx(K,{title:"no matches"})]})]}):e.jsx(K,{title:"loading…"})}function mi(t,s){return(t[s.event]??[]).some(o=>(o.hooks??[]).some(i=>i.type==="command"&&i.command===s.command))}function hi(){const t=Oe(),[s,n]=u.useState({}),[o,i]=u.useState(null),[a,r]=u.useState(null),[l,d]=u.useState(null),[c,p]=u.useState(""),m=t?`${t}/.claude/settings.json`:null,g=async()=>{if(!m)return;const y=await window.api.config.readJson(m),k=(y.data&&typeof y.data=="object"?y.data:{})??{};n(k.hooks??{})};u.useEffect(()=>{g()},[m]);const h=u.useMemo(()=>wt.filter(y=>rt(c,y.id,y.name,y.description,y.event)),[c]),f=async y=>{if(!m)return;i(y.id),d(null);const k=await window.api.config.readJson(m),w=(k.data&&typeof k.data=="object"?k.data:{})??{},O={...w.hooks??{}},D=(O[y.event]??[]).slice();D.push({...y.matcher?{matcher:y.matcher}:{},hooks:[{type:"command",command:y.command,...y.timeout?{timeout:y.timeout}:{}}]}),O[y.event]=D;const C=await window.api.config.writeJson(m,{...w,hooks:O});if(i(null),!C.ok){d(C.error??"write failed");return}r(`installed ${y.id}`),setTimeout(()=>r(null),2500),g()},b=async y=>{if(!m)return;i(y.id),d(null);const k=await window.api.config.readJson(m),w=(k.data&&typeof k.data=="object"?k.data:{})??{},O={...w.hooks??{}},D=(O[y.event]??[]).map(E=>({...E,hooks:(E.hooks??[]).filter(_=>!(_.type==="command"&&_.command===y.command))})).filter(E=>(E.hooks??[]).length>0);D.length?O[y.event]=D:delete O[y.event];const C=await window.api.config.writeJson(m,{...w,hooks:O});if(i(null),!C.ok){d(C.error??"write failed");return}g()};return t?e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(at,{query:c,onQueryChange:p,count:h.length,total:wt.length}),(a||l)&&e.jsx("div",{className:`px-4 py-2 text-xs border-b border-line ${l?"text-red-400 bg-red-950/20":"text-accent bg-bg-elev"}`,children:l??a}),e.jsxs("div",{className:"flex-1 overflow-auto divide-y divide-line",children:[h.map(y=>{const k=mi(s,y);return e.jsxs("div",{className:"px-4 py-3 flex items-start gap-3 hover:bg-bg-elev/50",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-fg text-xs font-medium",children:y.name}),e.jsx(ye,{tone:"dim",children:y.event}),y.matcher&&e.jsxs(ye,{tone:"dim",children:["match: ",y.matcher]}),k&&e.jsx(ye,{tone:"accent",children:"installed"})]}),e.jsx("div",{className:"text-fg-dim text-xs mt-0.5",children:y.description}),e.jsx("div",{className:"text-fg-faint text-[10px] font-mono mt-1 truncate",children:y.command})]}),e.jsx("div",{className:"flex gap-1 shrink-0",children:k?e.jsx("button",{disabled:o===y.id,onClick:()=>b(y),className:"px-2 py-0.5 text-xs border border-line rounded text-fg-dim hover:text-red-400",children:"remove"}):e.jsx("button",{disabled:o===y.id,onClick:()=>f(y),className:"px-2 py-0.5 text-xs border border-accent rounded text-accent hover:bg-accent hover:text-bg",children:o===y.id?"…":"install"})})]},y.id)}),h.length===0&&e.jsx(K,{title:"no matches"})]})]}):e.jsx(K,{title:"loading…"})}function fi(){const t=Oe(),[s,n]=u.useState(""),[o,i]=u.useState(null),[a,r]=u.useState(null),[l,d]=u.useState(null),[c,p]=u.useState(""),m=t?`${t}/.claude/settings.json`:null,g=async()=>{if(!m)return;const b=await window.api.config.readJson(m),y=(b.data&&typeof b.data=="object"?b.data:{})??{};n(JSON.stringify(y.permissions??{}))};u.useEffect(()=>{g()},[m]);const h=u.useMemo(()=>fs.filter(b=>rt(c,b.id,b.name,b.description)),[c]),f=async b=>{if(!m)return;i(b.id),d(null);const y=await window.api.config.readJson(m),k=(y.data&&typeof y.data=="object"?y.data:{})??{},w=await window.api.config.writeJson(m,{...k,permissions:b.permissions});if(i(null),!w.ok){d(w.error??"write failed");return}r(`applied ${b.id} — replaces existing permissions block`),setTimeout(()=>r(null),3e3),g()};return t?e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(at,{query:c,onQueryChange:p,count:h.length,total:fs.length}),(a||l)&&e.jsx("div",{className:`px-4 py-2 text-xs border-b border-line ${l?"text-red-400 bg-red-950/20":"text-accent bg-bg-elev"}`,children:l??a}),e.jsxs("div",{className:"flex-1 overflow-auto divide-y divide-line",children:[h.map(b=>{const y=s===JSON.stringify(b.permissions),k=[];return b.permissions.allow&&k.push(`${b.permissions.allow.length} allow`),b.permissions.deny&&k.push(`${b.permissions.deny.length} deny`),b.permissions.ask&&k.push(`${b.permissions.ask.length} ask`),b.permissions.defaultMode&&k.push(`mode: ${b.permissions.defaultMode}`),e.jsxs("div",{className:"px-4 py-3 flex items-start gap-3 hover:bg-bg-elev/50",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-fg text-xs font-medium",children:b.name}),y&&e.jsx(ye,{tone:"accent",children:"active"}),e.jsx(ye,{tone:"warn",children:"replaces permissions"})]}),e.jsx("div",{className:"text-fg-dim text-xs mt-0.5",children:b.description}),e.jsx("div",{className:"text-fg-faint text-[10px] font-mono mt-1 truncate",children:k.join(" · ")})]}),e.jsx("div",{className:"flex gap-1 shrink-0",children:e.jsx("button",{disabled:o===b.id,onClick:()=>f(b),className:"px-2 py-0.5 text-xs border border-accent rounded text-accent hover:bg-accent hover:text-bg",children:o===b.id?"…":"apply"})})]},b.id)}),h.length===0&&e.jsx(K,{title:"no matches"})]})]}):e.jsx(K,{title:"loading…"})}function cl({path:t,disabled:s=!1}){const[n,o]=u.useState(!1),i=G(p=>{var m;return((m=p.files[t])==null?void 0:m.draftRaw)??""}),a=G(p=>p.setDraft),r=u.useMemo(()=>new Set(cn(i)),[i]),l=u.useMemo(()=>pi(i,Nt),[i]),d=l.length>0,c=s||d;return e.jsxs("div",{className:"relative","data-testid":"insert-preset-menu",children:[e.jsx("button",{type:"button","data-testid":"insert-preset-button",disabled:s,onClick:()=>o(p=>!p),className:"px-2 py-0.5 text-xs rounded border border-line text-fg-dim hover:text-fg hover:bg-bg-hi disabled:opacity-50",title:d?"Locked: unmanaged sections collide with presets":"Insert a preset into CLAUDE.md",children:"Insert preset ▾"}),n&&e.jsxs("div",{className:`absolute left-0 top-full mt-1 ${je.dialog} w-80 max-h-96 overflow-auto rounded border border-line bg-bg-elev shadow-lg`,children:[d&&e.jsxs("div",{"data-testid":"insert-preset-locked",className:"px-3 py-2 text-[11px] text-yellow-500/90 border-b border-line",children:["Locked — unmanaged sections collide with presets: ",l.map(p=>`# ${p}`).join(" · "),". Remove them from the document first."]}),Nt.map(p=>{const m=r.has(p.id);return e.jsxs("button",{type:"button","data-testid":`insert-preset-${p.id}`,disabled:c,onClick:()=>a(t,di(i,p.id,Nt)),className:"w-full text-left px-3 py-1.5 text-xs flex items-center gap-2 hover:bg-bg-hi disabled:opacity-50 disabled:hover:bg-transparent",title:p.description,children:[e.jsx("span",{className:"flex-1 truncate text-fg",children:p.name}),e.jsx("span",{className:m?"text-accent":"text-fg-faint",children:m?"on":"off"})]},p.id)})]})]})}function at({query:t,onQueryChange:s,count:n,total:o}){return e.jsxs("div",{className:"shrink-0 border-b border-line bg-bg-elev px-3 py-1.5 flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-fg-faint",children:n===o?`${o} available`:`${n} of ${o}`}),e.jsx("div",{className:"flex-1"}),e.jsx("input",{value:t,onChange:i=>s(i.target.value),placeholder:"filter…",className:"bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg w-48"})]})}function Qt({href:t,children:s}){return e.jsx("a",{href:t,target:"_blank",rel:"noreferrer",className:"px-2 py-0.5 text-xs border border-line rounded text-fg-dim hover:text-fg hover:bg-bg-hi",children:s})}function gi({id:t,marketplace:s,installed:n,onDone:o}){const[i,a]=u.useState("idle"),[r,l]=u.useState([]),[d,c]=u.useState(!1),p=u.useRef(!0);u.useEffect(()=>()=>{p.current=!1},[]),u.useEffect(()=>{const g=window.api.plugins.onInstallProgress(({slug:h,line:f})=>{h===t&&l(b=>{const y=[...b,f];return y.length>200?y.slice(y.length-200):y})});return()=>g()},[t]);const m=async()=>{a("running"),l([]),c(!0);try{const g=await window.api.plugins.install({slug:t,marketplace:s});if(!p.current){g.ok?(W.info(`Installed ${t}`),o()):W.error(`Install failed: ${t} (exit ${g.exitCode})${g.error?` — ${g.error}`:""}`);return}g.ok?(a("idle"),W.info(`Installed ${t}`),o()):(a("error"),W.error(`Install failed: ${t} (exit ${g.exitCode})${g.error?` — ${g.error}`:""}`))}catch(g){if(!p.current){W.error(`Install error: ${t} — ${g instanceof Error?g.message:String(g)}`);return}a("error"),W.error(`Install error: ${t} — ${g instanceof Error?g.message:String(g)}`)}};return n?e.jsx("button",{disabled:!0,className:"px-2 py-0.5 text-xs border border-line rounded text-fg-faint bg-bg-elev cursor-default",children:"installed"}):e.jsxs("div",{className:"flex flex-col items-end gap-1",children:[e.jsx("button",{onClick:m,disabled:i==="running",className:`px-2 py-0.5 text-xs border rounded ${i==="running"?"border-line text-fg-faint bg-bg-elev cursor-not-allowed":"border-accent/50 text-accent hover:bg-accent hover:text-bg"}`,children:i==="running"?"installing…":i==="error"?"retry":"install"}),r.length>0&&e.jsx("button",{onClick:()=>c(g=>!g),className:"text-[10px] text-fg-faint hover:text-fg-dim",children:d?"hide log":"show log"}),d&&r.length>0&&e.jsx("pre",{className:"mt-0.5 max-h-40 w-72 overflow-auto bg-bg-elev border border-line rounded p-2 text-fg-faint font-mono text-[10px] whitespace-pre-wrap text-left",children:r.join(`
58
+ `)})]})}function dn({text:t,label:s}){const[n,o]=u.useState(!1);return e.jsx("button",{onClick:()=>{Hs(t).then(i=>{if(!i){W.error("Copy failed");return}o(!0),setTimeout(()=>o(!1),1500)})},className:"px-2 py-0.5 text-xs border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg",children:n?"copied!":s})}const yi="http://json-schema.org/draft-07/schema#",bi="https://json.schemastore.org/claude-code-settings.json",xi={permissionRule:{type:"string",description:`Tool permission rule.
59
59
  See https://code.claude.com/docs/en/settings#permission-rule-syntax
60
- See https://code.claude.com/docs/en/tools-reference for full list of tools available to Claude.`,pattern:"^((Agent|Artifact|Bash|Cd|Edit|EnterWorktree|ExitPlanMode|Glob|Grep|KillShell|LSP|Monitor|MultiEdit|NotebookEdit|PowerShell|Read|ShareOnboardingGuide|Skill|TaskCreate|TaskGet|TaskList|TaskOutput|TaskStop|TaskUpdate|TodoWrite|ToolSearch|WebFetch|WebSearch|Workflow|Write)(\\([^)]+\\))?|mcp__.*)$",examples:["Bash","Bash(npm run build)","Bash(git commit *)","Bash(npm run *)","Bash(ls*)","Bash(git * main)","Edit","Edit(/src/**/*.ts)","Read(*)","Skill(*)","Read(./.env)","Read(./secrets/**)","Read(//Users/alice/secrets/**)","Read(~/Documents/*.pdf)","Agent(Explore)","WebFetch","WebFetch(domain:example.com)","mcp__puppeteer","mcp__github__search_repositories"]},hookCommand:{anyOf:[{type:"object",description:"Bash command hook",additionalProperties:!1,required:["type","command"],properties:{type:{type:"string",description:"Hook type",const:"command"},command:{type:"string",description:"Shell command to execute",minLength:1},timeout:{type:"number",description:"Optional timeout in seconds (default: 600; lowered to 30 on UserPromptSubmit and 10 on MessageDisplay)",exclusiveMinimum:0},async:{type:"boolean",description:"Run this hook asynchronously without blocking Claude Code"},asyncRewake:{type:"boolean",description:"When true, the hook runs in the background and wakes the model when it exits with code 2. Implies async."},shell:{type:"string",enum:["bash","powershell"],description:'Shell interpreter for the command. "bash" uses the login shell (bash/zsh/sh); "powershell" uses pwsh. Defaults to bash.'},if:{type:"string",description:'Optional permission-rule-syntax filter (e.g., "Bash(git *)"). Evaluated only on tool-related events (PreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest, PermissionDenied); on other events a hook with `if` set never runs. See https://code.claude.com/docs/en/hooks-guide#filter-hooks-with-matchers'},statusMessage:{type:"string",description:"Custom spinner message displayed while the hook runs"},args:{type:"array",items:{type:"string"},description:"Argument list for exec form. When present, spawns the command directly without shell interpretation — each element is passed as-is, so path placeholders never need quoting. See https://code.claude.com/docs/en/hooks#command-hook-fields"}}},{type:"object",description:"LLM prompt hook. See https://code.claude.com/docs/en/hooks#prompt-based-hooks",additionalProperties:!1,required:["type","prompt"],properties:{type:{type:"string",description:"Hook type",const:"prompt"},prompt:{type:"string",description:"Prompt to evaluate with LLM. Use $ARGUMENTS placeholder for hook input JSON.",minLength:1},model:{type:"string",description:"Model to use for evaluation. Defaults to a fast model"},timeout:{type:"number",description:"Optional timeout in seconds (default: 30)",exclusiveMinimum:0},if:{type:"string",description:"Optional permission-rule-syntax filter. Evaluated only on tool-related events (PreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest, PermissionDenied); on other events a hook with `if` set never runs. See https://code.claude.com/docs/en/hooks-guide#filter-hooks-with-matchers"},statusMessage:{type:"string",description:"Custom spinner message displayed while the hook runs"},continueOnBlock:{type:"boolean",default:!1,description:'When the prompt returns ok: false, feed the reason back to Claude and continue the turn instead of stopping. Implemented as continue: true on the resulting decision: "block". See https://code.claude.com/docs/en/hooks#prompt-hook-configuration'}}},{type:"object",description:"Agent hook with multi-turn tool access for verification. See https://code.claude.com/docs/en/hooks#agent-based-hooks",additionalProperties:!1,required:["type","prompt"],properties:{type:{type:"string",description:"Hook type",const:"agent"},prompt:{type:"string",description:"Prompt describing what to verify. Use $ARGUMENTS placeholder for hook input JSON.",minLength:1},model:{type:"string",description:"Model to use for evaluation. Defaults to a fast model"},timeout:{type:"number",description:"Optional timeout in seconds (default: 60)",exclusiveMinimum:0},if:{type:"string",description:"Optional permission-rule-syntax filter. Evaluated only on tool-related events (PreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest, PermissionDenied); on other events a hook with `if` set never runs. See https://code.claude.com/docs/en/hooks-guide#filter-hooks-with-matchers"},statusMessage:{type:"string",description:"Custom spinner message displayed while the hook runs"}}},{type:"object",description:"HTTP webhook hook. POST JSON to a URL and receive JSON response. See https://code.claude.com/docs/en/hooks#http-hook-fields",additionalProperties:!1,required:["type","url"],properties:{type:{type:"string",description:"Hook type",const:"http"},url:{type:"string",description:"URL to POST hook input JSON to. Endpoint must accept POST requests and return JSON.",minLength:1},headers:{type:"object",additionalProperties:{type:"string"},description:"Custom HTTP headers (e.g., Authorization: Bearer token). Values support $VAR_NAME or ${VAR_NAME} interpolation."},allowedEnvVars:{type:"array",items:{type:"string",minLength:1},description:"List of environment variable names permitted for interpolation in headers. If not set, no env var interpolation is allowed."},timeout:{type:"number",description:"Optional timeout in seconds (default: 600; lowered to 30 on UserPromptSubmit and 10 on MessageDisplay)",exclusiveMinimum:0},if:{type:"string",description:"Optional permission-rule-syntax filter. Evaluated only on tool-related events (PreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest, PermissionDenied); on other events a hook with `if` set never runs. See https://code.claude.com/docs/en/hooks-guide#filter-hooks-with-matchers"},statusMessage:{type:"string",description:"Custom spinner message displayed while the hook runs"}}},{type:"object",description:"MCP tool hook. Call a tool on an already-connected MCP server. See https://code.claude.com/docs/en/hooks#mcp-tool-hook-fields",additionalProperties:!1,required:["type","server","tool"],properties:{type:{type:"string",description:"Hook type",const:"mcp_tool"},server:{type:"string",description:"Name of a configured MCP server (must already be connected)",minLength:1},tool:{type:"string",description:"Name of the tool to call on that server",minLength:1},input:{type:"object",additionalProperties:!0,description:"Arguments passed to the tool. String values support ${path} substitution from hook JSON input (e.g., ${tool_input.file_path}, ${cwd})"},timeout:{type:"number",description:"Optional timeout in seconds (default: 600; lowered to 30 on UserPromptSubmit and 10 on MessageDisplay)",exclusiveMinimum:0},if:{type:"string",description:"Optional permission-rule-syntax filter. Evaluated only on tool-related events (PreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest, PermissionDenied); on other events a hook with `if` set never runs. See https://code.claude.com/docs/en/hooks-guide#filter-hooks-with-matchers"},statusMessage:{type:"string",description:"Custom spinner message displayed while the hook runs"}}}]},hookMatcher:{type:"object",description:"Hook matcher configuration with multiple hooks",additionalProperties:!1,required:["hooks"],properties:{matcher:{type:"string",description:"Optional pattern to match event contexts, case-sensitive. Behavior depends on event type. See https://code.claude.com/docs/en/hooks#matcher-patterns for event-specific details and examples"},hooks:{type:"array",description:"Array of hooks to execute",items:{$ref:"#/$defs/hookCommand"}}}}},gi="Configuration settings for Claude Code. Learn more: https://code.claude.com/docs/en/settings",yi=!1,bi=!0,xi="object",vi=JSON.parse(`{"$schema":{"type":"string","description":"JSON Schema reference for Claude Code settings"},"apiKeyHelper":{"type":"string","description":"Path to a script that outputs authentication values. See https://code.claude.com/docs/en/settings#available-settings","examples":["/bin/generate_temp_api_key.sh"],"minLength":1},"autoMemoryEnabled":{"type":"boolean","description":"Enable automatic memory saves that capture useful context to ~/.claude/projects/<project>/memory/ (derived from the git repository, shared across worktrees). Also configurable via CLAUDE_CODE_DISABLE_AUTO_MEMORY environment variable (set to 1 to disable, 0 to enable). See https://code.claude.com/docs/en/memory#storage-location","default":true},"autoUpdatesChannel":{"type":"string","enum":["stable","latest"],"description":"Release channel to follow for updates. Use \\"stable\\" for a version that is typically about one week old and skips versions with major regressions, or \\"latest\\" (default) for the most recent release. Set DISABLE_AUTOUPDATER=1 to disable background auto-updates, or DISABLE_UPDATES=1 (added in v2.1.118) to block all update paths including manual \`claude update\`.","default":"latest"},"awsCredentialExport":{"type":"string","description":"Command that outputs AWS credentials as JSON (in the form {\\"Credentials\\": {\\"AccessKeyId\\": ..., \\"SecretAccessKey\\": ..., \\"SessionToken\\": ...}}). The output is captured silently. Use when you cannot modify the .aws directory and must return credentials directly. See https://code.claude.com/docs/en/amazon-bedrock#advanced-credential-configuration","examples":["/bin/generate_aws_grant.sh"],"minLength":1},"awsAuthRefresh":{"type":"string","description":"Command to run when AWS credentials are expired or unavailable; its output is shown to the user but interactive input is not supported. Also drives the \\"Claude Platform on AWS · refresh credentials\\" option in /login when configured. See https://code.claude.com/docs/en/amazon-bedrock#advanced-credential-configuration","examples":["aws sso login --profile myprofile"],"minLength":1},"claudeMdExcludes":{"type":"array","items":{"type":"string","minLength":1},"description":"Glob patterns for CLAUDE.md files to exclude from loading. Useful in monorepos to skip irrelevant instructions from other teams. Patterns match against absolute file paths. Arrays merge across settings layers. Managed policy CLAUDE.md files cannot be excluded. See https://code.claude.com/docs/en/memory#exclude-specific-claude-md-files","examples":[["**/monorepo/CLAUDE.md","/home/user/monorepo/other-team/.claude/rules/**"]]},"cleanupPeriodDays":{"type":"integer","minimum":1,"description":"Number of days to retain sessions, orphaned subagent worktrees, tasks, shell snapshots, and backups. Minimum is 1; setting 0 is rejected with a validation error. See https://code.claude.com/docs/en/settings#available-settings","examples":[20,30,60],"default":30},"env":{"type":"object","description":"Environment variables to set for Claude Code sessions. Many environment variables provide settings dimensions not available as dedicated settings.json properties (e.g., thinking tokens, prompt caching, bash timeouts, shell configuration). See https://code.claude.com/docs/en/settings#environment-variables for the full list.","examples":[{"ANTHROPIC_MODEL":"claude-opus-4-1","ANTHROPIC_SMALL_FAST_MODEL":"claude-3-5-haiku-latest"}],"default":{},"properties":{"ANTHROPIC_API_KEY":{"type":"string","description":"API key for Anthropic API authentication"},"ANTHROPIC_AUTH_TOKEN":{"type":"string","description":"Custom Authorization header bearer token for API requests"},"ANTHROPIC_AWS_API_KEY":{"type":"string","description":"Workspace API key for Claude Platform on AWS; takes precedence over SigV4 authentication. See https://code.claude.com/docs/en/claude-platform-on-aws#1-configure-aws-credentials"},"ANTHROPIC_AWS_BASE_URL":{"type":"string","description":"Override the Claude Platform on AWS endpoint URL. Default is https://aws-external-anthropic.{region}.api.aws. See https://code.claude.com/docs/en/claude-platform-on-aws#route-through-a-corporate-proxy"},"ANTHROPIC_AWS_WORKSPACE_ID":{"type":"string","description":"Required workspace ID for Claude Platform on AWS; sent as the anthropic-workspace-id header on every request. See https://code.claude.com/docs/en/claude-platform-on-aws#2-configure-claude-code"},"ANTHROPIC_BASE_URL":{"type":"string","description":"Override API endpoint URL for proxy or gateway routing"},"ANTHROPIC_BEDROCK_BASE_URL":{"type":"string","description":"Override Amazon Bedrock endpoint URL"},"ANTHROPIC_BEDROCK_MANTLE_BASE_URL":{"type":"string","description":"Override Bedrock Mantle endpoint URL"},"ANTHROPIC_BEDROCK_SERVICE_TIER":{"type":"string","description":"Select Bedrock service tier; sent as X-Amzn-Bedrock-Service-Tier header. See https://code.claude.com/docs/en/amazon-bedrock#service-tiers","enum":["default","flex","priority"]},"ANTHROPIC_BETAS":{"type":"string","description":"Comma-separated beta header values to include in API requests"},"ANTHROPIC_CUSTOM_HEADERS":{"type":"string","description":"Custom HTTP headers for API requests (newline-separated 'Name: Value' pairs)"},"ANTHROPIC_CUSTOM_MODEL_OPTION":{"type":"string","description":"Custom model ID to add as an entry in the model picker"},"ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION":{"type":"string","description":"Display description for the custom model in the model picker"},"ANTHROPIC_CUSTOM_MODEL_OPTION_NAME":{"type":"string","description":"Display name for the custom model in the model picker"},"ANTHROPIC_CUSTOM_MODEL_OPTION_SUPPORTED_CAPABILITIES":{"type":"string","description":"JSON object specifying capability flags for the custom model"},"ANTHROPIC_DEFAULT_FABLE_MODEL":{"type":"string","description":"Override the default Fable-class model ID. See https://code.claude.com/docs/en/model-config#environment-variables"},"ANTHROPIC_DEFAULT_FABLE_MODEL_DESCRIPTION":{"type":"string","description":"Display description shown for the Fable model in the model picker. See https://code.claude.com/docs/en/model-config#customize-pinned-model-display-and-capabilities"},"ANTHROPIC_DEFAULT_FABLE_MODEL_NAME":{"type":"string","description":"Display name shown for the Fable model in the model picker. See https://code.claude.com/docs/en/model-config#customize-pinned-model-display-and-capabilities"},"ANTHROPIC_DEFAULT_FABLE_MODEL_SUPPORTED_CAPABILITIES":{"type":"string","description":"Comma-separated list of capabilities the pinned Fable model supports. See https://code.claude.com/docs/en/model-config#customize-pinned-model-display-and-capabilities"},"ANTHROPIC_DEFAULT_HAIKU_MODEL":{"type":"string","description":"Override default Haiku model ID"},"ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION":{"type":"string","description":"Display description shown for the Haiku model in the model picker. See https://code.claude.com/docs/en/model-config#customize-pinned-model-display-and-capabilities"},"ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME":{"type":"string","description":"Display name shown for the Haiku model in the model picker. See https://code.claude.com/docs/en/model-config#customize-pinned-model-display-and-capabilities"},"ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES":{"type":"string","description":"Comma-separated list of capabilities the pinned Haiku model supports. See https://code.claude.com/docs/en/model-config#customize-pinned-model-display-and-capabilities"},"ANTHROPIC_DEFAULT_OPUS_MODEL":{"type":"string","description":"Override default Opus model ID"},"ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION":{"type":"string","description":"Display description shown for the Opus model in the model picker. See https://code.claude.com/docs/en/model-config#customize-pinned-model-display-and-capabilities"},"ANTHROPIC_DEFAULT_OPUS_MODEL_NAME":{"type":"string","description":"Display name shown for the Opus model in the model picker. See https://code.claude.com/docs/en/model-config#customize-pinned-model-display-and-capabilities"},"ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES":{"type":"string","description":"Comma-separated list of capabilities the pinned Opus model supports. See https://code.claude.com/docs/en/model-config#customize-pinned-model-display-and-capabilities"},"ANTHROPIC_DEFAULT_SONNET_MODEL":{"type":"string","description":"Override default Sonnet model ID"},"ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION":{"type":"string","description":"Display description shown for the Sonnet model in the model picker. See https://code.claude.com/docs/en/model-config#customize-pinned-model-display-and-capabilities"},"ANTHROPIC_DEFAULT_SONNET_MODEL_NAME":{"type":"string","description":"Display name shown for the Sonnet model in the model picker. See https://code.claude.com/docs/en/model-config#customize-pinned-model-display-and-capabilities"},"ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES":{"type":"string","description":"Comma-separated list of capabilities the pinned Sonnet model supports. See https://code.claude.com/docs/en/model-config#customize-pinned-model-display-and-capabilities"},"ANTHROPIC_FOUNDRY_API_KEY":{"type":"string","description":"Microsoft Foundry authentication key"},"ANTHROPIC_FOUNDRY_AUTH_TOKEN":{"type":"string","description":"Bearer token for Microsoft Foundry authentication, such as a Microsoft Entra access token. Claude Code sends it as the Authorization: Bearer header. Takes precedence over ANTHROPIC_FOUNDRY_API_KEY and over the Azure default credential chain. Requires Claude Code v2.1.203 or later. See https://code.claude.com/docs/en/microsoft-foundry"},"ANTHROPIC_FOUNDRY_BASE_URL":{"type":"string","description":"Microsoft Foundry resource URL"},"ANTHROPIC_FOUNDRY_RESOURCE":{"type":"string","description":"Microsoft Foundry resource name"},"ANTHROPIC_MODEL":{"type":"string","description":"Model to use (e.g., 'claude-opus-4-1', 'claude-sonnet-4-5-20250514', 'opus', 'sonnet', 'haiku')"},"ANTHROPIC_SMALL_FAST_MODEL":{"type":"string","description":"DEPRECATED (prefer ANTHROPIC_DEFAULT_HAIKU_MODEL). Haiku-class model to use for background and low-complexity tasks (e.g., 'claude-3-5-haiku-latest')"},"ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION":{"type":"string","description":"Override the AWS region for the Haiku-class model on Bedrock and Bedrock Mantle. Has no effect without ANTHROPIC_DEFAULT_HAIKU_MODEL (or the deprecated ANTHROPIC_SMALL_FAST_MODEL) set on Bedrock. See https://code.claude.com/docs/en/amazon-bedrock#3-configure-claude-code"},"ANTHROPIC_VERTEX_BASE_URL":{"type":"string","description":"Override Google Cloud's Agent Platform (formerly Vertex AI) endpoint URL. Use for custom endpoints or when routing through an LLM gateway"},"ANTHROPIC_VERTEX_PROJECT_ID":{"type":"string","description":"GCP project ID for Google Cloud's Agent Platform (formerly Vertex AI) requests. Overridden by GCLOUD_PROJECT, GOOGLE_CLOUD_PROJECT, or the project in your GOOGLE_APPLICATION_CREDENTIALS credential file"},"ANTHROPIC_WORKSPACE_ID":{"type":"string","description":"Workspace ID for workload identity federation. Scopes the minted token to a specific workspace when the federation rule covers more than one. See https://code.claude.com/docs/en/env-vars"},"API_FORCE_IDLE_TIMEOUT":{"type":"string","description":"Override the 5-minute idle timeout for streaming responses (0 disables it). See https://code.claude.com/docs/en/env-vars"},"API_TIMEOUT_MS":{"type":"string","description":"Timeout for API requests in milliseconds (default: 600000, or 10 minutes; maximum: 2147483647). Increase this when requests time out on slow networks or when routing through a proxy. Values above the maximum overflow the underlying timer and cause requests to fail immediately."},"AWS_BEARER_TOKEN_BEDROCK":{"type":"string","description":"Bearer token for Bedrock API authentication"},"AWS_REGION":{"type":"string","description":"AWS region for Amazon Bedrock and Claude Platform on AWS requests (e.g. us-east-1). See https://code.claude.com/docs/en/amazon-bedrock#3-configure-claude-code"},"BASH_DEFAULT_TIMEOUT_MS":{"type":"string","description":"Default bash command timeout in milliseconds (default: 120000)"},"BASH_MAX_OUTPUT_LENGTH":{"type":"string","description":"Maximum bash output characters before truncation"},"BASH_MAX_TIMEOUT_MS":{"type":"string","description":"Maximum bash command timeout in milliseconds (default: 600000)"},"BETA_TRACING_ENDPOINT":{"type":"string","description":"Endpoint that, together with ENABLE_BETA_TRACING_DETAILED=1, activates detailed beta tracing spans (e.g. claude_code.hook). See https://code.claude.com/docs/en/monitoring-usage#traces-beta"},"CCR_FORCE_BUNDLE":{"type":"string","description":"Force local repo bundling for --remote invocations","enum":["0","1"]},"CLAUDECODE":{"type":"string","description":"Set to 1 in subprocesses Claude Code spawns (Bash and PowerShell tools, tmux sessions, hook commands, status line commands, stdio MCP server subprocesses). IDE extensions also set this in their integrated terminals. To distinguish a direct tool/hook subprocess from a stdio MCP server subprocess, use CLAUDE_CODE_CHILD_SESSION instead. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_AFK_COUNTDOWN_MS":{"type":"string","description":"How many milliseconds before auto-continue the on-screen countdown appears on an unanswered AskUserQuestion dialog. Default 20000 (20 seconds). See CLAUDE_AFK_TIMEOUT_MS. Requires Claude Code v2.1.198 or later. See https://code.claude.com/docs/en/env-vars"},"CLAUDE_AFK_TIMEOUT_MS":{"type":"string","description":"How many milliseconds of idle time before an unanswered AskUserQuestion dialog auto-continues without you. Default 60000 (60 seconds). Requires Claude Code v2.1.198 or later. See https://code.claude.com/docs/en/env-vars"},"CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS":{"type":"string","description":"Disable built-in subagent types in Agent SDK","enum":["0","1"]},"CLAUDE_AGENT_SDK_MCP_NO_PREFIX":{"type":"string","description":"Skip 'mcp__<server>__' prefix on MCP tool names in Agent SDK","enum":["0","1"]},"CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS":{"type":"string","description":"Stall timeout for background subagents in milliseconds (default 600000). The timer resets on each streaming progress event; if no progress arrives within the window the subagent is aborted and the task is marked failed, surfacing any partial result to the parent. See https://code.claude.com/docs/en/env-vars"},"CLAUDE_AUTOCOMPACT_PCT_OVERRIDE":{"type":"string","description":"Context capacity percentage threshold for auto-compaction (1-100)"},"CLAUDE_AUTO_BACKGROUND_TASKS":{"type":"string","description":"Force-enable automatic backgrounding of tasks","enum":["0","1"]},"CLAUDE_AX_SCREEN_READER":{"type":"string","description":"Set to 1 to render screen-reader friendly output: flat text without decorative borders or animations. Set to 0 to force screen-reader mode off even when axScreenReader is true. The --ax-screen-reader flag takes precedence. Requires Claude Code v2.1.181 or later. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR":{"type":"string","description":"Return to original project directory after each bash command","enum":["0","1"]},"CLAUDE_CLIENT_PRESENCE_FILE":{"type":"string","description":"Path to a file whose existence marks the user as present; while it exists, mobile push notifications are skipped (v2.1.181+). See https://code.claude.com/docs/en/env-vars"},"CLAUDE_CODE_ACCESSIBILITY":{"type":"string","description":"Keep native cursor visible for screen magnifiers and assistive tools","enum":["0","1"]},"CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD":{"type":"string","description":"Load CLAUDE.md memory files from additional directories","enum":["0","1"]},"CLAUDE_CODE_ALT_SCREEN_FULL_REPAINT":{"type":"string","description":"Force a full-screen repaint on every frame in fullscreen mode. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_ALWAYS_ENABLE_EFFORT":{"type":"string","description":"Send the effort parameter for all models, not just those with effort enabled by default. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_API_KEY_HELPER_TTL_MS":{"type":"string","description":"Credential helper refresh interval in milliseconds"},"CLAUDE_CODE_ARTIFACT_AUTO_OPEN":{"type":"string","description":"Set to 0 to stop auto-opening the browser when a new artifact is created. See https://code.claude.com/docs/en/artifacts#create-an-artifact","enum":["0","1"]},"CLAUDE_CODE_ATTRIBUTION_HEADER":{"type":"string","description":"Include attribution block in the system prompt","enum":["0","1"]},"CLAUDE_CODE_AUTO_COMPACT_WINDOW":{"type":"string","description":"Context capacity for compaction calculations in tokens"},"CLAUDE_CODE_AUTO_CONNECT_IDE":{"type":"string","description":"Override automatic IDE connection behavior","enum":["true","false"]},"CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS":{"type":"string","description":"Time in milliseconds Claude Code waits for the AWS default credential provider chain to produce credentials before the request fails with \\"AWS default-chain credential resolve timed out\\" (default: 60000). Raise it when a step in your chain legitimately needs longer, such as a browser-based SSO sign-in with MFA through a wrapper like aws-vault. Applies wherever Claude Code signs with the default chain. Requires Claude Code v2.1.207 or later. See https://code.claude.com/docs/en/amazon-bedrock#credential-caching-and-resolution-timeout"},"CLAUDE_CODE_BRIDGE_SESSION_ID":{"type":"string","description":"Set automatically in Bash tool and hook command subprocesses while the session has an active Remote Control connection, and removed when the connection ends. The value is the session's ID in session_ form, the same identifier that appears in the session's claude.ai/code URL, so a script can link back to the session that ran it. Requires Claude Code v2.1.199 or later. See https://code.claude.com/docs/en/remote-control"},"CLAUDE_CODE_CERT_STORE":{"type":"string","description":"CA certificate sources (comma-separated: 'bundled', 'system')"},"CLAUDE_CODE_CHILD_SESSION":{"type":"string","description":"Set by Claude Code to 1 in nested subprocesses (Bash, PowerShell, Monitor, hook commands, status-line commands) to distinguish nested sessions from a top-level claude launched in IDE terminals (v2.1.172+). A nested interactive claude TUI started this way is excluded from --resume, --continue, up-arrow history, and the claude agents list; non-interactive claude -p sessions still persist (override with CLAUDE_CODE_FORCE_SESSION_PERSISTENCE=1). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_CLIENT_CERT":{"type":"string","description":"Client certificate file path for mutual TLS"},"CLAUDE_CODE_CLIENT_KEY":{"type":"string","description":"Client private key file path for mutual TLS"},"CLAUDE_CODE_CLIENT_KEY_PASSPHRASE":{"type":"string","description":"Passphrase for encrypted client private key"},"CLAUDE_CODE_DEBUG_LOGS_DIR":{"type":"string","description":"Override the debug log file path. Despite the name, this is a file path, not a directory."},"CLAUDE_CODE_DEBUG_LOG_LEVEL":{"type":"string","description":"Debug log verbosity level","enum":["verbose","debug","info","warn","error"]},"CLAUDE_CODE_DISABLE_1M_CONTEXT":{"type":"string","description":"Disable 1M context window models","enum":["0","1"]},"CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING":{"type":"string","description":"Disable adaptive reasoning","enum":["0","1"]},"CLAUDE_CODE_DISABLE_ADVISOR_TOOL":{"type":"string","description":"Disable the server-side advisor tool. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_DISABLE_AGENT_VIEW":{"type":"string","description":"Turn off background agents and agent view (claude agents, --bg, /background, and the on-demand supervisor). Equivalent to the disableAgentView setting. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN":{"type":"string","description":"Disable alternate screen buffer rendering. When set to 1, keeps conversation in native scrollback instead of fullscreen renderer","enum":["0","1"]},"CLAUDE_CODE_DISABLE_ARTIFACT":{"type":"string","description":"Disable the Artifact tool. Equivalent to setting disableArtifact. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_DISABLE_ATTACHMENTS":{"type":"string","description":"Disable attachment processing","enum":["0","1"]},"CLAUDE_CODE_DISABLE_AUTO_MEMORY":{"type":"string","description":"Disable automatic memory feature","enum":["0","1"]},"CLAUDE_CODE_DISABLE_BACKGROUND_TASKS":{"type":"string","description":"Disable all background task functionality","enum":["0","1"]},"CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_GUARD":{"type":"string","description":"Set to 1 to skip the check that an Amazon Bedrock streaming response carries the application/vnd.amazon.eventstream content-type. Without this variable, a response with a different content-type fails with an error naming that content-type, which means a gateway or proxy is transforming the response. Set it only when the gateway rewrites the Content-Type header but passes the binary event-stream body through unmodified; if the body itself was transformed, requests fail with \\"Truncated event message received\\" instead. Requires Claude Code v2.1.208 or later. See https://code.claude.com/docs/en/amazon-bedrock#streaming-errors-behind-a-gateway-or-proxy","enum":["0","1"]},"CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF":{"type":"string","description":"Set to 1 to stop a background session's running background shell commands, dynamic workflows, and (as of v2.1.198) background subagents when the supervisor stops, restarts, or updates that session's process, instead of handing them off to the session's next process. Affects only that handoff; CLAUDE_DISABLE_ADOPT turns off both. Requires Claude Code v2.1.196 or later. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP":{"type":"string","description":"UNDOCUMENTED. Disable automatic memory-pressure reaping of idle background shell commands (added v2.1.193).","enum":["0","1"]},"CLAUDE_CODE_DISABLE_BUNDLED_SKILLS":{"type":"string","description":"Disable the skills and workflows bundled with Claude Code (plugins and project .claude/skills are unaffected). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_DISABLE_CLAUDE_MDS":{"type":"string","description":"Prevent loading CLAUDE.md memory files","enum":["0","1"]},"CLAUDE_CODE_DISABLE_CRON":{"type":"string","description":"Disable scheduled/cron tasks","enum":["0","1"]},"CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS":{"type":"string","description":"Strip anthropic-beta headers from API requests. See https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md#21123","enum":["0","1"]},"CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS":{"type":"string","description":"Set to 1 to disable the built-in Explore and Plan subagents. Requires Claude Code v2.1.198 or later. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_DISABLE_FAST_MODE":{"type":"string","description":"Disable fast mode toggle","enum":["0","1"]},"CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY":{"type":"string","description":"Disable session quality feedback surveys","enum":["0","1"]},"CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING":{"type":"string","description":"Disable file checkpointing for /rewind","enum":["0","1"]},"CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS":{"type":"string","description":"Remove git commit and PR workflow instructions from the system prompt","enum":["0","1"]},"CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP":{"type":"string","description":"Prevent automatic remapping of legacy model names","enum":["0","1"]},"CLAUDE_CODE_DISABLE_MOUSE":{"type":"string","description":"Disable mouse tracking in fullscreen mode. See https://code.claude.com/docs/en/fullscreen#keep-native-text-selection","enum":["0","1"]},"CLAUDE_CODE_DISABLE_MOUSE_CLICKS":{"type":"string","description":"Disable mouse click/drag/hover in fullscreen mode while keeping wheel scroll (requires v2.1.195+). CLAUDE_CODE_DISABLE_MOUSE takes precedence when both variables are set. See https://code.claude.com/docs/en/fullscreen#keep-native-text-selection","enum":["0","1"]},"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC":{"type":"string","description":"Disable auto-update checks, telemetry, and feedback in one setting","enum":["0","1"]},"CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK":{"type":"string","description":"Disable fallback to non-streaming API mode","enum":["0","1"]},"CLAUDE_CODE_DISABLE_NOTIFICATION_PRESENCE_CHECK":{"type":"string","description":"Set to 1 to send desktop notifications from the PushNotification tool even while focused on the terminal. Requires Claude Code v2.1.193 or later. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL":{"type":"string","description":"Skip automatic installation of official marketplace plugins. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_DISABLE_POLICY_SKILLS":{"type":"string","description":"Skip loading system-wide policy skills. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_DISABLE_TERMINAL_TITLE":{"type":"string","description":"Disable terminal title updates","enum":["0","1"]},"CLAUDE_CODE_DISABLE_THINKING":{"type":"string","description":"Force-disable extended thinking","enum":["0","1"]},"CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL":{"type":"string","description":"Disable virtual scrolling in fullscreen mode","enum":["0","1"]},"CLAUDE_CODE_DISABLE_WORKFLOWS":{"type":"string","description":"Set to 1 to disable workflows. Equivalent to the disableWorkflows setting. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_EFFORT_LEVEL":{"type":"string","description":"Reasoning effort level","enum":["low","medium","high","xhigh","max","auto"]},"CLAUDE_CODE_ENABLE_APPEND_SUBAGENT_PROMPT":{"type":"string","description":"Set to 1 to enable appending extra text to the end of every subagent's system prompt. The --append-subagent-system-prompt flag supplies the appended text and sets this variable automatically, so you do not need to set it yourself. Requires Claude Code v2.1.205 or later. See https://code.claude.com/docs/en/sub-agents","enum":["0","1"]},"CLAUDE_CODE_ENABLE_AUTO_MODE":{"type":"string","description":"Set to 1 to make auto mode available on Amazon Bedrock, Google Cloud Vertex AI, and Microsoft Foundry (requires v2.1.158+; no effect on the Anthropic API where auto mode is available by default). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_ENABLE_AWAY_SUMMARY":{"type":"string","description":"Override session recap/away summary availability","enum":["0","1"]},"CLAUDE_CODE_ENABLE_BACKGROUND_PLUGIN_REFRESH":{"type":"string","description":"Refresh plugins at turn boundaries. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL":{"type":"string","description":"Enable feedback survey collection via OpenTelemetry for enterprises","enum":["0","1"]},"CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING":{"type":"string","description":"Force fine-grained tool output streaming","enum":["0","1"]},"CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY":{"type":"string","description":"Enable model discovery from LLM gateway /v1/models endpoint when ANTHROPIC_BASE_URL points at an Anthropic-compatible gateway","enum":["0","1"]},"CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION":{"type":"string","description":"Enable prompt suggestions","enum":["true","false"]},"CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING":{"type":"string","description":"Enable file checkpointing for a non-interactive CLI run, so \`claude -p --resume <session-id> --rewind-files <checkpoint-uuid>\` can rewind files. The Agent SDK sets this internally when enable_file_checkpointing (Python) or enableFileCheckpointing (TypeScript) is enabled; the bare CLI never sets it. Without it, a non-interactive rewind fails with \\"File rewinding is not enabled\\". See https://code.claude.com/docs/en/agent-sdk/file-checkpointing"},"CLAUDE_CODE_ENABLE_TASKS":{"type":"string","description":"Enable task tracking in non-interactive mode","enum":["0","1"]},"CLAUDE_CODE_ENABLE_TELEMETRY":{"type":"string","description":"Set to 1 to enable telemetry collection. Required for all OpenTelemetry integration. See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables","enum":["0","1"]},"CLAUDE_CODE_ENHANCED_TELEMETRY_BETA":{"type":"string","description":"Enable the enhanced telemetry (tracing) beta. ENABLE_ENHANCED_TELEMETRY_BETA is also accepted. See https://code.claude.com/docs/en/monitoring-usage#traces-beta","enum":["0","1"]},"CLAUDE_CODE_EXIT_AFTER_STOP_DELAY":{"type":"string","description":"Wait time in milliseconds before auto-exit after stop"},"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS":{"type":"string","description":"Enable experimental agent teams feature","enum":["0","1"]},"CLAUDE_CODE_EXTRA_BODY":{"type":"string","description":"JSON object to merge into every API request body"},"CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS":{"type":"string","description":"Token limit for file read operations"},"CLAUDE_CODE_FORCE_SESSION_PERSISTENCE":{"type":"string","description":"Set to 1 to override the automatic exclusion of nested interactive claude TUI sessions from --resume, --continue, up-arrow history, and the claude agents list (requires v2.1.172+). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_FORCE_STRIKETHROUGH":{"type":"string","description":"Set to 1 to force strikethrough rendering for ~~text~~ in Claude's responses when the terminal supports it but is not auto-detected, such as over SSH without TERM_PROGRAM forwarded. Without this, undetected terminals show the literal ~~ markers. Requires Claude Code v2.1.186 or later. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_FORCE_SYNC_OUTPUT":{"type":"string","description":"Force synchronous output flushing. When set to 1, forces synchronized output on terminals that auto-detection misses (e.g., Emacs eat)","enum":["0","1"]},"CLAUDE_CODE_FORK_SUBAGENT":{"type":"string","description":"Fork subagent processes in non-interactive sessions. See https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md#21120","enum":["0","1"]},"CLAUDE_CODE_FORWARD_SUBAGENT_TEXT":{"type":"string","description":"Set to 1 to emit subagent text and thinking blocks in claude -p --output-format stream-json output, the same behavior as the --forward-subagent-text flag. Use the variable when a harness invokes claude and cannot pass the flag itself. Unlike the flag, which exits with an error outside non-interactive mode with stream-json output, the variable is ignored there so that nested invocations keep working when it is set process-wide. Requires Claude Code v2.1.211 or later. See https://code.claude.com/docs/en/sub-agents","enum":["0","1"]},"CLAUDE_CODE_GIT_BASH_PATH":{"type":"string","description":"Path to Git Bash executable (Windows only)"},"CLAUDE_CODE_GLOB_HIDDEN":{"type":"string","description":"Include dotfiles/hidden files in Glob results","enum":["true","false"]},"CLAUDE_CODE_GLOB_NO_IGNORE":{"type":"string","description":"Don't respect .gitignore rules in Glob results","enum":["true","false"]},"CLAUDE_CODE_GLOB_TIMEOUT_SECONDS":{"type":"string","description":"Glob tool timeout in seconds (default: 20-60)"},"CLAUDE_CODE_HIDE_CWD":{"type":"string","description":"Hide the working directory in the startup logo. See https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md#21126","enum":["0","1"]},"CLAUDE_CODE_IDE_HOST_OVERRIDE":{"type":"string","description":"Override IDE connection address"},"CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL":{"type":"string","description":"Skip automatic IDE extension installation","enum":["0","1"]},"CLAUDE_CODE_IDE_SKIP_VALID_CHECK":{"type":"string","description":"Skip IDE lockfile validation","enum":["0","1"]},"CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS":{"type":"string","description":"How many subagents can be running in one session before the Agent tool refuses to spawn another (default: 20). Accepts a positive whole number in plain digits; anything else is ignored, so the variable can adjust the cap but cannot disable it. Requires Claude Code v2.1.217 or later. See https://code.claude.com/docs/en/sub-agents#concurrent-subagent-limit"},"CLAUDE_CODE_MAX_CONTEXT_TOKENS":{"type":"string","description":"Override context window size in tokens"},"CLAUDE_CODE_MAX_OUTPUT_TOKENS":{"type":"string","description":"Maximum output tokens per API request"},"CLAUDE_CODE_MAX_RETRIES":{"type":"string","description":"Maximum API request retry attempts (default: 10)"},"CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION":{"type":"string","description":"Cap on the number of subagents one session can spawn with the Agent tool (default: 200). When Claude reaches the cap, spawning another subagent fails with an error telling Claude to finish the remaining work directly. Accepts a positive whole number in plain digits with no upper bound; this variable does not take the scientific notation or digit-separator spellings. Anything else is ignored and the default applies, so the cap can be raised but not turned off. Requires Claude Code v2.1.212 or later. See https://code.claude.com/docs/en/sub-agents#session-subagent-limit"},"CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH":{"type":"string","description":"Number of subagent layers allowed below the main conversation (default: 1). At the default, subagents cannot spawn their own subagents; set 2 or higher to allow it. Accepts a positive whole number in plain digits; anything else is ignored, so the limit can be raised but not turned off. Requires Claude Code v2.1.217 or later. See https://code.claude.com/docs/en/sub-agents#let-subagents-spawn-their-own-subagents"},"CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY":{"type":"string","description":"Maximum parallel tool executions (default: 10)"},"CLAUDE_CODE_MAX_TURNS":{"type":"string","description":"Cap the number of agentic turns when no explicit limit is passed. Equivalent to --max-turns, which takes precedence. A non-positive integer is rejected at startup. See https://code.claude.com/docs/en/env-vars"},"CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION":{"type":"string","description":"Cap on the total number of WebSearch calls one session can make (default: 200). When Claude reaches the cap, further WebSearch calls return a notice telling it to continue with the information it already gathered. Accepts a positive whole number with no upper bound. Anything else is ignored and the default applies, so the cap can be raised but not turned off. Requires Claude Code v2.1.212 or later. See https://code.claude.com/docs/en/tools-reference#websearch-tool-behavior"},"CLAUDE_CODE_MCP_ALLOWLIST_ENV":{"type":"string","description":"Isolate MCP server environments to allowlisted variables","enum":["0","1"]},"CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS":{"type":"string","description":"Elapsed time in milliseconds before a still-running MCP tool call moves to a background task (default: 120000, or 2 minutes). Set to 0 to turn automatic backgrounding off. Requires Claude Code v2.1.212 or later. See https://code.claude.com/docs/en/mcp#automatic-backgrounding-of-long-tool-calls"},"CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT":{"type":"string","description":"Idle timeout in milliseconds for MCP tool calls. When a stdio, HTTP, SSE, WebSocket, or claude.ai connector MCP server sends no response and no progress notification for this long, the tool call aborts with an error instead of waiting for the overall MCP_TOOL_TIMEOUT. Overrides the per-transport defaults of 300000 (5 minutes) for network servers and 1800000 (30 minutes) for stdio servers. Set to 0 to disable the idle check. Values below 1000 are raised to one second, and the value is capped at the effective MCP_TOOL_TIMEOUT. A per-server timeout in .mcp.json of at least 1000 raises that server's idle window to at least the timeout value. Does not apply to IDE servers or SDK in-process servers. Requires Claude Code v2.1.187 or later. Before v2.1.203, stdio servers were exempt from the idle timeout. See https://code.claude.com/docs/en/mcp"},"CLAUDE_CODE_NATIVE_CURSOR":{"type":"string","description":"Set to 1 to show the terminal's own cursor at the input caret instead of a drawn block. The cursor respects the terminal's blink, shape, and focus settings. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_NEW_INIT":{"type":"string","description":"Use the interactive /init setup flow","enum":["0","1"]},"CLAUDE_CODE_NO_FLICKER":{"type":"string","description":"Enable fullscreen rendering mode to reduce flicker","enum":["0","1"]},"CLAUDE_CODE_OAUTH_REFRESH_TOKEN":{"type":"string","description":"OAuth refresh token"},"CLAUDE_CODE_OAUTH_SCOPES":{"type":"string","description":"OAuth scopes (space-separated)"},"CLAUDE_CODE_OAUTH_TOKEN":{"type":"string","description":"OAuth access token"},"CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH":{"type":"string","description":"Maximum length of content-bearing OpenTelemetry attributes (model responses, tool content, system prompts, raw API bodies), truncation marker included, in UTF-16 code units (default: 61440, i.e. 60 KB). Raise it only if your telemetry backend accepts attribute values larger than 64 KB, or lower it to cut telemetry volume. Requires Claude Code v2.1.214 or later. See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables"},"CLAUDE_CODE_OTEL_DIAG_STDERR":{"type":"string","description":"Set to 1 to write OpenTelemetry exporter diagnostic errors to stderr (otherwise shown only with --debug). Requires v2.1.179+. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_OTEL_FLUSH_TIMEOUT_MS":{"type":"string","description":"OpenTelemetry span flush timeout in milliseconds (default: 5000)"},"CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS":{"type":"string","description":"OpenTelemetry header helper refresh interval in milliseconds"},"CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS":{"type":"string","description":"OpenTelemetry shutdown timeout in milliseconds (default: 2000)"},"CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE":{"type":"string","description":"Enable automatic package manager updates. When set, Claude Code runs the upgrade command in background on Homebrew/WinGet and prompts to restart","enum":["0","1"]},"CLAUDE_CODE_PERFORCE_MODE":{"type":"string","description":"Enable Perforce write protection mode","enum":["0","1"]},"CLAUDE_CODE_PLUGIN_CACHE_DIR":{"type":"string","description":"Override the plugins root directory. Despite the name, this sets the parent directory, not the cache itself: marketplaces and the plugin cache live in subdirectories under this path. Defaults to ~/.claude/plugins. See https://code.claude.com/docs/en/env-vars"},"CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS":{"type":"string","description":"Plugin marketplace git operations timeout in milliseconds (default: 120000). See https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md#2151"},"CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE":{"type":"string","description":"Keep plugin cache on update failure","enum":["0","1"]},"CLAUDE_CODE_PLUGIN_PREFER_HTTPS":{"type":"string","enum":["0","1"],"description":"Set to 1 to clone GitHub owner/repo plugin sources over HTTPS instead of SSH. Useful in CI runners, containers, or environments without a configured SSH key for github.com. See https://code.claude.com/docs/en/env-vars"},"CLAUDE_CODE_PLUGIN_SEED_DIR":{"type":"string","description":"Path(s) to pre-populated plugin directories. See https://code.claude.com/docs/en/plugin-marketplaces#pre-populate-plugins-for-containers"},"CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY":{"type":"string","enum":["0","1"],"description":"Set to 1 to stop Claude Code from passing -ExecutionPolicy Bypass when spawning PowerShell for tool calls, hooks, and status line commands. By default Claude Code bypasses execution policy so .ps1 scripts work on default-Restricted Windows installs. See https://code.claude.com/docs/en/env-vars"},"CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS":{"type":"string","description":"Cap, in milliseconds, on how long \`claude -p\` waits for background subagents at exit (default 10 minutes; set to 0 to wait without limit, added v2.1.182). See https://code.claude.com/docs/en/headless#background-tasks-at-exit"},"CLAUDE_CODE_PROCESS_WRAPPER":{"type":"string","description":"Launch the processes Claude Code starts from its own binary, such as the background service that hosts agent view sessions, through a corporate launcher given as an argv prefix like /opt/corp/launcher. Set it in the env block of user or managed settings, not as a shell export, so the detached background service inherits it; project and local settings cannot set it. Equivalent to the processWrapper setting, which requires Claude Code v2.1.210 or later; this variable takes precedence when both are set. The VS Code extension configures its own launcher separately through its claudeProcessWrapper setting. Ignored on Windows. Requires Claude Code v2.1.208 or later. See https://code.claude.com/docs/en/corporate-launcher"},"CLAUDE_CODE_PROPAGATE_TRACEPARENT":{"type":"string","description":"Propagate the W3C traceparent header on API requests when using a custom ANTHROPIC_BASE_URL. See https://code.claude.com/docs/en/monitoring-usage#traces-beta","enum":["0","1"]},"CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST":{"type":"string","description":"Indicate that the host application manages provider routing","enum":["0","1"]},"CLAUDE_CODE_PROXY_RESOLVES_HOSTS":{"type":"string","description":"Allow proxy to handle DNS resolution","enum":["0","1"]},"CLAUDE_CODE_REMOTE":{"type":"string","description":"Indicates a remote web environment session","enum":["true","false"]},"CLAUDE_CODE_REMOTE_SESSION_ID":{"type":"string","description":"Cloud session identifier for remote sessions"},"CLAUDE_CODE_RESUME_INTERRUPTED_TURN":{"type":"string","description":"Automatically resume from a mid-turn interruption","enum":["0","1"]},"CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS":{"type":"string","description":"Maximum age in milliseconds of the last transcript message for a session that ended mid-turn to continue automatically on resume. When the last message is older than this bound, Claude Code skips both the CLAUDE_CODE_RESUME_INTERRUPTED_TURN automatic resume and the injected CLAUDE_CODE_RESUME_PROMPT continuation message, and the session starts idle so you continue explicitly. Unset or 0 means no bound; a negative or non-numeric value applies a one-hour bound. Spawn scripts for long-running agents can set this so a restart against an old transcript does not re-run a stale prompt. Claude Code sets a one-hour bound itself when it restarts a crashed agent view session that inherited its conversation from an interactive session. Requires Claude Code v2.1.211 or later. See https://code.claude.com/docs/en/env-vars"},"CLAUDE_CODE_RESUME_PROMPT":{"type":"string","description":"Override the continuation message injected when resuming a session that ended mid-turn (default \\"Continue from where you left off.\\"). An empty string uses the default. See https://code.claude.com/docs/en/env-vars"},"CLAUDE_CODE_RETRY_WATCHDOG":{"type":"string","description":"Set to 1 for unattended sessions (eval harnesses, CI, remote workers) to retry 429/529 capacity errors indefinitely, backing off up to 5 minutes, instead of failing after CLAUDE_CODE_MAX_RETRIES. Requires v2.1.186+. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_SAFE_MODE":{"type":"string","description":"Set to 1 to start in safe mode: CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, custom keybindings, status line and file-suggestion commands, LSP servers, and auto-memory do not load, for troubleshooting a broken configuration. Managed settings policy still applies. Equivalent to passing --safe-mode; directly spawned child processes inherit the variable. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_SCRIPT_CAPS":{"type":"string","description":"Script invocation limits (JSON object)"},"CLAUDE_CODE_SCROLL_SPEED":{"type":"string","description":"Set the mouse wheel scroll multiplier in fullscreen rendering. Accepts any positive value up to 20, including fractional values below 1 such as 0.5 to slow accelerated trackpad and wheel scrolling in terminals that already amplify wheel events. Set to 3 to match vim if your terminal sends one wheel event per notch without amplification. See https://code.claude.com/docs/en/fullscreen#mouse-wheel-scrolling"},"CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS":{"type":"string","description":"Override the time budget in milliseconds for SessionEnd hooks (default 1500, raised up to 60000 by the highest configured per-hook timeout). See https://code.claude.com/docs/en/env-vars"},"CLAUDE_CODE_SESSION_ID":{"type":"string","description":"Set automatically to the current session ID in Bash/PowerShell tool subprocesses, hook command subprocesses, and stdio MCP server subprocesses. Read-only. See https://code.claude.com/docs/en/env-vars"},"CLAUDE_CODE_SHELL":{"type":"string","description":"Override automatic shell detection (e.g., '/bin/zsh', '/bin/bash')"},"CLAUDE_CODE_SHELL_PREFIX":{"type":"string","description":"Command prefix wrapper for shell commands"},"CLAUDE_CODE_SIMPLE":{"type":"string","description":"Minimal mode with core tools only","enum":["0","1"]},"CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT":{"type":"string","description":"Use a shortened system prompt","enum":["0","1"]},"CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH":{"type":"string","description":"Skip client-side SigV4 authentication for Claude Platform on AWS; use when a proxy or gateway adds authentication before forwarding. See https://code.claude.com/docs/en/claude-platform-on-aws#route-through-a-corporate-proxy","enum":["0","1"]},"CLAUDE_CODE_SKIP_AWS_CRED_CACHE":{"type":"string","description":"Set to 1 to turn off the in-process cache of credentials resolved from the AWS default credential provider chain, so Claude Code resolves the chain on every API request. With the cache off, an SSO-backed profile requests credentials from IAM Identity Center on every request. Requires Claude Code v2.1.207 or later. See https://code.claude.com/docs/en/amazon-bedrock#credential-caching-and-resolution-timeout","enum":["0","1"]},"CLAUDE_CODE_SKIP_BEDROCK_AUTH":{"type":"string","description":"Skip AWS authentication for Bedrock","enum":["0","1"]},"CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS":{"type":"string","description":"Set to 1 to treat a failed fast mode availability check as available, for networks that block the check's direct request to api.anthropic.com. Claude Code still honors a \\"disabled by your organization\\" response. See https://code.claude.com/docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways","enum":["0","1"]},"CLAUDE_CODE_SKIP_FAST_MODE_ORG_CHECK":{"type":"string","description":"Set to 1 to skip the client-side fast mode availability check, for proxies that intercept the check's request rather than refuse it. The API still rejects fast mode requests when your organization has fast mode disabled. See https://code.claude.com/docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways","enum":["0","1"]},"CLAUDE_CODE_SKIP_FOUNDRY_AUTH":{"type":"string","description":"Skip Azure authentication for Foundry","enum":["0","1"]},"CLAUDE_CODE_SKIP_MANTLE_AUTH":{"type":"string","description":"Skip AWS authentication for Bedrock Mantle (for example, when using an LLM gateway). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_SKIP_PROMPT_HISTORY":{"type":"string","description":"Disable transcript writes entirely. See https://code.claude.com/docs/en/settings#environment-variables","enum":["0","1"]},"CLAUDE_CODE_SKIP_VERTEX_AUTH":{"type":"string","description":"Skip Google authentication for Google Cloud's Agent Platform","enum":["0","1"]},"CLAUDE_CODE_STOP_HOOK_BLOCK_CAP":{"type":"string","description":"Override the default maximum consecutive Stop hook blocks (default: 8) before the turn ends with a warning. Raise this when a stop hook legitimately needs more than 8 iterations to converge. See https://code.claude.com/docs/en/hooks-guide"},"CLAUDE_CODE_SUBAGENT_MODEL":{"type":"string","description":"Override model used by subagents"},"CLAUDE_CODE_SUBPROCESS_ENV_SCRUB":{"type":"string","description":"Strip credentials from subprocess environments","enum":["0","1"]},"CLAUDE_CODE_SYNC_PLUGIN_INSTALL":{"type":"string","description":"Wait synchronously for plugin installation","enum":["0","1"]},"CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS":{"type":"string","description":"Timeout in milliseconds for synchronous plugin installation"},"CLAUDE_CODE_SYNC_SKILLS":{"type":"string","description":"Set to 1 to download enabled claude.ai skills into ~/.claude/skills/ before the first query and resync every 10 minutes (non-interactive -p mode only; requires claude.ai auth). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_SYNC_SKILLS_INSTALL_TIMEOUT_MS":{"type":"string","description":"Timeout in milliseconds for a mid-session skills resync when CLAUDE_CODE_SYNC_SKILLS is set (default 30000). See https://code.claude.com/docs/en/env-vars"},"CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS":{"type":"string","description":"Timeout in milliseconds for the first query to wait on the initial skills sync when CLAUDE_CODE_SYNC_SKILLS is set (default 5000). See https://code.claude.com/docs/en/env-vars"},"CLAUDE_CODE_SYNTAX_HIGHLIGHT":{"type":"string","description":"UNDOCUMENTED. Enable syntax highlighting in diffs","enum":["true","false"]},"CLAUDE_CODE_TASK_LIST_ID":{"type":"string","description":"Shared task list identifier for team collaboration"},"CLAUDE_CODE_TEAM_NAME":{"type":"string","description":"Agent team membership name"},"CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS":{"type":"string","description":"Override, in milliseconds, how long a non-interactive session waits at exit for its agent team to finish tearing down. Accepts 1000 to 60000; an out-of-range value is ignored and the default of 10000 applies. Requires Claude Code v2.1.206 or later. See https://code.claude.com/docs/en/agent-teams"},"CLAUDE_CODE_TMPDIR":{"type":"string","description":"Override temp directory path"},"CLAUDE_CODE_TMUX_TRUECOLOR":{"type":"string","description":"Allow 24-bit truecolor rendering in tmux","enum":["0","1"]},"CLAUDE_CODE_USE_ANTHROPIC_AWS":{"type":"string","description":"Enable Claude Platform on AWS as the API provider. Bedrock and Foundry take precedence if also set. See https://code.claude.com/docs/en/claude-platform-on-aws#2-configure-claude-code","enum":["0","1"]},"CLAUDE_CODE_USE_BEDROCK":{"type":"string","description":"Enable Amazon Bedrock as the API provider. See https://code.claude.com/docs/en/amazon-bedrock#3-configure-claude-code","enum":["0","1"]},"CLAUDE_CODE_USE_FOUNDRY":{"type":"string","description":"Enable Microsoft Foundry as the API provider. See https://code.claude.com/docs/en/microsoft-foundry#3-configure-claude-code","enum":["0","1"]},"CLAUDE_CODE_USE_MANTLE":{"type":"string","description":"Enable the Mantle endpoint (native Anthropic API shape on Bedrock). See https://code.claude.com/docs/en/amazon-bedrock#enable-mantle","enum":["0","1"]},"CLAUDE_CODE_USE_NATIVE_FILE_SEARCH":{"type":"string","description":"Set to 1 to discover custom commands, subagents, and output styles using Node.js file APIs instead of ripgrep (for environments where the bundled ripgrep is unavailable). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_USE_POWERSHELL_TOOL":{"type":"string","description":"Enable PowerShell as default shell for interactive commands (Windows)","enum":["0","1"]},"CLAUDE_CODE_USE_VERTEX":{"type":"string","description":"Enable Google Cloud's Agent Platform as the API provider. See https://code.claude.com/docs/en/google-vertex-ai#4-configure-claude-code","enum":["0","1"]},"CLAUDE_CONFIG_DIR":{"type":"string","description":"Override the configuration directory (default ~/.claude) where settings, credentials, session history, and plugins are stored. Useful for running multiple accounts side by side. See https://code.claude.com/docs/en/env-vars"},"CLAUDE_DISABLE_ADOPT":{"type":"string","description":"Set to 1 to stop in-flight background work instead of carrying it over when you background a session by pressing ← or with /background. Claude Code asks you to confirm before backgrounding, then stops the tasks that would otherwise carry over. Requires Claude Code v2.1.195 or later. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_EFFORT":{"type":"string","enum":["low","medium","high","xhigh","max"],"description":"Set automatically in Bash tool subprocesses and hook commands to the active effort level for the turn (low, medium, high, xhigh, or max; ultracode reports as xhigh). Read-only. See https://code.claude.com/docs/en/env-vars"},"CLAUDE_ENABLE_BYTE_WATCHDOG":{"type":"string","description":"Set to 1 to force-enable, or 0 to force-disable, the byte-level streaming idle watchdog that aborts a connection when no bytes arrive within the configured timeout. Enabled by default on direct Anthropic API and Claude Platform on AWS connections. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK":{"type":"string","description":"Set to 1 to enable the byte-level streaming idle watchdog on Amazon Bedrock eventstream responses (off by default). Configure the timeout with CLAUDE_STREAM_IDLE_TIMEOUT_MS. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_ENABLE_STREAM_WATCHDOG":{"type":"string","description":"Set to 1 to force-enable, or 0 to force-disable, the event-level streaming idle watchdog. When unset, the watchdog is on by default for all providers (as of v2.1.196; before that the unset default was server-controlled on the direct Anthropic API and off on other providers). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_ENV_FILE":{"type":"string","description":"File path for persisting environment variables across Bash commands"},"CLAUDE_PID":{"type":"string","description":"Claude Code sets this to its own process ID in the subprocesses it spawns: Bash and PowerShell tool commands and hook commands. On Linux, the Bash tool's shell integration uses it to refuse a pkill pattern that would match the Claude Code process itself. Read it from your own scripts to identify or signal the parent Claude Code process deliberately. Requires Claude Code v2.1.214 or later. See https://code.claude.com/docs/en/errors#pkill-pattern-matches-the-claude-code-process"},"CLAUDE_PROJECT_DIR":{"type":"string","description":"Project root directory path (also provided to hooks)"},"CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX":{"type":"string","description":"Prefix for auto-generated Remote Control session names when no explicit name is set. Defaults to the machine hostname, producing names like myhost-graceful-unicorn. See https://code.claude.com/docs/en/remote-control#start-a-remote-control-session"},"CLAUDE_STREAM_IDLE_TIMEOUT_MS":{"type":"string","description":"Timeout in milliseconds before the streaming idle watchdog closes a stalled connection. When set explicitly the minimum is 300000 (5 minutes); lower values are clamped. See https://code.claude.com/docs/en/env-vars"},"CLOUD_ML_REGION":{"type":"string","description":"Google Cloud's Agent Platform region: global, a multi-region location (eu, us), or a specific region (e.g. us-east5). See https://code.claude.com/docs/en/google-vertex-ai#region-configuration"},"DEBUG":{"type":"string","description":"Set to a truthy value (1, true, yes, or on) to enable debug mode, equivalent to --debug. Logs are written to ~/.claude/debug/<session-id>.txt. See https://code.claude.com/docs/en/env-vars"},"DISABLE_AUTOUPDATER":{"type":"string","description":"Set to 1 to disable automatic background updates. Manual claude update still works; use DISABLE_UPDATES to block both. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DISABLE_AUTO_COMPACT":{"type":"string","description":"Set to 1 to disable automatic compaction when approaching the context limit. The manual /compact command remains available. Equivalent to autoCompactEnabled: false. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DISABLE_COMPACT":{"type":"string","description":"Set to 1 to disable all compaction: both automatic compaction and the manual /compact command. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DISABLE_COST_WARNINGS":{"type":"string","description":"Set to 1 to disable cost warning messages. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DISABLE_DOCTOR_COMMAND":{"type":"string","description":"Set to 1 to hide the /doctor command (useful for managed deployments). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DISABLE_ERROR_REPORTING":{"type":"string","description":"Disable Sentry error reporting","enum":["0","1"]},"DISABLE_EXTRA_USAGE_COMMAND":{"type":"string","description":"Set to 1 to hide the /usage-credits command for purchasing additional usage beyond rate limits. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DISABLE_FEEDBACK_COMMAND":{"type":"string","description":"Set to 1 to disable the /feedback command. The older name DISABLE_BUG_COMMAND is also accepted. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DISABLE_GROWTHBOOK":{"type":"string","description":"Set to 1 to disable GrowthBook feature-flag fetching and use code defaults for every flag. Telemetry stays on unless DISABLE_TELEMETRY is also set. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DISABLE_INSTALLATION_CHECKS":{"type":"string","description":"Set to 1 to disable installation warnings (use only when manually managing the installation location). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DISABLE_INSTALL_GITHUB_APP_COMMAND":{"type":"string","description":"Set to 1 to hide the /install-github-app command (already hidden on Bedrock, Vertex, or Foundry). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DISABLE_INTERLEAVED_THINKING":{"type":"string","description":"Set to 1 to prevent sending the interleaved-thinking beta header (useful when a gateway or provider does not support interleaved thinking). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DISABLE_LOGIN_COMMAND":{"type":"string","description":"Set to 1 to hide the /login command (useful when authentication is handled externally via API keys or apiKeyHelper). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DISABLE_LOGOUT_COMMAND":{"type":"string","description":"Set to 1 to hide the /logout command. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DISABLE_PROMPT_CACHING":{"type":"string","description":"Disable prompt caching for all models. See https://code.claude.com/docs/en/prompt-caching#disable-prompt-caching","enum":["0","1"]},"DISABLE_PROMPT_CACHING_FABLE":{"type":"string","description":"Disable prompt caching for Fable models only. See https://code.claude.com/docs/en/prompt-caching#disable-prompt-caching","enum":["0","1"]},"DISABLE_PROMPT_CACHING_HAIKU":{"type":"string","description":"Disable prompt caching for Haiku models only. See https://code.claude.com/docs/en/prompt-caching#disable-prompt-caching","enum":["0","1"]},"DISABLE_PROMPT_CACHING_OPUS":{"type":"string","description":"Disable prompt caching for Opus models only. See https://code.claude.com/docs/en/prompt-caching#disable-prompt-caching","enum":["0","1"]},"DISABLE_PROMPT_CACHING_SONNET":{"type":"string","description":"Disable prompt caching for Sonnet models only. See https://code.claude.com/docs/en/prompt-caching#disable-prompt-caching","enum":["0","1"]},"DISABLE_TELEMETRY":{"type":"string","description":"Set to 1 to opt out of telemetry. Also disables feature-flag fetching (same effect as DISABLE_GROWTHBOOK). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DISABLE_UPDATES":{"type":"string","description":"Block all update paths including manual updates","enum":["0","1"]},"DISABLE_UPGRADE_COMMAND":{"type":"string","description":"Set to 1 to hide the /upgrade command. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DO_NOT_TRACK":{"type":"string","description":"Set to 1 to opt out of telemetry (cross-tool convention; equivalent to DISABLE_TELEMETRY). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"ENABLE_BETA_TRACING_DETAILED":{"type":"string","description":"Emit detailed spans including hook execution when the tracing beta is enabled. See https://code.claude.com/docs/en/monitoring-usage#traces-beta","enum":["0","1"]},"ENABLE_CLAUDEAI_MCP_SERVERS":{"type":"string","description":"Opt in/out of claude.ai MCP servers. See https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md#2163","enum":["true","false"]},"ENABLE_PROMPT_CACHING_1H":{"type":"string","description":"Request a 1-hour prompt cache TTL instead of the 5-minute default (billed at a higher rate). See https://code.claude.com/docs/en/prompt-caching#cache-lifetime","enum":["0","1"]},"ENABLE_TOOL_SEARCH":{"type":"string","description":"Control MCP tool search: \\"true\\" always defers and sends the beta header (requests fail on Google Cloud's Agent Platform models earlier than Sonnet 4.5/Opus 4.5 or on proxies that do not support tool_reference); \\"auto\\" loads tools upfront if they fit within 10% of context; \\"auto:N\\" sets a custom threshold percentage (e.g. auto:5); \\"false\\" loads all tools upfront. Also applies when ANTHROPIC_BASE_URL points to a non-first-party host. See https://code.claude.com/docs/en/google-vertex-ai#4-configure-claude-code"},"FALLBACK_FOR_ALL_PRIMARY_MODELS":{"type":"string","description":"Set to any non-empty value to make all models (not only Opus) stop retrying with a repeated-overload error when no fallback model is configured. See https://code.claude.com/docs/en/env-vars"},"FORCE_AUTOUPDATE_PLUGINS":{"type":"string","description":"Keep plugin auto-updates enabled even when DISABLE_AUTOUPDATER=1 is set. See https://code.claude.com/docs/en/discover-plugins#configure-auto-updates","enum":["0","1"]},"FORCE_HYPERLINK":{"type":"string","description":"Set to 1 to enable clickable OSC 8 hyperlinks when your terminal supports them but is not auto-detected, or 0 to disable them","enum":["0","1"]},"FORCE_PROMPT_CACHING_5M":{"type":"string","description":"Force a 5-minute cache TTL regardless of authentication method; overrides ENABLE_PROMPT_CACHING_1H or a managed-settings TTL. See https://code.claude.com/docs/en/prompt-caching#override-the-ttl","enum":["0","1"]},"GOOGLE_APPLICATION_CREDENTIALS":{"type":"string","description":"Path to a GCP credential configuration file (service account key or workload identity federation config) used for Google Cloud's Agent Platform authentication. See https://code.claude.com/docs/en/google-vertex-ai#3-configure-gcp-credentials"},"HTTPS_PROXY":{"type":"string","description":"HTTPS proxy URL (recommended over HTTP_PROXY)"},"HTTP_PROXY":{"type":"string","description":"HTTP proxy URL"},"IS_DEMO":{"type":"string","description":"Set to 1 to enable demo mode: hides email and organization name from the header and /status output and skips onboarding. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"MAX_MCP_OUTPUT_TOKENS":{"type":"string","description":"Maximum number of tokens allowed in MCP tool output before truncation (default: 25000). Claude Code displays a warning above 10000 tokens. For tools that declare anthropic/maxResultSizeChars, that character limit replaces this token limit for text content, but image content from those tools is still subject to this limit. See https://code.claude.com/docs/en/mcp"},"MAX_STRUCTURED_OUTPUT_RETRIES":{"type":"string","description":"Number of times to retry when the model's response fails validation against --json-schema in non-interactive (-p) mode (default 5). See https://code.claude.com/docs/en/env-vars"},"MAX_THINKING_TOKENS":{"type":"string","description":"Override the extended thinking token budget; set to 0 to disable thinking on the Anthropic API. On adaptive reasoning models (Opus 4.7+, Opus 4.8, Fable 5) a nonzero budget is ignored unless CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING is set. See https://code.claude.com/docs/en/model-config#extended-thinking"},"MCP_CLIENT_SECRET":{"type":"string","description":"OAuth client secret for MCP servers that require pre-configured credentials (avoids the interactive prompt when adding a server with --client-secret). See https://code.claude.com/docs/en/env-vars"},"MCP_CONNECTION_NONBLOCKING":{"type":"string","description":"Controls whether startup waits for MCP servers to connect before the first query. Non-blocking by default since v2.1.142; set to 0 to restore the blocking 5-second connection wait. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"MCP_CONNECT_TIMEOUT_MS":{"type":"string","description":"How long blocking MCP startup waits in milliseconds for the connection batch before snapshotting the tool list (default 5000). Applies when MCP_CONNECTION_NONBLOCKING=0 or for alwaysLoad servers. See https://code.claude.com/docs/en/env-vars"},"MCP_OAUTH_CALLBACK_PORT":{"type":"string","description":"Fixed port for the OAuth redirect callback, as an alternative to --callback-port when adding an MCP server with pre-configured credentials. See https://code.claude.com/docs/en/env-vars"},"MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE":{"type":"string","description":"Maximum number of remote MCP servers (HTTP/SSE) to connect in parallel during startup (default 20). See https://code.claude.com/docs/en/env-vars"},"MCP_SERVER_CONNECTION_BATCH_SIZE":{"type":"string","description":"Maximum number of local MCP servers (stdio) to connect in parallel during startup (default 3). See https://code.claude.com/docs/en/env-vars"},"MCP_TIMEOUT":{"type":"string","description":"Timeout in milliseconds for MCP server startup (default 30000). See https://code.claude.com/docs/en/env-vars"},"MCP_TOOL_TIMEOUT":{"type":"string","description":"Timeout in milliseconds for MCP tool execution (default: 100000000, about 28 hours). A per-server timeout field in .mcp.json overrides this for that server. Values below 1000 are floored to one second. See https://code.claude.com/docs/en/mcp"},"NODE_EXTRA_CA_CERTS":{"type":"string","description":"Path to custom CA certificate file"},"NO_PROXY":{"type":"string","description":"Domains to bypass proxy (space or comma-separated, or '*' for all)"},"OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT":{"type":"string","description":"Standard OpenTelemetry SDK limit on attribute value length. Claude Code caps content-bearing telemetry attributes at the smaller of this and CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH, so the truncation marker stays within the SDK limit. Claude Code reads the OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT and OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT variants the same way, and the smallest set value applies to all signals. Requires Claude Code v2.1.214 or later. See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables"},"OTEL_EXPORTER_OTLP_CERTIFICATE":{"type":"string","description":"Path to the CA certificate for gRPC OTLP mTLS. See https://code.claude.com/docs/en/monitoring-usage#mtls-authentication"},"OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE":{"type":"string","description":"Path to the client certificate for gRPC OTLP mTLS. See https://code.claude.com/docs/en/monitoring-usage#mtls-authentication"},"OTEL_EXPORTER_OTLP_CLIENT_KEY":{"type":"string","description":"Path to the client private key for gRPC OTLP mTLS. See https://code.claude.com/docs/en/monitoring-usage#mtls-authentication"},"OTEL_EXPORTER_OTLP_ENDPOINT":{"type":"string","description":"OTLP exporter endpoint for all signals (e.g. http://localhost:4317). See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables"},"OTEL_EXPORTER_OTLP_HEADERS":{"type":"string","description":"Headers sent with OTLP exporter requests (e.g. Authorization=Bearer token). See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables"},"OTEL_EXPORTER_OTLP_LOGS_CLIENT_CERTIFICATE":{"type":"string","description":"Path to the client certificate for gRPC OTLP mTLS, overriding OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE for logs only. See https://code.claude.com/docs/en/monitoring-usage#mtls-authentication"},"OTEL_EXPORTER_OTLP_LOGS_CLIENT_KEY":{"type":"string","description":"Path to the client private key for gRPC OTLP mTLS, overriding OTEL_EXPORTER_OTLP_CLIENT_KEY for logs only. See https://code.claude.com/docs/en/monitoring-usage#mtls-authentication"},"OTEL_EXPORTER_OTLP_LOGS_ENDPOINT":{"type":"string","description":"OTLP exporter endpoint override for logs. See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables"},"OTEL_EXPORTER_OTLP_LOGS_PROTOCOL":{"type":"string","description":"OTLP protocol override for logs: grpc, http/json, or http/protobuf. See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables","enum":["grpc","http/json","http/protobuf"]},"OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE":{"type":"string","description":"Path to the client certificate for gRPC OTLP mTLS, overriding OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE for metrics only. See https://code.claude.com/docs/en/monitoring-usage#mtls-authentication"},"OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY":{"type":"string","description":"Path to the client private key for gRPC OTLP mTLS, overriding OTEL_EXPORTER_OTLP_CLIENT_KEY for metrics only. See https://code.claude.com/docs/en/monitoring-usage#mtls-authentication"},"OTEL_EXPORTER_OTLP_METRICS_ENDPOINT":{"type":"string","description":"OTLP exporter endpoint override for metrics. See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables"},"OTEL_EXPORTER_OTLP_METRICS_PROTOCOL":{"type":"string","description":"OTLP protocol override for metrics: grpc, http/json, or http/protobuf. See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables","enum":["grpc","http/json","http/protobuf"]},"OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE":{"type":"string","description":"Metrics temporality preference: delta (default) or cumulative. See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables","enum":["delta","cumulative"]},"OTEL_EXPORTER_OTLP_PROTOCOL":{"type":"string","description":"OTLP exporter protocol for all signals: grpc, http/json, or http/protobuf. See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables","enum":["grpc","http/json","http/protobuf"]},"OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE":{"type":"string","description":"Path to the client certificate for gRPC OTLP mTLS, overriding OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE for traces only. See https://code.claude.com/docs/en/monitoring-usage#mtls-authentication"},"OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY":{"type":"string","description":"Path to the client private key for gRPC OTLP mTLS, overriding OTEL_EXPORTER_OTLP_CLIENT_KEY for traces only. See https://code.claude.com/docs/en/monitoring-usage#mtls-authentication"},"OTEL_EXPORTER_OTLP_TRACES_ENDPOINT":{"type":"string","description":"OTLP exporter endpoint override for traces. See https://code.claude.com/docs/en/monitoring-usage#traces-beta"},"OTEL_EXPORTER_OTLP_TRACES_PROTOCOL":{"type":"string","description":"OTLP protocol override for traces: grpc, http/json, or http/protobuf. See https://code.claude.com/docs/en/monitoring-usage#traces-beta","enum":["grpc","http/json","http/protobuf"]},"OTEL_LOGS_EXPORTER":{"type":"string","description":"OpenTelemetry logs exporter(s) as a comma-separated list. Valid values: otlp, console, none. See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables"},"OTEL_LOGS_EXPORT_INTERVAL":{"type":"string","description":"Logs export interval in milliseconds (default 5000). See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables"},"OTEL_LOG_ASSISTANT_RESPONSES":{"type":"string","description":"UNDOCUMENTED. Include assistant response text in the claude_code.assistant_response OpenTelemetry log event (added v2.1.193). When unset, follows OTEL_LOG_USER_PROMPTS; set to 0 to keep prompts-only.","enum":["0","1"]},"OTEL_LOG_RAW_API_BODIES":{"type":"string","description":"Log raw API request/response bodies. Set to 1, or to file:<dir> to write them to a directory. See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables"},"OTEL_LOG_TOOL_CONTENT":{"type":"string","description":"Include full tool input/output content in OpenTelemetry log events (requires tracing; disabled by default). See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables","enum":["0","1"]},"OTEL_LOG_TOOL_DETAILS":{"type":"string","description":"Include tool name and parameters in OpenTelemetry log events (disabled by default). See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables","enum":["0","1"]},"OTEL_LOG_USER_PROMPTS":{"type":"string","description":"Include user prompt text in OpenTelemetry log events (disabled by default). See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables","enum":["0","1"]},"OTEL_METRICS_EXPORTER":{"type":"string","description":"OpenTelemetry metrics exporter(s) as a comma-separated list. Valid values: otlp, prometheus, console, none. See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables"},"OTEL_METRICS_INCLUDE_ACCOUNT_UUID":{"type":"string","description":"Include the user.account_uuid and user.account_id attributes on metrics (default true). See https://code.claude.com/docs/en/monitoring-usage#metrics-cardinality-control","enum":["true","false"]},"OTEL_METRICS_INCLUDE_ENTRYPOINT":{"type":"string","description":"Include the app.entrypoint attribute on metrics (default false). See https://code.claude.com/docs/en/monitoring-usage#metrics-cardinality-control","enum":["true","false"]},"OTEL_METRICS_INCLUDE_RESOURCE_ATTRIBUTES":{"type":"string","description":"Include configured OTEL_RESOURCE_ATTRIBUTES on metric data points (default true). See https://code.claude.com/docs/en/monitoring-usage#metrics-cardinality-control","enum":["true","false"]},"OTEL_METRICS_INCLUDE_SESSION_ID":{"type":"string","description":"Include the session.id attribute on metrics (default true). See https://code.claude.com/docs/en/monitoring-usage#metrics-cardinality-control","enum":["true","false"]},"OTEL_METRICS_INCLUDE_VERSION":{"type":"string","description":"Include the app.version attribute on metrics (default false). See https://code.claude.com/docs/en/monitoring-usage#metrics-cardinality-control","enum":["true","false"]},"OTEL_METRIC_EXPORT_INTERVAL":{"type":"string","description":"Metrics export interval in milliseconds (default 60000). See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables"},"OTEL_RESOURCE_ATTRIBUTES":{"type":"string","description":"Comma-separated key=value resource attributes attached to all telemetry. See https://code.claude.com/docs/en/monitoring-usage#multi-team-organization-support"},"OTEL_TRACES_EXPORTER":{"type":"string","description":"OpenTelemetry traces exporter(s) as a comma-separated list. Valid values: otlp, console, none. See https://code.claude.com/docs/en/monitoring-usage#traces-beta"},"OTEL_TRACES_EXPORT_INTERVAL":{"type":"string","description":"Traces export interval in milliseconds (default 5000). See https://code.claude.com/docs/en/monitoring-usage#traces-beta"},"SLASH_COMMAND_TOOL_CHAR_BUDGET":{"type":"string","description":"Override the character budget for skill metadata shown to the Skill tool. The budget scales dynamically at 1% of the context window, with a fallback of 8000 characters. Legacy name kept for backwards compatibility. See https://code.claude.com/docs/en/skills#control-who-invokes-a-skill"},"TASK_MAX_OUTPUT_LENGTH":{"type":"string","description":"Maximum number of characters in subagent output before truncation (default 32000, maximum 160000). When truncated, the full output is saved to disk and the path is included in the response. See https://code.claude.com/docs/en/env-vars"},"USE_BUILTIN_RIPGREP":{"type":"string","description":"Use the bundled ripgrep binary instead of system ripgrep","enum":["0","1"]},"VERTEX_REGION_CLAUDE_3_5_HAIKU":{"type":"string","description":"Override the Vertex AI region for Claude 3.5 Haiku (used when CLOUD_ML_REGION=global). See https://code.claude.com/docs/en/env-vars"},"VERTEX_REGION_CLAUDE_3_5_SONNET":{"type":"string","description":"Override the Vertex AI region for Claude 3.5 Sonnet (used when CLOUD_ML_REGION=global). See https://code.claude.com/docs/en/env-vars"},"VERTEX_REGION_CLAUDE_3_7_SONNET":{"type":"string","description":"Override the Vertex AI region for Claude 3.7 Sonnet (used when CLOUD_ML_REGION=global). See https://code.claude.com/docs/en/env-vars"},"VERTEX_REGION_CLAUDE_4_0_OPUS":{"type":"string","description":"Override the Vertex AI region for Claude 4.0 Opus (used when CLOUD_ML_REGION=global). See https://code.claude.com/docs/en/env-vars"},"VERTEX_REGION_CLAUDE_4_0_SONNET":{"type":"string","description":"Override the Vertex AI region for Claude 4.0 Sonnet (used when CLOUD_ML_REGION=global). See https://code.claude.com/docs/en/env-vars"},"VERTEX_REGION_CLAUDE_4_1_OPUS":{"type":"string","description":"Override the Vertex AI region for Claude 4.1 Opus (used when CLOUD_ML_REGION=global). See https://code.claude.com/docs/en/env-vars"},"VERTEX_REGION_CLAUDE_4_5_OPUS":{"type":"string","description":"Override the Vertex AI region for Claude Opus 4.5 (used when CLOUD_ML_REGION=global). See https://code.claude.com/docs/en/env-vars"},"VERTEX_REGION_CLAUDE_4_5_SONNET":{"type":"string","description":"Override the Vertex AI region for Claude Sonnet 4.5 (used when CLOUD_ML_REGION=global). See https://code.claude.com/docs/en/env-vars"},"VERTEX_REGION_CLAUDE_4_6_OPUS":{"type":"string","description":"Override the Vertex AI region for Claude Opus 4.6 (used when CLOUD_ML_REGION=global). See https://code.claude.com/docs/en/env-vars"},"VERTEX_REGION_CLAUDE_4_6_SONNET":{"type":"string","description":"Override the Vertex AI region for Claude Sonnet 4.6 (used when CLOUD_ML_REGION=global). See https://code.claude.com/docs/en/env-vars"},"VERTEX_REGION_CLAUDE_4_7_OPUS":{"type":"string","description":"Override the Vertex AI region for Claude Opus 4.7 (used when CLOUD_ML_REGION=global). See https://code.claude.com/docs/en/env-vars"},"VERTEX_REGION_CLAUDE_4_8_OPUS":{"type":"string","description":"Override the Vertex AI region for Claude Opus 4.8 (used when CLOUD_ML_REGION=global). See https://code.claude.com/docs/en/env-vars"},"VERTEX_REGION_CLAUDE_5_OPUS":{"type":"string","description":"Override region for Claude Opus 5 when using Google Cloud's Agent Platform (formerly Vertex AI). Added in v2.1.219. See https://code.claude.com/docs/en/google-vertex-ai"},"VERTEX_REGION_CLAUDE_5_SONNET":{"type":"string","description":"Override region for Claude Sonnet 5 when using Google Cloud's Agent Platform (formerly Vertex AI). Added in v2.1.197. See https://code.claude.com/docs/en/google-vertex-ai"},"VERTEX_REGION_CLAUDE_FABLE_5":{"type":"string","description":"Override the Vertex AI region for Claude Fable 5 (used when CLOUD_ML_REGION=global). See https://code.claude.com/docs/en/env-vars"},"VERTEX_REGION_CLAUDE_HAIKU_4_5":{"type":"string","description":"Override the Vertex AI region for Claude Haiku 4.5 (used when CLOUD_ML_REGION=global). See https://code.claude.com/docs/en/env-vars"}},"propertyNames":{"pattern":"^[A-Z_][A-Z0-9_]*$"},"additionalProperties":{"type":"string","description":"Environment variable value"}},"attribution":{"type":"object","description":"Customize attribution for git commits and pull requests. See https://code.claude.com/docs/en/settings#attribution-settings","additionalProperties":false,"properties":{"commit":{"type":"string","description":"Attribution for git commits, including any trailers. Empty string hides commit attribution"},"pr":{"type":"string","description":"Attribution for pull request descriptions. Empty string hides pull request attribution"},"sessionUrl":{"type":"boolean","description":"Whether to append the claude.ai session link as a Claude-Session trailer on commits and a link in pull request descriptions when running from a web or Remote Control session. Defaults to true; set to false to omit the link. See https://code.claude.com/docs/en/settings#attribution-settings","default":true}}},"includeGitInstructions":{"type":"boolean","description":"Include built-in git commit and PR workflow instructions in Claude's system prompt. Also configurable via CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS environment variable (set to 1 to disable). See https://code.claude.com/docs/en/settings#available-settings","default":true},"includeCoAuthoredBy":{"type":"boolean","description":"DEPRECATED. Use 'attribution' instead. Whether to include the co-authored-by Claude byline in git commits and pull requests (default: true)","default":true},"plansDirectory":{"type":"string","description":"Customize where plan files are stored. Path is relative to project root (default: ~/.claude/plans)","default":"~/.claude/plans","examples":["./plans"]},"respectGitignore":{"type":"boolean","description":"Control whether the @ file picker respects .gitignore patterns. When true (default), files matching .gitignore patterns are excluded from suggestions","default":true},"permissions":{"type":"object","properties":{"allow":{"type":"array","items":{"$ref":"#/$defs/permissionRule"},"description":"List of permission rules for allowed operations","uniqueItems":true},"deny":{"type":"array","items":{"$ref":"#/$defs/permissionRule"},"description":"List of permission rules for denied operations","uniqueItems":true},"ask":{"type":"array","items":{"$ref":"#/$defs/permissionRule"},"description":"List of permission rules that should always prompt for confirmation","uniqueItems":true},"defaultMode":{"type":"string","enum":["acceptEdits","bypassPermissions","default","delegate","dontAsk","plan","auto","manual"],"description":"Default permission mode.\\n\\"default\\": prompts on first use.\\nUNDOCUMENTED. \\"manual\\": accepted alias for \\"default\\" (the CLI/VS Code/JetBrains UI now labels this mode \\"Manual\\" as of v2.1.200; permission-modes.md has not yet been updated to mention it).\\n\\"acceptEdits\\": auto-accepts file edits.\\n\\"plan\\": read-only, no modifications.\\nUNDOCUMENTED. \\"delegate\\": coordination-only for agent team leads (agent teams are experimental; enable via CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS).\\n\\"dontAsk\\": auto-denies unless pre-approved via permissions.\\n\\"bypassPermissions\\": skips all prompts (use only in isolated environments).\\n\\"auto\\": auto-approves tool calls with background safety checks that verify actions align with your request.\\nSee https://code.claude.com/docs/en/permissions"},"disableBypassPermissionsMode":{"type":"string","enum":["disable"],"description":"Disable the ability to bypass permission prompts"},"disableAutoMode":{"type":"string","enum":["disable"],"description":"Set to \\"disable\\" to prevent auto mode from being activated. Removes \`auto\` from the Shift+Tab cycle and rejects \`--permission-mode auto\` at startup. Most useful in managed settings where users cannot override it. See https://code.claude.com/docs/en/permissions"},"additionalDirectories":{"type":"array","items":{"type":"string","minLength":1},"description":"Additional directories to include in the permission scope","examples":[["//Users/alice/Documents","~/projects"]],"uniqueItems":true}},"additionalProperties":false,"description":"Tool usage permissions configuration.\\nSee https://code.claude.com/docs/en/permissions and https://code.claude.com/docs/en/settings#permission-settings\\nSee https://code.claude.com/docs/en/tools-reference for full list of tools available to Claude.","examples":[{"allow":["Bash(git add:*)"],"ask":["Bash(gh pr create:*)","Bash(git commit:*)"],"deny":["Read(*.env)","Bash(rm:*)","Bash(curl:*)"],"defaultMode":"default"}]},"language":{"type":"string","description":"Configure Claude's preferred response language (e.g., \\"japanese\\", \\"spanish\\", \\"french\\"). Claude will respond in this language by default. Also sets the voice dictation language and terminal tab session title generation. See https://code.claude.com/docs/en/settings#available-settings","examples":["japanese","spanish","french"]},"model":{"type":"string","description":"Override the default model used by Claude Code. For finer control, use environment variables: ANTHROPIC_MODEL (runtime override), ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, ANTHROPIC_DEFAULT_HAIKU_MODEL (per-class pinning), CLAUDE_CODE_SUBAGENT_MODEL (subagent model). See https://code.claude.com/docs/en/model-config"},"availableModels":{"type":"array","items":{"type":"string"},"description":"Restrict which models users can select. When defined at multiple settings levels (user, project, etc.), arrays are merged and deduplicated. See https://code.claude.com/docs/en/model-config#restrict-model-selection","examples":[["sonnet","haiku"]]},"modelOverrides":{"type":"object","additionalProperties":{"type":"string"},"description":"Map Anthropic model IDs to provider-specific model IDs such as Bedrock inference profile ARNs, Vertex AI version names, or Foundry deployment names. Each model picker entry uses its mapped value when calling the provider API. Unknown keys are ignored. See https://code.claude.com/docs/en/model-config#override-model-ids-per-version","examples":[{"claude-opus-4-6":"arn:aws:bedrock:us-east-2:123456789012:application-inference-profile/opus-prod"}]},"effortLevel":{"type":"string","enum":["low","medium","high","xhigh"],"description":"Persist adaptive reasoning effort across sessions. Set to low, medium, high, or xhigh; max and ultracode are session-only and are not accepted in the settings file (use the CLAUDE_CODE_EFFORT_LEVEL environment variable or /effort for a session-only max). Effort is supported on Fable 5, Opus 4.8, Opus 4.7, Opus 4.6, and Sonnet 4.6, with xhigh sitting between high and max (added in v2.1.111). Defaults: Fable 5 and Opus 4.8 default to high; Opus 4.6 and Sonnet 4.6 default to high on all plans (Pro/Max raised from medium to high in v2.1.117); Opus 4.7 defaults to xhigh. Use /effort auto to reset to model default. Also configurable via CLAUDE_CODE_EFFORT_LEVEL environment variable. See https://code.claude.com/docs/en/model-config#adjust-effort-level"},"fastMode":{"type":"boolean","description":"Enable fast mode, which uses Claude Opus 5 by default (since v2.1.219) for faster output at higher per-token cost without downgrading to a smaller model. Requires extra usage enabled. Toggle with the /fast command. Supported on Opus 5 and Opus 4.8; fast mode for Opus 4.7 was deprecated on June 25, 2026 and removed on July 24, 2026. Before v2.1.219 fast mode defaulted to Opus 4.8 (v2.1.154 through v2.1.218) and to Opus 4.7 (v2.1.142 through v2.1.153). See https://code.claude.com/docs/en/fast-mode","default":false},"fastModePerSessionOptIn":{"type":"boolean","description":"Require per-session opt-in for fast mode. When true, fast mode does not persist across sessions and users must enable it with /fast each session. Useful for controlling costs. See https://code.claude.com/docs/en/fast-mode","default":false},"feedbackSurveyRate":{"type":"number","minimum":0,"maximum":1,"description":"Probability (0–1) that the session quality survey appears when eligible. A value of 0.05 means 5% of eligible sessions. See https://code.claude.com/docs/en/settings#available-settings","examples":[0.05]},"enableAllProjectMcpServers":{"type":"boolean","description":"Whether to automatically approve all MCP servers in the project. See https://code.claude.com/docs/en/mcp","examples":[true]},"enabledMcpjsonServers":{"type":"array","items":{"type":"string","minLength":1},"description":"List of approved MCP servers from .mcp.json. See https://code.claude.com/docs/en/mcp","examples":[["memory","github"]]},"disabledMcpjsonServers":{"type":"array","items":{"type":"string","minLength":1},"description":"List of rejected MCP servers from .mcp.json. See https://code.claude.com/docs/en/mcp","examples":[["filesystem"]]},"allowedMcpServers":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"serverName":{"type":"string","pattern":"^[a-zA-Z0-9_-]+$","description":"Name of the MCP server that users are allowed to configure"}},"required":["serverName"],"additionalProperties":false},{"type":"object","properties":{"serverCommand":{"type":"array","items":{"type":"string"},"description":"Exact command and arguments used to start stdio servers"}},"required":["serverCommand"],"additionalProperties":false},{"type":"object","properties":{"serverUrl":{"type":"string","description":"URL pattern for remote servers, supports wildcards (e.g., https://*.example.com/*)"}},"required":["serverUrl"],"additionalProperties":false}]},"description":"Enterprise allowlist of MCP servers that can be used. Applies to all scopes including enterprise servers from managed-mcp.json. If undefined, all servers are allowed. If empty array, no servers are allowed. Denylist takes precedence - if a server is on both lists, it is denied. See https://code.claude.com/docs/en/mcp#restriction-options"},"deniedMcpServers":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"serverName":{"type":"string","pattern":"^[a-zA-Z0-9_-]+$","description":"Name of the MCP server that is explicitly blocked"}},"required":["serverName"],"additionalProperties":false},{"type":"object","properties":{"serverCommand":{"type":"array","items":{"type":"string"},"description":"Exact command and arguments used to start stdio servers"}},"required":["serverCommand"],"additionalProperties":false},{"type":"object","properties":{"serverUrl":{"type":"string","description":"URL pattern for remote servers, supports wildcards (e.g., https://*.example.com/*)"}},"required":["serverUrl"],"additionalProperties":false}]},"description":"Enterprise denylist of MCP servers that are explicitly blocked. If a server is on the denylist, it will be blocked across all scopes including enterprise. Denylist takes precedence over allowlist - if a server is on both lists, it is denied. See https://code.claude.com/docs/en/mcp#restriction-options"},"httpHookAllowedEnvVars":{"type":"array","items":{"type":"string","minLength":1},"description":"Allowlist of environment variable names HTTP hooks may interpolate into headers. When set, each hook's effective allowedEnvVars is the intersection with this list. Undefined = no restriction. Arrays merge across settings sources. See https://code.claude.com/docs/en/settings#hook-configuration","examples":[["MY_TOKEN","HOOK_SECRET"]]},"hooks":{"type":"object","additionalProperties":false,"description":"Lifecycle event hooks that run at configurable points during Claude Code operation (tool use, session start/end, notifications, prompt submit, message display, and more), not just before/after tool executions. See https://code.claude.com/docs/en/hooks","examples":[{"PostToolUse":[{"matcher":"Edit|Write","hooks":[{"type":"command","command":"prettier --write","timeout":5}]}]}],"properties":{"PreToolUse":{"type":"array","description":"Hooks that run before tool calls","items":{"$ref":"#/$defs/hookMatcher"}},"PostToolUse":{"type":"array","description":"Hooks that run after tool completion","items":{"$ref":"#/$defs/hookMatcher"}},"PostToolUseFailure":{"type":"array","description":"Hooks that run after a tool fails","items":{"$ref":"#/$defs/hookMatcher"}},"PermissionRequest":{"type":"array","description":"Hooks that run when a permission dialog appears","items":{"$ref":"#/$defs/hookMatcher"}},"Notification":{"type":"array","description":"Hooks that trigger on notifications","items":{"$ref":"#/$defs/hookMatcher"}},"UserPromptSubmit":{"type":"array","description":"Hooks that run when a user submits a prompt","items":{"$ref":"#/$defs/hookMatcher"}},"Stop":{"type":"array","description":"Hooks that run when agents finish responding. Does not run on user interrupt","items":{"$ref":"#/$defs/hookMatcher"}},"StopFailure":{"type":"array","description":"Hooks that run when a turn ends due to an API error (e.g., rate_limit, authentication_failed, billing_error, invalid_request, server_error, max_output_tokens, unknown). Matcher can scope to specific error types. Hook output and exit code are ignored. See https://code.claude.com/docs/en/hooks","items":{"$ref":"#/$defs/hookMatcher"}},"SubagentStart":{"type":"array","description":"Hooks that run when a subagent is spawned","items":{"$ref":"#/$defs/hookMatcher"}},"SubagentStop":{"type":"array","description":"Hooks that run when subagents finish responding","items":{"$ref":"#/$defs/hookMatcher"}},"PreCompact":{"type":"array","description":"Hooks that run before the context is compacted","items":{"$ref":"#/$defs/hookMatcher"}},"PostCompact":{"type":"array","description":"Hooks that run after the context is compacted. See https://code.claude.com/docs/en/hooks","items":{"$ref":"#/$defs/hookMatcher"}},"Elicitation":{"type":"array","description":"Hooks that run when an MCP server requests user input during a tool call. See https://code.claude.com/docs/en/hooks","items":{"$ref":"#/$defs/hookMatcher"}},"ElicitationResult":{"type":"array","description":"Hooks that run after a user responds to an MCP elicitation, before the response is sent back to the server. See https://code.claude.com/docs/en/hooks","items":{"$ref":"#/$defs/hookMatcher"}},"TeammateIdle":{"type":"array","description":"Hooks that run when an agent team teammate is about to go idle. Exit code 2 sends feedback and keeps the teammate working. Does not support matchers. Agent teams are experimental. See https://code.claude.com/docs/en/hooks#teammateidle","items":{"$ref":"#/$defs/hookMatcher"}},"TaskCompleted":{"type":"array","description":"Hooks that run when a task is being marked as completed. Exit code 2 prevents completion and sends feedback. Does not support matchers. See https://code.claude.com/docs/en/hooks#taskcompleted","items":{"$ref":"#/$defs/hookMatcher"}},"Setup":{"type":"array","description":"UNDOCUMENTED. Hooks that run during repository initialization (--init, --init-only) or maintenance (--maintenance)","items":{"$ref":"#/$defs/hookMatcher"}},"InstructionsLoaded":{"type":"array","description":"Hooks that run when a CLAUDE.md or .claude/rules/*.md file is loaded into context. Fires at session start and when files are lazily loaded (e.g., nested traversal, path glob match). No decision control; used for audit logging and observability. Does not support matchers. See https://code.claude.com/docs/en/hooks#instructionsloaded","items":{"$ref":"#/$defs/hookMatcher"}},"CwdChanged":{"type":"array","description":"Hooks that run when the working directory changes. Provides cwd (new directory) and previous_cwd. Matchers are ignored; fires on every directory change. See https://code.claude.com/docs/en/hooks#cwdchanged","items":{"$ref":"#/$defs/hookMatcher"}},"FileChanged":{"type":"array","description":"Hooks that run when a watched file is created, modified, or deleted. Supports filename matchers. Provides file_path and file_event_type (created, modified, deleted). See https://code.claude.com/docs/en/hooks#filechanged","items":{"$ref":"#/$defs/hookMatcher"}},"ConfigChange":{"type":"array","description":"Hooks that run when settings, managed settings, or skill files change during a session. Supports matchers: user_settings, project_settings, local_settings, policy_settings, skills. Command handlers only. Exit code 2 blocks the change (except policy_settings which is audit-only). See https://code.claude.com/docs/en/hooks#configchange","items":{"$ref":"#/$defs/hookMatcher"}},"WorktreeCreate":{"type":"array","description":"Hooks that run when a worktree is created via --worktree or isolation: \\"worktree\\" in subagents. Command handlers only, no matchers. Hook must print absolute path to created worktree on stdout; non-zero exit fails creation. See https://code.claude.com/docs/en/hooks#worktreecreate","items":{"$ref":"#/$defs/hookMatcher"}},"WorktreeRemove":{"type":"array","description":"Hooks that run when a worktree is being removed at session exit or when a subagent finishes. Command handlers only, no matchers. Used for cleanup tasks; cannot block removal. See https://code.claude.com/docs/en/hooks#worktreeremove","items":{"$ref":"#/$defs/hookMatcher"}},"SessionStart":{"type":"array","description":"Hooks that run when a new session starts","items":{"$ref":"#/$defs/hookMatcher"}},"SessionEnd":{"type":"array","description":"Hooks that run when a session ends","items":{"$ref":"#/$defs/hookMatcher"}},"PostToolBatch":{"type":"array","description":"Hooks that run after a full batch of parallel tool calls resolves, before the next model call. Exit code 2 blocks the agentic loop. Does not support matchers. See https://code.claude.com/docs/en/hooks","items":{"$ref":"#/$defs/hookMatcher"}},"TaskCreated":{"type":"array","description":"Hooks that run when a task is being created via TaskCreate. Exit code 2 rolls back task creation. Does not support matchers. See https://code.claude.com/docs/en/hooks#taskcreated","items":{"$ref":"#/$defs/hookMatcher"}},"PermissionDenied":{"type":"array","description":"Hooks that run when a tool call is denied by the auto mode classifier. Supports matchers on tool name. See https://code.claude.com/docs/en/hooks","items":{"$ref":"#/$defs/hookMatcher"}},"UserPromptExpansion":{"type":"array","description":"Hooks that run when a user-typed command expands into a prompt, before it reaches Claude. Exit code 2 blocks the expansion. Supports matchers on command name. See https://code.claude.com/docs/en/hooks","items":{"$ref":"#/$defs/hookMatcher"}},"MessageDisplay":{"type":"array","description":"Hooks that run while assistant message text is displayed","items":{"$ref":"#/$defs/hookMatcher"}},"DirectoryAdded":{"type":"array","description":"UNDOCUMENTED. Hooks that run after /add-dir or the SDK register_repo_root control request registers a new working directory mid-session (added v2.1.219)","items":{"$ref":"#/$defs/hookMatcher"}}}},"disableAllHooks":{"type":"boolean","description":"Disable all hooks and statusLine execution. When true in managed settings, user and project-level disableAllHooks cannot override it. See https://code.claude.com/docs/en/hooks#disable-or-remove-hooks"},"allowedChannelPlugins":{"type":"array","items":{"type":"object","additionalProperties":false,"properties":{"marketplace":{"type":"string","description":"Name of the marketplace the channel plugin is installed from"},"plugin":{"type":"string","description":"Name of the channel plugin allowed to run"}},"required":["marketplace","plugin"]},"description":"(Managed settings only) Allowlist of channel plugins that may run, each identified by its marketplace and plugin name. When set, only the listed plugins can push inbound channel messages while channelsEnabled is true. Replaces the default Anthropic allowlist when set; undefined falls back to the default and an empty array blocks all channel plugins. Requires channelsEnabled: true. See https://code.claude.com/docs/en/channels#restrict-which-channel-plugins-can-run"},"allowedHttpHookUrls":{"type":"array","items":{"type":"string","minLength":1},"description":"Allowlist of URL patterns that HTTP hooks may target. Supports * as a wildcard. When set, hooks with non-matching URLs are blocked. Undefined = no restriction, empty array = block all HTTP hooks. Arrays merge across settings sources. See https://code.claude.com/docs/en/settings#hook-configuration","examples":[["https://hooks.example.com/*","http://localhost:*"]]},"allowManagedHooksOnly":{"type":"boolean","description":"(Managed settings only) Prevent loading of user, project, and plugin hooks. Only allows managed hooks and SDK hooks. See https://code.claude.com/docs/en/settings#hook-configuration"},"allowManagedPermissionRulesOnly":{"type":"boolean","description":"(Managed settings only) Prevent user and project settings from defining allow, ask, or deny permission rules. Only rules in managed settings apply. See https://code.claude.com/docs/en/settings#permission-settings"},"statusLine":{"type":"object","properties":{"type":{"type":"string","description":"The type of status line handler; must be set to \\"command\\" to run a custom shell script that receives JSON session data via stdin.","const":"command"},"command":{"type":"string","description":"A shell command or path to a script that displays session information (context usage, costs, git status, etc.) by reading JSON data from stdin and writing output to stdout. See https://code.claude.com/docs/en/statusline"},"padding":{"type":"number","description":"Optional number of extra horizontal spacing characters added to the status line content; defaults to 0."},"refreshInterval":{"type":"integer","minimum":1,"description":"Re-run the status line command every N seconds in addition to event-driven updates. Leave unset to run only on events. Useful for time-based data like clocks, or when background subagents change git state while the main session is idle. See https://code.claude.com/docs/en/statusline"},"hideVimModeIndicator":{"type":"boolean","description":"Set to true when your status line script renders the vim mode indicator itself, to suppress the built-in vim mode display. See https://code.claude.com/docs/en/statusline#manually-configure-a-status-line"}},"required":["type","command"],"additionalProperties":false,"description":"Custom status line display configuration. See https://code.claude.com/docs/en/statusline","examples":[{"type":"command","command":"~/.claude/statusline.sh"}]},"fileSuggestion":{"type":"object","properties":{"type":{"type":"string","description":"The type of file suggestion handler; must be set to \\"command\\" to execute a custom shell script that generates file suggestions for the @ file picker.","const":"command"},"command":{"type":"string","description":"Shell command to execute for file suggestions"}},"required":["type","command"],"additionalProperties":false,"description":"Configure a custom script for @ file autocomplete. See https://code.claude.com/docs/en/settings#file-suggestion-settings","examples":[{"type":"command","command":"~/.claude/file-suggestion.sh"}]},"enabledPlugins":{"type":"object","additionalProperties":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"boolean"},{"not":{}}]},"description":"Enabled plugins using plugin-id@marketplace-id format. Example: { \\"formatter@anthropic-tools\\": true }. See https://code.claude.com/docs/en/plugins"},"extraKnownMarketplaces":{"type":"object","additionalProperties":{"type":"object","properties":{"source":{"anyOf":[{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"url"},"url":{"type":"string","format":"uri","description":"Direct URL to marketplace.json file"}},"required":["source","url"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"hostPattern"},"hostPattern":{"type":"string","description":"Git host pattern to trust for repositories in source specifications"}},"required":["source","hostPattern"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"github"},"repo":{"type":"string","description":"GitHub repository in owner/repo format"},"ref":{"type":"string","description":"Git branch or tag to use (e.g., \\"main\\", \\"v1.0.0\\"). Defaults to repository default branch."},"path":{"type":"string","description":"Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"},"skipLfs":{"type":"boolean","description":"Skip Git LFS downloads when Claude Code clones or updates the marketplace repository. LFS pointer files remain as pointers instead of downloading their content. Use this when the repository contains large LFS objects unrelated to plugin content. Requires Claude Code v2.1.153 or later"}},"required":["source","repo"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"git"},"url":{"type":"string","pattern":"\\\\.git$","description":"Full git repository URL"},"ref":{"type":"string","description":"Git branch or tag to use (e.g., \\"main\\", \\"v1.0.0\\"). Defaults to repository default branch."},"path":{"type":"string","description":"Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"},"skipLfs":{"type":"boolean","description":"Skip Git LFS downloads when Claude Code clones or updates the marketplace repository. LFS pointer files remain as pointers instead of downloading their content. Use this when the repository contains large LFS objects unrelated to plugin content. Requires Claude Code v2.1.153 or later"}},"required":["source","url"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"npm"},"package":{"type":"string","description":"NPM package containing marketplace.json"}},"required":["source","package"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"file"},"path":{"type":"string","description":"Local file path to marketplace.json"}},"required":["source","path"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"directory"},"path":{"type":"string","description":"Local directory containing .claude-plugin/marketplace.json"}},"required":["source","path"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"settings"},"name":{"type":"string","description":"Name of the inline marketplace"},"plugins":{"type":"array","description":"Plugins declared inline. Each must reference an external source such as GitHub or npm. You still need to enable each plugin separately in enabledPlugins","items":{"type":"object","properties":{"name":{"type":"string","description":"Plugin name"},"source":{"description":"External source the plugin is fetched from. Inline plugins must reference external sources such as GitHub or npm, not relative paths","anyOf":[{"type":"object","properties":{"source":{"type":"string","description":"Identifies the plugin source type","const":"github"},"repo":{"type":"string","description":"GitHub repository in owner/repo format"},"ref":{"type":"string","description":"Git branch or tag"},"sha":{"type":"string","description":"Exact commit SHA to pin the plugin to"}},"required":["source","repo"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the plugin source type","const":"url"},"url":{"type":"string","description":"Git URL source"},"ref":{"type":"string","description":"Git branch or tag"},"sha":{"type":"string","description":"Exact commit SHA to pin the plugin to"}},"required":["source","url"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the plugin source type","const":"git-subdir"},"url":{"type":"string","description":"Git repository URL"},"path":{"type":"string","description":"Subdirectory within the git repo. Clones sparsely to minimize bandwidth for monorepos"},"ref":{"type":"string","description":"Git branch or tag"},"sha":{"type":"string","description":"Exact commit SHA to pin the plugin to"}},"required":["source","url","path"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the plugin source type","const":"npm"},"package":{"type":"string","description":"npm package name (supports scoped packages)"},"version":{"type":"string","description":"Package version"},"registry":{"type":"string","description":"npm registry URL"}},"required":["source","package"],"additionalProperties":false}]}},"required":["name","source"],"additionalProperties":false}}},"required":["source","name","plugins"],"additionalProperties":false}],"description":"Where to fetch the marketplace from"},"installLocation":{"type":"string","description":"Local cache path where marketplace manifest is stored (auto-generated if not provided)"},"autoUpdate":{"type":"boolean","description":"Whether to automatically update this marketplace on Claude Code startup. Written automatically by Claude Code when you toggle auto-update for a marketplace"},"lastUpdated":{"type":"string","description":"ISO 8601 timestamp of the last marketplace refresh. Written automatically by Claude Code"}},"required":["source"],"additionalProperties":false},"description":"Additional marketplaces to make available for this repository. Typically used in repository .claude/settings.json to ensure team members have required plugin sources. See https://code.claude.com/docs/en/plugin-marketplaces"},"strictKnownMarketplaces":{"type":"array","description":"(Managed settings only) Allowlist of plugin marketplaces users can add. Undefined = no restrictions, empty array = lockdown. Uses exact matching for source specifications. See https://code.claude.com/docs/en/plugin-marketplaces#managed-marketplace-restrictions","items":{"anyOf":[{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"hostPattern"},"hostPattern":{"type":"string","description":"Git host pattern to trust for repositories in source specifications"}},"required":["source","hostPattern"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"github"},"repo":{"type":"string","description":"GitHub repository in owner/repo format"},"ref":{"type":"string","description":"Git branch, tag, or SHA"},"path":{"type":"string","description":"Subdirectory path"}},"required":["source","repo"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"git"},"url":{"type":"string","description":"Full git repository URL"},"ref":{"type":"string","description":"Git branch, tag, or SHA"},"path":{"type":"string","description":"Subdirectory path"}},"required":["source","url"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"url"},"url":{"type":"string","format":"uri","description":"Direct URL to marketplace.json"},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"HTTP headers for authenticated access"}},"required":["source","url"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"npm"},"package":{"type":"string","description":"NPM package name (supports scoped packages)"}},"required":["source","package"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"file"},"path":{"type":"string","description":"Absolute path to marketplace.json file"}},"required":["source","path"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"directory"},"path":{"type":"string","description":"Absolute path to directory containing .claude-plugin/marketplace.json"}},"required":["source","path"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"pathPattern"},"pathPattern":{"type":"string","description":"Regex pattern to match file or directory paths for marketplace sources"}},"required":["source","pathPattern"],"additionalProperties":false}]},"examples":[[{"source":"github","repo":"acme-corp/approved-plugins"},{"source":"npm","package":"@acme-corp/compliance-plugins"}]]},"skippedMarketplaces":{"type":"array","items":{"type":"string","minLength":1},"description":"List of marketplace names the user has chosen not to install when prompted. See https://code.claude.com/docs/en/discover-plugins"},"skippedPlugins":{"type":"array","items":{"type":"string","minLength":1},"description":"List of plugin IDs (plugin@marketplace format) the user has chosen not to install when prompted. See https://code.claude.com/docs/en/discover-plugins"},"forceLoginMethod":{"type":"string","enum":["claudeai","console","gateway"],"description":"Use \\"claudeai\\" to restrict login to Claude.ai accounts, \\"console\\" to restrict login to Claude Console accounts, or \\"gateway\\" to restrict login to a cloud gateway. On Claude Code v2.1.212 or later, every first-party login path enforces the restriction, including the VS Code extension, the Agent SDK, \`claude setup-token\`, and /install-github-app; before v2.1.212, only terminal logins enforced it. See https://code.claude.com/docs/en/authentication#restrict-login-to-your-organization","examples":["claudeai"]},"forceLoginOrgUUID":{"oneOf":[{"type":"string","minLength":1},{"type":"array","items":{"type":"string","minLength":1}}],"description":"Organization UUID to use for OAuth login, or an array of UUIDs to allow several organizations. An empty array fails closed and blocks every login. See https://code.claude.com/docs/en/authentication#restrict-login-to-your-organization","examples":["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"]},"otelHeadersHelper":{"type":"string","description":"Path to an executable, or a shell command line with arguments, that outputs OpenTelemetry headers as a JSON object. Runs at startup and re-runs on the interval set by CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS. Requires CLAUDE_CODE_ENABLE_TELEMETRY=1. See https://code.claude.com/docs/en/monitoring-usage#dynamic-headers","minLength":1},"outputStyle":{"type":"string","description":"Controls the output style for assistant responses. Built-in styles: default, Proactive, Explanatory, Learning. Custom styles can be added in ~/.claude/output-styles/ or .claude/output-styles/. See https://code.claude.com/docs/en/output-styles","examples":["default","Proactive","Explanatory","Learning"],"minLength":1},"skipWebFetchPreflight":{"type":"boolean","description":"Skip the WebFetch blocklist check for enterprise environments with restrictive security policies. See https://code.claude.com/docs/en/settings#available-settings"},"sandbox":{"type":"object","description":"Sandbox execution configuration. See https://code.claude.com/docs/en/sandboxing","properties":{"network":{"type":"object","description":"Configures network isolation settings for the sandboxed bash environment, including domain restrictions, Unix socket access, and custom proxy configuration.","properties":{"allowUnixSockets":{"type":"array","items":{"type":"string"},"description":"Allow Unix domain sockets for local IPC (SSH agent, Docker, etc.). Provide an array of specific paths. Defaults to blocking if not specified. See https://code.claude.com/docs/en/sandboxing#network-isolation"},"allowLocalBinding":{"type":"boolean","description":"Allow binding to local network addresses (e.g., localhost ports). Defaults to false if not specified. See https://code.claude.com/docs/en/sandboxing#network-isolation"},"httpProxyPort":{"type":"integer","minimum":1,"maximum":65535,"description":"HTTP proxy port to use for network filtering. If not specified, a proxy server will be started automatically. See https://code.claude.com/docs/en/sandboxing#custom-proxy-configuration"},"socksProxyPort":{"type":"integer","minimum":1,"maximum":65535,"description":"SOCKS proxy port to use for network filtering. If not specified, a proxy server will be started automatically. See https://code.claude.com/docs/en/sandboxing#custom-proxy-configuration"},"allowAllUnixSockets":{"type":"boolean","description":"Allow all Unix domain socket connections. If true, this overrides allowUnixSockets. See https://code.claude.com/docs/en/sandboxing#network-isolation"},"allowedDomains":{"type":"array","items":{"type":"string","minLength":1},"description":"Allowlist of network domains for sandboxed commands. Supports wildcard patterns like *.example.com. See https://code.claude.com/docs/en/sandboxing#network-isolation"},"deniedDomains":{"type":"array","items":{"type":"string","minLength":1},"description":"Blocklist of network domains for sandboxed commands. Blocks specific domains even when a broader allowedDomains wildcard would otherwise permit them. Supports wildcard patterns like *.example.com. See https://code.claude.com/docs/en/sandboxing#network-isolation"},"allowManagedDomainsOnly":{"type":"boolean","description":"(Managed settings only) Only allowedDomains and WebFetch(domain:...) allow rules from managed settings are respected. User, project, local, and flag settings domains are ignored. Denied domains are still respected from all sources. Non-allowed domains are automatically blocked without user prompts. See https://code.claude.com/docs/en/sandboxing#network-isolation"},"allowMachLookup":{"type":"array","items":{"type":"string","minLength":1},"description":"macOS only. Additional XPC/Mach service names the sandbox may look up. Supports a single trailing * for prefix matching. Needed for tools that communicate via XPC such as the iOS Simulator or Playwright. See https://code.claude.com/docs/en/sandboxing#network-isolation","examples":[["com.apple.coresimulator.*"]]},"tlsTerminate":{"type":"object","description":"Experimental. Terminate TLS inside the sandbox proxy so it can read the contents of HTTPS requests. Required for mask credential substitution. Set {} to generate an ephemeral certificate authority for the session, or set caCertPath and caKeyPath to use your own. Only honored from user, managed, or CLI --settings settings, not from .claude/settings.json or .claude/settings.local.json. Requires Claude Code v2.1.199 or later. See https://code.claude.com/docs/en/sandboxing#protect-credentials","properties":{"caCertPath":{"type":"string","description":"Path to your own certificate authority certificate"},"caKeyPath":{"type":"string","description":"Path to your own certificate authority private key"}},"additionalProperties":false},"strictAllowlist":{"type":"boolean","description":"UNDOCUMENTED. Deny non-allowlisted hosts for sandboxed commands without prompting (added v2.1.219). See https://code.claude.com/docs/en/sandboxing#network-isolation"}},"additionalProperties":false},"ignoreViolations":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"},"description":"List of filesystem paths to ignore sandbox violations for when this command pattern matches"},"description":"Map of command patterns to filesystem paths to ignore violations for. Use \\"*\\" to match all commands"},"excludedCommands":{"type":"array","items":{"type":"string"},"description":"Commands that should never run in the sandbox (e.g., [\\"git\\", \\"docker\\"]). See https://code.claude.com/docs/en/sandboxing#configure-sandboxing"},"autoAllowBashIfSandboxed":{"type":"boolean","description":"Automatically allow bash commands without prompting when they run in the sandbox. Only applies to commands that will run sandboxed. See https://code.claude.com/docs/en/sandboxing#sandbox-modes","default":true},"enableWeakerNetworkIsolation":{"type":"boolean","description":"macOS only. Allow access to the system TLS trust service (com.apple.trustd.agent) in the sandbox. Required for Go-based tools like gh, gcloud, and terraform to verify TLS certificates when using httpProxyPort with a MITM proxy and custom CA. Reduces security by opening a potential data exfiltration path. Default: false. See https://code.claude.com/docs/en/sandboxing","default":false},"enableWeakerNestedSandbox":{"type":"boolean","description":"Enable weaker sandbox mode for unprivileged docker environments where --proc mounting fails. This significantly reduces the strength of the sandbox and should only be used when this risk is acceptable. Default: false (secure). See https://code.claude.com/docs/en/sandboxing#limitations"},"allowUnsandboxedCommands":{"type":"boolean","description":"Allow commands to run outside the sandbox via the dangerouslyDisableSandbox parameter. When false, the dangerouslyDisableSandbox parameter is completely ignored and all commands must run sandboxed. Default: true. See https://code.claude.com/docs/en/sandboxing#limitations"},"enabled":{"type":"boolean","description":"Enable sandboxed bash. See https://code.claude.com/docs/en/sandboxing#enable-sandboxing"},"filesystem":{"type":"object","description":"Filesystem access control for sandboxed commands. See https://code.claude.com/docs/en/sandboxing#filesystem-isolation","properties":{"allowWrite":{"type":"array","items":{"type":"string","minLength":1},"description":"Paths where subprocesses are allowed to write. Supports prefixes: // (absolute), ~/ (home directory), / (relative to settings file), ./ or no prefix (relative path). See https://code.claude.com/docs/en/sandboxing#granting-subprocess-write-access-to-specific-paths"},"denyWrite":{"type":"array","items":{"type":"string","minLength":1},"description":"Paths where subprocesses are explicitly denied write access. Takes precedence over allowWrite. See https://code.claude.com/docs/en/sandboxing#filesystem-isolation"},"denyRead":{"type":"array","items":{"type":"string","minLength":1},"description":"Paths where subprocesses are explicitly denied read access. See https://code.claude.com/docs/en/sandboxing#filesystem-isolation"},"allowRead":{"type":"array","items":{"type":"string","minLength":1},"description":"Paths to re-allow reading within denyRead regions. Takes precedence over denyRead for matching paths. See https://code.claude.com/docs/en/sandboxing#granting-subprocess-write-access-to-specific-paths"},"allowManagedReadPathsOnly":{"type":"boolean","description":"(Managed settings only) When true, only allowRead paths from managed settings are used; user, project, and local allowRead entries are ignored. denyRead still merges from all sources. See https://code.claude.com/docs/en/sandboxing#filesystem-isolation"},"disabled":{"type":"boolean","description":"Skip filesystem isolation while keeping network isolation: sandboxed commands get unrestricted read and write access to the host filesystem, and network egress stays confined to network.allowedDomains. Only honored from user, managed, or CLI --settings settings (default: false). Requires Claude Code v2.1.216 or later. See https://code.claude.com/docs/en/sandboxing#disable-filesystem-isolation","default":false}},"additionalProperties":false},"ripgrep":{"type":"object","description":"Custom ripgrep configuration for Claude Code's bundled ripgrep support. Overrides the bundled binary and arguments.","additionalProperties":false,"required":["command"],"properties":{"command":{"type":"string","description":"Path to the ripgrep binary to use","minLength":1},"args":{"type":"array","items":{"type":"string"},"description":"Additional arguments to pass to the ripgrep binary"}}},"bwrapPath":{"type":"string","minLength":1,"description":"(Managed setting only) Path to custom bubblewrap (bwrap) binary for Linux/WSL sandbox. Overrides default. See https://code.claude.com/docs/en/server-managed-settings"},"socatPath":{"type":"string","minLength":1,"description":"(Managed setting only) Path to custom socat binary for Linux/WSL network proxying. Overrides default. See https://code.claude.com/docs/en/server-managed-settings"},"failIfUnavailable":{"type":"boolean","description":"When true, make sandbox startup a hard failure if required sandbox dependencies are missing. Default: false (sandbox is skipped with a warning). See https://code.claude.com/docs/en/sandboxing#enable-sandboxing"},"enabledPlatforms":{"type":"array","items":{"type":"string","enum":["macos","linux","wsl","windows"]},"description":"Limit the entire sandbox configuration to the listed platforms. On platforms not in the list the sandbox config is inert: no sandbox, no auto-allow, no startup warning, and no failIfUnavailable exit. When omitted, all supported platforms are included. Only honored from managed (policy) settings."},"credentials":{"type":"object","additionalProperties":false,"description":"Block sandboxed commands from reading credential files and secret environment variables (v2.1.187+). Entries merge across settings scopes. See https://code.claude.com/docs/en/sandboxing#protect-credentials","properties":{"files":{"type":"array","description":"Credential file paths to hide from sandboxed commands","items":{"type":"object","additionalProperties":false,"properties":{"path":{"type":"string","description":"Path to the credential file to deny"},"mode":{"type":"string","enum":["deny"],"description":"Access mode; only \\"deny\\" is supported"}},"required":["path","mode"]}},"envVars":{"type":"array","description":"Secret environment variable names to unset for sandboxed commands","items":{"type":"object","additionalProperties":false,"properties":{"name":{"type":"string","description":"Environment variable name to deny"},"mode":{"type":"string","enum":["deny"],"description":"Access mode; only \\"deny\\" is supported"}},"required":["name","mode"]}},"allowPlaintextInject":{"type":"boolean","description":"Allow mask substitution on plain HTTP requests as well as TLS-terminated HTTPS. On plain HTTP the upstream identity is unverified and the credential travels in cleartext, so leave this off outside trusted test networks. Only honored from user, managed, or CLI --settings settings, not from .claude/settings.json or .claude/settings.local.json (default: false). Requires Claude Code v2.1.199 or later. See https://code.claude.com/docs/en/sandboxing#protect-credentials","default":false}}},"allowAppleEvents":{"type":"boolean","description":"Allow sandboxed commands to send Apple Events on macOS (v2.1.181+). Honored only from user, managed, or CLI settings; project settings cannot enable it. See https://code.claude.com/docs/en/sandboxing#limitations"}},"additionalProperties":false},"spinnerVerbs":{"type":"object","description":"Customize the verbs shown in spinner progress messages","properties":{"mode":{"type":"string","enum":["append","replace"],"description":"How to combine custom verbs with default spinner verbs: 'append' adds custom verbs to the default list, 'replace' uses only custom verbs"},"verbs":{"type":"array","items":{"type":"string","minLength":1},"minItems":1,"description":"Custom verbs used in spinner progress text"}},"required":["verbs"],"additionalProperties":false},"spinnerTipsEnabled":{"type":"boolean","description":"Show tips in the spinner while Claude is working. Set to false to disable tips (default: true)","default":true},"spinnerTipsOverride":{"type":"object","description":"Customize the tips displayed in the spinner while Claude is working. See https://code.claude.com/docs/en/settings#available-settings","properties":{"excludeDefault":{"type":"boolean","description":"If true, only show custom tips. If false or absent, custom tips merge with built-in tips","default":false},"tips":{"type":"array","items":{"type":"string","minLength":1},"description":"Custom tip strings to display in the spinner","minItems":1}},"required":["tips"],"additionalProperties":false},"terminalProgressBarEnabled":{"type":"boolean","description":"Enable the terminal progress bar that shows progress in supported terminals like Windows Terminal and iTerm2 (default: true)","default":true},"showTurnDuration":{"type":"boolean","description":"Show turn duration messages after responses (e.g., \\"Cooked for 1m 6s\\"). Set to false to hide these messages (default: true)","default":true},"skillOverrides":{"type":"object","additionalProperties":{"type":"string","enum":["on","name-only","user-invocable-only","off"]},"description":"Per-skill visibility overrides. Controls whether skills appear to Claude and in the / picker. Values: 'on' (name and description shown, default), 'name-only' (name only), 'user-invocable-only' (hidden from Claude, visible in /), 'off' (hidden everywhere). Plugin skills are not affected by this setting. See https://code.claude.com/docs/en/skills#override-skill-visibility-from-settings","examples":[{"legacy-context":"name-only","deploy":"off"}]},"prefersReducedMotion":{"type":"boolean","description":"Reduce or disable UI animations (spinners, shimmer, flash effects) for accessibility","default":false},"prUrlTemplate":{"type":"string","description":"URL template for the PR badge shown in the footer and in tool-result summaries. Substitutes placeholders {host}, {owner}, {repo}, {number}, {url} from the gh-reported PR URL. Use this to point PR links at an internal code-review tool instead of github.com. Does not affect #123 autolinks in Claude's prose. See https://code.claude.com/docs/en/settings#available-settings","examples":["https://reviews.example.com/{owner}/{repo}/pull/{number}"]},"alwaysThinkingEnabled":{"type":"boolean","description":"Enable extended thinking by default for all sessions. Typically configured via the /config command rather than editing directly. See https://code.claude.com/docs/en/common-workflows#use-extended-thinking-thinking-mode"},"companyAnnouncements":{"type":"array","items":{"type":"string","minLength":1},"description":"Company announcements to display at startup (one will be randomly selected if multiple are provided)"},"teammateMode":{"type":"string","enum":["auto","in-process","tmux","iterm2"],"description":"How agent team teammates display: \\"auto\\" picks split panes in tmux or iTerm2, in-process otherwise; \\"iterm2\\" (added in v2.1.186) forces iTerm2 native split panes and requires the it2 CLI (it shows an error with the install command if it2 is missing). The default is \\"in-process\\" (it was \\"auto\\" before v2.1.179). Agent teams are experimental and disabled by default. Enable them by adding CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS to your settings.json or environment. See https://code.claude.com/docs/en/agent-teams#choose-a-display-mode","default":"in-process"},"worktree":{"type":"object","additionalProperties":false,"description":"Configuration for --worktree sessions. See https://code.claude.com/docs/en/settings#worktree-settings","properties":{"sparsePaths":{"type":"array","items":{"type":"string","minLength":1},"description":"Directories to check out in each worktree via git sparse-checkout (cone mode). Only the listed paths are written to disk, which is faster in large monorepos. See https://code.claude.com/docs/en/settings#worktree-settings","examples":[["packages/my-app","shared/utils"]]},"baseRef":{"type":"string","enum":["fresh","head"],"default":"fresh","description":"Whether to branch worktrees from origin/<default> (fresh) or local HEAD (head). Default: fresh. Set to 'head' to preserve unpushed commits in new worktrees. See https://code.claude.com/docs/en/settings#worktree-settings"},"bgIsolation":{"type":"string","enum":["worktree","none"],"default":"worktree","description":"Isolation mode for background sessions. \\"worktree\\" blocks Edit/Write in main checkout until EnterWorktree is called; \\"none\\" lets background jobs edit the working copy directly without EnterWorktree, for repos where worktrees are impractical. See https://code.claude.com/docs/en/settings#worktree-settings"},"symlinkDirectories":{"type":"array","items":{"type":"string"},"description":"Directories to symlink from the main repository into each worktree to avoid duplicating large directories on disk. No directories are symlinked by default. See https://code.claude.com/docs/en/settings#worktree-settings","examples":[["node_modules",".cache"]]}}},"parentSettingsBehavior":{"type":"string","enum":["first-wins","merge"],"default":"first-wins","description":"(Admin/managed settings only) Controls how SDK managedSettings (parent tier) merge with inherited settings. 'first-wins': first non-empty value applies (default). 'merge': merge arrays and objects. See https://code.claude.com/docs/en/server-managed-settings"},"pluginTrustMessage":{"type":"string","description":"(Managed settings only) Custom message appended to the plugin trust warning shown before installation. Use to provide organization-specific context about approved plugins. See https://code.claude.com/docs/en/settings#plugin-settings","minLength":1},"pluginConfigs":{"type":"object","additionalProperties":{"type":"object","properties":{"mcpServers":{"type":"object","additionalProperties":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"array","items":{"type":"string"}}]}},"description":"User configuration values for MCP servers keyed by server name"},"options":{"type":"object","description":"Non-sensitive option values from the plugin manifest's userConfig, keyed by option name. Sensitive values go to secure storage instead. See https://code.claude.com/docs/en/plugins-reference","additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"array","items":{"type":"string"}}]}}},"additionalProperties":false},"description":"Per-plugin configuration including MCP server user configs and plugin options, keyed by plugin ID (plugin@marketplace format). See https://code.claude.com/docs/en/plugins"},"allowManagedMcpServersOnly":{"type":"boolean","description":"(Managed settings only) When true, only allowedMcpServers from managed settings are respected; MCP servers defined in user, project, or local settings are ignored. deniedMcpServers still merges from all sources. See https://code.claude.com/docs/en/managed-mcp"},"blockedMarketplaces":{"type":"array","description":"(Managed settings only) Blocklist of marketplace sources. These exact sources are blocked from being added as marketplaces. The check happens before downloading, so blocked sources never touch the filesystem.","items":{"anyOf":[{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"url","description":"Block marketplace fetched from direct URL"},"url":{"type":"string","format":"uri","description":"Direct URL to marketplace.json file"},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"Custom HTTP headers (e.g., for authentication)"}},"required":["source","url"]},{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"github","description":"Block marketplace from GitHub repository"},"repo":{"type":"string","description":"GitHub repository in owner/repo format"},"ref":{"type":"string","description":"Git branch or tag to use"},"path":{"type":"string","description":"Path to marketplace.json within repo"}},"required":["source","repo"]},{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"git","description":"Block marketplace from git repository URL"},"url":{"type":"string","pattern":".*\\\\.git$","description":"Full git repository URL"},"ref":{"type":"string","description":"Git branch or tag to use"},"path":{"type":"string","description":"Path to marketplace.json within repo"}},"required":["source","url"]},{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"npm","description":"Block marketplace from NPM package"},"package":{"type":"string","description":"NPM package containing marketplace.json"}},"required":["source","package"]},{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"file","description":"Block marketplace from local file"},"path":{"type":"string","description":"Local file path to marketplace.json"}},"required":["source","path"]},{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"directory","description":"Block marketplace from local directory"},"path":{"type":"string","description":"Local directory containing .claude-plugin/marketplace.json"}},"required":["source","path"]},{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"hostPattern","description":"Block marketplace by host pattern matching"},"hostPattern":{"type":"string","description":"Regex pattern to match the host/domain extracted from any marketplace source type"}},"required":["source","hostPattern"]},{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"pathPattern","description":"Block marketplace by file/directory path pattern matching"},"pathPattern":{"type":"string","description":"Regex pattern to match file or directory paths for marketplace sources"}},"required":["source","pathPattern"]}]}},"agent":{"type":"string","description":"Name of an agent (built-in or custom) to use for the main thread. Applies the agent's system prompt, tool restrictions, and model. See https://code.claude.com/docs/en/sub-agents","minLength":1},"autoMemoryDirectory":{"type":"string","description":"Custom directory path for auto-memory storage. Supports ~/ prefix for home-directory expansion. Ignored if set in checked-in project settings (.claude/settings.json) for security. Defaults to ~/.claude/projects/<sanitized-cwd>/memory/ when unset. See https://code.claude.com/docs/en/memory","minLength":1},"autoMode":{"type":"object","description":"Customization for the auto mode classifier prompt. Typically configured in managed settings to tune the allow/deny rules used when permissions.defaultMode is \\"auto\\". By default, allow, soft_deny, and environment REPLACE the corresponding built-in classifier section entirely. Include the literal string \\"$defaults\\" as an array entry (added in v2.1.118) to splice the built-in defaults in at that position alongside your custom rules. See https://code.claude.com/docs/en/permissions","additionalProperties":false,"properties":{"allow":{"type":"array","items":{"type":"string"},"description":"Rules for the auto mode classifier allow section. Replaces the built-in allow rules entirely unless the literal string \\"$defaults\\" is included as an entry, which splices the built-in defaults in at that position."},"soft_deny":{"type":"array","items":{"type":"string"},"description":"Rules for the auto mode classifier soft-deny section. Replaces the built-in soft-deny rules entirely unless the literal string \\"$defaults\\" is included as an entry, which splices the built-in defaults in at that position."},"environment":{"type":"array","items":{"type":"string"},"description":"Entries for the auto mode classifier environment section. Replaces the built-in environment context entirely unless the literal string \\"$defaults\\" is included as an entry, which splices the built-in defaults in at that position."},"hard_deny":{"type":"array","items":{"type":"string"},"description":"Rules for the auto mode classifier hard-deny section. Hard-deny rules block unconditionally regardless of user intent. Replaces the built-in hard-deny rules entirely unless the literal string \\"$defaults\\" is included as an entry, which splices the built-in defaults in at that position. See https://code.claude.com/docs/en/permissions"},"classifyAllShell":{"type":"boolean","description":"UNDOCUMENTED. Route all Bash/PowerShell commands through the auto mode classifier instead of only arbitrary-code-execution patterns (added in v2.1.193).","default":false}}},"channelsEnabled":{"type":"boolean","description":"(Managed settings only) Allow channels for the organization. On claude.ai Team and Enterprise plans, channels are blocked when this is unset or false. For Anthropic Console accounts using API key authentication, channels are allowed by default unless the organization deploys managed settings, in which case this key must be set to true. See https://code.claude.com/docs/en/channels#enterprise-controls"},"defaultShell":{"type":"string","enum":["bash","powershell"],"description":"Default shell for input-box ! commands. Default: bash. Using \\"powershell\\" routes ! commands through PowerShell on Windows and requires CLAUDE_CODE_USE_POWERSHELL_TOOL=1 with pwsh on PATH. See https://code.claude.com/docs/en/settings#available-settings"},"disableDeepLinkRegistration":{"type":"string","enum":["disable"],"description":"Set to \\"disable\\" to prevent Claude Code from registering the \`claude-cli://\` deep-link protocol handler on startup. Most useful in managed settings where users cannot override it. See https://code.claude.com/docs/en/settings#available-settings"},"disableSkillShellExecution":{"type":"boolean","description":"Disable inline shell execution for \`\` !\`...\` \`\` and \` \`\`\`! \` blocks in skills and custom slash commands from user, project, plugin, or additional-directory sources. Commands are replaced with [shell command execution disabled by policy] instead of being run. Bundled and managed skills are not affected. Most useful in managed settings where users cannot override it. See https://code.claude.com/docs/en/settings#available-settings"},"forceRemoteSettingsRefresh":{"type":"boolean","description":"(Managed settings only) Block CLI startup until remote managed settings are freshly fetched from the server. If the fetch fails, the CLI exits (fail-closed) rather than continuing with cached settings. When not set, startup continues without waiting for remote settings. See https://code.claude.com/docs/en/server-managed-settings"},"minimumVersion":{"type":"string","description":"Minimum Claude Code version to stay on. Prevents downgrades when switching release channels. See https://code.claude.com/docs/en/settings#available-settings","examples":["2.1.0"],"minLength":1},"showClearContextOnPlanAccept":{"type":"boolean","description":"When true, the plan-approval dialog offers a \\"clear context\\" option. Defaults to false.","default":false},"showThinkingSummaries":{"type":"boolean","description":"Show thinking summaries in the transcript view (Ctrl+O). Thinking summaries are not generated by default in interactive sessions; set to true to restore. See https://code.claude.com/docs/en/settings#available-settings","default":false},"skipDangerousModePermissionPrompt":{"type":"boolean","description":"Whether the user has accepted the bypass permissions mode dialog. Typically managed by the CLI rather than set by hand."},"strictPluginOnlyCustomization":{"description":"(Managed settings) Block non-plugin customization sources for the listed surfaces. Array form locks specific surfaces (e.g., [\\"skills\\", \\"hooks\\"]); true locks all four; false is an explicit no-op. See https://code.claude.com/docs/en/plugins-reference","anyOf":[{"type":"boolean"},{"type":"array","uniqueItems":true,"items":{"type":"string","enum":["skills","agents","hooks","mcp"]}}]},"tui":{"type":"string","enum":["fullscreen","default"],"description":"TUI rendering mode. Use \\"fullscreen\\" for the flicker-free alt-screen renderer with virtualized scrollback; \\"default\\" for the classic main-screen renderer. Corresponds to the /tui command. See https://code.claude.com/docs/en/settings#available-settings"},"viewMode":{"type":"string","enum":["default","verbose","focus"],"description":"Transcript view mode. \\"default\\" shows standard interactive view; \\"verbose\\" shows expanded tool details; \\"focus\\" shows prompt, one-line tool summaries, and final response only (Ctrl+O toggle). See https://code.claude.com/docs/en/settings#available-settings"},"useAutoModeDuringPlan":{"type":"boolean","description":"When true, apply the auto mode classifier during plan mode to auto-approve safe read-only tool calls while planning. Has no effect unless permissions.defaultMode allows auto. See https://code.claude.com/docs/en/permissions"},"voiceEnabled":{"type":"boolean","description":"Legacy alias for voice.enabled; prefer the voice object. Requires a Claude.ai account. See https://code.claude.com/docs/en/settings#available-settings"},"wslInheritsWindowsSettings":{"type":"boolean","description":"(Windows managed settings only) When true, Claude Code on WSL reads managed settings from the Windows policy chain in addition to /etc/claude-code, with Windows sources taking priority. Only honored when set in the HKLM registry key or C:\\\\Program Files\\\\ClaudeCode\\\\managed-settings.json, both of which require Windows admin to write. For HKCU policy to also apply on WSL, the flag must additionally be set in HKCU itself. Has no effect on native Windows. See https://code.claude.com/docs/en/settings#available-settings"},"subagentStatusLine":{"type":"object","additionalProperties":false,"description":"Status line configuration for subagent sessions. See https://code.claude.com/docs/en/statusline#subagent-status-lines","required":["type","command"],"properties":{"type":{"type":"string","const":"command","description":"Must be \\"command\\""},"command":{"type":"string","description":"Shell command to run for the subagent status line","minLength":1}}},"advisorModel":{"type":"string","description":"Model for the server-side advisor tool. Accepts a model alias (\\"opus\\", \\"sonnet\\", or \\"fable\\" on v2.1.170+) or a full model ID. Overridden by the --advisor CLI flag for the session, and blocked when the model is outside the availableModels allowlist. See https://code.claude.com/docs/en/advisor"},"autoCompactEnabled":{"type":"boolean","description":"Automatically compact the conversation when context approaches the limit. Also configurable via the DISABLE_AUTO_COMPACT environment variable. See https://code.claude.com/docs/en/settings#available-settings","default":true},"disableAgentView":{"type":"boolean","description":"(Managed settings) Turn off background agents and the agent view: claude agents, --bg, /background, and the on-demand supervisor. Also configurable via the CLAUDE_CODE_DISABLE_AGENT_VIEW environment variable (set to 1 to disable). See https://code.claude.com/docs/en/agent-view"},"editorMode":{"type":"string","enum":["normal","vim"],"description":"Key binding mode for the input prompt: \\"normal\\" or \\"vim\\". Appears in /config as Editor mode. See https://code.claude.com/docs/en/terminal-config#edit-prompts-with-vim-keybindings","default":"normal"},"enforceAvailableModels":{"type":"boolean","description":"(Managed settings) Extend the availableModels allowlist to the Default model option (requires v2.1.175+). Requires a non-empty availableModels list; when the account-type default is not in the allowlist, Default resolves to the first allowed entry instead. Has no effect when availableModels is unset or empty. See https://code.claude.com/docs/en/model-config#enforce-the-allowlist-for-the-default-model"},"fallbackModel":{"type":"array","maxItems":3,"items":{"type":"string"},"description":"Fallback model chain tried in order when the primary model is overloaded, unavailable, or returns a non-retryable server error. Capped at three entries after deduplication; accepts model names or aliases, and \\"default\\" expands to the account-type default. Overridden by the --fallback-model CLI flag for the session. See https://code.claude.com/docs/en/model-config#fallback-model-chains"},"fileCheckpointingEnabled":{"type":"boolean","description":"Snapshot edited files so /rewind can restore them. Also configurable via the CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING environment variable (set to 1 to disable). See https://code.claude.com/docs/en/checkpointing","default":true},"gcpAuthRefresh":{"type":"string","description":"Command to run when GCP credentials are expired or cannot be loaded. The command's output is displayed to the user but interactive input is not supported; it times out after three minutes. See https://code.claude.com/docs/en/google-vertex-ai#advanced-credential-configuration","examples":["gcloud auth application-default login"],"minLength":1},"managedMcpServers":{"type":"array","description":"(Managed settings, third-party Desktop deployments only) MCP server configurations pushed to all users. Each entry specifies the transport and connection details, plus an optional toolPolicy map. Delivered through the managed settings file or MDM. See https://code.claude.com/docs/en/desktop#enterprise-configuration","items":{"type":"object","additionalProperties":true}},"skillListingMaxDescChars":{"type":"integer","exclusiveMinimum":0,"description":"Per-skill character cap on the combined description and when_to_use text in the skill listing Claude sees each turn. Text longer than this is truncated. See https://code.claude.com/docs/en/skills#skill-descriptions-are-cut-short","default":1536},"preferredNotifChannel":{"type":"string","enum":["auto","terminal_bell","iterm2","iterm2_with_bell","kitty","ghostty","notifications_disabled"],"description":"Method for task-complete and permission-prompt notifications. \\"auto\\" (default) sends a desktop notification in iTerm2, Ghostty, and Kitty and does nothing in other terminals; \\"terminal_bell\\" rings the bell in any terminal; \\"notifications_disabled\\" turns them off. See https://code.claude.com/docs/en/terminal-config#get-a-terminal-bell-or-notification","default":"auto"},"pluginSuggestionMarketplaces":{"type":"array","items":{"type":"string"},"description":"(Managed settings only) Allowlist of marketplace names whose plugins may surface as contextual \\"suggested for this directory\\" tips in the /plugin Discover tab. No marketplace-declared suggestions surface without this allowlist. The built-in first-party frontend-design tip is unaffected. See https://code.claude.com/docs/en/settings#available-settings"},"requiredMaximumVersion":{"type":"string","description":"(Managed settings only) Maximum Claude Code version allowed to start. If the running version is newer, Claude Code exits at startup with instructions to install an approved version. See https://code.claude.com/docs/en/admin-setup#decide-what-to-enforce"},"requiredMinimumVersion":{"type":"string","description":"(Managed settings only) Minimum Claude Code version required to start. If the running version is older, Claude Code exits at startup rather than only warning. See https://code.claude.com/docs/en/admin-setup#decide-what-to-enforce"},"respondToBashCommands":{"type":"boolean","description":"Whether Claude responds after an input-box ! shell command runs (v2.1.186+). Set to false to add the command output to context without a response. See https://code.claude.com/docs/en/interactive-mode#shell-mode-with--prefix","default":true},"skillListingBudgetFraction":{"type":"number","exclusiveMinimum":0,"maximum":1,"description":"Fraction of the model context window reserved for the skill listing sent to Claude (default 0.01 = 1%). When the listing exceeds this, descriptions are shortened to fit. Also configurable via the SLASH_COMMAND_TOOL_CHAR_BUDGET environment variable (fixed character count). See https://code.claude.com/docs/en/skills#skill-descriptions-are-cut-short","default":0.01},"sshConfigs":{"type":"array","description":"(Managed settings) Pre-configured SSH connections distributed to Desktop users. See https://code.claude.com/docs/en/desktop#ssh-sessions","items":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","description":"Unique identifier for this SSH config, used to match configs across settings sources"},"name":{"type":"string","description":"Display name for the SSH connection"},"sshHost":{"type":"string","description":"SSH host in the form \\"user@hostname\\" or \\"hostname\\", or a host alias from ~/.ssh/config"},"sshPort":{"type":"integer","description":"SSH port (default 22)"},"sshIdentityFile":{"type":"string","description":"Path to the SSH identity file (private key)"},"startDirectory":{"type":"string","description":"Default working directory on the remote host; supports tilde expansion. Defaults to the remote user home directory"}},"required":["id","name","sshHost"]}},"sshHostAllowlist":{"type":"array","items":{"type":"string"},"description":"(Managed settings only) Allowlist restricting Desktop SSH sessions to approved hosts. Patterns are case-insensitive; * matches any host and *.example.com matches example.com and any subdomain. See https://code.claude.com/docs/en/desktop#ssh-sessions"},"theme":{"anyOf":[{"type":"string","enum":["auto","dark","light","dark-daltonized","light-daltonized","dark-ansi","light-ansi"]},{"type":"string","pattern":"^custom:.+","description":"Reference to a custom theme defined in ~/.claude/themes/, in the form \\"custom:<slug>\\""}],"description":"Color theme for the interface: auto, dark, light, the daltonized variants (deuteranopia-friendly), the ansi variants (16-color terminals), or a custom theme reference such as custom:<slug> or custom:<plugin-name>:<slug>. See https://code.claude.com/docs/en/terminal-config#match-the-color-theme","default":"dark"},"voice":{"type":"object","additionalProperties":false,"description":"Voice dictation settings: enabled turns dictation on, mode selects \\"hold\\" or \\"tap\\", and autoSubmit sends the prompt on key release in hold mode. Written automatically when you run /voice. Requires a Claude.ai account. See https://code.claude.com/docs/en/voice-dictation","properties":{"enabled":{"type":"boolean","description":"Enable push-to-talk voice dictation input"},"mode":{"type":"string","enum":["hold","tap"],"description":"Recording mode: \\"hold\\" (default) is push-to-talk; \\"tap\\" taps once to start and again to stop and submit"},"autoSubmit":{"type":"boolean","description":"In hold mode, auto-submit the prompt on key release when the transcript is at least three words long"}}},"wheelScrollAccelerationEnabled":{"type":"boolean","description":"In fullscreen rendering, accelerate mouse-wheel scroll speed during fast scrolls (v2.1.174+). Set to false for a constant scroll rate per wheel notch. See https://code.claude.com/docs/en/fullscreen#mouse-wheel-scrolling"},"disableBundledSkills":{"type":"boolean","description":"Disable the skills and workflows that ship with Claude Code: bundled skills and workflows are removed entirely, while built-in slash commands like /init stay typable but are hidden from the model. Skills from plugins, .claude/skills/, and .claude/commands/ are unaffected. Also configurable via the CLAUDE_CODE_DISABLE_BUNDLED_SKILLS environment variable. See https://code.claude.com/docs/en/settings#available-settings"},"awaySummaryEnabled":{"type":"boolean","description":"Show a one-line session recap when you return to the terminal after a few minutes away. Set to false (or turn off Session recap in /config) to disable. See https://code.claude.com/docs/en/settings#available-settings","default":true},"autoScrollEnabled":{"type":"boolean","description":"In fullscreen rendering, follow new output to the bottom of the conversation. Appears in /config as Auto-scroll. Permission prompts still scroll into view when this is off. See https://code.claude.com/docs/en/fullscreen","default":true},"allowAllClaudeAiMcps":{"type":"boolean","description":"(Managed settings only) Load claude.ai connectors alongside a deployed managed-mcp.json, which otherwise takes exclusive control and suppresses them. See https://code.claude.com/docs/en/managed-mcp"},"agentPushNotifEnabled":{"type":"boolean","description":"When Remote Control is connected, allow Claude to send proactive push notifications to your phone, for example when a long task finishes. Requires Claude Code v2.1.119 or later. See https://code.claude.com/docs/en/remote-control#mobile-push-notifications","default":false},"axScreenReader":{"type":"boolean","description":"Render screen-reader-friendly output: flat text without decorative borders or animations screen-reader mode always uses the classic renderer, so the tui setting has no effect while it is active. The CLAUDE_AX_SCREEN_READER environment variable and --ax-screen-reader flag take precedence. Requires Claude Code v2.1.181 or later. See https://code.claude.com/docs/en/settings#available-settings"},"claudeMd":{"type":"string","description":"(Managed settings only) CLAUDE.md-style instructions injected as organization-managed memory. Honored only from managed/policy settings. See https://code.claude.com/docs/en/settings#available-settings"},"disableArtifact":{"type":"boolean","description":"Disable the Artifact tool, which publishes session output as a private web page on claude.ai. Also configurable via the CLAUDE_CODE_DISABLE_ARTIFACT environment variable. See https://code.claude.com/docs/en/settings#available-settings"},"disableAutoMode":{"type":"string","enum":["disable"],"description":"Set to \\"disable\\" to prevent auto mode from being activated: removes auto from the Shift+Tab cycle and rejects --permission-mode auto at startup. See https://code.claude.com/docs/en/settings#available-settings"},"disableClaudeAiConnectors":{"type":"boolean","description":"Disable claude.ai MCP connectors so they are not auto-fetched or connected. A value of true in any settings source takes precedence. Requires Claude Code v2.1.182 or later. See https://code.claude.com/docs/en/settings#available-settings"},"disableRemoteControl":{"type":"boolean","description":"Disable Remote Control: blocks claude remote-control, the --remote-control flag, auto-start, and the in-session toggle. Requires Claude Code v2.1.128 or later. See https://code.claude.com/docs/en/remote-control"},"disableWorkflows":{"type":"boolean","description":"Disable dynamic workflows and bundled workflow commands. Also configurable via the CLAUDE_CODE_DISABLE_WORKFLOWS environment variable. See https://code.claude.com/docs/en/settings#available-settings","default":false},"footerLinksRegexes":{"type":"array","description":"Render extra clickable badges in the footer when a regex matches turn output (tool results and assistant responses). Read from user, --settings flag, and managed settings only; ignored in project and local settings. Requires Claude Code v2.1.176 or later. See https://code.claude.com/docs/en/settings#available-settings","items":{"type":"object","additionalProperties":false,"properties":{"type":{"type":"string","const":"regex","description":"Config variant; \\"regex\\" matches turn output and builds a URL from named capture groups"},"pattern":{"type":"string","description":"Regex matched against turn output"},"url":{"type":"string","description":"Link target; {name} placeholders are filled from named regex capture groups"},"label":{"type":"string","description":"Badge text; {name} placeholders filled from named capture groups, defaults to the full match"}},"required":["pattern","url"]}},"inputNeededNotifEnabled":{"type":"boolean","description":"When Remote Control is connected, send a push notification to your phone when a permission prompt or question is waiting for input. Requires Claude Code v2.1.119 or later. See https://code.claude.com/docs/en/settings#available-settings","default":false},"policyHelper":{"type":"object","additionalProperties":false,"description":"Admin-deployed executable that computes managed settings dynamically at startup. Honored only from MDM or the system managed-settings.json. Requires Claude Code v2.1.136 or later. See https://code.claude.com/docs/en/settings#available-settings","properties":{"path":{"type":"string","description":"Absolute path to the policy helper executable"},"timeoutMs":{"type":"integer","description":"How long in milliseconds to wait for the helper before treating the run as failed"},"refreshIntervalMs":{"description":"How often in milliseconds to re-run the helper in the background; set to 0 to disable refresh, or to at least 60000","anyOf":[{"type":"integer","const":0},{"type":"integer","minimum":60000}]}},"required":["path"]},"remoteControlAtStartup":{"type":"boolean","description":"Connect Remote Control automatically when each interactive session starts. true = always, false = never, unset = organization default. Requires Claude Code v2.1.119 or later. See https://code.claude.com/docs/en/remote-control#enable-remote-control-for-all-sessions"},"syntaxHighlightingDisabled":{"type":"boolean","description":"Disable syntax highlighting in diffs, code blocks, and file previews. See https://code.claude.com/docs/en/settings#available-settings"},"verbose":{"type":"boolean","description":"Show full tool output instead of truncated summaries. The --verbose flag overrides this for a single session. Requires Claude Code v2.1.119 or later. See https://code.claude.com/docs/en/settings#available-settings","default":false},"workflowKeywordTriggerEnabled":{"type":"boolean","description":"Whether including the keyword \\"ultracode\\" in a prompt triggers a dynamic workflow. Requires Claude Code v2.1.157 or later. See https://code.claude.com/docs/en/settings#available-settings","default":true},"askUserQuestionTimeout":{"type":"string","description":"Idle time before an unanswered AskUserQuestion dialog auto-continues with whatever options you had already selected. Accepts \\"60s\\", \\"5m\\", \\"10m\\", or \\"never\\" (default: \\"never\\", which waits until you answer). Appears in /config as Question auto-continue timeout, which writes this key to user settings. Not read from project or local settings. Requires Claude Code v2.1.200 or later. See https://code.claude.com/docs/en/settings#available-settings","enum":["60s","5m","10m","never"],"default":"never"},"teammateDefaultModel":{"type":["string","null"],"description":"Default model for agent team teammates when the spawn prompt does not specify one. Set to a model alias such as \\"sonnet\\", or null to inherit the lead's current /model selection. Appears in /config as Default teammate model. See https://code.claude.com/docs/en/agent-teams","examples":["sonnet"]},"workflowSizeGuideline":{"type":"string","description":"Sets the agent count Claude aims for in the dynamic workflows it writes. Claude Code sends the value to Claude as advice, not an enforced cap. Accepts \\"unrestricted\\" (default, which sends no guideline), \\"small\\", \\"medium\\", or \\"large\\". Appears in /config as Dynamic workflow size, and can be set with /config workflowSizeGuideline=small. Requires Claude Code v2.1.202 or later. On v2.1.203 or later the guideline's agent count also replaces the default threshold for the Large workflow warning. See https://code.claude.com/docs/en/workflows#set-a-size-guideline","enum":["unrestricted","small","medium","large"],"default":"unrestricted"},"enableArtifact":{"type":"boolean","description":"Enable or disable the Artifact tool for this user. When unset, the default follows the feature's availability for your account. The Artifacts row in /config writes this key. A managed disableArtifact and your organization's admin setting take precedence, and the key is ignored in project and local settings (.claude/settings.json, .claude/settings.local.json), which a repository could otherwise commit. Requires Claude Code v2.1.196 or later. See https://code.claude.com/docs/en/artifacts"},"permissionExplainerEnabled":{"type":"boolean","description":"Show a model-generated explanation of the command when you press Ctrl+E on a Bash or PowerShell permission prompt (default: true). Set to false to turn the shortcut off. See https://code.claude.com/docs/en/permissions#permission-system","default":true},"diffTool":{"type":"string","description":"Where to display file diffs when an IDE is connected: \\"auto\\" (default) opens diffs in the IDE's diff viewer, \\"terminal\\" keeps them in the terminal. Appears in /config as Diff tool only when Claude Code is connected to a VS Code or JetBrains IDE. See https://code.claude.com/docs/en/settings#global-config-settings","enum":["auto","terminal"],"default":"auto"},"externalEditorContext":{"type":"boolean","description":"Prepend Claude's previous response as #-commented context when you open the external editor with Ctrl+G (default: false). Appears in /config as Show last response in external editor. See https://code.claude.com/docs/en/settings#global-config-settings","default":false},"autoConnectIde":{"type":"boolean","description":"Automatically connect to a running IDE when Claude Code starts from an external terminal (default: false). Appears in /config as Auto-connect to IDE (external terminal) when running outside a VS Code or JetBrains terminal. Also configurable via the CLAUDE_CODE_AUTO_CONNECT_IDE environment variable, which overrides this when set. See https://code.claude.com/docs/en/settings#global-config-settings","default":false},"autoInstallIdeExtension":{"type":"boolean","description":"Automatically install the Claude Code IDE extension when running from a VS Code terminal (default: true). Appears in /config as Auto-install IDE extension when running inside a VS Code or JetBrains terminal. You can also set the CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL environment variable to 1. See https://code.claude.com/docs/en/settings#global-config-settings","default":true},"emojiCompletionEnabled":{"type":"boolean","description":"Show emoji suggestions when you type : plus a shortcode in the prompt input, and replace a completed shortcode such as :heart: with its emoji (default: true). Set to false to disable both. Requires Claude Code v2.1.217 or later. See https://code.claude.com/docs/en/interactive-mode#emoji-shortcodes","default":true},"vimInsertModeRemaps":{"type":"object","description":"Map two-key INSERT-mode sequences to Escape in vim editor mode. Each key is exactly two printable characters typed in sequence, and \\"<Esc>\\" is the only supported target; other entries are ignored. Read from user, --settings flag, and managed settings only, so a repository's checked-in settings cannot remap your keystrokes. Has no effect unless editorMode is \\"vim\\". Requires Claude Code v2.1.208 or later. See https://code.claude.com/docs/en/interactive-mode#remap-insert-mode-key-sequences","propertyNames":{"pattern":"^..$"},"additionalProperties":{"type":"string","description":"Remap target. \\"<Esc>\\" is the only supported value; other values are ignored"},"examples":[{"jj":"<Esc>"}]},"processWrapper":{"type":"string","description":"Corporate launcher command placed in front of the background processes Claude Code starts. Honored from managed settings, a --settings file, and user settings only; the CLAUDE_CODE_PROCESS_WRAPPER environment variable takes precedence when both are set. Requires Claude Code v2.1.210 or later. See https://code.claude.com/docs/en/corporate-launcher","examples":["/opt/corp/launcher --profile claude"]},"forceLoginGatewayUrl":{"type":"string","description":"Pre-fills and locks the gateway URL on the /login Cloud gateway screen. Either this key or forceLoginMethod: \\"gateway\\" surfaces that screen; set both so the URL is filled in. Honored only at the managed policy tier; ignored in user and project settings. See https://code.claude.com/docs/en/claude-apps-gateway#set-the-gateway-url","examples":["https://claude-gateway.example.com"]},"disableSideloadFlags":{"type":"boolean","description":"(Managed settings only) Reject the --plugin-dir, --plugin-url, --agents, and --mcp-config CLI flags at startup, which users could otherwise pass to bypass strictKnownMarketplaces for a single run. Also rejects these flags from any surface that spawns the CLI with them internally, currently Cowork local sessions in the desktop app. A --mcp-config whose servers are all in-process type: \\"sdk\\" entries is still accepted, so the Agent SDK and VS Code extension keep working. Does not block claude mcp add, .mcp.json, or SDK setMcpServers(); pair with allowedMcpServers for per-server MCP control. Requires Claude Code v2.1.193 or later. See https://code.claude.com/docs/en/settings#available-settings"},"browserExternalPageTools":{"type":"string","description":"(Managed settings only) Set to \\"disabled\\" to prevent Claude from using tools to read or act on external pages in the desktop app's Browser pane. Users can still navigate to external sites themselves, and local dev server previews are unaffected. See https://code.claude.com/docs/en/desktop#browse-external-sites","enum":["disabled"]},"disableBrowserExternalNavigation":{"type":"boolean","description":"(Managed settings only) Set to true to turn off external browsing in the desktop app's Browser pane. Neither users nor Claude can navigate to external sites, and localhost dev server previews are unaffected. The value must be the JSON boolean true; the string \\"true\\" is ignored. See https://code.claude.com/docs/en/desktop#browse-external-sites"},"disableMobileSimulatorTools":{"type":"boolean","description":"(Managed settings only) Set to true to block Claude's tools for the desktop app's iOS Simulator pane. Users keep manual use of the pane; only Claude's access is removed. The value must be the JSON boolean true; any other value is ignored, and a malformed value such as \\"true\\" or 1 logs a warning. See https://code.claude.com/docs/en/desktop-ios-simulator#turn-off-simulator-access"},"requireCoworkFullVmSandbox":{"type":"boolean","description":"(Managed settings only) Run Claude's tools inside an isolated virtual machine instead of on your Mac. Disables the desktop app's iOS Simulator pane and Claude's simulator tools entirely, so the pane cannot attach a device while it is set. See https://code.claude.com/docs/en/desktop-ios-simulator#turn-off-simulator-access"}}`),wi="Claude Code Settings",pn={$schema:mi,$id:hi,$defs:fi,description:gi,allowTrailingCommas:yi,additionalProperties:bi,type:xi,properties:vi,title:wi};function ki(t){const s=t??{},n={...s.$defs??{},...s.definitions??{}},o=h=>{if(!h)return{};if(!h.$ref)return r(h);const f=/^#\/(\$defs|definitions)\/(.+)$/.exec(h.$ref);if(!f)return r(h);const b=n[f[2]];return b?o({...b,...l(h)}):r(h)},i=new Set(["__proto__","constructor","prototype"]),a=h=>{if(!h)return{};const f={};for(const[b,y]of Object.entries(h))i.has(b)||(f[b]=y);return f},r=h=>{if(!h.allOf||h.allOf.length===0)return h;const f={...h};delete f.allOf;for(const b of h.allOf){const y=o(b);Object.assign(f,{properties:{...a(f.properties),...a(y.properties)},required:Ei([...f.required??[],...y.required??[]])}),!f.description&&y.description&&(f.description=y.description),f.default===void 0&&y.default!==void 0&&(f.default=y.default),!f.type&&y.type&&(f.type=y.type)}return f},l=h=>{const{$ref:f,...b}=h;return b},d=(h,f)=>{let b=o(h);for(const y of f){if(!b)return null;if(/^\d+$/.test(y)){const j=Array.isArray(b.items)?b.items[Number(y)]:b.items;b=j?o(j):null;continue}const k=b.properties;if(k&&!i.has(y)&&y in k){b=o(k[y]);continue}const w=b.additionalProperties;if(w&&typeof w=="object"){b=o(w);continue}return null}return b},c=(h,f,b)=>{if(!h)return null;const y={};if(h.description&&(y.description=h.description),h.type&&(y.type=h.type),h.default!==void 0&&(y.default=h.default),h.enum&&(y.enum=h.enum),h.const!==void 0&&(y.const=h.const),h.deprecated&&(y.deprecated=!0),h.examples&&(y.examples=h.examples),h.properties&&(y.knownChildren=Object.keys(h.properties)),b&&(f!=null&&f.includes(b))&&(y.required=!0),h.items&&!Array.isArray(h.items)){const k=o(h.items),w=c(k,void 0,null);w&&(y.itemsInfo=w)}return(h.additionalProperties===!0||typeof h.additionalProperties=="object")&&(y.open=!0),y},p=h=>f=>{if(f.length===0)return c(o(h),void 0,null);const b=d(h,f.slice(0,-1));if(!b)return null;const y=f[f.length-1],k=d(b,[y]);return c(k,b.required,y)},m=h=>{const f=o(h);return Object.keys(f.properties??{})},g=h=>({at:p(h),rootKeys:()=>m(h),rootedAt:f=>{const b=d(h,f);return g(b??{})}});return g(s)}function Ei(t){return Array.from(new Set(t))}let Ot=null;function un(){return Ot||(Ot=ki(pn)),Ot}const Si=["allow","deny","ask"],gs="This settings file has invalid JSON. Fix it in the Settings raw editor first; Permissions will not overwrite it.";function Ci(t){if(t.trim()==="")return{perms:{},full:{},err:null};try{const s=JSON.parse(t);if(s===null||typeof s!="object"||Array.isArray(s))return{perms:{},full:{},err:"settings file is not a JSON object"};const n=s;return{perms:n.permissions??{},full:n,err:null}}catch(s){return{perms:{},full:{},err:s.message}}}function _i({scope:t="user"}={}){const s=Oe(),n=Et(),o=(n==null?void 0:n.cwd)??null,i=Gs(h=>h.navFace),[a,r]=u.useState("rules");u.useEffect(()=>{i==="project"&&a==="presets"&&r("rules")},[i,a]);const d=zt(Kn,s,o)[t]??null,c=G(h=>h.files),p=e.jsx(Ws,{options:[{key:"rules",label:"Rules"},...i==="home"?[{key:"presets",label:"Presets"}]:[]],active:a,onChange:r});if(!s)return e.jsx(K,{title:"loading…"});if(a==="presets")return e.jsx(qe,{toolbar:p,children:e.jsx(pi,{})});const m=h=>h!=="user"&&!o,g=d?c[d]:null;return e.jsx(qe,{toolbar:e.jsxs(e.Fragment,{children:[p,e.jsx("span",{className:"ml-3 text-fg-faint truncate",children:d??"—"}),e.jsx("div",{className:"flex-1"}),e.jsx("a",{href:"https://code.claude.com/docs/en/settings#permissions",target:"_blank",rel:"noreferrer",className:"text-fg-faint hover:text-fg-dim underline-offset-2 hover:underline",children:"rule syntax ↗"})]}),children:m(t)?e.jsx(K,{title:"no active project",hint:"open a tab in a project directory to edit project or local permissions"}):d&&g?e.jsx(mn,{scope:t,cwd:o,activePath:d}):e.jsx(K,{title:"resolving…"})})}u.memo(_i);function mn({scope:t,cwd:s,activePath:n}){const o=G(c=>c.files[n]),{perms:i,err:a}=o?Ci(o.draftRaw):{perms:{},err:null},r=(c,p)=>{if(a){W.error(gs);return}window.api.claudeConfig.patch({fileId:"settings",scope:t,cwd:s,keyPath:["permissions",c],value:p}).catch(m=>W.error(m instanceof Error?m.message:String(m)))},l=(c,p)=>{const m=p.trim();if(!m)return;const g=i[c]??[];g.includes(m)||r(c,[...g,m])},d=(c,p)=>{const m=i[c]??[];r(c,m.filter((g,h)=>h!==p))};return e.jsxs("div",{className:"p-4 space-y-5 max-w-3xl",children:[a&&e.jsxs("div",{role:"alert",className:"text-xs text-red-400 border border-red-400/40 rounded px-3 py-2",children:[gs," (",a,")"]}),e.jsx(Ai,{value:i.defaultMode??"default",onChange:c=>r("defaultMode",c)}),Si.map(c=>e.jsx(Ni,{list:c,rules:i[c]??[],disabled:!!a,onAdd:p=>l(c,p),onRemove:p=>d(c,p)},c)),e.jsx(Oi,{dirs:i.additionalDirectories??[],disabled:!!a,onChange:c=>r("additionalDirectories",c)})]})}function Ai({value:t,onChange:s}){var a;const o=(((a=un().at(["permissions","defaultMode"]))==null?void 0:a.enum)??[]).filter(r=>typeof r=="string"),i=t&&!o.includes(t)?[...o,t]:o;return e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs text-fg uppercase tracking-wider mb-2",children:"Default Mode"}),e.jsx("div",{className:"inline-flex rounded border border-line overflow-hidden",children:i.map(r=>e.jsx("button",{onClick:()=>s(r),className:`px-2.5 py-1 text-xs transition-colors ${t===r?"bg-bg-hi text-fg":"bg-bg-elev text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:r},r))})]})}function Ni({list:t,rules:s,onAdd:n,onRemove:o,disabled:i}){const[a,r]=u.useState(""),l=t==="allow"?"text-green-400":t==="deny"?"text-red-400":"text-yellow-400";return e.jsxs("section",{children:[e.jsx("h3",{className:`text-xs uppercase tracking-wider mb-2 ${l}`,children:t}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx("input",{value:a,disabled:i,onChange:d=>r(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(n(a),r(""))},placeholder:t==="allow"?"e.g. Bash(ls:*) or Read(~/.claude/**)":"e.g. Write(/etc/**)",className:"flex-1 bg-bg-elev border border-line rounded px-2 py-1 text-xs text-fg placeholder-fg-faint"}),e.jsx("button",{onClick:()=>{n(a),r("")},disabled:i||!a.trim(),className:"px-2.5 py-1 border border-line rounded text-xs text-fg-dim hover:text-fg hover:bg-bg-hi disabled:opacity-40",children:"add"})]}),s.length===0?e.jsx("div",{className:"text-fg-faint text-xs",children:"no rules"}):e.jsx("ul",{className:"space-y-0.5",children:s.map((d,c)=>e.jsxs("li",{className:"flex items-center gap-2 text-xs font-mono bg-bg-elev border border-line rounded px-2 py-1",children:[e.jsx("span",{className:"flex-1 text-fg-dim truncate",children:d}),e.jsx("button",{onClick:()=>o(c),className:"text-fg-faint hover:text-red-400",title:"remove",children:"×"})]},`${c}-${d}`))})]})}function Oi({dirs:t,onChange:s,disabled:n}){const[o,i]=u.useState("");return e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs text-fg uppercase tracking-wider mb-2",children:"Additional Directories"}),e.jsx("div",{className:"flex gap-2 mb-2",children:e.jsx("input",{value:o,disabled:n,onChange:a=>i(a.target.value),onKeyDown:a=>{a.key==="Enter"&&o.trim()&&(s([...t,o.trim()]),i(""))},placeholder:"/absolute/path/to/dir",className:"flex-1 bg-bg-elev border border-line rounded px-2 py-1 text-xs text-fg placeholder-fg-faint"})}),e.jsx("ul",{className:"space-y-0.5",children:t.map((a,r)=>e.jsxs("li",{className:"flex items-center gap-2 text-xs font-mono bg-bg-elev border border-line rounded px-2 py-1",children:[e.jsx("span",{className:"flex-1 text-fg-dim truncate",children:a}),e.jsx("button",{onClick:()=>s(t.filter((l,d)=>d!==r)),className:"text-fg-faint hover:text-red-400",children:"×"})]},`${r}-${a}`))})]})}function ji({sidebar:t,detail:s,sidebarWidth:n="18rem"}){return e.jsxs("div",{className:"h-full flex",children:[e.jsx("div",{className:"shrink-0 border-r border-line overflow-y-auto",style:{width:n},children:t}),e.jsx("div",{className:"flex-1 min-w-0 overflow-auto",children:s})]})}const ys=t=>`${t}/.claude/session-manager/provenance.json`;function Ti(t){if(!t||typeof t!="object")return{};const s={};for(const[n,o]of Object.entries(t))(o==="anthropic"||o==="community"||o==="local")&&(s[n]=o);return s}const Ut=Kt((t,s)=>({overrides:{},loaded:!1,loading:!1,home:null,load:async n=>{const o=s();if(!(o.home===n&&(o.loaded||o.loading))){t({home:n,loading:!0});try{const i=await window.api.config.readJson(ys(n)),a=i.exists?Ti(i.data):{};t(r=>({overrides:{...a,...r.overrides},loaded:!0,loading:!1}))}catch{t({loaded:!0,loading:!1})}}},setOverride:async(n,o)=>{const i={...s().overrides};o===null?delete i[n]:i[n]=o,t({overrides:i});const a=s().home;if(a)try{await window.api.config.writeJson(ys(a),i)}catch{}}})),Ne=t=>(t??"").toLowerCase().trim(),hn=new Set,fn=new Set;for(const t of It){const s=t.official?hn:fn;s.add(Ne(t.id)),s.add(Ne(t.name))}const Li=new Set(vt.filter(t=>t.official).flatMap(t=>[Ne(t.id),Ne(t.name)])),Di=new Set(vt.filter(t=>!t.official).flatMap(t=>[Ne(t.id),Ne(t.name)])),Pi=new Set(ni.flatMap(t=>[Ne(t.id),Ne(t.name)])),Ri=new Set(wt.flatMap(t=>[Ne(t.id),Ne(t.name)])),Ii=new Set(wt.map(t=>t.command.trim())),Mi=new Set(["security-review","pr-comments","release-notes","add-dir","code-review","simplify"]),Ui=/(@anthropic-ai\/|anthropic\.com|github\.com\/anthropics)/i,$i=/(^|\s)(npx|uvx|pipx|bunx|mcp-remote|deno\s+run|docker\s+run)(\s|$)/i;function Bi(t){return[t.command,...t.args??[],t.url,t.repository,t.homepage].filter(Boolean).join(" ").toLowerCase()}const Fe=t=>({provenance:"anthropic",reason:t}),$t=t=>({provenance:"community",reason:t});function Fi(t,s,n){switch(t){case"mcp":return hn.has(s)?Fe("official MCP server (catalog)"):fn.has(s)?$t("third-party server (catalog)"):null;case"skill":case"command":return Li.has(s)?Fe("official Anthropic skill (catalog)"):Di.has(s)?$t("third-party skill (catalog)"):null;case"plugin":return null;case"subagent":return Pi.has(s)?Fe("bundled Anthropic subagent (catalog)"):null;case"hook":return Ri.has(s)||n&&Ii.has(n.trim())?Fe("bundled hook (catalog)"):null}}function Hi(t,s){return t.repository?"has a source repository":t.homepage?"has a homepage":t.url?"remote endpoint":$i.test(s)?"installed from a package registry":null}function Bt(t){const s=Ne(t.name),n=Bi(t),o=Fi(t.type,s,t.command);if(o)return o;if((t.type==="command"||t.type==="skill")&&Mi.has(s))return Fe("built-in Claude Code command");if(Ui.test(n))return Fe("Anthropic package or repo");const i=Hi(t,n);return i?$t(i):{provenance:"local",reason:"no external source — assumed self-created"}}function gn(t,s,n){return`${t}:${s??"-"}:${n}`}const Le={anthropic:"Anthropic",community:"Community",local:"Local"},bs={anthropic:"accent",community:"warn",local:"dim"},Gi=["anthropic","community","local"];function yn({input:t,scope:s,interactive:n=!0,className:o=""}){const i=Oe(),{overrides:a,load:r,setOverride:l}=Ut(),[d,c]=u.useState(!1),p=u.useRef(null);u.useEffect(()=>{i&&r(i)},[i,r]),u.useEffect(()=>{if(!d)return;const k=j=>{p.current&&!p.current.contains(j.target)&&c(!1)},w=j=>{j.key==="Escape"&&c(!1)};return window.addEventListener("mousedown",k),window.addEventListener("keydown",w),()=>{window.removeEventListener("mousedown",k),window.removeEventListener("keydown",w)}},[d]);const m=gn(t.type,s??null,t.name),g=Bt(t),h=a[m],f=h??g.provenance,b=h?`Origin manually set to ${Le[f]} — auto-detected ${Le[g.provenance]} (${g.reason})`:`Auto-detected ${Le[f]}: ${g.reason}`,y=e.jsxs(ye,{tone:bs[f],title:b,className:`${n?"cursor-pointer hover:brightness-125":""} ${o}`,children:[Le[f],h&&e.jsx("span",{className:"w-1 h-1 rounded-full bg-current opacity-70","aria-hidden":!0})]});return n?e.jsxs("span",{ref:p,className:"relative inline-flex",children:[e.jsx("button",{type:"button",onClick:k=>{k.stopPropagation(),c(w=>!w)},className:"inline-flex","aria-label":`Origin: ${Le[f]}. Click to change.`,children:y}),d&&e.jsxs("span",{className:`absolute ${Pe.dialog} top-full right-0 mt-1 min-w-[7.5rem] rounded-md border border-line bg-bg-elev shadow-lg py-1 text-left`,onClick:k=>k.stopPropagation(),children:[e.jsx("span",{className:"block px-2 pb-1 text-[10px] uppercase tracking-wide text-fg-faint",children:"Mark origin as"}),Gi.map(k=>e.jsxs("button",{type:"button",onClick:()=>{l(m,k),c(!1)},className:`flex w-full items-center gap-2 px-2 py-1 text-[12px] hover:bg-bg-hi/60 ${f===k?"text-fg":"text-fg-dim"}`,children:[e.jsx("span",{className:`w-2 h-2 rounded-full border ${Vn[bs[k]]}`,"aria-hidden":!0}),Le[k],h===k&&e.jsx("span",{className:"ml-auto text-[10px] text-fg-faint",children:"set"})]},k)),e.jsx("div",{className:"my-1 border-t border-line"}),e.jsxs("button",{type:"button",onClick:()=>{l(m,null),c(!1)},disabled:!h,className:"flex w-full items-center gap-2 px-2 py-1 text-[12px] text-fg-dim hover:bg-bg-hi/60 disabled:opacity-40 disabled:hover:bg-transparent",title:`Revert to auto-detection (${Le[g.provenance]})`,children:["Auto-detect",e.jsx("span",{className:"ml-auto text-[10px] text-fg-faint",children:Le[g.provenance]})]})]})]}):y}const Wi={UserPromptSubmit:{when:"Fires just before the user prompt is sent to the model.",payload:"{ prompt: string }",example:"Block submission if the prompt mentions a secret."},UserPromptExpansion:{when:"Fires when a slash command expands into its final prompt text.",payload:"{ command: string, expanded: string }",example:"Audit which slash commands actually run, post-expansion."},PreToolUse:{when:"Fires before any tool runs. Can block the call.",payload:"{ tool_name: string, tool_input: object }",example:'matcher="Bash" — block dangerous shell commands.'},PostToolUse:{when:"Fires after a tool completes successfully.",payload:"{ tool_name: string, tool_input: object, tool_result: string }",example:'matcher="Write|Edit" — run a linter on changed files.'},PostToolUseFailure:{when:"Fires after a tool errors out (non-zero exit, exception, or refusal).",payload:"{ tool_name: string, tool_input: object, error: string }",example:"Pipe failed Bash runs into a desktop notification."},PostToolBatch:{when:"Fires once after a parallel batch of tool calls all complete.",payload:"{ tool_uses: Array<{ tool_name, tool_input, tool_result? }> }",example:"Aggregate file-edit batches into a single commit message."},Stop:{when:"Fires when the model emits end_turn.",payload:"{ stop_reason: string, output_tokens: number }",example:"Play a chime when the agent finishes a long task."},StopFailure:{when:"Fires when a turn aborts without end_turn (rate-limit, network, OOM).",payload:'{ reason: "rate_limit"|"network"|"oom"|"killed"|string }',example:"Auto-resume on transient failures."},SessionStart:{when:"Fires once when a session boots (claude or claude -p).",payload:'{ source: "startup"|"resume", model: string, agent_type: string }',example:"Inject a project-specific system prompt addendum."},SessionEnd:{when:"Fires once when the session terminates.",payload:'{ reason: "user_quit"|"timeout"|"error"|string }',example:"Persist transcript summary to ~/.claude/projects/<>."},Setup:{when:"Fires during interactive setup (claude /setup, /init).",payload:'{ mode: "init"|"reconfigure"|string }'},PreCompact:{when:"Fires before transcript compaction runs.",payload:'{ transcript_path: string, trigger: "manual"|"auto" }',example:"Snapshot the pre-compact transcript for later diffing."},PostCompact:{when:"Fires after compaction; the active transcript is the compacted one.",payload:'{ transcript_path: string, trigger: "manual"|"auto" }'},InstructionsLoaded:{when:"Fires after CLAUDE.md and any imported memory files are loaded.",payload:'{ source: "session_start"|"reload" }'},Notification:{when:"Fires when Claude Code emits a desktop notification.",payload:"{ title: string, message: string }",example:"Forward to your own notify-send / osascript pipeline."},PermissionRequest:{when:"Fires when a tool needs user permission (per the permissions block).",payload:"{ tool_name: string, tool_input?: object }",example:"Auto-allow npm test invocations."},PermissionDenied:{when:"Fires when the user (or policy) denies a permission request.",payload:"{ tool_name: string, retry: boolean }",example:"Track which tools the user habitually rejects."},SubagentStart:{when:"Fires when a subagent (Task tool) spawns.",payload:"{ agent_type: string }",example:'matcher="security-reviewer" — log every security scan.'},SubagentStop:{when:"Fires when a subagent finishes.",payload:'{ agent_type: string, reason: "end_turn"|"error"|string }'},TeammateIdle:{when:"Fires when a teammate agent goes idle (waiting for input).",payload:"{ teammate_id?: string }"},TaskCreated:{when:"Fires when a new Task is created via the Task tool.",payload:"{ task: { description: string, ...} }",example:"Track each spawned task in an external queue."},TaskCompleted:{when:"Fires when a Task completes (success or failure).",payload:"{ task: { description: string, ...} }"},ConfigChange:{when:"Fires when settings.json (any scope) is mutated mid-session.",payload:'{ source: "user_settings"|"project_settings"|"local_settings" }',example:"Reload tooling that depends on env vars on config change."},CwdChanged:{when:"Fires when the working directory changes (e.g. agent cd-ing).",payload:"{ old_cwd: string, new_cwd: string }",example:"Refresh project-scoped indexers when cwd drifts."},FileChanged:{when:"Fires when a watched file outside Claude Code's edits changes.",payload:'{ file_path: string, change_type: "modified"|"created"|"deleted" }',example:"Re-run typecheck when any .ts file changes."},WorktreeCreate:{when:"Fires after a git worktree is created via /worktree or subagent isolation.",payload:"{ worktree_path?: string, branch?: string }"},WorktreeRemove:{when:"Fires after a git worktree is removed.",payload:"{ worktree_path?: string }"},Elicitation:{when:"Fires when Claude asks the user a multiple-choice question.",payload:'{ action: "accept"|"reject", ...}'},ElicitationResult:{when:"Fires after the user resolves an elicitation prompt.",payload:"{ choice?: string }"}},bn=["UserPromptSubmit","UserPromptExpansion","PreToolUse","PostToolUse","PostToolUseFailure","PostToolBatch","Stop","StopFailure","SessionStart","SessionEnd","Setup","PreCompact","PostCompact","InstructionsLoaded","Notification","PermissionRequest","PermissionDenied","SubagentStart","SubagentStop","TeammateIdle","TaskCreated","TaskCompleted","ConfigChange","CwdChanged","FileChanged","WorktreeCreate","WorktreeRemove","Elicitation","ElicitationResult"],qi=new Set(bn),Ki=["command","http","prompt","agent","mcp_tool"],Vi={UserPromptSubmit:{prompt:"hello"},UserPromptExpansion:{command:"/example",expanded:"hello"},PreToolUse:{tool_name:"Bash",tool_input:{command:"ls"}},PostToolUse:{tool_name:"Bash",tool_input:{command:"ls"},tool_result:""},PostToolUseFailure:{tool_name:"Bash",tool_input:{command:"ls"},error:""},PostToolBatch:{tool_uses:[]},Stop:{stop_reason:"end_turn",output_tokens:0},StopFailure:{reason:"rate_limit"},SessionStart:{source:"startup",model:"",agent_type:""},SessionEnd:{reason:"user_quit"},Setup:{mode:"init"},PreCompact:{transcript_path:"",trigger:"manual"},PostCompact:{transcript_path:"",trigger:"manual"},InstructionsLoaded:{source:"session_start"},Notification:{title:"test",message:"test notification"},PermissionRequest:{tool_name:"Bash"},PermissionDenied:{tool_name:"Bash",retry:!1},SubagentStart:{agent_type:"general-purpose"},SubagentStop:{agent_type:"general-purpose",reason:"end_turn"},TeammateIdle:{},TaskCreated:{task:{description:""}},TaskCompleted:{task:{description:""}},ConfigChange:{source:"user_settings"},CwdChanged:{old_cwd:"",new_cwd:""},FileChanged:{file_path:"",change_type:"modified"},WorktreeCreate:{},WorktreeRemove:{},Elicitation:{action:"accept"},ElicitationResult:{}},xs="This settings file has invalid JSON. Fix it in the Settings raw editor first; Hooks will not overwrite it.";function zi(t){if(t.trim()==="")return{full:{},hooks:{},err:null};try{const s=JSON.parse(t);if(s===null||typeof s!="object"||Array.isArray(s))return{full:{},hooks:{},err:"settings file is not a JSON object"};const n=s;return{full:n,hooks:n.hooks??{},err:null}}catch(s){return{full:{},hooks:{},err:s.message}}}function Yi(t,s){return(t[s]??[]).reduce((n,o)=>{var i;return n+(((i=o.hooks)==null?void 0:i.length)??0)},0)}function Xi({scope:t="user"}={}){const s=Oe(),n=Et(),o=(n==null?void 0:n.cwd)??null,i=Gs(p=>p.navFace),[a,r]=u.useState("events");u.useEffect(()=>{i==="project"&&a==="library"&&r("events")},[i,a]);const d=zt(qs,s,o)[t]??null,c=e.jsx(Ws,{options:[{key:"events",label:"Events"},...i==="home"?[{key:"library",label:"Library"}]:[]],active:a,onChange:r});return s?a==="library"?e.jsx(qe,{toolbar:c,children:e.jsx(di,{})}):t!=="user"&&!o?e.jsx(qe,{toolbar:e.jsx(e.Fragment,{children:c}),children:e.jsx(K,{title:"no active project"})}):d?e.jsx(qe,{toolbar:e.jsxs(e.Fragment,{children:[c,e.jsx("span",{className:"ml-3 text-fg-faint truncate",children:d}),e.jsx("div",{className:"flex-1"}),e.jsx("a",{href:"https://code.claude.com/docs/en/hooks",target:"_blank",rel:"noreferrer",className:"text-fg-faint hover:text-fg-dim underline-offset-2 hover:underline",children:"hook reference ↗"})]}),children:e.jsx(xn,{scope:t,cwd:o,path:d})}):e.jsx(K,{title:"loading…"}):e.jsx(K,{title:"loading…"})}function xn({scope:t,cwd:s,path:n,renderLayout:o}){const[i,a]=u.useState("PreToolUse"),[r,l]=u.useState(null),d=(A,L)=>{window.api.claudeConfig.patch({fileId:"settings",scope:t,cwd:s,keyPath:A,value:L}).catch(E=>W.error(E instanceof Error?E.message:String(E)))},c=G(A=>A.files[n]),{hooks:p,err:m}=c?zi(c.draftRaw):{hooks:{},err:null},g=Object.keys(p).filter(A=>!qi.has(A)),h=g.reduce((A,L)=>A+(p[L]??[]).reduce((E,T)=>{var O;return E+(((O=T.hooks)==null?void 0:O.length)??0)},0),0),f=(A,L)=>{if(m){W.error(xs);return}d(["hooks",A],L)},b=p[i]??[],y=()=>{f(i,[...b,{matcher:"",hooks:[{type:"command",command:""}]}])},k=(A,L)=>{const E=b.slice();E[A]=L,f(i,E)},w=A=>{f(i,b.filter((L,E)=>E!==A))},j=e.jsxs(e.Fragment,{children:[m?e.jsxs("div",{role:"alert",className:"px-3 py-2 border-b border-line text-xs text-red-400",children:[xs," (",m,")"]}):null,h>0?e.jsxs("div",{className:"px-3 py-2 border-b border-line text-xs bg-bg-elev text-fg-dim",children:[e.jsx("span",{className:"text-yellow-400",children:"⚠"})," ",h," hook(s) configured under unknown event names: ",e.jsx("span",{className:"font-mono text-fg",children:g.join(", ")}),e.jsx("span",{className:"text-fg-faint",children:" · these are ignored by Claude Code 2026; edit settings.json directly to remove."})]}):null]}),P=m||h>0?j:null,_=e.jsx("div",{className:"py-1",children:bn.map(A=>{const L=Yi(p,A),E=Wi[A],T=E?e.jsxs("span",{className:"block space-y-1",children:[e.jsx("span",{className:"block text-fg",children:E.when}),e.jsxs("span",{className:"block text-fg-faint font-mono",children:["payload: ",E.payload]}),E.example?e.jsxs("span",{className:"block text-fg-faint italic",children:["e.g. ",E.example]}):null]}):e.jsx("span",{className:"text-fg-faint italic",children:"no documentation yet"});return e.jsx("div",{className:"[&>span]:w-full",children:e.jsx(Fs,{content:T,align:"bottom-center",children:e.jsxs("button",{onClick:()=>a(A),title:E==null?void 0:E.when,className:`w-full text-left px-3 py-1 text-xs ${i===A?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"truncate",children:A}),L>0&&e.jsx("span",{className:"text-accent shrink-0 ml-2",children:L})]}),E?e.jsx("span",{className:"block text-[11px] leading-[1.3] text-fg-faint/80 font-normal truncate",children:E.when}):e.jsx("span",{className:"block text-[11px] leading-[1.3] text-fg-faint/80 italic font-normal truncate",children:"no documentation yet"})]})})},A)})}),S=e.jsxs("div",{className:"p-4 space-y-3 max-w-3xl",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-xs uppercase tracking-wider text-fg",children:i}),e.jsx("button",{onClick:y,disabled:!!m,className:"px-2 py-0.5 text-xs border border-line rounded text-fg-dim hover:text-fg hover:bg-bg-hi disabled:opacity-40 disabled:cursor-not-allowed",children:"+ add group"})]}),b.length===0?e.jsx("div",{className:"text-fg-faint text-xs",children:"no hooks for this event"}):b.map((A,L)=>e.jsx(Ji,{group:A,jsonInvalid:!!m,onChange:E=>k(L,E),onRemove:()=>w(L),onTestFire:E=>l({event:i,matcher:A.matcher??"",command:E.command??""})},L))]});return e.jsxs(e.Fragment,{children:[o?o({banners:P,list:_,detail:S}):e.jsxs("div",{className:"flex flex-col h-full",children:[P,e.jsx(ji,{sidebarWidth:"14rem",sidebar:_,detail:S})]}),r?e.jsx(sr,{event:r.event,matcher:r.matcher,command:r.command,onClose:()=>l(null)}):null]})}u.memo(Xi);function nt({value:t,onCommit:s,onDraft:n,...o}){const[i,a]=u.useState(t);u.useEffect(()=>a(t),[t]);const r=()=>{i!==t&&s(i)};return e.jsx("input",{...o,value:i,onChange:l=>{a(l.target.value),n==null||n(l.target.value)},onBlur:r,onKeyDown:l=>{l.key==="Enter"&&r()}})}function Ji({group:t,jsonInvalid:s,onChange:n,onRemove:o,onTestFire:i}){const a=()=>n({...t,hooks:[...t.hooks??[],{type:"command",command:""}]}),r=(d,c)=>{const p=t.hooks.slice();p[d]=c,n({...t,hooks:p})},l=d=>n({...t,hooks:t.hooks.filter((c,p)=>p!==d)});return e.jsxs("div",{className:"border border-line rounded p-3 bg-bg-elev space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-fg-faint w-16",children:"matcher"}),e.jsx(nt,{value:t.matcher??"",disabled:s,onCommit:d=>n({...t,matcher:d}),placeholder:"tool name regex or exact match (optional)",className:"flex-1 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg font-mono"}),e.jsx("button",{onClick:o,disabled:s,className:"text-fg-faint hover:text-red-400 text-xs disabled:opacity-40",title:"remove group",children:"× group"})]}),(t.hooks??[]).map((d,c)=>e.jsx(Zi,{rule:d,jsonInvalid:s,onChange:p=>r(c,p),onRemove:()=>l(c),onTestFire:()=>i(d)},c)),e.jsx("button",{onClick:a,disabled:s,className:"text-xs text-fg-faint hover:text-fg disabled:opacity-40",children:"+ add hook"})]})}function Qi(t){var n,o,i;const s=((o=(n=pn.$defs)==null?void 0:n.hookCommand)==null?void 0:o.anyOf)??[];for(const a of s){const r=a.properties;if(((i=r==null?void 0:r.type)==null?void 0:i.const)!==t)continue;const l=r.timeout;if(typeof(l==null?void 0:l.default)=="number")return l.default;const d=/default:\s*(\d+)/.exec((l==null?void 0:l.description)??"");return d?Number(d[1]):null}return null}function vs(t){return/^\d+$/.test(t.trim())&&Number(t)>0?Number(t):null}function Zi({rule:t,jsonInvalid:s,onChange:n,onRemove:o,onTestFire:i}){const a=h=>({command:"e.g. node ./scripts/lint.js $FILE",http:"e.g. https://hooks.example.com/notify",prompt:"e.g. Review this change for security issues",agent:"e.g. security-reviewer",mcp_tool:"e.g. mcp__server__tool"})[h],r=t.type==="command"?"command":t.type==="http"?"url":t.type==="prompt"?"prompt":t.type==="mcp_tool"?"mcpTool":"agent",l=t[r]??"",d=(t.args??[]).join(" "),[c,p]=u.useState(null),m=Qi(t.type),g={type:"hook",name:l||t.type,command:t.type==="command"?t.command:void 0,url:t.type==="http"?t.url:void 0};return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("select",{value:t.type,disabled:s,onChange:h=>n({type:h.target.value}),className:"bg-bg border border-line rounded px-1 py-0.5 text-xs text-fg",children:Ki.map(h=>e.jsx("option",{value:h,children:h},h))}),e.jsx(yn,{interactive:!1,input:g}),e.jsx(nt,{value:l,disabled:s,onCommit:h=>n({...t,[r]:h}),placeholder:a(t.type),className:`flex-1 bg-bg border rounded px-2 py-0.5 text-xs text-fg font-mono ${s?"border-red-500/70":l.trim()?"border-line":"border-yellow-600/50"}`}),s?e.jsx("span",{className:"text-red-400 text-xs",title:"The enclosing settings.json is malformed; fix the JSON before editing.",children:"× invalid"}):null,e.jsx(nt,{value:t.timeout!=null?String(t.timeout):"",disabled:s,"aria-label":"timeout (seconds)","aria-invalid":c?!0:void 0,title:c??"Timeout in seconds",onDraft:h=>{p(!h.trim()||vs(h)!=null?null:"Timeout must be a positive whole number of seconds")},onCommit:h=>{if(!h.trim()){n({...t,timeout:void 0});return}const f=vs(h);f!=null&&n({...t,timeout:f})},placeholder:m!=null?`${m} (seconds)`:"seconds",className:`w-24 bg-bg border rounded px-2 py-0.5 text-xs text-fg ${c?"border-red-500/70":"border-line"}`}),c?e.jsx("span",{role:"alert",className:"text-red-400 text-xs",children:c}):null,t.type==="command"?e.jsx("button",{onClick:i,disabled:s||!l.trim(),className:"px-2 py-0.5 text-xs border border-line rounded text-fg-dim hover:text-fg hover:bg-bg-hi disabled:opacity-40 disabled:cursor-not-allowed",title:"Run this command with a fake event payload",children:"test fire"}):null,e.jsx("button",{onClick:o,disabled:s,className:"text-fg-faint hover:text-red-400 text-xs disabled:opacity-40",children:"×"})]}),t.type==="command"?e.jsxs("div",{className:"flex items-center gap-2 pl-[3.75rem]",children:[e.jsx("span",{className:"text-xs text-fg-faint w-12",children:"args"}),e.jsx(nt,{value:d,disabled:s,onCommit:h=>n({...t,args:h.trim()?h.split(/\s+/).filter(Boolean):void 0}),placeholder:"argv array (v2.1.139+ exec form, no shell)",className:"flex-1 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg font-mono"})]}):null,e.jsxs("div",{className:"flex items-center gap-2 pl-[3.75rem]",children:[e.jsx("span",{className:"text-xs text-fg-faint w-12",children:"term"}),e.jsx(nt,{value:t.terminalSequence??"",disabled:s,onCommit:h=>n({...t,terminalSequence:h||void 0}),placeholder:"terminalSequence — e.g. \\\\a (bell), v2.1.141+",className:"flex-1 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg font-mono"})]})]})}function er(t){return JSON.stringify(Vi[t]??{},null,2)}function tr(t,s){if(!t.trim())return{matched:!0,target:null,note:"empty matcher → matches all"};const n=s&&typeof s=="object"&&"tool_name"in s?String(s.tool_name??""):null;if(n==null)return{matched:!1,target:null,note:"payload has no tool_name to match against"};try{return{matched:new RegExp(`^(?:${t})$`).test(n),target:n}}catch{return{matched:t===n,target:n,note:"matcher not valid regex; fell back to exact match"}}}function sr({event:t,matcher:s,command:n,onClose:o}){const[i,a]=u.useState(()=>er(t)),[r,l]=u.useState(!1),[d,c]=u.useState(null),[p,m]=u.useState(null);let g=null;try{JSON.parse(i)}catch(f){g=f.message}const h=async()=>{l(!0),c(null);let f=null;try{f=JSON.parse(i)}catch{}m(tr(s,f));try{const b=await window.api.app.testFireHook({command:n,payload:i,timeoutMs:5e3});c(b)}finally{l(!1)}};return e.jsx(zn,{open:!0,onClose:o,title:`Test fire — ${t}`,children:e.jsxs("div",{className:"space-y-3 text-xs",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-fg-faint mb-1",children:"resolved command"}),e.jsx("div",{className:"font-mono text-fg bg-bg border border-line rounded px-2 py-1 break-all",children:n})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-fg-faint mb-1",children:"matcher"}),e.jsx("div",{className:"font-mono text-fg bg-bg border border-line rounded px-2 py-1",children:s||e.jsx("span",{className:"text-fg-faint",children:"(empty — matches all)"})})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-fg-faint",children:"fake event payload (stdin)"}),g?e.jsxs("span",{className:"text-red-400",children:["× ",g]}):null]}),e.jsx("textarea",{value:i,onChange:f=>a(f.target.value),rows:8,className:`w-full bg-bg border rounded px-2 py-1 font-mono text-fg ${g?"border-red-500/70":"border-line"}`})]}),p?e.jsxs("div",{children:[e.jsx("div",{className:"text-fg-faint mb-1",children:"matcher result"}),e.jsxs("div",{className:"font-mono",children:[e.jsx("span",{className:p.matched?"text-green-400":"text-red-400",children:p.matched?"✓ match":"✗ no match"}),p.target!=null?e.jsxs("span",{className:"text-fg-dim",children:[' · target tool_name="',p.target,'"']}):null,p.note?e.jsx("div",{className:"text-fg-faint",children:p.note}):null]})]}):null,d?e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"text-fg-faint",children:["exit ",d.exitCode," · ",d.durationMs,"ms"]}),d.stdout?e.jsxs("div",{children:[e.jsx("div",{className:"text-fg-faint",children:"stdout"}),e.jsx("pre",{className:"bg-bg border border-line rounded p-2 font-mono text-fg whitespace-pre-wrap break-all max-h-40 overflow-auto",children:d.stdout})]}):null,d.stderr?e.jsxs("div",{children:[e.jsx("div",{className:"text-fg-faint",children:"stderr"}),e.jsx("pre",{className:"bg-bg border border-line rounded p-2 font-mono text-red-300 whitespace-pre-wrap break-all max-h-40 overflow-auto",children:d.stderr})]}):null]}):null,e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[e.jsx("button",{onClick:o,className:"px-2 py-0.5 text-xs border border-line rounded text-fg-dim hover:text-fg hover:bg-bg-hi",children:"close"}),e.jsx("button",{onClick:h,disabled:r||!!g||!n.trim(),className:"px-2 py-0.5 text-xs border border-line rounded text-fg hover:bg-bg-hi disabled:opacity-40 disabled:cursor-not-allowed",children:r?"running…":"run"})]})]})})}const nr=t=>`${t}/session-manager-operations/prompt-sessions/epic-worktree-config.json`;function or({cwd:t}){const[s,n]=u.useState(!1),[o,i]=u.useState(!1),[a,r]=u.useState(!1),[l,d]=u.useState(!1);u.useEffect(()=>{var h,f;let g=!1;return n(!1),Promise.resolve((f=(h=window.api.promptSessions)==null?void 0:h.getWorktreeDisabled)==null?void 0:f.call(h,{cwd:t})).then(b=>{g||(i((b==null?void 0:b.disabled)??!1),r((b==null?void 0:b.disabled)??!1),n(!0))},()=>{g||n(!0)}),()=>{g=!0}},[t]);const c=s&&a!==o,p=()=>{var g,h;d(!0),Promise.resolve((h=(g=window.api.promptSessions)==null?void 0:g.setWorktreeDisabled)==null?void 0:h.call(g,{cwd:t,disabled:a})).then(f=>{i((f==null?void 0:f.disabled)??a),r((f==null?void 0:f.disabled)??a)}).catch(f=>W.error(f instanceof Error?f.message:String(f))).finally(()=>d(!1))},m=()=>r(o);return e.jsxs("div",{"data-testid":"settings-epic-isolation",className:"flex flex-col flex-1 min-h-0",children:[e.jsx(Ct,{eyebrow:"PROJECT · SESSION MANAGER",title:"Epic isolation"}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto px-9 py-6 flex flex-col gap-3",children:e.jsxs(Ge,{label:"Worktree isolation",labelNote:"SESSION MANAGER'S OWN SETTING, NOT A SETTINGS.JSON KEY",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("span",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"block font-semibold text-fg",children:"Disable Epic worktree isolation for this project"}),e.jsxs("span",{className:"mt-1 block text-[13.5px] leading-snug text-fg-dim",children:["Off by default — each active Epic runs in its own isolated ",e.jsx("code",{children:"git worktree"})," (branch"," ",e.jsx("code",{children:"sm-epic/<id>"}),"), merged back to main at an explicit checkpoint. Turning this on makes every new Epic in this project run directly in the shared working tree instead, same as before this feature existed."]})]}),e.jsx("span",{"data-testid":"settings-epic-isolation-toggle",className:"shrink-0 mt-0.5",children:e.jsx(Me,{checked:a,disabled:!s||l,onChange:r})})]}),e.jsx("div",{className:"mt-3",children:e.jsx(Xs,{path:nr(t)})})]})}),c&&e.jsx("div",{className:"shrink-0 border-t border-line bg-bg-elev",children:e.jsx(_t,{dirty:c,busy:l,onSave:p,onRevert:m})})]})}const ir=["read","write","confirm","irreversible","money","public"],ws=t=>t instanceof Error?t.message:String(t),rr=(t,s)=>t.length===s.length&&t.every((n,o)=>n.rule===s[o].rule&&n.mark===s[o].mark);function ar({scope:t,cwd:s}){const n=Ks(E=>E.show),o=u.useRef(1),[i,a]=u.useState(!1),[r,l]=u.useState(null),[d,c]=u.useState({rows:[],interactive:!1}),[p,m]=u.useState([]),[g,h]=u.useState(!1),[f,b]=u.useState(!1),[y,k]=u.useState(null);u.useEffect(()=>{let E=!1;return a(!1),k(null),Promise.resolve().then(()=>window.api.toolRisk.read({scope:t,cwd:t==="project"?s:null})).then(T=>{if(E)return;if(l(T.path),!T.ok){const M=T.error??"could not read tool-risk marks";k(M),n("error",M)}const I={rows:Object.entries(T.marks??{}).map(([M,ue])=>({id:o.current++,rule:M,mark:ue})),interactive:T.interactive===!0};c(I),m(I.rows),h(I.interactive),a(!0)},T=>{if(E)return;const O=ws(T);k(O),n("error",O),a(!0)}),()=>{E=!0}},[t,s,n]);const w=i&&(!rr(p,d.rows)||t==="project"&&g!==d.interactive),j=(E,T)=>m(O=>O.map(I=>I.id===E?{...I,...T}:I)),P=E=>m(T=>T.filter(O=>O.id!==E)),_=()=>m(E=>[...E,{id:o.current++,rule:"",mark:"write"}]),S=()=>{const E={};for(const O of p)E[O.rule.trim()]=O.mark;b(!0),k(null);const T=t==="project"?{scope:t,cwd:s,marks:E,interactive:g}:{scope:t,cwd:null,marks:E};Promise.resolve().then(()=>window.api.toolRisk.write(T)).then(O=>{if(O.path&&l(O.path),!O.ok){const M=O.error??"tool-risk marks were not saved";k(M),n("error",M);return}const I=p.map(M=>({...M,rule:M.rule.trim()}));m(I),c({rows:I,interactive:t==="project"?g:!1})}).catch(O=>{const I=ws(O);k(I),n("error",I)}).finally(()=>b(!1))},A=()=>{m(d.rows),h(d.interactive),k(null)},L=t==="project"?"PROJECT · TOOL RISK":"SYSTEM · TOOL RISK";return e.jsxs("div",{"data-testid":"settings-tool-risk",className:"flex flex-col flex-1 min-h-0",children:[e.jsx(Ct,{eyebrow:L,title:"Tool risk"}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto px-9 py-6 flex flex-col gap-3",children:[e.jsxs(Ge,{label:"Marks",labelNote:"PROJECT OVERRIDES SYSTEM",children:[e.jsxs("p",{className:"text-[13.5px] leading-snug text-fg-dim",children:["One risk mark per tool rule (",e.jsx("code",{children:"mcp__server__tool"}),", ",e.jsx("code",{children:"mcp__server__*"}),","," ",e.jsx("code",{children:"Bash(prefix:*)"}),"). Project overrides System."]}),e.jsxs("div",{"data-testid":"tool-risk-rows",className:"mt-3 flex flex-col gap-2",children:[i&&p.length===0&&e.jsx("span",{"data-testid":"tool-risk-empty",className:"text-[13px] text-fg-faint",children:"No marks in this file yet."}),p.map(E=>e.jsxs("div",{"data-testid":"tool-risk-row",className:"flex items-center gap-2",children:[e.jsx("input",{type:"text","aria-label":"Tool rule","data-testid":"tool-risk-rule",value:E.rule,placeholder:"mcp__server__tool",disabled:f,onChange:T=>j(E.id,{rule:T.target.value}),className:"flex-1 min-w-0 h-8 px-2.5 rounded-[8px] bg-bg-hi border border-line font-mono text-[13px] text-fg outline-none focus:border-fg-faint"}),e.jsx("select",{"aria-label":"Risk mark","data-testid":"tool-risk-mark",value:E.mark,disabled:f,onChange:T=>j(E.id,{mark:T.target.value}),className:"h-8 px-2 rounded-[8px] bg-bg-hi border border-line text-[13px] text-fg",children:ir.map(T=>e.jsx("option",{value:T,children:T},T))}),e.jsx("button",{type:"button","data-testid":"tool-risk-remove","aria-label":`Remove ${E.rule||"mark"}`,disabled:f,onClick:()=>P(E.id),className:"h-8 px-2.5 rounded-[8px] border border-line text-[13px] text-fg-dim hover:bg-bg-hi focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",children:"Remove"})]},E.id))]}),e.jsx("div",{className:"mt-3 flex items-center gap-3",children:e.jsx("button",{type:"button","data-testid":"tool-risk-add",disabled:!i||f,onClick:_,className:"h-8 px-3 rounded-[8px] border border-line bg-bg-hi text-[13px] font-medium text-fg hover:bg-bg-elev focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",children:"+ Add mark"})}),y&&e.jsx("div",{role:"alert","data-testid":"tool-risk-refusal",className:"mt-3 text-xs text-red-400",children:y}),r&&e.jsx("div",{className:"mt-3",children:e.jsx(Xs,{path:r})})]}),t==="project"&&e.jsx(Ge,{label:"Interactive sessions",labelNote:"PROJECT ONLY",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("span",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"block font-semibold text-fg",children:"Also guard interactive sessions in this project"}),e.jsxs("span",{className:"mt-1 block text-[13.5px] leading-snug text-fg-dim",children:["Off by default — marks apply to scheduled jobs. Turning this on installs the tool-risk guard hook into this project's ",e.jsx("code",{children:".claude/settings.json"}),"."]})]}),e.jsx("span",{"data-testid":"tool-risk-interactive-toggle",className:"shrink-0 mt-0.5",children:e.jsx(Me,{checked:g,disabled:!i||f,onChange:h})})]})})]}),w&&e.jsx("div",{className:"shrink-0 border-t border-line bg-bg-elev",children:e.jsx(_t,{dirty:w,busy:f,onSave:S,onRevert:A})})]})}const lr={};function vn(t,s){if(s)return{text:s,authored:!1};const n=lr[t];return n?{text:n,authored:!0}:null}const cr={essentials:"star",git:"link",memory:"memory",model:"sparkle",interface:"eye",updates:"reload",env:"keys",hooks:"hooks",mcp:"mcp",plugins:"plugins",filesystem:"folder",login:"lock",feedback:"send",advanced:"shield",other:"dot"},dr="text-[11px] font-semibold uppercase tracking-[0.1em] text-fg-faint";function pr({node:t,schema:s}){const[n,o]=u.useState(""),[i,a]=u.useState(!1),[r,l]=u.useState(!0),d=t.kind==="object"?t:null,c=d?Object.keys(d.children):[],p=s.rootKeys(),m=new Set([...c,...p]),g=Array.from(m).sort().join(","),h=c.join(","),f=u.useMemo(()=>Qs(m),[g]),b=u.useMemo(()=>ro(m,new Set(c)),[g,h]),y=u.useMemo(()=>f.reduce((w,j)=>w+j.keys.length,0),[f]),k=u.useMemo(()=>f.filter(w=>i||!w.advanced).map(w=>({...w,keys:w.keys.filter(j=>{const P=(d==null?void 0:d.children[j])!==void 0;if(!r&&!P)return!1;if(!n.trim())return!0;const _=s.at([j]);return[j,Ye(j),(_==null?void 0:_.description)??""].join(" ").toLowerCase().includes(n.toLowerCase())})})).filter(w=>w.keys.length>0),[f,n,i,r,d,s]);return{filter:n,setFilter:o,showAdvanced:i,setShowAdvanced:a,showUnset:r,setShowUnset:l,rootNode:d,schema:s,groups:f,railGroups:b,visibleGroups:k,totalKeys:y}}function ur({cards:t,selectedId:s,onSelect:n}){return e.jsx("div",{className:"flex flex-col gap-px",role:"listbox","aria-label":"Settings groups",children:t.railGroups.map(o=>{const i=o.id===s;return e.jsxs("button",{type:"button",role:"option","aria-selected":i,"data-testid":"settings-group-row","data-group-id":o.id,onClick:()=>n(o.id),className:`w-full flex items-center gap-2.5 h-[34px] px-3 rounded-[9px] border text-left text-[13.5px] focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent ${i?"bg-bg-hi border-line font-semibold text-fg":"border-transparent text-fg-dim hover:bg-bg-hi/60"}`,children:[e.jsx(Ie,{name:cr[o.id]??"dot",size:16,className:`shrink-0 ${i?"text-accent":"text-fg-faint"}`}),e.jsx("span",{className:"flex-1 min-w-0 truncate",children:o.title}),e.jsxs("span",{className:`shrink-0 font-mono text-xs ${o.setCount?"text-fg-dim":"text-fg-faint"}`,children:[o.setCount,"/",o.total]})]},o.id)})})}function mr({cards:t,groupIds:s,targetScope:n,onOverride:o}){const{visibleGroups:i,rootNode:a,schema:r,filter:l}=t,d=i.filter(c=>s.includes(c.id));return e.jsxs("div",{className:"px-9 py-6 flex flex-col gap-[26px]",children:[d.map(c=>e.jsxs("section",{id:`settings-group-${c.id}`,"data-testid":"settings-group-section",children:[e.jsxs("div",{className:"flex items-baseline gap-3 mb-3",children:[e.jsxs("span",{className:dr,children:[c.title," · ",c.summary.replace(/\.$/,"")]}),c.advanced&&e.jsx("span",{className:"text-[9px] px-1.5 rounded border border-line text-fg-faint uppercase tracking-wide",children:"advanced"}),e.jsx("span",{"aria-hidden":!0,className:"flex-1 h-px bg-line"})]}),e.jsx("div",{className:"flex flex-col gap-2.5",children:c.keys.map(p=>e.jsx(vr,{keyName:p,node:a==null?void 0:a.children[p],info:r.at([p]),targetScope:n,onOverride:(m,g)=>o([p],m,g)},p))})]},c.id)),d.length===0&&e.jsx("div",{className:"px-6 py-12 text-center text-fg-faint text-sm",children:l.trim()?`no settings match "${l}"`:"nothing to show — turn on Show unset to see every setting in this group"})]})}const hr=[{stage:"default",label:"Default"},{stage:"user",label:"User"},{stage:"project",label:"Project"},{stage:"local",label:"Local"}],fr=["default","user"],wn=["default","user","project","local"];function gr(t){return t==="user"?fr:wn}const yr=["user","project","local"];function kn(t,s){if(t.kind==="leaf"){s.add(t.winner);for(const n of t.shadowed)s.add(n.scope)}else if(t.kind==="array")for(const n of t.items)s.add(n.fromScope);else for(const n of Object.values(t.children))kn(n,s)}function br(t,s){const n=new Set;if(s!==void 0&&n.add("default"),!t)return{effective:s!==void 0?"default":null,has:n};const o=new Set;return kn(t,o),o.forEach(a=>n.add(a)),t.kind==="leaf"?{effective:t.winner,has:n}:{effective:[...yr].reverse().find(a=>o.has(a))??null,has:n}}function xr({node:t,defaultVal:s,stages:n=wn}){const{effective:o,has:i}=br(t,s),a=hr.filter(r=>n.includes(r.stage));return e.jsx("div",{"data-testid":"source-ladder",className:"flex items-center gap-1.5 whitespace-nowrap","aria-label":"Where this value comes from",children:a.map(({stage:r,label:l},d)=>{const c=r===o,p=i.has(r);return e.jsxs("span",{className:"flex items-center gap-1.5",children:[d>0&&e.jsx("span",{"aria-hidden":!0,className:"w-3 h-px bg-line"}),e.jsxs("span",{"data-stage":r,"data-effective":c?"true":"false",title:c?`effective value comes from ${l}`:p?`${l} also sets this`:`not set in ${l}`,className:`flex items-center gap-1.5 text-xs ${c?"font-bold text-fg":p?"font-medium text-fg-dim":"font-medium text-fg-faint/70"}`,children:[e.jsx("span",{"aria-hidden":!0,className:`w-2.5 h-2.5 rounded-full box-border border-[1.5px] ${c?r==="default"?"bg-fg-faint border-fg-faint":"bg-accent border-accent":p?"border-fg-faint":"border-line"}`}),l]})]},r)})})}function vr({keyName:t,node:s,info:n,targetScope:o,onOverride:i}){const[a,r]=u.useState(!1),l=Ye(t),d=s!==void 0,c=(s==null?void 0:s.kind)==="leaf"?s:null,p=n==null?void 0:n.default,m=!!c&&p!==void 0&&Ht(c.value,p),g=!!c&&!m,h=vn(t,n==null?void 0:n.description),f=`${o}:${c?JSON.stringify(c.value):"∅"}`;return e.jsxs("div",{"data-testid":"setting-card","data-key":t,className:"px-[22px] py-4 rounded-[14px] bg-bg-hi border border-line",children:[e.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_minmax(0,250px)_auto_auto] items-center gap-x-7 gap-y-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2.5 flex-wrap",children:[e.jsx("h3",{className:"text-base font-semibold text-fg",children:l}),e.jsx("span",{className:"font-mono text-xs text-fg-faint",children:t}),(n==null?void 0:n.deprecated)&&e.jsx("span",{className:"text-[11px] italic text-fg-faint",children:"deprecated"}),(n==null?void 0:n.required)&&!d&&e.jsx("span",{className:"text-[11px] italic text-fg-faint",children:"required"})]}),h&&e.jsx("p",{className:`text-[13.5px] text-fg-dim mt-0.5 leading-relaxed ${h.authored?"inline-block border-b border-dotted border-fg-faint/70 cursor-help":""}`,title:h.authored?"In-app-authored description — not from the official Claude Code schema":void 0,children:Ar(h.text)})]}),e.jsx("div",{className:"min-w-0 text-[13px]",children:e.jsx(Cr,{keyName:t,node:s,info:n,onChange:b=>i(b),targetLabel:ze[o].label},f)}),e.jsx(xr,{node:s,defaultVal:p,stages:gr(o)}),e.jsx(wr,{keyName:t,title:l,expanded:a,onToggleDetails:()=>r(b=>!b),reset:g&&c?{label:`Reset · remove from ${ze[c.winner].label}`,run:()=>i(void 0,c.winner)}:null})]}),a&&e.jsxs("div",{"data-testid":"setting-details",className:"mt-3 pt-3 border-t border-line/60",children:[c&&e.jsx(kr,{leaf:c,defaultVal:p,onReset:b=>i(void 0,b)}),e.jsx(Er,{keyName:t,node:s,info:n})]})]})}function wr({keyName:t,title:s,expanded:n,onToggleDetails:o,reset:i}){const[a,r]=u.useState(!1),l=u.useRef(null),d=u.useId();u.useEffect(()=>{if(!a)return;const p=g=>{var h;(h=l.current)!=null&&h.contains(g.target)||r(!1)},m=g=>{g.key==="Escape"&&r(!1)};return window.addEventListener("mousedown",p),window.addEventListener("keydown",m),()=>{window.removeEventListener("mousedown",p),window.removeEventListener("keydown",m)}},[a]);const c="px-2.5 py-[7px] rounded-[5px] text-left whitespace-nowrap hover:bg-bg-elev";return e.jsxs("div",{ref:l,className:"relative",children:[e.jsx("button",{type:"button","data-testid":"setting-row-menu","aria-label":`More actions for ${s}`,"aria-haspopup":"menu","aria-expanded":a,"aria-controls":a?d:void 0,onClick:()=>r(p=>!p),className:"w-8 h-8 inline-flex items-center justify-center rounded-lg text-fg-faint hover:text-fg hover:bg-bg focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",children:"⋯"}),a&&e.jsxs("div",{id:d,role:"menu","aria-label":`Actions for ${t}`,className:`absolute ${Pe.dialog} right-0 top-9 min-w-[220px] p-[5px] flex flex-col gap-1 bg-bg-hi border border-line rounded-lg shadow-lg text-[13px] text-fg`,children:[i&&e.jsxs("button",{type:"button",role:"menuitem","data-testid":"setting-row-reset",className:c,onClick:()=>{r(!1),i.run()},children:["↺ ",i.label]}),e.jsx("button",{type:"button",role:"menuitem","data-testid":"setting-row-details",className:c,onClick:()=>{r(!1),o()},children:n?"Hide values across scopes":"Values across scopes…"})]})]})}function kr({leaf:t,defaultVal:s,onReset:n}){const o={};o[t.winner]={value:t.value,winner:!0};for(const i of t.shadowed)o[i.scope]={value:i.value,winner:!1};return e.jsxs("div",{className:"mt-2 border border-line rounded bg-bg-elev/40 text-xs",children:[e.jsx("div",{className:"px-2 py-1 text-fg-faint border-b border-line/60",children:"Values across all scopes (winner highlighted · reset removes that scope's value):"}),e.jsxs("div",{className:"divide-y divide-line/60",children:[["user","project","local"].map(i=>{const a=o[i],r=a!==void 0;return e.jsxs("div",{className:"grid grid-cols-[5rem_1fr_auto] gap-2 px-2 py-1 items-center",children:[e.jsx("span",{className:"text-fg-faint",children:ze[i].label}),e.jsx("span",{className:`font-mono truncate ${a!=null&&a.winner?"text-accent":"text-fg-dim"}`,children:r?ot(a.value):e.jsx("span",{className:"text-fg-faint",children:"—"})}),r?e.jsx("button",{onClick:()=>n(i),className:"text-[9px] px-1.5 py-0 rounded border border-line text-fg-faint uppercase tracking-wide hover:text-fg hover:bg-bg-hi",title:`delete this key from ${ze[i].label}`,children:"↺"}):e.jsx("span",{})]},i)}),e.jsxs("div",{className:"grid grid-cols-[5rem_1fr_auto] gap-2 px-2 py-1 items-center",children:[e.jsx("span",{className:"text-fg-faint",children:"Default"}),e.jsx("span",{className:"font-mono text-fg-dim truncate",children:s!==void 0?ot(s):e.jsx("span",{className:"text-fg-faint",children:"—"})}),e.jsx("span",{})]})]})]})}function Er({keyName:t,node:s,info:n}){const i=(s==null?void 0:s.kind)==="leaf"?s:null,a=vn(t,n==null?void 0:n.description);return e.jsxs("div",{className:"mt-2 space-y-2 text-xs",children:[a&&e.jsx("p",{className:`text-fg-dim leading-relaxed whitespace-pre-wrap ${a.authored?"inline-block border-b border-dotted border-fg-faint/70 cursor-help":""}`,title:a.authored?"In-app-authored description — not from the official Claude Code schema":void 0,children:a.text}),e.jsxs("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-fg-faint",children:[(n==null?void 0:n.type)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Type"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:Array.isArray(n.type)?n.type.join(" | "):n.type})]}),(n==null?void 0:n.default)!==void 0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Default"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:ot(n.default)})]}),(n==null?void 0:n.enum)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Options"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:n.enum.map(r=>String(r)).join(" | ")})]}),i&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Current"}),e.jsxs("dd",{className:"font-mono",children:[e.jsx("span",{className:"text-fg-dim",children:ot(i.value)}),e.jsxs("span",{className:"ml-2 text-fg-faint",children:["from ",ze[i.winner].label]})]})]}),i&&i.shadowed.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Shadowed"}),e.jsx("dd",{className:"space-y-0.5",children:i.shadowed.map((r,l)=>e.jsxs("div",{className:"font-mono text-fg-faint line-through",children:[ot(r.value)," —"," ",e.jsx("span",{className:"no-underline",children:ze[r.scope].label})]},l))})]}),(s==null?void 0:s.kind)==="array"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Accumulated"}),e.jsxs("dd",{className:"text-fg-dim",children:[s.items.length," items across all scopes"]})]})]})]})}const Sr=new Set(["outputStyle"]),jt="\0unset",ks="\0custom",En="w-full h-9 px-3 rounded-[10px] bg-bg border border-line font-mono text-[13px] text-fg placeholder:text-fg-faint focus:outline-none focus:border-fg-faint";function Cr({keyName:t,node:s,info:n,onChange:o,targetLabel:i}){var p;const a=(s==null?void 0:s.kind)==="leaf",r=a?s.value:void 0,l=a?r:n==null?void 0:n.default,d=_r(n==null?void 0:n.type),c=`${Ye(t)} — writes ${i}`;return d==="boolean"?e.jsx("span",{className:"flex items-center gap-2","aria-label":c,children:e.jsx(Me,{checked:l===!0,onChange:m=>o(m),label:l===!0?"on":"off"})}):n!=null&&n.enum?e.jsx(Es,{options:n.enum,value:l,onChange:o,aria:c,allowCustom:!1}):d==="string"&&Sr.has(t)&&((p=n==null?void 0:n.examples)!=null&&p.length)?e.jsx(Es,{options:n.examples,value:l,onChange:o,aria:c,allowCustom:!0}):d==="integer"||d==="number"?e.jsx(Ft,{kind:"number",initial:typeof l=="number"?String(l):"",aria:c,onCommit:m=>{if(m.trim()==="")return o(void 0);const g=d==="integer"?parseInt(m,10):parseFloat(m);Number.isNaN(g)||o(g)}}):d==="string"?e.jsx(Ft,{kind:"text",initial:typeof l=="string"?l:"",aria:c,onCommit:m=>o(m===""?void 0:m)}):e.jsxs("div",{className:"text-xs text-fg-faint",children:[(s==null?void 0:s.kind)==="array"?`${s.items.length} items · `:"","edit in ",e.jsx("span",{className:"text-fg-dim",children:"{ } Raw JSON"})]})}function Es({options:t,value:s,onChange:n,aria:o,allowCustom:i}){const[a,r]=u.useState(!1),l=s!==void 0,d=t.filter(g=>l||g!=="default"),c=l&&d.some(g=>Ht(g,s)),p=l&&!c?[s,...d]:d;if(a)return e.jsx(Ft,{kind:"text",initial:"",aria:o,autoFocus:!0,onCommit:g=>g===""?r(!1):n(g)});const m=l?p.findIndex(g=>Ht(g,s)):-1;return e.jsxs("select",{"aria-label":o,value:m>=0?String(m):jt,onChange:g=>{const h=g.target.value;if(h===ks)return r(!0);n(h===jt?void 0:p[Number(h)])},className:En,children:[!l&&e.jsx("option",{value:jt,children:"default"}),p.map((g,h)=>e.jsx("option",{value:String(h),children:String(g)},h)),i&&e.jsx("option",{value:ks,children:"custom…"})]})}function Ft({kind:t,initial:s,aria:n,onCommit:o,autoFocus:i}){const[a,r]=u.useState(s),l=()=>{a!==s&&o(a)};return e.jsx("input",{type:t,"aria-label":n,value:a,placeholder:"not set",autoFocus:i,onChange:d=>r(d.target.value),onBlur:l,onKeyDown:d=>{d.key==="Enter"&&d.target.blur(),d.key==="Escape"&&r(s)},className:En})}function _r(t){if(t)return Array.isArray(t)?t.find(n=>n!=="null")??t[0]:t}function Ht(t,s){return t===s?!0:typeof t!=typeof s?!1:t&&s&&typeof t=="object"?JSON.stringify(t)===JSON.stringify(s):!1}function Ar(t){const s=t.trim().split(`
61
- `)[0],n=s.match(/^([^.!?]+[.!?])/);return n?n[1]:s.length>120?s.slice(0,120)+"…":s}function ot(t){if(typeof t=="string")return t===""?'""':JSON.stringify(t);if(t===null)return"null";if(t===void 0)return"—";if(typeof t=="object"){const s=JSON.stringify(t);return s.length>60?s.slice(0,60)+"…":s}return String(t)}const Nr={user:{title:"Global settings",body:"This is the real ~/.claude/settings.json on disk — the same file the claude CLI reads on every session it starts. Edits apply machine-wide, to every project and every session."},project:{title:"Project settings",body:"This is the real <project>/.claude/settings.json on disk, checked into git. Edits apply to every current and future session in this project, for anyone who clones it."},local:{title:"Local settings",body:"This is the real <project>/.claude/settings.local.json on disk, gitignored. Edits apply to every current and future session in this project, on this machine only."}},Sn="text-[11px] font-semibold uppercase tracking-[0.1em] text-fg-faint",Ss={user:{label:"User",meta:"~/.claude/settings.json · every project"},project:{label:"Project",meta:".claude/settings.json · in git"},local:{label:"Local",meta:"settings.local.json · this machine"}};function Cs({on:t}){return e.jsx("span",{"aria-hidden":!0,className:`w-4 h-4 shrink-0 mt-0.5 rounded-full box-border ${t?"border-[5px] border-fg":"border-[1.5px] border-fg-faint"}`})}function _s({scope:t,selected:s}){return e.jsxs("span",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:`block text-[13.5px] ${s?"font-semibold text-fg":"font-medium text-fg-dim"}`,children:Ss[t].label}),e.jsx("span",{className:"block font-mono text-[11.5px] text-fg-faint break-words",children:Ss[t].meta})]})}function Or({scope:t,mtimeMs:s,exists:n,onScopeChange:o}){const i=n?s?`edited ${eo(s)}`:"":"not created yet";return e.jsxs("div",{"data-testid":"settings-file-card",title:Nr[t].body,className:"px-3.5 pt-3.5 pb-3 rounded-[14px] bg-bg-hi border border-line flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center px-0.5 pb-1",children:[e.jsx("span",{className:`flex-1 ${Sn}`,children:"SETTINGS FILE"}),e.jsx("span",{className:"text-[11.5px] text-fg-faint",children:i})]}),t==="user"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-[11px] p-2.5 rounded-[10px] bg-bg border border-line",children:[e.jsx(Cs,{on:!0}),e.jsx(_s,{scope:"user",selected:!0})]}),e.jsx("div",{className:"px-2.5 pt-1.5 text-xs leading-snug text-fg-faint",children:"Each project can override any of these in its own Claude config."})]}):e.jsx("div",{role:"radiogroup","aria-label":"Settings file",className:"flex flex-col gap-1",children:["project","local"].map(a=>{const r=a===t;return e.jsxs("button",{type:"button",role:"radio","aria-checked":r,"data-testid":`settings-file-${a}`,disabled:!o,onClick:()=>o==null?void 0:o(a),className:`w-full text-left flex gap-[11px] p-2.5 rounded-[10px] border focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent ${r?"bg-bg border-line":"border-transparent hover:bg-bg/60"}`,children:[e.jsx(Cs,{on:r}),e.jsx(_s,{scope:a,selected:r})]},a)})})]})}function mt({testId:t,icon:s,label:n,trailing:o,selected:i,onSelect:a}){return e.jsxs("button",{type:"button","data-testid":t,"aria-current":i,onClick:a,className:`w-full flex items-center gap-2.5 h-[34px] px-3 rounded-[9px] border text-left text-[13.5px] focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent ${i?"bg-bg-hi border-line font-semibold text-fg":"border-transparent text-fg-dim hover:bg-bg-hi/60"}`,children:[e.jsx(Ie,{name:s,size:16,className:`shrink-0 ${i?"text-accent":"text-fg-faint"}`}),e.jsx("span",{className:"flex-1 min-w-0 truncate",children:n}),e.jsx("span",{className:"shrink-0 text-xs text-fg-faint whitespace-nowrap",children:o})]})}function ht({eyebrow:t,title:s,summary:n,actions:o}){return e.jsxs("div",{"data-testid":"settings-detail-header",className:"shrink-0 px-9 pt-6 pb-5 border-b border-line flex items-end gap-4 whitespace-nowrap",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:`truncate ${Sn}`,children:t}),e.jsxs("div",{className:"mt-1 flex items-baseline gap-3.5 min-w-0",children:[e.jsx("span",{className:"shrink-0 font-serif text-[34px] font-medium leading-tight text-fg",children:s}),n&&e.jsx("span",{className:"truncate text-[14.5px] text-fg-dim",children:n})]})]}),o&&e.jsx("div",{className:"shrink-0 flex items-center gap-4",children:o})]})}const jr="https://code.claude.com/docs/en/settings";function As(){const[t,s]=u.useState(!1),n=u.useRef(null),o=u.useId();return u.useEffect(()=>{if(!t)return;const i=r=>{var l;(l=n.current)!=null&&l.contains(r.target)||s(!1)},a=r=>{r.key==="Escape"&&s(!1)};return window.addEventListener("mousedown",i),window.addEventListener("keydown",a),()=>{window.removeEventListener("mousedown",i),window.removeEventListener("keydown",a)}},[t]),e.jsxs("div",{ref:n,className:"relative",children:[e.jsx("button",{type:"button","data-testid":"settings-more","aria-label":"More actions","aria-haspopup":"menu","aria-expanded":t,"aria-controls":t?o:void 0,onClick:()=>s(i=>!i),className:"h-9 w-9 inline-flex items-center justify-center rounded-[10px] bg-bg-hi border border-line text-fg-dim hover:text-fg focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",children:"⋯"}),t&&e.jsx("div",{id:o,role:"menu","aria-label":"More actions",className:`absolute ${Pe.dialog} right-0 top-[42px] min-w-[200px] p-[5px] flex flex-col bg-bg-hi border border-line rounded-lg shadow-lg text-[13px] text-fg`,children:e.jsx("a",{role:"menuitem",href:jr,target:"_blank",rel:"noreferrer",onClick:()=>s(!1),className:"px-2.5 py-[7px] rounded-[5px] whitespace-nowrap hover:bg-bg-elev",children:"Settings schema reference ↗"})})]})}function Tr(t){let s=0;for(const n of["allow","ask","deny"]){const o=Vs(t,["permissions",n]);(o==null?void 0:o.kind)==="array"&&(s+=o.items.length)}return s}function Lr({scope:t="user",onScopeChange:s}={}){var X;const n=Oe(),o=os(N=>N.tabs),i=os(N=>N.activeTabId),a=o.find(N=>N.id===i)??null,r=(a==null?void 0:a.cwd)??null,[l,d]=u.useState("general"),[c,p]=u.useState(null);Yn("settings",N=>{(N==="general"||N==="permissions"||N==="hooks"||N==="raw")&&d(N)});const m=zt(qs,n,t==="user"?null:r),g=m[t]??null,h=G(N=>N.files),f=G(N=>N.setDraft),b=G(N=>N.saveJson),y=G(N=>N.revert),[k,w]=u.useState(null),j=u.useMemo(()=>Xn(Jn(h,m)),[h,m]),P=un(),_=pr({node:j,schema:P}),S=(N,Z,ie)=>{var he;const re=ie??t,we=m[re];if(!we)return;const je=((he=h[we])==null?void 0:he.draftRaw)??"";if(je.trim())try{JSON.parse(je)}catch(be){w(`${we} is not valid JSON (${be instanceof Error?be.message:String(be)}) — fix it in Raw before editing from General.`);return}w(null),window.api.claudeConfig.patch({fileId:"settings",scope:re,cwd:r,keyPath:N,value:Z}).catch(be=>W.error(be instanceof Error?be.message:String(be)))},A=Se(N=>N.tab),L=Se(N=>N.id),E=Se(N=>N.clear),T=u.useRef(null),[O,I]=u.useState(null);if(u.useEffect(()=>{if(A!=="settings"||!L||!n)return;const N=L.startsWith("settings:")?L.slice(9):null,Z=N?bt.find(re=>re.keys.includes(N)):void 0,ie=N?_.groups.find(re=>re.keys.includes(N)):void 0;Z!=null&&Z.tab?d(Z.tab):N&&ie&&(ie.advanced&&!_.showAdvanced&&_.setShowAdvanced(!0),_.showUnset||_.setShowUnset(!0),_.setFilter(""),p(ie.id),d("general"),I(N)),E()},[A,L,n,_,E]),u.useEffect(()=>{if(!O)return;I(null);const N=T.current,Z=N==null?void 0:N.querySelector('[data-testid="config-workbench-detail"]'),ie=Array.from((N==null?void 0:N.querySelectorAll('[data-testid="setting-card"]'))??[]).find(re=>re.dataset.key===O);Z&&ie&&Qn(Z,ie,{block:"start"})},[O]),!n)return e.jsx(K,{title:"loading…"});const M=g?h[g]:null,ue=t!=="user"&&!r,le=_.railGroups,te=c&&le.some(N=>N.id===c)?c:((X=le[0])==null?void 0:X.id)??null,ee=le.find(N=>N.id===te)??null,ce=_.groups.find(N=>N.id===te)??null,J=_.filter.trim()!=="",me=N=>{var Z;(Z=_.groups.find(ie=>ie.id===N))!=null&&Z.advanced&&!_.showAdvanced&&_.setShowAdvanced(!0),_.setFilter(""),p(N),d("general")},V=N=>{var Z;_.setShowAdvanced(N),!N&&(ce!=null&&ce.advanced)&&p(((Z=le.find(ie=>!ie.advanced))==null?void 0:Z.id)??null)},B=bt.find(N=>N.id==="hooks"),z=B?B.keys.filter(N=>Vs(j,[N])!==null).length:0,se=Tr(j),Q=t.toUpperCase(),oe=e.jsxs(e.Fragment,{children:[e.jsx(Or,{scope:t,mtimeMs:(M==null?void 0:M.mtimeMs)??null,exists:(M==null?void 0:M.exists)??!0,onScopeChange:s}),e.jsxs("label",{className:"flex items-center gap-2 h-[38px] px-3 rounded-[10px] bg-bg-hi border border-line text-[13px] text-fg-faint focus-within:border-fg-faint",children:[e.jsx(Ie,{name:"search",size:15,className:"shrink-0"}),e.jsx("input",{type:"search","aria-label":"Search settings",placeholder:`Search ${_.totalKeys} settings`,value:_.filter,onChange:N=>{_.setFilter(N.target.value),d("general")},className:"flex-1 min-w-0 bg-transparent outline-none text-fg placeholder:text-fg-faint"})]}),e.jsx(ur,{cards:_,selectedId:l==="general"&&!J?te:null,onSelect:me}),e.jsxs("div",{className:"flex flex-col gap-px border-t border-line pt-2.5",children:[e.jsx(mt,{testId:"settings-row-permissions",icon:"permissions",label:"Permissions",trailing:se?`${se} ${se===1?"rule":"rules"}`:"none set",selected:l==="permissions",onSelect:()=>d("permissions")}),e.jsx(mt,{testId:"settings-row-hooks",icon:"hooks",label:"Hooks",trailing:`${z}/${(B==null?void 0:B.keys.length)??0}`,selected:l==="hooks",onSelect:()=>d("hooks")}),e.jsx(mt,{testId:"settings-row-tool-risk",icon:"shield",label:"Tool risk",trailing:t==="user"?"system":"this project",selected:l==="tool-risk",onSelect:()=>d("tool-risk")}),t!=="user"&&e.jsx(mt,{testId:"settings-row-epic-isolation",icon:"projects",label:"Epic isolation",trailing:"this project",selected:l==="epic-isolation",onSelect:()=>d("epic-isolation")})]})]}),Ue=e.jsx("button",{type:"button",onClick:()=>d("raw"),className:"h-9 px-3.5 rounded-[10px] border border-line bg-bg-hi font-mono text-[13px] font-medium text-fg hover:bg-bg-elev focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",children:"{ } Raw JSON"}),fe=N=>e.jsxs(e.Fragment,{children:[N,Ue,e.jsx(As,{})]}),Ce=k&&l!=="raw"?e.jsx("div",{role:"alert",className:"shrink-0 mx-9 mt-3 px-3 py-2 rounded border border-line text-xs text-red-400",children:k}):null;let Y;if(ue)Y=e.jsx(K,{title:"no active project",hint:"open a tab in a project directory to edit project or local settings"});else if(!g)Y=e.jsx(K,{title:"resolving…"});else if(l==="tool-risk")Y=e.jsx(ar,{scope:t==="user"?"user":"project",cwd:t==="user"?null:r});else if(l==="epic-isolation"&&t!=="user"&&r)Y=e.jsx(or,{cwd:r});else if(l==="general"||l==="epic-isolation"){const N=J?{title:"Search",summary:`settings matching "${_.filter.trim()}"`}:{title:(ee==null?void 0:ee.title)??"Settings",summary:ce==null?void 0:ce.summary};Y=e.jsxs(e.Fragment,{children:[e.jsx(ht,{eyebrow:`${Q} SETTINGS · ${(ee==null?void 0:ee.setCount)??0} OF ${(ee==null?void 0:ee.total)??0} SET`,title:N.title,summary:N.summary,actions:e.jsxs(e.Fragment,{children:[e.jsx(Me,{checked:_.showUnset,onChange:_.setShowUnset,label:"Show unset"}),e.jsx(Me,{checked:_.showAdvanced,onChange:V,label:"Advanced"}),fe()]})}),Ce,e.jsx(mr,{cards:_,groupIds:J?_.visibleGroups.map(Z=>Z.id):te?[te]:[],targetScope:t,onOverride:S})]})}else l==="permissions"?Y=e.jsxs(e.Fragment,{children:[e.jsx(ht,{eyebrow:`${Q} SETTINGS · PERMISSIONS`,title:"Permissions",summary:"What Claude may do without asking.",actions:fe()}),Ce,e.jsx("div",{className:"px-6 py-3",children:e.jsx(mn,{scope:t,cwd:r,activePath:g})})]}):l==="hooks"?Y=e.jsx(xn,{scope:t,cwd:r,path:g,renderLayout:({banners:N,list:Z,detail:ie})=>e.jsxs(e.Fragment,{children:[e.jsx(ht,{eyebrow:`${Q} SETTINGS · HOOKS`,title:"Hooks",summary:"Commands that run on Claude Code events.",actions:fe()}),Ce,N,e.jsxs("div",{"data-testid":"settings-hooks-body",className:"flex-1 min-h-0 flex mt-3 border-t border-line",children:[e.jsx("div",{className:"w-56 shrink-0 border-r border-line overflow-y-auto",children:Z}),e.jsx("div",{className:"flex-1 min-w-0 overflow-y-auto",children:ie})]})]})}):M?Y=e.jsxs(e.Fragment,{children:[e.jsx(ht,{eyebrow:`${Q} SETTINGS · RAW JSON`,title:"Raw JSON",summary:"The whole file, as the claude CLI reads it.",actions:e.jsx(As,{})}),e.jsx("div",{"data-testid":"settings-raw-editor",className:"flex-1 min-h-0 overflow-clip mt-3",children:e.jsx(Zn,{path:g,value:M.draftRaw,onChange:N=>{w(null),f(g,N)}})}),e.jsx("div",{className:"shrink-0 border-t border-line bg-bg-elev",children:e.jsx(_t,{dirty:M.dirty,busy:M.busy,parseError:k||M.parseError,lastSavedAt:M.lastSavedAt,leading:M.exists?null:e.jsx("span",{children:"file will be created on save"}),onSave:async()=>{w(null);const N=await b(g);N.ok||w(N.error??"save failed")},onRevert:()=>{w(null),y(g)}})})]}):Y=e.jsx(K,{title:"resolving…"});return e.jsx("div",{ref:T,"data-testid":"settings-page",className:"flex h-full min-h-0 bg-bg text-fg",children:e.jsx(St,{list:oe,detail:Y})})}const rl=u.memo(Lr),Dr=2;function Ke(t){return`${t.source}:${t.pluginKey??t.cwd??""}:${t.name}`}const Tt=new Map,Pr=t=>t instanceof Error?t.message:String(t);async function Rr(t){try{return await window.api.mcp.checkServer(t)}catch(s){const n=Pr(s);return W.error(`MCP check of ${t.name} failed: ${n}`),{ok:!1,status:"failed",error:n,checkedAt:Date.now()}}}const Ve=Kt((t,s)=>({results:{},checking:{},check:n=>{const o=Ke(n),i=Tt.get(o);if(i)return i;t(r=>({checking:{...r.checking,[o]:!0}}));const a=Rr(n).then(r=>(Tt.delete(o),t(l=>{const d={...l.checking};return delete d[o],{results:{...l.results,[o]:r},checking:d}}),r));return Tt.set(o,a),a},checkAll:async n=>{const o=[...new Map(n.map(r=>[Ke(r),r])).values()];let i=0;const a=async()=>{for(;i<o.length;)await s().check(o[i++])};await Promise.all(Array.from({length:Math.min(Dr,o.length)},a))}})),Ir=t=>t.results,Mr=t=>t.checking,Gt={unchecked:"Not checked",connected:"Connected",failed:"Failed","needs-auth":"Needs auth"},Cn={unchecked:"border-[1.5px] border-fg-faint/60",connected:"bg-sage",failed:"bg-red-500","needs-auth":"bg-honey"},Ur={unchecked:"bg-bg-elev text-fg-dim",connected:"bg-sage/15 text-sage-dark",failed:"bg-red-500/10 text-red-700","needs-auth":"bg-honey/15 text-honey-dark"},$r={user:"User scope",project:"Project scope",local:"Local scope"},Br=8,Fr=3e4,Hr="••••••••",Gr=/^[A-Za-z0-9_@%+=:,./-]+$/;function Wr(t){return Gr.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`}function Zt(t){return(t.type??"stdio")!=="stdio"}function qr(t){return Zt(t)?t.url??"":t.command?[t.command,...t.args??[]].map(Wr).join(" "):""}const Wt=t=>t.replace(/[^A-Za-z0-9_-]/g,"_");function Ns(t,s){return`mcp__${Wt(t)}__${Wt(s)}`}const Lt="h-[38px] inline-flex items-center whitespace-nowrap px-4 bg-bg-hi border border-line rounded-[10px] text-[13.5px] font-medium text-fg hover:border-rule disabled:opacity-50 disabled:hover:border-line",_n="text-[13px] font-semibold text-accent hover:text-accent-dark",Kr="text-[11px] font-semibold uppercase tracking-[0.1em] text-fg-faint";function An({label:t}){return e.jsx("div",{className:"px-3 py-1.5 flex items-center text-xs",children:e.jsxs("span",{"data-testid":"savebar-clean",className:"min-w-0 flex items-center gap-[7px] text-fg-faint",children:[e.jsx("span",{"aria-hidden":"true",className:"shrink-0 w-1.5 h-1.5 rounded-full bg-sage"}),e.jsx("span",{className:"truncate",children:t})]})})}function Os({name:t,server:s,scope:n,fileLabel:o,plugin:i,checkRequest:a,origin:r,onChange:l,editing:d=!1,onEditingChange:c,editor:p,footer:m,cleanLabel:g,approval:h}){const f=i!==void 0,b=!f&&d,y=a?Ke(a):null,k=Ve(A=>y===null?void 0:A.results[y]),w=Ve(A=>y===null?!1:A.checking[y]===!0),j=Ve(A=>A.check);Vr(Fr,k!==void 0);const P=(k==null?void 0:k.status)??"unchecked",_=Zt(s),S=()=>{a&&j(a)};return e.jsxs("div",{"data-testid":"mcp-detail",className:"flex flex-col min-w-0",children:[e.jsxs("div",{className:"shrink-0 px-9 pt-6 pb-5 border-b border-line flex items-end gap-3 whitespace-nowrap",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{"data-testid":"mcp-detail-meta",className:`truncate ${Kr}`,children:[e.jsx("span",{"data-testid":"mcp-detail-origin",children:Le[r]})," · ",e.jsx("span",{"data-testid":"mcp-detail-transport",children:f?"plugin":s.type??"stdio"})," · ",f?e.jsxs(e.Fragment,{children:[e.jsxs("span",{"data-testid":"mcp-detail-plugin",children:["via the ",i," plugin"]})," · ",e.jsx("span",{"data-testid":"mcp-detail-readonly",children:"read-only"})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{"data-testid":"mcp-detail-scope",children:$r[n]})," · ",e.jsxs("span",{"data-testid":"mcp-detail-keypath",children:[o," › mcpServers › ",t]})]})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2.5 min-w-0",children:[e.jsx("h2",{"data-testid":"mcp-detail-name",className:"min-w-0 truncate font-mono text-[27px] font-semibold tracking-[-0.015em] text-fg",children:t}),e.jsxs("span",{"data-testid":"mcp-detail-status","data-status":P,title:k&&!k.ok?k.error:void 0,className:`shrink-0 inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-semibold ${Ur[P]}`,children:[e.jsx("span",{"aria-hidden":"true",className:`w-1.5 h-1.5 shrink-0 box-border rounded-full ${Cn[P]}${w?" animate-pulse":""}`}),Gt[P]]})]})]}),e.jsxs("div",{className:"shrink-0 flex items-center gap-2",children:[n==="user"&&!f?e.jsxs("span",{"data-testid":"mcp-detail-scope-note",className:"mr-2 inline-flex items-center gap-2 text-[13px] text-fg-dim",children:[e.jsx("span",{"aria-hidden":"true",className:"w-[7px] h-[7px] rounded-full bg-sage"}),"On in every project"]}):null,h&&!f?e.jsx("span",{"data-testid":"mcp-detail-approved",title:"disabledMcpjsonServers in .claude/settings.json",className:"mr-2 inline-flex text-[13px]",children:e.jsx(Me,{checked:h.approved,disabled:h.busy,onChange:h.onChange,label:"Approved"})}):null,e.jsx("button",{type:"button","data-testid":"mcp-check-again",onClick:S,disabled:a===null||w,className:Lt,children:w?"Checking…":"Check again"}),f?null:b?e.jsx("button",{type:"button","data-testid":"mcp-edit-done",onClick:()=>c==null?void 0:c(!1),className:Lt,children:"Done"}):e.jsx("button",{type:"button","data-testid":"mcp-edit-json",onClick:()=>c==null?void 0:c(!0),className:Lt,children:"Edit JSON"})]})]}),e.jsxs("div",{className:"px-9 py-7 flex flex-col gap-5 max-w-[1100px]",children:[b?p:e.jsxs(e.Fragment,{children:[e.jsx(zr,{server:s,readOnly:f}),f?null:_?e.jsx(js,{testId:"mcp-headers",label:"Headers",noun:"header",separator:":",emptyText:"No headers set.",values:s.headers??{},onAdd:(A,L)=>l==null?void 0:l({...s,headers:{...s.headers??{},[A]:L}})}):e.jsx(js,{testId:"mcp-env",label:"Environment",noun:"variable",separator:"=",emptyText:"No variables set.",values:s.env??{},onAdd:(A,L)=>l==null?void 0:l({...s,env:{...s.env??{},[A]:L}})}),e.jsx(Yr,{serverName:t,result:k,checking:w,canCheck:a!==null,onCheck:S})]}),g!==void 0?e.jsx("div",{className:"-mx-3",children:e.jsx(An,{label:g})}):m!==void 0?e.jsx("div",{className:"-mx-3",children:m}):null]})]})}function Vr(t,s){const[,n]=u.useState(0);u.useEffect(()=>{if(!s)return;const o=window.setInterval(()=>n(i=>i+1),t);return()=>window.clearInterval(o)},[t,s])}function zr({server:t,readOnly:s}){const n=Zt(t),o=qr(t),i=async()=>{await Hs(o)?W.success(n?"URL copied":"Command copied"):W.error(n?"Copy failed — the URL was not copied":"Copy failed — the command was not copied")};return e.jsx(Ge,{label:n?"URL":"Command",action:e.jsxs("button",{type:"button","data-testid":"mcp-command-copy",onClick:()=>void i(),disabled:!o,className:"shrink-0 inline-flex items-center gap-[7px] text-[13px] text-fg-dim hover:text-fg disabled:opacity-50 disabled:hover:text-fg-dim",children:[e.jsx("span",{"aria-hidden":"true","data-testid":"mcp-command-copy-icon",className:"inline-flex shrink-0",children:e.jsx(Ie,{name:"copy",size:15})}),"Copy"]}),children:e.jsx("div",{"data-testid":"mcp-command-box",className:"font-mono text-[16px] text-fg",children:o?e.jsx("span",{"data-testid":"mcp-command",className:"break-words",children:o}):e.jsx("span",{"data-testid":"mcp-command-empty",className:"font-sans text-[14px] text-fg-faint",children:s?n?"No URL set.":"No command set.":n?"No URL set — Edit JSON to add one.":"No command set — Edit JSON to add one."})})})}function js({testId:t,label:s,noun:n,separator:o,emptyText:i,values:a,onAdd:r}){const[l,d]=u.useState(()=>new Set),[c,p]=u.useState(!1),[m,g]=u.useState(""),h=u.useRef(null),f=Object.keys(a),b=m.trim(),y=b!==""&&!/\s/.test(b)&&!b.includes(o),k=_=>d(S=>{const A=new Set(S);return A.has(_)?A.delete(_):A.add(_),A}),w=()=>{p(!1),g("")},j=()=>{var _;y&&(r(b,((_=h.current)==null?void 0:_.value)??""),w())},P=_=>{_.key==="Enter"?(_.preventDefault(),j()):_.key==="Escape"&&(_.preventDefault(),w())};return e.jsx("div",{"data-testid":t,children:e.jsx(Ge,{label:s,labelNote:String(f.length),children:e.jsxs("div",{className:"flex flex-col gap-1.5",children:[f.length===0&&!c?e.jsx("div",{"data-testid":`${t}-empty`,className:"text-[14px] text-fg-dim",children:i}):null,f.map(_=>{const S=l.has(_);return e.jsxs("div",{"data-testid":`${t}-row-${_}`,className:"flex items-center gap-2.5 font-mono text-[13.5px]",children:[e.jsx("span",{className:"shrink-0 font-semibold text-fg",children:_}),e.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-fg-faint/60",children:o}),e.jsx("span",{"data-testid":`${t}-value-${_}`,title:S?void 0:"Hidden — Show reveals it",className:`min-w-0 break-words ${S?"text-fg-dim":"text-fg-faint tracking-wider"}`,children:S?a[_]:Hr}),e.jsx("button",{type:"button","data-testid":`${t}-reveal-${_}`,"aria-pressed":S,"aria-label":`${S?"Hide":"Show"} the value of ${_}`,onClick:()=>k(_),className:"ml-auto shrink-0 font-sans text-[13px] text-fg-dim hover:text-fg",children:S?"Hide":"Show"})]},_)}),c?e.jsxs("div",{"data-testid":`${t}-add-form`,className:"flex items-center gap-2 py-1",children:[e.jsx("input",{"data-testid":`${t}-new-key`,"aria-label":`New ${n} name`,value:m,onChange:_=>g(_.target.value),onKeyDown:P,placeholder:n==="variable"?"KEY":"Header-Name",spellCheck:!1,autoFocus:!0,className:"w-44 h-8 px-2 bg-bg border border-line rounded-md font-mono text-xs text-fg"}),e.jsx("span",{"aria-hidden":"true",className:"font-mono text-xs text-fg-faint",children:o}),e.jsx("input",{ref:h,type:"password",autoComplete:"off","data-testid":`${t}-new-value`,"aria-label":`New ${n} value`,onKeyDown:P,placeholder:"value",spellCheck:!1,className:"flex-1 min-w-0 h-8 px-2 bg-bg border border-line rounded-md font-mono text-xs text-fg"}),e.jsx("button",{type:"button","data-testid":`${t}-add-confirm`,onClick:j,disabled:!y,className:"shrink-0 h-8 px-3 rounded-md bg-accent text-bg-hi text-xs font-semibold hover:bg-accent/90 disabled:opacity-50 disabled:hover:bg-accent",children:"Add"}),e.jsx("button",{type:"button","data-testid":`${t}-add-cancel`,onClick:w,className:"shrink-0 h-8 px-2 text-xs text-fg-faint hover:text-fg",children:"Cancel"})]}):e.jsx("div",{className:"pt-1",children:e.jsxs("button",{type:"button","data-testid":`${t}-add`,onClick:()=>p(!0),className:_n,children:["+ Add ",n]})})]})})})}function Yr({serverName:t,result:s,checking:n,canCheck:o,onCheck:i}){const[a,r]=u.useState(!1),l=Date.now(),d=`mcp__${Wt(t)}__…`;if(!s&&!n)return e.jsxs("div",{"data-testid":"mcp-tools",className:"flex items-center gap-4 px-[18px] py-4 rounded-[14px] border border-dashed border-rule",children:[e.jsx("span",{"data-testid":"mcp-tools-empty-icon",className:"shrink-0 flex text-fg-faint",children:e.jsx(Ie,{name:"tool",size:26})}),e.jsxs("div",{"data-testid":"mcp-tools-empty",className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[15px] font-semibold text-fg",children:"Tools appear after a check"}),e.jsxs("div",{className:"text-[13.5px] text-fg-dim",children:["A check connects to ",t," once and lists every tool it offers, named"," ",e.jsx("span",{className:"font-mono text-[12.5px]",children:d})]})]}),e.jsxs("button",{type:"button","data-testid":"mcp-tools-check",onClick:i,disabled:!o,className:"shrink-0 h-[38px] px-4 rounded-[10px] bg-accent text-bg-hi hover:bg-accent/90 text-[13.5px] font-semibold disabled:opacity-50",children:["Check ",t]})]});const c=s!=null&&s.ok?s.tools:[],p=a?c:c.slice(0,Br),m=c.length-p.length,g=n?e.jsx("span",{"data-testid":"mcp-detail-checked",className:"shrink-0 text-[13px] text-fg-dim",children:"checking…"}):s?e.jsxs("span",{"data-testid":"mcp-detail-checked",title:new Date(s.checkedAt).toLocaleString(),className:"shrink-0 text-[13px] text-fg-dim",children:["checked ",zs(Math.min(s.checkedAt,l),l)]}):null;return e.jsx("div",{"data-testid":"mcp-tools",children:e.jsx(Ge,{label:"Tools",labelNote:s!=null&&s.ok?String(c.length):void 0,action:g,children:s?s.ok?c.length===0?e.jsx("div",{"data-testid":"mcp-tools-empty",className:"text-[14px] text-fg-dim",children:"The last check listed no tools."}):e.jsxs("div",{className:"flex flex-col gap-3 pt-1.5",children:[e.jsxs("div",{"data-testid":"mcp-tools-chips",className:"flex flex-wrap items-center gap-2",children:[p.map((h,f)=>e.jsx("span",{"data-testid":`mcp-tool-row-${h.name}`,title:h.description?`${Ns(t,h.name)} — ${h.description}`:Ns(t,h.name),className:"px-2.5 py-1 rounded-md bg-bg-elev border border-line font-mono text-[13px] text-fg",children:h.name},`${f}:${h.name}`)),m>0?e.jsxs("button",{type:"button","data-testid":"mcp-tools-more",onClick:()=>r(!0),className:_n,children:["+",m," more"]}):null]}),e.jsxs("div",{className:"text-[13px] text-fg-dim",children:["Claude calls them as ",e.jsx("span",{className:"font-mono text-[12.5px]",children:d})]})]}):e.jsxs("div",{"data-testid":"mcp-tools-empty",className:"text-[14px] text-fg-dim",children:[s.status==="needs-auth"?"The last check needs auth":"The last check failed",": ",s.error]}):e.jsxs("div",{className:"text-[14px] text-fg-dim",children:["Checking ",t,"…"]})})})}async function Nn(t){const s=`${t}/skills`;return await window.api.config.exists(s)?s:null}async function On(t){const{entries:s}=await Vt(t,{nested:!1});return s.map(n=>{const o=it(n.text);return{id:n.name,name:o.name,description:o.description,dir:n.dir,path:n.path,body:o.body}})}function al(t){const s=[],n=new Set;for(const o of t)for(const i of t){if(o.id===i.id)continue;const a=i.id.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=[`/${a}\\b`,`\`${a}\``];if(i.id.length>=4&&r.push(`\\b${a}\\b`),!r.some(c=>new RegExp(c,"i").test(o.body)))continue;const d=`${o.id}->${i.id}`;n.has(d)||(n.add(d),s.push({from:o.id,to:i.id}))}return s}function ll(t,s){return{name:t.name,path:t.path,mtimeMs:t.mtimeMs,hasManifest:!1,manifest:null,hasLsp:!1,monitors:0,hooks:0,agents:0,commands:0,skills:0,binCount:0,hasMcp:!1,mcpServers:0,error:s}}async function cl(t){const{hasManifest:s,manifest:n}=await es(t.path),[o,i]=await Promise.all([window.api.config.exists(`${t.path}/.lsp.json`),window.api.config.exists(`${t.path}/monitors/monitors.json`)]);let a=0;if(i){const m=await window.api.config.readJson(`${t.path}/monitors/monitors.json`);Array.isArray(m.data)?a=m.data.length:m.data&&typeof m.data=="object"&&Array.isArray(m.data.monitors)&&(a=m.data.monitors.length)}const[r,l,d]=await Promise.all([Dn(t.path,n),Pn(`${t.path}/bin`,{filesOnly:!0}),Nn(t.path)]),c=l.length,p=d?(await On(d)).length:0;return{name:t.name,path:t.path,mtimeMs:t.mtimeMs,hasManifest:s,manifest:n,hasLsp:o,monitors:a,hooks:r.hooks,agents:r.agentFiles.length,commands:r.commandFiles.length,skills:p,binCount:c,hasMcp:r.mcpServers.length>0,mcpServers:r.mcpServers.length}}function dl(t){return{skills:t.skills,commands:t.commands,agents:t.agents,hooks:t.hooks,mcpServers:t.mcpServers}}async function es(t){let s=`${t}/.claude-plugin/plugin.json`,n=await window.api.config.exists(s);if(n||(s=`${t}/plugin.json`,n=await window.api.config.exists(s)),!n)return{hasManifest:n,manifest:null};const o=await window.api.config.readJson(s),i=o.exists&&!o.parseError&&o.data&&typeof o.data=="object"&&!Array.isArray(o.data);return{hasManifest:n,manifest:i?o.data:null}}const De=t=>!!t&&typeof t=="object"&&!Array.isArray(t);function Xr(t,s){const n=s.startsWith("/")?s.startsWith(`${t}/`)?s.slice(t.length+1):null:s;if(n===null)return Ts(s);const o=[];for(const i of n.split("/"))if(!(i===""||i===".")){if(i!=="..")o.push(i);else if(o.pop()===void 0)return Ts(s)}return o.length>0?`${t}/${o.join("/")}`:t}function Ts(t){return console.warn(`[plugins] ignoring manifest path outside the plugin root: ${t}`),null}function Jr(t){return typeof t=="string"?[t]:Array.isArray(t)?t.filter(s=>typeof s=="string"):[]}function Qr(t){if(!De(t))return null;if(De(t.mcpServers))return t.mcpServers;const s=Object.values(t);return s.length>0&&s.every(o=>De(o)&&(typeof o.command=="string"||typeof o.url=="string"))?t:null}function Zr(t){if(!De(t))return 0;const s=De(t.hooks)?t.hooks:t;return Object.values(s).reduce((n,o)=>Array.isArray(o)?n+o.reduce((i,a)=>i+(De(a)&&Array.isArray(a.hooks)?a.hooks.length:0),0):n,0)}function gt(t,s,n){const o=new Set;for(const i of Jr(s)){const a=Xr(t,i);a&&o.add(a)}return o.add(`${t}/${n}`),[...o]}async function jn(t){try{const s=await window.api.config.readJson(t);return s.exists&&!s.parseError?s.data:null}catch{return null}}function Tn(t,s){return gt(t,typeof s=="string"||Array.isArray(s)?s:void 0,".mcp.json")}async function Ln(t,s){const n=await Promise.all(s.map(jn)),o=new Map;for(const i of[...De(t)?[t]:[],...n])for(const[a,r]of Object.entries(Qr(i)??{})){if(o.has(a))continue;const l=De(r)?r.command:void 0,d=De(r)?r.url:void 0;o.set(a,{id:a,name:a,description:typeof l=="string"?l:typeof d=="string"?d:null})}return[...o.values()]}async function Dn(t,s){const n=async f=>{const b=new Set;for(const y of f)if(y.endsWith(".md"))b.add(y);else for(const k of await Pn(y,{filesOnly:!0}))k.endsWith(".md")&&b.add(`${y}/${k}`);return[...b]},o=gt(t,s==null?void 0:s.commands,"commands"),i=gt(t,s==null?void 0:s.agents,"agents"),a=s==null?void 0:s.hooks,r=gt(t,typeof a=="string"||Array.isArray(a)?a:void 0,"hooks/hooks.json"),l=s==null?void 0:s.mcpServers,d=Tn(t,l),[c,p,m,g]=await Promise.all([n(o),n(i),Promise.all(r.map(jn)),Ln(l,d)]),h=[...De(a)?[a]:[],...m].reduce((f,b)=>f+Zr(b),0);return{commandFiles:c,agentFiles:p,hooks:h,mcpServers:g,sourcePaths:[...o,...i,...r,...d]}}async function ea(t){const{manifest:s}=await es(t),n=s==null?void 0:s.mcpServers;return Ln(n,Tn(t,n))}async function ta(t){const s=await Promise.all(t.map(o=>window.api.config.readText(o))),n=[];return t.forEach((o,i)=>{if(!s[i].exists)return;const a=o.slice(o.lastIndexOf("/")+1),r=it(s[i].text);n.push({id:o,name:r.name??a.replace(/\.md$/,""),description:r.description})}),n}async function Pn(t,s){try{return(await window.api.config.listDir(t,s)).entries.map(o=>o.name)}catch{return[]}}const qt=(t,s)=>({type:"mcp",name:t,command:s.command,args:s.args,url:s.url}),sa=["stdio","http","streamable-http","sse","ws"],na=new Set(["workspace"]),oa=new Set(["ide","tasks"]);function ia(t,s,n){return t==="user"?`${s}/.claude.json`:n?`${n}/.mcp.json`:null}function Ls(t){if(t.trim()==="")return{full:{},servers:{},err:null};try{const s=JSON.parse(t),n=s.mcpServers??{};return{full:s,servers:n,err:null}}catch(s){return{full:{},servers:{},err:s.message}}}function ra(t,s){const n={};for(const[o,i]of Object.entries(s)){const{enabled:a,...r}=i;n[o]=r}return JSON.stringify({...t,mcpServers:n},null,2)+`
62
- `}function aa(t,s){const n=[];for(const[o,i]of Object.entries(s)){if(JSON.stringify(i)===JSON.stringify(t[o]))continue;const{enabled:a,...r}=i;n.push({name:o,value:r})}for(const o of Object.keys(t))o in s||n.push({name:o,value:void 0});return n}function la(t){let s=Object.keys(t).length+1,n=`server-${s}`;for(;t[n];)s+=1,n=`server-${s}`;return n}const Dt=t=>({source:"plugin",name:t.name,pluginKey:t.pluginKey});async function ca(){var a,r;const s=(await((r=(a=window.api.plugins)==null?void 0:a.list)==null?void 0:r.call(a))??[]).filter(l=>l.enabled&&!!l.installPath),n=await Promise.allSettled(s.map(l=>ea(l.installPath))),o=[],i=[];return n.forEach((l,d)=>{const c=s[d];if(l.status==="rejected"){i.push(c.name);return}for(const p of l.value){const m=p.description??"",g=/^[a-z][a-z0-9+.-]*:\/\//i.test(m)?{type:"http",url:m}:{command:m||void 0};o.push({id:`${c.key}/${p.name}`,pluginKey:c.key,plugin:c.name,name:p.name,server:g})}}),i.length>0&&W.error(`Could not read the MCP servers of plugin ${i.join(", ")}`),o.sort((l,d)=>l.plugin.localeCompare(d.plugin)||l.name.localeCompare(d.name))}const da={anthropic:"text-accent-dark",community:"text-honey-dark",local:""};function Ds(t){if(!t)return"not checked";if(t.status==="connected"){const s=t.tools.length;return`connected · ${s} tool${s===1?"":"s"}`}return t.status==="needs-auth"?"needs auth":"failed"}function pa(t,s,n){return t==="user"?{source:"user",name:n}:s?{source:"project",name:n,cwd:s}:null}function Ps({result:t,checking:s,testId:n}){const o=(t==null?void 0:t.status)??"unchecked";return e.jsx("span",{"aria-hidden":"true","data-testid":n,"data-status":o,title:t&&!t.ok?`${Gt[o]}: ${t.error}`:Gt[o],className:`w-2 h-2 shrink-0 box-border rounded-full ${Cn[o]}${s?" animate-pulse":""}`})}const ua=6;function ma(t,s){return t===s?"~":t.startsWith(`${s}/`)?`~${t.slice(s.length)}`:t}const Rs=t=>`w-full text-left grid grid-cols-[8px_minmax(0,1fr)_auto] items-center gap-x-2.5 gap-y-0.5 px-3 py-2.5 rounded-xl border focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent ${t?"bg-bg-hi border-line shadow-sm":"border-transparent hover:bg-bg-hi/60"}`,ha="flex items-center gap-2 mx-1 mt-2 text-[11px] font-semibold tracking-[0.1em] uppercase text-fg-faint";function fa({items:t}){const[s,n]=u.useState(!1),o=u.useRef(null),i=u.useRef(null),a=u.useId();return u.useEffect(()=>{if(!s)return;const r=d=>{var p,m;const c=d.target;(p=o.current)!=null&&p.contains(c)||(m=i.current)!=null&&m.contains(c)||n(!1)},l=d=>{d.key==="Escape"&&n(!1)};return window.addEventListener("mousedown",r),window.addEventListener("keydown",l),()=>{window.removeEventListener("mousedown",r),window.removeEventListener("keydown",l)}},[s]),e.jsxs("div",{className:"relative shrink-0",children:[e.jsx("button",{ref:o,type:"button","data-testid":"mcp-add-server","aria-haspopup":"menu","aria-expanded":s,"aria-controls":s?a:void 0,onClick:()=>n(r=>!r),className:"h-[38px] px-4 rounded-[10px] bg-accent text-bg-hi hover:bg-accent/90 text-[13.5px] font-semibold focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",children:"+ Add"}),s&&e.jsx("div",{ref:i,id:a,role:"menu","aria-label":"Add a server","data-testid":"mcp-add-server-menu",className:`absolute ${Pe.dialog} right-0 top-[44px] min-w-[190px] p-[5px] flex flex-col bg-bg-hi border border-line rounded-lg shadow-lg text-[13px] text-fg`,children:t.map(r=>e.jsx("button",{type:"button",role:"menuitem","data-testid":r.testId,onClick:()=>{n(!1),r.onSelect()},className:"px-2.5 py-[7px] rounded-[5px] text-left whitespace-nowrap hover:bg-bg-elev",children:r.label},r.testId))})]})}function ga({onAdd:t,scope:s="user"}={}){const n=Oe(),o=Et(),i=(o==null?void 0:o.cwd)??null,[a,r]=u.useState(null),[l,d]=u.useState(null),[c,p]=u.useState(""),[m,g]=u.useState(null),h=u.useRef(null),f=u.useMemo(()=>n?ia(s,n,i):null,[n,s,i]),b=G(x=>x.files),y=G(x=>x.loadJson),k=G(x=>x.setDraft),w=G(x=>x.revert),j=G(x=>x.watchFile),P=G(x=>x.unwatchFile);u.useEffect(()=>{if(f)return b[f]||y(f),j(f),()=>P(f)},[f]);const _=Se(x=>x.tab),S=Se(x=>x.id),A=Se(x=>x.clear),L=f?b[f]:void 0;u.useEffect(()=>{if(_!=="mcp"||!S||!L||L.busy)return;const x=S.startsWith("mcp:")?S.slice(4):null,{servers:D}=Ls(L.draftRaw);x!==null&&D&&typeof D=="object"&&Object.hasOwn(D,x)&&(p(""),g(null),r(x),d(null)),A()},[_,S,L,A]);const[E,T]=u.useState(null),O=xa(s==="project"?i:null),[I,M]=u.useState([]);u.useEffect(()=>{if(s!=="user"){M([]);return}let x=!0;return ca().then(D=>{x&&M(D)}).catch(D=>{x&&W.error(`Could not list plugin MCP servers: ${D instanceof Error?D.message:String(D)}`)}),()=>{x=!1}},[s]);const ue=Ve(Ir),le=Ve(Mr),te=Ve(x=>x.checkAll),ee=Ut(x=>x.overrides),ce=Ut(x=>x.load);if(u.useEffect(()=>{n&&ce(n)},[n,ce]),!n)return e.jsx(K,{title:"loading…"});if(s==="project"&&!i)return e.jsx(K,{title:"no active project"});if(!f)return e.jsx(K,{title:"loading…"});const J=b[f],{full:me,servers:V,err:B}=J?Ls(J.draftRaw):{full:{},servers:{},err:null},z=Object.keys(V),se=c.trim().toLowerCase(),Q=se?z.filter(x=>x.toLowerCase().includes(se)):z,oe=se?I.filter(x=>x.name.toLowerCase().includes(se)):I,Ue=l!==null?I.find(x=>x.id===l)??null:null,fe=a!==null&&z.includes(a)?a:null,Ce=Q[0]??(oe.length>0?null:z[0]??null),Y=Ue??(fe===null&&Ce===null?oe[0]??I[0]??null:null),X=Y?null:fe??Ce,N=x=>pa(s,i,x),Z=x=>{const D=N(x);return D?ue[Ke(D)]:void 0},ie=x=>{const D=N(x);return D?le[Ke(D)]===!0:!1},re=x=>Ke(Dt(x)),we=[...Q.map(N).filter(x=>x!==null),...oe.map(Dt)],je=Q.some(ie)||oe.some(x=>le[re(x)]===!0),he=s==="user"?"~/.claude.json":".mcp.json",be=`${s==="user"?"~/.claude.json":`${ma(i??"",n)}/.mcp.json`} › mcpServers`,ge=Date.now(),C=J&&J.mtimeMs>0?`edited ${zs(Math.min(J.mtimeMs,ge),ge)}`:"not created yet",q=(x,D)=>ee[gn("mcp",s,x)]??Bt(qt(x,D)).provenance,F=se!==""||z.length+I.length>=ua,de=x=>{T(null),k(f,ra(me,x))},xe=()=>{const x=la(V);de({...V,[x]:{type:"stdio",command:"",args:[]}}),r(x),d(null),g(x)},Te=x=>{x!==X&&g(null),r(x),d(null)},lt=x=>{g(null),d(x)},Xe=x=>{const D=Q.includes(x)?Q:z,ne=D.indexOf(x),ae=D.filter($e=>$e!==x),ve={...V};delete ve[x],de(ve),r(ae[Math.min(ne,ae.length-1)]??null),g(null)},ct=(x,D)=>{if(!D||D===x||V[D])return;const ne={};for(const ae of Object.keys(V))ne[ae===x?D:ae]=V[ae];de(ne),r(D),g(ae=>ae===x?D:ae)},Je=(x,D)=>{de({...V,[x]:D})},Qe=[{label:"New server",testId:"mcp-new-server",onSelect:xe}];t&&Qe.push({label:"Browse catalog…",testId:"mcp-browse-catalog",onSelect:()=>t({scope:s,cwd:i})});const We=J&&!J.dirty&&!E&&!B&&!J.parseError?`Saved — matches ${he}`:void 0,dt=J?e.jsx(_t,{dirty:J.dirty,busy:J.busy,parseError:E||B||J.parseError,lastSavedAt:J.lastSavedAt,onSave:async()=>{var D;T(null);const x=((D=J.diskData)==null?void 0:D.mcpServers)??{};for(const[ne,ae]of Object.entries(V)){if(JSON.stringify(ae)===JSON.stringify(x[ne]))continue;const ve=Rt(ae);if(ve.length>0){Ks.getState().show("error",`Not saved: "${ne}" still contains placeholder ${ve.map($e=>$e.token).join(", ")} — replace it with a real value`);return}}try{for(const ne of aa(x,V))await window.api.claudeConfig.patch({...Mt(s,i),keyPath:["mcpServers",ne.name],value:ne.value});await y(f)}catch(ne){T(ne.message||"save failed")}},onRevert:()=>{T(null),w(f)},cleanLabel:`Saved — matches ${he}`,shortcutHint:!0,scopeRef:h}):null,pt=e.jsxs(e.Fragment,{children:[e.jsx(on,{eyebrow:"SERVER FILE",badge:e.jsx("span",{"data-testid":"mcp-file-edited",children:C}),path:be,note:s==="user"?e.jsxs("span",{"data-testid":"mcp-scope-note",className:"flex items-center gap-2 px-2.5 py-1.5 rounded-lg bg-bg-elev text-[12.5px] text-fg-dim",children:[e.jsx("span",{"aria-hidden":"true",className:"w-[7px] h-[7px] shrink-0 rounded-full bg-sage"}),"On in every project · no approval step"]}):void 0,children:O?e.jsx("div",{"data-testid":"mcp-gating",title:`enableAllProjectMcpServers in ${i}/.claude/settings.json`,className:"flex items-center px-2.5 py-1.5 rounded-lg bg-bg-elev text-[12.5px]",children:e.jsx("span",{"data-testid":"mcp-enable-all",className:"contents",children:e.jsx(Me,{checked:O.enableAll,disabled:O.busy,onChange:O.setEnableAll,label:"Auto-approve all servers"})})}):null}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button","data-testid":"mcp-check-all",onClick:()=>void te(we),disabled:we.length===0||je,className:"flex-1 min-w-0 h-[38px] px-3 rounded-[10px] bg-bg-hi border border-line text-[13.5px] font-medium text-fg hover:border-rule disabled:opacity-50 disabled:hover:border-line",children:je?"Checking…":`Check all ${we.length}`}),e.jsx(fa,{items:Qe})]}),F?e.jsx("input",{type:"search","data-testid":"mcp-filter","aria-label":"Filter servers",placeholder:"Filter servers",value:c,onChange:x=>p(x.target.value),spellCheck:!1,className:"h-[34px] px-3 rounded-[10px] bg-bg-hi border border-line text-[13px] text-fg placeholder:text-fg-faint outline-none focus:border-fg-faint"}):null,e.jsxs("div",{role:"listbox","aria-label":"MCP servers",className:"flex flex-col gap-1",children:[z.length===0?e.jsx("div",{className:"mx-1 py-1 text-xs text-fg-faint",children:I.length>0?`No servers in ${he} yet.`:"No servers yet."}):Q.length===0?e.jsxs("div",{className:"mx-1 py-1 text-xs text-fg-faint",children:["No servers match “",c.trim(),"”."]}):Q.map(x=>{var v;const D=V[x],ne=x===X,ae=Z(x),ve=ie(x),$e=q(x,D),Ze=Rt(D).map(R=>R.token).join(", ");return e.jsxs("button",{type:"button",role:"option","aria-selected":ne,"data-testid":`mcp-row-${x}`,"aria-current":ne?"true":void 0,title:((v=D.description)==null?void 0:v.trim())||void 0,onClick:()=>Te(x),className:Rs(ne),children:[e.jsx(Ps,{result:ae,checking:ve,testId:`mcp-dot-${x}`}),e.jsx("span",{className:`truncate text-[14px] text-fg ${ne?"font-semibold":"font-medium"}`,children:x}),e.jsx("span",{className:"font-mono text-[11.5px] text-fg-faint",children:D.type??"stdio"}),e.jsxs("span",{"data-testid":`mcp-status-${x}`,className:"col-start-2 col-span-2 truncate text-xs text-fg-faint",children:[e.jsx("span",{className:da[$e],children:Le[$e]})," · ",ve?"checking…":Ds(ae)]}),Ze?e.jsxs("span",{className:"col-start-2 col-span-2 truncate text-[11px] text-honey-dark",title:`${s} scope · ${f} — replace ${Ze} with a real value; Save refuses it until then`,children:["⚠ unconfigured placeholder: ",Ze]}):null]},x)}),I.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-testid":"mcp-plugins-header",className:ha,children:["From plugins",e.jsx("span",{"data-testid":"mcp-plugins-count",className:"font-mono font-medium tracking-normal text-fg-faint/60",children:oe.length}),e.jsx("span",{"data-testid":"mcp-plugins-readonly",className:"ml-auto px-[5px] border border-line rounded-[3px] text-[9.5px] font-medium tracking-normal text-fg-faint/80",children:"READ-ONLY"})]}),oe.length===0?e.jsxs("div",{className:"mx-1 py-1 text-xs text-fg-faint",children:["No plugin servers match “",c.trim(),"”."]}):oe.map(x=>{const D=(Y==null?void 0:Y.id)===x.id,ne=re(x),ae=ue[ne],ve=le[ne]===!0;return e.jsxs("button",{type:"button",role:"option","aria-selected":D,"data-testid":`mcp-plugin-row-${x.id}`,"aria-current":D?"true":void 0,onClick:()=>lt(x.id),className:Rs(D),children:[e.jsx(Ps,{result:ae,checking:ve,testId:`mcp-plugin-dot-${x.id}`}),e.jsx("span",{className:`truncate text-[14px] text-fg ${D?"font-semibold":"font-medium"}`,children:x.name}),e.jsx("span",{className:"font-mono text-[11.5px] text-fg-faint",children:"plugin"}),e.jsxs("span",{"data-testid":`mcp-plugin-status-${x.id}`,className:"col-start-2 col-span-2 truncate text-xs text-fg-faint",children:["via the ",x.plugin," plugin · ",ve?"checking…":Ds(ae)]})]},x.id)})]}):null]})]}),ut=Y?e.jsx(Os,{name:Y.name,server:Y.server,scope:"user",plugin:Y.plugin,checkRequest:Dt(Y),origin:Bt(qt(Y.name,Y.server)).provenance},`plugin:${Y.id}`):X!==null?e.jsx(Os,{name:X,server:V[X],scope:s,fileLabel:he,checkRequest:N(X),origin:q(X,V[X]),onChange:x=>Je(X,x),approval:O?ba(O,X):void 0,editing:m===X,onEditingChange:x=>g(x?X:null),editor:m===X?e.jsx(ya,{name:X,server:V[X],scope:s,onRename:x=>ct(X,x),onChange:x=>Je(X,x),onRemove:()=>Xe(X)}):null,footer:dt,cleanLabel:We},X):e.jsxs("div",{className:"flex-1 flex flex-col",children:[e.jsx("div",{className:"flex-1",children:e.jsx(K,{title:"No MCP servers yet",hint:t?"+ Add starts a new one or browses the catalog.":"+ Add starts a new one."})}),We!==void 0?e.jsx(An,{label:We}):dt]});return e.jsx("div",{ref:h,className:"h-full min-h-0 flex flex-col",children:e.jsx(St,{list:pt,detail:ut})})}const pl=u.memo(ga);function ya({name:t,server:s,scope:n,onRename:o,onChange:i,onRemove:a}){var h;const r=s.type??"stdio",l=na.has(t),d=oa.has(t),c=(h=s.permissions)==null?void 0:h.tools,p=c===void 0?"inherit":c==="allow"?"allow":c==="deny"?"deny":"list",m=Array.isArray(c)?c:[],g=(s.disabledTools??[]).join(", ");return e.jsxs("div",{"data-testid":"mcp-json-form",className:"space-y-4 max-w-2xl",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-fg-faint w-20",children:"origin"}),e.jsx(yn,{scope:n,input:qt(t,s)}),e.jsx("span",{className:"text-xs text-fg-faint",children:"click to change"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-xs text-fg-faint w-20",children:"name"}),e.jsx("input",{"aria-label":"Server name",defaultValue:t,onBlur:f=>o(f.target.value.trim()),className:"flex-1 bg-bg-elev border border-line rounded px-2 py-1 text-xs text-fg font-mono"}),e.jsx("button",{onClick:a,className:"text-xs text-fg-faint hover:text-red-400 px-2 py-1 border border-line rounded",children:"delete"})]}),e.jsx(et,{label:"description",value:s.description??"",onChange:f=>i({...s,description:f||void 0}),placeholder:"what this server does…"}),l?e.jsxs("div",{className:"text-xs px-2 py-1 border border-red-500/50 rounded text-red-300 bg-red-500/5",children:["⚠ ",e.jsx("span",{className:"font-mono",children:t})," is a reserved name — Claude Code will refuse to load this server (v2.1.128+)."]}):d?e.jsxs("div",{className:"text-xs px-2 py-1 border border-yellow-600/50 rounded text-yellow-200 bg-yellow-500/5",children:["⚠ ",e.jsx("span",{className:"font-mono",children:t})," collides with a commonly-bundled MCP name; expect surprises in other tools."]}):null,e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-xs text-fg-faint w-20",children:"type"}),e.jsx("select",{value:r,onChange:f=>i({...s,type:f.target.value}),className:"bg-bg-elev border border-line rounded px-2 py-1 text-xs text-fg",children:sa.map(f=>e.jsx("option",{value:f,children:f},f))}),r==="sse"?e.jsx("span",{className:"text-xs text-yellow-400/80",children:"sse is deprecated — prefer streamable-http"}):null]}),r==="stdio"?e.jsxs(e.Fragment,{children:[e.jsx(et,{label:"command",value:s.command??"",onChange:f=>i({...s,command:f}),placeholder:"npx / node / python …"}),e.jsx(et,{label:"args",value:(s.args??[]).join(" "),onChange:f=>i({...s,args:f.split(/\s+/).filter(Boolean)}),placeholder:"space-separated args"}),e.jsx(Is,{label:"env",value:s.env??{},onChange:f=>i({...s,env:f})})]}):e.jsxs(e.Fragment,{children:[e.jsx(et,{label:"url",value:s.url??"",onChange:f=>i({...s,url:f}),placeholder:"https://…"}),e.jsx(Is,{label:"headers",value:s.headers??{},onChange:f=>i({...s,headers:f})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-xs text-fg-faint w-20",children:"alwaysLoad"}),e.jsxs("label",{className:"flex items-center gap-2 text-xs text-fg",children:[e.jsx("input",{type:"checkbox",checked:s.alwaysLoad===!0,onChange:f=>i({...s,alwaysLoad:f.target.checked||void 0})}),e.jsx("span",{className:"text-fg-dim",children:"bypass tool-search deferral (v2.1.121+)"})]})]}),e.jsx(et,{label:"disabledTools",value:g,onChange:f=>{const b=f.split(",").map(y=>y.trim()).filter(Boolean);i({...s,disabledTools:b.length?b:void 0})},placeholder:"comma-separated tool names to hide"}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("label",{className:"text-xs text-fg-faint w-20 pt-1",children:"permissions"}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsxs("select",{value:p,onChange:f=>{const b=f.target.value,y={...s};if(b==="inherit"){if(y.permissions){const{tools:k,...w}=y.permissions;y.permissions=Object.keys(w).length?w:void 0}}else b==="list"?y.permissions={...y.permissions??{},tools:[]}:y.permissions={...y.permissions??{},tools:b};i(y)},className:"bg-bg-elev border border-line rounded px-2 py-1 text-xs text-fg",children:[e.jsx("option",{value:"inherit",children:"inherit (default)"}),e.jsx("option",{value:"allow",children:"allow all tools"}),e.jsx("option",{value:"deny",children:"deny all tools"}),e.jsx("option",{value:"list",children:"allowlist…"})]}),p==="list"?e.jsx("input",{value:m.join(", "),onChange:f=>{const b=f.target.value.split(",").map(y=>y.trim()).filter(Boolean);i({...s,permissions:{...s.permissions??{},tools:b}})},placeholder:"comma-separated tool names",className:"w-full bg-bg-elev border border-line rounded px-2 py-1 text-xs text-fg font-mono"}):null]})]})]})}function et({label:t,value:s,onChange:n,placeholder:o}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-xs text-fg-faint w-20",children:t}),e.jsx("input",{value:s,onChange:i=>n(i.target.value),placeholder:o,className:"flex-1 bg-bg-elev border border-line rounded px-2 py-1 text-xs text-fg font-mono"})]})}function Is({label:t,value:s,onChange:n}){const[o,i]=u.useState(""),[a,r]=u.useState(""),l=Object.entries(s);return e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("label",{className:"text-xs text-fg-faint w-20 pt-1",children:t}),e.jsxs("div",{className:"flex-1 space-y-1",children:[l.map(([d,c])=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{value:d,onChange:p=>{const m={...s};delete m[d],m[p.target.value]=c,n(m)},className:"w-32 bg-bg-elev border border-line rounded px-2 py-0.5 text-xs text-fg font-mono"}),e.jsx("input",{value:c,onChange:p=>n({...s,[d]:p.target.value}),className:"flex-1 bg-bg-elev border border-line rounded px-2 py-0.5 text-xs text-fg font-mono"}),e.jsx("button",{onClick:()=>{const p={...s};delete p[d],n(p)},className:"text-fg-faint hover:text-red-400 text-xs px-1",children:"×"})]},d)),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{value:o,onChange:d=>i(d.target.value),placeholder:"key",className:"w-32 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg-dim font-mono"}),e.jsx("input",{value:a,onChange:d=>r(d.target.value),placeholder:"value",className:"flex-1 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg-dim font-mono"}),e.jsx("button",{onClick:()=>{o.trim()&&(n({...s,[o.trim()]:a}),i(""),r(""))},className:"px-2 text-xs border border-line rounded text-fg-dim hover:text-fg hover:bg-bg-hi",children:"+"})]})]})]})}function ba(t,s){return{approved:!t.disabled.includes(s),busy:t.busy,onChange:n=>t.setApproved(s,n)}}function xa(t){const[s,n]=u.useState([]),[o,i]=u.useState(!1),[a,r]=u.useState(!1);if(u.useEffect(()=>{var m,g;if(!t)return;let d=!0;const c=()=>window.api.claudeConfig.read({fileId:"settings",scope:"project",cwd:t}).then(h=>{if(!d)return;const f=h.data;n(Array.isArray(f==null?void 0:f.disabledMcpjsonServers)?f.disabledMcpjsonServers:[]),i((f==null?void 0:f.enableAllProjectMcpServers)===!0)}).catch(h=>{d&&W.error(`Could not read MCP approval: ${h instanceof Error?h.message:String(h)}`)});c();const p=(g=(m=window.api.config)==null?void 0:m.onChanged)==null?void 0:g.call(m,()=>{c()});return()=>{d=!1,p==null||p()}},[t]),!t)return null;const l=async(d,c)=>{r(!0);try{await window.api.claudeConfig.patch({fileId:"settings",scope:"project",cwd:t,keyPath:[d],value:c})}catch(p){W.error(p.message||"save failed")}finally{r(!1)}};return{enableAll:o,disabled:s,busy:a,setEnableAll:d=>{i(d),l("enableAllProjectMcpServers",d?!0:void 0)},setApproved:(d,c)=>{const p=c?s.filter(m=>m!==d):[...new Set([...s,d])];n(p),l("disabledMcpjsonServers",p.length?p:void 0)}}}function va(t,s){return s&&(t===s||t.startsWith(`${s}/`))?`~${t.slice(s.length)}`:t}function wa(t){var i;const{frontmatter:s,body:n}=mo(t),o=((i=/^(?:\r?\n)*/.exec(n))==null?void 0:i[0])??"";return{frontmatter:s,lead:o,editorBody:n.slice(o.length)}}function ka({items:t}){const[s,n]=u.useState(!1),o=u.useRef(null),i=u.useRef(null),a=u.useId();return u.useEffect(()=>{if(!s)return;const r=d=>{var p,m;const c=d.target;(p=o.current)!=null&&p.contains(c)||(m=i.current)!=null&&m.contains(c)||n(!1)},l=d=>{d.key==="Escape"&&n(!1)};return window.addEventListener("mousedown",r),window.addEventListener("keydown",l),()=>{window.removeEventListener("mousedown",r),window.removeEventListener("keydown",l)}},[s]),e.jsxs("div",{className:"relative",children:[e.jsx("button",{ref:o,type:"button","data-testid":"skill-detail-more","aria-label":"More actions","aria-haspopup":"menu","aria-expanded":s,"aria-controls":s?a:void 0,onClick:()=>n(r=>!r),className:"h-9 w-9 inline-flex items-center justify-center rounded-[10px] bg-bg-hi border border-line text-fg-dim hover:text-fg hover:border-rule",children:"⋯"}),s&&e.jsx("div",{ref:i,id:a,role:"menu","aria-label":"More actions","data-testid":"skill-detail-more-menu",className:`absolute ${Pe.dialog} right-0 top-[42px] min-w-[200px] p-[5px] flex flex-col bg-bg-hi border border-line rounded-lg shadow-lg text-[13px] text-fg`,children:t.map(r=>e.jsx("button",{type:"button",role:"menuitem","data-testid":r.testId,onClick:()=>{n(!1),r.onSelect()},className:`px-2.5 py-[7px] rounded-[5px] text-left whitespace-nowrap hover:bg-bg-elev ${r.danger?"text-red-400":""}`,children:r.label},r.testId))})]})}function Ms({item:t,home:s,draft:n,dirty:o,busy:i,lastSavedAt:a,saveError:r,onDraftChange:l,onSave:d,onRevert:c,readOnly:p=!1,onToggleEnabled:m,onRemove:g}){const[h,f]=u.useState(!1),b=u.useMemo(()=>wa(n),[n]),y=u.useMemo(()=>ko(n)??"",[n]),k=t.kind==="commands"?"COMMAND":"SKILL",w=t.plugin?`FROM ${t.plugin.toUpperCase()}`:t.scope.toUpperCase(),j=`${k} · ${w} · ${va(t.path,s)}`,P=[{label:"Reveal in File Explorer",testId:"skill-detail-reveal",onSelect:()=>to(t.path)},...g&&!p?[{label:"Remove skill…",testId:"skill-detail-remove",danger:!0,onSelect:()=>f(!0)}]:[]],_=e.jsxs(e.Fragment,{children:[p&&e.jsx("span",{"data-testid":"skill-detail-readonly",className:"text-xs font-semibold px-2 py-0.5 rounded-full bg-bg-elev border border-line text-fg-dim",children:"Read-only"}),m&&!p&&e.jsxs("span",{"data-testid":"skill-detail-enabled",className:"flex items-center gap-2 text-[13px] text-fg-dim",title:o?"This skill has unsaved edits — save or revert before toggling":void 0,children:[e.jsx(Me,{checked:!t.disabled,disabled:o,onChange:S=>m(S)}),"Enabled"]}),e.jsx(ka,{items:P})]});return e.jsxs("div",{"data-testid":"skill-detail",className:"flex-1 min-h-0 flex flex-col",children:[e.jsx(Ct,{eyebrow:j,title:`/${t.name}`,actions:_}),h&&g&&e.jsxs("div",{"data-testid":"skill-detail-remove-confirm",role:"alert",className:"shrink-0 mx-9 mt-4 px-4 py-2.5 rounded-[10px] border border-red-400/40 bg-red-400/10 flex items-center gap-3 text-[13px] text-fg",children:[e.jsxs("span",{className:"flex-1 min-w-0",children:["Remove /",t.name,"? The folder moves to trash; reinstall from the Library."]}),e.jsx("button",{type:"button",onClick:()=>{f(!1),g()},className:"font-semibold text-red-400 hover:text-red-300",children:"confirm"}),e.jsx("button",{type:"button",onClick:()=>f(!1),className:"text-fg-faint hover:text-fg",children:"cancel"})]}),e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col gap-4 px-9 py-6",children:[e.jsx(Ge,{label:"DESCRIPTION",labelNote:"CLAUDE READS THIS TO DECIDE WHEN TO USE IT",children:p?e.jsx("span",{"data-testid":"skill-detail-description-text",className:"text-fg-dim",children:y||e.jsx("span",{className:"text-fg-faint",children:"No description"})}):e.jsx("textarea",{"data-testid":"skill-detail-description","aria-label":"Description",rows:2,value:y,onKeyDown:S=>{S.key==="Enter"&&S.preventDefault()},onChange:S=>l(xo(n,S.target.value.replace(/\r?\n/g," "))),placeholder:"What this does and when Claude should use it",className:"w-full resize-none bg-transparent outline-none text-fg placeholder:text-fg-faint"})}),e.jsx("div",{"data-testid":"skill-detail-editor","data-busy":i?"true":void 0,"data-saved-at":a??void 0,className:"flex-1 min-h-[420px] rounded-[14px] border border-line bg-bg-hi overflow-hidden",children:e.jsx(rn,{path:t.path,value:b.editorBody,defaultMode:"document",readOnly:p,dirty:p?void 0:o,onChange:S=>{if(p)return;const A=ho(b.frontmatter,b.lead+S);A!==n&&l(A)},onSave:p?void 0:d,onRevert:p?void 0:c})}),r&&e.jsxs("div",{"data-testid":"skill-detail-save-error",role:"alert",className:"text-[13px] text-red-400",children:["Could not save: ",r]})]})]})}const Us=t=>t instanceof Error?t.message:String(t),$s=(t,s,n)=>`${t} ${t===1?s:n}`,Bs=(t,s)=>t.name.localeCompare(s.name);async function Ea(t,s){const[n,{manifest:o}]=await Promise.all([Nn(s),es(s)]),[i,a]=await Promise.all([n?On(n):Promise.resolve([]),Dn(s,o)]),r=await ta(a.commandFiles);return[...i.map(l=>({kind:"skills",plugin:t,name:l.name??l.id,path:l.path,description:l.description??void 0})).sort(Bs),...r.map(l=>({kind:"commands",plugin:t,name:l.name??l.id,path:l.id,description:l.description??void 0})).sort(Bs)]}function Sa(t,s){const[n,o]=u.useState([]),i=u.useRef(0),a=u.useCallback(async()=>{const r=++i.current;if(!s){o([]);return}let l=[];try{const d=(await window.api.plugins.list()).filter(c=>c.enabled&&c.installPath);l=await Promise.all(d.map(async c=>{try{return{key:c.key,name:c.name,items:await Ea(c.name,c.installPath)}}catch(p){return{key:c.key,name:c.name,items:[],error:Us(p)}}}))}catch(d){console.warn(`[skills] could not list plugins: ${Us(d)}`)}i.current===r&&(l.sort((d,c)=>d.name.localeCompare(c.name)),o(l))},[s]);return u.useEffect(()=>{a()},[a]),u.useEffect(()=>()=>{i.current+=1},[]),Ys(s&&t?[`${t}/.claude/plugins/installed_plugins.json`,`${t}/.claude/settings.json`]:[],()=>{a()}),n}function Ca(t){const s=t.filter(o=>o.kind==="skills").length,n=t.length-s;return[s?$s(s,"skill","skills"):"",n?$s(n,"command","commands"):""].filter(Boolean).join(" · ")}function _a({open:t}){return e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:`shrink-0 text-fg-faint/60 transition-transform ${t?"rotate-90":""}`,"aria-hidden":!0,children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}function Aa({plugins:t,needle:s,selectedPath:n,onSelect:o}){const[i,a]=u.useState(()=>new Set),r=t.map(c=>{if(!s||c.name.toLowerCase().includes(s))return{p:c,items:c.items};const p=c.items.filter(m=>{var g;return m.name.toLowerCase().includes(s)||!!((g=m.description)!=null&&g.toLowerCase().includes(s))});return{p:c,items:p}}).filter(({p:c,items:p})=>!s||p.length>0||c.name.toLowerCase().includes(s)),l=r.reduce((c,p)=>c+p.items.length,0),d=c=>a(p=>{const m=new Set(p);return m.has(c)?m.delete(c):m.add(c),m});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-testid":"skills-section-plugins",className:"flex items-center gap-2 mt-3 mx-1.5 mb-1 text-[11px] font-semibold tracking-[0.06em] uppercase text-fg-faint",children:["From plugins",e.jsx("span",{"data-testid":"skills-section-plugins-count",className:"font-mono font-medium tracking-normal text-fg-faint/60",children:l}),e.jsx("span",{"data-testid":"skills-section-plugins-readonly",title:"Plugin files are managed by the plugin — open them to read, not edit",className:"ml-auto px-[5px] border border-line rounded-[3px] text-[9.5px] font-medium tracking-normal text-fg-faint",children:"READ-ONLY"})]}),t.length===0&&e.jsx("div",{className:"mx-1.5 mb-1 text-xs text-fg-faint",children:"No enabled plugin adds skills or commands"}),r.map(({p:c,items:p})=>{const m=!c.error&&(i.has(c.key)||!!s&&p.length>0);return e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("button",{type:"button","data-testid":"plugin-skills-row","data-plugin":c.name,"aria-expanded":m,onClick:()=>d(c.key),className:"flex items-center gap-2 px-2.5 py-[7px] border border-transparent rounded-[7px] text-left text-[12.5px] text-fg-dim hover:bg-bg-hi",children:[e.jsx("span",{className:"min-w-0 truncate",children:c.name}),c.error?e.jsx("span",{"data-testid":"plugin-skills-row-error",title:c.error,className:"ml-auto shrink-0 text-[11px] text-red-400",children:"Could not read plugin"}):e.jsx("span",{"data-testid":"plugin-skills-row-counts",className:"ml-auto shrink-0 font-mono text-[11px] text-fg-faint",children:Ca(c.items)||"nothing to list"}),e.jsx(_a,{open:m})]}),m&&p.map(g=>{const h=n===g.path;return e.jsxs("button",{type:"button","data-testid":"plugin-skills-item","data-path":g.path,"aria-current":h?"true":void 0,onClick:()=>o(g.path),className:`ml-3 mb-0.5 flex flex-col gap-[2px] px-2.5 py-1.5 border rounded-[7px] text-left ${h?"border-accent bg-bg-hi":"border-transparent hover:bg-bg-hi"}`,children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsxs("span",{"data-testid":"plugin-skills-item-name",className:"min-w-0 truncate font-mono text-[12px] font-semibold text-fg",children:["/",g.name]}),e.jsx("span",{className:"ml-auto shrink-0 text-[9.5px] tracking-[0.04em] text-fg-faint",children:g.kind==="commands"?"COMMAND":"SKILL"})]}),g.description&&e.jsx("span",{title:g.description,className:"truncate text-[11px] text-fg-faint",children:g.description})]},g.path)})]},c.key)})]})}const Na=250,Oa=2e3,ja=6;function Ta(t,s){return{user:{skills:`${t}/.claude/skills`,commands:`${t}/.claude/commands`},project:s?{skills:`${s}/.claude/skills`,commands:`${s}/.claude/commands`}:null}}const yt=t=>t instanceof Error?t.message:String(t);async function La(t,s){const n=t.map(()=>{});let o=0;const i=async()=>{for(let a=o++;a<t.length;a=o++)try{const r=await window.api.config.readText(t[a]);r.error?s.push({path:t[a],error:r.error}):r.exists&&(n[a]=it(r.text).description??void 0)}catch(r){s.push({path:t[a],error:yt(r)})}};return await Promise.all(Array.from({length:Math.min(ja,t.length)},i)),n}const Da=/^[a-z0-9][a-z0-9-]{0,63}$/,Pa="Use lowercase letters, digits and hyphens (max 64), starting with a letter or digit",Ra=(t,s)=>t==="skills"?["---",`name: ${s}`,'description: ""',"---","",`# ${s}`,""].join(`
60
+ See https://code.claude.com/docs/en/tools-reference for full list of tools available to Claude.`,pattern:"^((Agent|Artifact|Bash|Cd|Edit|EnterWorktree|ExitPlanMode|Glob|Grep|KillShell|LSP|Monitor|MultiEdit|NotebookEdit|PowerShell|Read|ShareOnboardingGuide|Skill|TaskCreate|TaskGet|TaskList|TaskOutput|TaskStop|TaskUpdate|TodoWrite|ToolSearch|WebFetch|WebSearch|Workflow|Write)(\\([^)]+\\))?|mcp__.*)$",examples:["Bash","Bash(npm run build)","Bash(git commit *)","Bash(npm run *)","Bash(ls*)","Bash(git * main)","Edit","Edit(/src/**/*.ts)","Read(*)","Skill(*)","Read(./.env)","Read(./secrets/**)","Read(//Users/alice/secrets/**)","Read(~/Documents/*.pdf)","Agent(Explore)","WebFetch","WebFetch(domain:example.com)","mcp__puppeteer","mcp__github__search_repositories"]},hookCommand:{anyOf:[{type:"object",description:"Bash command hook",additionalProperties:!1,required:["type","command"],properties:{type:{type:"string",description:"Hook type",const:"command"},command:{type:"string",description:"Shell command to execute",minLength:1},timeout:{type:"number",description:"Optional timeout in seconds (default: 600; lowered to 30 on UserPromptSubmit and 10 on MessageDisplay)",exclusiveMinimum:0},async:{type:"boolean",description:"Run this hook asynchronously without blocking Claude Code"},asyncRewake:{type:"boolean",description:"When true, the hook runs in the background and wakes the model when it exits with code 2. Implies async."},shell:{type:"string",enum:["bash","powershell"],description:'Shell interpreter for the command. "bash" uses the login shell (bash/zsh/sh); "powershell" uses pwsh. Defaults to bash.'},if:{type:"string",description:'Optional permission-rule-syntax filter (e.g., "Bash(git *)"). Evaluated only on tool-related events (PreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest, PermissionDenied); on other events a hook with `if` set never runs. See https://code.claude.com/docs/en/hooks-guide#filter-hooks-with-matchers'},statusMessage:{type:"string",description:"Custom spinner message displayed while the hook runs"},args:{type:"array",items:{type:"string"},description:"Argument list for exec form. When present, spawns the command directly without shell interpretation — each element is passed as-is, so path placeholders never need quoting. See https://code.claude.com/docs/en/hooks#command-hook-fields"}}},{type:"object",description:"LLM prompt hook. See https://code.claude.com/docs/en/hooks#prompt-based-hooks",additionalProperties:!1,required:["type","prompt"],properties:{type:{type:"string",description:"Hook type",const:"prompt"},prompt:{type:"string",description:"Prompt to evaluate with LLM. Use $ARGUMENTS placeholder for hook input JSON.",minLength:1},model:{type:"string",description:"Model to use for evaluation. Defaults to a fast model"},timeout:{type:"number",description:"Optional timeout in seconds (default: 30)",exclusiveMinimum:0},if:{type:"string",description:"Optional permission-rule-syntax filter. Evaluated only on tool-related events (PreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest, PermissionDenied); on other events a hook with `if` set never runs. See https://code.claude.com/docs/en/hooks-guide#filter-hooks-with-matchers"},statusMessage:{type:"string",description:"Custom spinner message displayed while the hook runs"},continueOnBlock:{type:"boolean",default:!1,description:'When the prompt returns ok: false, feed the reason back to Claude and continue the turn instead of stopping. Implemented as continue: true on the resulting decision: "block". See https://code.claude.com/docs/en/hooks#prompt-hook-configuration'}}},{type:"object",description:"Agent hook with multi-turn tool access for verification. See https://code.claude.com/docs/en/hooks#agent-based-hooks",additionalProperties:!1,required:["type","prompt"],properties:{type:{type:"string",description:"Hook type",const:"agent"},prompt:{type:"string",description:"Prompt describing what to verify. Use $ARGUMENTS placeholder for hook input JSON.",minLength:1},model:{type:"string",description:"Model to use for evaluation. Defaults to a fast model"},timeout:{type:"number",description:"Optional timeout in seconds (default: 60)",exclusiveMinimum:0},if:{type:"string",description:"Optional permission-rule-syntax filter. Evaluated only on tool-related events (PreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest, PermissionDenied); on other events a hook with `if` set never runs. See https://code.claude.com/docs/en/hooks-guide#filter-hooks-with-matchers"},statusMessage:{type:"string",description:"Custom spinner message displayed while the hook runs"}}},{type:"object",description:"HTTP webhook hook. POST JSON to a URL and receive JSON response. See https://code.claude.com/docs/en/hooks#http-hook-fields",additionalProperties:!1,required:["type","url"],properties:{type:{type:"string",description:"Hook type",const:"http"},url:{type:"string",description:"URL to POST hook input JSON to. Endpoint must accept POST requests and return JSON.",minLength:1},headers:{type:"object",additionalProperties:{type:"string"},description:"Custom HTTP headers (e.g., Authorization: Bearer token). Values support $VAR_NAME or ${VAR_NAME} interpolation."},allowedEnvVars:{type:"array",items:{type:"string",minLength:1},description:"List of environment variable names permitted for interpolation in headers. If not set, no env var interpolation is allowed."},timeout:{type:"number",description:"Optional timeout in seconds (default: 600; lowered to 30 on UserPromptSubmit and 10 on MessageDisplay)",exclusiveMinimum:0},if:{type:"string",description:"Optional permission-rule-syntax filter. Evaluated only on tool-related events (PreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest, PermissionDenied); on other events a hook with `if` set never runs. See https://code.claude.com/docs/en/hooks-guide#filter-hooks-with-matchers"},statusMessage:{type:"string",description:"Custom spinner message displayed while the hook runs"}}},{type:"object",description:"MCP tool hook. Call a tool on an already-connected MCP server. See https://code.claude.com/docs/en/hooks#mcp-tool-hook-fields",additionalProperties:!1,required:["type","server","tool"],properties:{type:{type:"string",description:"Hook type",const:"mcp_tool"},server:{type:"string",description:"Name of a configured MCP server (must already be connected)",minLength:1},tool:{type:"string",description:"Name of the tool to call on that server",minLength:1},input:{type:"object",additionalProperties:!0,description:"Arguments passed to the tool. String values support ${path} substitution from hook JSON input (e.g., ${tool_input.file_path}, ${cwd})"},timeout:{type:"number",description:"Optional timeout in seconds (default: 600; lowered to 30 on UserPromptSubmit and 10 on MessageDisplay)",exclusiveMinimum:0},if:{type:"string",description:"Optional permission-rule-syntax filter. Evaluated only on tool-related events (PreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest, PermissionDenied); on other events a hook with `if` set never runs. See https://code.claude.com/docs/en/hooks-guide#filter-hooks-with-matchers"},statusMessage:{type:"string",description:"Custom spinner message displayed while the hook runs"}}}]},hookMatcher:{type:"object",description:"Hook matcher configuration with multiple hooks",additionalProperties:!1,required:["hooks"],properties:{matcher:{type:"string",description:"Optional pattern to match event contexts, case-sensitive. Behavior depends on event type. See https://code.claude.com/docs/en/hooks#matcher-patterns for event-specific details and examples"},hooks:{type:"array",description:"Array of hooks to execute",items:{$ref:"#/$defs/hookCommand"}}}}},vi="Configuration settings for Claude Code. Learn more: https://code.claude.com/docs/en/settings",wi=!1,ki=!0,Ei="object",Si=JSON.parse(`{"$schema":{"type":"string","description":"JSON Schema reference for Claude Code settings"},"apiKeyHelper":{"type":"string","description":"Path to a script that outputs authentication values. See https://code.claude.com/docs/en/settings#available-settings","examples":["/bin/generate_temp_api_key.sh"],"minLength":1},"autoMemoryEnabled":{"type":"boolean","description":"Enable automatic memory saves that capture useful context to ~/.claude/projects/<project>/memory/ (derived from the git repository, shared across worktrees). Also configurable via CLAUDE_CODE_DISABLE_AUTO_MEMORY environment variable (set to 1 to disable, 0 to enable). See https://code.claude.com/docs/en/memory#storage-location","default":true},"autoUpdatesChannel":{"type":"string","enum":["stable","latest"],"description":"Release channel to follow for updates. Use \\"stable\\" for a version that is typically about one week old and skips versions with major regressions, or \\"latest\\" (default) for the most recent release. Set DISABLE_AUTOUPDATER=1 to disable background auto-updates, or DISABLE_UPDATES=1 (added in v2.1.118) to block all update paths including manual \`claude update\`.","default":"latest"},"awsCredentialExport":{"type":"string","description":"Command that outputs AWS credentials as JSON (in the form {\\"Credentials\\": {\\"AccessKeyId\\": ..., \\"SecretAccessKey\\": ..., \\"SessionToken\\": ...}}). The output is captured silently. Use when you cannot modify the .aws directory and must return credentials directly. See https://code.claude.com/docs/en/amazon-bedrock#advanced-credential-configuration","examples":["/bin/generate_aws_grant.sh"],"minLength":1},"awsAuthRefresh":{"type":"string","description":"Command to run when AWS credentials are expired or unavailable; its output is shown to the user but interactive input is not supported. Also drives the \\"Claude Platform on AWS · refresh credentials\\" option in /login when configured. See https://code.claude.com/docs/en/amazon-bedrock#advanced-credential-configuration","examples":["aws sso login --profile myprofile"],"minLength":1},"claudeMdExcludes":{"type":"array","items":{"type":"string","minLength":1},"description":"Glob patterns for CLAUDE.md files to exclude from loading. Useful in monorepos to skip irrelevant instructions from other teams. Patterns match against absolute file paths. Arrays merge across settings layers. Managed policy CLAUDE.md files cannot be excluded. See https://code.claude.com/docs/en/memory#exclude-specific-claude-md-files","examples":[["**/monorepo/CLAUDE.md","/home/user/monorepo/other-team/.claude/rules/**"]]},"cleanupPeriodDays":{"type":"integer","minimum":1,"description":"Number of days to retain sessions, orphaned subagent worktrees, tasks, shell snapshots, and backups. Minimum is 1; setting 0 is rejected with a validation error. See https://code.claude.com/docs/en/settings#available-settings","examples":[20,30,60],"default":30},"env":{"type":"object","description":"Environment variables to set for Claude Code sessions. Many environment variables provide settings dimensions not available as dedicated settings.json properties (e.g., thinking tokens, prompt caching, bash timeouts, shell configuration). See https://code.claude.com/docs/en/settings#environment-variables for the full list.","examples":[{"ANTHROPIC_MODEL":"claude-opus-4-1","ANTHROPIC_SMALL_FAST_MODEL":"claude-3-5-haiku-latest"}],"default":{},"properties":{"ANTHROPIC_API_KEY":{"type":"string","description":"API key for Anthropic API authentication"},"ANTHROPIC_AUTH_TOKEN":{"type":"string","description":"Custom Authorization header bearer token for API requests"},"ANTHROPIC_AWS_API_KEY":{"type":"string","description":"Workspace API key for Claude Platform on AWS; takes precedence over SigV4 authentication. See https://code.claude.com/docs/en/claude-platform-on-aws#1-configure-aws-credentials"},"ANTHROPIC_AWS_BASE_URL":{"type":"string","description":"Override the Claude Platform on AWS endpoint URL. Default is https://aws-external-anthropic.{region}.api.aws. See https://code.claude.com/docs/en/claude-platform-on-aws#route-through-a-corporate-proxy"},"ANTHROPIC_AWS_WORKSPACE_ID":{"type":"string","description":"Required workspace ID for Claude Platform on AWS; sent as the anthropic-workspace-id header on every request. See https://code.claude.com/docs/en/claude-platform-on-aws#2-configure-claude-code"},"ANTHROPIC_BASE_URL":{"type":"string","description":"Override API endpoint URL for proxy or gateway routing"},"ANTHROPIC_BEDROCK_BASE_URL":{"type":"string","description":"Override Amazon Bedrock endpoint URL"},"ANTHROPIC_BEDROCK_MANTLE_BASE_URL":{"type":"string","description":"Override Bedrock Mantle endpoint URL"},"ANTHROPIC_BEDROCK_SERVICE_TIER":{"type":"string","description":"Select Bedrock service tier; sent as X-Amzn-Bedrock-Service-Tier header. See https://code.claude.com/docs/en/amazon-bedrock#service-tiers","enum":["default","flex","priority"]},"ANTHROPIC_BETAS":{"type":"string","description":"Comma-separated beta header values to include in API requests"},"ANTHROPIC_CUSTOM_HEADERS":{"type":"string","description":"Custom HTTP headers for API requests (newline-separated 'Name: Value' pairs)"},"ANTHROPIC_CUSTOM_MODEL_OPTION":{"type":"string","description":"Custom model ID to add as an entry in the model picker"},"ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION":{"type":"string","description":"Display description for the custom model in the model picker"},"ANTHROPIC_CUSTOM_MODEL_OPTION_NAME":{"type":"string","description":"Display name for the custom model in the model picker"},"ANTHROPIC_CUSTOM_MODEL_OPTION_SUPPORTED_CAPABILITIES":{"type":"string","description":"JSON object specifying capability flags for the custom model"},"ANTHROPIC_DEFAULT_FABLE_MODEL":{"type":"string","description":"Override the default Fable-class model ID. See https://code.claude.com/docs/en/model-config#environment-variables"},"ANTHROPIC_DEFAULT_FABLE_MODEL_DESCRIPTION":{"type":"string","description":"Display description shown for the Fable model in the model picker. See https://code.claude.com/docs/en/model-config#customize-pinned-model-display-and-capabilities"},"ANTHROPIC_DEFAULT_FABLE_MODEL_NAME":{"type":"string","description":"Display name shown for the Fable model in the model picker. See https://code.claude.com/docs/en/model-config#customize-pinned-model-display-and-capabilities"},"ANTHROPIC_DEFAULT_FABLE_MODEL_SUPPORTED_CAPABILITIES":{"type":"string","description":"Comma-separated list of capabilities the pinned Fable model supports. See https://code.claude.com/docs/en/model-config#customize-pinned-model-display-and-capabilities"},"ANTHROPIC_DEFAULT_HAIKU_MODEL":{"type":"string","description":"Override default Haiku model ID"},"ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION":{"type":"string","description":"Display description shown for the Haiku model in the model picker. See https://code.claude.com/docs/en/model-config#customize-pinned-model-display-and-capabilities"},"ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME":{"type":"string","description":"Display name shown for the Haiku model in the model picker. See https://code.claude.com/docs/en/model-config#customize-pinned-model-display-and-capabilities"},"ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES":{"type":"string","description":"Comma-separated list of capabilities the pinned Haiku model supports. See https://code.claude.com/docs/en/model-config#customize-pinned-model-display-and-capabilities"},"ANTHROPIC_DEFAULT_OPUS_MODEL":{"type":"string","description":"Override default Opus model ID"},"ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION":{"type":"string","description":"Display description shown for the Opus model in the model picker. See https://code.claude.com/docs/en/model-config#customize-pinned-model-display-and-capabilities"},"ANTHROPIC_DEFAULT_OPUS_MODEL_NAME":{"type":"string","description":"Display name shown for the Opus model in the model picker. See https://code.claude.com/docs/en/model-config#customize-pinned-model-display-and-capabilities"},"ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES":{"type":"string","description":"Comma-separated list of capabilities the pinned Opus model supports. See https://code.claude.com/docs/en/model-config#customize-pinned-model-display-and-capabilities"},"ANTHROPIC_DEFAULT_SONNET_MODEL":{"type":"string","description":"Override default Sonnet model ID"},"ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION":{"type":"string","description":"Display description shown for the Sonnet model in the model picker. See https://code.claude.com/docs/en/model-config#customize-pinned-model-display-and-capabilities"},"ANTHROPIC_DEFAULT_SONNET_MODEL_NAME":{"type":"string","description":"Display name shown for the Sonnet model in the model picker. See https://code.claude.com/docs/en/model-config#customize-pinned-model-display-and-capabilities"},"ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES":{"type":"string","description":"Comma-separated list of capabilities the pinned Sonnet model supports. See https://code.claude.com/docs/en/model-config#customize-pinned-model-display-and-capabilities"},"ANTHROPIC_FOUNDRY_API_KEY":{"type":"string","description":"Microsoft Foundry authentication key"},"ANTHROPIC_FOUNDRY_AUTH_TOKEN":{"type":"string","description":"Bearer token for Microsoft Foundry authentication, such as a Microsoft Entra access token. Claude Code sends it as the Authorization: Bearer header. Takes precedence over ANTHROPIC_FOUNDRY_API_KEY and over the Azure default credential chain. Requires Claude Code v2.1.203 or later. See https://code.claude.com/docs/en/microsoft-foundry"},"ANTHROPIC_FOUNDRY_BASE_URL":{"type":"string","description":"Microsoft Foundry resource URL"},"ANTHROPIC_FOUNDRY_RESOURCE":{"type":"string","description":"Microsoft Foundry resource name"},"ANTHROPIC_MODEL":{"type":"string","description":"Model to use (e.g., 'claude-opus-4-1', 'claude-sonnet-4-5-20250514', 'opus', 'sonnet', 'haiku')"},"ANTHROPIC_SMALL_FAST_MODEL":{"type":"string","description":"DEPRECATED (prefer ANTHROPIC_DEFAULT_HAIKU_MODEL). Haiku-class model to use for background and low-complexity tasks (e.g., 'claude-3-5-haiku-latest')"},"ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION":{"type":"string","description":"Override the AWS region for the Haiku-class model on Bedrock and Bedrock Mantle. Has no effect without ANTHROPIC_DEFAULT_HAIKU_MODEL (or the deprecated ANTHROPIC_SMALL_FAST_MODEL) set on Bedrock. See https://code.claude.com/docs/en/amazon-bedrock#3-configure-claude-code"},"ANTHROPIC_VERTEX_BASE_URL":{"type":"string","description":"Override Google Cloud's Agent Platform (formerly Vertex AI) endpoint URL. Use for custom endpoints or when routing through an LLM gateway"},"ANTHROPIC_VERTEX_PROJECT_ID":{"type":"string","description":"GCP project ID for Google Cloud's Agent Platform (formerly Vertex AI) requests. Overridden by GCLOUD_PROJECT, GOOGLE_CLOUD_PROJECT, or the project in your GOOGLE_APPLICATION_CREDENTIALS credential file"},"ANTHROPIC_WORKSPACE_ID":{"type":"string","description":"Workspace ID for workload identity federation. Scopes the minted token to a specific workspace when the federation rule covers more than one. See https://code.claude.com/docs/en/env-vars"},"API_FORCE_IDLE_TIMEOUT":{"type":"string","description":"Override the 5-minute idle timeout for streaming responses (0 disables it). See https://code.claude.com/docs/en/env-vars"},"API_TIMEOUT_MS":{"type":"string","description":"Timeout for API requests in milliseconds (default: 600000, or 10 minutes; maximum: 2147483647). Increase this when requests time out on slow networks or when routing through a proxy. Values above the maximum overflow the underlying timer and cause requests to fail immediately."},"AWS_BEARER_TOKEN_BEDROCK":{"type":"string","description":"Bearer token for Bedrock API authentication"},"AWS_REGION":{"type":"string","description":"AWS region for Amazon Bedrock and Claude Platform on AWS requests (e.g. us-east-1). See https://code.claude.com/docs/en/amazon-bedrock#3-configure-claude-code"},"BASH_DEFAULT_TIMEOUT_MS":{"type":"string","description":"Default bash command timeout in milliseconds (default: 120000)"},"BASH_MAX_OUTPUT_LENGTH":{"type":"string","description":"Maximum bash output characters before truncation"},"BASH_MAX_TIMEOUT_MS":{"type":"string","description":"Maximum bash command timeout in milliseconds (default: 600000)"},"BETA_TRACING_ENDPOINT":{"type":"string","description":"Endpoint that, together with ENABLE_BETA_TRACING_DETAILED=1, activates detailed beta tracing spans (e.g. claude_code.hook). See https://code.claude.com/docs/en/monitoring-usage#traces-beta"},"CCR_FORCE_BUNDLE":{"type":"string","description":"Force local repo bundling for --remote invocations","enum":["0","1"]},"CLAUDECODE":{"type":"string","description":"Set to 1 in subprocesses Claude Code spawns (Bash and PowerShell tools, tmux sessions, hook commands, status line commands, stdio MCP server subprocesses). IDE extensions also set this in their integrated terminals. To distinguish a direct tool/hook subprocess from a stdio MCP server subprocess, use CLAUDE_CODE_CHILD_SESSION instead. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_AFK_COUNTDOWN_MS":{"type":"string","description":"How many milliseconds before auto-continue the on-screen countdown appears on an unanswered AskUserQuestion dialog. Default 20000 (20 seconds). See CLAUDE_AFK_TIMEOUT_MS. Requires Claude Code v2.1.198 or later. See https://code.claude.com/docs/en/env-vars"},"CLAUDE_AFK_TIMEOUT_MS":{"type":"string","description":"How many milliseconds of idle time before an unanswered AskUserQuestion dialog auto-continues without you. Default 60000 (60 seconds). Requires Claude Code v2.1.198 or later. See https://code.claude.com/docs/en/env-vars"},"CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS":{"type":"string","description":"Disable built-in subagent types in Agent SDK","enum":["0","1"]},"CLAUDE_AGENT_SDK_MCP_NO_PREFIX":{"type":"string","description":"Skip 'mcp__<server>__' prefix on MCP tool names in Agent SDK","enum":["0","1"]},"CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS":{"type":"string","description":"Stall timeout for background subagents in milliseconds (default 600000). The timer resets on each streaming progress event; if no progress arrives within the window the subagent is aborted and the task is marked failed, surfacing any partial result to the parent. See https://code.claude.com/docs/en/env-vars"},"CLAUDE_AUTOCOMPACT_PCT_OVERRIDE":{"type":"string","description":"Context capacity percentage threshold for auto-compaction (1-100)"},"CLAUDE_AUTO_BACKGROUND_TASKS":{"type":"string","description":"Force-enable automatic backgrounding of tasks","enum":["0","1"]},"CLAUDE_AX_SCREEN_READER":{"type":"string","description":"Set to 1 to render screen-reader friendly output: flat text without decorative borders or animations. Set to 0 to force screen-reader mode off even when axScreenReader is true. The --ax-screen-reader flag takes precedence. Requires Claude Code v2.1.181 or later. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR":{"type":"string","description":"Return to original project directory after each bash command","enum":["0","1"]},"CLAUDE_CLIENT_PRESENCE_FILE":{"type":"string","description":"Path to a file whose existence marks the user as present; while it exists, mobile push notifications are skipped (v2.1.181+). See https://code.claude.com/docs/en/env-vars"},"CLAUDE_CODE_ACCESSIBILITY":{"type":"string","description":"Keep native cursor visible for screen magnifiers and assistive tools","enum":["0","1"]},"CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD":{"type":"string","description":"Load CLAUDE.md memory files from additional directories","enum":["0","1"]},"CLAUDE_CODE_ALT_SCREEN_FULL_REPAINT":{"type":"string","description":"Force a full-screen repaint on every frame in fullscreen mode. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_ALWAYS_ENABLE_EFFORT":{"type":"string","description":"Send the effort parameter for all models, not just those with effort enabled by default. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_API_KEY_HELPER_TTL_MS":{"type":"string","description":"Credential helper refresh interval in milliseconds"},"CLAUDE_CODE_ARTIFACT_AUTO_OPEN":{"type":"string","description":"Set to 0 to stop auto-opening the browser when a new artifact is created. See https://code.claude.com/docs/en/artifacts#create-an-artifact","enum":["0","1"]},"CLAUDE_CODE_ATTRIBUTION_HEADER":{"type":"string","description":"Include attribution block in the system prompt","enum":["0","1"]},"CLAUDE_CODE_AUTO_COMPACT_WINDOW":{"type":"string","description":"Context capacity for compaction calculations in tokens"},"CLAUDE_CODE_AUTO_CONNECT_IDE":{"type":"string","description":"Override automatic IDE connection behavior","enum":["true","false"]},"CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS":{"type":"string","description":"Time in milliseconds Claude Code waits for the AWS default credential provider chain to produce credentials before the request fails with \\"AWS default-chain credential resolve timed out\\" (default: 60000). Raise it when a step in your chain legitimately needs longer, such as a browser-based SSO sign-in with MFA through a wrapper like aws-vault. Applies wherever Claude Code signs with the default chain. Requires Claude Code v2.1.207 or later. See https://code.claude.com/docs/en/amazon-bedrock#credential-caching-and-resolution-timeout"},"CLAUDE_CODE_BRIDGE_SESSION_ID":{"type":"string","description":"Set automatically in Bash tool and hook command subprocesses while the session has an active Remote Control connection, and removed when the connection ends. The value is the session's ID in session_ form, the same identifier that appears in the session's claude.ai/code URL, so a script can link back to the session that ran it. Requires Claude Code v2.1.199 or later. See https://code.claude.com/docs/en/remote-control"},"CLAUDE_CODE_CERT_STORE":{"type":"string","description":"CA certificate sources (comma-separated: 'bundled', 'system')"},"CLAUDE_CODE_CHILD_SESSION":{"type":"string","description":"Set by Claude Code to 1 in nested subprocesses (Bash, PowerShell, Monitor, hook commands, status-line commands) to distinguish nested sessions from a top-level claude launched in IDE terminals (v2.1.172+). A nested interactive claude TUI started this way is excluded from --resume, --continue, up-arrow history, and the claude agents list; non-interactive claude -p sessions still persist (override with CLAUDE_CODE_FORCE_SESSION_PERSISTENCE=1). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_CLIENT_CERT":{"type":"string","description":"Client certificate file path for mutual TLS"},"CLAUDE_CODE_CLIENT_KEY":{"type":"string","description":"Client private key file path for mutual TLS"},"CLAUDE_CODE_CLIENT_KEY_PASSPHRASE":{"type":"string","description":"Passphrase for encrypted client private key"},"CLAUDE_CODE_DEBUG_LOGS_DIR":{"type":"string","description":"Override the debug log file path. Despite the name, this is a file path, not a directory."},"CLAUDE_CODE_DEBUG_LOG_LEVEL":{"type":"string","description":"Debug log verbosity level","enum":["verbose","debug","info","warn","error"]},"CLAUDE_CODE_DISABLE_1M_CONTEXT":{"type":"string","description":"Disable 1M context window models","enum":["0","1"]},"CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING":{"type":"string","description":"Disable adaptive reasoning","enum":["0","1"]},"CLAUDE_CODE_DISABLE_ADVISOR_TOOL":{"type":"string","description":"Disable the server-side advisor tool. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_DISABLE_AGENT_VIEW":{"type":"string","description":"Turn off background agents and agent view (claude agents, --bg, /background, and the on-demand supervisor). Equivalent to the disableAgentView setting. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN":{"type":"string","description":"Disable alternate screen buffer rendering. When set to 1, keeps conversation in native scrollback instead of fullscreen renderer","enum":["0","1"]},"CLAUDE_CODE_DISABLE_ARTIFACT":{"type":"string","description":"Disable the Artifact tool. Equivalent to setting disableArtifact. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_DISABLE_ATTACHMENTS":{"type":"string","description":"Disable attachment processing","enum":["0","1"]},"CLAUDE_CODE_DISABLE_AUTO_MEMORY":{"type":"string","description":"Disable automatic memory feature","enum":["0","1"]},"CLAUDE_CODE_DISABLE_BACKGROUND_TASKS":{"type":"string","description":"Disable all background task functionality","enum":["0","1"]},"CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_GUARD":{"type":"string","description":"Set to 1 to skip the check that an Amazon Bedrock streaming response carries the application/vnd.amazon.eventstream content-type. Without this variable, a response with a different content-type fails with an error naming that content-type, which means a gateway or proxy is transforming the response. Set it only when the gateway rewrites the Content-Type header but passes the binary event-stream body through unmodified; if the body itself was transformed, requests fail with \\"Truncated event message received\\" instead. Requires Claude Code v2.1.208 or later. See https://code.claude.com/docs/en/amazon-bedrock#streaming-errors-behind-a-gateway-or-proxy","enum":["0","1"]},"CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF":{"type":"string","description":"Set to 1 to stop a background session's running background shell commands, dynamic workflows, and (as of v2.1.198) background subagents when the supervisor stops, restarts, or updates that session's process, instead of handing them off to the session's next process. Affects only that handoff; CLAUDE_DISABLE_ADOPT turns off both. Requires Claude Code v2.1.196 or later. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP":{"type":"string","description":"UNDOCUMENTED. Disable automatic memory-pressure reaping of idle background shell commands (added v2.1.193).","enum":["0","1"]},"CLAUDE_CODE_DISABLE_BUNDLED_SKILLS":{"type":"string","description":"Disable the skills and workflows bundled with Claude Code (plugins and project .claude/skills are unaffected). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_DISABLE_CLAUDE_MDS":{"type":"string","description":"Prevent loading CLAUDE.md memory files","enum":["0","1"]},"CLAUDE_CODE_DISABLE_CRON":{"type":"string","description":"Disable scheduled/cron tasks","enum":["0","1"]},"CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS":{"type":"string","description":"Strip anthropic-beta headers from API requests. See https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md#21123","enum":["0","1"]},"CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS":{"type":"string","description":"Set to 1 to disable the built-in Explore and Plan subagents. Requires Claude Code v2.1.198 or later. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_DISABLE_FAST_MODE":{"type":"string","description":"Disable fast mode toggle","enum":["0","1"]},"CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY":{"type":"string","description":"Disable session quality feedback surveys","enum":["0","1"]},"CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING":{"type":"string","description":"Disable file checkpointing for /rewind","enum":["0","1"]},"CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS":{"type":"string","description":"Remove git commit and PR workflow instructions from the system prompt","enum":["0","1"]},"CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP":{"type":"string","description":"Prevent automatic remapping of legacy model names","enum":["0","1"]},"CLAUDE_CODE_DISABLE_MOUSE":{"type":"string","description":"Disable mouse tracking in fullscreen mode. See https://code.claude.com/docs/en/fullscreen#keep-native-text-selection","enum":["0","1"]},"CLAUDE_CODE_DISABLE_MOUSE_CLICKS":{"type":"string","description":"Disable mouse click/drag/hover in fullscreen mode while keeping wheel scroll (requires v2.1.195+). CLAUDE_CODE_DISABLE_MOUSE takes precedence when both variables are set. See https://code.claude.com/docs/en/fullscreen#keep-native-text-selection","enum":["0","1"]},"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC":{"type":"string","description":"Disable auto-update checks, telemetry, and feedback in one setting","enum":["0","1"]},"CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK":{"type":"string","description":"Disable fallback to non-streaming API mode","enum":["0","1"]},"CLAUDE_CODE_DISABLE_NOTIFICATION_PRESENCE_CHECK":{"type":"string","description":"Set to 1 to send desktop notifications from the PushNotification tool even while focused on the terminal. Requires Claude Code v2.1.193 or later. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL":{"type":"string","description":"Skip automatic installation of official marketplace plugins. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_DISABLE_POLICY_SKILLS":{"type":"string","description":"Skip loading system-wide policy skills. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_DISABLE_TERMINAL_TITLE":{"type":"string","description":"Disable terminal title updates","enum":["0","1"]},"CLAUDE_CODE_DISABLE_THINKING":{"type":"string","description":"Force-disable extended thinking","enum":["0","1"]},"CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL":{"type":"string","description":"Disable virtual scrolling in fullscreen mode","enum":["0","1"]},"CLAUDE_CODE_DISABLE_WORKFLOWS":{"type":"string","description":"Set to 1 to disable workflows. Equivalent to the disableWorkflows setting. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_EFFORT_LEVEL":{"type":"string","description":"Reasoning effort level","enum":["low","medium","high","xhigh","max","auto"]},"CLAUDE_CODE_ENABLE_APPEND_SUBAGENT_PROMPT":{"type":"string","description":"Set to 1 to enable appending extra text to the end of every subagent's system prompt. The --append-subagent-system-prompt flag supplies the appended text and sets this variable automatically, so you do not need to set it yourself. Requires Claude Code v2.1.205 or later. See https://code.claude.com/docs/en/sub-agents","enum":["0","1"]},"CLAUDE_CODE_ENABLE_AUTO_MODE":{"type":"string","description":"Set to 1 to make auto mode available on Amazon Bedrock, Google Cloud Vertex AI, and Microsoft Foundry (requires v2.1.158+; no effect on the Anthropic API where auto mode is available by default). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_ENABLE_AWAY_SUMMARY":{"type":"string","description":"Override session recap/away summary availability","enum":["0","1"]},"CLAUDE_CODE_ENABLE_BACKGROUND_PLUGIN_REFRESH":{"type":"string","description":"Refresh plugins at turn boundaries. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL":{"type":"string","description":"Enable feedback survey collection via OpenTelemetry for enterprises","enum":["0","1"]},"CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING":{"type":"string","description":"Force fine-grained tool output streaming","enum":["0","1"]},"CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY":{"type":"string","description":"Enable model discovery from LLM gateway /v1/models endpoint when ANTHROPIC_BASE_URL points at an Anthropic-compatible gateway","enum":["0","1"]},"CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION":{"type":"string","description":"Enable prompt suggestions","enum":["true","false"]},"CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING":{"type":"string","description":"Enable file checkpointing for a non-interactive CLI run, so \`claude -p --resume <session-id> --rewind-files <checkpoint-uuid>\` can rewind files. The Agent SDK sets this internally when enable_file_checkpointing (Python) or enableFileCheckpointing (TypeScript) is enabled; the bare CLI never sets it. Without it, a non-interactive rewind fails with \\"File rewinding is not enabled\\". See https://code.claude.com/docs/en/agent-sdk/file-checkpointing"},"CLAUDE_CODE_ENABLE_TASKS":{"type":"string","description":"Enable task tracking in non-interactive mode","enum":["0","1"]},"CLAUDE_CODE_ENABLE_TELEMETRY":{"type":"string","description":"Set to 1 to enable telemetry collection. Required for all OpenTelemetry integration. See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables","enum":["0","1"]},"CLAUDE_CODE_ENHANCED_TELEMETRY_BETA":{"type":"string","description":"Enable the enhanced telemetry (tracing) beta. ENABLE_ENHANCED_TELEMETRY_BETA is also accepted. See https://code.claude.com/docs/en/monitoring-usage#traces-beta","enum":["0","1"]},"CLAUDE_CODE_EXIT_AFTER_STOP_DELAY":{"type":"string","description":"Wait time in milliseconds before auto-exit after stop"},"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS":{"type":"string","description":"Enable experimental agent teams feature","enum":["0","1"]},"CLAUDE_CODE_EXTRA_BODY":{"type":"string","description":"JSON object to merge into every API request body"},"CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS":{"type":"string","description":"Token limit for file read operations"},"CLAUDE_CODE_FORCE_SESSION_PERSISTENCE":{"type":"string","description":"Set to 1 to override the automatic exclusion of nested interactive claude TUI sessions from --resume, --continue, up-arrow history, and the claude agents list (requires v2.1.172+). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_FORCE_STRIKETHROUGH":{"type":"string","description":"Set to 1 to force strikethrough rendering for ~~text~~ in Claude's responses when the terminal supports it but is not auto-detected, such as over SSH without TERM_PROGRAM forwarded. Without this, undetected terminals show the literal ~~ markers. Requires Claude Code v2.1.186 or later. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_FORCE_SYNC_OUTPUT":{"type":"string","description":"Force synchronous output flushing. When set to 1, forces synchronized output on terminals that auto-detection misses (e.g., Emacs eat)","enum":["0","1"]},"CLAUDE_CODE_FORK_SUBAGENT":{"type":"string","description":"Fork subagent processes in non-interactive sessions. See https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md#21120","enum":["0","1"]},"CLAUDE_CODE_FORWARD_SUBAGENT_TEXT":{"type":"string","description":"Set to 1 to emit subagent text and thinking blocks in claude -p --output-format stream-json output, the same behavior as the --forward-subagent-text flag. Use the variable when a harness invokes claude and cannot pass the flag itself. Unlike the flag, which exits with an error outside non-interactive mode with stream-json output, the variable is ignored there so that nested invocations keep working when it is set process-wide. Requires Claude Code v2.1.211 or later. See https://code.claude.com/docs/en/sub-agents","enum":["0","1"]},"CLAUDE_CODE_GIT_BASH_PATH":{"type":"string","description":"Path to Git Bash executable (Windows only)"},"CLAUDE_CODE_GLOB_HIDDEN":{"type":"string","description":"Include dotfiles/hidden files in Glob results","enum":["true","false"]},"CLAUDE_CODE_GLOB_NO_IGNORE":{"type":"string","description":"Don't respect .gitignore rules in Glob results","enum":["true","false"]},"CLAUDE_CODE_GLOB_TIMEOUT_SECONDS":{"type":"string","description":"Glob tool timeout in seconds (default: 20-60)"},"CLAUDE_CODE_HIDE_CWD":{"type":"string","description":"Hide the working directory in the startup logo. See https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md#21126","enum":["0","1"]},"CLAUDE_CODE_IDE_HOST_OVERRIDE":{"type":"string","description":"Override IDE connection address"},"CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL":{"type":"string","description":"Skip automatic IDE extension installation","enum":["0","1"]},"CLAUDE_CODE_IDE_SKIP_VALID_CHECK":{"type":"string","description":"Skip IDE lockfile validation","enum":["0","1"]},"CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS":{"type":"string","description":"How many subagents can be running in one session before the Agent tool refuses to spawn another (default: 20). Accepts a positive whole number in plain digits; anything else is ignored, so the variable can adjust the cap but cannot disable it. Requires Claude Code v2.1.217 or later. See https://code.claude.com/docs/en/sub-agents#concurrent-subagent-limit"},"CLAUDE_CODE_MAX_CONTEXT_TOKENS":{"type":"string","description":"Override context window size in tokens"},"CLAUDE_CODE_MAX_OUTPUT_TOKENS":{"type":"string","description":"Maximum output tokens per API request"},"CLAUDE_CODE_MAX_RETRIES":{"type":"string","description":"Maximum API request retry attempts (default: 10)"},"CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION":{"type":"string","description":"Cap on the number of subagents one session can spawn with the Agent tool (default: 200). When Claude reaches the cap, spawning another subagent fails with an error telling Claude to finish the remaining work directly. Accepts a positive whole number in plain digits with no upper bound; this variable does not take the scientific notation or digit-separator spellings. Anything else is ignored and the default applies, so the cap can be raised but not turned off. Requires Claude Code v2.1.212 or later. See https://code.claude.com/docs/en/sub-agents#session-subagent-limit"},"CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH":{"type":"string","description":"Number of subagent layers allowed below the main conversation (default: 1). At the default, subagents cannot spawn their own subagents; set 2 or higher to allow it. Accepts a positive whole number in plain digits; anything else is ignored, so the limit can be raised but not turned off. Requires Claude Code v2.1.217 or later. See https://code.claude.com/docs/en/sub-agents#let-subagents-spawn-their-own-subagents"},"CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY":{"type":"string","description":"Maximum parallel tool executions (default: 10)"},"CLAUDE_CODE_MAX_TURNS":{"type":"string","description":"Cap the number of agentic turns when no explicit limit is passed. Equivalent to --max-turns, which takes precedence. A non-positive integer is rejected at startup. See https://code.claude.com/docs/en/env-vars"},"CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION":{"type":"string","description":"Cap on the total number of WebSearch calls one session can make (default: 200). When Claude reaches the cap, further WebSearch calls return a notice telling it to continue with the information it already gathered. Accepts a positive whole number with no upper bound. Anything else is ignored and the default applies, so the cap can be raised but not turned off. Requires Claude Code v2.1.212 or later. See https://code.claude.com/docs/en/tools-reference#websearch-tool-behavior"},"CLAUDE_CODE_MCP_ALLOWLIST_ENV":{"type":"string","description":"Isolate MCP server environments to allowlisted variables","enum":["0","1"]},"CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS":{"type":"string","description":"Elapsed time in milliseconds before a still-running MCP tool call moves to a background task (default: 120000, or 2 minutes). Set to 0 to turn automatic backgrounding off. Requires Claude Code v2.1.212 or later. See https://code.claude.com/docs/en/mcp#automatic-backgrounding-of-long-tool-calls"},"CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT":{"type":"string","description":"Idle timeout in milliseconds for MCP tool calls. When a stdio, HTTP, SSE, WebSocket, or claude.ai connector MCP server sends no response and no progress notification for this long, the tool call aborts with an error instead of waiting for the overall MCP_TOOL_TIMEOUT. Overrides the per-transport defaults of 300000 (5 minutes) for network servers and 1800000 (30 minutes) for stdio servers. Set to 0 to disable the idle check. Values below 1000 are raised to one second, and the value is capped at the effective MCP_TOOL_TIMEOUT. A per-server timeout in .mcp.json of at least 1000 raises that server's idle window to at least the timeout value. Does not apply to IDE servers or SDK in-process servers. Requires Claude Code v2.1.187 or later. Before v2.1.203, stdio servers were exempt from the idle timeout. See https://code.claude.com/docs/en/mcp"},"CLAUDE_CODE_NATIVE_CURSOR":{"type":"string","description":"Set to 1 to show the terminal's own cursor at the input caret instead of a drawn block. The cursor respects the terminal's blink, shape, and focus settings. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_NEW_INIT":{"type":"string","description":"Use the interactive /init setup flow","enum":["0","1"]},"CLAUDE_CODE_NO_FLICKER":{"type":"string","description":"Enable fullscreen rendering mode to reduce flicker","enum":["0","1"]},"CLAUDE_CODE_OAUTH_REFRESH_TOKEN":{"type":"string","description":"OAuth refresh token"},"CLAUDE_CODE_OAUTH_SCOPES":{"type":"string","description":"OAuth scopes (space-separated)"},"CLAUDE_CODE_OAUTH_TOKEN":{"type":"string","description":"OAuth access token"},"CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH":{"type":"string","description":"Maximum length of content-bearing OpenTelemetry attributes (model responses, tool content, system prompts, raw API bodies), truncation marker included, in UTF-16 code units (default: 61440, i.e. 60 KB). Raise it only if your telemetry backend accepts attribute values larger than 64 KB, or lower it to cut telemetry volume. Requires Claude Code v2.1.214 or later. See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables"},"CLAUDE_CODE_OTEL_DIAG_STDERR":{"type":"string","description":"Set to 1 to write OpenTelemetry exporter diagnostic errors to stderr (otherwise shown only with --debug). Requires v2.1.179+. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_OTEL_FLUSH_TIMEOUT_MS":{"type":"string","description":"OpenTelemetry span flush timeout in milliseconds (default: 5000)"},"CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS":{"type":"string","description":"OpenTelemetry header helper refresh interval in milliseconds"},"CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS":{"type":"string","description":"OpenTelemetry shutdown timeout in milliseconds (default: 2000)"},"CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE":{"type":"string","description":"Enable automatic package manager updates. When set, Claude Code runs the upgrade command in background on Homebrew/WinGet and prompts to restart","enum":["0","1"]},"CLAUDE_CODE_PERFORCE_MODE":{"type":"string","description":"Enable Perforce write protection mode","enum":["0","1"]},"CLAUDE_CODE_PLUGIN_CACHE_DIR":{"type":"string","description":"Override the plugins root directory. Despite the name, this sets the parent directory, not the cache itself: marketplaces and the plugin cache live in subdirectories under this path. Defaults to ~/.claude/plugins. See https://code.claude.com/docs/en/env-vars"},"CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS":{"type":"string","description":"Plugin marketplace git operations timeout in milliseconds (default: 120000). See https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md#2151"},"CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE":{"type":"string","description":"Keep plugin cache on update failure","enum":["0","1"]},"CLAUDE_CODE_PLUGIN_PREFER_HTTPS":{"type":"string","enum":["0","1"],"description":"Set to 1 to clone GitHub owner/repo plugin sources over HTTPS instead of SSH. Useful in CI runners, containers, or environments without a configured SSH key for github.com. See https://code.claude.com/docs/en/env-vars"},"CLAUDE_CODE_PLUGIN_SEED_DIR":{"type":"string","description":"Path(s) to pre-populated plugin directories. See https://code.claude.com/docs/en/plugin-marketplaces#pre-populate-plugins-for-containers"},"CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY":{"type":"string","enum":["0","1"],"description":"Set to 1 to stop Claude Code from passing -ExecutionPolicy Bypass when spawning PowerShell for tool calls, hooks, and status line commands. By default Claude Code bypasses execution policy so .ps1 scripts work on default-Restricted Windows installs. See https://code.claude.com/docs/en/env-vars"},"CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS":{"type":"string","description":"Cap, in milliseconds, on how long \`claude -p\` waits for background subagents at exit (default 10 minutes; set to 0 to wait without limit, added v2.1.182). See https://code.claude.com/docs/en/headless#background-tasks-at-exit"},"CLAUDE_CODE_PROCESS_WRAPPER":{"type":"string","description":"Launch the processes Claude Code starts from its own binary, such as the background service that hosts agent view sessions, through a corporate launcher given as an argv prefix like /opt/corp/launcher. Set it in the env block of user or managed settings, not as a shell export, so the detached background service inherits it; project and local settings cannot set it. Equivalent to the processWrapper setting, which requires Claude Code v2.1.210 or later; this variable takes precedence when both are set. The VS Code extension configures its own launcher separately through its claudeProcessWrapper setting. Ignored on Windows. Requires Claude Code v2.1.208 or later. See https://code.claude.com/docs/en/corporate-launcher"},"CLAUDE_CODE_PROPAGATE_TRACEPARENT":{"type":"string","description":"Propagate the W3C traceparent header on API requests when using a custom ANTHROPIC_BASE_URL. See https://code.claude.com/docs/en/monitoring-usage#traces-beta","enum":["0","1"]},"CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST":{"type":"string","description":"Indicate that the host application manages provider routing","enum":["0","1"]},"CLAUDE_CODE_PROXY_RESOLVES_HOSTS":{"type":"string","description":"Allow proxy to handle DNS resolution","enum":["0","1"]},"CLAUDE_CODE_REMOTE":{"type":"string","description":"Indicates a remote web environment session","enum":["true","false"]},"CLAUDE_CODE_REMOTE_SESSION_ID":{"type":"string","description":"Cloud session identifier for remote sessions"},"CLAUDE_CODE_RESUME_INTERRUPTED_TURN":{"type":"string","description":"Automatically resume from a mid-turn interruption","enum":["0","1"]},"CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS":{"type":"string","description":"Maximum age in milliseconds of the last transcript message for a session that ended mid-turn to continue automatically on resume. When the last message is older than this bound, Claude Code skips both the CLAUDE_CODE_RESUME_INTERRUPTED_TURN automatic resume and the injected CLAUDE_CODE_RESUME_PROMPT continuation message, and the session starts idle so you continue explicitly. Unset or 0 means no bound; a negative or non-numeric value applies a one-hour bound. Spawn scripts for long-running agents can set this so a restart against an old transcript does not re-run a stale prompt. Claude Code sets a one-hour bound itself when it restarts a crashed agent view session that inherited its conversation from an interactive session. Requires Claude Code v2.1.211 or later. See https://code.claude.com/docs/en/env-vars"},"CLAUDE_CODE_RESUME_PROMPT":{"type":"string","description":"Override the continuation message injected when resuming a session that ended mid-turn (default \\"Continue from where you left off.\\"). An empty string uses the default. See https://code.claude.com/docs/en/env-vars"},"CLAUDE_CODE_RETRY_WATCHDOG":{"type":"string","description":"Set to 1 for unattended sessions (eval harnesses, CI, remote workers) to retry 429/529 capacity errors indefinitely, backing off up to 5 minutes, instead of failing after CLAUDE_CODE_MAX_RETRIES. Requires v2.1.186+. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_SAFE_MODE":{"type":"string","description":"Set to 1 to start in safe mode: CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, custom keybindings, status line and file-suggestion commands, LSP servers, and auto-memory do not load, for troubleshooting a broken configuration. Managed settings policy still applies. Equivalent to passing --safe-mode; directly spawned child processes inherit the variable. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_SCRIPT_CAPS":{"type":"string","description":"Script invocation limits (JSON object)"},"CLAUDE_CODE_SCROLL_SPEED":{"type":"string","description":"Set the mouse wheel scroll multiplier in fullscreen rendering. Accepts any positive value up to 20, including fractional values below 1 such as 0.5 to slow accelerated trackpad and wheel scrolling in terminals that already amplify wheel events. Set to 3 to match vim if your terminal sends one wheel event per notch without amplification. See https://code.claude.com/docs/en/fullscreen#mouse-wheel-scrolling"},"CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS":{"type":"string","description":"Override the time budget in milliseconds for SessionEnd hooks (default 1500, raised up to 60000 by the highest configured per-hook timeout). See https://code.claude.com/docs/en/env-vars"},"CLAUDE_CODE_SESSION_ID":{"type":"string","description":"Set automatically to the current session ID in Bash/PowerShell tool subprocesses, hook command subprocesses, and stdio MCP server subprocesses. Read-only. See https://code.claude.com/docs/en/env-vars"},"CLAUDE_CODE_SHELL":{"type":"string","description":"Override automatic shell detection (e.g., '/bin/zsh', '/bin/bash')"},"CLAUDE_CODE_SHELL_PREFIX":{"type":"string","description":"Command prefix wrapper for shell commands"},"CLAUDE_CODE_SIMPLE":{"type":"string","description":"Minimal mode with core tools only","enum":["0","1"]},"CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT":{"type":"string","description":"Use a shortened system prompt","enum":["0","1"]},"CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH":{"type":"string","description":"Skip client-side SigV4 authentication for Claude Platform on AWS; use when a proxy or gateway adds authentication before forwarding. See https://code.claude.com/docs/en/claude-platform-on-aws#route-through-a-corporate-proxy","enum":["0","1"]},"CLAUDE_CODE_SKIP_AWS_CRED_CACHE":{"type":"string","description":"Set to 1 to turn off the in-process cache of credentials resolved from the AWS default credential provider chain, so Claude Code resolves the chain on every API request. With the cache off, an SSO-backed profile requests credentials from IAM Identity Center on every request. Requires Claude Code v2.1.207 or later. See https://code.claude.com/docs/en/amazon-bedrock#credential-caching-and-resolution-timeout","enum":["0","1"]},"CLAUDE_CODE_SKIP_BEDROCK_AUTH":{"type":"string","description":"Skip AWS authentication for Bedrock","enum":["0","1"]},"CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS":{"type":"string","description":"Set to 1 to treat a failed fast mode availability check as available, for networks that block the check's direct request to api.anthropic.com. Claude Code still honors a \\"disabled by your organization\\" response. See https://code.claude.com/docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways","enum":["0","1"]},"CLAUDE_CODE_SKIP_FAST_MODE_ORG_CHECK":{"type":"string","description":"Set to 1 to skip the client-side fast mode availability check, for proxies that intercept the check's request rather than refuse it. The API still rejects fast mode requests when your organization has fast mode disabled. See https://code.claude.com/docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways","enum":["0","1"]},"CLAUDE_CODE_SKIP_FOUNDRY_AUTH":{"type":"string","description":"Skip Azure authentication for Foundry","enum":["0","1"]},"CLAUDE_CODE_SKIP_MANTLE_AUTH":{"type":"string","description":"Skip AWS authentication for Bedrock Mantle (for example, when using an LLM gateway). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_SKIP_PROMPT_HISTORY":{"type":"string","description":"Disable transcript writes entirely. See https://code.claude.com/docs/en/settings#environment-variables","enum":["0","1"]},"CLAUDE_CODE_SKIP_VERTEX_AUTH":{"type":"string","description":"Skip Google authentication for Google Cloud's Agent Platform","enum":["0","1"]},"CLAUDE_CODE_STOP_HOOK_BLOCK_CAP":{"type":"string","description":"Override the default maximum consecutive Stop hook blocks (default: 8) before the turn ends with a warning. Raise this when a stop hook legitimately needs more than 8 iterations to converge. See https://code.claude.com/docs/en/hooks-guide"},"CLAUDE_CODE_SUBAGENT_MODEL":{"type":"string","description":"Override model used by subagents"},"CLAUDE_CODE_SUBPROCESS_ENV_SCRUB":{"type":"string","description":"Strip credentials from subprocess environments","enum":["0","1"]},"CLAUDE_CODE_SYNC_PLUGIN_INSTALL":{"type":"string","description":"Wait synchronously for plugin installation","enum":["0","1"]},"CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS":{"type":"string","description":"Timeout in milliseconds for synchronous plugin installation"},"CLAUDE_CODE_SYNC_SKILLS":{"type":"string","description":"Set to 1 to download enabled claude.ai skills into ~/.claude/skills/ before the first query and resync every 10 minutes (non-interactive -p mode only; requires claude.ai auth). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_SYNC_SKILLS_INSTALL_TIMEOUT_MS":{"type":"string","description":"Timeout in milliseconds for a mid-session skills resync when CLAUDE_CODE_SYNC_SKILLS is set (default 30000). See https://code.claude.com/docs/en/env-vars"},"CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS":{"type":"string","description":"Timeout in milliseconds for the first query to wait on the initial skills sync when CLAUDE_CODE_SYNC_SKILLS is set (default 5000). See https://code.claude.com/docs/en/env-vars"},"CLAUDE_CODE_SYNTAX_HIGHLIGHT":{"type":"string","description":"UNDOCUMENTED. Enable syntax highlighting in diffs","enum":["true","false"]},"CLAUDE_CODE_TASK_LIST_ID":{"type":"string","description":"Shared task list identifier for team collaboration"},"CLAUDE_CODE_TEAM_NAME":{"type":"string","description":"Agent team membership name"},"CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS":{"type":"string","description":"Override, in milliseconds, how long a non-interactive session waits at exit for its agent team to finish tearing down. Accepts 1000 to 60000; an out-of-range value is ignored and the default of 10000 applies. Requires Claude Code v2.1.206 or later. See https://code.claude.com/docs/en/agent-teams"},"CLAUDE_CODE_TMPDIR":{"type":"string","description":"Override temp directory path"},"CLAUDE_CODE_TMUX_TRUECOLOR":{"type":"string","description":"Allow 24-bit truecolor rendering in tmux","enum":["0","1"]},"CLAUDE_CODE_USE_ANTHROPIC_AWS":{"type":"string","description":"Enable Claude Platform on AWS as the API provider. Bedrock and Foundry take precedence if also set. See https://code.claude.com/docs/en/claude-platform-on-aws#2-configure-claude-code","enum":["0","1"]},"CLAUDE_CODE_USE_BEDROCK":{"type":"string","description":"Enable Amazon Bedrock as the API provider. See https://code.claude.com/docs/en/amazon-bedrock#3-configure-claude-code","enum":["0","1"]},"CLAUDE_CODE_USE_FOUNDRY":{"type":"string","description":"Enable Microsoft Foundry as the API provider. See https://code.claude.com/docs/en/microsoft-foundry#3-configure-claude-code","enum":["0","1"]},"CLAUDE_CODE_USE_MANTLE":{"type":"string","description":"Enable the Mantle endpoint (native Anthropic API shape on Bedrock). See https://code.claude.com/docs/en/amazon-bedrock#enable-mantle","enum":["0","1"]},"CLAUDE_CODE_USE_NATIVE_FILE_SEARCH":{"type":"string","description":"Set to 1 to discover custom commands, subagents, and output styles using Node.js file APIs instead of ripgrep (for environments where the bundled ripgrep is unavailable). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_CODE_USE_POWERSHELL_TOOL":{"type":"string","description":"Enable PowerShell as default shell for interactive commands (Windows)","enum":["0","1"]},"CLAUDE_CODE_USE_VERTEX":{"type":"string","description":"Enable Google Cloud's Agent Platform as the API provider. See https://code.claude.com/docs/en/google-vertex-ai#4-configure-claude-code","enum":["0","1"]},"CLAUDE_CONFIG_DIR":{"type":"string","description":"Override the configuration directory (default ~/.claude) where settings, credentials, session history, and plugins are stored. Useful for running multiple accounts side by side. See https://code.claude.com/docs/en/env-vars"},"CLAUDE_DISABLE_ADOPT":{"type":"string","description":"Set to 1 to stop in-flight background work instead of carrying it over when you background a session by pressing ← or with /background. Claude Code asks you to confirm before backgrounding, then stops the tasks that would otherwise carry over. Requires Claude Code v2.1.195 or later. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_EFFORT":{"type":"string","enum":["low","medium","high","xhigh","max"],"description":"Set automatically in Bash tool subprocesses and hook commands to the active effort level for the turn (low, medium, high, xhigh, or max; ultracode reports as xhigh). Read-only. See https://code.claude.com/docs/en/env-vars"},"CLAUDE_ENABLE_BYTE_WATCHDOG":{"type":"string","description":"Set to 1 to force-enable, or 0 to force-disable, the byte-level streaming idle watchdog that aborts a connection when no bytes arrive within the configured timeout. Enabled by default on direct Anthropic API and Claude Platform on AWS connections. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK":{"type":"string","description":"Set to 1 to enable the byte-level streaming idle watchdog on Amazon Bedrock eventstream responses (off by default). Configure the timeout with CLAUDE_STREAM_IDLE_TIMEOUT_MS. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_ENABLE_STREAM_WATCHDOG":{"type":"string","description":"Set to 1 to force-enable, or 0 to force-disable, the event-level streaming idle watchdog. When unset, the watchdog is on by default for all providers (as of v2.1.196; before that the unset default was server-controlled on the direct Anthropic API and off on other providers). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"CLAUDE_ENV_FILE":{"type":"string","description":"File path for persisting environment variables across Bash commands"},"CLAUDE_PID":{"type":"string","description":"Claude Code sets this to its own process ID in the subprocesses it spawns: Bash and PowerShell tool commands and hook commands. On Linux, the Bash tool's shell integration uses it to refuse a pkill pattern that would match the Claude Code process itself. Read it from your own scripts to identify or signal the parent Claude Code process deliberately. Requires Claude Code v2.1.214 or later. See https://code.claude.com/docs/en/errors#pkill-pattern-matches-the-claude-code-process"},"CLAUDE_PROJECT_DIR":{"type":"string","description":"Project root directory path (also provided to hooks)"},"CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX":{"type":"string","description":"Prefix for auto-generated Remote Control session names when no explicit name is set. Defaults to the machine hostname, producing names like myhost-graceful-unicorn. See https://code.claude.com/docs/en/remote-control#start-a-remote-control-session"},"CLAUDE_STREAM_IDLE_TIMEOUT_MS":{"type":"string","description":"Timeout in milliseconds before the streaming idle watchdog closes a stalled connection. When set explicitly the minimum is 300000 (5 minutes); lower values are clamped. See https://code.claude.com/docs/en/env-vars"},"CLOUD_ML_REGION":{"type":"string","description":"Google Cloud's Agent Platform region: global, a multi-region location (eu, us), or a specific region (e.g. us-east5). See https://code.claude.com/docs/en/google-vertex-ai#region-configuration"},"DEBUG":{"type":"string","description":"Set to a truthy value (1, true, yes, or on) to enable debug mode, equivalent to --debug. Logs are written to ~/.claude/debug/<session-id>.txt. See https://code.claude.com/docs/en/env-vars"},"DISABLE_AUTOUPDATER":{"type":"string","description":"Set to 1 to disable automatic background updates. Manual claude update still works; use DISABLE_UPDATES to block both. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DISABLE_AUTO_COMPACT":{"type":"string","description":"Set to 1 to disable automatic compaction when approaching the context limit. The manual /compact command remains available. Equivalent to autoCompactEnabled: false. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DISABLE_COMPACT":{"type":"string","description":"Set to 1 to disable all compaction: both automatic compaction and the manual /compact command. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DISABLE_COST_WARNINGS":{"type":"string","description":"Set to 1 to disable cost warning messages. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DISABLE_DOCTOR_COMMAND":{"type":"string","description":"Set to 1 to hide the /doctor command (useful for managed deployments). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DISABLE_ERROR_REPORTING":{"type":"string","description":"Disable Sentry error reporting","enum":["0","1"]},"DISABLE_EXTRA_USAGE_COMMAND":{"type":"string","description":"Set to 1 to hide the /usage-credits command for purchasing additional usage beyond rate limits. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DISABLE_FEEDBACK_COMMAND":{"type":"string","description":"Set to 1 to disable the /feedback command. The older name DISABLE_BUG_COMMAND is also accepted. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DISABLE_GROWTHBOOK":{"type":"string","description":"Set to 1 to disable GrowthBook feature-flag fetching and use code defaults for every flag. Telemetry stays on unless DISABLE_TELEMETRY is also set. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DISABLE_INSTALLATION_CHECKS":{"type":"string","description":"Set to 1 to disable installation warnings (use only when manually managing the installation location). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DISABLE_INSTALL_GITHUB_APP_COMMAND":{"type":"string","description":"Set to 1 to hide the /install-github-app command (already hidden on Bedrock, Vertex, or Foundry). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DISABLE_INTERLEAVED_THINKING":{"type":"string","description":"Set to 1 to prevent sending the interleaved-thinking beta header (useful when a gateway or provider does not support interleaved thinking). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DISABLE_LOGIN_COMMAND":{"type":"string","description":"Set to 1 to hide the /login command (useful when authentication is handled externally via API keys or apiKeyHelper). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DISABLE_LOGOUT_COMMAND":{"type":"string","description":"Set to 1 to hide the /logout command. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DISABLE_PROMPT_CACHING":{"type":"string","description":"Disable prompt caching for all models. See https://code.claude.com/docs/en/prompt-caching#disable-prompt-caching","enum":["0","1"]},"DISABLE_PROMPT_CACHING_FABLE":{"type":"string","description":"Disable prompt caching for Fable models only. See https://code.claude.com/docs/en/prompt-caching#disable-prompt-caching","enum":["0","1"]},"DISABLE_PROMPT_CACHING_HAIKU":{"type":"string","description":"Disable prompt caching for Haiku models only. See https://code.claude.com/docs/en/prompt-caching#disable-prompt-caching","enum":["0","1"]},"DISABLE_PROMPT_CACHING_OPUS":{"type":"string","description":"Disable prompt caching for Opus models only. See https://code.claude.com/docs/en/prompt-caching#disable-prompt-caching","enum":["0","1"]},"DISABLE_PROMPT_CACHING_SONNET":{"type":"string","description":"Disable prompt caching for Sonnet models only. See https://code.claude.com/docs/en/prompt-caching#disable-prompt-caching","enum":["0","1"]},"DISABLE_TELEMETRY":{"type":"string","description":"Set to 1 to opt out of telemetry. Also disables feature-flag fetching (same effect as DISABLE_GROWTHBOOK). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DISABLE_UPDATES":{"type":"string","description":"Block all update paths including manual updates","enum":["0","1"]},"DISABLE_UPGRADE_COMMAND":{"type":"string","description":"Set to 1 to hide the /upgrade command. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"DO_NOT_TRACK":{"type":"string","description":"Set to 1 to opt out of telemetry (cross-tool convention; equivalent to DISABLE_TELEMETRY). See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"ENABLE_BETA_TRACING_DETAILED":{"type":"string","description":"Emit detailed spans including hook execution when the tracing beta is enabled. See https://code.claude.com/docs/en/monitoring-usage#traces-beta","enum":["0","1"]},"ENABLE_CLAUDEAI_MCP_SERVERS":{"type":"string","description":"Opt in/out of claude.ai MCP servers. See https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md#2163","enum":["true","false"]},"ENABLE_PROMPT_CACHING_1H":{"type":"string","description":"Request a 1-hour prompt cache TTL instead of the 5-minute default (billed at a higher rate). See https://code.claude.com/docs/en/prompt-caching#cache-lifetime","enum":["0","1"]},"ENABLE_TOOL_SEARCH":{"type":"string","description":"Control MCP tool search: \\"true\\" always defers and sends the beta header (requests fail on Google Cloud's Agent Platform models earlier than Sonnet 4.5/Opus 4.5 or on proxies that do not support tool_reference); \\"auto\\" loads tools upfront if they fit within 10% of context; \\"auto:N\\" sets a custom threshold percentage (e.g. auto:5); \\"false\\" loads all tools upfront. Also applies when ANTHROPIC_BASE_URL points to a non-first-party host. See https://code.claude.com/docs/en/google-vertex-ai#4-configure-claude-code"},"FALLBACK_FOR_ALL_PRIMARY_MODELS":{"type":"string","description":"Set to any non-empty value to make all models (not only Opus) stop retrying with a repeated-overload error when no fallback model is configured. See https://code.claude.com/docs/en/env-vars"},"FORCE_AUTOUPDATE_PLUGINS":{"type":"string","description":"Keep plugin auto-updates enabled even when DISABLE_AUTOUPDATER=1 is set. See https://code.claude.com/docs/en/discover-plugins#configure-auto-updates","enum":["0","1"]},"FORCE_HYPERLINK":{"type":"string","description":"Set to 1 to enable clickable OSC 8 hyperlinks when your terminal supports them but is not auto-detected, or 0 to disable them","enum":["0","1"]},"FORCE_PROMPT_CACHING_5M":{"type":"string","description":"Force a 5-minute cache TTL regardless of authentication method; overrides ENABLE_PROMPT_CACHING_1H or a managed-settings TTL. See https://code.claude.com/docs/en/prompt-caching#override-the-ttl","enum":["0","1"]},"GOOGLE_APPLICATION_CREDENTIALS":{"type":"string","description":"Path to a GCP credential configuration file (service account key or workload identity federation config) used for Google Cloud's Agent Platform authentication. See https://code.claude.com/docs/en/google-vertex-ai#3-configure-gcp-credentials"},"HTTPS_PROXY":{"type":"string","description":"HTTPS proxy URL (recommended over HTTP_PROXY)"},"HTTP_PROXY":{"type":"string","description":"HTTP proxy URL"},"IS_DEMO":{"type":"string","description":"Set to 1 to enable demo mode: hides email and organization name from the header and /status output and skips onboarding. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"MAX_MCP_OUTPUT_TOKENS":{"type":"string","description":"Maximum number of tokens allowed in MCP tool output before truncation (default: 25000). Claude Code displays a warning above 10000 tokens. For tools that declare anthropic/maxResultSizeChars, that character limit replaces this token limit for text content, but image content from those tools is still subject to this limit. See https://code.claude.com/docs/en/mcp"},"MAX_STRUCTURED_OUTPUT_RETRIES":{"type":"string","description":"Number of times to retry when the model's response fails validation against --json-schema in non-interactive (-p) mode (default 5). See https://code.claude.com/docs/en/env-vars"},"MAX_THINKING_TOKENS":{"type":"string","description":"Override the extended thinking token budget; set to 0 to disable thinking on the Anthropic API. On adaptive reasoning models (Opus 4.7+, Opus 4.8, Fable 5) a nonzero budget is ignored unless CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING is set. See https://code.claude.com/docs/en/model-config#extended-thinking"},"MCP_CLIENT_SECRET":{"type":"string","description":"OAuth client secret for MCP servers that require pre-configured credentials (avoids the interactive prompt when adding a server with --client-secret). See https://code.claude.com/docs/en/env-vars"},"MCP_CONNECTION_NONBLOCKING":{"type":"string","description":"Controls whether startup waits for MCP servers to connect before the first query. Non-blocking by default since v2.1.142; set to 0 to restore the blocking 5-second connection wait. See https://code.claude.com/docs/en/env-vars","enum":["0","1"]},"MCP_CONNECT_TIMEOUT_MS":{"type":"string","description":"How long blocking MCP startup waits in milliseconds for the connection batch before snapshotting the tool list (default 5000). Applies when MCP_CONNECTION_NONBLOCKING=0 or for alwaysLoad servers. See https://code.claude.com/docs/en/env-vars"},"MCP_OAUTH_CALLBACK_PORT":{"type":"string","description":"Fixed port for the OAuth redirect callback, as an alternative to --callback-port when adding an MCP server with pre-configured credentials. See https://code.claude.com/docs/en/env-vars"},"MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE":{"type":"string","description":"Maximum number of remote MCP servers (HTTP/SSE) to connect in parallel during startup (default 20). See https://code.claude.com/docs/en/env-vars"},"MCP_SERVER_CONNECTION_BATCH_SIZE":{"type":"string","description":"Maximum number of local MCP servers (stdio) to connect in parallel during startup (default 3). See https://code.claude.com/docs/en/env-vars"},"MCP_TIMEOUT":{"type":"string","description":"Timeout in milliseconds for MCP server startup (default 30000). See https://code.claude.com/docs/en/env-vars"},"MCP_TOOL_TIMEOUT":{"type":"string","description":"Timeout in milliseconds for MCP tool execution (default: 100000000, about 28 hours). A per-server timeout field in .mcp.json overrides this for that server. Values below 1000 are floored to one second. See https://code.claude.com/docs/en/mcp"},"NODE_EXTRA_CA_CERTS":{"type":"string","description":"Path to custom CA certificate file"},"NO_PROXY":{"type":"string","description":"Domains to bypass proxy (space or comma-separated, or '*' for all)"},"OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT":{"type":"string","description":"Standard OpenTelemetry SDK limit on attribute value length. Claude Code caps content-bearing telemetry attributes at the smaller of this and CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH, so the truncation marker stays within the SDK limit. Claude Code reads the OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT and OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT variants the same way, and the smallest set value applies to all signals. Requires Claude Code v2.1.214 or later. See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables"},"OTEL_EXPORTER_OTLP_CERTIFICATE":{"type":"string","description":"Path to the CA certificate for gRPC OTLP mTLS. See https://code.claude.com/docs/en/monitoring-usage#mtls-authentication"},"OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE":{"type":"string","description":"Path to the client certificate for gRPC OTLP mTLS. See https://code.claude.com/docs/en/monitoring-usage#mtls-authentication"},"OTEL_EXPORTER_OTLP_CLIENT_KEY":{"type":"string","description":"Path to the client private key for gRPC OTLP mTLS. See https://code.claude.com/docs/en/monitoring-usage#mtls-authentication"},"OTEL_EXPORTER_OTLP_ENDPOINT":{"type":"string","description":"OTLP exporter endpoint for all signals (e.g. http://localhost:4317). See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables"},"OTEL_EXPORTER_OTLP_HEADERS":{"type":"string","description":"Headers sent with OTLP exporter requests (e.g. Authorization=Bearer token). See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables"},"OTEL_EXPORTER_OTLP_LOGS_CLIENT_CERTIFICATE":{"type":"string","description":"Path to the client certificate for gRPC OTLP mTLS, overriding OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE for logs only. See https://code.claude.com/docs/en/monitoring-usage#mtls-authentication"},"OTEL_EXPORTER_OTLP_LOGS_CLIENT_KEY":{"type":"string","description":"Path to the client private key for gRPC OTLP mTLS, overriding OTEL_EXPORTER_OTLP_CLIENT_KEY for logs only. See https://code.claude.com/docs/en/monitoring-usage#mtls-authentication"},"OTEL_EXPORTER_OTLP_LOGS_ENDPOINT":{"type":"string","description":"OTLP exporter endpoint override for logs. See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables"},"OTEL_EXPORTER_OTLP_LOGS_PROTOCOL":{"type":"string","description":"OTLP protocol override for logs: grpc, http/json, or http/protobuf. See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables","enum":["grpc","http/json","http/protobuf"]},"OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE":{"type":"string","description":"Path to the client certificate for gRPC OTLP mTLS, overriding OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE for metrics only. See https://code.claude.com/docs/en/monitoring-usage#mtls-authentication"},"OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY":{"type":"string","description":"Path to the client private key for gRPC OTLP mTLS, overriding OTEL_EXPORTER_OTLP_CLIENT_KEY for metrics only. See https://code.claude.com/docs/en/monitoring-usage#mtls-authentication"},"OTEL_EXPORTER_OTLP_METRICS_ENDPOINT":{"type":"string","description":"OTLP exporter endpoint override for metrics. See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables"},"OTEL_EXPORTER_OTLP_METRICS_PROTOCOL":{"type":"string","description":"OTLP protocol override for metrics: grpc, http/json, or http/protobuf. See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables","enum":["grpc","http/json","http/protobuf"]},"OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE":{"type":"string","description":"Metrics temporality preference: delta (default) or cumulative. See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables","enum":["delta","cumulative"]},"OTEL_EXPORTER_OTLP_PROTOCOL":{"type":"string","description":"OTLP exporter protocol for all signals: grpc, http/json, or http/protobuf. See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables","enum":["grpc","http/json","http/protobuf"]},"OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE":{"type":"string","description":"Path to the client certificate for gRPC OTLP mTLS, overriding OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE for traces only. See https://code.claude.com/docs/en/monitoring-usage#mtls-authentication"},"OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY":{"type":"string","description":"Path to the client private key for gRPC OTLP mTLS, overriding OTEL_EXPORTER_OTLP_CLIENT_KEY for traces only. See https://code.claude.com/docs/en/monitoring-usage#mtls-authentication"},"OTEL_EXPORTER_OTLP_TRACES_ENDPOINT":{"type":"string","description":"OTLP exporter endpoint override for traces. See https://code.claude.com/docs/en/monitoring-usage#traces-beta"},"OTEL_EXPORTER_OTLP_TRACES_PROTOCOL":{"type":"string","description":"OTLP protocol override for traces: grpc, http/json, or http/protobuf. See https://code.claude.com/docs/en/monitoring-usage#traces-beta","enum":["grpc","http/json","http/protobuf"]},"OTEL_LOGS_EXPORTER":{"type":"string","description":"OpenTelemetry logs exporter(s) as a comma-separated list. Valid values: otlp, console, none. See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables"},"OTEL_LOGS_EXPORT_INTERVAL":{"type":"string","description":"Logs export interval in milliseconds (default 5000). See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables"},"OTEL_LOG_ASSISTANT_RESPONSES":{"type":"string","description":"UNDOCUMENTED. Include assistant response text in the claude_code.assistant_response OpenTelemetry log event (added v2.1.193). When unset, follows OTEL_LOG_USER_PROMPTS; set to 0 to keep prompts-only.","enum":["0","1"]},"OTEL_LOG_RAW_API_BODIES":{"type":"string","description":"Log raw API request/response bodies. Set to 1, or to file:<dir> to write them to a directory. See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables"},"OTEL_LOG_TOOL_CONTENT":{"type":"string","description":"Include full tool input/output content in OpenTelemetry log events (requires tracing; disabled by default). See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables","enum":["0","1"]},"OTEL_LOG_TOOL_DETAILS":{"type":"string","description":"Include tool name and parameters in OpenTelemetry log events (disabled by default). See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables","enum":["0","1"]},"OTEL_LOG_USER_PROMPTS":{"type":"string","description":"Include user prompt text in OpenTelemetry log events (disabled by default). See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables","enum":["0","1"]},"OTEL_METRICS_EXPORTER":{"type":"string","description":"OpenTelemetry metrics exporter(s) as a comma-separated list. Valid values: otlp, prometheus, console, none. See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables"},"OTEL_METRICS_INCLUDE_ACCOUNT_UUID":{"type":"string","description":"Include the user.account_uuid and user.account_id attributes on metrics (default true). See https://code.claude.com/docs/en/monitoring-usage#metrics-cardinality-control","enum":["true","false"]},"OTEL_METRICS_INCLUDE_ENTRYPOINT":{"type":"string","description":"Include the app.entrypoint attribute on metrics (default false). See https://code.claude.com/docs/en/monitoring-usage#metrics-cardinality-control","enum":["true","false"]},"OTEL_METRICS_INCLUDE_RESOURCE_ATTRIBUTES":{"type":"string","description":"Include configured OTEL_RESOURCE_ATTRIBUTES on metric data points (default true). See https://code.claude.com/docs/en/monitoring-usage#metrics-cardinality-control","enum":["true","false"]},"OTEL_METRICS_INCLUDE_SESSION_ID":{"type":"string","description":"Include the session.id attribute on metrics (default true). See https://code.claude.com/docs/en/monitoring-usage#metrics-cardinality-control","enum":["true","false"]},"OTEL_METRICS_INCLUDE_VERSION":{"type":"string","description":"Include the app.version attribute on metrics (default false). See https://code.claude.com/docs/en/monitoring-usage#metrics-cardinality-control","enum":["true","false"]},"OTEL_METRIC_EXPORT_INTERVAL":{"type":"string","description":"Metrics export interval in milliseconds (default 60000). See https://code.claude.com/docs/en/monitoring-usage#common-configuration-variables"},"OTEL_RESOURCE_ATTRIBUTES":{"type":"string","description":"Comma-separated key=value resource attributes attached to all telemetry. See https://code.claude.com/docs/en/monitoring-usage#multi-team-organization-support"},"OTEL_TRACES_EXPORTER":{"type":"string","description":"OpenTelemetry traces exporter(s) as a comma-separated list. Valid values: otlp, console, none. See https://code.claude.com/docs/en/monitoring-usage#traces-beta"},"OTEL_TRACES_EXPORT_INTERVAL":{"type":"string","description":"Traces export interval in milliseconds (default 5000). See https://code.claude.com/docs/en/monitoring-usage#traces-beta"},"SLASH_COMMAND_TOOL_CHAR_BUDGET":{"type":"string","description":"Override the character budget for skill metadata shown to the Skill tool. The budget scales dynamically at 1% of the context window, with a fallback of 8000 characters. Legacy name kept for backwards compatibility. See https://code.claude.com/docs/en/skills#control-who-invokes-a-skill"},"TASK_MAX_OUTPUT_LENGTH":{"type":"string","description":"Maximum number of characters in subagent output before truncation (default 32000, maximum 160000). When truncated, the full output is saved to disk and the path is included in the response. See https://code.claude.com/docs/en/env-vars"},"USE_BUILTIN_RIPGREP":{"type":"string","description":"Use the bundled ripgrep binary instead of system ripgrep","enum":["0","1"]},"VERTEX_REGION_CLAUDE_3_5_HAIKU":{"type":"string","description":"Override the Vertex AI region for Claude 3.5 Haiku (used when CLOUD_ML_REGION=global). See https://code.claude.com/docs/en/env-vars"},"VERTEX_REGION_CLAUDE_3_5_SONNET":{"type":"string","description":"Override the Vertex AI region for Claude 3.5 Sonnet (used when CLOUD_ML_REGION=global). See https://code.claude.com/docs/en/env-vars"},"VERTEX_REGION_CLAUDE_3_7_SONNET":{"type":"string","description":"Override the Vertex AI region for Claude 3.7 Sonnet (used when CLOUD_ML_REGION=global). See https://code.claude.com/docs/en/env-vars"},"VERTEX_REGION_CLAUDE_4_0_OPUS":{"type":"string","description":"Override the Vertex AI region for Claude 4.0 Opus (used when CLOUD_ML_REGION=global). See https://code.claude.com/docs/en/env-vars"},"VERTEX_REGION_CLAUDE_4_0_SONNET":{"type":"string","description":"Override the Vertex AI region for Claude 4.0 Sonnet (used when CLOUD_ML_REGION=global). See https://code.claude.com/docs/en/env-vars"},"VERTEX_REGION_CLAUDE_4_1_OPUS":{"type":"string","description":"Override the Vertex AI region for Claude 4.1 Opus (used when CLOUD_ML_REGION=global). See https://code.claude.com/docs/en/env-vars"},"VERTEX_REGION_CLAUDE_4_5_OPUS":{"type":"string","description":"Override the Vertex AI region for Claude Opus 4.5 (used when CLOUD_ML_REGION=global). See https://code.claude.com/docs/en/env-vars"},"VERTEX_REGION_CLAUDE_4_5_SONNET":{"type":"string","description":"Override the Vertex AI region for Claude Sonnet 4.5 (used when CLOUD_ML_REGION=global). See https://code.claude.com/docs/en/env-vars"},"VERTEX_REGION_CLAUDE_4_6_OPUS":{"type":"string","description":"Override the Vertex AI region for Claude Opus 4.6 (used when CLOUD_ML_REGION=global). See https://code.claude.com/docs/en/env-vars"},"VERTEX_REGION_CLAUDE_4_6_SONNET":{"type":"string","description":"Override the Vertex AI region for Claude Sonnet 4.6 (used when CLOUD_ML_REGION=global). See https://code.claude.com/docs/en/env-vars"},"VERTEX_REGION_CLAUDE_4_7_OPUS":{"type":"string","description":"Override the Vertex AI region for Claude Opus 4.7 (used when CLOUD_ML_REGION=global). See https://code.claude.com/docs/en/env-vars"},"VERTEX_REGION_CLAUDE_4_8_OPUS":{"type":"string","description":"Override the Vertex AI region for Claude Opus 4.8 (used when CLOUD_ML_REGION=global). See https://code.claude.com/docs/en/env-vars"},"VERTEX_REGION_CLAUDE_5_OPUS":{"type":"string","description":"Override region for Claude Opus 5 when using Google Cloud's Agent Platform (formerly Vertex AI). Added in v2.1.219. See https://code.claude.com/docs/en/google-vertex-ai"},"VERTEX_REGION_CLAUDE_5_SONNET":{"type":"string","description":"Override region for Claude Sonnet 5 when using Google Cloud's Agent Platform (formerly Vertex AI). Added in v2.1.197. See https://code.claude.com/docs/en/google-vertex-ai"},"VERTEX_REGION_CLAUDE_FABLE_5":{"type":"string","description":"Override the Vertex AI region for Claude Fable 5 (used when CLOUD_ML_REGION=global). See https://code.claude.com/docs/en/env-vars"},"VERTEX_REGION_CLAUDE_HAIKU_4_5":{"type":"string","description":"Override the Vertex AI region for Claude Haiku 4.5 (used when CLOUD_ML_REGION=global). See https://code.claude.com/docs/en/env-vars"}},"propertyNames":{"pattern":"^[A-Z_][A-Z0-9_]*$"},"additionalProperties":{"type":"string","description":"Environment variable value"}},"attribution":{"type":"object","description":"Customize attribution for git commits and pull requests. See https://code.claude.com/docs/en/settings#attribution-settings","additionalProperties":false,"properties":{"commit":{"type":"string","description":"Attribution for git commits, including any trailers. Empty string hides commit attribution"},"pr":{"type":"string","description":"Attribution for pull request descriptions. Empty string hides pull request attribution"},"sessionUrl":{"type":"boolean","description":"Whether to append the claude.ai session link as a Claude-Session trailer on commits and a link in pull request descriptions when running from a web or Remote Control session. Defaults to true; set to false to omit the link. See https://code.claude.com/docs/en/settings#attribution-settings","default":true}}},"includeGitInstructions":{"type":"boolean","description":"Include built-in git commit and PR workflow instructions in Claude's system prompt. Also configurable via CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS environment variable (set to 1 to disable). See https://code.claude.com/docs/en/settings#available-settings","default":true},"includeCoAuthoredBy":{"type":"boolean","description":"DEPRECATED. Use 'attribution' instead. Whether to include the co-authored-by Claude byline in git commits and pull requests (default: true)","default":true},"plansDirectory":{"type":"string","description":"Customize where plan files are stored. Path is relative to project root (default: ~/.claude/plans)","default":"~/.claude/plans","examples":["./plans"]},"respectGitignore":{"type":"boolean","description":"Control whether the @ file picker respects .gitignore patterns. When true (default), files matching .gitignore patterns are excluded from suggestions","default":true},"permissions":{"type":"object","properties":{"allow":{"type":"array","items":{"$ref":"#/$defs/permissionRule"},"description":"List of permission rules for allowed operations","uniqueItems":true},"deny":{"type":"array","items":{"$ref":"#/$defs/permissionRule"},"description":"List of permission rules for denied operations","uniqueItems":true},"ask":{"type":"array","items":{"$ref":"#/$defs/permissionRule"},"description":"List of permission rules that should always prompt for confirmation","uniqueItems":true},"defaultMode":{"type":"string","enum":["acceptEdits","bypassPermissions","default","delegate","dontAsk","plan","auto","manual"],"description":"Default permission mode.\\n\\"default\\": prompts on first use.\\nUNDOCUMENTED. \\"manual\\": accepted alias for \\"default\\" (the CLI/VS Code/JetBrains UI now labels this mode \\"Manual\\" as of v2.1.200; permission-modes.md has not yet been updated to mention it).\\n\\"acceptEdits\\": auto-accepts file edits.\\n\\"plan\\": read-only, no modifications.\\nUNDOCUMENTED. \\"delegate\\": coordination-only for agent team leads (agent teams are experimental; enable via CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS).\\n\\"dontAsk\\": auto-denies unless pre-approved via permissions.\\n\\"bypassPermissions\\": skips all prompts (use only in isolated environments).\\n\\"auto\\": auto-approves tool calls with background safety checks that verify actions align with your request.\\nSee https://code.claude.com/docs/en/permissions"},"disableBypassPermissionsMode":{"type":"string","enum":["disable"],"description":"Disable the ability to bypass permission prompts"},"disableAutoMode":{"type":"string","enum":["disable"],"description":"Set to \\"disable\\" to prevent auto mode from being activated. Removes \`auto\` from the Shift+Tab cycle and rejects \`--permission-mode auto\` at startup. Most useful in managed settings where users cannot override it. See https://code.claude.com/docs/en/permissions"},"additionalDirectories":{"type":"array","items":{"type":"string","minLength":1},"description":"Additional directories to include in the permission scope","examples":[["//Users/alice/Documents","~/projects"]],"uniqueItems":true}},"additionalProperties":false,"description":"Tool usage permissions configuration.\\nSee https://code.claude.com/docs/en/permissions and https://code.claude.com/docs/en/settings#permission-settings\\nSee https://code.claude.com/docs/en/tools-reference for full list of tools available to Claude.","examples":[{"allow":["Bash(git add:*)"],"ask":["Bash(gh pr create:*)","Bash(git commit:*)"],"deny":["Read(*.env)","Bash(rm:*)","Bash(curl:*)"],"defaultMode":"default"}]},"language":{"type":"string","description":"Configure Claude's preferred response language (e.g., \\"japanese\\", \\"spanish\\", \\"french\\"). Claude will respond in this language by default. Also sets the voice dictation language and terminal tab session title generation. See https://code.claude.com/docs/en/settings#available-settings","examples":["japanese","spanish","french"]},"model":{"type":"string","description":"Override the default model used by Claude Code. For finer control, use environment variables: ANTHROPIC_MODEL (runtime override), ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, ANTHROPIC_DEFAULT_HAIKU_MODEL (per-class pinning), CLAUDE_CODE_SUBAGENT_MODEL (subagent model). See https://code.claude.com/docs/en/model-config"},"availableModels":{"type":"array","items":{"type":"string"},"description":"Restrict which models users can select. When defined at multiple settings levels (user, project, etc.), arrays are merged and deduplicated. See https://code.claude.com/docs/en/model-config#restrict-model-selection","examples":[["sonnet","haiku"]]},"modelOverrides":{"type":"object","additionalProperties":{"type":"string"},"description":"Map Anthropic model IDs to provider-specific model IDs such as Bedrock inference profile ARNs, Vertex AI version names, or Foundry deployment names. Each model picker entry uses its mapped value when calling the provider API. Unknown keys are ignored. See https://code.claude.com/docs/en/model-config#override-model-ids-per-version","examples":[{"claude-opus-4-6":"arn:aws:bedrock:us-east-2:123456789012:application-inference-profile/opus-prod"}]},"effortLevel":{"type":"string","enum":["low","medium","high","xhigh"],"description":"Persist adaptive reasoning effort across sessions. Set to low, medium, high, or xhigh; max and ultracode are session-only and are not accepted in the settings file (use the CLAUDE_CODE_EFFORT_LEVEL environment variable or /effort for a session-only max). Effort is supported on Fable 5, Opus 4.8, Opus 4.7, Opus 4.6, and Sonnet 4.6, with xhigh sitting between high and max (added in v2.1.111). Defaults: Fable 5 and Opus 4.8 default to high; Opus 4.6 and Sonnet 4.6 default to high on all plans (Pro/Max raised from medium to high in v2.1.117); Opus 4.7 defaults to xhigh. Use /effort auto to reset to model default. Also configurable via CLAUDE_CODE_EFFORT_LEVEL environment variable. See https://code.claude.com/docs/en/model-config#adjust-effort-level"},"fastMode":{"type":"boolean","description":"Enable fast mode, which uses Claude Opus 5 by default (since v2.1.219) for faster output at higher per-token cost without downgrading to a smaller model. Requires extra usage enabled. Toggle with the /fast command. Supported on Opus 5 and Opus 4.8; fast mode for Opus 4.7 was deprecated on June 25, 2026 and removed on July 24, 2026. Before v2.1.219 fast mode defaulted to Opus 4.8 (v2.1.154 through v2.1.218) and to Opus 4.7 (v2.1.142 through v2.1.153). See https://code.claude.com/docs/en/fast-mode","default":false},"fastModePerSessionOptIn":{"type":"boolean","description":"Require per-session opt-in for fast mode. When true, fast mode does not persist across sessions and users must enable it with /fast each session. Useful for controlling costs. See https://code.claude.com/docs/en/fast-mode","default":false},"feedbackSurveyRate":{"type":"number","minimum":0,"maximum":1,"description":"Probability (0–1) that the session quality survey appears when eligible. A value of 0.05 means 5% of eligible sessions. See https://code.claude.com/docs/en/settings#available-settings","examples":[0.05]},"enableAllProjectMcpServers":{"type":"boolean","description":"Whether to automatically approve all MCP servers in the project. See https://code.claude.com/docs/en/mcp","examples":[true]},"enabledMcpjsonServers":{"type":"array","items":{"type":"string","minLength":1},"description":"List of approved MCP servers from .mcp.json. See https://code.claude.com/docs/en/mcp","examples":[["memory","github"]]},"disabledMcpjsonServers":{"type":"array","items":{"type":"string","minLength":1},"description":"List of rejected MCP servers from .mcp.json. See https://code.claude.com/docs/en/mcp","examples":[["filesystem"]]},"allowedMcpServers":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"serverName":{"type":"string","pattern":"^[a-zA-Z0-9_-]+$","description":"Name of the MCP server that users are allowed to configure"}},"required":["serverName"],"additionalProperties":false},{"type":"object","properties":{"serverCommand":{"type":"array","items":{"type":"string"},"description":"Exact command and arguments used to start stdio servers"}},"required":["serverCommand"],"additionalProperties":false},{"type":"object","properties":{"serverUrl":{"type":"string","description":"URL pattern for remote servers, supports wildcards (e.g., https://*.example.com/*)"}},"required":["serverUrl"],"additionalProperties":false}]},"description":"Enterprise allowlist of MCP servers that can be used. Applies to all scopes including enterprise servers from managed-mcp.json. If undefined, all servers are allowed. If empty array, no servers are allowed. Denylist takes precedence - if a server is on both lists, it is denied. See https://code.claude.com/docs/en/mcp#restriction-options"},"deniedMcpServers":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"serverName":{"type":"string","pattern":"^[a-zA-Z0-9_-]+$","description":"Name of the MCP server that is explicitly blocked"}},"required":["serverName"],"additionalProperties":false},{"type":"object","properties":{"serverCommand":{"type":"array","items":{"type":"string"},"description":"Exact command and arguments used to start stdio servers"}},"required":["serverCommand"],"additionalProperties":false},{"type":"object","properties":{"serverUrl":{"type":"string","description":"URL pattern for remote servers, supports wildcards (e.g., https://*.example.com/*)"}},"required":["serverUrl"],"additionalProperties":false}]},"description":"Enterprise denylist of MCP servers that are explicitly blocked. If a server is on the denylist, it will be blocked across all scopes including enterprise. Denylist takes precedence over allowlist - if a server is on both lists, it is denied. See https://code.claude.com/docs/en/mcp#restriction-options"},"httpHookAllowedEnvVars":{"type":"array","items":{"type":"string","minLength":1},"description":"Allowlist of environment variable names HTTP hooks may interpolate into headers. When set, each hook's effective allowedEnvVars is the intersection with this list. Undefined = no restriction. Arrays merge across settings sources. See https://code.claude.com/docs/en/settings#hook-configuration","examples":[["MY_TOKEN","HOOK_SECRET"]]},"hooks":{"type":"object","additionalProperties":false,"description":"Lifecycle event hooks that run at configurable points during Claude Code operation (tool use, session start/end, notifications, prompt submit, message display, and more), not just before/after tool executions. See https://code.claude.com/docs/en/hooks","examples":[{"PostToolUse":[{"matcher":"Edit|Write","hooks":[{"type":"command","command":"prettier --write","timeout":5}]}]}],"properties":{"PreToolUse":{"type":"array","description":"Hooks that run before tool calls","items":{"$ref":"#/$defs/hookMatcher"}},"PostToolUse":{"type":"array","description":"Hooks that run after tool completion","items":{"$ref":"#/$defs/hookMatcher"}},"PostToolUseFailure":{"type":"array","description":"Hooks that run after a tool fails","items":{"$ref":"#/$defs/hookMatcher"}},"PermissionRequest":{"type":"array","description":"Hooks that run when a permission dialog appears","items":{"$ref":"#/$defs/hookMatcher"}},"Notification":{"type":"array","description":"Hooks that trigger on notifications","items":{"$ref":"#/$defs/hookMatcher"}},"UserPromptSubmit":{"type":"array","description":"Hooks that run when a user submits a prompt","items":{"$ref":"#/$defs/hookMatcher"}},"Stop":{"type":"array","description":"Hooks that run when agents finish responding. Does not run on user interrupt","items":{"$ref":"#/$defs/hookMatcher"}},"StopFailure":{"type":"array","description":"Hooks that run when a turn ends due to an API error (e.g., rate_limit, authentication_failed, billing_error, invalid_request, server_error, max_output_tokens, unknown). Matcher can scope to specific error types. Hook output and exit code are ignored. See https://code.claude.com/docs/en/hooks","items":{"$ref":"#/$defs/hookMatcher"}},"SubagentStart":{"type":"array","description":"Hooks that run when a subagent is spawned","items":{"$ref":"#/$defs/hookMatcher"}},"SubagentStop":{"type":"array","description":"Hooks that run when subagents finish responding","items":{"$ref":"#/$defs/hookMatcher"}},"PreCompact":{"type":"array","description":"Hooks that run before the context is compacted","items":{"$ref":"#/$defs/hookMatcher"}},"PostCompact":{"type":"array","description":"Hooks that run after the context is compacted. See https://code.claude.com/docs/en/hooks","items":{"$ref":"#/$defs/hookMatcher"}},"Elicitation":{"type":"array","description":"Hooks that run when an MCP server requests user input during a tool call. See https://code.claude.com/docs/en/hooks","items":{"$ref":"#/$defs/hookMatcher"}},"ElicitationResult":{"type":"array","description":"Hooks that run after a user responds to an MCP elicitation, before the response is sent back to the server. See https://code.claude.com/docs/en/hooks","items":{"$ref":"#/$defs/hookMatcher"}},"TeammateIdle":{"type":"array","description":"Hooks that run when an agent team teammate is about to go idle. Exit code 2 sends feedback and keeps the teammate working. Does not support matchers. Agent teams are experimental. See https://code.claude.com/docs/en/hooks#teammateidle","items":{"$ref":"#/$defs/hookMatcher"}},"TaskCompleted":{"type":"array","description":"Hooks that run when a task is being marked as completed. Exit code 2 prevents completion and sends feedback. Does not support matchers. See https://code.claude.com/docs/en/hooks#taskcompleted","items":{"$ref":"#/$defs/hookMatcher"}},"Setup":{"type":"array","description":"UNDOCUMENTED. Hooks that run during repository initialization (--init, --init-only) or maintenance (--maintenance)","items":{"$ref":"#/$defs/hookMatcher"}},"InstructionsLoaded":{"type":"array","description":"Hooks that run when a CLAUDE.md or .claude/rules/*.md file is loaded into context. Fires at session start and when files are lazily loaded (e.g., nested traversal, path glob match). No decision control; used for audit logging and observability. Does not support matchers. See https://code.claude.com/docs/en/hooks#instructionsloaded","items":{"$ref":"#/$defs/hookMatcher"}},"CwdChanged":{"type":"array","description":"Hooks that run when the working directory changes. Provides cwd (new directory) and previous_cwd. Matchers are ignored; fires on every directory change. See https://code.claude.com/docs/en/hooks#cwdchanged","items":{"$ref":"#/$defs/hookMatcher"}},"FileChanged":{"type":"array","description":"Hooks that run when a watched file is created, modified, or deleted. Supports filename matchers. Provides file_path and file_event_type (created, modified, deleted). See https://code.claude.com/docs/en/hooks#filechanged","items":{"$ref":"#/$defs/hookMatcher"}},"ConfigChange":{"type":"array","description":"Hooks that run when settings, managed settings, or skill files change during a session. Supports matchers: user_settings, project_settings, local_settings, policy_settings, skills. Command handlers only. Exit code 2 blocks the change (except policy_settings which is audit-only). See https://code.claude.com/docs/en/hooks#configchange","items":{"$ref":"#/$defs/hookMatcher"}},"WorktreeCreate":{"type":"array","description":"Hooks that run when a worktree is created via --worktree or isolation: \\"worktree\\" in subagents. Command handlers only, no matchers. Hook must print absolute path to created worktree on stdout; non-zero exit fails creation. See https://code.claude.com/docs/en/hooks#worktreecreate","items":{"$ref":"#/$defs/hookMatcher"}},"WorktreeRemove":{"type":"array","description":"Hooks that run when a worktree is being removed at session exit or when a subagent finishes. Command handlers only, no matchers. Used for cleanup tasks; cannot block removal. See https://code.claude.com/docs/en/hooks#worktreeremove","items":{"$ref":"#/$defs/hookMatcher"}},"SessionStart":{"type":"array","description":"Hooks that run when a new session starts","items":{"$ref":"#/$defs/hookMatcher"}},"SessionEnd":{"type":"array","description":"Hooks that run when a session ends","items":{"$ref":"#/$defs/hookMatcher"}},"PostToolBatch":{"type":"array","description":"Hooks that run after a full batch of parallel tool calls resolves, before the next model call. Exit code 2 blocks the agentic loop. Does not support matchers. See https://code.claude.com/docs/en/hooks","items":{"$ref":"#/$defs/hookMatcher"}},"TaskCreated":{"type":"array","description":"Hooks that run when a task is being created via TaskCreate. Exit code 2 rolls back task creation. Does not support matchers. See https://code.claude.com/docs/en/hooks#taskcreated","items":{"$ref":"#/$defs/hookMatcher"}},"PermissionDenied":{"type":"array","description":"Hooks that run when a tool call is denied by the auto mode classifier. Supports matchers on tool name. See https://code.claude.com/docs/en/hooks","items":{"$ref":"#/$defs/hookMatcher"}},"UserPromptExpansion":{"type":"array","description":"Hooks that run when a user-typed command expands into a prompt, before it reaches Claude. Exit code 2 blocks the expansion. Supports matchers on command name. See https://code.claude.com/docs/en/hooks","items":{"$ref":"#/$defs/hookMatcher"}},"MessageDisplay":{"type":"array","description":"Hooks that run while assistant message text is displayed","items":{"$ref":"#/$defs/hookMatcher"}},"DirectoryAdded":{"type":"array","description":"UNDOCUMENTED. Hooks that run after /add-dir or the SDK register_repo_root control request registers a new working directory mid-session (added v2.1.219)","items":{"$ref":"#/$defs/hookMatcher"}}}},"disableAllHooks":{"type":"boolean","description":"Disable all hooks and statusLine execution. When true in managed settings, user and project-level disableAllHooks cannot override it. See https://code.claude.com/docs/en/hooks#disable-or-remove-hooks"},"allowedChannelPlugins":{"type":"array","items":{"type":"object","additionalProperties":false,"properties":{"marketplace":{"type":"string","description":"Name of the marketplace the channel plugin is installed from"},"plugin":{"type":"string","description":"Name of the channel plugin allowed to run"}},"required":["marketplace","plugin"]},"description":"(Managed settings only) Allowlist of channel plugins that may run, each identified by its marketplace and plugin name. When set, only the listed plugins can push inbound channel messages while channelsEnabled is true. Replaces the default Anthropic allowlist when set; undefined falls back to the default and an empty array blocks all channel plugins. Requires channelsEnabled: true. See https://code.claude.com/docs/en/channels#restrict-which-channel-plugins-can-run"},"allowedHttpHookUrls":{"type":"array","items":{"type":"string","minLength":1},"description":"Allowlist of URL patterns that HTTP hooks may target. Supports * as a wildcard. When set, hooks with non-matching URLs are blocked. Undefined = no restriction, empty array = block all HTTP hooks. Arrays merge across settings sources. See https://code.claude.com/docs/en/settings#hook-configuration","examples":[["https://hooks.example.com/*","http://localhost:*"]]},"allowManagedHooksOnly":{"type":"boolean","description":"(Managed settings only) Prevent loading of user, project, and plugin hooks. Only allows managed hooks and SDK hooks. See https://code.claude.com/docs/en/settings#hook-configuration"},"allowManagedPermissionRulesOnly":{"type":"boolean","description":"(Managed settings only) Prevent user and project settings from defining allow, ask, or deny permission rules. Only rules in managed settings apply. See https://code.claude.com/docs/en/settings#permission-settings"},"statusLine":{"type":"object","properties":{"type":{"type":"string","description":"The type of status line handler; must be set to \\"command\\" to run a custom shell script that receives JSON session data via stdin.","const":"command"},"command":{"type":"string","description":"A shell command or path to a script that displays session information (context usage, costs, git status, etc.) by reading JSON data from stdin and writing output to stdout. See https://code.claude.com/docs/en/statusline"},"padding":{"type":"number","description":"Optional number of extra horizontal spacing characters added to the status line content; defaults to 0."},"refreshInterval":{"type":"integer","minimum":1,"description":"Re-run the status line command every N seconds in addition to event-driven updates. Leave unset to run only on events. Useful for time-based data like clocks, or when background subagents change git state while the main session is idle. See https://code.claude.com/docs/en/statusline"},"hideVimModeIndicator":{"type":"boolean","description":"Set to true when your status line script renders the vim mode indicator itself, to suppress the built-in vim mode display. See https://code.claude.com/docs/en/statusline#manually-configure-a-status-line"}},"required":["type","command"],"additionalProperties":false,"description":"Custom status line display configuration. See https://code.claude.com/docs/en/statusline","examples":[{"type":"command","command":"~/.claude/statusline.sh"}]},"fileSuggestion":{"type":"object","properties":{"type":{"type":"string","description":"The type of file suggestion handler; must be set to \\"command\\" to execute a custom shell script that generates file suggestions for the @ file picker.","const":"command"},"command":{"type":"string","description":"Shell command to execute for file suggestions"}},"required":["type","command"],"additionalProperties":false,"description":"Configure a custom script for @ file autocomplete. See https://code.claude.com/docs/en/settings#file-suggestion-settings","examples":[{"type":"command","command":"~/.claude/file-suggestion.sh"}]},"enabledPlugins":{"type":"object","additionalProperties":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"boolean"},{"not":{}}]},"description":"Enabled plugins using plugin-id@marketplace-id format. Example: { \\"formatter@anthropic-tools\\": true }. See https://code.claude.com/docs/en/plugins"},"extraKnownMarketplaces":{"type":"object","additionalProperties":{"type":"object","properties":{"source":{"anyOf":[{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"url"},"url":{"type":"string","format":"uri","description":"Direct URL to marketplace.json file"}},"required":["source","url"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"hostPattern"},"hostPattern":{"type":"string","description":"Git host pattern to trust for repositories in source specifications"}},"required":["source","hostPattern"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"github"},"repo":{"type":"string","description":"GitHub repository in owner/repo format"},"ref":{"type":"string","description":"Git branch or tag to use (e.g., \\"main\\", \\"v1.0.0\\"). Defaults to repository default branch."},"path":{"type":"string","description":"Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"},"skipLfs":{"type":"boolean","description":"Skip Git LFS downloads when Claude Code clones or updates the marketplace repository. LFS pointer files remain as pointers instead of downloading their content. Use this when the repository contains large LFS objects unrelated to plugin content. Requires Claude Code v2.1.153 or later"}},"required":["source","repo"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"git"},"url":{"type":"string","pattern":"\\\\.git$","description":"Full git repository URL"},"ref":{"type":"string","description":"Git branch or tag to use (e.g., \\"main\\", \\"v1.0.0\\"). Defaults to repository default branch."},"path":{"type":"string","description":"Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"},"skipLfs":{"type":"boolean","description":"Skip Git LFS downloads when Claude Code clones or updates the marketplace repository. LFS pointer files remain as pointers instead of downloading their content. Use this when the repository contains large LFS objects unrelated to plugin content. Requires Claude Code v2.1.153 or later"}},"required":["source","url"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"npm"},"package":{"type":"string","description":"NPM package containing marketplace.json"}},"required":["source","package"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"file"},"path":{"type":"string","description":"Local file path to marketplace.json"}},"required":["source","path"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"directory"},"path":{"type":"string","description":"Local directory containing .claude-plugin/marketplace.json"}},"required":["source","path"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"settings"},"name":{"type":"string","description":"Name of the inline marketplace"},"plugins":{"type":"array","description":"Plugins declared inline. Each must reference an external source such as GitHub or npm. You still need to enable each plugin separately in enabledPlugins","items":{"type":"object","properties":{"name":{"type":"string","description":"Plugin name"},"source":{"description":"External source the plugin is fetched from. Inline plugins must reference external sources such as GitHub or npm, not relative paths","anyOf":[{"type":"object","properties":{"source":{"type":"string","description":"Identifies the plugin source type","const":"github"},"repo":{"type":"string","description":"GitHub repository in owner/repo format"},"ref":{"type":"string","description":"Git branch or tag"},"sha":{"type":"string","description":"Exact commit SHA to pin the plugin to"}},"required":["source","repo"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the plugin source type","const":"url"},"url":{"type":"string","description":"Git URL source"},"ref":{"type":"string","description":"Git branch or tag"},"sha":{"type":"string","description":"Exact commit SHA to pin the plugin to"}},"required":["source","url"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the plugin source type","const":"git-subdir"},"url":{"type":"string","description":"Git repository URL"},"path":{"type":"string","description":"Subdirectory within the git repo. Clones sparsely to minimize bandwidth for monorepos"},"ref":{"type":"string","description":"Git branch or tag"},"sha":{"type":"string","description":"Exact commit SHA to pin the plugin to"}},"required":["source","url","path"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the plugin source type","const":"npm"},"package":{"type":"string","description":"npm package name (supports scoped packages)"},"version":{"type":"string","description":"Package version"},"registry":{"type":"string","description":"npm registry URL"}},"required":["source","package"],"additionalProperties":false}]}},"required":["name","source"],"additionalProperties":false}}},"required":["source","name","plugins"],"additionalProperties":false}],"description":"Where to fetch the marketplace from"},"installLocation":{"type":"string","description":"Local cache path where marketplace manifest is stored (auto-generated if not provided)"},"autoUpdate":{"type":"boolean","description":"Whether to automatically update this marketplace on Claude Code startup. Written automatically by Claude Code when you toggle auto-update for a marketplace"},"lastUpdated":{"type":"string","description":"ISO 8601 timestamp of the last marketplace refresh. Written automatically by Claude Code"}},"required":["source"],"additionalProperties":false},"description":"Additional marketplaces to make available for this repository. Typically used in repository .claude/settings.json to ensure team members have required plugin sources. See https://code.claude.com/docs/en/plugin-marketplaces"},"strictKnownMarketplaces":{"type":"array","description":"(Managed settings only) Allowlist of plugin marketplaces users can add. Undefined = no restrictions, empty array = lockdown. Uses exact matching for source specifications. See https://code.claude.com/docs/en/plugin-marketplaces#managed-marketplace-restrictions","items":{"anyOf":[{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"hostPattern"},"hostPattern":{"type":"string","description":"Git host pattern to trust for repositories in source specifications"}},"required":["source","hostPattern"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"github"},"repo":{"type":"string","description":"GitHub repository in owner/repo format"},"ref":{"type":"string","description":"Git branch, tag, or SHA"},"path":{"type":"string","description":"Subdirectory path"}},"required":["source","repo"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"git"},"url":{"type":"string","description":"Full git repository URL"},"ref":{"type":"string","description":"Git branch, tag, or SHA"},"path":{"type":"string","description":"Subdirectory path"}},"required":["source","url"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"url"},"url":{"type":"string","format":"uri","description":"Direct URL to marketplace.json"},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"HTTP headers for authenticated access"}},"required":["source","url"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"npm"},"package":{"type":"string","description":"NPM package name (supports scoped packages)"}},"required":["source","package"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"file"},"path":{"type":"string","description":"Absolute path to marketplace.json file"}},"required":["source","path"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"directory"},"path":{"type":"string","description":"Absolute path to directory containing .claude-plugin/marketplace.json"}},"required":["source","path"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"pathPattern"},"pathPattern":{"type":"string","description":"Regex pattern to match file or directory paths for marketplace sources"}},"required":["source","pathPattern"],"additionalProperties":false}]},"examples":[[{"source":"github","repo":"acme-corp/approved-plugins"},{"source":"npm","package":"@acme-corp/compliance-plugins"}]]},"skippedMarketplaces":{"type":"array","items":{"type":"string","minLength":1},"description":"List of marketplace names the user has chosen not to install when prompted. See https://code.claude.com/docs/en/discover-plugins"},"skippedPlugins":{"type":"array","items":{"type":"string","minLength":1},"description":"List of plugin IDs (plugin@marketplace format) the user has chosen not to install when prompted. See https://code.claude.com/docs/en/discover-plugins"},"forceLoginMethod":{"type":"string","enum":["claudeai","console","gateway"],"description":"Use \\"claudeai\\" to restrict login to Claude.ai accounts, \\"console\\" to restrict login to Claude Console accounts, or \\"gateway\\" to restrict login to a cloud gateway. On Claude Code v2.1.212 or later, every first-party login path enforces the restriction, including the VS Code extension, the Agent SDK, \`claude setup-token\`, and /install-github-app; before v2.1.212, only terminal logins enforced it. See https://code.claude.com/docs/en/authentication#restrict-login-to-your-organization","examples":["claudeai"]},"forceLoginOrgUUID":{"oneOf":[{"type":"string","minLength":1},{"type":"array","items":{"type":"string","minLength":1}}],"description":"Organization UUID to use for OAuth login, or an array of UUIDs to allow several organizations. An empty array fails closed and blocks every login. See https://code.claude.com/docs/en/authentication#restrict-login-to-your-organization","examples":["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"]},"otelHeadersHelper":{"type":"string","description":"Path to an executable, or a shell command line with arguments, that outputs OpenTelemetry headers as a JSON object. Runs at startup and re-runs on the interval set by CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS. Requires CLAUDE_CODE_ENABLE_TELEMETRY=1. See https://code.claude.com/docs/en/monitoring-usage#dynamic-headers","minLength":1},"outputStyle":{"type":"string","description":"Controls the output style for assistant responses. Built-in styles: default, Proactive, Explanatory, Learning. Custom styles can be added in ~/.claude/output-styles/ or .claude/output-styles/. See https://code.claude.com/docs/en/output-styles","examples":["default","Proactive","Explanatory","Learning"],"minLength":1},"skipWebFetchPreflight":{"type":"boolean","description":"Skip the WebFetch blocklist check for enterprise environments with restrictive security policies. See https://code.claude.com/docs/en/settings#available-settings"},"sandbox":{"type":"object","description":"Sandbox execution configuration. See https://code.claude.com/docs/en/sandboxing","properties":{"network":{"type":"object","description":"Configures network isolation settings for the sandboxed bash environment, including domain restrictions, Unix socket access, and custom proxy configuration.","properties":{"allowUnixSockets":{"type":"array","items":{"type":"string"},"description":"Allow Unix domain sockets for local IPC (SSH agent, Docker, etc.). Provide an array of specific paths. Defaults to blocking if not specified. See https://code.claude.com/docs/en/sandboxing#network-isolation"},"allowLocalBinding":{"type":"boolean","description":"Allow binding to local network addresses (e.g., localhost ports). Defaults to false if not specified. See https://code.claude.com/docs/en/sandboxing#network-isolation"},"httpProxyPort":{"type":"integer","minimum":1,"maximum":65535,"description":"HTTP proxy port to use for network filtering. If not specified, a proxy server will be started automatically. See https://code.claude.com/docs/en/sandboxing#custom-proxy-configuration"},"socksProxyPort":{"type":"integer","minimum":1,"maximum":65535,"description":"SOCKS proxy port to use for network filtering. If not specified, a proxy server will be started automatically. See https://code.claude.com/docs/en/sandboxing#custom-proxy-configuration"},"allowAllUnixSockets":{"type":"boolean","description":"Allow all Unix domain socket connections. If true, this overrides allowUnixSockets. See https://code.claude.com/docs/en/sandboxing#network-isolation"},"allowedDomains":{"type":"array","items":{"type":"string","minLength":1},"description":"Allowlist of network domains for sandboxed commands. Supports wildcard patterns like *.example.com. See https://code.claude.com/docs/en/sandboxing#network-isolation"},"deniedDomains":{"type":"array","items":{"type":"string","minLength":1},"description":"Blocklist of network domains for sandboxed commands. Blocks specific domains even when a broader allowedDomains wildcard would otherwise permit them. Supports wildcard patterns like *.example.com. See https://code.claude.com/docs/en/sandboxing#network-isolation"},"allowManagedDomainsOnly":{"type":"boolean","description":"(Managed settings only) Only allowedDomains and WebFetch(domain:...) allow rules from managed settings are respected. User, project, local, and flag settings domains are ignored. Denied domains are still respected from all sources. Non-allowed domains are automatically blocked without user prompts. See https://code.claude.com/docs/en/sandboxing#network-isolation"},"allowMachLookup":{"type":"array","items":{"type":"string","minLength":1},"description":"macOS only. Additional XPC/Mach service names the sandbox may look up. Supports a single trailing * for prefix matching. Needed for tools that communicate via XPC such as the iOS Simulator or Playwright. See https://code.claude.com/docs/en/sandboxing#network-isolation","examples":[["com.apple.coresimulator.*"]]},"tlsTerminate":{"type":"object","description":"Experimental. Terminate TLS inside the sandbox proxy so it can read the contents of HTTPS requests. Required for mask credential substitution. Set {} to generate an ephemeral certificate authority for the session, or set caCertPath and caKeyPath to use your own. Only honored from user, managed, or CLI --settings settings, not from .claude/settings.json or .claude/settings.local.json. Requires Claude Code v2.1.199 or later. See https://code.claude.com/docs/en/sandboxing#protect-credentials","properties":{"caCertPath":{"type":"string","description":"Path to your own certificate authority certificate"},"caKeyPath":{"type":"string","description":"Path to your own certificate authority private key"}},"additionalProperties":false},"strictAllowlist":{"type":"boolean","description":"UNDOCUMENTED. Deny non-allowlisted hosts for sandboxed commands without prompting (added v2.1.219). See https://code.claude.com/docs/en/sandboxing#network-isolation"}},"additionalProperties":false},"ignoreViolations":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"},"description":"List of filesystem paths to ignore sandbox violations for when this command pattern matches"},"description":"Map of command patterns to filesystem paths to ignore violations for. Use \\"*\\" to match all commands"},"excludedCommands":{"type":"array","items":{"type":"string"},"description":"Commands that should never run in the sandbox (e.g., [\\"git\\", \\"docker\\"]). See https://code.claude.com/docs/en/sandboxing#configure-sandboxing"},"autoAllowBashIfSandboxed":{"type":"boolean","description":"Automatically allow bash commands without prompting when they run in the sandbox. Only applies to commands that will run sandboxed. See https://code.claude.com/docs/en/sandboxing#sandbox-modes","default":true},"enableWeakerNetworkIsolation":{"type":"boolean","description":"macOS only. Allow access to the system TLS trust service (com.apple.trustd.agent) in the sandbox. Required for Go-based tools like gh, gcloud, and terraform to verify TLS certificates when using httpProxyPort with a MITM proxy and custom CA. Reduces security by opening a potential data exfiltration path. Default: false. See https://code.claude.com/docs/en/sandboxing","default":false},"enableWeakerNestedSandbox":{"type":"boolean","description":"Enable weaker sandbox mode for unprivileged docker environments where --proc mounting fails. This significantly reduces the strength of the sandbox and should only be used when this risk is acceptable. Default: false (secure). See https://code.claude.com/docs/en/sandboxing#limitations"},"allowUnsandboxedCommands":{"type":"boolean","description":"Allow commands to run outside the sandbox via the dangerouslyDisableSandbox parameter. When false, the dangerouslyDisableSandbox parameter is completely ignored and all commands must run sandboxed. Default: true. See https://code.claude.com/docs/en/sandboxing#limitations"},"enabled":{"type":"boolean","description":"Enable sandboxed bash. See https://code.claude.com/docs/en/sandboxing#enable-sandboxing"},"filesystem":{"type":"object","description":"Filesystem access control for sandboxed commands. See https://code.claude.com/docs/en/sandboxing#filesystem-isolation","properties":{"allowWrite":{"type":"array","items":{"type":"string","minLength":1},"description":"Paths where subprocesses are allowed to write. Supports prefixes: // (absolute), ~/ (home directory), / (relative to settings file), ./ or no prefix (relative path). See https://code.claude.com/docs/en/sandboxing#granting-subprocess-write-access-to-specific-paths"},"denyWrite":{"type":"array","items":{"type":"string","minLength":1},"description":"Paths where subprocesses are explicitly denied write access. Takes precedence over allowWrite. See https://code.claude.com/docs/en/sandboxing#filesystem-isolation"},"denyRead":{"type":"array","items":{"type":"string","minLength":1},"description":"Paths where subprocesses are explicitly denied read access. See https://code.claude.com/docs/en/sandboxing#filesystem-isolation"},"allowRead":{"type":"array","items":{"type":"string","minLength":1},"description":"Paths to re-allow reading within denyRead regions. Takes precedence over denyRead for matching paths. See https://code.claude.com/docs/en/sandboxing#granting-subprocess-write-access-to-specific-paths"},"allowManagedReadPathsOnly":{"type":"boolean","description":"(Managed settings only) When true, only allowRead paths from managed settings are used; user, project, and local allowRead entries are ignored. denyRead still merges from all sources. See https://code.claude.com/docs/en/sandboxing#filesystem-isolation"},"disabled":{"type":"boolean","description":"Skip filesystem isolation while keeping network isolation: sandboxed commands get unrestricted read and write access to the host filesystem, and network egress stays confined to network.allowedDomains. Only honored from user, managed, or CLI --settings settings (default: false). Requires Claude Code v2.1.216 or later. See https://code.claude.com/docs/en/sandboxing#disable-filesystem-isolation","default":false}},"additionalProperties":false},"ripgrep":{"type":"object","description":"Custom ripgrep configuration for Claude Code's bundled ripgrep support. Overrides the bundled binary and arguments.","additionalProperties":false,"required":["command"],"properties":{"command":{"type":"string","description":"Path to the ripgrep binary to use","minLength":1},"args":{"type":"array","items":{"type":"string"},"description":"Additional arguments to pass to the ripgrep binary"}}},"bwrapPath":{"type":"string","minLength":1,"description":"(Managed setting only) Path to custom bubblewrap (bwrap) binary for Linux/WSL sandbox. Overrides default. See https://code.claude.com/docs/en/server-managed-settings"},"socatPath":{"type":"string","minLength":1,"description":"(Managed setting only) Path to custom socat binary for Linux/WSL network proxying. Overrides default. See https://code.claude.com/docs/en/server-managed-settings"},"failIfUnavailable":{"type":"boolean","description":"When true, make sandbox startup a hard failure if required sandbox dependencies are missing. Default: false (sandbox is skipped with a warning). See https://code.claude.com/docs/en/sandboxing#enable-sandboxing"},"enabledPlatforms":{"type":"array","items":{"type":"string","enum":["macos","linux","wsl","windows"]},"description":"Limit the entire sandbox configuration to the listed platforms. On platforms not in the list the sandbox config is inert: no sandbox, no auto-allow, no startup warning, and no failIfUnavailable exit. When omitted, all supported platforms are included. Only honored from managed (policy) settings."},"credentials":{"type":"object","additionalProperties":false,"description":"Block sandboxed commands from reading credential files and secret environment variables (v2.1.187+). Entries merge across settings scopes. See https://code.claude.com/docs/en/sandboxing#protect-credentials","properties":{"files":{"type":"array","description":"Credential file paths to hide from sandboxed commands","items":{"type":"object","additionalProperties":false,"properties":{"path":{"type":"string","description":"Path to the credential file to deny"},"mode":{"type":"string","enum":["deny"],"description":"Access mode; only \\"deny\\" is supported"}},"required":["path","mode"]}},"envVars":{"type":"array","description":"Secret environment variable names to unset for sandboxed commands","items":{"type":"object","additionalProperties":false,"properties":{"name":{"type":"string","description":"Environment variable name to deny"},"mode":{"type":"string","enum":["deny"],"description":"Access mode; only \\"deny\\" is supported"}},"required":["name","mode"]}},"allowPlaintextInject":{"type":"boolean","description":"Allow mask substitution on plain HTTP requests as well as TLS-terminated HTTPS. On plain HTTP the upstream identity is unverified and the credential travels in cleartext, so leave this off outside trusted test networks. Only honored from user, managed, or CLI --settings settings, not from .claude/settings.json or .claude/settings.local.json (default: false). Requires Claude Code v2.1.199 or later. See https://code.claude.com/docs/en/sandboxing#protect-credentials","default":false}}},"allowAppleEvents":{"type":"boolean","description":"Allow sandboxed commands to send Apple Events on macOS (v2.1.181+). Honored only from user, managed, or CLI settings; project settings cannot enable it. See https://code.claude.com/docs/en/sandboxing#limitations"}},"additionalProperties":false},"spinnerVerbs":{"type":"object","description":"Customize the verbs shown in spinner progress messages","properties":{"mode":{"type":"string","enum":["append","replace"],"description":"How to combine custom verbs with default spinner verbs: 'append' adds custom verbs to the default list, 'replace' uses only custom verbs"},"verbs":{"type":"array","items":{"type":"string","minLength":1},"minItems":1,"description":"Custom verbs used in spinner progress text"}},"required":["verbs"],"additionalProperties":false},"spinnerTipsEnabled":{"type":"boolean","description":"Show tips in the spinner while Claude is working. Set to false to disable tips (default: true)","default":true},"spinnerTipsOverride":{"type":"object","description":"Customize the tips displayed in the spinner while Claude is working. See https://code.claude.com/docs/en/settings#available-settings","properties":{"excludeDefault":{"type":"boolean","description":"If true, only show custom tips. If false or absent, custom tips merge with built-in tips","default":false},"tips":{"type":"array","items":{"type":"string","minLength":1},"description":"Custom tip strings to display in the spinner","minItems":1}},"required":["tips"],"additionalProperties":false},"terminalProgressBarEnabled":{"type":"boolean","description":"Enable the terminal progress bar that shows progress in supported terminals like Windows Terminal and iTerm2 (default: true)","default":true},"showTurnDuration":{"type":"boolean","description":"Show turn duration messages after responses (e.g., \\"Cooked for 1m 6s\\"). Set to false to hide these messages (default: true)","default":true},"skillOverrides":{"type":"object","additionalProperties":{"type":"string","enum":["on","name-only","user-invocable-only","off"]},"description":"Per-skill visibility overrides. Controls whether skills appear to Claude and in the / picker. Values: 'on' (name and description shown, default), 'name-only' (name only), 'user-invocable-only' (hidden from Claude, visible in /), 'off' (hidden everywhere). Plugin skills are not affected by this setting. See https://code.claude.com/docs/en/skills#override-skill-visibility-from-settings","examples":[{"legacy-context":"name-only","deploy":"off"}]},"prefersReducedMotion":{"type":"boolean","description":"Reduce or disable UI animations (spinners, shimmer, flash effects) for accessibility","default":false},"prUrlTemplate":{"type":"string","description":"URL template for the PR badge shown in the footer and in tool-result summaries. Substitutes placeholders {host}, {owner}, {repo}, {number}, {url} from the gh-reported PR URL. Use this to point PR links at an internal code-review tool instead of github.com. Does not affect #123 autolinks in Claude's prose. See https://code.claude.com/docs/en/settings#available-settings","examples":["https://reviews.example.com/{owner}/{repo}/pull/{number}"]},"alwaysThinkingEnabled":{"type":"boolean","description":"Enable extended thinking by default for all sessions. Typically configured via the /config command rather than editing directly. See https://code.claude.com/docs/en/common-workflows#use-extended-thinking-thinking-mode"},"companyAnnouncements":{"type":"array","items":{"type":"string","minLength":1},"description":"Company announcements to display at startup (one will be randomly selected if multiple are provided)"},"teammateMode":{"type":"string","enum":["auto","in-process","tmux","iterm2"],"description":"How agent team teammates display: \\"auto\\" picks split panes in tmux or iTerm2, in-process otherwise; \\"iterm2\\" (added in v2.1.186) forces iTerm2 native split panes and requires the it2 CLI (it shows an error with the install command if it2 is missing). The default is \\"in-process\\" (it was \\"auto\\" before v2.1.179). Agent teams are experimental and disabled by default. Enable them by adding CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS to your settings.json or environment. See https://code.claude.com/docs/en/agent-teams#choose-a-display-mode","default":"in-process"},"worktree":{"type":"object","additionalProperties":false,"description":"Configuration for --worktree sessions. See https://code.claude.com/docs/en/settings#worktree-settings","properties":{"sparsePaths":{"type":"array","items":{"type":"string","minLength":1},"description":"Directories to check out in each worktree via git sparse-checkout (cone mode). Only the listed paths are written to disk, which is faster in large monorepos. See https://code.claude.com/docs/en/settings#worktree-settings","examples":[["packages/my-app","shared/utils"]]},"baseRef":{"type":"string","enum":["fresh","head"],"default":"fresh","description":"Whether to branch worktrees from origin/<default> (fresh) or local HEAD (head). Default: fresh. Set to 'head' to preserve unpushed commits in new worktrees. See https://code.claude.com/docs/en/settings#worktree-settings"},"bgIsolation":{"type":"string","enum":["worktree","none"],"default":"worktree","description":"Isolation mode for background sessions. \\"worktree\\" blocks Edit/Write in main checkout until EnterWorktree is called; \\"none\\" lets background jobs edit the working copy directly without EnterWorktree, for repos where worktrees are impractical. See https://code.claude.com/docs/en/settings#worktree-settings"},"symlinkDirectories":{"type":"array","items":{"type":"string"},"description":"Directories to symlink from the main repository into each worktree to avoid duplicating large directories on disk. No directories are symlinked by default. See https://code.claude.com/docs/en/settings#worktree-settings","examples":[["node_modules",".cache"]]}}},"parentSettingsBehavior":{"type":"string","enum":["first-wins","merge"],"default":"first-wins","description":"(Admin/managed settings only) Controls how SDK managedSettings (parent tier) merge with inherited settings. 'first-wins': first non-empty value applies (default). 'merge': merge arrays and objects. See https://code.claude.com/docs/en/server-managed-settings"},"pluginTrustMessage":{"type":"string","description":"(Managed settings only) Custom message appended to the plugin trust warning shown before installation. Use to provide organization-specific context about approved plugins. See https://code.claude.com/docs/en/settings#plugin-settings","minLength":1},"pluginConfigs":{"type":"object","additionalProperties":{"type":"object","properties":{"mcpServers":{"type":"object","additionalProperties":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"array","items":{"type":"string"}}]}},"description":"User configuration values for MCP servers keyed by server name"},"options":{"type":"object","description":"Non-sensitive option values from the plugin manifest's userConfig, keyed by option name. Sensitive values go to secure storage instead. See https://code.claude.com/docs/en/plugins-reference","additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"array","items":{"type":"string"}}]}}},"additionalProperties":false},"description":"Per-plugin configuration including MCP server user configs and plugin options, keyed by plugin ID (plugin@marketplace format). See https://code.claude.com/docs/en/plugins"},"allowManagedMcpServersOnly":{"type":"boolean","description":"(Managed settings only) When true, only allowedMcpServers from managed settings are respected; MCP servers defined in user, project, or local settings are ignored. deniedMcpServers still merges from all sources. See https://code.claude.com/docs/en/managed-mcp"},"blockedMarketplaces":{"type":"array","description":"(Managed settings only) Blocklist of marketplace sources. These exact sources are blocked from being added as marketplaces. The check happens before downloading, so blocked sources never touch the filesystem.","items":{"anyOf":[{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"url","description":"Block marketplace fetched from direct URL"},"url":{"type":"string","format":"uri","description":"Direct URL to marketplace.json file"},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"Custom HTTP headers (e.g., for authentication)"}},"required":["source","url"]},{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"github","description":"Block marketplace from GitHub repository"},"repo":{"type":"string","description":"GitHub repository in owner/repo format"},"ref":{"type":"string","description":"Git branch or tag to use"},"path":{"type":"string","description":"Path to marketplace.json within repo"}},"required":["source","repo"]},{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"git","description":"Block marketplace from git repository URL"},"url":{"type":"string","pattern":".*\\\\.git$","description":"Full git repository URL"},"ref":{"type":"string","description":"Git branch or tag to use"},"path":{"type":"string","description":"Path to marketplace.json within repo"}},"required":["source","url"]},{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"npm","description":"Block marketplace from NPM package"},"package":{"type":"string","description":"NPM package containing marketplace.json"}},"required":["source","package"]},{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"file","description":"Block marketplace from local file"},"path":{"type":"string","description":"Local file path to marketplace.json"}},"required":["source","path"]},{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"directory","description":"Block marketplace from local directory"},"path":{"type":"string","description":"Local directory containing .claude-plugin/marketplace.json"}},"required":["source","path"]},{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"hostPattern","description":"Block marketplace by host pattern matching"},"hostPattern":{"type":"string","description":"Regex pattern to match the host/domain extracted from any marketplace source type"}},"required":["source","hostPattern"]},{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"pathPattern","description":"Block marketplace by file/directory path pattern matching"},"pathPattern":{"type":"string","description":"Regex pattern to match file or directory paths for marketplace sources"}},"required":["source","pathPattern"]}]}},"agent":{"type":"string","description":"Name of an agent (built-in or custom) to use for the main thread. Applies the agent's system prompt, tool restrictions, and model. See https://code.claude.com/docs/en/sub-agents","minLength":1},"autoMemoryDirectory":{"type":"string","description":"Custom directory path for auto-memory storage. Supports ~/ prefix for home-directory expansion. Ignored if set in checked-in project settings (.claude/settings.json) for security. Defaults to ~/.claude/projects/<sanitized-cwd>/memory/ when unset. See https://code.claude.com/docs/en/memory","minLength":1},"autoMode":{"type":"object","description":"Customization for the auto mode classifier prompt. Typically configured in managed settings to tune the allow/deny rules used when permissions.defaultMode is \\"auto\\". By default, allow, soft_deny, and environment REPLACE the corresponding built-in classifier section entirely. Include the literal string \\"$defaults\\" as an array entry (added in v2.1.118) to splice the built-in defaults in at that position alongside your custom rules. See https://code.claude.com/docs/en/permissions","additionalProperties":false,"properties":{"allow":{"type":"array","items":{"type":"string"},"description":"Rules for the auto mode classifier allow section. Replaces the built-in allow rules entirely unless the literal string \\"$defaults\\" is included as an entry, which splices the built-in defaults in at that position."},"soft_deny":{"type":"array","items":{"type":"string"},"description":"Rules for the auto mode classifier soft-deny section. Replaces the built-in soft-deny rules entirely unless the literal string \\"$defaults\\" is included as an entry, which splices the built-in defaults in at that position."},"environment":{"type":"array","items":{"type":"string"},"description":"Entries for the auto mode classifier environment section. Replaces the built-in environment context entirely unless the literal string \\"$defaults\\" is included as an entry, which splices the built-in defaults in at that position."},"hard_deny":{"type":"array","items":{"type":"string"},"description":"Rules for the auto mode classifier hard-deny section. Hard-deny rules block unconditionally regardless of user intent. Replaces the built-in hard-deny rules entirely unless the literal string \\"$defaults\\" is included as an entry, which splices the built-in defaults in at that position. See https://code.claude.com/docs/en/permissions"},"classifyAllShell":{"type":"boolean","description":"UNDOCUMENTED. Route all Bash/PowerShell commands through the auto mode classifier instead of only arbitrary-code-execution patterns (added in v2.1.193).","default":false}}},"channelsEnabled":{"type":"boolean","description":"(Managed settings only) Allow channels for the organization. On claude.ai Team and Enterprise plans, channels are blocked when this is unset or false. For Anthropic Console accounts using API key authentication, channels are allowed by default unless the organization deploys managed settings, in which case this key must be set to true. See https://code.claude.com/docs/en/channels#enterprise-controls"},"defaultShell":{"type":"string","enum":["bash","powershell"],"description":"Default shell for input-box ! commands. Default: bash. Using \\"powershell\\" routes ! commands through PowerShell on Windows and requires CLAUDE_CODE_USE_POWERSHELL_TOOL=1 with pwsh on PATH. See https://code.claude.com/docs/en/settings#available-settings"},"disableDeepLinkRegistration":{"type":"string","enum":["disable"],"description":"Set to \\"disable\\" to prevent Claude Code from registering the \`claude-cli://\` deep-link protocol handler on startup. Most useful in managed settings where users cannot override it. See https://code.claude.com/docs/en/settings#available-settings"},"disableSkillShellExecution":{"type":"boolean","description":"Disable inline shell execution for \`\` !\`...\` \`\` and \` \`\`\`! \` blocks in skills and custom slash commands from user, project, plugin, or additional-directory sources. Commands are replaced with [shell command execution disabled by policy] instead of being run. Bundled and managed skills are not affected. Most useful in managed settings where users cannot override it. See https://code.claude.com/docs/en/settings#available-settings"},"forceRemoteSettingsRefresh":{"type":"boolean","description":"(Managed settings only) Block CLI startup until remote managed settings are freshly fetched from the server. If the fetch fails, the CLI exits (fail-closed) rather than continuing with cached settings. When not set, startup continues without waiting for remote settings. See https://code.claude.com/docs/en/server-managed-settings"},"minimumVersion":{"type":"string","description":"Minimum Claude Code version to stay on. Prevents downgrades when switching release channels. See https://code.claude.com/docs/en/settings#available-settings","examples":["2.1.0"],"minLength":1},"showClearContextOnPlanAccept":{"type":"boolean","description":"When true, the plan-approval dialog offers a \\"clear context\\" option. Defaults to false.","default":false},"showThinkingSummaries":{"type":"boolean","description":"Show thinking summaries in the transcript view (Ctrl+O). Thinking summaries are not generated by default in interactive sessions; set to true to restore. See https://code.claude.com/docs/en/settings#available-settings","default":false},"skipDangerousModePermissionPrompt":{"type":"boolean","description":"Whether the user has accepted the bypass permissions mode dialog. Typically managed by the CLI rather than set by hand."},"strictPluginOnlyCustomization":{"description":"(Managed settings) Block non-plugin customization sources for the listed surfaces. Array form locks specific surfaces (e.g., [\\"skills\\", \\"hooks\\"]); true locks all four; false is an explicit no-op. See https://code.claude.com/docs/en/plugins-reference","anyOf":[{"type":"boolean"},{"type":"array","uniqueItems":true,"items":{"type":"string","enum":["skills","agents","hooks","mcp"]}}]},"tui":{"type":"string","enum":["fullscreen","default"],"description":"TUI rendering mode. Use \\"fullscreen\\" for the flicker-free alt-screen renderer with virtualized scrollback; \\"default\\" for the classic main-screen renderer. Corresponds to the /tui command. See https://code.claude.com/docs/en/settings#available-settings"},"viewMode":{"type":"string","enum":["default","verbose","focus"],"description":"Transcript view mode. \\"default\\" shows standard interactive view; \\"verbose\\" shows expanded tool details; \\"focus\\" shows prompt, one-line tool summaries, and final response only (Ctrl+O toggle). See https://code.claude.com/docs/en/settings#available-settings"},"useAutoModeDuringPlan":{"type":"boolean","description":"When true, apply the auto mode classifier during plan mode to auto-approve safe read-only tool calls while planning. Has no effect unless permissions.defaultMode allows auto. See https://code.claude.com/docs/en/permissions"},"voiceEnabled":{"type":"boolean","description":"Legacy alias for voice.enabled; prefer the voice object. Requires a Claude.ai account. See https://code.claude.com/docs/en/settings#available-settings"},"wslInheritsWindowsSettings":{"type":"boolean","description":"(Windows managed settings only) When true, Claude Code on WSL reads managed settings from the Windows policy chain in addition to /etc/claude-code, with Windows sources taking priority. Only honored when set in the HKLM registry key or C:\\\\Program Files\\\\ClaudeCode\\\\managed-settings.json, both of which require Windows admin to write. For HKCU policy to also apply on WSL, the flag must additionally be set in HKCU itself. Has no effect on native Windows. See https://code.claude.com/docs/en/settings#available-settings"},"subagentStatusLine":{"type":"object","additionalProperties":false,"description":"Status line configuration for subagent sessions. See https://code.claude.com/docs/en/statusline#subagent-status-lines","required":["type","command"],"properties":{"type":{"type":"string","const":"command","description":"Must be \\"command\\""},"command":{"type":"string","description":"Shell command to run for the subagent status line","minLength":1}}},"advisorModel":{"type":"string","description":"Model for the server-side advisor tool. Accepts a model alias (\\"opus\\", \\"sonnet\\", or \\"fable\\" on v2.1.170+) or a full model ID. Overridden by the --advisor CLI flag for the session, and blocked when the model is outside the availableModels allowlist. See https://code.claude.com/docs/en/advisor"},"autoCompactEnabled":{"type":"boolean","description":"Automatically compact the conversation when context approaches the limit. Also configurable via the DISABLE_AUTO_COMPACT environment variable. See https://code.claude.com/docs/en/settings#available-settings","default":true},"disableAgentView":{"type":"boolean","description":"(Managed settings) Turn off background agents and the agent view: claude agents, --bg, /background, and the on-demand supervisor. Also configurable via the CLAUDE_CODE_DISABLE_AGENT_VIEW environment variable (set to 1 to disable). See https://code.claude.com/docs/en/agent-view"},"editorMode":{"type":"string","enum":["normal","vim"],"description":"Key binding mode for the input prompt: \\"normal\\" or \\"vim\\". Appears in /config as Editor mode. See https://code.claude.com/docs/en/terminal-config#edit-prompts-with-vim-keybindings","default":"normal"},"enforceAvailableModels":{"type":"boolean","description":"(Managed settings) Extend the availableModels allowlist to the Default model option (requires v2.1.175+). Requires a non-empty availableModels list; when the account-type default is not in the allowlist, Default resolves to the first allowed entry instead. Has no effect when availableModels is unset or empty. See https://code.claude.com/docs/en/model-config#enforce-the-allowlist-for-the-default-model"},"fallbackModel":{"type":"array","maxItems":3,"items":{"type":"string"},"description":"Fallback model chain tried in order when the primary model is overloaded, unavailable, or returns a non-retryable server error. Capped at three entries after deduplication; accepts model names or aliases, and \\"default\\" expands to the account-type default. Overridden by the --fallback-model CLI flag for the session. See https://code.claude.com/docs/en/model-config#fallback-model-chains"},"fileCheckpointingEnabled":{"type":"boolean","description":"Snapshot edited files so /rewind can restore them. Also configurable via the CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING environment variable (set to 1 to disable). See https://code.claude.com/docs/en/checkpointing","default":true},"gcpAuthRefresh":{"type":"string","description":"Command to run when GCP credentials are expired or cannot be loaded. The command's output is displayed to the user but interactive input is not supported; it times out after three minutes. See https://code.claude.com/docs/en/google-vertex-ai#advanced-credential-configuration","examples":["gcloud auth application-default login"],"minLength":1},"managedMcpServers":{"type":"array","description":"(Managed settings, third-party Desktop deployments only) MCP server configurations pushed to all users. Each entry specifies the transport and connection details, plus an optional toolPolicy map. Delivered through the managed settings file or MDM. See https://code.claude.com/docs/en/desktop#enterprise-configuration","items":{"type":"object","additionalProperties":true}},"skillListingMaxDescChars":{"type":"integer","exclusiveMinimum":0,"description":"Per-skill character cap on the combined description and when_to_use text in the skill listing Claude sees each turn. Text longer than this is truncated. See https://code.claude.com/docs/en/skills#skill-descriptions-are-cut-short","default":1536},"preferredNotifChannel":{"type":"string","enum":["auto","terminal_bell","iterm2","iterm2_with_bell","kitty","ghostty","notifications_disabled"],"description":"Method for task-complete and permission-prompt notifications. \\"auto\\" (default) sends a desktop notification in iTerm2, Ghostty, and Kitty and does nothing in other terminals; \\"terminal_bell\\" rings the bell in any terminal; \\"notifications_disabled\\" turns them off. See https://code.claude.com/docs/en/terminal-config#get-a-terminal-bell-or-notification","default":"auto"},"pluginSuggestionMarketplaces":{"type":"array","items":{"type":"string"},"description":"(Managed settings only) Allowlist of marketplace names whose plugins may surface as contextual \\"suggested for this directory\\" tips in the /plugin Discover tab. No marketplace-declared suggestions surface without this allowlist. The built-in first-party frontend-design tip is unaffected. See https://code.claude.com/docs/en/settings#available-settings"},"requiredMaximumVersion":{"type":"string","description":"(Managed settings only) Maximum Claude Code version allowed to start. If the running version is newer, Claude Code exits at startup with instructions to install an approved version. See https://code.claude.com/docs/en/admin-setup#decide-what-to-enforce"},"requiredMinimumVersion":{"type":"string","description":"(Managed settings only) Minimum Claude Code version required to start. If the running version is older, Claude Code exits at startup rather than only warning. See https://code.claude.com/docs/en/admin-setup#decide-what-to-enforce"},"respondToBashCommands":{"type":"boolean","description":"Whether Claude responds after an input-box ! shell command runs (v2.1.186+). Set to false to add the command output to context without a response. See https://code.claude.com/docs/en/interactive-mode#shell-mode-with--prefix","default":true},"skillListingBudgetFraction":{"type":"number","exclusiveMinimum":0,"maximum":1,"description":"Fraction of the model context window reserved for the skill listing sent to Claude (default 0.01 = 1%). When the listing exceeds this, descriptions are shortened to fit. Also configurable via the SLASH_COMMAND_TOOL_CHAR_BUDGET environment variable (fixed character count). See https://code.claude.com/docs/en/skills#skill-descriptions-are-cut-short","default":0.01},"sshConfigs":{"type":"array","description":"(Managed settings) Pre-configured SSH connections distributed to Desktop users. See https://code.claude.com/docs/en/desktop#ssh-sessions","items":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","description":"Unique identifier for this SSH config, used to match configs across settings sources"},"name":{"type":"string","description":"Display name for the SSH connection"},"sshHost":{"type":"string","description":"SSH host in the form \\"user@hostname\\" or \\"hostname\\", or a host alias from ~/.ssh/config"},"sshPort":{"type":"integer","description":"SSH port (default 22)"},"sshIdentityFile":{"type":"string","description":"Path to the SSH identity file (private key)"},"startDirectory":{"type":"string","description":"Default working directory on the remote host; supports tilde expansion. Defaults to the remote user home directory"}},"required":["id","name","sshHost"]}},"sshHostAllowlist":{"type":"array","items":{"type":"string"},"description":"(Managed settings only) Allowlist restricting Desktop SSH sessions to approved hosts. Patterns are case-insensitive; * matches any host and *.example.com matches example.com and any subdomain. See https://code.claude.com/docs/en/desktop#ssh-sessions"},"theme":{"anyOf":[{"type":"string","enum":["auto","dark","light","dark-daltonized","light-daltonized","dark-ansi","light-ansi"]},{"type":"string","pattern":"^custom:.+","description":"Reference to a custom theme defined in ~/.claude/themes/, in the form \\"custom:<slug>\\""}],"description":"Color theme for the interface: auto, dark, light, the daltonized variants (deuteranopia-friendly), the ansi variants (16-color terminals), or a custom theme reference such as custom:<slug> or custom:<plugin-name>:<slug>. See https://code.claude.com/docs/en/terminal-config#match-the-color-theme","default":"dark"},"voice":{"type":"object","additionalProperties":false,"description":"Voice dictation settings: enabled turns dictation on, mode selects \\"hold\\" or \\"tap\\", and autoSubmit sends the prompt on key release in hold mode. Written automatically when you run /voice. Requires a Claude.ai account. See https://code.claude.com/docs/en/voice-dictation","properties":{"enabled":{"type":"boolean","description":"Enable push-to-talk voice dictation input"},"mode":{"type":"string","enum":["hold","tap"],"description":"Recording mode: \\"hold\\" (default) is push-to-talk; \\"tap\\" taps once to start and again to stop and submit"},"autoSubmit":{"type":"boolean","description":"In hold mode, auto-submit the prompt on key release when the transcript is at least three words long"}}},"wheelScrollAccelerationEnabled":{"type":"boolean","description":"In fullscreen rendering, accelerate mouse-wheel scroll speed during fast scrolls (v2.1.174+). Set to false for a constant scroll rate per wheel notch. See https://code.claude.com/docs/en/fullscreen#mouse-wheel-scrolling"},"disableBundledSkills":{"type":"boolean","description":"Disable the skills and workflows that ship with Claude Code: bundled skills and workflows are removed entirely, while built-in slash commands like /init stay typable but are hidden from the model. Skills from plugins, .claude/skills/, and .claude/commands/ are unaffected. Also configurable via the CLAUDE_CODE_DISABLE_BUNDLED_SKILLS environment variable. See https://code.claude.com/docs/en/settings#available-settings"},"awaySummaryEnabled":{"type":"boolean","description":"Show a one-line session recap when you return to the terminal after a few minutes away. Set to false (or turn off Session recap in /config) to disable. See https://code.claude.com/docs/en/settings#available-settings","default":true},"autoScrollEnabled":{"type":"boolean","description":"In fullscreen rendering, follow new output to the bottom of the conversation. Appears in /config as Auto-scroll. Permission prompts still scroll into view when this is off. See https://code.claude.com/docs/en/fullscreen","default":true},"allowAllClaudeAiMcps":{"type":"boolean","description":"(Managed settings only) Load claude.ai connectors alongside a deployed managed-mcp.json, which otherwise takes exclusive control and suppresses them. See https://code.claude.com/docs/en/managed-mcp"},"agentPushNotifEnabled":{"type":"boolean","description":"When Remote Control is connected, allow Claude to send proactive push notifications to your phone, for example when a long task finishes. Requires Claude Code v2.1.119 or later. See https://code.claude.com/docs/en/remote-control#mobile-push-notifications","default":false},"axScreenReader":{"type":"boolean","description":"Render screen-reader-friendly output: flat text without decorative borders or animations screen-reader mode always uses the classic renderer, so the tui setting has no effect while it is active. The CLAUDE_AX_SCREEN_READER environment variable and --ax-screen-reader flag take precedence. Requires Claude Code v2.1.181 or later. See https://code.claude.com/docs/en/settings#available-settings"},"claudeMd":{"type":"string","description":"(Managed settings only) CLAUDE.md-style instructions injected as organization-managed memory. Honored only from managed/policy settings. See https://code.claude.com/docs/en/settings#available-settings"},"disableArtifact":{"type":"boolean","description":"Disable the Artifact tool, which publishes session output as a private web page on claude.ai. Also configurable via the CLAUDE_CODE_DISABLE_ARTIFACT environment variable. See https://code.claude.com/docs/en/settings#available-settings"},"disableAutoMode":{"type":"string","enum":["disable"],"description":"Set to \\"disable\\" to prevent auto mode from being activated: removes auto from the Shift+Tab cycle and rejects --permission-mode auto at startup. See https://code.claude.com/docs/en/settings#available-settings"},"disableClaudeAiConnectors":{"type":"boolean","description":"Disable claude.ai MCP connectors so they are not auto-fetched or connected. A value of true in any settings source takes precedence. Requires Claude Code v2.1.182 or later. See https://code.claude.com/docs/en/settings#available-settings"},"disableRemoteControl":{"type":"boolean","description":"Disable Remote Control: blocks claude remote-control, the --remote-control flag, auto-start, and the in-session toggle. Requires Claude Code v2.1.128 or later. See https://code.claude.com/docs/en/remote-control"},"disableWorkflows":{"type":"boolean","description":"Disable dynamic workflows and bundled workflow commands. Also configurable via the CLAUDE_CODE_DISABLE_WORKFLOWS environment variable. See https://code.claude.com/docs/en/settings#available-settings","default":false},"footerLinksRegexes":{"type":"array","description":"Render extra clickable badges in the footer when a regex matches turn output (tool results and assistant responses). Read from user, --settings flag, and managed settings only; ignored in project and local settings. Requires Claude Code v2.1.176 or later. See https://code.claude.com/docs/en/settings#available-settings","items":{"type":"object","additionalProperties":false,"properties":{"type":{"type":"string","const":"regex","description":"Config variant; \\"regex\\" matches turn output and builds a URL from named capture groups"},"pattern":{"type":"string","description":"Regex matched against turn output"},"url":{"type":"string","description":"Link target; {name} placeholders are filled from named regex capture groups"},"label":{"type":"string","description":"Badge text; {name} placeholders filled from named capture groups, defaults to the full match"}},"required":["pattern","url"]}},"inputNeededNotifEnabled":{"type":"boolean","description":"When Remote Control is connected, send a push notification to your phone when a permission prompt or question is waiting for input. Requires Claude Code v2.1.119 or later. See https://code.claude.com/docs/en/settings#available-settings","default":false},"policyHelper":{"type":"object","additionalProperties":false,"description":"Admin-deployed executable that computes managed settings dynamically at startup. Honored only from MDM or the system managed-settings.json. Requires Claude Code v2.1.136 or later. See https://code.claude.com/docs/en/settings#available-settings","properties":{"path":{"type":"string","description":"Absolute path to the policy helper executable"},"timeoutMs":{"type":"integer","description":"How long in milliseconds to wait for the helper before treating the run as failed"},"refreshIntervalMs":{"description":"How often in milliseconds to re-run the helper in the background; set to 0 to disable refresh, or to at least 60000","anyOf":[{"type":"integer","const":0},{"type":"integer","minimum":60000}]}},"required":["path"]},"remoteControlAtStartup":{"type":"boolean","description":"Connect Remote Control automatically when each interactive session starts. true = always, false = never, unset = organization default. Requires Claude Code v2.1.119 or later. See https://code.claude.com/docs/en/remote-control#enable-remote-control-for-all-sessions"},"syntaxHighlightingDisabled":{"type":"boolean","description":"Disable syntax highlighting in diffs, code blocks, and file previews. See https://code.claude.com/docs/en/settings#available-settings"},"verbose":{"type":"boolean","description":"Show full tool output instead of truncated summaries. The --verbose flag overrides this for a single session. Requires Claude Code v2.1.119 or later. See https://code.claude.com/docs/en/settings#available-settings","default":false},"workflowKeywordTriggerEnabled":{"type":"boolean","description":"Whether including the keyword \\"ultracode\\" in a prompt triggers a dynamic workflow. Requires Claude Code v2.1.157 or later. See https://code.claude.com/docs/en/settings#available-settings","default":true},"askUserQuestionTimeout":{"type":"string","description":"Idle time before an unanswered AskUserQuestion dialog auto-continues with whatever options you had already selected. Accepts \\"60s\\", \\"5m\\", \\"10m\\", or \\"never\\" (default: \\"never\\", which waits until you answer). Appears in /config as Question auto-continue timeout, which writes this key to user settings. Not read from project or local settings. Requires Claude Code v2.1.200 or later. See https://code.claude.com/docs/en/settings#available-settings","enum":["60s","5m","10m","never"],"default":"never"},"teammateDefaultModel":{"type":["string","null"],"description":"Default model for agent team teammates when the spawn prompt does not specify one. Set to a model alias such as \\"sonnet\\", or null to inherit the lead's current /model selection. Appears in /config as Default teammate model. See https://code.claude.com/docs/en/agent-teams","examples":["sonnet"]},"workflowSizeGuideline":{"type":"string","description":"Sets the agent count Claude aims for in the dynamic workflows it writes. Claude Code sends the value to Claude as advice, not an enforced cap. Accepts \\"unrestricted\\" (default, which sends no guideline), \\"small\\", \\"medium\\", or \\"large\\". Appears in /config as Dynamic workflow size, and can be set with /config workflowSizeGuideline=small. Requires Claude Code v2.1.202 or later. On v2.1.203 or later the guideline's agent count also replaces the default threshold for the Large workflow warning. See https://code.claude.com/docs/en/workflows#set-a-size-guideline","enum":["unrestricted","small","medium","large"],"default":"unrestricted"},"enableArtifact":{"type":"boolean","description":"Enable or disable the Artifact tool for this user. When unset, the default follows the feature's availability for your account. The Artifacts row in /config writes this key. A managed disableArtifact and your organization's admin setting take precedence, and the key is ignored in project and local settings (.claude/settings.json, .claude/settings.local.json), which a repository could otherwise commit. Requires Claude Code v2.1.196 or later. See https://code.claude.com/docs/en/artifacts"},"permissionExplainerEnabled":{"type":"boolean","description":"Show a model-generated explanation of the command when you press Ctrl+E on a Bash or PowerShell permission prompt (default: true). Set to false to turn the shortcut off. See https://code.claude.com/docs/en/permissions#permission-system","default":true},"diffTool":{"type":"string","description":"Where to display file diffs when an IDE is connected: \\"auto\\" (default) opens diffs in the IDE's diff viewer, \\"terminal\\" keeps them in the terminal. Appears in /config as Diff tool only when Claude Code is connected to a VS Code or JetBrains IDE. See https://code.claude.com/docs/en/settings#global-config-settings","enum":["auto","terminal"],"default":"auto"},"externalEditorContext":{"type":"boolean","description":"Prepend Claude's previous response as #-commented context when you open the external editor with Ctrl+G (default: false). Appears in /config as Show last response in external editor. See https://code.claude.com/docs/en/settings#global-config-settings","default":false},"autoConnectIde":{"type":"boolean","description":"Automatically connect to a running IDE when Claude Code starts from an external terminal (default: false). Appears in /config as Auto-connect to IDE (external terminal) when running outside a VS Code or JetBrains terminal. Also configurable via the CLAUDE_CODE_AUTO_CONNECT_IDE environment variable, which overrides this when set. See https://code.claude.com/docs/en/settings#global-config-settings","default":false},"autoInstallIdeExtension":{"type":"boolean","description":"Automatically install the Claude Code IDE extension when running from a VS Code terminal (default: true). Appears in /config as Auto-install IDE extension when running inside a VS Code or JetBrains terminal. You can also set the CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL environment variable to 1. See https://code.claude.com/docs/en/settings#global-config-settings","default":true},"emojiCompletionEnabled":{"type":"boolean","description":"Show emoji suggestions when you type : plus a shortcode in the prompt input, and replace a completed shortcode such as :heart: with its emoji (default: true). Set to false to disable both. Requires Claude Code v2.1.217 or later. See https://code.claude.com/docs/en/interactive-mode#emoji-shortcodes","default":true},"vimInsertModeRemaps":{"type":"object","description":"Map two-key INSERT-mode sequences to Escape in vim editor mode. Each key is exactly two printable characters typed in sequence, and \\"<Esc>\\" is the only supported target; other entries are ignored. Read from user, --settings flag, and managed settings only, so a repository's checked-in settings cannot remap your keystrokes. Has no effect unless editorMode is \\"vim\\". Requires Claude Code v2.1.208 or later. See https://code.claude.com/docs/en/interactive-mode#remap-insert-mode-key-sequences","propertyNames":{"pattern":"^..$"},"additionalProperties":{"type":"string","description":"Remap target. \\"<Esc>\\" is the only supported value; other values are ignored"},"examples":[{"jj":"<Esc>"}]},"processWrapper":{"type":"string","description":"Corporate launcher command placed in front of the background processes Claude Code starts. Honored from managed settings, a --settings file, and user settings only; the CLAUDE_CODE_PROCESS_WRAPPER environment variable takes precedence when both are set. Requires Claude Code v2.1.210 or later. See https://code.claude.com/docs/en/corporate-launcher","examples":["/opt/corp/launcher --profile claude"]},"forceLoginGatewayUrl":{"type":"string","description":"Pre-fills and locks the gateway URL on the /login Cloud gateway screen. Either this key or forceLoginMethod: \\"gateway\\" surfaces that screen; set both so the URL is filled in. Honored only at the managed policy tier; ignored in user and project settings. See https://code.claude.com/docs/en/claude-apps-gateway#set-the-gateway-url","examples":["https://claude-gateway.example.com"]},"disableSideloadFlags":{"type":"boolean","description":"(Managed settings only) Reject the --plugin-dir, --plugin-url, --agents, and --mcp-config CLI flags at startup, which users could otherwise pass to bypass strictKnownMarketplaces for a single run. Also rejects these flags from any surface that spawns the CLI with them internally, currently Cowork local sessions in the desktop app. A --mcp-config whose servers are all in-process type: \\"sdk\\" entries is still accepted, so the Agent SDK and VS Code extension keep working. Does not block claude mcp add, .mcp.json, or SDK setMcpServers(); pair with allowedMcpServers for per-server MCP control. Requires Claude Code v2.1.193 or later. See https://code.claude.com/docs/en/settings#available-settings"},"browserExternalPageTools":{"type":"string","description":"(Managed settings only) Set to \\"disabled\\" to prevent Claude from using tools to read or act on external pages in the desktop app's Browser pane. Users can still navigate to external sites themselves, and local dev server previews are unaffected. See https://code.claude.com/docs/en/desktop#browse-external-sites","enum":["disabled"]},"disableBrowserExternalNavigation":{"type":"boolean","description":"(Managed settings only) Set to true to turn off external browsing in the desktop app's Browser pane. Neither users nor Claude can navigate to external sites, and localhost dev server previews are unaffected. The value must be the JSON boolean true; the string \\"true\\" is ignored. See https://code.claude.com/docs/en/desktop#browse-external-sites"},"disableMobileSimulatorTools":{"type":"boolean","description":"(Managed settings only) Set to true to block Claude's tools for the desktop app's iOS Simulator pane. Users keep manual use of the pane; only Claude's access is removed. The value must be the JSON boolean true; any other value is ignored, and a malformed value such as \\"true\\" or 1 logs a warning. See https://code.claude.com/docs/en/desktop-ios-simulator#turn-off-simulator-access"},"requireCoworkFullVmSandbox":{"type":"boolean","description":"(Managed settings only) Run Claude's tools inside an isolated virtual machine instead of on your Mac. Disables the desktop app's iOS Simulator pane and Claude's simulator tools entirely, so the pane cannot attach a device while it is set. See https://code.claude.com/docs/en/desktop-ios-simulator#turn-off-simulator-access"}}`),Ci="Claude Code Settings",pn={$schema:yi,$id:bi,$defs:xi,description:vi,allowTrailingCommas:wi,additionalProperties:ki,type:Ei,properties:Si,title:Ci};function _i(t){const s=t??{},n={...s.$defs??{},...s.definitions??{}},o=h=>{if(!h)return{};if(!h.$ref)return r(h);const f=/^#\/(\$defs|definitions)\/(.+)$/.exec(h.$ref);if(!f)return r(h);const b=n[f[2]];return b?o({...b,...l(h)}):r(h)},i=new Set(["__proto__","constructor","prototype"]),a=h=>{if(!h)return{};const f={};for(const[b,y]of Object.entries(h))i.has(b)||(f[b]=y);return f},r=h=>{if(!h.allOf||h.allOf.length===0)return h;const f={...h};delete f.allOf;for(const b of h.allOf){const y=o(b);Object.assign(f,{properties:{...a(f.properties),...a(y.properties)},required:Ai([...f.required??[],...y.required??[]])}),!f.description&&y.description&&(f.description=y.description),f.default===void 0&&y.default!==void 0&&(f.default=y.default),!f.type&&y.type&&(f.type=y.type)}return f},l=h=>{const{$ref:f,...b}=h;return b},d=(h,f)=>{let b=o(h);for(const y of f){if(!b)return null;if(/^\d+$/.test(y)){const O=Array.isArray(b.items)?b.items[Number(y)]:b.items;b=O?o(O):null;continue}const k=b.properties;if(k&&!i.has(y)&&y in k){b=o(k[y]);continue}const w=b.additionalProperties;if(w&&typeof w=="object"){b=o(w);continue}return null}return b},c=(h,f,b)=>{if(!h)return null;const y={};if(h.description&&(y.description=h.description),h.type&&(y.type=h.type),h.default!==void 0&&(y.default=h.default),h.enum&&(y.enum=h.enum),h.const!==void 0&&(y.const=h.const),h.deprecated&&(y.deprecated=!0),h.examples&&(y.examples=h.examples),h.properties&&(y.knownChildren=Object.keys(h.properties)),b&&(f!=null&&f.includes(b))&&(y.required=!0),h.items&&!Array.isArray(h.items)){const k=o(h.items),w=c(k,void 0,null);w&&(y.itemsInfo=w)}return(h.additionalProperties===!0||typeof h.additionalProperties=="object")&&(y.open=!0),y},p=h=>f=>{if(f.length===0)return c(o(h),void 0,null);const b=d(h,f.slice(0,-1));if(!b)return null;const y=f[f.length-1],k=d(b,[y]);return c(k,b.required,y)},m=h=>{const f=o(h);return Object.keys(f.properties??{})},g=h=>({at:p(h),rootKeys:()=>m(h),rootedAt:f=>{const b=d(h,f);return g(b??{})}});return g(s)}function Ai(t){return Array.from(new Set(t))}let jt=null;function un(){return jt||(jt=_i(pn)),jt}const Ni=["allow","deny","ask"],gs="This settings file has invalid JSON. Fix it in the Settings raw editor first; Permissions will not overwrite it.";function ji(t){if(t.trim()==="")return{perms:{},full:{},err:null};try{const s=JSON.parse(t);if(s===null||typeof s!="object"||Array.isArray(s))return{perms:{},full:{},err:"settings file is not a JSON object"};const n=s;return{perms:n.permissions??{},full:n,err:null}}catch(s){return{perms:{},full:{},err:s.message}}}function Oi({scope:t="user"}={}){const s=Oe(),n=Et(),o=(n==null?void 0:n.cwd)??null,i=Gs(h=>h.navFace),[a,r]=u.useState("rules");u.useEffect(()=>{i==="project"&&a==="presets"&&r("rules")},[i,a]);const d=zt(zn,s,o)[t]??null,c=G(h=>h.files),p=e.jsx(Ws,{options:[{key:"rules",label:"Rules"},...i==="home"?[{key:"presets",label:"Presets"}]:[]],active:a,onChange:r});if(!s)return e.jsx(K,{title:"loading…"});if(a==="presets")return e.jsx(qe,{toolbar:p,children:e.jsx(fi,{})});const m=h=>h!=="user"&&!o,g=d?c[d]:null;return e.jsx(qe,{toolbar:e.jsxs(e.Fragment,{children:[p,e.jsx("span",{className:"ml-3 text-fg-faint truncate",children:d??"—"}),e.jsx("div",{className:"flex-1"}),e.jsx("a",{href:"https://code.claude.com/docs/en/settings#permissions",target:"_blank",rel:"noreferrer",className:"text-fg-faint hover:text-fg-dim underline-offset-2 hover:underline",children:"rule syntax ↗"})]}),children:m(t)?e.jsx(K,{title:"no active project",hint:"open a tab in a project directory to edit project or local permissions"}):d&&g?e.jsx(mn,{scope:t,cwd:o,activePath:d}):e.jsx(K,{title:"resolving…"})})}u.memo(Oi);function mn({scope:t,cwd:s,activePath:n}){const o=G(c=>c.files[n]),{perms:i,err:a}=o?ji(o.draftRaw):{perms:{},err:null},r=(c,p)=>{if(a){W.error(gs);return}window.api.claudeConfig.patch({fileId:"settings",scope:t,cwd:s,keyPath:["permissions",c],value:p}).catch(m=>W.error(m instanceof Error?m.message:String(m)))},l=(c,p)=>{const m=p.trim();if(!m)return;const g=i[c]??[];g.includes(m)||r(c,[...g,m])},d=(c,p)=>{const m=i[c]??[];r(c,m.filter((g,h)=>h!==p))};return e.jsxs("div",{className:"p-4 space-y-5 max-w-3xl",children:[a&&e.jsxs("div",{role:"alert",className:"text-xs text-red-400 border border-red-400/40 rounded px-3 py-2",children:[gs," (",a,")"]}),e.jsx(Ti,{value:i.defaultMode??"default",onChange:c=>r("defaultMode",c)}),Ni.map(c=>e.jsx(Li,{list:c,rules:i[c]??[],disabled:!!a,onAdd:p=>l(c,p),onRemove:p=>d(c,p)},c)),e.jsx(Di,{dirs:i.additionalDirectories??[],disabled:!!a,onChange:c=>r("additionalDirectories",c)})]})}function Ti({value:t,onChange:s}){var a;const o=(((a=un().at(["permissions","defaultMode"]))==null?void 0:a.enum)??[]).filter(r=>typeof r=="string"),i=t&&!o.includes(t)?[...o,t]:o;return e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs text-fg uppercase tracking-wider mb-2",children:"Default Mode"}),e.jsx("div",{className:"inline-flex rounded border border-line overflow-hidden",children:i.map(r=>e.jsx("button",{onClick:()=>s(r),className:`px-2.5 py-1 text-xs transition-colors ${t===r?"bg-bg-hi text-fg":"bg-bg-elev text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:r},r))})]})}function Li({list:t,rules:s,onAdd:n,onRemove:o,disabled:i}){const[a,r]=u.useState(""),l=t==="allow"?"text-green-400":t==="deny"?"text-red-400":"text-yellow-400";return e.jsxs("section",{children:[e.jsx("h3",{className:`text-xs uppercase tracking-wider mb-2 ${l}`,children:t}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx("input",{value:a,disabled:i,onChange:d=>r(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(n(a),r(""))},placeholder:t==="allow"?"e.g. Bash(ls:*) or Read(~/.claude/**)":"e.g. Write(/etc/**)",className:"flex-1 bg-bg-elev border border-line rounded px-2 py-1 text-xs text-fg placeholder-fg-faint"}),e.jsx("button",{onClick:()=>{n(a),r("")},disabled:i||!a.trim(),className:"px-2.5 py-1 border border-line rounded text-xs text-fg-dim hover:text-fg hover:bg-bg-hi disabled:opacity-40",children:"add"})]}),s.length===0?e.jsx("div",{className:"text-fg-faint text-xs",children:"no rules"}):e.jsx("ul",{className:"space-y-0.5",children:s.map((d,c)=>e.jsxs("li",{className:"flex items-center gap-2 text-xs font-mono bg-bg-elev border border-line rounded px-2 py-1",children:[e.jsx("span",{className:"flex-1 text-fg-dim truncate",children:d}),e.jsx("button",{onClick:()=>o(c),className:"text-fg-faint hover:text-red-400",title:"remove",children:"×"})]},`${c}-${d}`))})]})}function Di({dirs:t,onChange:s,disabled:n}){const[o,i]=u.useState("");return e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs text-fg uppercase tracking-wider mb-2",children:"Additional Directories"}),e.jsx("div",{className:"flex gap-2 mb-2",children:e.jsx("input",{value:o,disabled:n,onChange:a=>i(a.target.value),onKeyDown:a=>{a.key==="Enter"&&o.trim()&&(s([...t,o.trim()]),i(""))},placeholder:"/absolute/path/to/dir",className:"flex-1 bg-bg-elev border border-line rounded px-2 py-1 text-xs text-fg placeholder-fg-faint"})}),e.jsx("ul",{className:"space-y-0.5",children:t.map((a,r)=>e.jsxs("li",{className:"flex items-center gap-2 text-xs font-mono bg-bg-elev border border-line rounded px-2 py-1",children:[e.jsx("span",{className:"flex-1 text-fg-dim truncate",children:a}),e.jsx("button",{onClick:()=>s(t.filter((l,d)=>d!==r)),className:"text-fg-faint hover:text-red-400",children:"×"})]},`${r}-${a}`))})]})}function Pi({sidebar:t,detail:s,sidebarWidth:n="18rem"}){return e.jsxs("div",{className:"h-full flex",children:[e.jsx("div",{className:"shrink-0 border-r border-line overflow-y-auto",style:{width:n},children:t}),e.jsx("div",{className:"flex-1 min-w-0 overflow-auto",children:s})]})}const ys=t=>`${t}/.claude/session-manager/provenance.json`;function Ri(t){if(!t||typeof t!="object")return{};const s={};for(const[n,o]of Object.entries(t))(o==="anthropic"||o==="community"||o==="local")&&(s[n]=o);return s}const Ut=Kt((t,s)=>({overrides:{},loaded:!1,loading:!1,home:null,load:async n=>{const o=s();if(!(o.home===n&&(o.loaded||o.loading))){t({home:n,loading:!0});try{const i=await window.api.config.readJson(ys(n)),a=i.exists?Ri(i.data):{};t(r=>({overrides:{...a,...r.overrides},loaded:!0,loading:!1}))}catch{t({loaded:!0,loading:!1})}}},setOverride:async(n,o)=>{const i={...s().overrides};o===null?delete i[n]:i[n]=o,t({overrides:i});const a=s().home;if(a)try{await window.api.config.writeJson(ys(a),i)}catch{}}})),Ne=t=>(t??"").toLowerCase().trim(),hn=new Set,fn=new Set;for(const t of It){const s=t.official?hn:fn;s.add(Ne(t.id)),s.add(Ne(t.name))}const Ii=new Set(vt.filter(t=>t.official).flatMap(t=>[Ne(t.id),Ne(t.name)])),Mi=new Set(vt.filter(t=>!t.official).flatMap(t=>[Ne(t.id),Ne(t.name)])),Ui=new Set(ai.flatMap(t=>[Ne(t.id),Ne(t.name)])),$i=new Set(wt.flatMap(t=>[Ne(t.id),Ne(t.name)])),Bi=new Set(wt.map(t=>t.command.trim())),Fi=new Set(["security-review","pr-comments","release-notes","add-dir","code-review","simplify"]),Hi=/(@anthropic-ai\/|anthropic\.com|github\.com\/anthropics)/i,Gi=/(^|\s)(npx|uvx|pipx|bunx|mcp-remote|deno\s+run|docker\s+run)(\s|$)/i;function Wi(t){return[t.command,...t.args??[],t.url,t.repository,t.homepage].filter(Boolean).join(" ").toLowerCase()}const Fe=t=>({provenance:"anthropic",reason:t}),$t=t=>({provenance:"community",reason:t});function qi(t,s,n){switch(t){case"mcp":return hn.has(s)?Fe("official MCP server (catalog)"):fn.has(s)?$t("third-party server (catalog)"):null;case"skill":case"command":return Ii.has(s)?Fe("official Anthropic skill (catalog)"):Mi.has(s)?$t("third-party skill (catalog)"):null;case"plugin":return null;case"subagent":return Ui.has(s)?Fe("bundled Anthropic subagent (catalog)"):null;case"hook":return $i.has(s)||n&&Bi.has(n.trim())?Fe("bundled hook (catalog)"):null}}function Ki(t,s){return t.repository?"has a source repository":t.homepage?"has a homepage":t.url?"remote endpoint":Gi.test(s)?"installed from a package registry":null}function Bt(t){const s=Ne(t.name),n=Wi(t),o=qi(t.type,s,t.command);if(o)return o;if((t.type==="command"||t.type==="skill")&&Fi.has(s))return Fe("built-in Claude Code command");if(Hi.test(n))return Fe("Anthropic package or repo");const i=Ki(t,n);return i?$t(i):{provenance:"local",reason:"no external source — assumed self-created"}}function gn(t,s,n){return`${t}:${s??"-"}:${n}`}const De={anthropic:"Anthropic",community:"Community",local:"Local"},bs={anthropic:"accent",community:"warn",local:"dim"},Vi=["anthropic","community","local"];function yn({input:t,scope:s,interactive:n=!0,className:o=""}){const i=Oe(),{overrides:a,load:r,setOverride:l}=Ut(),[d,c]=u.useState(!1),p=u.useRef(null);u.useEffect(()=>{i&&r(i)},[i,r]),u.useEffect(()=>{if(!d)return;const k=O=>{p.current&&!p.current.contains(O.target)&&c(!1)},w=O=>{O.key==="Escape"&&c(!1)};return window.addEventListener("mousedown",k),window.addEventListener("keydown",w),()=>{window.removeEventListener("mousedown",k),window.removeEventListener("keydown",w)}},[d]);const m=gn(t.type,s??null,t.name),g=Bt(t),h=a[m],f=h??g.provenance,b=h?`Origin manually set to ${De[f]} — auto-detected ${De[g.provenance]} (${g.reason})`:`Auto-detected ${De[f]}: ${g.reason}`,y=e.jsxs(ye,{tone:bs[f],title:b,className:`${n?"cursor-pointer hover:brightness-125":""} ${o}`,children:[De[f],h&&e.jsx("span",{className:"w-1 h-1 rounded-full bg-current opacity-70","aria-hidden":!0})]});return n?e.jsxs("span",{ref:p,className:"relative inline-flex",children:[e.jsx("button",{type:"button",onClick:k=>{k.stopPropagation(),c(w=>!w)},className:"inline-flex","aria-label":`Origin: ${De[f]}. Click to change.`,children:y}),d&&e.jsxs("span",{className:`absolute ${je.dialog} top-full right-0 mt-1 min-w-[7.5rem] rounded-md border border-line bg-bg-elev shadow-lg py-1 text-left`,onClick:k=>k.stopPropagation(),children:[e.jsx("span",{className:"block px-2 pb-1 text-[10px] uppercase tracking-wide text-fg-faint",children:"Mark origin as"}),Vi.map(k=>e.jsxs("button",{type:"button",onClick:()=>{l(m,k),c(!1)},className:`flex w-full items-center gap-2 px-2 py-1 text-[12px] hover:bg-bg-hi/60 ${f===k?"text-fg":"text-fg-dim"}`,children:[e.jsx("span",{className:`w-2 h-2 rounded-full border ${Xn[bs[k]]}`,"aria-hidden":!0}),De[k],h===k&&e.jsx("span",{className:"ml-auto text-[10px] text-fg-faint",children:"set"})]},k)),e.jsx("div",{className:"my-1 border-t border-line"}),e.jsxs("button",{type:"button",onClick:()=>{l(m,null),c(!1)},disabled:!h,className:"flex w-full items-center gap-2 px-2 py-1 text-[12px] text-fg-dim hover:bg-bg-hi/60 disabled:opacity-40 disabled:hover:bg-transparent",title:`Revert to auto-detection (${De[g.provenance]})`,children:["Auto-detect",e.jsx("span",{className:"ml-auto text-[10px] text-fg-faint",children:De[g.provenance]})]})]})]}):y}const zi={UserPromptSubmit:{when:"Fires just before the user prompt is sent to the model.",payload:"{ prompt: string }",example:"Block submission if the prompt mentions a secret."},UserPromptExpansion:{when:"Fires when a slash command expands into its final prompt text.",payload:"{ command: string, expanded: string }",example:"Audit which slash commands actually run, post-expansion."},PreToolUse:{when:"Fires before any tool runs. Can block the call.",payload:"{ tool_name: string, tool_input: object }",example:'matcher="Bash" — block dangerous shell commands.'},PostToolUse:{when:"Fires after a tool completes successfully.",payload:"{ tool_name: string, tool_input: object, tool_result: string }",example:'matcher="Write|Edit" — run a linter on changed files.'},PostToolUseFailure:{when:"Fires after a tool errors out (non-zero exit, exception, or refusal).",payload:"{ tool_name: string, tool_input: object, error: string }",example:"Pipe failed Bash runs into a desktop notification."},PostToolBatch:{when:"Fires once after a parallel batch of tool calls all complete.",payload:"{ tool_uses: Array<{ tool_name, tool_input, tool_result? }> }",example:"Aggregate file-edit batches into a single commit message."},Stop:{when:"Fires when the model emits end_turn.",payload:"{ stop_reason: string, output_tokens: number }",example:"Play a chime when the agent finishes a long task."},StopFailure:{when:"Fires when a turn aborts without end_turn (rate-limit, network, OOM).",payload:'{ reason: "rate_limit"|"network"|"oom"|"killed"|string }',example:"Auto-resume on transient failures."},SessionStart:{when:"Fires once when a session boots (claude or claude -p).",payload:'{ source: "startup"|"resume", model: string, agent_type: string }',example:"Inject a project-specific system prompt addendum."},SessionEnd:{when:"Fires once when the session terminates.",payload:'{ reason: "user_quit"|"timeout"|"error"|string }',example:"Persist transcript summary to ~/.claude/projects/<>."},Setup:{when:"Fires during interactive setup (claude /setup, /init).",payload:'{ mode: "init"|"reconfigure"|string }'},PreCompact:{when:"Fires before transcript compaction runs.",payload:'{ transcript_path: string, trigger: "manual"|"auto" }',example:"Snapshot the pre-compact transcript for later diffing."},PostCompact:{when:"Fires after compaction; the active transcript is the compacted one.",payload:'{ transcript_path: string, trigger: "manual"|"auto" }'},InstructionsLoaded:{when:"Fires after CLAUDE.md and any imported memory files are loaded.",payload:'{ source: "session_start"|"reload" }'},Notification:{when:"Fires when Claude Code emits a desktop notification.",payload:"{ title: string, message: string }",example:"Forward to your own notify-send / osascript pipeline."},PermissionRequest:{when:"Fires when a tool needs user permission (per the permissions block).",payload:"{ tool_name: string, tool_input?: object }",example:"Auto-allow npm test invocations."},PermissionDenied:{when:"Fires when the user (or policy) denies a permission request.",payload:"{ tool_name: string, retry: boolean }",example:"Track which tools the user habitually rejects."},SubagentStart:{when:"Fires when a subagent (Task tool) spawns.",payload:"{ agent_type: string }",example:'matcher="security-reviewer" — log every security scan.'},SubagentStop:{when:"Fires when a subagent finishes.",payload:'{ agent_type: string, reason: "end_turn"|"error"|string }'},TeammateIdle:{when:"Fires when a teammate agent goes idle (waiting for input).",payload:"{ teammate_id?: string }"},TaskCreated:{when:"Fires when a new Task is created via the Task tool.",payload:"{ task: { description: string, ...} }",example:"Track each spawned task in an external queue."},TaskCompleted:{when:"Fires when a Task completes (success or failure).",payload:"{ task: { description: string, ...} }"},ConfigChange:{when:"Fires when settings.json (any scope) is mutated mid-session.",payload:'{ source: "user_settings"|"project_settings"|"local_settings" }',example:"Reload tooling that depends on env vars on config change."},CwdChanged:{when:"Fires when the working directory changes (e.g. agent cd-ing).",payload:"{ old_cwd: string, new_cwd: string }",example:"Refresh project-scoped indexers when cwd drifts."},FileChanged:{when:"Fires when a watched file outside Claude Code's edits changes.",payload:'{ file_path: string, change_type: "modified"|"created"|"deleted" }',example:"Re-run typecheck when any .ts file changes."},WorktreeCreate:{when:"Fires after a git worktree is created via /worktree or subagent isolation.",payload:"{ worktree_path?: string, branch?: string }"},WorktreeRemove:{when:"Fires after a git worktree is removed.",payload:"{ worktree_path?: string }"},Elicitation:{when:"Fires when Claude asks the user a multiple-choice question.",payload:'{ action: "accept"|"reject", ...}'},ElicitationResult:{when:"Fires after the user resolves an elicitation prompt.",payload:"{ choice?: string }"}},bn=["UserPromptSubmit","UserPromptExpansion","PreToolUse","PostToolUse","PostToolUseFailure","PostToolBatch","Stop","StopFailure","SessionStart","SessionEnd","Setup","PreCompact","PostCompact","InstructionsLoaded","Notification","PermissionRequest","PermissionDenied","SubagentStart","SubagentStop","TeammateIdle","TaskCreated","TaskCompleted","ConfigChange","CwdChanged","FileChanged","WorktreeCreate","WorktreeRemove","Elicitation","ElicitationResult"],Xi=new Set(bn),Yi=["command","http","prompt","agent","mcp_tool"],Ji={UserPromptSubmit:{prompt:"hello"},UserPromptExpansion:{command:"/example",expanded:"hello"},PreToolUse:{tool_name:"Bash",tool_input:{command:"ls"}},PostToolUse:{tool_name:"Bash",tool_input:{command:"ls"},tool_result:""},PostToolUseFailure:{tool_name:"Bash",tool_input:{command:"ls"},error:""},PostToolBatch:{tool_uses:[]},Stop:{stop_reason:"end_turn",output_tokens:0},StopFailure:{reason:"rate_limit"},SessionStart:{source:"startup",model:"",agent_type:""},SessionEnd:{reason:"user_quit"},Setup:{mode:"init"},PreCompact:{transcript_path:"",trigger:"manual"},PostCompact:{transcript_path:"",trigger:"manual"},InstructionsLoaded:{source:"session_start"},Notification:{title:"test",message:"test notification"},PermissionRequest:{tool_name:"Bash"},PermissionDenied:{tool_name:"Bash",retry:!1},SubagentStart:{agent_type:"general-purpose"},SubagentStop:{agent_type:"general-purpose",reason:"end_turn"},TeammateIdle:{},TaskCreated:{task:{description:""}},TaskCompleted:{task:{description:""}},ConfigChange:{source:"user_settings"},CwdChanged:{old_cwd:"",new_cwd:""},FileChanged:{file_path:"",change_type:"modified"},WorktreeCreate:{},WorktreeRemove:{},Elicitation:{action:"accept"},ElicitationResult:{}},xs="This settings file has invalid JSON. Fix it in the Settings raw editor first; Hooks will not overwrite it.";function Qi(t){if(t.trim()==="")return{full:{},hooks:{},err:null};try{const s=JSON.parse(t);if(s===null||typeof s!="object"||Array.isArray(s))return{full:{},hooks:{},err:"settings file is not a JSON object"};const n=s;return{full:n,hooks:n.hooks??{},err:null}}catch(s){return{full:{},hooks:{},err:s.message}}}function Zi(t,s){return(t[s]??[]).reduce((n,o)=>{var i;return n+(((i=o.hooks)==null?void 0:i.length)??0)},0)}function er({scope:t="user"}={}){const s=Oe(),n=Et(),o=(n==null?void 0:n.cwd)??null,i=Gs(p=>p.navFace),[a,r]=u.useState("events");u.useEffect(()=>{i==="project"&&a==="library"&&r("events")},[i,a]);const d=zt(qs,s,o)[t]??null,c=e.jsx(Ws,{options:[{key:"events",label:"Events"},...i==="home"?[{key:"library",label:"Library"}]:[]],active:a,onChange:r});return s?a==="library"?e.jsx(qe,{toolbar:c,children:e.jsx(hi,{})}):t!=="user"&&!o?e.jsx(qe,{toolbar:e.jsx(e.Fragment,{children:c}),children:e.jsx(K,{title:"no active project"})}):d?e.jsx(qe,{toolbar:e.jsxs(e.Fragment,{children:[c,e.jsx("span",{className:"ml-3 text-fg-faint truncate",children:d}),e.jsx("div",{className:"flex-1"}),e.jsx("a",{href:"https://code.claude.com/docs/en/hooks",target:"_blank",rel:"noreferrer",className:"text-fg-faint hover:text-fg-dim underline-offset-2 hover:underline",children:"hook reference ↗"})]}),children:e.jsx(xn,{scope:t,cwd:o,path:d})}):e.jsx(K,{title:"loading…"}):e.jsx(K,{title:"loading…"})}function xn({scope:t,cwd:s,path:n,renderLayout:o}){const[i,a]=u.useState("PreToolUse"),[r,l]=u.useState(null),d=(_,j)=>{window.api.claudeConfig.patch({fileId:"settings",scope:t,cwd:s,keyPath:_,value:j}).catch(A=>W.error(A instanceof Error?A.message:String(A)))},c=G(_=>_.files[n]),{hooks:p,err:m}=c?Qi(c.draftRaw):{hooks:{},err:null},g=Object.keys(p).filter(_=>!Xi.has(_)),h=g.reduce((_,j)=>_+(p[j]??[]).reduce((A,L)=>{var T;return A+(((T=L.hooks)==null?void 0:T.length)??0)},0),0),f=(_,j)=>{if(m){W.error(xs);return}d(["hooks",_],j)},b=p[i]??[],y=()=>{f(i,[...b,{matcher:"",hooks:[{type:"command",command:""}]}])},k=(_,j)=>{const A=b.slice();A[_]=j,f(i,A)},w=_=>{f(i,b.filter((j,A)=>A!==_))},O=e.jsxs(e.Fragment,{children:[m?e.jsxs("div",{role:"alert",className:"px-3 py-2 border-b border-line text-xs text-red-400",children:[xs," (",m,")"]}):null,h>0?e.jsxs("div",{className:"px-3 py-2 border-b border-line text-xs bg-bg-elev text-fg-dim",children:[e.jsx("span",{className:"text-yellow-400",children:"⚠"})," ",h," hook(s) configured under unknown event names: ",e.jsx("span",{className:"font-mono text-fg",children:g.join(", ")}),e.jsx("span",{className:"text-fg-faint",children:" · these are ignored by Claude Code 2026; edit settings.json directly to remove."})]}):null]}),D=m||h>0?O:null,C=e.jsx("div",{className:"py-1",children:bn.map(_=>{const j=Zi(p,_),A=zi[_],L=A?e.jsxs("span",{className:"block space-y-1",children:[e.jsx("span",{className:"block text-fg",children:A.when}),e.jsxs("span",{className:"block text-fg-faint font-mono",children:["payload: ",A.payload]}),A.example?e.jsxs("span",{className:"block text-fg-faint italic",children:["e.g. ",A.example]}):null]}):e.jsx("span",{className:"text-fg-faint italic",children:"no documentation yet"});return e.jsx("div",{className:"[&>span]:w-full",children:e.jsx(Fs,{content:L,align:"bottom-center",children:e.jsxs("button",{onClick:()=>a(_),title:A==null?void 0:A.when,className:`w-full text-left px-3 py-1 text-xs ${i===_?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"truncate",children:_}),j>0&&e.jsx("span",{className:"text-accent shrink-0 ml-2",children:j})]}),A?e.jsx("span",{className:"block text-[11px] leading-[1.3] text-fg-faint/80 font-normal truncate",children:A.when}):e.jsx("span",{className:"block text-[11px] leading-[1.3] text-fg-faint/80 italic font-normal truncate",children:"no documentation yet"})]})})},_)})}),E=e.jsxs("div",{className:"p-4 space-y-3 max-w-3xl",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-xs uppercase tracking-wider text-fg",children:i}),e.jsx("button",{onClick:y,disabled:!!m,className:"px-2 py-0.5 text-xs border border-line rounded text-fg-dim hover:text-fg hover:bg-bg-hi disabled:opacity-40 disabled:cursor-not-allowed",children:"+ add group"})]}),b.length===0?e.jsx("div",{className:"text-fg-faint text-xs",children:"no hooks for this event"}):b.map((_,j)=>e.jsx(tr,{group:_,jsonInvalid:!!m,onChange:A=>k(j,A),onRemove:()=>w(j),onTestFire:A=>l({event:i,matcher:_.matcher??"",command:A.command??""})},j))]});return e.jsxs(e.Fragment,{children:[o?o({banners:D,list:C,detail:E}):e.jsxs("div",{className:"flex flex-col h-full",children:[D,e.jsx(Pi,{sidebarWidth:"14rem",sidebar:C,detail:E})]}),r?e.jsx(rr,{event:r.event,matcher:r.matcher,command:r.command,onClose:()=>l(null)}):null]})}u.memo(er);function nt({value:t,onCommit:s,onDraft:n,...o}){const[i,a]=u.useState(t);u.useEffect(()=>a(t),[t]);const r=()=>{i!==t&&s(i)};return e.jsx("input",{...o,value:i,onChange:l=>{a(l.target.value),n==null||n(l.target.value)},onBlur:r,onKeyDown:l=>{l.key==="Enter"&&r()}})}function tr({group:t,jsonInvalid:s,onChange:n,onRemove:o,onTestFire:i}){const a=()=>n({...t,hooks:[...t.hooks??[],{type:"command",command:""}]}),r=(d,c)=>{const p=t.hooks.slice();p[d]=c,n({...t,hooks:p})},l=d=>n({...t,hooks:t.hooks.filter((c,p)=>p!==d)});return e.jsxs("div",{className:"border border-line rounded p-3 bg-bg-elev space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-fg-faint w-16",children:"matcher"}),e.jsx(nt,{value:t.matcher??"",disabled:s,onCommit:d=>n({...t,matcher:d}),placeholder:"tool name regex or exact match (optional)",className:"flex-1 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg font-mono"}),e.jsx("button",{onClick:o,disabled:s,className:"text-fg-faint hover:text-red-400 text-xs disabled:opacity-40",title:"remove group",children:"× group"})]}),(t.hooks??[]).map((d,c)=>e.jsx(nr,{rule:d,jsonInvalid:s,onChange:p=>r(c,p),onRemove:()=>l(c),onTestFire:()=>i(d)},c)),e.jsx("button",{onClick:a,disabled:s,className:"text-xs text-fg-faint hover:text-fg disabled:opacity-40",children:"+ add hook"})]})}function sr(t){var n,o,i;const s=((o=(n=pn.$defs)==null?void 0:n.hookCommand)==null?void 0:o.anyOf)??[];for(const a of s){const r=a.properties;if(((i=r==null?void 0:r.type)==null?void 0:i.const)!==t)continue;const l=r.timeout;if(typeof(l==null?void 0:l.default)=="number")return l.default;const d=/default:\s*(\d+)/.exec((l==null?void 0:l.description)??"");return d?Number(d[1]):null}return null}function vs(t){return/^\d+$/.test(t.trim())&&Number(t)>0?Number(t):null}function nr({rule:t,jsonInvalid:s,onChange:n,onRemove:o,onTestFire:i}){const a=h=>({command:"e.g. node ./scripts/lint.js $FILE",http:"e.g. https://hooks.example.com/notify",prompt:"e.g. Review this change for security issues",agent:"e.g. security-reviewer",mcp_tool:"e.g. mcp__server__tool"})[h],r=t.type==="command"?"command":t.type==="http"?"url":t.type==="prompt"?"prompt":t.type==="mcp_tool"?"mcpTool":"agent",l=t[r]??"",d=(t.args??[]).join(" "),[c,p]=u.useState(null),m=sr(t.type),g={type:"hook",name:l||t.type,command:t.type==="command"?t.command:void 0,url:t.type==="http"?t.url:void 0};return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("select",{value:t.type,disabled:s,onChange:h=>n({type:h.target.value}),className:"bg-bg border border-line rounded px-1 py-0.5 text-xs text-fg",children:Yi.map(h=>e.jsx("option",{value:h,children:h},h))}),e.jsx(yn,{interactive:!1,input:g}),e.jsx(nt,{value:l,disabled:s,onCommit:h=>n({...t,[r]:h}),placeholder:a(t.type),className:`flex-1 bg-bg border rounded px-2 py-0.5 text-xs text-fg font-mono ${s?"border-red-500/70":l.trim()?"border-line":"border-yellow-600/50"}`}),s?e.jsx("span",{className:"text-red-400 text-xs",title:"The enclosing settings.json is malformed; fix the JSON before editing.",children:"× invalid"}):null,e.jsx(nt,{value:t.timeout!=null?String(t.timeout):"",disabled:s,"aria-label":"timeout (seconds)","aria-invalid":c?!0:void 0,title:c??"Timeout in seconds",onDraft:h=>{p(!h.trim()||vs(h)!=null?null:"Timeout must be a positive whole number of seconds")},onCommit:h=>{if(!h.trim()){n({...t,timeout:void 0});return}const f=vs(h);f!=null&&n({...t,timeout:f})},placeholder:m!=null?`${m} (seconds)`:"seconds",className:`w-24 bg-bg border rounded px-2 py-0.5 text-xs text-fg ${c?"border-red-500/70":"border-line"}`}),c?e.jsx("span",{role:"alert",className:"text-red-400 text-xs",children:c}):null,t.type==="command"?e.jsx("button",{onClick:i,disabled:s||!l.trim(),className:"px-2 py-0.5 text-xs border border-line rounded text-fg-dim hover:text-fg hover:bg-bg-hi disabled:opacity-40 disabled:cursor-not-allowed",title:"Run this command with a fake event payload",children:"test fire"}):null,e.jsx("button",{onClick:o,disabled:s,className:"text-fg-faint hover:text-red-400 text-xs disabled:opacity-40",children:"×"})]}),t.type==="command"?e.jsxs("div",{className:"flex items-center gap-2 pl-[3.75rem]",children:[e.jsx("span",{className:"text-xs text-fg-faint w-12",children:"args"}),e.jsx(nt,{value:d,disabled:s,onCommit:h=>n({...t,args:h.trim()?h.split(/\s+/).filter(Boolean):void 0}),placeholder:"argv array (v2.1.139+ exec form, no shell)",className:"flex-1 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg font-mono"})]}):null,e.jsxs("div",{className:"flex items-center gap-2 pl-[3.75rem]",children:[e.jsx("span",{className:"text-xs text-fg-faint w-12",children:"term"}),e.jsx(nt,{value:t.terminalSequence??"",disabled:s,onCommit:h=>n({...t,terminalSequence:h||void 0}),placeholder:"terminalSequence — e.g. \\\\a (bell), v2.1.141+",className:"flex-1 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg font-mono"})]})]})}function or(t){return JSON.stringify(Ji[t]??{},null,2)}function ir(t,s){if(!t.trim())return{matched:!0,target:null,note:"empty matcher → matches all"};const n=s&&typeof s=="object"&&"tool_name"in s?String(s.tool_name??""):null;if(n==null)return{matched:!1,target:null,note:"payload has no tool_name to match against"};try{return{matched:new RegExp(`^(?:${t})$`).test(n),target:n}}catch{return{matched:t===n,target:n,note:"matcher not valid regex; fell back to exact match"}}}function rr({event:t,matcher:s,command:n,onClose:o}){const[i,a]=u.useState(()=>or(t)),[r,l]=u.useState(!1),[d,c]=u.useState(null),[p,m]=u.useState(null);let g=null;try{JSON.parse(i)}catch(f){g=f.message}const h=async()=>{l(!0),c(null);let f=null;try{f=JSON.parse(i)}catch{}m(ir(s,f));try{const b=await window.api.app.testFireHook({command:n,payload:i,timeoutMs:5e3});c(b)}finally{l(!1)}};return e.jsx(Yn,{open:!0,onClose:o,title:`Test fire — ${t}`,children:e.jsxs("div",{className:"space-y-3 text-xs",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-fg-faint mb-1",children:"resolved command"}),e.jsx("div",{className:"font-mono text-fg bg-bg border border-line rounded px-2 py-1 break-all",children:n})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-fg-faint mb-1",children:"matcher"}),e.jsx("div",{className:"font-mono text-fg bg-bg border border-line rounded px-2 py-1",children:s||e.jsx("span",{className:"text-fg-faint",children:"(empty — matches all)"})})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-fg-faint",children:"fake event payload (stdin)"}),g?e.jsxs("span",{className:"text-red-400",children:["× ",g]}):null]}),e.jsx("textarea",{value:i,onChange:f=>a(f.target.value),rows:8,className:`w-full bg-bg border rounded px-2 py-1 font-mono text-fg ${g?"border-red-500/70":"border-line"}`})]}),p?e.jsxs("div",{children:[e.jsx("div",{className:"text-fg-faint mb-1",children:"matcher result"}),e.jsxs("div",{className:"font-mono",children:[e.jsx("span",{className:p.matched?"text-green-400":"text-red-400",children:p.matched?"✓ match":"✗ no match"}),p.target!=null?e.jsxs("span",{className:"text-fg-dim",children:[' · target tool_name="',p.target,'"']}):null,p.note?e.jsx("div",{className:"text-fg-faint",children:p.note}):null]})]}):null,d?e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"text-fg-faint",children:["exit ",d.exitCode," · ",d.durationMs,"ms"]}),d.stdout?e.jsxs("div",{children:[e.jsx("div",{className:"text-fg-faint",children:"stdout"}),e.jsx("pre",{className:"bg-bg border border-line rounded p-2 font-mono text-fg whitespace-pre-wrap break-all max-h-40 overflow-auto",children:d.stdout})]}):null,d.stderr?e.jsxs("div",{children:[e.jsx("div",{className:"text-fg-faint",children:"stderr"}),e.jsx("pre",{className:"bg-bg border border-line rounded p-2 font-mono text-red-300 whitespace-pre-wrap break-all max-h-40 overflow-auto",children:d.stderr})]}):null]}):null,e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[e.jsx("button",{onClick:o,className:"px-2 py-0.5 text-xs border border-line rounded text-fg-dim hover:text-fg hover:bg-bg-hi",children:"close"}),e.jsx("button",{onClick:h,disabled:r||!!g||!n.trim(),className:"px-2 py-0.5 text-xs border border-line rounded text-fg hover:bg-bg-hi disabled:opacity-40 disabled:cursor-not-allowed",children:r?"running…":"run"})]})]})})}const ar=t=>`${t}/session-manager-operations/prompt-sessions/epic-worktree-config.json`;function lr({cwd:t}){const[s,n]=u.useState(!1),[o,i]=u.useState(!1),[a,r]=u.useState(!1),[l,d]=u.useState(!1);u.useEffect(()=>{var h,f;let g=!1;return n(!1),Promise.resolve((f=(h=window.api.promptSessions)==null?void 0:h.getWorktreeDisabled)==null?void 0:f.call(h,{cwd:t})).then(b=>{g||(i((b==null?void 0:b.disabled)??!1),r((b==null?void 0:b.disabled)??!1),n(!0))},()=>{g||n(!0)}),()=>{g=!0}},[t]);const c=s&&a!==o,p=()=>{var g,h;d(!0),Promise.resolve((h=(g=window.api.promptSessions)==null?void 0:g.setWorktreeDisabled)==null?void 0:h.call(g,{cwd:t,disabled:a})).then(f=>{i((f==null?void 0:f.disabled)??a),r((f==null?void 0:f.disabled)??a)}).catch(f=>W.error(f instanceof Error?f.message:String(f))).finally(()=>d(!1))},m=()=>r(o);return e.jsxs("div",{"data-testid":"settings-epic-isolation",className:"flex flex-col flex-1 min-h-0",children:[e.jsx(Ct,{eyebrow:"PROJECT · SESSION MANAGER",title:"Epic isolation"}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto px-9 py-6 flex flex-col gap-3",children:e.jsxs(Ge,{label:"Worktree isolation",labelNote:"SESSION MANAGER'S OWN SETTING, NOT A SETTINGS.JSON KEY",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("span",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"block font-semibold text-fg",children:"Disable Epic worktree isolation for this project"}),e.jsxs("span",{className:"mt-1 block text-[13.5px] leading-snug text-fg-dim",children:["Off by default — each active Epic runs in its own isolated ",e.jsx("code",{children:"git worktree"})," (branch"," ",e.jsx("code",{children:"sm-epic/<id>"}),"), merged back to main at an explicit checkpoint. Turning this on makes every new Epic in this project run directly in the shared working tree instead, same as before this feature existed."]})]}),e.jsx("span",{"data-testid":"settings-epic-isolation-toggle",className:"shrink-0 mt-0.5",children:e.jsx(Me,{checked:a,disabled:!s||l,onChange:r})})]}),e.jsx("div",{className:"mt-3",children:e.jsx(Ys,{path:ar(t)})})]})}),c&&e.jsx("div",{className:"shrink-0 border-t border-line bg-bg-elev",children:e.jsx(_t,{dirty:c,busy:l,onSave:p,onRevert:m})})]})}const cr=["read","write","confirm","irreversible","money","public"],ws=t=>t instanceof Error?t.message:String(t),dr=(t,s)=>t.length===s.length&&t.every((n,o)=>n.rule===s[o].rule&&n.mark===s[o].mark);function pr({scope:t,cwd:s}){const n=Ks(A=>A.show),o=u.useRef(1),[i,a]=u.useState(!1),[r,l]=u.useState(null),[d,c]=u.useState({rows:[],interactive:!1}),[p,m]=u.useState([]),[g,h]=u.useState(!1),[f,b]=u.useState(!1),[y,k]=u.useState(null);u.useEffect(()=>{let A=!1;return a(!1),k(null),Promise.resolve().then(()=>window.api.toolRisk.read({scope:t,cwd:t==="project"?s:null})).then(L=>{if(A)return;if(l(L.path),!L.ok){const I=L.error??"could not read tool-risk marks";k(I),n("error",I)}const U={rows:Object.entries(L.marks??{}).map(([I,ue])=>({id:o.current++,rule:I,mark:ue})),interactive:L.interactive===!0};c(U),m(U.rows),h(U.interactive),a(!0)},L=>{if(A)return;const T=ws(L);k(T),n("error",T),a(!0)}),()=>{A=!0}},[t,s,n]);const w=i&&(!dr(p,d.rows)||t==="project"&&g!==d.interactive),O=(A,L)=>m(T=>T.map(U=>U.id===A?{...U,...L}:U)),D=A=>m(L=>L.filter(T=>T.id!==A)),C=()=>m(A=>[...A,{id:o.current++,rule:"",mark:"write"}]),E=()=>{const A={};for(const T of p)A[T.rule.trim()]=T.mark;b(!0),k(null);const L=t==="project"?{scope:t,cwd:s,marks:A,interactive:g}:{scope:t,cwd:null,marks:A};Promise.resolve().then(()=>window.api.toolRisk.write(L)).then(T=>{if(T.path&&l(T.path),!T.ok){const I=T.error??"tool-risk marks were not saved";k(I),n("error",I);return}const U=p.map(I=>({...I,rule:I.rule.trim()}));m(U),c({rows:U,interactive:t==="project"?g:!1})}).catch(T=>{const U=ws(T);k(U),n("error",U)}).finally(()=>b(!1))},_=()=>{m(d.rows),h(d.interactive),k(null)},j=t==="project"?"PROJECT · TOOL RISK":"SYSTEM · TOOL RISK";return e.jsxs("div",{"data-testid":"settings-tool-risk",className:"flex flex-col flex-1 min-h-0",children:[e.jsx(Ct,{eyebrow:j,title:"Tool risk"}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto px-9 py-6 flex flex-col gap-3",children:[e.jsxs(Ge,{label:"Marks",labelNote:"PROJECT OVERRIDES SYSTEM",children:[e.jsxs("p",{className:"text-[13.5px] leading-snug text-fg-dim",children:["One risk mark per tool rule (",e.jsx("code",{children:"mcp__server__tool"}),", ",e.jsx("code",{children:"mcp__server__*"}),","," ",e.jsx("code",{children:"Bash(prefix:*)"}),"). Project overrides System."]}),e.jsxs("div",{"data-testid":"tool-risk-rows",className:"mt-3 flex flex-col gap-2",children:[i&&p.length===0&&e.jsx("span",{"data-testid":"tool-risk-empty",className:"text-[13px] text-fg-faint",children:"No marks in this file yet."}),p.map(A=>e.jsxs("div",{"data-testid":"tool-risk-row",className:"flex items-center gap-2",children:[e.jsx("input",{type:"text","aria-label":"Tool rule","data-testid":"tool-risk-rule",value:A.rule,placeholder:"mcp__server__tool",disabled:f,onChange:L=>O(A.id,{rule:L.target.value}),className:"flex-1 min-w-0 h-8 px-2.5 rounded-[8px] bg-bg-hi border border-line font-mono text-[13px] text-fg outline-none focus:border-fg-faint"}),e.jsx("select",{"aria-label":"Risk mark","data-testid":"tool-risk-mark",value:A.mark,disabled:f,onChange:L=>O(A.id,{mark:L.target.value}),className:"h-8 px-2 rounded-[8px] bg-bg-hi border border-line text-[13px] text-fg",children:cr.map(L=>e.jsx("option",{value:L,children:L},L))}),e.jsx("button",{type:"button","data-testid":"tool-risk-remove","aria-label":`Remove ${A.rule||"mark"}`,disabled:f,onClick:()=>D(A.id),className:"h-8 px-2.5 rounded-[8px] border border-line text-[13px] text-fg-dim hover:bg-bg-hi focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",children:"Remove"})]},A.id))]}),e.jsx("div",{className:"mt-3 flex items-center gap-3",children:e.jsx("button",{type:"button","data-testid":"tool-risk-add",disabled:!i||f,onClick:C,className:"h-8 px-3 rounded-[8px] border border-line bg-bg-hi text-[13px] font-medium text-fg hover:bg-bg-elev focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",children:"+ Add mark"})}),y&&e.jsx("div",{role:"alert","data-testid":"tool-risk-refusal",className:"mt-3 text-xs text-red-400",children:y}),r&&e.jsx("div",{className:"mt-3",children:e.jsx(Ys,{path:r})})]}),t==="project"&&e.jsx(Ge,{label:"Interactive sessions",labelNote:"PROJECT ONLY",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("span",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"block font-semibold text-fg",children:"Also guard interactive sessions in this project"}),e.jsxs("span",{className:"mt-1 block text-[13.5px] leading-snug text-fg-dim",children:["Off by default — marks apply to scheduled jobs. Turning this on installs the tool-risk guard hook into this project's ",e.jsx("code",{children:".claude/settings.json"}),"."]})]}),e.jsx("span",{"data-testid":"tool-risk-interactive-toggle",className:"shrink-0 mt-0.5",children:e.jsx(Me,{checked:g,disabled:!i||f,onChange:h})})]})})]}),w&&e.jsx("div",{className:"shrink-0 border-t border-line bg-bg-elev",children:e.jsx(_t,{dirty:w,busy:f,onSave:E,onRevert:_})})]})}const ur={};function vn(t,s){if(s)return{text:s,authored:!1};const n=ur[t];return n?{text:n,authored:!0}:null}const mr={essentials:"star",git:"link",memory:"memory",model:"sparkle",interface:"eye",updates:"reload",env:"keys",hooks:"hooks",mcp:"mcp",plugins:"plugins",filesystem:"folder",login:"lock",feedback:"send",advanced:"shield",other:"dot"},hr="text-[11px] font-semibold uppercase tracking-[0.1em] text-fg-faint";function fr({node:t,schema:s}){const[n,o]=u.useState(""),[i,a]=u.useState(!1),[r,l]=u.useState(!0),d=t.kind==="object"?t:null,c=d?Object.keys(d.children):[],p=s.rootKeys(),m=new Set([...c,...p]),g=Array.from(m).sort().join(","),h=c.join(","),f=u.useMemo(()=>Qs(m),[g]),b=u.useMemo(()=>lo(m,new Set(c)),[g,h]),y=u.useMemo(()=>f.reduce((w,O)=>w+O.keys.length,0),[f]),k=u.useMemo(()=>f.filter(w=>i||!w.advanced).map(w=>({...w,keys:w.keys.filter(O=>{const D=(d==null?void 0:d.children[O])!==void 0;if(!r&&!D)return!1;if(!n.trim())return!0;const C=s.at([O]);return[O,Xe(O),(C==null?void 0:C.description)??""].join(" ").toLowerCase().includes(n.toLowerCase())})})).filter(w=>w.keys.length>0),[f,n,i,r,d,s]);return{filter:n,setFilter:o,showAdvanced:i,setShowAdvanced:a,showUnset:r,setShowUnset:l,rootNode:d,schema:s,groups:f,railGroups:b,visibleGroups:k,totalKeys:y}}function gr({cards:t,selectedId:s,onSelect:n}){return e.jsx("div",{className:"flex flex-col gap-px",role:"listbox","aria-label":"Settings groups",children:t.railGroups.map(o=>{const i=o.id===s;return e.jsxs("button",{type:"button",role:"option","aria-selected":i,"data-testid":"settings-group-row","data-group-id":o.id,onClick:()=>n(o.id),className:`w-full flex items-center gap-2.5 h-[34px] px-3 rounded-[9px] border text-left text-[13.5px] focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent ${i?"bg-bg-hi border-line font-semibold text-fg":"border-transparent text-fg-dim hover:bg-bg-hi/60"}`,children:[e.jsx(Ie,{name:mr[o.id]??"dot",size:16,className:`shrink-0 ${i?"text-accent":"text-fg-faint"}`}),e.jsx("span",{className:"flex-1 min-w-0 truncate",children:o.title}),e.jsxs("span",{className:`shrink-0 font-mono text-xs ${o.setCount?"text-fg-dim":"text-fg-faint"}`,children:[o.setCount,"/",o.total]})]},o.id)})})}function yr({cards:t,groupIds:s,targetScope:n,onOverride:o}){const{visibleGroups:i,rootNode:a,schema:r,filter:l}=t,d=i.filter(c=>s.includes(c.id));return e.jsxs("div",{className:"px-9 py-6 flex flex-col gap-[26px]",children:[d.map(c=>e.jsxs("section",{id:`settings-group-${c.id}`,"data-testid":"settings-group-section",children:[e.jsxs("div",{className:"flex items-baseline gap-3 mb-3",children:[e.jsxs("span",{className:hr,children:[c.title," · ",c.summary.replace(/\.$/,"")]}),c.advanced&&e.jsx("span",{className:"text-[9px] px-1.5 rounded border border-line text-fg-faint uppercase tracking-wide",children:"advanced"}),e.jsx("span",{"aria-hidden":!0,className:"flex-1 h-px bg-line"})]}),e.jsx("div",{className:"flex flex-col gap-2.5",children:c.keys.map(p=>e.jsx(Sr,{keyName:p,node:a==null?void 0:a.children[p],info:r.at([p]),targetScope:n,onOverride:(m,g)=>o([p],m,g)},p))})]},c.id)),d.length===0&&e.jsx("div",{className:"px-6 py-12 text-center text-fg-faint text-sm",children:l.trim()?`no settings match "${l}"`:"nothing to show — turn on Show unset to see every setting in this group"})]})}const br=[{stage:"default",label:"Default"},{stage:"user",label:"User"},{stage:"project",label:"Project"},{stage:"local",label:"Local"}],xr=["default","user"],wn=["default","user","project","local"];function vr(t){return t==="user"?xr:wn}const wr=["user","project","local"];function kn(t,s){if(t.kind==="leaf"){s.add(t.winner);for(const n of t.shadowed)s.add(n.scope)}else if(t.kind==="array")for(const n of t.items)s.add(n.fromScope);else for(const n of Object.values(t.children))kn(n,s)}function kr(t,s){const n=new Set;if(s!==void 0&&n.add("default"),!t)return{effective:s!==void 0?"default":null,has:n};const o=new Set;return kn(t,o),o.forEach(a=>n.add(a)),t.kind==="leaf"?{effective:t.winner,has:n}:{effective:[...wr].reverse().find(a=>o.has(a))??null,has:n}}function Er({node:t,defaultVal:s,stages:n=wn}){const{effective:o,has:i}=kr(t,s),a=br.filter(r=>n.includes(r.stage));return e.jsx("div",{"data-testid":"source-ladder",className:"flex items-center gap-1.5 whitespace-nowrap","aria-label":"Where this value comes from",children:a.map(({stage:r,label:l},d)=>{const c=r===o,p=i.has(r);return e.jsxs("span",{className:"flex items-center gap-1.5",children:[d>0&&e.jsx("span",{"aria-hidden":!0,className:"w-3 h-px bg-line"}),e.jsxs("span",{"data-stage":r,"data-effective":c?"true":"false",title:c?`effective value comes from ${l}`:p?`${l} also sets this`:`not set in ${l}`,className:`flex items-center gap-1.5 text-xs ${c?"font-bold text-fg":p?"font-medium text-fg-dim":"font-medium text-fg-faint/70"}`,children:[e.jsx("span",{"aria-hidden":!0,className:`w-2.5 h-2.5 rounded-full box-border border-[1.5px] ${c?r==="default"?"bg-fg-faint border-fg-faint":"bg-accent border-accent":p?"border-fg-faint":"border-line"}`}),l]})]},r)})})}function Sr({keyName:t,node:s,info:n,targetScope:o,onOverride:i}){const[a,r]=u.useState(!1),l=Xe(t),d=s!==void 0,c=(s==null?void 0:s.kind)==="leaf"?s:null,p=n==null?void 0:n.default,m=!!c&&p!==void 0&&Ht(c.value,p),g=!!c&&!m,h=vn(t,n==null?void 0:n.description),f=`${o}:${c?JSON.stringify(c.value):"∅"}`;return e.jsxs("div",{"data-testid":"setting-card","data-key":t,className:"px-[22px] py-4 rounded-[14px] bg-bg-hi border border-line",children:[e.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_minmax(0,250px)_auto_auto] items-center gap-x-7 gap-y-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2.5 flex-wrap",children:[e.jsx("h3",{className:"text-base font-semibold text-fg",children:l}),e.jsx("span",{className:"font-mono text-xs text-fg-faint",children:t}),(n==null?void 0:n.deprecated)&&e.jsx("span",{className:"text-[11px] italic text-fg-faint",children:"deprecated"}),(n==null?void 0:n.required)&&!d&&e.jsx("span",{className:"text-[11px] italic text-fg-faint",children:"required"})]}),h&&e.jsx("p",{className:`text-[13.5px] text-fg-dim mt-0.5 leading-relaxed ${h.authored?"inline-block border-b border-dotted border-fg-faint/70 cursor-help":""}`,title:h.authored?"In-app-authored description — not from the official Claude Code schema":void 0,children:Tr(h.text)})]}),e.jsx("div",{className:"min-w-0 text-[13px]",children:e.jsx(jr,{keyName:t,node:s,info:n,onChange:b=>i(b),targetLabel:ze[o].label},f)}),e.jsx(Er,{node:s,defaultVal:p,stages:vr(o)}),e.jsx(Cr,{keyName:t,title:l,expanded:a,onToggleDetails:()=>r(b=>!b),reset:g&&c?{label:`Reset · remove from ${ze[c.winner].label}`,run:()=>i(void 0,c.winner)}:null})]}),a&&e.jsxs("div",{"data-testid":"setting-details",className:"mt-3 pt-3 border-t border-line/60",children:[c&&e.jsx(_r,{leaf:c,defaultVal:p,onReset:b=>i(void 0,b)}),e.jsx(Ar,{keyName:t,node:s,info:n})]})]})}function Cr({keyName:t,title:s,expanded:n,onToggleDetails:o,reset:i}){const[a,r]=u.useState(!1),l=u.useRef(null),d=u.useId();u.useEffect(()=>{if(!a)return;const p=g=>{var h;(h=l.current)!=null&&h.contains(g.target)||r(!1)},m=g=>{g.key==="Escape"&&r(!1)};return window.addEventListener("mousedown",p),window.addEventListener("keydown",m),()=>{window.removeEventListener("mousedown",p),window.removeEventListener("keydown",m)}},[a]);const c="px-2.5 py-[7px] rounded-[5px] text-left whitespace-nowrap hover:bg-bg-elev";return e.jsxs("div",{ref:l,className:"relative",children:[e.jsx("button",{type:"button","data-testid":"setting-row-menu","aria-label":`More actions for ${s}`,"aria-haspopup":"menu","aria-expanded":a,"aria-controls":a?d:void 0,onClick:()=>r(p=>!p),className:"w-8 h-8 inline-flex items-center justify-center rounded-lg text-fg-faint hover:text-fg hover:bg-bg focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",children:"⋯"}),a&&e.jsxs("div",{id:d,role:"menu","aria-label":`Actions for ${t}`,className:`absolute ${je.dialog} right-0 top-9 min-w-[220px] p-[5px] flex flex-col gap-1 bg-bg-hi border border-line rounded-lg shadow-lg text-[13px] text-fg`,children:[i&&e.jsxs("button",{type:"button",role:"menuitem","data-testid":"setting-row-reset",className:c,onClick:()=>{r(!1),i.run()},children:["↺ ",i.label]}),e.jsx("button",{type:"button",role:"menuitem","data-testid":"setting-row-details",className:c,onClick:()=>{r(!1),o()},children:n?"Hide values across scopes":"Values across scopes…"})]})]})}function _r({leaf:t,defaultVal:s,onReset:n}){const o={};o[t.winner]={value:t.value,winner:!0};for(const i of t.shadowed)o[i.scope]={value:i.value,winner:!1};return e.jsxs("div",{className:"mt-2 border border-line rounded bg-bg-elev/40 text-xs",children:[e.jsx("div",{className:"px-2 py-1 text-fg-faint border-b border-line/60",children:"Values across all scopes (winner highlighted · reset removes that scope's value):"}),e.jsxs("div",{className:"divide-y divide-line/60",children:[["user","project","local"].map(i=>{const a=o[i],r=a!==void 0;return e.jsxs("div",{className:"grid grid-cols-[5rem_1fr_auto] gap-2 px-2 py-1 items-center",children:[e.jsx("span",{className:"text-fg-faint",children:ze[i].label}),e.jsx("span",{className:`font-mono truncate ${a!=null&&a.winner?"text-accent":"text-fg-dim"}`,children:r?ot(a.value):e.jsx("span",{className:"text-fg-faint",children:"—"})}),r?e.jsx("button",{onClick:()=>n(i),className:"text-[9px] px-1.5 py-0 rounded border border-line text-fg-faint uppercase tracking-wide hover:text-fg hover:bg-bg-hi",title:`delete this key from ${ze[i].label}`,children:"↺"}):e.jsx("span",{})]},i)}),e.jsxs("div",{className:"grid grid-cols-[5rem_1fr_auto] gap-2 px-2 py-1 items-center",children:[e.jsx("span",{className:"text-fg-faint",children:"Default"}),e.jsx("span",{className:"font-mono text-fg-dim truncate",children:s!==void 0?ot(s):e.jsx("span",{className:"text-fg-faint",children:"—"})}),e.jsx("span",{})]})]})]})}function Ar({keyName:t,node:s,info:n}){const i=(s==null?void 0:s.kind)==="leaf"?s:null,a=vn(t,n==null?void 0:n.description);return e.jsxs("div",{className:"mt-2 space-y-2 text-xs",children:[a&&e.jsx("p",{className:`text-fg-dim leading-relaxed whitespace-pre-wrap ${a.authored?"inline-block border-b border-dotted border-fg-faint/70 cursor-help":""}`,title:a.authored?"In-app-authored description — not from the official Claude Code schema":void 0,children:a.text}),e.jsxs("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-fg-faint",children:[(n==null?void 0:n.type)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Type"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:Array.isArray(n.type)?n.type.join(" | "):n.type})]}),(n==null?void 0:n.default)!==void 0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Default"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:ot(n.default)})]}),(n==null?void 0:n.enum)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Options"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:n.enum.map(r=>String(r)).join(" | ")})]}),i&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Current"}),e.jsxs("dd",{className:"font-mono",children:[e.jsx("span",{className:"text-fg-dim",children:ot(i.value)}),e.jsxs("span",{className:"ml-2 text-fg-faint",children:["from ",ze[i.winner].label]})]})]}),i&&i.shadowed.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Shadowed"}),e.jsx("dd",{className:"space-y-0.5",children:i.shadowed.map((r,l)=>e.jsxs("div",{className:"font-mono text-fg-faint line-through",children:[ot(r.value)," —"," ",e.jsx("span",{className:"no-underline",children:ze[r.scope].label})]},l))})]}),(s==null?void 0:s.kind)==="array"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Accumulated"}),e.jsxs("dd",{className:"text-fg-dim",children:[s.items.length," items across all scopes"]})]})]})]})}const Nr=new Set(["outputStyle"]),Ot="\0unset",ks="\0custom",En="w-full h-9 px-3 rounded-[10px] bg-bg border border-line font-mono text-[13px] text-fg placeholder:text-fg-faint focus:outline-none focus:border-fg-faint";function jr({keyName:t,node:s,info:n,onChange:o,targetLabel:i}){var p;const a=(s==null?void 0:s.kind)==="leaf",r=a?s.value:void 0,l=a?r:n==null?void 0:n.default,d=Or(n==null?void 0:n.type),c=`${Xe(t)} — writes ${i}`;return d==="boolean"?e.jsx("span",{className:"flex items-center gap-2","aria-label":c,children:e.jsx(Me,{checked:l===!0,onChange:m=>o(m),label:l===!0?"on":"off"})}):n!=null&&n.enum?e.jsx(Es,{options:n.enum,value:l,onChange:o,aria:c,allowCustom:!1}):d==="string"&&Nr.has(t)&&((p=n==null?void 0:n.examples)!=null&&p.length)?e.jsx(Es,{options:n.examples,value:l,onChange:o,aria:c,allowCustom:!0}):d==="integer"||d==="number"?e.jsx(Ft,{kind:"number",initial:typeof l=="number"?String(l):"",aria:c,onCommit:m=>{if(m.trim()==="")return o(void 0);const g=d==="integer"?parseInt(m,10):parseFloat(m);Number.isNaN(g)||o(g)}}):d==="string"?e.jsx(Ft,{kind:"text",initial:typeof l=="string"?l:"",aria:c,onCommit:m=>o(m===""?void 0:m)}):e.jsxs("div",{className:"text-xs text-fg-faint",children:[(s==null?void 0:s.kind)==="array"?`${s.items.length} items · `:"","edit in ",e.jsx("span",{className:"text-fg-dim",children:"{ } Raw JSON"})]})}function Es({options:t,value:s,onChange:n,aria:o,allowCustom:i}){const[a,r]=u.useState(!1),l=s!==void 0,d=t.filter(g=>l||g!=="default"),c=l&&d.some(g=>Ht(g,s)),p=l&&!c?[s,...d]:d;if(a)return e.jsx(Ft,{kind:"text",initial:"",aria:o,autoFocus:!0,onCommit:g=>g===""?r(!1):n(g)});const m=l?p.findIndex(g=>Ht(g,s)):-1;return e.jsxs("select",{"aria-label":o,value:m>=0?String(m):Ot,onChange:g=>{const h=g.target.value;if(h===ks)return r(!0);n(h===Ot?void 0:p[Number(h)])},className:En,children:[!l&&e.jsx("option",{value:Ot,children:"default"}),p.map((g,h)=>e.jsx("option",{value:String(h),children:String(g)},h)),i&&e.jsx("option",{value:ks,children:"custom…"})]})}function Ft({kind:t,initial:s,aria:n,onCommit:o,autoFocus:i}){const[a,r]=u.useState(s),l=()=>{a!==s&&o(a)};return e.jsx("input",{type:t,"aria-label":n,value:a,placeholder:"not set",autoFocus:i,onChange:d=>r(d.target.value),onBlur:l,onKeyDown:d=>{d.key==="Enter"&&d.target.blur(),d.key==="Escape"&&r(s)},className:En})}function Or(t){if(t)return Array.isArray(t)?t.find(n=>n!=="null")??t[0]:t}function Ht(t,s){return t===s?!0:typeof t!=typeof s?!1:t&&s&&typeof t=="object"?JSON.stringify(t)===JSON.stringify(s):!1}function Tr(t){const s=t.trim().split(`
61
+ `)[0],n=s.match(/^([^.!?]+[.!?])/);return n?n[1]:s.length>120?s.slice(0,120)+"…":s}function ot(t){if(typeof t=="string")return t===""?'""':JSON.stringify(t);if(t===null)return"null";if(t===void 0)return"—";if(typeof t=="object"){const s=JSON.stringify(t);return s.length>60?s.slice(0,60)+"…":s}return String(t)}const Lr={user:{title:"Global settings",body:"This is the real ~/.claude/settings.json on disk — the same file the claude CLI reads on every session it starts. Edits apply machine-wide, to every project and every session."},project:{title:"Project settings",body:"This is the real <project>/.claude/settings.json on disk, checked into git. Edits apply to every current and future session in this project, for anyone who clones it."},local:{title:"Local settings",body:"This is the real <project>/.claude/settings.local.json on disk, gitignored. Edits apply to every current and future session in this project, on this machine only."}},Sn="text-[11px] font-semibold uppercase tracking-[0.1em] text-fg-faint",Ss={user:{label:"User",meta:"~/.claude/settings.json · every project"},project:{label:"Project",meta:".claude/settings.json · in git"},local:{label:"Local",meta:"settings.local.json · this machine"}};function Cs({on:t}){return e.jsx("span",{"aria-hidden":!0,className:`w-4 h-4 shrink-0 mt-0.5 rounded-full box-border ${t?"border-[5px] border-fg":"border-[1.5px] border-fg-faint"}`})}function _s({scope:t,selected:s}){return e.jsxs("span",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:`block text-[13.5px] ${s?"font-semibold text-fg":"font-medium text-fg-dim"}`,children:Ss[t].label}),e.jsx("span",{className:"block font-mono text-[11.5px] text-fg-faint break-words",children:Ss[t].meta})]})}function Dr({scope:t,mtimeMs:s,exists:n,onScopeChange:o}){const i=n?s?`edited ${so(s)}`:"":"not created yet";return e.jsxs("div",{"data-testid":"settings-file-card",title:Lr[t].body,className:"px-3.5 pt-3.5 pb-3 rounded-[14px] bg-bg-hi border border-line flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center px-0.5 pb-1",children:[e.jsx("span",{className:`flex-1 ${Sn}`,children:"SETTINGS FILE"}),e.jsx("span",{className:"text-[11.5px] text-fg-faint",children:i})]}),t==="user"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-[11px] p-2.5 rounded-[10px] bg-bg border border-line",children:[e.jsx(Cs,{on:!0}),e.jsx(_s,{scope:"user",selected:!0})]}),e.jsx("div",{className:"px-2.5 pt-1.5 text-xs leading-snug text-fg-faint",children:"Each project can override any of these in its own Claude config."})]}):e.jsx("div",{role:"radiogroup","aria-label":"Settings file",className:"flex flex-col gap-1",children:["project","local"].map(a=>{const r=a===t;return e.jsxs("button",{type:"button",role:"radio","aria-checked":r,"data-testid":`settings-file-${a}`,disabled:!o,onClick:()=>o==null?void 0:o(a),className:`w-full text-left flex gap-[11px] p-2.5 rounded-[10px] border focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent ${r?"bg-bg border-line":"border-transparent hover:bg-bg/60"}`,children:[e.jsx(Cs,{on:r}),e.jsx(_s,{scope:a,selected:r})]},a)})})]})}function mt({testId:t,icon:s,label:n,trailing:o,selected:i,onSelect:a}){return e.jsxs("button",{type:"button","data-testid":t,"aria-current":i,onClick:a,className:`w-full flex items-center gap-2.5 h-[34px] px-3 rounded-[9px] border text-left text-[13.5px] focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent ${i?"bg-bg-hi border-line font-semibold text-fg":"border-transparent text-fg-dim hover:bg-bg-hi/60"}`,children:[e.jsx(Ie,{name:s,size:16,className:`shrink-0 ${i?"text-accent":"text-fg-faint"}`}),e.jsx("span",{className:"flex-1 min-w-0 truncate",children:n}),e.jsx("span",{className:"shrink-0 text-xs text-fg-faint whitespace-nowrap",children:o})]})}function ht({eyebrow:t,title:s,summary:n,actions:o}){return e.jsxs("div",{"data-testid":"settings-detail-header",className:"shrink-0 px-9 pt-6 pb-5 border-b border-line flex items-end gap-4 whitespace-nowrap",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:`truncate ${Sn}`,children:t}),e.jsxs("div",{className:"mt-1 flex items-baseline gap-3.5 min-w-0",children:[e.jsx("span",{className:"shrink-0 font-serif text-[34px] font-medium leading-tight text-fg",children:s}),n&&e.jsx("span",{className:"truncate text-[14.5px] text-fg-dim",children:n})]})]}),o&&e.jsx("div",{className:"shrink-0 flex items-center gap-4",children:o})]})}const Pr="https://code.claude.com/docs/en/settings";function As(){const[t,s]=u.useState(!1),n=u.useRef(null),o=u.useId();return u.useEffect(()=>{if(!t)return;const i=r=>{var l;(l=n.current)!=null&&l.contains(r.target)||s(!1)},a=r=>{r.key==="Escape"&&s(!1)};return window.addEventListener("mousedown",i),window.addEventListener("keydown",a),()=>{window.removeEventListener("mousedown",i),window.removeEventListener("keydown",a)}},[t]),e.jsxs("div",{ref:n,className:"relative",children:[e.jsx("button",{type:"button","data-testid":"settings-more","aria-label":"More actions","aria-haspopup":"menu","aria-expanded":t,"aria-controls":t?o:void 0,onClick:()=>s(i=>!i),className:"h-9 w-9 inline-flex items-center justify-center rounded-[10px] bg-bg-hi border border-line text-fg-dim hover:text-fg focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",children:"⋯"}),t&&e.jsx("div",{id:o,role:"menu","aria-label":"More actions",className:`absolute ${je.dialog} right-0 top-[42px] min-w-[200px] p-[5px] flex flex-col bg-bg-hi border border-line rounded-lg shadow-lg text-[13px] text-fg`,children:e.jsx("a",{role:"menuitem",href:Pr,target:"_blank",rel:"noreferrer",onClick:()=>s(!1),className:"px-2.5 py-[7px] rounded-[5px] whitespace-nowrap hover:bg-bg-elev",children:"Settings schema reference ↗"})})]})}function Rr(t){let s=0;for(const n of["allow","ask","deny"]){const o=Vs(t,["permissions",n]);(o==null?void 0:o.kind)==="array"&&(s+=o.items.length)}return s}function Ir({scope:t="user",onScopeChange:s}={}){var Y;const n=Oe(),o=os(N=>N.tabs),i=os(N=>N.activeTabId),a=o.find(N=>N.id===i)??null,r=(a==null?void 0:a.cwd)??null,[l,d]=u.useState("general"),[c,p]=u.useState(null);Jn("settings",N=>{(N==="general"||N==="permissions"||N==="hooks"||N==="raw")&&d(N)});const m=zt(qs,n,t==="user"?null:r),g=m[t]??null,h=G(N=>N.files),f=G(N=>N.setDraft),b=G(N=>N.saveJson),y=G(N=>N.revert),[k,w]=u.useState(null),O=u.useMemo(()=>Qn(Zn(h,m)),[h,m]),D=un(),C=fr({node:O,schema:D}),E=(N,Z,ie)=>{var he;const re=ie??t,we=m[re];if(!we)return;const Te=((he=h[we])==null?void 0:he.draftRaw)??"";if(Te.trim())try{JSON.parse(Te)}catch(be){w(`${we} is not valid JSON (${be instanceof Error?be.message:String(be)}) — fix it in Raw before editing from General.`);return}w(null),window.api.claudeConfig.patch({fileId:"settings",scope:re,cwd:r,keyPath:N,value:Z}).catch(be=>W.error(be instanceof Error?be.message:String(be)))},_=Se(N=>N.tab),j=Se(N=>N.id),A=Se(N=>N.clear),L=u.useRef(null),[T,U]=u.useState(null);if(u.useEffect(()=>{if(_!=="settings"||!j||!n)return;const N=j.startsWith("settings:")?j.slice(9):null,Z=N?bt.find(re=>re.keys.includes(N)):void 0,ie=N?C.groups.find(re=>re.keys.includes(N)):void 0;Z!=null&&Z.tab?d(Z.tab):N&&ie&&(ie.advanced&&!C.showAdvanced&&C.setShowAdvanced(!0),C.showUnset||C.setShowUnset(!0),C.setFilter(""),p(ie.id),d("general"),U(N)),A()},[_,j,n,C,A]),u.useEffect(()=>{if(!T)return;U(null);const N=L.current,Z=N==null?void 0:N.querySelector('[data-testid="config-workbench-detail"]'),ie=Array.from((N==null?void 0:N.querySelectorAll('[data-testid="setting-card"]'))??[]).find(re=>re.dataset.key===T);Z&&ie&&eo(Z,ie,{block:"start"})},[T]),!n)return e.jsx(K,{title:"loading…"});const I=g?h[g]:null,ue=t!=="user"&&!r,le=C.railGroups,te=c&&le.some(N=>N.id===c)?c:((Y=le[0])==null?void 0:Y.id)??null,ee=le.find(N=>N.id===te)??null,ce=C.groups.find(N=>N.id===te)??null,J=C.filter.trim()!=="",me=N=>{var Z;(Z=C.groups.find(ie=>ie.id===N))!=null&&Z.advanced&&!C.showAdvanced&&C.setShowAdvanced(!0),C.setFilter(""),p(N),d("general")},V=N=>{var Z;C.setShowAdvanced(N),!N&&(ce!=null&&ce.advanced)&&p(((Z=le.find(ie=>!ie.advanced))==null?void 0:Z.id)??null)},B=bt.find(N=>N.id==="hooks"),z=B?B.keys.filter(N=>Vs(O,[N])!==null).length:0,se=Rr(O),Q=t.toUpperCase(),oe=e.jsxs(e.Fragment,{children:[e.jsx(Dr,{scope:t,mtimeMs:(I==null?void 0:I.mtimeMs)??null,exists:(I==null?void 0:I.exists)??!0,onScopeChange:s}),e.jsxs("label",{className:"flex items-center gap-2 h-[38px] px-3 rounded-[10px] bg-bg-hi border border-line text-[13px] text-fg-faint focus-within:border-fg-faint",children:[e.jsx(Ie,{name:"search",size:15,className:"shrink-0"}),e.jsx("input",{type:"search","aria-label":"Search settings",placeholder:`Search ${C.totalKeys} settings`,value:C.filter,onChange:N=>{C.setFilter(N.target.value),d("general")},className:"flex-1 min-w-0 bg-transparent outline-none text-fg placeholder:text-fg-faint"})]}),e.jsx(gr,{cards:C,selectedId:l==="general"&&!J?te:null,onSelect:me}),e.jsxs("div",{className:"flex flex-col gap-px border-t border-line pt-2.5",children:[e.jsx(mt,{testId:"settings-row-permissions",icon:"permissions",label:"Permissions",trailing:se?`${se} ${se===1?"rule":"rules"}`:"none set",selected:l==="permissions",onSelect:()=>d("permissions")}),e.jsx(mt,{testId:"settings-row-hooks",icon:"hooks",label:"Hooks",trailing:`${z}/${(B==null?void 0:B.keys.length)??0}`,selected:l==="hooks",onSelect:()=>d("hooks")}),e.jsx(mt,{testId:"settings-row-tool-risk",icon:"shield",label:"Tool risk",trailing:t==="user"?"system":"this project",selected:l==="tool-risk",onSelect:()=>d("tool-risk")}),t!=="user"&&e.jsx(mt,{testId:"settings-row-epic-isolation",icon:"projects",label:"Epic isolation",trailing:"this project",selected:l==="epic-isolation",onSelect:()=>d("epic-isolation")})]})]}),Ue=e.jsx("button",{type:"button",onClick:()=>d("raw"),className:"h-9 px-3.5 rounded-[10px] border border-line bg-bg-hi font-mono text-[13px] font-medium text-fg hover:bg-bg-elev focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",children:"{ } Raw JSON"}),fe=N=>e.jsxs(e.Fragment,{children:[N,Ue,e.jsx(As,{})]}),Ce=k&&l!=="raw"?e.jsx("div",{role:"alert",className:"shrink-0 mx-9 mt-3 px-3 py-2 rounded border border-line text-xs text-red-400",children:k}):null;let X;if(ue)X=e.jsx(K,{title:"no active project",hint:"open a tab in a project directory to edit project or local settings"});else if(!g)X=e.jsx(K,{title:"resolving…"});else if(l==="tool-risk")X=e.jsx(pr,{scope:t==="user"?"user":"project",cwd:t==="user"?null:r});else if(l==="epic-isolation"&&t!=="user"&&r)X=e.jsx(lr,{cwd:r});else if(l==="general"||l==="epic-isolation"){const N=J?{title:"Search",summary:`settings matching "${C.filter.trim()}"`}:{title:(ee==null?void 0:ee.title)??"Settings",summary:ce==null?void 0:ce.summary};X=e.jsxs(e.Fragment,{children:[e.jsx(ht,{eyebrow:`${Q} SETTINGS · ${(ee==null?void 0:ee.setCount)??0} OF ${(ee==null?void 0:ee.total)??0} SET`,title:N.title,summary:N.summary,actions:e.jsxs(e.Fragment,{children:[e.jsx(Me,{checked:C.showUnset,onChange:C.setShowUnset,label:"Show unset"}),e.jsx(Me,{checked:C.showAdvanced,onChange:V,label:"Advanced"}),fe()]})}),Ce,e.jsx(yr,{cards:C,groupIds:J?C.visibleGroups.map(Z=>Z.id):te?[te]:[],targetScope:t,onOverride:E})]})}else l==="permissions"?X=e.jsxs(e.Fragment,{children:[e.jsx(ht,{eyebrow:`${Q} SETTINGS · PERMISSIONS`,title:"Permissions",summary:"What Claude may do without asking.",actions:fe()}),Ce,e.jsx("div",{className:"px-6 py-3",children:e.jsx(mn,{scope:t,cwd:r,activePath:g})})]}):l==="hooks"?X=e.jsx(xn,{scope:t,cwd:r,path:g,renderLayout:({banners:N,list:Z,detail:ie})=>e.jsxs(e.Fragment,{children:[e.jsx(ht,{eyebrow:`${Q} SETTINGS · HOOKS`,title:"Hooks",summary:"Commands that run on Claude Code events.",actions:fe()}),Ce,N,e.jsxs("div",{"data-testid":"settings-hooks-body",className:"flex-1 min-h-0 flex mt-3 border-t border-line",children:[e.jsx("div",{className:"w-56 shrink-0 border-r border-line overflow-y-auto",children:Z}),e.jsx("div",{className:"flex-1 min-w-0 overflow-y-auto",children:ie})]})]})}):I?X=e.jsxs(e.Fragment,{children:[e.jsx(ht,{eyebrow:`${Q} SETTINGS · RAW JSON`,title:"Raw JSON",summary:"The whole file, as the claude CLI reads it.",actions:e.jsx(As,{})}),e.jsx("div",{"data-testid":"settings-raw-editor",className:"flex-1 min-h-0 overflow-clip mt-3",children:e.jsx(to,{path:g,value:I.draftRaw,onChange:N=>{w(null),f(g,N)}})}),e.jsx("div",{className:"shrink-0 border-t border-line bg-bg-elev",children:e.jsx(_t,{dirty:I.dirty,busy:I.busy,parseError:k||I.parseError,lastSavedAt:I.lastSavedAt,leading:I.exists?null:e.jsx("span",{children:"file will be created on save"}),onSave:async()=>{w(null);const N=await b(g);N.ok||w(N.error??"save failed")},onRevert:()=>{w(null),y(g)}})})]}):X=e.jsx(K,{title:"resolving…"});return e.jsx("div",{ref:L,"data-testid":"settings-page",className:"flex h-full min-h-0 bg-bg text-fg",children:e.jsx(St,{list:oe,detail:X})})}const dl=u.memo(Ir),Mr=2;function Ke(t){return`${t.source}:${t.pluginKey??t.cwd??""}:${t.name}`}const Tt=new Map,Ur=t=>t instanceof Error?t.message:String(t);async function $r(t){try{return await window.api.mcp.checkServer(t)}catch(s){const n=Ur(s);return W.error(`MCP check of ${t.name} failed: ${n}`),{ok:!1,status:"failed",error:n,checkedAt:Date.now()}}}const Ve=Kt((t,s)=>({results:{},checking:{},check:n=>{const o=Ke(n),i=Tt.get(o);if(i)return i;t(r=>({checking:{...r.checking,[o]:!0}}));const a=$r(n).then(r=>(Tt.delete(o),t(l=>{const d={...l.checking};return delete d[o],{results:{...l.results,[o]:r},checking:d}}),r));return Tt.set(o,a),a},checkAll:async n=>{const o=[...new Map(n.map(r=>[Ke(r),r])).values()];let i=0;const a=async()=>{for(;i<o.length;)await s().check(o[i++])};await Promise.all(Array.from({length:Math.min(Mr,o.length)},a))}})),Br=t=>t.results,Fr=t=>t.checking,Gt={unchecked:"Not checked",connected:"Connected",failed:"Failed","needs-auth":"Needs auth"},Cn={unchecked:"border-[1.5px] border-fg-faint/60",connected:"bg-sage",failed:"bg-red-500","needs-auth":"bg-honey"},Hr={unchecked:"bg-bg-elev text-fg-dim",connected:"bg-sage/15 text-sage-dark",failed:"bg-red-500/10 text-red-700","needs-auth":"bg-honey/15 text-honey-dark"},Gr={user:"User scope",project:"Project scope",local:"Local scope"},Wr=8,qr=3e4,Kr="••••••••",Vr=/^[A-Za-z0-9_@%+=:,./-]+$/;function zr(t){return Vr.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`}function Zt(t){return(t.type??"stdio")!=="stdio"}function Xr(t){return Zt(t)?t.url??"":t.command?[t.command,...t.args??[]].map(zr).join(" "):""}const Wt=t=>t.replace(/[^A-Za-z0-9_-]/g,"_");function Ns(t,s){return`mcp__${Wt(t)}__${Wt(s)}`}const Lt="h-[38px] inline-flex items-center whitespace-nowrap px-4 bg-bg-hi border border-line rounded-[10px] text-[13.5px] font-medium text-fg hover:border-rule disabled:opacity-50 disabled:hover:border-line",_n="text-[13px] font-semibold text-accent hover:text-accent-dark",Yr="text-[11px] font-semibold uppercase tracking-[0.1em] text-fg-faint";function An({label:t}){return e.jsx("div",{className:"px-3 py-1.5 flex items-center text-xs",children:e.jsxs("span",{"data-testid":"savebar-clean",className:"min-w-0 flex items-center gap-[7px] text-fg-faint",children:[e.jsx("span",{"aria-hidden":"true",className:"shrink-0 w-1.5 h-1.5 rounded-full bg-sage"}),e.jsx("span",{className:"truncate",children:t})]})})}function js({name:t,server:s,scope:n,fileLabel:o,plugin:i,checkRequest:a,origin:r,onChange:l,editing:d=!1,onEditingChange:c,editor:p,footer:m,cleanLabel:g,approval:h}){const f=i!==void 0,b=!f&&d,y=a?Ke(a):null,k=Ve(_=>y===null?void 0:_.results[y]),w=Ve(_=>y===null?!1:_.checking[y]===!0),O=Ve(_=>_.check);Jr(qr,k!==void 0);const D=(k==null?void 0:k.status)??"unchecked",C=Zt(s),E=()=>{a&&O(a)};return e.jsxs("div",{"data-testid":"mcp-detail",className:"flex flex-col min-w-0",children:[e.jsxs("div",{className:"shrink-0 px-9 pt-6 pb-5 border-b border-line flex items-end gap-3 whitespace-nowrap",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{"data-testid":"mcp-detail-meta",className:`truncate ${Yr}`,children:[e.jsx("span",{"data-testid":"mcp-detail-origin",children:De[r]})," · ",e.jsx("span",{"data-testid":"mcp-detail-transport",children:f?"plugin":s.type??"stdio"})," · ",f?e.jsxs(e.Fragment,{children:[e.jsxs("span",{"data-testid":"mcp-detail-plugin",children:["via the ",i," plugin"]})," · ",e.jsx("span",{"data-testid":"mcp-detail-readonly",children:"read-only"})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{"data-testid":"mcp-detail-scope",children:Gr[n]})," · ",e.jsxs("span",{"data-testid":"mcp-detail-keypath",children:[o," › mcpServers › ",t]})]})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2.5 min-w-0",children:[e.jsx("h2",{"data-testid":"mcp-detail-name",className:"min-w-0 truncate font-mono text-[27px] font-semibold tracking-[-0.015em] text-fg",children:t}),e.jsxs("span",{"data-testid":"mcp-detail-status","data-status":D,title:k&&!k.ok?k.error:void 0,className:`shrink-0 inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-semibold ${Hr[D]}`,children:[e.jsx("span",{"aria-hidden":"true",className:`w-1.5 h-1.5 shrink-0 box-border rounded-full ${Cn[D]}${w?" animate-pulse":""}`}),Gt[D]]})]})]}),e.jsxs("div",{className:"shrink-0 flex items-center gap-2",children:[n==="user"&&!f?e.jsxs("span",{"data-testid":"mcp-detail-scope-note",className:"mr-2 inline-flex items-center gap-2 text-[13px] text-fg-dim",children:[e.jsx("span",{"aria-hidden":"true",className:"w-[7px] h-[7px] rounded-full bg-sage"}),"On in every project"]}):null,h&&!f?e.jsx("span",{"data-testid":"mcp-detail-approved",title:"disabledMcpjsonServers in .claude/settings.json",className:"mr-2 inline-flex text-[13px]",children:e.jsx(Me,{checked:h.approved,disabled:h.busy,onChange:h.onChange,label:"Approved"})}):null,e.jsx("button",{type:"button","data-testid":"mcp-check-again",onClick:E,disabled:a===null||w,className:Lt,children:w?"Checking…":"Check again"}),f?null:b?e.jsx("button",{type:"button","data-testid":"mcp-edit-done",onClick:()=>c==null?void 0:c(!1),className:Lt,children:"Done"}):e.jsx("button",{type:"button","data-testid":"mcp-edit-json",onClick:()=>c==null?void 0:c(!0),className:Lt,children:"Edit JSON"})]})]}),e.jsxs("div",{className:"px-9 py-7 flex flex-col gap-5 max-w-[1100px]",children:[b?p:e.jsxs(e.Fragment,{children:[e.jsx(Qr,{server:s,readOnly:f}),f?null:C?e.jsx(Os,{testId:"mcp-headers",label:"Headers",noun:"header",separator:":",emptyText:"No headers set.",values:s.headers??{},onAdd:(_,j)=>l==null?void 0:l({...s,headers:{...s.headers??{},[_]:j}})}):e.jsx(Os,{testId:"mcp-env",label:"Environment",noun:"variable",separator:"=",emptyText:"No variables set.",values:s.env??{},onAdd:(_,j)=>l==null?void 0:l({...s,env:{...s.env??{},[_]:j}})}),e.jsx(Zr,{serverName:t,result:k,checking:w,canCheck:a!==null,onCheck:E})]}),g!==void 0?e.jsx("div",{className:"-mx-3",children:e.jsx(An,{label:g})}):m!==void 0?e.jsx("div",{className:"-mx-3",children:m}):null]})]})}function Jr(t,s){const[,n]=u.useState(0);u.useEffect(()=>{if(!s)return;const o=window.setInterval(()=>n(i=>i+1),t);return()=>window.clearInterval(o)},[t,s])}function Qr({server:t,readOnly:s}){const n=Zt(t),o=Xr(t),i=async()=>{await Hs(o)?W.success(n?"URL copied":"Command copied"):W.error(n?"Copy failed — the URL was not copied":"Copy failed — the command was not copied")};return e.jsx(Ge,{label:n?"URL":"Command",action:e.jsxs("button",{type:"button","data-testid":"mcp-command-copy",onClick:()=>void i(),disabled:!o,className:"shrink-0 inline-flex items-center gap-[7px] text-[13px] text-fg-dim hover:text-fg disabled:opacity-50 disabled:hover:text-fg-dim",children:[e.jsx("span",{"aria-hidden":"true","data-testid":"mcp-command-copy-icon",className:"inline-flex shrink-0",children:e.jsx(Ie,{name:"copy",size:15})}),"Copy"]}),children:e.jsx("div",{"data-testid":"mcp-command-box",className:"font-mono text-[16px] text-fg",children:o?e.jsx("span",{"data-testid":"mcp-command",className:"break-words",children:o}):e.jsx("span",{"data-testid":"mcp-command-empty",className:"font-sans text-[14px] text-fg-faint",children:s?n?"No URL set.":"No command set.":n?"No URL set — Edit JSON to add one.":"No command set — Edit JSON to add one."})})})}function Os({testId:t,label:s,noun:n,separator:o,emptyText:i,values:a,onAdd:r}){const[l,d]=u.useState(()=>new Set),[c,p]=u.useState(!1),[m,g]=u.useState(""),h=u.useRef(null),f=Object.keys(a),b=m.trim(),y=b!==""&&!/\s/.test(b)&&!b.includes(o),k=C=>d(E=>{const _=new Set(E);return _.has(C)?_.delete(C):_.add(C),_}),w=()=>{p(!1),g("")},O=()=>{var C;y&&(r(b,((C=h.current)==null?void 0:C.value)??""),w())},D=C=>{C.key==="Enter"?(C.preventDefault(),O()):C.key==="Escape"&&(C.preventDefault(),w())};return e.jsx("div",{"data-testid":t,children:e.jsx(Ge,{label:s,labelNote:String(f.length),children:e.jsxs("div",{className:"flex flex-col gap-1.5",children:[f.length===0&&!c?e.jsx("div",{"data-testid":`${t}-empty`,className:"text-[14px] text-fg-dim",children:i}):null,f.map(C=>{const E=l.has(C);return e.jsxs("div",{"data-testid":`${t}-row-${C}`,className:"flex items-center gap-2.5 font-mono text-[13.5px]",children:[e.jsx("span",{className:"shrink-0 font-semibold text-fg",children:C}),e.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-fg-faint/60",children:o}),e.jsx("span",{"data-testid":`${t}-value-${C}`,title:E?void 0:"Hidden — Show reveals it",className:`min-w-0 break-words ${E?"text-fg-dim":"text-fg-faint tracking-wider"}`,children:E?a[C]:Kr}),e.jsx("button",{type:"button","data-testid":`${t}-reveal-${C}`,"aria-pressed":E,"aria-label":`${E?"Hide":"Show"} the value of ${C}`,onClick:()=>k(C),className:"ml-auto shrink-0 font-sans text-[13px] text-fg-dim hover:text-fg",children:E?"Hide":"Show"})]},C)}),c?e.jsxs("div",{"data-testid":`${t}-add-form`,className:"flex items-center gap-2 py-1",children:[e.jsx("input",{"data-testid":`${t}-new-key`,"aria-label":`New ${n} name`,value:m,onChange:C=>g(C.target.value),onKeyDown:D,placeholder:n==="variable"?"KEY":"Header-Name",spellCheck:!1,autoFocus:!0,className:"w-44 h-8 px-2 bg-bg border border-line rounded-md font-mono text-xs text-fg"}),e.jsx("span",{"aria-hidden":"true",className:"font-mono text-xs text-fg-faint",children:o}),e.jsx("input",{ref:h,type:"password",autoComplete:"off","data-testid":`${t}-new-value`,"aria-label":`New ${n} value`,onKeyDown:D,placeholder:"value",spellCheck:!1,className:"flex-1 min-w-0 h-8 px-2 bg-bg border border-line rounded-md font-mono text-xs text-fg"}),e.jsx("button",{type:"button","data-testid":`${t}-add-confirm`,onClick:O,disabled:!y,className:"shrink-0 h-8 px-3 rounded-md bg-accent text-bg-hi text-xs font-semibold hover:bg-accent/90 disabled:opacity-50 disabled:hover:bg-accent",children:"Add"}),e.jsx("button",{type:"button","data-testid":`${t}-add-cancel`,onClick:w,className:"shrink-0 h-8 px-2 text-xs text-fg-faint hover:text-fg",children:"Cancel"})]}):e.jsx("div",{className:"pt-1",children:e.jsxs("button",{type:"button","data-testid":`${t}-add`,onClick:()=>p(!0),className:_n,children:["+ Add ",n]})})]})})})}function Zr({serverName:t,result:s,checking:n,canCheck:o,onCheck:i}){const[a,r]=u.useState(!1),l=Date.now(),d=`mcp__${Wt(t)}__…`;if(!s&&!n)return e.jsxs("div",{"data-testid":"mcp-tools",className:"flex items-center gap-4 px-[18px] py-4 rounded-[14px] border border-dashed border-rule",children:[e.jsx("span",{"data-testid":"mcp-tools-empty-icon",className:"shrink-0 flex text-fg-faint",children:e.jsx(Ie,{name:"tool",size:26})}),e.jsxs("div",{"data-testid":"mcp-tools-empty",className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[15px] font-semibold text-fg",children:"Tools appear after a check"}),e.jsxs("div",{className:"text-[13.5px] text-fg-dim",children:["A check connects to ",t," once and lists every tool it offers, named"," ",e.jsx("span",{className:"font-mono text-[12.5px]",children:d})]})]}),e.jsxs("button",{type:"button","data-testid":"mcp-tools-check",onClick:i,disabled:!o,className:"shrink-0 h-[38px] px-4 rounded-[10px] bg-accent text-bg-hi hover:bg-accent/90 text-[13.5px] font-semibold disabled:opacity-50",children:["Check ",t]})]});const c=s!=null&&s.ok?s.tools:[],p=a?c:c.slice(0,Wr),m=c.length-p.length,g=n?e.jsx("span",{"data-testid":"mcp-detail-checked",className:"shrink-0 text-[13px] text-fg-dim",children:"checking…"}):s?e.jsxs("span",{"data-testid":"mcp-detail-checked",title:new Date(s.checkedAt).toLocaleString(),className:"shrink-0 text-[13px] text-fg-dim",children:["checked ",zs(Math.min(s.checkedAt,l),l)]}):null;return e.jsx("div",{"data-testid":"mcp-tools",children:e.jsx(Ge,{label:"Tools",labelNote:s!=null&&s.ok?String(c.length):void 0,action:g,children:s?s.ok?c.length===0?e.jsx("div",{"data-testid":"mcp-tools-empty",className:"text-[14px] text-fg-dim",children:"The last check listed no tools."}):e.jsxs("div",{className:"flex flex-col gap-3 pt-1.5",children:[e.jsxs("div",{"data-testid":"mcp-tools-chips",className:"flex flex-wrap items-center gap-2",children:[p.map((h,f)=>e.jsx("span",{"data-testid":`mcp-tool-row-${h.name}`,title:h.description?`${Ns(t,h.name)} — ${h.description}`:Ns(t,h.name),className:"px-2.5 py-1 rounded-md bg-bg-elev border border-line font-mono text-[13px] text-fg",children:h.name},`${f}:${h.name}`)),m>0?e.jsxs("button",{type:"button","data-testid":"mcp-tools-more",onClick:()=>r(!0),className:_n,children:["+",m," more"]}):null]}),e.jsxs("div",{className:"text-[13px] text-fg-dim",children:["Claude calls them as ",e.jsx("span",{className:"font-mono text-[12.5px]",children:d})]})]}):e.jsxs("div",{"data-testid":"mcp-tools-empty",className:"text-[14px] text-fg-dim",children:[s.status==="needs-auth"?"The last check needs auth":"The last check failed",": ",s.error]}):e.jsxs("div",{className:"text-[14px] text-fg-dim",children:["Checking ",t,"…"]})})})}async function Nn(t){const s=`${t}/skills`;return await window.api.config.exists(s)?s:null}async function jn(t){const{entries:s}=await Vt(t,{nested:!1});return s.map(n=>{const o=it(n.text);return{id:n.name,name:o.name,description:o.description,dir:n.dir,path:n.path,body:o.body}})}function pl(t){const s=[],n=new Set;for(const o of t)for(const i of t){if(o.id===i.id)continue;const a=i.id.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=[`/${a}\\b`,`\`${a}\``];if(i.id.length>=4&&r.push(`\\b${a}\\b`),!r.some(c=>new RegExp(c,"i").test(o.body)))continue;const d=`${o.id}->${i.id}`;n.has(d)||(n.add(d),s.push({from:o.id,to:i.id}))}return s}function ul(t,s){return{name:t.name,path:t.path,mtimeMs:t.mtimeMs,hasManifest:!1,manifest:null,hasLsp:!1,monitors:0,hooks:0,agents:0,commands:0,skills:0,binCount:0,hasMcp:!1,mcpServers:0,error:s}}async function ml(t){const{hasManifest:s,manifest:n}=await es(t.path),[o,i]=await Promise.all([window.api.config.exists(`${t.path}/.lsp.json`),window.api.config.exists(`${t.path}/monitors/monitors.json`)]);let a=0;if(i){const m=await window.api.config.readJson(`${t.path}/monitors/monitors.json`);Array.isArray(m.data)?a=m.data.length:m.data&&typeof m.data=="object"&&Array.isArray(m.data.monitors)&&(a=m.data.monitors.length)}const[r,l,d]=await Promise.all([Dn(t.path,n),Pn(`${t.path}/bin`,{filesOnly:!0}),Nn(t.path)]),c=l.length,p=d?(await jn(d)).length:0;return{name:t.name,path:t.path,mtimeMs:t.mtimeMs,hasManifest:s,manifest:n,hasLsp:o,monitors:a,hooks:r.hooks,agents:r.agentFiles.length,commands:r.commandFiles.length,skills:p,binCount:c,hasMcp:r.mcpServers.length>0,mcpServers:r.mcpServers.length}}function hl(t){return{skills:t.skills,commands:t.commands,agents:t.agents,hooks:t.hooks,mcpServers:t.mcpServers}}async function es(t){let s=`${t}/.claude-plugin/plugin.json`,n=await window.api.config.exists(s);if(n||(s=`${t}/plugin.json`,n=await window.api.config.exists(s)),!n)return{hasManifest:n,manifest:null};const o=await window.api.config.readJson(s),i=o.exists&&!o.parseError&&o.data&&typeof o.data=="object"&&!Array.isArray(o.data);return{hasManifest:n,manifest:i?o.data:null}}const Pe=t=>!!t&&typeof t=="object"&&!Array.isArray(t);function ea(t,s){const n=s.startsWith("/")?s.startsWith(`${t}/`)?s.slice(t.length+1):null:s;if(n===null)return Ts(s);const o=[];for(const i of n.split("/"))if(!(i===""||i===".")){if(i!=="..")o.push(i);else if(o.pop()===void 0)return Ts(s)}return o.length>0?`${t}/${o.join("/")}`:t}function Ts(t){return console.warn(`[plugins] ignoring manifest path outside the plugin root: ${t}`),null}function ta(t){return typeof t=="string"?[t]:Array.isArray(t)?t.filter(s=>typeof s=="string"):[]}function sa(t){if(!Pe(t))return null;if(Pe(t.mcpServers))return t.mcpServers;const s=Object.values(t);return s.length>0&&s.every(o=>Pe(o)&&(typeof o.command=="string"||typeof o.url=="string"))?t:null}function na(t){if(!Pe(t))return 0;const s=Pe(t.hooks)?t.hooks:t;return Object.values(s).reduce((n,o)=>Array.isArray(o)?n+o.reduce((i,a)=>i+(Pe(a)&&Array.isArray(a.hooks)?a.hooks.length:0),0):n,0)}function gt(t,s,n){const o=new Set;for(const i of ta(s)){const a=ea(t,i);a&&o.add(a)}return o.add(`${t}/${n}`),[...o]}async function On(t){try{const s=await window.api.config.readJson(t);return s.exists&&!s.parseError?s.data:null}catch{return null}}function Tn(t,s){return gt(t,typeof s=="string"||Array.isArray(s)?s:void 0,".mcp.json")}async function Ln(t,s){const n=await Promise.all(s.map(On)),o=new Map;for(const i of[...Pe(t)?[t]:[],...n])for(const[a,r]of Object.entries(sa(i)??{})){if(o.has(a))continue;const l=Pe(r)?r.command:void 0,d=Pe(r)?r.url:void 0;o.set(a,{id:a,name:a,description:typeof l=="string"?l:typeof d=="string"?d:null})}return[...o.values()]}async function Dn(t,s){const n=async f=>{const b=new Set;for(const y of f)if(y.endsWith(".md"))b.add(y);else for(const k of await Pn(y,{filesOnly:!0}))k.endsWith(".md")&&b.add(`${y}/${k}`);return[...b]},o=gt(t,s==null?void 0:s.commands,"commands"),i=gt(t,s==null?void 0:s.agents,"agents"),a=s==null?void 0:s.hooks,r=gt(t,typeof a=="string"||Array.isArray(a)?a:void 0,"hooks/hooks.json"),l=s==null?void 0:s.mcpServers,d=Tn(t,l),[c,p,m,g]=await Promise.all([n(o),n(i),Promise.all(r.map(On)),Ln(l,d)]),h=[...Pe(a)?[a]:[],...m].reduce((f,b)=>f+na(b),0);return{commandFiles:c,agentFiles:p,hooks:h,mcpServers:g,sourcePaths:[...o,...i,...r,...d]}}async function oa(t){const{manifest:s}=await es(t),n=s==null?void 0:s.mcpServers;return Ln(n,Tn(t,n))}async function ia(t){const s=await Promise.all(t.map(o=>window.api.config.readText(o))),n=[];return t.forEach((o,i)=>{if(!s[i].exists)return;const a=o.slice(o.lastIndexOf("/")+1),r=it(s[i].text);n.push({id:o,name:r.name??a.replace(/\.md$/,""),description:r.description})}),n}async function Pn(t,s){try{return(await window.api.config.listDir(t,s)).entries.map(o=>o.name)}catch{return[]}}const qt=(t,s)=>({type:"mcp",name:t,command:s.command,args:s.args,url:s.url}),ra=["stdio","http","streamable-http","sse","ws"],aa=new Set(["workspace"]),la=new Set(["ide","tasks"]);function ca(t,s,n){return t==="user"?`${s}/.claude.json`:n?`${n}/.mcp.json`:null}function Ls(t){if(t.trim()==="")return{full:{},servers:{},err:null};try{const s=JSON.parse(t),n=s.mcpServers??{};return{full:s,servers:n,err:null}}catch(s){return{full:{},servers:{},err:s.message}}}function da(t,s){const n={};for(const[o,i]of Object.entries(s)){const{enabled:a,...r}=i;n[o]=r}return JSON.stringify({...t,mcpServers:n},null,2)+`
62
+ `}function pa(t,s){const n=[];for(const[o,i]of Object.entries(s)){if(JSON.stringify(i)===JSON.stringify(t[o]))continue;const{enabled:a,...r}=i;n.push({name:o,value:r})}for(const o of Object.keys(t))o in s||n.push({name:o,value:void 0});return n}function ua(t){let s=Object.keys(t).length+1,n=`server-${s}`;for(;t[n];)s+=1,n=`server-${s}`;return n}const Dt=t=>({source:"plugin",name:t.name,pluginKey:t.pluginKey});async function ma(){var a,r;const s=(await((r=(a=window.api.plugins)==null?void 0:a.list)==null?void 0:r.call(a))??[]).filter(l=>l.enabled&&!!l.installPath),n=await Promise.allSettled(s.map(l=>oa(l.installPath))),o=[],i=[];return n.forEach((l,d)=>{const c=s[d];if(l.status==="rejected"){i.push(c.name);return}for(const p of l.value){const m=p.description??"",g=/^[a-z][a-z0-9+.-]*:\/\//i.test(m)?{type:"http",url:m}:{command:m||void 0};o.push({id:`${c.key}/${p.name}`,pluginKey:c.key,plugin:c.name,name:p.name,server:g})}}),i.length>0&&W.error(`Could not read the MCP servers of plugin ${i.join(", ")}`),o.sort((l,d)=>l.plugin.localeCompare(d.plugin)||l.name.localeCompare(d.name))}const ha={anthropic:"text-accent-dark",community:"text-honey-dark",local:""};function Ds(t){if(!t)return"not checked";if(t.status==="connected"){const s=t.tools.length;return`connected · ${s} tool${s===1?"":"s"}`}return t.status==="needs-auth"?"needs auth":"failed"}function fa(t,s,n){return t==="user"?{source:"user",name:n}:s?{source:"project",name:n,cwd:s}:null}function Ps({result:t,checking:s,testId:n}){const o=(t==null?void 0:t.status)??"unchecked";return e.jsx("span",{"aria-hidden":"true","data-testid":n,"data-status":o,title:t&&!t.ok?`${Gt[o]}: ${t.error}`:Gt[o],className:`w-2 h-2 shrink-0 box-border rounded-full ${Cn[o]}${s?" animate-pulse":""}`})}const ga=6;function ya(t,s){return t===s?"~":t.startsWith(`${s}/`)?`~${t.slice(s.length)}`:t}const Rs=t=>`w-full text-left grid grid-cols-[8px_minmax(0,1fr)_auto] items-center gap-x-2.5 gap-y-0.5 px-3 py-2.5 rounded-xl border focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent ${t?"bg-bg-hi border-line shadow-sm":"border-transparent hover:bg-bg-hi/60"}`,ba="flex items-center gap-2 mx-1 mt-2 text-[11px] font-semibold tracking-[0.1em] uppercase text-fg-faint";function xa({items:t}){const[s,n]=u.useState(!1),o=u.useRef(null),i=u.useRef(null),a=u.useId();return u.useEffect(()=>{if(!s)return;const r=d=>{var p,m;const c=d.target;(p=o.current)!=null&&p.contains(c)||(m=i.current)!=null&&m.contains(c)||n(!1)},l=d=>{d.key==="Escape"&&n(!1)};return window.addEventListener("mousedown",r),window.addEventListener("keydown",l),()=>{window.removeEventListener("mousedown",r),window.removeEventListener("keydown",l)}},[s]),e.jsxs("div",{className:"relative shrink-0",children:[e.jsx("button",{ref:o,type:"button","data-testid":"mcp-add-server","aria-haspopup":"menu","aria-expanded":s,"aria-controls":s?a:void 0,onClick:()=>n(r=>!r),className:"h-[38px] px-4 rounded-[10px] bg-accent text-bg-hi hover:bg-accent/90 text-[13.5px] font-semibold focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",children:"+ Add"}),s&&e.jsx("div",{ref:i,id:a,role:"menu","aria-label":"Add a server","data-testid":"mcp-add-server-menu",className:`absolute ${je.dialog} right-0 top-[44px] min-w-[190px] p-[5px] flex flex-col bg-bg-hi border border-line rounded-lg shadow-lg text-[13px] text-fg`,children:t.map(r=>e.jsx("button",{type:"button",role:"menuitem","data-testid":r.testId,onClick:()=>{n(!1),r.onSelect()},className:"px-2.5 py-[7px] rounded-[5px] text-left whitespace-nowrap hover:bg-bg-elev",children:r.label},r.testId))})]})}function va({onAdd:t,scope:s="user"}={}){const n=Oe(),o=Et(),i=(o==null?void 0:o.cwd)??null,[a,r]=u.useState(null),[l,d]=u.useState(null),[c,p]=u.useState(""),[m,g]=u.useState(null),h=u.useRef(null),f=u.useMemo(()=>n?ca(s,n,i):null,[n,s,i]),b=G(x=>x.files),y=G(x=>x.loadJson),k=G(x=>x.setDraft),w=G(x=>x.revert),O=G(x=>x.watchFile),D=G(x=>x.unwatchFile);u.useEffect(()=>{if(f)return b[f]||y(f),O(f),()=>D(f)},[f]);const C=Se(x=>x.tab),E=Se(x=>x.id),_=Se(x=>x.clear),j=f?b[f]:void 0;u.useEffect(()=>{if(C!=="mcp"||!E||!j||j.busy)return;const x=E.startsWith("mcp:")?E.slice(4):null,{servers:P}=Ls(j.draftRaw);x!==null&&P&&typeof P=="object"&&Object.hasOwn(P,x)&&(p(""),g(null),r(x),d(null)),_()},[C,E,j,_]);const[A,L]=u.useState(null),T=Ea(s==="project"?i:null),[U,I]=u.useState([]);u.useEffect(()=>{if(s!=="user"){I([]);return}let x=!0;return ma().then(P=>{x&&I(P)}).catch(P=>{x&&W.error(`Could not list plugin MCP servers: ${P instanceof Error?P.message:String(P)}`)}),()=>{x=!1}},[s]);const ue=Ve(Br),le=Ve(Fr),te=Ve(x=>x.checkAll),ee=Ut(x=>x.overrides),ce=Ut(x=>x.load);if(u.useEffect(()=>{n&&ce(n)},[n,ce]),!n)return e.jsx(K,{title:"loading…"});if(s==="project"&&!i)return e.jsx(K,{title:"no active project"});if(!f)return e.jsx(K,{title:"loading…"});const J=b[f],{full:me,servers:V,err:B}=J?Ls(J.draftRaw):{full:{},servers:{},err:null},z=Object.keys(V),se=c.trim().toLowerCase(),Q=se?z.filter(x=>x.toLowerCase().includes(se)):z,oe=se?U.filter(x=>x.name.toLowerCase().includes(se)):U,Ue=l!==null?U.find(x=>x.id===l)??null:null,fe=a!==null&&z.includes(a)?a:null,Ce=Q[0]??(oe.length>0?null:z[0]??null),X=Ue??(fe===null&&Ce===null?oe[0]??U[0]??null:null),Y=X?null:fe??Ce,N=x=>fa(s,i,x),Z=x=>{const P=N(x);return P?ue[Ke(P)]:void 0},ie=x=>{const P=N(x);return P?le[Ke(P)]===!0:!1},re=x=>Ke(Dt(x)),we=[...Q.map(N).filter(x=>x!==null),...oe.map(Dt)],Te=Q.some(ie)||oe.some(x=>le[re(x)]===!0),he=s==="user"?"~/.claude.json":".mcp.json",be=`${s==="user"?"~/.claude.json":`${ya(i??"",n)}/.mcp.json`} › mcpServers`,ge=Date.now(),S=J&&J.mtimeMs>0?`edited ${zs(Math.min(J.mtimeMs,ge),ge)}`:"not created yet",q=(x,P)=>ee[gn("mcp",s,x)]??Bt(qt(x,P)).provenance,F=se!==""||z.length+U.length>=ga,de=x=>{L(null),k(f,da(me,x))},xe=()=>{const x=ua(V);de({...V,[x]:{type:"stdio",command:"",args:[]}}),r(x),d(null),g(x)},Le=x=>{x!==Y&&g(null),r(x),d(null)},lt=x=>{g(null),d(x)},Ye=x=>{const P=Q.includes(x)?Q:z,ne=P.indexOf(x),ae=P.filter($e=>$e!==x),ve={...V};delete ve[x],de(ve),r(ae[Math.min(ne,ae.length-1)]??null),g(null)},ct=(x,P)=>{if(!P||P===x||V[P])return;const ne={};for(const ae of Object.keys(V))ne[ae===x?P:ae]=V[ae];de(ne),r(P),g(ae=>ae===x?P:ae)},Je=(x,P)=>{de({...V,[x]:P})},Qe=[{label:"New server",testId:"mcp-new-server",onSelect:xe}];t&&Qe.push({label:"Browse catalog…",testId:"mcp-browse-catalog",onSelect:()=>t({scope:s,cwd:i})});const We=J&&!J.dirty&&!A&&!B&&!J.parseError?`Saved — matches ${he}`:void 0,dt=J?e.jsx(_t,{dirty:J.dirty,busy:J.busy,parseError:A||B||J.parseError,lastSavedAt:J.lastSavedAt,onSave:async()=>{var P;L(null);const x=((P=J.diskData)==null?void 0:P.mcpServers)??{};for(const[ne,ae]of Object.entries(V)){if(JSON.stringify(ae)===JSON.stringify(x[ne]))continue;const ve=Rt(ae);if(ve.length>0){Ks.getState().show("error",`Not saved: "${ne}" still contains placeholder ${ve.map($e=>$e.token).join(", ")} — replace it with a real value`);return}}try{for(const ne of pa(x,V))await window.api.claudeConfig.patch({...Mt(s,i),keyPath:["mcpServers",ne.name],value:ne.value});await y(f)}catch(ne){L(ne.message||"save failed")}},onRevert:()=>{L(null),w(f)},cleanLabel:`Saved — matches ${he}`,shortcutHint:!0,scopeRef:h}):null,pt=e.jsxs(e.Fragment,{children:[e.jsx(on,{eyebrow:"SERVER FILE",badge:e.jsx("span",{"data-testid":"mcp-file-edited",children:S}),path:be,note:s==="user"?e.jsxs("span",{"data-testid":"mcp-scope-note",className:"flex items-center gap-2 px-2.5 py-1.5 rounded-lg bg-bg-elev text-[12.5px] text-fg-dim",children:[e.jsx("span",{"aria-hidden":"true",className:"w-[7px] h-[7px] shrink-0 rounded-full bg-sage"}),"On in every project · no approval step"]}):void 0,children:T?e.jsx("div",{"data-testid":"mcp-gating",title:`enableAllProjectMcpServers in ${i}/.claude/settings.json`,className:"flex items-center px-2.5 py-1.5 rounded-lg bg-bg-elev text-[12.5px]",children:e.jsx("span",{"data-testid":"mcp-enable-all",className:"contents",children:e.jsx(Me,{checked:T.enableAll,disabled:T.busy,onChange:T.setEnableAll,label:"Auto-approve all servers"})})}):null}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button","data-testid":"mcp-check-all",onClick:()=>void te(we),disabled:we.length===0||Te,className:"flex-1 min-w-0 h-[38px] px-3 rounded-[10px] bg-bg-hi border border-line text-[13.5px] font-medium text-fg hover:border-rule disabled:opacity-50 disabled:hover:border-line",children:Te?"Checking…":`Check all ${we.length}`}),e.jsx(xa,{items:Qe})]}),F?e.jsx("input",{type:"search","data-testid":"mcp-filter","aria-label":"Filter servers",placeholder:"Filter servers",value:c,onChange:x=>p(x.target.value),spellCheck:!1,className:"h-[34px] px-3 rounded-[10px] bg-bg-hi border border-line text-[13px] text-fg placeholder:text-fg-faint outline-none focus:border-fg-faint"}):null,e.jsxs("div",{role:"listbox","aria-label":"MCP servers",className:"flex flex-col gap-1",children:[z.length===0?e.jsx("div",{className:"mx-1 py-1 text-xs text-fg-faint",children:U.length>0?`No servers in ${he} yet.`:"No servers yet."}):Q.length===0?e.jsxs("div",{className:"mx-1 py-1 text-xs text-fg-faint",children:["No servers match “",c.trim(),"”."]}):Q.map(x=>{var v;const P=V[x],ne=x===Y,ae=Z(x),ve=ie(x),$e=q(x,P),Ze=Rt(P).map(R=>R.token).join(", ");return e.jsxs("button",{type:"button",role:"option","aria-selected":ne,"data-testid":`mcp-row-${x}`,"aria-current":ne?"true":void 0,title:((v=P.description)==null?void 0:v.trim())||void 0,onClick:()=>Le(x),className:Rs(ne),children:[e.jsx(Ps,{result:ae,checking:ve,testId:`mcp-dot-${x}`}),e.jsx("span",{className:`truncate text-[14px] text-fg ${ne?"font-semibold":"font-medium"}`,children:x}),e.jsx("span",{className:"font-mono text-[11.5px] text-fg-faint",children:P.type??"stdio"}),e.jsxs("span",{"data-testid":`mcp-status-${x}`,className:"col-start-2 col-span-2 truncate text-xs text-fg-faint",children:[e.jsx("span",{className:ha[$e],children:De[$e]})," · ",ve?"checking…":Ds(ae)]}),Ze?e.jsxs("span",{className:"col-start-2 col-span-2 truncate text-[11px] text-honey-dark",title:`${s} scope · ${f} — replace ${Ze} with a real value; Save refuses it until then`,children:["⚠ unconfigured placeholder: ",Ze]}):null]},x)}),U.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-testid":"mcp-plugins-header",className:ba,children:["From plugins",e.jsx("span",{"data-testid":"mcp-plugins-count",className:"font-mono font-medium tracking-normal text-fg-faint/60",children:oe.length}),e.jsx("span",{"data-testid":"mcp-plugins-readonly",className:"ml-auto px-[5px] border border-line rounded-[3px] text-[9.5px] font-medium tracking-normal text-fg-faint/80",children:"READ-ONLY"})]}),oe.length===0?e.jsxs("div",{className:"mx-1 py-1 text-xs text-fg-faint",children:["No plugin servers match “",c.trim(),"”."]}):oe.map(x=>{const P=(X==null?void 0:X.id)===x.id,ne=re(x),ae=ue[ne],ve=le[ne]===!0;return e.jsxs("button",{type:"button",role:"option","aria-selected":P,"data-testid":`mcp-plugin-row-${x.id}`,"aria-current":P?"true":void 0,onClick:()=>lt(x.id),className:Rs(P),children:[e.jsx(Ps,{result:ae,checking:ve,testId:`mcp-plugin-dot-${x.id}`}),e.jsx("span",{className:`truncate text-[14px] text-fg ${P?"font-semibold":"font-medium"}`,children:x.name}),e.jsx("span",{className:"font-mono text-[11.5px] text-fg-faint",children:"plugin"}),e.jsxs("span",{"data-testid":`mcp-plugin-status-${x.id}`,className:"col-start-2 col-span-2 truncate text-xs text-fg-faint",children:["via the ",x.plugin," plugin · ",ve?"checking…":Ds(ae)]})]},x.id)})]}):null]})]}),ut=X?e.jsx(js,{name:X.name,server:X.server,scope:"user",plugin:X.plugin,checkRequest:Dt(X),origin:Bt(qt(X.name,X.server)).provenance},`plugin:${X.id}`):Y!==null?e.jsx(js,{name:Y,server:V[Y],scope:s,fileLabel:he,checkRequest:N(Y),origin:q(Y,V[Y]),onChange:x=>Je(Y,x),approval:T?ka(T,Y):void 0,editing:m===Y,onEditingChange:x=>g(x?Y:null),editor:m===Y?e.jsx(wa,{name:Y,server:V[Y],scope:s,onRename:x=>ct(Y,x),onChange:x=>Je(Y,x),onRemove:()=>Ye(Y)}):null,footer:dt,cleanLabel:We},Y):e.jsxs("div",{className:"flex-1 flex flex-col",children:[e.jsx("div",{className:"flex-1",children:e.jsx(K,{title:"No MCP servers yet",hint:t?"+ Add starts a new one or browses the catalog.":"+ Add starts a new one."})}),We!==void 0?e.jsx(An,{label:We}):dt]});return e.jsx("div",{ref:h,className:"h-full min-h-0 flex flex-col",children:e.jsx(St,{list:pt,detail:ut})})}const fl=u.memo(va);function wa({name:t,server:s,scope:n,onRename:o,onChange:i,onRemove:a}){var h;const r=s.type??"stdio",l=aa.has(t),d=la.has(t),c=(h=s.permissions)==null?void 0:h.tools,p=c===void 0?"inherit":c==="allow"?"allow":c==="deny"?"deny":"list",m=Array.isArray(c)?c:[],g=(s.disabledTools??[]).join(", ");return e.jsxs("div",{"data-testid":"mcp-json-form",className:"space-y-4 max-w-2xl",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-fg-faint w-20",children:"origin"}),e.jsx(yn,{scope:n,input:qt(t,s)}),e.jsx("span",{className:"text-xs text-fg-faint",children:"click to change"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-xs text-fg-faint w-20",children:"name"}),e.jsx("input",{"aria-label":"Server name",defaultValue:t,onBlur:f=>o(f.target.value.trim()),className:"flex-1 bg-bg-elev border border-line rounded px-2 py-1 text-xs text-fg font-mono"}),e.jsx("button",{onClick:a,className:"text-xs text-fg-faint hover:text-red-400 px-2 py-1 border border-line rounded",children:"delete"})]}),e.jsx(et,{label:"description",value:s.description??"",onChange:f=>i({...s,description:f||void 0}),placeholder:"what this server does…"}),l?e.jsxs("div",{className:"text-xs px-2 py-1 border border-red-500/50 rounded text-red-300 bg-red-500/5",children:["⚠ ",e.jsx("span",{className:"font-mono",children:t})," is a reserved name — Claude Code will refuse to load this server (v2.1.128+)."]}):d?e.jsxs("div",{className:"text-xs px-2 py-1 border border-yellow-600/50 rounded text-yellow-200 bg-yellow-500/5",children:["⚠ ",e.jsx("span",{className:"font-mono",children:t})," collides with a commonly-bundled MCP name; expect surprises in other tools."]}):null,e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-xs text-fg-faint w-20",children:"type"}),e.jsx("select",{value:r,onChange:f=>i({...s,type:f.target.value}),className:"bg-bg-elev border border-line rounded px-2 py-1 text-xs text-fg",children:ra.map(f=>e.jsx("option",{value:f,children:f},f))}),r==="sse"?e.jsx("span",{className:"text-xs text-yellow-400/80",children:"sse is deprecated — prefer streamable-http"}):null]}),r==="stdio"?e.jsxs(e.Fragment,{children:[e.jsx(et,{label:"command",value:s.command??"",onChange:f=>i({...s,command:f}),placeholder:"npx / node / python …"}),e.jsx(et,{label:"args",value:(s.args??[]).join(" "),onChange:f=>i({...s,args:f.split(/\s+/).filter(Boolean)}),placeholder:"space-separated args"}),e.jsx(Is,{label:"env",value:s.env??{},onChange:f=>i({...s,env:f})})]}):e.jsxs(e.Fragment,{children:[e.jsx(et,{label:"url",value:s.url??"",onChange:f=>i({...s,url:f}),placeholder:"https://…"}),e.jsx(Is,{label:"headers",value:s.headers??{},onChange:f=>i({...s,headers:f})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-xs text-fg-faint w-20",children:"alwaysLoad"}),e.jsxs("label",{className:"flex items-center gap-2 text-xs text-fg",children:[e.jsx("input",{type:"checkbox",checked:s.alwaysLoad===!0,onChange:f=>i({...s,alwaysLoad:f.target.checked||void 0})}),e.jsx("span",{className:"text-fg-dim",children:"bypass tool-search deferral (v2.1.121+)"})]})]}),e.jsx(et,{label:"disabledTools",value:g,onChange:f=>{const b=f.split(",").map(y=>y.trim()).filter(Boolean);i({...s,disabledTools:b.length?b:void 0})},placeholder:"comma-separated tool names to hide"}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("label",{className:"text-xs text-fg-faint w-20 pt-1",children:"permissions"}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsxs("select",{value:p,onChange:f=>{const b=f.target.value,y={...s};if(b==="inherit"){if(y.permissions){const{tools:k,...w}=y.permissions;y.permissions=Object.keys(w).length?w:void 0}}else b==="list"?y.permissions={...y.permissions??{},tools:[]}:y.permissions={...y.permissions??{},tools:b};i(y)},className:"bg-bg-elev border border-line rounded px-2 py-1 text-xs text-fg",children:[e.jsx("option",{value:"inherit",children:"inherit (default)"}),e.jsx("option",{value:"allow",children:"allow all tools"}),e.jsx("option",{value:"deny",children:"deny all tools"}),e.jsx("option",{value:"list",children:"allowlist…"})]}),p==="list"?e.jsx("input",{value:m.join(", "),onChange:f=>{const b=f.target.value.split(",").map(y=>y.trim()).filter(Boolean);i({...s,permissions:{...s.permissions??{},tools:b}})},placeholder:"comma-separated tool names",className:"w-full bg-bg-elev border border-line rounded px-2 py-1 text-xs text-fg font-mono"}):null]})]})]})}function et({label:t,value:s,onChange:n,placeholder:o}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-xs text-fg-faint w-20",children:t}),e.jsx("input",{value:s,onChange:i=>n(i.target.value),placeholder:o,className:"flex-1 bg-bg-elev border border-line rounded px-2 py-1 text-xs text-fg font-mono"})]})}function Is({label:t,value:s,onChange:n}){const[o,i]=u.useState(""),[a,r]=u.useState(""),l=Object.entries(s);return e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("label",{className:"text-xs text-fg-faint w-20 pt-1",children:t}),e.jsxs("div",{className:"flex-1 space-y-1",children:[l.map(([d,c])=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{value:d,onChange:p=>{const m={...s};delete m[d],m[p.target.value]=c,n(m)},className:"w-32 bg-bg-elev border border-line rounded px-2 py-0.5 text-xs text-fg font-mono"}),e.jsx("input",{value:c,onChange:p=>n({...s,[d]:p.target.value}),className:"flex-1 bg-bg-elev border border-line rounded px-2 py-0.5 text-xs text-fg font-mono"}),e.jsx("button",{onClick:()=>{const p={...s};delete p[d],n(p)},className:"text-fg-faint hover:text-red-400 text-xs px-1",children:"×"})]},d)),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{value:o,onChange:d=>i(d.target.value),placeholder:"key",className:"w-32 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg-dim font-mono"}),e.jsx("input",{value:a,onChange:d=>r(d.target.value),placeholder:"value",className:"flex-1 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg-dim font-mono"}),e.jsx("button",{onClick:()=>{o.trim()&&(n({...s,[o.trim()]:a}),i(""),r(""))},className:"px-2 text-xs border border-line rounded text-fg-dim hover:text-fg hover:bg-bg-hi",children:"+"})]})]})]})}function ka(t,s){return{approved:!t.disabled.includes(s),busy:t.busy,onChange:n=>t.setApproved(s,n)}}function Ea(t){const[s,n]=u.useState([]),[o,i]=u.useState(!1),[a,r]=u.useState(!1);if(u.useEffect(()=>{var m,g;if(!t)return;let d=!0;const c=()=>window.api.claudeConfig.read({fileId:"settings",scope:"project",cwd:t}).then(h=>{if(!d)return;const f=h.data;n(Array.isArray(f==null?void 0:f.disabledMcpjsonServers)?f.disabledMcpjsonServers:[]),i((f==null?void 0:f.enableAllProjectMcpServers)===!0)}).catch(h=>{d&&W.error(`Could not read MCP approval: ${h instanceof Error?h.message:String(h)}`)});c();const p=(g=(m=window.api.config)==null?void 0:m.onChanged)==null?void 0:g.call(m,()=>{c()});return()=>{d=!1,p==null||p()}},[t]),!t)return null;const l=async(d,c)=>{r(!0);try{await window.api.claudeConfig.patch({fileId:"settings",scope:"project",cwd:t,keyPath:[d],value:c})}catch(p){W.error(p.message||"save failed")}finally{r(!1)}};return{enableAll:o,disabled:s,busy:a,setEnableAll:d=>{i(d),l("enableAllProjectMcpServers",d?!0:void 0)},setApproved:(d,c)=>{const p=c?s.filter(m=>m!==d):[...new Set([...s,d])];n(p),l("disabledMcpjsonServers",p.length?p:void 0)}}}function Sa(t,s){return s&&(t===s||t.startsWith(`${s}/`))?`~${t.slice(s.length)}`:t}function Ca(t){var i;const{frontmatter:s,body:n}=fo(t),o=((i=/^(?:\r?\n)*/.exec(n))==null?void 0:i[0])??"";return{frontmatter:s,lead:o,editorBody:n.slice(o.length)}}function _a({items:t}){const[s,n]=u.useState(!1),o=u.useRef(null),i=u.useRef(null),a=u.useId();return u.useEffect(()=>{if(!s)return;const r=d=>{var p,m;const c=d.target;(p=o.current)!=null&&p.contains(c)||(m=i.current)!=null&&m.contains(c)||n(!1)},l=d=>{d.key==="Escape"&&n(!1)};return window.addEventListener("mousedown",r),window.addEventListener("keydown",l),()=>{window.removeEventListener("mousedown",r),window.removeEventListener("keydown",l)}},[s]),e.jsxs("div",{className:"relative",children:[e.jsx("button",{ref:o,type:"button","data-testid":"skill-detail-more","aria-label":"More actions","aria-haspopup":"menu","aria-expanded":s,"aria-controls":s?a:void 0,onClick:()=>n(r=>!r),className:"h-9 w-9 inline-flex items-center justify-center rounded-[10px] bg-bg-hi border border-line text-fg-dim hover:text-fg hover:border-rule",children:"⋯"}),s&&e.jsx("div",{ref:i,id:a,role:"menu","aria-label":"More actions","data-testid":"skill-detail-more-menu",className:`absolute ${je.dialog} right-0 top-[42px] min-w-[200px] p-[5px] flex flex-col bg-bg-hi border border-line rounded-lg shadow-lg text-[13px] text-fg`,children:t.map(r=>e.jsx("button",{type:"button",role:"menuitem","data-testid":r.testId,onClick:()=>{n(!1),r.onSelect()},className:`px-2.5 py-[7px] rounded-[5px] text-left whitespace-nowrap hover:bg-bg-elev ${r.danger?"text-red-400":""}`,children:r.label},r.testId))})]})}function Ms({item:t,home:s,draft:n,dirty:o,busy:i,lastSavedAt:a,saveError:r,onDraftChange:l,onSave:d,onRevert:c,readOnly:p=!1,onToggleEnabled:m,onRemove:g}){const[h,f]=u.useState(!1),b=u.useMemo(()=>Ca(n),[n]),y=u.useMemo(()=>So(n)??"",[n]),k=t.kind==="commands"?"COMMAND":"SKILL",w=t.plugin?`FROM ${t.plugin.toUpperCase()}`:t.scope.toUpperCase(),O=`${k} · ${w} · ${Sa(t.path,s)}`,D=[{label:"Reveal in File Explorer",testId:"skill-detail-reveal",onSelect:()=>no(t.path)},...g&&!p?[{label:"Remove skill…",testId:"skill-detail-remove",danger:!0,onSelect:()=>f(!0)}]:[]],C=e.jsxs(e.Fragment,{children:[p&&e.jsx("span",{"data-testid":"skill-detail-readonly",className:"text-xs font-semibold px-2 py-0.5 rounded-full bg-bg-elev border border-line text-fg-dim",children:"Read-only"}),m&&!p&&e.jsxs("span",{"data-testid":"skill-detail-enabled",className:"flex items-center gap-2 text-[13px] text-fg-dim",title:o?"This skill has unsaved edits — save or revert before toggling":void 0,children:[e.jsx(Me,{checked:!t.disabled,disabled:o,onChange:E=>m(E)}),"Enabled"]}),e.jsx(_a,{items:D})]});return e.jsxs("div",{"data-testid":"skill-detail",className:"flex-1 min-h-0 flex flex-col",children:[e.jsx(Ct,{eyebrow:O,title:`/${t.name}`,actions:C}),h&&g&&e.jsxs("div",{"data-testid":"skill-detail-remove-confirm",role:"alert",className:"shrink-0 mx-9 mt-4 px-4 py-2.5 rounded-[10px] border border-red-400/40 bg-red-400/10 flex items-center gap-3 text-[13px] text-fg",children:[e.jsxs("span",{className:"flex-1 min-w-0",children:["Remove /",t.name,"? The folder moves to trash; reinstall from the Library."]}),e.jsx("button",{type:"button",onClick:()=>{f(!1),g()},className:"font-semibold text-red-400 hover:text-red-300",children:"confirm"}),e.jsx("button",{type:"button",onClick:()=>f(!1),className:"text-fg-faint hover:text-fg",children:"cancel"})]}),e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col gap-4 px-9 py-6",children:[e.jsx(Ge,{label:"DESCRIPTION",labelNote:"CLAUDE READS THIS TO DECIDE WHEN TO USE IT",children:p?e.jsx("span",{"data-testid":"skill-detail-description-text",className:"text-fg-dim",children:y||e.jsx("span",{className:"text-fg-faint",children:"No description"})}):e.jsx("textarea",{"data-testid":"skill-detail-description","aria-label":"Description",rows:2,value:y,onKeyDown:E=>{E.key==="Enter"&&E.preventDefault()},onChange:E=>l(wo(n,E.target.value.replace(/\r?\n/g," "))),placeholder:"What this does and when Claude should use it",className:"w-full resize-none bg-transparent outline-none text-fg placeholder:text-fg-faint"})}),e.jsx("div",{"data-testid":"skill-detail-editor","data-busy":i?"true":void 0,"data-saved-at":a??void 0,className:"flex-1 min-h-[420px] rounded-[14px] border border-line bg-bg-hi overflow-hidden",children:e.jsx(rn,{path:t.path,value:b.editorBody,defaultMode:"document",readOnly:p,dirty:p?void 0:o,onChange:E=>{if(p)return;const _=go(b.frontmatter,b.lead+E);_!==n&&l(_)},onSave:p?void 0:d,onRevert:p?void 0:c})}),r&&e.jsxs("div",{"data-testid":"skill-detail-save-error",role:"alert",className:"text-[13px] text-red-400",children:["Could not save: ",r]})]})]})}const Us=t=>t instanceof Error?t.message:String(t),$s=(t,s,n)=>`${t} ${t===1?s:n}`,Bs=(t,s)=>t.name.localeCompare(s.name);async function Aa(t,s){const[n,{manifest:o}]=await Promise.all([Nn(s),es(s)]),[i,a]=await Promise.all([n?jn(n):Promise.resolve([]),Dn(s,o)]),r=await ia(a.commandFiles);return[...i.map(l=>({kind:"skills",plugin:t,name:l.name??l.id,path:l.path,description:l.description??void 0})).sort(Bs),...r.map(l=>({kind:"commands",plugin:t,name:l.name??l.id,path:l.id,description:l.description??void 0})).sort(Bs)]}function Na(t,s){const[n,o]=u.useState([]),i=u.useRef(0),a=u.useCallback(async()=>{const r=++i.current;if(!s){o([]);return}let l=[];try{const d=(await window.api.plugins.list()).filter(c=>c.enabled&&c.installPath);l=await Promise.all(d.map(async c=>{try{return{key:c.key,name:c.name,items:await Aa(c.name,c.installPath)}}catch(p){return{key:c.key,name:c.name,items:[],error:Us(p)}}}))}catch(d){console.warn(`[skills] could not list plugins: ${Us(d)}`)}i.current===r&&(l.sort((d,c)=>d.name.localeCompare(c.name)),o(l))},[s]);return u.useEffect(()=>{a()},[a]),u.useEffect(()=>()=>{i.current+=1},[]),Xs(s&&t?[`${t}/.claude/plugins/installed_plugins.json`,`${t}/.claude/settings.json`]:[],()=>{a()}),n}function ja(t){const s=t.filter(o=>o.kind==="skills").length,n=t.length-s;return[s?$s(s,"skill","skills"):"",n?$s(n,"command","commands"):""].filter(Boolean).join(" · ")}function Oa({open:t}){return e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:`shrink-0 text-fg-faint/60 transition-transform ${t?"rotate-90":""}`,"aria-hidden":!0,children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}function Ta({plugins:t,needle:s,selectedPath:n,onSelect:o}){const[i,a]=u.useState(()=>new Set),r=t.map(c=>{if(!s||c.name.toLowerCase().includes(s))return{p:c,items:c.items};const p=c.items.filter(m=>{var g;return m.name.toLowerCase().includes(s)||!!((g=m.description)!=null&&g.toLowerCase().includes(s))});return{p:c,items:p}}).filter(({p:c,items:p})=>!s||p.length>0||c.name.toLowerCase().includes(s)),l=r.reduce((c,p)=>c+p.items.length,0),d=c=>a(p=>{const m=new Set(p);return m.has(c)?m.delete(c):m.add(c),m});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-testid":"skills-section-plugins",className:"flex items-center gap-2 mt-3 mx-1.5 mb-1 text-[11px] font-semibold tracking-[0.06em] uppercase text-fg-faint",children:["From plugins",e.jsx("span",{"data-testid":"skills-section-plugins-count",className:"font-mono font-medium tracking-normal text-fg-faint/60",children:l}),e.jsx("span",{"data-testid":"skills-section-plugins-readonly",title:"Plugin files are managed by the plugin — open them to read, not edit",className:"ml-auto px-[5px] border border-line rounded-[3px] text-[9.5px] font-medium tracking-normal text-fg-faint",children:"READ-ONLY"})]}),t.length===0&&e.jsx("div",{className:"mx-1.5 mb-1 text-xs text-fg-faint",children:"No enabled plugin adds skills or commands"}),r.map(({p:c,items:p})=>{const m=!c.error&&(i.has(c.key)||!!s&&p.length>0);return e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("button",{type:"button","data-testid":"plugin-skills-row","data-plugin":c.name,"aria-expanded":m,onClick:()=>d(c.key),className:"flex items-center gap-2 px-2.5 py-[7px] border border-transparent rounded-[7px] text-left text-[12.5px] text-fg-dim hover:bg-bg-hi",children:[e.jsx("span",{className:"min-w-0 truncate",children:c.name}),c.error?e.jsx("span",{"data-testid":"plugin-skills-row-error",title:c.error,className:"ml-auto shrink-0 text-[11px] text-red-400",children:"Could not read plugin"}):e.jsx("span",{"data-testid":"plugin-skills-row-counts",className:"ml-auto shrink-0 font-mono text-[11px] text-fg-faint",children:ja(c.items)||"nothing to list"}),e.jsx(Oa,{open:m})]}),m&&p.map(g=>{const h=n===g.path;return e.jsxs("button",{type:"button","data-testid":"plugin-skills-item","data-path":g.path,"aria-current":h?"true":void 0,onClick:()=>o(g.path),className:`ml-3 mb-0.5 flex flex-col gap-[2px] px-2.5 py-1.5 border rounded-[7px] text-left ${h?"border-accent bg-bg-hi":"border-transparent hover:bg-bg-hi"}`,children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsxs("span",{"data-testid":"plugin-skills-item-name",className:"min-w-0 truncate font-mono text-[12px] font-semibold text-fg",children:["/",g.name]}),e.jsx("span",{className:"ml-auto shrink-0 text-[9.5px] tracking-[0.04em] text-fg-faint",children:g.kind==="commands"?"COMMAND":"SKILL"})]}),g.description&&e.jsx("span",{title:g.description,className:"truncate text-[11px] text-fg-faint",children:g.description})]},g.path)})]},c.key)})]})}const La=250,Da=2e3,Pa=6;function Ra(t,s){return{user:{skills:`${t}/.claude/skills`,commands:`${t}/.claude/commands`},project:s?{skills:`${s}/.claude/skills`,commands:`${s}/.claude/commands`}:null}}const yt=t=>t instanceof Error?t.message:String(t);async function Ia(t,s){const n=t.map(()=>{});let o=0;const i=async()=>{for(let a=o++;a<t.length;a=o++)try{const r=await window.api.config.readText(t[a]);r.error?s.push({path:t[a],error:r.error}):r.exists&&(n[a]=it(r.text).description??void 0)}catch(r){s.push({path:t[a],error:yt(r)})}};return await Promise.all(Array.from({length:Math.min(Pa,t.length)},i)),n}const Ma=/^[a-z0-9][a-z0-9-]{0,63}$/,Ua="Use lowercase letters, digits and hyphens (max 64), starting with a letter or digit",$a=(t,s)=>t==="skills"?["---",`name: ${s}`,'description: ""',"---","",`# ${s}`,""].join(`
63
63
  `):["---",'description: ""',"---",""].join(`
64
- `),Ia=(t,s)=>s&&(t===s||t.startsWith(`${s}/`))?`~${t.slice(s.length)}`:t,Ma=(t,s,n)=>`${t} ${t===1?s:n}`;function Ua({label:t,count:s,testId:n}){return e.jsxs("div",{"data-testid":n,className:"flex items-center gap-2 mt-3 mx-1.5 mb-1 text-[11px] font-semibold tracking-[0.06em] uppercase text-fg-faint",children:[t,e.jsx("span",{"data-testid":`${n}-count`,className:"font-mono font-medium tracking-normal text-fg-faint/60",children:s})]})}function tt({children:t,testId:s,title:n}){return e.jsx("div",{"data-testid":s,title:n,className:"mx-1.5 mb-1 text-xs text-fg-faint",children:t})}function $a({filter:t,onFilterChange:s,items:n}){const[o,i]=u.useState(!1),a=u.useRef(null),r=u.useId();return u.useEffect(()=>{if(!o)return;const l=c=>{var p;(p=a.current)!=null&&p.contains(c.target)||i(!1)},d=c=>{c.key==="Escape"&&i(!1)};return window.addEventListener("mousedown",l),window.addEventListener("keydown",d),()=>{window.removeEventListener("mousedown",l),window.removeEventListener("keydown",d)}},[o]),e.jsxs("div",{ref:a,"data-testid":"skills-toolbar",className:"relative flex items-center gap-2 whitespace-nowrap",children:[e.jsxs("label",{className:"flex-1 min-w-0 flex items-center gap-2 h-[38px] px-3 rounded-[10px] bg-bg-hi border border-line text-[13px] text-fg-faint focus-within:border-fg-faint",children:[e.jsx(Ie,{name:"search",size:15,className:"shrink-0"}),e.jsx("input",{type:"search","data-testid":"skills-filter","aria-label":"Filter",placeholder:"Filter",value:t,spellCheck:!1,onChange:l=>s(l.target.value),className:"flex-1 min-w-0 bg-transparent outline-none text-fg placeholder:text-fg-faint"})]}),e.jsx("button",{type:"button","data-testid":"skills-new","aria-haspopup":"menu","aria-expanded":o,"aria-controls":o?r:void 0,onClick:()=>i(l=>!l),className:"h-[38px] px-4 rounded-[10px] bg-accent text-bg-hi hover:bg-accent/90 text-[13.5px] font-semibold focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",children:"+ New"}),o&&e.jsx("div",{id:r,role:"menu","aria-label":"New","data-testid":"skills-new-menu",className:`absolute ${Pe.dialog} right-0 top-[44px] min-w-[190px] p-[5px] flex flex-col bg-bg-hi border border-line rounded-lg shadow-lg text-[13px] text-fg`,children:n.map(l=>e.jsx("button",{type:"button",role:"menuitem","data-testid":l.testId,onClick:()=>{i(!1),l.onSelect()},className:"px-2.5 py-[7px] rounded-[5px] text-left whitespace-nowrap hover:bg-bg-elev",children:l.label},l.testId))})]})}function Ba({onAdd:t,scope:s="user"}={}){const n=Oe(),o=Et(),i=(o==null?void 0:o.cwd)??null,[a,r]=u.useState([]),[l,d]=u.useState(null),[c,p]=u.useState(""),[m,g]=u.useState([]),[h,f]=u.useState(!1),[b,y]=u.useState(null),[k,w]=u.useState(""),[j,P]=u.useState(null),_=u.useRef(null),S=u.useRef(null),A=Sa(n,s==="user"),L=u.useMemo(()=>A.flatMap(v=>v.items),[A]),E=u.useRef(L);E.current=L;const T=u.useMemo(()=>n?Ta(n,i):null,[n,i]),O=u.useMemo(()=>T?s==="user"?T.user:T.project:null,[s,T]),I=u.useRef(0),M=u.useCallback(async()=>{const v=++I.current;if(!O){r([]),g([]),f(!0);return}const R=[],$=[];try{const U=await Vt(O.skills);$.push(...U.errors);for(const H of U.entries)R.push({kind:"skills",scope:s,name:H.name,path:H.path,dir:H.dir,disabled:ao(H.text),description:it(H.text).description??void 0})}catch(U){$.push({path:O.skills,error:yt(U)})}try{const U=await window.api.config.listDir(O.commands,{filesOnly:!0});U.ok||$.push({path:O.commands,error:U.error??"failed to list directory"});const H=U.entries.filter(ke=>ke.name.endsWith(".md")),pe=await La(H.map(ke=>ke.path),$);H.forEach((ke,Re)=>{R.push({kind:"commands",scope:s,name:ke.name.replace(/\.md$/,""),path:ke.path,dir:null,disabled:!1,description:pe[Re]})})}catch(U){$.push({path:O.commands,error:yt(U)})}if(I.current===v){for(const U of $)W.error(`Could not read ${U.path}: ${U.error}`);g($),R.sort((U,H)=>U.kind===H.kind?U.name.localeCompare(H.name):U.kind==="skills"?-1:1),r(R),f(!0),d(U=>{var H;return R.find(pe=>pe.path===U)||E.current.some(pe=>pe.path===U)?U:((H=R[0])==null?void 0:H.path)??null})}},[O,s]);u.useEffect(()=>{M()},[M]);const ue=Se(v=>v.tab),le=Se(v=>v.id),te=Se(v=>v.clear);u.useEffect(()=>{if(ue!=="skills"||!le||!h)return;const v=le.startsWith("skills:")?le.slice(7):null;v&&a.some(R=>R.path===v)&&(p(""),d(v)),te()},[ue,le,h,a,te]),u.useEffect(()=>()=>{I.current+=1},[]);const ee=u.useRef(M);ee.current=M;const ce=u.useRef(a);ce.current=a;const J=u.useRef(l);J.current=l;const me=u.useRef(null),V=u.useRef(!1),B=u.useRef(!1),z=u.useCallback(async()=>{if(V.current){B.current=!0;return}V.current=!0;try{await ee.current()}finally{V.current=!1}B.current&&(B.current=!1,z())},[]);u.useEffect(()=>()=>{me.current&&clearTimeout(me.current)},[]);const se=u.useCallback(v=>{var H;const R=J.current,$=R?ce.current.find(pe=>pe.path===R):null,U=R?(H=G.getState().files[R])==null?void 0:H.lastSavedAt:null;$!=null&&$.dir&&U&&Date.now()-U<Oa&&(v===$.dir||$.dir.startsWith(`${v}/`))||(me.current&&clearTimeout(me.current),me.current=setTimeout(()=>{me.current=null,z()},Na))},[z]);Ys(O?[O.skills,O.commands]:[],se);const Q=G(v=>v.files),oe=G(v=>v.loadText),Ue=G(v=>v.setDraft),fe=G(v=>v.saveText),Ce=G(v=>v.revert),Y=G(v=>v.watchFile),X=G(v=>v.unwatchFile);async function N(v,R){const $=await window.api.config.readText(v.path);if(!$.exists)return;const U=co($.text,R);if(U===$.text)return;const H=await window.api.config.writeText(v.path,U);if(!H.ok){W.error(H.error??"failed to update skill");return}r(pe=>pe.map(ke=>ke.path===v.path?{...ke,disabled:R}:ke)),G.getState().files[v.path]&&G.getState().loadText(v.path,!0)}async function Z(v){if(!v.dir)return;const R=await window.api.files.delete(v.dir);if(!R.ok){W.error(R.error??"failed to remove skill");return}W.info(`Removed "${v.name}" — moved to trash`),X(v.path),r($=>{const U=$.filter(H=>H.path!==v.path);return d(H=>{var pe;return H!==v.path?H:((pe=U[0])==null?void 0:pe.path)??null}),U})}u.useEffect(()=>{if(l)return Q[l]||oe(l),Y(l),()=>X(l)},[l]);const[ie,re]=u.useState(null),we=!!(l&&Q[l]);u.useEffect(()=>{var R;if(!we||!l||_.current!==l)return;const v=(R=S.current)==null?void 0:R.querySelector('[data-testid="skill-detail-description"]');v&&(_.current=null,v.focus())},[we,l]);function je(v){p(""),w(""),P(null),y(v)}function he(){y(null),w(""),P(null)}async function be(v,R){if(!O)return;const $=R.trim();if(!Da.test($)){P(Pa);return}const U=v==="skills"?"skill":"command";if(a.some(Re=>Re.kind===v&&Re.name===$)){P(`A ${U} named "${$}" already exists`);return}const H=v==="skills"?`${O.skills}/${$}`:null,pe=v==="skills"?`${H}/SKILL.md`:`${O.commands}/${$}.md`;try{if((await window.api.config.readText(pe)).exists){P(`A ${U} named "${$}" already exists`);return}const Be=await window.api.config.writeText(pe,Ra(v,$));if(!Be.ok)throw new Error(Be.error??"write failed")}catch(Re){W.error(`Could not create ${U} "${$}": ${yt(Re)}`),he(),d(null);return}he();const ke={kind:v,scope:s,name:$,path:pe,dir:H,disabled:!1,description:""};r(Re=>[...Re.filter(Be=>Be.path!==pe),ke].sort((Be,ts)=>Be.kind===ts.kind?Be.name.localeCompare(ts.name):Be.kind==="skills"?-1:1)),_.current=pe,d(pe)}if(!n)return e.jsx(K,{title:"loading…"});if(s==="project"&&!i)return e.jsx(qe,{toolbar:e.jsx(e.Fragment,{}),children:e.jsx(K,{title:"no active project",hint:"open a tab in a project directory to view project skills & commands"})});const ge=l?Q[l]:null,C=l?a.find(v=>v.path===l)??null:null,q=!C&&l?L.find(v=>v.path===l)??null:null,F=c.trim().toLowerCase().replace(/^\//,""),de=v=>{var R;return!F||v.name.toLowerCase().includes(F)||!!((R=v.description)!=null&&R.toLowerCase().includes(F))},xe=a.filter(v=>v.kind==="skills"),Te=a.filter(v=>v.kind==="commands"),lt=xe.filter(de),Xe=Te.filter(de),ct=v=>v?m.filter(R=>R.path===v||R.path.startsWith(`${v}/`)):[],Je=ct(O==null?void 0:O.skills),Qe=ct(O==null?void 0:O.commands),We=()=>je("skills"),dt=[{label:"New skill",testId:"skills-new-skill",onSelect:We},{label:"New command",testId:"skills-new-command",onSelect:()=>je("commands")},...t?[{label:"Browse catalog…",testId:"skills-new-browse-catalog",onSelect:t}]:[]],pt=v=>b!==v?null:e.jsxs("div",{"data-testid":`skills-new-row-${v}`,className:"flex flex-col gap-1",children:[e.jsx("input",{autoFocus:!0,"data-testid":`skills-new-name-${v}`,"aria-label":v==="skills"?"New skill name":"New command name","aria-invalid":j?"true":void 0,placeholder:v==="skills"?"skill-name":"command-name",value:k,spellCheck:!1,onChange:R=>{w(R.target.value),P(null)},onKeyDown:R=>{R.key==="Escape"?(R.preventDefault(),R.stopPropagation(),he()):R.key==="Enter"&&(R.preventDefault(),be(v,k))},className:`h-[34px] px-3 bg-bg-hi border rounded-[10px] font-mono text-[13px] text-fg outline-none ${j?"border-red-400":"border-accent"}`}),j&&e.jsx("div",{"data-testid":`skills-new-error-${v}`,role:"alert",className:"mx-1 text-[11px] text-red-400",children:j})]}),ut=v=>{var U;const R=l===v.path,$=!!((U=Q[v.path])!=null&&U.dirty);return e.jsx("div",{"data-testid":"skills-item","data-path":v.path,children:e.jsx(Mo,{title:`/${v.name}`,selected:R,muted:v.disabled,onSelect:()=>d(v.path),meta:v.description?e.jsx("span",{"data-testid":"skills-item-desc",title:v.description,children:v.description}):void 0,trailing:$||v.kind==="skills"?e.jsxs("span",{className:"flex items-center gap-2",children:[$&&e.jsx("span",{"data-testid":"skills-item-dirty",title:"Unsaved edits",className:"w-1.5 h-1.5 rounded-full bg-accent"}),v.kind==="skills"&&e.jsx("span",{onClick:H=>H.stopPropagation(),title:$?"This skill has unsaved edits — save or revert before toggling":v.disabled?"Disabled — Claude will not auto-invoke this skill":void 0,children:e.jsx(Me,{checked:!v.disabled,disabled:$,onChange:H=>void N(v,!H)})})]}):void 0})},v.path)};let x=null;lt.length>0?x=lt.map(ut):h?xe.length>0?x=e.jsx(tt,{children:"No skills match the filter"}):Je.length>0?x=e.jsx(tt,{testId:"skills-list-skills-error",title:Je.map(v=>`${v.path}: ${v.error}`).join(`
65
- `),children:"Could not list skills"}):x=e.jsxs("div",{"data-testid":"skills-empty",className:"px-3 py-[11px] flex flex-col gap-[5px] border border-dashed border-rule rounded-xl text-xs leading-[1.45] text-fg-dim",children:[e.jsx("span",{className:"font-semibold text-fg",children:"No skills yet"}),e.jsx("span",{children:"A skill is a folder with a SKILL.md that Claude loads when a task calls for it."}),e.jsx("button",{type:"button","data-testid":"skills-create-link",onClick:()=>We(),className:"self-start font-semibold text-accent hover:underline",children:"Create a skill →"})]}):x=null;let D=null;Xe.length>0?D=Xe.map(ut):h?Te.length>0?D=e.jsx(tt,{children:"No commands match the filter"}):Qe.length>0?D=e.jsx(tt,{testId:"skills-list-commands-error",title:Qe.map(v=>`${v.path}: ${v.error}`).join(`
66
- `),children:"Could not list slash commands"}):D=e.jsx(tt,{children:"No slash commands"}):D=null;const ne=xe.filter(v=>!v.disabled).length,ae=`${Ia((O==null?void 0:O.skills)??"",n)}/`,ve=`${Ma(xe.length,"skill","skills")} · ${s==="user"?"on in every project":"on in this project"}`,$e=e.jsxs(e.Fragment,{children:[e.jsx(on,{eyebrow:"SKILLS FOLDER",badge:e.jsxs("span",{"data-testid":"skills-folder-on",children:[ne," on"]}),path:ae,note:e.jsx("span",{"data-testid":"skills-folder-note",children:ve})}),e.jsx($a,{filter:c,onFilterChange:p,items:dt}),e.jsxs("div",{"data-testid":"skills-list",role:"listbox","aria-label":"Skills",className:"flex flex-col gap-1",children:[pt("skills"),x,e.jsx(Ua,{label:"Slash commands",count:Xe.length,testId:"skills-section-commands"}),pt("commands"),D,s==="user"&&h&&e.jsx(Aa,{plugins:A,needle:F,selectedPath:l,onSelect:d})]})]}),Ze=C&&ge?e.jsx(Ms,{item:C,home:n,draft:ge.draftRaw,dirty:ge.dirty,busy:ge.busy,lastSavedAt:ge.lastSavedAt,saveError:ie,onDraftChange:v=>{re(null),Ue(C.path,v)},onSave:async()=>{re(null);const v=await fe(C.path);v.ok||re(v.error??"save failed")},onRevert:()=>{re(null),Ce(C.path)},onToggleEnabled:C.kind==="skills"?v=>void N(C,!v):void 0,onRemove:C.dir?()=>void Z(C):void 0}):q&&ge?e.jsx(Ms,{readOnly:!0,item:{...q,scope:s},home:n,draft:ge.draftRaw,dirty:!1,busy:ge.busy,lastSavedAt:ge.lastSavedAt,saveError:null,onDraftChange:()=>{},onSave:()=>{},onRevert:()=>{}}):a.length===0&&m.length>0?e.jsx("div",{"data-testid":"skills-list-error",children:e.jsx(K,{title:"could not list skills or commands",hint:m.map(v=>`${v.path}: ${v.error}`).join(`
67
- `)})}):e.jsx(K,{title:a.length===0?"no skills or commands":"select an item"});return e.jsx("div",{ref:S,"data-testid":"skills-page",className:"h-full flex flex-col",children:e.jsx(St,{list:$e,detail:Ze})})}const ul=u.memo(Ba);export{Nn as A,Dn as B,tl as C,rn as D,Ir as E,dl as F,Qa as G,Se as H,il as I,Ve as J,ji as L,sl as M,ol as P,rl as S,Xa as a,Ge as b,Ct as c,on as d,Mo as e,Za as f,el as g,Ja as h,St as i,pl as j,ul as k,nl as l,Va as m,za as n,Ya as o,al as p,Eo as q,ll as r,cl as s,si as t,On as u,qa as v,Ka as w,pn as x,ta as y,es as z};
64
+ `),Ba=(t,s)=>s&&(t===s||t.startsWith(`${s}/`))?`~${t.slice(s.length)}`:t,Fa=(t,s,n)=>`${t} ${t===1?s:n}`;function Ha({label:t,count:s,testId:n}){return e.jsxs("div",{"data-testid":n,className:"flex items-center gap-2 mt-3 mx-1.5 mb-1 text-[11px] font-semibold tracking-[0.06em] uppercase text-fg-faint",children:[t,e.jsx("span",{"data-testid":`${n}-count`,className:"font-mono font-medium tracking-normal text-fg-faint/60",children:s})]})}function tt({children:t,testId:s,title:n}){return e.jsx("div",{"data-testid":s,title:n,className:"mx-1.5 mb-1 text-xs text-fg-faint",children:t})}function Ga({filter:t,onFilterChange:s,items:n}){const[o,i]=u.useState(!1),a=u.useRef(null),r=u.useId();return u.useEffect(()=>{if(!o)return;const l=c=>{var p;(p=a.current)!=null&&p.contains(c.target)||i(!1)},d=c=>{c.key==="Escape"&&i(!1)};return window.addEventListener("mousedown",l),window.addEventListener("keydown",d),()=>{window.removeEventListener("mousedown",l),window.removeEventListener("keydown",d)}},[o]),e.jsxs("div",{ref:a,"data-testid":"skills-toolbar",className:"relative flex items-center gap-2 whitespace-nowrap",children:[e.jsxs("label",{className:"flex-1 min-w-0 flex items-center gap-2 h-[38px] px-3 rounded-[10px] bg-bg-hi border border-line text-[13px] text-fg-faint focus-within:border-fg-faint",children:[e.jsx(Ie,{name:"search",size:15,className:"shrink-0"}),e.jsx("input",{type:"search","data-testid":"skills-filter","aria-label":"Filter",placeholder:"Filter",value:t,spellCheck:!1,onChange:l=>s(l.target.value),className:"flex-1 min-w-0 bg-transparent outline-none text-fg placeholder:text-fg-faint"})]}),e.jsx("button",{type:"button","data-testid":"skills-new","aria-haspopup":"menu","aria-expanded":o,"aria-controls":o?r:void 0,onClick:()=>i(l=>!l),className:"h-[38px] px-4 rounded-[10px] bg-accent text-bg-hi hover:bg-accent/90 text-[13.5px] font-semibold focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",children:"+ New"}),o&&e.jsx("div",{id:r,role:"menu","aria-label":"New","data-testid":"skills-new-menu",className:`absolute ${je.dialog} right-0 top-[44px] min-w-[190px] p-[5px] flex flex-col bg-bg-hi border border-line rounded-lg shadow-lg text-[13px] text-fg`,children:n.map(l=>e.jsx("button",{type:"button",role:"menuitem","data-testid":l.testId,onClick:()=>{i(!1),l.onSelect()},className:"px-2.5 py-[7px] rounded-[5px] text-left whitespace-nowrap hover:bg-bg-elev",children:l.label},l.testId))})]})}function Wa({onAdd:t,scope:s="user"}={}){const n=Oe(),o=Et(),i=(o==null?void 0:o.cwd)??null,[a,r]=u.useState([]),[l,d]=u.useState(null),[c,p]=u.useState(""),[m,g]=u.useState([]),[h,f]=u.useState(!1),[b,y]=u.useState(null),[k,w]=u.useState(""),[O,D]=u.useState(null),C=u.useRef(null),E=u.useRef(null),_=Na(n,s==="user"),j=u.useMemo(()=>_.flatMap(v=>v.items),[_]),A=u.useRef(j);A.current=j;const L=u.useMemo(()=>n?Ra(n,i):null,[n,i]),T=u.useMemo(()=>L?s==="user"?L.user:L.project:null,[s,L]),U=u.useRef(0),I=u.useCallback(async()=>{const v=++U.current;if(!T){r([]),g([]),f(!0);return}const R=[],$=[];try{const M=await Vt(T.skills);$.push(...M.errors);for(const H of M.entries)R.push({kind:"skills",scope:s,name:H.name,path:H.path,dir:H.dir,disabled:co(H.text),description:it(H.text).description??void 0})}catch(M){$.push({path:T.skills,error:yt(M)})}try{const M=await window.api.config.listDir(T.commands,{filesOnly:!0});M.ok||$.push({path:T.commands,error:M.error??"failed to list directory"});const H=M.entries.filter(ke=>ke.name.endsWith(".md")),pe=await Ia(H.map(ke=>ke.path),$);H.forEach((ke,Re)=>{R.push({kind:"commands",scope:s,name:ke.name.replace(/\.md$/,""),path:ke.path,dir:null,disabled:!1,description:pe[Re]})})}catch(M){$.push({path:T.commands,error:yt(M)})}if(U.current===v){for(const M of $)W.error(`Could not read ${M.path}: ${M.error}`);g($),R.sort((M,H)=>M.kind===H.kind?M.name.localeCompare(H.name):M.kind==="skills"?-1:1),r(R),f(!0),d(M=>{var H;return R.find(pe=>pe.path===M)||A.current.some(pe=>pe.path===M)?M:((H=R[0])==null?void 0:H.path)??null})}},[T,s]);u.useEffect(()=>{I()},[I]);const ue=Se(v=>v.tab),le=Se(v=>v.id),te=Se(v=>v.clear);u.useEffect(()=>{if(ue!=="skills"||!le||!h)return;const v=le.startsWith("skills:")?le.slice(7):null;v&&a.some(R=>R.path===v)&&(p(""),d(v)),te()},[ue,le,h,a,te]),u.useEffect(()=>()=>{U.current+=1},[]);const ee=u.useRef(I);ee.current=I;const ce=u.useRef(a);ce.current=a;const J=u.useRef(l);J.current=l;const me=u.useRef(null),V=u.useRef(!1),B=u.useRef(!1),z=u.useCallback(async()=>{if(V.current){B.current=!0;return}V.current=!0;try{await ee.current()}finally{V.current=!1}B.current&&(B.current=!1,z())},[]);u.useEffect(()=>()=>{me.current&&clearTimeout(me.current)},[]);const se=u.useCallback(v=>{var H;const R=J.current,$=R?ce.current.find(pe=>pe.path===R):null,M=R?(H=G.getState().files[R])==null?void 0:H.lastSavedAt:null;$!=null&&$.dir&&M&&Date.now()-M<Da&&(v===$.dir||$.dir.startsWith(`${v}/`))||(me.current&&clearTimeout(me.current),me.current=setTimeout(()=>{me.current=null,z()},La))},[z]);Xs(T?[T.skills,T.commands]:[],se);const Q=G(v=>v.files),oe=G(v=>v.loadText),Ue=G(v=>v.setDraft),fe=G(v=>v.saveText),Ce=G(v=>v.revert),X=G(v=>v.watchFile),Y=G(v=>v.unwatchFile);async function N(v,R){const $=await window.api.config.readText(v.path);if(!$.exists)return;const M=uo($.text,R);if(M===$.text)return;const H=await window.api.config.writeText(v.path,M);if(!H.ok){W.error(H.error??"failed to update skill");return}r(pe=>pe.map(ke=>ke.path===v.path?{...ke,disabled:R}:ke)),G.getState().files[v.path]&&G.getState().loadText(v.path,!0)}async function Z(v){if(!v.dir)return;const R=await window.api.files.delete(v.dir);if(!R.ok){W.error(R.error??"failed to remove skill");return}W.info(`Removed "${v.name}" — moved to trash`),Y(v.path),r($=>{const M=$.filter(H=>H.path!==v.path);return d(H=>{var pe;return H!==v.path?H:((pe=M[0])==null?void 0:pe.path)??null}),M})}u.useEffect(()=>{if(l)return Q[l]||oe(l),X(l),()=>Y(l)},[l]);const[ie,re]=u.useState(null),we=!!(l&&Q[l]);u.useEffect(()=>{var R;if(!we||!l||C.current!==l)return;const v=(R=E.current)==null?void 0:R.querySelector('[data-testid="skill-detail-description"]');v&&(C.current=null,v.focus())},[we,l]);function Te(v){p(""),w(""),D(null),y(v)}function he(){y(null),w(""),D(null)}async function be(v,R){if(!T)return;const $=R.trim();if(!Ma.test($)){D(Ua);return}const M=v==="skills"?"skill":"command";if(a.some(Re=>Re.kind===v&&Re.name===$)){D(`A ${M} named "${$}" already exists`);return}const H=v==="skills"?`${T.skills}/${$}`:null,pe=v==="skills"?`${H}/SKILL.md`:`${T.commands}/${$}.md`;try{if((await window.api.config.readText(pe)).exists){D(`A ${M} named "${$}" already exists`);return}const Be=await window.api.config.writeText(pe,$a(v,$));if(!Be.ok)throw new Error(Be.error??"write failed")}catch(Re){W.error(`Could not create ${M} "${$}": ${yt(Re)}`),he(),d(null);return}he();const ke={kind:v,scope:s,name:$,path:pe,dir:H,disabled:!1,description:""};r(Re=>[...Re.filter(Be=>Be.path!==pe),ke].sort((Be,ts)=>Be.kind===ts.kind?Be.name.localeCompare(ts.name):Be.kind==="skills"?-1:1)),C.current=pe,d(pe)}if(!n)return e.jsx(K,{title:"loading…"});if(s==="project"&&!i)return e.jsx(qe,{toolbar:e.jsx(e.Fragment,{}),children:e.jsx(K,{title:"no active project",hint:"open a tab in a project directory to view project skills & commands"})});const ge=l?Q[l]:null,S=l?a.find(v=>v.path===l)??null:null,q=!S&&l?j.find(v=>v.path===l)??null:null,F=c.trim().toLowerCase().replace(/^\//,""),de=v=>{var R;return!F||v.name.toLowerCase().includes(F)||!!((R=v.description)!=null&&R.toLowerCase().includes(F))},xe=a.filter(v=>v.kind==="skills"),Le=a.filter(v=>v.kind==="commands"),lt=xe.filter(de),Ye=Le.filter(de),ct=v=>v?m.filter(R=>R.path===v||R.path.startsWith(`${v}/`)):[],Je=ct(T==null?void 0:T.skills),Qe=ct(T==null?void 0:T.commands),We=()=>Te("skills"),dt=[{label:"New skill",testId:"skills-new-skill",onSelect:We},{label:"New command",testId:"skills-new-command",onSelect:()=>Te("commands")},...t?[{label:"Browse catalog…",testId:"skills-new-browse-catalog",onSelect:t}]:[]],pt=v=>b!==v?null:e.jsxs("div",{"data-testid":`skills-new-row-${v}`,className:"flex flex-col gap-1",children:[e.jsx("input",{autoFocus:!0,"data-testid":`skills-new-name-${v}`,"aria-label":v==="skills"?"New skill name":"New command name","aria-invalid":O?"true":void 0,placeholder:v==="skills"?"skill-name":"command-name",value:k,spellCheck:!1,onChange:R=>{w(R.target.value),D(null)},onKeyDown:R=>{R.key==="Escape"?(R.preventDefault(),R.stopPropagation(),he()):R.key==="Enter"&&(R.preventDefault(),be(v,k))},className:`h-[34px] px-3 bg-bg-hi border rounded-[10px] font-mono text-[13px] text-fg outline-none ${O?"border-red-400":"border-accent"}`}),O&&e.jsx("div",{"data-testid":`skills-new-error-${v}`,role:"alert",className:"mx-1 text-[11px] text-red-400",children:O})]}),ut=v=>{var M;const R=l===v.path,$=!!((M=Q[v.path])!=null&&M.dirty);return e.jsx("div",{"data-testid":"skills-item","data-path":v.path,children:e.jsx(Fo,{title:`/${v.name}`,selected:R,muted:v.disabled,onSelect:()=>d(v.path),meta:v.description?e.jsx("span",{"data-testid":"skills-item-desc",title:v.description,children:v.description}):void 0,trailing:$||v.kind==="skills"?e.jsxs("span",{className:"flex items-center gap-2",children:[$&&e.jsx("span",{"data-testid":"skills-item-dirty",title:"Unsaved edits",className:"w-1.5 h-1.5 rounded-full bg-accent"}),v.kind==="skills"&&e.jsx("span",{onClick:H=>H.stopPropagation(),title:$?"This skill has unsaved edits — save or revert before toggling":v.disabled?"Disabled — Claude will not auto-invoke this skill":void 0,children:e.jsx(Me,{checked:!v.disabled,disabled:$,onChange:H=>void N(v,!H)})})]}):void 0})},v.path)};let x=null;lt.length>0?x=lt.map(ut):h?xe.length>0?x=e.jsx(tt,{children:"No skills match the filter"}):Je.length>0?x=e.jsx(tt,{testId:"skills-list-skills-error",title:Je.map(v=>`${v.path}: ${v.error}`).join(`
65
+ `),children:"Could not list skills"}):x=e.jsxs("div",{"data-testid":"skills-empty",className:"px-3 py-[11px] flex flex-col gap-[5px] border border-dashed border-rule rounded-xl text-xs leading-[1.45] text-fg-dim",children:[e.jsx("span",{className:"font-semibold text-fg",children:"No skills yet"}),e.jsx("span",{children:"A skill is a folder with a SKILL.md that Claude loads when a task calls for it."}),e.jsx("button",{type:"button","data-testid":"skills-create-link",onClick:()=>We(),className:"self-start font-semibold text-accent hover:underline",children:"Create a skill →"})]}):x=null;let P=null;Ye.length>0?P=Ye.map(ut):h?Le.length>0?P=e.jsx(tt,{children:"No commands match the filter"}):Qe.length>0?P=e.jsx(tt,{testId:"skills-list-commands-error",title:Qe.map(v=>`${v.path}: ${v.error}`).join(`
66
+ `),children:"Could not list slash commands"}):P=e.jsx(tt,{children:"No slash commands"}):P=null;const ne=xe.filter(v=>!v.disabled).length,ae=`${Ba((T==null?void 0:T.skills)??"",n)}/`,ve=`${Fa(xe.length,"skill","skills")} · ${s==="user"?"on in every project":"on in this project"}`,$e=e.jsxs(e.Fragment,{children:[e.jsx(on,{eyebrow:"SKILLS FOLDER",badge:e.jsxs("span",{"data-testid":"skills-folder-on",children:[ne," on"]}),path:ae,note:e.jsx("span",{"data-testid":"skills-folder-note",children:ve})}),e.jsx(Ga,{filter:c,onFilterChange:p,items:dt}),e.jsxs("div",{"data-testid":"skills-list",role:"listbox","aria-label":"Skills",className:"flex flex-col gap-1",children:[pt("skills"),x,e.jsx(Ha,{label:"Slash commands",count:Ye.length,testId:"skills-section-commands"}),pt("commands"),P,s==="user"&&h&&e.jsx(Ta,{plugins:_,needle:F,selectedPath:l,onSelect:d})]})]}),Ze=S&&ge?e.jsx(Ms,{item:S,home:n,draft:ge.draftRaw,dirty:ge.dirty,busy:ge.busy,lastSavedAt:ge.lastSavedAt,saveError:ie,onDraftChange:v=>{re(null),Ue(S.path,v)},onSave:async()=>{re(null);const v=await fe(S.path);v.ok||re(v.error??"save failed")},onRevert:()=>{re(null),Ce(S.path)},onToggleEnabled:S.kind==="skills"?v=>void N(S,!v):void 0,onRemove:S.dir?()=>void Z(S):void 0}):q&&ge?e.jsx(Ms,{readOnly:!0,item:{...q,scope:s},home:n,draft:ge.draftRaw,dirty:!1,busy:ge.busy,lastSavedAt:ge.lastSavedAt,saveError:null,onDraftChange:()=>{},onSave:()=>{},onRevert:()=>{}}):a.length===0&&m.length>0?e.jsx("div",{"data-testid":"skills-list-error",children:e.jsx(K,{title:"could not list skills or commands",hint:m.map(v=>`${v.path}: ${v.error}`).join(`
67
+ `)})}):e.jsx(K,{title:a.length===0?"no skills or commands":"select an item"});return e.jsx("div",{ref:E,"data-testid":"skills-page",className:"h-full flex flex-col",children:e.jsx(St,{list:$e,detail:Ze})})}const gl=u.memo(Wa);export{Dn as A,Br as B,tl as C,rn as D,hl as E,el as F,Se as G,il as H,cl as I,Ve as J,Pi as L,rl as M,ll as P,dl as S,ol as a,Ge as b,Ct as c,on as d,Fo as e,sl as f,nl as g,St as h,fl as i,gl as j,al as k,Ja as l,Qa as m,Za as n,pl as o,Co as p,ul as q,ml as r,ri as s,jn as t,Xa as u,Ya as v,pn as w,ia as x,es as y,Nn as z};