{"owner":"withastro","repo":"astro","hasSkills":true,"hasMcp":false,"mcpConfig":null,"found":["AGENTS.md"],"skills":{"AGENTS.md":"# Think Before Coding\n\n**Don't assume. Don't hide confusion. Surface tradeoffs.**\n\nBefore implementing:\n\n- State your assumptions explicitly. If uncertain, ask.\n- If multiple interpretations exist, present them - don't pick silently.\n- If a simpler approach exists, say so. Push back when warranted.\n- If something is unclear, stop. Name what's confusing. Ask.\n\n# Simplicity First\n\n**Minimum code that solves the problem. Nothing speculative.**\n\n- No features beyond what was asked.\n- No abstractions for single-use code.\n- No \"flexibility\" or \"configurability\" that wasn't requested.\n- No error handling for impossible scenarios.\n- If you write 200 lines and it could be 50, rewrite it.\n\nAsk yourself: \"Would a senior engineer say this is overcomplicated?\" If yes, simplify.\n\n# Surgical Changes\n\n**Touch only what you must. Clean up only your own mess.**\n\nWhen editing existing code:\n\n- Don't \"improve\" adjacent code, comments, or formatting.\n- Don't refactor things that aren't broken.\n- Match existing style, even if you'd do it differently.\n- If you notice unrelated dead code, mention it - don't delete it.\n\nWhen your changes create orphans:\n\n- Remove imports/variables/functions that YOUR changes made unused.\n- Don't remove pre-existing dead code unless asked.\n\nThe test: Every changed line should trace directly to the user's request.\n\n# Goal-Driven Execution\n\n**Define success criteria. Loop until verified.**\n\nTransform tasks into verifiable goals:\n\n- \"Add validation\" → \"Write tests for invalid inputs, then make them pass\"\n- \"Fix the bug\" → \"Write a test that reproduces it, then make it pass\"\n- \"Refactor X\" → \"Ensure tests pass before and after\"\n\nFor multi-step tasks, state a brief plan:\n\n```\n1. [Step] → verify: [check]\n2. [Step] → verify: [check]\n3. [Step] → verify: [check]\n```\n\nStrong success criteria let you loop independently. Weak criteria (\"make it work\") require constant clarification.\n\n# Style Guide\n\n- Not defined here. For now, follow the same conventions and patterns that you detect in the surrounding code.\n- Keep formatting consistent. Our rules are defined in our [biome.jsonc](./biome.jsonc) file, enforced by Biome.\n- Run `pnpm format` to auto-format the entire repo.\n- Run `pnpm lint:ai` to lint the entire repo.\n\n# Writing Comments\n\nThese rules apply to **every** comment you write, including ones added incidentally while fixing a bug. Full guidance with examples: [`.agents/skills/writing-comments/SKILL.md`](./.agents/skills/writing-comments/SKILL.md).\n\n- Write for a contributor reading the code at HEAD, months later, with no access to this conversation, the PR, or the diff.\n- Never narrate change history (\"now\", \"previously\", \"no longer\") and never address the reviewer (\"this correctly handles...\"). State how the code works, not how it came to be or why the change is right.\n- Deletion test: a comment must state something the reader cannot recover from the code. If names or types already carry it, don't write it.\n- `/** */` docs state the contract (behavior, params, returns, throws); `//` comments carry rationale only. Anchor a workaround to the GitHub issue or PR that motivates it.\n- When your change alters documented behavior, extend or correct the existing prose — never replace specific docs with generic text.\n- Exception: `@docs`-tagged JSDoc in `types/public/config.ts` and `core/errors/errors-data.ts` is end-user documentation generated to the website; these rules don't apply there.\n\n# Environment Guide\n\n- Use `node -e` for scripting tasks, not `python` or `python3`.\n\n# Monorepo Structure\n\nThis directory is a Git monorepo containing a `pnpm` workspace:\n\n- The codebase is primarily TypeScript.\n- All packages live in `packages/`.\n- Integration packages live in `packages/integrations/`.\n- The core Astro package is `packages/astro`.\n\nIn error stack traces, built files from workspace packages in `node_modules/` map to TypeScript source in `packages/`:\n\n- `node_modules/astro/dist/...` → `packages/astro/src/...`\n- `node_modules/@astrojs/react/...` → `packages/integrations/react/src/...`\n\nEdits to source files take effect after rebuilding the package via `pnpm build`.\n\nUse `pnpm -C <dir> <command>` for project-local script commands when working in packages/examples/triage directories (Example: `pnpm -C packages/astro build`, `pnpm -C examples/blog dev`). Only omit `-C` flag when intentionally working in the monorepo root (Example: `pnpm format`, `pnpm lint:ai`, `pnpm test:types`).\n\n# Running Tests\n\n- Run `pnpm test` in workspace root or package directory to run full test suite (can be slow!)\n- Integration tests live in special `packages/integrations` folders.\n- Example: `pnpm -C <package-directory> exec astro-scripts test` - Run a single package test suite\n- Example: `pnpm -C <package-directory> exec astro-scripts test \"test/actions.test.js\"` - Run a single test file\n- Example: `pnpm -C <package-directory> exec astro-scripts test \"test/**/*.test.js\" --match \"CSS\"` - Run specific tests matching a string or regex patterns\n- Example: `pnpm -C <package-directory> exec astro-scripts test \"test/{actions,css,middleware}.test.js\"` - Run multiple test files\n- Key flags:\n  - `--match` / `-m`: Filter tests by name pattern (regex)\n  - `--only` / `-o`: Run only tests marked with `.only`\n  - `--parallel` / `-p`: Run tests in parallel (default is sequential)\n  - `--timeout` / `-t`: Set timeout in milliseconds\n  - `--watch` / `-w`: Watch mode\n\n# Astro Quick Reference\n\n- Use `astro dev` to start the local dev server with HMR. Do not use other web servers (`python -m http.server`, etc.).\n- Use `astro build` to create a production build in `dist/`, by default.\n- Use `astro preview` to serve the production build locally. Do not use other web servers (`python -m http.server`, etc.).\n- Use `astro check` to run type checking and diagnostics.\n- Use `astro sync` to generate and update TypeScript types.\n- Use `astro add` to install and configure an official integration.\n- Fetch **Full docs** at https://docs.astro.build/ (primary source for the latest reference).\n\n# Background Dev Servers\n\nUse `astro dev --background` to start and manage long-running dev servers in the background. Do not manually start detached servers with `&`.\n\nWorkflow:\n\n1. `pnpm -C examples/minimal dev --background` - Start the dev server in the background\n2. `pnpm -C examples/minimal dev logs` - View logs from the dev server. Useful for debugging server logs.\n3. `pnpm -C examples/minimal dev status` - Check whether a dev server is running\n4. `pnpm -C examples/minimal dev stop` - Stop the dev server when your work is complete\n\nUse `pnpm -C examples/minimal dev logs --follow` to stream logs. If a stale dev server is blocking startup, stop it first or use `pnpm -C examples/minimal dev --background --force` to replace it.\n\n# `agent-browser`\n\nUse `agent-browser` for web automation or when UI interaction, long-running browsers, or HMR testing is required. Do not use `curl` to test HMR issues.\n\nUse `agent-browser --help` to see all available commands.\n\nWorkflow:\n\n1. `agent-browser open <url>` - Navigate to page\n2. `agent-browser snapshot -i` - Get interactive elements with refs (@e1, @e2)\n3. `agent-browser click @e1` / `fill @e2 \"text\"` - Interact using refs\n4. Re-snapshot after all page changes, navigations, interactions.\n\nNote: `agent-browser` should be installed globally, and is not a dependency of this monorepo. If `agent-browser` isn't available on this machine, ask the user to run `npm install -g agent-browser && agent-browser install`. If you are running in headless mode with no human operator and need this tool to complete your job, it is best to fail the job vs. trying to work around not having the tool.\n\n# Deep Dives\n\nDetailed reference documents on specific subsystems. Read the relevant section before diving into a bug or feature in that area.\n\n## Unit Testing\n\nWhen writing unit tests, read [`reference/unit-testing.md`](./reference/unit-testing.md) for conventions, file placement, and the shared test utilities and mocks available in the repo. Do not duplicate existing helpers.\n\n## Vite Dep Optimizer (`optimizeDeps`)\n\nWhen a bug works in `astro build` but fails in `astro dev` with errors like `require is not defined`, the root cause is almost always Vite's dep optimizer failing to pre-bundle a CJS dependency. `astro build` uses Rollup and handles CJS→ESM reliably; `astro dev` relies on esbuild's optimizer scan, which is intentionally shallow and will miss deps that are only reachable through non-JS files (like `.astro` components in `node_modules`). The key files are `packages/astro/src/vite-plugin-environment/index.ts` (sets `optimizeDeps.entries`) and `packages/astro/src/core/create-vite.ts` (wires up `vitefu`/`crawlFrameworkPkgs`). For a full deep-dive including a debugging playbook and potential fixes, see [`reference/optimize-deps.md`](./reference/optimize-deps.md).\n"},"files":{"AGENTS.md":"# Think Before Coding\n\n**Don't assume. Don't hide confusion. Surface tradeoffs.**\n\nBefore implementing:\n\n- State your assumptions explicitly. If uncertain, ask.\n- If multiple interpretations exist, present them - don't pick silently.\n- If a simpler approach exists, say so. Push back when warranted.\n- If something is unclear, stop. Name what's confusing. Ask.\n\n# Simplicity First\n\n**Minimum code that solves the problem. Nothing speculative.**\n\n- No features beyond what was asked.\n- No abstractions for single-use code.\n- No \"flexibility\" or \"configurability\" that wasn't requested.\n- No error handling for impossible scenarios.\n- If you write 200 lines and it could be 50, rewrite it.\n\nAsk yourself: \"Would a senior engineer say this is overcomplicated?\" If yes, simplify.\n\n# Surgical Changes\n\n**Touch only what you must. Clean up only your own mess.**\n\nWhen editing existing code:\n\n- Don't \"improve\" adjacent code, comments, or formatting.\n- Don't refactor things that aren't broken.\n- Match existing style, even if you'd do it differently.\n- If you notice unrelated dead code, mention it - don't delete it.\n\nWhen your changes create orphans:\n\n- Remove imports/variables/functions that YOUR changes made unused.\n- Don't remove pre-existing dead code unless asked.\n\nThe test: Every changed line should trace directly to the user's request.\n\n# Goal-Driven Execution\n\n**Define success criteria. Loop until verified.**\n\nTransform tasks into verifiable goals:\n\n- \"Add validation\" → \"Write tests for invalid inputs, then make them pass\"\n- \"Fix the bug\" → \"Write a test that reproduces it, then make it pass\"\n- \"Refactor X\" → \"Ensure tests pass before and after\"\n\nFor multi-step tasks, state a brief plan:\n\n```\n1. [Step] → verify: [check]\n2. [Step] → verify: [check]\n3. [Step] → verify: [check]\n```\n\nStrong success criteria let you loop independently. Weak criteria (\"make it work\") require constant clarification.\n\n# Style Guide\n\n- Not defined here. For now, follow the same conventions and patterns that you detect in the surrounding code.\n- Keep formatting consistent. Our rules are defined in our [biome.jsonc](./biome.jsonc) file, enforced by Biome.\n- Run `pnpm format` to auto-format the entire repo.\n- Run `pnpm lint:ai` to lint the entire repo.\n\n# Writing Comments\n\nThese rules apply to **every** comment you write, including ones added incidentally while fixing a bug. Full guidance with examples: [`.agents/skills/writing-comments/SKILL.md`](./.agents/skills/writing-comments/SKILL.md).\n\n- Write for a contributor reading the code at HEAD, months later, with no access to this conversation, the PR, or the diff.\n- Never narrate change history (\"now\", \"previously\", \"no longer\") and never address the reviewer (\"this correctly handles...\"). State how the code works, not how it came to be or why the change is right.\n- Deletion test: a comment must state something the reader cannot recover from the code. If names or types already carry it, don't write it.\n- `/** */` docs state the contract (behavior, params, returns, throws); `//` comments carry rationale only. Anchor a workaround to the GitHub issue or PR that motivates it.\n- When your change alters documented behavior, extend or correct the existing prose — never replace specific docs with generic text.\n- Exception: `@docs`-tagged JSDoc in `types/public/config.ts` and `core/errors/errors-data.ts` is end-user documentation generated to the website; these rules don't apply there.\n\n# Environment Guide\n\n- Use `node -e` for scripting tasks, not `python` or `python3`.\n\n# Monorepo Structure\n\nThis directory is a Git monorepo containing a `pnpm` workspace:\n\n- The codebase is primarily TypeScript.\n- All packages live in `packages/`.\n- Integration packages live in `packages/integrations/`.\n- The core Astro package is `packages/astro`.\n\nIn error stack traces, built files from workspace packages in `node_modules/` map to TypeScript source in `packages/`:\n\n- `node_modules/astro/dist/...` → `packages/astro/src/...`\n- `node_modules/@astrojs/react/...` → `packages/integrations/react/src/...`\n\nEdits to source files take effect after rebuilding the package via `pnpm build`.\n\nUse `pnpm -C <dir> <command>` for project-local script commands when working in packages/examples/triage directories (Example: `pnpm -C packages/astro build`, `pnpm -C examples/blog dev`). Only omit `-C` flag when intentionally working in the monorepo root (Example: `pnpm format`, `pnpm lint:ai`, `pnpm test:types`).\n\n# Running Tests\n\n- Run `pnpm test` in workspace root or package directory to run full test suite (can be slow!)\n- Integration tests live in special `packages/integrations` folders.\n- Example: `pnpm -C <package-directory> exec astro-scripts test` - Run a single package test suite\n- Example: `pnpm -C <package-directory> exec astro-scripts test \"test/actions.test.js\"` - Run a single test file\n- Example: `pnpm -C <package-directory> exec astro-scripts test \"test/**/*.test.js\" --match \"CSS\"` - Run specific tests matching a string or regex patterns\n- Example: `pnpm -C <package-directory> exec astro-scripts test \"test/{actions,css,middleware}.test.js\"` - Run multiple test files\n- Key flags:\n  - `--match` / `-m`: Filter tests by name pattern (regex)\n  - `--only` / `-o`: Run only tests marked with `.only`\n  - `--parallel` / `-p`: Run tests in parallel (default is sequential)\n  - `--timeout` / `-t`: Set timeout in milliseconds\n  - `--watch` / `-w`: Watch mode\n\n# Astro Quick Reference\n\n- Use `astro dev` to start the local dev server with HMR. Do not use other web servers (`python -m http.server`, etc.).\n- Use `astro build` to create a production build in `dist/`, by default.\n- Use `astro preview` to serve the production build locally. Do not use other web servers (`python -m http.server`, etc.).\n- Use `astro check` to run type checking and diagnostics.\n- Use `astro sync` to generate and update TypeScript types.\n- Use `astro add` to install and configure an official integration.\n- Fetch **Full docs** at https://docs.astro.build/ (primary source for the latest reference).\n\n# Background Dev Servers\n\nUse `astro dev --background` to start and manage long-running dev servers in the background. Do not manually start detached servers with `&`.\n\nWorkflow:\n\n1. `pnpm -C examples/minimal dev --background` - Start the dev server in the background\n2. `pnpm -C examples/minimal dev logs` - View logs from the dev server. Useful for debugging server logs.\n3. `pnpm -C examples/minimal dev status` - Check whether a dev server is running\n4. `pnpm -C examples/minimal dev stop` - Stop the dev server when your work is complete\n\nUse `pnpm -C examples/minimal dev logs --follow` to stream logs. If a stale dev server is blocking startup, stop it first or use `pnpm -C examples/minimal dev --background --force` to replace it.\n\n# `agent-browser`\n\nUse `agent-browser` for web automation or when UI interaction, long-running browsers, or HMR testing is required. Do not use `curl` to test HMR issues.\n\nUse `agent-browser --help` to see all available commands.\n\nWorkflow:\n\n1. `agent-browser open <url>` - Navigate to page\n2. `agent-browser snapshot -i` - Get interactive elements with refs (@e1, @e2)\n3. `agent-browser click @e1` / `fill @e2 \"text\"` - Interact using refs\n4. Re-snapshot after all page changes, navigations, interactions.\n\nNote: `agent-browser` should be installed globally, and is not a dependency of this monorepo. If `agent-browser` isn't available on this machine, ask the user to run `npm install -g agent-browser && agent-browser install`. If you are running in headless mode with no human operator and need this tool to complete your job, it is best to fail the job vs. trying to work around not having the tool.\n\n# Deep Dives\n\nDetailed reference documents on specific subsystems. Read the relevant section before diving into a bug or feature in that area.\n\n## Unit Testing\n\nWhen writing unit tests, read [`reference/unit-testing.md`](./reference/unit-testing.md) for conventions, file placement, and the shared test utilities and mocks available in the repo. Do not duplicate existing helpers.\n\n## Vite Dep Optimizer (`optimizeDeps`)\n\nWhen a bug works in `astro build` but fails in `astro dev` with errors like `require is not defined`, the root cause is almost always Vite's dep optimizer failing to pre-bundle a CJS dependency. `astro build` uses Rollup and handles CJS→ESM reliably; `astro dev` relies on esbuild's optimizer scan, which is intentionally shallow and will miss deps that are only reachable through non-JS files (like `.astro` components in `node_modules`). The key files are `packages/astro/src/vite-plugin-environment/index.ts` (sets `optimizeDeps.entries`) and `packages/astro/src/core/create-vite.ts` (wires up `vitefu`/`crawlFrameworkPkgs`). For a full deep-dive including a debugging playbook and potential fixes, see [`reference/optimize-deps.md`](./reference/optimize-deps.md).\n"},"items":[{"name":"AGENTS.md","path":"AGENTS.md","title":"AGENTS.md","content":"# Think Before Coding\n\n**Don't assume. Don't hide confusion. Surface tradeoffs.**\n\nBefore implementing:\n\n- State your assumptions explicitly. If uncertain, ask.\n- If multiple interpretations exist, present them - don't pick silently.\n- If a simpler approach exists, say so. Push back when warranted.\n- If something is unclear, stop. Name what's confusing. Ask.\n\n# Simplicity First\n\n**Minimum code that solves the problem. Nothing speculative.**\n\n- No features beyond what was asked.\n- No abstractions for single-use code.\n- No \"flexibility\" or \"configurability\" that wasn't requested.\n- No error handling for impossible scenarios.\n- If you write 200 lines and it could be 50, rewrite it.\n\nAsk yourself: \"Would a senior engineer say this is overcomplicated?\" If yes, simplify.\n\n# Surgical Changes\n\n**Touch only what you must. Clean up only your own mess.**\n\nWhen editing existing code:\n\n- Don't \"improve\" adjacent code, comments, or formatting.\n- Don't refactor things that aren't broken.\n- Match existing style, even if you'd do it differently.\n- If you notice unrelated dead code, mention it - don't delete it.\n\nWhen your changes create orphans:\n\n- Remove imports/variables/functions that YOUR changes made unused.\n- Don't remove pre-existing dead code unless asked.\n\nThe test: Every changed line should trace directly to the user's request.\n\n# Goal-Driven Execution\n\n**Define success criteria. Loop until verified.**\n\nTransform tasks into verifiable goals:\n\n- \"Add validation\" → \"Write tests for invalid inputs, then make them pass\"\n- \"Fix the bug\" → \"Write a test that reproduces it, then make it pass\"\n- \"Refactor X\" → \"Ensure tests pass before and after\"\n\nFor multi-step tasks, state a brief plan:\n\n```\n1. [Step] → verify: [check]\n2. [Step] → verify: [check]\n3. [Step] → verify: [check]\n```\n\nStrong success criteria let you loop independently. Weak criteria (\"make it work\") require constant clarification.\n\n# Style Guide\n\n- Not defined here. For now, follow the same conventions and patterns that you detect in the surrounding code.\n- Keep formatting consistent. Our rules are defined in our [biome.jsonc](./biome.jsonc) file, enforced by Biome.\n- Run `pnpm format` to auto-format the entire repo.\n- Run `pnpm lint:ai` to lint the entire repo.\n\n# Writing Comments\n\nThese rules apply to **every** comment you write, including ones added incidentally while fixing a bug. Full guidance with examples: [`.agents/skills/writing-comments/SKILL.md`](./.agents/skills/writing-comments/SKILL.md).\n\n- Write for a contributor reading the code at HEAD, months later, with no access to this conversation, the PR, or the diff.\n- Never narrate change history (\"now\", \"previously\", \"no longer\") and never address the reviewer (\"this correctly handles...\"). State how the code works, not how it came to be or why the change is right.\n- Deletion test: a comment must state something the reader cannot recover from the code. If names or types already carry it, don't write it.\n- `/** */` docs state the contract (behavior, params, returns, throws); `//` comments carry rationale only. Anchor a workaround to the GitHub issue or PR that motivates it.\n- When your change alters documented behavior, extend or correct the existing prose — never replace specific docs with generic text.\n- Exception: `@docs`-tagged JSDoc in `types/public/config.ts` and `core/errors/errors-data.ts` is end-user documentation generated to the website; these rules don't apply there.\n\n# Environment Guide\n\n- Use `node -e` for scripting tasks, not `python` or `python3`.\n\n# Monorepo Structure\n\nThis directory is a Git monorepo containing a `pnpm` workspace:\n\n- The codebase is primarily TypeScript.\n- All packages live in `packages/`.\n- Integration packages live in `packages/integrations/`.\n- The core Astro package is `packages/astro`.\n\nIn error stack traces, built files from workspace packages in `node_modules/` map to TypeScript source in `packages/`:\n\n- `node_modules/astro/dist/...` → `packages/astro/src/...`\n- `node_modules/@astrojs/react/...` → `packages/integrations/react/src/...`\n\nEdits to source files take effect after rebuilding the package via `pnpm build`.\n\nUse `pnpm -C <dir> <command>` for project-local script commands when working in packages/examples/triage directories (Example: `pnpm -C packages/astro build`, `pnpm -C examples/blog dev`). Only omit `-C` flag when intentionally working in the monorepo root (Example: `pnpm format`, `pnpm lint:ai`, `pnpm test:types`).\n\n# Running Tests\n\n- Run `pnpm test` in workspace root or package directory to run full test suite (can be slow!)\n- Integration tests live in special `packages/integrations` folders.\n- Example: `pnpm -C <package-directory> exec astro-scripts test` - Run a single package test suite\n- Example: `pnpm -C <package-directory> exec astro-scripts test \"test/actions.test.js\"` - Run a single test file\n- Example: `pnpm -C <package-directory> exec astro-scripts test \"test/**/*.test.js\" --match \"CSS\"` - Run specific tests matching a string or regex patterns\n- Example: `pnpm -C <package-directory> exec astro-scripts test \"test/{actions,css,middleware}.test.js\"` - Run multiple test files\n- Key flags:\n  - `--match` / `-m`: Filter tests by name pattern (regex)\n  - `--only` / `-o`: Run only tests marked with `.only`\n  - `--parallel` / `-p`: Run tests in parallel (default is sequential)\n  - `--timeout` / `-t`: Set timeout in milliseconds\n  - `--watch` / `-w`: Watch mode\n\n# Astro Quick Reference\n\n- Use `astro dev` to start the local dev server with HMR. Do not use other web servers (`python -m http.server`, etc.).\n- Use `astro build` to create a production build in `dist/`, by default.\n- Use `astro preview` to serve the production build locally. Do not use other web servers (`python -m http.server`, etc.).\n- Use `astro check` to run type checking and diagnostics.\n- Use `astro sync` to generate and update TypeScript types.\n- Use `astro add` to install and configure an official integration.\n- Fetch **Full docs** at https://docs.astro.build/ (primary source for the latest reference).\n\n# Background Dev Servers\n\nUse `astro dev --background` to start and manage long-running dev servers in the background. Do not manually start detached servers with `&`.\n\nWorkflow:\n\n1. `pnpm -C examples/minimal dev --background` - Start the dev server in the background\n2. `pnpm -C examples/minimal dev logs` - View logs from the dev server. Useful for debugging server logs.\n3. `pnpm -C examples/minimal dev status` - Check whether a dev server is running\n4. `pnpm -C examples/minimal dev stop` - Stop the dev server when your work is complete\n\nUse `pnpm -C examples/minimal dev logs --follow` to stream logs. If a stale dev server is blocking startup, stop it first or use `pnpm -C examples/minimal dev --background --force` to replace it.\n\n# `agent-browser`\n\nUse `agent-browser` for web automation or when UI interaction, long-running browsers, or HMR testing is required. Do not use `curl` to test HMR issues.\n\nUse `agent-browser --help` to see all available commands.\n\nWorkflow:\n\n1. `agent-browser open <url>` - Navigate to page\n2. `agent-browser snapshot -i` - Get interactive elements with refs (@e1, @e2)\n3. `agent-browser click @e1` / `fill @e2 \"text\"` - Interact using refs\n4. Re-snapshot after all page changes, navigations, interactions.\n\nNote: `agent-browser` should be installed globally, and is not a dependency of this monorepo. If `agent-browser` isn't available on this machine, ask the user to run `npm install -g agent-browser && agent-browser install`. If you are running in headless mode with no human operator and need this tool to complete your job, it is best to fail the job vs. trying to work around not having the tool.\n\n# Deep Dives\n\nDetailed reference documents on specific subsystems. Read the relevant section before diving into a bug or feature in that area.\n\n## Unit Testing\n\nWhen writing unit tests, read [`reference/unit-testing.md`](./reference/unit-testing.md) for conventions, file placement, and the shared test utilities and mocks available in the repo. Do not duplicate existing helpers.\n\n## Vite Dep Optimizer (`optimizeDeps`)\n\nWhen a bug works in `astro build` but fails in `astro dev` with errors like `require is not defined`, the root cause is almost always Vite's dep optimizer failing to pre-bundle a CJS dependency. `astro build` uses Rollup and handles CJS→ESM reliably; `astro dev` relies on esbuild's optimizer scan, which is intentionally shallow and will miss deps that are only reachable through non-JS files (like `.astro` components in `node_modules`). The key files are `packages/astro/src/vite-plugin-environment/index.ts` (sets `optimizeDeps.entries`) and `packages/astro/src/core/create-vite.ts` (wires up `vitefu`/`crawlFrameworkPkgs`). For a full deep-dive including a debugging playbook and potential fixes, see [`reference/optimize-deps.md`](./reference/optimize-deps.md).\n","category":"root","tokens":2221}]}