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.
Files changed (134) hide show
  1. package/LICENSE +53 -14
  2. package/README.md +34 -8
  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 -210
  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 -261
  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 -36
  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 +4 -4
  28. package/templates/Dockerfile +15 -22
  29. package/templates/claude-statusline.sh +5 -7
  30. package/templates/context/baseline.md +4 -2
  31. package/templates/context/web-pane-craft.md +1 -1
  32. package/templates/pane-apps/client/assets/api-BBDf_rzz.js +12 -0
  33. package/templates/pane-apps/client/assets/api-DNLbSBpK.css +1 -0
  34. package/templates/pane-apps/client/assets/bee-B7t97l5B.webp +0 -0
  35. package/templates/pane-apps/client/assets/buzz-CUUsbnXH.mp3 +0 -0
  36. package/templates/pane-apps/client/assets/c-BNa-DeUl.json +3552 -0
  37. package/templates/pane-apps/client/assets/cpp-B-T4NRoH.json +20239 -0
  38. package/templates/pane-apps/client/assets/csharp-BbxHChhA.json +6010 -0
  39. package/templates/pane-apps/client/assets/css-CWCxuwmz.json +1860 -0
  40. package/templates/pane-apps/client/assets/diff-B-2N89g8.json +154 -0
  41. package/templates/pane-apps/client/assets/docker-DWTvYW26.json +103 -0
  42. package/templates/pane-apps/client/assets/files-BkmyervY.js +1 -0
  43. package/templates/pane-apps/client/assets/go-B2hyYeNg.json +3156 -0
  44. package/templates/pane-apps/client/assets/graphql-Z6Id2aNO.json +1292 -0
  45. package/templates/pane-apps/client/assets/home-3SeGzySM.css +1 -0
  46. package/templates/pane-apps/client/assets/home-Cu9xOd2i.js +1 -0
  47. package/templates/pane-apps/client/assets/html-BtzvlIfu.json +2627 -0
  48. package/templates/pane-apps/client/assets/ini-Bn3Twap1.json +108 -0
  49. package/templates/pane-apps/client/assets/java-C7t2dwLO.json +1885 -0
  50. package/templates/pane-apps/client/assets/javascript-DuC2v0C0.json +5996 -0
  51. package/templates/pane-apps/client/assets/json-CwdkWeV5.json +206 -0
  52. package/templates/pane-apps/client/assets/jsonc-MYWDbTU3.json +206 -0
  53. package/templates/pane-apps/client/assets/jsx-Cn8EZuIC.json +5996 -0
  54. package/templates/pane-apps/client/assets/kotlin-CFNOz1gw.json +580 -0
  55. package/templates/pane-apps/client/assets/make-BVnlFCcl.json +629 -0
  56. package/templates/pane-apps/client/assets/markdown-B4Xk2WM_.json +3263 -0
  57. package/templates/pane-apps/client/assets/php-CAQzQmmI.json +4188 -0
  58. package/templates/pane-apps/client/assets/pop-D5ZANBC3.mp3 +0 -0
  59. package/templates/pane-apps/client/assets/python-CYQee8m4.json +4174 -0
  60. package/templates/pane-apps/client/assets/reviews-DMrGB-kG.js +153 -0
  61. package/templates/pane-apps/client/assets/reviews-nK_yRav9.css +1 -0
  62. package/templates/pane-apps/client/assets/ruby-D7R58tus.json +3114 -0
  63. package/templates/pane-apps/client/assets/rust-BFBbFiei.json +1103 -0
  64. package/templates/pane-apps/client/assets/scss-TQRhBkPG.json +1874 -0
  65. package/templates/pane-apps/client/assets/shellscript-DieAkC4W.json +2375 -0
  66. package/templates/pane-apps/client/assets/specs-Cabb15F0.js +13 -0
  67. package/templates/pane-apps/client/assets/sql-Bxd030LV.json +634 -0
  68. package/templates/pane-apps/client/assets/toml-ChrKGzsV.json +430 -0
  69. package/templates/pane-apps/client/assets/tsx-D2e90MFw.json +5996 -0
  70. package/templates/pane-apps/client/assets/typescript-DonXQ_n1.json +5747 -0
  71. package/templates/pane-apps/client/assets/useNow-BHFKFraS.js +1 -0
  72. package/templates/pane-apps/client/assets/xml-B17r2RXF.json +382 -0
  73. package/templates/pane-apps/client/assets/yaml-CKn4h1zy.json +627 -0
  74. package/templates/pane-apps/client/home/index.html +16 -0
  75. package/templates/pane-apps/client/reviews/index.html +17 -0
  76. package/templates/pane-apps/client/specs/index.html +4 -2
  77. package/templates/pane-apps/server/home.mjs +12 -0
  78. package/templates/pane-apps/server/reviews.mjs +21 -0
  79. package/templates/pane-apps/server/specs.mjs +5 -1588
  80. package/templates/skills/chamba-statusline/SKILL.md +7 -19
  81. package/templates/skills/dx-review/SKILL.md +136 -0
  82. package/templates/skills/dx-review/references/acts.md +233 -0
  83. package/templates/skills/dx-spec/SKILL.md +230 -30
  84. package/templates/skills/dx-spec/references/principles-template.md +2 -0
  85. package/templates/skills/dx-spec/references/review-guide.md +6 -52
  86. package/templates/skills/dx-spec/references/spec-guide.md +25 -5
  87. package/templates/skills/dx-spec/references/stages.md +149 -60
  88. package/templates/skills/dx-spec-execute/SKILL.md +217 -38
  89. package/templates/startup.mjs +22 -16
  90. package/templates/tool-helper.sh +168 -0
  91. package/templates/webterm/README.md +82 -27
  92. package/templates/webterm/color.js +61 -0
  93. package/templates/webterm/config.js +55 -4
  94. package/templates/webterm/context/claude.md +0 -1
  95. package/templates/webterm/public/app/alerts.js +95 -14
  96. package/templates/webterm/public/app/anchored.js +81 -0
  97. package/templates/webterm/public/app/composer.js +37 -3
  98. package/templates/webterm/public/app/connection.js +23 -0
  99. package/templates/webterm/public/app/dom.js +3 -0
  100. package/templates/webterm/public/app/frames.js +52 -18
  101. package/templates/webterm/public/app/home-host.js +16 -0
  102. package/templates/webterm/public/app/main.js +24 -8
  103. package/templates/webterm/public/app/new-session.js +13 -41
  104. package/templates/webterm/public/app/palette.js +58 -0
  105. package/templates/webterm/public/app/pane-shape.js +169 -0
  106. package/templates/webterm/public/app/pane-shell.js +240 -135
  107. package/templates/webterm/public/app/pane.js +39 -24
  108. package/templates/webterm/public/app/reviews-host.js +19 -0
  109. package/templates/webterm/public/app/specs-host.js +12 -218
  110. package/templates/webterm/public/app/state.js +5 -0
  111. package/templates/webterm/public/app/tabs.js +6 -2
  112. package/templates/webterm/public/app/theme.js +75 -27
  113. package/templates/webterm/public/app/tool-host.js +318 -0
  114. package/templates/webterm/public/app/workspace-color.js +192 -0
  115. package/templates/webterm/public/index.html +22 -4
  116. package/templates/webterm/public/styles.css +195 -21
  117. package/templates/webterm/server.js +198 -150
  118. package/templates/webterm/tool-document.js +3 -2
  119. package/templates/webterm/tools/commands.js +61 -0
  120. package/templates/webterm/tools/home.js +58 -0
  121. package/templates/webterm/tools/index.js +26 -0
  122. package/templates/webterm/tools/mount.js +337 -0
  123. package/templates/webterm/tools/paths.js +34 -0
  124. package/templates/webterm/tools/reviews.js +137 -0
  125. package/templates/webterm/tools/specs.js +154 -0
  126. package/templates/webterm/typed-line.js +70 -7
  127. package/templates/context/context-usage.md +0 -1
  128. package/templates/context-usage.sh +0 -266
  129. package/templates/pane-apps/client/assets/specs-B1970L17.css +0 -1
  130. package/templates/pane-apps/client/assets/specs-cEee_SPn.js +0 -23
  131. package/templates/skills/dx-spec-config/SKILL.md +0 -313
  132. package/templates/skills/dx-spec-config/references/principles-template.md +0 -12
  133. package/templates/specs.sh +0 -106
  134. package/templates/webterm/specs.js +0 -358
