Skip to content

docs: add RFC for enhanced dependsOn syntax#322

Draft
branchseer wants to merge 8 commits intomainfrom
depends-on-rfc
Draft

docs: add RFC for enhanced dependsOn syntax#322
branchseer wants to merge 8 commits intomainfrom
depends-on-rfc

Conversation

@branchseer
Copy link
Copy Markdown
Member

Summary

  • Proposes two styles for enhanced dependsOn entries that reuse the existing vp run CLI mental model instead of inventing new symbols
  • Style 1 (CLI string): entries written as CLI args, e.g. "--transitive build", ["--filter", "@myorg/core", "build"]
  • Style 2 (object): keys mirror CLI flag names, e.g. { "transitive": true, "task": "build" }

Test plan

  • Review RFC content for correctness and completeness

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@branchseer branchseer marked this pull request as draft April 6, 2026 17:28
branchseer and others added 2 commits April 7, 2026 09:14
Task name is passed as the value of the flag key (e.g. `{ "transitive": "build" }`)
instead of a separate `task` field with a boolean flag.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@fengmk2
Copy link
Copy Markdown
Member

fengmk2 commented Apr 7, 2026

+1 for "Object syntax"

@ubugeeei
Copy link
Copy Markdown
Collaborator

ubugeeei commented Apr 7, 2026

btw, what happens in this case when there’s a circular reference?

@kazupon
Copy link
Copy Markdown
Contributor

kazupon commented Apr 8, 2026

btw, what happens in this case when there’s a circular reference?

I think Error::CycleDependencyDetected will be occured.

@branchseer
Copy link
Copy Markdown
Member Author

btw, what happens in this case when there’s a circular reference?

Yes Error::CycleDependencyDetected:

Error: Cycle dependency detected: error-cycle-dependency-test#task-a -> error-cycle-dependency-test#task-b -> error-cycle-dependency-test#task-a

branchseer and others added 5 commits April 12, 2026 10:16
Keep only the object syntax, removing the alternative CLI string array
style and the comparison table.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds a new package selection flag that selects only the direct (one-hop)
dependencies of the current package, excluding the package itself. This
is the equivalent of Turborepo/Nx's `^` prefix in `dependsOn`.

Unlike `--transitive` which walks the full transitive closure,
`--direct` stops after one hop. All dependency types (dependencies,
devDependencies, peerDependencies) are traversed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the three mutually exclusive booleans (`recursive`, `transitive`,
`direct`) with a `TraversalMode` enum resolved via `from_flags()`. Clap's
`group = "traversal"` enforces mutual exclusivity at parse time; the enum
makes it explicit in the type system.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fixes clippy errors introduced by the `--direct` flag work:

- `to_graph_traversal`: merge identical `Recursive`/`Transitive` arms
  (`match_same_arms`) and mark `const fn` (`missing_const_for_fn`).
  Both modes produce the same graph traversal; they differ only in how
  seeds are chosen, which is decided in `into_package_query`.
- `from_flags`: mark `const fn` (`missing_const_for_fn`).
- `PackageQueryArgs`: silence `struct_excessive_bools` with `#[expect]`
  since clap requires separate bool fields for the four CLI flags.
- `into_package_query`: extract the `--filter` token collection into a
  `collect_filter_tokens` helper to bring the function under the
  `too_many_lines` limit.

Fixes the Windows-only `query - direct with filter conflict` snapshot
failure: the `ParsePlanRequest` error formats `cwd:?`, which on Windows
escapes each `\` as `\\`, so the raw `workspace_root_str` redaction
never matched. Unescape the doubled backslashes on Windows before
redacting, so the same `<workspace>/` placeholder appears on both
platforms.

https://claude.ai/code/session_01RyEZx6J2a3SodaA5fzrwk6
The previous attempt unconditionally replaced `\\` with `\` on Windows
to unescape Debug-formatted paths, but this also collapsed the `\\?\`
verbatim prefix in Display-formatted paths used by other errors
(e.g. `ambiguous package name`), breaking those snapshots.

Instead, fix the root cause: format `cwd` with Display (`{cwd}`)
rather than Debug (`{cwd:?}`) in `ParsePlanRequest`. Display uses
`Path::display()` which emits raw backslashes on Windows, so the
existing raw `workspace_root_str` redaction works uniformly. Keep
the surrounding double quotes explicitly in the format string so
the existing `"<workspace>/"` snapshot stays exactly as-is.

Revert the test-side `\\` → `\` unescape now that it is no longer
needed and was breaking previously passing tests.

https://claude.ai/code/session_01RyEZx6J2a3SodaA5fzrwk6
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.

5 participants