Files
zeekay 564f5da572 feat(site): agent: makes an export readable by AI agents, from one definition
agent/main.ts (strict TypeScript, Node 22.18+ type stripping, turndown)
edits a built bundle in place before it publishes: a Markdown twin of
every public page (/ -> /index.md, /a/b -> /a/b.md), the
<link rel="alternate" type="text/markdown"> naming it before </head>,
robots.txt (canonical, or the Content-Signal and Sitemap lines a site's
own lacks), sitemap.xml, llms.txt (or the /auth.md line a site's own
lacks), /.well-known/api-catalog and /auth.md, each only where the site
wrote none of its own; --skills writes the agent-skills index. Each
piece has a --no-<piece> opt-out. agent/sweep.ts fetches every URL a
live site's sitemap.xml, llms.txt and --from files name as ClaudeBot,
Meta-ExternalAgent and Googlebot, six at a time.

The site action takes `agent: <host>` (or `slug=host` lines with
sites:); hanzo.yml takes site.agent and sites[].agent. Both reach the
tool through bin/agent. A site that names none ships as built.

Testing: agent/ typechecks strict and passes node --test on Node 24
and 22.23.3 (35 tests: three fixture bundles to golden output byte for
byte, idempotent second runs, a hardlinked bundle left alone, the
worker pool equal to one thread, a sweep against a local server).
bin/agent_test.sh, bin/sites_test.sh and every other hanzo.yml step
pass locally except gocache, which fails the same on origin/main in a
worktree. Over 249 live docs.hanzo.ai pages every page changed by the
one <link> and nothing else.
Risk: high (workflow and action). The action step and the build.yml
call run only when agent: is set; build.yml's tool list now requires
bin/agent, which every tree from this commit on carries.
How to revert: git revert this commit; callers drop agent: or pin the
previous tag.
2026-10-27 01:37:29 -07:00
..