usepilot 0.20.0 → 0.22.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.20.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.22.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
 
@@ -85,16 +85,19 @@ Select an element and its **property dialog** opens beside it.
85
85
  - **Search** by CSS name or Tailwind class: `p`, `pt`, `px`, `w`, `min-w`, `gap`, `display`, `items`, `aspect`, `bg`, `font`, `text`, `rounded`, `shadow`… 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).
86
86
  - **Tab** or **Enter** goes into the editor, **Enter** applies and goes back to the search for the next property: `pt` Tab `24` Enter.
87
87
  - **Values:** type a number (`12` is 12px), any CSS unit, a keyword (`auto`), math (`100% - 20px`), or a [variable](#variables-and-tokens). **↑/↓** 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.
88
+ - **Colors** show as hex in capitals, without the `#` (`0F172A`); type them with or without it. One digit is repeated: `f` is white (`FFFFFF`), `0` black. Click the swatch for the color picker.
88
89
  - **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.
89
90
  - **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".
90
91
  - **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.
91
- - **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.
92
+ - **Rich properties** (background image, 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.
93
+ - **Background image** (`bg-image`): **+** adds an image. In its panel, pick the type (an image, a linear or radial gradient, custom CSS, or none). An image takes its url; a gradient has a row per color stop: its position (empty, the browser spreads them; the field shows where; type a percentage, or step it with the arrows and leave the field, and the stop moves to its place in the list), then its color: click it to pick one (and its opacity), or hover it and click the variables button for one of the page's color variables; **×** takes the stop off (a gradient keeps at least two, so there's no × at two). **+** under the stops adds one. Each layer's panel ends with its own **size**, **position** and **repeat** (search `bg-cover`, `bg-center` or `bg-no-repeat` to find them).
94
+ - **Background clip** (`bg-clip`): how far the background reaches: the border, the padding, the content, or the text (`text` shows the background through the letters).
92
95
  - **Transform:** one row for everything that moves, turns, sizes or slants the element, its chip saying what's set (× 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.
93
96
  - **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.
94
97
  - **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.
95
98
  - **Copy and paste:** right-click a property's name for **Copy CSS**, **Copy properties** and **Paste properties** (onto the selected elements).
96
99
  - **Fields show what your CSS declares**, not computed values; hover a field to see what math or a variable comes to.
97
- - The dialog stays where it opened while you edit; drag it by the strip along its top edge.
100
+ - The dialog stays where it opened while you edit; drag it by the strip along its top edge. Drag its bottom edge to make it shorter (its properties scroll); it stays that height for the next elements you select.
98
101
 
99
102
  ## Variables and tokens
100
103
 
@@ -166,15 +169,17 @@ With **Select** on, **double-click** a text to edit it in place. **Enter** is do
166
169
  - 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.
167
170
  - **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.
168
171
  - The agent writes your changes in the project's own way (Tailwind classes, CSS modules, tokens…), never as inline styles.
172
+ - **Sounds**, if you want them: ask your agent to turn Pilot's sounds on, or add `sounds: true` where your app loads Pilot yourself ([options](#commands-and-options)). Pilot then plays a short sound when changes are sent, when a job is done, when the agent replies or asks you something, when something's stuck, and when you mark a comment as solved. Dragging a field's wheel clicks softly as it turns; dragged slowly, it clicks on every value. An angle's dial taps once as you start turning it. After a reload, they play once you've clicked or typed on the page.
169
173
 
170
174
  ## Comments
171
175
 
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).
176
+ - **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
177
  - **Attach** images, text files or PDFs with the attach button, or drop them on the box.
174
178
  - **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
179
  - 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
- - 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.
180
+ - A thread with a reply to read shows a **comment icon** on its element and counts on the Comment button. Click the icon to open the thread; on the selected element, it opens and closes it. When a reply or a question arrives, the comment icon on its element wiggles to catch your eye.
181
+ - **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. If you answered **All of them** to the agent's question, every look-alike on the page is selected with it, so your tweak goes to all of them. A reply with **Copy instructions** doesn't have it: allow what was refused and ask again first.
182
+ - **Show in DOM**, under a reply whose job added elements to the page, selects what was added and opens the DOM tree on it, with the comment box on it (switch to Select to edit it), even when it doesn't show on the page (empty, or only in a state, like a closed menu's items). The agent says in its reply what makes it show.
178
183
  - **Mark as solved** (or Option+Enter) closes the thread.
