deictic 0.1.0 → 0.3.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 (166) hide show
  1. package/API.md +303 -0
  2. package/README.md +56 -104
  3. package/dist/annotations/index.d.ts +1 -1
  4. package/dist/astro.d.ts +1 -1
  5. package/dist/bun.d.ts +1 -1
  6. package/dist/bun.js +2 -2
  7. package/dist/client/index.d.ts +4 -2
  8. package/dist/client/index.d.ts.map +1 -1
  9. package/dist/client/index.js +130 -16
  10. package/dist/client/index.js.map +1 -1
  11. package/dist/index.d.ts +21 -218
  12. package/dist/index.js.map +1 -1
  13. package/dist/loader.js +1 -1
  14. package/dist/logs/client.d.ts +4 -0
  15. package/dist/logs/client.d.ts.map +1 -0
  16. package/dist/logs/client.js +16 -0
  17. package/dist/logs/client.js.map +1 -0
  18. package/dist/logs/index.d.ts +18 -0
  19. package/dist/logs/index.d.ts.map +1 -0
  20. package/dist/logs/index.js +21 -0
  21. package/dist/logs/index.js.map +1 -0
  22. package/dist/network/client.d.ts +4 -0
  23. package/dist/network/client.d.ts.map +1 -0
  24. package/dist/network/client.js +29 -0
  25. package/dist/network/client.js.map +1 -0
  26. package/dist/network/index.d.ts +2 -0
  27. package/dist/network/index.js +39 -0
  28. package/dist/network/index.js.map +1 -0
  29. package/dist/next.d.ts +1 -1
  30. package/dist/next.js +2 -2
  31. package/dist/recommended/index.d.ts +15 -5
  32. package/dist/recommended/index.d.ts.map +1 -1
  33. package/dist/recommended/index.js +10 -3
  34. package/dist/recommended/index.js.map +1 -1
  35. package/dist/recordings/client.d.ts +1 -1
  36. package/dist/recordings/client.d.ts.map +1 -1
  37. package/dist/recordings/client.js +177 -48
  38. package/dist/recordings/client.js.map +1 -1
  39. package/dist/recordings/index.d.ts +2 -2
  40. package/dist/recordings/index.js +3 -3
  41. package/dist/screenshots/client.d.ts +7 -1
  42. package/dist/screenshots/client.d.ts.map +1 -1
  43. package/dist/screenshots/client.js +36 -4
  44. package/dist/screenshots/client.js.map +1 -1
  45. package/dist/screenshots/dom.d.ts +1 -1
  46. package/dist/screenshots/dom.d.ts.map +1 -1
  47. package/dist/screenshots/dom.js +1 -28
  48. package/dist/screenshots/dom.js.map +1 -1
  49. package/dist/screenshots/index.d.ts +1 -1
  50. package/dist/screenshots/index.js +2 -2
  51. package/dist/screenshots/index.js.map +1 -1
  52. package/dist/screenshots/rrweb.d.ts +2 -2
  53. package/dist/screenshots/rrweb.js +5 -1
  54. package/dist/screenshots/rrweb.js.map +1 -1
  55. package/dist/{endpoints.js → shared/endpoints.js} +1 -1
  56. package/dist/shared/endpoints.js.map +1 -0
  57. package/dist/shared/index.d.ts +238 -0
  58. package/dist/shared/index.d.ts.map +1 -0
  59. package/dist/{index3.d.ts → shared/index2.d.ts} +3 -1
  60. package/dist/shared/index2.d.ts.map +1 -0
  61. package/dist/shared/index3.d.ts +112 -0
  62. package/dist/shared/index3.d.ts.map +1 -0
  63. package/dist/shared/index4.d.ts +64 -0
  64. package/dist/shared/index4.d.ts.map +1 -0
  65. package/dist/shared/index5.d.ts +220 -0
  66. package/dist/shared/index5.d.ts.map +1 -0
  67. package/dist/{index5.d.ts → shared/index6.d.ts} +2 -2
  68. package/dist/shared/index6.d.ts.map +1 -0
  69. package/dist/{integration.d.ts → shared/integration.d.ts} +4 -3
  70. package/dist/shared/integration.d.ts.map +1 -0
  71. package/dist/{integration.js → shared/integration.js} +5 -3
  72. package/dist/shared/integration.js.map +1 -0
  73. package/dist/{kept.js → shared/kept.js} +2 -2
  74. package/dist/shared/kept.js.map +1 -0
  75. package/dist/{marks.js → shared/marks.js} +6 -1
  76. package/dist/shared/marks.js.map +1 -0
  77. package/dist/shared/mask.js +107 -0
  78. package/dist/shared/mask.js.map +1 -0
  79. package/dist/{playwright.js → shared/playwright.js} +19 -4
  80. package/dist/shared/playwright.js.map +1 -0
  81. package/dist/shared/recordings.js +437 -0
  82. package/dist/shared/recordings.js.map +1 -0
  83. package/dist/shared/shortcut.js.map +1 -0
  84. package/dist/shared/tasks.js +632 -0
  85. package/dist/shared/tasks.js.map +1 -0
  86. package/dist/shared/waveform.js.map +1 -0
  87. package/dist/tailwind/client.d.ts +1 -1
  88. package/dist/tailwind/index.d.ts +1 -1
  89. package/dist/tasks/client.d.ts +1 -1
  90. package/dist/tasks/client.d.ts.map +1 -1
  91. package/dist/tasks/client.js +272 -57
  92. package/dist/tasks/client.js.map +1 -1
  93. package/dist/tasks/index.d.ts +2 -159
  94. package/dist/tasks/index.js +1 -348
  95. package/dist/vite.d.ts +11 -12
  96. package/dist/vite.d.ts.map +1 -1
  97. package/dist/vite.js +21 -4
  98. package/dist/vite.js.map +1 -1
  99. package/dist/voice/client.d.ts.map +1 -1
  100. package/dist/voice/client.js +36 -15
  101. package/dist/voice/client.js.map +1 -1
  102. package/dist/voice/index.d.ts +6 -1
  103. package/dist/voice/index.d.ts.map +1 -1
  104. package/dist/voice/index.js +13 -3
  105. package/dist/voice/index.js.map +1 -1
  106. package/dist/webpack.d.ts +1 -1
  107. package/dist/webpack.js +2 -2
  108. package/package.json +41 -2
  109. package/skills/deictic/SKILL.md +20 -14
  110. package/skills/deictic/references/install.md +32 -10
  111. package/skills/deictic/references/recordings.md +29 -0
  112. package/skills/deictic/references/tasks.md +49 -21
  113. package/skills/deictic/references/watch.md +38 -11
  114. package/skills/deictic/scripts/lib.mjs +88 -4
  115. package/skills/deictic/scripts/recording.mjs +84 -4
  116. package/skills/deictic/scripts/task.mjs +36 -7
  117. package/skills/deictic/scripts/vb.mjs +12 -0
  118. package/skills/deictic/scripts/watch.mjs +74 -10
  119. package/src/client/away.ts +105 -0
  120. package/src/client/index.ts +60 -16
  121. package/src/client/style.ts +1 -0
  122. package/src/index.ts +21 -2
  123. package/src/plugins/logs/client.ts +18 -0
  124. package/src/plugins/logs/index.ts +55 -0
  125. package/src/plugins/network/client.ts +30 -0
  126. package/src/plugins/network/index.ts +69 -0
  127. package/src/plugins/network/mask.ts +133 -0
  128. package/src/plugins/recommended/index.ts +14 -1
  129. package/src/plugins/recordings/client.ts +220 -40
  130. package/src/plugins/recordings/index.ts +111 -25
  131. package/src/plugins/recordings/marks.ts +6 -0
  132. package/src/plugins/recordings/replay.ts +159 -10
  133. package/src/plugins/screenshots/client.ts +38 -2
  134. package/src/plugins/screenshots/dom.ts +1 -32
  135. package/src/plugins/screenshots/index.ts +2 -0
  136. package/src/plugins/screenshots/playwright.ts +15 -4
  137. package/src/plugins/screenshots/rrweb.ts +2 -1
  138. package/src/plugins/tasks/client.ts +273 -41
  139. package/src/plugins/tasks/index.ts +207 -47
  140. package/src/plugins/tasks/local.ts +170 -0
  141. package/src/plugins/tasks/watchers.ts +36 -0
  142. package/src/plugins/voice/client.ts +33 -10
  143. package/src/plugins/voice/index.ts +21 -4
  144. package/src/tools/integration.ts +5 -3
  145. package/src/tools/kept.ts +2 -2
  146. package/src/vite.ts +23 -4
  147. package/dist/endpoints.js.map +0 -1
  148. package/dist/index.d.ts.map +0 -1
  149. package/dist/index2.d.ts +0 -23
  150. package/dist/index3.d.ts.map +0 -1
  151. package/dist/index4.d.ts +0 -74
  152. package/dist/index4.d.ts.map +0 -1
  153. package/dist/index5.d.ts.map +0 -1
  154. package/dist/integration.d.ts.map +0 -1
  155. package/dist/integration.js.map +0 -1
  156. package/dist/kept.js.map +0 -1
  157. package/dist/marks.js.map +0 -1
  158. package/dist/playwright.js.map +0 -1
  159. package/dist/recordings.js +0 -235
  160. package/dist/recordings.js.map +0 -1
  161. package/dist/shortcut.js.map +0 -1
  162. package/dist/tasks/index.d.ts.map +0 -1
  163. package/dist/tasks/index.js.map +0 -1
  164. package/dist/waveform.js.map +0 -1
  165. /package/dist/{shortcut.js → shared/shortcut.js} +0 -0
  166. /package/dist/{waveform.js → shared/waveform.js} +0 -0
