command-code 1.4.1 → 1.4.3

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.
@@ -9,19 +9,24 @@ Mods are TypeScript packages that let you modify almost any behavior of Command
9
9
  A loadable mod IS an `AgentMod` once loaded; the mod host just builds it from a factory file instead of a code import:
10
10
 
11
11
  ```bash
12
- ~/.commandcode/mods/review-guard.ts one file = one mod
13
-
14
- ▼ jiti (TypeScript, no build step)
12
+ ~/.commandcode/mods/review-guard.ts
13
+ one file = one mod
14
+ ▼ jiti · TypeScript, no build step
15
15
  default-export factory(cmd: ModApi)
16
16
 
17
17
  ▼ createModHost().register(...)
18
- hooks + addTool ──► ONE AgentMod (id `mod:<name>`), appended after the built-ins
19
- addCommand ──► /slash dispatch + autocomplete in the TUI
20
- on(event) ──► AgentEvent bus subscription (observe-only)
21
- hooks.transformInput ─► typed-prompt interception (transform / consume)
22
- addProvider ──► ProviderModule appended to the host's provider set
23
- addRenderer ──► custom feed entries (showEntry → styled lines in the TUI)
24
- queueMessage ──► the loop's steering / follow-up drains
18
+ hooks + addTool ──► ONE AgentMod
19
+ id `mod:<name>`,
20
+ appended after built-ins
21
+ addCommand ──► /slash dispatch
22
+ + TUI autocomplete
23
+ on(event) ──► AgentEvent bus
24
+ (observe-only)
25
+ hooks.transformInput ──► typed-prompt
26
+ interception
27
+ addProvider ──► ProviderModule
28
+ addRenderer ──► custom feed entries
29
+ queueMessage ──► steering drains
25
30
  ```
26
31
 
27
32
  The factory receives the API bound as `cmd`. Registration verbs are all `add*` and each returns a `Disposable` - call `.dispose()` to undo exactly that one registration.
@@ -189,7 +194,15 @@ Built-in mods always win a name collision against a discovered mod of the same n
189
194
 
190
195
  ## Runnable examples
191
196
 
192
- Runnable, single-file example mods ship with Command Code inside the bundled `mod-builder` skill (`src/skills/bundled/mod-builder/examples/`) and are validated in CI - they load through the real loader on every test run, so they never rot. Ask Command Code to "build a mod" and it reads these.
197
+ Command Code ships runnable, single-file example mods and reads them itself. You don't need to find them on disk - just ask:
198
+
199
+ ```
200
+ build a mod that blocks dangerous shell commands
201
+ ```
202
+
203
+ Command Code opens the matching example and works from it. Every example loads through the real mod loader in CI on every test run, so what it copies is proven to load.
204
+
205
+ Ask for any of these by name or by what you want:
193
206
 
194
207
  | File | Shows |
195
208
  |---|---|
@@ -215,7 +228,7 @@ Runnable, single-file example mods ship with Command Code inside the bundled `mo
215
228
  - **Reload is the `/reload` path.** Mods load once per process; `/reload` restarts the process, which re-discovers and re-imports every mod (jiti caches nothing between loads). There is no in-place hot swap.
216
229
  - **Session controls stop at the harness surface.** `cmd.sessions` covers what the live harness owns (compact, tree, navigate, labels); creating/switching/forking sessions is host lifecycle, not harness state, and stays with the host UI.
217
230
 
218
- Embedders wire the same machinery directly: `createModHost` + `loadMods` + `createHarness({modHost})` (or `createNodeHarnessSession({modHost})`). See `packages/harness/src/mod-host/` for the pieces and its `__tests__/` for executable examples.
231
+ Embedders wire the same machinery directly: `createModHost` + `loadMods` + `createHarness({modHost})` (or `createNodeHarnessSession({modHost})`), all exported from `@commandcode/harness`.
219
232
 
220
233
  ---
221
234
 
@@ -55,4 +55,4 @@ Print mode loads user-scope and `--mod` mods with the UI bridge degraded to dete
55
55
 
56
56
  ## Working from the bundled examples
57
57
 
58
- Command Code ships runnable single-file examples inside the bundled `mod-builder` skill - each one loads through the real mod loader in CI on every test run, so copying one is copying something proven to load. In the Command Code repo itself, the same validation is a vitest suite (`packages/harness/src/mod-host/__tests__/examples.test.ts`); if you are contributing an example, that test must stay green.
58
+ 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.