# AGENTS.md — ZDDC ## Commands ```bash # Dev build: 5 HTML tools + cross-compile zddc-server binaries + regen the # matrix at website/releases/index.html. dist/ artifacts only — no # website/releases/ side-effect for the build outputs themselves. sh build.sh # Build a single HTML tool (archive | transmittal | classifier | mdedit | landing) sh tool/build.sh # ── Lockstep release: bumps ALL six tools (5 HTML + zddc-server) at once ── # # Coordinated version is max(latest tag across all six) + 1, so they # always converge. Channel cuts (alpha/beta) follow the same lockstep — # every tool's channel mirror is overwritten together. Workflow: # alpha = active dev iteration → beta = ready for general testing → stable = ship sh build.sh --release # stable, auto-coordinated next version sh build.sh --release 1.2.0 # stable, explicit version sh build.sh --release alpha # alpha cut for everything sh build.sh --release beta # beta cut for everything (cascades alpha → beta) # Single-tool release (rare; prefer the lockstep top-level cut above so # versions don't drift between tools). Same flags as the top-level form. sh tool/build.sh --release [|alpha|beta] ./freshen-channel # rebuild one tool's alpha/beta from its current stable tag # Test all tools npm test # Test single tool npx playwright test tool # archive | transmittal | classifier | mdedit # Dev server (cache-busting HTTP, on port 8000) ./dev-server start ./dev-server stop ``` No lint, typecheck, or format commands exist — the project is plain sh + vanilla JS. The build ends with a **channel-link verifier** that asserts every `_{stable,beta,alpha}.html` (and zddc-server's per-platform binary mirrors + stub pages) resolves. Build fails if any link is dangling. Bootstrap-friendly: zddc-server checks are skipped until the first `--release` cut materializes the binaries under `website/releases/`. ## Architecture Five independent single-file HTML tools (`archive`, `transmittal`, `classifier`, `mdedit`, `landing`). Each compiles to one self-contained `.html` in `dist/` with all CSS and JS inlined — the first four name their output `dist/tool.html`; `landing` writes `dist/index.html` (it's served at `/` by `zddc-server`). Tools share a small set of canonical helpers in `shared/` (filename parsing, ZDDC filter UI, theme, help) — see "Shared modules" below. ``` tool/ css/ source stylesheets (concatenated in order) js/ vanilla JS IIFEs (concatenated in order) template.html placeholder markers: {{CSS_PLACEHOLDER}}, {{JS_PLACEHOLDER}}, {{BUILD_LABEL}} build.sh assembles dist/tool.html dist/tool.html generated output — committed with `git add -f` shared/ base.css CSS tokens and primitives included first by every tool's CSS build zddc.js canonical filename/folder/revision parsers, formatters, status validation zddc-filter.js shared ZDDC project/status filter UI module theme.js light/dark theme switcher help.js shared help dialog module build-lib.sh POSIX sh helpers (ensure_exists, concat_files, build_timestamp) sourced by every tool's build.sh via: . "$root_dir/../shared/build-lib.sh" website/ index.html hand-edited intro page + install snippets (root URL) releases/ index.html versions index, regenerated by build.sh from filesystem scan _v.html real per-version files (committed, immutable) _v.html -> ... symlink: latest patch within X.Y.* _v.html -> ... symlink: latest within X.*.* _stable.html -> ... symlink: current stable _beta.html -> ... symlink to stable (or real bytes if active beta) _alpha.html -> ... symlink to beta/stable (or real bytes if active alpha) helm/ zddc-server-prod/ production-shaped Helm chart (compiles from source via init container) zddc-server-dev/ dev-shaped variant (tracks main HEAD; debug-level logging; faster probes) README.md chart design rationale + quick-start ``` **Critical:** `dist/` files are gitignored. They're the canonical built artifact for testing and the source for `--release` writes into `website/releases/`, but they aren't checked in. Never edit them directly. `website/releases/` IS committed — per-version HTML and per-version zddc-server binaries as real bytes, partial-version pins (`_v`, `_v`) and channel mirrors (`_stable`, `_beta`, `_alpha`) as symlinks. `shared/build-lib.sh` provides `promote_release` (HTML tools) and `promote_zddc_server` (binaries + matching stub pages); the top-level `build.sh --release` calls them in lockstep. zddc-server binaries live in this repo too — there's no Codeberg release-asset publication anymore; everything serves from `zddc.varasys.io/releases/`. ## Shared CSS (`shared/base.css`) Included as the **first** positional arg to every tool's `concat_files` CSS call. Provides: - `:root` CSS custom properties — `--primary`, `--bg`, `--text`, `--border`, `--font`, etc. - Brand color: `--primary: #2a5a8a` (matches zddc.varasys.io) - Button primitive: `.btn`, `.btn-primary`, `.btn-secondary`, `.btn-sm`, `.btn-lg`, `.btn-link` - `.app-header` + `.app-header__title` chrome rules - `.build-timestamp`, `.hidden`, `.truncate`, webkit scrollbars **Do not** define these in any tool's own CSS — they come from shared. **Toast CSS** lives in `classifier/css/base.css` only (classifier is the only tool that uses toasts). ## Transmittal CSS quirks - `transmittal/css/base.css` overrides `html { font-size: 16px }` inside `@media screen` — this must stay. `shared/base.css` sets `14px`; transmittal's floating labels are rem-based and were designed for 16px. - The floating label position is defined in `transmittal/css/forms.css`, not Tailwind classes. If adding new Tailwind classes to `template.html`, add them to `transmittal/css/utilities.css` too — there is no Tailwind build step. ## Build system rules - Every `build.sh` sources `shared/build-lib.sh` first (provides `ensure_exists`, `concat_files`, `build_timestamp`). Set `root_dir` before sourcing. - Build scripts use **POSIX sh** (`#!/bin/sh` with `set -eu`), not bash. - `concat_files` accepts **positional args only** (not array names). - `awk` processes `template.html`, replacing `{{PLACEHOLDER}}` markers and stripping CDN `