deictic 0.8.1 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/API.md +81 -17
  2. package/README.md +1 -1
  3. package/dist/annotations/client.js +1 -1
  4. package/dist/bun.d.ts.map +1 -1
  5. package/dist/bun.js +26 -8
  6. package/dist/bun.js.map +1 -1
  7. package/dist/cli.js +1 -1
  8. package/dist/cli.js.map +1 -1
  9. package/dist/client/index.d.ts +13 -13
  10. package/dist/client/index.d.ts.map +1 -1
  11. package/dist/client/index.js +19 -7
  12. package/dist/client/index.js.map +1 -1
  13. package/dist/next.d.ts.map +1 -1
  14. package/dist/next.js +45 -25
  15. package/dist/next.js.map +1 -1
  16. package/dist/react/client.d.ts +19 -0
  17. package/dist/react/client.d.ts.map +1 -0
  18. package/dist/react/client.js +504 -0
  19. package/dist/react/client.js.map +1 -0
  20. package/dist/react/index.d.ts +2 -0
  21. package/dist/react/index.js +1 -0
  22. package/dist/recommended/index.d.ts +15 -7
  23. package/dist/recommended/index.d.ts.map +1 -1
  24. package/dist/recommended/index.js +1 -1
  25. package/dist/recordings/client.d.ts.map +1 -1
  26. package/dist/recordings/client.js +48 -5
  27. package/dist/recordings/client.js.map +1 -1
  28. package/dist/screenshots/client.d.ts +9 -1
  29. package/dist/screenshots/client.d.ts.map +1 -1
  30. package/dist/screenshots/rrweb.d.ts +0 -6
  31. package/dist/screenshots/rrweb.d.ts.map +1 -1
  32. package/dist/screenshots/rrweb.js +46 -12
  33. package/dist/screenshots/rrweb.js.map +1 -1
  34. package/dist/shared/board.js +1 -1
  35. package/dist/shared/client.js +44 -2
  36. package/dist/shared/client.js.map +1 -1
  37. package/dist/shared/dom.js +7 -1
  38. package/dist/shared/dom.js.map +1 -1
  39. package/dist/shared/drawer.js +1 -1
  40. package/dist/shared/endpoints.js +15 -4
  41. package/dist/shared/endpoints.js.map +1 -1
  42. package/dist/shared/index.d.ts +11 -0
  43. package/dist/shared/index.d.ts.map +1 -1
  44. package/dist/shared/index10.d.ts +70 -0
  45. package/dist/shared/index10.d.ts.map +1 -0
  46. package/dist/shared/index3.d.ts +11 -0
  47. package/dist/shared/index3.d.ts.map +1 -1
  48. package/dist/shared/index7.d.ts +92 -312
  49. package/dist/shared/index7.d.ts.map +1 -1
  50. package/dist/shared/index8.d.ts +324 -47
  51. package/dist/shared/index8.d.ts.map +1 -1
  52. package/dist/shared/index9.d.ts +45 -63
  53. package/dist/shared/index9.d.ts.map +1 -1
  54. package/dist/shared/init.js +15 -11
  55. package/dist/shared/init.js.map +1 -1
  56. package/dist/shared/integration.d.ts +6 -0
  57. package/dist/shared/integration.d.ts.map +1 -1
  58. package/dist/shared/integration.js +28 -1
  59. package/dist/shared/integration.js.map +1 -1
  60. package/dist/shared/marks.js +7 -1
  61. package/dist/shared/marks.js.map +1 -1
  62. package/dist/shared/package.js +3 -1
  63. package/dist/shared/packages.js +1 -1
  64. package/dist/shared/playwright.js +39 -1
  65. package/dist/shared/playwright.js.map +1 -1
  66. package/dist/shared/react.js +25 -0
  67. package/dist/shared/react.js.map +1 -0
  68. package/dist/shared/recommended.js +6 -3
  69. package/dist/shared/recommended.js.map +1 -1
  70. package/dist/shared/recording.js +80 -3
  71. package/dist/shared/recording.js.map +1 -1
  72. package/dist/shared/recordings.js +30 -2
  73. package/dist/shared/recordings.js.map +1 -1
  74. package/dist/shared/screenshots.js.map +1 -1
  75. package/dist/shared/src.js.map +1 -1
  76. package/dist/shared/task.js +1 -0
  77. package/dist/shared/task.js.map +1 -1
  78. package/dist/shared/tasks.js +11 -0
  79. package/dist/shared/tasks.js.map +1 -1
  80. package/dist/shared/vite.d.ts +1 -1
  81. package/dist/shared/vite.d.ts.map +1 -1
  82. package/dist/shared/vite.js +28 -10
  83. package/dist/shared/vite.js.map +1 -1
  84. package/dist/tailwind/client.d.ts +1 -1
  85. package/dist/tailwind/index.d.ts +1 -1
  86. package/dist/tasks/client.d.ts +1 -1
  87. package/dist/tasks/client.js +45 -19
  88. package/dist/tasks/client.js.map +1 -1
  89. package/dist/tasks/index.d.ts +1 -1
  90. package/dist/voice/client.d.ts +1 -1
  91. package/dist/voice/client.js +1 -1
  92. package/dist/voice/index.d.ts +1 -1
  93. package/dist/webpack.d.ts +4 -0
  94. package/dist/webpack.d.ts.map +1 -1
  95. package/dist/webpack.js +37 -15
  96. package/dist/webpack.js.map +1 -1
  97. package/package.json +25 -1
  98. package/src/bun.ts +32 -8
  99. package/src/cli/bun.ts +2 -2
  100. package/src/cli/init.ts +14 -9
  101. package/src/cli/recording.ts +90 -4
  102. package/src/cli/task.ts +4 -0
  103. package/src/cli.ts +13 -6
  104. package/src/client/dom.ts +14 -0
  105. package/src/client/index.ts +25 -14
  106. package/src/index.ts +11 -0
  107. package/src/next.ts +34 -15
  108. package/src/plugins/react/client.ts +162 -0
  109. package/src/plugins/react/index.ts +130 -0
  110. package/src/plugins/react/renders.ts +219 -0
  111. package/src/plugins/react/serialize.ts +139 -0
  112. package/src/plugins/react/timeline.ts +143 -0
  113. package/src/plugins/recommended/index.ts +17 -5
  114. package/src/plugins/recordings/client.ts +64 -4
  115. package/src/plugins/recordings/marks.ts +7 -0
  116. package/src/plugins/recordings/replay.ts +30 -2
  117. package/src/plugins/screenshots/client.ts +42 -2
  118. package/src/plugins/screenshots/index.ts +11 -0
  119. package/src/plugins/screenshots/playwright.ts +65 -1
  120. package/src/plugins/screenshots/rrweb.ts +55 -28
  121. package/src/plugins/screenshots/states.ts +26 -0
  122. package/src/plugins/tasks/client.ts +41 -6
  123. package/src/plugins/tasks/composer.ts +24 -7
  124. package/src/plugins/tasks/index.ts +16 -2
  125. package/src/tools/integration.ts +33 -0
  126. package/src/tools/source.ts +14 -2
  127. package/src/vite.ts +31 -10
  128. package/src/webpack.ts +48 -16
package/API.md CHANGED
@@ -26,19 +26,19 @@ the page point at that plugin's code, not the file.
26
26
  ```ts
27
27
  // Vite, and anything on it (React Router, TanStack Start…): vite.config.ts
28
28
  import { deictic } from 'deictic/vite';
29
- export default defineConfig({ plugins: [deictic({ plugins: recommended() }), react()] });
29
+ export default defineConfig({ plugins: [deictic({ plugins: deicticRecommended() }), react()] });
30
30
 
31
31
  // Next.js (`next dev`, Turbopack or webpack): next.config.ts
32
32
  import { withDeictic } from 'deictic/next';
33
- export default withDeictic(nextConfig, { plugins: recommended() });
33
+ export default withDeictic(nextConfig, { plugins: deicticRecommended() });
34
34
 
35
35
  // webpack 5, Rspack (`launch-editor` opens files in your editor)
36
36
  import { DeicticPlugin } from 'deictic/webpack';
37
- export default { plugins: [new DeicticPlugin({ plugins: recommended() })] };
37
+ export default { plugins: [new DeicticPlugin({ plugins: deicticRecommended() })] };
38
38
 
39
39
  // Astro: astro.config.ts
40
40
  import { deictic } from 'deictic/astro';
41
- export default defineConfig({ integrations: [deictic({ plugins: recommended() })] });
41
+ export default defineConfig({ integrations: [deictic({ plugins: deicticRecommended() })] });
42
42
  ```
