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
1# Astro dev-server recipe (auto-detect fallback)
3Loaded when `detect-project-type.sh` returns `astro` and the startup tuple still lacks a command.
Astro dev-server recipe (auto-detect fallback)
Loaded when detect-project-type.sh returns astro and the startup tuple still lacks a command.
5## Signature
7- `astro.config.js`, `astro.config.mjs`, or `astro.config.ts` exists
8- `package.json` contains an `astro` dependency
Signature
astro.config.js,astro.config.mjs, orastro.config.tsexistspackage.jsoncontains anastrodependency
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 devThe 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 devPrefer the package manager indicated by the lockfile:
pnpm-lock.yaml->pnpm devyarn.lock->yarn devbun.lock/bun.lockb->bun run devpackage-lock.jsonor none ->npm run dev
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.
36## Stub generation
38```json
39{
40 "version": "0.2.0",
41 "configurations": [
42 {
43 "name": "Astro dev",
44 "runtimeExecutable": "npm",
45 "runtimeArgs": ["run", "dev"],
46 "port": 4321
47 }
48 ]
49}
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.
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 devruns 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
astrotype takes precedence overvitewhen bothastro.config.*andvite.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.