@specverse/engines 5.0.2 → 5.1.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 (57) hide show
  1. package/dist/ai/commands/fill.d.ts.map +1 -1
  2. package/dist/ai/commands/fill.js +16 -7
  3. package/dist/ai/commands/fill.js.map +1 -1
  4. package/dist/ai/commands/template.d.ts.map +1 -1
  5. package/dist/ai/commands/template.js +17 -8
  6. package/dist/ai/commands/template.js.map +1 -1
  7. package/dist/bundles/deriveCatalog.d.ts +18 -0
  8. package/dist/bundles/deriveCatalog.d.ts.map +1 -0
  9. package/dist/bundles/deriveCatalog.js +263 -0
  10. package/dist/bundles/deriveCatalog.js.map +1 -0
  11. package/dist/bundles/index.d.ts +15 -0
  12. package/dist/bundles/index.d.ts.map +1 -0
  13. package/dist/bundles/index.js +15 -0
  14. package/dist/bundles/index.js.map +1 -0
  15. package/dist/bundles/types.d.ts +53 -0
  16. package/dist/bundles/types.d.ts.map +1 -0
  17. package/dist/bundles/types.js +22 -0
  18. package/dist/bundles/types.js.map +1 -0
  19. package/dist/bundles/validate.d.ts +55 -0
  20. package/dist/bundles/validate.d.ts.map +1 -0
  21. package/dist/bundles/validate.js +471 -0
  22. package/dist/bundles/validate.js.map +1 -0
  23. package/dist/inference/quint-transpiler.js +2 -2
  24. package/dist/inference/quint-transpiler.js.map +1 -1
  25. package/dist/libs/instance-factories/applications/templates/react/runtime-package-json-generator.js +1 -1
  26. package/dist/libs/instance-factories/cli/templates/commander/command-generator.js +43 -0
  27. package/dist/libs/instance-factories/tools/templates/mcp/mcp-server-generator.js +11 -4
  28. package/libs/instance-factories/applications/templates/react/runtime-package-json-generator.ts +1 -1
  29. package/libs/instance-factories/cli/templates/commander/command-generator.ts +43 -0
  30. package/libs/instance-factories/tools/templates/mcp/mcp-server-generator.ts +10 -3
  31. package/package.json +9 -5
  32. package/assets/examples/09-api/ai-spec.yaml +0 -194
  33. package/assets/examples/09-api/converted.yaml +0 -95
  34. package/assets/examples/09-api/diagram-architecture.mmd +0 -10
  35. package/assets/examples/09-api/diagram-er.mmd +0 -10
  36. package/assets/examples/09-api/documentation.html +0 -104
  37. package/assets/examples/09-api/documentation.md +0 -95
  38. package/assets/examples/09-api/inferred-spec.yaml +0 -420
  39. package/assets/examples/09-api/openapi.json +0 -61
  40. package/assets/examples/10-api/README.md +0 -216
  41. package/assets/examples/10-api/ai-spec.yaml +0 -194
  42. package/assets/examples/10-api/converted.yaml +0 -96
  43. package/assets/examples/10-api/diagram-architecture.mmd +0 -10
  44. package/assets/examples/10-api/diagram-er.mmd +0 -10
  45. package/assets/examples/10-api/documentation.html +0 -104
  46. package/assets/examples/10-api/documentation.md +0 -95
  47. package/assets/examples/10-api/inferred-spec.yaml +0 -7
  48. package/assets/examples/10-api/metadata.yaml +0 -89
  49. package/assets/examples/10-api/openapi.json +0 -61
  50. package/assets/examples/10-api/package-integration-test.js +0 -177
  51. package/assets/examples/10-api/usage-example.js +0 -323
  52. package/assets/examples/10-api/usage-example.ts +0 -363
  53. package/assets/examples/10-api/workflow-test.js +0 -113
  54. package/assets/examples/validate-examples-with-expected-failures.cjs +0 -328
  55. package/assets/examples/validate-examples.cjs +0 -225
  56. package/assets/prompts/MOVED.md +0 -35
  57. package/assets/prompts/SUMMARY-v8-PROMOTION.md +0 -445
