Skip to main content

Historical deployment analysis โ€” walk git history, deploy per day, test all endpoints, capture screenshots, restore working fragments

Project description

rebuild

AI Cost Tracking

PyPI Version Python License AI Cost Human Time Model

  • ๐Ÿค– LLM usage: $1.2000 (8 commits)
  • ๐Ÿ‘ค Human dev: ~$226 (2.3h @ $100/h, 30min dedup)

Generated on 2026-05-01 using openrouter/qwen/qwen3-coder-next


Historical deployment analysis โ€” walk git history day by day, deploy per commit, test all endpoints, capture screenshots, restore working fragments.

Version Python License Tests


What it does

  1. Walk โ€” iterates through git history day by day (configurable range)
  2. Deploy โ€” starts the service per commit (docker-compose / uvicorn / none)
  3. Scan โ€” deta (service-level) โ†’ OpenAPI (API-level) โ†’ Traefik labels fallback
  4. Test โ€” testql scenarios (detailed API) or HTTP probe fallback (service-level)
  5. Screenshot โ€” Playwright screenshots per endpoint with retry/timeout
  6. Report โ€” generates report.html + results.json per day + timeline index.html
  7. Restore โ€” extracts the last working day of an endpoint as an isolated Docker project
  8. Dashboard โ€” overlays health% timeline with avg cyclomatic complexity (via toon)
  9. TUI โ€” interactive terminal menu: project โ†’ walk โ†’ history โ†’ diff โ†’ restore

Install

pip install rebuild

# with interactive TUI
pip install "rebuild[tui]"

# with Playwright screenshots
pip install "rebuild[screenshots]"
playwright install chromium

# everything
pip install "rebuild[full]"
playwright install chromium

# development
pip install -e ".[dev]"

Quick start

# Interactive TUI (recommended)
rebuild tui

# Dry-run: scan last 30 days without deploy
rebuild walk . --days 30 --dry-run

# Full walk with docker-compose
rebuild walk . --days 30 --deploy docker-compose

# Walk a specific date range
rebuild walk /path/to/repo --from 2024-01-01 --to 2024-04-01

# Restore last working version of an endpoint
rebuild restore /api/health .

# Generate timeline report from existing results
rebuild report

# Generate CC vs health% dashboard
rebuild dashboard --repo .

# Show version
rebuild version

CLI reference

rebuild walk

rebuild walk [REPO] [OPTIONS]

  REPO                    Path to git repository (default: .)

