chamba 0.1.0 → 0.3.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 (77) hide show
  1. package/README.md +50 -2
  2. package/dist/cli.js +662 -161
  3. package/dist/server.js +355 -111
  4. package/inject/annotate.js +18 -49
  5. package/package.json +6 -7
  6. package/skill/SKILL.md +67 -187
  7. package/web/assets/highlighted-body-OFNGDK62-Bn4Eu7CG.js +1 -0
  8. package/web/assets/index-B9DI4F1Z.js +202 -0
  9. package/web/assets/index-DK_n6CTo.css +2 -0
  10. package/web/assets/mermaid-GHXKKRXX-CEMduc-U.js +1 -0
  11. package/web/index.html +17 -2
  12. package/web/assets/abnfDiagram-VRR7QNED-aw1_rWFY.js +0 -1
  13. package/web/assets/arc-BMhSK0Sy.js +0 -1
  14. package/web/assets/architectureDiagram-ZJ3FMSHR-BZDcNKY3.js +0 -36
  15. package/web/assets/blockDiagram-677ZJIJ3-CLVR_gtH.js +0 -132
  16. package/web/assets/c4Diagram-LMCZKHZV-YjWWkNOJ.js +0 -10
  17. package/web/assets/channel-8ymR7Shm.js +0 -1
  18. package/web/assets/chunk-2Q5K7J3B-Bd9qqRl0.js +0 -1
  19. package/web/assets/chunk-32BRIVSS-Cq9EhooX.js +0 -1
  20. package/web/assets/chunk-5VM5RSS4-DYxyelz5.js +0 -15
  21. package/web/assets/chunk-EX3LRPZG-COaiqIlv.js +0 -231
  22. package/web/assets/chunk-JWPE2WC7-CMWXKnkF.js +0 -1
  23. package/web/assets/chunk-MOJQB5TN-BRzAoPL7.js +0 -88
  24. package/web/assets/chunk-RYQCIY6F-BRght6pl.js +0 -1
  25. package/web/assets/chunk-V7JOEXUC-BlbCYGxG.js +0 -206
  26. package/web/assets/chunk-VR4S4FIN-CPoKxaoM.js +0 -1
  27. package/web/assets/chunk-XXDRQBXY-DeNDfu5r.js +0 -1
  28. package/web/assets/classDiagram-OUVF2IWQ-g3gy3kDO.js +0 -1
  29. package/web/assets/classDiagram-v2-EOCWNBFH-g3gy3kDO.js +0 -1
  30. package/web/assets/cose-bilkent-JH36ORCC-C_V1sCw0.js +0 -1
  31. package/web/assets/cynefin-VYW2F7L2-CtWqChj_.js +0 -178
  32. package/web/assets/cynefinDiagram-TSTJHNR4-Q0g7rhQg.js +0 -62
  33. package/web/assets/cytoscape.esm-DTSO7Bv0.js +0 -331
  34. package/web/assets/dagre-VKFMJZFB-spMt8V5o.js +0 -4
  35. package/web/assets/defaultLocale-DX6XiGOO.js +0 -1
  36. package/web/assets/diagram-FQU43EPY-CF7kRW9U.js +0 -3
  37. package/web/assets/diagram-G47NLZAW-B-5ygaqt.js +0 -24
  38. package/web/assets/diagram-NH7WQ7WH-CdOGPV2-.js +0 -24
  39. package/web/assets/diagram-OA4YK3LP-D1_1pb2t.js +0 -30
  40. package/web/assets/diagram-WEI45ONY-gD_xjCgB.js +0 -41
  41. package/web/assets/ebnfDiagram-CCIWWBDH-aW4E-V1v.js +0 -1
  42. package/web/assets/erDiagram-Q63AITRT-BWndxFVg.js +0 -85
  43. package/web/assets/flowDiagram-23GEKE2U-CVc37qLo.js +0 -156
  44. package/web/assets/ganttDiagram-NO4QXBWP-DV-2BraZ.js +0 -292
  45. package/web/assets/gitGraphDiagram-IHSO6WYX-YCy7dADs.js +0 -106
  46. package/web/assets/graph-C9eacEi8.js +0 -1
  47. package/web/assets/highlighted-body-OFNGDK62-q_mVDG84.js +0 -1
  48. package/web/assets/index-BG6acTBk.css +0 -1
  49. package/web/assets/index-CBBSnvKL.js +0 -335
  50. package/web/assets/infoDiagram-FWYZ7A6U-ig4wRILz.js +0 -2
  51. package/web/assets/init-Gi6I4Gst.js +0 -1
  52. package/web/assets/ishikawaDiagram-FXEZZL3T-BE8nJNWr.js +0 -70
  53. package/web/assets/journeyDiagram-5HDEW3XC-_olL4LFF.js +0 -139
  54. package/web/assets/kanban-definition-HUTT4EX6-DTFmbw9d.js +0 -89
  55. package/web/assets/katex-C5jXJg4s.js +0 -257
  56. package/web/assets/layout-DEXfKzaS.js +0 -1
  57. package/web/assets/linear-CbmtQHdI.js +0 -1
  58. package/web/assets/map-Czzmt4hB.js +0 -1
  59. package/web/assets/mermaid.core-CyLpSBwh.js +0 -314
  60. package/web/assets/mindmap-definition-LN4V7U3C-BFXQ_blT.js +0 -96
  61. package/web/assets/ordinal-Cboi1Yqb.js +0 -1
  62. package/web/assets/pegDiagram-2B236MQR-BzFkomCY.js +0 -1
  63. package/web/assets/pieDiagram-ENE6RG2P-r6gWlwuV.js +0 -39
  64. package/web/assets/quadrantDiagram-ABIIQ3AL-DTFxtS0e.js +0 -7
  65. package/web/assets/railroadDiagram-RFXS5EU6-CbZAYLVe.js +0 -1
  66. package/web/assets/requirementDiagram-TGXJPOKE-DzGi5GvN.js +0 -84
  67. package/web/assets/sankeyDiagram-HTMAVEWB-CBWOwAUD.js +0 -40
  68. package/web/assets/sequenceDiagram-DBY2YBRQ-QX9rQ9ow.js +0 -162
  69. package/web/assets/sizeCapture-X5ZJPWSS-X8SU5JUW.js +0 -1
  70. package/web/assets/stateDiagram-2N3HPSRC-kQgWzKK8.js +0 -1
  71. package/web/assets/stateDiagram-v2-6OUMAXLB-2kXWc9Fv.js +0 -1
  72. package/web/assets/swimlanes-5IMT3BWC-eKT1_uaa.js +0 -2
  73. package/web/assets/swimlanesDiagram-G3AALYLV-B5i-k7ui.js +0 -8
  74. package/web/assets/timeline-definition-FHXFAJF6-BRKXt19C.js +0 -120
  75. package/web/assets/vennDiagram-L72KCM5P-C-mbeAXb.js +0 -34
  76. package/web/assets/wardleyDiagram-EHGQE667-Doojx4Uh.js +0 -78
  77. package/web/assets/xychartDiagram-FW5EYKEG-CQZh8Trp.js +0 -7
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "chamba",
3
- "version": "0.1.0",
4
- "description": "A browser workspace paired to your terminal coding agent over one shared conversation.",
3
+ "version": "0.3.0",
4
+ "description": "A browser workspace beside your terminal coding agent - a rich parallel interface to the terminal chat.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "chamba": "dist/cli.js"
8
8
  },
