chamba 0.7.0 → 0.8.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/LICENSE +53 -14
- package/README.md +28 -8
- package/dist/commands/advanced.js +7 -278
- package/dist/commands/dev.js +11 -612
- package/dist/commands/doctor.js +1 -29
- package/dist/commands/menu.js +1 -80
- package/dist/commands/onboard.js +6 -230
- package/dist/commands/settings.js +15 -349
- package/dist/lib/agent-commands.js +2 -0
- package/dist/lib/agent-context.js +6 -210
- package/dist/lib/browser.js +1 -40
- package/dist/lib/chamba-yaml.js +10 -191
- package/dist/lib/constants.js +1 -125
- package/dist/lib/dockerfile-builder.js +41 -261
- package/dist/lib/env.js +2 -78
- package/dist/lib/git-env.js +1 -21
- package/dist/lib/global-config.js +4 -66
- package/dist/lib/pnpm-store.js +1 -19
- package/dist/lib/ports.js +1 -210
- package/dist/lib/safe-rm.js +1 -36
- package/dist/lib/sessions.js +2 -34
- package/dist/lib/shadows.js +1 -176
- package/dist/lib/skills.js +2 -0
- package/dist/lib/templates.js +1 -0
- package/dist/lib/webterm.js +1 -305
- package/dist/lib/workspace-identity.js +4 -260
- package/package.json +4 -4
- package/templates/Dockerfile +12 -19
- package/templates/claude-statusline.sh +5 -7
- package/templates/context/baseline.md +2 -0
- package/templates/pane-apps/client/assets/c-BNa-DeUl.json +3552 -0
- package/templates/pane-apps/client/assets/cpp-B-T4NRoH.json +20239 -0
- package/templates/pane-apps/client/assets/csharp-BbxHChhA.json +6010 -0
- package/templates/pane-apps/client/assets/css-CWCxuwmz.json +1860 -0
- package/templates/pane-apps/client/assets/diff-B-2N89g8.json +154 -0
- package/templates/pane-apps/client/assets/docker-DWTvYW26.json +103 -0
- package/templates/pane-apps/client/assets/files-D0nJgFAA.js +12 -0
- package/templates/pane-apps/client/assets/files-h0K1vZyQ.css +1 -0
- package/templates/pane-apps/client/assets/go-B2hyYeNg.json +3156 -0
- package/templates/pane-apps/client/assets/graphql-Z6Id2aNO.json +1292 -0
- package/templates/pane-apps/client/assets/html-BtzvlIfu.json +2627 -0
- package/templates/pane-apps/client/assets/ini-Bn3Twap1.json +108 -0
- package/templates/pane-apps/client/assets/java-C7t2dwLO.json +1885 -0
- package/templates/pane-apps/client/assets/javascript-DuC2v0C0.json +5996 -0
- package/templates/pane-apps/client/assets/json-CwdkWeV5.json +206 -0
- package/templates/pane-apps/client/assets/jsonc-MYWDbTU3.json +206 -0
- package/templates/pane-apps/client/assets/jsx-Cn8EZuIC.json +5996 -0
- package/templates/pane-apps/client/assets/kotlin-CFNOz1gw.json +580 -0
- package/templates/pane-apps/client/assets/make-BVnlFCcl.json +629 -0
- package/templates/pane-apps/client/assets/markdown-B4Xk2WM_.json +3263 -0
- package/templates/pane-apps/client/assets/php-CAQzQmmI.json +4188 -0
- package/templates/pane-apps/client/assets/python-CYQee8m4.json +4174 -0
- package/templates/pane-apps/client/assets/reviews-BsoGZ35r.css +1 -0
- package/templates/pane-apps/client/assets/reviews-iW0Mbn4e.js +153 -0
- package/templates/pane-apps/client/assets/ruby-D7R58tus.json +3114 -0
- package/templates/pane-apps/client/assets/rust-BFBbFiei.json +1103 -0
- package/templates/pane-apps/client/assets/scss-TQRhBkPG.json +1874 -0
- package/templates/pane-apps/client/assets/shellscript-DieAkC4W.json +2375 -0
- package/templates/pane-apps/client/assets/specs-D9z3neR-.js +13 -0
- package/templates/pane-apps/client/assets/sql-Bxd030LV.json +634 -0
- package/templates/pane-apps/client/assets/toml-ChrKGzsV.json +430 -0
- package/templates/pane-apps/client/assets/tsx-D2e90MFw.json +5996 -0
- package/templates/pane-apps/client/assets/typescript-DonXQ_n1.json +5747 -0
- package/templates/pane-apps/client/assets/xml-B17r2RXF.json +382 -0
- package/templates/pane-apps/client/assets/yaml-CKn4h1zy.json +627 -0
- package/templates/pane-apps/client/reviews/index.html +15 -0
- package/templates/pane-apps/client/specs/index.html +3 -2
- package/templates/pane-apps/server/reviews.mjs +20 -0
- package/templates/pane-apps/server/specs.mjs +5 -1588
- package/templates/skills/chamba-statusline/SKILL.md +7 -19
- package/templates/skills/dx-review/SKILL.md +123 -0
- package/templates/skills/dx-review/references/acts.md +162 -0
- package/templates/skills/dx-spec/SKILL.md +223 -27
- package/templates/skills/dx-spec/references/principles-template.md +2 -0
- package/templates/skills/dx-spec/references/review-guide.md +4 -50
- package/templates/skills/dx-spec/references/spec-guide.md +24 -4
- package/templates/skills/dx-spec/references/stages.md +143 -58
- package/templates/skills/dx-spec-execute/SKILL.md +148 -35
- package/templates/startup.mjs +10 -4
- package/templates/tool-helper.sh +166 -0
- package/templates/webterm/README.md +60 -26
- package/templates/webterm/color.js +61 -0
- package/templates/webterm/config.js +35 -4
- package/templates/webterm/context/claude.md +0 -1
- package/templates/webterm/public/app/alerts.js +4 -4
- package/templates/webterm/public/app/anchored.js +81 -0
- package/templates/webterm/public/app/connection.js +9 -0
- package/templates/webterm/public/app/dom.js +2 -0
- package/templates/webterm/public/app/frames.js +51 -17
- package/templates/webterm/public/app/main.js +22 -8
- package/templates/webterm/public/app/new-session.js +13 -41
- package/templates/webterm/public/app/palette.js +58 -0
- package/templates/webterm/public/app/pane-shape.js +167 -0
- package/templates/webterm/public/app/pane-shell.js +199 -134
- package/templates/webterm/public/app/pane.js +33 -24
- package/templates/webterm/public/app/reviews-host.js +15 -0
- package/templates/webterm/public/app/specs-host.js +12 -218
- package/templates/webterm/public/app/state.js +5 -0
- package/templates/webterm/public/app/tabs.js +6 -2
- package/templates/webterm/public/app/theme.js +75 -27
- package/templates/webterm/public/app/tool-host.js +302 -0
- package/templates/webterm/public/app/workspace-color.js +192 -0
- package/templates/webterm/public/index.html +17 -3
- package/templates/webterm/public/styles.css +143 -21
- package/templates/webterm/server.js +198 -150
- package/templates/webterm/tools/commands.js +61 -0
- package/templates/webterm/tools/index.js +25 -0
- package/templates/webterm/tools/mount.js +337 -0
- package/templates/webterm/tools/paths.js +34 -0
- package/templates/webterm/tools/reviews.js +133 -0
- package/templates/webterm/tools/specs.js +154 -0
- package/templates/webterm/typed-line.js +70 -7
- package/templates/context/context-usage.md +0 -1
- package/templates/context-usage.sh +0 -266
- package/templates/pane-apps/client/assets/specs-B1970L17.css +0 -1
- package/templates/pane-apps/client/assets/specs-cEee_SPn.js +0 -23
- package/templates/skills/dx-spec-config/SKILL.md +0 -313
- package/templates/skills/dx-spec-config/references/principles-template.md +0 -12
- package/templates/specs.sh +0 -106
- package/templates/webterm/specs.js +0 -358
|
@@ -7,12 +7,16 @@ argument-hint: "[the name of the piece of work to run]"
|
|
|
7
7
|
|
|
8
8
|
# dx-spec execute - build the work from its plan
|
|
9
9
|
|
|
10
|
-
This skill runs when the user types
|
|
10
|
+
This skill runs when the user types the command, or when the Specs tab types it as the user's own act. It never starts on its own.
|
|
11
|
+
Each agent spells it its own way - `/dx-spec-execute` on claude and on opencode, and `$dx-spec-execute` on codex.
|
|
11
12
|
|
|
12
13
|
Your job is to move through the phases of one spec's plan, and to keep every bit of progress on disk, so a later session restarts from this point.
|
|
13
14
|
|
|
14
15
|
Write, build, verify, record and commit each phase yourself.
|
|
15
16
|
The only subagents are reviewers, and they exist so somebody who did not do the work judges it.
|
|
17
|
+
An agent with no subagent tool still reviews, one focus at a time and by itself, and says so - the review checkpoints section below has the whole of it.
|
|
18
|
+
|
|
19
|
+
A framed `[specs]` line never starts this skill: such a line is information for a run already going, and it instructs nobody.
|
|
16
20
|
|
|
17
21
|
## The web session
|
|
18
22
|
|
|
@@ -27,7 +31,9 @@ The answer holds `root` - the directory the tab serves - and the stage catalog.
|
|
|
27
31
|
A refusal means there is no pane.
|
|
28
32
|
Say this and stop:
|
|
29
33
|
|
|
30
|
-
> This works in the chamba web session, where the Specs tab holds your work. Open the browser window this container printed at start, or run `webterm` in the terminal to get the address again. Then
|
|
34
|
+
> This works in the chamba web session, where the Specs tab holds your work. Open the browser window this container printed at start, or run `webterm` in the terminal to get the address again. Then ask for this skill there.
|
|
35
|
+
|
|
36
|
+
Say the command in the spelling of the session's own agent.
|
|
31
37
|
|
|
32
38
|
Start no flow, and offer no substitute.
|
|
33
39
|
|
|
@@ -37,12 +43,15 @@ Start no flow, and offer no substitute.
|
|
|
37
43
|
A pause, a blocked run, a choice of spec: each one is a gate or a round on the tab.
|
|
38
44
|
Declaring one ends your turn.
|
|
39
45
|
The pane types one line into this terminal when the user answers, and that line starts you again.
|
|
46
|
+
A line saying a question was asked is not an answer: the user wants to know something before they decide, the ask is still open, and the form is still on their screen.
|
|
47
|
+
Answer it here in plain message text, and leave the ask standing.
|
|
40
48
|
|
|
41
49
|
`/dx-spec` carries the payload shapes, under **The verbs**.
|
|
42
50
|
Read that section for the exact JSON.
|
|
43
51
|
|
|
44
52
|
**Everything you tell the user while building is normal message text.**
|
|
45
|
-
A progress report is not a question.
|
|
53
|
+
A progress report is not a question, and it is not a stop.
|
|
54
|
+
Say it, and go straight on to the next thing in the same turn.
|
|
46
55
|
|
|
47
56
|
**Post the run as it moves**, so the board shows it live:
|
|
48
57
|
|
|
@@ -56,6 +65,29 @@ echo '{"round":1,"verdict":"holds, one for you","findings":6,"judgments":1}' | s
|
|
|
56
65
|
|
|
57
66
|
A phase's id is its file's name without the extension, which is what you already write and tick.
|
|
58
67
|
|
|
68
|
+
## The run does not stop on its own
|
|
69
|
+
|
|
70
|
+
The `pauses` decision is the only thing that stops this run for the user.
|
|
71
|
+
`"pauses": "none"` means you build every phase, from the first to the last, and give the turn back once.
|
|
72
|
+
|
|
73
|
+
Four things end your turn, and nothing else does:
|
|
74
|
+
|
|
75
|
+
- A pause the decisions put there.
|
|
76
|
+
- A stop condition from **Stop and ask**.
|
|
77
|
+
- An ask this skill itself sends you to the tab with: the branch gate, and a decision card for a review finding that is the user's to judge. Declaring one ends your turn, as it does everywhere in this family.
|
|
78
|
+
- The end of the run, where the report goes.
|
|
79
|
+
|
|
80
|
+
A review checkpoint is not one of them.
|
|
81
|
+
Run it, fix what it found, and start the next phase in the same turn.
|
|
82
|
+
Finishing a phase is not one of them either, however much there is to say about it.
|
|
83
|
+
|
|
84
|
+
Waiting for a reviewer you started is not a stop.
|
|
85
|
+
Where your environment makes you give the turn back to hear one, say that you are waiting, and carry the run on the moment the answer arrives.
|
|
86
|
+
|
|
87
|
+
A run that gives the turn back with a phase left to build has failed, unless it is at one of the four.
|
|
88
|
+
Before you end a turn, name which of the four you are at.
|
|
89
|
+
With none of them, you are not finished: go on to the next step.
|
|
90
|
+
|
|
59
91
|
## The tool owns the state
|
|
60
92
|
|
|
61
93
|
The Specs tool writes `state.json` and each spec's `README.md`.
|
|
@@ -71,9 +103,36 @@ The tab lists it beside the other artifacts and renders it.
|
|
|
71
103
|
A page about anything else goes to the Pages tab with `webpane`.
|
|
72
104
|
Either way, keep it standalone: no external stylesheet, no script that fetches anything, and images as data URLs.
|
|
73
105
|
|
|
106
|
+
## The run decisions are the user's instruction
|
|
107
|
+
|
|
108
|
+
`runDecisions` in the state holds how this run is shaped: the commits, the branch, the pauses and the review checkpoints.
|
|
109
|
+
The user settled every one of them on the execute form, in the act that started this run, and all of it binds you.
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
{ "commits": "per-phase", "branch": "new", "branchName": "spec/checkout-discounts",
|
|
113
|
+
"pauses": "chosen", "pausePhases": ["phase-03-the-banner"],
|
|
114
|
+
"checkpoints": [
|
|
115
|
+
{ "after": "final", "why": "judges the finished work as a whole",
|
|
116
|
+
"panel": ["correctness against the spec", "docs consistency"], "chosen": true } ],
|
|
117
|
+
"decidedAt": "2026-08-31T09:12:04.118Z" }
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Read each field as it is written, and never read around it:
|
|
121
|
+
|
|
122
|
+
- `pausePhases` counts only where `pauses` is `chosen`. A list left standing beside `none` or `every` is not a pause.
|
|
123
|
+
- A checkpoint counts only where its `chosen` is true. One that is false stays in the record and does not run.
|
|
124
|
+
- `branchName` counts only where `branch` is `new`.
|
|
125
|
+
|
|
126
|
+
**A spec with no `runDecisions` is a spec whose run was never set up.**
|
|
127
|
+
Say so, name the Execute action on the tab as where it is settled, and stop.
|
|
128
|
+
An old spec may carry lines in `plan/PLAN.md` that describe how its run was once meant to go.
|
|
129
|
+
Those lines are not the decisions and never override them.
|
|
130
|
+
The form never reads them: it opens on the recommendations where there are any, and on the built-in defaults where there are none.
|
|
131
|
+
So where the state holds decisions they bind you, and where it holds none there is nothing to act on, whatever `PLAN.md` says.
|
|
132
|
+
|
|
74
133
|
## The plan is the user's instruction
|
|
75
134
|
|
|
76
|
-
The user chose everything in the plan at spec time: the
|
|
135
|
+
The user chose everything in the plan at spec time: the phases, the verify steps, and the principles check with its recorded deviations.
|
|
77
136
|
All of it binds this run.
|
|
78
137
|
|
|
79
138
|
A recorded deviation is an approved exception.
|
|
@@ -91,8 +150,15 @@ The plan loses to the user, and never to you.
|
|
|
91
150
|
|
|
92
151
|
## 0. Bootstrap
|
|
93
152
|
|
|
94
|
-
|
|
95
|
-
|
|
153
|
+
Settle the root and the principles first:
|
|
154
|
+
|
|
155
|
+
1. Read `root` from `specs stages`. That is the directory the Specs tab serves, and every path in this family resolves against it.
|
|
156
|
+
2. Read `<root>/principles.md`. It is plain markdown: a `# Principles` heading, then one `- <principle>` bullet each, and nothing else.
|
|
157
|
+
3. Where no file is there, write one from `../dx-spec/references/principles-template.md`. Say in one line that you made it, and carry straight on.
|
|
158
|
+
4. Honor every principle the file holds for the rest of the run, best-effort - which is the standing each one has, and no more. A file with no bullets holds no principles, so there is nothing to honor.
|
|
159
|
+
|
|
160
|
+
A file that is already there produces no message at all.
|
|
161
|
+
Nothing else about how this family works is configurable, and the user changes a principle by editing that file.
|
|
96
162
|
|
|
97
163
|
## 1. Choose the spec
|
|
98
164
|
|
|
@@ -114,20 +180,21 @@ Declare the round on the likeliest candidate, because every asking verb names a
|
|
|
114
180
|
Change nothing until the user answers.
|
|
115
181
|
|
|
116
182
|
With no candidate at all, ask nothing.
|
|
117
|
-
Say there is no open work, name
|
|
183
|
+
Say there is no open work, name the `dx-spec` skill as where a spec gets written, and stop.
|
|
118
184
|
|
|
119
185
|
Then read, in this order: `specs state <spec>`, `spec/SPEC.md`, and `plan/PLAN.md`.
|
|
120
186
|
Do not read a phase file yet. Read or write one when its phase starts.
|
|
121
187
|
|
|
122
|
-
Handle these
|
|
188
|
+
Handle these three states before anything else:
|
|
123
189
|
|
|
124
|
-
- No `plan/` directory: say this spec has no execution plan, say
|
|
190
|
+
- No `plan/` directory: say this spec has no execution plan, say the `dx-spec` skill adds one, and stop.
|
|
125
191
|
- Every phase ticked: say so, and stop.
|
|
192
|
+
- No `runDecisions` in the state: say the run is not set up yet, name the Execute action on the tab as where that happens, and stop.
|
|
126
193
|
|
|
127
194
|
## 2. Work out where things stand
|
|
128
195
|
|
|
129
196
|
Work it out from disk alone.
|
|
130
|
-
Say it in a message before you do anything, together with what the
|
|
197
|
+
Say it in a message before you do anything, together with what the decisions ask for: where this run pauses, and where it gets reviewed.
|
|
131
198
|
The user then knows from the start where this run stops and where it gets reviewed.
|
|
132
199
|
|
|
133
200
|
**The phases.**
|
|
@@ -139,15 +206,14 @@ The user then knows from the start where this run stops and where it gets review
|
|
|
139
206
|
- The state file carries a dated line for each completed review checkpoint. A checkpoint whose phases are all done with no such line has not run. Run it before you move on.
|
|
140
207
|
|
|
141
208
|
**The commits.**
|
|
142
|
-
|
|
209
|
+
`commits` is `per-phase`, `single` or `none`.
|
|
143
210
|
It says how much of the record the repository itself shows:
|
|
144
211
|
|
|
145
|
-
- `per
|
|
212
|
+
- `per-phase`: a completed phase is a committed phase, and uncommitted changes belong to the phase that was interrupted.
|
|
146
213
|
- `single` or `none`: nothing is committed before the run ends, if at all. The phase status lines and the ticked boxes are the only record.
|
|
147
214
|
|
|
148
|
-
Read
|
|
149
|
-
`current` means the commits land on the
|
|
150
|
-
Any other value names a branch for this run.
|
|
215
|
+
Read `branch` with it.
|
|
216
|
+
`current` means the commits land on the branch that is checked out, and `new` means they land on the branch `branchName` names.
|
|
151
217
|
|
|
152
218
|
**A state that does not match.**
|
|
153
219
|
When the disk does not hold what this skill expects, settle it with judgment and say what you chose in the report.
|
|
@@ -195,7 +261,7 @@ Every phase goes through the same steps, and you carry out every one yourself.
|
|
|
195
261
|
|
|
196
262
|
4. **Record.** Set the phase's `Status:` to `done`, tick its box in `PLAN.md`, and post the phase as `done`.
|
|
197
263
|
|
|
198
|
-
With `
|
|
264
|
+
With `"commits": "per-phase"`: commit the phase's changes with a one-line message in the commit style, using "phase NN - <name>" as its descriptive part. The style is stated once, in `dx-spec/SKILL.md` under **The commit style**, and a phase commit takes the type that suits what the phase did. Commit only. Never push.
|
|
199
265
|
|
|
200
266
|
With `single` or `none`: commit nothing here.
|
|
201
267
|
|
|
@@ -203,50 +269,67 @@ Every phase goes through the same steps, and you carry out every one yourself.
|
|
|
203
269
|
|
|
204
270
|
Then, in this order:
|
|
205
271
|
|
|
206
|
-
- The review checkpoint after this phase, when the
|
|
207
|
-
- The pause after this phase, when the
|
|
272
|
+
- The review checkpoint after this phase, when the decisions put one there.
|
|
273
|
+
- The pause after this phase, when the decisions put one there.
|
|
208
274
|
|
|
209
275
|
A pause therefore always reports a result that is already reviewed and fixed.
|
|
276
|
+
Where no pause sits after this phase, the next phase starts in the same turn.
|
|
210
277
|
|
|
211
278
|
**On the first phase of a run**, post the status as `executing`.
|
|
212
279
|
|
|
213
|
-
**Before that first phase,
|
|
280
|
+
**Before that first phase, commit the run decisions**, where the spec directory is already committed.
|
|
281
|
+
The decisions the user made are part of the record of this work, so the spec directory is committed on the branch that is checked out now, before any move to the run's branch.
|
|
282
|
+
What lands is whatever of that directory the repository keeps: the rendered `README.md` always, and the state file where the repository does not ignore it.
|
|
283
|
+
Stage the spec directory by path, and compose the message from **The commit style** in `../dx-spec/SKILL.md`, with "<spec name> run set up" as the descriptive part.
|
|
284
|
+
This one commit happens whatever `commits` says, `none` included: it records what the user decided, not what this run built.
|
|
285
|
+
Where the spec directory holds nothing uncommitted, there is nothing to commit and nothing to say.
|
|
286
|
+
Where it was never committed at all, commit nothing, and say so in the report.
|
|
287
|
+
|
|
288
|
+
**Then, where `branch` is `new`**, put the run on the branch `branchName` names:
|
|
214
289
|
|
|
215
290
|
- Already on it: carry on.
|
|
216
291
|
- It exists but is not checked out: switch to it.
|
|
217
292
|
- It does not exist: create it from the current `HEAD`.
|
|
218
293
|
|
|
219
294
|
When the working tree holds changes that do not belong to this work, gate it on the tab before you switch or create: move to the branch and bring those changes along, or stay where you are and commit on the current branch.
|
|
220
|
-
When the user stays, say in the report that this run's commits did not go to the
|
|
295
|
+
When the user stays, say in the report that this run's commits did not go to the branch that was decided.
|
|
221
296
|
|
|
222
297
|
Never merge, and never push. Merging the work back is the user's job.
|
|
223
298
|
|
|
224
|
-
**The final commit with `
|
|
299
|
+
**The final commit with `"commits": "single"`.**
|
|
225
300
|
Once the last phase passes its verify steps and finishes its record step, commit everything this work produced, in one commit.
|
|
226
|
-
Compose the message from
|
|
301
|
+
Compose the message from **The commit style** in `dx-spec/SKILL.md`, with the `PLAN.md` title as its descriptive part.
|
|
227
302
|
That commit also covers earlier runs of the same work, which committed nothing.
|
|
228
303
|
Make it before the final review checkpoint: a final checkpoint must never read an uncommitted tree when commits are on.
|
|
304
|
+
`single` counts what the run built.
|
|
305
|
+
The run-decisions commit at the start and the closing commit at the end stand outside that count: each one carries the record of the run rather than the work, and each one happens on its own terms.
|
|
229
306
|
|
|
230
|
-
With `
|
|
307
|
+
With `"commits": "none"`, commit nothing this run built, at any point.
|
|
308
|
+
The run-decisions commit above is not one of the run's commits, and happens either way.
|
|
231
309
|
|
|
232
310
|
**Keep the spec true.**
|
|
233
311
|
When what gets built differs from `spec/SPEC.md` or the plan, update those files as part of the phase.
|
|
234
312
|
The spec is the documentation of what was actually built.
|
|
313
|
+
`/dx-spec` carries the rule over this, under **Keep what derives from a change true**: what derives from the document you changed is refreshed in the same act.
|
|
235
314
|
When the solution departs noticeably from an approved solution sketch, that is a stop condition: the sketch does not bind you, but the user approved it and has to stay informed.
|
|
236
315
|
|
|
237
316
|
### Review checkpoints
|
|
238
317
|
|
|
239
|
-
|
|
240
|
-
Each
|
|
241
|
-
|
|
318
|
+
`checkpoints` says where fresh reviewers judge the work.
|
|
319
|
+
Each one names where it sits in `after` - a phase id, or the word `final` - and holds one focus per reviewer in `panel`.
|
|
320
|
+
A checkpoint runs only where its `chosen` is true; one that is false is a record of what was offered and declined.
|
|
321
|
+
With no chosen checkpoint at all, no review runs, and the report says the user chose none.
|
|
242
322
|
|
|
243
|
-
Run a checkpoint once you record the phase it sits after, and once any commit the
|
|
323
|
+
Run a checkpoint once you record the phase it sits after, and once any commit the decisions ask for has landed.
|
|
244
324
|
Run the `final` checkpoint once the last phase is recorded, any required commit has landed, and before the end-of-run report.
|
|
245
325
|
|
|
246
326
|
**Start one reviewer subagent per focus the checkpoint names.**
|
|
247
327
|
The reviewers share no context: each gets its own prompt, none sees this conversation, none learns what the others found, and you are never one of them.
|
|
248
328
|
A reviewer's whole value comes from judging work it did not do.
|
|
249
|
-
|
|
329
|
+
|
|
330
|
+
An agent with no subagent tool runs the same passes itself, one focus at a time, and writes each pass's findings down before it starts the next.
|
|
331
|
+
Say in the report that the checkpoint ran inline, and that the fresh-context guarantee did not hold.
|
|
332
|
+
An agent that has the capability but cannot make it work is a different case: that is a stop condition, and it never downgrades quietly.
|
|
250
333
|
|
|
251
334
|
Tell each reviewer:
|
|
252
335
|
|
|
@@ -265,14 +348,18 @@ Then, yourself:
|
|
|
265
348
|
- Re-run the Verify steps of every phase the fixes touch.
|
|
266
349
|
- Have each reviewer who rejected a fix re-check it once.
|
|
267
350
|
- When a reviewer still objects after that re-check, you settle it: fix it once more when the objection names something real, and otherwise record the finding as knowingly accepted and move on.
|
|
268
|
-
- When commits are on, land the fixes in one follow-up commit, with "review fixes" as
|
|
351
|
+
- When commits are on, land the fixes in one follow-up commit, in **The commit style**, with "<spec name> review fixes" as its descriptive part.
|
|
269
352
|
|
|
270
353
|
Post the round with `specs review`, so the board carries its verdict.
|
|
271
354
|
Bring a finding that is the user's to judge to the tab as a decision card, rather than settling it yourself.
|
|
355
|
+
A card names the passage it is about by file and by section, asks one question, and offers the ways out as its own options, one of them recommended.
|
|
356
|
+
`../dx-spec/SKILL.md` carries the shape, under **The verbs**.
|
|
272
357
|
|
|
273
358
|
### Pauses
|
|
274
359
|
|
|
275
|
-
|
|
360
|
+
`pauses` says when the run stops for the user.
|
|
361
|
+
`none` stops nowhere, `every` stops after every phase, and `chosen` stops after each phase `pausePhases` names.
|
|
362
|
+
Read `pausePhases` only where `pauses` is `chosen`: a list beside `none` is what an earlier decision left behind, and it is not a pause.
|
|
276
363
|
|
|
277
364
|
At a pause, once the phase is built, reviewed where a checkpoint sits there, recorded and committed, report what the phase produced in a message.
|
|
278
365
|
Then declare a gate: carry on, or stop here.
|
|
@@ -311,14 +398,40 @@ Settle it, keep the run moving, and say in the report what you settled.
|
|
|
311
398
|
A run that stops to ask about something it could have settled has failed.
|
|
312
399
|
Quality is yours to hold, and the user is waiting for the finished work.
|
|
313
400
|
|
|
314
|
-
## 5.
|
|
401
|
+
## 5. The end of the run
|
|
402
|
+
|
|
403
|
+
Every phase is done, the final checkpoint has run, and its review-fixes commit has landed.
|
|
404
|
+
Then, in this order:
|
|
405
|
+
|
|
406
|
+
```
|
|
407
|
+
echo '{"kind":"status","status":"complete"}' | specs post <spec>
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
The post moves the state file and the rendered `README.md`, so it goes before the commit that carries them.
|
|
411
|
+
|
|
412
|
+
Then, unless `commits` is `none`, stage the spec directory by path and commit it.
|
|
413
|
+
Compose the message from **The commit style** in `dx-spec/SKILL.md`, with "<spec name> complete" as its descriptive part, which makes it a `docs` commit.
|
|
414
|
+
This one commit covers the phase files, the ticked plan, the spec the run kept true, and the rendered board.
|
|
415
|
+
Staging by path leaves every other change in the working tree alone, and the tree is clean over the spec directory once it lands.
|
|
416
|
+
Commit only. Never push.
|
|
417
|
+
|
|
418
|
+
With `"commits": "none"`, post the status and commit nothing.
|
|
419
|
+
The report then says the closing status was left uncommitted, so the user knows the state file and the `README.md` are changed and theirs to keep or to drop.
|
|
315
420
|
|
|
316
|
-
|
|
421
|
+
Then give the report below, which is what ends the turn and says what the closing commit did.
|
|
422
|
+
|
|
423
|
+
## 6. Report
|
|
424
|
+
|
|
425
|
+
This report is what ends a turn.
|
|
426
|
+
Give it at the end of the run, at a pause, or at a stop condition, and nowhere else.
|
|
427
|
+
What you say between phases is a progress line: say it and keep building.
|
|
428
|
+
|
|
429
|
+
Report in a normal message:
|
|
317
430
|
|
|
318
431
|
- The phases finished this run, and the overall progress, such as "5/7 phases done".
|
|
319
|
-
- What the verification showed, and the outcome of every checkpoint this run ran: what the reviewers found, what was fixed, what was dismissed and why. When
|
|
432
|
+
- What the verification showed, and the outcome of every checkpoint this run ran: what the reviewers found, what was fixed, what was dismissed and why. When no checkpoint was chosen, say so.
|
|
320
433
|
- What you settled on your own, where it matters to the user.
|
|
321
434
|
- The branch, when the run committed to one of its own, that it is unmerged, and that merging it back is the user's job.
|
|
435
|
+
- Whether the run decisions were committed, and where they were not, that the spec directory was never committed.
|
|
322
436
|
- Why the run stopped, when it stopped at a pause or a stop condition, and what you need from the user.
|
|
323
|
-
|
|
324
|
-
When every phase is done, post the status as `complete`.
|
|
437
|
+
- Whether the closing commit landed, and under `"commits": "none"`, that the closing status was left uncommitted.
|
package/templates/startup.mjs
CHANGED
|
@@ -71,7 +71,7 @@ try {
|
|
|
71
71
|
|
|
72
72
|
// -- Context snapshot cleanup (best-effort, silent) ---------------------------
|
|
73
73
|
// claude-statusline.sh writes one small per-session snapshot to this directory on every
|
|
74
|
-
// prompt render
|
|
74
|
+
// prompt render, and the web interface's status strip reads it. Delete week-old entries here -- covers both
|
|
75
75
|
// stale *.json snapshots and orphaned .tmp.* files. Any failure is swallowed so cleanup
|
|
76
76
|
// can never affect readiness checks.
|
|
77
77
|
const SNAPSHOT_DIR = "/home/devuser/.claude/context-usage";
|
|
@@ -165,7 +165,8 @@ const doUpdate = (label) =>
|
|
|
165
165
|
});
|
|
166
166
|
});
|
|
167
167
|
|
|
168
|
-
// SPACE within `seconds` -> skip.
|
|
168
|
+
// SPACE within `seconds` -> skip. ENTER -> update now, without waiting out the countdown. Any other input is
|
|
169
|
+
// ignored. Ctrl+C exits 130. Non-TTY -> no skip.
|
|
169
170
|
const promptSkipUpdate = (seconds) =>
|
|
170
171
|
new Promise((resolve) => {
|
|
171
172
|
if (!process.stdin.isTTY) {
|
|
@@ -175,7 +176,7 @@ const promptSkipUpdate = (seconds) =>
|
|
|
175
176
|
let remaining = seconds;
|
|
176
177
|
let tick;
|
|
177
178
|
let timer;
|
|
178
|
-
const line = (s) => `\r\x1b[K${blue("●")} ${dim(`Updating AI CLIs in ${s}s...
|
|
179
|
+
const line = (s) => `\r\x1b[K${blue("●")} ${dim(`Updating AI CLIs in ${s}s... SPACE to skip, ENTER to update now`)}`;
|
|
179
180
|
const cleanup = () => {
|
|
180
181
|
clearInterval(tick);
|
|
181
182
|
clearTimeout(timer);
|
|
@@ -195,6 +196,11 @@ const promptSkipUpdate = (seconds) =>
|
|
|
195
196
|
resolve(true);
|
|
196
197
|
return;
|
|
197
198
|
}
|
|
199
|
+
if (byte === 0x0d || byte === 0x0a) {
|
|
200
|
+
cleanup();
|
|
201
|
+
resolve(false);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
198
204
|
}
|
|
199
205
|
};
|
|
200
206
|
process.stdin.setRawMode(true);
|
|
@@ -221,7 +227,7 @@ if (Number.isFinite(lastUpdate) && Date.now() - lastUpdate < THROTTLE_MS) {
|
|
|
221
227
|
if (summary) console.log("");
|
|
222
228
|
if (!timestampFileExists) {
|
|
223
229
|
await doUpdate("Installing AI CLIs...");
|
|
224
|
-
} else if (await promptSkipUpdate(
|
|
230
|
+
} else if (await promptSkipUpdate(5)) {
|
|
225
231
|
skip("AI CLIs", "update skipped by user");
|
|
226
232
|
} else {
|
|
227
233
|
await doUpdate("Updating AI CLIs to latest...");
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# The agent's half of a pane tool's channel, in this session's web pane.
|
|
3
|
+
# Baked into the image at /usr/local/share/chamba/tool-helper.sh, on PATH as `specs` and as `reviews`.
|
|
4
|
+
#
|
|
5
|
+
# One script, and the tool it is for is the name it was called by. The two channels differ in a word, a door
|
|
6
|
+
# and a list of verbs, and in nothing else: the pane writes a file and types one line into this terminal, and
|
|
7
|
+
# these verbs are how the work moves the other way. Everything they change is a file in the tool's own
|
|
8
|
+
# directory, so every exchange is something git can see.
|
|
9
|
+
#
|
|
10
|
+
# The caller says who it is by its own pid and nothing more, exactly as `webpane` does. The server walks up
|
|
11
|
+
# the process tree from there to a session it started, and refuses a caller that is not in one.
|
|
12
|
+
set -euo pipefail
|
|
13
|
+
|
|
14
|
+
CONTAINER_PORT="${WEBTERM_PORT:-3899}"
|
|
15
|
+
KEY_FILE="${WEBTERM_KEY_FILE:-/tmp/webterm.key}"
|
|
16
|
+
|
|
17
|
+
# Which tool this is. The link's own name, so `specs` and `reviews` are one script with one set of rules.
|
|
18
|
+
TOOL="$(basename "$0")"
|
|
19
|
+
|
|
20
|
+
case "$TOOL" in
|
|
21
|
+
specs | reviews) ;;
|
|
22
|
+
*)
|
|
23
|
+
echo "tool-helper: no pane tool is called ${TOOL}." >&2
|
|
24
|
+
exit 1
|
|
25
|
+
;;
|
|
26
|
+
esac
|
|
27
|
+
|
|
28
|
+
usage_specs() {
|
|
29
|
+
cat <<'TEXT'
|
|
30
|
+
Usage: specs <verb> [<spec>] < payload.json
|
|
31
|
+
|
|
32
|
+
Verbs:
|
|
33
|
+
stages Where the specs live, and every stage a protocol may hold.
|
|
34
|
+
state <spec> Where the work stands: protocol, activity, what awaits the user.
|
|
35
|
+
intake [<spec>] File a new piece of work. { name, text, attachments, wish }
|
|
36
|
+
propose <spec> Recommend a protocol. { stages: [{ id, recommended, why }], note }
|
|
37
|
+
recommend <spec> Recommend how the run is shaped. { commits, branch, branchName, pauses, pausePhases, pauseReasons, noPauseReason, checkpoints }
|
|
38
|
+
await <spec> Declare a gate, a round or a decision card. { id, kind, title, file, payload }
|
|
39
|
+
withdraw <spec> Take back an ask nobody needs to answer. { id, reason }
|
|
40
|
+
post <spec> Say what is happening. { kind: activity | stage | phase | plan | status | note, ... }
|
|
41
|
+
review <spec> Post a round of quality review. { round, verdict, findings, judgments }
|
|
42
|
+
answers <spec> Read back what the user answered. { id }
|
|
43
|
+
|
|
44
|
+
A payload is JSON on stdin, where the verb takes one. The answer is JSON on stdout.
|
|
45
|
+
TEXT
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
usage_reviews() {
|
|
49
|
+
cat <<'TEXT'
|
|
50
|
+
Usage: reviews <verb> [<review>] < payload.json
|
|
51
|
+
|
|
52
|
+
Verbs:
|
|
53
|
+
stages Where the reviews live, and what a review may hold.
|
|
54
|
+
state <review> The state, the baseline's summary, and what awaits whom.
|
|
55
|
+
start File a review from this terminal. { name, selection }
|
|
56
|
+
metadata <review> Post the grouping and the notes for the baseline. { fingerprint, groups, notes }
|
|
57
|
+
reply <review> Append one reply to a thread. { thread, text }
|
|
58
|
+
activity <review> Say what you are doing. { said }
|
|
59
|
+
done <review> End your act; the tool recomputes the baseline where one is due.
|
|
60
|
+
log <review> One dated line for the activity log. { said }
|
|
61
|
+
|
|
62
|
+
A payload is JSON on stdin, where the verb takes one. The answer is JSON on stdout.
|
|
63
|
+
|
|
64
|
+
Nothing here marks a hunk seen, closes a thread, approves, or changes the baseline of its own accord.
|
|
65
|
+
Those are the reviewer's, through the tab.
|
|
66
|
+
TEXT
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
VERB="${1:-}"
|
|
70
|
+
ENTRY="${2:-}"
|
|
71
|
+
|
|
72
|
+
case "$VERB" in
|
|
73
|
+
"" | -h | --help)
|
|
74
|
+
"usage_${TOOL}"
|
|
75
|
+
exit 0
|
|
76
|
+
;;
|
|
77
|
+
esac
|
|
78
|
+
|
|
79
|
+
if [ ! -r "$KEY_FILE" ]; then
|
|
80
|
+
echo "${TOOL}: the web interface is not running in this container, so there is no pane to tell." >&2
|
|
81
|
+
exit 1
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
# A payload is read only for a verb that takes one. The verbs that carry none never touch stdin: an agent's
|
|
85
|
+
# shell often runs with a stdin that is neither a terminal nor closed - a socket, an open pipe - and a read on
|
|
86
|
+
# it waits for a close that never comes, which hangs the agent rather than answering it. So what is read is a
|
|
87
|
+
# pipe or a file, which is what a payload arrives on, and nothing else is read at all.
|
|
88
|
+
#
|
|
89
|
+
# The list is every such verb of either tool: `stages` and `state` read, and `reviews done` says its one thing
|
|
90
|
+
# by being called. A name no tool has is refused by the server whatever happens here.
|
|
91
|
+
BODY_FILE="$(mktemp)"
|
|
92
|
+
REQUEST_FILE="$(mktemp)"
|
|
93
|
+
PAYLOAD_FILE="$(mktemp)"
|
|
94
|
+
trap 'rm -f "$BODY_FILE" "$REQUEST_FILE" "$PAYLOAD_FILE"' EXIT
|
|
95
|
+
|
|
96
|
+
# The payload lands in a file rather than in a variable, because it is passed to jq and an argument has a
|
|
97
|
+
# size limit of its own: the grouping of a large review is hundreds of kilobytes, which is well under what
|
|
98
|
+
# the server accepts and over what one argument can carry.
|
|
99
|
+
echo -n "null" >"$PAYLOAD_FILE"
|
|
100
|
+
case "$VERB" in
|
|
101
|
+
stages | state | done) ;;
|
|
102
|
+
*)
|
|
103
|
+
if [ -p /dev/stdin ] || [ -f /dev/stdin ]; then
|
|
104
|
+
cat >"$PAYLOAD_FILE"
|
|
105
|
+
if [ ! -s "$PAYLOAD_FILE" ]; then
|
|
106
|
+
echo -n "null" >"$PAYLOAD_FILE"
|
|
107
|
+
fi
|
|
108
|
+
fi
|
|
109
|
+
;;
|
|
110
|
+
esac
|
|
111
|
+
|
|
112
|
+
# The request is composed with jq so the payload stays JSON rather than being spliced into a string. jq is in
|
|
113
|
+
# the image; without it there is no safe way to build this, so the helper says so instead of guessing.
|
|
114
|
+
if ! command -v jq >/dev/null 2>&1; then
|
|
115
|
+
echo "${TOOL}: jq is not in this container, and the request cannot be composed without it." >&2
|
|
116
|
+
exit 1
|
|
117
|
+
fi
|
|
118
|
+
|
|
119
|
+
# `--slurpfile` reads the payload as JSON from the file, and jq's own words are kept: a payload that is
|
|
120
|
+
# not JSON and a payload too large to read say different things, and an agent told the wrong one rewrites
|
|
121
|
+
# correct JSON for ever.
|
|
122
|
+
if ! SAID="$(jq -n --arg verb "$VERB" --arg entry "$ENTRY" --slurpfile payload "$PAYLOAD_FILE" \
|
|
123
|
+
'{ verb: $verb, entry: $entry, payload: $payload[0] }' 2>&1 >"$REQUEST_FILE")"; then
|
|
124
|
+
echo "${TOOL}: the payload on stdin is not JSON - ${SAID}" >&2
|
|
125
|
+
exit 1
|
|
126
|
+
fi
|
|
127
|
+
|
|
128
|
+
# How long an answer is waited for. Most verbs write a file and answer; `start` and `done` recompute a
|
|
129
|
+
# baseline, which reads the whole diff of a selection and every blob in it, and a wait that ran out there
|
|
130
|
+
# would tell the agent the act failed while the interface was still doing it.
|
|
131
|
+
case "$VERB" in
|
|
132
|
+
start | done) DEADLINE=300 ;;
|
|
133
|
+
*) DEADLINE=30 ;;
|
|
134
|
+
esac
|
|
135
|
+
|
|
136
|
+
# $$ is this script's own pid. The server climbs from it to whichever session started it.
|
|
137
|
+
STATUS="$(
|
|
138
|
+
curl -sS -o "$BODY_FILE" -w '%{http_code}' \
|
|
139
|
+
--connect-timeout 3 --max-time "$DEADLINE" \
|
|
140
|
+
-X POST \
|
|
141
|
+
-H "Content-Type: application/json" \
|
|
142
|
+
-H "X-Webterm-Key: $(head -n 1 "$KEY_FILE")" \
|
|
143
|
+
-H "X-${TOOL^}-Pid: $$" \
|
|
144
|
+
--data-binary "@${REQUEST_FILE}" \
|
|
145
|
+
"http://127.0.0.1:${CONTAINER_PORT}/${TOOL}/agent" 2>/dev/null
|
|
146
|
+
)" || {
|
|
147
|
+
echo "${TOOL}: could not reach the web interface on this container's port ${CONTAINER_PORT}." >&2
|
|
148
|
+
exit 1
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if [ "$STATUS" = "200" ]; then
|
|
152
|
+
jq . <"$BODY_FILE"
|
|
153
|
+
exit 0
|
|
154
|
+
fi
|
|
155
|
+
|
|
156
|
+
REASON="$(jq -r '.error // empty' <"$BODY_FILE" 2>/dev/null)"
|
|
157
|
+
if [ -z "$REASON" ]; then
|
|
158
|
+
case "$STATUS" in
|
|
159
|
+
403) REASON="the key on disk is not the one the interface is using" ;;
|
|
160
|
+
409) REASON="this is not running inside a web session" ;;
|
|
161
|
+
413) REASON="the payload is too large" ;;
|
|
162
|
+
*) REASON="the interface answered ${STATUS}" ;;
|
|
163
|
+
esac
|
|
164
|
+
fi
|
|
165
|
+
echo "${TOOL}: nothing was done - ${REASON}." >&2
|
|
166
|
+
exit 1
|