package/API.md ADDED
@@ -0,0 +1,303 @@
1
+ # API
2
+
3
+ Setup for each bundler, the options, and how to write a plugin. The [README](README.md) has the short version. The
4
+ types are the full reference: every option is documented where it's declared.
5
+
6
+ - [Bundlers](#bundlers)
7
+ - [Options](#options)
8
+ - [Tasks](#tasks)
9
+ - [Screenshots, recordings and voice](#screenshots-recordings-and-voice)
10
+ - [Tailwind](#tailwind)
11
+ - [Standalone](#standalone)
12
+ - [Events](#events)
13
+ - [Writing a plugin](#writing-a-plugin)
14
+ - [How it works](#how-it-works)
15
+
16
+ ## Bundlers
17
+
18
+ Every integration takes the same options and runs in the dev server only.
19
+
20
+ ```ts
21
+ // Vite, and anything on it (React Router, TanStack Start…): vite.config.ts
22
+ import { deictic } from 'deictic/vite';
23
+ export default defineConfig({ plugins: [react(), deictic({ plugins: recommended() })] });
24
+
25
+ // Next.js (`next dev`, Turbopack or webpack): next.config.ts
26
+ import { withDeictic } from 'deictic/next';
27
+ export default withDeictic(nextConfig, { plugins: recommended() });
28
+
29
+ // webpack 5, Rspack: add `launch-editor` to open files in your editor
30
+ import { DeicticPlugin } from 'deictic/webpack';
31
+ export default { plugins: [new DeicticPlugin({ plugins: recommended() })] };
32
+
33
+ // Astro: astro.config.ts
34
+ import { deictic } from 'deictic/astro';
35
+ export default defineConfig({ integrations: [deictic({ plugins: recommended() })] });
36
+ ```
37
+
38
+ Astro marks `.astro` components with Astro 7 or later, and JSX islands with any version.
39
+
40
+ Bun (`Bun.serve` with HTML imports) takes one module for both the bundler plugin and the routes:
41
+
42
+ ```ts
43
+ // deictic.plugin.ts
44
+ import { deictic } from 'deictic/bun';
45
+ export default deictic({ plugins: recommended() });
46
+ ```
47
+
48
+ ```toml
49
+ # bunfig.toml
50
+ [serve.static]
51
+ plugins = ["./deictic.plugin.ts"]
52
+ ```
53
+
54
+ ```ts
55
+ // server.ts
56
+ import tools from './deictic.plugin.ts';
57
+ Bun.serve({ routes: { ...tools.routes, '/*': index } });
58
+ ```
59
+
60
+ React Native isn't supported: there's no DOM to point at.
61
+
62
+ ## Options
63
+
64
+ ```ts
65
+ deictic({
66
+ shortcut: { modifiers: ['Control', 'Shift'] }, // instead of Alt; `false` for none
67
+ plugins: recommended({
68
+ tasks: { channel: 'ui', project: 'storefront', labels: { team: 'web' } },
69
+ screenshots: { maskAllInputs: true },
70
+ voice: false,
71
+ }),
72
+ });
73
+ ```
74
+
75
+ | Option | What it is |
76
+ | ---------- | ---------------------------------------------------------------------------------------------- |
77
+ | `plugins` | The plugins to load. None by default. |
78
+ | `shortcut` | `{ modifiers, button }`: held to outline, pressed to open. Alt and the left button by default. |
79
+
80
+ `recommended()`, from `deictic/recommended`, is tasks, screenshots, annotations, recordings and voice, and logs and
81
+ network, which put the page's console and its requests in a recording. Each takes its
82
+ options under its name, and `false` leaves it out (`recommended({ logs: false, network: false })`). Other plugins, your own included, go beside it:
83
+ `plugins: [...recommended(), notes()]`. Each plugin is also its own import (`deictic/tasks`, `deictic/screenshots`…),
84
+ to pick them one by one.
85
+
86
+ What a project keeps (the history, shots, recordings, voice notes) is in `.deictic/`, which ignores itself in git.
87
+
88
+ ## Tasks
89
+
90
+ `tasks(options)`, from `deictic/tasks`. Needs `@vercel/board`.
91
+
92
+ | Option | Default | What it is |
93
+ | ---------- | ------------------------------- | ---------------------------------------------------------- |
94
+ | `board` | `BOARD_URL`, else a local board | The board tasks go to |
95
+ | `channel` | `deictic` | The channel on it |
96
+ | `project` | your `package.json`'s `name` | The `deictic.project` label, to share a board |
97
+ | `labels` | none | Your own labels on every task |
98
+ | `link` | the local board's pages | `(channel, task?) => url`, where the panel links a task to |
99
+ | `html` | `true` | Whether the Task tab offers to attach the element's HTML |
100
+ | `shortcut` | none | Opens the Task tab directly |
101
+
102
+ With nothing set, the dev server starts a board on your machine: `http://127.0.0.1:4100/`, kept in `.deictic/board`.
103
+ For another:
104
+
105
+ ```bash
106
+ BOARD_URL=https://team.example/api/board vite # any board, by its URL
107
+ ```
108
+
109
+ ```ts
110
+ import { board } from '@vercel/board';
111
+ import { local } from 'deictic/tasks';
112
+
113
+ recommended({ tasks: { board: board() } }); // your team's, after `vercel login`
114
+ recommended({ tasks: { board: local({ port: 4200 }) } }); // the one on your machine, whatever BOARD_URL says
115
+ ```
116
+
117
+ `local()` takes `port`, `dir` (its folder, from the root), `inspect: false` for none of the board's own pages, and
118
+ `args`, more of `vb serve`'s.
119
+
120
+ A task is the words typed and its attachments. The rest is labels: `deictic.project`, `deictic.at` (the element's
121
+ `file:line:column`), `deictic.file`, `deictic.url`, `deictic.viewport` and more, with your own beside them. After the
122
+ words comes what a label can't hold: the chain of source it rendered through, as
123
+ `src/ui/label.tsx:6 ← src/Field.tsx:20 ← src/Panel.tsx:880` (a shared component's line is the same wherever it's
124
+ used; the rest say where). The element's HTML as it rendered is attached as `element.html`,
125
+ masked as screenshots are, for whoever can't open the page as you had it: a file, so the task stays short.
126
+ Untick **Attach HTML snapshot** for a task without it; `html: false` takes the box away. A screenshot attached by the box has the element outlined in it; one you annotated is as you drew it.
127
+
128
+ The tab lists the element's tasks, then the rest of its file's, folded away: each with its tag and line, which opens
129
+ that element's tasks when it's on the page. A task stays with its element as lines above it change, while the opening
130
+ tag's first line is still the same and the file has it once.
131
+
132
+ In the Task tab:
133
+
134
+ - **Attach** adds a screenshot of the page, and **Annotate** opens it to draw boxes, arrows and notes on.
135
+ - **Attach HTML snapshot** adds the element as the page has it, as a file.
136
+ - **Record** records the page as you use it, drawing as you go, with the mic on if you like. A reload, or a link to
137
+ another page of your site, leaves it going: stop it there, and the Task tab comes back with it, about the element
138
+ you started on, whether that page has it or not.
139
+ - **Voice** records a note.
140
+ - The tasks already about the element are listed. An ID opens the task on the board, and a task no one has claimed
141
+ can be edited or deleted. Undo takes any of it back.
142
+ - Beside the channel it says who's watching it, `claude watching`, or `no agent watching`: whether a task you add
143
+ now is taken up. It knows of an agent watching with the skill from the project's folder, and of one holding a
144
+ claim on a task of the channel's; with a board that isn't this machine's own it says nothing where it knows of
145
+ none, as one may watch from elsewhere.
146
+
147
+ ### The agent skill
148
+
149
+ deictic ships a skill that watches the channel and works each task as it arrives, with scripts that read a task,
150
+ turn a recording into a timeline, screenshot it at any moment and transcribe its voice notes. Its watch ends once
151
+ the channel has been quiet for 20 minutes, and the agent then stops and says so, so none watches for ever:
152
+
153
+ ```bash
154
+ npx skills add gkurt/deictic
155
+ ```
156
+
157
+ ## Screenshots, recordings and voice
158
+
159
+ | Plugin | Needs | Options |
160
+ | --------------------- | -------------------------------------------------------------- | ------------------------------------------------- |
161
+ | `deictic/screenshots` | `rrweb-snapshot` and `playwright-core`, or `modern-screenshot` | `renderer`, `keep` (100), `dir`, masking |
162
+ | `deictic/annotations` | nothing | `color`, `shortcut` |
163
+ | `deictic/recordings` | `rrweb`, `rrweb-player` | `keep` (20), `dir`, `canvas`, masking |
164
+ | `deictic/voice` | nothing | `keep` (50), `dir` |
165
+ | `deictic/logs` | `@rrweb/rrweb-plugin-console-record` | `levels` |
166
+ | `deictic/network` | `@rrweb/rrweb-plugin-network-record` | `headers`, `body`, `mask`, `ignore`, `initiators` |
167
+
168
+ Screenshots have two renderers:
169
+
170
+ ```ts
171
+ import { dom, rrweb } from 'deictic/screenshots';
172
+
173
+ screenshots({ renderer: rrweb({ channel: 'chrome' }) }); // default: a snapshot, rendered in a headless browser
174
+ screenshots({ renderer: dom() }); // drawn in the page with modern-screenshot: no browser needed, less exact
175
+ ```
176
+
177
+ `rrweb()` uses Playwright's Chromium (`npx playwright install chromium`), else Chrome or Edge; `channel` or
178
+ `executablePath` names one.
179
+
180
+ Masking follows [rrweb](https://github.com/rrweb-io/rrweb)'s names and defaults: `rr-block` blanks an element
181
+ (`blockClass`, `blockSelector`), `rr-mask` masks its text (`maskTextClass`, `maskTextSelector`), and `maskAllInputs`
182
+ masks every field. Passwords always are. Nothing of deictic's own UI is in a shot or a recording.
183
+
184
+ A recording has what a `<canvas>` drew, as a picture of each canvas that changed, twice a second:
185
+ `recordings: { canvas: { fps: 4 } }` for more, `canvas: false` for none (it then replays blank).
186
+
187
+ With logs and network, a recording has more than the page, each at its moment. The replay lists them beside the
188
+ page: the row it's at is lit, a click on one goes to its moment and shows the rest of it, and each error and failed
189
+ request is a mark on the timeline. Both are rrweb's own plugins, which
190
+ listen only while a recording is going, and each is left out with `false`.
191
+
192
+ - **`logs`** keeps what the page logged and the errors nothing caught. `levels: ['warn', 'error']` keeps less. rrweb
193
+ wraps the console as a recording starts and puts it back as it stops, so the rest of the time the browser's tools
194
+ name your own code as each line's source. Nothing masks what your code logs.
195
+ - **`network`** keeps the page's `fetch` and XHR requests: the URL, the status and the timing, as the browser reports
196
+ them of itself, with nothing wrapped. `headers: true` and `body: true` add those and the method, for which rrweb
197
+ wraps `fetch` and `XMLHttpRequest` while a recording is going. `initiators` adds what the page loads (`'img'`,
198
+ `'script'`).
199
+
200
+ Requests are masked before they're kept. A value is blanked to `***` where its name says it's a secret (`token`,
201
+ `secret`, `password`, `auth`, `cookie`, `session`, `key`, `code` and the like), in a URL's query or fragment, a header,
202
+ and a body's fields where the body is JSON or a form; `mask: ['email']` adds names. A password before a URL's host is
203
+ dropped, a body is cut at 10,000 characters, and `ignore: ['/analytics']` leaves requests out whole. A secret under a
204
+ name that says nothing isn't found, which is why headers and bodies are kept only when asked for.
205
+
206
+ ## Tailwind
207
+
208
+ Not in `recommended()`. `tailwind()`, from `deictic/tailwind`, adds a tab that edits the element's classes in place,
209
+ with completion, previews and undo, and writes them to the source. It needs Tailwind v4.
210
+
211
+ ```ts
212
+ import { tailwind } from 'deictic/tailwind';
213
+
214
+ deictic({ plugins: [...recommended(), tailwind({ css: 'src/index.css' })] });
215
+ ```
216
+
217
+ | Option | Default | What it is |
218
+ | ----------- | ------------------------------------------- | --------------------------------------------- |
219
+ | `css` | Tailwind's default theme | The stylesheet with your theme, from the root |
220
+ | `helpers` | `cn`, `clsx`, `cx`, `twMerge`, `classNames` | Calls whose first argument is a class list |
221
+ | `attribute` | `className` | `class` for Solid and Preact |
222
+ | `shortcut` | none | Opens the tab directly |
223
+
224
+ ## Standalone
225
+
226
+ A build has nothing of deictic. To show it on a deployed page with no dev server (a demo), `deictic/vite` takes
227
+ `standalone`: a module of the page's whose default export answers the overlay's requests there.
228
+
229
+ ```ts
230
+ // vite.config.ts
231
+ deictic({ plugins, standalone: 'src/standalone.ts' });
232
+
233
+ // src/standalone.ts: a request the dev server would get under `/__deictic/`, and its answer
234
+ import type { Standalone } from 'deictic';
235
+ export default (async (request) => Response.json({ model: null })) satisfies Standalone;
236
+ ```
237
+
238
+ What a plugin's routes would keep, the module keeps, and answers with the `url` it's at: screenshots' `add`; voice's
239
+ `add` and then `more/<id>`, a take as it's spoken (the `url` with `?last`); recordings' `begin`, `part/<id>?seq=<n>`
240
+ and `end/<id>` (the `url`) or `discard/<id>`. A recording's is a replay page for the build to publish:
241
+ `replayPage({ player, source })`, from `deictic/recordings`, is its HTML.
242
+
243
+ ## Events
244
+
245
+ The page hears these on `window`:
246
+
247
+ | Event | When | `detail` |
248
+ | --------------- | ----------------------------- | ------------------------------------------------------ |
249
+ | `deictic:open` | the popup opens over the page | the element and the tab |
250
+ | `deictic:close` | it closes | none |
251
+ | `deictic:task` | a task is added | its ID, title, state, channel, element and attachments |
252
+
253
+ `openPopup(element, { tab })`, from `deictic/client`, opens the popup from a gesture of your own.
254
+
255
+ ## Writing a plugin
256
+
257
+ A plugin has a server half, which runs beside the bundler, and a page half, which can draw a tab in the popup. Every
258
+ part is optional but its `name`.
259
+
260
+ ```ts
261
+ // my-plugin/index.ts
262
+ import { definePlugin } from 'deictic';
263
+
264
+ export const notes = () =>
265
+ definePlugin<Model, Op>({
266
+ name: 'notes',
267
+ client: 'my-plugin/client', // the page half, which the page imports
268
+ read: ({ element }) => ({ … }), // what the tab shows for the element
269
+ apply: (source, target, op) => [{ start, end, text }], // edits to the file, written by deictic, undoable
270
+ });
271
+
272
+ // my-plugin/client.ts
273
+ import { defineClientPlugin } from 'deictic';
274
+
275
+ export default defineClientPlugin<Model, Op>({
276
+ name: 'notes',
277
+ label: 'Notes',
278
+ mount(panel, { model, element, apply }) {
279
+ // draw into `panel`; `apply(op)` writes, and answers the model read again
280
+ },
281
+ });
282
+ ```
283
+
284
+ - `routes` adds routes to the dev server, which the page half reaches with `request(route)`.
285
+ - `setup` answers an API for other plugins, which reach it with `context.use(name)`. That's how tasks attaches
286
+ screenshots and recordings.
287
+ - A change that isn't to a file answers `{ done: record }`, and the plugin's `undo` and `redo` get the record back.
288
+ - Throw a `Refusal` for an op the plugin won't make. The panel shows its message.
289
+ - A panel leaves the popup for something on the page with `away(state, task)`, and is mounted again with `resumed`.
290
+ Where the task outlasts a page load, as a recording does, the page half's `resume` answers it on the next page, and
291
+ the popup comes back there: on the element, or without it (`element.isConnected` is false) where that page has none.
292
+
293
+ The types in `deictic`'s index document each part.
294
+
295
+ ## How it works
296
+
297
+ - A transform that runs before the framework's own adds `data-deictic="src/App.tsx:12:5"` to every host element
298
+ (`div`, `button`) in `.jsx`, `.tsx` and `.js` modules and in `.astro` components. So it works for any framework
299
+ that compiles JSX, server components too, and points at the element's own tag, not the component around it.
300
+ - Its endpoints are on the dev server's own origin, `/__deictic/*`, and take writes only as same-origin JSON, so no
301
+ other site can make them and no token reaches the page.
302
+ - Every change goes into one history in `.deictic/history.json`. The popup's undo and redo walk the part of it that
303
+ is the open tab's on the element it's open on. A plugin's own change, a task, is undone by the plugin.
package/README.md CHANGED
@@ -1,25 +1,56 @@
1
- # deictic
1
+ <p align="center">
2
+ <a href="https://gkurt.com/deictic/">
3
+ <img src="https://raw.githubusercontent.com/gkurt/deictic/main/site/public/icon.svg" width="88" height="88" alt="deictic">
4
+ </a>
5
+ </p>
2
6
 
3
- Point at an element in your running app and leave a task about it, for you, a teammate or an agent to work.
7
+ <h1 align="center">deictic</h1>
8
+
9
+ <p align="center">Point at an element in your running app and leave a task about it for your agent.</p>
10
+
11
+ <p align="center">
12
+ <a href="https://www.npmjs.com/package/deictic"><img src="https://img.shields.io/npm/v/deictic?color=12b358" alt="npm version"></a>
13
+ <a href="https://www.npmjs.com/package/deictic"><img src="https://img.shields.io/npm/dm/deictic?color=12b358" alt="npm downloads"></a>
14
+ <a href="https://github.com/gkurt/deictic/actions/workflows/ci.yml"><img src="https://github.com/gkurt/deictic/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
15
+ <a href="LICENSE"><img src="https://img.shields.io/npm/l/deictic?color=12b358" alt="MIT license"></a>
16
+ </p>
17
+
18
+ <p align="center">
19
+ <a href="https://gkurt.com/deictic/">Website</a> ·
20
+ <a href="https://gkurt.com/deictic/example/">Playground</a> ·
21
+ <a href="API.md">API</a> ·
22
+ <a href="CHANGELOG.md">Changelog</a>
23
+ </p>
24
+
25
+ ## What
4
26
 
5
27
  Hold **Alt** and point: the element is outlined with its tag and the file and line that rendered it. **Alt-click**,
6
- say what should change, and attach a screenshot to draw on, a screen recording or a voice note. The task goes to a
7
- [Vercel Board](https://vercel.com/docs/board) with everything an agent needs to find the code: the element's
8
- `file:line:column`, the page and the viewport.
28
+ say what should change, and attach a screenshot to draw on, a screen recording or a voice note.
29
+
30
+ The task goes to a [Vercel Board](https://vercel.com/docs/board), for you, a teammate or an agent to work.
31
+
32
+ ## Why
9
33
 
10
- It runs in your dev server only. A production build has none of it.
34
+ - **No describing where.** "The second button in the header on the pricing page" becomes `src/Header.tsx:12:5`.
35
+ Every task carries the element's place in the source, the page and the viewport.
36
+ - **Show, don't type.** Draw on a screenshot, record the bug as it happens, or just say it.
37
+ - **Agents pick it up.** A bundled skill watches the board and works each task as it arrives.
38
+ - **Nothing in production.** It runs in your dev server only. A build has none of it.
39
+ - **Any JSX.** Vite, Next.js, webpack, Rspack, Astro and Bun, server components too.
11
40
 
12
- ## Install
41
+ ## How
42
+
43
+ Install it with what its plugins use:
13
44
 
14
45
  ```bash
15
- npm install -D deictic @vercel/board rrweb rrweb-player rrweb-snapshot playwright-core
46
+ npm install -D deictic @vercel/board rrweb rrweb-player rrweb-snapshot playwright-core \
47
+ @rrweb/rrweb-plugin-console-record @rrweb/rrweb-plugin-network-record
16
48
  ```
17
49
 
18
- Then add it to your bundler. `recommended()` is the plugins for tasks: tasks, screenshots, annotations, recordings
19
- and voice.
50
+ Add it to your bundler:
20
51
 
21
52
  ```ts
22
- // vite.config.ts (and anything on Vite: React Router, TanStack Start…)
53
+ // vite.config.ts
23
54
  import { recommended } from 'deictic/recommended';
24
55
  import { deictic } from 'deictic/vite';
25
56
 
@@ -28,117 +59,38 @@ export default defineConfig({
28
59
  });
29
60
  ```
30
61
 
31
- | Bundler | Setup |
32
- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
33
- | Next.js (`next dev`) | `export default withDeictic(nextConfig, { plugins: recommended() })`, from `deictic/next` |
34
- | webpack 5, Rspack | `plugins: [new DeicticPlugin({ plugins: recommended() })]`, from `deictic/webpack` (`launch-editor` to open files) |
35
- | Astro | `integrations: [deictic({ plugins: recommended() })]`, from `deictic/astro` (`.astro` components with Astro 7; JSX islands with any) |
36
- | Bun (`Bun.serve`, HTML imports) | `deictic({ plugins: recommended() })` from `deictic/bun`, named in `bunfig.toml`'s `[serve.static] plugins`, its `routes` spread into `Bun.serve`'s |
37
-
38
- Screenshots render in a Chromium: Playwright's (`npx playwright install chromium`), else Chrome or Edge. React
39
- Native isn't supported: there's no DOM to point at.
40
-
41
- ## Tasks
62
+ Next.js, webpack, Rspack, Astro and Bun are [in the API](API.md#bundlers).
42
63
 
43
- Tasks go to a board on your machine or your team's:
44
-
45
- ```bash
46
- npx vb serve # a board on this machine, kept in .board/
47
- BOARD_URL=http://127.0.0.1:4100/api/board vite # or no BOARD_URL for your team's board, after `vercel login`
48
- ```
64
+ Start your dev server and Alt-click something. Tasks go to a board the dev server starts on your machine, with
65
+ nothing to set up: `http://127.0.0.1:4100/`.
49
66
 
50
- Whoever works the channel (`deictic` by default) takes it from there. For an agent, deictic comes with a skill that
51
- watches the channel and works each task as it arrives, with scripts that read a task, turn a recording into a
52
- timeline, screenshot it at any moment, and transcribe its voice notes:
67
+ To have your agent work them, add the skill and mention `/deictic`:
53
68
 
54
69
  ```bash
55
- npx skills add ./node_modules/deictic
70
+ npx skills add gkurt/deictic
56
71
  ```
57
72
 
58
- In the Task tab, **Attach** adds a screenshot of the page, **Annotate** opens it to draw boxes, arrows and notes on,
59
- **Record** records the page as you use it (drawing as you go, with the mic on if you like), and **Voice** records a
60
- note. Each is a chip that opens in a lightbox. The panel lists the tasks already about the element: each one's ID opens it
61
- on the board, and one no one has claimed yet can be edited or deleted there (deleting cancels it on the board). Undo
62
- takes any of it back. The page hears of each task added as a `deictic:task` event on `window`, its `detail` the task's ID,
63
- title, element and what was attached.
73
+ ### Options
64
74
 
65
- ## Options
66
-
67
- Each plugin takes its options under its name, and `false` leaves one out. Other plugins, your own included, go
68
- beside the preset:
75
+ Each plugin takes its options under its name, and `false` leaves one out:
69
76
 
70
77
  ```ts
71
78
  deictic({
72
- shortcut: { modifiers: ['Control', 'Shift'] }, // instead of Alt; `false` for none
79
+ shortcut: { modifiers: ['Control', 'Shift'] }, // instead of Alt
73
80
  plugins: recommended({
74
- tasks: { channel: 'ui', project: 'storefront', labels: { team: 'web' } },
81
+ tasks: { channel: 'ui', labels: { team: 'web' } },
75
82
  screenshots: { maskAllInputs: true },
76
83
  voice: false,
77
84
  }),
78
85
  });
79
86
  ```
80
87
 
81
- A task is the words typed and its attachments (with none typed, a line naming what's attached); the rest is labels: `deictic.project` (the `project` option, or by
82
- default your `package.json`'s name, to tell projects apart on one board), `deictic.at`, `deictic.url`,
83
- `deictic.viewport` and more, and your own `labels` beside them.
84
-
85
- Screenshots and recordings hide what [rrweb](https://github.com/rrweb-io/rrweb) would, by its names: `rr-block`
86
- blanks an element, `rr-mask` masks its text, `maskAllInputs` masks every field (passwords always are). Nothing of
87
- deictic's own UI is in them. What a project keeps (the history, shots, recordings, voice notes) is in `.deictic/`,
88
- which ignores itself in git.
89
-
90
- ## How it works
91
-
92
- - A transform that runs before the framework's own adds `data-deictic="src/App.tsx:12:5"` to every host element
93
- (`div`, `button`) in `.jsx`, `.tsx` and `.js` modules and in `.astro` components, so it works for any framework
94
- that compiles JSX, server components too, and points at the element's own tag rather than the component around it.
95
- - Its endpoints are on the dev server's own origin, `/__deictic/*`, and take writes only as same-origin JSON, so no
96
- other site can make them and no token reaches the page.
97
- - Every change goes into one history in `.deictic/history.json`. The popup's undo and redo walk the part of it that
98
- is the open tab's on the element it's open on. A plugin's own change, a task, is undone by the plugin.
99
-
100
- ## Writing a plugin
101
-
102
- A plugin has a server half, which runs beside the bundler, and a page half, which can draw a tab in the popup.
103
- Every part is optional but its `name`.
88
+ [API.md](API.md) has the rest: your team's board, masking, every plugin's options, and writing a plugin of your own.
104
89
 
105
- ```ts
106
- // my-plugin/index.ts
107
- import { definePlugin } from 'deictic';
108
-
109
- export const notes = () =>
110
- definePlugin<Model, Op>({
111
- name: 'notes',
112
- client: 'my-plugin/client', // the page half, which the page imports
113
- read: ({ element }) => ({ … }), // what the tab shows for the element
114
- apply: (source, target, op) => [{ start, end, text }], // edits to the file, written by deictic, undoable
115
- });
116
-
117
- // my-plugin/client.ts
118
- import { defineClientPlugin } from 'deictic';
119
-
120
- export default defineClientPlugin<Model, Op>({
121
- name: 'notes',
122
- label: 'Notes',
123
- mount(panel, { model, element, apply }) {
124
- // draw into `panel`; `apply(op)` writes, and answers the model read again
125
- },
126
- });
127
- ```
90
+ ## Contributing
128
91
 
129
- Plugins add routes to the dev server (`routes`), set up an API for others (`setup`), and reach each other's with
130
- `context.use(name)`: that's how tasks attaches screenshots and recordings. A change that isn't to a file answers
131
- `{ done: record }`, and the plugin's `undo` and `redo` get the record back. The types in `deictic`'s index document
132
- each part.
92
+ See [CONTRIBUTING.md](CONTRIBUTING.md).
133
93
 
134
- ## Develop
135
-
136
- ```bash
137
- bun install
138
- bun dev # build, then the site on http://localhost:5180, with a board on this machine for its tasks
139
- bun run test # bun test, on the source
140
- bun run checks # lint + format check + type check + test
141
- ```
94
+ ## License
142
95
 
143
- `examples/` has the same page on Vite, Next, Rspack and Bun (`bun run dev` in each, after a build). `/internal/` on
144
- the site pins deictic's own popup open at each tab, to leave tasks about deictic itself.
96
+ [MIT](LICENSE)
@@ -7,7 +7,7 @@
7
7
  * over the page (`svg(area)`), tasks repeat their notes, and a recording can keep each change as it
8
8
  * happens (`subscribe`). Nothing of it runs on the server.
9
9
  */
10
- import { C as Shortcut } from "../index.js";
10
+ import { w as Shortcut } from "../shared/index.js";
11
11
  /** A point in page coordinates: CSS pixels from the document's top left, so it stays put as the page scrolls. */
12
12
  export interface Point {
13
13
  x: number;
package/dist/astro.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  * server and in islands, and with Astro 7, whose parser says where their tags are, `.astro` components
8
8
  * too (`tools/astro.ts`).
9
9
  */
10
- import { t as DeicticOptions } from "./integration.js";
10
+ import { t as DeicticOptions } from "./shared/integration.js";
11
11
  import "./vite.js";
12
12
  /** What the integration reads of Astro's setup hook: Astro's own types, as far as they're used here. */
13
13
  interface Setup {
package/dist/bun.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BunPlugin } from "bun";
2
- import { t as DeicticOptions } from "./integration.js";
2
+ import { t as DeicticOptions } from "./shared/integration.js";
3
3
  export interface DeicticBunOptions extends DeicticOptions {
4
4
  /** The project's root, which marks and edits are from: the working directory by default. */
5
5
  root?: string;
package/dist/bun.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { resolve } from "node:path";
2
- import { t as endpoints } from "./endpoints.js";
3
- import { d as JSX, i as mark, o as prepare, r as importOf, s as writeClient } from "./integration.js";
2
+ import { t as endpoints } from "./shared/endpoints.js";
3
+ import { d as JSX, i as mark, o as prepare, r as importOf, s as writeClient } 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
@@ -8,7 +8,7 @@
8
8
  * Everything drawn sits in one shadow root, so neither the page's styles nor ours cross over. A
9
9
  * panel's undo and redo are its tab's on its element: the latest change that plugin made there.
10
10
  */
11
- import { C as Shortcut, i as ClientPlugin, s as LightboxItem, v as Target } from "../index.js";
11
+ import { i as ClientPlugin, s as LightboxItem, v as Standalone, w as Shortcut, y as Target } from "../shared/index.js";
12
12
  /**
13
13
  * Waveforms: a clip's, read off its audio, drawn as bars with what's played in the accent; and a mic's live,
14
14
  * a meter scrolling left as it hears. For the lightbox's player and whatever records the mic (the task
@@ -46,6 +46,8 @@ export interface StartOptions {
46
46
  shortcut?: Required<Shortcut>;
47
47
  options?: unknown;
48
48
  }[];
49
+ /** What answers the requests where there's no dev server to: a `standalone` build's. */
50
+ server?: Standalone;
49
51
  }
50
52
  export declare function targetOf(el: Element): Target | undefined;
51
53
  /**
@@ -88,6 +90,6 @@ export declare function lightboxIn(container: Element, items: LightboxItem[], {
88
90
  at?: number;
89
91
  }): () => void;
90
92
  /** Starts the overlay, once per page: the client module runs again when a module importing it is replaced. */
91
- export declare function start({ base, shortcut: own, plugins: given }: StartOptions): void;
93
+ export declare function start({ base, shortcut: own, plugins: given, server }: StartOptions): void;
92
94
  export type { Colors };
93
95
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/client/waveform.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;iBCxCpE;;EAEf;;EAEA,WAAW,SAAS;;EAEpB;IAAW,QAAQ;IAAc,WAAW,SAAS;IAAW;;;wBAwBlD,SAAS,IAAI,UAAU;;;;;qBA0C1B;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,SAAS"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/client/waveform.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;iBCvCpE;;EAEf;;EAEA,WAAW,SAAS;;EAEpB;IAAW,QAAQ;IAAc,WAAW,SAAS;IAAW;;;EAEhE,SAAS;;wBA2BK,SAAS,IAAI,UAAU;;;;;qBA2C1B;qBACA;iBAEI;;EAEf,SAAS;;EAET;;;;;;;wBAQc,UAAU,SAAS,WAAW;EAAS;;;;;;;;;wBAYvC,QAAQ,WAAW,WAAW,KAAK,MAAM;EAAa;EAAc,SAAS;;;;;;;wBAkD7E,WAAW,WAAW,SAAS,OAAO,kBAAkB;EAAQ;;;wBAchE,QAAQ,MAAM,UAAU,KAAK,SAAS,OAAO,UAAU"}