9
9
  "engines": {
10
- "node": ">=20"
10
+ "node": ">=22.12"
11
11
  },
12
12
  "files": [
13
13
  "dist",
@@ -17,11 +17,10 @@
17
17
  "README.md"
18
18
  ],
19
19
  "dependencies": {
20
- "hono": "4.12.27",
20
+ "hono": "4.12.30",
21
21
  "@hono/node-server": "1.19.14",
22
22
  "@hono/node-ws": "1.3.1",
23
- "ws": "8.21.0",
24
- "marked": "18.0.5",
25
- "zod": "3.25.76"
23
+ "ws": "8.21.1",
24
+ "zod": "4.4.3"
26
25
  }
27
26
  }
package/skill/SKILL.md CHANGED
@@ -1,213 +1,93 @@
1
1
  ---
2
2
  name: chamba
3
- description: Open a browser workspace paired to this terminal session so the human can see rendered markdown, paste screenshots the agent can read, and point at UI - one shared conversation between the terminal agent and the browser. Use when the user says /chamba, asks to "open chamba", wants to share or receive images, or wants a visual workspace alongside the terminal.
4
- when_to_use: The user typed /chamba, asked to open the chamba workspace, wants to paste or be shown an image/screenshot, or wants a browser surface paired with this terminal session.
3
+ description: Open a browser workspace beside this terminal session - a second, parallel conversation where the human can see rendered markdown, paste screenshots the agent can read, point at UI, and view rich HTML pages the agent renders. Use when the user says /chamba, asks to "open chamba", wants to share or receive images, or wants a visual workspace alongside the terminal.
4
+ when_to_use: The user typed /chamba, asked to open the chamba workspace, wants to paste or be shown an image/screenshot, or wants a browser surface beside this terminal session.
5
5
  ---
