@milesroxas/design-hub 0.9.0 → 0.11.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.
Files changed (150) hide show
  1. package/README.md +13 -11
  2. package/core/controls.test.ts +176 -0
  3. package/core/controls.ts +195 -0
  4. package/core/files.test.ts +76 -0
  5. package/core/files.ts +131 -0
  6. package/core/prototype.test.ts +124 -7
  7. package/core/prototype.ts +133 -24
  8. package/core/review/model.ts +144 -2
  9. package/core/review/policy.test.ts +79 -22
  10. package/core/review/policy.ts +36 -8
  11. package/core/review/service.test.ts +1525 -322
  12. package/core/review/service.ts +810 -183
  13. package/core/review/store.test.ts +91 -0
  14. package/core/review/store.ts +143 -26
  15. package/dist/core/controls.d.ts +55 -0
  16. package/dist/core/controls.js +174 -0
  17. package/dist/core/files.d.ts +39 -0
  18. package/dist/core/files.js +107 -0
  19. package/dist/core/prototype.d.ts +61 -12
  20. package/dist/core/prototype.js +105 -26
  21. package/dist/core/review/model.d.ts +87 -2
  22. package/dist/core/review/model.js +97 -1
  23. package/dist/core/review/policy.d.ts +11 -4
  24. package/dist/core/review/policy.js +14 -2
  25. package/dist/core/review/service.d.ts +222 -43
  26. package/dist/core/review/service.js +727 -182
  27. package/dist/core/review/store.d.ts +84 -24
  28. package/dist/core/review/store.js +66 -26
  29. package/dist/scripts/bootstrap.d.ts +4 -34
  30. package/dist/scripts/bootstrap.js +9 -244
  31. package/dist/scripts/cli.js +6 -0
  32. package/dist/scripts/client.d.ts +45 -0
  33. package/dist/scripts/client.js +320 -0
  34. package/dist/scripts/commands.js +6 -0
  35. package/dist/scripts/comments.d.ts +8 -26
  36. package/dist/scripts/comments.js +27 -14
  37. package/dist/scripts/guard.d.ts +11 -0
  38. package/dist/scripts/guard.js +44 -0
  39. package/dist/scripts/lib/builds.d.ts +40 -0
  40. package/dist/scripts/lib/builds.js +198 -0
  41. package/dist/scripts/lib/cli.js +3 -1
  42. package/dist/scripts/lib/deploy.d.ts +6 -90
  43. package/dist/scripts/lib/deploy.js +24 -137
  44. package/dist/scripts/lib/dns.d.ts +49 -0
  45. package/dist/scripts/lib/dns.js +141 -0
  46. package/dist/scripts/lib/fake-host.d.ts +168 -0
  47. package/dist/scripts/lib/fake-host.js +244 -0
  48. package/dist/scripts/lib/host.d.ts +87 -0
  49. package/dist/scripts/lib/host.js +362 -0
  50. package/dist/scripts/lib/linked.d.ts +51 -0
  51. package/dist/scripts/lib/linked.js +124 -0
  52. package/dist/scripts/lib/names.d.ts +35 -0
  53. package/dist/scripts/lib/names.js +77 -0
  54. package/dist/scripts/lib/review.d.ts +23 -2
  55. package/dist/scripts/lib/review.js +32 -15
  56. package/dist/scripts/lib/rules.d.ts +1 -0
  57. package/dist/scripts/lib/rules.js +1 -0
  58. package/dist/scripts/lib/studio-deps.d.ts +35 -0
  59. package/dist/scripts/lib/studio-deps.js +79 -0
  60. package/dist/scripts/lib/studios.d.ts +70 -0
  61. package/dist/scripts/lib/studios.js +187 -0
  62. package/dist/scripts/lib/update.d.ts +33 -0
  63. package/dist/scripts/lib/update.js +40 -0
  64. package/dist/scripts/lib/vercel.d.ts +1 -23
  65. package/dist/scripts/lib/vercel.js +6 -81
  66. package/dist/scripts/people.d.ts +7 -11
  67. package/dist/scripts/people.js +51 -46
  68. package/dist/scripts/preflight.d.ts +8 -1
  69. package/dist/scripts/preflight.js +36 -19
  70. package/dist/scripts/project.d.ts +86 -0
  71. package/dist/scripts/project.js +141 -0
  72. package/dist/scripts/share.d.ts +105 -30
  73. package/dist/scripts/share.js +82 -154
  74. package/dist/scripts/skills.d.ts +18 -2
  75. package/dist/scripts/skills.js +22 -3
  76. package/dist/scripts/studio.d.ts +75 -0
  77. package/dist/scripts/studio.js +401 -0
  78. package/dist/scripts/upgrade.d.ts +10 -2
  79. package/dist/scripts/upgrade.js +44 -14
  80. package/dist/server/api.d.ts +22 -11
  81. package/dist/server/api.js +125 -44
  82. package/dist/server/blob.d.ts +10 -0
  83. package/dist/server/blob.js +53 -0
  84. package/dist/server/checks.js +2 -2
  85. package/dist/server/dev.js +4 -4
  86. package/dist/server/env.d.ts +2 -0
  87. package/dist/server/env.js +9 -0
  88. package/dist/server/fake-upstash.js +52 -3
  89. package/dist/server/hosts.d.ts +11 -0
  90. package/dist/server/hosts.js +31 -0
  91. package/dist/server/local.d.ts +7 -1
  92. package/dist/server/local.js +10 -1
  93. package/dist/server/mark.d.ts +41 -0
  94. package/dist/server/mark.js +111 -0
  95. package/dist/server/session.d.ts +17 -9
  96. package/dist/server/session.js +22 -45
  97. package/dist/server/upstash.js +20 -0
  98. package/dist/vercel/files.d.ts +11 -0
  99. package/dist/vercel/files.js +68 -0
  100. package/dist/vercel/index.d.ts +4 -3
  101. package/dist/vercel/index.js +12 -8
  102. package/dist/vercel/proxy.d.ts +69 -4
  103. package/dist/vercel/proxy.js +171 -107
  104. package/dist/vite/plugin.d.ts +24 -1
  105. package/dist/vite/plugin.js +46 -2
  106. package/kit/Artboard.tsx +21 -8
  107. package/kit/Space.tsx +4 -3
  108. package/kit/Variants.tsx +193 -65
  109. package/kit/ViewTools.tsx +77 -11
  110. package/kit/audience.ts +85 -0
  111. package/kit/dials.css +59 -0
  112. package/kit/dials.tsx +272 -35
  113. package/kit/harness.css +34 -0
  114. package/kit/prefs.ts +23 -1
  115. package/package.json +3 -2
  116. package/shell/ClientViewNote.tsx +31 -3
  117. package/shell/Guide.tsx +11 -5
  118. package/shell/Index.tsx +32 -10
  119. package/shell/Notice.tsx +1 -1
  120. package/shell/controls.ts +26 -0
  121. package/shell/hub.ts +5 -1
  122. package/shell/main.tsx +33 -6
  123. package/shell/review/Review.tsx +2 -2
  124. package/shell/review/ThreadCard.tsx +5 -5
  125. package/shell/review/client.ts +28 -11
  126. package/shell/review/view.test.ts +19 -0
  127. package/shell/review/view.ts +25 -0
  128. package/shell/shell.css +8 -0
  129. package/shell/studio/ClientHub.tsx +98 -0
  130. package/shell/studio/hub.css +48 -0
  131. package/shell/studio/index.html +14 -0
  132. package/shell/studio/main.tsx +17 -0
  133. package/skills/miles-brand/SKILL.md +11 -1
  134. package/skills/miles-deploy/SKILL.md +121 -64
  135. package/skills/miles-design-hub/SKILL.md +11 -9
  136. package/skills/miles-prototype/SKILL.md +34 -1
  137. package/skills/miles-review/SKILL.md +5 -7
  138. package/skills/miles-worktrees/SKILL.md +3 -3
  139. package/templates/conductor/settings.toml +1 -1
  140. package/templates/studio/.env.example +9 -0
  141. package/templates/studio/.vercelignore +5 -0
  142. package/templates/studio/README.md +84 -0
  143. package/templates/studio/_gitignore +7 -0
  144. package/templates/studio/api/files.ts +4 -0
  145. package/templates/studio/api/review.ts +4 -0
  146. package/templates/studio/build.mjs +4 -0
  147. package/templates/studio/package.json +16 -0
  148. package/templates/studio/proxy.ts +4 -0
  149. package/templates/studio/studio.json +9 -0
  150. package/templates/studio/vercel.json +27 -0
@@ -1,21 +1,98 @@
1
1
  ---
2
2
  name: miles-deploy
3
- description: "Deploy the prototypes to Vercel behind the gate and hand out sign-in links: the pre-flight (pnpm preflight), GATE_SECRET, the review store that keeps people and their links, the handover message, adding people, a second device, signing someone out, how long access lasts. Load when the user asks to deploy, share, send a link, add or remove someone, give someone access on another device, change how long access lasts, turn on comments, or check the work before any of those. Triggers on: deploy, share, share link, send to the client, send it to the team, put it online, publish, go live, update the link, push the latest, Vercel, sign in to Vercel, vercel login, gate, GATE_SECRET, sign-in link, one-time link, new link, another device, link stopped working, sign out everywhere, access length, 3 months, 6 months, open-ended, password, production, preview URL, pre-flight, preflight, ready to send, turn on comments, review store, add someone, invite someone, remove someone."
3
+ description: "Share the prototypes through a studio and hand out sign-in links: the studio (one site for every client), its clients, linking a project to a client, the pre-flight (pnpm preflight), pnpm share, the handover message, adding people, a second device, signing someone out, how long access lasts, and what needs the studio owner's word first. Load when the user asks to deploy, share, send a link, set up a studio, add a client, add or remove someone, give someone access on another device, change how long access lasts, or check the work before any of those. Triggers on: deploy, share, share link, send to the client, send it to the team, put it online, publish, go live, update the link, push the latest, studio, studio site, new client, add a client, archive a client, client host, subdomain, domain, DNS, project link, Vercel, sign in to Vercel, vercel login, gate, sign-in link, one-time link, new link, another device, link stopped working, sign out everywhere, access length, 3 months, 6 months, open-ended, pre-flight, preflight, ready to send, add someone, invite someone, remove someone."
4
4
  ---
5
5
 
6
- # Deploy
6
+ # Share
7
7
 
