@milesroxas/create-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/index.mjs CHANGED
@@ -1,18 +1,20 @@
1
1
  #!/usr/bin/env node
2
2
  // npm create @milesroxas/design-hub -- --path <absolute path> [--owner <gh account>] [--visibility private|public|none]
3
+ // [--track product|website|brand ...] [--platform webflow|payload|wordpress|emdash] [--frontend astro|next]
3
4
  //
4
5
  // Copies the template into the folder, names the project after it, pins the
5
6
  // design-hub version, starts a git repo, installs, and puts the miles-*
6
- // skills in place. With --visibility private or public it also creates the
7
+ // skills in place. With --track it records the project's tracks and keeps
8
+ // only their samples. With --visibility private or public it also creates the
7
9
  // GitHub repo and pushes. Flags only, never a prompt, one JSON object on
8
10
  // stdout, `--help` prints the schema, a second run finds the project and
9
11
  // changes nothing.
10
12
  import { spawnSync } from 'node:child_process';
11
- import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
13
+ import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
12
14
  import { basename, dirname, join } from 'node:path';
13
15
  import { fileURLToPath } from 'node:url';
14
16
  import { parseArgs } from 'node:util';
15
- import { projectManifest, RENAMES, SKIP, SKIP_DIRS, SPEC, validate } from './lib.mjs';
17
+ import { projectManifest, RENAMES, SKIP, SKIP_DIRS, SPEC, tracksArgs, validate } from './lib.mjs';
16
18
 
17
19
  const HERE = dirname(fileURLToPath(import.meta.url));
18
20
  const TEMPLATE = join(HERE, 'template');
@@ -37,6 +39,7 @@ function run(cmd, args, cwd) {
37
39
  fail(`${cmd} ${args[0]} failed.`, {
38
40
  command: [cmd, ...args].join(' '),
39
41
  stderr: out.stderr.trim().slice(-600),
42
+ stdout: out.stdout.trim().slice(-600),
40
43
  });
41
44
  return out.stdout.trim();
42
45
  }
@@ -54,6 +57,9 @@ try {
54
57
  owner: { type: 'string' },
55
58
  visibility: { type: 'string' },
56
59
  link: { type: 'string' },
60
+ track: { type: 'string', multiple: true },
61
+ platform: { type: 'string' },
62
+ frontend: { type: 'string' },
57
63
  'no-install': { type: 'boolean' },
58
64
  },
59
65
  strict: true,
@@ -71,10 +77,13 @@ if (major < 22 || (major === 22 && minor < 18))
71
77
 
72
78
  const errors = validate(values);
73
79
  if (Object.keys(errors).length) fail(Object.values(errors).join(' '), { errors });
74
- const { path, visibility = 'none', link } = values;
80
+ const { path, visibility = 'none', link, track = [] } = values;
75
81
  const name = basename(path);
76
82
  // dev claims the folder's port on its first start; bootstrap is only for its flags (TypeSafe, Vercel, Conductor).
77
- const next = `pnpm --dir "${path}" ${values['no-install'] ? 'install' : 'dev'}`;
83
+ const next =
84
+ values['no-install'] && track.length
85
+ ? `pnpm --dir "${path}" install, then pnpm --dir "${path}" exec design-hub ${tracksArgs(values).join(' ')}`
86
+ : `pnpm --dir "${path}" ${values['no-install'] ? 'install' : 'dev'}`;
78
87
 
79
88
  // A second run finds the project already there and changes nothing.
80
89
  if (existsSync(join(path, 'package.json')) && existsSync(join(path, '.git'))) {
@@ -114,6 +123,7 @@ run('git', ['init', '-b', 'main'], path);
114
123
  if (!values['no-install']) {
115
124
  run('pnpm', ['install'], path);
116
125
  run(join(path, 'node_modules', '.bin', 'design-hub'), ['skills'], path);
126
+ if (track.length) run(join(path, 'node_modules', '.bin', 'design-hub'), tracksArgs(values), path);
117
127
  }
118
128
  run('git', ['add', '-A'], path);
119
129
  run(
@@ -152,4 +162,4 @@ if (visibility !== 'none') {
152
162
  );
153
163
  repo = `https://github.com/${owner}/${name}`;
154
164
  }
155
- print({ ok: true, path, repo, created: true, next });
165
+ print({ ok: true, path, repo, created: true, ...(track.length ? { tracks: track } : {}), next });
package/lib.mjs CHANGED
@@ -27,9 +27,25 @@ export const SPEC = {
27
27
  description:
28
28
  'Developing Design Hub itself: a local path to packages/design-hub, installed with the link: protocol.',
29
29
  },
30
+ '--track': {
31
+ type: 'list',
32
+ choices: ['product', 'website', 'brand'],
33
+ description:
34
+ 'A track the project has, repeated for several. Keeps only their samples. Default: every sample, tracks unset.',
35
+ },
36
+ '--platform': {
37
+ type: 'string',
38
+ choices: ['webflow', 'payload', 'wordpress', 'emdash'],
39
+ description: 'With --track website: where the site is built.',
40
+ },
41
+ '--frontend': {
42
+ type: 'string',
43
+ choices: ['astro', 'next'],
44
+ description: 'With Payload or WordPress: the front end. Webflow takes none; EmDash is always Astro.',
45
+ },
30
46
  '--no-install': { type: 'boolean', description: 'Copy the template and stop before pnpm install.' },
31
47
  },
32
- output: '{ ok, path, repo, created, next }',
48
+ output: '{ ok, path, repo, created, tracks?, next }',
33
49
  };
34
50
 
35
51
  /** Files the template stores under another name, because npm drops dotfiles of these names from a package. */