Options:
  --days INT              How many days back (default: 30)
  --from TEXT             Start date YYYY-MM-DD
  --to TEXT               End date YYYY-MM-DD
  --output PATH           Output directory (default: .rebuild)
  --deploy TEXT           Deploy method: auto|docker-compose|uvicorn|none
  --health-url TEXT       Health check URL (default: http://localhost:8003/api/health)
  --base-url TEXT         Base service URL (default: http://localhost:8003)
  --screenshots / --no-screenshots
                          Take Playwright screenshots (default: true)
  --dry-run               Scan only, no deploy

rebuild restore

rebuild restore ENDPOINT [REPO] [OPTIONS]

  ENDPOINT                Endpoint path e.g. /api/health

Options:
  --output PATH           Target project directory (default: restored/)
  --results-dir PATH      Walk results directory (default: .rebuild)

rebuild report

rebuild report [OPTIONS]

Options:
  --results-dir PATH      Walk results directory (default: .rebuild)

rebuild dashboard

rebuild dashboard [OPTIONS]

Options:
  --results-dir PATH      Walk results directory (default: .rebuild)
  --repo PATH             Repository path for CC extraction via toon (optional)

rebuild tui

rebuild tui

Interactive terminal UI โ€” requires pip install "rebuild[tui]". No options needed.

TUI flow:

ProjectScreen
  โ”œโ”€โ”€ [Open history]  โ†’ HistoryScreen
  โ”‚                       โ”œโ”€โ”€ [Diff]      โ†’ EndpointDetailScreen (diff mode)
  โ”‚                       โ”œโ”€โ”€ [Endpoints] โ†’ EndpointDetailScreen (detail mode)
  โ”‚                       โ””โ”€โ”€ [Restore]   โ†’ RestoreScreen โ†’ docker compose up -d
  โ””โ”€โ”€ [New walk]      โ†’ WalkConfigScreen โ†’ WalkProgressScreen โ†’ HistoryScreen

Keyboard shortcuts:

Key Action
D Diff vs previous day
R Restore selected endpoint
Enter Endpoint details for selected day
F1 Help
Escape Back
Ctrl+C Quit

Output structure

.rebuild/
  2024-03-15/
    commit.txt              # sha ยท message ยท author ยท timestamp
    endpoints.json          # detected endpoints
    results.json            # HTTP / testql results per endpoint
    testql-results.json     # raw testql output (if testql available)
    report.html             # per-day HTML report with screenshots
    screenshots/
      GET_api_health.png
      GET_api_items.png
  index.html                # timeline of all days
  dashboard.html            # CC vs health% chart (after rebuild dashboard)

Configuration โ€” rebuild.yaml

project:
  name: "my-api"
  repo: "."

deploy:
  method: docker-compose          # docker-compose | uvicorn | custom | none
  compose_file: docker-compose.yml
  health_url: http://localhost:8003/api/health
  health_timeout: 60
  health_interval: 2

scan:
  days: 30
  earliest_commit_per_day: true

testql:
  scenarios_dir: testql-scenarios/
  base_url: http://localhost:8003
  timeout: 10

output:
  dir: .rebuild
  screenshots: true
  html_report: true

Architecture

rebuild/
โ”œโ”€โ”€ rebuild/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ cli.py              # Typer CLI: walk, restore, report, version, dashboard, tui
โ”‚   โ”œโ”€โ”€ models.py           # Dataclasses: WalkConfig, DayResult, Endpoint, CommitInfo
โ”‚   โ”œโ”€โ”€ git_walker.py       # Day-by-day git history iteration
โ”‚   โ”œโ”€โ”€ deployer.py         # Deploy method detection + docker-compose/uvicorn lifecycle
โ”‚   โ”œโ”€โ”€ endpoint_scanner.py # deta (service) โ†’ OpenAPI (API) โ†’ Traefik labels fallback
โ”‚   โ”œโ”€โ”€ tester.py           # testql scenarios (API-level) + HTTP probe fallback
โ”‚   โ”œโ”€โ”€ screenshotter.py    # Playwright screenshots with retry/timeout
โ”‚   โ”œโ”€โ”€ reporter.py         # HTML + JSON report per day + timeline index
โ”‚   โ”œโ”€โ”€ restorer.py         # Extract last working endpoint as isolated Docker project
โ”‚   โ”œโ”€โ”€ dashboard.py        # CC (toon) vs health% comparative timeline
โ”‚   โ””โ”€โ”€ tui.py              # Textual TUI โ€” 6-screen interactive menu
โ”œโ”€โ”€ tests/                  # 44 tests (pytest)
โ”œโ”€โ”€ examples/
โ”‚   โ”œโ”€โ”€ 01-dry-run-walk/
โ”‚   โ”œโ”€โ”€ 02-docker-compose-project/
โ”‚   โ””โ”€โ”€ 03-restore-endpoint/
โ”œโ”€โ”€ testql-scenarios/
โ”œโ”€โ”€ pyproject.toml
โ””โ”€โ”€ rebuild.yaml.example

Endpoint scanner โ€” 3-level fallback

Level Source What it returns
1 deta scan services โ†’ ports โ†’ health paths
2 /openapi.json full endpoint list from OpenAPI spec
3 docker-compose Traefik labels PathPrefix rules
4 hardcoded fallback GET /api/health

Tester โ€” 2-level fallback

Level Condition Behaviour
1 testql installed + testql_dir set runs .testql.yaml scenarios
2 fallback HTTP GET probe per endpoint

Module summary

Module CCฬ„ Functions Purpose
cli 6.3 9 CLI entry points (incl. tui)
models โ€” โ€” Dataclasses only
git_walker 3.3 6 Git history iteration
deployer 3.5 9 Deploy lifecycle
endpoint_scanner 5.5 6 Endpoint detection (deta+OpenAPI+Traefik)
tester 4.3 6 testql (API-level) + HTTP probe (service-level)
screenshotter 3.6 5 Playwright screenshots with retry
reporter 6.0 6 HTML/JSON reports
restorer 5.5 5 Endpoint extraction โ†’ isolated Docker project
dashboard 4.5 4 CC vs health% chart
tui โ€” 6 screens Interactive Textual TUI

Hotspots (CC โ‰ฅ 9): walk (CC=15), report (CC=13), extract_endpoint (CC=9), save_html (CC=9), _scan_via_compose_labels (CC=9)


Dependencies

Runtime: typer>=0.12, rich>=13, gitpython>=3.1, httpx>=0.27, pyyaml>=6, pydantic>=2, deta>=0.1

Optional: playwright>=1.44 (screenshots)

Dev: pytest>=8, pytest-cov, pytest-asyncio, ruff, mypy


Examples

See examples/ for ready-to-run scenarios:


License

Licensed under Apache-2.0.

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

rebuild-0.1.8.tar.gz (43.6 kB view details)

Uploaded Source

Built Distribution

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

rebuild-0.1.8-py3-none-any.whl (42.9 kB view details)

Uploaded Python 3

File details

Details for the file rebuild-0.1.8.tar.gz.

File metadata

  • Download URL: rebuild-0.1.8.tar.gz
  • Upload date:
  • Size: 43.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for rebuild-0.1.8.tar.gz
Algorithm Hash digest
SHA256 4227ad28450193b61542848fd7f53039ce1b2176fab5e0278c9684beb998c663
MD5 d5cc4501e33c1de069c4cdb475dc0cee
BLAKE2b-256 8137bc8d14074306796c371056e561440ca08cd56725b8a72d7e497e1f97d716

See more details on using hashes here.

File details

Details for the file rebuild-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: rebuild-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 42.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for rebuild-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 41c4708c8f3e85338681da7e4b734f007b7d5b7fd1ceb92a575c433093740cf5
MD5 a69a73fe6f524836480e59e1b83074d8
BLAKE2b-256 10e13f715c9d55ceed65284104f5b9d6358e03e9a0379c99e4a6abe8a4de8e49

See more details on using hashes here.

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