@specverse/engines 6.0.2 → 6.0.5
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/dist/ai/behavior-ai-service.d.ts.map +1 -1
- package/dist/ai/behavior-ai-service.js +18 -6
- package/dist/ai/behavior-ai-service.js.map +1 -1
- package/dist/ai/prompt-loader.d.ts +7 -3
- package/dist/ai/prompt-loader.d.ts.map +1 -1
- package/dist/ai/prompt-loader.js +67 -69
- package/dist/ai/prompt-loader.js.map +1 -1
- package/dist/inference/core/specly-converter.d.ts.map +1 -1
- package/dist/inference/core/specly-converter.js +8 -0
- package/dist/inference/core/specly-converter.js.map +1 -1
- package/dist/inference/core/types.d.ts +1 -0
- package/dist/inference/core/types.d.ts.map +1 -1
- package/dist/inference/core/types.js.map +1 -1
- package/dist/inference/index.d.ts.map +1 -1
- package/dist/inference/index.js +13 -2
- package/dist/inference/index.js.map +1 -1
- package/dist/inference/logical/generators/controller-generator.d.ts.map +1 -1
- package/dist/inference/logical/generators/controller-generator.js +5 -0
- package/dist/inference/logical/generators/controller-generator.js.map +1 -1
- package/dist/inference/logical/logical-engine.d.ts.map +1 -1
- package/dist/inference/logical/logical-engine.js +3 -0
- package/dist/inference/logical/logical-engine.js.map +1 -1
- package/dist/libs/instance-factories/cli/templates/commander/command-generator.js +17 -6
- package/dist/libs/instance-factories/tools/templates/mcp/mcp-server-generator.js +8 -7
- package/libs/instance-factories/cli/templates/commander/command-generator.ts +17 -6
- package/libs/instance-factories/tools/templates/mcp/mcp-server-generator.ts +10 -9
- package/package.json +2 -1
- package/assets/examples/manifests/01-simple-default-mappings.yaml +0 -36
- package/assets/examples/manifests/02-capability-mappings.yaml +0 -55
- package/assets/examples/manifests/03-hybrid-mappings.yaml +0 -109
- package/assets/examples/manifests/README.md +0 -245
- package/assets/examples/manifests/backend-only.yaml +0 -43
- package/assets/examples/manifests/blog-api.md +0 -78
- package/assets/examples/manifests/blog-api.specly +0 -79
- package/assets/examples/manifests/frontend-only.yaml +0 -24
- package/assets/examples/manifests/fullstack-app.yaml +0 -42
- package/assets/examples/manifests/fullstack-monorepo.yaml +0 -59
- package/assets/examples-decomposed/cloud-native-manifest.example.yaml +0 -8
- package/assets/examples-decomposed/cloud-native-manifest.md +0 -379
- package/assets/examples-decomposed/cloud-native-manifest.specly +0 -60
- package/assets/examples-decomposed/docker-compose-manifest.example.yaml +0 -8
- package/assets/examples-decomposed/docker-compose-manifest.md +0 -326
- package/assets/examples-decomposed/docker-compose-manifest.specly +0 -40
- package/assets/examples-decomposed/kubernetes-deployment-manifest.example.yaml +0 -8
- package/assets/examples-decomposed/kubernetes-deployment-manifest.md +0 -237
- package/assets/examples-decomposed/kubernetes-deployment-manifest.specly +0 -41
- package/assets/examples-inference/inference-engine-demo.example.yaml +0 -8
- package/assets/examples-inference/inference-engine-demo.md +0 -574
- package/assets/examples-inference/inference-engine-demo.specly +0 -216
- package/assets/prompts/core/README.md +0 -319
- package/assets/prompts/core/standard/default/analyse.prompt.yaml +0 -531
- package/assets/prompts/core/standard/default/app-demo.prompt.yaml +0 -233
- package/assets/prompts/core/standard/default/behavior.prompt.yaml +0 -157
- package/assets/prompts/core/standard/default/create.prompt.yaml +0 -426
- package/assets/prompts/core/standard/default/materialise.prompt.yaml +0 -844
- package/assets/prompts/core/standard/default/realize.prompt.yaml +0 -611
- package/assets/prompts/core/standard/v9/analyse.prompt.yaml +0 -531
- package/assets/prompts/core/standard/v9/app-demo.prompt.yaml +0 -233
- package/assets/prompts/core/standard/v9/behavior.prompt.yaml +0 -157
- package/assets/prompts/core/standard/v9/create.prompt.yaml +0 -426
- package/assets/prompts/core/standard/v9/materialise.prompt.yaml +0 -844
- package/assets/prompts/core/standard/v9/realize.prompt.yaml +0 -611
- package/assets/templates/default/specs/main.specly +0 -65
|
@@ -1,611 +0,0 @@
|
|
|
1
|
-
name: realize
|
|
2
|
-
version: 9.0.0
|
|
3
|
-
description: Generate environment-appropriate deployment configurations from SpecVerse Deployments layer using instance factories
|
|
4
|
-
category: infrastructure
|
|
5
|
-
tags:
|
|
6
|
-
- deployment
|
|
7
|
-
- infrastructure
|
|
8
|
-
- kubernetes
|
|
9
|
-
- docker
|
|
10
|
-
- environment-aware
|
|
11
|
-
- operational-policies
|
|
12
|
-
|
|
13
|
-
metadata:
|
|
14
|
-
author: SpecVerse Team
|
|
15
|
-
lastUpdated: 2025-11-27
|
|
16
|
-
compatibleWith:
|
|
17
|
-
- specverse: ">=3.4.9"
|
|
18
|
-
breaking_changes_from_v8:
|
|
19
|
-
- Now focuses specifically on Deployments layer
|
|
20
|
-
- Uses instance factories for infrastructure code generation
|
|
21
|
-
- Separates operational policies from logical structure
|
|
22
|
-
- Supports schema extensions (operational policies, health checks, resources, etc)
|
|
23
|
-
- Environment-driven complexity adaptation
|
|
24
|
-
|
|
25
|
-
system:
|
|
26
|
-
role: |
|
|
27
|
-
You are an expert infrastructure generator that creates environment-appropriate deployment configurations from SpecVerse Deployments specifications.
|
|
28
|
-
|
|
29
|
-
context: |
|
|
30
|
-
## Core Philosophy: Deployments Layer
|
|
31
|
-
|
|
32
|
-
The **Deployments layer** in SpecVerse defines:
|
|
33
|
-
- **WHERE** components run (environment: dev, staging, production, enterprise)
|
|
34
|
-
- **HOW THEY BEHAVE** in that environment (operational policies)
|
|
35
|
-
- **OPERATIONAL CHARACTERISTICS**: security, performance, reliability, scalability
|
|
36
|
-
|
|
37
|
-
The Deployments layer is SEPARATE from:
|
|
38
|
-
- **Components** (pure logical structure - technology-agnostic)
|
|
39
|
-
- **Manifests** (technology selection via instance factories)
|
|
40
|
-
|
|
41
|
-
## Your Task
|
|
42
|
-
|
|
43
|
-
Given a SpecVerse specification with a `deployments` section, generate complete infrastructure configurations that:
|
|
44
|
-
1. **Implement all operational policies** from the Deployments layer
|
|
45
|
-
2. **Adapt to target environment** (dev/test/staging/production/enterprise)
|
|
46
|
-
3. **Use instance factories** for infrastructure-as-code generation
|
|
47
|
-
4. **Ensure production-readiness** with proper observability, security, reliability
|
|
48
|
-
|
|
49
|
-
## Step 1: Parse Deployments Layer
|
|
50
|
-
|
|
51
|
-
Read the `deployments` section for operational policies:
|
|
52
|
-
|
|
53
|
-
### Database Deployments
|
|
54
|
-
```yaml
|
|
55
|
-
deployments:
|
|
56
|
-
database:
|
|
57
|
-
engine: postgresql
|
|
58
|
-
version: "15"
|
|
59
|
-
resources:
|
|
60
|
-
limits: {cpu: "2", memory: "4Gi"}
|
|
61
|
-
requests: {cpu: "1", memory: "2Gi"}
|
|
62
|
-
storage:
|
|
63
|
-
size: "100Gi"
|
|
64
|
-
storageClass: "fast-ssd"
|
|
65
|
-
backup:
|
|
66
|
-
enabled: true
|
|
67
|
-
schedule: "0 2 * * *"
|
|
68
|
-
retention: 30
|
|
69
|
-
highAvailability:
|
|
70
|
-
replicas: 3
|
|
71
|
-
replicationMode: "async"
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### Service Deployments
|
|
75
|
-
```yaml
|
|
76
|
-
deployments:
|
|
77
|
-
services:
|
|
78
|
-
- name: TaskService
|
|
79
|
-
replicas: 3
|
|
80
|
-
security:
|
|
81
|
-
authentication: {required: true, method: "jwt"}
|
|
82
|
-
authorization: {enabled: true, rbac: true}
|
|
83
|
-
encryption: {inTransit: true, atRest: true}
|
|
84
|
-
caching:
|
|
85
|
-
enabled: true
|
|
86
|
-
strategy: "write-through"
|
|
87
|
-
ttl: 300
|
|
88
|
-
backend: "redis"
|
|
89
|
-
operations:
|
|
90
|
-
- operation: "createTask"
|
|
91
|
-
policies:
|
|
92
|
-
transaction: {isolation: "READ_COMMITTED", timeout: 5000}
|
|
93
|
-
retry: {maxAttempts: 3, backoff: "exponential"}
|
|
94
|
-
timeout: 10000
|
|
95
|
-
resources:
|
|
96
|
-
limits: {cpu: "1", memory: "2Gi"}
|
|
97
|
-
requests: {cpu: "500m", memory: "1Gi"}
|
|
98
|
-
healthChecks:
|
|
99
|
-
readiness: {path: "/health/ready", interval: 10}
|
|
100
|
-
liveness: {path: "/health/live", interval: 30}
|
|
101
|
-
autoscaling:
|
|
102
|
-
minReplicas: 2
|
|
103
|
-
maxReplicas: 10
|
|
104
|
-
targetCPU: 70
|
|
105
|
-
targetMemory: 80
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
### Controller Deployments
|
|
109
|
-
```yaml
|
|
110
|
-
deployments:
|
|
111
|
-
controllers:
|
|
112
|
-
- name: TaskController
|
|
113
|
-
rateLimit:
|
|
114
|
-
enabled: true
|
|
115
|
-
requestsPerMinute: 100
|
|
116
|
-
burstSize: 20
|
|
117
|
-
validation:
|
|
118
|
-
request: true
|
|
119
|
-
response: true
|
|
120
|
-
strict: true
|
|
121
|
-
timeout: 30000
|
|
122
|
-
operations:
|
|
123
|
-
- operation: "createTask"
|
|
124
|
-
rateLimit: {requestsPerMinute: 10}
|
|
125
|
-
timeout: 15000
|
|
126
|
-
healthChecks:
|
|
127
|
-
readiness: {path: "/api/health/ready", interval: 10}
|
|
128
|
-
liveness: {path: "/api/health/live", interval: 30}
|
|
129
|
-
resources:
|
|
130
|
-
limits: {cpu: "500m", memory: "1Gi"}
|
|
131
|
-
requests: {cpu: "250m", memory: "512Mi"}
|
|
132
|
-
networkPolicy:
|
|
133
|
-
ingress:
|
|
134
|
-
- from: [{namespaceSelector: {matchLabels: {name: "frontend"}}}]
|
|
135
|
-
ports: [{port: 3000, protocol: "TCP"}]
|
|
136
|
-
egress:
|
|
137
|
-
- to: [{namespaceSelector: {matchLabels: {name: "backend"}}}]
|
|
138
|
-
ports: [{port: 5432, protocol: "TCP"}]
|
|
139
|
-
autoscaling:
|
|
140
|
-
minReplicas: 3
|
|
141
|
-
maxReplicas: 20
|
|
142
|
-
targetCPU: 60
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
### View Deployments
|
|
146
|
-
```yaml
|
|
147
|
-
deployments:
|
|
148
|
-
views:
|
|
149
|
-
- name: TaskListView
|
|
150
|
-
routeGuards:
|
|
151
|
-
- guard: "AuthGuard"
|
|
152
|
-
apply: "beforeEnter"
|
|
153
|
-
- guard: "RoleGuard"
|
|
154
|
-
roles: ["admin", "user"]
|
|
155
|
-
caching:
|
|
156
|
-
enabled: true
|
|
157
|
-
strategy: "stale-while-revalidate"
|
|
158
|
-
ttl: 60
|
|
159
|
-
prefetch:
|
|
160
|
-
enabled: true
|
|
161
|
-
routes: ["taskDetails"]
|
|
162
|
-
resources:
|
|
163
|
-
limits: {cpu: "200m", memory: "512Mi"}
|
|
164
|
-
requests: {cpu: "100m", memory: "256Mi"}
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
### Communication Deployments
|
|
168
|
-
```yaml
|
|
169
|
-
deployments:
|
|
170
|
-
communication:
|
|
171
|
-
- name: TaskEventBus
|
|
172
|
-
type: "message-queue"
|
|
173
|
-
events:
|
|
174
|
-
broker: "rabbitmq"
|
|
175
|
-
durable: true
|
|
176
|
-
autoDelete: false
|
|
177
|
-
consumer:
|
|
178
|
-
concurrency: 5
|
|
179
|
-
prefetchCount: 10
|
|
180
|
-
retryPolicy:
|
|
181
|
-
maxAttempts: 3
|
|
182
|
-
backoff: "exponential"
|
|
183
|
-
deadLetterQueue: "task-events-dlq"
|
|
184
|
-
resources:
|
|
185
|
-
limits: {cpu: "500m", memory: "1Gi"}
|
|
186
|
-
requests: {cpu: "250m", memory: "512Mi"}
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
## Step 2: Environment Adaptation
|
|
190
|
-
|
|
191
|
-
Adapt operational policies based on target environment:
|
|
192
|
-
|
|
193
|
-
### Development Environment
|
|
194
|
-
- **Security**: Minimal (auth optional, no encryption)
|
|
195
|
-
- **Resources**: Small (100m CPU, 256Mi memory)
|
|
196
|
-
- **Replicas**: 1
|
|
197
|
-
- **Logging**: Verbose (DEBUG level)
|
|
198
|
-
- **Caching**: Disabled or minimal
|
|
199
|
-
- **Rate Limiting**: Disabled
|
|
200
|
-
- **Health Checks**: Simple, long intervals
|
|
201
|
-
- **Autoscaling**: Disabled
|
|
202
|
-
- **Networking**: Permissive policies
|
|
203
|
-
|
|
204
|
-
### Staging Environment
|
|
205
|
-
- **Security**: Production-like (auth required, encryption in transit)
|
|
206
|
-
- **Resources**: Medium (250m-500m CPU, 512Mi-1Gi memory)
|
|
207
|
-
- **Replicas**: 2
|
|
208
|
-
- **Logging**: Moderate (INFO level)
|
|
209
|
-
- **Caching**: Enabled with short TTL
|
|
210
|
-
- **Rate Limiting**: Lenient limits for testing
|
|
211
|
-
- **Health Checks**: Production-like, moderate intervals
|
|
212
|
-
- **Autoscaling**: Enabled with conservative thresholds
|
|
213
|
-
- **Networking**: Restrictive policies
|
|
214
|
-
|
|
215
|
-
### Production Environment
|
|
216
|
-
- **Security**: Full (auth required, encryption in transit and at rest, mTLS)
|
|
217
|
-
- **Resources**: Optimized (as specified in deployments)
|
|
218
|
-
- **Replicas**: HA (3+)
|
|
219
|
-
- **Logging**: Minimal (WARN/ERROR level)
|
|
220
|
-
- **Caching**: Enabled with optimal TTL
|
|
221
|
-
- **Rate Limiting**: Strict limits
|
|
222
|
-
- **Health Checks**: Fine-tuned intervals
|
|
223
|
-
- **Autoscaling**: Enabled with aggressive thresholds
|
|
224
|
-
- **Networking**: Strict zero-trust policies
|
|
225
|
-
- **Backup**: Automated with retention
|
|
226
|
-
- **Monitoring**: Full observability stack
|
|
227
|
-
|
|
228
|
-
### Enterprise Environment
|
|
229
|
-
- **Security**: Enhanced (mTLS, encryption at rest, audit logging, compliance)
|
|
230
|
-
- **Resources**: Over-provisioned for guaranteed performance
|
|
231
|
-
- **Replicas**: Multi-region HA (5+ per region)
|
|
232
|
-
- **Logging**: Comprehensive audit trail
|
|
233
|
-
- **Caching**: Multi-tier with geo-distribution
|
|
234
|
-
- **Rate Limiting**: Per-tenant limits
|
|
235
|
-
- **Health Checks**: Advanced with custom metrics
|
|
236
|
-
- **Autoscaling**: Predictive scaling with ML
|
|
237
|
-
- **Networking**: Multi-region, geo-routing, DDoS protection
|
|
238
|
-
- **Backup**: Multi-region with point-in-time recovery
|
|
239
|
-
- **Monitoring**: Advanced APM, distributed tracing, SLO tracking
|
|
240
|
-
|
|
241
|
-
## Step 3: Use Instance Factories for Infrastructure Generation
|
|
242
|
-
|
|
243
|
-
Read manifest's instance factories for infrastructure code generation:
|
|
244
|
-
|
|
245
|
-
### Kubernetes Instance Factory
|
|
246
|
-
```yaml
|
|
247
|
-
manifests:
|
|
248
|
-
instanceFactories:
|
|
249
|
-
- name: kubernetes-deployment
|
|
250
|
-
type: infrastructure
|
|
251
|
-
templates:
|
|
252
|
-
deployment: |
|
|
253
|
-
apiVersion: apps/v1
|
|
254
|
-
kind: Deployment
|
|
255
|
-
metadata:
|
|
256
|
-
name: {{serviceName}}
|
|
257
|
-
labels:
|
|
258
|
-
app: {{serviceName}}
|
|
259
|
-
version: {{version}}
|
|
260
|
-
spec:
|
|
261
|
-
replicas: {{replicas}}
|
|
262
|
-
selector:
|
|
263
|
-
matchLabels:
|
|
264
|
-
app: {{serviceName}}
|
|
265
|
-
template:
|
|
266
|
-
metadata:
|
|
267
|
-
labels:
|
|
268
|
-
app: {{serviceName}}
|
|
269
|
-
spec:
|
|
270
|
-
containers:
|
|
271
|
-
- name: {{serviceName}}
|
|
272
|
-
image: {{image}}
|
|
273
|
-
resources:
|
|
274
|
-
limits:
|
|
275
|
-
cpu: {{resources.limits.cpu}}
|
|
276
|
-
memory: {{resources.limits.memory}}
|
|
277
|
-
requests:
|
|
278
|
-
cpu: {{resources.requests.cpu}}
|
|
279
|
-
memory: {{resources.requests.memory}}
|
|
280
|
-
readinessProbe:
|
|
281
|
-
httpGet:
|
|
282
|
-
path: {{healthChecks.readiness.path}}
|
|
283
|
-
port: {{port}}
|
|
284
|
-
initialDelaySeconds: 10
|
|
285
|
-
periodSeconds: {{healthChecks.readiness.interval}}
|
|
286
|
-
livenessProbe:
|
|
287
|
-
httpGet:
|
|
288
|
-
path: {{healthChecks.liveness.path}}
|
|
289
|
-
port: {{port}}
|
|
290
|
-
initialDelaySeconds: 30
|
|
291
|
-
periodSeconds: {{healthChecks.liveness.interval}}
|
|
292
|
-
service: |
|
|
293
|
-
apiVersion: v1
|
|
294
|
-
kind: Service
|
|
295
|
-
metadata:
|
|
296
|
-
name: {{serviceName}}
|
|
297
|
-
spec:
|
|
298
|
-
selector:
|
|
299
|
-
app: {{serviceName}}
|
|
300
|
-
ports:
|
|
301
|
-
- protocol: TCP
|
|
302
|
-
port: {{port}}
|
|
303
|
-
targetPort: {{targetPort}}
|
|
304
|
-
hpa: |
|
|
305
|
-
apiVersion: autoscaling/v2
|
|
306
|
-
kind: HorizontalPodAutoscaler
|
|
307
|
-
metadata:
|
|
308
|
-
name: {{serviceName}}-hpa
|
|
309
|
-
spec:
|
|
310
|
-
scaleTargetRef:
|
|
311
|
-
apiVersion: apps/v1
|
|
312
|
-
kind: Deployment
|
|
313
|
-
name: {{serviceName}}
|
|
314
|
-
minReplicas: {{autoscaling.minReplicas}}
|
|
315
|
-
maxReplicas: {{autoscaling.maxReplicas}}
|
|
316
|
-
metrics:
|
|
317
|
-
- type: Resource
|
|
318
|
-
resource:
|
|
319
|
-
name: cpu
|
|
320
|
-
target:
|
|
321
|
-
type: Utilization
|
|
322
|
-
averageUtilization: {{autoscaling.targetCPU}}
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
### Docker Compose Instance Factory
|
|
326
|
-
```yaml
|
|
327
|
-
manifests:
|
|
328
|
-
instanceFactories:
|
|
329
|
-
- name: docker-compose
|
|
330
|
-
type: infrastructure
|
|
331
|
-
templates:
|
|
332
|
-
service: |
|
|
333
|
-
{{serviceName}}:
|
|
334
|
-
image: {{image}}
|
|
335
|
-
container_name: {{serviceName}}
|
|
336
|
-
restart: unless-stopped
|
|
337
|
-
environment:
|
|
338
|
-
{{#each envVars}}
|
|
339
|
-
- {{key}}={{value}}
|
|
340
|
-
{{/each}}
|
|
341
|
-
ports:
|
|
342
|
-
- "{{port}}:{{targetPort}}"
|
|
343
|
-
volumes:
|
|
344
|
-
{{#each volumes}}
|
|
345
|
-
- {{source}}:{{target}}
|
|
346
|
-
{{/each}}
|
|
347
|
-
healthcheck:
|
|
348
|
-
test: ["CMD", "curl", "-f", "http://localhost:{{port}}{{healthCheck.path}}"]
|
|
349
|
-
interval: {{healthCheck.interval}}s
|
|
350
|
-
timeout: 5s
|
|
351
|
-
retries: 3
|
|
352
|
-
deploy:
|
|
353
|
-
resources:
|
|
354
|
-
limits:
|
|
355
|
-
cpus: '{{resources.limits.cpu}}'
|
|
356
|
-
memory: {{resources.limits.memory}}
|
|
357
|
-
reservations:
|
|
358
|
-
cpus: '{{resources.requests.cpu}}'
|
|
359
|
-
memory: {{resources.requests.memory}}
|
|
360
|
-
```
|
|
361
|
-
|
|
362
|
-
## Step 4: Generate Infrastructure Configurations
|
|
363
|
-
|
|
364
|
-
For each deployment instance:
|
|
365
|
-
|
|
366
|
-
1. **Identify target infrastructure** from manifest (Kubernetes, Docker, AWS, Azure, GCP)
|
|
367
|
-
2. **Read instance factory template** for that infrastructure
|
|
368
|
-
3. **Fill template with**:
|
|
369
|
-
- Deployment policies (replicas, resources, health checks)
|
|
370
|
-
- Security policies (auth, encryption, network policies)
|
|
371
|
-
- Performance policies (caching, rate limiting)
|
|
372
|
-
- Reliability policies (retries, circuit breakers, timeouts)
|
|
373
|
-
- Environment-specific adaptations
|
|
374
|
-
4. **Generate complete configuration files**
|
|
375
|
-
|
|
376
|
-
### Example: Service Deployment → Kubernetes
|
|
377
|
-
|
|
378
|
-
Input (from deployments):
|
|
379
|
-
```yaml
|
|
380
|
-
deployments:
|
|
381
|
-
services:
|
|
382
|
-
- name: TaskService
|
|
383
|
-
replicas: 3
|
|
384
|
-
resources:
|
|
385
|
-
limits: {cpu: "1", memory: "2Gi"}
|
|
386
|
-
healthChecks:
|
|
387
|
-
readiness: {path: "/health/ready", interval: 10}
|
|
388
|
-
autoscaling:
|
|
389
|
-
minReplicas: 2
|
|
390
|
-
maxReplicas: 10
|
|
391
|
-
targetCPU: 70
|
|
392
|
-
```
|
|
393
|
-
|
|
394
|
-
Output (Kubernetes manifests):
|
|
395
|
-
```yaml
|
|
396
|
-
# deployment.yaml
|
|
397
|
-
# service.yaml
|
|
398
|
-
# hpa.yaml
|
|
399
|
-
# networkpolicy.yaml (if specified)
|
|
400
|
-
# configmap.yaml (for environment variables)
|
|
401
|
-
# secret.yaml (for sensitive data)
|
|
402
|
-
```
|
|
403
|
-
|
|
404
|
-
## Step 5: Observability Stack
|
|
405
|
-
|
|
406
|
-
Generate observability configurations based on deployment policies:
|
|
407
|
-
|
|
408
|
-
### Logging
|
|
409
|
-
- **Development**: Console output, DEBUG level
|
|
410
|
-
- **Production**: Structured JSON logs, WARN/ERROR level, centralized logging (ELK, Loki)
|
|
411
|
-
|
|
412
|
-
### Metrics
|
|
413
|
-
- **Service metrics**: Request rate, error rate, latency (RED metrics)
|
|
414
|
-
- **Resource metrics**: CPU, memory, disk, network
|
|
415
|
-
- **Business metrics**: From operational policies (cache hit rate, retry count, circuit breaker state)
|
|
416
|
-
|
|
417
|
-
### Tracing
|
|
418
|
-
- **Distributed tracing**: Jaeger, Zipkin, OpenTelemetry
|
|
419
|
-
- **Transaction tracing**: From transaction policies
|
|
420
|
-
- **Retry tracing**: Track retry attempts and backoff
|
|
421
|
-
|
|
422
|
-
### Alerts
|
|
423
|
-
- **Resource alerts**: CPU/memory thresholds
|
|
424
|
-
- **Availability alerts**: Health check failures, pod restarts
|
|
425
|
-
- **Performance alerts**: Latency SLOs, error rate thresholds
|
|
426
|
-
- **Security alerts**: Auth failures, rate limit violations
|
|
427
|
-
|
|
428
|
-
## Step 6: Security Configuration
|
|
429
|
-
|
|
430
|
-
Apply security policies from deployments:
|
|
431
|
-
|
|
432
|
-
### Authentication & Authorization
|
|
433
|
-
- Generate: AuthN/AuthZ middleware configurations
|
|
434
|
-
- From: `deployments.services[x].security.authentication`, `.authorization`
|
|
435
|
-
- Example: JWT validation, RBAC policies, OAuth2 client configs
|
|
436
|
-
|
|
437
|
-
### Encryption
|
|
438
|
-
- Generate: TLS certificates, encryption key management
|
|
439
|
-
- From: `deployments.services[x].security.encryption.inTransit`, `.atRest`
|
|
440
|
-
- Example: mTLS certificates, encryption-at-rest key rotation
|
|
441
|
-
|
|
442
|
-
### Network Security
|
|
443
|
-
- Generate: Network policies, firewall rules, ingress/egress rules
|
|
444
|
-
- From: `deployments.controllers[x].networkPolicy`
|
|
445
|
-
- Example: Kubernetes NetworkPolicy, AWS Security Groups
|
|
446
|
-
|
|
447
|
-
## Step 7: Performance Configuration
|
|
448
|
-
|
|
449
|
-
Apply performance policies from deployments:
|
|
450
|
-
|
|
451
|
-
### Caching
|
|
452
|
-
- Generate: Cache configurations (Redis, Memcached)
|
|
453
|
-
- From: `deployments.services[x].caching`
|
|
454
|
-
- Example: Redis cluster config, cache invalidation rules
|
|
455
|
-
|
|
456
|
-
### Rate Limiting
|
|
457
|
-
- Generate: Rate limiter configurations
|
|
458
|
-
- From: `deployments.controllers[x].rateLimit`
|
|
459
|
-
- Example: NGINX rate limiting, API Gateway throttling
|
|
460
|
-
|
|
461
|
-
### Resource Optimization
|
|
462
|
-
- Generate: Resource quotas, limit ranges
|
|
463
|
-
- From: `deployments.*.resources`
|
|
464
|
-
- Example: Kubernetes ResourceQuota, LimitRange
|
|
465
|
-
|
|
466
|
-
## Step 8: Reliability Configuration
|
|
467
|
-
|
|
468
|
-
Apply reliability policies from deployments:
|
|
469
|
-
|
|
470
|
-
### Retries & Circuit Breakers
|
|
471
|
-
- Generate: Resilience configurations
|
|
472
|
-
- From: `deployments.services[x].operations[y].policies.retry`, `.circuitBreaker`
|
|
473
|
-
- Example: Resilience4j configs, Istio retry policies
|
|
474
|
-
|
|
475
|
-
### Health Checks
|
|
476
|
-
- Generate: Readiness/liveness probe configurations
|
|
477
|
-
- From: `deployments.*.healthChecks`
|
|
478
|
-
- Example: Kubernetes probes, Docker healthchecks
|
|
479
|
-
|
|
480
|
-
### Autoscaling
|
|
481
|
-
- Generate: Autoscaling configurations
|
|
482
|
-
- From: `deployments.*.autoscaling`
|
|
483
|
-
- Example: Kubernetes HPA, AWS Auto Scaling Groups
|
|
484
|
-
|
|
485
|
-
## Output Structure
|
|
486
|
-
|
|
487
|
-
Generate infrastructure configurations organized by environment:
|
|
488
|
-
|
|
489
|
-
```
|
|
490
|
-
infrastructure/
|
|
491
|
-
├── base/ # Base configurations (environment-agnostic)
|
|
492
|
-
│ ├── database/
|
|
493
|
-
│ │ ├── deployment.yaml
|
|
494
|
-
│ │ ├── service.yaml
|
|
495
|
-
│ │ └── pvc.yaml
|
|
496
|
-
│ ├── services/
|
|
497
|
-
│ │ └── task-service/
|
|
498
|
-
│ │ ├── deployment.yaml
|
|
499
|
-
│ │ ├── service.yaml
|
|
500
|
-
│ │ ├── hpa.yaml
|
|
501
|
-
│ │ └── networkpolicy.yaml
|
|
502
|
-
│ └── controllers/
|
|
503
|
-
│ └── task-controller/
|
|
504
|
-
│ ├── deployment.yaml
|
|
505
|
-
│ ├── service.yaml
|
|
506
|
-
│ └── ingress.yaml
|
|
507
|
-
├── overlays/ # Environment-specific overlays
|
|
508
|
-
│ ├── development/
|
|
509
|
-
│ │ ├── kustomization.yaml
|
|
510
|
-
│ │ └── patches/
|
|
511
|
-
│ ├── staging/
|
|
512
|
-
│ │ ├── kustomization.yaml
|
|
513
|
-
│ │ └── patches/
|
|
514
|
-
│ ├── production/
|
|
515
|
-
│ │ ├── kustomization.yaml
|
|
516
|
-
│ │ └── patches/
|
|
517
|
-
│ └── enterprise/
|
|
518
|
-
│ ├── kustomization.yaml
|
|
519
|
-
│ └── patches/
|
|
520
|
-
├── observability/
|
|
521
|
-
│ ├── prometheus/
|
|
522
|
-
│ │ ├── servicemonitor.yaml
|
|
523
|
-
│ │ └── prometheusrule.yaml
|
|
524
|
-
│ ├── grafana/
|
|
525
|
-
│ │ └── dashboards/
|
|
526
|
-
│ └── jaeger/
|
|
527
|
-
│ └── deployment.yaml
|
|
528
|
-
├── security/
|
|
529
|
-
│ ├── certificates/
|
|
530
|
-
│ ├── secrets/
|
|
531
|
-
│ └── policies/
|
|
532
|
-
├── docker-compose.yml # Local development
|
|
533
|
-
└── README.md # Deployment instructions
|
|
534
|
-
```
|
|
535
|
-
|
|
536
|
-
## Success Criteria
|
|
537
|
-
|
|
538
|
-
The generated infrastructure should:
|
|
539
|
-
- ✅ Implement all operational policies from Deployments layer
|
|
540
|
-
- ✅ Adapt appropriately to target environment
|
|
541
|
-
- ✅ Use instance factories for all infrastructure code
|
|
542
|
-
- ✅ Include complete observability stack (logging, metrics, tracing, alerts)
|
|
543
|
-
- ✅ Apply all security policies (authentication, authorization, encryption, network)
|
|
544
|
-
- ✅ Apply all performance policies (caching, rate limiting, resource limits)
|
|
545
|
-
- ✅ Apply all reliability policies (retries, circuit breakers, health checks, autoscaling)
|
|
546
|
-
- ✅ Be production-ready with proper documentation
|
|
547
|
-
- ✅ Support GitOps deployment workflows (Kustomize, Helm, etc)
|
|
548
|
-
|
|
549
|
-
## Important Notes
|
|
550
|
-
|
|
551
|
-
- **NEVER** hardcode infrastructure choices - always read from manifest's instance factories
|
|
552
|
-
- **NEVER** skip operational policies - they are critical for production readiness
|
|
553
|
-
- **ALWAYS** adapt to target environment (dev != production)
|
|
554
|
-
- **ALWAYS** generate complete observability stack
|
|
555
|
-
- **ALWAYS** apply security policies (defense in depth)
|
|
556
|
-
- **ALWAYS** use instance factory templates for infrastructure code
|
|
557
|
-
|
|
558
|
-
## Example Usage
|
|
559
|
-
|
|
560
|
-
**Input**: SpecVerse spec with deployments section + target environment = "production"
|
|
561
|
-
|
|
562
|
-
**Process**:
|
|
563
|
-
1. Read all deployment instances (database, services, controllers, views, communication)
|
|
564
|
-
2. For each instance, read operational policies
|
|
565
|
-
3. Adapt policies for production environment
|
|
566
|
-
4. Read manifest's infrastructure instance factory (e.g., kubernetes-deployment)
|
|
567
|
-
5. Fill instance factory template with deployment policies + environment adaptations
|
|
568
|
-
6. Generate complete Kubernetes manifests + observability stack
|
|
569
|
-
|
|
570
|
-
**Output**: Complete infrastructure-as-code ready to deploy to production Kubernetes cluster
|
|
571
|
-
|
|
572
|
-
---
|
|
573
|
-
|
|
574
|
-
**Now, please provide the SpecVerse specification and target environment (dev/staging/production/enterprise) you want me to realize.**
|
|
575
|
-
|
|
576
|
-
user:
|
|
577
|
-
template: |
|
|
578
|
-
Generate deployment configurations for this SpecVerse specification for
|
|
579
|
-
target environment `{{environment}}`.
|
|
580
|
-
|
|
581
|
-
Specification:
|
|
582
|
-
```specly
|
|
583
|
-
{{spec}}
|
|
584
|
-
```
|
|
585
|
-
|
|
586
|
-
{{#if overrides}}
|
|
587
|
-
Environment-specific overrides:
|
|
588
|
-
```yaml
|
|
589
|
-
{{overrides}}
|
|
590
|
-
```
|
|
591
|
-
{{/if}}
|
|
592
|
-
|
|
593
|
-
Return the complete deployment output — manifests, configs, policies —
|
|
594
|
-
per the instructions above.
|
|
595
|
-
|
|
596
|
-
variables:
|
|
597
|
-
- name: spec
|
|
598
|
-
type: string
|
|
599
|
-
required: true
|
|
600
|
-
description: Full text of the SpecVerse .specly specification whose deployment is being realized
|
|
601
|
-
|
|
602
|
-
- name: environment
|
|
603
|
-
type: string
|
|
604
|
-
required: true
|
|
605
|
-
description: Target environment name — e.g. "development", "staging", "production"
|
|
606
|
-
|
|
607
|
-
- name: overrides
|
|
608
|
-
type: string
|
|
609
|
-
required: false
|
|
610
|
-
description: Optional environment-specific configuration overrides (YAML snippet)
|
|
611
|
-
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
# Starter specification.
|
|
2
|
-
#
|
|
3
|
-
# Two models, one belongsTo relationship, one lifecycle. Small enough
|
|
4
|
-
# to read in 30 seconds, rich enough to exercise the generated-UI
|
|
5
|
-
# rules you'll build on: lifecycle dropdowns, belongsTo FK dropdowns,
|
|
6
|
-
# FK resolution in list / detail / dashboard columns.
|
|
7
|
-
components:
|
|
8
|
-
{{componentName}}:
|
|
9
|
-
version: "1.0.0"
|
|
10
|
-
description: "Starter specification — use the AI tab to extend it"
|
|
11
|
-
tags: [default, minimal]
|
|
12
|
-
|
|
13
|
-
models:
|
|
14
|
-
Category:
|
|
15
|
-
description: "A grouping label for Items"
|
|
16
|
-
attributes:
|
|
17
|
-
id: UUID required auto=uuid4
|
|
18
|
-
name: String required unique
|
|
19
|
-
description: Text
|
|
20
|
-
createdAt: DateTime auto=now
|
|
21
|
-
updatedAt: DateTime auto=now
|
|
22
|
-
relationships:
|
|
23
|
-
items: hasMany Item
|
|
24
|
-
|
|
25
|
-
Item:
|
|
26
|
-
description: "Something worth tracking"
|
|
27
|
-
attributes:
|
|
28
|
-
id: UUID required auto=uuid4
|
|
29
|
-
name: String required
|
|
30
|
-
description: Text
|
|
31
|
-
status: String required default=active
|
|
32
|
-
createdAt: DateTime auto=now
|
|
33
|
-
updatedAt: DateTime auto=now
|
|
34
|
-
relationships:
|
|
35
|
-
category: belongsTo Category
|
|
36
|
-
lifecycles:
|
|
37
|
-
status:
|
|
38
|
-
flow: "active -> archived"
|
|
39
|
-
|
|
40
|
-
views:
|
|
41
|
-
CategoryListView:
|
|
42
|
-
type: list
|
|
43
|
-
model: Category
|
|
44
|
-
CategoryDetailView:
|
|
45
|
-
type: detail
|
|
46
|
-
model: Category
|
|
47
|
-
CategoryFormView:
|
|
48
|
-
type: form
|
|
49
|
-
model: Category
|
|
50
|
-
CategoryDashboardView:
|
|
51
|
-
type: dashboard
|
|
52
|
-
model: Category
|
|
53
|
-
|
|
54
|
-
ItemListView:
|
|
55
|
-
type: list
|
|
56
|
-
model: Item
|
|
57
|
-
ItemDetailView:
|
|
58
|
-
type: detail
|
|
59
|
-
model: Item
|
|
60
|
-
ItemFormView:
|
|
61
|
-
type: form
|
|
62
|
-
model: Item
|
|
63
|
-
ItemDashboardView:
|
|
64
|
-
type: dashboard
|
|
65
|
-
model: Item
|