leglas 0.2.0 → 0.4.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 +125 -24
- package/dist/bin.js +1084 -242
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1084 -238
- package/dist/shell/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/dist/shell/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/dist/shell/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/dist/shell/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/dist/shell/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/dist/shell/assets/index-BQHDjn0q.css +1 -0
- package/dist/shell/assets/index-T-uR7kT7.js +14 -0
- package/dist/shell/index.html +2 -2
- package/dist/watch.d.ts +2 -45
- package/package.json +3 -3
- package/dist/shell/assets/index-dMGYwlE1.css +0 -1
- package/dist/shell/assets/index-r7sGM7WL.js +0 -10
- package/dist/shell/assets/manrope-cyrillic-wght-normal-Dvxsihut.woff2 +0 -0
- package/dist/shell/assets/manrope-greek-wght-normal-DL7QRZyv.woff2 +0 -0
- package/dist/shell/assets/manrope-latin-ext-wght-normal-Ch3YOpNY.woff2 +0 -0
- package/dist/shell/assets/manrope-latin-wght-normal-DHIcAJRg.woff2 +0 -0
- package/dist/shell/assets/manrope-vietnamese-wght-normal-usUDDRr7.woff2 +0 -0
package/README.md
CHANGED
|
@@ -14,6 +14,12 @@
|
|
|
14
14
|
<a href="LICENSE"><img src="https://img.shields.io/npm/l/leglas" alt="license"></a>
|
|
15
15
|
</p>
|
|
16
16
|
|
|
17
|
+
<p align="center">
|
|
18
|
+
<img src="https://raw.githubusercontent.com/FredAmartey/leglas/pr-assets/rail-single.jpg" width="900" alt="The Leglas interface: a rail of three design directions on the left, and the selected one running as the real app filling the rest of the window" />
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
<p align="center"><i>Every direction in the rail, the selected one running as your actual app. Arrow keys flip between them.</i></p>
|
|
22
|
+
|
|
17
23
|
Code is becoming the source of truth. Features go from prompt to
|
|
18
24
|
working code in minutes, and mockups/design files eventually lag behind the product and drift out of sync. The
|
|
19
25
|
fastest teams already design in the medium they ship. Leglas is built
|
|
@@ -39,6 +45,12 @@ and sessions that clean up after themselves.
|
|
|
39
45
|
|
|
40
46
|
## What you can do with Leglas
|
|
41
47
|
|
|
48
|
+
<p align="center">
|
|
49
|
+
<img src="https://raw.githubusercontent.com/FredAmartey/leglas/pr-assets/compare-artboards.jpg" width="900" alt="The Leglas interface: a rail of three design directions on the left, and two of them running side by side as the real app, each labelled with its name." />
|
|
50
|
+
</p>
|
|
51
|
+
|
|
52
|
+
<p align="center"><i>Two directions for the same page, running side by side as the actual app.</i></p>
|
|
53
|
+
|
|
42
54
|
- Pick any two variations for side-by-side comparison when it gets hard to choose.
|
|
43
55
|
- Name each direction, drag to reorder and organise your variants, set aside the ones that
|
|
44
56
|
don't feel right. Your actions on every idea survive a long exploration.
|
|
@@ -51,12 +63,23 @@ and sessions that clean up after themselves.
|
|
|
51
63
|
the spread, your agent supplies the taste.
|
|
52
64
|
- Ask for changes without leaving the comparison: describe what you
|
|
53
65
|
want on the direction you're looking at, and Leglas turns it into a
|
|
54
|
-
precise request for your agent, file path included.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
66
|
+
precise request for your agent, file path included. The composer
|
|
67
|
+
carries its own agent picker, the way every chat you already use
|
|
68
|
+
carries a model picker: the CLIs found on your machine (Claude Code,
|
|
69
|
+
Codex, Cursor) are one click away next to the send button, each asked
|
|
70
|
+
for its login status so a signed-out CLI says so before a run instead
|
|
71
|
+
of failing one. Not on that list? Type the command that runs your
|
|
72
|
+
agent once, in the same menu, and Leglas hands it each request; or
|
|
73
|
+
connect an agent Leglas can't spawn (an IDE panel, an MCP host) with
|
|
74
|
+
the copy-paste MCP wiring behind "Connect another agent". Each run
|
|
75
|
+
reports in a card above the field: who is working, what file they
|
|
76
|
+
are touching, how long it has been, a stop button while it runs and
|
|
77
|
+
retry when it fails. Your agent, your subscription, no keys.
|
|
78
|
+
Prefer a terminal? `npx leglas watch` is the same loop with the
|
|
79
|
+
agent's own output scrolling by. In Claude Code, the Leglas MCP
|
|
80
|
+
server can also push each request straight into your open session as
|
|
81
|
+
a channel event (channels are a research preview: start Claude Code
|
|
82
|
+
with `--dangerously-load-development-channels
|
|
60
83
|
server:<your leglas server name>`).
|
|
61
84
|
- Keep the winner with one command. Leglas moves it into your source
|
|
62
85
|
tree and clears the exploration away.
|
|
@@ -76,66 +99,110 @@ preview of your app root. Add a config file to compare more than one thing.
|
|
|
76
99
|
|
|
77
100
|
It works with whatever you're building in. Leglas never imports or
|
|
78
101
|
executes your framework, so the target can be Next, Vite, Remix,
|
|
79
|
-
SvelteKit, Astro, or a folder of static files.
|
|
80
|
-
|
|
102
|
+
SvelteKit, Astro, or a folder of static files.
|
|
103
|
+
|
|
104
|
+
## Install
|
|
105
|
+
|
|
106
|
+
There is nothing you have to install: `npx leglas` fetches the CLI on
|
|
107
|
+
first use and starts from npm's cache after that, and every instruction
|
|
108
|
+
Leglas writes for agents uses the same form, so a fresh clone works
|
|
109
|
+
with no setup at all. Requires Node 24 or newer.
|
|
110
|
+
|
|
111
|
+
Two optional upgrades:
|
|
112
|
+
|
|
113
|
+
- `npm install -D leglas` pins the version in a project. Teammates and
|
|
114
|
+
CI get the same Leglas from their normal install, and `npx` resolves
|
|
115
|
+
the local copy from then on.
|
|
116
|
+
- `npm install -g leglas` is for typing `leglas` without the prefix.
|
|
81
117
|
|
|
82
118
|
## Working with coding agents
|
|
83
119
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
120
|
+
The fastest way in is the agent skill:
|
|
121
|
+
|
|
122
|
+
```sh
|
|
123
|
+
npx skills add FredAmartey/leglas
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
One install, and your agent recognises "give me a few directions for the
|
|
127
|
+
pricing page" as a Leglas exploration in any project, including ones
|
|
128
|
+
that have never seen Leglas. It sets the project up itself and gets to
|
|
129
|
+
work.
|
|
130
|
+
|
|
131
|
+
In a project, run `npx leglas init` once. It writes a section into your
|
|
132
|
+
project's `AGENTS.md`, creates a starter config, and gitignores Leglas's
|
|
133
|
+
working directory. That section travels with the repo, so Claude Code,
|
|
134
|
+
Cursor, Codex, or whatever you switch to next opens the project already
|
|
135
|
+
knowing how to add design directions to it. Every command accepts
|
|
136
|
+
`--json` and prints a single machine-readable envelope, so agents drive
|
|
137
|
+
the same CLI you do.
|
|
91
138
|
|
|
92
139
|
The instructions center on one rule: add beside what exists, never
|
|
93
140
|
rewrite it. Two directions that rewrite the same file cannot render from
|
|
94
141
|
one server, and asking an agent to "make the hero calmer" tempts it to
|
|
95
142
|
edit the hero. The supporting commands:
|
|
96
143
|
|
|
97
|
-
- `leglas explore hero --count 6` briefs the exploration: what the set
|
|
144
|
+
- `npx leglas explore hero --count 6` briefs the exploration: what the set
|
|
98
145
|
is for, why it only works if the six genuinely disagree, and how each
|
|
99
146
|
direction registers. Unbriefed, six requests come back as six variants
|
|
100
147
|
of one idea. With `--based-on "Aurora"` the goal flips: six deliberate
|
|
101
148
|
variants of a direction you already like, and drifting into a new
|
|
102
149
|
direction is the failure. The designs themselves are the agent's;
|
|
103
150
|
Leglas prescribes none.
|
|
104
|
-
- `leglas new hero --from src/Hero.tsx` scaffolds a switcher under
|
|
151
|
+
- `npx leglas new hero --from src/Hero.tsx` scaffolds a switcher under
|
|
105
152
|
`.leglas/variants/hero/`. With `--from`, the baseline re-exports your
|
|
106
153
|
real component, so you never compare against a stale copy. Leglas
|
|
107
154
|
prints the one line to add in your component and does not edit it,
|
|
108
155
|
because rewriting a file it does not understand is how a tool breaks a
|
|
109
156
|
codebase. Scaffolded branch points return the fallback in production
|
|
110
157
|
builds, so a committed one cannot expose an unreleased direction.
|
|
111
|
-
- `leglas classify --change package.json --rewrite src/theme.css` answers
|
|
158
|
+
- `npx leglas classify --change package.json --rewrite src/theme.css` answers
|
|
112
159
|
where a direction should live before it is written. Changing
|
|
113
160
|
dependencies, build configuration, or an existing file's behaviour
|
|
114
161
|
cannot be additive, so those directions build on their own git branch
|
|
115
162
|
and register with `leglas add --branch`. Everything else stays in-app,
|
|
116
163
|
where switching is instant.
|
|
117
|
-
- `leglas show "Aurora" --json` answers for one direction: its entry, the
|
|
164
|
+
- `npx leglas show "Aurora" --json` answers for one direction: its entry, the
|
|
118
165
|
source file behind it, the variants based on it, what it is being compared
|
|
119
166
|
against, and anything still pending on it. Copying a direction from the
|
|
120
167
|
rail hands over a block that ends in this command, so an agent given the
|
|
121
168
|
block can go and get the rest.
|
|
122
|
-
- `leglas keep "Aurora" --to src/components/hero.tsx` moves the winner
|
|
169
|
+
- `npx leglas keep "Aurora" --to src/components/hero.tsx` moves the winner
|
|
123
170
|
into real source and ends the exploration.
|
|
124
171
|
|
|
125
172
|
Asking for a change works from the interface too. Type what you want
|
|
126
173
|
changed into the field under the rail (or press `R`) and Leglas composes a
|
|
127
174
|
prompt naming the direction and the file behind it, copies it to your
|
|
128
175
|
clipboard, and queues it. The direction it means is the one highlighted
|
|
129
|
-
directly above the field. Your agent drains the queue with `leglas requests --json` and clears
|
|
176
|
+
directly above the field. Your agent drains the queue with `npx leglas requests --json` and clears
|
|
130
177
|
it with `--clear`. Leglas runs no model of its own; your agent already
|
|
131
178
|
knows your conventions and your taste.
|
|
132
179
|
|
|
180
|
+
The line under the field is the whole status: whether anything is
|
|
181
|
+
listening, what you have queued, and when it has been picked up.
|
|
182
|
+
|
|
183
|
+
<p align="center">
|
|
184
|
+
<img src="https://raw.githubusercontent.com/FredAmartey/leglas/pr-assets/field-idle.png" width="290" alt="The change field reading: Enter queues it for npx leglas requests" />
|
|
185
|
+
<img src="https://raw.githubusercontent.com/FredAmartey/leglas/pr-assets/field-queued.png" width="290" alt="The change field reading: one change queued for your agent" />
|
|
186
|
+
<img src="https://raw.githubusercontent.com/FredAmartey/leglas/pr-assets/field-pickedup.png" width="290" alt="The change field reading: Your agent is on it" />
|
|
187
|
+
</p>
|
|
188
|
+
|
|
189
|
+
<p align="center"><i>Nothing waiting, then a request queued, then an agent that has taken it.</i></p>
|
|
190
|
+
|
|
191
|
+
Pick an agent once and the same line shows it working: which file it is
|
|
192
|
+
editing, a cancel if you change your mind, a retry when a run goes
|
|
193
|
+
wrong. `npx leglas watch` in another terminal is the same loop with the
|
|
194
|
+
agent's own output in view, and it needs no flag once an agent has been
|
|
195
|
+
picked in the interface.
|
|
196
|
+
|
|
133
197
|
### MCP server
|
|
134
198
|
|
|
135
199
|
For agent hosts that cannot run shell commands, `leglas-mcp` exposes the
|
|
136
200
|
same operations as MCP tools over stdio: `start`, `add`, `list`, `show`,
|
|
137
201
|
`classify`, `explore`, `scaffold`, `keep`, `requests`, and `init`. Each
|
|
138
202
|
tool calls exactly what the CLI calls and returns the same envelope.
|
|
203
|
+
`watch` is the one command with no tool behind it: it is a loop that
|
|
204
|
+
holds a terminal open, and on a host that speaks channels the server
|
|
205
|
+
already pushes each request into the session as it arrives.
|
|
139
206
|
|
|
140
207
|
```sh
|
|
141
208
|
claude mcp add leglas -- npx -y leglas-mcp
|
|
@@ -147,9 +214,34 @@ Or in `.mcp.json`:
|
|
|
147
214
|
{ "mcpServers": { "leglas": { "command": "npx", "args": ["-y", "leglas-mcp"] } } }
|
|
148
215
|
```
|
|
149
216
|
|
|
150
|
-
The host's working directory names the project
|
|
151
|
-
|
|
152
|
-
|
|
217
|
+
The host's working directory names the project, the same contract as the
|
|
218
|
+
CLI. A host that starts the server somewhere else is asked where the
|
|
219
|
+
project is, over MCP roots. The `start` tool boots the viewer and returns
|
|
220
|
+
its URL, and anything it started stops when the session ends.
|
|
221
|
+
|
|
222
|
+
### As an Agent Plugin
|
|
223
|
+
|
|
224
|
+
The repository is also an [Agent Plugin](https://agent-plugins.org), the
|
|
225
|
+
open standard for shipping Agent Skills and MCP server configuration in
|
|
226
|
+
one format. Clients that implement it install the skill and the server
|
|
227
|
+
together, instead of the two steps above. It is a layout rather than a
|
|
228
|
+
build: `plugin.json` and `mcp.json` at the root, the skill in
|
|
229
|
+
`skills/leglas/`, nothing generated.
|
|
230
|
+
|
|
231
|
+
An Agent Plugins client starts a plugin's server in the plugin's own
|
|
232
|
+
install directory rather than the project, so on that path the working
|
|
233
|
+
directory names a copy of Leglas and nothing else. The server therefore
|
|
234
|
+
takes the project from the workspace the host declares over MCP roots,
|
|
235
|
+
and the working directory only when it sits inside one. If a host offers
|
|
236
|
+
neither, `LEGLAS_PROJECT_DIR` names the project outright; without it the
|
|
237
|
+
tools report that there is no project rather than writing into a plugin
|
|
238
|
+
cache. `mcp.json` passes `${PLUGIN_ROOT}` for exactly that check, and
|
|
239
|
+
nothing else.
|
|
240
|
+
|
|
241
|
+
The plugin's version covers the skill and the configuration, not the
|
|
242
|
+
server it launches: `npx` fetches the current `leglas-mcp` the same way
|
|
243
|
+
every `npx leglas` in these instructions fetches the current CLI, which
|
|
244
|
+
keeps both faces of Leglas on one version in a project they share.
|
|
153
245
|
|
|
154
246
|
## Configuration
|
|
155
247
|
|
|
@@ -203,6 +295,15 @@ what you want for the last two directions in contention: press `C`, or
|
|
|
203
295
|
hover a direction and press its compare button, and it becomes the right
|
|
204
296
|
pane while the active direction holds the left.
|
|
205
297
|
|
|
298
|
+
A split does not hand each side half the room. An app given half the room
|
|
299
|
+
crosses its own breakpoints and draws a different design, so you would be
|
|
300
|
+
choosing between two narrow renderings of directions meant for the wide
|
|
301
|
+
one. Instead each side is drawn at the width it had on its own and scaled
|
|
302
|
+
to fit, keeping the same proportions, so nothing reflows and flipping and
|
|
303
|
+
splitting agree about what the design is. Each pane says the width it is
|
|
304
|
+
drawn at and the scale it is shown at. If you want the narrow rendering,
|
|
305
|
+
that is what the tools popover's "Scale each side to fit" switch is for.
|
|
306
|
+
|
|
206
307
|
Arrows move between directions, `1` to `9` jump straight to one, `R` asks
|
|
207
308
|
for a change to the one you are on, `Cmd K` (`Ctrl K` elsewhere) searches
|
|
208
309
|
and `B` collapses the rail. Press `?` for the whole keymap.
|