43
43
 
44
44
  Astro marks `.astro` components with Astro 7 or later, and JSX islands with any version.
@@ -48,7 +48,7 @@ Bun (`Bun.serve` with HTML imports) takes one module for both the bundler plugin
48
48
  ```ts
49
49
  // deictic.plugin.ts
50
50
  import { deictic } from 'deictic/bun';
51
- export default deictic({ plugins: recommended() });
51
+ export default deictic({ plugins: deicticRecommended() });
52
52
  ```
53
53
 
54
54
  ```toml
@@ -70,7 +70,7 @@ React Native isn't supported: there's no DOM to point at.
70
70
  ```ts
71
71
  deictic({
72
72
  shortcut: { modifiers: ['Control', 'Shift'] }, // instead of Alt; `false` for none
73
- plugins: recommended({
73
+ plugins: deicticRecommended({
74
74
  tasks: { channel: 'ui', project: 'storefront', labels: { team: 'web' } },
75
75
  screenshots: { maskAllInputs: true },
76
76
  voice: false,
@@ -82,6 +82,12 @@ deictic({
82
82
  | ---------- | -------------------------------------------------------------------------------------------- |
83
83
  | `plugins` | The plugins to load. None by default. |
84
84
  | `shortcut` | `{ modifiers, button }`: held to point, pressed to open. Alt and the left button by default. |
85
+ | `defaults` | For a package that adds deictic with its own plugin: these options give way to the app's. |
86
+
87
+ A build may have deictic more than once: the app's, and one a package adds with its own plugin, as prosebook's
88
+ integrations add its copy inspector. They become one: every plugin, each name once, and every other option from the
89
+ first that sets it. One given with `defaults: true` comes after the app's, so the app's shortcut and its own plugin
90
+ of the same name win; two others that set an option two ways stop the dev server.
85
91
 
86
92
  The button is `'left'`, `'middle'` or `'right'`: `shortcut: { modifiers: ['Alt'], button: 'right' }` opens on Alt
87
93
  and a right-click, which the browser's own menu then doesn't answer. A plugin's own `shortcut` is the same, for its
@@ -136,11 +142,12 @@ keys work while the shortcut's are held, and while a tool has the page:
136
142
  | `S` | A screenshot of the window, with what's drawn on it (screenshots) |
137
143
  | `R`, `Shift+R` | Starts a recording, and stops it; discards it (recordings) |
138
144
  | `K` | The mic: a voice note, or a recording's voice (voice) |
145
+ | `P` | While a recording goes, whether React's commits go in it (react) |
139
146
  | `T` | A task about a point: the next press on the page opens the Task tab there |
140
147
 
141
148
  A recording, the mic and a drawing tool keep the panel up: stop them (`R`, `K`, `Esc`) and it goes with the keys.
142
- While a recording goes, Screenshot, the mic and Task step aside for its own controls: its time, its mic, Stop and
143
- Discard.
149
+ While a recording goes, Screenshot, the mic and Task step aside for its own controls: its time, its mic, React
150
+ (where [React state](#react-state) is loaded), Stop and Discard.
144
151
  What the tools make (shots, recordings, voice notes) waits for the next task, whichever element it's about: the Task
145
152
  tool counts them, and the Task tab lists each as a chip, to open or to leave out, and the drawer has them meanwhile. Marks stay on the
146
153
  page until a task takes them.
@@ -148,10 +155,11 @@ page until a task takes them.
148
155
  A task about a point is pinned on that point, not on an element's corner, and a shot taken as it goes has the point
149
156
  circled. It still names an element, the marked one under the point or the nearest to it, for its file and line.
150
157
 
151
- `recommended()`, from `deictic/recommended`, is tasks, screenshots, annotations, recordings and voice, and logs and
152
- network, which put the page's console and its requests in a recording. Each takes its
153
- options under its name, and `false` leaves it out (`recommended({ logs: false, network: false })`). Other plugins, your own included, go beside it:
154
- `plugins: [...recommended(), notes()]`. Each plugin is also its own import (`deictic/tasks`, `deictic/screenshots`…),
158
+ `deicticRecommended()`, from `deictic/recommended`, is tasks, screenshots, annotations, recordings and voice, and logs and
159
+ network, which put the page's console and its requests in a recording, and, where the project has React,
160
+ [React state](#react-state). Each takes its options under its name, and `false` leaves it out
161
+ (`deicticRecommended({ logs: false, react: false })`). Other plugins, your own included, go beside it:
162
+ `plugins: [...deicticRecommended(), notes()]`. It was `recommended()`. Each plugin is also its own import (`deictic/tasks`, `deictic/screenshots`…),
155
163
  to pick them one by one.
156
164
 
157
165
  What a project keeps (the history, shots, recordings, voice notes) is in `.deictic/`, which ignores itself in git.
@@ -186,8 +194,8 @@ BOARD_URL=https://team.example/api/board vite # any board, by its URL
186
194
  import { board } from '@vercel/board';
187
195
  import { local } from 'deictic/tasks';
188
196
 
189
- recommended({ tasks: { board: board() } }); // your team's, after `vercel login`
190
- recommended({ tasks: { board: local({ port: 4200 }) } }); // the one on your machine, whatever BOARD_URL says
197
+ deicticRecommended({ tasks: { board: board() } }); // your team's, after `vercel login`
198
+ deicticRecommended({ tasks: { board: local({ port: 4200 }) } }); // the one on your machine, whatever BOARD_URL says
191
199
  ```
192
200
 
193
201
  `local()` takes `port`, `dir` (its folder, from the root), `inspect: false` for none of the board's own pages, and
@@ -210,7 +218,9 @@ order, and `deictic.text` its text: the pins find it by its text, then by its pl
210
218
  component's line is the same wherever it's used; these say where: with React in development the components that use
211
219
  it, three at most, and otherwise the files around it). The element's HTML as it rendered is attached as `element.html`,
212
220
  masked as screenshots are, for whoever can't open the page as you had it: a file, so the task stays short.
213
- Untick **Attach HTML snapshot** for a task without it; `html: false` takes the box away. A screenshot attached by the
221
+ With [`reactState()`](#react-state) loaded, the props, state and hooks of the components that wrote it go beside it,
222
+ as `react.json` (`react.2.json` for the second element). Untick **Attach HTML snapshot** for a task without either;
223
+ `html: false` takes the box away. A screenshot attached by the
214
224
  button has the element outlined in it, or the point circled; one you drew on is as you drew it, and one taken from
215
225
  the tool panel is the window as it was.
216
226
 
@@ -260,7 +270,8 @@ The Task tab is for a new task. The ones there are, are in the drawer. In the ta
260
270
 
261
271
  deictic ships a skill that watches the channel and works each task as it arrives. What it runs is the package's own
262
272
  `deictic` command, so it reads tasks and recordings with the version that wrote them: `deictic watch`, `deictic task`,
263
- `deictic recording` (a timeline), `deictic frame` (a screenshot at any moment), `deictic voice` and
273
+ `deictic recording` (a timeline of what the person did and what went wrong, the page's other requests, console lines
274
+ and React commits counted, for the agent to ask for with `--only` or `--all`), `deictic frame` (a screenshot at any moment), `deictic voice` and
264
275
  `deictic transcribe`, and `deictic vb`, the board's CLI on the dev server's board (`npx deictic --help` lists them).
265
276
  Its watch ends once the channel has been quiet for 20 minutes, and the agent then stops and says so, so none watches
266
277
  for ever. `init` offers to add it; otherwise `npx skills add gkurt/deictic`.
@@ -292,6 +303,12 @@ screenshots({ renderer: dom() }); // drawn in the page with modern-screenshot: n
292
303
  `executablePath` names one. A shot has what a `<canvas>` shows, WebGL's included: `rrweb()` has a WebGL canvas keep
293
304
  its drawing buffer unless the page says otherwise.
294
305
 
306
+ With `rrweb()`, a task's screenshot is the page as it was when you Alt-clicked, not as it is when you add the task: a
307
+ tooltip, a hover card, a menu or a toast that the popup's pointer and focus close, or that time takes away, is still
308
+ in it. The page is taken as the press goes down and rendered while you type. What's hovered and focused shows as it
309
+ was (`:hover`, `:focus`, `:focus-visible`, `:focus-within`, Tailwind's `hover:` classes too), which a copy of the page
310
+ otherwise loses. Another element attached later is shot as it's attached; `dom()` takes the page as the task goes.
311
+
295
312
  Masking follows [rrweb](https://github.com/rrweb-io/rrweb)'s names and defaults: `rr-block` blanks an element
296
313
  (`blockClass`, `blockSelector`), `rr-mask` masks its text (`maskTextClass`, `maskTextSelector`), and `maskAllInputs`
297
314
  masks every field. Passwords always are. Nothing of deictic's own UI is in a shot or a recording.
@@ -318,9 +335,49 @@ and a body's fields where the body is JSON or a form; `mask: ['email']` adds nam
318
335
  dropped, a body is cut at 10,000 characters, and `ignore: ['/analytics']` leaves requests out whole. A secret under a
319
336
  name that says nothing isn't found, which is why headers and bodies are kept only when asked for.
320
337
 
338
+ ## React state
339
+
340
+ In `deicticRecommended()` where React is installed (found from where the dev server starts), under `react`, or
341
+ `reactState()` from `deictic/react` on its own. It attaches what React's DevTools would show of the element
342
+ a task is about, as `react.json`: the component that wrote it, and the ones that wrote that, each with its props and its
343
+ state (a class's, or a function's hooks, named as your code names them: `chosen`, not `State`). For a task whose change
344
+ depends on what the page held: the plan that was picked, the list that was empty. It reads React's fibers with
345
+ [bippy](https://github.com/aidenybai/bippy), in development only.
346
+
347
+ ```ts
348
+ deicticRecommended({ react: { components: 2, mask: ['email'] } });
349
+ deicticRecommended({ react: false }); // none
350
+ ```
351
+
352
+ | Option | Default | What it is |
353
+ | ------------ | ------- | ----------------------------------------------------------------------------- |
354
+ | `components` | `4` | How many components, out from the one that wrote the element |
355
+ | `mask` | none | More names whose values are blanked, as `network`'s `mask` |
356
+ | `names` | `true` | Whether hooks are named from the source and its map, fetched as DevTools does |
357
+ | `renders` | `true` | Whether each component's renders are counted, timed and explained |
358
+
359
+ Values are your page's, so they're masked as requests are: a value whose name says it's a secret (`token`, `password`,
360
+ `auth` and the like) is `***`. What JSON can't hold says what it was, in brackets (`[function onClick]`, `[<Button>]`,
361
+ `[circular]`), and what's deep or long is cut, saying so. Effects are left out.
362
+
363
+ Each component also says how it rendered, as DevTools' profiler would: how many times, how many in the 10 seconds
364
+ before the task (a loop, a burst on each keystroke), how long ago, how long the last render took (`lastMs`, with what
365
+ it rendered, and `selfMs`, its own part), and why (`mounted`, `props changed: chosen`, `state changed`, `context
366
+ changed`, `its parent rendered`). React tells them to DevTools' hook, which React Refresh installs in development, so
367
+ they're counted from when the page started deictic, not from its first render.
368
+
369
+ A recording can have React's commits too, as DevTools' profiler has them: press **React** (`P`) among its controls.
370
+ It's off until you do, stays as you leave it, for the next recording too, and carries on over a page load. Commits a
371
+ frame apart are one entry: how long they took, React's priority (`immediate` for a click or a key), and the
372
+ components that rendered, the slowest first, each with its time, where its JSX is and why. Past ten entries in a second,
373
+ the rest of that second is one entry at its end (`40 commits over 0.8s, slowest 31ms`), so a page that animates is
374
+ eleven entries a second at most. The replay
375
+ lists them beside the page under **React**, a slow one marked on the timeline; `deictic recording` lists the slow
376
+ ones and counts the rest, `--only react` lists them all, `--full` with each component's line, and `--problems` has those slower than a frame.
377
+
321
378
  ## Tailwind
322
379
 
323
- Not in `recommended()`. `tailwind()`, from `deictic/tailwind`, adds a tab that edits the element's classes in place,
380
+ Not in `deicticRecommended()`. `tailwind()`, from `deictic/tailwind`, adds a tab that edits the element's classes in place,
324
381
  with completion, previews and undo, and writes them to the source. It needs Tailwind v4.
325
382
 
326
383
  ```ts
@@ -399,6 +456,8 @@ export default defineClientPlugin<Model, Op>({
399
456
  ```
400
457
 
401
458
  - `routes` adds routes to the dev server, which the page half reaches with `request(route)`.
459
+ - `edit(place)` on the page half opens a place in a file under the root in the editor, as the popup's own link opens the
460
+ element's: a catalog entry, say. It goes through the dev server, or the `standalone` module where there's none.
402
461
  - `packages` names what it imports that the project installs itself (its optional peers): as the dev server starts,
403
462
  one that's missing is reported, with the command that installs it.
404
463
  - `context.report(problem)`, on either half, reports a problem of the plugin's own (a `Problem`: a `key` that's the
@@ -410,11 +469,16 @@ export default defineClientPlugin<Model, Op>({
410
469
  screenshots and recordings.
411
470
  - A change that isn't to a file answers `{ done: record }`, and the plugin's `undo` and `redo` get the record back.
412
471
  - Throw a `Refusal` for an op the plugin won't make. The panel shows its message.
472
+ - An edit's `file` names another file under the root than the element's (a catalog's entry). One that isn't there is
473
+ made where every edit to it is at its start, `start: 0, end: 0`, and undo takes it away again.
413
474
  - `read` and `apply` get the element's source, or a `Refusal` saying why it isn't to be found (the file doesn't parse,
414
475
  or the page runs other code than the file has): throw it where the plugin needs the source, or go on without, as
415
476
  tasks do. Text edits without it are refused.
416
477
  - `pointing(context)` on the page half draws what the plugin has on the page while a shortcut's keys are held, and
417
478
  answers what takes it away: tasks pins each task where its element is.
479
+ - `pressed(context, element)` on the page half hears a shortcut's press on a marked element as it goes down, before
480
+ the page's own handlers and before the popup takes the pointer and the focus: screenshots keeps the page as it is
481
+ then. Keep it quick: the press waits on it.
418
482
  - `context.open(plugin, element, at?)` opens the popup on another element, or on a point in it (`at`, in CSS pixels
419
483
  from its top left, which the panel then gets as `context.at`). Not while the open one holds something `unsaved`:
420
484
  its button shakes, and it answers false.
package/README.md CHANGED
@@ -59,7 +59,7 @@ In the config `init` wrote, each plugin takes its options under its name, and `f
59
59
  ```ts
60
60
  deictic({
61
61
  shortcut: { modifiers: ['Control', 'Shift'] }, // instead of Alt
62
- plugins: recommended({
62
+ plugins: deicticRecommended({
63
63
  tasks: { channel: 'ui', labels: { team: 'web' } },
64
64
  screenshots: { maskAllInputs: true },
65
65
  voice: false,
@@ -1,4 +1,4 @@
1
- import { n as MOD, r as controlFor, u as toolButton } from "../shared/dom.js";
1
+ import { a as controlFor, f as toolButton, n as MOD } from "../shared/dom.js";
2
2
  import { n as defineClientPlugin } from "../shared/src.js";
3
3
  const PAD = 6;
4
4
  const guess = (text) => text.length * 14 * .6;
package/dist/bun.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bun.d.ts","names":[],"sources":["../src/bun.ts"],"mappings":";;iBA0BiB,0BAA0B;;EAEzC;;YAGU,mBAAmB;;EAE7B,QAAQ,gBAAgB,KAAK,YAAY,QAAQ;;wBAGnC,QAAQ,UAAS,oBAAyB"}
1
+ {"version":3,"file":"bun.d.ts","names":[],"sources":["../src/bun.ts"],"mappings":";;iBA+BiB,0BAA0B;;EAEzC;;YAGU,mBAAmB;;EAE7B,QAAQ,gBAAgB,KAAK,YAAY,QAAQ;;wBAYnC,QAAQ,UAAS,oBAAyB"}
package/dist/bun.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { resolve } from "node:path";
2
2
  import { t as endpoints } from "./shared/endpoints.js";
3
- import { h as JSX, i as mark, o as prepare, r as importOf, s as writeClient } from "./shared/integration.js";
3
+ import { c as writeClient, g as JSX, i as mark, o as merge, r as importOf, s as prepare } from "./shared/integration.js";
4
4
  // src/bun.ts
5
5
  /**
6
6
  * `deictic/bun`: deictic in Bun's dev server, the bundler `Bun.serve` runs for HTML imports. Nothing
@@ -19,15 +19,28 @@ import { h as JSX, i as mark, o as prepare, r as importOf, s as writeClient } fr
19
19
  * // server.ts
20
20
  * import tools from './deictic.ts';
21
21
  * Bun.serve({ routes: { ...tools.routes, '/*': index }, development: true });
22
+ *
23
+ * bunfig may name deictic more than once: the app's, and a package's that adds its own plugin (`defaults`), as
24
+ * prosebook's does. Each made in the process for a root is kept (`made`), the first set up marks the modules, and
25
+ * the client and the endpoints, made when first needed, load all of their options merged (`merge`); any of them
26
+ * has the routes.
22
27
  */
28
+ const made = /* @__PURE__ */ new Map();
23
29
  function deictic(options = {}) {
24
- const { plugins, shortcut } = prepare(options);
30
+ prepare(options);
25
31
  const root = resolve(options.root ?? process.cwd());
26
- let handle;
32
+ let all = made.get(root);
33
+ if (all === void 0) made.set(root, all = {
34
+ given: [],
35
+ marking: false
36
+ });
37
+ all.given.push(options);
38
+ const shared = all;
39
+ const merged = () => prepare(shared.given.length === 1 ? shared.given[0] : merge(shared.given));
27
40
  const route = async (req) => {
28
- handle ??= endpoints({
41
+ shared.handle ??= endpoints({
29
42
  root,
30
- plugins,
43
+ plugins: merged().plugins,
31
44
  open: (path, { line, column }) => {
32
45
  try {
33
46
  Bun.openInEditor(path, {
@@ -40,18 +53,23 @@ function deictic(options = {}) {
40
53
  }
41
54
  }
42
55
  });
43
- return await handle(req) ?? new Response(null, { status: 404 });
56
+ return await shared.handle(req) ?? new Response(null, { status: 404 });
44
57
  };
45
58
  return {
46
59
  name: "deictic",
47
60
  routes: { "/__deictic/*": route },
48
61
  setup(build) {
49
- if ("entrypoints" in build.config) return;
50
- const client = writeClient(root, plugins, "/", shortcut);
62
+ if ("entrypoints" in build.config || shared.marking) return;
63
+ shared.marking = true;
64
+ let client;
51
65
  const forBrowser = (args) => !("side" in args) || args.side === "client";
52
66
  build.onLoad({ filter: JSX }, async (args) => {
53
67
  if (/[\\/]node_modules[\\/]/.test(args.path)) return void 0;
54
68
  const code = await Bun.file(args.path).text();
69
+ if (client === void 0) {
70
+ const { plugins, shortcut } = merged();
71
+ client = writeClient(root, plugins, "/", shortcut);
72
+ }
55
73
  const marked = mark(code, args.path, root, forBrowser(args) ? importOf(client, args.path) : "");
56
74
  if (marked === void 0) return void 0;
57
75
  return {
package/dist/bun.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bun.js","names":[],"sources":["../src/bun.ts"],"sourcesContent":["/**\n * `deictic/bun`: deictic in Bun's dev server, the bundler `Bun.serve` runs for HTML imports. Nothing\n * runs in `Bun.build`.\n *\n * Named in bunfig.toml's `[serve.static] plugins`, it marks each JSX module as it loads, and in the\n * browser appends the import of the client module, written to `.deictic/client.js`, as Bun has no\n * virtual modules for it. A bundler plugin can't add routes to the server, so the endpoints are the\n * plugin's `routes`, spread into `Bun.serve`'s; a place opens in the editor `Bun.openInEditor` finds.\n *\n * bunfig names a module whose default export is the plugin, so the plugin lives in a file of its own,\n * which the server imports too, for its routes:\n *\n * // deictic.ts\n * export default deictic({ plugins: [tailwind()] });\n * // server.ts\n * import tools from './deictic.ts';\n * Bun.serve({ routes: { ...tools.routes, '/*': index }, development: true });\n */\nimport { resolve } from 'node:path';\n\nimport type { BunPlugin } from 'bun';\n\nimport { endpoints } from './tools/endpoints.ts';\nimport { type DeicticOptions, importOf, mark, prepare, writeClient } from './tools/integration.ts';\nimport { JSX } from './tools/locate.ts';\n\nexport interface DeicticBunOptions extends DeicticOptions {\n /** The project's root, which marks and edits are from: the working directory by default. */\n root?: string;\n}\n\nexport type DeicticBunPlugin = BunPlugin & {\n /** The endpoints, as `Bun.serve` routes: `routes: { ...plugin.routes, '/*': index }`. */\n routes: Record<string, (req: Request) => Promise<Response>>;\n};\n\nexport function deictic(options: DeicticBunOptions = {}): DeicticBunPlugin {\n // Now, so a wrong set of plugins stops the dev server as it starts, rather than the page.\n const { plugins, shortcut } = prepare(options);\n const root = resolve(options.root ?? process.cwd());\n let handle: ((req: Request) => Promise<Response | undefined>) | undefined;\n const route = async (req: Request) => {\n handle ??= endpoints({\n root,\n plugins,\n open: (path, { line, column }) => {\n try {\n Bun.openInEditor(path, { line, column });\n return new Response(null, { status: 204 });\n } catch (e) {\n return new Response(`${e instanceof Error ? e.message : String(e)}: set VISUAL or EDITOR to the editor's command`, {\n status: 500,\n });\n }\n },\n });\n return (await handle(req)) ?? new Response(null, { status: 404 });\n };\n\n return {\n name: 'deictic',\n routes: { '/__deictic/*': route },\n setup(build) {\n // A build names its entry points; the dev server's bundler doesn't.\n if ('entrypoints' in build.config) return;\n const client = writeClient(root, plugins, '/', shortcut);\n // Bun names the side it loads a module for (undocumented, and not in Bun's types); the dev server's is the browser's.\n const forBrowser = (args: object) => !('side' in args) || args.side === 'client';\n build.onLoad({ filter: JSX }, async (args) => {\n // A dependency's is left to Bun, unread.\n if (/[\\\\/]node_modules[\\\\/]/.test(args.path)) return undefined;\n const code = await Bun.file(args.path).text();\n const marked = mark(code, args.path, root, forBrowser(args) ? importOf(client, args.path) : '');\n if (marked === undefined) return undefined;\n return { contents: marked.code, loader: args.path.endsWith('tsx') ? 'tsx' : 'jsx' };\n });\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAoCA,SAAgB,QAAQ,UAA6B,CAAC,GAAqB;CAEzE,MAAM,EAAE,SAAS,aAAa,QAAQ,OAAO;CAC7C,MAAM,OAAO,QAAQ,QAAQ,QAAQ,QAAQ,IAAI,CAAC;CAClD,IAAI;CACJ,MAAM,QAAQ,OAAO,QAAiB;EACpC,WAAW,UAAU;GACnB;GACA;GACA,OAAO,MAAM,EAAE,MAAM,aAAa;IAChC,IAAI;KACF,IAAI,aAAa,MAAM;MAAE;MAAM;KAAO,CAAC;KACvC,OAAO,IAAI,SAAS,MAAM,EAAE,QAAQ,IAAI,CAAC;IAC3C,SAAS,GAAG;KACV,OAAO,IAAI,SAAS,GAAG,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC,EAAE,iDAAiD,EACjH,QAAQ,IACV,CAAC;IACH;GACF;EACF,CAAC;EACD,OAAQ,MAAM,OAAO,GAAG,KAAM,IAAI,SAAS,MAAM,EAAE,QAAQ,IAAI,CAAC;CAClE;CAEA,OAAO;EACL,MAAM;EACN,QAAQ,EAAE,gBAAgB,MAAM;EAChC,MAAM,OAAO;GAEX,IAAI,iBAAiB,MAAM,QAAQ;GACnC,MAAM,SAAS,YAAY,MAAM,SAAS,KAAK,QAAQ;GAEvD,MAAM,cAAc,SAAiB,EAAE,UAAU,SAAS,KAAK,SAAS;GACxE,MAAM,OAAO,EAAE,QAAQ,IAAI,GAAG,OAAO,SAAS;IAE5C,IAAI,yBAAyB,KAAK,KAAK,IAAI,GAAG,OAAO,KAAA;IACrD,MAAM,OAAO,MAAM,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,KAAK;IAC5C,MAAM,SAAS,KAAK,MAAM,KAAK,MAAM,MAAM,WAAW,IAAI,IAAI,SAAS,QAAQ,KAAK,IAAI,IAAI,EAAE;IAC9F,IAAI,WAAW,KAAA,GAAW,OAAO,KAAA;IACjC,OAAO;KAAE,UAAU,OAAO;KAAM,QAAQ,KAAK,KAAK,SAAS,KAAK,IAAI,QAAQ;IAAM;GACpF,CAAC;EACH;CACF;AACF"}
1
+ {"version":3,"file":"bun.js","names":[],"sources":["../src/bun.ts"],"sourcesContent":["/**\n * `deictic/bun`: deictic in Bun's dev server, the bundler `Bun.serve` runs for HTML imports. Nothing\n * runs in `Bun.build`.\n *\n * Named in bunfig.toml's `[serve.static] plugins`, it marks each JSX module as it loads, and in the\n * browser appends the import of the client module, written to `.deictic/client.js`, as Bun has no\n * virtual modules for it. A bundler plugin can't add routes to the server, so the endpoints are the\n * plugin's `routes`, spread into `Bun.serve`'s; a place opens in the editor `Bun.openInEditor` finds.\n *\n * bunfig names a module whose default export is the plugin, so the plugin lives in a file of its own,\n * which the server imports too, for its routes:\n *\n * // deictic.ts\n * export default deictic({ plugins: [tailwind()] });\n * // server.ts\n * import tools from './deictic.ts';\n * Bun.serve({ routes: { ...tools.routes, '/*': index }, development: true });\n *\n * bunfig may name deictic more than once: the app's, and a package's that adds its own plugin (`defaults`), as\n * prosebook's does. Each made in the process for a root is kept (`made`), the first set up marks the modules, and\n * the client and the endpoints, made when first needed, load all of their options merged (`merge`); any of them\n * has the routes.\n */\nimport { resolve } from 'node:path';\n\nimport type { BunPlugin } from 'bun';\n\nimport { endpoints } from './tools/endpoints.ts';\nimport { type DeicticOptions, importOf, mark, merge, prepare, writeClient } from './tools/integration.ts';\nimport { JSX } from './tools/locate.ts';\n\nexport interface DeicticBunOptions extends DeicticOptions {\n /** The project's root, which marks and edits are from: the working directory by default. */\n root?: string;\n}\n\nexport type DeicticBunPlugin = BunPlugin & {\n /** The endpoints, as `Bun.serve` routes: `routes: { ...plugin.routes, '/*': index }`. */\n routes: Record<string, (req: Request) => Promise<Response>>;\n};\n\n/** Every deictic made in the process, by its root: what it was given, whether one set up its marking, and its endpoints. */\ninterface Made {\n given: DeicticBunOptions[];\n marking: boolean;\n handle?: (req: Request) => Promise<Response | undefined>;\n}\n\nconst made = new Map<string, Made>();\n\nexport function deictic(options: DeicticBunOptions = {}): DeicticBunPlugin {\n // Now, so a wrong set of plugins stops the dev server as it starts, rather than the page.\n prepare(options);\n const root = resolve(options.root ?? process.cwd());\n let all = made.get(root);\n if (all === undefined) made.set(root, (all = { given: [], marking: false }));\n all.given.push(options);\n const shared = all;\n const merged = () => prepare(shared.given.length === 1 ? shared.given[0]! : merge(shared.given));\n const route = async (req: Request) => {\n shared.handle ??= endpoints({\n root,\n plugins: merged().plugins,\n open: (path, { line, column }) => {\n try {\n Bun.openInEditor(path, { line, column });\n return new Response(null, { status: 204 });\n } catch (e) {\n return new Response(`${e instanceof Error ? e.message : String(e)}: set VISUAL or EDITOR to the editor's command`, {\n status: 500,\n });\n }\n },\n });\n return (await shared.handle(req)) ?? new Response(null, { status: 404 });\n };\n\n return {\n name: 'deictic',\n routes: { '/__deictic/*': route },\n setup(build) {\n // A build names its entry points; the dev server's bundler doesn't.\n if ('entrypoints' in build.config || shared.marking) return;\n shared.marking = true;\n let client: string | undefined;\n // Bun names the side it loads a module for (undocumented, and not in Bun's types); the dev server's is the browser's.\n const forBrowser = (args: object) => !('side' in args) || args.side === 'client';\n build.onLoad({ filter: JSX }, async (args) => {\n // A dependency's is left to Bun, unread.\n if (/[\\\\/]node_modules[\\\\/]/.test(args.path)) return undefined;\n const code = await Bun.file(args.path).text();\n // Written as the first module loads, once bunfig's every deictic has been made.\n if (client === undefined) {\n const { plugins, shortcut } = merged();\n client = writeClient(root, plugins, '/', shortcut);\n }\n const marked = mark(code, args.path, root, forBrowser(args) ? importOf(client, args.path) : '');\n if (marked === undefined) return undefined;\n return { contents: marked.code, loader: args.path.endsWith('tsx') ? 'tsx' : 'jsx' };\n });\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,MAAM,uBAAO,IAAI,IAAkB;AAEnC,SAAgB,QAAQ,UAA6B,CAAC,GAAqB;CAEzE,QAAQ,OAAO;CACf,MAAM,OAAO,QAAQ,QAAQ,QAAQ,QAAQ,IAAI,CAAC;CAClD,IAAI,MAAM,KAAK,IAAI,IAAI;CACvB,IAAI,QAAQ,KAAA,GAAW,KAAK,IAAI,MAAO,MAAM;EAAE,OAAO,CAAC;EAAG,SAAS;CAAM,CAAE;CAC3E,IAAI,MAAM,KAAK,OAAO;CACtB,MAAM,SAAS;CACf,MAAM,eAAe,QAAQ,OAAO,MAAM,WAAW,IAAI,OAAO,MAAM,KAAM,MAAM,OAAO,KAAK,CAAC;CAC/F,MAAM,QAAQ,OAAO,QAAiB;EACpC,OAAO,WAAW,UAAU;GAC1B;GACA,SAAS,OAAO,CAAC,CAAC;GAClB,OAAO,MAAM,EAAE,MAAM,aAAa;IAChC,IAAI;KACF,IAAI,aAAa,MAAM;MAAE;MAAM;KAAO,CAAC;KACvC,OAAO,IAAI,SAAS,MAAM,EAAE,QAAQ,IAAI,CAAC;IAC3C,SAAS,GAAG;KACV,OAAO,IAAI,SAAS,GAAG,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC,EAAE,iDAAiD,EACjH,QAAQ,IACV,CAAC;IACH;GACF;EACF,CAAC;EACD,OAAQ,MAAM,OAAO,OAAO,GAAG,KAAM,IAAI,SAAS,MAAM,EAAE,QAAQ,IAAI,CAAC;CACzE;CAEA,OAAO;EACL,MAAM;EACN,QAAQ,EAAE,gBAAgB,MAAM;EAChC,MAAM,OAAO;GAEX,IAAI,iBAAiB,MAAM,UAAU,OAAO,SAAS;GACrD,OAAO,UAAU;GACjB,IAAI;GAEJ,MAAM,cAAc,SAAiB,EAAE,UAAU,SAAS,KAAK,SAAS;GACxE,MAAM,OAAO,EAAE,QAAQ,IAAI,GAAG,OAAO,SAAS;IAE5C,IAAI,yBAAyB,KAAK,KAAK,IAAI,GAAG,OAAO,KAAA;IACrD,MAAM,OAAO,MAAM,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,KAAK;IAE5C,IAAI,WAAW,KAAA,GAAW;KACxB,MAAM,EAAE,SAAS,aAAa,OAAO;KACrC,SAAS,YAAY,MAAM,SAAS,KAAK,QAAQ;IACnD;IACA,MAAM,SAAS,KAAK,MAAM,KAAK,MAAM,MAAM,WAAW,IAAI,IAAI,SAAS,QAAQ,KAAK,IAAI,IAAI,EAAE;IAC9F,IAAI,WAAW,KAAA,GAAW,OAAO,KAAA;IACjC,OAAO;KAAE,UAAU,OAAO;KAAM,QAAQ,KAAK,KAAK,SAAS,KAAK,IAAI,QAAQ;IAAM;GACpF,CAAC;EACH;CACF;AACF"}
package/dist/cli.js CHANGED
@@ -29,7 +29,7 @@ program.commandsGroup("For the agent that works the tasks (the skill):");
29
29
  program.command("vb").description("the board on the dev server: deictic vb whoami, deictic vb tasks claim 68 --lease 30m").argument("[args...]", "anything vb takes").helpOption(false).allowUnknownOption().passThroughOptions().action(async (args) => (await import("./shared/vb.js")).run(args));
30
30
  program.command("watch").description("a line per new task, reply and cancellation").argument("[channel]", "the channel", "deictic").option("--idle <time>", "ends once the channel has had nothing for this long: 30m, 45s, 1h", "20m").option("--once", "ends at the first thing to act on").option("--label <key=value>", "only tasks with this label (repeatable)", all).action(async (channel, options) => (await import("./shared/watch.js")).run(channel, options));
31
31
  program.command("task").description("a task briefly: what was asked, by whom, who holds it, what is attached").argument("<id>", "the task: 68 or #68").option("--out <dir>", "downloads what is attached here").action(async (id, options) => (await import("./shared/task.js")).run(id, options));
32
- program.command("recording").description("a recording as a timeline, or the part of it asked for").argument("<recording>", RECORDING).option("--nth <n>", "a task's nth recording", "1").option("--only <kinds>", "these kinds of line: console, request, page, click, input, scroll, resize, marks, voice (repeatable)", all).option("--problems", "errors, warnings and requests that failed").option("--from <seconds>", "from this far in").option("--to <seconds>", "to this far in").option("--around <seconds>", "the 3 seconds either side of this").option("--grep <text>", "lines with this in them, in any case").option("--full", "all of each line: where it was logged from, a request's headers and bodies").option("--json", "as JSON").action(async (ref, options) => (await import("./shared/recording.js")).run(ref, options));
32
+ program.command("recording").description("a recording as a timeline: what the person did and what went wrong, with a count of the page's other requests, console lines and React commits; or the part of it asked for").argument("<recording>", RECORDING).option("--nth <n>", "a task's nth recording", "1").option("--only <kinds>", "these kinds of line: console, request, react, page, click, input, scroll, resize, marks, voice (repeatable)", all).option("--all", "every line: every request, console line and React commit too").option("--problems", "errors, warnings, requests that failed and React commits slower than a frame").option("--from <seconds>", "from this far in").option("--to <seconds>", "to this far in").option("--around <seconds>", "every line of the 3 seconds either side of this").option("--grep <text>", "lines with this in them, in any case, of every line").option("--full", "all of each line: where it was logged from, a request's headers and bodies, a React commit's components").option("--json", "as JSON").action(async (ref, options) => (await import("./shared/recording.js")).run(ref, options));
33
33
  program.command("frame").description("PNGs of a recording, as the replay draws it, marks and all (needs the dev server)").argument("<recording>", RECORDING).option("--nth <n>", "a task's nth recording", "1").option("--at <seconds>", "a frame this far in (repeatable); by default after each change to the marks, and the end", all).option("--every <seconds>", "a frame this often").option("--out <dir>", "where the PNGs go, a temporary folder by default").option("--base <url>", "the dev server, where it's not the recorded page's origin").action(async (ref, options) => (await import("./shared/frame.js")).run(ref, options));
34
34
  program.command("voice").description("when speech happens in voice clips, in the recording's time").argument("<clip>", CLIP).option("--noise <dB>", "what counts as silence; lower hears quieter speech", "-35").option("--gap <seconds>", "the shortest silence between stretches of speech", "0.4").option("--wav <dir>", "also writes each clip here as 16 kHz WAV").option("--json", "as JSON").action(async (ref, options) => (await import("./shared/voice2.js")).run(ref, options));
35
35
  program.command("transcribe").description("what was said in voice clips, on this machine, with when").argument("[clip]", CLIP).option("--setup", "installs it, outside the project: ask the person first").option("--model <size>", "tiny, base, small, large-v3-turbo, or a model ID", "base").option("--language <code>", "the language spoken (en), rather than guessed").option("--json", "as JSON").action(async (ref, options) => (await import("./shared/transcribe.js")).run(ref, options));
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","names":[],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * The `deictic` command. `init` sets a project up and `clean` deletes what it kept, for the person; the rest are for\n * the agent that works the tasks, as the skill says: the board, a watch, a task, and what a task carries. Each is\n * declared here, its arguments and options with what they do, which is all `--help` needs; what it runs is in `cli/`,\n * imported only when it's run, so `deictic task` doesn't load the parser `init` edits configs with. Run in the\n * project, where its board and `.deictic/` are: `npx deictic <command>`.\n */\nimport { Argument, Command } from 'commander';\n\n/** A repeatable option's values, in order. */\nconst all = (value: string, previous: string[] | undefined) => [...(previous ?? []), value];\nconst RECORDING = 'a task (68), a replay URL, a recording ID or a JSON file';\nconst CLIP = 'a task, a replay URL, a recording ID, an audio file or a clip ID';\n\nconst program = new Command('deictic')\n .usage('<command> [options]')\n .enablePositionalOptions()\n .helpOption('-h, --help', 'says what a command takes')\n .showHelpAfterError('(add --help for what it takes)')\n .addHelpText('after', '\\nRun in the project. deictic help <command>, or <command> --help, says what it takes.');\n\nprogram.commandsGroup('Setting up and cleaning up:');\n// Here, not under a heading of its own, which a lone `help` would get.\nprogram.helpCommand('help [command]', 'says what a command takes');\n\nprogram\n .command('init')\n .description('sets deictic up in this project')\n .option('--dry-run', 'says what it would do, and does none of it')\n .option('--no-install', \"doesn't install: says the command instead\")\n .option('--skill', 'adds the agent skill without asking')\n .option('--no-skill', \"doesn't add the agent skill: says the command instead\")\n .action(async (options) => (await import('./cli/init.ts')).run(options));\n\nprogram\n .command('clean')\n .description('deletes what deictic kept, after saying what and how big and asking')\n .addArgument(\n new Argument('[parts...]', 'what to delete: shots, recordings and voice clips by default').choices([\n 'screenshots',\n 'recordings',\n 'voice',\n 'history',\n 'board',\n 'all',\n 'transcribe',\n ]),\n )\n .option('-y, --yes', \"deletes without asking: with no terminal to ask on, it doesn't delete without it\")\n .addHelpText(\n 'after',\n '\\nhistory (undo) and board (the local board, its tasks) only with the dev server stopped. all is everything in' +\n \"\\nthe project's .deictic/; transcribe is the transcription model, outside it, which every project shares.\",\n )\n .action(async (parts: string[], options) => (await import('./cli/clean.ts')).run(parts, options));\n\nprogram.commandsGroup('For the agent that works the tasks (the skill):');\n\nprogram\n .command('vb')\n .description('the board on the dev server: deictic vb whoami, deictic vb tasks claim 68 --lease 30m')\n .argument('[args...]', 'anything vb takes')\n // All of it is vb's, --help too.\n .helpOption(false)\n .allowUnknownOption()\n .passThroughOptions()\n .action(async (args: string[]) => (await import('./cli/vb.ts')).run(args));\n\nprogram\n .command('watch')\n .description('a line per new task, reply and cancellation')\n .argument('[channel]', 'the channel', 'deictic')\n .option('--idle <time>', 'ends once the channel has had nothing for this long: 30m, 45s, 1h', '20m')\n .option('--once', 'ends at the first thing to act on')\n .option('--label <key=value>', 'only tasks with this label (repeatable)', all)\n .action(async (channel: string, options) => (await import('./cli/watch.ts')).run(channel, options));\n\nprogram\n .command('task')\n .description('a task briefly: what was asked, by whom, who holds it, what is attached')\n .argument('<id>', 'the task: 68 or #68')\n .option('--out <dir>', 'downloads what is attached here')\n .action(async (id: string, options) => (await import('./cli/task.ts')).run(id, options));\n\nprogram\n .command('recording')\n .description('a recording as a timeline, or the part of it asked for')\n .argument('<recording>', RECORDING)\n .option('--nth <n>', \"a task's nth recording\", '1')\n .option('--only <kinds>', 'these kinds of line: console, request, page, click, input, scroll, resize, marks, voice (repeatable)', all)\n .option('--problems', 'errors, warnings and requests that failed')\n .option('--from <seconds>', 'from this far in')\n .option('--to <seconds>', 'to this far in')\n .option('--around <seconds>', 'the 3 seconds either side of this')\n .option('--grep <text>', 'lines with this in them, in any case')\n .option('--full', \"all of each line: where it was logged from, a request's headers and bodies\")\n .option('--json', 'as JSON')\n .action(async (ref: string, options) => (await import('./cli/recording.ts')).run(ref, options));\n\nprogram\n .command('frame')\n .description('PNGs of a recording, as the replay draws it, marks and all (needs the dev server)')\n .argument('<recording>', RECORDING)\n .option('--nth <n>', \"a task's nth recording\", '1')\n .option('--at <seconds>', 'a frame this far in (repeatable); by default after each change to the marks, and the end', all)\n .option('--every <seconds>', 'a frame this often')\n .option('--out <dir>', 'where the PNGs go, a temporary folder by default')\n .option('--base <url>', \"the dev server, where it's not the recorded page's origin\")\n .action(async (ref: string, options) => (await import('./cli/frame.ts')).run(ref, options));\n\nprogram\n .command('voice')\n .description(\"when speech happens in voice clips, in the recording's time\")\n .argument('<clip>', CLIP)\n .option('--noise <dB>', 'what counts as silence; lower hears quieter speech', '-35')\n .option('--gap <seconds>', 'the shortest silence between stretches of speech', '0.4')\n .option('--wav <dir>', 'also writes each clip here as 16 kHz WAV')\n .option('--json', 'as JSON')\n .action(async (ref: string, options) => (await import('./cli/voice.ts')).run(ref, options));\n\nprogram\n .command('transcribe')\n .description('what was said in voice clips, on this machine, with when')\n .argument('[clip]', CLIP)\n .option('--setup', 'installs it, outside the project: ask the person first')\n .option('--model <size>', 'tiny, base, small, large-v3-turbo, or a model ID', 'base')\n .option('--language <code>', 'the language spoken (en), rather than guessed')\n .option('--json', 'as JSON')\n .action(async (ref: string | undefined, options) => (await import('./cli/transcribe.ts')).run(ref, options));\n\nif (process.argv.length <= 2) {\n program.outputHelp();\n process.exit(0);\n}\nawait program.parseAsync();\n"],"mappings":"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"}
1
+ {"version":3,"file":"cli.js","names":[],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * The `deictic` command. `init` sets a project up and `clean` deletes what it kept, for the person; the rest are for\n * the agent that works the tasks, as the skill says: the board, a watch, a task, and what a task carries. Each is\n * declared here, its arguments and options with what they do, which is all `--help` needs; what it runs is in `cli/`,\n * imported only when it's run, so `deictic task` doesn't load the parser `init` edits configs with. Run in the\n * project, where its board and `.deictic/` are: `npx deictic <command>`.\n */\nimport { Argument, Command } from 'commander';\n\n/** A repeatable option's values, in order. */\nconst all = (value: string, previous: string[] | undefined) => [...(previous ?? []), value];\nconst RECORDING = 'a task (68), a replay URL, a recording ID or a JSON file';\nconst CLIP = 'a task, a replay URL, a recording ID, an audio file or a clip ID';\n\nconst program = new Command('deictic')\n .usage('<command> [options]')\n .enablePositionalOptions()\n .helpOption('-h, --help', 'says what a command takes')\n .showHelpAfterError('(add --help for what it takes)')\n .addHelpText('after', '\\nRun in the project. deictic help <command>, or <command> --help, says what it takes.');\n\nprogram.commandsGroup('Setting up and cleaning up:');\n// Here, not under a heading of its own, which a lone `help` would get.\nprogram.helpCommand('help [command]', 'says what a command takes');\n\nprogram\n .command('init')\n .description('sets deictic up in this project')\n .option('--dry-run', 'says what it would do, and does none of it')\n .option('--no-install', \"doesn't install: says the command instead\")\n .option('--skill', 'adds the agent skill without asking')\n .option('--no-skill', \"doesn't add the agent skill: says the command instead\")\n .action(async (options) => (await import('./cli/init.ts')).run(options));\n\nprogram\n .command('clean')\n .description('deletes what deictic kept, after saying what and how big and asking')\n .addArgument(\n new Argument('[parts...]', 'what to delete: shots, recordings and voice clips by default').choices([\n 'screenshots',\n 'recordings',\n 'voice',\n 'history',\n 'board',\n 'all',\n 'transcribe',\n ]),\n )\n .option('-y, --yes', \"deletes without asking: with no terminal to ask on, it doesn't delete without it\")\n .addHelpText(\n 'after',\n '\\nhistory (undo) and board (the local board, its tasks) only with the dev server stopped. all is everything in' +\n \"\\nthe project's .deictic/; transcribe is the transcription model, outside it, which every project shares.\",\n )\n .action(async (parts: string[], options) => (await import('./cli/clean.ts')).run(parts, options));\n\nprogram.commandsGroup('For the agent that works the tasks (the skill):');\n\nprogram\n .command('vb')\n .description('the board on the dev server: deictic vb whoami, deictic vb tasks claim 68 --lease 30m')\n .argument('[args...]', 'anything vb takes')\n // All of it is vb's, --help too.\n .helpOption(false)\n .allowUnknownOption()\n .passThroughOptions()\n .action(async (args: string[]) => (await import('./cli/vb.ts')).run(args));\n\nprogram\n .command('watch')\n .description('a line per new task, reply and cancellation')\n .argument('[channel]', 'the channel', 'deictic')\n .option('--idle <time>', 'ends once the channel has had nothing for this long: 30m, 45s, 1h', '20m')\n .option('--once', 'ends at the first thing to act on')\n .option('--label <key=value>', 'only tasks with this label (repeatable)', all)\n .action(async (channel: string, options) => (await import('./cli/watch.ts')).run(channel, options));\n\nprogram\n .command('task')\n .description('a task briefly: what was asked, by whom, who holds it, what is attached')\n .argument('<id>', 'the task: 68 or #68')\n .option('--out <dir>', 'downloads what is attached here')\n .action(async (id: string, options) => (await import('./cli/task.ts')).run(id, options));\n\nprogram\n .command('recording')\n .description(\n \"a recording as a timeline: what the person did and what went wrong, with a count of the page's other requests, console lines and React commits; or the part of it asked for\",\n )\n .argument('<recording>', RECORDING)\n .option('--nth <n>', \"a task's nth recording\", '1')\n .option(\n '--only <kinds>',\n 'these kinds of line: console, request, react, page, click, input, scroll, resize, marks, voice (repeatable)',\n all,\n )\n .option('--all', 'every line: every request, console line and React commit too')\n .option('--problems', 'errors, warnings, requests that failed and React commits slower than a frame')\n .option('--from <seconds>', 'from this far in')\n .option('--to <seconds>', 'to this far in')\n .option('--around <seconds>', 'every line of the 3 seconds either side of this')\n .option('--grep <text>', 'lines with this in them, in any case, of every line')\n .option('--full', \"all of each line: where it was logged from, a request's headers and bodies, a React commit's components\")\n .option('--json', 'as JSON')\n .action(async (ref: string, options) => (await import('./cli/recording.ts')).run(ref, options));\n\nprogram\n .command('frame')\n .description('PNGs of a recording, as the replay draws it, marks and all (needs the dev server)')\n .argument('<recording>', RECORDING)\n .option('--nth <n>', \"a task's nth recording\", '1')\n .option('--at <seconds>', 'a frame this far in (repeatable); by default after each change to the marks, and the end', all)\n .option('--every <seconds>', 'a frame this often')\n .option('--out <dir>', 'where the PNGs go, a temporary folder by default')\n .option('--base <url>', \"the dev server, where it's not the recorded page's origin\")\n .action(async (ref: string, options) => (await import('./cli/frame.ts')).run(ref, options));\n\nprogram\n .command('voice')\n .description(\"when speech happens in voice clips, in the recording's time\")\n .argument('<clip>', CLIP)\n .option('--noise <dB>', 'what counts as silence; lower hears quieter speech', '-35')\n .option('--gap <seconds>', 'the shortest silence between stretches of speech', '0.4')\n .option('--wav <dir>', 'also writes each clip here as 16 kHz WAV')\n .option('--json', 'as JSON')\n .action(async (ref: string, options) => (await import('./cli/voice.ts')).run(ref, options));\n\nprogram\n .command('transcribe')\n .description('what was said in voice clips, on this machine, with when')\n .argument('[clip]', CLIP)\n .option('--setup', 'installs it, outside the project: ask the person first')\n .option('--model <size>', 'tiny, base, small, large-v3-turbo, or a model ID', 'base')\n .option('--language <code>', 'the language spoken (en), rather than guessed')\n .option('--json', 'as JSON')\n .action(async (ref: string | undefined, options) => (await import('./cli/transcribe.ts')).run(ref, options));\n\nif (process.argv.length <= 2) {\n program.outputHelp();\n process.exit(0);\n}\nawait program.parseAsync();\n"],"mappings":"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"}
@@ -37,6 +37,18 @@ export declare function drawBars(canvas: HTMLCanvasElement, peaks: readonly numb
37
37
  export declare function liveWaveform(canvas: HTMLCanvasElement, stream: MediaStream, colors: Colors): () => void;
38
38
  /** An element's place in the source, as its mark has it, or nothing for one with none. */
39
39
  export declare function targetOf(el: Element): Target | undefined;
40
+ /**
41
+ * What the page hears on `window` as the popup opens over it on an element (its `detail` a `PopupOpened`) and as
42
+ * it closes: for a page that moves on its own to hold still meanwhile, as deictic's site does. Not for one pinned.
43
+ */
44
+ export declare const POPUP_OPENED = "deictic:open";
45
+ export declare const POPUP_CLOSED = "deictic:close";
46
+ interface PopupOpened {
47
+ /** The element it's open on. */
48
+ element: Element;
49
+ /** The plugin whose tab it opened at. */
50
+ tab: string;
51
+ }
40
52
  export interface StartOptions {
41
53
  /** The dev server's base URL, ending in `/`. */
42
54
  base: string;
@@ -51,18 +63,6 @@ export interface StartOptions {
51
63
  /** What answers the requests where there's no dev server to: a `standalone` build's. */
52
64
  server?: Standalone;
53
65
  }
54
- /**
55
- * What the page hears on `window` as the popup opens over it on an element (its `detail` a `PopupOpened`) and as
56
- * it closes: for a page that moves on its own to hold still meanwhile, as deictic's site does. Not for one pinned.
57
- */
58
- export declare const POPUP_OPENED = "deictic:open";
59
- export declare const POPUP_CLOSED = "deictic:close";
60
- export interface PopupOpened {
61
- /** The element it's open on. */
62
- element: Element;
63
- /** The plugin whose tab it opened at. */
64
- tab: string;
65
- }
66
66
  /**
67
67
  * Opens the popup over the page on `element`, as deictic's own shortcut does: at `tab` (a plugin's name), or at the
68
68
  * tab used last. For a page that opens it from a gesture of its own, as deictic's site does on a plain click.
@@ -92,5 +92,5 @@ export declare function lightboxIn(container: Element, items: LightboxItem[], {
92
92
  }): () => void;
93
93
  /** Starts the overlay, once per page: the client module runs again when a module importing it is replaced. */
94
94
  export declare function start({ base, shortcut: own, plugins: given, server }: StartOptions): void;
95
- export type { Colors };
95
+ export type { Colors, PopupOpened };
96
96
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/client/waveform.ts","../../src/client/dom.ts","../../src/client/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;wBAUsB,QAAQ,aAAa,eAAe;EAAU;EAAiB;;UAsBpE;;EAEf;;EAEA;;;wBAIc,SAAS,QAAQ,mBAAmB,0BAA0B,kBAAkB,QAAQ;;;;;wBAoBxF,aAAa,QAAQ,mBAAmB,QAAQ,aAAa,QAAQ;;wBCrDrE,SAAS,IAAI,UAAU;iBCgCtB;;EAEf;;EAEA,WAAW,SAAS;;EAEpB;IAAW,QAAQ;IAAc,WAAW,SAAS;IAAW;;;EAEhE,SAAS;;;;;;qBAyDE;qBACA;iBAEI;;EAEf,SAAS;;EAET;;;;;;;wBAQc,UAAU,SAAS,WAAW;EAAS;;;;;;;;;wBAYvC,QAAQ,WAAW,WAAW,KAAK,MAAM;EAAa;EAAc,SAAS;;;;;;;wBAiD7E,WAAW,WAAW,SAAS,OAAO,kBAAkB;EAAQ;;;wBAchE,QAAQ,MAAM,UAAU,KAAK,SAAS,OAAO,UAAU"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/client/waveform.ts","../../src/client/dom.ts","../../src/client/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;wBAUsB,QAAQ,aAAa,eAAe;EAAU;EAAiB;;UAsBpE;;EAEf;;EAEA;;;wBAIc,SAAS,QAAQ,mBAAmB,0BAA0B,kBAAkB,QAAQ;;;;;wBAoBxF,aAAa,QAAQ,mBAAmB,QAAQ,aAAa,QAAQ;;wBCrDrE,SAAS,IAAI,UAAU;;;;;qBAoE1B;qBACA;UAEI;;EAEf,SAAS;;EAET;;iBC3Ce;;EAEf;;EAEA,WAAW,SAAS;;EAEpB;IAAW,QAAQ;IAAc,WAAW,SAAS;IAAW;;;EAEhE,SAAS;;;;;;;wBA6DK,UAAU,SAAS,WAAW;EAAS;;;;;;;;;wBAYvC,QAAQ,WAAW,WAAW,KAAK,MAAM;EAAa;EAAc,SAAS;;;;;;;wBAiD7E,WAAW,WAAW,SAAS,OAAO,kBAAkB;EAAQ;;;wBAchE,QAAQ,MAAM,UAAU,KAAK,SAAS,OAAO,UAAU"}
@@ -1,6 +1,6 @@
1
1
  import { r as gestureOf } from "../shared/shortcut.js";
2
2
  import { a as tell, r as named } from "../shared/component.js";
3
- import { a as nameOf, c as sameAs, i as div, l as targetOf, o as place$1, r as controlFor, s as reduced, t as ATTRIBUTE } from "../shared/dom.js";
3
+ import { a as controlFor, c as place$1, d as targetOf, i as POPUP_OPENED, l as reduced, o as div, r as POPUP_CLOSED, s as nameOf, t as ATTRIBUTE, u as sameAs } from "../shared/dom.js";
4
4
  import { t as drawerIn } from "../shared/drawer.js";
5
5
  import { n as liveWaveform, r as peaksOf, t as drawBars } from "../shared/waveform.js";
6
6
  // src/client/away.ts
@@ -1426,12 +1426,6 @@ function icon(path, width = 2) {
1426
1426
  }
1427
1427
  let started;
1428
1428
  /**
1429
- * What the page hears on `window` as the popup opens over it on an element (its `detail` a `PopupOpened`) and as
1430
- * it closes: for a page that moves on its own to hold still meanwhile, as deictic's site does. Not for one pinned.
1431
- */
1432
- const POPUP_OPENED = "deictic:open";
1433
- const POPUP_CLOSED = "deictic:close";
1434
- /**
1435
1429
  * Opens the popup over the page on `element`, as deictic's own shortcut does: at `tab` (a plugin's name), or at the
1436
1430
  * tab used last. For a page that opens it from a gesture of its own, as deictic's site does on a plain click.
1437
1431
  * Answers whether it opened: not where no plugin has a tab, or `element` has no mark. The overlay must have started.
@@ -1559,6 +1553,14 @@ function start({ base, shortcut: own, plugins: given, server }) {
1559
1553
  ...problem,
1560
1554
  plugin: name
1561
1555
  }),
1556
+ edit: async ({ file, line, column }) => {
1557
+ const res = await send(`${base}__deictic/open?${new URLSearchParams({
1558
+ file,
1559
+ line: String(line),
1560
+ column: String(column)
1561
+ })}`);
1562
+ if (!res.ok) throw new Error(await res.text());
1563
+ },
1562
1564
  open: (plugin, element, at) => panel?.guard() !== true && openAt(plugin, element, at),
1563
1565
  lightbox: (items, options) => openLightbox(root, items, options),
1564
1566
  drawer,
@@ -1756,6 +1758,16 @@ function start({ base, shortcut: own, plugins: given, server }) {
1756
1758
  });
1757
1759
  let press = {};
1758
1760
  let opened;
1761
+ window.addEventListener("pointerdown", (e) => {
1762
+ if (e.composedPath().includes(host) || pressedBy(e) === void 0) return;
1763
+ const hit = hitAt(e.clientX, e.clientY);
1764
+ if (hit === void 0) return;
1765
+ for (const { plugin } of given) try {
1766
+ plugin.pressed?.(contextOf(plugin.name), hit.el);
1767
+ } catch (e) {
1768
+ report(failed(plugin.name, "keep what the page showed as it was pressed", e));
1769
+ }
1770
+ }, true);
1759
1771
  window.addEventListener("mousedown", (e) => {
1760
1772
  press = {};
1761
1773
  if (e.composedPath().includes(host)) return;