@lssm/bundle.contractspec-workspace 0.0.0-canary-20251217083314 → 1.41.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/rolldown_runtime.js +1 -22
- package/dist/adapters/ai.js +1 -82
- package/dist/adapters/factory.js +1 -36
- package/dist/adapters/fs.js +1 -118
- package/dist/adapters/git.js +1 -54
- package/dist/adapters/index.js +1 -7
- package/dist/adapters/logger.js +1 -80
- package/dist/adapters/watcher.js +1 -69
- package/dist/adapters/workspace.js +2 -190
- package/dist/ai/agents/claude-code-agent.js +9 -146
- package/dist/ai/agents/cursor-agent.js +17 -286
- package/dist/ai/agents/index.js +1 -5
- package/dist/ai/agents/openai-codex-agent.js +8 -140
- package/dist/ai/agents/orchestrator.js +1 -142
- package/dist/ai/agents/simple-agent.js +4 -80
- package/dist/ai/client.js +1 -162
- package/dist/ai/index.js +1 -27
- package/dist/ai/prompts/code-generation.js +13 -55
- package/dist/ai/prompts/index.js +1 -12
- package/dist/ai/prompts/spec-creation.js +20 -61
- package/dist/ai/providers.js +1 -40
- package/dist/formatters/index.js +1 -18
- package/dist/formatters/json.js +1 -71
- package/dist/formatters/sarif.js +1 -163
- package/dist/formatters/text.js +2 -208
- package/dist/index.js +1 -81
- package/dist/services/agent-guide/adapters/claude-code.js +3 -144
- package/dist/services/agent-guide/adapters/cursor-cli.js +3 -135
- package/dist/services/agent-guide/adapters/generic-mcp.js +3 -159
- package/dist/services/agent-guide/adapters/index.js +1 -30
- package/dist/services/agent-guide/agent-guide-service.js +1 -148
- package/dist/services/agent-guide/index.js +1 -5
- package/dist/services/build.js +1 -140
- package/dist/services/ci-check/ci-check-service.js +1 -393
- package/dist/services/ci-check/index.js +1 -2
- package/dist/services/ci-check/types.js +1 -28
- package/dist/services/clean.js +1 -71
- package/dist/services/config.js +1 -76
- package/dist/services/deps.js +1 -62
- package/dist/services/diff.js +1 -33
- package/dist/services/doctor/checks/ai.js +2 -118
- package/dist/services/doctor/checks/cli.js +1 -146
- package/dist/services/doctor/checks/config.js +1 -170
- package/dist/services/doctor/checks/deps.js +1 -180
- package/dist/services/doctor/checks/index.js +1 -6
- package/dist/services/doctor/checks/mcp.js +1 -144
- package/dist/services/doctor/checks/workspace.js +1 -243
- package/dist/services/doctor/doctor-service.js +2 -115
- package/dist/services/doctor/index.js +1 -2
- package/dist/services/doctor/types.js +1 -26
- package/dist/services/implementation/discovery.js +2 -143
- package/dist/services/implementation/index.js +1 -2
- package/dist/services/implementation/resolver.js +1 -223
- package/dist/services/index.js +1 -53
- package/dist/services/integrity-diagram.js +6 -274
- package/dist/services/integrity.js +1 -272
- package/dist/services/list.js +1 -35
- package/dist/services/openapi/export-service.js +2 -51
- package/dist/services/openapi/import-service.js +1 -75
- package/dist/services/openapi/index.js +1 -4
- package/dist/services/openapi/sync-service.js +1 -121
- package/dist/services/openapi/validate-service.js +1 -130
- package/dist/services/regenerator.js +1 -23
- package/dist/services/registry.js +1 -73
- package/dist/services/setup/config-generators.js +26 -113
- package/dist/services/setup/file-merger.js +2 -60
- package/dist/services/setup/index.js +1 -4
- package/dist/services/setup/setup-service.js +1 -95
- package/dist/services/setup/targets/agents-md.js +1 -46
- package/dist/services/setup/targets/cli-config.js +1 -59
- package/dist/services/setup/targets/cursor-rules.js +1 -47
- package/dist/services/setup/targets/mcp-claude.js +1 -59
- package/dist/services/setup/targets/mcp-cursor.js +1 -58
- package/dist/services/setup/targets/vscode-settings.js +1 -62
- package/dist/services/setup/types.js +1 -26
- package/dist/services/sync.js +1 -62
- package/dist/services/test.js +1 -30
- package/dist/services/validate-implementation.js +1 -69
- package/dist/services/validate.js +1 -47
- package/dist/services/verification-cache/adapters/filesystem.js +1 -121
- package/dist/services/verification-cache/adapters/in-memory.js +1 -45
- package/dist/services/verification-cache/adapters/index.js +1 -3
- package/dist/services/verification-cache/adapters/workspace-state.js +1 -90
- package/dist/services/verification-cache/cache-service.js +1 -255
- package/dist/services/verification-cache/index.js +1 -6
- package/dist/services/verification-cache/types.js +1 -15
- package/dist/services/verify/ai-verifier.js +9 -336
- package/dist/services/verify/behavior-verifier.js +1 -185
- package/dist/services/verify/index.js +1 -4
- package/dist/services/verify/structure-verifier.js +2 -195
- package/dist/services/verify/verify-service.js +3 -203
- package/dist/services/watch.js +1 -31
- package/dist/services/workspace-info.js +2 -102
- package/dist/templates/app-config.template.js +28 -101
- package/dist/templates/data-view.template.js +27 -42
- package/dist/templates/event.template.js +14 -29
- package/dist/templates/experiment.template.js +51 -77
- package/dist/templates/handler.template.js +17 -53
- package/dist/templates/index.js +1 -36
- package/dist/templates/integration.template.js +50 -134
- package/dist/templates/knowledge.template.js +21 -62
- package/dist/templates/migration.template.js +26 -50
- package/dist/templates/operation.template.js +28 -44
- package/dist/templates/presentation.template.js +20 -46
- package/dist/templates/telemetry.template.js +53 -74
- package/dist/templates/workflow-runner.template.js +6 -12
- package/dist/templates/workflow.template.js +24 -51
- package/package.json +10 -15
- package/dist/adapters/ai.d.ts +0 -11
- package/dist/adapters/factory.d.ts +0 -28
- package/dist/adapters/fs.d.ts +0 -10
- package/dist/adapters/git.d.ts +0 -10
- package/dist/adapters/logger.d.ts +0 -17
- package/dist/adapters/watcher.d.ts +0 -10
- package/dist/adapters/workspace.d.ts +0 -93
- package/dist/ai/agents/claude-code-agent.d.ts +0 -21
- package/dist/ai/agents/cursor-agent.d.ts +0 -67
- package/dist/ai/agents/openai-codex-agent.d.ts +0 -21
- package/dist/ai/agents/orchestrator.d.ts +0 -49
- package/dist/ai/agents/simple-agent.d.ts +0 -16
- package/dist/ai/agents/types.d.ts +0 -35
- package/dist/ai/client.d.ts +0 -82
- package/dist/ai/index.d.ts +0 -16
- package/dist/ai/prompts/code-generation.d.ts +0 -25
- package/dist/ai/prompts/index.d.ts +0 -9
- package/dist/ai/prompts/spec-creation.d.ts +0 -28
- package/dist/ai/providers.d.ts +0 -28
- package/dist/formatters/index.d.ts +0 -10
- package/dist/formatters/json.d.ts +0 -88
- package/dist/formatters/sarif.d.ts +0 -100
- package/dist/formatters/text.d.ts +0 -34
- package/dist/index.d.ts +0 -66
- package/dist/libs/ai-providers/dist/factory.js +0 -154
- package/dist/libs/ai-providers/dist/index.js +0 -4
- package/dist/libs/ai-providers/dist/legacy.js +0 -72
- package/dist/libs/ai-providers/dist/models.js +0 -287
- package/dist/libs/ai-providers/dist/validation.js +0 -1
- package/dist/libs/contracts/dist/capabilities/openbanking.js +0 -88
- package/dist/libs/contracts/dist/client/index.js +0 -5
- package/dist/libs/contracts/dist/client/react/feature-render.js +0 -2
- package/dist/libs/contracts/dist/client/react/form-render.js +0 -4
- package/dist/libs/contracts/dist/client/react/index.js +0 -4
- package/dist/libs/contracts/dist/contract-registry/index.js +0 -1
- package/dist/libs/contracts/dist/contract-registry/schemas.js +0 -60
- package/dist/libs/contracts/dist/docs/PUBLISHING.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/index.js +0 -29
- package/dist/libs/contracts/dist/docs/presentations.js +0 -71
- package/dist/libs/contracts/dist/docs/registry.js +0 -44
- package/dist/libs/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +0 -80
- package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +0 -57
- package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js +0 -357
- package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js +0 -37
- package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js +0 -20
- package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js +0 -48
- package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +0 -79
- package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +0 -84
- package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +0 -45
- package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js +0 -67
- package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +0 -40
- package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js +0 -69
- package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +0 -47
- package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js +0 -62
- package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js +0 -155
- package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js +0 -20
- package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js +0 -101
- package/dist/libs/contracts/dist/docs/tech/workflows/overview.docblock.js +0 -20
- package/dist/libs/contracts/dist/events.js +0 -8
- package/dist/libs/contracts/dist/experiments/evaluator.js +0 -1
- package/dist/libs/contracts/dist/index.js +0 -72
- package/dist/libs/contracts/dist/install.js +0 -2
- package/dist/libs/contracts/dist/integrations/contracts.js +0 -377
- package/dist/libs/contracts/dist/integrations/index.js +0 -18
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/accounts.js +0 -228
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/balances.js +0 -159
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/index.js +0 -3
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/transactions.js +0 -210
- package/dist/libs/contracts/dist/integrations/openbanking/models.js +0 -242
- package/dist/libs/contracts/dist/integrations/openbanking/telemetry.js +0 -13
- package/dist/libs/contracts/dist/integrations/providers/elevenlabs.js +0 -52
- package/dist/libs/contracts/dist/integrations/providers/gcs-storage.js +0 -75
- package/dist/libs/contracts/dist/integrations/providers/gmail.js +0 -87
- package/dist/libs/contracts/dist/integrations/providers/google-calendar.js +0 -66
- package/dist/libs/contracts/dist/integrations/providers/index.js +0 -11
- package/dist/libs/contracts/dist/integrations/providers/mistral.js +0 -68
- package/dist/libs/contracts/dist/integrations/providers/postmark.js +0 -68
- package/dist/libs/contracts/dist/integrations/providers/powens.js +0 -116
- package/dist/libs/contracts/dist/integrations/providers/qdrant.js +0 -73
- package/dist/libs/contracts/dist/integrations/providers/registry.js +0 -10
- package/dist/libs/contracts/dist/integrations/providers/stripe.js +0 -83
- package/dist/libs/contracts/dist/integrations/providers/twilio-sms.js +0 -61
- package/dist/libs/contracts/dist/jsonschema.js +0 -24
- package/dist/libs/contracts/dist/knowledge/contracts.js +0 -306
- package/dist/libs/contracts/dist/knowledge/index.js +0 -7
- package/dist/libs/contracts/dist/knowledge/spaces/email-threads.js +0 -34
- package/dist/libs/contracts/dist/knowledge/spaces/financial-docs.js +0 -34
- package/dist/libs/contracts/dist/knowledge/spaces/financial-overview.js +0 -38
- package/dist/libs/contracts/dist/knowledge/spaces/index.js +0 -6
- package/dist/libs/contracts/dist/knowledge/spaces/product-canon.js +0 -34
- package/dist/libs/contracts/dist/knowledge/spaces/support-faq.js +0 -37
- package/dist/libs/contracts/dist/knowledge/spaces/uploaded-docs.js +0 -34
- package/dist/libs/contracts/dist/llm/exporters.js +0 -352
- package/dist/libs/contracts/dist/llm/index.js +0 -2
- package/dist/libs/contracts/dist/llm/prompts.js +0 -211
- package/dist/libs/contracts/dist/onboarding-base.js +0 -196
- package/dist/libs/contracts/dist/openapi.js +0 -75
- package/dist/libs/contracts/dist/ownership.js +0 -21
- package/dist/libs/contracts/dist/presentations.js +0 -1
- package/dist/libs/contracts/dist/presentations.v2.js +0 -11
- package/dist/libs/contracts/dist/prompt.js +0 -1
- package/dist/libs/contracts/dist/promptRegistry.js +0 -1
- package/dist/libs/contracts/dist/regenerator/index.js +0 -2
- package/dist/libs/contracts/dist/regenerator/service.js +0 -92
- package/dist/libs/contracts/dist/regenerator/utils.js +0 -51
- package/dist/libs/contracts/dist/registry.js +0 -208
- package/dist/libs/contracts/dist/resources.js +0 -1
- package/dist/libs/contracts/dist/schema/dist/EnumType.js +0 -2
- package/dist/libs/contracts/dist/schema/dist/FieldType.js +0 -49
- package/dist/libs/contracts/dist/schema/dist/ScalarTypeEnum.js +0 -236
- package/dist/libs/contracts/dist/schema/dist/SchemaModel.js +0 -34
- package/dist/libs/contracts/dist/schema/dist/entity/defineEntity.js +0 -1
- package/dist/libs/contracts/dist/schema/dist/entity/index.js +0 -2
- package/dist/libs/contracts/dist/schema/dist/entity/types.js +0 -1
- package/dist/libs/contracts/dist/schema/dist/index.js +0 -6
- package/dist/libs/contracts/dist/server/graphql-pothos.js +0 -6
- package/dist/libs/contracts/dist/server/index.js +0 -8
- package/dist/libs/contracts/dist/server/mcp/createMcpServer.js +0 -4
- package/dist/libs/contracts/dist/server/mcp/registerPresentations.js +0 -2
- package/dist/libs/contracts/dist/server/mcp/registerPrompts.js +0 -1
- package/dist/libs/contracts/dist/server/mcp/registerResources.js +0 -2
- package/dist/libs/contracts/dist/server/mcp/registerTools.js +0 -1
- package/dist/libs/contracts/dist/server/provider-mcp.js +0 -1
- package/dist/libs/contracts/dist/server/rest-elysia.js +0 -1
- package/dist/libs/contracts/dist/server/rest-express.js +0 -1
- package/dist/libs/contracts/dist/server/rest-generic.js +0 -1
- package/dist/libs/contracts/dist/server/rest-next-app.js +0 -1
- package/dist/libs/contracts/dist/server/rest-next-pages.js +0 -1
- package/dist/libs/contracts/dist/spec.js +0 -35
- package/dist/libs/contracts/dist/telemetry/index.js +0 -1
- package/dist/libs/contracts/dist/telemetry/tracker.js +0 -1
- package/dist/libs/contracts/dist/tests/index.js +0 -1
- package/dist/libs/contracts/dist/tests/runner.js +0 -150
- package/dist/libs/contracts/dist/workflow/index.js +0 -1
- package/dist/libs/contracts/dist/workflow/runner.js +0 -1
- package/dist/libs/contracts-transformers/dist/common/utils.js +0 -47
- package/dist/libs/contracts-transformers/dist/openapi/exporter.js +0 -1
- package/dist/libs/contracts-transformers/dist/openapi/importer.js +0 -255
- package/dist/libs/contracts-transformers/dist/openapi/index.js +0 -4
- package/dist/libs/contracts-transformers/dist/openapi/parser.js +0 -231
- package/dist/libs/contracts-transformers/dist/openapi/schema-converter.js +0 -201
- package/dist/modules/contractspec-workspace/dist/ai/code-generation.js +0 -137
- package/dist/modules/contractspec-workspace/dist/ai/spec-creation.js +0 -101
- package/dist/modules/contractspec-workspace/dist/analysis/deps/graph.js +0 -84
- package/dist/modules/contractspec-workspace/dist/analysis/deps/parse-imports.js +0 -30
- package/dist/modules/contractspec-workspace/dist/analysis/diff/semantic.js +0 -96
- package/dist/modules/contractspec-workspace/dist/analysis/feature-scan.js +0 -151
- package/dist/modules/contractspec-workspace/dist/analysis/spec-scan.js +0 -344
- package/dist/modules/contractspec-workspace/dist/analysis/validate/spec-structure.js +0 -122
- package/dist/modules/contractspec-workspace/dist/templates/app-config.js +0 -105
- package/dist/modules/contractspec-workspace/dist/templates/data-view.js +0 -68
- package/dist/modules/contractspec-workspace/dist/templates/event.js +0 -38
- package/dist/modules/contractspec-workspace/dist/templates/experiment.js +0 -87
- package/dist/modules/contractspec-workspace/dist/templates/handler.js +0 -95
- package/dist/modules/contractspec-workspace/dist/templates/integration-utils.js +0 -104
- package/dist/modules/contractspec-workspace/dist/templates/integration.js +0 -62
- package/dist/modules/contractspec-workspace/dist/templates/knowledge.js +0 -68
- package/dist/modules/contractspec-workspace/dist/templates/migration.js +0 -60
- package/dist/modules/contractspec-workspace/dist/templates/operation.js +0 -100
- package/dist/modules/contractspec-workspace/dist/templates/presentation.js +0 -78
- package/dist/modules/contractspec-workspace/dist/templates/telemetry.js +0 -89
- package/dist/modules/contractspec-workspace/dist/templates/utils.js +0 -38
- package/dist/modules/contractspec-workspace/dist/templates/workflow-runner.js +0 -48
- package/dist/modules/contractspec-workspace/dist/templates/workflow.js +0 -67
- package/dist/modules/contractspec-workspace/dist/types/generation-types.js +0 -20
- package/dist/ports/ai.d.ts +0 -58
- package/dist/ports/fs.d.ts +0 -80
- package/dist/ports/git.d.ts +0 -32
- package/dist/ports/logger.d.ts +0 -87
- package/dist/ports/watcher.d.ts +0 -51
- package/dist/services/agent-guide/adapters/claude-code.d.ts +0 -34
- package/dist/services/agent-guide/adapters/cursor-cli.d.ts +0 -38
- package/dist/services/agent-guide/adapters/generic-mcp.d.ts +0 -52
- package/dist/services/agent-guide/adapters/index.d.ts +0 -22
- package/dist/services/agent-guide/agent-guide-service.d.ts +0 -55
- package/dist/services/agent-guide/types.d.ts +0 -57
- package/dist/services/build.d.ts +0 -58
- package/dist/services/ci-check/ci-check-service.d.ts +0 -15
- package/dist/services/ci-check/types.d.ts +0 -142
- package/dist/services/clean.d.ts +0 -40
- package/dist/services/config.d.ts +0 -25
- package/dist/services/deps.d.ts +0 -52
- package/dist/services/diff.d.ts +0 -33
- package/dist/services/doctor/doctor-service.d.ts +0 -23
- package/dist/services/doctor/types.d.ts +0 -117
- package/dist/services/implementation/discovery.d.ts +0 -29
- package/dist/services/implementation/resolver.d.ts +0 -43
- package/dist/services/implementation/types.d.ts +0 -78
- package/dist/services/integrity-diagram.d.ts +0 -35
- package/dist/services/integrity.d.ts +0 -133
- package/dist/services/list.d.ts +0 -30
- package/dist/services/openapi/export-service.d.ts +0 -52
- package/dist/services/openapi/import-service.d.ts +0 -15
- package/dist/services/openapi/sync-service.d.ts +0 -18
- package/dist/services/openapi/types.d.ts +0 -184
- package/dist/services/openapi/validate-service.d.ts +0 -15
- package/dist/services/regenerator.d.ts +0 -17
- package/dist/services/registry.d.ts +0 -52
- package/dist/services/setup/config-generators.d.ts +0 -41
- package/dist/services/setup/file-merger.d.ts +0 -26
- package/dist/services/setup/setup-service.d.ts +0 -11
- package/dist/services/setup/types.d.ts +0 -84
- package/dist/services/sync.d.ts +0 -40
- package/dist/services/test.d.ts +0 -14
- package/dist/services/validate-implementation.d.ts +0 -31
- package/dist/services/validate.d.ts +0 -40
- package/dist/services/verification-cache/adapters/filesystem.d.ts +0 -45
- package/dist/services/verification-cache/adapters/in-memory.d.ts +0 -26
- package/dist/services/verification-cache/adapters/workspace-state.d.ts +0 -48
- package/dist/services/verification-cache/cache-service.d.ts +0 -69
- package/dist/services/verification-cache/types.d.ts +0 -123
- package/dist/services/verify/ai-verifier.d.ts +0 -24
- package/dist/services/verify/behavior-verifier.d.ts +0 -11
- package/dist/services/verify/structure-verifier.d.ts +0 -11
- package/dist/services/verify/types.d.ts +0 -136
- package/dist/services/verify/verify-service.d.ts +0 -59
- package/dist/services/watch.d.ts +0 -24
- package/dist/services/workspace-info.d.ts +0 -61
- package/dist/templates/app-config.template.d.ts +0 -6
- package/dist/templates/data-view.template.d.ts +0 -6
- package/dist/templates/event.template.d.ts +0 -10
- package/dist/templates/experiment.template.d.ts +0 -6
- package/dist/templates/handler.template.d.ts +0 -15
- package/dist/templates/index.d.ts +0 -20
- package/dist/templates/integration.template.d.ts +0 -6
- package/dist/templates/knowledge.template.d.ts +0 -6
- package/dist/templates/migration.template.d.ts +0 -6
- package/dist/templates/operation.template.d.ts +0 -10
- package/dist/templates/presentation.template.d.ts +0 -10
- package/dist/templates/telemetry.template.d.ts +0 -6
- package/dist/templates/workflow-runner.template.d.ts +0 -15
- package/dist/templates/workflow.template.d.ts +0 -6
- package/dist/types/config.d.ts +0 -33
- package/dist/types.d.ts +0 -323
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
//#region ../../modules/contractspec-workspace/dist/ai/code-generation.js
|
|
2
|
-
/**
|
|
3
|
-
* AI prompts for code generation.
|
|
4
|
-
* Extracted from cli-contracts/src/ai/prompts/code-generation.ts
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Build prompt for generating handler implementation.
|
|
8
|
-
*/
|
|
9
|
-
function buildHandlerPrompt(specCode) {
|
|
10
|
-
return `You are a senior TypeScript developer implementing a handler for a contract specification.
|
|
11
|
-
|
|
12
|
-
Here is the contract spec:
|
|
13
|
-
|
|
14
|
-
\`\`\`typescript
|
|
15
|
-
${specCode}
|
|
16
|
-
\`\`\`
|
|
17
|
-
|
|
18
|
-
Generate a complete handler implementation that:
|
|
19
|
-
|
|
20
|
-
1. **Matches the spec signature**: Input/output types from the spec
|
|
21
|
-
2. **Handles errors**: Implement error cases defined in spec.io.errors
|
|
22
|
-
3. **Emits events**: Use the events declared in spec.sideEffects.emits
|
|
23
|
-
4. **Validates input**: Use zod validation from the schema
|
|
24
|
-
5. **Follows best practices**: Clean, type-safe TypeScript
|
|
25
|
-
6. **Includes comments**: Explain business logic
|
|
26
|
-
|
|
27
|
-
The handler should be production-ready with proper error handling, logging points, and clear structure.
|
|
28
|
-
|
|
29
|
-
Return only the TypeScript code for the handler function.`;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Build prompt for generating React component from presentation spec.
|
|
33
|
-
*/
|
|
34
|
-
function buildComponentPrompt(specCode) {
|
|
35
|
-
return `You are a senior React developer creating a component for a presentation specification.
|
|
36
|
-
|
|
37
|
-
Here is the presentation spec:
|
|
38
|
-
|
|
39
|
-
\`\`\`typescript
|
|
40
|
-
${specCode}
|
|
41
|
-
\`\`\`
|
|
42
|
-
|
|
43
|
-
Generate a complete React component that:
|
|
44
|
-
|
|
45
|
-
1. **Props interface**: Typed props from the spec
|
|
46
|
-
2. **Accessibility**: Proper ARIA labels, roles, keyboard navigation
|
|
47
|
-
3. **Mobile-first**: Optimized for small screens and touch
|
|
48
|
-
4. **Clean UI**: Simple, intuitive interface
|
|
49
|
-
5. **Type-safe**: Full TypeScript with no 'any' types
|
|
50
|
-
6. **Best practices**: React hooks, proper state management
|
|
51
|
-
|
|
52
|
-
The component should follow Atomic Design principles and be reusable.
|
|
53
|
-
|
|
54
|
-
Return only the TypeScript/TSX code for the component.`;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Build prompt for generating form component.
|
|
58
|
-
*/
|
|
59
|
-
function buildFormPrompt(specCode) {
|
|
60
|
-
return `You are a senior React developer creating a form component from a form specification.
|
|
61
|
-
|
|
62
|
-
Here is the form spec:
|
|
63
|
-
|
|
64
|
-
\`\`\`typescript
|
|
65
|
-
${specCode}
|
|
66
|
-
\`\`\`
|
|
67
|
-
|
|
68
|
-
Generate a complete form component using react-hook-form that:
|
|
69
|
-
|
|
70
|
-
1. **Form validation**: Use zod schema for validation
|
|
71
|
-
2. **Field types**: Proper inputs for each field type
|
|
72
|
-
3. **Conditional logic**: Support visibleWhen, enabledWhen, requiredWhen predicates
|
|
73
|
-
4. **Error handling**: Clear, user-friendly error messages
|
|
74
|
-
5. **Accessibility**: Labels, hints, ARIA attributes
|
|
75
|
-
6. **Mobile-optimized**: Touch-friendly, appropriate input types
|
|
76
|
-
7. **Type-safe**: Full TypeScript
|
|
77
|
-
|
|
78
|
-
The form should provide excellent UX with real-time validation and helpful feedback.
|
|
79
|
-
|
|
80
|
-
Return only the TypeScript/TSX code for the form component.`;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Build prompt for generating tests.
|
|
84
|
-
*/
|
|
85
|
-
function buildTestPrompt(specCode, implementationCode, testType) {
|
|
86
|
-
return `You are a senior developer writing comprehensive tests.
|
|
87
|
-
|
|
88
|
-
Spec:
|
|
89
|
-
\`\`\`typescript
|
|
90
|
-
${specCode}
|
|
91
|
-
\`\`\`
|
|
92
|
-
|
|
93
|
-
Implementation:
|
|
94
|
-
\`\`\`typescript
|
|
95
|
-
${implementationCode}
|
|
96
|
-
\`\`\`
|
|
97
|
-
|
|
98
|
-
Generate complete test suite using Vitest that:
|
|
99
|
-
${testType === "handler" ? `
|
|
100
|
-
- Test all acceptance scenarios from the spec
|
|
101
|
-
- Test error cases defined in spec.io.errors
|
|
102
|
-
- Verify events are emitted correctly
|
|
103
|
-
- Test input validation
|
|
104
|
-
- Test happy path and edge cases` : `
|
|
105
|
-
- Test rendering with various props
|
|
106
|
-
- Test user interactions
|
|
107
|
-
- Test accessibility (a11y)
|
|
108
|
-
- Test responsive behavior
|
|
109
|
-
- Test error states`}
|
|
110
|
-
|
|
111
|
-
Use clear test descriptions and follow AAA pattern (Arrange, Act, Assert).
|
|
112
|
-
|
|
113
|
-
Return only the TypeScript test code.`;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* System prompt for code generation.
|
|
117
|
-
*/
|
|
118
|
-
function getCodeGenSystemPrompt() {
|
|
119
|
-
return `You are an expert TypeScript developer with deep knowledge of:
|
|
120
|
-
- Type-safe API design
|
|
121
|
-
- React and modern hooks
|
|
122
|
-
- Test-driven development
|
|
123
|
-
- Accessibility best practices
|
|
124
|
-
- Clean code principles
|
|
125
|
-
|
|
126
|
-
Generate production-ready code that is:
|
|
127
|
-
- Fully typed (no 'any' or type assertions unless absolutely necessary)
|
|
128
|
-
- Well-documented with TSDoc comments
|
|
129
|
-
- Following project conventions
|
|
130
|
-
- Defensive and error-safe
|
|
131
|
-
- Easy to maintain and extend
|
|
132
|
-
|
|
133
|
-
Always prioritize code quality, safety, and user experience.`;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
//#endregion
|
|
137
|
-
export { buildComponentPrompt, buildFormPrompt, buildHandlerPrompt, buildTestPrompt, getCodeGenSystemPrompt };
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
//#region ../../modules/contractspec-workspace/dist/ai/spec-creation.js
|
|
2
|
-
/**
|
|
3
|
-
* Build prompt for creating operation spec from description.
|
|
4
|
-
*/
|
|
5
|
-
function buildOperationSpecPrompt(description, kind) {
|
|
6
|
-
return `You are a senior software architect creating a contract specification for an operation.
|
|
7
|
-
|
|
8
|
-
The operation is a ${kind} (${kind === "command" ? "changes state, has side effects" : "read-only, idempotent"}).
|
|
9
|
-
|
|
10
|
-
User description: ${description}
|
|
11
|
-
|
|
12
|
-
Create a complete contract specification following these guidelines:
|
|
13
|
-
|
|
14
|
-
1. **Name**: Use dot notation like "domain.operationName" (e.g., "user.signup", "payment.charge")
|
|
15
|
-
2. **Version**: Start at 1
|
|
16
|
-
3. **Description**: Clear, concise summary (1-2 sentences)
|
|
17
|
-
4. **Goal**: Business purpose - why this operation exists
|
|
18
|
-
5. **Context**: Background, constraints, scope (what it does and doesn't do)
|
|
19
|
-
6. **Input/Output**: Describe the shape (we'll create schemas separately)
|
|
20
|
-
7. **Auth**: Who can call this - anonymous, user, or admin
|
|
21
|
-
8. **Feature Flags**: Any flags that gate this operation
|
|
22
|
-
9. **Side Effects**: What events might be emitted, analytics to track
|
|
23
|
-
|
|
24
|
-
Respond with a structured spec.`;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Build prompt for creating event spec from description.
|
|
28
|
-
*/
|
|
29
|
-
function buildEventSpecPrompt(description) {
|
|
30
|
-
return `You are a senior software architect creating an event specification.
|
|
31
|
-
|
|
32
|
-
User description: ${description}
|
|
33
|
-
|
|
34
|
-
Create a complete event specification following these guidelines:
|
|
35
|
-
|
|
36
|
-
1. **Name**: Use dot notation like "domain.event_name" (e.g., "user.signup_completed", "payment.charged")
|
|
37
|
-
2. **Version**: Start at 1
|
|
38
|
-
3. **Description**: Clear description of when this event is emitted
|
|
39
|
-
4. **Payload**: Describe what data the event carries
|
|
40
|
-
5. **PII Fields**: List any personally identifiable information fields (e.g., ["email", "name"])
|
|
41
|
-
|
|
42
|
-
Events represent things that have already happened and should use past tense.
|
|
43
|
-
|
|
44
|
-
Respond with a structured spec.`;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Build prompt for creating presentation spec from description.
|
|
48
|
-
*/
|
|
49
|
-
function buildPresentationSpecPrompt(description, kind) {
|
|
50
|
-
return `You are a senior software architect creating a presentation specification.
|
|
51
|
-
|
|
52
|
-
This is a ${kind} presentation - ${{
|
|
53
|
-
web_component: "a React component with props schema",
|
|
54
|
-
markdown: "markdown/MDX documentation or guide",
|
|
55
|
-
data: "structured data export (JSON/XML)"
|
|
56
|
-
}[kind]}.
|
|
57
|
-
|
|
58
|
-
User description: ${description}
|
|
59
|
-
|
|
60
|
-
Create a complete presentation specification following these guidelines:
|
|
61
|
-
|
|
62
|
-
1. **Name**: Use dot notation like "domain.presentation_name" (e.g., "user.profile_card", "docs.api_guide")
|
|
63
|
-
2. **Version**: Start at 1
|
|
64
|
-
3. **Description**: What this presentation shows/provides
|
|
65
|
-
4. **Kind-specific details**:
|
|
66
|
-
${kind === "web_component" ? "- Component key (symbolic, resolved by host app)\n - Props structure\n - Analytics events to track" : kind === "markdown" ? "- Content or resource URI\n - Target audience" : "- MIME type (e.g., application/json)\n - Data structure description"}
|
|
67
|
-
|
|
68
|
-
Respond with a structured spec.`;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Build system prompt for all spec generation.
|
|
72
|
-
*/
|
|
73
|
-
function getSystemPrompt() {
|
|
74
|
-
return `You are an expert software architect specializing in API design and contract-driven development.
|
|
75
|
-
|
|
76
|
-
You create clear, well-documented specifications that serve as the single source of truth for operations, events, and presentations.
|
|
77
|
-
|
|
78
|
-
Your specs are:
|
|
79
|
-
- Precise and unambiguous
|
|
80
|
-
- Following TypeScript conventions
|
|
81
|
-
- Business-oriented (capturing the "why" not just "what")
|
|
82
|
-
- Designed for both humans and AI agents to understand
|
|
83
|
-
|
|
84
|
-
Always use proper dot notation for names and ensure all metadata is meaningful and accurate.`;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Create example-based prompt for better results.
|
|
88
|
-
*/
|
|
89
|
-
function addExampleContext(basePrompt, examples) {
|
|
90
|
-
if (examples.length === 0) return basePrompt;
|
|
91
|
-
return `${basePrompt}
|
|
92
|
-
|
|
93
|
-
Here are some good examples for reference:
|
|
94
|
-
|
|
95
|
-
${examples.join("\n\n")}
|
|
96
|
-
|
|
97
|
-
Follow this structure and quality level.`;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
//#endregion
|
|
101
|
-
export { addExampleContext, buildEventSpecPrompt, buildOperationSpecPrompt, buildPresentationSpecPrompt, getSystemPrompt };
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
//#region ../../modules/contractspec-workspace/dist/analysis/deps/graph.js
|
|
2
|
-
/**
|
|
3
|
-
* Build reverse edges (dependents) for all nodes in the graph.
|
|
4
|
-
*/
|
|
5
|
-
function buildReverseEdges(graph) {
|
|
6
|
-
for (const node of graph.values()) node.dependents = [];
|
|
7
|
-
for (const [name, node] of graph) for (const dep of node.dependencies) {
|
|
8
|
-
const depNode = graph.get(dep);
|
|
9
|
-
if (depNode) depNode.dependents.push(name);
|
|
10
|
-
}
|
|
11
|
-
for (const node of graph.values()) node.dependents.sort((a, b) => a.localeCompare(b));
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Detect circular dependencies in the graph.
|
|
15
|
-
*/
|
|
16
|
-
function detectCycles(graph) {
|
|
17
|
-
const visited = /* @__PURE__ */ new Set();
|
|
18
|
-
const stack = /* @__PURE__ */ new Set();
|
|
19
|
-
const cycles = [];
|
|
20
|
-
function dfs(name, path) {
|
|
21
|
-
if (stack.has(name)) {
|
|
22
|
-
const start = path.indexOf(name);
|
|
23
|
-
if (start >= 0) cycles.push([...path.slice(start), name]);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
if (visited.has(name)) return;
|
|
27
|
-
visited.add(name);
|
|
28
|
-
stack.add(name);
|
|
29
|
-
const node = graph.get(name);
|
|
30
|
-
if (node) for (const dep of node.dependencies) dfs(dep, [...path, name]);
|
|
31
|
-
stack.delete(name);
|
|
32
|
-
}
|
|
33
|
-
for (const name of graph.keys()) if (!visited.has(name)) dfs(name, []);
|
|
34
|
-
return cycles;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Find missing dependencies (referenced but not defined).
|
|
38
|
-
*/
|
|
39
|
-
function findMissingDependencies(graph) {
|
|
40
|
-
const missing = [];
|
|
41
|
-
for (const [name, node] of graph) {
|
|
42
|
-
const absent = node.dependencies.filter((dep) => !graph.has(dep));
|
|
43
|
-
if (absent.length > 0) missing.push({
|
|
44
|
-
contract: name,
|
|
45
|
-
missing: absent
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
return missing;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Generate DOT format output for visualization.
|
|
52
|
-
*/
|
|
53
|
-
function toDot(graph) {
|
|
54
|
-
const lines = [];
|
|
55
|
-
lines.push("digraph ContractDependencies {");
|
|
56
|
-
lines.push(" rankdir=LR;");
|
|
57
|
-
lines.push(" node [shape=box];");
|
|
58
|
-
for (const [name, node] of graph) {
|
|
59
|
-
for (const dep of node.dependencies) lines.push(` "${name}" -> "${dep}";`);
|
|
60
|
-
if (node.dependencies.length === 0) lines.push(` "${name}";`);
|
|
61
|
-
}
|
|
62
|
-
lines.push("}");
|
|
63
|
-
return lines.join("\n");
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Create an empty contract graph.
|
|
67
|
-
*/
|
|
68
|
-
function createContractGraph() {
|
|
69
|
-
return /* @__PURE__ */ new Map();
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Add a node to the contract graph.
|
|
73
|
-
*/
|
|
74
|
-
function addContractNode(graph, name, file, dependencies) {
|
|
75
|
-
graph.set(name, {
|
|
76
|
-
name,
|
|
77
|
-
file,
|
|
78
|
-
dependencies,
|
|
79
|
-
dependents: []
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
//#endregion
|
|
84
|
-
export { addContractNode, buildReverseEdges, createContractGraph, detectCycles, findMissingDependencies, toDot };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
//#region ../../modules/contractspec-workspace/dist/analysis/deps/parse-imports.js
|
|
2
|
-
/**
|
|
3
|
-
* Import parsing utilities for dependency analysis.
|
|
4
|
-
* Extracted from cli-contracts/src/commands/deps/parse-imports.ts
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Parse spec imports from source code.
|
|
8
|
-
* Returns the names of imported specs based on file naming conventions.
|
|
9
|
-
*
|
|
10
|
-
* @param sourceCode - The source code to parse
|
|
11
|
-
* @param fromFilePath - The path of the file being parsed (for relative resolution)
|
|
12
|
-
* @returns Array of imported spec names
|
|
13
|
-
*/
|
|
14
|
-
function parseImportedSpecNames(sourceCode, _fromFilePath) {
|
|
15
|
-
const imports = [];
|
|
16
|
-
const importRegex = /import\s+.*?\s+from\s+['"]([^'"]+\.(?:contracts|event|presentation|workflow|data-view|migration|telemetry|experiment|app-config|integration|knowledge)(?:\.[jt]s)?)['"]/g;
|
|
17
|
-
let match;
|
|
18
|
-
while ((match = importRegex.exec(sourceCode)) !== null) {
|
|
19
|
-
const importPath = match[1];
|
|
20
|
-
if (!importPath) continue;
|
|
21
|
-
if (!importPath.startsWith(".") && !importPath.startsWith("/")) continue;
|
|
22
|
-
const pathParts = importPath.split("/");
|
|
23
|
-
const name = (pathParts[pathParts.length - 1] ?? "").replace(/\.(ts|js)$/, "").replace(/\.(contracts|event|presentation|workflow|data-view|migration|telemetry|experiment|app-config|integration|knowledge)$/, "");
|
|
24
|
-
if (name.length > 0) imports.push(name);
|
|
25
|
-
}
|
|
26
|
-
return Array.from(new Set(imports)).sort((a, b) => a.localeCompare(b));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
//#endregion
|
|
30
|
-
export { parseImportedSpecNames };
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { scanSpecSource } from "../spec-scan.js";
|
|
2
|
-
|
|
3
|
-
//#region ../../modules/contractspec-workspace/dist/analysis/diff/semantic.js
|
|
4
|
-
/**
|
|
5
|
-
* Compute semantic differences between two spec sources.
|
|
6
|
-
*/
|
|
7
|
-
function computeSemanticDiff(aCode, aPath, bCode, bPath, options = {}) {
|
|
8
|
-
const a = scanSpecSource(aCode, aPath);
|
|
9
|
-
const b = scanSpecSource(bCode, bPath);
|
|
10
|
-
const diffs = [];
|
|
11
|
-
compareScalar(diffs, "specType", a.specType, b.specType, {
|
|
12
|
-
breaking: true,
|
|
13
|
-
label: "Spec type"
|
|
14
|
-
});
|
|
15
|
-
compareScalar(diffs, "name", a.name, b.name, {
|
|
16
|
-
breaking: true,
|
|
17
|
-
label: "Name"
|
|
18
|
-
});
|
|
19
|
-
compareScalar(diffs, "version", a.version, b.version, {
|
|
20
|
-
breaking: true,
|
|
21
|
-
label: "Version"
|
|
22
|
-
});
|
|
23
|
-
compareScalar(diffs, "kind", a.kind, b.kind, {
|
|
24
|
-
breaking: true,
|
|
25
|
-
label: "Kind"
|
|
26
|
-
});
|
|
27
|
-
compareScalar(diffs, "stability", a.stability, b.stability, {
|
|
28
|
-
breaking: isStabilityDowngrade(a, b),
|
|
29
|
-
label: "Stability"
|
|
30
|
-
});
|
|
31
|
-
compareArray(diffs, "owners", a.owners ?? [], b.owners ?? [], { label: "Owners" });
|
|
32
|
-
compareArray(diffs, "tags", a.tags ?? [], b.tags ?? [], { label: "Tags" });
|
|
33
|
-
compareStructuralHints(diffs, a, b);
|
|
34
|
-
return options.breakingOnly ? diffs.filter((d) => d.type === "breaking") : diffs;
|
|
35
|
-
}
|
|
36
|
-
function compareScalar(diffs, path, a, b, config) {
|
|
37
|
-
if (a === b) return;
|
|
38
|
-
diffs.push({
|
|
39
|
-
type: config.breaking ? "breaking" : "changed",
|
|
40
|
-
path,
|
|
41
|
-
oldValue: a,
|
|
42
|
-
newValue: b,
|
|
43
|
-
description: `${config.label} changed`
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
function compareArray(diffs, path, a, b, config) {
|
|
47
|
-
const aSorted = [...a].sort();
|
|
48
|
-
const bSorted = [...b].sort();
|
|
49
|
-
if (JSON.stringify(aSorted) === JSON.stringify(bSorted)) return;
|
|
50
|
-
diffs.push({
|
|
51
|
-
type: "changed",
|
|
52
|
-
path,
|
|
53
|
-
oldValue: aSorted,
|
|
54
|
-
newValue: bSorted,
|
|
55
|
-
description: `${config.label} changed`
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
function isStabilityDowngrade(a, b) {
|
|
59
|
-
const order = {
|
|
60
|
-
experimental: 0,
|
|
61
|
-
beta: 1,
|
|
62
|
-
stable: 2,
|
|
63
|
-
deprecated: 3
|
|
64
|
-
};
|
|
65
|
-
const aValue = a.stability ? order[a.stability] ?? 0 : 0;
|
|
66
|
-
return (b.stability ? order[b.stability] ?? 0 : 0) > aValue;
|
|
67
|
-
}
|
|
68
|
-
function compareStructuralHints(diffs, a, b) {
|
|
69
|
-
compareScalar(diffs, "hasMeta", a.hasMeta, b.hasMeta, {
|
|
70
|
-
breaking: a.specType === "operation" || b.specType === "operation",
|
|
71
|
-
label: "meta section presence"
|
|
72
|
-
});
|
|
73
|
-
compareScalar(diffs, "hasIo", a.hasIo, b.hasIo, {
|
|
74
|
-
breaking: a.specType === "operation" || b.specType === "operation",
|
|
75
|
-
label: "io section presence"
|
|
76
|
-
});
|
|
77
|
-
compareScalar(diffs, "hasPolicy", a.hasPolicy, b.hasPolicy, {
|
|
78
|
-
breaking: a.specType === "operation" || b.specType === "operation",
|
|
79
|
-
label: "policy section presence"
|
|
80
|
-
});
|
|
81
|
-
compareScalar(diffs, "hasPayload", a.hasPayload, b.hasPayload, {
|
|
82
|
-
breaking: a.specType === "event" || b.specType === "event",
|
|
83
|
-
label: "payload section presence"
|
|
84
|
-
});
|
|
85
|
-
compareScalar(diffs, "hasContent", a.hasContent, b.hasContent, {
|
|
86
|
-
breaking: a.specType === "presentation" || b.specType === "presentation",
|
|
87
|
-
label: "content section presence"
|
|
88
|
-
});
|
|
89
|
-
compareScalar(diffs, "hasDefinition", a.hasDefinition, b.hasDefinition, {
|
|
90
|
-
breaking: a.specType === "workflow" || b.specType === "workflow",
|
|
91
|
-
label: "definition section presence"
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
//#endregion
|
|
96
|
-
export { computeSemanticDiff };
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
//#region ../../modules/contractspec-workspace/dist/analysis/feature-scan.js
|
|
2
|
-
/**
|
|
3
|
-
* Check if a file is a feature file based on naming conventions.
|
|
4
|
-
*/
|
|
5
|
-
function isFeatureFile(filePath) {
|
|
6
|
-
return filePath.includes(".feature.");
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Scan a feature source file to extract metadata.
|
|
10
|
-
*/
|
|
11
|
-
function scanFeatureSource(code, filePath) {
|
|
12
|
-
const key = matchStringField(code, "key") ?? extractKeyFromFilePath(filePath);
|
|
13
|
-
const title = matchStringField(code, "title") ?? void 0;
|
|
14
|
-
const description = matchStringField(code, "description") ?? void 0;
|
|
15
|
-
const domain = matchStringField(code, "domain") ?? void 0;
|
|
16
|
-
const stabilityRaw = matchStringField(code, "stability");
|
|
17
|
-
return {
|
|
18
|
-
filePath,
|
|
19
|
-
key,
|
|
20
|
-
title,
|
|
21
|
-
description,
|
|
22
|
-
domain,
|
|
23
|
-
stability: isStability(stabilityRaw) ? stabilityRaw : void 0,
|
|
24
|
-
owners: matchStringArrayField(code, "owners"),
|
|
25
|
-
tags: matchStringArrayField(code, "tags"),
|
|
26
|
-
operations: extractRefsFromArray(code, "operations"),
|
|
27
|
-
events: extractRefsFromArray(code, "events"),
|
|
28
|
-
presentations: extractRefsFromArray(code, "presentations"),
|
|
29
|
-
experiments: extractRefsFromArray(code, "experiments"),
|
|
30
|
-
capabilities: extractCapabilities(code),
|
|
31
|
-
opToPresentationLinks: extractOpToPresentationLinks(code)
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Extract refs from a named array (e.g., operations, events, presentations).
|
|
36
|
-
*/
|
|
37
|
-
function extractRefsFromArray(code, fieldName) {
|
|
38
|
-
const refs = [];
|
|
39
|
-
const arrayPattern = new RegExp(`${escapeRegex(fieldName)}\\s*:\\s*\\[([\\s\\S]*?)\\]`, "m");
|
|
40
|
-
const arrayMatch = code.match(arrayPattern);
|
|
41
|
-
if (!arrayMatch?.[1]) return refs;
|
|
42
|
-
const refPattern = /\{\s*name:\s*['"]([^'"]+)['"]\s*,\s*version:\s*(\d+)/g;
|
|
43
|
-
let match;
|
|
44
|
-
while ((match = refPattern.exec(arrayMatch[1])) !== null) if (match[1] && match[2]) refs.push({
|
|
45
|
-
name: match[1],
|
|
46
|
-
version: Number(match[2])
|
|
47
|
-
});
|
|
48
|
-
return refs;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Extract capability bindings (provides and requires).
|
|
52
|
-
*/
|
|
53
|
-
function extractCapabilities(code) {
|
|
54
|
-
const provides = [];
|
|
55
|
-
const requires = [];
|
|
56
|
-
const capabilitiesMatch = code.match(/capabilities\s*:\s*\{([\s\S]*?)\}/);
|
|
57
|
-
if (!capabilitiesMatch?.[1]) return {
|
|
58
|
-
provides,
|
|
59
|
-
requires
|
|
60
|
-
};
|
|
61
|
-
const capabilitiesContent = capabilitiesMatch[1];
|
|
62
|
-
const providesMatch = capabilitiesContent.match(/provides\s*:\s*\[([\s\S]*?)\]/);
|
|
63
|
-
if (providesMatch?.[1]) {
|
|
64
|
-
const refPattern = /\{\s*key:\s*['"]([^'"]+)['"]\s*,\s*version:\s*(\d+)/g;
|
|
65
|
-
let match;
|
|
66
|
-
while ((match = refPattern.exec(providesMatch[1])) !== null) if (match[1] && match[2]) provides.push({
|
|
67
|
-
name: match[1],
|
|
68
|
-
version: Number(match[2])
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
const requiresMatch = capabilitiesContent.match(/requires\s*:\s*\[([\s\S]*?)\]/);
|
|
72
|
-
if (requiresMatch?.[1]) {
|
|
73
|
-
const refPatternWithVersion = /\{\s*key:\s*['"]([^'"]+)['"]\s*,\s*version:\s*(\d+)/g;
|
|
74
|
-
const refPatternKeyOnly = /\{\s*key:\s*['"]([^'"]+)['"]\s*\}/g;
|
|
75
|
-
let match = null;
|
|
76
|
-
while ((match = refPatternWithVersion.exec(requiresMatch[1])) !== null) if (match[1] && match[2]) requires.push({
|
|
77
|
-
name: match[1],
|
|
78
|
-
version: Number(match[2])
|
|
79
|
-
});
|
|
80
|
-
while ((match = refPatternKeyOnly.exec(requiresMatch[1])) !== null) if (match && match[1]) {
|
|
81
|
-
if (!requires.some((r) => r.name === match[1])) requires.push({
|
|
82
|
-
name: match[1],
|
|
83
|
-
version: 1
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return {
|
|
88
|
-
provides,
|
|
89
|
-
requires
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Extract opToPresentation links.
|
|
94
|
-
*/
|
|
95
|
-
function extractOpToPresentationLinks(code) {
|
|
96
|
-
const links = [];
|
|
97
|
-
const arrayMatch = code.match(/opToPresentation\s*:\s*\[([\s\S]*?)\]/);
|
|
98
|
-
if (!arrayMatch?.[1]) return links;
|
|
99
|
-
const linkPattern = /\{\s*op:\s*\{\s*name:\s*['"]([^'"]+)['"]\s*,\s*version:\s*(\d+)\s*\}\s*,\s*pres:\s*\{\s*name:\s*['"]([^'"]+)['"]\s*,\s*version:\s*(\d+)\s*\}/g;
|
|
100
|
-
let match;
|
|
101
|
-
while ((match = linkPattern.exec(arrayMatch[1])) !== null) if (match[1] && match[2] && match[3] && match[4]) links.push({
|
|
102
|
-
op: {
|
|
103
|
-
name: match[1],
|
|
104
|
-
version: Number(match[2])
|
|
105
|
-
},
|
|
106
|
-
pres: {
|
|
107
|
-
name: match[3],
|
|
108
|
-
version: Number(match[4])
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
return links;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Extract key from file path as fallback.
|
|
115
|
-
*/
|
|
116
|
-
function extractKeyFromFilePath(filePath) {
|
|
117
|
-
return (filePath.split("/").pop() ?? filePath).replace(/\.feature\.[jt]s$/, "").replace(/[^a-zA-Z0-9-]/g, "-");
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Match a string field in source code.
|
|
121
|
-
*/
|
|
122
|
-
function matchStringField(code, field) {
|
|
123
|
-
const regex = /* @__PURE__ */ new RegExp(`${escapeRegex(field)}\\s*:\\s*['"]([^'"]+)['"]`);
|
|
124
|
-
return code.match(regex)?.[1] ?? null;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Match a string array field in source code.
|
|
128
|
-
*/
|
|
129
|
-
function matchStringArrayField(code, field) {
|
|
130
|
-
const regex = /* @__PURE__ */ new RegExp(`${escapeRegex(field)}\\s*:\\s*\\[([\\s\\S]*?)\\]`);
|
|
131
|
-
const match = code.match(regex);
|
|
132
|
-
if (!match?.[1]) return void 0;
|
|
133
|
-
const inner = match[1];
|
|
134
|
-
const items = Array.from(inner.matchAll(/['"]([^'"]+)['"]/g)).map((m) => m[1]).filter((value) => typeof value === "string" && value.length > 0);
|
|
135
|
-
return items.length > 0 ? items : void 0;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Check if a value is a valid stability.
|
|
139
|
-
*/
|
|
140
|
-
function isStability(value) {
|
|
141
|
-
return value === "experimental" || value === "beta" || value === "stable" || value === "deprecated";
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Escape regex special characters.
|
|
145
|
-
*/
|
|
146
|
-
function escapeRegex(value) {
|
|
147
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
//#endregion
|
|
151
|
-
export { isFeatureFile, scanFeatureSource };
|