@lssm/module.contractspec-workspace 0.0.0-canary-20251217083314 → 1.41.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/code-generation.js +13 -50
- package/dist/ai/spec-creation.js +18 -50
- package/dist/analysis/deps/graph.js +2 -84
- package/dist/analysis/deps/parse-imports.js +1 -30
- package/dist/analysis/diff/semantic.js +1 -96
- package/dist/analysis/feature-scan.js +1 -151
- package/dist/analysis/spec-scan.js +1 -344
- package/dist/analysis/validate/spec-structure.js +1 -122
- package/dist/index.js +1 -25
- package/dist/templates/app-config.js +28 -100
- package/dist/templates/data-view.js +27 -41
- package/dist/templates/event.js +14 -28
- package/dist/templates/experiment.js +51 -76
- package/dist/templates/handler.js +17 -49
- package/dist/templates/integration-utils.js +26 -97
- package/dist/templates/integration.js +23 -46
- package/dist/templates/knowledge.js +19 -59
- package/dist/templates/migration.js +26 -49
- package/dist/templates/operation.js +28 -40
- package/dist/templates/presentation.js +20 -45
- package/dist/templates/telemetry.js +53 -73
- package/dist/templates/utils.js +1 -38
- package/dist/templates/workflow-runner.js +6 -12
- package/dist/templates/workflow.js +24 -50
- package/dist/types/generation-types.js +1 -20
- package/package.json +6 -7
- package/dist/ai/code-generation.d.ts +0 -27
- package/dist/ai/spec-creation.d.ts +0 -26
- package/dist/analysis/deps/graph.d.ts +0 -33
- package/dist/analysis/deps/parse-imports.d.ts +0 -16
- package/dist/analysis/diff/semantic.d.ts +0 -10
- package/dist/analysis/feature-scan.d.ts +0 -14
- package/dist/analysis/spec-scan.d.ts +0 -33
- package/dist/analysis/validate/spec-structure.d.ts +0 -10
- package/dist/index.d.ts +0 -26
- package/dist/templates/app-config.d.ts +0 -6
- package/dist/templates/data-view.d.ts +0 -6
- package/dist/templates/event.d.ts +0 -10
- package/dist/templates/experiment.d.ts +0 -6
- package/dist/templates/handler.d.ts +0 -19
- package/dist/templates/integration.d.ts +0 -6
- package/dist/templates/knowledge.d.ts +0 -6
- package/dist/templates/migration.d.ts +0 -6
- package/dist/templates/operation.d.ts +0 -10
- package/dist/templates/presentation.d.ts +0 -10
- package/dist/templates/telemetry.d.ts +0 -6
- package/dist/templates/utils.d.ts +0 -26
- package/dist/templates/workflow-runner.d.ts +0 -15
- package/dist/templates/workflow.d.ts +0 -10
- package/dist/types/analysis-types.d.ts +0 -125
- package/dist/types/generation-types.d.ts +0 -83
- package/dist/types/spec-types.d.ts +0 -344
|
@@ -1,89 +1,69 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
type: '${
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
${prop.required ? "required: true," : ""}
|
|
16
|
-
${prop.pii ? "pii: true," : ""}
|
|
17
|
-
${prop.redact ? "redact: true," : ""}
|
|
18
|
-
${prop.description ? `description: '${escapeString(prop.description)}',` : ""}
|
|
19
|
-
}`).join(",\n");
|
|
20
|
-
const anomalyRules = event.anomalyRules?.length ? ` anomalyDetection: {
|
|
1
|
+
import{toPascalCase as e}from"./utils.js";function t(t){let i=e(t.name.split(`.`).pop()??`Telemetry`)+`Telemetry`,a=t.providers?.length?`providers: [
|
|
2
|
+
${t.providers.map(e=>` {
|
|
3
|
+
type: '${e.type}',
|
|
4
|
+
config: ${r(e.config)},
|
|
5
|
+
}`).join(`,
|
|
6
|
+
`)}
|
|
7
|
+
],`:``,o=t.events.map(e=>{let t=e.properties.map(e=>` '${e.name}': {
|
|
8
|
+
type: '${e.type}',
|
|
9
|
+
${e.required?`required: true,`:``}
|
|
10
|
+
${e.pii?`pii: true,`:``}
|
|
11
|
+
${e.redact?`redact: true,`:``}
|
|
12
|
+
${e.description?`description: '${n(e.description)}',`:``}
|
|
13
|
+
}`).join(`,
|
|
14
|
+
`),r=e.anomalyRules?.length?` anomalyDetection: {
|
|
21
15
|
enabled: true,
|
|
22
|
-
${typeof
|
|
16
|
+
${typeof e.anomalyMinimumSample==`number`?`minimumSample: ${e.anomalyMinimumSample},`:``}
|
|
23
17
|
thresholds: [
|
|
24
|
-
${
|
|
25
|
-
metric: '${
|
|
26
|
-
${typeof
|
|
27
|
-
${typeof
|
|
28
|
-
}`).join(
|
|
18
|
+
${e.anomalyRules.map(e=>` {
|
|
19
|
+
metric: '${n(e.metric)}',
|
|
20
|
+
${typeof e.min==`number`?`min: ${e.min},`:``}
|
|
21
|
+
${typeof e.max==`number`?`max: ${e.max},`:``}
|
|
22
|
+
}`).join(`,
|
|
23
|
+
`)}
|
|
29
24
|
],
|
|
30
|
-
actions: [${(
|
|
31
|
-
}
|
|
25
|
+
actions: [${(e.anomalyActions??[]).map(e=>`'${e}'`).join(`, `)}],
|
|
26
|
+
},`:e.anomalyEnabled?` anomalyDetection: {
|
|
32
27
|
enabled: true,
|
|
33
|
-
${typeof
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
version: ${event.version},
|
|
28
|
+
${typeof e.anomalyMinimumSample==`number`?`minimumSample: ${e.anomalyMinimumSample},`:``}
|
|
29
|
+
},`:``;return` {
|
|
30
|
+
name: '${n(e.name)}',
|
|
31
|
+
version: ${e.version},
|
|
38
32
|
semantics: {
|
|
39
|
-
what: '${
|
|
40
|
-
${
|
|
41
|
-
${
|
|
33
|
+
what: '${n(e.what)}',
|
|
34
|
+
${e.who?`who: '${n(e.who)}',`:``}
|
|
35
|
+
${e.why?`why: '${n(e.why)}',`:``}
|
|
42
36
|
},
|
|
43
|
-
privacy: '${
|
|
37
|
+
privacy: '${e.privacy}',
|
|
44
38
|
properties: {
|
|
45
|
-
${
|
|
39
|
+
${t}
|
|
46
40
|
},
|
|
47
|
-
${typeof
|
|
48
|
-
${typeof
|
|
49
|
-
${
|
|
50
|
-
${
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return `import type { TelemetrySpec } from '@lssm/lib.contracts/telemetry';
|
|
41
|
+
${typeof e.retentionDays==`number`?`retention: { days: ${e.retentionDays}, ${e.retentionPolicy?`policy: '${e.retentionPolicy}'`:``} },`:``}
|
|
42
|
+
${typeof e.samplingRate==`number`?`sampling: { rate: ${e.samplingRate}${e.samplingConditions?`, conditions: ['${n(e.samplingConditions)}']`:``} },`:``}
|
|
43
|
+
${r}
|
|
44
|
+
${e.tags?.length?`tags: [${e.tags.map(e=>`'${n(e)}'`).join(`, `)}],`:``}
|
|
45
|
+
}`}).join(`,
|
|
46
|
+
`);return`import type { TelemetrySpec } from '@lssm/lib.contracts/telemetry';
|
|
54
47
|
|
|
55
|
-
export const ${
|
|
48
|
+
export const ${i}: TelemetrySpec = {
|
|
56
49
|
meta: {
|
|
57
|
-
name: '${
|
|
58
|
-
version: ${
|
|
59
|
-
title: '${
|
|
60
|
-
description: '${
|
|
61
|
-
domain: '${
|
|
62
|
-
owners: [${
|
|
63
|
-
tags: [${
|
|
64
|
-
stability: '${
|
|
50
|
+
name: '${n(t.name)}',
|
|
51
|
+
version: ${t.version},
|
|
52
|
+
title: '${n(t.name)} telemetry',
|
|
53
|
+
description: '${n(t.description||`Describe the purpose of this telemetry spec.`)}',
|
|
54
|
+
domain: '${n(t.domain)}',
|
|
55
|
+
owners: [${t.owners.map(e=>`'${n(e)}'`).join(`, `)}],
|
|
56
|
+
tags: [${t.tags.map(e=>`'${n(e)}'`).join(`, `)}],
|
|
57
|
+
stability: '${t.stability}',
|
|
65
58
|
},
|
|
66
59
|
config: {
|
|
67
|
-
${typeof
|
|
68
|
-
${typeof
|
|
69
|
-
${
|
|
70
|
-
${
|
|
60
|
+
${typeof t.defaultRetentionDays==`number`?`defaultRetentionDays: ${t.defaultRetentionDays},`:``}
|
|
61
|
+
${typeof t.defaultSamplingRate==`number`?`defaultSamplingRate: ${t.defaultSamplingRate},`:``}
|
|
62
|
+
${t.anomalyEnabled?`anomalyDetection: { enabled: true${typeof t.anomalyCheckIntervalMs==`number`?`, checkIntervalMs: ${t.anomalyCheckIntervalMs}`:``} },`:``}
|
|
63
|
+
${a}
|
|
71
64
|
},
|
|
72
65
|
events: [
|
|
73
|
-
${
|
|
66
|
+
${o}
|
|
74
67
|
],
|
|
75
68
|
};
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
function escapeString(value) {
|
|
79
|
-
return value.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
|
|
80
|
-
}
|
|
81
|
-
function formatConfigValue(value) {
|
|
82
|
-
const trimmed = value.trim();
|
|
83
|
-
if (!trimmed) return "{}";
|
|
84
|
-
if (trimmed.startsWith("{") && trimmed.endsWith("}") || trimmed.startsWith("[") && trimmed.endsWith("]")) return trimmed;
|
|
85
|
-
return `'${escapeString(trimmed)}'`;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
//#endregion
|
|
89
|
-
export { generateTelemetrySpec };
|
|
69
|
+
`}function n(e){return e.replace(/\\/g,`\\\\`).replace(/'/g,`\\'`)}function r(e){let t=e.trim();return t?t.startsWith(`{`)&&t.endsWith(`}`)||t.startsWith(`[`)&&t.endsWith(`]`)?t:`'${n(t)}'`:`{}`}export{t as generateTelemetrySpec};
|
package/dist/templates/utils.js
CHANGED
|
@@ -1,38 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Utility functions for template generation.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Convert string to camelCase.
|
|
7
|
-
*/
|
|
8
|
-
function toCamelCase(str) {
|
|
9
|
-
const pascal = toPascalCase(str);
|
|
10
|
-
return pascal.charAt(0).toLowerCase() + pascal.slice(1);
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Convert string to PascalCase.
|
|
14
|
-
*/
|
|
15
|
-
function toPascalCase(str) {
|
|
16
|
-
return str.split(/[-_.]/).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("");
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Convert string to kebab-case.
|
|
20
|
-
*/
|
|
21
|
-
function toKebabCase(str) {
|
|
22
|
-
return str.replace(/\./g, "-").replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Capitalize first letter.
|
|
26
|
-
*/
|
|
27
|
-
function capitalize(str) {
|
|
28
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Escape single quotes in string.
|
|
32
|
-
*/
|
|
33
|
-
function escapeString(value) {
|
|
34
|
-
return value.replace(/'/g, "\\'");
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
//#endregion
|
|
38
|
-
export { capitalize, escapeString, toCamelCase, toKebabCase, toPascalCase };
|
|
1
|
+
function e(e){let n=t(e);return n.charAt(0).toLowerCase()+n.slice(1)}function t(e){return e.split(/[-_.]/).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}function n(e){return e.replace(/\./g,`-`).replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}function r(e){return e.charAt(0).toUpperCase()+e.slice(1)}function i(e){return e.replace(/'/g,`\\'`)}export{r as capitalize,i as escapeString,e as toCamelCase,n as toKebabCase,t as toPascalCase};
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
function generateWorkflowRunnerTemplate({ exportName, specImportPath, runnerName, workflowName }) {
|
|
3
|
-
return `import {
|
|
1
|
+
function e({exportName:e,specImportPath:t,runnerName:n,workflowName:r}){return`import {
|
|
4
2
|
InMemoryStateStore,
|
|
5
3
|
WorkflowRegistry,
|
|
6
4
|
WorkflowRunner,
|
|
7
5
|
} from '@lssm/lib.contracts/workflow';
|
|
8
|
-
import { ${
|
|
6
|
+
import { ${e} } from '${t}';
|
|
9
7
|
|
|
10
8
|
/**
|
|
11
|
-
* Runner wiring for ${
|
|
9
|
+
* Runner wiring for ${r}.
|
|
12
10
|
*
|
|
13
11
|
* TODO:
|
|
14
12
|
* - Replace the in-memory state store with a persistent adapter if needed.
|
|
@@ -16,11 +14,11 @@ import { ${exportName} } from '${specImportPath}';
|
|
|
16
14
|
* - Wire eventEmitter to telemetry sinks.
|
|
17
15
|
*/
|
|
18
16
|
const registry = new WorkflowRegistry();
|
|
19
|
-
registry.register(${
|
|
17
|
+
registry.register(${e});
|
|
20
18
|
|
|
21
19
|
const stateStore = new InMemoryStateStore();
|
|
22
20
|
|
|
23
|
-
export const ${
|
|
21
|
+
export const ${n} = new WorkflowRunner({
|
|
24
22
|
registry,
|
|
25
23
|
stateStore,
|
|
26
24
|
opExecutor: async (operation, input, ctx) => {
|
|
@@ -41,8 +39,4 @@ export const ${runnerName} = new WorkflowRunner({
|
|
|
41
39
|
// TODO: forward workflow events to telemetry or logging sinks
|
|
42
40
|
},
|
|
43
41
|
});
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
//#endregion
|
|
48
|
-
export { generateWorkflowRunnerTemplate };
|
|
42
|
+
`}export{e as generateWorkflowRunnerTemplate};
|
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const specVarName = toPascalCase(data.name.split(".").pop() ?? "Workflow") + "Workflow";
|
|
9
|
-
const stepsCode = data.steps.map((step) => formatStep(step)).join(",\n");
|
|
10
|
-
const transitionsCode = data.transitions.map((transition) => ` {
|
|
11
|
-
from: '${transition.from}',
|
|
12
|
-
to: '${transition.to}',
|
|
13
|
-
${transition.condition ? ` condition: '${escapeString(transition.condition)}',` : ""}
|
|
14
|
-
}`).join(",\n");
|
|
15
|
-
return `import type { WorkflowSpec } from '@lssm/lib.contracts/workflow';
|
|
1
|
+
import{escapeString as e,toPascalCase as t}from"./utils.js";function n(n){let i=t(n.name.split(`.`).pop()??`Workflow`)+`Workflow`,a=n.steps.map(e=>r(e)).join(`,
|
|
2
|
+
`),o=n.transitions.map(t=>` {
|
|
3
|
+
from: '${t.from}',
|
|
4
|
+
to: '${t.to}',
|
|
5
|
+
${t.condition?` condition: '${e(t.condition)}',`:``}
|
|
6
|
+
}`).join(`,
|
|
7
|
+
`);return`import type { WorkflowSpec } from '@lssm/lib.contracts/workflow';
|
|
16
8
|
|
|
17
9
|
/**
|
|
18
10
|
* Workflow generated via contractspec CLI.
|
|
@@ -22,46 +14,28 @@ ${transition.condition ? ` condition: '${escapeString(transition.condition)
|
|
|
22
14
|
* - Provide form renderers for human steps.
|
|
23
15
|
* - Add guards/conditions as needed.
|
|
24
16
|
*/
|
|
25
|
-
export const ${
|
|
17
|
+
export const ${i}: WorkflowSpec = {
|
|
26
18
|
meta: {
|
|
27
|
-
name: '${
|
|
28
|
-
version: ${
|
|
29
|
-
title: '${
|
|
30
|
-
description: '${
|
|
31
|
-
domain: '${
|
|
32
|
-
stability: '${
|
|
33
|
-
owners: [${
|
|
34
|
-
tags: [${
|
|
19
|
+
name: '${n.name}',
|
|
20
|
+
version: ${n.version},
|
|
21
|
+
title: '${e(n.title)}',
|
|
22
|
+
description: '${e(n.description)}',
|
|
23
|
+
domain: '${e(n.domain)}',
|
|
24
|
+
stability: '${n.stability}',
|
|
25
|
+
owners: [${n.owners.map(e=>`'${e}'`).join(`, `)}],
|
|
26
|
+
tags: [${n.tags.map(e=>`'${e}'`).join(`, `)}],
|
|
35
27
|
},
|
|
36
28
|
definition: {
|
|
37
|
-
${
|
|
38
|
-
${
|
|
29
|
+
${n.entryStepId?` entryStepId: '${n.entryStepId}',\n`:``} steps: [
|
|
30
|
+
${a}
|
|
39
31
|
],
|
|
40
32
|
transitions: [
|
|
41
|
-
${
|
|
33
|
+
${o}
|
|
42
34
|
],
|
|
43
35
|
},
|
|
44
|
-
${
|
|
45
|
-
flags: [${
|
|
46
|
-
}
|
|
36
|
+
${n.policyFlags.length>0?`policy: {
|
|
37
|
+
flags: [${n.policyFlags.map(e=>`'${e}'`).join(`, `)}],
|
|
38
|
+
},`:`// policy: { flags: [] },`}
|
|
47
39
|
};
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
function formatStep(step) {
|
|
51
|
-
const lines = [
|
|
52
|
-
` {`,
|
|
53
|
-
` id: '${step.id}',`,
|
|
54
|
-
` type: '${step.type}',`,
|
|
55
|
-
` label: '${escapeString(step.label)}',`
|
|
56
|
-
];
|
|
57
|
-
if (step.description) lines.push(` description: '${escapeString(step.description)}',`);
|
|
58
|
-
const actionLines = [];
|
|
59
|
-
if (step.operation) actionLines.push(`operation: { name: '${step.operation.name}', version: ${step.operation.version} }`);
|
|
60
|
-
if (step.form) actionLines.push(`form: { key: '${step.form.key}', version: ${step.form.version} }`);
|
|
61
|
-
if (actionLines.length) lines.push(` action: { ${actionLines.join(", ")} },`);
|
|
62
|
-
lines.push(` }`);
|
|
63
|
-
return lines.join("\n");
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
//#endregion
|
|
67
|
-
export { generateWorkflowSpec };
|
|
40
|
+
`}function r(t){let n=[` {`,` id: '${t.id}',`,` type: '${t.type}',`,` label: '${e(t.label)}',`];t.description&&n.push(` description: '${e(t.description)}',`);let r=[];return t.operation&&r.push(`operation: { name: '${t.operation.name}', version: ${t.operation.version} }`),t.form&&r.push(`form: { key: '${t.form.key}', version: ${t.form.version} }`),r.length&&n.push(` action: { ${r.join(`, `)} },`),n.push(` }`),n.join(`
|
|
41
|
+
`)}export{n as generateWorkflowSpec};
|
|
@@ -1,20 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Default workspace configuration.
|
|
4
|
-
*/
|
|
5
|
-
const DEFAULT_WORKSPACE_CONFIG = {
|
|
6
|
-
aiProvider: "claude",
|
|
7
|
-
agentMode: "simple",
|
|
8
|
-
outputDir: "./src",
|
|
9
|
-
conventions: {
|
|
10
|
-
operations: "interactions/commands|queries",
|
|
11
|
-
events: "events",
|
|
12
|
-
presentations: "presentations",
|
|
13
|
-
forms: "forms"
|
|
14
|
-
},
|
|
15
|
-
defaultOwners: [],
|
|
16
|
-
defaultTags: []
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
//#endregion
|
|
20
|
-
export { DEFAULT_WORKSPACE_CONFIG };
|
|
1
|
+
const e={aiProvider:`claude`,agentMode:`simple`,outputDir:`./src`,conventions:{operations:`interactions/commands|queries`,events:`events`,presentations:`presentations`,forms:`forms`},defaultOwners:[],defaultTags:[]};export{e as DEFAULT_WORKSPACE_CONFIG};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lssm/module.contractspec-workspace",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.41.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
13
|
"publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
|
|
14
|
-
"publish:pkg:canary": "bun publish:pkg --tag canary",
|
|
15
14
|
"build": "bun build:bundle && bun build:types",
|
|
16
15
|
"build:bundle": "tsdown",
|
|
17
16
|
"build:types": "tsc --noEmit",
|
|
@@ -23,18 +22,18 @@
|
|
|
23
22
|
"test": "bun run"
|
|
24
23
|
},
|
|
25
24
|
"dependencies": {
|
|
26
|
-
"@lssm/lib.contracts": "
|
|
27
|
-
"@lssm/lib.schema": "
|
|
25
|
+
"@lssm/lib.contracts": "workspace:*",
|
|
26
|
+
"@lssm/lib.schema": "workspace:*",
|
|
28
27
|
"zod": "^4.1.13"
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
|
31
|
-
"@lssm/tool.tsdown": "
|
|
32
|
-
"@lssm/tool.typescript": "
|
|
30
|
+
"@lssm/tool.tsdown": "workspace:*",
|
|
31
|
+
"@lssm/tool.typescript": "workspace:*",
|
|
33
32
|
"tsdown": "^0.17.4",
|
|
34
33
|
"typescript": "^5.9.3"
|
|
35
34
|
},
|
|
36
35
|
"exports": {
|
|
37
|
-
".": "./
|
|
36
|
+
".": "./src/index.ts",
|
|
38
37
|
"./*": "./*"
|
|
39
38
|
},
|
|
40
39
|
"publishConfig": {
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
//#region src/ai/code-generation.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* AI prompts for code generation.
|
|
4
|
-
* Extracted from cli-contracts/src/ai/prompts/code-generation.ts
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Build prompt for generating handler implementation.
|
|
8
|
-
*/
|
|
9
|
-
declare function buildHandlerPrompt(specCode: string): string;
|
|
10
|
-
/**
|
|
11
|
-
* Build prompt for generating React component from presentation spec.
|
|
12
|
-
*/
|
|
13
|
-
declare function buildComponentPrompt(specCode: string): string;
|
|
14
|
-
/**
|
|
15
|
-
* Build prompt for generating form component.
|
|
16
|
-
*/
|
|
17
|
-
declare function buildFormPrompt(specCode: string): string;
|
|
18
|
-
/**
|
|
19
|
-
* Build prompt for generating tests.
|
|
20
|
-
*/
|
|
21
|
-
declare function buildTestPrompt(specCode: string, implementationCode: string, testType: 'handler' | 'component'): string;
|
|
22
|
-
/**
|
|
23
|
-
* System prompt for code generation.
|
|
24
|
-
*/
|
|
25
|
-
declare function getCodeGenSystemPrompt(): string;
|
|
26
|
-
//#endregion
|
|
27
|
-
export { buildComponentPrompt, buildFormPrompt, buildHandlerPrompt, buildTestPrompt, getCodeGenSystemPrompt };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { OpKind, PresentationKind } from "../types/spec-types.js";
|
|
2
|
-
|
|
3
|
-
//#region src/ai/spec-creation.d.ts
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Build prompt for creating operation spec from description.
|
|
7
|
-
*/
|
|
8
|
-
declare function buildOperationSpecPrompt(description: string, kind: OpKind): string;
|
|
9
|
-
/**
|
|
10
|
-
* Build prompt for creating event spec from description.
|
|
11
|
-
*/
|
|
12
|
-
declare function buildEventSpecPrompt(description: string): string;
|
|
13
|
-
/**
|
|
14
|
-
* Build prompt for creating presentation spec from description.
|
|
15
|
-
*/
|
|
16
|
-
declare function buildPresentationSpecPrompt(description: string, kind: PresentationKind): string;
|
|
17
|
-
/**
|
|
18
|
-
* Build system prompt for all spec generation.
|
|
19
|
-
*/
|
|
20
|
-
declare function getSystemPrompt(): string;
|
|
21
|
-
/**
|
|
22
|
-
* Create example-based prompt for better results.
|
|
23
|
-
*/
|
|
24
|
-
declare function addExampleContext(basePrompt: string, examples: string[]): string;
|
|
25
|
-
//#endregion
|
|
26
|
-
export { addExampleContext, buildEventSpecPrompt, buildOperationSpecPrompt, buildPresentationSpecPrompt, getSystemPrompt };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ContractGraph, ContractNode } from "../../types/analysis-types.js";
|
|
2
|
-
|
|
3
|
-
//#region src/analysis/deps/graph.d.ts
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Build reverse edges (dependents) for all nodes in the graph.
|
|
7
|
-
*/
|
|
8
|
-
declare function buildReverseEdges(graph: ContractGraph): void;
|
|
9
|
-
/**
|
|
10
|
-
* Detect circular dependencies in the graph.
|
|
11
|
-
*/
|
|
12
|
-
declare function detectCycles(graph: ContractGraph): string[][];
|
|
13
|
-
/**
|
|
14
|
-
* Find missing dependencies (referenced but not defined).
|
|
15
|
-
*/
|
|
16
|
-
declare function findMissingDependencies(graph: ContractGraph): {
|
|
17
|
-
contract: string;
|
|
18
|
-
missing: string[];
|
|
19
|
-
}[];
|
|
20
|
-
/**
|
|
21
|
-
* Generate DOT format output for visualization.
|
|
22
|
-
*/
|
|
23
|
-
declare function toDot(graph: ContractGraph): string;
|
|
24
|
-
/**
|
|
25
|
-
* Create an empty contract graph.
|
|
26
|
-
*/
|
|
27
|
-
declare function createContractGraph(): ContractGraph;
|
|
28
|
-
/**
|
|
29
|
-
* Add a node to the contract graph.
|
|
30
|
-
*/
|
|
31
|
-
declare function addContractNode(graph: ContractGraph, name: string, file: string, dependencies: string[]): void;
|
|
32
|
-
//#endregion
|
|
33
|
-
export { addContractNode, buildReverseEdges, createContractGraph, detectCycles, findMissingDependencies, toDot };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
//#region src/analysis/deps/parse-imports.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Import parsing utilities for dependency analysis.
|
|
4
|
-
* Extracted from cli-contracts/src/commands/deps/parse-imports.ts
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Parse spec imports from source code.
|
|
8
|
-
* Returns the names of imported specs based on file naming conventions.
|
|
9
|
-
*
|
|
10
|
-
* @param sourceCode - The source code to parse
|
|
11
|
-
* @param fromFilePath - The path of the file being parsed (for relative resolution)
|
|
12
|
-
* @returns Array of imported spec names
|
|
13
|
-
*/
|
|
14
|
-
declare function parseImportedSpecNames(sourceCode: string, _fromFilePath: string): string[];
|
|
15
|
-
//#endregion
|
|
16
|
-
export { parseImportedSpecNames };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { SemanticDiffItem, SemanticDiffOptions } from "../../types/analysis-types.js";
|
|
2
|
-
|
|
3
|
-
//#region src/analysis/diff/semantic.d.ts
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Compute semantic differences between two spec sources.
|
|
7
|
-
*/
|
|
8
|
-
declare function computeSemanticDiff(aCode: string, aPath: string, bCode: string, bPath: string, options?: SemanticDiffOptions): SemanticDiffItem[];
|
|
9
|
-
//#endregion
|
|
10
|
-
export { computeSemanticDiff };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { FeatureScanResult } from "../types/analysis-types.js";
|
|
2
|
-
|
|
3
|
-
//#region src/analysis/feature-scan.d.ts
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Check if a file is a feature file based on naming conventions.
|
|
7
|
-
*/
|
|
8
|
-
declare function isFeatureFile(filePath: string): boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Scan a feature source file to extract metadata.
|
|
11
|
-
*/
|
|
12
|
-
declare function scanFeatureSource(code: string, filePath: string): FeatureScanResult;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { isFeatureFile, scanFeatureSource };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { AnalyzedSpecType, RefInfo, SpecScanResult } from "../types/analysis-types.js";
|
|
2
|
-
|
|
3
|
-
//#region src/analysis/spec-scan.d.ts
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Infer spec type from file path based on naming conventions.
|
|
7
|
-
* Supports all contract types from @lssm/lib.contracts.
|
|
8
|
-
*/
|
|
9
|
-
declare function inferSpecTypeFromFilePath(filePath: string): AnalyzedSpecType;
|
|
10
|
-
/**
|
|
11
|
-
* Scan spec source code to extract metadata without executing it.
|
|
12
|
-
*/
|
|
13
|
-
declare function scanSpecSource(code: string, filePath: string): SpecScanResult;
|
|
14
|
-
/**
|
|
15
|
-
* Extract emitted event refs from operation spec source.
|
|
16
|
-
* Looks for sideEffects.emits array entries.
|
|
17
|
-
*/
|
|
18
|
-
declare function extractEmittedEvents(code: string): RefInfo[] | undefined;
|
|
19
|
-
/**
|
|
20
|
-
* Extract policy refs from operation spec source.
|
|
21
|
-
*/
|
|
22
|
-
declare function extractPolicyRefs(code: string): RefInfo[] | undefined;
|
|
23
|
-
/**
|
|
24
|
-
* Extract test spec refs.
|
|
25
|
-
*/
|
|
26
|
-
declare function extractTestRefs(code: string): RefInfo[] | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* Scan spec source code to extract ALL specs from a file.
|
|
29
|
-
* This function finds multiple spec definitions in a single file.
|
|
30
|
-
*/
|
|
31
|
-
declare function scanAllSpecsFromSource(code: string, filePath: string): SpecScanResult[];
|
|
32
|
-
//#endregion
|
|
33
|
-
export { extractEmittedEvents, extractPolicyRefs, extractTestRefs, inferSpecTypeFromFilePath, scanAllSpecsFromSource, scanSpecSource };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ValidationResult } from "../../types/analysis-types.js";
|
|
2
|
-
|
|
3
|
-
//#region src/analysis/validate/spec-structure.d.ts
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Validate spec structure based on source code and filename.
|
|
7
|
-
*/
|
|
8
|
-
declare function validateSpecStructure(code: string, fileName: string): ValidationResult;
|
|
9
|
-
//#endregion
|
|
10
|
-
export { validateSpecStructure };
|
package/dist/index.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { AppBlueprintSpecData, AppConfigFeatureFlagData, AppConfigMappingData, AppRouteConfigData, BaseSpecData, DataViewFieldData, DataViewKind, DataViewSpecData, EventSpecData, ExperimentAllocationData, ExperimentMetricData, ExperimentSpecData, ExperimentVariantData, ExperimentVariantOverrideData, FeatureSpecData, FormSpecData, IntegrationCapabilityRefData, IntegrationCapabilityRequirementData, IntegrationCategoryData, IntegrationConfigFieldData, IntegrationConfigFieldType, IntegrationHealthCheckMethod, IntegrationOwnershipModeData, IntegrationSecretFieldData, IntegrationSpecData, KnowledgeCategoryData, KnowledgeRetentionData, KnowledgeSpaceSpecData, KnowledgeTrustLevel, MigrationSpecData, MigrationStepData, MigrationStepKind, OpKind, OperationSpecData, PresentationKind, PresentationSpecData, RandomAllocationData, SpecType, Stability, StepType, StickyAllocationData, TargetedAllocationData, TargetingRuleData, TelemetryAnomalyRuleData, TelemetryEventData, TelemetryPrivacy, TelemetryPropertyData, TelemetryProviderData, TelemetrySpecData, WorkflowSpecData, WorkflowStepData, WorkflowTransitionData } from "./types/spec-types.js";
|
|
2
|
-
import { AnalyzedOperationKind, AnalyzedSpecType, ContractGraph, ContractNode, ExtractedRef, FeatureScanResult, RefInfo, RefType, SemanticDiffItem, SemanticDiffOptions, SemanticDiffType, SpecScanResult, ValidationResult } from "./types/analysis-types.js";
|
|
3
|
-
import { AIGenerationOptions, CodeGenerationContext, DEFAULT_WORKSPACE_CONFIG, GenerationResult, GenerationTarget, SpecBuildType, SpecGenerationContext, TestTarget, WorkspaceConfig } from "./types/generation-types.js";
|
|
4
|
-
import { extractEmittedEvents, extractPolicyRefs, extractTestRefs, inferSpecTypeFromFilePath, scanAllSpecsFromSource, scanSpecSource } from "./analysis/spec-scan.js";
|
|
5
|
-
import { isFeatureFile, scanFeatureSource } from "./analysis/feature-scan.js";
|
|
6
|
-
import { computeSemanticDiff } from "./analysis/diff/semantic.js";
|
|
7
|
-
import { addContractNode, buildReverseEdges, createContractGraph, detectCycles, findMissingDependencies, toDot } from "./analysis/deps/graph.js";
|
|
8
|
-
import { parseImportedSpecNames } from "./analysis/deps/parse-imports.js";
|
|
9
|
-
import { validateSpecStructure } from "./analysis/validate/spec-structure.js";
|
|
10
|
-
import { generateOperationSpec } from "./templates/operation.js";
|
|
11
|
-
import { generateEventSpec } from "./templates/event.js";
|
|
12
|
-
import { generatePresentationSpec } from "./templates/presentation.js";
|
|
13
|
-
import { generateWorkflowSpec } from "./templates/workflow.js";
|
|
14
|
-
import { generateWorkflowRunnerTemplate } from "./templates/workflow-runner.js";
|
|
15
|
-
import { generateDataViewSpec } from "./templates/data-view.js";
|
|
16
|
-
import { generateTelemetrySpec } from "./templates/telemetry.js";
|
|
17
|
-
import { generateExperimentSpec } from "./templates/experiment.js";
|
|
18
|
-
import { generateAppBlueprintSpec } from "./templates/app-config.js";
|
|
19
|
-
import { generateMigrationSpec } from "./templates/migration.js";
|
|
20
|
-
import { generateIntegrationSpec } from "./templates/integration.js";
|
|
21
|
-
import { generateKnowledgeSpaceSpec } from "./templates/knowledge.js";
|
|
22
|
-
import { generateComponentTemplate, generateHandlerTemplate, generateTestTemplate } from "./templates/handler.js";
|
|
23
|
-
import { capitalize, escapeString, toCamelCase, toKebabCase, toPascalCase } from "./templates/utils.js";
|
|
24
|
-
import { addExampleContext, buildEventSpecPrompt, buildOperationSpecPrompt, buildPresentationSpecPrompt, getSystemPrompt } from "./ai/spec-creation.js";
|
|
25
|
-
import { buildComponentPrompt, buildFormPrompt, buildHandlerPrompt, buildTestPrompt, getCodeGenSystemPrompt } from "./ai/code-generation.js";
|
|
26
|
-
export { AIGenerationOptions, AnalyzedOperationKind, AnalyzedSpecType, AppBlueprintSpecData, AppConfigFeatureFlagData, AppConfigMappingData, AppRouteConfigData, BaseSpecData, CodeGenerationContext, ContractGraph, ContractNode, DEFAULT_WORKSPACE_CONFIG, DataViewFieldData, DataViewKind, DataViewSpecData, EventSpecData, ExperimentAllocationData, ExperimentMetricData, ExperimentSpecData, ExperimentVariantData, ExperimentVariantOverrideData, ExtractedRef, FeatureScanResult, FeatureSpecData, FormSpecData, GenerationResult, GenerationTarget, IntegrationCapabilityRefData, IntegrationCapabilityRequirementData, IntegrationCategoryData, IntegrationConfigFieldData, IntegrationConfigFieldType, IntegrationHealthCheckMethod, IntegrationOwnershipModeData, IntegrationSecretFieldData, IntegrationSpecData, KnowledgeCategoryData, KnowledgeRetentionData, KnowledgeSpaceSpecData, KnowledgeTrustLevel, MigrationSpecData, MigrationStepData, MigrationStepKind, OpKind, OperationSpecData, PresentationKind, PresentationSpecData, RandomAllocationData, RefInfo, RefType, SemanticDiffItem, SemanticDiffOptions, SemanticDiffType, SpecBuildType, SpecGenerationContext, SpecScanResult, SpecType, Stability, StepType, StickyAllocationData, TargetedAllocationData, TargetingRuleData, TelemetryAnomalyRuleData, TelemetryEventData, TelemetryPrivacy, TelemetryPropertyData, TelemetryProviderData, TelemetrySpecData, TestTarget, ValidationResult, WorkflowSpecData, WorkflowStepData, WorkflowTransitionData, WorkspaceConfig, addContractNode, addExampleContext, buildComponentPrompt, buildEventSpecPrompt, buildFormPrompt, buildHandlerPrompt, buildOperationSpecPrompt, buildPresentationSpecPrompt, buildReverseEdges, buildTestPrompt, capitalize, computeSemanticDiff, createContractGraph, detectCycles, escapeString, extractEmittedEvents, extractPolicyRefs, extractTestRefs, findMissingDependencies, generateAppBlueprintSpec, generateComponentTemplate, generateDataViewSpec, generateEventSpec, generateExperimentSpec, generateHandlerTemplate, generateIntegrationSpec, generateKnowledgeSpaceSpec, generateMigrationSpec, generateOperationSpec, generatePresentationSpec, generateTelemetrySpec, generateTestTemplate, generateWorkflowRunnerTemplate, generateWorkflowSpec, getCodeGenSystemPrompt, getSystemPrompt, inferSpecTypeFromFilePath, isFeatureFile, parseImportedSpecNames, scanAllSpecsFromSource, scanFeatureSource, scanSpecSource, toCamelCase, toDot, toKebabCase, toPascalCase, validateSpecStructure };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { EventSpecData } from "../types/spec-types.js";
|
|
2
|
-
|
|
3
|
-
//#region src/templates/event.d.ts
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Generate event spec TypeScript code.
|
|
7
|
-
*/
|
|
8
|
-
declare function generateEventSpec(data: EventSpecData): string;
|
|
9
|
-
//#endregion
|
|
10
|
-
export { generateEventSpec };
|