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:
- Observe: Track upstream changes through observations
- Analyze: Classify and understand each change
- Assess: Evaluate relevance and risk
- Plan: Design implementation strategy
- Implement: Apply changes to downstream project
- Validate: Verify correctness
- Contribute: Push changes upstream
- Learn: Record outcomes and maintain statistics
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f24ce892822bab23dfc3649bd52446e149d65b29ba4d19cb7da03ceac0bb560
|
|
| MD5 |
4ef70b44e2c5bf91245600d5c297e697
|
|
| BLAKE2b-256 |
b8f3894a3edad889ec7103c03f08022156f60cc073566c242d784807cd354d65
|
Provenance
The following attestation bundles were made for code_adapt-0.1.0.tar.gz:
Publisher:
publish.yml on aipioneers/code-adapt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
code_adapt-0.1.0.tar.gz -
Subject digest:
9f24ce892822bab23dfc3649bd52446e149d65b29ba4d19cb7da03ceac0bb560 - Sigstore transparency entry: 1171910440
- Sigstore integration time:
-
Permalink:
aipioneers/code-adapt@7eb08f6bd3f13f96662d6d9845d39a67eb329035 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/aipioneers
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7eb08f6bd3f13f96662d6d9845d39a67eb329035 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
106488e60e2d50afd5797643cff49dc523ff393c8041b7cf4f1d30db2d346956
|
|
| MD5 |
dba3c42e3ce9a6eb2f34ee0e0c396f7c
|
|
| BLAKE2b-256 |
6be9eaf8db2e02357f5e46638fea961be69bfec796c69257458c476a947429d1
|
Provenance
The following attestation bundles were made for code_adapt-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on aipioneers/code-adapt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
code_adapt-0.1.0-py3-none-any.whl -
Subject digest:
106488e60e2d50afd5797643cff49dc523ff393c8041b7cf4f1d30db2d346956 - Sigstore transparency entry: 1171910450
- Sigstore integration time:
-
Permalink:
aipioneers/code-adapt@7eb08f6bd3f13f96662d6d9845d39a67eb329035 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/aipioneers
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7eb08f6bd3f13f96662d6d9845d39a67eb329035 -
Trigger Event:
release
-
Statement type: