Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions aube.usage.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ cmd add help="Add a dependency" {
flag --allow-low-downloads help="Bypass the [`lowDownloadThreshold`] confirm prompt / refusal for this invocation" {
long_help "Bypass the [`lowDownloadThreshold`] confirm prompt / refusal for this invocation.\n\n`aube add` looks up each candidate's weekly download count and prompts (interactive) or fails (CI) when the count is below [`lowDownloadThreshold`]. The flag is intended for the cases where you've already verified the package out-of-band — adding a brand-new niche tool, a fresh fork, an internal scratch package — and don't want the prompt to interrupt scripted workflows. Does not affect the OSV malicious-package check, which remains a hard block."
}
flag --dangerously-allow-all-builds help="Allow every dependency's lifecycle scripts to run" {
long_help "Allow every dependency's lifecycle scripts to run.\n\nBypasses the `allowBuilds` allowlist for this invocation. Do not use in CI. Mirrors pnpm's `--dangerously-allow-all-builds`."
}
flag --deny-build help="Mark a dependency's lifecycle scripts as reviewed and denied" var=#true {
long_help "Mark a dependency's lifecycle scripts as reviewed and denied.\n\nWrites `allowBuilds: { <pkg>: false }` into the workspace yaml (or `package.json#aube.allowBuilds`) before the install runs, so the named package's lifecycle scripts stay skipped without tripping `strictDepBuilds=true`. Repeatable — pass the flag once per package.\n\nConflicts with `--no-save`, which only snapshots `package.json` and the lockfile and would leave an orphaned denial in the workspace yaml on restore. Also conflicts with `--allow-build` for the same package name."
arg <PKG>
Expand Down
4 changes: 4 additions & 0 deletions crates/aube/src/commands/add/filtered.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ pub(super) async fn run(
let mut install_opts = install::InstallOptions::with_mode(
crate::commands::chained_frozen_mode(install::FrozenMode::Fix),
);
super::apply_dangerously_allow_all_builds(
&mut install_opts,
args.dangerously_allow_all_builds,
);
install_opts.workspace_filter = filter.clone();
// See the sibling `aube add` codepath for why this flag is set:
// live OSV API on the resolved transitives.
Expand Down
11 changes: 8 additions & 3 deletions crates/aube/src/commands/add/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ use std::collections::BTreeMap;
/// bin linking. Without this guard every failed `add -g` would leak a
/// subdir that `scan_packages` ignores (no hash symlink) but disk space
/// keeps.
#[allow(clippy::too_many_arguments)]
pub(super) async fn run_global(
packages: &[String],
allow_build: Vec<String>,
deny_build: Vec<String>,
allow_low_downloads: bool,
dangerously_allow_all_builds: bool,
deny_build: Vec<String>,
lockfile: crate::cli_args::LockfileArgs,
network: crate::cli_args::NetworkArgs,
virtual_store: crate::cli_args::VirtualStoreArgs,
Expand Down Expand Up @@ -74,8 +76,9 @@ pub(super) async fn run_global(
let result = run_global_inner(
packages,
allow_build,
deny_build,
allow_low_downloads,
dangerously_allow_all_builds,
deny_build,
&layout,
&install_dir,
lockfile,
Expand Down Expand Up @@ -115,8 +118,9 @@ pub(super) async fn run_global(
async fn run_global_inner(
packages: &[String],
allow_build: Vec<String>,
deny_build: Vec<String>,
allow_low_downloads: bool,
dangerously_allow_all_builds: bool,
deny_build: Vec<String>,
layout: &crate::commands::global::GlobalLayout,
install_dir: &std::path::Path,
lockfile: crate::cli_args::LockfileArgs,
Expand Down Expand Up @@ -197,6 +201,7 @@ async fn run_global_inner(
// install" even when the user explicitly approved the dep
// (see Discussion #617).
allow_build,
dangerously_allow_all_builds,
// Same contract as `allow_build`, but force-denies matching
// packages so global installs can satisfy `strictDepBuilds=true`
// while keeping selected lifecycle scripts skipped.
Expand Down
26 changes: 24 additions & 2 deletions crates/aube/src/commands/add/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ pub struct AddArgs {
/// which remains a hard block.
#[arg(long)]
pub allow_low_downloads: bool,
/// Allow every dependency's lifecycle scripts to run.
///
/// Bypasses the `allowBuilds` allowlist for this invocation. Do not
/// use in CI. Mirrors pnpm's `--dangerously-allow-all-builds`.
#[arg(long)]
pub dangerously_allow_all_builds: bool,
/// Mark a dependency's lifecycle scripts as reviewed and denied.
///
/// Writes `allowBuilds: { <pkg>: false }` into the workspace yaml
Expand Down Expand Up @@ -214,8 +220,9 @@ pub async fn run(
save_catalog,
save_catalog_name,
allow_build,
deny_build,
allow_low_downloads,
dangerously_allow_all_builds,
deny_build,
lockfile,
network,
virtual_store,
Expand All @@ -237,8 +244,9 @@ pub async fn run(
return global::run_global(
packages,
allow_build,
deny_build,
allow_low_downloads,
dangerously_allow_all_builds,
deny_build,
lockfile,
network,
virtual_store,
Expand Down Expand Up @@ -399,6 +407,7 @@ pub async fn run(
// `ERR_AUBE_MALICIOUS_PACKAGE` as the CLI-name gate above.
let mut install_opts =
install::InstallOptions::with_mode(super::chained_frozen_mode(install::FrozenMode::Fix));
apply_dangerously_allow_all_builds(&mut install_opts, dangerously_allow_all_builds);
install_opts.osv_transitive_check = true;
let pipeline_result: miette::Result<()> = install::run(install_opts).await;

Expand Down Expand Up @@ -438,3 +447,16 @@ pub async fn run(
}
Ok(())
}

pub(super) fn apply_dangerously_allow_all_builds(
install_opts: &mut install::InstallOptions,
enabled: bool,
) {
if enabled {
install_opts.dangerously_allow_all_builds = true;
install_opts.cli_flags.push((
"dangerously-allow-all-builds".to_string(),
"true".to_string(),
));
}
}
19 changes: 19 additions & 0 deletions crates/aube/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1356,6 +1356,25 @@ mod cli_spec_tests {
);
}

#[test]
fn add_accepts_dangerously_allow_all_builds_after_package() {
let cli = Cli::try_parse_from([
"aube",
"add",
"--global",
"opencode-ai@1.17.13",
"--dangerously-allow-all-builds",
])
.expect("add --dangerously-allow-all-builds should parse after a package");

let Some(Commands::Add(add_args)) = cli.command else {
panic!("expected add subcommand");
};
assert!(add_args.global);
assert!(add_args.dangerously_allow_all_builds);
assert_eq!(add_args.packages, ["opencode-ai@1.17.13"]);
}

#[test]
fn lifter_does_not_eat_lifted_flag_as_kept_flag_value() {
// Regression: `aube --dir /tmp --frozen-lockfile install` would
Expand Down
6 changes: 6 additions & 0 deletions docs/cli/add.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ Bypass the [`lowDownloadThreshold`] confirm prompt / refusal for this invocation

`aube add` looks up each candidate's weekly download count and prompts (interactive) or fails (CI) when the count is below [`lowDownloadThreshold`]. The flag is intended for the cases where you've already verified the package out-of-band — adding a brand-new niche tool, a fresh fork, an internal scratch package — and don't want the prompt to interrupt scripted workflows. Does not affect the OSV malicious-package check, which remains a hard block.

### `--dangerously-allow-all-builds`

Allow every dependency's lifecycle scripts to run.

Bypasses the `allowBuilds` allowlist for this invocation. Do not use in CI. Mirrors pnpm's `--dangerously-allow-all-builds`.

### `--deny-build… <PKG>`

Mark a dependency's lifecycle scripts as reviewed and denied.
Expand Down
13 changes: 13 additions & 0 deletions docs/cli/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,19 @@
"hide": false,
"global": false
},
{
"name": "dangerously-allow-all-builds",
"usage": "--dangerously-allow-all-builds",
"help": "Allow every dependency's lifecycle scripts to run",
"help_long": "Allow every dependency's lifecycle scripts to run.\n\nBypasses the `allowBuilds` allowlist for this invocation. Do not use in CI. Mirrors pnpm's `--dangerously-allow-all-builds`.",
"help_first_line": "Allow every dependency's lifecycle scripts to run",
"short": [],
"long": [
"dangerously-allow-all-builds"
],
"hide": false,
"global": false
},
{
"name": "deny-build",
"usage": "--deny-build… <PKG>",
Expand Down
13 changes: 13 additions & 0 deletions test/global_install.bats
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,19 @@ teardown() {
assert_success
}

@test "aube add -g --dangerously-allow-all-builds runs unreviewed builds" {
AUBE_STRICT_DEP_BUILDS=true run aube add -g \
aube-test-builds-marker@1.0.0 \
--dangerously-allow-all-builds
assert_success
refute_output --partial "must be reviewed before install"
refute_output --partial "ignored build scripts"

pkg_dir="$AUBE_HOME/global-aube"
install_dir="$(find "$pkg_dir" -mindepth 1 -maxdepth 1 -type d -print -quit)"
assert_file_exists "$install_dir/aube-builds-marker.txt"
}

@test "aube add -g --deny-build=<pkg> marks a global dep's build scripts reviewed" {
AUBE_STRICT_DEP_BUILDS=true run aube add -g \
--deny-build=aube-test-builds-marker \
Expand Down
Loading