Commands
Detailed documentation for all CLI commands
build
Compile a Constela program to JavaScript.
bash
constela build app.json --output dist/app.js --minifyOptions
| Option | Description |
|---|---|
--output, -o | Output file path |
--minify, -m | Minify output |
--sourcemap, -s | Generate source map |
--target, -t | Module format (esm, cjs, iife) |
--json | Output result as JSON (for AI tool integration) |
--watch, -w | Watch for changes and rebuild automatically |
--verbose, -v | Show detailed progress (timing for each pass) |
--debug | Show internal debug information |
dev
Start the development server with hot reload.
bash
constela dev app.json --port 3000Options
| Option | Description |
|---|---|
--port, -p | Dev server port (default: 3000) |
--open, -o | Open browser automatically |
validate
Validate a program without building. Error messages include "Did you mean?" suggestions for typos.
bash
constela validate app.json
constela validate --all src/Options
| Option | Description |
|---|---|
--all | Validate all JSON files in the specified directory |
--json | Output errors as structured JSON |
--verbose, -v | Show detailed validation info |
Example Output
text
Error [UNDEFINED_STATE] at /view/children/0/value/name
Undefined state reference: 'count'
Did you mean 'counter'?inspect
Visualize program structure including state fields, actions, components, and dependencies.
bash
constela inspect app.json
constela inspect --state --json app.jsonOptions
| Option | Description |
|---|---|
--json | Output as JSON |
--state | Show only state section |
--actions | Show only actions section |
--verbose, -v | Show all details |
init
Initialize a new Constela project.
bash
constela init my-appCreates a new directory with a basic project structure:
text
my-app/
├── src/
│ └── app.json
├── package.json
└── README.mdsuggest
Analyze DSL files using AI and get improvement suggestions.
bash
constela suggest app.json --aspect accessibilityArguments
| Argument | Description |
|---|---|
<input> | DSL file to analyze |
Options
| Option | Description |
|---|---|
--aspect <type> | Analysis aspect: accessibility, performance, security, ux (default: accessibility) |
--provider <name> | AI provider: anthropic, openai (default: anthropic) |
--json | Output as JSON |
Environment Variables
| Variable | Description |
|---|---|
ANTHROPIC_API_KEY | Required when using Anthropic provider |
OPENAI_API_KEY | Required when using OpenAI provider |
Examples
bash
# Analyze for accessibility issues
constela suggest app.json --aspect accessibility
# Analyze for security (using OpenAI)
constela suggest app.json --aspect security --provider openai
# JSON output for tooling
constela suggest app.json --aspect ux --jsonExample Output
text
=== Suggestions for app.json (accessibility) ===
[HIGH] Missing aria-label on button
Recommendation: Add aria-label="Submit form" to the button element
Location: view.children[0].props
[MED] Low color contrast in text
Recommendation: Increase contrast ratio to meet WCAG AA standards
Location: view.children[2].props.style
Total: 2 suggestion(s)