Skip to main content

Command line toolkit for operations teams

Project description

chatops

A command line toolkit for operations teams built with Typer.

Installation

Install from PyPI:

pip install chatops

For local development from a cloned repository:

pip install -e .

Run tests with:

./test.sh

Developer setup

git clone https://github.com/example/chatops.git
cd chatops
python -m venv .venv
source .venv/bin/activate
pip install -e .

Docker usage

Build and run the CLI in a container:

docker build -t chatops .
docker run --rm -v $PWD:/app chatops support --help

Usage

Invoke the CLI with the installed entry point:

chatops --help

The command was previously named chatops-toolkit. That legacy name remains available as an alias, but the recommended entry point is simply chatops.

You can also run the package directly:

python -m chatops --help

Both forms expose the same set of subcommands. Each command is invoked with the chatops prefix:

  • chatops deploy – deployment actions
  • chatops logs – view recent logs
  • chatops cost – cost management reports
  • chatops incident – incident management
  • chatops security – security utilities
  • chatops cve – vulnerability information
  • chatops iam – IAM utilities
  • chatops suggest – AI helpers
  • chatops explain – AI helpers
  • chatops monitor – monitoring checks
  • chatops support – interactive assistant
  • chatops doctor – environment checks
  • chatops env – environment management
  • chatops cloud – cloud platform helpers
  • chatops git – git workflow utilities
  • chatops docker – Docker commands
  • chatops version – show CLI version

Environment configuration

A sample configuration file is bundled with the project at config.yaml.

Copy or symlink this file to ~/.chatops/config.yaml to get started. If the home directory file is missing, the CLI automatically falls back to the repo-local sample. Then define environments in that file:

environments:
  local:
    provider: local
  aws-prod:
    provider: aws
  gcp-prod:
    provider: gcp

Activate one with chatops env use NAME. Each activation creates a sandbox directory under ~/.chatops/sandboxes/NAME used by commands that interact with the chosen provider. Commands read the active environment unless overridden with --env NAME.

Command reference

deploy

  • chatops deploy deploy APP ENV – trigger a GitHub Actions deployment workflow
  • chatops deploy status – print deploy history
  • chatops deploy rollback APP ENV – rollback to last release

logs

  • chatops logs SERVICE – show recent log lines for a service
  • chatops logs live SERVICE – stream live log lines
  • chatops logs grep PATTERN – search log entries
  • chatops logs tail SERVICE [--lines N] – tail logs (default 50 lines)

cost

  • chatops cost azure --subscription-id ID – show Azure cost by service
  • chatops cost forecast – show forecasted monthly spend
  • chatops cost top-spenders – top 5 services by spend
  • chatops cost export [--format csv|json] – export cost data

iam

  • chatops iam list-admins – list IAM admins
  • chatops iam check-expired – find expired credentials
  • chatops iam audit – show IAM misconfigurations

incident

  • chatops incident ack INCIDENT_ID – acknowledge an incident
  • chatops incident who – show on-call rotation
  • chatops incident runbook TOPIC – print SOP for a topic
  • chatops incident report create – generate postmortem template

security

  • chatops security scan PATH – scan for secrets
  • chatops security port-scan HOST – scan open ports
  • chatops security whoami – show cloud identity

cve

  • chatops cve latest – fetch recent CVEs
  • chatops cve search --keyword TEXT – search CVEs

suggest

  • chatops suggest PROMPT – suggest best CLI command

  • chatops suggest explain TEXT – explain an error message

explain

  • chatops explain explain TEXT – explain a stack trace
  • chatops explain autofix FILE – suggest code improvements

monitor

  • chatops monitor uptime URL – check service uptime
  • chatops monitor latency [--threshold MS] – simulate latency alert

support

  • chatops support – launch interactive assistant (prompts for OPENAI_API_KEY if needed)

doctor

  • chatops doctor – verify required tools are installed

env

  • chatops env use NAME – activate NAME
  • chatops env current – show the active environment
  • chatops env list – list configured environments
  • chatops env status – check auth for active environment
  • chatops env exit – deactivate the active environment

generate

  • chatops generate terraform RESOURCE – create Terraform config
  • chatops generate dockerfile – produce a Dockerfile
  • chatops generate github-actions – create CI workflow

agent

  • chatops agent run "if CPU > 80% -> scale" – autonomous actions

test

  • chatops test write --file app.py – generate tests
  • chatops test run – run all tests

compliance

  • chatops compliance scan --profile cmmc – simulate compliance checks

metrics

  • chatops metrics latency --service api – show latency metrics

insight

  • chatops insight top-errors --window 1h – recent log errors

feedback

  • chatops feedback --last up – rate previous response

version

  • chatops version – show CLI version

Example commands

Deploy an application (requires GITHUB_TOKEN and GITHUB_REPOSITORY):

chatops deploy deploy myapp prod

Tail logs for a service:

chatops logs myservice

Generate an Azure cost report for a subscription:

chatops cost azure --subscription-id <SUBSCRIPTION_ID>

Show on-call rotation:

chatops incident who

Run a security scan:

chatops security scan .

Show recent pull requests for a repo:

chatops pr status owner/repo

Display command history:

chatops history show

Display high or critical CVEs published in the last week:

chatops cve latest

Suggest a CLI Command

suggest_command maps natural language requests to a CLI command and requires OPENAI_API_KEY:

from chatops import suggest_command

cmd = suggest_command("restart app on prod")
print(cmd)

Plugins

Custom commands can be added by dropping *.py files in ~/.chatops/plugins or .chatops/plugins within a project. Each plugin should expose a Typer app object. The CLI loads them automatically at startup and reports any errors encountered during loading.

Contributing

See CONTRIBUTING.md for the full contributor guide.

  1. Fork the repository and create a virtual environment.
  2. Install in editable mode with pip install -e ..
  3. Run ./test.sh before submitting a pull request.

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

chatops-0.9.2.tar.gz (29.8 kB view details)

Uploaded Source

Built Distribution

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

chatops-0.9.2-py3-none-any.whl (46.2 kB view details)

Uploaded Python 3

File details

Details for the file chatops-0.9.2.tar.gz.

File metadata

  • Download URL: chatops-0.9.2.tar.gz
  • Upload date:
  • Size: 29.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for chatops-0.9.2.tar.gz
Algorithm Hash digest
SHA256 7e7e868d7cb31a23799479e01aba41e224eeab13a8ce5f7c10391144e7f6e6d0
MD5 6fa39bb12627e4a0cea73118f2ce9734
BLAKE2b-256 6a25dafad8844bd4fca360d0e794c4d31672bc4f7408b33852dcc3b4ee052346

See more details on using hashes here.

Provenance

The following attestation bundles were made for chatops-0.9.2.tar.gz:

Publisher: publish.yml on cloudcwfranck/chatops

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chatops-0.9.2-py3-none-any.whl.

File metadata

  • Download URL: chatops-0.9.2-py3-none-any.whl
  • Upload date:
  • Size: 46.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for chatops-0.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8e7a2943e7f88d08bf0f7b5a5b567373e9ea076b73db83fe3cdc95497d326ebc
MD5 04b305efcc7edd0d75cd372c11698f8d
BLAKE2b-256 18428138f0dc0d3fe79bb44a5b8541b138e6d794afd4f1e48fe6008f4fab6838

See more details on using hashes here.

Provenance

The following attestation bundles were made for chatops-0.9.2-py3-none-any.whl:

Publisher: publish.yml on cloudcwfranck/chatops

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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