refactor: DDD domain packages — replace @paws/types with colocated domains#55
Conversation
Create 6 domain packages with colocated types, stores, routes, and logic: - @paws/domain-common: shared primitives (IdSchema, ErrorCode, ErrorResponse) - @paws/domain-network: NetworkConfig, NetworkAllocation, PortExposure - @paws/domain-browser: BrowserConfig, BrowserAction, routes - @paws/domain-session: Session lifecycle, SessionStore, events, WS messages, routes - @paws/domain-audit: AuditEvent, AuditStore, audit routes - @paws/domain-mcp: McpServerConfig, McpToolCall, McpServerStore Session domain consumers fully migrated (17 files). Other domain consumer migrations pending — currently in dual-source state with @paws/types. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Daemon domain with colocated types, agent config, governance checker, store interface + in-memory impl, and route definitions. Includes Trigger types (webhook/schedule/watch/github), AgentConfig with generateAgentScript(), and GovernanceChecker for rate limiting. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Snapshot domain with types (build request/response/status, size, jobs), config (SnapshotConfig, SnapshotTemplateId), and 6 built-in templates (minimal, node, python, docker, fullstack, claude-code). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fleet domain with Worker types, FleetOverview, CostSummary, and scheduler (selectWorker, workerAvailableCapacity). Absorbs the scheduling logic from @paws/scheduler into the fleet domain. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Zero remaining imports from @paws/types across the entire codebase. All consumers now import directly from their domain package: - ErrorCode/ErrorResponseSchema → @paws/domain-common - NetworkAllocation/NetworkConfig/PortExposure → @paws/domain-network - BrowserAction/BrowserConfig → @paws/domain-browser - Session/SessionStore/WsMessages → @paws/domain-session - Daemon/Trigger/AgentConfig/Governance → @paws/domain-daemon - Snapshot/SnapshotConfig/templates → @paws/domain-snapshot - Worker/FleetOverview/CostSummary → @paws/domain-fleet - McpServerConfig/McpToolCall → @paws/domain-mcp - AuditStore/AuditEvent → @paws/domain-audit Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Delete all type source files from @paws/types. The package is now empty
(exports {}). All types live in their domain packages under packages/domains/.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove the @paws/types package entirely. Fix all tsconfig project references to point to domain packages instead. Fix inline import() references in app.ts, autoscaler.ts, executor.ts, and SDK client. The monorepo now has zero references to @paws/types. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove all duplicate code from control-plane that now lives in domain packages: - routes: browser, audit, daemons, webhooks, fleet, snapshots, snapshot-configs, templates, sessions - stores: audit, mcp (+ their tests) - governance.ts, events.ts Delete @paws/scheduler entirely — absorbed into @paws/domain-fleet. Add routes to domain-fleet (fleet overview, workers, cost) and domain-snapshot (build, list, configs CRUD, templates). Control-plane app.ts now imports everything from domain packages. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (132)
📝 WalkthroughWalkthroughThis refactoring migrates the monorepo from a monolithic Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
|
Summary
packages/domains/with colocated types, stores, routes, and logic@paws/typesto domain-specific imports@paws/typespackage entirely (was 15 source files + 14 test files)@paws/schedulerpackage (absorbed into@paws/domain-fleet)Domain packages
@paws/domain-common@paws/domain-network@paws/domain-browser@paws/domain-session@paws/domain-daemon@paws/domain-snapshot@paws/domain-fleet@paws/domain-audit@paws/domain-mcpTest plan
bun testpasses (46/46 excluding pre-existing CLI issues)@paws/typesimports across the entire codebase🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
@paws/domain-*) for audit, browser, daemon, fleet, MCP, network, session, and snapshot functionality.Refactor