beam-alpha 0.1.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 +114 -0
- package/bin/blueprint.mjs +7 -0
- package/dist/beam.js +3272 -0
- package/dist/canvas/assets/AzeretMono-C5fM7CrN.woff2 +0 -0
- package/dist/canvas/assets/OpenRunde-Bold-DS-_1xH5.woff2 +0 -0
- package/dist/canvas/assets/OpenRunde-Medium-Krf-ZDqK.woff2 +0 -0
- package/dist/canvas/assets/OpenRunde-Regular-BZVnpUN1.woff2 +0 -0
- package/dist/canvas/assets/OpenRunde-Semibold-Nru5tuSm.woff2 +0 -0
- package/dist/canvas/assets/index-BIsbDeNY.css +1 -0
- package/dist/canvas/assets/index.embed-CE8oqNgH.js +230 -0
- package/dist/canvas/index.html +16 -0
- package/dist/cli.js +678 -0
- package/dist/index.d.ts +74 -0
- package/dist/index.js +8663 -0
- package/dist/next/pin-loader.cjs +120 -0
- package/dist/next/source-loader.cjs +137 -0
- package/dist/next.d.ts +60 -0
- package/dist/next.js +8896 -0
- package/dist/overlay/overlay.css +1 -0
- package/dist/overlay/overlay.js +219 -0
- package/dist/probe.js +3084 -0
- package/dist/runtime/core.d.ts +43 -0
- package/dist/runtime/core.js +36 -0
- package/dist/runtime/core.prod.js +19 -0
- package/dist/runtime/react.d.ts +16 -0
- package/dist/runtime/react.js +48 -0
- package/dist/runtime/react.prod.js +17 -0
- package/package.json +67 -0
package/README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# @blueprint/dev
|
|
2
|
+
|
|
3
|
+
Beam, inside your own Vite dev server: a canvas at `/__blueprint` for pointing
|
|
4
|
+
at any element of your app, tweaking its interactions live, and handing the
|
|
5
|
+
result to a coding agent — and **⌥⌘B** on any page for the same tools in place.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -D @blueprint/dev@npm:beam-alpha
|
|
9
|
+
npx blueprint init
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
(The package is imported as `@blueprint/dev` and published, for now, under a
|
|
13
|
+
throwaway name; the alias installs it where the import expects. This line is
|
|
14
|
+
the only place the throwaway shows.)
|
|
15
|
+
|
|
16
|
+
**Run the dev server on your own machine.** Beam's agent runner spawns your
|
|
17
|
+
Claude Code from the dev server's process, so a dev server inside a
|
|
18
|
+
container or on a remote has no agent to run — the server's banner prints
|
|
19
|
+
an `Agent:` line saying what it found. Your app's backend can live wherever
|
|
20
|
+
it normally does.
|
|
21
|
+
|
|
22
|
+
`blueprint init` writes the `.mcp.json` entry a coding agent connects through
|
|
23
|
+
and prints the plugin line for your Vite config. Add it — `blueprint()` goes
|
|
24
|
+
first:
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
// vite.config.ts
|
|
28
|
+
import { defineConfig } from 'vite'
|
|
29
|
+
import react from '@vitejs/plugin-react'
|
|
30
|
+
import { blueprint } from '@blueprint/dev'
|
|
31
|
+
|
|
32
|
+
export default defineConfig({
|
|
33
|
+
// blueprint() goes first — its hooks must run before react's and tailwind's.
|
|
34
|
+
plugins: [blueprint(), react()]
|
|
35
|
+
})
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Then `npm run dev`, open your app as usual and press **⌥⌘B** — or open
|
|
39
|
+
`/__blueprint` for the canvas.
|
|
40
|
+
|
|
41
|
+
### Next.js
|
|
42
|
+
|
|
43
|
+
Three touches, the NextAuth shape — `npx blueprint init` writes the route
|
|
44
|
+
file and prints the other two:
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
// next.config.ts — wrap whatever config is there; a NextConfig-typed value is fine
|
|
48
|
+
import { withBlueprint } from '@blueprint/dev/next'
|
|
49
|
+
export default withBlueprint(nextConfig)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
// app/api/blueprint/[[...path]]/route.ts
|
|
54
|
+
export { GET, POST, PUT, DELETE } from '@blueprint/dev/next'
|
|
55
|
+
export const dynamic = 'force-dynamic'
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
// app/layout.tsx — inside <head>
|
|
60
|
+
import { Beam } from '@blueprint/dev/next'
|
|
61
|
+
<head><Beam /></head>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Everything is dev-only; `next build` emits nothing of Beam's. Sandboxes
|
|
65
|
+
(isolated component renders) are Vite's, and the Next host says so rather
|
|
66
|
+
than degrading; everything else works.
|
|
67
|
+
|
|
68
|
+
## What it does
|
|
69
|
+
|
|
70
|
+
- Serves the canvas at `/__blueprint` and injects a dormant probe into every
|
|
71
|
+
page the dev server renders. The probe wakes only inside a canvas card, or
|
|
72
|
+
on **⌥⌘B**, which loads Beam.
|
|
73
|
+
- `vite build` emits nothing. Every hook is `apply: 'serve'`.
|
|
74
|
+
- Writes nothing to your source, with one exception you ask for: **Apply** on a
|
|
75
|
+
declared parameter rewrites that declaration's own fallback literal, and
|
|
76
|
+
nothing else.
|
|
77
|
+
- Speaks MCP at `/__blueprint/mcp`, so Claude Code (or any MCP client) can read
|
|
78
|
+
the canvas, answer annotations, and write parameters.
|
|
79
|
+
|
|
80
|
+
## Declared parameters
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
import { declareParam } from '@blueprint/dev/runtime'
|
|
84
|
+
|
|
85
|
+
const lift = declareParam('card.lift', 6, { min: 0, max: 24, unit: 'px' })
|
|
86
|
+
// later, at the point of use:
|
|
87
|
+
style={{ transform: `translateY(-${lift()}px)` }}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The canvas shows `card.lift` as a control; the reader returns the live value
|
|
91
|
+
while a control is held and the fallback otherwise. **Apply** bakes the new value
|
|
92
|
+
into this line. In production the helper is a passthrough that returns the
|
|
93
|
+
fallback. React users get `useParam` from `@blueprint/dev/react`.
|
|
94
|
+
|
|
95
|
+
## Options
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
blueprint({
|
|
99
|
+
agent: false, // unmount the managed-agent runner (spawns your agent CLI); on by default
|
|
100
|
+
controlCode: true // ask for the terminal code before privileged routes answer; off by default
|
|
101
|
+
})
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Both defaults favour a working fresh install over posture; the trade is
|
|
105
|
+
documented in the repository's `docs/dev-plugin.md` under "Security". The
|
|
106
|
+
runner only ever spawns an agent found on the dev server's own PATH — when
|
|
107
|
+
none is, the Agent drawer says where it looked and requests still reach an
|
|
108
|
+
agent connected over MCP.
|
|
109
|
+
|
|
110
|
+
## License
|
|
111
|
+
|
|
112
|
+
PolyForm Shield 1.0.0. Bundled fonts (Open Runde, Azeret Mono) are under the
|
|
113
|
+
SIL Open Font License. Open Runde is modified: subset, and carrying a
|
|
114
|
+
tabular-figures feature the upstream face does not.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// The published entry point for `npx blueprint`. The real CLI is bundled into
|
|
3
|
+
// dist/ at build time; this shim only dispatches, so `bin` can live in the
|
|
4
|
+
// repo while dist/ stays generated.
|
|
5
|
+
import { runCli } from '../dist/cli.js'
|
|
6
|
+
|
|
7
|
+
process.exitCode = await runCli(process.argv.slice(2))
|