@cmodjs/core 5.13.4 → 6.0.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 (66) hide show
  1. package/docs/commands.md +11 -11
  2. package/docs/dependencies.md +32 -57
  3. package/docs/index.md +7 -5
  4. package/docs/install-steps.md +3 -3
  5. package/docs/jobs.md +18 -18
  6. package/docs/mod.md +36 -35
  7. package/docs/options.md +3 -3
  8. package/docs/session.md +1 -1
  9. package/docs/state.md +4 -4
  10. package/docs/testing.md +21 -21
  11. package/docs/ui.md +37 -26
  12. package/installer.d.ts +1 -2
  13. package/installer.d.ts.map +1 -1
  14. package/mod.d.ts +13 -7
  15. package/mod.d.ts.map +1 -1
  16. package/mod.js +3 -3
  17. package/package.json +1 -1
  18. package/records.d.ts +10 -2
  19. package/records.d.ts.map +1 -1
  20. package/records.js +13 -2
  21. package/register.d.ts +5 -3
  22. package/register.d.ts.map +1 -1
  23. package/register.js +4 -0
  24. package/runtime/claude.d.ts +4 -0
  25. package/runtime/claude.d.ts.map +1 -1
  26. package/runtime/lifecycle.d.ts.map +1 -1
  27. package/runtime/lifecycle.js +8 -3
  28. package/runtime/toaster.d.ts +1 -1
  29. package/runtime/toaster.d.ts.map +1 -1
  30. package/runtime/toaster.js +4 -4
  31. package/runtime/ui.d.ts +2 -1
  32. package/runtime/ui.d.ts.map +1 -1
  33. package/runtime/ui.js +14 -1
  34. package/runtime/web.js +3 -0
  35. package/src/installer.ts +1 -2
  36. package/src/mod.ts +21 -10
  37. package/src/records.ts +12 -2
  38. package/src/register.ts +11 -3
  39. package/src/runtime/claude.ts +4 -0
  40. package/src/runtime/lifecycle.ts +12 -3
  41. package/src/runtime/toaster.ts +4 -4
  42. package/src/runtime/ui.ts +14 -2
  43. package/src/runtime/web.ts +2 -0
  44. package/src/testing/fake-claude.ts +4 -0
  45. package/src/testing.ts +11 -5
  46. package/src/ui/areas.ts +1 -2
  47. package/src/ui/components.ts +10 -11
  48. package/src/ui/elements.ts +51 -3
  49. package/src/ui/panes.ts +9 -5
  50. package/src/ui/styles.ts +3 -3
  51. package/testing/fake-claude.d.ts.map +1 -1
  52. package/testing/fake-claude.js +4 -0
  53. package/testing.d.ts +2 -2
  54. package/testing.d.ts.map +1 -1
  55. package/testing.js +10 -4
  56. package/ui/areas.d.ts +1 -2
  57. package/ui/areas.d.ts.map +1 -1
  58. package/ui/components.d.ts +15 -16
  59. package/ui/components.d.ts.map +1 -1
  60. package/ui/elements.d.ts +32 -13
  61. package/ui/elements.d.ts.map +1 -1
  62. package/ui/elements.js +15 -1
  63. package/ui/panes.d.ts +7 -5
  64. package/ui/panes.d.ts.map +1 -1
  65. package/ui/styles.d.ts +3 -3
  66. package/ui/styles.d.ts.map +1 -1
