mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-08 21:15:18 +09:00
## Summary - make the MCP page generator render the CLI package version directly in the page title - publish `Webstudio MCP v<release>` from the exact generated page in each successful release - merge each successful release tag into the publication-only `docs` branch - serialize publication and ignore reruns or older release tags already contained in `docs` ## Root cause The first publication design advanced `docs` to the release commit without putting the CLI package version into the generated page. The repository uses `0.0.0-webstudio-version` until release time, so the release workflow now replaces that existing version placeholder with the successful tag version before publishing. ## Todo - [x] Generate the CLI version in the MCP page title. - [x] Publish the generated page from the exact release revision. - [x] Make publication idempotent and prevent version downgrades. - [x] Validate generation, formatting, linting, and release-branch behavior. - [ ] Merge this pull request. - [ ] Publish `0.285.0` as the initial version on the existing `docs` branch. ## Verification - `pnpm docs:mcp:test` - `pnpm docs:mcp:typecheck` - `pnpm check:generated-docs` - `pnpm lint` - `pnpm oxfmt --check` - `git diff --check` - isolated Git simulation for release merge, exact generated-page selection, version replacement, and rerun detection - regression tests demonstrated failing without version rendering and validation, then passing after restoration Ref #5986
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
import { renderMcpDocumentation } from "./generate-mcp-docs.js";
|
|
|
|
test("renders GitBook metadata around the complete CLI manual", () => {
|
|
const generated = renderMcpDocumentation(
|
|
"# Webstudio MCP Manual\n\n## Startup\n\nStart here.\n",
|
|
"1.2.3"
|
|
);
|
|
|
|
assert.match(generated, /^---\n/);
|
|
assert.match(generated, /# Webstudio MCP v1\.2\.3\n/);
|
|
assert.match(
|
|
generated,
|
|
/GitBook publishes it when that revision is successfully released/
|
|
);
|
|
assert.match(
|
|
generated,
|
|
/See \[CLI\]\(cli\.md\) for Node\.js and\s+`npx` setup/
|
|
);
|
|
assert.match(generated, /## Startup\n\nStart here\./);
|
|
assert.match(generated, /## Related\n/);
|
|
assert.equal(generated.includes("# Webstudio MCP Manual"), false);
|
|
});
|
|
|
|
test("rejects an unexpected CLI manual", () => {
|
|
assert.throws(
|
|
() => renderMcpDocumentation("# Different manual", "1.2.3"),
|
|
/Expected the CLI manual/
|
|
);
|
|
});
|
|
|
|
test("rejects a missing CLI version", () => {
|
|
assert.throws(
|
|
() => renderMcpDocumentation("# Webstudio MCP Manual\n\nBody", ""),
|
|
/Expected a CLI version/
|
|
);
|
|
});
|