@@ -38,12 +54,44 @@ export const RENAMES = { _gitignore: '.gitignore', _gitattributes: '.gitattribut
38
54
  /** What is copied from the template: everything but what a project makes for itself. */
39
55
  export const SKIP = new Set(['node_modules', 'dist', '.env', 'pnpm-lock.yaml']);
40
56
  export const SKIP_DIRS = {
41
- '.design-hub': new Set(['checks.json']),
57
+ '.design-hub': new Set(['checks.json', 'project.json']),
42
58
  '.claude': new Set(['settings.json']),
43
59
  };
44
60
 
61
+ const TRACKS = ['product', 'website', 'brand'];
62
+ // The platform rules of design-hub's core/project.ts, checked here before
63
+ // anything is copied, because the package that owns them is not installed
64
+ // yet. `design-hub tracks set` applies them again after the install.
65
+ const PLATFORM_FRONTEND = { webflow: null, emdash: 'astro', payload: 'choose', wordpress: 'choose' };
66
+
67
+ /** The problem with a set of tracks and a website platform, or null. */
68
+ export function tracksProblem({ track = [], platform, frontend }) {
69
+ const unknown = track.filter((t) => !TRACKS.includes(t));
70
+ if (unknown.length) return `--track takes ${TRACKS.join(', ')}; got ${unknown.join(', ')}.`;
71
+ if ((platform || frontend) && !track.includes('website'))
72
+ return '--platform and --frontend need --track website.';
73
+ if (frontend && !platform) return '--frontend needs --platform.';
74
+ if (!platform) return null;
75
+ if (!(platform in PLATFORM_FRONTEND))
76
+ return `--platform takes ${Object.keys(PLATFORM_FRONTEND).join(', ')}.`;
77
+ const rule = PLATFORM_FRONTEND[platform];
78
+ if (rule === 'choose' && !['astro', 'next'].includes(frontend ?? ''))
79
+ return `${platform} needs --frontend astro or next.`;
80
+ if (rule !== 'choose' && frontend && frontend !== rule)
81
+ return rule ? `${platform} always uses ${rule}.` : `${platform} renders its own pages; drop --frontend.`;
82
+ return null;
83
+ }
84
+
85
+ /** Flags for `design-hub tracks set`, which records the tracks and drops the other tracks' samples. */
86
+ export function tracksArgs({ track = [], platform, frontend }) {
87
+ const args = ['tracks', 'set', ...track.flatMap((t) => ['--track', t]), '--remove-samples'];
88
+ if (platform) args.push('--platform', platform);
89
+ if (frontend) args.push('--frontend', frontend);
90
+ return args;
91
+ }
92
+
45
93
  /** The problems with a create request, by flag; empty when it is valid. */
46
- export function validate({ path, visibility = 'none', template, link }) {
94
+ export function validate({ path, visibility = 'none', template, link, track, platform, frontend }) {
47
95
  const errors = {};
48
96
  if (!path || !isAbsolute(path)) errors.path = '--path takes an absolute folder.';
49
97
  else if (!/^[\w.-]+$/.test(basename(path)))
@@ -53,6 +101,8 @@ export function validate({ path, visibility = 'none', template, link }) {
53
101
  if (template !== undefined && !/^[\w.-]+\/[\w.-]+$/.test(template))
54
102
  errors.template = '--template takes owner/repo.';
55
103
  if (link !== undefined && !isAbsolute(link)) errors.link = '--link takes an absolute path.';
104
+ const tracks = tracksProblem({ track, platform, frontend });
105
+ if (tracks) errors.track = tracks;
56
106
  return errors;
57
107
  }
58
108
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milesroxas/create-design-hub",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Create a Design Hub project: the thin folder of prototypes, kit materials and docs that installs the @milesroxas/design-hub package. Runs as `npm create @milesroxas/design-hub`.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -23,6 +23,7 @@
23
23
  "!template/node_modules",
24
24
  "!template/.design-hub/*",
25
25
  "template/.design-hub/checks.json",
26
+ "template/.design-hub/project.json",
26
27
  "!template/.claude/skills",
27
28
  "!template/dist",
28
29
  "!template/.env",
@@ -31,7 +32,7 @@
31
32
  ],
32
33
  "devDependencies": {
33
34
  "@biomejs/biome": "2.6.3",
34
- "@milesroxas/design-hub": "0.2.0"
35
+ "@milesroxas/design-hub": "0.3.0"
35
36
  },
36
37
  "scripts": {
37
38
  "check": "biome check --config-path ../design-hub/configs/biome .",
package/setup/app.html CHANGED
@@ -204,6 +204,13 @@
204
204
  .choice input:checked { border: 1.5px solid var(--text); }
205
205
  .choice input:checked::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--text); }
206
206
  .choice input:focus-visible { outline: none; }
207
+ .choice input[type=checkbox] { border-radius: 4px; }
208
+ .choice input[type=checkbox]:checked { background: var(--text); border-color: var(--text); }
209
+ .choice input[type=checkbox]:checked::after { width: 8px; height: 4px; border-radius: 0; background: none; border-left: 1.5px solid var(--surface); border-bottom: 1.5px solid var(--surface); transform: translateY(-1px) rotate(-45deg); }
210
+ fieldset { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: var(--s2); }
211
+ legend { padding: 0; margin-bottom: var(--s2); font-size: var(--text-sm); font-weight: 500; }
212
+ .inline-choices { display: flex; flex-wrap: wrap; gap: var(--s2); }
213
+ .inline-choices .choice { padding: var(--s3) var(--s4); }
207
214
  .choice-body { display: grid; gap: 2px; }
208
215
  .choice-title { font-weight: 500; }
209
216
  .choice:has(input:disabled) .choice-title { color: var(--disabled-text); }
@@ -374,6 +381,50 @@
374
381
  <button type="button" class="small quiet" id="pick-folder" aria-label="Change where the project is saved">Change…</button>
375
382
  </div>
376
383
  </div>
384
+ <fieldset>
385
+ <legend>What is this project? <span class="optional">Pick every one that applies</span></legend>
386
+ <div class="choices">
387
+ <label class="choice">
388
+ <input type="checkbox" name="track" value="product">
389
+ <div class="choice-body">
390
+ <div class="choice-title">Product</div>
391
+ <div class="choice-desc">App screens in a sidebar and top bar, handed to the client's engineers as a spec.</div>
392
+ </div>
393
+ </label>
394
+ <label class="choice">
395
+ <input type="checkbox" name="track" value="website">
396
+ <div class="choice-body">
397
+ <div class="choice-title">Website</div>
398
+ <div class="choice-desc">Pages with a header and footer, built on a CMS.</div>
399
+ </div>
400
+ </label>
401
+ <label class="choice">
402
+ <input type="checkbox" name="track" value="brand">
403
+ <div class="choice-body">
404
+ <div class="choice-title">Brand collateral</div>
405
+ <div class="choice-desc">Social posts, slides and print, from the brand's design system.</div>
406
+ </div>
407
+ </label>
408
+ </div>
409
+ <p class="error-text" data-error="track" role="alert"></p>
410
+ </fieldset>
411
+ <fieldset id="platform-field" hidden>
412
+ <legend>Where is the website built?</legend>
413
+ <div class="inline-choices">
414
+ <label class="choice"><input type="radio" name="platform" value="webflow"><div class="choice-body"><div class="choice-title">Webflow</div></div></label>
415
+ <label class="choice"><input type="radio" name="platform" value="payload"><div class="choice-body"><div class="choice-title">Payload</div></div></label>
416
+ <label class="choice"><input type="radio" name="platform" value="wordpress"><div class="choice-body"><div class="choice-title">WordPress</div></div></label>
417
+ <label class="choice"><input type="radio" name="platform" value="emdash"><div class="choice-body"><div class="choice-title">EmDash</div></div></label>
418
+ </div>
419
+ <p class="hint" id="platform-hint">Not decided yet? Leave it; you can set it later.</p>
420
+ </fieldset>
421
+ <fieldset id="frontend-field" hidden>
422
+ <legend>Which front end?</legend>
423
+ <div class="inline-choices">
424
+ <label class="choice"><input type="radio" name="frontend" value="astro"><div class="choice-body"><div class="choice-title">Astro</div></div></label>
425
+ <label class="choice"><input type="radio" name="frontend" value="next"><div class="choice-body"><div class="choice-title">Next.js</div></div></label>
426
+ </div>
427
+ </fieldset>
377
428
  <div class="actions"><button class="primary" type="submit">Continue</button></div>
378
429
  </form>
379
430
  </section>
@@ -703,8 +754,33 @@
703
754
  if (res.path) { form.parent = res.path; form.parentDisplay = res.display; renderWhere(); }
704
755
  };
705
756
 
757
+ const checked = (name) => $$(`input[name=${name}]:checked`).map((i) => i.value);
758
+ const PLATFORM_HINT = {
759
+ webflow: 'Webflow renders its own pages.',
760
+ emdash: 'EmDash sites are built with Astro and deployed on Cloudflare.',
761
+ };
762
+ function syncTracks() {
763
+ const website = checked('track').includes('website');
764
+ const [platform] = checked('platform');
765
+ $('#platform-field').hidden = !website;
766
+ $('#frontend-field').hidden = !website || !['payload', 'wordpress'].includes(platform);
767
+ $('#platform-hint').textContent = PLATFORM_HINT[platform] ?? 'Not decided yet? Leave it; you can set it later.';
768
+ $('[data-error=track]').textContent = '';
769
+ }
770
+ for (const i of $$('input[name=track], input[name=platform]')) i.addEventListener('change', syncTracks);
771
+ function tracks() {
772
+ const track = checked('track');
773
+ const [platform = ''] = track.includes('website') ? checked('platform') : [];
774
+ const [frontend = ''] = ['payload', 'wordpress'].includes(platform) ? checked('frontend') : [];
775
+ return { track, platform, frontend };
776
+ }
777
+
706
778
  $('#name-form').addEventListener('submit', async (e) => {
707
779
  e.preventDefault();
780
+ if (!checked('track').length) {
781
+ $('[data-error=track]').textContent = 'Pick at least one.';
782
+ return $('input[name=track]').focus();
783
+ }
708
784
  const name = $('#project-name').value;
709
785
  const res = await api('/api/path', { name, parent: form.parent });
710
786
  if (!res.ok) {
@@ -786,6 +862,7 @@
786
862
  owner: $('#owner').value,
787
863
  typesafeKey: $('#typesafe-key').value,
788
864
  conductorBranch: $('#conductor-branch').value,
865
+ ...tracks(),
789
866
  };
790
867
  }
791
868
 
@@ -815,6 +892,7 @@
815
892
  const n = $(`[data-error=${field}]`);
816
893
  if (n) n.textContent = msg;
817
894
  }