8
- `pnpm share` deploys the project to the linked Vercel project and checks the live link; the user never types a command. Every path sits behind the gate in `proxy.ts`. There is no password: each person is named, and signs in with their own one-time link. A link signs in one device, then stops working, so a used link opens nothing. An unused link signs in whoever opens it first, so it goes only to its person. The mechanics are scripts; this skill decides when they run and what the user is told.
8
+ A project is shared through a **studio**: one site that serves every client of the studio. A client has its own address, `<client>.<apex>`, and each of its projects sits at `/<project>/` below it. A person signs in once on their client's address and sees every project the studio has shared with that client, and nothing of any other client. The user never types a command: run them and send any link they must click.
9
+
10
+ There is no password. Each person is named and signs in with their own one-time link. A link signs in one device, then stops working. An unused link signs in whoever opens it first, so it goes only to its person.
11
+
12
+ ## What needs the owner's word first
13
+
14
+ A studio runs on its owner's hosting account. Ask the owner, in one plain question, before each of these, every time:
15
+
16
+ - **Spending money.** Nothing here should cost anything. If a command stops on a plan, a payment or a limit, stop and tell the owner what it said.
17
+ - **Creating or deleting anything on the account:** `studio create`, `studio deploy` (it replaces the site and deletes every older deployment), `client add` (it puts a new address on the site), `client archive` (it deletes the client's people, projects, comments and files for good).
18
+ - **DNS:** a record `client add` adds or prints, or one `client archive` removes.
19
+ - **Skipping a pre-flight step** with `--skip`.
20
+
21
+ `project link`, `share`, `people` and `comments` act only inside the studio's own store, for the linked project and its client. Run them when the user asks.
22
+
23
+ ## Signing in to Vercel
24
+
25
+ The studio commands need the Vercel CLI signed in:
26
+
27
+ ```bash
28
+ pnpm signin
29
+ ```
30
+
31
+ Signed in, it prints `signedIn: true` and the account. Signed out, it starts the sign-in and prints a `url` at once. Send the user that link to open and approve, then run `pnpm signin --wait 300`, which returns when they have. Any command that answers "not signed in" gets the same treatment. Why a link: `vercel login` waits for a browser click, so a terminal only adds a step the user can get wrong.
32
+
33
+ ## Find the studio
34
+
35
+ A machine keeps a list of its studios (`~/.design-hub/studios.json`), each by slug with its folder. The folder holds the studio's secrets, so it never goes in a project.
36
+
37
+ ```
38
+ does this machine list a studio?
39
+ ├── yes, the one the user means → Link the project
40
+ ├── it exists on another machine → pnpm studio link --dir <its folder, copied here with its .env>
41
+ └── no studio yet → New studio, with the owner's word
42
+ ```
43
+
44
+ ## New studio
45
+
46
+ Ask the owner for: the studio's slug and name, the apex domain clients go under (`example.com`), the Vercel team, and who serves the apex's DNS. Then, with their word:
47
+
48
+ ```bash
49
+ pnpm studio create --dir <folder outside any project> --slug <studio> --apex <domain> \
50
+ --name "<studio name>" --owner "<owner's name>" --team <vercel team> --dns vercel|cloudflare|manual
51
+ ```
52
+
53
+ - `--dns vercel`: the apex is on Vercel's nameservers, and one wildcard serves every client. Only `*.<apex>` reaches certificate logs.
54
+ - `--dns cloudflare`: one record per client through Cloudflare's API. Pass `--cloudflare-token-file <file>` holding a token with DNS edit on the zone, never the token itself.
55
+ - `--dns manual`: `client add` prints the record for the owner to add.
56
+ - With `cloudflare` or `manual`, each client's address is public in certificate logs from the moment it is added. To keep a client's name out of them, add it with `--host <codename>`.
57
+ - The first time on a team it can stop on the Upstash terms. Send the owner the message in its `fix` as written, then run it again when they say it is done.
58
+
59
+ It makes the folder, sets up the site on the team with its own database and file store, deploys it and lists it on this machine. The owner is its first Studio person. Commit the folder to a private repo if the owner wants it on another machine; its `.env` stays out of git.
60
+
61
+ To move the studio to a newer Design Hub: `pnpm add @milesroxas/design-hub@<version>` in its folder, then, with the owner's word, `pnpm studio deploy --studio <slug>`.
62
+
63
+ ## New client
64
+
65
+ With the owner's word:
66
+
67
+ ```bash
68
+ pnpm client add <client> --studio <studio> --name "<client name>" \
69
+ --person "<their first person>" --team "<their company>" [--host <codename>]
70
+ ```
71
+
72
+ It adds the address, its DNS record (or prints it, `dns.record`, for the owner to add, then run it again), checks the address answers from this studio's site, and prints two links: one for the client's first person (`links.client`) and one for the owner on the client's address (`links.studio`). A link that shows Not found opens within a minute.
73
+
74
+ - How long the client's people keep access: `pnpm client access <client> --studio <studio> --access 3m|6m|open`. Without a client it is the studio's default. Absent, it is 3 months.
75
+ - A client that has finished: with the owner's word, `pnpm client archive <client> --studio <studio>`. Run it again if it stops part way. The slug can be used again two minutes later, and starts empty.
76
+
77
+ ## Link the project
78
+
79
+ Once per project, on any machine that lists the studio:
80
+
81
+ ```bash
82
+ pnpm project link --studio <studio> --client <client> --project <project>
83
+ ```
84
+
85
+ `<project>` is the project's path on the client's address, so pick a slug that does not name anything the client should not see. It writes `.design-hub/studio.json`. Commit that file: it holds no secret, and every machine reads it to know where the project goes.
9
86
 
10
87
  ## Before every link goes out
11
88
 
12
- `pnpm share` runs this first and stops on a failure; run it alone to check without deploying:
89
+ `pnpm share` runs the pre-flight first and stops on a failure. Run it alone to check without sharing:
13
90
 
14
91
  ```bash
15
92
  pnpm preflight
16
93
  ```
17
94
 
18
- It runs every check in one pass and prints JSON with one entry per step. Read it, then walk this for each step with `ok: false`:
95
+ It prints one entry per step. Walk each step with `ok: false`:
19
96
 
20
97
  ```
21
98
  step failed?
@@ -23,98 +100,78 @@ step failed?
23
100
  │ or, only after the user says it is a business contact:
24
101
  │ pnpm preflight --allow-contact <value>
25
102
  ├── states → add the missing rows to that README's States table (miles-prototype), then rerun
26
- ├── gate → pnpm bootstrap --vercel <project> --review sets GATE_SECRET and adds the review store
27
- │ (KV_REST_API_URL, KV_REST_API_TOKEN): without the store nobody can sign in
103
+ ├── gate → the studio does not agree with .design-hub/studio.json: do what `fix` says
28
104
  └── any other → fix what `detail` names; `fix` says how
29
105
  ```
30
106
 
31
- Never send the link with a failed step, and never skip one with `--skip` without the user's word. Why: the link is what the client signs off on, and every step guards something they would see (a private phone number, a state nobody listed, a page that will not load).
107
+ Never send a link with a failed step, and never skip one without the user's word. Why: the link is what the client signs off on, and every step guards something they would see: a private phone number, a state nobody listed, a page that will not load.
32
108
 
33
- ## Signing in
34
-
35
- Every Vercel step needs the CLI signed in. The user never opens a terminal for it:
109
+ ## Share
36
110
 
37
111
  ```bash
38
- pnpm signin
112
+ pnpm share
39
113
  ```
40
114
 
41
- Signed in, it prints `signedIn: true` and the account. Signed out, it starts the sign-in in the background and prints a `url` at once. Send the user that link to open and approve, then run `pnpm signin --wait 300`, which returns when they have. Why a link: `vercel login` is a device sign-in that waits for a browser click, so a terminal adds nothing but a step the user can get wrong. Any command below that answers "not signed in" gets the same treatment.
42
-
43
- ## First deploy
115
+ It runs the pre-flight, builds the project for its path, uploads the build into the studio and only then points the project at it, so a half-finished upload is never served. It keeps the live build and the two before it. `address` is the project's address on its client's host. `ok: false` names the `stage` and the fix.
44
116
 
45
- 1. `pnpm signin` (above).
46
- 2. Ask which Vercel team the project goes in when `vercel teams ls` lists more than one. Then, from the project root:
47
- ```bash
48
- pnpm bootstrap --vercel <project-name> --team <team-slug> --review [--access 3m|6m|open]
49
- ```
50
- `--team` is the team the project is created in; without it the CLI's current team wins, which is often not the one the user means. It links the project, connects it to the GitHub repo (`vercel.git`: `connected`, `kept`, or `none` with a warning), turns Vercel Authentication off (the hub's gate is the protection), and writes a fresh `GATE_SECRET` to `.env` and to Production and Preview. `--review` adds the review store, which keeps the people and their links (see The review store). Without it nobody can sign in. `--access` sets how long a new client keeps access by default (see Access). A second run keeps what is set.
51
- 3. Deploy:
52
- ```bash
53
- pnpm share
54
- ```
55
- It runs the pre-flight, deploys, waits for the build, and requests the production URL as a signed-out browser, which must answer with the sign-in page, and then a made-up sign-in link, which must answer 404: that proves the review store is wired, since nobody signs in without it. Connected to the repo and on a clean `main`, it pushes and follows the build for that commit; otherwise it uploads the folder with the Vercel CLI. It refuses uncommitted changes rather than deploy something other than the commit: ask the user before committing. `ok: false` names the `stage` (`preflight`, `deploy` or `gate`) and the fix; a failed pre-flight step is walked as above, and nothing deploys until it passes.
56
- 4. Add the first Studio person, the user, and send them their link (see People).
57
- 5. The handover message, from the JSON's `share`, one per person: their own link, which prototype to open (`share.open`: its path and its walkthrough), that Controls is the round button at the top of the page, and that the link signs in one device, then stops working, so for another device they ask for a new one. A reviewer who is not told about Controls reviews one state. Never send `GATE_SECRET`, and never send one person's link to another.
58
-
59
- ## The review store
60
-
61
- Every share needs it: it keeps the people, their links and their comments. Ask once whether comments should be sorted by TypeSafe; `--review [--typesafe-key <key>]` adds Upstash Redis to the project through the Vercel Marketplace and copies the store's credentials into `.env`. The first time on a team it can stop on the Marketplace terms. Send the user the message in its `fix` as written: it links that team's terms page, names the one product to pick (**Upstash for Redis**, Redis Compatible Database) when Vercel lists several, and tells them not to create a database there, since the rerun creates the store and connects it. Rerun when they say it is done; if `stderr` shows another cause, show it to them instead. With TypeSafe on, comments are sorted by kind and state as they arrive. `pnpm share` after it, so the env reaches the site. `miles-review` owns working from the comments.
117
+ Before the handover, check that each prototype it names is switched to client-facing (below). Then send one message per person: the `address`, the prototype to open (`open`: its address and its walkthrough), that **Controls** is the round button at the top of the page, and their own link. Someone already signed in on that address sees the new project at once. A reviewer who is not told about Controls reviews one state.
62
118
 
