@crossdelta/platform-sdk 0.4.47 → 0.5.0
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/bin/cli.js +150 -143
- package/bin/services/ai/instructions/ai-instructions.md +25 -7
- package/bin/templates/hono-microservice/src/index.ts.hbs +2 -2
- package/bin/templates/workspace/package.json.hbs +8 -6
- package/bin/templates/workspace/pnpm-workspace.yaml.hbs +5 -0
- package/bin/templates/workspace/services/nats/scripts/start-dev.sh.hbs +1 -1
- package/package.json +2 -1
|
@@ -31,6 +31,7 @@ Rules:
|
|
|
31
31
|
- One package per line.
|
|
32
32
|
- No versions.
|
|
33
33
|
- Only packages not included in the scaffold.
|
|
34
|
+
- **CRITICAL:** Only use packages that actually exist on npm. Verify package names are correct (e.g., `@pusher/push-notifications-server` not `pusher-beams`). When unsure, use well-known, established packages.
|
|
34
35
|
|
|
35
36
|
---
|
|
36
37
|
|
|
@@ -97,11 +98,28 @@ Contains only:
|
|
|
97
98
|
|
|
98
99
|
---
|
|
99
100
|
|
|
100
|
-
# 6. Use-Case Rules
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
-
|
|
104
|
-
- Use
|
|
101
|
+
# 6. Use-Case Rules (Lean Hexagonal Architecture)
|
|
102
|
+
|
|
103
|
+
Services follow a **Lean Hexagonal Architecture** pattern:
|
|
104
|
+
- **Handlers** = Adapters (receive events, delegate to use-cases)
|
|
105
|
+
- **Use-Cases** = Application Core (business logic, orchestration)
|
|
106
|
+
- No explicit ports/interfaces unless needed
|
|
107
|
+
|
|
108
|
+
**IMPORTANT:** A single service description may result in **multiple use-cases**. Break down complex functionality into focused, single-responsibility use-cases.
|
|
109
|
+
|
|
110
|
+
Example: "Payment processing service" might generate:
|
|
111
|
+
- `validate-payment.use-case.ts` - Validate payment details
|
|
112
|
+
- `process-payment.use-case.ts` - Execute payment with provider
|
|
113
|
+
- `notify-payment-status.use-case.ts` - Send payment notifications
|
|
114
|
+
- `refund-payment.use-case.ts` - Handle refund requests
|
|
115
|
+
|
|
116
|
+
Use-Case Rules:
|
|
117
|
+
- All domain logic lives in `use-cases/`
|
|
118
|
+
- One use-case = one responsibility
|
|
119
|
+
- Pure functions preferred
|
|
120
|
+
- No framework imports
|
|
121
|
+
- Use inferred schema types from handlers
|
|
122
|
+
- Compose use-cases when needed (call one from another)
|
|
105
123
|
|
|
106
124
|
---
|
|
107
125
|
|
|
@@ -157,7 +175,7 @@ Forbidden in handlers:
|
|
|
157
175
|
|
|
158
176
|
# 8. Testing Rules
|
|
159
177
|
|
|
160
|
-
**CRITICAL:**
|
|
178
|
+
**CRITICAL:**
|
|
161
179
|
- Test ONLY use-cases (NOT event handlers)
|
|
162
180
|
- Use Bun's native test runner: `import { describe, expect, it, beforeEach, afterEach } from 'bun:test'`
|
|
163
181
|
- **NO mocking available** - Bun does NOT have `vi`, `mock`, `jest.fn()`, or module mocking
|
|
@@ -195,7 +213,7 @@ describe('Send Notification Use Case', () => {
|
|
|
195
213
|
|
|
196
214
|
it('should throw error if credentials not set', async () => {
|
|
197
215
|
delete process.env.PUSHER_BEAMS_INSTANCE_ID
|
|
198
|
-
|
|
216
|
+
|
|
199
217
|
await expect(
|
|
200
218
|
sendNotification({ orderId: '123', customerId: 'cust-1' })
|
|
201
219
|
).rejects.toThrow('Missing Pusher Beams credentials')
|
|
@@ -10,9 +10,9 @@ app.get('/health', (c) => {
|
|
|
10
10
|
return c.json({ status: 'ok' })
|
|
11
11
|
})
|
|
12
12
|
|
|
13
|
-
console.log('Starting {{serviceName}} service on port', port)
|
|
14
|
-
|
|
15
13
|
Bun.serve({
|
|
16
14
|
port,
|
|
17
15
|
fetch: app.fetch,
|
|
18
16
|
})
|
|
17
|
+
|
|
18
|
+
console.log(`🚀 Service ready at http://localhost:${port}`)
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "pf dev",
|
|
6
6
|
"generate-env": "turbo run generate-env --ui=stream",
|
|
7
|
-
"build": "
|
|
8
|
-
"preview": "
|
|
9
|
-
"lint": "
|
|
10
|
-
"format": "
|
|
7
|
+
"build": "dotenv -e .env.local -- turbo run build",
|
|
8
|
+
"preview": "dotenv -e .env.local -- turbo run preview",
|
|
9
|
+
"lint": "turbo run lint",
|
|
10
|
+
"format": "turbo run format",
|
|
11
11
|
"pulumi": "cd infra && pulumi",
|
|
12
|
-
"test": "
|
|
12
|
+
"test": "dotenv -e .env.local -- turbo run test"
|
|
13
13
|
},
|
|
14
14
|
"pf": {
|
|
15
15
|
"registry": "{{projectName}}/platform",
|
|
@@ -21,8 +21,10 @@
|
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@biomejs/biome": "2.3.7",
|
|
23
23
|
"@crossdelta/platform-sdk": "latest",
|
|
24
|
+
"bun": "^1.2.7",
|
|
25
|
+
"dotenv-cli": "^8.0.0",
|
|
24
26
|
"turbo": "^2.5.6"
|
|
25
27
|
},
|
|
26
|
-
"packageManager": "
|
|
28
|
+
"packageManager": "{{packageManagerVersion}}",
|
|
27
29
|
"workspaces": ["packages/*", "apps/*", "services/*", "infra"]
|
|
28
30
|
}
|
|
@@ -11,7 +11,7 @@ if [[ -f "$ENV_FILE" ]]; then
|
|
|
11
11
|
source "$ENV_FILE"
|
|
12
12
|
set +a
|
|
13
13
|
else
|
|
14
|
-
echo "[NATS] Warning: $ENV_FILE not found. Run '
|
|
14
|
+
echo "[NATS] Warning: $ENV_FILE not found. Run 'pf dev' or your package manager's 'generate-env' script first."
|
|
15
15
|
fi
|
|
16
16
|
|
|
17
17
|
# Container name (local dev only)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crossdelta/platform-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "CLI toolkit for scaffolding Turborepo workspaces with Pulumi infrastructure and Hono/NestJS microservices",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -88,6 +88,7 @@
|
|
|
88
88
|
"chalk": "^5.4.1",
|
|
89
89
|
"cli-table3": "^0.6.5",
|
|
90
90
|
"commander": "^13.1.0",
|
|
91
|
+
"dotenv": "^17.2.3",
|
|
91
92
|
"enquirer": "^2.4.1",
|
|
92
93
|
"execa": "^9.5.2",
|
|
93
94
|
"fs-extra": "^11.3.0",
|