Skip to content

Commit 18d8f0f

Browse files
jherrcursoragent
andauthored
feat(core,api,ui-react)!: ship the document state acceptance suite (XState parallel approval passes on all three stores); Mermaid from a strategy's graph; the review queue follows the strategy (4c) (#36) (#36)
Chain step 13 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>
1 parent 2b1aee0 commit 18d8f0f

35 files changed

Lines changed: 2315 additions & 747 deletions
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@tanstack/cms-core': minor
3+
---
4+
5+
The document state strategy acceptance suite ships as `@tanstack/cms-core/document-state/acceptance`: `runDocumentStateAcceptance(name, { database, strategies }, runner)` runs the parallel-approval spec (eleven steps plus core's rules) with an injected test runner and strategies, and the built-in SQLite, libsql and Postgres storages all run it. The XState parallel-approval example in the new "Custom Document State Strategies" docs page passes it. New exports: `stateGraphToMermaid(graph)` (a Mermaid chart of a strategy's `describe()`; the review-queue docs embed the default strategy's) and, from `@tanstack/cms-core/server`, `readChangeSet(collection, id)` (the open change set as its strategy reads it).
6+
7+
Breaking changes:
8+
9+
- Core no longer asks the strategy about a stranded change set. Every action on it except `discard` is refused (`rule: 'stranded'`), and core runs the `discard` itself for a reviewer (`review.decide`, not an agent); a strategy's emits on that discard no longer run. `availableDocumentActions` offers reviewers only **Discard change set** on it, and `documentStateLabel` reads `Stranded`.
10+
- An audit entry's `to` records the state a closing decision returned (for example the final approval's `published`); it was always `null` once the change set closed.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@tanstack/cms-api': minor
3+
'@tanstack/cms-ui-react': minor
4+
---
5+
6+
The review queue follows each collection's document state strategy. `reviewSnapshot` items carry `review: { label, actions, stranded? }` (type `ChangeSetReview`: the strategy's state label and the actions it offers the caller), and the new `actOnChange({ id, action, publishAt?, reason?, expectedVersion? })` operation (also a `createServerFn` in `@tanstack/cms-api/start`) runs any offered action that doesn't carry a document, such as a custom sign-off, `schedule` or `discard`. The `/review` page shows the label, renders buttons from the offered actions (Approve and Reject only when the strategy offers them), lets reviewers set or clear a change set's publish time, and lists stranded change sets with a **Discard change set** button.
7+
8+
Behavior change: `reviewSnapshot` now also lists stranded drafts (a stranded change set has to be discarded from the queue), and the Approve and Reject buttons follow the strategy's offered actions instead of the caller's `review.decide` permission alone.

‎docs/agents/ai-images.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Media & AI Images
33
id: ai-images
4-
order: 4
4+
order: 5
55
description: "Upload, browse, and render images in TanStack CMS, and generate or edit them with an app-supplied @tanstack/ai image adapter."
66
keywords:
77
- tanstack cms

0 commit comments

Comments
 (0)