Skip to content

feat(phase2): wiki-as-SoT parallel sync scaffold#21

Merged
stackbilt-admin merged 3 commits into
mainfrom
feat/phase2-wiki-sync-scaffold
May 2, 2026
Merged

feat(phase2): wiki-as-SoT parallel sync scaffold#21
stackbilt-admin merged 3 commits into
mainfrom
feat/phase2-wiki-sync-scaffold

Conversation

@stackbilt-admin
Copy link
Copy Markdown
Member

Summary

Phase 2 of the wiki-as-docs-SoT migration (AEGIS wiki slug wiki-as-docs-sot-migration). Adds a parallel sync that reads from AEGIS wiki and writes to src/content/docs/. Runs alongside legacy docs-sync.sh — does not replace it. Output uses a -from-wiki suffix so POC pages render at /mcp-from-wiki/ for side-by-side comparison with the existing /mcp/.

What's in this PR

File Purpose
src/content/config.ts Adds optional lastVerified + sourceSlug to the docs collection schema. Surfaces wiki metadata for "Verified <date>" stamps + back-links.
scripts/wiki-publish-manifest.json New manifest v4 — slug → Astro page metadata. Phase 2 ships one entry: mcp-gateway-architecturemcp-from-wiki.md.
scripts/docs-sync-from-wiki.sh Bash sync. Reads $AEGIS_BASE/api/wiki/:slug (auth: Bearer $AEGIS_TOKEN); parses wiki_read shape; builds Astro frontmatter from wiki metadata + manifest cosmetics; hashes for idempotence; writes to src/content/docs/<page>.
src/content/docs/mcp-from-wiki.md POC page hand-generated from the wiki source (verbatim copy of mcp-gateway-architecture body, captured 2026-05-02 via wiki_read_page MCP tool). Validates the round-trip end-to-end.

Round-trip verification

Astro build: 9 → 10 pages, new /mcp-from-wiki/index.html rendered cleanly. Pre-commit hook passed on both commits.

The POC page renders alongside the legacy /mcp page (sourced from stackbilt-web/docs/mcp.md via the existing docs-sync.sh). Side-by-side after deploy:

  • https://docs.stackbilt.dev/mcp ← legacy gh-API path
  • https://docs.stackbilt.dev/mcp-from-wiki ← new wiki path

Same content (the upstream stackbilt-web/docs/mcp.md is itself derived from the same wiki page, so they're expected to match). The comparison is the format: does the wiki round-trip produce the same rendered page that the gh-API path produces?

Dependency

The script can't run end-to-end yet — aegis.stackbilt.dev/api/wiki/:slug returns 404 today. AEGIS only exposes wiki via MCP. Filed Stackbilt-dev/aegis#582 for a public HTTP wiki proxy endpoint. Once that lands, docs-sync-from-wiki.sh becomes functional and the POC file regenerates from the script instead of being hand-maintained.

What's NOT in this PR (per migration plan)

  • Phase 3 (first migration of mcp-gateway-architecture to replace the legacy /mcp source) — held until script is functional
  • Phase 4 (migrate remaining pages) — per-page PRs after Phase 3
  • Phase 5 (per-repo CI hooks) — opt-in per repo
  • Phase 6 (retire legacy sync) — final cleanup

Test plan

  • npm run build produces 10 pages including /mcp-from-wiki/index.html
  • Pre-commit hook passes (Astro build) on both commits
  • Schema accepts lastVerified and sourceSlug without validation errors
  • After deploy: visit https://docs.stackbilt.dev/mcp-from-wiki and compare against https://docs.stackbilt.dev/mcp — content parity expected
  • After Stackbilt-dev/aegis#582 lands: run AEGIS_TOKEN=... ./scripts/docs-sync-from-wiki.sh --dry-run and verify it reports 0 changes (idempotent) when local matches wiki

Migration phase status

# Status
0 — sync bug fix (docs#19) ✅ landed 2863efd3
1 — marker + audit ✅ AEGIS wiki page
2 — parallel sync script THIS PR
3 — first migration Blocked on aegis#582
4–6 Future

🤖 Generated with Claude Code

Kurt Overmier and others added 3 commits May 2, 2026 11:05
The sed range pattern '/^---$/,/^---$/p' restarts after termination,
capturing every '^---$' pair in the file. Files with markdown HR
separators in the body (api-reference.md upstream has 65) had their
content doubled on each sync, then re-doubled on the next.

Replaced with an awk single-state-machine: increments n on each ---,
prints the line, exits at the second ---; in between, prints body
lines. Idempotent for files with body HR separators; behavior
unchanged for files without (mcp.md, platform.md, etc.).

Verified by re-running the sync after the fix:
  Sync complete: 0 updated, 4 unchanged, 0 failed
api-reference.md stays at 1861 lines (was doubling to 2906 with the
sed pattern). Closes #19.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Phase 2 of wiki-as-docs-sot-migration. Adds the parallel sync path
that reads from AEGIS wiki and writes to src/content/docs/. Runs
alongside legacy docs-sync.sh — does not replace it. Output uses
a -from-wiki suffix so the POC pages route at /mcp-from-wiki/ for
side-by-side comparison with the legacy /mcp/ rendering.

- src/content/config.ts — add optional lastVerified + sourceSlug
  fields on the docs collection schema. Surfaces the wiki page's
  verification date and source slug for "Verified <date>" stamps
  and back-links to the AEGIS wiki source.
- scripts/wiki-publish-manifest.json — new manifest schema (v4)
  mapping wiki slugs → Astro page metadata (section/order/color/tag).
  Phase 2 ships with one entry as POC: mcp-gateway-architecture.
- scripts/docs-sync-from-wiki.sh — bash sync script. Reads from
  AEGIS HTTP API at $AEGIS_BASE/api/wiki/:slug (auth: bearer
  $AEGIS_TOKEN), parses wiki_read_page response, builds Astro
  frontmatter from wiki metadata + manifest cosmetics, hashes
  for idempotence, writes to src/content/docs/<page>.

Dependency: the script needs a public HTTP wiki proxy on
aegis-daemon (filed as Stackbilt-dev/aegis#582). Until that
endpoint lands, the script will exit non-zero with a 404 from
AEGIS — the POC page in src/content/docs/mcp-from-wiki.md is
hand-generated for now to validate the round-trip.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Round-trip validation artifact for the wiki-as-SoT migration.
Content is a verbatim copy of the AEGIS wiki page
mcp-gateway-architecture (revision MToyMDI2... captured 2026-05-02
via wiki_read_page MCP tool); frontmatter built per the new
docs-sync-from-wiki.sh script's pattern (manifest cosmetics +
wiki lastVerified + wiki sourceSlug).

Routes at /mcp-from-wiki for side-by-side comparison with the
existing /mcp page (legacy gh-API sync of stackbilt-web/docs/mcp.md).

Once Stackbilt-dev/aegis#582 lands the AEGIS HTTP wiki proxy,
docs-sync-from-wiki.sh will regenerate this file automatically and
the round-trip becomes script-driven instead of hand-generated.

Astro build: 9 → 10 pages, /mcp-from-wiki/index.html added.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@stackbilt-admin stackbilt-admin merged commit 8f35667 into main May 2, 2026
1 check passed
@stackbilt-admin stackbilt-admin deleted the feat/phase2-wiki-sync-scaffold branch May 2, 2026 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant