@lssm/bundle.contractspec-workspace 0.0.0-canary-20251217062139 → 0.0.0-canary-20251217060834

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 (191) hide show
  1. package/dist/adapters/ai.js +1 -1
  2. package/dist/adapters/index.d.ts +7 -0
  3. package/dist/ai/agents/claude-code-agent.js +1 -1
  4. package/dist/ai/agents/openai-codex-agent.js +1 -1
  5. package/dist/ai/agents/orchestrator.js +1 -1
  6. package/dist/ai/providers.js +1 -1
  7. package/dist/index.d.ts +3 -0
  8. package/dist/index.js +1 -1
  9. package/dist/ports/index.d.ts +5 -0
  10. package/dist/services/agent-guide/adapters/claude-code.js +1 -1
  11. package/dist/services/agent-guide/adapters/cursor-cli.js +2 -2
  12. package/dist/services/agent-guide/adapters/generic-mcp.js +1 -1
  13. package/dist/services/agent-guide/agent-guide-service.js +1 -1
  14. package/dist/services/agent-guide/index.d.ts +6 -0
  15. package/dist/services/build.js +1 -1
  16. package/dist/services/ci-check/ci-check-service.js +1 -1
  17. package/dist/services/ci-check/index.d.ts +2 -0
  18. package/dist/services/config.js +1 -1
  19. package/dist/services/deps.js +1 -1
  20. package/dist/services/diff.js +1 -1
  21. package/dist/services/doctor/index.d.ts +2 -0
  22. package/dist/services/implementation/index.d.ts +3 -0
  23. package/dist/services/implementation/resolver.js +1 -1
  24. package/dist/services/index.d.ts +56 -0
  25. package/dist/services/integrity.js +1 -1
  26. package/dist/services/list.js +1 -1
  27. package/dist/services/openapi/export-service.js +1 -1
  28. package/dist/services/openapi/import-service.js +1 -1
  29. package/dist/services/openapi/index.d.ts +5 -0
  30. package/dist/services/openapi/sync-service.js +1 -1
  31. package/dist/services/openapi/validate-service.js +1 -1
  32. package/dist/services/regenerator.js +1 -1
  33. package/dist/services/test.js +1 -1
  34. package/dist/services/validate-implementation.js +1 -1
  35. package/dist/services/validate.js +1 -1
  36. package/dist/services/verification-cache/adapters/index.d.ts +3 -0
  37. package/dist/services/verification-cache/index.d.ts +6 -0
  38. package/dist/services/verify/ai-verifier.js +6 -6
  39. package/dist/services/verify/behavior-verifier.js +1 -1
  40. package/dist/services/verify/index.d.ts +5 -0
  41. package/dist/services/verify/structure-verifier.js +1 -1
  42. package/package.json +9 -9
  43. package/dist/libs/ai-providers/dist/factory.js +0 -1
  44. package/dist/libs/ai-providers/dist/index.js +0 -1
  45. package/dist/libs/ai-providers/dist/legacy.js +0 -1
  46. package/dist/libs/ai-providers/dist/models.js +0 -1
  47. package/dist/libs/ai-providers/dist/validation.js +0 -1
  48. package/dist/libs/contracts/dist/capabilities/openbanking.js +0 -1
  49. package/dist/libs/contracts/dist/client/index.js +0 -1
  50. package/dist/libs/contracts/dist/client/react/feature-render.js +0 -1
  51. package/dist/libs/contracts/dist/client/react/form-render.js +0 -1
  52. package/dist/libs/contracts/dist/client/react/index.js +0 -1
  53. package/dist/libs/contracts/dist/contract-registry/index.js +0 -1
  54. package/dist/libs/contracts/dist/contract-registry/schemas.js +0 -1
  55. package/dist/libs/contracts/dist/docs/PUBLISHING.docblock.js +0 -76
  56. package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +0 -350
  57. package/dist/libs/contracts/dist/docs/index.js +0 -1
  58. package/dist/libs/contracts/dist/docs/presentations.js +0 -1
  59. package/dist/libs/contracts/dist/docs/registry.js +0 -1
  60. package/dist/libs/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +0 -383
  61. package/dist/libs/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +0 -68
  62. package/dist/libs/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +0 -140
  63. package/dist/libs/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +0 -86
  64. package/dist/libs/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +0 -1
  65. package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +0 -58
  66. package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +0 -38
  67. package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +0 -213
  68. package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js +0 -289
  69. package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js +0 -1
  70. package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js +0 -1
  71. package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js +0 -262
  72. package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js +0 -1
  73. package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +0 -57
  74. package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +0 -63
  75. package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +0 -36
  76. package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js +0 -1
  77. package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +0 -20
  78. package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js +0 -65
  79. package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +0 -1
  80. package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js +0 -41
  81. package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js +0 -122
  82. package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js +0 -1
  83. package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js +0 -68
  84. package/dist/libs/contracts/dist/docs/tech/workflows/overview.docblock.js +0 -1
  85. package/dist/libs/contracts/dist/events.js +0 -1
  86. package/dist/libs/contracts/dist/experiments/evaluator.js +0 -1
  87. package/dist/libs/contracts/dist/index.js +0 -1
  88. package/dist/libs/contracts/dist/install.js +0 -1
  89. package/dist/libs/contracts/dist/integrations/contracts.js +0 -1
  90. package/dist/libs/contracts/dist/integrations/index.js +0 -1
  91. package/dist/libs/contracts/dist/integrations/openbanking/contracts/accounts.js +0 -1
  92. package/dist/libs/contracts/dist/integrations/openbanking/contracts/balances.js +0 -1
  93. package/dist/libs/contracts/dist/integrations/openbanking/contracts/index.js +0 -1
  94. package/dist/libs/contracts/dist/integrations/openbanking/contracts/transactions.js +0 -1
  95. package/dist/libs/contracts/dist/integrations/openbanking/models.js +0 -1
  96. package/dist/libs/contracts/dist/integrations/openbanking/telemetry.js +0 -1
  97. package/dist/libs/contracts/dist/integrations/providers/elevenlabs.js +0 -1
  98. package/dist/libs/contracts/dist/integrations/providers/gcs-storage.js +0 -1
  99. package/dist/libs/contracts/dist/integrations/providers/gmail.js +0 -1
  100. package/dist/libs/contracts/dist/integrations/providers/google-calendar.js +0 -1
  101. package/dist/libs/contracts/dist/integrations/providers/index.js +0 -1
  102. package/dist/libs/contracts/dist/integrations/providers/mistral.js +0 -1
  103. package/dist/libs/contracts/dist/integrations/providers/postmark.js +0 -1
  104. package/dist/libs/contracts/dist/integrations/providers/powens.js +0 -1
  105. package/dist/libs/contracts/dist/integrations/providers/qdrant.js +0 -1
  106. package/dist/libs/contracts/dist/integrations/providers/registry.js +0 -1
  107. package/dist/libs/contracts/dist/integrations/providers/stripe.js +0 -1
  108. package/dist/libs/contracts/dist/integrations/providers/twilio-sms.js +0 -1
  109. package/dist/libs/contracts/dist/jsonschema.js +0 -1
  110. package/dist/libs/contracts/dist/knowledge/contracts.js +0 -1
  111. package/dist/libs/contracts/dist/knowledge/index.js +0 -1
  112. package/dist/libs/contracts/dist/knowledge/spaces/email-threads.js +0 -1
  113. package/dist/libs/contracts/dist/knowledge/spaces/financial-docs.js +0 -1
  114. package/dist/libs/contracts/dist/knowledge/spaces/financial-overview.js +0 -1
  115. package/dist/libs/contracts/dist/knowledge/spaces/index.js +0 -1
  116. package/dist/libs/contracts/dist/knowledge/spaces/product-canon.js +0 -1
  117. package/dist/libs/contracts/dist/knowledge/spaces/support-faq.js +0 -1
  118. package/dist/libs/contracts/dist/knowledge/spaces/uploaded-docs.js +0 -1
  119. package/dist/libs/contracts/dist/llm/exporters.js +0 -4
  120. package/dist/libs/contracts/dist/llm/index.js +0 -1
  121. package/dist/libs/contracts/dist/llm/prompts.js +0 -75
  122. package/dist/libs/contracts/dist/onboarding-base.js +0 -1
  123. package/dist/libs/contracts/dist/openapi.js +0 -1
  124. package/dist/libs/contracts/dist/ownership.js +0 -1
  125. package/dist/libs/contracts/dist/presentations.js +0 -1
  126. package/dist/libs/contracts/dist/presentations.v2.js +0 -1
  127. package/dist/libs/contracts/dist/prompt.js +0 -1
  128. package/dist/libs/contracts/dist/promptRegistry.js +0 -1
  129. package/dist/libs/contracts/dist/regenerator/index.js +0 -1
  130. package/dist/libs/contracts/dist/regenerator/service.js +0 -1
  131. package/dist/libs/contracts/dist/regenerator/utils.js +0 -1
  132. package/dist/libs/contracts/dist/registry.js +0 -1
  133. package/dist/libs/contracts/dist/resources.js +0 -1
  134. package/dist/libs/contracts/dist/schema/dist/EnumType.js +0 -1
  135. package/dist/libs/contracts/dist/schema/dist/FieldType.js +0 -1
  136. package/dist/libs/contracts/dist/schema/dist/ScalarTypeEnum.js +0 -1
  137. package/dist/libs/contracts/dist/schema/dist/SchemaModel.js +0 -1
  138. package/dist/libs/contracts/dist/schema/dist/entity/defineEntity.js +0 -1
  139. package/dist/libs/contracts/dist/schema/dist/entity/index.js +0 -1
  140. package/dist/libs/contracts/dist/schema/dist/entity/types.js +0 -1
  141. package/dist/libs/contracts/dist/schema/dist/index.js +0 -1
  142. package/dist/libs/contracts/dist/server/graphql-pothos.js +0 -1
  143. package/dist/libs/contracts/dist/server/index.js +0 -1
  144. package/dist/libs/contracts/dist/server/mcp/createMcpServer.js +0 -1
  145. package/dist/libs/contracts/dist/server/mcp/registerPresentations.js +0 -1
  146. package/dist/libs/contracts/dist/server/mcp/registerPrompts.js +0 -1
  147. package/dist/libs/contracts/dist/server/mcp/registerResources.js +0 -1
  148. package/dist/libs/contracts/dist/server/mcp/registerTools.js +0 -1
  149. package/dist/libs/contracts/dist/server/provider-mcp.js +0 -1
  150. package/dist/libs/contracts/dist/server/rest-elysia.js +0 -1
  151. package/dist/libs/contracts/dist/server/rest-express.js +0 -1
  152. package/dist/libs/contracts/dist/server/rest-generic.js +0 -1
  153. package/dist/libs/contracts/dist/server/rest-next-app.js +0 -1
  154. package/dist/libs/contracts/dist/server/rest-next-pages.js +0 -1
  155. package/dist/libs/contracts/dist/spec.js +0 -1
  156. package/dist/libs/contracts/dist/telemetry/index.js +0 -1
  157. package/dist/libs/contracts/dist/telemetry/tracker.js +0 -1
  158. package/dist/libs/contracts/dist/tests/index.js +0 -1
  159. package/dist/libs/contracts/dist/tests/runner.js +0 -1
  160. package/dist/libs/contracts/dist/workflow/index.js +0 -1
  161. package/dist/libs/contracts/dist/workflow/runner.js +0 -1
  162. package/dist/libs/contracts-transformers/dist/common/utils.js +0 -1
  163. package/dist/libs/contracts-transformers/dist/openapi/exporter.js +0 -1
  164. package/dist/libs/contracts-transformers/dist/openapi/importer.js +0 -2
  165. package/dist/libs/contracts-transformers/dist/openapi/index.js +0 -1
  166. package/dist/libs/contracts-transformers/dist/openapi/parser.js +0 -1
  167. package/dist/libs/contracts-transformers/dist/openapi/schema-converter.js +0 -4
  168. package/dist/modules/contractspec-workspace/dist/ai/code-generation.js +0 -100
  169. package/dist/modules/contractspec-workspace/dist/ai/spec-creation.js +0 -69
  170. package/dist/modules/contractspec-workspace/dist/analysis/deps/graph.js +0 -2
  171. package/dist/modules/contractspec-workspace/dist/analysis/deps/parse-imports.js +0 -1
  172. package/dist/modules/contractspec-workspace/dist/analysis/diff/semantic.js +0 -1
  173. package/dist/modules/contractspec-workspace/dist/analysis/feature-scan.js +0 -1
  174. package/dist/modules/contractspec-workspace/dist/analysis/spec-scan.js +0 -1
  175. package/dist/modules/contractspec-workspace/dist/analysis/validate/spec-structure.js +0 -1
  176. package/dist/modules/contractspec-workspace/dist/templates/app-config.js +0 -33
  177. package/dist/modules/contractspec-workspace/dist/templates/data-view.js +0 -54
  178. package/dist/modules/contractspec-workspace/dist/templates/event.js +0 -24
  179. package/dist/modules/contractspec-workspace/dist/templates/experiment.js +0 -62
  180. package/dist/modules/contractspec-workspace/dist/templates/handler.js +0 -63
  181. package/dist/modules/contractspec-workspace/dist/templates/integration-utils.js +0 -33
  182. package/dist/modules/contractspec-workspace/dist/templates/integration.js +0 -39
  183. package/dist/modules/contractspec-workspace/dist/templates/knowledge.js +0 -28
  184. package/dist/modules/contractspec-workspace/dist/templates/migration.js +0 -37
  185. package/dist/modules/contractspec-workspace/dist/templates/operation.js +0 -88
  186. package/dist/modules/contractspec-workspace/dist/templates/presentation.js +0 -53
  187. package/dist/modules/contractspec-workspace/dist/templates/telemetry.js +0 -69
  188. package/dist/modules/contractspec-workspace/dist/templates/utils.js +0 -1
  189. package/dist/modules/contractspec-workspace/dist/templates/workflow-runner.js +0 -42
  190. package/dist/modules/contractspec-workspace/dist/templates/workflow.js +0 -41
  191. package/dist/modules/contractspec-workspace/dist/types/generation-types.js +0 -1
