Skip to content
This repository was archived by the owner on Sep 4, 2025. It is now read-only.

Commit d13a770

Browse files
flyingrobotsclaude
andcommitted
feat(architecture): Implement clean 3-layer architecture with ports & adapters
Major refactoring to separate concerns into three distinct layers: ## Core Layer (Pure Business Logic) - Created @starfleet/data-core package with zero Node.js dependencies - Implemented ports as pure TypeScript-style JSDoc interfaces - Added application use-cases: GenerateMigrationPlan, ApplyMigrationPlan, VerifySafetyGates - Defined domain types and event constants - No I/O, no console, no process - pure functions only ## Host-Node Layer (Adapters) - Created @starfleet/data-host-node package with Node.js implementations - Implemented all port adapters: FileSystem, Glob, Clock, Environment, Logger, EventBus, Git, Db, Process, Crypto - Single-connection transaction support in DbPortNodeAdapter - Cross-platform ProcessPort.which() for Windows/Unix compatibility - EventBus returns unsubscribe functions for clean resource management ## CLI Layer (Presentation) - Created @starfleet/data-cli package as thin presentation layer - Composition root in buildServices.js wires all dependencies - Runtime port validation with ensurePort() - Extracted reporter to separate module for clean separation - Commands are now thin orchestrators calling use-cases ## Architecture Improvements - ESLint rules enforce layer boundaries (no Node in core!) - Package exports use /* patterns for proper directory mapping - Workspace configuration for npm monorepo - Smoke test for verifying DI container wiring - All adapters validated at startup for fail-fast behavior This architecture enables: - Unit testing core logic without I/O - Swappable implementations via ports - Future API/GUI without touching business logic - Clean dependency flow: CLI → Host-Node → Core 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent a05844f commit d13a770

File tree

172 files changed

+7919
-224
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+7919
-224
lines changed

CLAUDE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,4 +208,5 @@ For TypeScript projects, use `@typescript-eslint/no-floating-promises` to catch
208208
### Recent Fixes
209209
- Fixed error handling in CompileCommand constructor to properly display errors
210210
- Added `isProd` property to start event emissions
211-
- Fixed MigrationCompiler config property naming (sqlDir vs rootDir)
211+
- Fixed MigrationCompiler config property naming (sqlDir vs rootDir)
212+
- CRITICAL: ABSOLUTELY ZERO TYPESCRIPT ALLOWED, CLAUDE. Very slim exceptions to this rule (Edge Function generation nonsense). For information, see @import @docs/decisions/000-javascript-not-typescript.md

0 commit comments

Comments
 (0)