CDD-CMDB

A Configuration Management Database defined entirely as a test suite

View the Project on GitHub syndicalt/cdd-cmdb

Generator

The generator is a CLI that produces a runnable CMDB implementation by prompting Claude and iterating on test failures.

How It Works

┌─────────────────────────────────────────────┐
│  1. Read specs, schemas, harness, tests     │
│                                             │
│  2. Prompt Claude to generate server code   │
│         ↓                                   │
│  3. Parse <file> blocks from response       │
│         ↓                                   │
│  4. Write files to output directory         │
│         ↓                                   │
│  5. Create venv, install requirements.txt   │
│         ↓                                   │
│  6. Start app.py, wait for /health          │
│         ↓                                   │
│  7. Run pytest against the server           │
│         ↓                                   │
│  ┌──── 8. All tests pass? ────┐             │
│  │ YES                   NO   │             │
│  │  ↓                    ↓    │             │
│  │ Done!         Feed failures│             │
│  │               back to      │             │
│  │               Claude → (2) │             │
│  └────────────────────────────┘             │
└─────────────────────────────────────────────┘

Usage

# Prerequisites
export ANTHROPIC_API_KEY=sk-ant-...
pip install -e ".[generator]"

# Basic usage (FastAPI + SQLite, minimal profile)
python -m generator --profile minimal

# Customize everything
python -m generator \
  --profile enterprise \
  --backend python/flask/postgres \
  --output ./my-cmdb \
  --port 9000 \
  --model claude-opus-4-6 \
  --max-iterations 10

CLI Options

Flag Default Description
--profile minimal Test suite profile to target: minimal, standard, enterprise
--backend python/fastapi/sqlite Backend stack hint passed to the LLM
--output ./generated Directory for the generated implementation
--max-iterations 5 Maximum generate-test-fix cycles
--model claude-sonnet-4-6 Anthropic model ID
--port 8080 Port for the generated server

What Gets Generated

The output directory contains a self-contained Python application:

generated/
  app.py              # Entry point (python app.py)
  models.py           # Data models (if the LLM splits them out)
  requirements.txt    # pip dependencies
  .venv/              # Virtual environment (created automatically)

The generated code has no runtime dependency on this repository. You can copy the output directory anywhere and run it standalone.

Architecture

Module Breakdown

File Parsing

Claude outputs files in <file path="..."> XML blocks. The orchestrator uses a regex to extract them:

<file path="app.py">
# Generated CMDB server
from fastapi import FastAPI
...
</file>

Error Recovery

Tips