Genairus logoGenAI-R-Us
Genairus logoGenAI-R-Us

Chronos — CLI Reference

Chronos Documentation: ← Introduction | Language Reference | ← Examples & Artifacts | CLI Reference


CLI and Workflow

The Chronos CLI (chronos) validates your specifications and executes the projections defined in chronos-build.json. It runs the same way locally, in CI, or as part of a build pipeline.

Global flags available on every command:

FlagDescription
--help, -hPrint command help
--debugPrint debug information including stack traces
--no-colorDisable ANSI color output
--force-colorForce ANSI color output
CommandDescription
chronos initCreate a new project from a template
chronos validateValidate specs without generating artifacts
chronos buildValidate and execute all configured projections
chronos selectQuery shapes using a selector expression
chronos diffCompare two specs and report changes
chronos cleanRemove all generated artifacts

Click any command to expand its full documentation.

chronos init — Create a new project from a template

Create a new Chronos project from a template.

chronos init -t quickstart -o ./my-requirements

Flags:

FlagDescription
-t, --template <name>Template to use (default: quickstart)
-o, --output <dir>Output directory for the new project
--listList all available templates
--url <repo>Use a custom template repository

Available templates:

TemplateDescription
quickstartSingle-journey starter project
e-commerceMulti-journey e-commerce example
saas-onboardingSaaS signup and onboarding flows
api-serviceAPI-focused journeys with Smithy integration
compliance-heavyTemplate with GDPR/PCI-DSS policy examples
# List available templates
chronos init --list

# Create project from a template
chronos init -t e-commerce -o ./requirements

# Use a custom template repository
chronos init --url https://github.com/my-org/chronos-templates -t internal-standard -o ./requirements
chronos validate — Validate specs for syntax errors without generating artifacts

Validate .chronos files for syntax errors and semantic rule violations without generating any artifacts.

chronos validate
chronos validate requirements/checkout/
chronos validate requirements/checkout/guest-checkout.chronos

Flags:

FlagDescription
--severity <level>Minimum severity to report: note, warning, danger, error (default: warning)
--config <file>Path to chronos-build.json (default: auto-discover)

Output:

Validation events are printed to stderr with severity, rule code, file location, and message:

ERROR [CHR-001] requirements/checkout/guest-checkout.chronos:12
  Journey 'GuestCheckout' does not declare an actor.

WARNING [CHR-009] requirements/checkout/guest-checkout.chronos:8
  Journey 'GuestCheckout' has no @kpi trait. Consider linking to a business metric.

WARNING [CHR-004] requirements/checkout/guest-checkout.chronos:34
  Expectation contains ambiguous language: "quickly". Use measurable language instead.

Exit code is 0 if no errors, 1 if any ERROR severity events are found.

chronos build — Validate and execute all configured projections

Validate your spec and execute all projections defined in chronos-build.json. This is the primary command for generating artifacts and pushing to external systems.

chronos build
chronos build --projection issues
chronos build --projection tests,diagrams

Flags:

FlagDescription
--config <file>Path to chronos-build.json (default: auto-discover)
--projection <name>Run only the named projection(s), comma-separated
--output <dir>Override the output directory
--dry-runValidate and plan without executing projections

Credentials for issue tracker plugins are read from environment variables—never stored in chronos-build.json:

CHRONOS_LINEAR_TOKEN=xxx chronos build
CHRONOS_JIRA_TOKEN=xxx chronos build
chronos select — Query shapes using a selector expression

Query shapes defined in your .chronos files using a selector expression. Useful for auditing, reporting, and scripting.

chronos select 'journey'
chronos select 'journey[trait|compliance]'
chronos select 'actor' requirements/

Flags:

FlagDescription
--selector <expr>Selector expression (can also be passed as first positional argument)
--config <file>Path to chronos-build.json
--format <fmt>Output format: ids (default), json

Selector syntax:

Selectors target shape types and filter by traits, namespaces, or name patterns:

ExpressionMatches
*All shapes
journeyAll journeys
actorAll actors
entityAll entities
policyAll policies
enumAll enums
[trait|kpi]Any shape with a @kpi trait
[trait|compliance]Any shape with a @compliance trait
[id|namespace = "com.example.checkout"]Shapes in a specific namespace
[id|name ^= "Guest"]Shapes whose name starts with "Guest"
journey[trait|compliance]Journeys with a @compliance trait
journey:not([trait|kpi])Journeys missing a @kpi trait
entity[trait|pii]Entities marked with @pii

Examples:

# List all journey IDs
chronos select 'journey'
# com.genairus.commerce.checkout#GuestCheckout
# com.genairus.commerce.checkout#ReturnCustomerCheckout
# com.genairus.onboarding#EmailSignup

# Find all compliance-tagged journeys
chronos select 'journey[trait|compliance]'

# Find journeys missing a KPI
chronos select 'journey:not([trait|kpi])'

# Find all PII entities
chronos select 'entity[trait|pii]'

# Output as JSON for scripting
chronos select 'journey' --format json
chronos diff — Compare two specs and report breaking changes

Compare two .chronos files, directories, or project versions and report what changed. Highlights breaking changes—removed journeys, dropped steps, changed expectations.

chronos diff --old v1/requirements/ --new v2/requirements/
chronos diff --old main --new feature/checkout-v2 --mode git

Flags:

FlagDescription
--old <path|ref>Old model path or git ref
--new <path|ref>New model path or git ref
--mode <mode>Comparison mode: files (default), git
--severity <level>Minimum severity to report

Comparison modes:

ModeDescription
filesCompare two file paths or directories directly
gitCompare between git refs (branch, tag, commit SHA)

Output:

BREAKING  Journey 'GuestCheckout' step 'PlaceOrder' expectation changed
          - "Order is created with status PAID and confirmation email is queued"
          + "Order is created with status PENDING and payment is processed asynchronously"

ADDED     Journey 'ExpressCheckout' added in com.genairus.commerce.checkout

REMOVED   Actor 'GuestUser' removed from com.genairus.common.actors
          ↳ Referenced by: GuestCheckout, ExpressCheckout

Breaking changes exit with code 1—useful for gating CI pipelines on requirement regressions.

chronos clean — Remove all generated artifacts

Remove all generated artifacts from the output directories defined in chronos-build.json.

chronos clean
chronos clean --projection issues

Flags:

FlagDescription
--config <file>Path to chronos-build.json
--projection <name>Clean only the named projection(s)

Running in CI / Build Pipelines

chronos build is designed to run unattended. Add it to any pipeline:

# .github/workflows/chronos.yml
name: Chronos Build
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install Chronos CLI
        run: |
          curl -L https://github.com/genairus/chronos/releases/latest/download/chronos-linux-x86_64.zip \
          -o chronos.zip && unzip chronos.zip && sudo mv chronos /usr/local/bin/
      - name: Validate
        run: chronos validate
      - name: Diff against main
        run: chronos diff --old origin/main --new HEAD --mode git
      - name: Build artifacts
        run: chronos build
        env:
          CHRONOS_LINEAR_TOKEN: ${{ secrets.LINEAR_API_TOKEN }}

Build Configuration

chronos-build.json is the single configuration file that controls everything Chronos produces. Each entry in projections is a named plugin. You pick which ones to enable—if a projection isn't listed, it isn't run.

Issue tracker plugins (use one):

PluginTracker
jira-cloudJira Cloud
jira-serverJira Data Center / Server
linearLinear
asanaAsana
github-issuesGitHub Issues
azure-devopsAzure DevOps Work Items

Test scaffolding plugins (use one):

PluginFrameworkOutput
cucumberCucumber / Gherkin.feature files
jestJest.test.ts describe/it scaffolding
playwrightPlaywright.spec.ts test scaffolding
rspecRSpec_spec.rb scaffolding
pytestpytesttest_*.py scaffolding

Document plugins:

