Skip to main content

Command-line interface for ContentRX — content-design linter for Figma, code, and CI.

Project description

ContentRX CLI

contentrx-cli is a thin command-line client for the ContentRX content-standards checker. It posts your strings to the ContentRX API and prints violations — the kind of thing you'd call from a pre-commit hook, a CI job, or an ad-hoc terminal check while writing UI copy.

pip install contentrx-cli
export CONTENTRX_API_KEY=cx_...      # mint at https://content-rx.vercel.app/dashboard
contentrx "Click here to learn more"

The CLI ships with no third-party dependencies — stdlib only. Install time is seconds, the attack surface is whatever Python itself already includes.


Authentication

All requests need an API key. Generate one in the dashboard:

https://content-rx.vercel.app/dashboardGenerate key (or Rotate)

The key is shown exactly once. Store it somewhere you trust. The CLI reads it from the CONTENTRX_API_KEY environment variable — no global config file, no per-directory .contentrxrc.

export CONTENTRX_API_KEY=cx_a1b2c3...

If the key is missing or expired the CLI prints a short, actionable error pointing back at the dashboard URL.

Pointing at a non-default backend

Self-hosted or test-deployment users can override the API URL:

export CONTENTRX_API_URL=https://contentrx-staging.example.com

Usage

Single check

contentrx "Save changes"
✓ PASS
  Content type: button_cta
  Active-voice verb. Specific action. Clean.

With hints:

contentrx --content-type error_message "Something went wrong."
contentrx --moment destructive_action "Delete forever?"

JSON output

For piping into other tools or inspecting the raw response:

contentrx --json "Save changes"

Batch check

Text file, one string per line:

cat > strings.txt <<'EOF'
Save changes
Click here to learn more
Something went wrong.
EOF

contentrx --batch strings.txt

JSON with per-string hints:

cat > strings.json <<'EOF'
[
  {"text": "Save changes", "content_type": "button_cta"},
  {"text": "Delete forever?", "moment": "destructive_action"}
]
EOF

contentrx --batch strings.json

Verbose mode

Adds latency + month-to-date usage from the API response:

contentrx -v "Save changes"

Exit codes

Stable across versions — safe to pin on in CI.

Code Meaning
0 All checks passed
1 At least one check failed (violations present)
2 Usage error (argparse / invalid arguments / bad batch file)
3 Missing or invalid CONTENTRX_API_KEY
4 Monthly quota exhausted
5 Rate limit exceeded
6 Network / upstream error

CI examples

GitHub Actions

name: Content lint
on:
  pull_request:
    paths: ['src/**/*.tsx', 'src/**/*.ts']

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: '3.12'
      - run: pip install contentrx-cli
      - name: Lint changed UI strings
        env:
          CONTENTRX_API_KEY: ${{ secrets.CONTENTRX_API_KEY }}
        run: |
          contentrx --batch strings.json

(For AST-based extraction of strings from TSX/JSX, use the contentrx-action GitHub Action instead of rolling your own extraction. Shipped separately in github-action/.)

pre-commit

# .pre-commit-config.yaml
repos:
  - repo: local
    hooks:
      - id: contentrx
        name: ContentRX
        entry: contentrx --batch
        language: system
        files: ^content/strings\.json$

Development

cd cli-client
pip install -e ".[dev]"
pytest tests/

Tests mock the HTTP layer so they run offline without an API key.

License

MIT. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

contentrx_cli-0.1.0.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

contentrx_cli-0.1.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file contentrx_cli-0.1.0.tar.gz.

File metadata

  • Download URL: contentrx_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for contentrx_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 850a5d7da76dde459188dbdc6ab2eafe758fba602b2bc852aab29f8ad8c933f0
MD5 8169d2fbc8edb907b5ea50d77d742e1c
BLAKE2b-256 ef8f60151b4c6a4401d04cc655718001d02a8cd1508802fb35057eb0a522dcb0

See more details on using hashes here.

File details

Details for the file contentrx_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: contentrx_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for contentrx_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 87e738ff86fcdfbbe4afb85b174882325124c80467c6cb66d5d05eba93c6ec76
MD5 4593fe6f99d329bd5adf03b70bf2e54f
BLAKE2b-256 a5052cccd7b20e48766d1f8b127f5d719ff9f7075980d8b7e87187bbfaad7e02

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page