critiqs-react 0.3.0 → 0.5.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 (58) hide show
  1. package/AGENT_SETUP.md +198 -66
  2. package/README.md +214 -31
  3. package/bin/critiqs.mjs +3 -1
  4. package/dist/index.js +16877 -4770
  5. package/dist/server/index.d.ts +1 -87
  6. package/dist/server/index.js +1 -4889
  7. package/package.json +6 -5
  8. package/bin/cli.d.mts +0 -21
  9. package/bin/cli.mjs +0 -293
  10. package/bin/env.d.mts +0 -41
  11. package/bin/env.mjs +0 -384
  12. package/bin/init.d.mts +0 -126
  13. package/bin/init.mjs +0 -965
  14. package/bin/mcp.d.mts +0 -20
  15. package/bin/mcp.mjs +0 -314
  16. package/bin/setup.d.mts +0 -183
  17. package/bin/setup.mjs +0 -1054
  18. package/dist/backend/convex/_generated/api.d.ts +0 -95
  19. package/dist/backend/convex/_generated/api.js +0 -23
  20. package/dist/backend/convex/_generated/dataModel.d.ts +0 -60
  21. package/dist/backend/convex/_generated/server.d.ts +0 -162
  22. package/dist/backend/convex/_generated/server.js +0 -101
  23. package/dist/backend/convex/ai.ts +0 -93
  24. package/dist/backend/convex/aiSettings.ts +0 -43
  25. package/dist/backend/convex/auth.config.ts +0 -18
  26. package/dist/backend/convex/captureHttp.ts +0 -96
  27. package/dist/backend/convex/captures.ts +0 -167
  28. package/dist/backend/convex/crons.ts +0 -14
  29. package/dist/backend/convex/deviceSignIn.ts +0 -151
  30. package/dist/backend/convex/grouping.ts +0 -41
  31. package/dist/backend/convex/http.ts +0 -724
  32. package/dist/backend/convex/lib/ai.ts +0 -6
  33. package/dist/backend/convex/lib/links.ts +0 -12
  34. package/dist/backend/convex/lib/pages.ts +0 -207
  35. package/dist/backend/convex/lib/r2.ts +0 -75
  36. package/dist/backend/convex/lib/store.ts +0 -509
  37. package/dist/backend/convex/lib/tokens.ts +0 -101
  38. package/dist/backend/convex/lib/validators.ts +0 -73
  39. package/dist/backend/convex/lib/vendor/aws4fetch.js +0 -289
  40. package/dist/backend/convex/lib/vendor/critiqs_ai.js +0 -49081
  41. package/dist/backend/convex/lib/vendor/critiqs_core.js +0 -385
  42. package/dist/backend/convex/lib/vendor/critiqs_server.js +0 -3108
  43. package/dist/backend/convex/notificationEmails.ts +0 -61
  44. package/dist/backend/convex/notifications.ts +0 -182
  45. package/dist/backend/convex/plans.ts +0 -67
  46. package/dist/backend/convex/projects.ts +0 -46
  47. package/dist/backend/convex/schema.ts +0 -343
  48. package/dist/backend/convex/search.ts +0 -26
  49. package/dist/backend/convex/signIn.ts +0 -368
  50. package/dist/backend/convex/tags.ts +0 -68
  51. package/dist/backend/convex/threads.ts +0 -146
  52. package/dist/backend/convex/users.ts +0 -13
  53. package/dist/server/chunks/driver-n9zpr0k3.js +0 -21
  54. package/dist/server/chunks/index-9bg7tmnq.js +0 -522
  55. package/dist/server/chunks/index-askcfn7t.js +0 -148
  56. package/dist/server/chunks/providers-rv184xvj.js +0 -48444
  57. package/dist/server/chunks/token-kzddms7r.js +0 -63
  58. package/dist/server/chunks/token-util-k8bee1wc.js +0 -4
