@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.
Files changed (116) hide show
  1. package/assets/prompts/core/standard/default/analyse.prompt.yaml +5 -5
  2. package/assets/prompts/core/standard/default/app-demo.prompt.yaml +21 -1
  3. package/assets/prompts/core/standard/default/behavior.prompt.yaml +150 -0
  4. package/assets/prompts/core/standard/default/create.prompt.yaml +3 -3
  5. package/assets/prompts/core/standard/default/materialise.prompt.yaml +804 -774
  6. package/assets/prompts/core/standard/default/realize.prompt.yaml +581 -544
  7. package/assets/prompts/core/standard/v9/analyse.prompt.yaml +5 -5
  8. package/assets/prompts/core/standard/v9/app-demo.prompt.yaml +233 -0
  9. package/assets/prompts/core/standard/v9/behavior.prompt.yaml +33 -9
  10. package/assets/prompts/core/standard/v9/create.prompt.yaml +3 -3
  11. package/assets/prompts/core/standard/v9/materialise.prompt.yaml +804 -774
  12. package/assets/prompts/core/standard/v9/realize.prompt.yaml +581 -544
  13. package/dist/ai/commands/fill.d.ts.map +1 -1
  14. package/dist/ai/commands/fill.js +16 -7
  15. package/dist/ai/commands/fill.js.map +1 -1
  16. package/dist/ai/commands/template.d.ts.map +1 -1
  17. package/dist/ai/commands/template.js +17 -8
  18. package/dist/ai/commands/template.js.map +1 -1
  19. package/dist/bundles/deriveCatalog.d.ts +18 -0
  20. package/dist/bundles/deriveCatalog.d.ts.map +1 -0
  21. package/dist/bundles/deriveCatalog.js +263 -0
  22. package/dist/bundles/deriveCatalog.js.map +1 -0
  23. package/dist/bundles/index.d.ts +15 -0
  24. package/dist/bundles/index.d.ts.map +1 -0
  25. package/dist/bundles/index.js +15 -0
  26. package/dist/bundles/index.js.map +1 -0
  27. package/dist/bundles/types.d.ts +53 -0
  28. package/dist/bundles/types.d.ts.map +1 -0
  29. package/dist/bundles/types.js +22 -0
  30. package/dist/bundles/types.js.map +1 -0
  31. package/dist/bundles/validate.d.ts +55 -0
  32. package/dist/bundles/validate.d.ts.map +1 -0
  33. package/dist/bundles/validate.js +471 -0
  34. package/dist/bundles/validate.js.map +1 -0
  35. package/dist/inference/quint-transpiler.js +2 -2
  36. package/dist/inference/quint-transpiler.js.map +1 -1
  37. package/dist/libs/instance-factories/applications/templates/react/runtime-package-json-generator.js +1 -1
  38. package/dist/libs/instance-factories/cli/templates/commander/command-generator.js +227 -0
  39. package/dist/libs/instance-factories/tools/templates/mcp/mcp-server-generator.js +295 -14
  40. package/libs/instance-factories/applications/templates/react/runtime-package-json-generator.ts +1 -1
  41. package/libs/instance-factories/cli/templates/commander/command-generator.ts +227 -0
  42. package/libs/instance-factories/tools/templates/mcp/mcp-server-generator.ts +328 -15
  43. package/package.json +9 -5
  44. package/assets/examples/09-api/ai-spec.yaml +0 -194
  45. package/assets/examples/09-api/converted.yaml +0 -95
  46. package/assets/examples/09-api/diagram-architecture.mmd +0 -10
  47. package/assets/examples/09-api/diagram-er.mmd +0 -10
  48. package/assets/examples/09-api/documentation.html +0 -104
  49. package/assets/examples/09-api/documentation.md +0 -95
  50. package/assets/examples/09-api/inferred-spec.yaml +0 -420
  51. package/assets/examples/09-api/openapi.json +0 -61
  52. package/assets/examples/10-api/README.md +0 -216
  53. package/assets/examples/10-api/ai-spec.yaml +0 -194
  54. package/assets/examples/10-api/converted.yaml +0 -96
  55. package/assets/examples/10-api/diagram-architecture.mmd +0 -10
  56. package/assets/examples/10-api/diagram-er.mmd +0 -10
  57. package/assets/examples/10-api/documentation.html +0 -104
  58. package/assets/examples/10-api/documentation.md +0 -95
  59. package/assets/examples/10-api/inferred-spec.yaml +0 -7
  60. package/assets/examples/10-api/metadata.yaml +0 -89
  61. package/assets/examples/10-api/openapi.json +0 -61
  62. package/assets/examples/10-api/package-integration-test.js +0 -177
  63. package/assets/examples/10-api/usage-example.js +0 -323
  64. package/assets/examples/10-api/usage-example.ts +0 -363
  65. package/assets/examples/10-api/workflow-test.js +0 -113
  66. package/assets/examples/validate-examples-with-expected-failures.cjs +0 -328
  67. package/assets/examples/validate-examples.cjs +0 -225
  68. package/assets/prompts/MOVED.md +0 -35
  69. package/assets/prompts/SUMMARY-v8-PROMOTION.md +0 -445
  70. package/assets/prompts/core/CHANGELOG.md +0 -158
  71. package/assets/prompts/core/MIGRATION-v6-to-v7.md +0 -379
  72. package/assets/prompts/core/base-terminal-prompt.md +0 -201
  73. package/assets/prompts/core/examples/example-usage.ts +0 -140
  74. package/assets/prompts/core/schemas/prompt.schema.json +0 -309
  75. package/assets/prompts/core/schemas/prompt.schema.yaml +0 -229
  76. package/assets/prompts/core/standard/archive/v1/analyse.prompt.yaml +0 -259
  77. package/assets/prompts/core/standard/archive/v1/create.prompt.yaml +0 -302
  78. package/assets/prompts/core/standard/archive/v1/materialise.prompt.yaml +0 -328
  79. package/assets/prompts/core/standard/archive/v1/realize.prompt.yaml +0 -606
  80. package/assets/prompts/core/standard/archive/v2/README.md +0 -110
  81. package/assets/prompts/core/standard/archive/v2/analyse.prompt.yaml +0 -151
  82. package/assets/prompts/core/standard/archive/v2/create.prompt.yaml +0 -151
  83. package/assets/prompts/core/standard/archive/v2/materialise.prompt.yaml +0 -132
  84. package/assets/prompts/core/standard/archive/v2/realize.prompt.yaml +0 -147
  85. package/assets/prompts/core/standard/archive/v3/README.md +0 -279
  86. package/assets/prompts/core/standard/archive/v3/analyse.prompt.yaml +0 -309
  87. package/assets/prompts/core/standard/archive/v3/create.prompt.yaml +0 -351
  88. package/assets/prompts/core/standard/archive/v3/materialise.prompt.yaml +0 -247
  89. package/assets/prompts/core/standard/archive/v3/realize.prompt.yaml +0 -344
  90. package/assets/prompts/core/standard/archive/v4/README.md +0 -79
  91. package/assets/prompts/core/standard/archive/v4/analyse.prompt.yaml +0 -204
  92. package/assets/prompts/core/standard/archive/v4/create.prompt.yaml +0 -185
  93. package/assets/prompts/core/standard/archive/v5/README.md +0 -224
  94. package/assets/prompts/core/standard/archive/v5/analyse.prompt.yaml +0 -209
  95. package/assets/prompts/core/standard/archive/v5/create.prompt.yaml +0 -225
  96. package/assets/prompts/core/standard/archive/v5/materialise.prompt.yaml +0 -242
  97. package/assets/prompts/core/standard/archive/v5/realize.prompt.yaml +0 -336
  98. package/assets/prompts/core/standard/archive/v6/README.md +0 -187
  99. package/assets/prompts/core/standard/archive/v6/analyse.prompt.yaml +0 -219
  100. package/assets/prompts/core/standard/archive/v6/create.prompt.yaml +0 -180
  101. package/assets/prompts/core/standard/archive/v6/materialise.prompt.yaml +0 -203
  102. package/assets/prompts/core/standard/archive/v6/realize.prompt.yaml +0 -215
  103. package/assets/prompts/core/standard/archive/v7/analyse.prompt.nick.yaml +0 -144
  104. package/assets/prompts/core/standard/archive/v7/analyse.prompt.old.yaml +0 -146
  105. package/assets/prompts/core/standard/archive/v7/analyse.prompt.yaml +0 -129
  106. package/assets/prompts/core/standard/archive/v7/create.prompt.yaml +0 -146
  107. package/assets/prompts/core/standard/archive/v7/materialise.prompt.yaml +0 -297
  108. package/assets/prompts/core/standard/archive/v7/realize.prompt.yaml +0 -294
  109. package/assets/prompts/core/standard/archive/v8/README.md +0 -400
  110. package/assets/prompts/core/standard/archive/v8/analyse.prompt.yaml +0 -185
  111. package/assets/prompts/core/standard/archive/v8/create.prompt.yaml +0 -203
  112. package/assets/prompts/core/standard/archive/v8/materialise.prompt.yaml +0 -297
  113. package/assets/prompts/core/standard/archive/v8/realize.prompt.yaml +0 -294
  114. package/assets/prompts/templates/api-orchestrator-template.yaml +0 -188
  115. package/assets/prompts/templates/claude-integration-template.md +0 -121
  116. package/assets/prompts/templates/terminal-prompt-template.md +0 -97
