fix(add): auto-detect local-path specs instead of hitting the registry#499
fix(add): auto-detect local-path specs instead of hitting the registry#499
Conversation
Greptile SummaryFixes Confidence Score: 5/5Safe to merge — all previously-flagged P1 issues are resolved and no new defects were found. Both P1 findings from the previous review (drive-letter check needing a path-separator guard, No files require special attention. Important Files Changed
Reviews (4): Last reviewed commit: "fix(add): auto-detect bare local paths i..." | Re-trigger Greptile |
c13ebfa to
a9f9aa7
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a9f9aa7. Configure here.
a9f9aa7 to
502e962
Compare
`aube add /path/to/lib` (and `./lib`, `../lib`, `~/lib`, `C:/projects/lib`) used to fall through to the registry path and surface a confusing HTTP 405 from npmjs. The recently-merged `file:` / `link:` support (#487) only handled the prefixed forms. Match pnpm's `parseBareSpecifier`: detect path-shaped specs at parse time and route them through the existing local-path machinery. Bare paths default to `link:` for directories and `file:` for tarballs (pnpm parity); `~/` is expanded eagerly because the resolver has no tilde handling. The drive-letter check requires `/` or `\` after the colon so a single-character npm alias like `a:1.0.0` isn't reclassified as a Windows path. Closes discussions/497. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
502e962 to
94eb716
Compare

Summary
aube add /path/to/lib(and./lib,~/lib,file:./lib,link:./lib) used to fall through to the registry path and surface a confusingHTTP 405 Method Not Allowedfrom npmjsparseBareSpecifier: detect path-shaped specs at parse time, read the target'spackage.jsonfor the package name + version, write the spec verbatim to the manifestlink:for directories andfile:for tarballs (pnpm parity); explicitfile:/link:prefixes are preservedaube addyet — they emit a clear hint pointing at manualpackage.jsonediting rather than the previous 405Reported in discussions/497.
Test plan
parse_pkg_specunit tests cover absolute / relative /~//file:/link:/ tarball / Windows drive-letter / scoped-name (negative) / git-URL (negative)test/add.batscases exercise the end-to-end install pipeline (bare path,file:prefix,link:prefix, tarball-suffix friendly error)cargo test --workspace(1300+ tests) greenmise run test:bats test/add.batsandtest/install.batsgreencargo clippy --all-targets -- -D warningsclean🤖 Generated with Claude Code
Note
Medium Risk
Medium risk because it changes
aube addspec parsing and normalization for a broad set of inputs (POSIX/Windows paths,~/expansion), which could reclassify some previously-registry specs or alter manifest output in edge cases.Overview
aube addnow auto-detects bare path-shaped arguments (absolute/relative/~//Windows drive paths) as local dependencies instead of falling through to the registry fetch path.Bare paths are normalized to
link:by default (orfile:for tarball-looking paths) with eager~/expansion, and local basename derivation now handles Windows\separators. Adds focused unit tests plus a Bats integration test to cover the new local-path detection/normalization behavior and prevent regressions like the prior HTTP 405 on/path/to/lib.Reviewed by Cursor Bugbot for commit 94eb716. Bugbot is set up for automated code reviews on this repo. Configure here.