Skip to content

task-monitor 5/6: install.sh cargo build + CI Rust job: build and link task-monitor from every loadout installer - #285

Merged
martin-conur merged 2 commits into
mainfrom
task/monitor-install
Oct 20, 2026
Merged

martin-conur merged 2 commits into
mainfrom
task/monitor-install

Conversation

@martin-conur

Copy link
Copy Markdown
Owner

Summary

Every loadout's install.sh now builds the task-monitor TUI with cargo and links it into ~/.local/bin, so you no longer have to build it by hand. If cargo isn't installed it says so in one line and carries on, and a failed build only warns; the bash commands install either way.

Closes #277

What changed

  • New lib/monitor-install.sh (aw_install_monitor), called from the drift-guarded install-shared-symlinks stanza, so all seven loadouts get it.
  • It reads the binary path off cargo's JSON output (--message-format=json-render-diagnostics) instead of assuming monitor/target/release, so CARGO_TARGET_DIR / build.target-dir work. When that puts the binary outside the checkout, where it can't find bin/task-monitor-snapshot beside itself, the installer says to export TASK_MONITOR_SNAPSHOT.
  • A reported executable that isn't there is treated as a failed build, never linked.
  • Per the scope change on the issue, the CI Rust job is already in task-monitor 4/6: ratatui front end (repo view + all-repos overview, real-time): the task-monitor binary in monitor/ #282; this PR is the install part only.

Tests

  • tests/install_symlinks.bats puts a stub cargo on PATH in setup, so no installer test runs a real release build. Five new tests: build args + link target, one-line skip with no cargo anywhere on PATH, failed build, missing reported executable, outside-the-checkout hint.
  • Six mutations of the helper (no cargo check, no -x check, fail path returning 1, no hint, wrong link target, no --release) each turned at least one test red.
  • Real end-to-end: ran claude-gh/install.sh against a scratch HOME with the real cargo; it built, linked and task-monitor --help ran through the link. Repeated with an outside CARGO_TARGET_DIR; the hint printed.
  • ./run_tests.sh: 1466/1466 pass. tools/check-drift.sh clean, shellcheck -x clean on the changed files.

Docs

README task-monitor section, .claude/gh-workflow.md, the seven steering templates, CHANGELOG (with the upgrading note: re-run the loadout's install.sh; no task-init re-run needed).

🤖 Generated with Claude Code

…k task-monitor from every loadout installer

New `lib/monitor-install.sh` (`aw_install_monitor`), called from the
drift-guarded install-shared-symlinks stanza of all seven loadout
installers. With cargo on PATH it runs `cargo build --release` on
monitor/ and links ~/.local/bin/task-monitor to the executable cargo's
JSON output reports, so CARGO_TARGET_DIR is honoured; a binary built
outside the checkout gets a TASK_MONITOR_SNAPSHOT hint. Without cargo it
prints one skip line; a failed build warns. Neither fails the install.

tests/install_symlinks.bats stubs cargo for every installer test and
adds five #277 cases. README, the workflow doc, the seven steering
templates and CHANGELOG updated. The CI Rust job moved to #282.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@martin-conur

Copy link
Copy Markdown
Owner Author

Spec compliance

Issue #277 as amended by its scope-change comment (CI Rust job moved to #282; confirmed present in .github/workflows, with build/test/clippy/fmt on ubuntu and macos plus an MSRV job). Against the remaining scope:

  • cargo build --release when cargo is on PATH, binary linked into ~/.local/bin: delivered via lib/monitor-install.sh, called from the drift-guarded install-shared-symlinks stanza in all 7 installers.
  • One-line skip without cargo, bash commands still install: delivered and tested.
  • install_symlinks tests: five new ones plus a cargo stub in setup, so no installer test does a real build.
  • README, CHANGELOG with the upgrading note, workflow doc and the 7 steering templates: all updated. A grep finds no leftover "install.sh does not build it" wording.
  • Prebuilt binaries are not touched, as specified.

Code-review findings

No correctness blockers.

  • Under set -euo pipefail, binary=$(cargo … | sed … | tail -n 1) || binary="" is safe: a cargo failure yields an empty path and the warn-and-continue branch.
  • Taking the last "executable" in cargo's JSON is right. Build scripts compile first and the crate has a single [[bin]].
  • The -x check on the reported path stops a dangling symlink.
  • The outside-the-checkout test uses pwd -P on both sides, so it is not fooled by a symlinked tmp dir such as macOS /var vs /private/var.
  • CI ran on head 8af468e with all 7 checks green (bats ubuntu and macos, ShellCheck, drift, Rust ×3). That includes the Rust job from task-monitor 4/6: ratatui front end (repo view + all-repos overview, real-time): the task-monitor binary in monitor/ #282.

Nit, optional: the installer's cargo build has no --locked, while CI uses it. A stale Cargo.lock would be silently updated in the user's checkout. Adding --locked means changing the stub's expected args in the test as well. Not blocking.

PR body opens with ## Summary.

Verdict

clean-with-nits (the nit is optional). Merge decision is PM's.

…locked

The installer's `cargo build` now passes `--locked`, as CI does, so a
user install builds exactly the committed Cargo.lock instead of silently
updating a stale one in the checkout. The retry hint says the same. The
stub-cargo test pinning the build args is updated; dropping `--locked`
turns it red. README, CHANGELOG and the helper's header comment follow.

Review nit on PR #285.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@martin-conur
martin-conur merged commit efe2138 into main Oct 20, 2026
7 checks passed
@martin-conur
martin-conur deleted the task/monitor-install branch October 20, 2026 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

task-monitor 5/6: install.sh cargo build + CI Rust job

1 participant