usepilot 0.4.0 → 0.5.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 CHANGED
@@ -1,104 +1,59 @@
1
1
  # Pilot
2
2
 
3
- **Take the controls from your coding agent and edit your UI in the browser.**
3
+ **Take the controls from your coding agent.**
4
4
 
5
- Pilot is a dev-only design overlay for your real app. Select an element,
6
- search a property the way you'd type a Tailwind class (`pt`, `gap-x`,
7
- `size`), adjust it in a visual editor and see the change live. Then send your
8
- changes to your coding agent: plain-CSS intent it translates into
9
- your project's own conventions (Tailwind classes, CSS modules, design tokens…).
10
- Pilot never edits your files.
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:
11
6
 
12
- > Early preview (0.x). Things will change between versions.
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
+ - **Comment.** Leave a note on an element ("make this feel less cramped") and get the agent's reply right there.
9
+ - **Ask for a task.** Use **Make responsive** on a section and the agent makes it work at every screen width.
13
10
 
14
- ## Install
15
-
16
- ```bash
17
- npm install -D usepilot
18
- ```
19
-
20
- Load it in development only. Pilot runs in its own Shadow DOM, so it doesn't
21
- touch your app's styles or framework.
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.
22
12
 
23
- **Vite (React, Vue, Svelte, plain…)**: in your app's entry file (`main.tsx`,
24
- `main.ts`…):
25
-
26
- ```ts
27
- if (import.meta.env.DEV) import("usepilot/auto");
28
- ```
13
+ > **Early preview (0.x).** It works, and things will change between versions.
29
14
 
30
- **Next.js (App Router)**: a small client component, rendered in your root
31
- layout:
15
+ ## Install
32
16
 
33
- ```tsx
34
- // app/pilot.tsx
35
- "use client";
36
- import { useEffect } from "react";
17
+ Paste this into your coding agent, in your project. Any agent that supports MCP works: Claude Code, Codex, Cursor, VS Code and others.
37
18
 
38
- export function Pilot() {
39
- useEffect(() => {
40
- if (process.env.NODE_ENV === "development") import("usepilot/auto");
41
- }, []);
42
- return null;
43
- }
44
19
  ```
45
-
46
- ```tsx
47
- // app/layout.tsx: inside <body>
48
- <Pilot />
20
+ Set up Pilot in this project: run `npx usepilot@latest init` and follow what it prints.
49
21
  ```
50
22
 
51
- **Anything else**: import `usepilot/auto` from code that only runs in the
52
- browser, in development.
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** (`/pilot` in Claude Code). It opens Pilot in your app.
53
24
 
54
- ## Hand the page over from your agent
25
+ Commit the files it adds (the MCP config for your agents, and Claude Code's `/pilot`), and everyone on the project gets Pilot.
55
26
 
56
- Pilot works with your coding agent: type `/pilot` in a chat, and Pilot opens
57
- in your app. Design, press **Send**, and the agent applies your edits while
58
- you keep going. Pilot shows each change until it's really in your code, and
59
- sends back to the agent what didn't land.
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.
60
28
 
61
- **For a repo you share**: from its root folder, then commit the two files it
62
- writes (`.claude/skills/pilot/SKILL.md` and `.mcp.json`), so everyone working
63
- in the repo gets `/pilot`:
64
-
65
- ```bash
66
- npx usepilot setup --project
67
- ```
68
-
69
- **Just for you, in every project** (nothing goes in the repo):
70
-
71
- ```bash
72
- npx usepilot setup
73
- claude mcp add --scope user pilot -- npx -y usepilot mcp
74
- ```
29
+ ### If something doesn't work
75
30
 
76
- (Other agents: add `npx -y usepilot mcp` as an MCP server in their settings.)
31
+ - **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.
32
+ - **The agent doesn't know Pilot.** Start a new chat: agents load their MCP servers when a chat starts. Some ask once to approve the project's server: say yes.
33
+ - **"Another Pilot version (bridge …) runs on port 4747".** Another open chat runs a different Pilot version. Update with `npx usepilot@latest init` and restart that chat.
77
34
 
78
- ## Use
35
+ ## Using Pilot
79
36
 
80
- 1. **Launch**: press **Option+P** (Alt+P) on any page of your app.
81
- 2. **Select**: click the cursor in the toolbar, then any element.
82
- 3. **Search and edit**: type a property (`p`, `pt`, `w`, `gap`, `display`,
83
- `aspect`…), Tab into its editor, type or drag a value. Cmd/Ctrl+Z undoes.
84
- Type `from-768 ` first to make the change for some viewport widths only.
85
- 4. **Send**: with an agent in `/pilot` mode, the second toolbar button sends
86
- your changes to it. Keep designing meanwhile; each change stops being
87
- previewed once it's in your code. Without an agent, the button copies
88
- your changes as a prompt to paste anywhere (Cmd/Ctrl+Z undoes them once
89
- they're applied).
37
+ 1. **Launch:** ask your agent to launch Pilot (`/pilot` in Claude Code), or press **Option+P** on any page of your app.
38
+ 2. **Select** with the cursor button in the toolbar, then click any element. Its property dialog opens next to it.
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
+ - Type `from-768 ` first to make the change only for some screen widths.
41
+ - Type `hover:` to change the hover state.
42
+ - Type `/` to see every modifier.
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. **Comment** with the speech-bubble tool: click an element and write to the agent.
45
+ 6. **Edit text** in place: with the cursor tool on, double-click it.
90
46
 
91
- Your changes survive reloads in the same browser tab. Quit with the toolbar's
92
- last button.
47
+ Your changes survive reloads in the same browser tab. Quit with the toolbar's last button.
93
48
 
94
- ## Options
49
+ ### Options
95
50
 
96
51
  ```ts
97
52
  import { mountPilot } from "usepilot";
98
53
 
99
54
  mountPilot({
100
- shortcut: "alt+p", // or "ctrl+shift+e", or false
101
- launch: false, // true: open on load
55
+ shortcut: "alt+p", // or "ctrl+shift+e", or false
56
+ launch: false, // true: open on load
102
57
  nameAttributes: ["data-block"], // attributes your project names elements with
103
58
  });
104
59
  ```