@crossdelta/platform-sdk 0.25.6 → 0.26.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/CHANGELOG.md +25 -0
- package/README.md +19 -46
- package/bin/cli.mjs +101 -237
- package/bin/docs/generators/README.md +4 -32
- package/bin/templates/workspace/.claude/rules/cloudevents.md +1 -2
- package/bin/templates/workspace/CLAUDE.md +5 -1
- package/bin/templates/workspace/package.json.hbs +9 -0
- package/bin/templates/workspace/packages/contracts/README.md.hbs +1 -1
- package/package.json +1 -43
- package/schemas/service-types.schema.json +0 -33
|
@@ -10,47 +10,19 @@ generators/
|
|
|
10
10
|
├── service.md # Main service generator instructions
|
|
11
11
|
├── code-style.md # Code style, formatting, naming conventions
|
|
12
12
|
├── testing.md # Testing rules and patterns
|
|
13
|
+
├── natural-language.md # Natural-language prompt pipeline
|
|
13
14
|
├── hono-bun.md # Hono with Bun runtime specifics
|
|
14
15
|
├── hono-node.md # Hono with Node.js runtime specifics
|
|
15
16
|
└── nest.md # NestJS framework specifics
|
|
16
17
|
```
|
|
17
18
|
|
|
18
|
-
## How Instructions Are
|
|
19
|
-
|
|
20
|
-
Instructions are configured in `package.json` under `generatorConfig.docs`:
|
|
21
|
-
|
|
22
|
-
```json
|
|
23
|
-
{
|
|
24
|
-
"generatorConfig": {
|
|
25
|
-
"docs": {
|
|
26
|
-
"base": ["service.md", "code-style.md", "testing.md"],
|
|
27
|
-
"frameworks": {
|
|
28
|
-
"hono": { "bun": "hono-bun.md", "node": "hono-node.md" },
|
|
29
|
-
"nest": "nest.md"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
```
|
|
19
|
+
## How Instructions Are Served
|
|
35
20
|
|
|
36
|
-
|
|
37
|
-
1. **Base docs** - Always loaded (service.md, code-style.md, testing.md)
|
|
38
|
-
2. **Framework-specific** - Based on `serviceType` and `packageManager`
|
|
39
|
-
3. **Workspace instructions** - every one of `CLAUDE.md`, `AGENTS.md`, `.github/copilot-instructions.md`, `docs/ai-guidelines.md` that the workspace carries. Missing files are skipped; the token budget is split across the ones found.
|
|
21
|
+
The pf MCP server lists the `.md` files in this directory as the resource `docs://generators` and serves each one as `docs://generators/<name>` (`packages/pf-mcp/src/resources/generator-docs.ts`; the directory is read by `listGeneratorDocs` in `cli/src/core/facade/index.ts`). The build copies the directory to `bin/docs/generators` (`build:copy` in `package.json`). An agent reads the file it needs; nothing is merged or loaded in a fixed order.
|
|
40
22
|
|
|
41
23
|
## Adding New Generators
|
|
42
24
|
|
|
43
25
|
To add instructions for a new framework:
|
|
44
26
|
|
|
45
27
|
1. Create `<framework>.md` in this directory
|
|
46
|
-
2.
|
|
47
|
-
3. Follow the existing format from `hono-bun.md` or `nest.md`
|
|
48
|
-
|
|
49
|
-
## Template Variables
|
|
50
|
-
|
|
51
|
-
The following variables are replaced at runtime:
|
|
52
|
-
|
|
53
|
-
| Variable | Description |
|
|
54
|
-
|----------|-------------|
|
|
55
|
-
| `{{scope}}` | Package scope (e.g., `@orderboss`) |
|
|
56
|
-
| `{{AVAILABLE_CONTRACTS}}` | Auto-generated list of existing contracts |
|
|
28
|
+
2. Follow the existing format from `hono-bun.md` or `nest.md`
|
|
@@ -53,7 +53,7 @@ Rules for working with the CloudEvents package and event handlers.
|
|
|
53
53
|
|
|
54
54
|
## NATS Migrations
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
Stream migrations live in `infra/migrations/`.
|
|
57
57
|
|
|
58
58
|
## Publishing Checklist
|
|
59
59
|
|
|
@@ -61,7 +61,6 @@ See [Infrastructure](infrastructure.md) for migration conventions (`infra/migrat
|
|
|
61
61
|
2. Update `CHANGELOG.md`
|
|
62
62
|
3. **Push to remote before publishing** — npm publish reads from the repo
|
|
63
63
|
4. Trigger workflow: `gh workflow run publish-packages.yml -f package=cloudevents`
|
|
64
|
-
5. After publishing: the `sync-templates` pre-commit hook auto-updates downstream `package.json` references
|
|
65
64
|
|
|
66
65
|
## Distributed Tracing
|
|
67
66
|
|
|
@@ -25,7 +25,7 @@ You are assisting in TypeScript-first monorepos using modern TypeScript tooling
|
|
|
25
25
|
|
|
26
26
|
- **Test consumers**: When changing a shared package (`packages/*`), run tests in **all consuming services**, not just the package itself. Changes to shared code have blast radius.
|
|
27
27
|
- **Push before publish**: Always push commits to remote before triggering npm publish workflows. The CI reads from the repo, not your local machine.
|
|
28
|
-
- **Pre-commit hooks
|
|
28
|
+
- **Pre-commit hooks**: Never bypass them with `--no-verify`.
|
|
29
29
|
- **Capture lessons**: When a convention or pitfall emerges, propose updating a scoped `.claude/rules/` file. Ask before creating new files. Keep `CLAUDE.md` project-agnostic; domain-specific rules go in scoped files with `paths:`.
|
|
30
30
|
|
|
31
31
|
## Monorepo Awareness
|
|
@@ -52,6 +52,10 @@ regardless of which file is open, because that cost is paid on every turn.
|
|
|
52
52
|
Code style and testing conventions are not rules here: the `pf` generators carry their own, and they
|
|
53
53
|
load whenever the generator writes code.
|
|
54
54
|
|
|
55
|
+
## Agent Kit
|
|
56
|
+
|
|
57
|
+
Skills, agents and general rules under `.claude/` come from `@crossdelta/agent-kit` and are listed in `.claude/agent-kit.lock.json`. Project values (languages, plan directory, models, checks) live in `.claude/agent-kit.json`. Update with `pf agents sync`; a conflicting local edit lands as `<file>.kit-new`. Put project knowledge into `.claude/project/<skill>.md` or a rule beside `.claude/rules/kit/`, so the kit files stay updatable. `pf plans` shows the plan progress of the current sprint.
|
|
58
|
+
|
|
55
59
|
## Key Packages
|
|
56
60
|
|
|
57
61
|
Installed from npm, not vendored into this repo. Read their APIs in `node_modules/`, not from memory.
|
|
@@ -17,6 +17,14 @@
|
|
|
17
17
|
"commands": {
|
|
18
18
|
"pulumi": {
|
|
19
19
|
"cwd": "infra"
|
|
20
|
+
},
|
|
21
|
+
"agents": {
|
|
22
|
+
"command": "bunx @crossdelta/agent-kit",
|
|
23
|
+
"description": "Agent kit: init, sync, check, plans"
|
|
24
|
+
},
|
|
25
|
+
"plans": {
|
|
26
|
+
"command": "bunx @crossdelta/agent-kit plans",
|
|
27
|
+
"description": "Live view of the sprint's lanes and their plan progress"
|
|
20
28
|
}
|
|
21
29
|
},
|
|
22
30
|
"paths": {
|
|
@@ -43,6 +51,7 @@
|
|
|
43
51
|
},
|
|
44
52
|
"devDependencies": {
|
|
45
53
|
"@biomejs/biome": "2.3.7",
|
|
54
|
+
"@crossdelta/agent-kit": "latest",
|
|
46
55
|
"@crossdelta/platform-sdk": "latest",
|
|
47
56
|
"dotenv-cli": "^8.0.0",
|
|
48
57
|
"turbo": "^2.5.6"
|
|
@@ -89,7 +89,7 @@ Contracts are **auto-generated** when you create event handlers:
|
|
|
89
89
|
|
|
90
90
|
```bash
|
|
91
91
|
# 1. Create service with event handler
|
|
92
|
-
pf new hono-micro notifications
|
|
92
|
+
pf new hono-micro notifications
|
|
93
93
|
|
|
94
94
|
# 2. Add event (creates contract, mock, handler)
|
|
95
95
|
pf cloudevents add order.created --service services/notifications
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crossdelta/platform-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"description": "Platform toolkit for event-driven microservices — keeping code and infrastructure in lockstep.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -65,42 +65,6 @@
|
|
|
65
65
|
"name": "Marcelle Hövelmanns",
|
|
66
66
|
"email": "mail@hoevelmanns.io"
|
|
67
67
|
},
|
|
68
|
-
"generatorConfig": {
|
|
69
|
-
"docs": {
|
|
70
|
-
"base": [
|
|
71
|
-
"service.md",
|
|
72
|
-
"code-style.md",
|
|
73
|
-
"testing.md"
|
|
74
|
-
],
|
|
75
|
-
"frameworks": {
|
|
76
|
-
"hono": {
|
|
77
|
-
"bun": "hono-bun.md",
|
|
78
|
-
"node": "hono-node.md"
|
|
79
|
-
},
|
|
80
|
-
"nest": "nest.md"
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
"serviceTypes": {
|
|
84
|
-
"hono": {
|
|
85
|
-
"commandType": "hono-micro",
|
|
86
|
-
"entryPoint": "src/index.ts",
|
|
87
|
-
"skipFiles": [
|
|
88
|
-
"package.json",
|
|
89
|
-
"tsconfig.json",
|
|
90
|
-
"Dockerfile"
|
|
91
|
-
]
|
|
92
|
-
},
|
|
93
|
-
"nest": {
|
|
94
|
-
"commandType": "nest-micro",
|
|
95
|
-
"entryPoint": "src/main.ts",
|
|
96
|
-
"skipFiles": [
|
|
97
|
-
"package.json",
|
|
98
|
-
"tsconfig.json",
|
|
99
|
-
"Dockerfile"
|
|
100
|
-
]
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
68
|
"scripts": {
|
|
105
69
|
"dev": "tsup --watch",
|
|
106
70
|
"build: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/",
|
|
@@ -115,15 +79,11 @@
|
|
|
115
79
|
},
|
|
116
80
|
"schematics": "./dist/schematics/collection.json",
|
|
117
81
|
"dependencies": {
|
|
118
|
-
"@ai-sdk/anthropic": "^2.0.53",
|
|
119
|
-
"@ai-sdk/openai": "^2.0.79",
|
|
120
82
|
"@angular-devkit/core": "^21.0.0",
|
|
121
83
|
"@crossdelta/cloudevents": "^0.10.0",
|
|
122
84
|
"@crossdelta/flowcore": "^0.1.2",
|
|
123
85
|
"@faker-js/faker": "^9.8.0",
|
|
124
|
-
"@inquirer/prompts": "^7.5.0",
|
|
125
86
|
"@listr2/prompt-adapter-enquirer": "^2.0.15",
|
|
126
|
-
"ai": "^5.0.108",
|
|
127
87
|
"chalk": "^5.4.1",
|
|
128
88
|
"chokidar": "^5.0.0",
|
|
129
89
|
"cli-table3": "^0.6.5",
|
|
@@ -136,11 +96,9 @@
|
|
|
136
96
|
"handlebars": "^4.7.8",
|
|
137
97
|
"jiti": "^2.6.1",
|
|
138
98
|
"listr2": "^8.3.2",
|
|
139
|
-
"ora": "^8.2.0",
|
|
140
99
|
"package-up": "^5.0.0",
|
|
141
100
|
"rimraf": "^6.1.2",
|
|
142
101
|
"terminal-link": "^4.0.0",
|
|
143
|
-
"ts-morph": "^27.0.0",
|
|
144
102
|
"zod": "^4.0.0",
|
|
145
103
|
"@crossdelta/infrastructure": "^0.16.0"
|
|
146
104
|
},
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
-
"title": "Service Types Configuration",
|
|
4
|
-
"description": "Configuration for different microservice types in the Platform SDK",
|
|
5
|
-
"type": "object",
|
|
6
|
-
"properties": {
|
|
7
|
-
"serviceTypes": {
|
|
8
|
-
"type": "object",
|
|
9
|
-
"additionalProperties": {
|
|
10
|
-
"type": "object",
|
|
11
|
-
"required": ["commandType", "entryPoint", "skipFiles"],
|
|
12
|
-
"properties": {
|
|
13
|
-
"commandType": {
|
|
14
|
-
"type": "string",
|
|
15
|
-
"description": "CLI command type for scaffolding (e.g., 'hono-micro', 'nest-micro')"
|
|
16
|
-
},
|
|
17
|
-
"entryPoint": {
|
|
18
|
-
"type": "string",
|
|
19
|
-
"description": "Relative path to the service entry point file"
|
|
20
|
-
},
|
|
21
|
-
"skipFiles": {
|
|
22
|
-
"type": "array",
|
|
23
|
-
"description": "Files that should not be overwritten by AI generation",
|
|
24
|
-
"items": {
|
|
25
|
-
"type": "string"
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"required": ["serviceTypes"]
|
|
33
|
-
}
|