command-code 1.92.0 → 1.93.1

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 (92) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/package.json +1 -1
  3. package/vsix/commandcode-vscode.vsix +0 -0
  4. package/dist/bundled/agent-browser/SKILL.md +0 -73
  5. package/dist/bundled/command-code-knowledge/SKILL.md +0 -68
  6. package/dist/bundled/command-code-knowledge/live-models.ts +0 -284
  7. package/dist/bundled/command-code-knowledge/reference/byok.md +0 -389
  8. package/dist/bundled/command-code-knowledge/reference/custom-agents.md +0 -341
  9. package/dist/bundled/command-code-knowledge/reference/custom-slash-commands.md +0 -423
  10. package/dist/bundled/command-code-knowledge/reference/headless.md +0 -381
  11. package/dist/bundled/command-code-knowledge/reference/hooks.md +0 -1107
  12. package/dist/bundled/command-code-knowledge/reference/mcp.md +0 -636
  13. package/dist/bundled/command-code-knowledge/reference/memory.md +0 -137
  14. package/dist/bundled/command-code-knowledge/reference/models.md +0 -145
  15. package/dist/bundled/command-code-knowledge/reference/permissions.md +0 -486
  16. package/dist/bundled/command-code-knowledge/reference/plan-mode.md +0 -283
  17. package/dist/bundled/command-code-knowledge/reference/plans.md +0 -16
  18. package/dist/bundled/command-code-knowledge/reference/product-help.md +0 -490
  19. package/dist/bundled/command-code-knowledge/reference/sessions.md +0 -377
  20. package/dist/bundled/command-code-knowledge/reference/skills.md +0 -1009
  21. package/dist/bundled/command-code-knowledge/reference/tools.md +0 -522
  22. package/dist/bundled/config/SKILL.md +0 -18
  23. package/dist/bundled/config/references/permissions.md +0 -27
  24. package/dist/bundled/config/references/settings.md +0 -49
  25. package/dist/bundled/design/SKILL.md +0 -441
  26. package/dist/bundled/design/references/accessibility.md +0 -404
  27. package/dist/bundled/design/references/border.md +0 -161
  28. package/dist/bundled/design/references/button.md +0 -192
  29. package/dist/bundled/design/references/checkup.md +0 -162
  30. package/dist/bundled/design/references/color.md +0 -245
  31. package/dist/bundled/design/references/create.md +0 -291
  32. package/dist/bundled/design/references/design-html.md +0 -227
  33. package/dist/bundled/design/references/deslop.md +0 -283
  34. package/dist/bundled/design/references/finish.md +0 -156
  35. package/dist/bundled/design/references/interaction.md +0 -186
  36. package/dist/bundled/design/references/layout.md +0 -216
  37. package/dist/bundled/design/references/media.md +0 -112
  38. package/dist/bundled/design/references/motion.md +0 -237
  39. package/dist/bundled/design/references/redesign.md +0 -197
  40. package/dist/bundled/design/references/refine.md +0 -193
  41. package/dist/bundled/design/references/relayout.md +0 -207
  42. package/dist/bundled/design/references/report-html.md +0 -235
  43. package/dist/bundled/design/references/responsive.md +0 -233
  44. package/dist/bundled/design/references/review.md +0 -164
  45. package/dist/bundled/design/references/setup.md +0 -119
  46. package/dist/bundled/design/references/severity.md +0 -111
  47. package/dist/bundled/design/references/shadow.md +0 -164
  48. package/dist/bundled/design/references/smell.md +0 -211
  49. package/dist/bundled/design/references/style-3d.md +0 -23
  50. package/dist/bundled/design/references/style-bento.md +0 -21
  51. package/dist/bundled/design/references/style-editorial.md +0 -23
  52. package/dist/bundled/design/references/style-futuristic.md +0 -21
  53. package/dist/bundled/design/references/style-glassmorphism.md +0 -52
  54. package/dist/bundled/design/references/style-maximalism.md +0 -20
  55. package/dist/bundled/design/references/style-minimalism.md +0 -21
  56. package/dist/bundled/design/references/style-neo-brutalism.md +0 -21
  57. package/dist/bundled/design/references/style-retro-futurism.md +0 -21
  58. package/dist/bundled/design/references/style-swiss.md +0 -20
  59. package/dist/bundled/design/references/style.md +0 -77
  60. package/dist/bundled/design/references/surface.md +0 -163
  61. package/dist/bundled/design/references/system.md +0 -73
  62. package/dist/bundled/design/references/typeset.md +0 -210
  63. package/dist/bundled/design/references/variants.md +0 -193
  64. package/dist/bundled/design/references/voice.md +0 -184
  65. package/dist/bundled/design/references/writing.md +0 -174
  66. package/dist/bundled/loop/SKILL.md +0 -16
  67. package/dist/bundled/mod-builder/SKILL.md +0 -135
  68. package/dist/bundled/mod-builder/examples/block-dangerous-commands.ts +0 -41
  69. package/dist/bundled/mod-builder/examples/custom-entry-renderer.ts +0 -32
  70. package/dist/bundled/mod-builder/examples/custom-tool.ts +0 -53
  71. package/dist/bundled/mod-builder/examples/flags-and-options.ts +0 -29
  72. package/dist/bundled/mod-builder/examples/input-shortcuts.ts +0 -41
  73. package/dist/bundled/mod-builder/examples/kitchen-sink.ts +0 -129
  74. package/dist/bundled/mod-builder/examples/lifecycle-hooks.ts +0 -64
  75. package/dist/bundled/mod-builder/examples/model-router.ts +0 -43
  76. package/dist/bundled/mod-builder/examples/observe-events.ts +0 -30
  77. package/dist/bundled/mod-builder/examples/pane-and-buttons.ts +0 -60
  78. package/dist/bundled/mod-builder/examples/pane-form.ts +0 -68
  79. package/dist/bundled/mod-builder/examples/permission-policy.ts +0 -34
  80. package/dist/bundled/mod-builder/examples/redact-secrets.ts +0 -46
  81. package/dist/bundled/mod-builder/examples/slash-command.ts +0 -33
  82. package/dist/bundled/mod-builder/examples/spinner-count.ts +0 -47
  83. package/dist/bundled/mod-builder/examples/stream-filter.ts +0 -70
  84. package/dist/bundled/mod-builder/reference/api.md +0 -140
  85. package/dist/bundled/mod-builder/reference/hooks-and-events.md +0 -347
  86. package/dist/bundled/mod-builder/reference/overview.md +0 -271
  87. package/dist/bundled/mod-builder/reference/packaging.md +0 -187
  88. package/dist/bundled/mod-builder/reference/ui.md +0 -253
  89. package/dist/bundled/mod-builder/reference/verify.md +0 -67
  90. package/dist/bundled/skill-builder/SKILL.md +0 -104
  91. package/dist/cli.mjs +0 -16
  92. package/dist/index.mjs +0 -2
