CLI Commands
Unentropy provides a command-line interface for local development and testing. Use these commands to initialize configuration, validate setup, and preview reports before pushing to CI.
Generate configuration file with sensible defaults for your project type.
bunx unentropy init [options]Behavior
Section titled “Behavior”- Detects project type from marker files
- Creates
unentropy.jsonwith appropriate metrics - Displays GitHub Actions workflow examples
- Suggests next steps
Options
Section titled “Options”--type, -t
Section titled “--type, -t”Force specific project type.
bunx unentropy init --type phpValues: javascript, php, go, python
Use this when:
- Auto-detection picks the wrong type
- You have a multi-language project
- Marker files are in subdirectories
--storage, -s
Section titled “--storage, -s”Select storage backend.
bunx unentropy init --storage s3Values: artifact (default), s3, local
artifact: GitHub Actions artifacts (90-day retention)s3: S3-compatible storage (unlimited retention)local: Local file (development only)
--force, -f
Section titled “--force, -f”Overwrite existing configuration.
bunx unentropy init --forceWarning: This replaces your existing unentropy.json. Back up custom changes first.
--dry-run
Section titled “--dry-run”Preview configuration without writing files.
bunx unentropy init --dry-runDisplays what would be created without modifying anything.
Project Type Detection
Section titled “Project Type Detection”Unentropy detects your project type from these files:
| Type | Detection Files |
|---|---|
| JavaScript | package.json, tsconfig.json, bun.lockb, pnpm-lock.yaml, yarn.lock, package-lock.json |
| PHP | composer.json, composer.lock |
| Go | go.mod, go.sum |
| Python | pyproject.toml, setup.py, requirements.txt, Pipfile, setup.cfg |
Priority order when multiple types detected: JavaScript > PHP > Go > Python
Example Output
Section titled “Example Output”Detected project type: javascript (found: package.json, tsconfig.json)
✓ Created unentropy.json with 3 metrics:
- lines-of-code (Lines of Code)
- test-coverage (Test Coverage)
- bundle (Bundle Size)
Next steps:
1. Run 'bunx unentropy test' to verify metric collection
2. Add the workflows below to your repository
TRACK METRICS (main branch):
.github/workflows/metrics.yml:
name: Track Metrics
on:
push:
branches: [main]
jobs:
track-metrics:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run tests with coverage
run: bun test --coverage
- name: Track metrics
uses: unentropy/track-metrics-action@v1
QUALITY GATE (pull requests):
.github/workflows/quality-gate.yml:
name: Quality Gate
on:
pull_request:
jobs:
quality-gate:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Run tests with coverage
run: bun test --coverage
- name: Quality Gate Check
uses: unentropy/quality-gate-action@v1Exit Codes
Section titled “Exit Codes”- 0: Success
- 1: Configuration already exists (use
--forceto overwrite) - 1: Project type cannot be detected (use
--typeto specify) - 1: Invalid
--typevalue
Validate configuration and run metric collection locally without persisting data.
bunx unentropy test [options]Behavior
Section titled “Behavior”- Validates
unentropy.jsonschema - Runs metric collection commands sequentially
- Displays results with values, units, and timing
- Exits with appropriate code based on results
Options
Section titled “Options”--config, -c
Section titled “--config, -c”Specify alternate configuration file.
bunx unentropy test --config custom-config.jsonDefault: unentropy.json
--timeout
Section titled “--timeout”Override per-metric timeout in milliseconds.
bunx unentropy test --timeout 60000Default: 30000ms (30 seconds)
Per-metric timeouts in config take precedence when not specified.
Example Output
Section titled “Example Output”Success:
✓ Config schema valid
Collecting metrics:
✓ lines-of-code (integer) 4,521 0.8s
✓ test-coverage (percent) 87.3% 2.1s
✓ bundle (bytes) 240 KB 0.2s
All 3 metrics collected successfully.Failure:
✓ Config schema valid
Collecting metrics:
✓ lines-of-code (integer) 4,521 0.8s
✗ test-coverage (percent) Failed 2.1s
Error: coverage/lcov.info not found
✓ bundle (bytes) 240 KB 0.2s
2 of 3 metrics collected successfully.Exit Codes
Section titled “Exit Codes”- 0: All metrics collected successfully
- 1: Configuration validation failed
- 2: One or more metrics failed to collect
preview
Section titled “preview”Generate HTML report with empty/placeholder data to preview report structure.
bunx unentropy preview [options]Behavior
Section titled “Behavior”- Validates
unentropy.jsonschema - Generates HTML report with all configured metrics
- Shows metrics with no data (empty state)
- Opens report in default browser
Options
Section titled “Options”--config, -c
Section titled “--config, -c”Specify alternate configuration file.
bunx unentropy preview --config custom-config.jsonDefault: unentropy.json
--output, -o
Section titled “--output, -o”Specify output directory.
bunx unentropy preview --output ./reports/previewDefault: unentropy-preview
Creates directory if it doesn’t exist. Report is written to <output>/index.html.
--no-open
Section titled “--no-open”Don’t open browser automatically.
bunx unentropy preview --no-openReport is generated but browser doesn’t launch. Useful in headless/CI environments.
--force, -f
Section titled “--force, -f”Overwrite existing non-empty output directory.
bunx unentropy preview --forceWarning: This deletes existing content in the output directory.
Example Output
Section titled “Example Output”✓ Config schema valid
✓ Generated report: unentropy-preview/index.html
✓ Opening in browser...Exit Codes
Section titled “Exit Codes”- 0: Report generated successfully
- 1: Configuration validation failed
- 1: Output directory exists and is not empty (use
--force) - 1: Report generation failed
- 1: Configuration file not found
verify
Section titled “verify”Validate configuration file schema and structure.
bunx unentropy verify [config]Arguments
Section titled “Arguments”- config (optional): Path to configuration file. Defaults to
unentropy.json.
Behavior
Section titled “Behavior”Validates:
- JSON syntax
- Required fields present
- Valid metric definitions
- Storage configuration correct
- Threshold syntax valid
Example Output
Section titled “Example Output”Success:
✓ Configuration is validFailure:
✗ Configuration validation failed:
Error: Invalid storage type "invalid-type"
Expected: sqlite-local, sqlite-artifact, sqlite-s3
Location: storage.type
Error: Missing required field "command" for metric "coverage"
Location: metrics.coverageExit Codes
Section titled “Exit Codes”- 0: Configuration is valid
- 1: Validation failed
Global Options
Section titled “Global Options”These options work with all commands:
--help, -h
Section titled “--help, -h”Show help for a command.
bunx unentropy --help
bunx unentropy init --help
bunx unentropy test --help--version
Section titled “--version”Show Unentropy version.
bunx unentropy --versionCommon Workflows
Section titled “Common Workflows”First-Time Setup
Section titled “First-Time Setup”# Generate configuration
bunx unentropy init
# Verify it works
bunx unentropy test
# Preview report structure
bunx unentropy preview
# Add workflows to repository (copy from init output)
# Commit and pushAfter Changing Configuration
Section titled “After Changing Configuration”# Validate changes
bunx unentropy verify
# Test metric collection
bunx unentropy test
# Preview report
bunx unentropy preview --forceDebugging Metric Collection
Section titled “Debugging Metric Collection”# Test metric collection
bunx unentropy test
# Increase timeout for slow metrics
bunx unentropy test --timeout 60000Multi-Project Setup
Section titled “Multi-Project Setup”# Project 1 (JavaScript)
cd project1
bunx unentropy init --type javascript
# Project 2 (PHP)
cd ../project2
bunx unentropy init --type phpRelated Resources
Section titled “Related Resources”- Getting Started Guide - Initial setup walkthrough
- Configuration Reference - Config file syntax
- Metrics Guide - Metric configuration