usepilot 0.19.0 → 0.21.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/GUIDE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Pilot guide
2
2
 
3
- How to use Pilot, task by task. This guide is for **usepilot 0.19.0**: it ships with Pilot, so the copy in your project (`node_modules/usepilot/GUIDE.md`, or `npx usepilot guide`) always matches the version you have.
3
+ How to use Pilot, task by task. This guide is for **usepilot 0.21.0**: it ships with Pilot, so the copy in your project (`node_modules/usepilot/GUIDE.md`, or `npx usepilot guide`) always matches the version you have.
4
4
 
5
5
  **Agents:** when someone asks how to do something with Pilot, answer from this file. If it isn't here, Pilot doesn't do it yet: say so rather than guessing.
6
6
 
@@ -169,12 +169,12 @@ With **Select** on, **double-click** a text to edit it in place. **Enter** is do
169
169
 
170
170
  ## Comments
171
171
 
172
- - **Comment** (Option+C), click an element (Shift+click for several), and write what you want in your own words. **Enter** sends, **Shift+Enter** is a new line, **Esc** closes (your draft is kept).
172
+ - **Comment** (Option+C), click an element (Shift+click for several), and write what you want in your own words. **Enter** sends, **Shift+Enter** is a new line, **Esc** closes (your draft is kept, and comes back as you left it, an open `@` or `/` list included).
173
173
  - **Attach** images, text files or PDFs with the attach button, or drop them on the box.
174
- - **Unsent edits go along:** edits you made on those elements show as a chip ("2 changes") and go with the comment; remove the chip to keep them for Send. Where the comment and an edit disagree, the comment wins.
174
+ - **Unsent edits go along:** edits you made on those elements show as a chip ("2 changes") and go with the comment; remove the chip to keep them for Send. Where the comment and an edit disagree, the comment wins. With a skill or `pilot-make-responsive` picked, the edits go first, then the skill works on the result: both chips show, the edits' first.
175
175
  - Each element has a **thread**: the agent replies in it, and you can reply to follow up ("a bit more"): the agent remembers the thread.
176
176
  - A thread with a reply to read shows a **comment icon** on its element and counts on the Comment button.
177
- - **Edit manually**, under a reply that changed the element's look, switches to Select with those elements selected, to fine-tune what the agent chose.
177
+ - **Edit manually**, under a reply that changed the element's look, switches to Select with those elements selected, to fine-tune what the agent chose. A reply with **Copy instructions** doesn't have it: allow what was refused and ask again first.
178
178
  - **Mark as solved** (or Option+Enter) closes the thread.
179
179
  - **Stop** (beside send) cancels the job while the agent works.
180
180
 
@@ -184,15 +184,21 @@ Type `/` at the start of a word in the comment box:
184
184
 
185
185
  - **Your agent's skills**, the ones its own `/` shows (the project's, then yours). A bare `/` lists the first few; type to see every match (`/emil`). Pick one and the agent uses it for this comment.
186
186
  - **Props**, on a component's instance: lists the props that change how it looks. Reply with a line like `tone: dark` to change one.
187
- - **Make responsive**: makes the element work at every screen width. Pilot checks the result at a phone width, each breakpoint and a wide desktop, and sends problems back to the agent once.
187
+ - **pilot-make-responsive** (`/responsive` finds it too): makes the element work at every screen width. Pilot checks the result at a phone width, each breakpoint and a wide desktop, and sends problems back to the agent once.
188
+ - **pilot-break-and-fix**: makes the element hold up with real-world content. Pilot first puts odd content into a copy of the page (very long text, long words like URLs, many more items, images that fail to load or come in odd shapes) and measures what breaks at each width; the agent fixes exactly that, without changing how it looks with its usual content; Pilot tests again after.
189
+ - **pilot-make-accessible**: fixes what Pilot's audit finds: text contrast (in light and dark mode), names for icon buttons, images and fields, a visible focus style, tap targets on phones, and animations for people who prefer reduced motion. The agent also reviews the code for what can't be measured, and changes nothing of your layout: Pilot checks every element's size and position at every width before and after. Its reply lists what it changed.
190
+
191
+ Pilot's three always end their reply with what Pilot measured itself ("**Pilot checked it:** 4 problems before, 0 now"), and send what's left back to the agent once.
188
192
 
189
193
  ## Mentions (@)
190
194
 
191
195
  Type `@` in a comment to name things instead of describing them: the page's **tokens** and **breakpoints** (`--color-brand`, `@768px`), its **components** (`@ProductCard`, also ones not on this page while Pilot runs for the project), and its **named elements** (`@section#features`). The agent gets exactly what you picked, and where it is in the code.
192
196
 
197
+ The list shows a few of each at first; type to narrow it, and it shows every match. Type a kind of token to list all of that kind, whatever their names: `@color` for every color, `@font` for every font, also `@shadow`, `@easing` and `@duration`.
198
+
193
199
  ## When the agent asks you something
194
200
 
195
- When part of a job needs your decision, the agent asks in a thread instead of guessing, and does the rest. It leaves that part unchanged until you answer, and says so ("Not changed yet: …"). The most common question: you changed one card, or commented on it, and the cards share one component. A question about several elements gets a thread of its own. Answer with a button:
201
+ When part of a job needs your decision, the agent asks in a thread instead of guessing, and does the rest. It leaves that part unchanged until you answer, and says so ("Not changed yet: …"). The most common question: you changed one card, or commented on it, and the cards share one component (or one loop in the code, on a site without components). A question about several elements gets a thread of its own. Answer with a button:
196
202
 
197
203
  - **All of them** changes the component itself.
198
204
  - **Only this** changes this one instance.
