Skip to content

Commit a6cd496

Browse files
authored
chore: add AGENTS.md (#392)
1 parent 1948b9a commit a6cd496

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

AGENTS.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# AGENTS.md
2+
3+
This file provides guidance for AI coding agents working in this repository.
4+
5+
## Repository Overview
6+
7+
- This is a monorepo of example projects for the Rstack ecosystem: Rspack, Rsbuild, Rspress, Rsdoctor, and Rslib.
8+
- Package manager: `pnpm` (see `package.json#packageManager`).
9+
- Workspace layout: `pnpm-workspace.yaml` includes `rspack/**`, `rsbuild/**`, `rslib/**`, `rspress/**`, `rsdoctor/**`.
10+
11+
## Quick Start (Local)
12+
13+
Prerequisites:
14+
- Node.js per `.nvmrc`
15+
- `corepack` enabled
16+
17+
Common commands:
18+
- Install deps: `corepack enable && pnpm i`
19+
- Build everything: `pnpm run build`
20+
- Build a group:
21+
- Rspack examples: `pnpm run build:rspack`
22+
- Rsbuild examples: `pnpm run build:rsbuild`
23+
- Rspress examples: `pnpm run build:rspress`
24+
- Rsdoctor examples: `pnpm run build:rsdoctor`
25+
- Rslib examples: `pnpm run build:rslib`
26+
- Test Rspack examples: `pnpm run test:rspack`
27+
28+
Working in a single example:
29+
- `cd rspack/basic` (or any other example dir)
30+
- `pnpm i` (workspace install is preferred at repo root)
31+
- `pnpm run dev` / `pnpm run build` / `pnpm run test` (depends on the example)
32+
33+
## Where Things Live
34+
35+
Top-level directories:
36+
- `rspack/`: Rspack examples (often package name prefix `example-*`).
37+
- `rsbuild/`: Rsbuild examples (often package name prefix `rsbuild-*`).
38+
- `rspress/`: Rspress examples (often package name prefix `rspress-*`).
39+
- `rsdoctor/`: Rsdoctor examples (often package name prefix `rsdoctor-*`).
40+
- `rslib/`: Rslib examples (often package name prefix `rslib-*`).
41+
42+
## Coding Conventions
43+
44+
- Formatting and linting: `Biome` is used (see `biome.json`).
45+
- Default JS/TS quote style is single quotes.
46+
- Line width is 100.
47+
- Prefer minimal, example-focused changes. This repo is a collection of runnable examples; avoid refactors that reduce clarity.
48+
- Keep UI strings and code comments in English unless the surrounding file is already predominantly another language.
49+
50+
## Running/Changing Examples
51+
52+
- Examples are expected to be runnable independently.
53+
- When changing build tooling or config:
54+
- Ensure the example still runs via its `dev` script (if present).
55+
- Ensure `build` works at least for the changed example.
56+
57+
## Dependencies & Workspace Notes
58+
59+
- Prefer adding dependencies at the example package level, not in the repo root, unless the dependency is shared.
60+
- Use `pnpm --filter` to scope commands to a single package or group.
61+
- Example: `pnpm --filter "example-basic" dev`
62+
63+
## Agent Workflow Expectations
64+
65+
When making changes:
66+
- Identify the single example/package impacted.
67+
- Keep changes scoped to that example unless explicitly requested.
68+
- Update configuration consistently with the conventions in that subtree.
69+
- Run the narrowest possible validation command (e.g. `pnpm --filter <pkg> build`) before running broad builds.
70+
71+
## Common Pitfalls
72+
73+
- Avoid editing generated output directories: `dist`, `dist-*`, `doc_build`.
74+
- Many examples are similar but not identical; do not assume scripts/config match across directories.
75+
- Some examples may pin specific versions or require particular Node constraints; check the example `package.json`.

0 commit comments

Comments
 (0)