895
+ if (event.errors.track) return show('name');
818
896
  if (event.errors.name || event.errors.parent) {
819
897
  $('#name-error').textContent = event.errors.name ?? event.errors.parent;
820
898
  return show('name');
package/setup/lib.mjs CHANGED
@@ -2,6 +2,7 @@
2
2
  // create-design-hub and bootstrap, and the plain-language version of their errors.
3
3
  // No I/O here, so every rule is tested without a server or a disk.
4
4
  import { isAbsolute, join } from 'node:path';
5
+ import { tracksProblem } from '../lib.mjs';
5
6
  import { slugify } from './slug.mjs';
6
7
 
7
8
  /** What to do when nothing more specific is known. */
@@ -61,9 +62,20 @@ export function validateCreate(body, { home }) {
61
62
  const target = projectPath(b, home);
62
63
  Object.assign(errors, target.errors);
63
64
  value.path = target.path;
65
+ Object.assign(value, trackValue(b, errors));
64
66
  return Object.keys(errors).length ? { ok: false, errors } : { ok: true, value };
65
67
  }
66
68
 
69
+ /** The tracks and website platform from the page, recording the problem under `track`. */
70
+ function trackValue(b, errors) {
71
+ const track = Array.isArray(b.track) ? b.track.map(String) : [];
72
+ const platform = String(b.platform ?? '').trim() || undefined;
73
+ const frontend = String(b.frontend ?? '').trim() || undefined;
74
+ const problem = track.length ? tracksProblem({ track, platform, frontend }) : 'Pick at least one.';
75
+ if (problem) errors.track = problem;
76
+ return { track, platform, frontend };
77
+ }
78
+
67
79
  /** Flags for create-design-hub: the copy only; the install is its own step. `link` is a local design-hub checkout. */
68
80
  export function createArgs({ path, visibility, owner, link }) {
69
81
  const args = ['--path', path, '--visibility', visibility === 'local' ? 'none' : visibility, '--no-install'];
@@ -33,9 +33,20 @@ test('readPort reads the PORT line', () => {
33
33
  });
34
34
 
35
35
  test('validateCreate builds the path and rejects bad fields', () => {
36
- const ok = validateCreate({ name: 'Acme', visibility: 'local' }, { home: HOME });
36
+ const ok = validateCreate({ name: 'Acme', visibility: 'local', track: ['product'] }, { home: HOME });
37
37
  assert.equal(ok.ok, true);
38
38
  assert.equal(ok.value.path, '/Users/sam/Design/acme');
39
+ assert.deepEqual(ok.value.track, ['product']);
40
+ const site = validateCreate(
41
+ { name: 'Acme', track: ['website'], platform: 'payload', frontend: 'next' },
42
+ { home: HOME },
43
+ );
44
+ assert.deepEqual([site.value.platform, site.value.frontend], ['payload', 'next']);
45
+ assert.match(validateCreate({ name: 'Acme' }, { home: HOME }).errors.track, /at least one/);
46
+ assert.match(
47
+ validateCreate({ name: 'Acme', track: ['website'], platform: 'wordpress' }, { home: HOME }).errors.track,
48
+ /needs --frontend/,
49
+ );
39
50
  const bad = validateCreate(
40
51
  {
41
52
  name: '!!',
@@ -46,7 +57,14 @@ test('validateCreate builds the path and rejects bad fields', () => {
46
57
  },
47
58
  { home: HOME },
48
59
  );
49
- assert.deepEqual(Object.keys(bad.errors).sort(), ['name', 'owner', 'parent', 'typesafeKey', 'visibility']);
60
+ assert.deepEqual(Object.keys(bad.errors).sort(), [
61
+ 'name',
62
+ 'owner',
63
+ 'parent',
64
+ 'track',
65
+ 'typesafeKey',
66
+ 'visibility',
67
+ ]);
50
68
  });
51
69
 
52
70
  test('createArgs maps local to none, drops the owner there, never installs, and links a local hub', () => {
package/setup/server.mjs CHANGED
@@ -23,6 +23,7 @@ import { createServer } from 'node:http';
23
23
  import { homedir, platform } from 'node:os';
24
24
  import { basename, delimiter, dirname, join } from 'node:path';
25
25
  import { fileURLToPath } from 'node:url';
26
+ import { tracksArgs } from '../lib.mjs';
26
27
  import {
27
28
  bootstrapArgs,
28
29
  createArgs,
@@ -182,8 +183,8 @@ async function prepare(body, send) {
182
183
  return path && { path, value: checked.value };
183
184
  }
184
185
 
185
- /** pnpm install, then the miles-* skills from the installed package. */
186
- function install(path) {
186
+ /** pnpm install, then the miles-* skills from the installed package, then the tracks (which drop the other samples). */
187
+ function install(path, value) {
187
188
  return new Promise((resolve) => {
188
189
  const child = spawn('pnpm', ['install'], { cwd: path, env: process.env });
189
190
  let err = '';
@@ -191,7 +192,10 @@ function install(path) {
191
192
  child.on('error', (e) => resolve({ ok: false, error: 'pnpm is not installed.', stderr: e.message }));
192
193
  child.on('close', (code) => {
193
194
  if (code !== 0) return resolve({ ok: false, error: 'pnpm install failed.', stderr: err.slice(-1200) });
194
- resolve(runJson(join(path, 'node_modules', '.bin', 'design-hub'), ['skills'], path));
195
+ const hub = join(path, 'node_modules', '.bin', 'design-hub');
196
+ runJson(hub, ['skills'], path).then((skills) =>
197
+ resolve(skills.ok ? runJson(hub, tracksArgs(value), path) : skills),
198
+ );
195
199
  });
196
200
  });
197
201
  }
@@ -199,7 +203,7 @@ function install(path) {
199
203
  async function create(body, send) {
200
204
  const ready = await prepare(body, send);
201
205
  if (!ready) return;
202
- const installed = await step(send, 'install', () => install(ready.path));
206
+ const installed = await step(send, 'install', () => install(ready.path, ready.value));
203
207
  if (!installed) return;
204
208
  const hub = join(ready.path, 'node_modules', '.bin', 'design-hub');
205
209
  const ported = await step(send, 'port', () =>
@@ -0,0 +1,3 @@
1
+ {
2
+ "tracks": ["product", "website", "brand"]
3
+ }
@@ -23,6 +23,16 @@ TYPESAFE_API_KEY=
23
23
  KV_REST_API_URL=
24
24
  KV_REST_API_TOKEN=
25
25
 
26
- # Optional: `pnpm fixtures-pull` reads a Webflow CMS collection with a site
27
- # token that has the cms:read scope.
26
+ # Optional: `pnpm fixtures-pull` reads real content from the website's CMS.
27
+ # Fill only the platform's lines. Read-only access is enough.
28
+ # Webflow: a site token with the cms:read scope.
28
29
  WEBFLOW_TOKEN=
30
+ # Payload: the site's origin and an API key from a user in an auth collection
31
+ # with useAPIKey on (PAYLOAD_AUTH_COLLECTION when that collection is not users).
32
+ PAYLOAD_URL=
33
+ PAYLOAD_API_KEY=
34
+ PAYLOAD_AUTH_COLLECTION=
35
+ # WordPress: the site's origin. Drafts need a user and an application password.
36
+ WORDPRESS_URL=
37
+ WORDPRESS_USER=
38
+ WORDPRESS_APP_PASSWORD=
@@ -2,14 +2,14 @@
2
2
 
3
3
  The contract for every coding agent in this project (Claude, Codex, Cursor, others). `CLAUDE.md` points here.
4
4
 
5
- This project holds prototypes, the materials they are drawn with, and the documents around them. The hub that lists and serves them, the review panel, the password gate and the `design-hub` command are the `@milesroxas/design-hub` package in `node_modules`: never edit it, never read it to do prototype work. Everything an agent touches is in this folder.
5
+ This project holds prototypes, the materials they are drawn with, and the documents around them. Its tracks, in `.design-hub/project.json`, say what kind of engagement it is: **product** (app screens, handed to the client's engineers as a spec), **website** (pages on a CMS: Webflow, Payload, WordPress or EmDash), **brand** (collateral: social posts, slides, print), or any mix. Read it before starting work; `pnpm tracks` prints it. The hub that lists and serves them, the review panel, the password gate and the `design-hub` command are the `@milesroxas/design-hub` package in `node_modules`: never edit it, never read it to do prototype work. Everything an agent touches is in this folder.
6
6
 
7
7
  ## Why it works this way
8
8
 
9
9
  Code here is for sketching, not shipping. Following Karri Saarinen's [Design is more than code](https://linear.app/now/design-is-more-than-code), a prototype answers a question that was written down first, in words. Speed comes from removing production constraints, never from skipping the problem.
10
10
 
11
11
  1. **Problem first.** `README.md` states the problem and the one question before any code exists. Restate it when you present the prototype.
12
- 2. **Two places to stand.** Pick one per prototype: the disposable shell (`AppShell` for a product, `SiteShell` for a website), the project's chrome from `kit/shell.ts` and `DESIGN.md`, Shell; or the low-gravity space (`Space`), one thing alone on a quiet canvas with the picker and live dials.
12
+ 2. **Where it stands.** Pick one per prototype: the shell of its track (`AppShell` for product, `SiteShell` for website), the project's chrome from `kit/shell.ts` and `DESIGN.md`, Shell; or the low-gravity space (`Space`), one thing alone on a quiet canvas with the picker and live dials. Brand collateral always stands on a `Board` of `Artboard`s, each at its real pixel size.
13
13
  3. **Low gravity.** A prototype imports only `@kit/*` and its own folder. Never another prototype. No tests, no stories, no abstractions for later. The fidelity ceiling is in the `miles-prototype` skill, and the fidelity guard hook says so when a write goes over it.
14
14
  4. **Fork, don't flex.** If a kit piece needs to behave differently, copy it into the prototype folder and change the copy. Never add a prop or a variant to `kit/` for one prototype.
15
15
  5. **Promote on second use.** When a second prototype copies the same thing, move it into `kit/` and point both at it.
@@ -37,15 +37,19 @@ Run from the project root. Every command prints one JSON object; `--help` prints
37
37
 
38
38
  ```bash
39
39
  pnpm dev # http://localhost:<PORT>, review panel and all
40
+ pnpm tracks # the project's tracks and website platform
40
41
  pnpm new <slug> --feature <feature> # a space prototype with the picker and dials
41
- pnpm new <slug> --app --sprint --feature <feature> # the feature's one primary prototype, in the shell
42
+ pnpm new <slug> --app --sprint --feature <feature> # the feature's one primary prototype, in its track's shell
42
43
  pnpm new <slug> --app --alternate --feature <feature> # another take on the primary
44
+ pnpm new <slug> --app --track website ... # with several tracks, name the one it belongs to
45
+ pnpm new <slug> --track brand --feature <feature> # brand collateral: a Board of artboards
43
46
  pnpm guide <feature> # the feature's walkthrough, docs/sprints/<feature>/guide.md
47
+ pnpm export <slug> # brand artboards to exports/<slug>/: PNG for posts, PDF for slides and print (miles-brand)
44
48
  pnpm check # TypeScript and Biome; must pass before you report done
45
49
  pnpm fix # Biome format and safe fixes
46
50
  pnpm preflight # every check a share link needs (miles-deploy)
47
51
  pnpm comments pull # review comments into docs/sprints/<feature>/comments.md (miles-review)
48
- pnpm fixtures-pull <slug> --collection <id> --map key=field # real fixtures from Webflow (miles-get-hostile)
52
+ pnpm fixtures-pull <slug> --collection <id> --map key=path # real fixtures from the CMS: Webflow, Payload, WordPress, or --from a JSON file (miles-get-hostile)
49
53
  pnpm commands # every command, with its flags, as JSON
50
54
  ```
51
55
 
@@ -57,16 +61,18 @@ Each checkout (the main clone, a git worktree, a harness workspace) runs on its
57
61
  prototypes/<slug>/ one prototype: README.md, index.tsx, styles.css, fixtures.json
58
62
  kit/ the project's materials: tokens.css, shell.ts (brand, nav), icons.ts, AppShell, SiteShell
59
63
  docs/sprints/<feature>/ design-doc.md, guide.md, comments.md (generated), port.md, assets/
60
- DESIGN.md PRODUCT.md the design system's named rules; who the product is for
64
+ DESIGN.md PRODUCT.md the design system's named rules (Brand for collateral); who the product is for
65
+ exports/ exported collateral, gitignored; rebuilt from the prototype any time
66
+ .design-hub/project.json the tracks and website platform (pnpm tracks set rewrites it)
61
67
  .design-hub/checks.json the Jev thresholds (design-hub calibrate --write rewrites it)
62
68
  api/review.ts proxy.ts vercel.json the deploy entries; one line each, never edited
63
69
  ```
64
70
 
65
- `prototypes/sample-list/` is the reference for every convention; delete it once the project has a feature.
71
+ Each track's sample is the reference for its conventions: `prototypes/sample-list/` for product, `prototypes/sample-page/` for website, `prototypes/sample-social/` for brand. Setup keeps only the samples of the project's tracks; delete one, with its `docs/sprints/` folder, once its track has a feature of its own.
66
72
 
67
73
  ## A prototype
68
74
 
69
- README frontmatter, all fields required (`feature` may be empty for a one-off): `title`, `summary`, `context` (space | app), `status` (exploring | decided | archived), `kind` (sprint | alternate | exploration), `feature`, `created`. `pnpm new` writes it.
75
+ README frontmatter, all fields required (`feature` may be empty for a one-off): `title`, `summary`, `context` (space | app | board), `track` (product | website | brand), `status` (exploring | decided | archived), `kind` (sprint | alternate | exploration), `feature`, `created`. `pnpm new` writes it.
70
76
 
71
77
  The README's `## States` table lists every state the prototype holds and how to reach it. The fidelity guard asks whether a write adds a state that is not there, and `miles-port` refuses a folder without the table.
72
78
 
@@ -87,6 +93,7 @@ One slug in two places: `docs/sprints/<feature>/` and the `feature:` line of eve
87
93
  | `@kit/shell` | `BRAND`, `PRODUCT` (nav, workspace, user), `SITE` (nav, footer): the one place the chrome is written. |
88
94
  | `@kit/AppShell`, `@kit/SiteShell` | The disposable shells. Mount the dialog, sheet and toast hosts and the View dials. `PageHead({ title, desc, back, actions })`. |
89
95
  | `@kit/Space` | `<Space title lede width>`: the low-gravity canvas. |
96
+ | `@kit/Artboard` | `<Board title lede>` holding `<Artboard format name>`s: collateral at real pixel size, scaled to fit on screen, written to files by `pnpm export`. `FORMATS` lists the sizes. |
90
97
  | `@kit/ui` | `Button`, `Chevron`, `Segmented`, `Badge`, `Checkbox`, `useMenu`, `Select`, `openDialog`, `confirmDialog`, `openSheet`, `toast()`, `notInPrototype(what)`. Card, table and empty-state classes in `ui.css`. |
91
98
  | `@kit/fixtures` | `fixtureSets({ real, missing }, { max, text })` returns `{ real, longest, empty, max, missing }`; `SET_NAMES` for the dial. |
92
99
  | `@kit/Variants` | `<Variants options={{ Quiet, Editorial }}>`: the picker. Keys 1-N, arrows, R; `?v=N`. |
@@ -128,6 +135,7 @@ The `miles-*` skills in `.claude/skills/` come from the `@milesroxas/design-hub`
128
135
  | `miles-deploy` | Deploying, sharing a link, the password, checking the work before either. |
129
136
  | `miles-review` | Comments from the deployed prototypes, and who may comment. |
130
137
  | `miles-port` | Turning an approved prototype into production. |
138
+ | `miles-brand` | Brand collateral: social posts, slides, print; artboards, formats and export. |
131
139
  | `miles-worktrees` | Worktrees, parallel agents, Conductor or any harness, and port collisions. |
132
140
 
133
141
  Existing skills these lean on: `emil-prototype`, `emil-animations`, `emil-touch-and-accessibility`, `emil-performance`, `emil-writing-skills` for every Markdown file, `impeccable` for a design pass. If a skill disagrees with this file, this file wins.
@@ -69,12 +69,22 @@ One paragraph on what the product is for and how the interface serves that. Name
69
69
 
70
70
  ## Shell
71
71
 
72
- Every project has a shell: a product's sidebar, top bar and content, or a website's header and footer, with a pre-footer when the design treats one as a global. Record the answer `miles-design-hub` collected so it is built once and never asked again:
72
+ The shell follows the tracks in `.design-hub/project.json`: a product draws `AppShell` (sidebar, top bar, content), a website draws `SiteShell` (header and footer, with a pre-footer when the design treats one as a global), and brand collateral has no shell. Record, per track the project has, what `miles-design-hub` collected so it is built once and never asked again:
73
73
 
74
- - **Kind:** product or website.
75
- - **Paper frames:** the link to each frame that holds the shell (header, sidebar, footer, pre-footer). Empty when the design has no shell and prototypes stand in the Space.
74
+ - **Product:** the link to each Paper frame that holds the sidebar and top bar, or "from the sample".
75
+ - **Website:** the link to each Paper frame that holds the header, footer and pre-footer, or "from the sample".
76
76
  - **Where it is built:** `kit/shell.ts` (brand, navigation, people) and `AppShell.tsx` or `SiteShell.tsx`. A prototype never rebuilds the shell inside its own folder.
77
77
 
78
+ ## Brand
79
+
80
+ For a project with the brand track. Collateral is drawn from the same tokens as everything else; this section holds what tokens cannot say. `miles-brand` reads it before any artboard. Leave it out when the project has no brand track.
81
+
82
+ - **Logo:** each lockup, its file in `kit/icons.ts` or `public/`, its clear space (in units of the mark's height) and its minimum size in pixels. When it goes on the brand colour and when on the page colour.
83
+ - **Imagery:** the photo or illustration style in two sentences, the crops each format uses, and what never appears.
84
+ - **Collateral type:** the headline, subhead and body sizes at 1080 wide, and the shortest headline that still reads at feed size.
85
+ - **Formats:** the formats the brand runs (`post-square`, `post-portrait`, `story`, `link-preview`, `banner`, `slide`, `a4`, `letter`) and where each goes. A story keeps type and the logo out of its top and bottom 250px.
86
+ - **Voice:** the rule for headlines and calls to action, with one right and one wrong example.
87
+
78
88
  ## Colors
79
89
 
80
90
  Group by role: primary, neutral, status, any utility family. For each colour, its name, hex, token, what it is for and its dark value. Then the named rules, each a bold name and a paragraph that says the rule and why it holds.
@@ -13,7 +13,7 @@ Not a developer? The [guide](https://github.com/milesroxas/design-hub/tree/main/
13
13
 
14
14
  | Path | What goes there |
15
15
  | --- | --- |
16
- | `prototypes/<slug>/` | One prototype: its README, code, styles and fixtures. `sample-list/` is the reference; delete it once the project has a feature. |
16
+ | `prototypes/<slug>/` | One prototype: its README, code, styles and fixtures. Each track keeps its sample as the reference (`sample-list/` for product, `sample-page/` for website); delete one once its track has a feature. |
17
17
  | `kit/` | The project's materials: `tokens.css`, `shell.ts` (brand and navigation), `icons.ts`, the disposable `AppShell` and `SiteShell`. |
18
18
  | `docs/sprints/<feature>/` | A feature's design doc, walkthrough, pulled comments and port report. |
19
19
  | `DESIGN.md`, `PRODUCT.md` | The recorded design system and who the product is for. |
@@ -9,6 +9,9 @@
9
9
  # Dependencies and builds
10
10
  node_modules/
11
11
  dist/
12
+
13
+ # Exported collateral: files to hand over, rebuilt from the prototype any time
14
+ exports/
12
15
  .vercel/
13
16
 
14
17
  # Environment and secrets
@@ -19,9 +22,10 @@ dist/
19
22
  # Logs
20
23
  *.log
21
24
 
22
- # Local state: the Jev log and its labels, the dev review store. checks.json is the project's thresholds and stays.
25
+ # Local state: the Jev log and its labels, the dev review store. checks.json (the thresholds) and project.json (the tracks) stay.
23
26
  .design-hub/*
24
27
  !.design-hub/checks.json
28
+ !.design-hub/project.json
25
29
 
26
30
  # Obsidian per-machine state (docs/ is an Obsidian vault)
27
31
  docs/.obsidian/workspace*.json
@@ -0,0 +1,63 @@
1
+ ---
2
+ type: guide
3
+ feature: sample-brand
4
+ date: 2026-11-24
5
+ audience: Anyone learning the template
6
+ ---
7
+
8
+ # Sample social post: a walkthrough
9
+
10
+ The brand track's reference: one announcement post in three formats, at real size, with every fixture set, layout and tone on a dial. Nothing here is a real campaign. It exists so a reviewer can see what collateral from this hub looks like, and so Claude has a working example of the conventions to read.
11
+
12
+ ## Before you start
13
+
14
+ 1. **Open the prototype** at `/sample-social/`.
15
+ 2. **Find Controls.** The dark round button at the top of the page opens a panel that belongs to the board, not the post. Review holds the fixture set, the post, the layout and the tone; Board holds the zoom and the safe-area guides; View holds theme and motion. The panel's last row, **Open the walkthrough**, brings this page back in a new tab.
16
+ 3. **Nothing persists.** Reload and the board is back on the first real post.
17
+
18
+ ## 1. Read the board
19
+
20
+ **Do:** open the prototype. The same post sits in three artboards: square, portrait and story, each labelled with its format and size.
21
+
22
+ - Each artboard is drawn at its real size (1080 wide) and scaled to fit the screen. Type sizes in the code are the sizes that ship.
23
+ - The story's top and bottom 250px are shaded: the platform's own buttons cover them, so type and the mark stay out.
24
+
25
+ ## 2. Break it
26
+
27
+ Controls → Review → Fixtures → **longest**
28
+
29
+ The headline and subhead doubled. The headline wraps; the square, with the least room, is where it breaks first.
30
+
31
+ Controls → Review → Fixtures → **missing**, then Post → **1** and **2**
32
+
33
+ A post with no image or kicker, and one with no subhead or call to action. The photo shows a dashed outline where the image would be.
34
+
35
+ Controls → Review → Fixtures → **empty**
36
+
37
+ No post: each artboard says so.
38
+
39
+ ## 3. Change the template
40
+
41
+ Controls → Review → Layout → **type**, Tone → **light**
42
+
43
+ The copy alone, larger, on the page colour. Every combination is a state the export can write.
44
+
45
+ ## 4. Export it
46
+
47
+ Ask Claude to export the post, or run `pnpm export sample-social`. It writes one PNG per artboard into `exports/sample-social/`, at exactly 1080 wide, from the dial state you name.
48
+
49
+ ## Every state, and how to reach it
50
+
51
+ | State | How to reach it |
52
+ | --- | --- |
53
+ | Real post | Controls → Review → Fixtures → **real** |
54
+ | Longest copy | Controls → Review → Fixtures → **longest** |
55
+ | No post | Controls → Review → Fixtures → **empty** |
56
+ | Missing content | Controls → Review → Fixtures → **missing** |
57
+ | Another post | Controls → Review → Post → **2** or **3** |
58
+ | Type only | Controls → Review → Layout → **type** |
59
+ | Light tone | Controls → Review → Tone → **light** |
60
+
61
+ ## What we need from you
62
+
63
+ Nothing. Delete `prototypes/sample-social/` and `docs/sprints/sample-brand/` once the project has a brand feature of its own.
@@ -0,0 +1,69 @@
1
+ ---
2
+ type: guide
3
+ feature: sample-site
4
+ date: 2026-11-24
5
+ audience: Anyone learning the template
6
+ ---
7
+
8
+ # Sample page: a walkthrough
9
+
10
+ The website track's reference: a journal index inside the website shell, with every fixture set on a dial. Nothing here is a real site. It exists so a reviewer can see what a website prototype from this hub looks like, and so Claude has a working example of the conventions to read.
11
+
12
+ ## Before you start
13
+
14
+ 1. **Open the prototype** at `/sample-page/`.
15
+ 2. **Find Controls.** The dark round button at the top of the page opens a panel that belongs to the prototype, not the site. Review holds the fixture set and the column count; Motion holds the two numbers the entrance uses; View holds theme, reduced motion and speed. The panel's last row, **Open the walkthrough**, brings this page back in a new tab.
16
+ 3. **Nothing persists.** Reload and the grid is back on the real set.
17
+
18
+ ## 1. Read the journal
19
+
20
+ **Do:** open the prototype. Six posts arrive one after another, under the site's header and above its footer.
21
+
22
+ - The card is the link. Category and date sit above the title; the excerpt stops at three lines.
23
+ - The header and footer come from `kit/shell.ts`, written once for every page of the site.
24
+
25
+ **Try:** click a card. A dark toast says the post would open here. That is the prototype speaking, not the site.
26
+
27
+ ## 2. Break it
28
+
29
+ Controls → Review → Fixtures → **longest**
30
+
31
+ The first post carries the longest real title and excerpt doubled. The title wraps; the excerpt still stops at three lines, so the row stays level.
32
+
33
+ Controls → Review → Fixtures → **empty**
34
+
35
+ No posts: the grid gives way to one line and a Subscribe action.
36
+
37
+ Controls → Review → Fixtures → **max**
38
+
39
+ Forty posts, the design's maximum for one page. The entrance stagger is capped at the eighth card.
40
+
41
+ Controls → Review → Fixtures → **missing**
42
+
43
+ A post with no image, one with no excerpt or category, one with no title or date. Each says what is missing where the value would be.
44
+
45
+ ## 3. Change the grid
46
+
47
+ Controls → Review → Columns → **2**
48
+
49
+ Two cards per row on a wide screen. Phones always show one.
50
+
51
+ ## Every state, and how to reach it
52
+
53
+ | State | How to reach it |
54
+ | --- | --- |
55
+ | Real posts | Controls → Review → Fixtures → **real** |
56
+ | Longest titles | Controls → Review → Fixtures → **longest** |
57
+ | Empty | Controls → Review → Fixtures → **empty** |
58
+ | Maximum count | Controls → Review → Fixtures → **max** |
59
+ | Missing content | Controls → Review → Fixtures → **missing** |
60
+ | Two columns | Controls → Review → Columns → **2** |
61
+ | Dark | Controls → View → Theme → **dark** |
62
+
63
+ ## What the prototype does not do
64
+
65
+ Opening a post and subscribing are scope toasts. The header's other links are the shell's stubs.
66
+
67
+ ## What we need from you
68
+
69
+ Nothing. Delete `prototypes/sample-page/` and `docs/sprints/sample-site/` once the project has a website feature of its own.
@@ -34,6 +34,7 @@ export const SITE = {
34
34
  nav: [
35
35
  { href: '#/', label: 'Home' },
36
36
  { href: '#/work', label: 'Work' },
37
+ { href: '#/journal', label: 'Journal' },
37
38
  { href: '#/about', label: 'About' },
38
39
  { href: '#/contact', label: 'Contact' },
39
40
  ] satisfies SiteLink[],
@@ -9,8 +9,10 @@
9
9
  "dev": "design-hub dev",
10
10
  "build": "design-hub build",
11
11
  "preview": "design-hub preview",
12
+ "export": "design-hub export",
12
13
  "bootstrap": "design-hub bootstrap",
13
14
  "new": "design-hub new",
15
+ "tracks": "design-hub tracks",
14
16
  "guide": "design-hub guide",
15
17
  "check": "design-hub check",
16
18
  "fix": "design-hub check --fix",
@@ -2,6 +2,7 @@
2
2
  title: Sample list
3
3
  summary: A list page with every fixture set on a dial, as the reference for the conventions.
4
4
  context: app
5
+ track: product
5
6
  status: exploring
6
7
  kind: sprint
7
8
  feature: sample
@@ -0,0 +1,52 @@
1
+ ---
2
+ title: Sample page
3
+ summary: A journal index inside the website shell, with every fixture set on a dial, as the reference for a website's conventions.
4
+ context: app
5
+ track: website
6
+ status: exploring
7
+ kind: sprint
8
+ feature: sample-site
9
+ created: 2026-11-24
10
+ ---
11
+
12
+ # Sample page
13
+
14
+ The website track's reference prototype. It shows what a website prototype from this hub looks like: a page inside `SiteShell`, sections that read their content the way the CMS hands it over, hostile fixtures on a dial, and a walkthrough at `/guide/sample-site/`. Delete it when the project has a website feature of its own.
15
+
16
+ ## Problem
17
+
18
+ A CMS page is designed with six tidy posts and launched with a hundred messy ones. Editors skip images, write long titles and publish drafts without excerpts, and the grid breaks on the first week of real content.
19
+
20
+ ## Question
21
+
22
+ Does the journal grid hold up under every fixture set, in two and three columns, without a card changing height in a way that breaks the row?
23
+
24
+ ## Flows
25
+
26
+ | Flow | Starts from | Edge cases |
27
+ | --- | --- | --- |
28
+ | Read the journal | `#/journal` | longest title, no posts, 40 posts, no image, no excerpt |
29
+ | Open a post | a card | the card is the link; Open is a scope toast |
30
+ | Filter by category | a category chip | a scope toast; filtering is not this prototype's question |
31
+
32
+ ## States
33
+
34
+ Every state the prototype holds, one row each. The fidelity guard and `miles-port` read this table.
35
+
36
+ | State | How to reach it |
37
+ | --- | --- |
38
+ | Real posts | Controls → Review → Fixtures → **real** |
39
+ | Longest titles | Controls → Review → Fixtures → **longest** |
40
+ | Empty | Controls → Review → Fixtures → **empty** |
41
+ | Maximum count | Controls → Review → Fixtures → **max** |
42
+ | Missing content | Controls → Review → Fixtures → **missing** |
43
+ | Two columns | Controls → Review → Columns → **2** |
44
+ | Dark | Controls → View → Theme → **dark** |
45
+
46
+ ## Fixtures
47
+
48
+ `fixtures.json` holds `real` (six posts written from the comp; a CMS project pulls them from its posts collection with the fields `title`, `excerpt`, `category`, `published` and `image`) and `missing` (hand-written: no image, no excerpt or category, no title or date). `@kit/fixtures` derives `longest`, `empty` and `max`; the design's maximum is 40 posts on one page.
49
+
50
+ ## Decision
51
+
52
+ Empty until picked. What was chosen, its values, and what was rejected and why. Then delete the folder.
@@ -0,0 +1,78 @@
1
+ {
2
+ "real": [
3
+ {
4
+ "id": "1",
5
+ "title": "How we plan a site rebuild in two weeks",
6
+ "excerpt": "The questions we ask before the first frame, and the ones we leave for the build.",
7
+ "category": "Process",
8
+ "published": "2026-10-28",
9
+ "image": "#dbe6fe"
10
+ },
11
+ {
12
+ "id": "2",
13
+ "title": "Choosing a CMS your editors will like",
14
+ "excerpt": "Webflow, Payload, WordPress and EmDash, compared on the work editors do every day.",
15
+ "category": "Platforms",
16
+ "published": "2026-10-21",
17
+ "image": "#fedf89"
18
+ },
19
+ {
20
+ "id": "3",
21
+ "title": "A pricing page that answers the second question",
22
+ "excerpt": "Visitors read the price, then look for what happens after they pay.",
23
+ "category": "Case study",
24
+ "published": "2026-10-14",
25
+ "image": "#a9efc5"
26
+ },
27
+ {
28
+ "id": "4",
29
+ "title": "Motion that survives a slow phone",
30
+ "excerpt": "What we animate, what we fade, and what we never move.",
31
+ "category": "Craft",
32
+ "published": "2026-10-07",
33
+ "image": "#fecdc9"
34
+ },
35
+ {
36
+ "id": "5",
37
+ "title": "Writing alt text people actually hear",
38
+ "excerpt": "Short, specific, and written for the sentence around the image.",
39
+ "category": "Accessibility",
40
+ "published": "2026-09-30",
41
+ "image": "#e9d7fe"
42
+ },
43
+ {
44
+ "id": "6",
45
+ "title": "The footer is a sitemap, not a junk drawer",
46
+ "excerpt": "Three columns, one note, and nothing a visitor has to hunt for.",
47
+ "category": "Craft",
48
+ "published": "2026-09-23",
49
+ "image": "#d1fadf"
50
+ }
51
+ ],
52
+ "missing": [
53
+ {
54
+ "id": "m1",
55
+ "title": "A post with no image",
56
+ "excerpt": "Editors skip the image more often than the design expects.",
57
+ "category": "Process",
58
+ "published": "2026-10-28",
59
+ "image": null
60
+ },
61
+ {
62
+ "id": "m2",
63
+ "title": "A post with no excerpt",
64
+ "excerpt": "",
65
+ "category": "",
66
+ "published": "2026-10-21",
67
+ "image": "#fedf89"
68
+ },
69
+ {
70
+ "id": "m3",
71
+ "title": "",
72
+ "excerpt": "A draft that was published before it had a title.",
73
+ "category": "Platforms",
74
+ "published": "",
75
+ "image": "#a9efc5"
76
+ }
77
+ ]
78
+ }
@@ -0,0 +1,115 @@
1
+ import { DialVars, useDials } from '@kit/dials';
2
+ import { type FixtureSets, fixtureSets, SET_NAMES, type SetName } from '@kit/fixtures';
3
+ import { fmtDate, plural } from '@kit/format';
4
+ import { SiteShell } from '@kit/SiteShell';
5
+ import { Button, notInPrototype, toast } from '@kit/ui';
6
+ import type { CSSProperties } from 'react';
7
+ import data from './fixtures.json';
8
+ import './styles.css';
9
+
10
+ type Post = {
11
+ id: string;
12
+ title: string;
13
+ excerpt: string;
14
+ category: string;
15
+ published: string;
16
+ image: string | null;
17
+ };
18
+
19
+ const MAX_POSTS = 40;
20
+ const sets: FixtureSets<Post> = fixtureSets(data satisfies { real: Post[]; missing: Post[] }, {
21
+ max: MAX_POSTS,
22
+ text: ['title', 'excerpt'],
23
+ });
24
+
25
+ function PostCard({ post, index }: { post: Post; index: number }) {
26
+ return (
27
+ <li className="post" style={{ '--i': Math.min(index, 8) } as CSSProperties}>
28
+ <a
29
+ className="post-link"
30
+ href={`#/journal/${post.id}`}
31
+ onClick={(e) => {
32
+ e.preventDefault();
33
+ toast(`${post.title || 'The post'} would open here.`, { kind: 'scope' });
34
+ }}
35
+ >
36
+ {post.image ? (
37
+ <span className="post-image" style={{ background: post.image }} aria-hidden="true" />
38
+ ) : (
39
+ <span className="post-image is-missing" aria-hidden="true" />
40
+ )}
41
+ <span className="post-meta">
42
+ {post.category ? <span className="post-category">{post.category}</span> : null}
43
+ <time className="tabular" dateTime={post.published}>
44
+ {fmtDate(post.published) || 'Unscheduled'}
45
+ </time>
46
+ </span>
47
+ <span className="post-title">{post.title || <span className="post-untitled">Untitled</span>}</span>
48
+ {post.excerpt ? <span className="post-excerpt">{post.excerpt}</span> : null}
49
+ </a>
50
+ </li>
51
+ );
52
+ }
53
+
54
+ // The journal is its own component so its Review panel registers before the
55
+ // Motion dials and View: a child registers before its parent, and siblings in order.
56
+ function Journal() {
57
+ const review = useDials(
58
+ 'Review',
59
+ {
60
+ fixtures: { type: 'select', options: [...SET_NAMES], default: 'real' },
61
+ columns: { type: 'select', options: ['3', '2'], default: '3' },
62
+ },
63
+ {
64
+ hints: {
65
+ fixtures:
66
+ 'Which fixture set the grid shows. longest, empty and max are derived from real by @kit/fixtures.',
67
+ columns: 'Cards per row on a wide screen. Phones always show one.',
68
+ },
69
+ },
70
+ );
71
+ const posts = sets[review.fixtures as SetName];
72
+
73
+ return (
74
+ <div className="journal" data-columns={review.columns}>
75
+ <header className="journal-head">
76
+ <h1>Journal</h1>
77
+ <p className="journal-lede">Notes on the work: process, platforms and craft.</p>
78
+ </header>
79
+ {posts.length === 0 ? (
80
+ <div className="journal-empty">
81
+ <h2>No posts yet</h2>
82
+ <p>The first post appears here when it is published.</p>
83
+ <Button kind="secondary" label="Subscribe" onClick={() => notInPrototype('Subscribing')} />
84
+ </div>
85
+ ) : (
86
+ <>
87
+ <ul className="posts">
88
+ {posts.map((post, i) => (
89
+ <PostCard key={post.id} post={post} index={i} />
90
+ ))}
91
+ </ul>
92
+ <p className="journal-foot tabular">{plural(posts.length, 'post')}</p>
93
+ </>
94
+ )}
95
+ </div>
96
+ );
97
+ }
98
+
99
+ export default function Prototype() {
100
+ return (
101
+ <SiteShell active="#/journal">
102
+ <Journal />
103
+ <DialVars
104
+ name="Motion"
105
+ config={{ rise: [260, 0, 600, 10], stagger: [40, 0, 120, 5] }}
106
+ options={{
107
+ hints: {
108
+ rise: 'How long each card takes to arrive, in ms.',
109
+ stagger: 'The gap between one card and the next, in ms.',
110
+ },
111
+ }}
112
+ />
113
+ </SiteShell>
114
+ );
115
+ }
@@ -0,0 +1,27 @@
1
+ /* The journal: a grid of cards that keeps its rows level whatever the
2
+ content. Cards arrive 6px up, one after another, on the dials in index.tsx
3
+ (--rise, --stagger, unitless ms). */
4
+ .journal-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 40px; }
5
+ .journal-head h1 { font-size: 40px; line-height: 48px; letter-spacing: -0.02em; }
6
+ .journal-lede { font-size: 18px; line-height: 28px; color: var(--text-secondary); max-width: 56ch; }
7
+ .posts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 24px; }
8
+ .journal[data-columns="2"] .posts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
9
+ .post { animation: post-rise calc(var(--rise, 260) * 1ms) var(--ease-out) calc(var(--i, 0) * var(--stagger, 40) * 1ms) backwards; }
10
+ .post-link { display: flex; flex-direction: column; gap: 8px; height: 100%; padding: 8px; margin: -8px; border-radius: var(--radius-md); color: inherit; text-decoration: none; transition: background-color var(--dur-hover) var(--ease-hover); }
11
+ @media (hover: hover) and (pointer: fine) { .post-link:hover { background: var(--bg-primary_hover); } }
12
+ .post-link:active { background: var(--bg-active); }
13
+ .post-image { aspect-ratio: 3 / 2; border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px rgb(16 24 40 / 0.08); margin-bottom: 8px; }
14
+ .post-image.is-missing { background: var(--bg-secondary); box-shadow: none; outline: 1px dashed var(--border-primary); outline-offset: -1px; }
15
+ .post-meta { display: flex; gap: 12px; font-size: 12px; line-height: 18px; color: var(--text-tertiary); }
16
+ .post-category { font-weight: 600; color: var(--text-secondary); }
17
+ .post-title { font-size: 18px; line-height: 26px; font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; text-wrap: pretty; }
18
+ .post-untitled { color: var(--text-quaternary); font-style: italic; font-weight: 500; }
19
+ .post-excerpt { color: var(--text-secondary); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
20
+ .journal-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 48px 0; }
21
+ .journal-empty p { color: var(--text-secondary); margin-bottom: 8px; }
22
+ .journal-foot { margin-top: 40px; color: var(--text-tertiary); font-size: 14px; }
23
+ @keyframes post-rise { from { opacity: 0; translate: 0 6px; } }
24
+ :root[data-motion="reduce"] .post { animation-name: post-fade; }
25
+ @keyframes post-fade { from { opacity: 0; } }
26
+ @media (max-width: 900px) { .posts, .journal[data-columns="2"] .posts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
27
+ @media (max-width: 600px) { .posts, .journal[data-columns="2"] .posts { grid-template-columns: minmax(0, 1fr); } }
@@ -0,0 +1,56 @@
1
+ ---
2
+ title: Sample social post
3
+ summary: One announcement post in three formats, with every fixture set, layout and tone on a dial, as the reference for brand collateral.
4
+ context: board
5
+ track: brand
6
+ status: exploring
7
+ kind: sprint
8
+ feature: sample-brand
9
+ created: 2026-11-24
10
+ ---
11
+
12
+ # Sample social post
13
+
14
+ The brand track's reference prototype. It shows what collateral from this hub looks like: one template drawn at real size in three formats, copy from fixtures, the brand's tokens, dials for layout and tone, and files written with `pnpm export sample-social`. Delete it when the project has a brand feature of its own.
15
+
16
+ ## Problem
17
+
18
+ A post template is approved with one tidy headline and then filled by whoever posts next week: a long headline, no image, no call to action. The square looks right and the story crops the logo under the platform's own buttons.
19
+
20
+ ## Question
21
+
22
+ Does one template hold every post the team will write, in square, portrait and story, without a format breaking?
23
+
24
+ ## Formats
25
+
26
+ | Artboard | Format | Where it runs |
27
+ | --- | --- | --- |
28
+ | square | `post-square`, 1080 × 1080 | Instagram and LinkedIn feeds |
29
+ | portrait | `post-portrait`, 1080 × 1350 | Instagram feed |
30
+ | story | `story`, 1080 × 1920 | Instagram and LinkedIn stories; type stays out of the top and bottom 250px |
31
+
32
+ ## States
33
+
34
+ Every state the board holds, one row each. `miles-port` and the export read this table.
35
+
36
+ | State | How to reach it |
37
+ | --- | --- |
38
+ | Real post | Controls → Review → Fixtures → **real** |
39
+ | Longest copy | Controls → Review → Fixtures → **longest** |
40
+ | No post | Controls → Review → Fixtures → **empty** |
41
+ | Missing content | Controls → Review → Fixtures → **missing** |
42
+ | Another post | Controls → Review → Post → **2** or **3** |
43
+ | Type only | Controls → Review → Layout → **type** |
44
+ | Light tone | Controls → Review → Tone → **light** |
45
+
46
+ ## Fixtures
47
+
48
+ `fixtures.json` holds `real` (three announcements written from the comp) and `missing` (no image or kicker; no subhead or call to action). `@kit/fixtures` derives `longest`, `empty` and `max`.
49
+
50
+ ## Export
51
+
52
+ `pnpm export sample-social` writes `exports/sample-social/sample-social-square.png`, `-portrait.png` and `-story.png` at 1080 wide. Another state: `pnpm export sample-social --dials '{"Review":{"layout":"type","tone":"light"}}'`.
53
+
54
+ ## Decision
55
+
56
+ Empty until picked. What was chosen, its values, and what was rejected and why. Then delete the folder.
@@ -0,0 +1,46 @@
1
+ {
2
+ "real": [
3
+ {
4
+ "id": "1",
5
+ "kicker": "New",
6
+ "headline": "Plan a site rebuild in two weeks",
7
+ "sub": "The questions we ask before the first frame.",
8
+ "cta": "Read the guide",
9
+ "image": "#dbe6fe"
10
+ },
11
+ {
12
+ "id": "2",
13
+ "kicker": "Case study",
14
+ "headline": "A pricing page that answers the second question",
15
+ "sub": "What visitors look for after they read the price.",
16
+ "cta": "See the work",
17
+ "image": "#fedf89"
18
+ },
19
+ {
20
+ "id": "3",
21
+ "kicker": "Event",
22
+ "headline": "Design review, live, every Thursday",
23
+ "sub": "Bring a screen. Leave with three decisions.",
24
+ "cta": "Save a seat",
25
+ "image": "#a9efc5"
26
+ }
27
+ ],
28
+ "missing": [
29
+ {
30
+ "id": "m1",
31
+ "kicker": "",
32
+ "headline": "A post with no image and no kicker",
33
+ "sub": "Editors skip the image more often than the design expects.",
34
+ "cta": "Read more",
35
+ "image": null
36
+ },
37
+ {
38
+ "id": "m2",
39
+ "kicker": "New",
40
+ "headline": "A post with no subhead or call to action",
41
+ "sub": "",
42
+ "cta": "",
43
+ "image": "#fecdc9"
44
+ }
45
+ ]
46
+ }
@@ -0,0 +1,95 @@
1
+ import { Artboard, Board, type FormatName } from '@kit/Artboard';
2
+ import { useDials } from '@kit/dials';
3
+ import { type FixtureSets, fixtureSets, SET_NAMES, type SetName } from '@kit/fixtures';
4
+ import { Icon } from '@kit/Icon';
5
+ import { BRAND } from '@kit/shell';
6
+ import data from './fixtures.json';
7
+ import './styles.css';
8
+
9
+ type Post = { id: string; kicker: string; headline: string; sub: string; cta: string; image: string | null };
10
+
11
+ const sets: FixtureSets<Post> = fixtureSets(data satisfies { real: Post[]; missing: Post[] }, {
12
+ max: 3,
13
+ text: ['headline', 'sub'],
14
+ });
15
+
16
+ const ARTBOARDS: { format: FormatName; name: string }[] = [
17
+ { format: 'post-square', name: 'square' },
18
+ { format: 'post-portrait', name: 'portrait' },
19
+ { format: 'story', name: 'story' },
20
+ ];
21
+
22
+ function PostArt({ post, layout, tone }: { post: Post | undefined; layout: string; tone: string }) {
23
+ if (!post)
24
+ return (
25
+ <div className="post-art post-none" data-tone={tone}>
26
+ <p>No post in this set.</p>
27
+ </div>
28
+ );
29
+ const photo = layout === 'photo';
30
+ return (
31
+ <div className="post-art" data-tone={tone} data-layout={layout}>
32
+ {photo ? (
33
+ <div
34
+ className={post.image ? 'post-photo' : 'post-photo is-missing'}
35
+ style={post.image ? { background: post.image } : undefined}
36
+ aria-hidden="true"
37
+ />
38
+ ) : null}
39
+ <div className="post-copy">
40
+ {post.kicker ? <p className="post-kicker">{post.kicker}</p> : null}
41
+ <h2 className="post-headline">{post.headline}</h2>
42
+ {post.sub ? <p className="post-sub">{post.sub}</p> : null}
43
+ {post.cta ? <p className="post-cta">{post.cta}</p> : null}
44
+ </div>
45
+ <p className="post-brand">
46
+ <Icon name={BRAND.glyph} size={40} />
47
+ {BRAND.name}
48
+ </p>
49
+ </div>
50
+ );
51
+ }
52
+
53
+ // The post is its own component so its Review panel registers before the Board's.
54
+ function Posts() {
55
+ const review = useDials(
56
+ 'Review',
57
+ {
58
+ fixtures: { type: 'select', options: [...SET_NAMES], default: 'real' },
59
+ post: { type: 'select', options: ['1', '2', '3'], default: '1' },
60
+ layout: { type: 'select', options: ['photo', 'type'], default: 'photo' },
61
+ tone: { type: 'select', options: ['brand', 'light'], default: 'brand' },
62
+ },
63
+ {
64
+ hints: {
65
+ fixtures:
66
+ 'Which fixture set the post reads. longest, empty and max are derived from real by @kit/fixtures.',
67
+ post: 'Which post in the set. A set with fewer posts shows its last.',
68
+ layout: 'photo: an image above the copy. type: copy alone, larger.',
69
+ tone: 'brand: the brand colour behind white type. light: the page colour behind brand type.',
70
+ },
71
+ },
72
+ );
73
+ const posts = sets[review.fixtures as SetName];
74
+ const post = posts[Math.min(Number(review.post), posts.length) - 1];
75
+ return (
76
+ <>
77
+ {ARTBOARDS.map((a) => (
78
+ <Artboard key={a.name} format={a.format} name={a.name}>
79
+ <PostArt post={post} layout={review.layout as string} tone={review.tone as string} />
80
+ </Artboard>
81
+ ))}
82
+ </>
83
+ );
84
+ }
85
+
86
+ export default function Prototype() {
87
+ return (
88
+ <Board
89
+ title="Sample social post"
90
+ lede="Does one template hold every post the team will write, in every format?"
91
+ >
92
+ <Posts />
93
+ </Board>
94
+ );
95
+ }
@@ -0,0 +1,20 @@
1
+ /* Real pixels: every artboard is 1080 wide. The copy block sits at the
2
+ bottom; the story's extra height goes to the photo, and its 250px top and
3
+ bottom bands stay clear of type and the mark. */
4
+ .post-art { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 56px; padding: 88px; background: var(--bg-brand-solid); color: var(--text-white); font-family: inherit; }
5
+ .post-art[data-tone="light"] { background: var(--bg-primary); color: var(--text-primary); }
6
+ .post-photo { flex: 1; min-height: 0; border-radius: 24px; box-shadow: inset 0 0 0 2px rgb(255 255 255 / 0.2); }
7
+ .post-photo.is-missing { background: transparent; outline: 3px dashed currentColor; outline-offset: -3px; opacity: 0.4; }
8
+ .post-copy { display: flex; flex-direction: column; gap: 24px; }
9
+ .post-art[data-layout="type"] .post-copy { flex: 1; justify-content: center; }
10
+ .post-kicker { font-size: 28px; line-height: 36px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.8; }
11
+ .post-headline { font-size: 80px; line-height: 1.05; font-weight: 700; letter-spacing: -0.02em; text-wrap: balance; overflow-wrap: anywhere; }
12
+ .post-art[data-layout="type"] .post-headline { font-size: 104px; }
13
+ .post-sub { font-size: 34px; line-height: 46px; max-width: 28ch; opacity: 0.85; }
14
+ .post-cta { align-self: flex-start; padding: 18px 32px; border-radius: 999px; background: var(--text-white); color: var(--bg-brand-solid); font-size: 30px; line-height: 36px; font-weight: 600; }
15
+ .post-art[data-tone="light"] .post-cta { background: var(--bg-brand-solid); color: var(--text-white); }
16
+ .post-brand { display: flex; align-items: center; gap: 16px; font-size: 32px; line-height: 40px; font-weight: 600; }
17
+ .post-none { justify-content: center; align-items: center; font-size: 40px; opacity: 0.7; }
18
+ [data-format="post-square"] .post-art { gap: 40px; padding: 72px; }
19
+ [data-format="post-square"] .post-headline { font-size: 68px; }
20
+ [data-format="story"] .post-art { padding: 250px 88px; }
@@ -1,18 +0,0 @@
1
- {
2
- "version": "0.0.1",
3
- "configurations": [
4
- {
5
- "name": "prototypes",
6
- "runtimeExecutable": "pnpm",
7
- "runtimeArgs": [
8
- "dev"
9
- ],
10
- "port": 3101
11
- },
12
- {
13
- "name": "prototypes-attach",
14
- "url": "http://localhost:3101",
15
- "port": 3101
16
- }
17
- ]
18
- }