Renames build.sh → build and replaces the --release flag form with
subcommands:
./build cut alpha (default; active dev iteration)
./build beta cut beta (cascades alpha → beta)
./build release cut stable (coordinated next version)
./build release X.Y.Z cut stable at explicit version
./build help
The contract shift: there's no longer a "plain dev build that doesn't
touch channels" at the top level. Every full-stack build is a publish
action — running ./build IS active dev iteration, which is what alpha
already meant. To iterate on one tool without writing to the website
worktree, use the per-tool sh tool/build.sh (unchanged).
Output continues to land in ${ZDDC_DEPLOY_RELEASES_DIR:-$HOME/src/zddc-website/releases}
and nothing is pushed automatically. Commit + push the website branch
yourself when you want to publish. Stable cuts still tag locally on
main; tags push separately too.
Behind the scenes: the export of ZDDC_DEPLOY_RELEASES_DIR is moved
above the per-tool build.sh invocations so children inherit it. The
prior "if RELEASE_CHANNEL else write_zddc_server_stubs_all" branch is
collapsed since RELEASE_CHANNEL is always set under the new CLI.
Docs (CLAUDE.md, AGENTS.md, ARCHITECTURE.md, zddc/README.md) updated
to reference ./build everywhere; the per-tool sh tool/build.sh refs
stay (they're a separate, narrower entry point).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
8.8 KiB
8.8 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Authoritative docs — read these first
This repo already has two thorough agent-facing references. Always consult them before working — they cover details intentionally omitted here:
AGENTS.md— commands, build-system rules, per-tool parser quirks, testing gotchas, git/worktree workflow, release process, zddc-server notesARCHITECTURE.md— single-file HTML pattern rationale, JS module/state patterns, per-tool architecture, security model
If something in this CLAUDE.md conflicts with those, those win — and please update them rather than letting drift accumulate.
Repo shape
This is a monorepo of independent tools, not one application:
archive/,transmittal/,classifier/,mdedit/,landing/— five self-contained HTML tools, each compiled to a single inlined HTML file in its owndist/. Naming: the first four outputdist/tool.html;landing/outputsdist/index.html(it's the project picker served at the root ofzddc-server).zddc/— Go HTTP server (separate sub-project; Go 1.24+). ServesZDDC_ROOT/index.htmlatGET /as the landing page;Accept: application/jsonon/returns the ACL-filtered project list. Cross-compiled binaries are committed to thewebsiteorphan branch (LFS-tracked) and served fromzddc.varasys.io/releases/(no Codeberg release assets); thehelm/charts in this repo build from source at deploy time.shared/—base.cssplus shared JS modules (zddc.js,hash.js,zddc-filter.js,theme.js,help.js) included by every tool's build, andbuild-lib.sh(POSIX sh helpers sourced by every tool'sbuild.shAND by the top-levelbuildfor lockstep release helpers).websiteorphan branch (same Codeberg repo) — committed static site:index.html(root URL, hand-edited intro),releases/<tool>_v<X.Y.Z>.html(immutable per-version archives),releases/<tool>_v<X.Y>.htmland_v<X>.html(symlinks),releases/<tool>_{stable,beta,alpha}.html(channel mirrors),releases/zddc-server_v<X.Y.Z>_<platform>(per-version cross-compiled binaries; LFS-tracked),releases/zddc-server_<channel>_<platform>(binary symlinks following the same cascade),releases/zddc-server_<X>.html(per-version / per-channel stub pages that fan out the four platform downloads in one matrix-cell link),releases/index.html(matrix table regenerated bybuild.sh). Working dir:~/src/zddc-website/(agit worktreeof thewebsitebranch —git -C ~/src/zddc worktree add ~/src/zddc-website website). Caddy: thezddc.varasys.io:8443vhost bind-mounts~/src/zddc-websiteand serves from there. Install model: local use is a download from/releases/. Server use iszddc-server, which has the current-stable build of all five tools baked in via//go:embed(compile-time default). Tools auto-served at folder-name-driven paths:archiveeverywhere,classifierinIncoming/Working/Stagingsubtrees,mdeditinWorkingsubtrees,transmittalinStagingsubtrees,landingonly at root. Override via.zddc apps:cascade entry (channel/version/URL/path) — fetched once, cached at<ZDDC_ROOT>/_app/. Drop a real.htmlfile at any path to override.helm/— example Helm charts for zddc-server (zddc-server-prod/,zddc-server-dev/). Both compile from source via init container. Operators copyvalues.yaml.exampleand customize. No secrets in repo.tests/— Playwright specs (Chromium only, requires File System Access API).tests/schema.spec.jsvalidatestransmittal.schema.jsonagainst canonical fixtures viaajv(only dev dep besides Playwright)
Most-used commands
# Lockstep release driver. Every invocation is a publish action;
# alpha is the default since "alpha = active dev iteration".
./build # cut alpha (default)
./build beta # cut beta — cascades alpha → beta
./build release # cut stable — coordinated next version, cascades all
./build release X.Y.Z # cut stable at explicit version
./build help # usage
sh tool/build.sh # build one HTML tool's dist/ (no channel write)
sh tool/build.sh --release [...] # single-tool release (rare; prefer the lockstep ./build)
./freshen-channel <tool> <channel> # rebuild one tool's alpha/beta from its current stable tag
npm test # all Playwright specs (build first!)
npx playwright test <tool> # one spec
./dev-server start # stop # cache-busting HTTP on :8000
# zddc/ Go server (sub-project)
(cd zddc && go test ./...) # unit tests (Go 1.24+)
No lint/typecheck/format commands exist for the HTML tools — vanilla JS + POSIX sh by design.
Things that bite if you forget
dist/is gitignored.tool/dist/<tool>.htmlis the canonical built artifact for testing and as the source for--releasewrites. Never hand-edit adist/file.- Lockstep releases. Every release cut bumps all six artifacts (5 HTML tools + zddc-server) to the same version, even if a tool didn't change. The coordinated next-stable target is
max(latest tag across all tools) + 1. Per-tool independent versions are no longer the norm —./build releaseis the canonical path. Workflow: alpha = active dev, beta = ready for general testing, stable = ready to ship. - Release artifacts live on the
websiteorphan branch. The build pipeline writes them to${ZDDC_DEPLOY_RELEASES_DIR:-$HOME/src/zddc-website/releases}— a git worktree of that branch, served by Caddy directly. HTML tools: per-version<tool>_v<X.Y.Z>.html(real immutable files) + partial-version pins + channel mirrors (symlinks). zddc-server:zddc-server_v<X.Y.Z>_<platform>per-version binaries (LFS),zddc-server_v<X.Y>_<platform>/_v<X>_<platform>/_<channel>_<platform>symlinks, pluszddc-server_<X>.htmlstub pages that surface the four platform downloads in one matrix-cell link. Same cascade rule for both: stable cut → beta + alpha both reset to stable; beta cut → alpha cascades to beta. - No tags for alpha/beta. Channel URLs are stable URLs by design — appending counter tags would defeat the purpose. The on-page label encodes
<date> · <sha>for traceability. Stable cuts get clean<tool>-vX.Y.Ztags for every tool (six tags per cut, all sharing the same X.Y.Z). - Pre-release semver in the on-page label. Plain dev builds and
--release alpha|betacuts embedvX.Y.Z-{alpha,beta}in{{BUILD_LABEL}}where X.Y.Z is the next-stable target. Plain dev adds a full timestamp +-dirtymarker;--release alpha|betais date-only. - Channel-link verifier. Every
./buildends with a check that every<tool>_{stable,beta,alpha}.html(and zddc-server's per-platform binary mirrors + stub pages) resolves. Bootstrap-friendly: skips zddc-server checks until the first--releasecut materializes the binaries. sh tool/build.shis a single-tool dev build. Writesdist/<tool>.htmlonly; no new per-version files / symlink updates in the website worktree. Useful for iterating on one tool without cutting alpha for the whole suite. To publish, run./build(cuts alpha for everything together). Release artifacts always land in${ZDDC_DEPLOY_RELEASES_DIR:-~/src/zddc-website/releases}; nothing is pushed automatically — commit + push the website branch when you want to publish.- Always build before running tests — Playwright opens
dist/tool.htmlviafile://. </in JS string/template literals breaks inline<script>embedding.shared/build-lib.shprovidesescape_js_close_tags; every tool'sbuild.shruns JS through it before inlining.- All ZDDC parsing/formatting/hashing goes through
window.zddc(fromshared/zddc.js+shared/hash.js+shared/zddc-filter.js). API:parseFilename,parseFolder,parseRevision,formatFilename,formatFolder,compareRevisions,isValidStatus,splitExtension,joinExtension,crypto.{sha256Hex, sha256String, sha256File, bytesToHex},filter.{parse, matches}. File objects across tools usetrackingNumber(string) andextension(string, no leading dot — usezddc.joinExtension(name, ext)to build a filename). Add edge cases totests/zddc.spec.js, not per-tool tests. - Two globals only:
window.app(per-tool app state + modules) andwindow.zddc(shared library). No others — anything that crosses tool boundaries goes through one of these. - Worktrees live at
~/src/zddc-<branch>. Checkgit worktree listbefore starting a feature branch; nevergit checkout/switchinside a worktree another agent might be using. - Build scripts are POSIX
shwithset -eu, not bash.concat_filestakes positional args only.