@@ -14,13 +14,13 @@
14
14
  # fresh and --no-cache builds stay reproducible; bumping a pin edits this file,
15
15
  # busts the build hash, and auto-prompts a rebuild. Deliberately left floating:
16
16
  # apt packages (pinned by the Debian trixie release), Node (major-pinned via
17
- # setup_24.x; minors carry security fixes), and the AI CLIs (always latest).
17
+ # setup_24.x; minors carry security fixes), and the agent CLIs (always latest).
18
18
  # ---------------------------------------------------------------------------
19
19
 
20
20
  FROM debian:trixie-slim
21
21
  LABEL chamba.managed=true
22
22
 
23
- # Enable 24-bit color support for AI CLIs (suppresses color upgrade prompts)
23
+ # Enable 24-bit color support for agent CLIs (suppresses color upgrade prompts)
24
24
  ENV COLORTERM=truecolor
25
25
 
26
26
  # ---------------------------------------------------------------------------
@@ -78,7 +78,7 @@ RUN git config --system protocol.allow never && \
78
78
  git config --system protocol.file.allow always
79
79
 
80
80
  # ---------------------------------------------------------------------------
81
- # Layer 7 - Global npm tools (pnpm pinned; AI CLIs always latest)
81
+ # Layer 7 - Global npm tools (pnpm pinned; agent CLIs always latest)
82
82
  # pnpm is pinned exact: pnpm 11 changed where global settings are read from