package/AGENT_SETUP.md CHANGED
@@ -1,10 +1,25 @@
1
+ <!-- Generated from packages/critiqs/AGENT_SETUP.md when critiqs-react is built; edit that file. -->
1
2
  # Setting up Critiqs: instructions for coding agents
2
3
 
3
- Critiqs lets reviewers comment directly on a running React prototype. It is one
4
- component, `<Critiqs />`, from the `critiqs-react` package, and works in any
5
- React 18 or 19 app: Vite, Create React App, Next.js (App Router or Pages
6
- Router), server-rendered apps, and custom setups. The command line is enough;
7
- the MCP server (step 5) is optional.
4
+ Critiqs lets reviewers comment directly on a running prototype. Each framework
5
+ has a small Critiqs package that builds on the shared `critiqs` package, and
6
+ one setup command, `critiqs`, sets up any of them:
7
+
8
+ | Framework | Package |
9
+ | --- | --- |
10
+ | React, Next.js | `critiqs-react` |
11
+ | Vue | `critiqs-vue` |
12
+ | Nuxt | `critiqs-nuxt` |
13
+ | Svelte, SvelteKit | `critiqs-svelte` |
14
+ | Angular | `critiqs-angular` |
15
+ | Astro | `critiqs-astro` |
16
+ | Solid | `critiqs-solid` |
17
+ | Ruby on Rails | the `critiqs-rails` gem |
18
+ | Django | `django-critiqs` on PyPI |
19
+ | Flask | `flask-critiqs` on PyPI |
20
+
21
+ A page with no build at all uses `<critiqs-app>` from `critiqs` itself; see its
22
+ README. The command line is enough; the MCP server (step 5) is optional.
8
23
 
9
24
  The setup CLI supports Node.js 20 or later. For the optional embedded SQLite
10
25
  server use Node.js 22.13 or later, or Bun. Node.js 20 can build the browser
@@ -14,37 +29,44 @@ Never ask the person to paste keys, tokens, or sign-in codes into the
14
29
  conversation. Critiqs Cloud, the default, needs none. AI is optional: don't set
15
30
  it up unless asked.
16
31
 
17
- ## 1. Install the package
32
+ ## 1. Run setup
18
33
 
19
- Use the project's own package manager, as its lockfile shows:
20
-
21
- ```sh
22
- npm install critiqs-react # pnpm add / yarn add / bun add critiqs-react
23
- ```
34
+ Run the commands below in the app's folder (the one with its `package.json`,
35
+ `Gemfile`, or `manage.py`), or pass `--dir <folder>`. Use `npx critiqs …` (or
36
+ `pnpm dlx critiqs`, `yarn dlx critiqs`, `bunx critiqs`). In an app that already has `critiqs-react`,
37
+ `npx critiqs-react …` runs the same command, so existing instructions keep
38
+ working.
24
39
 
