@milesroxas/design-hub 0.11.1 → 0.12.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 (60) hide show
  1. package/README.md +4 -2
  2. package/core/prototype.test.ts +52 -0
  3. package/core/prototype.ts +59 -0
  4. package/core/review/model.ts +32 -3
  5. package/core/review/service.test.ts +240 -0
  6. package/core/review/service.ts +281 -50
  7. package/core/review/store.ts +10 -4
  8. package/dist/core/prototype.d.ts +50 -0
  9. package/dist/core/prototype.js +38 -0
  10. package/dist/core/review/model.d.ts +25 -1
  11. package/dist/core/review/model.js +18 -2
  12. package/dist/core/review/service.d.ts +98 -16
  13. package/dist/core/review/service.js +254 -45
  14. package/dist/core/review/store.d.ts +10 -4
  15. package/dist/scripts/client.d.ts +3 -3
  16. package/dist/scripts/client.js +52 -66
  17. package/dist/scripts/lib/dns.d.ts +32 -0
  18. package/dist/scripts/lib/dns.js +69 -1
  19. package/dist/scripts/lib/fake-host.d.ts +34 -9
  20. package/dist/scripts/lib/fake-host.js +7 -4
  21. package/dist/scripts/lib/review.d.ts +5 -2
  22. package/dist/scripts/lib/review.js +8 -2
  23. package/dist/scripts/lib/studios.d.ts +3 -1
  24. package/dist/scripts/lib/studios.js +2 -0
  25. package/dist/scripts/people.d.ts +8 -5
  26. package/dist/scripts/people.js +152 -41
  27. package/dist/scripts/share.js +1 -1
  28. package/dist/scripts/studio.d.ts +3 -3
  29. package/dist/scripts/studio.js +100 -10
  30. package/dist/server/api.d.ts +6 -8
  31. package/dist/server/api.js +129 -42
  32. package/dist/server/hosts.d.ts +3 -3
  33. package/dist/server/hosts.js +10 -10
  34. package/dist/server/session.d.ts +7 -0
  35. package/dist/server/session.js +8 -1
  36. package/dist/vercel/proxy.d.ts +7 -3
  37. package/dist/vercel/proxy.js +215 -49
  38. package/dist/vite/plugin.d.ts +6 -2
  39. package/dist/vite/plugin.js +21 -3
  40. package/package.json +1 -1
  41. package/shell/Index.tsx +29 -0
  42. package/shell/review/People.tsx +80 -61
  43. package/shell/review/Review.tsx +49 -1
  44. package/shell/review/ThreadCard.tsx +13 -1
  45. package/shell/review/client.ts +56 -22
  46. package/shell/review/review.css +1 -0
  47. package/shell/review/unsent.test.ts +63 -0
  48. package/shell/review/unsent.ts +64 -0
  49. package/shell/review/view.ts +22 -6
  50. package/shell/studio/ClientHub.tsx +9 -36
  51. package/shell/studio/StudioHub.tsx +293 -0
  52. package/shell/studio/hub.css +80 -5
  53. package/shell/studio/page.tsx +57 -0
  54. package/shell/studio/studio.html +14 -0
  55. package/shell/studio/studio.tsx +19 -0
  56. package/skills/miles-deploy/SKILL.md +16 -6
  57. package/skills/miles-design-hub/SKILL.md +3 -3
  58. package/skills/miles-review/SKILL.md +1 -1
  59. package/templates/studio/README.md +32 -13
  60. package/templates/studio/package.json +1 -1
@@ -5,7 +5,7 @@ description: "Share the prototypes through a studio and hand out sign-in links:
5
5
 
6
6
  # Share
7
7
 
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.
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 studio's own people sign in at `studio.<apex>`: it lists every client with its projects, **Open hub** goes into one with one click, already signed in, and **People** manages each client's people and the studio's own. No client reaches it. The user never types a command: run them and send any link they must click.
9
9
 
10
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
11
 
@@ -18,7 +18,7 @@ A studio runs on its owner's hosting account. Ask the owner, in one plain questi
18
18
  - **DNS:** a record `client add` adds or prints, or one `client archive` removes.
19
19
  - **Skipping a pre-flight step** with `--skip`.
20
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.
21
+ `project link`, `share`, `people` and `comments` act only inside the studio's own store, for the linked project and its client, and `people --studio` for the studio's own people. Run them when the user asks.
22
22
 
23
23
  ## Signing in to Vercel
24
24
 
