This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
abc (AI Bash Command) is a command-line tool that translates natural language descriptions into shell commands using LLMs. It uses a plugin architecture to support multiple LLM providers.
- abc_cli: Main package containing command generation logic
abc_generate.py: CLI entry point that handles command generationllm_provider.py: Abstract base class that all providers must implementabc_setup.py: Installation script for shell integration- Shell scripts (
abc.sh,abc.tcsh) provide theabcshell function
- abc_provider_anthropic: Anthropic Claude provider
- abc_provider_aws_bedrock: AWS Bedrock provider
- abc_provider_openai: OpenAI GPT provider
- Providers are discovered via Python entry points defined in pyproject.toml
- The
abccommand is a shell function (not a direct Python script) that callsabc_generate - Providers implement the
LLMProviderabstract base class - Configuration uses INI format with sections for different providers
- Shell integration must be idempotent (safe to run multiple times)
# Development install (using Makefile - recommended)
make install-dev
# Manual development install
pipx install -e .
pipx inject abc-cli -e ./abc_provider_anthropic
pipx inject abc-cli -e ./abc_provider_aws_bedrock
pipx inject abc-cli -e ./abc_provider_openai
abc_setup --no-prompt
# Regular install from source
make install
# Nix install (alternative)
make install-nix# Run all tests (using Makefile - creates venv automatically)
make test
# Run tests with coverage report
COVERAGE=1 make test
# Manual testing (requires setting up venv first)
python -m pytest
# Run with coverage
python -m pytest --cov=abc_cli
# Run specific test file
python -m pytest abc_cli/tests/test_abc_generate.py
# Test specific provider
python -m pytest abc_provider_anthropic/tests/
python -m pytest abc_provider_aws_bedrock/tests/
python -m pytest abc_provider_openai/tests/# Show project file tree
make tree
# Clean build artifacts and cache
make clean
# Re-run shell setup (if abc command stops working)
make setup# Complete uninstall (using Makefile)
make uninstall
# Manual uninstall
abc_setup --uninstall --no-prompt
pipx uninstall abc-cli
# Nix uninstall
make uninstall-nix- Python Compatibility: Must support Python ≥ 3.8
- Shell Function: The
abccommand users type is a shell function that:- Calls
abc_generatewith the user's description - Presents the generated command in an editable prompt
- Adds executed commands to shell history
- Calls
- Configuration Priority:
- Primary:
~/.config/abc/config(XDG standard) - Legacy:
~/.abc.conf(for backward compatibility)
- Primary:
- Danger Level Evaluation: Commands are evaluated for potential harm before presentation
- Version Updates: When releasing, update ALL version strings to the same date (YYYY.MM.DD format).
To find all version strings:
git grep -i 'version.*20' - Testing Structure: Tests use pytest with markers (unit, integration, slow) and separate test suites for each provider
When implementing or modifying providers:
- Inherit from
abc_cli.llm_provider.LLMProvider - Implement required methods:
configure(),generate_command(),is_configured() - Register via entry point in pyproject.toml
- Support both environment variables and config file for API keys
- Handle danger level evaluation in generated commands
- Shell Integration:
abc_cli/abc.shandabc_cli/abc.tcsh- shell functions that users actually run - Main CLI:
abc_cli/abc_generate.py- core command generation logic - Provider Base:
abc_cli/llm_provider.py- abstract base class for all providers - Setup Script:
abc_cli/abc_setup.py- handles shell integration installation - Config Template:
abc_cli/abc.conf.template- example configuration