Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ jobs:
if: ${{ !cancelled() && steps.install.outcome == 'success' }}
run: pnpm dedupe --check

# Install rewrites the Vite+ block in AGENTS.md from the installed
# vite-plus. Dependabot bumps skip that, so a stale block fails here.
- name: Check the Vite+ block in AGENTS.md is current
if: ${{ !cancelled() && steps.install.outcome == 'success' }}
run: git diff --exit-code AGENTS.md

- name: Run type, lint, and format checks
if: ${{ !cancelled() && steps.install.outcome == 'success' }}
run: pnpm checks
Expand Down
45 changes: 38 additions & 7 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,47 @@ Every code review, including `/code-review`, uses these standards sources:

Pass `REVIEW.md` by path to every reviewer sub-agent, not only the standards one. Sub-agents don't always load this file.

<!-- `vp config` rewrites the Vite+ block below from node_modules/vite-plus on install, so edits inside it are lost. The ignore markers stop the formatter from reflowing it, which would fight that rewrite. -->
<!-- prettier-ignore-start -->
<!--VITE PLUS START-->

# Using Vite+, the Unified Toolchain for the Web

This project is using Vite+, a unified toolchain built on top of Vite, Rolldown, Vitest, tsdown, Oxlint, Oxfmt, and Vite Task. Vite+ wraps runtime management, package management, and frontend tooling in a single global CLI called `vp`. Vite+ is distinct from Vite, and it invokes Vite through `vp dev` and `vp build`. Run `vp help` to print a list of commands and `vp <command> --help` for information about a specific command.

Docs are local at `node_modules/vite-plus/docs` or online at https://viteplus.dev/guide/.

## Built-in Commands vs Scripts

`vp <name>` runs a built-in command. `vp run <name>` runs a `package.json` script or a `vite.config.ts` task. Scripts cannot overwrite built-ins, so `vp dev` and `vp run dev` may do different things. Check `package.json` and `vite.config.ts` first, and run `vp run <name>` when the project defines a script or task with that name.

## Tool Versions

Run `vp toolchain` to show versions and relationships in the active Vite+
release. Add a tool name to select part of the graph. For example, run
`vp toolchain vite`. Use `--global` to ignore the local `vite-plus` package. Use
`vp why <package>` to show the package-manager dependency graph.

## Review Checklist

- [ ] Run `vp install` after pulling remote changes and before getting started.
- [ ] Run `vp check` and `vp test` to format, lint, type check and test changes.
- [ ] Check if there are `vite.config.ts` tasks or `package.json` scripts necessary for validation, run via `vp run <script>`.
- [ ] If setup, runtime, or package-manager behavior looks wrong, run `vp env doctor` and include its output when asking for help.

<!--VITE PLUS END-->
<!-- prettier-ignore-end -->

## Commands

Run from project root. Prefer these `pnpm` scripts. `vp` subcommands (`vp test`, `vp lint`, `vp fmt`, `vp check`) are fine to run directly, since `vp` resolves the project's pinned Vite+ and its config; use `pnpm exec vp` if the global CLI isn't installed. `vp check` runs format, lint, and type checks. Never invoke `tsc`, `tsgo`, `vitest`, `oxlint`, or `oxfmt` directly or via `pnpx`, because bare tools use the wrong version and miss project context.
Run from the project root. Bare `tsc`, `tsgo`, `vitest`, `oxlint`, and `oxfmt` use the wrong version and miss project context, so always go through `vp`, never through those tools directly or via `pnpx`. Without the global `vp` CLI, prefix each command with `pnpm exec`. The `pnpm` scripts in `package.json` are aliases for humans.

