@crossdelta/platform-sdk 0.8.4 → 0.8.21

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.
@@ -1,4 +1,4 @@
1
- # Service Generator Instructions
1
+ # AI Generation Rules for CLI Code Output
2
2
 
3
3
  These rules define how AI-generated scaffolded services must be structured.
4
4
 
@@ -88,7 +88,7 @@ consumeJetStreamEvents({
88
88
 
89
89
  ---
90
90
 
91
- ## Commands Block (REQUIRED - MUST BE FIRST)
91
+ # 1. Commands Block (REQUIRED - MUST BE FIRST)
92
92
 
93
93
  ```commands
94
94
  pf new hono-micro services/my-service -y
@@ -99,7 +99,7 @@ pf new hono-micro services/my-service -y
99
99
 
100
100
  ---
101
101
 
102
- ## Post-Generation Commands
102
+ # 2. Post-Generation Commands
103
103
 
104
104
  For Event Consumer services:
105
105
 
@@ -111,7 +111,7 @@ pf event add <event.type> --service services/my-service
111
111
 
112
112
  ---
113
113
 
114
- ## Dependencies Block
114
+ # 3. Dependencies Block
115
115
 
116
116
  Only include packages not in the scaffold:
117
117
 
@@ -124,7 +124,7 @@ zod
124
124
 
125
125
  ---
126
126
 
127
- ## Required Files
127
+ # 4. Required Files
128
128
 
129
129
  **Event Consumer:**
130
130
  ```
@@ -159,9 +159,16 @@ services/my-service/
159
159
 
160
160
  ---
161
161
 
162
- ## Service Types
162
+ # 5. Code Style
163
163
 
164
- ### 📤 Event Publisher (REST API)
164
+ - Biome-compatible, strict TS, arrow functions only
165
+ - No semicolons, minimal comments, alphabetized imports
166
+
167
+ ---
168
+
169
+ # 6. Service Types
170
+
171
+ ## 📤 Event Publisher (REST API)
165
172
 
166
173
  **Keywords:** "publishes", "creates", "manages", "REST API"
167
174
 
@@ -182,19 +189,19 @@ app.post('/orders', async (c) => {
182
189
  Bun.serve({ port: 4001, fetch: app.fetch })
183
190
  ```
184
191
 
185
- ### 📥 Event Consumer (NATS)
192
+ ## 📥 Event Consumer (NATS)
186
193
 
187
194
  **Keywords:** "consumes", "listens to", "reacts to", "handles events"
188
195
 
189
- See 3-Step Workflow above.
196
+ See 4-Step Workflow above.
190
197
 
191
- ### 🔄 Hybrid (Both)
198
+ ## 🔄 Hybrid (Both)
192
199
 
193
200
  Combines REST endpoints + NATS consumer.
194
201
 
195
202
  ---
196
203
 
197
- ## Use-Case Rules
204
+ # 7. Use-Case Rules
198
205
 
199
206
  - Live in `src/use-cases/*.use-case.ts`
200
207
  - Pure functions, no framework imports
@@ -219,7 +226,7 @@ export const processOrder = async (
219
226
 
220
227
  ---
221
228
 
222
- ## Testing Rules
229
+ # 8. Testing Rules
223
230
 
224
231
  - Test ONLY use-cases
225
232
  - Use `import { describe, expect, it } from 'bun:test'`
@@ -241,7 +248,7 @@ describe('Process Order', () => {
241
248
 
242
249
  ---
243
250
 
244
- ## Absolute Rules
251
+ # 9. Absolute Rules
245
252
 
246
253
  **DO NOT:**
247
254
  - Generate full rewrites
@@ -10,7 +10,6 @@ Always generate **minimal diffs**, never full rewrites.
10
10
  - Analyze only the opened file unless explicitly asked.
11
11
  - Follow existing architecture and naming conventions.
12
12
  - Prefer strict typing; avoid `any`.
13
- - **Reuse existing code**: Before implementing new functionality, search the codebase for existing functions, utilities, or services that can be reused. Avoid duplicating logic.
14
13
 
15
14
  ## Code Style
16
15
  - Single quotes, no semicolons, 2-space indent, trailing commas.
@@ -61,7 +60,8 @@ Always generate **minimal diffs**, never full rewrites.
61
60
  When working with specific service types or packages, refer to these detailed guidelines:
62
61
 
63
62
  ### Service Generation & Architecture
64
- - [CLI Service Generator](../packages/platform-sdk/docs/generators/service.md) - AI code generation rules
63
+ - [Service Architecture Guidelines](../docs/generators/services/architecture-guidelines.md) - General patterns for all services
64
+ - [Hono Microservice Guidelines](../docs/generators/services/hono-micro-guidelines.md) - Event-driven Hono patterns
65
65
 
66
66
  ### Key Packages
67
67
  - [@crossdelta/cloudevents](../packages/cloudevents/README.md) - Event handling with NATS and CloudEvents
package/install.sh CHANGED
@@ -11,15 +11,15 @@ NC='\033[0m'
11
11
 
12
12
  printf "${CYAN}"
13
13
  cat << "EOF"
14
- ______
14
+ ______
15
15
  / ____/
16
- ____ / /_
17
- / __ \ / __/
18
- / /_/ // /
19
- / .___//_/
20
- /_/
21
-
22
- @crossdelta/platform-sdk installer
16
+ ____ / /_
17
+ / __ \ / __/
18
+ / /_/ // /
19
+ / .___//_/
20
+ /_/
21
+
22
+ @crossdelta/platform-sdk installer
23
23
  EOF
24
24
  printf "${NC}\n"
25
25
 
@@ -44,28 +44,28 @@ detect_or_install_package_manager() {
44
44
  echo "npm"
45
45
  return 0
46
46
  fi
47
-
47
+
48
48
  # No package manager found - ask user for permission
49
49
  printf "${YELLOW}No package manager found (bun, pnpm, yarn, npm).${NC}\n"
50
50
  printf "${YELLOW}To use @crossdelta/platform-sdk, we recommend installing Bun (fast JavaScript runtime).${NC}\n"
51
51
  printf "\n"
52
52
  read -p "Do you want to install Bun now? (y/n) " -n 1 -r
53
53
  printf "\n"
54
-
54
+
55
55
  if [[ ! $REPLY =~ ^[Yy]$ ]]; then
56
56
  printf "${RED}Installation cancelled. Please install Bun or another package manager manually.${NC}\n"
57
57
  printf "${BLUE}Visit: https://bun.sh${NC}\n"
58
58
  exit 1
59
59
  fi
60
-
60
+
61
61
  # Install Bun
62
62
  printf "${BLUE}Installing Bun...${NC}\n"
63
63
  curl -fsSL https://bun.sh/install | bash
64
-
64
+
65
65
  # Load Bun into current shell
66
66
  export BUN_INSTALL="$HOME/.bun"
67
67
  export PATH="$BUN_INSTALL/bin:$PATH"
68
-
68
+
69
69
  printf "${GREEN}✓${NC} Bun installed successfully\n"
70
70
  echo "bun"
71
71
  }
@@ -117,7 +117,7 @@ if [ $# -eq 0 ]; then
117
117
  else
118
118
  # Arguments provided: Run pf command directly
119
119
  PF_ARGS=()
120
-
120
+
121
121
  while [[ $# -gt 0 ]]; do
122
122
  case $1 in
123
123
  -h|--help)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crossdelta/platform-sdk",
3
- "version": "0.8.4",
3
+ "version": "0.8.21",
4
4
  "description": "Platform toolkit for event-driven microservices — keeping code and infrastructure in lockstep.",
5
5
  "keywords": [
6
6
  "cli",
@@ -29,7 +29,7 @@
29
29
  "files": [
30
30
  "bin/**/*.js",
31
31
  "bin/**/templates/**",
32
- "bin/docs/generators/**",
32
+ "bin/**/instructions/**",
33
33
  "bin/**/*.json",
34
34
  "!bin/**/*.map",
35
35
  "dist/",
@@ -51,7 +51,7 @@
51
51
  "scripts": {
52
52
  "start:dev": "node esbuild.config.mjs --watch",
53
53
  "build:cli": "node esbuild.config.mjs",
54
- "build:cli:copy": "cp cli/integration.collection.json bin/integration.collection.json && rm -rf bin/templates && mkdir -p bin/templates && cp -r cli/src/commands/create/workspace/templates bin/templates/workspace && cp -r cli/src/commands/create/hono-microservice/templates bin/templates/hono-microservice && cp -r cli/src/commands/create/nest-microservice/templates bin/templates/nest-microservice && mkdir -p bin/docs/generators && cp -r docs/generators/* bin/docs/generators/",
54
+ "build:cli:copy": "cp cli/integration.collection.json bin/integration.collection.json && rm -rf bin/templates && mkdir -p bin/templates && cp -r cli/src/commands/create/workspace/templates bin/templates/workspace && cp -r cli/src/commands/create/hono-microservice/templates bin/templates/hono-microservice && cp -r cli/src/commands/create/nest-microservice/templates bin/templates/nest-microservice && mkdir -p bin/services/ai/instructions && cp cli/src/services/ai/instructions/ai-instructions.md bin/services/ai/instructions/",
55
55
  "build:schematics:transpile": "tsc --project tsconfig.schematics.json",
56
56
  "build:schematics:copy": "cp -R schematics/* dist/schematics && find dist/schematics -name '*.ts' -delete",
57
57
  "build:schematics": "npm run build:schematics:transpile && npm run build:schematics:copy",
@@ -1,47 +0,0 @@
1
- # Generator Documentation
2
-
3
- This directory contains AI instructions for code generators.
4
-
5
- ## Structure
6
-
7
- ```
8
- generators/
9
- ├── README.md # This file
10
- └── service.md # Service generator instructions
11
- ```
12
-
13
- ## How Instructions Are Loaded
14
-
15
- The AI service generator loads instructions in priority order (most specific first):
16
-
17
- 1. **Generator-specific** (`packages/platform-sdk/docs/generators/service.md`)
18
- - Detailed rules for the service generator output format
19
- - Event consumer/publisher workflows
20
- - File structure requirements
21
-
22
- 2. **Copilot instructions** (`.github/copilot-instructions.md`)
23
- - Project-wide coding standards
24
- - Code style rules
25
- - Package-specific guidelines
26
-
27
- 3. **Project AI guidelines** (`docs/ai-guidelines.md`)
28
- - General architectural principles
29
- - Validation patterns
30
- - Testing guidelines
31
-
32
- ## Adding New Generators
33
-
34
- To add instructions for a new generator:
35
-
36
- 1. Create `<generator-name>.md` in this directory
37
- 2. Update `INSTRUCTION_FILES` in `ai-service-generator.ts` if needed
38
- 3. Follow the existing format from `service.md`
39
-
40
- ## Template Variables
41
-
42
- The following variables are replaced at runtime:
43
-
44
- | Variable | Description |
45
- |----------|-------------|
46
- | `{{scope}}` | Package scope (e.g., `@orderboss`) |
47
- | `{{AVAILABLE_CONTRACTS}}` | Auto-generated list of existing contracts |