# Workshop ## Overview A monorepo of open-source utilities. Currently houses `readyup`, a pre-deployment verification CLI; `overlay`, a chezmoi-backed scaffolding tool; `repo-tools`, a CLI for the repositories in a machine-local registry; `git-tools`, a CLI that derives values from git branch names; `launchd-agent`, a library for per-user launchd agents on macOS; `systemd-service`, a library for systemd services on Linux; `secret-tools`, a CLI for secrets in the macOS keychain; `nodejs-tools`, a CLI and library for Node.js runtimes, toolchains, and `node_modules` directories; `atlassian-tools`, a CLI for Jira Cloud projects; `chrome-tools`, a CLI for Chrome debug sessions; `demo-tools`, a CLI that runs aidemo demos; `npm-tools`, a CLI for npm package and registry chores; and `compositor`, a private content-composition engine under construction. ## Project structure Packages live under `packages/`: - **`atlassian-tools`**: CLI that reconciles a Jira Cloud project against a declarative spec, lists its work items, and manages the API token in the macOS keychain. Binary: `thor-jira`. - **`chrome-tools`**: CLI that launches and manages Chrome debug sessions, each on a profile and port derived from the working directory's repository and branch. macOS only. Binary: `thor-chrome`. - **`compositor`**: Content-agnostic engine that resolves declared content across precedence-ordered sources and plans idempotent writes to targets. Private and unreleased; no binary. - **`demo-tools`**: CLI that runs aidemo's render, probe, and MCP server with the environment that a demo repository's `.config/thor-demo.yaml` declares, and archives each rendered take under a per-machine archive root; `thor-demo voice setup` installs a local mlx-audio voice clone on Apple Silicon, and `thor-demo revoice` narrates a recorded demo again in the cloned voice. Its README describes both configuration files, the archive, and the voice clone. Each demo repository installs aidemo, a peer dependency, so the workspace sets `autoInstallPeers: false` and the tests run a fake aidemo. The package is also a demo repository of its own: `demos/` holds its aidemo demos, and rendered media (MP4, MP3, WebM) is never committed. Binary: `thor-demo`. - **`git-tools`**: CLI that derives values from git branch names: a stable number per branch, and the ticket that a branch encodes. Binary: `thor-git`. - **`launchd-agent`**: Library that installs, replaces, restarts, inspects, and removes per-user launchd agents on macOS. No binary. - **`nodejs-tools`**: CLI that inspects Node.js runtimes and toolchains and prunes `node_modules` directories, and a library export, `resolveNodePath`, that returns the node binary that asdf selects for a checkout. Binary: `thor-node`. - **`npm-tools`**: CLI that runs npm package and registry chores: `list-packages` lists a pnpm workspace's packages and whether each can be published, `publish-placeholder` publishes the `0.0.0` placeholder that a new package needs before `npm trust` can be configured for it, and `move-trust` moves a package's trusted publisher to another GitHub repository. Binary: `thor-npm`. - **`overlay`**: Idempotent overlay of a canonical scaffolding file set onto a target directory, backed by chezmoi. Binary: `overlay`. - **`readyup`**: Pre-deployment verification checks with TypeScript-authored kits, CLI runner, and JSON output. Binary: `rdy` (alias `readyup`). Its reference documentation lives in `docs/`, because npm truncates a registry README at 65,536 code points; `rdy help ` prints those files and `src/__tests__/doc-links.app.unit.test.ts` keeps them linked. Its `agents/` directory is a CodeAssembly content root, published to consumers as the `consult-readyup-kits` skill; `agents/README.md` states the discipline for editing it. Its presentation deck loads `presentation/deck.js`, an untracked bundle of `presentation/src/` that the package's `prepare` and `build:post` scripts write. - **`repo-tools`**: CLI that lists, scans, registers, and moves the repositories indexed by a machine-local repo registry. Binary: `thor-repo`. - **`secret-tools`**: CLI that stores, reads, and removes secrets in the macOS keychain. Binary: `thor-secret`. - **`systemd-service`**: Library that installs, restarts, inspects, and removes systemd system services on Linux. No binary. Key files: - `.config/nmr.config.ts`: Per-repo nmr script overrides. Its root hooks are what keep kit bundles honest and what validate readyup's agent content root, and its `build:post` and `ci:pre` hooks run the `rdy` bin, whose wrapper (`packages/readyup/bin/rdy.js`) loads TypeScript source in a checkout, so they need no prior build. - `.config/readyup.config.ts`: Readyup compile settings, plus the `sources` list whose kits audit this repo. - `.readyup/kits/`: Kit files (TypeScript sources compiled to self-contained ESM bundles). - `packages/readyup/vitest.config.ts`: Retained per-package config, holding the kit tree's coverage include. A package config replaces the root one rather than extending it, so this one passes `vitest.shared.ts` alongside its own setting, and anything a root-collected run needs belongs in that layer instead. - `pnpm-workspace.yaml`: Its `catalog` block is the single declaration site for every version shared across manifests, so a package it names is declared as `catalog:` rather than a literal version. Nothing enforces this yet; node-monorepo-tools#654 tracks the check. - `vitest.config.ts`, `vitest.root.config.ts`, and `vitest.shared.ts`: Vitest projects for packages and for root-level tests respectively, and the layer that every config in the repo passes to the factory; the root variant excludes every workspace package. `nmr test:watch` resolves `vitest.config.ts` and collects the whole tree through it, loading no package config. The root suite's `vitest-shared-options` test fails a config that omits the layer. ## Commands From the repo root, `pnpm exec rdy run --sources` runs the default kit of every source that `.config/readyup.config.ts` names, auditing this repo against the conventions that those sources own, including `codeassembly`'s `guidance` checklist over the agent-guidance wiring. Nothing in CI runs it; run it by hand after a dependency upgrade. ## Architecture ### Testing - Suites are Vitest projects on an isolation ladder, named for the furthest thing a test reaches and selected by `--project`, not by naming a config file. `nmr test` runs `unit` and `tool`, the two tiers a bare install can run; `nmr test:unit` and `nmr test:tool` run one apiece; `nmr test:all` adds `localhost` and `remote`, which this repo declares but does not use. - The tier a test file lands in is decided by the infix nearest `.test.ts`: `*.tool.test.ts` reaches a program the environment supplies (a spawned binary, or esbuild through its API). `unit` is the residual and claims every file the named tiers don't, so the filesystem is not a tier boundary; a tmpdir test is a unit test. - Test files are named `[.]..test.ts`. The tier tail is mandatory; a bare `*.test.ts` is drift, as is a tail naming anything but a tier. Any token before the tail documents intent: `.app.` covers something about the repo itself, `.wiring.` a seam whose branches unit tests already cover, `.roundtrip.` a value surviving serialization and reparsing. The root suite's `test-file-conventions` test, which declares nmr's `checkTestFileConventions`, enforces the tail and placement under `__tests__` across every package. ### Code quality Lefthook's pre-commit hook formats staged files with Prettier and restages them, so a commit can contain bytes you did not write. The code-quality workflow does not run `nmr ci`; it runs that command's steps as the parallel legs listed in `.github/workflows/code-quality.yaml`, each naming the hooks it needs. A hook added to `ci`, `check:strict`, or one of their constituents does not run in CI until a leg names it. ## Commit conventions The scope values this repo uses are `atlassian-tools`, `chrome-tools`, `compositor`, `demo-tools`, `git-tools`, `launchd-agent`, `nodejs-tools`, `npm-tools`, `overlay`, `readyup`, `repo-tools`, `root`, `secret-tools`, and `systemd-service`, mirroring the `scope:*` labels in `.config/release-kit.config.ts`. ## Releases Releases run through the **Release** GitHub Actions workflow (`workflow_dispatch`), which bumps versions, regenerates CHANGELOGs, and pushes tags; the resulting `-v` tag pushes trigger **Publish** and **Create GitHub release**. Never push a release tag by hand. ## Gotchas - **Build caching**: `nmr build` skips a package whose sources are unchanged, keyed on a hash under `node_modules/.cache/nmr-compile/`. This is not the check-result cache, and `--no-cache` does not reach it; removing the output is what forces a rebuild (`nmr clean`, or deleting `dist` by any means). - **Kit freshness**: the tracked kit bundles embed the readyup version that compiled them, and the manifest records the compile's toolchain (`esbuildVersion`, `bundledDependencies`), so a bump to readyup, to esbuild, or to a bundled dependency leaves them stale until `rdy compile` runs. `nmr ci` verifies them by recompiling, and does so before its build step, which would otherwise regenerate a stale bundle in place.