command-code 1.83.0 → 1.84.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # command-code
2
2
 
3
+ ## 1.84.0
4
+
5
+ ### Minor Changes
6
+
7
+ - feat: Add `/statusline` to customize what shows on the line under the input
8
+
3
9
  ## 1.83.0
4
10
 
5
11
  ### Minor Changes
@@ -122,6 +122,7 @@ Every built-in command, grouped by area. Aliases are shown in parentheses on the
122
122
  | `/config [query]` | Search and change settings |
123
123
  | `/theme [dark\|light\|auto]` | Switch themes; `auto` matches your terminal background |
124
124
  | `/status` | Show comprehensive environment status |
125
+ | `/statusline [off\|on\|reset]` | Configure Command Code's statusline UI (terminal only) |
125
126
  | `/changelog [all]` | See what's new in Command Code (`all` for the full history) |
126
127
  | `/learn` | Open the Command Code learn hub in your browser |
127
128
  | `/update` | Update Command Code to the latest version |
@@ -153,6 +154,7 @@ Most commands are **blocked mid-turn** - mode flips, session switches, model cha
153
154
  - `/session-file` - read-only session facts
154
155
  - `/copy` - clipboard only
155
156
  - `/todos` (also `ctrl+x`) - edits local todo state, most useful mid-turn while a plan is being driven (needs the `todos` mod enabled)
157
+ - `/statusline off`, `/statusline on`, `/statusline reset` - a local display preference (bare `/statusline` opens its editor once the turn ends)
156
158
  - `/exit` / `/quit` - always available
157
159
  - `/goal clear` - stops the goal loop; the current step finishes, then the loop stops. Setting a **new** goal mid-turn is refused with a busy notice.
158
160
 
