usepilot 0.16.0 → 0.17.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 +266 -0
- package/README.md +14 -21
- package/cli/chunk-B43K6Q5Y.js +4577 -0
- package/cli/index.js +267 -4363
- package/cli/next.js +19 -0
- package/cli/vite.js +30 -0
- package/dist/{mount-DXYP_y3R.js → mount-D4AddIUr.js} +5749 -4221
- package/dist/pilot-auto.js +1 -1
- package/dist/pilot.js +1 -1
- package/package.json +13 -4
- package/types/next.d.ts +7 -0
- package/types/vite.d.ts +9 -0
package/GUIDE.md
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
# Pilot guide
|
|
2
|
+
|
|
3
|
+
How 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.
|
|
4
|
+
|
|
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
|
+
|
|
7
|
+
## Contents
|
|
8
|
+
|
|
9
|
+
- [Setting up](#setting-up)
|
|
10
|
+
- [Opening, hiding and closing Pilot](#opening-hiding-and-closing-pilot)
|
|
11
|
+
- [The toolbar](#the-toolbar)
|
|
12
|
+
- [Selecting elements](#selecting-elements)
|
|
13
|
+
- [Editing properties](#editing-properties)
|
|
14
|
+
- [Variables and tokens](#variables-and-tokens)
|
|
15
|
+
- [Screen widths (breakpoints)](#screen-widths-breakpoints)
|
|
16
|
+
- [Hover, focus, dark mode and other states](#hover-focus-dark-mode-and-other-states)
|
|
17
|
+
- [Editing text](#editing-text)
|
|
18
|
+
- [Undo, discard and reloads](#undo-discard-and-reloads)
|
|
19
|
+
- [Sending changes to your agent](#sending-changes-to-your-agent)
|
|
20
|
+
- [Comments](#comments)
|
|
21
|
+
- [Skills and Pilot's tasks (the / list)](#skills-and-pilots-tasks-the--list)
|
|
22
|
+
- [Mentions (@)](#mentions-)
|
|
23
|
+
- [When the agent asks you something](#when-the-agent-asks-you-something)
|
|
24
|
+
- [Measuring distances](#measuring-distances)
|
|
25
|
+
- [The DOM tree](#the-dom-tree)
|
|
26
|
+
- [Keyboard shortcuts](#keyboard-shortcuts)
|
|
27
|
+
- [When something's wrong](#when-somethings-wrong)
|
|
28
|
+
- [What Pilot doesn't do (yet)](#what-pilot-doesnt-do-yet)
|
|
29
|
+
- [Commands and options](#commands-and-options)
|
|
30
|
+
|
|
31
|
+
## Setting up
|
|
32
|
+
|
|
33
|
+
1. **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.
|
|
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
|
+
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
|
+
|
|
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.
|
|
38
|
+
|
|
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
|
+
|
|
41
|
+
**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.)
|
|
42
|
+
|
|
43
|
+
**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.
|
|
44
|
+
|
|
45
|
+
**Updating:** run `npx usepilot@latest update` in the project's folder, then restart your dev server (and `npx usepilot`, if you run it).
|
|
46
|
+
|
|
47
|
+
## Opening, hiding and closing Pilot
|
|
48
|
+
|
|
49
|
+
- **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.
|
|
50
|
+
- **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.
|
|
51
|
+
- **Close:** the toolbar's last button closes Pilot in every tab of the site. Jobs keep running, and Option+P opens it again.
|
|
52
|
+
- Pilot remembers per browser tab whether it's open, so reloads don't open or close it.
|
|
53
|
+
|
|
54
|
+
## The toolbar
|
|
55
|
+
|
|
56
|
+
From left to right:
|
|
57
|
+
|
|
58
|
+
| Button | What it does |
|
|
59
|
+
| --- | --- |
|
|
60
|
+
| **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. |
|
|
61
|
+
| **Select** (cursor, Option+V) | Click an element to edit its properties. |
|
|
62
|
+
| **Send** | Sends your changes not sent yet to the agent, as one job. Its count is how many it would send. |
|
|
63
|
+
| **Discard** (brush) | Takes your unsent changes off the page, in one undo step. Sent ones stay. |
|
|
64
|
+
| **Jobs** (a robot at a laptop) | Shows while jobs are running, with how many. Clicking it scrolls to the next job's elements. |
|
|
65
|
+
| **Hide** (eye) | Hides Pilot in this tab, everything kept. |
|
|
66
|
+
| **Close** | Closes Pilot on the whole site. |
|
|
67
|
+
|
|
68
|
+
Drag the toolbar by the strip along its top edge; it stays where you put it.
|
|
69
|
+
|
|
70
|
+
## Selecting elements
|
|
71
|
+
|
|
72
|
+
- **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.
|
|
73
|
+
- **Several elements:** Shift+click adds an element or takes it out. A plain click selects just one again.
|
|
74
|
+
- **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.
|
|
75
|
+
- **Show in DOM** (`< >` on the selection's corner) opens the [DOM tree](#the-dom-tree) on it.
|
|
76
|
+
- **Esc** clears the selection; with nothing selected, Esc turns the tool off.
|
|
77
|
+
- Grid containers show their grid lines and numbers; hovering an element stripes its padding, margin and gaps.
|
|
78
|
+
- The selection survives your agent's reloads (hot reload and full reloads).
|
|
79
|
+
|
|
80
|
+
## Editing properties
|
|
81
|
+
|
|
82
|
+
Select an element and its **property dialog** opens beside it.
|
|
83
|
+
|
|
84
|
+
- **With nothing typed**, it lists every property the element sets, grouped (Layout, Position, Appearance, Effects, Transform, Typography, Interactivity, SVG, Visibility).
|
|
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
|
+
- **Tab** or **Enter** goes into the editor, **Enter** applies and goes back to the search for the next property: `pt` Tab `24` Enter.
|
|
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
|
+
- **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.
|
|
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
|
+
- **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
|
+
- **Copy and paste:** right-click a property's name for **Copy CSS**, **Copy properties** and **Paste properties** (onto the selected elements).
|
|
93
|
+
- **Fields show what your CSS declares**, not computed values; hover a field to see what math or a variable comes to.
|
|
94
|
+
- The dialog stays where it opened while you edit; drag it by the strip along its top edge.
|
|
95
|
+
|
|
96
|
+
## Variables and tokens
|
|
97
|
+
|
|
98
|
+
Use your project's tokens anywhere a value goes:
|
|
99
|
+
|
|
100
|
+
- **Type `--`** in a field to list the page's CSS variables that fit (spacing for a padding, colors for a color…), filtered as you type, by name or value. It works inside math too: `calc(--sp`…
|
|
101
|
+
- **The variable button** on the right edge of a hovered field opens the same list to browse.
|
|
102
|
+
- **↑/↓** on a field holding a token move along its scale (`--space-3` → `--space-4`); Shift+drag on the handle does the same.
|
|
103
|
+
- 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.
|
|
104
|
+
|
|
105
|
+
The agent writes the token the project's way, never a raw value.
|
|
106
|
+
|
|
107
|
+
## Screen widths (breakpoints)
|
|
108
|
+
|
|
109
|
+
**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.
|
|
110
|
+
|
|
111
|
+
To choose the widths yourself, start the search with a **width modifier**:
|
|
112
|
+
|
|
113
|
+
- `from-768 ` (with a space): from 768px up. `to-767 `: up to 767px. Both make a range: `from-768 to-1199 `.
|
|
114
|
+
- `base `: the value with no media query (no breakpoint).
|
|
115
|
+
- `all-widths `: one value at every width; your breakpoint rules for that property are removed.
|
|
116
|
+
- After `from-` or `to-`, a list offers the window's width and the page's breakpoints; **Tab** takes the suggestion.
|
|
117
|
+
- **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`.
|
|
118
|
+
- While a property is in use, the ruler shows bars for where its values apply: green where your edit goes.
|
|
119
|
+
|
|
120
|
+
Modifiers stay set across selections until you remove them (the pill's ×, 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.
|
|
121
|
+
|
|
122
|
+
## Hover, focus, dark mode and other states
|
|
123
|
+
|
|
124
|
+
Start the search with a state, Tailwind style, or type `/` to pick one:
|
|
125
|
+
|
|
126
|
+
| Modifier | Edits |
|
|
127
|
+
| --- | --- |
|
|
128
|
+
| `hover:` `focus:` `focus-visible:` `active:` | the element in that state |
|
|
129
|
+
| `dark:` `light:` | the page in dark (or light-only) mode, the way your project does dark mode |
|
|
130
|
+
| `before:` `after:` `placeholder:` | the element's `::before`, `::after`, or a field's placeholder |
|
|
131
|
+
|
|
132
|
+
- They combine with each other and with widths: `hover:from-768 `, `dark:hover:`.
|
|
133
|
+
- **`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`, `✓`): Pilot adds the quotes.
|
|
134
|
+
- **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
|
+
- **`/` at the start of the search** lists every modifier, and first the combinations this element already uses, with what each sets.
|
|
136
|
+
|
|
137
|
+
## Editing text
|
|
138
|
+
|
|
139
|
+
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.
|
|
140
|
+
|
|
141
|
+
## Undo, discard and reloads
|
|
142
|
+
|
|
143
|
+
- **Cmd/Ctrl+Z** undoes, **Cmd/Ctrl+Shift+Z** (or Ctrl+Y) redoes. A whole drag is one step.
|
|
144
|
+
- **Discard** takes every unsent change off the page, as one undo step.
|
|
145
|
+
- Your changes survive reloads in the same browser tab, and stay previewed on the page until they're really in your code.
|
|
146
|
+
|
|
147
|
+
## Sending changes to your agent
|
|
148
|
+
|
|
149
|
+
- **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.
|
|
150
|
+
- 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 × to **stop** the job.
|
|
151
|
+
- 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.
|
|
152
|
+
- **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.
|
|
153
|
+
- The agent writes your changes in the project's own way (Tailwind classes, CSS modules, tokens…), never as inline styles.
|
|
154
|
+
|
|
155
|
+
## Comments
|
|
156
|
+
|
|
157
|
+
- **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).
|
|
158
|
+
- **Attach** images, text files or PDFs with the attach button, or drop them on the box.
|
|
159
|
+
- **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.
|
|
160
|
+
- 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.
|
|
161
|
+
- A thread with a reply to read shows a **comment icon** on its element and counts on the Comment button.
|
|
162
|
+
- **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.
|
|
163
|
+
- **Mark as solved** (or Option+Enter) closes the thread.
|
|
164
|
+
- **Stop** (beside send) cancels the job while the agent works.
|
|
165
|
+
|
|
166
|
+
## Skills and Pilot's tasks (the / list)
|
|
167
|
+
|
|
168
|
+
Type `/` at the start of a word in the comment box:
|
|
169
|
+
|
|
170
|
+
- **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.
|
|
171
|
+
- **Props**, on a component's instance: lists the props that change how it looks. Reply with a line like `tone: dark` to change one.
|
|
172
|
+
- **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.
|
|
173
|
+
|
|
174
|
+
## Mentions (@)
|
|
175
|
+
|
|
176
|
+
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.
|
|
177
|
+
|
|
178
|
+
## When the agent asks you something
|
|
179
|
+
|
|
180
|
+
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:
|
|
181
|
+
|
|
182
|
+
- **All of them** changes the component itself.
|
|
183
|
+
- **Only this** changes this one instance.
|
|
184
|
+
- **New variant** adds a named option to the component and uses it here.
|
|
185
|
+
|
|
186
|
+
Or 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.
|
|
187
|
+
|
|
188
|
+
Once 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.
|
|
189
|
+
|
|
190
|
+
## Measuring distances
|
|
191
|
+
|
|
192
|
+
With 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.
|
|
193
|
+
|
|
194
|
+
## The DOM tree
|
|
195
|
+
|
|
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.
|
|
197
|
+
|
|
198
|
+
## Keyboard shortcuts
|
|
199
|
+
|
|
200
|
+
| Keys | Does |
|
|
201
|
+
| --- | --- |
|
|
202
|
+
| **Option+P** (Alt+P) | Open Pilot; once open, hide and show it |
|
|
203
|
+
| **Option+V** / **Option+C** | Select tool / Comment tool |
|
|
204
|
+
| **Alt+D** | DOM tree |
|
|
205
|
+
| hold **Alt** | Measure distances |
|
|
206
|
+
| **Esc** | One step back: editor → search → clear search → close the dialog → turn the tool off |
|
|
207
|
+
| **Cmd/Ctrl+Z**, **Cmd/Ctrl+Shift+Z** | Undo, redo |
|
|
208
|
+
| **Tab** / **Enter** in the search | Into the editor |
|
|
209
|
+
| **Enter** in an editor | Apply, back to the search |
|
|
210
|
+
| **↑/↓**, **Shift+↑/↓** | Step a value by 1, by 10 (a token: along its scale) |
|
|
211
|
+
| **Tab** / **Shift+Tab** in an editor | Next / previous field |
|
|
212
|
+
| `/` at the start of the search | Modifiers (widths, states) |
|
|
213
|
+
| **Backspace** at the start of the search | Remove the last modifier |
|
|
214
|
+
| double-click a text | Edit it in place |
|
|
215
|
+
| **Shift+click** | Add to the selection |
|
|
216
|
+
| **Enter** / **Option+Enter** in a comment | Send / mark as solved |
|
|
217
|
+
|
|
218
|
+
The shortcuts with Option work in Pilot's own fields too, but not while you're typing in the page's fields.
|
|
219
|
+
|
|
220
|
+
## When something's wrong
|
|
221
|
+
|
|
222
|
+
Pilot 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.
|
|
223
|
+
|
|
224
|
+
- **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).
|
|
225
|
+
- **"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`).
|
|
226
|
+
- **"Sign in to …"**: 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)).
|
|
227
|
+
- **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.
|
|
228
|
+
- **"… couldn't do this job"**: the dev server's terminal (or the one running `npx usepilot`) shows what the agent said.
|
|
229
|
+
- **"… needs an update"**: your agent's command-line tool is too old for Pilot; run the command it gives.
|
|
230
|
+
- **"… has gone quiet"**: no sign of work for 2 minutes. Click to stop the job, then send again.
|
|
231
|
+
- **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).
|
|
232
|
+
- **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.
|
|
233
|
+
|
|
234
|
+
## What Pilot doesn't do (yet)
|
|
235
|
+
|
|
236
|
+
- It never edits your code itself, and never runs on your live site: the agent writes the code.
|
|
237
|
+
- No adding, moving or deleting elements from Pilot: ask in a comment.
|
|
238
|
+
- No forcing hover or focus on the page while editing those states (hide Pilot to try them).
|
|
239
|
+
- No values typed in the search (`pt-4` + Enter): search for the property, then type the value.
|
|
240
|
+
- No Copy prompt: everything goes through Pilot running for the project (with the dev server, or `npx usepilot`).
|
|
241
|
+
- Components are read in React and Vue only (not Svelte or Angular). Tailwind v3 config tokens aren't read.
|
|
242
|
+
- Props work on one component instance at a time.
|
|
243
|
+
|
|
244
|
+
## Commands and options
|
|
245
|
+
|
|
246
|
+
| Command | Does |
|
|
247
|
+
| --- | --- |
|
|
248
|
+
| `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` |
|
|
249
|
+
| `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 |
|
|
250
|
+
| `npx usepilot@latest init` | Set Pilot up in a project (ask your agent to run it) |
|
|
251
|
+
| `npx usepilot@latest update` | Update Pilot in this project |
|
|
252
|
+
| `npx usepilot guide` | Print this guide |
|
|
253
|
+
| `npx usepilot help` | List the commands |
|
|
254
|
+
|
|
255
|
+
Options, where your app loads Pilot:
|
|
256
|
+
|
|
257
|
+
```ts
|
|
258
|
+
import { mountPilot } from "usepilot";
|
|
259
|
+
|
|
260
|
+
mountPilot({
|
|
261
|
+
shortcut: "alt+p", // or "ctrl+shift+e", or false
|
|
262
|
+
launch: false, // true: open on load
|
|
263
|
+
nameAttributes: ["data-block"], // attributes your project names elements with
|
|
264
|
+
project: "my-app", // your package.json's name: npx usepilot runs for its own project's pages
|
|
265
|
+
});
|
|
266
|
+
```
|
package/README.md
CHANGED
|
@@ -14,33 +14,23 @@ Pilot turns the page you're building into a design surface for your agents. You
|
|
|
14
14
|
|
|
15
15
|
Pilot works with **Claude Code**, **Codex** or **Cursor**, on your agent's usual plan.
|
|
16
16
|
|
|
17
|
-
1. **
|
|
18
|
-
|
|
19
|
-
- **Claude Code:** `curl -fsSL https://claude.ai/install.sh | bash`, then `claude auth login`
|
|
20
|
-
- **Codex:** `npm install -g @openai/codex`, then `codex login`
|
|
21
|
-
- **Cursor:** `curl https://cursor.com/install -fsS | bash`, then `cursor-agent login`
|
|
22
|
-
|
|
23
|
-
Already using your agent in a terminal? Skip this step.
|
|
24
|
-
|
|
25
|
-
2. **Add Pilot to your project.** Paste this into your agent's chat, in the project:
|
|
17
|
+
1. **Paste this into your agent's chat**, in your project:
|
|
26
18
|
|
|
27
19
|
```
|
|
28
20
|
Set up Pilot in this project: run `npx usepilot@latest init` and follow what it prints.
|
|
29
21
|
```
|
|
30
22
|
|
|
31
|
-
|
|
23
|
+
Your agent adds Pilot to your app and sets it to start with your dev server, on your computer only: teammates who share the project don't get it until they run `npx usepilot init` themselves. 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).
|
|
32
24
|
|
|
33
|
-
|
|
25
|
+
2. **Restart your dev server** and open your app. Pilot appears on every page, and you can start designing right away.
|
|
34
26
|
|
|
35
|
-
|
|
36
|
-
npx usepilot
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
Keep it open next to your app, and open your app: Pilot appears on every page. Edit and press Send, or leave a comment: Pilot asks your agent to make the change, and the terminal shows its progress. It uses the agent you set Pilot up with (`npx usepilot --agent codex` switches).
|
|
27
|
+
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, then goes as soon as you've signed in. Already using your agent in a terminal? You're signed in already.
|
|
40
28
|
|
|
41
29
|
**What your agent can do:** edit your project's files, and anything you've already set it to always allow. Anything it would normally ask your permission for is refused, since no one is there to answer: its reply tells you.
|
|
42
30
|
|
|
43
|
-
|
|
31
|
+
Your dev server's terminal shows what Pilot and your agent are doing. **Option+P** (Alt+P on Windows and Linux) opens or hides Pilot in your app.
|
|
32
|
+
|
|
33
|
+
**A dev server Pilot can't start with?** Run `npx usepilot` in your project's folder, next to it, and keep it open.
|
|
44
34
|
|
|
45
35
|
### Updating
|
|
46
36
|
|
|
@@ -50,17 +40,20 @@ Run this in your project's folder:
|
|
|
50
40
|
npx usepilot@latest update
|
|
51
41
|
```
|
|
52
42
|
|
|
53
|
-
Then restart your app's dev server and `npx usepilot
|
|
43
|
+
Then restart your app's dev server (and `npx usepilot`, if you run it). Updating from 0.13 or earlier also removes Pilot's old setup in your agents (its MCP server and the `/pilot` skill): Pilot no longer runs inside a chat.
|
|
54
44
|
|
|
55
45
|
### If something doesn't work
|
|
56
46
|
|
|
57
47
|
- **The toolbar doesn't appear.** Pilot only loads in development, in the browser. Ask your agent to check where `usepilot/auto` is imported. The shortcut is ignored while you're typing in a text field.
|
|
58
|
-
- **The toolbar says "Pilot isn't running for …".**
|
|
59
|
-
- **The
|
|
48
|
+
- **The toolbar says "Pilot isn't running for …".** Restart your dev server: Pilot starts with it (its terminal says why, if it doesn't). Without that setup, run `npx usepilot` in your project's folder and keep it running. Its terminal says why it left the page: another project's page, or a page set up before 0.15 (ask your agent to run `npx usepilot@latest update`).
|
|
49
|
+
- **The sign-in page doesn't open**, or the sign-in doesn't finish. Sign in in a terminal instead: `claude auth login`, `codex login` or `cursor-agent login`. Pilot notices, and what you sent goes.
|
|
50
|
+
- **The toolbar says your agent couldn't do a job.** Your dev server's terminal (or the one running `npx usepilot`) shows what the agent said.
|
|
60
51
|
|
|
61
52
|
## Using Pilot
|
|
62
53
|
|
|
63
|
-
|
|
54
|
+
Everything Pilot does, task by task, is in the guide, which ships with Pilot: `npx usepilot guide` prints it for the version you have, and it's in your project at `node_modules/usepilot/GUIDE.md`. Ask your agent how to do something in Pilot and it can answer from there. The short version:
|
|
55
|
+
|
|
56
|
+
1. **Open your app** with its dev server running. Closed Pilot, or moved to another page? **Option+P** (Alt+P) opens it again.
|
|
64
57
|
2. **Select** with the cursor button in the toolbar, then click any element. Its property dialog opens next to it. Shift+click selects several, to edit them together.
|
|
65
58
|
3. **Search and edit.** Type a property (`p`, `pt`, `w`, `gap`, `display`, `aspect`…), press Tab to go into its editor, then type or drag a value. Cmd/Ctrl+Z undoes.
|
|
66
59
|
- Type `from-768 ` first to make the change only for some screen widths.
|