Skip to main content

code-adapt CLI

Observe. Adapt. Contribute.

A command-line tool for managing the adaptation lifecycle: observing upstream changes, analyzing and assessing them, planning adaptations, implementing changes, and contributing back upstream.

Features

  • Observe: Track upstream repository changes (commits, PRs, releases)
  • Analyze: Deep analysis of specific changes with classification and intent extraction
  • Assess: Evaluate relevance against downstream projects
  • Plan: Generate detailed adaptation plans with strategies
  • Implement: Create file stubs and TODO markers for adaptations
  • Validate: Verify implemented adaptations
  • Contribute: Prepare upstream contributions with draft PRs
  • Reporting: Generate weekly and release activity reports
  • Learning: Track adaptation outcomes and maintain statistics
  • Policy Management: Define and validate adaptation policies
  • Profile Management: Create and manage project profiles

Quick Start

Installation

# Clone the repository
git clone https://github.com/aipioneers/adapt.git
cd adapt

# Install (editable mode for development)
pip install -e ".[dev]"

Authentication

# Option 1: Use GitHub CLI
gh auth login

# Option 2: Set environment variable
export GITHUB_TOKEN="your_token_here"

Initialize a Project

code-adapt init

Add Repositories

# Add upstream repository
code-adapt repo add upstream myrepo https://github.com/owner/myrepo.git

# Add downstream repository
code-adapt repo add downstream myproject https://github.com/owner/myproject.git

Observe Changes

# Observe all changes since last time
code-adapt observe myrepo

# Observe changes in the last 7 days
code-adapt observe myrepo --since 7d

# Observe only pull requests
code-adapt observe myrepo --prs

Analyze Changes

code-adapt analyze pr-123
code-adapt analyze commit-a1b2c3d
code-adapt analyze release-v1.0.0

Assess Relevance

code-adapt assess pr-123 --against downstream-project

Plan and Implement

# Generate adaptation plan
code-adapt plan adaptation-id

# Implement with dry-run first
code-adapt implement adaptation-id --dry-run

# Create implementation branch and open PR
code-adapt implement adaptation-id --branch --open-pr

Development

# Install with dev dependencies
pip install -e ".[dev]"

# Run all tests
pytest tests/ -v

# Run single test file
pytest tests/test_models.py -v

# Run tests matching pattern
pytest -k "test_security" -v

# Run with coverage
pytest --cov=code_adapt tests/

Project Structure

adapt/
├── code_adapt/
│   ├── cli/main.py      # Typer CLI with all 15 commands
│   ├── services/         # github, auth, classifier, assessor, id_generator
│   ├── models.py         # Pydantic models & state machine
│   ├── storage.py        # YAML/JSON I/O with atomic writes
│   └── errors.py         # Custom error hierarchy
├── tests/                # pytest test suite
└── .adapt/               # Runtime data directory (git-tracked)

Architecture

The code-adapt CLI follows the adaptation lifecycle pattern:

  1. Observe: Track upstream changes through observations
  2. Analyze: Classify and understand each change
  3. Assess: Evaluate relevance and risk
  4. Plan: Design implementation strategy
  5. Implement: Apply changes to downstream project
  6. Validate: Verify correctness
  7. Contribute: Push changes upstream
  8. Learn: Record outcomes and maintain statistics

License

MIT

Metadata

Release files for code-adapt 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for code-adapt 0.1.0
File Size Uploaded
code_adapt-0.1.0.tar.gz 25.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for code-adapt 0.1.0
File Interpreter ABI Platform
code_adapt-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 51.2 kB

Release files / code_adapt-0.1.0.tar.gz

Download URL code_adapt-0.1.0.tar.gz
Size 25.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9f24ce892822bab23dfc3649bd52446e149d65b29ba4d19cb7da03ceac0bb560
BLAKE2b-256 checksum
How to use checksums
b8f3894a3edad889ec7103c03f08022156f60cc073566c242d784807cd354d65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 24, 2026.

Transparency log

Release files / code_adapt-0.1.0-py3-none-any.whl

Download URL code_adapt-0.1.0-py3-none-any.whl
Size 25.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
106488e60e2d50afd5797643cff49dc523ff393c8041b7cf4f1d30db2d346956
BLAKE2b-256 checksum
How to use checksums
6be9eaf8db2e02357f5e46638fea961be69bfec796c69257458c476a947429d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 24, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page