@specverse/engines 6.7.8 → 6.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/behavior-ai-service.js +2 -2
- package/dist/ai/behavior-ai-service.js.map +1 -1
- package/dist/inference/core/specly-converter.d.ts.map +1 -1
- package/dist/inference/core/specly-converter.js +20 -0
- package/dist/inference/core/specly-converter.js.map +1 -1
- package/dist/inference/index.d.ts.map +1 -1
- package/dist/inference/index.js +72 -22
- package/dist/inference/index.js.map +1 -1
- package/dist/inference/logical/generators/controller-generator.d.ts.map +1 -1
- package/dist/inference/logical/generators/controller-generator.js +26 -4
- package/dist/inference/logical/generators/controller-generator.js.map +1 -1
- package/dist/libs/instance-factories/applications/templates/generic/backend-package-json-generator.js +22 -5
- package/dist/libs/instance-factories/controllers/templates/fastify/routes-generator.js +50 -15
- package/dist/libs/instance-factories/controllers/templates/fastify/server-generator.js +26 -6
- package/dist/libs/instance-factories/services/postgres-native-services.yaml +90 -0
- package/dist/libs/instance-factories/services/templates/_shared/step-matching.js +44 -0
- package/dist/libs/instance-factories/services/templates/mongodb-native/controller-generator.js +68 -13
- package/dist/libs/instance-factories/services/templates/mongodb-native/step-conventions.js +515 -0
- package/dist/libs/instance-factories/services/templates/postgres-native/client-generator.js +165 -0
- package/dist/libs/instance-factories/services/templates/postgres-native/controller-generator.js +300 -0
- package/dist/libs/instance-factories/services/templates/postgres-native/ddl-generator.js +169 -0
- package/dist/libs/instance-factories/services/templates/postgres-native/service-generator.js +65 -0
- package/dist/libs/instance-factories/services/templates/postgres-native/step-conventions.js +433 -0
- package/dist/libs/instance-factories/services/templates/prisma/ai-behaviors-generator.js +27 -4
- package/dist/libs/instance-factories/services/templates/prisma/step-conventions.js +7 -34
- package/dist/parser/processors/ExecutableProcessor.d.ts.map +1 -1
- package/dist/parser/processors/ExecutableProcessor.js +14 -1
- package/dist/parser/processors/ExecutableProcessor.js.map +1 -1
- package/dist/realize/index.d.ts.map +1 -1
- package/dist/realize/index.js +30 -3
- package/dist/realize/index.js.map +1 -1
- package/libs/instance-factories/applications/templates/generic/backend-package-json-generator.ts +46 -24
- package/libs/instance-factories/controllers/templates/fastify/routes-generator.ts +80 -21
- package/libs/instance-factories/controllers/templates/fastify/server-generator.ts +48 -7
- package/libs/instance-factories/services/postgres-native-services.yaml +90 -0
- package/libs/instance-factories/services/templates/_shared/step-matching.ts +103 -0
- package/libs/instance-factories/services/templates/mongodb-native/controller-generator.ts +97 -23
- package/libs/instance-factories/services/templates/mongodb-native/step-conventions.ts +691 -0
- package/libs/instance-factories/services/templates/postgres-native/__tests__/controller-generator.test.ts +193 -0
- package/libs/instance-factories/services/templates/postgres-native/client-generator.ts +178 -0
- package/libs/instance-factories/services/templates/postgres-native/controller-generator.ts +372 -0
- package/libs/instance-factories/services/templates/postgres-native/ddl-generator.ts +236 -0
- package/libs/instance-factories/services/templates/postgres-native/service-generator.ts +84 -0
- package/libs/instance-factories/services/templates/postgres-native/step-conventions.ts +539 -0
- package/libs/instance-factories/services/templates/prisma/ai-behaviors-generator.ts +61 -7
- package/libs/instance-factories/services/templates/prisma/step-conventions.ts +21 -68
- package/package.json +4 -3
|
@@ -3,45 +3,25 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Each convention maps a natural language step pattern to generated code.
|
|
5
5
|
* Patterns are tried in order; first match wins. Unmatched steps get stubs.
|
|
6
|
+
*
|
|
7
|
+
* The match-walker + toMethod/toVar identifier helpers live in
|
|
8
|
+
* `../_shared/step-matching.ts` so the same machinery powers
|
|
9
|
+
* `mongodb-native/step-conventions.ts`. This file is now (almost
|
|
10
|
+
* entirely) the prisma-specific conventions array. (#43K-D)
|
|
6
11
|
*/
|
|
7
12
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export interface StepContext {
|
|
16
|
-
modelName: string;
|
|
17
|
-
prismaModel: string;
|
|
18
|
-
serviceName: string;
|
|
19
|
-
operationName: string;
|
|
20
|
-
stepNum: number;
|
|
21
|
-
/** Parameter names from the action (e.g., ['pollId', 'optionId']) */
|
|
22
|
-
parameterNames?: string[];
|
|
23
|
-
/** Variables already declared (to avoid redeclaration) */
|
|
24
|
-
declaredVars?: Set<string>;
|
|
25
|
-
/** Named result variable (from spec's `as:` clause) */
|
|
26
|
-
resultName?: string;
|
|
27
|
-
}
|
|
13
|
+
import {
|
|
14
|
+
toMethod,
|
|
15
|
+
toVar,
|
|
16
|
+
matchAgainstConventions,
|
|
17
|
+
type SharedConvention,
|
|
18
|
+
type SharedStepContext,
|
|
19
|
+
} from '../_shared/step-matching.js';
|
|
28
20
|
|
|
29
|
-
|
|
30
|
-
return name.charAt(0).toLowerCase() + name.slice(1);
|
|
31
|
-
}
|
|
21
|
+
export type StepConvention = SharedConvention<StepContext>;
|
|
32
22
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// parens, etc.) so step text like "Compile via expr-eval Parser" yields
|
|
36
|
-
// "compileViaExprEvalParser", not "compileViaExpr-evalParser" (which is
|
|
37
|
-
// not a valid TypeScript identifier and breaks esbuild downstream).
|
|
38
|
-
const cleaned = words.trim().replace(/[^A-Za-z0-9\s]+/g, ' ');
|
|
39
|
-
const camel = cleaned.replace(/\s+(.)/g, (_, c) => c.toUpperCase()).replace(/^\w/, c => c.toLowerCase());
|
|
40
|
-
// Strip any remaining non-identifier chars (digits at start, etc.) and
|
|
41
|
-
// ensure the result is a valid TS identifier. If the input collapses to
|
|
42
|
-
// the empty string, fall back to a generic name.
|
|
43
|
-
const safe = camel.replace(/[^A-Za-z0-9_$]/g, '');
|
|
44
|
-
return safe || 'unnamedStep';
|
|
23
|
+
export interface StepContext extends SharedStepContext {
|
|
24
|
+
prismaModel: string;
|
|
45
25
|
}
|
|
46
26
|
|
|
47
27
|
/**
|
|
@@ -367,37 +347,10 @@ export function matchStep(
|
|
|
367
347
|
inputs?: string[];
|
|
368
348
|
resultVar?: string;
|
|
369
349
|
} {
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
matched: true,
|
|
377
|
-
};
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
// No match — pure AI function call
|
|
382
|
-
// Inputs = all variables declared by previous steps + operation parameters
|
|
383
|
-
const functionName = toMethod(step);
|
|
384
|
-
const declared = Array.from(ctx.declaredVars || []);
|
|
385
|
-
const paramNames = ctx.parameterNames || [];
|
|
386
|
-
const inputs = [...paramNames, ...declared];
|
|
387
|
-
|
|
388
|
-
// Use named result from spec (`as:`) or default to stepNResult
|
|
389
|
-
const resultVar = ctx.resultName || `step${ctx.stepNum}Result`;
|
|
390
|
-
const inputObj = inputs.length > 0 ? `{ ${inputs.join(', ')} }` : '{}';
|
|
391
|
-
|
|
392
|
-
// Register the result variable so subsequent steps can reference it
|
|
393
|
-
if (ctx.declaredVars) ctx.declaredVars.add(resultVar);
|
|
394
|
-
|
|
395
|
-
return {
|
|
396
|
-
call: ` // Step ${ctx.stepNum}: ${step} [AI-generated — pure function]
|
|
397
|
-
const ${resultVar} = await aiBehaviors.${functionName}(${inputObj});`,
|
|
398
|
-
matched: false,
|
|
399
|
-
functionName,
|
|
400
|
-
inputs,
|
|
401
|
-
resultVar,
|
|
402
|
-
};
|
|
350
|
+
// Prisma's AI-fallback uses plain field shorthand `{ a, b, c }` (no
|
|
351
|
+
// `args.X` indirection — the controller-generator destructures params
|
|
352
|
+
// at function entry).
|
|
353
|
+
const aiArgsExpr = (inputs: string[], _paramNames: string[]) =>
|
|
354
|
+
inputs.length > 0 ? `{ ${inputs.join(', ')} }` : '{}';
|
|
355
|
+
return matchAgainstConventions(step, ctx, STEP_CONVENTIONS, aiArgsExpr);
|
|
403
356
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@specverse/engines",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.16.0",
|
|
4
4
|
"description": "SpecVerse toolchain — parser, inference, realize, generators, AI, registry, bundles",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -61,8 +61,9 @@
|
|
|
61
61
|
"@ai-sdk/anthropic": "^3.0.71",
|
|
62
62
|
"@ai-sdk/openai-compatible": "^2.0.41",
|
|
63
63
|
"@ai-sdk/provider": "^3.0.8",
|
|
64
|
-
"@specverse/assets": "^1.
|
|
65
|
-
"@specverse/
|
|
64
|
+
"@specverse/assets": "^1.10.2",
|
|
65
|
+
"@specverse/engines": "^6.15.0",
|
|
66
|
+
"@specverse/entities": "^5.2.2",
|
|
66
67
|
"@specverse/runtime": "^5.0.1",
|
|
67
68
|
"@specverse/types": "^5.1.0",
|
|
68
69
|
"ai": "^6.0.168",
|