evolution-engine 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- evolution_engine-0.1.0/MANIFEST.in +3 -0
- evolution_engine-0.1.0/PKG-INFO +338 -0
- evolution_engine-0.1.0/README.md +303 -0
- evolution_engine-0.1.0/evolution/__init__.py +1 -0
- evolution_engine-0.1.0/evolution/adapter_scaffold.py +712 -0
- evolution_engine-0.1.0/evolution/adapter_validator.py +347 -0
- evolution_engine-0.1.0/evolution/adapters/__init__.py +11 -0
- evolution_engine-0.1.0/evolution/adapters/ci/__init__.py +3 -0
- evolution_engine-0.1.0/evolution/adapters/ci/github_actions_adapter.py +171 -0
- evolution_engine-0.1.0/evolution/adapters/config/__init__.py +3 -0
- evolution_engine-0.1.0/evolution/adapters/config/terraform_adapter.py +108 -0
- evolution_engine-0.1.0/evolution/adapters/dependency/__init__.py +3 -0
- evolution_engine-0.1.0/evolution/adapters/dependency/pip_adapter.py +107 -0
- evolution_engine-0.1.0/evolution/adapters/deployment/__init__.py +3 -0
- evolution_engine-0.1.0/evolution/adapters/deployment/github_releases_adapter.py +142 -0
- evolution_engine-0.1.0/evolution/adapters/git/__init__.py +4 -0
- evolution_engine-0.1.0/evolution/adapters/git/git_adapter.py +69 -0
- evolution_engine-0.1.0/evolution/adapters/git/git_history_walker.py +608 -0
- evolution_engine-0.1.0/evolution/adapters/github_client.py +177 -0
- evolution_engine-0.1.0/evolution/adapters/schema/__init__.py +3 -0
- evolution_engine-0.1.0/evolution/adapters/schema/openapi_adapter.py +130 -0
- evolution_engine-0.1.0/evolution/adapters/security/__init__.py +3 -0
- evolution_engine-0.1.0/evolution/adapters/security/github_security_adapter.py +169 -0
- evolution_engine-0.1.0/evolution/adapters/security/trivy_adapter.py +113 -0
- evolution_engine-0.1.0/evolution/adapters/testing/__init__.py +3 -0
- evolution_engine-0.1.0/evolution/adapters/testing/junit_adapter.py +149 -0
- evolution_engine-0.1.0/evolution/agents/__init__.py +15 -0
- evolution_engine-0.1.0/evolution/agents/anthropic_agent.py +94 -0
- evolution_engine-0.1.0/evolution/agents/base.py +149 -0
- evolution_engine-0.1.0/evolution/agents/cli_agent.py +120 -0
- evolution_engine-0.1.0/evolution/cli.py +1160 -0
- evolution_engine-0.1.0/evolution/config.py +161 -0
- evolution_engine-0.1.0/evolution/data/adapter_catalog.json +28 -0
- evolution_engine-0.1.0/evolution/data/sdk_fingerprints.json +302 -0
- evolution_engine-0.1.0/evolution/data/universal_patterns.json +1218 -0
- evolution_engine-0.1.0/evolution/fixer.py +439 -0
- evolution_engine-0.1.0/evolution/fp_validation.py +355 -0
- evolution_engine-0.1.0/evolution/friendly.py +200 -0
- evolution_engine-0.1.0/evolution/inline_suggestions.py +253 -0
- evolution_engine-0.1.0/evolution/investigator.py +250 -0
- evolution_engine-0.1.0/evolution/kb_export.py +195 -0
- evolution_engine-0.1.0/evolution/kb_security.py +271 -0
- evolution_engine-0.1.0/evolution/kb_sync.py +302 -0
- evolution_engine-0.1.0/evolution/knowledge_store.py +431 -0
- evolution_engine-0.1.0/evolution/license.py +289 -0
- evolution_engine-0.1.0/evolution/llm_anthropic.py +73 -0
- evolution_engine-0.1.0/evolution/llm_openrouter.py +83 -0
- evolution_engine-0.1.0/evolution/orchestrator.py +421 -0
- evolution_engine-0.1.0/evolution/phase1_engine.py +117 -0
- evolution_engine-0.1.0/evolution/phase2_engine.py +543 -0
- evolution_engine-0.1.0/evolution/phase3_1_renderer.py +75 -0
- evolution_engine-0.1.0/evolution/phase3_engine.py +212 -0
- evolution_engine-0.1.0/evolution/phase4_engine.py +1120 -0
- evolution_engine-0.1.0/evolution/phase5_engine.py +1076 -0
- evolution_engine-0.1.0/evolution/pr_comment.py +242 -0
- evolution_engine-0.1.0/evolution/prescan.py +363 -0
- evolution_engine-0.1.0/evolution/registry.py +394 -0
- evolution_engine-0.1.0/evolution/report_generator.py +884 -0
- evolution_engine-0.1.0/evolution/telemetry.py +141 -0
- evolution_engine-0.1.0/evolution/validation_gate.py +40 -0
- evolution_engine-0.1.0/evolution_engine.egg-info/PKG-INFO +338 -0
- evolution_engine-0.1.0/evolution_engine.egg-info/SOURCES.txt +67 -0
- evolution_engine-0.1.0/evolution_engine.egg-info/dependency_links.txt +1 -0
- evolution_engine-0.1.0/evolution_engine.egg-info/entry_points.txt +2 -0
- evolution_engine-0.1.0/evolution_engine.egg-info/requires.txt +13 -0
- evolution_engine-0.1.0/evolution_engine.egg-info/top_level.txt +1 -0
- evolution_engine-0.1.0/pyproject.toml +64 -0
- evolution_engine-0.1.0/setup.cfg +4 -0
- evolution_engine-0.1.0/tests/test_git_history_walker.py +139 -0
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: evolution-engine
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Git-native codebase evolution indexer
|
|
5
|
+
Author: Slava
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://codequal.dev
|
|
8
|
+
Project-URL: Repository, https://github.com/alpsla/evolution_monitor
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/alpsla/evolution_monitor/issues
|
|
10
|
+
Keywords: git,devops,ci-cd,code-quality,evolution,drift-detection,codebase-analysis
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
15
|
+
Classifier: Topic :: Software Development :: Testing
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
21
|
+
Classifier: Operating System :: OS Independent
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
Requires-Dist: GitPython>=3.1
|
|
25
|
+
Requires-Dist: click>=8.0
|
|
26
|
+
Requires-Dist: requests>=2.25
|
|
27
|
+
Requires-Dist: jinja2>=3.0
|
|
28
|
+
Provides-Extra: llm
|
|
29
|
+
Requires-Dist: requests>=2.25; extra == "llm"
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
33
|
+
Requires-Dist: python-dotenv>=0.19; extra == "dev"
|
|
34
|
+
Requires-Dist: stripe>=7.0; extra == "dev"
|
|
35
|
+
|
|
36
|
+
# Evolution Engine
|
|
37
|
+
|
|
38
|
+
**Development Process Intelligence — a local-first CLI tool that observes how software evolves, learns what is structurally normal, and surfaces unexpected change with evidence to act.**
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## What It Does
|
|
43
|
+
|
|
44
|
+
Run `evo analyze .` on any git repository. The Evolution Engine detects adapters automatically, builds per-repo baselines, and reports when your development process deviates from its own historical norms — across commits, CI, dependencies, deployments, and more.
|
|
45
|
+
|
|
46
|
+
No data leaves your machine. No configuration required. No accounts to create.
|
|
47
|
+
|
|
48
|
+
### The Pipeline
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
Sources → Phase 1 (Record) → Phase 2 (Measure) → Phase 3 (Explain)
|
|
52
|
+
│ │
|
|
53
|
+
└──── Phase 4 (Learn) ←──┘
|
|
54
|
+
│
|
|
55
|
+
Phase 5 (Inform)
|
|
56
|
+
│
|
|
57
|
+
HTML Report
|
|
58
|
+
│
|
|
59
|
+
HUMAN / AI
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
| Phase | What It Does |
|
|
63
|
+
|-------|-------------|
|
|
64
|
+
| **Phase 1** | Records immutable events from truth sources |
|
|
65
|
+
| **Phase 2** | Computes baselines and deviation signals (MAD/IQR robust statistics) |
|
|
66
|
+
| **Phase 3** | Explains signals in human language (template + optional LLM) |
|
|
67
|
+
| **Phase 4** | Discovers cross-source patterns (correlation, lift, presence-based) |
|
|
68
|
+
| **Phase 5** | Advisory reports with evidence packages |
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Quick Start
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Install
|
|
76
|
+
pip install evolution-engine
|
|
77
|
+
|
|
78
|
+
# Analyze any git repository
|
|
79
|
+
evo analyze .
|
|
80
|
+
|
|
81
|
+
# With a GitHub token (unlocks CI, deployment, security data)
|
|
82
|
+
evo analyze . --token ghp_xxx
|
|
83
|
+
|
|
84
|
+
# Generate an HTML report
|
|
85
|
+
evo report .
|
|
86
|
+
|
|
87
|
+
# See what adapters were detected
|
|
88
|
+
evo status
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### From Source
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
git clone <repo-url>
|
|
95
|
+
cd evolution-engine
|
|
96
|
+
python -m venv .venv
|
|
97
|
+
source .venv/bin/activate
|
|
98
|
+
pip install -e .
|
|
99
|
+
|
|
100
|
+
# Run the test suite (246 tests)
|
|
101
|
+
python -m pytest tests/ -v
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Environment Variables
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# .env file (all optional)
|
|
108
|
+
GITHUB_TOKEN=ghp_xxx # Unlocks CI, deployment, security adapters
|
|
109
|
+
EVO_LICENSE_KEY=xxx # Pro/Team features (free tier works without)
|
|
110
|
+
OPENROUTER_API_KEY=xxx # LLM-enhanced explanations (Phase 3.1)
|
|
111
|
+
PHASE31_ENABLED=false # LLM off by default
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Source Families & Auto-Detection
|
|
117
|
+
|
|
118
|
+
The adapter registry automatically detects available data sources in three tiers:
|
|
119
|
+
|
|
120
|
+
### Tier 1 — File-Based (zero config, always works offline)
|
|
121
|
+
|
|
122
|
+
| Family | Detected By | What It Observes |
|
|
123
|
+
|--------|------------|-----------------|
|
|
124
|
+
| Version Control | `.git/` | Commits, file changes, structural coupling, co-change novelty |
|
|
125
|
+
| Dependency Graph | `requirements.txt`, `package-lock.json`, `go.mod`, `Cargo.lock`, `Gemfile.lock` | Dependency count, churn, transitive depth |
|
|
126
|
+
| Configuration | `*.tf`, `docker-compose.yml` | Resource count, config churn |
|
|
127
|
+
| Schema / API | `openapi.yaml`, `*.graphql` | Endpoint growth, field changes |
|
|
128
|
+
|
|
129
|
+
### Tier 2 — API-Enriched (optional token unlocks more)
|
|
130
|
+
|
|
131
|
+
| Family | Token | What It Observes |
|
|
132
|
+
|--------|-------|-----------------|
|
|
133
|
+
| CI / Build Pipeline | `GITHUB_TOKEN` | Build durations, failure rates |
|
|
134
|
+
| Deployment | `GITHUB_TOKEN` | Release cadence, pre-releases, asset count |
|
|
135
|
+
| Security Scanning | `GITHUB_TOKEN` | Vulnerability count, severity, Dependabot alerts |
|
|
136
|
+
|
|
137
|
+
### Tier 3 — Community Plugins (pip-installable)
|
|
138
|
+
|
|
139
|
+
Already using tools like **Snyk**, **SonarQube**, **Jenkins**, **ArgoCD**, **GitLab CI**, **Datadog**, or **PagerDuty**? Evo doesn't replace them — it learns from them. Install or build an adapter to feed their data into the pipeline, and Evo will correlate it with your git history, dependencies, and other sources to discover cross-tool patterns.
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
pip install evo-adapter-jenkins # Jenkins CI adapter
|
|
143
|
+
pip install evo-adapter-snyk # Snyk security adapter
|
|
144
|
+
pip install evo-adapter-argocd # ArgoCD deployment adapter
|
|
145
|
+
evo analyze . # Auto-detected!
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Plugins are auto-discovered via Python `entry_points`. If an adapter for your tool doesn't exist yet, you can [build one](#building-adapters) or [request one](#cli-commands) (`evo adapter request`).
|
|
149
|
+
|
|
150
|
+
### Historical Replay
|
|
151
|
+
|
|
152
|
+
The **Git History Walker** extracts dependency, schema, and config files from git history, creating temporal evolution timelines (not just current-state snapshots). This enables Phase 4 to correlate dependency changes with CI failures, deployments, and other events over time.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## CLI Commands
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# Core
|
|
160
|
+
evo analyze [path] # Detect adapters, run full pipeline
|
|
161
|
+
evo analyze . --families git,ci # Override auto-detection
|
|
162
|
+
evo report [path] # Generate HTML report from last run
|
|
163
|
+
evo status # Show detected adapters and event counts
|
|
164
|
+
|
|
165
|
+
# Patterns & Knowledge Base
|
|
166
|
+
evo patterns list # Show discovered patterns
|
|
167
|
+
evo patterns export # Export anonymized pattern digests
|
|
168
|
+
evo patterns import <file> # Import community patterns
|
|
169
|
+
evo patterns sync # Sync universal patterns
|
|
170
|
+
|
|
171
|
+
# Adapter Ecosystem
|
|
172
|
+
evo adapter list # Show detected + installed adapters
|
|
173
|
+
evo adapter validate <class> # Run 13-check certification
|
|
174
|
+
evo adapter guide # How to build an adapter
|
|
175
|
+
evo adapter new <name> --family ci # Scaffold a pip-installable package
|
|
176
|
+
evo adapter prompt <name> --family ci # Generate AI prompt for building
|
|
177
|
+
evo adapter request <description> # Request an adapter from the community
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Building Adapters
|
|
183
|
+
|
|
184
|
+
The Evolution Engine supports a plugin ecosystem. Third-party adapters are pip-installable packages that auto-register via Python `entry_points`.
|
|
185
|
+
|
|
186
|
+
### Quick Path
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
# Scaffold a complete pip package
|
|
190
|
+
evo adapter new jenkins --family ci
|
|
191
|
+
|
|
192
|
+
# Or generate an AI prompt and paste it into your coding assistant
|
|
193
|
+
evo adapter prompt jenkins --family ci --copy
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Certification
|
|
197
|
+
|
|
198
|
+
Before publishing, validate your adapter passes all 13 contract checks:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
cd evo-adapter-jenkins
|
|
202
|
+
pip install -e .
|
|
203
|
+
evo adapter validate evo_jenkins.JenkinsAdapter
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Checks include: required class attributes, valid family, iter_events yields valid events, JSON serialization, attestation structure, and more.
|
|
207
|
+
|
|
208
|
+
### Learn More
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
evo adapter guide # Full tutorial with contract details
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Pattern Knowledge Base
|
|
217
|
+
|
|
218
|
+
The Evolution Engine discovers cross-family patterns automatically:
|
|
219
|
+
|
|
220
|
+
- **Pearson correlation**: deviation magnitudes track together (|r| >= 0.3)
|
|
221
|
+
- **Lift-based co-occurrence**: deviations co-occur more than chance (lift >= 1.5)
|
|
222
|
+
- **Presence-based**: metric distributions differ when events co-occur (Cohen's d >= 0.2)
|
|
223
|
+
|
|
224
|
+
Patterns progress through scopes: **local** (this repo) -> **community** (shared anonymously) -> **confirmed** (local + community match) -> **universal** (bundled in package).
|
|
225
|
+
|
|
226
|
+
Universal patterns ship with the pip package and are recognized instantly on new repositories.
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## Project Structure
|
|
231
|
+
|
|
232
|
+
```
|
|
233
|
+
evolution-engine/
|
|
234
|
+
├── evolution/
|
|
235
|
+
│ ├── cli.py # Click-based CLI (evo command)
|
|
236
|
+
│ ├── orchestrator.py # Pipeline orchestration (detect → P1-P5)
|
|
237
|
+
│ ├── registry.py # 3-tier adapter auto-detection
|
|
238
|
+
│ ├── phase1_engine.py # Phase 1: Observation
|
|
239
|
+
│ ├── phase2_engine.py # Phase 2: Baselines (MAD/IQR)
|
|
240
|
+
│ ├── phase3_engine.py # Phase 3: Explanations
|
|
241
|
+
│ ├── phase3_1_renderer.py # Phase 3.1: LLM enhancement
|
|
242
|
+
│ ├── phase4_engine.py # Phase 4: Pattern discovery
|
|
243
|
+
│ ├── phase5_engine.py # Phase 5: Advisory
|
|
244
|
+
│ ├── knowledge_store.py # SQLite knowledge base
|
|
245
|
+
│ ├── kb_export.py # Anonymized pattern export/import
|
|
246
|
+
│ ├── kb_security.py # Import validation (XSS, injection, traversal)
|
|
247
|
+
│ ├── report_generator.py # Standalone HTML report generator
|
|
248
|
+
│ ├── adapter_validator.py # 13-check adapter certification
|
|
249
|
+
│ ├── adapter_scaffold.py # Package scaffolding + AI prompt gen
|
|
250
|
+
│ ├── license.py # License tier gating
|
|
251
|
+
│ ├── llm_openrouter.py # OpenRouter LLM client
|
|
252
|
+
│ ├── llm_anthropic.py # Anthropic LLM client
|
|
253
|
+
│ ├── validation_gate.py # LLM output validation
|
|
254
|
+
│ ├── data/
|
|
255
|
+
│ │ └── universal_patterns.json # Bundled universal patterns
|
|
256
|
+
│ └── adapters/
|
|
257
|
+
│ ├── git/ # Version Control (+ Git History Walker)
|
|
258
|
+
│ ├── ci/ # CI / Build Pipeline (GitHub Actions)
|
|
259
|
+
│ ├── testing/ # Test Execution (JUnit XML)
|
|
260
|
+
│ ├── dependency/ # Dependency Graph (pip, npm, go, cargo, bundler)
|
|
261
|
+
│ ├── schema/ # Schema / API (OpenAPI)
|
|
262
|
+
│ ├── deployment/ # Deployment (GitHub Releases)
|
|
263
|
+
│ ├── config/ # Configuration (Terraform)
|
|
264
|
+
│ └── security/ # Security Scanning (Trivy, Dependabot)
|
|
265
|
+
├── tests/
|
|
266
|
+
│ ├── conftest.py # Shared fixtures
|
|
267
|
+
│ ├── unit/ # 200+ unit tests
|
|
268
|
+
│ │ ├── test_phase2_deviation.py
|
|
269
|
+
│ │ ├── test_phase4_cooccurrence.py
|
|
270
|
+
│ │ ├── test_phase5_advisory.py
|
|
271
|
+
│ │ ├── test_knowledge_store.py
|
|
272
|
+
│ │ ├── test_registry.py
|
|
273
|
+
│ │ ├── test_adapter_validator.py
|
|
274
|
+
│ │ ├── test_adapter_scaffold.py
|
|
275
|
+
│ │ ├── test_kb_export.py
|
|
276
|
+
│ │ ├── test_kb_security.py
|
|
277
|
+
│ │ ├── test_license.py
|
|
278
|
+
│ │ ├── test_report_generator.py
|
|
279
|
+
│ │ └── adapters/ # Lockfile parser tests
|
|
280
|
+
│ └── integration/
|
|
281
|
+
│ └── test_pipeline_e2e.py # Full pipeline integration test
|
|
282
|
+
├── scripts/
|
|
283
|
+
│ └── aggregate_calibration.py # Cross-repo pattern aggregation
|
|
284
|
+
├── docs/
|
|
285
|
+
│ ├── ARCHITECTURE_VISION.md # Constitution
|
|
286
|
+
│ ├── IMPLEMENTATION_PLAN.md # Roadmap
|
|
287
|
+
│ ├── PHASE_*_CONTRACT.md # Phase contracts (2, 3, 4, 5)
|
|
288
|
+
│ ├── PHASE_*_DESIGN.md # Phase designs (2, 3, 4, 5)
|
|
289
|
+
│ ├── ADAPTER_CONTRACT.md # Universal adapter contract
|
|
290
|
+
│ └── adapters/ # 8 family contracts
|
|
291
|
+
├── pyproject.toml # Package config (entry point: evo)
|
|
292
|
+
└── .env # Environment config (optional)
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## Open-Core Model
|
|
298
|
+
|
|
299
|
+
| Open Source (MIT) | Proprietary |
|
|
300
|
+
|-------------------|-------------|
|
|
301
|
+
| All adapters | Phase 2-5 engines |
|
|
302
|
+
| CLI, registry, orchestrator | Knowledge store |
|
|
303
|
+
| Phase 1 engine | |
|
|
304
|
+
| KB export/import/security | |
|
|
305
|
+
| Report generator | |
|
|
306
|
+
| Adapter scaffold & validator | |
|
|
307
|
+
|
|
308
|
+
The open adapter ecosystem ensures anyone can connect new data sources. The analysis engines are the proprietary core.
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## Documentation
|
|
313
|
+
|
|
314
|
+
See [`docs/README.md`](docs/README.md) for the full documentation structure and authority hierarchy.
|
|
315
|
+
|
|
316
|
+
Key documents:
|
|
317
|
+
- **[Architecture Vision](docs/ARCHITECTURE_VISION.md)** — why the system exists and how it works
|
|
318
|
+
- **[Implementation Plan](docs/IMPLEMENTATION_PLAN.md)** — what's done, what's next
|
|
319
|
+
- **[Adapter World Map](docs/adapters/README.md)** — all 8 source families
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
## Principles
|
|
324
|
+
|
|
325
|
+
1. Observation precedes interpretation
|
|
326
|
+
2. History is immutable; interpretation is disposable
|
|
327
|
+
3. Determinism beats intelligence
|
|
328
|
+
4. Local baselines over global heuristics
|
|
329
|
+
5. Multiple weak signals beat one strong opinion
|
|
330
|
+
6. Absence of signal is not evidence of safety
|
|
331
|
+
7. Humans are escalated to, not replaced
|
|
332
|
+
8. Evidence enables action
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
## License
|
|
337
|
+
|
|
338
|
+
Open-core: adapters and CLI under MIT, analysis engines proprietary.
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
# Evolution Engine
|
|
2
|
+
|
|
3
|
+
**Development Process Intelligence — a local-first CLI tool that observes how software evolves, learns what is structurally normal, and surfaces unexpected change with evidence to act.**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## What It Does
|
|
8
|
+
|
|
9
|
+
Run `evo analyze .` on any git repository. The Evolution Engine detects adapters automatically, builds per-repo baselines, and reports when your development process deviates from its own historical norms — across commits, CI, dependencies, deployments, and more.
|
|
10
|
+
|
|
11
|
+
No data leaves your machine. No configuration required. No accounts to create.
|
|
12
|
+
|
|
13
|
+
### The Pipeline
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
Sources → Phase 1 (Record) → Phase 2 (Measure) → Phase 3 (Explain)
|
|
17
|
+
│ │
|
|
18
|
+
└──── Phase 4 (Learn) ←──┘
|
|
19
|
+
│
|
|
20
|
+
Phase 5 (Inform)
|
|
21
|
+
│
|
|
22
|
+
HTML Report
|
|
23
|
+
│
|
|
24
|
+
HUMAN / AI
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
| Phase | What It Does |
|
|
28
|
+
|-------|-------------|
|
|
29
|
+
| **Phase 1** | Records immutable events from truth sources |
|
|
30
|
+
| **Phase 2** | Computes baselines and deviation signals (MAD/IQR robust statistics) |
|
|
31
|
+
| **Phase 3** | Explains signals in human language (template + optional LLM) |
|
|
32
|
+
| **Phase 4** | Discovers cross-source patterns (correlation, lift, presence-based) |
|
|
33
|
+
| **Phase 5** | Advisory reports with evidence packages |
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Quick Start
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Install
|
|
41
|
+
pip install evolution-engine
|
|
42
|
+
|
|
43
|
+
# Analyze any git repository
|
|
44
|
+
evo analyze .
|
|
45
|
+
|
|
46
|
+
# With a GitHub token (unlocks CI, deployment, security data)
|
|
47
|
+
evo analyze . --token ghp_xxx
|
|
48
|
+
|
|
49
|
+
# Generate an HTML report
|
|
50
|
+
evo report .
|
|
51
|
+
|
|
52
|
+
# See what adapters were detected
|
|
53
|
+
evo status
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### From Source
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
git clone <repo-url>
|
|
60
|
+
cd evolution-engine
|
|
61
|
+
python -m venv .venv
|
|
62
|
+
source .venv/bin/activate
|
|
63
|
+
pip install -e .
|
|
64
|
+
|
|
65
|
+
# Run the test suite (246 tests)
|
|
66
|
+
python -m pytest tests/ -v
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Environment Variables
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# .env file (all optional)
|
|
73
|
+
GITHUB_TOKEN=ghp_xxx # Unlocks CI, deployment, security adapters
|
|
74
|
+
EVO_LICENSE_KEY=xxx # Pro/Team features (free tier works without)
|
|
75
|
+
OPENROUTER_API_KEY=xxx # LLM-enhanced explanations (Phase 3.1)
|
|
76
|
+
PHASE31_ENABLED=false # LLM off by default
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Source Families & Auto-Detection
|
|
82
|
+
|
|
83
|
+
The adapter registry automatically detects available data sources in three tiers:
|
|
84
|
+
|
|
85
|
+
### Tier 1 — File-Based (zero config, always works offline)
|
|
86
|
+
|
|
87
|
+
| Family | Detected By | What It Observes |
|
|
88
|
+
|--------|------------|-----------------|
|
|
89
|
+
| Version Control | `.git/` | Commits, file changes, structural coupling, co-change novelty |
|
|
90
|
+
| Dependency Graph | `requirements.txt`, `package-lock.json`, `go.mod`, `Cargo.lock`, `Gemfile.lock` | Dependency count, churn, transitive depth |
|
|
91
|
+
| Configuration | `*.tf`, `docker-compose.yml` | Resource count, config churn |
|
|
92
|
+
| Schema / API | `openapi.yaml`, `*.graphql` | Endpoint growth, field changes |
|
|
93
|
+
|
|
94
|
+
### Tier 2 — API-Enriched (optional token unlocks more)
|
|
95
|
+
|
|
96
|
+
| Family | Token | What It Observes |
|
|
97
|
+
|--------|-------|-----------------|
|
|
98
|
+
| CI / Build Pipeline | `GITHUB_TOKEN` | Build durations, failure rates |
|
|
99
|
+
| Deployment | `GITHUB_TOKEN` | Release cadence, pre-releases, asset count |
|
|
100
|
+
| Security Scanning | `GITHUB_TOKEN` | Vulnerability count, severity, Dependabot alerts |
|
|
101
|
+
|
|
102
|
+
### Tier 3 — Community Plugins (pip-installable)
|
|
103
|
+
|
|
104
|
+
Already using tools like **Snyk**, **SonarQube**, **Jenkins**, **ArgoCD**, **GitLab CI**, **Datadog**, or **PagerDuty**? Evo doesn't replace them — it learns from them. Install or build an adapter to feed their data into the pipeline, and Evo will correlate it with your git history, dependencies, and other sources to discover cross-tool patterns.
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
pip install evo-adapter-jenkins # Jenkins CI adapter
|
|
108
|
+
pip install evo-adapter-snyk # Snyk security adapter
|
|
109
|
+
pip install evo-adapter-argocd # ArgoCD deployment adapter
|
|
110
|
+
evo analyze . # Auto-detected!
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Plugins are auto-discovered via Python `entry_points`. If an adapter for your tool doesn't exist yet, you can [build one](#building-adapters) or [request one](#cli-commands) (`evo adapter request`).
|
|
114
|
+
|
|
115
|
+
### Historical Replay
|
|
116
|
+
|
|
117
|
+
The **Git History Walker** extracts dependency, schema, and config files from git history, creating temporal evolution timelines (not just current-state snapshots). This enables Phase 4 to correlate dependency changes with CI failures, deployments, and other events over time.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## CLI Commands
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# Core
|
|
125
|
+
evo analyze [path] # Detect adapters, run full pipeline
|
|
126
|
+
evo analyze . --families git,ci # Override auto-detection
|
|
127
|
+
evo report [path] # Generate HTML report from last run
|
|
128
|
+
evo status # Show detected adapters and event counts
|
|
129
|
+
|
|
130
|
+
# Patterns & Knowledge Base
|
|
131
|
+
evo patterns list # Show discovered patterns
|
|
132
|
+
evo patterns export # Export anonymized pattern digests
|
|
133
|
+
evo patterns import <file> # Import community patterns
|
|
134
|
+
evo patterns sync # Sync universal patterns
|
|
135
|
+
|
|
136
|
+
# Adapter Ecosystem
|
|
137
|
+
evo adapter list # Show detected + installed adapters
|
|
138
|
+
evo adapter validate <class> # Run 13-check certification
|
|
139
|
+
evo adapter guide # How to build an adapter
|
|
140
|
+
evo adapter new <name> --family ci # Scaffold a pip-installable package
|
|
141
|
+
evo adapter prompt <name> --family ci # Generate AI prompt for building
|
|
142
|
+
evo adapter request <description> # Request an adapter from the community
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Building Adapters
|
|
148
|
+
|
|
149
|
+
The Evolution Engine supports a plugin ecosystem. Third-party adapters are pip-installable packages that auto-register via Python `entry_points`.
|
|
150
|
+
|
|
151
|
+
### Quick Path
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
# Scaffold a complete pip package
|
|
155
|
+
evo adapter new jenkins --family ci
|
|
156
|
+
|
|
157
|
+
# Or generate an AI prompt and paste it into your coding assistant
|
|
158
|
+
evo adapter prompt jenkins --family ci --copy
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Certification
|
|
162
|
+
|
|
163
|
+
Before publishing, validate your adapter passes all 13 contract checks:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
cd evo-adapter-jenkins
|
|
167
|
+
pip install -e .
|
|
168
|
+
evo adapter validate evo_jenkins.JenkinsAdapter
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Checks include: required class attributes, valid family, iter_events yields valid events, JSON serialization, attestation structure, and more.
|
|
172
|
+
|
|
173
|
+
### Learn More
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
evo adapter guide # Full tutorial with contract details
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Pattern Knowledge Base
|
|
182
|
+
|
|
183
|
+
The Evolution Engine discovers cross-family patterns automatically:
|
|
184
|
+
|
|
185
|
+
- **Pearson correlation**: deviation magnitudes track together (|r| >= 0.3)
|
|
186
|
+
- **Lift-based co-occurrence**: deviations co-occur more than chance (lift >= 1.5)
|
|
187
|
+
- **Presence-based**: metric distributions differ when events co-occur (Cohen's d >= 0.2)
|
|
188
|
+
|
|
189
|
+
Patterns progress through scopes: **local** (this repo) -> **community** (shared anonymously) -> **confirmed** (local + community match) -> **universal** (bundled in package).
|
|
190
|
+
|
|
191
|
+
Universal patterns ship with the pip package and are recognized instantly on new repositories.
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Project Structure
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
evolution-engine/
|
|
199
|
+
├── evolution/
|
|
200
|
+
│ ├── cli.py # Click-based CLI (evo command)
|
|
201
|
+
│ ├── orchestrator.py # Pipeline orchestration (detect → P1-P5)
|
|
202
|
+
│ ├── registry.py # 3-tier adapter auto-detection
|
|
203
|
+
│ ├── phase1_engine.py # Phase 1: Observation
|
|
204
|
+
│ ├── phase2_engine.py # Phase 2: Baselines (MAD/IQR)
|
|
205
|
+
│ ├── phase3_engine.py # Phase 3: Explanations
|
|
206
|
+
│ ├── phase3_1_renderer.py # Phase 3.1: LLM enhancement
|
|
207
|
+
│ ├── phase4_engine.py # Phase 4: Pattern discovery
|
|
208
|
+
│ ├── phase5_engine.py # Phase 5: Advisory
|
|
209
|
+
│ ├── knowledge_store.py # SQLite knowledge base
|
|
210
|
+
│ ├── kb_export.py # Anonymized pattern export/import
|
|
211
|
+
│ ├── kb_security.py # Import validation (XSS, injection, traversal)
|
|
212
|
+
│ ├── report_generator.py # Standalone HTML report generator
|
|
213
|
+
│ ├── adapter_validator.py # 13-check adapter certification
|
|
214
|
+
│ ├── adapter_scaffold.py # Package scaffolding + AI prompt gen
|
|
215
|
+
│ ├── license.py # License tier gating
|
|
216
|
+
│ ├── llm_openrouter.py # OpenRouter LLM client
|
|
217
|
+
│ ├── llm_anthropic.py # Anthropic LLM client
|
|
218
|
+
│ ├── validation_gate.py # LLM output validation
|
|
219
|
+
│ ├── data/
|
|
220
|
+
│ │ └── universal_patterns.json # Bundled universal patterns
|
|
221
|
+
│ └── adapters/
|
|
222
|
+
│ ├── git/ # Version Control (+ Git History Walker)
|
|
223
|
+
│ ├── ci/ # CI / Build Pipeline (GitHub Actions)
|
|
224
|
+
│ ├── testing/ # Test Execution (JUnit XML)
|
|
225
|
+
│ ├── dependency/ # Dependency Graph (pip, npm, go, cargo, bundler)
|
|
226
|
+
│ ├── schema/ # Schema / API (OpenAPI)
|
|
227
|
+
│ ├── deployment/ # Deployment (GitHub Releases)
|
|
228
|
+
│ ├── config/ # Configuration (Terraform)
|
|
229
|
+
│ └── security/ # Security Scanning (Trivy, Dependabot)
|
|
230
|
+
├── tests/
|
|
231
|
+
│ ├── conftest.py # Shared fixtures
|
|
232
|
+
│ ├── unit/ # 200+ unit tests
|
|
233
|
+
│ │ ├── test_phase2_deviation.py
|
|
234
|
+
│ │ ├── test_phase4_cooccurrence.py
|
|
235
|
+
│ │ ├── test_phase5_advisory.py
|
|
236
|
+
│ │ ├── test_knowledge_store.py
|
|
237
|
+
│ │ ├── test_registry.py
|
|
238
|
+
│ │ ├── test_adapter_validator.py
|
|
239
|
+
│ │ ├── test_adapter_scaffold.py
|
|
240
|
+
│ │ ├── test_kb_export.py
|
|
241
|
+
│ │ ├── test_kb_security.py
|
|
242
|
+
│ │ ├── test_license.py
|
|
243
|
+
│ │ ├── test_report_generator.py
|
|
244
|
+
│ │ └── adapters/ # Lockfile parser tests
|
|
245
|
+
│ └── integration/
|
|
246
|
+
│ └── test_pipeline_e2e.py # Full pipeline integration test
|
|
247
|
+
├── scripts/
|
|
248
|
+
│ └── aggregate_calibration.py # Cross-repo pattern aggregation
|
|
249
|
+
├── docs/
|
|
250
|
+
│ ├── ARCHITECTURE_VISION.md # Constitution
|
|
251
|
+
│ ├── IMPLEMENTATION_PLAN.md # Roadmap
|
|
252
|
+
│ ├── PHASE_*_CONTRACT.md # Phase contracts (2, 3, 4, 5)
|
|
253
|
+
│ ├── PHASE_*_DESIGN.md # Phase designs (2, 3, 4, 5)
|
|
254
|
+
│ ├── ADAPTER_CONTRACT.md # Universal adapter contract
|
|
255
|
+
│ └── adapters/ # 8 family contracts
|
|
256
|
+
├── pyproject.toml # Package config (entry point: evo)
|
|
257
|
+
└── .env # Environment config (optional)
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## Open-Core Model
|
|
263
|
+
|
|
264
|
+
| Open Source (MIT) | Proprietary |
|
|
265
|
+
|-------------------|-------------|
|
|
266
|
+
| All adapters | Phase 2-5 engines |
|
|
267
|
+
| CLI, registry, orchestrator | Knowledge store |
|
|
268
|
+
| Phase 1 engine | |
|
|
269
|
+
| KB export/import/security | |
|
|
270
|
+
| Report generator | |
|
|
271
|
+
| Adapter scaffold & validator | |
|
|
272
|
+
|
|
273
|
+
The open adapter ecosystem ensures anyone can connect new data sources. The analysis engines are the proprietary core.
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## Documentation
|
|
278
|
+
|
|
279
|
+
See [`docs/README.md`](docs/README.md) for the full documentation structure and authority hierarchy.
|
|
280
|
+
|
|
281
|
+
Key documents:
|
|
282
|
+
- **[Architecture Vision](docs/ARCHITECTURE_VISION.md)** — why the system exists and how it works
|
|
283
|
+
- **[Implementation Plan](docs/IMPLEMENTATION_PLAN.md)** — what's done, what's next
|
|
284
|
+
- **[Adapter World Map](docs/adapters/README.md)** — all 8 source families
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## Principles
|
|
289
|
+
|
|
290
|
+
1. Observation precedes interpretation
|
|
291
|
+
2. History is immutable; interpretation is disposable
|
|
292
|
+
3. Determinism beats intelligence
|
|
293
|
+
4. Local baselines over global heuristics
|
|
294
|
+
5. Multiple weak signals beat one strong opinion
|
|
295
|
+
6. Absence of signal is not evidence of safety
|
|
296
|
+
7. Humans are escalated to, not replaced
|
|
297
|
+
8. Evidence enables action
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## License
|
|
302
|
+
|
|
303
|
+
Open-core: adapters and CLI under MIT, analysis engines proprietary.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.0"
|