Skip to content

@conloca/cli

Overview

@conloca/cli provides command-line tools for managing Conloca content. Use it to initialize content directory structures, scaffold Astro integration files, and verify content integrity.

Installation

bun add -g @conloca/cli

Or run without installing:

bunx @conloca/cli --help

Commands

conloca init

Initialize a new Conloca content structure inside a project directory.

conloca init <directory> <site>

Arguments:

ArgumentDescription
directoryPath to the project directory where content/ should be created
siteSite name (e.g., default, blog)

What it creates inside <directory>:

  • content/
  • content/<site>/pages/
  • content/blocks/shared/
  • content/sites.json

Note: conloca init always creates a content/ directory inside the path you pass. If you run conloca init ./content default, the result will be ./content/content/....

Example:

# Initialize content in current directory for 'default' site
conloca init . default

# Initialize content in a specific project directory for 'blog' site
conloca init ./my-astro-project blog

conloca verify

Verify content files in an existing Conloca content/ directory and auto-repair missing required fields.

conloca verify <directory>

Arguments:

ArgumentDescription
directoryPath to the content/ directory to verify

What it does:

  • Scans all VXJSON and MDX content files
  • Checks for required fields (id, created, modified)
  • Auto-repairs files with missing fields
  • Reports errors and displays a summary

Example:

conloca verify ./content

conloca astro setup

Scaffold Astro integration files for a Conloca CMS project.

conloca astro setup [path]

Arguments:

ArgumentDescriptionDefault
pathAstro project directory. (current directory)

Options:

FlagDescriptionDefault
-s, --site <name>Target site namedefault

Note: The --site flag is accepted but silently ignored. conloca astro setup always configures the default site.

What it generates:

FilePurpose
src/puck.config.tsxPuck component configuration with starter components
src/components/Layout.tsxLayout component with grid/flex support
src/components/Section.tsxSection wrapper component
src/components/puck/HeadingComponent.tsxHeading render component
src/components/puck/Heading.tsxHeading Puck config
src/components/puck/TextComponent.tsxText render component
src/components/puck/Text.tsxText Puck config
src/components/puck/Flex.tsxFlex layout Puck component
src/components/puck/Grid.tsxGrid layout Puck component
src/schemas/data.tsExample Zod schemas for data collections

Examples:

# Set up in current directory
conloca astro setup

# Set up in a specific project
conloca astro setup ./my-astro-project

# Set up for a specific site
conloca astro setup ./my-astro-project --site blog

Global Options

FlagShortDescription
--help-hShow help message
--site <name>-sTarget site name (default: default)

Note: For conloca astro setup, the --site flag is accepted but silently ignored — the command always configures the default site.

Quick Start

# 1. Create a new Astro project
bun create astro@latest my-site
cd my-site

# 2. Install Conloca packages
bun add @conloca/astro-cms

# 3. Initialize content structure
bunx @conloca/cli init . default

# 4. Scaffold Astro integration
bunx @conloca/cli astro setup

# 5. Add conlocaCMS to astro.config.mjs (see @conloca/astro-cms docs)

# 6. Start development
bun run dev

# 7. Open /__cms in your browser