You are working on the Astrical documentation site, an AI-first Astro based CMS and Digital Experience Platform.
Astrical is designed to decouple content and structure from the underlying code, enabling AI agents to build and manage enterprise-grade websites primarily through YAML configuration.
The project consists of two main components:
- Core (
src/core): The Astro-based engine that renders the website. It transforms declarative YAML content into a static site. - CLI (
src/cli): The command-line interface for managing the project, running development and management commands, and building the site.
- Content as Configuration: The site's pages, menus, and global settings are defined in structured YAML files within the
content/directory. - Code as Engine: The
src/coredirectory contains the logic, components, and layouts. Avoid modifyingsrc/coreunless explicitly tasked with adding new capabilities that cannot be achieved via YAML or styling. - CLI as Interface: Use the custom CLI commands (via
npm runscripts orastrical) to interact with the project.
src/core/dev/content_management.rst: CRITICAL. This is your "Operations Manual". It defines the YAML schema, available components, and how to build pages.src/core/dev/architecture.rst: Explains the technical architecture and data flow.src/core/dev/theme_design.rst: How to style the site usingthemes/*/style.yamlandglobal.css.src/core/dev/module_dev.md: Guide for creating and managing modules to extend the system.
content/pages/: Create and edit page YAML files here.content/shared/: Reusable content widgets used within page sections.content/menus/: Update navigation menus.content/config.yaml: Global site configuration.themes/: Theme definitions for styling.public/: Store static assets (images, PDFs, etc.) here.src/modules/: Feature modules/submodules.
src/core/: Contains the Astro components, layouts, and logic. Modifying this implies changing the framework capabilities, not just the site content.
The project root package.json scripts map to the src/cli commands.
- Start Server:
npm run dev- Starts the Astro development server (powered by
src/cli'sdevcommand). - Access at
http://localhost:4321.
- Starts the Astro development server (powered by
- Build Site:
npm run build- Builds the production static site to
dist/.
- Builds the production static site to
- Validate Content:
npm run validate- Validates all YAML content against the schemas in
src/core/dev/content.spec.yaml.
- Validates all YAML content against the schemas in
- Type Check:
npm run check- Runs ESLint, Prettier, and Astro diagnostics.
- Fix Linting Errors:
npm run fix- Fix ESLint and Prettier linting issues.
- Read the Manual: Always refer to
src/core/dev/content_management.rstbefore creating complex pages. - YAML First: Attempt to solve user requests by modifying usage of existing components in
content/before writing new code insrc/core. - Validate: After modifying YAML, run
npm run validateto ensure correctness. - CLI Usage: Use
npm run <script>to execute commands, which internally uses theastricalCLI.
Astrical uses a modular architecture to extend the core capabilities without modifying the src/core engine. Modules are Git repositories (submodules) located in src/modules.
- Purpose: Add new components, form handlers, API routes, or other backend logic.
- Location:
src/modules/. - Creation: Use the CLI to scaffold a new module from the standard starter kit.
astrical module init <name>
- This command defaults to using the starter module at
https://github.com/astrical-modules/starter.git. - It effectively creates a new Git repository in
src/modules/<name>and wires it into the project.
- This command defaults to using the starter module at
/
├── content/ # The AI Workspace (Content & Config)
│ ├── config.yaml # Site-wide config
│ ├── pages/ # Page YAMLs
│ ├── shared/ # Reusable widget component YAMLs
│ └── menus/ # Menu YAMLs
├── themes/ # Theme definitions
├── src/
│ ├── core/ # Astrical Core CMS / DXP (Astro based)
│ │ ├── src/
│ │ │ ├── components/ # Astro components
│ │ │ ├── layouts/ # Page layouts
│ │ │ └── pages/ # Page routes
│ │ └── dev/ # Documentation & Schemas
│ ├── cli/ # Astrical CLI
│ │ └── src/
│ │ ├── commands/ # Astrical command implementations
│ │ └── utils/ # CLI utilities
│ ├── commands/ # Specialized documentation commands
│ └── modules/ # Feature Modules (Git Submodules)
├── public/ # Static assets
└── package.json # Javascript manifest and development scripts
All static assets (images, videos, documents) should be stored in the top-level public/ directory.
- Storage: Place files in
public/(e.g.,public/images/hero.png). - Linking: Reference assets using the absolute path from the site root, starting with
/. Do NOT includepublicin the URL.- Correct:
/images/hero.png - Incorrect:
public/images/hero.pngor../public/images/hero.png
- Correct:
- Organization: Use subdirectories to keep assets organized (e.g.,
public/images/,public/docs/).