MindAttic.Deploy/BIBLE
MindAttic.Deploy — Project Bible
Single source of truth for what MindAttic.Deploy IS, is NOT, and the rules that keep it coherent. README.md says how to build/run; this says how to think about the system.
1. The one sentence
One pipeline that FTPS-deploys the MindAttic root sites (the MindAttic.Web sites and the MindAttic.Components asset package they load, as one linked group) and fires the GitHub-Actions deploys of the Blazor apps — from a single registry (projects.json) and a single FTP credential, with zero per-project deploy machinery.
2. The product promise
- One repo, one install, one credential.
npm installonce; one FTP credential, resolved per M.DPLY-LAW-3. No per-projectdeploy.ps1/deploy.settings.json/node_modules/. - One registry edits everything.
projects.jsonhas two target arrays —sites[](verbatim root sites) andapps[](Blazor/CI apps) — pluslinkedGroups. Add/retag a target by editing only this file. - Two pipelines. Root sites (including the linked group) and apps. A run names one with a mode flag (
--site,--sites,--uiux,--app,--apps); there is no default pipeline. - Two front doors, one engine.
npm run deploy(Node) andMindAttic.Deploy.Cli(C#) both drive the samesrc/deploy.jspipeline — the CLI shells into node. See M.DPLY-LAW-1. - Linked deploy. The MindAttic.Components repo holds the shared jsDelivr asset package (its
web/folder); the four sites that load assets from it (ryandebraal.com,mindatticcares.com,Hyperspace,mindattic.com) live together in the MindAttic.Web repo; they are a permanent linked group (linkedGroupsinprojects.json): deploying any one deploys all of them — next tag pinned in the pages, hooks and stamps, onePin MindAttic.Components V<n>commit, tag + push, CDN verified byte-exact, then FTP — and aborts before any upload if a gate fails. The flow is specified in §4.3; the code issrc/linked.js. - Project pages live on GitHub. Each MindAttic repo's GitHub README is its project page; this repo renders and uploads nothing per project.
3. What it is NOT
- NOT a component library. It does not own fonts, the Cyberspace effects, or theme CSS — those live in
MindAttic.Componentsand are loaded at runtime via jsDelivr or spliced by its sync scripts. This repo only invokes those scripts aspreDeployhooks. - NOT a project-page generator. Each repo's GitHub README is its project page; adding a README renderer here is a regression.
- NOT a remote cleaner. It never deletes files on the FTP host; stale remote files are removed by hand.
- NOT the editor of component sources. For the linked group it rewrites the tag pins and stamps in the sites' pages, commits and pushes them in MindAttic.Web, and tags and pushes MindAttic.Components; it never edits files inside
MindAttic.Components/web(components/,assets/,themes/). - NOT the host of per-project deploy state. Projects carry no
scripts/cli/,deploy.bat,deploy.settings.jsonor marker-block deploy files of their own; adding them is a regression. - NOT the actual app deployer for Blazor apps. For
apps[]entries it commits + pushes a branch; the project's own GitHub Actions workflow does the real Azure push. - NOT a SemVer project. Whole-number versioning only (HOUSE-LAW-1), including the MindAttic.Components release tags the linked deploy publishes and pins (
V1,V2, … neverv1.1.1). - NOT a renderer.
sites[]files are uploaded verbatim (only the Last-Updated stamp and the linked group's tag pins are rewritten); nothing is templated. - NOT a committer of anyone's work. The linked deploy commits only its own pin, splice and stamp changes inside the group's site folders; any other uncommitted change aborts the run, and a hook that touches a file outside those folders aborts it too.
4. Architecture canon
projects.json (THE registry)
┌──────────────────────────┬──────────────┐
│ sites[] + linkedGroups │ apps[] │
│ MindAttic.Web root sites │ Blazor / CI │
└────────────┬─────────────┴──────┬───────┘
│ │
▼ ▼
┌──────────────── src/deploy.js ─────────────────┐
│ site: preDeploy hooks → stamp → FTPS │
│ linked: src/linked.js — pin → hooks → stamp → │
│ commit → tag → push → CDN gate → FTPS │
│ app: preDeploy hooks → git commit/push │
│ (no mode flag → usage, exit 2) │
└────────────────────┬───────────────────────────┘
│ shells into
MindAttic.Deploy.Cli (C#) ───┘ (node --use-system-ca src/deploy.js …)
│
creds: [CLI only] MindAttic.Vault → MINDATTIC_FTP_JSON env → secrets/ftp.json (basic-ftp, FTPS)
4.1 Projects / components
MindAttic.Deploy.Cli/— C# console app (net10.0, Spectre.Console.Cli, assembly nameMindAttic.Deploy). A thin front door that shells into the node pipeline (seeServices/DeployRunner.csandServices/ProjectRoster.cs). Solution:MindAttic.Deploy.slnx.src/deploy.js— the pipeline (site / app modes; the linked group runs throughsrc/linked.js); FTPS viabasic-ftp; preDeploy hook runner. A run with no mode flag prints usage and exits 2.src/linked.js— the linked deploy (§4.3).projects.json— the registry (sites[]/apps[]+linkedGroups).package.json—npm test,npm run deploy,npm run all(all sites, then all apps); one runtime dependency,basic-ftp..github/workflows/cli-ci.yml— builds the C# CLI and smoke-tests--version. There is no CI deploy workflow; deploys run from the dev box.test/linked.test.js— the node:test suite (npm test).scripts/publish.ps1,scripts/ensure-fresh.ps1— CLI publish + freshness helpers.tools/codex.ps1— Codex doctor + digest CLI;tools/build-readme.ps1— regeneratesREADME.htmfromREADME.md.
4.2 Domain model (NOUNS)
- SiteProfile — a verbatim root site (
slug,sourceDir,ftpRemotePath,files[]oruploadDir: true(recursive, non-destructive tree upload),stampFile, optionalpinFiles[],preDeploy[]). Uploaded as-is. Each linked-group site uploads only itsindex.htm. - AppProfile — a Blazor / GitHub-Actions deploy target (
slug,repo,branch,workflow,disabled,disabledNote,stageOnly[],commitMessage,preDeploy[]). - HookProfile — a
preDeploystep:kind∈ {package-pull,powershell,dotnet-build}, plusrequired; a powershell hook may declaretagArg, the flag that receives the linked release tag (mindattic.com's component splice,MindAttic.Components/web/build/build-sites.ps1, takes no tag: it pins the MindAttic.Components release named in that repo'sweb/sites.json).package-pullrunsgit pullin the linked package'ssourceDir. - DeployConfig — the deserialized
projects.json(sites,apps,linkedGroups). - Linked group — a repo holding a jsDelivr package folder plus the site folders that load from it, either in the same repo or all in one other repo (
linkedGroups):mindattic-web= packageMindAttic.Components(repomindattic/MindAttic.Componentsat../MindAttic.Components,cdnSubpathweb,firstTagV1, branchmain) + sitesryandebraal.com→mindatticcares.com→hyperspace→mindattic.com, each withsourceDir../MindAttic.Web/<folder>. Package URLs arehttps://cdn.jsdelivr.net/gh/mindattic/MindAttic.Components@V<n>/web/<path>. The listed order is the FTP order. Deploying any member deploys all.
4.3 Key services (VERBS)
- Mode guard —
src/deploy.jsrefuses a run with none of--site/--sites/--uiux/--app/--apps(usage, exit 2). - Site deploy (
runSiteMode/deployOneSite) — runpreDeploy, stamp<!-- Last Updated -->, FTPS thefiles[]glob toftpRemotePath. - Linked deploy (
src/linked.js,runLinkedMode) —planTargetsexpands--site <member>/--sites/--uiux(alias--package) to the whole group;--no-linkdeploys the named site only, with a loud warning. Everything with a side effect is injected so it is testable. The flow aborts BEFORE any FTP upload if a gate fails:--dry-runchanges nothing (no fetch, pin edit, hook, stamp, commit, tag, push, FTP connect or upload) and prints the whole plan; gates that would abort print[WOULD ABORT].--with-tests(runs<cdnSubpath>/tests) is accepted only on a linked deploy. Pushingmainof MindAttic.Web triggers itssync-subscribersworkflow only when the push touches the package paths that workflow watches; the pin commit touches only site folders.- Preflight (
inspectRepo) — the repo is a git repo onmainwith a clean working tree,originreachable, not behind or diverged fromorigin/main, latest tag an ancestor ofHEAD, no tag moved on origin, no whole-number tag that exists only locally and is not atHEAD,<cdnSubpath>\tools\build-asset-manifest.ps1 -Verifypasses, every site's page exists inside the repo, FTP secrets resolvable. - Release tag (
releaseTagAfter) — ifHEADalready carries the latestV<n>tag and every page's pins equal it, that tag is reused (steps 3–5 are skipped; this is also how a run resumes after a rejected push). Otherwise the release tag isV<n+1>, orfirstTagwhile the repo has no whole-number tag. Gates before anything is written: no page pins a tag newer than the release tag, every literal package URL exists in the package tree with the manifest's byte count, nothing pins@main; a release tag already on origin at another commit aborts (tags are immutable). - Prepare —
rewritePinsturns everygh/<repo>@V<n>/<cdnSubpath>/pin in each site'spinFiles(default: itsstampFile) into the release tag (idempotent; npm, other repos' and non-package URLs are untouched); each site'spreDeployhooks run (a hook withtagArgreceives the tag;package-pullis skipped); eachstampFileis stamped. - Commit — the changed files are committed as
Pin <package slug> V<n>. A hook that changed a file outside the group's site folders aborts the run. Any failure in steps 3–4 restores the working tree (reset --hard,clean -fd) to the clean state preflight verified; in the split layout the package repo is restored the same way, but only when it was still clean just before step 3 (never discarding someone else's changes). - Tag — annotated
V<n>on that commit; the message lists the commit subjects since the previous tag. - Push —
git push origin main, then the tag. Never force. A rejected push is a clean abort ([ABORT] ... Nothing was uploaded, exit 1); the commit and tag stay local and the next run reuses them. - CDN gate (
buildCdnChecks+verifyCdn) — every package URL the pages use (literal URLs, plus every file listed in<cdnSubpath>/assets-manifest.jsonunder each site's domain folder, which covers URLs built at runtime from a base prefix) must return HTTP 200 on jsDelivr at the release tag withaccess-control-allow-origin: *and acontent-lengthequal to the file in the package folder. Directory-like base URLs and documentation placeholders (@<tag>/<path>) are not fetched. Failures retry in shared backoff rounds (default 3 minutes total); a dry run never waits. A tag that is published but fails the gate stays; the next run reuses it. - FTP — the committed pages upload in group order over one connection (no second stamp), reconnecting before the next site if an upload closed it; a failing site does not stop the others; the exit code is non-zero if any failed.
--sitesdeploys non-member sites after the group. The summary reports whether the repo is clean and in sync withorigin/main.
- Preflight (
- App deploy (
runAppMode/deployOneApp) — runpreDeploy,git addstageOnly, commit if staged, pushbranchto fire the project's workflow; disabled apps print their note and exit 0. - preDeploy hooks (
executePreDeploy) —runPackagePull(git pull in the linked package'ssourceDir, read fromprojects.json),runPowershellHook,runDotnetBuildHook. - Credential load — the C# CLI (
DeployRunner.RunNode) reads MindAttic.Vault (FtpCredentialStore.Default.TryGetJson(),%APPDATA%\MindAttic\Ftp\ftp.json) and, when it has content, passes it to node asMINDATTIC_FTP_JSON;loadFtpSettingsinsrc/deploy.jsresolvesMINDATTIC_FTP_JSONenv →secrets/ftp.json; FTPS viaaccessFtp. - CLI dispatch (
MindAttic.Deploy.Cli) —site(with--no-link/--with-tests) /uiux(aliaspackage) /app/all/list/versioncommands; default (no args) is an interactive multi-select menu (MainMenuCommand) that runs a linked group once however many of its members are ticked; all shell intoDeployRunner.RunNode.ProjectRosterresolves the repo root and deserializesprojects.jsonat startup.
5. The Laws
This project inherits all org-wide laws from MindAttic.HouseRules.md by reference — they are not restated here. Most directly load-bearing for this repo:
- HOUSE-LAW-1 — Whole-number versioning (assembly
Versionand the MindAttic.WebV<n>release tag the linked deploy pins). - HOUSE-LAW-2 — Soft-disable, never hard-delete (an
apps[]entry is disabled with a note, never deleted, until infra exists). - HOUSE-LAW-3 — Credentials resolve through MindAttic.Vault (FTP creds; see M.DPLY-LAW-3).
- HOUSE-LAW-6 — One engine, many front doors (the CLI and
npm run deploydrive the samesrc/deploy.js; see M.DPLY-LAW-1). - HOUSE-LAW-8 — Definition of done is verified, not asserted (see §8).
Project-specific laws:
M.DPLY-LAW-1 — One pipeline, two front doors
src/deploy.js is the single deploy engine. MindAttic.Deploy.Cli MUST NOT reimplement deploy logic; it shells into node --use-system-ca src/deploy.js … (Services/DeployRunner.cs). A behavior change happens in src/deploy.js / src/linked.js, not in the C# layer.
M.DPLY-LAW-2 — The registry is the only edit point for targets
Adding, removing, or retagging a deploy target (sites[] / apps[] entries: slug, paths, files, hooks, disabled) and editing linked-group membership or FTP order (linkedGroups) is an edit to projects.json and nothing else. Components live in MindAttic.Components; project pages are each repo's GitHub README.
M.DPLY-LAW-3 — Credentials never live in code or uploaded output
FTP credentials resolve MindAttic.Vault (C# CLI only, per HOUSE-LAW-3) → MINDATTIC_FTP_JSON env → secrets/ftp.json (gitignored), and are never embedded in source or any uploaded file.
M.DPLY-LAW-4 — Shared assets are CDN-pinned to an immutable tag
The sites load shared assets from MindAttic.Components on jsDelivr (gh/mindattic/MindAttic.Components@V<n>/web/) at an immutable whole-number tag, never @main (tip-of-tree, non-atomic, cached ~12h). For the linked group that tag is the release tag the deploy publishes, pins in each site's pinFiles and verifies byte-exact on the CDN before any upload; a page never pins a tag newer than the published one.
M.DPLY-LAW-5 — Apps fire CI; this repo never FTPs an app
For apps[], the repo's contract ends at git push <branch>; the project's own workflow performs the real (Azure) deploy. A disabled app prints its disabledNote and exits 0 — it never half-fires.
M.DPLY-LAW-6 — Fail loud on unknown input
src/deploy.js rejects an unknown flag, a linked-only modifier used outside a linked deploy (--no-link without --site/--sites, --with-tests without --site <member>/--sites/--uiux) and a run with no mode flag — each with usage and exit 2 — rather than guessing at a deploy.
6. Verified state
Evidence from the dev box (Windows 11, Node 24, .NET 10 SDK).
| Capability | Status | Evidence |
|---|---|---|
| C# CLI builds clean | ✅ done | dotnet build MindAttic.Deploy.Cli -c Release --nologo → 0 Warning(s), 0 Error(s) (2026-10-03).
|
| Node pipeline flag-validated | ✅ done | src/deploy.js rejects unknown flags, misplaced linked modifiers and a run with no mode flag (exit 2); --help works. Covered by the cli: tests in test/linked.test.js.
|
Linked deploy (src/linked.js)
|
🟡 partial | npm test → 38 tests pass (2026-10-13): split package/sites repos (tag from and on the package repo, pin commit + push in the sites repo, reuse, dirty sites repo and package-touching hook abort), tag math incl. firstTag, expansion, flag validation, subpath-aware pin rewrite and URLs, dirty/behind/tag-moved/stray-local-tag/site-outside-repo aborts, pin commit + tag + push with a clean tree after, tag reuse, rejected push + resume, hook touching a file outside the site folders aborts and restores, CDN gate incl. runtime-built base prefixes, dry-run changes nothing, partial FTP failure + reconnect, registry consistency — against a throwaway monorepo with a bare origin, a local stand-in for jsDelivr serving the published tag, and a fake FTP. No real MindAttic.Web release has run yet; the first one publishes V12.
|
| FTPS site upload | 🟡 partial | Exercised by real deploys; no automated test against a real host. |
| App deploy | 🟡 partial | Push-to-branch CI path; no automated test (it would push real branches). |
| Automated test suite | 🟡 partial | test/linked.test.js covers the linked deploy and the CLI flag guards; plain site/app modes and the C# CLI have no automated tests (rfc/0001-test-harness.md).
|
7. Active frontier
- RFC: rfc/0001-test-harness.md — extend automated tests to the plain site/app modes and the C# CLI so those behaviors can graduate from 🟡 to ✅.
- Roadmap: resolve MindAttic.Vault in the Node front door too, so
secrets/ftp.jsoncan be dropped (M.DPLY-US-E2). - Epics: see USER_STORIES.md — Epic A (registry-driven deploy), Epic C (root sites + linked group), Epic D (Blazor apps), Epic E (credentials), and the priority backlog (test harness).
8. Quality bar
A change is done when:
dotnet build MindAttic.Deploy.slnx -c Releaseis clean (0 warnings —TreatWarningsAsErrors=true).node src/deploy.js --helpruns,npm testpasses, and a representative--dry-rundeploy succeeds for the affected mode.- Behavior changes land in
src/deploy.js/src/linked.js(not duplicated in the C# CLI — M.DPLY-LAW-1). - Target changes are confined to
projects.json(M.DPLY-LAW-2); no credential touches source/output (M.DPLY-LAW-3). - Per HOUSE-LAW-8: a status is
✅in the docs only when a build or run proves it; otherwise🟡/⬜. powershell -File tools/codex.ps1 doctorpasses.
9. Glossary
- Root site — a verbatim FTPS-uploaded site (
mindattic.comroot,mindatticcares.com,ryandebraal.com, plus thehyperspace,idiotproof-replaysandknowyourmechsub-folders); not templated. - App — a Blazor / GitHub-Actions deploy target; this repo commits+pushes, CI deploys.
- preDeploy hook — a step run before upload/push:
package-pull,powershell, ordotnet-build. - Mode flag — one of
--site,--sites,--uiux,--app,--apps;src/deploy.jsexits 2 without one. - Asset manifest —
MindAttic.Components/web/assets-manifest.json, the verified list of package assets the CDN gate checks. - Linked group — see §4.2; release tag — the whole-number
V<n>tag of MindAttic.Components a linked deploy publishes (or reuses) and pins in the sites; pin — theMindAttic.Components@V<n>segment of a…/MindAttic.Components@V<n>/web/jsDelivr URL; pin commit — thePin MindAttic.Components V<n>commit holding the pins, splices and stamps that the release tag points at; CDN gate — the pre-FTP check that every package asset the sites use is live at the release tag with the exact bytes. - Front door — an entry point (the Node
npm runscripts or the C# CLI) onto the one deploy engine. - Stamp — the
<!-- Last Updated: <iso> -->comment written into a root site'sstampFile.