Skip to content

feat(run): print the task graph as JSON with vp run --json - #948

Open
wan9chi wants to merge 2 commits into
claude/user-temp-artifactsfrom
claude/task-graph-json
Open

wan9chi wants to merge 2 commits into
claude/user-temp-artifactsfrom
claude/task-graph-json

Conversation

@wan9chi

@wan9chi wan9chi commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Motivation

Shell completion, editor task panels, CI scripts and coding agents need the workspace's tasks, and how they depend on each other, without parsing text or loading every vite.config.* themselves (#320, voidzero-dev/vite-plus#2848, voidzero-dev/vite-plus#1182). The task graph RFC specifies vp run --json for this, and this PR implements it.

Changes

  • vp run --json prints every package and every task in the workspace, with each task's dependsOn resolved to task IDs. It's indented when stdout is a terminal and on one line otherwise. A one-element command array prints as a string.
  • Like vp run without a task, it loads every package's config, now that configs load lazily (feat(task-graph): load a package's config only when a run reads its tasks #944). A broken config in any package fails the whole command: the error goes to stderr, and nothing goes to stdout. A dependsOn cycle isn't an error.
  • --json is exclusive, like --last-details.
  • $schema: a test generates crates/vt/schemas/task-graph.json from the document's Rust types with schemars, which is only a dev-dependency, using the types' doc comments as descriptions. artifact! embeds that file. Each --json run copies it to task-graph_<hash>.json in the user's own vp-schemas folder in the system temp directory (fix: materialize artifacts in the user's own temp folder #947), unless it's already there, and $schema is that file's file:// URL.
  • vtt pipe-stdout lets an e2e step snapshot what a command prints when its stdout isn't a terminal.
  • RFC updates:
    • $schema points to the temp-directory copy rather than to a file in the vite-plus package.
    • A one-element command prints as a string.
    • The task graph is printed even when dependsOn entries form a cycle.
    • --json loads every config.

Keeping output that a config prints while loading off stdout, which the RFC requires, is left for later. Only vite-plus's in-process vite.config.* loader can print.

🤖 Generated with Claude Code


Note

Low Risk
New read-only CLI path with extensive snapshot/e2e coverage; behavior changes are limited to additive --json output and temp-dir schema writes, not task execution or caching.

Overview
Adds vp run --json, which loads every package config (same as listing tasks), runs nothing, and prints one JSON document with all workspace packages, tasks, and resolved dependsOn task IDs. Output is pretty-printed on a TTY and compact when stdout is piped; --json is mutually exclusive with other run modes (task name, -r, etc.).

The payload includes $schema, version, workspaceRoot, and stable task ID encoding (# / % escaped). A committed schemas/task-graph.json is generated from Rust document types via schemars and embedded at build time; each run materializes it under a per-user temp vp-schemas folder and points $schema at a file:// URL (RFC/docs updated accordingly).

Supporting work: new task_graph_json session module, public package_graph() on the indexed graph, optional schemars on Str, vtt pipe-stdout for e2e snapshots of captured stdout, and a seccomp macro cast fix so adding serde_json/schemars does not break syscall-number comparisons.

Reviewed by Cursor Bugbot for commit 19e4c82. Bugbot is set up for automated code reviews on this repo. Configure here.

@wan9chi
wan9chi added this pull request to stack #949 November 6, 2026 01:31
@socket-security

socket-security Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedcargo/​schemars@​1.2.3100100100100100

View full report

`vp run --json` prints every package and task in the workspace, with
each task's `dependsOn` resolved to task IDs, as one JSON document, as
docs/rfcs/task-graph-json.md specifies. Like `vp run` without a task, it
loads every package's config, and a broken one fails the whole command.

- The document types live in `vt::session::task_graph_json`. A test
  generates `crates/vt/schemas/task-graph.json` from them with schemars,
  which is only a dev-dependency.
- `artifact!` embeds that schema, and each `--json` run copies it to
  `task-graph_<hash>.json` in the user's own `vp-schemas` folder in the
  system temp directory, unless it's already there. `$schema` points to
  that copy.
- `--json` is exclusive, like `--last-details`.
- `vtt pipe-stdout` lets an e2e step snapshot what a command prints when
  its stdout isn't a terminal.
- The RFCs describe the temp-directory schema, and say that a
  `dependsOn` cycle doesn't stop the task graph from printing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wan9chi
wan9chi force-pushed the claude/task-graph-json branch from dda3eb3 to 1c6ac94 Compare November 6, 2026 01:31
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

fspy benchmark

linux

dynamic/launch             change  -0.06%  [ -3.62% ..  +3.16%]  overhead   +57.20%
dynamic/access             change  +0.36%  [ -3.67% ..  +3.41%]  overhead   +21.40%
dynamic/access-relative    change  +0.00%  [ -2.14% ..  +2.49%]  overhead   +68.92%
dynamic/access-contended   change  +0.94%  [ -3.94% ..  +5.16%]  overhead   +56.69%
static/launch              change  +0.06%  [ -2.86% ..  +3.77%]  overhead  +200.86%
static/access              change  +0.30%  [ -0.93% ..  +1.47%]  overhead +1474.64%
static/access-relative     change  +0.22%  [ -1.18% ..  +0.99%]  overhead +1969.71%
static/access-contended    change  +0.07%  [ -0.96% ..  +1.45%]  overhead +1886.00%

macos

dynamic/launch             change  +0.12%  [ -2.98% ..  +3.56%]  overhead  +235.30%
dynamic/access             change  -0.38%  [ -3.07% ..  +2.71%]  overhead    +3.85%
dynamic/access-relative    change  +0.33%  [ -2.18% ..  +2.62%]  overhead  +258.19%
dynamic/access-contended   change  +0.30%  [ -2.67% ..  +3.69%]  overhead    +3.34%

windows

dynamic/launch             change  +0.88%  [ -6.93% ..  +8.35%]  overhead   +28.06%
dynamic/access             change  -0.18%  [ -1.26% ..  +0.92%]  overhead    +1.47%
dynamic/access-relative    change  +0.00%  [ -0.90% ..  +0.90%]  overhead    +1.43%
dynamic/access-contended   change  -0.17%  [ -1.71% ..  +0.88%]  overhead    +1.76%

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1c6ac94. Configure here.

Comment thread crates/vt_bin/src/vtt/pipe_stdout.rs Resolved
- fspy's seccomp handler compared syscall numbers with `as _`, which
  became ambiguous once `--all-features` (vt_str's new `schemars`
  feature) brought serde_json's `PartialEq<Value> for i32` into fspy's
  dependency graph. The cast now names `c_int`.
- The schema test reads `CARGO_MANIFEST_DIR` at runtime: CI builds the
  Windows tests on Linux, so `env!` gave a Linux path.
- The plan fixture no longer has a task with `cwd: ".."`: the internal
  `task_graph.md` dump keeps the `..` on Unix but not on Windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wan9chi wan9chi added ci: full Run the slow CI jobs (macOS x64, musl) on this pull request and removed ci: full Run the slow CI jobs (macOS x64, musl) on this pull request labels Nov 6, 2026

This branch has not been deployed

No deployments
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