@lssm/bundle.contractspec-workspace 0.0.0-canary-20251217080011 → 1.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/node_modules/@ai-sdk/anthropic/dist/index.js +1 -0
- package/dist/node_modules/@ai-sdk/openai/dist/index.js +11 -0
- package/dist/node_modules/@ai-sdk/provider/dist/index.js +3 -0
- package/dist/node_modules/@ai-sdk/provider-utils/dist/index.js +5 -0
- package/dist/node_modules/chalk/source/index.js +2 -0
- package/dist/node_modules/chalk/source/utilities.js +4 -0
- package/dist/node_modules/chalk/source/vendor/ansi-styles/index.js +1 -0
- package/dist/node_modules/chalk/source/vendor/supports-color/browser.js +1 -0
- package/dist/node_modules/cli-cursor/index.js +1 -0
- package/dist/node_modules/cli-spinners/index.js +1 -0
- package/dist/node_modules/cli-spinners/spinners.js +1 -0
- package/dist/node_modules/eventsource-parser/dist/index.js +5 -0
- package/dist/node_modules/eventsource-parser/dist/stream.js +1 -0
- package/dist/node_modules/get-east-asian-width/index.js +1 -0
- package/dist/node_modules/get-east-asian-width/lookup.js +1 -0
- package/dist/node_modules/is-interactive/index.js +1 -0
- package/dist/node_modules/is-unicode-supported/index.js +1 -0
- package/dist/node_modules/log-symbols/browser-symbols.js +1 -0
- package/dist/node_modules/mimic-function/index.js +1 -0
- package/dist/node_modules/onetime/index.js +1 -0
- package/dist/node_modules/ora/index.js +6 -0
- package/dist/node_modules/restore-cursor/index.js +1 -0
- package/dist/node_modules/signal-exit/dist/mjs/index.js +1 -0
- package/dist/node_modules/signal-exit/dist/mjs/signals.js +1 -0
- package/dist/node_modules/stdin-discarder/index.js +1 -0
- package/dist/node_modules/string-width/index.js +1 -0
- package/dist/node_modules/strip-ansi/index.js +1 -0
- package/dist/node_modules/strip-ansi/node_modules/ansi-regex/index.js +1 -0
- 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 -16
- 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,60 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
//#region src/services/verify/ai-verifier.ts
|
|
5
|
-
/**
|
|
6
|
-
* Parse AI response to structured result.
|
|
7
|
-
*/
|
|
8
|
-
function parseAIResponse(response) {
|
|
9
|
-
const jsonMatch = response.match(/```json\n?([\s\S]*?)\n?```/);
|
|
10
|
-
if (jsonMatch?.[1]) try {
|
|
11
|
-
const parsed = JSON.parse(jsonMatch[1]);
|
|
12
|
-
return {
|
|
13
|
-
compliant: parsed.passed ?? false,
|
|
14
|
-
confidence: (parsed.score ?? 0) / 100,
|
|
15
|
-
findings: (parsed.issues ?? []).map((issue) => ({
|
|
16
|
-
category: String(issue.category ?? "semantic"),
|
|
17
|
-
severity: String(issue.severity ?? "warning"),
|
|
18
|
-
message: String(issue.message ?? ""),
|
|
19
|
-
location: issue.location ? String(issue.location) : void 0,
|
|
20
|
-
suggestion: issue.suggestion ? String(issue.suggestion) : void 0
|
|
21
|
-
})),
|
|
22
|
-
rawResponse: response
|
|
23
|
-
};
|
|
24
|
-
} catch {}
|
|
25
|
-
const findings = [];
|
|
26
|
-
const lines = response.split("\n");
|
|
27
|
-
let currentSeverity = "info";
|
|
28
|
-
for (const line of lines) {
|
|
29
|
-
const lineLower = line.toLowerCase();
|
|
30
|
-
if (lineLower.includes("error") || lineLower.includes("critical")) currentSeverity = "error";
|
|
31
|
-
else if (lineLower.includes("warning") || lineLower.includes("should")) currentSeverity = "warning";
|
|
32
|
-
else if (lineLower.includes("info") || lineLower.includes("note")) currentSeverity = "info";
|
|
33
|
-
const bulletMatch = line.match(/^[-*•]\s*(.+)$/);
|
|
34
|
-
const numberedMatch = line.match(/^\d+\.\s*(.+)$/);
|
|
35
|
-
if (bulletMatch || numberedMatch) {
|
|
36
|
-
const content = bulletMatch?.[1] ?? numberedMatch?.[1] ?? "";
|
|
37
|
-
if (content.length > 10) findings.push({
|
|
38
|
-
category: "semantic",
|
|
39
|
-
severity: currentSeverity,
|
|
40
|
-
message: content
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
const hasErrors = findings.some((f) => f.severity === "error");
|
|
45
|
-
return {
|
|
46
|
-
compliant: !hasErrors,
|
|
47
|
-
confidence: hasErrors ? .3 : findings.length === 0 ? .9 : .7,
|
|
48
|
-
findings,
|
|
49
|
-
rawResponse: response
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Call AI provider for verification.
|
|
54
|
-
* This is a placeholder - actual implementation would use AI SDK.
|
|
55
|
-
*/
|
|
56
|
-
async function callAI(prompt, config) {
|
|
57
|
-
if (!config.aiApiKey) return `\`\`\`json
|
|
1
|
+
import{generateVerificationPrompt as e,specToFullMarkdown as t}from"@lssm/lib.contracts/llm";function n(e){let t=e.match(/```json\n?([\s\S]*?)\n?```/);if(t?.[1])try{let n=JSON.parse(t[1]);return{compliant:n.passed??!1,confidence:(n.score??0)/100,findings:(n.issues??[]).map(e=>({category:String(e.category??`semantic`),severity:String(e.severity??`warning`),message:String(e.message??``),location:e.location?String(e.location):void 0,suggestion:e.suggestion?String(e.suggestion):void 0})),rawResponse:e}}catch{}let n=[],r=e.split(`
|
|
2
|
+
`),i=`info`;for(let e of r){let t=e.toLowerCase();t.includes(`error`)||t.includes(`critical`)?i=`error`:t.includes(`warning`)||t.includes(`should`)?i=`warning`:(t.includes(`info`)||t.includes(`note`))&&(i=`info`);let r=e.match(/^[-*•]\s*(.+)$/),a=e.match(/^\d+\.\s*(.+)$/);if(r||a){let e=r?.[1]??a?.[1]??``;e.length>10&&n.push({category:`semantic`,severity:i,message:e})}}let a=n.some(e=>e.severity===`error`);return{compliant:!a,confidence:a?.3:n.length===0?.9:.7,findings:n,rawResponse:e}}async function r(e,t){if(!t.aiApiKey)return`\`\`\`json
|
|
58
3
|
{
|
|
59
4
|
"passed": true,
|
|
60
5
|
"score": 50,
|
|
@@ -71,154 +16,23 @@ async function callAI(prompt, config) {
|
|
|
71
16
|
],
|
|
72
17
|
"summary": "AI verification skipped - no API key configured. Structure and behavior checks have been performed."
|
|
73
18
|
}
|
|
74
|
-
\`\`\``;
|
|
75
|
-
try {
|
|
76
|
-
const provider = config.aiProvider ?? "anthropic";
|
|
77
|
-
if (provider === "anthropic") {
|
|
78
|
-
const { anthropic } = await import("@ai-sdk/anthropic");
|
|
79
|
-
const { generateText } = await import("ai");
|
|
80
|
-
return (await generateText({
|
|
81
|
-
model: anthropic("claude-3-5-sonnet-20241022"),
|
|
82
|
-
prompt,
|
|
83
|
-
system: "You are an expert code reviewer analyzing implementation compliance with specifications. Respond with structured JSON."
|
|
84
|
-
})).text;
|
|
85
|
-
} else if (provider === "openai") {
|
|
86
|
-
const { openai } = await import("@ai-sdk/openai");
|
|
87
|
-
const { generateText } = await import("ai");
|
|
88
|
-
return (await generateText({
|
|
89
|
-
model: openai("gpt-4o"),
|
|
90
|
-
prompt,
|
|
91
|
-
system: "You are an expert code reviewer analyzing implementation compliance with specifications. Respond with structured JSON."
|
|
92
|
-
})).text;
|
|
93
|
-
}
|
|
94
|
-
throw new Error(`Unknown AI provider: ${provider}`);
|
|
95
|
-
} catch (error) {
|
|
96
|
-
return `\`\`\`json
|
|
19
|
+
\`\`\``;try{let n=t.aiProvider??`anthropic`;if(n===`anthropic`){let{anthropic:t}=await import(`../../node_modules/@ai-sdk/anthropic/dist/index.js`),{generateText:n}=await import(`ai`);return(await n({model:t(`claude-3-5-sonnet-20241022`),prompt:e,system:`You are an expert code reviewer analyzing implementation compliance with specifications. Respond with structured JSON.`})).text}else if(n===`openai`){let{openai:t}=await import(`../../node_modules/@ai-sdk/openai/dist/index.js`),{generateText:n}=await import(`ai`);return(await n({model:t(`gpt-4o`),prompt:e,system:`You are an expert code reviewer analyzing implementation compliance with specifications. Respond with structured JSON.`})).text}throw Error(`Unknown AI provider: ${n}`)}catch(e){return`\`\`\`json
|
|
97
20
|
{
|
|
98
21
|
"passed": false,
|
|
99
22
|
"score": 0,
|
|
100
23
|
"issues": [
|
|
101
|
-
{ "severity": "error", "category": "semantic", "message": "AI verification failed: ${
|
|
24
|
+
{ "severity": "error", "category": "semantic", "message": "AI verification failed: ${e instanceof Error?e.message:`Unknown error`}" }
|
|
102
25
|
],
|
|
103
26
|
"summary": "AI verification encountered an error"
|
|
104
27
|
}
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Run AI-powered verification.
|
|
110
|
-
*/
|
|
111
|
-
async function verifyWithAI(input, config = {}) {
|
|
112
|
-
const { spec, implementationCode, implementationPath } = input;
|
|
113
|
-
const startTime = Date.now();
|
|
114
|
-
const result = parseAIResponse(await callAI(generateVerificationPrompt(spec, implementationCode).taskPrompt, config));
|
|
115
|
-
const issues = result.findings.map((f) => ({
|
|
116
|
-
severity: f.severity,
|
|
117
|
-
category: "semantic",
|
|
118
|
-
message: f.message,
|
|
119
|
-
location: f.location ? { file: f.location } : implementationPath ? { file: implementationPath } : void 0,
|
|
120
|
-
suggestion: f.suggestion
|
|
121
|
-
}));
|
|
122
|
-
const score = Math.round(result.confidence * 100);
|
|
123
|
-
const passed = result.compliant;
|
|
124
|
-
return {
|
|
125
|
-
tier: "ai_review",
|
|
126
|
-
passed,
|
|
127
|
-
score,
|
|
128
|
-
issues,
|
|
129
|
-
suggestions: result.findings.filter((f) => f.suggestion).map((f) => f.suggestion),
|
|
130
|
-
coverage: {
|
|
131
|
-
scenarios: {
|
|
132
|
-
total: 0,
|
|
133
|
-
covered: 0
|
|
134
|
-
},
|
|
135
|
-
errors: {
|
|
136
|
-
total: 0,
|
|
137
|
-
handled: 0
|
|
138
|
-
},
|
|
139
|
-
fields: {
|
|
140
|
-
total: 1,
|
|
141
|
-
implemented: passed ? 1 : 0
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
meta: {
|
|
145
|
-
specName: spec.meta.name,
|
|
146
|
-
specVersion: spec.meta.version,
|
|
147
|
-
implementationPath: implementationPath ?? "unknown",
|
|
148
|
-
verifiedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
149
|
-
duration: Date.now() - startTime
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Create a simpler AI review without calling the API.
|
|
155
|
-
* Used as fallback or for quick checks.
|
|
156
|
-
*/
|
|
157
|
-
function createQuickAIReview(input) {
|
|
158
|
-
const { spec, implementationCode, implementationPath } = input;
|
|
159
|
-
const startTime = Date.now();
|
|
160
|
-
const issues = [];
|
|
161
|
-
if (implementationCode.includes("console.log")) issues.push({
|
|
162
|
-
severity: "warning",
|
|
163
|
-
category: "semantic",
|
|
164
|
-
message: "Console.log statements found - consider using proper logging",
|
|
165
|
-
suggestion: "Use a structured logger instead of console.log"
|
|
166
|
-
});
|
|
167
|
-
if (implementationCode.includes("// TODO") || implementationCode.includes("// FIXME")) issues.push({
|
|
168
|
-
severity: "info",
|
|
169
|
-
category: "semantic",
|
|
170
|
-
message: "TODO/FIXME comments found - implementation may be incomplete",
|
|
171
|
-
suggestion: "Address TODO items before finalizing implementation"
|
|
172
|
-
});
|
|
173
|
-
if (spec.policy.auth !== "anonymous" && !implementationCode.includes("auth")) issues.push({
|
|
174
|
-
severity: "warning",
|
|
175
|
-
category: "semantic",
|
|
176
|
-
message: `Spec requires ${spec.policy.auth} auth but no auth check found`,
|
|
177
|
-
suggestion: "Add authentication check at the handler entry point"
|
|
178
|
-
});
|
|
179
|
-
const score = issues.filter((i) => i.severity === "error").length === 0 ? 80 : 40;
|
|
180
|
-
const passed = issues.filter((i) => i.severity === "error").length === 0;
|
|
181
|
-
return {
|
|
182
|
-
tier: "ai_review",
|
|
183
|
-
passed,
|
|
184
|
-
score,
|
|
185
|
-
issues,
|
|
186
|
-
suggestions: issues.filter((i) => i.suggestion).map((i) => i.suggestion),
|
|
187
|
-
coverage: {
|
|
188
|
-
scenarios: {
|
|
189
|
-
total: 0,
|
|
190
|
-
covered: 0
|
|
191
|
-
},
|
|
192
|
-
errors: {
|
|
193
|
-
total: 0,
|
|
194
|
-
handled: 0
|
|
195
|
-
},
|
|
196
|
-
fields: {
|
|
197
|
-
total: 1,
|
|
198
|
-
implemented: passed ? 1 : 0
|
|
199
|
-
}
|
|
200
|
-
},
|
|
201
|
-
meta: {
|
|
202
|
-
specName: spec.meta.name,
|
|
203
|
-
specVersion: spec.meta.version,
|
|
204
|
-
implementationPath: implementationPath ?? "unknown",
|
|
205
|
-
verifiedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
206
|
-
duration: Date.now() - startTime
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Generate a prompt for semantic field verification.
|
|
212
|
-
*/
|
|
213
|
-
function generateSemanticFieldPrompt(specFields, implCode) {
|
|
214
|
-
return `You are analyzing a code implementation against its specification.
|
|
28
|
+
\`\`\``}}async function i(t,i={}){let{spec:a,implementationCode:o,implementationPath:s}=t,c=Date.now(),l=n(await r(e(a,o).taskPrompt,i)),u=l.findings.map(e=>({severity:e.severity,category:`semantic`,message:e.message,location:e.location?{file:e.location}:s?{file:s}:void 0,suggestion:e.suggestion})),d=Math.round(l.confidence*100),f=l.compliant;return{tier:`ai_review`,passed:f,score:d,issues:u,suggestions:l.findings.filter(e=>e.suggestion).map(e=>e.suggestion),coverage:{scenarios:{total:0,covered:0},errors:{total:0,handled:0},fields:{total:1,implemented:f?1:0}},meta:{specName:a.meta.name,specVersion:a.meta.version,implementationPath:s??`unknown`,verifiedAt:new Date().toISOString(),duration:Date.now()-c}}}function a(e){let{spec:t,implementationCode:n,implementationPath:r}=e,i=Date.now(),a=[];n.includes(`console.log`)&&a.push({severity:`warning`,category:`semantic`,message:`Console.log statements found - consider using proper logging`,suggestion:`Use a structured logger instead of console.log`}),(n.includes(`// TODO`)||n.includes(`// FIXME`))&&a.push({severity:`info`,category:`semantic`,message:`TODO/FIXME comments found - implementation may be incomplete`,suggestion:`Address TODO items before finalizing implementation`}),t.policy.auth!==`anonymous`&&!n.includes(`auth`)&&a.push({severity:`warning`,category:`semantic`,message:`Spec requires ${t.policy.auth} auth but no auth check found`,suggestion:`Add authentication check at the handler entry point`});let o=a.filter(e=>e.severity===`error`).length===0?80:40,s=a.filter(e=>e.severity===`error`).length===0;return{tier:`ai_review`,passed:s,score:o,issues:a,suggestions:a.filter(e=>e.suggestion).map(e=>e.suggestion),coverage:{scenarios:{total:0,covered:0},errors:{total:0,handled:0},fields:{total:1,implemented:s?1:0}},meta:{specName:t.meta.name,specVersion:t.meta.version,implementationPath:r??`unknown`,verifiedAt:new Date().toISOString(),duration:Date.now()-i}}}function o(e,t){return`You are analyzing a code implementation against its specification.
|
|
215
29
|
|
|
216
30
|
## Spec Schema Fields
|
|
217
|
-
${
|
|
31
|
+
${e}
|
|
218
32
|
|
|
219
33
|
## Implementation Code
|
|
220
34
|
\`\`\`typescript
|
|
221
|
-
${
|
|
35
|
+
${t}
|
|
222
36
|
\`\`\`
|
|
223
37
|
|
|
224
38
|
## Task
|
|
@@ -258,146 +72,5 @@ Match types:
|
|
|
258
72
|
- "compatible": Semantically similar (e.g., "email" vs "emailAddress")
|
|
259
73
|
- "mismatch": Different meaning despite similar naming
|
|
260
74
|
- "missing": Spec field not found in implementation
|
|
261
|
-
`;
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Extract field definitions from spec schema.
|
|
265
|
-
*/
|
|
266
|
-
function extractSpecFields(spec) {
|
|
267
|
-
const fields = [];
|
|
268
|
-
/**
|
|
269
|
-
* Helper to safely extract fields from a schema.
|
|
270
|
-
*/
|
|
271
|
-
const extractFromSchema = (schema, direction) => {
|
|
272
|
-
try {
|
|
273
|
-
const shapeFn = schema?._def?.shape;
|
|
274
|
-
if (shapeFn && typeof shapeFn === "function") {
|
|
275
|
-
const shapeObj = shapeFn();
|
|
276
|
-
for (const [key, value] of Object.entries(shapeObj)) {
|
|
277
|
-
const typeName = value?._def?.typeName ?? "unknown";
|
|
278
|
-
fields.push(`- ${key}: ${String(typeName).replace("Zod", "").toLowerCase()} (${direction})`);
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
} catch {
|
|
282
|
-
fields.push(`- [unable to extract ${direction} fields]`);
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
if (spec.io.input) extractFromSchema(spec.io.input, "input");
|
|
286
|
-
if (spec.io.output && !("resourceRef" in spec.io.output)) extractFromSchema(spec.io.output, "output");
|
|
287
|
-
if (fields.length === 0) return "- [no schema fields could be extracted]";
|
|
288
|
-
return fields.join("\n");
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* Parse semantic verification response from AI.
|
|
292
|
-
*/
|
|
293
|
-
function parseSemanticResponse(response) {
|
|
294
|
-
const jsonMatch = response.match(/```json\n?([\s\S]*?)\n?```/);
|
|
295
|
-
if (jsonMatch?.[1]) try {
|
|
296
|
-
const parsed = JSON.parse(jsonMatch[1]);
|
|
297
|
-
return {
|
|
298
|
-
fieldMappings: (parsed.fieldMappings ?? []).map((m) => ({
|
|
299
|
-
specField: String(m.specField ?? ""),
|
|
300
|
-
specType: String(m.specType ?? "unknown"),
|
|
301
|
-
implementationField: m.implementationField ? String(m.implementationField) : void 0,
|
|
302
|
-
implementationType: m.implementationType ? String(m.implementationType) : void 0,
|
|
303
|
-
match: m.match ?? "missing",
|
|
304
|
-
aiConfidence: typeof m.aiConfidence === "number" ? m.aiConfidence : .5,
|
|
305
|
-
suggestion: m.suggestion ? String(m.suggestion) : void 0
|
|
306
|
-
})),
|
|
307
|
-
intentAlignment: {
|
|
308
|
-
score: typeof parsed.intentAlignment?.score === "number" ? parsed.intentAlignment.score : 50,
|
|
309
|
-
issues: Array.isArray(parsed.intentAlignment?.issues) ? parsed.intentAlignment.issues : [],
|
|
310
|
-
suggestions: Array.isArray(parsed.intentAlignment?.suggestions) ? parsed.intentAlignment.suggestions : []
|
|
311
|
-
},
|
|
312
|
-
semanticIssues: (parsed.semanticIssues ?? []).map((i) => ({
|
|
313
|
-
category: String(i.category ?? "semantic"),
|
|
314
|
-
severity: i.severity ?? "warning",
|
|
315
|
-
message: String(i.message ?? ""),
|
|
316
|
-
suggestion: i.suggestion ? String(i.suggestion) : void 0
|
|
317
|
-
})),
|
|
318
|
-
rawResponse: response
|
|
319
|
-
};
|
|
320
|
-
} catch {}
|
|
321
|
-
return {
|
|
322
|
-
fieldMappings: [],
|
|
323
|
-
intentAlignment: {
|
|
324
|
-
score: 50,
|
|
325
|
-
issues: ["Unable to parse AI response for semantic analysis"],
|
|
326
|
-
suggestions: []
|
|
327
|
-
},
|
|
328
|
-
semanticIssues: [],
|
|
329
|
-
rawResponse: response
|
|
330
|
-
};
|
|
331
|
-
}
|
|
332
|
-
/**
|
|
333
|
-
* Run semantic field-level verification using AI.
|
|
334
|
-
*/
|
|
335
|
-
async function verifySemanticFields(input, config = {}) {
|
|
336
|
-
const { spec, implementationCode } = input;
|
|
337
|
-
return parseSemanticResponse(await callAI(generateSemanticFieldPrompt(extractSpecFields(spec), implementationCode), config));
|
|
338
|
-
}
|
|
339
|
-
/**
|
|
340
|
-
* Run enhanced AI verification with semantic field analysis.
|
|
341
|
-
*/
|
|
342
|
-
async function verifyWithAIEnhanced(input, config = {}) {
|
|
343
|
-
const { spec, implementationCode, implementationPath } = input;
|
|
344
|
-
const startTime = Date.now();
|
|
345
|
-
const baseReport = await verifyWithAI(input, config);
|
|
346
|
-
let semanticResult;
|
|
347
|
-
if (config.aiApiKey) try {
|
|
348
|
-
semanticResult = await verifySemanticFields(input, config);
|
|
349
|
-
} catch {}
|
|
350
|
-
if (semanticResult) {
|
|
351
|
-
const semanticIssues = [];
|
|
352
|
-
for (const mapping of semanticResult.fieldMappings) if (mapping.match === "missing") semanticIssues.push({
|
|
353
|
-
severity: "error",
|
|
354
|
-
category: "semantic",
|
|
355
|
-
message: `Missing field: '${mapping.specField}' (${mapping.specType}) not found in implementation`,
|
|
356
|
-
suggestion: mapping.suggestion ?? `Add field '${mapping.specField}' to implementation`
|
|
357
|
-
});
|
|
358
|
-
else if (mapping.match === "mismatch") semanticIssues.push({
|
|
359
|
-
severity: "warning",
|
|
360
|
-
category: "semantic",
|
|
361
|
-
message: `Field mismatch: '${mapping.specField}' has incorrect implementation as '${mapping.implementationField}'`,
|
|
362
|
-
suggestion: mapping.suggestion
|
|
363
|
-
});
|
|
364
|
-
else if (mapping.match === "compatible" && mapping.aiConfidence < .8) semanticIssues.push({
|
|
365
|
-
severity: "info",
|
|
366
|
-
category: "semantic",
|
|
367
|
-
message: `Field naming: '${mapping.specField}' implemented as '${mapping.implementationField}' (compatible but not exact)`,
|
|
368
|
-
suggestion: mapping.suggestion
|
|
369
|
-
});
|
|
370
|
-
for (const issue of semanticResult.intentAlignment.issues) semanticIssues.push({
|
|
371
|
-
severity: "warning",
|
|
372
|
-
category: "semantic",
|
|
373
|
-
message: issue
|
|
374
|
-
});
|
|
375
|
-
for (const issue of semanticResult.semanticIssues) semanticIssues.push({
|
|
376
|
-
severity: issue.severity,
|
|
377
|
-
category: "semantic",
|
|
378
|
-
message: issue.message,
|
|
379
|
-
suggestion: issue.suggestion
|
|
380
|
-
});
|
|
381
|
-
baseReport.issues = [...baseReport.issues, ...semanticIssues];
|
|
382
|
-
const totalFields = semanticResult.fieldMappings.length;
|
|
383
|
-
const implementedFields = semanticResult.fieldMappings.filter((m) => m.match === "exact" || m.match === "compatible").length;
|
|
384
|
-
if (totalFields > 0) {
|
|
385
|
-
const fieldScore = Math.round(implementedFields / totalFields * 100);
|
|
386
|
-
baseReport.score = Math.round((baseReport.score + fieldScore) / 2);
|
|
387
|
-
baseReport.coverage.fields = {
|
|
388
|
-
total: totalFields,
|
|
389
|
-
implemented: implementedFields
|
|
390
|
-
};
|
|
391
|
-
}
|
|
392
|
-
if (semanticIssues.some((i) => i.severity === "error")) baseReport.passed = false;
|
|
393
|
-
baseReport.suggestions = [...baseReport.suggestions, ...semanticResult.intentAlignment.suggestions];
|
|
394
|
-
}
|
|
395
|
-
baseReport.meta = {
|
|
396
|
-
...baseReport.meta,
|
|
397
|
-
duration: Date.now() - startTime
|
|
398
|
-
};
|
|
399
|
-
return baseReport;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
//#endregion
|
|
403
|
-
export { createQuickAIReview, verifySemanticFields, verifyWithAI, verifyWithAIEnhanced };
|
|
75
|
+
`}function s(e){let t=[],n=(e,n)=>{try{let r=e?._def?.shape;if(r&&typeof r==`function`){let e=r();for(let[r,i]of Object.entries(e)){let e=i?._def?.typeName??`unknown`;t.push(`- ${r}: ${String(e).replace(`Zod`,``).toLowerCase()} (${n})`)}}}catch{t.push(`- [unable to extract ${n} fields]`)}};return e.io.input&&n(e.io.input,`input`),e.io.output&&!(`resourceRef`in e.io.output)&&n(e.io.output,`output`),t.length===0?`- [no schema fields could be extracted]`:t.join(`
|
|
76
|
+
`)}function c(e){let t=e.match(/```json\n?([\s\S]*?)\n?```/);if(t?.[1])try{let n=JSON.parse(t[1]);return{fieldMappings:(n.fieldMappings??[]).map(e=>({specField:String(e.specField??``),specType:String(e.specType??`unknown`),implementationField:e.implementationField?String(e.implementationField):void 0,implementationType:e.implementationType?String(e.implementationType):void 0,match:e.match??`missing`,aiConfidence:typeof e.aiConfidence==`number`?e.aiConfidence:.5,suggestion:e.suggestion?String(e.suggestion):void 0})),intentAlignment:{score:typeof n.intentAlignment?.score==`number`?n.intentAlignment.score:50,issues:Array.isArray(n.intentAlignment?.issues)?n.intentAlignment.issues:[],suggestions:Array.isArray(n.intentAlignment?.suggestions)?n.intentAlignment.suggestions:[]},semanticIssues:(n.semanticIssues??[]).map(e=>({category:String(e.category??`semantic`),severity:e.severity??`warning`,message:String(e.message??``),suggestion:e.suggestion?String(e.suggestion):void 0})),rawResponse:e}}catch{}return{fieldMappings:[],intentAlignment:{score:50,issues:[`Unable to parse AI response for semantic analysis`],suggestions:[]},semanticIssues:[],rawResponse:e}}async function l(e,t={}){let{spec:n,implementationCode:i}=e;return c(await r(o(s(n),i),t))}async function u(e,t={}){let{spec:n,implementationCode:r,implementationPath:a}=e,o=Date.now(),s=await i(e,t),c;if(t.aiApiKey)try{c=await l(e,t)}catch{}if(c){let e=[];for(let t of c.fieldMappings)t.match===`missing`?e.push({severity:`error`,category:`semantic`,message:`Missing field: '${t.specField}' (${t.specType}) not found in implementation`,suggestion:t.suggestion??`Add field '${t.specField}' to implementation`}):t.match===`mismatch`?e.push({severity:`warning`,category:`semantic`,message:`Field mismatch: '${t.specField}' has incorrect implementation as '${t.implementationField}'`,suggestion:t.suggestion}):t.match===`compatible`&&t.aiConfidence<.8&&e.push({severity:`info`,category:`semantic`,message:`Field naming: '${t.specField}' implemented as '${t.implementationField}' (compatible but not exact)`,suggestion:t.suggestion});for(let t of c.intentAlignment.issues)e.push({severity:`warning`,category:`semantic`,message:t});for(let t of c.semanticIssues)e.push({severity:t.severity,category:`semantic`,message:t.message,suggestion:t.suggestion});s.issues=[...s.issues,...e];let t=c.fieldMappings.length,n=c.fieldMappings.filter(e=>e.match===`exact`||e.match===`compatible`).length;if(t>0){let e=Math.round(n/t*100);s.score=Math.round((s.score+e)/2),s.coverage.fields={total:t,implemented:n}}e.some(e=>e.severity===`error`)&&(s.passed=!1),s.suggestions=[...s.suggestions,...c.intentAlignment.suggestions]}return s.meta={...s.meta,duration:Date.now()-o},s}export{a as createQuickAIReview,l as verifySemanticFields,i as verifyWithAI,u as verifyWithAIEnhanced};
|
|
@@ -1,185 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
//#region src/services/verify/behavior-verifier.ts
|
|
4
|
-
/**
|
|
5
|
-
* Check if a scenario is likely covered by the implementation.
|
|
6
|
-
*/
|
|
7
|
-
function checkScenarioCoverage(code, scenario) {
|
|
8
|
-
const keywords = [
|
|
9
|
-
...scenario.given,
|
|
10
|
-
...scenario.when,
|
|
11
|
-
...scenario.then
|
|
12
|
-
].flatMap((s) => s.toLowerCase().split(/\s+/).filter((w) => w.length > 3));
|
|
13
|
-
const codeLower = code.toLowerCase();
|
|
14
|
-
const foundKeywords = keywords.filter((kw) => codeLower.includes(kw));
|
|
15
|
-
const coverage = keywords.length > 0 ? foundKeywords.length / keywords.length : 0;
|
|
16
|
-
const scenarioNameLower = scenario.name.toLowerCase().replace(/\s+/g, "");
|
|
17
|
-
const hasTestForScenario = codeLower.includes(scenarioNameLower) || codeLower.includes(`test('${scenario.name.toLowerCase()}'`) || codeLower.includes(`it('${scenario.name.toLowerCase()}'`) || codeLower.includes(`describe('${scenario.name.toLowerCase()}'`);
|
|
18
|
-
const passed = coverage >= .3 || hasTestForScenario;
|
|
19
|
-
return {
|
|
20
|
-
name: scenario.name,
|
|
21
|
-
type: "scenario",
|
|
22
|
-
passed,
|
|
23
|
-
expected: `Given: ${scenario.given.join("; ")}; When: ${scenario.when.join("; ")}; Then: ${scenario.then.join("; ")}`,
|
|
24
|
-
details: passed ? void 0 : `Scenario keywords not found in implementation (${Math.round(coverage * 100)}% coverage)`
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Check if an example is likely handled.
|
|
29
|
-
*/
|
|
30
|
-
function checkExampleCoverage(code, example) {
|
|
31
|
-
const inputStr = JSON.stringify(example.input);
|
|
32
|
-
const outputStr = JSON.stringify(example.output);
|
|
33
|
-
const inputValues = extractStringValues(example.input);
|
|
34
|
-
const outputValues = extractStringValues(example.output);
|
|
35
|
-
const codeLower = code.toLowerCase();
|
|
36
|
-
const foundInputValues = inputValues.filter((v) => codeLower.includes(v.toLowerCase()));
|
|
37
|
-
const foundOutputValues = outputValues.filter((v) => codeLower.includes(v.toLowerCase()));
|
|
38
|
-
const avgCoverage = ((inputValues.length > 0 ? foundInputValues.length / inputValues.length : 1) + (outputValues.length > 0 ? foundOutputValues.length / outputValues.length : 1)) / 2;
|
|
39
|
-
const passed = avgCoverage >= .2;
|
|
40
|
-
return {
|
|
41
|
-
name: example.name,
|
|
42
|
-
type: "example",
|
|
43
|
-
passed,
|
|
44
|
-
expected: `Input: ${inputStr.slice(0, 100)}...; Output: ${outputStr.slice(0, 100)}...`,
|
|
45
|
-
details: passed ? void 0 : `Example values not found in implementation (${Math.round(avgCoverage * 100)}% coverage)`
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Extract string values from an object for comparison.
|
|
50
|
-
*/
|
|
51
|
-
function extractStringValues(obj) {
|
|
52
|
-
const values = [];
|
|
53
|
-
function extract(value) {
|
|
54
|
-
if (typeof value === "string" && value.length > 2) values.push(value);
|
|
55
|
-
else if (Array.isArray(value)) value.forEach(extract);
|
|
56
|
-
else if (value && typeof value === "object") Object.values(value).forEach(extract);
|
|
57
|
-
}
|
|
58
|
-
extract(obj);
|
|
59
|
-
return values;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Check if an error case is handled.
|
|
63
|
-
*/
|
|
64
|
-
function checkErrorCaseCoverage(code, errorCode, errorDef) {
|
|
65
|
-
const hasErrorCode = code.includes(errorCode);
|
|
66
|
-
const hasHttpStatus = errorDef.http ? code.includes(String(errorDef.http)) : true;
|
|
67
|
-
const whenKeywords = errorDef.when.toLowerCase().split(/\s+/).filter((w) => w.length > 3);
|
|
68
|
-
const codeLower = code.toLowerCase();
|
|
69
|
-
const foundWhenKeywords = whenKeywords.filter((kw) => codeLower.includes(kw));
|
|
70
|
-
const whenCoverage = whenKeywords.length > 0 ? foundWhenKeywords.length / whenKeywords.length : 1;
|
|
71
|
-
const passed = hasErrorCode && (hasHttpStatus || whenCoverage >= .3);
|
|
72
|
-
return {
|
|
73
|
-
name: `Error: ${errorCode}`,
|
|
74
|
-
type: "error",
|
|
75
|
-
passed,
|
|
76
|
-
expected: `When: ${errorDef.when}; Return: ${errorCode} (HTTP ${errorDef.http ?? 400})`,
|
|
77
|
-
details: passed ? void 0 : !hasErrorCode ? `Error code '${errorCode}' not found in implementation` : `Error condition not properly implemented`
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Check if events are emitted in the right conditions.
|
|
82
|
-
*/
|
|
83
|
-
function checkEventConditions(code, spec) {
|
|
84
|
-
const events = spec.sideEffects?.emits ?? [];
|
|
85
|
-
const checks = [];
|
|
86
|
-
for (const event of events) {
|
|
87
|
-
const eventName = isEmitDeclRef(event) ? event.ref.name : event.name;
|
|
88
|
-
const when = event.when;
|
|
89
|
-
const whenKeywords = when.toLowerCase().split(/\s+/).filter((w) => w.length > 3);
|
|
90
|
-
const codeLower = code.toLowerCase();
|
|
91
|
-
const hasEvent = codeLower.includes(eventName.toLowerCase());
|
|
92
|
-
const foundKeywords = whenKeywords.filter((kw) => codeLower.includes(kw));
|
|
93
|
-
const conditionCoverage = whenKeywords.length > 0 ? foundKeywords.length / whenKeywords.length : 1;
|
|
94
|
-
checks.push({
|
|
95
|
-
name: `Event: ${eventName}`,
|
|
96
|
-
type: "scenario",
|
|
97
|
-
passed: hasEvent && conditionCoverage >= .3,
|
|
98
|
-
expected: `Emit ${eventName} when: ${when}`,
|
|
99
|
-
details: !hasEvent ? `Event '${eventName}' not found` : conditionCoverage < .3 ? `Event condition not properly implemented` : void 0
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
return checks;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Check if idempotency is properly handled.
|
|
106
|
-
*/
|
|
107
|
-
function checkIdempotency(code, spec) {
|
|
108
|
-
if (spec.policy.idempotent === void 0) return null;
|
|
109
|
-
if (!spec.policy.idempotent) return null;
|
|
110
|
-
const idempotentPatterns = [
|
|
111
|
-
"idempotency",
|
|
112
|
-
"idempotent",
|
|
113
|
-
"already exists",
|
|
114
|
-
"upsert",
|
|
115
|
-
"on conflict",
|
|
116
|
-
"if not exists",
|
|
117
|
-
"dedupe",
|
|
118
|
-
"duplicate"
|
|
119
|
-
];
|
|
120
|
-
const codeLower = code.toLowerCase();
|
|
121
|
-
const hasIdempotentPattern = idempotentPatterns.some((p) => codeLower.includes(p));
|
|
122
|
-
return {
|
|
123
|
-
name: "Idempotency",
|
|
124
|
-
type: "scenario",
|
|
125
|
-
passed: hasIdempotentPattern,
|
|
126
|
-
expected: "Operation should be idempotent (safe to retry)",
|
|
127
|
-
details: hasIdempotentPattern ? void 0 : "No idempotency pattern found for idempotent operation"
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Run all behavior checks and produce a verification report.
|
|
132
|
-
*/
|
|
133
|
-
function verifyBehavior(input) {
|
|
134
|
-
const { spec, implementationCode, implementationPath } = input;
|
|
135
|
-
const startTime = Date.now();
|
|
136
|
-
const checks = [];
|
|
137
|
-
for (const scenario of spec.acceptance?.scenarios ?? []) checks.push(checkScenarioCoverage(implementationCode, scenario));
|
|
138
|
-
for (const example of spec.acceptance?.examples ?? []) checks.push(checkExampleCoverage(implementationCode, example));
|
|
139
|
-
for (const [code, errorDef] of Object.entries(spec.io.errors ?? {})) checks.push(checkErrorCaseCoverage(implementationCode, code, errorDef));
|
|
140
|
-
checks.push(...checkEventConditions(implementationCode, spec));
|
|
141
|
-
const idempotencyCheck = checkIdempotency(implementationCode, spec);
|
|
142
|
-
if (idempotencyCheck) checks.push(idempotencyCheck);
|
|
143
|
-
const issues = checks.filter((c) => !c.passed).map((c) => ({
|
|
144
|
-
severity: c.type === "error" ? "error" : "warning",
|
|
145
|
-
category: c.type === "scenario" ? "scenario" : c.type === "example" ? "scenario" : "error_handling",
|
|
146
|
-
message: c.details ?? `${c.type} not covered: ${c.name}`,
|
|
147
|
-
location: implementationPath ? { file: implementationPath } : void 0,
|
|
148
|
-
suggestion: c.expected ? `Expected: ${c.expected}` : void 0
|
|
149
|
-
}));
|
|
150
|
-
const scenarioChecks = checks.filter((c) => c.type === "scenario");
|
|
151
|
-
const errorChecks = checks.filter((c) => c.type === "error");
|
|
152
|
-
const passedCount = checks.filter((c) => c.passed).length;
|
|
153
|
-
const score = checks.length > 0 ? Math.round(passedCount / checks.length * 100) : 100;
|
|
154
|
-
return {
|
|
155
|
-
tier: "behavior",
|
|
156
|
-
passed: issues.filter((i) => i.severity === "error").length === 0,
|
|
157
|
-
score,
|
|
158
|
-
issues,
|
|
159
|
-
suggestions: checks.filter((c) => !c.passed && c.expected).map((c) => `${c.name}: ${c.expected}`),
|
|
160
|
-
coverage: {
|
|
161
|
-
scenarios: {
|
|
162
|
-
total: scenarioChecks.length,
|
|
163
|
-
covered: scenarioChecks.filter((c) => c.passed).length
|
|
164
|
-
},
|
|
165
|
-
errors: {
|
|
166
|
-
total: errorChecks.length,
|
|
167
|
-
handled: errorChecks.filter((c) => c.passed).length
|
|
168
|
-
},
|
|
169
|
-
fields: {
|
|
170
|
-
total: checks.length,
|
|
171
|
-
implemented: passedCount
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
meta: {
|
|
175
|
-
specName: spec.meta.name,
|
|
176
|
-
specVersion: spec.meta.version,
|
|
177
|
-
implementationPath: implementationPath ?? "unknown",
|
|
178
|
-
verifiedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
179
|
-
duration: Date.now() - startTime
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
//#endregion
|
|
185
|
-
export { verifyBehavior };
|
|
1
|
+
import{isEmitDeclRef as e}from"@lssm/lib.contracts/spec";function t(e,t){let n=[...t.given,...t.when,...t.then].flatMap(e=>e.toLowerCase().split(/\s+/).filter(e=>e.length>3)),r=e.toLowerCase(),i=n.filter(e=>r.includes(e)),a=n.length>0?i.length/n.length:0,o=t.name.toLowerCase().replace(/\s+/g,``),s=r.includes(o)||r.includes(`test('${t.name.toLowerCase()}'`)||r.includes(`it('${t.name.toLowerCase()}'`)||r.includes(`describe('${t.name.toLowerCase()}'`),c=a>=.3||s;return{name:t.name,type:`scenario`,passed:c,expected:`Given: ${t.given.join(`; `)}; When: ${t.when.join(`; `)}; Then: ${t.then.join(`; `)}`,details:c?void 0:`Scenario keywords not found in implementation (${Math.round(a*100)}% coverage)`}}function n(e,t){let n=JSON.stringify(t.input),i=JSON.stringify(t.output),a=r(t.input),o=r(t.output),s=e.toLowerCase(),c=a.filter(e=>s.includes(e.toLowerCase())),l=o.filter(e=>s.includes(e.toLowerCase())),u=((a.length>0?c.length/a.length:1)+(o.length>0?l.length/o.length:1))/2,d=u>=.2;return{name:t.name,type:`example`,passed:d,expected:`Input: ${n.slice(0,100)}...; Output: ${i.slice(0,100)}...`,details:d?void 0:`Example values not found in implementation (${Math.round(u*100)}% coverage)`}}function r(e){let t=[];function n(e){typeof e==`string`&&e.length>2?t.push(e):Array.isArray(e)?e.forEach(n):e&&typeof e==`object`&&Object.values(e).forEach(n)}return n(e),t}function i(e,t,n){let r=e.includes(t),i=n.http?e.includes(String(n.http)):!0,a=n.when.toLowerCase().split(/\s+/).filter(e=>e.length>3),o=e.toLowerCase(),s=a.filter(e=>o.includes(e)),c=a.length>0?s.length/a.length:1,l=r&&(i||c>=.3);return{name:`Error: ${t}`,type:`error`,passed:l,expected:`When: ${n.when}; Return: ${t} (HTTP ${n.http??400})`,details:l?void 0:r?`Error condition not properly implemented`:`Error code '${t}' not found in implementation`}}function a(t,n){let r=n.sideEffects?.emits??[],i=[];for(let n of r){let r=e(n)?n.ref.name:n.name,a=n.when,o=a.toLowerCase().split(/\s+/).filter(e=>e.length>3),s=t.toLowerCase(),c=s.includes(r.toLowerCase()),l=o.filter(e=>s.includes(e)),u=o.length>0?l.length/o.length:1;i.push({name:`Event: ${r}`,type:`scenario`,passed:c&&u>=.3,expected:`Emit ${r} when: ${a}`,details:c?u<.3?`Event condition not properly implemented`:void 0:`Event '${r}' not found`})}return i}function o(e,t){if(t.policy.idempotent===void 0||!t.policy.idempotent)return null;let n=[`idempotency`,`idempotent`,`already exists`,`upsert`,`on conflict`,`if not exists`,`dedupe`,`duplicate`],r=e.toLowerCase(),i=n.some(e=>r.includes(e));return{name:`Idempotency`,type:`scenario`,passed:i,expected:`Operation should be idempotent (safe to retry)`,details:i?void 0:`No idempotency pattern found for idempotent operation`}}function s(e){let{spec:r,implementationCode:s,implementationPath:c}=e,l=Date.now(),u=[];for(let e of r.acceptance?.scenarios??[])u.push(t(s,e));for(let e of r.acceptance?.examples??[])u.push(n(s,e));for(let[e,t]of Object.entries(r.io.errors??{}))u.push(i(s,e,t));u.push(...a(s,r));let d=o(s,r);d&&u.push(d);let f=u.filter(e=>!e.passed).map(e=>({severity:e.type===`error`?`error`:`warning`,category:e.type===`scenario`||e.type===`example`?`scenario`:`error_handling`,message:e.details??`${e.type} not covered: ${e.name}`,location:c?{file:c}:void 0,suggestion:e.expected?`Expected: ${e.expected}`:void 0})),p=u.filter(e=>e.type===`scenario`),m=u.filter(e=>e.type===`error`),h=u.filter(e=>e.passed).length,g=u.length>0?Math.round(h/u.length*100):100;return{tier:`behavior`,passed:f.filter(e=>e.severity===`error`).length===0,score:g,issues:f,suggestions:u.filter(e=>!e.passed&&e.expected).map(e=>`${e.name}: ${e.expected}`),coverage:{scenarios:{total:p.length,covered:p.filter(e=>e.passed).length},errors:{total:m.length,handled:m.filter(e=>e.passed).length},fields:{total:u.length,implemented:h}},meta:{specName:r.meta.name,specVersion:r.meta.version,implementationPath:c??`unknown`,verifiedAt:new Date().toISOString(),duration:Date.now()-l}}}export{s as verifyBehavior};
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { verifyBehavior } from "./behavior-verifier.js";
|
|
3
|
-
import { createQuickAIReview, verifySemanticFields, verifyWithAI, verifyWithAIEnhanced } from "./ai-verifier.js";
|
|
4
|
-
import { VerifyService, createVerifyService, verifyService } from "./verify-service.js";
|
|
1
|
+
import{verifyStructure as e}from"./structure-verifier.js";import{verifyBehavior as t}from"./behavior-verifier.js";import{createQuickAIReview as n,verifySemanticFields as r,verifyWithAI as i,verifyWithAIEnhanced as a}from"./ai-verifier.js";import{VerifyService as o,createVerifyService as s,verifyService as c}from"./verify-service.js";
|