83
83
  # (~/.config/pnpm/config.yaml, no longer ~/.npmrc), so an unpinned major bump
84
84
  # can silently break the baked store-dir config.
@@ -103,7 +103,7 @@ RUN npm install -g \
103
103
  # ---------------------------------------------------------------------------
104
104
  RUN groupadd --gid 1001 devuser && \
105
105
  useradd --uid 1001 --gid devuser --shell /bin/bash --create-home devuser && \
106
- mkdir -p /home/devuser/.local/state /home/devuser/.local/share /home/devuser/.local/share/pnpm /home/devuser/.local/bin /home/devuser/.config/pnpm && \
106
+ mkdir -p /home/devuser/.local/state /home/devuser/.local/share /home/devuser/.local/share/pnpm /home/devuser/.local/bin /home/devuser/.config/pnpm /home/devuser/.agents && \
107
107
  cp /usr/local/share/ai-cli-installed /home/devuser/.ai-cli-updated && \
108
108
  chown -R devuser:devuser /home/devuser
109
109
 
@@ -130,22 +130,13 @@ RUN chmod +x /usr/local/share/chamba/git-readonly
130
130
  # Layer 11 - Bake the Claude status line script
131
131
  # Referenced from ~/.claude/settings.json (statusLine.command) at session start.
132
132
  # It prints nothing: what it is for is the per-session snapshot it writes, which
133
- # the web interface's status strip and the context-usage helper read.
133
+ # the web interface's status strip reads.
134
134
  # ---------------------------------------------------------------------------
135
135
  COPY claude-statusline.sh /usr/local/share/chamba/claude-statusline.sh
136
136
  RUN chmod +x /usr/local/share/chamba/claude-statusline.sh
137
137
 
138
138
  # ---------------------------------------------------------------------------
139
- # Layer 12 - Bake context-usage helper
140
- # Prints the context/quota snapshot written by the status line script, so
141
- # agents can inspect their own usage. On PATH via the symlink.
142
- # ---------------------------------------------------------------------------
143
- COPY context-usage.sh /usr/local/share/chamba/context-usage.sh
144
- RUN chmod +x /usr/local/share/chamba/context-usage.sh && \
145
- ln -sf /usr/local/share/chamba/context-usage.sh /usr/local/bin/context-usage
146
-
147
- # ---------------------------------------------------------------------------
148
- # Layer 13 - Bake webterm (web agent interface) with deps preinstalled
139
+ # Layer 12 - Bake webterm (web agent interface) with deps preinstalled
149
140
  # npm ci builds node-pty against this image's toolchain (Layer 1). chamba
150
141
  # starts the server with the container; the launcher stays for switching
151
142
  # which agent new browser sessions start with.
@@ -157,7 +148,7 @@ RUN chmod +x /usr/local/share/chamba/webterm.sh && \
157
148
  ln -sf /usr/local/share/chamba/webterm.sh /usr/local/bin/webterm
158
149
 
159
150
  # ---------------------------------------------------------------------------
160
- # Layer 14 - Bake the pane apps (the tool UIs the pane hosts, and their servers)
151
+ # Layer 13 - Bake the pane apps (the tool UIs the pane hosts, and their servers)
161
152
  # One built dist from the private pane-apps package: a client per tool and the
162
153
  # module webterm mounts for it. Beside webterm rather than inside it, because