179
184
  - **Stop** (beside send) cancels the job while the agent works.
180
185
 
@@ -194,9 +199,11 @@ Pilot's three always end their reply with what Pilot measured itself ("**Pilot c
194
199
 
195
200
  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.
196
201
 
202
+ 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`.
203
+
197
204
  ## When the agent asks you something
198
205
 
199
- 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:
206
+ 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:
200
207
 
201
208
  - **All of them** changes the component itself.
202
209
  - **Only this** changes this one instance.
@@ -212,7 +219,7 @@ With an element selected, **hold Alt (Option)** and move the pointer: Pilot show
212
219
 
213
220
  ## The DOM tree
214
221
 
215
- **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, **↑/↓** to move, **→/←** 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.
222
+ **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, **↑/↓** to move, **→/←** 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: hover one to see its box on the page, click it to edit it (its element is selected with the `before:` or `after:` modifier on). Clicking the element's own row takes that modifier off.
216
223
 
217
224
  ## Keyboard shortcuts
218
225
 
@@ -281,5 +288,10 @@ mountPilot({
281
288
  launch: false, // true: open on load
282
289
  nameAttributes: ["data-block"], // attributes your project names elements with
283
290
  project: "my-app", // your package.json's name: npx usepilot runs for its own project's pages
291
+ sounds: true, // sounds for sent, done, replies, stuck, solved, and dragging values. Default false
284
292
  });
285
293
  ```
294
+
295
+ To change one, ask your agent ("turn Pilot's sounds on", "open Pilot on load"), or edit it yourself and reload the page.
296
+
297
+ **Agents**, to set an option: search the app's code for `usepilot` to find where it loads Pilot, a `mountPilot({ project: … })` call (in `import("usepilot").then(…)`, or a `<script type="module">` importing `…/node_modules/usepilot/dist/pilot.js`), and add the option beside `project`, keeping the development-only check around it. An import of `usepilot/auto` takes no options: replace it with `import("usepilot").then((p) => p.mountPilot({ project: "<the package.json name>", … }))`, under the same check. `usepilot/vite` and `usepilot/next`, in the build config, don't take these options. The page picks the change up on reload.
package/README.md CHANGED
@@ -75,6 +75,7 @@ mountPilot({
75
75
  launch: false, // true: open on load
76
76
  nameAttributes: ["data-block"], // attributes your project names elements with
77
77
  project: "my-app", // your package.json's name: npx usepilot runs for its own project's pages
78
+ sounds: true, // sounds for sent, done, replies, stuck, solved, and dragging values. Default false
78
79
  });
79
80
  ```
80
81
 
@@ -715,6 +715,7 @@ function formatComment(changeSet, request) {
715
715
  several > 1 ? "- Change only what the comment is about, on each of these elements." : "- Change only what the comment is about.",
716
716
  `- ${sharedCode()}`,
717
717
  "- **A question, not a change:** answer it, and change nothing.",
718
+ "- **Elements you add that won't show on the page as it is now** (empty, or shown only in a state: a closed menu's items, a tooltip on hover, a closed dialog): say in your reply what makes them show. Pilot offers the designer a button that selects what you added.",
718
719
  latest?.skill ? "- **Your notes are your reply in the designer's thread:** reply as the skill says (findings, a report, options to pick from), as long as it needs to be. Markdown shows (lists, bold, inline `code`, code blocks); headings show as bold lines." : "- **Your notes are your reply in the designer's thread, a small chat box for quick design back-and-forth:** keep it concise, like a chat message: what you changed, or your answer, or what you need from them, in a few short sentences at most. No headings, and not a report: the designer sees the result on the page."
719
720
  );
720
721
  return `${lines.join("\n")}
@@ -804,7 +805,9 @@ function targetLines(target) {
804
805
  }