@@ -1 +1 @@
1
- import{anthropic as e}from"@ai-sdk/anthropic";import{openai as t}from"@ai-sdk/openai";import{ollama as n}from"ollama-ai-provider";import{generateObject as r,generateText as i,streamText as a}from"ai";function o(e){return{async validateProvider(e){try{let{aiProvider:t}=e;return t===`ollama`?{success:!0}:t===`claude`&&!process.env.ANTHROPIC_API_KEY?{success:!1,error:`ANTHROPIC_API_KEY environment variable not set`}:t===`openai`&&!process.env.OPENAI_API_KEY?{success:!1,error:`OPENAI_API_KEY environment variable not set`}:{success:!0}}catch(e){return{success:!1,error:e instanceof Error?e.message:String(e)}}},async generateText(t){return{text:(await i({model:s(e),prompt:t.prompt,system:t.systemPrompt})).text}},async generateStructured(t){return{object:(await r({model:s(e),schema:t.schema,prompt:t.prompt,system:t.systemPrompt})).object}},async streamText(t,n){let r=await a({model:s(e),prompt:t.prompt,system:t.systemPrompt}),i=``;for await(let e of r.textStream)i+=e,n(e);return i}}}function s(r){let{aiProvider:i,aiModel:a,customEndpoint:o}=r;switch(i){case`claude`:return e(a??`claude-3-5-sonnet-20241022`);case`openai`:return t(a??`gpt-4o`);case`ollama`:return n(a??`codellama`);case`custom`:if(!o)throw Error(`Custom endpoint required. Set customEndpoint in config or CONTRACTSPEC_LLM_ENDPOINT env var`);return t(a??`default`);default:throw Error(`Unknown AI provider: ${i}`)}}export{o as createNodeAiAdapter};
1
+ import{anthropic as e}from"../node_modules/@ai-sdk/anthropic/dist/index.js";import{openai as t}from"../node_modules/@ai-sdk/openai/dist/index.js";import{ollama as n}from"ollama-ai-provider";import{generateObject as r,generateText as i,streamText as a}from"ai";function o(e){return{async validateProvider(e){try{let{aiProvider:t}=e;return t===`ollama`?{success:!0}:t===`claude`&&!process.env.ANTHROPIC_API_KEY?{success:!1,error:`ANTHROPIC_API_KEY environment variable not set`}:t===`openai`&&!process.env.OPENAI_API_KEY?{success:!1,error:`OPENAI_API_KEY environment variable not set`}:{success:!0}}catch(e){return{success:!1,error:e instanceof Error?e.message:String(e)}}},async generateText(t){return{text:(await i({model:s(e),prompt:t.prompt,system:t.systemPrompt})).text}},async generateStructured(t){return{object:(await r({model:s(e),schema:t.schema,prompt:t.prompt,system:t.systemPrompt})).object}},async streamText(t,n){let r=await a({model:s(e),prompt:t.prompt,system:t.systemPrompt}),i=``;for await(let e of r.textStream)i+=e,n(e);return i}}}function s(r){let{aiProvider:i,aiModel:a,customEndpoint:o}=r;switch(i){case`claude`:return e(a??`claude-3-5-sonnet-20241022`);case`openai`:return t(a??`gpt-4o`);case`ollama`:return n(a??`codellama`);case`custom`:if(!o)throw Error(`Custom endpoint required. Set customEndpoint in config or CONTRACTSPEC_LLM_ENDPOINT env var`);return t(a??`default`);default:throw Error(`Unknown AI provider: ${i}`)}}export{o as createNodeAiAdapter};
@@ -0,0 +1,7 @@
1
+ import { createNodeFsAdapter } from "./fs.js";
2
+ import { createNodeGitAdapter } from "./git.js";
3
+ import { createNodeWatcherAdapter } from "./watcher.js";
4
+ import { createNodeAiAdapter } from "./ai.js";
5
+ import { createConsoleLoggerAdapter, createNoopLoggerAdapter } from "./logger.js";
6
+ import { CreateAdaptersOptions, createNodeAdapters } from "./factory.js";
7
+ import { PackageManager, WorkspaceInfo, detectPackageManager, findPackageRoot, findWorkspaceRoot, getExecCommand, getInstallCommand, getPackageName, getRunCommand, getWorkspaceInfo, getWorkspacePackages, isMonorepo } from "./workspace.js";
@@ -1,4 +1,4 @@
1
- import{anthropic as e}from"@ai-sdk/anthropic";import{generateText as t}from"ai";var n=class{name=`claude-code`;apiKey;constructor(){this.apiKey=process.env.ANTHROPIC_API_KEY}canHandle(e){return!!this.apiKey}async generate(n){if(!this.apiKey)return{success:!1,errors:[`ANTHROPIC_API_KEY not set. Claude Code agent requires API access.`]};try{let r=e(`claude-3-7-sonnet-20250219`),i=this.buildSystemPrompt(n),a=await t({model:r,prompt:this.buildUserPrompt(n),system:i,temperature:.2});return{success:!0,code:this.extractCode(a.text),metadata:{model:`claude-3-7-sonnet`,agentMode:`claude-code`,usage:a.usage}}}catch(e){return{success:!1,errors:[e instanceof Error?e.message:String(e)]}}}async validate(n){if(!this.apiKey)return{success:!1,errors:[`ANTHROPIC_API_KEY not set`]};try{let r=await t({model:e(`claude-3-7-sonnet-20250219`),prompt:`
1
+ import{anthropic as e}from"../../node_modules/@ai-sdk/anthropic/dist/index.js";import{generateText as t}from"ai";var n=class{name=`claude-code`;apiKey;constructor(){this.apiKey=process.env.ANTHROPIC_API_KEY}canHandle(e){return!!this.apiKey}async generate(n){if(!this.apiKey)return{success:!1,errors:[`ANTHROPIC_API_KEY not set. Claude Code agent requires API access.`]};try{let r=e(`claude-3-7-sonnet-20250219`),i=this.buildSystemPrompt(n),a=await t({model:r,prompt:this.buildUserPrompt(n),system:i,temperature:.2});return{success:!0,code:this.extractCode(a.text),metadata:{model:`claude-3-7-sonnet`,agentMode:`claude-code`,usage:a.usage}}}catch(e){return{success:!1,errors:[e instanceof Error?e.message:String(e)]}}}async validate(n){if(!this.apiKey)return{success:!1,errors:[`ANTHROPIC_API_KEY not set`]};try{let r=await t({model:e(`claude-3-7-sonnet-20250219`),prompt:`
2
2
  You are an expert code reviewer. Carefully analyze this implementation against its specification.
3
3
 
4
4
  SPECIFICATION:
@@ -1,4 +1,4 @@
1
- import{openai as e}from"@ai-sdk/openai";import{generateText as t}from"ai";var n=class{name=`openai-codex`;apiKey;constructor(){this.apiKey=process.env.OPENAI_API_KEY}canHandle(e){return!!this.apiKey}async generate(n){if(!this.apiKey)return{success:!1,errors:[`OPENAI_API_KEY not set. OpenAI Codex agent requires API access.`]};try{let r=this.isComplexTask(n)?`o1`:`gpt-4o`,i=e(r),a=this.buildSystemPrompt(n),o=await t({model:i,prompt:this.buildUserPrompt(n),system:a,temperature:.2});return{success:!0,code:this.extractCode(o.text),metadata:{model:r,agentMode:`openai-codex`,usage:o.usage}}}catch(e){return{success:!1,errors:[e instanceof Error?e.message:String(e)]}}}async validate(n){if(!this.apiKey)return{success:!1,errors:[`OPENAI_API_KEY not set`]};try{let r=await t({model:e(`gpt-4o`),prompt:`
1
+ import{openai as e}from"../../node_modules/@ai-sdk/openai/dist/index.js";import{generateText as t}from"ai";var n=class{name=`openai-codex`;apiKey;constructor(){this.apiKey=process.env.OPENAI_API_KEY}canHandle(e){return!!this.apiKey}async generate(n){if(!this.apiKey)return{success:!1,errors:[`OPENAI_API_KEY not set. OpenAI Codex agent requires API access.`]};try{let r=this.isComplexTask(n)?`o1`:`gpt-4o`,i=e(r),a=this.buildSystemPrompt(n),o=await t({model:i,prompt:this.buildUserPrompt(n),system:a,temperature:.2});return{success:!0,code:this.extractCode(o.text),metadata:{model:r,agentMode:`openai-codex`,usage:o.usage}}}catch(e){return{success:!1,errors:[e instanceof Error?e.message:String(e)]}}}async validate(n){if(!this.apiKey)return{success:!1,errors:[`OPENAI_API_KEY not set`]};try{let r=await t({model:e(`gpt-4o`),prompt:`
2
2
  Review this code implementation against its specification.
3
3
 
4
4
  SPECIFICATION:
@@ -1 +1 @@
1
- import{SimpleAgent as e}from"./simple-agent.js";import{CursorAgent as t}from"./cursor-agent.js";import{ClaudeCodeAgent as n}from"./claude-code-agent.js";import{OpenAICodexAgent as r}from"./openai-codex-agent.js";import i from"chalk";import a from"ora";var o=class{agents;defaultAgent;constructor(i){this.config=i,this.agents=new Map;let a=new e(i),o=new t,s=new n,c=new r;this.agents.set(`simple`,a),this.agents.set(`cursor`,o),this.agents.set(`claude-code`,s),this.agents.set(`openai-codex`,c),this.defaultAgent=a}async executeTask(e){let t=this.getAgentMode(),n=this.agents.get(t);if(!n)return console.log(i.yellow(`⚠️ Agent '${t}' not found, using simple agent`)),this.defaultAgent.generate(e);if(!n.canHandle(e))return console.log(i.yellow(`⚠️ Agent '${t}' cannot handle this task, falling back to simple agent`)),this.defaultAgent.generate(e);let r=a(`Executing with ${t} agent...`).start();try{let a=e.type===`validate`?await n.validate(e):await n.generate(e);if(a.success)return r.succeed(i.green(`${t} agent completed successfully`)),a;r.warn(i.yellow(`${t} agent failed, trying fallback...`));let o=this.getFallbackMode(t);if(o&&o!==t){let t=this.agents.get(o);if(t&&t.canHandle(e))return e.type===`validate`?await t.validate(e):await t.generate(e)}return r.info(i.gray(`Using simple agent as ultimate fallback`)),e.type===`validate`?await this.defaultAgent.validate(e):await this.defaultAgent.generate(e)}catch{return r.fail(i.red(`Agent execution failed`)),console.log(i.gray(`Falling back to simple agent...`)),e.type===`validate`?await this.defaultAgent.validate(e):await this.defaultAgent.generate(e)}}async generate(e,t){return this.executeTask({type:`generate`,specCode:e,targetPath:t})}async generateTests(e,t){return this.executeTask({type:`test`,specCode:e,existingCode:t})}async validate(e,t){return this.executeTask({type:`validate`,specCode:e,existingCode:t})}async refactor(e,t){return this.executeTask({type:`refactor`,specCode:e,existingCode:t})}async getAvailableAgents(){let e=[];for(let[t,n]of this.agents){let r=n.canHandle({type:`generate`,specCode:`test`});e.push({mode:t,available:r,reason:r?void 0:`Not configured or dependencies missing`})}return e}getAgentMode(){return this.config.agentMode||`simple`}getFallbackMode(e){return{cursor:`claude-code`,"claude-code":`openai-codex`,"openai-codex":`simple`,simple:`simple`}[e]}};export{o as AgentOrchestrator};
1
+ import{SimpleAgent as e}from"./simple-agent.js";import{CursorAgent as t}from"./cursor-agent.js";import{ClaudeCodeAgent as n}from"./claude-code-agent.js";import{OpenAICodexAgent as r}from"./openai-codex-agent.js";import i from"../../node_modules/chalk/source/index.js";import a from"../../node_modules/ora/index.js";var o=class{agents;defaultAgent;constructor(i){this.config=i,this.agents=new Map;let a=new e(i),o=new t,s=new n,c=new r;this.agents.set(`simple`,a),this.agents.set(`cursor`,o),this.agents.set(`claude-code`,s),this.agents.set(`openai-codex`,c),this.defaultAgent=a}async executeTask(e){let t=this.getAgentMode(),n=this.agents.get(t);if(!n)return console.log(i.yellow(`⚠️ Agent '${t}' not found, using simple agent`)),this.defaultAgent.generate(e);if(!n.canHandle(e))return console.log(i.yellow(`⚠️ Agent '${t}' cannot handle this task, falling back to simple agent`)),this.defaultAgent.generate(e);let r=a(`Executing with ${t} agent...`).start();try{let a=e.type===`validate`?await n.validate(e):await n.generate(e);if(a.success)return r.succeed(i.green(`${t} agent completed successfully`)),a;r.warn(i.yellow(`${t} agent failed, trying fallback...`));let o=this.getFallbackMode(t);if(o&&o!==t){let t=this.agents.get(o);if(t&&t.canHandle(e))return e.type===`validate`?await t.validate(e):await t.generate(e)}return r.info(i.gray(`Using simple agent as ultimate fallback`)),e.type===`validate`?await this.defaultAgent.validate(e):await this.defaultAgent.generate(e)}catch{return r.fail(i.red(`Agent execution failed`)),console.log(i.gray(`Falling back to simple agent...`)),e.type===`validate`?await this.defaultAgent.validate(e):await this.defaultAgent.generate(e)}}async generate(e,t){return this.executeTask({type:`generate`,specCode:e,targetPath:t})}async generateTests(e,t){return this.executeTask({type:`test`,specCode:e,existingCode:t})}async validate(e,t){return this.executeTask({type:`validate`,specCode:e,existingCode:t})}async refactor(e,t){return this.executeTask({type:`refactor`,specCode:e,existingCode:t})}async getAvailableAgents(){let e=[];for(let[t,n]of this.agents){let r=n.canHandle({type:`generate`,specCode:`test`});e.push({mode:t,available:r,reason:r?void 0:`Not configured or dependencies missing`})}return e}getAgentMode(){return this.config.agentMode||`simple`}getFallbackMode(e){return{cursor:`claude-code`,"claude-code":`openai-codex`,"openai-codex":`simple`,simple:`simple`}[e]}};export{o as AgentOrchestrator};
@@ -1 +1 @@
1
- import{i as e}from"../libs/ai-providers/dist/models.js";import{i as t,r as n}from"../libs/ai-providers/dist/legacy.js";import"../libs/ai-providers/dist/index.js";function r(e){return n({aiProvider:e.aiProvider,aiModel:e.aiModel||void 0,customEndpoint:e.customEndpoint||void 0})}async function i(e){return await t({aiProvider:e.aiProvider,aiModel:e.aiModel||void 0,customEndpoint:e.customEndpoint||void 0})}function a(t){return e(t)}export{r as getAIProvider,a as getRecommendedModels,i as validateProvider};
1
+ import{getAIProvider as e,getRecommendedModels as t,validateLegacyProvider as n}from"@lssm/lib.ai-providers";function r(t){return e({aiProvider:t.aiProvider,aiModel:t.aiModel||void 0,customEndpoint:t.customEndpoint||void 0})}async function i(e){return await n({aiProvider:e.aiProvider,aiModel:e.aiModel||void 0,customEndpoint:e.customEndpoint||void 0})}function a(e){return t(e)}export{r as getAIProvider,a as getRecommendedModels,i as validateProvider};
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import { GitAdapter, GitCleanOptions } from "./ports/git.js";
3
3
  import { WatchEvent, WatchEventHandler, WatchEventType, WatchOptions, Watcher, WatcherAdapter } from "./ports/watcher.js";
4
4
  import { AiAdapter, AiGenerateOptions, AiGenerateResult, AiGenerateStructuredOptions, AiValidationResult } from "./ports/ai.js";
5
5
  import { LogLevel, LoggerAdapter, ProgressReporter, ProgressUpdate, WorkspaceAdapters } from "./ports/logger.js";
6
+ import "./ports/index.js";
6
7
  import { createNodeFsAdapter } from "./adapters/fs.js";
7
8
  import { createNodeGitAdapter } from "./adapters/git.js";
8
9
  import { createNodeWatcherAdapter } from "./adapters/watcher.js";
@@ -10,6 +11,7 @@ import { createNodeAiAdapter } from "./adapters/ai.js";
10
11
  import { createConsoleLoggerAdapter, createNoopLoggerAdapter } from "./adapters/logger.js";
11
12
  import { CreateAdaptersOptions, createNodeAdapters } from "./adapters/factory.js";
12
13
  import { PackageManager, WorkspaceInfo, detectPackageManager, findPackageRoot, findWorkspaceRoot, getExecCommand, getInstallCommand, getPackageName, getRunCommand, getWorkspaceInfo, getWorkspacePackages, isMonorepo } from "./adapters/workspace.js";
14
+ import "./adapters/index.js";
13
15
  import { AgentMode, AiProvider, Config } from "./types/config.js";
14
16
  import { ValidateSpecOptions, ValidateSpecResult, validateSpec, validateSpecs } from "./services/validate.js";
15
17
  import { ValidateImplementationOptions, ValidateImplementationResult, validateImplementationFiles } from "./services/validate-implementation.js";
@@ -59,6 +61,7 @@ import { VerificationCacheService, cacheKeyToString, computeContentHash, createV
59
61
  import { InMemoryCacheStorage, createInMemoryCacheStorage } from "./services/verification-cache/adapters/in-memory.js";
60
62
  import { FileSystemCacheStorage, createFileSystemCacheStorage } from "./services/verification-cache/adapters/filesystem.js";
61
63
  import { KeyValueStore, WorkspaceStateCacheStorage, createWorkspaceStateCacheStorage } from "./services/verification-cache/adapters/workspace-state.js";
64
+ import "./services/index.js";
62
65
  import { index_d_exports as index_d_exports$1 } from "./formatters/index.js";
63
66
  import { index_d_exports as index_d_exports$2 } from "./templates/index.js";
64
67
  import { index_d_exports } from "./ai/index.js";
package/dist/index.js CHANGED
@@ -1 +1 @@
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{createNodeFsAdapter as e}from"./adapters/fs.js";import{createNodeGitAdapter as t}from"./adapters/git.js";import{createNodeWatcherAdapter as n}from"./adapters/watcher.js";import{createNodeAiAdapter as r}from"./adapters/ai.js";import{createConsoleLoggerAdapter as i,createNoopLoggerAdapter as a}from"./adapters/logger.js";import{createNodeAdapters as o}from"./adapters/factory.js";import{detectPackageManager as s,findPackageRoot as c,findWorkspaceRoot as l,getExecCommand as u,getInstallCommand as d,getPackageName as f,getRunCommand as p,getWorkspaceInfo as m,getWorkspacePackages as h,isMonorepo as g}from"./adapters/workspace.js";import"./adapters/index.js";import{validateSpec as _,validateSpecs as v}from"./services/validate.js";import{validateImplementationFiles as y}from"./services/validate-implementation.js";import{compareSpecs as b}from"./services/diff.js";import{analyzeDeps as x,exportGraphAsDot as S,getContractNode as C,getGraphStats as w}from"./services/deps.js";import{groupSpecsByType as T,listSpecs as E}from"./services/list.js";import{getApiKey as D,loadWorkspaceConfig as O,mergeWorkspaceConfig as k}from"./services/config.js";import{buildSpec as A}from"./services/build.js";import{importFromOpenApiService as j}from"./services/openapi/import-service.js";import{syncWithOpenApiService as M}from"./services/openapi/sync-service.js";import{validateAgainstOpenApiService as N}from"./services/openapi/validate-service.js";import{exportOpenApi as P}from"./services/openapi/export-service.js";import{RegistryClient as F,addToRegistry as I,listFromRegistry as L,resolveRegistryUrl as R,searchRegistry as z}from"./services/registry.js";import{syncSpecs as B}from"./services/sync.js";import{watchSpecs as V}from"./services/watch.js";import{cleanArtifacts as H}from"./services/clean.js";import{runTests as U}from"./services/test.js";import{createRegeneratorService as W}from"./services/regenerator.js";import{findAllConfigFiles as G,formatWorkspaceInfo as K,getExtendedWorkspaceInfo as q,mergeMonorepoConfigs as J}from"./services/workspace-info.js";import{analyzeIntegrity as Y,filterIssuesBySeverity as X,filterIssuesByType as Z,getAllSpecs as Q}from"./services/integrity.js";import{generateMermaidDiagram as $}from"./services/integrity-diagram.js";import{ALL_SETUP_TARGETS as ee,SETUP_TARGET_LABELS as te}from"./services/setup/types.js";import{generateAgentsMd as ne,generateClaudeMcpConfig as re,generateContractsrcConfig as ie,generateCursorMcpConfig as ae,generateCursorRules as oe,generateVscodeSettings as se,getClaudeDesktopConfigPath as ce}from"./services/setup/config-generators.js";import{deepMergeOverwrite as le,deepMergePreserve as ue,formatJson as de,safeParseJson as fe}from"./services/setup/file-merger.js";import{runSetup as pe}from"./services/setup/setup-service.js";import{ALL_CHECK_CATEGORIES as me,CHECK_CATEGORY_LABELS as he}from"./services/doctor/types.js";import{formatCheckResult as ge,formatDoctorSummary as _e,runDoctor as ve}from"./services/doctor/doctor-service.js";import{ALL_CI_CHECK_CATEGORIES as ye,CI_CHECK_CATEGORY_LABELS as be}from"./services/ci-check/types.js";import{discoverAllImplementations as xe,discoverImplementationsForSpec as Se,extractSpecReferences as Ce,inferImplementationType as we}from"./services/implementation/discovery.js";import{getImplementationSummary as Te,resolveAllImplementations as Ee,resolveImplementations as De}from"./services/implementation/resolver.js";import{DEFAULT_CACHE_CONFIG as Oe}from"./services/verification-cache/types.js";import{VerificationCacheService as ke,cacheKeyToString as Ae,computeContentHash as je,createVerificationCacheService as Me,stringToCacheKey as Ne}from"./services/verification-cache/cache-service.js";import{InMemoryCacheStorage as Pe,createInMemoryCacheStorage as Fe}from"./services/verification-cache/adapters/in-memory.js";import{FileSystemCacheStorage as Ie,createFileSystemCacheStorage as Le}from"./services/verification-cache/adapters/filesystem.js";import{WorkspaceStateCacheStorage as Re,createWorkspaceStateCacheStorage as ze}from"./services/verification-cache/adapters/workspace-state.js";import{runCIChecks as Be}from"./services/ci-check/ci-check-service.js";import{ClaudeCodeAdapter as Ve,claudeCodeAdapter as He}from"./services/agent-guide/adapters/claude-code.js";import{CursorCLIAdapter as Ue,cursorCLIAdapter as We}from"./services/agent-guide/adapters/cursor-cli.js";import{GenericMCPAdapter as Ge,genericMCPAdapter as Ke}from"./services/agent-guide/adapters/generic-mcp.js";import{agentAdapters as qe,getAgentAdapter as Je,listAgentTypes as Ye}from"./services/agent-guide/adapters/index.js";import{AgentGuideService as Xe,agentGuideService as Ze,createAgentGuideService as Qe}from"./services/agent-guide/agent-guide-service.js";import{verifyStructure as $e}from"./services/verify/structure-verifier.js";import{verifyBehavior as et}from"./services/verify/behavior-verifier.js";import{createQuickAIReview as tt,verifySemanticFields as nt,verifyWithAI as rt,verifyWithAIEnhanced as it}from"./services/verify/ai-verifier.js";import{VerifyService as at,createVerifyService as ot,verifyService as st}from"./services/verify/verify-service.js";import"./services/index.js";import{formatters_exports as ct}from"./formatters/index.js";import{templates_exports as lt}from"./templates/index.js";import{ai_exports as ut}from"./ai/index.js";export*from"@lssm/module.contractspec-workspace";export{me as ALL_CHECK_CATEGORIES,ye as ALL_CI_CHECK_CATEGORIES,ee as ALL_SETUP_TARGETS,Xe as AgentGuideService,he as CHECK_CATEGORY_LABELS,be as CI_CHECK_CATEGORY_LABELS,Ve as ClaudeCodeAdapter,Ue as CursorCLIAdapter,Oe as DEFAULT_CACHE_CONFIG,Ie as FileSystemCacheStorage,Ge as GenericMCPAdapter,Pe as InMemoryCacheStorage,F as RegistryClient,te as SETUP_TARGET_LABELS,ke as VerificationCacheService,at as VerifyService,Re as WorkspaceStateCacheStorage,I as addToRegistry,qe as agentAdapters,Ze as agentGuideService,ut as ai,x as analyzeDeps,Y as analyzeIntegrity,A as buildSpec,Ae as cacheKeyToString,He as claudeCodeAdapter,H as cleanArtifacts,b as compareSpecs,je as computeContentHash,Qe as createAgentGuideService,i as createConsoleLoggerAdapter,Le as createFileSystemCacheStorage,Fe as createInMemoryCacheStorage,o as createNodeAdapters,r as createNodeAiAdapter,e as createNodeFsAdapter,t as createNodeGitAdapter,n as createNodeWatcherAdapter,a as createNoopLoggerAdapter,tt as createQuickAIReview,W as createRegeneratorService,Me as createVerificationCacheService,ot as createVerifyService,ze as createWorkspaceStateCacheStorage,We as cursorCLIAdapter,le as deepMergeOverwrite,ue as deepMergePreserve,s as detectPackageManager,xe as discoverAllImplementations,Se as discoverImplementationsForSpec,S as exportGraphAsDot,P as exportOpenApi,Ce as extractSpecReferences,X as filterIssuesBySeverity,Z as filterIssuesByType,G as findAllConfigFiles,c as findPackageRoot,l as findWorkspaceRoot,ge as formatCheckResult,_e as formatDoctorSummary,de as formatJson,K as formatWorkspaceInfo,ct as formatters,ne as generateAgentsMd,re as generateClaudeMcpConfig,ie as generateContractsrcConfig,ae as generateCursorMcpConfig,oe as generateCursorRules,$ as generateMermaidDiagram,se as generateVscodeSettings,Ke as genericMCPAdapter,Je as getAgentAdapter,Q as getAllSpecs,D as getApiKey,ce as getClaudeDesktopConfigPath,C as getContractNode,u as getExecCommand,q as getExtendedWorkspaceInfo,w as getGraphStats,Te as getImplementationSummary,d as getInstallCommand,f as getPackageName,p as getRunCommand,m as getWorkspaceInfo,h as getWorkspacePackages,T as groupSpecsByType,j as importFromOpenApiService,we as inferImplementationType,g as isMonorepo,Ye as listAgentTypes,L as listFromRegistry,E as listSpecs,O as loadWorkspaceConfig,J as mergeMonorepoConfigs,k as mergeWorkspaceConfig,Ee as resolveAllImplementations,De as resolveImplementations,R as resolveRegistryUrl,Be as runCIChecks,ve as runDoctor,pe as runSetup,U as runTests,fe as safeParseJson,z as searchRegistry,Ne as stringToCacheKey,B as syncSpecs,M as syncWithOpenApiService,lt as templates,N as validateAgainstOpenApiService,y as validateImplementationFiles,_ as validateSpec,v as validateSpecs,et as verifyBehavior,nt as verifySemanticFields,st as verifyService,$e as verifyStructure,rt as verifyWithAI,it as verifyWithAIEnhanced,V as watchSpecs};
@@ -0,0 +1,5 @@
1
+ import { DiscoverOptions, FileStat, FsAdapter } from "./fs.js";
2
+ import { GitAdapter, GitCleanOptions } from "./git.js";
3
+ import { WatchEvent, WatchEventHandler, WatchEventType, WatchOptions, Watcher, WatcherAdapter } from "./watcher.js";
4
+ import { AiAdapter, AiGenerateOptions, AiGenerateResult, AiGenerateStructuredOptions, AiValidationResult } from "./ai.js";
5
+ import { LogLevel, LoggerAdapter, ProgressReporter, ProgressUpdate, WorkspaceAdapters } from "./logger.js";
@@ -1,3 +1,3 @@
1
- import{n as e}from"../../../libs/contracts/dist/llm/prompts.js";import"../../../libs/contracts/dist/llm/index.js";var t=class{agentType=`claude-code`;formatPlan(t){let n=[];if(n.push(`# Implement: ${t.target.name}.v${t.target.version}`),n.push(``),n.push(`## Context`),n.push(``),n.push(`**Goal:** ${t.context.goal}`),n.push(``),n.push(`**Description:** ${t.context.description}`),n.push(``),t.context.background&&(n.push(`**Background:**`),n.push(t.context.background),n.push(``)),n.push(`## Specification`),n.push(``),n.push(t.specMarkdown),n.push(``),t.fileStructure.length>0){n.push(`## Files to Create/Modify`),n.push(``);for(let e of t.fileStructure){let t=e.type===`create`?`📝`:`✏️`;n.push(`${t} \`${e.path}\``),n.push(` ${e.purpose}`),n.push(``)}}n.push(`## Implementation Steps`),n.push(``);for(let e of t.steps){n.push(`### ${e.order}. ${e.title}`),n.push(``),n.push(e.description),n.push(``),n.push(`**Acceptance Criteria:**`);for(let t of e.acceptanceCriteria)n.push(`- [ ] ${t}`);n.push(``)}if(t.constraints.policy.length>0||t.constraints.security.length>0||t.constraints.pii.length>0){if(n.push(`## Constraints`),n.push(``),t.constraints.policy.length>0){n.push(`### Policy`);for(let e of t.constraints.policy)n.push(`- ${e}`);n.push(``)}if(t.constraints.security.length>0){n.push(`### Security`);for(let e of t.constraints.security)n.push(`- ⚠️ ${e}`);n.push(``)}if(t.constraints.pii.length>0){n.push(`### PII Handling`),n.push(`The following fields contain personally identifiable information:`);for(let e of t.constraints.pii)n.push(`- \`${e}\``);n.push(``)}}n.push(`## Verification Checklist`),n.push(``),n.push(`Before submitting, verify:`);for(let e of t.verificationChecklist)n.push(`- [ ] ${e}`);return n.push(``),n.push(`## Instructions`),n.push(``),n.push(`1. Implement each step in order`),n.push("2. Use TypeScript with strict typing (no `any`)"),n.push(`3. Include JSDoc comments for public APIs`),n.push(`4. Handle all error cases defined in the spec`),n.push(`5. Emit events as specified`),n.push(`6. Mark checklist items as you complete them`),n.push(``),{agent:`claude-code`,systemPrompt:e[`claude-code`],taskPrompt:n.join(`
1
+ import{AGENT_SYSTEM_PROMPTS as e}from"@lssm/lib.contracts/llm";var t=class{agentType=`claude-code`;formatPlan(t){let n=[];if(n.push(`# Implement: ${t.target.name}.v${t.target.version}`),n.push(``),n.push(`## Context`),n.push(``),n.push(`**Goal:** ${t.context.goal}`),n.push(``),n.push(`**Description:** ${t.context.description}`),n.push(``),t.context.background&&(n.push(`**Background:**`),n.push(t.context.background),n.push(``)),n.push(`## Specification`),n.push(``),n.push(t.specMarkdown),n.push(``),t.fileStructure.length>0){n.push(`## Files to Create/Modify`),n.push(``);for(let e of t.fileStructure){let t=e.type===`create`?`📝`:`✏️`;n.push(`${t} \`${e.path}\``),n.push(` ${e.purpose}`),n.push(``)}}n.push(`## Implementation Steps`),n.push(``);for(let e of t.steps){n.push(`### ${e.order}. ${e.title}`),n.push(``),n.push(e.description),n.push(``),n.push(`**Acceptance Criteria:**`);for(let t of e.acceptanceCriteria)n.push(`- [ ] ${t}`);n.push(``)}if(t.constraints.policy.length>0||t.constraints.security.length>0||t.constraints.pii.length>0){if(n.push(`## Constraints`),n.push(``),t.constraints.policy.length>0){n.push(`### Policy`);for(let e of t.constraints.policy)n.push(`- ${e}`);n.push(``)}if(t.constraints.security.length>0){n.push(`### Security`);for(let e of t.constraints.security)n.push(`- ⚠️ ${e}`);n.push(``)}if(t.constraints.pii.length>0){n.push(`### PII Handling`),n.push(`The following fields contain personally identifiable information:`);for(let e of t.constraints.pii)n.push(`- \`${e}\``);n.push(``)}}n.push(`## Verification Checklist`),n.push(``),n.push(`Before submitting, verify:`);for(let e of t.verificationChecklist)n.push(`- [ ] ${e}`);return n.push(``),n.push(`## Instructions`),n.push(``),n.push(`1. Implement each step in order`),n.push("2. Use TypeScript with strict typing (no `any`)"),n.push(`3. Include JSDoc comments for public APIs`),n.push(`4. Handle all error cases defined in the spec`),n.push(`5. Emit events as specified`),n.push(`6. Mark checklist items as you complete them`),n.push(``),{agent:`claude-code`,systemPrompt:e[`claude-code`],taskPrompt:n.join(`
2
2
  `)}}generateConfig(e){let t=[];return t.push(`# ContractSpec Implementation Context`),t.push(``),t.push(`This codebase uses ContractSpec for spec-first development.`),t.push(``),t.push(`## Spec Details`),t.push(``),t.push(`- **Name:** ${e.meta.name}`),t.push(`- **Version:** ${e.meta.version}`),t.push(`- **Kind:** ${e.meta.kind}`),t.push(`- **Stability:** ${e.meta.stability}`),t.push(``),t.push(`## Implementation Requirements`),t.push(``),t.push(`1. Match input/output types exactly`),t.push(`2. Handle all defined error cases`),t.push(`3. Emit events as specified`),t.push(`4. Respect policy constraints`),t.push(``),t.join(`
3
3
  `)}parseOutput(e){let t=e.match(/```(?:typescript|ts|tsx)?\n([\s\S]*?)\n```/);if(t?.[1])return{code:t[1]};let n=[];for(let t of[/error:\s*(.+)/gi,/failed:\s*(.+)/gi,/cannot\s+(.+)/gi]){let r=e.matchAll(t);for(let e of r)e[1]&&n.push(e[1])}return n.length>0?{errors:n}:{code:e}}};const n=new t;export{t as ClaudeCodeAdapter,n as claudeCodeAdapter};
@@ -1,3 +1,3 @@
1
- import{n as e}from"../../../libs/contracts/dist/llm/prompts.js";import"../../../libs/contracts/dist/llm/index.js";var t=class{agentType=`cursor-cli`;formatPlan(t){let n=[];if(n.push(`# ${t.target.name}.v${t.target.version}`),n.push(``),n.push(`> ${t.context.goal}`),n.push(``),t.fileStructure.length>0){n.push(`## Files`),n.push(``);for(let e of t.fileStructure)n.push(`- ${e.type}: \`${e.path}\` - ${e.purpose}`);n.push(``)}n.push(`## Spec`),n.push(``),n.push(t.specMarkdown),n.push(``),n.push(`## Steps`),n.push(``);for(let e of t.steps)n.push(`${e.order}. **${e.title}**: ${e.description}`);n.push(``);let r=[...t.constraints.policy,...t.constraints.security.map(e=>`⚠️ ${e}`)];if(r.length>0){n.push(`## Constraints`),n.push(``);for(let e of r)n.push(`- ${e}`);n.push(``)}return t.constraints.pii.length>0&&(n.push(`## PII Fields`),n.push(``),n.push(`Handle carefully: ${t.constraints.pii.map(e=>`\`${e}\``).join(`, `)}`),n.push(``)),{agent:`cursor-cli`,systemPrompt:e[`cursor-cli`],taskPrompt:n.join(`
1
+ import{AGENT_SYSTEM_PROMPTS as e,specToFullMarkdown as t}from"@lssm/lib.contracts/llm";var n=class{agentType=`cursor-cli`;formatPlan(t){let n=[];if(n.push(`# ${t.target.name}.v${t.target.version}`),n.push(``),n.push(`> ${t.context.goal}`),n.push(``),t.fileStructure.length>0){n.push(`## Files`),n.push(``);for(let e of t.fileStructure)n.push(`- ${e.type}: \`${e.path}\` - ${e.purpose}`);n.push(``)}n.push(`## Spec`),n.push(``),n.push(t.specMarkdown),n.push(``),n.push(`## Steps`),n.push(``);for(let e of t.steps)n.push(`${e.order}. **${e.title}**: ${e.description}`);n.push(``);let r=[...t.constraints.policy,...t.constraints.security.map(e=>`⚠️ ${e}`)];if(r.length>0){n.push(`## Constraints`),n.push(``);for(let e of r)n.push(`- ${e}`);n.push(``)}return t.constraints.pii.length>0&&(n.push(`## PII Fields`),n.push(``),n.push(`Handle carefully: ${t.constraints.pii.map(e=>`\`${e}\``).join(`, `)}`),n.push(``)),{agent:`cursor-cli`,systemPrompt:e[`cursor-cli`],taskPrompt:n.join(`
2
2
  `)}}generateConfig(e){let t=e.meta,n=[];if(n.push(`---`),n.push(`description: Implementation rules for ${t.name}.v${t.version}`),n.push(`globs: ["**/${t.name.replace(/\./g,`/`)}/**"]`),n.push(`alwaysApply: false`),n.push(`---`),n.push(``),n.push(`# ${t.name} Implementation Rules`),n.push(``),n.push(`This ${t.kind} operation must follow the ContractSpec specification.`),n.push(``),n.push(`## Goal`),n.push(``),n.push(t.goal),n.push(``),n.push(`## Requirements`),n.push(``),n.push(`1. Input/output types MUST match the spec schema exactly`),n.push(`2. All error cases MUST be handled`),e.sideEffects?.emits?.length&&n.push(`3. Events MUST be emitted as specified`),n.push(`4. Auth level: ${e.policy.auth}`),e.policy.idempotent!==void 0&&n.push(`5. Idempotency: ${e.policy.idempotent}`),n.push(``),e.io.errors&&Object.keys(e.io.errors).length>0){n.push(`## Error Cases`),n.push(``);for(let[t,r]of Object.entries(e.io.errors))n.push(`- \`${t}\` (HTTP ${r.http??400}): ${r.when}`);n.push(``)}if(e.sideEffects?.emits?.length){n.push(`## Events to Emit`),n.push(``);for(let t of e.sideEffects.emits)`ref`in t?n.push(`- \`${t.ref.name}.v${t.ref.version}\`: ${t.when}`):n.push(`- \`${t.name}.v${t.version}\`: ${t.when}`);n.push(``)}if(e.policy.pii?.length){n.push(`## PII Handling`),n.push(``),n.push(`These fields contain PII and must be handled with care:`);for(let t of e.policy.pii)n.push(`- \`${t}\``);n.push(``)}if(e.acceptance?.scenarios?.length){n.push(`## Acceptance Scenarios`),n.push(``);for(let t of e.acceptance.scenarios)n.push(`### ${t.name}`),n.push(`- Given: ${t.given.join(`; `)}`),n.push(`- When: ${t.when.join(`; `)}`),n.push(`- Then: ${t.then.join(`; `)}`),n.push(``)}return n.join(`
3
- `)}getCursorRulesPath(e){return`.cursor/rules/${e.meta.name.replace(/\./g,`-`)}.mdc`}parseOutput(e){let t=e.match(/```(?:typescript|ts|tsx|javascript|js)?\n([\s\S]*?)\n```/);return t?.[1]?{code:t[1]}:{code:e}}};const n=new t;export{t as CursorCLIAdapter,n as cursorCLIAdapter};
3
+ `)}getCursorRulesPath(e){return`.cursor/rules/${e.meta.name.replace(/\./g,`-`)}.mdc`}parseOutput(e){let t=e.match(/```(?:typescript|ts|tsx|javascript|js)?\n([\s\S]*?)\n```/);return t?.[1]?{code:t[1]}:{code:e}}};const r=new n;export{n as CursorCLIAdapter,r as cursorCLIAdapter};
@@ -1,3 +1,3 @@
1
- import{n as e}from"../../../libs/contracts/dist/llm/prompts.js";import"../../../libs/contracts/dist/llm/index.js";var t=class{agentType=`generic-mcp`;formatPlan(t){let n=[];if(n.push(`# Implementation Task: ${t.target.name}.v${t.target.version}`),n.push(``),n.push(`## Task`),n.push(``),n.push(`Implement the ${t.target.type} \`${t.target.name}\` version ${t.target.version}.`),n.push(``),n.push(`## Context`),n.push(``),n.push(`**Goal:** ${t.context.goal}`),n.push(``),n.push(`**Description:** ${t.context.description}`),n.push(``),t.context.background&&(n.push(`**Background:**`),n.push(``),n.push(t.context.background),n.push(``)),n.push(`## Specification`),n.push(``),n.push(t.specMarkdown),n.push(``),t.fileStructure.length>0){n.push(`## Files`),n.push(``),n.push(`| Path | Action | Purpose |`),n.push(`|------|--------|---------|`);for(let e of t.fileStructure)n.push(`| \`${e.path}\` | ${e.type} | ${e.purpose} |`);n.push(``)}n.push(`## Implementation Steps`),n.push(``);for(let e of t.steps)if(n.push(`### Step ${e.order}: ${e.title}`),n.push(``),n.push(e.description),n.push(``),e.acceptanceCriteria.length>0){n.push(`**Acceptance Criteria:**`),n.push(``);for(let t of e.acceptanceCriteria)n.push(`- ${t}`);n.push(``)}if(n.push(`## Constraints`),n.push(``),t.constraints.policy.length>0){n.push(`**Policy:**`);for(let e of t.constraints.policy)n.push(`- ${e}`);n.push(``)}if(t.constraints.security.length>0){n.push(`**Security:**`);for(let e of t.constraints.security)n.push(`- ${e}`);n.push(``)}if(t.constraints.pii.length>0){n.push(`**PII Fields (handle with care):**`);for(let e of t.constraints.pii)n.push(`- \`${e}\``);n.push(``)}n.push(`## Verification`),n.push(``),n.push(`After implementation, verify:`),n.push(``);for(let e of t.verificationChecklist)n.push(`- [ ] ${e}`);return n.push(``),{agent:`generic-mcp`,systemPrompt:e[`generic-mcp`],taskPrompt:n.join(`
1
+ import{AGENT_SYSTEM_PROMPTS as e}from"@lssm/lib.contracts/llm";var t=class{agentType=`generic-mcp`;formatPlan(t){let n=[];if(n.push(`# Implementation Task: ${t.target.name}.v${t.target.version}`),n.push(``),n.push(`## Task`),n.push(``),n.push(`Implement the ${t.target.type} \`${t.target.name}\` version ${t.target.version}.`),n.push(``),n.push(`## Context`),n.push(``),n.push(`**Goal:** ${t.context.goal}`),n.push(``),n.push(`**Description:** ${t.context.description}`),n.push(``),t.context.background&&(n.push(`**Background:**`),n.push(``),n.push(t.context.background),n.push(``)),n.push(`## Specification`),n.push(``),n.push(t.specMarkdown),n.push(``),t.fileStructure.length>0){n.push(`## Files`),n.push(``),n.push(`| Path | Action | Purpose |`),n.push(`|------|--------|---------|`);for(let e of t.fileStructure)n.push(`| \`${e.path}\` | ${e.type} | ${e.purpose} |`);n.push(``)}n.push(`## Implementation Steps`),n.push(``);for(let e of t.steps)if(n.push(`### Step ${e.order}: ${e.title}`),n.push(``),n.push(e.description),n.push(``),e.acceptanceCriteria.length>0){n.push(`**Acceptance Criteria:**`),n.push(``);for(let t of e.acceptanceCriteria)n.push(`- ${t}`);n.push(``)}if(n.push(`## Constraints`),n.push(``),t.constraints.policy.length>0){n.push(`**Policy:**`);for(let e of t.constraints.policy)n.push(`- ${e}`);n.push(``)}if(t.constraints.security.length>0){n.push(`**Security:**`);for(let e of t.constraints.security)n.push(`- ${e}`);n.push(``)}if(t.constraints.pii.length>0){n.push(`**PII Fields (handle with care):**`);for(let e of t.constraints.pii)n.push(`- \`${e}\``);n.push(``)}n.push(`## Verification`),n.push(``),n.push(`After implementation, verify:`),n.push(``);for(let e of t.verificationChecklist)n.push(`- [ ] ${e}`);return n.push(``),{agent:`generic-mcp`,systemPrompt:e[`generic-mcp`],taskPrompt:n.join(`
2
2
  `)}}formatAsResource(e){return{uri:`spec://${e.target.name}/v${e.target.version}/plan`,mimeType:`application/json`,data:JSON.stringify({target:e.target,context:e.context,fileStructure:e.fileStructure,steps:e.steps,constraints:e.constraints,verificationChecklist:e.verificationChecklist},null,2)}}formatAsPromptMessage(e){return{role:`user`,content:{type:`text`,text:this.formatPlan(e).taskPrompt}}}generateConfig(e){let t=e.meta,n=[];return n.push(`# ${t.name} v${t.version}`),n.push(``),n.push(`**Type:** ${t.kind}`),n.push(`**Stability:** ${t.stability}`),n.push(``),n.push(`## Goal`),n.push(``),n.push(t.goal),n.push(``),n.push(`## Description`),n.push(``),n.push(t.description),n.push(``),n.join(`
3
3
  `)}parseOutput(e){let t=e.match(/```(?:typescript|ts|tsx|javascript|js|python|go|rust)?\n([\s\S]*?)\n```/);if(t?.[1])return{code:t[1]};try{let t=JSON.parse(e);if(typeof t.code==`string`)return{code:t.code};if(typeof t.errors==`object`)return{errors:Array.isArray(t.errors)?t.errors:[String(t.errors)]}}catch{}return{code:e}}};const n=new t;export{t as GenericMCPAdapter,n as genericMCPAdapter};
@@ -1 +1 @@
1
- import{a as e,o as t,s as n}from"../../libs/contracts/dist/llm/exporters.js";import{s as r}from"../../libs/contracts/dist/llm/prompts.js";import"../../libs/contracts/dist/llm/index.js";import{getAgentAdapter as i,listAgentTypes as a}from"./adapters/index.js";const o={defaultAgent:`generic-mcp`,verbose:!1};var s=class{config;constructor(e={}){this.config={...o,...e}}generateGuide(t,n={}){let a=i(n.agent??this.config.defaultAgent),o=r(t,{projectRoot:this.config.projectRoot,existingFiles:n.targetPath?[n.targetPath]:void 0});return{plan:o,prompt:a.formatPlan(o),markdown:e(t)}}generateFeatureGuide(e,t,a={}){let o=i(a.agent??this.config.defaultAgent),s=e.operations?.[0],c=s?t.specs?.getSpec(s.name,s.version):void 0,l;c?(l=r(c,{projectRoot:this.config.projectRoot}),l.target={type:`feature`,name:e.meta.key,version:1},l.context.goal=e.meta.description??l.context.goal):l={target:{type:`feature`,name:e.meta.key,version:1},context:{goal:e.meta.description??`Implement feature ${e.meta.key}`,description:e.meta.title??e.meta.key,background:``},specMarkdown:n(e,t),fileStructure:[],steps:[{order:1,title:`Implement Feature`,description:`Implement the ${e.meta.key} feature`,acceptanceCriteria:[]}],constraints:{policy:[],security:[],pii:[]},verificationChecklist:[]},l.specMarkdown=n(e,t,{format:`full`,includeRelatedSpecs:!0,includeRelatedEvents:!0,includeRelatedPresentations:!0}),e.operations?.length&&(l.steps=e.operations.map((e,t)=>({order:t+1,title:`Implement ${e.name}`,description:`Implement operation ${e.name}.v${e.version}`,acceptanceCriteria:[`Operation ${e.name} works as specified`]})));let u=o.formatPlan(l),d=n(e,t);return{plan:l,prompt:u,markdown:d}}generateAgentConfig(e,t){return i(t??this.config.defaultAgent).generateConfig?.(e)}exportForAgent(e,n,r=`implement`,i){return t(e,{taskType:r,existingCode:i})}listAgentTypes(){return a()}getDefaultAgent(){return this.config.defaultAgent}configure(e){this.config={...this.config,...e}}};function c(e){return new s(e)}const l=new s;export{s as AgentGuideService,l as agentGuideService,c as createAgentGuideService};
1
+ import{getAgentAdapter as e,listAgentTypes as t}from"./adapters/index.js";import{featureToMarkdown as n,generateImplementationPlan as r,specToAgentPrompt as i,specToFullMarkdown as a}from"@lssm/lib.contracts/llm";const o={defaultAgent:`generic-mcp`,verbose:!1};var s=class{config;constructor(e={}){this.config={...o,...e}}generateGuide(t,n={}){let i=e(n.agent??this.config.defaultAgent),o=r(t,{projectRoot:this.config.projectRoot,existingFiles:n.targetPath?[n.targetPath]:void 0});return{plan:o,prompt:i.formatPlan(o),markdown:a(t)}}generateFeatureGuide(t,i,a={}){let o=e(a.agent??this.config.defaultAgent),s=t.operations?.[0],c=s?i.specs?.getSpec(s.name,s.version):void 0,l;c?(l=r(c,{projectRoot:this.config.projectRoot}),l.target={type:`feature`,name:t.meta.key,version:1},l.context.goal=t.meta.description??l.context.goal):l={target:{type:`feature`,name:t.meta.key,version:1},context:{goal:t.meta.description??`Implement feature ${t.meta.key}`,description:t.meta.title??t.meta.key,background:``},specMarkdown:n(t,i),fileStructure:[],steps:[{order:1,title:`Implement Feature`,description:`Implement the ${t.meta.key} feature`,acceptanceCriteria:[]}],constraints:{policy:[],security:[],pii:[]},verificationChecklist:[]},l.specMarkdown=n(t,i,{format:`full`,includeRelatedSpecs:!0,includeRelatedEvents:!0,includeRelatedPresentations:!0}),t.operations?.length&&(l.steps=t.operations.map((e,t)=>({order:t+1,title:`Implement ${e.name}`,description:`Implement operation ${e.name}.v${e.version}`,acceptanceCriteria:[`Operation ${e.name} works as specified`]})));let u=o.formatPlan(l),d=n(t,i);return{plan:l,prompt:u,markdown:d}}generateAgentConfig(t,n){return e(n??this.config.defaultAgent).generateConfig?.(t)}exportForAgent(e,t,n=`implement`,r){return i(e,{taskType:n,existingCode:r})}listAgentTypes(){return t()}getDefaultAgent(){return this.config.defaultAgent}configure(e){this.config={...this.config,...e}}};function c(e){return new s(e)}const l=new s;export{s as AgentGuideService,l as agentGuideService,c as createAgentGuideService};
@@ -0,0 +1,6 @@
1
+ import { AgentAdapter, AgentGuideConfig, FormatOptions, GuideOptions, GuideResult } from "./types.js";
2
+ import { AgentGuideService, agentGuideService, createAgentGuideService } from "./agent-guide-service.js";
3
+ import { ClaudeCodeAdapter, claudeCodeAdapter } from "./adapters/claude-code.js";
4
+ import { CursorCLIAdapter, cursorCLIAdapter } from "./adapters/cursor-cli.js";
5
+ import { GenericMCPAdapter, genericMCPAdapter } from "./adapters/generic-mcp.js";
6
+ import { agentAdapters, getAgentAdapter, listAgentTypes } from "./adapters/index.js";
@@ -1 +1 @@
1
- import{e,t}from"../modules/contractspec-workspace/dist/analysis/spec-scan.js";import{a as n,i as r,r as i}from"../modules/contractspec-workspace/dist/templates/handler.js";async function a(n,r,i,a={}){let{fs:c,logger:l}=r,{targets:u=s(n),outputDir:d=i.outputDir,overwrite:f=!1,dryRun:p=!1}=a,m=await c.readFile(n),h=t(m,n),g=e(n);l.info(`Building from spec: ${n}`,{specType:g});let _=[];for(let e of u)try{let t=await o(e,n,m,h,g,{fs:c,logger:l},d,f,p);_.push(t)}catch(t){_.push({target:e,outputPath:``,success:!1,error:t instanceof Error?t.message:String(t)})}return{specPath:n,specInfo:h,results:_}}async function o(e,t,a,o,s,l,u,d,f){let{fs:p,logger:m}=l,h,g;switch(e){case`handler`:{if(s!==`operation`)return{target:e,outputPath:``,success:!1,skipped:!0,error:`Handler generation only supported for operation specs (got ${s})`};let n=o.kind===`command`||o.kind===`query`?o.kind:`command`;h=i(o.name??`unknown`,n),g=c(t,u,`handlers`,o.name??`unknown`,`.handler.ts`,l.fs);break}case`component`:if(s!==`presentation`)return{target:e,outputPath:``,success:!1,skipped:!0,error:`Component generation only supported for presentation specs (got ${s})`};h=r(o.name??`unknown`,o.description??``),g=c(t,u,`components`,o.name??`unknown`,`.tsx`,l.fs);break;case`test`:{let e=s===`operation`?`handler`:`component`;h=n(o.name??`unknown`,e),g=c(t,u,`__tests__`,o.name??`unknown`,`.test.ts`,l.fs);break}default:return{target:e,outputPath:``,success:!1,error:`Unknown target: ${e}`}}if(await p.exists(g)&&!d)return{target:e,outputPath:g,success:!1,skipped:!0,error:`File already exists (use overwrite option)`};if(f)return m.info(`[dry-run] Would write: ${g}`),{target:e,outputPath:g,success:!0};let _=p.dirname(g);return await p.mkdir(_),await p.writeFile(g,h),m.info(`Generated: ${g}`),{target:e,outputPath:g,success:!0}}function s(t){switch(e(t)){case`operation`:return[`handler`];case`presentation`:return[`component`];default:return[]}}function c(e,t,n,r,i,a){let o=l(r.split(`.`).pop()??`unknown`),s;return s=t.startsWith(`.`)?a.resolve(a.dirname(e),`..`,t,n):a.resolve(t,n),a.join(s,`${o}${i}`)}function l(e){return e.replace(/\./g,`-`).replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}export{a as buildSpec};
1
+ import{generateComponentTemplate as e,generateHandlerTemplate as t,generateTestTemplate as n,inferSpecTypeFromFilePath as r,scanSpecSource as i}from"@lssm/module.contractspec-workspace";async function a(e,t,n,a={}){let{fs:c,logger:l}=t,{targets:u=s(e),outputDir:d=n.outputDir,overwrite:f=!1,dryRun:p=!1}=a,m=await c.readFile(e),h=i(m,e),g=r(e);l.info(`Building from spec: ${e}`,{specType:g});let _=[];for(let t of u)try{let n=await o(t,e,m,h,g,{fs:c,logger:l},d,f,p);_.push(n)}catch(e){_.push({target:t,outputPath:``,success:!1,error:e instanceof Error?e.message:String(e)})}return{specPath:e,specInfo:h,results:_}}async function o(r,i,a,o,s,l,u,d,f){let{fs:p,logger:m}=l,h,g;switch(r){case`handler`:{if(s!==`operation`)return{target:r,outputPath:``,success:!1,skipped:!0,error:`Handler generation only supported for operation specs (got ${s})`};let e=o.kind===`command`||o.kind===`query`?o.kind:`command`;h=t(o.name??`unknown`,e),g=c(i,u,`handlers`,o.name??`unknown`,`.handler.ts`,l.fs);break}case`component`:if(s!==`presentation`)return{target:r,outputPath:``,success:!1,skipped:!0,error:`Component generation only supported for presentation specs (got ${s})`};h=e(o.name??`unknown`,o.description??``),g=c(i,u,`components`,o.name??`unknown`,`.tsx`,l.fs);break;case`test`:{let e=s===`operation`?`handler`:`component`;h=n(o.name??`unknown`,e),g=c(i,u,`__tests__`,o.name??`unknown`,`.test.ts`,l.fs);break}default:return{target:r,outputPath:``,success:!1,error:`Unknown target: ${r}`}}if(await p.exists(g)&&!d)return{target:r,outputPath:g,success:!1,skipped:!0,error:`File already exists (use overwrite option)`};if(f)return m.info(`[dry-run] Would write: ${g}`),{target:r,outputPath:g,success:!0};let _=p.dirname(g);return await p.mkdir(_),await p.writeFile(g,h),m.info(`Generated: ${g}`),{target:r,outputPath:g,success:!0}}function s(e){switch(r(e)){case`operation`:return[`handler`];case`presentation`:return[`component`];default:return[]}}function c(e,t,n,r,i,a){let o=l(r.split(`.`).pop()??`unknown`),s;return s=t.startsWith(`.`)?a.resolve(a.dirname(e),`..`,t,n):a.resolve(t,n),a.join(s,`${o}${i}`)}function l(e){return e.replace(/\./g,`-`).replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}export{a as buildSpec};
@@ -1 +1 @@
1
- import{e}from"../../modules/contractspec-workspace/dist/analysis/feature-scan.js";import{e as t}from"../../modules/contractspec-workspace/dist/analysis/validate/spec-structure.js";import{validateImplementationFiles as n}from"../validate-implementation.js";import{analyzeDeps as r}from"../deps.js";import{loadWorkspaceConfig as i}from"../config.js";import{analyzeIntegrity as a}from"../integrity.js";import{runDoctor as o}from"../doctor/doctor-service.js";import{resolveAllImplementations as s}from"../implementation/resolver.js";import"../verification-cache/index.js";async function c(t,n={}){let r=Date.now(),{fs:i,logger:a}=t,o=[],s=[],c=l(n);a.info(`Starting CI checks...`,{checks:c});let y=(await i.glob({pattern:n.pattern})).filter(t=>!e(t)&&!t.includes(`.test.`)&&!t.includes(`.spec.`));if(c.includes(`structure`)){let e=Date.now(),n=await u(t,y);o.push(...n),s.push(_(`structure`,n,Date.now()-e))}if(c.includes(`integrity`)){let e=Date.now(),r=await d(t,n);o.push(...r),s.push(_(`integrity`,r,Date.now()-e))}if(c.includes(`deps`)){let e=Date.now(),r=await f(t,n);o.push(...r),s.push(_(`deps`,r,Date.now()-e))}if(c.includes(`doctor`)){let e=Date.now(),r=await p(t,n);o.push(...r),s.push(_(`doctor`,r,Date.now()-e))}if(c.includes(`handlers`)||n.checkHandlers){let e=Date.now(),n=await m(t,y);o.push(...n),s.push(_(`handlers`,n,Date.now()-e))}if(c.includes(`tests`)||n.checkTests){let e=Date.now(),n=await h(t,y);o.push(...n),s.push(_(`tests`,n,Date.now()-e))}if(c.includes(`implementation`)){let e=Date.now(),r=await g(t,y,n);o.push(...r),s.push(_(`implementation`,r,Date.now()-e))}let b=o.filter(e=>e.severity===`error`).length,x=o.filter(e=>e.severity===`warning`).length,S=o.filter(e=>e.severity===`note`).length,C=n.failOnWarnings?b===0&&x===0:b===0,w=await v(i),T={success:C,totalErrors:b,totalWarnings:x,totalNotes:S,issues:o,categories:s,durationMs:Date.now()-r,timestamp:new Date().toISOString(),...w};return a.info(`CI checks complete`,{success:C,errors:b,warnings:x,durationMs:T.durationMs}),T}function l(e){let t=[`structure`,`integrity`,`deps`,`doctor`];return e.checkHandlers&&t.push(`handlers`),e.checkTests&&t.push(`tests`),e.implementation&&t.push(`implementation`),e.checks&&e.checks.length>0?e.checks:e.skip&&e.skip.length>0?t.filter(t=>!e.skip?.includes(t)):t}async function u(e,n){let{fs:r}=e,i=[];for(let e of n){let n=t(await r.readFile(e),r.basename(e));for(let t of n.errors)i.push({ruleId:`spec-structure-error`,severity:`error`,message:t,category:`structure`,file:e});for(let t of n.warnings)i.push({ruleId:`spec-structure-warning`,severity:`warning`,message:t,category:`structure`,file:e})}return i}async function d(e,t){let n=[],r=await a(e,{pattern:t.pattern,all:!0});for(let e of r.issues)n.push({ruleId:`integrity-${e.type}`,severity:e.severity===`error`?`error`:`warning`,message:e.message,category:`integrity`,file:e.file,context:{specName:e.specName,specType:e.specType,featureKey:e.featureKey,ref:e.ref}});return n}async function f(e,t){let n=[],i=await r(e,{pattern:t.pattern});for(let e of i.cycles)n.push({ruleId:`deps-circular`,severity:`error`,message:`Circular dependency detected: ${e.join(` → `)}`,category:`deps`,context:{cycle:e}});for(let e of i.missing)for(let t of e.missing)n.push({ruleId:`deps-missing`,severity:`error`,message:`Missing dependency: ${e.contract} requires ${t}`,category:`deps`,context:{contract:e.contract,missing:t}});return n}async function p(e,t){let n=[],r=await o(e,{workspaceRoot:t.workspaceRoot??process.cwd(),skipAi:!0,categories:[`cli`,`config`,`deps`,`workspace`]});for(let e of r.checks)e.status===`fail`?n.push({ruleId:`doctor-${e.category}-${e.name.toLowerCase().replace(/\s+/g,`-`)}`,severity:`error`,message:`${e.name}: ${e.message}`,category:`doctor`,context:{details:e.details}}):e.status===`warn`&&n.push({ruleId:`doctor-${e.category}-${e.name.toLowerCase().replace(/\s+/g,`-`)}`,severity:`warning`,message:`${e.name}: ${e.message}`,category:`doctor`,context:{details:e.details}});return n}async function m(e,t){let{fs:r}=e,a=[],o=await i(r);for(let e of t){if(!e.includes(`.contracts.`))continue;let t=await n(e,{fs:r},o,{checkHandlers:!0,outputDir:o.outputDir});for(let n of t.errors)a.push({ruleId:`handler-missing`,severity:`warning`,message:n,category:`handlers`,file:e});for(let n of t.warnings)a.push({ruleId:`handler-warning`,severity:`warning`,message:n,category:`handlers`,file:e})}return a}async function h(e,t){let{fs:r}=e,a=[],o=await i(r);for(let e of t){if(!e.includes(`.contracts.`))continue;let t=await n(e,{fs:r},o,{checkTests:!0,outputDir:o.outputDir});for(let n of t.errors)a.push({ruleId:`test-missing`,severity:`warning`,message:n,category:`tests`,file:e});for(let n of t.warnings)a.push({ruleId:`test-warning`,severity:`warning`,message:n,category:`tests`,file:e})}return a}async function g(e,t,n){let{fs:r}=e,a=[],o=await i(r),c=n.implementation??{},l=await s(t.filter(e=>e.includes(`.contracts.`)),{fs:r},o,{computeHashes:c.useCache??!0});for(let e of l){if(c.requireImplemented&&e.status===`missing`?a.push({ruleId:`impl-missing`,severity:`error`,message:`Spec ${e.specName} has no implementation`,category:`implementation`,file:e.specPath,context:{specName:e.specName,specVersion:e.specVersion,status:e.status}}):e.status===`missing`&&a.push({ruleId:`impl-missing`,severity:`warning`,message:`Spec ${e.specName} has no implementation`,category:`implementation`,file:e.specPath,context:{specName:e.specName,specVersion:e.specVersion,status:e.status}}),!c.allowPartial&&e.status===`partial`){let t=e.implementations.filter(e=>!e.exists&&e.type!==`test`).map(e=>e.path);a.push({ruleId:`impl-partial`,severity:`warning`,message:`Spec ${e.specName} has partial implementation: missing ${t.join(`, `)}`,category:`implementation`,file:e.specPath,context:{specName:e.specName,specVersion:e.specVersion,status:e.status,missingFiles:t}})}let t=e.implementations.filter(e=>!e.exists&&e.type===`test`);t.length>0&&a.push({ruleId:`impl-missing-tests`,severity:`note`,message:`Spec ${e.specName} missing test files: ${t.map(e=>e.path).join(`, `)}`,category:`implementation`,file:e.specPath,context:{specName:e.specName,missingTests:t.map(e=>e.path)}})}return a}function _(e,t,n){let r={structure:`Spec Structure Validation`,integrity:`Contract Integrity Analysis`,deps:`Dependency Analysis`,doctor:`Installation Health`,handlers:`Handler Implementation`,tests:`Test Coverage`,implementation:`Implementation Verification`},i=t.filter(e=>e.severity===`error`).length,a=t.filter(e=>e.severity===`warning`).length,o=t.filter(e=>e.severity===`note`).length;return{category:e,label:r[e],errors:i,warnings:a,notes:o,passed:i===0,durationMs:n}}async function v(e){try{let t=`.git/HEAD`;if(!await e.exists(t))return{};let n=await e.readFile(t),r=n.match(/^ref: (.+)$/m);if(r){let t=r[1]?.replace(`refs/heads/`,``),n=`.git/${r[1]}`;return await e.exists(n)?{commitSha:(await e.readFile(n)).trim(),branch:t}:{branch:t}}return{commitSha:n.trim()}}catch{return{}}}export{c as runCIChecks};
1
+ import{validateImplementationFiles as e}from"../validate-implementation.js";import{analyzeDeps as t}from"../deps.js";import{loadWorkspaceConfig as n}from"../config.js";import{analyzeIntegrity as r}from"../integrity.js";import{runDoctor as i}from"../doctor/doctor-service.js";import{resolveAllImplementations as a}from"../implementation/resolver.js";import"../verification-cache/index.js";import{isFeatureFile as o,validateSpecStructure as s}from"@lssm/module.contractspec-workspace";async function c(e,t={}){let n=Date.now(),{fs:r,logger:i}=e,a=[],s=[],c=l(t);i.info(`Starting CI checks...`,{checks:c});let y=(await r.glob({pattern:t.pattern})).filter(e=>!o(e)&&!e.includes(`.test.`)&&!e.includes(`.spec.`));if(c.includes(`structure`)){let t=Date.now(),n=await u(e,y);a.push(...n),s.push(_(`structure`,n,Date.now()-t))}if(c.includes(`integrity`)){let n=Date.now(),r=await d(e,t);a.push(...r),s.push(_(`integrity`,r,Date.now()-n))}if(c.includes(`deps`)){let n=Date.now(),r=await f(e,t);a.push(...r),s.push(_(`deps`,r,Date.now()-n))}if(c.includes(`doctor`)){let n=Date.now(),r=await p(e,t);a.push(...r),s.push(_(`doctor`,r,Date.now()-n))}if(c.includes(`handlers`)||t.checkHandlers){let t=Date.now(),n=await m(e,y);a.push(...n),s.push(_(`handlers`,n,Date.now()-t))}if(c.includes(`tests`)||t.checkTests){let t=Date.now(),n=await h(e,y);a.push(...n),s.push(_(`tests`,n,Date.now()-t))}if(c.includes(`implementation`)){let n=Date.now(),r=await g(e,y,t);a.push(...r),s.push(_(`implementation`,r,Date.now()-n))}let b=a.filter(e=>e.severity===`error`).length,x=a.filter(e=>e.severity===`warning`).length,S=a.filter(e=>e.severity===`note`).length,C=t.failOnWarnings?b===0&&x===0:b===0,w=await v(r),T={success:C,totalErrors:b,totalWarnings:x,totalNotes:S,issues:a,categories:s,durationMs:Date.now()-n,timestamp:new Date().toISOString(),...w};return i.info(`CI checks complete`,{success:C,errors:b,warnings:x,durationMs:T.durationMs}),T}function l(e){let t=[`structure`,`integrity`,`deps`,`doctor`];return e.checkHandlers&&t.push(`handlers`),e.checkTests&&t.push(`tests`),e.implementation&&t.push(`implementation`),e.checks&&e.checks.length>0?e.checks:e.skip&&e.skip.length>0?t.filter(t=>!e.skip?.includes(t)):t}async function u(e,t){let{fs:n}=e,r=[];for(let e of t){let t=s(await n.readFile(e),n.basename(e));for(let n of t.errors)r.push({ruleId:`spec-structure-error`,severity:`error`,message:n,category:`structure`,file:e});for(let n of t.warnings)r.push({ruleId:`spec-structure-warning`,severity:`warning`,message:n,category:`structure`,file:e})}return r}async function d(e,t){let n=[],i=await r(e,{pattern:t.pattern,all:!0});for(let e of i.issues)n.push({ruleId:`integrity-${e.type}`,severity:e.severity===`error`?`error`:`warning`,message:e.message,category:`integrity`,file:e.file,context:{specName:e.specName,specType:e.specType,featureKey:e.featureKey,ref:e.ref}});return n}async function f(e,n){let r=[],i=await t(e,{pattern:n.pattern});for(let e of i.cycles)r.push({ruleId:`deps-circular`,severity:`error`,message:`Circular dependency detected: ${e.join(` → `)}`,category:`deps`,context:{cycle:e}});for(let e of i.missing)for(let t of e.missing)r.push({ruleId:`deps-missing`,severity:`error`,message:`Missing dependency: ${e.contract} requires ${t}`,category:`deps`,context:{contract:e.contract,missing:t}});return r}async function p(e,t){let n=[],r=await i(e,{workspaceRoot:t.workspaceRoot??process.cwd(),skipAi:!0,categories:[`cli`,`config`,`deps`,`workspace`]});for(let e of r.checks)e.status===`fail`?n.push({ruleId:`doctor-${e.category}-${e.name.toLowerCase().replace(/\s+/g,`-`)}`,severity:`error`,message:`${e.name}: ${e.message}`,category:`doctor`,context:{details:e.details}}):e.status===`warn`&&n.push({ruleId:`doctor-${e.category}-${e.name.toLowerCase().replace(/\s+/g,`-`)}`,severity:`warning`,message:`${e.name}: ${e.message}`,category:`doctor`,context:{details:e.details}});return n}async function m(t,r){let{fs:i}=t,a=[],o=await n(i);for(let t of r){if(!t.includes(`.contracts.`))continue;let n=await e(t,{fs:i},o,{checkHandlers:!0,outputDir:o.outputDir});for(let e of n.errors)a.push({ruleId:`handler-missing`,severity:`warning`,message:e,category:`handlers`,file:t});for(let e of n.warnings)a.push({ruleId:`handler-warning`,severity:`warning`,message:e,category:`handlers`,file:t})}return a}async function h(t,r){let{fs:i}=t,a=[],o=await n(i);for(let t of r){if(!t.includes(`.contracts.`))continue;let n=await e(t,{fs:i},o,{checkTests:!0,outputDir:o.outputDir});for(let e of n.errors)a.push({ruleId:`test-missing`,severity:`warning`,message:e,category:`tests`,file:t});for(let e of n.warnings)a.push({ruleId:`test-warning`,severity:`warning`,message:e,category:`tests`,file:t})}return a}async function g(e,t,r){let{fs:i}=e,o=[],s=await n(i),c=r.implementation??{},l=await a(t.filter(e=>e.includes(`.contracts.`)),{fs:i},s,{computeHashes:c.useCache??!0});for(let e of l){if(c.requireImplemented&&e.status===`missing`?o.push({ruleId:`impl-missing`,severity:`error`,message:`Spec ${e.specName} has no implementation`,category:`implementation`,file:e.specPath,context:{specName:e.specName,specVersion:e.specVersion,status:e.status}}):e.status===`missing`&&o.push({ruleId:`impl-missing`,severity:`warning`,message:`Spec ${e.specName} has no implementation`,category:`implementation`,file:e.specPath,context:{specName:e.specName,specVersion:e.specVersion,status:e.status}}),!c.allowPartial&&e.status===`partial`){let t=e.implementations.filter(e=>!e.exists&&e.type!==`test`).map(e=>e.path);o.push({ruleId:`impl-partial`,severity:`warning`,message:`Spec ${e.specName} has partial implementation: missing ${t.join(`, `)}`,category:`implementation`,file:e.specPath,context:{specName:e.specName,specVersion:e.specVersion,status:e.status,missingFiles:t}})}let t=e.implementations.filter(e=>!e.exists&&e.type===`test`);t.length>0&&o.push({ruleId:`impl-missing-tests`,severity:`note`,message:`Spec ${e.specName} missing test files: ${t.map(e=>e.path).join(`, `)}`,category:`implementation`,file:e.specPath,context:{specName:e.specName,missingTests:t.map(e=>e.path)}})}return o}function _(e,t,n){let r={structure:`Spec Structure Validation`,integrity:`Contract Integrity Analysis`,deps:`Dependency Analysis`,doctor:`Installation Health`,handlers:`Handler Implementation`,tests:`Test Coverage`,implementation:`Implementation Verification`},i=t.filter(e=>e.severity===`error`).length,a=t.filter(e=>e.severity===`warning`).length,o=t.filter(e=>e.severity===`note`).length;return{category:e,label:r[e],errors:i,warnings:a,notes:o,passed:i===0,durationMs:n}}async function v(e){try{let t=`.git/HEAD`;if(!await e.exists(t))return{};let n=await e.readFile(t),r=n.match(/^ref: (.+)$/m);if(r){let t=r[1]?.replace(`refs/heads/`,``),n=`.git/${r[1]}`;return await e.exists(n)?{commitSha:(await e.readFile(n)).trim(),branch:t}:{branch:t}}return{commitSha:n.trim()}}catch{return{}}}export{c as runCIChecks};
@@ -0,0 +1,2 @@
1
+ import { ALL_CI_CHECK_CATEGORIES, CICheckCategory, CICheckCategorySummary, CICheckOptions, CICheckResult, CIFormatOptions, CIIssue, CIIssueSeverity, CIOutputFormat, CI_CHECK_CATEGORY_LABELS } from "./types.js";
2
+ import { runCIChecks } from "./ci-check-service.js";
@@ -1 +1 @@
1
- import{e}from"../modules/contractspec-workspace/dist/types/generation-types.js";import*as t from"zod";const n=t.object({aiProvider:t.enum([`claude`,`openai`,`ollama`,`custom`]).default(`claude`),aiModel:t.string().optional(),agentMode:t.enum([`simple`,`cursor`,`claude-code`,`openai-codex`]).default(`simple`),customEndpoint:t.string().url().nullable().optional(),customApiKey:t.string().nullable().optional(),outputDir:t.string().default(`./src`),conventions:t.object({operations:t.string().default(`interactions/commands|queries`),events:t.string().default(`events`),presentations:t.string().default(`presentations`),forms:t.string().default(`forms`)}),defaultOwners:t.array(t.string()).default([]),defaultTags:t.array(t.string()).default([])});async function r(t,r){let i=t.join(r??`.`,`.contractsrc.json`);if(!await t.exists(i))return e;try{let e=await t.readFile(i),r=JSON.parse(e);return n.parse(r)}catch{return e}}function i(e,t){return{...e,aiProvider:t.provider??process.env.CONTRACTSPEC_AI_PROVIDER??e.aiProvider,aiModel:t.model??process.env.CONTRACTSPEC_AI_MODEL??e.aiModel,agentMode:t.agentMode??process.env.CONTRACTSPEC_AGENT_MODE??e.agentMode,customEndpoint:t.endpoint??process.env.CONTRACTSPEC_LLM_ENDPOINT??e.customEndpoint??void 0,customApiKey:process.env.CONTRACTSPEC_LLM_API_KEY??e.customApiKey??void 0,outputDir:t.outputDir??e.outputDir}}function a(e){switch(e){case`claude`:return process.env.ANTHROPIC_API_KEY;case`openai`:return process.env.OPENAI_API_KEY;case`custom`:return process.env.CONTRACTSPEC_LLM_API_KEY;case`ollama`:return;default:return}}export{a as getApiKey,r as loadWorkspaceConfig,i as mergeWorkspaceConfig};
1
+ import{DEFAULT_WORKSPACE_CONFIG as e}from"@lssm/module.contractspec-workspace";import*as t from"zod";const n=t.object({aiProvider:t.enum([`claude`,`openai`,`ollama`,`custom`]).default(`claude`),aiModel:t.string().optional(),agentMode:t.enum([`simple`,`cursor`,`claude-code`,`openai-codex`]).default(`simple`),customEndpoint:t.string().url().nullable().optional(),customApiKey:t.string().nullable().optional(),outputDir:t.string().default(`./src`),conventions:t.object({operations:t.string().default(`interactions/commands|queries`),events:t.string().default(`events`),presentations:t.string().default(`presentations`),forms:t.string().default(`forms`)}),defaultOwners:t.array(t.string()).default([]),defaultTags:t.array(t.string()).default([])});async function r(t,r){let i=t.join(r??`.`,`.contractsrc.json`);if(!await t.exists(i))return e;try{let e=await t.readFile(i),r=JSON.parse(e);return n.parse(r)}catch{return e}}function i(e,t){return{...e,aiProvider:t.provider??process.env.CONTRACTSPEC_AI_PROVIDER??e.aiProvider,aiModel:t.model??process.env.CONTRACTSPEC_AI_MODEL??e.aiModel,agentMode:t.agentMode??process.env.CONTRACTSPEC_AGENT_MODE??e.agentMode,customEndpoint:t.endpoint??process.env.CONTRACTSPEC_LLM_ENDPOINT??e.customEndpoint??void 0,customApiKey:process.env.CONTRACTSPEC_LLM_API_KEY??e.customApiKey??void 0,outputDir:t.outputDir??e.outputDir}}function a(e){switch(e){case`claude`:return process.env.ANTHROPIC_API_KEY;case`openai`:return process.env.OPENAI_API_KEY;case`custom`:return process.env.CONTRACTSPEC_LLM_API_KEY;case`ollama`:return;default:return}}export{a as getApiKey,r as loadWorkspaceConfig,i as mergeWorkspaceConfig};
@@ -1 +1 @@
1
- import{a as e,e as t,i as n,n as r,r as i,t as a}from"../modules/contractspec-workspace/dist/analysis/deps/graph.js";import{e as o}from"../modules/contractspec-workspace/dist/analysis/deps/parse-imports.js";async function s(i,s={}){let{fs:c}=i,l=await c.glob({pattern:s.pattern}),u=n();for(let t of l){let n=await c.readFile(t),r=c.relative(`.`,t),i=n.match(/name:\s*['"]([^'"]+)['"]/);e(u,(i?.[1]?i[1]:c.basename(t).replace(/\.[jt]s$/,``).replace(/\.(contracts|event|presentation|workflow|data-view|migration|telemetry|experiment|app-config|integration|knowledge)$/,``))||`unknown`,r,o(n,t))}t(u);let d=a(u),f=r(u);return{graph:u,total:u.size,cycles:d,missing:f}}function c(e,t){return e.get(t)}function l(e){return i(e)}function u(e){let t=Array.from(e.values()),n=t.filter(e=>e.dependencies.length>0),r=t.filter(e=>e.dependencies.length===0),i=t.filter(e=>e.dependents.length>0),a=t.filter(e=>e.dependents.length===0);return{total:e.size,withDeps:n.length,withoutDeps:r.length,used:i.length,unused:a.length}}export{s as analyzeDeps,l as exportGraphAsDot,c as getContractNode,u as getGraphStats};
1
+ import{addContractNode as e,buildReverseEdges as t,createContractGraph as n,detectCycles as r,findMissingDependencies as i,parseImportedSpecNames as a,toDot as o}from"@lssm/module.contractspec-workspace";async function s(o,s={}){let{fs:c}=o,l=await c.glob({pattern:s.pattern}),u=n();for(let t of l){let n=await c.readFile(t),r=c.relative(`.`,t),i=n.match(/name:\s*['"]([^'"]+)['"]/);e(u,(i?.[1]?i[1]:c.basename(t).replace(/\.[jt]s$/,``).replace(/\.(contracts|event|presentation|workflow|data-view|migration|telemetry|experiment|app-config|integration|knowledge)$/,``))||`unknown`,r,a(n,t))}t(u);let d=r(u),f=i(u);return{graph:u,total:u.size,cycles:d,missing:f}}function c(e,t){return e.get(t)}function l(e){return o(e)}function u(e){let t=Array.from(e.values()),n=t.filter(e=>e.dependencies.length>0),r=t.filter(e=>e.dependencies.length===0),i=t.filter(e=>e.dependents.length>0),a=t.filter(e=>e.dependents.length===0);return{total:e.size,withDeps:n.length,withoutDeps:r.length,used:i.length,unused:a.length}}export{s as analyzeDeps,l as exportGraphAsDot,c as getContractNode,u as getGraphStats};
@@ -1 +1 @@
1
- import{t as e}from"../modules/contractspec-workspace/dist/analysis/diff/semantic.js";async function t(t,n,r,i={}){let{fs:a,git:o}=r;if(!await a.exists(t))throw Error(`Spec file not found: ${t}`);let s=await a.readFile(t),c,l;if(i.baseline)c=await o.showFile(i.baseline,t),l=`${i.baseline}:${t}`;else{if(!await a.exists(n))throw Error(`Spec file not found: ${n}`);c=await a.readFile(n),l=n}let u=e(s,t,c,l,{breakingOnly:i.breakingOnly});return{spec1:t,spec2:l,differences:u}}export{t as compareSpecs};
1
+ import{computeSemanticDiff as e}from"@lssm/module.contractspec-workspace";async function t(t,n,r,i={}){let{fs:a,git:o}=r;if(!await a.exists(t))throw Error(`Spec file not found: ${t}`);let s=await a.readFile(t),c,l;if(i.baseline)c=await o.showFile(i.baseline,t),l=`${i.baseline}:${t}`;else{if(!await a.exists(n))throw Error(`Spec file not found: ${n}`);c=await a.readFile(n),l=n}let u=e(s,t,c,l,{breakingOnly:i.breakingOnly});return{spec1:t,spec2:l,differences:u}}export{t as compareSpecs};
@@ -0,0 +1,2 @@
1
+ import { ALL_CHECK_CATEGORIES, CHECK_CATEGORY_LABELS, CheckCategory, CheckContext, CheckResult, CheckStatus, DoctorOptions, DoctorPromptCallbacks, DoctorResult, FixAction, FixResult } from "./types.js";
2
+ import { formatCheckResult, formatDoctorSummary, runDoctor } from "./doctor-service.js";
@@ -0,0 +1,3 @@
1
+ import { DiscoveryOptions, ImplementationSource, ImplementationStatus, ResolvedImplementation, SpecImplementationResult, SpecReferenceMatch } from "./types.js";
2
+ import { discoverAllImplementations, discoverImplementationsForSpec, extractSpecReferences, inferImplementationType } from "./discovery.js";
3
+ import { ResolverOptions, getImplementationSummary, resolveAllImplementations, resolveImplementations } from "./resolver.js";
@@ -1 +1 @@
1
- import{t as e}from"../../modules/contractspec-workspace/dist/analysis/spec-scan.js";import{discoverImplementationsForSpec as t}from"./discovery.js";import{createHash as n}from"crypto";const r={includeExplicit:!0,includeDiscovered:!0,includeConvention:!0,computeHashes:!0};function i(e){return e.replace(/\./g,`-`).replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}function a(e){return n(`sha256`).update(e).digest(`hex`)}function o(e,t,n){let r=i(t),a=[];return e===`operation`&&(a.push({path:`${n}/handlers/${r}.handler.ts`,type:`handler`}),a.push({path:`${n}/handlers/${r}.handler.test.ts`,type:`test`})),e===`presentation`&&(a.push({path:`${n}/components/${r}.tsx`,type:`component`}),a.push({path:`${n}/components/${r}.test.tsx`,type:`test`})),e===`form`&&(a.push({path:`${n}/forms/${r}.form.tsx`,type:`form`}),a.push({path:`${n}/forms/${r}.form.test.tsx`,type:`test`})),e===`event`&&(a.push({path:`${n}/handlers/${r}.handler.ts`,type:`handler`}),a.push({path:`${n}/handlers/${r}.handler.test.ts`,type:`test`})),a}function s(e){if(e.length===0)return`missing`;let t=e.filter(e=>e.exists);return e.filter(e=>e.type!==`test`),t.filter(e=>e.type!==`test`).length===0?`missing`:e.every(e=>e.exists)?`implemented`:`partial`}async function c(n,i,c,d={}){let f={...r,...d},{fs:p}=i;if(!await p.exists(n))throw Error(`Spec file not found: ${n}`);let m=await p.readFile(n),h=f.computeHashes?a(m):void 0,g=e(m,n),_=g.name??p.basename(n).replace(/\.[jt]s$/,``),v=g.version??1,y=g.specType??`operation`,b=[],x=new Set,S=async(e,t,n,r)=>{if(x.has(e))return;x.add(e);let i=await p.exists(e),o;if(i&&f.computeHashes)try{o=a(await p.readFile(e))}catch{}b.push({path:e,type:t,source:n,exists:i,contentHash:o,description:r})};if(f.includeExplicit){let e=l(m);for(let t of e)await S(t.path,t.type,`explicit`,t.description)}if(f.includeDiscovered){let e=await t(_,i,f),r=u(_);for(let n of r){let r=await t(n,i,f);e.push(...r)}for(let t of e)t.filePath!==n&&await S(t.filePath,t.inferredType,`discovered`)}if(f.includeConvention){let e=o(y,_,f.outputDir??c.outputDir??`./src`);for(let{path:t,type:n}of e)await S(t,n,`convention`)}return{specName:_,specVersion:v,specPath:n,specType:y,implementations:b,status:s(b),specHash:h}}function l(e){let t=[],n=e.match(/implementations\s*:\s*\[([\s\S]*?)\]/);if(!n)return t;let r=n[1];if(!r)return t;let i=/\{\s*path\s*:\s*['"`]([^'"`]+)['"`]\s*,\s*type\s*:\s*['"`]([^'"`]+)['"`](?:\s*,\s*description\s*:\s*['"`]([^'"`]+)['"`])?\s*\}/g,a;for(;(a=i.exec(r))!==null;)t.push({path:a[1],type:a[2],description:a[3]});return t}function u(e){let t=[],n=e.replace(/Spec$/,``).replace(/Contract$/,``).replace(/Command$/,``).replace(/Query$/,``);n!==e&&(t.push(n),t.push(`${n}Spec`),t.push(`${n}Contract`));let r=e.split(`.`);if(r.length>1){let e=r.map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``);t.push(e)}return t}async function d(e,t,n,r={}){let i=[];for(let a of e)try{let e=await c(a,t,n,r);i.push(e)}catch(e){console.error(`Failed to resolve implementations for ${a}:`,e)}return i}function f(e){let t=e.filter(e=>e.status===`implemented`).length,n=e.filter(e=>e.status===`partial`).length,r=e.filter(e=>e.status===`missing`).length;return{total:e.length,implemented:t,partial:n,missing:r,coverage:e.length>0?Math.round(t/e.length*100):100}}export{f as getImplementationSummary,d as resolveAllImplementations,c as resolveImplementations};
1
+ import{discoverImplementationsForSpec as e}from"./discovery.js";import{scanSpecSource as t}from"@lssm/module.contractspec-workspace";import{createHash as n}from"crypto";const r={includeExplicit:!0,includeDiscovered:!0,includeConvention:!0,computeHashes:!0};function i(e){return e.replace(/\./g,`-`).replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}function a(e){return n(`sha256`).update(e).digest(`hex`)}function o(e,t,n){let r=i(t),a=[];return e===`operation`&&(a.push({path:`${n}/handlers/${r}.handler.ts`,type:`handler`}),a.push({path:`${n}/handlers/${r}.handler.test.ts`,type:`test`})),e===`presentation`&&(a.push({path:`${n}/components/${r}.tsx`,type:`component`}),a.push({path:`${n}/components/${r}.test.tsx`,type:`test`})),e===`form`&&(a.push({path:`${n}/forms/${r}.form.tsx`,type:`form`}),a.push({path:`${n}/forms/${r}.form.test.tsx`,type:`test`})),e===`event`&&(a.push({path:`${n}/handlers/${r}.handler.ts`,type:`handler`}),a.push({path:`${n}/handlers/${r}.handler.test.ts`,type:`test`})),a}function s(e){if(e.length===0)return`missing`;let t=e.filter(e=>e.exists);return e.filter(e=>e.type!==`test`),t.filter(e=>e.type!==`test`).length===0?`missing`:e.every(e=>e.exists)?`implemented`:`partial`}async function c(n,i,c,d={}){let f={...r,...d},{fs:p}=i;if(!await p.exists(n))throw Error(`Spec file not found: ${n}`);let m=await p.readFile(n),h=f.computeHashes?a(m):void 0,g=t(m,n),_=g.name??p.basename(n).replace(/\.[jt]s$/,``),v=g.version??1,y=g.specType??`operation`,b=[],x=new Set,S=async(e,t,n,r)=>{if(x.has(e))return;x.add(e);let i=await p.exists(e),o;if(i&&f.computeHashes)try{o=a(await p.readFile(e))}catch{}b.push({path:e,type:t,source:n,exists:i,contentHash:o,description:r})};if(f.includeExplicit){let e=l(m);for(let t of e)await S(t.path,t.type,`explicit`,t.description)}if(f.includeDiscovered){let t=await e(_,i,f),r=u(_);for(let n of r){let r=await e(n,i,f);t.push(...r)}for(let e of t)e.filePath!==n&&await S(e.filePath,e.inferredType,`discovered`)}if(f.includeConvention){let e=o(y,_,f.outputDir??c.outputDir??`./src`);for(let{path:t,type:n}of e)await S(t,n,`convention`)}return{specName:_,specVersion:v,specPath:n,specType:y,implementations:b,status:s(b),specHash:h}}function l(e){let t=[],n=e.match(/implementations\s*:\s*\[([\s\S]*?)\]/);if(!n)return t;let r=n[1];if(!r)return t;let i=/\{\s*path\s*:\s*['"`]([^'"`]+)['"`]\s*,\s*type\s*:\s*['"`]([^'"`]+)['"`](?:\s*,\s*description\s*:\s*['"`]([^'"`]+)['"`])?\s*\}/g,a;for(;(a=i.exec(r))!==null;)t.push({path:a[1],type:a[2],description:a[3]});return t}function u(e){let t=[],n=e.replace(/Spec$/,``).replace(/Contract$/,``).replace(/Command$/,``).replace(/Query$/,``);n!==e&&(t.push(n),t.push(`${n}Spec`),t.push(`${n}Contract`));let r=e.split(`.`);if(r.length>1){let e=r.map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``);t.push(e)}return t}async function d(e,t,n,r={}){let i=[];for(let a of e)try{let e=await c(a,t,n,r);i.push(e)}catch(e){console.error(`Failed to resolve implementations for ${a}:`,e)}return i}function f(e){let t=e.filter(e=>e.status===`implemented`).length,n=e.filter(e=>e.status===`partial`).length,r=e.filter(e=>e.status===`missing`).length;return{total:e.length,implemented:t,partial:n,missing:r,coverage:e.length>0?Math.round(t/e.length*100):100}}export{f as getImplementationSummary,d as resolveAllImplementations,c as resolveImplementations};
@@ -0,0 +1,56 @@
1
+ import { PackageManager, WorkspaceInfo, detectPackageManager, findPackageRoot, findWorkspaceRoot, getWorkspaceInfo } from "../adapters/workspace.js";
2
+ import { ValidateSpecOptions, ValidateSpecResult, validateSpec, validateSpecs } from "./validate.js";
3
+ import { ValidateImplementationOptions, ValidateImplementationResult, validateImplementationFiles } from "./validate-implementation.js";
4
+ import { CompareSpecsOptions, CompareSpecsResult, compareSpecs } from "./diff.js";
5
+ import { AnalyzeDepsOptions, AnalyzeDepsResult, analyzeDeps, exportGraphAsDot, getContractNode, getGraphStats } from "./deps.js";
6
+ import { ListSpecsOptions, groupSpecsByType, listSpecs } from "./list.js";
7
+ import { getApiKey, loadWorkspaceConfig, mergeWorkspaceConfig } from "./config.js";
8
+ import { BuildSpecOptions, BuildSpecResult, BuildTarget, BuildTargetResult, buildSpec } from "./build.js";
9
+ import { OpenApiExportServiceOptions, OpenApiExportServiceResult, OpenApiImportServiceOptions, OpenApiImportServiceResult, OpenApiSourceConfig, OpenApiSyncServiceOptions, OpenApiSyncServiceResult, OpenApiValidateServiceOptions, OpenApiValidateServiceResult } from "./openapi/types.js";
10
+ import { importFromOpenApiService } from "./openapi/import-service.js";
11
+ import { syncWithOpenApiService } from "./openapi/sync-service.js";
12
+ import { validateAgainstOpenApiService } from "./openapi/validate-service.js";
13
+ import { OpenApiExportOptions, OpenApiExportResult, exportOpenApi } from "./openapi/export-service.js";
14
+ import "./openapi/index.js";
15
+ import { RegistryClient, RegistryClientOptions, addToRegistry, listFromRegistry, resolveRegistryUrl, searchRegistry } from "./registry.js";
16
+ import { SyncBuildFn, SyncSpecsOptions, SyncSpecsResult, SyncSpecsRunResult, SyncValidateFn, syncSpecs } from "./sync.js";
17
+ import { WatchBuildFn, WatchSpecsOptions, WatchValidateFn, watchSpecs } from "./watch.js";
18
+ import { CleanOptions, CleanResult, cleanArtifacts } from "./clean.js";
19
+ import { RunTestsResult, TestRunResult, runTests } from "./test.js";
20
+ import { CreateRegeneratorOptions, createRegeneratorService } from "./regenerator.js";
21
+ import { ExtendedWorkspaceInfo, MonorepoConfig, findAllConfigFiles, formatWorkspaceInfo, getExtendedWorkspaceInfo, mergeMonorepoConfigs } from "./workspace-info.js";
22
+ import { CoverageByType, IntegrityAnalysisOptions, IntegrityAnalysisResult, IntegrityIssue, SpecInventory, SpecLocation, analyzeIntegrity, filterIssuesBySeverity, filterIssuesByType, getAllSpecs } from "./integrity.js";
23
+ import { DiagramOptions, DiagramType, generateMermaidDiagram } from "./integrity-diagram.js";
24
+ import { ALL_SETUP_TARGETS, SETUP_TARGET_LABELS, SetupFileResult, SetupOptions, SetupPromptCallbacks, SetupResult, SetupScope, SetupTarget } from "./setup/types.js";
25
+ import { runSetup } from "./setup/setup-service.js";
26
+ import { generateAgentsMd, generateClaudeMcpConfig, generateContractsrcConfig, generateCursorMcpConfig, generateCursorRules, generateVscodeSettings, getClaudeDesktopConfigPath } from "./setup/config-generators.js";
27
+ import { deepMergeOverwrite, deepMergePreserve, formatJson, safeParseJson } from "./setup/file-merger.js";
28
+ import { ALL_CHECK_CATEGORIES, CHECK_CATEGORY_LABELS, CheckCategory, CheckContext, CheckResult, CheckStatus, DoctorOptions, DoctorPromptCallbacks, DoctorResult, FixAction, FixResult } from "./doctor/types.js";
29
+ import { formatCheckResult, formatDoctorSummary, runDoctor } from "./doctor/doctor-service.js";
30
+ import "./doctor/index.js";
31
+ import { ALL_CI_CHECK_CATEGORIES, CICheckCategory, CICheckCategorySummary, CICheckOptions, CICheckResult, CIFormatOptions, CIIssue, CIIssueSeverity, CIOutputFormat, CI_CHECK_CATEGORY_LABELS } from "./ci-check/types.js";
32
+ import { runCIChecks } from "./ci-check/ci-check-service.js";
33
+ import "./ci-check/index.js";
34
+ import { AgentAdapter, AgentGuideConfig, FormatOptions, GuideOptions, GuideResult } from "./agent-guide/types.js";
35
+ import { AgentGuideService, agentGuideService, createAgentGuideService } from "./agent-guide/agent-guide-service.js";
36
+ import { ClaudeCodeAdapter, claudeCodeAdapter } from "./agent-guide/adapters/claude-code.js";
37
+ import { CursorCLIAdapter, cursorCLIAdapter } from "./agent-guide/adapters/cursor-cli.js";
38
+ import { GenericMCPAdapter, genericMCPAdapter } from "./agent-guide/adapters/generic-mcp.js";
39
+ import { agentAdapters, getAgentAdapter, listAgentTypes } from "./agent-guide/adapters/index.js";
40
+ import "./agent-guide/index.js";
41
+ import { AIReviewResult, BehaviorCheck, FieldMapping, FieldMatchType, IntentAlignment, SemanticVerificationResult, StructureCheck, VerifyConfig, VerifyInput, VerifyOptions, VerifyResult } from "./verify/types.js";
42
+ import { VerifyService, createVerifyService, verifyService } from "./verify/verify-service.js";
43
+ import { verifyStructure } from "./verify/structure-verifier.js";
44
+ import { verifyBehavior } from "./verify/behavior-verifier.js";
45
+ import { createQuickAIReview, verifySemanticFields, verifyWithAI, verifyWithAIEnhanced } from "./verify/ai-verifier.js";
46
+ import "./verify/index.js";
47
+ import { DiscoveryOptions, ImplementationSource, ImplementationStatus, ResolvedImplementation, SpecImplementationResult, SpecReferenceMatch } from "./implementation/types.js";
48
+ import { discoverAllImplementations, discoverImplementationsForSpec, extractSpecReferences, inferImplementationType } from "./implementation/discovery.js";
49
+ import { ResolverOptions, getImplementationSummary, resolveAllImplementations, resolveImplementations } from "./implementation/resolver.js";
50
+ import "./implementation/index.js";
51
+ import { CacheEntryMeta, CacheKeyString, CacheLookupResult, CacheMissReason, CacheStats, CacheStorageAdapter, DEFAULT_CACHE_CONFIG, VerificationCacheConfig, VerificationCacheEntry, VerificationCacheKey } from "./verification-cache/types.js";
52
+ import { VerificationCacheService, cacheKeyToString, computeContentHash, createVerificationCacheService, stringToCacheKey } from "./verification-cache/cache-service.js";
53
+ import { InMemoryCacheStorage, createInMemoryCacheStorage } from "./verification-cache/adapters/in-memory.js";
54
+ import { FileSystemCacheStorage, createFileSystemCacheStorage } from "./verification-cache/adapters/filesystem.js";
55
+ import { KeyValueStore, WorkspaceStateCacheStorage, createWorkspaceStateCacheStorage } from "./verification-cache/adapters/workspace-state.js";
56
+ import "./verification-cache/index.js";
@@ -1 +1 @@
1
- import{h as e}from"../modules/contractspec-workspace/dist/analysis/spec-scan.js";import{e as t,t as n}from"../modules/contractspec-workspace/dist/analysis/feature-scan.js";function r(e,t){return`${e}.v${t}`}function i(){return{operations:new Map,events:new Map,presentations:new Map,capabilities:new Map,workflows:new Map,dataViews:new Map,forms:new Map,migrations:new Map,experiments:new Map,integrations:new Map,knowledge:new Map,telemetry:new Map,appConfigs:new Map,policies:new Map,testSpecs:new Map}}function a(e,t){return{operation:e.operations,event:e.events,presentation:e.presentations,capability:e.capabilities,workflow:e.workflows,"data-view":e.dataViews,form:e.forms,migration:e.migrations,experiment:e.experiments,integration:e.integrations,knowledge:e.knowledge,telemetry:e.telemetry,"app-config":e.appConfigs,policy:e.policies,"test-spec":e.testSpecs}[t]}async function o(o,s={}){let{fs:c,logger:l}=o;l.info(`Starting integrity analysis...`,{options:s});let u=await c.glob({pattern:s.pattern}),d=i(),f=[],p=[];for(let i of u){let o=await c.readFile(i);if(t(i)){let e=n(o,i);f.push(e)}else{let t=e(o,i);for(let e of t)if(e.specType!==`unknown`&&e.specType!==`feature`){let t=a(d,e.specType);if(t&&e.name&&e.version!==void 0){let n=r(e.name,e.version);t.set(n,{name:e.name,version:e.version,file:e.filePath,type:e.specType,stability:e.stability})}}}}let m=s.featureKey?f.filter(e=>e.key===s.featureKey):f,h=new Set;for(let e of m){for(let t of e.operations){let n=r(t.name,t.version);h.add(`operation:${n}`),d.operations.has(n)||p.push({severity:`error`,type:`unresolved-ref`,message:`Operation ${t.name}.v${t.version} not found`,file:e.filePath,featureKey:e.key,specType:`operation`,ref:t})}for(let t of e.events){let n=r(t.name,t.version);h.add(`event:${n}`),d.events.has(n)||p.push({severity:`error`,type:`unresolved-ref`,message:`Event ${t.name}.v${t.version} not found`,file:e.filePath,featureKey:e.key,specType:`event`,ref:t})}for(let t of e.presentations){let n=r(t.name,t.version);h.add(`presentation:${n}`),d.presentations.has(n)||p.push({severity:`error`,type:`unresolved-ref`,message:`Presentation ${t.name}.v${t.version} not found`,file:e.filePath,featureKey:e.key,specType:`presentation`,ref:t})}for(let t of e.experiments){let n=r(t.name,t.version);h.add(`experiment:${n}`),d.experiments.has(n)||p.push({severity:`error`,type:`unresolved-ref`,message:`Experiment ${t.name}.v${t.version} not found`,file:e.filePath,featureKey:e.key,specType:`experiment`,ref:t})}for(let t of e.capabilities.provides){let n=r(t.name,t.version);h.add(`capability:${n}`),d.capabilities.has(n)||p.push({severity:`warning`,type:`unresolved-ref`,message:`Provided capability ${t.name}.v${t.version} not found`,file:e.filePath,featureKey:e.key,specType:`capability`,ref:t})}for(let t of e.capabilities.requires){let e=r(t.name,t.version);h.add(`capability:${e}`)}for(let t of e.opToPresentationLinks){let n=r(t.op.name,t.op.version),i=r(t.pres.name,t.pres.version);d.operations.has(n)||p.push({severity:`error`,type:`broken-link`,message:`Linked operation ${t.op.name}.v${t.op.version} not found`,file:e.filePath,featureKey:e.key,specType:`operation`,ref:t.op}),d.presentations.has(i)||p.push({severity:`error`,type:`broken-link`,message:`Linked presentation ${t.pres.name}.v${t.pres.version} not found`,file:e.filePath,featureKey:e.key,specType:`presentation`,ref:t.pres})}}let g=[],_=[`operation`,`event`,`presentation`,`experiment`];for(let e of _){let t=a(d,e);if(t)for(let[n,r]of t)h.has(`${e}:${n}`)||(g.push(r),p.push({severity:`warning`,type:`orphaned`,message:`${e} ${r.name}.v${r.version} is not linked to any feature`,file:r.file,specName:r.name,specType:r.type}))}let v={};for(let e of _){let t=a(d,e);if(!t)continue;let n=t.size,r=0;for(let n of t.keys())h.has(`${e}:${n}`)&&r++;v[e]={total:n,covered:r,orphaned:n-r}}let y=Object.values(v).reduce((e,t)=>e+t.total,0),b=Object.values(v).reduce((e,t)=>e+t.covered,0),x={total:y,linkedToFeature:b,orphaned:y-b,byType:v},S=!p.some(e=>e.severity===`error`);return l.info(`Integrity analysis complete`,{features:f.length,totalSpecs:y,orphaned:g.length,issues:p.length,healthy:S}),{inventory:d,features:m,coverage:x,issues:p,orphanedSpecs:g,healthy:S}}function s(e){let t=[];for(let n of Object.values(e))for(let e of n.values())t.push(e);return t}function c(e,t){return e.filter(e=>e.type===t)}function l(e,t){return e.filter(e=>e.severity===t)}export{o as analyzeIntegrity,l as filterIssuesBySeverity,c as filterIssuesByType,s as getAllSpecs};
1
+ import{isFeatureFile as e,scanAllSpecsFromSource as t,scanFeatureSource as n}from"@lssm/module.contractspec-workspace";function r(e,t){return`${e}.v${t}`}function i(){return{operations:new Map,events:new Map,presentations:new Map,capabilities:new Map,workflows:new Map,dataViews:new Map,forms:new Map,migrations:new Map,experiments:new Map,integrations:new Map,knowledge:new Map,telemetry:new Map,appConfigs:new Map,policies:new Map,testSpecs:new Map}}function a(e,t){return{operation:e.operations,event:e.events,presentation:e.presentations,capability:e.capabilities,workflow:e.workflows,"data-view":e.dataViews,form:e.forms,migration:e.migrations,experiment:e.experiments,integration:e.integrations,knowledge:e.knowledge,telemetry:e.telemetry,"app-config":e.appConfigs,policy:e.policies,"test-spec":e.testSpecs}[t]}async function o(o,s={}){let{fs:c,logger:l}=o;l.info(`Starting integrity analysis...`,{options:s});let u=await c.glob({pattern:s.pattern}),d=i(),f=[],p=[];for(let i of u){let o=await c.readFile(i);if(e(i)){let e=n(o,i);f.push(e)}else{let e=t(o,i);for(let t of e)if(t.specType!==`unknown`&&t.specType!==`feature`){let e=a(d,t.specType);if(e&&t.name&&t.version!==void 0){let n=r(t.name,t.version);e.set(n,{name:t.name,version:t.version,file:t.filePath,type:t.specType,stability:t.stability})}}}}let m=s.featureKey?f.filter(e=>e.key===s.featureKey):f,h=new Set;for(let e of m){for(let t of e.operations){let n=r(t.name,t.version);h.add(`operation:${n}`),d.operations.has(n)||p.push({severity:`error`,type:`unresolved-ref`,message:`Operation ${t.name}.v${t.version} not found`,file:e.filePath,featureKey:e.key,specType:`operation`,ref:t})}for(let t of e.events){let n=r(t.name,t.version);h.add(`event:${n}`),d.events.has(n)||p.push({severity:`error`,type:`unresolved-ref`,message:`Event ${t.name}.v${t.version} not found`,file:e.filePath,featureKey:e.key,specType:`event`,ref:t})}for(let t of e.presentations){let n=r(t.name,t.version);h.add(`presentation:${n}`),d.presentations.has(n)||p.push({severity:`error`,type:`unresolved-ref`,message:`Presentation ${t.name}.v${t.version} not found`,file:e.filePath,featureKey:e.key,specType:`presentation`,ref:t})}for(let t of e.experiments){let n=r(t.name,t.version);h.add(`experiment:${n}`),d.experiments.has(n)||p.push({severity:`error`,type:`unresolved-ref`,message:`Experiment ${t.name}.v${t.version} not found`,file:e.filePath,featureKey:e.key,specType:`experiment`,ref:t})}for(let t of e.capabilities.provides){let n=r(t.name,t.version);h.add(`capability:${n}`),d.capabilities.has(n)||p.push({severity:`warning`,type:`unresolved-ref`,message:`Provided capability ${t.name}.v${t.version} not found`,file:e.filePath,featureKey:e.key,specType:`capability`,ref:t})}for(let t of e.capabilities.requires){let e=r(t.name,t.version);h.add(`capability:${e}`)}for(let t of e.opToPresentationLinks){let n=r(t.op.name,t.op.version),i=r(t.pres.name,t.pres.version);d.operations.has(n)||p.push({severity:`error`,type:`broken-link`,message:`Linked operation ${t.op.name}.v${t.op.version} not found`,file:e.filePath,featureKey:e.key,specType:`operation`,ref:t.op}),d.presentations.has(i)||p.push({severity:`error`,type:`broken-link`,message:`Linked presentation ${t.pres.name}.v${t.pres.version} not found`,file:e.filePath,featureKey:e.key,specType:`presentation`,ref:t.pres})}}let g=[],_=[`operation`,`event`,`presentation`,`experiment`];for(let e of _){let t=a(d,e);if(t)for(let[n,r]of t)h.has(`${e}:${n}`)||(g.push(r),p.push({severity:`warning`,type:`orphaned`,message:`${e} ${r.name}.v${r.version} is not linked to any feature`,file:r.file,specName:r.name,specType:r.type}))}let v={};for(let e of _){let t=a(d,e);if(!t)continue;let n=t.size,r=0;for(let n of t.keys())h.has(`${e}:${n}`)&&r++;v[e]={total:n,covered:r,orphaned:n-r}}let y=Object.values(v).reduce((e,t)=>e+t.total,0),b=Object.values(v).reduce((e,t)=>e+t.covered,0),x={total:y,linkedToFeature:b,orphaned:y-b,byType:v},S=!p.some(e=>e.severity===`error`);return l.info(`Integrity analysis complete`,{features:f.length,totalSpecs:y,orphaned:g.length,issues:p.length,healthy:S}),{inventory:d,features:m,coverage:x,issues:p,orphanedSpecs:g,healthy:S}}function s(e){let t=[];for(let n of Object.values(e))for(let e of n.values())t.push(e);return t}function c(e,t){return e.filter(e=>e.type===t)}function l(e,t){return e.filter(e=>e.severity===t)}export{o as analyzeIntegrity,l as filterIssuesBySeverity,c as filterIssuesByType,s as getAllSpecs};
@@ -1 +1 @@
1
- import{t as e}from"../modules/contractspec-workspace/dist/analysis/spec-scan.js";async function t(t,n={}){let{fs:r}=t,i=await r.glob({pattern:n.pattern}),a=[];for(let t of i){let i=e(await r.readFile(t),t);n.type&&i.specType!==n.type||a.push(i)}return a}function n(e){let t=new Map;for(let n of e){let e=t.get(n.specType)??[];e.push(n),t.set(n.specType,e)}return t}export{n as groupSpecsByType,t as listSpecs};
1
+ import{scanSpecSource as e}from"@lssm/module.contractspec-workspace";async function t(t,n={}){let{fs:r}=t,i=await r.glob({pattern:n.pattern}),a=[];for(let t of i){let i=e(await r.readFile(t),t);n.type&&i.specType!==n.type||a.push(i)}return a}function n(e){let t=new Map;for(let n of e){let e=t.get(n.specType)??[];e.push(n),t.set(n.specType,e)}return t}export{n as groupSpecsByType,t as listSpecs};
@@ -1,2 +1,2 @@
1
- import{o as e}from"../../libs/contracts/dist/registry.js";import{o as t}from"../../libs/contracts/dist/openapi.js";import"../../libs/contracts/dist/index.js";async function n(e,n){let{fs:i,logger:a}=n,{registryPath:o,outputPath:s=`./openapi.json`}=e;a.info(`Loading registry...`,{registryPath:o});let c=await r(o,i);a.info(`Generating OpenAPI document...`);let l=t(c,{title:e.title,version:e.version,description:e.description,servers:e.servers}),u=JSON.stringify(l,null,2)+`
1
+ import{SpecRegistry as e,openApiForRegistry as t}from"@lssm/lib.contracts";async function n(e,n){let{fs:i,logger:a}=n,{registryPath:o,outputPath:s=`./openapi.json`}=e;a.info(`Loading registry...`,{registryPath:o});let c=await r(o,i);a.info(`Generating OpenAPI document...`);let l=t(c,{title:e.title,version:e.version,description:e.description,servers:e.servers}),u=JSON.stringify(l,null,2)+`
2
2
  `,d=i.resolve(s);return await i.mkdir(i.dirname(d)),await i.writeFile(d,u),a.info(`OpenAPI document written to ${d}`),{document:l,outputPath:d,json:u}}async function r(t,n){let r=await import(n.resolve(t));if(r instanceof e)return r;if(r.registry instanceof e)return r.registry;let i=typeof r.createRegistry==`function`?r.createRegistry:typeof r.default==`function`?r.default:void 0;if(i){let t=await i();if(t instanceof e)return t}throw Error(`Registry module ${t} must export a SpecRegistry instance or a factory function returning one.`)}export{n as exportOpenApi};
@@ -1 +1 @@
1
- import{f as e}from"../../libs/contracts-transformers/dist/openapi/parser.js";import{f as t}from"../../libs/contracts-transformers/dist/openapi/importer.js";import"../../libs/contracts-transformers/dist/openapi/index.js";import{dirname as n,join as r}from"path";async function i(i,a){let{fs:o,logger:s}=a,{source:c,outputDir:l,prefix:u,tags:d,exclude:f,defaultStability:p,defaultOwners:m,defaultAuth:h,dryRun:g=!1}=i;s.info(`Importing from OpenAPI: ${c}`);let _=await e(c,{fetch:globalThis.fetch,readFile:e=>o.readFile(e)});if(_.warnings.length>0)for(let e of _.warnings)s.warn(`Parse warning: ${e}`);s.info(`Parsed ${_.operations.length} operations from ${_.info.title} v${_.info.version}`);let v=t(_,{prefix:u,tags:d,exclude:f,defaultStability:p,defaultOwners:m,defaultAuth:h});s.info(`Import result: ${v.summary.imported} imported, ${v.summary.skipped} skipped, ${v.summary.errors} errors`);let y=[],b=[],x=[];for(let e of v.specs){let t=r(l,e.fileName);if(g)s.info(`[DRY RUN] Would create: ${t}`);else{let r=n(t);await o.mkdir(r),await o.writeFile(t,e.code),s.info(`Created: ${t}`)}y.push({path:t,operationId:e.source.sourceId,specName:e.fileName.replace(`.ts`,``)})}for(let e of v.skipped)b.push({operationId:e.sourceId,reason:e.reason}),s.debug(`Skipped: ${e.sourceId} - ${e.reason}`);for(let e of v.errors)x.push({operationId:e.sourceId,error:e.error}),s.error(`Error: ${e.sourceId} - ${e.error}`);return{imported:v.summary.imported,skipped:v.summary.skipped,errors:v.summary.errors,files:y,skippedOperations:b,errorMessages:x}}export{i as importFromOpenApiService};
1
+ import{importFromOpenApi as e,parseOpenApi as t}from"@lssm/lib.contracts-transformers/openapi";import{dirname as n,join as r}from"path";async function i(i,a){let{fs:o,logger:s}=a,{source:c,outputDir:l,prefix:u,tags:d,exclude:f,defaultStability:p,defaultOwners:m,defaultAuth:h,dryRun:g=!1}=i;s.info(`Importing from OpenAPI: ${c}`);let _=await t(c,{fetch:globalThis.fetch,readFile:e=>o.readFile(e)});if(_.warnings.length>0)for(let e of _.warnings)s.warn(`Parse warning: ${e}`);s.info(`Parsed ${_.operations.length} operations from ${_.info.title} v${_.info.version}`);let v=e(_,{prefix:u,tags:d,exclude:f,defaultStability:p,defaultOwners:m,defaultAuth:h});s.info(`Import result: ${v.summary.imported} imported, ${v.summary.skipped} skipped, ${v.summary.errors} errors`);let y=[],b=[],x=[];for(let e of v.specs){let t=r(l,e.fileName);if(g)s.info(`[DRY RUN] Would create: ${t}`);else{let r=n(t);await o.mkdir(r),await o.writeFile(t,e.code),s.info(`Created: ${t}`)}y.push({path:t,operationId:e.source.sourceId,specName:e.fileName.replace(`.ts`,``)})}for(let e of v.skipped)b.push({operationId:e.sourceId,reason:e.reason}),s.debug(`Skipped: ${e.sourceId} - ${e.reason}`);for(let e of v.errors)x.push({operationId:e.sourceId,error:e.error}),s.error(`Error: ${e.sourceId} - ${e.error}`);return{imported:v.summary.imported,skipped:v.summary.skipped,errors:v.summary.errors,files:y,skippedOperations:b,errorMessages:x}}export{i as importFromOpenApiService};
@@ -0,0 +1,5 @@
1
+ import { OpenApiExportServiceOptions, OpenApiExportServiceResult, OpenApiImportServiceOptions, OpenApiImportServiceResult, OpenApiSourceConfig, OpenApiSyncServiceOptions, OpenApiSyncServiceResult, OpenApiValidateServiceOptions, OpenApiValidateServiceResult } from "./types.js";
2
+ import { importFromOpenApiService } from "./import-service.js";
3
+ import { syncWithOpenApiService } from "./sync-service.js";
4
+ import { validateAgainstOpenApiService } from "./validate-service.js";
5
+ import { OpenApiExportOptions, OpenApiExportResult, exportOpenApi } from "./export-service.js";
@@ -1 +1 @@
1
- import{f as e}from"../../libs/contracts-transformers/dist/openapi/parser.js";import{f as t}from"../../libs/contracts-transformers/dist/openapi/importer.js";import"../../libs/contracts-transformers/dist/openapi/index.js";import{dirname as n,join as r}from"path";async function i(i,a,o){let{fs:s,logger:c}=o,{sources:l,sourceName:u,interactive:d,force:f,dryRun:p}=i,{sources:m,outputDir:h}=a,g=l??m??[];if(u&&(g=g.filter(e=>e.name===u),g.length===0))throw Error(`Source not found: ${u}`);if(g.length===0)return c.warn(`No OpenAPI sources configured. Add sources to .contractsrc.json`),{added:0,updated:0,unchanged:0,conflicts:0,changes:[]};let _={added:0,updated:0,unchanged:0,conflicts:0,changes:[]};for(let i of g){c.info(`Syncing with source: ${i.name}`);let a=i.url??i.file;if(!a){c.warn(`Source ${i.name} has no url or file configured`);continue}let o=await e(a,{fetch:globalThis.fetch,readFile:e=>s.readFile(e)});c.info(`Parsed ${o.operations.length} operations from ${i.name}`);let l=t(o,{prefix:i.prefix,tags:i.tags,exclude:i.exclude,defaultStability:i.defaultStability,defaultAuth:i.defaultAuth});for(let e of l.specs){let t=r(h,e.fileName);if(await s.exists(t))await s.readFile(t)===e.code?(_.unchanged++,_.changes.push({operationId:e.source.sourceId,action:`unchanged`,path:t})):f===`openapi`?(p||await s.writeFile(t,e.code),_.updated++,_.changes.push({operationId:e.source.sourceId,action:`updated`,path:t}),c.info(`Updated: ${e.source.sourceId}`)):f===`contractspec`?(_.unchanged++,_.changes.push({operationId:e.source.sourceId,action:`unchanged`,path:t}),c.info(`Kept: ${e.source.sourceId}`)):d?(_.conflicts++,_.changes.push({operationId:e.source.sourceId,action:`conflict`,path:t}),c.warn(`Conflict: ${e.source.sourceId} - needs resolution`)):(_.conflicts++,_.changes.push({operationId:e.source.sourceId,action:`conflict`,path:t}),c.warn(`Conflict: ${e.source.sourceId}`));else{if(!p){let r=n(t);await s.mkdir(r),await s.writeFile(t,e.code)}_.added++,_.changes.push({operationId:e.source.sourceId,action:`added`,path:t}),c.info(`Added: ${e.source.sourceId}`)}}}return c.info(`Sync complete: ${_.added} added, ${_.updated} updated, ${_.unchanged} unchanged, ${_.conflicts} conflicts`),_}export{i as syncWithOpenApiService};
1
+ import{importFromOpenApi as e,parseOpenApi as t}from"@lssm/lib.contracts-transformers/openapi";import{dirname as n,join as r}from"path";async function i(i,a,o){let{fs:s,logger:c}=o,{sources:l,sourceName:u,interactive:d,force:f,dryRun:p}=i,{sources:m,outputDir:h}=a,g=l??m??[];if(u&&(g=g.filter(e=>e.name===u),g.length===0))throw Error(`Source not found: ${u}`);if(g.length===0)return c.warn(`No OpenAPI sources configured. Add sources to .contractsrc.json`),{added:0,updated:0,unchanged:0,conflicts:0,changes:[]};let _={added:0,updated:0,unchanged:0,conflicts:0,changes:[]};for(let i of g){c.info(`Syncing with source: ${i.name}`);let a=i.url??i.file;if(!a){c.warn(`Source ${i.name} has no url or file configured`);continue}let o=await t(a,{fetch:globalThis.fetch,readFile:e=>s.readFile(e)});c.info(`Parsed ${o.operations.length} operations from ${i.name}`);let l=e(o,{prefix:i.prefix,tags:i.tags,exclude:i.exclude,defaultStability:i.defaultStability,defaultAuth:i.defaultAuth});for(let e of l.specs){let t=r(h,e.fileName);if(await s.exists(t))await s.readFile(t)===e.code?(_.unchanged++,_.changes.push({operationId:e.source.sourceId,action:`unchanged`,path:t})):f===`openapi`?(p||await s.writeFile(t,e.code),_.updated++,_.changes.push({operationId:e.source.sourceId,action:`updated`,path:t}),c.info(`Updated: ${e.source.sourceId}`)):f===`contractspec`?(_.unchanged++,_.changes.push({operationId:e.source.sourceId,action:`unchanged`,path:t}),c.info(`Kept: ${e.source.sourceId}`)):d?(_.conflicts++,_.changes.push({operationId:e.source.sourceId,action:`conflict`,path:t}),c.warn(`Conflict: ${e.source.sourceId} - needs resolution`)):(_.conflicts++,_.changes.push({operationId:e.source.sourceId,action:`conflict`,path:t}),c.warn(`Conflict: ${e.source.sourceId}`));else{if(!p){let r=n(t);await s.mkdir(r),await s.writeFile(t,e.code)}_.added++,_.changes.push({operationId:e.source.sourceId,action:`added`,path:t}),c.info(`Added: ${e.source.sourceId}`)}}}return c.info(`Sync complete: ${_.added} added, ${_.updated} updated, ${_.unchanged} unchanged, ${_.conflicts} conflicts`),_}export{i as syncWithOpenApiService};
@@ -1 +1 @@
1
- import{f as e}from"../../libs/contracts-transformers/dist/openapi/parser.js";import"../../libs/contracts-transformers/dist/openapi/index.js";async function t(t,n){let{fs:r,logger:i}=n,{specPath:a,openApiSource:o,ignoreDescriptions:s,ignoreTags:c,ignoreTransport:l}=t;i.info(`Validating specs against OpenAPI: ${o}`);let u=await e(o,{fetch:globalThis.fetch,readFile:e=>r.readFile(e)});i.info(`Parsed ${u.operations.length} operations from ${u.info.title}`);let d=new Map;for(let e of u.operations)d.set(e.operationId,e);let f=[],p=0,m=0,h=await r.stat(a),g=[];if(h.isDirectory){let e=await r.glob({pattern:`**/*.ts`,cwd:a,ignore:[`node_modules/**`,`dist/**`,`*.test.ts`,`*.spec.ts`],absolute:!0});g.push(...e)}else g.push(a);i.info(`Found ${g.length} spec files to validate`);for(let e of g)try{let t=await r.readFile(e),n=t.match(/operationId:\s*['"]([^'"]+)['"]/)||t.match(/name:\s*['"]([^'"]+)['"]/)||t.match(/export\s+const\s+(\w+)Spec\s*=/);if(!n||!n[1]){i.debug(`Could not extract operationId from ${e}`);continue}let a=n[1];p++;let o;if(o=d.get(a),!o){let e=a.replace(/([A-Z])/g,`_$1`).toLowerCase();o=d.get(e)}if(!o){for(let[e,t]of d)if(e.toLowerCase().includes(a.toLowerCase())||a.toLowerCase().includes(e.toLowerCase())){o=t;break}}if(!o){f.push({specPath:e,valid:!1,diffs:[{path:``,type:`removed`,description:`No matching operation found in OpenAPI for spec: ${a}`}]}),m++;continue}let s=[];if(o.deprecated&&!t.includes(`deprecated`)&&s.push({path:`meta.stability`,type:`modified`,description:`OpenAPI operation is deprecated but spec does not indicate deprecation`}),!l){let e=t.match(/path:\s*['"]([^'"]+)['"]/);e&&e[1]!==o.path&&s.push({path:`transport.rest.path`,type:`modified`,description:`Path mismatch: spec has "${e[1]}", OpenAPI has "${o.path}"`})}if(!l){let e=t.match(/method:\s*['"]([^'"]+)['"]/);e?.[1]&&e[1].toLowerCase()!==o.method.toLowerCase()&&s.push({path:`transport.rest.method`,type:`modified`,description:`Method mismatch: spec has "${e[1]}", OpenAPI has "${o.method.toUpperCase()}"`})}let c=s.length===0;c||m++,f.push({specPath:e,operationId:o.operationId,valid:c,diffs:s})}catch(t){i.error(`Error validating ${e}: ${t}`),f.push({specPath:e,valid:!1,diffs:[{path:``,type:`modified`,description:`Error: ${t instanceof Error?t.message:String(t)}`}]}),m++}let _=m===0;return i.info(`Validation ${_?`passed`:`failed`}: ${p} specs checked, ${m} with differences`),{valid:_,specsValidated:p,specsWithDiffs:m,results:f}}export{t as validateAgainstOpenApiService};
1
+ import{parseOpenApi as e}from"@lssm/lib.contracts-transformers/openapi";async function t(t,n){let{fs:r,logger:i}=n,{specPath:a,openApiSource:o,ignoreDescriptions:s,ignoreTags:c,ignoreTransport:l}=t;i.info(`Validating specs against OpenAPI: ${o}`);let u=await e(o,{fetch:globalThis.fetch,readFile:e=>r.readFile(e)});i.info(`Parsed ${u.operations.length} operations from ${u.info.title}`);let d=new Map;for(let e of u.operations)d.set(e.operationId,e);let f=[],p=0,m=0,h=await r.stat(a),g=[];if(h.isDirectory){let e=await r.glob({pattern:`**/*.ts`,cwd:a,ignore:[`node_modules/**`,`dist/**`,`*.test.ts`,`*.spec.ts`],absolute:!0});g.push(...e)}else g.push(a);i.info(`Found ${g.length} spec files to validate`);for(let e of g)try{let t=await r.readFile(e),n=t.match(/operationId:\s*['"]([^'"]+)['"]/)||t.match(/name:\s*['"]([^'"]+)['"]/)||t.match(/export\s+const\s+(\w+)Spec\s*=/);if(!n||!n[1]){i.debug(`Could not extract operationId from ${e}`);continue}let a=n[1];p++;let o;if(o=d.get(a),!o){let e=a.replace(/([A-Z])/g,`_$1`).toLowerCase();o=d.get(e)}if(!o){for(let[e,t]of d)if(e.toLowerCase().includes(a.toLowerCase())||a.toLowerCase().includes(e.toLowerCase())){o=t;break}}if(!o){f.push({specPath:e,valid:!1,diffs:[{path:``,type:`removed`,description:`No matching operation found in OpenAPI for spec: ${a}`}]}),m++;continue}let s=[];if(o.deprecated&&!t.includes(`deprecated`)&&s.push({path:`meta.stability`,type:`modified`,description:`OpenAPI operation is deprecated but spec does not indicate deprecation`}),!l){let e=t.match(/path:\s*['"]([^'"]+)['"]/);e&&e[1]!==o.path&&s.push({path:`transport.rest.path`,type:`modified`,description:`Path mismatch: spec has "${e[1]}", OpenAPI has "${o.path}"`})}if(!l){let e=t.match(/method:\s*['"]([^'"]+)['"]/);e?.[1]&&e[1].toLowerCase()!==o.method.toLowerCase()&&s.push({path:`transport.rest.method`,type:`modified`,description:`Method mismatch: spec has "${e[1]}", OpenAPI has "${o.method.toUpperCase()}"`})}let c=s.length===0;c||m++,f.push({specPath:e,operationId:o.operationId,valid:c,diffs:s})}catch(t){i.error(`Error validating ${e}: ${t}`),f.push({specPath:e,valid:!1,diffs:[{path:``,type:`modified`,description:`Error: ${t instanceof Error?t.message:String(t)}`}]}),m++}let _=m===0;return i.info(`Validation ${_?`passed`:`failed`}: ${p} specs checked, ${m} with differences`),{valid:_,specsValidated:p,specsWithDiffs:m,results:f}}export{t as validateAgainstOpenApiService};
@@ -1 +1 @@
1
- import{i as e}from"../libs/contracts/dist/regenerator/service.js";import"../libs/contracts/dist/regenerator/index.js";function t(t){return new e({contexts:t.contexts,adapters:t.adapters??{},rules:t.rules,sink:t.sink,pollIntervalMs:t.pollIntervalMs,batchDurationMs:t.batchDurationMs})}export{t as createRegeneratorService};
1
+ import{RegeneratorService as e}from"@lssm/lib.contracts/regenerator";function t(t){return new e({contexts:t.contexts,adapters:t.adapters??{},rules:t.rules,sink:t.sink,pollIntervalMs:t.pollIntervalMs,batchDurationMs:t.batchDurationMs})}export{t as createRegeneratorService};
@@ -1 +1 @@
1
- import{t as e}from"../libs/contracts/dist/tests/runner.js";import"../libs/contracts/dist/tests/index.js";async function t(t,n){let r=new e({registry:n}),i=[],a=0,o=0;for(let e of t){let t=await r.run(e);i.push(t),a+=t.passed,o+=t.failed}return{results:i,passed:a,failed:o}}export{t as runTests};
1
+ import{TestRunner as e}from"@lssm/lib.contracts/tests";async function t(t,n){let r=new e({registry:n}),i=[],a=0,o=0;for(let e of t){let t=await r.run(e);i.push(t),a+=t.passed,o+=t.failed}return{results:i,passed:a,failed:o}}export{t as runTests};
@@ -1 +1 @@
1
- import{t as e}from"../modules/contractspec-workspace/dist/analysis/spec-scan.js";function t(e){return e.replace(/\./g,`-`).replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}function n(e){return e.split(/[-_.]/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}async function r(r,i,a,o={}){let{fs:s}=i,c=[],l=[];if(!await s.exists(r))return{valid:!1,errors:[`Spec file not found: ${r}`],warnings:[],expected:{}};let u=e(await s.readFile(r),r),d=u.name??s.basename(r).replace(/\.[jt]s$/,``),f=o.outputDir??a.outputDir??`./src`,p=t(d),m={};if(u.specType===`operation`&&(m.handlerPath=s.join(f,`handlers`,`${p}.handler.ts`),m.handlerTestPath=s.join(f,`handlers`,`${p}.handler.test.ts`)),u.specType===`presentation`&&(m.componentPath=s.join(f,`components`,`${p}.tsx`),m.componentTestPath=s.join(f,`components`,`${p}.test.tsx`)),u.specType===`form`&&(m.formPath=s.join(f,`forms`,`${p}.form.tsx`),m.formTestPath=s.join(f,`forms`,`${p}.form.test.tsx`)),o.checkHandlers&&m.handlerPath)if(!await s.exists(m.handlerPath))c.push(`Missing handler file: ${m.handlerPath}`);else{let e=await s.readFile(m.handlerPath),t=`${n(d.split(`.`).pop()??d)}Spec`,r=/ContractHandler<\s*typeof\s+\w+\s*>/.test(e),i=RegExp(`typeof\\s+${t}\\b`).test(e);r?i||l.push(`Handler ContractHandler typing does not reference expected spec var (${t}): ${m.handlerPath}`):l.push(`Handler does not appear to type itself as ContractHandler<typeof Spec>: ${m.handlerPath}`)}if(o.checkTests){let e=[m.handlerTestPath,m.componentTestPath,m.formTestPath].filter(e=>typeof e==`string`);for(let t of e)await s.exists(t)||c.push(`Missing test file: ${t}`)}return{valid:c.length===0,errors:c,warnings:l,expected:m}}export{r as validateImplementationFiles};
1
+ import{scanSpecSource as e}from"@lssm/module.contractspec-workspace";function t(e){return e.replace(/\./g,`-`).replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}function n(e){return e.split(/[-_.]/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}async function r(r,i,a,o={}){let{fs:s}=i,c=[],l=[];if(!await s.exists(r))return{valid:!1,errors:[`Spec file not found: ${r}`],warnings:[],expected:{}};let u=e(await s.readFile(r),r),d=u.name??s.basename(r).replace(/\.[jt]s$/,``),f=o.outputDir??a.outputDir??`./src`,p=t(d),m={};if(u.specType===`operation`&&(m.handlerPath=s.join(f,`handlers`,`${p}.handler.ts`),m.handlerTestPath=s.join(f,`handlers`,`${p}.handler.test.ts`)),u.specType===`presentation`&&(m.componentPath=s.join(f,`components`,`${p}.tsx`),m.componentTestPath=s.join(f,`components`,`${p}.test.tsx`)),u.specType===`form`&&(m.formPath=s.join(f,`forms`,`${p}.form.tsx`),m.formTestPath=s.join(f,`forms`,`${p}.form.test.tsx`)),o.checkHandlers&&m.handlerPath)if(!await s.exists(m.handlerPath))c.push(`Missing handler file: ${m.handlerPath}`);else{let e=await s.readFile(m.handlerPath),t=`${n(d.split(`.`).pop()??d)}Spec`,r=/ContractHandler<\s*typeof\s+\w+\s*>/.test(e),i=RegExp(`typeof\\s+${t}\\b`).test(e);r?i||l.push(`Handler ContractHandler typing does not reference expected spec var (${t}): ${m.handlerPath}`):l.push(`Handler does not appear to type itself as ContractHandler<typeof Spec>: ${m.handlerPath}`)}if(o.checkTests){let e=[m.handlerTestPath,m.componentTestPath,m.formTestPath].filter(e=>typeof e==`string`);for(let t of e)await s.exists(t)||c.push(`Missing test file: ${t}`)}return{valid:c.length===0,errors:c,warnings:l,expected:m}}export{r as validateImplementationFiles};
@@ -1 +1 @@
1
- import{e}from"../modules/contractspec-workspace/dist/analysis/validate/spec-structure.js";async function t(t,n,r={}){let{fs:i}=n;if(!await i.exists(t))return{valid:!1,errors:[`Spec file not found: ${t}`],warnings:[]};let a=await i.readFile(t),o=i.basename(t),s=[],c=[],l;return r.skipStructure||(l=e(a,o),s.push(...l.errors),c.push(...l.warnings)),{valid:s.length===0,structureResult:l,errors:s,warnings:c}}async function n(e,n,r={}){let i=new Map;for(let a of e){let e=await t(a,n,r);i.set(a,e)}return i}export{t as validateSpec,n as validateSpecs};
1
+ import{validateSpecStructure as e}from"@lssm/module.contractspec-workspace";async function t(t,n,r={}){let{fs:i}=n;if(!await i.exists(t))return{valid:!1,errors:[`Spec file not found: ${t}`],warnings:[]};let a=await i.readFile(t),o=i.basename(t),s=[],c=[],l;return r.skipStructure||(l=e(a,o),s.push(...l.errors),c.push(...l.warnings)),{valid:s.length===0,structureResult:l,errors:s,warnings:c}}async function n(e,n,r={}){let i=new Map;for(let a of e){let e=await t(a,n,r);i.set(a,e)}return i}export{t as validateSpec,n as validateSpecs};
@@ -0,0 +1,3 @@
1
+ import { InMemoryCacheStorage, createInMemoryCacheStorage } from "./in-memory.js";
2
+ import { FileSystemCacheStorage, createFileSystemCacheStorage } from "./filesystem.js";
3
+ import { KeyValueStore, WorkspaceStateCacheStorage, createWorkspaceStateCacheStorage } from "./workspace-state.js";
@@ -0,0 +1,6 @@
1
+ import { CacheEntryMeta, CacheKeyString, CacheLookupResult, CacheMissReason, CacheStats, CacheStorageAdapter, DEFAULT_CACHE_CONFIG, VerificationCacheConfig, VerificationCacheEntry, VerificationCacheKey } from "./types.js";
2
+ import { VerificationCacheService, cacheKeyToString, computeContentHash, createVerificationCacheService, stringToCacheKey } from "./cache-service.js";
3
+ import { InMemoryCacheStorage, createInMemoryCacheStorage } from "./adapters/in-memory.js";
4
+ import { FileSystemCacheStorage, createFileSystemCacheStorage } from "./adapters/filesystem.js";
5
+ import { KeyValueStore, WorkspaceStateCacheStorage, createWorkspaceStateCacheStorage } from "./adapters/workspace-state.js";
6
+ import "./adapters/index.js";