Skip to content

feat(cli): aube rebuild <pkg> targets a specific package#477

Merged
jdx merged 3 commits intomainfrom
worktree-agent-af9a91dc73891b7d8
May 2, 2026
Merged

feat(cli): aube rebuild <pkg> targets a specific package#477
jdx merged 3 commits intomainfrom
worktree-agent-af9a91dc73891b7d8

Conversation

@jdx
Copy link
Copy Markdown
Contributor

@jdx jdx commented May 2, 2026

Summary

  • aube rebuild now takes zero or more positional package names. With no args, the existing whole-policy rebuild runs unchanged (back-compat). With names, only the named deps' lifecycle scripts run, the build policy is bypassed for those deps, and the root preinstall / install / postinstall / prepare hooks are skipped.
  • Match is by graph name (the in-tree alias when one is configured), so aube rebuild my-alias works for a manifest entry like "my-alias": "npm:real-pkg@1.0", matching pnpm. Unknown names hard-error and list every unmatched entry.
  • Workspace aube --filter <something> rebuild <pkg> composes: each filtered importer runs only the named deps' scripts.

Triage decision in PR #471 (lifecycleScripts.ts:282).

Test plan

  • cargo build
  • cargo test
  • cargo clippy --all-targets -- -D warnings
  • cargo fmt --check
  • mise run test:bats test/rebuild.bats — 15/15 pass, including 4 new selective-mode tests (single dep, two deps, policy-bypass, unmatched-name error)
  • mise run test:bats test/lifecycle_scripts.bats — 33/33 pass

🤖 Generated with Claude Code


Note

Medium Risk
Extends lifecycle-script execution paths and adds an explicit policy-bypass mode, which could change when/which dependency scripts run if used in automation. Scope is contained to rebuild and guarded by explicit package arguments plus new error checks for missing lockfile/unmatched names.

Overview
aube rebuild now accepts optional positional package names; when provided, it runs lifecycle scripts only for the named installed dependencies, skips all root hooks, and bypasses the allowBuilds/onlyBuiltDependencies policy as an explicit opt-in.

The dependency lifecycle runner (run_dep_lifecycle_scripts) was extended with a selective mode filter (matching by lockfile graph name/alias), and rebuild now hard-errors on missing lockfile or unknown package names. CLI usage/docs were updated and new Bats tests cover selective rebuild behavior, policy bypass, and error cases.

Reviewed by Cursor Bugbot for commit 7a72e31. Bugbot is set up for automated code reviews on this repo. Configure here.

`aube rebuild` now takes zero or more positional package names. With
no args the existing whole-policy rebuild runs unchanged. With one or
more names, only those deps' lifecycle scripts run, the build policy
is bypassed for the named deps, and the root preinstall / install /
postinstall / prepare hooks are skipped — the user named the dep, so
the dep is the work.

Triage decision in PR #471 (lifecycleScripts.ts:282).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 2, 2026

Greptile Summary

This PR extends aube rebuild with an optional list of positional package names. When names are supplied, only those deps' lifecycle scripts run, the build policy is bypassed for them, and root hooks are skipped. The previous P1 (silent no-op when no lockfile was present in selective mode) has been fixed with an explicit early error.

Confidence Score: 5/5

Safe to merge — implementation is correct, all edge cases are guarded, and tests cover the new paths.

No P0 or P1 findings. The previously identified silent no-op (missing lockfile + selective mode) has been addressed with an early error. The jail policy is still applied in selective mode, and the alias-vs-registry-name distinction is handled correctly and consistently between the unmatched-name check and the lifecycle filter.

No files require special attention.

Important Files Changed

Filename Overview
crates/aube/src/commands/rebuild.rs Core selective rebuild logic: adds packages: Vec<String> arg, lockfile guard for selective mode (fixed per previous review), unmatched-name check, and routes lifecycle execution with the selected set. Logic is sound.
crates/aube/src/commands/install/lifecycle.rs Adds selected_names parameter to run_dep_lifecycle_scripts; selective mode bypasses policy and matches by pkg.name (alias), normal mode retains registry_name() allowlist check. Jail policy still applied in both modes.
crates/aube/src/commands/install/mod.rs Passes None as selected_names to the install path of run_dep_lifecycle_scripts — correct, preserves existing behaviour unchanged.
test/rebuild.bats Four new bats tests cover single dep, multi-dep, policy bypass, unmatched-name error, and the no-lockfile guard added in this PR.

Reviews (3): Last reviewed commit: "fix(cli): aube rebuild <pkg> errors when..." | Re-trigger Greptile

Comment thread crates/aube/src/commands/rebuild.rs
autofix-ci Bot and others added 2 commits May 2, 2026 19:52
Without the guard, `aube rebuild my-package` on a fresh checkout (or
before the first install) silently exits Ok: the lockfile-keyed graph
is None, so the entire `if let Some(graph)` block — including the
unmatched-name check — is skipped, and root hooks are also skipped
(selected.is_some()). Invisible no-op in CI.

Hard-error before the graph branch instead, with a hint to run
`aube install` first.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jdx
Copy link
Copy Markdown
Contributor Author

jdx commented May 2, 2026

Addressed Greptile's P1: aube rebuild <pkg> with no lockfile was silently exiting Ok. The if let Some(graph) block (containing the unmatched-name check) was skipped when graph.is_none(), and root hooks were also skipped because selected.is_some(). Invisible no-op in CI.

Added a guard before the graph branch that hard-errors with a hint to run aube install first, plus a regression-locking bats test (aube rebuild <pkg> errors when no lockfile is present).

Verified: cargo build/clippy/fmt clean, mise run test:bats test/rebuild.bats 16/16 pass.

Written with Claude.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 2, 2026

Benchmark changes

Public ratios: warm installs vs Bun 4x -> 7x; warm installs vs pnpm 9x -> 11x.

Benchmark aube bun pnpm
Fresh install (warm cache) 246ms -> 198ms (-20%) 1011ms -> 1448ms (+43%) 2227ms -> 2229ms (+0%)
CI install (warm cache, GVS disabled) 1174ms -> 1050ms (-11%) 1530ms -> 1509ms (-1%) 2049ms -> 2254ms (+10%)
CI install (cold cache, GVS disabled) 4273ms -> 4368ms (+2%) 4034ms -> 4445ms (+10%) 4940ms -> 5339ms (+8%)

7a72e31 vs 7d7ded0 | aube/bun/pnpm | 3 scenarios | 3 runs | 500mbit/50ms | generated by Codex.

@jdx jdx merged commit 56a5651 into main May 2, 2026
18 checks passed
@jdx jdx deleted the worktree-agent-af9a91dc73891b7d8 branch May 2, 2026 21:56
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.

1 participant