- `pnpm checks` — all static checks (types + lint + format); default validation for small changes
- `pnpm check:lint` / `pnpm lint` — lint / lint and fix
- `pnpm check:format` / `pnpm format` — check / fix formatting
- `pnpm test` — run all tests
- `pnpm test <path>` — test files matching a path substring (file, dir, or partial)
- `pnpm test -t "suite > name"` — test by name, with segments joined by a spaced `>` exactly as the reporter prints them; a single segment such as `-t "renders empty state"` also works (no `--` separator; pnpm forwards args verbatim, unlike npm)
- `vp check` — format, lint, and type checks; default validation for small changes
- `vp check --fix` — the same, fixing what it can
- `vp test` — run all tests once
- `vp test <path>` — test files matching a path substring (file, dir, or partial)
- `vp test -t "suite > name"` — test by name, with segments joined by a spaced `>` exactly as the reporter prints them; a single segment such as `-t "renders empty state"` also works
- `pnpm dedupe --check` — after a dependency change, confirms the lockfile has no drift; CI runs it

## Agent skills

Expand Down
8 changes: 4 additions & 4 deletions docs/agents/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Vitest. Tests co-locate with source as `*.test.ts` (or `*.test.tsx` for componen

## Where tests live

Vitest collects only the projects listed in `test.projects` of the root `vite.config.ts`, currently just `packages/*`. A test file outside those is never collected, and `pnpm test` still reports green, so adding a new top-level test directory means giving it a `vite.config.ts` and adding it to that list.
Vitest collects only the projects listed in `test.projects` of the root `vite.config.ts`, currently just `packages/*`. A test file outside those is never collected, and `vp test` still reports green, so adding a new top-level test directory means giving it a `vite.config.ts` and adding it to that list.

Each project sets up its own environment. `setupTests.ts` below is registered by `packages/graph-explorer` only. `packages/graph-explorer-proxy-server` has its own setup file, and `packages/shared` has no setup file, so any tests added there must reset their own mocks.

Expand Down Expand Up @@ -74,9 +74,9 @@ test("filters vertices by type", () => {

Commands are in AGENTS.md.

- Small change: `pnpm checks`, plus `pnpm test <path>` for the area you touched
- Before a PR, or after touching shared utilities, core providers, or type definitions: `pnpm test`
- No associated tests (config or type-only change): `pnpm checks`
- Small change: `vp check`, plus `vp test <path>` for the area you touched
- Before a PR, or after touching shared utilities, core providers, or type definitions: `vp test`
- No associated tests (config or type-only change): `vp check`

## Special cases

Expand Down
3 changes: 1 addition & 2 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ A major bump is also where `pnpm-workspace.yaml` deserves a read. Since pnpm 12,

[Vite+](https://viteplus.dev) runs linting, formatting, type checking, tests, and the pre-commit hook. It's a dev dependency, so `pnpm install` is all the setup it needs. Run `pnpm checks` for lint, format, and type checks, `pnpm test` or `pnpm test:watch` for tests, and `pnpm lint` or `pnpm format` to fix issues. A global `vp` CLI is optional; without one, `pnpm exec vp` works.

- Run `pnpm install` after pulling the switch to Vite+. It moves your pre-commit hook from Husky to `vp staged`.
- If `pnpm install` prints `core.hooksPath is already set`, your clone or global Git config points hooks somewhere else, and the Vite+ hook isn't installed. Run `git config --unset core.hooksPath` (add `--global` if the value is global), then `pnpm install` again.
- If the pre-commit hook never runs, or `pnpm install` prints `core.hooksPath is already set`, the Vite+ hook isn't installed, because your clone or global Git config points hooks somewhere else. Clones from before the switch to Vite+ still point at Husky. Run `git config --unset core.hooksPath` (add `--global` if the value is global), then `pnpm run prepare`.
- In VS Code, install the recommended Vite+ extension pack. In Zed, install `oxc-zed`.

## Run in development mode
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"author": "amazon",
"type": "module",
"scripts": {
"prepare": "(git config --unset core.hooksPath husky || cd .) && vp config --no-agent",
"prepare": "vp config",
"lint": "vp lint --fix",
"check:lint": "vp lint",
"format": "vp fmt",
Expand Down
Loading