CLI

Command-line interface reference for development, building, and content management.

Dustavez uses Astro’s CLI for development and builds, plus a set of helper scripts for setup, validation, and content scaffolding. All commands are defined in package.json and run via npm, pnpm, or yarn.

Core commands

dev

Terminal
npm run dev

Starts the development server at localhost:4321 with hot module replacement. Every change to an .mdx file, component, or style triggers an instant reload.

Options:

  • --port <number> — Use a different port (default: 4321)
  • --host — Expose to network (for testing on other devices)

build

Terminal
npm run build

Generates the production static site to the dist/ directory. The build process:

  1. Validates all frontmatter against the Zod schema
  2. Compiles MDX to HTML with syntax highlighting
  3. Generates the search index
  4. Optimizes assets (CSS, fonts)

If validation fails, the build exits with a clear error message pointing to the problem file and field.

preview

Terminal
npm run preview

Serves the dist/ directory locally, simulating a production deployment. Use this to verify the build output before deploying.

Tip

Always run npm run preview before deploying to catch issues that only appear in production builds, such as broken relative links or missing assets.


Setup and scaffolding

setup

Terminal
npm run setup

An interactive script that walks you through customizing a fresh clone of Dustavez. Prompts for:

  • Site name and URL
  • Accent color (picks from the preset palette or accepts a custom hex)
  • Whether to clear the sample content from content/docs/en/

Run this once after cloning. Safe to skip — all values can be changed manually in src/lib/config.ts and src/styles/tokens.css at any time.

new-page

Terminal
npm run new-page

An interactive script that scaffolds a new MDX page. Prompts for the section, page title, and description, then writes a correctly formatted .mdx file in the right folder with pre-filled frontmatter.

Saves you from manually getting the frontmatter fields right when adding a new doc page.


Validation

validate

Terminal
npm run validate

Runs full project validation in sequence: TypeScript/Astro type checking followed by a link check. Equivalent to:

Terminal
npx astro check && npm run check-links

Run this before deploying or in CI to catch issues early. See CI/CD automation for a workflow example.

Terminal
npm run check-links

Scans all MDX files for internal links and verifies each target page exists. Reports broken links with the file and line number so they’re easy to find and fix.

Note

check-links only validates internal links (those starting with /). External URLs are not checked.

check-freshness

Terminal
npm run check-freshness

Scans all published pages and reports any whose lastUpdated frontmatter field is older than a configurable threshold (default: 180 days). Useful for keeping large documentation sets from going stale.

Output example:

⚠ content/docs/en/deployment/netlify.mdx — last updated 2025-09-12 (205 days ago)
⚠ content/docs/en/theming/dark-mode.mdx — last updated 2025-10-01 (186 days ago)
2 pages may need review.

Exit codes

CodeMeaning
0Success
1Build error (invalid frontmatter, broken imports, syntax errors)

Build errors include the file path and line number, making it straightforward to locate and fix problems.

Last updated: April 4, 2026
Edit this page on GitHub