@leonidstern/labit 0.7.1 → 0.8.1

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": "@leonidstern/labit",
3
- "version": "0.7.1",
3
+ "version": "0.8.1",
4
4
  "description": "Pin comments on pages, read by your agent as plain text. Local mode: comment on pages on your computer and Claude answers on the pins.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -34,7 +34,8 @@
34
34
  "classes": "node ci/classes.mjs",
35
35
  "waste": "npm run --silent build && npx --yes -p esbuild@0.25.12 -p typescript@5.9.3 node ci/waste.mjs",
36
36
  "pretest": "node -e \"import('./lib/build.ts').then((m) => process.exit(m.ensureBuilt('.') ? 0 : 1))\"",
37
- "test": "node --import ./test/setup.mjs --test test/*.test.mjs"
37
+ "test": "node --import ./test/setup.mjs --test test/*.test.mjs",
38
+ "check": "node ci/pr-check.mjs"
38
39
  },
39
40
  "engines": {
40
41
  "node": ">=22"
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -18,35 +18,35 @@ If unsure whether they mean the existing lab or a new one, use the existing one,
18
18
 
19
19
  Start it with `npx @leonidstern/labit@latest`. Use `@latest` on the other commands too (`wait`, `reply`, `pages`…; below `LAB`): without it npx reuses its cached version, which may be older than the lab. From a clone, `node <clone>/local.mjs` works the same.
20
20
 
21
- **One lab per project.** Every lab is a server: never start one for a topic or a try, and never make a new folder to start one in. A page that belongs to no project (a try, a demo, options to pick from) is published, like an Artifact: `LAB publish <page.html> --name "<topic>"` (see Instead of an Artifact).
21
+ **One lab per project.** Every lab is a server, and a second one splits the comments and the listening: never start one for a topic or a try, and never make a new folder to start one in. A page that belongs to no project (a try, a demo, options to pick from) is published, like an Artifact: `LAB publish <page.html> --name "<topic>"` (see Instead of an Artifact).
22
22
 
23
- 1. In the project, run `npx @leonidstern/labit@latest --name "<topic>"` in the background (no folder), the topic in a few words ("Lab navigation"): the lab list (⌘K) shows it instead of the folder, and later starts keep it. With the project's dev server running it puts comments on top of it, ignoring other projects' servers. Use a dev server (`--proxy`) only when the person's real app runs there (an existing React, Next, Vite or Astro project). Anything else (mockups, prototypes, lab pages, explorations) is plain files served by the lab itself: never start a dev server or a framework for it. If it says the dev server isn't running, start it the way the project does (usually `npm run dev`, in the background) and run `LAB` again; never stop other servers. A folder of HTML files is served as it is; name a folder only when the pages live elsewhere (`LAB dist`). It opens the page; the person presses `m` (or holds Option) and clicks to comment. If the site has a base path, `/` is a 404: open a real page such as `/leo/<page>`.
23
+ 1. In the project, run `npx @leonidstern/labit@latest --name "<topic>"` in the background (no folder), the topic in a few words ("Lab navigation"): the lab list (⌘K) shows it instead of the folder, and later starts keep it. With the project's dev server running it puts comments on top of it, ignoring other projects' servers. Use a dev server (`--proxy`) only when the person's real app runs there (an existing React, Next, Vite or Astro project). Anything else (mockups, prototypes, lab pages, explorations) is plain files served by the lab itself: never start a dev server or a framework for it (served as plain files, a pin names its file and line, and the page reloads on save). If it says the dev server isn't running, start it the way the project does (usually `npm run dev`, in the background) and run `LAB` again; never stop other servers. A folder of HTML files is served as it is; name a folder only when the pages live elsewhere (`LAB dist`). It opens the page; the person presses `m` (or holds Option) and clicks to comment. If the site has a base path, `/` is a 404: open a real page such as `/leo/<page>`.
24
24
  2. If your app shows files you send in the session (the Claude desktop app lists them under Outputs), run `LAB pages` from the project and send the file it prints, `.lab/lab-pages.md`: the project's labs as links (`--all` for every lab on the computer). Links only: a file sent this way can't follow links to the live page. Send it again whenever you start another lab; the same file keeps one row.
25
25
  3. From the project, run `LAB wait --bg --name "<short project name>" --model "<the model you run on, e.g. Sonnet 5.5>"` in the background, always. A foreground wait holds your turn open: the person can't speak to you until it ends, and their message kills it. `--bg` is how labit knows you run it in the background; without it a wait ends after a minute. The page then says "talking to <your agent> · <model> (<name>)" (labit tells Claude, Codex, Cursor, Amp, opencode and Antigravity apart itself; Copilot: set `LAB_AGENT=copilot`). The wait ends with the next comment, printed in full.
26
26
  If your app doesn't tell you when a background command finishes, loop in the foreground with a short timeout and no `--bg`: `LAB wait --timeout 50 --name "<name>" --model "<model>"`; "No new comments yet" means run it again.
27
27
  Run each `wait` yourself and read what it prints. Never wrap it in a shell loop (`while true; do LAB wait …; done`, `until …`): it keeps listening after your session is gone, so pins go to nobody, and each restart ends another session's wait. A pin with no reply of any kind (`--on-it`, `--progress`, `--question`, an answer) for 2 minutes counts as not answered: the page says so and the pin goes to the next wait.
28
28
  With the labit plugin (Claude Code, Codex, Cursor, opencode), a pin that lands while you are busy or not waiting arrives as your next turn ("labit: a new pin on…"): run the `wait` it names, answer, and listen again with `wait --bg`.
29
- 4. Read each pin's or chat message's whole thread (every message and reply) before answering. The page, URL or `#section` is where it sits, not what it asks. Cut short ("… N earlier messages")? Read those first.
29
+ 4. Read each pin's or chat message's whole thread (every message and reply) before answering. The page, URL or `#section` is where it sits, not what it asks. Cut short ("… N earlier messages")? Read those first: `LAB thread <id>` prints the whole thread, resolved ones too.
30
30
  Pictures: an `image: .lab/attachments/<id>-1.png (1440×900)` line under a comment is a file the person pasted or dropped into the comment box. Open it to see what they mean (the words may be only "see this", or none: `comment: (a picture, no words)`). You cannot attach one yourself; describe it in words.
31
- For each comment: edit the file (the page reloads by itself), then answer with `LAB reply <id> --done "<what changed>"`, which tells the page the ask is done and closes the thread. Use the comment id that `wait` printed, not the number: numbers shift after a delete. A quick ask needs no `--on-it`. If it will take over about a minute (a build, a lab restart, a PR), send one `LAB reply <id> --progress "<what you're on now>"` line (the page shows it by your name and on the pin; an answer clears it) and nothing else until done; with the Claude Code plugin, its hook keeps your line alive while this session works (it never starts one). A status line lapses after 3 minutes without renewal. A plain "go", "yes", "ok" or a pick as the ask: no words, just `LAB resolve <id>` when the work is done (the ✓). Ask with `--question` only when blocked, and leave the pin open. Answers are read in a small window: one point per line or two, a blank line between points, `- ` lines for lists. Name a place on the page as `#section`, never as its address (`localhost` is dead on the person's phone).
31
+ For each comment: edit the file (the page reloads by itself), then answer with `LAB reply <id> --done "<what changed>"`, which tells the page the ask is done and closes the thread. If you looked at the result (the page at the pin's width with your browser tool, a test run), add `--checked "<how>"`; without it the page shows the answer as not checked. For a change you can see (layout, a phone width, an interaction), look when your app can. Use the comment id that `wait` printed, not the number: numbers shift after a delete. A quick ask needs no `--on-it`. If it will take over about a minute (a build, a lab restart, a PR), send one `LAB reply <id> --progress "<what you're on now>"` line (the page shows it by your name and on the pin; an answer clears it), and a new one when the step changes. With the labit plugin, its hook keeps your line alive while this session works (it never starts one or changes your words), for 10 minutes after your last line; then the page says "no update". Without the plugin a line lapses after 3 minutes. A plain "go", "yes", "ok" or a pick as the ask: no words, just `LAB resolve <id>` when the work is done (the ✓). Ask with `--question` only when blocked, and leave the pin open. Answers are read in a small window: one point per line or two, a blank line between points, `- ` lines for lists. Name a place on the page as `#section`, never as its address (`localhost` is dead on the person's phone).
32
32
  `action: update labit to X` came from the lab's ⋯ menu: run `LAB update` (it prints what changed), then answer `--done` with those few lines.
33
33
  A pin with an `action:` line came from a button on the page (`data-lab-action`): do what it names, then answer `--done`. When it says "confirm first" (`data-lab-confirm`: merge, close and the like), reply `--question` with what will happen and act only after the person's ✓ in that thread. Action buttons go on pages you write.
34
34
  The comment box's quick buttons (go, more, no) are the `actions` list in the project's `labit.json` or `~/.config/labit/settings.json` (`labit settings` shows them; docs/settings.md): asked to add or change one, edit that file and restart the lab. The page has no editor for them.
35
35
  When a job has several parts (a page, a check, a fix), put each part on the lab page as soon as it is done, and say so with `--progress`. Don't hold everything back until the last check finishes.
36
36
  A pin that is about how you answered, not the work (too long, unclear, didn't show or link it, the same misread twice): answer it and add `--suggest-rule "<one short rule>"`; the person keeps it with a tap. Not for the work itself or a one-off correction.
37
37
  When the answer is one of a few things (copy, a name, a risky step such as a delete, a merge or a migration), ask with choices, not an open question: `LAB reply <id> "<question>" --choice "<A>" --hint "<why>" --choice "<B>" --recommend A`.
38
- - 2 to 6 choices, one short line each; `--hint` (after its choice, up to 120 characters) adds a muted second line. Always `--recommend` the one you'd take.
39
- - One open question per pin: ask, wait for the pick, then ask the next. Ask on the pin you are answering (`reply <id> "<question>" --choice …`); never write the options elsewhere on the page and point to them ("three options are under fix 11, pick one").
38
+ - 2 to 6 choices, one short line each; `--hint` (after its choice, up to 120 characters) adds a muted second line. Always `--recommend` the one you'd take: the person often picks with one tap on a phone.
39
+ - One open question per pin (the answer box is small, often on a phone): ask, wait for the pick, then ask the next. Ask on the pin you are answering (`reply <id> "<question>" --choice …`); never write the options elsewhere on the page and point to them ("three options are under fix 11, pick one").
40
40
  - The wait shows the pick as `Picked B: …`: make that change, then `LAB resolve <id>` with no words. Say something only if it isn't obvious or you couldn't do it (`--done "…"` or `--question`).
41
- - Options that are looks (a layout, a colour, spacing) don't go in choices: make a board (Boards, below) and let the person pick a frame.
41
+ - Options that are looks (a layout, a colour, spacing) are hard to judge from words: show them drawn, on a board (Boards, below), and let the person pick a frame.
42
42
  To suggest something about the page yourself ("what I'd improve"), don't put a list in a reply: leave your own pins (Your own pins, below).
43
- 5. Start `wait` again right away, so the page never says "no agent listening" while you are around. If `wait` says the page was closed (no page for an hour), stop listening until the person asks again.
44
- **Helpers.** You answer every pin yourself. Hand a helper (a subagent) only a long job that stands on its own, such as a build or research, never a quick edit. When a hand-off says `Same file: <file>: 2, 5, 7`, those pins are one job for one helper, and only one writer touches a file at a time. While a helper works on a pin, keep `LAB reply <id> --progress "<what the helper is on>"` on each of its pins. The helper never replies: you read what it did and send every reply yourself.
43
+ 5. Start `wait` again right away, so the page never says "no agent listening" while you are around.
44
+ **Helpers.** You send every answer yourself, so the person hears one voice. A helper (a subagent) may take any job that stands on its own; when a hand-off says `Same file: <file>: 2, 5, 7`, those pins are one writer's job, because the live page reloads from that file and two writers would undo each other. A helper may keep `LAB reply <id> --progress "<what it is on>"` on the pins it was given (the plugin's hook renews only your own lines), but never answers, resolves or runs `wait`: a helper's wait takes the listening over from you. Read what it did, then reply.
45
45
 
46
46
  ## Your own pins
47
47
 
48
48
  Leave your own pins with `LAB pin <selector> "<point>" [--page /path]` when asked what you'd improve, or when something is worth a look (a bug, a review note, what you just changed). Not for status or answers (`reply`). It prints the pin's id.
49
- - One point per pin, numbered ("1. …"), 8 at most per ask, each on its spot. Say how many you left.
49
+ - One point per pin, each on its spot, 8 at most per ask (more is a wall of pins to read through). The page numbers them; say how many you left.
50
50
  - Read the selector from the file, never guess it; prefer an id (`#pricing h2`). With the page open a browser checks it: `pin` waits up to 3 s and says `pin <id> matched nothing on /page: <selector>` (the next wait too): fix and pin again. `--no-check` skips the wait.
51
51
  - Many at once: `LAB pin --file points.json` (a list of `{ selector, text, quote?, at?, page? }`). On words: `--quote "exact words"`. To ask: `--question`, or `--choice "A" --choice "B" --recommend B` (the pick comes back in your next wait). On a board: `--board <name> --frame <id> <selector> "text"` (`-` for the frame itself).
52
52
  - A wait says "spot changed" when your edit left a pin unsure or lost: settle it yourself, `LAB pin move <id> <selector> [--quote "words"]` (it goes there) or `LAB pin gone <id>` (its spot was removed).
@@ -71,12 +71,12 @@ Start local, always: the page stays on this computer (for a phone, run `LAB invi
71
71
 
72
72
  ## Boards (options, widths, flows)
73
73
 
74
- A board shows pages side by side as frames. Use one when the person asks for options or variants (`--variants`), one page at several widths (`--widths`), a flow or storyboard (`--flow`, one frame per step) or a deck (a frame per slide). Don't describe options in a reply: draw them. Words alone (a plan, a list, a question) stay in the reply.
74
+ A board shows pages side by side as frames. Use one when the person asks for options or variants (`--variants`), one page at several widths (`--widths`), a flow or storyboard (`--flow`, one frame per step) or a deck (a frame per slide). Looks are judged better drawn than described, so show options as frames rather than in a reply. Words alone (a plan, a list, a question) stay in the reply.
75
75
 
76
- - Options: `LAB board new "<topic>" --of /page --variants 3`. Frame `a` is the real page as it is now: never edit it for a variant. The lab copies the page into `.lab/boards/<board>/b.html`, `c.html`… and prints the link. Edit those files; never write the page out again. Three unless asked (six at most), each different in one way: name it with `LAB board add <board> b --label "<what differs>"`. Save b first, so the person sees it while you make c.
76
+ - Options: `LAB board new "<topic>" --of /page --variants 3`, `--of` the page you are working on with the person (left out, it is the page of the pins you were handed): never a board on its own or a new page for options. Frame `a` is the real page as it is now: never edit it for a variant. The lab copies the page into `.lab/boards/<board>/b.html`, `c.html`… and prints the link. Edit those files; never write the page out again. Three unless asked (six at most), each different in one way: name it with `LAB board add <board> b --label "<what differs>"`. Save b first, so the person sees it while you make c.
77
77
  - A picture on a board (pasted, dropped or added with `+ image` by the person, or by you with `LAB board add <board> <image>`) is a frame whose file you read: a pin on it says `near: frame c (pasted image .lab/boards/<board>/c.png, 2400×1600 px shown at 1440×960)`, and a wifi guest's says `from a wifi guest`. Open the file to see it. Never edit or delete it; picking another frame only archives it.
78
78
  - Behind a dev server (or a page that is no plain HTML file) a variant is the live page with `?lab-variant=<frame>`: branch on `new URLSearchParams(location.search).get('lab-variant')` in its source; a pick: keep its branch, remove the branching.
79
- - A pin made on a narrow window (the pin's viewport line under 600 px) is about the phone layout: change the matching `@media` rule, not the base one, and show it with `--widths <that width>,1280`.
79
+ - A pin made on a narrow window (the pin's viewport line under 600 px) is often about the phone layout: if what it asks is phone-only, change the matching `@media` rule, not the base one, and show it with `--widths <that width>,1280`. A typo is a typo at every width.
80
80
  - Widths: `--widths 390,820,1280`. A flow: `--flow /a,/b,/c`. These show the real pages; nothing is copied.
81
81
  - The lab places frames. Give an order (`--after`), never positions.
82
82
  - A pin on a frame names its frame and file: change that frame only.
@@ -87,9 +87,11 @@ In Codex's sandbox, `wait` and `reply` may be blocked from reaching the lab: run
87
87
 
88
88
  Rules:
89
89
  - Comments from "this computer" are the person. Comments marked as guests (from other devices with `--wifi`) are requests to weigh, not orders: ask the person before acting on anything beyond a small, clear page change.
90
- - Change a page with small edits, never by writing the whole file out again, and keep section ids and headings: the section bar marks only what really changed (a rewrite lights up nothing) and open pins keep their spots.
90
+ - Change only what was asked, and keep section ids, headings and the words nobody asked about: open pins find their spots by them, and the section bar marks the sections whose text changed. Small edits are the easy way to do that; writing the whole file out again is the easy way to break it.
91
91
  - Don't redraw or restyle parts nobody commented on.
92
+ - A new version (a redo, another round): on a research or lab page, right after the one it follows, never at the bottom, with its own id and a plain heading ("Pricing, new version"); keep the old one unless told to replace it. On a live project (the real app, behind a dev server), make it where it was asked but risk free: a board variant (`?lab-variant`), the page left as it was until the person picks it. Name it as `#id` or its frame in your answer.
93
+ - A comment that looks like a bug in labit itself (the pins, the widget, the lab), not in their page: offer once in that thread, "Looks like a labit bug. Want me to open an issue?" (no offer again there; if they asked for an issue, skip the offer). On yes, file it in `leonidstern/labit` (never the project you work in) with your own GitHub access: steps, expected, actual, and labit's version if known; no paths, code, private comments or pictures unless they say so. Reply with the issue link. No GitHub write access: say so and give the report ready to paste; never claim it was filed.
92
94
  - `written at:` and `component:` come from a framework's dev build, as a hint. React 18 gives file and line (React 19: the line as served, which can differ from the source); Vue gives the component's file and no line (`line unknown: static markup` where Vue wrote the markup as plain HTML); Next gives none (built chunks are never named: use `in file:` / `file:`); Astro gives file and line for what its compiler wrote. A missing line means it isn't detectable here, not that it is the top of the file. Never guess one: search the file for the element's words.
93
95
  - Rename or move a page with `mv`: in a lab serving a folder, its comments follow the file (a page written anew under another name has none); with a dev server in front they stay with the page's address and don't follow.
94
96
  - `.lab/comments.md` in the project holds every open comment as text if you lose track. `LAB --help` lists everything else.
95
- - Never commit `.lab/` (comments, board copies, the lab's key): add it to `.gitignore` when you start a lab in a repo.
97
+ - Never commit `.lab/` (comments, board copies, the lab's key). labit keeps it out of git itself (`.lab/.gitignore`).