Skip to main content

Observe. Adapt. Contribute. — CLI for the Adaptation Lifecycle

Project description

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

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

code_adapt-0.1.0.tar.gz (25.5 kB view details)

Uploaded Source

Built Distribution

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

code_adapt-0.1.0-py3-none-any.whl (25.6 kB view details)

Uploaded Python 3

File details

Details for the file code_adapt-0.1.0.tar.gz.

File metadata

  • Download URL: code_adapt-0.1.0.tar.gz
  • Upload date:
  • Size: 25.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for code_adapt-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9f24ce892822bab23dfc3649bd52446e149d65b29ba4d19cb7da03ceac0bb560
MD5 4ef70b44e2c5bf91245600d5c297e697
BLAKE2b-256 b8f3894a3edad889ec7103c03f08022156f60cc073566c242d784807cd354d65

See more details on using hashes here.

Provenance

The following attestation bundles were made for code_adapt-0.1.0.tar.gz:

Publisher: publish.yml on aipioneers/code-adapt

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

File details

Details for the file code_adapt-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: code_adapt-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 25.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for code_adapt-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 106488e60e2d50afd5797643cff49dc523ff393c8041b7cf4f1d30db2d346956
MD5 dba3c42e3ce9a6eb2f34ee0e0c396f7c
BLAKE2b-256 6be9eaf8db2e02357f5e46638fea961be69bfec796c69257458c476a947429d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for code_adapt-0.1.0-py3-none-any.whl:

Publisher: publish.yml on aipioneers/code-adapt

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