@specverse/engines 4.2.0 → 4.2.2

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 (87) hide show
  1. package/assets/templates/default/specs/main.specly +65 -0
  2. package/dist/libs/instance-factories/CURVED-INTERFACE.md +278 -0
  3. package/dist/libs/instance-factories/README.md +73 -0
  4. package/dist/libs/instance-factories/applications/README.md +51 -0
  5. package/dist/libs/instance-factories/applications/generic-app.yaml +52 -0
  6. package/dist/libs/instance-factories/applications/react-app-runtime.yaml +139 -0
  7. package/dist/libs/instance-factories/applications/react-app-starter.yaml +143 -0
  8. package/dist/libs/instance-factories/applications/templates/react/env-example-generator.js +24 -2
  9. package/dist/libs/instance-factories/applications/templates/react/vite-config-generator.js +54 -33
  10. package/dist/libs/instance-factories/applications/templates/react-starter/README.md +211 -0
  11. package/dist/libs/instance-factories/applications/templates/react-starter/api-types-starter-generator.js +69 -0
  12. package/dist/libs/instance-factories/applications/templates/react-starter/app-tsx-generator.js +1 -1
  13. package/dist/libs/instance-factories/applications/templates/react-starter/belongs-to.js +40 -0
  14. package/dist/libs/instance-factories/applications/templates/react-starter/dashboard-body-composer.js +11 -3
  15. package/dist/libs/instance-factories/applications/templates/react-starter/detail-body-composer.js +18 -16
  16. package/dist/libs/instance-factories/applications/templates/react-starter/form-body-composer.js +50 -23
  17. package/dist/libs/instance-factories/applications/templates/react-starter/helpers-emitter.js +9 -3
  18. package/dist/libs/instance-factories/applications/templates/react-starter/list-body-composer.js +17 -7
  19. package/dist/libs/instance-factories/applications/templates/react-starter/orchestrator.js +16 -5
  20. package/dist/libs/instance-factories/applications/templates/react-starter/skeletons/dashboard.tsx.template +49 -0
  21. package/dist/libs/instance-factories/applications/templates/react-starter/skeletons/detail.tsx.template +96 -0
  22. package/dist/libs/instance-factories/applications/templates/react-starter/skeletons/form.tsx.template +116 -0
  23. package/dist/libs/instance-factories/applications/templates/react-starter/skeletons/list.tsx.template +74 -0
  24. package/dist/libs/instance-factories/applications/templates/react-starter/use-api-hooks-starter-generator.js +95 -0
  25. package/dist/libs/instance-factories/applications/templates/react-starter/view-emitter.js +26 -1
  26. package/dist/libs/instance-factories/archived/fastify-prisma.yaml +104 -0
  27. package/dist/libs/instance-factories/cli/README.md +43 -0
  28. package/dist/libs/instance-factories/cli/commander-js.yaml +55 -0
  29. package/dist/libs/instance-factories/cli/templates/commander/command-generator.js +49 -1
  30. package/dist/libs/instance-factories/communication/README.md +47 -0
  31. package/dist/libs/instance-factories/communication/event-emitter.yaml +60 -0
  32. package/dist/libs/instance-factories/communication/rabbitmq-events.yaml +87 -0
  33. package/dist/libs/instance-factories/controllers/README.md +42 -0
  34. package/dist/libs/instance-factories/controllers/fastify.yaml +139 -0
  35. package/dist/libs/instance-factories/controllers/templates/fastify/server-generator.js +29 -2
  36. package/dist/libs/instance-factories/infrastructure/README.md +29 -0
  37. package/dist/libs/instance-factories/infrastructure/docker-k8s.yaml +61 -0
  38. package/dist/libs/instance-factories/orms/README.md +54 -0
  39. package/dist/libs/instance-factories/orms/prisma.yaml +89 -0
  40. package/dist/libs/instance-factories/orms/templates/prisma/schema-generator.js +2 -2
  41. package/dist/libs/instance-factories/scaffolding/README.md +49 -0
  42. package/dist/libs/instance-factories/scaffolding/generic-scaffold.yaml +65 -0
  43. package/dist/libs/instance-factories/sdks/README.md +28 -0
  44. package/dist/libs/instance-factories/sdks/python-sdk.yaml +66 -0
  45. package/dist/libs/instance-factories/sdks/typescript-sdk.yaml +59 -0
  46. package/dist/libs/instance-factories/services/README.md +55 -0
  47. package/dist/libs/instance-factories/services/prisma-services.yaml +71 -0
  48. package/dist/libs/instance-factories/storage/README.md +34 -0
  49. package/dist/libs/instance-factories/storage/mongodb.yaml +79 -0
  50. package/dist/libs/instance-factories/storage/postgresql.yaml +75 -0
  51. package/dist/libs/instance-factories/storage/redis.yaml +79 -0
  52. package/dist/libs/instance-factories/testing/README.md +40 -0
  53. package/dist/libs/instance-factories/testing/vitest-tests.yaml +63 -0
  54. package/dist/libs/instance-factories/tools/README.md +70 -0
  55. package/dist/libs/instance-factories/tools/mcp.yaml +36 -0
  56. package/dist/libs/instance-factories/tools/vscode.yaml +35 -0
  57. package/dist/libs/instance-factories/validation/README.md +38 -0
  58. package/dist/libs/instance-factories/validation/zod.yaml +56 -0
  59. package/dist/realize/engines/code-generator.d.ts.map +1 -1
  60. package/dist/realize/engines/code-generator.js +3 -0
  61. package/dist/realize/engines/code-generator.js.map +1 -1
  62. package/libs/instance-factories/applications/react-app-starter.yaml +10 -17
  63. package/libs/instance-factories/applications/templates/react/env-example-generator.ts +24 -2
  64. package/libs/instance-factories/applications/templates/react/vite-config-generator.ts +54 -33
  65. package/libs/instance-factories/applications/templates/react-starter/__tests__/detail-body-composer.test.ts +5 -4
  66. package/libs/instance-factories/applications/templates/react-starter/__tests__/form-body-composer.test.ts +18 -5
  67. package/libs/instance-factories/applications/templates/react-starter/__tests__/orchestrator.test.ts +83 -62
  68. package/libs/instance-factories/applications/templates/react-starter/api-types-starter-generator.ts +98 -0
  69. package/libs/instance-factories/applications/templates/react-starter/app-tsx-generator.ts +1 -1
  70. package/libs/instance-factories/applications/templates/react-starter/belongs-to.ts +82 -0
  71. package/libs/instance-factories/applications/templates/react-starter/dashboard-body-composer.ts +20 -5
  72. package/libs/instance-factories/applications/templates/react-starter/detail-body-composer.ts +33 -33
  73. package/libs/instance-factories/applications/templates/react-starter/form-body-composer.ts +107 -30
  74. package/libs/instance-factories/applications/templates/react-starter/helpers-emitter.ts +9 -3
  75. package/libs/instance-factories/applications/templates/react-starter/list-body-composer.ts +34 -8
  76. package/libs/instance-factories/applications/templates/react-starter/orchestrator.ts +41 -26
  77. package/libs/instance-factories/applications/templates/react-starter/skeletons/dashboard.tsx.template +2 -0
  78. package/libs/instance-factories/applications/templates/react-starter/skeletons/detail.tsx.template +2 -0
  79. package/libs/instance-factories/applications/templates/react-starter/skeletons/form.tsx.template +2 -0
  80. package/libs/instance-factories/applications/templates/react-starter/skeletons/list.tsx.template +2 -0
  81. package/libs/instance-factories/applications/templates/react-starter/use-api-hooks-starter-generator.ts +124 -0
  82. package/libs/instance-factories/applications/templates/react-starter/view-emitter.ts +58 -0
  83. package/libs/instance-factories/cli/templates/commander/command-generator.ts +49 -1
  84. package/libs/instance-factories/controllers/fastify.yaml +7 -0
  85. package/libs/instance-factories/controllers/templates/fastify/server-generator.ts +36 -2
  86. package/libs/instance-factories/orms/templates/prisma/schema-generator.ts +11 -4
  87. package/package.json +2 -1
