diff --git a/api/index.md b/api/index.md index 5b5f624..b3f54ee 100644 --- a/api/index.md +++ b/api/index.md @@ -84,6 +84,13 @@ releases_require_versioning`. | `GET /api/pages/:id/releases/:version` | The frozen copy: `html`, `headings`, `tags`, `relations`, `metadata` (auto fields resolve to the release's author and date), `classification`, and a `release` object with the entry above plus `current`, the living page's version. | | `GET /media//?release=` | An attachment as it was frozen with that release. | +A page on `main` without a `version` in a versioned space counts as `0.1.0`. `GET /api/pages/:id` and `GET /api/pages/:id/review` then return +`version: "0.1.0"` with `implicitVersion: true`. `GET /api/pages/:id/versions` +lists a synthetic entry with `implicit: true` (no diff — it is today's state). +Its first release bumps from 0.1.0 and also records 0.1.0 as a real entry pointing at `main` before the merge, so the +original state can be compared from then on. A draft-only page has no +version; its first release gives `0.1.0`, or `1.0.0` with `bump: "major"`. + Both `releases` routes need read access only, and `404` stays ambiguous. The MCP tool `read_page` takes an optional `version` to read a frozen copy. diff --git a/architecture/index.md b/architecture/index.md index 44a6a62..ea24bb3 100644 --- a/architecture/index.md +++ b/architecture/index.md @@ -45,6 +45,21 @@ and permissions exclusively through the API's HTTP surface. | `packages/design-tokens` | The catalog of design tokens that drives the look and feel — see [[web-frontend]]. | | `packages/git-provider` | One interface, two implementations (Forgejo, GitHub): read/write files, commits, branches, pull requests, reviews. | +## Page versions in Git + +In a versioned space, each approval writes `version` and a `changelog` entry +into the page's frontmatter, in a commit on the draft branch just before the +merge. Both fields are system-managed. Postgres holds `page_versions`, the map +from version to Git state for the version list and the diff; a reindex +rebuilds it by walking the file's history. + +A page on `main` without `version` counts as 0.1.0, and its first approval +bumps from there; a new page's first approval gives 0.1.0, or 1.0.0 as major. +For the existing page, that approval also writes a 0.1.0 changelog entry with `ref: `, the `main` +commit before the merge. Releases are merge commits, so the commit before the +version commit is the draft, not the old `main`; `ref` lets the reindex find +the 0.1.0 state from Git alone. + ## Release archive in Git Releasing a page in a versioned space can freeze it: in the same commit as