chamba 0.7.0 → 0.9.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 +34 -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 +15 -22
- package/templates/claude-statusline.sh +5 -7
- package/templates/context/baseline.md +4 -2
- package/templates/context/web-pane-craft.md +1 -1
- package/templates/pane-apps/client/assets/api-BBDf_rzz.js +12 -0
- package/templates/pane-apps/client/assets/api-DNLbSBpK.css +1 -0
- package/templates/pane-apps/client/assets/bee-B7t97l5B.webp +0 -0
- package/templates/pane-apps/client/assets/buzz-CUUsbnXH.mp3 +0 -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-BkmyervY.js +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/home-3SeGzySM.css +1 -0
- package/templates/pane-apps/client/assets/home-Cu9xOd2i.js +1 -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/pop-D5ZANBC3.mp3 +0 -0
- package/templates/pane-apps/client/assets/python-CYQee8m4.json +4174 -0
- package/templates/pane-apps/client/assets/reviews-DMrGB-kG.js +153 -0
- package/templates/pane-apps/client/assets/reviews-nK_yRav9.css +1 -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-Cabb15F0.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/useNow-BHFKFraS.js +1 -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/home/index.html +16 -0
- package/templates/pane-apps/client/reviews/index.html +17 -0
- package/templates/pane-apps/client/specs/index.html +4 -2
- package/templates/pane-apps/server/home.mjs +12 -0
- package/templates/pane-apps/server/reviews.mjs +21 -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 +136 -0
- package/templates/skills/dx-review/references/acts.md +233 -0
- package/templates/skills/dx-spec/SKILL.md +230 -30
- package/templates/skills/dx-spec/references/principles-template.md +2 -0
- package/templates/skills/dx-spec/references/review-guide.md +6 -52
- package/templates/skills/dx-spec/references/spec-guide.md +25 -5
- package/templates/skills/dx-spec/references/stages.md +149 -60
- package/templates/skills/dx-spec-execute/SKILL.md +217 -38
- package/templates/startup.mjs +22 -16
- package/templates/tool-helper.sh +168 -0
- package/templates/webterm/README.md +82 -27
- package/templates/webterm/color.js +61 -0
- package/templates/webterm/config.js +55 -4
- package/templates/webterm/context/claude.md +0 -1
- package/templates/webterm/public/app/alerts.js +95 -14
- package/templates/webterm/public/app/anchored.js +81 -0
- package/templates/webterm/public/app/composer.js +37 -3
- package/templates/webterm/public/app/connection.js +23 -0
- package/templates/webterm/public/app/dom.js +3 -0
- package/templates/webterm/public/app/frames.js +52 -18
- package/templates/webterm/public/app/home-host.js +16 -0
- package/templates/webterm/public/app/main.js +24 -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 +169 -0
- package/templates/webterm/public/app/pane-shell.js +240 -135
- package/templates/webterm/public/app/pane.js +39 -24
- package/templates/webterm/public/app/reviews-host.js +19 -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 +318 -0
- package/templates/webterm/public/app/workspace-color.js +192 -0
- package/templates/webterm/public/index.html +22 -4
- package/templates/webterm/public/styles.css +195 -21
- package/templates/webterm/server.js +198 -150
- package/templates/webterm/tool-document.js +3 -2
- package/templates/webterm/tools/commands.js +61 -0
- package/templates/webterm/tools/home.js +58 -0
- package/templates/webterm/tools/index.js +26 -0
- package/templates/webterm/tools/mount.js +337 -0
- package/templates/webterm/tools/paths.js +34 -0
- package/templates/webterm/tools/reviews.js +137 -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
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: dx-spec-config
|
|
3
|
-
description: View and change the settings and principles the dx-spec skills honor - commit style, saved planning answers, and the engineering principles - and define the one-time setup the other dx-spec skills offer at start. User-invoked only.
|
|
4
|
-
disable-model-invocation: true
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# dx-spec config - the user's preferences
|
|
8
|
-
|
|
9
|
-
This skill runs when the user types `/dx-spec-config`. It never starts on its own.
|
|
10
|
-
|
|
11
|
-
The skill owns one file: the principles file beside the specs.
|
|
12
|
-
It writes that file the first time, it runs a wizard to change it, and it runs a doctor that checks it against the shape below.
|
|
13
|
-
`/dx-spec` and `/dx-spec-execute` only read it.
|
|
14
|
-
The init flow is the one flow this skill offers the other two.
|
|
15
|
-
|
|
16
|
-
## The web session
|
|
17
|
-
|
|
18
|
-
Every skill in this family runs inside a chamba web session.
|
|
19
|
-
Check for one before anything else:
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
specs stages
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
The answer holds `root` - the directory the Specs tab serves - and the stage catalog.
|
|
26
|
-
A refusal means there is no pane.
|
|
27
|
-
Say this and stop:
|
|
28
|
-
|
|
29
|
-
> 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 run `/dx-spec-config` there.
|
|
30
|
-
|
|
31
|
-
Start no flow, and offer no substitute.
|
|
32
|
-
|
|
33
|
-
## Asking questions
|
|
34
|
-
|
|
35
|
-
The questions in this skill belong to no piece of work, so they do not go on the Specs tab.
|
|
36
|
-
The tab's forms belong to one spec, and settings belong to none.
|
|
37
|
-
Ask them with `AskUserQuestion`.
|
|
38
|
-
When that tool is absent, or refuses a call, ask the question as a normal message and end your turn.
|
|
39
|
-
Then wait. Do not do the thing the question was there to confirm.
|
|
40
|
-
|
|
41
|
-
Write a question whose options do not depend on the work as a fenced block tagged `question`, and ask it exactly as written.
|
|
42
|
-
|
|
43
|
-
````markdown
|
|
44
|
-
```question
|
|
45
|
-
Question: <the question text, verbatim>
|
|
46
|
-
Header: <the short chip label, verbatim>
|
|
47
|
-
- <option label>
|
|
48
|
-
<option description>
|
|
49
|
-
- <option label>
|
|
50
|
-
<option description>
|
|
51
|
-
```
|
|
52
|
-
````
|
|
53
|
-
|
|
54
|
-
How to read a block:
|
|
55
|
-
|
|
56
|
-
- Copy the question text, the header, the labels, the descriptions and their order exactly.
|
|
57
|
-
- Angle brackets mark the parts you fill in.
|
|
58
|
-
- A line marked `only when ...` is conditional. Every other line is always there.
|
|
59
|
-
- Never reword a block to fit the moment. Never add an option.
|
|
60
|
-
- `AskUserQuestion` adds its own free-text choice, so no block carries an option that only means "something else".
|
|
61
|
-
|
|
62
|
-
Every question shows 2 options at least and 4 options at most.
|
|
63
|
-
Put the recommended option first, and end its label with `(Recommended)`.
|
|
64
|
-
Keep labels short, and put the reasoning in the descriptions.
|
|
65
|
-
Write for someone who has never used these skills.
|
|
66
|
-
|
|
67
|
-
## The specs root
|
|
68
|
-
|
|
69
|
-
`specs stages` answers with `root`.
|
|
70
|
-
That is the directory the Specs tab serves, and every path in this family resolves against it.
|
|
71
|
-
The principles file is `<root>/principles.md`.
|
|
72
|
-
|
|
73
|
-
## The principles file
|
|
74
|
-
|
|
75
|
-
`<root>/principles.md` is plain markdown.
|
|
76
|
-
It holds a settings section and a principles section, and nothing else.
|
|
77
|
-
|
|
78
|
-
The settings sit under a `## Settings` heading, one `- <key>: <value>` bullet each, under one note line that points at `/dx-spec-config`.
|
|
79
|
-
The principles sit under a `## Principles` heading, one `- <principle>` bullet each.
|
|
80
|
-
The file carries no explanation of a setting, no guidance on writing a principle, and no examples.
|
|
81
|
-
Every run of every skill in this family reads this file, so it holds only what an agent must honor.
|
|
82
|
-
The meaning of each setting lives here, in the skill that writes the file.
|
|
83
|
-
|
|
84
|
-
What each setting holds:
|
|
85
|
-
|
|
86
|
-
- `commit_style` - the shape of every commit message this family makes. `default` names the default style below. Any other value is a plain description of the project's own shape, with an example message in it.
|
|
87
|
-
- `commit_mode` - a saved answer to "should the run commit as it goes?". `prompt` keeps the question, `current-branch` commits on the current branch, `new-branch` commits on a new branch, and `no-commits` leaves the changes in the working tree.
|
|
88
|
-
- `commit_grouping` - a saved answer to "how are those commits grouped?". `prompt` keeps the question, `per phase` commits each phase, and `single` commits once at the end. This setting counts only when the run commits at all.
|
|
89
|
-
- `branch_naming` - the branch name pattern for `commit_mode: new-branch`. `<slug>` in the pattern becomes the spec's own slug.
|
|
90
|
-
|
|
91
|
-
The principles section holds plain engineering principles that every run honors best-effort.
|
|
92
|
-
A principle states its reason when the reason is not obvious.
|
|
93
|
-
A principle states its own scope when it does not apply everywhere.
|
|
94
|
-
When the project's own documents already carry a rule, the principle points at that rule and declares it binding.
|
|
95
|
-
It does not restate the rule.
|
|
96
|
-
The section ships empty, so an empty section means no principles.
|
|
97
|
-
Use this form:
|
|
98
|
-
|
|
99
|
-
```markdown
|
|
100
|
-
- Always recommend two code reviewers at least in an execution plan, because one reviewer shares too many blind spots with the author.
|
|
101
|
-
- Never add a dependency without asking first: a dependency is a cost the project carries for years.
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
A saved answer skips its question, and says nothing.
|
|
105
|
-
The execution-plan stage still records the resolved `Commits:` and `Branch:` lines in `PLAN.md`, whatever their source.
|
|
106
|
-
The plan gate still shows the whole setup, so the user can make an exception for one spec there.
|
|
107
|
-
That exception changes that plan alone, and never this file.
|
|
108
|
-
|
|
109
|
-
The shipped template is `references/principles-template.md`, beside this file.
|
|
110
|
-
A fresh file starts as a copy of it.
|
|
111
|
-
|
|
112
|
-
## The default commit style
|
|
113
|
-
|
|
114
|
-
The default style is the spec name, then a colon, then what the commit did:
|
|
115
|
-
|
|
116
|
-
```
|
|
117
|
-
user-preferences: spec ready
|
|
118
|
-
user-preferences: phase 02 - the consuming skills
|
|
119
|
-
user-preferences: review fixes
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
This skill and its template are the only places that spell the pattern out.
|
|
123
|
-
Every other mention of it says "the default style".
|
|
124
|
-
|
|
125
|
-
The commits this skill makes use `dx-spec` in place of the spec name: `dx-spec: set up config` and `dx-spec: update config`.
|
|
126
|
-
A `commit_style` that is not `default` restyles these the same as any other message.
|
|
127
|
-
|
|
128
|
-
When `commit_style` describes a type-prefixed convention, two families apply:
|
|
129
|
-
|
|
130
|
-
- A spec-level commit touches only spec files, so its type is fixed - `docs`, for example.
|
|
131
|
-
- A work-level commit carries code, so its type comes from what the phase did.
|
|
132
|
-
|
|
133
|
-
## The bootstrap
|
|
134
|
-
|
|
135
|
-
Before its first step, `/dx-spec` and `/dx-spec-execute` do this:
|
|
136
|
-
|
|
137
|
-
1. Read `root` from `specs stages`.
|
|
138
|
-
2. Read `<root>/principles.md` when it is there, and take what parses: the settings it knows, and the principles bullets.
|
|
139
|
-
3. When a setting is missing, unreadable, or holds a value this file does not list, use its default. Say so once, in one line, and name `/dx-spec-config` as where it gets sorted out. Repair nothing here: a run the user is waiting on is not the place to fix a settings file.
|
|
140
|
-
4. With no file there at all, ask the question below. On "set it up now", run the init flow before the run continues.
|
|
141
|
-
5. Apply the settings and the principles for the rest of the run.
|
|
142
|
-
|
|
143
|
-
```question
|
|
144
|
-
Question: You have no settings file for this yet. Should I set one up now?
|
|
145
|
-
Header: Setup
|
|
146
|
-
- Set it up now (Recommended)
|
|
147
|
-
A few questions about how you like to work - how commits are written, and what I may do without asking - and I write the file before we carry on. You answer them once.
|
|
148
|
-
- Carry on without it
|
|
149
|
-
I use the built-in defaults for this run and ask again next time. You can also set it up whenever you like, with /dx-spec-config.
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
A file that reads cleanly produces no message at all.
|
|
153
|
-
The init flow is the only flow a bootstrap runs.
|
|
154
|
-
Checking the file, repairing it and changing it all belong to a direct run of this skill.
|
|
155
|
-
|
|
156
|
-
## Init flow
|
|
157
|
-
|
|
158
|
-
This flow runs when a direct `/dx-spec-config` run finds no principles file, and when a bootstrap offers it and the user agrees.
|
|
159
|
-
|
|
160
|
-
1. Send one short intro message: this family keeps a small settings and principles file beside the specs, this is its one-time setup, and anything chosen here changes later through `/dx-spec-config` or by editing the file.
|
|
161
|
-
2. Work out the project's commit style. Read the project's own commit rules and its recent commit subjects. A clear shape - a type prefix, a ticket key, any consistent pattern - becomes the first option below, written in plain words with an example message from this project. Drop that option when the project shows no consistent shape. A commit this family made in the default style is not a project convention.
|
|
162
|
-
3. Ask the three questions below in one `AskUserQuestion` call.
|
|
163
|
-
|
|
164
|
-
```question
|
|
165
|
-
Question: How should the commits I make be written?
|
|
166
|
-
Header: Commit style
|
|
167
|
-
- <the project's own style, in a few words> (Recommended) (only when the project's commits or rules show a clear shape)
|
|
168
|
-
<the shape found, in plain words, with an example message from this project>.
|
|
169
|
-
- The default style
|
|
170
|
-
The spec name, a colon, then what the commit did.
|
|
171
|
-
- Conventional prefixes (only when the first option is not itself a type-prefix shape)
|
|
172
|
-
A type prefix, then what the commit did: "feat: ...", "fix: ...", "docs: ...", and so on.
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
When the first option is absent, the default style comes first and carries the marker.
|
|
176
|
-
Save the answer as `commit_style`: `default` for the default style, and otherwise a plain description of the shape with an example message in it.
|
|
177
|
-
|
|
178
|
-
```question
|
|
179
|
-
Question: Should runs save their work with git commits as they go?
|
|
180
|
-
Header: Commits
|
|
181
|
-
- Decide per piece of work (Recommended)
|
|
182
|
-
Each execution plan asks this when it is written.
|
|
183
|
-
- Yes, on the current branch
|
|
184
|
-
Every run commits as it goes, on whatever branch is checked out.
|
|
185
|
-
- Yes, on a new branch
|
|
186
|
-
Every run commits on a branch of its own, named by a pattern you can change later.
|
|
187
|
-
- No commits
|
|
188
|
-
Runs leave their changes in your working folder for you to handle.
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
```question
|
|
192
|
-
Question: And when a run commits, how should the commits be grouped?
|
|
193
|
-
Header: Grouping
|
|
194
|
-
- Decide per piece of work (Recommended)
|
|
195
|
-
Each execution plan asks this when it is written.
|
|
196
|
-
- One commit per phase
|
|
197
|
-
Each finished phase is committed on its own.
|
|
198
|
-
- A single commit
|
|
199
|
-
All the work lands in one commit at the end.
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
4. Ask the question below in a second `AskUserQuestion` call, right after those three. It gets its own call, because the answer starts a task and leads to another question.
|
|
203
|
-
|
|
204
|
-
```question
|
|
205
|
-
Question: Should I read your project now and draft the principles I should follow?
|
|
206
|
-
Header: Principles
|
|
207
|
-
- Draft them from the project (Recommended)
|
|
208
|
-
I read your rule documents, the README, the lint and CI setup, and recent commits, and propose a short list for you to look over.
|
|
209
|
-
- Start with none
|
|
210
|
-
The file is written with an empty principles section. You can add principles any time through /dx-spec-config, which offers the same draft from your project.
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
On "draft them from the project": read `CLAUDE.md` and `AGENTS.md`, the README, the lint and CI configs, and recent commits.
|
|
214
|
-
Draft the principles from what they show.
|
|
215
|
-
Point at a rule the project already documents, and declare it binding, rather than restating it.
|
|
216
|
-
Write down the undocumented conventions alone.
|
|
217
|
-
Keep the draft to five or six principles, because every run reads this file.
|
|
218
|
-
Write nothing to disk in this step. Step 5 writes it.
|
|
219
|
-
|
|
220
|
-
On "start with none": keep the template's empty principles section for step 5.
|
|
221
|
-
|
|
222
|
-
5. Write `<root>/principles.md` once: the template, with each setting's value replaced by the answer, and the principles section either drafted or empty.
|
|
223
|
-
6. Only when you drafted principles, ask the user to read them:
|
|
224
|
-
|
|
225
|
-
```question
|
|
226
|
-
Question: I wrote the principles into <root>/principles.md - please read them there. Keep them as they are?
|
|
227
|
-
Header: Principles
|
|
228
|
-
- Keep them (Recommended)
|
|
229
|
-
The file stays as it is.
|
|
230
|
-
- Change them
|
|
231
|
-
Tell me what to add, reword or drop. I rewrite the principles section and ask again.
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
On "change them": rewrite the section from what the user typed, then ask this question again. Loop until they keep it.
|
|
235
|
-
|
|
236
|
-
7. Offer the commit gate below, with the message `dx-spec: set up config` in the confirmed style.
|
|
237
|
-
8. Carry on with whatever the skill was invoked to do.
|
|
238
|
-
|
|
239
|
-
```question
|
|
240
|
-
Question: Should I commit your principles file to git?
|
|
241
|
-
Header: Commit file
|
|
242
|
-
- Commit it (Recommended)
|
|
243
|
-
I commit only <root>/principles.md, with the message "<the composed message>". I never push.
|
|
244
|
-
(only when the working tree holds unrelated changes) Everything else you have changed is left exactly as it is.
|
|
245
|
-
- Don't commit
|
|
246
|
-
The file stays in your working folder for you to handle.
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
On "commit": stage the principles file by path, and commit it. Commit only. Never push.
|
|
250
|
-
|
|
251
|
-
## The doctor
|
|
252
|
-
|
|
253
|
-
The doctor is the check a direct `/dx-spec-config` run makes on an existing file.
|
|
254
|
-
It is the one place file trouble is dealt with.
|
|
255
|
-
No other skill runs it, and it never runs during someone else's work.
|
|
256
|
-
|
|
257
|
-
Compare the user's file against the shape above, by meaning rather than by bytes:
|
|
258
|
-
|
|
259
|
-
- A setting the shape has and the file lacks: propose adding it with its default, and say what it does.
|
|
260
|
-
- A setting whose value is not one this file lists: say what the setting does, name the values that exist, and ask which one is meant.
|
|
261
|
-
- A setting the file holds that this shape no longer has: propose dropping it, because nothing reads it.
|
|
262
|
-
- Text this shape does not have - an opening note, an explanation under a setting, example principles: propose dropping it, because every run reads this file and that material belongs in this skill. Never touch a line under `## Principles` this way. A principle belongs to the user, however it is worded.
|
|
263
|
-
- A whole section the file lacks: treat it as something the user removed. Name what is on offer, and put back only what they ask for.
|
|
264
|
-
- A file that does not read as markdown at all: say so plainly, and offer to write a fresh one, keeping every setting and principle the current file still lets you read.
|
|
265
|
-
|
|
266
|
-
Nothing here is an error, and nothing is applied without asking.
|
|
267
|
-
Say what you found in one short message, then ask:
|
|
268
|
-
|
|
269
|
-
```question
|
|
270
|
-
Question: I compared your settings file with the shape this version expects: <what differs, in a line each>. Bring it up to date?
|
|
271
|
-
Header: Settings file
|
|
272
|
-
- Apply these (Recommended)
|
|
273
|
-
I make those changes. Every setting you chose and every principle you wrote stays exactly as it is.
|
|
274
|
-
- Leave it as it is
|
|
275
|
-
Nothing is changed, and everything keeps working on what your file already says.
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
A partial answer - one change and not another - comes through free text.
|
|
279
|
-
Write into the file whatever the user accepts.
|
|
280
|
-
The commit gate at the end of the run covers it.
|
|
281
|
-
|
|
282
|
-
## Running directly - the wizard
|
|
283
|
-
|
|
284
|
-
When the user types `/dx-spec-config`, read `root` and look at `principles.md`:
|
|
285
|
-
|
|
286
|
-
- No file: run the init flow, minus its last step, and stop there. A file just written needs no doctor.
|
|
287
|
-
- A file there: run the doctor, then the wizard below.
|
|
288
|
-
|
|
289
|
-
Show one short message: the commit style, the saved planning answers, and a short summary of the principles.
|
|
290
|
-
When the section is empty, say plainly that no principles are written yet.
|
|
291
|
-
Then ask:
|
|
292
|
-
|
|
293
|
-
```question
|
|
294
|
-
Question: Anything you want to change?
|
|
295
|
-
Header: Settings
|
|
296
|
-
- Nothing - keep it as it is (Recommended)
|
|
297
|
-
The wizard ends here.
|
|
298
|
-
- The commit style
|
|
299
|
-
How the commits I make are written. I can also work out a fresh proposal from your project's commits.
|
|
300
|
-
- The planning answers
|
|
301
|
-
Whether runs commit as they go, how commits are grouped, and the branch name pattern.
|
|
302
|
-
- The principles
|
|
303
|
-
The principles every run reads at start and honors. I show you the ones you have, and you add, reword or drop them by typing what you want.
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
A setting change reuses the init-flow question for that setting.
|
|
307
|
-
The commit style change offers the same fresh derivation the init flow makes.
|
|
308
|
-
The principles area offers the same derivation too.
|
|
309
|
-
Change the principles and the branch pattern through free text: the user types, you restate, they confirm.
|
|
310
|
-
After each change, ask this question again, so several things change in one run.
|
|
311
|
-
|
|
312
|
-
When the doctor or the wizard changed anything, write the file, then end with the commit gate from the init flow and the message `dx-spec: update config`.
|
|
313
|
-
When nothing changed, end without touching the file.
|
package/templates/specs.sh
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# specs - move a piece of work through the Specs tool in this session's web pane.
|
|
3
|
-
# Baked into the image at /usr/local/share/chamba/specs.sh, on PATH as `specs`.
|
|
4
|
-
#
|
|
5
|
-
# The agent's half of the coordination channel. The pane writes a file and types one line into this terminal;
|
|
6
|
-
# these verbs are how the work moves the other way. Everything they change is a file in the spec directory,
|
|
7
|
-
# so every exchange is something git can see.
|
|
8
|
-
#
|
|
9
|
-
# The caller says who it is by its own pid and nothing more, exactly as `webpane` does. The server walks up
|
|
10
|
-
# the process tree from there to a session it started, and refuses a caller that is not in one.
|
|
11
|
-
set -euo pipefail
|
|
12
|
-
|
|
13
|
-
CONTAINER_PORT="${WEBTERM_PORT:-3899}"
|
|
14
|
-
KEY_FILE="${WEBTERM_KEY_FILE:-/tmp/webterm.key}"
|
|
15
|
-
|
|
16
|
-
usage() {
|
|
17
|
-
cat <<'TEXT'
|
|
18
|
-
Usage: specs <verb> [<spec>] < payload.json
|
|
19
|
-
|
|
20
|
-
Verbs:
|
|
21
|
-
stages Where the specs live, and every stage a protocol may hold.
|
|
22
|
-
state <spec> Where the work stands: protocol, activity, what awaits the user.
|
|
23
|
-
intake [<spec>] File a new piece of work. { name, text, attachments }
|
|
24
|
-
propose <spec> Recommend a protocol. { stages: [{ id, recommended, why }], note }
|
|
25
|
-
await <spec> Declare a gate or a round. { id, kind, title, file, payload }
|
|
26
|
-
post <spec> Say what is happening. { kind: activity | stage | phase | status | note, ... }
|
|
27
|
-
review <spec> Post a round of quality review. { round, verdict, findings, judgments }
|
|
28
|
-
answers <spec> Read back what the user answered. { id }
|
|
29
|
-
|
|
30
|
-
A payload is JSON on stdin, where the verb takes one. The answer is JSON on stdout.
|
|
31
|
-
TEXT
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
VERB="${1:-}"
|
|
35
|
-
SPEC="${2:-}"
|
|
36
|
-
|
|
37
|
-
case "$VERB" in
|
|
38
|
-
"" | -h | --help)
|
|
39
|
-
usage
|
|
40
|
-
exit 0
|
|
41
|
-
;;
|
|
42
|
-
esac
|
|
43
|
-
|
|
44
|
-
if [ ! -r "$KEY_FILE" ]; then
|
|
45
|
-
echo "specs: the web interface is not running in this container, so there is no pane to tell." >&2
|
|
46
|
-
exit 1
|
|
47
|
-
fi
|
|
48
|
-
|
|
49
|
-
# A payload only where one was piped in. A verb that takes none is called with nothing on stdin, and waiting
|
|
50
|
-
# for a terminal to close would hang the agent rather than answer it.
|
|
51
|
-
PAYLOAD="null"
|
|
52
|
-
if [ ! -t 0 ]; then
|
|
53
|
-
PIPED="$(cat)"
|
|
54
|
-
if [ -n "$PIPED" ]; then
|
|
55
|
-
PAYLOAD="$PIPED"
|
|
56
|
-
fi
|
|
57
|
-
fi
|
|
58
|
-
|
|
59
|
-
BODY_FILE="$(mktemp)"
|
|
60
|
-
REQUEST_FILE="$(mktemp)"
|
|
61
|
-
trap 'rm -f "$BODY_FILE" "$REQUEST_FILE"' EXIT
|
|
62
|
-
|
|
63
|
-
# The request is composed with jq so the payload stays JSON rather than being spliced into a string. jq is in
|
|
64
|
-
# the image; without it there is no safe way to build this, so the helper says so instead of guessing.
|
|
65
|
-
if ! command -v jq >/dev/null 2>&1; then
|
|
66
|
-
echo "specs: jq is not in this container, and the request cannot be composed without it." >&2
|
|
67
|
-
exit 1
|
|
68
|
-
fi
|
|
69
|
-
|
|
70
|
-
if ! jq -n --arg verb "$VERB" --arg spec "$SPEC" --argjson payload "$PAYLOAD" \
|
|
71
|
-
'{ verb: $verb, spec: $spec, payload: $payload }' >"$REQUEST_FILE" 2>/dev/null; then
|
|
72
|
-
echo "specs: the payload on stdin is not JSON." >&2
|
|
73
|
-
exit 1
|
|
74
|
-
fi
|
|
75
|
-
|
|
76
|
-
# $$ is this script's own pid. The server climbs from it to whichever session started it.
|
|
77
|
-
STATUS="$(
|
|
78
|
-
curl -sS -o "$BODY_FILE" -w '%{http_code}' \
|
|
79
|
-
--connect-timeout 3 --max-time 30 \
|
|
80
|
-
-X POST \
|
|
81
|
-
-H "Content-Type: application/json" \
|
|
82
|
-
-H "X-Webterm-Key: $(head -n 1 "$KEY_FILE")" \
|
|
83
|
-
-H "X-Specs-Pid: $$" \
|
|
84
|
-
--data-binary "@${REQUEST_FILE}" \
|
|
85
|
-
"http://127.0.0.1:${CONTAINER_PORT}${WEBTERM_SPECS_AGENT_PATH:-/specs/agent}" 2>/dev/null
|
|
86
|
-
)" || {
|
|
87
|
-
echo "specs: could not reach the web interface on this container's port ${CONTAINER_PORT}." >&2
|
|
88
|
-
exit 1
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if [ "$STATUS" = "200" ]; then
|
|
92
|
-
jq . <"$BODY_FILE"
|
|
93
|
-
exit 0
|
|
94
|
-
fi
|
|
95
|
-
|
|
96
|
-
REASON="$(jq -r '.error // empty' <"$BODY_FILE" 2>/dev/null)"
|
|
97
|
-
if [ -z "$REASON" ]; then
|
|
98
|
-
case "$STATUS" in
|
|
99
|
-
403) REASON="the key on disk is not the one the interface is using" ;;
|
|
100
|
-
409) REASON="this is not running inside a web session" ;;
|
|
101
|
-
413) REASON="the payload is too large" ;;
|
|
102
|
-
*) REASON="the interface answered ${STATUS}" ;;
|
|
103
|
-
esac
|
|
104
|
-
fi
|
|
105
|
-
echo "specs: nothing was done - ${REASON}." >&2
|
|
106
|
-
exit 1
|