@crossdelta/platform-sdk 0.7.1 → 0.7.2
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.
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
These rules define how AI-generated scaffolded services must be structured when produced by CLI tools.
|
|
4
4
|
|
|
5
|
+
## ⚠️ CRITICAL: Code Quality Guidelines
|
|
6
|
+
|
|
7
|
+
**NEVER invent APIs, package names, or TypeScript types:**
|
|
8
|
+
- ✅ **Research actual package documentation** before using third-party libraries
|
|
9
|
+
- ✅ **Verify TypeScript types** match the actual library's type definitions
|
|
10
|
+
- ✅ **Check npm registry** to confirm package names exist
|
|
11
|
+
- ❌ **DO NOT hallucinate** API methods, properties, or function signatures
|
|
12
|
+
- ❌ **DO NOT guess** at type structures - look them up or use `any` with a TODO comment
|
|
13
|
+
|
|
14
|
+
**When unsure:**
|
|
15
|
+
1. Use well-known, battle-tested packages (e.g., `@pusher/push-notifications-server`, not `pusher-beams`)
|
|
16
|
+
2. Keep code simple and explicit
|
|
17
|
+
3. Add TODO comments for unverified APIs: `// TODO: Verify this API signature`
|
|
18
|
+
|
|
5
19
|
---
|
|
6
20
|
|
|
7
21
|
# 1. Commands Block (REQUIRED - MUST BE FIRST)
|
|
@@ -61,7 +75,8 @@ Rules:
|
|
|
61
75
|
- One package per line.
|
|
62
76
|
- No versions.
|
|
63
77
|
- Only packages not included in the scaffold.
|
|
64
|
-
- **CRITICAL:** Only use packages that actually exist on npm. Verify package names
|
|
78
|
+
- **CRITICAL:** Only use packages that actually exist on npm. **Verify package names on npmjs.com** before using them (e.g., `@pusher/push-notifications-server` not `pusher-beams`).
|
|
79
|
+
- **TypeScript safety:** Ensure your code respects the actual TypeScript types exported by the package. Do not invent properties or methods.
|
|
65
80
|
- **IMPORTANT:** Workspace packages (like `{{scope}}/contracts`) are automatically detected and installed with `workspace:*` protocol. Just list the package name without version.
|
|
66
81
|
|
|
67
82
|
### Core Package Names (ALWAYS USE THESE EXACT NAMES)
|
|
@@ -195,7 +210,7 @@ Bun.serve({ port, fetch: app.fetch })
|
|
|
195
210
|
```ts
|
|
196
211
|
import '@crossdelta/telemetry'
|
|
197
212
|
|
|
198
|
-
import { consumeJetStreamEvents } from '@crossdelta/cloudevents'
|
|
213
|
+
import { consumeJetStreamEvents, ensureJetStreamStream } from '@crossdelta/cloudevents'
|
|
199
214
|
import { Hono } from 'hono'
|
|
200
215
|
|
|
201
216
|
const port = Number(process.env.PORT || process.env.MY_SERVICE_PORT) || 4003
|
|
@@ -203,17 +218,28 @@ const app = new Hono()
|
|
|
203
218
|
|
|
204
219
|
app.get('/health', (c) => c.json({ status: 'ok' }))
|
|
205
220
|
|
|
221
|
+
Bun.serve({ port, fetch: app.fetch })
|
|
222
|
+
|
|
223
|
+
// Ensure stream exists (idempotent - safe to call on every start)
|
|
224
|
+
await ensureJetStreamStream({
|
|
225
|
+
stream: 'ORDERS',
|
|
226
|
+
subjects: ['orders.>'],
|
|
227
|
+
})
|
|
228
|
+
|
|
206
229
|
// Start NATS consumer - handlers are auto-discovered
|
|
207
230
|
consumeJetStreamEvents({
|
|
208
231
|
stream: 'ORDERS',
|
|
209
232
|
consumer: 'my-service',
|
|
210
233
|
discover: './src/events/**/*.event.ts',
|
|
211
234
|
})
|
|
212
|
-
|
|
213
|
-
Bun.serve({ port, fetch: app.fetch })
|
|
214
235
|
```
|
|
215
236
|
|
|
216
|
-
**
|
|
237
|
+
**CRITICAL:**
|
|
238
|
+
- MUST call `ensureJetStreamStream()` BEFORE `consumeJetStreamEvents()`
|
|
239
|
+
- MUST use top-level await (Bun supports this)
|
|
240
|
+
- `ensureJetStreamStream()` uses `subjects` parameter (stream-level: what goes INTO the stream)
|
|
241
|
+
- `consumeJetStreamEvents()` uses `filterSubjects` parameter (consumer-level: what THIS consumer reads)
|
|
242
|
+
- Do NOT confuse `subjects` (stream) with `filterSubjects` (consumer)
|
|
217
243
|
|
|
218
244
|
### � HTTP CloudEvent Receiver (Receives CloudEvents via HTTP POST)
|
|
219
245
|
|
package/install.sh
CHANGED
|
@@ -83,16 +83,16 @@ if [ $# -eq 0 ]; then
|
|
|
83
83
|
|
|
84
84
|
case $PM in
|
|
85
85
|
bun)
|
|
86
|
-
bun add -g @crossdelta/platform-sdk
|
|
86
|
+
bun add -g @crossdelta/platform-sdk --silent 2>&1 | grep -v "deprecated\|peer dependencies\|unmet peer" || true
|
|
87
87
|
;;
|
|
88
88
|
pnpm)
|
|
89
|
-
pnpm add -g @crossdelta/platform-sdk
|
|
89
|
+
pnpm add -g @crossdelta/platform-sdk --reporter=silent 2>&1 || true
|
|
90
90
|
;;
|
|
91
91
|
yarn)
|
|
92
|
-
yarn global add @crossdelta/platform-sdk
|
|
92
|
+
yarn global add @crossdelta/platform-sdk --silent 2>&1 || true
|
|
93
93
|
;;
|
|
94
94
|
npm)
|
|
95
|
-
npm install -g @crossdelta/platform-sdk
|
|
95
|
+
npm install -g @crossdelta/platform-sdk --silent 2>&1 || true
|
|
96
96
|
;;
|
|
97
97
|
esac
|
|
98
98
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crossdelta/platform-sdk",
|
|
3
|
-
"version": "0.7.
|
|
4
|
-
"description": "Your AI-powered platform engineer. Scaffold complete Turborepo workspaces, generate microservice boilerplate with natural language, and deploy to the cloud — all from one CLI
|
|
3
|
+
"version": "0.7.2",
|
|
4
|
+
"description": "Your AI-powered platform engineer. Scaffold complete Turborepo workspaces, generate microservice boilerplate with natural language, and deploy to the cloud — all from one CLI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
7
7
|
"scaffolding",
|