@staff0rd/assist 0.922.0 → 0.924.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/claude/advice/ask.md +1 -1
- package/claude/commands/ask.md +2 -0
- package/claude/commands/bug.md +1 -1
- package/claude/commands/draft.md +1 -1
- package/claude/commands/github.md +2 -0
- package/claude/commands/refine.md +1 -1
- package/claude/commands/review-config.md +1 -0
- package/claude/commands/review-high-level.md +1 -1
- package/claude/commands/slack-post.md +1 -0
- package/claude/skills/review-ci/scripts/review.mjs +2 -2
- package/dist/commands/sessions/web/bundle.js +398 -398
- package/dist/index.js +48 -14
- package/package.json +1 -1
package/claude/advice/ask.md
CHANGED
|
@@ -3,4 +3,4 @@ title: Asking for sign-off
|
|
|
3
3
|
when: always
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
When a plan, summary or proposed decision needs the user's sign-off before you act on it, don't ask in chat. Write it as markdown to a scratch file and run `assist ask --title '<title>' --body - < <file>` as a background task, doing no other work until it returns. It opens in the session's web preview pane with approve, reject and inline comments, and blocks until the user decides. Approval exits 0 and prints any comments to fold in; rejection exits non-zero with the reason and comments — revise and re-run. Outside a web session it just prints the markdown, so ask in chat.
|
|
6
|
+
When a plan, summary or proposed decision needs the user's sign-off before you act on it, don't ask in chat. Write it as markdown to a scratch file and run `assist ask --title '<title>' --body - < <file>` as a background task, doing no other work until it returns. It opens in the session's web preview pane with approve, reject and inline comments, and blocks until the user decides. Approval exits 0 and prints any comments to fold in; rejection exits non-zero with the reason and comments — revise and re-run. To revise a still-pending preview, re-run it directly without stopping the earlier task; that task then exits 0 as superseded — ignore its result. Outside a web session it just prints the markdown, so ask in chat.
|
package/claude/commands/ask.md
CHANGED
|
@@ -21,6 +21,8 @@ assist ask --title '<short title>' --body - < <scratch file>
|
|
|
21
21
|
|
|
22
22
|
Always run it **as a background task**, and do no other work until it returns. In a web session it blocks until the user decides, which can take far longer than the default command timeout, and the pending preview dies with the process.
|
|
23
23
|
|
|
24
|
+
To revise the update while it is still pending, re-run Step 2 directly — do not stop the earlier task. The pane swaps to the new version, and the earlier task exits 0 printing `Superseded by a newer preview — no decision; ignore this result.`: ignore it.
|
|
25
|
+
|
|
24
26
|
Outside a web session it prints the markdown and exits 0 without a decision: ask the user in chat instead.
|
|
25
27
|
|
|
26
28
|
## Step 3: act on the decision
|
package/claude/commands/bug.md
CHANGED
|
@@ -70,7 +70,7 @@ JSON
|
|
|
70
70
|
|
|
71
71
|
The payload is strict JSON — an unknown key is an error. `\n` inside the `description` string is a JSON escape and becomes a real newline, which is what the markdown rendering needs.
|
|
72
72
|
|
|
73
|
-
Always run `propose` **as a background task**, and do no other work until it returns. In a web session it blocks on the preview pane until the user decides, which can take far longer than the default command timeout, and the pending preview dies with the process — a killed `propose` abandons the item.
|
|
73
|
+
Always run `propose` **as a background task**, and do no other work until it returns. In a web session it blocks on the preview pane until the user decides, which can take far longer than the default command timeout, and the pending preview dies with the process — a killed `propose` abandons the item. To revise the report while its preview is still pending, re-run `propose` with the revised payload directly — do not stop the earlier task. The pane swaps to the new version, and the earlier task exits 0 printing `Superseded by a newer preview — no decision; ignore this result.` without creating anything: ignore it.
|
|
74
74
|
|
|
75
75
|
`propose` decides where the bug report is reviewed and prints what to do next. Follow that instruction; never inspect the environment to work it out yourself:
|
|
76
76
|
|
package/claude/commands/draft.md
CHANGED
|
@@ -104,7 +104,7 @@ JSON
|
|
|
104
104
|
|
|
105
105
|
The payload is strict JSON — an unknown key is an error. `\n` inside the `description` string is a JSON escape and becomes a real newline, which is what the markdown rendering needs. Each phase needs at least one task; omit `manualChecks` for the phases that don't need any (most of them). A phase named `Review` is rejected: the runner appends that phase itself.
|
|
106
106
|
|
|
107
|
-
Always run `propose` **as a background task**, and do no other work until it returns. In a web session it blocks on the preview pane until the user decides, which can take far longer than the default command timeout, and the pending preview dies with the process — a killed `propose` abandons the item.
|
|
107
|
+
Always run `propose` **as a background task**, and do no other work until it returns. In a web session it blocks on the preview pane until the user decides, which can take far longer than the default command timeout, and the pending preview dies with the process — a killed `propose` abandons the item. To revise the item while its preview is still pending, re-run `propose` with the revised payload directly — do not stop the earlier task. The pane swaps to the new version, and the earlier task exits 0 printing `Superseded by a newer preview — no decision; ignore this result.` without creating anything: ignore it.
|
|
108
108
|
|
|
109
109
|
`propose` decides where the item is reviewed and prints what to do next. Follow that instruction; never inspect the environment to work it out yourself:
|
|
110
110
|
|
|
@@ -62,6 +62,8 @@ Display the output so the user can see what happened. If the command exits non-z
|
|
|
62
62
|
- **Request changes** — the reason and every inline comment, each with the excerpt it was left on. The output names the working file holding the pane's markdown, collapses included. Revise **that file in place** to address the comments — never recompose the body from scratch — then re-run the command, which previews the revised file with the earlier collapses intact. Pass `--fresh` only when the working file should be thrown away and the issue re-fetched.
|
|
63
63
|
- **The issue moved on GitHub** — it names the working file holding the markdown. Someone else edited the issue, so nothing was pushed; tell the user rather than re-running blind.
|
|
64
64
|
|
|
65
|
+
Any preview in this skill (`edit`, `create`, `comment`) can be revised while still pending by re-running the command directly — do not stop the earlier task. The earlier task exits 0 printing `Superseded by a newer preview — no decision; ignore this result.` without touching GitHub: ignore it.
|
|
66
|
+
|
|
65
67
|
## Action: create
|
|
66
68
|
|
|
67
69
|
Create a new issue from a free-form request (e.g. `create bug against owner/repo, Sprint 3 milestone, Roadmap project: login fails on Safari`). Step 2 does not apply — there is no issue yet. Work out from the args:
|
|
@@ -64,7 +64,7 @@ The payload is the whole plan, not a patch: every phase you want the item to end
|
|
|
64
64
|
|
|
65
65
|
Do not chain `add-phase`, `update-phase`, `remove-phase` and `move-phase` calls to build up a change — that is one preview per command and leaves the item half-edited if the user rejects part way. Those commands remain for a human typing a quick one-liner at a terminal.
|
|
66
66
|
|
|
67
|
-
In a web session this renders the whole change into the preview pane as one diff — each phase marked unchanged, added, edited or moved, removed phases listed separately, phases the item has already completed flagged, and any clamp of `currentPhase` into the shorter plan shown at the top — and blocks until the user decides. The review can take far longer than the default command timeout, so run `update-plan` **as a background task** and do no other work until it returns; the pending preview dies with the process.
|
|
67
|
+
In a web session this renders the whole change into the preview pane as one diff — each phase marked unchanged, added, edited or moved, removed phases listed separately, phases the item has already completed flagged, and any clamp of `currentPhase` into the shorter plan shown at the top — and blocks until the user decides. The review can take far longer than the default command timeout, so run `update-plan` **as a background task** and do no other work until it returns; the pending preview dies with the process. To revise the change while it is still pending, re-run `update-plan` with the revised payload directly — do not stop the earlier task. The pane swaps to the new diff, and the earlier task exits 0 printing `Superseded by a newer preview — no decision; ignore this result.` without writing anything: ignore it.
|
|
68
68
|
|
|
69
69
|
When it returns:
|
|
70
70
|
|
|
@@ -46,6 +46,7 @@ assist ask --title 'High-level review config' --body - < <scratch file>
|
|
|
46
46
|
|
|
47
47
|
- **Approved (exit 0)** — fold every printed inline comment into the answers (a comment on a glob edits or drops it; a comment on the scope switches it), then write.
|
|
48
48
|
- **Rejected (non-zero exit)** — write nothing. Address the reason and each comment, re-check any changed glob still matches files, revise the scratch file and re-run `assist ask`.
|
|
49
|
+
- **Superseded (exit 0)** — you re-ran `assist ask` while this one was pending, which is how to revise it; do not stop the earlier task first. Ignore this result and wait for the newer one.
|
|
49
50
|
|
|
50
51
|
Outside a web session `assist ask` only prints the markdown and exits 0 without a decision: ask the user in chat instead, and write only once they have answered.
|
|
51
52
|
|
|
@@ -9,7 +9,7 @@ Run the high-level review (see `docs/high-level-review.md`) for the PR given in
|
|
|
9
9
|
assist review --high-level $ARGUMENTS
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
If this is a re-invocation in a session that already ran it, re-run it anyway — never assume the checklist is still open, since the pane may have gone even while a previous task still looks alive.
|
|
12
|
+
If this is a re-invocation in a session that already ran it, re-run it anyway — never assume the checklist is still open, since the pane may have gone even while a previous task still looks alive. Do not stop a still-running previous `assist review --high-level` task: launch it afresh, and the new checklist replaces the old one in place. The earlier task then exits 0 printing `Superseded by a newer preview — no decision; ignore this result.` — ignore it.
|
|
13
13
|
|
|
14
14
|
Run it as a background task. In an assist web session it opens the checklist in the web UI preview pane and returns once the user approves or requests changes; otherwise it prints the checklist and exits straight away. Do not review the PR yourself or post anything to GitHub.
|
|
15
15
|
|
|
@@ -38,6 +38,7 @@ In an assist web session this renders each message in the preview pane for appro
|
|
|
38
38
|
- **Approved (`--body`)** — the last line of stdout is the path to the approved body under `~/.assist/slack/`. That file, not your scratch file, is what gets posted. The line above it names the target channel, and the resolved `thread_ts` when `--thread` was passed.
|
|
39
39
|
- **Approved (`--parts`)** — only after the last part is approved does the command print anything: a line naming the target, then one `k/N <path>` line per part in thread order under `~/.assist/slack/`, then a line saying how to thread them. Those files, not your scratch files, are what get posted.
|
|
40
40
|
- **Rejected** — the command exits non-zero with the reason and any inline comments, and names the working file of the message that was rejected (with its position, for a batch). No path is handed back, so nothing from the batch is posted. Address every comment, rewrite that working file in place, and re-run the same command with that working file in place of the scratch file it came from — a batch re-previews from part 1. Do not post, and do not recompose the messages from scratch.
|
|
41
|
+
- **Superseded** — the command was re-run while this preview was pending, which is how to revise a pending preview; never stop the earlier task first. It exits 0 printing `Superseded by a newer preview — no decision; ignore this result.` and posts nothing: ignore it and wait for the newer run.
|
|
41
42
|
|
|
42
43
|
Outside a web session there is no pane: the bodies pass straight through and the working files are written immediately.
|
|
43
44
|
|
|
@@ -434,8 +434,8 @@ ${i}
|
|
|
434
434
|
Comment: ${t.note}
|
|
435
435
|
`})}function b1(e,t,r){console.error(`${e} rejected${t.reason?`: ${t.reason}`:"."}`);let i=t.comments??[];if(i.length>0){console.error(`
|
|
436
436
|
The reviewer left ${i.length} comment${i.length===1?"":"s"} on the preview. Address each one, then re-run this command:
|
|
437
|
-
`);for(let n of y1(i))console.error(n)}r&&console.error(r),process.exit(1)}function w1(e){if(Array.isArray(e))return e.flatMap(t=>{let{path:r,alt:i,group:n}=t??{};if(typeof r!="string"||r==="")return[];let o={path:r,alt:typeof i=="string"?i:""};return[typeof n=="string"&&n!==""?{...o,group:n}:o]})}function $1(e){if(Array.isArray(e))return e.flatMap(t=>{let{id:r,ticked:i,comment:n}=t??{};return typeof r!="string"?[]:[{id:r,ticked:i===!0,...typeof n=="string"&&n!==""?{comment:n}:{}}]})}function x1(e){return e==="LEFT"||e==="RIGHT"}function LU(e){let t=e;return typeof t?.path=="string"&&Number.isInteger(t.startLine)&&Number.isInteger(t.endLine)&&typeof t.quote=="string"&&typeof t.note=="string"&&t.note.trim()!==""}function S1(e){if(Array.isArray(e))return e.filter(LU).map(({path:t,startLine:r,endLine:i,quote:n,note:o,startSide:s,side:a})=>({path:t,startLine:r,endLine:i,quote:n,note:o,...x1(s)?{startSide:s}:{},...x1(a)?{side:a}:{}}))}var MU=["APPROVE","COMMENT","REQUEST_CHANGES"];function FU(e){let t=e;if(!(typeof t?.topLeft!="string"||typeof t.bottomRight!="string"))return{topLeft:t.topLeft,bottomRight:t.bottomRight}}function _1(e){return e.decision!=="approve"&&e.decision!=="reject"?null:{decision:e.decision,reason:e.reason,comments:Array.isArray(e.comments)?e.comments:void 0,screenshots:w1(e.screenshots),body:typeof e.body=="string"?e.body:void 0,reviewAfter:e.reviewAfter===!0,announceAfter:e.announceAfter===!0,draft:typeof e.draft=="boolean"?e.draft:void 0,autoMerge:e.autoMerge===!0,autostart:e.autostart===!0,selection:FU(e.selection),checklist:$1(e.checklist),reviewEvent:MU.find(t=>t===e.reviewEvent),reviewComments:S1(e.reviewComments),dismissed:e.dismissed===!0}}function k1(e,t){try{let r=JSON.parse(e);if(r.type==="error"&&(r.message??"").includes("pr-preview"))return{kind:"error",message:r.message??"pr-preview failed"};if(r.type
|
|
438
|
-
`)},r)})}async function P1(e,t,r={}){console.log("Awaiting your approval in the assist web UI preview pane\u2026");let i;try{i=await I1(t)}catch(n){console.error(`Error: ${n instanceof Error?n.message:String(n)}`),process.exit(1)}return i.body!==void 0&&r.saveEditedBody?.(i.body),i.decision==="reject"&&!r.rejectIsOutcome&&b1(e,i,r.rejectionAdvice),i}async function C1(e,t,r){let i=process.env.ASSIST_SESSION_ID;process.env.ASSIST_SESSION!=="1"||!i||await P1("PR comment preview",{sessionId:i,requestId:qU(),title:e,body:t,prNumber:r,kind:"pr-comment"})}function ZU(e){let t=e.toLowerCase();(t.includes("claude")||t.includes("opus"))&&(console.error('Error: Body must not contain "claude" or "opus"'),process.exit(1))}function O1(e){(!Number.isInteger(e)||e<1)&&(console.error("Error: Line must be a positive integer"),process.exit(1))}async function E1(e,t,r,i={}){let{startLine:n,skipPreview:o}=i;ZU(r),O1(t),n!==void 0&&O1(n);let s=n!==void 0?`${n}-${t}`:`${t}`;o||await C1(`Comment on ${e}:${s}`,r,null);try{let a=Fi();v1({prId:a,body:r,path:e,line:t,startLine:n}),console.log(`Added review comment on ${e}:${s}`)}catch(a){throw Mi(a)&&(console.error("Error: GitHub CLI (gh) is not installed."),console.error("Install it from https://cli.github.com/"),process.exit(1)),a}}var T1="the reviewer";function on(e){return e.replace(/\bclaude\b/gi,T1).replace(/\bopus\b/gi,T1)}function BU(e){let t=[],r=e.severity??"finding";return t.push(`**${r}: ${e.title}**`),e.impact&&t.push("",`Impact: ${e.impact}`),e.recommendation&&t.push("",`Recommendation: ${e.recommendation}`),on(t.join(`
|
|
437
|
+
`);for(let n of y1(i))console.error(n)}r&&console.error(r),process.exit(1)}function w1(e){if(Array.isArray(e))return e.flatMap(t=>{let{path:r,alt:i,group:n}=t??{};if(typeof r!="string"||r==="")return[];let o={path:r,alt:typeof i=="string"?i:""};return[typeof n=="string"&&n!==""?{...o,group:n}:o]})}function $1(e){if(Array.isArray(e))return e.flatMap(t=>{let{id:r,ticked:i,comment:n}=t??{};return typeof r!="string"?[]:[{id:r,ticked:i===!0,...typeof n=="string"&&n!==""?{comment:n}:{}}]})}function x1(e){return e==="LEFT"||e==="RIGHT"}function LU(e){let t=e;return typeof t?.path=="string"&&Number.isInteger(t.startLine)&&Number.isInteger(t.endLine)&&typeof t.quote=="string"&&typeof t.note=="string"&&t.note.trim()!==""}function S1(e){if(Array.isArray(e))return e.filter(LU).map(({path:t,startLine:r,endLine:i,quote:n,note:o,startSide:s,side:a})=>({path:t,startLine:r,endLine:i,quote:n,note:o,...x1(s)?{startSide:s}:{},...x1(a)?{side:a}:{}}))}var MU=["APPROVE","COMMENT","REQUEST_CHANGES"];function FU(e){let t=e;if(!(typeof t?.topLeft!="string"||typeof t.bottomRight!="string"))return{topLeft:t.topLeft,bottomRight:t.bottomRight}}function _1(e){return e.decision!=="approve"&&e.decision!=="reject"?null:{decision:e.decision,reason:e.reason,comments:Array.isArray(e.comments)?e.comments:void 0,screenshots:w1(e.screenshots),body:typeof e.body=="string"?e.body:void 0,reviewAfter:e.reviewAfter===!0,announceAfter:e.announceAfter===!0,draft:typeof e.draft=="boolean"?e.draft:void 0,autoMerge:e.autoMerge===!0,autostart:e.autostart===!0,selection:FU(e.selection),checklist:$1(e.checklist),reviewEvent:MU.find(t=>t===e.reviewEvent),reviewComments:S1(e.reviewComments),dismissed:e.dismissed===!0}}function k1(e,t){try{let r=JSON.parse(e);if(r.type==="error"&&(r.message??"").includes("pr-preview"))return{kind:"error",message:r.message??"pr-preview failed"};if(r.requestId!==t)return null;if(r.type==="pr-superseded")return{kind:"superseded"};if(r.type!=="pr-decision")return null;let i=_1(r);return i?{kind:"decision",decision:i}:null}catch{return null}}function I1(e){return new Promise((t,r)=>{rn().then(i=>{let n=!1,o=(s,a)=>{n||(n=!0,i.destroy(),s?r(s):t(a))};nn(i,s=>{let a=k1(s,e.requestId);a&&(a.kind==="error"?o(new Error(a.message)):a.kind==="superseded"?o(void 0,"superseded"):o(void 0,a.decision))}),i.on("error",s=>o(s)),i.on("close",()=>o(new Error("daemon closed before a decision was made"))),i.write(`${JSON.stringify({type:"pr-preview",...e})}
|
|
438
|
+
`)},r)})}async function P1(e,t,r={}){console.log("Awaiting your approval in the assist web UI preview pane\u2026");let i;try{i=await I1(t)}catch(n){console.error(`Error: ${n instanceof Error?n.message:String(n)}`),process.exit(1)}return i==="superseded"&&(console.log("Superseded by a newer preview \u2014 no decision; ignore this result."),process.exit(0)),i.body!==void 0&&r.saveEditedBody?.(i.body),i.decision==="reject"&&!r.rejectIsOutcome&&b1(e,i,r.rejectionAdvice),i}async function C1(e,t,r){let i=process.env.ASSIST_SESSION_ID;process.env.ASSIST_SESSION!=="1"||!i||await P1("PR comment preview",{sessionId:i,requestId:qU(),title:e,body:t,prNumber:r,kind:"pr-comment"})}function ZU(e){let t=e.toLowerCase();(t.includes("claude")||t.includes("opus"))&&(console.error('Error: Body must not contain "claude" or "opus"'),process.exit(1))}function O1(e){(!Number.isInteger(e)||e<1)&&(console.error("Error: Line must be a positive integer"),process.exit(1))}async function E1(e,t,r,i={}){let{startLine:n,skipPreview:o}=i;ZU(r),O1(t),n!==void 0&&O1(n);let s=n!==void 0?`${n}-${t}`:`${t}`;o||await C1(`Comment on ${e}:${s}`,r,null);try{let a=Fi();v1({prId:a,body:r,path:e,line:t,startLine:n}),console.log(`Added review comment on ${e}:${s}`)}catch(a){throw Mi(a)&&(console.error("Error: GitHub CLI (gh) is not installed."),console.error("Install it from https://cli.github.com/"),process.exit(1)),a}}var T1="the reviewer";function on(e){return e.replace(/\bclaude\b/gi,T1).replace(/\bopus\b/gi,T1)}function BU(e){let t=[],r=e.severity??"finding";return t.push(`**${r}: ${e.title}**`),e.impact&&t.push("",`Impact: ${e.impact}`),e.recommendation&&t.push("",`Recommendation: ${e.recommendation}`),on(t.join(`
|
|
439
439
|
`))}async function R1(e){let t=0,r=[];for(let i of e){let n=BU(i);try{await E1(i.file,i.line,n,{startLine:i.startLine,skipPreview:!0}),t++}catch(o){r.push(i);let s=o instanceof Error?o.message:String(o);console.error(`Failed to post comment on ${i.file}:${i.line}: ${s}`)}}return{posted:t,failed:r}}function N1(e,t,r){return er(on(tt(e,t)),r)}var VU="mutation($prId: ID!, $body: String) { submitPullRequestReview(input: { pullRequestId: $prId, event: COMMENT, body: $body }) { pullRequestReview { id } } }";function qg(e){return Ji(VU,e)}function A1(e,t){return t.posted>0?qg(e):KU(e,t)?!0:tr(e)}function KU(e,t){return t.failed>0&&qg(e)}function z1(e,t){return[...e,...t.map(r=>({...r,reason:"comment-rejected"}))]}async function GU(e){if(!e.prompt)return e.submit;await Fg("waiting");try{return await fr("Submit the pending review?",e.submit)}finally{await Fg("running")}}async function D1(e,t,r,i){let{posted:n,failed:o}=await R1(e),s=o.length>0?`, ${o.length} failed`:"";console.log(`Posted ${n} comment(s)${s}.`);let a=z1(t,o),l=Yt(a);if(n===0&&l.length===0&&!i.ciFooter)return{posted:0,submitted:!1};if(await GU(i)){let u=A1(N1(r,a,i.ciFooter),{posted:n,failed:o.length});if(!u&&i.ciFooter)throw new Error("the review could not be submitted to the PR");return{posted:n,submitted:u}}return console.log("Leaving the review unsubmitted."),{posted:n,submitted:!1}}function JU(){try{return qi()}catch(e){return console.error(`Error: could not confirm which PR this tree is on: ${e instanceof Error?e.message:String(e)}`),null}}function j1(e){let t=JU();return t===e?!0:(console.error(`Error: this tree is now on ${t===null?"a branch with no open PR":`PR #${t}`}, not the reviewed PR #${e}; skipping the post and any chained sessions.`),!1)}function U1(e,t){let r=on(`${tt(e)}
|
|
440
440
|
|
|
441
441
|
No findings were raised.`);return tr(er(r,t))}function L1(e,t){if(!t)return{posted:0,submitted:!1};if(!U1(e,t))throw new Error("the review could not be submitted to the PR");return{posted:0,submitted:!0}}function M1(e,t){let r=[];return e>0&&r.push(`${e} line comment(s)`),t>0&&r.push(`${t} finding(s) in the review body`),r.join(" and ")}var HU={posted:0,submitted:!1};async function YU(e,t,r){return r.prompt?fr(`Post ${t} to PR #${e}?`,!1):!0}async function XU(e,t,r){let i=WU(t,"utf8"),{inDiff:n,unanchored:o}=Ki(i,e),s=Yt(o);if(n.length===0&&s.length===0)return L1(i,r.ciFooter);let a=M1(n.length,s.length);return console.log(`Found PR #${e.prNumber} with ${a} to post.`),await YU(e.prNumber,a,r)?D1(n,o,i,r):(console.log("Skipped posting."),HU)}async function F1(e,t,r){if(!j1(t.prNumber))return;let i=await XU(t,e,r);await f1(t.prNumber,i,r)}import{mkdirSync as QU,writeFileSync as eL}from"node:fs";import{dirname as tL}from"node:path";var Vg="assist sessions set-status";function Zg(e){return`${Vg} running --source ${e}`}function rL(e){return`${Vg} waiting --source ${e}`}function Bg(e){return`${Vg} waiting --source ${e} --ack`}function Ht(e,t){let r=[{type:"command",command:e}];return[t==null?{hooks:r}:{matcher:t,hooks:r}]}var q1="AskUserQuestion",nL=`^(?!${q1}$).*`,iL={theme:"auto",hooks:{UserPromptSubmit:Ht(Zg("prompt")),PreToolUse:[...Ht(rL("pretool"),q1),...Ht(Zg("pretool"),nL)],PostToolUse:Ht(Zg("posttool")),Stop:Ht(Bg("stop")),Notification:Ht(Bg("notification")),PermissionRequest:Ht(Bg("permission"))}};function Z1(){let e=tn.hooksSettings;return QU(tL(e),{recursive:!0}),eL(e,JSON.stringify(iL,null,2)),e}import{spawn as oL}from"node:child_process";function B1(e,t,r={}){let{ASSIST_ACTIVITY_ID:i,CLAUDE_CODE_CHILD_SESSION:n,...o}=process.env,s=oL(e,t,{stdio:"inherit",env:{...o,...r.env},cwd:r.cwd}),a=new Promise((l,c)=>{s.on("close",u=>l(u??0)),s.on("error",c)});return{child:s,done:a}}function sn(e,t={}){let r=["--settings",Z1(),...sL(e,t)],i=t.permissionMode??(t.allowEdits?"auto":void 0);return i&&r.push("--permission-mode",i),B1("claude",r)}function sL(e,t){return t.resumeSessionId?e?["--resume",t.resumeSessionId,e]:["--resume",t.resumeSessionId]:t.sessionId?e?["--session-id",t.sessionId,e]:["--session-id",t.sessionId]:e?[e]:[]}function aL(e){return`You are helping the user apply fixes for a code review with each finding decided one at a time.
|