@dfosco/storyboard 0.9.4 → 0.9.5
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/package.json +1 -1
- package/scaffold/AGENTS.md +0 -79
package/package.json
CHANGED
package/scaffold/AGENTS.md
CHANGED
|
@@ -161,40 +161,6 @@ The `storyboard` CLI (`sb` alias) wraps dev tooling. The standard `npm run dev`
|
|
|
161
161
|
|
|
162
162
|
For the full canvas CLI reference (positioning, batch ops, collision detection), invoke the **canvas** skill.
|
|
163
163
|
|
|
164
|
-
### Dev URLs
|
|
165
|
-
|
|
166
|
-
With Caddy proxy running (set up via `npm run setup`):
|
|
167
|
-
- Main: `http://storyboard.localhost/storyboard/`
|
|
168
|
-
- Worktree `fix-bug`: `http://storyboard.localhost/fix-bug/storyboard/`
|
|
169
|
-
|
|
170
|
-
Without proxy (fallback with port numbers):
|
|
171
|
-
- Main: `http://localhost:1234/storyboard/`
|
|
172
|
-
- Worktree: `http://localhost:<port>/storyboard/`
|
|
173
|
-
|
|
174
|
-
### Dev URL session state
|
|
175
|
-
|
|
176
|
-
Whenever Copilot starts a dev server (e.g. `npm run dev`), save the URL as `devURL` in the SQL session database. Read the proxy URL from the dev server's startup output (`[storyboard] proxy URL: <url>`):
|
|
177
|
-
|
|
178
|
-
```sql
|
|
179
|
-
INSERT OR REPLACE INTO session_state (key, value) VALUES ('devURL', 'http://storyboard.localhost/storyboard/');
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
If the proxy is not running, fall back to the direct URL from the output (`[storyboard] direct URL: <url>`).
|
|
183
|
-
|
|
184
|
-
This `devURL` is used as the default target by the **agent-browser** skill when the user says "inspect the browser", "check the page", etc. — no URL argument needed.
|
|
185
|
-
|
|
186
|
-
**How `devURL` gets set:**
|
|
187
|
-
- **Automatically** — when Copilot runs `npm run dev` (or directly `storyboard dev`), persist the proxy URL (or direct URL if no proxy) to `devURL`.
|
|
188
|
-
- **From user input** — if the user says "the dev server is at http://localhost:3000", save that as `devURL`.
|
|
189
|
-
- **Implicitly from inspection** — if no `devURL` is set and the user says "inspect http://storyboard.localhost/storyboard/", that URL becomes the `devURL` for the rest of the session.
|
|
190
|
-
|
|
191
|
-
**How `devURL` gets read:**
|
|
192
|
-
- Before opening a browser with `agent-browser`, always check for a saved `devURL`:
|
|
193
|
-
```sql
|
|
194
|
-
SELECT value FROM session_state WHERE key = 'devURL';
|
|
195
|
-
```
|
|
196
|
-
- If set, use it as the default URL. If not set, ask the user or fall back to `http://storyboard.localhost/storyboard/`.
|
|
197
|
-
|
|
198
164
|
---
|
|
199
165
|
|
|
200
166
|
## Architecture
|
|
@@ -232,14 +198,9 @@ The fix was a one-line compaction (4MB → 9KB). Everything the user reported
|
|
|
232
198
|
|
|
233
199
|
## Key Conventions to follow at all times
|
|
234
200
|
|
|
235
|
-
- Use **Primer React** components from `@primer/react` for all UI elements
|
|
236
201
|
- Use **semantic HTML tags** whenever they are appropriate in between Primer React components
|
|
237
|
-
- Use **Primer Octicons** from `@primer/octicons-react` for icons
|
|
238
|
-
- **Before importing any icon, verify it exists in `.agents/data/primer-octicons.json`** (the authoritative export list, generated from the installed package). Agents frequently invent icon names like `ScissorsIcon` that do not exist and break the page at runtime. If the icon you want is not in that list, pick the closest available name from the list — never guess.
|
|
239
|
-
- Regenerate the list after bumping `@primer/octicons-react`: `node scripts/gen-octicons-list.mjs`
|
|
240
202
|
- Use the **canvas widget type registry** at `.agents/data/widget-types.json` as the authoritative list of valid canvas widget `type` strings, their props, default sizes, and when-to-use guidance. Never invent widget types. In particular: when showing multiple variants of a single story file, use ONE `component-set` widget — not N `story` widgets. Regenerate after changing the widget registry: `node scripts/gen-widget-types.mjs`.
|
|
241
203
|
- Use **CSS Modules** (`*.module.css`) for component-specific styles
|
|
242
|
-
- If you find any `sx` styled-components styling, migrate them to CSS Modules
|
|
243
204
|
- **Components must live in their own directory:** `src/components/Name/Name.jsx`, `Name.module.css`, `name.story.jsx`. Never place component files flat in `src/components/`.
|
|
244
205
|
- **Always use the `create` skill** when creating new components or stories — don't manually create files.
|
|
245
206
|
- **Every piece of data consumed in a page must gracefully handle `null` or `undefined` without crashing.** Since flow data, records, and overrides can all be partial, incomplete, or missing, components must never assume a field exists. Use optional chaining, fallback values, or conditional rendering for every data access.
|
|
@@ -252,14 +213,6 @@ The fix was a one-line compaction (4MB → 9KB). Everything the user reported
|
|
|
252
213
|
|
|
253
214
|
---
|
|
254
215
|
|
|
255
|
-
## Key anti-patterns to avoid
|
|
256
|
-
|
|
257
|
-
- **DO NOT EVER USE** `<Box>` components
|
|
258
|
-
- **DO NOT EVER USE** `sx` styled-components
|
|
259
|
-
- **DO NOT USE `useState` in pages or components.** All state management must happen through storyboard hooks (`useFlowData`, `useOverride`, `useObject`, `useRecord`, etc.). Storyboard state lives in the URL hash — not in React component state.
|
|
260
|
-
|
|
261
|
-
---
|
|
262
|
-
|
|
263
216
|
## Storyboard Data System
|
|
264
217
|
|
|
265
218
|
The storyboard data system separates UI prototype data from components using JSON files discovered by a Vite plugin at dev/build time.
|
|
@@ -347,38 +300,6 @@ Access with `useRecord('posts')` in a `pages/posts/[id].jsx` dynamic route page.
|
|
|
347
300
|
|
|
348
301
|
---
|
|
349
302
|
|
|
350
|
-
### External Prototypes
|
|
351
|
-
|
|
352
|
-
An **external prototype** links to a prototype hosted at an external URL. It appears in the viewfinder alongside regular prototypes but opens in a new tab instead of navigating within the app.
|
|
353
|
-
|
|
354
|
-
To create one, add a folder inside `src/prototypes/` with only a `.prototype.json` file containing a `url` field:
|
|
355
|
-
|
|
356
|
-
```json
|
|
357
|
-
// my-external-app.prototype.json
|
|
358
|
-
{
|
|
359
|
-
"meta": {
|
|
360
|
-
"title": "External App",
|
|
361
|
-
"description": "Hosted on another domain",
|
|
362
|
-
"author": ["dfosco"]
|
|
363
|
-
},
|
|
364
|
-
"url": "https://example.com/prototype"
|
|
365
|
-
}
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
No `index.jsx` or flow files are needed — the folder only contains the `.prototype.json`.
|
|
369
|
-
|
|
370
|
-
**Behavior:**
|
|
371
|
-
- Shows up in the viewfinder with an "external" badge
|
|
372
|
-
- Clicking opens the URL in a new tab (`target="_blank"`)
|
|
373
|
-
- Can live inside `.folder/` directories for grouping
|
|
374
|
-
- Supports all standard metadata (`title`, `description`, `author`, `icon`, `tags`, `team`)
|
|
375
|
-
|
|
376
|
-
**Creating via Workshop UI:** Use the "New prototype" workshop action and check the "External prototype" checkbox, then provide the URL.
|
|
377
|
-
|
|
378
|
-
**Creating via Agent:** Create the folder and `.prototype.json` file directly — no special commands needed.
|
|
379
|
-
|
|
380
|
-
---
|
|
381
|
-
|
|
382
303
|
### Template Variables
|
|
383
304
|
|
|
384
305
|
Data files support **build-time template variables** using `${variableName}` syntax within JSON string values. Variables are resolved by the Vite data plugin based on the file's location — no runtime overhead.
|