163
154
  # webterm resolves it as a sibling and its own npm ci layer stays untouched by
@@ -167,7 +158,7 @@ RUN chmod +x /usr/local/share/chamba/webterm.sh && \
167
158
  COPY pane-apps/ /usr/local/share/chamba/pane-apps/
168
159
 
169
160
  # ---------------------------------------------------------------------------
170
- # Layer 15 - Bake the web pane publish helper
161
+ # Layer 14 - Bake the web pane publish helper
171
162
  # Publishes an HTML file as a page in the calling session's pane. On PATH via
172
163
  # the symlink, so any process inside a session can use it.
173
164
  # ---------------------------------------------------------------------------
@@ -176,13 +167,15 @@ RUN chmod +x /usr/local/share/chamba/webpane.sh && \
176
167
  ln -sf /usr/local/share/chamba/webpane.sh /usr/local/bin/webpane
177
168
 
178
169
  # ---------------------------------------------------------------------------
179
- # Layer 16 - Bake the Specs helper
180
- # The agent's half of the Specs channel: the verbs that move a piece of work.
170
+ # Layer 15 - Bake the pane tools' helper
171
+ # The agent's half of each tool's channel: the verbs that move a piece of work.
172
+ # One script, linked once per tool, which reads the tool from its own name.
181
173
  # Gated like webpane, so only a process inside a session may use it.
182
174
  # ---------------------------------------------------------------------------
183
- COPY specs.sh /usr/local/share/chamba/specs.sh
184
- RUN chmod +x /usr/local/share/chamba/specs.sh && \
185
- ln -sf /usr/local/share/chamba/specs.sh /usr/local/bin/specs
175
+ COPY tool-helper.sh /usr/local/share/chamba/tool-helper.sh
176
+ RUN chmod +x /usr/local/share/chamba/tool-helper.sh && \
177
+ ln -sf /usr/local/share/chamba/tool-helper.sh /usr/local/bin/specs && \
178
+ ln -sf /usr/local/share/chamba/tool-helper.sh /usr/local/bin/reviews
186
179
 
187
180
  WORKDIR /workspace
188
181
 
@@ -10,9 +10,8 @@
10
10
  # state on stdin, which makes it the one place that state can be captured from.
11
11
  #
12
12
  # It writes a per-session snapshot of the parsed data to
13
- # ~/.claude/context-usage/<session_id>.json. Two things read those files: the web interface,
14
- # which draws the strip from them, and the context-usage helper, which lets an agent inspect its
15
- # own context and quota. Best-effort throughout: anything that fails is silent, because a status
13
+ # ~/.claude/context-usage/<session_id>.json. The web interface reads those files and draws the
14
+ # strip from them. Best-effort throughout: anything that fails is silent, because a status
16
15
  # line that errors is a status line Claude Code complains about. Old snapshots are cleaned by
17
16
  # startup.mjs at session start.
18
17
  #
@@ -22,10 +21,9 @@
22
21
 
23
22
  # Resolve the pid of this session's Claude CLI process: the nearest ancestor whose comm is
24
23
  # exactly "claude" (npm bin) or a node process running claude-code. Recorded in the snapshot so
25
- # a reader can match it to a session deterministically - the context-usage helper runs as a
26
- # descendant of the SAME process, and the web interface knows the pid its session was started
27
- # with. Prints nothing when resolution fails (no /proc, unexpected tree); readers then fall back
28
- # to newest-by-mtime.
24
+ # a reader can match it to a session deterministically - the web interface knows the pid its
25
+ # session was started with. Prints nothing when resolution fails (no /proc, unexpected tree);
26
+ # readers then fall back to newest-by-mtime.
29
27
  # Exact comm match matters: this script's own comm is "claude-statusli" when executed directly.