@@ -367,6 +367,7 @@ function requestTargets(request) {
367
367
  function formatPrompt(changeSet, options = {}) {
368
368
  if (changeSet.request?.kind === "responsive") return formatResponsive(changeSet, changeSet.request);
369
369
  if (changeSet.request?.kind === "break-and-fix") return formatBreakFix(changeSet, changeSet.request);
370
+ if (changeSet.request?.kind === "accessible") return formatAccessible(changeSet, changeSet.request);
370
371
  if (changeSet.request?.kind === "comment") return formatComment(changeSet, changeSet.request);
371
372
  if (changeSet.request?.kind === "props") return formatProps(changeSet, changeSet.request);
372
373
  const { page, edits, note } = changeSet;
@@ -450,6 +451,7 @@ var PROJECT_CODE = `**Write production code in the project's own styling system*
450
451
  var ACTION_ASKED = {
451
452
  responsive: "asked you to make it responsive",
452
453
  "break-and-fix": "asked you to break and fix it",
454
+ accessible: "asked you to make it accessible",
453
455
  props: "asked for the component's props"
454
456
  };
455
457
  function propValue(value) {
@@ -509,11 +511,13 @@ function formatBreakFix(changeSet, request) {
509
511
  "",
510
512
  ...elementsSection(request),
511
513
  "",
514
+ ...stressSection(request),
515
+ "",
512
516
  "## How to do it",
513
517
  "",
514
518
  "1. **Find the element's component and where its content comes from**: props, data, a CMS or an API, translations. List what can vary: each text, how many repeated items there are, optional parts (an image, a subtitle, a badge), numbers, names, URLs.",
515
- "2. **Think of the odd but realistic content each can get**: text far longer than the placeholder (a 120-character title, a long person or product name) and much shorter or empty; long words with no spaces (URLs, emails, IDs, compound words); optional parts missing (no image, no subtitle, an empty list) and many repeated items instead of a few; big numbers and prices; the longer strings of other languages; images (and background images) in odd shapes, very wide, very tall, tiny or low-resolution, and images that fail to load.",
516
- "3. **Find where it breaks**: for each kind of odd content, read the layout code and work out what it would do: content sticking out of the viewport, spilling out of its parent, clipped, or overlapping; items that shrink when they shouldn't (an icon or avatar squeezed by flex), buttons that stretch, rows that misalign, text wrapping under an icon, images stretched or squashed. If trying it helps, put the content in temporarily and take it out again; no browser or screenshots.",
519
+ "2. **Start from what Pilot found**, then think of the odd but realistic content Pilot can't put in for you: text far longer than the placeholder (a 120-character title, a long person or product name) and much shorter or empty; long words with no spaces (URLs, emails, IDs, compound words); optional parts missing (no image, no subtitle, an empty list) and many repeated items instead of a few; big numbers and prices; the longer strings of other languages; images (and background images) in odd shapes, very wide, very tall, tiny or low-resolution, and images that fail to load.",
520
+ "3. **Find where it breaks**: each problem Pilot found, and for the content it can't try, read the layout code and work out what it would do: content sticking out of the viewport, spilling out of its parent, clipped, or overlapping; items that shrink when they shouldn't (an icon or avatar squeezed by flex), buttons that stretch, rows that misalign, text wrapping under an icon, images stretched or squashed. If trying it helps, put the content in temporarily and take it out again; no browser or screenshots.",
517
521
  "4. **Fix what breaks, without changing how it looks with its usual content**, the way this project does it (its utilities, its components):",
518
522
  " - **Long text:** truncate it with an ellipsis (`truncate`, `text-overflow: ellipsis`) where one line matters, or clamp it to a few lines (`line-clamp-*`) where it can wrap; when the full text is lost, show it on hover (`title`, or the project's tooltip).",
519
523
  " - **Flex and grid:** `min-width: 0` (`min-w-0`) on items holding text so they can shrink; `flex-shrink: 0` (`shrink-0`) on icons, avatars and buttons that mustn't; `minmax(0, 1fr)` columns; wrapping rows (`flex-wrap`) instead of overflowing ones.",
@@ -522,7 +526,7 @@ function formatBreakFix(changeSet, request) {
522
526
  " - **Missing parts:** no gap or empty box left behind; a simple empty state only where one is clearly needed.",
523
527
  " In the check, an ellipsis on your deliberately long text is the fix working, not a problem.",
524
528
  "5. **Put the real content back.** Remove every temporary value you added: nothing of the test may stay in the code. With its usual content, the element must look as it did at the designer's width.",
525
- `6. **Report** in your notes, in a line or two, what broke and how you fixed it, and anything for the designer to decide (a content limit to agree on, an empty state to design). When you report it done, Pilot runs the width check once more, with the usual content: problems come back to you once, as a follow-up.`,
529
+ `6. **Report** in your notes, in a line or two, what broke and how you fixed it, and anything for the designer to decide (a content limit to agree on, an empty state to design). When you report it done, Pilot runs the same stress test again, and the width check with the usual content (its look at the designer's width must be unchanged): what's left comes back to you once, as a follow-up.`,
526
530
  "",
527
531
  several > 1 ? `Change only these elements and what they need (their children, their containers). If they come from a shared component, fix it there, so every instance gets sturdier, as long as its usual look doesn't change; ask before anything that would. ${firstChecked()}` : "Change only this element and what it needs (its children, its container). If it's a shared component, fix it there, so every instance gets sturdier, as long as its usual look doesn't change; ask before anything that would.",
528
532
  "",
@@ -531,6 +535,67 @@ function formatBreakFix(changeSet, request) {
531
535
  return `${lines.join("\n")}
532
536
  `;
533
537
  }
538
+ function stressSection(request) {
539
+ const tested = request.tested ? ` (${request.tested})` : "";
540
+ if (!request.found) return [];
541
+ if (!request.found.length)
542
+ return [
543
+ "## What Pilot's stress test found",
544
+ "",
545
+ `Pilot put odd content into a copy of the page${tested} and measured the element: nothing broke. Check from the code what it can't put in (below), and fix only what would break; if nothing would, change nothing and say so.`
546
+ ];
547
+ return [
548
+ "## What Pilot's stress test found",
549
+ "",
550
+ `Pilot put odd content into a copy of the page${tested}, measured the element at each width, and found what breaks (problems it already has with its usual content are left out). Fix each of these:`,
551
+ "",
552
+ ...request.found.map((f) => `- ${f}`)
553
+ ];
554
+ }
555
+ function formatAccessible(changeSet, request) {
556
+ const { page, note } = changeSet;
557
+ const several = requestTargets(request).length;
558
+ const tested = request.tested ? ` (${request.tested})` : "";
559
+ const lines = [
560
+ "# Pilot: make accessible",
561
+ "",
562
+ several > 1 ? `A designer selected the ${several} elements below together in the browser with Pilot and asked you to make them accessible: usable with a keyboard and a screen reader, readable, and easy to tap, **without changing their layout**.` : "A designer selected the element below in the browser with Pilot and asked you to make it accessible: usable with a keyboard and a screen reader, readable, and easy to tap, **without changing its layout**.",
563
+ "",
564
+ `Page: ${page.url} (${page.title || "untitled"}), seen at ${page.viewport.width}x${page.viewport.height}`,
565
+ "",
566
+ advancedTask()
567
+ ];
568
+ if (note?.trim()) lines.push("", `Designer note: ${note.trim()}`);
569
+ if (request.attachments?.length)
570
+ lines.push("", ...attachmentLines(request.attachments, `The designer attached ${countFiles(request.attachments.length)}:`));
571
+ if (request.references?.length) lines.push("", ...referenceLines(request.references));
572
+ lines.push("", ...elementsSection(request), "", "## What Pilot's audit found", "");
573
+ if (!request.found)
574
+ lines.push("Pilot couldn't audit a copy of the page this time. Check contrast, names, focus, tap targets and motion from the code, then review it (step 2).");
575
+ else if (!request.found.length)
576
+ lines.push(`Pilot audited a copy of the page${tested}: nothing it measures needs fixing. Review the code (step 2) and fix only what it finds.`);
577
+ else lines.push(`Pilot audited a copy of the page${tested}. Fix each of these:`, "", ...request.found.map((f) => `- ${f}`));
578
+ lines.push(
579
+ "",
580
+ "## How to do it",
581
+ "",
582
+ "1. **Fix what Pilot found**, the way this project does it (its utilities, its components, its tokens):",
583
+ " - **Contrast:** change the text color (or, when the text color is the brand's, the background) to the nearest shade that passes, in the project's palette or tokens, keeping the hue. Check it in both color schemes when the project has a dark mode. Say each color you changed, old \u2192 new, in your reply: the designer decides brand colors.",
584
+ ' - **Names:** an `aria-label` for controls with only an icon (and `aria-hidden="true"` on the icon); `alt` text for meaningful images, saying what they show or do, and `alt=""` for decorative ones; a `<label>` for each field (visually hidden with the project\'s `sr-only` utility when there\'s no visible one; a placeholder isn\'t a label). Never add visible text without asking.',
585
+ " - **Focus:** a visible `:focus-visible` style (`focus-visible:` in Tailwind) for everything that can be tabbed to, in the project's style (its ring or outline utilities); don't remove the browser's outline without a replacement.",
586
+ " - **Tap targets:** make the hit area at least 24\xD724px on phones **without changing how it looks or moving anything**: a transparent pseudo-element over it (`after:absolute after:-inset-2`, with `relative` on the control), never a bigger visible control or new spacing.",
587
+ " - **Motion:** keep animations for people who haven't asked for reduced motion (`motion-safe:`, or a `prefers-reduced-motion` media query) and stop or shorten them for those who have.",
588
+ '2. **Review the code for what Pilot can\'t measure**, in these elements only: clickable `div`s or `span`s that should be a `button` or a link (with the keyboard working); ARIA that\'s wrong or redundant (a `role` without its required states, `aria-hidden` on something focusable, ARIA where a native element would do); headings out of order; link text that says nothing out of context ("click here", "read more" without a visible or hidden label); state shown by color alone; form errors not tied to their field. Fix what\'s clearly wrong; ask about anything that would change how it looks.',
589
+ "3. **Don't change the layout.** Every element must keep its size and position at every width: no new padding, margins, borders, font sizes or line heights, no wrapping or reordering, nothing added that takes space. Colors, focus styles, and attributes are fine. When you report it done, Pilot audits it again and compares every element's box at a phone width, each breakpoint and a wide desktop with before: anything moved or resized comes back to you, with what's left of the audit, once.",
590
+ "4. **Your reply is the designer's comment**: tell them what you changed, a short line per fix, grouped (contrast, names, focus, tap targets, motion, code), with each color change old \u2192 new; then anything they should decide or check. No preamble.",
591
+ "",
592
+ several > 1 ? `Change only these elements and what they need. If they come from a shared component, fix it there, so every instance gets the fix, as long as its look doesn't change; ask before anything that would. ${firstChecked()}` : "Change only this element and what it needs. If it's a shared component, fix it there, so every instance gets the fix, as long as its look doesn't change; ask before anything that would.",
593
+ "",
594
+ PROJECT_CODE
595
+ );
596
+ return `${lines.join("\n")}
597
+ `;
598
+ }
534
599
  function formatResponsive(changeSet, request) {
535
600
  const { page, note } = changeSet;
536
601
  const { breakpoints } = request;
@@ -739,7 +804,9 @@ function targetLines(target) {
739
804
  }
740
805
  if (target.lookAlikes) {
741
806
  const of = target.lookAlikesOf ? `other instances of \`${target.lookAlikesOf}\`, the same part of each` : "the same part of other copies";
742
- out.push(`- Look-alikes: ${target.lookAlikes} more on the page (${of}), not in this job`);
807
+ out.push(
808
+ `- Look-alikes: ${target.lookAlikes} more on the page (${of}), not in this job. If the code that renders this one renders them too (a shared component, a loop), don't change it there, nor single this one out in it: leave it and ask (*Shared code, only some copies*, above)`
809
+ );
743
810
  }
744
811
  if (target.everyCopy) {
745
812
  out.push(
@@ -3709,7 +3776,7 @@ function locate(target, root, options = {}) {
3709
3776
  const all = found.list;
3710
3777
  const best = all[0];
3711
3778
  if (!best || !convincing(best)) return null;
3712
- const at = (c) => ({ file: c.file.rel, line: c.index + 1, snippet: snippetAt(c.file.lines, c.index) });
3779
+ const at = (c) => ({ file: c.file.rel, line: c.index + 1, snippet: snippetAt(c.file.lines, c.index), ...loopAround(c.file.lines, c.index) });
3713
3780
  const apart = (a, b) => a.file !== b.file || a.index !== b.index || a.column !== b.column;
3714
3781
  const elsewhere = all.filter((c) => apart(c, best));
3715
3782
  const second = elsewhere[0];
@@ -3737,7 +3804,7 @@ function candidates(target, root, options = {}) {
3737
3804
  if (file) {
3738
3805
  const own = scoreFile(n, file, from, from + 200).sort((a, b) => b.score - a.score)[0];
3739
3806
  const index = own && own.score >= 2 ? own.index : from;
3740
- return { known: { file: known, line: index + 1, snippet: snippetAt(file.lines, index) } };
3807
+ return { known: { file: known, line: index + 1, snippet: snippetAt(file.lines, index), ...loopAround(file.lines, index) } };
3741
3808
  }
3742
3809
  }
3743
3810
  if (!n.id && !n.texts.length && !n.attrs.length && !n.classes.length) return null;
@@ -3750,6 +3817,24 @@ function candidates(target, root, options = {}) {
3750
3817
  }
3751
3818
  return { list: list2.sort((a, b) => b.score - a.score) };
3752
3819
  }
3820
+ function loopAround(lines, index) {
3821
+ const indent = (l) => /^\s*/.exec(l)?.[0].length ?? 0;
3822
+ const found = (i) => ({ loop: { line: i + 1, text: cut(lines[i].trim()) } });
3823
+ if (LOOP.test(lines[index] ?? "")) return found(index);
3824
+ let level = indent(lines[index] ?? "");
3825
+ for (let i = index - 1; i >= Math.max(0, index - LOOP_LINES) && level > 0; i--) {
3826
+ const line = lines[i];
3827
+ if (!line.trim() || indent(line) >= level) continue;
3828
+ if (LOOP.test(line)) return found(i);
3829
+ level = indent(line);
3830
+ }
3831
+ return {};
3832
+ }
3833
+ var LOOP = /\bforeach\s*\(|@foreach\b|@for\b|\{[#{]\s*#?each\b|\{%-?\s*for\b|\bv-for=|\*ngFor=|\bx-for=|\.each\s+do\b|\.each\s*\{|\.(map|forEach|flatMap)\(|\bfor\s*\(|\bfor\s+(\w+|\(.*?\))\s+(in|of)\b|\{\{-?\s*range\b/;
3834
+ var LOOP_LINES = 40;
3835
+ function cut(text) {
3836
+ return text.length > 100 ? `${text.slice(0, 99)}\u2026` : text;
3837
+ }
3753
3838
  function snippetAt(lines, index) {
3754
3839
  return lines.slice(Math.max(0, index - 2), index + 3).map((l) => l.length > 160 ? `${l.slice(0, 159)}\u2026` : l).join("\n");
3755
3840
  }
@@ -3854,6 +3939,12 @@ function jobLocations(job, root) {
3854
3939
  }
3855
3940
  return found;
3856
3941
  }
3942
+ function loopNote(target, at) {
3943
+ if (!at.loop) return [];
3944
+ const where = at.loop.line === at.line ? "on this line" : `line ${at.loop.line}`;
3945
+ const ask = target.lookAlikes ? `: a change here reaches the ${target.lookAlikes} more like it on the page too, which this job leaves out, so ask before changing it here (*Shared code, only some copies*)` : ": a change here reaches every element it renders";
3946
+ return ["", ` In a loop (\`${at.loop.text}\`, ${where})${ask}.`];
3947
+ }
3857
3948
  function whereSection(job, root, located = jobLocations(job, root)) {
3858
3949
  if (!searchable(root)) return "";
3859
3950
  const found = [];
@@ -3874,7 +3965,7 @@ function whereSection(job, root, located = jobLocations(job, root)) {
3874
3965
  ` \`${at.also.file}:${at.also.line}\`:`,
3875
3966
  ...snippet(at.also)
3876
3967
  );
3877
- else found.push(`- \`${target.path}\` \u2192 \`${at.file}:${at.line}\`:`, ...snippet(at));
3968
+ else found.push(`- \`${target.path}\` \u2192 \`${at.file}:${at.line}\`:`, ...loopNote(target, at), ...snippet(at));
3878
3969
  }
3879
3970
  if (!found.length) return "";
3880
3971
  return [
@@ -4072,6 +4163,8 @@ function notesFor(job) {
4072
4163
  return "what changed at which widths, anything left for the designer";
4073
4164
  case "break-and-fix":
4074
4165
  return "what broke and how you fixed it, anything for the designer to decide";
4166
+ case "accessible":
4167
+ return "your reply in the designer's comment thread: what you changed, a short line per fix, grouped, each color change old \u2192 new; then anything for the designer to decide";
4075
4168
  case "props":
4076
4169
  return "one short sentence for the designer, like a chat message; the props go in `props`";
4077
4170
  default:
@@ -4096,10 +4189,11 @@ function taskFollowUp(job) {
4096
4189
  formatPrompt(job.changeSet)
4097
4190
  ].join("\n");
4098
4191
  const breakFix = request?.kind === "break-and-fix";
4192
+ const accessible = request?.kind === "accessible";
4099
4193
  const lines = [
4100
- breakFix ? "# Pilot: break and fix, follow-up" : "# Pilot: make responsive, follow-up",
4194
+ breakFix ? "# Pilot: break and fix, follow-up" : accessible ? "# Pilot: make accessible, follow-up" : "# Pilot: make responsive, follow-up",
4101
4195
  "",
4102
- breakFix ? `You stress-tested ${target} and reported it done, but Pilot's width check (the page with its usual content, measured at each width) finds these problems. If one comes from test content still in the code, remove it:` : `You made ${target} responsive, but Pilot's width check (the page measured at each width) still finds these problems:`,
4196
+ breakFix ? `You made ${target} hold up with odd content and reported it done, but Pilot's checks find these problems: its stress test (odd content put into a copy of the page) and its width check (the usual content, measured at each width, its look at the designer's width unchanged). If one comes from test content still in the code, remove it:` : accessible ? `You made ${target} accessible and reported it done, but Pilot's audit (and its comparison of every element's box at every width with before: the layout mustn't change) finds these problems:` : `You made ${target} responsive, but Pilot's width check (the page measured at each width) still finds these problems:`,
4103
4197
  "",
4104
4198
  ...(job.issues ?? []).map((i) => `- ${i}`),
4105
4199
  "",
package/cli/index.js CHANGED
@@ -16,14 +16,14 @@ import {
16
16
  shownPath,
17
17
  startRunner,
18
18
  startWithDevServer
19
- } from "./chunk-JKVQCFKU.js";
19
+ } from "./chunk-3S3IFMRI.js";
20
20
 
21
21
  // src/index.ts
22
22
  import { spawn } from "child_process";
23
23
  import { createInterface } from "readline/promises";
24
24
 
25
25
  // ../usepilot/GUIDE.md
26
- var GUIDE_default = "# Pilot guide\n\nHow to use Pilot, task by task. This guide is for **usepilot 0.19.0**: it ships with Pilot, so the copy in your project (`node_modules/usepilot/GUIDE.md`, or `npx usepilot guide`) always matches the version you have.\n\n**Agents:** when someone asks how to do something with Pilot, answer from this file. If it isn't here, Pilot doesn't do it yet: say so rather than guessing.\n\n## Contents\n\n- [Setting up](#setting-up)\n- [Opening, hiding and closing Pilot](#opening-hiding-and-closing-pilot)\n- [The toolbar](#the-toolbar)\n- [Selecting elements](#selecting-elements)\n- [Editing properties](#editing-properties)\n- [Variables and tokens](#variables-and-tokens)\n- [Screen widths (breakpoints)](#screen-widths-breakpoints)\n- [Hover, focus, dark mode and other states](#hover-focus-dark-mode-and-other-states)\n- [Editing text](#editing-text)\n- [Undo, discard and reloads](#undo-discard-and-reloads)\n- [Sending changes to your agent](#sending-changes-to-your-agent)\n- [Comments](#comments)\n- [Skills and Pilot's tasks (the / list)](#skills-and-pilots-tasks-the--list)\n- [Mentions (@)](#mentions-)\n- [When the agent asks you something](#when-the-agent-asks-you-something)\n- [Measuring distances](#measuring-distances)\n- [The DOM tree](#the-dom-tree)\n- [Keyboard shortcuts](#keyboard-shortcuts)\n- [When something's wrong](#when-somethings-wrong)\n- [What Pilot doesn't do (yet)](#what-pilot-doesnt-do-yet)\n- [Commands and options](#commands-and-options)\n\n## Setting up\n\n1. **Add Pilot to the project**: ask your agent, in the project, to *run `npx usepilot@latest init` and follow what it prints*. It installs Pilot as a dev dependency, loads it in development only (Pilot never ships to your live site), and sets it to start with your dev server. Pilot runs your agent's command-line tool for each job, not its chat window: if that isn't installed, your agent installs it, after asking you.\n2. **Restart your dev server** and open your app. Pilot opens on every page, and you can design right away. The dev server's terminal shows each job's progress (`[pilot]` lines).\n3. **Sign in once, when Pilot asks.** The first time you send something (Send, or a comment), Pilot opens your agent's sign-in page in your browser; what you sent waits, and goes once you've signed in. Already signed in to your agent's command-line tool? Nothing to do. To sign in in a terminal instead: `claude auth login`, `codex login` or `cursor-agent login`.\n\n**Your teammates:** the setup lives in the project's files, but Pilot starts with the dev server only on computers where it's set up (where `init` or `npx usepilot` ran). Teammates who haven't set it up see one line in their dev server's terminal and nothing else; to use Pilot, they ask their agent the same as in step 1 (or run `npx usepilot init` in the project once): it changes none of the project's files, and turns Pilot on for them.\n\n**A dev server Pilot can't start with?** Run `npx usepilot` in the project's folder, in a terminal beside it, and keep it running.\n\n**Choosing the agent:** Pilot uses the agent you set it up with. `npx usepilot init --agent codex` (or `claude`, `cursor`) switches, remembered for the project; then restart your dev server. (`npx usepilot --agent codex` does the same when you run Pilot that way.)\n\n**What the agent may do:** edit the project's files, and whatever you've already set it to always allow. Anything it would normally ask permission for is refused, since no one is there to answer; its reply says what was refused. For an MCP server or a website, the reply has a **Copy instructions** button: paste them into your agent's chat to allow it for this project. Commands are never allowed this way.\n\n**Updating:** run `npx usepilot@latest update` in the project's folder, then restart your dev server (and `npx usepilot`, if you run it).\n\n## Opening, hiding and closing Pilot\n\n- **Option+P** (Alt+P on Windows and Linux) opens Pilot on any page of your app. Pilot starting (with the dev server, or `npx usepilot`) also opens it in the app's open tabs.\n- **Hide:** Option+P again, or the toolbar's eye button, hides Pilot in this tab and keeps everything as it was (the selection, the dialog, what you typed). The page is fully yours meanwhile: hover, click and focus work normally, your edits stay on it. Press Option+P again to come back. Use it to try a hover or a click for real.\n- **Close:** the toolbar's last button closes Pilot in every tab of the site. Jobs keep running, and Option+P opens it again.\n- Pilot remembers per browser tab whether it's open, so reloads don't open or close it.\n\n## The toolbar\n\nFrom left to right:\n\n| Button | What it does |\n| --- | --- |\n| **Comment** (speech bubble, Option+C) | Click an element to ask the agent for a change in your own words. Its count is the threads waiting for you; clicking it while it's on goes to the next one. |\n| **Select** (cursor, Option+V) | Click an element to edit its properties. |\n| **Send** | Sends your changes not sent yet to the agent, as one job. Its count is how many it would send. |\n| **Discard** (brush) | Takes your unsent changes off the page, in one undo step. Sent ones stay. |\n| **Jobs** (a robot at a laptop) | Shows while jobs are running, with how many. Clicking it scrolls to the next job's elements. |\n| **Hide** (eye) | Hides Pilot in this tab, everything kept. |\n| **Close** | Closes Pilot on the whole site. |\n\nDrag the toolbar by the strip along its top edge; it stays where you put it.\n\n## Selecting elements\n\n- **Select** (Option+V), then **hover** an element to see its name and size, and **click** to select it. The click doesn't reach the page, so links and buttons don't fire.\n- **Several elements:** Shift+click adds an element or takes it out. A plain click selects just one again.\n- **Select similar** (a button above the selection's corner) adds every element like the selected one: in a React or Vue app, the same part of every instance of its component (every card's title, not every heading); elsewhere, the same part of every repeated copy.\n- **Show in DOM** (`< >` on the selection's corner) opens the [DOM tree](#the-dom-tree) on it.\n- **Esc** clears the selection; with nothing selected, Esc turns the tool off.\n- Grid containers show their grid lines and numbers; hovering an element stripes its padding, margin and gaps.\n- The selection survives your agent's reloads (hot reload and full reloads).\n\n## Editing properties\n\nSelect an element and its **property dialog** opens beside it.\n\n- **With nothing typed**, it lists every property the element sets, grouped (Content, for a `::before` or `::after`; Layout, Position, Appearance, Effects, Transform, Transition, Typography, Interactivity, SVG, Visibility).\n- **Search** by CSS name or Tailwind class: `p`, `pt`, `px`, `w`, `min-w`, `gap`, `display`, `items`, `aspect`, `bg`, `font`, `text`, `rounded`, `shadow`\u2026 Abbreviations work too (`mxw` is max-width). The search finds properties only: type values in the editor (`pt-4` in the search isn't a value).\n- **Tab** or **Enter** goes into the editor, **Enter** applies and goes back to the search for the next property: `pt` Tab `24` Enter.\n- **Values:** type a number (`12` is 12px), any CSS unit, a keyword (`auto`), math (`100% - 20px`), or a [variable](#variables-and-tokens). **\u2191/\u2193** step by 1, **Shift** by 10; the scroll wheel does the same on a field being edited. Some fields have a **drag handle** to scrub the value.\n- **Linked sides** work like Tailwind: `p` sets all four sides, `px` left and right, `py` top and bottom. The button beside padding, margin, inset, gap and radius switches between one value and each side.\n- **Several selected:** each change goes to all of them. A field whose value differs between them says **Mixed**; typing a value sets it on all. If they'd take it at different screen widths (one card has a rule for large screens, the other doesn't), each follows its own, and the footer says so: \"Widths differ: from 1024px on 1, Base on 1\".\n- **Clearing a field** (empty it and press Enter) means \"this element doesn't set this property\": Pilot takes the property off that element, not set to 0.\n- **Rich properties** (box shadow, filter, backdrop filter, mask image) show their values as chips: click one to edit it in a panel beside the dialog, **+** to add one.\n- **Transform:** one row for everything that moves, turns, sizes or slants the element, its chip saying what's set (\xD7 takes it all off). Click it and pick its **type**: **default** has translate, rotate, scale and skew (each one value, or each axis on its own with the button at the right of its row; scale takes a factor, `1.5`, or a percentage), **custom** takes it all as CSS functions in one value (`translate(-50%, -50%) rotate(5deg)`), **none** turns them all off.\n- **3D:** turning an element around X or Y, or moving it along Z, only looks 3D with a perspective on its parent; without one, the footer says \"Add perspective to the parent\". Select the parent and set its perspective.\n- **Transition:** each transition is a chip (`opacity 300ms`); click it to pick what animates (or **custom** for any property, **none** for no transition) and its own duration, easing and delay. **+** adds one. The **duration**, **easing** and **delay** rows under the chips apply to every transition at once, over the chips' own (like Tailwind's `duration-300 ease-out`); a chip's footer says when they do. A bare number is milliseconds. **Easing** shows its curve: drag its two handles to make your own (**Shift** snaps a handle to the top or bottom line), or pick **spring** and set its bounce (the duration is how long it feels; the footer says when it really settles), or **custom** for anything else, your project's easing variables included.\n- **Copy and paste:** right-click a property's name for **Copy CSS**, **Copy properties** and **Paste properties** (onto the selected elements).\n- **Fields show what your CSS declares**, not computed values; hover a field to see what math or a variable comes to.\n- The dialog stays where it opened while you edit; drag it by the strip along its top edge.\n\n## Variables and tokens\n\nUse your project's tokens anywhere a value goes:\n\n- **Type `--`** in a field to list the page's CSS variables that fit (spacing for a padding, colors for a color\u2026), filtered as you type, by name or value. It works inside math too: `calc(--sp`\u2026\n- **The variable button** on the right edge of a hovered field opens the same list to browse.\n- **\u2191/\u2193** on a field holding a token move along its scale (`--space-3` \u2192 `--space-4`); Shift+drag on the handle does the same.\n- Tokens kept in files rather than CSS (a W3C or Style Dictionary `tokens.json`, Sass `$variables`) are listed too while Pilot runs for the project. Tailwind v3 configs aren't read.\n\nThe agent writes the token the project's way, never a raw value.\n\n## Screen widths (breakpoints)\n\n**By default, an edit goes where your CSS already puts it at the current window width.** With `pt-2 md:pt-4 lg:pt-12` and the window between md and lg, padding-top shows and changes the `md:` value. Resize, and the field follows. Where nothing sets the property, the edit is the base value.\n\nTo choose the widths yourself, start the search with a **width modifier**:\n\n- `from-768 ` (with a space): from 768px up. `to-767 `: up to 767px. Both make a range: `from-768 to-1199 `.\n- `base `: the value with no media query (no breakpoint).\n- `all-widths `: one value at every width; your breakpoint rules for that property are removed.\n- After `from-` or `to-`, a list offers the window's width and the page's breakpoints; **Tab** takes the suggestion.\n- **The width ruler:** hover the very top of the window to see the window's width and the page's breakpoints. Click the width or a breakpoint to set `from` it; Shift+click for `to`.\n- While a property is in use, the ruler shows bars for where its values apply: green where your edit goes.\n\nModifiers stay set across selections until you remove them (the pill's \xD7, or Backspace at the start of the search). Click **default** in the pill row to go back to no modifiers without losing them. Edits for widths other than the window's don't show on the page until you resize into them.\n\n## Hover, focus, dark mode and other states\n\nStart the search with a state, Tailwind style, or type `/` to pick one:\n\n| Modifier | Edits |\n| --- | --- |\n| `hover:` `focus:` `focus-visible:` `active:` | the element in that state |\n| `dark:` `light:` | the page in dark (or light-only) mode, the way your project does dark mode |\n| `before:` `after:` `placeholder:` | the element's `::before`, `::after`, or a field's placeholder |\n\n- They combine with each other and with widths: `hover:from-768 `, `dark:hover:`.\n- **`before:` and `after:`** add `content: \"\"` with your first change when the element has no `::before` (`::after`) yet, so it's drawn; one Cmd+Z takes both back. Type its text in **content** (`Popular`, `\u2713`): Pilot adds the quotes.\n- **Pilot doesn't force the state on the page.** The fields show and edit what's set for that state; to see it, hide Pilot (Option+P) and hover or focus the element, or switch your system or site to dark mode.\n- **`/` at the start of the search** lists every modifier, and first the combinations this element already uses, with what each sets.\n\n## Any other condition, in words\n\nFor a condition no modifier lists, type `/` and describe it right there: \"the parent .card has focus inside\", \"it has data-open\", \"the peer input is invalid and not focused\". The menu offers **Create modifier**; press **Enter**. Your edits are then only for when it holds.\n\n- You won't see those edits live until the agent has written them: check **force state** beside the pill to see the selected elements as if the condition held, whatever the page is doing: your edits, and the values your code already has under that condition. Uncheck it for the page as it is.\n- When the job comes back, the agent gives the condition a short name, which the pill and the `/` menu show from then on, and your edits show live when the condition holds.\n- If the agent can't tell what you mean, it asks you in the thread. A modifier only stays in the menu once the agent has written it as CSS; if it doesn't say how it wrote it (even after Pilot asks again), the job's notes tell you, and the modifier isn't kept.\n- CSS works too, with `&` for the element (`.card:hover &`): that one shows live right away.\n- A comment you write while a condition is in the pill is about that condition only: the comment box says so.\n- The `/` menu also lists the conditions your code already has on the element (`group-hover/hero`, `.card:hover &`, `motion-reduce`), even when they don't hold right now. Pick one to see and edit its values.\n- Backspace at the start of the search removes it, like the other modifiers.\n\n## Editing text\n\nWith **Select** on, **double-click** a text to edit it in place. **Enter** is done, **Esc** cancels. In an element with other elements inside, you edit the run of text under the pointer. Text edits are sent and undone like any other change.\n\n## Undo, discard and reloads\n\n- **Cmd/Ctrl+Z** undoes, **Cmd/Ctrl+Shift+Z** (or Ctrl+Y) redoes. A whole drag is one step.\n- **Discard** takes every unsent change off the page, as one undo step.\n- Your changes survive reloads in the same browser tab, and stay previewed on the page until they're really in your code.\n\n## Sending changes to your agent\n\n- **Send** sends your unsent changes as one job. Keep designing: new changes go in the next job, and up to five jobs run at once.\n- While a job is on an element, it shows a **loader** on its corner; its tooltip says where the job stands. Hover the loader and click the \xD7 to **stop** the job.\n- A new change or comment on an element with a job on it **waits** (\"Queued\") and goes once that job is done, so two jobs never edit the same element at once.\n- **Pilot checks the page** when the agent is done. What landed stops being previewed. What didn't goes back to the agent once; after that, Pilot accepts what the code gives. To insist on a value, edit it again and Send.\n- The agent writes your changes in the project's own way (Tailwind classes, CSS modules, tokens\u2026), never as inline styles.\n\n## Comments\n\n- **Comment** (Option+C), click an element (Shift+click for several), and write what you want in your own words. **Enter** sends, **Shift+Enter** is a new line, **Esc** closes (your draft is kept).\n- **Attach** images, text files or PDFs with the attach button, or drop them on the box.\n- **Unsent edits go along:** edits you made on those elements show as a chip (\"2 changes\") and go with the comment; remove the chip to keep them for Send. Where the comment and an edit disagree, the comment wins.\n- Each element has a **thread**: the agent replies in it, and you can reply to follow up (\"a bit more\"): the agent remembers the thread.\n- A thread with a reply to read shows a **comment icon** on its element and counts on the Comment button.\n- **Edit manually**, under a reply that changed the element's look, switches to Select with those elements selected, to fine-tune what the agent chose.\n- **Mark as solved** (or Option+Enter) closes the thread.\n- **Stop** (beside send) cancels the job while the agent works.\n\n## Skills and Pilot's tasks (the / list)\n\nType `/` at the start of a word in the comment box:\n\n- **Your agent's skills**, the ones its own `/` shows (the project's, then yours). A bare `/` lists the first few; type to see every match (`/emil`). Pick one and the agent uses it for this comment.\n- **Props**, on a component's instance: lists the props that change how it looks. Reply with a line like `tone: dark` to change one.\n- **Make responsive**: makes the element work at every screen width. Pilot checks the result at a phone width, each breakpoint and a wide desktop, and sends problems back to the agent once.\n\n## Mentions (@)\n\nType `@` in a comment to name things instead of describing them: the page's **tokens** and **breakpoints** (`--color-brand`, `@768px`), its **components** (`@ProductCard`, also ones not on this page while Pilot runs for the project), and its **named elements** (`@section#features`). The agent gets exactly what you picked, and where it is in the code.\n\n## When the agent asks you something\n\nWhen part of a job needs your decision, the agent asks in a thread instead of guessing, and does the rest. It leaves that part unchanged until you answer, and says so (\"Not changed yet: \u2026\"). The most common question: you changed one card, or commented on it, and the cards share one component. A question about several elements gets a thread of its own. Answer with a button:\n\n- **All of them** changes the component itself.\n- **Only this** changes this one instance.\n- **New variant** adds a named option to the component and uses it here.\n\nOr write your own answer (only the buttons' exact words are read as \"every copy\" for the loaders). Selecting every instance of a component (Select similar) already says \"all of them\", so the agent changes the component without asking.\n\nOnce you answer, the loaders show where the agent works now: on the element it asked about, and with **All of them** on every instance like it on the page. The rest of the job's elements are done.\n\n## Measuring distances\n\nWith an element selected, **hold Alt (Option)** and move the pointer: Pilot shows the distances from the selection to the element under the pointer (or to its parent), in red. Release Alt to go back.\n\n## The DOM tree\n\n**Alt+D** (or Show in DOM) opens a tree of the page's elements, starting at `<html>` and `<body>`, to select what's hard to click: overlapping, zero-size or hidden elements, or the page itself (its background, colors and fonts). Click a row to select it, **\u2191/\u2193** to move, **\u2192/\u2190** to open and close. Cmd/Ctrl+click adds a row, Shift+click selects a range. In a React or Vue app, **Components** at the top switches to the tree of component instances. `::before` and `::after` are listed too, not selectable: hover one to see its box on the page.\n\n## Keyboard shortcuts\n\n| Keys | Does |\n| --- | --- |\n| **Option+P** (Alt+P) | Open Pilot; once open, hide and show it |\n| **Option+V** / **Option+C** | Select tool / Comment tool |\n| **Alt+D** | DOM tree |\n| hold **Alt** | Measure distances |\n| **Esc** | One step back: editor \u2192 search \u2192 clear search \u2192 close the dialog \u2192 turn the tool off |\n| **Cmd/Ctrl+Z**, **Cmd/Ctrl+Shift+Z** | Undo, redo |\n| **Tab** / **Enter** in the search | Into the editor |\n| **Enter** in an editor | Apply, back to the search |\n| **\u2191/\u2193**, **Shift+\u2191/\u2193** | Step a value by 1, by 10 (a token: along its scale) |\n| **Tab** / **Shift+Tab** in an editor | Next / previous field |\n| `/` at the start of the search | Modifiers (widths, states) |\n| **Backspace** at the start of the search | Remove the last modifier |\n| double-click a text | Edit it in place |\n| **Shift+click** | Add to the selection |\n| **Enter** / **Option+Enter** in a comment | Send / mark as solved |\n\nThe shortcuts with Option work in Pilot's own fields too, but not while you're typing in the page's fields.\n\n## When something's wrong\n\nPilot says when it's stuck: a red **!** on a toolbar button (hover it for what to do), a red warning on an element's corner, or a red reply in a thread.\n\n- **The toolbar doesn't appear.** Pilot only loads in development, in the browser. Press Option+P. If nothing happens, ask your agent to check where `usepilot/auto` is imported (Option+P is ignored while you type in the page's fields).\n- **\"Pilot isn't running for this site\"**: restart your dev server, which starts Pilot (its terminal says why, if it doesn't). Without that setup, run `npx usepilot` in the project's folder and keep it running. Its terminal says why it skipped the page (another project's page, or a loader set up before 0.15: run `npx usepilot@latest update`).\n- **\"Sign in to \u2026\"**: your agent isn't signed in. Click Send to open its sign-in page; what you sent goes once you've signed in. If the page doesn't open, or the sign-in doesn't finish, sign in in a terminal (see [Setting up](#setting-up)).\n- **Your agent's tool isn't installed**: ask your agent to install its command-line tool (or run the command Pilot shows). What you sent waits, and goes once it's ready.\n- **\"\u2026 couldn't do this job\"**: the dev server's terminal (or the one running `npx usepilot`) shows what the agent said.\n- **\"\u2026 needs an update\"**: your agent's command-line tool is too old for Pilot; run the command it gives.\n- **\"\u2026 has gone quiet\"**: no sign of work for 2 minutes. Click to stop the job, then send again.\n- **A reply says something was refused**: the agent wasn't allowed to do it in its settings. See *What the agent may do* in [Setting up](#setting-up).\n- **A change shows on the page but not in the code yet**: it stays previewed until the agent's job lands. A change for another screen width or a state can't be checked on the page, so Pilot takes the agent's word for it.\n\n## What Pilot doesn't do (yet)\n\n- It never edits your code itself, and never runs on your live site: the agent writes the code.\n- No adding, moving or deleting elements from Pilot: ask in a comment.\n- No forcing hover or focus on the page while editing those states (hide Pilot to try them).\n- No values typed in the search (`pt-4` + Enter): search for the property, then type the value.\n- No Copy prompt: everything goes through Pilot running for the project (with the dev server, or `npx usepilot`).\n- Components are read in React and Vue only (not Svelte or Angular). Tailwind v3 config tokens aren't read.\n- Props work on one component instance at a time.\n\n## Commands and options\n\n| Command | Does |\n| --- | --- |\n| `usepilot dev -- <command>` | Run your dev server with Pilot in it, in a `package.json` script (`\"dev\": \"usepilot dev -- vite\"`); Vite and Next.js use their own way (`usepilot/vite`, `usepilot/next`), set up by `init` |\n| `npx usepilot` | Run Pilot for this project, beside a dev server Pilot doesn't start with. `--agent claude\\|codex\\|cursor` picks the agent, `--url <address>` gives the app's address when Pilot can't tell |\n| `npx usepilot@latest init` | Set Pilot up in a project (ask your agent to run it) |\n| `npx usepilot@latest update` | Update Pilot in this project |\n| `npx usepilot guide` | Print this guide |\n| `npx usepilot help` | List the commands |\n\nOptions, where your app loads Pilot:\n\n```ts\nimport { mountPilot } from \"usepilot\";\n\nmountPilot({\n shortcut: \"alt+p\", // or \"ctrl+shift+e\", or false\n launch: false, // true: open on load\n nameAttributes: [\"data-block\"], // attributes your project names elements with\n project: \"my-app\", // your package.json's name: npx usepilot runs for its own project's pages\n});\n```\n";
26
+ var GUIDE_default = "# Pilot guide\n\nHow to use Pilot, task by task. This guide is for **usepilot 0.21.0**: it ships with Pilot, so the copy in your project (`node_modules/usepilot/GUIDE.md`, or `npx usepilot guide`) always matches the version you have.\n\n**Agents:** when someone asks how to do something with Pilot, answer from this file. If it isn't here, Pilot doesn't do it yet: say so rather than guessing.\n\n## Contents\n\n- [Setting up](#setting-up)\n- [Opening, hiding and closing Pilot](#opening-hiding-and-closing-pilot)\n- [The toolbar](#the-toolbar)\n- [Selecting elements](#selecting-elements)\n- [Editing properties](#editing-properties)\n- [Variables and tokens](#variables-and-tokens)\n- [Screen widths (breakpoints)](#screen-widths-breakpoints)\n- [Hover, focus, dark mode and other states](#hover-focus-dark-mode-and-other-states)\n- [Editing text](#editing-text)\n- [Undo, discard and reloads](#undo-discard-and-reloads)\n- [Sending changes to your agent](#sending-changes-to-your-agent)\n- [Comments](#comments)\n- [Skills and Pilot's tasks (the / list)](#skills-and-pilots-tasks-the--list)\n- [Mentions (@)](#mentions-)\n- [When the agent asks you something](#when-the-agent-asks-you-something)\n- [Measuring distances](#measuring-distances)\n- [The DOM tree](#the-dom-tree)\n- [Keyboard shortcuts](#keyboard-shortcuts)\n- [When something's wrong](#when-somethings-wrong)\n- [What Pilot doesn't do (yet)](#what-pilot-doesnt-do-yet)\n- [Commands and options](#commands-and-options)\n\n## Setting up\n\n1. **Add Pilot to the project**: ask your agent, in the project, to *run `npx usepilot@latest init` and follow what it prints*. It installs Pilot as a dev dependency, loads it in development only (Pilot never ships to your live site), and sets it to start with your dev server. Pilot runs your agent's command-line tool for each job, not its chat window: if that isn't installed, your agent installs it, after asking you.\n2. **Restart your dev server** and open your app. Pilot opens on every page, and you can design right away. The dev server's terminal shows each job's progress (`[pilot]` lines).\n3. **Sign in once, when Pilot asks.** The first time you send something (Send, or a comment), Pilot opens your agent's sign-in page in your browser; what you sent waits, and goes once you've signed in. Already signed in to your agent's command-line tool? Nothing to do. To sign in in a terminal instead: `claude auth login`, `codex login` or `cursor-agent login`.\n\n**Your teammates:** the setup lives in the project's files, but Pilot starts with the dev server only on computers where it's set up (where `init` or `npx usepilot` ran). Teammates who haven't set it up see one line in their dev server's terminal and nothing else; to use Pilot, they ask their agent the same as in step 1 (or run `npx usepilot init` in the project once): it changes none of the project's files, and turns Pilot on for them.\n\n**A dev server Pilot can't start with?** Run `npx usepilot` in the project's folder, in a terminal beside it, and keep it running.\n\n**Choosing the agent:** Pilot uses the agent you set it up with. `npx usepilot init --agent codex` (or `claude`, `cursor`) switches, remembered for the project; then restart your dev server. (`npx usepilot --agent codex` does the same when you run Pilot that way.)\n\n**What the agent may do:** edit the project's files, and whatever you've already set it to always allow. Anything it would normally ask permission for is refused, since no one is there to answer; its reply says what was refused. For an MCP server or a website, the reply has a **Copy instructions** button: paste them into your agent's chat to allow it for this project. Commands are never allowed this way.\n\n**Updating:** run `npx usepilot@latest update` in the project's folder, then restart your dev server (and `npx usepilot`, if you run it).\n\n## Opening, hiding and closing Pilot\n\n- **Option+P** (Alt+P on Windows and Linux) opens Pilot on any page of your app. Pilot starting (with the dev server, or `npx usepilot`) also opens it in the app's open tabs.\n- **Hide:** Option+P again, or the toolbar's eye button, hides Pilot in this tab and keeps everything as it was (the selection, the dialog, what you typed). The page is fully yours meanwhile: hover, click and focus work normally, your edits stay on it. Press Option+P again to come back. Use it to try a hover or a click for real.\n- **Close:** the toolbar's last button closes Pilot in every tab of the site. Jobs keep running, and Option+P opens it again.\n- Pilot remembers per browser tab whether it's open, so reloads don't open or close it.\n\n## The toolbar\n\nFrom left to right:\n\n| Button | What it does |\n| --- | --- |\n| **Comment** (speech bubble, Option+C) | Click an element to ask the agent for a change in your own words. Its count is the threads waiting for you; clicking it while it's on goes to the next one. |\n| **Select** (cursor, Option+V) | Click an element to edit its properties. |\n| **Send** | Sends your changes not sent yet to the agent, as one job. Its count is how many it would send. |\n| **Discard** (brush) | Takes your unsent changes off the page, in one undo step. Sent ones stay. |\n| **Jobs** (a robot at a laptop) | Shows while jobs are running, with how many. Clicking it scrolls to the next job's elements. |\n| **Hide** (eye) | Hides Pilot in this tab, everything kept. |\n| **Close** | Closes Pilot on the whole site. |\n\nDrag the toolbar by the strip along its top edge; it stays where you put it.\n\n## Selecting elements\n\n- **Select** (Option+V), then **hover** an element to see its name and size, and **click** to select it. The click doesn't reach the page, so links and buttons don't fire.\n- **Several elements:** Shift+click adds an element or takes it out. A plain click selects just one again.\n- **Select similar** (a button above the selection's corner) adds every element like the selected one: in a React or Vue app, the same part of every instance of its component (every card's title, not every heading); elsewhere, the same part of every repeated copy.\n- **Show in DOM** (`< >` on the selection's corner) opens the [DOM tree](#the-dom-tree) on it.\n- **Esc** clears the selection; with nothing selected, Esc turns the tool off.\n- Grid containers show their grid lines and numbers; hovering an element stripes its padding, margin and gaps.\n- The selection survives your agent's reloads (hot reload and full reloads).\n\n## Editing properties\n\nSelect an element and its **property dialog** opens beside it.\n\n- **With nothing typed**, it lists every property the element sets, grouped (Content, for a `::before` or `::after`; Layout, Position, Appearance, Effects, Transform, Transition, Typography, Interactivity, SVG, Visibility).\n- **Search** by CSS name or Tailwind class: `p`, `pt`, `px`, `w`, `min-w`, `gap`, `display`, `items`, `aspect`, `bg`, `font`, `text`, `rounded`, `shadow`\u2026 Abbreviations work too (`mxw` is max-width). The search finds properties only: type values in the editor (`pt-4` in the search isn't a value).\n- **Tab** or **Enter** goes into the editor, **Enter** applies and goes back to the search for the next property: `pt` Tab `24` Enter.\n- **Values:** type a number (`12` is 12px), any CSS unit, a keyword (`auto`), math (`100% - 20px`), or a [variable](#variables-and-tokens). **\u2191/\u2193** step by 1, **Shift** by 10; the scroll wheel does the same on a field being edited. Some fields have a **drag handle** to scrub the value.\n- **Linked sides** work like Tailwind: `p` sets all four sides, `px` left and right, `py` top and bottom. The button beside padding, margin, inset, gap and radius switches between one value and each side.\n- **Several selected:** each change goes to all of them. A field whose value differs between them says **Mixed**; typing a value sets it on all. If they'd take it at different screen widths (one card has a rule for large screens, the other doesn't), each follows its own, and the footer says so: \"Widths differ: from 1024px on 1, Base on 1\".\n- **Clearing a field** (empty it and press Enter) means \"this element doesn't set this property\": Pilot takes the property off that element, not set to 0.\n- **Rich properties** (box shadow, filter, backdrop filter, mask image) show their values as chips: click one to edit it in a panel beside the dialog, **+** to add one.\n- **Transform:** one row for everything that moves, turns, sizes or slants the element, its chip saying what's set (\xD7 takes it all off). Click it and pick its **type**: **default** has translate, rotate, scale and skew (each one value, or each axis on its own with the button at the right of its row; scale takes a factor, `1.5`, or a percentage), **custom** takes it all as CSS functions in one value (`translate(-50%, -50%) rotate(5deg)`), **none** turns them all off.\n- **3D:** turning an element around X or Y, or moving it along Z, only looks 3D with a perspective on its parent; without one, the footer says \"Add perspective to the parent\". Select the parent and set its perspective.\n- **Transition:** each transition is a chip (`opacity 300ms`); click it to pick what animates (or **custom** for any property, **none** for no transition) and its own duration, easing and delay. **+** adds one. The **duration**, **easing** and **delay** rows under the chips apply to every transition at once, over the chips' own (like Tailwind's `duration-300 ease-out`); a chip's footer says when they do. A bare number is milliseconds. **Easing** shows its curve: drag its two handles to make your own (**Shift** snaps a handle to the top or bottom line), or pick **spring** and set its bounce (the duration is how long it feels; the footer says when it really settles), or **custom** for anything else, your project's easing variables included.\n- **Copy and paste:** right-click a property's name for **Copy CSS**, **Copy properties** and **Paste properties** (onto the selected elements).\n- **Fields show what your CSS declares**, not computed values; hover a field to see what math or a variable comes to.\n- The dialog stays where it opened while you edit; drag it by the strip along its top edge.\n\n## Variables and tokens\n\nUse your project's tokens anywhere a value goes:\n\n- **Type `--`** in a field to list the page's CSS variables that fit (spacing for a padding, colors for a color\u2026), filtered as you type, by name or value. It works inside math too: `calc(--sp`\u2026\n- **The variable button** on the right edge of a hovered field opens the same list to browse.\n- **\u2191/\u2193** on a field holding a token move along its scale (`--space-3` \u2192 `--space-4`); Shift+drag on the handle does the same.\n- Tokens kept in files rather than CSS (a W3C or Style Dictionary `tokens.json`, Sass `$variables`) are listed too while Pilot runs for the project. Tailwind v3 configs aren't read.\n\nThe agent writes the token the project's way, never a raw value.\n\n## Screen widths (breakpoints)\n\n**By default, an edit goes where your CSS already puts it at the current window width.** With `pt-2 md:pt-4 lg:pt-12` and the window between md and lg, padding-top shows and changes the `md:` value. Resize, and the field follows. Where nothing sets the property, the edit is the base value.\n\nTo choose the widths yourself, start the search with a **width modifier**:\n\n- `from-768 ` (with a space): from 768px up. `to-767 `: up to 767px. Both make a range: `from-768 to-1199 `.\n- `base `: the value with no media query (no breakpoint).\n- `all-widths `: one value at every width; your breakpoint rules for that property are removed.\n- After `from-` or `to-`, a list offers the window's width and the page's breakpoints; **Tab** takes the suggestion.\n- **The width ruler:** hover the very top of the window to see the window's width and the page's breakpoints. Click the width or a breakpoint to set `from` it; Shift+click for `to`.\n- While a property is in use, the ruler shows bars for where its values apply: green where your edit goes.\n\nModifiers stay set across selections until you remove them (the pill's \xD7, or Backspace at the start of the search). Click **default** in the pill row to go back to no modifiers without losing them. Edits for widths other than the window's don't show on the page until you resize into them.\n\n## Hover, focus, dark mode and other states\n\nStart the search with a state, Tailwind style, or type `/` to pick one:\n\n| Modifier | Edits |\n| --- | --- |\n| `hover:` `focus:` `focus-visible:` `active:` | the element in that state |\n| `dark:` `light:` | the page in dark (or light-only) mode, the way your project does dark mode |\n| `before:` `after:` `placeholder:` | the element's `::before`, `::after`, or a field's placeholder |\n\n- They combine with each other and with widths: `hover:from-768 `, `dark:hover:`.\n- **`before:` and `after:`** add `content: \"\"` with your first change when the element has no `::before` (`::after`) yet, so it's drawn; one Cmd+Z takes both back. Type its text in **content** (`Popular`, `\u2713`): Pilot adds the quotes.\n- **Pilot doesn't force the state on the page.** The fields show and edit what's set for that state; to see it, hide Pilot (Option+P) and hover or focus the element, or switch your system or site to dark mode.\n- **`/` at the start of the search** lists every modifier, and first the combinations this element already uses, with what each sets.\n\n## Any other condition, in words\n\nFor a condition no modifier lists, type `/` and describe it right there: \"the parent .card has focus inside\", \"it has data-open\", \"the peer input is invalid and not focused\". The menu offers **Create modifier**; press **Enter**. Your edits are then only for when it holds.\n\n- You won't see those edits live until the agent has written them: check **force state** beside the pill to see the selected elements as if the condition held, whatever the page is doing: your edits, and the values your code already has under that condition. Uncheck it for the page as it is.\n- When the job comes back, the agent gives the condition a short name, which the pill and the `/` menu show from then on, and your edits show live when the condition holds.\n- If the agent can't tell what you mean, it asks you in the thread. A modifier only stays in the menu once the agent has written it as CSS; if it doesn't say how it wrote it (even after Pilot asks again), the job's notes tell you, and the modifier isn't kept.\n- CSS works too, with `&` for the element (`.card:hover &`): that one shows live right away.\n- A comment you write while a condition is in the pill is about that condition only: the comment box says so.\n- The `/` menu also lists the conditions your code already has on the element (`group-hover/hero`, `.card:hover &`, `motion-reduce`), even when they don't hold right now. Pick one to see and edit its values.\n- Backspace at the start of the search removes it, like the other modifiers.\n\n## Editing text\n\nWith **Select** on, **double-click** a text to edit it in place. **Enter** is done, **Esc** cancels. In an element with other elements inside, you edit the run of text under the pointer. Text edits are sent and undone like any other change.\n\n## Undo, discard and reloads\n\n- **Cmd/Ctrl+Z** undoes, **Cmd/Ctrl+Shift+Z** (or Ctrl+Y) redoes. A whole drag is one step.\n- **Discard** takes every unsent change off the page, as one undo step.\n- Your changes survive reloads in the same browser tab, and stay previewed on the page until they're really in your code.\n\n## Sending changes to your agent\n\n- **Send** sends your unsent changes as one job. Keep designing: new changes go in the next job, and up to five jobs run at once.\n- While a job is on an element, it shows a **loader** on its corner; its tooltip says where the job stands. Hover the loader and click the \xD7 to **stop** the job.\n- A new change or comment on an element with a job on it **waits** (\"Queued\") and goes once that job is done, so two jobs never edit the same element at once.\n- **Pilot checks the page** when the agent is done. What landed stops being previewed. What didn't goes back to the agent once; after that, Pilot accepts what the code gives. To insist on a value, edit it again and Send.\n- The agent writes your changes in the project's own way (Tailwind classes, CSS modules, tokens\u2026), never as inline styles.\n\n## Comments\n\n- **Comment** (Option+C), click an element (Shift+click for several), and write what you want in your own words. **Enter** sends, **Shift+Enter** is a new line, **Esc** closes (your draft is kept, and comes back as you left it, an open `@` or `/` list included).\n- **Attach** images, text files or PDFs with the attach button, or drop them on the box.\n- **Unsent edits go along:** edits you made on those elements show as a chip (\"2 changes\") and go with the comment; remove the chip to keep them for Send. Where the comment and an edit disagree, the comment wins. With a skill or `pilot-make-responsive` picked, the edits go first, then the skill works on the result: both chips show, the edits' first.\n- Each element has a **thread**: the agent replies in it, and you can reply to follow up (\"a bit more\"): the agent remembers the thread.\n- A thread with a reply to read shows a **comment icon** on its element and counts on the Comment button.\n- **Edit manually**, under a reply that changed the element's look, switches to Select with those elements selected, to fine-tune what the agent chose. A reply with **Copy instructions** doesn't have it: allow what was refused and ask again first.\n- **Mark as solved** (or Option+Enter) closes the thread.\n- **Stop** (beside send) cancels the job while the agent works.\n\n## Skills and Pilot's tasks (the / list)\n\nType `/` at the start of a word in the comment box:\n\n- **Your agent's skills**, the ones its own `/` shows (the project's, then yours). A bare `/` lists the first few; type to see every match (`/emil`). Pick one and the agent uses it for this comment.\n- **Props**, on a component's instance: lists the props that change how it looks. Reply with a line like `tone: dark` to change one.\n- **pilot-make-responsive** (`/responsive` finds it too): makes the element work at every screen width. Pilot checks the result at a phone width, each breakpoint and a wide desktop, and sends problems back to the agent once.\n- **pilot-break-and-fix**: makes the element hold up with real-world content. Pilot first puts odd content into a copy of the page (very long text, long words like URLs, many more items, images that fail to load or come in odd shapes) and measures what breaks at each width; the agent fixes exactly that, without changing how it looks with its usual content; Pilot tests again after.\n- **pilot-make-accessible**: fixes what Pilot's audit finds: text contrast (in light and dark mode), names for icon buttons, images and fields, a visible focus style, tap targets on phones, and animations for people who prefer reduced motion. The agent also reviews the code for what can't be measured, and changes nothing of your layout: Pilot checks every element's size and position at every width before and after. Its reply lists what it changed.\n\nPilot's three always end their reply with what Pilot measured itself (\"**Pilot checked it:** 4 problems before, 0 now\"), and send what's left back to the agent once.\n\n## Mentions (@)\n\nType `@` in a comment to name things instead of describing them: the page's **tokens** and **breakpoints** (`--color-brand`, `@768px`), its **components** (`@ProductCard`, also ones not on this page while Pilot runs for the project), and its **named elements** (`@section#features`). The agent gets exactly what you picked, and where it is in the code.\n\nThe list shows a few of each at first; type to narrow it, and it shows every match. Type a kind of token to list all of that kind, whatever their names: `@color` for every color, `@font` for every font, also `@shadow`, `@easing` and `@duration`.\n\n## When the agent asks you something\n\nWhen part of a job needs your decision, the agent asks in a thread instead of guessing, and does the rest. It leaves that part unchanged until you answer, and says so (\"Not changed yet: \u2026\"). The most common question: you changed one card, or commented on it, and the cards share one component (or one loop in the code, on a site without components). A question about several elements gets a thread of its own. Answer with a button:\n\n- **All of them** changes the component itself.\n- **Only this** changes this one instance.\n- **New variant** adds a named option to the component and uses it here.\n\nOr write your own answer (only the buttons' exact words are read as \"every copy\" for the loaders). Selecting every instance of a component (Select similar) already says \"all of them\", so the agent changes the component without asking.\n\nOnce you answer, the loaders show where the agent works now: on the element it asked about, and with **All of them** on every instance like it on the page. The rest of the job's elements are done.\n\n## Measuring distances\n\nWith an element selected, **hold Alt (Option)** and move the pointer: Pilot shows the distances from the selection to the element under the pointer (or to its parent), in red. Release Alt to go back.\n\n## The DOM tree\n\n**Alt+D** (or Show in DOM) opens a tree of the page's elements, starting at `<html>` and `<body>`, to select what's hard to click: overlapping, zero-size or hidden elements, or the page itself (its background, colors and fonts). Click a row to select it, **\u2191/\u2193** to move, **\u2192/\u2190** to open and close. Cmd/Ctrl+click adds a row, Shift+click selects a range. In a React or Vue app, **Components** at the top switches to the tree of component instances. `::before` and `::after` are listed too, not selectable: hover one to see its box on the page.\n\n## Keyboard shortcuts\n\n| Keys | Does |\n| --- | --- |\n| **Option+P** (Alt+P) | Open Pilot; once open, hide and show it |\n| **Option+V** / **Option+C** | Select tool / Comment tool |\n| **Alt+D** | DOM tree |\n| hold **Alt** | Measure distances |\n| **Esc** | One step back: editor \u2192 search \u2192 clear search \u2192 close the dialog \u2192 turn the tool off |\n| **Cmd/Ctrl+Z**, **Cmd/Ctrl+Shift+Z** | Undo, redo |\n| **Tab** / **Enter** in the search | Into the editor |\n| **Enter** in an editor | Apply, back to the search |\n| **\u2191/\u2193**, **Shift+\u2191/\u2193** | Step a value by 1, by 10 (a token: along its scale) |\n| **Tab** / **Shift+Tab** in an editor | Next / previous field |\n| `/` at the start of the search | Modifiers (widths, states) |\n| **Backspace** at the start of the search | Remove the last modifier |\n| double-click a text | Edit it in place |\n| **Shift+click** | Add to the selection |\n| **Enter** / **Option+Enter** in a comment | Send / mark as solved |\n\nThe shortcuts with Option work in Pilot's own fields too, but not while you're typing in the page's fields.\n\n## When something's wrong\n\nPilot says when it's stuck: a red **!** on a toolbar button (hover it for what to do), a red warning on an element's corner, or a red reply in a thread.\n\n- **The toolbar doesn't appear.** Pilot only loads in development, in the browser. Press Option+P. If nothing happens, ask your agent to check where `usepilot/auto` is imported (Option+P is ignored while you type in the page's fields).\n- **\"Pilot isn't running for this site\"**: restart your dev server, which starts Pilot (its terminal says why, if it doesn't). Without that setup, run `npx usepilot` in the project's folder and keep it running. Its terminal says why it skipped the page (another project's page, or a loader set up before 0.15: run `npx usepilot@latest update`).\n- **\"Sign in to \u2026\"**: your agent isn't signed in. Click Send to open its sign-in page; what you sent goes once you've signed in. If the page doesn't open, or the sign-in doesn't finish, sign in in a terminal (see [Setting up](#setting-up)).\n- **Your agent's tool isn't installed**: ask your agent to install its command-line tool (or run the command Pilot shows). What you sent waits, and goes once it's ready.\n- **\"\u2026 couldn't do this job\"**: the dev server's terminal (or the one running `npx usepilot`) shows what the agent said.\n- **\"\u2026 needs an update\"**: your agent's command-line tool is too old for Pilot; run the command it gives.\n- **\"\u2026 has gone quiet\"**: no sign of work for 2 minutes. Click to stop the job, then send again.\n- **A reply says something was refused**: the agent wasn't allowed to do it in its settings. See *What the agent may do* in [Setting up](#setting-up).\n- **A change shows on the page but not in the code yet**: it stays previewed until the agent's job lands. A change for another screen width or a state can't be checked on the page, so Pilot takes the agent's word for it.\n\n## What Pilot doesn't do (yet)\n\n- It never edits your code itself, and never runs on your live site: the agent writes the code.\n- No adding, moving or deleting elements from Pilot: ask in a comment.\n- No forcing hover or focus on the page while editing those states (hide Pilot to try them).\n- No values typed in the search (`pt-4` + Enter): search for the property, then type the value.\n- No Copy prompt: everything goes through Pilot running for the project (with the dev server, or `npx usepilot`).\n- Components are read in React and Vue only (not Svelte or Angular). Tailwind v3 config tokens aren't read.\n- Props work on one component instance at a time.\n\n## Commands and options\n\n| Command | Does |\n| --- | --- |\n| `usepilot dev -- <command>` | Run your dev server with Pilot in it, in a `package.json` script (`\"dev\": \"usepilot dev -- vite\"`); Vite and Next.js use their own way (`usepilot/vite`, `usepilot/next`), set up by `init` |\n| `npx usepilot` | Run Pilot for this project, beside a dev server Pilot doesn't start with. `--agent claude\\|codex\\|cursor` picks the agent, `--url <address>` gives the app's address when Pilot can't tell |\n| `npx usepilot@latest init` | Set Pilot up in a project (ask your agent to run it) |\n| `npx usepilot@latest update` | Update Pilot in this project |\n| `npx usepilot guide` | Print this guide |\n| `npx usepilot help` | List the commands |\n\nOptions, where your app loads Pilot:\n\n```ts\nimport { mountPilot } from \"usepilot\";\n\nmountPilot({\n shortcut: \"alt+p\", // or \"ctrl+shift+e\", or false\n launch: false, // true: open on load\n nameAttributes: [\"data-block\"], // attributes your project names elements with\n project: \"my-app\", // your package.json's name: npx usepilot runs for its own project's pages\n});\n```\n";
27
27
 
28
28
  // src/init.ts
29
29
  import { spawnSync } from "child_process";
@@ -125,7 +125,7 @@ function readJson(file) {
125
125
  }
126
126
 
127
127
  // src/version.ts
128
- var VERSION = "0.19.0";
128
+ var VERSION = "0.21.0";
129
129
  function olderThan(a, b) {
130
130
  const parts = (v) => v.replace(/^[^\d]*/, "").split(/[.-]/).slice(0, 3).map((n) => Number.parseInt(n, 10) || 0);
131
131
  const [x, y] = [parts(a), parts(b)];
package/cli/next.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __pilotRequire } from "node:module"; const require = __pilotRequire(import.meta.url);
2
2
  import {
3
3
  startWithDevServer
4
- } from "./chunk-JKVQCFKU.js";
4
+ } from "./chunk-3S3IFMRI.js";
5
5
 
6
6
  // src/next.ts
7
7
  var DEV_PHASE = "phase-development-server";
package/cli/vite.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __pilotRequire } from "node:module"; const require = __pilotRequire(import.meta.url);
2
2
  import {
3
3
  startWithDevServer
4
- } from "./chunk-JKVQCFKU.js";
4
+ } from "./chunk-3S3IFMRI.js";
5
5
 
6
6
  // src/vite.ts
7
7
  function pilot() {