63
119
  ## People
64
120
 
65
- Every person is named, and each gets their own link. Add the first Studio person, the user, from here:
121
+ People belong to the linked project's client. Each gets their own link, on the client's address:
66
122
 
67
123
  ```bash
68
- pnpm people add --name "<user>" --team "<studio>" --kind studio --site <share.url>
124
+ pnpm people add --name "<name>" --team "<company>"
69
125
  ```
70
126
 
71
- Send them the `link`; from then on, Studio adds everyone else in the People tab (the round comments button, then **⋯**, **People**), or ask for it here with `pnpm people add --name "<name>" --team "<company>" --site <share.url>`. A Client is the default kind.
127
+ A Client is the default kind. `--kind studio` makes a Studio person, who sees every client of the studio; the command says so in `notice`. Studio adds people from the People tab too (the round comments button, then **⋯**, **People**).
72
128
 
73
129
  - **A link signs in one device, then stops working.** Opening it shows who it is for and a Continue button; Continue uses it up. Why: a mail or chat preview opens links too, and must not use one up. An unused link lasts 14 days.
74
- - **Another device, or a link that stopped working:** `pnpm people link <id> --site <url>` gives one more link. Their other devices stay signed in.
75
- - **A lost or shared device:** `pnpm people sign-out <id> --site <url>` ends every session (within five minutes) and every unused link (at once) they hold, and gives one new link.
130
+ - **Another device, or a link that stopped working:** `pnpm people link <id>` gives one more link. Their other devices stay signed in.
131
+ - **A lost or shared device:** `pnpm people sign-out <id>` ends every session (within five minutes) and every unused link (at once) they hold, and gives one new link.
76
132
  - **Someone leaves:** `pnpm people revoke <id>`, or Revoke in the People tab. Their access ends on every device within five minutes, and their links stop working at once.
77
133
  - `pnpm people` lists everyone, with their id and when their access ends.
78
134
  - Never paste a link into a commit, a document, a ticket or a comment, and never send one to anyone but its person. Why: until it is used, whoever opens it first signs in as that person.
79
135
 
80
136
  ## Access
81
137
 
82
- A signed-in device stays signed in until the person's access ends: 3 months, 6 months, or open-ended. A new client gets the project default; a new Studio person is open-ended.
138
+ A signed-in device stays signed in until the person's access ends: 3 months, 6 months, or open-ended. A person's own length wins; else the client's (`client access`); else the studio's; else 3 months. A new Studio person is open-ended.
83
139
 
84
- - The project default: `pnpm people access` reads it, `pnpm people access --access 6m` sets it. Absent, it is 3 months. Ask the user at the first deploy how long the engagement runs.
85
140
  - One person: `pnpm people access <id> --access 3m|6m|open`, counted from today, or `--access` on `pnpm people add`.
86
- - When someone's access ends their links stop working at once, and every device signs out within five minutes. A changed access length reaches their signed-in devices within five minutes too. Change their access to let them back in, then send a new link.
141
+ - When someone's access ends, their links stop working at once and every device signs out within five minutes. A changed length reaches their signed-in devices within five minutes too. Change their access to let them back in, then send a new link.
142
+
143
+ ## Internal and client-facing
144
+
145
+ Every prototype is **Internal** until a Studio person marks it **Client-facing** with the switch beside it on the project's **Prototypes** page. Only then can a Client open it or see it listed. To check, open the project signed in as Studio and turn on **Client view**. A switch flipped under `pnpm dev` changes the dev store only; the studio has its own.
146
+
147
+ Dials and variants follow the same rule. A Client's **Controls** has only the View tools (theme, reduce motion, speed), and each internal dial stays at its default. A Client gets the first variant and no picker. Studio marks a dial with the eye beside its row in Controls, and variants with the eye at the end of the picker. The brand board's Zoom and Guides are the client's from the start. Copy parameters and Save version are Studio's only.
87
148
 
88
- ## Internal and client-facing prototypes
149
+ Walkthroughs and feature names reach every signed-in person whatever the switches say, so a walkthrough that describes internal work must wait.
89
150
 
90
- Every prototype is **Internal** until a Studio person marks it **Client-facing** with the switch beside it on the deployed site's **Prototypes** page; only then can a Client open it or see it listed. No command reads or sets it: to check one, open the site's index signed in as Studio and look at its switch, or turn on **Client view** there to see the index as a client gets it. A switch flipped under `pnpm dev` writes the local store only; the deployed site has its own. A new prototype is internal, and so is every prototype on a site upgraded to the release that brought this: after that upgrade, tell the user once that clients see nothing until they switch on the prototypes the client should see. Before sending a handover, ask the user to check that the prototype it names is switched on. Walkthroughs and feature names reach every signed-in person whatever the switches say, so a walkthrough that describes internal work must wait.
151
+ A build that fails names the file. Fix it; never work around the check (`miles-prototype` lists what a build refuses).
91
152
 
92
- The same upgrade changes what a build accepts and writes. Tell the user once, and when a build fails fix the file it names; never work around the check:
153
+ ## Comments
93
154
 
94
- - A stylesheet that does not parse (an unclosed block) fails `pnpm build` and stops `pnpm dev` (the page answers 500), naming file and line, where both worked before: every stylesheet is now read for reaches into a prototype's folder.
95
- - A prototype that reaches into another prototype's folder fails in `pnpm dev` and `pnpm build`, naming both files: an import (any query), a CSS `@import` or `url()`, or a `new URL('…', import.meta.url)`. Copy the file into the prototype that uses it, or move it into `kit/`.
96
- - Importing a file that sits directly in `prototypes/`, or in a folder there with no `README.md`, fails in `pnpm dev` and `pnpm build`: nothing in `prototypes/` is shared. Move shared code into `kit/`.
97
- - A `kit/` file that imports or references anything in a prototype's folder fails in `pnpm dev` and `pnpm build`: the kit never reads a prototype. Move what it needs into `kit/`.
98
- - A web worker in a prototype fails `pnpm build`. Run the work on the main thread, or build the worker from `kit/` files only.
99
- - Sass, Less and Stylus are refused: importing a `.scss`, `.sass`, `.less`, `.styl` or `.stylus` file from a prototype or from `kit/` fails in `pnpm dev` and `pnpm build`, naming the file. Rewrite it as plain CSS or `.pcss`.
100
- - Stylesheet ties resolve in source import order, as in `pnpm dev`: when a prototype imports a kit sheet and then its own, a rule of equal weight in its own sheet wins, where a build could put the kit's last before.
101
- - A prototype's small images and SVGs are separate requests from its own folder, no longer inlined as `data:` URIs.
102
- - A build fails when a file outside a prototype's folder is one of that prototype's files whole (the same bytes, a `data:` URI of it, or its whole text as a string), naming both files.
103
- - `postcss` is a direct dependency of the hub, and Vite is pinned to 8.3 (it was any 8.x from 8.3.5): the project's next install may move its Vite to any 8.3 patch, never 8.4. Nothing to do.
155
+ `pnpm comments pull` reads the linked project's comments from the studio. `miles-review` owns working from them. With `--local`, `people` and `comments` use this machine's dev store, whose links sign in nowhere.
104
156
 