PluginOutput
prdProduct Requirements Document (Markdown or HTML)
mermaidState diagrams
event-contractsTelemetry event contracts
{
  "version": "1.0",
  "sources": ["requirements/**/*.chronos"],
  "projections": {
    "issues": {
      "plugin": "linear",
      "config": {
        "teamId": "PRODUCT"
      }
    },
    "prd": {
      "plugin": "prd",
      "output": "./artifacts/docs",
      "config": {
        "format": "markdown",
        "includeKpis": true,
        "includeCompliance": true
      }
    },
    "tests": {
      "plugin": "cucumber",
      "output": "./features",
      "config": {
        "language": "en",
        "indentSize": 2
      }
    },
    "diagrams": {
      "plugin": "mermaid",
      "output": "./artifacts/diagrams",
      "config": {
        "theme": "default"
      }
    },
    "telemetry": {
      "plugin": "event-contracts",
      "output": "./artifacts/telemetry",
      "config": {
        "format": "yaml"
      }
    }
  },
  "integrations": {
    "capacitor": {
      "schema": "./data"
    },
    "smithy": {
      "spec": "./api"
    }
  }
}

Every projection that calls an external API (issue trackers) reads its credentials from environment variables. The chronos-build.json file is safe to commit—no secrets belong in it.


Validation Rules

Chronos enforces semantic rules:

RuleDescription
CompletenessEvery journey must have actor, steps, and outcomes
AmbiguityFuzzy language ("fast", "easy") triggers warnings
TraceabilityJourneys should link to KPIs via @kpi trait
ReachabilityAll steps must lead to a terminal outcome
Type SafetyAll referenced shapes must be defined or imported

Common Validation Errors

Error: Ambiguous expectation

expectations must not contain fuzzy language like "fast", "easy", "intuitive"

Fix: Use concrete, measurable language:

  • ❌ "System responds quickly"
  • ✅ "System responds within 500ms (p99)"

Error: Unresolved shape reference

Entity 'Order' is not defined in namespace 'com.example'

Fix: Add import or define the entity:

use com.example.entities#Order

Error: Journey lacks terminal outcome

Journey 'GuestCheckout' has paths that don't reach a terminal state

Fix: Ensure all steps and variants lead to outcomes.success or outcomes.failure.


Troubleshooting

Common Issues

Issue: "Namespace not found" error

Error: Cannot resolve shape 'Order' from namespace 'com.example.data'

Solution:

  1. Check that the namespace is correct in your use statement
  2. Verify the file defining Order exists and has the correct namespace declaration
  3. Ensure the source directory is included in chronos-build.json sources array

Issue: Fuzzy language warnings

Warning: Step expectation contains ambiguous language: "quickly", "easily"

Solution: Replace with concrete, measurable language:

  • "responds quickly" → "responds within 500ms (p99)"
  • "displays clearly" → "displays error message in red text above form"
  • "handles errors gracefully" → "returns 400 status with JSON error object"

Issue: Journey doesn't validate

Error: Journey 'GuestCheckout' has unreachable terminal state

Solution: Trace all paths through your journey:

  1. Every step should either lead to another step or to a terminal outcome
  2. Every variant should specify an outcome field
  3. Use TransitionTo() or ReturnToStep() to create explicit paths

Issue: Generated work items missing fields or failing to push

Solution: Check your issue tracker plugin configuration in chronos-build.json. Each plugin has its own required config keys—refer to the plugin's documentation. Example for jira-cloud:

{
  "projections": {
    "issues": {
      "plugin": "jira-cloud",
      "config": {
        "projectKey": "ECOM",           // Must match your Jira project key
        "issueTypeEpic": "Epic",        // Must match Jira issue type name exactly
        "issueTypeStory": "Story",
        "customFields": {
          "KPI": "customfield_10001"    // Map Chronos traits to custom fields
        }
      }
    }
  }
}

Getting Help


Chronos Documentation: ← Introduction | Language Reference | ← Examples & Artifacts | CLI Reference