@specverse/engines 5.0.2 → 5.2.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/assets/prompts/core/standard/default/analyse.prompt.yaml +5 -5
- package/assets/prompts/core/standard/default/app-demo.prompt.yaml +21 -1
- package/assets/prompts/core/standard/default/behavior.prompt.yaml +150 -0
- package/assets/prompts/core/standard/default/create.prompt.yaml +3 -3
- package/assets/prompts/core/standard/default/materialise.prompt.yaml +804 -774
- package/assets/prompts/core/standard/default/realize.prompt.yaml +581 -544
- package/assets/prompts/core/standard/v9/analyse.prompt.yaml +5 -5
- package/assets/prompts/core/standard/v9/app-demo.prompt.yaml +233 -0
- package/assets/prompts/core/standard/v9/behavior.prompt.yaml +33 -9
- package/assets/prompts/core/standard/v9/create.prompt.yaml +3 -3
- package/assets/prompts/core/standard/v9/materialise.prompt.yaml +804 -774
- package/assets/prompts/core/standard/v9/realize.prompt.yaml +581 -544
- package/dist/ai/commands/fill.d.ts.map +1 -1
- package/dist/ai/commands/fill.js +16 -7
- package/dist/ai/commands/fill.js.map +1 -1
- package/dist/ai/commands/template.d.ts.map +1 -1
- package/dist/ai/commands/template.js +17 -8
- package/dist/ai/commands/template.js.map +1 -1
- package/dist/bundles/deriveCatalog.d.ts +18 -0
- package/dist/bundles/deriveCatalog.d.ts.map +1 -0
- package/dist/bundles/deriveCatalog.js +263 -0
- package/dist/bundles/deriveCatalog.js.map +1 -0
- package/dist/bundles/index.d.ts +15 -0
- package/dist/bundles/index.d.ts.map +1 -0
- package/dist/bundles/index.js +15 -0
- package/dist/bundles/index.js.map +1 -0
- package/dist/bundles/types.d.ts +53 -0
- package/dist/bundles/types.d.ts.map +1 -0
- package/dist/bundles/types.js +22 -0
- package/dist/bundles/types.js.map +1 -0
- package/dist/bundles/validate.d.ts +55 -0
- package/dist/bundles/validate.d.ts.map +1 -0
- package/dist/bundles/validate.js +471 -0
- package/dist/bundles/validate.js.map +1 -0
- package/dist/inference/quint-transpiler.js +2 -2
- package/dist/inference/quint-transpiler.js.map +1 -1
- package/dist/libs/instance-factories/applications/templates/react/runtime-package-json-generator.js +1 -1
- package/dist/libs/instance-factories/cli/templates/commander/command-generator.js +227 -0
- package/dist/libs/instance-factories/tools/templates/mcp/mcp-server-generator.js +295 -14
- package/libs/instance-factories/applications/templates/react/runtime-package-json-generator.ts +1 -1
- package/libs/instance-factories/cli/templates/commander/command-generator.ts +227 -0
- package/libs/instance-factories/tools/templates/mcp/mcp-server-generator.ts +328 -15
- package/package.json +9 -5
- package/assets/examples/09-api/ai-spec.yaml +0 -194
- package/assets/examples/09-api/converted.yaml +0 -95
- package/assets/examples/09-api/diagram-architecture.mmd +0 -10
- package/assets/examples/09-api/diagram-er.mmd +0 -10
- package/assets/examples/09-api/documentation.html +0 -104
- package/assets/examples/09-api/documentation.md +0 -95
- package/assets/examples/09-api/inferred-spec.yaml +0 -420
- package/assets/examples/09-api/openapi.json +0 -61
- package/assets/examples/10-api/README.md +0 -216
- package/assets/examples/10-api/ai-spec.yaml +0 -194
- package/assets/examples/10-api/converted.yaml +0 -96
- package/assets/examples/10-api/diagram-architecture.mmd +0 -10
- package/assets/examples/10-api/diagram-er.mmd +0 -10
- package/assets/examples/10-api/documentation.html +0 -104
- package/assets/examples/10-api/documentation.md +0 -95
- package/assets/examples/10-api/inferred-spec.yaml +0 -7
- package/assets/examples/10-api/metadata.yaml +0 -89
- package/assets/examples/10-api/openapi.json +0 -61
- package/assets/examples/10-api/package-integration-test.js +0 -177
- package/assets/examples/10-api/usage-example.js +0 -323
- package/assets/examples/10-api/usage-example.ts +0 -363
- package/assets/examples/10-api/workflow-test.js +0 -113
- package/assets/examples/validate-examples-with-expected-failures.cjs +0 -328
- package/assets/examples/validate-examples.cjs +0 -225
- package/assets/prompts/MOVED.md +0 -35
- package/assets/prompts/SUMMARY-v8-PROMOTION.md +0 -445
- package/assets/prompts/core/CHANGELOG.md +0 -158
- package/assets/prompts/core/MIGRATION-v6-to-v7.md +0 -379
- package/assets/prompts/core/base-terminal-prompt.md +0 -201
- package/assets/prompts/core/examples/example-usage.ts +0 -140
- package/assets/prompts/core/schemas/prompt.schema.json +0 -309
- package/assets/prompts/core/schemas/prompt.schema.yaml +0 -229
- package/assets/prompts/core/standard/archive/v1/analyse.prompt.yaml +0 -259
- package/assets/prompts/core/standard/archive/v1/create.prompt.yaml +0 -302
- package/assets/prompts/core/standard/archive/v1/materialise.prompt.yaml +0 -328
- package/assets/prompts/core/standard/archive/v1/realize.prompt.yaml +0 -606
- package/assets/prompts/core/standard/archive/v2/README.md +0 -110
- package/assets/prompts/core/standard/archive/v2/analyse.prompt.yaml +0 -151
- package/assets/prompts/core/standard/archive/v2/create.prompt.yaml +0 -151
- package/assets/prompts/core/standard/archive/v2/materialise.prompt.yaml +0 -132
- package/assets/prompts/core/standard/archive/v2/realize.prompt.yaml +0 -147
- package/assets/prompts/core/standard/archive/v3/README.md +0 -279
- package/assets/prompts/core/standard/archive/v3/analyse.prompt.yaml +0 -309
- package/assets/prompts/core/standard/archive/v3/create.prompt.yaml +0 -351
- package/assets/prompts/core/standard/archive/v3/materialise.prompt.yaml +0 -247
- package/assets/prompts/core/standard/archive/v3/realize.prompt.yaml +0 -344
- package/assets/prompts/core/standard/archive/v4/README.md +0 -79
- package/assets/prompts/core/standard/archive/v4/analyse.prompt.yaml +0 -204
- package/assets/prompts/core/standard/archive/v4/create.prompt.yaml +0 -185
- package/assets/prompts/core/standard/archive/v5/README.md +0 -224
- package/assets/prompts/core/standard/archive/v5/analyse.prompt.yaml +0 -209
- package/assets/prompts/core/standard/archive/v5/create.prompt.yaml +0 -225
- package/assets/prompts/core/standard/archive/v5/materialise.prompt.yaml +0 -242
- package/assets/prompts/core/standard/archive/v5/realize.prompt.yaml +0 -336
- package/assets/prompts/core/standard/archive/v6/README.md +0 -187
- package/assets/prompts/core/standard/archive/v6/analyse.prompt.yaml +0 -219
- package/assets/prompts/core/standard/archive/v6/create.prompt.yaml +0 -180
- package/assets/prompts/core/standard/archive/v6/materialise.prompt.yaml +0 -203
- package/assets/prompts/core/standard/archive/v6/realize.prompt.yaml +0 -215
- package/assets/prompts/core/standard/archive/v7/analyse.prompt.nick.yaml +0 -144
- package/assets/prompts/core/standard/archive/v7/analyse.prompt.old.yaml +0 -146
- package/assets/prompts/core/standard/archive/v7/analyse.prompt.yaml +0 -129
- package/assets/prompts/core/standard/archive/v7/create.prompt.yaml +0 -146
- package/assets/prompts/core/standard/archive/v7/materialise.prompt.yaml +0 -297
- package/assets/prompts/core/standard/archive/v7/realize.prompt.yaml +0 -294
- package/assets/prompts/core/standard/archive/v8/README.md +0 -400
- package/assets/prompts/core/standard/archive/v8/analyse.prompt.yaml +0 -185
- package/assets/prompts/core/standard/archive/v8/create.prompt.yaml +0 -203
- package/assets/prompts/core/standard/archive/v8/materialise.prompt.yaml +0 -297
- package/assets/prompts/core/standard/archive/v8/realize.prompt.yaml +0 -294
- package/assets/prompts/templates/api-orchestrator-template.yaml +0 -188
- package/assets/prompts/templates/claude-integration-template.md +0 -121
- package/assets/prompts/templates/terminal-prompt-template.md +0 -97
|
@@ -1,328 +0,0 @@
|
|
|
1
|
-
name: materialise
|
|
2
|
-
version: "1.0.0"
|
|
3
|
-
description: Generate clean implementation from extracted specifications for comparison with existing code
|
|
4
|
-
author: SpecVerse Team
|
|
5
|
-
tags: [materialise, comparison, clean-implementation]
|
|
6
|
-
|
|
7
|
-
system:
|
|
8
|
-
role: |
|
|
9
|
-
You generate a complete NEW implementation from extracted specifications.
|
|
10
|
-
This is NOT about updating existing code - you create a fresh, clean implementation
|
|
11
|
-
that can be compared with the original codebase for migration planning.
|
|
12
|
-
|
|
13
|
-
context: |
|
|
14
|
-
Your purpose is to create a "clean room" implementation from specifications that were
|
|
15
|
-
extracted from an existing application. This clean implementation will be used to:
|
|
16
|
-
1. Compare with the original code to identify differences
|
|
17
|
-
2. Generate migration recommendations
|
|
18
|
-
3. Highlight inconsistencies or technical debt
|
|
19
|
-
4. Plan refactoring strategies
|
|
20
|
-
|
|
21
|
-
Generate production-quality code that follows best practices for the detected framework.
|
|
22
|
-
|
|
23
|
-
capabilities:
|
|
24
|
-
- Generate complete application implementations
|
|
25
|
-
- Follow framework-specific best practices
|
|
26
|
-
- Implement all models, controllers, and services from specs
|
|
27
|
-
- Generate database schemas and migrations
|
|
28
|
-
- Create proper API endpoints
|
|
29
|
-
- Add appropriate error handling
|
|
30
|
-
- Generate clean, maintainable code
|
|
31
|
-
|
|
32
|
-
constraints:
|
|
33
|
-
- Generate NEW code, not modifications to existing code
|
|
34
|
-
- Follow the technology patterns from the manifest
|
|
35
|
-
- Implement ALL specifications completely
|
|
36
|
-
- Use modern best practices
|
|
37
|
-
- Include proper error handling and validation
|
|
38
|
-
- Generate working, compilable code
|
|
39
|
-
|
|
40
|
-
user:
|
|
41
|
-
template: |
|
|
42
|
-
Generate a clean implementation from these extracted specifications:
|
|
43
|
-
|
|
44
|
-
Component Specification:
|
|
45
|
-
{{componentSpec}}
|
|
46
|
-
|
|
47
|
-
Deployment Specification:
|
|
48
|
-
{{deploymentSpec}}
|
|
49
|
-
|
|
50
|
-
Implementation Manifest:
|
|
51
|
-
{{manifest}}
|
|
52
|
-
|
|
53
|
-
Original Application Path: {{originalPath}}
|
|
54
|
-
|
|
55
|
-
Generate a complete, clean implementation that:
|
|
56
|
-
1. Implements all models with proper attributes and relationships
|
|
57
|
-
2. Creates all controllers with the specified actions
|
|
58
|
-
3. Implements all services with business logic
|
|
59
|
-
4. Includes database schema/migrations
|
|
60
|
-
5. Follows the framework patterns from the manifest
|
|
61
|
-
6. Uses modern best practices
|
|
62
|
-
7. Is ready to run and test
|
|
63
|
-
|
|
64
|
-
Output the complete file structure and contents for the clean implementation.
|
|
65
|
-
Include a comparison report highlighting key differences from the original.
|
|
66
|
-
|
|
67
|
-
variables:
|
|
68
|
-
- name: componentSpec
|
|
69
|
-
type: string
|
|
70
|
-
required: true
|
|
71
|
-
description: SpecVerse component specification in YAML format
|
|
72
|
-
|
|
73
|
-
- name: deploymentSpec
|
|
74
|
-
type: string
|
|
75
|
-
required: false
|
|
76
|
-
description: SpecVerse deployment specification in YAML format
|
|
77
|
-
|
|
78
|
-
- name: manifest
|
|
79
|
-
type: string
|
|
80
|
-
required: true
|
|
81
|
-
description: Implementation manifest describing technology stack
|
|
82
|
-
|
|
83
|
-
- name: originalPath
|
|
84
|
-
type: string
|
|
85
|
-
required: true
|
|
86
|
-
description: Path to the original application for reference
|
|
87
|
-
|
|
88
|
-
context:
|
|
89
|
-
includes:
|
|
90
|
-
- schema: schema/SPECVERSE-V3.1-SCHEMA-AI.yaml
|
|
91
|
-
- library: framework-implementations
|
|
92
|
-
- template: clean-room-patterns
|
|
93
|
-
max_tokens: 12000
|
|
94
|
-
temperature: 0.2
|
|
95
|
-
top_p: 0.9
|
|
96
|
-
|
|
97
|
-
validation:
|
|
98
|
-
input:
|
|
99
|
-
- rule: Component specification must be provided
|
|
100
|
-
required: true
|
|
101
|
-
- rule: Implementation manifest must be provided
|
|
102
|
-
required: true
|
|
103
|
-
- rule: Specifications must be valid YAML
|
|
104
|
-
required: true
|
|
105
|
-
|
|
106
|
-
output:
|
|
107
|
-
- rule: Must generate complete working implementation
|
|
108
|
-
format: text
|
|
109
|
-
- rule: All models from spec must be implemented
|
|
110
|
-
format: text
|
|
111
|
-
- rule: All controllers from spec must be implemented
|
|
112
|
-
format: text
|
|
113
|
-
- rule: Must include comparison report
|
|
114
|
-
format: markdown
|
|
115
|
-
|
|
116
|
-
examples:
|
|
117
|
-
- name: Next.js Application Materialisation
|
|
118
|
-
description: Generate clean Next.js implementation from extracted specs
|
|
119
|
-
input:
|
|
120
|
-
componentSpec: |
|
|
121
|
-
components:
|
|
122
|
-
UserManagement:
|
|
123
|
-
version: "1.0.0"
|
|
124
|
-
models:
|
|
125
|
-
User:
|
|
126
|
-
attributes:
|
|
127
|
-
id: String required unique auto=cuid
|
|
128
|
-
email: Email required unique
|
|
129
|
-
name: String optional
|
|
130
|
-
relationships:
|
|
131
|
-
posts: hasMany Post cascade
|
|
132
|
-
Post:
|
|
133
|
-
attributes:
|
|
134
|
-
id: String required unique auto=cuid
|
|
135
|
-
title: String required
|
|
136
|
-
content: String optional
|
|
137
|
-
relationships:
|
|
138
|
-
author: belongsTo User required
|
|
139
|
-
controllers:
|
|
140
|
-
UserController:
|
|
141
|
-
model: User
|
|
142
|
-
actions:
|
|
143
|
-
getUsers:
|
|
144
|
-
returns: User[]
|
|
145
|
-
createUser:
|
|
146
|
-
parameters:
|
|
147
|
-
email: Email required
|
|
148
|
-
name: String optional
|
|
149
|
-
returns: User
|
|
150
|
-
manifest: |
|
|
151
|
-
technology:
|
|
152
|
-
framework: "nextjs"
|
|
153
|
-
version: "14.0.0"
|
|
154
|
-
language: "typescript"
|
|
155
|
-
database:
|
|
156
|
-
orm: "prisma"
|
|
157
|
-
provider: "postgresql"
|
|
158
|
-
api:
|
|
159
|
-
type: "rest"
|
|
160
|
-
pattern: "app-router"
|
|
161
|
-
originalPath: "/apps/legacy-user-app"
|
|
162
|
-
|
|
163
|
-
output: |
|
|
164
|
-
## Clean Implementation Structure
|
|
165
|
-
|
|
166
|
-
```
|
|
167
|
-
clean-user-management/
|
|
168
|
-
├── app/
|
|
169
|
-
│ ├── api/
|
|
170
|
-
│ │ └── users/
|
|
171
|
-
│ │ └── route.ts
|
|
172
|
-
│ └── layout.tsx
|
|
173
|
-
├── prisma/
|
|
174
|
-
│ ├── schema.prisma
|
|
175
|
-
│ └── migrations/
|
|
176
|
-
├── lib/
|
|
177
|
-
│ └── prisma.ts
|
|
178
|
-
└── package.json
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
### File Contents
|
|
182
|
-
|
|
183
|
-
**prisma/schema.prisma**
|
|
184
|
-
```prisma
|
|
185
|
-
generator client {
|
|
186
|
-
provider = "prisma-client-js"
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
datasource db {
|
|
190
|
-
provider = "postgresql"
|
|
191
|
-
url = env("DATABASE_URL")
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
model User {
|
|
195
|
-
id String @id @default(cuid())
|
|
196
|
-
email String @unique
|
|
197
|
-
name String?
|
|
198
|
-
posts Post[]
|
|
199
|
-
createdAt DateTime @default(now())
|
|
200
|
-
updatedAt DateTime @updatedAt
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
model Post {
|
|
204
|
-
id String @id @default(cuid())
|
|
205
|
-
title String
|
|
206
|
-
content String?
|
|
207
|
-
authorId String
|
|
208
|
-
author User @relation(fields: [authorId], references: [id], onDelete: Cascade)
|
|
209
|
-
createdAt DateTime @default(now())
|
|
210
|
-
updatedAt DateTime @updatedAt
|
|
211
|
-
}
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
**app/api/users/route.ts**
|
|
215
|
-
```typescript
|
|
216
|
-
import { NextRequest, NextResponse } from 'next/server';
|
|
217
|
-
import { prisma } from '@/lib/prisma';
|
|
218
|
-
import { z } from 'zod';
|
|
219
|
-
|
|
220
|
-
const createUserSchema = z.object({
|
|
221
|
-
email: z.string().email(),
|
|
222
|
-
name: z.string().optional(),
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
export async function GET() {
|
|
226
|
-
try {
|
|
227
|
-
const users = await prisma.user.findMany({
|
|
228
|
-
include: {
|
|
229
|
-
posts: true,
|
|
230
|
-
},
|
|
231
|
-
});
|
|
232
|
-
return NextResponse.json(users);
|
|
233
|
-
} catch (error) {
|
|
234
|
-
return NextResponse.json(
|
|
235
|
-
{ error: 'Failed to fetch users' },
|
|
236
|
-
{ status: 500 }
|
|
237
|
-
);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
export async function POST(request: NextRequest) {
|
|
242
|
-
try {
|
|
243
|
-
const body = await request.json();
|
|
244
|
-
const validatedData = createUserSchema.parse(body);
|
|
245
|
-
|
|
246
|
-
const user = await prisma.user.create({
|
|
247
|
-
data: validatedData,
|
|
248
|
-
include: {
|
|
249
|
-
posts: true,
|
|
250
|
-
},
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
return NextResponse.json(user, { status: 201 });
|
|
254
|
-
} catch (error) {
|
|
255
|
-
if (error instanceof z.ZodError) {
|
|
256
|
-
return NextResponse.json(
|
|
257
|
-
{ error: 'Validation failed', details: error.errors },
|
|
258
|
-
{ status: 400 }
|
|
259
|
-
);
|
|
260
|
-
}
|
|
261
|
-
return NextResponse.json(
|
|
262
|
-
{ error: 'Failed to create user' },
|
|
263
|
-
{ status: 500 }
|
|
264
|
-
);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
**lib/prisma.ts**
|
|
270
|
-
```typescript
|
|
271
|
-
import { PrismaClient } from '@prisma/client';
|
|
272
|
-
|
|
273
|
-
const globalForPrisma = globalThis as unknown as {
|
|
274
|
-
prisma: PrismaClient | undefined;
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
export const prisma = globalForPrisma.prisma ?? new PrismaClient();
|
|
278
|
-
|
|
279
|
-
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma;
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
## Comparison Report
|
|
283
|
-
|
|
284
|
-
### Key Improvements in Clean Implementation
|
|
285
|
-
|
|
286
|
-
1. **Type Safety**: Added Zod validation for API endpoints
|
|
287
|
-
2. **Error Handling**: Comprehensive error handling with appropriate HTTP status codes
|
|
288
|
-
3. **Database Relations**: Proper cascade delete handling
|
|
289
|
-
4. **Code Organization**: Clean separation of concerns
|
|
290
|
-
5. **Modern Patterns**: Uses Next.js 14 App Router patterns
|
|
291
|
-
6. **Validation**: Input validation on all endpoints
|
|
292
|
-
7. **TypeScript**: Full TypeScript implementation
|
|
293
|
-
|
|
294
|
-
### Likely Differences from Original
|
|
295
|
-
|
|
296
|
-
1. **Missing Error Handling**: Original may lack proper error responses
|
|
297
|
-
2. **No Input Validation**: Original may accept any input without validation
|
|
298
|
-
3. **Inconsistent Code Style**: Original may have mixed patterns
|
|
299
|
-
4. **Missing Type Safety**: Original may use any/unknown types
|
|
300
|
-
5. **Incomplete Relations**: Original may not handle cascade deletes properly
|
|
301
|
-
|
|
302
|
-
### Migration Recommendations
|
|
303
|
-
|
|
304
|
-
1. Add input validation using Zod or similar
|
|
305
|
-
2. Implement comprehensive error handling
|
|
306
|
-
3. Update database schema for proper relations
|
|
307
|
-
4. Add TypeScript types throughout
|
|
308
|
-
5. Migrate to Next.js App Router if using Pages Router
|
|
309
|
-
6. Add proper connection pooling for database
|
|
310
|
-
|
|
311
|
-
explanation: |
|
|
312
|
-
This clean implementation demonstrates modern Next.js best practices while
|
|
313
|
-
staying true to the extracted specifications. It provides a baseline for
|
|
314
|
-
comparing with the original code and identifying improvement opportunities.
|
|
315
|
-
|
|
316
|
-
metadata:
|
|
317
|
-
created: "2024-01-01T00:00:00Z"
|
|
318
|
-
updated: "2024-01-01T00:00:00Z"
|
|
319
|
-
tested_with:
|
|
320
|
-
- provider: openai
|
|
321
|
-
model: gpt-4
|
|
322
|
-
success_rate: 92
|
|
323
|
-
- provider: anthropic
|
|
324
|
-
model: claude-3-opus
|
|
325
|
-
success_rate: 95
|
|
326
|
-
performance:
|
|
327
|
-
avg_response_time: 18.7
|
|
328
|
-
avg_tokens_used: 6500
|