105
- ## A project that shared before one-time links
157
+ ## A project that still has its own site
106
158
 
107
- A project that shared with a password (before one-time links) needs this once, before its next `pnpm share`. The pre-flight `gate` step stops the share until the store is there, so production is never replaced by a gate nobody can pass.
159
+ Only for a project made before studios. It has `proxy.ts`, `api/review.ts` and `vercel.json` at its root, and its own Vercel project, often connected to its git repo so that every push deploys. Design Hub no longer has what those files import. Until they are gone, `pnpm check` fails and `pnpm skills` stops with a message that sends you here. Do these steps in order, and never skip ahead.
108
160
 
109
- 1. The review store is now required: `pnpm bootstrap --vercel <project> --review`. Why: people and their links live in it, so without it nobody can sign in.
110
- 2. People, links and comments from before are not carried over. Add everyone again with `pnpm people add`, and send each person their own link. Tell the user once that the old comments stay in the old store and in any `comments.md` already pulled, and are not on the new site.
111
- 3. The old password variable (the `GATE_` one that is not `GATE_SECRET`) is no longer read. Remove it from `.env`, and from the Vercel project: `vercel env ls` names it, then `vercel env rm <name> production` and `preview`.
112
- 4. Earlier deployments still serve the old password page at their own URLs. Remove them: `vercel ls <project>` lists them; `vercel rm <url>` each one older than the new production deployment, with the user's word.
161
+ 1. **Tell the user**, in plain words: this project's own site stops being used. The project is shared through a studio instead, at its client's address.
162
+ 2. **With their word, take the old site off git**, before any of the three files is deleted and before anything is pushed. Why the order: those files hold the sign-in. A push without them, to a Vercel project still connected to the repo, publishes the prototypes with no sign-in for anyone who has the address.
163
+ - `.vercel/project.json` names the old project (`projectId`) and its team (`orgId`). Ask the user which team that is if `vercel teams ls` does not make it plain, and name it in every command.
164
+ - Disconnect it from git, in the project folder: `vercel git disconnect --scope <team>`. The old site stays up, behind its own sign-in, until it is deleted.
165
+ - Or delete it: `vercel project remove <project name> --scope <team>`.
166
+ - If the command stops on a prompt or an error, send the user to `https://vercel.com/<team>/<project name>/settings/git` to click **Disconnect**, or to the **Delete Project** button at the bottom of `https://vercel.com/<team>/<project name>/settings`. Wait until they say it is done.
167
+ 3. **Only then remove the old site from the project:** delete `proxy.ts`, `api/review.ts`, `vercel.json` and the `.vercel` folder, and the line naming them in `AGENTS.md`'s Layout. Run `pnpm skills` again: it passes now. Then link the project (`pnpm project link`, Link the project above) and share it (`pnpm share`).
168
+ 4. **Add the people again.** Nothing moves over from the old site: its people and comments stay behind. Add each person with `pnpm people add` (People above) and send them their new link on the client's address.
169
+ 5. **Commit** when the user asks: the removal, `.design-hub/studio.json` and the upgrade's own changes, which `git status` lists, as one commit, "Upgrade Design Hub to <version>".
113
170
 
114
171
  ## Security, never weakened for a prototype
115
172
 
116
- - `vercel.json` sets `noindex`, `X-Frame-Options: DENY`, `nosniff`, HSTS and a same-origin referrer on every path. The gate pages add a hash CSP, run no script and send no referrer.
117
- - A link is 32 random bytes, and the store keeps only its hash. Using one is atomic: of two requests with the same link, only one signs in.
118
- - The session cookie carries when the store last said yes. After five minutes the gate asks the store again on the next request of any kind and issues a fresh cookie, so a revoke, a sign out everywhere or a changed access length reaches every device within five minutes. A store that does not answer gives 503 and signs nobody out.
119
- - `--site` needs the deployed store's credentials in `.env`; with only the local store, `people` refuses rather than print a link the site does not know.
120
- - `GATE_SECRET` signs every session, together with the review store's URL, so two projects that share a secret (a copied folder) never accept each other's cookies. Never send it, never commit it. Replacing it on Vercel signs everyone out.
173
+ - Every path of every client's address sits behind the gate. A Client's session works only on their own client's address. Another client's project, a project with no build and an internal prototype all answer the same 404 as a path that is not there.
174
+ - The studio site sends `noindex`, `X-Frame-Options: DENY`, `nosniff`, HSTS and a same-origin referrer on every path. The gate pages add a hash CSP, run no script and send no referrer.
175
+ - A link is 32 random bytes, and the store keeps only its hash. Of two requests with the same link, only one signs in.
176
+ - The session cookie carries when the store last said yes. After five minutes the gate asks the store again on the next request, so a revoke, a sign out everywhere or a changed access length reaches every device within five minutes. A store that does not answer gives 503 and signs nobody out.
177
+ - The studio folder's `.env` holds the studio's secrets: the gate's signing secret, the database and the file store. Never send it, never commit it, never copy it into a project.
@@ -52,18 +52,21 @@ The tracks decide everything a shell question used to: product draws `AppShell`,
52
52
 
53
53
  | Header | Question | Options |
54
54
  |---|---|---|
55
- | Share | Put the prototypes on a private link now? Each person signs in with their own link. | Yes (Recommended) · Later. Why now: everything it needs is answered in one sitting, and the first link proves the deploy works before there is client work on it. |
55
+ | Share | Share the prototypes through a studio now? Each person signs in with their own link on their client's address. | Yes (Recommended) · Later. Why now: everything it needs is answered in one sitting, and the first link proves the share works before there is client work on it. Ask it only when this machine lists a studio. No command lists them: read `~/.design-hub/studios.json`, which holds each studio's slug and folder and no secret. With none, it is Later, and `miles-deploy` sets one up with its owner. |
56
+ | Studio | Which studio shares this project? | One option per slug in the list. Asked only with Share a yes and more than one studio listed; with one, it is that one. Every command below names it with `--studio`. |
57
+ | Client | Which client is this project for? | A client the studio has (its slug, typed) · A new client. Asked only with Share a yes. A new client needs the studio owner's word, since it adds an address and a DNS record: ask for it in the same round. |
56
58
  | Front end | Which front end will the site use? | Astro (Recommended) · Next.js |
57
59
 
58
60
  **Round 4: typed answers, one short chat message each, only for what was chosen.**
59
61
 
62
+ - A new client: its slug and name, and the name and company of the client's first person, who gets the client's first link.
60
63
  - Paper: the link to the Paper frame or page, and which frames hold the shell of each track: the sidebar and top bar for product, the header, footer and any pre-footer for website.
61
64
  - TypeSafe on: the API key. If the host has a secret field (such as `request_secret`), use it instead of chat, because a key typed in chat stays in the transcript.
62
65
  - Always, last: "Anything about the product for `PRODUCT.md`? Reply 'skip' to leave it empty."
63
66
 
64
67
  Without a question tool (another agent, or a host that lacks one), ask everything in one message with defaults in brackets, and wait for every answer. Nothing in steps 3 to 6 runs until every round is answered.
65
68
 
