Skip to content

Commit 036aff0

Browse files
authored
docs: update AGENTS.md with new package structure and skills (#198)
1 parent cfdce12 commit 036aff0

File tree

2 files changed

+59
-60
lines changed

2 files changed

+59
-60
lines changed

AGENTS.md

Lines changed: 58 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,71 @@
11
# AGENTS GUIDE
22

3-
Quick reference for future agents working on this repo.
4-
53
## Stack & Structure
6-
- Monorepo via `pnpm` workspaces; builds orchestrated with `turbo`.
7-
- ESM TypeScript everywhere; bundling with `tsdown`.
8-
- Key packages:
9-
- `packages/core` (`@vitejs/devtools`): Vite plugin, CLI, host/runtime (docks, views, terminals), websocket RPC server, standalone/webcomponents client.
10-
- `packages/kit` (`@vitejs/devtools-kit`): public types/utilities (`defineRpcFunction`, shared state, events) for integration authors; client helpers.
11-
- `packages/rpc` (`@vitejs/devtools-rpc`): thin typed RPC wrapper over `birpc`, with WS presets.
12-
- `packages/rolldown` (`@vitejs/devtools-rolldown`): Nuxt-based UI served from the plugin; registers Vite dock and RPC functions for Rolldown build data.
13-
- `packages/webext`: browser extension scaffolding (currently ancillary).
14-
- Docs under `docs/` (VitePress); user-facing guides in `docs/guide`.
15-
- Path aliases defined in `alias.ts` and propagated to `tsconfig.base.json` (do not edit paths manually).
4+
5+
Monorepo (`pnpm` workspaces + `turbo`). ESM TypeScript; bundled with `tsdown`. Path aliases in `alias.ts` (propagated to `tsconfig.base.json` — do not edit manually).
6+
7+
### Packages
8+
9+
| Package | npm | Description |
10+
|---------|-----|-------------|
11+
| `packages/core` | `@vitejs/devtools` | Vite plugin, CLI, runtime hosts (docks, views, terminals), WS RPC server, standalone/webcomponents client |
12+
| `packages/kit` | `@vitejs/devtools-kit` | Public types/utilities for integration authors (`defineRpcFunction`, shared state, events, client helpers) |
13+
| `packages/rpc` | `@vitejs/devtools-rpc` | Typed RPC wrapper over `birpc` with WS presets |
14+
| `packages/ui` | `@vitejs/devtools-ui` | Shared UI components, composables, and UnoCSS preset (`presetDevToolsUI`). Private, not published |
15+
| `packages/rolldown` | `@vitejs/devtools-rolldown` | Nuxt UI for Rolldown build data. Serves at `/.devtools-rolldown/` |
16+
| `packages/vite` | `@vitejs/devtools-vite` | Nuxt UI for Vite DevTools (WIP). Serves at `/.devtools-vite/` |
17+
| `packages/self-inspect` | `@vitejs/devtools-self-inspect` | Meta-introspection — DevTools for the DevTools. Serves at `/.devtools-self-inspect/` |
18+
| `packages/webext` || Browser extension scaffolding (ancillary) |
19+
20+
Other top-level directories:
21+
- `docs/` — VitePress docs; guides in `docs/guide/`
22+
- `skills/` — Agent skill files generated from docs via [Agent Skills](https://agentskills.io/home). Structured references (RPC patterns, dock types, shared state, project structure) for AI agent context.
1623

1724
```mermaid
1825
flowchart TD
19-
core["@vitejs/devtools"] --> kit["@vitejs/devtools-kit"]
20-
core --> rpc["@vitejs/devtools-rpc"]
21-
core --> rolldownUI["@vitejs/devtools-rolldown (Nuxt UI)"]
22-
rolldownUI --> kit
23-
rolldownUI --> rpc
24-
webext["@vitejs/devtools-webext"] --> core
26+
core["core"] --> kit & rpc
27+
core --> rolldown & vite & self-inspect
28+
rolldown --> kit & rpc & ui
29+
vite --> kit & rpc & ui
30+
self-inspect --> kit & rpc
31+
webext --> core
2532
```
2633

27-
## Runtime Architecture (high level)
28-
- Plugin entry (`createDevToolsContext` in `packages/core/src/node/context.ts`) builds a `DevToolsNodeContext` with hosts for RPC, docks, views, terminals. It registers built-in RPC functions and invokes `plugin.devtools.setup` hooks from Vite plugins.
29-
- Node context vs client context:
30-
- **Node context**: server-side state (cwd, workspaceRoot, vite config, mode, rpc/docks/views/terminals hosts) plus internal storage (auth) from `context-internal.ts`. Used by plugins and RPC handlers.
31-
- **Client context**: webcomponents/Nuxt UI state (`packages/core/src/client/webcomponents/state/*`), holding dock entries, selected panels, and RPC client; created with `clientType` of `embedded` or `standalone`.
32-
- Websocket server (`packages/core/src/node/ws.ts`) exposes RPC via `@vitejs/devtools-rpc/presets/ws`. Auth is skipped in build mode or when `devtools.clientAuth` is `false`; trusted IDs stored under `node_modules/.vite/devtools/auth.json`.
33-
- DevTools middleware (`packages/core/src/node/server.ts`) serves connection meta and standalone client assets.
34-
- The Rolldown UI plugin (`packages/rolldown/src/node/plugin.ts`) registers RPC functions (Rolldown data fetchers) and hosts the Nuxt-generated static UI at `/.devtools-rolldown/`, adding a dock entry.
35-
- Nuxt app config (`packages/rolldown/src/nuxt.config.ts`): SPA, base `/.devtools-rolldown/`, disables Nuxt devtools, enables typed pages, uses Unocss/VueUse; sets `vite.devtools.clientAuth = false` for UI.
34+
## Architecture
3635

37-
## Client Modes (kit/core)
38-
- **Embedded mode**: default overlay injected into the host app; docks render inside the app shell; use `clientType: 'embedded'` when creating client context.
39-
- **Standalone mode**: runs the webcomponents UI as an independent page (see `packages/core/src/client/standalone`); useful for external access or when not injecting into the host app UI.
36+
- **Entry**: `createDevToolsContext` (`packages/core/src/node/context.ts`) builds `DevToolsNodeContext` with hosts for RPC, docks, views, terminals. Invokes `plugin.devtools.setup` hooks.
37+
- **Node context**: server-side (cwd, vite config, mode, hosts, auth storage at `node_modules/.vite/devtools/auth.json`).
38+
- **Client context**: webcomponents/Nuxt UI state (`packages/core/src/client/webcomponents/state/*`) — dock entries, panels, RPC client. Two modes: `embedded` (overlay in host app) and `standalone` (independent page).
39+
- **WS server** (`packages/core/src/node/ws.ts`): RPC via `@vitejs/devtools-rpc/presets/ws`. Auth skipped in build mode or when `devtools.clientAuth` is `false`.
40+
- **Nuxt UI plugins** (rolldown, vite, self-inspect): each registers RPC functions and hosts static Nuxt SPA at its own base path.
4041

41-
## Development Workflow
42-
- Install: `pnpm install` (repo requires `pnpm@10.x`).
43-
- Build all: `pnpm build` (runs `turbo run build`; for UI data, build generates Rolldown metadata under `packages/rolldown/node_modules/.rolldown`).
44-
- Dev:
45-
- Core playground: `pnpm -C packages/core run play`
46-
- Rolldown UI: `pnpm -C packages/rolldown run dev`
47-
- Standalone core client: `pnpm -C packages/core run dev:standalone`
48-
- Tests: `pnpm test` (Vitest; projects under `packages/*` and `test`).
49-
- Typecheck: `pnpm typecheck` (via `vue-tsc -b`).
50-
- Lint: `pnpm lint`
51-
- Use `pnpm lint --fix` to auto-resolve common issues.
52-
- Docs: `pnpm -C docs run docs` / `docs:build` / `docs:serve`.
42+
## Development
5343

54-
## Conventions & Guardrails
55-
- Prefer workspace imports via aliases from `alias.ts`.
56-
- Keep RPC additions typed; use `defineRpcFunction` from kit when adding server functions.
57-
- Docks/views/terminals are registered through hosts on `DevToolsNodeContext`; mutations should update shared state (`@vitejs/devtools-kit/utils/shared-state`).
58-
- When touching websocket auth or storage, note persisted state lives in `node_modules/.vite/devtools/auth.json` (created by `createStorage`).
59-
- For Nuxt UI changes, base path must remain `/.devtools-vite/`; keep `clientAuth` considerations in mind if exposing over network.
60-
- Project is currently focused on Rolldown build-mode analysis; dev-mode support is deferred.
44+
```sh
45+
pnpm install # requires pnpm@10.x
46+
pnpm build # turbo run build
47+
pnpm test # Vitest
48+
pnpm typecheck # vue-tsc -b
49+
pnpm lint --fix # ESLint
50+
pnpm -C packages/core run play # core playground
51+
pnpm -C packages/rolldown run dev # rolldown UI dev
52+
pnpm -C packages/core run dev:standalone # standalone client
53+
pnpm -C docs run docs # docs dev server
54+
```
55+
56+
## Conventions
57+
58+
- Use workspace aliases from `alias.ts`.
59+
- RPC functions must use `defineRpcFunction` from kit; always namespace IDs (`my-plugin:fn-name`).
60+
- Shared state via `@vitejs/devtools-kit/utils/shared-state`; keep values serializable.
61+
- Nuxt UI base paths: `/.devtools-rolldown/`, `/.devtools-vite/`, `/.devtools-self-inspect/`.
62+
- Shared UI components/preset in `packages/ui`; use `presetDevToolsUI` from `@vitejs/devtools-ui/unocss`.
63+
- Currently focused on Rolldown build-mode analysis; dev-mode support is deferred.
6164

62-
## Useful Paths
63-
- Core runtime: `packages/core/src/node/*`
64-
- Core webcomponents: `packages/core/src/client/webcomponents`
65-
- Kit utilities: `packages/kit/src/utils/*`
66-
- RPC presets: `packages/rpc/src/presets/ws/*`
67-
- Rolldown UI app: `packages/rolldown/src/app`
68-
- Docs: `docs/guide/*`
65+
## Before PRs
66+
67+
```sh
68+
pnpm lint && pnpm test && pnpm typecheck && pnpm build
69+
```
6970

70-
## Quick Checks Before PRs
71-
- Run `pnpm lint && pnpm test && pnpm typecheck`.
72-
- Ensure `pnpm build` succeeds (regenerates Rolldown metadata if needed).
73-
- Follow conventional commit style (`feat:`, `fix:`, etc.). README flags project as WIP; set expectations accordingly.
71+
Follow conventional commits (`feat:`, `fix:`, etc.).

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
AGENTS.md

0 commit comments

Comments
 (0)