@@ -1,187 +0,0 @@
1
- <!-- Generated from the Command Code docs: https://commandcode.ai/docs -->
2
-
3
- # Install and share mods
4
-
5
- A mod starts as a single file in `~/.commandcode/mods/`. To share it with your team or anyone else, turn it into a **package**: an npm package, a git repo, or a local folder. `cmd mods add` installs a package, and Command Code loads it in every session after that.
6
-
7
- ## Manage mods from the CLI
8
-
9
- ```bash
10
- cmd mods add cmd-mod-hi # npm package (a bare name means npm)
11
- cmd mods add @team/review-mod@1.2.0 # scoped npm package, pinned to a version
12
- cmd mods add owner/repo@v1 # GitHub repo (other hosts: git:<host>/…)
13
- cmd mods add ./tools/local-mod # local folder, used where it is
14
- cmd mods add -g owner/repo # install for your user instead of this project
15
- cmd mods list # list installed mods (alias: ls)
16
- cmd mods update # install anything missing, refresh pinned refs (alias: up)
17
- cmd mods remove owner/repo # remove by source (alias: rm)
18
- cmd mods remove fun-stuff # or by the name `mods list` prints
19
- cmd mods enable <name> # turn a mod on; -g for your user
20
- cmd mods disable <name> # turn a mod off; -g for your user
21
- cmd mods open # open this project's mods folder; --user for yours
22
- cmd mods inspect ./some-mod # show what a mod hooks and reaches, without running it
23
- ```
24
-
25
- `cmd mods list` prints one line per mod: its name, its scope, and where it comes from. Project mods come first, then user mods, then mods from packages.
26
-
27
- ```
28
- Mods (2)
29
- guard · project · .commandcode/mods/guard.ts
30
- cmd-mod-hi · user · from npm:cmd-mod-hi
31
- ```
32
-
33
- A mod you dropped in shows its file. A mod from a package shows `from <source>`; its files live under `.registry/`, which you never edit by hand. Built-in mods are not listed. A package source only appears when it needs attention: it is not installed yet, or it installed but added no mods.
34
-
35
- **Removing.** `cmd mods remove` takes either a source or a mod name from `cmd mods list`, and removes whatever provides it:
36
-
37
- - a dropped-in file or folder is deleted from the mods folder;
38
- - a mod from a package removes that package, and tells you which other mods went with it;
39
- - a `mods.paths` mod has its settings entry removed.
40
-
41
- It finds the right scope on its own, so a user mod does not need `-g`. If the source is not installed in either scope, it tells you so.
42
-
43
- **Opening the folder.** `cmd mods open` opens `<project>/.commandcode/mods`, or `~/.commandcode/mods` with `--user` (`-g`), and creates it if needed. `--path` prints the folder instead of opening it.
44
-
45
- **How sources are read and saved.**
46
-
47
- - A source without a slash, or a `@scope/name`, is an npm package, so the `npm:` prefix is optional. A `git:` prefix always means git.
48
- - Sources are saved in the `mods.sources` settings key: `.commandcode/settings.json` for the project, `~/.commandcode/settings.json` with `-g`.
49
- - Versions and refs do not change what a source is: `owner/repo@v1` and `https://github.com/owner/repo` are the same package. A project entry takes priority over the same package at the user level.
50
- - Packages install into `<scope>/.commandcode/mods/.registry/{npm,git}/…`. Startup never runs npm or git by itself. A package that is configured but not installed shows a warning that points at `cmd mods update`.
51
-
52
- ## Turn a mod into a package
53
-
54
- List what the package contains in `package.json`. Entries can be exact paths, folders, or globs, relative to the package root. Entries that point outside the root are ignored.
55
-
56
- ```json
57
- {
58
- "name": "@team/review-mod",
59
- "description": "Blocks risky diffs and adds a /review command.",
60
- "keywords": ["cmd-mod", "cmd-mod-tool", "cmd-mod-command"],
61
- "repository": "https://github.com/team/review-mod",
62
- "commandcode": {
63
- "mods": ["./src/review.ts", "src/checks/*.ts"],
64
- "skills": ["./skills"]
65
- }
66
- }
67
- ```
68
-
69
- Without `commandcode.mods`, Command Code looks for a `mods/` folder, then a root `index.ts`.
70
-
71
- `commandcode.skills` lists skill folders the package ships next to its mods. Each entry is one skill folder or a folder of skills, relative to the package root. They load in every session the package loads in, so one `cmd mods add` brings both the mods and their skills. A mod can add skills from code too, with `cmd.addSkillsPath`.
72
-
73
- Add the `cmd-mod` keyword so maintainers can find your package. Kind keywords such as `cmd-mod-tool` and `cmd-mod-hook` describe it further. Publishing to npm does not put your mod on the Command Code mods hub by itself. To list it, see [Listing a mod on the mods hub](#listing-a-mod-on-the-mods-hub).
74
-
75
- ## Load only some mods from a package
76
-
77
- To load part of a package, use the object form of a `mods.sources` entry:
78
-
79
- ```json
80
- {
81
- "mods": {
82
- "sources": [
83
- {"source": "owner/review-pack", "mods": ["review/*.ts", "!review/slow.ts"]}
84
- ]
85
- }
86
- }
87
- ```
88
-
89
- Patterns match a file's path inside the package, or its mod name. There are four kinds, applied in this order:
90
-
91
- 1. `-path` always excludes that exact path, and beats everything else.
92
- 2. `+path` always includes that exact path, even if a glob dropped it.
93
- 3. `!glob` excludes matches.
94
- 4. A plain glob includes matches. When any includes exist, a mod must match one of them.
95
-
96
- `cmd mods add` and `cmd mods remove` keep entries you wrote by hand, filters included.
97
-
98
- ## Turn a mod on or off
99
-
100
- `cmd mods disable <name>` turns a mod off without removing it, and `cmd mods enable <name>` turns it back on. Both write to the project settings (`.commandcode/settings.json`) by default, or to your user settings (`~/.commandcode/settings.json`) with `-g`. The change applies on the next session or after `/reload`.
101
-
102
- ```bash
103
- cmd mods disable review-guard # off in this project
104
- cmd mods enable review-guard -g # on for your user
105
- ```
106
-
107
- They work for dropped-in files, installed packages, and the built-ins that can be turned off (`provider-copilot`, `update-notice`, `titling`, `learning`, and others). `disable` adds the name to `mods.disabled`. `enable` removes it from there, and for an opt-in built-in such as `todos` it also adds the name to `mods.enabled`:
108
-
109
- ```json
110
- {"mods": {"disabled": ["review-guard"], "enabled": ["todos"]}}
111
- ```
112
-
113
- A disable in any settings file wins. Command Code reads the user, project, and project local (`.commandcode/settings.local.json`) settings, and a `mods.disabled` entry in any of them keeps the mod off, even if another file turns it on. So if another file still disables the mod you enable, the command does not report success. It names that file, gives the fix, and exits with code 1 so a script's `&&` chain stops:
114
-
115
- ```bash
116
- $ cmd mods enable review-guard
117
- ⚠ review-guard is still disabled
118
- Your user settings (~/.commandcode/settings.json) disable it.
119
- To enable it at the user level, run: cmd mods enable review-guard -g
120
- ```
121
-
122
- No command writes to `settings.local.json`, so a disable there has to be removed by hand.
123
-
124
- **In a project you have not opened yet.** Command Code reads project settings only after it has run in that project, the same rule project mods follow. Enabling or disabling there still saves the setting, and it applies once you start Command Code in the project. Use `-g` to apply it at the user level right away. `cmd mods list --builtin` shows when a built-in will change state, for example `enabled · disabled once you start Command Code here`.
125
-
126
- ## Trust and safety
127
-
128
- - **There is no sandbox.** A mod is code that runs with your permissions, so only install packages you trust.
129
- - **Inspect before you trust.** `cmd mods inspect <path>` reads a mod's source without importing it, and lists the hooks it registers, what it adds, and what it can reach: processes, the network, the filesystem, the environment, permission answers, and transcript rewrites. It only reads the text, so code the mod imports or builds at runtime can reach further, and the report says so.
130
-
131
- ```bash
132
- $ cmd mods inspect ./permission-policy.ts
133
- files: 1
134
- hooks: onPermissionRequest
135
- registers: none
136
- reaches: answers permission prompts (onPermissionRequest)
137
- imports: none
138
- ```
139
-
140
- - **Kill switches.** `cmd --safe-mode` loads only built-in mods for one session (no installed mods, no `--mod`). `{"mods": {"disableAll": true}}` in any settings file does the same for every session until you remove it.
141
- - **Project mods need workspace trust**, like project skills. They load only after you accept the workspace trust prompt. User mods and `--mod` mods always load.
142
- - **Packages install with `npm --ignore-scripts`.** Mods are TypeScript loaded directly, so they need no build step, and install scripts would only add risk.
143
- - **Print mode loads only user mods and `--mod` mods.** Print mode never shows a trust prompt, so project mods stay out of headless runs. Pass `--dangerously-skip-permissions` to include a repo's own mods in a headless run, for example in CI.
144
-
145
- # Listing a mod on the mods hub
146
-
147
- The [Command Code mods hub](https://commandcode.ai/mods) lists the reviewed entries in `mods/registry.json` in the public [`CommandCodeAI/command-code`](https://github.com/CommandCodeAI/command-code) repo. Every mod on the mods hub needs an entry there, whether it is published to npm or lives on GitHub. Publishing a package or adding a keyword does not list it.
148
-
149
- To list your mod:
150
-
151
- 1. Publish it to npm or push it to a public GitHub repo. Check that `package.json` has the right mod entry points, description, and repository.
152
- 2. Open a PR that adds one entry to [`mods/registry.json`](https://github.com/CommandCodeAI/command-code/blob/main/mods/registry.json). For an npm mod, set both `source` and `npm` to the full package name, including its scope.
153
- 3. Maintainers review the published code. Once the PR is merged, the mods hub picks up the change within about 15 minutes, with no website deploy.
154
-
155
- ```json
156
- {
157
- "version": 1,
158
- "hidden": [],
159
- "mods": [
160
- {
161
- "name": "review-guard",
162
- "source": "owner/review-guard",
163
- "description": "Blocks risky diffs and adds a /review command.",
164
- "author": {"name": "Ada", "github": "ada"},
165
- "repo": "https://github.com/owner/review-guard",
166
- "kinds": ["tool", "command"],
167
- "tags": ["safety", "review"]
168
- }
169
- ]
170
- }
171
- ```
172
-
173
- | Field | Required | What it does |
174
- |---|:---:|---|
175
- | `name` | yes | Unique lowercase name the mods hub shows |
176
- | `source` | yes | What `cmd mods add <source>` installs: an npm name or `owner/repo` |
177
- | `description` | yes | The summary on the mods hub card, up to 240 characters |
178
- | `author.name` | yes | Who made it. Add `author.github` to link your profile |
179
- | `kinds` | yes | At least one of `tool`, `command`, `hook`, `provider`, `renderer`, `flag` |
180
- | `repo` | no | A GitHub URL. Adds a live star count |
181
- | `npm` | no | The published npm package. Adds the latest version, publish date, and monthly downloads |
182
- | `tags` | no | Lowercase search tags |
183
- | `addedAt` | no | `YYYY-MM-DD`, used to sort by newest |
184
-
185
- `official` marks a mod the Command Code team maintains, and the top level `hidden` list keeps spam or impersonation off the mods hub. Both are set by maintainers only. The full schema is `mods/registry.schema.json`.
186
-
187
- The mods hub's list, with live npm data and GitHub star counts, is also served at [`commandcode.ai/mods.json`](https://commandcode.ai/mods.json). It allows requests from any origin, so the CLI or any script can read the same list the mods hub shows.
@@ -1,253 +0,0 @@
1
- <!-- Generated from the Command Code docs: https://commandcode.ai/docs -->
2
-
3
- # UI surface
4
-
5
- Everything a mod can put on screen rides `cmd.ui`, `cmd.addRenderer`, and `cmd.showEntry`. All of it is data, never components: a mod returns strings or a small element tree, the TUI and the desktop app draw it, headless runs degrade to deterministic defaults, and a crashing render becomes a one-line warning - never a broken screen.
6
-
7
- ## Notifications and dialogs
8
-
9
- - `cmd.ui.notify(message, level?)` - a `notice` feed row, styled by `level`: `'info'` (default) is a dim bullet, `'warning'` an amber ⚠, `'error'` a red ⚠. Rendered during a turn (the per-turn feed projector); a notice raised at factory time flushes once the session binds.
10
- - `cmd.ui.toast(text, {level?, durationMs?})` - a short-lived line above the prompt that clears itself (default 4s). `level` is `info`, `success`, `warning`, or `error`. Where nothing draws toasts (headless), it falls back to a notice row so the message is never lost.
11
- - `cmd.ui.confirm({title, message?})` / `cmd.ui.select({title, options})` / `cmd.ui.input({title, placeholder?})` - the Interaction question modal in the TUI. Headless, each resolves its deterministic default: confirm → `false`, select/input → `undefined` - never auto-approved.
12
- - `cmd.ui.setTitle(text | null)` - the terminal tab title. The text replaces the session title on the tab (and survives the host's own title re-assertions) until `null` hands the tab back. Headless: no-op.
13
-
14
- ## Clipboard and sound
15
-
16
- - `cmd.ui.copy(text)` - write `text` to the system clipboard through the same helper `/copy` uses. It never throws: `{isCopied: true}`, or `{isCopied: false, reason}` where `reason` is `headless` (no interactive host), `no-clipboard` (the machine's clipboard is unreachable, for example over SSH without X11), or `error`.
17
- - `cmd.audio.play({file, timeoutMs?})` - play a sound file with the platform player: `afplay` on macOS, `paplay` then `aplay` on Linux, PowerShell `Media.SoundPlayer` on Windows. A relative `file` resolves against the directory of the mod's own file, so ship the sound next to it; an absolute path works too. It runs through the runtime shell and is killed after `timeoutMs` (default 10s). It never throws: `{isPlayed: true}`, or `{isPlayed: false, reason}` where `reason` is `headless`, `not-found`, `no-player`, `timeout`, or `error`.
18
- - `cmd.audio.bell()` - ring the terminal bell. Returns `{isPlayed: true}`, or `{isPlayed: false, reason: 'headless'}`.
19
- - Where they work today. In the desktop app, copy, bell, and play all answer `headless` for now. Over SSH without a display, copy answers `no-clipboard`. On Windows, and on Linux with only ALSA (`aplay`, no PulseAudio or PipeWire), play handles WAV files only. Ship a `.wav` if the mod should sound everywhere.
20
- - Bad arguments never throw either. A `file` that is not a string answers `error`. A `timeoutMs` that is not a positive whole number falls back to the 10s default. A hot reload stops any sound the old code started.
21
-
22
- Sound is a side effect, so do not `await` it in a hook unless the turn should wait for it:
23
-
24
- ```ts
25
- cmd.hooks({
26
- onStop: () => {
27
- void cmd.audio.play({file: './done.wav'});
28
- return undefined;
29
- },
30
- });
31
- cmd.addCommand({
32
- name: 'copy-branch',
33
- handler: async ({exec, ui}) => {
34
- const {stdout} = await exec({command: 'git', args: ['branch', '--show-current']});
35
- const copied = await ui.copy(stdout.trim());
36
- return {message: copied.isCopied ? 'Copied.' : `Not copied: ${copied.reason}`};
37
- },
38
- });
39
- ```
40
-
41
- ## Footer status segments
42
-
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
-
45
- ```ts
46
- cmd.hooks({
47
- onSessionStart: () => cmd.ui.setStatus('#channel ✓ connected'),
48
- onSessionEnd: () => cmd.ui.setStatus(null),
49
- });
50
- ```
51
-
52
- `cmd.ui.capabilities.status` / `cmd.ui.capabilities.surface` - whether this host renders footer segments, and widgets / panes / toasts (true in the interactive TUI and the desktop app, false headless). Use them to pick a surface instead of shipping a permanent fallback:
53
-
54
- ```ts
55
- if (cmd.ui.capabilities.status) cmd.ui.setStatus(text);
56
- else cmd.ui.notify(text);
57
- ```
58
-
59
- ## Elements
60
-
61
- A widget's or pane's `render({width})` returns a list of nodes. A node is a plain string (one line) or one of:
62
-
63
- | Element | Shape | Draws |
64
- |---|---|---|
65
- | text | `{type: 'text', text, color?, bold?, dim?}` | styled text; `color` is `red` `green` `yellow` `blue` `magenta` `cyan` `white` `gray` |
66
- | row | `{type: 'row', children}` | children on one line, space-separated |
67
- | box | `{type: 'box', title?, children}` | an optional bold title, then each child on its own line |
68
- | button | `{type: 'button', label, hotkey?, key?, onPress}` | `[ r: Reset ]`; `hotkey` is one letter or digit, `key` is its identity (defaults to the label) |
69
- | progress | `{type: 'progress', value, width?, label?}` | `label ██████░░░░ 60%`, `value` 0..1 |
70
- | divider | `{type: 'divider'}` | a rule across `width` |
71
- | input | `{type: 'input', key, placeholder?, value?, onSubmit(text)}` | a one-line text field `[ value ]`; editable only while its pane has focus, Enter submits |
72
- | select | `{type: 'select', key, options: [{label, value}], value?, onSelect(value)}` | `○ Small ◉ Medium ○ Large` with `value` marked; while focused, ←/→ move the highlight and Enter picks |
73
- | markdown | `{type: 'markdown', text}` | markdown drawn the way the feed draws replies (headings, lists, code, tables); a host without a markdown renderer falls back to plain lines |
74
-
75
- `width` is the columns the surface draws into, so a mod can size its own layout. Mods still own their styling: a plain string is printed as written, ansi colors and styles included. Other escape sequences (cursor moves, screen clears) and control bytes other than newline and tab are dropped from all mod text, so a mod can never take over the terminal.
76
-
77
- `input` and `select` need a `key` (their identity for focus and handlers); a button's `key` defaults to its label. Their handlers run in the mod like a hook: a throw becomes `mod_error {hook: 'ui.submit'}` or `{hook: 'ui.select'}`, and the surface repaints after every submit or pick. Keep what they set in `cmd.state` and read it back as `value`, so the field shows it after a repaint or a hot reload. Images and raster graphics are not elements: terminal graphics protocols (kitty, iTerm2, sixel) differ per terminal and do not survive the TUI's line-based redraw.
78
-
79
- ## Widgets: the band above the prompt
80
-
81
- `cmd.ui.widget({placement: 'above-editor' | 'below-editor', render})` - lines drawn around the input panel; `above-editor` is the band right above the prompt, `below-editor` sits under it with the status row. `render` re-runs on every repaint; call `cmd.ui.refreshWidgets()` after the data it reads changed (or keep that data in `cmd.state`, whose `set` repaints for you). A throwing render shows a one-line warning and reports a `mod_error` so siblings keep drawing. Widgets sit inside the surface's two-column side margins; pass `isFullWidth: true` to draw edge to edge, lined up with the prompt box (`render` then gets the prompt column's full width). Terminal UI only; other surfaces ignore it. The returned `Disposable` removes the widget. Headless: stored, drawn nowhere.
82
-
83
- ```ts
84
- let failing = 0;
85
- cmd.ui.widget({
86
- placement: 'above-editor',
87
- render: () => [
88
- failing > 0
89
- ? {type: 'text', text: `✗ ${failing} tests failing`, color: 'red'}
90
- : {type: 'text', text: '✓ tests green', color: 'green'},
91
- ],
92
- });
93
- cmd.on('tool_completed', () => {
94
- failing = readFailingCount();
95
- cmd.ui.refreshWidgets();
96
- });
97
- ```
98
-
99
- ## Panes
100
-
101
- `cmd.ui.pane({id, title, render})` - a titled, bordered panel above the prompt that the person opens and closes. Registering does not open it: `cmd.ui.openPane(id)` does (usually from a command), `cmd.ui.closePane(id)` closes it, and so do `/mods open <pane>` / `/mods close <pane>`. While a pane is open, **Alt+&lt;hotkey&gt;** presses its buttons (the pane's last line lists them) and **Alt+0** closes the newest one; typing still goes to the prompt. Hotkeys the prompt already owns (`p`, `v`, `w`, `u`, `m`) are drawn but never pressed by the chord. A pane's id is `<mod>/<id>`, so two mods can both have a `stats` pane; whether it is open survives a hot reload.
102
-
103
- **Docked on wide terminals.** From 140 columns up, open panes draw in a column to the right of the prompt (about 40% of the width, 40 to 72 columns) instead of stacking above it, and the prompt narrows to fit beside them. The feed above is scrollback, so panes dock beside the prompt, not beside the feed. Below 140 columns they stack above the prompt.
104
-
105
- ### Focus
106
-
107
- The prompt keeps the keyboard until a pane takes it, so typing never reaches a pane by accident. **Alt+↑** moves focus into the newest open pane (its border lights up and the prompt steps aside, keeping what you typed), and `cmd.ui.openPane(id, {focus: true})` opens a pane with focus, like a dialog. While a pane has focus:
108
-
109
- | Key | Does |
110
- |---|---|
111
- | Tab / ↓ | next button, input, or select (wraps) |
112
- | Shift+Tab / ↑ | previous one |
113
- | Enter | press the button, submit the input, or pick the select's highlighted option |
114
- | ←/→ | move a select's highlight |
115
- | typing, Backspace | edit the focused input (it starts from its `value`) |
116
- | Esc | give the keyboard back to the prompt. The pane stays open, and what you typed in it is still there when it takes focus again. |
117
- | Alt+0 | close the newest pane (focus returns to the prompt) |
118
-
119
- Ctrl+C still reaches the prompt's interrupt and exit keys while a pane has focus. Closing the focused pane, or a dialog taking the screen, hands the keyboard back too.
120
-
121
- ```ts
122
- cmd.ui.pane({
123
- id: 'standup',
124
- title: 'Standup',
125
- render: () => [
126
- {type: 'markdown', text: '**Today**: one line, then pick how it is going.'},
127
- {
128
- type: 'input',
129
- key: 'note',
130
- placeholder: 'what are you working on?',
131
- value: cmd.state.get<string>('note') ?? '',
132
- onSubmit: text => cmd.state.set('note', text),
133
- },
134
- {
135
- type: 'select',
136
- key: 'mood',
137
- options: [
138
- {label: 'Great', value: 'great'},
139
- {label: 'Blocked', value: 'blocked'},
140
- ],
141
- value: cmd.state.get<string>('mood'),
142
- onSelect: value => cmd.state.set('mood', value),
143
- },
144
- ],
145
- });
146
- cmd.addCommand({
147
- name: 'standup',
148
- handler: () => cmd.ui.openPane('standup', {focus: true}),
149
- });
150
- ```
151
-
152
- ```ts
153
- cmd.ui.pane({
154
- id: 'calls',
155
- title: 'Tool calls',
156
- render: () => [
157
- {type: 'progress', label: 'budget', value: calls() / 50},
158
- {
159
- type: 'button',
160
- label: 'Reset',
161
- hotkey: 'r',
162
- onPress: () => cmd.state.set('calls', 0),
163
- },
164
- ],
165
- });
166
- cmd.addCommand({name: 'calls', handler: () => cmd.ui.openPane('calls')});
167
- ```
168
-
169
- A button's `onPress` runs in the mod like a hook: a throw becomes `mod_error {hook: 'ui.press'}`, and the surface repaints after every press.
170
-
171
- ## Custom feed rendering
172
-
173
- - `cmd.addRenderer(customType, data => lines)` - a renderer for a custom entry type; returns the lines to print (style them with ansi escapes - picocolors, `@commandcode/tui` helpers, or raw codes). First registration per type wins across mods.
174
- - `cmd.showEntry(customType, data)` - render a custom entry into the live feed through the renderer registered for that type (unrendered types pretty-print as JSON). The TUI wires the sink; headless runs drop entries. Pair with `cmd.session.appendCustomEntry` when the data should also persist.
175
-
176
- ## Restyle built-in rows
177
-
178
- `cmd.ui.override(component, render)` - redraw a row Command Code draws itself, with the same [elements](#elements) widgets use. `render(props, next)` gets the row's data and returns nodes, or `undefined` to keep the built-in row. The returned `Disposable` removes the override, and a hot reload drops it with every other registration.
179
-
180
- | Component | `props` | What the nodes do |
181
- |---|---|---|
182
- | `spinner` | `{status, elapsedMs, tokens}` | appended after the working status line, on the same line |
183
- | `tool_row` | `{toolName, displayName, input, status, result?}` | drawn instead of the tool's row; `status` is `pending`, `success`, or `error`, `result` is set once it finished |
184
- | `user_message` | `{text}` | drawn instead of the person's message |
185
- | `command_output` | `{message, details?, isError}` | drawn instead of a slash command's result row |
186
-
187
- ```ts
188
- // "tool calls: 3" beside the spinner.
189
- cmd.ui.override('spinner', (_props, next) => [
190
- {type: 'text', text: `tool calls: ${calls()}`, color: 'cyan'},
191
- ...(next() ?? []),
192
- ]);
193
-
194
- // Shell rows as one line; every other tool keeps its built-in row.
195
- cmd.ui.override('tool_row', ({toolName, input}) =>
196
- toolName === 'shell_command' ? [`$ ${input}`] : undefined,
197
- );
198
- ```
199
-
200
- How overrides compose and fail:
201
-
202
- - **Load order, first answer wins.** Several mods can override the same component. The first mod to return nodes wins; `undefined` passes to the next mod, and past the last one to the built-in row.
203
- - **`next()` is the rest of the chain.** It returns what the mods loaded after this one drew, or `undefined` when the built-in row would draw. Wrap it to add to another mod's drawing instead of replacing it (`[...mine, ...(next() ?? [])]`). It runs the later mods once, however often you call it.
204
- - **A broken override falls back.** An override that throws, returns something other than an array or `undefined` (a string, or the Promise of an `async` render), or draws a malformed tree is skipped as if it returned `undefined`. It reports one `mod_error {hook: 'ui.override:<component>'}` until the mod registers it again, so a broken spinner override does not report on every frame.
205
- - **Rows redraw with the row.** The spinner redraws about 12 times a second; a tool row redraws while it is live and is final once it scrolls into the transcript. An override applies to rows drawn after it registered.
206
- - **Tool and command rows are a trust surface.** A `tool_row` or `command_output` override changes what the transcript shows for a tool call or a command. Install only mods you trust to show those rows honestly.
207
- - **Never the permission prompt.** Only the four components above are overridable; any other name throws at registration.
208
-
209
- ## In the desktop app
210
-
211
- The desktop app draws the same surface around the chat composer. Mod code still runs only in the app's main process: it renders each widget and pane there at a fixed 80 columns and sends the window plain lines and button ids, never code.
212
-
213
- - **Widgets**: `above-editor` sits right above the composer, `below-editor` right under it, with the status row below that.
214
- - **Panes**: an open pane is a card above the composer, titled, with a close button. Buttons are clickable where the mod drew them (`[ r: Reset ]`); Alt+hotkey chords are a TUI thing.
215
- - **Toasts**: the app's own toasts, titled with the mod's name.
216
- - **Styling**: ansi bold, dim, and the eight element colors map to the app theme; other escape codes (cursor moves, links, 256-color) are dropped.
217
-
218
- ## In the VS Code extension
219
-
220
- The [IDE extension](https://commandcode.ai/docs/ide) loads mods from the same places as the CLI, with one mod host per chat session.
221
-
222
- - Mod commands appear in the slash menu. `message` and `prompt` results and thrown errors show in the chat.
223
- - `notify`, `toast`, `showEntry` and `mod_error` become chat rows. `confirm`, `select` and `input` use the question card.
224
- - `setStatus` text appears in the VS Code status bar.
225
- - `cmd.store` shares `~/.commandcode/mods/.store` with the CLI.
226
- - `/mods` lists loaded and failed mods. `/mods reload [name]` reloads them.
227
-
228
- Project mods load only for the trusted workspace folder.
229
-
230
- More mods support coming soon.
231
-
232
- ## Headless behavior at a glance
233
-
234
- | Surface | Interactive TUI | Desktop app | Headless (`-p`) |
235
- |---|---|---|---|
236
- | `notify` | notice feed row | notice feed row | printed notice |
237
- | `toast` | line above the prompt, clears itself | app toast, clears itself | notice row |
238
- | `confirm` | modal | question in the composer | resolves `false` |
239
- | `select` / `input` | modal | question in the composer | resolves `undefined` |
240
- | `setStatus` | footer segment under the input | status row under the composer | stored, rendered nowhere |
241
- | `widget` | band above / below the prompt | band above / below the composer | stored, drawn nowhere |
242
- | `pane` | bordered panel above the prompt (docked right from 140 columns), Alt+key buttons, Alt+↑ focus | card above the composer, clickable buttons | stored, drawn nowhere |
243
- | `override` | redraws the spinner / tool / message / command rows | not drawn | stored, drawn nowhere |
244
- | `setTitle` | terminal tab title | no-op | no-op |
245
- | `showEntry` | rendered feed row | dropped | dropped |
246
- | `addShortcut` | dispatched after host bindings | never fires | never fires |
247
- | `sendUserMessage` | real user turn (queued while busy) | falls back to `queueMessage` | falls back to `queueMessage` |
248
- | `prompt.submit` | starts a turn when idle, queues when busy | follow-up queue | follow-up queue |
249
- | `shutdown` | exits after the turn settles | no-op | no-op |
250
- | `ui.copy` | system clipboard | `{isCopied: false, reason: 'headless'}` | `{isCopied: false, reason: 'headless'}` |
251
- | `audio.play` / `audio.bell` | platform player / terminal bell | no sound, `reason: 'headless'` | no sound, `reason: 'headless'` |
252
-
253
- **TUI only for now.** `cmd.ui.override`, `cmd.ui.setTitle`, `cmd.ui.copy`, `cmd.audio`, `cmd.addShortcut`, `cmd.shutdown`, pane focus, and typing into `input` or picking in `select` elements are handled by the interactive TUI only. The desktop app draws an `input` or `select` element as plain text it cannot focus, and a `markdown` element as styled lines.
@@ -1,67 +0,0 @@
1
- <!-- Generated from the Command Code docs: https://commandcode.ai/docs -->
2
-
3
- # Verify a mod
4
-
5
- A mod that fails to import, exports no factory, or throws in its factory becomes a **warning - never a crashed session**. That safety also means a broken mod can fail silently if you never check. This section is the verification loop: load it, list it, exercise it, reload it.
6
-
7
- ## 1. Load it without installing
8
-
9
- ```bash
10
- cmd --mod ./your-mod.ts
11
- ```
12
-
13
- `--mod` is repeatable, loads ahead of installed mods, and wins name collisions - the fastest try-it loop. No build step: jiti compiles the TypeScript at load.
14
-
15
- ## 2. Confirm it registered
16
-
17
- ```bash
18
- cmd mods list
19
- ```
20
-
21
- Your mod must appear, with no load warnings. If it does not appear, the warning printed by `cmd mods list` says why (import error, no default-export factory, factory threw, duplicate name).
22
-
23
- ## 3. Exercise every surface it registers
24
-
25
- - **Slash command** - type `/` in the chat input: the command must appear in autocomplete with its description. Run it; `{message}` renders an info row, `{prompt}` starts an automated turn.
26
- - **Tool** - ask the model to use it by name ("call count_todos"). The tool call renders in the feed like any built-in.
27
- - **Hook** - trigger the behavior it guards (for a `beforeToolCall` blocker, ask for the blocked action and watch the block reason land as the tool result).
28
- - **Input interception** - type the pattern `transformInput` matches and confirm the rewrite/consume happened.
29
- - **Status** - `cmd.ui.setStatus('text')` must show up as a segment on the row under the input, replace itself on the next call, and disappear on `setStatus(null)`.
30
- - **Widget** - an `above-editor` widget draws right above the prompt, a `below-editor` one under it; `cmd.ui.refreshWidgets()` (or a `cmd.state.set`) repaints it.
31
- - **Pane** - open it (`/mods open <pane>`, or the mod's own command): it draws above the prompt with its buttons' Alt+keys on its last line; `Alt+<key>` presses one, `Alt+0` closes it. For inputs and selects, `Alt+↑` focuses it: Tab through the fields, type, press Enter, and check the pane redraws with the new `value`.
32
- - **Toast** - `cmd.ui.toast('text')` shows above the prompt and clears itself.
33
- - **Override** - send a prompt that runs a tool: a `spinner` override shows beside the working line, a `tool_row` override replaces that tool's row. If a row still looks built-in, the override returned `undefined` or threw (look for `mod_error` with `ui.override:` in its hook).
34
- - **Permission answers** - with an `onPermissionRequest` hook, trigger a call that would prompt: an answered prompt never appears. `cmd mods inspect` lists the hook so reviewers see it too.
35
- - **Renderer** - `cmd.showEntry` rows render styled; an unregistered type pretty-prints as JSON.
36
-
37
- ### Test: block-dangerous-commands guards rm -rf
38
-
39
- ```text copy filename="Prompt"
40
- Run rm -rf /tmp/scratch-dir
41
- ```
42
-
43
- Expected result:
44
-
45
- - The mod's confirm dialog appears before the shell command runs
46
- - Declining blocks the tool - the model sees the block reason and adapts
47
- - No `tool_running` fires for the blocked call
48
-
49
- ## 4. Iterate: save, and it reloads
50
-
51
- In the interactive TUI, saving a mod's file reloads it in place, with no restart: the feed says `[mods] ✓ reloaded <name>` (or why it did not). The old code gets `onSessionEnd` with `reason: 'reload'`, then every registration it made is disposed, except tools added with `addTool`. Those keep the old code until the next session. `cmd.state` survives, and `onSessionStart` fires again with `source: 'reload'`. A save that throws while loading leaves the old code running. `/mods reload [name]` reloads on demand. Two things need more than a reload: tools (the tool set is fixed per session, so start a new session or `/reload`) and new mod files (`/reload` re-discovers). `COMMANDCODE_MODS_HOT_RELOAD=0` turns the watcher off.
52
-
53
- ## 5. Headless check (CI)
54
-
55
- ```bash
56
- cmd -p "exercise the mod" --mod ./your-mod.ts
57
- ```
58
-
59
- Print mode loads user-scope and `--mod` mods with the UI bridge degraded to deterministic defaults (confirm → false, select/input → undefined). A mod that must work in CI should behave sensibly under those defaults.
60
-
61
- ## 6. List it on the mods hub
62
-
63
- Publish the mod, then add it to the Command Code mods hub with a PR to the public registry. See [Listing a mod on the mods hub](./packaging.md#listing-a-mod-on-the-mods-hub) for the steps and fields.
64
-
65
- ## Working from the bundled examples
66
-
67
- Ask Command Code to build the mod you want and it starts from a bundled example rather than a blank file - see [Runnable examples](./overview.md#runnable-examples) for the list. Each one loads through the real mod loader in CI on every test run, so what you start from is proven to load.
@@ -1,104 +0,0 @@
1
- ---
2
- name: skill-builder
3
- description: Author a new Agent Skill for Command Code end to end — scaffold the directory, write valid SKILL.md frontmatter, structure the instructions for progressive disclosure, and verify the skill loads. Use when the user wants to create, build, or generate a skill, turn a repeated workflow, prompt, or set of scripts into a reusable skill, or fix a skill that fails validation.
4
- ---
5
-
6
- # Skill Builder
7
-
8
- You are turning a workflow the user cares about into an Agent Skill: a directory with a
9
- `SKILL.md` manifest that any agent implementing the Agent Skills standard
10
- (https://agentskills.io/specification) can discover and load on demand. Follow the steps in
11
- order; each produces something the next step consumes.
12
-
13
- ## 1. Pin down the job
14
-
15
- Before writing anything, get concrete answers to three questions — from the conversation if
16
- they are already there, otherwise ask:
17
-
18
- - **What does the skill do?** One capability per skill. If the user describes two loosely
19
- related jobs (e.g. "release notes and versioning"), propose splitting them.
20
- - **When should an agent reach for it?** The trigger phrases and task shapes. These become the
21
- `description`, which is the only thing the model sees before deciding to load the skill.
22
- - **What does it need?** Scripts, templates, reference documents, external tools. These decide
23
- whether the skill is a single SKILL.md or needs supporting files.
24
-
25
- ## 2. Choose name and location
26
-
27
- Name rules (enforced at load time — a violation means the skill is skipped with a warning):
28
-
29
- - 1–64 characters; only lowercase letters `a-z`, digits `0-9`, and hyphens
30
- - No leading, trailing, or consecutive hyphens
31
- - **Must equal the directory name** — `my-skill/SKILL.md` declares `name: my-skill`
32
-
33
- Prefer a verb-or-domain name that survives out of context: `changelog-writer` beats `helper`.
34
-
35
- Location decides who gets the skill:
36
-
37
- | Location | Scope |
38
- |----------|-------|
39
- | `.commandcode/skills/<name>/` at the project root | everyone in this repo (commit it) |
40
- | `~/.commandcode/skills/<name>/` | this user, every project |
41
- | `.agents/skills/<name>/` or `~/.agents/skills/<name>/` | same scopes, shared with other Agent-Skills tools |
42
-
43
- Default to the project location when the workflow is repo-specific, the user location when it is
44
- personal habit. Skills may be grouped in subdirectories (e.g.
45
- `.commandcode/skills/docs/changelog-writer/`) — discovery is recursive.
46
-
47
- ## 3. Write the frontmatter
48
-
49
- Required fields:
50
-
51
- ```yaml
52
- ---
53
- name: changelog-writer
54
- description: Draft changelog entries from merged PRs and commit history, grouped by change type. Use when the user asks for a changelog, release notes, or "what changed since <version>".
55
- ---
56
- ```
57
-
58
- The `description` carries the whole discovery burden. Write it as *what it does* + *when to use
59
- it*, with the words a user would actually say. Under 1024 characters; two sentences is usually
60
- right. Avoid "helps with X" — name the verbs and the artifacts.
61
-
62
- Optional fields, all standard-compliant:
63
-
64
- - `license` — a license name or bundled file reference
65
- - `compatibility` — only when the skill has real environment requirements (≤500 chars)
66
- - `metadata` — a string-to-string map for anything else (author, version, …)
67
- - `allowed-tools` — space-separated pre-approved tools (experimental across implementations)
68
-
69
- Command Code also honors these extensions (other tools ignore them safely):
70
-
71
- - `argument-hint` — shown in the slash menu, e.g. `argument-hint: "<branch> [--draft]"`
72
- - `disable-model-invocation: true` — the model never sees or auto-loads the skill; only an
73
- explicit `/name` invocation runs it. Use for destructive or highly contextual workflows.
74
- - `model` — pin a model for the skill's work
75
-
76
- ## 4. Write the body
77
-
78
- The body is the instruction set the agent follows after activation. Structure it for an agent,
79
- not a human reader: imperative steps, exact commands, decision rules for edge cases, and one
80
- worked example beat prose paragraphs.
81
-
82
- Budget for progressive disclosure — the three-tier loading model the standard defines:
83
-
84
- 1. **Metadata** (name + description) is always in context. Spend it on triggers.
85
- 2. **The SKILL.md body** loads on activation. Keep it under ~500 lines; if you are pasting long
86
- reference material, move it out.
87
- 3. **Supporting files** load only when the body points at them. Link with paths relative to the
88
- skill directory: `references/format.md`, `scripts/collect.sh`.
89
-
90
- Conventional (not required) subdirectories: `scripts/` for executable helpers, `references/` for
91
- documentation the agent reads on demand, `assets/` for templates and static files. Positional
92
- arguments from a slash invocation are available as `$ARGUMENTS` (all of them) or
93
- `$ARGUMENTS[0]`, `$ARGUMENTS[1]`, … individually.
94
-
95
- ## 5. Verify
96
-
97
- 1. Re-read the frontmatter against the rules in step 2 — especially name ↔ directory match.
98
- 2. Run `cmd skills list` (or open `/skills` in the TUI): the skill must appear with no warning.
99
- A skipped skill shows up under its failure category — fix and re-check.
100
- 3. Invoke it once with `/name` and confirm the agent follows the body as written. Trim anything
101
- it did not need.
102
-
103
- If the user will share the skill, remind them: skills are instructions plus executable code, so
104
- consumers should review the content before trusting it.