@@ -56,7 +56,7 @@ pnpm studio create --dir <folder outside any project> --slug <studio> --apex <do
56
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
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
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.
59
+ It makes the folder, sets up the site on the team with its own database and file store, deploys it, adds `studio.<apex>` and lists it on this machine. The owner is its first Studio person. `link` is the owner's sign-in link on `studio.<apex>`, printed once, by the run that first finds the host answering: send it to the owner only. Until then `studioHost.state` is `waiting` with a `fix`, and `pnpm studio deploy --studio <slug>` prints the link once the host answers. Commit the folder to a private repo if the owner wants it on another machine; its `.env` stays out of git.
60
60
 
61
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
62
 
@@ -69,7 +69,7 @@ pnpm client add <client> --studio <studio> --name "<client name>" \
69
69
  --person "<their first person>" --team "<their company>" [--host <codename>]
70
70
  ```
71
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.
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 one link, for the client's first person (`links.client`). The owner needs none: the client is listed on `studio.<apex>`, and **Open hub** there signs them in on its address. A link that shows Not found opens within a minute. `pnpm client list --studio <studio>` lists every client.
73
73
 
74
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
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.
@@ -121,10 +121,20 @@ Before the handover, check that each prototype it names is switched to client-fa
121
121
  People belong to the linked project's client. Each gets their own link, on the client's address:
122
122
 
123
123
  ```bash
124
- pnpm people add --name "<name>" --team "<company>"
124
+ pnpm people add --name "<name>"
125
125
  ```
126
126
 
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**).
127
+ A Client is the default kind. Their team, shown beside their name, is the client's name; a Studio person's is the studio's. `--team` overrides it, only for someone outside both (a freelancer's own company). Studio adds people from the People tab too (the round comments button, then **⋯**, **People**), and on `studio.<apex>` with **People** beside the client.
128
+
129
+ The studio's own people sign in at `studio.<apex>` and see every client. From any project on this machine, linked or not:
130
+
131
+ ```bash
132
+ pnpm people add --name "<name>" --studio <studio> # a Studio person, their link on studio.<apex>
133
+ pnpm people --studio <studio> # the studio's people, with their ids
134
+ pnpm people link <id> --studio <studio> # a new link for one of them, the owner too
135
+ ```
136
+
137
+ `owner` in the studio folder's `studio.json` is the owner's id. A Studio person's link is on `studio.<apex>` once it answers; before then `--studio` refuses `add`, `link` and `sign-out`, changes nothing and says why (`studio_host_waiting`). In a linked project, `--kind studio`, or `add --studio` for the project's own studio, prints a `notice` that they see every client. On `studio.<apex>`, **People** under **Studio people** adds Studio people and gives another Studio person a new link; a person's own row there has no actions, so a user's own new link comes from `pnpm people link <their id> --studio <studio>` or from someone else in the studio. Use the command when the owner lost their link or wants a second device.
128
138
 
129
139
  - **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.
130
140
  - **Another device, or a link that stopped working:** `pnpm people link <id>` gives one more link. Their other devices stay signed in.
@@ -89,12 +89,12 @@ It picks a port nothing holds and no other project claims, writes it to `.env` a
89
89
 
90
90
  The user does nothing in a terminal here; each step that needs them is one link to click.
91
91
 
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.
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. It is the only link `client add` prints: the studio opens the client from `studio.<apex>`. `miles-deploy` has the rest.
93
93
  2. `pnpm --dir <path> project link --studio <studio> --client <client> --project <name>`, then commit `.design-hub/studio.json`.
94
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`.
95
+ 4. The user's own Studio link, on `studio.<apex>`, only when they have no device signed in there: when `pnpm --dir <path> people --studio <studio>` lists them, `pnpm --dir <path> people link <id> --studio <studio>`; else `pnpm --dir <path> people add --name "<user>" --studio <studio>`.
96
96
 
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.
97
+ Give the user the `address`, and their own `link` when step 4 made one, in the closing message. Say the link signs in one device and then stops working, that `studio.<apex>` lists every client and opens this one with one click, 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.
98
98
 
99
99
  ## 5. Record what was answered
100
100
 
@@ -32,7 +32,7 @@ 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
- - 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.
35
+ - People belong to the linked project's client. Anyone comes from `pnpm people add --name <n>`, the People tab, or **People** beside the client on `studio.<apex>`. The studio's own people sign in at `studio.<apex>` and open every client from there: `pnpm people add --name <n> --studio <studio>`, and `pnpm people link <id> --studio <studio>` for a new link.
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
 
@@ -1,8 +1,12 @@
1
1
  # A Design Hub studio site
2
2
 