66
- With Share answered Later, comments and the share link come later, with `miles-deploy`.
69
+ With Share answered Later, sharing comes later, with `miles-deploy`.
67
70
 
68
71
  ## 3. Create the project
69
72
 
@@ -82,17 +85,16 @@ pnpm --dir <path> bootstrap [--typesafe-key <key>] [--conductor --branch <branch
82
85
 
83
86
  It picks a port nothing holds and no other project claims, writes it to `.env` and `.claude/launch.json`, and applies the flags. Read the JSON's `warnings`. With the skills answered globally: `npx skills add milesroxas/design-hub -g -y`.
84
87
 
85
- ## 4b. Put it on a link, when Share was a yes
88
+ ## 4b. Share it, when Share was a yes
86
89
 
87
90
  The user does nothing in a terminal here; each step that needs them is one link to click.
88
91
 
89
- 1. `pnpm --dir <path> signin`. Signed out, it prints a `url`: send it to the user to approve, then `pnpm --dir <path> signin --wait 300`.
90
- 2. `vercel teams ls`; with more than one team, ask which with the question tool (personal account first when it is listed).
91
- 3. `pnpm --dir <path> bootstrap --vercel <name> --team <team-slug> --review`. It links the project, connects the GitHub repo, sets the gate's secret, turns Vercel's own login off and adds the review store, which keeps the people and their sign-in links. A first `--review` on a team can stop on the Marketplace terms: send the user the message in `fix` as written (it names **Upstash for Redis** as the product to pick), then rerun.
92
- 4. `pnpm --dir <path> share --cli`. `--cli` uploads the folder, since the setup may have left files uncommitted; later deploys push `main`. On `ok: false`, follow `stage` and `fix` (the pre-flight steps are in `miles-deploy`).
93
- 5. `pnpm --dir <path> people add --name "<user>" --team "<studio>" --kind studio --site <share.url>`.
92
+ 1. A new client, with the owner's word: `pnpm --dir <path> signin` first (signed out, it prints a `url`: send it to the user, then `pnpm --dir <path> signin --wait 300`), then `pnpm --dir <path> client add <client> --studio <studio> --name "<client name>" --person "<client's first person>" --team "<their company>"`. `links.client` is for that person only: put it in a message addressed to them, and tell the user not to open it, since it signs in whoever opens it first. `links.studio` is the studio owner's link on the client's address: it is the user's when they are the owner. `miles-deploy` has the rest.
93
+ 2. `pnpm --dir <path> project link --studio <studio> --client <client> --project <name>`, then commit `.design-hub/studio.json`.
94
+ 3. `pnpm --dir <path> share`. On `ok: false`, follow `stage` and `fix` (the pre-flight steps are in `miles-deploy`).
95
+ 4. The user's own Studio link, unless `links.studio` was theirs: when `pnpm --dir <path> people` lists them, `pnpm --dir <path> people link <id>`; else `pnpm --dir <path> people add --name "<user>" --team "<studio name>" --kind studio`.
94
96
 
95
- Give the user `share.url` and their own `link` in the closing message, say the link signs in one device and then stops working, and say the link shows the samples until the first feature replaces them.
97
+ Give the user the `address` and their own `link` in the closing message, say the link signs in one device and then stops working, that each prototype is internal until they switch it to client-facing, and that the address shows the samples until the first feature replaces them.
96
98
 
97
99
  ## 5. Record what was answered
98
100
 
@@ -83,10 +83,43 @@ Is it a value CSS consumes (duration, distance, scale, colour)?
83
83
  ```
84
84
 
85
85
  - Every dial carries a hint: one sentence, the unit named. A reviewer never guesses what a slider does.
86
- - Panels register in the order a reviewer reaches for them: Review (fixtures, role, scenarios) first, then the feature's own numbers, then Motion. View is mounted by the shell.
86
+ - Panels register in the order a reviewer reaches for them: Review (fixtures, role, scenarios) first, then the feature's own numbers, then Motion. View is mounted by what the prototype stands on (see View tools).
87
87
  - Slider defaults are the comp's values. The decision is the number the user settles on; copy it into the README's Decision with the rejected range.
88
+ - Every dial is internal: a client's panel has the View tools and nothing else until a dial is marked client-facing. `client(...)` from `@kit/dials` marks one where it is declared (`density: client({ type: 'select', ... })`, or around a folder for every dial in it); use it only when the user asks for clients to have that dial. Studio can also mark any dial with the eye beside its row, per deployed site, and that overrules the code. Fixtures, roles and scenarios stay internal.
89
+ - A client reads an internal dial at its default, so the default is the value to present, not a test value.
90
+ - The picker is Studio's until marked: a client gets the first variant and no picker, unless Studio marks variants with the picker's eye. Put the direction to present first.
88
91
  - Never a control inside the product chrome. A sidebar item or a sheet that switches fixtures is a testing aid wearing the product's clothes.
89
92
 
93
+ ## View tools
94
+
95
+ ### View tools fit what the prototype is
96
+
97
+ The **View** panel holds only what changes something on the prototype in front of the reviewer. What a prototype stands on decides it; you never mount `ViewTools` yourself (the guard blocks it).
98
+
99
+ | It stands on | View holds | Why |
100
+ | --- | --- | --- |
101
+ | `AppShell`, `SiteShell` | Theme, Reduce motion, Speed | A product or a site has themes and things that move. |
102
+ | `Space` | Theme, Reduce motion, Speed, unless narrowed | One thing alone may have neither. |
103
+ | `Board` (brand collateral) | Nothing: no View panel | A still file has no motion to slow, and one look. Zoom and Guides are its viewing tools. |
104
+
105
+ Narrow a `Space` when a tool would do nothing there:
106
+
107
+ ```
108
+ Does anything in it move (a transition, an animation, a hover or press response)?
109
+ ├── No → drop motion: <Space tools={['theme']}>
110
+ └── Yes → keep it
111
+ Does it have a light and a dark look (the project's tokens do, unless DESIGN.md says one theme)?
112
+ ├── No → drop theme: <Space tools={['motion']}>
113
+ └── Yes → keep it
114
+ Neither → <Space tools={false}>
115
+ ```
116
+
117
+ - Decide from what is on the page now, and change `tools` when that changes: adding the first transition to a Space that had `['theme']` puts motion back.
118
+ - A kit component that animates counts as motion: a toast, a menu, a dialog, a press response on a `Button`.
119
+ - A project with one theme narrows it once, in its own `kit/AppShell.tsx` and `kit/SiteShell.tsx` (`<ViewTools tools={['motion']} />`), not in each prototype.
120
+ - A person's own reduced-motion setting is still honoured everywhere, whatever View holds. Removing the dial removes a test control, not the behaviour: `:root[data-motion="reduce"]` rules stay in every prototype that moves.
121
+ - Never add a reduce-motion or speed control of your own to a prototype that has none in View. If you think it needs one, it stands on the wrong thing.
122
+
90
123
  ## Motion, accessibility, performance
91
124
 
92
125
  The references beside this skill (`references/motion.md`, `references/accessibility.md`, `references/performance.md`) are binding; the short rules: transform and opacity only, ease-out in and ease-in out, nothing over 300ms, nothing animates on a keyboard action, reduced motion keeps the fades, every control has a name, 40px targets, no state per frame.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: miles-review
3
- description: "Work from review comments on the deployed prototypes: pull them into the repo, sort them by state and kind, act on each, resolve them, and manage who may comment. Load when the user mentions comments, feedback, review notes, a reviewer, a sign-in link, or asks what the client said. Triggers on: comments, feedback, review notes, client notes, what did they say, reviewer, add someone, invite, sign-in link, new link, people, revoke, resolve, triage, pnpm comments, pnpm people."
3
+ description: "Work from review comments on the shared prototypes: pull them into the repo, sort them by state and kind, act on each, resolve them, and manage who may comment. Load when the user mentions comments, feedback, review notes, a reviewer, a sign-in link, or asks what the client said. Triggers on: comments, feedback, review notes, client notes, what did they say, reviewer, add someone, invite, sign-in link, new link, people, revoke, resolve, triage, pnpm comments, pnpm people."
4
4
  ---
5
5
 
6
6
  # Review
@@ -11,7 +11,7 @@ Each thread line starts with its label and its audience: `- #I3 (internal) Ed (S
11
11
 
12
12
  ## Working from comments
13
13
 
14
- 1. **Pull**, from the project root: `pnpm comments pull`. The JSON's `store` says which store it read: `deployed` when `.env` holds the store's credentials, `local` otherwise. Say which to the user, because local comments are only yours.
14
+ 1. **Pull**, from the project root: `pnpm comments pull`. The JSON's `store` says which store it read: `studio` in a project linked to a studio (`.design-hub/studio.json`), `local` otherwise. Say which to the user, because local comments are only yours.
15
15
  2. **Sort what is unsorted.** With TypeSafe on, `pnpm comments triage` first. Without it, sort by reading, and set the kind and state in the panel so the next pull agrees.
16
16
  3. **Walk each open thread.** The first match wins:
17
17
  ```
@@ -19,8 +19,8 @@ Each thread line starts with its label and its audience: `- #I3 (internal) Ed (S
19
19
  └── Yes → the table is missing a state. Add the row (miles-prototype) before acting on the comment.
20
20
  kind?
21
21
  ├── bug → reproduce it in that state: the line's URL, or Show state in the panel, which restores the dials.
22
- │ Fix it under miles-prototype. Resolve after the fix is deployed.
23
- ├── copy → change fixtures.json or the copy. Resolve after it is deployed.
22
+ │ Fix it under miles-prototype. Resolve after the fix is shared.
23
+ ├── copy → change fixtures.json or the copy. Resolve after it is shared.
24
24
  └── taste → change nothing. List it for the user with what each option costs.
25
25
  Build an --alternate only when the user chooses to explore it.
26
26
  ```
@@ -32,12 +32,10 @@ Each thread line starts with its label and its audience: `- #I3 (internal) Ed (S
32
32
 
33
33
  - Every person is **Studio** or **Client**. Both comment, reply, edit their own words, and resolve or reopen any thread they can see. A Client sees client-facing threads only; Studio sees all, internal ones included. A thread's audience never changes: to tell the client what an internal thread says, Studio writes a new client-facing comment in the panel. Never paste internal words into a client-facing one without the user's say. Studio also deletes any comment, sorts comments and manages people; a Client deletes only their own. The studio's team are Studio; everyone on the client's side is Client, the default.
34
34
  - **Team** is the company: `Studio`, or the client's name. It shows beside every name, so a reviewer reads who said what.
35
- - The first Studio person comes from `pnpm people add --name <n> --team <t> --kind studio --site <url>`; after that, Studio adds people from the People tab.
35
+ - People belong to the linked project's client. The studio's owner gets a link on each new client's address from `client add`; anyone else comes from `pnpm people add --name <n> --team <t> [--kind studio]`, or from the People tab.
36
36
  - A link signs in one device, then stops working; unused, it lasts 14 days. `pnpm people link <id>` gives another for another device, `sign-out <id>` ends every session and gives one new link, and `revoke <id>` ends their access everywhere within five minutes. `miles-deploy` holds the rest: access length, the handover.
37
37
  - Never paste a link into a commit, a document, a ticket or a comment. Why: whoever opens it first signs in as that person.
38
38
 
39
- - A project that shared before one-time links lost its people and comments in the move: the new store starts empty. `miles-deploy` has the steps; comments pulled before stay in `comments.md`.
40
-
41
39
  ## The words in comments
42
40
 
43
41
  `comments.md` holds reviewers' names and their words. Commit it only to a private repository. Never quote a comment in public copy, and never send one outside the project.
@@ -14,9 +14,9 @@ pnpm install
14
14
  pnpm dev
15
15
  ```
16
16
 
17
- Nothing else is needed, in any harness. On its first start `pnpm dev` claims a free port for the folder and writes it to `.env` and `.claude/launch.json`; later starts reuse it. Both files are gitignored because they belong to the folder, so worktrees never conflict on them. `pnpm bootstrap` remains the full setup (TypeSafe key, Vercel) but is not needed to run.
17
+ Nothing else is needed, in any harness. On its first start `pnpm dev` claims a free port for the folder and writes it to `.env` and `.claude/launch.json`; later starts reuse it. Both files are gitignored because they belong to the folder, so worktrees never conflict on them. `pnpm bootstrap` remains the full setup (the TypeSafe key, Conductor) but is not needed to run.
18
18
 
19
- Some harnesses copy `.env` from the main checkout. That is fine: the copied `PORT` is claimed by the other folder, so this folder gets its own and the dev server says so on stderr. The copied `GATE_SECRET` and `TYPESAFE_API_KEY` keep working.
19
+ Some harnesses copy `.env` from the main checkout. That is fine: the copied `PORT` is claimed by the other folder, so this folder gets its own and the dev server says so on stderr. The copied `TYPESAFE_API_KEY` keeps working.
20
20
 
21
21
  ## Ports
22
22
 
@@ -51,6 +51,6 @@ On a taken port, `pnpm dev` refuses to start (`strictPort`) and `pnpm bootstrap`
51
51
 
52
52
  ## Nothing shared
53
53
 
54
- Checkouts share no database and no container. The review store's local copy is a file in each checkout's `.design-hub/`, and the deployed store is remote, so two checkouts never see each other's local comments.
54
+ Checkouts share no database and no container. The dev review store is a file in each checkout's `.design-hub/`, and a studio's store is remote, so two checkouts never see each other's local comments.
55
55
 
56
56
  When the user keeps their own record of which project owns which port, add this folder's port to it too.
@@ -5,7 +5,7 @@
5
5
 
6
6
  # Each workspace installs the project and serves it on its own
7
7
  # $CONDUCTOR_PORT; the dev server reads that port before .env's PORT. No
8
- # secrets are copied in: GATE_SECRET is for Vercel only.
8
+ # secrets are copied in.
9
9
  [scripts]
10
10
  setup = """
11
11
  git -C "$CONDUCTOR_ROOT_PATH" fetch --prune origin && git -C "$CONDUCTOR_ROOT_PATH" pull --ff-only || true
@@ -0,0 +1,9 @@
1
+ # The studio's secrets, written here by `design-hub studio create` and
2
+ # `studio link`; never committed or deployed. The site's Production env holds
3
+ # the same GATE_SECRET and store names. Studios share none of these.
4
+ GATE_SECRET=
5
+ KV_REST_API_URL=
6
+ KV_REST_API_TOKEN=
7
+ BLOB_READ_WRITE_TOKEN=
8
+ # Only with Cloudflare DNS: a token with DNS edit on the apex's zone.
9
+ CLOUDFLARE_API_TOKEN=
@@ -0,0 +1,5 @@
1
+ .env
2
+ .env.*
3
+ !.env.example
4
+ node_modules
5
+ dist
@@ -0,0 +1,84 @@
1
+ # A Design Hub studio site
2
+
3
+ One deployment serves every client of a studio: the sign-in gate, the review
4
+ API, each client's hub at `<client>.<apex>`, and every project's build at
5
+ `<client>.<apex>/<project>/`, read from a private Vercel Blob store. Projects
6
+ stay in their own repos: each is linked to a client once (`design-hub project
7
+ link`), and `design-hub share` run in it uploads its build here.
8
+
9
+ | File | What it is |
10
+ | --- | --- |
11
+ | `studio.json` | The studio's id, slug, apex, name, Vercel team and project, and DNS mode. No secrets. |
12
+ | `proxy.ts`, `api/review.ts`, `api/files.ts` | One-line entries from `@milesroxas/design-hub/vercel`. |
13
+ | `build.mjs` | Builds the client hub page and the gate's font into `dist/`. |
14
+ | `.env` | The studio's secrets, gitignored. `.env.example` names them. |
15
+ | `pnpm-lock.yaml` | Written by the install `studio create` and `studio deploy` run here. Kept and deployed: Vercel picks its pnpm from it, and without one its install fails. |
16
+
17
+ ## Commands
18
+
19
+ `design-hub studio create` makes this folder from the package's template; nobody
20
+ copies it by hand.
21
+
22
+ ```bash
23
+ design-hub studio create --dir <folder> --slug <studio> --apex <domain> \
24
+ --name "<studio name>" --owner "<your name>" --team <vercel team> --dns vercel|cloudflare|manual
25
+ design-hub client add <client> --studio <studio> --name "<client name>" --person "<their name>"
26
+ design-hub client access <client> --studio <studio> --access 3m|6m|open|studio
27
+ design-hub client archive <client> --studio <studio>
28
+ design-hub studio deploy --studio <studio> # installs and builds here, deploys, removes every older deployment
29
+ design-hub studio link --dir <folder> # this folder on another machine
30
+ ```
31
+
32
+ In a project, once its studio is listed on the machine:
33
+
34
+ ```bash
35
+ design-hub project link --studio <studio> --client <client> --project <project> # commit .design-hub/studio.json
36
+ design-hub share # prints https://<client host>/<project>/
37
+ design-hub people add --name "<name>" --team "<team>" # a link on the client's host
38
+ ```
39
+
40
+ - **DNS.** `vercel`: the apex is on Vercel's nameservers and one wildcard serves
41
+ every client; only `*.<apex>` reaches certificate logs. `cloudflare`: a
42
+ DNS-only record per client through Cloudflare's API, from a token with DNS
43
+ edit on the zone (`--cloudflare-token-file`, copied into `.env`). `manual`:
44
+ `client add` prints the record to add, then is run again. With either of the
45
+ last two a client's host is public in certificate logs: `--host <codename>`
46
+ keeps its name out.
47
+ - **One database per studio.** `studio create` marks the studio's database
48
+ with the id in `studio.json`, and refuses one that is another studio's or
49
+ already holds a studio's data, before writing to it; refused, it takes the
50
+ database's credentials out of `.env` and disconnects it again if it
51
+ connected it. Every `client` and `project` command, and `share`,
52
+ `design-hub people` and `comments` in a linked project, check the mark
53
+ first. `people` and `comments` do not run in this folder: they act for a
54
+ linked project's client. Never connect one database to two studios
55
+ (`--database` names one no studio uses).
56
+ - **Shares.** `share` builds the project at `/<project>/`, uploads every file
57
+ (dotfiles skipped) under a new random build id, and only then points the
58
+ project at it, so a half-finished upload is never served; one that fails is
59
+ removed. The live build and the two newest others are kept. The address it
60
+ prints is the client's own host, never a deployment.
61
+ - **Links.** `client add` prints one link for the client's first person and one
62
+ for you, both on the client's own host. Each signs in one device, then stops
63
+ working. A session works on its own client's host only, a Studio person's
64
+ too, and is checked against the store again every five minutes.
65
+ - **Access.** A person's own length, else the client's (`client access`), else
66
+ the studio's (`client access` with no client), else three months.
67
+ - **Archive.** First everything of the client that can be read: its host stops
68
+ serving it, then every person, project, comment and file goes, so the slug
69
+ used again starts clean. Then its DNS record: with `cloudflare`, the record
70
+ `client add` made is removed and any other record at the host is named and
71
+ left; with `manual`, the record to remove is printed. Last, the host comes
72
+ off the site. A host another client has is never taken off. Stopped part
73
+ way, the same command run again finishes it.
74
+ - **Install and build.** `studio create` and `studio deploy` run
75
+ `pnpm install` and `pnpm build` in this folder before each deploy, and stop
76
+ there if either fails. The install keeps `pnpm-lock.yaml` in step with
77
+ `package.json`, so the site installs what `package.json` names.
78
+ - **Upgrade.** `pnpm add @milesroxas/design-hub@<version>` here, then
79
+ `studio deploy`.
80
+ - **From a checkout.** `--package <file>.tgz` on `studio create` or
81
+ `studio deploy` installs a pack of `@milesroxas/design-hub`
82
+ (`pnpm --dir packages/design-hub pack`) in place of the package named before,
83
+ even one packed again at the same version. The deploy uploads the file and
84
+ Vercel installs it.
@@ -0,0 +1,7 @@
1
+ .DS_Store
2
+ node_modules/
3
+ dist/
4
+ .vercel/
5
+ .env
6
+ .env.*
7
+ !.env.example
@@ -0,0 +1,4 @@
1
+ // Every project's build, read from the private file store by the build its record points at.
2
+ import { filesFunction } from '@milesroxas/design-hub/vercel';
3
+
4
+ export default filesFunction();
@@ -0,0 +1,4 @@
1
+ // The review API, scoped by the host's client and the project a request names.
2
+ import { studioReviewFunction } from '@milesroxas/design-hub/vercel';
3
+
4
+ export default studioReviewFunction();
@@ -0,0 +1,4 @@
1
+ // The client hub page and the gate's font, into dist/.
2
+ import { buildStudio } from '@milesroxas/design-hub/vite';
3
+
4
+ await buildStudio(import.meta.dirname);
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "design-hub-studio",
3
+ "private": true,
4
+ "type": "module",
5
+ "engines": {
6
+ "node": ">=22.18"
7
+ },
8
+ "scripts": {
9
+ "build": "node build.mjs"
10
+ },
11
+ "dependencies": {
12
+ "@milesroxas/design-hub": "0.11.0",
13
+ "react": "^19.3.1",
14
+ "react-dom": "^19.3.1"
15
+ }
16
+ }