# AGENTS.md — ZDDC ## Commands ```bash # Build all tools (writes to dist/ only; also regenerates website/releases/{index.html,manifest.json}) sh build.sh # Build single tool sh tool/build.sh # archive | transmittal | classifier | mdedit | landing # Cut a stable release (auto-increments patch version, tags -vX.Y.Z, uploads _vX.Y.Z.html to Codeberg) sh tool/build.sh --release sh tool/build.sh --release 1.2.0 # explicit version # Cut an alpha/beta channel build (tags -vX.Y.Z-{alpha,beta}.N, uploads to Codeberg as a prerelease) sh tool/build.sh --release alpha sh tool/build.sh --release beta # Release all tools at once sh build.sh --release [version|alpha|beta] # 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. ## 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 (root URL) releases/ index.html versions index, regenerated by build.sh from the Codeberg release list manifest.json - → tag map (regenerated by build.sh; consumed by the level-2 stub at runtime) bootstrap/ level1/.html same-origin level-1 stubs (4 tools, no landing) track-stable/.html level-2 stubs that track the current-stable channel track-alpha/.html level-2 stubs that track the alpha channel track-beta/.html level-2 stubs that track the beta channel bootstrap/ level1.html.tmpl per-project bootstrap template (relative ../.html) level2.html.tmpl level-2 channel-tracking bootstrap template README.md install / channel / pin docs ``` **Critical:** `dist/` files are gitignored. They're the canonical built artifact for testing and the source for `--release` uploads to Codeberg, but they aren't checked in. Never edit them directly. The per-version `_v.html` artifacts and zddc-server binaries also aren't checked in — they live on Codeberg as release assets attached to git tags. `website/releases/` only contains `index.html` (versions index) and `manifest.json` (channel → tag map), both regenerated by `build.sh` from a Codeberg API call. ## 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 `