Add codeflash-api to project layout and rewrite context in CLAUDE.md

This commit is contained in:
Kevin Turcios 2026-04-21 21:12:30 -05:00
parent 122152b3ce
commit c978a9d2a9

View file

@ -70,7 +70,8 @@ Use `$RUNNER` in docs and scripts to refer to the Python runner. The value depen
## Layout
- **`packages/`** — UV workspace with Python packages (core, python, mcp, lsp, github-app)
- **`packages/`** — UV workspace with Python packages (core, python, api, mcp, lsp, github-app)
- **`packages/codeflash-api/`** — FastAPI AI service (replaces Django aiservice in codeflash-internal). All optimization, repair, refinement, testgen, and ranking endpoints. Must be thoroughly unit tested with edge case coverage.
- **`plugin/`** — Claude Code plugin (language-agnostic base + language overlays under `plugin/languages/`)
- **`plugin/languages/python/`** — Python-specific plugin overlay (domain agents, skills, references)
- **`plugin/languages/go/`** — Go-specific plugin overlay (domain agents, skills, references)
@ -93,7 +94,18 @@ prek run --all-files # Lint: ruff check, ruff format, interrogate, m
uv run pytest packages/ -v # Test all packages
```
Package-specific conventions (attrs patterns, type annotations, testing) are in `packages/.claude/rules/` and load automatically when editing package source.
Package-specific conventions (attrs patterns, type annotations, testing) are in `packages/.claude/rules/` and load automatically when editing package source. The API package has its own rules in `packages/codeflash-api/.claude/rules/`.
## AI Service (codeflash-api)
`packages/codeflash-api/` is a ground-up FastAPI rewrite of the Django aiservice from `codeflash-internal/django/aiservice/`. The Django version is the reference implementation — port logic faithfully, don't reimplement from scratch.
Key design decisions:
- FastAPI with async throughout, Pydantic v2 models at every boundary
- No Django ORM — use async SQLAlchemy or raw asyncpg for Postgres
- Middleware chain as FastAPI dependencies: auth → rate limit → usage tracking
- Every module must have comprehensive unit tests, including error paths and edge cases
- LLM provider abstraction layer (Azure OpenAI + Anthropic Bedrock behind a common interface)
## Plugin Development