805
806
  if (target.lookAlikes) {
806
807
  const of = target.lookAlikesOf ? `other instances of \`${target.lookAlikesOf}\`, the same part of each` : "the same part of other copies";
807
- out.push(`- Look-alikes: ${target.lookAlikes} more on the page (${of}), not in this job`);
808
+ out.push(
809
+ `- 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)`
810
+ );
808
811
  }
809
812
  if (target.everyCopy) {
810
813
  out.push(
@@ -3774,7 +3777,7 @@ function locate(target, root, options = {}) {
3774
3777
  const all = found.list;
3775
3778
  const best = all[0];
3776
3779
  if (!best || !convincing(best)) return null;
3777
- const at = (c) => ({ file: c.file.rel, line: c.index + 1, snippet: snippetAt(c.file.lines, c.index) });
3780
+ const at = (c) => ({ file: c.file.rel, line: c.index + 1, snippet: snippetAt(c.file.lines, c.index), ...loopAround(c.file.lines, c.index) });
3778
3781
  const apart = (a, b) => a.file !== b.file || a.index !== b.index || a.column !== b.column;
3779
3782
  const elsewhere = all.filter((c) => apart(c, best));
3780
3783
  const second = elsewhere[0];
@@ -3802,7 +3805,7 @@ function candidates(target, root, options = {}) {
3802
3805
  if (file) {
3803
3806
  const own = scoreFile(n, file, from, from + 200).sort((a, b) => b.score - a.score)[0];
3804
3807
  const index = own && own.score >= 2 ? own.index : from;
3805
- return { known: { file: known, line: index + 1, snippet: snippetAt(file.lines, index) } };
3808
+ return { known: { file: known, line: index + 1, snippet: snippetAt(file.lines, index), ...loopAround(file.lines, index) } };
3806
3809
  }
3807
3810
  }
3808
3811
  if (!n.id && !n.texts.length && !n.attrs.length && !n.classes.length) return null;
@@ -3815,6 +3818,24 @@ function candidates(target, root, options = {}) {
3815
3818
  }
3816
3819
  return { list: list2.sort((a, b) => b.score - a.score) };
3817
3820
  }
3821
+ function loopAround(lines, index) {
3822
+ const indent = (l) => /^\s*/.exec(l)?.[0].length ?? 0;
3823
+ const found = (i) => ({ loop: { line: i + 1, text: cut(lines[i].trim()) } });
3824
+ if (LOOP.test(lines[index] ?? "")) return found(index);
3825
+ let level = indent(lines[index] ?? "");
3826
+ for (let i = index - 1; i >= Math.max(0, index - LOOP_LINES) && level > 0; i--) {
3827
+ const line = lines[i];
3828
+ if (!line.trim() || indent(line) >= level) continue;
3829
+ if (LOOP.test(line)) return found(i);
3830
+ level = indent(line);
3831
+ }
3832
+ return {};
3833
+ }
3834
+ 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/;
3835
+ var LOOP_LINES = 40;
3836
+ function cut(text) {
3837
+ return text.length > 100 ? `${text.slice(0, 99)}\u2026` : text;
3838
+ }
3818
3839
  function snippetAt(lines, index) {
3819
3840
  return lines.slice(Math.max(0, index - 2), index + 3).map((l) => l.length > 160 ? `${l.slice(0, 159)}\u2026` : l).join("\n");
3820
3841
  }
@@ -3919,6 +3940,12 @@ function jobLocations(job, root) {
3919
3940
  }
3920
3941
  return found;
3921
3942
  }
3943
+ function loopNote(target, at) {
3944
+ if (!at.loop) return [];
3945
+ const where = at.loop.line === at.line ? "on this line" : `line ${at.loop.line}`;
3946
+ 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";
3947
+ return ["", ` In a loop (\`${at.loop.text}\`, ${where})${ask}.`];
3948
+ }
3922
3949
  function whereSection(job, root, located = jobLocations(job, root)) {
3923
3950
  if (!searchable(root)) return "";
3924
3951
  const found = [];
@@ -3939,7 +3966,7 @@ function whereSection(job, root, located = jobLocations(job, root)) {
3939
3966
  ` \`${at.also.file}:${at.also.line}\`:`,
3940
3967
  ...snippet(at.also)
3941
3968
  );
3942
- else found.push(`- \`${target.path}\` \u2192 \`${at.file}:${at.line}\`:`, ...snippet(at));
3969
+ else found.push(`- \`${target.path}\` \u2192 \`${at.file}:${at.line}\`:`, ...loopNote(target, at), ...snippet(at));
3943
3970
  }
3944
3971
  if (!found.length) return "";
3945
3972
  return [
package/cli/index.js CHANGED
@@ -16,14 +16,14 @@ import {
16
16
  shownPath,
17
17
  startRunner,
18
18
  startWithDevServer
19
- } from "./chunk-IQGA6RGZ.js";
19
+ } from "./chunk-HVM5DNLS.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.20.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. 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.\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\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.22.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- **Colors** show as hex in capitals, without the `#` (`0F172A`); type them with or without it. One digit is repeated: `f` is white (`FFFFFF`), `0` black. Click the swatch for the color picker.\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** (background image, 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- **Background image** (`bg-image`): **+** adds an image. In its panel, pick the type (an image, a linear or radial gradient, custom CSS, or none). An image takes its url; a gradient has a row per color stop: its position (empty, the browser spreads them; the field shows where; type a percentage, or step it with the arrows and leave the field, and the stop moves to its place in the list), then its color: click it to pick one (and its opacity), or hover it and click the variables button for one of the page's color variables; **\xD7** takes the stop off (a gradient keeps at least two, so there's no \xD7 at two). **+** under the stops adds one. Each layer's panel ends with its own **size**, **position** and **repeat** (search `bg-cover`, `bg-center` or `bg-no-repeat` to find them).\n- **Background clip** (`bg-clip`): how far the background reaches: the border, the padding, the content, or the text (`text` shows the background through the letters).\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. Drag its bottom edge to make it shorter (its properties scroll); it stays that height for the next elements you select.\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- **Sounds**, if you want them: ask your agent to turn Pilot's sounds on, or add `sounds: true` where your app loads Pilot yourself ([options](#commands-and-options)). Pilot then plays a short sound when changes are sent, when a job is done, when the agent replies or asks you something, when something's stuck, and when you mark a comment as solved. Dragging a field's wheel clicks softly as it turns; dragged slowly, it clicks on every value. An angle's dial taps once as you start turning it. After a reload, they play once you've clicked or typed on the page.\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. Click the icon to open the thread; on the selected element, it opens and closes it. When a reply or a question arrives, the comment icon on its element wiggles to catch your eye.\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. If you answered **All of them** to the agent's question, every look-alike on the page is selected with it, so your tweak goes to all of them. A reply with **Copy instructions** doesn't have it: allow what was refused and ask again first.\n- **Show in DOM**, under a reply whose job added elements to the page, selects what was added and opens the DOM tree on it, with the comment box on it (switch to Select to edit it), even when it doesn't show on the page (empty, or only in a state, like a closed menu's items). The agent says in its reply what makes it show.\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: hover one to see its box on the page, click it to edit it (its element is selected with the `before:` or `after:` modifier on). Clicking the element's own row takes that modifier off.\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 sounds: true, // sounds for sent, done, replies, stuck, solved, and dragging values. Default false\n});\n```\n\nTo change one, ask your agent (\"turn Pilot's sounds on\", \"open Pilot on load\"), or edit it yourself and reload the page.\n\n**Agents**, to set an option: search the app's code for `usepilot` to find where it loads Pilot, a `mountPilot({ project: \u2026 })` call (in `import(\"usepilot\").then(\u2026)`, or a `<script type=\"module\">` importing `\u2026/node_modules/usepilot/dist/pilot.js`), and add the option beside `project`, keeping the development-only check around it. An import of `usepilot/auto` takes no options: replace it with `import(\"usepilot\").then((p) => p.mountPilot({ project: \"<the package.json name>\", \u2026 }))`, under the same check. `usepilot/vite` and `usepilot/next`, in the build config, don't take these options. The page picks the change up on reload.\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.20.0";
128
+ var VERSION = "0.22.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-IQGA6RGZ.js";
4
+ } from "./chunk-HVM5DNLS.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-IQGA6RGZ.js";
4
+ } from "./chunk-HVM5DNLS.js";
5
5
 
6
6
  // src/vite.ts
7
7
  function pilot() {