Skip to content

Commit 174fcd8

Browse files
committed
chore: post-pivot cleanup — update CLAUDE.md, gitignore site/, remove orphan test
1 parent f78cab4 commit 174fcd8

3 files changed

Lines changed: 43 additions & 725 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ npm-debug.log*
1616

1717
# Build outputs
1818
apps/web/dist/
19+
site/
1920

2021
# Environment
2122
.env

CLAUDE.md

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,57 @@ make migrate # Alembic upgrade head
99

1010
## Architecture
1111

12-
Monorepo with two apps and shared infra:
12+
Monorepo with two apps, skills, and shared infra. See [ADR-001](docs/adr-001-claude-code-container-pivot.md) for the pivot decision.
1313

1414
```
1515
apps/api/ — FastAPI backend (Python 3.12, uv)
1616
src/helprs/
1717
core/ — config, database, dependencies, exceptions, middleware, security
18-
modules/ — domain modules: identity, installation, webhook, billing, comprehension
19-
admin/ — SQLAdmin panel
18+
modules/ — domain modules: identity, installation, webhook, container (Phase 2)
19+
admin/ — SQLAdmin panel + credential management
2020
tests/ — mirrors modules/ structure
2121
alembic/ — DB migrations
2222
apps/web/ — React frontend (Vite, TypeScript)
23-
src/features/ — feature modules: auth, demo, installation, session
23+
src/features/ — feature modules: auth, dashboard, installation, session
2424
src/shared/ — shared components/utils
25+
skills/ — Claude Code skill definitions (mounted into ephemeral containers)
2526
infra/
26-
docker/ — Dockerfiles (api, web)
27+
docker/ — Dockerfiles (api, web, claude-runner)
2728
coolify/ — production docker-compose
2829
```
2930

31+
## How It Works
32+
33+
1. GitHub PR event hits the webhook receiver
34+
2. API posts a PR comment with a session link
35+
3. User clicks the link (or auto-trigger if configured)
36+
4. Backend spins up an ephemeral Docker container with Claude Code CLI
37+
5. Container runs the assigned skill against the PR (using `gh` CLI for fast checkout)
38+
6. Results stream back via SSE passthrough to the frontend
39+
7. Container is destroyed after completion or timeout
40+
41+
**Key**: Users provide their Claude credentials once in the admin panel (BYOK). The backend never calls the Claude API directly -- containers use the credentials natively via Claude Code CLI.
42+
3043
## Key Patterns
3144

3245
- **App factory**: `helprs.main:create_app()` — lifespan manages DB engine
33-
- **Flat modules** (identity, installation, webhook, billing): `router.py`, `service.py`, `models.py`, `schemas.py`
34-
- **Layered modules** (comprehension): DDD layout — `domain/`, `application/`, `infrastructure/`, `presentation/`
35-
- **AI agents**: comprehension uses pydantic-ai agents (`infrastructure/agents.py`) with SSE streaming responses
46+
- **Flat modules** (identity, installation, webhook, container): `router.py`, `service.py`, `models.py`, `schemas.py`
47+
- **Container orchestration**: `container` module manages ephemeral Docker lifecycle, credential injection, result relay
48+
- **Skills as agents**: each skill is a self-contained folder with workflow definitions, mounted into containers
49+
- **SSE passthrough**: backend relays container output to frontend (no AI response generation in backend)
3650
- **API prefix**: all routes under `/api/v1`
3751
- **Admin panel**: SQLAdmin at `/admin`, configured in `admin/views.py`
3852

53+
## Skills
54+
55+
Skills are pluggable Claude Code agent definitions in `skills/`. See `skills/SKILL_SPEC.md` for the full specification.
56+
57+
| Skill | Purpose | PR fetch strategy |
58+
|-------|---------|-------------------|
59+
| `challenge-me` | Socratic quiz on PR changes | Shallow clone |
60+
| `code-review` | Multi-layer adversarial review | Shallow clone |
61+
| `security-audit` | Vulnerability scan on diff | Diff only |
62+
3963
## Code Style
4064

4165
- Python: ruff with `line-length = 120`, target Python 3.12
@@ -47,7 +71,6 @@ infra/
4771
```bash
4872
cd apps/api && uv run pytest # All API tests
4973
cd apps/api && uv run pytest tests/modules/identity/ # Single module
50-
cd apps/api && uv run pytest tests/modules/comprehension/test_story_4_2.py # Single file
5174
cd apps/web && npx vitest run # All frontend tests
5275
cd apps/api && uv run alembic revision --autogenerate -m "description" # New migration
5376
```
@@ -61,10 +84,19 @@ Required `.env` at repo root (see docker-compose.yml):
6184
- `DATABASE_URL` — Postgres connection string
6285
- `SECRET_KEY` — app secret
6386
- `GITHUB_APP_ID`, `GITHUB_WEBHOOK_SECRET` — GitHub App config
64-
- `FERNET_KEY` — encryption key for BYOK secrets
87+
- `FERNET_KEY` — encryption key for stored credentials
6588

6689
## Gotchas
6790

6891
- Always run `make lint` before pushing — ruff + eslint must pass
6992
- DB migrations: `make migrate` inside Docker, or `cd apps/api && uv run alembic upgrade head` locally
7093
- Test conftest **must** set env vars before importing from `helprs.*`
94+
- **Agent-readiness**: This repo must be fully understandable by a fresh Claude Code instance with no prior context. Keep docs and CLAUDE.md accurate.
95+
- **Worktree merges**: Always `git stash --include-untracked` before merging worktree branches into main — uncommitted local changes cause modify/delete conflicts
96+
97+
## Key Decisions
98+
99+
- **Pre-pivot code**: preserved on branch `pre-pivot/v1`
100+
- **No pydantic-ai**: AI orchestration handled by Claude Code CLI in containers, not Python agent code
101+
- **BYOK via admin**: credentials stored once per user, injected as ephemeral env vars into containers
102+
- **Open source target**: designed for self-hosting with own Claude licenses

0 commit comments

Comments
 (0)