3
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
4
+ API, each client's hub at `<client>.<apex>`, every project's build at
5
+ `<client>.<apex>/<project>/`, read from a private Vercel Blob store, and the
6
+ studio hub at `studio.<apex>`. Studio people sign in there and see every
7
+ client with its projects; Open goes into a client's hub with one click,
8
+ already signed in; and each client's people, and the studio's own, are
9
+ managed there. No client's host serves the studio hub. Projects
6
10
  stay in their own repos: each is linked to a client once (`design-hub project
7
11
  link`), and `design-hub share` run in it uploads its build here.
8
12
 
@@ -10,7 +14,7 @@ link`), and `design-hub share` run in it uploads its build here.
10
14
  | --- | --- |
11
15
  | `studio.json` | The studio's id, slug, apex, name, Vercel team and project, and DNS mode. No secrets. |
12
16
  | `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/`. |
17
+ | `build.mjs` | Builds the client hub page, the studio hub page and the gate's font into `dist/`. |
14
18
  | `.env` | The studio's secrets, gitignored. `.env.example` names them. |
15
19
  | `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
20
 
@@ -25,16 +29,23 @@ design-hub studio create --dir <folder> --slug <studio> --apex <domain> \
25
29
  design-hub client add <client> --studio <studio> --name "<client name>" --person "<their name>"
26
30
  design-hub client access <client> --studio <studio> --access 3m|6m|open|studio
27
31
  design-hub client archive <client> --studio <studio>
32
+ design-hub client list --studio <studio>
28
33
  design-hub studio deploy --studio <studio> # installs and builds here, deploys, removes every older deployment
29
34
  design-hub studio link --dir <folder> # this folder on another machine
35
+ design-hub people link <your id> --studio <studio> # a new sign-in link for you, on studio.<apex>
36
+ design-hub people add --name "<name>" --studio <studio> # a Studio person, their link on studio.<apex>
30
37
  ```
31
38
 
39
+ `people` here, or with `--studio` from anywhere on the machine, is the
40
+ studio's own people: Studio people only. `people list` names each id, your
41
+ own (`owner` in `studio.json`) too.
42
+
32
43
  In a project, once its studio is listed on the machine:
33
44
 
34
45
  ```bash
35
46
  design-hub project link --studio <studio> --client <client> --project <project> # commit .design-hub/studio.json
36
47
  design-hub share # prints https://<client host>/<project>/
37
- design-hub people add --name "<name>" --team "<team>" # a link on the client's host
48
+ design-hub people add --name "<name>" # a Client person, their link on the client's host
38
49
  ```
39
50
 
40
51
  - **DNS.** `vercel`: the apex is on Vercel's nameservers and one wildcard serves
@@ -48,20 +59,28 @@ design-hub people add --name "<name>" --team "<team>"
48
59
  with the id in `studio.json`, and refuses one that is another studio's or
49
60
  already holds a studio's data, before writing to it; refused, it takes the
50
61
  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).
62
+ connected it. Every `client` and `project` command, `people`, and `share`
63
+ and `comments` in a linked project, check the mark first. `comments` does
64
+ not run in this folder: it acts for a linked project's client. Never
65
+ connect one database to two studios (`--database` names one no studio
66
+ uses).
56
67
  - **Shares.** `share` builds the project at `/<project>/`, uploads every file
57
68
  (dotfiles skipped) under a new random build id, and only then points the
58
69
  project at it, so a half-finished upload is never served; one that fails is
59
70
  removed. The live build and the two newest others are kept. The address it
60
71
  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.
72
+ - **The studio host.** `studio create` (or `studio deploy`, for a studio made
73
+ before it had one) adds `studio.<apex>`: its DNS record, its domain on the
74
+ site, and a proof that it answers as this studio. The run that first proves
75
+ it prints the owner's link there; later runs leave it alone and print none.
76
+ A new link for the owner: `people link <owner id> --studio <studio>`.
77
+ - **Links.** `client add` prints one link, for the client's first person, on
78
+ the client's own host. A Studio person's link is on `studio.<apex>` once it
79
+ answers, from `people` and from the studio hub. Each link signs in one
80
+ device, then stops working. A session works on its own host only, a Studio
81
+ person's too, and is checked against the store again every five minutes.
82
+ Open on the studio hub signs the Studio person in on the client's host with
83
+ a one-time handoff that lasts 60 seconds.
65
84
  - **Access.** A person's own length, else the client's (`client access`), else
66
85
  the studio's (`client access` with no client), else three months.
67
86
  - **Archive.** First everything of the client that can be read: its host stops
@@ -9,7 +9,7 @@
9
9
  "build": "node build.mjs"
10
10
  },
11
11
  "dependencies": {
12
- "@milesroxas/design-hub": "0.11.1",
12
+ "@milesroxas/design-hub": "0.12.0",
13
13
  "react": "^19.3.1",
14
14
  "react-dom": "^19.3.1"
15
15
  }