@staff0rd/assist 0.244.2 → 0.245.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -6
- package/claude/commands/bug.md +6 -0
- package/claude/commands/draft.md +6 -0
- package/claude/commands/refine.md +8 -0
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +176 -158
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -122,8 +122,8 @@ The first backlog command in a repository that still has a local `.assist/backlo
|
|
|
122
122
|
- `assist backlog update-phase <id> <phase> [--name <n>] [--task <t...>] [--manual-check <c...>]` - Modify a plan phase (name, tasks, or manual checks)
|
|
123
123
|
- `assist backlog update-phase <id> <phase> [--add-task <text>] [--edit-task <n> <text>] [--remove-task <n>] [--add-check <text>] [--edit-check <n> <text>] [--remove-check <n>]` - Granular task and manual-check edits using 1-based indices matching `backlog show`: `--add-*` appends (repeatable), `--edit-*` replaces entry n in place, `--remove-*` deletes entry n and renumbers the rest (task ops cannot be combined with `--task`; check ops cannot be combined with `--manual-check`)
|
|
124
124
|
- `assist backlog remove-phase <id> <phase>` - Remove a plan phase from a backlog item
|
|
125
|
-
- `assist backlog next [id]` - Pick and run the next backlog item, or open `/draft` if none remain; pass an `id` to run that item first, then continue chaining
|
|
126
|
-
- `assist backlog refine [id]` - Alias for `refine`
|
|
125
|
+
- `assist backlog next [id] [--once]` - Pick and run the next backlog item, or open `/draft` if none remain; pass an `id` to run that item first, then continue chaining; `--once` exits after the first completed item run instead of prompting for another
|
|
126
|
+
- `assist backlog refine [id] [--once]` - Alias for `refine`
|
|
127
127
|
- `assist backlog start <id>` - Set a backlog item to in-progress
|
|
128
128
|
- `assist backlog stop` - Revert all in-progress backlog items to todo and reset their phase to 1
|
|
129
129
|
- `assist backlog done <id>` - Set a backlog item to done
|
|
@@ -251,12 +251,13 @@ The first backlog command in a repository that still has a local `.assist/backlo
|
|
|
251
251
|
Web sessions are owned by a long-lived daemon process, not the web server: the server is a thin client that relays WebSocket traffic to the daemon over a local IPC socket (unix domain socket at `~/.assist/daemon/daemon.sock`; named pipe `\\.\pipe\assist-sessions-daemon` on Windows). Restarting the web server leaves sessions running with scrollback intact. The daemon logs to `~/.assist/daemon/daemon.log` and auto-exits once no sessions remain and no client has been connected for 60 seconds (it is respawned on demand by the web server).
|
|
252
252
|
|
|
253
253
|
When iterating on assist itself: web server changes only need the `assist sessions` process restarted — sessions survive. Daemon/session-core changes need `assist daemon restart` to load the new code; this kills the PTYs, then claude sessions — including assist sessions that wrap claude, like `assist draft` — are auto-respawned via `claude --resume` with scrollback starting fresh, while run sessions (and assist sessions whose claude sessionId was never discovered) reappear as not-restored tiles that can be retried.
|
|
254
|
-
- `assist next [id]` - Alias for `backlog next [id]`
|
|
255
|
-
- `assist draft` (alias: `feat`) - Launch Claude in `/draft` mode, chain into next on `/next` signal
|
|
256
|
-
- `assist bug` - Launch Claude in `/bug` mode, chain into next on `/next` signal
|
|
257
|
-
- `assist refine [id]` - Launch Claude in `/refine` mode to refine a backlog item; prompts for selection when no id given
|
|
254
|
+
- `assist next [id] [--once]` - Alias for `backlog next [id]`; `--once` exits after the first completed item run instead of prompting for another
|
|
255
|
+
- `assist draft [--once]` (alias: `feat`) - Launch Claude in `/draft` mode, chain into next on `/next` signal; `--once` exits when the done signal arrives after the initial draft completes
|
|
256
|
+
- `assist bug [--once]` - Launch Claude in `/bug` mode, chain into next on `/next` signal; `--once` exits when the done signal arrives after the initial bug report completes
|
|
257
|
+
- `assist refine [id] [--once]` - Launch Claude in `/refine` mode to refine a backlog item; prompts for selection when no id given; `--once` exits when the done signal arrives after refinement completes
|
|
258
258
|
- `assist review-comments [number]` - Launch Claude in `/review-comments` mode to process PR review comments (single session, no chaining); when a PR number is supplied, checks out that PR via `gh pr checkout` first
|
|
259
259
|
- `assist signal next [id]` - Write a next signal to chain into `assist next`; when `id` is supplied, the parent launcher runs that backlog item directly
|
|
260
|
+
- `assist signal done` - Write a done signal marking the session's initial task complete; `--once` launch sessions exit when it arrives, plain sessions ignore it
|
|
260
261
|
|
|
261
262
|
When `commit.pull` is enabled in config, `assist draft`, `assist bug`, `assist refine`, `assist next`, and `assist backlog run` run `git pull --ff-only` before doing anything else; if the pull fails the command aborts. `assist next` pulls once per invocation, not per item in its loop.
|
|
262
263
|
|
package/claude/commands/bug.md
CHANGED
|
@@ -47,3 +47,9 @@ assist backlog add --name "Bug title" --type bug --desc "**Repro:**\n1. ...\n\n*
|
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
Then show the user the item was created and suggest they can run `assist backlog run <id>` to start implementation.
|
|
50
|
+
|
|
51
|
+
Finally, signal that the bug-filing task is complete:
|
|
52
|
+
```
|
|
53
|
+
assist signal done 2>&1
|
|
54
|
+
```
|
|
55
|
+
This lets a wrapping `assist bug --once` session end; in a plain interactive session it has no effect.
|
package/claude/commands/draft.md
CHANGED
|
@@ -84,3 +84,9 @@ assist backlog add-phase <id> "Phase name" --task "Task 1" --task "Task 2" --man
|
|
|
84
84
|
```
|
|
85
85
|
|
|
86
86
|
Then show the user the item was created and suggest they can run `assist backlog run <id>` to start implementation.
|
|
87
|
+
|
|
88
|
+
Finally, signal that the drafting task is complete:
|
|
89
|
+
```
|
|
90
|
+
assist signal done 2>&1
|
|
91
|
+
```
|
|
92
|
+
This lets a wrapping `assist draft --once` session end; in a plain interactive session it has no effect.
|
|
@@ -80,3 +80,11 @@ After applying changes, show the updated item with `assist backlog view <id> 2>&
|
|
|
80
80
|
## Step 4: Iterate
|
|
81
81
|
|
|
82
82
|
Ask if there is anything else to refine. Continue the conversation until the user is satisfied.
|
|
83
|
+
|
|
84
|
+
## Step 5: Signal completion
|
|
85
|
+
|
|
86
|
+
Once the user confirms they are done refining, signal that the task is complete:
|
|
87
|
+
```
|
|
88
|
+
assist signal done 2>&1
|
|
89
|
+
```
|
|
90
|
+
This lets a wrapping `assist refine --once` session end; in a plain interactive session it has no effect.
|
|
@@ -200,7 +200,7 @@ ${e}</tr>
|
|
|
200
200
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+t+`</${r}>
|
|
201
201
|
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${gn(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:r}){let o=this.parser.parseInline(r),i=ZN(e);if(i===null)return o;e=i;let n='<a href="'+e+'"';return t&&(n+=' title="'+gn(t)+'"'),n+=">"+o+"</a>",n}image({href:e,title:t,text:r,tokens:o}){o&&(r=this.parser.parseInline(o,this.parser.textRenderer));let i=ZN(e);if(i===null)return gn(r);e=i;let n=`<img src="${e}" alt="${r}"`;return t&&(n+=` title="${gn(t)}"`),n+=">",n}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:gn(e.text)}},L1=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},ds=class P1{constructor(t){Fe(this,"options");Fe(this,"renderer");Fe(this,"textRenderer");this.options=t||Ul,this.options.renderer=this.options.renderer||new hb,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new L1}static parse(t,r){return new P1(r).parse(t)}static parseInline(t,r){return new P1(r).parseInline(t)}parse(t,r=!0){let o="";for(let i=0;i<t.length;i++){let n=t[i];if(this.options.extensions?.renderers?.[n.type]){let a=n,l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(a.type)){o+=l||"";continue}}let s=n;switch(s.type){case"space":{o+=this.renderer.space(s);continue}case"hr":{o+=this.renderer.hr(s);continue}case"heading":{o+=this.renderer.heading(s);continue}case"code":{o+=this.renderer.code(s);continue}case"table":{o+=this.renderer.table(s);continue}case"blockquote":{o+=this.renderer.blockquote(s);continue}case"list":{o+=this.renderer.list(s);continue}case"html":{o+=this.renderer.html(s);continue}case"paragraph":{o+=this.renderer.paragraph(s);continue}case"text":{let a=s,l=this.renderer.text(a);for(;i+1<t.length&&t[i+1].type==="text";)a=t[++i],l+=`
|
|
202
202
|
`+this.renderer.text(a);r?o+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l,escaped:!0}]}):o+=l;continue}default:{let a='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return o}parseInline(t,r=this.renderer){let o="";for(let i=0;i<t.length;i++){let n=t[i];if(this.options.extensions?.renderers?.[n.type]){let a=this.options.extensions.renderers[n.type].call({parser:this},n);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(n.type)){o+=a||"";continue}}let s=n;switch(s.type){case"escape":{o+=r.text(s);break}case"html":{o+=r.html(s);break}case"link":{o+=r.link(s);break}case"image":{o+=r.image(s);break}case"strong":{o+=r.strong(s);break}case"em":{o+=r.em(s);break}case"codespan":{o+=r.codespan(s);break}case"br":{o+=r.br(s);break}case"del":{o+=r.del(s);break}case"text":{o+=r.text(s);break}default:{let a='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return o}},C1,pb=(C1=class{constructor(e){Fe(this,"options");Fe(this,"block");this.options=e||Ul}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?ps.lex:ps.lexInline}provideParser(){return this.block?ds.parse:ds.parseInline}},Fe(C1,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),C1),yG=class{constructor(...e){Fe(this,"defaults",E1());Fe(this,"options",this.setOptions);Fe(this,"parse",this.parseMarkdown(!0));Fe(this,"parseInline",this.parseMarkdown(!1));Fe(this,"Parser",ds);Fe(this,"Renderer",hb);Fe(this,"TextRenderer",L1);Fe(this,"Lexer",ps);Fe(this,"Tokenizer",fb);Fe(this,"Hooks",pb);this.use(...e)}walkTokens(e,t){let r=[];for(let o of e)switch(r=r.concat(t.call(this,o)),o.type){case"table":{let i=o;for(let n of i.header)r=r.concat(this.walkTokens(n.tokens,t));for(let n of i.rows)for(let s of n)r=r.concat(this.walkTokens(s.tokens,t));break}case"list":{let i=o;r=r.concat(this.walkTokens(i.items,t));break}default:{let i=o;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(n=>{let s=i[n].flat(1/0);r=r.concat(this.walkTokens(s,t))}):i.tokens&&(r=r.concat(this.walkTokens(i.tokens,t)))}}return r}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{let o={...r};if(o.async=this.defaults.async||o.async||!1,r.extensions&&(r.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let n=t.renderers[i.name];n?t.renderers[i.name]=function(...s){let a=i.renderer.apply(this,s);return a===!1&&(a=n.apply(this,s)),a}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let n=t[i.level];n?n.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),o.extensions=t),r.renderer){let i=this.defaults.renderer||new hb(this.defaults);for(let n in r.renderer){if(!(n in i))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let s=n,a=r.renderer[s],l=i[s];i[s]=(...c)=>{let u=a.apply(i,c);return u===!1&&(u=l.apply(i,c)),u||""}}o.renderer=i}if(r.tokenizer){let i=this.defaults.tokenizer||new fb(this.defaults);for(let n in r.tokenizer){if(!(n in i))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let s=n,a=r.tokenizer[s],l=i[s];i[s]=(...c)=>{let u=a.apply(i,c);return u===!1&&(u=l.apply(i,c)),u}}o.tokenizer=i}if(r.hooks){let i=this.defaults.hooks||new pb;for(let n in r.hooks){if(!(n in i))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let s=n,a=r.hooks[s],l=i[s];pb.passThroughHooks.has(n)?i[s]=c=>{if(this.defaults.async)return Promise.resolve(a.call(i,c)).then(p=>l.call(i,p));let u=a.call(i,c);return l.call(i,u)}:i[s]=(...c)=>{let u=a.apply(i,c);return u===!1&&(u=l.apply(i,c)),u}}o.hooks=i}if(r.walkTokens){let i=this.defaults.walkTokens,n=r.walkTokens;o.walkTokens=function(s){let a=[];return a.push(n.call(this,s)),i&&(a=a.concat(i.call(this,s))),a}}this.defaults={...this.defaults,...o}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return ps.lex(e,t??this.defaults)}parser(e,t){return ds.parse(e,t??this.defaults)}parseMarkdown(e){return(r,o)=>{let i={...o},n={...this.defaults,...i},s=this.onError(!!n.silent,!!n.async);if(this.defaults.async===!0&&i.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));n.hooks&&(n.hooks.options=n,n.hooks.block=e);let a=n.hooks?n.hooks.provideLexer():e?ps.lex:ps.lexInline,l=n.hooks?n.hooks.provideParser():e?ds.parse:ds.parseInline;if(n.async)return Promise.resolve(n.hooks?n.hooks.preprocess(r):r).then(c=>a(c,n)).then(c=>n.hooks?n.hooks.processAllTokens(c):c).then(c=>n.walkTokens?Promise.all(this.walkTokens(c,n.walkTokens)).then(()=>c):c).then(c=>l(c,n)).then(c=>n.hooks?n.hooks.postprocess(c):c).catch(s);try{n.hooks&&(r=n.hooks.preprocess(r));let c=a(r,n);n.hooks&&(c=n.hooks.processAllTokens(c)),n.walkTokens&&this.walkTokens(c,n.walkTokens);let u=l(c,n);return n.hooks&&(u=n.hooks.postprocess(u)),u}catch(c){return s(c)}}}onError(e,t){return r=>{if(r.message+=`
|
|
203
|
-
Please report this to https://github.com/markedjs/marked.`,e){let o="<p>An error occurred:</p><pre>"+gn(r.message+"",!0)+"</pre>";return t?Promise.resolve(o):o}if(t)return Promise.reject(r);throw r}}},Hl=new yG;function ke(e,t){return Hl.parse(e,t)}ke.options=ke.setOptions=function(e){return Hl.setOptions(e),ke.defaults=Hl.defaults,eL(ke.defaults),ke};ke.getDefaults=E1;ke.defaults=Ul;ke.use=function(...e){return Hl.use(...e),ke.defaults=Hl.defaults,eL(ke.defaults),ke};ke.walkTokens=function(e,t){return Hl.walkTokens(e,t)};ke.parseInline=Hl.parseInline;ke.Parser=ds;ke.parser=ds.parse;ke.Renderer=hb;ke.TextRenderer=L1;ke.Lexer=ps;ke.lexer=ps.lex;ke.Tokenizer=fb;ke.Hooks=pb;ke.parse=ke;var pBe=ke.options,dBe=ke.setOptions,fBe=ke.use,hBe=ke.walkTokens,mBe=ke.parseInline;var yBe=ds.parse,gBe=ps.lex;var pL=_(I(),1),ga=_(R(),1);function gG({text:e}){return(0,ga.jsx)(de,{sx:t=>({border:1,borderColor:"divider",borderRadius:1,p:1.5,mt:1,minHeight:60,bgcolor:t.palette.mode==="dark"?"grey.900":"grey.50"}),dangerouslySetInnerHTML:{__html:ke.parse(e||"")}})}function dL({value:e,onChange:t}){let[r,o]=(0,pL.useState)(!1);return(0,ga.jsxs)(de,{sx:{mb:2},children:[(0,ga.jsxs)(X,{variant:"body2",sx:{fontWeight:"medium",mb:.5},children:["Description"," ",(0,ga.jsx)(qy,{component:"button",type:"button",variant:"caption",onClick:()=>o(!r),sx:{ml:1},children:"(preview)"})]}),(0,ga.jsx)(Zt,{fullWidth:!0,multiline:!0,minRows:4,size:"small",placeholder:"Markdown supported",value:e,onChange:i=>t(i.target.value)}),r&&(0,ga.jsx)(gG,{text:e})]})}var xh=_(R(),1);function fL({submitLabel:e,onCancel:t}){return(0,xh.jsxs)(Ae,{direction:"row",spacing:1,sx:{mt:2},children:[(0,xh.jsx)(Re,{type:"submit",variant:"contained",children:e}),(0,xh.jsx)(Re,{type:"button",variant:"outlined",onClick:t,children:"Cancel"})]})}var mL=_(R(),1);function hL({value:e,onChange:t}){return(0,mL.jsx)(Zt,{label:"Name",required:!0,fullWidth:!0,size:"small",placeholder:"Item name",value:e,onChange:r=>t(r.target.value),sx:{mb:2}})}var $l=_(R(),1);function yL({value:e,onChange:t}){return(0,$l.jsxs)(fu,{sx:{mb:2},children:[(0,$l.jsx)(gu,{children:"Type"}),(0,$l.jsx)(mg,{row:!0,name:"type",value:e,onChange:r=>t(r.target.value),children:["story","bug"].map(r=>(0,$l.jsx)(yu,{value:r,control:(0,$l.jsx)(hg,{size:"small"}),label:r.charAt(0).toUpperCase()+r.slice(1)},r))})]})}var ji=_(R(),1);function gL({title:e,submitLabel:t,type:r,onTypeChange:o,name:i,onNameChange:n,description:s,onDescriptionChange:a,initialAc:l,onAcChange:c,onCancel:u}){return(0,ji.jsxs)(ji.Fragment,{children:[(0,ji.jsx)(X,{variant:"h6",sx:{mb:2},children:e}),(0,ji.jsx)(yL,{value:r,onChange:o}),(0,ji.jsx)(hL,{value:i,onChange:n}),(0,ji.jsx)(dL,{value:s,onChange:a}),(0,ji.jsx)(GN,{initial:l,onChange:c}),(0,ji.jsx)(fL,{submitLabel:t,onCancel:u})]})}var wp=_(I(),1);function vL(e){let t=VN(e),[r,o]=(0,wp.useState)(t.type),[i,n]=(0,wp.useState)(t.name),[s,a]=(0,wp.useState)(t.description),l=(0,wp.useRef)(t.ac);return{defaults:t,type:r,setType:o,name:i,setName:n,description:s,setDescription:a,setAc(c){l.current=c},fields(){return{type:r,name:i,description:s,criteria:l.current}}}}var va=_(R(),1);function gb({item:e,onReload:t,backTo:r}){let o=_o(),i=So(),n=vL(e);return(0,va.jsxs)(va.Fragment,{children:[(0,va.jsx)(sb,{to:r}),(0,va.jsx)(St,{component:"form",variant:"outlined",sx:{p:3},onSubmit:s=>qN(s,n.fields(),e,i,async a=>{await t(),o(`/backlog/items/${a}`)}),children:(0,va.jsx)(gL,{title:n.defaults.title,submitLabel:n.defaults.submitLabel,type:n.type,onTypeChange:n.setType,name:n.name,onNameChange:n.setName,description:n.description,onDescriptionChange:n.setDescription,initialAc:n.defaults.ac,onAcChange:n.setAc,onCancel:()=>o(r)})})]})}var ba=_(I(),1);function bL(){let e=So(),[t,r]=(0,ba.useState)(""),[o,i]=(0,ba.useState)(null),[n,s]=(0,ba.useState)(!1),a=(0,ba.useRef)(void 0);return(0,ba.useEffect)(()=>{if(a.current!==void 0&&clearTimeout(a.current),!t.trim()){i(null),s(!1);return}return s(!0),a.current=setTimeout(async()=>{i(await lb(t,e)),s(!1)},250),()=>{a.current!==void 0&&clearTimeout(a.current)}},[t,e]),{query:t,setQuery:r,results:o,loading:n}}var _L=_(I(),1),SL="backlog-show-completed",I1=new Set,xL=vG();function vG(){try{return localStorage.getItem(SL)==="true"}catch{return!1}}function bG(e){return I1.add(e),()=>I1.delete(e)}function _G(){return xL}function SG(e){xL=e;try{localStorage.setItem(SL,String(e))}catch{}for(let t of I1)t()}function vb(){return[(0,_L.useSyncExternalStore)(bG,_G),SG]}var z1=_(R(),1);function TL(){let[e,t]=vb();return(0,z1.jsx)(yu,{control:(0,z1.jsx)(vg,{checked:e,onChange:()=>t(!e),size:"small"}),label:"Show completed",slotProps:{typography:{variant:"body2",color:"text.secondary"}}})}var bb={story:"info",bug:"error"},_b={todo:"default","in-progress":"warning",done:"success",wontdo:"error"};var wL=_(R(),1),xG={flexShrink:0,fontWeight:500,fontSize:"0.75rem",height:22};function CL(){return(0,wL.jsx)(ni,{label:"in progress",size:"small",color:_b["in-progress"],sx:xG})}var PL=_(R(),1),TG={todo:"\u25CB","in-progress":"\u25D4",done:"\u25CF",wontdo:"\u2715"},CG={todo:"text.disabled","in-progress":"warning.main",done:"success.main",wontdo:"error.main"};function wG(e){return{fontSize:"1.125rem",flexShrink:0,color:CG[e]}}function RL({status:e}){return(0,PL.jsx)(X,{sx:wG(e),children:TG[e]})}var _a=_(R(),1),EL={display:"flex",alignItems:"center",gap:1.5,width:"100%",textAlign:"left",p:2,mb:1,borderRadius:2,border:1,borderColor:"divider",bgcolor:"background.paper",transition:"box-shadow 0.2s","&:hover":{boxShadow:3}},RG=EL,PG={...EL,borderColor:"warning.main",borderLeft:4,borderLeftColor:"warning.main",bgcolor:e=>Bi(e.palette.warning.main,.08)},EG={color:"text.disabled",flexShrink:0},kG={fontWeight:500,flex:1,textAlign:"left"},OG={flexShrink:0,fontWeight:500,fontSize:"0.75rem",height:22};function kL({item:e,onSelect:t}){let r=e.status==="in-progress";return(0,_a.jsxs)(Bt,{onClick:t,sx:r?PG:RG,children:[(0,_a.jsx)(RL,{status:e.status}),(0,_a.jsx)(ni,{label:e.type,size:"small",color:bb[e.type],sx:OG}),(0,_a.jsxs)(X,{variant:"body2",sx:EG,children:["#",e.id]}),(0,_a.jsx)(X,{sx:kG,children:e.name}),r&&(0,_a.jsx)(CL,{})]})}var fs=_(R(),1),MG={display:"flex",justifyContent:"center",py:6},DG={textAlign:"center",color:"text.disabled",py:6,px:2};function AG({query:e}){let t=e.trim()?"No items match your search.":"No items in the backlog.";return(0,fs.jsx)(de,{sx:DG,children:t})}function OL({loading:e,query:t,items:r,onSelect:o}){return e?(0,fs.jsx)(de,{sx:MG,children:(0,fs.jsx)(Is,{})}):r.length===0?(0,fs.jsx)(AG,{query:t}):(0,fs.jsx)(fs.Fragment,{children:r.map(i=>(0,fs.jsx)(kL,{item:i,onSelect:()=>o(i)},i.id))})}var DL=_(R(),1);function ML({value:e,onChange:t}){return(0,DL.jsx)(Zt,{fullWidth:!0,size:"small",placeholder:"Search backlog\u2026",value:e,onChange:r=>t(r.target.value),sx:{mb:2}})}var Vo=_(R(),1),BG={justifyContent:"space-between",alignItems:"center",mb:3};function NG(e,t){return t?e:e.filter(r=>r.status!=="done"&&r.status!=="wontdo")}var LG={fontWeight:600},IG={alignItems:"center"};function zG({onAdd:e}){return(0,Vo.jsxs)(Ae,{direction:"row",sx:BG,children:[(0,Vo.jsx)(X,{variant:"h5",sx:LG,children:"Backlog"}),(0,Vo.jsxs)(Ae,{direction:"row",spacing:2,sx:IG,children:[(0,Vo.jsx)(TL,{}),(0,Vo.jsx)(Re,{variant:"contained",size:"small",onClick:e,children:"+ Add Item"})]})]})}function AL({items:e,loading:t}){let r=_o(),[o]=vb(),{query:i,setQuery:n,results:s,loading:a}=bL(),l=NG(s??e,o);return(0,Vo.jsxs)(Vo.Fragment,{children:[(0,Vo.jsx)(zG,{onAdd:()=>r("/backlog/add")}),(0,Vo.jsx)(ML,{value:i,onChange:n}),(0,Vo.jsx)(OL,{loading:t||a,query:i,items:l,onSelect:c=>r(`/backlog/items/${c.id}`)})]})}var BL=_(I(),1);var hs=_(R(),1);function Sb({onConfirm:e,onCancel:t,title:r="Confirm deletion",message:o="Are you sure you want to delete this item?"}){return(0,hs.jsxs)(lu,{open:!0,onClose:t,maxWidth:"xs",fullWidth:!0,children:[(0,hs.jsx)(pu,{children:r}),(0,hs.jsx)(uu,{children:(0,hs.jsx)(Uy,{children:o})}),(0,hs.jsxs)(cu,{children:[(0,hs.jsx)(Re,{onClick:t,children:"Cancel"}),(0,hs.jsx)(Re,{variant:"contained",color:"error",onClick:e,children:"Delete"})]})]})}var jl=_(R(),1);function NL({itemId:e,onDeleted:t}){let r=So(),[o,i]=(0,BL.useState)(!1);return(0,jl.jsxs)(jl.Fragment,{children:[o&&(0,jl.jsx)(Sb,{onConfirm:async()=>{await FN(e,r),await t()},onCancel:()=>i(!1)}),(0,jl.jsx)(Re,{variant:"contained",color:"error",size:"small",onClick:()=>i(!0),children:"Delete"})]})}var Sa=_(R(),1);function LL({criteria:e}){return e.length===0?null:(0,Sa.jsxs)(de,{sx:{mb:2},children:[(0,Sa.jsx)(X,{variant:"overline",sx:{color:"text.secondary",mb:1,display:"block",letterSpacing:"0.08em"},children:"Acceptance Criteria"}),(0,Sa.jsx)(sn,{disablePadding:!0,children:e.map((t,r)=>(0,Sa.jsxs)(Us,{disableGutters:!0,disablePadding:!0,sx:{py:.5,display:"flex",alignItems:"baseline"},children:[(0,Sa.jsxs)(X,{component:"span",sx:{color:"text.secondary",mr:1},children:[r+1,"."]}),(0,Sa.jsx)(de,{component:"span",className:"markdown",dangerouslySetInnerHTML:{__html:ke.parseInline(t)}})]},t))})]})}var Wl=_(R(),1),FG={alignItems:"center",fontSize:"0.75rem",color:"text.secondary",mb:.5},HG={color:"text.disabled"},UG={fontWeight:500},$G={summary:"Phase summary",comment:"Comment"};function IL({comment:e}){return(0,Wl.jsxs)(Ae,{direction:"row",spacing:.5,sx:FG,children:[e.id!==void 0&&(0,Wl.jsxs)(X,{variant:"caption",sx:HG,children:["#",e.id]}),(0,Wl.jsx)(X,{variant:"caption",sx:UG,children:$G[e.type]}),e.phase!==void 0&&(0,Wl.jsxs)(X,{variant:"caption",children:["\xB7 Phase ",e.phase]}),(0,Wl.jsxs)(X,{variant:"caption",children:["\xB7 ",jG(e.timestamp)]})]})}function jG(e){return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}var zL=_(R(),1),FL=_e((0,zL.jsx)("path",{d:"M16 9v10H8V9zm-1.5-6h-5l-1 1H5v2h14V4h-3.5zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2z"}),"DeleteOutlined");var F1=_(I(),1);var vn=_(R(),1),WG={mt:-.5,mr:-.5,color:"text.secondary"};function HL({itemId:e,commentId:t,onDeleted:r}){let o=So(),[i,n]=(0,F1.useState)(!1),[s,a]=(0,F1.useState)(),l=()=>a(void 0);return(0,vn.jsxs)(vn.Fragment,{children:[i&&(0,vn.jsx)(Sb,{message:"Are you sure you want to delete this comment?",onConfirm:async()=>{n(!1);try{await HN(e,t,o),await r()}catch(c){a(c instanceof Error?c.message:"Failed to delete comment")}},onCancel:()=>n(!1)}),(0,vn.jsx)(Ru,{open:s!==void 0,autoHideDuration:6e3,onClose:l,children:(0,vn.jsx)(Qc,{severity:"error",variant:"filled",onClose:l,children:s})}),(0,vn.jsx)(ii,{"aria-label":"Delete comment",size:"small",sx:WG,onClick:()=>n(!0),children:(0,vn.jsx)(FL,{fontSize:"inherit"})})]})}var Vl=_(R(),1),VG={summary:{bgcolor:"warning.light",borderColor:"warning.dark"},comment:{bgcolor:"action.selected",borderColor:"divider"}},qG={justifyContent:"space-between",alignItems:"flex-start"},KG={color:"text.primary",whiteSpace:"pre-wrap"};function GG(e){return{p:1.5,bgcolor:e.bgcolor,borderColor:e.borderColor}}function UL({comment:e,itemId:t,onDeleted:r}){return(0,Vl.jsxs)(St,{variant:"outlined",sx:GG(VG[e.type]),children:[(0,Vl.jsxs)(Ae,{direction:"row",sx:qG,children:[(0,Vl.jsx)(IL,{comment:e}),e.id!==void 0&&t!==void 0&&r&&(0,Vl.jsx)(HL,{itemId:t,commentId:e.id,onDeleted:r})]}),(0,Vl.jsx)(X,{variant:"body2",sx:KG,children:e.text})]})}var Rp=_(R(),1),YG={color:"text.secondary",mb:1,display:"block",letterSpacing:"0.08em"};function $L({comments:e,itemId:t,onCommentDeleted:r}){return e.length===0?null:(0,Rp.jsxs)(de,{sx:{mb:2},children:[(0,Rp.jsx)(X,{variant:"overline",sx:YG,children:"Comments"}),(0,Rp.jsx)(Ae,{spacing:1,children:e.map((o,i)=>(0,Rp.jsx)(UL,{comment:o,itemId:t,onDeleted:r},`${o.timestamp}-${i}`))})]})}var xb=_(R(),1),jL={todo:{bg:"action.selected",text:"text.primary"},"in-progress":{bg:"warning.main",text:"warning.contrastText"},done:{bg:"success.main",text:"success.contrastText"},wontdo:{bg:"error.main",text:"error.contrastText"}},XG=["todo","in-progress","done","wontdo"];function WL({current:e,onStatusChange:t}){return t?(0,xb.jsx)(Cu,{value:e,onChange:r=>t(r.target.value),size:"small",sx:{fontSize:"0.75rem",fontWeight:500,borderRadius:4,bgcolor:jL[e].bg,color:jL[e].text,"& .MuiSelect-select":{py:.5,px:1.5},"& .MuiSelect-icon":{color:"inherit"}},children:XG.map(r=>(0,xb.jsx)(Un,{value:r,children:r},r))}):(0,xb.jsx)(ni,{label:e,size:"small",color:_b[e],sx:{fontWeight:500,fontSize:"0.75rem"}})}var Pp=_(R(),1),ZG={alignItems:"center",color:"text.disabled",fontSize:"0.875rem",mb:2},QG={fontWeight:500,fontSize:"0.75rem"};function VL({item:e,onStatusChange:t}){let r=bb[e.type];return(0,Pp.jsxs)(Ae,{direction:"row",spacing:1,sx:ZG,children:[(0,Pp.jsxs)(X,{variant:"body2",color:"text.disabled",children:["#",e.id]}),r&&(0,Pp.jsx)(ni,{label:e.type,size:"small",color:r,sx:QG}),(0,Pp.jsx)(WL,{current:e.status,onStatusChange:t})]})}var KL=_(R(),1),JG={lineHeight:1.7,"& p":{mt:0}};function qL({content:e}){return(0,KL.jsx)(de,{className:"markdown",sx:JG,dangerouslySetInnerHTML:{__html:ke.parse(e)}})}var ms=_(R(),1);function GL({checks:e}){return(0,ms.jsxs)(de,{sx:{mt:1,pt:1},children:[(0,ms.jsx)(du,{sx:{mb:1}}),(0,ms.jsx)(X,{variant:"overline",sx:{color:"text.disabled",letterSpacing:"0.08em"},children:"Manual Checks"}),(0,ms.jsx)(sn,{disablePadding:!0,sx:{ml:.5,mt:.5},children:e.map(t=>(0,ms.jsxs)(Us,{disableGutters:!0,disablePadding:!0,sx:{py:.25,display:"flex",alignItems:"baseline"},children:[(0,ms.jsx)(X,{component:"span",sx:{mr:1,fontSize:"0.875rem",color:"text.secondary"},children:"\u2610"}),(0,ms.jsx)(de,{component:"span",className:"markdown",sx:{fontSize:"0.875rem",color:"text.secondary"},dangerouslySetInnerHTML:{__html:ke.parseInline(t)}})]},t))})]})}var ZL=_(I(),1);var YL=_(I(),1),bn=_(R(),1);function XL({phaseName:e,onConfirm:t,onCancel:r}){let[o,i]=(0,YL.useState)("");return(0,bn.jsxs)(lu,{open:!0,onClose:r,maxWidth:"xs",fullWidth:!0,children:[(0,bn.jsxs)(pu,{children:["Rewind to ",e,"?"]}),(0,bn.jsxs)(uu,{children:[(0,bn.jsx)(X,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"This will mark all later phases as incomplete."}),(0,bn.jsx)(Zt,{fullWidth:!0,multiline:!0,rows:3,size:"small",placeholder:"Reason for rewinding...",value:o,onChange:n=>i(n.target.value)})]}),(0,bn.jsxs)(cu,{children:[(0,bn.jsx)(Re,{onClick:r,children:"Cancel"}),(0,bn.jsx)(Re,{variant:"contained",color:"warning",disabled:o.trim().length===0,onClick:()=>t(o.trim()),children:"Rewind"})]})]})}var ql=_(R(),1);function QL({itemId:e,phaseNumber:t,phaseName:r,onRewound:o}){let i=So(),[n,s]=(0,ZL.useState)(!1);return(0,ql.jsxs)(ql.Fragment,{children:[(0,ql.jsx)(Re,{size:"small",color:"warning",variant:"outlined",onClick:()=>s(!0),sx:{ml:"auto",textTransform:"none",fontSize:"0.75rem"},children:"Rewind"}),n&&(0,ql.jsx)(XL,{phaseName:r,onConfirm:async a=>{await jN(e,t,a,i),await o()},onCancel:()=>s(!1)})]})}var Ep=_(R(),1),eY={done:{label:"Done",color:"success"},current:{label:"In Progress",color:"info"},upcoming:{label:"Upcoming",color:"default"}},tY={alignItems:"center",mb:1},rY={fontWeight:500},oY={fontWeight:500,fontSize:"0.75rem"};function JL({phase:e,index:t,status:r,itemId:o,onRewind:i}){let n=eY[r],s=r==="done"&&o!==void 0&&i;return(0,Ep.jsxs)(Ae,{direction:"row",spacing:1,sx:tY,children:[(0,Ep.jsxs)(X,{sx:rY,children:["Phase ",t+1,": ",e.name]}),(0,Ep.jsx)(ni,{label:n.label,size:"small",color:n.color,sx:oY}),s&&(0,Ep.jsx)(QL,{itemId:o,phaseNumber:t+1,phaseName:e.name,onRewound:i})]})}var kp=_(R(),1);function e5({tasks:e,marker:t}){return(0,kp.jsx)(sn,{disablePadding:!0,sx:{ml:.5},children:e.map(r=>(0,kp.jsxs)(Us,{disableGutters:!0,disablePadding:!0,sx:{py:.25,display:"flex",alignItems:"baseline"},children:[(0,kp.jsx)(X,{component:"span",sx:{color:"text.secondary",mr:1},children:t}),(0,kp.jsx)(de,{component:"span",className:"markdown",dangerouslySetInnerHTML:{__html:ke.parseInline(r.task)}})]},r.task))})}var Op=_(R(),1),iY={done:{borderColor:"success.light",bgcolor:"success.light"},current:{borderColor:"info.main",bgcolor:"info.light",ring:"info.light"},upcoming:{borderColor:"divider",bgcolor:"background.paper"}};function nY(e){return{p:2,borderColor:e.borderColor,bgcolor:e.bgcolor,...e.ring?{boxShadow:"0 0 0 2px",borderColor:"info.main"}:{}}}var sY={done:"\u2713",current:"\u2022",upcoming:"\u2022"};function t5({phase:e,index:t,status:r,itemId:o,onRewind:i}){let n=e.manualChecks??[];return(0,Op.jsxs)(St,{variant:"outlined",sx:nY(iY[r]),children:[(0,Op.jsx)(JL,{phase:e,index:t,status:r,itemId:o,onRewind:i}),(0,Op.jsx)(e5,{tasks:e.tasks,marker:sY[r]}),n.length>0&&(0,Op.jsx)(GL,{checks:n})]})}var Mp=_(R(),1);function aY(e,t){if(t===void 0)return"upcoming";let r=e+1;return r<t?"done":r===t?"current":"upcoming"}function r5({phases:e,currentPhase:t,itemId:r,onRewind:o}){return e.length===0?null:(0,Mp.jsxs)(de,{sx:{mb:2},children:[(0,Mp.jsx)(X,{variant:"overline",sx:{color:"text.secondary",mb:1,display:"block",letterSpacing:"0.08em"},children:"Plan"}),(0,Mp.jsx)(Ae,{spacing:1.5,children:e.map((i,n)=>(0,Mp.jsx)(t5,{phase:i,index:n,status:aY(n,t),itemId:r,onRewind:o},i.name))})]})}var Wi=_(R(),1),lY={color:"text.secondary",mb:1,display:"block",letterSpacing:"0.08em"};function o5({item:e,onStatusChange:t,onRewind:r,onCommentDeleted:o}){return(0,Wi.jsxs)(St,{variant:"outlined",sx:{p:3},children:[(0,Wi.jsx)(X,{variant:"h5",component:"h2",children:e.name}),(0,Wi.jsx)(VL,{item:e,onStatusChange:t}),e.description&&(0,Wi.jsxs)(de,{sx:{mb:2},children:[(0,Wi.jsx)(X,{variant:"overline",sx:lY,children:"Description"}),(0,Wi.jsx)(qL,{content:e.description})]}),(0,Wi.jsx)(LL,{criteria:e.acceptanceCriteria}),e.plan&&(0,Wi.jsx)(r5,{phases:e.plan,currentPhase:e.currentPhase,itemId:e.id,onRewind:r}),e.comments&&(0,Wi.jsx)($L,{comments:e.comments,itemId:e.id,onCommentDeleted:o})]})}var _n=_(R(),1),cY={justifyContent:"space-between",alignItems:"center",mb:2};function uY({itemId:e,onDeleted:t}){let r=_o();return(0,_n.jsxs)(Ae,{direction:"row",sx:cY,children:[(0,_n.jsx)(sb,{to:"/backlog"}),(0,_n.jsxs)(Ae,{direction:"row",spacing:1,children:[(0,_n.jsx)(Re,{variant:"contained",color:"inherit",size:"small",onClick:()=>r(`/backlog/items/${e}/edit`),children:"Edit"}),(0,_n.jsx)(NL,{itemId:e,onDeleted:t})]})]})}function i5({item:e,onReload:t}){let r=_o(),o=So(),i=async()=>{await t(),r("/backlog")},n=async s=>{await $N(e.id,s,o),await t()};return(0,_n.jsxs)(de,{children:[(0,_n.jsx)(uY,{itemId:e.id,onDeleted:i}),(0,_n.jsx)(o5,{item:e,onStatusChange:n,onRewind:t,onCommentDeleted:t})]})}var H1=_(R(),1);function U1({items:e,mode:t,onReload:r}){let{id:o}=c1(),i=Number(o),n=e.find(s=>s.id===i);return n?t==="edit"?(0,H1.jsx)(gb,{item:n,onReload:r,backTo:`/backlog/items/${i}`}):(0,H1.jsx)(i5,{item:n,onReload:r}):null}var Vi=_(R(),1);function n5({items:e,loading:t,onReload:r}){return(0,Vi.jsxs)(Fl,{children:[(0,Vi.jsx)(Wo,{index:!0,element:(0,Vi.jsx)(AL,{items:e,loading:t})}),(0,Vi.jsx)(Wo,{path:"items/:id",element:(0,Vi.jsx)(U1,{items:e,mode:"detail",onReload:r})}),(0,Vi.jsx)(Wo,{path:"items/:id/edit",element:(0,Vi.jsx)(U1,{items:e,mode:"edit",onReload:r})}),(0,Vi.jsx)(Wo,{path:"add",element:(0,Vi.jsx)(gb,{onReload:r,backTo:"/backlog"})})]})}var ys=_(I(),1);function s5(){let e=So(),[t,r]=(0,ys.useState)([]),[o,i]=(0,ys.useState)(!0),[n,s]=(0,ys.useState)(!0),a=(0,ys.useCallback)(async()=>{r(await lb(void 0,e)),i(!1)},[e]);(0,ys.useEffect)(()=>{i(!0),s(!0),(async()=>{if(await LN(e)){await a();return}s(!1),r([]),i(!1)})()},[e,a]);let l=(0,ys.useCallback)(async()=>{await IN(e),s(!0),i(!0),await a()},[e,a]);return{items:t,loading:o,exists:n,reload:a,initialize:l}}var Th=_(R(),1);function a5(){let{items:e,loading:t,exists:r,reload:o,initialize:i}=s5();return r?(0,Th.jsx)(Fl,{children:(0,Th.jsx)(Wo,{path:"/*",element:(0,Th.jsx)(n5,{items:e,loading:t,onReload:o})})}):(0,Th.jsx)(BN,{onInit:i})}var fz=_(I(),1);var Db=_(I(),1);var $1={"assist-draft":{label:"\u25B6 /draft",args:["draft"]},"assist-bug":{label:"\u25B6 /bug",args:["bug"]},"assist-next":{label:"\u25B6 /next",args:["next"]}};function pY(e){return e in $1}function dY(e){return[...$1[e].args]}function l5(e,t,r,o){if(pY(e)&&t){r(dY(e),t);return}o(e)}var c5=Object.entries($1).map(([e,{label:t}])=>({value:e,label:t})),u5="Enter prompt...";var Ch=_(R(),1),fY={textTransform:"none",fontSize:13,py:.25,px:1.25};function p5({onSelect:e}){return(0,Ch.jsx)(Ch.Fragment,{children:c5.map(t=>(0,Ch.jsx)(Re,{size:"small",variant:"outlined",onClick:()=>e(t.value),sx:fY,children:t.label},t.value))})}var f5=_(R(),1);function hY(e){return(e.params?.length??0)>0}function d5({config:e,active:t,onClick:r}){return(0,f5.jsxs)(Re,{size:"small",variant:t?"contained":"outlined",onClick:r,sx:{textTransform:"none",fontSize:13,py:.25,px:1.25},children:[!hY(e)&&"\u25B6 ",e.name]})}var Kl=_(R(),1);function h5({configs:e,selectedRun:t,onSelectRun:r,hiddenCount:o}){return(0,Kl.jsxs)(Kl.Fragment,{children:[e.map(i=>(0,Kl.jsx)(d5,{config:i,active:t===i.name,onClick:()=>r(i.name)},i.name)),o>0&&(0,Kl.jsxs)(X,{variant:"caption",color:"text.disabled",children:["+",o," more"]})]})}var wh=_(R(),1),mY=10;function m5({onSelectMode:e,runConfigs:t,totalRunCount:r,selectedRun:o,onSelectRun:i}){let n=t.slice(0,mY);return(0,wh.jsxs)(Ae,{direction:"row",spacing:.5,sx:{flexWrap:"wrap",alignItems:"center"},children:[(0,wh.jsx)(p5,{onSelect:a=>{i(null),e(a)}}),(0,wh.jsx)(h5,{configs:n,selectedRun:o,onSelectRun:i,hiddenCount:r-n.length})]})}var Rh=_(R(),1);function y5({prompt:e,setPrompt:t}){return(0,Rh.jsxs)(Ae,{direction:"row",spacing:1,children:[(0,Rh.jsx)(Zt,{value:e,onChange:r=>t(r.target.value),placeholder:u5,size:"small",fullWidth:!0,slotProps:{input:{sx:{fontSize:13}}}}),(0,Rh.jsx)(Re,{type:"submit",variant:"contained",size:"small",sx:{whiteSpace:"nowrap"},children:"Start"})]})}var Ph=_(R(),1);function yY(e){let t=e.description?` \u2014 ${e.description}`:"";return e.required?`${e.name} *${t}`:`${e.name}${t}`}function g5({config:e,values:t,onChange:r}){let o=e.params??[],i=(n,s)=>r({...t,[n]:s});return(0,Ph.jsxs)(Ae,{spacing:.75,children:[o.map(n=>(0,Ph.jsx)(Zt,{label:yY(n),value:t[n.name]??n.default??"",onChange:s=>i(n.name,s.target.value),placeholder:n.default??"",size:"small",fullWidth:!0,slotProps:{input:{sx:{fontSize:13}},inputLabel:{sx:{fontSize:11},shrink:!0}}},n.name)),(0,Ph.jsxs)(Re,{type:"submit",variant:"contained",size:"small",children:["Run ",e.name]})]})}var xa=_(R(),1);function v5({form:e,totalRunCount:t}){let r=e.selectedRun?e.filteredRunConfigs.find(o=>o.name===e.selectedRun):null;return(0,xa.jsxs)(xa.Fragment,{children:[(0,xa.jsx)(m5,{onSelectMode:e.handleSelectMode,runConfigs:e.filteredRunConfigs,totalRunCount:t,selectedRun:e.selectedRun,onSelectRun:e.handleSelectRun}),e.selectedRun&&r?(0,xa.jsx)(g5,{config:r,values:e.runParams,onChange:e.setRunParams}):(0,xa.jsx)(y5,{prompt:e.prompt,setPrompt:e.setPrompt})]})}var Gl=_(I(),1);function b5(e,t,r,o){return e&&!t.find(n=>n.name===e)?.params?.length?(o(e,[],r),null):e}function _5(e,t,r){r(e.trim(),t)}function S5(e,t){return(e?.params??[]).map(r=>t[r.name]?.trim()).filter(Boolean)}function x5(e){if(e.selectedRun){let t=e.configs.find(r=>r.name===e.selectedRun);return e.onCreateRun(e.selectedRun,S5(t,e.runParams),e.cwd),"run"}return _5(e.prompt,e.cwd,e.onCreate),"claude"}var Tb=_(I(),1);function T5(e,t){if(!t)return!0;let o=(t.includes("*")?t:`*${t}*`).replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${o}$`,"i").test(e)}function C5(e){let[t,r]=(0,Tb.useState)(""),o=(0,Tb.useMemo)(()=>e.filter(i=>T5(i.name,t)),[e,t]);return{runFilter:t,setRunFilter:r,filteredRunConfigs:o}}function w5(e){let{runConfigs:t,onCreateRun:r,onRequestRunConfigs:o}=e,{selectedCwd:i}=nb(),[n,s]=(0,Gl.useState)("free"),[a,l]=(0,Gl.useState)(""),[c,u]=(0,Gl.useState)(null),[p,f]=(0,Gl.useState)({}),d=C5(t);return(0,Gl.useEffect)(()=>{i&&o(i)},[i,o]),{selectedCwd:i,mode:n,prompt:a,setPrompt:l,selectedRun:c,runParams:p,setRunParams:f,...d,handleSelectRun(h){u(b5(h,t,i,r)),f({})},handleSelectMode(h){u(null),l5(h,i,e.onCreateAssist,s)},handleSubmit(h){if(h.preventDefault(),!i)return;x5({selectedRun:c,runParams:p,prompt:a,cwd:i,configs:t,onCreate:e.onCreate,onCreateRun:e.onCreateRun})==="run"?f({}):l("")}}}var Dp=_(R(),1);function R5(e){let{runConfigs:t}=e,r=w5(e),o=r.selectedCwd!=="";return(0,Dp.jsxs)(de,{component:"form",onSubmit:r.handleSubmit,sx:{p:1.5,borderTop:1,borderColor:"divider",display:"flex",flexDirection:"column",gap:1},children:[t.length>0&&(0,Dp.jsx)(Zt,{value:r.runFilter,onChange:i=>r.setRunFilter(i.target.value),placeholder:"Filter runs...",size:"small",fullWidth:!0,slotProps:{input:{sx:{fontSize:13}}}}),o?(0,Dp.jsx)(v5,{form:r,totalRunCount:t.length}):(0,Dp.jsx)(X,{variant:"caption",color:"text.disabled",sx:{py:.75},children:"Select a repo in the toolbar to create a session"})]})}var P5=_(R(),1),E5=_e((0,P5.jsx)("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close");var j1=_(R(),1);function k5({onDismiss:e}){return(0,j1.jsx)(ii,{size:"small",onClick:t=>{t.stopPropagation(),e()},title:"Dismiss",sx:{color:"text.disabled","&:hover":{color:"text.primary"}},children:(0,j1.jsx)(E5,{sx:{fontSize:16}})})}var O5=_(R(),1),M5=_e((0,O5.jsx)("path",{d:"M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8"}),"Replay");var W1=_(R(),1);function D5({onRetry:e}){return(0,W1.jsx)(ii,{size:"small",onClick:t=>{t.stopPropagation(),e()},title:"Retry",sx:{color:"text.disabled","&:hover":{color:"text.primary"}},children:(0,W1.jsx)(M5,{sx:{fontSize:14}})})}var Ap=_(R(),1);function Cb(e){return{display:"block",width:"100%",textAlign:"left",p:"10px 12px",mb:.5,borderRadius:1.5,bgcolor:e?"action.selected":"background.default",border:1,borderColor:e?"primary.main":"transparent",cursor:"pointer",transition:"background 0.15s","&:hover":e?void 0:{bgcolor:"action.hover"}}}function A5({name:e,isDone:t,onRetry:r,onDismiss:o}){return(0,Ap.jsxs)(de,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,Ap.jsx)(X,{variant:"body2",noWrap:!0,sx:{flex:1,color:"text.primary"},children:e}),t&&r&&(0,Ap.jsx)(D5,{onRetry:r}),t&&(0,Ap.jsx)(k5,{onDismiss:o})]})}var Yl=_(R(),1),gY={running:"success.main",waiting:"warning.main",done:"info.main"};function B5({status:e,elapsed:t,restored:r}){return(0,Yl.jsxs)(de,{sx:{display:"flex",justifyContent:"space-between",mt:.5},children:[(0,Yl.jsxs)(de,{sx:{display:"flex",gap:1},children:[(0,Yl.jsxs)(X,{variant:"caption",sx:{color:gY[e]},children:["\u25CF ",e]}),r!==void 0&&(0,Yl.jsx)(X,{variant:"caption",sx:{color:r?"success.main":"warning.main"},children:r?"restored":"not restored"})]}),(0,Yl.jsx)(X,{variant:"caption",color:"text.disabled",children:t})]})}var wb=_(I(),1);function N5(e){let[,t]=(0,wb.useState)(0);(0,wb.useEffect)(()=>{let n=setInterval(()=>t(s=>s+1),1e3);return()=>clearInterval(n)},[]);let r=Math.floor((Date.now()-e)/1e3),o=Math.floor(r/60),i=r%60;return o>=60?`${Math.floor(o/60)}h ${o%60}m`:o>0?`${o}m ${i}s`:`${i}s`}var Eh=_(R(),1);function L5({session:e,active:t,onClick:r,onRetry:o,onDismiss:i}){let n=N5(e.startedAt);return(0,Eh.jsxs)(Bt,{onClick:r,sx:Cb(t),children:[(0,Eh.jsx)(A5,{name:e.name,isDone:e.status==="done",onRetry:o,onDismiss:i}),(0,Eh.jsx)(B5,{status:e.status,elapsed:n,restored:e.restored})]})}var kh=_(R(),1);function I5({sessions:e,activeId:t,onSelect:r,onRetry:o,onDismiss:i}){return(0,kh.jsxs)(de,{sx:{flex:1,overflow:"auto",p:1},children:[e.map(n=>(0,kh.jsx)(L5,{session:n,active:n.id===t,onClick:()=>r(n.id),onRetry:(n.commandType==="run"||n.commandType==="assist")&&n.status==="done"?()=>o(n.id):void 0,onDismiss:()=>i(n.id)},n.id)),e.length===0&&(0,kh.jsx)(X,{variant:"caption",color:"text.disabled",sx:{display:"block",textAlign:"center",p:2},children:"No sessions yet"})]})}var Xl=_(R(),1);function z5({sessions:e,activeId:t,run:r,onSelect:o,onCreate:i,onCreateAssist:n,onRetry:s,onDismiss:a}){return(0,Xl.jsxs)(Xl.Fragment,{children:[(0,Xl.jsx)(I5,{sessions:e,activeId:t,onSelect:o,onRetry:s,onDismiss:a}),(0,Xl.jsx)(R5,{runConfigs:r.configs,onCreate:i,onCreateRun:r.create,onCreateAssist:n,onRequestRunConfigs:r.requestConfigs})]})}var Mb=_(I(),1);function F5(e){let t=Date.now()-new Date(e).getTime(),r=Math.floor(t/1e3);if(r<60)return"just now";let o=Math.floor(r/60);if(o<60)return`${o}m ago`;let i=Math.floor(o/60);if(i<24)return`${i}h ago`;let n=Math.floor(i/24);return n<30?`${n}d ago`:`${Math.floor(n/30)}mo ago`}var Zl=_(R(),1);function H5({session:e,onResume:t}){return(0,Zl.jsxs)(Bt,{onClick:()=>t(e),sx:Cb(!1),children:[(0,Zl.jsx)(X,{variant:"body2",noWrap:!0,sx:{color:"text.primary"},children:e.name}),(0,Zl.jsxs)(de,{sx:{display:"flex",justifyContent:"space-between",mt:.5},children:[(0,Zl.jsx)(X,{variant:"caption",color:"info.main",children:e.project}),(0,Zl.jsx)(X,{variant:"caption",color:"text.disabled",children:F5(e.timestamp)})]})]})}var Pb=_(I(),1);var U5=_(R(),1),$5=_e((0,U5.jsx)("path",{d:"m7 10 5 5 5-5z"}),"ArrowDropDown");var j5=_(R(),1),W5=_e((0,j5.jsx)("path",{d:"m7 14 5-5 5 5z"}),"ArrowDropUp");var Rb=_(R(),1);function V5({label:e,open:t,onClick:r}){return(0,Rb.jsx)(Re,{size:"small",variant:"outlined",onClick:r,endIcon:t?(0,Rb.jsx)(W5,{}):(0,Rb.jsx)($5,{}),sx:{textTransform:"none",fontSize:11,justifyContent:"space-between",maxWidth:"100%",overflow:"hidden"},fullWidth:!0,children:e})}var Ob=_(R(),1),Eb={position:"absolute",top:"100%",left:0,right:0,mt:.25,maxHeight:200,overflowY:"auto",zIndex:10};function kb({label:e,children:t}){let[r,o]=(0,Pb.useState)(!1),i=(0,Pb.useRef)(null);return(0,Ob.jsxs)(St,{component:"fieldset",ref:i,variant:"outlined",sx:{position:"relative",border:"none",m:0,p:0},onBlur:n=>{i.current?.contains(n.relatedTarget)||o(!1)},children:[(0,Ob.jsx)(V5,{label:e,open:r,onClick:()=>o(!r)}),r&&t(()=>o(!1))]})}var Bp=_(R(),1);function q5({items:e,selected:t,onToggle:r}){return(0,Bp.jsx)(fl,{dense:!0,sx:Eb,children:e.map(o=>(0,Bp.jsxs)(Un,{onClick:()=>r(o),dense:!0,children:[(0,Bp.jsx)(L0,{size:"small",checked:t.has(o),sx:{p:0,mr:1}}),(0,Bp.jsx)(J0,{primary:o,slotProps:{primary:{variant:"caption"}}})]},o))})}var V1=_(R(),1);function vY(e){return e.size===0?"All projects":e.size===1?[...e][0]:`${e.size} projects`}function K5({projects:e,selected:t,onChange:r}){let o=i=>{let n=new Set(t);n.has(i)?n.delete(i):n.add(i),r(n)};return(0,V1.jsx)(kb,{label:vY(t),children:()=>(0,V1.jsx)(q5,{items:e,selected:t,onToggle:o})})}function G5(e){let t=new Set;for(let r of e)t.add(r.project);return[...t].sort()}function Y5(e,t){return t.size===0?e:e.filter(r=>t.has(r.project))}var Sn=_(R(),1);function bY({hasAny:e}){return(0,Sn.jsx)(X,{variant:"caption",color:"text.disabled",sx:{display:"block",textAlign:"center",p:2},children:e?"No sessions match filter":"No session history"})}function _Y({sessions:e,onResume:t}){return(0,Sn.jsxs)(de,{sx:{flex:1,overflow:"auto",p:1},children:[e.map(r=>(0,Sn.jsx)(H5,{session:r,onResume:t},r.sessionId)),e.length===0&&(0,Sn.jsx)(bY,{hasAny:!1})]})}function X5({sessions:e,onResume:t}){let[r,o]=(0,Mb.useState)(new Set),i=(0,Mb.useMemo)(()=>G5(e),[e]),n=Y5(e,r);return(0,Sn.jsxs)(de,{sx:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:[i.length>1&&(0,Sn.jsx)(de,{sx:{px:1,pt:1},children:(0,Sn.jsx)(K5,{projects:i,selected:r,onChange:o})}),(0,Sn.jsx)(_Y,{sessions:n,onResume:t})]})}var Oh=_(R(),1),Z5={minHeight:36,py:0,fontSize:12};function Q5({tab:e,activeCount:t,historyCount:r,onChange:o}){return(0,Oh.jsxs)(hf,{value:e==="active"?0:1,onChange:(n,s)=>o(s===0?"active":"history"),variant:"fullWidth",sx:{borderBottom:1,borderColor:"divider",minHeight:36},children:[(0,Oh.jsx)(hl,{label:`Active ${t}`,sx:Z5}),(0,Oh.jsx)(hl,{label:`History ${r}`,sx:Z5})]})}var Np=_(R(),1),SY={width:280,minWidth:280,borderRight:1,borderColor:"divider",display:"flex",flexDirection:"column",bgcolor:"background.paper"};function J5(e){return(0,Np.jsxs)(de,{sx:SY,children:[(0,Np.jsx)(Q5,{tab:e.tab,activeCount:e.sessions.length,historyCount:e.history.length,onChange:e.onTabChange}),e.tab==="active"?(0,Np.jsx)(z5,{sessions:e.sessions,activeId:e.activeId,run:e.run,onSelect:e.onSelect,onCreate:e.onCreate,onCreateAssist:e.onCreateAssist,onRetry:e.onRetry,onDismiss:e.onDismiss}):(0,Np.jsx)(X5,{sessions:e.history,onResume:e.onResume})]})}var tI=_(R(),1);function eI({socket:e,tab:t,onTabChange:r}){let o=(0,Db.useCallback)(n=>{e.resumeSession(n.sessionId,n.cwd,n.name),r("active")},[e.resumeSession,r]),i=(0,Db.useMemo)(()=>({configs:e.runConfigs,create:e.createRunSession,requestConfigs:e.requestRunConfigs}),[e.runConfigs,e.createRunSession,e.requestRunConfigs]);return(0,tI.jsx)(J5,{sessions:e.sessions,history:e.history,run:i,activeId:e.activeId,tab:t,onTabChange:r,onSelect:e.setActiveId,onCreate:e.createSession,onCreateAssist:e.createAssistSession,onResume:o,onRetry:e.retrySession,onDismiss:e.dismissSession})}var cz=_(I(),1);var em=_(I(),1);var xY=2,TY=1,rI=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,r=window.getComputedStyle(this._terminal.element.parentElement),o=parseInt(r.getPropertyValue("height")),i=Math.max(0,parseInt(r.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),s={top:parseInt(n.getPropertyValue("padding-top")),bottom:parseInt(n.getPropertyValue("padding-bottom")),right:parseInt(n.getPropertyValue("padding-right")),left:parseInt(n.getPropertyValue("padding-left"))},a=s.top+s.bottom,l=s.right+s.left,c=o-a,u=i-l-t;return{cols:Math.max(xY,Math.floor(u/e.css.cell.width)),rows:Math.max(TY,Math.floor(c/e.css.cell.height))}}};var s3=Object.defineProperty,CY=Object.getOwnPropertyDescriptor,wY=(e,t)=>{for(var r in t)s3(e,r,{get:t[r],enumerable:!0})},jt=(e,t,r,o)=>{for(var i=o>1?void 0:o?CY(t,r):t,n=e.length-1,s;n>=0;n--)(s=e[n])&&(i=(o?s(t,r,i):s(i))||i);return o&&i&&s3(t,r,i),i},te=(e,t)=>(r,o)=>t(r,o,e),oI="Terminal input",lC={get:()=>oI,set:e=>oI=e},iI="Too much output to announce, navigate to rows manually to read",cC={get:()=>iI,set:e=>iI=e};function RY(e){return e.replace(/\r?\n/g,"\r")}function PY(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function EY(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function kY(e,t,r,o){if(e.stopPropagation(),e.clipboardData){let i=e.clipboardData.getData("text/plain");a3(i,t,r,o)}}function a3(e,t,r,o){e=RY(e),e=PY(e,r.decPrivateModes.bracketedPasteMode&&o.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(e,!0),t.value=""}function l3(e,t,r){let o=r.getBoundingClientRect(),i=e.clientX-o.left-10,n=e.clientY-o.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${i}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}function nI(e,t,r,o,i){l3(e,t,r),i&&o.rightClickSelect(e),t.value=o.selectionText,t.select()}function Pa(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function o_(e,t=0,r=e.length){let o="";for(let i=t;i<r;++i){let n=e[i];n>65535?(n-=65536,o+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):o+=String.fromCharCode(n)}return o}var OY=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let r=e.length;if(!r)return 0;let o=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[o++]=(this._interim-55296)*1024+n-56320+65536:(t[o++]=this._interim,t[o++]=n),this._interim=0}for(let n=i;n<r;++n){let s=e.charCodeAt(n);if(55296<=s&&s<=56319){if(++n>=r)return this._interim=s,o;let a=e.charCodeAt(n);56320<=a&&a<=57343?t[o++]=(s-55296)*1024+a-56320+65536:(t[o++]=s,t[o++]=a);continue}s!==65279&&(t[o++]=s)}return o}},MY=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let r=e.length;if(!r)return 0;let o=0,i,n,s,a,l=0,c=0;if(this.interim[0]){let f=!1,d=this.interim[0];d&=(d&224)===192?31:(d&240)===224?15:7;let h=0,y;for(;(y=this.interim[++h]&63)&&h<4;)d<<=6,d|=y;let b=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,m=b-h;for(;c<m;){if(c>=r)return 0;if(y=e[c++],(y&192)!==128){c--,f=!0;break}else this.interim[h++]=y,d<<=6,d|=y&63}f||(b===2?d<128?c--:t[o++]=d:b===3?d<2048||d>=55296&&d<=57343||d===65279||(t[o++]=d):d<65536||d>1114111||(t[o++]=d)),this.interim.fill(0)}let u=r-4,p=c;for(;p<r;){for(;p<u&&!((i=e[p])&128)&&!((n=e[p+1])&128)&&!((s=e[p+2])&128)&&!((a=e[p+3])&128);)t[o++]=i,t[o++]=n,t[o++]=s,t[o++]=a,p+=4;if(i=e[p++],i<128)t[o++]=i;else if((i&224)===192){if(p>=r)return this.interim[0]=i,o;if(n=e[p++],(n&192)!==128){p--;continue}if(l=(i&31)<<6|n&63,l<128){p--;continue}t[o++]=l}else if((i&240)===224){if(p>=r)return this.interim[0]=i,o;if(n=e[p++],(n&192)!==128){p--;continue}if(p>=r)return this.interim[0]=i,this.interim[1]=n,o;if(s=e[p++],(s&192)!==128){p--;continue}if(l=(i&15)<<12|(n&63)<<6|s&63,l<2048||l>=55296&&l<=57343||l===65279)continue;t[o++]=l}else if((i&248)===240){if(p>=r)return this.interim[0]=i,o;if(n=e[p++],(n&192)!==128){p--;continue}if(p>=r)return this.interim[0]=i,this.interim[1]=n,o;if(s=e[p++],(s&192)!==128){p--;continue}if(p>=r)return this.interim[0]=i,this.interim[1]=n,this.interim[2]=s,o;if(a=e[p++],(a&192)!==128){p--;continue}if(l=(i&7)<<18|(n&63)<<12|(s&63)<<6|a&63,l<65536||l>1114111)continue;t[o++]=l}}return o}},c3="",Ea=" ",Xh=class u3{constructor(){this.fg=0,this.bg=0,this.extended=new Gb}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new u3;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Gb=class p3{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new p3(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ti=class d3 extends Xh{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Gb,this.combinedData=""}static fromCharData(t){let r=new d3;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Pa(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let o=t[1].charCodeAt(0);if(55296<=o&&o<=56319){let i=t[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(o-55296)*1024+i-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},sI="di$target",uC="di$dependencies",q1=new Map;function DY(e){return e[uC]||[]}function Sr(e){if(q1.has(e))return q1.get(e);let t=function(r,o,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");AY(t,r,i)};return t._id=e,q1.set(e,t),t}function AY(e,t,r){t[sI]===t?t[uC].push({id:e,index:r}):(t[uC]=[{id:e,index:r}],t[sI]=t)}var io=Sr("BufferService"),f3=Sr("CoreMouseService"),nc=Sr("CoreService"),BY=Sr("CharsetService"),qC=Sr("InstantiationService"),h3=Sr("LogService"),no=Sr("OptionsService"),m3=Sr("OscLinkService"),NY=Sr("UnicodeService"),Zh=Sr("DecorationService"),pC=class{constructor(e,t,r){this._bufferService=e,this._optionsService=t,this._oscLinkService=r}provideLinks(e,t){let r=this._bufferService.buffer.lines.get(e-1);if(!r){t(void 0);return}let o=[],i=this._optionsService.rawOptions.linkHandler,n=new Ti,s=r.getTrimmedLength(),a=-1,l=-1,c=!1;for(let u=0;u<s;u++)if(!(l===-1&&!r.hasContent(u))){if(r.loadCell(u,n),n.hasExtendedAttrs()&&n.extended.urlId)if(l===-1){l=u,a=n.extended.urlId;continue}else c=n.extended.urlId!==a;else l!==-1&&(c=!0);if(c||l!==-1&&u===s-1){let p=this._oscLinkService.getLinkData(a)?.uri;if(p){let f={start:{x:l+1,y:e},end:{x:u+(!c&&u===s-1?1:0),y:e}},d=!1;if(!i?.allowNonHttpProtocols)try{let h=new URL(p);["http:","https:"].includes(h.protocol)||(d=!0)}catch{d=!0}d||o.push({text:p,range:f,activate:(h,y)=>i?i.activate(h,y,f):LY(h,y),hover:(h,y)=>i?.hover?.(h,y,f),leave:(h,y)=>i?.leave?.(h,y,f)})}c=!1,n.hasExtendedAttrs()&&n.extended.urlId?(l=u,a=n.extended.urlId):(l=-1,a=-1)}}t(o)}};pC=jt([te(0,io),te(1,no),te(2,m3)],pC);function LY(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
203
|
+
Please report this to https://github.com/markedjs/marked.`,e){let o="<p>An error occurred:</p><pre>"+gn(r.message+"",!0)+"</pre>";return t?Promise.resolve(o):o}if(t)return Promise.reject(r);throw r}}},Hl=new yG;function ke(e,t){return Hl.parse(e,t)}ke.options=ke.setOptions=function(e){return Hl.setOptions(e),ke.defaults=Hl.defaults,eL(ke.defaults),ke};ke.getDefaults=E1;ke.defaults=Ul;ke.use=function(...e){return Hl.use(...e),ke.defaults=Hl.defaults,eL(ke.defaults),ke};ke.walkTokens=function(e,t){return Hl.walkTokens(e,t)};ke.parseInline=Hl.parseInline;ke.Parser=ds;ke.parser=ds.parse;ke.Renderer=hb;ke.TextRenderer=L1;ke.Lexer=ps;ke.lexer=ps.lex;ke.Tokenizer=fb;ke.Hooks=pb;ke.parse=ke;var pBe=ke.options,dBe=ke.setOptions,fBe=ke.use,hBe=ke.walkTokens,mBe=ke.parseInline;var yBe=ds.parse,gBe=ps.lex;var pL=_(I(),1),ga=_(R(),1);function gG({text:e}){return(0,ga.jsx)(de,{sx:t=>({border:1,borderColor:"divider",borderRadius:1,p:1.5,mt:1,minHeight:60,bgcolor:t.palette.mode==="dark"?"grey.900":"grey.50"}),dangerouslySetInnerHTML:{__html:ke.parse(e||"")}})}function dL({value:e,onChange:t}){let[r,o]=(0,pL.useState)(!1);return(0,ga.jsxs)(de,{sx:{mb:2},children:[(0,ga.jsxs)(X,{variant:"body2",sx:{fontWeight:"medium",mb:.5},children:["Description"," ",(0,ga.jsx)(qy,{component:"button",type:"button",variant:"caption",onClick:()=>o(!r),sx:{ml:1},children:"(preview)"})]}),(0,ga.jsx)(Zt,{fullWidth:!0,multiline:!0,minRows:4,size:"small",placeholder:"Markdown supported",value:e,onChange:i=>t(i.target.value)}),r&&(0,ga.jsx)(gG,{text:e})]})}var xh=_(R(),1);function fL({submitLabel:e,onCancel:t}){return(0,xh.jsxs)(Ae,{direction:"row",spacing:1,sx:{mt:2},children:[(0,xh.jsx)(Re,{type:"submit",variant:"contained",children:e}),(0,xh.jsx)(Re,{type:"button",variant:"outlined",onClick:t,children:"Cancel"})]})}var mL=_(R(),1);function hL({value:e,onChange:t}){return(0,mL.jsx)(Zt,{label:"Name",required:!0,fullWidth:!0,size:"small",placeholder:"Item name",value:e,onChange:r=>t(r.target.value),sx:{mb:2}})}var $l=_(R(),1);function yL({value:e,onChange:t}){return(0,$l.jsxs)(fu,{sx:{mb:2},children:[(0,$l.jsx)(gu,{children:"Type"}),(0,$l.jsx)(mg,{row:!0,name:"type",value:e,onChange:r=>t(r.target.value),children:["story","bug"].map(r=>(0,$l.jsx)(yu,{value:r,control:(0,$l.jsx)(hg,{size:"small"}),label:r.charAt(0).toUpperCase()+r.slice(1)},r))})]})}var ji=_(R(),1);function gL({title:e,submitLabel:t,type:r,onTypeChange:o,name:i,onNameChange:n,description:s,onDescriptionChange:a,initialAc:l,onAcChange:c,onCancel:u}){return(0,ji.jsxs)(ji.Fragment,{children:[(0,ji.jsx)(X,{variant:"h6",sx:{mb:2},children:e}),(0,ji.jsx)(yL,{value:r,onChange:o}),(0,ji.jsx)(hL,{value:i,onChange:n}),(0,ji.jsx)(dL,{value:s,onChange:a}),(0,ji.jsx)(GN,{initial:l,onChange:c}),(0,ji.jsx)(fL,{submitLabel:t,onCancel:u})]})}var wp=_(I(),1);function vL(e){let t=VN(e),[r,o]=(0,wp.useState)(t.type),[i,n]=(0,wp.useState)(t.name),[s,a]=(0,wp.useState)(t.description),l=(0,wp.useRef)(t.ac);return{defaults:t,type:r,setType:o,name:i,setName:n,description:s,setDescription:a,setAc(c){l.current=c},fields(){return{type:r,name:i,description:s,criteria:l.current}}}}var va=_(R(),1);function gb({item:e,onReload:t,backTo:r}){let o=_o(),i=So(),n=vL(e);return(0,va.jsxs)(va.Fragment,{children:[(0,va.jsx)(sb,{to:r}),(0,va.jsx)(St,{component:"form",variant:"outlined",sx:{p:3},onSubmit:s=>qN(s,n.fields(),e,i,async a=>{await t(),o(`/backlog/items/${a}`)}),children:(0,va.jsx)(gL,{title:n.defaults.title,submitLabel:n.defaults.submitLabel,type:n.type,onTypeChange:n.setType,name:n.name,onNameChange:n.setName,description:n.description,onDescriptionChange:n.setDescription,initialAc:n.defaults.ac,onAcChange:n.setAc,onCancel:()=>o(r)})})]})}var ba=_(I(),1);function bL(){let e=So(),[t,r]=(0,ba.useState)(""),[o,i]=(0,ba.useState)(null),[n,s]=(0,ba.useState)(!1),a=(0,ba.useRef)(void 0);return(0,ba.useEffect)(()=>{if(a.current!==void 0&&clearTimeout(a.current),!t.trim()){i(null),s(!1);return}return s(!0),a.current=setTimeout(async()=>{i(await lb(t,e)),s(!1)},250),()=>{a.current!==void 0&&clearTimeout(a.current)}},[t,e]),{query:t,setQuery:r,results:o,loading:n}}var _L=_(I(),1),SL="backlog-show-completed",I1=new Set,xL=vG();function vG(){try{return localStorage.getItem(SL)==="true"}catch{return!1}}function bG(e){return I1.add(e),()=>I1.delete(e)}function _G(){return xL}function SG(e){xL=e;try{localStorage.setItem(SL,String(e))}catch{}for(let t of I1)t()}function vb(){return[(0,_L.useSyncExternalStore)(bG,_G),SG]}var z1=_(R(),1);function TL(){let[e,t]=vb();return(0,z1.jsx)(yu,{control:(0,z1.jsx)(vg,{checked:e,onChange:()=>t(!e),size:"small"}),label:"Show completed",slotProps:{typography:{variant:"body2",color:"text.secondary"}}})}var bb={story:"info",bug:"error"},_b={todo:"default","in-progress":"warning",done:"success",wontdo:"error"};var wL=_(R(),1),xG={flexShrink:0,fontWeight:500,fontSize:"0.75rem",height:22};function CL(){return(0,wL.jsx)(ni,{label:"in progress",size:"small",color:_b["in-progress"],sx:xG})}var PL=_(R(),1),TG={todo:"\u25CB","in-progress":"\u25D4",done:"\u25CF",wontdo:"\u2715"},CG={todo:"text.disabled","in-progress":"warning.main",done:"success.main",wontdo:"error.main"};function wG(e){return{fontSize:"1.125rem",flexShrink:0,color:CG[e]}}function RL({status:e}){return(0,PL.jsx)(X,{sx:wG(e),children:TG[e]})}var _a=_(R(),1),EL={display:"flex",alignItems:"center",gap:1.5,width:"100%",textAlign:"left",p:2,mb:1,borderRadius:2,border:1,borderColor:"divider",bgcolor:"background.paper",transition:"box-shadow 0.2s","&:hover":{boxShadow:3}},RG=EL,PG={...EL,borderColor:"warning.main",borderLeft:4,borderLeftColor:"warning.main",bgcolor:e=>Bi(e.palette.warning.main,.08)},EG={color:"text.disabled",flexShrink:0},kG={fontWeight:500,flex:1,textAlign:"left"},OG={flexShrink:0,fontWeight:500,fontSize:"0.75rem",height:22};function kL({item:e,onSelect:t}){let r=e.status==="in-progress";return(0,_a.jsxs)(Bt,{onClick:t,sx:r?PG:RG,children:[(0,_a.jsx)(RL,{status:e.status}),(0,_a.jsx)(ni,{label:e.type,size:"small",color:bb[e.type],sx:OG}),(0,_a.jsxs)(X,{variant:"body2",sx:EG,children:["#",e.id]}),(0,_a.jsx)(X,{sx:kG,children:e.name}),r&&(0,_a.jsx)(CL,{})]})}var fs=_(R(),1),MG={display:"flex",justifyContent:"center",py:6},DG={textAlign:"center",color:"text.disabled",py:6,px:2};function AG({query:e}){let t=e.trim()?"No items match your search.":"No items in the backlog.";return(0,fs.jsx)(de,{sx:DG,children:t})}function OL({loading:e,query:t,items:r,onSelect:o}){return e?(0,fs.jsx)(de,{sx:MG,children:(0,fs.jsx)(Is,{})}):r.length===0?(0,fs.jsx)(AG,{query:t}):(0,fs.jsx)(fs.Fragment,{children:r.map(i=>(0,fs.jsx)(kL,{item:i,onSelect:()=>o(i)},i.id))})}var DL=_(R(),1);function ML({value:e,onChange:t}){return(0,DL.jsx)(Zt,{fullWidth:!0,size:"small",placeholder:"Search backlog\u2026",value:e,onChange:r=>t(r.target.value),sx:{mb:2}})}var Vo=_(R(),1),BG={justifyContent:"space-between",alignItems:"center",mb:3};function NG(e,t){return t?e:e.filter(r=>r.status!=="done"&&r.status!=="wontdo")}var LG={fontWeight:600},IG={alignItems:"center"};function zG({onAdd:e}){return(0,Vo.jsxs)(Ae,{direction:"row",sx:BG,children:[(0,Vo.jsx)(X,{variant:"h5",sx:LG,children:"Backlog"}),(0,Vo.jsxs)(Ae,{direction:"row",spacing:2,sx:IG,children:[(0,Vo.jsx)(TL,{}),(0,Vo.jsx)(Re,{variant:"contained",size:"small",onClick:e,children:"+ Add Item"})]})]})}function AL({items:e,loading:t}){let r=_o(),[o]=vb(),{query:i,setQuery:n,results:s,loading:a}=bL(),l=NG(s??e,o);return(0,Vo.jsxs)(Vo.Fragment,{children:[(0,Vo.jsx)(zG,{onAdd:()=>r("/backlog/add")}),(0,Vo.jsx)(ML,{value:i,onChange:n}),(0,Vo.jsx)(OL,{loading:t||a,query:i,items:l,onSelect:c=>r(`/backlog/items/${c.id}`)})]})}var BL=_(I(),1);var hs=_(R(),1);function Sb({onConfirm:e,onCancel:t,title:r="Confirm deletion",message:o="Are you sure you want to delete this item?"}){return(0,hs.jsxs)(lu,{open:!0,onClose:t,maxWidth:"xs",fullWidth:!0,children:[(0,hs.jsx)(pu,{children:r}),(0,hs.jsx)(uu,{children:(0,hs.jsx)(Uy,{children:o})}),(0,hs.jsxs)(cu,{children:[(0,hs.jsx)(Re,{onClick:t,children:"Cancel"}),(0,hs.jsx)(Re,{variant:"contained",color:"error",onClick:e,children:"Delete"})]})]})}var jl=_(R(),1);function NL({itemId:e,onDeleted:t}){let r=So(),[o,i]=(0,BL.useState)(!1);return(0,jl.jsxs)(jl.Fragment,{children:[o&&(0,jl.jsx)(Sb,{onConfirm:async()=>{await FN(e,r),await t()},onCancel:()=>i(!1)}),(0,jl.jsx)(Re,{variant:"contained",color:"error",size:"small",onClick:()=>i(!0),children:"Delete"})]})}var Sa=_(R(),1);function LL({criteria:e}){return e.length===0?null:(0,Sa.jsxs)(de,{sx:{mb:2},children:[(0,Sa.jsx)(X,{variant:"overline",sx:{color:"text.secondary",mb:1,display:"block",letterSpacing:"0.08em"},children:"Acceptance Criteria"}),(0,Sa.jsx)(sn,{disablePadding:!0,children:e.map((t,r)=>(0,Sa.jsxs)(Us,{disableGutters:!0,disablePadding:!0,sx:{py:.5,display:"flex",alignItems:"baseline"},children:[(0,Sa.jsxs)(X,{component:"span",sx:{color:"text.secondary",mr:1},children:[r+1,"."]}),(0,Sa.jsx)(de,{component:"span",className:"markdown",dangerouslySetInnerHTML:{__html:ke.parseInline(t)}})]},t))})]})}var Wl=_(R(),1),FG={alignItems:"center",fontSize:"0.75rem",color:"text.secondary",mb:.5},HG={color:"text.disabled"},UG={fontWeight:500},$G={summary:"Phase summary",comment:"Comment"};function IL({comment:e}){return(0,Wl.jsxs)(Ae,{direction:"row",spacing:.5,sx:FG,children:[e.id!==void 0&&(0,Wl.jsxs)(X,{variant:"caption",sx:HG,children:["#",e.id]}),(0,Wl.jsx)(X,{variant:"caption",sx:UG,children:$G[e.type]}),e.phase!==void 0&&(0,Wl.jsxs)(X,{variant:"caption",children:["\xB7 Phase ",e.phase]}),(0,Wl.jsxs)(X,{variant:"caption",children:["\xB7 ",jG(e.timestamp)]})]})}function jG(e){return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}var zL=_(R(),1),FL=_e((0,zL.jsx)("path",{d:"M16 9v10H8V9zm-1.5-6h-5l-1 1H5v2h14V4h-3.5zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2z"}),"DeleteOutlined");var F1=_(I(),1);var vn=_(R(),1),WG={mt:-.5,mr:-.5,color:"text.secondary"};function HL({itemId:e,commentId:t,onDeleted:r}){let o=So(),[i,n]=(0,F1.useState)(!1),[s,a]=(0,F1.useState)(),l=()=>a(void 0);return(0,vn.jsxs)(vn.Fragment,{children:[i&&(0,vn.jsx)(Sb,{message:"Are you sure you want to delete this comment?",onConfirm:async()=>{n(!1);try{await HN(e,t,o),await r()}catch(c){a(c instanceof Error?c.message:"Failed to delete comment")}},onCancel:()=>n(!1)}),(0,vn.jsx)(Ru,{open:s!==void 0,autoHideDuration:6e3,onClose:l,children:(0,vn.jsx)(Qc,{severity:"error",variant:"filled",onClose:l,children:s})}),(0,vn.jsx)(ii,{"aria-label":"Delete comment",size:"small",sx:WG,onClick:()=>n(!0),children:(0,vn.jsx)(FL,{fontSize:"inherit"})})]})}var Vl=_(R(),1),VG={summary:{bgcolor:"warning.light",borderColor:"warning.dark"},comment:{bgcolor:"action.selected",borderColor:"divider"}},qG={justifyContent:"space-between",alignItems:"flex-start"},KG={color:"text.primary",whiteSpace:"pre-wrap"};function GG(e){return{p:1.5,bgcolor:e.bgcolor,borderColor:e.borderColor}}function UL({comment:e,itemId:t,onDeleted:r}){return(0,Vl.jsxs)(St,{variant:"outlined",sx:GG(VG[e.type]),children:[(0,Vl.jsxs)(Ae,{direction:"row",sx:qG,children:[(0,Vl.jsx)(IL,{comment:e}),e.id!==void 0&&t!==void 0&&r&&(0,Vl.jsx)(HL,{itemId:t,commentId:e.id,onDeleted:r})]}),(0,Vl.jsx)(X,{variant:"body2",sx:KG,children:e.text})]})}var Rp=_(R(),1),YG={color:"text.secondary",mb:1,display:"block",letterSpacing:"0.08em"};function $L({comments:e,itemId:t,onCommentDeleted:r}){return e.length===0?null:(0,Rp.jsxs)(de,{sx:{mb:2},children:[(0,Rp.jsx)(X,{variant:"overline",sx:YG,children:"Comments"}),(0,Rp.jsx)(Ae,{spacing:1,children:e.map((o,i)=>(0,Rp.jsx)(UL,{comment:o,itemId:t,onDeleted:r},`${o.timestamp}-${i}`))})]})}var xb=_(R(),1),jL={todo:{bg:"action.selected",text:"text.primary"},"in-progress":{bg:"warning.main",text:"warning.contrastText"},done:{bg:"success.main",text:"success.contrastText"},wontdo:{bg:"error.main",text:"error.contrastText"}},XG=["todo","in-progress","done","wontdo"];function WL({current:e,onStatusChange:t}){return t?(0,xb.jsx)(Cu,{value:e,onChange:r=>t(r.target.value),size:"small",sx:{fontSize:"0.75rem",fontWeight:500,borderRadius:4,bgcolor:jL[e].bg,color:jL[e].text,"& .MuiSelect-select":{py:.5,px:1.5},"& .MuiSelect-icon":{color:"inherit"}},children:XG.map(r=>(0,xb.jsx)(Un,{value:r,children:r},r))}):(0,xb.jsx)(ni,{label:e,size:"small",color:_b[e],sx:{fontWeight:500,fontSize:"0.75rem"}})}var Pp=_(R(),1),ZG={alignItems:"center",color:"text.disabled",fontSize:"0.875rem",mb:2},QG={fontWeight:500,fontSize:"0.75rem"};function VL({item:e,onStatusChange:t}){let r=bb[e.type];return(0,Pp.jsxs)(Ae,{direction:"row",spacing:1,sx:ZG,children:[(0,Pp.jsxs)(X,{variant:"body2",color:"text.disabled",children:["#",e.id]}),r&&(0,Pp.jsx)(ni,{label:e.type,size:"small",color:r,sx:QG}),(0,Pp.jsx)(WL,{current:e.status,onStatusChange:t})]})}var KL=_(R(),1),JG={lineHeight:1.7,"& p":{mt:0}};function qL({content:e}){return(0,KL.jsx)(de,{className:"markdown",sx:JG,dangerouslySetInnerHTML:{__html:ke.parse(e)}})}var ms=_(R(),1);function GL({checks:e}){return(0,ms.jsxs)(de,{sx:{mt:1,pt:1},children:[(0,ms.jsx)(du,{sx:{mb:1}}),(0,ms.jsx)(X,{variant:"overline",sx:{color:"text.disabled",letterSpacing:"0.08em"},children:"Manual Checks"}),(0,ms.jsx)(sn,{disablePadding:!0,sx:{ml:.5,mt:.5},children:e.map(t=>(0,ms.jsxs)(Us,{disableGutters:!0,disablePadding:!0,sx:{py:.25,display:"flex",alignItems:"baseline"},children:[(0,ms.jsx)(X,{component:"span",sx:{mr:1,fontSize:"0.875rem",color:"text.secondary"},children:"\u2610"}),(0,ms.jsx)(de,{component:"span",className:"markdown",sx:{fontSize:"0.875rem",color:"text.secondary"},dangerouslySetInnerHTML:{__html:ke.parseInline(t)}})]},t))})]})}var ZL=_(I(),1);var YL=_(I(),1),bn=_(R(),1);function XL({phaseName:e,onConfirm:t,onCancel:r}){let[o,i]=(0,YL.useState)("");return(0,bn.jsxs)(lu,{open:!0,onClose:r,maxWidth:"xs",fullWidth:!0,children:[(0,bn.jsxs)(pu,{children:["Rewind to ",e,"?"]}),(0,bn.jsxs)(uu,{children:[(0,bn.jsx)(X,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"This will mark all later phases as incomplete."}),(0,bn.jsx)(Zt,{fullWidth:!0,multiline:!0,rows:3,size:"small",placeholder:"Reason for rewinding...",value:o,onChange:n=>i(n.target.value)})]}),(0,bn.jsxs)(cu,{children:[(0,bn.jsx)(Re,{onClick:r,children:"Cancel"}),(0,bn.jsx)(Re,{variant:"contained",color:"warning",disabled:o.trim().length===0,onClick:()=>t(o.trim()),children:"Rewind"})]})]})}var ql=_(R(),1);function QL({itemId:e,phaseNumber:t,phaseName:r,onRewound:o}){let i=So(),[n,s]=(0,ZL.useState)(!1);return(0,ql.jsxs)(ql.Fragment,{children:[(0,ql.jsx)(Re,{size:"small",color:"warning",variant:"outlined",onClick:()=>s(!0),sx:{ml:"auto",textTransform:"none",fontSize:"0.75rem"},children:"Rewind"}),n&&(0,ql.jsx)(XL,{phaseName:r,onConfirm:async a=>{await jN(e,t,a,i),await o()},onCancel:()=>s(!1)})]})}var Ep=_(R(),1),eY={done:{label:"Done",color:"success"},current:{label:"In Progress",color:"info"},upcoming:{label:"Upcoming",color:"default"}},tY={alignItems:"center",mb:1},rY={fontWeight:500},oY={fontWeight:500,fontSize:"0.75rem"};function JL({phase:e,index:t,status:r,itemId:o,onRewind:i}){let n=eY[r],s=r==="done"&&o!==void 0&&i;return(0,Ep.jsxs)(Ae,{direction:"row",spacing:1,sx:tY,children:[(0,Ep.jsxs)(X,{sx:rY,children:["Phase ",t+1,": ",e.name]}),(0,Ep.jsx)(ni,{label:n.label,size:"small",color:n.color,sx:oY}),s&&(0,Ep.jsx)(QL,{itemId:o,phaseNumber:t+1,phaseName:e.name,onRewound:i})]})}var kp=_(R(),1);function e5({tasks:e,marker:t}){return(0,kp.jsx)(sn,{disablePadding:!0,sx:{ml:.5},children:e.map(r=>(0,kp.jsxs)(Us,{disableGutters:!0,disablePadding:!0,sx:{py:.25,display:"flex",alignItems:"baseline"},children:[(0,kp.jsx)(X,{component:"span",sx:{color:"text.secondary",mr:1},children:t}),(0,kp.jsx)(de,{component:"span",className:"markdown",dangerouslySetInnerHTML:{__html:ke.parseInline(r.task)}})]},r.task))})}var Op=_(R(),1),iY={done:{borderColor:"success.light",bgcolor:"success.light"},current:{borderColor:"info.main",bgcolor:"info.light",ring:"info.light"},upcoming:{borderColor:"divider",bgcolor:"background.paper"}};function nY(e){return{p:2,borderColor:e.borderColor,bgcolor:e.bgcolor,...e.ring?{boxShadow:"0 0 0 2px",borderColor:"info.main"}:{}}}var sY={done:"\u2713",current:"\u2022",upcoming:"\u2022"};function t5({phase:e,index:t,status:r,itemId:o,onRewind:i}){let n=e.manualChecks??[];return(0,Op.jsxs)(St,{variant:"outlined",sx:nY(iY[r]),children:[(0,Op.jsx)(JL,{phase:e,index:t,status:r,itemId:o,onRewind:i}),(0,Op.jsx)(e5,{tasks:e.tasks,marker:sY[r]}),n.length>0&&(0,Op.jsx)(GL,{checks:n})]})}var Mp=_(R(),1);function aY(e,t){if(t===void 0)return"upcoming";let r=e+1;return r<t?"done":r===t?"current":"upcoming"}function r5({phases:e,currentPhase:t,itemId:r,onRewind:o}){return e.length===0?null:(0,Mp.jsxs)(de,{sx:{mb:2},children:[(0,Mp.jsx)(X,{variant:"overline",sx:{color:"text.secondary",mb:1,display:"block",letterSpacing:"0.08em"},children:"Plan"}),(0,Mp.jsx)(Ae,{spacing:1.5,children:e.map((i,n)=>(0,Mp.jsx)(t5,{phase:i,index:n,status:aY(n,t),itemId:r,onRewind:o},i.name))})]})}var Wi=_(R(),1),lY={color:"text.secondary",mb:1,display:"block",letterSpacing:"0.08em"};function o5({item:e,onStatusChange:t,onRewind:r,onCommentDeleted:o}){return(0,Wi.jsxs)(St,{variant:"outlined",sx:{p:3},children:[(0,Wi.jsx)(X,{variant:"h5",component:"h2",children:e.name}),(0,Wi.jsx)(VL,{item:e,onStatusChange:t}),e.description&&(0,Wi.jsxs)(de,{sx:{mb:2},children:[(0,Wi.jsx)(X,{variant:"overline",sx:lY,children:"Description"}),(0,Wi.jsx)(qL,{content:e.description})]}),(0,Wi.jsx)(LL,{criteria:e.acceptanceCriteria}),e.plan&&(0,Wi.jsx)(r5,{phases:e.plan,currentPhase:e.currentPhase,itemId:e.id,onRewind:r}),e.comments&&(0,Wi.jsx)($L,{comments:e.comments,itemId:e.id,onCommentDeleted:o})]})}var _n=_(R(),1),cY={justifyContent:"space-between",alignItems:"center",mb:2};function uY({itemId:e,onDeleted:t}){let r=_o();return(0,_n.jsxs)(Ae,{direction:"row",sx:cY,children:[(0,_n.jsx)(sb,{to:"/backlog"}),(0,_n.jsxs)(Ae,{direction:"row",spacing:1,children:[(0,_n.jsx)(Re,{variant:"contained",color:"inherit",size:"small",onClick:()=>r(`/backlog/items/${e}/edit`),children:"Edit"}),(0,_n.jsx)(NL,{itemId:e,onDeleted:t})]})]})}function i5({item:e,onReload:t}){let r=_o(),o=So(),i=async()=>{await t(),r("/backlog")},n=async s=>{await $N(e.id,s,o),await t()};return(0,_n.jsxs)(de,{children:[(0,_n.jsx)(uY,{itemId:e.id,onDeleted:i}),(0,_n.jsx)(o5,{item:e,onStatusChange:n,onRewind:t,onCommentDeleted:t})]})}var H1=_(R(),1);function U1({items:e,mode:t,onReload:r}){let{id:o}=c1(),i=Number(o),n=e.find(s=>s.id===i);return n?t==="edit"?(0,H1.jsx)(gb,{item:n,onReload:r,backTo:`/backlog/items/${i}`}):(0,H1.jsx)(i5,{item:n,onReload:r}):null}var Vi=_(R(),1);function n5({items:e,loading:t,onReload:r}){return(0,Vi.jsxs)(Fl,{children:[(0,Vi.jsx)(Wo,{index:!0,element:(0,Vi.jsx)(AL,{items:e,loading:t})}),(0,Vi.jsx)(Wo,{path:"items/:id",element:(0,Vi.jsx)(U1,{items:e,mode:"detail",onReload:r})}),(0,Vi.jsx)(Wo,{path:"items/:id/edit",element:(0,Vi.jsx)(U1,{items:e,mode:"edit",onReload:r})}),(0,Vi.jsx)(Wo,{path:"add",element:(0,Vi.jsx)(gb,{onReload:r,backTo:"/backlog"})})]})}var ys=_(I(),1);function s5(){let e=So(),[t,r]=(0,ys.useState)([]),[o,i]=(0,ys.useState)(!0),[n,s]=(0,ys.useState)(!0),a=(0,ys.useCallback)(async()=>{r(await lb(void 0,e)),i(!1)},[e]);(0,ys.useEffect)(()=>{i(!0),s(!0),(async()=>{if(await LN(e)){await a();return}s(!1),r([]),i(!1)})()},[e,a]);let l=(0,ys.useCallback)(async()=>{await IN(e),s(!0),i(!0),await a()},[e,a]);return{items:t,loading:o,exists:n,reload:a,initialize:l}}var Th=_(R(),1);function a5(){let{items:e,loading:t,exists:r,reload:o,initialize:i}=s5();return r?(0,Th.jsx)(Fl,{children:(0,Th.jsx)(Wo,{path:"/*",element:(0,Th.jsx)(n5,{items:e,loading:t,onReload:o})})}):(0,Th.jsx)(BN,{onInit:i})}var fz=_(I(),1);var Db=_(I(),1);var $1={"assist-draft":{label:"\u25B6 /draft",args:["draft","--once"]},"assist-bug":{label:"\u25B6 /bug",args:["bug","--once"]},"assist-next":{label:"\u25B6 /next",args:["next","--once"]}};function pY(e){return e in $1}function dY(e){return[...$1[e].args]}function l5(e,t,r,o){if(pY(e)&&t){r(dY(e),t);return}o(e)}var c5=Object.entries($1).map(([e,{label:t}])=>({value:e,label:t})),u5="Enter prompt...";var Ch=_(R(),1),fY={textTransform:"none",fontSize:13,py:.25,px:1.25};function p5({onSelect:e}){return(0,Ch.jsx)(Ch.Fragment,{children:c5.map(t=>(0,Ch.jsx)(Re,{size:"small",variant:"outlined",onClick:()=>e(t.value),sx:fY,children:t.label},t.value))})}var f5=_(R(),1);function hY(e){return(e.params?.length??0)>0}function d5({config:e,active:t,onClick:r}){return(0,f5.jsxs)(Re,{size:"small",variant:t?"contained":"outlined",onClick:r,sx:{textTransform:"none",fontSize:13,py:.25,px:1.25},children:[!hY(e)&&"\u25B6 ",e.name]})}var Kl=_(R(),1);function h5({configs:e,selectedRun:t,onSelectRun:r,hiddenCount:o}){return(0,Kl.jsxs)(Kl.Fragment,{children:[e.map(i=>(0,Kl.jsx)(d5,{config:i,active:t===i.name,onClick:()=>r(i.name)},i.name)),o>0&&(0,Kl.jsxs)(X,{variant:"caption",color:"text.disabled",children:["+",o," more"]})]})}var wh=_(R(),1),mY=10;function m5({onSelectMode:e,runConfigs:t,totalRunCount:r,selectedRun:o,onSelectRun:i}){let n=t.slice(0,mY);return(0,wh.jsxs)(Ae,{direction:"row",spacing:.5,sx:{flexWrap:"wrap",alignItems:"center"},children:[(0,wh.jsx)(p5,{onSelect:a=>{i(null),e(a)}}),(0,wh.jsx)(h5,{configs:n,selectedRun:o,onSelectRun:i,hiddenCount:r-n.length})]})}var Rh=_(R(),1);function y5({prompt:e,setPrompt:t}){return(0,Rh.jsxs)(Ae,{direction:"row",spacing:1,children:[(0,Rh.jsx)(Zt,{value:e,onChange:r=>t(r.target.value),placeholder:u5,size:"small",fullWidth:!0,slotProps:{input:{sx:{fontSize:13}}}}),(0,Rh.jsx)(Re,{type:"submit",variant:"contained",size:"small",sx:{whiteSpace:"nowrap"},children:"Start"})]})}var Ph=_(R(),1);function yY(e){let t=e.description?` \u2014 ${e.description}`:"";return e.required?`${e.name} *${t}`:`${e.name}${t}`}function g5({config:e,values:t,onChange:r}){let o=e.params??[],i=(n,s)=>r({...t,[n]:s});return(0,Ph.jsxs)(Ae,{spacing:.75,children:[o.map(n=>(0,Ph.jsx)(Zt,{label:yY(n),value:t[n.name]??n.default??"",onChange:s=>i(n.name,s.target.value),placeholder:n.default??"",size:"small",fullWidth:!0,slotProps:{input:{sx:{fontSize:13}},inputLabel:{sx:{fontSize:11},shrink:!0}}},n.name)),(0,Ph.jsxs)(Re,{type:"submit",variant:"contained",size:"small",children:["Run ",e.name]})]})}var xa=_(R(),1);function v5({form:e,totalRunCount:t}){let r=e.selectedRun?e.filteredRunConfigs.find(o=>o.name===e.selectedRun):null;return(0,xa.jsxs)(xa.Fragment,{children:[(0,xa.jsx)(m5,{onSelectMode:e.handleSelectMode,runConfigs:e.filteredRunConfigs,totalRunCount:t,selectedRun:e.selectedRun,onSelectRun:e.handleSelectRun}),e.selectedRun&&r?(0,xa.jsx)(g5,{config:r,values:e.runParams,onChange:e.setRunParams}):(0,xa.jsx)(y5,{prompt:e.prompt,setPrompt:e.setPrompt})]})}var Gl=_(I(),1);function b5(e,t,r,o){return e&&!t.find(n=>n.name===e)?.params?.length?(o(e,[],r),null):e}function _5(e,t,r){r(e.trim(),t)}function S5(e,t){return(e?.params??[]).map(r=>t[r.name]?.trim()).filter(Boolean)}function x5(e){if(e.selectedRun){let t=e.configs.find(r=>r.name===e.selectedRun);return e.onCreateRun(e.selectedRun,S5(t,e.runParams),e.cwd),"run"}return _5(e.prompt,e.cwd,e.onCreate),"claude"}var Tb=_(I(),1);function T5(e,t){if(!t)return!0;let o=(t.includes("*")?t:`*${t}*`).replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${o}$`,"i").test(e)}function C5(e){let[t,r]=(0,Tb.useState)(""),o=(0,Tb.useMemo)(()=>e.filter(i=>T5(i.name,t)),[e,t]);return{runFilter:t,setRunFilter:r,filteredRunConfigs:o}}function w5(e){let{runConfigs:t,onCreateRun:r,onRequestRunConfigs:o}=e,{selectedCwd:i}=nb(),[n,s]=(0,Gl.useState)("free"),[a,l]=(0,Gl.useState)(""),[c,u]=(0,Gl.useState)(null),[p,f]=(0,Gl.useState)({}),d=C5(t);return(0,Gl.useEffect)(()=>{i&&o(i)},[i,o]),{selectedCwd:i,mode:n,prompt:a,setPrompt:l,selectedRun:c,runParams:p,setRunParams:f,...d,handleSelectRun(h){u(b5(h,t,i,r)),f({})},handleSelectMode(h){u(null),l5(h,i,e.onCreateAssist,s)},handleSubmit(h){if(h.preventDefault(),!i)return;x5({selectedRun:c,runParams:p,prompt:a,cwd:i,configs:t,onCreate:e.onCreate,onCreateRun:e.onCreateRun})==="run"?f({}):l("")}}}var Dp=_(R(),1);function R5(e){let{runConfigs:t}=e,r=w5(e),o=r.selectedCwd!=="";return(0,Dp.jsxs)(de,{component:"form",onSubmit:r.handleSubmit,sx:{p:1.5,borderTop:1,borderColor:"divider",display:"flex",flexDirection:"column",gap:1},children:[t.length>0&&(0,Dp.jsx)(Zt,{value:r.runFilter,onChange:i=>r.setRunFilter(i.target.value),placeholder:"Filter runs...",size:"small",fullWidth:!0,slotProps:{input:{sx:{fontSize:13}}}}),o?(0,Dp.jsx)(v5,{form:r,totalRunCount:t.length}):(0,Dp.jsx)(X,{variant:"caption",color:"text.disabled",sx:{py:.75},children:"Select a repo in the toolbar to create a session"})]})}var P5=_(R(),1),E5=_e((0,P5.jsx)("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close");var j1=_(R(),1);function k5({onDismiss:e}){return(0,j1.jsx)(ii,{size:"small",onClick:t=>{t.stopPropagation(),e()},title:"Dismiss",sx:{color:"text.disabled","&:hover":{color:"text.primary"}},children:(0,j1.jsx)(E5,{sx:{fontSize:16}})})}var O5=_(R(),1),M5=_e((0,O5.jsx)("path",{d:"M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8"}),"Replay");var W1=_(R(),1);function D5({onRetry:e}){return(0,W1.jsx)(ii,{size:"small",onClick:t=>{t.stopPropagation(),e()},title:"Retry",sx:{color:"text.disabled","&:hover":{color:"text.primary"}},children:(0,W1.jsx)(M5,{sx:{fontSize:14}})})}var Ap=_(R(),1);function Cb(e){return{display:"block",width:"100%",textAlign:"left",p:"10px 12px",mb:.5,borderRadius:1.5,bgcolor:e?"action.selected":"background.default",border:1,borderColor:e?"primary.main":"transparent",cursor:"pointer",transition:"background 0.15s","&:hover":e?void 0:{bgcolor:"action.hover"}}}function A5({name:e,isDone:t,onRetry:r,onDismiss:o}){return(0,Ap.jsxs)(de,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,Ap.jsx)(X,{variant:"body2",noWrap:!0,sx:{flex:1,color:"text.primary"},children:e}),t&&r&&(0,Ap.jsx)(D5,{onRetry:r}),t&&(0,Ap.jsx)(k5,{onDismiss:o})]})}var Yl=_(R(),1),gY={running:"success.main",waiting:"warning.main",done:"info.main"};function B5({status:e,elapsed:t,restored:r}){return(0,Yl.jsxs)(de,{sx:{display:"flex",justifyContent:"space-between",mt:.5},children:[(0,Yl.jsxs)(de,{sx:{display:"flex",gap:1},children:[(0,Yl.jsxs)(X,{variant:"caption",sx:{color:gY[e]},children:["\u25CF ",e]}),r!==void 0&&(0,Yl.jsx)(X,{variant:"caption",sx:{color:r?"success.main":"warning.main"},children:r?"restored":"not restored"})]}),(0,Yl.jsx)(X,{variant:"caption",color:"text.disabled",children:t})]})}var wb=_(I(),1);function N5(e){let[,t]=(0,wb.useState)(0);(0,wb.useEffect)(()=>{let n=setInterval(()=>t(s=>s+1),1e3);return()=>clearInterval(n)},[]);let r=Math.floor((Date.now()-e)/1e3),o=Math.floor(r/60),i=r%60;return o>=60?`${Math.floor(o/60)}h ${o%60}m`:o>0?`${o}m ${i}s`:`${i}s`}var Eh=_(R(),1);function L5({session:e,active:t,onClick:r,onRetry:o,onDismiss:i}){let n=N5(e.startedAt);return(0,Eh.jsxs)(Bt,{onClick:r,sx:Cb(t),children:[(0,Eh.jsx)(A5,{name:e.name,isDone:e.status==="done",onRetry:o,onDismiss:i}),(0,Eh.jsx)(B5,{status:e.status,elapsed:n,restored:e.restored})]})}var kh=_(R(),1);function I5({sessions:e,activeId:t,onSelect:r,onRetry:o,onDismiss:i}){return(0,kh.jsxs)(de,{sx:{flex:1,overflow:"auto",p:1},children:[e.map(n=>(0,kh.jsx)(L5,{session:n,active:n.id===t,onClick:()=>r(n.id),onRetry:(n.commandType==="run"||n.commandType==="assist")&&n.status==="done"?()=>o(n.id):void 0,onDismiss:()=>i(n.id)},n.id)),e.length===0&&(0,kh.jsx)(X,{variant:"caption",color:"text.disabled",sx:{display:"block",textAlign:"center",p:2},children:"No sessions yet"})]})}var Xl=_(R(),1);function z5({sessions:e,activeId:t,run:r,onSelect:o,onCreate:i,onCreateAssist:n,onRetry:s,onDismiss:a}){return(0,Xl.jsxs)(Xl.Fragment,{children:[(0,Xl.jsx)(I5,{sessions:e,activeId:t,onSelect:o,onRetry:s,onDismiss:a}),(0,Xl.jsx)(R5,{runConfigs:r.configs,onCreate:i,onCreateRun:r.create,onCreateAssist:n,onRequestRunConfigs:r.requestConfigs})]})}var Mb=_(I(),1);function F5(e){let t=Date.now()-new Date(e).getTime(),r=Math.floor(t/1e3);if(r<60)return"just now";let o=Math.floor(r/60);if(o<60)return`${o}m ago`;let i=Math.floor(o/60);if(i<24)return`${i}h ago`;let n=Math.floor(i/24);return n<30?`${n}d ago`:`${Math.floor(n/30)}mo ago`}var Zl=_(R(),1);function H5({session:e,onResume:t}){return(0,Zl.jsxs)(Bt,{onClick:()=>t(e),sx:Cb(!1),children:[(0,Zl.jsx)(X,{variant:"body2",noWrap:!0,sx:{color:"text.primary"},children:e.name}),(0,Zl.jsxs)(de,{sx:{display:"flex",justifyContent:"space-between",mt:.5},children:[(0,Zl.jsx)(X,{variant:"caption",color:"info.main",children:e.project}),(0,Zl.jsx)(X,{variant:"caption",color:"text.disabled",children:F5(e.timestamp)})]})]})}var Pb=_(I(),1);var U5=_(R(),1),$5=_e((0,U5.jsx)("path",{d:"m7 10 5 5 5-5z"}),"ArrowDropDown");var j5=_(R(),1),W5=_e((0,j5.jsx)("path",{d:"m7 14 5-5 5 5z"}),"ArrowDropUp");var Rb=_(R(),1);function V5({label:e,open:t,onClick:r}){return(0,Rb.jsx)(Re,{size:"small",variant:"outlined",onClick:r,endIcon:t?(0,Rb.jsx)(W5,{}):(0,Rb.jsx)($5,{}),sx:{textTransform:"none",fontSize:11,justifyContent:"space-between",maxWidth:"100%",overflow:"hidden"},fullWidth:!0,children:e})}var Ob=_(R(),1),Eb={position:"absolute",top:"100%",left:0,right:0,mt:.25,maxHeight:200,overflowY:"auto",zIndex:10};function kb({label:e,children:t}){let[r,o]=(0,Pb.useState)(!1),i=(0,Pb.useRef)(null);return(0,Ob.jsxs)(St,{component:"fieldset",ref:i,variant:"outlined",sx:{position:"relative",border:"none",m:0,p:0},onBlur:n=>{i.current?.contains(n.relatedTarget)||o(!1)},children:[(0,Ob.jsx)(V5,{label:e,open:r,onClick:()=>o(!r)}),r&&t(()=>o(!1))]})}var Bp=_(R(),1);function q5({items:e,selected:t,onToggle:r}){return(0,Bp.jsx)(fl,{dense:!0,sx:Eb,children:e.map(o=>(0,Bp.jsxs)(Un,{onClick:()=>r(o),dense:!0,children:[(0,Bp.jsx)(L0,{size:"small",checked:t.has(o),sx:{p:0,mr:1}}),(0,Bp.jsx)(J0,{primary:o,slotProps:{primary:{variant:"caption"}}})]},o))})}var V1=_(R(),1);function vY(e){return e.size===0?"All projects":e.size===1?[...e][0]:`${e.size} projects`}function K5({projects:e,selected:t,onChange:r}){let o=i=>{let n=new Set(t);n.has(i)?n.delete(i):n.add(i),r(n)};return(0,V1.jsx)(kb,{label:vY(t),children:()=>(0,V1.jsx)(q5,{items:e,selected:t,onToggle:o})})}function G5(e){let t=new Set;for(let r of e)t.add(r.project);return[...t].sort()}function Y5(e,t){return t.size===0?e:e.filter(r=>t.has(r.project))}var Sn=_(R(),1);function bY({hasAny:e}){return(0,Sn.jsx)(X,{variant:"caption",color:"text.disabled",sx:{display:"block",textAlign:"center",p:2},children:e?"No sessions match filter":"No session history"})}function _Y({sessions:e,onResume:t}){return(0,Sn.jsxs)(de,{sx:{flex:1,overflow:"auto",p:1},children:[e.map(r=>(0,Sn.jsx)(H5,{session:r,onResume:t},r.sessionId)),e.length===0&&(0,Sn.jsx)(bY,{hasAny:!1})]})}function X5({sessions:e,onResume:t}){let[r,o]=(0,Mb.useState)(new Set),i=(0,Mb.useMemo)(()=>G5(e),[e]),n=Y5(e,r);return(0,Sn.jsxs)(de,{sx:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:[i.length>1&&(0,Sn.jsx)(de,{sx:{px:1,pt:1},children:(0,Sn.jsx)(K5,{projects:i,selected:r,onChange:o})}),(0,Sn.jsx)(_Y,{sessions:n,onResume:t})]})}var Oh=_(R(),1),Z5={minHeight:36,py:0,fontSize:12};function Q5({tab:e,activeCount:t,historyCount:r,onChange:o}){return(0,Oh.jsxs)(hf,{value:e==="active"?0:1,onChange:(n,s)=>o(s===0?"active":"history"),variant:"fullWidth",sx:{borderBottom:1,borderColor:"divider",minHeight:36},children:[(0,Oh.jsx)(hl,{label:`Active ${t}`,sx:Z5}),(0,Oh.jsx)(hl,{label:`History ${r}`,sx:Z5})]})}var Np=_(R(),1),SY={width:280,minWidth:280,borderRight:1,borderColor:"divider",display:"flex",flexDirection:"column",bgcolor:"background.paper"};function J5(e){return(0,Np.jsxs)(de,{sx:SY,children:[(0,Np.jsx)(Q5,{tab:e.tab,activeCount:e.sessions.length,historyCount:e.history.length,onChange:e.onTabChange}),e.tab==="active"?(0,Np.jsx)(z5,{sessions:e.sessions,activeId:e.activeId,run:e.run,onSelect:e.onSelect,onCreate:e.onCreate,onCreateAssist:e.onCreateAssist,onRetry:e.onRetry,onDismiss:e.onDismiss}):(0,Np.jsx)(X5,{sessions:e.history,onResume:e.onResume})]})}var tI=_(R(),1);function eI({socket:e,tab:t,onTabChange:r}){let o=(0,Db.useCallback)(n=>{e.resumeSession(n.sessionId,n.cwd,n.name),r("active")},[e.resumeSession,r]),i=(0,Db.useMemo)(()=>({configs:e.runConfigs,create:e.createRunSession,requestConfigs:e.requestRunConfigs}),[e.runConfigs,e.createRunSession,e.requestRunConfigs]);return(0,tI.jsx)(J5,{sessions:e.sessions,history:e.history,run:i,activeId:e.activeId,tab:t,onTabChange:r,onSelect:e.setActiveId,onCreate:e.createSession,onCreateAssist:e.createAssistSession,onResume:o,onRetry:e.retrySession,onDismiss:e.dismissSession})}var cz=_(I(),1);var em=_(I(),1);var xY=2,TY=1,rI=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,r=window.getComputedStyle(this._terminal.element.parentElement),o=parseInt(r.getPropertyValue("height")),i=Math.max(0,parseInt(r.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),s={top:parseInt(n.getPropertyValue("padding-top")),bottom:parseInt(n.getPropertyValue("padding-bottom")),right:parseInt(n.getPropertyValue("padding-right")),left:parseInt(n.getPropertyValue("padding-left"))},a=s.top+s.bottom,l=s.right+s.left,c=o-a,u=i-l-t;return{cols:Math.max(xY,Math.floor(u/e.css.cell.width)),rows:Math.max(TY,Math.floor(c/e.css.cell.height))}}};var s3=Object.defineProperty,CY=Object.getOwnPropertyDescriptor,wY=(e,t)=>{for(var r in t)s3(e,r,{get:t[r],enumerable:!0})},jt=(e,t,r,o)=>{for(var i=o>1?void 0:o?CY(t,r):t,n=e.length-1,s;n>=0;n--)(s=e[n])&&(i=(o?s(t,r,i):s(i))||i);return o&&i&&s3(t,r,i),i},te=(e,t)=>(r,o)=>t(r,o,e),oI="Terminal input",lC={get:()=>oI,set:e=>oI=e},iI="Too much output to announce, navigate to rows manually to read",cC={get:()=>iI,set:e=>iI=e};function RY(e){return e.replace(/\r?\n/g,"\r")}function PY(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function EY(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function kY(e,t,r,o){if(e.stopPropagation(),e.clipboardData){let i=e.clipboardData.getData("text/plain");a3(i,t,r,o)}}function a3(e,t,r,o){e=RY(e),e=PY(e,r.decPrivateModes.bracketedPasteMode&&o.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(e,!0),t.value=""}function l3(e,t,r){let o=r.getBoundingClientRect(),i=e.clientX-o.left-10,n=e.clientY-o.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${i}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}function nI(e,t,r,o,i){l3(e,t,r),i&&o.rightClickSelect(e),t.value=o.selectionText,t.select()}function Pa(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function o_(e,t=0,r=e.length){let o="";for(let i=t;i<r;++i){let n=e[i];n>65535?(n-=65536,o+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):o+=String.fromCharCode(n)}return o}var OY=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let r=e.length;if(!r)return 0;let o=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[o++]=(this._interim-55296)*1024+n-56320+65536:(t[o++]=this._interim,t[o++]=n),this._interim=0}for(let n=i;n<r;++n){let s=e.charCodeAt(n);if(55296<=s&&s<=56319){if(++n>=r)return this._interim=s,o;let a=e.charCodeAt(n);56320<=a&&a<=57343?t[o++]=(s-55296)*1024+a-56320+65536:(t[o++]=s,t[o++]=a);continue}s!==65279&&(t[o++]=s)}return o}},MY=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let r=e.length;if(!r)return 0;let o=0,i,n,s,a,l=0,c=0;if(this.interim[0]){let f=!1,d=this.interim[0];d&=(d&224)===192?31:(d&240)===224?15:7;let h=0,y;for(;(y=this.interim[++h]&63)&&h<4;)d<<=6,d|=y;let b=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,m=b-h;for(;c<m;){if(c>=r)return 0;if(y=e[c++],(y&192)!==128){c--,f=!0;break}else this.interim[h++]=y,d<<=6,d|=y&63}f||(b===2?d<128?c--:t[o++]=d:b===3?d<2048||d>=55296&&d<=57343||d===65279||(t[o++]=d):d<65536||d>1114111||(t[o++]=d)),this.interim.fill(0)}let u=r-4,p=c;for(;p<r;){for(;p<u&&!((i=e[p])&128)&&!((n=e[p+1])&128)&&!((s=e[p+2])&128)&&!((a=e[p+3])&128);)t[o++]=i,t[o++]=n,t[o++]=s,t[o++]=a,p+=4;if(i=e[p++],i<128)t[o++]=i;else if((i&224)===192){if(p>=r)return this.interim[0]=i,o;if(n=e[p++],(n&192)!==128){p--;continue}if(l=(i&31)<<6|n&63,l<128){p--;continue}t[o++]=l}else if((i&240)===224){if(p>=r)return this.interim[0]=i,o;if(n=e[p++],(n&192)!==128){p--;continue}if(p>=r)return this.interim[0]=i,this.interim[1]=n,o;if(s=e[p++],(s&192)!==128){p--;continue}if(l=(i&15)<<12|(n&63)<<6|s&63,l<2048||l>=55296&&l<=57343||l===65279)continue;t[o++]=l}else if((i&248)===240){if(p>=r)return this.interim[0]=i,o;if(n=e[p++],(n&192)!==128){p--;continue}if(p>=r)return this.interim[0]=i,this.interim[1]=n,o;if(s=e[p++],(s&192)!==128){p--;continue}if(p>=r)return this.interim[0]=i,this.interim[1]=n,this.interim[2]=s,o;if(a=e[p++],(a&192)!==128){p--;continue}if(l=(i&7)<<18|(n&63)<<12|(s&63)<<6|a&63,l<65536||l>1114111)continue;t[o++]=l}}return o}},c3="",Ea=" ",Xh=class u3{constructor(){this.fg=0,this.bg=0,this.extended=new Gb}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new u3;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Gb=class p3{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new p3(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ti=class d3 extends Xh{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Gb,this.combinedData=""}static fromCharData(t){let r=new d3;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Pa(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let o=t[1].charCodeAt(0);if(55296<=o&&o<=56319){let i=t[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(o-55296)*1024+i-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},sI="di$target",uC="di$dependencies",q1=new Map;function DY(e){return e[uC]||[]}function Sr(e){if(q1.has(e))return q1.get(e);let t=function(r,o,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");AY(t,r,i)};return t._id=e,q1.set(e,t),t}function AY(e,t,r){t[sI]===t?t[uC].push({id:e,index:r}):(t[uC]=[{id:e,index:r}],t[sI]=t)}var io=Sr("BufferService"),f3=Sr("CoreMouseService"),nc=Sr("CoreService"),BY=Sr("CharsetService"),qC=Sr("InstantiationService"),h3=Sr("LogService"),no=Sr("OptionsService"),m3=Sr("OscLinkService"),NY=Sr("UnicodeService"),Zh=Sr("DecorationService"),pC=class{constructor(e,t,r){this._bufferService=e,this._optionsService=t,this._oscLinkService=r}provideLinks(e,t){let r=this._bufferService.buffer.lines.get(e-1);if(!r){t(void 0);return}let o=[],i=this._optionsService.rawOptions.linkHandler,n=new Ti,s=r.getTrimmedLength(),a=-1,l=-1,c=!1;for(let u=0;u<s;u++)if(!(l===-1&&!r.hasContent(u))){if(r.loadCell(u,n),n.hasExtendedAttrs()&&n.extended.urlId)if(l===-1){l=u,a=n.extended.urlId;continue}else c=n.extended.urlId!==a;else l!==-1&&(c=!0);if(c||l!==-1&&u===s-1){let p=this._oscLinkService.getLinkData(a)?.uri;if(p){let f={start:{x:l+1,y:e},end:{x:u+(!c&&u===s-1?1:0),y:e}},d=!1;if(!i?.allowNonHttpProtocols)try{let h=new URL(p);["http:","https:"].includes(h.protocol)||(d=!0)}catch{d=!0}d||o.push({text:p,range:f,activate:(h,y)=>i?i.activate(h,y,f):LY(h,y),hover:(h,y)=>i?.hover?.(h,y,f),leave:(h,y)=>i?.leave?.(h,y,f)})}c=!1,n.hasExtendedAttrs()&&n.extended.urlId?(l=u,a=n.extended.urlId):(l=-1,a=-1)}}t(o)}};pC=jt([te(0,io),te(1,no),te(2,m3)],pC);function LY(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
204
204
|
|
|
205
205
|
WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var i_=Sr("CharSizeService"),Ss=Sr("CoreBrowserService"),KC=Sr("MouseService"),xs=Sr("RenderService"),IY=Sr("SelectionService"),y3=Sr("CharacterJoinerService"),Fp=Sr("ThemeService"),g3=Sr("LinkProviderService"),zY=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?aI.isErrorNoTelemetry(e)?new aI(e.message+`
|
|
206
206
|
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.245.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -3632,15 +3632,15 @@ Phase ${phaseNumber} completed.`));
|
|
|
3632
3632
|
|
|
3633
3633
|
// src/commands/backlog/watchForMarker.ts
|
|
3634
3634
|
import { existsSync as existsSync20, unwatchFile, watchFile } from "fs";
|
|
3635
|
-
function watchForMarker(child) {
|
|
3635
|
+
function watchForMarker(child, options2) {
|
|
3636
3636
|
const statusPath = getSignalPath();
|
|
3637
3637
|
watchFile(statusPath, { interval: 1e3 }, () => {
|
|
3638
3638
|
if (!existsSync20(statusPath)) return;
|
|
3639
3639
|
const signal = readSignal();
|
|
3640
|
-
if (signal)
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3640
|
+
if (!signal) return;
|
|
3641
|
+
if (signal.event === "done" && !options2?.actOnDone) return;
|
|
3642
|
+
unwatchFile(statusPath);
|
|
3643
|
+
child.kill("SIGTERM");
|
|
3644
3644
|
});
|
|
3645
3645
|
}
|
|
3646
3646
|
function stopWatching() {
|
|
@@ -3809,7 +3809,7 @@ async function next(options2, startId) {
|
|
|
3809
3809
|
firstPick = false;
|
|
3810
3810
|
if (id === void 0) return;
|
|
3811
3811
|
const completed = await run2(id, options2);
|
|
3812
|
-
if (!completed) return;
|
|
3812
|
+
if (!completed || options2?.once) return;
|
|
3813
3813
|
}
|
|
3814
3814
|
}
|
|
3815
3815
|
|
|
@@ -4584,117 +4584,27 @@ async function web2(options2) {
|
|
|
4584
4584
|
await web({ port: options2.port, initialPath: "/backlog" });
|
|
4585
4585
|
}
|
|
4586
4586
|
|
|
4587
|
-
// src/commands/backlog/refine.ts
|
|
4588
|
-
import chalk47 from "chalk";
|
|
4589
|
-
import enquirer6 from "enquirer";
|
|
4590
|
-
|
|
4591
|
-
// src/commands/backlog/launchMode.ts
|
|
4592
|
-
import chalk46 from "chalk";
|
|
4593
|
-
|
|
4594
|
-
// src/commands/backlog/tryRunById.ts
|
|
4595
|
-
import chalk45 from "chalk";
|
|
4596
|
-
async function tryRunById(id, options2) {
|
|
4597
|
-
const items2 = await loadBacklog();
|
|
4598
|
-
const numericId = Number.parseInt(id, 10);
|
|
4599
|
-
const item = Number.isNaN(numericId) ? void 0 : items2.find((i) => i.id === numericId);
|
|
4600
|
-
if (!item) {
|
|
4601
|
-
console.log(chalk45.red(`Item #${id} not found.`));
|
|
4602
|
-
return false;
|
|
4603
|
-
}
|
|
4604
|
-
if (item.status === "done") {
|
|
4605
|
-
console.log(chalk45.red(`Item #${id} is already done.`));
|
|
4606
|
-
return false;
|
|
4607
|
-
}
|
|
4608
|
-
if (item.status === "wontdo") {
|
|
4609
|
-
console.log(chalk45.red(`Item #${id} is marked won't do.`));
|
|
4610
|
-
return false;
|
|
4611
|
-
}
|
|
4612
|
-
if (isBlocked(item, items2)) {
|
|
4613
|
-
console.log(
|
|
4614
|
-
chalk45.red(`Item #${id} is blocked by unresolved dependencies.`)
|
|
4615
|
-
);
|
|
4616
|
-
return false;
|
|
4617
|
-
}
|
|
4618
|
-
console.log(chalk45.bold(`
|
|
4619
|
-
Running backlog item #${id}...
|
|
4620
|
-
`));
|
|
4621
|
-
await run2(id, options2);
|
|
4622
|
-
return true;
|
|
4623
|
-
}
|
|
4624
|
-
|
|
4625
|
-
// src/commands/backlog/launchMode.ts
|
|
4626
|
-
async function launchMode(slashCommand) {
|
|
4627
|
-
pullIfConfigured();
|
|
4628
|
-
process.env.ASSIST_SESSION_ID = String(process.pid);
|
|
4629
|
-
const { child, done: done2 } = spawnClaude(`/${slashCommand}`, { allowEdits: true });
|
|
4630
|
-
watchForMarker(child);
|
|
4631
|
-
await done2;
|
|
4632
|
-
stopWatching();
|
|
4633
|
-
const signal = readSignal();
|
|
4634
|
-
cleanupSignal();
|
|
4635
|
-
if (signal?.event === "next") {
|
|
4636
|
-
if (typeof signal.id === "string" && signal.id) {
|
|
4637
|
-
if (await tryRunById(signal.id, { allowEdits: true })) return;
|
|
4638
|
-
}
|
|
4639
|
-
console.log(chalk46.bold("\nChaining into assist next...\n"));
|
|
4640
|
-
await next({ allowEdits: true });
|
|
4641
|
-
}
|
|
4642
|
-
}
|
|
4643
|
-
|
|
4644
|
-
// src/commands/backlog/refine.ts
|
|
4645
|
-
async function pickItemForRefine() {
|
|
4646
|
-
const items2 = await loadBacklog();
|
|
4647
|
-
const active = items2.filter(
|
|
4648
|
-
(i) => i.status === "todo" || i.status === "in-progress"
|
|
4649
|
-
);
|
|
4650
|
-
if (active.length === 0) {
|
|
4651
|
-
console.log(chalk47.yellow("No active backlog items to refine."));
|
|
4652
|
-
return void 0;
|
|
4653
|
-
}
|
|
4654
|
-
if (active.length === 1) {
|
|
4655
|
-
const item = active[0];
|
|
4656
|
-
console.log(chalk47.bold(`Auto-selecting item #${item.id}: ${item.name}`));
|
|
4657
|
-
return String(item.id);
|
|
4658
|
-
}
|
|
4659
|
-
const { selected } = await exitOnCancel(
|
|
4660
|
-
enquirer6.prompt({
|
|
4661
|
-
type: "select",
|
|
4662
|
-
name: "selected",
|
|
4663
|
-
message: "Choose a backlog item to refine:",
|
|
4664
|
-
choices: active.map((item) => ({
|
|
4665
|
-
name: `${typeLabel(item.type)} #${item.id}: ${item.name}`
|
|
4666
|
-
}))
|
|
4667
|
-
})
|
|
4668
|
-
);
|
|
4669
|
-
return selected.match(/#(\d+)/)?.[1] ?? "";
|
|
4670
|
-
}
|
|
4671
|
-
async function refine(id) {
|
|
4672
|
-
const itemId = id ?? await pickItemForRefine();
|
|
4673
|
-
if (!itemId) return;
|
|
4674
|
-
await launchMode(`refine ${itemId}`);
|
|
4675
|
-
}
|
|
4676
|
-
|
|
4677
4587
|
// src/commands/backlog/comment/index.ts
|
|
4678
|
-
import
|
|
4588
|
+
import chalk45 from "chalk";
|
|
4679
4589
|
async function comment(id, text2) {
|
|
4680
4590
|
const found = await findOneItem(id);
|
|
4681
4591
|
if (!found) process.exit(1);
|
|
4682
4592
|
await appendComment(found.orm, found.item.id, text2);
|
|
4683
|
-
console.log(
|
|
4593
|
+
console.log(chalk45.green(`Comment added to item #${id}.`));
|
|
4684
4594
|
}
|
|
4685
4595
|
|
|
4686
4596
|
// src/commands/backlog/comments/index.ts
|
|
4687
|
-
import
|
|
4597
|
+
import chalk46 from "chalk";
|
|
4688
4598
|
async function comments2(id) {
|
|
4689
4599
|
const found = await findOneItem(id);
|
|
4690
4600
|
if (!found) process.exit(1);
|
|
4691
4601
|
const { item } = found;
|
|
4692
4602
|
const entries = item.comments ?? [];
|
|
4693
4603
|
if (entries.length === 0) {
|
|
4694
|
-
console.log(
|
|
4604
|
+
console.log(chalk46.dim(`No comments on item #${id}.`));
|
|
4695
4605
|
return;
|
|
4696
4606
|
}
|
|
4697
|
-
console.log(
|
|
4607
|
+
console.log(chalk46.bold(`Comments for #${id}: ${item.name}
|
|
4698
4608
|
`));
|
|
4699
4609
|
for (const entry of entries) {
|
|
4700
4610
|
console.log(`${formatComment(entry)}
|
|
@@ -4703,7 +4613,7 @@ async function comments2(id) {
|
|
|
4703
4613
|
}
|
|
4704
4614
|
|
|
4705
4615
|
// src/commands/backlog/delete-comment/index.ts
|
|
4706
|
-
import
|
|
4616
|
+
import chalk47 from "chalk";
|
|
4707
4617
|
async function deleteCommentCmd(id, commentId) {
|
|
4708
4618
|
const found = await findOneItem(id);
|
|
4709
4619
|
if (!found) process.exit(1);
|
|
@@ -4715,16 +4625,16 @@ async function deleteCommentCmd(id, commentId) {
|
|
|
4715
4625
|
switch (outcome) {
|
|
4716
4626
|
case "deleted":
|
|
4717
4627
|
console.log(
|
|
4718
|
-
|
|
4628
|
+
chalk47.green(`Comment #${commentId} deleted from item #${id}.`)
|
|
4719
4629
|
);
|
|
4720
4630
|
break;
|
|
4721
4631
|
case "not-found":
|
|
4722
|
-
console.log(
|
|
4632
|
+
console.log(chalk47.red(`Comment #${commentId} not found on item #${id}.`));
|
|
4723
4633
|
process.exit(1);
|
|
4724
4634
|
break;
|
|
4725
4635
|
case "is-summary":
|
|
4726
4636
|
console.log(
|
|
4727
|
-
|
|
4637
|
+
chalk47.red(
|
|
4728
4638
|
`Comment #${commentId} is a phase summary and cannot be deleted.`
|
|
4729
4639
|
)
|
|
4730
4640
|
);
|
|
@@ -4742,7 +4652,7 @@ function registerCommentCommands(cmd) {
|
|
|
4742
4652
|
|
|
4743
4653
|
// src/commands/backlog/export/index.ts
|
|
4744
4654
|
import { writeFile } from "fs/promises";
|
|
4745
|
-
import
|
|
4655
|
+
import chalk48 from "chalk";
|
|
4746
4656
|
|
|
4747
4657
|
// src/commands/backlog/dump/DumpTable.ts
|
|
4748
4658
|
var DUMP_FORMAT = "assist-backlog-dump";
|
|
@@ -4809,7 +4719,7 @@ async function exportBacklog(file) {
|
|
|
4809
4719
|
if (file) {
|
|
4810
4720
|
await writeFile(file, dump);
|
|
4811
4721
|
console.error(
|
|
4812
|
-
|
|
4722
|
+
chalk48.green(`Exported backlog to ${file} (${dump.length} bytes).`)
|
|
4813
4723
|
);
|
|
4814
4724
|
return;
|
|
4815
4725
|
}
|
|
@@ -4825,7 +4735,7 @@ function registerExportCommand(cmd) {
|
|
|
4825
4735
|
|
|
4826
4736
|
// src/commands/backlog/import/index.ts
|
|
4827
4737
|
import { readFile } from "fs/promises";
|
|
4828
|
-
import
|
|
4738
|
+
import chalk50 from "chalk";
|
|
4829
4739
|
|
|
4830
4740
|
// src/commands/backlog/dump/countCopyRows.ts
|
|
4831
4741
|
function countCopyRows(data) {
|
|
@@ -4902,7 +4812,7 @@ function validateDump({ header, sections }) {
|
|
|
4902
4812
|
}
|
|
4903
4813
|
|
|
4904
4814
|
// src/commands/backlog/import/confirmReplace.ts
|
|
4905
|
-
import
|
|
4815
|
+
import chalk49 from "chalk";
|
|
4906
4816
|
async function countRows(client, table) {
|
|
4907
4817
|
const { rows } = await client.query(
|
|
4908
4818
|
`SELECT count(*)::int AS n FROM ${table}`
|
|
@@ -4913,7 +4823,7 @@ function printSummary(current, incoming) {
|
|
|
4913
4823
|
const lines = DUMP_TABLES.map(
|
|
4914
4824
|
(t, i) => ` ${t.name}: ${current[i]} \u2192 ${incoming[i]} rows`
|
|
4915
4825
|
);
|
|
4916
|
-
console.error(
|
|
4826
|
+
console.error(chalk49.bold("\nThis will REPLACE all backlog data:"));
|
|
4917
4827
|
console.error(`${lines.join("\n")}
|
|
4918
4828
|
`);
|
|
4919
4829
|
}
|
|
@@ -4989,13 +4899,13 @@ async function importBacklog(file, options2 = {}) {
|
|
|
4989
4899
|
);
|
|
4990
4900
|
await withBacklogClient(async (client) => {
|
|
4991
4901
|
if (!options2.yes && !await confirmReplace(client, incoming, !file)) {
|
|
4992
|
-
console.error(
|
|
4902
|
+
console.error(chalk50.yellow("Import cancelled; no changes made."));
|
|
4993
4903
|
return;
|
|
4994
4904
|
}
|
|
4995
4905
|
await restore(client, parsed);
|
|
4996
4906
|
const total = incoming.reduce((sum, n) => sum + n, 0);
|
|
4997
4907
|
console.error(
|
|
4998
|
-
|
|
4908
|
+
chalk50.green(
|
|
4999
4909
|
`Imported backlog: ${total} rows restored across ${DUMP_TABLES.length} tables.`
|
|
5000
4910
|
)
|
|
5001
4911
|
);
|
|
@@ -5012,16 +4922,16 @@ function registerImportCommand(cmd) {
|
|
|
5012
4922
|
}
|
|
5013
4923
|
|
|
5014
4924
|
// src/commands/backlog/add/index.ts
|
|
5015
|
-
import
|
|
4925
|
+
import chalk51 from "chalk";
|
|
5016
4926
|
|
|
5017
4927
|
// src/commands/backlog/add/shared.ts
|
|
5018
4928
|
import { spawnSync } from "child_process";
|
|
5019
4929
|
import { mkdtempSync, readFileSync as readFileSync14, unlinkSync as unlinkSync4, writeFileSync as writeFileSync13 } from "fs";
|
|
5020
4930
|
import { tmpdir } from "os";
|
|
5021
4931
|
import { join as join17 } from "path";
|
|
5022
|
-
import
|
|
4932
|
+
import enquirer6 from "enquirer";
|
|
5023
4933
|
async function promptType() {
|
|
5024
|
-
const { type } = await
|
|
4934
|
+
const { type } = await enquirer6.prompt({
|
|
5025
4935
|
type: "select",
|
|
5026
4936
|
name: "type",
|
|
5027
4937
|
message: "Type:",
|
|
@@ -5031,7 +4941,7 @@ async function promptType() {
|
|
|
5031
4941
|
return type;
|
|
5032
4942
|
}
|
|
5033
4943
|
async function promptName() {
|
|
5034
|
-
const { name } = await
|
|
4944
|
+
const { name } = await enquirer6.prompt({
|
|
5035
4945
|
type: "input",
|
|
5036
4946
|
name: "name",
|
|
5037
4947
|
message: "Name:",
|
|
@@ -5040,14 +4950,14 @@ async function promptName() {
|
|
|
5040
4950
|
return name.trim();
|
|
5041
4951
|
}
|
|
5042
4952
|
async function promptDescription() {
|
|
5043
|
-
const { useEditor } = await
|
|
4953
|
+
const { useEditor } = await enquirer6.prompt({
|
|
5044
4954
|
type: "confirm",
|
|
5045
4955
|
name: "useEditor",
|
|
5046
4956
|
message: "Open editor for description?",
|
|
5047
4957
|
initial: false
|
|
5048
4958
|
});
|
|
5049
4959
|
if (!useEditor) {
|
|
5050
|
-
const { description } = await
|
|
4960
|
+
const { description } = await enquirer6.prompt({
|
|
5051
4961
|
type: "input",
|
|
5052
4962
|
name: "description",
|
|
5053
4963
|
message: "Description (optional):"
|
|
@@ -5073,7 +4983,7 @@ function openEditor() {
|
|
|
5073
4983
|
async function promptAcceptanceCriteria() {
|
|
5074
4984
|
const criteria = [];
|
|
5075
4985
|
for (; ; ) {
|
|
5076
|
-
const { criterion } = await
|
|
4986
|
+
const { criterion } = await enquirer6.prompt({
|
|
5077
4987
|
type: "input",
|
|
5078
4988
|
name: "criterion",
|
|
5079
4989
|
message: "Acceptance criterion (empty to finish):"
|
|
@@ -5102,11 +5012,11 @@ async function add(options2) {
|
|
|
5102
5012
|
},
|
|
5103
5013
|
getOrigin()
|
|
5104
5014
|
);
|
|
5105
|
-
console.log(
|
|
5015
|
+
console.log(chalk51.green(`Added item #${id}: ${name}`));
|
|
5106
5016
|
}
|
|
5107
5017
|
|
|
5108
5018
|
// src/commands/backlog/addPhase.ts
|
|
5109
|
-
import
|
|
5019
|
+
import chalk53 from "chalk";
|
|
5110
5020
|
|
|
5111
5021
|
// src/commands/backlog/insertPhaseAt.ts
|
|
5112
5022
|
import { count, eq as eq14 } from "drizzle-orm";
|
|
@@ -5139,7 +5049,7 @@ async function insertPhaseAt(orm, itemId, phaseIdx, name, tasks, manualChecks, c
|
|
|
5139
5049
|
}
|
|
5140
5050
|
|
|
5141
5051
|
// src/commands/backlog/resolveInsertPosition.ts
|
|
5142
|
-
import
|
|
5052
|
+
import chalk52 from "chalk";
|
|
5143
5053
|
import { count as count2, eq as eq15 } from "drizzle-orm";
|
|
5144
5054
|
async function resolveInsertPosition(orm, itemId, position) {
|
|
5145
5055
|
const [row] = await orm.select({ cnt: count2() }).from(planPhases).where(eq15(planPhases.itemId, itemId));
|
|
@@ -5148,7 +5058,7 @@ async function resolveInsertPosition(orm, itemId, position) {
|
|
|
5148
5058
|
const pos = Number.parseInt(position, 10);
|
|
5149
5059
|
if (pos < 1 || pos > phaseCount + 1) {
|
|
5150
5060
|
console.log(
|
|
5151
|
-
|
|
5061
|
+
chalk52.red(
|
|
5152
5062
|
`Position ${pos} is out of range. Must be between 1 and ${phaseCount + 1}.`
|
|
5153
5063
|
)
|
|
5154
5064
|
);
|
|
@@ -5169,7 +5079,7 @@ async function addPhase(id, name, options2) {
|
|
|
5169
5079
|
if (!found) return;
|
|
5170
5080
|
const tasks = options2.task ?? [];
|
|
5171
5081
|
if (tasks.length === 0) {
|
|
5172
|
-
console.log(
|
|
5082
|
+
console.log(chalk53.red("At least one --task is required."));
|
|
5173
5083
|
process.exitCode = 1;
|
|
5174
5084
|
return;
|
|
5175
5085
|
}
|
|
@@ -5188,14 +5098,14 @@ async function addPhase(id, name, options2) {
|
|
|
5188
5098
|
);
|
|
5189
5099
|
const verb = options2.position !== void 0 ? "Inserted" : "Added";
|
|
5190
5100
|
console.log(
|
|
5191
|
-
|
|
5101
|
+
chalk53.green(
|
|
5192
5102
|
`${verb} phase ${phaseIdx + 1} "${name}" to item #${itemId} with ${tasks.length} task(s).`
|
|
5193
5103
|
)
|
|
5194
5104
|
);
|
|
5195
5105
|
}
|
|
5196
5106
|
|
|
5197
5107
|
// src/commands/backlog/list/index.ts
|
|
5198
|
-
import
|
|
5108
|
+
import chalk54 from "chalk";
|
|
5199
5109
|
|
|
5200
5110
|
// src/commands/backlog/originDisplayName.ts
|
|
5201
5111
|
function originDisplayName(origin) {
|
|
@@ -5247,7 +5157,7 @@ async function list2(options2) {
|
|
|
5247
5157
|
const allItems = await loadBacklog(options2.allRepos);
|
|
5248
5158
|
const items2 = filterItems(allItems, options2);
|
|
5249
5159
|
if (items2.length === 0) {
|
|
5250
|
-
console.log(
|
|
5160
|
+
console.log(chalk54.dim("Backlog is empty."));
|
|
5251
5161
|
return;
|
|
5252
5162
|
}
|
|
5253
5163
|
const labels = originDisplayLabels(
|
|
@@ -5256,9 +5166,9 @@ async function list2(options2) {
|
|
|
5256
5166
|
const repoNameOf = (item) => item.origin ? labels.get(item.origin) ?? "" : "";
|
|
5257
5167
|
const prefixWidth = options2.allRepos ? Math.max(0, ...items2.map((i) => repoNameOf(i).length)) : 0;
|
|
5258
5168
|
for (const item of items2) {
|
|
5259
|
-
const repoPrefix2 = options2.allRepos ? `${
|
|
5169
|
+
const repoPrefix2 = options2.allRepos ? `${chalk54.dim(repoNameOf(item).padEnd(prefixWidth))} ` : "";
|
|
5260
5170
|
console.log(
|
|
5261
|
-
`${repoPrefix2}${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
5171
|
+
`${repoPrefix2}${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk54.dim(`#${item.id}`)} ${item.name}${phaseLabel(item)}${dependencyLabel(item, allItems)}`
|
|
5262
5172
|
);
|
|
5263
5173
|
if (options2.verbose) {
|
|
5264
5174
|
printVerboseDetails(item);
|
|
@@ -5284,7 +5194,7 @@ function registerItemCommands(cmd) {
|
|
|
5284
5194
|
}
|
|
5285
5195
|
|
|
5286
5196
|
// src/commands/backlog/link.ts
|
|
5287
|
-
import
|
|
5197
|
+
import chalk56 from "chalk";
|
|
5288
5198
|
|
|
5289
5199
|
// src/commands/backlog/hasCycle.ts
|
|
5290
5200
|
function hasCycle(adjacency, fromId, toId) {
|
|
@@ -5316,14 +5226,14 @@ async function loadDependencyGraph(orm) {
|
|
|
5316
5226
|
}
|
|
5317
5227
|
|
|
5318
5228
|
// src/commands/backlog/validateLinkTarget.ts
|
|
5319
|
-
import
|
|
5229
|
+
import chalk55 from "chalk";
|
|
5320
5230
|
function validateLinkTarget(fromItem, fromNum, toNum, linkType) {
|
|
5321
5231
|
const duplicate = (fromItem.links ?? []).some(
|
|
5322
5232
|
(l) => l.targetId === toNum && l.type === linkType
|
|
5323
5233
|
);
|
|
5324
5234
|
if (duplicate) {
|
|
5325
5235
|
console.log(
|
|
5326
|
-
|
|
5236
|
+
chalk55.yellow(`Link already exists: #${fromNum} ${linkType} #${toNum}`)
|
|
5327
5237
|
);
|
|
5328
5238
|
return false;
|
|
5329
5239
|
}
|
|
@@ -5332,7 +5242,7 @@ function validateLinkTarget(fromItem, fromNum, toNum, linkType) {
|
|
|
5332
5242
|
|
|
5333
5243
|
// src/commands/backlog/link.ts
|
|
5334
5244
|
function fail(message) {
|
|
5335
|
-
console.log(
|
|
5245
|
+
console.log(chalk56.red(message));
|
|
5336
5246
|
return void 0;
|
|
5337
5247
|
}
|
|
5338
5248
|
function parseLinkType(type) {
|
|
@@ -5362,12 +5272,12 @@ async function link(fromId, toId, opts) {
|
|
|
5362
5272
|
if (await createsCycle(orm, linkType, fromNum, toNum)) return;
|
|
5363
5273
|
await orm.insert(links).values({ itemId: fromNum, type: linkType, targetId: toNum });
|
|
5364
5274
|
console.log(
|
|
5365
|
-
|
|
5275
|
+
chalk56.green(`Linked #${fromNum} ${linkType} #${toNum} (${toItem.name})`)
|
|
5366
5276
|
);
|
|
5367
5277
|
}
|
|
5368
5278
|
|
|
5369
5279
|
// src/commands/backlog/unlink.ts
|
|
5370
|
-
import
|
|
5280
|
+
import chalk57 from "chalk";
|
|
5371
5281
|
import { and as and4, eq as eq17 } from "drizzle-orm";
|
|
5372
5282
|
async function unlink(fromId, toId) {
|
|
5373
5283
|
const fromNum = Number.parseInt(fromId, 10);
|
|
@@ -5375,19 +5285,19 @@ async function unlink(fromId, toId) {
|
|
|
5375
5285
|
const { orm } = await getReady();
|
|
5376
5286
|
const fromItem = await loadItem(orm, fromNum);
|
|
5377
5287
|
if (!fromItem) {
|
|
5378
|
-
console.log(
|
|
5288
|
+
console.log(chalk57.red(`Item #${fromId} not found.`));
|
|
5379
5289
|
return;
|
|
5380
5290
|
}
|
|
5381
5291
|
if (!fromItem.links || fromItem.links.length === 0) {
|
|
5382
|
-
console.log(
|
|
5292
|
+
console.log(chalk57.yellow(`No links found on item #${fromId}.`));
|
|
5383
5293
|
return;
|
|
5384
5294
|
}
|
|
5385
5295
|
if (!fromItem.links.some((l) => l.targetId === toNum)) {
|
|
5386
|
-
console.log(
|
|
5296
|
+
console.log(chalk57.yellow(`No link from #${fromId} to #${toId} found.`));
|
|
5387
5297
|
return;
|
|
5388
5298
|
}
|
|
5389
5299
|
await orm.delete(links).where(and4(eq17(links.itemId, fromNum), eq17(links.targetId, toNum)));
|
|
5390
|
-
console.log(
|
|
5300
|
+
console.log(chalk57.green(`Removed link from #${fromId} to #${toId}.`));
|
|
5391
5301
|
}
|
|
5392
5302
|
|
|
5393
5303
|
// src/commands/backlog/registerLinkCommands.ts
|
|
@@ -5401,17 +5311,17 @@ function registerLinkCommands(cmd) {
|
|
|
5401
5311
|
}
|
|
5402
5312
|
|
|
5403
5313
|
// src/commands/backlog/move-repo/index.ts
|
|
5404
|
-
import
|
|
5314
|
+
import chalk59 from "chalk";
|
|
5405
5315
|
import { eq as eq19 } from "drizzle-orm";
|
|
5406
5316
|
|
|
5407
5317
|
// src/commands/backlog/move-repo/confirmMove.ts
|
|
5408
|
-
import
|
|
5318
|
+
import chalk58 from "chalk";
|
|
5409
5319
|
function pluralItems(n) {
|
|
5410
5320
|
return `${n} item${n === 1 ? "" : "s"}`;
|
|
5411
5321
|
}
|
|
5412
5322
|
async function confirmMove(cnt, oldOrigin, newOrigin) {
|
|
5413
5323
|
console.log(
|
|
5414
|
-
`${pluralItems(cnt)}: ${
|
|
5324
|
+
`${pluralItems(cnt)}: ${chalk58.cyan(oldOrigin)} \u2192 ${chalk58.cyan(newOrigin)}`
|
|
5415
5325
|
);
|
|
5416
5326
|
return promptConfirm(`Retag ${pluralItems(cnt)}?`);
|
|
5417
5327
|
}
|
|
@@ -5443,7 +5353,7 @@ Pass the full origin.`
|
|
|
5443
5353
|
|
|
5444
5354
|
// src/commands/backlog/move-repo/index.ts
|
|
5445
5355
|
function fail2(message) {
|
|
5446
|
-
console.log(
|
|
5356
|
+
console.log(chalk59.red(message));
|
|
5447
5357
|
process.exitCode = 1;
|
|
5448
5358
|
}
|
|
5449
5359
|
async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
@@ -5459,12 +5369,12 @@ async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
|
5459
5369
|
}
|
|
5460
5370
|
const cnt = await countByOrigin(orm, oldOrigin);
|
|
5461
5371
|
if (!options2.yes && !await confirmMove(cnt, oldOrigin, newOrigin)) {
|
|
5462
|
-
console.log(
|
|
5372
|
+
console.log(chalk59.yellow("Move cancelled; no changes made."));
|
|
5463
5373
|
return;
|
|
5464
5374
|
}
|
|
5465
5375
|
await orm.update(items).set({ origin: newOrigin }).where(eq19(items.origin, oldOrigin));
|
|
5466
5376
|
console.log(
|
|
5467
|
-
|
|
5377
|
+
chalk59.green(
|
|
5468
5378
|
`Moved ${pluralItems(cnt)} from "${oldOrigin}" to "${newOrigin}".`
|
|
5469
5379
|
)
|
|
5470
5380
|
);
|
|
@@ -5479,12 +5389,116 @@ function registerMoveRepoCommand(cmd) {
|
|
|
5479
5389
|
);
|
|
5480
5390
|
}
|
|
5481
5391
|
|
|
5392
|
+
// src/commands/backlog/registerNextCommand.ts
|
|
5393
|
+
function registerNextCommand(cmd) {
|
|
5394
|
+
cmd.command("next").argument("[id]", "Backlog item ID to run first").description("Pick and run the next backlog item, or open /draft if none").option("-w, --write", "Run Claude with auto permission mode (default)").option("--no-write", "Run Claude without auto permission mode").option("--once", "Exit after the first completed item run").action(
|
|
5395
|
+
(id, opts) => next({ allowEdits: opts.write !== false, once: opts.once }, id)
|
|
5396
|
+
);
|
|
5397
|
+
}
|
|
5398
|
+
|
|
5482
5399
|
// src/commands/backlog/registerPlanCommands.ts
|
|
5483
5400
|
function registerPlanCommands(cmd) {
|
|
5484
5401
|
cmd.command("plan <id>").description("Display the plan for a backlog item").action(plan);
|
|
5485
5402
|
cmd.command("phase-done <id> <phase> <summary>").description("Signal that a plan phase is complete").action(phaseDone);
|
|
5486
5403
|
}
|
|
5487
5404
|
|
|
5405
|
+
// src/commands/backlog/refine.ts
|
|
5406
|
+
import chalk62 from "chalk";
|
|
5407
|
+
import enquirer7 from "enquirer";
|
|
5408
|
+
|
|
5409
|
+
// src/commands/backlog/launchMode.ts
|
|
5410
|
+
import chalk61 from "chalk";
|
|
5411
|
+
|
|
5412
|
+
// src/commands/backlog/tryRunById.ts
|
|
5413
|
+
import chalk60 from "chalk";
|
|
5414
|
+
async function tryRunById(id, options2) {
|
|
5415
|
+
const items2 = await loadBacklog();
|
|
5416
|
+
const numericId = Number.parseInt(id, 10);
|
|
5417
|
+
const item = Number.isNaN(numericId) ? void 0 : items2.find((i) => i.id === numericId);
|
|
5418
|
+
if (!item) {
|
|
5419
|
+
console.log(chalk60.red(`Item #${id} not found.`));
|
|
5420
|
+
return false;
|
|
5421
|
+
}
|
|
5422
|
+
if (item.status === "done") {
|
|
5423
|
+
console.log(chalk60.red(`Item #${id} is already done.`));
|
|
5424
|
+
return false;
|
|
5425
|
+
}
|
|
5426
|
+
if (item.status === "wontdo") {
|
|
5427
|
+
console.log(chalk60.red(`Item #${id} is marked won't do.`));
|
|
5428
|
+
return false;
|
|
5429
|
+
}
|
|
5430
|
+
if (isBlocked(item, items2)) {
|
|
5431
|
+
console.log(
|
|
5432
|
+
chalk60.red(`Item #${id} is blocked by unresolved dependencies.`)
|
|
5433
|
+
);
|
|
5434
|
+
return false;
|
|
5435
|
+
}
|
|
5436
|
+
console.log(chalk60.bold(`
|
|
5437
|
+
Running backlog item #${id}...
|
|
5438
|
+
`));
|
|
5439
|
+
await run2(id, options2);
|
|
5440
|
+
return true;
|
|
5441
|
+
}
|
|
5442
|
+
|
|
5443
|
+
// src/commands/backlog/launchMode.ts
|
|
5444
|
+
async function launchMode(slashCommand, options2) {
|
|
5445
|
+
pullIfConfigured();
|
|
5446
|
+
process.env.ASSIST_SESSION_ID = String(process.pid);
|
|
5447
|
+
const { child, done: done2 } = spawnClaude(`/${slashCommand}`, { allowEdits: true });
|
|
5448
|
+
watchForMarker(child, { actOnDone: options2?.once });
|
|
5449
|
+
await done2;
|
|
5450
|
+
stopWatching();
|
|
5451
|
+
const signal = readSignal();
|
|
5452
|
+
cleanupSignal();
|
|
5453
|
+
if (signal?.event === "next") {
|
|
5454
|
+
if (typeof signal.id === "string" && signal.id) {
|
|
5455
|
+
if (await tryRunById(signal.id, { allowEdits: true })) return;
|
|
5456
|
+
}
|
|
5457
|
+
console.log(chalk61.bold("\nChaining into assist next...\n"));
|
|
5458
|
+
await next({ allowEdits: true, once: options2?.once });
|
|
5459
|
+
}
|
|
5460
|
+
}
|
|
5461
|
+
|
|
5462
|
+
// src/commands/backlog/refine.ts
|
|
5463
|
+
async function pickItemForRefine() {
|
|
5464
|
+
const items2 = await loadBacklog();
|
|
5465
|
+
const active = items2.filter(
|
|
5466
|
+
(i) => i.status === "todo" || i.status === "in-progress"
|
|
5467
|
+
);
|
|
5468
|
+
if (active.length === 0) {
|
|
5469
|
+
console.log(chalk62.yellow("No active backlog items to refine."));
|
|
5470
|
+
return void 0;
|
|
5471
|
+
}
|
|
5472
|
+
if (active.length === 1) {
|
|
5473
|
+
const item = active[0];
|
|
5474
|
+
console.log(chalk62.bold(`Auto-selecting item #${item.id}: ${item.name}`));
|
|
5475
|
+
return String(item.id);
|
|
5476
|
+
}
|
|
5477
|
+
const { selected } = await exitOnCancel(
|
|
5478
|
+
enquirer7.prompt({
|
|
5479
|
+
type: "select",
|
|
5480
|
+
name: "selected",
|
|
5481
|
+
message: "Choose a backlog item to refine:",
|
|
5482
|
+
choices: active.map((item) => ({
|
|
5483
|
+
name: `${typeLabel(item.type)} #${item.id}: ${item.name}`
|
|
5484
|
+
}))
|
|
5485
|
+
})
|
|
5486
|
+
);
|
|
5487
|
+
return selected.match(/#(\d+)/)?.[1] ?? "";
|
|
5488
|
+
}
|
|
5489
|
+
async function refine(id, options2) {
|
|
5490
|
+
const itemId = id ?? await pickItemForRefine();
|
|
5491
|
+
if (!itemId) return;
|
|
5492
|
+
await launchMode(`refine ${itemId}`, options2);
|
|
5493
|
+
}
|
|
5494
|
+
|
|
5495
|
+
// src/commands/backlog/registerRefineCommand.ts
|
|
5496
|
+
function registerRefineCommand(cmd) {
|
|
5497
|
+
cmd.command("refine").argument("[id]", "Backlog item ID").description("Alias for refine").option("--once", "Exit when the initial task completes").action(
|
|
5498
|
+
(id, opts) => refine(id, { once: opts.once })
|
|
5499
|
+
);
|
|
5500
|
+
}
|
|
5501
|
+
|
|
5488
5502
|
// src/commands/backlog/rewindPhase.ts
|
|
5489
5503
|
import chalk63 from "chalk";
|
|
5490
5504
|
function validateRewind2(item, phaseNumber) {
|
|
@@ -6021,14 +6035,6 @@ function registerShowCommands(cmd) {
|
|
|
6021
6035
|
function registerWebCommand(cmd) {
|
|
6022
6036
|
cmd.command("web").description("Open the backlog tab in the web dashboard").option("-p, --port <number>", "Port to listen on", "3100").action(web2);
|
|
6023
6037
|
}
|
|
6024
|
-
function registerRefineCommand(cmd) {
|
|
6025
|
-
cmd.command("refine").argument("[id]", "Backlog item ID").description("Alias for refine").action((id) => refine(id));
|
|
6026
|
-
}
|
|
6027
|
-
function registerNextCommand(cmd) {
|
|
6028
|
-
cmd.command("next").argument("[id]", "Backlog item ID to run first").description("Pick and run the next backlog item, or open /draft if none").option("-w, --write", "Run Claude with auto permission mode (default)").option("--no-write", "Run Claude without auto permission mode").action(
|
|
6029
|
-
(id, opts) => next({ allowEdits: opts.write !== false }, id)
|
|
6030
|
-
);
|
|
6031
|
-
}
|
|
6032
6038
|
var registrars = [
|
|
6033
6039
|
registerItemCommands,
|
|
6034
6040
|
registerShowCommands,
|
|
@@ -9598,13 +9604,21 @@ async function reviewComments(number) {
|
|
|
9598
9604
|
|
|
9599
9605
|
// src/commands/registerLaunch.ts
|
|
9600
9606
|
function registerLaunch(program2) {
|
|
9601
|
-
program2.command("next").argument("[id]", "Backlog item ID to run first").description("Alias for backlog next").
|
|
9607
|
+
program2.command("next").argument("[id]", "Backlog item ID to run first").description("Alias for backlog next").option("--once", "Exit after the first completed item run").action(
|
|
9608
|
+
(id, opts) => next({ allowEdits: true, once: opts.once }, id)
|
|
9609
|
+
);
|
|
9602
9610
|
program2.command("draft").alias("feat").description(
|
|
9603
9611
|
"Launch Claude in /draft mode, chain into next on /next signal"
|
|
9604
|
-
).
|
|
9605
|
-
|
|
9612
|
+
).option("--once", "Exit when the initial task completes").action(
|
|
9613
|
+
(opts) => launchMode("draft", { once: opts.once })
|
|
9614
|
+
);
|
|
9615
|
+
program2.command("bug").description("Launch Claude in /bug mode, chain into next on /next signal").option("--once", "Exit when the initial task completes").action(
|
|
9616
|
+
(opts) => launchMode("bug", { once: opts.once })
|
|
9617
|
+
);
|
|
9606
9618
|
program2.command("review-comments").argument("[number]", "PR number to check out first").description("Launch Claude in /review-comments mode (single session)").action((number) => reviewComments(number));
|
|
9607
|
-
program2.command("refine").argument("[id]", "Backlog item ID").description("Launch Claude in /refine mode to refine a backlog item").
|
|
9619
|
+
program2.command("refine").argument("[id]", "Backlog item ID").description("Launch Claude in /refine mode to refine a backlog item").option("--once", "Exit when the initial task completes").action(
|
|
9620
|
+
(id, opts) => refine(id, { once: opts.once })
|
|
9621
|
+
);
|
|
9608
9622
|
}
|
|
9609
9623
|
|
|
9610
9624
|
// src/commands/registerList.ts
|
|
@@ -14709,6 +14723,10 @@ function registerSignal(program2) {
|
|
|
14709
14723
|
writeSignal("next", id ? { id } : void 0);
|
|
14710
14724
|
console.log("Signal written.");
|
|
14711
14725
|
});
|
|
14726
|
+
signalCommand.command("done").description("Write a done signal to end a --once launch session").action(() => {
|
|
14727
|
+
writeSignal("done");
|
|
14728
|
+
console.log("Signal written.");
|
|
14729
|
+
});
|
|
14712
14730
|
}
|
|
14713
14731
|
|
|
14714
14732
|
// src/commands/sql/sqlAuth.ts
|