usepilot 0.17.0 → 0.19.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 +20 -5
- package/README.md +1 -1
- package/cli/{chunk-B43K6Q5Y.js → chunk-JKVQCFKU.js} +121 -23
- package/cli/index.js +3 -3
- package/cli/next.js +1 -1
- package/cli/vite.js +1 -1
- package/dist/{mount-D4AddIUr.js → mount-5Xy3XPJR.js} +8615 -6192
- package/dist/pilot-auto.js +1 -1
- package/dist/pilot.js +1 -1
- package/package.json +1 -1
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.
|
|
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.
|
|
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
|
|
|
@@ -34,7 +34,7 @@ How to use Pilot, task by task. This guide is for **usepilot 0.17.0**: it ships
|
|
|
34
34
|
2. **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).
|
|
35
35
|
3. **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`.
|
|
36
36
|
|
|
37
|
-
**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 run `npx usepilot init` in the project once.
|
|
37
|
+
**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.
|
|
38
38
|
|
|
39
39
|
**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.
|
|
40
40
|
|
|
@@ -81,14 +81,17 @@ Drag the toolbar by the strip along its top edge; it stays where you put it.
|
|
|
81
81
|
|
|
82
82
|
Select an element and its **property dialog** opens beside it.
|
|
83
83
|
|
|
84
|
-
- **With nothing typed**, it lists every property the element sets, grouped (Layout, Position, Appearance, Effects, Transform, Typography, Interactivity, SVG, Visibility).
|
|
84
|
+
- **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).
|
|
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
88
|
- **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
|
-
- **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.
|
|
89
|
+
- **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
90
|
- **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
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
|
+
- **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
|
+
- **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
|
+
- **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.
|
|
92
95
|
- **Copy and paste:** right-click a property's name for **Copy CSS**, **Copy properties** and **Paste properties** (onto the selected elements).
|
|
93
96
|
- **Fields show what your CSS declares**, not computed values; hover a field to see what math or a variable comes to.
|
|
94
97
|
- The dialog stays where it opened while you edit; drag it by the strip along its top edge.
|
|
@@ -134,6 +137,18 @@ Start the search with a state, Tailwind style, or type `/` to pick one:
|
|
|
134
137
|
- **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.
|
|
135
138
|
- **`/` at the start of the search** lists every modifier, and first the combinations this element already uses, with what each sets.
|
|
136
139
|
|
|
140
|
+
## Any other condition, in words
|
|
141
|
+
|
|
142
|
+
For 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.
|
|
143
|
+
|
|
144
|
+
- 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.
|
|
145
|
+
- 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.
|
|
146
|
+
- 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.
|
|
147
|
+
- CSS works too, with `&` for the element (`.card:hover &`): that one shows live right away.
|
|
148
|
+
- A comment you write while a condition is in the pill is about that condition only: the comment box says so.
|
|
149
|
+
- 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.
|
|
150
|
+
- Backspace at the start of the search removes it, like the other modifiers.
|
|
151
|
+
|
|
137
152
|
## Editing text
|
|
138
153
|
|
|
139
154
|
With **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.
|
|
@@ -193,7 +208,7 @@ With an element selected, **hold Alt (Option)** and move the pointer: Pilot show
|
|
|
193
208
|
|
|
194
209
|
## The DOM tree
|
|
195
210
|
|
|
196
|
-
**Alt+D** (or Show in DOM) opens a tree of the page's elements, to select what's hard to click: overlapping, zero-size or hidden elements. 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.
|
|
211
|
+
**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.
|
|
197
212
|
|
|
198
213
|
## Keyboard shortcuts
|
|
199
214
|
|
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ Pilot works with **Claude Code**, **Codex** or **Cursor**, on your agent's usual
|
|
|
20
20
|
Set up Pilot in this project: run `npx usepilot@latest init` and follow what it prints.
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
Your agent adds Pilot to your app and sets it to start with your dev server, on your computer only:
|
|
23
|
+
Your agent adds Pilot to your app and sets it to start with your dev server, on your computer only. **Joining a project that already has Pilot?** Pass your agent the same prompt: it changes none of the project's files, and turns Pilot on for you. Pilot only runs while you develop: it never ships to your live site. Pilot runs your agent's terminal app for each job, not its chat window, so if that isn't installed yet, your agent installs it (it asks you first).
|
|
24
24
|
|
|
25
25
|
2. **Restart your dev server** and open your app. Pilot appears on every page, and you can start designing right away.
|
|
26
26
|
|
|
@@ -404,7 +404,7 @@ function advancedTask() {
|
|
|
404
404
|
return "**An advanced task: it needs judgment more than speed.** If you can hand work to a more capable model than the one you run on (a subagent, or another model your agent offers), do: give it this whole prompt, have it make the changes, and report back with what it did.";
|
|
405
405
|
}
|
|
406
406
|
var DESIGN_INTENT = "**These are design instructions, not code**: the designer's intent, shown as plain CSS values. Use your judgment and write production code the way this project already styles things, whatever it uses (Tailwind, CSS or Sass modules, StyleX, vanilla-extract, Panda, styled-components, Emotion, a component library's props\u2026). First look at how each element's component is styled, and follow that: its tokens and scale, its variants and props, and the rule that already styles it rather than a new override.";
|
|
407
|
-
var PRODUCTION_CODE = "No inline styles, no `!important
|
|
407
|
+
var PRODUCTION_CODE = "No inline styles, no new `!important` (keep the ones the project has), no hard-coded values where a token or utility fits.";
|
|
408
408
|
var SHARED_CHOICES = {
|
|
409
409
|
all: { label: "All of them", means: "change the component (or the shared code) itself, so every instance gets it." },
|
|
410
410
|
one: {
|
|
@@ -659,6 +659,7 @@ function commentLines(message) {
|
|
|
659
659
|
const text = message?.text.trim() ?? "";
|
|
660
660
|
const files = message?.attachments ?? [];
|
|
661
661
|
const out = text ? [quote(text)] : [];
|
|
662
|
+
if (message?.condition) out.push("", whenLine(message.condition));
|
|
662
663
|
const references = message?.references ?? [];
|
|
663
664
|
if (references.length) out.push("", ...referenceLines(references));
|
|
664
665
|
if (!files.length) return out.length ? out : ["> (empty)"];
|
|
@@ -671,6 +672,11 @@ function commentLines(message) {
|
|
|
671
672
|
);
|
|
672
673
|
return out;
|
|
673
674
|
}
|
|
675
|
+
function whenLine(when) {
|
|
676
|
+
const css = [when.media && `@media ${when.media}`, when.container && `@container ${when.container}`, when.selector && `\`${when.selector}\``].filter(Boolean).join(" and ");
|
|
677
|
+
const how = when.project ? `a condition the project already has (\`${when.words}\`, ${css}${when.selector ? ", `&` being this element" : ""}): change its rule, don't add another` : css ? `${css}${when.selector ? ", `&` being this element" : ""}: write it the project's way` : `the designer's words: work out what on the page marks that, write it the project's way, and ask if you can't tell`;
|
|
678
|
+
return `It's about this element only when ${JSON.stringify(when.label ?? when.words)} holds (${how}); the rest of the time it stays as it is.`;
|
|
679
|
+
}
|
|
674
680
|
function referenceLines(references) {
|
|
675
681
|
const picked = references.some((r) => r.kind !== "unlisted");
|
|
676
682
|
return [
|
|
@@ -758,18 +764,19 @@ function formatEdit(edit, n) {
|
|
|
758
764
|
if (texts?.length) out.push("", "Text (from \u2192 to):", "", ...texts.map((t) => `- ${JSON.stringify(t.from)} \u2192 ${JSON.stringify(t.to)}`));
|
|
759
765
|
if (!changes.length) return out;
|
|
760
766
|
const withStates = changes.some((c) => c.states?.length);
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
withStates ? "| --- | --- | --- | --- | --- |" : "| --- | --- | --- | --- |"
|
|
765
|
-
);
|
|
767
|
+
const withWhen = changes.some((c) => c.condition);
|
|
768
|
+
const head = ["Property", "From", "To", "Widths", ...withStates ? ["State"] : [], ...withWhen ? ["When"] : []];
|
|
769
|
+
out.push("", `| ${head.join(" | ")} |`, `| ${head.map(() => "---").join(" | ")} |`);
|
|
766
770
|
for (const c of changes) {
|
|
767
771
|
const to = c.removed ? "*removed*" : `\`${c.to}\``;
|
|
768
772
|
const from = c.from ? `\`${c.from}\`` : "*not set*";
|
|
769
773
|
const widths = c.widths ? describeWidths(c.widths) : "base";
|
|
770
|
-
|
|
774
|
+
const cells = [`\`${c.property}\``, from, to, widths, ...withStates ? [describeStates(c.states)] : [], ...withWhen ? [c.condition ? c.condition.words.replace(/\|/g, "\\|") : "\u2014"] : []];
|
|
775
|
+
out.push(`| ${cells.join(" | ")} |`);
|
|
771
776
|
}
|
|
772
|
-
const notes = changes.flatMap(
|
|
777
|
+
const notes = changes.flatMap(
|
|
778
|
+
(c) => [c.removed && removalNote(c), mediaNote(c), conditionNote(c), importantNote(c), equivalentsNote(c)].filter((n2) => !!n2)
|
|
779
|
+
);
|
|
773
780
|
if (notes.length) out.push("", ...notes.map((n2) => `- ${n2}`));
|
|
774
781
|
return out;
|
|
775
782
|
}
|
|
@@ -789,6 +796,22 @@ function mediaNote(c) {
|
|
|
789
796
|
const today = `\`${c.property}\` is set inside \`@media ${media}\` today.`;
|
|
790
797
|
return c.widths ? `${today} The change is for ${describeWidths(c.widths)}.` : `${today} The change has no width: set it without a media query, and keep that one as it is.`;
|
|
791
798
|
}
|
|
799
|
+
function conditionNote(c) {
|
|
800
|
+
const when = c.condition;
|
|
801
|
+
if (!when) return null;
|
|
802
|
+
const css = [when.media && `@media ${when.media}`, when.container && `@container ${when.container}`, when.selector && `\`${when.selector}\``].filter(Boolean).join(" and ");
|
|
803
|
+
const container = when.container ? " A container query is about the element's nearest container (an ancestor with `container-type`): make the one meant a container if it isn't one yet." : "";
|
|
804
|
+
if (!css)
|
|
805
|
+
return `\`${c.property}\` is only for when ${JSON.stringify(when.words)} (the designer's words): work out what on the page marks that (a class, an attribute, a parent's or a sibling's state, what it contains, a media or container query), and write the change for it the project's way, the element's other styles as they are. If you can't tell what the words mean, ask the designer (a question, your best readings as its choices) rather than guess.`;
|
|
806
|
+
const read4 = when.selector ? `${css}, \`&\` being this element` : `\`${css}\``;
|
|
807
|
+
if (when.project)
|
|
808
|
+
return `\`${c.property}\` is only for when ${read4}: a condition the project already has (${JSON.stringify(when.words)}). Change that rule's value (its source above, when there's one), or add the property to it, the project's way; don't add another rule for it.`;
|
|
809
|
+
return `\`${c.property}\` is only for when ${read4} (the designer wrote it as CSS): write it the project's way, the element's other styles as they are.${container}`;
|
|
810
|
+
}
|
|
811
|
+
function importantNote(c) {
|
|
812
|
+
if (!c.important || c.removed) return null;
|
|
813
|
+
return `\`${c.property}\` is \`!important\` in the project today (Tailwind's \`!\` prefix, or \`!important\` in its rule): change that declaration and keep it important, so the new value still wins where the old one did.`;
|
|
814
|
+
}
|
|
792
815
|
function equivalentsNote(c) {
|
|
793
816
|
const e = c.equivalents;
|
|
794
817
|
if (!e || !e.tokens.length && !e.classes.length) return null;
|
|
@@ -810,10 +833,32 @@ function removalNote(c) {
|
|
|
810
833
|
}
|
|
811
834
|
|
|
812
835
|
// ../protocol/src/bridge.ts
|
|
813
|
-
var BRIDGE_VERSION =
|
|
836
|
+
var BRIDGE_VERSION = 10;
|
|
814
837
|
var DEFAULT_BRIDGE_PORT = 4747 + BRIDGE_VERSION;
|
|
815
838
|
var SKILL_NAME = /^[A-Za-z0-9][\w.:-]{0,63}$/;
|
|
816
839
|
var MAX_CHOICES = 4;
|
|
840
|
+
function conditionResultsOf(value) {
|
|
841
|
+
if (!Array.isArray(value)) return void 0;
|
|
842
|
+
const text = (v, max) => typeof v === "string" && v.trim() && !/[{}<>]/.test(v) ? v.trim().slice(0, max) : void 0;
|
|
843
|
+
const out = [];
|
|
844
|
+
for (const item of value.slice(0, 50)) {
|
|
845
|
+
const c = item;
|
|
846
|
+
const element = Number.isInteger(c?.element) && c?.element >= 1 && c?.element <= 1e3 ? c?.element : void 0;
|
|
847
|
+
const words = text(c?.words, 300);
|
|
848
|
+
if (!element || !words) continue;
|
|
849
|
+
const selector = text(c?.selector, 300);
|
|
850
|
+
const result = {
|
|
851
|
+
element,
|
|
852
|
+
words,
|
|
853
|
+
...text(c?.label, 40) ? { label: text(c?.label, 40) } : {},
|
|
854
|
+
...selector?.includes("&") ? { selector } : {},
|
|
855
|
+
...text(c?.media, 200) ? { media: text(c?.media, 200) } : {},
|
|
856
|
+
...text(c?.container, 200) ? { container: text(c?.container, 200) } : {}
|
|
857
|
+
};
|
|
858
|
+
if (result.label || result.selector || result.media || result.container) out.push(result);
|
|
859
|
+
}
|
|
860
|
+
return out.length ? out : void 0;
|
|
861
|
+
}
|
|
817
862
|
function questionOf(value) {
|
|
818
863
|
const q = value;
|
|
819
864
|
if (typeof q?.text !== "string" || !q.text.trim()) return void 0;
|
|
@@ -1581,7 +1626,9 @@ var Hub = class {
|
|
|
1581
1626
|
// The session to resume for its follow-up (kept from the first run when a later one has none), and the run's error or none.
|
|
1582
1627
|
session: extra.session ?? job.session,
|
|
1583
1628
|
error: extra.error,
|
|
1584
|
-
allow: extra.allow
|
|
1629
|
+
allow: extra.allow,
|
|
1630
|
+
// The conditions it wrote (an edit's, not a question's: what it left for the answer isn't written yet).
|
|
1631
|
+
...extra.conditions?.length && !asks.question ? { conditions: extra.conditions } : {}
|
|
1585
1632
|
});
|
|
1586
1633
|
return job;
|
|
1587
1634
|
}
|
|
@@ -1687,10 +1734,10 @@ var Hub = class {
|
|
|
1687
1734
|
* preferably to the agent that did it. Null when it can't (not done, or
|
|
1688
1735
|
* already a follow-up: then the page takes what the code gives).
|
|
1689
1736
|
*/
|
|
1690
|
-
retry(origin, jobId, differences, issues) {
|
|
1737
|
+
retry(origin, jobId, differences, issues, unnamed) {
|
|
1691
1738
|
const job = this.jobs.get(jobId);
|
|
1692
1739
|
if (!job || job.origin !== originKey(origin) || job.status !== "done" || (job.attempt ?? 1) >= 2) return null;
|
|
1693
|
-
this.update(job, { status: "queued", attempt: 2, differences, issues, notes: void 0 });
|
|
1740
|
+
this.update(job, { status: "queued", attempt: 2, differences, issues, notes: void 0, ...unnamed?.length ? { unnamed } : {} });
|
|
1694
1741
|
this.dispatch(job.origin);
|
|
1695
1742
|
return job;
|
|
1696
1743
|
}
|
|
@@ -1842,7 +1889,8 @@ async function handle(hub, req, res, attachments) {
|
|
|
1842
1889
|
origin,
|
|
1843
1890
|
decodeURIComponent(id),
|
|
1844
1891
|
(data.differences ?? []).slice(0, 200),
|
|
1845
|
-
stringsOf(data.issues)
|
|
1892
|
+
stringsOf(data.issues),
|
|
1893
|
+
unnamedOf(data.unnamed)
|
|
1846
1894
|
);
|
|
1847
1895
|
return job ? json(res, 200, { job }) : json(res, 409, { error: `can't ${action} this job` });
|
|
1848
1896
|
}
|
|
@@ -1895,7 +1943,12 @@ async function handleAgent(hub, action, data, req, res) {
|
|
|
1895
1943
|
case "done":
|
|
1896
1944
|
if (!d.jobId) return json(res, 400, { error: "jobId needed" });
|
|
1897
1945
|
return json(res, 200, {
|
|
1898
|
-
job: hub.done(d.agent.id, d.jobId, d.notes, questionOf(d.question), propsOf(d.props), {
|
|
1946
|
+
job: hub.done(d.agent.id, d.jobId, d.notes, questionOf(d.question), propsOf(d.props), {
|
|
1947
|
+
session: sessionOf(d.session),
|
|
1948
|
+
error: jobErrorOf(d.error),
|
|
1949
|
+
allow: allowOf(d.allow),
|
|
1950
|
+
conditions: conditionResultsOf(d.conditions)
|
|
1951
|
+
})
|
|
1899
1952
|
});
|
|
1900
1953
|
case "activity":
|
|
1901
1954
|
if (!d.jobId) return json(res, 400, { error: "jobId needed" });
|
|
@@ -1919,6 +1972,11 @@ async function handleAgent(hub, action, data, req, res) {
|
|
|
1919
1972
|
}
|
|
1920
1973
|
}
|
|
1921
1974
|
var CHECK_TIMEOUT = 6e4;
|
|
1975
|
+
function unnamedOf(value) {
|
|
1976
|
+
if (!Array.isArray(value)) return void 0;
|
|
1977
|
+
const out = value.slice(0, 50).map((v) => v).filter((v) => Number.isInteger(v?.element) && v.element >= 1 && typeof v.words === "string" && v.words.trim()).map((v) => ({ element: v.element, words: v.words.trim().slice(0, 300) }));
|
|
1978
|
+
return out.length ? out : void 0;
|
|
1979
|
+
}
|
|
1922
1980
|
function stringsOf(value) {
|
|
1923
1981
|
if (!Array.isArray(value)) return void 0;
|
|
1924
1982
|
return value.filter((v) => typeof v === "string").slice(0, 100).map((v) => v.slice(0, 2e3));
|
|
@@ -2222,7 +2280,7 @@ import { mkdirSync, readFileSync as readFileSync4, realpathSync, writeFileSync }
|
|
|
2222
2280
|
import { homedir as homedir3 } from "os";
|
|
2223
2281
|
import { basename as basename4, dirname as dirname5, join as join6, resolve as resolve2 } from "path";
|
|
2224
2282
|
function configFile(env = process.env, platform = process.platform, home = homedir3()) {
|
|
2225
|
-
const base = platform === "win32" ? env.APPDATA
|
|
2283
|
+
const base = platform === "win32" ? env.APPDATA || join6(home, "AppData", "Roaming") : env.XDG_CONFIG_HOME || join6(home, ".config");
|
|
2226
2284
|
return join6(base, "usepilot", "projects.json");
|
|
2227
2285
|
}
|
|
2228
2286
|
function read3(file) {
|
|
@@ -3154,8 +3212,9 @@ function factsSection(job, root, near = []) {
|
|
|
3154
3212
|
const cls = classFor(change.property, change.to, tw.theme);
|
|
3155
3213
|
if (cls) {
|
|
3156
3214
|
const prefix = prefixFor(change, tw.theme);
|
|
3215
|
+
const when = change.condition ? ", under the condition's variant (its note)" : "";
|
|
3157
3216
|
add(
|
|
3158
|
-
`- \`${change.property}: ${change.to}\`${prefix ? ` (${prefix.slice(0, -1).replaceAll(":", ", ")})` : ""} is \`${prefix}${cls.exact}\`${cls.closest ? `, no step of the scale; its closest is \`${prefix}${cls.closest.cls}\` (${px(cls.closest.px)})` : ""}${cls.note ? ` (${cls.note})` : ""}.`
|
|
3217
|
+
`- \`${change.property}: ${change.to}\`${prefix ? ` (${prefix.slice(0, -1).replaceAll(":", ", ")})` : ""} is \`${prefix}${cls.exact}\`${cls.closest ? `, no step of the scale; its closest is \`${prefix}${cls.closest.cls}\` (${px(cls.closest.px)})` : ""}${cls.note ? ` (${cls.note})` : ""}${when}.`
|
|
3159
3218
|
);
|
|
3160
3219
|
}
|
|
3161
3220
|
}
|
|
@@ -3901,7 +3960,7 @@ var SessionPool = class {
|
|
|
3901
3960
|
|
|
3902
3961
|
// src/prompt.ts
|
|
3903
3962
|
function jobPrompt(job, where = "", options = {}) {
|
|
3904
|
-
const body2 = job.attempt === 2 && job.issues?.length ? taskFollowUp(job) : job.attempt === 2 && job.differences?.length ? followUp(job) : job.answer && job.question ? answered(job) : formatPrompt(job.changeSet, options);
|
|
3963
|
+
const body2 = job.attempt === 2 && job.issues?.length ? taskFollowUp(job) : job.attempt === 2 && (job.differences?.length || job.unnamed?.length) ? followUp(job) : job.answer && job.question ? answered(job) : formatPrompt(job.changeSet, options);
|
|
3905
3964
|
return `${body2}${where ? `
|
|
3906
3965
|
${where}
|
|
3907
3966
|
` : ""}
|
|
@@ -3924,6 +3983,7 @@ function runFooter(job) {
|
|
|
3924
3983
|
...props ? ["", "`type` is one of `options`, `boolean`, `text`, `number`; `options` only for `options`."] : [],
|
|
3925
3984
|
...!props && several ? ["", "`element`: the number of the element it's about (its heading's), so the designer sees it there; leave it out when it's about all of them."] : [],
|
|
3926
3985
|
"",
|
|
3986
|
+
...conditionsAsk(job),
|
|
3927
3987
|
// What runs were refused most, for nothing (a skill's checks): reading with `cat`, fetching the page with `curl`.
|
|
3928
3988
|
"Read and search files with your own file tools, not shell commands (`cat`, `cd`, `grep`), and don't fetch or open the page (`curl`, a browser): Pilot checks it itself.",
|
|
3929
3989
|
"",
|
|
@@ -3935,6 +3995,20 @@ function runFooter(job) {
|
|
|
3935
3995
|
"```"
|
|
3936
3996
|
].join("\n");
|
|
3937
3997
|
}
|
|
3998
|
+
function conditionsAsk(job) {
|
|
3999
|
+
const conditions = job.changeSet.edits.some((e) => e.changes.some((c) => c.condition && !c.condition.selector && !c.condition.media && !c.condition.container));
|
|
4000
|
+
if (!conditions) return [];
|
|
4001
|
+
return [
|
|
4002
|
+
"",
|
|
4003
|
+
"For each When condition you wrote, add `conditions` to that block (one block at the very end: every key in it), after you wrote them:",
|
|
4004
|
+
"",
|
|
4005
|
+
"```pilot",
|
|
4006
|
+
'{"conditions": [{"element": 1, "words": "the When, as given", "label": "group-hover", "selector": ".card:hover &"}]}',
|
|
4007
|
+
"```",
|
|
4008
|
+
"",
|
|
4009
|
+
"`element`: its heading's number. `label`: a short name for it in Pilot's menu, like a variant name (`group-hover`, `data-open`, `peer-invalid`): a label only, not a hint about the code, which follows the project's own way. `selector`: the CSS selector your code makes it, `&` for this element (`.card:hover &`, `&[data-open]`, `&:has(> :checked)`); `media` or `container` (the query) for a media or container query, with or without it."
|
|
4010
|
+
];
|
|
4011
|
+
}
|
|
3938
4012
|
function answered(job) {
|
|
3939
4013
|
const meaning = job.answer ? sharedChoiceMeaning(job.answer) : null;
|
|
3940
4014
|
return [
|
|
@@ -3955,17 +4029,30 @@ function answered(job) {
|
|
|
3955
4029
|
].join("\n");
|
|
3956
4030
|
}
|
|
3957
4031
|
function followUp(job) {
|
|
3958
|
-
const lines = [
|
|
3959
|
-
|
|
3960
|
-
|
|
4032
|
+
const lines = ["# Pilot design edits: follow-up", ""];
|
|
4033
|
+
if (!job.differences?.length) {
|
|
4034
|
+
lines.push(
|
|
4035
|
+
"You applied this job, but didn't give back these conditions (When) in your `conditions`. Pilot keeps a condition only with the CSS your code makes it, so add each to that block, as asked below; don't change the code again:",
|
|
4036
|
+
"",
|
|
4037
|
+
...(job.unnamed ?? []).map((u) => `- Element ${u.element}: ${JSON.stringify(u.words)}`)
|
|
4038
|
+
);
|
|
4039
|
+
return lines.join("\n");
|
|
4040
|
+
}
|
|
4041
|
+
lines.push(
|
|
3961
4042
|
"You applied this job, but Pilot checked the page and these changes don't give the designer's value yet (the values are what the browser computes for the element):",
|
|
3962
4043
|
""
|
|
3963
|
-
|
|
4044
|
+
);
|
|
3964
4045
|
for (const d of job.differences ?? []) {
|
|
3965
4046
|
const edit = job.changeSet.edits.find((e) => e.target.selector === d.selector);
|
|
3966
4047
|
const where = edit ? `\`${edit.target.path}\` (selector \`${d.selector}\`${edit.target.text ? `, text "${edit.target.text}"` : ""})` : `\`${d.selector}\``;
|
|
3967
4048
|
lines.push(`- ${where}: \`${d.property}\` should be \`${d.expected}\`, the page gives \`${d.actual ?? "?"}\`.`);
|
|
3968
4049
|
}
|
|
4050
|
+
if (job.unnamed?.length)
|
|
4051
|
+
lines.push(
|
|
4052
|
+
"",
|
|
4053
|
+
"And give back these conditions (When) in your `conditions`, as asked below: Pilot keeps a condition only with the CSS your code makes it.",
|
|
4054
|
+
...job.unnamed.map((u) => `- Element ${u.element}: ${JSON.stringify(u.words)}`)
|
|
4055
|
+
);
|
|
3969
4056
|
lines.push(
|
|
3970
4057
|
"",
|
|
3971
4058
|
"Fix them: the usual causes are a rule that overrides yours (more specific, later, or in a media query), an edit in the wrong file or component, or a missed change. A media query, state or condition the project already had for a base change is meant to win where it applies (Pilot checks a base change only where it doesn't): keep it, don't flatten it. If you chose a different value on purpose (a token or the nearest step in the project's scale), keep it and say so in your notes. Pilot takes what the code gives after this."
|
|
@@ -4350,7 +4437,11 @@ ${said.map((l) => ` ${l}`).join("\n")}` : ""}`);
|
|
|
4350
4437
|
const session = result.session ? { agent: cli.kind, id: result.session } : void 0;
|
|
4351
4438
|
const refused = refusedNote(cli, [...result.refused ?? [], ...reply.refused ?? []]);
|
|
4352
4439
|
const notes = refused ? [reply.notes, refused.note].filter(Boolean).join("\n\n") : reply.notes;
|
|
4353
|
-
await bridge.done(job.id, notes, reply.question, reply.props, {
|
|
4440
|
+
await bridge.done(job.id, notes, reply.question, reply.props, {
|
|
4441
|
+
session,
|
|
4442
|
+
...refused?.allow ? { allow: refused.allow } : {},
|
|
4443
|
+
...reply.conditions ? { conditions: reply.conditions } : {}
|
|
4444
|
+
});
|
|
4354
4445
|
out(`\u2713 ${seconds}s \xB7 ${firstLine(reply.notes) || "Done."}`);
|
|
4355
4446
|
if (refused) out(`! ${[refused.note, refused.allow].filter(Boolean).join(" ").replaceAll("**", "").replaceAll("`", "")}`);
|
|
4356
4447
|
} catch (error) {
|
|
@@ -4422,7 +4513,14 @@ function replyOf(reply) {
|
|
|
4422
4513
|
}
|
|
4423
4514
|
notes = notes.trim();
|
|
4424
4515
|
const refused = refusedOf(data.refused);
|
|
4425
|
-
|
|
4516
|
+
const conditions = conditionResultsOf(data.conditions);
|
|
4517
|
+
return {
|
|
4518
|
+
notes: notes || void 0,
|
|
4519
|
+
question: questionOf(data.question),
|
|
4520
|
+
props: propsOf(data.props),
|
|
4521
|
+
...refused.length ? { refused } : {},
|
|
4522
|
+
...conditions ? { conditions } : {}
|
|
4523
|
+
};
|
|
4426
4524
|
}
|
|
4427
4525
|
function signInProblem(error) {
|
|
4428
4526
|
return !!error && /not (logged|signed) in|log ?in required|please (run )?\/?login|authenticat|unauthori[sz]ed|\b401\b|api key/i.test(error);
|
package/cli/index.js
CHANGED
|
@@ -16,14 +16,14 @@ import {
|
|
|
16
16
|
shownPath,
|
|
17
17
|
startRunner,
|
|
18
18
|
startWithDevServer
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-JKVQCFKU.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.17.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 run `npx usepilot init` in the project once.\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 (Layout, Position, Appearance, Effects, Transform, 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.\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- **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## 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, to select what's hard to click: overlapping, zero-size or hidden elements. 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.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";
|
|
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.
|
|
128
|
+
var VERSION = "0.19.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-
|
|
4
|
+
} from "./chunk-JKVQCFKU.js";
|
|
5
5
|
|
|
6
6
|
// src/next.ts
|
|
7
7
|
var DEV_PHASE = "phase-development-server";
|
package/cli/vite.js
CHANGED