This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is getsaga.dev — the documentation website for Saga, a Swift static site generator. The site is itself built with Saga: it parses Saga's own source code and DocC files to produce documentation and API reference pages.
NEVER run just run — the dev server is always already running. Assume it is active and will pick up changes automatically.
All commands use just:
just run— development mode: compiles Tailwind CSS, copies DocC docs, generates symbol graph, then runssaga devwith file watchingjust build— production build: same prep steps, thenswift runto generate the site intodeploy/just compile— compile the Swift binary without running itjust resolve— resolve Swift Package Manager dependenciesjust format— format code withswiftformat -swift-version 5 .just clean— removedeploy/,.build/symbolgraph/, andcontent/docs/just copy-docs— copy DocC markdown from Saga's checkout intocontent/docs/just symbol-graph— generate Saga's symbol graph JSON for the API reference
Prerequisites: brew install loopwerk/tap/saga just
Single executable target (Website) in Sources/Website/. The entry point is main.swift.
- Tailwind CSS — compiles
content/static/input.css→content/static/output.cssvia SwiftTailwind - DocC rewriting — rewrites DocC-flavored markdown (
Symbol,<doc:File>) into standard markdown with links to/api/and/docs/routes - Guide documentation — registers
content/docs/folder, processes markdown through Parsley, Moon (syntax highlighting), and SwiftSoup (external links, TOC generation) - API reference — loads
.build/symbolgraph/Saga.symbols.json(generated byjust symbol-graph), parses with SymbolKit, produces pages for each public type/function - Static pages — landing page (
index.html) and 404 page - Post-processing — HTML minification via Bonsai (production only; skipped when
isDevis true)
main.swift— orchestrates the entire build pipelineUtils.swift— doc sorting order, DocC markdown rewriting (rewriteMarkdown), parameter/return value renderingAPIReference.swift— symbol graph parsing, declaration rendering, doc comment processingDocProcessor.swift— item processors for guide pages (title cleanup, syntax highlighting, TOC, blockquote styling)templates/Layout.swift— shared HTML layout with nav and footertemplates/HomePage.swift— landing pagetemplates/DocTemplate.swift— guide documentation page templatetemplates/APITemplate.swift— API reference page template
The content/docs/ directory is generated (gitignored) — it's copied from Saga's DocC sources via just copy-docs, then rewritten in-place before Saga processes them. Do not edit these files directly.
The doc ordering is hardcoded in Utils.swift: ["index", "Installation", "GettingStarted", "Architecture", "AdvancedUsage"].
- SwiftFormat config in
.swiftformat: 2-space indent,--indentcase true,--patternlet inline - Templates use Swim (imported as
HTML) for type-safe HTML with Tailwind CSS classes - CSS is Tailwind v4, configured via
content/static/input.css
This project is deployed on Linux (via Docker). All Swift code must compile and run on Linux. Key things to watch for:
- Foundation networking types (
URLRequest,URLSession, etc.) requireimport FoundationNetworkingon Linux. Use a conditional import:#if canImport(FoundationNetworking) import FoundationNetworking #endif
- Avoid Apple-only APIs (e.g.,
Combine,SwiftUI, Objective-C runtime features). Stick to cross-platform Swift and Foundation.
Multi-stage Docker build: Swift 6.0 builder → nginx:alpine serving deploy/. See Dockerfile and nginx.conf.