@lssm/bundle.contractspec-workspace 0.0.0-canary-20251217083314 → 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
package/dist/services/build.js
CHANGED
|
@@ -1,140 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { generateComponentTemplate, generateHandlerTemplate, generateTestTemplate } from "../modules/contractspec-workspace/dist/templates/handler.js";
|
|
3
|
-
|
|
4
|
-
//#region src/services/build.ts
|
|
5
|
-
/**
|
|
6
|
-
* Build/scaffold service for generating implementation files from specs.
|
|
7
|
-
*
|
|
8
|
-
* Uses templates from @lssm/module.contractspec-workspace to generate
|
|
9
|
-
* handler, component, and test skeletons without requiring AI.
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* Build implementation files from a spec.
|
|
13
|
-
*/
|
|
14
|
-
async function buildSpec(specPath, adapters, config, options = {}) {
|
|
15
|
-
const { fs, logger } = adapters;
|
|
16
|
-
const { targets = detectDefaultTargets(specPath), outputDir = config.outputDir, overwrite = false, dryRun = false } = options;
|
|
17
|
-
const specCode = await fs.readFile(specPath);
|
|
18
|
-
const specInfo = scanSpecSource(specCode, specPath);
|
|
19
|
-
const specType = inferSpecTypeFromFilePath(specPath);
|
|
20
|
-
logger.info(`Building from spec: ${specPath}`, { specType });
|
|
21
|
-
const results = [];
|
|
22
|
-
for (const target of targets) try {
|
|
23
|
-
const result = await buildTarget(target, specPath, specCode, specInfo, specType, {
|
|
24
|
-
fs,
|
|
25
|
-
logger
|
|
26
|
-
}, outputDir, overwrite, dryRun);
|
|
27
|
-
results.push(result);
|
|
28
|
-
} catch (error) {
|
|
29
|
-
results.push({
|
|
30
|
-
target,
|
|
31
|
-
outputPath: "",
|
|
32
|
-
success: false,
|
|
33
|
-
error: error instanceof Error ? error.message : String(error)
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
return {
|
|
37
|
-
specPath,
|
|
38
|
-
specInfo,
|
|
39
|
-
results
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Build a single target from a spec.
|
|
44
|
-
*/
|
|
45
|
-
async function buildTarget(target, specPath, _specCode, specInfo, specType, adapters, outputDir, overwrite, dryRun) {
|
|
46
|
-
const { fs, logger } = adapters;
|
|
47
|
-
let code;
|
|
48
|
-
let outputPath;
|
|
49
|
-
switch (target) {
|
|
50
|
-
case "handler": {
|
|
51
|
-
if (specType !== "operation") return {
|
|
52
|
-
target,
|
|
53
|
-
outputPath: "",
|
|
54
|
-
success: false,
|
|
55
|
-
skipped: true,
|
|
56
|
-
error: `Handler generation only supported for operation specs (got ${specType})`
|
|
57
|
-
};
|
|
58
|
-
const kind = specInfo.kind === "command" || specInfo.kind === "query" ? specInfo.kind : "command";
|
|
59
|
-
code = generateHandlerTemplate(specInfo.name ?? "unknown", kind);
|
|
60
|
-
outputPath = resolveOutputPath(specPath, outputDir, "handlers", specInfo.name ?? "unknown", ".handler.ts", adapters.fs);
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
case "component":
|
|
64
|
-
if (specType !== "presentation") return {
|
|
65
|
-
target,
|
|
66
|
-
outputPath: "",
|
|
67
|
-
success: false,
|
|
68
|
-
skipped: true,
|
|
69
|
-
error: `Component generation only supported for presentation specs (got ${specType})`
|
|
70
|
-
};
|
|
71
|
-
code = generateComponentTemplate(specInfo.name ?? "unknown", specInfo.description ?? "");
|
|
72
|
-
outputPath = resolveOutputPath(specPath, outputDir, "components", specInfo.name ?? "unknown", ".tsx", adapters.fs);
|
|
73
|
-
break;
|
|
74
|
-
case "test": {
|
|
75
|
-
const testType = specType === "operation" ? "handler" : "component";
|
|
76
|
-
code = generateTestTemplate(specInfo.name ?? "unknown", testType);
|
|
77
|
-
outputPath = resolveOutputPath(specPath, outputDir, "__tests__", specInfo.name ?? "unknown", ".test.ts", adapters.fs);
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
default: return {
|
|
81
|
-
target,
|
|
82
|
-
outputPath: "",
|
|
83
|
-
success: false,
|
|
84
|
-
error: `Unknown target: ${target}`
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
if (await fs.exists(outputPath) && !overwrite) return {
|
|
88
|
-
target,
|
|
89
|
-
outputPath,
|
|
90
|
-
success: false,
|
|
91
|
-
skipped: true,
|
|
92
|
-
error: "File already exists (use overwrite option)"
|
|
93
|
-
};
|
|
94
|
-
if (dryRun) {
|
|
95
|
-
logger.info(`[dry-run] Would write: ${outputPath}`);
|
|
96
|
-
return {
|
|
97
|
-
target,
|
|
98
|
-
outputPath,
|
|
99
|
-
success: true
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
const dirPath = fs.dirname(outputPath);
|
|
103
|
-
await fs.mkdir(dirPath);
|
|
104
|
-
await fs.writeFile(outputPath, code);
|
|
105
|
-
logger.info(`Generated: ${outputPath}`);
|
|
106
|
-
return {
|
|
107
|
-
target,
|
|
108
|
-
outputPath,
|
|
109
|
-
success: true
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Detect default targets based on spec type.
|
|
114
|
-
*/
|
|
115
|
-
function detectDefaultTargets(specPath) {
|
|
116
|
-
switch (inferSpecTypeFromFilePath(specPath)) {
|
|
117
|
-
case "operation": return ["handler"];
|
|
118
|
-
case "presentation": return ["component"];
|
|
119
|
-
default: return [];
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Resolve output path for generated file.
|
|
124
|
-
*/
|
|
125
|
-
function resolveOutputPath(specPath, outputDir, subdir, specName, extension, fs) {
|
|
126
|
-
const sanitizedName = toKebabCase(specName.split(".").pop() ?? "unknown");
|
|
127
|
-
let baseDir;
|
|
128
|
-
if (outputDir.startsWith(".")) baseDir = fs.resolve(fs.dirname(specPath), "..", outputDir, subdir);
|
|
129
|
-
else baseDir = fs.resolve(outputDir, subdir);
|
|
130
|
-
return fs.join(baseDir, `${sanitizedName}${extension}`);
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Convert string to kebab-case.
|
|
134
|
-
*/
|
|
135
|
-
function toKebabCase(str) {
|
|
136
|
-
return str.replace(/\./g, "-").replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
//#endregion
|
|
140
|
-
export { buildSpec };
|
|
1
|
+
import{generateComponentTemplate as e,generateHandlerTemplate as t,generateTestTemplate as n,inferSpecTypeFromFilePath as r,scanSpecSource as i}from"@lssm/module.contractspec-workspace";async function a(e,t,n,a={}){let{fs:c,logger:l}=t,{targets:u=s(e),outputDir:d=n.outputDir,overwrite:f=!1,dryRun:p=!1}=a,m=await c.readFile(e),h=i(m,e),g=r(e);l.info(`Building from spec: ${e}`,{specType:g});let _=[];for(let t of u)try{let n=await o(t,e,m,h,g,{fs:c,logger:l},d,f,p);_.push(n)}catch(e){_.push({target:t,outputPath:``,success:!1,error:e instanceof Error?e.message:String(e)})}return{specPath:e,specInfo:h,results:_}}async function o(r,i,a,o,s,l,u,d,f){let{fs:p,logger:m}=l,h,g;switch(r){case`handler`:{if(s!==`operation`)return{target:r,outputPath:``,success:!1,skipped:!0,error:`Handler generation only supported for operation specs (got ${s})`};let e=o.kind===`command`||o.kind===`query`?o.kind:`command`;h=t(o.name??`unknown`,e),g=c(i,u,`handlers`,o.name??`unknown`,`.handler.ts`,l.fs);break}case`component`:if(s!==`presentation`)return{target:r,outputPath:``,success:!1,skipped:!0,error:`Component generation only supported for presentation specs (got ${s})`};h=e(o.name??`unknown`,o.description??``),g=c(i,u,`components`,o.name??`unknown`,`.tsx`,l.fs);break;case`test`:{let e=s===`operation`?`handler`:`component`;h=n(o.name??`unknown`,e),g=c(i,u,`__tests__`,o.name??`unknown`,`.test.ts`,l.fs);break}default:return{target:r,outputPath:``,success:!1,error:`Unknown target: ${r}`}}if(await p.exists(g)&&!d)return{target:r,outputPath:g,success:!1,skipped:!0,error:`File already exists (use overwrite option)`};if(f)return m.info(`[dry-run] Would write: ${g}`),{target:r,outputPath:g,success:!0};let _=p.dirname(g);return await p.mkdir(_),await p.writeFile(g,h),m.info(`Generated: ${g}`),{target:r,outputPath:g,success:!0}}function s(e){switch(r(e)){case`operation`:return[`handler`];case`presentation`:return[`component`];default:return[]}}function c(e,t,n,r,i,a){let o=l(r.split(`.`).pop()??`unknown`),s;return s=t.startsWith(`.`)?a.resolve(a.dirname(e),`..`,t,n):a.resolve(t,n),a.join(s,`${o}${i}`)}function l(e){return e.replace(/\./g,`-`).replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}export{a as buildSpec};
|
|
@@ -1,393 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { validateSpecStructure } from "../../modules/contractspec-workspace/dist/analysis/validate/spec-structure.js";
|
|
3
|
-
import { validateImplementationFiles } from "../validate-implementation.js";
|
|
4
|
-
import { analyzeDeps } from "../deps.js";
|
|
5
|
-
import { loadWorkspaceConfig } from "../config.js";
|
|
6
|
-
import { analyzeIntegrity } from "../integrity.js";
|
|
7
|
-
import { runDoctor } from "../doctor/doctor-service.js";
|
|
8
|
-
import { resolveAllImplementations } from "../implementation/resolver.js";
|
|
9
|
-
import "../verification-cache/index.js";
|
|
10
|
-
|
|
11
|
-
//#region src/services/ci-check/ci-check-service.ts
|
|
12
|
-
/**
|
|
13
|
-
* CI Check service.
|
|
14
|
-
*
|
|
15
|
-
* Orchestrates all validation checks for CI/CD pipelines.
|
|
16
|
-
* Returns structured results suitable for multiple output formats.
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* Run all CI checks and return structured results.
|
|
20
|
-
*/
|
|
21
|
-
async function runCIChecks(adapters, options = {}) {
|
|
22
|
-
const startTime = Date.now();
|
|
23
|
-
const { fs, logger } = adapters;
|
|
24
|
-
const issues = [];
|
|
25
|
-
const categorySummaries = [];
|
|
26
|
-
const checksToRun = getChecksToRun(options);
|
|
27
|
-
logger.info("Starting CI checks...", { checks: checksToRun });
|
|
28
|
-
const specFiles = (await fs.glob({ pattern: options.pattern })).filter((f) => !isFeatureFile(f) && !f.includes(".test.") && !f.includes(".spec."));
|
|
29
|
-
if (checksToRun.includes("structure")) {
|
|
30
|
-
const categoryStart = Date.now();
|
|
31
|
-
const structureIssues = await runStructureChecks(adapters, specFiles);
|
|
32
|
-
issues.push(...structureIssues);
|
|
33
|
-
categorySummaries.push(createCategorySummary("structure", structureIssues, Date.now() - categoryStart));
|
|
34
|
-
}
|
|
35
|
-
if (checksToRun.includes("integrity")) {
|
|
36
|
-
const categoryStart = Date.now();
|
|
37
|
-
const integrityIssues = await runIntegrityChecks(adapters, options);
|
|
38
|
-
issues.push(...integrityIssues);
|
|
39
|
-
categorySummaries.push(createCategorySummary("integrity", integrityIssues, Date.now() - categoryStart));
|
|
40
|
-
}
|
|
41
|
-
if (checksToRun.includes("deps")) {
|
|
42
|
-
const categoryStart = Date.now();
|
|
43
|
-
const depsIssues = await runDepsChecks(adapters, options);
|
|
44
|
-
issues.push(...depsIssues);
|
|
45
|
-
categorySummaries.push(createCategorySummary("deps", depsIssues, Date.now() - categoryStart));
|
|
46
|
-
}
|
|
47
|
-
if (checksToRun.includes("doctor")) {
|
|
48
|
-
const categoryStart = Date.now();
|
|
49
|
-
const doctorIssues = await runDoctorChecks(adapters, options);
|
|
50
|
-
issues.push(...doctorIssues);
|
|
51
|
-
categorySummaries.push(createCategorySummary("doctor", doctorIssues, Date.now() - categoryStart));
|
|
52
|
-
}
|
|
53
|
-
if (checksToRun.includes("handlers") || options.checkHandlers) {
|
|
54
|
-
const categoryStart = Date.now();
|
|
55
|
-
const handlerIssues = await runHandlerChecks(adapters, specFiles);
|
|
56
|
-
issues.push(...handlerIssues);
|
|
57
|
-
categorySummaries.push(createCategorySummary("handlers", handlerIssues, Date.now() - categoryStart));
|
|
58
|
-
}
|
|
59
|
-
if (checksToRun.includes("tests") || options.checkTests) {
|
|
60
|
-
const categoryStart = Date.now();
|
|
61
|
-
const testIssues = await runTestChecks(adapters, specFiles);
|
|
62
|
-
issues.push(...testIssues);
|
|
63
|
-
categorySummaries.push(createCategorySummary("tests", testIssues, Date.now() - categoryStart));
|
|
64
|
-
}
|
|
65
|
-
if (checksToRun.includes("implementation")) {
|
|
66
|
-
const categoryStart = Date.now();
|
|
67
|
-
const implIssues = await runImplementationChecks(adapters, specFiles, options);
|
|
68
|
-
issues.push(...implIssues);
|
|
69
|
-
categorySummaries.push(createCategorySummary("implementation", implIssues, Date.now() - categoryStart));
|
|
70
|
-
}
|
|
71
|
-
const totalErrors = issues.filter((i) => i.severity === "error").length;
|
|
72
|
-
const totalWarnings = issues.filter((i) => i.severity === "warning").length;
|
|
73
|
-
const totalNotes = issues.filter((i) => i.severity === "note").length;
|
|
74
|
-
const success = options.failOnWarnings ? totalErrors === 0 && totalWarnings === 0 : totalErrors === 0;
|
|
75
|
-
const gitInfo = await getGitInfo(fs);
|
|
76
|
-
const result = {
|
|
77
|
-
success,
|
|
78
|
-
totalErrors,
|
|
79
|
-
totalWarnings,
|
|
80
|
-
totalNotes,
|
|
81
|
-
issues,
|
|
82
|
-
categories: categorySummaries,
|
|
83
|
-
durationMs: Date.now() - startTime,
|
|
84
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
85
|
-
...gitInfo
|
|
86
|
-
};
|
|
87
|
-
logger.info("CI checks complete", {
|
|
88
|
-
success,
|
|
89
|
-
errors: totalErrors,
|
|
90
|
-
warnings: totalWarnings,
|
|
91
|
-
durationMs: result.durationMs
|
|
92
|
-
});
|
|
93
|
-
return result;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Determine which checks to run based on options.
|
|
97
|
-
*/
|
|
98
|
-
function getChecksToRun(options) {
|
|
99
|
-
const allCategories = [
|
|
100
|
-
"structure",
|
|
101
|
-
"integrity",
|
|
102
|
-
"deps",
|
|
103
|
-
"doctor"
|
|
104
|
-
];
|
|
105
|
-
if (options.checkHandlers) allCategories.push("handlers");
|
|
106
|
-
if (options.checkTests) allCategories.push("tests");
|
|
107
|
-
if (options.implementation) allCategories.push("implementation");
|
|
108
|
-
if (options.checks && options.checks.length > 0) return options.checks;
|
|
109
|
-
if (options.skip && options.skip.length > 0) return allCategories.filter((c) => !options.skip?.includes(c));
|
|
110
|
-
return allCategories;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Run spec structure validation checks.
|
|
114
|
-
*/
|
|
115
|
-
async function runStructureChecks(adapters, specFiles) {
|
|
116
|
-
const { fs } = adapters;
|
|
117
|
-
const issues = [];
|
|
118
|
-
for (const file of specFiles) {
|
|
119
|
-
const result = validateSpecStructure(await fs.readFile(file), fs.basename(file));
|
|
120
|
-
for (const error of result.errors) issues.push({
|
|
121
|
-
ruleId: "spec-structure-error",
|
|
122
|
-
severity: "error",
|
|
123
|
-
message: error,
|
|
124
|
-
category: "structure",
|
|
125
|
-
file
|
|
126
|
-
});
|
|
127
|
-
for (const warning of result.warnings) issues.push({
|
|
128
|
-
ruleId: "spec-structure-warning",
|
|
129
|
-
severity: "warning",
|
|
130
|
-
message: warning,
|
|
131
|
-
category: "structure",
|
|
132
|
-
file
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
return issues;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Run integrity analysis checks.
|
|
139
|
-
*/
|
|
140
|
-
async function runIntegrityChecks(adapters, options) {
|
|
141
|
-
const issues = [];
|
|
142
|
-
const result = await analyzeIntegrity(adapters, {
|
|
143
|
-
pattern: options.pattern,
|
|
144
|
-
all: true
|
|
145
|
-
});
|
|
146
|
-
for (const issue of result.issues) issues.push({
|
|
147
|
-
ruleId: `integrity-${issue.type}`,
|
|
148
|
-
severity: issue.severity === "error" ? "error" : "warning",
|
|
149
|
-
message: issue.message,
|
|
150
|
-
category: "integrity",
|
|
151
|
-
file: issue.file,
|
|
152
|
-
context: {
|
|
153
|
-
specName: issue.specName,
|
|
154
|
-
specType: issue.specType,
|
|
155
|
-
featureKey: issue.featureKey,
|
|
156
|
-
ref: issue.ref
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
return issues;
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Run dependency analysis checks.
|
|
163
|
-
*/
|
|
164
|
-
async function runDepsChecks(adapters, options) {
|
|
165
|
-
const issues = [];
|
|
166
|
-
const result = await analyzeDeps(adapters, { pattern: options.pattern });
|
|
167
|
-
for (const cycle of result.cycles) issues.push({
|
|
168
|
-
ruleId: "deps-circular",
|
|
169
|
-
severity: "error",
|
|
170
|
-
message: `Circular dependency detected: ${cycle.join(" → ")}`,
|
|
171
|
-
category: "deps",
|
|
172
|
-
context: { cycle }
|
|
173
|
-
});
|
|
174
|
-
for (const item of result.missing) for (const missing of item.missing) issues.push({
|
|
175
|
-
ruleId: "deps-missing",
|
|
176
|
-
severity: "error",
|
|
177
|
-
message: `Missing dependency: ${item.contract} requires ${missing}`,
|
|
178
|
-
category: "deps",
|
|
179
|
-
context: {
|
|
180
|
-
contract: item.contract,
|
|
181
|
-
missing
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
return issues;
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Run doctor checks (skipping AI in CI).
|
|
188
|
-
*/
|
|
189
|
-
async function runDoctorChecks(adapters, options) {
|
|
190
|
-
const issues = [];
|
|
191
|
-
const result = await runDoctor(adapters, {
|
|
192
|
-
workspaceRoot: options.workspaceRoot ?? process.cwd(),
|
|
193
|
-
skipAi: true,
|
|
194
|
-
categories: [
|
|
195
|
-
"cli",
|
|
196
|
-
"config",
|
|
197
|
-
"deps",
|
|
198
|
-
"workspace"
|
|
199
|
-
]
|
|
200
|
-
});
|
|
201
|
-
for (const check of result.checks) if (check.status === "fail") issues.push({
|
|
202
|
-
ruleId: `doctor-${check.category}-${check.name.toLowerCase().replace(/\s+/g, "-")}`,
|
|
203
|
-
severity: "error",
|
|
204
|
-
message: `${check.name}: ${check.message}`,
|
|
205
|
-
category: "doctor",
|
|
206
|
-
context: { details: check.details }
|
|
207
|
-
});
|
|
208
|
-
else if (check.status === "warn") issues.push({
|
|
209
|
-
ruleId: `doctor-${check.category}-${check.name.toLowerCase().replace(/\s+/g, "-")}`,
|
|
210
|
-
severity: "warning",
|
|
211
|
-
message: `${check.name}: ${check.message}`,
|
|
212
|
-
category: "doctor",
|
|
213
|
-
context: { details: check.details }
|
|
214
|
-
});
|
|
215
|
-
return issues;
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Run handler implementation checks.
|
|
219
|
-
*/
|
|
220
|
-
async function runHandlerChecks(adapters, specFiles) {
|
|
221
|
-
const { fs } = adapters;
|
|
222
|
-
const issues = [];
|
|
223
|
-
const config = await loadWorkspaceConfig(fs);
|
|
224
|
-
for (const specFile of specFiles) {
|
|
225
|
-
if (!specFile.includes(".contracts.")) continue;
|
|
226
|
-
const result = await validateImplementationFiles(specFile, { fs }, config, {
|
|
227
|
-
checkHandlers: true,
|
|
228
|
-
outputDir: config.outputDir
|
|
229
|
-
});
|
|
230
|
-
for (const error of result.errors) issues.push({
|
|
231
|
-
ruleId: "handler-missing",
|
|
232
|
-
severity: "warning",
|
|
233
|
-
message: error,
|
|
234
|
-
category: "handlers",
|
|
235
|
-
file: specFile
|
|
236
|
-
});
|
|
237
|
-
for (const warning of result.warnings) issues.push({
|
|
238
|
-
ruleId: "handler-warning",
|
|
239
|
-
severity: "warning",
|
|
240
|
-
message: warning,
|
|
241
|
-
category: "handlers",
|
|
242
|
-
file: specFile
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
return issues;
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Run test coverage checks.
|
|
249
|
-
*/
|
|
250
|
-
async function runTestChecks(adapters, specFiles) {
|
|
251
|
-
const { fs } = adapters;
|
|
252
|
-
const issues = [];
|
|
253
|
-
const config = await loadWorkspaceConfig(fs);
|
|
254
|
-
for (const specFile of specFiles) {
|
|
255
|
-
if (!specFile.includes(".contracts.")) continue;
|
|
256
|
-
const result = await validateImplementationFiles(specFile, { fs }, config, {
|
|
257
|
-
checkTests: true,
|
|
258
|
-
outputDir: config.outputDir
|
|
259
|
-
});
|
|
260
|
-
for (const error of result.errors) issues.push({
|
|
261
|
-
ruleId: "test-missing",
|
|
262
|
-
severity: "warning",
|
|
263
|
-
message: error,
|
|
264
|
-
category: "tests",
|
|
265
|
-
file: specFile
|
|
266
|
-
});
|
|
267
|
-
for (const warning of result.warnings) issues.push({
|
|
268
|
-
ruleId: "test-warning",
|
|
269
|
-
severity: "warning",
|
|
270
|
-
message: warning,
|
|
271
|
-
category: "tests",
|
|
272
|
-
file: specFile
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
return issues;
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* Run implementation verification checks.
|
|
279
|
-
*/
|
|
280
|
-
async function runImplementationChecks(adapters, specFiles, options) {
|
|
281
|
-
const { fs } = adapters;
|
|
282
|
-
const issues = [];
|
|
283
|
-
const config = await loadWorkspaceConfig(fs);
|
|
284
|
-
const implOptions = options.implementation ?? {};
|
|
285
|
-
const results = await resolveAllImplementations(specFiles.filter((f) => f.includes(".contracts.")), { fs }, config, { computeHashes: implOptions.useCache ?? true });
|
|
286
|
-
for (const result of results) {
|
|
287
|
-
if (implOptions.requireImplemented && result.status === "missing") issues.push({
|
|
288
|
-
ruleId: "impl-missing",
|
|
289
|
-
severity: "error",
|
|
290
|
-
message: `Spec ${result.specName} has no implementation`,
|
|
291
|
-
category: "implementation",
|
|
292
|
-
file: result.specPath,
|
|
293
|
-
context: {
|
|
294
|
-
specName: result.specName,
|
|
295
|
-
specVersion: result.specVersion,
|
|
296
|
-
status: result.status
|
|
297
|
-
}
|
|
298
|
-
});
|
|
299
|
-
else if (result.status === "missing") issues.push({
|
|
300
|
-
ruleId: "impl-missing",
|
|
301
|
-
severity: "warning",
|
|
302
|
-
message: `Spec ${result.specName} has no implementation`,
|
|
303
|
-
category: "implementation",
|
|
304
|
-
file: result.specPath,
|
|
305
|
-
context: {
|
|
306
|
-
specName: result.specName,
|
|
307
|
-
specVersion: result.specVersion,
|
|
308
|
-
status: result.status
|
|
309
|
-
}
|
|
310
|
-
});
|
|
311
|
-
if (!implOptions.allowPartial && result.status === "partial") {
|
|
312
|
-
const missingImpls = result.implementations.filter((i) => !i.exists && i.type !== "test").map((i) => i.path);
|
|
313
|
-
issues.push({
|
|
314
|
-
ruleId: "impl-partial",
|
|
315
|
-
severity: "warning",
|
|
316
|
-
message: `Spec ${result.specName} has partial implementation: missing ${missingImpls.join(", ")}`,
|
|
317
|
-
category: "implementation",
|
|
318
|
-
file: result.specPath,
|
|
319
|
-
context: {
|
|
320
|
-
specName: result.specName,
|
|
321
|
-
specVersion: result.specVersion,
|
|
322
|
-
status: result.status,
|
|
323
|
-
missingFiles: missingImpls
|
|
324
|
-
}
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
const missingTests = result.implementations.filter((i) => !i.exists && i.type === "test");
|
|
328
|
-
if (missingTests.length > 0) issues.push({
|
|
329
|
-
ruleId: "impl-missing-tests",
|
|
330
|
-
severity: "note",
|
|
331
|
-
message: `Spec ${result.specName} missing test files: ${missingTests.map((t) => t.path).join(", ")}`,
|
|
332
|
-
category: "implementation",
|
|
333
|
-
file: result.specPath,
|
|
334
|
-
context: {
|
|
335
|
-
specName: result.specName,
|
|
336
|
-
missingTests: missingTests.map((t) => t.path)
|
|
337
|
-
}
|
|
338
|
-
});
|
|
339
|
-
}
|
|
340
|
-
return issues;
|
|
341
|
-
}
|
|
342
|
-
/**
|
|
343
|
-
* Create a category summary from issues.
|
|
344
|
-
*/
|
|
345
|
-
function createCategorySummary(category, issues, durationMs) {
|
|
346
|
-
const categoryLabels = {
|
|
347
|
-
structure: "Spec Structure Validation",
|
|
348
|
-
integrity: "Contract Integrity Analysis",
|
|
349
|
-
deps: "Dependency Analysis",
|
|
350
|
-
doctor: "Installation Health",
|
|
351
|
-
handlers: "Handler Implementation",
|
|
352
|
-
tests: "Test Coverage",
|
|
353
|
-
implementation: "Implementation Verification"
|
|
354
|
-
};
|
|
355
|
-
const errors = issues.filter((i) => i.severity === "error").length;
|
|
356
|
-
const warnings = issues.filter((i) => i.severity === "warning").length;
|
|
357
|
-
const notes = issues.filter((i) => i.severity === "note").length;
|
|
358
|
-
return {
|
|
359
|
-
category,
|
|
360
|
-
label: categoryLabels[category],
|
|
361
|
-
errors,
|
|
362
|
-
warnings,
|
|
363
|
-
notes,
|
|
364
|
-
passed: errors === 0,
|
|
365
|
-
durationMs
|
|
366
|
-
};
|
|
367
|
-
}
|
|
368
|
-
/**
|
|
369
|
-
* Get git information if available.
|
|
370
|
-
*/
|
|
371
|
-
async function getGitInfo(fs) {
|
|
372
|
-
try {
|
|
373
|
-
const gitHeadPath = ".git/HEAD";
|
|
374
|
-
if (!await fs.exists(gitHeadPath)) return {};
|
|
375
|
-
const headContent = await fs.readFile(gitHeadPath);
|
|
376
|
-
const refMatch = headContent.match(/^ref: (.+)$/m);
|
|
377
|
-
if (refMatch) {
|
|
378
|
-
const branch = refMatch[1]?.replace("refs/heads/", "");
|
|
379
|
-
const refPath = `.git/${refMatch[1]}`;
|
|
380
|
-
if (await fs.exists(refPath)) return {
|
|
381
|
-
commitSha: (await fs.readFile(refPath)).trim(),
|
|
382
|
-
branch
|
|
383
|
-
};
|
|
384
|
-
return { branch };
|
|
385
|
-
}
|
|
386
|
-
return { commitSha: headContent.trim() };
|
|
387
|
-
} catch {
|
|
388
|
-
return {};
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
//#endregion
|
|
393
|
-
export { runCIChecks };
|
|
1
|
+
import{validateImplementationFiles as e}from"../validate-implementation.js";import{analyzeDeps as t}from"../deps.js";import{loadWorkspaceConfig as n}from"../config.js";import{analyzeIntegrity as r}from"../integrity.js";import{runDoctor as i}from"../doctor/doctor-service.js";import{resolveAllImplementations as a}from"../implementation/resolver.js";import"../verification-cache/index.js";import{isFeatureFile as o,validateSpecStructure as s}from"@lssm/module.contractspec-workspace";async function c(e,t={}){let n=Date.now(),{fs:r,logger:i}=e,a=[],s=[],c=l(t);i.info(`Starting CI checks...`,{checks:c});let y=(await r.glob({pattern:t.pattern})).filter(e=>!o(e)&&!e.includes(`.test.`)&&!e.includes(`.spec.`));if(c.includes(`structure`)){let t=Date.now(),n=await u(e,y);a.push(...n),s.push(_(`structure`,n,Date.now()-t))}if(c.includes(`integrity`)){let n=Date.now(),r=await d(e,t);a.push(...r),s.push(_(`integrity`,r,Date.now()-n))}if(c.includes(`deps`)){let n=Date.now(),r=await f(e,t);a.push(...r),s.push(_(`deps`,r,Date.now()-n))}if(c.includes(`doctor`)){let n=Date.now(),r=await p(e,t);a.push(...r),s.push(_(`doctor`,r,Date.now()-n))}if(c.includes(`handlers`)||t.checkHandlers){let t=Date.now(),n=await m(e,y);a.push(...n),s.push(_(`handlers`,n,Date.now()-t))}if(c.includes(`tests`)||t.checkTests){let t=Date.now(),n=await h(e,y);a.push(...n),s.push(_(`tests`,n,Date.now()-t))}if(c.includes(`implementation`)){let n=Date.now(),r=await g(e,y,t);a.push(...r),s.push(_(`implementation`,r,Date.now()-n))}let b=a.filter(e=>e.severity===`error`).length,x=a.filter(e=>e.severity===`warning`).length,S=a.filter(e=>e.severity===`note`).length,C=t.failOnWarnings?b===0&&x===0:b===0,w=await v(r),T={success:C,totalErrors:b,totalWarnings:x,totalNotes:S,issues:a,categories:s,durationMs:Date.now()-n,timestamp:new Date().toISOString(),...w};return i.info(`CI checks complete`,{success:C,errors:b,warnings:x,durationMs:T.durationMs}),T}function l(e){let t=[`structure`,`integrity`,`deps`,`doctor`];return e.checkHandlers&&t.push(`handlers`),e.checkTests&&t.push(`tests`),e.implementation&&t.push(`implementation`),e.checks&&e.checks.length>0?e.checks:e.skip&&e.skip.length>0?t.filter(t=>!e.skip?.includes(t)):t}async function u(e,t){let{fs:n}=e,r=[];for(let e of t){let t=s(await n.readFile(e),n.basename(e));for(let n of t.errors)r.push({ruleId:`spec-structure-error`,severity:`error`,message:n,category:`structure`,file:e});for(let n of t.warnings)r.push({ruleId:`spec-structure-warning`,severity:`warning`,message:n,category:`structure`,file:e})}return r}async function d(e,t){let n=[],i=await r(e,{pattern:t.pattern,all:!0});for(let e of i.issues)n.push({ruleId:`integrity-${e.type}`,severity:e.severity===`error`?`error`:`warning`,message:e.message,category:`integrity`,file:e.file,context:{specName:e.specName,specType:e.specType,featureKey:e.featureKey,ref:e.ref}});return n}async function f(e,n){let r=[],i=await t(e,{pattern:n.pattern});for(let e of i.cycles)r.push({ruleId:`deps-circular`,severity:`error`,message:`Circular dependency detected: ${e.join(` → `)}`,category:`deps`,context:{cycle:e}});for(let e of i.missing)for(let t of e.missing)r.push({ruleId:`deps-missing`,severity:`error`,message:`Missing dependency: ${e.contract} requires ${t}`,category:`deps`,context:{contract:e.contract,missing:t}});return r}async function p(e,t){let n=[],r=await i(e,{workspaceRoot:t.workspaceRoot??process.cwd(),skipAi:!0,categories:[`cli`,`config`,`deps`,`workspace`]});for(let e of r.checks)e.status===`fail`?n.push({ruleId:`doctor-${e.category}-${e.name.toLowerCase().replace(/\s+/g,`-`)}`,severity:`error`,message:`${e.name}: ${e.message}`,category:`doctor`,context:{details:e.details}}):e.status===`warn`&&n.push({ruleId:`doctor-${e.category}-${e.name.toLowerCase().replace(/\s+/g,`-`)}`,severity:`warning`,message:`${e.name}: ${e.message}`,category:`doctor`,context:{details:e.details}});return n}async function m(t,r){let{fs:i}=t,a=[],o=await n(i);for(let t of r){if(!t.includes(`.contracts.`))continue;let n=await e(t,{fs:i},o,{checkHandlers:!0,outputDir:o.outputDir});for(let e of n.errors)a.push({ruleId:`handler-missing`,severity:`warning`,message:e,category:`handlers`,file:t});for(let e of n.warnings)a.push({ruleId:`handler-warning`,severity:`warning`,message:e,category:`handlers`,file:t})}return a}async function h(t,r){let{fs:i}=t,a=[],o=await n(i);for(let t of r){if(!t.includes(`.contracts.`))continue;let n=await e(t,{fs:i},o,{checkTests:!0,outputDir:o.outputDir});for(let e of n.errors)a.push({ruleId:`test-missing`,severity:`warning`,message:e,category:`tests`,file:t});for(let e of n.warnings)a.push({ruleId:`test-warning`,severity:`warning`,message:e,category:`tests`,file:t})}return a}async function g(e,t,r){let{fs:i}=e,o=[],s=await n(i),c=r.implementation??{},l=await a(t.filter(e=>e.includes(`.contracts.`)),{fs:i},s,{computeHashes:c.useCache??!0});for(let e of l){if(c.requireImplemented&&e.status===`missing`?o.push({ruleId:`impl-missing`,severity:`error`,message:`Spec ${e.specName} has no implementation`,category:`implementation`,file:e.specPath,context:{specName:e.specName,specVersion:e.specVersion,status:e.status}}):e.status===`missing`&&o.push({ruleId:`impl-missing`,severity:`warning`,message:`Spec ${e.specName} has no implementation`,category:`implementation`,file:e.specPath,context:{specName:e.specName,specVersion:e.specVersion,status:e.status}}),!c.allowPartial&&e.status===`partial`){let t=e.implementations.filter(e=>!e.exists&&e.type!==`test`).map(e=>e.path);o.push({ruleId:`impl-partial`,severity:`warning`,message:`Spec ${e.specName} has partial implementation: missing ${t.join(`, `)}`,category:`implementation`,file:e.specPath,context:{specName:e.specName,specVersion:e.specVersion,status:e.status,missingFiles:t}})}let t=e.implementations.filter(e=>!e.exists&&e.type===`test`);t.length>0&&o.push({ruleId:`impl-missing-tests`,severity:`note`,message:`Spec ${e.specName} missing test files: ${t.map(e=>e.path).join(`, `)}`,category:`implementation`,file:e.specPath,context:{specName:e.specName,missingTests:t.map(e=>e.path)}})}return o}function _(e,t,n){let r={structure:`Spec Structure Validation`,integrity:`Contract Integrity Analysis`,deps:`Dependency Analysis`,doctor:`Installation Health`,handlers:`Handler Implementation`,tests:`Test Coverage`,implementation:`Implementation Verification`},i=t.filter(e=>e.severity===`error`).length,a=t.filter(e=>e.severity===`warning`).length,o=t.filter(e=>e.severity===`note`).length;return{category:e,label:r[e],errors:i,warnings:a,notes:o,passed:i===0,durationMs:n}}async function v(e){try{let t=`.git/HEAD`;if(!await e.exists(t))return{};let n=await e.readFile(t),r=n.match(/^ref: (.+)$/m);if(r){let t=r[1]?.replace(`refs/heads/`,``),n=`.git/${r[1]}`;return await e.exists(n)?{commitSha:(await e.readFile(n)).trim(),branch:t}:{branch:t}}return{commitSha:n.trim()}}catch{return{}}}export{c as runCIChecks};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { runCIChecks } from "./ci-check-service.js";
|
|
1
|
+
import{ALL_CI_CHECK_CATEGORIES as e,CI_CHECK_CATEGORY_LABELS as t}from"./types.js";import{runCIChecks as n}from"./ci-check-service.js";
|
|
@@ -1,28 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* All available CI check categories.
|
|
4
|
-
*/
|
|
5
|
-
const ALL_CI_CHECK_CATEGORIES = [
|
|
6
|
-
"structure",
|
|
7
|
-
"integrity",
|
|
8
|
-
"deps",
|
|
9
|
-
"doctor",
|
|
10
|
-
"handlers",
|
|
11
|
-
"tests",
|
|
12
|
-
"implementation"
|
|
13
|
-
];
|
|
14
|
-
/**
|
|
15
|
-
* Human-readable labels for CI check categories.
|
|
16
|
-
*/
|
|
17
|
-
const CI_CHECK_CATEGORY_LABELS = {
|
|
18
|
-
structure: "Spec Structure Validation",
|
|
19
|
-
integrity: "Contract Integrity Analysis",
|
|
20
|
-
deps: "Dependency Analysis",
|
|
21
|
-
doctor: "Installation Health",
|
|
22
|
-
handlers: "Handler Implementation",
|
|
23
|
-
tests: "Test Coverage",
|
|
24
|
-
implementation: "Implementation Verification"
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
//#endregion
|
|
28
|
-
export { ALL_CI_CHECK_CATEGORIES, CI_CHECK_CATEGORY_LABELS };
|
|
1
|
+
const e=[`structure`,`integrity`,`deps`,`doctor`,`handlers`,`tests`,`implementation`],t={structure:`Spec Structure Validation`,integrity:`Contract Integrity Analysis`,deps:`Dependency Analysis`,doctor:`Installation Health`,handlers:`Handler Implementation`,tests:`Test Coverage`,implementation:`Implementation Verification`};export{e as ALL_CI_CHECK_CATEGORIES,t as CI_CHECK_CATEGORY_LABELS};
|
package/dist/services/clean.js
CHANGED
|
@@ -1,71 +1 @@
|
|
|
1
|
-
|
|
2
|
-
async function cleanArtifacts(adapters, options = {}) {
|
|
3
|
-
const { fs, logger } = adapters;
|
|
4
|
-
const outputDir = (options.outputDir ?? "./src").replace(/\\/g, "/");
|
|
5
|
-
const basePatterns = [
|
|
6
|
-
"generated/**",
|
|
7
|
-
"dist/**",
|
|
8
|
-
".turbo/**"
|
|
9
|
-
];
|
|
10
|
-
const outputDirPatterns = [
|
|
11
|
-
`${outputDir}/handlers/**/*.handler.ts`,
|
|
12
|
-
`${outputDir}/handlers/**/*.handler.test.ts`,
|
|
13
|
-
`${outputDir}/components/**/*.tsx`,
|
|
14
|
-
`${outputDir}/components/**/*.test.tsx`,
|
|
15
|
-
`${outputDir}/forms/**/*.form.tsx`,
|
|
16
|
-
`${outputDir}/forms/**/*.form.test.tsx`,
|
|
17
|
-
`${outputDir}/**/*.runner.ts`,
|
|
18
|
-
`${outputDir}/**/*.renderer.tsx`
|
|
19
|
-
];
|
|
20
|
-
const patterns = options.generatedOnly ? [...basePatterns, ...outputDirPatterns] : [
|
|
21
|
-
...basePatterns,
|
|
22
|
-
"**/*.generated.ts",
|
|
23
|
-
"**/*.generated.js",
|
|
24
|
-
"**/*.generated.d.ts",
|
|
25
|
-
...outputDirPatterns
|
|
26
|
-
];
|
|
27
|
-
const candidates = await fs.glob({
|
|
28
|
-
patterns,
|
|
29
|
-
ignore: ["node_modules/**"]
|
|
30
|
-
});
|
|
31
|
-
const removed = [];
|
|
32
|
-
const skipped = [];
|
|
33
|
-
for (const p of candidates) try {
|
|
34
|
-
const st = await fs.stat(p);
|
|
35
|
-
const ageDays = (Date.now() - st.mtime.getTime()) / (1e3 * 60 * 60 * 24);
|
|
36
|
-
if (typeof options.olderThanDays === "number" && ageDays < options.olderThanDays) {
|
|
37
|
-
skipped.push({
|
|
38
|
-
path: p,
|
|
39
|
-
reason: `younger_than_${options.olderThanDays}_days`
|
|
40
|
-
});
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
if (options.dryRun) logger.info("[dry-run] clean would remove", {
|
|
44
|
-
path: p,
|
|
45
|
-
size: st.size
|
|
46
|
-
});
|
|
47
|
-
else {
|
|
48
|
-
await fs.remove(p);
|
|
49
|
-
logger.info("clean.removed", {
|
|
50
|
-
path: p,
|
|
51
|
-
size: st.size
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
removed.push({
|
|
55
|
-
path: p,
|
|
56
|
-
size: st.size
|
|
57
|
-
});
|
|
58
|
-
} catch (error) {
|
|
59
|
-
skipped.push({
|
|
60
|
-
path: p,
|
|
61
|
-
reason: error instanceof Error ? error.message : String(error)
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
return {
|
|
65
|
-
removed,
|
|
66
|
-
skipped
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
//#endregion
|
|
71
|
-
export { cleanArtifacts };
|
|
1
|
+
async function e(e,t={}){let{fs:n,logger:r}=e,i=(t.outputDir??`./src`).replace(/\\/g,`/`),a=[`generated/**`,`dist/**`,`.turbo/**`],o=[`${i}/handlers/**/*.handler.ts`,`${i}/handlers/**/*.handler.test.ts`,`${i}/components/**/*.tsx`,`${i}/components/**/*.test.tsx`,`${i}/forms/**/*.form.tsx`,`${i}/forms/**/*.form.test.tsx`,`${i}/**/*.runner.ts`,`${i}/**/*.renderer.tsx`],s=t.generatedOnly?[...a,...o]:[...a,`**/*.generated.ts`,`**/*.generated.js`,`**/*.generated.d.ts`,...o],c=await n.glob({patterns:s,ignore:[`node_modules/**`]}),l=[],u=[];for(let e of c)try{let i=await n.stat(e),a=(Date.now()-i.mtime.getTime())/(1e3*60*60*24);if(typeof t.olderThanDays==`number`&&a<t.olderThanDays){u.push({path:e,reason:`younger_than_${t.olderThanDays}_days`});continue}t.dryRun?r.info(`[dry-run] clean would remove`,{path:e,size:i.size}):(await n.remove(e),r.info(`clean.removed`,{path:e,size:i.size})),l.push({path:e,size:i.size})}catch(t){u.push({path:e,reason:t instanceof Error?t.message:String(t)})}return{removed:l,skipped:u}}export{e as cleanArtifacts};
|