Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ jobs:
run: |
mkdir -p .codeframe
source .venv/bin/activate
python -c "from codeframe.persistence.database import Database; db = Database('.codeframe/state.db'); db.initialize(); db.close()"
python -c "from codeframe.platform_store.database import Database; db = Database('.codeframe/state.db'); db.initialize(); db.close()"
echo "✅ Database initialized"

- name: Start FastAPI server in background
Expand Down Expand Up @@ -466,7 +466,7 @@ jobs:
# # E2E tests expect database at tests/e2e/.codeframe/state.db
# mkdir -p tests/e2e/.codeframe
# source .venv/bin/activate
# python -c "from codeframe.persistence.database import Database; db = Database('tests/e2e/.codeframe/state.db'); db.initialize(); db.close()"
# python -c "from codeframe.platform_store.database import Database; db = Database('tests/e2e/.codeframe/state.db'); db.initialize(); db.close()"
# echo "✅ Database initialized at tests/e2e/.codeframe/state.db"
#
# - name: Start backend server
Expand Down Expand Up @@ -621,7 +621,7 @@ jobs:
# run: |
# mkdir -p .codeframe
# source .venv/bin/activate
# python -c "from codeframe.persistence.database import Database; db = Database('.codeframe/state.db'); db.initialize(); db.close()"
# python -c "from codeframe.platform_store.database import Database; db = Database('.codeframe/state.db'); db.initialize(); db.close()"
# echo "✅ Database initialized"
#
# - name: Start backend server
Expand Down
13 changes: 5 additions & 8 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,7 @@ Golden Path commands must work from the CLI with **no server running**. FastAPI

This separation prevents duplicate state transitions (e.g., DONE→DONE errors).

### 4) Legacy can be read, not depended on
`server/` is reference only. Do NOT import legacy UI/server modules into core.

### 5) Keep commits runnable
### 4) Keep commits runnable
At all times: `codeframe --help` works, Golden Path stubs can run, no breaking renames/moves.

---
Expand All @@ -89,7 +86,6 @@ At all times: `codeframe --help` works, Golden Path stubs can run, no breaking r
- **CLI-first**: Golden Path works **without any running FastAPI server**
- **Adapters**: LLM providers in `codeframe/adapters/llm/`
- **Server/UI optional**: FastAPI and UI are thin adapters over core; web UI connects via REST/WebSocket
- `server/` contains v1 code retained as reference only; do not build toward v1 patterns

### Phase 3 Web UI (actively developed — not legacy)
Next.js 16 App Router, TypeScript, Shadcn/UI, Tailwind CSS, Hugeicons, XTerm.js, WebSocket + SSE.
Expand Down Expand Up @@ -128,14 +124,15 @@ codeframe/
│ ├── server.py, models.py, dependencies.py
│ └── routers/ # 16 v2 router modules
├── auth/ # API key service + auth dependencies
├── lib/ # rate_limiter.py, audit_logger.py
└── server/ # Legacy v1 (reference only)
├── lib/ # rate_limiter.py, audit_logger.py, metrics_tracker.py
└── platform_store/ # Control-plane store: auth, api keys, audit logs,
# interactive sessions, token usage (slim Database + repos)

web-ui/ # Phase 3 Web UI (Next.js, actively developed)
tests/
├── core/ # Core module tests (auto-marked v2)
├── adapters/ # LLM + E2B adapter tests
├── agents/ # Worker agent tests
├── agents/ # dependency_resolver tests
├── integration/ # Cross-module integration tests
├── lifecycle/ # End-to-end lifecycle tests (CLI + API + web, uses MockProvider)
└── ui/ # FastAPI router tests
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ When creating new API endpoints that access project resources:

```python
from fastapi import HTTPException, Depends
from codeframe.persistence.database import Database
from codeframe.platform_store.database import Database
from codeframe.ui.dependencies import get_db, get_current_user, User

@router.get("/api/projects/{project_id}/resource")
Expand Down
6 changes: 3 additions & 3 deletions PRD.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ High‑level architecture is defined in [`specs/CODEFRAME_SPEC.md`](specs/CODEFR
- **CLI** (`codeframe/cli.py`) – project initialization, server start, session commands.
- **Backend API** (`codeframe/ui/server.py`) – projects, agents, tasks, blockers, discovery, PRD, context, session.
- **Agent layer** (`codeframe/agents/*`) – lead + worker agents + pool + dependency resolver.
- **Persistence** (`codeframe/persistence/database.py`) – all state with flattened v1.0 schema.
- **Platform store** (`codeframe/platform_store/database.py`) – all state with flattened v1.0 schema.
- **Context & session** (`codeframe/lib/context_manager.py`, `codeframe/core/session_manager.py`).
- **Dashboard** (`web-ui/*`) – React/TypeScript UI with SWR and WebSocket integration.

Expand Down Expand Up @@ -219,7 +219,7 @@ This section captures the **stepwise workflows**; the next section defines forma

2. DB keeps issues/tasks plus DAG dependencies; implementation lives in:

- `codeframe/persistence/database.py` methods for issues, tasks, `task_dependencies`.
- `codeframe/platform_store/database.py` methods for issues, tasks, `task_dependencies`.
- `tests/api/test_api_issues.py` verifies the contract.

3. API and UI:
Expand Down Expand Up @@ -264,7 +264,7 @@ This section captures the **stepwise workflows**; the next section defines forma
1. When blocked, worker agents create blockers in DB:

- Schema and behavior in `specs/049-human-in-loop/spec.md`.
- Implementation in `codeframe/persistence/database.py` and `codeframe/ui/server.py` endpoints:
- Implementation in `codeframe/platform_store/database.py` and `codeframe/ui/server.py` endpoints:
- `GET /api/projects/{id}/blockers`
- `GET /api/blockers/{id}`
- `POST /api/blockers/{id}/resolve`
Expand Down
6 changes: 3 additions & 3 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
#### 2.2 Agent Creation
- [ ] Use Python REPL or script:
```python
from codeframe.persistence.database import Database
from codeframe.platform_store.database import Database
db = Database("test-project/.codeframe/state.db")
db.initialize()
agent_id = db.create_agent("lead-1", "lead", "claude", "directive")
Expand Down Expand Up @@ -123,7 +123,7 @@
- [ ] Test Lead Agent initialization:
```python
from codeframe.agents.lead_agent import LeadAgent
from codeframe.persistence.database import Database
from codeframe.platform_store.database import Database

db = Database("test-project/.codeframe/state.db")
db.initialize()
Expand Down Expand Up @@ -190,7 +190,7 @@
- [ ] Test agent lifecycle:
```python
from codeframe.agents.lead_agent import LeadAgent
from codeframe.persistence.database import Database
from codeframe.platform_store.database import Database
from codeframe.core.models import AgentMaturity

db = Database("test-project/.codeframe/state.db")
Expand Down
2 changes: 1 addition & 1 deletion codeframe/auth/api_key_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
SCOPE_WRITE,
)
from codeframe.core.api_key_service import ApiKeyService
from codeframe.persistence.database import Database
from codeframe.platform_store.database import Database

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion codeframe/auth/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ async def get_api_key_auth(
# Fallback: create database connection
logger.warning("No db in app.state, creating fallback connection for API key auth")
import os
from codeframe.persistence.database import Database
from codeframe.platform_store.database import Database

db_path = os.getenv(
"DATABASE_PATH",
Expand Down
2 changes: 1 addition & 1 deletion codeframe/cli/auth_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
CredentialSource,
)
from codeframe.core.api_key_service import ApiKeyService
from codeframe.persistence.database import Database
from codeframe.platform_store.database import Database

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion codeframe/cli/stats_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def _get_db():
Raises:
typer.Exit: If no workspace is found.
"""
from codeframe.persistence.database import Database
from codeframe.platform_store.database import Database

db_path = Path(".codeframe/state.db")
if not db_path.exists():
Expand Down
2 changes: 1 addition & 1 deletion codeframe/core/api_key_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
SCOPE_READ,
SCOPE_WRITE,
)
from codeframe.persistence.database import Database
from codeframe.platform_store.database import Database

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion codeframe/core/react_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def _persist_token_usage(self, task_id: str) -> None:
db = None
try:
from codeframe.lib.metrics_tracker import MetricsTracker
from codeframe.persistence.database import Database
from codeframe.platform_store.database import Database

db = Database(str(self.workspace.db_path))
db.initialize()
Expand Down
2 changes: 1 addition & 1 deletion codeframe/lib/audit_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from typing import Optional, Dict, Any
from enum import Enum

from codeframe.persistence.database import Database
from codeframe.platform_store.database import Database


class AuditEventType(Enum):
Expand Down
4 changes: 2 additions & 2 deletions codeframe/lib/metrics_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

Example:
>>> from codeframe.lib.metrics_tracker import MetricsTracker
>>> from codeframe.persistence.database import Database
>>> from codeframe.platform_store.database import Database
>>> from codeframe.core.models import CallType
>>>
>>> db = Database("state.db")
Expand Down Expand Up @@ -42,7 +42,7 @@
from datetime import datetime, timedelta, timezone
from typing import Any, Dict, List, Optional, Union
from codeframe.core.models import CallType, TokenUsage
from codeframe.persistence.database import Database
from codeframe.platform_store.database import Database

logger = logging.getLogger(__name__)

Expand Down
5 changes: 0 additions & 5 deletions codeframe/persistence/__init__.py

This file was deleted.

5 changes: 5 additions & 0 deletions codeframe/platform_store/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""Platform store: control-plane state (auth, API keys, audit logs, interactive sessions, token usage)."""

from codeframe.platform_store.database import Database

__all__ = ["Database"]
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
import asyncio
import aiosqlite

from codeframe.persistence.schema_manager import SchemaManager
from codeframe.persistence.repositories import (
from codeframe.platform_store.schema_manager import SchemaManager
from codeframe.platform_store.repositories import (
TokenRepository,
AuditRepository,
APIKeyRepository,
)
from codeframe.persistence.repositories.interactive_sessions import InteractiveSessionRepository
from codeframe.platform_store.repositories.interactive_sessions import InteractiveSessionRepository

logger = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
repository is imported directly from its module by ``database.py``.
"""

from codeframe.persistence.repositories.base import BaseRepository
from codeframe.persistence.repositories.token_repository import TokenRepository
from codeframe.persistence.repositories.audit_repository import AuditRepository
from codeframe.persistence.repositories.api_key_repository import APIKeyRepository
from codeframe.platform_store.repositories.base import BaseRepository
from codeframe.platform_store.repositories.token_repository import TokenRepository
from codeframe.platform_store.repositories.audit_repository import AuditRepository
from codeframe.platform_store.repositories.api_key_repository import APIKeyRepository

__all__ = [
"BaseRepository",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from typing import Optional, Dict, Any, List
import logging

from codeframe.persistence.repositories.base import BaseRepository
from codeframe.platform_store.repositories.base import BaseRepository

logger = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import logging


from codeframe.persistence.repositories.base import BaseRepository
from codeframe.platform_store.repositories.base import BaseRepository

logger = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from datetime import datetime, UTC
from typing import Optional

from codeframe.persistence.repositories.base import BaseRepository
from codeframe.platform_store.repositories.base import BaseRepository


class InteractiveSessionRepository(BaseRepository):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from codeframe.core.models import (
CallType,
)
from codeframe.persistence.repositories.base import BaseRepository
from codeframe.platform_store.repositories.base import BaseRepository

if TYPE_CHECKING:
from codeframe.core.models import TokenUsage
Expand Down
4 changes: 2 additions & 2 deletions codeframe/ui/routers/costs_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

The handler opens the workspace SQLite database directly to avoid the
pre-existing schema conflict between `codeframe/core/workspace.py` and
`codeframe/persistence/schema_manager.py` — wiring `TokenRepository`
`codeframe/platform_store/schema_manager.py` — wiring `TokenRepository`
to a raw connection skips `Database.initialize()` entirely.
"""

Expand All @@ -25,7 +25,7 @@
from codeframe.core import tasks as tasks_module
from codeframe.core.workspace import Workspace
from codeframe.lib.rate_limiter import rate_limit_standard
from codeframe.persistence.repositories.token_repository import TokenRepository
from codeframe.platform_store.repositories.token_repository import TokenRepository
from codeframe.ui.dependencies import get_v2_workspace

logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion codeframe/ui/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
workspace_v2,
)
from codeframe.auth import router as auth_router
from codeframe.persistence.database import Database
from codeframe.platform_store.database import Database
from codeframe.lib.rate_limiter import (
get_rate_limiter,
rate_limit_exceeded_handler,
Expand Down
Loading
Loading