@milesroxas/design-hub 0.2.0 → 0.3.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/core/catalog.test.ts +10 -1
- package/core/catalog.ts +11 -0
- package/core/cms.test.ts +103 -0
- package/core/cms.ts +178 -0
- package/core/export.test.ts +127 -0
- package/core/export.ts +120 -0
- package/core/formats.ts +60 -0
- package/core/project.test.ts +71 -0
- package/core/project.ts +147 -0
- package/dist/core/catalog.d.ts +5 -0
- package/dist/core/catalog.js +10 -0
- package/dist/core/cms.d.ts +40 -0
- package/dist/core/cms.js +141 -0
- package/dist/core/export.d.ts +52 -0
- package/dist/core/export.js +84 -0
- package/dist/core/formats.d.ts +90 -0
- package/dist/core/formats.js +39 -0
- package/dist/core/project.d.ts +56 -0
- package/dist/core/project.js +121 -0
- package/dist/scripts/cli.js +4 -0
- package/dist/scripts/commands.js +4 -0
- package/dist/scripts/export.d.ts +42 -0
- package/dist/scripts/export.js +192 -0
- package/dist/scripts/fixtures-pull.d.ts +31 -19
- package/dist/scripts/fixtures-pull.js +102 -62
- package/dist/scripts/lib/cdp.d.ts +11 -0
- package/dist/scripts/lib/cdp.js +110 -0
- package/dist/scripts/new.d.ts +13 -1
- package/dist/scripts/new.js +43 -4
- package/dist/scripts/tracks.d.ts +40 -0
- package/dist/scripts/tracks.js +93 -0
- package/dist/server/paths.d.ts +2 -0
- package/dist/server/paths.js +2 -0
- package/dist/server/project.d.ts +7 -0
- package/dist/server/project.js +29 -0
- package/kit/Artboard.tsx +160 -0
- package/kit/artboard.css +47 -0
- package/kit/dials.tsx +2 -1
- package/package.json +1 -1
- package/shell/Index.tsx +49 -4
- package/shell/main.tsx +6 -2
- package/shell/shell.css +7 -3
- package/skills/miles-brand/SKILL.md +52 -0
- package/skills/miles-design-hub/SKILL.md +60 -25
- package/skills/miles-get-hostile/SKILL.md +7 -5
- package/skills/miles-new-feature/SKILL.md +8 -7
- package/skills/miles-port/SKILL.md +14 -2
- package/skills/miles-port/references/emdash.md +43 -0
- package/skills/miles-port/references/payload.md +31 -0
- package/skills/miles-port/references/wordpress.md +31 -0
- package/skills/miles-prototype/SKILL.md +2 -2
- package/templates/app/README.md +1 -0
- package/templates/brand/README.md +48 -0
- package/templates/brand/index.tsx +16 -0
- package/templates/brand/styles.css +5 -0
- package/templates/site/README.md +42 -0
- package/templates/site/index.tsx +22 -0
- package/templates/site/styles.css +6 -0
- package/templates/space/README.md +1 -0
|
@@ -9,38 +9,65 @@ The entry point. The user never starts in a terminal: they ask for a new project
|
|
|
9
9
|
|
|
10
10
|
Someone who does not use Claude Code gets the same result from the setup app: `Design Hub.command` in the Design Hub repo opens a page that asks the name, the place and GitHub, then runs the same two commands. Point a non-technical user there instead of this skill when they ask how to start without Claude.
|
|
11
11
|
|
|
12
|
-
## 1.
|
|
12
|
+
## 1. Check the machine first
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
1. **Where should the project live?** An absolute path; its folder name becomes the repo name. [`~/SITES/<name>`]
|
|
17
|
-
2. **Which GitHub account or org owns the repo, private or public, or no GitHub repo?** [the account `gh` is signed in as, private]
|
|
18
|
-
3. **Start from a Paper comp or from the sample prototype?** [sample]
|
|
19
|
-
4. **If Paper: the link to the Paper frame or page.**
|
|
20
|
-
5. **Does the design include a shell? Which frames hold it?** A product shell is sidebar, top bar and content; a website shell is header and footer, plus a pre-footer when the design treats it as a global. [no shell: prototypes stand in the Space]
|
|
21
|
-
6. **Install the `miles-*` skills globally or for this project only?** [project only; the clone already has them]
|
|
22
|
-
7. **Turn on TypeSafe checks? If yes, the TypeSafe API key.** [off] Why opt-in: a template anyone can use cannot require a paid account.
|
|
23
|
-
8. **Will the project run in Conductor workspaces? If yes, the branch they land on.** [no]
|
|
24
|
-
|
|
25
|
-
Comments and the share link come later, with `miles-deploy`, because they need a Vercel project.
|
|
26
|
-
|
|
27
|
-
## 2. Check the machine
|
|
14
|
+
These are read-only, and their answers become the choices in step 2, so run them before asking anything.
|
|
28
15
|
|
|
29
16
|
```bash
|
|
30
|
-
node --version
|
|
31
|
-
pnpm --version
|
|
32
|
-
gh auth status
|
|
17
|
+
node --version # 22.18 or newer; else install the current LTS
|
|
18
|
+
pnpm --version # else: corepack enable
|
|
19
|
+
gh auth status # the signed-in account; none means "No GitHub repo" is the only working choice until gh auth login
|
|
20
|
+
gh api user/orgs --jq '.[].login' # the orgs that can own the repo
|
|
33
21
|
```
|
|
34
22
|
|
|
35
23
|
The skills these lean on, installed globally: `emil-prototype`, `emil-writing-skills`, `impeccable`. Check `~/.claude/skills/` and install any that is missing with `npx skills add <source> -g -y`; say which were added.
|
|
36
24
|
|
|
25
|
+
A cloud container (no `~/SITES`, a home such as `/home/user`, a fresh VM per session) loses anything installed under `~` when the session ends. There, default the location to the working directory and skip the Conductor question: Conductor runs on the user's own machine.
|
|
26
|
+
|
|
27
|
+
## 2. Ask before anything is created
|
|
28
|
+
|
|
29
|
+
Ask with the host's question tool (`AskUserQuestion` in Claude Code), never as a numbered list in chat. Why: each answer is one click, the recommended choice is already marked, and nothing gets skipped in a wall of text. The tool takes at most 4 questions per call and 2 to 4 options per question, and it always adds "Other" for a typed answer. Put the recommended option first with "(Recommended)" at the end of its label. Take the project name from the request; ask for it in chat only when the request has none.
|
|
30
|
+
|
|
31
|
+
**Round 1: the project.**
|
|
32
|
+
|
|
33
|
+
| Header | Question | Options |
|
|
34
|
+
|---|---|---|
|
|
35
|
+
| Location | Where should `<name>` live? Its folder name becomes the repo name. | `~/SITES/<name>` (Recommended) · `~/Design/<name>`; in a cloud container, `<working dir>/<name>` (Recommended). "Other" takes any absolute path. |
|
|
36
|
+
| GitHub | Who owns the repo, and who can see it? | `<gh login>`, private (Recommended) · `<gh login>`, public · `<org>`, private for the first org from step 1 · No GitHub repo. "Other" takes another owner. |
|
|
37
|
+
| Tracks | What is this engagement? Pick every one that applies. (`multiSelect: true`) | Product: app screens, handed to the client's engineers as a spec · Website: pages on a CMS · Brand collateral: social posts, slides, print. A full-service project picks all three. |
|
|
38
|
+
| Start | Start from a Paper comp or from the samples? | The samples (Recommended) · Paper comp |
|
|
39
|
+
|
|
40
|
+
The tracks decide everything a shell question used to: product draws `AppShell`, website draws `SiteShell`, brand draws fixed-size artboards with no shell. Never ask about a shell separately.
|
|
41
|
+
|
|
42
|
+
**Round 2: the setup.** Ask Platform only with the website track; leave Conductor out in a cloud container.
|
|
43
|
+
|
|
44
|
+
| Header | Question | Options |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| Platform | Where is the website built? | Webflow · Payload · WordPress · EmDash: Astro, deployed on Cloudflare. "Other": not decided yet, which leaves the platform unset until the port asks. |
|
|
47
|
+
| Skills | Install the `miles-*` skills for this project only, or globally? | Project only: the project already has them (Recommended) · Globally |
|
|
48
|
+
| TypeSafe | Turn on TypeSafe's Jev checks? | Off (Recommended) · On: I have an API key. Why opt-in: a template anyone can use cannot require a paid account. |
|
|
49
|
+
| Conductor | Will the project run in Conductor workspaces? | No (Recommended) · Yes, landing on `main` · Yes, on another branch (they type it in "Other") |
|
|
50
|
+
|
|
51
|
+
**Round 3: the front end, only for Payload or WordPress.** One question: Astro (Recommended) · Next.js. Webflow renders its own pages and EmDash is always Astro, so neither is asked.
|
|
52
|
+
|
|
53
|
+
**Round 4: typed answers, one short chat message each, only for what was chosen.**
|
|
54
|
+
|
|
55
|
+
- Paper: the link to the Paper frame or page, and which frames hold the shell of each track: the sidebar and top bar for product, the header, footer and any pre-footer for website.
|
|
56
|
+
- TypeSafe on: the API key. If the host has a secret field (such as `request_secret`), use it instead of chat, because a key typed in chat stays in the transcript.
|
|
57
|
+
- Always, last: "Anything about the product for `PRODUCT.md`? Reply 'skip' to leave it empty."
|
|
58
|
+
|
|
59
|
+
Without a question tool (another agent, or a host that lacks one), ask everything in one message with defaults in brackets, and wait for every answer. Nothing in steps 3 to 6 runs until every round is answered.
|
|
60
|
+
|
|
61
|
+
Comments and the share link come later, with `miles-deploy`, because they need a Vercel project.
|
|
62
|
+
|
|
37
63
|
## 3. Create the project
|
|
38
64
|
|
|
39
65
|
```bash
|
|
40
|
-
npm create @milesroxas/design-hub@latest -- --path <path> --visibility private|public|none [--owner <owner>]
|
|
66
|
+
npm create @milesroxas/design-hub@latest -- --path <path> --visibility private|public|none [--owner <owner>] \
|
|
67
|
+
--track <track> [--track <track> ...] [--platform webflow|payload|wordpress|emdash] [--frontend astro|next]
|
|
41
68
|
```
|
|
42
69
|
|
|
43
|
-
It copies the template, pins the `@milesroxas/design-hub` package, installs, puts the `miles-*` skills in `.claude/skills/`, makes the first commit, and with `private` or `public` creates the GitHub repo and pushes. It prints one JSON object; `ok: false` names the fix. A second run finds the project and changes nothing, so rerun it after a fix instead of finishing by hand.
|
|
70
|
+
One `--track` per track picked. It copies the template, pins the `@milesroxas/design-hub` package, installs, puts the `miles-*` skills in `.claude/skills/`, records the tracks and platform in `.design-hub/project.json`, keeps only the picked tracks' samples, makes the first commit, and with `private` or `public` creates the GitHub repo and pushes. It prints one JSON object; `ok: false` names the fix. A second run finds the project and changes nothing, so rerun it after a fix instead of finishing by hand.
|
|
44
71
|
|
|
45
72
|
## 4. Run the setup
|
|
46
73
|
|
|
@@ -48,15 +75,23 @@ It copies the template, pins the `@milesroxas/design-hub` package, installs, put
|
|
|
48
75
|
pnpm --dir <path> bootstrap [--typesafe-key <key>] [--conductor --branch <branch>]
|
|
49
76
|
```
|
|
50
77
|
|
|
51
|
-
It picks a port nothing holds and no other project claims, writes it to `.env` and `.claude/launch.json`, and applies the flags. Read the JSON's `warnings`. With
|
|
78
|
+
It picks a port nothing holds and no other project claims, writes it to `.env` and `.claude/launch.json`, and applies the flags. Read the JSON's `warnings`. With the skills answered globally: `npx skills add milesroxas/design-hub -g -y`.
|
|
52
79
|
|
|
53
80
|
## 5. Record what was answered
|
|
54
81
|
|
|
55
|
-
Write the shell
|
|
82
|
+
Write the shell of each track under `DESIGN.md`, Shell: product is `AppShell`, website is `SiteShell`, brand has none; add the Paper frames that hold each, or "from the sample" without Paper. It is built once and every later session reads it instead of asking. The tracks themselves live in `.design-hub/project.json`; never copy them into prose that could drift from it. Fill `PRODUCT.md` from what the user said about the product; leave a section empty only when they said nothing about it, and say so.
|
|
56
83
|
|
|
57
84
|
## 6. Hand off
|
|
58
85
|
|
|
59
|
-
- **Paper start:** open the Paper link and load `miles-paper-to-prototype`. It reads the fonts and tokens first, then the shell frames, then the feature frame, and leaves
|
|
60
|
-
- **Sample start:** `pnpm dev
|
|
86
|
+
- **Paper start:** open the Paper link and load `miles-paper-to-prototype`. It reads the fonts and tokens first, then the shell frames, then the feature frame, and leaves the samples in place as the reference until the first feature exists.
|
|
87
|
+
- **Sample start:** `pnpm dev`, then open each kept track's sample and point the user at its walkthrough:
|
|
88
|
+
|
|
89
|
+
| Track | Sample | Walkthrough |
|
|
90
|
+
|---|---|---|
|
|
91
|
+
| product | `/sample-list/` | `/guide/sample/` |
|
|
92
|
+
| website | `/sample-page/` | `/guide/sample-site/` |
|
|
93
|
+
| brand | `/sample-social/` | `/guide/sample-brand/` |
|
|
94
|
+
|
|
95
|
+
The next step is `miles-new-feature`.
|
|
61
96
|
|
|
62
|
-
Close with the path, the port, the repo URL when there is one, whether TypeSafe is on, and the one command that starts the server. Nothing is committed unless the user asks.
|
|
97
|
+
Close with the path, the port, the repo URL when there is one, the tracks and the website platform, whether TypeSafe is on, and the one command that starts the server. Nothing is committed unless the user asks.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: miles-get-hostile
|
|
3
|
-
description: "Hostile fixtures for a prototype: fixtures.json with real data from the CMS or the comp, the missing set by hand, and the strategy and design answers for the edge cases (longest, empty, maximum count, missing media). Load when writing or changing fixtures.json, when a reviewer asks what happens with no items or a long name, or when a state needs data to reach it. Triggers on: fixtures, fixture set, hostile, edge case, worst content, longest, empty state, max count, missing image, real data, CMS pull, collection items, fixtures-pull, Webflow token."
|
|
3
|
+
description: "Hostile fixtures for a prototype: fixtures.json with real data from the CMS or the comp, the missing set by hand, and the strategy and design answers for the edge cases (longest, empty, maximum count, missing media). Load when writing or changing fixtures.json, when a reviewer asks what happens with no items or a long name, or when a state needs data to reach it. Triggers on: fixtures, fixture set, hostile, edge case, worst content, longest, empty state, max count, missing image, real data, CMS pull, collection items, fixtures-pull, Webflow token, Payload, WordPress, EmDash."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Get hostile
|
|
@@ -23,10 +23,12 @@ Pretty placeholder data hides the decision. Every prototype carries five sets, s
|
|
|
23
23
|
|
|
24
24
|
## Where `real` comes from, cheapest first
|
|
25
25
|
|
|
26
|
-
1. **
|
|
27
|
-
2. **
|
|
28
|
-
3. **
|
|
29
|
-
4. **
|
|
26
|
+
1. **The project's CMS, by script.** `pnpm fixtures-pull <slug>` reads the platform in `.design-hub/project.json`: Webflow (`WEBFLOW_TOKEN`), Payload (`PAYLOAD_URL`, `PAYLOAD_API_KEY`) or WordPress (`WORDPRESS_URL`), each in `.env`; a missing key comes back with the fix. Run it once with `--collection <id or slug>` and no `--map`: it lists the field paths with a sample of each. Then pull with one `--map key=path` per field the component renders (`--map cover=thumbnail.url`, `--map title=title.rendered`). It pages through any `--limit`, keeps every other key in `fixtures.json`, and turns WordPress's rendered HTML into plain text. Why a script: it costs no tokens per item, so a pull of 200 items costs the same as 20.
|
|
27
|
+
2. **EmDash, or any CMS with a JSON export.** Write the items to a file (EmDash: `npx emdash content list <collection> --json > items.json`), then `pnpm fixtures-pull <slug> --from items.json`, first without `--map` to list the paths, then with it. Delete the file after: it is a copy of client content.
|
|
28
|
+
3. **A Webflow project without a token.** One call to the Webflow MCP's CMS tool for the collection behind the design, `limit` 20 or fewer. Keep only the fields the component renders. Never a full-collection pull: every field of every item spends tokens on nothing the component shows.
|
|
29
|
+
4. **No CMS.** Write `real` from the content in the Paper comp, word for word. Eight items minimum, because a list of three never shows its rhythm.
|
|
30
|
+
|
|
31
|
+
Say where `real` came from in the README's Fixtures section: the platform and the collection.
|
|
30
32
|
|
|
31
33
|
Strip anything that identifies a private person before writing it down: a phone number, a personal email, a home address. `pnpm preflight` stops on every email and phone number until each is replaced or confirmed as a business contact.
|
|
32
34
|
|
|
@@ -14,22 +14,23 @@ One feature is one slug used in two places: `docs/sprints/<slug>/` and the `feat
|
|
|
14
14
|
- The feature's main prototype, the one its walkthrough opens → `--sprint`. One per feature; `pnpm new` refuses a second.
|
|
15
15
|
- Another full take on the same flow, to compare against the primary → `--alternate`. Refused until the primary exists.
|
|
16
16
|
- A side question about one part (a menu's motion, a loading state) → exploration, the default.
|
|
17
|
-
3. **
|
|
18
|
-
4. **
|
|
17
|
+
3. **Which track?** Read `.design-hub/project.json` (or `pnpm tracks`). A project with one track uses it. A project with several needs `--track product|website|brand`: product is app screens, website is CMS pages, brand is collateral (social posts, slides, print). `pnpm new` refuses a track the project does not have, because the track decides the shell, the sample to read, and how `miles-port` hands it off.
|
|
18
|
+
4. **Where does it stand?** `--app` when the question is about the feature in context: the track's shell, `AppShell` for product and `SiteShell` for website, as `DESIGN.md`, Shell, describes. Nothing when it is one thing alone in the Space. Brand is always a `Board` of artboards, whatever the flags; `miles-brand` takes over from step 6.
|
|
19
|
+
5. **Scaffold.** From the project root:
|
|
19
20
|
```bash
|
|
20
|
-
pnpm new <slug> --app --sprint --feature <feature> --title "Title"
|
|
21
|
+
pnpm new <slug> --app --sprint --feature <feature> --track website --title "Title"
|
|
21
22
|
pnpm guide <feature> # once per feature, for the sprint
|
|
22
23
|
```
|
|
23
|
-
The scaffolder fills the frontmatter and refuses a bad slug, a second sprint,
|
|
24
|
-
|
|
24
|
+
The scaffolder fills the frontmatter, `track` included, and refuses a bad slug, a second sprint, an alternate without a primary, or a track the project lacks. Never create the folder by hand: a folder without the README's frontmatter is invisible to the index.
|
|
25
|
+
6. **Write the README before any code**, top to bottom:
|
|
25
26
|
- **Problem.** What is wrong or unknown today, and for whom. Two sentences.
|
|
26
27
|
- **Question.** The one decision the prototype exists to make. One sentence, a question mark. If there are two questions, there are two prototypes.
|
|
27
28
|
- **Flows** (app) or **Directions** (space). A table: each flow with where it starts and its edge cases; each direction with its name and the axis it varies on.
|
|
28
29
|
- **States.** Every state the prototype will hold and how to reach it. Start with the five fixture sets (`miles-get-hostile`); add the feature's own (selected, editing, a run in progress). The guard and `miles-port` read this table.
|
|
29
30
|
- **Fixtures.** Where `real` comes from and the design's maximum count.
|
|
30
31
|
- **Decision.** Empty.
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
7. **Design doc.** `docs/sprints/<slug>/design-doc.md` holds what the prototype tests: the context, the proposal, the open decisions. Write it when the feature has more than one flow; a single exploration needs only its README.
|
|
33
|
+
8. **Then build**, under `miles-prototype`.
|
|
33
34
|
|
|
34
35
|
## The walkthrough
|
|
35
36
|
|
|
@@ -19,7 +19,18 @@ Read `prototypes/<slug>/`, never the running prototype. Refuse to start, naming
|
|
|
19
19
|
|
|
20
20
|
## Branch: where is it going?
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
The prototype's `track:` and `.design-hub/project.json` answer this before anyone is asked:
|
|
23
|
+
|
|
24
|
+
| Track | Where it goes |
|
|
25
|
+
| --- | --- |
|
|
26
|
+
| `product` | The client's engineers build it; this studio does not touch their codebase. The port is the report alone: the state map, tokens and components by name, the fixtures as their test data. Skip both build branches below. |
|
|
27
|
+
| `website`, platform `webflow` | The Webflow branch. |
|
|
28
|
+
| `website`, platform `payload`, `wordpress` or `emdash` | The codebase branch, on the site's front end (`website.frontend`: Astro or Next; EmDash is always Astro, deployed to Cloudflare). Ask only for the path to the site's repo. |
|
|
29
|
+
| `website` without a platform | Stop and ask where the site is built, then record it: `pnpm tracks set --track <every track> --platform <platform> [--frontend astro|next]`. |
|
|
30
|
+
| `brand` | The export is the hand-off: `pnpm export <slug>` with the Decision's dial state (`miles-brand`). When the client wants the template itself in Figma, Canva or Keynote, the report lists each slot, format and value to rebuild there. Skip both build branches below. |
|
|
31
|
+
| no `track:` (a project made before tracks) | Ask one question: Webflow, or a codebase (the path to its repo)? |
|
|
32
|
+
|
|
33
|
+
Then walk one branch. Both follow three rules:
|
|
23
34
|
|
|
24
35
|
- **The target's conventions win.** Where a token or component has no match in the target, list it in the port report. Never invent one in the target.
|
|
25
36
|
- **Dials become fixed values.** DialKit never ships. Each dial's committed default is the value; the README's Decision is the source.
|
|
@@ -44,7 +55,7 @@ Ask one question first: Webflow, or a codebase (the path to its repo)? Then walk
|
|
|
44
55
|
3. **Fixtures travel.** Each fixture set becomes a test fixture or a story in the target's own convention, and each README state a test or a story. Why: the hostile sets are where QA catches the edge cases, so they go with the feature.
|
|
45
56
|
4. **A new branch**, never the target's main. Name it after the feature slug.
|
|
46
57
|
|
|
47
|
-
Read the
|
|
58
|
+
Read the references for the target's stack before step 2: the front end's (`references/next.md` for Next.js, `references/astro.md` for Astro) and the CMS's (`references/payload.md`, `references/wordpress.md`, `references/emdash.md`). The target's own `AGENTS.md` still wins over both. For any other stack, the target's docs are the reference. The CMS (Payload, WordPress, EmDash) owns the content model: map each fixture key to a field of the collection the page reads, and list a key with no field in the report instead of adding one to the CMS unasked.
|
|
48
59
|
|
|
49
60
|
## Output: the port report
|
|
50
61
|
|
|
@@ -54,6 +65,7 @@ Read the reference for the target's stack before step 2, when there is one: `ref
|
|
|
54
65
|
- **Mapped.** Tokens and components with their target names.
|
|
55
66
|
- **Not mapped.** Tokens with no target, states with no mechanism, and what the user has to decide for each.
|
|
56
67
|
- **Webflow build spec** (Webflow branch): the structure, classes, variables and interactions a person builds in the Designer, in build order.
|
|
68
|
+
- **Engineering hand-off** (product track): the states, values and fixtures an engineer needs without opening the prototype, in the order they would build them.
|
|
57
69
|
- **Where it is.** The branch, the collection, the draft items.
|
|
58
70
|
|
|
59
71
|
The report is the review surface. Nothing goes live until the user has read it.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Porting into EmDash
|
|
2
|
+
|
|
3
|
+
EmDash is a CMS that runs inside an Astro site, deployed on Cloudflare (Workers, with D1 for content and R2 for media). The front end is that Astro site, so read `astro.md` for components, islands, states and tests; this file covers EmDash's content model and how pages read it. Read the target's `astro.config.mjs`, `src/live.config.ts` and its pages first; where they decide something, they win.
|
|
4
|
+
|
|
5
|
+
## Where each piece goes
|
|
6
|
+
|
|
7
|
+
| Prototype | EmDash |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| `fixtures.json` `real` | A collection. Collections live in the database, not in code: made in the admin's schema builder (`/_emdash/admin`) or with the CLI (`npx emdash schema list`, `schema get <collection>`, `schema add-field`). `pages` and `posts` exist from the start. |
|
|
10
|
+
| A fixture key | A field of the type its value needs: `string`, `text`, `url`, `number`, `integer`, `boolean`, `datetime`, `select`, `multiSelect`, `portableText` (formatted copy), `image`, `file`, `reference` (another collection's entry), `json`, `slug`, `repeater` (a repeated group), `blocks`. |
|
|
11
|
+
| A page made of sections | A `blocks` or `repeater` field, one front-end component per block type. |
|
|
12
|
+
| A hostile set | Field validation and the page's handling of each case. The sets stay test fixtures, never site content. |
|
|
13
|
+
|
|
14
|
+
## Content model rules
|
|
15
|
+
|
|
16
|
+
- **Add, never rename.** Each collection is a real SQL table; renaming or retyping a field of a live collection risks its content. List any rename in the report for the user.
|
|
17
|
+
- After a schema change, `npx emdash types` regenerates the types the pages read.
|
|
18
|
+
|
|
19
|
+
## Content in
|
|
20
|
+
|
|
21
|
+
The `real` items go in as drafts, through the site's MCP server or the `npx emdash content` commands (`npx emdash content --help` lists them on the installed version), against the local dev site first (`--url http://localhost:4321`). Never publish, and never write to the deployed site or run `npm run deploy` without the user's word.
|
|
22
|
+
|
|
23
|
+
## Pages read
|
|
24
|
+
|
|
25
|
+
Pages query at request time through Astro's live collections:
|
|
26
|
+
|
|
27
|
+
```astro
|
|
28
|
+
---
|
|
29
|
+
import { getEmDashCollection, getEmDashEntry } from 'emdash';
|
|
30
|
+
import { Image, PortableText } from 'emdash/ui';
|
|
31
|
+
const { entries: posts } = await getEmDashCollection('posts', { status: 'published', limit: 12 });
|
|
32
|
+
---
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Fields are on `entry.data` (`post.data.title`); `entry.id` is the slug for links. Formatted copy renders with `<PortableText value={post.data.content} />`, images with `Image`. Each README state maps to a query: empty is `entries.length === 0`, missing is an entry with empty fields, and an unknown slug returns no `entry`.
|
|
36
|
+
|
|
37
|
+
## Real fixtures back out
|
|
38
|
+
|
|
39
|
+
`npx emdash content list <collection> --json > items.json`, then `pnpm fixtures-pull <slug> --from items.json --map key=path` (with no `--map` it lists the paths).
|
|
40
|
+
|
|
41
|
+
## Report
|
|
42
|
+
|
|
43
|
+
Under Mapped: each collection, block and field with its type. Under Not mapped: fixture keys with no field, and schema changes left for the user.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Porting into Payload
|
|
2
|
+
|
|
3
|
+
Payload is the CMS; the site's pages are the front end in `website.frontend` (Astro or Next). Read `astro.md` or `next.md` for the page side; this file covers the content model and how content gets in. Read the target's `payload.config.ts` and `src/collections/` first; where they already decide something, they win.
|
|
4
|
+
|
|
5
|
+
## Where each piece goes
|
|
6
|
+
|
|
7
|
+
| Prototype | Payload |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| `fixtures.json` `real`, one item's keys | A collection's `fields` (`src/collections/<Name>.ts`, a `CollectionConfig`), when the content is a list (posts, people, products). A global when there is exactly one (a footer, site settings). |
|
|
10
|
+
| A page made of sections | A `blocks` field on the pages collection: one block config per prototype section, one front-end component per block, matched by `blockType`. |
|
|
11
|
+
| A fixture key's value | The field type by what it holds: `text` or `textarea` for strings, `richText` (Lexical) for formatted copy, `upload` for an image, `relationship` for another collection's item, `select` for a fixed set, `date`, `number`, `checkbox`, `array` for a repeated group. |
|
|
12
|
+
| A hostile set (`longest`, `missing`) | Field `validation`, `maxLength` and `required` decided from it: `missing` says which fields may be empty, `longest` what the front end must survive. The sets stay test fixtures, never CMS content. |
|
|
13
|
+
| The README's Decision | `admin.description` on each field that carries a rule an editor must follow (an image ratio, a character limit). |
|
|
14
|
+
|
|
15
|
+
## Content model rules
|
|
16
|
+
|
|
17
|
+
- **Add, never rename.** A new field is additive; renaming or retyping a live field loses content. List any rename the design wants in the report and leave it for the user.
|
|
18
|
+
- **Drafts first.** Collections an editor publishes get `versions: { drafts: true }` when the target uses drafts elsewhere. Never turn drafts on for one feature only.
|
|
19
|
+
- **Migrations.** On a SQL adapter (Postgres, SQLite), a schema change needs `payload migrate:create`; commit the migration with the code. Then `payload generate:types` so the front end reads typed data.
|
|
20
|
+
|
|
21
|
+
## Content in
|
|
22
|
+
|
|
23
|
+
The `real` items go in as drafts: `_status: 'draft'` through the target's seed script, the Local API (`payload.create({ collection, data, draft: true })`) or the admin. Never publish, and never seed a production database: content on a live site is the user's call.
|
|
24
|
+
|
|
25
|
+
## Front end reads
|
|
26
|
+
|
|
27
|
+
Astro reads with the REST API (`GET /api/<collection>?where[...]&depth=1`) or the Local API when the front end shares the Payload app (Next). `depth` decides how far relationships and uploads expand; set it to what the components render and no deeper. Each README state maps to a query result: empty is zero docs, missing is a doc with empty fields.
|
|
28
|
+
|
|
29
|
+
## Report
|
|
30
|
+
|
|
31
|
+
Under Mapped: each collection, block and field with its type. Under Not mapped: any fixture key with no field, and any field the design needs that would rename or retype a live one.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Porting into WordPress
|
|
2
|
+
|
|
3
|
+
WordPress is the CMS, headless: the site's pages are the front end in `website.frontend` (Astro or Next), which reads WordPress over its REST API. Read `astro.md` or `next.md` for the page side; this file covers the content model and how content gets in. Read the target's theme or plugin code, its registered post types and its field plugin (ACF or another) first; where they decide something, they win.
|
|
4
|
+
|
|
5
|
+
## Where each piece goes
|
|
6
|
+
|
|
7
|
+
| Prototype | WordPress |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| `fixtures.json` `real` | Posts or pages when the content is the site's articles or pages; a custom post type (`register_post_type` with `show_in_rest: true`) when it is anything else (case studies, team, events). |
|
|
10
|
+
| A fixture key | A core field when one fits (`title`, `excerpt`, `date`, the featured image); a custom field otherwise, exposed in REST (ACF with "Show in REST API" on puts it under `acf`). |
|
|
11
|
+
| A category or tag key | A taxonomy (`register_taxonomy` with `show_in_rest: true`), never a free-text field. |
|
|
12
|
+
| A page made of sections | The target's convention: ACF flexible content, or Gutenberg blocks. Follow what the site already uses; never introduce the other one for one feature. |
|
|
13
|
+
| A hostile set | Field rules (required, character limits in the field's instructions), and the front end's handling of each case. The sets stay test fixtures, never site content. |
|
|
14
|
+
|
|
15
|
+
## Content model rules
|
|
16
|
+
|
|
17
|
+
- **Fields over HTML.** Content the design styles per part (a title, a date, a quote) is a field, so the front end owns the markup. Body copy stays `content`, rendered from `content.rendered` with the core block styles the front end already ships.
|
|
18
|
+
- **Add, never rename.** A field or post type rename orphans existing content. List it in the report for the user.
|
|
19
|
+
- Field groups live in code when the target keeps them in code (ACF JSON or PHP); never only in the database of one environment.
|
|
20
|
+
|
|
21
|
+
## Content in
|
|
22
|
+
|
|
23
|
+
The `real` items go in as drafts (`status: draft`) through WP-CLI, the REST API with an application password, or the admin. Never publish, never on production without the user's word.
|
|
24
|
+
|
|
25
|
+
## Front end reads
|
|
26
|
+
|
|
27
|
+
`GET /wp-json/wp/v2/<rest base>?_embed=1` returns the items with their featured media and terms embedded; `_fields=` trims a response to what the page renders. `title.rendered` and `excerpt.rendered` are HTML: strip or render them as the design says. Each README state maps to a response: empty is `[]`, missing is an item with empty fields or no `_embedded` media.
|
|
28
|
+
|
|
29
|
+
## Report
|
|
30
|
+
|
|
31
|
+
Under Mapped: each post type, taxonomy and field with its REST path. Under Not mapped: fixture keys with no field, and anything that would need a plugin the site does not have.
|
|
@@ -5,13 +5,13 @@ description: "The rules for writing or changing any prototype code under prototy
|
|
|
5
5
|
|
|
6
6
|
# Prototype
|
|
7
7
|
|
|
8
|
-
A prototype here answers one written question with the least code that can answer it, in the project's real materials, with every state reachable from a dial. This skill holds the ceiling. `AGENTS.md` holds the stack and the layout; `prototypes/sample-list/` is the worked example and wins over any description of it here.
|
|
8
|
+
A prototype here answers one written question with the least code that can answer it, in the project's real materials, with every state reachable from a dial. This skill holds the ceiling. `AGENTS.md` holds the stack and the layout; the sample of the prototype's track (`prototypes/sample-list/` for product, `prototypes/sample-page/` for website, `prototypes/sample-social/` for brand, where `miles-brand` adds the collateral rules) is the worked example and wins over any description of it here.
|
|
9
9
|
|
|
10
10
|
## Before the first line
|
|
11
11
|
|
|
12
12
|
1. Read the feature's `README.md`. If it has no Problem, Question and States, stop and write them with `miles-new-feature`. Code written before the question is code that answers a different question.
|
|
13
13
|
2. Decide where it stands: `AppShell` or `SiteShell` when the question is about the feature in context, `Space` when it is about one thing alone. Never both in one prototype.
|
|
14
|
-
3. Read `
|
|
14
|
+
3. Read the `index.tsx` of the track's sample once per session (`sample-list` for product, `sample-page` for website, `sample-social` for brand, whichever the project kept). It is the reference for every pattern below.
|
|
15
15
|
|
|
16
16
|
## The fidelity ceiling
|
|
17
17
|
|
package/templates/app/README.md
CHANGED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: {{title}}
|
|
3
|
+
summary: One line on what this piece is for.
|
|
4
|
+
context: board
|
|
5
|
+
track: {{track}}
|
|
6
|
+
status: exploring
|
|
7
|
+
kind: {{kind}}
|
|
8
|
+
feature: {{feature}}
|
|
9
|
+
created: {{created}}
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# {{title}}
|
|
13
|
+
|
|
14
|
+
## Problem
|
|
15
|
+
|
|
16
|
+
What the piece has to do, where it appears, and for whom. Write this before any artboard.
|
|
17
|
+
|
|
18
|
+
## Question
|
|
19
|
+
|
|
20
|
+
The one decision this board exists to make.
|
|
21
|
+
|
|
22
|
+
## Formats
|
|
23
|
+
|
|
24
|
+
| Artboard | Format | Where it runs |
|
|
25
|
+
| --- | --- | --- |
|
|
26
|
+
| | | |
|
|
27
|
+
|
|
28
|
+
Formats come from `@kit/Artboard` (`post-square`, `post-portrait`, `story`, `link-preview`, `banner`, `slide`, `a4`, `letter`). Each artboard is drawn at its real pixel size; a story keeps type and logos out of its top and bottom 250px.
|
|
29
|
+
|
|
30
|
+
## States
|
|
31
|
+
|
|
32
|
+
Every state the board holds, one row each: each fixture set, each layout and each tone a dial reaches. `miles-port` and the export read this table.
|
|
33
|
+
|
|
34
|
+
| State | How to reach it |
|
|
35
|
+
| --- | --- |
|
|
36
|
+
| | |
|
|
37
|
+
|
|
38
|
+
## Fixtures
|
|
39
|
+
|
|
40
|
+
`fixtures.json` holds `real` (the copy and images this piece runs with) and `missing` (no image, no subhead). `@kit/fixtures` derives `longest`, `empty` and `max`. Say where `real` came from.
|
|
41
|
+
|
|
42
|
+
## Export
|
|
43
|
+
|
|
44
|
+
`pnpm export {{slug}}` writes PNGs for posts and a PDF for slides and print into `exports/{{slug}}/`. Name the dial state that ships in the Decision, and export with it (`--dials`).
|
|
45
|
+
|
|
46
|
+
## Decision
|
|
47
|
+
|
|
48
|
+
Empty until picked. What was chosen, its values, and what was rejected and why.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Artboard, Board } from '@kit/Artboard';
|
|
2
|
+
import './styles.css';
|
|
3
|
+
|
|
4
|
+
export default function Prototype() {
|
|
5
|
+
return (
|
|
6
|
+
<Board title="{{title}}" lede="Replace with the question from README.md.">
|
|
7
|
+
<Artboard format="post-square" name="square">
|
|
8
|
+
<div className="piece">
|
|
9
|
+
<p className="piece-kicker">Kicker</p>
|
|
10
|
+
<h2 className="piece-headline">The headline, at the size it ships</h2>
|
|
11
|
+
<p className="piece-sub">Every value here is in real pixels: this artboard is 1080 wide.</p>
|
|
12
|
+
</div>
|
|
13
|
+
</Artboard>
|
|
14
|
+
</Board>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/* Values are real pixels at the artboard's size (1080 wide for posts). */
|
|
2
|
+
.piece { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 24px; padding: 96px; background: var(--bg-brand-solid, var(--bg-primary)); color: var(--text-white, var(--text-primary)); }
|
|
3
|
+
.piece-kicker { font-size: 28px; line-height: 36px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.8; }
|
|
4
|
+
.piece-headline { font-size: 88px; line-height: 1.05; font-weight: 700; letter-spacing: -0.02em; text-wrap: balance; max-width: 16ch; }
|
|
5
|
+
.piece-sub { font-size: 32px; line-height: 44px; max-width: 30ch; opacity: 0.85; }
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: {{title}}
|
|
3
|
+
summary: One line on what this explores.
|
|
4
|
+
context: app
|
|
5
|
+
track: {{track}}
|
|
6
|
+
status: exploring
|
|
7
|
+
kind: {{kind}}
|
|
8
|
+
feature: {{feature}}
|
|
9
|
+
created: {{created}}
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# {{title}}
|
|
13
|
+
|
|
14
|
+
## Problem
|
|
15
|
+
|
|
16
|
+
What is wrong or unknown today, and for whom. Write this before any code.
|
|
17
|
+
|
|
18
|
+
## Question
|
|
19
|
+
|
|
20
|
+
The one decision this prototype exists to make.
|
|
21
|
+
|
|
22
|
+
## Flows
|
|
23
|
+
|
|
24
|
+
| Flow | Starts from | Edge cases |
|
|
25
|
+
| --- | --- | --- |
|
|
26
|
+
| | | |
|
|
27
|
+
|
|
28
|
+
## States
|
|
29
|
+
|
|
30
|
+
Every state the prototype holds, one row each. The fidelity guard and `miles-port` read this table: a state that is not here does not exist to them.
|
|
31
|
+
|
|
32
|
+
| State | How to reach it |
|
|
33
|
+
| --- | --- |
|
|
34
|
+
| | |
|
|
35
|
+
|
|
36
|
+
## Fixtures
|
|
37
|
+
|
|
38
|
+
`fixtures.json` holds `real` and `missing`; `@kit/fixtures` derives `longest`, `empty` and `max`. Say where `real` came from (which CMS collection, or the comp) and the design's maximum count. A website's content is the CMS's: name the collection and the fields each section reads, so the port maps them by name.
|
|
39
|
+
|
|
40
|
+
## Decision
|
|
41
|
+
|
|
42
|
+
Empty until picked. What was chosen, its values, and what was rejected and why. Then delete the folder.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SiteShell } from '@kit/SiteShell';
|
|
2
|
+
import { Button, notInPrototype } from '@kit/ui';
|
|
3
|
+
import './styles.css';
|
|
4
|
+
|
|
5
|
+
export default function Prototype() {
|
|
6
|
+
return (
|
|
7
|
+
<SiteShell>
|
|
8
|
+
<section className="page-hero">
|
|
9
|
+
<h1>{{title}}</h1>
|
|
10
|
+
<p className="page-lede">Replace with the question from README.md.</p>
|
|
11
|
+
<Button kind="primary" label="Get started" onClick={() => notInPrototype('The call to action')} />
|
|
12
|
+
</section>
|
|
13
|
+
<section className="page-section">
|
|
14
|
+
<h2>The section under test</h2>
|
|
15
|
+
<p>
|
|
16
|
+
Build the page here with @kit/ui, section by section, each reading its content from fixtures.json
|
|
17
|
+
the way the CMS will hand it over.
|
|
18
|
+
</p>
|
|
19
|
+
</section>
|
|
20
|
+
</SiteShell>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
.page-hero { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; padding: 48px 0 64px; }
|
|
2
|
+
.page-hero h1 { font-size: 48px; line-height: 1.1; letter-spacing: -0.02em; max-width: 18ch; text-wrap: balance; }
|
|
3
|
+
.page-lede { font-size: 18px; line-height: 28px; color: var(--text-secondary); max-width: 56ch; }
|
|
4
|
+
.page-section { display: flex; flex-direction: column; gap: 8px; padding: 48px 0; border-top: 1px solid var(--border-secondary); }
|
|
5
|
+
.page-section h2 { font-size: 24px; line-height: 32px; }
|
|
6
|
+
.page-section p { color: var(--text-secondary); max-width: 64ch; }
|