# tools/ Developer documentation for `wikitool` - how the CLI is built, how to change it, and how to run its tests. **This is not the command reference.** That is [CONTRACT.md](CONTRACT.md), which `wikitool docs verify` checks against the registered commands. Copying its generated command records here would create a second copy that drifts, so this file deliberately has none - and `docs verify` now enforces that. | Document | Audience | |---|---| | `README.md` (this file) | Humans working *on* wikitool | | [`CONTRACT.md`](CONTRACT.md) | Agents working *with* wikitool - commands, error contracts, maintenance schedule | | [`../AGENTS.md`](../AGENTS.md) | The invariants that say when using a command is mandatory | | [`../CHANGES.md`](../CHANGES.md) | What changed in the stack, and when | ## Setup ```bash tools/preflight.sh # from the repo root ``` ```powershell pwsh -NoProfile -ExecutionPolicy Bypass -File tools/preflight.ps1 # PowerShell 7 on Windows ``` The preflight is the one way a checkout gets its environment: it checks the tools listed in `prerequisites.txt`, records their absolute paths in `../.wikitool-tools.json`, creates `.venv` and installs `requirements.txt` into it with `-m pip`. It is POSIX sh because it has to run before Python is known to exist; exit 42 means the user has to act, and its output says how. The procedure an agent follows around it is `instructions/preflight.md`. Each release also attaches `preflight.sh` and `preflight.ps1` as assets, for the first install before any tree exists. `release.yml` writes the download address of that same release into two placeholder lines of the copy (`RELEASE_ARCHIVE_URL`/`RELEASE_CHECKSUM_URL` in the shell script, `$ReleaseArchiveUrl`/`$ReleaseChecksumUrl` in the PowerShell one; the tree copy leaves them empty). With no `prerequisites.txt` beside it, the script is in *asset mode*: it downloads the tarball and its `.sha256`, refuses on a mismatch, reads the folder limit out of the archive, unpacks into `