usepilot 0.5.0 → 0.6.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/README.md +6 -6
- package/cli/index.js +94 -29
- package/dist/{mount-C8kQoeYt.js → mount-mxONUQQO.js} +1596 -1480
- package/dist/pilot-auto.js +1 -1
- package/dist/pilot.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
Pilot lets you point at your running app and tell your coding agent exactly what to change. It runs inside your app in development, so you work on the real page with real data, not on a separate canvas:
|
|
6
6
|
|
|
7
7
|
- **Edit.** Select an element, type a property the way you'd type a Tailwind class (`pt`, `w`, `gap-x`), and set it with a visual control. You see the change live.
|
|
8
|
-
- **
|
|
9
|
-
- **
|
|
8
|
+
- **Ask for a change.** Click an element with the comment tool and say what you want, in your own words, with a screenshot or a file if it helps. The agent makes the change and tells you in a line what it did.
|
|
9
|
+
- **Run a task.** Type `/` in the comment box and pick one: **Make responsive** makes the element work at every screen width, and **Break and fix** tries it with odd content (very long text, missing or odd-shaped images) and fixes what breaks.
|
|
10
10
|
|
|
11
11
|
Then press **Send**. Your agent writes the changes into your code using your project's own conventions (Tailwind classes, CSS modules, design tokens). Pilot never edits your files itself. It checks the result on the page: what landed stops being previewed, and what didn't goes back to the agent. You see what the code does, not what the agent says it did.
|
|
12
12
|
|
|
@@ -20,9 +20,9 @@ Paste this into your coding agent, in your project. Any agent that supports MCP
|
|
|
20
20
|
Set up Pilot in this project: run `npx usepilot@latest init` and follow what it prints.
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
The agent installs Pilot as a dev dependency, connects itself to it, and loads it in your app, in development only. Then open a new chat and ask it to **launch Pilot
|
|
23
|
+
The agent installs Pilot as a dev dependency, connects itself to it, and loads it in your app, in development only. Then open a new chat and ask it to **launch Pilot**, or run its `/pilot` command (`$pilot` in Codex). Pilot opens in your app, connected to the agent.
|
|
24
24
|
|
|
25
|
-
Commit the files it adds
|
|
25
|
+
Commit the files it adds, and everyone on the project gets Pilot.
|
|
26
26
|
|
|
27
27
|
**No agent?** Run `npx usepilot@latest init` yourself and do the step it prints for loading Pilot. Then press **Option+P** (Alt+P on Windows and Linux) in your app, and **Copy prompt** hands your changes to any chat.
|
|
28
28
|
|
|
@@ -34,14 +34,14 @@ Commit the files it adds (the MCP config for your agents, and Claude Code's `/pi
|
|
|
34
34
|
|
|
35
35
|
## Using Pilot
|
|
36
36
|
|
|
37
|
-
1. **Launch:** ask your agent to launch Pilot
|
|
37
|
+
1. **Launch:** ask your agent to launch Pilot, or run `/pilot`. Pilot opens in your app, connected to the agent: everything you send goes to it, and it writes the code while you keep designing. Closed Pilot, or moved to another page? **Option+P** (Alt+P) opens it again, still connected while the agent's chat runs Pilot.
|
|
38
38
|
2. **Select** with the cursor button in the toolbar, then click any element. Its property dialog opens next to it.
|
|
39
39
|
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.
|
|
40
40
|
- Type `from-768 ` first to make the change only for some screen widths.
|
|
41
41
|
- Type `hover:` to change the hover state.
|
|
42
42
|
- Type `/` to see every modifier.
|
|
43
43
|
4. **Send** your changes to the agent with the toolbar's Send button. Keep designing while it works. Each change stays previewed until it's really in your code.
|
|
44
|
-
5. **
|
|
44
|
+
5. **Ask for a change** with the speech-bubble tool: click an element and tell the agent what to change. Type `/` there for tasks like Make responsive and Break and fix.
|
|
45
45
|
6. **Edit text** in place: with the cursor tool on, double-click it.
|
|
46
46
|
|
|
47
47
|
Your changes survive reloads in the same browser tab. Quit with the toolbar's last button.
|
package/cli/index.js
CHANGED
|
@@ -36696,6 +36696,7 @@ var ATTACHMENT_ACCEPT = [...new Set(Object.values(ATTACHMENT_TYPES))].join(",")
|
|
|
36696
36696
|
// ../protocol/src/format.ts
|
|
36697
36697
|
function formatPrompt(changeSet) {
|
|
36698
36698
|
if (changeSet.request?.kind === "responsive") return formatResponsive(changeSet, changeSet.request);
|
|
36699
|
+
if (changeSet.request?.kind === "break-and-fix") return formatBreakFix(changeSet, changeSet.request);
|
|
36699
36700
|
if (changeSet.request?.kind === "comment") return formatComment(changeSet, changeSet.request);
|
|
36700
36701
|
const { page, edits, note } = changeSet;
|
|
36701
36702
|
const lines = [
|
|
@@ -36723,6 +36724,52 @@ function formatPrompt(changeSet) {
|
|
|
36723
36724
|
`;
|
|
36724
36725
|
}
|
|
36725
36726
|
var ADVANCED_TASK = '**An advanced task: it needs judgment more than speed.** If you can hand work to a more capable model and aren\'t running on one, do: in Claude Code, unless you already run on Opus, give this whole prompt (with the job id) to a subagent with `model: "opus"` (the Agent tool), have it make the changes and run the width check, and report back; then call `pilot_done` with its notes.';
|
|
36727
|
+
var ACTION_ASKED = {
|
|
36728
|
+
responsive: "asked you to make it responsive",
|
|
36729
|
+
"break-and-fix": "asked you to break and fix it"
|
|
36730
|
+
};
|
|
36731
|
+
function formatBreakFix(changeSet, request) {
|
|
36732
|
+
const { page, note } = changeSet;
|
|
36733
|
+
const { target, breakpoints } = request;
|
|
36734
|
+
const widths = breakpoints.length ? breakpoints.map((b) => `${b}px`).join(", ") : "none found (it may use container queries, or none yet)";
|
|
36735
|
+
const lines = [
|
|
36736
|
+
"# Pilot: break and fix",
|
|
36737
|
+
"",
|
|
36738
|
+
"A designer selected the element below in the browser with Pilot and asked you to stress-test it: make sure it holds up with real-world content, not only the placeholder values it was built with, and fix what breaks. Content should never break the layout.",
|
|
36739
|
+
"",
|
|
36740
|
+
`Page: ${page.url} (${page.title || "untitled"}), seen at ${page.viewport.width}x${page.viewport.height}`,
|
|
36741
|
+
`The page's breakpoints (the widths its media queries test): ${widths}`,
|
|
36742
|
+
"",
|
|
36743
|
+
ADVANCED_TASK
|
|
36744
|
+
];
|
|
36745
|
+
if (note?.trim()) lines.push("", `Designer note: ${note.trim()}`);
|
|
36746
|
+
if (request.attachments?.length) lines.push("", ...attachmentLines(request.attachments, `The designer attached ${countFiles(request.attachments.length)}:`));
|
|
36747
|
+
lines.push(
|
|
36748
|
+
"",
|
|
36749
|
+
`## \`${target.path}\``,
|
|
36750
|
+
"",
|
|
36751
|
+
...targetLines(target),
|
|
36752
|
+
"",
|
|
36753
|
+
"## How to do it",
|
|
36754
|
+
"",
|
|
36755
|
+
"1. **Find the element's component and where its content comes from**: props, data, a CMS or an API, translations. List what can vary: each text, how many repeated items there are, optional parts (an image, a subtitle, a badge), numbers, names, URLs.",
|
|
36756
|
+
"2. **Think of the odd but realistic content each can get**: text far longer than the placeholder (a 120-character title, a long person or product name) and much shorter or empty; long words with no spaces (URLs, emails, IDs, compound words); optional parts missing (no image, no subtitle, an empty list) and many repeated items instead of a few; big numbers and prices; the longer strings of other languages; images (and background images) in odd shapes, very wide, very tall, tiny or low-resolution, and images that fail to load.",
|
|
36757
|
+
"3. **Break it on purpose, temporarily**: put that content in the page (the props, the fixture or data it renders, or the markup), let hot reload show it, and run `pilot_check_widths` with this job's id. It measures the element at every width in the designer's page and reports, as numbers, content sticking out of the viewport, spilling out of its parent, clipped, or overlapping. Read the code too, for what the check can't see: items that shrink when they shouldn't (an icon or avatar squeezed by flex), buttons that stretch, rows that misalign, text wrapping under an icon, images stretched or squashed (a distorted image keeps its box, so the check doesn't report it).",
|
|
36758
|
+
"4. **Fix what breaks, without changing how it looks with its usual content**, the way this project does it (its utilities, its components):",
|
|
36759
|
+
" - **Long text:** truncate it with an ellipsis (`truncate`, `text-overflow: ellipsis`) where one line matters, or clamp it to a few lines (`line-clamp-*`) where it can wrap; when the full text is lost, show it on hover (`title`, or the project's tooltip).",
|
|
36760
|
+
" - **Flex and grid:** `min-width: 0` (`min-w-0`) on items holding text so they can shrink; `flex-shrink: 0` (`shrink-0`) on icons, avatars and buttons that mustn't; `minmax(0, 1fr)` columns; wrapping rows (`flex-wrap`) instead of overflowing ones.",
|
|
36761
|
+
" - **Long words:** `overflow-wrap: anywhere` (`break-words`) where text must wrap.",
|
|
36762
|
+
" - **Images:** `object-fit: cover` for photos that should fill their frame, `contain` where cropping would lose something (logos, product shots); for background images, `background-size: cover` (or `contain`) with a sensible `background-position`. A fixed `aspect-ratio` (or size) on the frame, so the layout doesn't jump while an image loads or when its shape is odd, and a fallback when it fails or is missing (a plain background, initials, an icon), never a broken-image box.",
|
|
36763
|
+
" - **Missing parts:** no gap or empty box left behind; a simple empty state only where one is clearly needed.",
|
|
36764
|
+
" In the check, an ellipsis on your deliberately long text is the fix working, not a problem.",
|
|
36765
|
+
"5. **Put the real content back.** Remove every temporary value you added: nothing of the test may stay in the code. Then run `pilot_check_widths` again: with its usual content, the element must look as it did at the designer's width (the check reports any change there).",
|
|
36766
|
+
"6. **Report** in your notes, in a line or two, what broke and how you fixed it, and anything for the designer to decide (a content limit to agree on, an empty state to design). When you report it done, Pilot runs the width check once more, with the usual content: problems come back to you once, as a follow-up.",
|
|
36767
|
+
"",
|
|
36768
|
+
"Change only this element and what it needs (its children, its container). If it's a shared component, fix it there, so every instance gets sturdier, as long as its usual look doesn't change; ask before anything that would. Never leave inline styles."
|
|
36769
|
+
);
|
|
36770
|
+
return `${lines.join("\n")}
|
|
36771
|
+
`;
|
|
36772
|
+
}
|
|
36726
36773
|
function formatResponsive(changeSet, request) {
|
|
36727
36774
|
const { page, note } = changeSet;
|
|
36728
36775
|
const { target, breakpoints } = request;
|
|
@@ -36738,6 +36785,7 @@ function formatResponsive(changeSet, request) {
|
|
|
36738
36785
|
ADVANCED_TASK
|
|
36739
36786
|
];
|
|
36740
36787
|
if (note?.trim()) lines.push("", `Designer note: ${note.trim()}`);
|
|
36788
|
+
if (request.attachments?.length) lines.push("", ...attachmentLines(request.attachments, `The designer attached ${countFiles(request.attachments.length)}:`));
|
|
36741
36789
|
lines.push(
|
|
36742
36790
|
"",
|
|
36743
36791
|
`## \`${target.path}\``,
|
|
@@ -36784,7 +36832,8 @@ function formatComment(changeSet, request) {
|
|
|
36784
36832
|
lines.push("", "## The thread so far (you already did what it asked)", "");
|
|
36785
36833
|
for (const m of earlier) {
|
|
36786
36834
|
const files = m.attachments?.length ? ` (${countFiles(m.attachments.length)})` : "";
|
|
36787
|
-
|
|
36835
|
+
const action = m.action ? ` (${ACTION_ASKED[m.action]})` : "";
|
|
36836
|
+
lines.push(`- **${m.from === "designer" ? "Designer" : "You"}:**${action}${files} ${m.text.replace(/\s*\n\s*/g, " ")}`.trimEnd());
|
|
36788
36837
|
}
|
|
36789
36838
|
}
|
|
36790
36839
|
lines.push(
|
|
@@ -36811,14 +36860,18 @@ function commentLines(message) {
|
|
|
36811
36860
|
out.push(
|
|
36812
36861
|
text ? `The designer attached ${countFiles(files.length)} to it:` : `The comment is ${countFiles(files.length)}, with no words. ${one ? "It" : "They"} may hold the instructions: a screenshot, a sketch, notes, a spec. If it's unclear what to do, ask in your reply instead of guessing.`,
|
|
36813
36862
|
"",
|
|
36814
|
-
...files
|
|
36815
|
-
const kind = attachmentKind(file2.id);
|
|
36816
|
-
const how = kind === "pdf" ? "a PDF: open it at this path" : kind === "image" ? "an image, shown with this job" : "a text file, its contents shown with this job";
|
|
36817
|
-
return `- ${file2.name ? `${file2.name} ` : ""}(${how}): \`${file2.path ?? file2.id}\``;
|
|
36818
|
-
})
|
|
36863
|
+
...attachmentLines(files)
|
|
36819
36864
|
);
|
|
36820
36865
|
return out;
|
|
36821
36866
|
}
|
|
36867
|
+
function attachmentLines(files, intro) {
|
|
36868
|
+
const lines = files.map((file2) => {
|
|
36869
|
+
const kind = attachmentKind(file2.id);
|
|
36870
|
+
const how = kind === "pdf" ? "a PDF: open it at this path" : kind === "image" ? "an image, shown with this job" : "a text file, its contents shown with this job";
|
|
36871
|
+
return `- ${file2.name ? `${file2.name} ` : ""}(${how}): \`${file2.path ?? file2.id}\``;
|
|
36872
|
+
});
|
|
36873
|
+
return intro ? [intro, "", ...lines] : lines;
|
|
36874
|
+
}
|
|
36822
36875
|
function countFiles(n) {
|
|
36823
36876
|
return n === 1 ? "a file" : `${n} files`;
|
|
36824
36877
|
}
|
|
@@ -36979,23 +37032,29 @@ async function saveAttachment(bytes, type, dir = attachmentsDir()) {
|
|
|
36979
37032
|
}
|
|
36980
37033
|
function withAttachmentPaths(job, dir = attachmentsDir()) {
|
|
36981
37034
|
const request = job.changeSet.request;
|
|
36982
|
-
|
|
36983
|
-
|
|
36984
|
-
|
|
36985
|
-
const attachments = message.attachments.filter((file2) => typeof file2?.id === "string" && ATTACHMENT_ID.test(file2.id) && existsSync(join(dir, file2.id))).slice(0, 20).map((file2) => ({
|
|
37035
|
+
const kept = (files) => {
|
|
37036
|
+
if (!Array.isArray(files)) return void 0;
|
|
37037
|
+
const valid = files.filter((file2) => typeof file2?.id === "string" && ATTACHMENT_ID.test(file2.id) && existsSync(join(dir, file2.id))).slice(0, 20).map((file2) => ({
|
|
36986
37038
|
id: file2.id,
|
|
36987
37039
|
name: typeof file2.name === "string" ? file2.name.slice(0, 200) : void 0,
|
|
36988
37040
|
path: join(dir, file2.id)
|
|
36989
37041
|
}));
|
|
36990
|
-
return
|
|
36991
|
-
}
|
|
37042
|
+
return valid.length ? valid : void 0;
|
|
37043
|
+
};
|
|
37044
|
+
if (request && request.kind !== "comment")
|
|
37045
|
+
return { ...job, changeSet: { ...job.changeSet, request: { ...request, attachments: kept(request.attachments) } } };
|
|
37046
|
+
if (request?.kind !== "comment") return job;
|
|
37047
|
+
const thread = request.thread.map((message) => message.attachments ? { ...message, attachments: kept(message.attachments) } : message);
|
|
36992
37048
|
return { ...job, changeSet: { ...job.changeSet, request: { ...request, thread } } };
|
|
36993
37049
|
}
|
|
36994
37050
|
async function attachmentBlocks(job) {
|
|
36995
37051
|
const request = job.changeSet.request;
|
|
36996
|
-
|
|
36997
|
-
|
|
36998
|
-
|
|
37052
|
+
let files;
|
|
37053
|
+
if (request && request.kind !== "comment") files = request.attachments ?? [];
|
|
37054
|
+
else if (request?.kind === "comment") {
|
|
37055
|
+
const lastReply = request.thread.map((m) => m.from).lastIndexOf("agent");
|
|
37056
|
+
files = request.thread.slice(lastReply + 1).flatMap((m) => m.attachments ?? []);
|
|
37057
|
+
} else return [];
|
|
36999
37058
|
const blocks = [];
|
|
37000
37059
|
for (const file2 of files) {
|
|
37001
37060
|
const path = file2.path;
|
|
@@ -37657,7 +37716,7 @@ var INSTRUCTIONS = `Pilot lets the designer edit the running app in the browser
|
|
|
37657
37716
|
The loop, when the user asks to launch or start Pilot, runs /pilot, or asks to hand the design over:
|
|
37658
37717
|
1. Find the page: the URL of the app's dev server, from the dev script and its config (vite.config \u2192 server.port, Next.js \u2192 3000, a --port flag\u2026) or a server already running. If it isn't running, start it in the background; if you can't tell the URL, ask. Call pilot_launch with that URL: Pilot opens in that page (if the page isn't open, tell the user to open it), then tell the user in one line that Pilot is ready: select an element, edit, press Send.
|
|
37659
37718
|
2. Call pilot_wait_for_edits. It returns a job when the designer presses Send, or "no edits yet" after a while: then call it again. (In Claude Code a long wait moves to the background: the job arrives as its result.)
|
|
37660
|
-
3. Apply the job's edits to the source, in the project's conventions (see the job's guidelines). Edits are basic: every value is given, so be fast (no screenshots or browser checks: Pilot checks the page). A "make responsive" job is an advanced task: make one element work at every viewport width.
|
|
37719
|
+
3. Apply the job's edits to the source, in the project's conventions (see the job's guidelines). Edits are basic: every value is given, so be fast (no screenshots or browser checks: Pilot checks the page). A "make responsive" job is an advanced task: make one element work at every viewport width. A "break and fix" job is one too: stress-test one element with odd but realistic content, fix what breaks, and put the real content back. Their prompts list the steps; check the result with pilot_check_widths (numbers for every width, instead of screenshots). In Claude Code, hand advanced tasks to an Opus subagent unless you run on Opus. A "comment" job is the designer's own words about one element: do what it asks (simple asks right away, open-ended ones as advanced tasks), and your pilot_done notes are your reply in their thread: one short sentence, like a chat message, not a report.
|
|
37661
37720
|
4. Call pilot_done with the job id and short notes (values you approximated, anything you did differently). Then call pilot_wait_for_edits again.
|
|
37662
37721
|
|
|
37663
37722
|
Keep looping until the user interrupts you. Pilot keeps previewing each job's changes until you call pilot_done, then checks them against the page's real CSS: changes that didn't land come back once as a follow-up job with what the page gives instead.`;
|
|
@@ -37705,16 +37764,20 @@ function notesFor(job) {
|
|
|
37705
37764
|
return "your reply in the designer's comment thread, a small chat box: one short sentence, about 120 characters at most, with what you changed or your answer; no lists or code blocks";
|
|
37706
37765
|
case "responsive":
|
|
37707
37766
|
return "what changed at which widths, anything left for the designer";
|
|
37767
|
+
case "break-and-fix":
|
|
37768
|
+
return "what broke and how you fixed it, anything for the designer to decide";
|
|
37708
37769
|
default:
|
|
37709
37770
|
return "values you approximated, anything you did differently";
|
|
37710
37771
|
}
|
|
37711
37772
|
}
|
|
37712
37773
|
function taskFollowUp(job) {
|
|
37713
|
-
const
|
|
37774
|
+
const request = job.changeSet.request;
|
|
37775
|
+
const target = `\`${request?.target.path ?? "the element"}\``;
|
|
37776
|
+
const breakFix = request?.kind === "break-and-fix";
|
|
37714
37777
|
const lines = [
|
|
37715
|
-
"# Pilot: make responsive, follow-up",
|
|
37778
|
+
breakFix ? "# Pilot: break and fix, follow-up" : "# Pilot: make responsive, follow-up",
|
|
37716
37779
|
"",
|
|
37717
|
-
`You
|
|
37780
|
+
breakFix ? `You stress-tested ${target} and reported it done, but Pilot's width check (the page with its usual content, measured at each width) finds these problems. If one comes from test content still in the code, remove it:` : `You made ${target} responsive, but Pilot's width check (the page measured at each width) still finds these problems:`,
|
|
37718
37781
|
"",
|
|
37719
37782
|
...(job.issues ?? []).map((i) => `- ${i}`),
|
|
37720
37783
|
"",
|
|
@@ -37730,7 +37793,7 @@ function createPilotServer(options = {}) {
|
|
|
37730
37793
|
const port = options.port ?? (Number(process.env.PILOT_PORT) || DEFAULT_BRIDGE_PORT);
|
|
37731
37794
|
const cwd = options.cwd ?? process.cwd();
|
|
37732
37795
|
let waitMs = options.waitMs ?? waitMsFor(void 0);
|
|
37733
|
-
const server = new McpServer({ name: "pilot", version: "0.
|
|
37796
|
+
const server = new McpServer({ name: "pilot", version: "0.6.0" }, { instructions: INSTRUCTIONS });
|
|
37734
37797
|
const agent = { id: randomUUID2(), label: agentLabel(void 0, cwd) };
|
|
37735
37798
|
const bridge = new Bridge(agent, port);
|
|
37736
37799
|
let origin = null;
|
|
@@ -37815,9 +37878,9 @@ function createPilotServer(options = {}) {
|
|
|
37815
37878
|
"pilot_check_widths",
|
|
37816
37879
|
{
|
|
37817
37880
|
title: "Check an element at every width",
|
|
37818
|
-
description: "For a Make responsive job: Pilot loads the page in hidden frames at a phone width, each breakpoint and just below it, a wide desktop and the designer's width, and measures the job's element in each. Returns each width's size and layout, and problems (sticking out of the viewport, spilling out of its parent, clipped content, overlaps), plus what changed at the designer's width. Use it instead of screenshots; fix the problems and run it again until it finds none.",
|
|
37881
|
+
description: "For a Make responsive or Break and fix job: Pilot loads the page in hidden frames at a phone width, each breakpoint and just below it, a wide desktop and the designer's width, and measures the job's element in each. Returns each width's size and layout, and problems (sticking out of the viewport, spilling out of its parent, clipped content, overlaps), plus what changed at the designer's width. Use it instead of screenshots; fix the problems and run it again until it finds none.",
|
|
37819
37882
|
inputSchema: {
|
|
37820
|
-
jobId: external_exports.string().describe("The Make responsive job's id, from pilot_wait_for_edits.")
|
|
37883
|
+
jobId: external_exports.string().describe("The Make responsive or Break and fix job's id, from pilot_wait_for_edits.")
|
|
37821
37884
|
}
|
|
37822
37885
|
},
|
|
37823
37886
|
async ({ jobId }) => {
|
|
@@ -37825,7 +37888,7 @@ function createPilotServer(options = {}) {
|
|
|
37825
37888
|
const check2 = await bridge.check(jobId);
|
|
37826
37889
|
if (!check2) {
|
|
37827
37890
|
return text(
|
|
37828
|
-
`Pilot couldn't check job ${jobId}: no page answered. The page with Pilot must be open (the designer's tab), and the job must be a Make responsive one. If you can, check the widths in a browser instead.`,
|
|
37891
|
+
`Pilot couldn't check job ${jobId}: no page answered. The page with Pilot must be open (the designer's tab), and the job must be a Make responsive or Break and fix one. If you can, check the widths in a browser instead.`,
|
|
37829
37892
|
true
|
|
37830
37893
|
);
|
|
37831
37894
|
}
|
|
@@ -37851,7 +37914,7 @@ import { homedir } from "os";
|
|
|
37851
37914
|
import { join as join2, relative } from "path";
|
|
37852
37915
|
|
|
37853
37916
|
// ../../skills/pilot/SKILL.md
|
|
37854
|
-
var SKILL_default = "---\nname: pilot\ndescription: Hand the UI to the designer with Pilot, then apply the design edits they send, job after job. Use when the user runs /pilot, says they want to take control of the design or edit the UI in the browser, or pastes a \"Pilot design edits\" brief.\n---\n\n# Pilot\n\nPilot lets the designer edit the running app in the browser. They select elements, change CSS properties with Pilot's editors, and press **Send**. Each Send reaches you as a **job**: plain CSS `property: from \u2192 to` (and new text, when they rewrote one) on identifiable elements, for you to write into the source in this project's conventions. The designer keeps designing while you work; Pilot previews each job's changes until you report it done, then checks them against the page's real CSS.\n\n## When the user runs /pilot\n\n1. **Find the page.** Work out the URL of the app's dev server: the dev script and its config (`vite.config.*` \u2192 `server.port`, Next.js \u2192 3000, a `--port` flag\u2026), or a server already running in a terminal. If the dev server isn't running, start it in the background. If you can't tell the URL, ask.\n2. **Launch:** call `pilot_launch` with that URL. Pilot opens in the page (if the page isn't open yet, tell the designer to open it).\n3. **Tell the designer** in one line that Pilot is ready: select an element, edit, press Send.\n4. **Wait:** call `pilot_wait_for_edits`. It returns a job when the designer presses Send, or \"no edits yet\" after a while: call it again, without saying anything to the user. In Claude Code, a wait longer than two minutes moves to the background: end your turn with a short \"Waiting for your edits\", and the job arrives as the task's result.\n5. **Apply the job** (below), then call `pilot_done` with the job id and short notes, and go back to step 4.\n\nKeep looping until the user asks you to stop. Keep your messages between jobs short: a line on what you changed (and anything you approximated) is enough. If the user talks to you meanwhile, help them, and keep (or start again) a wait in the background so their next Send reaches you (queued jobs are kept).\n\n## Applying a job\n\nJobs come in three kinds:\n\n- **Edits** (basic): the designer set every value; you only translate them. **Speed is what matters**: go straight to the code, apply, call `pilot_done`. No screenshots, browser checks, builds or tests: Pilot checks the page itself and sends back what didn't land.\n- **Comments**: the designer's own words about one element (\"make it the brand green\", \"can this be calmer?\"), with the thread so far. Do what the latest one asks: a specific, small ask right away (like an edit), an open-ended one as an advanced task (below). A question gets an answer and no change. Your `pilot_done` notes are your reply in their thread, a small chat box for quick design back-and-forth: one short sentence, like a chat message (about 120 characters), with no lists or code blocks. Not a report: they see the result on the page.\n- **Tasks** (advanced), like **Make responsive**: the designer selected an element and asked for an outcome (work at every viewport width). They need judgment more than speed. The prompt has the steps. Check the result with `pilot_check_widths` (numbers for every width, no screenshots needed). In Claude Code, unless you already run on Opus, hand the task to a subagent with `model: \"opus\"`, then call `pilot_done` with its notes. Pilot checks the widths again when you're done; problems come back once as a follow-up.\n\n### Edits\n\nThe values are **intent, not code**. Translate them into this project's conventions:\n\n- **Tailwind:** the closest utility or theme value (`border-radius: 12px` \u2192 `rounded-xl`, `padding-top: 24px` \u2192 `pt-6`). Arbitrary values only when nothing fits.\n- **CSS / CSS modules / Sass:** edit the rule that styles the element. Don't add a new override.\n- **Design tokens / CSS variables:** prefer an existing token that matches. Don't hard-code its value.\n- **CSS-in-JS:** edit the styled definition or `sx` / `style` object where the component is styled.\n\nRules:\n\n- Never leave inline styles behind. Pilot's preview is only a preview.\n- Find each element by its selector, DOM path and text snippet, then the component that renders it.\n- If an element comes from a shared component, ask before changing every instance. Otherwise scope the change (a variant, a prop, a class on that use).\n- **Widths:** a change for some viewport widths goes in a media query; use the project's breakpoints when one matches (or is within a few pixels). \"Every width\" means no media query should override it.\n- **Removed:** the element shouldn't declare the property at all (not `0` or `none`).\n- **Text:** the designer rewrote the element's copy. Change it where it comes from (the markup, a prop, a translation file), for this element only; Pilot checks that the page shows the new text.\n- If you approximated a value to fit a token or scale, say which and by how much in `pilot_done`'s notes (`22px \u2192 pt-6, 24px`). Pilot checks the page after each job: a change that doesn't give the designer's value comes back to you once as a follow-up. Fix it, or keep a deliberate choice and say why; after that, Pilot takes what the code gives.\n- Don't run builds or tests for a job unless it's needed: hot reload shows the result, and the designer is waiting to see it.\n";
|
|
37917
|
+
var SKILL_default = "---\nname: pilot\ndescription: Hand the UI to the designer with Pilot, then apply the design edits they send, job after job. Use when the user runs /pilot, says they want to take control of the design or edit the UI in the browser, or pastes a \"Pilot design edits\" brief.\n---\n\n# Pilot\n\nPilot lets the designer edit the running app in the browser. They select elements, change CSS properties with Pilot's editors, and press **Send**. Each Send reaches you as a **job**: plain CSS `property: from \u2192 to` (and new text, when they rewrote one) on identifiable elements, for you to write into the source in this project's conventions. The designer keeps designing while you work; Pilot previews each job's changes until you report it done, then checks them against the page's real CSS.\n\n## When the user runs /pilot (or asks to launch Pilot)\n\n1. **Find the page.** Work out the URL of the app's dev server: the dev script and its config (`vite.config.*` \u2192 `server.port`, Next.js \u2192 3000, a `--port` flag\u2026), or a server already running in a terminal. If the dev server isn't running, start it in the background. If you can't tell the URL, ask.\n2. **Launch:** call `pilot_launch` with that URL. Pilot opens in the page (if the page isn't open yet, tell the designer to open it).\n3. **Tell the designer** in one line that Pilot is ready: select an element, edit, press Send.\n4. **Wait:** call `pilot_wait_for_edits`. It returns a job when the designer presses Send, or \"no edits yet\" after a while: call it again, without saying anything to the user. In Claude Code, a wait longer than two minutes moves to the background: end your turn with a short \"Waiting for your edits\", and the job arrives as the task's result.\n5. **Apply the job** (below), then call `pilot_done` with the job id and short notes, and go back to step 4.\n\nKeep looping until the user asks you to stop. Keep your messages between jobs short: a line on what you changed (and anything you approximated) is enough. If the user talks to you meanwhile, help them, and keep (or start again) a wait in the background so their next Send reaches you (queued jobs are kept).\n\n## Applying a job\n\nJobs come in three kinds:\n\n- **Edits** (basic): the designer set every value; you only translate them. **Speed is what matters**: go straight to the code, apply, call `pilot_done`. No screenshots, browser checks, builds or tests: Pilot checks the page itself and sends back what didn't land.\n- **Comments**: the designer's own words about one element (\"make it the brand green\", \"can this be calmer?\"), with the thread so far. Do what the latest one asks: a specific, small ask right away (like an edit), an open-ended one as an advanced task (below). A question gets an answer and no change. Your `pilot_done` notes are your reply in their thread, a small chat box for quick design back-and-forth: one short sentence, like a chat message (about 120 characters), with no lists or code blocks. Not a report: they see the result on the page.\n- **Tasks** (advanced), like **Make responsive** and **Break and fix**: the designer selected an element and asked for an outcome (work at every viewport width; hold up with odd but realistic content, like very long text, with the real content put back after testing). They need judgment more than speed. The prompt has the steps. Check the result with `pilot_check_widths` (numbers for every width, no screenshots needed). In Claude Code, unless you already run on Opus, hand the task to a subagent with `model: \"opus\"`, then call `pilot_done` with its notes. Pilot checks the widths again when you're done; problems come back once as a follow-up.\n\n### Edits\n\nThe values are **intent, not code**. Translate them into this project's conventions:\n\n- **Tailwind:** the closest utility or theme value (`border-radius: 12px` \u2192 `rounded-xl`, `padding-top: 24px` \u2192 `pt-6`). Arbitrary values only when nothing fits.\n- **CSS / CSS modules / Sass:** edit the rule that styles the element. Don't add a new override.\n- **Design tokens / CSS variables:** prefer an existing token that matches. Don't hard-code its value.\n- **CSS-in-JS:** edit the styled definition or `sx` / `style` object where the component is styled.\n\nRules:\n\n- Never leave inline styles behind. Pilot's preview is only a preview.\n- Find each element by its selector, DOM path and text snippet, then the component that renders it.\n- If an element comes from a shared component, ask before changing every instance. Otherwise scope the change (a variant, a prop, a class on that use).\n- **Widths:** a change for some viewport widths goes in a media query; use the project's breakpoints when one matches (or is within a few pixels). \"Every width\" means no media query should override it.\n- **Removed:** the element shouldn't declare the property at all (not `0` or `none`).\n- **Text:** the designer rewrote the element's copy. Change it where it comes from (the markup, a prop, a translation file), for this element only; Pilot checks that the page shows the new text.\n- If you approximated a value to fit a token or scale, say which and by how much in `pilot_done`'s notes (`22px \u2192 pt-6, 24px`). Pilot checks the page after each job: a change that doesn't give the designer's value comes back to you once as a follow-up. Fix it, or keep a deliberate choice and say why; after that, Pilot takes what the code gives.\n- Don't run builds or tests for a job unless it's needed: hot reload shows the result, and the designer is waiting to see it.\n";
|
|
37855
37918
|
|
|
37856
37919
|
// src/setup.ts
|
|
37857
37920
|
var MCP_SERVER = { command: "npx", args: ["-y", "usepilot", "mcp"] };
|
|
@@ -37930,6 +37993,7 @@ var CLIENTS = [
|
|
|
37930
37993
|
{ name: "VS Code", file: join3(".vscode", "mcp.json"), key: "servers", entry: { type: "stdio", ...MCP_SERVER } }
|
|
37931
37994
|
];
|
|
37932
37995
|
var COMMAND = `${MCP_SERVER.command} ${MCP_SERVER.args.join(" ")}`;
|
|
37996
|
+
var SKILL_FOLDERS = [join3(".agents", "skills"), join3(".claude", "skills"), join3(".github", "skills")];
|
|
37933
37997
|
async function init(options = {}) {
|
|
37934
37998
|
const cwd = options.cwd ?? process.cwd();
|
|
37935
37999
|
const run = options.run ?? runCommand;
|
|
@@ -37973,15 +38037,16 @@ ${apps.map((a) => `- ${a}`).join("\n")}` : "."}
|
|
|
37973
38037
|
else registered.push(`${client.name} (\`${relative2(root, file2)}\`)`);
|
|
37974
38038
|
}
|
|
37975
38039
|
if (registered.length) done.push(`Registered Pilot's MCP server for ${list(registered)}.`);
|
|
37976
|
-
const
|
|
37977
|
-
done.push(`Added the \`/pilot\`
|
|
38040
|
+
for (const folder of SKILL_FOLDERS) await writeSkill(join3(root, folder, "pilot"));
|
|
38041
|
+
done.push(`Added the \`pilot\` skill (\`/pilot\`; \`$pilot\` in Codex) where agents read skills: ${list(SKILL_FOLDERS.map((f) => `\`${f}/pilot/\``))}.`);
|
|
37978
38042
|
if (framework.loads) done.push(`The app already loads Pilot (\`${relative2(cwd, framework.loads)}\`).`);
|
|
37979
38043
|
else todo.push(loadStep(framework, cwd));
|
|
37980
38044
|
todo.push(
|
|
37981
38045
|
`**If you aren't Claude Code, Cursor or VS Code**, register Pilot's MCP server with yourself too, named \`pilot\`, running \`${COMMAND}\`. Codex: \`codex mcp add pilot -- ${COMMAND}\`. Others: their MCP settings.`,
|
|
37982
|
-
`**Tell the user**, in a few lines: Pilot is set up. To start, open a new chat (agents load MCP servers when a chat starts; some ask once to approve the project's server), then ask to launch Pilot
|
|
37983
|
-
|
|
37984
|
-
|
|
38046
|
+
`**Tell the user**, in a few lines: Pilot is set up. To start, open a new chat (agents load MCP servers when a chat starts; some ask once to approve the project's server), then ask to launch Pilot, or run \`/pilot\` (\`$pilot\` in Codex). The new files (${list([
|
|
38047
|
+
...CLIENTS.map((c) => `\`${c.file}\``),
|
|
38048
|
+
...SKILL_FOLDERS.map((f) => `\`${f}/pilot/\``)
|
|
38049
|
+
])}) can be committed, so everyone on the project gets it. Without an agent, Option+P (Alt+P) in the app opens Pilot, and Copy prompt hands the changes over.`
|
|
37985
38050
|
);
|
|
37986
38051
|
return `# Pilot: set up
|
|
37987
38052
|
|