25
- Run the commands below in the app's folder (the one with its `package.json`),
26
- or pass `--dir <folder>`. Use `npx critiqs-react …` (or `pnpm exec`, `yarn`,
27
- `bunx`); the command inside the package is named `critiqs`.
40
+ Setup finds the app's framework from its `package.json`, `Gemfile`, or
41
+ `manage.py` and `requirements.txt`. Critiqs the code already has comes first:
42
+ setup updates it whatever the framework (such as `critiqs-react` in an Astro
43
+ app's React island), and changes nothing when two framework packages each set
44
+ it up. When the app doesn't list the framework's Critiqs package yet, setup
45
+ says which one to install, with the command for the project's package manager
46
+ (as its lockfile shows), naming the app when run from elsewhere in its
47
+ workspace. Install it: setup adds the code that uses it, not the package.
28
48
 
29
49
  **Monorepos:** each app gets its own project. Run init once per app with
30
50
  `--dir apps/<app>`; at the workspace root, init lists the apps with these exact
31
51
  commands and changes nothing. Ask the person which apps should have Critiqs;
32
52
  never connect two apps to one project unless they ask for that.
33
53
 
34
- ## 2. Add the component and create the project
54
+ ## 2. Add Critiqs and create the project
35
55
 
36
56
  ```sh
37
- npx critiqs-react init --json
57
+ npx critiqs init --json
38
58
  ```
39
59
 
40
- Init adds `<Critiqs />` and its import where the app renders: beside `<App />`
41
- in a `createRoot(…).render(…)` or `ReactDOM.render(…)` call, inside `<body>` in
42
- a Next.js `app/layout.tsx` (the layout stays a server component; the package
43
- declares the client boundary), beside `<Component {...pageProps} />` in
44
- `pages/_app.tsx`, or beside the element `hydrateRoot` receives. For other
45
- structures, name the file and element:
46
- `npx critiqs-react init --entry src/Shell.tsx --mount Outlet`. Preview with
47
- `npx critiqs-react init <projectId> --dry-run` when the project already exists.
60
+ Init adds the framework's Critiqs component or tag, and its import, where the
61
+ app renders. In React it goes beside `<App />` in a `createRoot(…).render(…)`
62
+ or `ReactDOM.render(…)` call, or beside the element `hydrateRoot` receives; in
63
+ Next.js inside `<body>` in `app/layout.tsx` (the layout stays a server
64
+ component; the package declares the client boundary), or beside
65
+ `<Component {...pageProps} />` in `pages/_app.tsx`. Each framework package's
66
+ README says where it goes there. For other structures, name the file:
67
+ `npx critiqs init --entry src/Shell.tsx`, and in React and Next.js the element
68
+ to add it beside: `--mount Outlet`. Preview with
69
+ `npx critiqs init <projectId> --dry-run` when the project already exists.
48
70
 
49
71
  Then init signs the person in and creates the project:
50
72
 
@@ -54,26 +76,35 @@ Then init signs the person in and creates the project:
54
76
  let init choose it. It prints an address and a code such as `BCDF-GHJK`. Give
55
77
  both to the person exactly and ask them to open the address on any device,
56
78
  enter the code, sign in, and choose Approve. The code expires after 10
57
- minutes. Never ask them to send you the email code.
79
+ minutes. Never ask them to send you the email code. The address is always
80
+ the sign-in service's own `/auth/device` page. For a backend other than
81
+ Critiqs Cloud, the sign-in service must confirm that its page names the
82
+ backend, as for `sign-in` below.
58
83
 
59
84
  With `--json`, standard output is one JSON object; progress, including the
60
85
  address and code, goes to standard error. The result's `stages` say where
61
- setup stands: `Code`, `Project`, `Try it locally`, and `Reviewers elsewhere`,
62
- each `pass`, `warn`, `fail`, or `next`. Report them to the person, including
63
- any `warn` (such as a missing review address) and every `next` step they must
64
- take themselves (run the dev server, deploy).
65
-
66
- In a Vite or Next.js app, init makes the component read the app's public
67
- variable, `<Critiqs projectId={import.meta.env.VITE_CRITIQS_PROJECT_ID} requireProjectId />`
68
- (`process.env.NEXT_PUBLIC_CRITIQS_PROJECT_ID` in Next.js; workspace apps get a
69
- name with the app's suffix, such as `VITE_CRITIQS_PROJECT_ID_ADMIN`), sets it
70
- in the app's `.env.local`, and lists it empty in `.env.example`. The result's
71
- `env` names the variable and file, and the `Deployments` stage says what to
72
- do: commit the code change but not `.env.local`, and tell the person to set the
73
- variable in the build settings of each deployment that should show Critiqs,
74
- leaving it unset where Critiqs shouldn't appear. The value is built into the
75
- app, so changing it needs a rebuild. Other builds get the ID written into the
76
- component; commit it. The project ID is public configuration, not a secret.
86
+ setup stands: `Code`, `Project`, `Finish setup` (when the framework's package
87
+ still needs installing, or the framework has another step), `Try it locally`,
88
+ and `Reviewers elsewhere`, each `pass`, `warn`, `fail`, or `next`. Report them
89
+ to the person, including any `warn` (such as a missing review address), and
90
+ take or report every `next` step (install the package, run the dev server,
91
+ deploy).
92
+
93
+ Where the framework has a public environment variable, init makes Critiqs read
94
+ its project ID from it, sets it in the app's local `.env` file, and lists it
95
+ empty in `.env.example`. In a Vite app (React, Vue, Svelte, Solid) it is
96
+ `VITE_CRITIQS_PROJECT_ID`, in Next.js `NEXT_PUBLIC_CRITIQS_PROJECT_ID`, and
97
+ each framework's package README names its own; workspace apps get a name with
98
+ the app's suffix, such as `VITE_CRITIQS_PROJECT_ID_ADMIN`. A React app then
99
+ has `<Critiqs projectId={import.meta.env.VITE_CRITIQS_PROJECT_ID} requireProjectId />`.
100
+ The result's `env` names the variable and file, and the `Deployments` stage
101
+ says what to do: commit the code change but not the local `.env` file, and tell
102
+ the person to set the variable in the settings of each deployment that should
103
+ show Critiqs, leaving it unset where Critiqs shouldn't appear. A variable read
104
+ when the app is built needs a rebuild after it changes. Server frameworks
105
+ (Rails, Django, Flask) read it from the server's environment instead. Other
106
+ apps get the ID written into the code; commit it. The project ID is public
107
+ configuration, not a secret.
77
108
 
78
109
  Running init again is safe: it keeps the project the code names (a literal ID,
79
110
  or the variable's value in `.env` files), and after an interrupted run it
@@ -82,13 +113,13 @@ the person wants another project. Init never edits code that computes the ID,
82
113
  or a wrapper the person wrote; it prints what to set instead.
83
114
 
84
115
  If the person already has a project ID, connect it instead:
85
- `npx critiqs-react init <projectId>` (no sign-in needed). It sets the variable
86
- when the component reads one.
116
+ `npx critiqs init <projectId>` (no sign-in needed). It sets the variable
117
+ when Critiqs reads one.
87
118
 
88
119
  ## 3. Check the setup
89
120
 
90
121
  ```sh
91
- npx critiqs-react doctor --json
122
+ npx critiqs doctor --json
92
123
  ```
93
124
 
94
125
  `ok` is false when any check `fail`s. Each check has a `stage` (`code`,
@@ -101,29 +132,35 @@ ID, doctor checks the value in this computer's `.env` files against the
101
132
  backend; it can't see a deployment's build settings, and says so in the
102
133
  `Deployments` check.
103
134
  If setup used `--project-env-file`, pass the same file to doctor, for example
104
- `npx critiqs-react doctor --project-env-file config/.env.local --json` (or `envFile`
135
+ `npx critiqs doctor --project-env-file config/.env.local --json` (or `envFile`
105
136
  on `critiqs_doctor`). If the environment directory cannot be determined,
106
137
  doctor reports that uncertainty instead of saying the app is disabled.
107
138
 
108
- Once the prototype is deployed, record its address so mention emails link to
109
- it: `npx critiqs-react init --review-url https://<deployed address>`. Then ask
139
+ Once the prototype is deployed, record its address, including any path, so
140
+ mention emails from every copy open it:
141
+ `npx critiqs init --review-url https://<deployed address>`. Don't guess
142
+ it from a local, private, or Tailscale address; ask the person if unsure. Then ask
110
143
  the person to open the deployed prototype and leave a comment.
111
144
 
112
145
  ## 4. When something fails
113
146
 
114
147
  | Output | Do this |
115
148
  | --- | --- |
116
- | `Init didn't find where the app renders` | Find the file that renders the app's root and rerun with `--entry <file>` (and `--mount <Element>`), or add `<Critiqs />` there by hand and rerun init. |
149
+ | `Init didn't find where the app renders` | Find the file that renders the app's root and rerun with `--entry <file>` (and in React, `--mount <Element>`), or add Critiqs there by hand as the printed instructions say and rerun init. |
150
+ | `Setup didn't recognize this app's framework` | Check the app's folder (`--dir`) and that its `package.json`, `Gemfile`, or Python requirements list the framework. In a page without a build, use `<critiqs-app>` from `critiqs`. |
117
151
  | `Found several places the app could render Critiqs` | Ask which app this is; rerun with `--entry`, or in that app's folder. |
118
152
  | `is a workspace with … apps` | Ask which apps should have Critiqs; run the printed `--dir` command for each. |
119
153
  | `sets envDir in a way init can't follow` | Find the `.env.local` the app's Vite config loads and rerun with `--project-env-file <file>`, relative to the app. |
120
- | `sets envPrefix` | Give `<Critiqs />` `projectId={import.meta.env.<name with the app's prefix>} requireProjectId`, then rerun init. |
121
- | `Couldn't write .env.local` after the project was created | Add the printed `NAME=<project ID>` line to that file; the project and component already exist. |
154
+ | `sets envPrefix` | In this Vite app, give `<Critiqs />` `projectId={import.meta.env.<name with the app's prefix>} requireProjectId`, then rerun init. |
155
+ | `Couldn't write .env.local` after the project was created | Add the printed `NAME=<project ID>` line to that file; the project and the code change already exist. |
122
156
  | `uses Critiqs under another name` | Critiqs is already mounted there; set the printed properties on it by hand. |
157
+ | `already loads … in a way setup can't read` | Critiqs is already on the page another way (a namespace import, a re-export, `mountCritiqs`, or a router helper). Ask whether to keep it: set its project ID by hand, or remove it and rerun init. |
158
+ | `several … config files` | Ask which config file the app uses; remove the others, then rerun init. |
123
159
  | `sets projectId from code` | The code computes the ID (a wrapper or fallback); init leaves it alone. Put the printed ID where that code reads it, without making it secret. |
124
- | `doesn't support approving setup from another device yet` | Run init where a browser can open, using the chosen backend, or create the project in the matching prototype's Critiqs sidebar and update its existing component's projectId while keeping its backend. |
160
+ | `doesn't support approving setup from another device yet` | Run init where a browser can open, using the chosen backend, or create the project in the matching prototype's Critiqs sidebar, then run `npx critiqs init <projectId>`, which keeps its backend. |
125
161
  | `Setup was denied` or `The setup code expired` | Run init again; nothing was created. |
126
- | Source became unreadable or unwritable after approval | Keep the returned project ID and backend. Restore access, then apply the complete snippet at its indicated entry/mount, and the `.env` line it names. Update an existing component; do not use an ID-only command that would lose the selected backend. |
162
+ | `doesn't confirm its approval page names the backend`, `on its approval page, not`, `didn't say clearly which addresses`, or `didn't confirm it with the approval` | The sign-in service can't show, or didn't confirm, the backend the person would approve, so nothing was created. Tell the person; its operator deploys the current Critiqs backend. Don't retry with another backend without asking. |
163
+ | Source became unreadable or unwritable after approval | Keep the returned project ID and backend. Restore access, then apply the complete instructions it printed, at the file it names, and the `.env` line. Update an existing Critiqs setup; do not use an ID-only command that would lose the selected backend. |
127
164
  | `The code already uses project …` | Nothing changed. Use `--review-url` to set its address, or `--new-project` only if asked. |
128
165
  | `Critiqs Cloud isn't ready for this version` | The hosted backend is older than the package; tell the person. Don't switch backends without asking. |
129
166
 
@@ -135,11 +172,14 @@ configuration, with any keys in its environment rather than in tool calls:
135
172
  ```json
136
173
  {
137
174
  "mcpServers": {
138
- "critiqs": { "command": "npx", "args": ["critiqs-react", "mcp"] }
175
+ "critiqs": { "command": "npx", "args": ["critiqs", "mcp"] }
139
176
  }
140
177
  }
141
178
  ```
142
179
 
180
+ A configuration with `"args": ["critiqs-react", "mcp"]` keeps working: it runs
181
+ the same server.
182
+
143
183
  - `critiqs_setup_start` (`signIn`: `"auto"`, `"browser"`, or `"remote"`;
144
184
  `entry`, `mount`, `name`, `reviewUrl`, `newProject`, `dir`, `envFile`; `target`:
145
185
  `"cloud"` by default, `"own-convex"`, or an existing backend's URL). Returns
@@ -155,18 +195,20 @@ configuration, with any keys in its environment rather than in tool calls:
155
195
 
156
196
  These are separate from basic setup; skip them unless the person asks.
157
197
 
158
- - **Context:** `version`, `getContext`, and `restoreContext` properties record
159
- and restore the prototype's view state; see the package README.
160
- - **The team's own Convex deployment:** `npx critiqs-react init --own-convex`.
198
+ - **Context:** the `version`, `getContext`, and `restoreContext` settings
199
+ record and restore the prototype's view state; see the framework package's
200
+ README.
201
+ - **The team's own Convex deployment:** `npx critiqs init --own-convex`.
161
202
  It needs `CONVEX_DEPLOY_KEY`, a production deploy key the person sets in the
162
203
  environment themselves; `RESEND_API_KEY` and `CRITIQS_EMAIL_FROM` are
163
- optional and turn on mention emails. It also writes
164
- `backend="https://<deployment>.convex.cloud"`.
165
- - **Inside the app's own Node or Bun server:** `critiqs-react/server` runs
166
- Critiqs on SQLite; see the package README. Pass the mounted path as
167
- `backend` (for example `backend="/critiqs"`), create the project in the
168
- Critiqs sidebar, and write its ID with `npx critiqs-react init <projectId>`.
169
- `npx critiqs-react doctor --backend http://localhost:<port>/critiqs` checks it.
204
+ optional and turn on mention emails. It also sets Critiqs's backend setting
205
+ to `https://<deployment>.convex.cloud` in the code.
206
+ - **Inside the app's own Node or Bun server:** `critiqs/server` (also
207
+ `critiqs-react/server`) runs Critiqs on SQLite; see the `critiqs-react`
208
+ README. Set the mounted path as Critiqs's backend setting (for example
209
+ `/critiqs`), create the project in the
210
+ Critiqs sidebar, and write its ID with `npx critiqs init <projectId>`.
211
+ `npx critiqs doctor --backend http://localhost:<port>/critiqs` checks it.
170
212
  - **AI:** works without any setup in the host app. On the team's own Convex
171
213
  deployment, the person can set `CRITIQS_AI_ENCRYPTION_KEY` (32 or more random
172
214
  characters, such as from `openssl rand -base64 32`) with `npx convex env set
@@ -174,10 +216,100 @@ These are separate from basic setup; skip them unless the person asks.
174
216
  can connect a provider in the Critiqs sidebar. After upgrading a deployment
175
217
  that already has feedback, run `npx convex run tags:backfill` once.
176
218
 
219
+ ## 7. Reading feedback
220
+
221
+ To act on reviewers' feedback, read it with the MCP server's tools. They work
222
+ with Critiqs Cloud and Convex deployments, not yet with Critiqs inside the
223
+ app's own server.
224
+
225
+ 1. **Sign the computer in once.** The first reading call says the computer
226
+ isn't signed in. Call `critiqs_sign_in` (`signIn`: `"auto"`, `"browser"` to
227
+ also open the approval page on this computer, or `"remote"`; `backend` when
228
+ not on Critiqs Cloud). Give the person the address and code exactly, as in
229
+ setup, then call `critiqs_sign_in_finish` until it reports who signed in.
230
+ People can instead run `npx critiqs sign-in`. The sign-in is kept on the
231
+ computer, readable only by its user, and is reused by later sessions until
232
+ `critiqs_sign_out` (or `npx critiqs sign-out`), 30 days without use,
233
+ or 90 days. It is sent only to the backends it was approved for, and to
234
+ where each serves screenshots and page copies; the approval page names
235
+ them, and the person should check it does. Signing in for a backend other
236
+ than Critiqs Cloud needs a sign-in service that names it there (the
237
+ current Critiqs backend). Critiqs Cloud's older sign-in service names no
238
+ backend; then check only that the page's address is the one given. Never
239
+ ask for the code the person receives by email.
240
+ 2. **`critiqs_comments`** (`projectId`, required; `status`: `"open"` by
241
+ default, `"resolved"`, or `"all"`; `author`: a display name or an author ID;
242
+ `since` and `until`: a date such as `2026-10-01`, a date and time, or an age
243
+ such as `7d`; `tag`; `screen`; `text`; `limit`, 50 by default). Returns
244
+ matching threads, newest activity first, each with its whole discussion
245
+ and context: `context.target.purposeId` is the element's `data-critiqs-id`
246
+ in the code, with the screen, view state, record, scope, page address,
247
+ window size, demo persona, build revision, and `movedTo` when a thread was
248
+ reattached. With author, time, or text filters, a thread matches when any of
249
+ its messages does, and each message's `matches` says which. `truncated`
250
+ says when more matched than `limit`.
251
+ 3. **`critiqs_thread`** (`thread`: an ID or a Critiqs link) adds mentions,
252
+ reactions, who last resolved or reopened the thread and who moved it, its
253
+ screenshot's state, and, where the backend has tickets, `tickets`: each
254
+ Linear, GitHub Issues, or Jira ticket linked to it, with its key, title,
255
+ status (`lastKnown` when Critiqs can no longer check it), and address.
256
+ 4. **`critiqs_screenshot`** (`thread`; `file` to save it) returns what the
257
+ reviewer saw, with the commented element outlined. Images over 5 MB need
258
+ `file`.
259
+ 5. **`critiqs_reply`** (`thread`, `body`; `mention`: display names or author
260
+ IDs from `critiqs_thread`; `revision`, such as the commit) posts a reply as
261
+ the signed-in person, shown as "Name · via coding agent". Use it once the
262
+ work is done, to say what changed and ask the right people to check it.
263
+ Everyone else in the thread is emailed about it (unless they turned that
264
+ off); people you mention get a mention email. Write only what you actually
265
+ did and verified.
266
+ 6. **`critiqs_mockups`** (`projectId`, required; `screen`; `text` in the
267
+ title; `limit`, 50 by default) lists the project's mockups, most recently
268
+ changed first: proposed changes reviewers made with Critiqs AI on frozen
269
+ copies of a page. Each has the page it was made from (address, screen,
270
+ view state, build revision, demo persona), its version and thread counts,
271
+ its page copies' IDs and widths, and its mockup threads: each one's ID,
272
+ status, first message, author, and last activity. A mockup made in the
273
+ Mockup panel has one thread, whose first message says what it is for.
274
+ 7. **`critiqs_mockup`** (`mockup`, required; `version`, the latest by
275
+ default, or `0` for the original copies; `saveCopies`, a folder) returns
276
+ what to build. For each page copy, `edits` lists every change from the
277
+ original copy in order: CSS rules, text, attributes, and inserted,
278
+ replaced, or removed elements, each naming an element by its
279
+ `data-critiqs-node` number. A change's `original` is that element as the
280
+ copy has it: its start tag without the number, its text, and the nearest
281
+ `data-critiqs-id` (`purposeId`), to find the component in the code.
282
+ `original` is null with `addedByChange` when an earlier change in the list
283
+ added the element. It also returns the version history, the mockup
284
+ threads with their whole discussions (Critiqs AI's replies have
285
+ `via: "ai"`, `askedBy`, and the `mockupVersion` they saved), and the
286
+ linked feedback threads, which `critiqs_thread` reads in full. With
287
+ `saveCopies`, each copy's original HTML is written to
288
+ `<folder>/<mockupId>/<copyId>.html` and the version's changes to
289
+ `edits-v<N>.json` beside them. Build the change in the app's own
290
+ components; don't paste the copy's HTML.
291
+
292
+ | Message | What to do |
293
+ | --- | --- |
294
+ | `isn't signed in` or `sign-in ended` | Call `critiqs_sign_in` and have the person approve. |
295
+ | `isn't approved for the backend at` | Nothing was sent to that backend. Ask the person whether they trust it; only then call `critiqs_sign_in` with that `backend`, and have them check that the approval page names it. |
296
+ | `with screenshots and page copies from` | The sign-in was approved for other download addresses than the backend now uses. Nothing was sent. Ask the person whether they trust the new address; only then sign in again for that `backend`. |
297
+ | `doesn't use HTTPS` | Critiqs sends sign-ins over plain http only to this computer (`localhost`, `127.0.0.1`, or `[::1]`). Use the backend's HTTPS address. |
298
+ | `answered with a redirect` | Critiqs doesn't follow redirects with a sign-in, and sent it nowhere else. Use the backend's own address; tell the person if it keeps happening. |
299
+ | `doesn't confirm its approval page names the backend` | The sign-in service is older than the package, so its approval page can't show the backend. Tell the person; its operator deploys the current backend. |
300
+ | `on its approval page, not` | The sign-in service would show a different address than this backend, so the sign-in stopped. Tell the person; don't retry. |
301
+ | `didn't say clearly which addresses` or `didn't confirm it with the approval` | The sign-in service didn't confirm both addresses the page showed, so the computer kept nothing. Tell the person; its operator deploys the current Critiqs backend. |
302
+ | `people are named` | Use one of the listed author IDs. |
303
+ | `No one named … has commented in this project` | Mention only people who have commented there, by the names or author IDs `critiqs_thread` shows. |
304
+ | `can't post agent replies yet` | The backend is older than the package; tell the person. Its operator deploys the current backend. |
305
+ | `has no mockups yet` | The backend is older than the package; tell the person. Its operator deploys the current backend. |
306
+ | `runs an older version that can't keep this computer signed in` | The backend is older than the package; tell the person. Its operator deploys the current backend. |
307
+ | `didn't confirm signing out` | The computer is still signed in; try again when the backend is reachable. |
308
+
177
309
  ## What not to do
178
310
 
179
- - Don't add a second `<Critiqs />`, or wrap the app in Critiqs providers or
180
- `"use client"` boundaries; the package handles its own.
311
+ - Don't add a second Critiqs component or tag, or wrap the app in Critiqs
312
+ providers or `"use client"` boundaries; the package handles its own.
181
313
  - Don't put keys in source files, tool arguments, the conversation, or the
182
314
  prototype's browser code or build settings: AI and email keys belong on the
183
315
  backend only.
@@ -185,6 +317,6 @@ These are separate from basic setup; skip them unless the person asks.
185
317
  which feedback a copy (local, preview, deployed) shows; a preview never
186
318
  changes the project's review address unless someone runs `--review-url` for
187
319
  it.
188
- - Don't commit `.env.local`, copy one app's project ID into another app's
320
+ - Don't commit the local `.env` file (such as `.env.local`), copy one app's project ID into another app's
189
321
  variable, or set one generic `VITE_CRITIQS_PROJECT_ID` for a build that
190
322
  builds several apps.