AI Agent Guide
This page is the compact entry point for AI assistants, coding agents, and other generated-code tools working with xaligo.
Read First
Use this order when collecting context:
For repository work, also read the applicable files under
.github/instructions/ before planning or editing. Those files are the
source of truth for implementation constraints.
Core Model
xaligo has one source DSL: .xal. Keep every renderer on the same pipeline:
.xal -> parser -> layout -> shared scene/plan -> encoder
Do not add format-specific parsers or hidden alternate layout paths. SVG, Excalidraw, PPTX, XYFlow, and Isoflow should consume shared parser, layout, and scene/plan data wherever possible.
Important Paths
| Path | Purpose |
|---|---|
internal/usecase/ | Parser, layout, validation, shared scene and plan logic |
internal/repository/ | Filesystem, catalog, preview, and output-format adapters |
cmd/ | Native CLI entry point |
cmd/wasm/ | JavaScript/WASM adapter |
external/ | TypeScript package and PPTX exporter implementation |
docs/src/examples/samples/ | Source .xal and CSV examples |
docs/src/examples/previews/ | Rendered SVG previews used by the book |
etc/resources/aws/ | Catalogs, icons, templates, and attribution |
Generated outputs belong in output/ or another temporary directory, not in
the documentation source tree unless they are intentional documentation assets
such as SVG previews.
Useful Examples
- Line Variants shows route, traffic, and style overrides.
- Route and Traffic Separation shows structural routes plus directional traffic lanes.
- Automatic Route Junctions shows shared route trunks and fan-out junctions.
The corresponding source files live in docs/src/examples/samples/.
Common Commands
go test ./...
go build ./...
mdbook build docs
git diff --check
Render a documentation example:
.bin/xaligo render docs/src/examples/samples/route-traffic.xal \
--format svg \
--mode network \
-o output/route-traffic.svg
Editing Rules
- Preserve the shared
.xalpipeline. - Keep mode and output format independent.
- Keep render geometry and routing in shared use-case layers.
- Keep generated binaries, package artifacts, and ad hoc renders out of the repository.
- Update documentation links when moving examples or changing CLI paths.
- Prefer focused tests or render checks for behavior changes.