@lssm/bundle.contractspec-workspace 0.0.0-canary-20251217063201 → 0.0.0-canary-20251217072406
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/_virtual/rolldown_runtime.js +22 -1
- package/dist/adapters/ai.js +82 -1
- package/dist/adapters/factory.js +36 -1
- package/dist/adapters/fs.js +118 -1
- package/dist/adapters/git.js +54 -1
- package/dist/adapters/index.js +7 -1
- package/dist/adapters/logger.js +80 -1
- package/dist/adapters/watcher.js +69 -1
- package/dist/adapters/workspace.js +190 -2
- package/dist/ai/agents/claude-code-agent.js +146 -9
- package/dist/ai/agents/cursor-agent.js +286 -17
- package/dist/ai/agents/index.js +5 -1
- package/dist/ai/agents/openai-codex-agent.js +140 -8
- package/dist/ai/agents/orchestrator.js +142 -1
- package/dist/ai/agents/simple-agent.js +80 -4
- package/dist/ai/client.js +162 -1
- package/dist/ai/index.js +27 -1
- package/dist/ai/prompts/code-generation.js +55 -13
- package/dist/ai/prompts/index.js +12 -1
- package/dist/ai/prompts/spec-creation.js +61 -20
- package/dist/ai/providers.js +40 -1
- package/dist/formatters/index.js +18 -1
- package/dist/formatters/json.js +71 -1
- package/dist/formatters/sarif.js +163 -1
- package/dist/formatters/text.js +208 -2
- package/dist/index.js +81 -1
- package/dist/libs/ai-providers/dist/factory.js +154 -1
- package/dist/libs/ai-providers/dist/index.js +4 -1
- package/dist/libs/ai-providers/dist/legacy.js +72 -1
- package/dist/libs/ai-providers/dist/models.js +287 -1
- package/dist/libs/ai-providers/dist/validation.js +1 -1
- package/dist/libs/contracts/dist/capabilities/openbanking.js +88 -1
- package/dist/libs/contracts/dist/client/index.js +5 -1
- package/dist/libs/contracts/dist/client/react/feature-render.js +2 -1
- package/dist/libs/contracts/dist/client/react/form-render.js +4 -1
- package/dist/libs/contracts/dist/client/react/index.js +4 -1
- package/dist/libs/contracts/dist/contract-registry/index.js +1 -1
- package/dist/libs/contracts/dist/contract-registry/schemas.js +60 -1
- package/dist/libs/contracts/dist/docs/PUBLISHING.docblock.js +16 -76
- package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +16 -350
- package/dist/libs/contracts/dist/docs/index.js +29 -1
- package/dist/libs/contracts/dist/docs/presentations.js +71 -1
- package/dist/libs/contracts/dist/docs/registry.js +44 -1
- package/dist/libs/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +16 -383
- package/dist/libs/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +16 -68
- package/dist/libs/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +16 -140
- package/dist/libs/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +16 -86
- package/dist/libs/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +16 -1
- package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +24 -2
- package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +21 -2
- package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +16 -213
- package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js +73 -5
- package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js +37 -1
- package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js +16 -1
- package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js +20 -262
- package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js +48 -1
- package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +24 -2
- package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +23 -2
- package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +25 -16
- package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js +67 -1
- package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +22 -2
- package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js +40 -36
- package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +47 -1
- package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js +23 -2
- package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js +36 -3
- package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js +20 -1
- package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js +36 -3
- package/dist/libs/contracts/dist/docs/tech/workflows/overview.docblock.js +20 -1
- package/dist/libs/contracts/dist/events.js +8 -1
- package/dist/libs/contracts/dist/experiments/evaluator.js +1 -1
- package/dist/libs/contracts/dist/index.js +72 -1
- package/dist/libs/contracts/dist/install.js +2 -1
- package/dist/libs/contracts/dist/integrations/contracts.js +377 -1
- package/dist/libs/contracts/dist/integrations/index.js +18 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/accounts.js +228 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/balances.js +159 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/index.js +3 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/transactions.js +210 -1
- package/dist/libs/contracts/dist/integrations/openbanking/models.js +242 -1
- package/dist/libs/contracts/dist/integrations/openbanking/telemetry.js +13 -1
- package/dist/libs/contracts/dist/integrations/providers/elevenlabs.js +52 -1
- package/dist/libs/contracts/dist/integrations/providers/gcs-storage.js +75 -1
- package/dist/libs/contracts/dist/integrations/providers/gmail.js +87 -1
- package/dist/libs/contracts/dist/integrations/providers/google-calendar.js +66 -1
- package/dist/libs/contracts/dist/integrations/providers/index.js +11 -1
- package/dist/libs/contracts/dist/integrations/providers/mistral.js +68 -1
- package/dist/libs/contracts/dist/integrations/providers/postmark.js +68 -1
- package/dist/libs/contracts/dist/integrations/providers/powens.js +116 -1
- package/dist/libs/contracts/dist/integrations/providers/qdrant.js +73 -1
- package/dist/libs/contracts/dist/integrations/providers/registry.js +10 -1
- package/dist/libs/contracts/dist/integrations/providers/stripe.js +83 -1
- package/dist/libs/contracts/dist/integrations/providers/twilio-sms.js +61 -1
- package/dist/libs/contracts/dist/jsonschema.js +24 -1
- package/dist/libs/contracts/dist/knowledge/contracts.js +306 -1
- package/dist/libs/contracts/dist/knowledge/index.js +7 -1
- package/dist/libs/contracts/dist/knowledge/spaces/email-threads.js +34 -1
- package/dist/libs/contracts/dist/knowledge/spaces/financial-docs.js +34 -1
- package/dist/libs/contracts/dist/knowledge/spaces/financial-overview.js +38 -1
- package/dist/libs/contracts/dist/knowledge/spaces/index.js +6 -1
- package/dist/libs/contracts/dist/knowledge/spaces/product-canon.js +34 -1
- package/dist/libs/contracts/dist/knowledge/spaces/support-faq.js +37 -1
- package/dist/libs/contracts/dist/knowledge/spaces/uploaded-docs.js +34 -1
- package/dist/libs/contracts/dist/llm/exporters.js +352 -4
- package/dist/libs/contracts/dist/llm/index.js +2 -1
- package/dist/libs/contracts/dist/llm/prompts.js +143 -7
- package/dist/libs/contracts/dist/onboarding-base.js +196 -1
- package/dist/libs/contracts/dist/openapi.js +75 -1
- package/dist/libs/contracts/dist/ownership.js +21 -1
- package/dist/libs/contracts/dist/presentations.js +1 -1
- package/dist/libs/contracts/dist/presentations.v2.js +11 -1
- package/dist/libs/contracts/dist/prompt.js +1 -1
- package/dist/libs/contracts/dist/promptRegistry.js +1 -1
- package/dist/libs/contracts/dist/regenerator/index.js +2 -1
- package/dist/libs/contracts/dist/regenerator/service.js +92 -1
- package/dist/libs/contracts/dist/regenerator/utils.js +51 -1
- package/dist/libs/contracts/dist/registry.js +208 -1
- package/dist/libs/contracts/dist/resources.js +1 -1
- package/dist/libs/contracts/dist/schema/dist/EnumType.js +2 -1
- package/dist/libs/contracts/dist/schema/dist/FieldType.js +49 -1
- package/dist/libs/contracts/dist/schema/dist/ScalarTypeEnum.js +236 -1
- package/dist/libs/contracts/dist/schema/dist/SchemaModel.js +34 -1
- package/dist/libs/contracts/dist/schema/dist/entity/defineEntity.js +1 -1
- package/dist/libs/contracts/dist/schema/dist/entity/index.js +2 -1
- package/dist/libs/contracts/dist/schema/dist/entity/types.js +1 -1
- package/dist/libs/contracts/dist/schema/dist/index.js +6 -1
- package/dist/libs/contracts/dist/server/graphql-pothos.js +6 -1
- package/dist/libs/contracts/dist/server/index.js +8 -1
- package/dist/libs/contracts/dist/server/mcp/createMcpServer.js +4 -1
- package/dist/libs/contracts/dist/server/mcp/registerPresentations.js +2 -1
- package/dist/libs/contracts/dist/server/mcp/registerPrompts.js +1 -1
- package/dist/libs/contracts/dist/server/mcp/registerResources.js +2 -1
- package/dist/libs/contracts/dist/server/mcp/registerTools.js +1 -1
- package/dist/libs/contracts/dist/server/provider-mcp.js +1 -1
- package/dist/libs/contracts/dist/server/rest-elysia.js +1 -1
- package/dist/libs/contracts/dist/server/rest-express.js +1 -1
- package/dist/libs/contracts/dist/server/rest-generic.js +1 -1
- package/dist/libs/contracts/dist/server/rest-next-app.js +1 -1
- package/dist/libs/contracts/dist/server/rest-next-pages.js +1 -1
- package/dist/libs/contracts/dist/spec.js +35 -1
- package/dist/libs/contracts/dist/telemetry/index.js +1 -1
- package/dist/libs/contracts/dist/telemetry/tracker.js +1 -1
- package/dist/libs/contracts/dist/tests/index.js +1 -1
- package/dist/libs/contracts/dist/tests/runner.js +150 -1
- package/dist/libs/contracts/dist/workflow/index.js +1 -1
- package/dist/libs/contracts/dist/workflow/runner.js +1 -1
- package/dist/libs/contracts-transformers/dist/common/utils.js +47 -1
- package/dist/libs/contracts-transformers/dist/openapi/exporter.js +1 -1
- package/dist/libs/contracts-transformers/dist/openapi/importer.js +255 -2
- package/dist/libs/contracts-transformers/dist/openapi/index.js +4 -1
- package/dist/libs/contracts-transformers/dist/openapi/parser.js +231 -1
- package/dist/libs/contracts-transformers/dist/openapi/schema-converter.js +201 -4
- package/dist/modules/contractspec-workspace/dist/ai/code-generation.js +50 -13
- package/dist/modules/contractspec-workspace/dist/ai/spec-creation.js +50 -18
- package/dist/modules/contractspec-workspace/dist/analysis/deps/graph.js +84 -2
- package/dist/modules/contractspec-workspace/dist/analysis/deps/parse-imports.js +30 -1
- package/dist/modules/contractspec-workspace/dist/analysis/diff/semantic.js +96 -1
- package/dist/modules/contractspec-workspace/dist/analysis/feature-scan.js +151 -1
- package/dist/modules/contractspec-workspace/dist/analysis/spec-scan.js +344 -1
- package/dist/modules/contractspec-workspace/dist/analysis/validate/spec-structure.js +122 -1
- package/dist/modules/contractspec-workspace/dist/templates/app-config.js +100 -28
- package/dist/modules/contractspec-workspace/dist/templates/data-view.js +41 -27
- package/dist/modules/contractspec-workspace/dist/templates/event.js +28 -14
- package/dist/modules/contractspec-workspace/dist/templates/experiment.js +76 -51
- package/dist/modules/contractspec-workspace/dist/templates/handler.js +49 -17
- package/dist/modules/contractspec-workspace/dist/templates/integration-utils.js +97 -26
- package/dist/modules/contractspec-workspace/dist/templates/integration.js +46 -23
- package/dist/modules/contractspec-workspace/dist/templates/knowledge.js +59 -19
- package/dist/modules/contractspec-workspace/dist/templates/migration.js +49 -26
- package/dist/modules/contractspec-workspace/dist/templates/operation.js +40 -28
- package/dist/modules/contractspec-workspace/dist/templates/presentation.js +45 -20
- package/dist/modules/contractspec-workspace/dist/templates/telemetry.js +73 -53
- package/dist/modules/contractspec-workspace/dist/templates/utils.js +38 -1
- package/dist/modules/contractspec-workspace/dist/templates/workflow-runner.js +12 -6
- package/dist/modules/contractspec-workspace/dist/templates/workflow.js +50 -24
- package/dist/modules/contractspec-workspace/dist/types/generation-types.js +20 -1
- package/dist/services/agent-guide/adapters/claude-code.js +144 -3
- package/dist/services/agent-guide/adapters/cursor-cli.js +135 -3
- package/dist/services/agent-guide/adapters/generic-mcp.js +159 -3
- package/dist/services/agent-guide/adapters/index.js +30 -1
- package/dist/services/agent-guide/agent-guide-service.js +148 -1
- package/dist/services/agent-guide/index.js +5 -1
- package/dist/services/build.js +140 -1
- package/dist/services/ci-check/ci-check-service.js +393 -1
- package/dist/services/ci-check/index.js +2 -1
- package/dist/services/ci-check/types.js +28 -1
- package/dist/services/clean.js +71 -1
- package/dist/services/config.js +76 -1
- package/dist/services/deps.js +62 -1
- package/dist/services/diff.js +33 -1
- package/dist/services/doctor/checks/ai.js +118 -2
- package/dist/services/doctor/checks/cli.js +146 -1
- package/dist/services/doctor/checks/config.js +170 -1
- package/dist/services/doctor/checks/deps.js +180 -1
- package/dist/services/doctor/checks/index.js +6 -1
- package/dist/services/doctor/checks/mcp.js +144 -1
- package/dist/services/doctor/checks/workspace.js +243 -1
- package/dist/services/doctor/doctor-service.js +115 -2
- package/dist/services/doctor/index.js +2 -1
- package/dist/services/doctor/types.js +26 -1
- package/dist/services/implementation/discovery.js +143 -2
- package/dist/services/implementation/index.js +2 -1
- package/dist/services/implementation/resolver.js +223 -1
- package/dist/services/index.js +53 -1
- package/dist/services/integrity-diagram.js +274 -6
- package/dist/services/integrity.js +272 -1
- package/dist/services/list.js +35 -1
- package/dist/services/openapi/export-service.js +51 -2
- package/dist/services/openapi/import-service.js +75 -1
- package/dist/services/openapi/index.js +4 -1
- package/dist/services/openapi/sync-service.js +121 -1
- package/dist/services/openapi/validate-service.js +130 -1
- package/dist/services/regenerator.js +23 -1
- package/dist/services/registry.js +73 -1
- package/dist/services/setup/config-generators.js +113 -26
- package/dist/services/setup/file-merger.js +60 -2
- package/dist/services/setup/index.js +4 -1
- package/dist/services/setup/setup-service.js +95 -1
- package/dist/services/setup/targets/agents-md.js +46 -1
- package/dist/services/setup/targets/cli-config.js +59 -1
- package/dist/services/setup/targets/cursor-rules.js +47 -1
- package/dist/services/setup/targets/mcp-claude.js +59 -1
- package/dist/services/setup/targets/mcp-cursor.js +58 -1
- package/dist/services/setup/targets/vscode-settings.js +62 -1
- package/dist/services/setup/types.js +26 -1
- package/dist/services/sync.js +62 -1
- package/dist/services/test.js +30 -1
- package/dist/services/validate-implementation.js +69 -1
- package/dist/services/validate.js +47 -1
- package/dist/services/verification-cache/adapters/filesystem.js +121 -1
- package/dist/services/verification-cache/adapters/in-memory.js +45 -1
- package/dist/services/verification-cache/adapters/index.js +3 -1
- package/dist/services/verification-cache/adapters/workspace-state.js +90 -1
- package/dist/services/verification-cache/cache-service.js +255 -1
- package/dist/services/verification-cache/index.js +6 -1
- package/dist/services/verification-cache/types.js +15 -1
- package/dist/services/verify/ai-verifier.js +336 -9
- package/dist/services/verify/behavior-verifier.js +185 -1
- package/dist/services/verify/index.js +4 -1
- package/dist/services/verify/structure-verifier.js +195 -2
- package/dist/services/verify/verify-service.js +203 -3
- package/dist/services/watch.js +31 -1
- package/dist/services/workspace-info.js +102 -2
- package/dist/templates/app-config.template.js +101 -28
- package/dist/templates/data-view.template.js +42 -27
- package/dist/templates/event.template.js +29 -14
- package/dist/templates/experiment.template.js +77 -51
- package/dist/templates/handler.template.js +53 -17
- package/dist/templates/index.js +36 -1
- package/dist/templates/integration.template.js +134 -50
- package/dist/templates/knowledge.template.js +62 -21
- package/dist/templates/migration.template.js +50 -26
- package/dist/templates/operation.template.js +44 -28
- package/dist/templates/presentation.template.js +46 -20
- package/dist/templates/telemetry.template.js +74 -53
- package/dist/templates/workflow-runner.template.js +12 -6
- package/dist/templates/workflow.template.js +51 -24
- package/package.json +13 -9
|
@@ -1,2 +1,84 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region ../../modules/contractspec-workspace/dist/analysis/deps/graph.js
|
|
2
|
+
/**
|
|
3
|
+
* Build reverse edges (dependents) for all nodes in the graph.
|
|
4
|
+
*/
|
|
5
|
+
function buildReverseEdges(graph) {
|
|
6
|
+
for (const node of graph.values()) node.dependents = [];
|
|
7
|
+
for (const [name, node] of graph) for (const dep of node.dependencies) {
|
|
8
|
+
const depNode = graph.get(dep);
|
|
9
|
+
if (depNode) depNode.dependents.push(name);
|
|
10
|
+
}
|
|
11
|
+
for (const node of graph.values()) node.dependents.sort((a, b) => a.localeCompare(b));
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Detect circular dependencies in the graph.
|
|
15
|
+
*/
|
|
16
|
+
function detectCycles(graph) {
|
|
17
|
+
const visited = /* @__PURE__ */ new Set();
|
|
18
|
+
const stack = /* @__PURE__ */ new Set();
|
|
19
|
+
const cycles = [];
|
|
20
|
+
function dfs(name, path) {
|
|
21
|
+
if (stack.has(name)) {
|
|
22
|
+
const start = path.indexOf(name);
|
|
23
|
+
if (start >= 0) cycles.push([...path.slice(start), name]);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (visited.has(name)) return;
|
|
27
|
+
visited.add(name);
|
|
28
|
+
stack.add(name);
|
|
29
|
+
const node = graph.get(name);
|
|
30
|
+
if (node) for (const dep of node.dependencies) dfs(dep, [...path, name]);
|
|
31
|
+
stack.delete(name);
|
|
32
|
+
}
|
|
33
|
+
for (const name of graph.keys()) if (!visited.has(name)) dfs(name, []);
|
|
34
|
+
return cycles;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Find missing dependencies (referenced but not defined).
|
|
38
|
+
*/
|
|
39
|
+
function findMissingDependencies(graph) {
|
|
40
|
+
const missing = [];
|
|
41
|
+
for (const [name, node] of graph) {
|
|
42
|
+
const absent = node.dependencies.filter((dep) => !graph.has(dep));
|
|
43
|
+
if (absent.length > 0) missing.push({
|
|
44
|
+
contract: name,
|
|
45
|
+
missing: absent
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return missing;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Generate DOT format output for visualization.
|
|
52
|
+
*/
|
|
53
|
+
function toDot(graph) {
|
|
54
|
+
const lines = [];
|
|
55
|
+
lines.push("digraph ContractDependencies {");
|
|
56
|
+
lines.push(" rankdir=LR;");
|
|
57
|
+
lines.push(" node [shape=box];");
|
|
58
|
+
for (const [name, node] of graph) {
|
|
59
|
+
for (const dep of node.dependencies) lines.push(` "${name}" -> "${dep}";`);
|
|
60
|
+
if (node.dependencies.length === 0) lines.push(` "${name}";`);
|
|
61
|
+
}
|
|
62
|
+
lines.push("}");
|
|
63
|
+
return lines.join("\n");
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Create an empty contract graph.
|
|
67
|
+
*/
|
|
68
|
+
function createContractGraph() {
|
|
69
|
+
return /* @__PURE__ */ new Map();
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Add a node to the contract graph.
|
|
73
|
+
*/
|
|
74
|
+
function addContractNode(graph, name, file, dependencies) {
|
|
75
|
+
graph.set(name, {
|
|
76
|
+
name,
|
|
77
|
+
file,
|
|
78
|
+
dependencies,
|
|
79
|
+
dependents: []
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
//#endregion
|
|
84
|
+
export { addContractNode, buildReverseEdges, createContractGraph, detectCycles, findMissingDependencies, toDot };
|
|
@@ -1 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
//#region ../../modules/contractspec-workspace/dist/analysis/deps/parse-imports.js
|
|
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
|
+
function parseImportedSpecNames(sourceCode, _fromFilePath) {
|
|
15
|
+
const imports = [];
|
|
16
|
+
const importRegex = /import\s+.*?\s+from\s+['"]([^'"]+\.(?:contracts|event|presentation|workflow|data-view|migration|telemetry|experiment|app-config|integration|knowledge)(?:\.[jt]s)?)['"]/g;
|
|
17
|
+
let match;
|
|
18
|
+
while ((match = importRegex.exec(sourceCode)) !== null) {
|
|
19
|
+
const importPath = match[1];
|
|
20
|
+
if (!importPath) continue;
|
|
21
|
+
if (!importPath.startsWith(".") && !importPath.startsWith("/")) continue;
|
|
22
|
+
const pathParts = importPath.split("/");
|
|
23
|
+
const name = (pathParts[pathParts.length - 1] ?? "").replace(/\.(ts|js)$/, "").replace(/\.(contracts|event|presentation|workflow|data-view|migration|telemetry|experiment|app-config|integration|knowledge)$/, "");
|
|
24
|
+
if (name.length > 0) imports.push(name);
|
|
25
|
+
}
|
|
26
|
+
return Array.from(new Set(imports)).sort((a, b) => a.localeCompare(b));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
export { parseImportedSpecNames };
|
|
@@ -1 +1,96 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { scanSpecSource } from "../spec-scan.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../modules/contractspec-workspace/dist/analysis/diff/semantic.js
|
|
4
|
+
/**
|
|
5
|
+
* Compute semantic differences between two spec sources.
|
|
6
|
+
*/
|
|
7
|
+
function computeSemanticDiff(aCode, aPath, bCode, bPath, options = {}) {
|
|
8
|
+
const a = scanSpecSource(aCode, aPath);
|
|
9
|
+
const b = scanSpecSource(bCode, bPath);
|
|
10
|
+
const diffs = [];
|
|
11
|
+
compareScalar(diffs, "specType", a.specType, b.specType, {
|
|
12
|
+
breaking: true,
|
|
13
|
+
label: "Spec type"
|
|
14
|
+
});
|
|
15
|
+
compareScalar(diffs, "name", a.name, b.name, {
|
|
16
|
+
breaking: true,
|
|
17
|
+
label: "Name"
|
|
18
|
+
});
|
|
19
|
+
compareScalar(diffs, "version", a.version, b.version, {
|
|
20
|
+
breaking: true,
|
|
21
|
+
label: "Version"
|
|
22
|
+
});
|
|
23
|
+
compareScalar(diffs, "kind", a.kind, b.kind, {
|
|
24
|
+
breaking: true,
|
|
25
|
+
label: "Kind"
|
|
26
|
+
});
|
|
27
|
+
compareScalar(diffs, "stability", a.stability, b.stability, {
|
|
28
|
+
breaking: isStabilityDowngrade(a, b),
|
|
29
|
+
label: "Stability"
|
|
30
|
+
});
|
|
31
|
+
compareArray(diffs, "owners", a.owners ?? [], b.owners ?? [], { label: "Owners" });
|
|
32
|
+
compareArray(diffs, "tags", a.tags ?? [], b.tags ?? [], { label: "Tags" });
|
|
33
|
+
compareStructuralHints(diffs, a, b);
|
|
34
|
+
return options.breakingOnly ? diffs.filter((d) => d.type === "breaking") : diffs;
|
|
35
|
+
}
|
|
36
|
+
function compareScalar(diffs, path, a, b, config) {
|
|
37
|
+
if (a === b) return;
|
|
38
|
+
diffs.push({
|
|
39
|
+
type: config.breaking ? "breaking" : "changed",
|
|
40
|
+
path,
|
|
41
|
+
oldValue: a,
|
|
42
|
+
newValue: b,
|
|
43
|
+
description: `${config.label} changed`
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function compareArray(diffs, path, a, b, config) {
|
|
47
|
+
const aSorted = [...a].sort();
|
|
48
|
+
const bSorted = [...b].sort();
|
|
49
|
+
if (JSON.stringify(aSorted) === JSON.stringify(bSorted)) return;
|
|
50
|
+
diffs.push({
|
|
51
|
+
type: "changed",
|
|
52
|
+
path,
|
|
53
|
+
oldValue: aSorted,
|
|
54
|
+
newValue: bSorted,
|
|
55
|
+
description: `${config.label} changed`
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function isStabilityDowngrade(a, b) {
|
|
59
|
+
const order = {
|
|
60
|
+
experimental: 0,
|
|
61
|
+
beta: 1,
|
|
62
|
+
stable: 2,
|
|
63
|
+
deprecated: 3
|
|
64
|
+
};
|
|
65
|
+
const aValue = a.stability ? order[a.stability] ?? 0 : 0;
|
|
66
|
+
return (b.stability ? order[b.stability] ?? 0 : 0) > aValue;
|
|
67
|
+
}
|
|
68
|
+
function compareStructuralHints(diffs, a, b) {
|
|
69
|
+
compareScalar(diffs, "hasMeta", a.hasMeta, b.hasMeta, {
|
|
70
|
+
breaking: a.specType === "operation" || b.specType === "operation",
|
|
71
|
+
label: "meta section presence"
|
|
72
|
+
});
|
|
73
|
+
compareScalar(diffs, "hasIo", a.hasIo, b.hasIo, {
|
|
74
|
+
breaking: a.specType === "operation" || b.specType === "operation",
|
|
75
|
+
label: "io section presence"
|
|
76
|
+
});
|
|
77
|
+
compareScalar(diffs, "hasPolicy", a.hasPolicy, b.hasPolicy, {
|
|
78
|
+
breaking: a.specType === "operation" || b.specType === "operation",
|
|
79
|
+
label: "policy section presence"
|
|
80
|
+
});
|
|
81
|
+
compareScalar(diffs, "hasPayload", a.hasPayload, b.hasPayload, {
|
|
82
|
+
breaking: a.specType === "event" || b.specType === "event",
|
|
83
|
+
label: "payload section presence"
|
|
84
|
+
});
|
|
85
|
+
compareScalar(diffs, "hasContent", a.hasContent, b.hasContent, {
|
|
86
|
+
breaking: a.specType === "presentation" || b.specType === "presentation",
|
|
87
|
+
label: "content section presence"
|
|
88
|
+
});
|
|
89
|
+
compareScalar(diffs, "hasDefinition", a.hasDefinition, b.hasDefinition, {
|
|
90
|
+
breaking: a.specType === "workflow" || b.specType === "workflow",
|
|
91
|
+
label: "definition section presence"
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
//#endregion
|
|
96
|
+
export { computeSemanticDiff };
|
|
@@ -1 +1,151 @@
|
|
|
1
|
-
|
|
1
|
+
//#region ../../modules/contractspec-workspace/dist/analysis/feature-scan.js
|
|
2
|
+
/**
|
|
3
|
+
* Check if a file is a feature file based on naming conventions.
|
|
4
|
+
*/
|
|
5
|
+
function isFeatureFile(filePath) {
|
|
6
|
+
return filePath.includes(".feature.");
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Scan a feature source file to extract metadata.
|
|
10
|
+
*/
|
|
11
|
+
function scanFeatureSource(code, filePath) {
|
|
12
|
+
const key = matchStringField(code, "key") ?? extractKeyFromFilePath(filePath);
|
|
13
|
+
const title = matchStringField(code, "title") ?? void 0;
|
|
14
|
+
const description = matchStringField(code, "description") ?? void 0;
|
|
15
|
+
const domain = matchStringField(code, "domain") ?? void 0;
|
|
16
|
+
const stabilityRaw = matchStringField(code, "stability");
|
|
17
|
+
return {
|
|
18
|
+
filePath,
|
|
19
|
+
key,
|
|
20
|
+
title,
|
|
21
|
+
description,
|
|
22
|
+
domain,
|
|
23
|
+
stability: isStability(stabilityRaw) ? stabilityRaw : void 0,
|
|
24
|
+
owners: matchStringArrayField(code, "owners"),
|
|
25
|
+
tags: matchStringArrayField(code, "tags"),
|
|
26
|
+
operations: extractRefsFromArray(code, "operations"),
|
|
27
|
+
events: extractRefsFromArray(code, "events"),
|
|
28
|
+
presentations: extractRefsFromArray(code, "presentations"),
|
|
29
|
+
experiments: extractRefsFromArray(code, "experiments"),
|
|
30
|
+
capabilities: extractCapabilities(code),
|
|
31
|
+
opToPresentationLinks: extractOpToPresentationLinks(code)
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Extract refs from a named array (e.g., operations, events, presentations).
|
|
36
|
+
*/
|
|
37
|
+
function extractRefsFromArray(code, fieldName) {
|
|
38
|
+
const refs = [];
|
|
39
|
+
const arrayPattern = new RegExp(`${escapeRegex(fieldName)}\\s*:\\s*\\[([\\s\\S]*?)\\]`, "m");
|
|
40
|
+
const arrayMatch = code.match(arrayPattern);
|
|
41
|
+
if (!arrayMatch?.[1]) return refs;
|
|
42
|
+
const refPattern = /\{\s*name:\s*['"]([^'"]+)['"]\s*,\s*version:\s*(\d+)/g;
|
|
43
|
+
let match;
|
|
44
|
+
while ((match = refPattern.exec(arrayMatch[1])) !== null) if (match[1] && match[2]) refs.push({
|
|
45
|
+
name: match[1],
|
|
46
|
+
version: Number(match[2])
|
|
47
|
+
});
|
|
48
|
+
return refs;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Extract capability bindings (provides and requires).
|
|
52
|
+
*/
|
|
53
|
+
function extractCapabilities(code) {
|
|
54
|
+
const provides = [];
|
|
55
|
+
const requires = [];
|
|
56
|
+
const capabilitiesMatch = code.match(/capabilities\s*:\s*\{([\s\S]*?)\}/);
|
|
57
|
+
if (!capabilitiesMatch?.[1]) return {
|
|
58
|
+
provides,
|
|
59
|
+
requires
|
|
60
|
+
};
|
|
61
|
+
const capabilitiesContent = capabilitiesMatch[1];
|
|
62
|
+
const providesMatch = capabilitiesContent.match(/provides\s*:\s*\[([\s\S]*?)\]/);
|
|
63
|
+
if (providesMatch?.[1]) {
|
|
64
|
+
const refPattern = /\{\s*key:\s*['"]([^'"]+)['"]\s*,\s*version:\s*(\d+)/g;
|
|
65
|
+
let match;
|
|
66
|
+
while ((match = refPattern.exec(providesMatch[1])) !== null) if (match[1] && match[2]) provides.push({
|
|
67
|
+
name: match[1],
|
|
68
|
+
version: Number(match[2])
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
const requiresMatch = capabilitiesContent.match(/requires\s*:\s*\[([\s\S]*?)\]/);
|
|
72
|
+
if (requiresMatch?.[1]) {
|
|
73
|
+
const refPatternWithVersion = /\{\s*key:\s*['"]([^'"]+)['"]\s*,\s*version:\s*(\d+)/g;
|
|
74
|
+
const refPatternKeyOnly = /\{\s*key:\s*['"]([^'"]+)['"]\s*\}/g;
|
|
75
|
+
let match = null;
|
|
76
|
+
while ((match = refPatternWithVersion.exec(requiresMatch[1])) !== null) if (match[1] && match[2]) requires.push({
|
|
77
|
+
name: match[1],
|
|
78
|
+
version: Number(match[2])
|
|
79
|
+
});
|
|
80
|
+
while ((match = refPatternKeyOnly.exec(requiresMatch[1])) !== null) if (match && match[1]) {
|
|
81
|
+
if (!requires.some((r) => r.name === match[1])) requires.push({
|
|
82
|
+
name: match[1],
|
|
83
|
+
version: 1
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
provides,
|
|
89
|
+
requires
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Extract opToPresentation links.
|
|
94
|
+
*/
|
|
95
|
+
function extractOpToPresentationLinks(code) {
|
|
96
|
+
const links = [];
|
|
97
|
+
const arrayMatch = code.match(/opToPresentation\s*:\s*\[([\s\S]*?)\]/);
|
|
98
|
+
if (!arrayMatch?.[1]) return links;
|
|
99
|
+
const linkPattern = /\{\s*op:\s*\{\s*name:\s*['"]([^'"]+)['"]\s*,\s*version:\s*(\d+)\s*\}\s*,\s*pres:\s*\{\s*name:\s*['"]([^'"]+)['"]\s*,\s*version:\s*(\d+)\s*\}/g;
|
|
100
|
+
let match;
|
|
101
|
+
while ((match = linkPattern.exec(arrayMatch[1])) !== null) if (match[1] && match[2] && match[3] && match[4]) links.push({
|
|
102
|
+
op: {
|
|
103
|
+
name: match[1],
|
|
104
|
+
version: Number(match[2])
|
|
105
|
+
},
|
|
106
|
+
pres: {
|
|
107
|
+
name: match[3],
|
|
108
|
+
version: Number(match[4])
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
return links;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Extract key from file path as fallback.
|
|
115
|
+
*/
|
|
116
|
+
function extractKeyFromFilePath(filePath) {
|
|
117
|
+
return (filePath.split("/").pop() ?? filePath).replace(/\.feature\.[jt]s$/, "").replace(/[^a-zA-Z0-9-]/g, "-");
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Match a string field in source code.
|
|
121
|
+
*/
|
|
122
|
+
function matchStringField(code, field) {
|
|
123
|
+
const regex = /* @__PURE__ */ new RegExp(`${escapeRegex(field)}\\s*:\\s*['"]([^'"]+)['"]`);
|
|
124
|
+
return code.match(regex)?.[1] ?? null;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Match a string array field in source code.
|
|
128
|
+
*/
|
|
129
|
+
function matchStringArrayField(code, field) {
|
|
130
|
+
const regex = /* @__PURE__ */ new RegExp(`${escapeRegex(field)}\\s*:\\s*\\[([\\s\\S]*?)\\]`);
|
|
131
|
+
const match = code.match(regex);
|
|
132
|
+
if (!match?.[1]) return void 0;
|
|
133
|
+
const inner = match[1];
|
|
134
|
+
const items = Array.from(inner.matchAll(/['"]([^'"]+)['"]/g)).map((m) => m[1]).filter((value) => typeof value === "string" && value.length > 0);
|
|
135
|
+
return items.length > 0 ? items : void 0;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Check if a value is a valid stability.
|
|
139
|
+
*/
|
|
140
|
+
function isStability(value) {
|
|
141
|
+
return value === "experimental" || value === "beta" || value === "stable" || value === "deprecated";
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Escape regex special characters.
|
|
145
|
+
*/
|
|
146
|
+
function escapeRegex(value) {
|
|
147
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
//#endregion
|
|
151
|
+
export { isFeatureFile, scanFeatureSource };
|