@@ -166,6 +168,128 @@ Most other commands - `/clear`, `/mode`, `/plan`, `/model`, `/compact`, `/worktr
166
168
 
167
169
  `/loop <interval> <task>` runs the task now and repeats it on a fixed cadence such as `5m`, `2h`, `1d`, or a trailing `every 2 hours`. `/loop <task>` runs it now and lets the agent pick each next delay, between one minute and one hour. Bare `/loop` runs the default maintenance task, which a `.commandcode/loop.md` file replaces. Esc cancels the conversation's loops. The [`/loop`](https://commandcode.ai/docs/loop) page has the normalization rules, `loop.md`, and resume behavior.
168
170
 
171
+ ### `/statusline` in detail
172
+
173
+ The status line is the row directly under the input. It stays visible while you type and steps aside only for the slash menu, the `@` file list, the slash hint, and a pending Ctrl+C exit:
174
+
175
+ ```text
176
+ > fix the parser
177
+ branch: main · mymod: ok
178
+ ? for shortcuts · PR #5329 · taste on
179
+ ```
180
+
181
+ Bare `/statusline` slash command opens the statusline editor. Select items from the list to add to the statusline. An item with nothing to show right now says why in brackets beside its label, for example `Git branch (not on a git branch)`, instead of showing a placeholder.
182
+
183
+ These items sit in the row, in the order you choose. Items marked *off* are unchecked by default:
184
+
185
+ | **Item** | **Shows** |
186
+ | ----------------- | ---------------------------------------------------------------------------------- |
187
+ | Model | This session's model (*off*) |
188
+ | Model + reasoning | The model and its reasoning level, e.g. `Opus 4.7 with high effort` (*off*) |
189
+ | Reasoning level | The reasoning level alone, e.g. `high effort` (*off*) |
190
+ | Current directory | The working directory, e.g. `~/work/app` (*off*) |
191
+ | Git branch | The checked-out branch, e.g. `branch: main`; re-read after each turn (*off*) |
192
+ | Session name | The session's name, from `/rename` or the generated title (*off*) |
193
+ | Version | The Command Code version, e.g. `v1.77.0` (*off*) |
194
+ | Phase model | The planning or implementation model, while one is in charge; always at the right end of the row |
195
+
196
+ These items keep their own place under the input; you can only turn them on or off. All are on by default:
197
+
198
+ | **Item** | **Controls** |
199
+ | ----------------- | ---------------------------------------------------------------------------------- |
200
+ | Permission mode | The accept-edits and plan mode badges. Bypass and dont-ask always show |
201
+ | IDE context | The IDE file or selection and the IDE connection indicator |
202
+ | Pull request | The open or merged PR badge for this branch, as a link |
203
+ | Taste learning | `taste on` or `taste off` (`taste off (byok)` when a BYOK session skips learning) |
204
+ | Background tasks | Running shells and monitors; press `↓` to manage them |
205
+ | Shortcut hints | `? for shortcuts` and the paste hint. The stash badge shows whenever a prompt is stashed |
206
+
207
+ The Ctrl+C exit prompt, credit warnings, and update, share and taste notices always show.
208
+
209
+ | **Key** | **Action** |
210
+ | ------------------ | ---------------------------------------------------------- |
211
+ | `↑` / `↓` | Move between items |
212
+ | `Space` / `Enter` | Check or uncheck the focused item |
213
+ | `←` / `→` | Move the focused item left or right in the row (only row items move; Phase model stays at the right end) |
214
+ | `Esc` | Save your changes and close (just close if nothing changed; during a save, close at once; after another session's change, discard yours) |
215
+ | `Ctrl+C` | Close without saving |
216
+
217
+ Unchecked items keep their place, so checking one again puts it back where it was. Nothing changes under the input until Esc saves the layout. If the write fails, the editor stays open with your changes, and Esc tries again; if another session changed the layout while you were editing, it never overwrites it: Enter reloads the saved version, Esc discards your changes. Closing the editor gives you back the prompt you were writing.
218
+
219
+ Output from [mods](https://commandcode.ai/docs/mods) (`cmd.ui.setStatus`) always appears after the built-ins, and before the phase model at the right end, in the order the mods loaded. Unchecking every built-in still shows mod output; `/statusline off` is the way to hide the whole row.
220
+
221
+ #### Add your own items with mods
222
+
223
+ The editor lists only the built-in items. To show anything else in the row, such as a CI result, a ticket number or a count, use a [mod](https://commandcode.ai/docs/mods) that calls `cmd.ui.setStatus(text)`. Each mod gets one segment: a new call replaces its text, and `null` removes it. You don't need to write the mod yourself; describe what you want and Command Code builds it:
224
+
225
+ ```text copy filename="Prompt"
226
+ Build me a mod that shows how many files I've changed in this git repo in my status line, in yellow, and updates it after every turn. Show nothing when the tree is clean.
227
+ ```
228
+
229
+ Command Code writes something like this and saves it in `~/.commandcode/mods/changed-files.ts`, where it loads in every session:
230
+
231
+ ```ts copy filename="~/.commandcode/mods/changed-files.ts"
232
+ import type {ModApi} from '@commandcode/harness';
233
+
234
+ export default function (cmd: ModApi): void {
235
+ const refresh = async (): Promise<void> => {
236
+ const {stdout, code} = await cmd.exec({command: 'git', args: ['status', '--porcelain']});
237
+ const count = stdout.split('\n').filter(Boolean).length;
238
+ // null clears the segment: nothing shows on a clean tree or outside a repo.
239
+ cmd.ui.setStatus(code === 0 && count > 0 ? `\u001b[33m✎ ${count} changed\u001b[39m` : null);
240
+ };
241
+
242
+ cmd.hooks({onSessionStart: refresh});
243
+ cmd.on('turn_end', () => void refresh());
244
+ }
245
+ ```
246
+
247
+ The next session shows it in the row:
248
+
249
+ ```text
250
+ > fix the parser
251
+ ✎ 2 changed
252
+ ? for shortcuts · PR #5329 · taste on
253
+ ```
254
+
255
+ To try a mod without installing it, run `cmd --mod ./changed-files.ts`; after editing an installed one, run `/reload`. Mod text can use ANSI colors and OSC 8 links; other escape codes are removed. To hide mod output but keep the built-ins, set `legacy-mods` to `"enabled": false` in `config.json` (see below). The [UI surface](https://commandcode.ai/docs/mods#ui-surface) section of the mods page has the full `setStatus` contract.
256
+
257
+ | **Command** | **Effect** |
258
+ | -------------------- | --------------------------------------------------------------------------------- |
259
+ | `/statusline` | Open the editor |
260
+ | `/statusline off` | Hide the whole row, mod output included. Your selection is kept, and the on/off-only items above are unaffected |
261
+ | `/statusline on` | Show the row again with your saved selection, or the default one |
262
+ | `/statusline reset` | Forget your layout and go back to the default, in the order above |
263
+
264
+ Your items always get exactly one line under the input, in the order you set. When they don't fit your terminal, the line is cut with `…` at the edge rather than wrapping or reordering. The phase model sits at the right end of that line when it fits beside it, otherwise at the right end of the line below.
265
+
266
+ The layout is saved in `~/.commandcode/config.json` under `statusline`. You rarely need to edit it by hand:
267
+
268
+ ```json
269
+ {
270
+ "statusline": {
271
+ "version": 1,
272
+ "enabled": true,
273
+ "items": [
274
+ {"id": "model", "enabled": false},
275
+ {"id": "pull-request", "enabled": true},
276
+ {"id": "taste", "enabled": true},
277
+ {"id": "phase-model", "enabled": true},
278
+ {"id": "background-tasks", "enabled": true},
279
+ {"id": "git-branch", "enabled": true},
280
+ {"id": "permission-mode", "enabled": true},
281
+ {"id": "legacy-mods", "enabled": true}
282
+ ]
283
+ }
284
+ }
285
+ ```
286
+
287
+ `items` sets the order, except that `phase-model` always draws at the right end. `enabled: false` on an item unchecks it; `enabled: false` at the top level is `/statusline off`. An item missing from `items` is unchecked, except the on/off-only items (`permission-mode`, `ide`, `pull-request`, `taste`, `background-tasks`, `hints`), which stay on. Other ids: `model-reasoning`, `reasoning`, `cwd`, `session-name`, `version`. `legacy-mods` is where mod output goes; leave it out (or set `"items": []`) and mod output is hidden.
288
+
289
+ A layout saved by a newer version of Command Code is never overwritten: the row uses the default layout and the editor opens read-only, until you update or run `/statusline reset`. A `statusline` value that isn't valid is also left untouched and shown read-only; fix or remove the `statusline` key, or run `/statusline reset`. If `config.json` itself isn't valid JSON, nothing can save the layout, `/statusline reset` included, until you fix or remove that file.
290
+
291
+ The row doesn't watch the file. A hand edit, or a save from another Command Code window, shows up the next time you open `/statusline`, run `/statusline off`, `on` or `reset`, or restart.
292
+
169
293
  ### `/rc` in detail
170
294
 
171
295
  Bare `/rc` opens the picker: platform, setup, permission mode. `/rc default`, `/rc auto-accept` and `/rc yolo` connect straight into a mode. `/rc status` reports what is on, `/rc off` disconnects, and `/rc off clear` also deletes the bot's own messages. `/rc` is refused when the model asks for it and when it arrives from the chat, so the bot cannot change its own token or allowlist. See [`/rc`](https://commandcode.ai/docs/remote-control) for setup and what the chat can send.
@@ -68,6 +68,7 @@
68
68
  - /pr-comments: Fetch all PR comments for current branch
69
69
  - /add-dir: Manage additional directory scope
70
70
  - /status: Show comprehensive environment status
71
+ - /statusline [off|on|reset]: Configure Command Code's statusline UI: pick and order the row under the input (model, reasoning, phase model, directory, git branch, session name, version) and turn the mode badge, IDE context, PR, taste, background tasks and shortcut hints on or off; mod status follows. Terminal only
71
72
  - /usage: Display credits, plan, and usage metrics
72
73
  - /upgrade: Open billing page to upgrade your plan
73
74
  - /extra: Buy extra usage at API cost, zero markup
@@ -40,7 +40,7 @@ cmd.addCommand({
40
40
 
41
41
  ## Footer status segments
42
42
 
43
- `cmd.ui.setStatus(text | null)` - a persistent per-mod segment in the TUI footer (under the input panel). One segment per mod: a new call replaces the text, `null` (or whitespace-only text) clears it, and the returned `Disposable` clears it too - but only while it still owns the segment, so a stale handle disposing late can't wipe a newer status. Segments from multiple mods render on one row in load order, and a call from async code repaints on its own. Text is printed verbatim (style it with ansi), collapsed to a single line: newlines and tabs become spaces. Headless: stored, rendered nowhere.
43
+ `cmd.ui.setStatus(text | null)` - a persistent per-mod segment on the TUI's status row (under the input). One segment per mod: a new call replaces the text, `null` (or whitespace-only text) clears it, and the returned `Disposable` clears it too - but only while it still owns the segment, so a stale handle disposing late can't wipe a newer status. Segments from multiple mods render after the row's built-in items in load order, and a call from async code repaints on its own. Style text with ansi colors (SGR) and OSC 8 links; every other escape - cursor moves, screen clears, OSC titles and clipboard writes - is stripped, and newlines and tabs become spaces. Mod segments share the user's one status line, after the built-ins and before the right-pinned phase model; the line is cut with `…` at the terminal edge, so trailing segments can be cut off. `/statusline off` hides the whole row (`cmd.ui.capabilities.status` stays true). Headless: stored, rendered nowhere. For a complete example built by asking Command Code, see [Add your own items with mods](https://commandcode.ai/docs/reference/slash-commands#add-your-own-items-with-mods).
44
44
 
45
45
  ```ts
46
46
  cmd.hooks({