Clarx

CLI Overview

The Clarx CLI scores any codebase against the AI-First Standard locally and in CI.

Clarx CLI

The CLI is the primary way to run Clarx analysis. It scores a local codebase against the AI-First Standard, outputs a human-readable report, and exits with a non-zero code when thresholds are not met.


Install

npm install -g clarx
# or run without installing
npx clarx

Quick start

# Score the current directory
clarx score

# Score with JSON output
clarx score --format json

# Score and fail CI if overall score is below 70
clarx score --min-score 70

# Generate a starter manifest
clarx init

# Explain a specific rule
clarx explain C2

Output

The default report is human-readable:

Clarx AI-First Score — v0.1
Confidence: medium

  Overall         72 / 100

  Discoverability     85
  Boundary Clarity    90
  Context Efficiency  60  ⚠
  Operational Guidance 50  ⚠
  Edit Safety         80

Warnings (4):
  C2  3 files exceed 400 lines:
        apps/api/src/routes/auth.ts (847 lines)
        packages/ui/src/tokens.ts (512 lines)  [declared in manifest — exempt]
        apps/web/src/pages/dashboard.tsx (601 lines)
  O2  Guidance file does not declare generated directories
  O3  Guidance file does not declare verification commands
  O4  Guidance file does not declare where common changes belong

Recommendations (2):
  C4  High fan-in files not declared in manifest:
        packages/ui/src/tokens.ts (imported by 23 files)
  E4  Package boundaries not enforced by tooling

Run `clarx explain <rule>` for guidance on any rule.

Formats

FlagOutput
--format text (default)Human-readable terminal report
--format jsonMachine-readable JSON for dashboards and CI
--format markdownMarkdown summary for PR comments
--format sarifSARIF for GitHub Code Scanning and editor annotations

Exit codes

CodeMeaning
0Analysis complete, score at or above threshold
1Analysis complete, score below threshold
2Hard failure detected
3Analysis error (could not read repo)