codd-dev 1.3.0__tar.gz → 1.5.1__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.
Files changed (52) hide show
  1. {codd_dev-1.3.0 → codd_dev-1.5.1}/PKG-INFO +153 -144
  2. {codd_dev-1.3.0 → codd_dev-1.5.1}/README.md +152 -143
  3. codd_dev-1.5.1/codd/audit.py +354 -0
  4. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/cli.py +333 -87
  5. codd_dev-1.5.1/codd/extract_ai.py +498 -0
  6. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/extractor.py +4 -0
  7. codd_dev-1.5.1/codd/mcp_server.py +282 -0
  8. codd_dev-1.5.1/codd/measure.py +333 -0
  9. codd_dev-1.5.1/codd/policy.py +219 -0
  10. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/require.py +33 -12
  11. codd_dev-1.5.1/codd/require_plugins.py +149 -0
  12. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/restore.py +1 -0
  13. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/templates/codd.yaml.tmpl +2 -2
  14. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/validator.py +35 -1
  15. {codd_dev-1.3.0 → codd_dev-1.5.1}/pyproject.toml +1 -1
  16. {codd_dev-1.3.0 → codd_dev-1.5.1}/.gitignore +0 -0
  17. {codd_dev-1.3.0 → codd_dev-1.5.1}/LICENSE +0 -0
  18. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/__init__.py +0 -0
  19. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/assembler.py +0 -0
  20. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/clustering.py +0 -0
  21. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/config.py +0 -0
  22. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/contracts.py +0 -0
  23. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/defaults.yaml +0 -0
  24. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/env_refs.py +0 -0
  25. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/generator.py +0 -0
  26. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/graph.py +0 -0
  27. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/hooks/__init__.py +0 -0
  28. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/hooks/pre-commit +0 -0
  29. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/implementer.py +0 -0
  30. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/inheritance.py +0 -0
  31. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/parsing.py +0 -0
  32. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/planner.py +0 -0
  33. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/propagate.py +0 -0
  34. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/propagator.py +0 -0
  35. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/reviewer.py +0 -0
  36. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/risk.py +0 -0
  37. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/scanner.py +0 -0
  38. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/schema_refs.py +0 -0
  39. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/synth.py +0 -0
  40. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/templates/conventions.yaml.tmpl +0 -0
  41. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/templates/data_dependencies.yaml.tmpl +0 -0
  42. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/templates/doc_links.yaml.tmpl +0 -0
  43. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/templates/extracted/api-contract.md.j2 +0 -0
  44. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/templates/extracted/architecture-overview.md.j2 +0 -0
  45. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/templates/extracted/module-detail.md.j2 +0 -0
  46. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/templates/extracted/schema-design.md.j2 +0 -0
  47. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/templates/extracted/system-context.md.j2 +0 -0
  48. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/templates/gitignore.tmpl +0 -0
  49. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/templates/overrides.yaml.tmpl +0 -0
  50. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/traceability.py +0 -0
  51. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/verifier.py +0 -0
  52. {codd_dev-1.3.0 → codd_dev-1.5.1}/codd/wiring.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codd-dev
3
- Version: 1.3.0
3
+ Version: 1.5.1
4
4
  Summary: CoDD: Coherence-Driven Development — cross-artifact change impact analysis
5
5
  Project-URL: Homepage, https://github.com/yohey-w/codd-dev
6
6
  Project-URL: Repository, https://github.com/yohey-w/codd-dev
@@ -37,7 +37,7 @@ Description-Content-Type: text/markdown
37
37
 
38
38
  <p align="center">
39
39
  <strong>CoDD — Coherence-Driven Development</strong><br>
40
- <em>Keep AI-built systems coherent when requirements change.</em>
40
+ <em>The evidence engine for change management in AI-assisted development.</em>
41
41
  </p>
42
42
 
43
43
  <p align="center">
@@ -53,27 +53,26 @@ Description-Content-Type: text/markdown
53
53
 
54
54
  ---
55
55
 
56
- > *Harnesses tell agents how to work. CoDD keeps artifacts coherent.*
56
+ > *When code changes, CoDD traces what's affected, checks what's violated, and produces the evidence trail for your merge decision.*
57
57
 
58
58
  ```
59
59
  pip install codd-dev
60
60
  ```
61
61
 
