@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.
Files changed (52) hide show
  1. package/dist/ai/code-generation.js +13 -50
  2. package/dist/ai/spec-creation.js +18 -50
  3. package/dist/analysis/deps/graph.js +2 -84
  4. package/dist/analysis/deps/parse-imports.js +1 -30
  5. package/dist/analysis/diff/semantic.js +1 -96
  6. package/dist/analysis/feature-scan.js +1 -151
  7. package/dist/analysis/spec-scan.js +1 -344
  8. package/dist/analysis/validate/spec-structure.js +1 -122
  9. package/dist/index.js +1 -25
  10. package/dist/templates/app-config.js +28 -100
  11. package/dist/templates/data-view.js +27 -41
  12. package/dist/templates/event.js +14 -28
  13. package/dist/templates/experiment.js +51 -76
  14. package/dist/templates/handler.js +17 -49
  15. package/dist/templates/integration-utils.js +26 -97
  16. package/dist/templates/integration.js +23 -46
  17. package/dist/templates/knowledge.js +19 -59
  18. package/dist/templates/migration.js +26 -49
  19. package/dist/templates/operation.js +28 -40
  20. package/dist/templates/presentation.js +20 -45
  21. package/dist/templates/telemetry.js +53 -73
  22. package/dist/templates/utils.js +1 -38
  23. package/dist/templates/workflow-runner.js +6 -12
  24. package/dist/templates/workflow.js +24 -50
  25. package/dist/types/generation-types.js +1 -20
  26. package/package.json +6 -7
  27. package/dist/ai/code-generation.d.ts +0 -27
  28. package/dist/ai/spec-creation.d.ts +0 -26
  29. package/dist/analysis/deps/graph.d.ts +0 -33
  30. package/dist/analysis/deps/parse-imports.d.ts +0 -16
  31. package/dist/analysis/diff/semantic.d.ts +0 -10
  32. package/dist/analysis/feature-scan.d.ts +0 -14
  33. package/dist/analysis/spec-scan.d.ts +0 -33
  34. package/dist/analysis/validate/spec-structure.d.ts +0 -10
  35. package/dist/index.d.ts +0 -26
  36. package/dist/templates/app-config.d.ts +0 -6
  37. package/dist/templates/data-view.d.ts +0 -6
  38. package/dist/templates/event.d.ts +0 -10
  39. package/dist/templates/experiment.d.ts +0 -6
  40. package/dist/templates/handler.d.ts +0 -19
  41. package/dist/templates/integration.d.ts +0 -6
  42. package/dist/templates/knowledge.d.ts +0 -6
  43. package/dist/templates/migration.d.ts +0 -6
  44. package/dist/templates/operation.d.ts +0 -10
  45. package/dist/templates/presentation.d.ts +0 -10
  46. package/dist/templates/telemetry.d.ts +0 -6
  47. package/dist/templates/utils.d.ts +0 -26
  48. package/dist/templates/workflow-runner.d.ts +0 -15
  49. package/dist/templates/workflow.d.ts +0 -10
  50. package/dist/types/analysis-types.d.ts +0 -125
  51. package/dist/types/generation-types.d.ts +0 -83
  52. package/dist/types/spec-types.d.ts +0 -344
