no-mistakes(document): Clarify rebuild updates and check guidance
This commit is contained in:
1 parent
022967e277
commit
ad55229df8
4 files changed
+73
-22
No files matched your search
@@ -344,7 +344,7 @@ in
|
|||||||
# older. A newer copy is left alone so rebuild.sh's latest-release update
|
# older. A newer copy is left alone so rebuild.sh's latest-release update
|
||||||
# survives the next switch.
|
# survives the next switch.
|
||||||
want_tasks_axi="0.2.6"
|
want_tasks_axi="0.2.6"
|
||||||
have_tasks_axi="$(tasks-axi --version 2>/dev/null | head -1 | tr -d '[:space:]')"
|
have_tasks_axi="$(tasks-axi --version 2>/dev/null | head -1 | tr -d '[:space:]' || true)"
|
||||||
if [ -z "$have_tasks_axi" ] \
|
if [ -z "$have_tasks_axi" ] \
|
||||||
|| [ "$(printf '%s\n%s\n' "$want_tasks_axi" "$have_tasks_axi" | sort -V | head -1)" != "$want_tasks_axi" ]; then
|
|| [ "$(printf '%s\n%s\n' "$want_tasks_axi" "$have_tasks_axi" | sort -V | head -1)" != "$want_tasks_axi" ]; then
|
||||||
"$npm" install -g "tasks-axi@$want_tasks_axi"
|
"$npm" install -g "tasks-axi@$want_tasks_axi"
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ The captain confirmed the split on 2026-11-15. Leave it unchanged:
|
|||||||
./tests/fm-launcher.sh --live # installed zshrc; fails while it still launches Pi
|
./tests/fm-launcher.sh --live # installed zshrc; fails while it still launches Pi
|
||||||
./tests/fm-launcher.sh # generated zshrc; must pass
|
./tests/fm-launcher.sh # generated zshrc; must pass
|
||||||
./tests/crew-dispatch.sh # routing via firstmate, model IDs via opencode models
|
./tests/crew-dispatch.sh # routing via firstmate, model IDs via opencode models
|
||||||
./tests/rebuild-update-steps.sh # static audit of rebuild.sh update steps
|
./tests/rebuild-update-steps.sh # isolated updater execution and activation checks
|
||||||
./tests/run.sh # all checks
|
./tests/run.sh # all checks
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -78,13 +78,13 @@ This follows the NIST SP 800-128 Rev. 1 (2019) Section 3.3 "Controlling Configur
|
|||||||
|
|
||||||
## What `rebuild.sh` updates
|
## What `rebuild.sh` updates
|
||||||
|
|
||||||
One `./rebuild.sh` run brings every installed component to its latest supported version. Each step is idempotent: a current copy is left alone, and a re-run repeats no install. When a tool or the network is absent, the step prints a warning and the rebuild continues.
|
`./rebuild.sh` updates the components below. The npm updater skips packages already at the registry version. Other tools use their own update commands on each run. Optional updater failures print warnings and allow the rebuild to continue. A failed switch stops the script before the post-switch updates.
|
||||||
|
|
||||||
Before the switch:
|
Before the switch:
|
||||||
|
|
||||||
- Installed npm globals through `/opt/homebrew/bin/npm`, never Nix's npm: `@steipete/bird`, `chrome-devtools-axi`, `defuddle`, `forgejo-axi`, `gh-axi`, `lavish-axi`, `quota-axi`, and `tasks-axi`. The script skips absent packages and compares each installed package with the registry before an update. `tasks-axi` keeps its firstmate floor of 0.2.6 in `home.activation.axiTools`, which now installs only a missing or older copy, so the latest release survives the switch.
|
- Installed npm globals listed in `rebuild.sh`'s `npm_globals` array, through `/opt/homebrew/bin/npm`, never Nix's npm. The script skips absent packages and compares each installed package with the registry before an update. `home.activation.axiTools` enforces the `tasks-axi` minimum without downgrades, so newer releases survive the switch.
|
||||||
- Retired npm OpenCode packages `@opencode-ai/cli` and `opencode-ai` are removed so their shims cannot conflict with the Homebrew formula.
|
- Retired npm OpenCode packages `@opencode-ai/cli` and `opencode-ai` are removed so their shims cannot conflict with the Homebrew formula.
|
||||||
- `no-mistakes update`, using the binary at `~/.no-mistakes/bin/no-mistakes`.
|
- `no-mistakes update`, using `~/.no-mistakes/bin/no-mistakes`, or the command on `PATH` if that binary is absent.
|
||||||
- `hermes update --yes`, which pulls the configured channel and restarts the services that run its new code.
|
- `hermes update --yes`, which pulls the configured channel and restarts the services that run its new code.
|
||||||
- `nix flake update`, so the switch builds from the newest locked inputs. Commit the resulting `flake.lock` change.
|
- `nix flake update`, so the switch builds from the newest locked inputs. Commit the resulting `flake.lock` change.
|
||||||
|
|
||||||
@@ -92,15 +92,13 @@ During the switch:
|
|||||||
|
|
||||||
- nix-darwin updates Homebrew formulae and casks through `configuration.nix`'s `onActivation.autoUpdate` and `onActivation.upgrade` settings.
|
- nix-darwin updates Homebrew formulae and casks through `configuration.nix`'s `onActivation.autoUpdate` and `onActivation.upgrade` settings.
|
||||||
- `home.activation.backpass` updates `acpx` and `backpass`. Other activation steps install their declared npm packages when absent.
|
- `home.activation.backpass` updates `acpx` and `backpass`. Other activation steps install their declared npm packages when absent.
|
||||||
- Home Manager replaces the standalone `~/.local/bin/actionlint` and `~/.local/bin/shellcheck` binaries with links to the packages selected by the updated flake. Later rebuilds update those links automatically.
|
- Home Manager replaces the standalone `~/.local/bin/actionlint` and `~/.local/bin/shellcheck` binaries with links to the selected nixpkgs packages. Later rebuilds update those links automatically, rather than downloading separate releases.
|
||||||
|
|
||||||
After the switch:
|
After the switch:
|
||||||
|
|
||||||
- The Skills CLI updates every skill tracked in `~/.agents/.skill-lock.json`. The pinned pstack skills are not in that lock, so they stay on the `home.nix` revision (see [pstack skills](#pstack-skills-pinned-on-every-rebuild)). `security-audit` is excluded on purpose, because `home.nix` freezes it so a rebuild never pulls a new skill mid-session; renew it by hand with the command in [security-audit skill](#security-audit-skill-agent-security-reviews).
|
- The Skills CLI updates skills tracked in `~/.agents/.skill-lock.json`, except `security-audit`. See [security-audit skill](#security-audit-skill-agent-security-reviews) for its freeze policy and manual update command. Untracked skills receive no update here. See [pstack skills](#pstack-skills-pinned-on-every-rebuild) for the pinned skills and their update procedure.
|
||||||
- `pi update --extensions --no-approve`, run after the switch because the Homebrew bundle may have upgraded the `pi` binary.
|
- `pi update --extensions --no-approve`, run after the switch because the Homebrew bundle may have upgraded the `pi` binary.
|
||||||
|
|
||||||
`actionlint` and `shellcheck` follow the versions available in the selected nixpkgs revision, rather than separate release downloads. The pinned pstack tree stays put; see its section for how to move it.
|
|
||||||
|
|
||||||
## security-audit skill (agent security reviews)
|
## security-audit skill (agent security reviews)
|
||||||
|
|
||||||
`home.activation.securityAuditSkill` installs Cloudflare's `security-audit` skill from `https://github.com/cloudflare/security-audit-skill` so the coding agents can run a structured vulnerability audit. The exact command:
|
`home.activation.securityAuditSkill` installs Cloudflare's `security-audit` skill from `https://github.com/cloudflare/security-audit-skill` so the coding agents can run a structured vulnerability audit. The exact command:
|
||||||
|
|||||||
+12
-13
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Rebuild nix-darwin + home-manager from this checkout.
|
# Rebuild nix-darwin + home-manager from this checkout.
|
||||||
#
|
#
|
||||||
# Before the switch, update every installed component that is not declarative:
|
# Before the switch, update the non-declarative tools listed below:
|
||||||
# npm globals (through Homebrew's node, never Nix's npm), no-mistakes,
|
# npm globals (through Homebrew's node, never Nix's npm), no-mistakes,
|
||||||
# Hermes Agent, and the flake inputs. After the switch,
|
# Hermes Agent, and the flake inputs. After the switch,
|
||||||
# update the installed agent skills and Pi extensions against the upgraded
|
# update the installed agent skills and Pi extensions against the upgraded
|
||||||
@@ -9,15 +9,15 @@
|
|||||||
#
|
#
|
||||||
# Rotates stale home-manager *.backup files before the switch so a second switch
|
# Rotates stale home-manager *.backup files before the switch so a second switch
|
||||||
# never fails with "would be clobbered".
|
# never fails with "would be clobbered".
|
||||||
# Every update step is idempotent and warns when its tool or network is absent,
|
# Optional updater failures warn and allow the rebuild to continue.
|
||||||
# so one missing updater never aborts the rebuild.
|
# A failed switch stops the script before post-switch updates.
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
|
||||||
ln -sfn "$DIR" ~/.dotfiles
|
ln -sfn "$DIR" ~/.dotfiles
|
||||||
NPM=/opt/homebrew/bin/npm
|
NPM=/opt/homebrew/bin/npm
|
||||||
|
|
||||||
# npm globals are installed outside Nix and Homebrew, so no other step moves
|
# The npm globals listed below have no declarative updater.
|
||||||
# them. Use /opt/homebrew/bin/npm explicitly: the activation PATH can resolve
|
# Use /opt/homebrew/bin/npm explicitly: the activation PATH can resolve
|
||||||
# Nix's npm, which cannot write the Homebrew prefix, and these packages belong to
|
# Nix's npm, which cannot write the Homebrew prefix, and these packages belong to
|
||||||
# Homebrew's node. Each package is compared with the registry first, so a current
|
# Homebrew's node. Each package is compared with the registry first, so a current
|
||||||
# copy is left alone and a failed lookup or install only warns.
|
# copy is left alone and a failed lookup or install only warns.
|
||||||
@@ -61,8 +61,8 @@ process.stdin.on("end", () => {
|
|||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
# tasks-axi is also gated by home.nix (firstmate needs >= 0.2.6). Update it
|
# home.activation.axiTools enforces the tasks-axi minimum without downgrades,
|
||||||
# here so it reaches the latest release; the activation only fills a gap.
|
# so a newer release installed here survives the switch.
|
||||||
npm_globals=(
|
npm_globals=(
|
||||||
"@steipete/bird"
|
"@steipete/bird"
|
||||||
chrome-devtools-axi
|
chrome-devtools-axi
|
||||||
@@ -128,7 +128,7 @@ fi
|
|||||||
# Hermes Agent is a mutable git clone at ~/.hermes/hermes-agent, so Nix and
|
# Hermes Agent is a mutable git clone at ~/.hermes/hermes-agent, so Nix and
|
||||||
# Homebrew never move it. Its own updater pulls the configured channel and
|
# Homebrew never move it. Its own updater pulls the configured channel and
|
||||||
# restarts the services that run its new code; --yes keeps the rebuild
|
# restarts the services that run its new code; --yes keeps the rebuild
|
||||||
# non-interactive. A failure leaves the installed version in place.
|
# non-interactive.
|
||||||
echo "==> Updating Hermes Agent..."
|
echo "==> Updating Hermes Agent..."
|
||||||
if ! command -v hermes >/dev/null 2>&1; then
|
if ! command -v hermes >/dev/null 2>&1; then
|
||||||
echo "==> WARNING: hermes not found. Skipping update."
|
echo "==> WARNING: hermes not found. Skipping update."
|
||||||
@@ -139,7 +139,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
stamp="$(date +%Y%m%d-%H%M%S)"
|
stamp="$(date +%Y%m%d-%H%M%S)"
|
||||||
# Paths home-manager manages via home.file (regular files become out-of-store symlinks).
|
# Paths managed by home.file, including config links and Nix package binaries.
|
||||||
managed=(
|
managed=(
|
||||||
"$HOME/.grok/config.toml"
|
"$HOME/.grok/config.toml"
|
||||||
"$HOME/.grok/AGENTS.md"
|
"$HOME/.grok/AGENTS.md"
|
||||||
@@ -193,10 +193,9 @@ fi
|
|||||||
|
|
||||||
sudo darwin-rebuild switch --flake ~/.dotfiles#lt-mbp
|
sudo darwin-rebuild switch --flake ~/.dotfiles#lt-mbp
|
||||||
|
|
||||||
# Update installed agent skills after the switch. The Skills CLI tracks most of
|
# Update tracked skills after activation. Exclude security-audit to preserve
|
||||||
# ~/.agents/skills through its lock file; the pinned pstack skills are not in
|
# home.activation.securityAuditSkill's freeze policy. Untracked skills,
|
||||||
# that lock, so they stay on the home.nix revision. security-audit is skipped on
|
# including the pinned pstack copies, are outside this updater's scope.
|
||||||
# purpose: home.nix freezes it so a rebuild never pulls a new skill mid-session.
|
|
||||||
echo "==> Updating agent skills..."
|
echo "==> Updating agent skills..."
|
||||||
NPX=/opt/homebrew/bin/npx
|
NPX=/opt/homebrew/bin/npx
|
||||||
SKILL_LOCK="$HOME/.agents/.skill-lock.json"
|
SKILL_LOCK="$HOME/.agents/.skill-lock.json"
|
||||||
|
|||||||
@@ -331,5 +331,59 @@ class ManagedLintTools(unittest.TestCase):
|
|||||||
self.assertTrue(command["force"])
|
self.assertTrue(command["force"])
|
||||||
|
|
||||||
|
|
||||||
|
class ActivationToolFloor(unittest.TestCase):
|
||||||
|
"""The generated activation installs the floor without downgrading newer tools."""
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
expression = '''
|
||||||
|
(builtins.getFlake (toString ./.)).darwinConfigurations."lt-mbp"
|
||||||
|
.config.home-manager.users.laptran.home.activation.axiTools.data
|
||||||
|
'''
|
||||||
|
result = subprocess.run(
|
||||||
|
["nix", "eval", "--raw", "--impure", "--expr", expression],
|
||||||
|
cwd=ROOT, text=True, capture_output=True, timeout=120,
|
||||||
|
)
|
||||||
|
if result.returncode:
|
||||||
|
raise AssertionError(result.stderr)
|
||||||
|
cls.activation = result.stdout
|
||||||
|
|
||||||
|
def test_missing_old_current_and_newer_tasks_versions(self):
|
||||||
|
# Independent oracle: firstmate requires 0.2.6. A rebuild must retain
|
||||||
|
# a newer installed release instead of restoring that minimum.
|
||||||
|
boundaries = r'''
|
||||||
|
function /opt/homebrew/bin/npm { printf '%s\n' "$*" >> "$TEST_CALLS"; }
|
||||||
|
function [ {
|
||||||
|
if [[ $1 == -x && $2 == /opt/homebrew/bin/* ]]; then return 0; fi
|
||||||
|
builtin [ "$@"
|
||||||
|
}
|
||||||
|
tasks-axi() {
|
||||||
|
if [[ -z $TEST_HAVE ]]; then return 127; fi
|
||||||
|
printf '%s\n' "$TEST_HAVE"
|
||||||
|
}
|
||||||
|
'''
|
||||||
|
with tempfile.TemporaryDirectory(prefix=".activation-test-", dir=ROOT) as scratch:
|
||||||
|
root = Path(scratch)
|
||||||
|
script = root / "activation.sh"
|
||||||
|
script.write_text(boundaries + self.activation)
|
||||||
|
calls = root / "calls"
|
||||||
|
for have, installs in (
|
||||||
|
("", ["install -g tasks-axi@0.2.6"]),
|
||||||
|
("0.2.5", ["install -g tasks-axi@0.2.6"]),
|
||||||
|
("0.2.6", []),
|
||||||
|
("2.0.0", []),
|
||||||
|
):
|
||||||
|
with self.subTest(installed=have or "absent"):
|
||||||
|
calls.write_text("")
|
||||||
|
env = {"HOME": str(root), "PATH": "/usr/bin:/bin",
|
||||||
|
"TEST_HAVE": have, "TEST_CALLS": str(calls)}
|
||||||
|
result = subprocess.run(
|
||||||
|
[shutil.which("bash"), str(script)], cwd=ROOT, env=env,
|
||||||
|
text=True, capture_output=True, timeout=30,
|
||||||
|
)
|
||||||
|
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
|
||||||
|
self.assertEqual(calls.read_text().splitlines(), installs)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
Reference in new issue
Block a user