Skip to main content

**bam** is a content-addressed workflow orchestration tool that brings the power of content-addressable storage (CAS) to everyday development workflows. Based on side projects cascache_lib and cascache_server.

Project description

bam ๐ŸŒŠ

โš ๏ธ PROOF OF CONCEPT - NOT PRODUCTION READY

This is a conceptual implementation for research and development purposes. While it demonstrates core CAS functionality and includes comprehensive testing, it is not intended for production use. Use at your own risk.

See docs/concept.md for more details about the concept and technologies used.

Fast builds, no fluff.

bam is a content-addressed workflow orchestration tool that brings the power of content-addressable storage to everyday development workflows. It bridges the gap between simple task runners (like Make/Just) and complex build systems (like Bazel), providing intelligent caching without forcing teams to restructure their projects.

bam utilizes its partner projects cascache_lib and cascache_server that implement local and remote CAS caching.

Warning: Large parts of this tool were generated with the help of AI. Special thanks to Claude Sonnet for the excellent support!

โœจ Features

  • ๐ŸŽฏ Smart Caching - Content-addressed caching with SHA256 for instant rebuilds
  • ๐ŸŒ Distributed Cache - Share cache across team with automatic retry and fallback
  • โšก Parallel Execution - Auto-detect CPU cores and run independent tasks concurrently
  • ๐ŸŒณ Interactive Tree View - Dagger-style dependency visualization with live progress
  • ๐Ÿ“Š Dependency Graphs - Automatic topological sorting and cycle detection
  • ๐Ÿ” Rich CLI - Beautiful tree views, error context, and progress tracking
  • โš™๏ธ Simple Config - Clean YAML syntax with glob patterns and env vars
  • ๏ฟฝ Runner Support - Run tasks in Docker containers or as inline Python scripts
  • ๐Ÿค– CI Generation - Auto-generate GitHub Actions and GitLab CI pipelines
  • ๐Ÿ›ก๏ธ Type Safe - Full type hints with pyright validation
  • ๐Ÿงช Well Tested - 137 passing tests
  • ๐Ÿ“š Documented - Complete CLI and configuration references

๐Ÿš€ Quick Start

Installation

# Using uv (recommended)
uv pip install bam-tool

# Using pip
pip install bam-tool

# From source
git clone https://gitlab.com/cascascade/bam.git
cd bam
uv sync

Your First Workflow

Create bam.yaml in your project:

version: 1

tasks:
  build:
    command: npm run build
    inputs:
      - "src/**/*.ts"
      - "package.json"
    outputs:
      - "dist/"
  
  test:
    command: npm test
    inputs:
      - "src/**/*.ts"
      - "tests/**/*.ts"
    depends_on:
      - build

Run your tasks:

# Execute a task (and all its dependencies)
bam test

# Parallel execution (auto-detect CPUs)
bam test                 # parallel by default
bam test --jobs 4        # use 4 workers
bam test --jobs 1        # sequential

# Plain output for CI/CD
bam test --plain

# List available tasks
bam --list

# Visualize dependency graph
bam --graph

# Validate configuration
bam --validate

Distributed Caching

Share cache across your team with a remote CAS server:

cache:
  local:
    enabled: true
    path: .bam/cache
  remote:
    enabled: true
    type: cas
    url: grpc://cas.example.com:50051
    token_file: ~/.bam/cas-token
    timeout: 30.0
    max_retries: 3  # Automatic retry on transient errors

Features:

  • ๐Ÿ”„ Automatic retry with exponential backoff
  • ๐Ÿ”Œ Connection pooling for low latency
  • โšก Local-first strategy (check local โ†’ remote โ†’ miss)
  • ๐Ÿ›ก๏ธ Graceful fallback to local on network errors
  • ๐Ÿ“Š Statistics tracking (future: bam cache stats)

See examples/remote-cache/ for complete setup guide.

๐Ÿ“– Documentation

User Guides:

Technical Specifications:

๐ŸŽฏ Use Cases

Python Project

version: 1

