Next.js + pnpm monorepo
A storefront split into a web app and a shared UI package.
Test command: pnpm test · package web
# AGENTS.md ## Project Project: Northwind. A TypeScript Next.js storefront split into a web app and a shared UI package. You are in a TypeScript Next.js repo. Do not introduce the Pages Router beside the App Router unless a task names that file. This file is plain Markdown. There are no required fields. When two AGENTS.md files disagree, follow the one closest to the file you are editing. A direct instruction in the chat overrides this file. ## Commands These are the runnable checks. Do not replace them with a command you happen to prefer. - Install: `pnpm install` - Dev server: `pnpm dev` - Build: `pnpm build` - Test: `pnpm test` - Lint: `pnpm lint` - Format: `pnpm exec prettier --write .` - Typecheck: `pnpm exec tsc --noEmit` Package `web` from the root: `pnpm --filter web test`. Lint that package with `pnpm --filter web lint`. A change is not done until the test command above has passed, or you have reported the failure you could not fix. Prefer the existing loading and error files in a route segment over a new wrapper. Read package.json before you run a script. If the test script is missing, say so. Do not invent vitest, jest, or playwright. ## Directory layout apps/web is the Next.js app. packages/ui holds shared components. pnpm-workspace.yaml lists both. The workspace file lists the members. A filter command uses the package name, not the folder name, when those two differ. ## Style and patterns TypeScript strict. Server Components by default. Client components only when the file needs state or a browser API. If any of that conflicts with the linter named above, the linter wins. ## Testing instructions Add or update a test for every behavior change. The integration test under apps/web/tests hits the route, not a mock of the route. ## Before you open a pull request Conventional Commits. Run lint and test before opening the pull request. ## Security Secrets live in the host environment. .env.local is gitignored. Do not put a secret in a NEXT_PUBLIC_ variable. Do not copy a secret into this file to "clarify" a rule. ## Never do these Do not edit .next or node_modules. Do not disable a lint rule to make a check pass. Do not commit a lockfile change you did not cause. ## Nested AGENTS.md files Monorepo: keep cross-cutting rules here. Put package-specific install, test, and lint commands in an AGENTS.md next to that package. The closest file to the file you edit is the one to follow. The package in view is `web`. Commands that apply only there belong in that package's AGENTS.md, not in a longer copy of this file. The AGENTS.md homepage says the closest file to the edited file wins. Codex, separately, concatenates files from the root down and lets the closer file come last. Either way, put the exception next to the package and keep the root file short. ## Agents that read this file Codex reads AGENTS.md before it works. It walks from the repository root down to the working directory, keeps one file per directory (AGENTS.override.md ahead of AGENTS.md), and concatenates them. Closer files come later, so they win a conflict. The combined text stops at project_doc_max_bytes, which is 32 KiB unless that setting was changed. Keep this file short, and put package-only commands in a nested file. Cursor treats AGENTS.md as the plain-Markdown alternative to .cursor/rules. Root and nested files both apply; the nested file wins when they conflict. Leave .cursor/rules for .mdc files with frontmatter. Prefer a pointer to a doc over a copy of that doc. Update this file when a command changes. A stale command wastes the run.