package/docs/mod.md CHANGED
@@ -29,8 +29,8 @@ type ModDefinition<State, Name, Options, Hotkeys> = {
29
29
  ```tsx
30
30
  import { defineMod, sessions } from '../node_modules/@cmodjs/core/mod.js'
31
31
 
32
- export const greeter = defineMod({
33
- name: 'greeter',
32
+ export const myMod = defineMod({
33
+ name: 'my-mod',
34
34
  state: { session: { isGreeted: false } },
35
35
 
36
36
  setup(mod) {
@@ -109,28 +109,29 @@ A mod's `CHANGELOG.md`, at its root, holds what changed in each version, written
109
109
  `hooks/hooks.json` names `hooks/register.ts` as the plugin's hooks module. `register.ts` calls `registerMod` and does nothing else:
110
110
 
111
111
  ```ts
112
- import type { On, PluginOptions } from 'claude-code'
113
- import { registerMod } from '../node_modules/@cmodjs/core/register.js'
114
- import { greeter } from '../src/mod.js'
112
+ import { registerMod, type AddHook, type PluginOptions } from '../node_modules/@cmodjs/core/register.js'
113
+ import { myMod } from '../src/mod.js'
115
114
 
116
- export function register(addHook: On, options: PluginOptions): void {
117
- registerMod(addHook, greeter, options)
115
+ export function register(addHook: AddHook, options: PluginOptions): void {
116
+ registerMod(addHook, myMod, options)
118
117
  }
119
118
  ```
120
119
 
121
120
  ```ts
122
- registerMod<State, Options>(addHook: On, definition: ModDefinition<State, string, Options>, options: PluginOptions): void
123
- registerPermissionCheck(addHook: On): void
121
+ registerMod<State, Options>(addHook: AddHook, definition: ModDefinition<State, string, Options>, options: PluginOptions): void
122
+ registerPermissionCheck(addHook: AddHook): void
124
123
  registeredMod(): ModDefinition | undefined
125
124
  ```
126
125
 
126
+ `AddHook` is the function Claude Code passes `register` to add each hook, and `PluginOptions` the values it passes with it.
127
+
127
128
  `registerMod` registers one handler per Claude Code event the mod can use, and routes each event to the mod. `options` is what Claude Code passes `register`: the values of the mod's options ([options.md](options.md)). `registeredMod` returns the definition `registerMod` got, for `cmod check` to read the mod's options without starting it. `registerMod` leaves out Claude Code's permission check, the events `tool.check` and `PermissionRequest`.
128
129
 
129
130
  A mod that hears permissions calls `registerPermissionCheck` after `registerMod`. That covers `sessions.current.onPermissionCheck`, `beforePermissionCheck`, `onPermissionRequest`, `beforePermissionRequest`, and the `permissions` job:
130
131
 
131
132
  ```ts
132
- export function register(addHook: On, options: PluginOptions): void {
133
- registerMod(addHook, guard, options)
133
+ export function register(addHook: AddHook, options: PluginOptions): void {
134
+ registerMod(addHook, myMod, options)
134
135
  registerPermissionCheck(addHook)
135
136
  }
136
137
  ```
@@ -269,7 +270,7 @@ With `{ to: 'transcript' }`, the line shows dim in the conversation, where the p
269
270
  With a `level`, the line is a failure the mod works around and goes on past, and it goes to the Log in Settings and `cmod log` too, which counts each repeat with the versions it happened on. An `error` shows a toast only where cmod shows a failure the mod throws: for a mod run from its checkout, in a session working inside it ([ui.md](ui.md#toasts)). A `warning` never shows one. Throw instead when the listener or handler cannot go on.
270
271
 
271
272
  ```ts
272
- mod.log(`The rule ${name} did not load, so rulebook skips it: ${messageOf(error)}`, { level: 'error' })
273
+ mod.log(`The rule ${name} did not load, so ${mod.name} skips it: ${messageOf(error)}`, { level: 'error' })
273
274
  ```
274
275
 
275
276
  ### Hotkeys
@@ -296,13 +297,13 @@ type Hotkey = {
296
297
  - `tested.hotkey(name)` presses a hotkey in a test ([testing.md](testing.md)).
297
298
 
298
299
  ```tsx
299
- export const notes = defineMod({
300
- name: 'notes',
300
+ export const myMod = defineMod({
301
+ name: 'my-mod',
301
302
  hotkeys: {
302
- toggle: { title: 'Show or hide the notes', default: 'alt+shift+n' },
303
+ toggle: { title: 'Show or hide the page', default: 'alt+shift+n' },
303
304
  },
304
305
  setup(mod) {
305
- const page = mod.sidebar.add(notesPage)
306
+ const page = mod.sidebar.add(myPage)
306
307
  mod.hotkeys.toggle.onPress(() => page.toggle({ focus: true }))
307
308
  },
308
309
  })
@@ -381,7 +382,7 @@ type ConfigRow = { key: string; label: string; description?: string; kind: 'bool
381
382
  ## model: one question outside the conversation
382
383
 
383
384
  ```ts
384
- model.complete(request: ModelCompleteRequest, options?: { signal?: AbortSignal }): Promise<ModelCompleteResult>
385
+ model.complete(request: ModelCompleteRequest, options?: ModelCompleteOptions): Promise<ModelCompleteResult>
385
386
  ```
386
387
 
387
388
  `complete` asks a model one question through Claude Code's own login, outside the conversation, so the answer costs no context and the person sees no turn. The request names the `model`, such as `'haiku'`, and the `prompt`, and takes `system`, `maxTokens`, `effort`, and `timeoutMs`. `timeoutMs` stops a model that is slow or down, so the listener that waits on it still answers in time. `options.signal` stops the call when its `AbortController` aborts.
@@ -400,19 +401,19 @@ sessions.current.beforeTurnEnd(async (turn, { signal }) => {
400
401
  ## process: run a program
401
402
 
402
403
  ```ts
403
- process.run(argv: readonly string[], init?: ProcessRunInit): Promise<ProcessRunResult>
404
- process.spawn(argv: readonly string[], init?: { cwd?, env?, input? }): HookStream<ProcessSpawnChunk, ProcessSpawnResult>
404
+ process.run(argv: readonly string[], options?: ProcessRunOptions): Promise<ProcessRunResult>
405
+ process.spawn(argv: readonly string[], options?: ProcessSpawnOptions): Subprocess
405
406
  ```
406
407
 
407
408
  Both run a program without a shell. `argv[0]` is the program and the rest are its arguments. A bare name that cmod installed, such as `trace`, runs from cmod's programs folder ([install-steps.md](install-steps.md#run-a-program-by-its-name)), and any other name runs through Claude Code's `PATH`.
408
409
 
409
- - `init.cwd` is the program's folder, absolute or relative to the session's working folder. Without it the program runs in the session's working folder.
410
- - `init.env` sets variables over Claude Code's own environment.
410
+ - `options.cwd` is the program's folder, absolute or relative to the session's working folder. Without it the program runs in the session's working folder.
411
+ - `options.env` sets variables over Claude Code's own environment.
411
412
  - `run` takes `stdin`, and `spawn` takes `input`: text written to standard input, which then closes.
412
413
  - `run` takes `timeoutMs`: Claude Code kills the program after it, 30 seconds by default and 10 minutes at most. `longestMs`, exported from `mod.js`, is those 10 minutes in milliseconds, `600000`.
413
414
  - `run` resolves `{ exitCode, stdout, stderr, isStdoutTruncated, isStderrTruncated }` once the program exits, whatever its exit code. It keeps the first 4 MiB of each stream. A program ended by a signal has `exitCode` 1.
414
415
  - `run` rejects when the program cannot start, and when it is still running at `timeoutMs`. It reads the whole output, so a background process the program leaves writing holds the call until the timeout.
415
- - `spawn` streams `{ stream: 'stdout' | 'stderr', text }` pieces as the program writes them. Its `result` resolves `{ code, signal }` once the stream is read to its end. Its first pull rejects when the program cannot start.
416
+ - `spawn` answers a `Subprocess`, which streams `{ stream: 'stdout' | 'stderr', text }` pieces as the program writes them. Its `result` resolves `{ code, signal }` once the stream is read to its end. Its first pull rejects when the program cannot start.
416
417
  - The `for await` loop over a `spawn` is the program's life. Leaving the loop, or calling `return()` on the stream, kills the program, and so does unloading the mod. Returning from the listener does not.
417
418
 
418
419
  A job's deadline bounds the whole callback that makes these calls ([jobs.md](jobs.md#deadlines)).
@@ -420,8 +421,8 @@ A job's deadline bounds the whole callback that makes these calls ([jobs.md](job
420
421
  ```ts
421
422
  import { defineMod, process, sessions } from '../node_modules/@cmodjs/core/mod.js'
422
423
 
423
- export const branchNote = defineMod({
424
- name: 'branch-note',
424
+ export const myMod = defineMod({
425
+ name: 'my-mod',
425
426
  setup() {
426
427
  sessions.current.beforeSessionStart(async () => {
427
428
  const { exitCode, stdout } = await process.run(['git', 'branch', '--show-current'], { cwd: sessions.current.project })
@@ -439,7 +440,7 @@ fs.read(path: string): Promise<string>
439
440
  fs.write(path: string, text: string): Promise<void>
440
441
  fs.list(path?: string): Promise<Entry[]>
441
442
  fs.exists(path: string): Promise<boolean>
442
- fs.stat(path: string, options?: { resolve: boolean }): Promise<Stat>
443
+ fs.stat(path: string, options?: StatOptions): Promise<Stat>
443
444
  fs.find(glob: string | readonly string[]): Promise<readonly FileMatch[]>
444
445
  fs.onChange({ path: string | readonly string[] }, listener: (change: FileChange) => unknown): Subscription
445
446
  ```
@@ -455,7 +456,7 @@ type Stat = { isFile: boolean; isFolder: boolean; isLink: boolean; size: number;
455
456
  - `write` writes the whole file and creates its folders.
456
457
  - `list` lists a folder, the working folder without a path. A symbolic link is neither a file nor a folder, with `isLink` true. `modifiedAt` is the time it last changed, in milliseconds since 1970.
457
458
  - `exists` answers whether the path leads to a file or a folder.
458
- - `stat` answers what the path leads to, following a symbolic link, and rejects a missing path. With `{ resolve: true }` it also answers `realPath`: the absolute path, every symbolic link followed.
459
+ - `stat` answers what the path leads to, following a symbolic link, and rejects a missing path. With `StatOptions` `{ resolve: true }` it also answers `realPath`: the absolute path, every symbolic link followed.
459
460
  - `onChange` hears each file that changes, appears, or goes at a path or under a folder, the mod's own saves included. cmod checks the paths twice a second, and at most 2000 files under one call's folders. A call over more stops, with an error toast that names its paths. It works from `setup` or any time later, and for a path that does not exist yet. A relative path is under the session's working folder. `path` takes strings only, unlike other matchers:
460
461
 
461
462
  ```ts
@@ -479,7 +480,7 @@ type FileMatch = { readonly path: string; readonly name?: string; readonly metad
479
480
 
480
481
  ```ts
481
482
  const skills = await fs.find(['~/.claude/skills/*/SKILL.md', '.claude/skills/*/SKILL.md'])
482
- const planning = skills.filter((skill) => skill.metadata['modes']?.split(' ').includes('plan'))
483
+ const planning = skills.filter((skill) => skill.metadata['tags']?.split(' ').includes('plan'))
483
484
  ```
484
485
 
485
486
  ## metadata: a file's own keys
@@ -497,14 +498,14 @@ Where a file keeps its metadata depends on its type:
497
498
  ---
498
499
  name: plan
499
500
  metadata:
500
- modes.modes: plan build
501
+ my-mod.tags: plan build
501
502
  ---
502
503
  ```
503
504
 
504
505
  ```sh
505
506
  #!/bin/sh
506
507
  # /// metadata
507
- # modes.modes: plan build
508
+ # my-mod.tags: plan build
508
509
  # ///
509
510
  ```
510
511
 
@@ -518,7 +519,7 @@ metadata:
518
519
 
519
520
  ```ts
520
521
  await metadata.update('.claude/skills/plan/SKILL.md', (keys) => {
521
- keys['modes'] = 'plan build'
522
+ keys['tags'] = 'plan build'
522
523
  })
523
524
  ```
524
525
 
@@ -527,10 +528,10 @@ await metadata.update('.claude/skills/plan/SKILL.md', (keys) => {
527
528
  ## http: fetch a URL
528
529
 
529
530
  ```ts
530
- http.fetch(url: string, init?: HttpInit): Promise<HttpResponse>
531
+ http.fetch(url: string, options?: HttpOptions): Promise<HttpResponse>
531
532
  ```
532
533
 
533
- - `init` takes `method` (`GET` by default), `headers`, `body` as text, and `socketPath`, the absolute path of a Unix socket the request goes over.
534
+ - `options` takes `method` (`GET` by default), `headers`, `body` as text, and `socketPath`, the absolute path of a Unix socket the request goes over.
534
535
  - The response is `{ status, ok, headers, text }`. `ok` is true for a 2xx status. Header names are lower case.
535
536
  - A mod reaches the address its own `program` job answers on the same way ([jobs.md](jobs.md#program)).
536
537
 
@@ -543,7 +544,7 @@ type Device = { id: string; name: string; os: 'darwin' | 'linux'; arch: 'arm64'
543
544
  ```
544
545
 
545
546
  - `id` is the same on one computer for every session, mod, and reinstall, and differs between computers. cmod reads it from the operating system and stores nothing: the IOPlatformUUID on macOS, and on Linux `/etc/machine-id`, or `/var/lib/dbus/machine-id` when that holds none, as systemd and D-Bus read them, hashed for cmod the way systemd's `sd_id128_get_machine_app_specific` hashes a machine id for an app, so the id never shows the computer's own.
546
- - `name` is the name the computer goes by on its network: its LocalHostName on macOS, such as `Office-Mac-mini`, and its hostname on Linux.
547
+ - `name` is the name the computer goes by on its network: its LocalHostName on macOS, such as `Mac-mini`, and its hostname on Linux.
547
548
  - `os` and `arch` are the names cmod's builds use, such as `darwin` and `arm64`.
548
549
  - `read` reads the computer the first time the mod calls it, and answers the same device after that. It rejects on a computer other than macOS or Linux on arm64 or x64. It also rejects on a Linux computer where neither `/etc/machine-id` nor `/var/lib/dbus/machine-id` holds a machine id, as in many containers, with a sentence that names both files.
549
550
  - A mod's program that runs with no session, such as over `ssh`, reads the same device with `cmod device --json` ([commands.md](commands.md#cmod-device)).
@@ -573,8 +574,8 @@ Returns an `Error`'s `message`, or the value as text. Use it in a `catch`, where
573
574
  ```ts
574
575
  import { defineMod, fs, messageOf, sessions } from '../node_modules/@cmodjs/core/mod.js'
575
576
 
576
- export const notes = defineMod({
577
- name: 'notes',
577
+ export const myMod = defineMod({
578
+ name: 'my-mod',
578
579
  setup(mod) {
579
580
  sessions.current.onTurnEnd(async () => {
580
581
  await fs.write(`${mod.dataFolder}/last-stop.txt`, new Date().toISOString()).catch((error: unknown) => {
package/docs/options.md CHANGED
@@ -10,8 +10,8 @@ An option is a value a person sets for a mod and the mod reads, such as a token,
10
10
  import { defineMod } from '../node_modules/@cmodjs/core/mod.js'
11
11
  import { option } from '../node_modules/@cmodjs/core/options.js'
12
12
 
13
- export const ciWatch = defineMod({
14
- name: 'ci-watch',
13
+ export const myMod = defineMod({
14
+ name: 'my-mod',
15
15
  options: {
16
16
  githubToken: option.secret({ title: 'GitHub token', description: 'Reads your CI runs' }),
17
17
  every: option.number({ title: 'Check every', description: 'Minutes between checks', default: 10, min: 1 }),
@@ -89,7 +89,7 @@ Claude Code reads a plugin's options from `userConfig` in `.claude-plugin/plugin
89
89
  `testMod(mod, { options: { githubToken: 'ghp_test' } })` starts the tested mod with those values, as Claude Code passes them. Each option left out gets its default. A test that leaves out an option with no default fails with `<mod> needs <title>, which a person sets in /config. Give it to the tested mod: testMod(mod, { options: { <key>: … } }).` `fakes.config.list` answers the `/config` rows, so a test can lock a value as managed settings do ([testing.md](testing.md)).
90
90
 
91
91
  ```ts
92
- const tested = testMod(ciWatch, { options: { githubToken: 'ghp_test', branch: 'develop' } })
92
+ const tested = testMod(myMod, { options: { githubToken: 'ghp_test', branch: 'develop' } })
93
93
  await tested.start()
94
94
  expect(tested.shown.toasts).toContainEqual({ type: 'default', message: 'Watching develop every 10 minutes' })
95
95
  ```
package/docs/session.md CHANGED
@@ -206,7 +206,7 @@ sessions.current.beforeTurnEnd(async () => ((await testsPass()) ? undefined : {
206
206
 
207
207
  When several listeners answer, each sees what the one before it changed, and the first `refuse` or `result` decides.
208
208
 
209
- Claude reads each mod's `note` inside the mod's own tag, such as `<tracer_mod>…</tracer_mod>` for the mod `tracer`. Every note Claude received becomes a `Note` whose `from` is `{ type: 'mod', name }`, so `onNote({ from: { type: 'mod', name: 'tracer' } })` hears each note of tracer's that Claude got, and never one Claude Code dropped.
209
+ Claude reads each mod's `note` inside the mod's own tag, such as `<my-mod_mod>…</my-mod_mod>` for the mod `my-mod`. Every note Claude received becomes a `Note` whose `from` is `{ type: 'mod', name }`, so `onNote({ from: { type: 'mod', name: 'my-mod' } })` hears each note from my-mod that Claude got, and never one Claude Code dropped.
210
210
 
211
211
  ### The session's own events
212
212
 
package/docs/state.md CHANGED
@@ -45,8 +45,8 @@ Then pass it to `defineMod`:
45
45
  import { defineMod, sessions } from '../node_modules/@cmodjs/core/mod.js'
46
46
  import { initialState } from './state.js'
47
47
 
48
- export const tasks = defineMod({
49
- name: 'tasks',
48
+ export const myMod = defineMod({
49
+ name: 'my-mod',
50
50
  state: initialState,
51
51
  setup(mod) {
52
52
  sessions.current.onPrompt(() => {
@@ -68,8 +68,8 @@ Assign to a key. cmod saves the new value and redraws the mod.
68
68
  ```ts
69
69
  import { defineMod, sessions } from '../node_modules/@cmodjs/core/mod.js'
70
70
 
71
- export const reads = defineMod({
72
- name: 'reads',
71
+ export const myMod = defineMod({
72
+ name: 'my-mod',
73
73
  state: { memory: { readFiles: [] as readonly string[] } },
74
74
  setup(mod) {
75
75
  sessions.current.onToolResult(({ files }) => {
package/docs/testing.md CHANGED
@@ -9,10 +9,10 @@ testMod<State, Options>(definition: ModDefinition<State, string, Options>, optio
9
9
  ```ts
10
10
  import { expect, test } from 'bun:test'
11
11
  import { testMod } from '../node_modules/@cmodjs/core/testing.js'
12
- import { todo } from '../src/mod.js'
12
+ import { myMod } from '../src/mod.js'
13
13
 
14
14
  test('/todo adds the item to the project list', async () => {
15
- const tested = testMod(todo)
15
+ const tested = testMod(myMod)
16
16
 
17
17
  expect(await tested.type('/todo buy milk')).toEqual({ text: 'Added: buy milk', note: 'The to-do list is now: buy milk' })
18
18
  expect(tested.state.project.items).toEqual(['buy milk'])
@@ -98,11 +98,11 @@ Starts the mod: loads its state, runs `setup`, and adds its listeners, pages, pa
98
98
  - `raise.beforeTurnEnd({ answer?, failure? })` asks about the open turn ending. It rejects when no turn is open: add a `Prompt` first.
99
99
  - `raise.beforeContextEnd()` asks about a compaction of the open context, and resolves with the mod's answer, such as `{ summary }`. `{ task }` asks about the compaction of a task's context, a task `tested.startTask` started.
100
100
  - `raise.beforeSessionStart({ source: 'compact' })` asks about the main agent's compaction. `{ source: 'compact', task }` asks about a subagent's, which only `sessions.current.goal.beforeSessionStart` hears.
101
- - A `note` that `raise` returns is the mod's own text. What Claude Code receives, as `claudeCodeOf(tested).fire` shows it, holds the note inside the mod's tag, such as `<guard_mod>…</guard_mod>`.
101
+ - A `note` that `raise` returns is the mod's own text. What Claude Code receives, as `claudeCodeOf(tested).fire` shows it, holds the note inside the mod's tag, such as `<my-mod_mod>…</my-mod_mod>`.
102
102
 
103
103
  ```ts
104
104
  test('a force push is refused', async () => {
105
- const tested = testMod(guard)
105
+ const tested = testMod(myMod)
106
106
  await tested.add({ type: Prompt, text: 'Push it' })
107
107
 
108
108
  expect(await tested.raise.beforeToolCall({ name: 'Bash', input: { command: 'git push --force' } })).toEqual({ refuse: 'Force pushes rewrite shared history.' })
@@ -133,10 +133,10 @@ expect(await tested.fire('cmod.call', { to: 'safe-delete', method: 'restore', in
133
133
  ```ts
134
134
  import { expect, test } from 'bun:test'
135
135
  import { testMod } from '../node_modules/@cmodjs/core/testing.js'
136
- import { guard } from '../src/mod.js'
136
+ import { myMod } from '../src/mod.js'
137
137
 
138
138
  test('a force push is denied with the reason', async () => {
139
- const tested = testMod(guard)
139
+ const tested = testMod(myMod)
140
140
 
141
141
  const answer = await tested.fire('tool.check', { tool: 'Bash', input: { command: 'git push --force' }, tool_use_id: 'toolu_1' }, { decision: 'allow' })
142
142
 
@@ -151,8 +151,8 @@ A mod that adds a note to the prompts about a release answers `beforePrompt`, an
151
151
  ```ts
152
152
  import { defineMod, sessions } from '../node_modules/@cmodjs/core/mod.js'
153
153
 
154
- export const release = defineMod({
155
- name: 'release',
154
+ export const myMod = defineMod({
155
+ name: 'my-mod',
156
156
  setup() {
157
157
  sessions.current.beforePrompt({ text: /\brelease\b/i }, () => ({ note: 'Run bun run release, then push the tag.' }))
158
158
  },
@@ -162,10 +162,10 @@ export const release = defineMod({
162
162
  ```ts
163
163
  import { expect, test } from 'bun:test'
164
164
  import { testMod } from '../node_modules/@cmodjs/core/testing.js'
165
- import { release } from '../src/mod.js'
165
+ import { myMod } from '../src/mod.js'
166
166
 
167
167
  test('a prompt about a release gets the release steps, and another prompt gets nothing', async () => {
168
- const tested = testMod(release)
168
+ const tested = testMod(myMod)
169
169
 
170
170
  expect(await tested.raise.beforePrompt({ text: 'Cut a release' })).toEqual({ note: 'Run bun run release, then push the tag.' })
171
171
  expect(await tested.raise.beforePrompt({ text: 'Fix the bug' })).toBeUndefined()
@@ -194,10 +194,10 @@ The `sessions` option gives the earlier conversations, each a `FakeSession`: an
194
194
  import { expect, test } from 'bun:test'
195
195
  import { Prompt, Reply } from '../node_modules/@cmodjs/core/mod.js'
196
196
  import { testMod } from '../node_modules/@cmodjs/core/testing.js'
197
- import { recall } from '../src/mod.js'
197
+ import { myMod } from '../src/mod.js'
198
198
 
199
199
  test('/recall finds the earlier session about the deploy', async () => {
200
- const tested = testMod(recall, { sessions: [{ id: 'older', title: 'Fix the deploy', messages: [{ type: Prompt, text: 'Why did the deploy fail?' }] }] })
200
+ const tested = testMod(myMod, { sessions: [{ id: 'older', title: 'Fix the deploy', messages: [{ type: Prompt, text: 'Why did the deploy fail?' }] }] })
201
201
  await tested.add({ type: Prompt, text: 'Recall the deploy' })
202
202
  await tested.add({ type: Reply, text: 'Looking.' })
203
203
  await tested.endTurn()
@@ -212,10 +212,10 @@ A `before` listener on the current session answers what `raise` asks, such as `t
212
212
 
213
213
  ### lines
214
214
 
215
- - `shown.page.lines()` draws the page the mod shows in the Sidebar now, and `shown.pane.lines()` the pane it shows now, and each returns its rows of text. Each rejects when the mod shows none, such as `No pane of notes shows. Open one with pane.open(), from a slash command, a hotkey, or setup.` A page gets `params`, `isFocused`, and `columns`, 80 unless `lines({ columns })` gives another. A pane gets `params`, `title`, `isFocused`, true once an `open` or `toggle` with `{ focus: true }` opened it, `bodyColumns`, which is the `columns` that `lines({ columns })` gives, else the pane's own `columns`, else 80, `placement: 'dock'`, `scroll: { offset: 0, bodyRows: 24 }`, and `view: {}`. `shown.page.id` and `shown.pane.id` name what shows, and `params` holds its params.
215
+ - `shown.page.lines()` draws the page the mod shows in the Sidebar now, and `shown.pane.lines()` the pane it shows now, and each returns its rows of text. Each rejects when the mod shows none, such as `No pane of my-mod shows. Open one with pane.open(), from a slash command, a hotkey, or setup.` A page gets `params`, `isFocused`, and `columns`, 80 unless `lines({ columns })` gives another. A pane gets `params`, `title`, `isFocused`, true once an `open` or `toggle` with `{ focus: true }` opened it, `bodyColumns`, which is the `columns` that `lines({ columns })` gives, else the pane's own `columns`, else 80, `placement: 'dock'`, `scroll: { offset: 0, bodyRows: 24 }`, and `view: {}`. `shown.page.id` and `shown.pane.id` name what shows, and `params` holds its params.
216
216
  - A `Markdown` element in the mod's pages, panes, and widgets draws through the mod's own markdown styles, as it does in a session. Other mods' styles are not drawn.
217
217
  - A key in a page or widget draws as the cmod plugin gives it to Claude Code: `<mod>/<page>:<key>` in a page, `<mod>/<widget>:<key>` in a widget, and `<mod>/markdown:<scope>:<block>:<key>` in what a markdown style draws, where `<scope>` is the drawn key of the `Markdown` element that holds the block, or its place among the `Markdown` elements without a key, and `<block>` is the block's number in that element's markdown, each from `0`. In the mod's own pane, a style's key draws as `<scope>:<block>:<key>`, and in a reply as `<block>:<key>`. `press`, `input`, and `select` take the key the mod wrote, and a key two blocks share reaches the first.
218
- - Claude Code refuses a whole tree in which two `Input`, `Select`, `Markdown`, `Client`, `Raster`, or `Image` elements have one key, anywhere in it, and a refused Sidebar draws blank for the session. So drawing a page, a pane, a widget area, or a style that does it rejects with Claude Code's own text, such as `cmod: returned a tree Pane refuses: Markdown "notes/all:item-text:0" is drawn twice; each takes its own key`. Elements of different types, such as a `Box` and a `Markdown`, may share a key. Claude Code also refuses a `Box`, `Text`, or `Button` whose `hover` names no `scope` and has no `Box` with a key around it, the `Box` itself included, so drawing one rejects with `cmod: returned a tree Pane refuses: Button "notes/all:archive" hover has no Box with a key around it; the nearest keyed Box is what the pointer hovers, or a scope names its group`.
218
+ - Claude Code refuses a whole tree in which two `Input`, `Select`, `Markdown`, `Client`, `Raster`, or `Image` elements have one key, anywhere in it, and a refused Sidebar draws blank for the session. So drawing a page, a pane, a widget area, or a style that does it rejects with Claude Code's own text, such as `cmod: returned a tree Pane refuses: Markdown "my-mod/all:item-text:0" is drawn twice; each takes its own key`. Elements of different types, such as a `Box` and a `Markdown`, may share a key. Claude Code also refuses a `Box`, `Text`, or `Button` whose `hover` names no `scope` and has no `Box` with a key around it, the `Box` itself included, so drawing one rejects with `cmod: returned a tree Pane refuses: Button "my-mod/all:archive" hover has no Box with a key around it; the nearest keyed Box is what the pointer hovers, or a scope names its group`.
219
219
  - A `Button` draws as Claude Code draws it: `[ Save ]`, or `1: Save` when it is `plain` with a `hotkey`, or `Save` when it is `plain` alone. Borders and colors are not drawn.
220
220
  - `lines(area)` draws the mod's widgets in that area, in the rows the person would see, and returns them. A new widget is in the first row of its first area. A layout given in `files` as `/test/home/.local/share/cmod/widgets.json` places the widgets another way. `{ columns }` sets the row's width, 80 by default. `lines(TurnEnd)` draws under the last turn that ended, and rejects when none has: end one with `tested.endTurn()` first.
221
221
  - `lines(kind, props, requestId?)` draws the mod's style of that kind with `props` and returns its rows. `Default` draws a plain listing of the props it gets, so a test sees what the style changed. Draw `Reply` with a reply's `text` to test a markdown style. Draws that pass one `requestId` grow one streamed reply.
@@ -224,10 +224,10 @@ A `before` listener on the current session answers what `raise` asks, such as `t
224
224
  import { expect, test } from 'bun:test'
225
225
  import { BelowPrompt, Prompt } from '../node_modules/@cmodjs/core/mod.js'
226
226
  import { testMod } from '../node_modules/@cmodjs/core/testing.js'
227
- import { prompts } from '../src/mod.js'
227
+ import { myMod } from '../src/mod.js'
228
228
 
229
229
  test('the prompt count shows below the prompt', async () => {
230
- const tested = testMod(prompts)
230
+ const tested = testMod(myMod)
231
231
  await tested.add({ type: Prompt, text: 'hello' })
232
232
 
233
233
  expect(await tested.lines(BelowPrompt)).toEqual(['Prompts: 1'])
@@ -259,7 +259,7 @@ test('the hotkey shows the prompt count in the Sidebar', async () => {
259
259
 
260
260
  `shown.page` and `shown.pane` act on an element of what shows as the person does, and await its handler. Each rejects when it does not draw the element: `The pane "<pane>" of <mod> draws no <Element> with the key "<key>".`, or the same for a page.
261
261
 
262
- - `press(key)` presses the `Button` whose `key` or `label` is `key`, and runs its `onPress`.
262
+ - `press(key)` presses the `Button` whose `key` or `label` is `key`, and runs its `onPress`. A `Button` with `href` opens its page as a press in the terminal does ([ui.md](ui.md#a-button-opens-a-web-page-with-href)): it runs `uname -s` and the opener through `fakes.process.run`, or copies the link through `ui.copy` on a Linux with no display.
263
263
  - `press(key, link)` presses the link `link` in the `Markdown` whose `key` is `key`, and runs its `onLinkPress`.
264
264
  - `input(key, text)` types `text` into the `Input` whose `key` is `key` and presses Enter, which runs its `onSubmit`. With a third argument `'change'` it runs `onInput` instead, as one edit does.
265
265
  - `select(key, value)` picks the option `value` of the `Select` whose `key` is `key`, and runs its `onSelect`. It rejects an option the `Select` does not have.
@@ -333,16 +333,16 @@ Set a fake to answer a call:
333
333
  - `tool.call` answers `CronCreate`, `CronDelete`, and `CronList` by default, keeping the crons a `schedule` makes in `shown.schedules`. A call to any other tool needs a fake.
334
334
  - `files` takes symbolic links too: `testMod(mod, { files, links: { '/work/skills': '/shared/skills' } })` makes `/work/skills` a link to `/shared/skills`, so a test of `fs.find` or `metadata.update` follows it as a real file system does.
335
335
  - `testMod` opens no install page: an option with no default and no value fails `start()` with its fix, and the `installer` steps are not shown. Test a step's `render` and `isDone` by calling them with the started `mod`.
336
- - The `committer` below runs `git`, and the `process.run` fake answers in its place.
336
+ - The mod below runs `git`, and the `process.run` fake answers in its place.
337
337
 
338
338
  ```ts
339
339
  import { expect, test } from 'bun:test'
340
340
  import { Prompt } from '../node_modules/@cmodjs/core/mod.js'
341
341
  import { testMod } from '../node_modules/@cmodjs/core/testing.js'
342
- import { committer } from '../src/mod.js'
342
+ import { myMod } from '../src/mod.js'
343
343
 
344
344
  test('a Commit answer commits', async () => {
345
- const tested = testMod(committer)
345
+ const tested = testMod(myMod)
346
346
  tested.fakes.ui.ask = async () => 'Commit'
347
347
  tested.fakes.process.run = async () => ({ exitCode: 0, stdout: '', stderr: '', isStdoutTruncated: false, isStderrTruncated: false })
348
348
 
@@ -390,7 +390,7 @@ The test kit keeps no Log, as a cmod older than 4.3.0 keeps none, so every error
390
390
 
391
391
  ```ts
392
392
  test('the Mode prompt follows the mode', async () => {
393
- const tested = testMod(modes)
393
+ const tested = testMod(myMod)
394
394
  await tested.fire('prompt.context', { blocks: [] }, { blocks: [] })
395
395
 
396
396
  tested.state.session.mode = 'build'
package/docs/ui.md CHANGED
@@ -23,12 +23,11 @@ A mod never asks the person to type a command. When a toast, a page, or a pane n
23
23
 
24
24
  ## Elements
25
25
 
26
- `ui/elements.js` exports the elements a render draws with. Each takes the props Claude Code types in the `claude-code` module:
26
+ `ui/elements.js` exports the elements a render draws with, and the type of each one's props. A `color` prop takes a `Color`, Claude Code's theme names such as `'claude'` or any CSS color:
27
27
 
28
28
  - `Box`, with `BoxProps`, draws a flex container: `flexDirection`, `gap`, `padding`, `margin`, `minWidth`, and the rest.
29
29
  - `Text`, with `TextProps`, draws text: `bold`, `dimColor`, `color`, `wrap`, and the rest.
30
- - `Button`, with `ButtonProps`, draws a button: `label` or one string child, `onPress`, `hotkey`, `key`, `variant`.
31
- - `Link`, with `LinkProps`, draws a link.
30
+ - `Button`, with `ButtonProps`, draws a button: `label` or one string child, `hotkey`, `key`, `variant`, and either `onPress` or `href`. `onPress` gets a `Press`, which names the `surface` the press came from.
32
31
  - `Code`, with `CodeProps`, draws highlighted code.
33
32
  - `Markdown`, with `MarkdownProps`, draws markdown text, as Claude Code draws a reply.
34
33
  - `Input`, with `InputProps`, draws a text input. It is one line tall unless `rows` says more: `rows: 4` draws four lines that wrap, as a `<textarea>`, for a note or a comment.
@@ -40,13 +39,26 @@ A mod never asks the person to type a command. When a toast, a page, or a pane n
40
39
 
41
40
  Claude Code refuses a whole drawing that holds an element its app does not draw, and draws its own instead. A style reads `surface` to pick what to draw, and a pane reads it from its props.
42
41
 
43
- Write them as JSX in a `.tsx` file. The template's `tsconfig.json` sets `jsx: react` with `jsxFactory: h` and `jsxFragmentFactory: Fragment`. Claude Code declares `h` and `Fragment` as globals, and `testMod` supplies them in tests. Never declare, import, or name anything `h` or `Fragment` in a file that writes JSX. A component is a function that returns a `RenderElement`:
42
+ ### A Button opens a web page with href
43
+
44
+ A `Button` with `href` in place of `onPress` opens that page on the person's own device, so every control a mod draws is a `Button`, and works the same in every terminal. A link inside prose is a `Markdown` link.
45
+
46
+ ```tsx
47
+ <Button key="sign-in" href={signInUrl} label="Sign in" />
48
+ ```
49
+
50
+ Where the person presses it decides how it opens:
51
+
52
+ - In the terminal, cmod opens the page by the rule Claude Code uses for its own links. It runs the program `BROWSER` names, unless `BROWSER` is `true`. Over ssh, or on Linux with neither `DISPLAY` nor `WAYLAND_DISPLAY`, the browser is on another computer, so cmod copies the link to the person's clipboard and shows `Copied the link` with `Paste it in your browser.` under it. Anywhere else it runs `open` on macOS and `xdg-open` on Linux.
53
+ - The desktop, phone, and VS Code apps draw an `https:` link as their own link, which the app opens. They draw any other link as a button whose press copies it there, because they open only `https:`.
54
+ - The browser app draws it as a link styled as a button, which the browser opens in a new tab.
55
+
56
+ Write them as JSX in a `.tsx` file. The template's `tsconfig.json` sets `jsx: react` with `jsxFactory: h` and `jsxFragmentFactory: Fragment`. Claude Code declares `h` and `Fragment` as globals, and `testMod` supplies them in tests. Never declare, import, or name anything `h` or `Fragment` in a file that writes JSX. A component is a function that returns a `JSX.Element`, and takes its children as `JSX.Children`. Both are global, so a component imports only the elements it draws:
44
57
 
45
58
  ```tsx
46
- import type { RenderElement } from 'claude-code'
47
59
  import { Box, Text } from '../node_modules/@cmodjs/core/ui/elements.js'
48
60
 
49
- export function Count({ label, count }: { readonly label: string; readonly count: number }): RenderElement {
61
+ export function Count({ label, count }: { readonly label: string; readonly count: number }): JSX.Element {
50
62
  return (
51
63
  <Box gap={1}>
52
64
  <Text bold>{label}</Text>
@@ -66,7 +78,7 @@ An element built outside a render, at module load or in a hook, holds its props
66
78
 
67
79
  ```ts
68
80
  Tabs(props: { tabs: readonly { key: string; label: string; hotkey?: string }[]; selected: string; onSelect(key: string): void; children? })
69
- Split(props: { children: readonly RenderElement[] })
81
+ Split(props: { children: readonly JSX.Element[] })
70
82
  Panel(props: { title: string; children? })
71
83
  Toggle(props: { label: string; checked: boolean; onChange(checked: boolean): void })
72
84
  Tooltip(props: { text: string; children? })
@@ -114,7 +126,7 @@ export const notesPage: PageInit<NotesState> = {
114
126
  type PageInit<State, Params = undefined> = {
115
127
  readonly id: string
116
128
  readonly title: string
117
- render(mod: Mod<State>, props: { readonly params: Params; readonly isFocused: boolean; readonly columns: number }): RenderElement
129
+ render(mod: Mod<State>, props: { readonly params: Params; readonly isFocused: boolean; readonly columns: number }): JSX.Element
118
130
  }
119
131
 
120
132
  type Page<Params = undefined> = {
@@ -155,8 +167,8 @@ import { notesPage, type NotesState } from './pages/notes.js'
155
167
 
156
168
  const initialState: NotesState = { global: { notes: [] } }
157
169
 
158
- export const notes = defineMod({
159
- name: 'notes',
170
+ export const myMod = defineMod({
171
+ name: 'my-mod',
160
172
  state: initialState,
161
173
  hotkeys: {
162
174
  toggle: { title: 'Show or hide the notes', default: 'alt+shift+n' },
@@ -184,9 +196,9 @@ type PaneInit<State, Params = undefined> = {
184
196
  readonly rows?: number | ((state: State) => number | undefined)
185
197
  readonly closeOnEscape?: true
186
198
  readonly holdToasts?: true
187
- render(mod: Mod<State>, props: PaneProps<Params>): RenderElement
188
- onScroll?(mod: Mod<State>, e: Frozen<UiScrollInput>): void | Promise<void>
189
- onClose?(mod: Mod<State>, e: Frozen<PaneCloseInput>): void | Promise<void>
199
+ render(mod: Mod<State>, props: PaneProps<Params>): JSX.Element
200
+ onScroll?(mod: Mod<State>, scroll: PaneScroll): void | Promise<void>
201
+ onClose?(mod: Mod<State>, close: PaneClose): void | Promise<void>
190
202
  }
191
203
  ```
192
204
 
@@ -198,7 +210,7 @@ type PaneInit<State, Params = undefined> = {
198
210
  - `closeOnEscape` closes the pane when the person presses Escape while it holds the keyboard. Left out, Escape gives the keyboard back to the prompt and the pane stays.
199
211
  - `holdToasts` holds every toast back while the pane is shown, the toasts of other plugins and of Claude Code included. Use it for a pane the person answers and closes, never for one that stays open.
200
212
  - `render` draws the pane's body. `props` holds `params`, `surface`, the app that draws it, `title`, `isFocused`, `bodyColumns`, `placement` (`'dock'` or `'inline'`), `scroll`, and `view`, which transcript is on screen beside the pane.
201
- - `onScroll` runs after this pane's window moved. `onClose` runs after the pane closed, by the person or by `close()`, and `e.origin.kind` is `'person'` or `'plugin'`. A handler that throws shows the error toast `The <title> pane's <handler> threw`.
213
+ - `onScroll` runs after this pane's window moved, with a `PaneScroll`. `onClose` runs after the pane closed, by the person or by `close()`, with a `PaneClose`, whose `origin.kind` is `'person'` or `'plugin'`. A handler that throws shows the error toast `The <title> pane's <handler> threw`.
202
214
  - `open` asks Claude Code to show the pane, and `isOpen` turns true once Claude Code places it. A pane opened from what the person did shows at any width, and one opened from anything else only at 144 columns, or 110 for a pane the person opened before.
203
215
  - `focus` moves the keyboard once to the `Button`, `Input`, or `Select` the pane drew with that `key`, while the pane holds the keyboard. It resolves once the keyboard moved, and rejects with `<mod>: Claude Code did not focus "<key>" in the <title> pane: <reason>` when it did not.
204
216
  - Adding two panes with one id throws `<mod>: the pane "<id>" is already added. Give each pane its own id.`
@@ -253,7 +265,7 @@ type WidgetInit<State> = {
253
265
  readonly title: string
254
266
  readonly areas: readonly [Area, ...Area[]]
255
267
  readonly place?: { readonly side?: 'left' | 'right'; readonly size?: 'fit' | 'fill' }
256
- render(mod: Mod<State>, context: WidgetContext): RenderElement | undefined
268
+ render(mod: Mod<State>, context: WidgetContext): JSX.Element | undefined
257
269
  }
258
270
 
259
271
  type WidgetContext =
@@ -300,8 +312,8 @@ This mod places a path on the left of the row below the prompt, and its usage, b
300
312
  import { BelowPrompt, defineMod } from '../node_modules/@cmodjs/core/mod.js'
301
313
  import { Text } from '../node_modules/@cmodjs/core/ui/elements.js'
302
314
 
303
- export const status = defineMod({
304
- name: 'status',
315
+ export const myMod = defineMod({
316
+ name: 'my-mod',
305
317
  state: { session: { path: '', usage: '', branch: '', time: '', date: '' } },
306
318
  setup(mod) {
307
319
  mod.widgets.add({ id: 'path', title: 'Path', areas: [BelowPrompt], place: { size: 'fill' }, render: (current) => <Text wrap="truncate-end">{current.state.session.path}</Text> })
@@ -355,8 +367,8 @@ The rows a style changes:
355
367
  import { defineMod, sessions, TurnEnd } from '../node_modules/@cmodjs/core/mod.js'
356
368
  import { Box, Text } from '../node_modules/@cmodjs/core/ui/elements.js'
357
369
 
358
- export const turns = defineMod({
359
- name: 'turns',
370
+ export const myMod = defineMod({
371
+ name: 'my-mod',
360
372
  state: { session: { turns: 0 } },
361
373
  setup(mod) {
362
374
  mod.styles.add({
@@ -395,17 +407,16 @@ A markdown style draws wherever markdown shows: in Claude's replies and in every
395
407
  Claude Code refuses a whole drawing in which two `Input`, `Select`, `Markdown`, `Client`, `Raster`, or `Image` elements share a key. So cmod puts each block's place in front of every key its style draws, and the keys a style draws need be unique only within the one block it draws, as a component's keys are in React. The place is the block's number in its markdown, from `0`, after the `key` of the `Markdown` element that holds it, or that element's number among the ones drawn without a key. A block that draws again in its place keeps its keys, so Claude Code keeps what the person typed in its `Input`.
396
408
 
397
409
  ```tsx
398
- import type { RenderElement } from 'claude-code'
399
410
  import { defineMod, type StyleProps } from '../node_modules/@cmodjs/core/mod.js'
400
411
  import { CodeBlock } from '../node_modules/@cmodjs/core/ui/markdown.js'
401
412
  import { Text } from '../node_modules/@cmodjs/core/ui/elements.js'
402
413
 
403
- function MermaidBlock({ lang, value, Default }: StyleProps<typeof CodeBlock>): RenderElement {
414
+ function MermaidBlock({ lang, value, Default }: StyleProps<typeof CodeBlock>): JSX.Element {
404
415
  return lang === 'mermaid' ? <Text>{`diagram: ${value}`}</Text> : <Default />
405
416
  }
406
417
 
407
- export const diagrams = defineMod({
408
- name: 'diagrams',
418
+ export const myMod = defineMod({
419
+ name: 'my-mod',
409
420
  setup(mod) {
410
421
  mod.styles.add({ kind: CodeBlock, render: (_mod, props) => <MermaidBlock {...props} /> })
411
422
  },
@@ -432,7 +443,7 @@ mod.toast.dismiss(id?: ToastId): void
432
443
 
433
444
  type ToastOptions = {
434
445
  id?: ToastId
435
- description?: string | RenderElement
446
+ description?: string | JSX.Element
436
447
  action?: { label: string; onClick(): unknown }
437
448
  duration?: number
438
449
  }
@@ -485,8 +496,8 @@ type AskOptions = { options?: readonly string[]; header?: string; multiSelect?:
485
496
  ```ts
486
497
  import { defineMod, process, sessions } from '../node_modules/@cmodjs/core/mod.js'
487
498
 
488
- export const committer = defineMod({
489
- name: 'committer',
499
+ export const myMod = defineMod({
500
+ name: 'my-mod',
490
501
  setup(mod) {
491
502
  sessions.current.onTurnEnd(async () => {
492
503
  const answer = await mod.ask('Commit the changes?', { options: ['Commit', 'Wait'], header: 'Commit' })
package/installer.d.ts CHANGED
@@ -1,10 +1,9 @@
1
- import type { RenderElement } from 'claude-code';
2
1
  import type { Mod } from './mod.js';
3
2
  import type { PageProps } from './ui/panes.js';
4
3
  export type Step<State extends object = Record<never, never>> = {
5
4
  readonly id: string;
6
5
  readonly title: string;
7
- render(mod: Mod<State>, props: PageProps<undefined>): RenderElement;
6
+ render(mod: Mod<State>, props: PageProps<undefined>): JSX.Element;
8
7
  isDone(mod: Mod<State>): boolean | Promise<boolean>;
9
8
  };
10
9
  export declare function checkSteps(name: string, steps: readonly Step<never>[]): void;
@@ -1 +1 @@
1
- {"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["src/installer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,MAAM,MAAM,IAAI,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI;IAC9D,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,aAAa,CAAA;IACnE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CACpD,CAAA;AAID,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAQ5E"}
1
+ {"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["src/installer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,MAAM,MAAM,IAAI,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI;IAC9D,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC,OAAO,CAAA;IACjE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CACpD,CAAA;AAID,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAQ5E"}