@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.
Files changed (63) hide show
  1. package/dist/ai/behavior-ai-service.d.ts.map +1 -1
  2. package/dist/ai/behavior-ai-service.js +18 -6
  3. package/dist/ai/behavior-ai-service.js.map +1 -1
  4. package/dist/ai/prompt-loader.d.ts +7 -3
  5. package/dist/ai/prompt-loader.d.ts.map +1 -1
  6. package/dist/ai/prompt-loader.js +67 -69
  7. package/dist/ai/prompt-loader.js.map +1 -1
  8. package/dist/inference/core/specly-converter.d.ts.map +1 -1
  9. package/dist/inference/core/specly-converter.js +8 -0
  10. package/dist/inference/core/specly-converter.js.map +1 -1
  11. package/dist/inference/core/types.d.ts +1 -0
  12. package/dist/inference/core/types.d.ts.map +1 -1
  13. package/dist/inference/core/types.js.map +1 -1
  14. package/dist/inference/index.d.ts.map +1 -1
  15. package/dist/inference/index.js +13 -2
  16. package/dist/inference/index.js.map +1 -1
  17. package/dist/inference/logical/generators/controller-generator.d.ts.map +1 -1
  18. package/dist/inference/logical/generators/controller-generator.js +5 -0
  19. package/dist/inference/logical/generators/controller-generator.js.map +1 -1
  20. package/dist/inference/logical/logical-engine.d.ts.map +1 -1
  21. package/dist/inference/logical/logical-engine.js +3 -0
  22. package/dist/inference/logical/logical-engine.js.map +1 -1
  23. package/dist/libs/instance-factories/cli/templates/commander/command-generator.js +17 -6
  24. package/dist/libs/instance-factories/tools/templates/mcp/mcp-server-generator.js +8 -7
  25. package/libs/instance-factories/cli/templates/commander/command-generator.ts +17 -6
  26. package/libs/instance-factories/tools/templates/mcp/mcp-server-generator.ts +10 -9
  27. package/package.json +2 -1
  28. package/assets/examples/manifests/01-simple-default-mappings.yaml +0 -36
  29. package/assets/examples/manifests/02-capability-mappings.yaml +0 -55
  30. package/assets/examples/manifests/03-hybrid-mappings.yaml +0 -109
  31. package/assets/examples/manifests/README.md +0 -245
  32. package/assets/examples/manifests/backend-only.yaml +0 -43
  33. package/assets/examples/manifests/blog-api.md +0 -78
  34. package/assets/examples/manifests/blog-api.specly +0 -79
  35. package/assets/examples/manifests/frontend-only.yaml +0 -24
  36. package/assets/examples/manifests/fullstack-app.yaml +0 -42
  37. package/assets/examples/manifests/fullstack-monorepo.yaml +0 -59
  38. package/assets/examples-decomposed/cloud-native-manifest.example.yaml +0 -8
  39. package/assets/examples-decomposed/cloud-native-manifest.md +0 -379
  40. package/assets/examples-decomposed/cloud-native-manifest.specly +0 -60
  41. package/assets/examples-decomposed/docker-compose-manifest.example.yaml +0 -8
  42. package/assets/examples-decomposed/docker-compose-manifest.md +0 -326
  43. package/assets/examples-decomposed/docker-compose-manifest.specly +0 -40
  44. package/assets/examples-decomposed/kubernetes-deployment-manifest.example.yaml +0 -8
  45. package/assets/examples-decomposed/kubernetes-deployment-manifest.md +0 -237
  46. package/assets/examples-decomposed/kubernetes-deployment-manifest.specly +0 -41
  47. package/assets/examples-inference/inference-engine-demo.example.yaml +0 -8
  48. package/assets/examples-inference/inference-engine-demo.md +0 -574
  49. package/assets/examples-inference/inference-engine-demo.specly +0 -216
  50. package/assets/prompts/core/README.md +0 -319
  51. package/assets/prompts/core/standard/default/analyse.prompt.yaml +0 -531
  52. package/assets/prompts/core/standard/default/app-demo.prompt.yaml +0 -233
  53. package/assets/prompts/core/standard/default/behavior.prompt.yaml +0 -157
  54. package/assets/prompts/core/standard/default/create.prompt.yaml +0 -426
  55. package/assets/prompts/core/standard/default/materialise.prompt.yaml +0 -844
  56. package/assets/prompts/core/standard/default/realize.prompt.yaml +0 -611
  57. package/assets/prompts/core/standard/v9/analyse.prompt.yaml +0 -531
  58. package/assets/prompts/core/standard/v9/app-demo.prompt.yaml +0 -233
  59. package/assets/prompts/core/standard/v9/behavior.prompt.yaml +0 -157
  60. package/assets/prompts/core/standard/v9/create.prompt.yaml +0 -426
  61. package/assets/prompts/core/standard/v9/materialise.prompt.yaml +0 -844
  62. package/assets/prompts/core/standard/v9/realize.prompt.yaml +0 -611
  63. package/assets/templates/default/specs/main.specly +0 -65
