@milesroxas/design-hub 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -32
- package/core/catalog.test.ts +28 -1
- package/core/catalog.ts +21 -4
- package/dist/core/catalog.d.ts +8 -1
- package/dist/core/catalog.js +12 -3
- package/dist/scripts/lib/catalog.d.ts +1 -1
- package/dist/scripts/lib/catalog.js +3 -3
- package/dist/scripts/new.d.ts +8 -3
- package/dist/scripts/new.js +15 -4
- package/dist/scripts/preflight.js +1 -1
- package/dist/scripts/share.js +3 -3
- package/dist/server/api.d.ts +11 -0
- package/dist/server/api.js +6 -0
- package/dist/server/dev-studio.d.ts +36 -0
- package/dist/server/dev-studio.js +181 -0
- package/dist/server/dev.d.ts +16 -1
- package/dist/server/dev.js +4 -4
- package/dist/vite/plugin.js +3 -0
- package/kit/ViewTools.tsx +9 -0
- package/kit/prefs.ts +3 -4
- package/package.json +1 -1
- package/shell/Command.tsx +142 -0
- package/shell/Index.tsx +902 -400
- package/shell/Milestone.tsx +302 -0
- package/shell/Sidebar.tsx +236 -0
- package/shell/index.css +224 -0
- package/shell/milestones.test.ts +157 -0
- package/shell/milestones.ts +144 -0
- package/shell/registry.ts +4 -3
- package/shell/shell.css +8 -175
- package/shell/sidebar.css +86 -0
- package/shell/studio/ClientHub.tsx +21 -10
- package/shell/studio/StudioHub.tsx +120 -45
- package/shell/studio/hub.css +20 -15
- package/shell/studio/page.tsx +28 -17
- package/shell/system.css +12 -0
- package/skills/miles-deploy/SKILL.md +1 -1
- package/skills/miles-new-feature/SKILL.md +2 -1
- package/skills/miles-prototype/SKILL.md +1 -1
- package/templates/app/README.md +1 -1
- package/templates/brand/README.md +1 -1
- package/templates/site/README.md +1 -1
- package/templates/space/README.md +1 -1
- package/templates/studio/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,55 +16,60 @@ How a project becomes an app: `design-hub dev` runs Vite with the package's `she
|
|
|
16
16
|
|
|
17
17
|
## The index
|
|
18
18
|
|
|
19
|
-
`/` lists
|
|
19
|
+
`/` lists the project's milestones (`shell/Index.tsx`, `shell/milestones.ts`, `shell/index.css`). It answers one question for a reviewer: what is each milestone's current answer, and what around it is live right now.
|
|
20
|
+
|
|
21
|
+
The README's fields keep their names; the hub shows them under the names people use:
|
|
22
|
+
|
|
23
|
+
| In the README | In the hub |
|
|
24
|
+
| --- | --- |
|
|
25
|
+
| `feature` | A **Milestone**: the unit of work, one question |
|
|
26
|
+
| `kind: sprint` | Its **Main**: the current answer, one per milestone |
|
|
27
|
+
| `docs/sprints/<feature>/guide.md` | Its **Guide** |
|
|
28
|
+
| `kind: alternate`, `kind: exploration` | An **Exploration** |
|
|
29
|
+
|
|
30
|
+
### Sidebar
|
|
31
|
+
|
|
32
|
+
A sidebar docks to the left edge (248px, `--bg-secondary_subtle`, a hairline right border). Top to bottom: under a base, **All projects** back to the client's hub; **Search**, a button that opens the command menu; then two views. **Milestones** (`#/`) nests each milestone as a jump to its row, clearing any filter. **Tools** (`#/tools`) lists `kind: tool` prototypes; it shows only once the project has a tool. **Recent** lists the last five prototypes opened from this index, per browser. Who is signed in sits at the foot. Under 1024px the sidebar becomes a bar across the top, with no jumps and no Recent.
|
|
33
|
+
|
|
34
|
+
### Search
|
|
35
|
+
|
|
36
|
+
The command menu (`shell/Command.tsx`): Command or Control with K, or `/`, from anywhere. It finds milestones, prototypes and tools by title, summary and slug, and holds Client view as an action. Enter opens a prototype and shows a milestone's home. With no query it lists Recent and the actions. It opens and closes with no motion.
|
|
20
37
|
|
|
21
38
|
### Which kind
|
|
22
39
|
|
|
23
40
|
Walk this for every new prototype; the first match wins.
|
|
24
41
|
|
|
25
|
-
1. The feature's main prototype, the one its walkthrough opens → `sprint`. Exactly one per feature, so a reviewer never has to guess which build is current. `design-hub new --sprint` refuses a second while the first is not archived.
|
|
42
|
+
1. The feature's main prototype, the one its walkthrough opens → `sprint`. Exactly one per feature, so a reviewer never has to guess which build is current. `design-hub new --sprint` refuses a second while the first is open (not archived, not presented).
|
|
26
43
|
2. Another full take on that same flow, built to compare against the primary → `alternate` (`--alternate`). Refused until the primary exists, because an alternate is only legible next to what it replaces.
|
|
27
|
-
3.
|
|
44
|
+
3. A small app that makes assets for several features (chart skeletons, an icon set) → `tool` (`--tool`). It needs no feature, starts `in-progress`, and lists under Tools, never under a milestone.
|
|
45
|
+
4. Anything else: a side question about one part (a menu's motion, a loading state) → `exploration`, the default.
|
|
28
46
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
Groups, in order: one per feature, then `Without a feature` (explorations with an empty `feature:`), then `Archived` (`status: archived`, any kind, plain rows).
|
|
47
|
+
Statuses: `exploring` (open), `decided`, `ready` (a sprint handed to engineering; shown as Ready for dev), `in-progress` (a tool being built), `presented` (a take the client saw and did not pick; add `presented: <date>`, which dates it in place of `created`), `archived`.
|
|
32
48
|
|
|
33
|
-
|
|
49
|
+
### Layout
|
|
34
50
|
|
|
35
|
-
|
|
36
|
-
2. **Primary.** The one `sprint` row, its title 16px against 14px for every other row. Size alone marks it; no badge, no new shape.
|
|
37
|
-
3. **Alternates.** Under an `Alternates` caption (12px, 500, quaternary text), indented 20px and joined to the primary by a 1px rail in `--border-secondary` on the primary's text edge. The rail makes them children of that one row; a heading of their own would make them peers of the feature. A stray second `sprint` renders here too.
|
|
38
|
-
4. **Explorations.** A toggle (`Explorations`, the count, a chevron), collapsed by default because explorations are working material, not the feature. The open state persists per group in `localStorage` (`index-explorations-open`). Typing in the filter opens every fold, so a match is never hidden. Open, the explorations are cards on a grid (`minmax(208px, 1fr)`, 8px gap). Every exploration lives here, never in the row list.
|
|
51
|
+
Milestones, by last update or by name (Display), then **No milestone** (prototypes with an empty `feature:`). A milestone whose every prototype is archived leaves the index; search still finds its prototypes.
|
|
39
52
|
|
|
40
|
-
|
|
53
|
+
- **A milestone row** carries its title, its Main's status and the date of its newest prototype. Click, Enter or Space opens the milestone's home; on hover or focus the date gives way to `Open →`, in the same cell.
|
|
54
|
+
- **Quick links** hang under it on a 1px rail, and each opens what it names: its Main (marked `Main`), its Guide, then under an `Explorations` label, indented on a second rail, the explorations still in motion. A link spells out a status only when it waits on someone: `review` and `ready`.
|
|
55
|
+
- **Folding.** The chevron in the gutter folds a milestone's quick links; it has its own hover surface, so the row never reads as a heading that folds. Until someone folds it, a `decided` milestone starts folded and an open one does not. Folds persist per browser (`index-folds`); Display has Fold all.
|
|
56
|
+
- **Filter** narrows by track and status, each offered only when the milestones have two or more; a filter in use shows as a chip that removes it.
|
|
57
|
+
- **Keys.** J and K, or the arrows, walk the rows; Left and Right fold and unfold the milestone in focus.
|
|
58
|
+
- No counts anywhere, and quick links carry no icons.
|
|
41
59
|
|
|
42
|
-
|
|
60
|
+
Status is a 6px mark before the word: a ring for exploring, a solid dot for decided, the brand colour only for what waits on someone. `review` reads `Ready to present` to Studio and `In review` to a Client.
|
|
43
61
|
|
|
44
|
-
|
|
62
|
+
### A milestone's home
|
|
45
63
|
|
|
46
|
-
|
|
47
|
-
- **Cards** take `--radius-lg` and 12px padding, so card text keeps the page's text edge. The title line ends in an arrow (quaternary), because the whole card opens the prototype. The summary drops to caption size (12px/18px, tertiary) so three cards scan as three titles. Context, status and date sit pinned to the bottom so the meta lines up across a row of cards. The edge is an inset ring (`oklch(0 0 0 / 0.08)`) plus two soft layers in light, and a white 9% ring alone in dark, where the tokens drop every shadow. The ring is inset because the fold clips its content while it animates and would cut an outer one. Focus stacks the focus ring on the edge, since both are box-shadows and the edge alone would erase it.
|
|
48
|
-
- **Status** is a 6px dot before the word: ink for exploring, success for decided, quinary for archived. The word stays, so colour is never the only signal.
|
|
49
|
-
- **Foot.** The count alone, in body type over a hairline (the Ledger Foot Rule).
|
|
50
|
-
- **Lede.** 18px/28px Geist at 400, secondary text. `--font-voice` resolves to Geist inside the hub's `.sys` scope (`shell/system.css`), so the index never borrows the project's faces.
|
|
64
|
+
Over the index, at `#/m/<feature>` (`shell/Milestone.tsx`), so it has a link and Back closes it. One bar: previous and next milestone (K and J), Full page, Close. A reading column: the title, the Main's summary, the question (the first paragraph under the Main README's `## Question`), then Main, Explorations, Presented and, for Studio, Archived. Beside it, Status, Track and Updated; under 600px they move under the text. The foot holds Guide and the one primary, `Open Main`; Enter opens it. Escape or a press on the backdrop closes, and focus returns to the milestone's row.
|
|
51
65
|
|
|
52
66
|
### Audience
|
|
53
67
|
|
|
54
|
-
Every prototype is Internal until Studio marks it Client-facing; a Client's index lists only the client-facing ones, and the gate refuses an internal prototype's page and files to a Client. Studio, outside Client view, sees each prototype's audience
|
|
68
|
+
Every prototype is Internal until Studio marks it Client-facing; a Client's index lists only the client-facing ones, and the gate refuses an internal prototype's page and files to a Client. Studio, outside Client view, sees each prototype's audience at the end of its row in the milestone's home, never inside the link: `Internal` on the internal comments' amber (`--sys-internal`), then a switch (`role="switch"`, a 28px track, its hit area grown to 40px). A prototype with no milestone, and a tool, has no home: its switch ends its row on the index. A switch shows at once, waits while its save is out, and is undone with a toast if the save fails. **Client view** in the toolbar shows the index, and every comment, as a client gets them.
|
|
55
69
|
|
|
56
70
|
### Motion
|
|
57
71
|
|
|
58
|
-
Nothing animates on a keyboard action.
|
|
59
|
-
|
|
60
|
-
- **Arrival**, one shot: the head fades over 200ms, then each heading, caption, row and open card rises 4px and fades over 220ms, 30ms apart (stagger capped at eight), then the foot. Keyframes fill backwards only, so a settled row's opacity stays free to transition.
|
|
61
|
-
- **Departure**, pointer only: a clicked row or card holds while the rest of the page fades over 150ms on the Layer Exit curve, filling the wait while the browser fetches the prototype. A modified click or Enter opens instantly; a back-forward restore clears the fade.
|
|
62
|
-
- **Fold:** opens over 220ms (grid row `0fr` to `1fr`, plus the fade) and closes over 150ms, both `--ease-out`; the chevron turns 180°. A keyboard toggle is instant.
|
|
63
|
-
- **Hover:** a row takes the Hover Rule fill. A card stays white and lifts instead (ring and shadow deepen; in dark, the ring brightens and the surface steps up to `--bg-primary_hover`), and its arrow moves 2px right and darkens to secondary. Both lift the summary to secondary. **Press:** `scale(0.97)`.
|
|
64
|
-
- **Reduced motion** keeps the fades and drops the rise, the press, the fold's growth, the chevron's turn and the arrow's nudge.
|
|
65
|
-
- Up and Down arrows walk the rows and the cards of open folds.
|
|
66
|
-
|
|
67
|
-
A speculation rule in `shell/index.html` prefetches a prototype's page when its row is hovered, so the document is in cache by the click (Chromium; other browsers ignore the rule). Prerendering was rejected: it would play a prototype's entrance motion before anyone saw it.
|
|
72
|
+
Nothing animates on a keyboard action. The home fades and scales from 0.97 when opened by pointer, and lands at once by keyboard; the command menu never animates. Hover fills use the Hover Rule. Reduced motion drops the scale and the chevron's turn.
|
|
68
73
|
|
|
69
74
|
## The walkthrough
|
|
70
75
|
|
|
@@ -76,7 +81,7 @@ A speculation rule in `shell/index.html` prefetches a prototype's page when its
|
|
|
76
81
|
|
|
77
82
|
A client's address is `<client>.<apex>` (or a codename under the apex, `client add --host`), and a project is `/<project>/` below it. `design-hub project link` writes `.design-hub/studio.json` in the project (studio, its id, client, project; committed). `design-hub share` builds the project with base `/<project>/`, uploads `dist/` under `c/<client>/<project>/<build>/` in the file store with a new random build id, checks every file is there, and only then points the project's record at that build, so a half-finished upload is never served; the live build and the two before it are kept. Every path on every client's host sits behind the gate, enforced on the server by the gate (`server/gate.ts`, free of any host: it answers each request with a decision), run as Vercel Routing Middleware by its adapter (`createStudioProxy` in `vercel/proxy.ts`, which the studio's `vercel.json` names as `proxy.entrypoint`). The host names the client, from one store lookup kept a minute per instance; a host no client has is the plain 404 before anything else is read. The files function and the review function run the gate's checks again themselves, in the order host, session, project, so neither trusts anything the gate set. A client-side gate was rejected because the bundle and the state behind it would still download.
|
|
78
83
|
|
|
79
|
-
Studio people have a host of their own, `studio.<apex>`, which `studio create` (or `studio deploy`, for an older studio) adds and proves as it proves a client's. Only Studio people sign in there; a Client, a cookie of a client's host, or none gets that host's sign-in page, word for word a client host's. Its page is the studio hub (`shell/studio/StudioHub.tsx`, built apart from the client hub under `_studio/`, so no client's host serves it): every client with its projects, an **Open** that hands the person off to the client's host (a one-time record in the client's keys, claimed once there within 60 seconds, which sets that host's own Studio cookie), and a **People** panel per client
|
|
84
|
+
Studio people have a host of their own, `studio.<apex>`, which `studio create` (or `studio deploy`, for an older studio) adds and proves as it proves a client's. Only Studio people sign in there; a Client, a cookie of a client's host, or none gets that host's sign-in page, word for word a client host's. Its page is the studio hub (`shell/studio/StudioHub.tsx`, built apart from the client hub under `_studio/`, so no client's host serves it): the index's sidebar (`shell/Sidebar.tsx`: Search over clients and projects, **Clients** with each client nested as a jump, **Studio people**), then every client with its projects, an **Open** that hands the person off to the client's host (a one-time record in the client's keys, claimed once there within 60 seconds, which sets that host's own Studio cookie), and a **People** panel per client, the review panel's People controls. **Studio people** (`#/people`) is a view of its own that shows the studio's own people in those controls at once. A client's hub wears the same sidebar, with Search over its projects. Its review API answers `me`, `clients` and the people ops, each naming the client it is for with `client`, which the service checks as the handoff does (known, added, not archived) and answers as an unknown client otherwise; without `client` an op is the studio's own people. No client's host reads a `client` parameter.
|
|
80
85
|
|
|
81
86
|
Every person is named, and signs in with a one-time link that Studio makes in the review panel's People tab, on the studio hub, with `design-hub people` in a linked project, the studio folder or with `--studio`, or, for a client's first person, with `design-hub client add`. A Client's link is on their client's host, and signs in there only. A Studio person's is on `studio.<apex>` once it answers (on the linked client's host before then), and signs in on any host of the studio; the owner's first comes from the run that proves the studio host, and a new one from `people link <owner id> --studio <studio>`.
|
|
82
87
|
|
|
@@ -97,4 +102,4 @@ Every signed-in person can comment as themselves. The People tab lists each pers
|
|
|
97
102
|
|
|
98
103
|
The panel (`shell/review/`) mounts on every prototype page in its own React root, so a prototype that throws never takes it down. A comment carries the prototype, the URL, every dial panel's values (`snapshotDials`), and the element it was pinned to as a selector path with an offset; Show state reopens the URL and sets the dials back. Pins draw over their elements and below the Controls panel. The API is one endpoint, `<project>/api/review` (`server/api.ts`, reached on a studio site through its one-line `api/review.ts`, scoped by the host's client and the project the path names): queries by GET, commands by POST with a JSON body, same-origin only. The rules (who may delete, what a valid comment is, which client a person may act in) live once, in `core/review/`, behind a small storage port: the studio's database (`server/stores/`: Upstash Redis over REST, or Postgres in one table of key, field and value), or a file in `.design-hub/review.json` under `design-hub dev`, where whoever runs the server is a local Studio person in one fixed scope. Every key is built by one function from a scope, under the prefix `hub4:`: the studio's (`studio:people`, `clients`, `hosts`, …), a client's (`c:<client>:people`, `:links`, `:projects`, …) and a project's (`c:<client>:p:<project>:comments:<prototype>`, …), so no op reaches another client's records.
|
|
99
104
|
|
|
100
|
-
`design-hub dev` serves the prototypes open, with the review panel on the local store. The gate and the studio's functions are covered by `pnpm test` (`vercel/gate.test.ts`, against an in-memory Upstash and file store, and again in `vercel/gate.postgres.test.ts` on an embedded Postgres).
|
|
105
|
+
`design-hub dev` serves the prototypes open, with the review panel on the local store. It also serves the studio site's own pages, so they can be seen and used before a studio exists (`server/dev-studio.ts`): the studio hub at `/_studio/` and each client's hub at `/_clients/<client>/`, on a store of their own, `.design-hub/studio.json`, filled on first use with sample clients, projects and people (delete the file for a fresh set). The page that asks (its Referer) says which site an API request is; Open goes to the client's dev hub, and every project opens this project's index. The gate and the studio's functions are covered by `pnpm test` (`vercel/gate.test.ts`, against an in-memory Upstash and file store, and again in `vercel/gate.postgres.test.ts` on an embedded Postgres).
|
package/core/catalog.test.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import assert from 'node:assert/strict';
|
|
2
2
|
import { test } from 'node:test';
|
|
3
|
-
import { byIndexOrder, isLive, placeLabel, readMeta } from './catalog.ts';
|
|
3
|
+
import { byIndexOrder, isLive, isOpen, placeLabel, readMeta } from './catalog.ts';
|
|
4
4
|
import { frontmatter } from './frontmatter.ts';
|
|
5
5
|
|
|
6
6
|
const readme = (fm: string, body = '') => `---\n${fm}\n---\n\n# X\n${body}`;
|
|
@@ -28,6 +28,13 @@ test('readMeta fills defaults and keeps only the known kinds', () => {
|
|
|
28
28
|
);
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
+
test('readMeta reads the question: the first paragraph under its heading, on one line', () => {
|
|
32
|
+
const q = (body: string) => readMeta('x', readme('kind: sprint', body)).question;
|
|
33
|
+
assert.equal(q('\n## Question\n\nDoes the row hold\nup?\n\nMore.\n\n## Flows\n'), 'Does the row hold up?');
|
|
34
|
+
assert.equal(q('\n## Problem\n\nA list.\n'), '');
|
|
35
|
+
assert.equal(q('\n## Question\n\n## Flows\n\nNone.\n'), '');
|
|
36
|
+
});
|
|
37
|
+
|
|
31
38
|
test('open questions sort above answered ones, newest first, then by title', () => {
|
|
32
39
|
const m = (slug: string, status: string, created: string) =>
|
|
33
40
|
readMeta(slug, readme(`title: ${slug}\nstatus: ${status}\ncreated: ${created}`));
|
|
@@ -43,6 +50,26 @@ test('open questions sort above answered ones, newest first, then by title', ()
|
|
|
43
50
|
assert.equal(isLive({ status: 'archived' }), false);
|
|
44
51
|
});
|
|
45
52
|
|
|
53
|
+
test('a tool is a kind of its own, and a tool being built sorts with open questions', () => {
|
|
54
|
+
assert.equal(readMeta('x', readme('kind: tool')).kind, 'tool');
|
|
55
|
+
const m = (slug: string, status: string) =>
|
|
56
|
+
readMeta(slug, readme(`title: ${slug}\nstatus: ${status}\ncreated: 2026-01-01`));
|
|
57
|
+
assert.deepEqual(
|
|
58
|
+
[m('b', 'decided'), m('a', 'in-progress')].sort(byIndexOrder).map((x) => x.slug),
|
|
59
|
+
['a', 'b'],
|
|
60
|
+
);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test('a presented take keeps the day the client saw it, and is no longer open work', () => {
|
|
64
|
+
const m = readMeta('x', readme('status: presented\npresented: 2026-11-24'));
|
|
65
|
+
assert.equal(m.presented, '2026-11-24');
|
|
66
|
+
assert.equal(readMeta('x', readme('status: exploring')).presented, '');
|
|
67
|
+
assert.equal(isLive(m), true);
|
|
68
|
+
assert.equal(isOpen(m), false);
|
|
69
|
+
assert.equal(isOpen({ status: 'archived' }), false);
|
|
70
|
+
assert.equal(isOpen({ status: 'decided' }), true);
|
|
71
|
+
});
|
|
72
|
+
|
|
46
73
|
test('the track is read when known, and names the shell a prototype stands in', () => {
|
|
47
74
|
assert.equal(readMeta('x', readme('track: website')).track, 'website');
|
|
48
75
|
assert.equal(readMeta('x', readme('track: app')).track, '');
|
package/core/catalog.ts
CHANGED
|
@@ -6,7 +6,9 @@ import { frontmatter } from './frontmatter.ts';
|
|
|
6
6
|
import { TRACKS, type Track } from './project.ts';
|
|
7
7
|
import { parseStates, type State } from './states.ts';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
/** A tool makes assets for several features, so it answers no one feature's question and lists apart. */
|
|
10
|
+
export type Kind = 'sprint' | 'alternate' | 'exploration' | 'tool';
|
|
11
|
+
const KINDS: readonly string[] = ['sprint', 'alternate', 'exploration', 'tool'];
|
|
10
12
|
|
|
11
13
|
export type Meta = {
|
|
12
14
|
slug: string;
|
|
@@ -19,10 +21,20 @@ export type Meta = {
|
|
|
19
21
|
kind: Kind;
|
|
20
22
|
feature: string;
|
|
21
23
|
created: string;
|
|
24
|
+
/** The day the client saw it, for `status: presented` (a take shown and not picked); empty otherwise. */
|
|
25
|
+
presented: string;
|
|
26
|
+
/** The one question it answers: the first paragraph under `## Question`; empty without one. */
|
|
27
|
+
question: string;
|
|
22
28
|
/** null when the README has no States section. */
|
|
23
29
|
states: State[] | null;
|
|
24
30
|
};
|
|
25
31
|
|
|
32
|
+
/** The first paragraph under `## Question`, on one line. */
|
|
33
|
+
const questionOf = (readme: string) =>
|
|
34
|
+
(readme.match(/^## Question[ \t]*\n+([^\n#|][^\n]*(?:\n[^\n#|][^\n]*)*)/m)?.[1] ?? '')
|
|
35
|
+
.replace(/\s+/g, ' ')
|
|
36
|
+
.trim();
|
|
37
|
+
|
|
26
38
|
export function readMeta(slug: string, readme: string): Meta {
|
|
27
39
|
const { data } = frontmatter(readme);
|
|
28
40
|
return {
|
|
@@ -32,17 +44,22 @@ export function readMeta(slug: string, readme: string): Meta {
|
|
|
32
44
|
context: data.context || 'space',
|
|
33
45
|
track: TRACKS.includes(data.track as Track) ? (data.track as Track) : '',
|
|
34
46
|
status: data.status || 'exploring',
|
|
35
|
-
kind: data.kind
|
|
47
|
+
kind: KINDS.includes(data.kind ?? '') ? (data.kind as Kind) : 'exploration',
|
|
36
48
|
feature: data.feature || '',
|
|
37
49
|
created: data.created || '',
|
|
50
|
+
presented: data.presented || '',
|
|
51
|
+
question: questionOf(readme),
|
|
38
52
|
states: parseStates(readme),
|
|
39
53
|
};
|
|
40
54
|
}
|
|
41
55
|
|
|
42
56
|
export const isLive = (m: Pick<Meta, 'status'>) => m.status !== 'archived';
|
|
43
57
|
|
|
44
|
-
|
|
45
|
-
const
|
|
58
|
+
/** Still the feature's own work: neither archived nor a take the client saw and did not pick. */
|
|
59
|
+
export const isOpen = (m: Pick<Meta, 'status'>) => isLive(m) && m.status !== 'presented';
|
|
60
|
+
|
|
61
|
+
// Open work (a question being explored, a tool being built) sits above answered work; within a status, newest first.
|
|
62
|
+
const rank = (status: string) => (status === 'exploring' || status === 'in-progress' ? 0 : 1);
|
|
46
63
|
export const byIndexOrder = (a: Meta, b: Meta) =>
|
|
47
64
|
rank(a.status) - rank(b.status) || b.created.localeCompare(a.created) || a.title.localeCompare(b.title);
|
|
48
65
|
|
package/dist/core/catalog.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Track } from './project.ts';
|
|
2
2
|
import { type State } from './states.ts';
|
|
3
|
-
|
|
3
|
+
/** A tool makes assets for several features, so it answers no one feature's question and lists apart. */
|
|
4
|
+
export type Kind = 'sprint' | 'alternate' | 'exploration' | 'tool';
|
|
4
5
|
export type Meta = {
|
|
5
6
|
slug: string;
|
|
6
7
|
title: string;
|
|
@@ -12,11 +13,17 @@ export type Meta = {
|
|
|
12
13
|
kind: Kind;
|
|
13
14
|
feature: string;
|
|
14
15
|
created: string;
|
|
16
|
+
/** The day the client saw it, for `status: presented` (a take shown and not picked); empty otherwise. */
|
|
17
|
+
presented: string;
|
|
18
|
+
/** The one question it answers: the first paragraph under `## Question`; empty without one. */
|
|
19
|
+
question: string;
|
|
15
20
|
/** null when the README has no States section. */
|
|
16
21
|
states: State[] | null;
|
|
17
22
|
};
|
|
18
23
|
export declare function readMeta(slug: string, readme: string): Meta;
|
|
19
24
|
export declare const isLive: (m: Pick<Meta, 'status'>) => boolean;
|
|
25
|
+
/** Still the feature's own work: neither archived nor a take the client saw and did not pick. */
|
|
26
|
+
export declare const isOpen: (m: Pick<Meta, 'status'>) => boolean;
|
|
20
27
|
export declare const byIndexOrder: (a: Meta, b: Meta) => number;
|
|
21
28
|
/** Where a prototype stands, in words: the Space, the shell its track draws, or a board of artboards. */
|
|
22
29
|
export declare function placeLabel(m: Pick<Meta, 'context' | 'track'>): string;
|
package/dist/core/catalog.js
CHANGED
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
import { frontmatter } from './frontmatter.js';
|
|
6
6
|
import { TRACKS } from './project.js';
|
|
7
7
|
import { parseStates } from './states.js';
|
|
8
|
+
const KINDS = ['sprint', 'alternate', 'exploration', 'tool'];
|
|
9
|
+
/** The first paragraph under `## Question`, on one line. */
|
|
10
|
+
const questionOf = (readme) => (readme.match(/^## Question[ \t]*\n+([^\n#|][^\n]*(?:\n[^\n#|][^\n]*)*)/m)?.[1] ?? '')
|
|
11
|
+
.replace(/\s+/g, ' ')
|
|
12
|
+
.trim();
|
|
8
13
|
export function readMeta(slug, readme) {
|
|
9
14
|
const { data } = frontmatter(readme);
|
|
10
15
|
return {
|
|
@@ -14,15 +19,19 @@ export function readMeta(slug, readme) {
|
|
|
14
19
|
context: data.context || 'space',
|
|
15
20
|
track: TRACKS.includes(data.track) ? data.track : '',
|
|
16
21
|
status: data.status || 'exploring',
|
|
17
|
-
kind:
|
|
22
|
+
kind: KINDS.includes(data.kind ?? '') ? data.kind : 'exploration',
|
|
18
23
|
feature: data.feature || '',
|
|
19
24
|
created: data.created || '',
|
|
25
|
+
presented: data.presented || '',
|
|
26
|
+
question: questionOf(readme),
|
|
20
27
|
states: parseStates(readme),
|
|
21
28
|
};
|
|
22
29
|
}
|
|
23
30
|
export const isLive = (m) => m.status !== 'archived';
|
|
24
|
-
|
|
25
|
-
const
|
|
31
|
+
/** Still the feature's own work: neither archived nor a take the client saw and did not pick. */
|
|
32
|
+
export const isOpen = (m) => isLive(m) && m.status !== 'presented';
|
|
33
|
+
// Open work (a question being explored, a tool being built) sits above answered work; within a status, newest first.
|
|
34
|
+
const rank = (status) => (status === 'exploring' || status === 'in-progress' ? 0 : 1);
|
|
26
35
|
export const byIndexOrder = (a, b) => rank(a.status) - rank(b.status) || b.created.localeCompare(a.created) || a.title.localeCompare(b.title);
|
|
27
36
|
/** Where a prototype stands, in words: the Space, the shell its track draws, or a board of artboards. */
|
|
28
37
|
export function placeLabel(m) {
|
|
@@ -3,5 +3,5 @@ export type OnDisk = Meta & {
|
|
|
3
3
|
dir: string;
|
|
4
4
|
};
|
|
5
5
|
export declare function prototypes(root?: string): OnDisk[];
|
|
6
|
-
/** The feature's
|
|
6
|
+
/** The feature's open primary prototype, if it has one: an archived or presented sprint leaves the place free. */
|
|
7
7
|
export declare const primaryOf: (feature: string, all?: OnDisk[]) => OnDisk | undefined;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// The prototypes on disk, read the way the browser index reads them (vite/registry.ts).
|
|
3
3
|
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
4
4
|
import { join } from 'node:path';
|
|
5
|
-
import { byIndexOrder,
|
|
5
|
+
import { byIndexOrder, isOpen, readMeta } from '../../core/catalog.js';
|
|
6
6
|
import { PROTOTYPES } from '../../server/paths.js';
|
|
7
7
|
export function prototypes(root = PROTOTYPES) {
|
|
8
8
|
return readdirSync(root, { withFileTypes: true })
|
|
@@ -14,5 +14,5 @@ export function prototypes(root = PROTOTYPES) {
|
|
|
14
14
|
}))
|
|
15
15
|
.sort(byIndexOrder);
|
|
16
16
|
}
|
|
17
|
-
/** The feature's
|
|
18
|
-
export const primaryOf = (feature, all = prototypes()) => all.find((p) => p.kind === 'sprint' &&
|
|
17
|
+
/** The feature's open primary prototype, if it has one: an archived or presented sprint leaves the place free. */
|
|
18
|
+
export const primaryOf = (feature, all = prototypes()) => all.find((p) => p.kind === 'sprint' && isOpen(p) && p.feature === feature);
|
package/dist/scripts/new.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import type { Kind } from '../core/catalog.ts';
|
|
2
3
|
import { type Track } from '../core/project.ts';
|
|
3
4
|
import { type Args } from './lib/cli.ts';
|
|
4
5
|
export declare const spec: {
|
|
@@ -27,6 +28,10 @@ export declare const spec: {
|
|
|
27
28
|
readonly type: 'boolean';
|
|
28
29
|
readonly description: 'Another take on the primary. Needs --feature and a primary.';
|
|
29
30
|
};
|
|
31
|
+
readonly tool: {
|
|
32
|
+
readonly type: 'boolean';
|
|
33
|
+
readonly description: 'A small app that makes assets for several features: listed under Tools, not in a feature group, and starts In progress.';
|
|
34
|
+
};
|
|
30
35
|
readonly feature: {
|
|
31
36
|
readonly type: 'string';
|
|
32
37
|
readonly description: 'The feature slug: the folder under docs/sprints/.';
|
|
@@ -42,7 +47,6 @@ export declare const spec: {
|
|
|
42
47
|
};
|
|
43
48
|
readonly output: '{ ok, created, url, next }';
|
|
44
49
|
};
|
|
45
|
-
type Kind = 'sprint' | 'alternate' | 'exploration';
|
|
46
50
|
/**
|
|
47
51
|
* The template folder: brand collateral is always a board of artboards;
|
|
48
52
|
* otherwise the Space, or the shell of the prototype's track. A project
|
|
@@ -50,10 +54,11 @@ type Kind = 'sprint' | 'alternate' | 'exploration';
|
|
|
50
54
|
*/
|
|
51
55
|
export declare function templateFor(track: Track | '', app: boolean): string;
|
|
52
56
|
/** The kind the flags ask for, refused when the feature's state does not allow it. */
|
|
53
|
-
export declare function kindFor(flags: Pick<Args<typeof spec>['flags'], 'sprint' | 'alternate'
|
|
57
|
+
export declare function kindFor(flags: Pick<Args<typeof spec>['flags'], 'sprint' | 'alternate'> & {
|
|
58
|
+
tool?: boolean;
|
|
59
|
+
}, feature: string, primary?: (f: string) => string | undefined): Kind;
|
|
54
60
|
export declare function main(args: Args<typeof spec>): {
|
|
55
61
|
created: string;
|
|
56
62
|
url: string;
|
|
57
63
|
next: string;
|
|
58
64
|
};
|
|
59
|
-
export {};
|
package/dist/scripts/new.js
CHANGED
|
@@ -36,6 +36,10 @@ export const spec = {
|
|
|
36
36
|
type: 'boolean',
|
|
37
37
|
description: 'Another take on the primary. Needs --feature and a primary.',
|
|
38
38
|
},
|
|
39
|
+
tool: {
|
|
40
|
+
type: 'boolean',
|
|
41
|
+
description: 'A small app that makes assets for several features: listed under Tools, not in a feature group, and starts In progress.',
|
|
42
|
+
},
|
|
39
43
|
feature: { type: 'string', description: 'The feature slug: the folder under docs/sprints/.' },
|
|
40
44
|
title: { type: 'string', description: 'Display title. Default: the slug in sentence case.' },
|
|
41
45
|
guide: { type: 'boolean', description: 'Scaffold docs/sprints/<feature>/guide.md instead.' },
|
|
@@ -100,10 +104,16 @@ function resolveTrack(asked) {
|
|
|
100
104
|
}
|
|
101
105
|
/** The kind the flags ask for, refused when the feature's state does not allow it. */
|
|
102
106
|
export function kindFor(flags, feature, primary = (f) => primaryOf(f)?.slug) {
|
|
103
|
-
if (flags.sprint
|
|
104
|
-
throw new CliError('Pick one of --sprint and --
|
|
105
|
-
const kind = flags.sprint
|
|
106
|
-
|
|
107
|
+
if ([flags.sprint, flags.alternate, flags.tool].filter(Boolean).length > 1)
|
|
108
|
+
throw new CliError('Pick one of --sprint, --alternate and --tool.');
|
|
109
|
+
const kind = flags.sprint
|
|
110
|
+
? 'sprint'
|
|
111
|
+
: flags.alternate
|
|
112
|
+
? 'alternate'
|
|
113
|
+
: flags.tool
|
|
114
|
+
? 'tool'
|
|
115
|
+
: 'exploration';
|
|
116
|
+
if (kind === 'exploration' || kind === 'tool')
|
|
107
117
|
return kind;
|
|
108
118
|
if (!feature)
|
|
109
119
|
throw new CliError(`A ${kind} prototype names its feature.`, { fix: 'Add --feature <feature>.' });
|
|
@@ -136,6 +146,7 @@ function prototype(slug, { flags }) {
|
|
|
136
146
|
slug,
|
|
137
147
|
created: created(),
|
|
138
148
|
kind,
|
|
149
|
+
status: kind === 'tool' ? 'in-progress' : 'exploring',
|
|
139
150
|
feature,
|
|
140
151
|
track,
|
|
141
152
|
});
|
|
@@ -46,7 +46,7 @@ export const spec = {
|
|
|
46
46
|
const MAX_CODE_CHARS = 12_000;
|
|
47
47
|
const outcome = (step, run, fix) => run.ok ? { step, ok: true } : { step, ok: false, detail: run.output ?? run.error, fix };
|
|
48
48
|
/** Prototypes a reviewer is sent to: live sprints and their alternates. */
|
|
49
|
-
const reviewed = (all) => all.filter((p) => isLive(p) && p.kind
|
|
49
|
+
const reviewed = (all) => all.filter((p) => isLive(p) && (p.kind === 'sprint' || p.kind === 'alternate'));
|
|
50
50
|
function guides(all) {
|
|
51
51
|
const features = [
|
|
52
52
|
...new Set(reviewed(all)
|
package/dist/scripts/share.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { existsSync, mkdtempSync, rmSync } from 'node:fs';
|
|
10
10
|
import { tmpdir } from 'node:os';
|
|
11
11
|
import { join } from 'node:path';
|
|
12
|
-
import {
|
|
12
|
+
import { isOpen } from '../core/catalog.js';
|
|
13
13
|
import { DOCS, ROOT } from '../server/paths.js';
|
|
14
14
|
import { buildHub } from '../vite/plugin.js';
|
|
15
15
|
import { KEEP_BUILDS, pruneBuilds, publishBuild } from './lib/builds.js';
|
|
@@ -30,10 +30,10 @@ export const spec = {
|
|
|
30
30
|
},
|
|
31
31
|
output: '{ ok, studio, client, project, build, files, address, open: [{ title, url, guide? }], removed, next } or { ok: false, stage, ... }',
|
|
32
32
|
};
|
|
33
|
-
/** Each
|
|
33
|
+
/** Each open sprint (not archived, not a presented take) and its walkthrough, by its path below the project. */
|
|
34
34
|
function opens() {
|
|
35
35
|
return prototypes()
|
|
36
|
-
.filter((p) =>
|
|
36
|
+
.filter((p) => isOpen(p) && p.kind === 'sprint')
|
|
37
37
|
.map((p) => ({
|
|
38
38
|
title: p.title,
|
|
39
39
|
path: `${p.slug}/`,
|
package/dist/server/api.d.ts
CHANGED
|
@@ -21,6 +21,17 @@ export type ApiContext = {
|
|
|
21
21
|
mailUnknown?: boolean;
|
|
22
22
|
};
|
|
23
23
|
export declare const handleReview: (request: Request, ctx: ApiContext) => Promise<Response>;
|
|
24
|
+
/**
|
|
25
|
+
* The studio's own host's review API for one Studio person already known:
|
|
26
|
+
* `design-hub dev` serves the studio hub's page on it, over a local store,
|
|
27
|
+
* with no gate in front.
|
|
28
|
+
*/
|
|
29
|
+
export declare const handleStudioReview: (request: Request, { review, actor, host, mailer }: {
|
|
30
|
+
review: Review;
|
|
31
|
+
actor: Person;
|
|
32
|
+
host: string;
|
|
33
|
+
mailer: Mailer | null;
|
|
34
|
+
}) => Promise<Response>;
|
|
24
35
|
/** The person a request's signed cookie names, while they may still sign in, where `at` is: a client's scope, or the studio's host. */
|
|
25
36
|
export declare function actorFrom(request: Request, review: Review, gate: Gate, at: HostScope): Promise<Person | null>;
|
|
26
37
|
/** A studio site's review service and gate keys, or why it has none. */
|
package/dist/server/api.js
CHANGED
|
@@ -314,6 +314,12 @@ const studioOps = (review, actor, host, mailer) => {
|
|
|
314
314
|
},
|
|
315
315
|
};
|
|
316
316
|
};
|
|
317
|
+
/**
|
|
318
|
+
* The studio's own host's review API for one Studio person already known:
|
|
319
|
+
* `design-hub dev` serves the studio hub's page on it, over a local store,
|
|
320
|
+
* with no gate in front.
|
|
321
|
+
*/
|
|
322
|
+
export const handleStudioReview = (request, { review, actor, host, mailer }) => answer(request, studioOps(review, actor, host, mailer));
|
|
317
323
|
/** The person a request's signed cookie names, while they may still sign in, where `at` is: a client's scope, or the studio's host. */
|
|
318
324
|
export async function actorFrom(request, review, gate, at) {
|
|
319
325
|
const claim = await readPersonToken(gate, readCookie(request, PERSON_COOKIE));
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
import type { Person } from '../core/review/model.ts';
|
|
3
|
+
import { type Review } from '../core/review/service.ts';
|
|
4
|
+
type Sample = {
|
|
5
|
+
slug: string;
|
|
6
|
+
name: string;
|
|
7
|
+
/** Proven: added and open. Otherwise still waiting for its address, as a half-run `client add` leaves it. */
|
|
8
|
+
proven: boolean;
|
|
9
|
+
projects: {
|
|
10
|
+
slug: string;
|
|
11
|
+
name: string;
|
|
12
|
+
built: boolean;
|
|
13
|
+
}[];
|
|
14
|
+
people: {
|
|
15
|
+
name: string;
|
|
16
|
+
email: string | null;
|
|
17
|
+
}[];
|
|
18
|
+
};
|
|
19
|
+
/** What a studio with a little history holds: two open clients with projects and people, and one still being added. */
|
|
20
|
+
export declare const SAMPLE_CLIENTS: Sample[];
|
|
21
|
+
export declare const SAMPLE_STUDIO_PEOPLE: {
|
|
22
|
+
name: string;
|
|
23
|
+
email: string;
|
|
24
|
+
}[];
|
|
25
|
+
/** Fills an empty dev studio store with the samples; a store that has a client already is left as it is. */
|
|
26
|
+
export declare function seedDevStudio(review: Review, actor: Person): Promise<void>;
|
|
27
|
+
/** Which dev site a page is: the studio's host, a client's (by slug), or neither (the project's own pages). */
|
|
28
|
+
export declare function devSiteOf(page: string | undefined): {
|
|
29
|
+
studio: true;
|
|
30
|
+
} | {
|
|
31
|
+
client: string;
|
|
32
|
+
} | null;
|
|
33
|
+
/** Where Open on the studio hub lands in dev: the client's dev hub, or, for a project, this project's index. */
|
|
34
|
+
export declare function devHandoffTarget(form: URLSearchParams): string;
|
|
35
|
+
export declare function devStudio(): Plugin;
|
|
36
|
+
export {};
|