CLI
The Cohera CLI provides a powerful command-line interface for managing your Cohera resources, running agents, and automating workflows.
Installation
Section titled “Installation”npm install -g @cohera/cliOr with other package managers:
# Yarnyarn global add @cohera/cli
# pnpmpnpm add -g @cohera/cli
# Homebrew (macOS/Linux)brew install cohera-io/tap/coheraVerify the installation:
cohera --versionQuick Start
Section titled “Quick Start”-
Configure your API key:
Terminal window cohera config set api-key ck_live_... -
Verify the connection:
Terminal window cohera whoami -
List your certificates:
Terminal window cohera certificates list
Configuration
Section titled “Configuration”Setting Up
Section titled “Setting Up”# Set API keycohera config set api-key ck_live_...
# Set organization (for multi-org accounts)cohera config set org-id org_abc123
# Set default output formatcohera config set format json
# View current configurationcohera config listConfiguration File
Section titled “Configuration File”The CLI stores configuration in ~/.cohera/config.yaml:
api-key: ck_live_...org-id: org_abc123format: tablebase-url: https://api.cohera.ioEnvironment Variables
Section titled “Environment Variables”You can also use environment variables:
export COHERA_API_KEY=ck_live_...export COHERA_ORG_ID=org_abc123export COHERA_FORMAT=jsonCommands
Section titled “Commands”Certificates
Section titled “Certificates”# List all certificatescohera certificates list
# List with filterscohera certificates list --status active --supplier sup_abc123
# Get a specific certificatecohera certificates get cert_abc123
# Get with relationshipscohera certificates get cert_abc123 --include supplier,components
# Create a certificatecohera certificates create \ --name "CoA - Batch 2024-001" \ --supplier sup_abc123 \ --type coa \ --expiry 2025-06-30
# Update a certificatecohera certificates update cert_abc123 --status expired
# Delete a certificatecohera certificates delete cert_abc123
# Export to filecohera certificates list --format json > certificates.jsoncohera certificates list --format csv > certificates.csvSuppliers
Section titled “Suppliers”# List supplierscohera suppliers list
# Search supplierscohera suppliers search "Acme"
# Get supplier detailscohera suppliers get sup_abc123
# Create suppliercohera suppliers create \ --name "Acme Chemicals" \ --email contact@acme.com \ --status approved
# Update suppliercohera suppliers update sup_abc123 --status inactiveComponents
Section titled “Components”# List componentscohera components list
# Get component with graphcohera components get comp_abc123 --include supplier,certificates,products
# List by suppliercohera components list --supplier sup_abc123Products
Section titled “Products”# List productscohera products list
# Get product with BOMcohera products get prod_abc123 --include bom,components
# Impact analysiscohera products affected-by --certificate cert_abc123Agents
Section titled “Agents”# List available agentscohera agents list
# Run the certificate intake agentcohera agents run certificate-intake \ --input document.pdf \ --supplier sup_abc123
# Run impact analysiscohera agents run impact-analysis \ --certificate cert_abc123
# Run expiry checkcohera agents run expiry-check \ --days 30 \ --notify
# Check agent statuscohera agents status job_abc123
# View agent logscohera agents logs job_abc123Workflows
Section titled “Workflows”# List workflowscohera workflows list
# Trigger a workflowcohera workflows trigger certificate-renewal \ --certificate cert_abc123
# Check workflow statuscohera workflows status wf_abc123Output Formats
Section titled “Output Formats”Table (Default)
Section titled “Table (Default)”cohera certificates list --format tableID NAME STATUS EXPIRYcert_abc123 CoA - Batch 2024-001 active 2025-06-30cert_def456 CoC - Material X active 2025-03-15cert_ghi789 GMP Certificate expired 2024-01-01cohera certificates list --format json[ { "id": "cert_abc123", "name": "CoA - Batch 2024-001", "status": "active", "expiryDate": "2025-06-30T00:00:00Z" }]cohera certificates list --format csvid,name,status,expiryDatecert_abc123,CoA - Batch 2024-001,active,2025-06-30cert_def456,CoC - Material X,active,2025-03-15cohera certificates list --format yaml- id: cert_abc123 name: CoA - Batch 2024-001 status: active expiryDate: 2025-06-30Scripting
Section titled “Scripting”Using JQ
Section titled “Using JQ”# Get certificate namescohera certificates list --format json | jq '.[].name'
# Filter expiring certificatescohera certificates list --format json | jq '[.[] | select(.daysUntilExpiry < 30)]'
# Count by statuscohera certificates list --format json | jq 'group_by(.status) | map({status: .[0].status, count: length})'Shell Scripts
Section titled “Shell Scripts”#!/bin/bash
# Check for expiring certificates and send notificationsexpiring=$(cohera certificates list --status active --expires-within 30d --format json)
if [ "$(echo $expiring | jq length)" -gt 0 ]; then echo "Found expiring certificates:" echo $expiring | jq -r '.[] | "\(.name) expires on \(.expiryDate)"'
# Send notification (example with Slack) curl -X POST $SLACK_WEBHOOK -d "{ \"text\": \"Warning: $(echo $expiring | jq length) certificates expiring soon\" }"fiCI/CD Integration
Section titled “CI/CD Integration”name: Certificate Check
on: schedule: - cron: '0 8 * * *' # Daily at 8 AM
jobs: check: runs-on: ubuntu-latest steps: - name: Install Cohera CLI run: npm install -g @cohera/cli
- name: Check expiring certificates env: COHERA_API_KEY: ${{ secrets.COHERA_API_KEY }} run: | cohera certificates list \ --status active \ --expires-within 30d \ --format json > expiring.json
if [ $(jq length expiring.json) -gt 0 ]; then echo "::warning::Found expiring certificates" jq -r '.[] | "- \(.name) expires \(.expiryDate)"' expiring.json fiInteractive Mode
Section titled “Interactive Mode”Start an interactive session:
cohera interactiveWelcome to Cohera CLI Interactive ModeType 'help' for available commands, 'exit' to quit
cohera> certificates list --status activeID NAME STATUS EXPIRYcert_abc123 CoA - Batch 2024-001 active 2025-06-30
cohera> certificates get cert_abc123 --include supplier{ "id": "cert_abc123", "name": "CoA - Batch 2024-001", "supplier": { "id": "sup_abc123", "name": "Acme Chemicals" }}
cohera> exitPlugins
Section titled “Plugins”Extend the CLI with plugins:
# Install a plugincohera plugins install @cohera/cli-plugin-veeva
# List installed pluginscohera plugins list
# Use plugin commandscohera veeva sync --vault prodTroubleshooting
Section titled “Troubleshooting”Debug Mode
Section titled “Debug Mode”# Enable verbose loggingcohera certificates list --debug
# Show HTTP requests/responsescohera certificates list --verboseCommon Issues
Section titled “Common Issues”Getting Help
Section titled “Getting Help”# General helpcohera --help
# Command-specific helpcohera certificates --helpcohera certificates list --help
# Version infocohera --versionAutocomplete
Section titled “Autocomplete”Enable shell autocompletion:
# Bashcohera completion bash >> ~/.bashrc
# Zshcohera completion zsh >> ~/.zshrc
# Fishcohera completion fish > ~/.config/fish/completions/cohera.fish
# PowerShellcohera completion powershell >> $PROFILEAPI Reference
Section titled “API Reference”For complete documentation, see: