fix(cli): why/list/query work from a workspace subpackage#504
Conversation
`aube why`, `aube list`, and `aube query` were resolving the cwd via `project_or_workspace_root`, which prefers the nearest `package.json`. Inside a workspace member like `packages/foo/`, that returned the subpackage directory and `parse_lockfile` then failed with "No lockfile found. Run `aube install` first." even though the workspace lockfile sat one level up. Switch all three commands to `workspace_or_project_root` so they walk up to the workspace root when one is present and fall back to the nearest project root for non-workspace trees (and yaml-only coordinator monorepos). Drop the now-dead `project_or_workspace_root` helper and its zero-call-site read-from override branches in `list` / `query`. Reported in #345. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Greptile SummaryFixes Confidence Score: 5/5Safe to merge — read-only CLI behavior change with full test coverage and no remaining callers of the removed helper. All changes are narrowly scoped to root-resolution logic for read commands, the removed function has no remaining callers, the new behavior is exactly what pnpm users expect, and three targeted regression tests exercise the fixed paths end-to-end. No files require special attention. Important Files Changed
Reviews (3): Last reviewed commit: "refactor(cli): drop redundant list.rs re..." | Re-trigger Greptile |
Yaml-only coordinator monorepos carry `pnpm-workspace.yaml` / `aube-workspace.yaml`, so `find_workspace_root` matches them on the first branch — they never reach the project-root fallback. Reword the fallback clause to cover only true non-workspace trees. Spotted by Greptile in code review. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a742e2e. Configure here.
After the workspace-root switch, `read_from` was always `cwd.clone()` — the conditional that produced a divergent value was removed in the previous commit but the variable was left behind. Inline every reference to use `&cwd` directly and drop the dead clone. Spotted by Cursor Bugbot in code review. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Summary
aube why,aube list, andaube queryresolved cwd viaproject_or_workspace_root, which returns the nearestpackage.json. Inside a workspace member likepackages/foo/, that returned the subpackage directory andparse_lockfilethen failed withNo lockfile found. Run aube install first.even though the workspace lockfile sat one level up.workspace_or_project_rootso they walk up to the workspace root when one is present and fall back to the nearest project root for non-workspace trees (and yaml-only coordinator monorepos).project_or_workspace_roothelper and the zero-call-siteread_fromoverride branches inlist/query.Reported in #345.
Test plan
cargo build,cargo fmt --check,cargo clippy -p aube --all-targets -- -D warningscargo test -p aube --bin aube(393 tests pass)mise run test:bats test/why.bats test/list.bats test/query.bats test/project_root_walk_up.bats(47/47 pass, including 3 new regression tests)packages/lib-adeclaringis-odd;cd packages/lib-a && aube {why is-number, list, query '[name=is-number]' --parseable}all succeed instead of erroring.🤖 Generated with Claude Code
Note
Low Risk
Low risk: changes are limited to CLI cwd/root resolution for read-only commands and add regression tests; main risk is altered root selection in edge-case directory layouts.
Overview
Fixes
aube list,aube query, andaube whyto prefer the workspace root (when present) over the nearestpackage.json, so running from a workspace member directory reads the correct root lockfile/manifest instead of erroring with missing lockfile.Removes the now-unused
project_or_workspace_roothelper and simplifies the commands’ root-selection logic, and adds Bats regression tests covering running each command from a subpackage cwd in a pnpm workspace.Reviewed by Cursor Bugbot for commit 02e36fd. Bugbot is set up for automated code reviews on this repo. Configure here.