@react-grab/cli 0.1.41 → 0.1.43-dev.5ceaf57
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 +286 -196
- package/dist/cli.js +286 -196
- package/dist/cli.js.map +1 -1
- package/package.json +5 -3
- package/skills/react-grab/SKILL.md +19 -51
package/package.json
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-grab/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.43-dev.5ceaf57",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/aidenybai/react-grab.git"
|
|
7
|
+
},
|
|
4
8
|
"bin": {
|
|
5
9
|
"react-grab": "./bin/cli.js"
|
|
6
10
|
},
|
|
@@ -21,12 +25,10 @@
|
|
|
21
25
|
"agent-install": "^0.0.5",
|
|
22
26
|
"commander": "^14.0.3",
|
|
23
27
|
"ignore": "^7.0.5",
|
|
24
|
-
"jsonc-parser": "^3.3.1",
|
|
25
28
|
"ora": "^9.4.0",
|
|
26
29
|
"package-manager-detector": "^1.6.0",
|
|
27
30
|
"picocolors": "^1.1.1",
|
|
28
31
|
"prompts": "^2.4.2",
|
|
29
|
-
"smol-toml": "^1.6.1",
|
|
30
32
|
"tinyexec": "^1.1.2"
|
|
31
33
|
},
|
|
32
34
|
"devDependencies": {
|
|
@@ -10,63 +10,29 @@ description: >-
|
|
|
10
10
|
|
|
11
11
|
# React Grab
|
|
12
12
|
|
|
13
|
-
The user selects UI elements in their browser and copies them with React Grab.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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.
|
|
13
|
+
The user selects UI elements in their browser and copies them with React Grab.
|
|
14
|
+
`npx grab pull` waits for new grabs and prints each as one line of JSON (usually
|
|
15
|
+
one, sometimes a few if several were copied), starting the background watcher
|
|
16
|
+
automatically the first time. Run it in a loop.
|
|
28
17
|
|
|
29
18
|
## The loop
|
|
30
19
|
|
|
31
20
|
Repeat until the user says stop:
|
|
32
21
|
|
|
33
|
-
1.
|
|
22
|
+
1. Wait for the next grab:
|
|
34
23
|
|
|
35
24
|
```bash
|
|
36
|
-
npx grab
|
|
25
|
+
npx grab pull
|
|
37
26
|
```
|
|
38
27
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
28
|
+
It blocks until the user grabs something, then prints the new grab(s) — one JSON
|
|
29
|
+
object per line. Act on every line. If your shell cancels the command before a
|
|
30
|
+
grab arrives, just run it again — nothing is lost; the watcher keeps capturing in
|
|
31
|
+
the background and `pull` resumes where it left off.
|
|
42
32
|
|
|
43
|
-
2. Act on
|
|
33
|
+
2. Act on the grab (below).
|
|
44
34
|
3. Go back to step 1.
|
|
45
35
|
|
|
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.
|
|
69
|
-
|
|
70
36
|
## Acting on a grab
|
|
71
37
|
|
|
72
38
|
Each grab JSON has `content` (the element's source references) and, in prompt
|
|
@@ -79,15 +45,17 @@ mode, `prompt` (the user's typed instruction):
|
|
|
79
45
|
loop, or, if there is none, triage it (summarize component + `file:line`) and
|
|
80
46
|
wait for direction.
|
|
81
47
|
|
|
82
|
-
A standing instruction is optional; prompt mode lets the user steer each grab
|
|
83
|
-
inline.
|
|
84
|
-
|
|
85
48
|
## Stopping
|
|
86
49
|
|
|
87
|
-
When the user says stop,
|
|
50
|
+
When the user says stop, run this and don't pull again:
|
|
88
51
|
|
|
89
52
|
```bash
|
|
90
|
-
npx grab
|
|
53
|
+
npx grab stop
|
|
91
54
|
```
|
|
92
55
|
|
|
93
|
-
|
|
56
|
+
## Notes
|
|
57
|
+
|
|
58
|
+
- The watcher reads the clipboard on the machine it runs on — run it on the same
|
|
59
|
+
machine as the browser, not over SSH or in a remote container.
|
|
60
|
+
- Grabs older than ~5 minutes are skipped as stale; use `npx grab pull --max-age 0`
|
|
61
|
+
to deliver every grab regardless of age.
|