@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
package/dist/formatters/text.js
CHANGED
|
@@ -1,2 +1,208 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/formatters/text.ts
|
|
2
|
+
/**
|
|
3
|
+
* Format CI check results as text lines.
|
|
4
|
+
* Returns structured lines that can be styled by the CLI.
|
|
5
|
+
*/
|
|
6
|
+
function formatAsTextLines(result, options = {}) {
|
|
7
|
+
const lines = [];
|
|
8
|
+
const { verbose = false, showTiming = true, groupByFile = false } = options;
|
|
9
|
+
lines.push({
|
|
10
|
+
text: "",
|
|
11
|
+
style: "normal"
|
|
12
|
+
});
|
|
13
|
+
lines.push({
|
|
14
|
+
text: "📋 ContractSpec CI Check Results",
|
|
15
|
+
style: "bold"
|
|
16
|
+
});
|
|
17
|
+
lines.push({
|
|
18
|
+
text: "",
|
|
19
|
+
style: "normal"
|
|
20
|
+
});
|
|
21
|
+
if (result.commitSha || result.branch) {
|
|
22
|
+
const gitInfo = [result.branch ? `branch: ${result.branch}` : null, result.commitSha ? `commit: ${result.commitSha.slice(0, 7)}` : null].filter(Boolean).join(", ");
|
|
23
|
+
lines.push({
|
|
24
|
+
text: `Git: ${gitInfo}`,
|
|
25
|
+
style: "muted"
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
lines.push({
|
|
29
|
+
text: "",
|
|
30
|
+
style: "normal"
|
|
31
|
+
});
|
|
32
|
+
lines.push({
|
|
33
|
+
text: "Check Results:",
|
|
34
|
+
style: "bold"
|
|
35
|
+
});
|
|
36
|
+
for (const category of result.categories) {
|
|
37
|
+
const icon = category.passed ? "✓" : "✗";
|
|
38
|
+
const style = category.passed ? "success" : "error";
|
|
39
|
+
const stats = formatCategoryStats(category);
|
|
40
|
+
const timing = showTiming ? ` (${category.durationMs}ms)` : "";
|
|
41
|
+
lines.push({
|
|
42
|
+
text: ` ${icon} ${category.label}: ${stats}${timing}`,
|
|
43
|
+
style
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if (result.issues.length > 0) {
|
|
47
|
+
lines.push({
|
|
48
|
+
text: "",
|
|
49
|
+
style: "normal"
|
|
50
|
+
});
|
|
51
|
+
lines.push({
|
|
52
|
+
text: "Issues:",
|
|
53
|
+
style: "bold"
|
|
54
|
+
});
|
|
55
|
+
if (groupByFile) {
|
|
56
|
+
const byFile = groupIssuesByFile(result.issues);
|
|
57
|
+
for (const [file, issues] of byFile) {
|
|
58
|
+
lines.push({
|
|
59
|
+
text: "",
|
|
60
|
+
style: "normal"
|
|
61
|
+
});
|
|
62
|
+
lines.push({
|
|
63
|
+
text: ` ${file || "(no file)"}`,
|
|
64
|
+
style: "bold",
|
|
65
|
+
indent: 1
|
|
66
|
+
});
|
|
67
|
+
for (const issue of issues) lines.push(...formatIssueLines(issue, verbose, 2));
|
|
68
|
+
}
|
|
69
|
+
} else {
|
|
70
|
+
const errors = result.issues.filter((i) => i.severity === "error");
|
|
71
|
+
const warnings = result.issues.filter((i) => i.severity === "warning");
|
|
72
|
+
const notes = result.issues.filter((i) => i.severity === "note");
|
|
73
|
+
if (errors.length > 0) {
|
|
74
|
+
lines.push({
|
|
75
|
+
text: "",
|
|
76
|
+
style: "normal"
|
|
77
|
+
});
|
|
78
|
+
lines.push({
|
|
79
|
+
text: " Errors:",
|
|
80
|
+
style: "error",
|
|
81
|
+
indent: 1
|
|
82
|
+
});
|
|
83
|
+
for (const issue of errors) lines.push(...formatIssueLines(issue, verbose, 2));
|
|
84
|
+
}
|
|
85
|
+
if (warnings.length > 0) {
|
|
86
|
+
lines.push({
|
|
87
|
+
text: "",
|
|
88
|
+
style: "normal"
|
|
89
|
+
});
|
|
90
|
+
lines.push({
|
|
91
|
+
text: " Warnings:",
|
|
92
|
+
style: "warning",
|
|
93
|
+
indent: 1
|
|
94
|
+
});
|
|
95
|
+
for (const issue of warnings) lines.push(...formatIssueLines(issue, verbose, 2));
|
|
96
|
+
}
|
|
97
|
+
if (notes.length > 0 && verbose) {
|
|
98
|
+
lines.push({
|
|
99
|
+
text: "",
|
|
100
|
+
style: "normal"
|
|
101
|
+
});
|
|
102
|
+
lines.push({
|
|
103
|
+
text: " Notes:",
|
|
104
|
+
style: "muted",
|
|
105
|
+
indent: 1
|
|
106
|
+
});
|
|
107
|
+
for (const issue of notes) lines.push(...formatIssueLines(issue, verbose, 2));
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
lines.push({
|
|
112
|
+
text: "",
|
|
113
|
+
style: "normal"
|
|
114
|
+
});
|
|
115
|
+
lines.push({
|
|
116
|
+
text: "─".repeat(50),
|
|
117
|
+
style: "muted"
|
|
118
|
+
});
|
|
119
|
+
const summaryParts = [
|
|
120
|
+
result.totalErrors > 0 ? `${result.totalErrors} error(s)` : null,
|
|
121
|
+
result.totalWarnings > 0 ? `${result.totalWarnings} warning(s)` : null,
|
|
122
|
+
result.totalNotes > 0 && verbose ? `${result.totalNotes} note(s)` : null
|
|
123
|
+
].filter(Boolean);
|
|
124
|
+
if (summaryParts.length > 0) lines.push({
|
|
125
|
+
text: `Found: ${summaryParts.join(", ")}`,
|
|
126
|
+
style: result.success ? "warning" : "error"
|
|
127
|
+
});
|
|
128
|
+
if (showTiming) lines.push({
|
|
129
|
+
text: `Duration: ${result.durationMs}ms`,
|
|
130
|
+
style: "muted"
|
|
131
|
+
});
|
|
132
|
+
lines.push({
|
|
133
|
+
text: "",
|
|
134
|
+
style: "normal"
|
|
135
|
+
});
|
|
136
|
+
if (result.success) lines.push({
|
|
137
|
+
text: "✅ All CI checks passed!",
|
|
138
|
+
style: "success"
|
|
139
|
+
});
|
|
140
|
+
else lines.push({
|
|
141
|
+
text: "❌ CI checks failed",
|
|
142
|
+
style: "error"
|
|
143
|
+
});
|
|
144
|
+
lines.push({
|
|
145
|
+
text: "",
|
|
146
|
+
style: "normal"
|
|
147
|
+
});
|
|
148
|
+
return lines;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Format CI check results as plain text string.
|
|
152
|
+
*/
|
|
153
|
+
function formatAsText(result, options = {}) {
|
|
154
|
+
return formatAsTextLines(result, options).map((line) => " ".repeat(line.indent ?? 0) + line.text).join("\n");
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Format category stats.
|
|
158
|
+
*/
|
|
159
|
+
function formatCategoryStats(category) {
|
|
160
|
+
const parts = [];
|
|
161
|
+
if (category.errors > 0) parts.push(`${category.errors} error(s)`);
|
|
162
|
+
if (category.warnings > 0) parts.push(`${category.warnings} warning(s)`);
|
|
163
|
+
if (parts.length === 0) return "passed";
|
|
164
|
+
return parts.join(", ");
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Format a single issue as text lines.
|
|
168
|
+
*/
|
|
169
|
+
function formatIssueLines(issue, verbose, baseIndent) {
|
|
170
|
+
const lines = [];
|
|
171
|
+
const icon = issue.severity === "error" ? "✗" : issue.severity === "warning" ? "⚠" : "○";
|
|
172
|
+
const style = issue.severity === "error" ? "error" : issue.severity === "warning" ? "warning" : "muted";
|
|
173
|
+
let mainLine = `${icon} ${issue.message}`;
|
|
174
|
+
if (issue.file) {
|
|
175
|
+
const location = issue.line ? `:${issue.line}` : "";
|
|
176
|
+
mainLine += ` (${issue.file}${location})`;
|
|
177
|
+
}
|
|
178
|
+
lines.push({
|
|
179
|
+
text: mainLine,
|
|
180
|
+
style,
|
|
181
|
+
indent: baseIndent
|
|
182
|
+
});
|
|
183
|
+
if (verbose && issue.context) {
|
|
184
|
+
const contextStr = JSON.stringify(issue.context);
|
|
185
|
+
if (contextStr !== "{}") lines.push({
|
|
186
|
+
text: `Context: ${contextStr}`,
|
|
187
|
+
style: "muted",
|
|
188
|
+
indent: baseIndent + 1
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
return lines;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Group issues by file.
|
|
195
|
+
*/
|
|
196
|
+
function groupIssuesByFile(issues) {
|
|
197
|
+
const byFile = /* @__PURE__ */ new Map();
|
|
198
|
+
for (const issue of issues) {
|
|
199
|
+
const file = issue.file ?? "";
|
|
200
|
+
if (!byFile.has(file)) byFile.set(file, []);
|
|
201
|
+
const fileIssues = byFile.get(file);
|
|
202
|
+
if (fileIssues) fileIssues.push(issue);
|
|
203
|
+
}
|
|
204
|
+
return new Map([...byFile.entries()].sort(([a], [b]) => a.localeCompare(b)));
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
//#endregion
|
|
208
|
+
export { formatAsText, formatAsTextLines };
|
package/dist/index.js
CHANGED
|
@@ -1 +1,81 @@
|
|
|
1
|
-
import{e}from"./modules/contractspec-workspace/dist/types/generation-types.js";import{e as t,h as n,i as r,n as i,r as a,t as o}from"./modules/contractspec-workspace/dist/analysis/spec-scan.js";import{e as s,t as c}from"./modules/contractspec-workspace/dist/analysis/feature-scan.js";import{t as l}from"./modules/contractspec-workspace/dist/analysis/diff/semantic.js";import{a as u,e as d,i as f,n as p,r as m,t as h}from"./modules/contractspec-workspace/dist/analysis/deps/graph.js";import{e as g}from"./modules/contractspec-workspace/dist/analysis/deps/parse-imports.js";import{e as _}from"./modules/contractspec-workspace/dist/analysis/validate/spec-structure.js";import{e as v,i as y,n as b,r as x,t as S}from"./modules/contractspec-workspace/dist/templates/utils.js";import{n as C}from"./modules/contractspec-workspace/dist/templates/operation.js";import{t as w}from"./modules/contractspec-workspace/dist/templates/event.js";import{t as T}from"./modules/contractspec-workspace/dist/templates/presentation.js";import{n as E}from"./modules/contractspec-workspace/dist/templates/workflow.js";import{e as D}from"./modules/contractspec-workspace/dist/templates/workflow-runner.js";import{n as O}from"./modules/contractspec-workspace/dist/templates/data-view.js";import{t as k}from"./modules/contractspec-workspace/dist/templates/telemetry.js";import{t as A}from"./modules/contractspec-workspace/dist/templates/experiment.js";import{t as j}from"./modules/contractspec-workspace/dist/templates/app-config.js";import{n as M}from"./modules/contractspec-workspace/dist/templates/migration.js";import{d as N}from"./modules/contractspec-workspace/dist/templates/integration.js";import{n as P}from"./modules/contractspec-workspace/dist/templates/knowledge.js";import{a as F,i as I,r as L}from"./modules/contractspec-workspace/dist/templates/handler.js";import{e as R,i as z,n as B,r as V,t as H}from"./modules/contractspec-workspace/dist/ai/spec-creation.js";import{e as U,i as W,n as G,r as K,t as q}from"./modules/contractspec-workspace/dist/ai/code-generation.js";import{createNodeFsAdapter as J}from"./adapters/fs.js";import{createNodeGitAdapter as Y}from"./adapters/git.js";import{createNodeWatcherAdapter as X}from"./adapters/watcher.js";import{createNodeAiAdapter as Z}from"./adapters/ai.js";import{createConsoleLoggerAdapter as Q,createNoopLoggerAdapter as $}from"./adapters/logger.js";import{createNodeAdapters as ee}from"./adapters/factory.js";import{detectPackageManager as te,findPackageRoot as ne,findWorkspaceRoot as re,getExecCommand as ie,getInstallCommand as ae,getPackageName as oe,getRunCommand as se,getWorkspaceInfo as ce,getWorkspacePackages as le,isMonorepo as ue}from"./adapters/workspace.js";import"./adapters/index.js";import{validateSpec as de,validateSpecs as fe}from"./services/validate.js";import{validateImplementationFiles as pe}from"./services/validate-implementation.js";import{compareSpecs as me}from"./services/diff.js";import{analyzeDeps as he,exportGraphAsDot as ge,getContractNode as _e,getGraphStats as ve}from"./services/deps.js";import{groupSpecsByType as ye,listSpecs as be}from"./services/list.js";import{getApiKey as xe,loadWorkspaceConfig as Se,mergeWorkspaceConfig as Ce}from"./services/config.js";import{buildSpec as we}from"./services/build.js";import{importFromOpenApiService as Te}from"./services/openapi/import-service.js";import{syncWithOpenApiService as Ee}from"./services/openapi/sync-service.js";import{validateAgainstOpenApiService as De}from"./services/openapi/validate-service.js";import{exportOpenApi as Oe}from"./services/openapi/export-service.js";import{RegistryClient as ke,addToRegistry as Ae,listFromRegistry as je,resolveRegistryUrl as Me,searchRegistry as Ne}from"./services/registry.js";import{syncSpecs as Pe}from"./services/sync.js";import{watchSpecs as Fe}from"./services/watch.js";import{cleanArtifacts as Ie}from"./services/clean.js";import{runTests as Le}from"./services/test.js";import{createRegeneratorService as Re}from"./services/regenerator.js";import{findAllConfigFiles as ze,formatWorkspaceInfo as Be,getExtendedWorkspaceInfo as Ve,mergeMonorepoConfigs as He}from"./services/workspace-info.js";import{analyzeIntegrity as Ue,filterIssuesBySeverity as We,filterIssuesByType as Ge,getAllSpecs as Ke}from"./services/integrity.js";import{generateMermaidDiagram as qe}from"./services/integrity-diagram.js";import{ALL_SETUP_TARGETS as Je,SETUP_TARGET_LABELS as Ye}from"./services/setup/types.js";import{generateAgentsMd as Xe,generateClaudeMcpConfig as Ze,generateContractsrcConfig as Qe,generateCursorMcpConfig as $e,generateCursorRules as et,generateVscodeSettings as tt,getClaudeDesktopConfigPath as nt}from"./services/setup/config-generators.js";import{deepMergeOverwrite as rt,deepMergePreserve as it,formatJson as at,safeParseJson as ot}from"./services/setup/file-merger.js";import{runSetup as st}from"./services/setup/setup-service.js";import{ALL_CHECK_CATEGORIES as ct,CHECK_CATEGORY_LABELS as lt}from"./services/doctor/types.js";import{formatCheckResult as ut,formatDoctorSummary as dt,runDoctor as ft}from"./services/doctor/doctor-service.js";import{ALL_CI_CHECK_CATEGORIES as pt,CI_CHECK_CATEGORY_LABELS as mt}from"./services/ci-check/types.js";import{discoverAllImplementations as ht,discoverImplementationsForSpec as gt,extractSpecReferences as _t,inferImplementationType as vt}from"./services/implementation/discovery.js";import{getImplementationSummary as yt,resolveAllImplementations as bt,resolveImplementations as xt}from"./services/implementation/resolver.js";import{DEFAULT_CACHE_CONFIG as St}from"./services/verification-cache/types.js";import{VerificationCacheService as Ct,cacheKeyToString as wt,computeContentHash as Tt,createVerificationCacheService as Et,stringToCacheKey as Dt}from"./services/verification-cache/cache-service.js";import{InMemoryCacheStorage as Ot,createInMemoryCacheStorage as kt}from"./services/verification-cache/adapters/in-memory.js";import{FileSystemCacheStorage as At,createFileSystemCacheStorage as jt}from"./services/verification-cache/adapters/filesystem.js";import{WorkspaceStateCacheStorage as Mt,createWorkspaceStateCacheStorage as Nt}from"./services/verification-cache/adapters/workspace-state.js";import{runCIChecks as Pt}from"./services/ci-check/ci-check-service.js";import{ClaudeCodeAdapter as Ft,claudeCodeAdapter as It}from"./services/agent-guide/adapters/claude-code.js";import{CursorCLIAdapter as Lt,cursorCLIAdapter as Rt}from"./services/agent-guide/adapters/cursor-cli.js";import{GenericMCPAdapter as zt,genericMCPAdapter as Bt}from"./services/agent-guide/adapters/generic-mcp.js";import{agentAdapters as Vt,getAgentAdapter as Ht,listAgentTypes as Ut}from"./services/agent-guide/adapters/index.js";import{AgentGuideService as Wt,agentGuideService as Gt,createAgentGuideService as Kt}from"./services/agent-guide/agent-guide-service.js";import{verifyStructure as qt}from"./services/verify/structure-verifier.js";import{verifyBehavior as Jt}from"./services/verify/behavior-verifier.js";import{createQuickAIReview as Yt,verifySemanticFields as Xt,verifyWithAI as Zt,verifyWithAIEnhanced as Qt}from"./services/verify/ai-verifier.js";import{VerifyService as $t,createVerifyService as en,verifyService as tn}from"./services/verify/verify-service.js";import"./services/index.js";import{formatters_exports as nn}from"./formatters/index.js";import{templates_exports as rn}from"./templates/index.js";import{ai_exports as an}from"./ai/index.js";export{ct as ALL_CHECK_CATEGORIES,pt as ALL_CI_CHECK_CATEGORIES,Je as ALL_SETUP_TARGETS,Wt as AgentGuideService,lt as CHECK_CATEGORY_LABELS,mt as CI_CHECK_CATEGORY_LABELS,Ft as ClaudeCodeAdapter,Lt as CursorCLIAdapter,St as DEFAULT_CACHE_CONFIG,e as DEFAULT_WORKSPACE_CONFIG,At as FileSystemCacheStorage,zt as GenericMCPAdapter,Ot as InMemoryCacheStorage,ke as RegistryClient,Ye as SETUP_TARGET_LABELS,Ct as VerificationCacheService,$t as VerifyService,Mt as WorkspaceStateCacheStorage,u as addContractNode,z as addExampleContext,Ae as addToRegistry,Vt as agentAdapters,Gt as agentGuideService,an as ai,he as analyzeDeps,Ue as analyzeIntegrity,q as buildComponentPrompt,H as buildEventSpecPrompt,G as buildFormPrompt,U as buildHandlerPrompt,R as buildOperationSpecPrompt,B as buildPresentationSpecPrompt,d as buildReverseEdges,we as buildSpec,K as buildTestPrompt,wt as cacheKeyToString,x as capitalize,It as claudeCodeAdapter,Ie as cleanArtifacts,me as compareSpecs,Tt as computeContentHash,l as computeSemanticDiff,Kt as createAgentGuideService,Q as createConsoleLoggerAdapter,f as createContractGraph,jt as createFileSystemCacheStorage,kt as createInMemoryCacheStorage,ee as createNodeAdapters,Z as createNodeAiAdapter,J as createNodeFsAdapter,Y as createNodeGitAdapter,X as createNodeWatcherAdapter,$ as createNoopLoggerAdapter,Yt as createQuickAIReview,Re as createRegeneratorService,Et as createVerificationCacheService,en as createVerifyService,Nt as createWorkspaceStateCacheStorage,Rt as cursorCLIAdapter,rt as deepMergeOverwrite,it as deepMergePreserve,h as detectCycles,te as detectPackageManager,ht as discoverAllImplementations,gt as discoverImplementationsForSpec,y as escapeString,ge as exportGraphAsDot,Oe as exportOpenApi,i as extractEmittedEvents,a as extractPolicyRefs,_t as extractSpecReferences,r as extractTestRefs,We as filterIssuesBySeverity,Ge as filterIssuesByType,ze as findAllConfigFiles,p as findMissingDependencies,ne as findPackageRoot,re as findWorkspaceRoot,ut as formatCheckResult,dt as formatDoctorSummary,at as formatJson,Be as formatWorkspaceInfo,nn as formatters,Xe as generateAgentsMd,j as generateAppBlueprintSpec,Ze as generateClaudeMcpConfig,I as generateComponentTemplate,Qe as generateContractsrcConfig,$e as generateCursorMcpConfig,et as generateCursorRules,O as generateDataViewSpec,w as generateEventSpec,A as generateExperimentSpec,L as generateHandlerTemplate,N as generateIntegrationSpec,P as generateKnowledgeSpaceSpec,qe as generateMermaidDiagram,M as generateMigrationSpec,C as generateOperationSpec,T as generatePresentationSpec,k as generateTelemetrySpec,F as generateTestTemplate,tt as generateVscodeSettings,D as generateWorkflowRunnerTemplate,E as generateWorkflowSpec,Bt as genericMCPAdapter,Ht as getAgentAdapter,Ke as getAllSpecs,xe as getApiKey,nt as getClaudeDesktopConfigPath,W as getCodeGenSystemPrompt,_e as getContractNode,ie as getExecCommand,Ve as getExtendedWorkspaceInfo,ve as getGraphStats,yt as getImplementationSummary,ae as getInstallCommand,oe as getPackageName,se as getRunCommand,V as getSystemPrompt,ce as getWorkspaceInfo,le as getWorkspacePackages,ye as groupSpecsByType,Te as importFromOpenApiService,vt as inferImplementationType,t as inferSpecTypeFromFilePath,s as isFeatureFile,ue as isMonorepo,Ut as listAgentTypes,je as listFromRegistry,be as listSpecs,Se as loadWorkspaceConfig,He as mergeMonorepoConfigs,Ce as mergeWorkspaceConfig,g as parseImportedSpecNames,bt as resolveAllImplementations,xt as resolveImplementations,Me as resolveRegistryUrl,Pt as runCIChecks,ft as runDoctor,st as runSetup,Le as runTests,ot as safeParseJson,n as scanAllSpecsFromSource,c as scanFeatureSource,o as scanSpecSource,Ne as searchRegistry,Dt as stringToCacheKey,Pe as syncSpecs,Ee as syncWithOpenApiService,rn as templates,v as toCamelCase,m as toDot,b as toKebabCase,S as toPascalCase,De as validateAgainstOpenApiService,pe as validateImplementationFiles,de as validateSpec,_ as validateSpecStructure,fe as validateSpecs,Jt as verifyBehavior,Xt as verifySemanticFields,tn as verifyService,qt as verifyStructure,Zt as verifyWithAI,Qt as verifyWithAIEnhanced,Fe as watchSpecs};
|
|
1
|
+
import { DEFAULT_WORKSPACE_CONFIG } from "./modules/contractspec-workspace/dist/types/generation-types.js";
|
|
2
|
+
import { extractEmittedEvents, extractPolicyRefs, extractTestRefs, inferSpecTypeFromFilePath, scanAllSpecsFromSource, scanSpecSource } from "./modules/contractspec-workspace/dist/analysis/spec-scan.js";
|
|
3
|
+
import { isFeatureFile, scanFeatureSource } from "./modules/contractspec-workspace/dist/analysis/feature-scan.js";
|
|
4
|
+
import { computeSemanticDiff } from "./modules/contractspec-workspace/dist/analysis/diff/semantic.js";
|
|
5
|
+
import { addContractNode, buildReverseEdges, createContractGraph, detectCycles, findMissingDependencies, toDot } from "./modules/contractspec-workspace/dist/analysis/deps/graph.js";
|
|
6
|
+
import { parseImportedSpecNames } from "./modules/contractspec-workspace/dist/analysis/deps/parse-imports.js";
|
|
7
|
+
import { validateSpecStructure } from "./modules/contractspec-workspace/dist/analysis/validate/spec-structure.js";
|
|
8
|
+
import { capitalize, escapeString, toCamelCase, toKebabCase, toPascalCase } from "./modules/contractspec-workspace/dist/templates/utils.js";
|
|
9
|
+
import { generateOperationSpec } from "./modules/contractspec-workspace/dist/templates/operation.js";
|
|
10
|
+
import { generateEventSpec } from "./modules/contractspec-workspace/dist/templates/event.js";
|
|
11
|
+
import { generatePresentationSpec } from "./modules/contractspec-workspace/dist/templates/presentation.js";
|
|
12
|
+
import { generateWorkflowSpec } from "./modules/contractspec-workspace/dist/templates/workflow.js";
|
|
13
|
+
import { generateWorkflowRunnerTemplate } from "./modules/contractspec-workspace/dist/templates/workflow-runner.js";
|
|
14
|
+
import { generateDataViewSpec } from "./modules/contractspec-workspace/dist/templates/data-view.js";
|
|
15
|
+
import { generateTelemetrySpec } from "./modules/contractspec-workspace/dist/templates/telemetry.js";
|
|
16
|
+
import { generateExperimentSpec } from "./modules/contractspec-workspace/dist/templates/experiment.js";
|
|
17
|
+
import { generateAppBlueprintSpec } from "./modules/contractspec-workspace/dist/templates/app-config.js";
|
|
18
|
+
import { generateMigrationSpec } from "./modules/contractspec-workspace/dist/templates/migration.js";
|
|
19
|
+
import { generateIntegrationSpec } from "./modules/contractspec-workspace/dist/templates/integration.js";
|
|
20
|
+
import { generateKnowledgeSpaceSpec } from "./modules/contractspec-workspace/dist/templates/knowledge.js";
|
|
21
|
+
import { generateComponentTemplate, generateHandlerTemplate, generateTestTemplate } from "./modules/contractspec-workspace/dist/templates/handler.js";
|
|
22
|
+
import { addExampleContext, buildEventSpecPrompt, buildOperationSpecPrompt, buildPresentationSpecPrompt, getSystemPrompt } from "./modules/contractspec-workspace/dist/ai/spec-creation.js";
|
|
23
|
+
import { buildComponentPrompt, buildFormPrompt, buildHandlerPrompt, buildTestPrompt, getCodeGenSystemPrompt } from "./modules/contractspec-workspace/dist/ai/code-generation.js";
|
|
24
|
+
import { createNodeFsAdapter } from "./adapters/fs.js";
|
|
25
|
+
import { createNodeGitAdapter } from "./adapters/git.js";
|
|
26
|
+
import { createNodeWatcherAdapter } from "./adapters/watcher.js";
|
|
27
|
+
import { createNodeAiAdapter } from "./adapters/ai.js";
|
|
28
|
+
import { createConsoleLoggerAdapter, createNoopLoggerAdapter } from "./adapters/logger.js";
|
|
29
|
+
import { createNodeAdapters } from "./adapters/factory.js";
|
|
30
|
+
import { detectPackageManager, findPackageRoot, findWorkspaceRoot, getExecCommand, getInstallCommand, getPackageName, getRunCommand, getWorkspaceInfo, getWorkspacePackages, isMonorepo } from "./adapters/workspace.js";
|
|
31
|
+
import "./adapters/index.js";
|
|
32
|
+
import { validateSpec, validateSpecs } from "./services/validate.js";
|
|
33
|
+
import { validateImplementationFiles } from "./services/validate-implementation.js";
|
|
34
|
+
import { compareSpecs } from "./services/diff.js";
|
|
35
|
+
import { analyzeDeps, exportGraphAsDot, getContractNode, getGraphStats } from "./services/deps.js";
|
|
36
|
+
import { groupSpecsByType, listSpecs } from "./services/list.js";
|
|
37
|
+
import { getApiKey, loadWorkspaceConfig, mergeWorkspaceConfig } from "./services/config.js";
|
|
38
|
+
import { buildSpec } from "./services/build.js";
|
|
39
|
+
import { importFromOpenApiService } from "./services/openapi/import-service.js";
|
|
40
|
+
import { syncWithOpenApiService } from "./services/openapi/sync-service.js";
|
|
41
|
+
import { validateAgainstOpenApiService } from "./services/openapi/validate-service.js";
|
|
42
|
+
import { exportOpenApi } from "./services/openapi/export-service.js";
|
|
43
|
+
import { RegistryClient, addToRegistry, listFromRegistry, resolveRegistryUrl, searchRegistry } from "./services/registry.js";
|
|
44
|
+
import { syncSpecs } from "./services/sync.js";
|
|
45
|
+
import { watchSpecs } from "./services/watch.js";
|
|
46
|
+
import { cleanArtifacts } from "./services/clean.js";
|
|
47
|
+
import { runTests } from "./services/test.js";
|
|
48
|
+
import { createRegeneratorService } from "./services/regenerator.js";
|
|
49
|
+
import { findAllConfigFiles, formatWorkspaceInfo, getExtendedWorkspaceInfo, mergeMonorepoConfigs } from "./services/workspace-info.js";
|
|
50
|
+
import { analyzeIntegrity, filterIssuesBySeverity, filterIssuesByType, getAllSpecs } from "./services/integrity.js";
|
|
51
|
+
import { generateMermaidDiagram } from "./services/integrity-diagram.js";
|
|
52
|
+
import { ALL_SETUP_TARGETS, SETUP_TARGET_LABELS } from "./services/setup/types.js";
|
|
53
|
+
import { generateAgentsMd, generateClaudeMcpConfig, generateContractsrcConfig, generateCursorMcpConfig, generateCursorRules, generateVscodeSettings, getClaudeDesktopConfigPath } from "./services/setup/config-generators.js";
|
|
54
|
+
import { deepMergeOverwrite, deepMergePreserve, formatJson, safeParseJson } from "./services/setup/file-merger.js";
|
|
55
|
+
import { runSetup } from "./services/setup/setup-service.js";
|
|
56
|
+
import { ALL_CHECK_CATEGORIES, CHECK_CATEGORY_LABELS } from "./services/doctor/types.js";
|
|
57
|
+
import { formatCheckResult, formatDoctorSummary, runDoctor } from "./services/doctor/doctor-service.js";
|
|
58
|
+
import { ALL_CI_CHECK_CATEGORIES, CI_CHECK_CATEGORY_LABELS } from "./services/ci-check/types.js";
|
|
59
|
+
import { discoverAllImplementations, discoverImplementationsForSpec, extractSpecReferences, inferImplementationType } from "./services/implementation/discovery.js";
|
|
60
|
+
import { getImplementationSummary, resolveAllImplementations, resolveImplementations } from "./services/implementation/resolver.js";
|
|
61
|
+
import { DEFAULT_CACHE_CONFIG } from "./services/verification-cache/types.js";
|
|
62
|
+
import { VerificationCacheService, cacheKeyToString, computeContentHash, createVerificationCacheService, stringToCacheKey } from "./services/verification-cache/cache-service.js";
|
|
63
|
+
import { InMemoryCacheStorage, createInMemoryCacheStorage } from "./services/verification-cache/adapters/in-memory.js";
|
|
64
|
+
import { FileSystemCacheStorage, createFileSystemCacheStorage } from "./services/verification-cache/adapters/filesystem.js";
|
|
65
|
+
import { WorkspaceStateCacheStorage, createWorkspaceStateCacheStorage } from "./services/verification-cache/adapters/workspace-state.js";
|
|
66
|
+
import { runCIChecks } from "./services/ci-check/ci-check-service.js";
|
|
67
|
+
import { ClaudeCodeAdapter, claudeCodeAdapter } from "./services/agent-guide/adapters/claude-code.js";
|
|
68
|
+
import { CursorCLIAdapter, cursorCLIAdapter } from "./services/agent-guide/adapters/cursor-cli.js";
|
|
69
|
+
import { GenericMCPAdapter, genericMCPAdapter } from "./services/agent-guide/adapters/generic-mcp.js";
|
|
70
|
+
import { agentAdapters, getAgentAdapter, listAgentTypes } from "./services/agent-guide/adapters/index.js";
|
|
71
|
+
import { AgentGuideService, agentGuideService, createAgentGuideService } from "./services/agent-guide/agent-guide-service.js";
|
|
72
|
+
import { verifyStructure } from "./services/verify/structure-verifier.js";
|
|
73
|
+
import { verifyBehavior } from "./services/verify/behavior-verifier.js";
|
|
74
|
+
import { createQuickAIReview, verifySemanticFields, verifyWithAI, verifyWithAIEnhanced } from "./services/verify/ai-verifier.js";
|
|
75
|
+
import { VerifyService, createVerifyService, verifyService } from "./services/verify/verify-service.js";
|
|
76
|
+
import "./services/index.js";
|
|
77
|
+
import { formatters_exports } from "./formatters/index.js";
|
|
78
|
+
import { templates_exports } from "./templates/index.js";
|
|
79
|
+
import { ai_exports } from "./ai/index.js";
|
|
80
|
+
|
|
81
|
+
export { ALL_CHECK_CATEGORIES, ALL_CI_CHECK_CATEGORIES, ALL_SETUP_TARGETS, AgentGuideService, CHECK_CATEGORY_LABELS, CI_CHECK_CATEGORY_LABELS, ClaudeCodeAdapter, CursorCLIAdapter, DEFAULT_CACHE_CONFIG, DEFAULT_WORKSPACE_CONFIG, FileSystemCacheStorage, GenericMCPAdapter, InMemoryCacheStorage, RegistryClient, SETUP_TARGET_LABELS, VerificationCacheService, VerifyService, WorkspaceStateCacheStorage, addContractNode, addExampleContext, addToRegistry, agentAdapters, agentGuideService, ai_exports as ai, analyzeDeps, analyzeIntegrity, buildComponentPrompt, buildEventSpecPrompt, buildFormPrompt, buildHandlerPrompt, buildOperationSpecPrompt, buildPresentationSpecPrompt, buildReverseEdges, buildSpec, buildTestPrompt, cacheKeyToString, capitalize, claudeCodeAdapter, cleanArtifacts, compareSpecs, computeContentHash, computeSemanticDiff, createAgentGuideService, createConsoleLoggerAdapter, createContractGraph, createFileSystemCacheStorage, createInMemoryCacheStorage, createNodeAdapters, createNodeAiAdapter, createNodeFsAdapter, createNodeGitAdapter, createNodeWatcherAdapter, createNoopLoggerAdapter, createQuickAIReview, createRegeneratorService, createVerificationCacheService, createVerifyService, createWorkspaceStateCacheStorage, cursorCLIAdapter, deepMergeOverwrite, deepMergePreserve, detectCycles, detectPackageManager, discoverAllImplementations, discoverImplementationsForSpec, escapeString, exportGraphAsDot, exportOpenApi, extractEmittedEvents, extractPolicyRefs, extractSpecReferences, extractTestRefs, filterIssuesBySeverity, filterIssuesByType, findAllConfigFiles, findMissingDependencies, findPackageRoot, findWorkspaceRoot, formatCheckResult, formatDoctorSummary, formatJson, formatWorkspaceInfo, formatters_exports as formatters, generateAgentsMd, generateAppBlueprintSpec, generateClaudeMcpConfig, generateComponentTemplate, generateContractsrcConfig, generateCursorMcpConfig, generateCursorRules, generateDataViewSpec, generateEventSpec, generateExperimentSpec, generateHandlerTemplate, generateIntegrationSpec, generateKnowledgeSpaceSpec, generateMermaidDiagram, generateMigrationSpec, generateOperationSpec, generatePresentationSpec, generateTelemetrySpec, generateTestTemplate, generateVscodeSettings, generateWorkflowRunnerTemplate, generateWorkflowSpec, genericMCPAdapter, getAgentAdapter, getAllSpecs, getApiKey, getClaudeDesktopConfigPath, getCodeGenSystemPrompt, getContractNode, getExecCommand, getExtendedWorkspaceInfo, getGraphStats, getImplementationSummary, getInstallCommand, getPackageName, getRunCommand, getSystemPrompt, getWorkspaceInfo, getWorkspacePackages, groupSpecsByType, importFromOpenApiService, inferImplementationType, inferSpecTypeFromFilePath, isFeatureFile, isMonorepo, listAgentTypes, listFromRegistry, listSpecs, loadWorkspaceConfig, mergeMonorepoConfigs, mergeWorkspaceConfig, parseImportedSpecNames, resolveAllImplementations, resolveImplementations, resolveRegistryUrl, runCIChecks, runDoctor, runSetup, runTests, safeParseJson, scanAllSpecsFromSource, scanFeatureSource, scanSpecSource, searchRegistry, stringToCacheKey, syncSpecs, syncWithOpenApiService, templates_exports as templates, toCamelCase, toDot, toKebabCase, toPascalCase, validateAgainstOpenApiService, validateImplementationFiles, validateSpec, validateSpecStructure, validateSpecs, verifyBehavior, verifySemanticFields, verifyService, verifyStructure, verifyWithAI, verifyWithAIEnhanced, watchSpecs };
|
|
@@ -1 +1,154 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { DEFAULT_MODELS, getModelsForProvider } from "./models.js";
|
|
2
|
+
import { anthropic } from "@ai-sdk/anthropic";
|
|
3
|
+
import { openai } from "@ai-sdk/openai";
|
|
4
|
+
import { ollama } from "ollama-ai-provider";
|
|
5
|
+
import { google } from "@ai-sdk/google";
|
|
6
|
+
import { mistral } from "@ai-sdk/mistral";
|
|
7
|
+
|
|
8
|
+
//#region ../../libs/ai-providers/dist/factory.js
|
|
9
|
+
/**
|
|
10
|
+
* Base provider implementation
|
|
11
|
+
*/
|
|
12
|
+
var BaseProvider = class {
|
|
13
|
+
name;
|
|
14
|
+
model;
|
|
15
|
+
mode;
|
|
16
|
+
config;
|
|
17
|
+
cachedModel = null;
|
|
18
|
+
constructor(config) {
|
|
19
|
+
this.name = config.provider;
|
|
20
|
+
this.model = config.model ?? DEFAULT_MODELS[config.provider];
|
|
21
|
+
this.mode = this.determineMode(config);
|
|
22
|
+
this.config = config;
|
|
23
|
+
}
|
|
24
|
+
determineMode(config) {
|
|
25
|
+
if (config.provider === "ollama") return "local";
|
|
26
|
+
if (config.apiKey) return "byok";
|
|
27
|
+
return "managed";
|
|
28
|
+
}
|
|
29
|
+
getModel() {
|
|
30
|
+
if (!this.cachedModel) this.cachedModel = this.createModel();
|
|
31
|
+
return this.cachedModel;
|
|
32
|
+
}
|
|
33
|
+
createModel() {
|
|
34
|
+
const { apiKey, baseUrl, proxyUrl, organizationId } = this.config;
|
|
35
|
+
switch (this.name) {
|
|
36
|
+
case "ollama": {
|
|
37
|
+
const originalBaseUrl = process.env.OLLAMA_BASE_URL;
|
|
38
|
+
if (baseUrl && baseUrl !== "http://localhost:11434") process.env.OLLAMA_BASE_URL = baseUrl;
|
|
39
|
+
const ollamaModel = ollama(this.model);
|
|
40
|
+
if (originalBaseUrl !== void 0) process.env.OLLAMA_BASE_URL = originalBaseUrl;
|
|
41
|
+
else if (baseUrl && baseUrl !== "http://localhost:11434") delete process.env.OLLAMA_BASE_URL;
|
|
42
|
+
return ollamaModel;
|
|
43
|
+
}
|
|
44
|
+
case "openai":
|
|
45
|
+
if (this.mode === "managed") {
|
|
46
|
+
const originalBaseUrl = process.env.OPENAI_BASE_URL;
|
|
47
|
+
if (proxyUrl) process.env.OPENAI_BASE_URL = proxyUrl;
|
|
48
|
+
const model = openai(this.model);
|
|
49
|
+
if (originalBaseUrl !== void 0) process.env.OPENAI_BASE_URL = originalBaseUrl;
|
|
50
|
+
else if (proxyUrl) delete process.env.OPENAI_BASE_URL;
|
|
51
|
+
return model;
|
|
52
|
+
}
|
|
53
|
+
return openai(this.model);
|
|
54
|
+
case "anthropic":
|
|
55
|
+
if (this.mode === "managed") {
|
|
56
|
+
const originalBaseUrl = process.env.OPENAI_BASE_URL;
|
|
57
|
+
if (proxyUrl) process.env.OPENAI_BASE_URL = proxyUrl;
|
|
58
|
+
const model = openai(this.model);
|
|
59
|
+
if (originalBaseUrl !== void 0) process.env.OPENAI_BASE_URL = originalBaseUrl;
|
|
60
|
+
else if (proxyUrl) delete process.env.OPENAI_BASE_URL;
|
|
61
|
+
return model;
|
|
62
|
+
}
|
|
63
|
+
return anthropic(this.model);
|
|
64
|
+
case "mistral":
|
|
65
|
+
if (this.mode === "managed") {
|
|
66
|
+
const originalBaseUrl = process.env.OPENAI_BASE_URL;
|
|
67
|
+
if (proxyUrl) process.env.OPENAI_BASE_URL = proxyUrl;
|
|
68
|
+
const model = openai(this.model);
|
|
69
|
+
if (originalBaseUrl !== void 0) process.env.OPENAI_BASE_URL = originalBaseUrl;
|
|
70
|
+
else if (proxyUrl) delete process.env.OPENAI_BASE_URL;
|
|
71
|
+
return model;
|
|
72
|
+
}
|
|
73
|
+
return mistral(this.model);
|
|
74
|
+
case "gemini":
|
|
75
|
+
if (this.mode === "managed") {
|
|
76
|
+
const originalBaseUrl = process.env.OPENAI_BASE_URL;
|
|
77
|
+
if (proxyUrl) process.env.OPENAI_BASE_URL = proxyUrl;
|
|
78
|
+
const model = openai(this.model);
|
|
79
|
+
if (originalBaseUrl !== void 0) process.env.OPENAI_BASE_URL = originalBaseUrl;
|
|
80
|
+
else if (proxyUrl) delete process.env.OPENAI_BASE_URL;
|
|
81
|
+
return model;
|
|
82
|
+
}
|
|
83
|
+
return google(this.model);
|
|
84
|
+
default: throw new Error(`Unknown provider: ${this.name}`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
async listModels() {
|
|
88
|
+
if (this.name === "ollama") return this.listOllamaModels();
|
|
89
|
+
return getModelsForProvider(this.name);
|
|
90
|
+
}
|
|
91
|
+
async listOllamaModels() {
|
|
92
|
+
try {
|
|
93
|
+
const baseUrl = this.config.baseUrl ?? "http://localhost:11434";
|
|
94
|
+
const response = await fetch(`${baseUrl}/api/tags`);
|
|
95
|
+
if (!response.ok) return getModelsForProvider("ollama");
|
|
96
|
+
return ((await response.json()).models ?? []).map((m) => ({
|
|
97
|
+
id: m.name,
|
|
98
|
+
name: m.name,
|
|
99
|
+
provider: "ollama",
|
|
100
|
+
contextWindow: 8e3,
|
|
101
|
+
capabilities: {
|
|
102
|
+
vision: false,
|
|
103
|
+
tools: false,
|
|
104
|
+
reasoning: false,
|
|
105
|
+
streaming: true
|
|
106
|
+
}
|
|
107
|
+
}));
|
|
108
|
+
} catch {
|
|
109
|
+
return getModelsForProvider("ollama");
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
async validate() {
|
|
113
|
+
if (this.name === "ollama") return this.validateOllama();
|
|
114
|
+
if (this.mode === "byok" && !this.config.apiKey) return {
|
|
115
|
+
valid: false,
|
|
116
|
+
error: `API key required for ${this.name}`
|
|
117
|
+
};
|
|
118
|
+
if (this.mode === "managed" && !this.config.proxyUrl && !this.config.organizationId) return {
|
|
119
|
+
valid: false,
|
|
120
|
+
error: "Managed mode requires proxyUrl or organizationId"
|
|
121
|
+
};
|
|
122
|
+
return { valid: true };
|
|
123
|
+
}
|
|
124
|
+
async validateOllama() {
|
|
125
|
+
try {
|
|
126
|
+
const baseUrl = this.config.baseUrl ?? "http://localhost:11434";
|
|
127
|
+
const response = await fetch(`${baseUrl}/api/tags`);
|
|
128
|
+
if (!response.ok) return {
|
|
129
|
+
valid: false,
|
|
130
|
+
error: `Ollama server returned ${response.status}`
|
|
131
|
+
};
|
|
132
|
+
const models = (await response.json()).models ?? [];
|
|
133
|
+
if (!models.some((m) => m.name === this.model)) return {
|
|
134
|
+
valid: false,
|
|
135
|
+
error: `Model "${this.model}" not found. Available: ${models.map((m) => m.name).join(", ")}`
|
|
136
|
+
};
|
|
137
|
+
return { valid: true };
|
|
138
|
+
} catch (error) {
|
|
139
|
+
return {
|
|
140
|
+
valid: false,
|
|
141
|
+
error: `Cannot connect to Ollama at ${this.config.baseUrl ?? "http://localhost:11434"}: ${error instanceof Error ? error.message : String(error)}`
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Create a provider from configuration
|
|
148
|
+
*/
|
|
149
|
+
function createProvider(config) {
|
|
150
|
+
return new BaseProvider(config);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
//#endregion
|
|
154
|
+
export { createProvider };
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { DEFAULT_MODELS, MODELS, getModelsForProvider, getRecommendedModels } from "./models.js";
|
|
2
|
+
import { createProvider } from "./factory.js";
|
|
3
|
+
import "./validation.js";
|
|
4
|
+
import { getAIProvider, validateProvider } from "./legacy.js";
|
|
@@ -1 +1,72 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { getRecommendedModels } from "./models.js";
|
|
2
|
+
import { createProvider } from "./factory.js";
|
|
3
|
+
|
|
4
|
+
//#region ../../libs/ai-providers/dist/legacy.js
|
|
5
|
+
/**
|
|
6
|
+
* Map legacy provider names to new ones
|
|
7
|
+
*/
|
|
8
|
+
function mapLegacyProvider(legacy) {
|
|
9
|
+
switch (legacy) {
|
|
10
|
+
case "claude": return "anthropic";
|
|
11
|
+
case "custom": return "openai";
|
|
12
|
+
default: return legacy;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get AI provider from legacy Config type
|
|
17
|
+
*
|
|
18
|
+
* @deprecated Use createProvider() instead
|
|
19
|
+
*/
|
|
20
|
+
function getAIProvider(config) {
|
|
21
|
+
const provider = mapLegacyProvider(config.aiProvider);
|
|
22
|
+
let apiKey;
|
|
23
|
+
switch (provider) {
|
|
24
|
+
case "openai":
|
|
25
|
+
apiKey = process.env.OPENAI_API_KEY;
|
|
26
|
+
break;
|
|
27
|
+
case "anthropic":
|
|
28
|
+
apiKey = process.env.ANTHROPIC_API_KEY;
|
|
29
|
+
break;
|
|
30
|
+
case "mistral":
|
|
31
|
+
apiKey = process.env.MISTRAL_API_KEY;
|
|
32
|
+
break;
|
|
33
|
+
case "gemini":
|
|
34
|
+
apiKey = process.env.GOOGLE_API_KEY ?? process.env.GEMINI_API_KEY;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
return createProvider({
|
|
38
|
+
provider,
|
|
39
|
+
model: config.aiModel,
|
|
40
|
+
apiKey,
|
|
41
|
+
baseUrl: config.customEndpoint
|
|
42
|
+
}).getModel();
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Validate provider from legacy Config type
|
|
46
|
+
*
|
|
47
|
+
* @deprecated Use validateProvider() from './validation' instead
|
|
48
|
+
*/
|
|
49
|
+
async function validateProvider(config) {
|
|
50
|
+
const provider = mapLegacyProvider(config.aiProvider);
|
|
51
|
+
if (provider === "ollama") return { success: true };
|
|
52
|
+
if (provider === "anthropic" && !process.env.ANTHROPIC_API_KEY) return {
|
|
53
|
+
success: false,
|
|
54
|
+
error: "ANTHROPIC_API_KEY environment variable not set"
|
|
55
|
+
};
|
|
56
|
+
if (provider === "openai" && !process.env.OPENAI_API_KEY) return {
|
|
57
|
+
success: false,
|
|
58
|
+
error: "OPENAI_API_KEY environment variable not set"
|
|
59
|
+
};
|
|
60
|
+
if (provider === "mistral" && !process.env.MISTRAL_API_KEY) return {
|
|
61
|
+
success: false,
|
|
62
|
+
error: "MISTRAL_API_KEY environment variable not set"
|
|
63
|
+
};
|
|
64
|
+
if (provider === "gemini" && !process.env.GOOGLE_API_KEY && !process.env.GEMINI_API_KEY) return {
|
|
65
|
+
success: false,
|
|
66
|
+
error: "GOOGLE_API_KEY or GEMINI_API_KEY environment variable not set"
|
|
67
|
+
};
|
|
68
|
+
return { success: true };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
//#endregion
|
|
72
|
+
export { getAIProvider, validateProvider };
|