Command-Line Interface
Lumen builds on the Astro CLI and adds specific commands to manage your documentation lifecycle.
Main Commands
Section titled “Main Commands”astro dev
Section titled “astro dev”Starts the development server with Hot Module Replacement (HMR).
pnpm dev# equivalent to:pnpm astro devAvailable options:
| Option | Description |
|---|---|
--host |
Expose the server on the network (default: localhost). |
--port |
Server port (default: 4321). |
--open |
Automatically open the browser. |
Example:
pnpm astro dev --host 0.0.0.0 --port 3000astro build
Section titled “astro build”Generates the static site for production. Output goes to the dist/ folder.
pnpm build# equivalent to:pnpm astro buildAvailable options:
| Option | Description |
|---|---|
--verbose |
Show detailed build process logs. |
--drafts |
Include pages marked as drafts. |
astro preview
Section titled “astro preview”Serves the built site locally to preview the production output.
pnpm previewastro check
Section titled “astro check”Checks TypeScript types across the entire project without emitting output. Useful for detecting errors before building.
pnpm astro checkStarlight Commands
Section titled “Starlight Commands”Type Generation
Section titled “Type Generation”The astro sync command generates TypeScript types for content collections
and configuration.
pnpm astro syncThis command runs automatically before astro dev and astro build. Run it
manually if your types seem out of sync.
Content Analysis
Section titled “Content Analysis”The Pagefind tool automatically indexes your content during build. To verify the index in development:
pnpm buildpnpm previewSearch is available client-side and requires no external server.
Recommended Scripts
Section titled “Recommended Scripts”Here are the scripts to configure in your package.json for an optimal
workflow:
{ "scripts": { "dev": "astro dev", "start": "astro dev", "build": "astro build", "preview": "astro preview", "astro": "astro", "check": "astro check", "check:watch": "astro check --watch", "format": "prettier --write .", "format:check": "prettier --check ." }}| Script | Usage |
|---|---|
dev / start |
Local development with HMR. |
build |
Static site generation. |
preview |
Production build preview. |
check |
TypeScript type checking. |
check:watch |
Continuous checking during dev. |
format |
Automatic code formatting. |
format:check |
Format check (CI). |
Environment Variables
Section titled “Environment Variables”The CLI respects standard Astro environment variables:
| Variable | Description |
|---|---|
PORT |
Development server port. |
HOST |
Development server host. |
NODE_ENV |
Environment (development or production). |
SITE |
Deployment URL (used for canonical links). |
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.