deictic 0.2.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.
- package/API.md +303 -0
- package/README.md +56 -127
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +117 -7
- package/dist/client/index.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/logs/client.d.ts +4 -0
- package/dist/logs/client.d.ts.map +1 -0
- package/dist/logs/client.js +16 -0
- package/dist/logs/client.js.map +1 -0
- package/dist/logs/index.d.ts +18 -0
- package/dist/logs/index.d.ts.map +1 -0
- package/dist/logs/index.js +21 -0
- package/dist/logs/index.js.map +1 -0
- package/dist/network/client.d.ts +4 -0
- package/dist/network/client.d.ts.map +1 -0
- package/dist/network/client.js +29 -0
- package/dist/network/client.js.map +1 -0
- package/dist/network/index.d.ts +2 -0
- package/dist/network/index.js +39 -0
- package/dist/network/index.js.map +1 -0
- package/dist/recommended/index.d.ts +13 -3
- package/dist/recommended/index.d.ts.map +1 -1
- package/dist/recommended/index.js +8 -1
- package/dist/recommended/index.js.map +1 -1
- package/dist/recordings/client.d.ts +1 -1
- package/dist/recordings/client.d.ts.map +1 -1
- package/dist/recordings/client.js +175 -46
- package/dist/recordings/client.js.map +1 -1
- package/dist/recordings/index.d.ts +2 -2
- package/dist/screenshots/client.d.ts +6 -0
- package/dist/screenshots/client.d.ts.map +1 -1
- package/dist/screenshots/client.js +34 -2
- package/dist/screenshots/client.js.map +1 -1
- package/dist/screenshots/dom.d.ts.map +1 -1
- package/dist/screenshots/dom.js +1 -28
- package/dist/screenshots/dom.js.map +1 -1
- package/dist/screenshots/index.js.map +1 -1
- package/dist/screenshots/rrweb.d.ts +1 -1
- package/dist/screenshots/rrweb.js +5 -1
- package/dist/screenshots/rrweb.js.map +1 -1
- package/dist/shared/index.d.ts +14 -2
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index2.d.ts +2 -0
- package/dist/shared/index2.d.ts.map +1 -1
- package/dist/shared/index3.d.ts +29 -3
- package/dist/shared/index3.d.ts.map +1 -1
- package/dist/shared/index4.d.ts +52 -172
- package/dist/shared/index4.d.ts.map +1 -1
- package/dist/shared/index5.d.ts +208 -58
- package/dist/shared/index5.d.ts.map +1 -1
- package/dist/shared/index6.d.ts +70 -0
- package/dist/shared/index6.d.ts.map +1 -0
- package/dist/shared/marks.js +6 -1
- package/dist/shared/marks.js.map +1 -1
- package/dist/shared/mask.js +107 -0
- package/dist/shared/mask.js.map +1 -0
- package/dist/shared/playwright.js +19 -4
- package/dist/shared/playwright.js.map +1 -1
- package/dist/shared/recordings.js +219 -28
- package/dist/shared/recordings.js.map +1 -1
- package/dist/shared/tasks.js +145 -34
- package/dist/shared/tasks.js.map +1 -1
- package/dist/tailwind/client.d.ts +1 -1
- package/dist/tailwind/index.d.ts +1 -1
- package/dist/tasks/client.d.ts +1 -1
- package/dist/tasks/client.d.ts.map +1 -1
- package/dist/tasks/client.js +271 -56
- package/dist/tasks/client.js.map +1 -1
- package/dist/tasks/index.d.ts +2 -2
- package/dist/voice/client.d.ts.map +1 -1
- package/dist/voice/client.js +35 -14
- package/dist/voice/client.js.map +1 -1
- package/dist/voice/index.d.ts +6 -1
- package/dist/voice/index.d.ts.map +1 -1
- package/dist/voice/index.js +12 -2
- package/dist/voice/index.js.map +1 -1
- package/package.json +41 -2
- package/skills/deictic/SKILL.md +20 -14
- package/skills/deictic/references/install.md +18 -11
- package/skills/deictic/references/recordings.md +29 -0
- package/skills/deictic/references/tasks.md +49 -21
- package/skills/deictic/references/watch.md +38 -11
- package/skills/deictic/scripts/lib.mjs +69 -3
- package/skills/deictic/scripts/recording.mjs +84 -4
- package/skills/deictic/scripts/task.mjs +36 -7
- package/skills/deictic/scripts/vb.mjs +12 -0
- package/skills/deictic/scripts/watch.mjs +74 -10
- package/src/client/away.ts +105 -0
- package/src/client/index.ts +40 -9
- package/src/client/style.ts +1 -0
- package/src/index.ts +14 -2
- package/src/plugins/logs/client.ts +18 -0
- package/src/plugins/logs/index.ts +55 -0
- package/src/plugins/network/client.ts +30 -0
- package/src/plugins/network/index.ts +69 -0
- package/src/plugins/network/mask.ts +133 -0
- package/src/plugins/recommended/index.ts +14 -1
- package/src/plugins/recordings/client.ts +219 -40
- package/src/plugins/recordings/index.ts +108 -23
- package/src/plugins/recordings/marks.ts +6 -0
- package/src/plugins/recordings/replay.ts +127 -4
- package/src/plugins/screenshots/client.ts +35 -0
- package/src/plugins/screenshots/dom.ts +1 -32
- package/src/plugins/screenshots/index.ts +2 -0
- package/src/plugins/screenshots/playwright.ts +15 -4
- package/src/plugins/screenshots/rrweb.ts +2 -1
- package/src/plugins/tasks/client.ts +273 -41
- package/src/plugins/tasks/index.ts +155 -39
- package/src/plugins/tasks/watchers.ts +36 -0
- package/src/plugins/voice/client.ts +33 -11
- package/src/plugins/voice/index.ts +21 -4
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
|
-
|
|
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
|
-
|
|
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.
|
|
7
|
-
|
|
8
|
-
|
|
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.
|
|
9
31
|
|
|
10
|
-
|
|
32
|
+
## Why
|
|
11
33
|
|
|
12
|
-
|
|
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.
|
|
40
|
+
|
|
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
|
-
|
|
19
|
-
and voice.
|
|
50
|
+
Add it to your bundler:
|
|
20
51
|
|
|
21
52
|
```ts
|
|
22
|
-
// vite.config.ts
|
|
53
|
+
// vite.config.ts
|
|
23
54
|
import { recommended } from 'deictic/recommended';
|
|
24
55
|
import { deictic } from 'deictic/vite';
|
|
25
56
|
|
|
@@ -28,140 +59,38 @@ export default defineConfig({
|
|
|
28
59
|
});
|
|
29
60
|
```
|
|
30
61
|
|
|
31
|
-
|
|
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
|
|
42
|
-
|
|
43
|
-
Tasks go to a board the dev server starts on your machine, with nothing to set up: `http://127.0.0.1:4100/`, kept
|
|
44
|
-
in `.deictic/board`. For a board of your own, name it, or pass your team's:
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
BOARD_URL=https://team.example/api/board vite # any board, by its URL
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
```ts
|
|
51
|
-
recommended({ tasks: { board: board() } }); // your team's, from `@vercel/board`, after `vercel login`
|
|
52
|
-
recommended({ tasks: { board: local({ port: 4200 }) } }); // the one on your machine, from `deictic/tasks`
|
|
53
|
-
```
|
|
62
|
+
Next.js, webpack, Rspack, Astro and Bun are [in the API](API.md#bundlers).
|
|
54
63
|
|
|
55
|
-
|
|
56
|
-
|
|
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/`.
|
|
57
66
|
|
|
58
|
-
|
|
59
|
-
watches the channel and works each task as it arrives, with scripts that read a task, turn a recording into a
|
|
60
|
-
timeline, screenshot it at any moment, and transcribe its voice notes:
|
|
67
|
+
To have your agent work them, add the skill and mention `/deictic`:
|
|
61
68
|
|
|
62
69
|
```bash
|
|
63
|
-
npx skills add
|
|
70
|
+
npx skills add gkurt/deictic
|
|
64
71
|
```
|
|
65
72
|
|
|
66
|
-
|
|
67
|
-
**Record** records the page as you use it (drawing as you go, with the mic on if you like), and **Voice** records a
|
|
68
|
-
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
|
|
69
|
-
on the board, and one no one has claimed yet can be edited or deleted there (deleting cancels it on the board). Undo
|
|
70
|
-
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,
|
|
71
|
-
title, element and what was attached.
|
|
72
|
-
|
|
73
|
-
## Options
|
|
73
|
+
### Options
|
|
74
74
|
|
|
75
|
-
Each plugin takes its options under its name, and `false` leaves one out
|
|
76
|
-
beside the preset:
|
|
75
|
+
Each plugin takes its options under its name, and `false` leaves one out:
|
|
77
76
|
|
|
78
77
|
```ts
|
|
79
78
|
deictic({
|
|
80
|
-
shortcut: { modifiers: ['Control', 'Shift'] }, // instead of Alt
|
|
79
|
+
shortcut: { modifiers: ['Control', 'Shift'] }, // instead of Alt
|
|
81
80
|
plugins: recommended({
|
|
82
|
-
tasks: { channel: 'ui',
|
|
81
|
+
tasks: { channel: 'ui', labels: { team: 'web' } },
|
|
83
82
|
screenshots: { maskAllInputs: true },
|
|
84
83
|
voice: false,
|
|
85
84
|
}),
|
|
86
85
|
});
|
|
87
86
|
```
|
|
88
87
|
|
|
89
|
-
|
|
90
|
-
default your `package.json`'s name, to tell projects apart on one board), `deictic.at`, `deictic.url`,
|
|
91
|
-
`deictic.viewport` and more, and your own `labels` beside them.
|
|
88
|
+
[API.md](API.md) has the rest: your team's board, masking, every plugin's options, and writing a plugin of your own.
|
|
92
89
|
|
|
93
|
-
|
|
94
|
-
blanks an element, `rr-mask` masks its text, `maskAllInputs` masks every field (passwords always are). Nothing of
|
|
95
|
-
deictic's own UI is in them. What a project keeps (the history, shots, recordings, voice notes) is in `.deictic/`,
|
|
96
|
-
which ignores itself in git.
|
|
90
|
+
## Contributing
|
|
97
91
|
|
|
98
|
-
|
|
99
|
-
`standalone`, a module of the page's whose default export answers the overlay's requests there:
|
|
92
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
100
93
|
|
|
101
|
-
|
|
102
|
-
// vite.config.ts
|
|
103
|
-
deictic({ plugins, standalone: 'src/standalone.ts' });
|
|
104
|
-
|
|
105
|
-
// src/standalone.ts: a request the dev server would get under `/__deictic/`, and its answer
|
|
106
|
-
import type { Standalone } from 'deictic';
|
|
107
|
-
export default (async (request) => Response.json({ model: null })) satisfies Standalone;
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
What a plugin's `add` route would keep, the module keeps, and answers with the `url` it's at. A recording's is a
|
|
111
|
-
replay page for the build to publish: `replayPage({ player, source })` from `deictic/recordings` is its HTML.
|
|
112
|
-
|
|
113
|
-
## How it works
|
|
114
|
-
|
|
115
|
-
- A transform that runs before the framework's own adds `data-deictic="src/App.tsx:12:5"` to every host element
|
|
116
|
-
(`div`, `button`) in `.jsx`, `.tsx` and `.js` modules and in `.astro` components, so it works for any framework
|
|
117
|
-
that compiles JSX, server components too, and points at the element's own tag rather than the component around it.
|
|
118
|
-
- Its endpoints are on the dev server's own origin, `/__deictic/*`, and take writes only as same-origin JSON, so no
|
|
119
|
-
other site can make them and no token reaches the page.
|
|
120
|
-
- Every change goes into one history in `.deictic/history.json`. The popup's undo and redo walk the part of it that
|
|
121
|
-
is the open tab's on the element it's open on. A plugin's own change, a task, is undone by the plugin.
|
|
122
|
-
|
|
123
|
-
## Writing a plugin
|
|
124
|
-
|
|
125
|
-
A plugin has a server half, which runs beside the bundler, and a page half, which can draw a tab in the popup.
|
|
126
|
-
Every part is optional but its `name`.
|
|
127
|
-
|
|
128
|
-
```ts
|
|
129
|
-
// my-plugin/index.ts
|
|
130
|
-
import { definePlugin } from 'deictic';
|
|
131
|
-
|
|
132
|
-
export const notes = () =>
|
|
133
|
-
definePlugin<Model, Op>({
|
|
134
|
-
name: 'notes',
|
|
135
|
-
client: 'my-plugin/client', // the page half, which the page imports
|
|
136
|
-
read: ({ element }) => ({ … }), // what the tab shows for the element
|
|
137
|
-
apply: (source, target, op) => [{ start, end, text }], // edits to the file, written by deictic, undoable
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
// my-plugin/client.ts
|
|
141
|
-
import { defineClientPlugin } from 'deictic';
|
|
142
|
-
|
|
143
|
-
export default defineClientPlugin<Model, Op>({
|
|
144
|
-
name: 'notes',
|
|
145
|
-
label: 'Notes',
|
|
146
|
-
mount(panel, { model, element, apply }) {
|
|
147
|
-
// draw into `panel`; `apply(op)` writes, and answers the model read again
|
|
148
|
-
},
|
|
149
|
-
});
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
Plugins add routes to the dev server (`routes`), set up an API for others (`setup`), and reach each other's with
|
|
153
|
-
`context.use(name)`: that's how tasks attaches screenshots and recordings. A change that isn't to a file answers
|
|
154
|
-
`{ done: record }`, and the plugin's `undo` and `redo` get the record back. The types in `deictic`'s index document
|
|
155
|
-
each part.
|
|
156
|
-
|
|
157
|
-
## Develop
|
|
158
|
-
|
|
159
|
-
```bash
|
|
160
|
-
bun install
|
|
161
|
-
bun dev # build, then the site on http://localhost:5180, with a board on this machine for its tasks
|
|
162
|
-
bun run test # bun test, on the source
|
|
163
|
-
bun run checks # lint + format check + type check + test
|
|
164
|
-
```
|
|
94
|
+
## License
|
|
165
95
|
|
|
166
|
-
|
|
167
|
-
the site pins deictic's own popup open at each tab, to leave tasks about deictic itself.
|
|
96
|
+
[MIT](LICENSE)
|
|
@@ -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;
|
|
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"}
|