@@ -1,95 +0,0 @@
1
- # SpecVerseFundamentals
2
-
3
- Example 01-01: Basic model definition with attributes
4
-
5
- **Version:** 1.0.0
6
- **Generated:** 2026-03-23T18:22:33.403Z
7
-
8
- ## Table of Contents
9
-
10
- - [Overview](#overview)
11
- - [Models](#models)
12
- - [Product](#product)
13
-
14
- ## Overview
15
-
16
- ### Component Statistics
17
-
18
- | Component Type | Count |
19
- |----------------|-------|
20
- | Models | 1 |
21
- | Controllers | 0 |
22
- | Services | 0 |
23
- | Views | 0 |
24
- | Events | 0 |
25
-
26
- ### Imports
27
-
28
-
29
- ### Exports
30
-
31
- **SpecVerseFundamentals:**
32
- - **models:** Product
33
-
34
- ## Models
35
-
36
- ### Product
37
-
38
- Simple product with basic attributes
39
-
40
- #### Attributes
41
-
42
- | Name | Type | Required | Unique | Description |
43
- |------|------|----------|--------|-------------|
44
- | id | UUID | ✓ | | |
45
- | name | String | ✓ | | |
46
- | summary | String | | | |
47
- | price | Money | ✓ | | |
48
- | inStock | Boolean | | | Default: true |
49
- | category | String | ✓ | | |
50
- | contactEmail | Email | | | |
51
-
52
- #### Behaviors
53
-
54
- ##### attachProfile
55
-
56
- Attach a profile to this model instance
57
-
58
- **Parameters:**
59
- - `profileName`: String (required)
60
-
61
- **Returns:** Boolean
62
-
63
- **Preconditions:**
64
- - Profile exists and is compatible with this model
65
-
66
- **Postconditions:**
67
- - Profile is attached
68
- - Profile attributes are available
69
-
70
- ##### detachProfile
71
-
72
- Detach a profile from this model instance
73
-
74
- **Parameters:**
75
- - `profileName`: String (required)
76
-
77
- **Returns:** Boolean
78
-
79
- **Preconditions:**
80
- - Profile is currently attached
81
-
82
- **Postconditions:**
83
- - Profile is detached
84
- - Profile attributes are no longer available
85
-
86
- ##### hasProfile
87
-
88
- Check if a profile is attached to this model instance
89
-
90
- **Parameters:**
91
- - `profileName`: String (required)
92
-
93
- **Returns:** Boolean
94
-
95
- ---
@@ -1,7 +0,0 @@
1
- name: GeneratedComponent
2
- version: 3.1.0
3
- controllers: {}
4
- services: {}
5
- events: {}
6
- views: {}
7
- models: {}
@@ -1,89 +0,0 @@
1
- # API Integration Examples Metadata
2
- category: "api"
3
- title: "SpecVerse API Integration"
4
- description: "Comprehensive examples for programmatic integration of SpecVerse in TypeScript and JavaScript applications"
5
- targetAudience: "developers"
6
- estimatedTime: "2-3 hours"
7
-
8
- learningObjectives:
9
- - "Master the SpecVerse programmatic API for parsing and validation"
10
- - "Integrate AI inference engine into applications"
11
- - "Generate UML diagrams and documentation programmatically"
12
- - "Handle errors and edge cases in API integration"
13
- - "Test and validate API integrations"
14
-
15
- examples:
16
- - id: "09-01-usage-example"
17
- title: "Comprehensive API Usage"
18
- description: "Complete workflow examples showing all SpecVerse API capabilities"
19
- concepts: ["api", "parsing", "inference", "generation", "integration"]
20
- prerequisites: ["basic-javascript", "nodejs"]
21
- difficulty: "intermediate"
22
- estimatedTime: "45 minutes"
23
- formats: ["js", "ts"]
24
- learningObjectives:
25
- - "Parse and validate SpecVerse specifications programmatically"
26
- - "Use AI inference engine to enhance specifications"
27
- - "Generate UML diagrams and documentation"
28
- - "Handle parsing and validation errors"
29
- specverseFeatures: ["Parser API", "Inference Engine", "Generators", "Error Handling"]
30
- realWorldUseCase: "Build tools, web applications, automated processing pipelines"
31
-
32
- - id: "09-02-workflow-test"
33
- title: "End-to-End API Testing"
34
- description: "Focused workflow test for CI/CD and production validation"
35
- concepts: ["testing", "ci-cd", "validation", "automation"]
36
- prerequisites: ["api-basics"]
37
- difficulty: "intermediate"
38
- estimatedTime: "30 minutes"
39
- formats: ["js"]
40
- learningObjectives:
41
- - "Create automated API tests for CI/CD pipelines"
42
- - "Validate API functionality with embedded specifications"
43
- - "Handle success/failure scenarios appropriately"
44
- specverseFeatures: ["API Testing", "Validation", "CI/CD Integration"]
45
- realWorldUseCase: "Automated testing, build pipelines, API health checks"
46
-
47
- - id: "09-03-package-integration"
48
- title: "Package Integration Testing"
49
- description: "Validate complete npm package installation and API functionality"
50
- concepts: ["npm", "package-testing", "integration", "real-world-usage"]
51
- prerequisites: ["api-basics", "npm-knowledge"]
52
- difficulty: "advanced"
53
- estimatedTime: "45 minutes"
54
- formats: ["js"]
55
- learningObjectives:
56
- - "Test complete package installation workflow"
57
- - "Validate API functionality in real npm environment"
58
- - "Ensure package integrity and completeness"
59
- specverseFeatures: ["Package Distribution", "API Validation", "Integration Testing"]
60
- realWorldUseCase: "Release validation, package testing, integration verification"
61
-
62
- usagePatterns:
63
- webApplications:
64
- description: "Integration into React, Vue, Angular applications"
65
- examples: ["React component generation", "Vue template processing", "Angular service integration"]
66
-
67
- buildTools:
68
- description: "webpack, vite, rollup plugin integration"
69
- examples: ["Build-time specification processing", "Asset generation", "Plugin development"]
70
-
71
- apiServices:
72
- description: "Express, Fastify, Koa API endpoint integration"
73
- examples: ["Specification validation endpoints", "API generation services", "Documentation APIs"]
74
-
75
- cliTools:
76
- description: "Custom CLI tool development"
77
- examples: ["Custom specification processors", "Domain-specific tools", "Workflow automation"]
78
-
79
- performanceConsiderations:
80
- parsing: "Sub-5ms for typical specifications"
81
- inference: "Optimized rule processing engine"
82
- memory: "Efficient caching and resource management"
83
- concurrency: "Thread-safe for concurrent processing"
84
-
85
- nextSteps:
86
- - "Integrate SpecVerse into your project using these patterns"
87
- - "Customize examples for your specific use case"
88
- - "Use workflow-test.js patterns for production validation"
89
- - "Explore advanced inference engine configuration options"
@@ -1,61 +0,0 @@
1
- {
2
- "openapi": "3.0.3",
3
- "info": {
4
- "title": "SpecVerseFundamentals",
5
- "description": "Example 01-01: Basic model definition with attributes",
6
- "version": "1.0.0"
7
- },
8
- "servers": [
9
- {
10
- "url": "https://api.example.com"
11
- }
12
- ],
13
- "paths": {},
14
- "components": {
15
- "schemas": {
16
- "Product": {
17
- "type": "object",
18
- "description": "Simple product with basic attributes",
19
- "properties": {
20
- "id": {
21
- "type": "string",
22
- "description": ""
23
- },
24
- "name": {
25
- "type": "string",
26
- "description": ""
27
- },
28
- "summary": {
29
- "type": "string",
30
- "description": ""
31
- },
32
- "price": {
33
- "type": "string",
34
- "description": ""
35
- },
36
- "inStock": {
37
- "type": "boolean",
38
- "description": "Default: true",
39
- "default": "true"
40
- },
41
- "category": {
42
- "type": "string",
43
- "description": ""
44
- },
45
- "contactEmail": {
46
- "type": "string",
47
- "description": ""
48
- }
49
- },
50
- "required": [
51
- "id",
52
- "name",
53
- "price",
54
- "category"
55
- ]
56
- }
57
- },
58
- "responses": {},
59
- "parameters": {}
60
- }
61
- }
@@ -1,177 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * SpecVerse npm Package Integration Test
4
- *
5
- * Tests the actual npm package installation and API usage
6
- * This validates that the built package works when installed externally
7
- */
8
-
9
- import { execSync } from 'child_process';
10
- import { mkdtempSync, rmSync, writeFileSync, readFileSync } from 'fs';
11
- import { tmpdir } from 'os';
12
- import { join } from 'path';
13
-
14
- async function testPackageIntegration() {
15
- console.log('🧪 Testing npm package integration...');
16
-
17
- let testDir;
18
- let packagePath;
19
-
20
- try {
21
- // 1. Create package from current source
22
- console.log('1️⃣ Creating package...');
23
- const packOutput = execSync('npm pack --silent', { encoding: 'utf8' }).trim();
24
- // Extract just the .tgz filename from the output (last line that ends with .tgz)
25
- const tgzFilename = packOutput.split('\n').filter(line => line.endsWith('.tgz')).pop() || packOutput;
26
- packagePath = join(process.cwd(), tgzFilename);
27
- console.log(`✅ Package created: ${tgzFilename}`);
28
-
29
- // 2. Create temporary test directory
30
- console.log('2️⃣ Setting up test environment...');
31
- testDir = mkdtempSync(join(tmpdir(), 'specverse-test-'));
32
- console.log(`✅ Test directory: ${testDir}`);
33
-
34
- // 3. Install package in test directory
35
- console.log('3️⃣ Installing package...');
36
- execSync(`cd "${testDir}" && npm init -y --silent`, { stdio: 'ignore' });
37
- // Set type to module for ES module support
38
- const packageJsonPath = join(testDir, 'package.json');
39
- const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
40
- packageJson.type = 'module';
41
- writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
42
- execSync(`cd "${testDir}" && npm install "${packagePath}" --silent`, { stdio: 'ignore' });
43
- console.log('✅ Package installed successfully');
44
-
45
- // 4. Create test script (ES module)
46
- console.log('4️⃣ Creating test script...');
47
- const testScript = `
48
- import { SpecVerseParser, LogicalInferenceEngine } from '@specverse/lang';
49
- import { readFileSync } from 'fs';
50
- import { join, dirname } from 'path';
51
- import { fileURLToPath } from 'url';
52
-
53
- const __filename = fileURLToPath(import.meta.url);
54
- const __dirname = dirname(__filename);
55
-
56
- async function runTest() {
57
- console.log('🔍 Testing installed package...');
58
-
59
- // Simple test specification
60
- const testSpec = \`components:
61
- TestComponent:
62
- version: "3.2.0"
63
- description: "Test component for package integration"
64
-
65
- models:
66
- Product:
67
- description: "Test product model"
68
- attributes:
69
- id: UUID required unique
70
- name: String required
71
- price: Number required
72
- lifecycles:
73
- status:
74
- flow: draft -> active -> archived
75
-
76
- deployments: {}
77
- \`;
78
-
79
- try {
80
- // Test 1: Parse specification
81
- const schemaPath = join(__dirname, 'node_modules/@specverse/lang/schema/SPECVERSE-SCHEMA.json');
82
- const schema = JSON.parse(readFileSync(schemaPath, 'utf8'));
83
- const parser = new SpecVerseParser(schema);
84
-
85
- const parseResult = parser.parseContent(testSpec, 'test.specly');
86
- if (parseResult.errors.length > 0) {
87
- throw new Error('Parsing failed: ' + parseResult.errors.map(e => e.message).join(', '));
88
- }
89
- console.log('✅ Parsing successful');
90
-
91
- // Test 2: Run inference
92
- const config = {
93
- logical: {
94
- generateControllers: true,
95
- generateServices: true,
96
- generateEvents: true,
97
- generateViews: true
98
- },
99
- rules: {
100
- logicalRulesPath: join(__dirname, 'node_modules/@specverse/lang/dist/inference-engine/rules/logical')
101
- }
102
- };
103
-
104
- const engine = new LogicalInferenceEngine(config);
105
- await engine.loadRules();
106
-
107
- // Get the first (and only) component since parser uses array-style indexing
108
- const componentName = Object.keys(parseResult.ast.components)[0];
109
- const component = parseResult.ast.components[componentName];
110
- const models = component.models;
111
- const inference = await engine.inferLogicalSpecification(models, 'TestComponent');
112
-
113
- console.log(\`✅ Inference successful:\`);
114
- console.log(\` Controllers: \${Object.keys(inference.controllers || {}).length}\`);
115
- console.log(\` Services: \${Object.keys(inference.services || {}).length}\`);
116
- console.log(\` Events: \${Object.keys(inference.events || {}).length}\`);
117
- console.log(\` Views: \${Object.keys(inference.views || {}).length}\`);
118
-
119
- console.log('🎉 PACKAGE INTEGRATION TEST SUCCESS!');
120
- process.exit(0);
121
-
122
- } catch (error) {
123
- console.error('❌ Test failed:', error.message);
124
- process.exit(1);
125
- }
126
- }
127
-
128
- runTest();
129
- `;
130
-
131
- writeFileSync(join(testDir, 'test.js'), testScript);
132
- console.log('✅ Test script created');
133
-
134
- // 5. Run the test
135
- console.log('5️⃣ Running package integration test...');
136
- execSync(`cd "${testDir}" && node test.js`, {
137
- stdio: 'inherit',
138
- timeout: 30000
139
- });
140
-
141
- console.log('🎉 npm Package Integration Test PASSED!');
142
-
143
- } catch (error) {
144
- console.error('❌ Package integration test failed:', error.message);
145
- throw error;
146
-
147
- } finally {
148
- // Cleanup
149
- if (testDir) {
150
- try {
151
- rmSync(testDir, { recursive: true, force: true });
152
- console.log('🧹 Cleaned up test directory');
153
- } catch (cleanupError) {
154
- console.warn('⚠️ Could not clean up test directory:', cleanupError.message);
155
- }
156
- }
157
-
158
- if (packagePath) {
159
- try {
160
- rmSync(packagePath, { force: true });
161
- console.log('🧹 Cleaned up package file');
162
- } catch (cleanupError) {
163
- console.warn('⚠️ Could not clean up package file:', cleanupError.message);
164
- }
165
- }
166
- }
167
- }
168
-
169
- // Run if called directly
170
- if (import.meta.url === `file://${process.argv[1]}`) {
171
- testPackageIntegration().catch((error) => {
172
- console.error('Package integration test failed:', error.message);
173
- process.exit(1);
174
- });
175
- }
176
-
177
- export { testPackageIntegration };