CLI Overview

The refrakt CLI provides tools for generating content, inspecting rune output, auditing themes, and managing your project. Install it alongside your other refrakt.md packages:

npm install @refrakt-md/cli

This makes the refrakt command available in your project scripts and via npx refrakt.

Commands

CommandPurpose
inspectPreview identity transform output and audit CSS coverage
writeGenerate Markdown content using AI
extractGenerate API reference docs from TypeScript or Python source (via @refrakt-md/docs plugin)
contractsGenerate and validate structure contracts
scaffold-cssGenerate CSS stub files for a new theme
validateValidate theme config and manifest
themeInstall themes and show theme info
editLaunch the browser-based content editor
package validateValidate a rune package before publishing

Quick examples

# Preview the HTML output for a rune
refrakt inspect hint --type=warning

# Generate a docs site with AI
refrakt write -d content/ "Set up a docs site with guides and a blog"

# Generate API reference from source code
refrakt docs extract ./src -o ./content/api

# Audit CSS coverage across all runes
refrakt inspect --all --audit

# Audit metadata dimensions across all runes
refrakt inspect --all --audit-dimensions

# Generate structure contracts for CI
refrakt contracts -o contracts/structures.json --config .

# Launch the content editor
refrakt edit

# Validate a rune package before publishing
refrakt package validate ./my-package

Package commands

Community packages can extend the CLI with additional subcommands. These are available when the package is installed.

PackageCommandPurpose
@refrakt-md/docsrefrakt docs extractGenerate API reference docs from TypeScript or Python source
@refrakt-md/planrefrakt planProject planning — status, next item, update, create, validate, serve, build

Run refrakt --help to see all available commands and options.