You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5c474b0
Browse filesBrowse the repository at this point in the historyBrowse files
Chain step 14 of the linear merge chain onto main 3b4a112: this PR's own changes, resolved against the PRs before it in the merge order.
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
The default document state strategy is now Draft → Pending Review → Approved → Published. A reviewer who holds `review.decide` but not `content.publish` approves a staged change into the new `approved` state (audited as `transitioned`, emitting `review.approved`) without touching the live document; a publisher's `publish` action then applies it (an approved deletion needs `content.delete`), or the scheduler publishes it at its `publishAt`. A reviewer who can publish still approves and publishes in one decision, so apps whose reviewers can publish behave as before. A new submission sends an approved change back to Pending Review. `approveChange` accepts reviewers without `content.publish` (the strategy decides, and core re-checks access for anything that writes live content), and the review page shows them a single **Approve** button and publishers a **Publish** button on approved changes.
8
+
9
+
Breaking changes:
10
+
11
+
- The default strategy's labels are `Pending Review` (was `Pending review`) and the new `Approved`; `ReviewState` gains `'approved'`.
12
+
-`approveChange` by a reviewer without `content.publish` used to fail with `FORBIDDEN`; it now moves the change to Approved.
13
+
- A scheduled or manual publish of an approved change set no longer emits a second `review.approved` (it was emitted at approval).
14
+
-`directStrategy().describe()` charts only its own states (Unpublished, Published, Draft); `reviewStrategy().describe()` adds Approved.
Copy file name to clipboardExpand all lines: app/prm/README.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,7 @@ Built for individuals, small teams, and families — ideal for running on a home
8
8
9
9
-**Self-contained instance data directory (`PRM_DATA_DIR`)** — stores configuration (`prm.json`), secrets (`secrets.env`), SQLite database (`cms.db`), uploaded photos (`uploads/`), and snapshots (`backups/`) in one directory outside the repo.
10
10
-**Multi-user DB authentication** — first-run `/setup` creates the `owner` account; invite family or teammates via one-time `/invite/$token` links from `/prm-settings`.
11
+
-**Owner direct, agent review** — the PRM's document state strategy, `ownerDirectAgentReview` in `src/document-state.ts`: people who may publish (owners, members) commit their own saves, and agent and import writes go through review.
11
12
-**Optional approval workflow (off by default)** — `approvalRequired: false` auto-approves agent and import writes while preserving full revision and audit history; flip it on in `/prm-settings` to stage changes into `/review`.
12
13
-**Groups & Events** — organize people into recurring circles (`TanStack`, `Creators`, `Founders`, `Oak St & School Parents`) or time-bounded events (`Timmy's Birthday Party`, `AI Coding Summit 2026`) with start/end times, location, per-event roles/talks, and a talked-with progress bar.
13
14
-**Rich person profiles** — multiple names (`aliases` / AKAs), `pronouns`, human-only personal contact fields (`phone`, `email`, `birthday`, `address`), per-field provenance (`personSource`), and deep-snoop enrichment.
Copy file name to clipboardExpand all lines: docs/agents/review-queue.md
+24-6Lines changed: 24 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,9 @@ TanStack CMS has one workflow for every kind of change, whether a person or an a
20
20
21
21
-**Unpublished documents** are saved directly by anyone who may publish.
22
22
-**Published documents** get a **draft**: the live version stays as it is until someone publishes the changes.
23
-
-**Authors and agents** never commit. Their changes are **staged** in the review queue at `/review`, where an editor approves or rejects them.
23
+
-**Authors and agents** never commit. Their changes are **staged** in the review queue at `/review`, where a reviewer approves or rejects them.
24
+
25
+
A change moves through the default flow's states: **Draft** (a publisher's private working copy), **Pending Review** (a staged proposal), **Approved** (a reviewer approved it; it waits for a publisher) and **Published**. A reviewer who may also publish approves and publishes in one step, so **Approved** only appears when reviewing and publishing are separate roles.
24
26
25
27
Every commit records a **revision**, and every decision (a direct save, an approval, a rejection, a discarded draft, a scheduled publish, an import) lands in the **audit trail**.
26
28
@@ -84,7 +86,7 @@ Agents can read their own staged work. `read_document` and `update_document` fal
84
86
85
87
The `/review` page lists pending changes with a field-level diff, the proposer, and any instruction note the agent attached. Deletions are highlighted in red and list the fields that will be removed.
86
88
87
-
Anyone with `content.read` can view the queue (limited to collections they may read, with unreadable fields redacted). Deciding requires `review.decide`, plus the right to publish (or, for deletions, delete) in that collection:
89
+
Anyone with `content.read` can view the queue (limited to collections they may read, with unreadable fields redacted). Deciding requires `review.decide`. A reviewer who may also publish (or, for deletions, delete) in that collection applies the change as they approve it:
88
90
89
91
-**Approve & publish** commits the change and publishes it. For a proposal that already sets `published: true`, the document goes live as proposed.
90
92
-**Approve as draft** (offered for proposals that don't publish) commits the content with `published: false`.
@@ -93,7 +95,18 @@ Anyone with `content.read` can view the queue (limited to collections they may r
93
95
94
96
The audit entry records both parties, for example `mcp (approved by Jane Doe)`. The underlying operations are `approveChange({ id, publish?, force? })` and `rejectChange({ id })`.
95
97
96
-
Each pending change also shows its strategy's label for the document's state (for example **Pending review**, or a custom strategy's **Changes requested**), and its buttons are the actions the strategy offers you, so a custom strategy's actions (such as **Approve (legal)**) appear next to Approve and Reject. When the strategy offers `schedule`, a **Publish at** field sets or clears the change set's publish time, and a **Publishes …** badge shows it. These buttons call `actOnChange({ id, action, publishAt?, reason?, expectedVersion? })`, which runs the action through the strategy and refuses one it doesn't offer you.
98
+
A reviewer without `content.publish` sees **Approve** instead. It moves the change to **Approved** (audited as `transitioned`, with a `review.approved` event) and leaves the live document as it is. A publisher then sees **Publish**, which applies the approved change and publishes it (on a published document they can also schedule it with **Publish at**); a new submission sends it back to **Pending Review**. For example, a `reviewer` role that approves but can't publish:
99
+
100
+
```ts
101
+
defineCms({
102
+
roles: {
103
+
reviewer: ['content.read', 'review.decide'],
104
+
},
105
+
// ...
106
+
})
107
+
```
108
+
109
+
Each pending change also shows its strategy's label for the document's state (for example **Pending Review** or **Approved**, or a custom strategy's **Changes requested**), and its buttons are the actions the strategy offers you, so a custom strategy's actions (such as **Approve (legal)**) appear next to Approve and Reject. When the strategy offers `schedule`, a **Publish at** field sets or clears the change set's publish time, and a **Publishes …** badge shows it. These buttons call `actOnChange({ id, action, publishAt?, reason?, expectedVersion? })`, which runs the action through the strategy and refuses one it doesn't offer you.
97
110
98
111
A pending change remembers the revision of the live document it was proposed against. When someone commits a new live revision while it is open:
99
112
@@ -119,21 +132,26 @@ defineCms({
119
132
})
120
133
```
121
134
122
-
The built-in strategies' states and actions, generated from `reviewStrategy().describe()` with `stateGraphToMermaid`:
135
+
The default strategy's states and actions, generated from `reviewStrategy().describe()` with `stateGraphToMermaid`:
Copy file name to clipboardExpand all lines: docs/api/routes-and-endpoints.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -250,7 +250,7 @@ Every operation is also a TanStack Start server function in [`@tanstack/cms-api/
250
250
|`deleteDoc`| POST |`content.delete`|`{ collection, id, force? }`|`{ ok }`|
251
251
|`bulkDocuments`| POST |`content.write`|`{ collection, ids (1–100), action: 'publish' \| 'unpublish' \| 'delete' }`|`{ ok, results: [{ id, ok, error?: { code, message } }] }`. `delete` also needs `content.delete`; `publish` and `unpublish` need publish rights. One failed item doesn't stop the rest. |
252
252
|`reviewSnapshot`| GET |`content.read`|`{}`|`{ pending, audit }`. Each pending change carries `review: { label, actions, stranded? }` from its strategy, for the caller. Drafts are excluded unless stranded. |
253
-
|`approveChange`| POST |`review.decide`|`{ id, publish?, force? }`| The approved pending change. `CONFLICT` when the document changed since the proposal was staged, unless `force` is set. |
253
+
|`approveChange`| POST |`review.decide`|`{ id, publish?, force? }`| The approved pending change. A reviewer without `content.publish` moves it to **Approved** for a publisher to publish. `CONFLICT` when the document changed since the proposal was staged, unless `force` is set. |
254
254
|`rejectChange`| POST |`review.decide`|`{ id }`| The rejected pending change. |
255
255
|`actOnChange`| POST |`content.read`|`{ id, action, publishAt?: string \| null, reason?, expectedVersion? }`|`{ ok, effects, label }`. Runs only an action the change set's strategy offers the caller now (`FORBIDDEN` otherwise); actions that carry a document (`edit`, `submit`, `draft`, `import`) are `BAD_REQUEST`. `CONFLICT` when `expectedVersion` is stale. |
256
256
|`proposeEdit`| POST |`agent.use`|`{ collection, id, instruction, current }`| The AI-proposed document (not saved). |
0 commit comments