6
6
 
7
7
  # chamba
8
8
 
9
- chamba pairs this terminal session with a browser workspace over one shared
10
- conversation. The terminal stays home base; the browser is where the human reads
11
- rendered markdown, pastes screenshots you can open, and points at UI. A pasted
12
- image arrives as a real file path you can `Read`; anything you send back with a
13
- file renders inline in their browser.
14
-
15
- Every command is `npx chamba@latest <command>`. Conversation content prints on
16
- stdout (what you read and act on); status and hints go to stderr, so a command's
17
- stdout is just the messages. Using `@latest` resolves the newest published
18
- version rather than a stale one npx may have cached.
19
-
20
- ## Opening a session
21
-
22
- ```
23
- npx chamba@latest open --title "what this is about"
24
- ```
25
-
26
- Optionally `--kind spec` for spec work (extra Draft/Mock/Diagram surfaces). This
27
- prints a URL on stdout - give that URL to the human and ask them to open it. The
28
- server starts automatically if it is not already running.
29
-
30
- ## The loop
31
-
32
- After opening (or `attach`), wait for the human:
33
-
34
- ```
35
- npx chamba@latest poll
36
- ```
37
-
38
- `poll` blocks until there is something to read, then prints it and returns. Run it
39
- again to keep waiting - it is safe to re-run (a batch re-delivers if you were
40
- interrupted before acting). React to what each line says:
41
-
42
- - A message from the human (`you: ...`): do the work, then answer with `reply`.
43
- - An attachment line (` [file] name -> /abs/path`): that path is a real file on
44
- disk. `Read` it (screenshots, mockups, logs) and act on what you see.
45
- - An annotation batch (`you [N annotations]:`): the human pointed at elements in
46
- the app tab. Each numbered item carries the comment, the `selector`, the `page`
47
- and `viewport`, a `[shot]` screenshot path to `Read`, and - when the app is
48
- React/Next - the `component:` name and its source `file:line`. Use the source
49
- and selector to find the code, `Read` the shot to see the problem, fix each item,
50
- then `reply`. (React 19 shows the component name but may omit `file:line` unless
51
- the app opted into bippy's source tier; fall back to the selector then.)
52
- - `· You moved to another session (<id>)`: the human switched sessions. Hand off
53
- with `npx chamba@latest attach <id>`, then keep polling that one.
54
- - `· Session ended`: the human handed back to the terminal. Stop polling and
55
- resume terminal work.
9
+ chamba is a browser conversation running beside this terminal one - two separate channels you attend at the same time.
10
+ Every command is `npx chamba@latest <command>`; conversation content prints on stdout, hints and status on stderr.
11
+
12
+ ## Protocol
13
+
14
+ 1. `npx chamba@latest open --title "what this is about"` - prints the session URL.
15
+ Say exactly: `Chamba available at: <url>` and nothing more.
16
+ 2. Launch `npx chamba@latest poll` as a background task.
17
+ It parks silently until the human sends something - hours or days, zero cost.
18
+ 3. When a poll returns: say `From chamba: <one-line gist of what arrived>`, act on it, answer with `reply`, and relaunch the background `poll` immediately.
19
+ While no poll is parked the browser tells the human no agent is listening.
20
+ 4. While the browser exchange is live, tighten the loop: poll in the foreground with `poll --for 240000` (give the command a generous timeout), reply, re-poll.
21
+ When it goes quiet, drop back to a background `poll`.
22
+ 5. Stop only when the session ends (see the cheatsheet).
23
+ Then say exactly: `Chamba stopped. Say the word to reopen.`
24
+
25
+ Do not narrate opening, polling, or switching beyond those one-liners.
26
+ The session is stateless to you: everything lives on disk plus your read cursor, so after any interruption `open` + `poll` puts you exactly back.
27
+ Re-running `open` in the same agent session reconnects to the same session (`--new` forces fresh, `--last` rebinds to the newest active one).
28
+ If `open` reports no git root, ask where the workspace should live and run `init <dir>` once.
29
+
30
+ ## What arrives -> what you do
31
+
32
+ | You see | It means | You do |
33
+ | --- | --- | --- |
34
+ | `you: ...` | a message from the browser | act, then `reply <text>` |
35
+ | `you [re #42 agent: "..."]: ...` | a reply to earlier event #42; the bracket is that event's gist | act with that context; use `reply --to 42` when answering that event specifically |
36
+ | `you [answer in terminal]: ...` | the human wants the answer HERE, in the terminal | answer in the terminal conversation; do not `reply` |
37
+ | ` [file] name -> /abs/path` | an attachment on the message above | `Read` the path (screenshots, mockups, logs) |
38
+ | `you [N annotations]:` | numbered element comments from the app tab or your page | per item: use `selector`/`component`/`file:line` to find the code, `Read` the `[shot]`, fix, then `reply` |
39
+ | `[chamba <id>#<seq> "..."]` pasted here in the terminal | the human is referencing a browser message | run `npx chamba@latest get <id>#<seq>` to print it, then answer in the terminal |
40
+ | Session ended` | the human handed back | stop the loop; say the stop line |
41
+ | `chamba server stopped` | deliberate stop | stop the loop; `open` again only if work should continue |
42
+
43
+ Anything else on stderr (heartbeat, retry note, quiet stretch) means: relaunch `poll` and keep listening.
44
+ Polling is at-least-once: a batch re-delivers if you were interrupted before acting on it.
45
+
46
+ ## Answer where you were asked
47
+
48
+ Terminal input is answered in the terminal; browser input is answered with `reply`.
49
+ Never mirror content between the channels.
50
+ The only overrides are explicit: `[answer in terminal]` and a pasted `[chamba ...]` reference both move that one answer to the terminal.
56
51
 
57
52
  ## Replying
58
53
 
59
54
  ```
60
55
  npx chamba@latest reply on it - here is the diff you asked about
56
+ npx chamba@latest reply here's the chart --image /abs/chart.png
57
+ npx chamba@latest reply --to 42 yes, exactly that one
61
58
  ```
62
59
 
63
- Send a file back (renders in their browser); text is optional alongside it:
64
-
65
- ```
66
- npx chamba@latest reply here's the chart --image /abs/path/to/chart.png
67
- ```
68
-
69
- Use `--file a,b` / `--image a,b` (comma-separated) for several files.
60
+ `--file a,b` / `--image a,b` attach files (comma-separated); text is optional alongside them.
61
+ `--to <seq>` threads the reply to a specific earlier event - use it when answering something older than the latest message.
70
62
 
71
- ## Handing back
63
+ ## Illustration pages
72
64
 
73
65
  ```
74
- npx chamba@latest end
66
+ npx chamba@latest show /abs/page.html --name architecture
75
67
  ```
76
68
 
77
- Ends the session from the terminal (the browser goes read-only). The human can
78
- also hand back from the browser, which you will see as `· Session ended` on your
79
- next poll.
69
+ Renders a full HTML page in the browser's Illustration tab - use it proactively for diagrams, mockups, comparisons, anything richer than markdown.
80
70
 
81
- ## Spec sessions
71
+ - The page must be fully self-contained: inline all CSS/JS/SVG; it runs in a sandboxed iframe (`allow-scripts` only) with no network access.
72
+ - Re-`show` the same `--name` to revise in place; a new name adds a page.
73
+ - The human can annotate your page like any app - comments arrive as an annotation batch with selectors into your own HTML.
82
74
 
83
- A spec session is chamba's deepest use: a structured interview that produces a
84
- spec package - a canonical markdown draft, mockups, diagrams, and a decision log -
85
- in the same shared thread and the same annotation system.
86
- Open one with `--kind spec`:
75
+ ## The app tab
87
76
 
88
- ```
89
- npx chamba@latest open --kind spec --title "checkout redesign spec"
90
- ```
77
+ The "Your app" tab frames the human's dev app for annotation; it needs chamba's client script inside that app.
78
+ When asked to set it up (the tab has a button that sends you the request), add the tag from the "not detected" banner - `<script src="<chamba-origin>/inject/annotate.js"></script>`, chamba-origin being the same host/port as the `open` URL - to the app's HTML entry or root layout, guarded to development.
79
+ Then have the app reloaded in the tab.
80
+ One-time per app.
91
81
 
92
- This unlocks three surface tabs beside "Your app" - Draft, Mock, Diagram - each
93
- annotatable exactly like the app tab.
94
- You drive the session from the terminal with four commands (`ask`, `decision`,
95
- `artifact`, `export`); the human answers, points, and annotates from the browser.
96
-
97
- ### Intake: infer the kind of work, then confirm it
98
-
99
- A spec session opens with a free-form dump - text, pasted images, files.
100
- Read all of it, infer which of four kinds of spec work this is, and confirm your
101
- read with the human before diving in (they can override).
102
- Record the confirmed kind with `decision` so it is on the log.
103
-
104
- The four kinds are behaviorally distinct - they change what you do, not just a label:
105
-
106
- - **co-spec** - no spec exists yet; you build one from scratch.
107
- Start wide (goals, users, constraints, what success means), then converge; most
108
- of the work is net-new question cards and a draft that grows from nothing.
109
- - **review** - a spec or feature already exists and the human wants it pressure-tested.
110
- Read it first against the codebase, then lead with the gaps, contradictions, and
111
- unstated assumptions you find rather than with open-ended questions.
112
- - **refine** - a draft exists and is roughly right; the work is sharpening.
113
- Hunt vague terms, underspecified edges, and missing error/empty/loading states,
114
- then propose precise wording and confirm it.
115
- - **feedback** - the human has a running thing and reactions to it.
116
- Lean on the Your app tab and annotations: turn each pointed-at problem into a
117
- decision and a draft revision.
118
-
119
- ### The interview doctrine
120
-
121
- - Hunt ambiguity relentlessly; every vague term ("fast", "simple", "secure") is a
122
- question waiting to be asked.
123
- - Assume the highest standard: when you offer options, mark the one you would
124
- choose as `recommended` and say why in its description.
125
- - Give development cost low weight - prefer quality, simplicity, robustness,
126
- scalability, and long-term maintainability; surface the trade-off and let the
127
- human decide.
128
- - Cross-reference every claim against the actual code as `path:line`; do not assert
129
- what the codebase does from memory.
130
- - Never let anything unresolved silently vanish: if you cannot get an answer,
131
- record it as an `assumed` decision so it surfaces as an open question.
132
- - The human can stop anytime; the card always carries a stop affordance, so honor it.
133
-
134
- ### Asking - question cards
135
-
136
- Post a structured question with `ask`.
137
- Options are structured (a label, a description, an optional `recommended` flag), so
138
- the card is passed as JSON - inline via `--json` or as a file path positional:
139
-
140
- ```
141
- npx chamba@latest ask --json '{
142
- "question": "How should an expired checkout session behave?",
143
- "options": [
144
- {"label": "Silent refresh", "description": "Mint a new session, keep the cart, no interruption.", "recommended": true},
145
- {"label": "Prompt to resume", "description": "Show a resume dialog before restoring the cart."},
146
- {"label": "Hard reset", "description": "Discard the cart and start over."}
147
- ]
148
- }'
149
- ```
150
-
151
- Offer as many options as the question genuinely has (up to six); do not pad to a
152
- number, and do not collapse real choices to fit.
153
- You never add a "let me type my own" option or a "leave a note" option: the card
154
- always shows a free-text custom-answer field and always lets the human annotate
155
- their choice, with voice on both.
156
- The answer returns as a normal message on your next `poll` - there is no separate
157
- answer command - and `ask` fills in the card id for you.
158
-
159
- ### Recording decisions
160
-
161
- Every material choice goes on the decision log, marked `confirmed` (the human chose
162
- it) or `assumed` (you chose it provisionally on their behalf):
163
-
164
- ```
165
- npx chamba@latest decision --status confirmed --summary "Expired sessions refresh silently, cart preserved"
166
- npx chamba@latest decision --status assumed --summary "Guest checkout is in scope" --detail "Unconfirmed; revisit before finalizing"
167
- ```
168
-
169
- `assumed` entries are the ones that surface as open questions on export, so record
170
- them honestly rather than guessing silently.
171
-
172
- ### Building artifacts - draft, mock, diagram
173
-
174
- Publish a draft, mock, or diagram from a file with `artifact`; the matching surface
175
- tab renders it, annotatable like the app:
176
-
177
- ```
178
- npx chamba@latest artifact --kind draft --name spec --file /abs/spec.md
179
- npx chamba@latest artifact --kind mock --name checkout --file /abs/checkout.html
180
- npx chamba@latest artifact --kind diagram --name flow --file /abs/flow.mmd
181
- ```
182
-
183
- - `draft` is markdown (rendered), `mock` is HTML (served sandboxed with the
184
- annotation layer injected), `diagram` is mermaid.
185
- - Build the draft live: re-post the same `--kind draft --name <name>` as you write,
186
- and its tab reloads to the new revision each time - this is how the spec builds in
187
- front of the human.
188
- - Keep one draft name (e.g. `spec`) as the canonical draft; it becomes `spec.md` on
189
- export, and any other draft names land in `assets/`.
190
- - Mocks and diagrams are annotated through the same select -> comment -> card flow as
191
- the app tab; a batch of mock annotations arrives on `poll` just like app ones.
192
-
193
- ### Exporting the package
194
-
195
- Nothing leaves `.chamba/` automatically.
196
- When the spec is ready to be official, copy the self-contained package to a
197
- destination the human names (usually under `docs/`):
198
-
199
- ```
200
- npx chamba@latest export docs/checkout-spec
201
- ```
82
+ ## Ending
202
83
 
203
- This writes `spec.md` (the canonical draft), `assets/` (mocks and diagrams), and
204
- `decisions.md` (the log, grouped confirmed vs. assumed/open).
84
+ `npx chamba@latest end` - only when the human explicitly asks to stop or hand back, never on your own initiative.
205
85
 
206
86
  ## Notes
207
87
 
208
- - All commands talk to a local server that shares this container; you never need a
209
- host or port beyond the defaults.
210
- - Presence is automatic: while you are parked in `poll`, the browser shows the
211
- agent as here.
212
- - Past sessions stay readable: `npx chamba@latest attach <id>` reloads any session's
213
- recent history.
88
+ - Each project has its own `.chamba/` workspace (created at the git root on first `open`) and its own server on a derived port; never set a port by hand.
89
+ - Presence is automatic: a parked poll shows "listening", a delivered batch flips to "working", a reply or the next poll flips back.
90
+ No poll parked shows "away".
91
+ - If the server crashed, a parked poll respawns it by itself; after a deliberate `stop` it exits cleanly.
92
+ Every message is durable on disk either way.
93
+ - Past sessions stay readable in the browser; an ended session opens read-only.
@@ -0,0 +1 @@
1
+ import{a as e,n as t,o as n,r,s as i,t as a}from"./index-B9DI4F1Z.js";var o=i(n(),1),s=e(),c=({code:e,language:n,raw:i,className:c,startLine:l,lineNumbers:u,...d})=>{let{shikiTheme:f}=(0,o.useContext)(r),p=t(),[m,h]=(0,o.useState)(i);return(0,o.useEffect)(()=>{if(!p){h(i);return}let t=p.highlight({code:e,language:n,themes:f},e=>{h(e)});t&&h(t)},[e,n,f,p,i]),(0,s.jsx)(a,{className:c,language:n,lineNumbers:u,result:m,startLine:l,...d})};export{c as HighlightedCodeBlockBody};