@lssm/bundle.contractspec-workspace 0.0.0-canary-20251217063201 → 0.0.0-canary-20251217072406
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/rolldown_runtime.js +22 -1
- package/dist/adapters/ai.js +82 -1
- package/dist/adapters/factory.js +36 -1
- package/dist/adapters/fs.js +118 -1
- package/dist/adapters/git.js +54 -1
- package/dist/adapters/index.js +7 -1
- package/dist/adapters/logger.js +80 -1
- package/dist/adapters/watcher.js +69 -1
- package/dist/adapters/workspace.js +190 -2
- package/dist/ai/agents/claude-code-agent.js +146 -9
- package/dist/ai/agents/cursor-agent.js +286 -17
- package/dist/ai/agents/index.js +5 -1
- package/dist/ai/agents/openai-codex-agent.js +140 -8
- package/dist/ai/agents/orchestrator.js +142 -1
- package/dist/ai/agents/simple-agent.js +80 -4
- package/dist/ai/client.js +162 -1
- package/dist/ai/index.js +27 -1
- package/dist/ai/prompts/code-generation.js +55 -13
- package/dist/ai/prompts/index.js +12 -1
- package/dist/ai/prompts/spec-creation.js +61 -20
- package/dist/ai/providers.js +40 -1
- package/dist/formatters/index.js +18 -1
- package/dist/formatters/json.js +71 -1
- package/dist/formatters/sarif.js +163 -1
- package/dist/formatters/text.js +208 -2
- package/dist/index.js +81 -1
- package/dist/libs/ai-providers/dist/factory.js +154 -1
- package/dist/libs/ai-providers/dist/index.js +4 -1
- package/dist/libs/ai-providers/dist/legacy.js +72 -1
- package/dist/libs/ai-providers/dist/models.js +287 -1
- package/dist/libs/ai-providers/dist/validation.js +1 -1
- package/dist/libs/contracts/dist/capabilities/openbanking.js +88 -1
- package/dist/libs/contracts/dist/client/index.js +5 -1
- package/dist/libs/contracts/dist/client/react/feature-render.js +2 -1
- package/dist/libs/contracts/dist/client/react/form-render.js +4 -1
- package/dist/libs/contracts/dist/client/react/index.js +4 -1
- package/dist/libs/contracts/dist/contract-registry/index.js +1 -1
- package/dist/libs/contracts/dist/contract-registry/schemas.js +60 -1
- package/dist/libs/contracts/dist/docs/PUBLISHING.docblock.js +16 -76
- package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +16 -350
- package/dist/libs/contracts/dist/docs/index.js +29 -1
- package/dist/libs/contracts/dist/docs/presentations.js +71 -1
- package/dist/libs/contracts/dist/docs/registry.js +44 -1
- package/dist/libs/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +16 -383
- package/dist/libs/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +16 -68
- package/dist/libs/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +16 -140
- package/dist/libs/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +16 -86
- package/dist/libs/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +16 -1
- package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +24 -2
- package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +21 -2
- package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +16 -213
- package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js +73 -5
- package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js +37 -1
- package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js +16 -1
- package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js +20 -262
- package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js +48 -1
- package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +24 -2
- package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +23 -2
- package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +25 -16
- package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js +67 -1
- package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +22 -2
- package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js +40 -36
- package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +47 -1
- package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js +23 -2
- package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js +36 -3
- package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js +20 -1
- package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js +36 -3
- package/dist/libs/contracts/dist/docs/tech/workflows/overview.docblock.js +20 -1
- package/dist/libs/contracts/dist/events.js +8 -1
- package/dist/libs/contracts/dist/experiments/evaluator.js +1 -1
- package/dist/libs/contracts/dist/index.js +72 -1
- package/dist/libs/contracts/dist/install.js +2 -1
- package/dist/libs/contracts/dist/integrations/contracts.js +377 -1
- package/dist/libs/contracts/dist/integrations/index.js +18 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/accounts.js +228 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/balances.js +159 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/index.js +3 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/transactions.js +210 -1
- package/dist/libs/contracts/dist/integrations/openbanking/models.js +242 -1
- package/dist/libs/contracts/dist/integrations/openbanking/telemetry.js +13 -1
- package/dist/libs/contracts/dist/integrations/providers/elevenlabs.js +52 -1
- package/dist/libs/contracts/dist/integrations/providers/gcs-storage.js +75 -1
- package/dist/libs/contracts/dist/integrations/providers/gmail.js +87 -1
- package/dist/libs/contracts/dist/integrations/providers/google-calendar.js +66 -1
- package/dist/libs/contracts/dist/integrations/providers/index.js +11 -1
- package/dist/libs/contracts/dist/integrations/providers/mistral.js +68 -1
- package/dist/libs/contracts/dist/integrations/providers/postmark.js +68 -1
- package/dist/libs/contracts/dist/integrations/providers/powens.js +116 -1
- package/dist/libs/contracts/dist/integrations/providers/qdrant.js +73 -1
- package/dist/libs/contracts/dist/integrations/providers/registry.js +10 -1
- package/dist/libs/contracts/dist/integrations/providers/stripe.js +83 -1
- package/dist/libs/contracts/dist/integrations/providers/twilio-sms.js +61 -1
- package/dist/libs/contracts/dist/jsonschema.js +24 -1
- package/dist/libs/contracts/dist/knowledge/contracts.js +306 -1
- package/dist/libs/contracts/dist/knowledge/index.js +7 -1
- package/dist/libs/contracts/dist/knowledge/spaces/email-threads.js +34 -1
- package/dist/libs/contracts/dist/knowledge/spaces/financial-docs.js +34 -1
- package/dist/libs/contracts/dist/knowledge/spaces/financial-overview.js +38 -1
- package/dist/libs/contracts/dist/knowledge/spaces/index.js +6 -1
- package/dist/libs/contracts/dist/knowledge/spaces/product-canon.js +34 -1
- package/dist/libs/contracts/dist/knowledge/spaces/support-faq.js +37 -1
- package/dist/libs/contracts/dist/knowledge/spaces/uploaded-docs.js +34 -1
- package/dist/libs/contracts/dist/llm/exporters.js +352 -4
- package/dist/libs/contracts/dist/llm/index.js +2 -1
- package/dist/libs/contracts/dist/llm/prompts.js +143 -7
- package/dist/libs/contracts/dist/onboarding-base.js +196 -1
- package/dist/libs/contracts/dist/openapi.js +75 -1
- package/dist/libs/contracts/dist/ownership.js +21 -1
- package/dist/libs/contracts/dist/presentations.js +1 -1
- package/dist/libs/contracts/dist/presentations.v2.js +11 -1
- package/dist/libs/contracts/dist/prompt.js +1 -1
- package/dist/libs/contracts/dist/promptRegistry.js +1 -1
- package/dist/libs/contracts/dist/regenerator/index.js +2 -1
- package/dist/libs/contracts/dist/regenerator/service.js +92 -1
- package/dist/libs/contracts/dist/regenerator/utils.js +51 -1
- package/dist/libs/contracts/dist/registry.js +208 -1
- package/dist/libs/contracts/dist/resources.js +1 -1
- package/dist/libs/contracts/dist/schema/dist/EnumType.js +2 -1
- package/dist/libs/contracts/dist/schema/dist/FieldType.js +49 -1
- package/dist/libs/contracts/dist/schema/dist/ScalarTypeEnum.js +236 -1
- package/dist/libs/contracts/dist/schema/dist/SchemaModel.js +34 -1
- package/dist/libs/contracts/dist/schema/dist/entity/defineEntity.js +1 -1
- package/dist/libs/contracts/dist/schema/dist/entity/index.js +2 -1
- package/dist/libs/contracts/dist/schema/dist/entity/types.js +1 -1
- package/dist/libs/contracts/dist/schema/dist/index.js +6 -1
- package/dist/libs/contracts/dist/server/graphql-pothos.js +6 -1
- package/dist/libs/contracts/dist/server/index.js +8 -1
- package/dist/libs/contracts/dist/server/mcp/createMcpServer.js +4 -1
- package/dist/libs/contracts/dist/server/mcp/registerPresentations.js +2 -1
- package/dist/libs/contracts/dist/server/mcp/registerPrompts.js +1 -1
- package/dist/libs/contracts/dist/server/mcp/registerResources.js +2 -1
- package/dist/libs/contracts/dist/server/mcp/registerTools.js +1 -1
- package/dist/libs/contracts/dist/server/provider-mcp.js +1 -1
- package/dist/libs/contracts/dist/server/rest-elysia.js +1 -1
- package/dist/libs/contracts/dist/server/rest-express.js +1 -1
- package/dist/libs/contracts/dist/server/rest-generic.js +1 -1
- package/dist/libs/contracts/dist/server/rest-next-app.js +1 -1
- package/dist/libs/contracts/dist/server/rest-next-pages.js +1 -1
- package/dist/libs/contracts/dist/spec.js +35 -1
- package/dist/libs/contracts/dist/telemetry/index.js +1 -1
- package/dist/libs/contracts/dist/telemetry/tracker.js +1 -1
- package/dist/libs/contracts/dist/tests/index.js +1 -1
- package/dist/libs/contracts/dist/tests/runner.js +150 -1
- package/dist/libs/contracts/dist/workflow/index.js +1 -1
- package/dist/libs/contracts/dist/workflow/runner.js +1 -1
- package/dist/libs/contracts-transformers/dist/common/utils.js +47 -1
- package/dist/libs/contracts-transformers/dist/openapi/exporter.js +1 -1
- package/dist/libs/contracts-transformers/dist/openapi/importer.js +255 -2
- package/dist/libs/contracts-transformers/dist/openapi/index.js +4 -1
- package/dist/libs/contracts-transformers/dist/openapi/parser.js +231 -1
- package/dist/libs/contracts-transformers/dist/openapi/schema-converter.js +201 -4
- package/dist/modules/contractspec-workspace/dist/ai/code-generation.js +50 -13
- package/dist/modules/contractspec-workspace/dist/ai/spec-creation.js +50 -18
- package/dist/modules/contractspec-workspace/dist/analysis/deps/graph.js +84 -2
- package/dist/modules/contractspec-workspace/dist/analysis/deps/parse-imports.js +30 -1
- package/dist/modules/contractspec-workspace/dist/analysis/diff/semantic.js +96 -1
- package/dist/modules/contractspec-workspace/dist/analysis/feature-scan.js +151 -1
- package/dist/modules/contractspec-workspace/dist/analysis/spec-scan.js +344 -1
- package/dist/modules/contractspec-workspace/dist/analysis/validate/spec-structure.js +122 -1
- package/dist/modules/contractspec-workspace/dist/templates/app-config.js +100 -28
- package/dist/modules/contractspec-workspace/dist/templates/data-view.js +41 -27
- package/dist/modules/contractspec-workspace/dist/templates/event.js +28 -14
- package/dist/modules/contractspec-workspace/dist/templates/experiment.js +76 -51
- package/dist/modules/contractspec-workspace/dist/templates/handler.js +49 -17
- package/dist/modules/contractspec-workspace/dist/templates/integration-utils.js +97 -26
- package/dist/modules/contractspec-workspace/dist/templates/integration.js +46 -23
- package/dist/modules/contractspec-workspace/dist/templates/knowledge.js +59 -19
- package/dist/modules/contractspec-workspace/dist/templates/migration.js +49 -26
- package/dist/modules/contractspec-workspace/dist/templates/operation.js +40 -28
- package/dist/modules/contractspec-workspace/dist/templates/presentation.js +45 -20
- package/dist/modules/contractspec-workspace/dist/templates/telemetry.js +73 -53
- package/dist/modules/contractspec-workspace/dist/templates/utils.js +38 -1
- package/dist/modules/contractspec-workspace/dist/templates/workflow-runner.js +12 -6
- package/dist/modules/contractspec-workspace/dist/templates/workflow.js +50 -24
- package/dist/modules/contractspec-workspace/dist/types/generation-types.js +20 -1
- package/dist/services/agent-guide/adapters/claude-code.js +144 -3
- package/dist/services/agent-guide/adapters/cursor-cli.js +135 -3
- package/dist/services/agent-guide/adapters/generic-mcp.js +159 -3
- package/dist/services/agent-guide/adapters/index.js +30 -1
- package/dist/services/agent-guide/agent-guide-service.js +148 -1
- package/dist/services/agent-guide/index.js +5 -1
- package/dist/services/build.js +140 -1
- package/dist/services/ci-check/ci-check-service.js +393 -1
- package/dist/services/ci-check/index.js +2 -1
- package/dist/services/ci-check/types.js +28 -1
- package/dist/services/clean.js +71 -1
- package/dist/services/config.js +76 -1
- package/dist/services/deps.js +62 -1
- package/dist/services/diff.js +33 -1
- package/dist/services/doctor/checks/ai.js +118 -2
- package/dist/services/doctor/checks/cli.js +146 -1
- package/dist/services/doctor/checks/config.js +170 -1
- package/dist/services/doctor/checks/deps.js +180 -1
- package/dist/services/doctor/checks/index.js +6 -1
- package/dist/services/doctor/checks/mcp.js +144 -1
- package/dist/services/doctor/checks/workspace.js +243 -1
- package/dist/services/doctor/doctor-service.js +115 -2
- package/dist/services/doctor/index.js +2 -1
- package/dist/services/doctor/types.js +26 -1
- package/dist/services/implementation/discovery.js +143 -2
- package/dist/services/implementation/index.js +2 -1
- package/dist/services/implementation/resolver.js +223 -1
- package/dist/services/index.js +53 -1
- package/dist/services/integrity-diagram.js +274 -6
- package/dist/services/integrity.js +272 -1
- package/dist/services/list.js +35 -1
- package/dist/services/openapi/export-service.js +51 -2
- package/dist/services/openapi/import-service.js +75 -1
- package/dist/services/openapi/index.js +4 -1
- package/dist/services/openapi/sync-service.js +121 -1
- package/dist/services/openapi/validate-service.js +130 -1
- package/dist/services/regenerator.js +23 -1
- package/dist/services/registry.js +73 -1
- package/dist/services/setup/config-generators.js +113 -26
- package/dist/services/setup/file-merger.js +60 -2
- package/dist/services/setup/index.js +4 -1
- package/dist/services/setup/setup-service.js +95 -1
- package/dist/services/setup/targets/agents-md.js +46 -1
- package/dist/services/setup/targets/cli-config.js +59 -1
- package/dist/services/setup/targets/cursor-rules.js +47 -1
- package/dist/services/setup/targets/mcp-claude.js +59 -1
- package/dist/services/setup/targets/mcp-cursor.js +58 -1
- package/dist/services/setup/targets/vscode-settings.js +62 -1
- package/dist/services/setup/types.js +26 -1
- package/dist/services/sync.js +62 -1
- package/dist/services/test.js +30 -1
- package/dist/services/validate-implementation.js +69 -1
- package/dist/services/validate.js +47 -1
- package/dist/services/verification-cache/adapters/filesystem.js +121 -1
- package/dist/services/verification-cache/adapters/in-memory.js +45 -1
- package/dist/services/verification-cache/adapters/index.js +3 -1
- package/dist/services/verification-cache/adapters/workspace-state.js +90 -1
- package/dist/services/verification-cache/cache-service.js +255 -1
- package/dist/services/verification-cache/index.js +6 -1
- package/dist/services/verification-cache/types.js +15 -1
- package/dist/services/verify/ai-verifier.js +336 -9
- package/dist/services/verify/behavior-verifier.js +185 -1
- package/dist/services/verify/index.js +4 -1
- package/dist/services/verify/structure-verifier.js +195 -2
- package/dist/services/verify/verify-service.js +203 -3
- package/dist/services/watch.js +31 -1
- package/dist/services/workspace-info.js +102 -2
- package/dist/templates/app-config.template.js +101 -28
- package/dist/templates/data-view.template.js +42 -27
- package/dist/templates/event.template.js +29 -14
- package/dist/templates/experiment.template.js +77 -51
- package/dist/templates/handler.template.js +53 -17
- package/dist/templates/index.js +36 -1
- package/dist/templates/integration.template.js +134 -50
- package/dist/templates/knowledge.template.js +62 -21
- package/dist/templates/migration.template.js +50 -26
- package/dist/templates/operation.template.js +44 -28
- package/dist/templates/presentation.template.js +46 -20
- package/dist/templates/telemetry.template.js +74 -53
- package/dist/templates/workflow-runner.template.js +12 -6
- package/dist/templates/workflow.template.js +51 -24
- package/package.json +13 -9
|
@@ -1,9 +1,23 @@
|
|
|
1
|
-
import{__export
|
|
1
|
+
import { __export } from "../../_virtual/rolldown_runtime.js";
|
|
2
|
+
|
|
3
|
+
//#region src/ai/prompts/code-generation.ts
|
|
4
|
+
var code_generation_exports = /* @__PURE__ */ __export({
|
|
5
|
+
buildComponentPrompt: () => buildComponentPrompt,
|
|
6
|
+
buildFormPrompt: () => buildFormPrompt,
|
|
7
|
+
buildHandlerPrompt: () => buildHandlerPrompt,
|
|
8
|
+
buildTestPrompt: () => buildTestPrompt,
|
|
9
|
+
getCodeGenSystemPrompt: () => getCodeGenSystemPrompt
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* Build prompt for generating handler implementation
|
|
13
|
+
*/
|
|
14
|
+
function buildHandlerPrompt(specCode) {
|
|
15
|
+
return `You are a senior TypeScript developer implementing a handler for a contract specification.
|
|
2
16
|
|
|
3
17
|
Here is the contract spec:
|
|
4
18
|
|
|
5
19
|
\`\`\`typescript
|
|
6
|
-
${
|
|
20
|
+
${specCode}
|
|
7
21
|
\`\`\`
|
|
8
22
|
|
|
9
23
|
Generate a complete handler implementation that:
|
|
@@ -17,12 +31,18 @@ Generate a complete handler implementation that:
|
|
|
17
31
|
|
|
18
32
|
The handler should be production-ready with proper error handling, logging points, and clear structure.
|
|
19
33
|
|
|
20
|
-
Return only the TypeScript code for the handler function
|
|
34
|
+
Return only the TypeScript code for the handler function.`;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Build prompt for generating React component from presentation spec
|
|
38
|
+
*/
|
|
39
|
+
function buildComponentPrompt(specCode) {
|
|
40
|
+
return `You are a senior React developer creating a component for a presentation specification.
|
|
21
41
|
|
|
22
42
|
Here is the presentation spec:
|
|
23
43
|
|
|
24
44
|
\`\`\`typescript
|
|
25
|
-
${
|
|
45
|
+
${specCode}
|
|
26
46
|
\`\`\`
|
|
27
47
|
|
|
28
48
|
Generate a complete React component that:
|
|
@@ -36,12 +56,18 @@ Generate a complete React component that:
|
|
|
36
56
|
|
|
37
57
|
The component should follow Atomic Design principles and be reusable.
|
|
38
58
|
|
|
39
|
-
Return only the TypeScript/TSX code for the component
|
|
59
|
+
Return only the TypeScript/TSX code for the component.`;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Build prompt for generating form component
|
|
63
|
+
*/
|
|
64
|
+
function buildFormPrompt(specCode) {
|
|
65
|
+
return `You are a senior React developer creating a form component from a form specification.
|
|
40
66
|
|
|
41
67
|
Here is the form spec:
|
|
42
68
|
|
|
43
69
|
\`\`\`typescript
|
|
44
|
-
${
|
|
70
|
+
${specCode}
|
|
45
71
|
\`\`\`
|
|
46
72
|
|
|
47
73
|
Generate a complete form component using react-hook-form that:
|
|
@@ -56,25 +82,31 @@ Generate a complete form component using react-hook-form that:
|
|
|
56
82
|
|
|
57
83
|
The form should provide excellent UX with real-time validation and helpful feedback.
|
|
58
84
|
|
|
59
|
-
Return only the TypeScript/TSX code for the form component
|
|
85
|
+
Return only the TypeScript/TSX code for the form component.`;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Build prompt for generating tests
|
|
89
|
+
*/
|
|
90
|
+
function buildTestPrompt(specCode, implementationCode, testType) {
|
|
91
|
+
return `You are a senior developer writing comprehensive tests.
|
|
60
92
|
|
|
61
93
|
Spec:
|
|
62
94
|
\`\`\`typescript
|
|
63
|
-
${
|
|
95
|
+
${specCode}
|
|
64
96
|
\`\`\`
|
|
65
97
|
|
|
66
98
|
Implementation:
|
|
67
99
|
\`\`\`typescript
|
|
68
|
-
${
|
|
100
|
+
${implementationCode}
|
|
69
101
|
\`\`\`
|
|
70
102
|
|
|
71
103
|
Generate complete test suite using Vitest that:
|
|
72
|
-
${
|
|
104
|
+
${testType === "handler" ? `
|
|
73
105
|
- Test all acceptance scenarios from the spec
|
|
74
106
|
- Test error cases defined in spec.io.errors
|
|
75
107
|
- Verify events are emitted correctly
|
|
76
108
|
- Test input validation
|
|
77
|
-
- Test happy path and edge cases
|
|
109
|
+
- Test happy path and edge cases` : `
|
|
78
110
|
- Test rendering with various props
|
|
79
111
|
- Test user interactions
|
|
80
112
|
- Test accessibility (a11y)
|
|
@@ -83,7 +115,13 @@ ${n===`handler`?`
|
|
|
83
115
|
|
|
84
116
|
Use clear test descriptions and follow AAA pattern (Arrange, Act, Assert).
|
|
85
117
|
|
|
86
|
-
Return only the TypeScript test code
|
|
118
|
+
Return only the TypeScript test code.`;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* System prompt for code generation
|
|
122
|
+
*/
|
|
123
|
+
function getCodeGenSystemPrompt() {
|
|
124
|
+
return `You are an expert TypeScript developer with deep knowledge of:
|
|
87
125
|
- Type-safe API design
|
|
88
126
|
- React and modern hooks
|
|
89
127
|
- Test-driven development
|
|
@@ -97,4 +135,8 @@ Generate production-ready code that is:
|
|
|
97
135
|
- Defensive and error-safe
|
|
98
136
|
- Easy to maintain and extend
|
|
99
137
|
|
|
100
|
-
Always prioritize code quality, safety, and user experience
|
|
138
|
+
Always prioritize code quality, safety, and user experience.`;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
//#endregion
|
|
142
|
+
export { buildComponentPrompt, buildFormPrompt, buildHandlerPrompt, buildTestPrompt, code_generation_exports, getCodeGenSystemPrompt };
|
package/dist/ai/prompts/index.js
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
-
import{__export
|
|
1
|
+
import { __export } from "../../_virtual/rolldown_runtime.js";
|
|
2
|
+
import { spec_creation_exports } from "./spec-creation.js";
|
|
3
|
+
import { code_generation_exports } from "./code-generation.js";
|
|
4
|
+
|
|
5
|
+
//#region src/ai/prompts/index.ts
|
|
6
|
+
var prompts_exports = /* @__PURE__ */ __export({
|
|
7
|
+
codeGeneration: () => code_generation_exports,
|
|
8
|
+
specCreation: () => spec_creation_exports
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { prompts_exports };
|
|
@@ -1,8 +1,22 @@
|
|
|
1
|
-
import{__export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { __export } from "../../_virtual/rolldown_runtime.js";
|
|
2
|
+
|
|
3
|
+
//#region src/ai/prompts/spec-creation.ts
|
|
4
|
+
var spec_creation_exports = /* @__PURE__ */ __export({
|
|
5
|
+
addExampleContext: () => addExampleContext,
|
|
6
|
+
buildEventSpecPrompt: () => buildEventSpecPrompt,
|
|
7
|
+
buildOperationSpecPrompt: () => buildOperationSpecPrompt,
|
|
8
|
+
buildPresentationSpecPrompt: () => buildPresentationSpecPrompt,
|
|
9
|
+
getSystemPrompt: () => getSystemPrompt
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* Build prompt for creating operation spec from description
|
|
13
|
+
*/
|
|
14
|
+
function buildOperationSpecPrompt(description, kind) {
|
|
15
|
+
return `You are a senior software architect creating a contract specification for an operation.
|
|
16
|
+
|
|
17
|
+
The operation is a ${kind} (${kind === "command" ? "changes state, has side effects" : "read-only, idempotent"}).
|
|
18
|
+
|
|
19
|
+
User description: ${description}
|
|
6
20
|
|
|
7
21
|
Create a complete contract specification following these guidelines:
|
|
8
22
|
|
|
@@ -16,9 +30,15 @@ Create a complete contract specification following these guidelines:
|
|
|
16
30
|
8. **Feature Flags**: Any flags that gate this operation
|
|
17
31
|
9. **Side Effects**: What events might be emitted, analytics to track
|
|
18
32
|
|
|
19
|
-
Respond with a structured spec
|
|
33
|
+
Respond with a structured spec.`;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Build prompt for creating event spec from description
|
|
37
|
+
*/
|
|
38
|
+
function buildEventSpecPrompt(description) {
|
|
39
|
+
return `You are a senior software architect creating an event specification.
|
|
20
40
|
|
|
21
|
-
User description: ${
|
|
41
|
+
User description: ${description}
|
|
22
42
|
|
|
23
43
|
Create a complete event specification following these guidelines:
|
|
24
44
|
|
|
@@ -30,11 +50,21 @@ Create a complete event specification following these guidelines:
|
|
|
30
50
|
|
|
31
51
|
Events represent things that have already happened and should use past tense.
|
|
32
52
|
|
|
33
|
-
Respond with a structured spec
|
|
53
|
+
Respond with a structured spec.`;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Build prompt for creating presentation spec from description
|
|
57
|
+
*/
|
|
58
|
+
function buildPresentationSpecPrompt(description, kind) {
|
|
59
|
+
return `You are a senior software architect creating a presentation specification.
|
|
34
60
|
|
|
35
|
-
This is a ${
|
|
61
|
+
This is a ${kind} presentation - ${{
|
|
62
|
+
web_component: "a React component with props schema",
|
|
63
|
+
markdown: "markdown/MDX documentation or guide",
|
|
64
|
+
data: "structured data export (JSON/XML)"
|
|
65
|
+
}[kind]}.
|
|
36
66
|
|
|
37
|
-
User description: ${
|
|
67
|
+
User description: ${description}
|
|
38
68
|
|
|
39
69
|
Create a complete presentation specification following these guidelines:
|
|
40
70
|
|
|
@@ -42,13 +72,15 @@ Create a complete presentation specification following these guidelines:
|
|
|
42
72
|
2. **Version**: Start at 1
|
|
43
73
|
3. **Description**: What this presentation shows/provides
|
|
44
74
|
4. **Kind-specific details**:
|
|
45
|
-
${
|
|
46
|
-
- Props structure
|
|
47
|
-
- Analytics events to track`:t===`markdown`?`- Content or resource URI
|
|
48
|
-
- Target audience`:`- MIME type (e.g., application/json)
|
|
49
|
-
- Data structure description`}
|
|
75
|
+
${kind === "web_component" ? "- Component key (symbolic, resolved by host app)\n - Props structure\n - Analytics events to track" : kind === "markdown" ? "- Content or resource URI\n - Target audience" : "- MIME type (e.g., application/json)\n - Data structure description"}
|
|
50
76
|
|
|
51
|
-
Respond with a structured spec
|
|
77
|
+
Respond with a structured spec.`;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Build system prompt for all spec generation
|
|
81
|
+
*/
|
|
82
|
+
function getSystemPrompt() {
|
|
83
|
+
return `You are an expert software architect specializing in API design and contract-driven development.
|
|
52
84
|
|
|
53
85
|
You create clear, well-documented specifications that serve as the single source of truth for operations, events, and presentations.
|
|
54
86
|
|
|
@@ -58,12 +90,21 @@ Your specs are:
|
|
|
58
90
|
- Business-oriented (capturing the "why" not just "what")
|
|
59
91
|
- Designed for both humans and AI agents to understand
|
|
60
92
|
|
|
61
|
-
Always use proper dot notation for names and ensure all metadata is meaningful and accurate
|
|
93
|
+
Always use proper dot notation for names and ensure all metadata is meaningful and accurate.`;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Create example-based prompt for better results
|
|
97
|
+
*/
|
|
98
|
+
function addExampleContext(basePrompt, examples) {
|
|
99
|
+
if (examples.length === 0) return basePrompt;
|
|
100
|
+
return `${basePrompt}
|
|
62
101
|
|
|
63
102
|
Here are some good examples for reference:
|
|
64
103
|
|
|
65
|
-
${
|
|
104
|
+
${examples.join("\n\n")}
|
|
66
105
|
|
|
67
|
-
|
|
106
|
+
Follow this structure and quality level.`;
|
|
107
|
+
}
|
|
68
108
|
|
|
69
|
-
|
|
109
|
+
//#endregion
|
|
110
|
+
export { buildEventSpecPrompt, buildOperationSpecPrompt, buildPresentationSpecPrompt, getSystemPrompt, spec_creation_exports };
|
package/dist/ai/providers.js
CHANGED
|
@@ -1 +1,40 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { getRecommendedModels } from "../libs/ai-providers/dist/models.js";
|
|
2
|
+
import { getAIProvider, validateProvider } from "../libs/ai-providers/dist/legacy.js";
|
|
3
|
+
import "../libs/ai-providers/dist/index.js";
|
|
4
|
+
|
|
5
|
+
//#region src/ai/providers.ts
|
|
6
|
+
/**
|
|
7
|
+
* Initialize AI provider based on configuration
|
|
8
|
+
*
|
|
9
|
+
* @deprecated Use createProvider() from @lssm/lib.ai-providers instead
|
|
10
|
+
*/
|
|
11
|
+
function getAIProvider$1(config) {
|
|
12
|
+
return getAIProvider({
|
|
13
|
+
aiProvider: config.aiProvider,
|
|
14
|
+
aiModel: config.aiModel || void 0,
|
|
15
|
+
customEndpoint: config.customEndpoint || void 0
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Validate that the provider is accessible and working
|
|
20
|
+
*
|
|
21
|
+
* @deprecated Use validateProvider() from @lssm/lib.ai-providers instead
|
|
22
|
+
*/
|
|
23
|
+
async function validateProvider$1(config) {
|
|
24
|
+
return await validateProvider({
|
|
25
|
+
aiProvider: config.aiProvider,
|
|
26
|
+
aiModel: config.aiModel || void 0,
|
|
27
|
+
customEndpoint: config.customEndpoint || void 0
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Get recommended models for each provider
|
|
32
|
+
*
|
|
33
|
+
* @deprecated Use getModelsForProvider() from @lssm/lib.ai-providers instead
|
|
34
|
+
*/
|
|
35
|
+
function getRecommendedModels$1(provider) {
|
|
36
|
+
return getRecommendedModels(provider);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { getAIProvider$1 as getAIProvider, getRecommendedModels$1 as getRecommendedModels, validateProvider$1 as validateProvider };
|
package/dist/formatters/index.js
CHANGED
|
@@ -1 +1,18 @@
|
|
|
1
|
-
import{__export
|
|
1
|
+
import { __export } from "../_virtual/rolldown_runtime.js";
|
|
2
|
+
import { formatAsSarif, sarifToJson } from "./sarif.js";
|
|
3
|
+
import { formatAsJson, formatAsJsonCompact, formatAsJsonFull } from "./json.js";
|
|
4
|
+
import { formatAsText, formatAsTextLines } from "./text.js";
|
|
5
|
+
|
|
6
|
+
//#region src/formatters/index.ts
|
|
7
|
+
var formatters_exports = /* @__PURE__ */ __export({
|
|
8
|
+
formatAsJson: () => formatAsJson,
|
|
9
|
+
formatAsJsonCompact: () => formatAsJsonCompact,
|
|
10
|
+
formatAsJsonFull: () => formatAsJsonFull,
|
|
11
|
+
formatAsSarif: () => formatAsSarif,
|
|
12
|
+
formatAsText: () => formatAsText,
|
|
13
|
+
formatAsTextLines: () => formatAsTextLines,
|
|
14
|
+
sarifToJson: () => sarifToJson
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { formatters_exports };
|
package/dist/formatters/json.js
CHANGED
|
@@ -1 +1,71 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/formatters/json.ts
|
|
2
|
+
/**
|
|
3
|
+
* Format CI check results as compact JSON.
|
|
4
|
+
*/
|
|
5
|
+
function formatAsJsonCompact(result) {
|
|
6
|
+
return {
|
|
7
|
+
success: result.success,
|
|
8
|
+
errors: result.totalErrors,
|
|
9
|
+
warnings: result.totalWarnings,
|
|
10
|
+
duration: result.durationMs,
|
|
11
|
+
timestamp: result.timestamp,
|
|
12
|
+
commit: result.commitSha,
|
|
13
|
+
branch: result.branch,
|
|
14
|
+
issues: result.issues.map((issue) => ({
|
|
15
|
+
rule: issue.ruleId,
|
|
16
|
+
severity: issue.severity,
|
|
17
|
+
message: issue.message,
|
|
18
|
+
file: issue.file,
|
|
19
|
+
line: issue.line
|
|
20
|
+
}))
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Format CI check results as full JSON with all details.
|
|
25
|
+
*/
|
|
26
|
+
function formatAsJsonFull(result) {
|
|
27
|
+
return {
|
|
28
|
+
success: result.success,
|
|
29
|
+
summary: {
|
|
30
|
+
totalErrors: result.totalErrors,
|
|
31
|
+
totalWarnings: result.totalWarnings,
|
|
32
|
+
totalNotes: result.totalNotes,
|
|
33
|
+
durationMs: result.durationMs,
|
|
34
|
+
timestamp: result.timestamp,
|
|
35
|
+
commitSha: result.commitSha,
|
|
36
|
+
branch: result.branch
|
|
37
|
+
},
|
|
38
|
+
categories: result.categories.map((cat) => ({
|
|
39
|
+
category: cat.category,
|
|
40
|
+
label: cat.label,
|
|
41
|
+
passed: cat.passed,
|
|
42
|
+
errors: cat.errors,
|
|
43
|
+
warnings: cat.warnings,
|
|
44
|
+
notes: cat.notes,
|
|
45
|
+
durationMs: cat.durationMs
|
|
46
|
+
})),
|
|
47
|
+
issues: result.issues.map((issue) => ({
|
|
48
|
+
ruleId: issue.ruleId,
|
|
49
|
+
severity: issue.severity,
|
|
50
|
+
message: issue.message,
|
|
51
|
+
category: issue.category,
|
|
52
|
+
file: issue.file,
|
|
53
|
+
line: issue.line,
|
|
54
|
+
column: issue.column,
|
|
55
|
+
endLine: issue.endLine,
|
|
56
|
+
endColumn: issue.endColumn,
|
|
57
|
+
context: issue.context
|
|
58
|
+
}))
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Format CI check results as JSON.
|
|
63
|
+
*/
|
|
64
|
+
function formatAsJson(result, options = {}) {
|
|
65
|
+
const { pretty = true, includeDetails = true } = options;
|
|
66
|
+
const output = includeDetails ? formatAsJsonFull(result) : formatAsJsonCompact(result);
|
|
67
|
+
return pretty ? JSON.stringify(output, null, 2) : JSON.stringify(output);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
export { formatAsJson, formatAsJsonCompact, formatAsJsonFull };
|
package/dist/formatters/sarif.js
CHANGED
|
@@ -1 +1,163 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/formatters/sarif.ts
|
|
2
|
+
/**
|
|
3
|
+
* Map of rule IDs to their metadata.
|
|
4
|
+
*/
|
|
5
|
+
const RULE_METADATA = {
|
|
6
|
+
"spec-structure-error": {
|
|
7
|
+
name: "Spec Structure Error",
|
|
8
|
+
description: "Contract specification is missing required structure elements"
|
|
9
|
+
},
|
|
10
|
+
"spec-structure-warning": {
|
|
11
|
+
name: "Spec Structure Warning",
|
|
12
|
+
description: "Contract specification has recommended but missing elements"
|
|
13
|
+
},
|
|
14
|
+
"integrity-orphaned": {
|
|
15
|
+
name: "Orphaned Spec",
|
|
16
|
+
description: "Contract specification is not linked to any feature"
|
|
17
|
+
},
|
|
18
|
+
"integrity-unresolved-ref": {
|
|
19
|
+
name: "Unresolved Reference",
|
|
20
|
+
description: "Contract specification references a non-existent spec"
|
|
21
|
+
},
|
|
22
|
+
"integrity-missing-feature": {
|
|
23
|
+
name: "Missing Feature",
|
|
24
|
+
description: "Feature referenced by spec does not exist"
|
|
25
|
+
},
|
|
26
|
+
"integrity-broken-link": {
|
|
27
|
+
name: "Broken Link",
|
|
28
|
+
description: "Link between specs is broken"
|
|
29
|
+
},
|
|
30
|
+
"deps-circular": {
|
|
31
|
+
name: "Circular Dependency",
|
|
32
|
+
description: "Circular dependency detected between contracts"
|
|
33
|
+
},
|
|
34
|
+
"deps-missing": {
|
|
35
|
+
name: "Missing Dependency",
|
|
36
|
+
description: "Contract depends on a non-existent contract"
|
|
37
|
+
},
|
|
38
|
+
"handler-missing": {
|
|
39
|
+
name: "Missing Handler",
|
|
40
|
+
description: "Handler implementation file does not exist for this contract"
|
|
41
|
+
},
|
|
42
|
+
"handler-warning": {
|
|
43
|
+
name: "Handler Warning",
|
|
44
|
+
description: "Handler implementation has potential issues"
|
|
45
|
+
},
|
|
46
|
+
"test-missing": {
|
|
47
|
+
name: "Missing Test",
|
|
48
|
+
description: "Test file does not exist for this contract"
|
|
49
|
+
},
|
|
50
|
+
"test-warning": {
|
|
51
|
+
name: "Test Warning",
|
|
52
|
+
description: "Test implementation has potential issues"
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Format CI check results as SARIF.
|
|
57
|
+
*/
|
|
58
|
+
function formatAsSarif(result, options = {}) {
|
|
59
|
+
const { toolName = "ContractSpec", toolVersion = "1.0.0", toolUri = "https://contractspec.dev", repositoryUri, workingDirectory } = options;
|
|
60
|
+
const ruleMap = /* @__PURE__ */ new Map();
|
|
61
|
+
const ruleIndexMap = /* @__PURE__ */ new Map();
|
|
62
|
+
for (const issue of result.issues) if (!ruleMap.has(issue.ruleId)) {
|
|
63
|
+
const metadata = RULE_METADATA[issue.ruleId] ?? {
|
|
64
|
+
name: issue.ruleId,
|
|
65
|
+
description: `Rule: ${issue.ruleId}`
|
|
66
|
+
};
|
|
67
|
+
const rule = {
|
|
68
|
+
id: issue.ruleId,
|
|
69
|
+
name: metadata.name,
|
|
70
|
+
shortDescription: { text: metadata.description },
|
|
71
|
+
defaultConfiguration: { level: mapSeverityToLevel(issue.severity) }
|
|
72
|
+
};
|
|
73
|
+
if (metadata.helpUri) rule.helpUri = metadata.helpUri;
|
|
74
|
+
ruleIndexMap.set(issue.ruleId, ruleMap.size);
|
|
75
|
+
ruleMap.set(issue.ruleId, rule);
|
|
76
|
+
}
|
|
77
|
+
const results = result.issues.map((issue) => {
|
|
78
|
+
const sarifResult = {
|
|
79
|
+
ruleId: issue.ruleId,
|
|
80
|
+
ruleIndex: ruleIndexMap.get(issue.ruleId) ?? 0,
|
|
81
|
+
level: mapSeverityToLevel(issue.severity),
|
|
82
|
+
message: { text: issue.message }
|
|
83
|
+
};
|
|
84
|
+
if (issue.file) {
|
|
85
|
+
const location = { physicalLocation: { artifactLocation: {
|
|
86
|
+
uri: normalizeUri(issue.file),
|
|
87
|
+
uriBaseId: "%SRCROOT%"
|
|
88
|
+
} } };
|
|
89
|
+
if (issue.line !== void 0) location.physicalLocation.region = {
|
|
90
|
+
startLine: issue.line,
|
|
91
|
+
startColumn: issue.column ?? 1,
|
|
92
|
+
endLine: issue.endLine ?? issue.line,
|
|
93
|
+
endColumn: issue.endColumn
|
|
94
|
+
};
|
|
95
|
+
sarifResult.locations = [location];
|
|
96
|
+
}
|
|
97
|
+
sarifResult.partialFingerprints = { primaryLocationLineHash: createFingerprint(issue) };
|
|
98
|
+
return sarifResult;
|
|
99
|
+
});
|
|
100
|
+
const versionControlProvenance = [];
|
|
101
|
+
if (repositoryUri || result.commitSha || result.branch) versionControlProvenance.push({
|
|
102
|
+
repositoryUri,
|
|
103
|
+
revisionId: result.commitSha,
|
|
104
|
+
branch: result.branch
|
|
105
|
+
});
|
|
106
|
+
const run = {
|
|
107
|
+
tool: { driver: {
|
|
108
|
+
name: toolName,
|
|
109
|
+
version: toolVersion,
|
|
110
|
+
informationUri: toolUri,
|
|
111
|
+
rules: Array.from(ruleMap.values())
|
|
112
|
+
} },
|
|
113
|
+
results,
|
|
114
|
+
invocations: [{
|
|
115
|
+
executionSuccessful: result.success,
|
|
116
|
+
endTimeUtc: result.timestamp,
|
|
117
|
+
...workingDirectory && { workingDirectory: { uri: workingDirectory } }
|
|
118
|
+
}]
|
|
119
|
+
};
|
|
120
|
+
if (versionControlProvenance.length > 0) run.versionControlProvenance = versionControlProvenance;
|
|
121
|
+
return {
|
|
122
|
+
$schema: "https://json.schemastore.org/sarif-2.1.0.json",
|
|
123
|
+
version: "2.1.0",
|
|
124
|
+
runs: [run]
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Map CI severity to SARIF level.
|
|
129
|
+
*/
|
|
130
|
+
function mapSeverityToLevel(severity) {
|
|
131
|
+
switch (severity) {
|
|
132
|
+
case "error": return "error";
|
|
133
|
+
case "warning": return "warning";
|
|
134
|
+
case "note": return "note";
|
|
135
|
+
default: return "warning";
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Normalize file path to SARIF URI format.
|
|
140
|
+
*/
|
|
141
|
+
function normalizeUri(filePath) {
|
|
142
|
+
return filePath.replace(/^\.\//, "").replace(/\\/g, "/");
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Create a fingerprint for issue deduplication.
|
|
146
|
+
*/
|
|
147
|
+
function createFingerprint(issue) {
|
|
148
|
+
const parts = [
|
|
149
|
+
issue.ruleId,
|
|
150
|
+
issue.file ?? "",
|
|
151
|
+
issue.message
|
|
152
|
+
];
|
|
153
|
+
return Buffer.from(parts.join("|")).toString("base64").slice(0, 16);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Serialize SARIF output to JSON string.
|
|
157
|
+
*/
|
|
158
|
+
function sarifToJson(sarif) {
|
|
159
|
+
return JSON.stringify(sarif, null, 2);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
//#endregion
|
|
163
|
+
export { formatAsSarif, sarifToJson };
|