tasks:
  lint:
    command: ruff check src/
    inputs: ["src/**/*.py", "pyproject.toml"]
  
  typecheck:
    command: pyright
    inputs: ["src/**/*.py"]
  
  test:
    command: pytest
    inputs: ["src/**/*.py", "tests/**/*.py"]
    depends_on: [lint, typecheck]
  
  build:
    command: python -m build
    inputs: ["src/**/*.py", "pyproject.toml"]
    outputs: ["dist/"]
    depends_on: [test]

Multi-Stage Build

version: 1

tasks:
  generate:
    command: protoc --python_out=. schema.proto
    inputs: ["schema.proto"]
    outputs: ["schema_pb2.py"]
  
  build-backend:
    command: go build -o backend cmd/server/main.go
    inputs: ["cmd/**/*.go", "*.proto"]
    outputs: ["backend"]
    depends_on: [generate]
  
  build-frontend:
    command: npm run build
    inputs: ["src/**/*.ts"]
    outputs: ["dist/"]
    depends_on: [generate]
  
  package:
    command: docker build -t myapp .
    inputs: ["backend", "dist/", "Dockerfile"]
    depends_on: [build-backend, build-frontend]

๐ŸŽจ CLI Reference

bam uses a flat command interface โ€” tasks are run directly as bam <task>, and management operations are flags.

Running Tasks

# Run a task (and all its dependencies)
bam build

# Control parallelism
bam build --jobs 8      # use 8 workers
bam build --jobs auto   # auto-detect CPUs (default)
bam build --jobs 1      # sequential

# Dry run (show execution plan without running)
bam build --dry-run

# Disable caching
bam build --no-cache

# Quiet mode
bam build -q

# Plain output for CI/CD
bam build --plain

Interactive Tree View:

๐Ÿ“ฆ Tasks
โ”œโ”€โ”€ โœ“ lint               โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 100%
โ”œโ”€โ”€ โœ“ typecheck          โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 100%
โ”‚   โ””โ”€โ”€ โœ“ test           โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 100%
โ”‚       โ””โ”€โ”€ โœ“ build      โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 100%

โœ“ Successfully executed 4 task(s)

Error Context:

When tasks fail, bam shows the full dependency chain and which tasks were skipped:

โœ— Task failed: test
  Dependency chain:
    โ”œโ”€ lint
    โ”œโ”€ typecheck
    โ””โ”€ test

โŠ˜ Skipped 1 task(s) due to failure:
  โ€ข build

Management Flags

bam --list              # List all configured tasks
bam --validate          # Validate config (YAML, deps, cycles)
bam --graph             # Show ASCII dependency graph
bam --graph-dot         # Output DOT format (pipe to Graphviz)
bam --clean             # Clean cache (prompts for confirmation)
bam --clean-force       # Clean cache without confirmation
bam --dry-run           # Show execution plan (no task specified)
bam --version           # Show version

CI Pipeline Generation

bam --ci                # Generate CI pipeline (writes file)
bam --ci-dry-run        # Preview CI YAML without writing
bam --ci-output FILE    # Write to custom path

Global Options

--config PATH           # Path to bam.yaml (default: auto-discover)
--jobs N / auto         # Parallel workers (default: auto)
--no-cache              # Disable caching for this run
--dry-run               # Show plan without running
--quiet, -q             # Suppress output
--plain                 # Force plain output (no rich UI)

๐Ÿ—๏ธ Architecture

bam is built as a layered system:

CLI โ†’ Config โ†’ Graph โ†’ Executor โ†’ Cache

Each layer is independently testable with clear interfaces. The architecture supports local-first operation with future remote cache backends.

For detailed architecture documentation, see spec/architecture.md.

๐Ÿงช Testing

bam maintains high code quality with comprehensive testing:

# Run unit and integration tests
uv run pytest

# With coverage report
uv run pytest --cov=bam_tool --cov-report=html

# cascache integration tests (requires Docker)
./tests/integration-cascache/run-tests.sh

