claude-code-session-manager 0.75.0 → 0.75.1
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.
- package/dist/assets/{AgentLibrary-SpzptNyq.js → AgentLibrary-CGplUKxY.js} +1 -1
- package/dist/assets/{DataModel-C4M9xVLC.js → DataModel-DQ15KxVb.js} +1 -1
- package/dist/assets/{History-92FYrZKS.js → History-v2TSC_6A.js} +1 -1
- package/dist/assets/{Hooks-DlnavO1l.js → Hooks-Co7s6BNB.js} +1 -1
- package/dist/assets/{HostBilko-CKI7jt1z.js → HostBilko-DJj8FWPK.js} +1 -1
- package/dist/assets/{Library-Brhxe7xa.js → Library-DQaC9VQ1.js} +1 -1
- package/dist/assets/{ListDetail-DmIweYTN.js → ListDetail-BwFRfAZm.js} +1 -1
- package/dist/assets/{MarkdownEditor-DA4xqWWi.js → MarkdownEditor-C155gNpc.js} +1 -1
- package/dist/assets/{McpServers-DWXQGzVc.js → McpServers-BmLgE_gS.js} +1 -1
- package/dist/assets/{Memory-HCx9Arao.js → Memory-ISwNcS5j.js} +1 -1
- package/dist/assets/{Panel-B20C6kN8.js → Panel-1adjEpj-.js} +1 -1
- package/dist/assets/{Permissions-C4sPgLpA.js → Permissions-FrCz5cGa.js} +1 -1
- package/dist/assets/{Plugins-CaRenCBg.js → Plugins-zUssKp_b.js} +2 -2
- package/dist/assets/{ProvenanceBadge-DfrXzTeh.js → ProvenanceBadge-CAXqA_HX.js} +1 -1
- package/dist/assets/{SaveBar-BmpUx2Yh.js → SaveBar-D9cqms3Y.js} +1 -1
- package/dist/assets/{Scheduler-xUD8pQ6q.js → Scheduler-dNNc9S11.js} +1 -1
- package/dist/assets/{ScopeSwitcher-DVlKMck5.js → ScopeSwitcher-1wBTne7S.js} +1 -1
- package/dist/assets/{Settings-C457mxOK.js → Settings-BT_expIg.js} +1 -1
- package/dist/assets/{SkillReferenceGraph-D3dDc5X7.js → SkillReferenceGraph-CVccq4Cu.js} +1 -1
- package/dist/assets/{Skills-BNDlbftC.js → Skills-xFpRY0ld.js} +1 -1
- package/dist/assets/{SystemPrompt-d-ykNRec.js → SystemPrompt-CEk_71th.js} +1 -1
- package/dist/assets/{TagLibrary-D3JWkQK-.js → TagLibrary-C2zhihQG.js} +1 -1
- package/dist/assets/{TiptapBody-B1Ox6D6E.js → TiptapBody-CQKcHKaD.js} +1 -1
- package/dist/assets/{Toggle-CaYw6Lrj.js → Toggle-CQ-IBb8m.js} +1 -1
- package/dist/assets/{index-CEeLxNCz.js → index-BgbV3sKX.js} +3 -3
- package/dist/assets/{settingsSchema-DUkd45M5.js → settingsSchema-D6ccSKqm.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/main/__tests__/scheduler-autofix-outcome.test.cjs +116 -0
- package/src/main/__tests__/scheduler-autofix-select.test.cjs +113 -7
- package/src/main/__tests__/scheduler-fix-plan-path.test.cjs +119 -0
- package/src/main/scheduler.cjs +136 -27
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{ad as x,a4 as o,S as j,aq as P}from"./index-CEeLxNCz.js";function re({node:e,targetScope:t,onOverride:r,schema:n,rootLabel:m}){const[c,f]=x.useState(""),[d,l]=x.useState(!0),g=[],i=e.kind==="object"&&Object.keys(e.children).length===0,h=((n==null?void 0:n.rootKeys())??[]).length>0;return o.jsxs("div",{className:"h-full flex flex-col",children:[o.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:[o.jsxs("span",{className:"text-fg-faint",children:["merged · overrides → ",o.jsx("span",{className:"text-fg-dim",children:j[t].label})]}),h&&o.jsxs("label",{className:"flex items-center gap-1 text-fg-faint cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:d,onChange:s=>l(s.target.checked),className:"accent-accent"}),"show unset keys"]}),o.jsx("div",{className:"flex-1"}),o.jsx("input",{value:c,onChange:s=>f(s.target.value),placeholder:"filter keys or descriptions…",className:"bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg w-56"})]}),o.jsx("div",{className:"flex-1 overflow-auto px-3 py-2 font-mono text-xs",children:i&&!d?o.jsx("div",{className:"text-fg-faint italic px-2 py-4",children:"no settings resolved — all scope files empty or missing"}):o.jsx(O,{node:e,path:g,label:m??"(root)",targetScope:t,onOverride:r,filter:c,depth:0,schema:n,showGhosts:d,defaultOpen:!0})})]})}function O(e){return e.node.kind==="object"?o.jsx(D,{...e,node:e.node}):e.node.kind==="array"?o.jsx(R,{...e,node:e.node}):o.jsx($,{...e,node:e.node})}function L(e,t){return t.trim()?e.toLowerCase().includes(t.toLowerCase()):!0}function w(e,t,r){return!!(!r.trim()||e.some(n=>L(n,r))||t!=null&&t.description&&L(t.description,r))}function D({node:e,path:t,label:r,targetScope:n,onOverride:m,filter:c,depth:f,schema:d,showGhosts:l,defaultOpen:g}){const[i,b]=x.useState(g??f<2),h=(d==null?void 0:d.at(t))??null,s=new Set(Object.keys(e.children)),a=l?(h==null?void 0:h.knownChildren)??[]:[],u=Array.from(new Set([...s,...a])).sort(),p=x.useMemo(()=>c.trim()?u.filter(y=>{const v=(d==null?void 0:d.at([...t,y]))??null;return w([...t,y],v,c)?!0:s.has(y)?N(e.children[y],[...t,y],c,d):!1}):u,[u.join(","),c,e,t.join("."),d]);if(c.trim()&&p.length===0&&!w(t,h,c))return null;if(t.length===0)return o.jsx("div",{children:p.map(y=>k(y))});return o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-1 py-0.5 hover:bg-bg-elev/50 rounded cursor-pointer",style:{paddingLeft:f*14},onClick:()=>b(!i),children:[o.jsx("span",{className:"text-fg-faint w-3 shrink-0",children:i?"▾":"▸"}),o.jsx("span",{className:"text-fg",children:r}),o.jsxs("span",{className:"text-fg-faint",children:[" {",s.size,a.length>s.size?`/${new Set([...s,...a]).size}`:"","}"]}),(h==null?void 0:h.description)&&o.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:h.description,children:["— ",h.description]})]}),i&&p.map(y=>k(y))]});function k(y){if(s.has(y))return o.jsx(O,{node:e.children[y],path:[...t,y],label:y,targetScope:n,onOverride:m,filter:c,depth:f+1,schema:d,showGhosts:l},y);const v=(d==null?void 0:d.at([...t,y]))??null;return v?o.jsx(_,{path:[...t,y],label:y,info:v,targetScope:n,onSet:m,depth:f+1,filter:c},y):null}}function N(e,t,r,n){const m=(n==null?void 0:n.at(t))??null;if(w(t,m,r))return!0;if(e.kind!=="object")return!1;for(const c of Object.keys(e.children))if(N(e.children[c],[...t,c],r,n))return!0;return!1}function R({node:e,path:t,label:r,filter:n,depth:m,schema:c}){const[f,d]=x.useState(!0),l=(c==null?void 0:c.at(t))??null;return w(t,l,n)?o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-1 py-0.5 hover:bg-bg-elev/50 rounded cursor-pointer",style:{paddingLeft:m*14},onClick:()=>d(!f),children:[o.jsx("span",{className:"text-fg-faint w-3 shrink-0",children:f?"▾":"▸"}),o.jsx("span",{className:"text-fg",children:r}),o.jsxs("span",{className:"text-fg-faint",children:[" [",e.items.length,"]"]}),o.jsx(S,{tone:"warn",children:"accumulated"}),(l==null?void 0:l.description)&&o.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:l.description,children:["— ",l.description]})]}),f&&e.items.map((g,i)=>o.jsxs("div",{className:"flex items-start gap-2 py-0.5",style:{paddingLeft:(m+1)*14},children:[o.jsx("span",{className:"text-fg-faint w-3 shrink-0"}),o.jsxs("span",{className:"text-fg-faint",children:[i,":"]}),o.jsx("span",{className:"text-fg-dim truncate max-w-xl",children:E(g.value)}),o.jsx(M,{scope:g.fromScope})]},i))]}):null}function $({node:e,path:t,label:r,targetScope:n,onOverride:m,filter:c,depth:f,schema:d}){const[l,g]=x.useState(!1),i=(d==null?void 0:d.at(t))??null;if(!w(t,i,c))return null;const b=e.winner!==n,h=e.shadowed.length>0;return o.jsxs("div",{children:[o.jsxs("div",{className:"group flex items-center gap-2 py-0.5 hover:bg-bg-elev/50 rounded",style:{paddingLeft:f*14},children:[o.jsx("span",{className:`w-3 shrink-0 ${h?"text-fg-faint cursor-pointer":""}`,onClick:()=>h&&g(!l),children:h?l?"▾":"▸":""}),o.jsxs("span",{className:"text-fg",children:[r,":"]}),o.jsx("span",{className:"text-fg-dim truncate max-w-md",children:E(e.value)}),o.jsx(M,{scope:e.winner}),(i==null?void 0:i.deprecated)&&o.jsx(S,{tone:"warn",children:"deprecated"}),(i==null?void 0:i.default)!==void 0&&I(e.value,i.default)&&o.jsx(S,{tone:"dim",children:"= default"}),e.typeMismatch&&o.jsx("span",{className:"text-yellow-500/80",title:"shadowed scopes have a different value type",children:"⚠"}),(i==null?void 0:i.description)&&o.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:i.description,children:["— ",i.description]}),o.jsx("div",{className:"flex-1"}),(i==null?void 0:i.enum)&&o.jsx(T,{values:i.enum}),o.jsx("button",{disabled:!b,onClick:()=>m(t,e.value),className:`opacity-0 group-hover:opacity-100 px-1.5 py-0 text-[10px] border rounded transition-opacity ${b?"border-accent/50 text-accent hover:bg-accent hover:text-bg":"border-line text-fg-faint cursor-not-allowed"}`,title:b?`copy into ${j[n].label} draft`:`already winning in ${j[n].label}`,children:"override"})]}),l&&e.shadowed.map((s,a)=>o.jsxs("div",{className:"flex items-center gap-2 py-0.5 text-fg-faint line-through",style:{paddingLeft:(f+1)*14+12},children:[o.jsx("span",{children:"shadowed:"}),o.jsx("span",{className:"truncate max-w-xl",children:E(s.value)}),o.jsx(M,{scope:s.scope,dim:!0})]},a))]})}function _({path:e,label:t,info:r,targetScope:n,onSet:m,depth:c,filter:f}){if(!w(e,r,f))return null;const d=r.default!==void 0?r.default:H(r.type),l=Array.isArray(r.type)?r.type.join("|"):r.type??"?";return o.jsxs("div",{className:"group flex items-center gap-2 py-0.5 hover:bg-bg-elev/50 rounded opacity-60",style:{paddingLeft:c*14},children:[o.jsx("span",{className:"w-3 shrink-0"}),o.jsx("span",{className:"text-fg-dim",children:t}),o.jsx(S,{tone:"dim",children:l}),r.required&&o.jsx(S,{tone:"warn",children:"required"}),r.default!==void 0&&o.jsxs("span",{className:"text-fg-faint",children:["default: ",E(r.default)]}),r.description&&o.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:r.description,children:["— ",r.description]}),o.jsx("div",{className:"flex-1"}),r.enum&&o.jsx(T,{values:r.enum}),o.jsx("button",{onClick:()=>m(e,d),className:"opacity-0 group-hover:opacity-100 px-1.5 py-0 text-[10px] border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg transition-opacity",title:`write to ${j[n].label} draft`,children:"set"})]})}function I(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"?JSON.stringify(e)===JSON.stringify(t):!1}function H(e){switch(Array.isArray(e)?e[0]:e){case"boolean":return!1;case"integer":case"number":return 0;case"string":return"";case"array":return[];case"object":return{};case"null":return null;default:return null}}function E(e){if(typeof e=="string")return JSON.stringify(e);if(e===null)return"null";if(typeof e=="object"){const t=JSON.stringify(e);return t.length>100?t.slice(0,100)+"…":t}return String(e)}function M({scope:e,dim:t}){const r=e==="user"?"bg-bg-hi text-fg-dim border-line":e==="project"?"bg-blue-950/30 text-blue-400/80 border-blue-900/40":"bg-purple-950/30 text-purple-400/80 border-purple-900/40";return o.jsx("span",{className:`text-[10px] px-1 py-0 rounded border uppercase tracking-wide shrink-0 ${r} ${t?"opacity-60":""}`,children:j[e].label})}function S({children:e,tone:t="default"}){const r={default:"bg-bg-hi text-fg-dim border-line",warn:"bg-yellow-950/30 text-yellow-500/80 border-yellow-900/40",dim:"bg-bg-elev text-fg-faint border-line"}[t];return o.jsx("span",{className:`text-[10px] px-1 py-0 rounded border uppercase tracking-wide shrink-0 ${r}`,children:e})}function T({values:e}){const t=e.map(r=>String(r)).join(" | ");return o.jsxs("span",{className:"text-[10px] text-fg-faint truncate max-w-xs",title:`allowed: ${t}`,children:["∈ ",t.length>30?t.slice(0,30)+"…":t]})}function ie(e,t,r){const n=P(l=>l.files),m=P(l=>l.loadJson),c=P(l=>l.watchFile),f=P(l=>l.unwatchFile),d=x.useMemo(()=>{const l={};for(const g of e.scopes){const i=e.resolve(g,t??"",r);i&&(l[g]=i)}return l},[e,t,r]);return x.useEffect(()=>{const l=Object.values(d).filter(Boolean);return l.forEach(g=>{n[g]||m(g),c(g)}),()=>{l.forEach(g=>f(g))}},[JSON.stringify(d)]),d}const q=[];function C(e){return Array.isArray(e)?"array":e!==null&&typeof e=="object"?"object":"scalar"}function ne(e){const t=e.filter(r=>r.data!==void 0);return t.length===0?{kind:"object",children:{}}:U(t,[])}function U(e,t){const r=q.includes(t.join(".")),n=e.every(i=>C(i.data)==="object"),m=e.every(i=>C(i.data)==="array");if(n){const i=new Set;for(const h of e)for(const s of Object.keys(h.data))i.add(s);const b={};for(const h of i){const s=e.filter(a=>h in a.data).map(a=>({scope:a.scope,data:a.data[h]}));b[h]=U(s,[...t,h])}return{kind:"object",children:b}}if(m&&!r){const i=[];for(const b of[...e].reverse())for(const h of b.data)i.push({value:h,fromScope:b.scope,index:i.length});return{kind:"array",items:i}}const c=[...e].reverse(),f=c[0],d=c.slice(1).map(i=>({scope:i.scope,value:i.data})),l=C(f.data),g=d.some(i=>C(i.value)!==l);return{kind:"leaf",value:f.data,winner:f.scope,shadowed:d,...g?{typeMismatch:!0}:{}}}function B(e,t){if(t.length===0)return e;if(e.kind!=="object")return null;const[r,...n]=t,m=e.children[r];return m?B(m,n):null}function G(e,t,r){if(t.length===0)return r;const[n,...m]=t,c=e&&typeof e=="object"&&!Array.isArray(e)?{...e}:{};return c[n]=G(c[n],m,r),c}const F=["user","project","local"];function ae(e,t){const r=[];for(const n of F){const m=t[n];if(!m)continue;const c=e[m];if(!c||!c.exists)continue;const f=c.draftRaw??"";if(f.trim())try{r.push({scope:n,data:JSON.parse(f)})}catch{}}return r}const W="http://json-schema.org/draft-07/schema#",K="https://json.schemastore.org/claude-code-settings.json",J={permissionRule:{type:"string",description:`Tool permission rule.
|
|
1
|
+
import{ad as x,a4 as o,S as j,aq as P}from"./index-BgbV3sKX.js";function re({node:e,targetScope:t,onOverride:r,schema:n,rootLabel:m}){const[c,f]=x.useState(""),[d,l]=x.useState(!0),g=[],i=e.kind==="object"&&Object.keys(e.children).length===0,h=((n==null?void 0:n.rootKeys())??[]).length>0;return o.jsxs("div",{className:"h-full flex flex-col",children:[o.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:[o.jsxs("span",{className:"text-fg-faint",children:["merged · overrides → ",o.jsx("span",{className:"text-fg-dim",children:j[t].label})]}),h&&o.jsxs("label",{className:"flex items-center gap-1 text-fg-faint cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:d,onChange:s=>l(s.target.checked),className:"accent-accent"}),"show unset keys"]}),o.jsx("div",{className:"flex-1"}),o.jsx("input",{value:c,onChange:s=>f(s.target.value),placeholder:"filter keys or descriptions…",className:"bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg w-56"})]}),o.jsx("div",{className:"flex-1 overflow-auto px-3 py-2 font-mono text-xs",children:i&&!d?o.jsx("div",{className:"text-fg-faint italic px-2 py-4",children:"no settings resolved — all scope files empty or missing"}):o.jsx(O,{node:e,path:g,label:m??"(root)",targetScope:t,onOverride:r,filter:c,depth:0,schema:n,showGhosts:d,defaultOpen:!0})})]})}function O(e){return e.node.kind==="object"?o.jsx(D,{...e,node:e.node}):e.node.kind==="array"?o.jsx(R,{...e,node:e.node}):o.jsx($,{...e,node:e.node})}function L(e,t){return t.trim()?e.toLowerCase().includes(t.toLowerCase()):!0}function w(e,t,r){return!!(!r.trim()||e.some(n=>L(n,r))||t!=null&&t.description&&L(t.description,r))}function D({node:e,path:t,label:r,targetScope:n,onOverride:m,filter:c,depth:f,schema:d,showGhosts:l,defaultOpen:g}){const[i,b]=x.useState(g??f<2),h=(d==null?void 0:d.at(t))??null,s=new Set(Object.keys(e.children)),a=l?(h==null?void 0:h.knownChildren)??[]:[],u=Array.from(new Set([...s,...a])).sort(),p=x.useMemo(()=>c.trim()?u.filter(y=>{const v=(d==null?void 0:d.at([...t,y]))??null;return w([...t,y],v,c)?!0:s.has(y)?N(e.children[y],[...t,y],c,d):!1}):u,[u.join(","),c,e,t.join("."),d]);if(c.trim()&&p.length===0&&!w(t,h,c))return null;if(t.length===0)return o.jsx("div",{children:p.map(y=>k(y))});return o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-1 py-0.5 hover:bg-bg-elev/50 rounded cursor-pointer",style:{paddingLeft:f*14},onClick:()=>b(!i),children:[o.jsx("span",{className:"text-fg-faint w-3 shrink-0",children:i?"▾":"▸"}),o.jsx("span",{className:"text-fg",children:r}),o.jsxs("span",{className:"text-fg-faint",children:[" {",s.size,a.length>s.size?`/${new Set([...s,...a]).size}`:"","}"]}),(h==null?void 0:h.description)&&o.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:h.description,children:["— ",h.description]})]}),i&&p.map(y=>k(y))]});function k(y){if(s.has(y))return o.jsx(O,{node:e.children[y],path:[...t,y],label:y,targetScope:n,onOverride:m,filter:c,depth:f+1,schema:d,showGhosts:l},y);const v=(d==null?void 0:d.at([...t,y]))??null;return v?o.jsx(_,{path:[...t,y],label:y,info:v,targetScope:n,onSet:m,depth:f+1,filter:c},y):null}}function N(e,t,r,n){const m=(n==null?void 0:n.at(t))??null;if(w(t,m,r))return!0;if(e.kind!=="object")return!1;for(const c of Object.keys(e.children))if(N(e.children[c],[...t,c],r,n))return!0;return!1}function R({node:e,path:t,label:r,filter:n,depth:m,schema:c}){const[f,d]=x.useState(!0),l=(c==null?void 0:c.at(t))??null;return w(t,l,n)?o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-1 py-0.5 hover:bg-bg-elev/50 rounded cursor-pointer",style:{paddingLeft:m*14},onClick:()=>d(!f),children:[o.jsx("span",{className:"text-fg-faint w-3 shrink-0",children:f?"▾":"▸"}),o.jsx("span",{className:"text-fg",children:r}),o.jsxs("span",{className:"text-fg-faint",children:[" [",e.items.length,"]"]}),o.jsx(S,{tone:"warn",children:"accumulated"}),(l==null?void 0:l.description)&&o.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:l.description,children:["— ",l.description]})]}),f&&e.items.map((g,i)=>o.jsxs("div",{className:"flex items-start gap-2 py-0.5",style:{paddingLeft:(m+1)*14},children:[o.jsx("span",{className:"text-fg-faint w-3 shrink-0"}),o.jsxs("span",{className:"text-fg-faint",children:[i,":"]}),o.jsx("span",{className:"text-fg-dim truncate max-w-xl",children:E(g.value)}),o.jsx(M,{scope:g.fromScope})]},i))]}):null}function $({node:e,path:t,label:r,targetScope:n,onOverride:m,filter:c,depth:f,schema:d}){const[l,g]=x.useState(!1),i=(d==null?void 0:d.at(t))??null;if(!w(t,i,c))return null;const b=e.winner!==n,h=e.shadowed.length>0;return o.jsxs("div",{children:[o.jsxs("div",{className:"group flex items-center gap-2 py-0.5 hover:bg-bg-elev/50 rounded",style:{paddingLeft:f*14},children:[o.jsx("span",{className:`w-3 shrink-0 ${h?"text-fg-faint cursor-pointer":""}`,onClick:()=>h&&g(!l),children:h?l?"▾":"▸":""}),o.jsxs("span",{className:"text-fg",children:[r,":"]}),o.jsx("span",{className:"text-fg-dim truncate max-w-md",children:E(e.value)}),o.jsx(M,{scope:e.winner}),(i==null?void 0:i.deprecated)&&o.jsx(S,{tone:"warn",children:"deprecated"}),(i==null?void 0:i.default)!==void 0&&I(e.value,i.default)&&o.jsx(S,{tone:"dim",children:"= default"}),e.typeMismatch&&o.jsx("span",{className:"text-yellow-500/80",title:"shadowed scopes have a different value type",children:"⚠"}),(i==null?void 0:i.description)&&o.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:i.description,children:["— ",i.description]}),o.jsx("div",{className:"flex-1"}),(i==null?void 0:i.enum)&&o.jsx(T,{values:i.enum}),o.jsx("button",{disabled:!b,onClick:()=>m(t,e.value),className:`opacity-0 group-hover:opacity-100 px-1.5 py-0 text-[10px] border rounded transition-opacity ${b?"border-accent/50 text-accent hover:bg-accent hover:text-bg":"border-line text-fg-faint cursor-not-allowed"}`,title:b?`copy into ${j[n].label} draft`:`already winning in ${j[n].label}`,children:"override"})]}),l&&e.shadowed.map((s,a)=>o.jsxs("div",{className:"flex items-center gap-2 py-0.5 text-fg-faint line-through",style:{paddingLeft:(f+1)*14+12},children:[o.jsx("span",{children:"shadowed:"}),o.jsx("span",{className:"truncate max-w-xl",children:E(s.value)}),o.jsx(M,{scope:s.scope,dim:!0})]},a))]})}function _({path:e,label:t,info:r,targetScope:n,onSet:m,depth:c,filter:f}){if(!w(e,r,f))return null;const d=r.default!==void 0?r.default:H(r.type),l=Array.isArray(r.type)?r.type.join("|"):r.type??"?";return o.jsxs("div",{className:"group flex items-center gap-2 py-0.5 hover:bg-bg-elev/50 rounded opacity-60",style:{paddingLeft:c*14},children:[o.jsx("span",{className:"w-3 shrink-0"}),o.jsx("span",{className:"text-fg-dim",children:t}),o.jsx(S,{tone:"dim",children:l}),r.required&&o.jsx(S,{tone:"warn",children:"required"}),r.default!==void 0&&o.jsxs("span",{className:"text-fg-faint",children:["default: ",E(r.default)]}),r.description&&o.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:r.description,children:["— ",r.description]}),o.jsx("div",{className:"flex-1"}),r.enum&&o.jsx(T,{values:r.enum}),o.jsx("button",{onClick:()=>m(e,d),className:"opacity-0 group-hover:opacity-100 px-1.5 py-0 text-[10px] border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg transition-opacity",title:`write to ${j[n].label} draft`,children:"set"})]})}function I(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"?JSON.stringify(e)===JSON.stringify(t):!1}function H(e){switch(Array.isArray(e)?e[0]:e){case"boolean":return!1;case"integer":case"number":return 0;case"string":return"";case"array":return[];case"object":return{};case"null":return null;default:return null}}function E(e){if(typeof e=="string")return JSON.stringify(e);if(e===null)return"null";if(typeof e=="object"){const t=JSON.stringify(e);return t.length>100?t.slice(0,100)+"…":t}return String(e)}function M({scope:e,dim:t}){const r=e==="user"?"bg-bg-hi text-fg-dim border-line":e==="project"?"bg-blue-950/30 text-blue-400/80 border-blue-900/40":"bg-purple-950/30 text-purple-400/80 border-purple-900/40";return o.jsx("span",{className:`text-[10px] px-1 py-0 rounded border uppercase tracking-wide shrink-0 ${r} ${t?"opacity-60":""}`,children:j[e].label})}function S({children:e,tone:t="default"}){const r={default:"bg-bg-hi text-fg-dim border-line",warn:"bg-yellow-950/30 text-yellow-500/80 border-yellow-900/40",dim:"bg-bg-elev text-fg-faint border-line"}[t];return o.jsx("span",{className:`text-[10px] px-1 py-0 rounded border uppercase tracking-wide shrink-0 ${r}`,children:e})}function T({values:e}){const t=e.map(r=>String(r)).join(" | ");return o.jsxs("span",{className:"text-[10px] text-fg-faint truncate max-w-xs",title:`allowed: ${t}`,children:["∈ ",t.length>30?t.slice(0,30)+"…":t]})}function ie(e,t,r){const n=P(l=>l.files),m=P(l=>l.loadJson),c=P(l=>l.watchFile),f=P(l=>l.unwatchFile),d=x.useMemo(()=>{const l={};for(const g of e.scopes){const i=e.resolve(g,t??"",r);i&&(l[g]=i)}return l},[e,t,r]);return x.useEffect(()=>{const l=Object.values(d).filter(Boolean);return l.forEach(g=>{n[g]||m(g),c(g)}),()=>{l.forEach(g=>f(g))}},[JSON.stringify(d)]),d}const q=[];function C(e){return Array.isArray(e)?"array":e!==null&&typeof e=="object"?"object":"scalar"}function ne(e){const t=e.filter(r=>r.data!==void 0);return t.length===0?{kind:"object",children:{}}:U(t,[])}function U(e,t){const r=q.includes(t.join(".")),n=e.every(i=>C(i.data)==="object"),m=e.every(i=>C(i.data)==="array");if(n){const i=new Set;for(const h of e)for(const s of Object.keys(h.data))i.add(s);const b={};for(const h of i){const s=e.filter(a=>h in a.data).map(a=>({scope:a.scope,data:a.data[h]}));b[h]=U(s,[...t,h])}return{kind:"object",children:b}}if(m&&!r){const i=[];for(const b of[...e].reverse())for(const h of b.data)i.push({value:h,fromScope:b.scope,index:i.length});return{kind:"array",items:i}}const c=[...e].reverse(),f=c[0],d=c.slice(1).map(i=>({scope:i.scope,value:i.data})),l=C(f.data),g=d.some(i=>C(i.value)!==l);return{kind:"leaf",value:f.data,winner:f.scope,shadowed:d,...g?{typeMismatch:!0}:{}}}function B(e,t){if(t.length===0)return e;if(e.kind!=="object")return null;const[r,...n]=t,m=e.children[r];return m?B(m,n):null}function G(e,t,r){if(t.length===0)return r;const[n,...m]=t,c=e&&typeof e=="object"&&!Array.isArray(e)?{...e}:{};return c[n]=G(c[n],m,r),c}const F=["user","project","local"];function ae(e,t){const r=[];for(const n of F){const m=t[n];if(!m)continue;const c=e[m];if(!c||!c.exists)continue;const f=c.draftRaw??"";if(f.trim())try{r.push({scope:n,data:JSON.parse(f)})}catch{}}return r}const W="http://json-schema.org/draft-07/schema#",K="https://json.schemastore.org/claude-code-settings.json",J={permissionRule:{type:"string",description:`Tool permission rule.
|
|
2
2
|
See https://code.claude.com/docs/en/settings#permission-rule-syntax
|
|
3
3
|
See https://code.claude.com/docs/en/settings#tools-available-to-claude for full list of tools available to Claude.`,pattern:"^((Agent|Bash|Edit|ExitPlanMode|Glob|Grep|KillShell|LSP|NotebookEdit|Read|Skill|TaskCreate|TaskGet|TaskList|TaskOutput|TaskStop|TaskUpdate|TodoWrite|ToolSearch|WebFetch|WebSearch|Write)(\\((?=.*[^)*?])[^)]+\\))?|mcp__.*)$",examples:["Bash","Bash(npm run build)","Bash(git commit *)","Bash(npm run *)","Bash(ls*)","Bash(git * main)","Edit","Edit(/src/**/*.ts)","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",exclusiveMinimum:0},async:{type:"boolean",description:"Run this hook asynchronously without blocking Claude Code"},statusMessage:{type:"string",description:"Custom spinner message displayed while the hook runs"}}},{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},statusMessage:{type:"string",description:"Custom spinner message displayed while the hook runs"}}},{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},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-hooks",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: 30)",exclusiveMinimum:0},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"}}}}},V="Configuration settings for Claude Code. Learn more: https://code.claude.com/docs/en/settings",z=!0,Y=!0,Z="object",X=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","examples":["/bin/generate_temp_api_key.sh"],"minLength":1},"autoMemoryEnabled":{"type":"boolean","description":"Enable automatic memory saves that capture useful context to .claude/memory/. 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#auto-memory","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 updates entirely.","default":"latest"},"awsCredentialExport":{"type":"string","description":"Path to a script that exports AWS credentials","examples":["/bin/generate_aws_grant.sh"],"minLength":1},"awsAuthRefresh":{"type":"string","description":"Path to a script that refreshes AWS authentication","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-claudemd-files","examples":[["**/monorepo/CLAUDE.md","/home/user/monorepo/other-team/.claude/rules/**"]]},"cleanupPeriodDays":{"type":"integer","minimum":0,"description":"Number of days to retain chat transcripts (0 to disable cleanup)","examples":[20,30,60],"default":30},"env":{"type":"object","additionalProperties":false,"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.\\nUNDOCUMENTED: CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS (plugin marketplace git timeout in ms, default 120000, see https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md#2151).\\nUNDOCUMENTED: ENABLE_CLAUDEAI_MCP_SERVERS (set to false to opt out of claude.ai MCP servers, see https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md#2163).","examples":[{"ANTHROPIC_MODEL":"claude-opus-4-1","ANTHROPIC_SMALL_FAST_MODEL":"claude-3-5-haiku-latest"}],"default":{},"patternProperties":{"^[A-Z_][A-Z0-9_]*$":{"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"}}},"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"],"description":"Default permission mode.\\n\\"default\\": prompts on first use.\\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).\\nSee https://code.claude.com/docs/en/permissions"},"disableBypassPermissionsMode":{"type":"string","enum":["disable"],"description":"Disable the ability to bypass permission prompts"},"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/settings#tools-available-to-claude 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":"Preferred language for Claude's responses","examples":["japanese","spanish","french"]},"model":{"type":"string","enum":["opus","sonnet","haiku","default"],"description":"Override the default model used by Claude Code. Accepts a short alias (opus|sonnet|haiku) or a full model ID. 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"],"description":"Control Opus 4.6 adaptive reasoning effort. Lower effort is faster and cheaper for straightforward tasks, higher effort provides deeper reasoning. Defaults vary by model and plan (Opus 4.6 defaults to medium for Max and Team subscribers). 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 for Opus 4.6 (research preview). Fast mode uses the same model with 2.5x faster output at higher per-token cost. Requires extra usage enabled. Alternatively, toggle with /fast command. 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","examples":[0.05]},"editorMode":{"type":"string","enum":["normal","vim"],"default":"normal","description":"Editor input mode for the Claude Code terminal prompt. 'vim' enables modal editing (Esc for normal mode, i for insert). See https://code.claude.com/docs/en/settings"},"skillOverrides":{"type":"object","additionalProperties":{"type":"string","enum":["on","name-only","user-invocable-only","off"]},"description":"Per-skill availability override map. Keys are skill names; values are one of 'on' (default), 'name-only' (skill name listed but not auto-loaded), 'user-invocable-only' (load only when user explicitly invokes), or 'off' (hidden). Requires Claude Code v2.1.129+. See https://code.claude.com/docs/en/settings","examples":[{"playwright-debug":"user-invocable-only","init":"off"}]},"disableAgentView":{"type":"boolean","default":false,"description":"Disable the Agent View feature (read-only inspection of sub-agent activity). Useful when administering managed deployments. Requires Claude Code v2.1.139+. See https://code.claude.com/docs/en/settings"},"disableRemoteControl":{"type":"boolean","default":false,"description":"Block the \`claude remote-control\` channel that allows external clients to drive this Claude Code instance. Recommended default for shared/CI environments. Requires Claude Code v2.1.128+. See https://code.claude.com/docs/en/settings"},"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":"Custom commands to run 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"}},"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"}},"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"}}}},"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"},"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."}},"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)"}},"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)"}},"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}],"description":"Where to fetch the marketplace from"},"installLocation":{"type":"string","description":"Local cache path where marketplace manifest is stored (auto-generated if not provided)"}},"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/settings#strictknownmarketplaces","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"},"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"},"forceLoginMethod":{"type":"string","enum":["claudeai","console"],"description":"Force a specific login method: \\"claudeai\\" for Claude Pro/Max, \\"console\\" for Console billing","examples":["claudeai"]},"forceLoginOrgUUID":{"type":"string","description":"Organization UUID to use for OAuth login","examples":["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"],"minLength":1},"otelHeadersHelper":{"type":"string","description":"Path to a script that outputs OpenTelemetry headers","minLength":1},"outputStyle":{"type":"string","description":"Controls the output style for assistant responses. Built-in styles: default, 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","Explanatory","Learning"],"minLength":1},"skipWebFetchPreflight":{"type":"boolean","description":"Skip the WebFetch blocklist check for enterprise environments with restrictive security policies"},"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"},"allowLocalBinding":{"type":"boolean","description":"Allow binding to local network addresses (e.g., localhost ports). Defaults to false if not specified"},"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"},"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"},"allowAllUnixSockets":{"type":"boolean","description":"Allow all Unix domain socket connections. If true, this overrides allowUnixSockets"},"allowedDomains":{"type":"array","items":{"type":"string","minLength":1},"description":"Allowlist of network domains for sandboxed commands. Supports wildcard patterns like *.example.com"},"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."}},"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\\"])"},"autoAllowBashIfSandboxed":{"type":"boolean","description":"Automatically allow bash commands without prompting when they run in the sandbox. Only applies to commands that will run sandboxed.","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/settings#sandbox-settings","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)."},"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."},"enabled":{"type":"boolean","description":"Enable sandboxed bash"},"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)"},"denyWrite":{"type":"array","items":{"type":"string","minLength":1},"description":"Paths where subprocesses are explicitly denied write access. Takes precedence over allowWrite"},"denyRead":{"type":"array","items":{"type":"string","minLength":1},"description":"Paths where subprocesses are explicitly denied read access"},"allowRead":{"type":"array","items":{"type":"string","minLength":1},"description":"Paths to re-allow reading within denyRead regions. Takes precedence over denyRead for matching paths"},"allowManagedReadPathsOnly":{"type":"boolean","description":"When true (managed settings only), only allowRead paths from managed settings are used"}},"additionalProperties":false}},"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},"prefersReducedMotion":{"type":"boolean","description":"Reduce or disable UI animations (spinners, shimmer, flash effects) for accessibility","default":false},"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"],"description":"How agent team teammates display: \\"auto\\" picks split panes in tmux or iTerm2, in-process otherwise. 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","default":"auto"},"worktree":{"type":"object","additionalProperties":false,"description":"Configuration for --worktree sessions. See https://code.claude.com/docs/en/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.","examples":[["packages/my-app","shared/utils"]]}}},"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"}},"additionalProperties":false},"description":"Per-plugin configuration including MCP server user configs, keyed by plugin ID (plugin@marketplace format). See https://code.claude.com/docs/en/plugins"},"allowManagedMcpServersOnly":{"type":"boolean","description":"(Managed settings only) Only allowedMcpServers from managed settings are respected. deniedMcpServers still merges from all sources. Users can still add their own MCP servers, but only the admin-defined allowlist applies."},"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"]}]}}}`),Q="Claude Code Settings",ee={$schema:W,$id:K,$defs:J,description:V,allowTrailingCommas:z,additionalProperties:Y,type:Z,properties:X,title:Q};function te(e){const t=e??{},r={...t.$defs??{},...t.definitions??{}},n=s=>{if(!s)return{};if(!s.$ref)return f(s);const a=/^#\/(\$defs|definitions)\/(.+)$/.exec(s.$ref);if(!a)return f(s);const u=r[a[2]];return u?n({...u,...d(s)}):f(s)},m=new Set(["__proto__","constructor","prototype"]),c=s=>{if(!s)return{};const a={};for(const[u,p]of Object.entries(s))m.has(u)||(a[u]=p);return a},f=s=>{if(!s.allOf||s.allOf.length===0)return s;const a={...s};delete a.allOf;for(const u of s.allOf){const p=n(u);Object.assign(a,{properties:{...c(a.properties),...c(p.properties)},required:se([...a.required??[],...p.required??[]])}),!a.description&&p.description&&(a.description=p.description),a.default===void 0&&p.default!==void 0&&(a.default=p.default),!a.type&&p.type&&(a.type=p.type)}return a},d=s=>{const{$ref:a,...u}=s;return u},l=(s,a)=>{let u=n(s);for(const p of a){if(!u)return null;if(/^\d+$/.test(p)){const v=Array.isArray(u.items)?u.items[Number(p)]:u.items;u=v?n(v):null;continue}const k=u.properties;if(k&&!m.has(p)&&p in k){u=n(k[p]);continue}const y=u.additionalProperties;if(y&&typeof y=="object"){u=n(y);continue}return null}return u},g=(s,a,u)=>{if(!s)return null;const p={};if(s.description&&(p.description=s.description),s.type&&(p.type=s.type),s.default!==void 0&&(p.default=s.default),s.enum&&(p.enum=s.enum),s.const!==void 0&&(p.const=s.const),s.deprecated&&(p.deprecated=!0),s.examples&&(p.examples=s.examples),s.properties&&(p.knownChildren=Object.keys(s.properties)),u&&(a!=null&&a.includes(u))&&(p.required=!0),s.items&&!Array.isArray(s.items)){const k=n(s.items),y=g(k,void 0,null);y&&(p.itemsInfo=y)}return(s.additionalProperties===!0||typeof s.additionalProperties=="object")&&(p.open=!0),p},i=s=>a=>{if(a.length===0)return g(n(s),void 0,null);const u=l(s,a.slice(0,-1));if(!u)return null;const p=a[a.length-1],k=l(u,[p]);return g(k,u.required,p)},b=s=>{const a=n(s);return Object.keys(a.properties??{})},h=s=>({at:i(s),rootKeys:()=>b(s),rootedAt:a=>{const u=l(s,a);return h(u??{})}});return h(t)}function se(e){return Array.from(new Set(e))}let A=null;function ce(){return A||(A=te(ee)),A}export{re as E,ce as a,B as g,ne as m,ae as p,G as s,ie as u};
|
package/dist/index.html
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
8
8
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
9
9
|
<link href="https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;0,6..72,700;1,6..72,400&family=Geist:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap" rel="stylesheet">
|
|
10
|
-
<script type="module" crossorigin src="./assets/index-
|
|
10
|
+
<script type="module" crossorigin src="./assets/index-BgbV3sKX.js"></script>
|
|
11
11
|
<link rel="modulepreload" crossorigin href="./assets/monaco-editor-BW5C4Iv1.js">
|
|
12
12
|
<link rel="stylesheet" crossorigin href="./assets/monaco-editor-BTnBOi8r.css">
|
|
13
13
|
<link rel="stylesheet" crossorigin href="./assets/index-Dbo9R4e0.css">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-session-manager",
|
|
3
|
-
"version": "0.75.
|
|
3
|
+
"version": "0.75.1",
|
|
4
4
|
"description": "Local cockpit for the Claude Code CLI — multi-tab terminal, full config surface, scheduler, voice dictation, and live observability.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/main/index.cjs",
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scheduler-autofix-outcome.test.cjs — self-heal terminal-state gap fix.
|
|
3
|
+
*
|
|
4
|
+
* spawnInvestigation's onExit used to stamp autoFixOutcome only in the
|
|
5
|
+
* no-plan branch; a job whose probe erred, spawn-failed, or produced a plan
|
|
6
|
+
* that never became a queue row ended up autoFixAttempted:true with no
|
|
7
|
+
* outcome — permanently excluded from both retry AND the exhausted-retry
|
|
8
|
+
* annotation. This file is a vitest-runnable (npm run test:unit) home for
|
|
9
|
+
* the scenarios the PRD's acceptance criteria enumerate; the pure-logic
|
|
10
|
+
* coverage in scheduler-autofix-select.test.cjs (node --test) exercises the
|
|
11
|
+
* same helpers in more granular detail.
|
|
12
|
+
*
|
|
13
|
+
* Run: timeout 120 npx vitest run src/main/__tests__/scheduler-autofix-outcome.test.cjs
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
'use strict';
|
|
17
|
+
|
|
18
|
+
import { test, expect } from 'vitest';
|
|
19
|
+
const {
|
|
20
|
+
selectAutoFixTargets, isExhaustedAutoFix, isPlanUnqueued, fixSlugFor,
|
|
21
|
+
} = require('../scheduler.cjs');
|
|
22
|
+
|
|
23
|
+
const noSiblingOnDisk = () => false;
|
|
24
|
+
|
|
25
|
+
function makeJob(overrides = {}) {
|
|
26
|
+
return {
|
|
27
|
+
slug: '05-my-feature',
|
|
28
|
+
status: 'needs_review',
|
|
29
|
+
runId: '2026-06-16T10-00-00-000Z',
|
|
30
|
+
parallelGroup: 5,
|
|
31
|
+
...overrides,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function isTarget(job) {
|
|
36
|
+
return selectAutoFixTargets([job], { fixSlugExists: noSiblingOnDisk }).some((j) => j.slug === job.slug);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function isAnnotatable(job, queuedSlugs = new Set()) {
|
|
40
|
+
return isExhaustedAutoFix(job) || isPlanUnqueued(job, queuedSlugs);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// (a) attempted + no outcome → eligible once, then annotated when the retry is spent.
|
|
44
|
+
test('(a) attempted with unstamped outcome and an unspent retry is eligible, not annotated', () => {
|
|
45
|
+
const job = makeJob({ autoFixAttempted: true, autoFixRetries: 0 });
|
|
46
|
+
expect(isTarget(job)).toBe(true);
|
|
47
|
+
expect(isAnnotatable(job)).toBe(false);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test('(a) attempted with unstamped outcome and a spent retry is annotated, not eligible', () => {
|
|
51
|
+
const job = makeJob({ autoFixAttempted: true, autoFixRetries: 1 });
|
|
52
|
+
expect(isTarget(job)).toBe(false);
|
|
53
|
+
expect(isAnnotatable(job)).toBe(true);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// (b) outcome 'error' → eligible once.
|
|
57
|
+
test("(b) outcome 'error' with an unspent retry is eligible", () => {
|
|
58
|
+
const job = makeJob({ autoFixAttempted: true, autoFixOutcome: 'error', autoFixRetries: 0 });
|
|
59
|
+
expect(isTarget(job)).toBe(true);
|
|
60
|
+
expect(isAnnotatable(job)).toBe(false);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test("(b) outcome 'error' with a spent retry is annotated, not eligible", () => {
|
|
64
|
+
const job = makeJob({ autoFixAttempted: true, autoFixOutcome: 'error', autoFixRetries: 1 });
|
|
65
|
+
expect(isTarget(job)).toBe(false);
|
|
66
|
+
expect(isAnnotatable(job)).toBe(true);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// (c) outcome 'plan' with no queue row → annotated autofix_plan_unqueued, NOT retried.
|
|
70
|
+
test("(c) outcome 'plan' with the fix slug absent from the queue is annotated, never retried", () => {
|
|
71
|
+
const job = makeJob({ autoFixAttempted: true, autoFixOutcome: 'plan', autoFixRetries: 0 });
|
|
72
|
+
expect(isTarget(job)).toBe(false);
|
|
73
|
+
expect(isPlanUnqueued(job, new Set())).toBe(true);
|
|
74
|
+
expect(isExhaustedAutoFix(job)).toBe(false);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// (d) outcome 'plan' WITH a queue row → neither retried nor annotated.
|
|
78
|
+
test("(d) outcome 'plan' with the fix slug present in the queue is neither retried nor annotated", () => {
|
|
79
|
+
const job = makeJob({ autoFixAttempted: true, autoFixOutcome: 'plan', autoFixRetries: 0 });
|
|
80
|
+
const queuedSlugs = new Set([fixSlugFor(job)]);
|
|
81
|
+
expect(isTarget(job)).toBe(false);
|
|
82
|
+
expect(isAnnotatable(job, queuedSlugs)).toBe(false);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// (invariant) every needs_review job is either an auto-fix target or
|
|
86
|
+
// annotatable (would receive a non-null verifierVerdict) — never both false.
|
|
87
|
+
test('invariant: fresh, retry-eligible, exhausted, and plan-unqueued jobs are always selected or annotatable', () => {
|
|
88
|
+
const jobs = [
|
|
89
|
+
makeJob({ slug: '01-fresh' }),
|
|
90
|
+
makeJob({ slug: '02-unstamped-retry', autoFixAttempted: true, autoFixRetries: 0 }),
|
|
91
|
+
makeJob({ slug: '03-unstamped-exhausted', autoFixAttempted: true, autoFixRetries: 1 }),
|
|
92
|
+
makeJob({ slug: '04-error-retry', autoFixAttempted: true, autoFixOutcome: 'error', autoFixRetries: 0 }),
|
|
93
|
+
makeJob({ slug: '05-error-exhausted', autoFixAttempted: true, autoFixOutcome: 'error', autoFixRetries: 1 }),
|
|
94
|
+
makeJob({ slug: '06-plan-unqueued', autoFixAttempted: true, autoFixOutcome: 'plan', autoFixRetries: 0 }),
|
|
95
|
+
];
|
|
96
|
+
const planJob = jobs.find((j) => j.slug === '06-plan-unqueued');
|
|
97
|
+
const planQueuedJob = makeJob({
|
|
98
|
+
slug: '07-plan-queued', parallelGroup: 7, autoFixAttempted: true, autoFixOutcome: 'plan', autoFixRetries: 0,
|
|
99
|
+
});
|
|
100
|
+
jobs.push(planQueuedJob);
|
|
101
|
+
const queuedSlugs = new Set([fixSlugFor(planQueuedJob)]);
|
|
102
|
+
|
|
103
|
+
const targets = new Set(selectAutoFixTargets(jobs, { fixSlugExists: noSiblingOnDisk }).map((j) => j.slug));
|
|
104
|
+
for (const job of jobs) {
|
|
105
|
+
const selected = targets.has(job.slug);
|
|
106
|
+
const annotated = isAnnotatable(job, queuedSlugs);
|
|
107
|
+
if (job.slug === '07-plan-queued') {
|
|
108
|
+
// The good path: waiting on the fix-plan job itself, no action here.
|
|
109
|
+
expect(selected).toBe(false);
|
|
110
|
+
expect(annotated).toBe(false);
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
expect(selected || annotated).toBe(true);
|
|
114
|
+
}
|
|
115
|
+
expect(isPlanUnqueued(planJob, queuedSlugs)).toBe(true);
|
|
116
|
+
});
|
|
@@ -11,7 +11,7 @@ const assert = require('node:assert/strict');
|
|
|
11
11
|
const {
|
|
12
12
|
selectAutoFixTargets, isUnresolvableNeedsReview, isRescanCandidate,
|
|
13
13
|
healTargetForFix, isFixPlanBeyondDepthCap, MAX_INVESTIGATION_DEPTH,
|
|
14
|
-
isEligibleForImmediateAutoFix,
|
|
14
|
+
isEligibleForImmediateAutoFix, isExhaustedAutoFix, isPlanUnqueued, fixSlugFor,
|
|
15
15
|
} = require('../scheduler.cjs');
|
|
16
16
|
|
|
17
17
|
const noSiblingOnDisk = () => false;
|
|
@@ -34,8 +34,8 @@ test('selects a fresh needs_review job', () => {
|
|
|
34
34
|
assert.strictEqual(result[0].slug, '05-my-feature');
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
test('excludes job with autoFixAttempted: true', () => {
|
|
38
|
-
const jobs = [makeJob({ autoFixAttempted: true })];
|
|
37
|
+
test('excludes job with autoFixAttempted: true whose retry is already spent', () => {
|
|
38
|
+
const jobs = [makeJob({ autoFixAttempted: true, autoFixRetries: 1 })];
|
|
39
39
|
const result = selectAutoFixTargets(jobs, { fixSlugExists: noSiblingOnDisk });
|
|
40
40
|
assert.strictEqual(result.length, 0);
|
|
41
41
|
});
|
|
@@ -105,12 +105,112 @@ test('autoFixOutcome no-plan with retries=1 is exhausted (not selected)', () =>
|
|
|
105
105
|
assert.strictEqual(result.length, 0);
|
|
106
106
|
});
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
// ---- PRD: unstamped/error outcomes must retry once, not dead-end forever ----
|
|
109
|
+
|
|
110
|
+
test('autoFixAttempted true with NO outcome recorded (unstamped — spawn threw before onExit wired) is retry-eligible once', () => {
|
|
111
|
+
const jobs = [makeJob({ autoFixAttempted: true, autoFixRetries: 0 })];
|
|
112
|
+
const result = selectAutoFixTargets(jobs, { fixSlugExists: noSiblingOnDisk });
|
|
113
|
+
assert.strictEqual(result.length, 1);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
test('autoFixAttempted true with no outcome AND retries=1 is exhausted (not selected)', () => {
|
|
117
|
+
const jobs = [makeJob({ autoFixAttempted: true, autoFixRetries: 1 })];
|
|
110
118
|
const result = selectAutoFixTargets(jobs, { fixSlugExists: noSiblingOnDisk });
|
|
111
119
|
assert.strictEqual(result.length, 0);
|
|
112
120
|
});
|
|
113
121
|
|
|
122
|
+
test('autoFixOutcome error with retries=0 is retry-eligible', () => {
|
|
123
|
+
const jobs = [makeJob({ autoFixAttempted: true, autoFixOutcome: 'error', autoFixRetries: 0 })];
|
|
124
|
+
const result = selectAutoFixTargets(jobs, { fixSlugExists: noSiblingOnDisk });
|
|
125
|
+
assert.strictEqual(result.length, 1);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
test('autoFixOutcome error with retries=1 is exhausted (not selected)', () => {
|
|
129
|
+
const jobs = [makeJob({ autoFixAttempted: true, autoFixOutcome: 'error', autoFixRetries: 1 })];
|
|
130
|
+
const result = selectAutoFixTargets(jobs, { fixSlugExists: noSiblingOnDisk });
|
|
131
|
+
assert.strictEqual(result.length, 0);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
test('autoFixOutcome plan is NEVER retried, regardless of autoFixRetries', () => {
|
|
135
|
+
const jobs = [makeJob({ autoFixAttempted: true, autoFixOutcome: 'plan', autoFixRetries: 0 })];
|
|
136
|
+
const result = selectAutoFixTargets(jobs, { fixSlugExists: noSiblingOnDisk });
|
|
137
|
+
assert.strictEqual(result.length, 0);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
// ---- isExhaustedAutoFix / isPlanUnqueued (reverifyNeedsReview annotation) ----
|
|
141
|
+
|
|
142
|
+
test('isExhaustedAutoFix: no-plan outcome with retries spent → true', () => {
|
|
143
|
+
const job = makeJob({ autoFixAttempted: true, autoFixOutcome: 'no-plan', autoFixRetries: 1 });
|
|
144
|
+
assert.strictEqual(isExhaustedAutoFix(job), true);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
test('isExhaustedAutoFix: error outcome with retries spent → true', () => {
|
|
148
|
+
const job = makeJob({ autoFixAttempted: true, autoFixOutcome: 'error', autoFixRetries: 1 });
|
|
149
|
+
assert.strictEqual(isExhaustedAutoFix(job), true);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
test('isExhaustedAutoFix: unstamped outcome with retries spent → true', () => {
|
|
153
|
+
const job = makeJob({ autoFixAttempted: true, autoFixRetries: 1 });
|
|
154
|
+
assert.strictEqual(isExhaustedAutoFix(job), true);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
test('isExhaustedAutoFix: retries not yet spent → false (still eligible for its one retry)', () => {
|
|
158
|
+
const job = makeJob({ autoFixAttempted: true, autoFixOutcome: 'no-plan', autoFixRetries: 0 });
|
|
159
|
+
assert.strictEqual(isExhaustedAutoFix(job), false);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
test('isExhaustedAutoFix: plan outcome is never "exhausted" here — isPlanUnqueued\'s job instead', () => {
|
|
163
|
+
const job = makeJob({ autoFixAttempted: true, autoFixOutcome: 'plan', autoFixRetries: 1 });
|
|
164
|
+
assert.strictEqual(isExhaustedAutoFix(job), false);
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
test('isPlanUnqueued: plan outcome, fix slug absent from queue → true', () => {
|
|
168
|
+
const job = makeJob({ autoFixAttempted: true, autoFixOutcome: 'plan' });
|
|
169
|
+
assert.strictEqual(isPlanUnqueued(job, new Set()), true);
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
test('isPlanUnqueued: plan outcome, fix slug present in queue → false', () => {
|
|
173
|
+
const job = makeJob({ autoFixAttempted: true, autoFixOutcome: 'plan' });
|
|
174
|
+
assert.strictEqual(isPlanUnqueued(job, new Set([fixSlugFor(job)])), false);
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
test('isPlanUnqueued: no-plan outcome is never "plan unqueued"', () => {
|
|
178
|
+
const job = makeJob({ autoFixAttempted: true, autoFixOutcome: 'no-plan' });
|
|
179
|
+
assert.strictEqual(isPlanUnqueued(job, new Set()), false);
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
// ---- invariant: every needs_review job is either an auto-fix target, or
|
|
183
|
+
// classified by one of the annotation predicates (i.e. would receive a
|
|
184
|
+
// non-null verifierVerdict) — no job may fall through both. ----
|
|
185
|
+
|
|
186
|
+
test('invariant: attempted+no-outcome, retries spent → not a target, but IS annotatable', () => {
|
|
187
|
+
const job = makeJob({ autoFixAttempted: true, autoFixRetries: 1 });
|
|
188
|
+
const isTarget = selectAutoFixTargets([job], { fixSlugExists: noSiblingOnDisk }).length === 1;
|
|
189
|
+
const isAnnotatable = isExhaustedAutoFix(job) || isPlanUnqueued(job, new Set())
|
|
190
|
+
|| isUnresolvableNeedsReview(job, { hasRunDir: true });
|
|
191
|
+
assert.strictEqual(isTarget, false);
|
|
192
|
+
assert.strictEqual(isAnnotatable, true);
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
test('invariant: plan outcome, no queue row → not a target, but IS annotatable (autofix_plan_unqueued)', () => {
|
|
196
|
+
const job = makeJob({ autoFixAttempted: true, autoFixOutcome: 'plan' });
|
|
197
|
+
const isTarget = selectAutoFixTargets([job], { fixSlugExists: noSiblingOnDisk }).length === 1;
|
|
198
|
+
const isAnnotatable = isExhaustedAutoFix(job) || isPlanUnqueued(job, new Set())
|
|
199
|
+
|| isUnresolvableNeedsReview(job, { hasRunDir: true });
|
|
200
|
+
assert.strictEqual(isTarget, false);
|
|
201
|
+
assert.strictEqual(isAnnotatable, true);
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
test('invariant: plan outcome WITH a queue row → not a target and NOT annotated (waiting on the fix-plan job itself)', () => {
|
|
205
|
+
const job = makeJob({ autoFixAttempted: true, autoFixOutcome: 'plan' });
|
|
206
|
+
const queuedSlugs = new Set([fixSlugFor(job)]);
|
|
207
|
+
const isTarget = selectAutoFixTargets([job], { fixSlugExists: noSiblingOnDisk }).length === 1;
|
|
208
|
+
const isAnnotatable = isExhaustedAutoFix(job) || isPlanUnqueued(job, queuedSlugs)
|
|
209
|
+
|| isUnresolvableNeedsReview(job, { hasRunDir: true });
|
|
210
|
+
assert.strictEqual(isTarget, false);
|
|
211
|
+
assert.strictEqual(isAnnotatable, false);
|
|
212
|
+
});
|
|
213
|
+
|
|
114
214
|
test('excludes when fix sibling exists on disk', () => {
|
|
115
215
|
const jobs = [makeJob()];
|
|
116
216
|
// fixSlug = '05-fix-my-feature'
|
|
@@ -224,12 +324,18 @@ test('isEligibleForImmediateAutoFix: fresh needs_review job (fresh from spawnJob
|
|
|
224
324
|
assert.strictEqual(result, true);
|
|
225
325
|
});
|
|
226
326
|
|
|
227
|
-
test('isEligibleForImmediateAutoFix: job already
|
|
228
|
-
const job = makeJob({ autoFixAttempted: true });
|
|
327
|
+
test('isEligibleForImmediateAutoFix: attempted job with retry already spent is excluded (prevents double-spawn with the periodic pass)', () => {
|
|
328
|
+
const job = makeJob({ autoFixAttempted: true, autoFixRetries: 1 });
|
|
229
329
|
const result = isEligibleForImmediateAutoFix(job, [job], noSiblingOnDisk);
|
|
230
330
|
assert.strictEqual(result, false);
|
|
231
331
|
});
|
|
232
332
|
|
|
333
|
+
test('isEligibleForImmediateAutoFix: attempted job with an unstamped outcome and its retry still unspent IS eligible (bounded once)', () => {
|
|
334
|
+
const job = makeJob({ autoFixAttempted: true, autoFixRetries: 0 });
|
|
335
|
+
const result = isEligibleForImmediateAutoFix(job, [job], noSiblingOnDisk);
|
|
336
|
+
assert.strictEqual(result, true);
|
|
337
|
+
});
|
|
338
|
+
|
|
233
339
|
test('isEligibleForImmediateAutoFix: fix sibling already on disk excludes the job', () => {
|
|
234
340
|
const job = makeJob();
|
|
235
341
|
// fixSlug = '05-fix-my-feature'
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scheduler-fix-plan-path.test.cjs — regression test for the self-heal
|
|
3
|
+
* dead-letter bug: spawnInvestigation used to write every auto-fix plan into
|
|
4
|
+
* the RETIRED flat `<cwd>/session-manager-operations/scheduler/prds/` dir
|
|
5
|
+
* (prdDirForCwd), which reconcile()'s consolidateAllFlatPrds sweeps BEFORE
|
|
6
|
+
* scanning for queue rows — so a freshly-authored fix plan (no queue row yet
|
|
7
|
+
* by definition) was archived into `prds-archived/` on the very next pass
|
|
8
|
+
* and never enqueued. Confirmed live in starry-night-ships: job
|
|
9
|
+
* 105-arena-perf-fences produced a valid fix plan that landed in
|
|
10
|
+
* prds-archived/ having never appeared in queue.json or history.jsonl.
|
|
11
|
+
*
|
|
12
|
+
* The fix: resolveFixPlanPath resolves the write dir from the ORIGINAL job's
|
|
13
|
+
* live PRD location (findPrdDir, via resolveVerifyPrdPath) — normally the
|
|
14
|
+
* originating Epic's own `epics/<epicId>/prds/`, which consolidateFlatPrds
|
|
15
|
+
* never touches — falling back to the flat dir only when the original can't
|
|
16
|
+
* be found live anywhere on disk.
|
|
17
|
+
*
|
|
18
|
+
* Run: timeout 120 npx vitest run src/main/__tests__/scheduler-fix-plan-path.test.cjs
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
'use strict';
|
|
22
|
+
|
|
23
|
+
import { test, expect, beforeAll, afterAll } from 'vitest';
|
|
24
|
+
const fs = require('node:fs');
|
|
25
|
+
const os = require('node:os');
|
|
26
|
+
const path = require('node:path');
|
|
27
|
+
|
|
28
|
+
let tmpHome;
|
|
29
|
+
let originalHome;
|
|
30
|
+
let resolveFixPlanPath;
|
|
31
|
+
let PRDS_DIR;
|
|
32
|
+
let consolidateFlatPrds;
|
|
33
|
+
|
|
34
|
+
beforeAll(() => {
|
|
35
|
+
originalHome = process.env.HOME;
|
|
36
|
+
tmpHome = fs.mkdtempSync(path.join(os.tmpdir(), 'sm-fix-plan-path-'));
|
|
37
|
+
process.env.HOME = tmpHome;
|
|
38
|
+
|
|
39
|
+
// Load AFTER HOME is stubbed — scheduler.cjs snapshots os.homedir() into
|
|
40
|
+
// PRDS_DIR at module load, not lazily (see scheduler-find-prd-dir.test.cjs).
|
|
41
|
+
({ resolveFixPlanPath, PRDS_DIR } = require('../scheduler.cjs'));
|
|
42
|
+
({ consolidateFlatPrds } = require('../lib/prdMigration.cjs'));
|
|
43
|
+
|
|
44
|
+
if (!PRDS_DIR.startsWith(tmpHome)) {
|
|
45
|
+
throw new Error(`refusing to run: PRDS_DIR (${PRDS_DIR}) is not under the temp HOME (${tmpHome})`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// allProjectCwds()/activeProjectCwds() (consumed by findPrdDir's candidate
|
|
49
|
+
// search) discover project cwds by scanning ~/.claude/projects/*/*.jsonl
|
|
50
|
+
// for a `cwd` field — fake one project transcript pointing at the real
|
|
51
|
+
// on-disk cwd used below (mirrors scheduler-verify-prd-path.test.cjs).
|
|
52
|
+
const projectsDir = path.join(tmpHome, '.claude', 'projects');
|
|
53
|
+
const projDir = path.join(projectsDir, 'fake-fix-plan-project-slug');
|
|
54
|
+
fs.mkdirSync(projDir, { recursive: true });
|
|
55
|
+
fs.writeFileSync(
|
|
56
|
+
path.join(projDir, 'session.jsonl'),
|
|
57
|
+
`${JSON.stringify({ cwd: projectCwd() })}\n`,
|
|
58
|
+
'utf8',
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
afterAll(() => {
|
|
63
|
+
process.env.HOME = originalHome;
|
|
64
|
+
fs.rmSync(tmpHome, { recursive: true, force: true });
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
function projectCwd() {
|
|
68
|
+
return path.join(tmpHome, 'fix-plan-project-cwd');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
test('resolveFixPlanPath resolves the fix plan into the SAME Epic-scoped dir as the original PRD, and it survives consolidateFlatPrds', async () => {
|
|
72
|
+
const cwd = projectCwd();
|
|
73
|
+
const epicId = 'test-epic-arena-perf';
|
|
74
|
+
const slug = `105-arena-perf-fences-${process.pid}`;
|
|
75
|
+
const prdsDir = path.join(cwd, 'session-manager-operations', 'scheduler', 'epics', epicId, 'prds');
|
|
76
|
+
fs.mkdirSync(prdsDir, { recursive: true });
|
|
77
|
+
fs.writeFileSync(path.join(prdsDir, `${slug}.md`), '---\ntitle: arena perf fences\n---\n\n# Goal\n\ntest\n', 'utf8');
|
|
78
|
+
|
|
79
|
+
const failedJob = { slug, cwd, parallelGroup: 5 };
|
|
80
|
+
const resolved = await resolveFixPlanPath(failedJob);
|
|
81
|
+
|
|
82
|
+
const expectedFixSlug = '05-fix-arena-perf-fences-' + process.pid;
|
|
83
|
+
expect(resolved.fixSlug).toBe(expectedFixSlug);
|
|
84
|
+
expect(resolved.livePrdDir).toBe(prdsDir);
|
|
85
|
+
expect(resolved.fixPath).toBe(path.join(prdsDir, `${expectedFixSlug}.md`));
|
|
86
|
+
|
|
87
|
+
// A fix plan written at the resolved path must survive a consolidateFlatPrds
|
|
88
|
+
// pass over the SAME project cwd — the sweep only ever touches the flat dir.
|
|
89
|
+
fs.writeFileSync(resolved.fixPath, `---\ntitle: Fix: arena perf fences\ncwd: ${cwd}\nparallelGroup: 5\nestimateMinutes: 30\n---\n\nfix body\n`, 'utf8');
|
|
90
|
+
await consolidateFlatPrds(cwd);
|
|
91
|
+
expect(fs.existsSync(resolved.fixPath)).toBe(true);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test('resolveFixPlanPath falls back to the flat dir when the original PRD cannot be found live anywhere on disk', async () => {
|
|
95
|
+
const cwd = path.join(tmpHome, 'fix-plan-project-cwd-missing');
|
|
96
|
+
const slug = `999-nonexistent-${process.pid}`;
|
|
97
|
+
const failedJob = { slug, cwd, parallelGroup: 3 };
|
|
98
|
+
|
|
99
|
+
const resolved = await resolveFixPlanPath(failedJob);
|
|
100
|
+
|
|
101
|
+
expect(resolved.livePrdDir).toBe(null);
|
|
102
|
+
const flatDir = path.join(cwd, 'session-manager-operations', 'scheduler', 'prds');
|
|
103
|
+
expect(resolved.fixPath).toBe(path.join(flatDir, `${resolved.fixSlug}.md`));
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test('the OLD flat-dir path (regression guard) does NOT survive consolidateFlatPrds — proves the bug this fix addresses', async () => {
|
|
107
|
+
const cwd = path.join(tmpHome, 'fix-plan-project-cwd-old-behavior');
|
|
108
|
+
const flatDir = path.join(cwd, 'session-manager-operations', 'scheduler', 'prds');
|
|
109
|
+
fs.mkdirSync(flatDir, { recursive: true });
|
|
110
|
+
const oldFixPath = path.join(flatDir, '07-fix-old-behavior.md');
|
|
111
|
+
fs.writeFileSync(oldFixPath, `---\ntitle: Fix: old behavior\ncwd: ${cwd}\nparallelGroup: 7\nestimateMinutes: 30\n---\n\nfix body\n`, 'utf8');
|
|
112
|
+
|
|
113
|
+
// No queue.json at all — the file has no live queue row, exactly the
|
|
114
|
+
// freshly-authored-fix-plan situation the bug hit.
|
|
115
|
+
await consolidateFlatPrds(cwd);
|
|
116
|
+
|
|
117
|
+
expect(fs.existsSync(oldFixPath)).toBe(false);
|
|
118
|
+
expect(fs.existsSync(path.join(cwd, 'session-manager-operations', 'scheduler', 'prds-archived', '07-fix-old-behavior.md'))).toBe(true);
|
|
119
|
+
});
|