chamba 0.6.1 → 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.
Files changed (118) hide show
  1. package/LICENSE +53 -14
  2. package/README.md +38 -11
  3. package/dist/commands/advanced.js +7 -278
  4. package/dist/commands/dev.js +11 -612
  5. package/dist/commands/doctor.js +1 -29
  6. package/dist/commands/menu.js +1 -80
  7. package/dist/commands/onboard.js +6 -230
  8. package/dist/commands/settings.js +15 -349
  9. package/dist/lib/agent-commands.js +2 -0
  10. package/dist/lib/agent-context.js +6 -184
  11. package/dist/lib/browser.js +1 -40
  12. package/dist/lib/chamba-yaml.js +10 -191
  13. package/dist/lib/constants.js +1 -125
  14. package/dist/lib/dockerfile-builder.js +41 -260
  15. package/dist/lib/env.js +2 -78
  16. package/dist/lib/git-env.js +1 -21
  17. package/dist/lib/global-config.js +4 -66
  18. package/dist/lib/pnpm-store.js +1 -19
  19. package/dist/lib/ports.js +1 -210
  20. package/dist/lib/safe-rm.js +1 -26
  21. package/dist/lib/sessions.js +2 -34
  22. package/dist/lib/shadows.js +1 -176
  23. package/dist/lib/skills.js +2 -0
  24. package/dist/lib/templates.js +1 -0
  25. package/dist/lib/webterm.js +1 -305
  26. package/dist/lib/workspace-identity.js +4 -260
  27. package/package.json +6 -6
  28. package/templates/Dockerfile +24 -12
  29. package/templates/claude-statusline.sh +5 -7
  30. package/templates/context/baseline.md +2 -0
  31. package/templates/pane-apps/client/assets/c-BNa-DeUl.json +3552 -0
  32. package/templates/pane-apps/client/assets/cpp-B-T4NRoH.json +20239 -0
  33. package/templates/pane-apps/client/assets/csharp-BbxHChhA.json +6010 -0
  34. package/templates/pane-apps/client/assets/css-CWCxuwmz.json +1860 -0
  35. package/templates/pane-apps/client/assets/diff-B-2N89g8.json +154 -0
  36. package/templates/pane-apps/client/assets/docker-DWTvYW26.json +103 -0
  37. package/templates/pane-apps/client/assets/files-D0nJgFAA.js +12 -0
  38. package/templates/pane-apps/client/assets/files-h0K1vZyQ.css +1 -0
  39. package/templates/pane-apps/client/assets/go-B2hyYeNg.json +3156 -0
  40. package/templates/pane-apps/client/assets/graphql-Z6Id2aNO.json +1292 -0
  41. package/templates/pane-apps/client/assets/html-BtzvlIfu.json +2627 -0
  42. package/templates/pane-apps/client/assets/ini-Bn3Twap1.json +108 -0
  43. package/templates/pane-apps/client/assets/java-C7t2dwLO.json +1885 -0
  44. package/templates/pane-apps/client/assets/javascript-DuC2v0C0.json +5996 -0
  45. package/templates/pane-apps/client/assets/json-CwdkWeV5.json +206 -0
  46. package/templates/pane-apps/client/assets/jsonc-MYWDbTU3.json +206 -0
  47. package/templates/pane-apps/client/assets/jsx-Cn8EZuIC.json +5996 -0
  48. package/templates/pane-apps/client/assets/kotlin-CFNOz1gw.json +580 -0
  49. package/templates/pane-apps/client/assets/make-BVnlFCcl.json +629 -0
  50. package/templates/pane-apps/client/assets/markdown-B4Xk2WM_.json +3263 -0
  51. package/templates/pane-apps/client/assets/php-CAQzQmmI.json +4188 -0
  52. package/templates/pane-apps/client/assets/python-CYQee8m4.json +4174 -0
  53. package/templates/pane-apps/client/assets/reviews-BsoGZ35r.css +1 -0
  54. package/templates/pane-apps/client/assets/reviews-iW0Mbn4e.js +153 -0
  55. package/templates/pane-apps/client/assets/ruby-D7R58tus.json +3114 -0
  56. package/templates/pane-apps/client/assets/rust-BFBbFiei.json +1103 -0
  57. package/templates/pane-apps/client/assets/scss-TQRhBkPG.json +1874 -0
  58. package/templates/pane-apps/client/assets/shellscript-DieAkC4W.json +2375 -0
  59. package/templates/pane-apps/client/assets/specs-D9z3neR-.js +13 -0
  60. package/templates/pane-apps/client/assets/sql-Bxd030LV.json +634 -0
  61. package/templates/pane-apps/client/assets/toml-ChrKGzsV.json +430 -0
  62. package/templates/pane-apps/client/assets/tsx-D2e90MFw.json +5996 -0
  63. package/templates/pane-apps/client/assets/typescript-DonXQ_n1.json +5747 -0
  64. package/templates/pane-apps/client/assets/xml-B17r2RXF.json +382 -0
  65. package/templates/pane-apps/client/assets/yaml-CKn4h1zy.json +627 -0
  66. package/templates/pane-apps/client/reviews/index.html +15 -0
  67. package/templates/pane-apps/client/specs/index.html +14 -0
  68. package/templates/pane-apps/server/reviews.mjs +20 -0
  69. package/templates/pane-apps/server/specs.mjs +5 -0
  70. package/templates/skills/chamba-statusline/SKILL.md +7 -19
  71. package/templates/skills/dx-review/SKILL.md +123 -0
  72. package/templates/skills/dx-review/references/acts.md +162 -0
  73. package/templates/skills/dx-spec/SKILL.md +561 -0
  74. package/templates/skills/dx-spec/references/imagination-guide.md +140 -0
  75. package/templates/skills/dx-spec/references/principles-template.md +2 -0
  76. package/templates/skills/dx-spec/references/review-guide.md +127 -0
  77. package/templates/skills/dx-spec/references/spec-guide.md +145 -0
  78. package/templates/skills/dx-spec/references/stages.md +484 -0
  79. package/templates/skills/dx-spec-execute/SKILL.md +437 -0
  80. package/templates/startup.mjs +10 -4
  81. package/templates/tool-helper.sh +166 -0
  82. package/templates/webterm/README.md +79 -9
  83. package/templates/webterm/color.js +61 -0
  84. package/templates/webterm/config.js +74 -0
  85. package/templates/webterm/context/claude.md +0 -1
  86. package/templates/webterm/public/app/alerts.js +4 -4
  87. package/templates/webterm/public/app/anchored.js +81 -0
  88. package/templates/webterm/public/app/composer.js +4 -1
  89. package/templates/webterm/public/app/connection.js +9 -0
  90. package/templates/webterm/public/app/dom.js +15 -5
  91. package/templates/webterm/public/app/frames.js +51 -10
  92. package/templates/webterm/public/app/main.js +26 -6
  93. package/templates/webterm/public/app/new-session.js +13 -41
  94. package/templates/webterm/public/app/palette.js +58 -0
  95. package/templates/webterm/public/app/pane-shape.js +167 -0
  96. package/templates/webterm/public/app/pane-shell.js +380 -0
  97. package/templates/webterm/public/app/pane.js +77 -193
  98. package/templates/webterm/public/app/reviews-host.js +15 -0
  99. package/templates/webterm/public/app/specs-host.js +16 -0
  100. package/templates/webterm/public/app/state.js +5 -0
  101. package/templates/webterm/public/app/tabs.js +6 -2
  102. package/templates/webterm/public/app/terminal.js +8 -0
  103. package/templates/webterm/public/app/theme.js +75 -27
  104. package/templates/webterm/public/app/tool-host.js +302 -0
  105. package/templates/webterm/public/app/workspace-color.js +192 -0
  106. package/templates/webterm/public/index.html +68 -30
  107. package/templates/webterm/public/styles.css +270 -34
  108. package/templates/webterm/server.js +321 -0
  109. package/templates/webterm/tool-document.js +67 -0
  110. package/templates/webterm/tools/commands.js +61 -0
  111. package/templates/webterm/tools/index.js +25 -0
  112. package/templates/webterm/tools/mount.js +337 -0
  113. package/templates/webterm/tools/paths.js +34 -0
  114. package/templates/webterm/tools/reviews.js +133 -0
  115. package/templates/webterm/tools/specs.js +154 -0
  116. package/templates/webterm/typed-line.js +148 -0
  117. package/templates/context/context-usage.md +0 -1
  118. package/templates/context-usage.sh +0 -266
