@react-grab/cli 0.1.40 → 0.1.42

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-grab/cli",
3
- "version": "0.1.40",
3
+ "version": "0.1.42",
4
4
  "bin": {
5
5
  "react-grab": "./bin/cli.js"
6
6
  },
@@ -10,60 +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. 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.
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. Pull the next grabs (blocks up to 20s for one to arrive, then returns):
22
+ 1. Wait for the next grab:
34
23
 
35
24
  ```bash
36
- npx grab read --wait 20000
25
+ npx grab pull
37
26
  ```
38
27
 
39
- Each line of stdout is one grab as JSON. Empty output means nothing new yet —
40
- just run it again.
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.
41
32
 
42
- 2. Act on each grab (below).
33
+ 2. Act on the grab (below).
43
34
  3. Go back to step 1.
44
35
 
45
- `read` advances a cursor (`./.react-grab/cursor.txt`), so each grab is delivered
46
- exactly once across calls. Add `--all` to replay the whole history from the start.
47
-
48
- ## Gotchas
49
-
50
- - **Empty `read` output is not an error** — it just means no grab landed yet.
51
- Re-run it; never treat empty output as the daemon being dead or the loop being
52
- done. Only the user saying "stop" ends the loop.
53
- - **The daemon reads the clipboard on the machine it runs on.** Over SSH, in a
54
- container, or on a cloud host while the browser is on the user's laptop, grabs
55
- never arrive. The daemon must run on the same machine as the browser.
56
- - **Run one `read` at a time.** Concurrent reads share `cursor.txt` and can
57
- double-deliver or skip grabs — keep the loop sequential.
58
- - **`read --all` replays the whole history without consuming it** — it does not
59
- advance the cursor, so use it only to inspect history; the loop's plain `read`
60
- is what delivers each grab exactly once.
61
- - **If grabs never arrive even though the user is grabbing**, the daemon may not
62
- be staying up. A healthy daemon makes `npx grab@latest watch` report
63
- `already watching`; if it keeps reporting `started`, the daemon is dying on
64
- startup — usually no clipboard reader. Try `npx grab watch --text-only`, or run
65
- `npx grab watch --foreground` once to see the startup error directly.
66
-
67
36
  ## Acting on a grab
68
37
 
69
38
  Each grab JSON has `content` (the element's source references) and, in prompt
@@ -76,15 +45,17 @@ mode, `prompt` (the user's typed instruction):
76
45
  loop, or, if there is none, triage it (summarize component + `file:line`) and
77
46
  wait for direction.
78
47
 
79
- A standing instruction is optional; prompt mode lets the user steer each grab
80
- inline.
81
-
82
48
  ## Stopping
83
49
 
84
- When the user says stop, stop the daemon and do not read again:
50
+ When the user says stop, run this and don't pull again:
85
51
 
86
52
  ```bash
87
- npx grab@latest watch --stop
53
+ npx grab stop
88
54
  ```
89
55
 
90
- Confirm the loop has stopped.
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.