62
- **v1.2.0** — `init` / `scan` / `impact` are stable. `generate` / `implement` / `assemble` / `validate` / `extract` are alpha.
62
+ **v1.5.0** — `init` / `scan` / `impact` are stable. `extract --ai` with baseline preset. `audit` / `policy` / `require` / `validate` are alpha. GitHub Action for CI integration.
63
63
 
64
64
  ---
65
65
 
66
66
  ## Why CoDD?
67
67
 
68
- AI can generate code from specs. But what happens when **requirements change mid-project?**
68
+ AI can generate code. Humans can review PRs. But who tracks the **evidence trail** when requirements change?
69
69
 
70
- - Which design docs are affected?
71
- - Which tests need updating?
72
- - Which API contracts broke?
73
- - Did anyone forget to update the database migration?
70
+ - Which design docs are now stale?
71
+ - Which policy rules did the change violate?
72
+ - What's the blast radius across the dependency graph?
73
+ - Can the PM sign off on this merge with confidence?
74
74
 
75
- **Spec Kit** and **OpenSpec** answer *"how do I start?"*
76
- **CoDD** answers *"how do I keep going when things change?"*
75
+ **CoDD is the evidence engine.** It builds the dependency graph, traces change impact, enforces enterprise policies, and produces a reviewer-ready audit pack — so your merge decision is based on evidence, not gut feeling.
77
76
 
78
77
  ## How It Works
79
78
 
@@ -145,145 +144,27 @@ codd assemble
145
144
 
146
145
  ```bash
147
146
  codd extract # Reverse-engineer design docs from code
147
+ codd require # Infer requirements from code (what was built and why)
148
148
  codd plan --init # Generate wave_config from extracted docs
149
149
  codd scan # Build dependency graph
150
150
  codd impact # Change impact analysis
151
+ codd audit --skip-review # Full change review: validate + impact + policy
152
+ codd measure # Project health score (0-100)
151
153
  ```
152
154
 
153
- ## 5-Minute Greenfield Demo — Spec to Working App
155
+ ## Demos
154
156
 
155
- 37 lines of spec 6 design docs (1,353 lines) → 102 code files (6,445 lines) → TypeScript strict build passes.
157
+ ### Greenfield Spec to Working App
156
158
 
157
- ### Step 1: Write your requirements
159
+ 37 lines of spec → 6 design docs (1,353 lines) 102 code files (6,445 lines) → TypeScript strict build passes. No interactive AI chat — the entire workflow is a shell script.
158
160
 