@@ -0,0 +1,162 @@
1
+ # The three acts, in detail
2
+
3
+ Read the act you are doing.
4
+ `SKILL.md` says how you learn which one that is: `reviews state "<review>"`, and then `awaits.act`.
5
+
6
+ Everything here is posted with the verbs of `SKILL.md`, and nothing else writes to a review.
7
+
8
+ ## prepare - the review has a baseline and no grouping
9
+
10
+ The reviewer has filed a review and is waiting to read it.
11
+ Until you post a grouping the screen shows every hunk under "Not grouped yet", which is a wall of diff with no story in it.
12
+ So this act is the one the reviewer waits on longest, and it is the one that decides how the review reads.
13
+
14
+ **1. Read the change before you group it.**
15
+ The state's `baseline` holds every file and, for each one, the id and header of each of its hunks.
16
+ Read the code itself as well - the files of the workspace are there, and the review is of the tree you are in.
17
+ A grouping written from headers alone groups by file, which the tab could have done without you.
18
+
19
+ **2. Group by intent, not by file.**
20
+ A group is a piece of work somebody did: "the discount rules", "the new error path", "the rename that follows from it".
21
+ Three to seven groups reads well for most changesets.
22
+ One group of forty hunks says nothing, and twenty groups of two are the file list again.
23
+
24
+ - A hunk may sit in several groups where it belongs to both.
25
+ - A hunk in no group lands under "Ungrouped", which is the tool's own group. It is for the case where you missed one, and a review that shows it is a review you left half grouped.
26
+ - `ungrouped` in the post's answer is that list. Read it, and post again with the hunks it names in the groups they belong to.
27
+
28
+ **3. Give each group a narrative and its facts.**
29
+ The narrative is a short paragraph in plain language: what this piece of work does, and why the change is what it is.
30
+ The reviewer reads it before the hunks, so it says the thing the diff cannot - the intent.
31
+ The facts are a few short lines of what is true and checkable: "adds one table column", "no call site outside the cart", "the old path stays for one release".
32
+ Facts are facts. Anything that needs "I think" is not one.
33
+
34
+ **4. Write the notes.**
35
+ You read every line of this change, and the reviewer has not.
36
+ The notes are what you learned while you read, beside the code, so that the human review is quick and misses nothing.
37
+ A note is plain text of one kind, on one hunk or on a line range inside it.
38
+
39
+ - `info` - an explanation that helps the reviewer understand the code: what a passage does, why the change is the way it is, what it mirrors elsewhere. "This mirrors the rule in `pricing.ts`." Write one wherever an explanation would save the reviewer a search or a guess.
40
+ - `attention` - anything that deserves the reviewer's eyes, whether or not you found a fault in it: a hard passage, a change of behaviour, a decision with a trade-off, a place you believe is right and a human should confirm. "This drops the guard the caller used to hold." Attention is relative to this changeset: it marks the parts of this change that most need a human.
41
+ - `issue` - something you are certain is wrong. The text says what is wrong in one or two sentences and, where you see it, how to fix it. "The loop never steps `i`, so it never ends. Step it at the end of the body." Write an issue only when you are sure; where you are not, write `attention` and say what you suspect.
42
+
43
+ The screen counts the open `issue` and `attention` notes on each group and in the status bar, so the reviewer sees where the eyes are needed before they read.
44
+ The reviewer can dismiss a note, ask you to fix an issue, or open a conversation on it.
45
+ One note per thing you have to say, and the kind that fits it.
46
+ A note on every hunk is a rail nobody reads, but a hunk that needs an explanation and has none is a question the reviewer has to ask you.
47
+
48
+ **Do not fix anything in this act.**
49
+ You found the issue, and the reviewer decides what to do with it: the fix is an item in the batch they send, and `process` is where you do it.
50
+
51
+ **5. Post it.**
52
+
53
+ ```
54
+ echo '{
55
+ "fingerprint": "sha256:...",
56
+ "groups": [
57
+ { "id": "discount-rules", "name": "Discount rules",
58
+ "narrative": "The rules move out of the cart and into one place ...",
59
+ "facts": ["adds one table column", "no call site outside the cart"],
60
+ "hunks": ["src/cart/discount.ts#9f3a...#1", "src/cart/discount.ts#9f3a...#2"] }
61
+ ],
62
+ "notes": [
63
+ { "hunk": "src/cart/discount.ts#9f3a...#1", "kind": "attention", "lines": [44, 46],
64
+ "text": "This drops the guard the caller used to hold." },
65
+ { "hunk": "src/cart/discount.ts#9f3a...#2", "kind": "issue", "lines": [61],
66
+ "text": "The loop never steps `i`, so it never ends. Step it at the end of the body." }
67
+ ]
68
+ }' | reviews metadata "<review>"
69
+ ```
70
+
71
+ `fingerprint` is the baseline's own, from the state you read.
72
+ `id` is yours to choose and is the name the tool refers to the group by; `name` is what the reviewer reads.
73
+ `kind` is `info`, `attention` or `issue`.
74
+ `lines` are new-side line numbers inside the hunk, and a note without them is about the whole hunk.
75
+ The screen draws one bar in the gutter from the smallest number to the largest, so two numbers name a range.
76
+
77
+ **A post replaces the whole grouping.**
78
+ That is what makes a group appear as it becomes ready: post the groups you have, and post them all again with the next one added.
79
+ The screen then shows three groups, then four.
80
+ A post with no group empties the grouping, which is what it says.
81
+
82
+ **6. Say what you are doing, and finish.**
83
+ Post `activity` as you work through it - "Grouping the parser changes, 3 of 5 ready" - and `done` when the grouping is complete and every note is in.
84
+
85
+ **Say how many groups there will be, in `groups`.**
86
+
87
+ ```
88
+ echo '{ "said": "Grouping the parser changes, 3 of 5 ready", "groups": 5 }' | reviews activity "<review>"
89
+ ```
90
+
91
+ You are the only one who knows it: the tool holds the groups you posted, and the tab draws one card waiting for each group you promised and has not arrived, so the reviewer sees how much is still coming.
92
+ Post it once you know the number, and post the sentence alone after that - the count stands until you post another, and it is cleared when the review goes back to the reviewer.
93
+
94
+ ## process - the reviewer sent a batch
95
+
96
+ `send` in the state is the newest batch: when it was sent, the baseline it was written against, and its `items`.
97
+ Each item is one thing the reviewer asked, and each one has already opened or joined a conversation on the hunk or the group it is about.
98
+
99
+ An item carries:
100
+
101
+ - `hunk` - the hunk it is about, or null for a comment on a group.
102
+ - `group` - the group it is about, and null for everything else.
103
+ - `act` - what the reviewer asked for: `undo` (undo the change), `explain` (explain it in a comment), `comment`, `fix` (fix what a note of yours says), or `group-comment`.
104
+ - `lines` - the new-side lines the item is about, or null for the whole hunk or a group.
105
+ - `text` - what they said, and it may be empty for an `undo` that speaks for itself.
106
+
107
+ **Do the work first, and reply about what you did.**
108
+ The order matters: a reply is a statement about the code, and a reply written before the change is a promise.
109
+
110
+ - `undo` - put that hunk's change back as it was, unless doing so breaks something the reviewer cannot see. Where it does, do not undo it quietly: say what breaks, in the conversation, and leave the code as it is.
111
+ - `explain` - the reviewer wants the reasoning, not a change. Answer in the conversation and change nothing.
112
+ - `fix` - the reviewer read an `issue` note of yours and asks for the fix. The text is the note, with anything they added, and `lines` says where. Fix it, and reply with what you did.
113
+ - `comment` and `group-comment` - read what they asked for and do it. It may be a change, a question, or both.
114
+
115
+ **Reply in the conversation each item is on.**
116
+
117
+ ```
118
+ echo '{ "thread": "<the thread id from the state>", "text": "Undone. The old guard is back, and ..." }' | reviews reply "<review>"
119
+ ```
120
+
121
+ The `threads` in the state hold the id, the anchor and every message, so the thread of an item is the one whose anchor is that item's hunk or group.
122
+ One reply per item, and each one lands live on the reviewer's screen under the hunk they were looking at.
123
+
124
+ You cannot close a conversation, and you should not try to write a reply that reads like a closing.
125
+ The reviewer closes a conversation when they are satisfied, and that is the whole point of the control.
126
+
127
+ **Where an item is unclear, ask in the terminal.**
128
+ Then do the item, and reply once you know what it asked.
129
+ Do not reply with a question: a reply is your answer, and the tab draws it as one.
130
+
131
+ **Finish with `done`.**
132
+ It hands the review back and the tool recomputes the baseline, so the reviewer sees your commits as part of the review and every hunk they had read that you did not touch is still read.
133
+
134
+ ## sync - the baseline moved
135
+
136
+ The reviewer synced the review, stopped you mid-act, or followed a merge.
137
+ Either way the baseline is a new one, and the state's `metadata` is what you posted for the baseline before it.
138
+
139
+ **What is already true, and what you do not have to do again.**
140
+ The tool carried every mark, conversation and pending item onto the hunks that did not change, and it kept the grouping of every hunk that is still there.
141
+ A hunk the reviewer had read whose content changed comes back unread with a "changed since you saw it" marker, which is the tool's, not a note of yours.
142
+
143
+ So this act is the difference, and not the review again:
144
+
145
+ 1. **Group what is new.** `ungrouped` names the hunks no group holds. Most of them are new hunks, and each one belongs in a group that exists or in one more group.
146
+ 2. **Revise what the new code made wrong.** A narrative that describes code that is no longer there is worse than none, because the reviewer reads it as current. Read your own narratives against the new baseline and rewrite the ones that moved.
147
+ 3. **Read your notes again.** The tool dropped the notes of every hunk whose content changed, and kept the rest. Write again only the notes that are still true of the new code, and write notes for what is new. An issue you fixed gets no note: the rail shows the code as it is, not what it was.
148
+ 4. **Answer what is open.** A conversation the reviewer is waiting on is one that is open and whose last message is theirs. Answer it if the new code answers it.
149
+
150
+ Post the whole grouping again, with the new baseline's `fingerprint`, and `done` when it is in.
151
+
152
+ ## The no-act case
153
+
154
+ `awaits.act` is null, so none of the three applies.
155
+ It happens two ways, and both are ordinary.
156
+
157
+ - **`side` is `you`.** The review is with the reviewer. It came back to them when the last act posted `done`, or they stopped you and are reading it now. The command arrived because they asked again, or because it was typed by hand.
158
+ - **`side` is `agent` and `act` is null.** The review is yours and names no act, which is a review that has nothing pending in it.
159
+
160
+ Say so in the terminal, in one line, and post nothing.
161
+ Not `activity`, and not `done`: `done` recomputes the baseline and hands back a review that was never taken, and the reviewer reads that as work that happened.
162
+ Where the review is the reviewer's, every verb that writes is refused in any case, and the refusal is the right answer rather than something to work around.