@@ -1,89 +1,69 @@
1
- import { toPascalCase } from "./utils.js";
2
-
3
- //#region src/templates/telemetry.ts
4
- function generateTelemetrySpec(data) {
5
- const specVar = toPascalCase(data.name.split(".").pop() ?? "Telemetry") + "Telemetry";
6
- const providers = data.providers?.length ? `providers: [
7
- ${data.providers.map((provider) => ` {
8
- type: '${provider.type}',
9
- config: ${formatConfigValue(provider.config)},
10
- }`).join(",\n")}
11
- ],` : "";
12
- const events = data.events.map((event) => {
13
- const properties = event.properties.map((prop) => ` '${prop.name}': {
14
- type: '${prop.type}',
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 event.anomalyMinimumSample === "number" ? `minimumSample: ${event.anomalyMinimumSample},` : ""}
16
+ ${typeof e.anomalyMinimumSample==`number`?`minimumSample: ${e.anomalyMinimumSample},`:``}
23
17
  thresholds: [
24
- ${event.anomalyRules.map((rule) => ` {
25
- metric: '${escapeString(rule.metric)}',
26
- ${typeof rule.min === "number" ? `min: ${rule.min},` : ""}
27
- ${typeof rule.max === "number" ? `max: ${rule.max},` : ""}
28
- }`).join(",\n")}
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: [${(event.anomalyActions ?? []).map((action) => `'${action}'`).join(", ")}],
31
- },` : event.anomalyEnabled ? ` anomalyDetection: {
25
+ actions: [${(e.anomalyActions??[]).map(e=>`'${e}'`).join(`, `)}],
26
+ },`:e.anomalyEnabled?` anomalyDetection: {
32
27
  enabled: true,
33
- ${typeof event.anomalyMinimumSample === "number" ? `minimumSample: ${event.anomalyMinimumSample},` : ""}
34
- },` : "";
35
- return ` {
36
- name: '${escapeString(event.name)}',
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: '${escapeString(event.what)}',
40
- ${event.who ? `who: '${escapeString(event.who)}',` : ""}
41
- ${event.why ? `why: '${escapeString(event.why)}',` : ""}
33
+ what: '${n(e.what)}',
34
+ ${e.who?`who: '${n(e.who)}',`:``}
35
+ ${e.why?`why: '${n(e.why)}',`:``}
42
36
  },
43
- privacy: '${event.privacy}',
37
+ privacy: '${e.privacy}',
44
38
  properties: {
45
- ${properties}
39
+ ${t}
46
40
  },
47
- ${typeof event.retentionDays === "number" ? `retention: { days: ${event.retentionDays}, ${event.retentionPolicy ? `policy: '${event.retentionPolicy}'` : ""} },` : ""}
48
- ${typeof event.samplingRate === "number" ? `sampling: { rate: ${event.samplingRate}${event.samplingConditions ? `, conditions: ['${escapeString(event.samplingConditions)}']` : ""} },` : ""}
49
- ${anomalyRules}
50
- ${event.tags?.length ? `tags: [${event.tags.map((tag) => `'${escapeString(tag)}'`).join(", ")}],` : ""}
51
- }`;
52
- }).join(",\n");
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 ${specVar}: TelemetrySpec = {
48
+ export const ${i}: TelemetrySpec = {
56
49
  meta: {
57
- name: '${escapeString(data.name)}',
58
- version: ${data.version},
59
- title: '${escapeString(data.name)} telemetry',
60
- description: '${escapeString(data.description || "Describe the purpose of this telemetry spec.")}',
61
- domain: '${escapeString(data.domain)}',
62
- owners: [${data.owners.map((owner) => `'${escapeString(owner)}'`).join(", ")}],
63
- tags: [${data.tags.map((tag) => `'${escapeString(tag)}'`).join(", ")}],
64
- stability: '${data.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 data.defaultRetentionDays === "number" ? `defaultRetentionDays: ${data.defaultRetentionDays},` : ""}
68
- ${typeof data.defaultSamplingRate === "number" ? `defaultSamplingRate: ${data.defaultSamplingRate},` : ""}
69
- ${data.anomalyEnabled ? `anomalyDetection: { enabled: true${typeof data.anomalyCheckIntervalMs === "number" ? `, checkIntervalMs: ${data.anomalyCheckIntervalMs}` : ""} },` : ""}
70
- ${providers}
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
- ${events}
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};
@@ -1,38 +1 @@
1
- //#region src/templates/utils.ts
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
- //#region src/templates/workflow-runner.ts
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 { ${exportName} } from '${specImportPath}';
6
+ import { ${e} } from '${t}';
9
7
 
10
8
  /**
11
- * Runner wiring for ${workflowName}.
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(${exportName});
17
+ registry.register(${e});
20
18
 
21
19
  const stateStore = new InMemoryStateStore();
22
20
 
23
- export const ${runnerName} = new WorkflowRunner({
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 { escapeString, toPascalCase } from "./utils.js";
2
-
3
- //#region src/templates/workflow.ts
4
- /**
5
- * Generate workflow spec TypeScript code.
6
- */
7
- function generateWorkflowSpec(data) {
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 ${specVarName}: WorkflowSpec = {
17
+ export const ${i}: WorkflowSpec = {
26
18
  meta: {
27
- name: '${data.name}',
28
- version: ${data.version},
29
- title: '${escapeString(data.title)}',
30
- description: '${escapeString(data.description)}',
31
- domain: '${escapeString(data.domain)}',
32
- stability: '${data.stability}',
33
- owners: [${data.owners.map((owner) => `'${owner}'`).join(", ")}],
34
- tags: [${data.tags.map((tag) => `'${tag}'`).join(", ")}],
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
- ${data.entryStepId ? ` entryStepId: '${data.entryStepId}',\n` : ""} steps: [
38
- ${stepsCode}
29
+ ${n.entryStepId?` entryStepId: '${n.entryStepId}',\n`:``} steps: [
30
+ ${a}
39
31
  ],
40
32
  transitions: [
41
- ${transitionsCode}
33
+ ${o}
42
34
  ],
43
35
  },
44
- ${data.policyFlags.length > 0 ? `policy: {
45
- flags: [${data.policyFlags.map((flag) => `'${flag}'`).join(", ")}],
46
- },` : "// policy: { flags: [] },"}
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
- //#region src/types/generation-types.ts
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": "0.0.0-canary-20251217083314",
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": "0.0.0-canary-20251217083314",
27
- "@lssm/lib.schema": "0.0.0-canary-20251217083314",
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": "0.0.0-canary-20251217083314",
32
- "@lssm/tool.typescript": "0.0.0-canary-20251217083314",
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
- ".": "./dist/index.js",
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,6 +0,0 @@
1
- import { AppBlueprintSpecData } from "../types/spec-types.js";
2
-
3
- //#region src/templates/app-config.d.ts
4
- declare function generateAppBlueprintSpec(data: AppBlueprintSpecData): string;
5
- //#endregion
6
- export { generateAppBlueprintSpec };
@@ -1,6 +0,0 @@
1
- import { DataViewSpecData } from "../types/spec-types.js";
2
-
3
- //#region src/templates/data-view.d.ts
4
- declare function generateDataViewSpec(data: DataViewSpecData): string;
5
- //#endregion
6
- export { generateDataViewSpec };
@@ -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 };
@@ -1,6 +0,0 @@
1
- import { ExperimentSpecData } from "../types/spec-types.js";
2
-
3
- //#region src/templates/experiment.d.ts
4
- declare function generateExperimentSpec(data: ExperimentSpecData): string;
5
- //#endregion
6
- export { generateExperimentSpec };