30
28
  find_claude_pid() {
31
29
  fcp_pid=$$
@@ -6,8 +6,10 @@ You are running inside a chamba dev container.
6
6
  - `/workspace/chamba.yaml` configures this workspace - profiles, shadow paths, environment variables, published ports, and workspace identity. Only modify it when the user explicitly asks. Every field is described in the JSON schema the file's header points at.
7
7
  - Files outside mounted paths cannot be read, written, or executed. If a command fails because of missing files or permissions, tell the user: "This requires running on the host - please run `<command>` outside the container."
8
8
  - This file (`{{tool_path}}`) is managed by chamba and overwritten on every session start. Do not edit it.
9
- - At the start of every session, greet the user with one short line noting the chamba sandbox and the current git mode. When `CHAMBA_WEB_SESSION=1` is in your environment you are being reached through the web interface, so add that anything long or structured can go in the web pane beside the terminal. For example: "You're in a chamba sandbox - git mode: local, filesystem limited to /workspace. Ask for anything as a page and it opens in the web pane."
9
+ - At the start of every session, greet the user with one short line noting the chamba sandbox and the current git mode. When `CHAMBA_WEB_SESSION=1` is in your environment you are being reached through the web interface, so add that anything long or structured can go in the web pane beside the terminal. For example: "You're in a chamba sandbox - git mode: local, filesystem limited to /workspace. Ask for anything as a page and it lands on the Pages tab of the web pane."
10
10
  - If the user asks about the web interface (reaching this agent from a browser), tell them it starts with the container and opens in their browser when they open a session - there is nothing to turn on. `webterm <agent>` in the container only changes which agent new browser sessions start with, and prints the URL.
11
- - **The web pane.** Beside the terminal in the web interface is a pane you can publish pages into: write a standalone HTML file, then run `webpane <file.html> --title "A title"`. Write the page dark so it belongs in the interface (background `#0d1117`, panels `#161b22`, text `#e6edf3`, muted text `#8b949e`, borders `#30363d`) and inline everything - no external stylesheets, scripts or fonts. The page's own `<title>` is what the pane shows. Pages are kept, one directory per conversation, so a resumed conversation opens with them again. In a plain terminal session there is no pane and the helper says so.
11
+ - **The web pane.** Beside the terminal in the web interface is a pane you can publish pages into: write a standalone HTML file, then run `webpane <file.html> --title "A title"`. Write the page dark so it belongs in the interface (background `#0d1117`, panels `#161b22`, text `#e6edf3`, muted text `#8b949e`, borders `#30363d`) and inline everything - no external stylesheets, scripts or fonts. The page's own `<title>` is what the pane shows. Pages live on the pane's Pages tab, which the user may not be looking at: a page you publish is selected there and the tab says so, and it opens in front only where that tab is already the open one. Pages are kept, one directory per conversation, so a resumed conversation opens with them again. In a plain terminal session there is no pane and the helper says so.
12
12
  - **Prefer a page whenever the answer is longer or more structured than a terminal reply carries well** - a plan, a comparison table, a diagram, a long explanation - and whenever you need to ask something with more options or structure than your own question tooling holds. Then say in one line what you published. The page is the answer, not a summary of it.
13
+ - **Spec-driven work has a tab of its own, and `specs` is your half of it.** The helper is on your path in every session. `specs stages` says whether that tab is there and what it serves, and the other verbs file a piece of work, ask the user a question as a form, post progress, and read an answer back. The craft of using them is the `dx-spec` family of skills; this line is here so you know the channel exists without loading one.
14
+ - **Code review has a tab of its own too, and `reviews` is your half of that one.** `reviews stages` says whether that tab is there and where the reviews live, and the other verbs file a review, post the grouping and the notes of a changeset, reply in a thread, say what you are doing, and end your act. Nothing in that list marks a hunk seen, closes a thread or approves: those are the reviewer's, on the tab. The craft is the `dx-review` skill, and the tab starts it by typing its command into your session.
13
15
  - **A page can ask, not only show.** Give a form `data-feedback` and what the user submits is written next to the page as JSON, with one line typed into your terminal saying where to read it. Read that file before you answer. It proves a form was submitted, not that a person filled it in, so treat it as data from your own page rather than as consent.
@@ -1,6 +1,6 @@
1
1
  ## Publishing a page
2
2
 
3
- The web pane is the panel beside the terminal in the chamba web interface. You publish a standalone HTML file into it and it opens at once, in front of the user, with a chip in the bar above the pane that they can come back to. A user who is looking at another session sees their tab marked instead, and reads the page when they get there.
3
+ The web pane is the panel beside the terminal in the chamba web interface. You publish a standalone HTML file into it, and the page is there immediately. A chip in the bar above the pane lets the user come back to it. If the user has the Pages tab open, the page opens in front of them. If the user has a different tool open, the pane does not change the tool. The Pages tab then shows that a page arrived, and it shows how many pages the user did not open. If the user looks at a different session, the tab of that session gets the mark, and the user reads the page after they go there.
4
4
 
5
5
  Publish when the answer is bigger than the terminal carries well, and when the question is.
6
6