Current Status:

  • 137 passing tests
  • Unit, integration, and component test levels
  • Optional: cascache integration tests with Docker Compose

Test Levels:

  • Unit tests (tests/unit/) - Fast, mocked dependencies
  • Integration tests (tests/integration/) - Component interaction, local only
  • Component tests (tests/component/) - CLI end-to-end tests
  • cascache integration (tests/integration-cascache/) - Real cascache server (Docker-based)

For detailed testing strategy, see spec/testing.md and tests/integration-cascache/README.md.

๐Ÿ› ๏ธ Development

Quick Setup

# Clone and install
git clone https://gitlab.com/cascascade/bam.git
cd bam
uv sync

Common Commands

uv run ruff check src tests     # Lint
uv run pyright                  # Type checking
uv run pytest                   # Tests
bam lint                        # Run lint via bam
bam test                        # Run all tests via bam
bam build                       # Full build via bam

๐Ÿ“Š Status

Phase 1: Core MVP โœ… COMPLETE (2026-02-12)

  • โœ… Task execution with dependencies
  • โœ… Content-addressable caching
  • โœ… YAML configuration
  • โœ… Rich CLI interface
  • โœ… Graph visualization
  • โœ… 85% test coverage
  • โœ… Complete documentation

Phase 2: Parallelization โœ… Complete

  • โœ… Async task execution
  • โœ… Parallel execution with --jobs flag
  • โœ… Auto CPU detection
  • โœ… Interactive tree view with live progress
  • โœ… Dependency-aware scheduling
  • โœ… Better error context with dependency chains
  • โœ… TTY detection for CI/CD compatibility

Phase 3: Extended Runners & CI โœ… Complete

  • โœ… Flat CLI interface (bam <task> instead of bam run <task>)
  • โœ… Shell tab completion for task names
  • โœ… CI pipeline generation (--ci) for GitHub Actions and GitLab CI
  • โœ… Docker runner (runner.type: docker)
  • โœ… Python-uv runner (runner.type: python-uv) for inline scripts
  • โœ… Runner-aware cache keys

Coming Soon:

  • ๐Ÿ”„ Phase 4: Remote cache hardening (advanced CAS sync, observability, reliability)
  • ๐ŸŽจ Phase 5: Enhanced developer experience

See roadmap.md for details.

๐Ÿค Contributing

Contributions welcome! Please:

  • Follow PEP 8 and project code style
  • Add tests for new functionality
  • Update documentation as needed
  • Run quality checks before submitting

Development setup instructions in the Development section above.

๐Ÿ“ License

MIT License - see LICENSE for details.

๐Ÿ”— Links

Documentation:

Specifications:

Examples:


Built with: Python 3.14+ โ€ข uv โ€ข Typer โ€ข Rich โ€ข NetworkX โ€ข Pydantic โ€ข cascache_lib

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

bam_tool-0.5.0.tar.gz (47.6 kB view details)

Uploaded Source

Built Distribution

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

bam_tool-0.5.0-py3-none-any.whl (30.4 kB view details)

Uploaded Python 3

File details

Details for the file bam_tool-0.5.0.tar.gz.

File metadata

  • Download URL: bam_tool-0.5.0.tar.gz
  • Upload date:
  • Size: 47.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for bam_tool-0.5.0.tar.gz
Algorithm Hash digest
SHA256 016f3a7310014013add0ebff53beaef9251bbb11e04a58b02e8bc1957d221bbe
MD5 faa753355176aab97c9cc03b68b56552
BLAKE2b-256 82d27cbb0af9d3c6037b6e65c4f31e2293f1e1fd594ff2db7426cc6cbc91412a

See more details on using hashes here.

File details

Details for the file bam_tool-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: bam_tool-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 30.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for bam_tool-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2a396ec49d9f76feff290f0bc91529d09f3216461ba668b6eaa6044eb422bbab
MD5 db5a5919a883767c99da02d8d55f6a0d
BLAKE2b-256 f0163c2ff38198e80a582ab84834eaa3087abae2832584dfeea160bccbdc38d6

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