bd init: initialize beads issue tracking

This commit is contained in:
2026-11-11 18:14:23 +01:00
parent ccf8ad67fa
commit b2274894b5
13 changed files with 496 additions and 13 deletions
+61 -13
View File
@@ -1,15 +1,10 @@
# AGENTS.md - Agent Development Guide
## MANDATORY: Use td for Task Management
You must run td usage --new-session at conversation start (or after /clear) to see current work.
Use td usage -q for subsequent reads.
This document provides context and guidelines for agentic coding agents working on the zugferd-service repository.
## Project Overview
ZUGFeRD-Service is a REST API for extracting and validating ZUGFeRD/Factur-X invoice data from PDF files. Built with FastAPI and Python 3.11+.
ZUGFeRD-Service is a REST API for extracting and validating EN 16931 e-invoices: ZUGFeRD/Factur-X PDFs and plain XML (XRechnung, Peppol) in CII or UBL syntax. Built with FastAPI and Python 3.11+.
**Tech Stack:**
- FastAPI >= 0.109.0 (web framework)
@@ -40,7 +35,7 @@ HOST=127.0.0.1 PORT=8000 LOG_LEVEL=DEBUG python -m src.main
pytest
# Run specific test file
pytest tests/test_extract.py
pytest tests/test_extractor.py
# Run specific test function
pytest tests/test_api.py::test_health_check
@@ -227,7 +222,8 @@ src/
├── __init__.py
├── main.py # FastAPI app, endpoints, exception handlers
├── models.py # Pydantic models (all requests/responses)
├── extractor.py # ZUGFeRD XML extraction logic
├── extractor.py # File detection (PDF/XML), CII extraction logic
├── ubl_parser.py # UBL Invoice/CreditNote parsing
├── validator.py # Invoice validation logic
├── pdf_parser.py # PDF text extraction
└── utils.py # Utility functions (constants, helpers)
@@ -235,9 +231,12 @@ src/
tests/
├── conftest.py # Pytest fixtures
├── test_api.py # API endpoint tests
├── test_extractor.py # Extraction logic tests
├── test_extractor.py # Extraction logic tests (PDF/CII)
├── test_xml_formats.py # Plain XML, UBL and credit note tests
├── test_validator.py # Validation logic tests
└── fixtures/ # Test PDF files
├── test_fixture_sweep.py # Sweep over all fixture PDFs (KNOWN_GAPS catalogue)
├── test_real_invoice_regressions.py # Anonymized real-invoice regressions
└── fixtures/ # Test PDF and XML files (see MANIFEST.md)
```
## Validation Checks
@@ -246,16 +245,65 @@ Four validation checks supported:
1. **pflichtfelder** - Required fields present and non-empty
2. **betraege** - Amount calculations correct (tolerance: 0.01)
3. **ustid** - VAT ID format (DE, AT, CH)
4. **pdf_abgleich** - XML vs PDF text comparison
4. **pdf_abgleich** - XML vs PDF text comparison (currently only matches the English patterns `Invoice <nr>` and `Total:`; passes without comparing otherwise)
## Environment Variables
- `HOST` (default: `0.0.0.0`)
- `PORT` (default: `5000`)
- `LOG_LEVEL` (default: `INFO`)
- `LOG_LEVEL` (default: `INFO`; applied to the `src` package logger in `src/main.py`)
## Additional Notes
- Python 3.11+ required
- No type suppression (`# type: ignore`) allowed
- File size limit: 10MB for PDF uploads
- File size limit: 10MB for PDF and XML uploads
- Parse untrusted XML only via `_parse_xml` in `src/extractor.py` (no entity/DTD resolution)
- CI runs `uv sync --extra dev --frozen` and `uv run --extra dev pytest -q` (lockfile: factur-x 6.8; the Nix dev shell still packages factur-x 3.8)
- Returns warnings (not errors) for non-critical issues
- Uses Decimal rounding with ROUND_HALF_UP for monetary values
<!-- BEGIN BEADS INTEGRATION v:1 profile:minimal hash:ca08a54f -->
## Beads Issue Tracker
This project uses **bd (beads)** for issue tracking. Run `bd prime` to see full workflow context and commands.
### Quick Reference
```bash
bd ready # Find available work
bd show <id> # View issue details
bd update <id> --claim # Claim work
bd close <id> # Complete work
```
### Rules
- Use `bd` for ALL task tracking — do NOT use TodoWrite, TaskCreate, or markdown TODO lists
- Run `bd prime` for detailed command reference and session close protocol
- Use `bd remember` for persistent knowledge — do NOT use MEMORY.md files
## Session Completion
**When ending a work session**, you MUST complete ALL steps below. Work is NOT complete until `git push` succeeds.
**MANDATORY WORKFLOW:**
1. **File issues for remaining work** - Create issues for anything that needs follow-up
2. **Run quality gates** (if code changed) - Tests, linters, builds
3. **Update issue status** - Close finished work, update in-progress items
4. **PUSH TO REMOTE** - This is MANDATORY:
```bash
git pull --rebase
bd dolt push
git push
git status # MUST show "up to date with origin"
```
5. **Clean up** - Clear stashes, prune remote branches
6. **Verify** - All changes committed AND pushed
7. **Hand off** - Provide context for next session
**CRITICAL RULES:**
- Work is NOT complete until `git push` succeeds
- NEVER stop before pushing - that leaves work stranded locally
- NEVER say "ready to push when you are" - YOU must push
- If push fails, resolve and retry until it succeeds
<!-- END BEADS INTEGRATION -->