@@ -1,379 +0,0 @@
1
- # Migration Guide: SpecVerse Prompts v6 → v7
2
-
3
- **Upgrade your AI workflows to the enhanced v7 prompts with data consistency and environment-adaptive generation**
4
-
5
- ## šŸŽÆ Overview
6
-
7
- SpecVerse v7 prompts represent a major upgrade focused on:
8
- - **Data consistency**: Multi-layer validation and type mapping
9
- - **Environment adaptation**: Output that scales with your needs
10
- - **Production readiness**: Battle-tested patterns and automation
11
- - **Real-world reliability**: Based on actual implementation experience
12
-
13
- ## šŸ“Š What's New in v7
14
-
15
- ### Key Enhancements
16
-
17
- | Area | v6 | v7 |
18
- |------|----|----|
19
- | **Data Handling** | Basic column mapping | āœ… Snake_case ↔ CamelCase automation |
20
- | **Validation** | Client-side only | āœ… Database + API + Frontend |
21
- | **Error Handling** | Manual patterns | āœ… Comprehensive recovery patterns |
22
- | **Environments** | One-size-fits-all | āœ… Adaptive (dev/test/prod/enterprise) |
23
- | **Setup** | Manual configuration | āœ… Automated scripts (start.sh) |
24
- | **Testing** | Limited examples | āœ… Battle-tested with real applications |
25
-
26
- ### New Features
27
- - **Database-level validation functions** for conflict detection
28
- - **Environment-aware deployment** configurations
29
- - **Comprehensive error handling** with recovery patterns
30
- - **Automated setup scripts** for instant productivity
31
- - **Multi-layer type safety** across all application layers
32
-
33
- ## šŸ”„ Migration Steps
34
-
35
- ### Step 1: Update File Paths
36
-
37
- **Before (v6):**
38
- ```bash
39
- prompts/core/standard/v6/create.prompt.yaml
40
- prompts/core/standard/v6/materialise.prompt.yaml
41
- prompts/core/standard/v6/realize.prompt.yaml
42
- ```
43
-
44
- **After (v7):**
45
- ```bash
46
- prompts/core/standard/v7/create.prompt.yaml
47
- prompts/core/standard/v7/materialise.prompt.yaml
48
- prompts/core/standard/v7/realize.prompt.yaml
49
- ```
50
-
51
- ### Step 2: Update Variable Sets
52
-
53
- #### Materialise Prompt Variables
54
-
55
- **v6 Variables:**
56
- ```yaml
57
- specificationFile: "spec.specly"
58
- targetFramework: "nextjs"
59
- implementationStyle: "modern"
60
- developmentEnvironment: "local"
61
- ```
62
-
63
- **v7 Variables (Enhanced):**
64
- ```yaml
65
- specificationFile: "spec.specly"
66
- targetFramework: "nextjs"
67
- implementationStyle: "modern"
68
- developmentEnvironment: "local"
69
- # NEW in v7:
70
- dataConsistencyLevel: "strict" # basic/strict/paranoid
71
- errorHandlingStrategy: "comprehensive" # minimal/standard/comprehensive
72
- validationDepth: "multi-layer" # client-only/api-level/multi-layer/database-enforced
73
- setupAutomation: "full" # manual/semi-automated/full
74
- ```
75
-
76
- #### Realize Prompt Variables
77
-
78
- **v6 Variables:**
79
- ```yaml
80
- cloudProvider: "aws"
81
- environmentType: "production"
82
- scaleRequirements: "standard"
83
- ```
84
-
85
- **v7 Variables (Enhanced):**
86
- ```yaml
87
- cloudProvider: "vercel" # Added vercel, netlify, local
88
- environmentType: "production" # Now drives output complexity
89
- scaleRequirements: "auto" # auto adjusts based on environment
90
- # NEW in v7:
91
- deploymentStrategy: "rolling" # rolling/blue-green/canary/recreate
92
- databaseStrategy: "managed" # managed/self-hosted/serverless/local
93
- localDevSupport: "full" # none/basic/full
94
- automationLevel: "comprehensive" # manual/basic/comprehensive
95
- ```
96
-
97
- ### Step 3: Update Prompt Templates
98
-
99
- #### Terminal Usage
100
-
101
- **v6 Terminal Prompt:**
102
- ```
103
- Generate a complete implementation from this SpecVerse specification:
104
-
105
- [SPECIFICATION]
106
-
107
- Target Framework: nextjs
108
- Implementation Style: modern
109
-
110
- Please generate complete project structure and code.
111
- ```
112
-
113
- **v7 Terminal Prompt (Enhanced):**
114
- ```
115
- Generate a complete implementation from this SpecVerse specification:
116
-
117
- [SPECIFICATION]
118
-
119
- Target Framework: nextjs
120
- Implementation Style: modern
121
- Data Consistency Level: strict
122
- Error Handling Strategy: comprehensive
123
- Validation Depth: multi-layer
124
- Setup Automation: full
125
-
126
- Generate:
127
- 1. Complete project structure with automated setup
128
- 2. Database schema with multi-layer validation
129
- 3. API routes with comprehensive error handling
130
- 4. React components with type-safe data handling
131
- 5. Setup scripts (start.sh) for instant development
132
- 6. Production-ready configurations
133
- ```
134
-
135
- ### Step 4: Review Generated Output
136
-
137
- #### Enhanced Database Layer
138
-
139
- **v7 Generates:**
140
- ```typescript
141
- // Enhanced with type mapping
142
- export async function getBookings(): Promise<Booking[]> {
143
- const result = await query('SELECT * FROM bookings ORDER BY check_in')
144
- // v7: Automatic snake_case to camelCase mapping
145
- return result.rows.map(row => ({
146
- id: row.id,
147
- roomId: row.room_id, // ← Automatic mapping
148
- guestName: row.guest_name, // ← Automatic mapping
149
- checkIn: row.check_in, // ← Automatic mapping
150
- checkOut: row.check_out, // ← Automatic mapping
151
- notes: row.notes,
152
- createdAt: row.created_at
153
- }))
154
- }
155
- ```
156
-
157
- #### Enhanced Error Handling
158
-
159
- **v7 Generates:**
160
- ```typescript
161
- // Comprehensive error handling with recovery
162
- try {
163
- const bookings = await getBookings()
164
- return NextResponse.json(bookings)
165
- } catch (error) {
166
- console.error('Error fetching bookings:', error)
167
-
168
- // v7: Detailed error classification and recovery
169
- if (error.code === 'ECONNREFUSED') {
170
- return NextResponse.json(
171
- { error: 'Database connection failed', retry: true },
172
- { status: 503 }
173
- )
174
- }
175
-
176
- return NextResponse.json(
177
- { error: 'Internal server error', details: error.message },
178
- { status: 500 }
179
- )
180
- }
181
- ```
182
-
183
- #### Environment-Adaptive Deployment
184
-
185
- **v7 Development Environment:**
186
- ```yaml
187
- # Simple Docker Compose for development
188
- version: '3.8'
189
- services:
190
- postgres:
191
- image: postgres:15
192
- environment:
193
- POSTGRES_DB: guesthouse_dev
194
- POSTGRES_USER: postgres
195
- POSTGRES_PASSWORD: postgres
196
- ports:
197
- - "5432:5432"
198
-
199
- app:
200
- build: .
201
- ports:
202
- - "3000:3000"
203
- depends_on:
204
- - postgres
205
- ```
206
-
207
- **v7 Production Environment:**
208
- ```yaml
209
- # Full infrastructure with monitoring
210
- apiVersion: apps/v1
211
- kind: Deployment
212
- metadata:
213
- name: guesthouse-app
214
- spec:
215
- replicas: 3
216
- strategy:
217
- type: RollingUpdate
218
- rollingUpdate:
219
- maxUnavailable: 1
220
- maxSurge: 1
221
- template:
222
- spec:
223
- containers:
224
- - name: app
225
- image: guesthouse:latest
226
- ports:
227
- - containerPort: 3000
228
- livenessProbe:
229
- httpGet:
230
- path: /api/health
231
- port: 3000
232
- readinessProbe:
233
- httpGet:
234
- path: /api/ready
235
- port: 3000
236
- ```
237
-
238
- ## āš ļø Breaking Changes
239
-
240
- ### 1. Materialise Prompt Structure
241
-
242
- **Breaking Change:** Multi-phase template with data analysis
243
- ```yaml
244
- # v7 requires analysis phase before implementation
245
- ## PHASE 1: DATA ANALYSIS
246
- Analyze the specification for:
247
- - Data models and their relationships
248
- - Validation rules and constraints
249
- - Potential conflict scenarios
250
-
251
- ## PHASE 2: IMPLEMENTATION GENERATION
252
- Generate implementation with data consistency focus
253
- ```
254
-
255
- ### 2. Realize Prompt Environment Logic
256
-
257
- **Breaking Change:** Conditional template based on environment
258
- ```yaml
259
- # v7 uses conditional logic
260
- {% if environmentType == "development" %}
261
- Generate simple Docker Compose setup
262
- {% elif environmentType == "production" %}
263
- Generate production infrastructure
264
- {% endif %}
265
- ```
266
-
267
- ### 3. Enhanced Variable Requirements
268
-
269
- **Breaking Change:** New required variables for consistency
270
- - `dataConsistencyLevel` - Controls validation depth
271
- - `errorHandlingStrategy` - Defines error handling approach
272
- - `environmentType` - Drives output complexity
273
-
274
- ## šŸ› ļø Troubleshooting Common Migration Issues
275
-
276
- ### Issue: Data Not Displaying After Migration
277
-
278
- **Symptoms:**
279
- - API returns data but frontend shows empty
280
- - Database queries work but components don't render
281
-
282
- **v7 Solution:**
283
- ```yaml
284
- # Use strict data consistency in materialise
285
- dataConsistencyLevel: "strict"
286
- validationDepth: "multi-layer"
287
- ```
288
-
289
- **Result:** Automatic snake_case/camelCase mapping generated
290
-
291
- ### Issue: Over-Engineered Development Environment
292
-
293
- **Symptoms:**
294
- - Complex infrastructure for local development
295
- - Unnecessary monitoring and compliance features
296
-
297
- **v7 Solution:**
298
- ```yaml
299
- # Use development environment type
300
- environmentType: "development"
301
- localDevSupport: "full"
302
- ```
303
-
304
- **Result:** Simple Docker Compose + start.sh script
305
-
306
- ### Issue: Missing Error Handling
307
-
308
- **Symptoms:**
309
- - Application crashes on errors
310
- - No recovery mechanisms
311
- - Poor error messages
312
-
313
- **v7 Solution:**
314
- ```yaml
315
- # Use comprehensive error handling
316
- errorHandlingStrategy: "comprehensive"
317
- ```
318
-
319
- **Result:** Complete error handling with recovery patterns
320
-
321
- ## āœ… Validation Checklist
322
-
323
- After migration, verify:
324
-
325
- - [ ] **File paths updated** to v7 directories
326
- - [ ] **New variables added** for data consistency and environment
327
- - [ ] **Generated code includes** type mapping functions
328
- - [ ] **Error handling is comprehensive** with recovery patterns
329
- - [ ] **Setup scripts work** (start.sh can launch application)
330
- - [ ] **Environment-appropriate complexity** (dev ≠ prod features)
331
- - [ ] **Database validation** functions are generated
332
- - [ ] **Multi-layer validation** across all boundaries
333
-
334
- ## šŸ“š Learning Resources
335
-
336
- ### Example Migration
337
-
338
- See the complete guesthouse booking system example that validated v7:
339
- - **Before**: Manual setup, data mapping issues, basic error handling
340
- - **After**: Automated setup, consistent data flow, comprehensive error handling
341
-
342
- ### Key Files to Review
343
-
344
- 1. **`lib/db.ts`** - Data mapping functions
345
- 2. **`start.sh`** - Automated setup script
346
- 3. **`schema.sql`** - Database constraints and functions
347
- 4. **API routes** - Error handling patterns
348
- 5. **Components** - Type-safe data handling
349
-
350
- ## šŸŽÆ Best Practices for v7
351
-
352
- ### 1. Choose Appropriate Data Consistency
353
- - **Basic**: Simple applications, minimal validation
354
- - **Strict**: Business applications (recommended)
355
- - **Paranoid**: Financial/healthcare applications
356
-
357
- ### 2. Environment-Specific Configuration
358
- - **Development**: Focus on speed and debugging
359
- - **Production**: Include monitoring and security
360
- - **Enterprise**: Full compliance and disaster recovery
361
-
362
- ### 3. Gradual Migration Strategy
363
- 1. Start with development environment
364
- 2. Validate data consistency patterns
365
- 3. Test error handling scenarios
366
- 4. Migrate production configurations
367
- 5. Update team documentation
368
-
369
- ## šŸš€ Next Steps
370
-
371
- 1. **Update your prompts** to v7 syntax
372
- 2. **Test with a small project** to validate migration
373
- 3. **Review generated code** for quality improvements
374
- 4. **Update team documentation** with v7 patterns
375
- 5. **Enjoy enhanced productivity** with automated setup!
376
-
377
- ---
378
-
379
- **Need help?** Check the [troubleshooting section](README.md#troubleshooting) in the main README or review the [CHANGELOG](CHANGELOG.md) for detailed changes.
@@ -1,201 +0,0 @@
1
- # SpecVerse Terminal Quick-Start Guide
2
-
3
- **For**: LLM Terminal Users (ChatGPT, Claude, Cursor, etc.)
4
- **Purpose**: Use SpecVerse standard prompts for specification generation and implementation
5
- **Version**: 7.0.0
6
-
7
- This guide shows how to use the **standard SpecVerse prompts** for terminal/chat-based AI interactions.
8
-
9
- ## Available Standard Prompts (v7)
10
-
11
- SpecVerse provides four standard prompts with enhanced capabilities:
12
-
13
- 1. **`create`** - Generate SpecVerse specifications from natural language requirements
14
- 2. **`analyse`** - Extract specifications from existing codebases (reverse engineering)
15
- 3. **`materialise`** - Generate complete implementations from specifications
16
- 4. **`realize`** - Generate deployment configurations (environment-adaptive)
17
-
18
- Located in: `prompts/core/standard/v7/`
19
-
20
- ## Quick Start: Using the Create Prompt
21
-
22
- The **create** prompt is your starting point for new projects:
23
-
24
- ### Step 1: View the Full Prompt
25
-
26
- ```bash
27
- cat prompts/core/standard/v7/create.prompt.yaml
28
- ```
29
-
30
- ### Step 2: Terminal-Ready Version
31
-
32
- Copy this complete prompt into your LLM:
33
-
34
- ```
35
- You are a SpecVerse v3.2.0 specification creator that generates complete, well-structured specifications from natural language requirements.
36
-
37
- IMPORTANT: First, read these reference files if available:
38
- - node_modules/@specverse/lang/schema/SPECVERSE-SCHEMA-AI.yaml (AI guidance and examples)
39
- - node_modules/@specverse/lang/schema/MINIMAL-SYNTAX-REFERENCE.specly (complete syntax example)
40
-
41
- Your task is to:
42
- 1. Analyze natural language requirements
43
- 2. Extract core business entities and their relationships
44
- 3. Generate complete SpecVerse specifications with:
45
- - Models with attributes and behaviors
46
- - Controllers with CURED operations
47
- - Services with business logic
48
- - Views for user interfaces
49
- - Events for system communication
50
- - Deployments for infrastructure
51
- - Manifests for implementation details
52
-
53
- Use SpecVerse v3.2.0 syntax:
54
- - Attributes: name: Type modifiers
55
- - Types: String, Integer, UUID, Email, DateTime, Boolean, Money, Text
56
- - Modifiers: required, optional, unique, auto, searchable, indexed, default=value
57
- - Relations: hasMany, belongsTo, references
58
-
59
- Generate a SpecVerse specification from these requirements:
60
-
61
- Requirements: [YOUR REQUIREMENTS HERE]
62
- Project Type: [web-app/api/full-stack]
63
- Scale: [personal/startup/business/enterprise]
64
- Primary Technology: [nextjs/nestjs/express/auto]
65
-
66
- Please generate:
67
- 1. Complete component specification with all models and relationships
68
- 2. Implementation manifest with technology choices
69
- 3. Deployment specification for the target environment
70
- ```
71
-
72
- ## Workflow Example: From Idea to Implementation
73
-
74
- ### 1. Create Specification
75
- ```
76
- Requirements: I need a guesthouse booking system where I can manage multiple properties, each with rooms that guests can book. Need to see bookings on a timeline and prevent double-booking.
77
- Project Type: full-stack
78
- Scale: business
79
- Primary Technology: nextjs
80
- ```
81
-
82
- ### 2. Generate Implementation (Materialise)
83
- After getting your specification, use the materialise prompt:
84
-
85
- ```
86
- Generate a complete implementation from this SpecVerse specification:
87
-
88
- [PASTE YOUR SPECIFICATION HERE]
89
-
90
- Target Framework: nextjs
91
- Implementation Style: modern
92
- Data Consistency Level: strict
93
- Error Handling Strategy: comprehensive
94
-
95
- Generate:
96
- 1. Complete project structure
97
- 2. Database schema with migrations
98
- 3. API routes with validation
99
- 4. React components with state management
100
- 5. Setup scripts (like start.sh)
101
- 6. Documentation
102
- ```
103
-
104
- ### 3. Generate Deployment (Realize)
105
- For deployment configurations:
106
-
107
- ```
108
- Generate deployment configurations from this SpecVerse specification:
109
-
110
- [PASTE YOUR SPECIFICATION HERE]
111
-
112
- Target Environment: [development/production/enterprise]
113
- Cloud Provider: [vercel/aws/local]
114
-
115
- For development: Generate Docker Compose and start.sh script
116
- For production: Generate infrastructure as code and CI/CD pipelines
117
- ```
118
-
119
- ## Complete Workflow Commands
120
-
121
- 1. **Create** a specification from requirements
122
- 2. **Save** as `spec.specly`
123
- 3. **Materialise** into working code
124
- 4. **Realize** deployment configurations
125
- 5. **Run** with generated start scripts
126
-
127
- ## Key Improvements in v7
128
-
129
- ### Create (v7)
130
- - Better validation and type safety
131
- - Support for complex relationships
132
- - Event-driven architecture patterns
133
- - Modern deployment targets (Vercel, Netlify)
134
-
135
- ### Materialise (v7)
136
- - **Data consistency focus** - Handles snake_case/camelCase mapping
137
- - **Multi-layer validation** - Database, API, and frontend
138
- - **Automated setup** - Generates start.sh style scripts
139
- - **Error handling** - Comprehensive error patterns
140
-
141
- ### Realize (v7)
142
- - **Environment-adaptive** - Only generates what's needed
143
- - **Progressive enhancement** - Dev → Test → Prod → Enterprise
144
- - **Local dev support** - Quick start scripts and Docker Compose
145
- - **Zero-downtime** - Blue-green and canary deployments
146
-
147
- ## Environment-Specific Generation
148
-
149
- ### Development
150
- - Simple Docker Compose
151
- - start.sh quick-start script
152
- - Hot reload configuration
153
- - Basic debugging setup
154
-
155
- ### Production
156
- - High availability infrastructure
157
- - Monitoring and alerting
158
- - Security hardening
159
- - Backup and recovery
160
-
161
- ### Enterprise
162
- - Multi-region deployment
163
- - Compliance frameworks
164
- - Advanced security
165
- - Disaster recovery
166
-
167
- ## Tips for Better Results
168
-
169
- 1. **Be specific** about your requirements
170
- 2. **Include examples** of the data you'll work with
171
- 3. **Specify scale** to get appropriate architecture
172
- 4. **Mention constraints** like compliance or performance
173
- 5. **Describe user workflows** for better UX generation
174
-
175
- ## Troubleshooting Common Issues
176
-
177
- ### Data Mapping Issues
178
- If you see snake_case/camelCase problems:
179
- - Request "strict" data consistency level in materialise
180
- - Ask for explicit data mapping functions
181
-
182
- ### Missing Bookings/Data
183
- Check for:
184
- - Database column name mapping (room_id vs roomId)
185
- - Date format conversions (ISO vs YYYY-MM-DD)
186
- - API response transformations
187
-
188
- ### Connection Issues
189
- For database connections:
190
- - Use environment variables in scripts
191
- - Generate start.sh with explicit POSTGRES_URL
192
- - Include .env.example templates
193
-
194
- ## Next Steps
195
-
196
- 1. Start with the **create** prompt for your requirements
197
- 2. Use **materialise** to generate implementation
198
- 3. Apply **realize** for deployment setup
199
- 4. Iterate based on your specific needs
200
-
201
- Remember: v7 prompts are environment-aware and will adapt their output to your actual needs!
@@ -1,140 +0,0 @@
1
- /**
2
- * Example usage of the SpecVerse Prompt System
3
- * Demonstrates how to load and process prompts with the PromptLoader
4
- */
5
-
6
- import { promptLoader } from '../src/prompts/prompt-loader';
7
-
8
- async function demonstratePromptUsage() {
9
- console.log('SpecVerse Prompt System Demo\n');
10
-
11
- try {
12
- // 1. List all available prompts
13
- console.log('šŸ“‹ Available prompts:');
14
- const prompts = await promptLoader.listPrompts();
15
- prompts.forEach(({ path, definition }) => {
16
- console.log(` - ${path}: ${definition.description}`);
17
- });
18
- console.log('');
19
-
20
- // 2. Load and process the 'create' prompt
21
- console.log('šŸ”§ Processing "create" prompt...');
22
- const createPrompt = await promptLoader.processPrompt(
23
- 'standard/create',
24
- {
25
- requirements: 'Build a simple blog where users can write posts with titles and content. Posts should have tags for organization.',
26
- scale: 'personal',
27
- preferredTech: 'nextjs'
28
- }
29
- );
30
-
31
- console.log('System Prompt Preview:');
32
- console.log(createPrompt.system.substring(0, 200) + '...\n');
33
-
34
- console.log('User Prompt Preview:');
35
- console.log(createPrompt.user.substring(0, 300) + '...\n');
36
-
37
- // 3. Load and process the 'analyse' prompt
38
- console.log('šŸ” Processing "analyse" prompt...');
39
- const analysePrompt = await promptLoader.processPrompt(
40
- 'standard/analyse',
41
- {
42
- applicationPath: '/path/to/my-app',
43
- frameworkType: 'nextjs',
44
- directoryStructure: 'my-app/\nā”œā”€ā”€ app/\n│ └── api/\n└── package.json',
45
- filesContent: '=== package.json ===\n{ "name": "my-app" }'
46
- }
47
- );
48
-
49
- console.log('Analysis Prompt Ready:');
50
- console.log(`- System prompt length: ${analysePrompt.system.length} chars`);
51
- console.log(`- User prompt length: ${analysePrompt.user.length} chars`);
52
- console.log(`- Context includes: ${Object.keys(analysePrompt.context.includes).join(', ')}\n`);
53
-
54
- // 4. Validate a prompt
55
- console.log('āœ… Validating prompt structure...');
56
- const prompt = await promptLoader.loadPrompt('standard/create');
57
- const validation = promptLoader.validatePrompt(prompt);
58
-
59
- console.log(`Validation result: ${validation.valid ? 'PASSED' : 'FAILED'}`);
60
- if (!validation.valid) {
61
- console.log('Errors:', validation.errors);
62
- }
63
-
64
- } catch (error) {
65
- console.error('Error:', error.message);
66
- }
67
- }
68
-
69
- async function exampleLLMIntegration() {
70
- console.log('\nšŸ¤– Example LLM Integration\n');
71
-
72
- try {
73
- // Simulate loading a prompt and sending to LLM
74
- const prompt = await promptLoader.processPrompt(
75
- 'standard/create',
76
- {
77
- requirements: 'Create an e-commerce site with products and shopping cart',
78
- scale: 'business'
79
- }
80
- );
81
-
82
- // This is what you would send to an LLM provider
83
- const llmRequest = {
84
- messages: [
85
- { role: 'system', content: prompt.system },
86
- { role: 'user', content: prompt.user }
87
- ],
88
- max_tokens: prompt.context.max_tokens,
89
- temperature: prompt.context.temperature,
90
- top_p: prompt.context.top_p
91
- };
92
-
93
- console.log('LLM Request Structure:');
94
- console.log(`- Messages: ${llmRequest.messages.length}`);
95
- console.log(`- Max tokens: ${llmRequest.max_tokens}`);
96
- console.log(`- Temperature: ${llmRequest.temperature}`);
97
- console.log(`- Top P: ${llmRequest.top_p}`);
98
-
99
- // Mock LLM response
100
- const mockResponse = `
101
- components:
102
- EcommercePlatform:
103
- version: "1.0.0"
104
- description: "E-commerce platform"
105
-
106
- models:
107
- Product:
108
- attributes:
109
- name: String required searchable
110
- price: Money required
111
- inventory: Integer required default=0 min=0
112
- relationships:
113
- category: belongsTo Category required
114
-
115
- Category:
116
- attributes:
117
- name: String required unique
118
- relationships:
119
- products: hasMany Product
120
- `;
121
-
122
- console.log('\nMock LLM Response:');
123
- console.log(mockResponse);
124
-
125
- } catch (error) {
126
- console.error('Error:', error.message);
127
- }
128
- }
129
-
130
- async function runExamples() {
131
- await demonstratePromptUsage();
132
- await exampleLLMIntegration();
133
- }
134
-
135
- // Run examples if this file is executed directly
136
- if (require.main === module) {
137
- runExamples().catch(console.error);
138
- }
139
-
140
- export { demonstratePromptUsage, exampleLLMIntegration };