@react-grab/cli 0.1.39 → 0.1.41
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/dist/cli.cjs +369 -138
- package/dist/cli.js +369 -138
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
- package/skills/react-grab/SKILL.md +60 -16
package/package.json
CHANGED
|
@@ -6,31 +6,70 @@ description: >-
|
|
|
6
6
|
copy-paste or manual handoff. Triggers: "watch react grab", "monitor my
|
|
7
7
|
grabs", "auto-process react grab", "watch my clipboard for grabs". Not for a
|
|
8
8
|
one-off paste of a single grab; this is the continuous, always-on loop.
|
|
9
|
-
disable-model-invocation: true
|
|
10
9
|
---
|
|
11
10
|
|
|
12
11
|
# React Grab
|
|
13
12
|
|
|
14
|
-
The user selects UI elements in their browser and copies them with React Grab.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
The user selects UI elements in their browser and copies them with React Grab. A
|
|
14
|
+
background daemon captures each grab to `./.react-grab/history.jsonl`; you pull
|
|
15
|
+
them with `grab read`. Nothing blocks the agent: the daemon runs detached and
|
|
16
|
+
`read` returns promptly, so the loop survives shell-command timeouts.
|
|
17
|
+
|
|
18
|
+
## Start the daemon (once)
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npx grab@latest watch
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
This launches a detached daemon that watches the clipboard. It is idempotent per
|
|
25
|
+
dir — re-running it while a daemon is already watching this project is a no-op —
|
|
26
|
+
so it is safe to run at the start of every session. `--dir <path>` relocates the
|
|
27
|
+
capture dir; `--text-only` skips the native clipboard reader.
|
|
19
28
|
|
|
20
29
|
## The loop
|
|
21
30
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
31
|
+
Repeat until the user says stop:
|
|
32
|
+
|
|
33
|
+
1. Pull the next grab — this blocks until one arrives:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npx grab read --wait infinite
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Give the command a long timeout. If your shell cancels it before a grab arrives,
|
|
40
|
+
just run it again — the daemon keeps capturing in the background, so nothing is
|
|
41
|
+
lost. Each line of stdout is one grab as JSON.
|
|
26
42
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
43
|
+
2. Act on each grab (below).
|
|
44
|
+
3. Go back to step 1.
|
|
45
|
+
|
|
46
|
+
`read` advances a cursor (`./.react-grab/cursor.txt`), so each grab is delivered
|
|
47
|
+
exactly once across calls. Grabs older than ~5 minutes are treated as stale and
|
|
48
|
+
skipped (override with `--max-age <ms>`, or `--max-age 0` to never evict). Add
|
|
49
|
+
`--all` to replay the whole history from the start.
|
|
50
|
+
|
|
51
|
+
## Gotchas
|
|
52
|
+
|
|
53
|
+
- **Empty `read` output is not an error** — it just means no grab landed yet.
|
|
54
|
+
Re-run it; never treat empty output as the daemon being dead or the loop being
|
|
55
|
+
done. Only the user saying "stop" ends the loop.
|
|
56
|
+
- **The daemon reads the clipboard on the machine it runs on.** Over SSH, in a
|
|
57
|
+
container, or on a cloud host while the browser is on the user's laptop, grabs
|
|
58
|
+
never arrive. The daemon must run on the same machine as the browser.
|
|
59
|
+
- **Run one `read` at a time.** Concurrent reads share `cursor.txt` and can
|
|
60
|
+
double-deliver or skip grabs — keep the loop sequential.
|
|
61
|
+
- **`read --all` replays the whole history without consuming it** — it does not
|
|
62
|
+
advance the cursor, so use it only to inspect history; the loop's plain `read`
|
|
63
|
+
is what delivers each grab exactly once.
|
|
64
|
+
- **If grabs never arrive even though the user is grabbing**, the daemon may not
|
|
65
|
+
be staying up. A healthy daemon makes `npx grab@latest watch` report
|
|
66
|
+
`already watching`; if it keeps reporting `started`, the daemon is dying on
|
|
67
|
+
startup — usually no clipboard reader. Try `npx grab watch --text-only`, or run
|
|
68
|
+
`npx grab watch --foreground` once to see the startup error directly.
|
|
30
69
|
|
|
31
70
|
## Acting on a grab
|
|
32
71
|
|
|
33
|
-
|
|
72
|
+
Each grab JSON has `content` (the element's source references) and, in prompt
|
|
34
73
|
mode, `prompt` (the user's typed instruction):
|
|
35
74
|
|
|
36
75
|
- **`prompt` present** → that comment IS the task. Execute it against the grabbed
|
|
@@ -45,5 +84,10 @@ inline.
|
|
|
45
84
|
|
|
46
85
|
## Stopping
|
|
47
86
|
|
|
48
|
-
When the user says stop,
|
|
49
|
-
|
|
87
|
+
When the user says stop, stop the daemon and do not read again:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
npx grab@latest watch --stop
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Confirm the loop has stopped.
|