@@ -1,216 +0,0 @@
1
- components:
2
- ECommerceSystem:
3
- version: "2.0.0"
4
- description: "Example 03-06: Complete e-commerce system to test inference engine"
5
-
6
- export:
7
- models: [Customer, Product, Order, OrderItem, Payment, Category, Review, Inventory]
8
- controllers: [OrderController]
9
- events: [OrderCreated]
10
- views: [OrderDashboard]
11
-
12
- import:
13
- - from: "@specverse/primitives"
14
- select: [Money]
15
-
16
- models:
17
- Customer:
18
- description: "Root entity - customer account"
19
- attributes:
20
- id: UUID required
21
- email: Email required unique
22
- firstName: String required
23
- lastName: String required
24
- phone: String
25
- status: String default=active
26
- creditLimit: Money default=1000.00
27
- registrationDate: DateTime required
28
- relationships:
29
- orders: hasMany Order
30
- reviews: hasMany Review
31
- lifecycles:
32
- account:
33
- flow: pending -> active -> suspended -> deleted
34
- behaviors:
35
- calculateTotalSpent:
36
- description: "Calculate total amount spent by customer"
37
- returns: Money
38
- ensures: ["Returns accurate total spending"]
39
- validateCreditLimit:
40
- description: "Check if customer can make purchase"
41
- parameters:
42
- amount: Money required
43
- returns: Boolean
44
- ensures: ["Credit limit validation completed"]
45
-
46
- Product:
47
- description: "Product catalog entity"
48
- attributes:
49
- id: UUID required
50
- name: String required
51
- description: String
52
- price: Money required
53
- category: String required
54
- stock: Integer required
55
- isDigital: Boolean default=false
56
- weight: String
57
- sku: String required unique
58
- relationships:
59
- orderItems: hasMany OrderItem
60
- reviews: hasMany Review
61
- inventory: hasOne Inventory
62
- lifecycles:
63
- inventory:
64
- flow: draft -> active -> discontinued -> archived
65
-
66
- Order:
67
- description: "Customer order - belongs to customer, has many items"
68
- attributes:
69
- id: UUID required
70
- orderNumber: String required unique
71
- customerEmail: Email required
72
- subtotal: Money required
73
- tax: Money required
74
- shipping: Money required
75
- total: Money required
76
- shippingAddress: String required
77
- billingAddress: String required
78
- orderDate: DateTime required
79
- expectedDelivery: DateTime
80
- relationships:
81
- customer: belongsTo Customer
82
- items: hasMany OrderItem
83
- payments: hasMany Payment
84
- lifecycles:
85
- fulfillment:
86
- flow: pending -> processing -> shipped -> delivered
87
- payment:
88
- flow: unpaid -> paid -> refunded
89
-
90
- OrderItem:
91
- description: "Individual line item in an order"
92
- attributes:
93
- id: UUID required
94
- productName: String required
95
- productSku: String required
96
- quantity: Integer required
97
- unitPrice: Money required
98
- lineTotal: Money required
99
- discountApplied: Money
100
- relationships:
101
- order: belongsTo Order
102
- product: belongsTo Product
103
-
104
- Payment:
105
- description: "Payment transaction for an order"
106
- attributes:
107
- id: UUID required
108
- amount: Money required
109
- paymentMethod: String required
110
- transactionId: String required
111
- processorResponse: String
112
- processedAt: DateTime
113
- refundedAmount: Money
114
- relationships:
115
- order: belongsTo Order
116
- lifecycles:
117
- processing:
118
- flow: pending -> authorized -> captured -> settled
119
-
120
- Category:
121
- description: "Product category hierarchy"
122
- attributes:
123
- id: UUID required
124
- name: String required
125
- description: String
126
- parentId: UUID
127
- isActive: Boolean default=true
128
- sortOrder: Integer default=0
129
- relationships:
130
- parent: belongsTo Category
131
- children: hasMany Category
132
- products: hasMany Product
133
-
134
- Review:
135
- description: "Customer product review"
136
- attributes:
137
- id: UUID required
138
- rating: Integer required
139
- title: String required
140
- comment: String
141
- isVerifiedPurchase: Boolean default=false
142
- isApproved: Boolean default=false
143
- reviewDate: DateTime required
144
- relationships:
145
- product: belongsTo Product
146
- customer: belongsTo Customer
147
- lifecycles:
148
- moderation:
149
- flow: pending -> approved -> rejected
150
-
151
- Inventory:
152
- description: "Warehouse inventory tracking"
153
- attributes:
154
- id: UUID required
155
- location: String required
156
- quantityOnHand: Integer required
157
- quantityReserved: Integer default=0
158
- quantityAvailable: Integer required
159
- reorderPoint: Integer default=10
160
- maxStock: Integer default=100
161
- lastRestocked: DateTime
162
- relationships:
163
- product: belongsTo Product
164
- behaviors:
165
- updateQuantity:
166
- description: "Update inventory levels"
167
- parameters:
168
- quantity: Integer required
169
- reason: String required
170
- returns: Boolean
171
- ensures: ["Inventory levels updated correctly"]
172
- checkLowStock:
173
- description: "Check if reorder needed"
174
- returns: Boolean
175
- ensures: ["Low stock status determined"]
176
-
177
- controllers:
178
- OrderController:
179
- description: "Handle order operations"
180
- model: Order
181
- actions:
182
- createOrder:
183
- description: "Create new order"
184
- parameters:
185
- customerId: UUID required
186
- items: String required
187
- shippingAddress: String required
188
- returns: Order
189
- requires: ["Customer exists", "Products available"]
190
- ensures: ["Order created", "Inventory updated"]
191
- publishes: [OrderCreated]
192
-
193
- events:
194
- OrderCreated:
195
- description: "Fired when new order is created"
196
- attributes:
197
- orderId: UUID required
198
- customerId: UUID required
199
- total: Money required
200
- orderNumber: String required
201
- createdAt: DateTime required
202
-
203
- views:
204
- OrderDashboard:
205
- description: "Order management dashboard"
206
- model: Order
207
- uiComponents:
208
- OrderTable: {}
209
- OrderSummary: {}
210
- OrderFilters: {}
211
- properties:
212
- orderLimit: 50
213
- responsive: true
214
- realtime: true
215
-
216
- deployments: {}
@@ -1,319 +0,0 @@
1
- # SpecVerse Standard Prompts
2
-
3
- **Production-ready AI prompts for complete application development workflows**
4
-
5
- ## Overview
6
-
7
- The SpecVerse standard prompts enable seamless specification-driven development using AI assistants like Claude, ChatGPT, and Cursor. These prompts transform natural language requirements into complete, deployable applications.
8
-
9
- ## 📁 Directory Structure
10
-
11
- ```
12
- prompts/core/
13
- ├── standard/
14
- │ ├── v6/ # Previous version (deprecated)
15
- │ └── v7/ # Current version (recommended)
16
- │ ├── create.prompt.yaml # Requirements → Specifications
17
- │ ├── analyse.prompt.yaml # Code → Specifications (reverse engineering)
18
- │ ├── materialise.prompt.yaml # Specifications → Implementation
19
- │ └── realize.prompt.yaml # Specifications → Deployment (environment-adaptive)
20
- ├── specialized/ # Task-specific prompts
21
- │ ├── migration.prompt.yaml # Technology migrations
22
- │ └── optimization.prompt.yaml # Performance optimization
23
- ├── schemas/ # Validation schemas
24
- │ └── prompt.schema.yaml # Prompt structure validation
25
- ├── examples/ # Example usage and test cases
26
- ├── base-terminal-prompt.md # Ready-to-use terminal prompts
27
- ├── CHANGELOG.md # Version history and migration notes
28
- └── README.md # This file
29
- ```
30
-
31
- ## 🚀 Quick Start
32
-
33
- ### For Terminal/Chat Usage
34
-
35
- **1. Get terminal-ready prompts:**
36
- ```bash
37
- cat prompts/core/base-terminal-prompt.md
38
- ```
39
-
40
- **2. Copy the create prompt and replace requirements:**
41
- ```
42
- Requirements: I need a guesthouse booking system with multiple properties, rooms, and timeline visualization
43
- Project Type: full-stack
44
- Scale: business
45
- Primary Technology: nextjs
46
- ```
47
-
48
- **3. Generate implementation:**
49
- Use the materialise prompt with your generated specification.
50
-
51
- ### For Programmatic Usage
52
-
53
- ```typescript
54
- import { loadPrompt } from '@specverse/prompts';
55
-
56
- const prompt = await loadPrompt('standard/v7/create');
57
- const result = await llmProvider.complete(prompt, context);
58
- ```
59
-
60
- ## 🔄 Complete Workflow
61
-
62
- ### 1. Create Phase
63
- **Input**: Natural language requirements
64
- **Output**: Complete SpecVerse specification
65
- **Prompt**: `create.prompt.yaml`
66
-
67
- ```
68
- "I need a booking system for guesthouses..."
69
-
70
- Complete SpecVerse specification with models, controllers, services
71
- ```
72
-
73
- ### 2. Materialise Phase
74
- **Input**: SpecVerse specification
75
- **Output**: Production-ready implementation
76
- **Prompt**: `materialise.prompt.yaml`
77
-
78
- ```
79
- SpecVerse specification
80
-
81
- - Complete Next.js application
82
- - Database schema with validations
83
- - API routes with error handling
84
- - React components with state management
85
- - Setup scripts (start.sh)
86
- ```
87
-
88
- ### 3. Realize Phase (Optional)
89
- **Input**: SpecVerse specification + environment
90
- **Output**: Deployment configurations
91
- **Prompt**: `realize.prompt.yaml`
92
-
93
- ```
94
- SpecVerse specification + "production" environment
95
-
96
- - Infrastructure as Code
97
- - CI/CD pipelines
98
- - Monitoring configurations
99
- - Security policies
100
- ```
101
-
102
- ## 📊 Version Comparison
103
-
104
- | Feature | v6 | v7 |
105
- |---------|----|----|
106
- | Data Consistency | Basic | ✅ Multi-layer validation |
107
- | Error Handling | Manual | ✅ Comprehensive patterns |
108
- | Environment Adaptation | Static | ✅ Adaptive complexity |
109
- | Local Development | Manual setup | ✅ Automated (start.sh) |
110
- | Deployment Strategies | Basic | ✅ Zero-downtime options |
111
- | Type Safety | Partial | ✅ End-to-end |
112
- | Real-world Testing | Limited | ✅ Battle-tested |
113
-
114
- ## 🎯 Key Enhancements in v7
115
-
116
- ### Data Consistency Focus
117
- - **Snake_case ↔ CamelCase mapping**: Automatic handling between database and frontend
118
- - **Multi-layer validation**: Database constraints + API validation + Frontend checks
119
- - **Type safety**: End-to-end type consistency across all layers
120
-
121
- ### Environment-Adaptive Generation
122
- - **Development**: Simple Docker Compose + start.sh script
123
- - **Production**: HA infrastructure + monitoring + security
124
- - **Enterprise**: Multi-region + compliance + disaster recovery
125
-
126
- ### Production-Ready Patterns
127
- - **Error handling**: Comprehensive error patterns with recovery
128
- - **Automation**: Complete setup and deployment scripts
129
- - **Monitoring**: Health checks and observability
130
- - **Security**: Production-grade security configurations
131
-
132
- ## 🛠️ Framework Support
133
-
134
- ### Supported Frameworks
135
- - **Next.js**: Full-stack React with App Router
136
- - **NestJS**: Enterprise Node.js with TypeORM
137
- - **Express**: Lightweight Node.js API
138
- - **Django**: Python web framework
139
- - **Rails**: Ruby web framework
140
- - **Spring Boot**: Java enterprise applications
141
-
142
- ### Cloud Platforms
143
- - **Vercel**: Serverless Next.js deployment
144
- - **AWS**: Full cloud infrastructure
145
- - **Azure**: Microsoft cloud services
146
- - **GCP**: Google cloud platform
147
- - **Local**: Docker-based development
148
-
149
- ## 📚 Real-World Testing
150
-
151
- ### Guesthouse Booking System Example
152
- The v7 prompts were battle-tested with a complete guesthouse booking system:
153
-
154
- - **Models**: Houses, Rooms, Bookings with relationships
155
- - **Features**: Timeline visualization, conflict detection, multi-property support
156
- - **Technologies**: Next.js 14, PostgreSQL, TypeScript, Tailwind CSS
157
- - **Deployment**: Automated setup with start.sh, Docker Compose, health checks
158
-
159
- **Result**: Fully functional application from requirements to deployment.
160
-
161
- ### Generated Code Quality
162
- - ✅ **Type-safe**: Strict TypeScript with no `any` types
163
- - ✅ **Validated**: Multi-layer data validation
164
- - ✅ **Tested**: Comprehensive error handling
165
- - ✅ **Documented**: Self-documenting code patterns
166
- - ✅ **Deployable**: Production-ready configurations
167
-
168
- ## 📝 Prompt Format (v7)
169
-
170
- All v7 prompts follow an enhanced YAML format:
171
-
172
- ```yaml
173
- name: prompt-name
174
- version: "7.0.0"
175
- description: Enhanced prompt with data consistency focus
176
- author: SpecVerse Team
177
- tags: [v7, production-ready, data-consistency]
178
-
179
- system:
180
- role: |
181
- Enhanced role with specific workflows and constraints
182
- context: |
183
- Required reading and enhanced requirements
184
- capabilities:
185
- - Enhanced capability list
186
- constraints:
187
- - Production-ready constraints
188
-
189
- user:
190
- template: |
191
- Multi-phase template with conditional logic
192
- {% if environmentType == "development" %}
193
- Development-specific instructions
194
- {% endif %}
195
-
196
- variables:
197
- - name: dataConsistencyLevel
198
- type: string
199
- enum: ["basic", "strict", "paranoid"]
200
- default: "strict"
201
-
202
- context:
203
- includes:
204
- - schema: node_modules/@specverse/entities/schema/SPECVERSE-SCHEMA.json
205
- priority: "READ SCHEMA FILES FIRST"
206
- max_tokens: 4000
207
-
208
- framework_support:
209
- nextjs:
210
- data_patterns: ["type-safe API routes", "validated forms"]
211
- validation_libraries: ["zod", "yup"]
212
-
213
- output:
214
- quality_standards:
215
- - data_integrity: "Multi-layer validation"
216
- - error_resilience: "Recovery patterns"
217
-
218
- validation:
219
- data_consistency: "Validate data flow between layers"
220
- production_readiness: "Enterprise-grade quality"
221
- ```
222
-
223
- ## 🔧 Configuration Options
224
-
225
- ### Data Consistency Levels
226
- ```yaml
227
- dataConsistencyLevel:
228
- - basic # Basic validation
229
- - strict # Multi-layer validation (recommended)
230
- - paranoid # Maximum validation and checks
231
- ```
232
-
233
- ### Implementation Styles
234
- ```yaml
235
- implementationStyle:
236
- - minimal # Essential features only
237
- - modern # Best practices (recommended)
238
- - enterprise # Full enterprise features
239
- ```
240
-
241
- ### Environment Types
242
- ```yaml
243
- environmentType:
244
- - development # Local dev with hot reload
245
- - test # CI/CD integration
246
- - production # High availability
247
- - enterprise # Full compliance
248
- ```
249
-
250
- ## 🐛 Troubleshooting
251
-
252
- ### Common Issues & Solutions
253
-
254
- **Data not displaying:**
255
- - Check snake_case/camelCase mapping in `lib/db.ts`
256
- - Verify date format conversions (ISO vs YYYY-MM-DD)
257
- - Use `dataConsistencyLevel: strict` in materialise
258
-
259
- **Database connection errors:**
260
- - Use environment variables in scripts: `POSTGRES_URL="..." npm run dev`
261
- - Check `.env.local` configuration
262
- - Verify database exists and is accessible
263
-
264
- **Missing functionality:**
265
- - Ensure complete specification with all required models
266
- - Use `implementationStyle: modern` for full features
267
- - Check generated component relationships
268
-
269
- ## 📖 Migration Guide
270
-
271
- ### Upgrading from v6 to v7
272
-
273
- 1. **Update file paths**: Change `standard/v6/` to `standard/v7/`
274
- 2. **Add new variables**: Include `dataConsistencyLevel`, `environmentType`
275
- 3. **Review output**: Check for enhanced error handling and validation
276
- 4. **Test thoroughly**: Verify data consistency and type mapping
277
-
278
- ### Breaking Changes
279
- - Materialise prompt requires data consistency configuration
280
- - Realize prompt generates environment-specific output
281
- - Enhanced variable sets for better control
282
-
283
- ## 🧪 Testing
284
-
285
- Each prompt includes comprehensive testing:
286
-
287
- ```bash
288
- # Test prompt effectiveness
289
- npm run test:prompts
290
-
291
- # Validate output format
292
- npm run validate:prompts
293
-
294
- # Test with multiple LLM providers
295
- npm run test:providers
296
- ```
297
-
298
- ## 🤝 Contributing
299
-
300
- ### Adding New Prompts
301
- 1. Follow the v7 YAML schema
302
- 2. Include comprehensive variable definitions
303
- 3. Add examples and usage documentation
304
- 4. Test with real-world scenarios
305
- 5. Update CHANGELOG.md
306
-
307
- ### Reporting Issues
308
- - Include full prompt configuration
309
- - Provide example requirements or specifications
310
- - Share generated output and expected behavior
311
- - Test with multiple frameworks when possible
312
-
313
- ## 📄 License
314
-
315
- Part of the SpecVerse project - MIT License
316
-
317
- ---
318
-
319
- **Ready to start?** Check out [base-terminal-prompt.md](base-terminal-prompt.md) for copy-paste ready prompts!