Astro v7 static site migration, WordPress and HTML source contract extraction, Content Layer collection scaffolding, offline official documentation search, and post-build dist/ SEO parity verification for coding agents.
Install or update legends-astro via cto-legends (https://github.com/avalonreset/cto-legends): run `cto-legends install legends-astro --apply`, then `cto-legends handoff legends-astro` and follow the returned JSON recipe to verify `legends-astro`.
Prompting an unguided coding agent to "convert our WordPress, Next.js, or HTML site to Astro" routinely breaks search equity and client interactivity in predictable ways:
- Outdated Astro v4/v5 Content Collections syntax: Frontier models default to stale training patterns (
src/content/config.ts,type: 'content', andentry.slug) that fail in Astro v7 Content Layer builds (src/content.config.ts,glob()fromastro/loaders,zfromastro/zod, andentry.id). - Silent route-shape drift and dropped SEO metadata: Casual component rewrites alter trailing slashes (
/page.htmlvs/page/index.html), drop<link rel="canonical">or JSON-LD@typeschema blocks, and delete DOMidattributes referenced by client-side JavaScript (getElementById,querySelector). - Production draft leaks and reordered first-paint styles: Static path builders omit
draft !== truefilters so unpublished articles ship to production, while inline critical<style data-first-paint>blocks get moved below blocking scripts in<head>.
legends-astro gives your coding agent a contract-locked migration and post-build parity workflow. Before writing a component, source-audit extracts a deterministic migration-contract.json from your legacy HTML tree, WordPress WXR .xml or REST .json export, or legends-firecrawl capture. After astro build, verify-build audits the compiled dist/ directory against that contract and blocks release if any route, meta tag, JSON-LD block, or JavaScript DOM selector went missing.
Once cto-legends is installed, you ask your coding agent in plain english. It inspects your Node and Astro runtime, locks the source migration contract first, previews Content Layer scaffolding before touching disk, and verifies dist/ after building:
When migrating from legacy HTML directories, WordPress WXR .xml exports, WordPress REST .json dumps, or legends-firecrawl .json captures, legends-astro separates read-only discovery from guarded project scaffolding:
- Deterministic pre-migration contract (
migration-contract.json):source-auditrecords every published route and URL shape (file,directory,clean,root), recommendedbuild.formatandtrailingSlashsettings,<title>,<meta name="description">, canonical link, OpenGraph, Twitter Card, JSON-LD@typeblocks, and every DOMidcross-referenced against.jsselector queries. - Preview-first Astro v7 Content Layer generation (
ingest): Runningingestdefaults to a read-only preview that computesplannedFilesand aplanSha256digest. Passing--apply --confirm-plan <planSha256>writessrc/content.config.ts(glob()+astro/zod),src/lib/published.ts(draft !== truefilter), converted Markdown pages (src/content/pages/*.md), and legacy route aliases inpublic/_redirectswith CWE-59 symlink refusal and CWE-776 XML entity rejection.
Every subcommand runs locally with zero mandatory Python third-party dependencies and never imports or executes untrusted consumer astro.config.* files during inspection:
| Surface | legends-astro Subcommand |
What It Does |
|---|---|---|
| Runtime & Config Readiness | doctor |
Checks Node runtime (>=22.12.0 / >=22.23.4, LTS 24.15.0 tested), global astro PATH collisions with Astronomer Airflow CLI, lockfile consistency (npm, pnpm, yarn, bun), vendored docs SHA-256 hashes, and Astro v7 traps (src/content/config.ts, prerender = false). |
| Pre-Migration Contract Lock | source-audit |
Parses legacy HTML folders/files, WordPress WXR .xml, WP REST .json, or legends-firecrawl .json into migration-contract.json with route shapes, SEO tags, JSON-LD, client-JS DOM IDs, and converted Markdown. |
| Content Layer Scaffolding | ingest |
Previews (planSha256) and scaffolds src/content.config.ts, src/lib/published.ts, clean Markdown entries, public/_redirects, and migration-contract.json. |
| Post-Build Parity Gate | verify-build |
Audits built dist/ HTML against migration-contract.json and src/content/ for 1:1 route survival, zero draft: true leaks, preserved <title>/description/JSON-LD, required client-JS DOM IDs, first-paint <head> CSS order, and valid internal links/assets. |
| Offline Official Astro Docs | docs-lookup |
Searches 24 SHA-256-verified withastro/docs MDX guides and 9 wiki/ runbooks offline, plus verified upstream endpoints (registry.npmjs.org, api.github.com) when --live-locations or --check-live is passed. |
| Vault Pack & Resource Paths | knowledge-pack, resources |
Verifies the 10-file knowledge/astro/pack.json (legends.knowledge-pack/v1) for attachment into legends-empire and resolves packaged resource paths across source checkouts and wheel installs. |
- 24 vendored
withastro/docsMDX guides + 9 operational runbooks: Verified by SHA-256 againstvendor/astro-docs/manifest.json(withastro/docscommit0844aab04ea2f3859132ab97b1e9daa01ade76a1). Becausehttps://docs.astro.build/llms.txtand/llms-full.txtreturn HTTP 404 upstream,legends-astro docs-lookupgives your agent instant, deterministic offline search across Content Layer, routing, WordPress/Next.js migration, and upgrade guides. - Attachable Empire vault pack (
knowledge/astro/pack.json): Ships 9 engineering runbooks (wiki/) andtemplates/migration-receipt.mdready to attach into alegends-empireMarkdown knowledge vault.
# 1. Check local Node runtime, vendored docs checksums, and target Astro project readiness
legends-astro doctor --project /path/to/astro-site --json
# 2. Extract routes, SEO metadata, JSON-LD, client-JS DOM IDs, and Markdown from legacy source
legends-astro source-audit --source /path/to/wp-export.xml --output migration-contract.json
# 3. Preview Astro v7 Content Layer scaffolding (read-only by default; pass --apply --confirm-plan <sha256> to write)
legends-astro ingest --source /path/to/wp-export.xml --output /path/to/astro-site
legends-astro ingest --source /path/to/wp-export.xml --output /path/to/astro-site --apply --confirm-plan <planSha256>
# 4. After running project-local astro check && astro build, verify dist/ against the contract
legends-astro verify-build --dist /path/to/astro-site/dist --project /path/to/astro-site --contract migration-contract.json
# 5. Search the 24 vendored Astro v7 guides and 9 runbooks offline
legends-astro docs-lookup "astro content collections"
legends-astro docs-lookup "wordpress to astro" --live-locationsKnowledge vault runbooks and legends-empire attachment (knowledge-pack)
Start at wiki/index.md or attach the versioned knowledge pack at knowledge/astro/pack.json (legends.knowledge-pack/v1):
- Wiki index and Inspect setup and runtime
- Pages, components, styles, and scripts
- Content collections (
src/content.config.ts) - Migrate HTML, WordPress, and Next.js
- Performance, headers, and caching
- Diagnose and upgrade Astro v7 and Latest docs and ecosystem lookup
- Source ledger, Migration receipt template, and Empire attachment guide
legends-astro knowledge-pack --check --json
legends-astro resources --json
cto-legends run legends-empire -- knowledge attach /path/to/legends-astro/knowledge/astro/pack.json --vault /path/to/vault --operation-id op-astro-001 --generated-at 2026-10-24T00:00:00ZAgent setup (via cto-legends) and standalone installation
Part of cto-legends. The central router skill is vendored at skills/cto-legends/SKILL.md; this module is not a separate registered skill and does not require an ambient MCP daemon. legends-astro replaces the legacy legends-astro-kit identifier while retaining legends-astro-kit as a compatibility alias in cto-legends.
Run cto-legends handoff legends-astro and read the returned installed recipe and task-readiness checks (docs/AGENT-RECIPE.md). If the module is missing, preview setup with cto-legends install legends-astro, perform the authorized setup, then repeat the handoff.
cto-legends handoff legends-astro
cto-legends run legends-astro -- doctor --jsonDirect installation from source (Python 3.11+ and Node.js 22.12.0+, LTS 24.15.0 tested):
git clone https://github.com/avalonreset/legends-astro.git
cd legends-astro
python -m pip install .
legends-astro doctor --jsonRepository layout, verification, and scope limits
Agent / CLI (`legends-astro`)
-> Static runtime & trap inspection (`doctor`, `scripts/doctor.mjs`, zero config execution)
-> Pre-migration contract extraction (`source-audit` -> `migration-contract.json`)
-> Preview-first Content Layer scaffolding (`ingest` -> `src/content.config.ts` + `_redirects`)
-> Post-build 1:1 parity gate (`verify-build` against `dist/` and `migration-contract.json`)
legends_astro/: Python CLI (cli.py), source auditor and parity verifier (auditor.py), and offline documentation indexer (docs_nav.py).scripts/: Node readiness inspector (doctor.mjs), vendored docs SHA-256 verifier (verify-sources.mjs), SVG card renderer (render_cards.py), and release gates (check_release.py).vendor/astro-docs/&knowledge/astro/: 24 SHA-256-pinnedwithastro/docsMDX guides and attachablelegends.knowledge-pack/v1runbooks.
python -m unittest discover -s tests -v
node ./scripts/verify-sources.mjs
node ./scripts/test-doctor.mjs
python scripts/check_release.pyThis module does not deploy sites to hosting providers, run a live browser crawler, or execute untrusted consumer astro.config.* files. Pair with legends-firecrawl for live site scraping and legends-cloudflare, legends-coolify, or legends-hetzner for infrastructure and DNS cutover. This is an independent community project built around official Astro documentation and CLI workflows and is not affiliated with or endorsed by the Astro project.
See compatibility and verification, contributing, code of conduct, security, support, and attribution.
MIT License. See LICENSE and THIRD_PARTY_NOTICES.md. Vendored withastro/docs files in vendor/astro-docs/ are MIT licensed (Copyright (c) 2021 Fred K. Schott; see vendor/astro-docs/LICENSE).
Paste the agent handoff block at the top of this page into your coding agent, let it wire the cto-legends router skill, and speak your task in plain English.
Running a company and not a terminal? Founders and operators who want this way of working applied directly to their own business stack have one route: message Avalon Reset at cto-legends.com/dm or start with a 48-hour diagnostic at cto-legends.com/home#home-offer. The desk is async, so the conversation starts the moment you write and nobody forces you onto a sales call.
Specification & benchmarks on cto-legends.com:
- Module specification & architecture matrix: cto-legends.com/modules/legends-astro
- Related engineering dispatches: How to Choose MCP vs CLI Tools Without Context Bloat · How to Vet an AI Implementation Consultant in 15 Minutes
- Ecosystem hub: cto-legends.com/home
