Skip to content

feat(cli): aube add bootstraps package.json + 10 misc.ts ports#417

Merged
jdx merged 6 commits intomainfrom
claude/pnpm-misc-batch-1
Apr 30, 2026
Merged

feat(cli): aube add bootstraps package.json + 10 misc.ts ports#417
jdx merged 6 commits intomainfrom
claude/pnpm-misc-batch-1

Conversation

@jdx
Copy link
Copy Markdown
Contributor

@jdx jdx commented Apr 30, 2026

Summary

Two parts:

  1. aube add now creates a minimal package.json when run in a directory without one — mirrors pnpm install <pkg>. Bootstraps a project in a single command. The home-boundary safety check on find_project_root still applies; aube install is unchanged (still errors clearly when no manifest exists).
  2. 10/37 cases ported from pnpm/test/install/misc.ts to test/pnpm_install_misc.bats, with TODO triage updates as scenarios are resolved.

Ported (10)

Source line Scenario
36 bin files from deps are on PATH for the root postinstall script
73 --use-stderr redirects everything to stderr; stdout stays empty
83 lockfile: false in pnpm-workspace.yaml suppresses the lockfile
97 --prefix runs install in a subdirectory
124 --save-exact + --save-dev combined
150 spec preserved verbatim (~3.0.0 doesn't get rewritten to ^)
163 tarball with case-only filename collisions installs cleanly
219 a script can invoke a bin from an installed dep
233 new behavior: aube add <pkg> in an empty dir creates package.json
245 bare aube add (no pkg name) exits 1 with a helpful error

Translation choices

  • is-positive substituted with is-odd where it didn't matter to the scenario.
  • pnpm install <pkg> translated to aube add <pkg> (aube splits the two commands).
  • The case-collision port deliberately skips pnpm's StoreIndex-internal assertions and only checks the user-visible parity guarantee.
  • The --use-stderr port uses assert grep -qF for the stderr-contains check because assert can't wrap the bash [[ ... ]] keyword.

Divergences cleared

  • create-package.json-if-missing (233) — fixed in this PR.
  • pnpm add with no name exits 1 (245) — was a false positive; aube already exits 1.

Divergences still recorded in the TODO

  • --lockfile-dir (112) — aube has no flag for placing the lockfile outside the project root.
  • package.yaml manifest (136) — aube's manifest reader is package.json-only; would need a multi-crate format-aware rewrite (out of scope here).
  • strict-store-pkg-content-check (516) — needs investigation; depends on whether aube has an equivalent store-tamper detector.

Test plan

  • mise run test:bats test/pnpm_install_misc.bats passes locally (10/10)
  • mise run test:bats test/add.bats passes locally (no regressions)
  • mise run test:bats test/project_root_walk_up.bats passes locally (the existing aube install errors clearly when no package.json test still works — the new behavior is aube add-only)
  • cargo clippy -p aube --all-targets -- -D warnings clean

🤖 Generated with Claude Code

Base automatically changed from claude/elated-tharp-beb760 to main April 30, 2026 20:59
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 30, 2026

Greptile Summary

This PR ports 9 new bats test cases from pnpm/test/install/misc.ts (bringing the total to 10/37) and adds a small add.rs change that writes a minimal package.json to cwd when no project root is found, matching pnpm's bootstrap-on-first-add behaviour.

One note on the PR description: it lists case 245 ("bare aube add fails") as a divergence where "aube exits 0", but add.rs already has an early packages.is_empty() guard (line 239) that returns Err(\"no packages specified\") before the new code runs — the test's assert_failure is correct and the divergence note is outdated. Similarly, the title and description say 8 cases were ported, while 9 were actually added (10 total including the pre-existing one); PNPM_TEST_IMPORT.md's count of 10/37 is the accurate figure.

Confidence Score: 5/5

Safe to merge — code and tests are correct; only the PR description has minor inaccuracies.

No P0 or P1 findings. The add.rs change is minimal and correctly scoped. Tests are well-structured with appropriate bats_require_minimum_version guard and proper use of bats-file helpers. The apparent contradiction between the PR description and the test for case 245 resolves cleanly in favour of the test being right.

No files require special attention.

Important Files Changed

Filename Overview
crates/aube/src/commands/add.rs Adds package.json bootstrap logic: when no project root is found, writes {} to cwd before resolving the project root. Correctly placed after the early packages.is_empty() guard and the --workspace/--prefix chdir, so all flag interactions are safe.
test/pnpm_install_misc.bats Adds 9 new bats tests porting pnpm/test/install/misc.ts scenarios; bats_require_minimum_version 1.5.0 correctly gates the run --separate-stderr flag used by the --use-stderr test.
test/PNPM_TEST_IMPORT.md Updated triage table to 10/37 ported; documents remaining high-value targets, skipped fixtures, and divergences accurately.

Reviews (6): Last reviewed commit: "feat(cli): aube add creates package.json..." | Re-trigger Greptile

Comment thread test/pnpm_install_misc.bats Outdated
Comment thread test/pnpm_install_misc.bats Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 30, 2026

Benchmark changes

Versions:

  • aube: 1.5.1 -> 1.5.2
  • pnpm: 11.0.1 -> 11.0.3

Public ratios: warm installs vs Bun 3x -> 1.8x; warm installs vs pnpm 9x -> 8x.

Benchmark aube bun pnpm
Fresh install (warm cache) 237ms -> 277ms (+17%) 728ms -> 497ms (-32%) 2104ms -> 2348ms (+12%)
CI install (warm cache, GVS disabled) 564ms -> 1186ms (+110%) 742ms -> 719ms (-3%) 2094ms -> 2455ms (+17%)
CI install (cold cache, GVS disabled) 2282ms -> 8615ms (+278%) 1895ms -> 7541ms (+298%) 5439ms -> 7835ms (+44%)

13935c7 vs aecb50f | aube/bun/pnpm | 3 scenarios | 3 runs | 500mbit/50ms | generated by Codex.

@jdx jdx force-pushed the claude/pnpm-misc-batch-1 branch 3 times, most recently from 8951cc2 to bd385f9 Compare April 30, 2026 21:37
jdx and others added 3 commits April 30, 2026 16:43
Adds --use-stderr, lockfile=false-in-workspace-yaml, --prefix, and
spec-preserved-verbatim. is-positive substituted with is-odd
(already in test/registry/storage/). Brings the misc.ts port to 5/37.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Use assert_file_not_exists instead of `assert [ ! -e ... ]` for
  bats-file diagnostic output on failure.
- Wrap `[ -z "$output" ]` in `assert` to surface the actual value on
  failure. Note in code that `[[ ... ]]` can't be wrapped (bash
  keyword); switch the stderr-contains check to `assert grep -qF`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Now that the @pnpm.e2e/* fixtures landed in test/registry/storage/
(via #424), three previously-skipped misc.ts ports become viable:
- bin-on-PATH-in-root-postinstall (line 36)
- run-script-invokes-dep-bin (line 219)
- case-only-filename-collision-installs-cleanly (line 163)

The case-collision port deliberately skips pnpm's StoreIndex-internal
assertions (those probe pnpm-specific CAS internals) and instead asserts
the user-visible parity guarantee: install succeeds and the package
materializes under node_modules. Brings the misc.ts port to 8/37.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jdx jdx force-pushed the claude/pnpm-misc-batch-1 branch from bd385f9 to e1da3cb Compare April 30, 2026 21:44
jdx and others added 2 commits April 30, 2026 16:45
STORE_VERSION was a misread — it's just a path-component constant in
pnpm's test, not the subject of any test. The actual scenario is
strict-store-pkg-content-check: tamper with the cached store manifest
and expect the next install to fail. Note the aube parity dependency.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
aube has no flag or setting for placing the lockfile outside the
project root. Move misc.ts:112 from "remaining high-value" to
"documented divergences" in the import TODO.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jdx jdx changed the title test: port four more cases from pnpm misc.ts test: port 8 cases from pnpm install/misc.ts Apr 30, 2026
Mirrors pnpm: `pnpm install <pkg>` (= `aube add <pkg>`) in a directory
with no manifest writes a minimal `{}` package.json before continuing,
so users can bootstrap a project with a single command.

The home-boundary safety check on find_project_root still applies — the
auto-create only fires when the walk returns None (no ancestor up to
$HOME has package.json). `aube install` is unchanged: it still errors
clearly when there's no manifest.

Also ports two more misc.ts cases:
- create-package.json-if-missing (233) — uses the new behavior above
- pnpm-add-fails-with-no-name (245) — was a false-positive divergence in
  the TODO; the original "exit=0" reading was a `$?`-after-pipe artifact.
  aube already does the right thing.

Brings the misc.ts port to 10/37.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jdx jdx changed the title test: port 8 cases from pnpm install/misc.ts feat(cli): aube add bootstraps package.json + 10 misc.ts ports Apr 30, 2026
@jdx jdx merged commit ad4b5a4 into main Apr 30, 2026
20 checks passed
@jdx jdx deleted the claude/pnpm-misc-batch-1 branch April 30, 2026 22:05
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