Repository navigation
Description
Goal. A standalone package that lets a Vitest user run only the tests a change affects, using DiffCI's import graph:
npm i -D @diffci.com/vitest # name to be decided
vitest run --affected # or a plugin option; see design questionsNo account, no DiffCI CLI, no CI step, and nothing sent anywhere. It should feel like part of Vitest, not like a second tool. We want people to find DiffCI through Vitest's own users, the way Supabase grew through Postgres extensions.
What it must do
- Select from the graph, not the diff. Pick the test files DiffCI's planner selects for the working tree, or for a
--base/--headrange, including tests reached through imports, fixtures andvi.mocktargets. - Fall back to the full run, and say why. Do this whenever DiffCI would: config, lockfile or
package.jsonchanges, imports it can't follow, an incomplete graph. Never select fewer tests on uncertain evidence. This is the trust promise ("It's just your CI"). - Explain each pick. Print why each test was selected, and the fallback reason when there is one, in a form a person and an agent can both read.
- Leave Vitest alone otherwise. Workspaces/projects, reporters, coverage and watch mode keep working. Without the option, Vitest behaves exactly as before.
Design questions to settle first, in docs/design/vitest-plugin.md
- Integration point. A Vite/Vitest plugin (for example Vitest's plugin API,
configureVitest; check the current docs and the minimum Vitest version it needs), a custom CLI flag, or a thin wrapper command. What do Vitest's own--changedandvitest relatedalready provide, and how does this differ? See #101. - What it depends on. Import Core's planner directly (
@diffci.com/core, MIT) rather than the whole CLI. Which modules does it need, and is anything missing from Core's public exports? - Package layout and release. A new package under
packages/, with its own entry inrelease-files.json, npm trusted publishing like the CLI, and a version policy. - Multi-project setups. Vitest workspaces and
projects, and monorepos where Vitest runs per package. - Testing. Synthetic Vitest repositories in tests, plus one real public repository named in the design note.
Done when: first, a PR with the design note answering the questions above, reviewed here before any code. Then a first slice that only filters test files and prints the reasons and any fallback, with tests. Watch mode and coverage can come later.
Good background: docs/design/affected-checks.md, docs/change-plan.md, and how the CLI builds a plan in packages/diffci-cli/src/client/. Comment here if you want to take the design note or part of it, and ask anything. Setup and DCO sign-off are in CONTRIBUTING.md.
Activity