Skip to content

feat: add vite_command crate for command execution#296

Merged
fengmk2 merged 2 commits intomainfrom
11-11-feat_run_command_with_fspy
Nov 20, 2025
Merged

feat: add vite_command crate for command execution#296
fengmk2 merged 2 commits intomainfrom
11-11-feat_run_command_with_fspy

Conversation

@fengmk2
Copy link
Member

@fengmk2 fengmk2 commented Nov 11, 2025

TL;DR

Add a new vite_command crate for executing commands with file system access tracking.

What changed?

  • Created a new vite_command crate that provides utilities for running commands with file system access tracking using fspy
  • Added JavaScript bindings to expose this functionality to the CLI
  • Implemented runCommand() function that can be imported from @voidzero-dev/vite-plus/binding
  • Updated CI workflow to run the new tests
  • Fixed stdio streams on Unix platforms to prevent issues with file descriptors

How to test?

  1. Run the new tests:

    pnpm --filter=@voidzero-dev/vite-plus test
    
  2. Try using the new API in JavaScript:

    import { runCommand } from '@voidzero-dev/vite-plus/binding';
    
    const result = await runCommand({
      binName: 'node',
      args: ['-e', 'console.log("Hello, world!")'],
      envs: { PATH: process.env.PATH },
      cwd: process.cwd(),
    });
    
    console.log(`Exit code: ${result.exitCode}`);
    console.log(`Path accesses:`, result.pathAccesses);

Why make this change?

This change provides a robust way to track file system accesses made by child processes, which is essential for features like dependency tracking, caching, and build optimization. By exposing this functionality through JavaScript bindings, it enables the CLI to implement more intelligent build tools that can understand exactly which files are being read or written during command execution.

Copy link
Member Author

fengmk2 commented Nov 11, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@fengmk2 fengmk2 force-pushed the 11-11-feat_run_command_with_fspy branch 3 times, most recently from ceedc0a to e10f17a Compare November 11, 2025 05:55
@fengmk2 fengmk2 changed the title feat: run command with fspy feat: add vite_command crate for process execution Nov 11, 2025
@fengmk2 fengmk2 changed the title feat: add vite_command crate for process execution feat: add vite_command crate for command execution Nov 11, 2025
@fengmk2 fengmk2 force-pushed the 11-11-feat_run_command_with_fspy branch 16 times, most recently from bfc2e9e to 5826052 Compare November 12, 2025 07:42
@fengmk2 fengmk2 force-pushed the 11-11-feat_run_command_with_fspy branch 4 times, most recently from 70c2e15 to 2e9276a Compare November 15, 2025 08:04
@fengmk2 fengmk2 force-pushed the 11-11-feat_run_command_with_fspy branch from 2e9276a to 06cf754 Compare November 15, 2025 08:32
@fengmk2 fengmk2 force-pushed the 11-11-feat_run_command_with_fspy branch from f409ec7 to dbd0974 Compare November 19, 2025 07:09
Copilot AI review requested due to automatic review settings November 19, 2025 08:21
@fengmk2 fengmk2 force-pushed the 11-11-feat_run_command_with_fspy branch from dbd0974 to af40762 Compare November 19, 2025 08:21
@fengmk2 fengmk2 force-pushed the 11-11-feat_run_command_with_fspy branch from af40762 to bc1410d Compare November 19, 2025 08:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 16 out of 18 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fengmk2 fengmk2 force-pushed the 11-11-feat_run_command_with_fspy branch from bc1410d to d258eb1 Compare November 19, 2025 09:00
Copilot AI review requested due to automatic review settings November 19, 2025 09:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 17 out of 19 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fengmk2 fengmk2 force-pushed the 11-11-feat_run_command_with_fspy branch from 4786a76 to 8ba34bc Compare November 19, 2025 09:49
Copilot AI review requested due to automatic review settings November 19, 2025 10:03
@fengmk2 fengmk2 force-pushed the 11-11-feat_run_command_with_fspy branch from 8ba34bc to 59f106d Compare November 19, 2025 10:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 16 out of 18 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fengmk2 fengmk2 force-pushed the 11-11-feat_run_command_with_fspy branch from 59f106d to 4fd6e56 Compare November 19, 2025 11:05
@fengmk2 fengmk2 requested a review from Brooooooklyn November 19, 2025 12:36
@fengmk2 fengmk2 merged commit bb0f097 into main Nov 20, 2025
12 checks passed
Copy link
Member Author

fengmk2 commented Nov 20, 2025

Merge activity

@fengmk2 fengmk2 deleted the 11-11-feat_run_command_with_fspy branch November 20, 2025 07:07
graphite-app bot pushed a commit that referenced this pull request Mar 26, 2026
…#1096)

## Summary

- Bump vite-task to [2663222c](voidzero-dev/vite-task#296) which merges synthetic task's `input` config with parent cache config and supports `GlobWithBase` with `InputBase::Workspace`
- Add `!node_modules/.vite-temp/**` negative input glob (workspace-root-relative) to Pack and Build subcommands
- Update test for `trailing_var_arg` CLI parsing change
- Add comprehensive snap tests for cache behavior

Vite writes transient compiled config files to `node_modules/.vite-temp/` during builds. These files were tracked by fspy as both read and written, causing a read-write overlap that prevented caching ("not cached because it modified its input").

The fix passes `!node_modules/.vite-temp/**` as a `GlobWithBase { base: InputBase::Workspace }` negative glob via `EnabledCacheConfig.input` on Pack and Build subcommands. vite-task PR [#296](voidzero-dev/vite-task#296) ensures this glob is resolved relative to the workspace root and merged into the parent task's input config.

vite-task changelog: voidzero-dev/vite-task@69cc6eb...2663222#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed

## Snap tests

| Test | Verifies |
| --- | --- |
| `command-pack-monorepo` | cache hit (root + sub dir), source change miss, direct `vp pack` not cached |
| `vp-build-cache` | cache hit via `vp run`, direct `vp build` not cached |
| `vp-build-cache-monorepo` | cache hit (root + sub dir), source change miss, direct `vp build` not cached |
| `vp-pack-cache-disabled` | `cache: false` disables caching for `vp pack` |
| `vp-build-cache-disabled` | `cache: false` disables caching for `vp build` |

## Test plan

- [x] `cargo check` and `cargo test` pass (with `-D warnings`)
- [x] All snap tests pass locally
- [x] CI passes on all platforms

Closes #1095

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.

4 participants