refactor: Restructure monorepo to apps/server/ and apps/web/ layout

Move src/ → apps/server/ and packages/web/ → apps/web/ to adopt
standard monorepo conventions (apps/ for runnable apps, packages/
for reusable libraries). Update all config files, shared package
imports, test fixtures, and documentation to reflect new paths.

Key fixes:
- Update workspace config to ["apps/*", "packages/*"]
- Update tsconfig.json rootDir/include for apps/server/
- Add apps/web/** to vitest exclude list
- Update drizzle.config.ts schema path
- Fix ensure-schema.ts migration path detection (3 levels up in dev,
  2 levels up in dist)
- Fix tests/integration/cli-server.test.ts import paths
- Update packages/shared imports to apps/server/ paths
- Update all docs/ files with new paths
This commit is contained in:
Lukas May
2026-03-03 11:22:53 +01:00
parent 8c38d958ce
commit 34578d39c6
535 changed files with 75452 additions and 687 deletions

View File

@@ -23,7 +23,7 @@ CLI (cw)
├── CoordinationManager (merge queue, conflict resolution)
└── PreviewManager (Docker-based preview deployments)
Web UI (packages/web/)
Web UI (apps/web/)
└── React 19 + TanStack Router + tRPC React Query
├── Initiative management (CRUD, projects)
├── Page editor (Tiptap rich text)
@@ -36,9 +36,9 @@ Web UI (packages/web/)
### Hexagonal Architecture (Ports & Adapters)
Every data-access layer follows this pattern:
- **Port** (interface): `src/db/repositories/<entity>-repository.ts`
- **Adapter** (implementation): `src/db/repositories/drizzle/<entity>-repository.ts`
- Re-exported from barrel files so consumers import from `src/db/`
- **Port** (interface): `apps/server/db/repositories/<entity>-repository.ts`
- **Adapter** (implementation): `apps/server/db/repositories/drizzle/<entity>-repository.ts`
- Re-exported from barrel files so consumers import from `apps/server/db/`
### Event-Driven Communication
All inter-module communication flows through a typed `EventBus`:
@@ -55,20 +55,20 @@ Agent providers (Claude, Codex, etc.) are defined as configuration objects, not
| Module | Path | Purpose | Docs |
|--------|------|---------|------|
| Agent | `src/agent/` | Agent lifecycle, output parsing, accounts | [agent.md](agent.md) |
| Database | `src/db/` | Schema, repositories, migrations | [database.md](database.md) |
| Server & API | `src/server/`, `src/trpc/` | HTTP server, tRPC procedures | [server-api.md](server-api.md) |
| Frontend | `packages/web/` | React UI, components, hooks | [frontend.md](frontend.md) |
| CLI & Config | `src/cli/`, `src/config/` | CLI commands, workspace config | [cli-config.md](cli-config.md) |
| Dispatch | `src/dispatch/` | Task/phase queue and dispatch | [dispatch-events.md](dispatch-events.md) |
| Coordination | `src/coordination/` | Merge queue, conflict resolution | [server-api.md](server-api.md#coordination) |
| Git | `src/git/` | Worktree management, project clones | [git-process-logging.md](git-process-logging.md) |
| Process | `src/process/` | Child process spawn/track/stop | [git-process-logging.md](git-process-logging.md) |
| Logging | `src/logger/`, `src/logging/` | Structured logging, file capture | [git-process-logging.md](git-process-logging.md) |
| Events | `src/events/` | EventBus, typed event system | [dispatch-events.md](dispatch-events.md) |
| Agent | `apps/server/agent/` | Agent lifecycle, output parsing, accounts | [agent.md](agent.md) |
| Database | `apps/server/db/` | Schema, repositories, migrations | [database.md](database.md) |
| Server & API | `apps/server/server/`, `apps/server/trpc/` | HTTP server, tRPC procedures | [server-api.md](server-api.md) |
| Frontend | `apps/web/` | React UI, components, hooks | [frontend.md](frontend.md) |
| CLI & Config | `apps/server/cli/`, `apps/server/config/` | CLI commands, workspace config | [cli-config.md](cli-config.md) |
| Dispatch | `apps/server/dispatch/` | Task/phase queue and dispatch | [dispatch-events.md](dispatch-events.md) |
| Coordination | `apps/server/coordination/` | Merge queue, conflict resolution | [server-api.md](server-api.md#coordination) |
| Git | `apps/server/git/` | Worktree management, project clones | [git-process-logging.md](git-process-logging.md) |
| Process | `apps/server/process/` | Child process spawn/track/stop | [git-process-logging.md](git-process-logging.md) |
| Logging | `apps/server/logger/`, `apps/server/logging/` | Structured logging, file capture | [git-process-logging.md](git-process-logging.md) |
| Events | `apps/server/events/` | EventBus, typed event system | [dispatch-events.md](dispatch-events.md) |
| Shared | `packages/shared/` | Types shared between frontend/backend | [frontend.md](frontend.md) |
| Preview | `src/preview/` | Docker-based preview deployments | [preview.md](preview.md) |
| Tests | `src/test/` | E2E, integration, fixtures | [testing.md](testing.md) |
| Preview | `apps/server/preview/` | Docker-based preview deployments | [preview.md](preview.md) |
| Tests | `apps/server/test/` | E2E, integration, fixtures | [testing.md](testing.md) |
## Entity Relationships