159
- ```text
160
- # TaskFlow — Personal Todo App
161
+ Full walkthrough: [Harness as Code — A Guide to CoDD #1](https://zenn.dev/shio_shoppaize/articles/codd-greenfield-guide?locale=en)
161
162
 
162
- ## Functional Requirements
163
- - Task CRUD: create, read, update, delete tasks
164
- - Each task has: title, description (optional), due date (optional),
165
- priority (low/medium/high), completed status
166
- - Task list with filtering by: status (all/active/completed), priority
167
- - Local state management (no backend, localStorage)
163
+ ### Brownfield — Change Impact Analysis
168
164
 
169
- ## UI Requirements
170
- - Single-page app with responsive layout (mobile-first)
171
- - Dark theme with accent color (#3b82f6)
172
- - Floating action button opens a modal form
173
- - Toast notifications on create/update/delete
174
- - Keyboard shortcuts: Enter to submit, Escape to close modal
165
+ 2 lines changed in requirements → `codd impact` identifies 6 out of 7 design docs affected. Green band: AI auto-updates. Amber band: human reviews. You know exactly what to fix before anything breaks.
175
166
 
176
- ## Constraints
177
- - Next.js 15 App Router with React Server Components
178
- - Tailwind CSS
179
- - TypeScript strict mode
180
- - Deploy-ready as static export
181
- ```
182
-
183
- ### Step 2: Run the pipeline
184
-
185
- ```bash
186
- pip install codd-dev
187
- codd init --requirements spec.md
188
- codd plan --init # AI designs the wave structure
189
-
190
- waves=$(codd plan --waves) # → 4
191
- for wave in $(seq 1 $waves); do
192
- codd generate --wave $wave # design docs, wave by wave
193
- done
194
-
195
- codd validate # quality gate
196
-
197
- sprints=$(codd plan --sprints) # → 17
198
- for sprint in $(seq 1 $sprints); do
199
- codd implement --sprint $sprint # code from design docs
200
- done
201
-
202
- codd assemble # integrate into buildable project
203
- npm run build # TypeScript strict, zero errors
204
- ```
205
-
206
- No interactive AI chat at any step. Every AI call goes through `claude --print` — prompt in, text out. **Harness as Code**: the entire workflow is a shell script.
207
-
208
- ### Step 3: Model role separation
209
-
210
- ```bash
211
- # Design docs — needs judgment, use Opus
212
- codd generate --wave 1 --ai-cmd 'claude --print --model claude-opus-4-6 --tools ""'
213
-
214
- # Code generation — needs volume, use Codex (or Sonnet)
215
- codd implement --sprint 1 --ai-cmd 'codex --full-auto -q'
216
- ```
217
-
218
- ## 5-Minute Brownfield Demo — Change Impact Analysis
219
-
220
- Already have a codebase? CoDD tracks what's affected when requirements change.
221
-
222
- ### Step 1: Write requirements and generate design docs
223
-
224
- ```text
225
- # TaskFlow — Requirements
226
-
227
- ## Functional Requirements
228
- - User auth (email + Google OAuth)
229
- - Workspace management (teams, roles, invites)
230
- - Task CRUD with assignees, labels, due dates
231
- - Real-time updates (WebSocket)
232
- - File attachments (S3)
233
- - Notification system (in-app + email)
234
-
235
- ## Constraints
236
- - Next.js + Prisma + PostgreSQL
237
- - Row-level security for workspace isolation
238
- - All API endpoints rate-limited
239
- ```
240
-
241
- ```bash
242
- codd init --requirements spec.txt
243
- codd plan --init
244
- waves=$(codd plan --waves)
245
- for wave in $(seq 1 $waves); do codd generate --wave $wave; done
246
- codd scan
247
- ```
248
-
249
- ```
250
- Scan complete:
251
- Documents with frontmatter: 7
252
- Graph: 7 nodes, 15 edges
253
- ```
254
-
255
- ### Step 2: Change requirements mid-project
256
-
257
- Your PM asks for SSO and audit logging. Add to `docs/requirements/requirements.md`:
258
-
259
- ```text
260
- ## Additional Requirements (v1.1)
261
- - SAML SSO (enterprise customers)
262
- - Audit logging (record & export all operations)
263
- ```
264
-
265
- ```bash
266
- codd impact # detects uncommitted changes automatically
267
- ```
268
-
269
- ```
270
- # CoDD Impact Report
271
-
272
- ## Green Band (high confidence, auto-propagate)
273
- | Target | Depth | Confidence |
274
- |-------------------------|-------|------------|
275
- | design:system-design | 1 | 0.90 |
276
- | design:api-design | 1 | 0.90 |
277
- | detail:db-design | 2 | 0.90 |
278
- | detail:auth-design | 2 | 0.90 |
279
-
280
- ## Amber Band (must review)
281
- | Target | Depth | Confidence |
282
- |-------------------------|-------|------------|
283
- | test:test-strategy | 2 | 0.90 |
284
- ```
285
-
286
- **2 lines changed → 6 out of 7 docs affected.** Green band: AI auto-updates. Amber: human reviews. You know exactly what to fix before anything breaks.
167
+ Deep dive: [CoDD deep-dive](https://zenn.dev/shio_shoppaize/articles/shogun-codd-coherence?locale=en)
287
168
 
288
169
  ## Wave-Based Generation
289
170
 
@@ -381,6 +262,15 @@ All other commands (`scan`, `impact`, `generate`, etc.) automatically discover w
381
262
 
382
263
  Already have a codebase? CoDD provides a full brownfield workflow — from code extraction to design doc reconstruction.
383
264
 
265
+ ### AI-Powered Extraction (--ai)
266
+
267
+ > **Note on presets**: `codd extract --ai` ships with a **baseline** extraction prompt. The extraction quality in published benchmarks (F1 0.953+) was achieved with a tuned preset and internal evaluation dataset — not the public baseline. The baseline uses the same workflow and output format, but results will vary depending on your codebase and prompt. Use `--prompt-file` to supply your own tuned prompt.
268
+
269
+ ```bash
270
+ codd extract --ai # Uses built-in baseline preset
271
+ codd extract --ai --prompt-file my.md # Uses your custom prompt
272
+ ```
273
+
384
274
  ### Step 1: Extract structure from code
385
275
 
386
276
  `codd extract` reverse-engineers design documents from your source code. No AI required — pure static analysis.
@@ -454,6 +344,118 @@ codd impact
454
344
  | `codd propagate` | Experimental | Reverse-propagate source code changes to design docs |
455
345
  | `codd review` | Experimental | AI-powered artifact quality evaluation (LLM-as-Judge) |
456
346
  | `codd extract` | **Alpha** | Reverse-engineer design docs from existing code |
347
+ | `codd require` | **Alpha** | Infer requirements from existing codebase (brownfield) |
348
+ | `codd audit` | **Alpha** | Consolidated change review pack (validate + impact + policy + review) |
349
+ | `codd policy` | **Alpha** | Enterprise policy checker (forbidden/required patterns in source code) |
350
+ | `codd measure` | **Alpha** | Project health metrics (graph, coverage, quality, health score 0-100) |
351
+ | `codd mcp-server` | **Alpha** | MCP server for AI tool integration (stdio, zero dependencies) |
352
+
353
+ ## CI Integration (GitHub Action)
354
+
355
+ Run CoDD audit on every pull request. The action posts a comment with verdict (APPROVE / CONDITIONAL / REJECT), validation results, policy violations, and impact analysis.
356
+
357
+ ### Quick Setup
358
+
359
+ Add `.github/workflows/codd.yml` to your project:
360
+
361
+ ```yaml
362
+ name: CoDD Audit
363
+ on:
364
+ pull_request:
365
+ branches: [main]
366
+
367
+ permissions:
368
+ contents: read
369
+ pull-requests: write
370
+
371
+ jobs:
372
+ audit:
373
+ runs-on: ubuntu-latest
374
+ steps:
375
+ - uses: actions/checkout@v4
376
+ with:
377
+ fetch-depth: 0
378
+
379
+ - uses: yohey-w/codd-dev@main
380
+ with:
381
+ diff-target: origin/${{ github.base_ref }}
382
+ skip-review: "true" # Set to "false" to enable AI review
383
+ ```
384
+
385
+ ### Action Inputs
386
+
387
+ | Input | Default | Description |
388
+ |-------|---------|-------------|
389
+ | `diff-target` | `origin/main` | Git ref to diff against |
390
+ | `skip-review` | `true` | Skip AI review phase (faster, no AI cost) |
391
+ | `python-version` | `3.12` | Python version |
392
+ | `codd-version` | latest | Specific version (e.g., `>=1.3.0`) |
393
+ | `post-comment` | `true` | Post results as PR comment |
394
+
395
+ ### Action Outputs
396
+
397
+ | Output | Description |
398
+ |--------|-------------|
399
+ | `verdict` | `APPROVE`, `CONDITIONAL`, or `REJECT` |
400
+ | `risk-level` | `LOW`, `MEDIUM`, or `HIGH` |
401
+ | `report-json` | Path to the JSON audit report |
402
+
403
+ ### Enterprise Policies
404
+
405
+ Define source code policies in your `codd.yaml`:
406
+
407
+ ```yaml
408
+ policies:
409
+ - id: SEC-001
410
+ description: "No hardcoded passwords"
411
+ severity: CRITICAL
412
+ kind: forbidden
413
+ pattern: 'password\s*=\s*[''"]'
414
+ glob: "*.py"
415
+
416
+ - id: LOG-001
417
+ description: "All modules must import logging"
418
+ severity: WARNING
419
+ kind: required
420
+ pattern: "import logging"
421
+ glob: "*.py"
422
+ ```
423
+
424
+ The policy checker runs as part of `codd audit` and independently via `codd policy`. Critical violations cause REJECT; warnings cause CONDITIONAL.
425
+
426
+ ## MCP Server
427
+
428
+ CoDD exposes its tools via the [Model Context Protocol](https://modelcontextprotocol.io/) for direct AI tool integration. Zero external dependencies — works with any MCP-compatible client.
429
+
430
+ ```bash
431
+ codd mcp-server --project /path/to/your/project
432
+ ```
433
+
434
+ ### Claude Code Configuration
435
+
436
+ Add to `~/.claude/claude_code_config.json`:
437
+
438
+ ```json
439
+ {
440
+ "mcpServers": {
441
+ "codd": {
442
+ "command": "codd",
443
+ "args": ["mcp-server", "--project", "/path/to/your/project"]
444
+ }
445
+ }
446
+ }
447
+ ```
448
+
449
+ ### Available MCP Tools
450
+
451
+ | Tool | Description |
452
+ |------|-------------|
453
+ | `codd_validate` | Check frontmatter integrity and graph consistency |
454
+ | `codd_impact` | Analyze change impact for a given node or file |
455
+ | `codd_policy` | Check source code against enterprise policy rules |
456
+ | `codd_audit` | Consolidated change review (validate + impact + policy) |
457
+ | `codd_scan` | Build dependency graph from design documents |
458
+ | `codd_measure` | Project health metrics (graph, coverage, quality, health score) |
457
459
 
458
460
  ## Claude Code Integration
459
461
 
@@ -618,7 +620,7 @@ CoDD dogfoods itself. The `.codd/` directory contains CoDD's own config, and `co
618
620
  codd init --config-dir .codd --project-name "codd-dev" --language "python"
619
621
  codd extract # 15 modules → design docs with dependency frontmatter
620
622
  codd scan # 49 nodes, 83 edges
621
- codd verify # mypy + pytest (127/127 tests pass)
623
+ codd verify # mypy + pytest (434 tests pass)
622
624
  ```
623
625
 
624
626
  If CoDD can't manage itself, it shouldn't manage your project.
@@ -635,15 +637,22 @@ If CoDD can't manage itself, it shouldn't manage your project.
635
637
  - [x] `codd review` — AI-powered quality evaluation with review-driven regeneration loop
636
638
  - [x] `--feedback` flag — feed review results back into generate/restore/propagate
637
639
  - [x] `codd verify` — language-agnostic verification (Python: mypy + pytest, TypeScript: tsc + jest)
640
+ - [x] `codd require` — infer requirements from existing codebase with confidence tags
641
+ - [x] `codd audit` — consolidated change review pack (validate + impact + policy + review)
642
+ - [x] `codd policy` — enterprise policy checker (forbidden/required patterns)
643
+ - [x] `codd measure` — project health metrics (graph, coverage, quality, score 0-100)
644
+ - [x] GitHub Action — CI integration for PR audit with auto-commenting
645
+ - [x] MCP Server — stdio JSON-RPC server for AI tool integration
646
+ - [x] Plugin system — extensible require prompts (tags, evidence format, output sections)
638
647
  - [ ] Multi-harness integration examples (Claude Code, Copilot, Cursor)
639
648
  - [ ] VS Code extension for impact visualization
640
649
 
641
650
  ## Articles
642
651
 
643
- - [dev.to (English): Harness as Code — Treating AI Workflows Like Infrastructure](https://dev.to/yohey-w/harness-as-code-treating-ai-workflows-like-infrastructure-27ni)
644
- - [dev.to (English): What Happens After "Spec First"](https://dev.to/yohey-w/codd-coherence-driven-development-what-happens-after-spec-first-514f)
645
- - [Zenn (Japanese): Harness as Code — CoDD活用ガイド #1 spec → 設計書コード](https://zenn.dev/shio_shoppaize/articles/codd-greenfield-guide)
646
- - [Zenn (Japanese): CoDD deep-dive](https://zenn.dev/shio_shoppaize/articles/shogun-codd-coherence)
652
+ - [dev.to: Harness as Code — Treating AI Workflows Like Infrastructure](https://dev.to/yohey-w/harness-as-code-treating-ai-workflows-like-infrastructure-27ni)
653
+ - [dev.to: What Happens After "Spec First"](https://dev.to/yohey-w/codd-coherence-driven-development-what-happens-after-spec-first-514f)
654
+ - [Zenn: Harness as Code — A Guide to CoDD #1 spec → designcode](https://zenn.dev/shio_shoppaize/articles/codd-greenfield-guide?locale=en)
655
+ - [Zenn: CoDD deep-dive](https://zenn.dev/shio_shoppaize/articles/shogun-codd-coherence?locale=en)
647
656
 
648
657
  ## License
649
658