Skill Tracer
Skills › Compound Engineering › ce-polish › dev-server-astro.md

dev-server-astro.md

58 lines · skills/ce-polish/references/dev-server-astro.md at 3449230

Open on GitHub
1# Astro dev-server recipe (auto-detect fallback)
2
3Loaded when `detect-project-type.sh` returns `astro` and the startup tuple still lacks a command.
4

Astro dev-server recipe (auto-detect fallback)

Loaded when detect-project-type.sh returns astro and the startup tuple still lacks a command.

Raw lines 1 to 4
5## Signature
6
7- `astro.config.js`, `astro.config.mjs`, or `astro.config.ts` exists
8- `package.json` contains an `astro` dependency
9

Signature

  • astro.config.js, astro.config.mjs, or astro.config.ts exists
  • package.json contains an astro dependency
Raw lines 5 to 9
10## Start command
12Standard:
14```bash
15npm run dev
16```
18The `dev` script in `package.json` typically wraps `astro dev`. Also valid (read `package.json` scripts to confirm which the project uses):
20```bash
21pnpm dev
22yarn dev
23bun run dev
24```
26Prefer the package manager indicated by the lockfile:
27- `pnpm-lock.yaml` -> `pnpm dev`
28- `yarn.lock` -> `yarn dev`
29- `bun.lock` / `bun.lockb` -> `bun run dev`
30- `package-lock.json` or none -> `npm run dev`

Start command

Standard:

npm run dev

The dev script in package.json typically wraps astro dev. Also valid (read package.json scripts to confirm which the project uses):

pnpm dev
yarn dev
bun run dev

Prefer the package manager indicated by the lockfile:

  • pnpm-lock.yaml -> pnpm dev
  • yarn.lock -> yarn dev
  • bun.lock / bun.lockb -> bun run dev
  • package-lock.json or none -> npm run dev
Raw lines 10 to 31
32## Port
34Default: `4321`. Astro respects `--port <port>` and the `server.port` field in `astro.config.*`. Overrides follow the cascade in `references/dev-server-detection.md`.

Port

Default: 4321. Astro respects --port <port> and the server.port field in astro.config.*. Overrides follow the cascade in references/dev-server-detection.md.

Raw lines 32 to 35
36## Stub generation
38```json
40 "version": "0.2.0",
41 "configurations": [
42 {
43 "name": "Astro dev",
44 "runtimeExecutable": "npm",
45 "runtimeArgs": ["run", "dev"],
46 "port": 4321
47 }
48 ]
50```
52Substitute the resolved package manager (`npm` / `pnpm` / `yarn` / `bun`) and port.

Stub generation

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Astro dev",
      "runtimeExecutable": "npm",
      "runtimeArgs": ["run", "dev"],
      "port": 4321
    }
  ]
}

Substitute the resolved package manager (npm / pnpm / yarn / bun) and port.

Raw lines 36 to 53
54## Common gotchas
56- **SSR vs SSG:** `astro dev` runs identically for both output modes; the difference only matters at build time. Polish does not need to distinguish between them.
57- **Astro config takes precedence over Vite config:** Astro uses Vite under the hood but ships its own config file. The `astro` type takes precedence over `vite` when both `astro.config.*` and `vite.config.*` exist. This is rare -- Astro projects do not usually have a separate Vite config file.
58- **Dev toolbar (Astro 4+):** Astro 4+ includes a dev toolbar that adds overlay UI in the browser. It does not affect port binding or URL routing -- polish can ignore it.

Common gotchas

  • SSR vs SSG: astro dev runs identically for both output modes; the difference only matters at build time. Polish does not need to distinguish between them.
  • Astro config takes precedence over Vite config: Astro uses Vite under the hood but ships its own config file. The astro type takes precedence over vite when both astro.config.* and vite.config.* exist. This is rare -- Astro projects do not usually have a separate Vite config file.
  • Dev toolbar (Astro 4+): Astro 4+ includes a dev toolbar that adds overlay UI in the browser. It does not affect port binding or URL routing -- polish can ignore it.
Raw lines 54 to 58