@crossdelta/platform-sdk 0.17.5 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +407 -0
- package/README.md +22 -17
- package/bin/cli.js +341 -223
- package/bin/docs/generators/hono-bun.md +12 -28
- package/bin/docs/generators/hono-node.md +13 -29
- package/bin/templates/workspace/.github/workflows/publish-packages.yml +10 -6
- package/bin/templates/workspace/infra/package.json.hbs +1 -1
- package/package.json +3 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@crossdelta/platform-sdk` will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.18.0] - 2025-12-22
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- **CLI Architecture** - Reorganized internal structure for better maintainability
|
|
12
|
+
- Moved `services/` to `core/` (ai, ast, bun, env, events, filesystem, etc.)
|
|
13
|
+
- AI setup now under `setup/ai/` subcommand structure
|
|
14
|
+
- Centralized CLI config in `config/index.ts`
|
|
15
|
+
- Unified help formatting with declarative formatter
|
|
16
|
+
|
|
17
|
+
### Performance
|
|
18
|
+
- **Shell Completion** - Complete overhaul of completion system
|
|
19
|
+
- Workspace-local cache (`node_modules/.cache/pf/`) instead of dynamic extraction
|
|
20
|
+
- Shell scripts read from cache file for instant completions
|
|
21
|
+
- Fast event name scanner without Zod validation overhead
|
|
22
|
+
- `pf event publish <TAB>` now responds in <50ms (was 200-500ms)
|
|
23
|
+
- Auto-regenerate cache on workspace changes
|
|
24
|
+
- See `docs/completion-performance.md` for technical details
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
- **Dev Mode Exit Codes** - Simplified exit code handling
|
|
28
|
+
- Exit codes 0, 1, 130 (SIGINT), 143 (SIGTERM) treated as normal exits
|
|
29
|
+
- Cleaner shutdown without spurious error messages
|
|
30
|
+
|
|
31
|
+
### Removed
|
|
32
|
+
- Dead code cleanup (`regenerate.ts`, unused completion extractors)
|
|
33
|
+
- Decorative ASCII header blocks (per conventions)
|
|
34
|
+
- Duplicated `KNOWN_COMMAND_DESCRIPTIONS` constant
|
|
35
|
+
|
|
36
|
+
## [0.17.5] - 2025-12-21
|
|
37
|
+
|
|
38
|
+
### Fixed
|
|
39
|
+
- **npm Publishing** - README now correctly uploaded in publish workflow
|
|
40
|
+
- Fixed GitHub Actions workflow to upload README.md, CHANGELOG.md, LICENSE, etc.
|
|
41
|
+
- Previously only `dist/` was uploaded, causing missing README on npm
|
|
42
|
+
- Now uploads all files needed for npm package (bin, schemas, logo, install.sh)
|
|
43
|
+
|
|
44
|
+
## [0.17.3] - 2025-12-21
|
|
45
|
+
|
|
46
|
+
### Fixed
|
|
47
|
+
- **Dev Mode Shutdown** - `pf dev` now exits cleanly with single CTRL+C after service crash
|
|
48
|
+
- File watchers are properly closed on shutdown to release event loop
|
|
49
|
+
- No more "hanging" process requiring second CTRL+C
|
|
50
|
+
- Graceful shutdown sequence: Services → NATS → Watchers → Exit
|
|
51
|
+
|
|
52
|
+
### Removed
|
|
53
|
+
- **Unused Code** - Removed `promptCompletionSetup()` function
|
|
54
|
+
- Function was never called, dead code from initial completion feature
|
|
55
|
+
- Autocompletion still works via explicit `pf setup --completion`
|
|
56
|
+
- Removed misleading README statement about "first-run prompt"
|
|
57
|
+
|
|
58
|
+
## [0.17.2] - 2024-12-21
|
|
59
|
+
|
|
60
|
+
### Fixed
|
|
61
|
+
- **Event Handler Naming** - Fixed documentation to match CLI implementation
|
|
62
|
+
- All examples now use singular handler names (`order-created.handler.ts` not `orders-created.handler.ts`)
|
|
63
|
+
- Updated `service.md` and `nest.md` AI generation guidelines
|
|
64
|
+
- Fixed test mock data to use singular event types (`order.created` not `orders.created`)
|
|
65
|
+
- Resolved issue where AI generated plural handlers but CLI generated singular handlers, causing duplicate files
|
|
66
|
+
- Handler files now consistently match event types in kebab-case (e.g., `order.created` → `order-created.handler.ts`)
|
|
67
|
+
|
|
68
|
+
## [0.17.0] - 2025-12-21
|
|
69
|
+
|
|
70
|
+
### Added
|
|
71
|
+
- **Root `tsconfig.json` Generation** - `pf new workspace` now creates a modern TypeScript config
|
|
72
|
+
- TypeScript 5+ best practices (`verbatimModuleSyntax`, `allowImportingTsExtensions`)
|
|
73
|
+
- Strict type checking with additional safety (`noFallthroughCasesInSwitch`)
|
|
74
|
+
- Flexible base config - packages can override with their specific needs
|
|
75
|
+
- Prevents warnings from test workspaces in `tmp/` directory
|
|
76
|
+
|
|
77
|
+
### Changed
|
|
78
|
+
- **TypeScript Configuration** - Modern, less restrictive root config
|
|
79
|
+
- `noEmit: true` - root doesn't emit, packages handle their own compilation
|
|
80
|
+
- Removed decorators from root (NestJS packages define themselves)
|
|
81
|
+
- Added `tmp/` to exclude list for test workspaces
|
|
82
|
+
|
|
83
|
+
## [0.16.6] - 2025-12-21
|
|
84
|
+
|
|
85
|
+
### Performance
|
|
86
|
+
- **Bundle Size Reduction**: 90% smaller package size
|
|
87
|
+
- Before: 3.15MB unpacked (2.9MB cli.js)
|
|
88
|
+
- After: 321KB unpacked (114KB cli.js)
|
|
89
|
+
- Changed esbuild config to use `packages: 'external'` instead of explicit external list
|
|
90
|
+
- All node_modules dependencies now excluded from bundle
|
|
91
|
+
- Only source code is bundled, dependencies loaded at runtime
|
|
92
|
+
|
|
93
|
+
### Changed
|
|
94
|
+
- Removed explicit `esbuild.external` list from package.json (no longer needed)
|
|
95
|
+
|
|
96
|
+
## [0.16.5] - 2025-12-21
|
|
97
|
+
|
|
98
|
+
### Fixed
|
|
99
|
+
- **Naming Convention Enforcement**: All documentation examples now use singular event types
|
|
100
|
+
- Event types: `order.created` not `orders.created` (singular - one fact)
|
|
101
|
+
- Schemas: `OrderCreatedSchema` not `OrdersCreatedSchema` (singular - one instance)
|
|
102
|
+
- Data types: `OrderCreatedData` not `OrdersCreatedData` (singular - one instance)
|
|
103
|
+
- Fixed 22+ examples across all generator docs
|
|
104
|
+
- **CLI Generation Consistency**: Contract names now properly pluralized
|
|
105
|
+
- Contracts: `OrdersCreatedContract` (plural - category of events)
|
|
106
|
+
- Aligns with documentation and naming convention rules
|
|
107
|
+
|
|
108
|
+
### Changed
|
|
109
|
+
- **Documentation Cleanup**: Removed duplicate sections and improved clarity
|
|
110
|
+
- Consolidated Stream Architecture section
|
|
111
|
+
- Clarified singular/plural naming rules with prominent examples
|
|
112
|
+
- Added final rule table for Schema/Type/Contract/Stream naming
|
|
113
|
+
|
|
114
|
+
## [0.16.2] - 2025-12-21
|
|
115
|
+
|
|
116
|
+
### Added
|
|
117
|
+
- **Environment Validation Scaffold**: Automatic `src/config/env.ts` creation
|
|
118
|
+
- Uses Zod v4 with `safeParse()` + explicit error handling
|
|
119
|
+
- Export validated `env` object for type-safe access
|
|
120
|
+
- Better error messages via `result.error.format()`
|
|
121
|
+
- Process exits with code 1 on validation failure
|
|
122
|
+
- **Zod Dependency**: Auto-added to Hono service dependencies (`^4.0.0`)
|
|
123
|
+
|
|
124
|
+
### Changed
|
|
125
|
+
- **Import Order Enforcement**: Critical import sequence now documented
|
|
126
|
+
1. Environment validation (`./config/env`) - First to validate before any code runs
|
|
127
|
+
2. Telemetry (`@crossdelta/telemetry`) - Second to patch modules before they load
|
|
128
|
+
3. All other imports follow
|
|
129
|
+
- **Clean Documentation**: Removed redundant comments from code examples
|
|
130
|
+
- Import order explained in section header, not inline comments
|
|
131
|
+
- Self-documenting code pattern
|
|
132
|
+
|
|
133
|
+
### Fixed
|
|
134
|
+
- **Dev Mode UX**: `pf dev` no longer exits when services crash
|
|
135
|
+
- Removed `process.exit()` call in process manager
|
|
136
|
+
- Context-aware messages based on exit code (0 vs non-zero)
|
|
137
|
+
- Auto-restart on file save preserved
|
|
138
|
+
|
|
139
|
+
### Internal
|
|
140
|
+
- Centralized event naming logic in `eventTypeToNames()` (8 return fields)
|
|
141
|
+
- Refactored 5 CLI services to use centralized naming
|
|
142
|
+
- Template build process includes new `src/config/` directory
|
|
143
|
+
|
|
144
|
+
### Documentation
|
|
145
|
+
- Updated `hono-bun.md` and `hono-node.md` with env validation examples
|
|
146
|
+
- Added import order requirements for AI code generation
|
|
147
|
+
- Environment validation section with Zod v4 best practices
|
|
148
|
+
|
|
149
|
+
### Breaking Changes
|
|
150
|
+
- Hono services now require `import './config/env'` before telemetry
|
|
151
|
+
- Environment validation runs at startup (fails fast on invalid env)
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## [0.13.0] - 2025-12-20
|
|
156
|
+
|
|
157
|
+
### Added
|
|
158
|
+
- **Domain-Grouped Event Structure**: Events organized by domain (`events/<domain>/<event>.ts`)
|
|
159
|
+
- Scalable for 100+ events (e.g., `events/orders/created.ts`, `events/customers/updated.ts`)
|
|
160
|
+
- Three-layer export system: domain index → events index → main index
|
|
161
|
+
- Auto-activation of exports on first event creation
|
|
162
|
+
- **Stream Policies**: Business rules for JetStream retention/storage in contracts package
|
|
163
|
+
- `STREAM_POLICIES` - Stream-specific overrides (ORDERS: 14d, CUSTOMERS: 30d)
|
|
164
|
+
- `DEFAULT_POLICY` - Default retention (7 days, file storage, 1 replica)
|
|
165
|
+
- Time/size constants for readability (`DAYS`, `MB`)
|
|
166
|
+
- **Generic Stream Deployment**: `@crossdelta/infrastructure` now exports `deployStreams()`
|
|
167
|
+
- Separates logic (library) from data (workspace)
|
|
168
|
+
- Workspaces inject contracts + policies via thin wrapper
|
|
169
|
+
- Replaces workspace-specific stream deployment code
|
|
170
|
+
- **Workspace Templates**: Added domain structure templates
|
|
171
|
+
- `src/events/index.ts` - Event contracts index with helpful comments
|
|
172
|
+
- `src/stream-policies.ts.hbs` - Stream policy template
|
|
173
|
+
- Templates synced via `bun run sync-templates`
|
|
174
|
+
- **Ephemeral Stream Auto-Creation**: `pf dev` now auto-creates streams from contracts
|
|
175
|
+
- Scans `packages/contracts/src/index.ts` for contracts with `channel.stream` metadata
|
|
176
|
+
- Creates ephemeral streams (memory storage, 1h retention) before services start
|
|
177
|
+
- No manual stream setup needed in development
|
|
178
|
+
- Services can immediately consume from streams on startup
|
|
179
|
+
- **Environment Validation Pattern**: Documented fail-fast config validation for Hono
|
|
180
|
+
- Separate `src/config/env.ts` with Zod schema
|
|
181
|
+
- Uses `safeParse()` + `process.exit(1)` pattern (Bun --hot compatible)
|
|
182
|
+
- Must import in `src/index.ts` for validation to execute
|
|
183
|
+
- Ensures Turbo TUI shows red X on validation failure (like NestJS)
|
|
184
|
+
- Explicit rule: DO NOT include `SERVICE_NAME_PORT` in env schema (handled by template)
|
|
185
|
+
- **Infrastructure Directory**: `infra/services/.gitkeep` in workspace template
|
|
186
|
+
- Ensures directory exists for `pf new` to create service configs
|
|
187
|
+
- Fixes issue where empty `.env.local` was generated
|
|
188
|
+
|
|
189
|
+
### Changed
|
|
190
|
+
- **BREAKING: Handler File Extension**: `*.event.ts` → `*.handler.ts`
|
|
191
|
+
- More semantically correct (files contain handlers, not event definitions)
|
|
192
|
+
- Event definitions live in `packages/contracts/src/events/`
|
|
193
|
+
- Handlers live in `services/*/src/events/`
|
|
194
|
+
- Discover pattern: `./src/events/**/*.handler.ts`
|
|
195
|
+
- **Migration**: Rename `*.event.ts` → `*.handler.ts` in your services
|
|
196
|
+
- **Contracts Structure**: Migrated from flat to domain-grouped
|
|
197
|
+
- Before: `events/orders-created.ts`
|
|
198
|
+
- After: `events/orders/created.ts` + `events/orders/index.ts`
|
|
199
|
+
- **CLI Event Generation**: Updated to create domain structure automatically
|
|
200
|
+
- `pf event add order.created` → creates `events/orders/created.ts`
|
|
201
|
+
- Auto-creates domain index files
|
|
202
|
+
- Three-phase export management (domain → events → main)
|
|
203
|
+
- **Service Generation**: Updated to use new `consumeJetStreams` API
|
|
204
|
+
- Removed manual stream creation (`ensureJetStreamStream`)
|
|
205
|
+
- Services consume from streams, never create them
|
|
206
|
+
- Import changed: `consumeJetStreams` (plural, new API)
|
|
207
|
+
- **Index Management**: Fixed duplicate export detection
|
|
208
|
+
- Now checks actual exports, not just text in comments
|
|
209
|
+
- `lines.some(line => line.trim() === exportLine)` for precision
|
|
210
|
+
- **Infrastructure**: Moved stream deployment logic from workspace to library
|
|
211
|
+
- Generic logic: `@crossdelta/infrastructure/lib/helpers/deploy-streams.ts`
|
|
212
|
+
- Workspace: `infra/streams/index.ts` (thin wrapper)
|
|
213
|
+
- Policies: `packages/contracts/src/stream-policies.ts` (business rules)
|
|
214
|
+
- **Hono Template Restoration**: Restored `src/index.ts.hbs` template
|
|
215
|
+
- Was accidentally deleted in commit 76dcc90
|
|
216
|
+
- Now properly generates entry point with correct port configuration
|
|
217
|
+
- Uses `generateHonoIndexTs()` helper instead of regex replacement
|
|
218
|
+
- **NestJS Port Configuration**: Removed `process.env.PORT ||` fallback
|
|
219
|
+
- Services now use only their specific env var (e.g., `MY_SERVICE_PORT`)
|
|
220
|
+
- Prevents port conflicts in multi-service development
|
|
221
|
+
- Consistent with Hono template pattern
|
|
222
|
+
- **Stream Architecture Documentation**: Clarified ephemeral vs persistent streams
|
|
223
|
+
- Development: `pf dev` auto-creates ephemeral streams from contracts
|
|
224
|
+
- Production: Pulumi materializes persistent streams with retention policies
|
|
225
|
+
- Services NEVER create streams (in any environment)
|
|
226
|
+
- Updated all READMEs to reflect correct flow
|
|
227
|
+
- **AI Generation Rules**: Consolidated and simplified documentation
|
|
228
|
+
- Removed redundant rules from framework-specific MD files
|
|
229
|
+
- Core rules in `ai-prompt-builder.ts`: AI can modify entry points but must preserve port line
|
|
230
|
+
- Added explicit "DO NOT generate `infra/services/*.ts`" rule (CLI handles this)
|
|
231
|
+
- Clarified naming convention: Events singular (domain.created), Streams PLURAL (DOMAINS)
|
|
232
|
+
- **NestJS Templates**: Removed `ensureJetStreams` references
|
|
233
|
+
- `events.service.ts.hbs` now uses only `consumeJetStreams`
|
|
234
|
+
- Updated comments to reflect stream auto-creation architecture
|
|
235
|
+
- Consistent with Hono templates
|
|
236
|
+
|
|
237
|
+
### Fixed
|
|
238
|
+
- Export detection in `index-manager.ts` no longer matches commented examples
|
|
239
|
+
- Handler service now uses correct `consumeJetStreams` API
|
|
240
|
+
- Contract path resolution for domain structure
|
|
241
|
+
- Template variable substitution (`{{workspaceName}}` in stream-policies.ts.hbs)
|
|
242
|
+
- **Environment Validation Import**: Added explicit requirement to import `env` in entry point
|
|
243
|
+
- Without import, validation code exists but never executes
|
|
244
|
+
- AI was generating `src/config/env.ts` but not importing it
|
|
245
|
+
- Now documented with CRITICAL warnings in both `hono-bun.md` and `hono-node.md`
|
|
246
|
+
- **Port Configuration in Env Schema**: Removed confusing PORT validation examples
|
|
247
|
+
- Port is read from template-generated env var, not from env schema
|
|
248
|
+
- Prevents AI from duplicating port config in validation
|
|
249
|
+
- Clear comments: "DO NOT include SERVICE_NAME_PORT here"
|
|
250
|
+
- **Discovery Service**: Fixed `ensureJetStreams` code generation
|
|
251
|
+
- Removed stream creation code from `generateStreamConfigCode()`
|
|
252
|
+
- Only generates `consumeJetStreams` with correct plural stream names
|
|
253
|
+
- Added architecture comments explaining stream creation responsibility
|
|
254
|
+
- **Legacy Content Cleanup**: Removed contradictory sections from documentation
|
|
255
|
+
- Deleted "Benefits" sections that referenced removed patterns (env.PORT)
|
|
256
|
+
- Removed duplicate/conflicting CRITICAL rules from hono-node.md
|
|
257
|
+
- Consistent CRITICAL rules across all framework docs
|
|
258
|
+
|
|
259
|
+
### Documentation
|
|
260
|
+
- Updated contracts README with domain structure examples
|
|
261
|
+
- Updated workspace templates to reflect new structure
|
|
262
|
+
- Added stream architecture documentation (conceptual vs. architectural)
|
|
263
|
+
- Clarified separation: contracts define "what", infrastructure defines "how"
|
|
264
|
+
- Removed legacy API references from all public package READMEs
|
|
265
|
+
- **Stream Naming Convention**: Extensively documented singular vs plural pattern
|
|
266
|
+
- Event types: singular (domain.created, order.created)
|
|
267
|
+
- Stream names: PLURAL (DOMAINS, ORDERS)
|
|
268
|
+
- Added "Merksatz" mnemonic: "Events sind singular. Streams sind plural."
|
|
269
|
+
- Examples in `consumeJetStreams` showing correct/incorrect usage
|
|
270
|
+
- **Port Configuration**: Clarified SERVICE_NAME_PORT pattern
|
|
271
|
+
- Convert service name to SCREAMING_SNAKE_CASE + `_PORT`
|
|
272
|
+
- DO NOT use generic `PORT` - causes conflicts
|
|
273
|
+
- Port assigned by CLI, written to `infra/services/*.ts`
|
|
274
|
+
- Service reads from specific env var, never hardcoded
|
|
275
|
+
- **Environment Validation**: Two-step pattern documented
|
|
276
|
+
- Step 1: Create `src/config/env.ts` with validation
|
|
277
|
+
- Step 2: Import in `src/index.ts` (CRITICAL - validation never runs without this!)
|
|
278
|
+
- Clear examples showing crash behavior and exit codes
|
|
279
|
+
|
|
280
|
+
### Internal
|
|
281
|
+
- **Code Organization**: Extracted pure functions from event command
|
|
282
|
+
- `format-consumers.ts` - Format consumer list for display
|
|
283
|
+
- `render-events-table.ts` - Render events table with schemas
|
|
284
|
+
- Improved testability and separation of concerns
|
|
285
|
+
- **Dev Command**: Integrated stream auto-creation into development workflow
|
|
286
|
+
- `startNatsInfra()` now returns boolean indicating success
|
|
287
|
+
- `ensureDevStreams()` called after NATS starts
|
|
288
|
+
- Uses `jiti` for TypeScript contract imports
|
|
289
|
+
- Silent failure with helpful message if stream creation fails
|
|
290
|
+
|
|
291
|
+
### Removed
|
|
292
|
+
- **Legacy API**: `consumeJetStreamEvents()` removed from public documentation
|
|
293
|
+
- Use `consumeJetStreams()` instead (plural, supports multiple streams)
|
|
294
|
+
|
|
295
|
+
### Migration Guide
|
|
296
|
+
1. **Rename handler files**: `*.event.ts` → `*.handler.ts`
|
|
297
|
+
```bash
|
|
298
|
+
find services -name "*.event.ts" -exec bash -c 'mv "$0" "${0%.event.ts}.handler.ts"' {} \;
|
|
299
|
+
```
|
|
300
|
+
2. **Update discover patterns**: Change `'./src/events/**/*.event.ts'` → `'./src/events/**/*.handler.ts'`
|
|
301
|
+
3. **Update contract imports**: Adjust for domain structure if using contracts package
|
|
302
|
+
|
|
303
|
+
### Dependencies
|
|
304
|
+
- `@crossdelta/infrastructure` added to contracts `package.json`
|
|
305
|
+
- **BREAKING: Handler File Extension**: `*.event.ts` → `*.handler.ts`
|
|
306
|
+
- More semantically correct (files contain handlers, not event definitions)
|
|
307
|
+
- Event definitions live in `packages/contracts/src/events/`
|
|
308
|
+
- Handlers live in `services/*/src/events/`
|
|
309
|
+
- Discover pattern: `./src/events/**/*.handler.ts`
|
|
310
|
+
- **Migration**: Rename `*.event.ts` → `*.handler.ts` in your services
|
|
311
|
+
- **Contracts Structure**: Migrated from flat to domain-grouped
|
|
312
|
+
- Before: `events/orders-created.ts`
|
|
313
|
+
- After: `events/orders/created.ts` + `events/orders/index.ts`
|
|
314
|
+
- **CLI Event Generation**: Updated to create domain structure automatically
|
|
315
|
+
- `pf event add order.created` → creates `events/orders/created.ts`
|
|
316
|
+
- Auto-creates domain index files
|
|
317
|
+
- Three-phase export management (domain → events → main)
|
|
318
|
+
- **Service Generation**: Updated to use new `consumeJetStreams` API
|
|
319
|
+
- Removed manual stream creation (`ensureJetStreamStream`)
|
|
320
|
+
- Services consume from streams, never create them
|
|
321
|
+
- Import changed: `consumeJetStreams` (plural, new API)
|
|
322
|
+
- **Index Management**: Fixed duplicate export detection
|
|
323
|
+
- Now checks actual exports, not just text in comments
|
|
324
|
+
- `lines.some(line => line.trim() === exportLine)` for precision
|
|
325
|
+
- **Infrastructure**: Moved stream deployment logic from workspace to library
|
|
326
|
+
- Generic logic: `@crossdelta/infrastructure/lib/helpers/deploy-streams.ts`
|
|
327
|
+
- Workspace: `infra/streams/index.ts` (thin wrapper)
|
|
328
|
+
- Policies: `packages/contracts/src/stream-policies.ts` (business rules)
|
|
329
|
+
|
|
330
|
+
### Fixed
|
|
331
|
+
- Export detection in `index-manager.ts` no longer matches commented examples
|
|
332
|
+
- Handler service now uses correct `consumeJetStreams` API
|
|
333
|
+
- Contract path resolution for domain structure
|
|
334
|
+
- Template variable substitution (`{{workspaceName}}` in stream-policies.ts.hbs)
|
|
335
|
+
|
|
336
|
+
### Documentation
|
|
337
|
+
- Updated contracts README with domain structure examples
|
|
338
|
+
- Updated workspace templates to reflect new structure
|
|
339
|
+
- Added stream architecture documentation (conceptual vs. architectural)
|
|
340
|
+
- Clarified separation: contracts define "what", infrastructure defines "how"
|
|
341
|
+
- Removed legacy API references from all public package READMEs
|
|
342
|
+
|
|
343
|
+
### Removed
|
|
344
|
+
- **Legacy API**: `consumeJetStreamEvents()` removed from public documentation
|
|
345
|
+
- Use `consumeJetStreams()` instead (plural, supports multiple streams)
|
|
346
|
+
|
|
347
|
+
### Migration Guide
|
|
348
|
+
1. **Rename handler files**: `*.event.ts` → `*.handler.ts`
|
|
349
|
+
```bash
|
|
350
|
+
find services -name "*.event.ts" -exec bash -c 'mv "$0" "${0%.event.ts}.handler.ts"' {} \;
|
|
351
|
+
```
|
|
352
|
+
2. **Update discover patterns**: Change `'./src/events/**/*.event.ts'` → `'./src/events/**/*.handler.ts'`
|
|
353
|
+
3. **Update contract imports**: Adjust for domain structure if using contracts package
|
|
354
|
+
|
|
355
|
+
### Dependencies
|
|
356
|
+
- `@crossdelta/infrastructure` added to contracts `package.json`
|
|
357
|
+
|
|
358
|
+
## [0.11.0] - 2025-12-19
|
|
359
|
+
|
|
360
|
+
### Added
|
|
361
|
+
- **Config-Driven Generator Docs**: Generator instructions now configured in `package.json` under `generatorConfig`
|
|
362
|
+
- `docs.base`: Base instruction files (service.md, code-style.md, testing.md)
|
|
363
|
+
- `docs.frameworks`: Framework-specific files (hono-bun.md, hono-node.md, nest.md)
|
|
364
|
+
- `serviceTypes`: Service type configuration (command types, entry points, skip files)
|
|
365
|
+
- **Lock-File Mechanism**: `.pf-generating` file pauses hot-reload during AI service generation
|
|
366
|
+
- **File-Watcher Service**: Refactored from `dev.command.ts` to `services/file-watcher.ts`
|
|
367
|
+
- Watches for lock file deletion to trigger reload
|
|
368
|
+
- Configurable watch paths via `pf.paths` in package.json
|
|
369
|
+
- **Modular AI Instructions**: Split large instruction file into focused modules:
|
|
370
|
+
- `service.md` - Core service generation rules
|
|
371
|
+
- `code-style.md` - Formatting, imports, naming conventions
|
|
372
|
+
- `testing.md` - Testing patterns with bun:test
|
|
373
|
+
- `hono-bun.md` / `hono-node.md` - Hono-specific patterns
|
|
374
|
+
- `nest.md` - NestJS-specific patterns
|
|
375
|
+
- **Tests**: Added `config.test.ts` for `getGeneratorConfig()` validation
|
|
376
|
+
|
|
377
|
+
### Changed
|
|
378
|
+
- **NestJS tsconfig**: Changed to `moduleResolution: bundler` + added `bun-types`
|
|
379
|
+
- **NestJS structure**: Removed test file exclusion from tsconfig.json (needed for IDE)
|
|
380
|
+
- **Biome Config**: Disabled `useImportType` globally for NestJS DI compatibility
|
|
381
|
+
- **Generator docs**: Massively simplified and reorganized (README, framework docs)
|
|
382
|
+
- **AI Instructions Loading**: Now uses config from package.json instead of hardcoded paths
|
|
383
|
+
- **CloudEvents API**: Updated all generators to use new `ensureJetStreams` / `consumeJetStreams`
|
|
384
|
+
|
|
385
|
+
### Fixed
|
|
386
|
+
- NestJS import sorting issues with DI patterns
|
|
387
|
+
- Handler logging standardized on `console.log` (services can use Logger)
|
|
388
|
+
- Schema field consistency checks in AI generation
|
|
389
|
+
|
|
390
|
+
### Documentation
|
|
391
|
+
- Expanded AI section in README with feature list and "What makes it different"
|
|
392
|
+
- Added link to `@crossdelta/cloudevents` package
|
|
393
|
+
- Added "AI-assisted" mention in header tagline
|
|
394
|
+
- Updated generator docs with NestJS best practices (use built-in features)
|
|
395
|
+
- Added config validation patterns with `@nestjs/config` + Zod
|
|
396
|
+
|
|
397
|
+
### Infrastructure
|
|
398
|
+
- Added VS Code workspace settings (`.vscode/settings.json`)
|
|
399
|
+
- Added VS Code extension recommendations (`.vscode/extensions.json`)
|
|
400
|
+
- Biome format-on-save enabled by default
|
|
401
|
+
|
|
402
|
+
---
|
|
403
|
+
|
|
404
|
+
## Older Versions
|
|
405
|
+
|
|
406
|
+
For changes in versions prior to 0.11.0, please refer to the [git commit history](https://github.com/orderboss/platform/commits/main/packages/platform-sdk).
|
|
407
|
+
|
package/README.md
CHANGED
|
@@ -196,32 +196,33 @@ pf event publish order.created
|
|
|
196
196
|
| `pf event add <type> --service <path>` | 🔗 Add contract + handler + wire stream |
|
|
197
197
|
| `pf event list` | 📋 List available events and consumers |
|
|
198
198
|
| `pf event publish <type>` | 📤 Publish mock event to NATS |
|
|
199
|
+
| `pf setup completion` | 🔧 Install shell autocompletion (zsh/bash) |
|
|
200
|
+
| `pf setup ai` | 🤖 Configure AI provider for code generation |
|
|
199
201
|
| `pf test` | 🧪 Run tests across the monorepo |
|
|
200
202
|
| `pf build` | 📦 Build all packages and services |
|
|
201
203
|
| `pf lint` | ✨ Lint and format with Biome |
|
|
202
204
|
| `pf audit` | 🔒 Run security audit on dependencies |
|
|
203
|
-
| `pf setup --completion` | 🎯 Install shell autocompletion |
|
|
204
205
|
|
|
205
206
|
> `pf` proxies all commands to Turborepo (works from any subdirectory).
|
|
206
207
|
|
|
207
|
-
|
|
208
|
+
#### Custom Command Descriptions
|
|
208
209
|
|
|
209
|
-
|
|
210
|
+
Add descriptions to your workspace commands for better autocompletion:
|
|
210
211
|
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
pf
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
212
|
+
```json
|
|
213
|
+
{
|
|
214
|
+
"pf": {
|
|
215
|
+
"commands": {
|
|
216
|
+
"deploy": {
|
|
217
|
+
"command": "cd infra && pulumi up",
|
|
218
|
+
"description": "Deploy infrastructure to production"
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
222
223
|
```
|
|
223
224
|
|
|
224
|
-
|
|
225
|
+
Then `pf <TAB>` shows: `deploy -- Deploy infrastructure to production`
|
|
225
226
|
|
|
226
227
|
---
|
|
227
228
|
|
|
@@ -230,7 +231,7 @@ pf setup --<TAB> # Shows --ai, --completion
|
|
|
230
231
|
> **Optional but powerful.** Configure once, then use `--ai` with any generator.
|
|
231
232
|
|
|
232
233
|
```bash
|
|
233
|
-
pf setup
|
|
234
|
+
pf setup ai # OpenAI or Anthropic
|
|
234
235
|
|
|
235
236
|
pf new hono-micro services/notifications --ai \
|
|
236
237
|
-d "Send emails when orders are created"
|
|
@@ -363,7 +364,11 @@ my-platform/
|
|
|
363
364
|
"pf": {
|
|
364
365
|
"registry": "my-org/my-platform",
|
|
365
366
|
"commands": {
|
|
366
|
-
"deploy": {
|
|
367
|
+
"deploy": {
|
|
368
|
+
"cwd": "infra",
|
|
369
|
+
"command": "pulumi up --yes",
|
|
370
|
+
"description": "Deploy infrastructure to production"
|
|
371
|
+
}
|
|
367
372
|
},
|
|
368
373
|
"paths": {
|
|
369
374
|
"services": { "path": "services", "watch": true },
|