Skip to content

Commit 31ebcc8

Browse files
committed
Improve preview background changeset
1 parent 45b9958 commit 31ebcc8

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

.changeset/giant-pets-take.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,23 @@
22
'astro': minor
33
---
44

5-
Adds the `astro preview --background` flag to start preview servers as background processes, including automatic background mode for AI coding agents
5+
Adds the `astro preview --background` flag to start preview servers as background processes.
6+
7+
This makes preview servers easier to manage from scripts and AI coding agents because the command returns after the server is ready instead of keeping the terminal attached to the long-running process.
8+
9+
```sh
10+
astro preview --background
11+
```
12+
13+
When a preview server is running in the background, you can inspect or stop it with new `astro preview` subcommands:
14+
15+
```sh
16+
astro preview status
17+
astro preview logs
18+
astro preview logs --follow
19+
astro preview stop
20+
```
21+
22+
If Astro detects that `astro preview` is being run by an AI coding agent, background mode is enabled automatically. This matches the existing behavior for `astro dev`, allowing agents to continue working after the preview server starts while still receiving the server URL and process ID.
23+
24+
To opt out of automatic background mode for preview servers, set `ASTRO_PREVIEW_BACKGROUND=0` before running `astro preview`.

0 commit comments

Comments
 (0)