@@ -0,0 +1,59 @@
1
+ name: TypeScriptSDK
2
+ version: "1.0.0"
3
+ category: view
4
+ description: "TypeScript SDK generator for consuming REST APIs with full type safety"
5
+
6
+ metadata:
7
+ author: "SpecVerse Team"
8
+ license: "MIT"
9
+ tags: [typescript, sdk, client, rest-api]
10
+
11
+ compatibility:
12
+ specverse: ">=3.3.0"
13
+ node: ">=18.0.0"
14
+
15
+ capabilities:
16
+ provides:
17
+ - "sdk.typescript"
18
+ - "client.rest"
19
+ requires:
20
+ - "api.rest"
21
+ - "api.rest.crud"
22
+
23
+ technology:
24
+ runtime: "node"
25
+ language: "typescript"
26
+ framework: "native"
27
+ httpClient: "fetch"
28
+
29
+ dependencies:
30
+ runtime: []
31
+ dev:
32
+ - name: "@types/node"
33
+ version: "^20.8.0"
34
+ - name: "typescript"
35
+ version: "^5.2.0"
36
+
37
+ codeTemplates:
38
+ sdk:
39
+ engine: typescript
40
+ generator: "libs/instance-factories/sdks/templates/typescript/sdk-generator.ts"
41
+ outputPattern: "sdk-typescript/"
42
+
43
+ configuration:
44
+ packageName: "@specverse/sdk"
45
+ packageVersion: "1.0.0"
46
+ includeAuth: true
47
+ includeRetry: true
48
+ timeout: 30000
49
+ retries: 3
50
+
51
+ # NOTE: This implementation type wraps the existing generate-sdk-typescript.js script
52
+ # TODO: Future enhancement - Convert generate-sdk-typescript.js to native TypeScript template generator
53
+ # The current script is 900+ lines and generates a complete SDK package structure.
54
+ # Converting to native templates would require breaking it into multiple template files:
55
+ # - client-generator.ts (main client class)
56
+ # - resource-generator.ts (per-controller resource classes)
57
+ # - types-generator.ts (TypeScript interfaces)
58
+ # - errors-generator.ts (error classes)
59
+ # - package-generator.ts (package.json, tsconfig.json)
@@ -0,0 +1,55 @@
1
+ # Services Factory
2
+
3
+ Business logic generation with CURED operations and L3 behavior support.
4
+
5
+ ## Definition
6
+
7
+ | File | Description |
8
+ |------|-------------|
9
+ | `prisma-services.yaml` | Prisma-backed controllers and services with CRUD and event publishing |
10
+
11
+ ## Generated Output
12
+
13
+ | Generator | Output | Purpose |
14
+ |-----------|--------|---------|
15
+ | `controller-generator` | `backend/src/controllers/{model}Controller.ts` | Per-model CURED controllers (Create, Update, Read, Execute, Delete) |
16
+ | `service-generator` | `backend/src/services/{service}.ts` | Abstract business logic services (not tied to single model) |
17
+ | `behavior-generator` | (imported by above) | L3 behavior generation: preconditions, steps, postconditions, events |
18
+
19
+ ### Controller vs Service
20
+
21
+ - **Controllers** are model-specific — one per model, managing CURED operations and
22
+ event pub/sub for that model.
23
+ - **Services** are cross-cutting — they can interact with multiple models and
24
+ implement business workflows.
25
+
26
+ ### Behavior Generator (L3)
27
+
28
+ The behavior generator produces method bodies from behavioral metadata:
29
+ - **Preconditions** become guard checks (throw on violation)
30
+ - **Steps** become ordered business logic
31
+ - **Postconditions** become dev-mode assertions
32
+ - **publishes/sideEffects** become event publishing calls
33
+ - **transactional** wraps in `prisma.$transaction`
34
+
35
+ This is the third generation layer: L1 (schema) and L2 (CRUD) are handled by
36
+ the ORM and controller generators.
37
+
38
+ ## Technology
39
+
40
+ - **ORM**: @prisma/client ^5.5.0
41
+ - **Patterns**: CURED operations, event-driven, transactional
42
+
43
+ ## Capabilities
44
+
45
+ | Provides | Requires |
46
+ |----------|----------|
47
+ | `service.controller` | `orm.client` |
48
+ | `service.business` | |
49
+ | `service.crud` | |
50
+
51
+ ## Configuration
52
+
53
+ - `validation: true` — input validation enabled
54
+ - `eventPublishing: true` — events emitted on state changes
55
+ - `errorHandling: "throw"` — exceptions propagate to caller
@@ -0,0 +1,71 @@
1
+ name: PrismaServices
2
+ version: "1.0.0"
3
+ category: service
4
+ description: "Business logic services using Prisma client for data access"
5
+
6
+ metadata:
7
+ author: "SpecVerse Team"
8
+ license: "MIT"
9
+ tags: [services, business-logic, prisma, controllers]
10
+
11
+ compatibility:
12
+ specverse: ">=3.3.0"
13
+ node: ">=18.0.0"
14
+
15
+ capabilities:
16
+ provides:
17
+ - "service.controller" # Model-specific business logic (controllers)
18
+ - "service.business" # Abstract business logic (services)
19
+ - "service.crud" # CRUD operations
20
+ requires:
21
+ - "orm.client" # Needs Prisma client for data access
22
+
23
+ technology:
24
+ runtime: "node"
25
+ language: "typescript"
26
+ orm: "prisma"
27
+
28
+ dependencies:
29
+ runtime:
30
+ - name: "@prisma/client"
31
+ version: "^5.5.0"
32
+
33
+ dev:
34
+ - name: "@types/node"
35
+ version: "^20.8.0"
36
+ - name: "typescript"
37
+ version: "^5.2.0"
38
+
39
+ codeTemplates:
40
+ controllers:
41
+ engine: typescript
42
+ generator: "libs/instance-factories/services/templates/prisma/controller-generator.ts"
43
+ outputPattern: "{backendDir}/src/controllers/{model}Controller.ts"
44
+
45
+ services:
46
+ engine: typescript
47
+ generator: "libs/instance-factories/services/templates/prisma/service-generator.ts"
48
+ outputPattern: "{backendDir}/src/services/{service}.ts"
49
+
50
+ configuration:
51
+ outputStructure: "monorepo"
52
+ backendDir: "backend"
53
+
54
+ validation: true
55
+ eventPublishing: true
56
+ errorHandling: "throw"
57
+
58
+ # Requirements for generic scaffolding (runtime-agnostic structure)
59
+ requirements:
60
+ # Package dependencies (Node.js/npm-specific)
61
+ dependencies:
62
+ npm:
63
+ dependencies:
64
+ "@prisma/client": "^5.5.0"
65
+ # Services don't add extra scripts, they use the ones from Prisma
66
+
67
+ # No environment variables needed
68
+ environment: []
69
+
70
+ # No special configuration needed
71
+ configuration: {}
@@ -0,0 +1,34 @@
1
+ # Storage Instance Factory
2
+
3
+ Generates database connection configuration and Docker Compose files for three storage backends.
4
+
5
+ ## Definitions
6
+
7
+ - **`mongodb.yaml`** -- MongoDB 6 with sharding and replication support
8
+ - **`postgresql.yaml`** -- PostgreSQL 15 with production-tuned settings
9
+ - **`redis.yaml`** -- Redis 7 for caching and session management
10
+
11
+ ## Generators
12
+
13
+ Each backend has two generators under `templates/{backend}/`:
14
+
15
+ | Generator | Output Pattern | Purpose |
16
+ |---|---|---|
17
+ | `config-generator.ts` | `config/database.{instance}.ts` | Connection config with pool settings |
18
+ | `docker-generator.ts` | `docker/{service}.{instance}.yml` | Docker Compose service definition |
19
+
20
+ ## Capabilities
21
+
22
+ | Backend | Provides |
23
+ |---|---|
24
+ | MongoDB | `storage.database`, `storage.database.document`, `storage.database.nosql` |
25
+ | PostgreSQL | `storage.database`, `storage.database.relational`, `storage.database.sql` |
26
+ | Redis | `storage.cache`, `storage.cache.memory`, `storage.session` |
27
+
28
+ ## Default Configuration
29
+
30
+ - **MongoDB**: Pool 2-10, replication off by default, daily backups at 2am (7-day retention)
31
+ - **PostgreSQL**: Pool 2-10, 256MB shared buffers, 100 max connections, daily backups
32
+ - **Redis**: 256MB max memory, LRU eviction, AOF persistence, hourly backups
33
+
34
+ All backends use environment variables for credentials (`${DB_HOST}`, `${REDIS_PASSWORD}`, etc.).
@@ -0,0 +1,79 @@
1
+ name: MongoDB6
2
+ version: "1.0.0"
3
+ category: storage
4
+ description: "MongoDB 6 document database with sharding and replication support"
5
+
6
+ metadata:
7
+ author: "SpecVerse Team"
8
+ license: "MIT"
9
+ tags: [mongodb, database, nosql, document]
10
+
11
+ compatibility:
12
+ specverse: ">=3.3.0"
13
+ mongodb: ">=6.0"
14
+
15
+ capabilities:
16
+ provides:
17
+ - "storage.database"
18
+ - "storage.database.document"
19
+ - "storage.database.nosql"
20
+ - "database.mongodb"
21
+ requires: []
22
+
23
+ technology:
24
+ runtime: "node"
25
+ language: "typescript"
26
+ database: "mongodb"
27
+ version: "6.x"
28
+
29
+ dependencies:
30
+ runtime: [] # Database runs separately
31
+
32
+ dev:
33
+ - name: "mongodb"
34
+ version: "^6.3.0"
35
+ description: "MongoDB driver for Node.js"
36
+
37
+ codeTemplates:
38
+ config:
39
+ engine: typescript
40
+ generator: "libs/instance-factories/storage/templates/mongodb/config-generator.ts"
41
+ outputPattern: "config/database.{instance}.ts"
42
+
43
+ docker:
44
+ engine: typescript
45
+ generator: "libs/instance-factories/storage/templates/mongodb/docker-generator.ts"
46
+ outputPattern: "docker/mongodb.{instance}.yml"
47
+
48
+ configuration:
49
+ # Database connection
50
+ host: "${MONGO_HOST:-localhost}"
51
+ port: 27017
52
+ database: "${MONGO_DB}"
53
+ username: "${MONGO_USER}"
54
+ password: "${MONGO_PASSWORD}"
55
+ authSource: "admin"
56
+
57
+ # Connection options
58
+ options:
59
+ maxPoolSize: 10
60
+ minPoolSize: 2
61
+ serverSelectionTimeoutMS: 5000
62
+ socketTimeoutMS: 45000
63
+
64
+ # Replication
65
+ replication:
66
+ enabled: false
67
+ replSetName: "rs0"
68
+ replicas: 3
69
+
70
+ # Sharding
71
+ sharding:
72
+ enabled: false
73
+ shardKey: "_id"
74
+
75
+ # Backup
76
+ backup:
77
+ enabled: true
78
+ schedule: "0 2 * * *" # Daily at 2am
79
+ retention: 7 # days
@@ -0,0 +1,75 @@
1
+ name: PostgreSQL15
2
+ version: "1.0.0"
3
+ category: storage
4
+ description: "PostgreSQL 15 database with optimized configuration for production"
5
+
6
+ metadata:
7
+ author: "SpecVerse Team"
8
+ license: "MIT"
9
+ tags: [postgresql, database, sql, relational]
10
+
11
+ compatibility:
12
+ specverse: ">=3.3.0"
13
+ postgresql: ">=15.0"
14
+
15
+ capabilities:
16
+ provides:
17
+ - "storage.database"
18
+ - "storage.database.relational"
19
+ - "storage.database.sql"
20
+ - "database.postgresql"
21
+ requires: []
22
+
23
+ technology:
24
+ runtime: "node"
25
+ language: "typescript"
26
+ database: "postgresql"
27
+ version: "15.x"
28
+
29
+ dependencies:
30
+ runtime: [] # Database runs separately
31
+
32
+ dev:
33
+ - name: "pg"
34
+ version: "^8.11.0"
35
+ description: "PostgreSQL client for Node.js"
36
+
37
+ codeTemplates:
38
+ config:
39
+ engine: typescript
40
+ generator: "libs/instance-factories/storage/templates/postgresql/config-generator.ts"
41
+ outputPattern: "config/database.{instance}.ts"
42
+
43
+ docker:
44
+ engine: typescript
45
+ generator: "libs/instance-factories/storage/templates/postgresql/docker-generator.ts"
46
+ outputPattern: "docker/postgres.{instance}.yml"
47
+
48
+ configuration:
49
+ # Database connection
50
+ host: "${DB_HOST:-localhost}"
51
+ port: 5432
52
+ database: "${DB_NAME}"
53
+ username: "${DB_USER}"
54
+ password: "${DB_PASSWORD}"
55
+
56
+ # Connection pool
57
+ pool:
58
+ min: 2
59
+ max: 10
60
+ idleTimeoutMillis: 30000
61
+ connectionTimeoutMillis: 2000
62
+
63
+ # Performance
64
+ settings:
65
+ max_connections: 100
66
+ shared_buffers: "256MB"
67
+ effective_cache_size: "1GB"
68
+ work_mem: "16MB"
69
+ maintenance_work_mem: "128MB"
70
+
71
+ # Backup
72
+ backup:
73
+ enabled: true
74
+ schedule: "0 2 * * *" # Daily at 2am
75
+ retention: 7 # days
@@ -0,0 +1,79 @@
1
+ name: Redis7
2
+ version: "1.0.0"
3
+ category: storage
4
+ description: "Redis 7 in-memory data store for caching and session management"
5
+
6
+ metadata:
7
+ author: "SpecVerse Team"
8
+ license: "MIT"
9
+ tags: [redis, cache, session, key-value]
10
+
11
+ compatibility:
12
+ specverse: ">=3.3.0"
13
+ redis: ">=7.0"
14
+
15
+ capabilities:
16
+ provides:
17
+ - "storage.cache"
18
+ - "storage.cache.memory"
19
+ - "storage.session"
20
+ - "database.redis"
21
+ requires: []
22
+
23
+ technology:
24
+ runtime: "node"
25
+ language: "typescript"
26
+ database: "redis"
27
+ version: "7.x"
28
+
29
+ dependencies:
30
+ runtime: [] # Database runs separately
31
+
32
+ dev:
33
+ - name: "redis"
34
+ version: "^4.6.0"
35
+ description: "Redis client for Node.js"
36
+ - name: "@types/redis"
37
+ version: "^4.0.11"
38
+
39
+ codeTemplates:
40
+ config:
41
+ engine: typescript
42
+ generator: "libs/instance-factories/storage/templates/redis/config-generator.ts"
43
+ outputPattern: "config/cache.{instance}.ts"
44
+
45
+ docker:
46
+ engine: typescript
47
+ generator: "libs/instance-factories/storage/templates/redis/docker-generator.ts"
48
+ outputPattern: "docker/redis.{instance}.yml"
49
+
50
+ configuration:
51
+ # Connection
52
+ host: "${REDIS_HOST:-localhost}"
53
+ port: 6379
54
+ password: "${REDIS_PASSWORD}"
55
+ database: 0
56
+
57
+ # Connection options
58
+ options:
59
+ connectTimeout: 10000
60
+ commandTimeout: 5000
61
+ retryStrategy: "exponential"
62
+ maxRetriesPerRequest: 3
63
+
64
+ # Memory management
65
+ memory:
66
+ maxMemory: "256mb"
67
+ evictionPolicy: "allkeys-lru"
68
+
69
+ # Persistence
70
+ persistence:
71
+ enabled: true
72
+ strategy: "aof" # append-only file
73
+ fsync: "everysec"
74
+
75
+ # Backup
76
+ backup:
77
+ enabled: true
78
+ schedule: "0 * * * *" # Hourly
79
+ retention: 24 # hours
@@ -0,0 +1,40 @@
1
+ # Testing Instance Factory
2
+
3
+ Generates a comprehensive Vitest test suite from a SpecVerse specification, covering unit, integration, and end-to-end tests.
4
+
5
+ ## Definition
6
+
7
+ - **`vitest-tests.yaml`** -- Single definition for the full test suite (category: `service`).
8
+
9
+ ## Generator
10
+
11
+ - `templates/vitest/tests-generator.ts` -- Wraps `generate-tests.js` (700+ lines). Produces a complete test directory structure.
12
+
13
+ ## Capabilities
14
+
15
+ | Capability | Description |
16
+ |---|---|
17
+ | `testing.unit` | Service-layer unit tests |
18
+ | `testing.integration` | Route integration tests |
19
+ | `testing.e2e` | End-to-end workflow tests |
20
+
21
+ ## What Gets Generated
22
+
23
+ - Unit tests for each service
24
+ - Integration tests for each route
25
+ - End-to-end tests for cross-model workflows
26
+ - Test data fixtures
27
+ - Prisma and EventBus mocks
28
+ - Database and server setup utilities
29
+
30
+ ## Default Configuration
31
+
32
+ All five generation flags are enabled by default: `generateUnitTests`, `generateIntegrationTests`, `generateE2ETests`, `generateFixtures`, `generateMocks`.
33
+
34
+ ## Dependencies
35
+
36
+ Vitest 1.x with `@vitest/ui` for interactive test reporting.
37
+
38
+ ## Status
39
+
40
+ Wrapper implementation. Future TODO to split into dedicated generators per test tier (unit, integration, e2e, fixtures, mocks, setup).
@@ -0,0 +1,63 @@
1
+ name: VitestTests
2
+ version: "1.0.0"
3
+ category: service
4
+ description: "Comprehensive test suite generator with Vitest - unit, integration, and e2e tests"
5
+
6
+ metadata:
7
+ author: "SpecVerse Team"
8
+ license: "MIT"
9
+ tags: [vitest, testing, typescript, unit, integration, e2e]
10
+
11
+ compatibility:
12
+ specverse: ">=3.3.0"
13
+ node: ">=18.0.0"
14
+
15
+ capabilities:
16
+ provides:
17
+ - "testing.unit"
18
+ - "testing.integration"
19
+ - "testing.e2e"
20
+ requires:
21
+ - "api.rest"
22
+
23
+ technology:
24
+ runtime: "node"
25
+ language: "typescript"
26
+ testFramework: "vitest"
27
+ testRunner: "vitest"
28
+
29
+ dependencies:
30
+ dev:
31
+ - name: "vitest"
32
+ version: "^1.0.0"
33
+ - name: "@vitest/ui"
34
+ version: "^1.0.0"
35
+ - name: "@types/node"
36
+ version: "^20.8.0"
37
+ - name: "typescript"
38
+ version: "^5.2.0"
39
+
40
+ codeTemplates:
41
+ tests:
42
+ engine: typescript
43
+ generator: "libs/instance-factories/testing/templates/vitest/tests-generator.ts"
44
+ outputPattern: "tests/"
45
+
46
+ configuration:
47
+ testFramework: "vitest"
48
+ generateUnitTests: true
49
+ generateIntegrationTests: true
50
+ generateE2ETests: true
51
+ generateFixtures: true
52
+ generateMocks: true
53
+
54
+ # NOTE: This implementation type wraps the existing generate-tests.js script
55
+ # TODO: Future enhancement - Convert generate-tests.js to native TypeScript template generator
56
+ # The current script is 700+ lines and generates a complete test suite structure.
57
+ # Converting to native templates would require breaking it into multiple template files:
58
+ # - unit-tests-generator.ts (service layer unit tests)
59
+ # - integration-tests-generator.ts (route integration tests)
60
+ # - e2e-tests-generator.ts (end-to-end workflow tests)
61
+ # - fixtures-generator.ts (test data fixtures)
62
+ # - mocks-generator.ts (Prisma and EventBus mocks)
63
+ # - setup-generator.ts (database and server setup utilities)
@@ -0,0 +1,70 @@
1
+ # Tools Instance Factory
2
+
3
+ Generates two complete developer tool packages from a SpecVerse specification: an MCP (Model Context Protocol) server and a VSCode extension. Unlike most other instance factories, these are **not wrappers** -- they are native TypeScript generators that ship substantial static asset trees.
4
+
5
+ ## Generators
6
+
7
+ ### MCP Server (`templates/mcp/`)
8
+
9
+ **`mcp-server-generator.ts`** generates a fully functional MCP server by:
10
+
11
+ 1. Copying the `static/` framework (a complete Node.js project with 9 service classes)
12
+ 2. Extracting tools, resources, and CLI commands from the spec
13
+ 3. Generating `src/generated/spec-registry.ts` with spec-driven tool/resource registration
14
+
15
+ The static framework includes:
16
+
17
+ - **Server**: `mcp-server.ts` -- StdioServerTransport-based MCP server with event handling
18
+ - **Controller**: `MCPServerController.ts` -- Request routing and lifecycle management
19
+ - **Services**: 9 service classes including `CLIProxyService`, `HybridResourcesProvider`, `OrchestratorBridge`, `LibraryToolsService`, `PromptToolsService`, `EntityModuleService`, and others
20
+ - **Deployment targets**: Local (stdio), Web (HTTP), Extension (embedded), Enterprise (Docker)
21
+ - **Build scripts**: Per-deployment builders (`build-local.js`, `build-web.js`, `build-extension.js`, `build-enterprise.js`)
22
+ - **Tests**: Unit tests for `CLIProxyService` and `ResourcesProviderService`
23
+ - **Docs**: Deployment guides (local, web, extension) and hybrid resource system documentation
24
+
25
+ The generated MCP server exposes tools like `specverse-create`, `specverse-analyse`, `specverse-validate`, `specverse-realize`, and `specverse-suggest`, plus resources for schema, conventions, library catalog, and prompt templates.
26
+
27
+ **Package**: `@specverse/mcp` v3.5.2, depends on `@modelcontextprotocol/sdk` and `@specverse/lang`.
28
+
29
+ ### VSCode Extension (`templates/vscode/`)
30
+
31
+ **`vscode-extension-generator.ts`** generates a publishable VSCode extension by:
32
+
33
+ 1. Extracting CLI commands from the spec (with nested subcommand support)
34
+ 2. Extracting entity type keywords for syntax highlighting
35
+ 3. Generating `package.json` with commands, keybindings, and contributes
36
+ 4. Copying static assets and generating an esbuild script
37
+
38
+ The static assets include:
39
+
40
+ - **`extension.ts`** -- Extension activation and command registration
41
+ - **`syntaxes/specverse.tmLanguage.json`** -- TextMate grammar for `.specly` files
42
+ - **`themes/`** -- Four color theme variants (basic, complete, colors, complete-colors)
43
+ - **`schemas/specverse-v3-schema.json`** -- JSON Schema for in-editor validation
44
+ - **`language-configuration.json`** -- Bracket matching, auto-closing, comment toggling
45
+
46
+ ## Output Structure
47
+
48
+ ```
49
+ tools/
50
+ specverse-mcp/ # Complete MCP server project
51
+ src/
52
+ controllers/
53
+ events/
54
+ interfaces/
55
+ models/
56
+ server/
57
+ services/
58
+ generated/ # <-- spec-driven registry (generated)
59
+ scripts/
60
+ docs/
61
+ package.json
62
+ tsconfig.json
63
+ vscode-extension/ # Complete VSCode extension project
64
+ src/extension.ts
65
+ syntaxes/
66
+ themes/
67
+ schemas/
68
+ scripts/build.js
69
+ package.json
70
+ ```
@@ -0,0 +1,36 @@
1
+ name: MCPServer
2
+ version: "4.0.0"
3
+ category: tools
4
+ description: "MCP server exposing services as AI-accessible tools via the Model Context Protocol"
5
+
6
+ metadata:
7
+ author: "SpecVerse Team"
8
+ license: "MIT"
9
+ tags: [mcp, ai, tools, claude, llm]
10
+
11
+ compatibility:
12
+ specverse: "^4.0.0"
13
+ node: ">=18.0.0"
14
+
15
+ capabilities:
16
+ provides:
17
+ - "tools.mcp"
18
+ - "tools.mcp.server"
19
+ requires:
20
+ - "service.controller"
21
+
22
+ technology:
23
+ runtime: "node"
24
+ language: "typescript"
25
+ framework: "@modelcontextprotocol/sdk"
26
+
27
+ dependencies:
28
+ runtime:
29
+ - name: "@modelcontextprotocol/sdk"
30
+ version: "^1.0.0"
31
+
32
+ codeTemplates:
33
+ mcp-server:
34
+ engine: typescript
35
+ generator: "libs/instance-factories/tools/templates/mcp/mcp-server-generator.ts"
36
+ outputPattern: "tools/specverse-mcp/"