Appearance
vendor-bots.mjs
Keeps vendor/bots honest against the lab checkout it was copied from.
Contributor tooling › vendor-bots.mjs
What it does
Without --check, re-copies packages/bots from the sibling grafted-wars-bot-simulation checkout over vendor/bots. Stamps vendor/bots.upstream with the lab commit that last touched that package, and with a content digest of the copy.
With --check, judges vendor/bots two ways. It checks the content digest against the stamp, which is always answerable, needing only this repository. Where the lab is present, it also checks the copy's files against the lab's tree at the recorded commit. A difference there reports as drift. A lab that has moved past that commit without touching the package reports as a notice instead. Reports the digest question alone, with the reason, when the lab or the recorded commit is unavailable.
Usage
Run through its npm run alias:
bash
npm run vendor:checkOr directly:
bash
node tools/vendor-bots.mjs --checknode tools/vendor-bots.mjs (no flag) re-copies from the lab instead of checking.
Options
| Flag | Value | What it does | Default |
|---|---|---|---|
--check | no value | Judges the existing vendor/bots copy against its stamp, and, where reachable, against the lab, instead of re-copying. This is the mode npm run check runs. | Off. The bare invocation re-copies and re-stamps. |
Inputs and outputs
Reads packages/bots from the lab checkout: by default the sibling directory grafted-wars-bot-simulation, or GW_VENDOR_LAB when set. With --check, reads the lab's git history for that path instead of its live worktree. Always reads vendor/bots and vendor/bots.upstream in this repository.
Without --check, on success (exit 0): overwrites vendor/bots with the copy, and rewrites vendor/bots.upstream with the new commit and digest. Prints how many files were copied and at which commit, then the new digest.
With --check, exit 0 covers two cases. The copy can be undrifted, or distance can be unjudgeable from this machine while the digest still matches its stamp; either way it prints a line confirming what was judged. Exit 1 covers three cases, each printed to stderr as a drift line. The copy's digest can disagree with its stamp (edited in place). A file can differ from the lab's recorded commit. Or no commit in the lab touches packages/bots at all — that last case also fails the bare (re-copy) mode.
Examples
npm run check runs this in --check mode, so confirm the vendored bot brain still matches before pushing:
bash
npm run vendor:checkAfter the lab's packages/bots changes, pull the update into this repository:
bash
node tools/vendor-bots.mjsNotes
Passing --check on a machine with no lab beside it, every CI runner included, still judges the content digest. It cannot judge distance from the recorded lab commit, but a copy edited in place is caught there.
The stamped commit is the last lab commit that touched packages/bots, never the lab's own head. Judging against a moving head would fail this check on lab commits that leave the package untouched. A lab head past the recorded commit prints as a notice, not a failure.
Source
tools/vendor-bots.mjs — part of Contributor tooling