@contractspec/bundle.workspace 0.0.0-canary-20260113162409
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/LICENSE +21 -0
- package/README.md +83 -0
- package/dist/_virtual/rolldown_runtime.mjs +20 -0
- package/dist/adapters/ai.d.mts +12 -0
- package/dist/adapters/ai.d.mts.map +1 -0
- package/dist/adapters/ai.mjs +83 -0
- package/dist/adapters/ai.mjs.map +1 -0
- package/dist/adapters/factory.d.mts +29 -0
- package/dist/adapters/factory.d.mts.map +1 -0
- package/dist/adapters/factory.mjs +37 -0
- package/dist/adapters/factory.mjs.map +1 -0
- package/dist/adapters/fs.d.mts +12 -0
- package/dist/adapters/fs.d.mts.map +1 -0
- package/dist/adapters/fs.mjs +133 -0
- package/dist/adapters/fs.mjs.map +1 -0
- package/dist/adapters/git.d.mts +11 -0
- package/dist/adapters/git.d.mts.map +1 -0
- package/dist/adapters/git.mjs +84 -0
- package/dist/adapters/git.mjs.map +1 -0
- package/dist/adapters/index.d.mts +7 -0
- package/dist/adapters/index.mjs +9 -0
- package/dist/adapters/logger.d.mts +18 -0
- package/dist/adapters/logger.d.mts.map +1 -0
- package/dist/adapters/logger.mjs +81 -0
- package/dist/adapters/logger.mjs.map +1 -0
- package/dist/adapters/watcher.d.mts +11 -0
- package/dist/adapters/watcher.d.mts.map +1 -0
- package/dist/adapters/watcher.mjs +74 -0
- package/dist/adapters/watcher.mjs.map +1 -0
- package/dist/adapters/workspace.d.mts +148 -0
- package/dist/adapters/workspace.d.mts.map +1 -0
- package/dist/adapters/workspace.mjs +275 -0
- package/dist/adapters/workspace.mjs.map +1 -0
- package/dist/ai/agents/claude-code-agent.d.mts +22 -0
- package/dist/ai/agents/claude-code-agent.d.mts.map +1 -0
- package/dist/ai/agents/claude-code-agent.mjs +182 -0
- package/dist/ai/agents/claude-code-agent.mjs.map +1 -0
- package/dist/ai/agents/cursor-agent.d.mts +68 -0
- package/dist/ai/agents/cursor-agent.d.mts.map +1 -0
- package/dist/ai/agents/cursor-agent.mjs +436 -0
- package/dist/ai/agents/cursor-agent.mjs.map +1 -0
- package/dist/ai/agents/index.mjs +7 -0
- package/dist/ai/agents/openai-codex-agent.d.mts +22 -0
- package/dist/ai/agents/openai-codex-agent.d.mts.map +1 -0
- package/dist/ai/agents/openai-codex-agent.mjs +167 -0
- package/dist/ai/agents/openai-codex-agent.mjs.map +1 -0
- package/dist/ai/agents/orchestrator.d.mts +50 -0
- package/dist/ai/agents/orchestrator.d.mts.map +1 -0
- package/dist/ai/agents/orchestrator.mjs +143 -0
- package/dist/ai/agents/orchestrator.mjs.map +1 -0
- package/dist/ai/agents/simple-agent.d.mts +17 -0
- package/dist/ai/agents/simple-agent.d.mts.map +1 -0
- package/dist/ai/agents/simple-agent.mjs +92 -0
- package/dist/ai/agents/simple-agent.mjs.map +1 -0
- package/dist/ai/agents/types.d.mts +36 -0
- package/dist/ai/agents/types.d.mts.map +1 -0
- package/dist/ai/client.d.mts +97 -0
- package/dist/ai/client.d.mts.map +1 -0
- package/dist/ai/client.mjs +189 -0
- package/dist/ai/client.mjs.map +1 -0
- package/dist/ai/index.d.mts +9 -0
- package/dist/ai/index.mjs +11 -0
- package/dist/ai/prompts/code-generation.d.mts +26 -0
- package/dist/ai/prompts/code-generation.d.mts.map +1 -0
- package/dist/ai/prompts/code-generation.mjs +143 -0
- package/dist/ai/prompts/code-generation.mjs.map +1 -0
- package/dist/ai/prompts/index.d.mts +10 -0
- package/dist/ai/prompts/index.d.mts.map +1 -0
- package/dist/ai/prompts/index.mjs +13 -0
- package/dist/ai/prompts/index.mjs.map +1 -0
- package/dist/ai/prompts/spec-creation.d.mts +29 -0
- package/dist/ai/prompts/spec-creation.d.mts.map +1 -0
- package/dist/ai/prompts/spec-creation.mjs +111 -0
- package/dist/ai/prompts/spec-creation.mjs.map +1 -0
- package/dist/ai/providers.d.mts +29 -0
- package/dist/ai/providers.d.mts.map +1 -0
- package/dist/ai/providers.mjs +39 -0
- package/dist/ai/providers.mjs.map +1 -0
- package/dist/formatters/index.d.mts +11 -0
- package/dist/formatters/index.d.mts.map +1 -0
- package/dist/formatters/index.mjs +17 -0
- package/dist/formatters/index.mjs.map +1 -0
- package/dist/formatters/json.d.mts +56 -0
- package/dist/formatters/json.d.mts.map +1 -0
- package/dist/formatters/json.mjs +43 -0
- package/dist/formatters/json.mjs.map +1 -0
- package/dist/formatters/sarif.d.mts +101 -0
- package/dist/formatters/sarif.d.mts.map +1 -0
- package/dist/formatters/sarif.mjs +163 -0
- package/dist/formatters/sarif.mjs.map +1 -0
- package/dist/formatters/text.d.mts +35 -0
- package/dist/formatters/text.d.mts.map +1 -0
- package/dist/formatters/text.mjs +209 -0
- package/dist/formatters/text.mjs.map +1 -0
- package/dist/index.d.mts +125 -0
- package/dist/index.mjs +110 -0
- package/dist/ports/ai.d.mts +59 -0
- package/dist/ports/ai.d.mts.map +1 -0
- package/dist/ports/fs.d.mts +81 -0
- package/dist/ports/fs.d.mts.map +1 -0
- package/dist/ports/git.d.mts +46 -0
- package/dist/ports/git.d.mts.map +1 -0
- package/dist/ports/index.d.mts +6 -0
- package/dist/ports/logger.d.mts +88 -0
- package/dist/ports/logger.d.mts.map +1 -0
- package/dist/ports/rulesync.d.mts +38 -0
- package/dist/ports/rulesync.d.mts.map +1 -0
- package/dist/ports/watcher.d.mts +52 -0
- package/dist/ports/watcher.d.mts.map +1 -0
- package/dist/services/agent-guide/adapters/claude-code.d.mts +35 -0
- package/dist/services/agent-guide/adapters/claude-code.d.mts.map +1 -0
- package/dist/services/agent-guide/adapters/claude-code.mjs +144 -0
- package/dist/services/agent-guide/adapters/claude-code.mjs.map +1 -0
- package/dist/services/agent-guide/adapters/cursor-cli.d.mts +39 -0
- package/dist/services/agent-guide/adapters/cursor-cli.d.mts.map +1 -0
- package/dist/services/agent-guide/adapters/cursor-cli.mjs +135 -0
- package/dist/services/agent-guide/adapters/cursor-cli.mjs.map +1 -0
- package/dist/services/agent-guide/adapters/generic-mcp.d.mts +53 -0
- package/dist/services/agent-guide/adapters/generic-mcp.d.mts.map +1 -0
- package/dist/services/agent-guide/adapters/generic-mcp.mjs +159 -0
- package/dist/services/agent-guide/adapters/generic-mcp.mjs.map +1 -0
- package/dist/services/agent-guide/adapters/index.d.mts +23 -0
- package/dist/services/agent-guide/adapters/index.d.mts.map +1 -0
- package/dist/services/agent-guide/adapters/index.mjs +31 -0
- package/dist/services/agent-guide/adapters/index.mjs.map +1 -0
- package/dist/services/agent-guide/agent-guide-service.d.mts +56 -0
- package/dist/services/agent-guide/agent-guide-service.d.mts.map +1 -0
- package/dist/services/agent-guide/agent-guide-service.mjs +147 -0
- package/dist/services/agent-guide/agent-guide-service.mjs.map +1 -0
- package/dist/services/agent-guide/index.d.mts +6 -0
- package/dist/services/agent-guide/index.mjs +7 -0
- package/dist/services/agent-guide/types.d.mts +58 -0
- package/dist/services/agent-guide/types.d.mts.map +1 -0
- package/dist/services/build.d.mts +61 -0
- package/dist/services/build.d.mts.map +1 -0
- package/dist/services/build.mjs +151 -0
- package/dist/services/build.mjs.map +1 -0
- package/dist/services/ci-check/checks/coverage.mjs +77 -0
- package/dist/services/ci-check/checks/coverage.mjs.map +1 -0
- package/dist/services/ci-check/checks/deps.mjs +32 -0
- package/dist/services/ci-check/checks/deps.mjs.map +1 -0
- package/dist/services/ci-check/checks/doctor.mjs +38 -0
- package/dist/services/ci-check/checks/doctor.mjs.map +1 -0
- package/dist/services/ci-check/checks/drift.mjs +40 -0
- package/dist/services/ci-check/checks/drift.mjs.map +1 -0
- package/dist/services/ci-check/checks/handlers.mjs +38 -0
- package/dist/services/ci-check/checks/handlers.mjs.map +1 -0
- package/dist/services/ci-check/checks/implementation.mjs +73 -0
- package/dist/services/ci-check/checks/implementation.mjs.map +1 -0
- package/dist/services/ci-check/checks/index.mjs +13 -0
- package/dist/services/ci-check/checks/integrity.mjs +31 -0
- package/dist/services/ci-check/checks/integrity.mjs.map +1 -0
- package/dist/services/ci-check/checks/layers.mjs +66 -0
- package/dist/services/ci-check/checks/layers.mjs.map +1 -0
- package/dist/services/ci-check/checks/structure.mjs +35 -0
- package/dist/services/ci-check/checks/structure.mjs.map +1 -0
- package/dist/services/ci-check/checks/test-refs.mjs +63 -0
- package/dist/services/ci-check/checks/test-refs.mjs.map +1 -0
- package/dist/services/ci-check/checks/tests.mjs +38 -0
- package/dist/services/ci-check/checks/tests.mjs.map +1 -0
- package/dist/services/ci-check/ci-check-service.d.mts +16 -0
- package/dist/services/ci-check/ci-check-service.d.mts.map +1 -0
- package/dist/services/ci-check/ci-check-service.mjs +129 -0
- package/dist/services/ci-check/ci-check-service.mjs.map +1 -0
- package/dist/services/ci-check/index.d.mts +2 -0
- package/dist/services/ci-check/index.mjs +4 -0
- package/dist/services/ci-check/types.d.mts +147 -0
- package/dist/services/ci-check/types.d.mts.map +1 -0
- package/dist/services/ci-check/types.mjs +37 -0
- package/dist/services/ci-check/types.mjs.map +1 -0
- package/dist/services/ci-check/utils.mjs +76 -0
- package/dist/services/ci-check/utils.mjs.map +1 -0
- package/dist/services/clean.d.mts +41 -0
- package/dist/services/clean.d.mts.map +1 -0
- package/dist/services/clean.mjs +72 -0
- package/dist/services/clean.mjs.map +1 -0
- package/dist/services/config.d.mts +16 -0
- package/dist/services/config.d.mts.map +1 -0
- package/dist/services/config.mjs +63 -0
- package/dist/services/config.mjs.map +1 -0
- package/dist/services/coverage/parsers/index.mjs +34 -0
- package/dist/services/coverage/parsers/index.mjs.map +1 -0
- package/dist/services/coverage/parsers/istanbul-parser.mjs +108 -0
- package/dist/services/coverage/parsers/istanbul-parser.mjs.map +1 -0
- package/dist/services/coverage/validator.mjs +55 -0
- package/dist/services/coverage/validator.mjs.map +1 -0
- package/dist/services/create/ai-generator.d.mts +84 -0
- package/dist/services/create/ai-generator.d.mts.map +1 -0
- package/dist/services/create/ai-generator.mjs +178 -0
- package/dist/services/create/ai-generator.mjs.map +1 -0
- package/dist/services/create/index.d.mts +28 -0
- package/dist/services/create/index.d.mts.map +1 -0
- package/dist/services/create/index.mjs +37 -0
- package/dist/services/create/index.mjs.map +1 -0
- package/dist/services/create/templates.d.mts +22 -0
- package/dist/services/create/templates.d.mts.map +1 -0
- package/dist/services/create/templates.mjs +39 -0
- package/dist/services/create/templates.mjs.map +1 -0
- package/dist/services/deps.d.mts +53 -0
- package/dist/services/deps.d.mts.map +1 -0
- package/dist/services/deps.mjs +62 -0
- package/dist/services/deps.mjs.map +1 -0
- package/dist/services/diff.d.mts +34 -0
- package/dist/services/diff.d.mts.map +1 -0
- package/dist/services/diff.mjs +34 -0
- package/dist/services/diff.mjs.map +1 -0
- package/dist/services/docs/docs-service.d.mts +20 -0
- package/dist/services/docs/docs-service.d.mts.map +1 -0
- package/dist/services/docs/docs-service.mjs +59 -0
- package/dist/services/docs/docs-service.mjs.map +1 -0
- package/dist/services/docs/index.d.mts +1 -0
- package/dist/services/docs/index.mjs +3 -0
- package/dist/services/doctor/checks/ai.mjs +119 -0
- package/dist/services/doctor/checks/ai.mjs.map +1 -0
- package/dist/services/doctor/checks/cli.mjs +156 -0
- package/dist/services/doctor/checks/cli.mjs.map +1 -0
- package/dist/services/doctor/checks/config.mjs +303 -0
- package/dist/services/doctor/checks/config.mjs.map +1 -0
- package/dist/services/doctor/checks/deps.mjs +267 -0
- package/dist/services/doctor/checks/deps.mjs.map +1 -0
- package/dist/services/doctor/checks/index.mjs +9 -0
- package/dist/services/doctor/checks/layers.mjs +139 -0
- package/dist/services/doctor/checks/layers.mjs.map +1 -0
- package/dist/services/doctor/checks/mcp.mjs +145 -0
- package/dist/services/doctor/checks/mcp.mjs.map +1 -0
- package/dist/services/doctor/checks/workspace.mjs +263 -0
- package/dist/services/doctor/checks/workspace.mjs.map +1 -0
- package/dist/services/doctor/doctor-service.d.mts +24 -0
- package/dist/services/doctor/doctor-service.d.mts.map +1 -0
- package/dist/services/doctor/doctor-service.mjs +118 -0
- package/dist/services/doctor/doctor-service.mjs.map +1 -0
- package/dist/services/doctor/index.d.mts +2 -0
- package/dist/services/doctor/index.mjs +4 -0
- package/dist/services/doctor/types.d.mts +118 -0
- package/dist/services/doctor/types.d.mts.map +1 -0
- package/dist/services/doctor/types.mjs +29 -0
- package/dist/services/doctor/types.mjs.map +1 -0
- package/dist/services/drift.mjs +73 -0
- package/dist/services/drift.mjs.map +1 -0
- package/dist/services/extract.d.mts +12 -0
- package/dist/services/extract.d.mts.map +1 -0
- package/dist/services/extract.mjs +33 -0
- package/dist/services/extract.mjs.map +1 -0
- package/dist/services/features/completion.d.mts +21 -0
- package/dist/services/features/completion.d.mts.map +1 -0
- package/dist/services/features/completion.mjs +70 -0
- package/dist/services/features/completion.mjs.map +1 -0
- package/dist/services/features/feature-editor.d.mts +27 -0
- package/dist/services/features/feature-editor.d.mts.map +1 -0
- package/dist/services/features/feature-editor.mjs +37 -0
- package/dist/services/features/feature-editor.mjs.map +1 -0
- package/dist/services/features/index.d.mts +11 -0
- package/dist/services/features/index.d.mts.map +1 -0
- package/dist/services/features/index.mjs +16 -0
- package/dist/services/features/index.mjs.map +1 -0
- package/dist/services/features/validation.d.mts +21 -0
- package/dist/services/features/validation.d.mts.map +1 -0
- package/dist/services/features/validation.mjs +27 -0
- package/dist/services/features/validation.mjs.map +1 -0
- package/dist/services/fix/fix-link-formatter.d.mts +12 -0
- package/dist/services/fix/fix-link-formatter.d.mts.map +1 -0
- package/dist/services/fix/fix-link-formatter.mjs +38 -0
- package/dist/services/fix/fix-link-formatter.mjs.map +1 -0
- package/dist/services/fix/fix-service.d.mts +74 -0
- package/dist/services/fix/fix-service.d.mts.map +1 -0
- package/dist/services/fix/fix-service.mjs +169 -0
- package/dist/services/fix/fix-service.mjs.map +1 -0
- package/dist/services/fix/index.d.mts +16 -0
- package/dist/services/fix/index.d.mts.map +1 -0
- package/dist/services/fix/index.mjs +24 -0
- package/dist/services/fix/index.mjs.map +1 -0
- package/dist/services/fix/path-resolver.mjs +83 -0
- package/dist/services/fix/path-resolver.mjs.map +1 -0
- package/dist/services/fix/schemas.d.mts +17 -0
- package/dist/services/fix/schemas.d.mts.map +1 -0
- package/dist/services/fix/schemas.mjs +12 -0
- package/dist/services/fix/schemas.mjs.map +1 -0
- package/dist/services/fix/strategies/implement-ai.d.mts +18 -0
- package/dist/services/fix/strategies/implement-ai.d.mts.map +1 -0
- package/dist/services/fix/strategies/implement-ai.mjs +139 -0
- package/dist/services/fix/strategies/implement-ai.mjs.map +1 -0
- package/dist/services/fix/strategies/implement-skeleton.d.mts +14 -0
- package/dist/services/fix/strategies/implement-skeleton.d.mts.map +1 -0
- package/dist/services/fix/strategies/implement-skeleton.mjs +77 -0
- package/dist/services/fix/strategies/implement-skeleton.mjs.map +1 -0
- package/dist/services/fix/strategies/index.d.mts +3 -0
- package/dist/services/fix/strategies/remove-reference.d.mts +17 -0
- package/dist/services/fix/strategies/remove-reference.d.mts.map +1 -0
- package/dist/services/fix/strategies/remove-reference.mjs +98 -0
- package/dist/services/fix/strategies/remove-reference.mjs.map +1 -0
- package/dist/services/fix/types.d.mts +207 -0
- package/dist/services/fix/types.d.mts.map +1 -0
- package/dist/services/fix/types.mjs +20 -0
- package/dist/services/fix/types.mjs.map +1 -0
- package/dist/services/formatter.d.mts +15 -0
- package/dist/services/formatter.d.mts.map +1 -0
- package/dist/services/formatter.mjs +26 -0
- package/dist/services/formatter.mjs.map +1 -0
- package/dist/services/gap.d.mts +18 -0
- package/dist/services/gap.d.mts.map +1 -0
- package/dist/services/gap.mjs +44 -0
- package/dist/services/gap.mjs.map +1 -0
- package/dist/services/generate-artifacts.d.mts +11 -0
- package/dist/services/generate-artifacts.d.mts.map +1 -0
- package/dist/services/generate-artifacts.mjs +27 -0
- package/dist/services/generate-artifacts.mjs.map +1 -0
- package/dist/services/hooks/hooks-service.d.mts +24 -0
- package/dist/services/hooks/hooks-service.d.mts.map +1 -0
- package/dist/services/hooks/hooks-service.mjs +126 -0
- package/dist/services/hooks/hooks-service.mjs.map +1 -0
- package/dist/services/hooks/index.d.mts +10 -0
- package/dist/services/hooks/index.d.mts.map +1 -0
- package/dist/services/hooks/index.mjs +12 -0
- package/dist/services/hooks/index.mjs.map +1 -0
- package/dist/services/hooks/types.d.mts +56 -0
- package/dist/services/hooks/types.d.mts.map +1 -0
- package/dist/services/impact/formatters.d.mts +27 -0
- package/dist/services/impact/formatters.d.mts.map +1 -0
- package/dist/services/impact/formatters.mjs +139 -0
- package/dist/services/impact/formatters.mjs.map +1 -0
- package/dist/services/impact/impact-detection-service.d.mts +22 -0
- package/dist/services/impact/impact-detection-service.d.mts.map +1 -0
- package/dist/services/impact/impact-detection-service.mjs +96 -0
- package/dist/services/impact/impact-detection-service.mjs.map +1 -0
- package/dist/services/impact/index.d.mts +11 -0
- package/dist/services/impact/index.d.mts.map +1 -0
- package/dist/services/impact/index.mjs +16 -0
- package/dist/services/impact/index.mjs.map +1 -0
- package/dist/services/impact/types.d.mts +63 -0
- package/dist/services/impact/types.d.mts.map +1 -0
- package/dist/services/implementation/discovery.d.mts +30 -0
- package/dist/services/implementation/discovery.d.mts.map +1 -0
- package/dist/services/implementation/discovery.mjs +144 -0
- package/dist/services/implementation/discovery.mjs.map +1 -0
- package/dist/services/implementation/index.d.mts +6 -0
- package/dist/services/implementation/index.mjs +7 -0
- package/dist/services/implementation/resolver/conventions.d.mts +18 -0
- package/dist/services/implementation/resolver/conventions.d.mts.map +1 -0
- package/dist/services/implementation/resolver/conventions.mjs +59 -0
- package/dist/services/implementation/resolver/conventions.mjs.map +1 -0
- package/dist/services/implementation/resolver/index.d.mts +24 -0
- package/dist/services/implementation/resolver/index.d.mts.map +1 -0
- package/dist/services/implementation/resolver/index.mjs +111 -0
- package/dist/services/implementation/resolver/index.mjs.map +1 -0
- package/dist/services/implementation/resolver/parsers.d.mts +16 -0
- package/dist/services/implementation/resolver/parsers.d.mts.map +1 -0
- package/dist/services/implementation/resolver/parsers.mjs +100 -0
- package/dist/services/implementation/resolver/parsers.mjs.map +1 -0
- package/dist/services/implementation/resolver/status.d.mts +21 -0
- package/dist/services/implementation/resolver/status.d.mts.map +1 -0
- package/dist/services/implementation/resolver/status.mjs +31 -0
- package/dist/services/implementation/resolver/status.mjs.map +1 -0
- package/dist/services/implementation/types.d.mts +89 -0
- package/dist/services/implementation/types.d.mts.map +1 -0
- package/dist/services/index.d.mts +103 -0
- package/dist/services/index.mjs +100 -0
- package/dist/services/integrity-diagram.d.mts +36 -0
- package/dist/services/integrity-diagram.d.mts.map +1 -0
- package/dist/services/integrity-diagram.mjs +275 -0
- package/dist/services/integrity-diagram.mjs.map +1 -0
- package/dist/services/integrity.d.mts +152 -0
- package/dist/services/integrity.d.mts.map +1 -0
- package/dist/services/integrity.mjs +361 -0
- package/dist/services/integrity.mjs.map +1 -0
- package/dist/services/layer-discovery.d.mts +77 -0
- package/dist/services/layer-discovery.d.mts.map +1 -0
- package/dist/services/layer-discovery.mjs +121 -0
- package/dist/services/layer-discovery.mjs.map +1 -0
- package/dist/services/list.d.mts +37 -0
- package/dist/services/list.d.mts.map +1 -0
- package/dist/services/list.mjs +46 -0
- package/dist/services/list.mjs.map +1 -0
- package/dist/services/llm/index.d.mts +28 -0
- package/dist/services/llm/index.d.mts.map +1 -0
- package/dist/services/llm/index.mjs +187 -0
- package/dist/services/llm/index.mjs.map +1 -0
- package/dist/services/llm/verify-static.d.mts +26 -0
- package/dist/services/llm/verify-static.d.mts.map +1 -0
- package/dist/services/llm/verify-static.mjs +82 -0
- package/dist/services/llm/verify-static.mjs.map +1 -0
- package/dist/services/modules/module-resolver.mjs +61 -0
- package/dist/services/modules/module-resolver.mjs.map +1 -0
- package/dist/services/openapi/export-service.d.mts +53 -0
- package/dist/services/openapi/export-service.d.mts.map +1 -0
- package/dist/services/openapi/export-service.mjs +50 -0
- package/dist/services/openapi/export-service.mjs.map +1 -0
- package/dist/services/openapi/import-service.d.mts +17 -0
- package/dist/services/openapi/import-service.d.mts.map +1 -0
- package/dist/services/openapi/import-service.mjs +168 -0
- package/dist/services/openapi/import-service.mjs.map +1 -0
- package/dist/services/openapi/index.d.mts +5 -0
- package/dist/services/openapi/index.mjs +6 -0
- package/dist/services/openapi/sync-service.d.mts +17 -0
- package/dist/services/openapi/sync-service.d.mts.map +1 -0
- package/dist/services/openapi/sync-service.mjs +120 -0
- package/dist/services/openapi/sync-service.mjs.map +1 -0
- package/dist/services/openapi/types.d.mts +162 -0
- package/dist/services/openapi/types.d.mts.map +1 -0
- package/dist/services/openapi/validate-service.d.mts +16 -0
- package/dist/services/openapi/validate-service.d.mts.map +1 -0
- package/dist/services/openapi/validate-service.mjs +130 -0
- package/dist/services/openapi/validate-service.mjs.map +1 -0
- package/dist/services/quickstart/dependencies.d.mts +31 -0
- package/dist/services/quickstart/dependencies.d.mts.map +1 -0
- package/dist/services/quickstart/dependencies.mjs +57 -0
- package/dist/services/quickstart/dependencies.mjs.map +1 -0
- package/dist/services/quickstart/index.mjs +4 -0
- package/dist/services/quickstart/quickstart-service.d.mts +20 -0
- package/dist/services/quickstart/quickstart-service.d.mts.map +1 -0
- package/dist/services/quickstart/quickstart-service.mjs +196 -0
- package/dist/services/quickstart/quickstart-service.mjs.map +1 -0
- package/dist/services/quickstart/types.d.mts +81 -0
- package/dist/services/quickstart/types.d.mts.map +1 -0
- package/dist/services/regenerator.d.mts +18 -0
- package/dist/services/regenerator.d.mts.map +1 -0
- package/dist/services/regenerator.mjs +23 -0
- package/dist/services/regenerator.mjs.map +1 -0
- package/dist/services/registry.d.mts +53 -0
- package/dist/services/registry.d.mts.map +1 -0
- package/dist/services/registry.mjs +74 -0
- package/dist/services/registry.mjs.map +1 -0
- package/dist/services/rulesync.d.mts +17 -0
- package/dist/services/rulesync.d.mts.map +1 -0
- package/dist/services/rulesync.mjs +71 -0
- package/dist/services/rulesync.mjs.map +1 -0
- package/dist/services/setup/config-generators.d.mts +42 -0
- package/dist/services/setup/config-generators.d.mts.map +1 -0
- package/dist/services/setup/config-generators.mjs +252 -0
- package/dist/services/setup/config-generators.mjs.map +1 -0
- package/dist/services/setup/file-merger.d.mts +27 -0
- package/dist/services/setup/file-merger.d.mts.map +1 -0
- package/dist/services/setup/file-merger.mjs +61 -0
- package/dist/services/setup/file-merger.mjs.map +1 -0
- package/dist/services/setup/setup-service.d.mts +12 -0
- package/dist/services/setup/setup-service.d.mts.map +1 -0
- package/dist/services/setup/setup-service.mjs +96 -0
- package/dist/services/setup/setup-service.mjs.map +1 -0
- package/dist/services/setup/targets/agents-md.mjs +47 -0
- package/dist/services/setup/targets/agents-md.mjs.map +1 -0
- package/dist/services/setup/targets/cli-config.mjs +60 -0
- package/dist/services/setup/targets/cli-config.mjs.map +1 -0
- package/dist/services/setup/targets/cursor-rules.mjs +48 -0
- package/dist/services/setup/targets/cursor-rules.mjs.map +1 -0
- package/dist/services/setup/targets/mcp-claude.mjs +60 -0
- package/dist/services/setup/targets/mcp-claude.mjs.map +1 -0
- package/dist/services/setup/targets/mcp-cursor.mjs +59 -0
- package/dist/services/setup/targets/mcp-cursor.mjs.map +1 -0
- package/dist/services/setup/targets/vscode-settings.mjs +63 -0
- package/dist/services/setup/targets/vscode-settings.mjs.map +1 -0
- package/dist/services/setup/types.d.mts +85 -0
- package/dist/services/setup/types.d.mts.map +1 -0
- package/dist/services/setup/types.mjs +27 -0
- package/dist/services/setup/types.mjs.map +1 -0
- package/dist/services/sync.d.mts +42 -0
- package/dist/services/sync.d.mts.map +1 -0
- package/dist/services/sync.mjs +64 -0
- package/dist/services/sync.mjs.map +1 -0
- package/dist/services/test/index.d.mts +2 -0
- package/dist/services/test/index.mjs +4 -0
- package/dist/services/test/test-generator-service.d.mts +24 -0
- package/dist/services/test/test-generator-service.d.mts.map +1 -0
- package/dist/services/test/test-generator-service.mjs +92 -0
- package/dist/services/test/test-generator-service.mjs.map +1 -0
- package/dist/services/test/test-service.d.mts +27 -0
- package/dist/services/test/test-service.d.mts.map +1 -0
- package/dist/services/test/test-service.mjs +94 -0
- package/dist/services/test/test-service.mjs.map +1 -0
- package/dist/services/test-link/index.d.mts +18 -0
- package/dist/services/test-link/index.d.mts.map +1 -0
- package/dist/services/test-link/index.mjs +60 -0
- package/dist/services/test-link/index.mjs.map +1 -0
- package/dist/services/test-link/test-ref-validator.d.mts +2 -0
- package/dist/services/test-link/test-ref-validator.mjs +50 -0
- package/dist/services/test-link/test-ref-validator.mjs.map +1 -0
- package/dist/services/upgrade/index.d.mts +10 -0
- package/dist/services/upgrade/index.d.mts.map +1 -0
- package/dist/services/upgrade/index.mjs +15 -0
- package/dist/services/upgrade/index.mjs.map +1 -0
- package/dist/services/upgrade/types.d.mts +78 -0
- package/dist/services/upgrade/types.d.mts.map +1 -0
- package/dist/services/upgrade/upgrade-service.d.mts +38 -0
- package/dist/services/upgrade/upgrade-service.d.mts.map +1 -0
- package/dist/services/upgrade/upgrade-service.mjs +201 -0
- package/dist/services/upgrade/upgrade-service.mjs.map +1 -0
- package/dist/services/validate/blueprint-validator.d.mts +23 -0
- package/dist/services/validate/blueprint-validator.d.mts.map +1 -0
- package/dist/services/validate/blueprint-validator.mjs +50 -0
- package/dist/services/validate/blueprint-validator.mjs.map +1 -0
- package/dist/services/validate/implementation-agent-validator.d.mts +20 -0
- package/dist/services/validate/implementation-agent-validator.d.mts.map +1 -0
- package/dist/services/validate/implementation-agent-validator.mjs +42 -0
- package/dist/services/validate/implementation-agent-validator.mjs.map +1 -0
- package/dist/services/validate/implementation-validator.d.mts +32 -0
- package/dist/services/validate/implementation-validator.d.mts.map +1 -0
- package/dist/services/validate/implementation-validator.mjs +64 -0
- package/dist/services/validate/implementation-validator.mjs.map +1 -0
- package/dist/services/validate/index.d.mts +5 -0
- package/dist/services/validate/index.mjs +7 -0
- package/dist/services/validate/spec-validator.d.mts +42 -0
- package/dist/services/validate/spec-validator.d.mts.map +1 -0
- package/dist/services/validate/spec-validator.mjs +49 -0
- package/dist/services/validate/spec-validator.mjs.map +1 -0
- package/dist/services/validate/tenant-validator.d.mts +21 -0
- package/dist/services/validate/tenant-validator.d.mts.map +1 -0
- package/dist/services/validate/tenant-validator.mjs +165 -0
- package/dist/services/validate/tenant-validator.mjs.map +1 -0
- package/dist/services/verification-cache/adapters/filesystem.d.mts +46 -0
- package/dist/services/verification-cache/adapters/filesystem.d.mts.map +1 -0
- package/dist/services/verification-cache/adapters/filesystem.mjs +120 -0
- package/dist/services/verification-cache/adapters/filesystem.mjs.map +1 -0
- package/dist/services/verification-cache/adapters/in-memory.d.mts +27 -0
- package/dist/services/verification-cache/adapters/in-memory.d.mts.map +1 -0
- package/dist/services/verification-cache/adapters/in-memory.mjs +46 -0
- package/dist/services/verification-cache/adapters/in-memory.mjs.map +1 -0
- package/dist/services/verification-cache/adapters/index.d.mts +3 -0
- package/dist/services/verification-cache/adapters/index.mjs +5 -0
- package/dist/services/verification-cache/adapters/workspace-state.d.mts +49 -0
- package/dist/services/verification-cache/adapters/workspace-state.d.mts.map +1 -0
- package/dist/services/verification-cache/adapters/workspace-state.mjs +91 -0
- package/dist/services/verification-cache/adapters/workspace-state.mjs.map +1 -0
- package/dist/services/verification-cache/cache-service.d.mts +70 -0
- package/dist/services/verification-cache/cache-service.d.mts.map +1 -0
- package/dist/services/verification-cache/cache-service.mjs +256 -0
- package/dist/services/verification-cache/cache-service.mjs.map +1 -0
- package/dist/services/verification-cache/index.d.mts +6 -0
- package/dist/services/verification-cache/index.mjs +8 -0
- package/dist/services/verification-cache/types.d.mts +124 -0
- package/dist/services/verification-cache/types.d.mts.map +1 -0
- package/dist/services/verification-cache/types.mjs +16 -0
- package/dist/services/verification-cache/types.mjs.map +1 -0
- package/dist/services/verify/ai-verifier.d.mts +25 -0
- package/dist/services/verify/ai-verifier.d.mts.map +1 -0
- package/dist/services/verify/ai-verifier.mjs +403 -0
- package/dist/services/verify/ai-verifier.mjs.map +1 -0
- package/dist/services/verify/behavior-verifier.d.mts +12 -0
- package/dist/services/verify/behavior-verifier.d.mts.map +1 -0
- package/dist/services/verify/behavior-verifier.mjs +186 -0
- package/dist/services/verify/behavior-verifier.mjs.map +1 -0
- package/dist/services/verify/index.d.mts +5 -0
- package/dist/services/verify/index.mjs +6 -0
- package/dist/services/verify/structure-verifier.d.mts +12 -0
- package/dist/services/verify/structure-verifier.d.mts.map +1 -0
- package/dist/services/verify/structure-verifier.mjs +196 -0
- package/dist/services/verify/structure-verifier.mjs.map +1 -0
- package/dist/services/verify/types.d.mts +137 -0
- package/dist/services/verify/types.d.mts.map +1 -0
- package/dist/services/verify/verify-service.d.mts +60 -0
- package/dist/services/verify/verify-service.d.mts.map +1 -0
- package/dist/services/verify/verify-service.mjs +204 -0
- package/dist/services/verify/verify-service.mjs.map +1 -0
- package/dist/services/versioning/changelog-formatter.d.mts +24 -0
- package/dist/services/versioning/changelog-formatter.d.mts.map +1 -0
- package/dist/services/versioning/changelog-formatter.mjs +155 -0
- package/dist/services/versioning/changelog-formatter.mjs.map +1 -0
- package/dist/services/versioning/conventional-commits.d.mts +95 -0
- package/dist/services/versioning/conventional-commits.d.mts.map +1 -0
- package/dist/services/versioning/conventional-commits.mjs +184 -0
- package/dist/services/versioning/conventional-commits.mjs.map +1 -0
- package/dist/services/versioning/index.d.mts +12 -0
- package/dist/services/versioning/index.d.mts.map +1 -0
- package/dist/services/versioning/index.mjs +28 -0
- package/dist/services/versioning/index.mjs.map +1 -0
- package/dist/services/versioning/types.d.mts +135 -0
- package/dist/services/versioning/types.d.mts.map +1 -0
- package/dist/services/versioning/versioning-service.d.mts +74 -0
- package/dist/services/versioning/versioning-service.d.mts.map +1 -0
- package/dist/services/versioning/versioning-service.mjs +501 -0
- package/dist/services/versioning/versioning-service.mjs.map +1 -0
- package/dist/services/vibe/config.d.mts +12 -0
- package/dist/services/vibe/config.d.mts.map +1 -0
- package/dist/services/vibe/config.mjs +43 -0
- package/dist/services/vibe/config.mjs.map +1 -0
- package/dist/services/vibe/context.d.mts +19 -0
- package/dist/services/vibe/context.d.mts.map +1 -0
- package/dist/services/vibe/context.mjs +92 -0
- package/dist/services/vibe/context.mjs.map +1 -0
- package/dist/services/vibe/definitions.d.mts +8 -0
- package/dist/services/vibe/definitions.d.mts.map +1 -0
- package/dist/services/vibe/definitions.mjs +129 -0
- package/dist/services/vibe/definitions.mjs.map +1 -0
- package/dist/services/vibe/engine.d.mts +44 -0
- package/dist/services/vibe/engine.d.mts.map +1 -0
- package/dist/services/vibe/engine.mjs +147 -0
- package/dist/services/vibe/engine.mjs.map +1 -0
- package/dist/services/vibe/index.d.mts +15 -0
- package/dist/services/vibe/index.d.mts.map +1 -0
- package/dist/services/vibe/index.mjs +26 -0
- package/dist/services/vibe/index.mjs.map +1 -0
- package/dist/services/vibe/loader.d.mts +15 -0
- package/dist/services/vibe/loader.d.mts.map +1 -0
- package/dist/services/vibe/loader.mjs +48 -0
- package/dist/services/vibe/loader.mjs.map +1 -0
- package/dist/services/vibe/pack.d.mts +19 -0
- package/dist/services/vibe/pack.d.mts.map +1 -0
- package/dist/services/vibe/pack.mjs +66 -0
- package/dist/services/vibe/pack.mjs.map +1 -0
- package/dist/services/vibe/types.d.mts +59 -0
- package/dist/services/vibe/types.d.mts.map +1 -0
- package/dist/services/vibe/types.mjs +12 -0
- package/dist/services/vibe/types.mjs.map +1 -0
- package/dist/services/view/index.d.mts +11 -0
- package/dist/services/view/index.d.mts.map +1 -0
- package/dist/services/view/index.mjs +119 -0
- package/dist/services/view/index.mjs.map +1 -0
- package/dist/services/watch.d.mts +25 -0
- package/dist/services/watch.d.mts.map +1 -0
- package/dist/services/watch.mjs +33 -0
- package/dist/services/watch.mjs.map +1 -0
- package/dist/services/workspace-info.d.mts +62 -0
- package/dist/services/workspace-info.d.mts.map +1 -0
- package/dist/services/workspace-info.mjs +103 -0
- package/dist/services/workspace-info.mjs.map +1 -0
- package/dist/templates/app-config.template.d.mts +7 -0
- package/dist/templates/app-config.template.d.mts.map +1 -0
- package/dist/templates/app-config.template.mjs +107 -0
- package/dist/templates/app-config.template.mjs.map +1 -0
- package/dist/templates/data-view.template.d.mts +7 -0
- package/dist/templates/data-view.template.d.mts.map +1 -0
- package/dist/templates/data-view.template.mjs +70 -0
- package/dist/templates/data-view.template.mjs.map +1 -0
- package/dist/templates/event.template.d.mts +11 -0
- package/dist/templates/event.template.d.mts.map +1 -0
- package/dist/templates/event.template.mjs +42 -0
- package/dist/templates/event.template.mjs.map +1 -0
- package/dist/templates/experiment.template.d.mts +7 -0
- package/dist/templates/experiment.template.d.mts.map +1 -0
- package/dist/templates/experiment.template.mjs +89 -0
- package/dist/templates/experiment.template.mjs.map +1 -0
- package/dist/templates/feature.template.d.mts +33 -0
- package/dist/templates/feature.template.d.mts.map +1 -0
- package/dist/templates/feature.template.mjs +52 -0
- package/dist/templates/feature.template.mjs.map +1 -0
- package/dist/templates/fix/skeleton-capability.mjs +49 -0
- package/dist/templates/fix/skeleton-capability.mjs.map +1 -0
- package/dist/templates/fix/skeleton-event.mjs +56 -0
- package/dist/templates/fix/skeleton-event.mjs.map +1 -0
- package/dist/templates/fix/skeleton-operation.mjs +122 -0
- package/dist/templates/fix/skeleton-operation.mjs.map +1 -0
- package/dist/templates/fix/skeleton-presentation.mjs +65 -0
- package/dist/templates/fix/skeleton-presentation.mjs.map +1 -0
- package/dist/templates/fix/utils.mjs +34 -0
- package/dist/templates/fix/utils.mjs.map +1 -0
- package/dist/templates/handler.template.d.mts +16 -0
- package/dist/templates/handler.template.d.mts.map +1 -0
- package/dist/templates/handler.template.mjs +100 -0
- package/dist/templates/handler.template.mjs.map +1 -0
- package/dist/templates/index.d.mts +22 -0
- package/dist/templates/index.d.mts.map +1 -0
- package/dist/templates/index.mjs +39 -0
- package/dist/templates/index.mjs.map +1 -0
- package/dist/templates/integration.template.d.mts +7 -0
- package/dist/templates/integration.template.d.mts.map +1 -0
- package/dist/templates/integration.template.mjs +160 -0
- package/dist/templates/integration.template.mjs.map +1 -0
- package/dist/templates/knowledge.template.d.mts +7 -0
- package/dist/templates/knowledge.template.d.mts.map +1 -0
- package/dist/templates/knowledge.template.mjs +75 -0
- package/dist/templates/knowledge.template.mjs.map +1 -0
- package/dist/templates/migration.template.d.mts +7 -0
- package/dist/templates/migration.template.d.mts.map +1 -0
- package/dist/templates/migration.template.mjs +62 -0
- package/dist/templates/migration.template.mjs.map +1 -0
- package/dist/templates/operation.template.d.mts +11 -0
- package/dist/templates/operation.template.d.mts.map +1 -0
- package/dist/templates/operation.template.mjs +107 -0
- package/dist/templates/operation.template.mjs.map +1 -0
- package/dist/templates/presentation.template.d.mts +11 -0
- package/dist/templates/presentation.template.d.mts.map +1 -0
- package/dist/templates/presentation.template.mjs +80 -0
- package/dist/templates/presentation.template.mjs.map +1 -0
- package/dist/templates/telemetry.template.d.mts +7 -0
- package/dist/templates/telemetry.template.d.mts.map +1 -0
- package/dist/templates/telemetry.template.mjs +91 -0
- package/dist/templates/telemetry.template.mjs.map +1 -0
- package/dist/templates/workflow-runner.template.d.mts +16 -0
- package/dist/templates/workflow-runner.template.d.mts.map +1 -0
- package/dist/templates/workflow-runner.template.mjs +50 -0
- package/dist/templates/workflow-runner.template.mjs.map +1 -0
- package/dist/templates/workflow.template.d.mts +7 -0
- package/dist/templates/workflow.template.d.mts.map +1 -0
- package/dist/templates/workflow.template.mjs +69 -0
- package/dist/templates/workflow.template.mjs.map +1 -0
- package/dist/types/config.d.mts +34 -0
- package/dist/types/config.d.mts.map +1 -0
- package/dist/types.d.mts +324 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/utils/filter.d.mts +16 -0
- package/dist/utils/filter.d.mts.map +1 -0
- package/dist/utils/filter.mjs +22 -0
- package/dist/utils/filter.mjs.map +1 -0
- package/dist/utils/index.d.mts +11 -0
- package/dist/utils/index.d.mts.map +1 -0
- package/dist/utils/index.mjs +20 -0
- package/dist/utils/index.mjs.map +1 -0
- package/dist/utils/module-loader.d.mts +5 -0
- package/dist/utils/module-loader.d.mts.map +1 -0
- package/dist/utils/module-loader.mjs +41 -0
- package/dist/utils/module-loader.mjs.map +1 -0
- package/dist/utils/validation.d.mts +37 -0
- package/dist/utils/validation.d.mts.map +1 -0
- package/dist/utils/validation.mjs +43 -0
- package/dist/utils/validation.mjs.map +1 -0
- package/package.json +76 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { getAIProvider } from "./providers.mjs";
|
|
2
|
+
import { buildComponentPrompt, buildFormPrompt, buildHandlerPrompt, buildTestPrompt, getCodeGenSystemPrompt } from "./prompts/code-generation.mjs";
|
|
3
|
+
import { buildEventSpecPrompt, buildOperationSpecPrompt, buildPresentationSpecPrompt, getSystemPrompt } from "./prompts/spec-creation.mjs";
|
|
4
|
+
import { generateObject, generateText, streamText } from "ai";
|
|
5
|
+
import * as z$1 from "zod";
|
|
6
|
+
|
|
7
|
+
//#region src/ai/client.ts
|
|
8
|
+
/**
|
|
9
|
+
* AI Client for spec creation and code generation
|
|
10
|
+
*/
|
|
11
|
+
var AIClient = class {
|
|
12
|
+
constructor(config) {
|
|
13
|
+
this.config = config;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Generate operation spec from natural language description
|
|
17
|
+
*/
|
|
18
|
+
async generateOperationSpec(description, kind) {
|
|
19
|
+
return (await generateObject({
|
|
20
|
+
model: getAIProvider(this.config),
|
|
21
|
+
schema: z$1.object({
|
|
22
|
+
name: z$1.string().describe("Dot notation name like \"domain.operation\""),
|
|
23
|
+
version: z$1.number().int().positive().default(1),
|
|
24
|
+
description: z$1.string().describe("Clear, concise summary"),
|
|
25
|
+
goal: z$1.string().describe("Business purpose"),
|
|
26
|
+
context: z$1.string().describe("Background and constraints"),
|
|
27
|
+
stability: z$1.enum([
|
|
28
|
+
"experimental",
|
|
29
|
+
"beta",
|
|
30
|
+
"stable",
|
|
31
|
+
"deprecated"
|
|
32
|
+
]).default("beta"),
|
|
33
|
+
owners: z$1.array(z$1.string()).describe("Team/person owners with @ prefix"),
|
|
34
|
+
tags: z$1.array(z$1.string()).describe("Categorization tags"),
|
|
35
|
+
auth: z$1.enum([
|
|
36
|
+
"anonymous",
|
|
37
|
+
"user",
|
|
38
|
+
"admin"
|
|
39
|
+
]).describe("Required auth level"),
|
|
40
|
+
inputShape: z$1.string().describe("Description of input structure"),
|
|
41
|
+
outputShape: z$1.string().describe("Description of output structure"),
|
|
42
|
+
flags: z$1.array(z$1.string()).describe("Feature flags").default([]),
|
|
43
|
+
possibleEvents: z$1.array(z$1.string()).describe("Events this may emit").default([]),
|
|
44
|
+
analytics: z$1.array(z$1.string()).describe("Analytics events to track").default([])
|
|
45
|
+
}),
|
|
46
|
+
prompt: buildOperationSpecPrompt(description, kind),
|
|
47
|
+
system: getSystemPrompt()
|
|
48
|
+
})).object;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Generate event spec from description
|
|
52
|
+
*/
|
|
53
|
+
async generateEventSpec(description) {
|
|
54
|
+
return (await generateObject({
|
|
55
|
+
model: getAIProvider(this.config),
|
|
56
|
+
schema: z$1.object({
|
|
57
|
+
name: z$1.string().describe("Dot notation name like \"domain.event_name\""),
|
|
58
|
+
version: z$1.number().int().positive().default(1),
|
|
59
|
+
description: z$1.string().describe("When this event is emitted"),
|
|
60
|
+
stability: z$1.enum([
|
|
61
|
+
"experimental",
|
|
62
|
+
"beta",
|
|
63
|
+
"stable",
|
|
64
|
+
"deprecated"
|
|
65
|
+
]).default("beta"),
|
|
66
|
+
owners: z$1.array(z$1.string()).default([]),
|
|
67
|
+
tags: z$1.array(z$1.string()).default([]),
|
|
68
|
+
payloadShape: z$1.string().describe("Description of event payload"),
|
|
69
|
+
piiFields: z$1.array(z$1.string()).describe("PII field paths").default([])
|
|
70
|
+
}),
|
|
71
|
+
prompt: buildEventSpecPrompt(description),
|
|
72
|
+
system: getSystemPrompt()
|
|
73
|
+
})).object;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Generate presentation spec from description
|
|
77
|
+
*/
|
|
78
|
+
async generatePresentationSpec(description, kind) {
|
|
79
|
+
return (await generateObject({
|
|
80
|
+
model: getAIProvider(this.config),
|
|
81
|
+
schema: z$1.object({
|
|
82
|
+
name: z$1.string(),
|
|
83
|
+
version: z$1.number().int().positive().default(1),
|
|
84
|
+
description: z$1.string(),
|
|
85
|
+
stability: z$1.enum([
|
|
86
|
+
"experimental",
|
|
87
|
+
"beta",
|
|
88
|
+
"stable",
|
|
89
|
+
"deprecated"
|
|
90
|
+
]).default("beta"),
|
|
91
|
+
owners: z$1.array(z$1.string()).default([]),
|
|
92
|
+
tags: z$1.array(z$1.string()).default([]),
|
|
93
|
+
componentKey: z$1.string().optional(),
|
|
94
|
+
propsShape: z$1.string().optional(),
|
|
95
|
+
content: z$1.string().optional(),
|
|
96
|
+
mimeType: z$1.string().optional(),
|
|
97
|
+
dataShape: z$1.string().optional()
|
|
98
|
+
}),
|
|
99
|
+
prompt: buildPresentationSpecPrompt(description, kind),
|
|
100
|
+
system: getSystemPrompt()
|
|
101
|
+
})).object;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Generate handler implementation from spec
|
|
105
|
+
*/
|
|
106
|
+
async generateHandler(specCode) {
|
|
107
|
+
return (await generateText({
|
|
108
|
+
model: getAIProvider(this.config),
|
|
109
|
+
prompt: buildHandlerPrompt(specCode),
|
|
110
|
+
system: getCodeGenSystemPrompt()
|
|
111
|
+
})).text;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Generate React component from presentation spec
|
|
115
|
+
*/
|
|
116
|
+
async generateComponent(specCode) {
|
|
117
|
+
return (await generateText({
|
|
118
|
+
model: getAIProvider(this.config),
|
|
119
|
+
prompt: buildComponentPrompt(specCode),
|
|
120
|
+
system: getCodeGenSystemPrompt()
|
|
121
|
+
})).text;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Generate form component from form spec
|
|
125
|
+
*/
|
|
126
|
+
async generateForm(specCode) {
|
|
127
|
+
return (await generateText({
|
|
128
|
+
model: getAIProvider(this.config),
|
|
129
|
+
prompt: buildFormPrompt(specCode),
|
|
130
|
+
system: getCodeGenSystemPrompt()
|
|
131
|
+
})).text;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Generate tests for implementation
|
|
135
|
+
*/
|
|
136
|
+
async generateTests(specCode, implementationCode, testType) {
|
|
137
|
+
return (await generateText({
|
|
138
|
+
model: getAIProvider(this.config),
|
|
139
|
+
prompt: buildTestPrompt(specCode, implementationCode, testType),
|
|
140
|
+
system: getCodeGenSystemPrompt()
|
|
141
|
+
})).text;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Stream code generation for better UX
|
|
145
|
+
*/
|
|
146
|
+
async streamCodeGeneration(prompt, onChunk) {
|
|
147
|
+
const result = await streamText({
|
|
148
|
+
model: getAIProvider(this.config),
|
|
149
|
+
prompt,
|
|
150
|
+
system: getCodeGenSystemPrompt()
|
|
151
|
+
});
|
|
152
|
+
let fullText = "";
|
|
153
|
+
for await (const chunk of result.textStream) {
|
|
154
|
+
fullText += chunk;
|
|
155
|
+
onChunk(chunk);
|
|
156
|
+
}
|
|
157
|
+
return fullText;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Chat with the AI model
|
|
161
|
+
*/
|
|
162
|
+
async chat(messages, system) {
|
|
163
|
+
return (await generateText({
|
|
164
|
+
model: getAIProvider(this.config),
|
|
165
|
+
messages,
|
|
166
|
+
system: system || getSystemPrompt()
|
|
167
|
+
})).text;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Stream chat with the AI model
|
|
171
|
+
*/
|
|
172
|
+
async streamChat(messages, onChunk, system) {
|
|
173
|
+
const result = await streamText({
|
|
174
|
+
model: getAIProvider(this.config),
|
|
175
|
+
messages,
|
|
176
|
+
system: system || getSystemPrompt()
|
|
177
|
+
});
|
|
178
|
+
let fullText = "";
|
|
179
|
+
for await (const chunk of result.textStream) {
|
|
180
|
+
fullText += chunk;
|
|
181
|
+
onChunk(chunk);
|
|
182
|
+
}
|
|
183
|
+
return fullText;
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
//#endregion
|
|
188
|
+
export { AIClient };
|
|
189
|
+
//# sourceMappingURL=client.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.mjs","names":["z"],"sources":["../../src/ai/client.ts"],"sourcesContent":["import { generateObject, generateText, streamText } from 'ai';\nimport * as z from 'zod';\nimport { getAIProvider } from './providers';\nimport type { Config } from '../types/config';\nimport {\n buildEventSpecPrompt,\n buildOperationSpecPrompt,\n buildPresentationSpecPrompt,\n getSystemPrompt,\n} from './prompts/spec-creation';\nimport {\n buildComponentPrompt,\n buildFormPrompt,\n buildHandlerPrompt,\n buildTestPrompt,\n getCodeGenSystemPrompt,\n} from './prompts/code-generation';\nimport type { OpKind, PresentationKind } from '../types';\n\n/**\n * AI Client for spec creation and code generation\n */\nexport class AIClient {\n constructor(private config: Config) {}\n\n /**\n * Generate operation spec from natural language description\n */\n async generateOperationSpec(description: string, kind: OpKind) {\n const model = getAIProvider(this.config);\n\n const schema = z.object({\n name: z.string().describe('Dot notation name like \"domain.operation\"'),\n version: z.number().int().positive().default(1),\n description: z.string().describe('Clear, concise summary'),\n goal: z.string().describe('Business purpose'),\n context: z.string().describe('Background and constraints'),\n stability: z\n .enum(['experimental', 'beta', 'stable', 'deprecated'])\n .default('beta'),\n owners: z.array(z.string()).describe('Team/person owners with @ prefix'),\n tags: z.array(z.string()).describe('Categorization tags'),\n auth: z\n .enum(['anonymous', 'user', 'admin'])\n .describe('Required auth level'),\n inputShape: z.string().describe('Description of input structure'),\n outputShape: z.string().describe('Description of output structure'),\n flags: z.array(z.string()).describe('Feature flags').default([]),\n possibleEvents: z\n .array(z.string())\n .describe('Events this may emit')\n .default([]),\n analytics: z\n .array(z.string())\n .describe('Analytics events to track')\n .default([]),\n });\n\n const prompt = buildOperationSpecPrompt(description, kind);\n\n const result = await generateObject({\n model,\n schema,\n prompt,\n system: getSystemPrompt(),\n });\n\n return result.object;\n }\n\n /**\n * Generate event spec from description\n */\n async generateEventSpec(description: string) {\n const model = getAIProvider(this.config);\n\n const schema = z.object({\n name: z.string().describe('Dot notation name like \"domain.event_name\"'),\n version: z.number().int().positive().default(1),\n description: z.string().describe('When this event is emitted'),\n stability: z\n .enum(['experimental', 'beta', 'stable', 'deprecated'])\n .default('beta'),\n owners: z.array(z.string()).default([]),\n tags: z.array(z.string()).default([]),\n payloadShape: z.string().describe('Description of event payload'),\n piiFields: z.array(z.string()).describe('PII field paths').default([]),\n });\n\n const prompt = buildEventSpecPrompt(description);\n\n const result = await generateObject({\n model,\n schema,\n prompt,\n system: getSystemPrompt(),\n });\n\n return result.object;\n }\n\n /**\n * Generate presentation spec from description\n */\n async generatePresentationSpec(description: string, kind: PresentationKind) {\n const model = getAIProvider(this.config);\n\n const schema = z.object({\n name: z.string(),\n version: z.number().int().positive().default(1),\n description: z.string(),\n stability: z\n .enum(['experimental', 'beta', 'stable', 'deprecated'])\n .default('beta'),\n owners: z.array(z.string()).default([]),\n tags: z.array(z.string()).default([]),\n componentKey: z.string().optional(),\n propsShape: z.string().optional(),\n content: z.string().optional(),\n mimeType: z.string().optional(),\n dataShape: z.string().optional(),\n });\n\n const prompt = buildPresentationSpecPrompt(description, kind);\n\n const result = await generateObject({\n model,\n schema,\n prompt,\n system: getSystemPrompt(),\n });\n\n return result.object;\n }\n\n /**\n * Generate handler implementation from spec\n */\n async generateHandler(specCode: string): Promise<string> {\n const model = getAIProvider(this.config);\n\n const result = await generateText({\n model,\n prompt: buildHandlerPrompt(specCode),\n system: getCodeGenSystemPrompt(),\n });\n\n return result.text;\n }\n\n /**\n * Generate React component from presentation spec\n */\n async generateComponent(specCode: string): Promise<string> {\n const model = getAIProvider(this.config);\n\n const result = await generateText({\n model,\n prompt: buildComponentPrompt(specCode),\n system: getCodeGenSystemPrompt(),\n });\n\n return result.text;\n }\n\n /**\n * Generate form component from form spec\n */\n async generateForm(specCode: string): Promise<string> {\n const model = getAIProvider(this.config);\n\n const result = await generateText({\n model,\n prompt: buildFormPrompt(specCode),\n system: getCodeGenSystemPrompt(),\n });\n\n return result.text;\n }\n\n /**\n * Generate tests for implementation\n */\n async generateTests(\n specCode: string,\n implementationCode: string,\n testType: 'handler' | 'component'\n ): Promise<string> {\n const model = getAIProvider(this.config);\n\n const result = await generateText({\n model,\n prompt: buildTestPrompt(specCode, implementationCode, testType),\n system: getCodeGenSystemPrompt(),\n });\n\n return result.text;\n }\n\n /**\n * Stream code generation for better UX\n */\n async streamCodeGeneration(\n prompt: string,\n onChunk: (text: string) => void\n ): Promise<string> {\n const model = getAIProvider(this.config);\n\n const result = await streamText({\n model,\n prompt,\n system: getCodeGenSystemPrompt(),\n });\n\n let fullText = '';\n\n for await (const chunk of result.textStream) {\n fullText += chunk;\n onChunk(chunk);\n }\n\n return fullText;\n }\n\n /**\n * Chat with the AI model\n */\n async chat(\n messages: { role: 'system' | 'user' | 'assistant'; content: string }[],\n system?: string\n ): Promise<string> {\n const model = getAIProvider(this.config);\n\n const result = await generateText({\n model,\n messages,\n system: system || getSystemPrompt(),\n });\n\n return result.text;\n }\n\n /**\n * Stream chat with the AI model\n */\n async streamChat(\n messages: { role: 'system' | 'user' | 'assistant'; content: string }[],\n onChunk: (text: string) => void,\n system?: string\n ): Promise<string> {\n const model = getAIProvider(this.config);\n\n const result = await streamText({\n model,\n messages,\n system: system || getSystemPrompt(),\n });\n\n let fullText = '';\n\n for await (const chunk of result.textStream) {\n fullText += chunk;\n onChunk(chunk);\n }\n\n return fullText;\n }\n}\n"],"mappings":";;;;;;;;;;AAsBA,IAAa,WAAb,MAAsB;CACpB,YAAY,AAAQ,QAAgB;EAAhB;;;;;CAKpB,MAAM,sBAAsB,aAAqB,MAAc;AAuC7D,UAPe,MAAM,eAAe;GAClC,OAhCY,cAAc,KAAK,OAAO;GAiCtC,QA/BaA,IAAE,OAAO;IACtB,MAAMA,IAAE,QAAQ,CAAC,SAAS,8CAA4C;IACtE,SAASA,IAAE,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,EAAE;IAC/C,aAAaA,IAAE,QAAQ,CAAC,SAAS,yBAAyB;IAC1D,MAAMA,IAAE,QAAQ,CAAC,SAAS,mBAAmB;IAC7C,SAASA,IAAE,QAAQ,CAAC,SAAS,6BAA6B;IAC1D,WAAWA,IACR,KAAK;KAAC;KAAgB;KAAQ;KAAU;KAAa,CAAC,CACtD,QAAQ,OAAO;IAClB,QAAQA,IAAE,MAAMA,IAAE,QAAQ,CAAC,CAAC,SAAS,mCAAmC;IACxE,MAAMA,IAAE,MAAMA,IAAE,QAAQ,CAAC,CAAC,SAAS,sBAAsB;IACzD,MAAMA,IACH,KAAK;KAAC;KAAa;KAAQ;KAAQ,CAAC,CACpC,SAAS,sBAAsB;IAClC,YAAYA,IAAE,QAAQ,CAAC,SAAS,iCAAiC;IACjE,aAAaA,IAAE,QAAQ,CAAC,SAAS,kCAAkC;IACnE,OAAOA,IAAE,MAAMA,IAAE,QAAQ,CAAC,CAAC,SAAS,gBAAgB,CAAC,QAAQ,EAAE,CAAC;IAChE,gBAAgBA,IACb,MAAMA,IAAE,QAAQ,CAAC,CACjB,SAAS,uBAAuB,CAChC,QAAQ,EAAE,CAAC;IACd,WAAWA,IACR,MAAMA,IAAE,QAAQ,CAAC,CACjB,SAAS,4BAA4B,CACrC,QAAQ,EAAE,CAAC;IACf,CAAC;GAOA,QALa,yBAAyB,aAAa,KAAK;GAMxD,QAAQ,iBAAiB;GAC1B,CAAC,EAEY;;;;;CAMhB,MAAM,kBAAkB,aAAqB;AAyB3C,UAPe,MAAM,eAAe;GAClC,OAlBY,cAAc,KAAK,OAAO;GAmBtC,QAjBaA,IAAE,OAAO;IACtB,MAAMA,IAAE,QAAQ,CAAC,SAAS,+CAA6C;IACvE,SAASA,IAAE,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,EAAE;IAC/C,aAAaA,IAAE,QAAQ,CAAC,SAAS,6BAA6B;IAC9D,WAAWA,IACR,KAAK;KAAC;KAAgB;KAAQ;KAAU;KAAa,CAAC,CACtD,QAAQ,OAAO;IAClB,QAAQA,IAAE,MAAMA,IAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;IACvC,MAAMA,IAAE,MAAMA,IAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;IACrC,cAAcA,IAAE,QAAQ,CAAC,SAAS,+BAA+B;IACjE,WAAWA,IAAE,MAAMA,IAAE,QAAQ,CAAC,CAAC,SAAS,kBAAkB,CAAC,QAAQ,EAAE,CAAC;IACvE,CAAC;GAOA,QALa,qBAAqB,YAAY;GAM9C,QAAQ,iBAAiB;GAC1B,CAAC,EAEY;;;;;CAMhB,MAAM,yBAAyB,aAAqB,MAAwB;AA4B1E,UAPe,MAAM,eAAe;GAClC,OArBY,cAAc,KAAK,OAAO;GAsBtC,QApBaA,IAAE,OAAO;IACtB,MAAMA,IAAE,QAAQ;IAChB,SAASA,IAAE,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,EAAE;IAC/C,aAAaA,IAAE,QAAQ;IACvB,WAAWA,IACR,KAAK;KAAC;KAAgB;KAAQ;KAAU;KAAa,CAAC,CACtD,QAAQ,OAAO;IAClB,QAAQA,IAAE,MAAMA,IAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;IACvC,MAAMA,IAAE,MAAMA,IAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;IACrC,cAAcA,IAAE,QAAQ,CAAC,UAAU;IACnC,YAAYA,IAAE,QAAQ,CAAC,UAAU;IACjC,SAASA,IAAE,QAAQ,CAAC,UAAU;IAC9B,UAAUA,IAAE,QAAQ,CAAC,UAAU;IAC/B,WAAWA,IAAE,QAAQ,CAAC,UAAU;IACjC,CAAC;GAOA,QALa,4BAA4B,aAAa,KAAK;GAM3D,QAAQ,iBAAiB;GAC1B,CAAC,EAEY;;;;;CAMhB,MAAM,gBAAgB,UAAmC;AASvD,UANe,MAAM,aAAa;GAChC,OAHY,cAAc,KAAK,OAAO;GAItC,QAAQ,mBAAmB,SAAS;GACpC,QAAQ,wBAAwB;GACjC,CAAC,EAEY;;;;;CAMhB,MAAM,kBAAkB,UAAmC;AASzD,UANe,MAAM,aAAa;GAChC,OAHY,cAAc,KAAK,OAAO;GAItC,QAAQ,qBAAqB,SAAS;GACtC,QAAQ,wBAAwB;GACjC,CAAC,EAEY;;;;;CAMhB,MAAM,aAAa,UAAmC;AASpD,UANe,MAAM,aAAa;GAChC,OAHY,cAAc,KAAK,OAAO;GAItC,QAAQ,gBAAgB,SAAS;GACjC,QAAQ,wBAAwB;GACjC,CAAC,EAEY;;;;;CAMhB,MAAM,cACJ,UACA,oBACA,UACiB;AASjB,UANe,MAAM,aAAa;GAChC,OAHY,cAAc,KAAK,OAAO;GAItC,QAAQ,gBAAgB,UAAU,oBAAoB,SAAS;GAC/D,QAAQ,wBAAwB;GACjC,CAAC,EAEY;;;;;CAMhB,MAAM,qBACJ,QACA,SACiB;EAGjB,MAAM,SAAS,MAAM,WAAW;GAC9B,OAHY,cAAc,KAAK,OAAO;GAItC;GACA,QAAQ,wBAAwB;GACjC,CAAC;EAEF,IAAI,WAAW;AAEf,aAAW,MAAM,SAAS,OAAO,YAAY;AAC3C,eAAY;AACZ,WAAQ,MAAM;;AAGhB,SAAO;;;;;CAMT,MAAM,KACJ,UACA,QACiB;AASjB,UANe,MAAM,aAAa;GAChC,OAHY,cAAc,KAAK,OAAO;GAItC;GACA,QAAQ,UAAU,iBAAiB;GACpC,CAAC,EAEY;;;;;CAMhB,MAAM,WACJ,UACA,SACA,QACiB;EAGjB,MAAM,SAAS,MAAM,WAAW;GAC9B,OAHY,cAAc,KAAK,OAAO;GAItC;GACA,QAAQ,UAAU,iBAAiB;GACpC,CAAC;EAEF,IAAI,WAAW;AAEf,aAAW,MAAM,SAAS,OAAO,YAAY;AAC3C,eAAY;AACZ,WAAQ,MAAM;;AAGhB,SAAO"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AIClient } from "./client.mjs";
|
|
2
|
+
import { getAIProvider, getRecommendedModels, validateProvider } from "./providers.mjs";
|
|
3
|
+
import { AgentConfig, AgentMode, AgentProvider, AgentResult, AgentTask } from "./agents/types.mjs";
|
|
4
|
+
import { AgentOrchestrator } from "./agents/orchestrator.mjs";
|
|
5
|
+
import { SimpleAgent } from "./agents/simple-agent.mjs";
|
|
6
|
+
import { CursorAgent } from "./agents/cursor-agent.mjs";
|
|
7
|
+
import { ClaudeCodeAgent } from "./agents/claude-code-agent.mjs";
|
|
8
|
+
import { OpenAICodexAgent } from "./agents/openai-codex-agent.mjs";
|
|
9
|
+
import { index_d_exports } from "./prompts/index.mjs";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { getAIProvider, getRecommendedModels, validateProvider } from "./providers.mjs";
|
|
2
|
+
import { SimpleAgent } from "./agents/simple-agent.mjs";
|
|
3
|
+
import { CursorAgent } from "./agents/cursor-agent.mjs";
|
|
4
|
+
import { ClaudeCodeAgent } from "./agents/claude-code-agent.mjs";
|
|
5
|
+
import { OpenAICodexAgent } from "./agents/openai-codex-agent.mjs";
|
|
6
|
+
import { AgentOrchestrator } from "./agents/orchestrator.mjs";
|
|
7
|
+
import { AIClient } from "./client.mjs";
|
|
8
|
+
import "./agents/index.mjs";
|
|
9
|
+
import { prompts_exports } from "./prompts/index.mjs";
|
|
10
|
+
|
|
11
|
+
export { };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
declare namespace code_generation_d_exports {
|
|
2
|
+
export { buildComponentPrompt, buildFormPrompt, buildHandlerPrompt, buildTestPrompt, getCodeGenSystemPrompt };
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Build prompt for generating handler implementation
|
|
6
|
+
*/
|
|
7
|
+
declare function buildHandlerPrompt(specCode: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Build prompt for generating React component from presentation spec
|
|
10
|
+
*/
|
|
11
|
+
declare function buildComponentPrompt(specCode: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Build prompt for generating form component
|
|
14
|
+
*/
|
|
15
|
+
declare function buildFormPrompt(specCode: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Build prompt for generating tests
|
|
18
|
+
*/
|
|
19
|
+
declare function buildTestPrompt(specCode: string, implementationCode: string, testType: 'handler' | 'component'): string;
|
|
20
|
+
/**
|
|
21
|
+
* System prompt for code generation
|
|
22
|
+
*/
|
|
23
|
+
declare function getCodeGenSystemPrompt(): string;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { code_generation_d_exports };
|
|
26
|
+
//# sourceMappingURL=code-generation.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-generation.d.mts","names":[],"sources":["../../../src/ai/prompts/code-generation.ts"],"sourcesContent":[],"mappings":";;;;;;iBAGgB,kBAAA;;;;iBA0BA,oBAAA;;;AA1BhB;AA0BgB,iBA0BA,eAAA,CA1BoB,QAAA,EAAA,MAAA,CAAA,EAAA,MAAA;AA0BpC;AA2BA;AA2CA;iBA3CgB,eAAA;;;;iBA2CA,sBAAA,CAAA"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { __exportAll } from "../../_virtual/rolldown_runtime.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/ai/prompts/code-generation.ts
|
|
4
|
+
var code_generation_exports = /* @__PURE__ */ __exportAll({
|
|
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.
|
|
16
|
+
|
|
17
|
+
Here is the contract spec:
|
|
18
|
+
|
|
19
|
+
\`\`\`typescript
|
|
20
|
+
${specCode}
|
|
21
|
+
\`\`\`
|
|
22
|
+
|
|
23
|
+
Generate a complete handler implementation that:
|
|
24
|
+
|
|
25
|
+
1. **Matches the spec signature**: Input/output types from the spec
|
|
26
|
+
2. **Handles errors**: Implement error cases defined in spec.io.errors
|
|
27
|
+
3. **Emits events**: Use the events declared in spec.sideEffects.emits
|
|
28
|
+
4. **Validates input**: Use zod validation from the schema
|
|
29
|
+
5. **Follows best practices**: Clean, type-safe TypeScript
|
|
30
|
+
6. **Includes comments**: Explain business logic
|
|
31
|
+
|
|
32
|
+
The handler should be production-ready with proper error handling, logging points, and clear structure.
|
|
33
|
+
|
|
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.
|
|
41
|
+
|
|
42
|
+
Here is the presentation spec:
|
|
43
|
+
|
|
44
|
+
\`\`\`typescript
|
|
45
|
+
${specCode}
|
|
46
|
+
\`\`\`
|
|
47
|
+
|
|
48
|
+
Generate a complete React component that:
|
|
49
|
+
|
|
50
|
+
1. **Props interface**: Typed props from the spec
|
|
51
|
+
2. **Accessibility**: Proper ARIA labels, roles, keyboard navigation
|
|
52
|
+
3. **Mobile-first**: Optimized for small screens and touch
|
|
53
|
+
4. **Clean UI**: Simple, intuitive interface
|
|
54
|
+
5. **Type-safe**: Full TypeScript with no 'any' types
|
|
55
|
+
6. **Best practices**: React hooks, proper state management
|
|
56
|
+
|
|
57
|
+
The component should follow Atomic Design principles and be reusable.
|
|
58
|
+
|
|
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.
|
|
66
|
+
|
|
67
|
+
Here is the form spec:
|
|
68
|
+
|
|
69
|
+
\`\`\`typescript
|
|
70
|
+
${specCode}
|
|
71
|
+
\`\`\`
|
|
72
|
+
|
|
73
|
+
Generate a complete form component using react-hook-form that:
|
|
74
|
+
|
|
75
|
+
1. **Form validation**: Use zod schema for validation
|
|
76
|
+
2. **Field types**: Proper inputs for each field type
|
|
77
|
+
3. **Conditional logic**: Support visibleWhen, enabledWhen, requiredWhen predicates
|
|
78
|
+
4. **Error handling**: Clear, user-friendly error messages
|
|
79
|
+
5. **Accessibility**: Labels, hints, ARIA attributes
|
|
80
|
+
6. **Mobile-optimized**: Touch-friendly, appropriate input types
|
|
81
|
+
7. **Type-safe**: Full TypeScript
|
|
82
|
+
|
|
83
|
+
The form should provide excellent UX with real-time validation and helpful feedback.
|
|
84
|
+
|
|
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.
|
|
92
|
+
|
|
93
|
+
Spec:
|
|
94
|
+
\`\`\`typescript
|
|
95
|
+
${specCode}
|
|
96
|
+
\`\`\`
|
|
97
|
+
|
|
98
|
+
Implementation:
|
|
99
|
+
\`\`\`typescript
|
|
100
|
+
${implementationCode}
|
|
101
|
+
\`\`\`
|
|
102
|
+
|
|
103
|
+
Generate complete test suite using Vitest that:
|
|
104
|
+
${testType === "handler" ? `
|
|
105
|
+
- Test all acceptance scenarios from the spec
|
|
106
|
+
- Test error cases defined in spec.io.errors
|
|
107
|
+
- Verify events are emitted correctly
|
|
108
|
+
- Test input validation
|
|
109
|
+
- Test happy path and edge cases` : `
|
|
110
|
+
- Test rendering with various props
|
|
111
|
+
- Test user interactions
|
|
112
|
+
- Test accessibility (a11y)
|
|
113
|
+
- Test responsive behavior
|
|
114
|
+
- Test error states`}
|
|
115
|
+
|
|
116
|
+
Use clear test descriptions and follow AAA pattern (Arrange, Act, Assert).
|
|
117
|
+
|
|
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:
|
|
125
|
+
- Type-safe API design
|
|
126
|
+
- React and modern hooks
|
|
127
|
+
- Test-driven development
|
|
128
|
+
- Accessibility best practices
|
|
129
|
+
- Clean code principles
|
|
130
|
+
|
|
131
|
+
Generate production-ready code that is:
|
|
132
|
+
- Fully typed (no 'any' or type assertions unless absolutely necessary)
|
|
133
|
+
- Well-documented with TSDoc comments
|
|
134
|
+
- Following project conventions
|
|
135
|
+
- Defensive and error-safe
|
|
136
|
+
- Easy to maintain and extend
|
|
137
|
+
|
|
138
|
+
Always prioritize code quality, safety, and user experience.`;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
//#endregion
|
|
142
|
+
export { buildComponentPrompt, buildFormPrompt, buildHandlerPrompt, buildTestPrompt, code_generation_exports, getCodeGenSystemPrompt };
|
|
143
|
+
//# sourceMappingURL=code-generation.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-generation.mjs","names":[],"sources":["../../../src/ai/prompts/code-generation.ts"],"sourcesContent":["/**\n * Build prompt for generating handler implementation\n */\nexport function buildHandlerPrompt(specCode: string): string {\n return `You are a senior TypeScript developer implementing a handler for a contract specification.\n\nHere is the contract spec:\n\n\\`\\`\\`typescript\n${specCode}\n\\`\\`\\`\n\nGenerate a complete handler implementation that:\n\n1. **Matches the spec signature**: Input/output types from the spec\n2. **Handles errors**: Implement error cases defined in spec.io.errors\n3. **Emits events**: Use the events declared in spec.sideEffects.emits\n4. **Validates input**: Use zod validation from the schema\n5. **Follows best practices**: Clean, type-safe TypeScript\n6. **Includes comments**: Explain business logic\n\nThe handler should be production-ready with proper error handling, logging points, and clear structure.\n\nReturn only the TypeScript code for the handler function.`;\n}\n\n/**\n * Build prompt for generating React component from presentation spec\n */\nexport function buildComponentPrompt(specCode: string): string {\n return `You are a senior React developer creating a component for a presentation specification.\n\nHere is the presentation spec:\n\n\\`\\`\\`typescript\n${specCode}\n\\`\\`\\`\n\nGenerate a complete React component that:\n\n1. **Props interface**: Typed props from the spec\n2. **Accessibility**: Proper ARIA labels, roles, keyboard navigation\n3. **Mobile-first**: Optimized for small screens and touch\n4. **Clean UI**: Simple, intuitive interface\n5. **Type-safe**: Full TypeScript with no 'any' types\n6. **Best practices**: React hooks, proper state management\n\nThe component should follow Atomic Design principles and be reusable.\n\nReturn only the TypeScript/TSX code for the component.`;\n}\n\n/**\n * Build prompt for generating form component\n */\nexport function buildFormPrompt(specCode: string): string {\n return `You are a senior React developer creating a form component from a form specification.\n\nHere is the form spec:\n\n\\`\\`\\`typescript\n${specCode}\n\\`\\`\\`\n\nGenerate a complete form component using react-hook-form that:\n\n1. **Form validation**: Use zod schema for validation\n2. **Field types**: Proper inputs for each field type\n3. **Conditional logic**: Support visibleWhen, enabledWhen, requiredWhen predicates\n4. **Error handling**: Clear, user-friendly error messages\n5. **Accessibility**: Labels, hints, ARIA attributes\n6. **Mobile-optimized**: Touch-friendly, appropriate input types\n7. **Type-safe**: Full TypeScript\n\nThe form should provide excellent UX with real-time validation and helpful feedback.\n\nReturn only the TypeScript/TSX code for the form component.`;\n}\n\n/**\n * Build prompt for generating tests\n */\nexport function buildTestPrompt(\n specCode: string,\n implementationCode: string,\n testType: 'handler' | 'component'\n): string {\n const testFocus =\n testType === 'handler'\n ? `\n - Test all acceptance scenarios from the spec\n - Test error cases defined in spec.io.errors\n - Verify events are emitted correctly\n - Test input validation\n - Test happy path and edge cases`\n : `\n - Test rendering with various props\n - Test user interactions\n - Test accessibility (a11y)\n - Test responsive behavior\n - Test error states`;\n\n return `You are a senior developer writing comprehensive tests.\n\nSpec:\n\\`\\`\\`typescript\n${specCode}\n\\`\\`\\`\n\nImplementation:\n\\`\\`\\`typescript\n${implementationCode}\n\\`\\`\\`\n\nGenerate complete test suite using Vitest that:\n${testFocus}\n\nUse clear test descriptions and follow AAA pattern (Arrange, Act, Assert).\n\nReturn only the TypeScript test code.`;\n}\n\n/**\n * System prompt for code generation\n */\nexport function getCodeGenSystemPrompt(): string {\n return `You are an expert TypeScript developer with deep knowledge of:\n- Type-safe API design\n- React and modern hooks\n- Test-driven development\n- Accessibility best practices\n- Clean code principles\n\nGenerate production-ready code that is:\n- Fully typed (no 'any' or type assertions unless absolutely necessary)\n- Well-documented with TSDoc comments\n- Following project conventions\n- Defensive and error-safe\n- Easy to maintain and extend\n\nAlways prioritize code quality, safety, and user experience.`;\n}\n"],"mappings":";;;;;;;;;;;;;AAGA,SAAgB,mBAAmB,UAA0B;AAC3D,QAAO;;;;;EAKP,SAAS;;;;;;;;;;;;;;;;;;;AAoBX,SAAgB,qBAAqB,UAA0B;AAC7D,QAAO;;;;;EAKP,SAAS;;;;;;;;;;;;;;;;;;;AAoBX,SAAgB,gBAAgB,UAA0B;AACxD,QAAO;;;;;EAKP,SAAS;;;;;;;;;;;;;;;;;;;;AAqBX,SAAgB,gBACd,UACA,oBACA,UACQ;AAgBR,QAAO;;;;EAIP,SAAS;;;;;EAKT,mBAAmB;;;;EAvBjB,aAAa,YACT;;;;;sCAMA;;;;;uBAoBI;;;;;;;;;AAUZ,SAAgB,yBAAiC;AAC/C,QAAO"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { code_generation_d_exports } from "./code-generation.mjs";
|
|
2
|
+
import { spec_creation_d_exports } from "./spec-creation.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/ai/prompts/index.d.ts
|
|
5
|
+
declare namespace index_d_exports {
|
|
6
|
+
export { code_generation_d_exports as codeGeneration, spec_creation_d_exports as specCreation };
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { index_d_exports };
|
|
10
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/ai/prompts/index.ts"],"sourcesContent":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { __exportAll } from "../../_virtual/rolldown_runtime.mjs";
|
|
2
|
+
import { code_generation_exports } from "./code-generation.mjs";
|
|
3
|
+
import { spec_creation_exports } from "./spec-creation.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/ai/prompts/index.ts
|
|
6
|
+
var prompts_exports = /* @__PURE__ */ __exportAll({
|
|
7
|
+
codeGeneration: () => code_generation_exports,
|
|
8
|
+
specCreation: () => spec_creation_exports
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { prompts_exports };
|
|
13
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/ai/prompts/index.ts"],"sourcesContent":["/**\n * AI prompts for ContractSpec.\n */\n\nexport * as codeGeneration from './code-generation';\nexport * as specCreation from './spec-creation';\n"],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { OpKind, PresentationKind } from "../../types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/ai/prompts/spec-creation.d.ts
|
|
4
|
+
declare namespace spec_creation_d_exports {
|
|
5
|
+
export { addExampleContext, buildEventSpecPrompt, buildOperationSpecPrompt, buildPresentationSpecPrompt, getSystemPrompt };
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Build prompt for creating operation spec from description
|
|
9
|
+
*/
|
|
10
|
+
declare function buildOperationSpecPrompt(description: string, kind: OpKind): string;
|
|
11
|
+
/**
|
|
12
|
+
* Build prompt for creating event spec from description
|
|
13
|
+
*/
|
|
14
|
+
declare function buildEventSpecPrompt(description: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Build prompt for creating presentation spec from description
|
|
17
|
+
*/
|
|
18
|
+
declare function buildPresentationSpecPrompt(description: string, kind: PresentationKind): string;
|
|
19
|
+
/**
|
|
20
|
+
* Build system prompt for all spec generation
|
|
21
|
+
*/
|
|
22
|
+
declare function getSystemPrompt(): string;
|
|
23
|
+
/**
|
|
24
|
+
* Create example-based prompt for better results
|
|
25
|
+
*/
|
|
26
|
+
declare function addExampleContext(basePrompt: string, examples: string[]): string;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { spec_creation_d_exports };
|
|
29
|
+
//# sourceMappingURL=spec-creation.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec-creation.d.mts","names":[],"sources":["../../../src/ai/prompts/spec-creation.ts"],"sourcesContent":[],"mappings":";;;;;;;;;iBAKgB,wBAAA,4BAER;;;;iBA0BQ,oBAAA;;;AA5BhB;AA4BgB,iBAqBA,2BAAA,CArBoB,WAAA,EAAA,MAAA,EAAA,IAAA,EAuB5B,gBAvB4B,CAAA,EAAA,MAAA;AAqBpC;AAoCA;AAiBA;iBAjBgB,eAAA,CAAA;;;;iBAiBA,iBAAA"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { __exportAll } from "../../_virtual/rolldown_runtime.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/ai/prompts/spec-creation.ts
|
|
4
|
+
var spec_creation_exports = /* @__PURE__ */ __exportAll({
|
|
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}
|
|
20
|
+
|
|
21
|
+
Create a complete contract specification following these guidelines:
|
|
22
|
+
|
|
23
|
+
1. **Name**: Use dot notation like "domain.operationName" (e.g., "user.signup", "payment.charge")
|
|
24
|
+
2. **Version**: Start at 1
|
|
25
|
+
3. **Description**: Clear, concise summary (1-2 sentences)
|
|
26
|
+
4. **Goal**: Business purpose - why this operation exists
|
|
27
|
+
5. **Context**: Background, constraints, scope (what it does and doesn't do)
|
|
28
|
+
6. **Input/Output**: Describe the shape (we'll create schemas separately)
|
|
29
|
+
7. **Auth**: Who can call this - anonymous, user, or admin
|
|
30
|
+
8. **Feature Flags**: Any flags that gate this operation
|
|
31
|
+
9. **Side Effects**: What events might be emitted, analytics to track
|
|
32
|
+
|
|
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.
|
|
40
|
+
|
|
41
|
+
User description: ${description}
|
|
42
|
+
|
|
43
|
+
Create a complete event specification following these guidelines:
|
|
44
|
+
|
|
45
|
+
1. **Name**: Use dot notation like "domain.event_name" (e.g., "user.signup_completed", "payment.charged")
|
|
46
|
+
2. **Version**: Start at 1
|
|
47
|
+
3. **Description**: Clear description of when this event is emitted
|
|
48
|
+
4. **Payload**: Describe what data the event carries
|
|
49
|
+
5. **PII Fields**: List any personally identifiable information fields (e.g., ["email", "name"])
|
|
50
|
+
|
|
51
|
+
Events represent things that have already happened and should use past tense.
|
|
52
|
+
|
|
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.
|
|
60
|
+
|
|
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]}.
|
|
66
|
+
|
|
67
|
+
User description: ${description}
|
|
68
|
+
|
|
69
|
+
Create a complete presentation specification following these guidelines:
|
|
70
|
+
|
|
71
|
+
1. **Name**: Use dot notation like "domain.presentation_name" (e.g., "user.profile_card", "docs.api_guide")
|
|
72
|
+
2. **Version**: Start at 1
|
|
73
|
+
3. **Description**: What this presentation shows/provides
|
|
74
|
+
4. **Kind-specific details**:
|
|
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"}
|
|
76
|
+
|
|
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.
|
|
84
|
+
|
|
85
|
+
You create clear, well-documented specifications that serve as the single source of truth for operations, events, and presentations.
|
|
86
|
+
|
|
87
|
+
Your specs are:
|
|
88
|
+
- Precise and unambiguous
|
|
89
|
+
- Following TypeScript conventions
|
|
90
|
+
- Business-oriented (capturing the "why" not just "what")
|
|
91
|
+
- Designed for both humans and AI agents to understand
|
|
92
|
+
|
|
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}
|
|
101
|
+
|
|
102
|
+
Here are some good examples for reference:
|
|
103
|
+
|
|
104
|
+
${examples.join("\n\n")}
|
|
105
|
+
|
|
106
|
+
Follow this structure and quality level.`;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
//#endregion
|
|
110
|
+
export { buildEventSpecPrompt, buildOperationSpecPrompt, buildPresentationSpecPrompt, getSystemPrompt, spec_creation_exports };
|
|
111
|
+
//# sourceMappingURL=spec-creation.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec-creation.mjs","names":[],"sources":["../../../src/ai/prompts/spec-creation.ts"],"sourcesContent":["import type { OpKind, PresentationKind } from '../../types';\n\n/**\n * Build prompt for creating operation spec from description\n */\nexport function buildOperationSpecPrompt(\n description: string,\n kind: OpKind\n): string {\n return `You are a senior software architect creating a contract specification for an operation.\n\nThe operation is a ${kind} (${kind === 'command' ? 'changes state, has side effects' : 'read-only, idempotent'}).\n\nUser description: ${description}\n\nCreate a complete contract specification following these guidelines:\n\n1. **Name**: Use dot notation like \"domain.operationName\" (e.g., \"user.signup\", \"payment.charge\")\n2. **Version**: Start at 1\n3. **Description**: Clear, concise summary (1-2 sentences)\n4. **Goal**: Business purpose - why this operation exists\n5. **Context**: Background, constraints, scope (what it does and doesn't do)\n6. **Input/Output**: Describe the shape (we'll create schemas separately)\n7. **Auth**: Who can call this - anonymous, user, or admin\n8. **Feature Flags**: Any flags that gate this operation\n9. **Side Effects**: What events might be emitted, analytics to track\n\nRespond with a structured spec.`;\n}\n\n/**\n * Build prompt for creating event spec from description\n */\nexport function buildEventSpecPrompt(description: string): string {\n return `You are a senior software architect creating an event specification.\n\nUser description: ${description}\n\nCreate a complete event specification following these guidelines:\n\n1. **Name**: Use dot notation like \"domain.event_name\" (e.g., \"user.signup_completed\", \"payment.charged\")\n2. **Version**: Start at 1\n3. **Description**: Clear description of when this event is emitted\n4. **Payload**: Describe what data the event carries\n5. **PII Fields**: List any personally identifiable information fields (e.g., [\"email\", \"name\"])\n\nEvents represent things that have already happened and should use past tense.\n\nRespond with a structured spec.`;\n}\n\n/**\n * Build prompt for creating presentation spec from description\n */\nexport function buildPresentationSpecPrompt(\n description: string,\n kind: PresentationKind\n): string {\n const kindDescriptions = {\n web_component: 'a React component with props schema',\n markdown: 'markdown/MDX documentation or guide',\n data: 'structured data export (JSON/XML)',\n };\n\n return `You are a senior software architect creating a presentation specification.\n\nThis is a ${kind} presentation - ${kindDescriptions[kind]}.\n\nUser description: ${description}\n\nCreate a complete presentation specification following these guidelines:\n\n1. **Name**: Use dot notation like \"domain.presentation_name\" (e.g., \"user.profile_card\", \"docs.api_guide\")\n2. **Version**: Start at 1\n3. **Description**: What this presentation shows/provides\n4. **Kind-specific details**:\n ${\n kind === 'web_component'\n ? '- Component key (symbolic, resolved by host app)\\n - Props structure\\n - Analytics events to track'\n : kind === 'markdown'\n ? '- Content or resource URI\\n - Target audience'\n : '- MIME type (e.g., application/json)\\n - Data structure description'\n }\n\nRespond with a structured spec.`;\n}\n\n/**\n * Build system prompt for all spec generation\n */\nexport function getSystemPrompt(): string {\n return `You are an expert software architect specializing in API design and contract-driven development.\n\nYou create clear, well-documented specifications that serve as the single source of truth for operations, events, and presentations.\n\nYour specs are:\n- Precise and unambiguous\n- Following TypeScript conventions\n- Business-oriented (capturing the \"why\" not just \"what\")\n- Designed for both humans and AI agents to understand\n\nAlways use proper dot notation for names and ensure all metadata is meaningful and accurate.`;\n}\n\n/**\n * Create example-based prompt for better results\n */\nexport function addExampleContext(\n basePrompt: string,\n examples: string[]\n): string {\n if (examples.length === 0) return basePrompt;\n\n return `${basePrompt}\n\nHere are some good examples for reference:\n\n${examples.join('\\n\\n')}\n\nFollow this structure and quality level.`;\n}\n"],"mappings":";;;;;;;;;;;;;AAKA,SAAgB,yBACd,aACA,MACQ;AACR,QAAO;;qBAEY,KAAK,IAAI,SAAS,YAAY,oCAAoC,wBAAwB;;oBAE3F,YAAY;;;;;;;;;;;;;;;;;;;AAoBhC,SAAgB,qBAAqB,aAA6B;AAChE,QAAO;;oBAEW,YAAY;;;;;;;;;;;;;;;;;AAkBhC,SAAgB,4BACd,aACA,MACQ;AAOR,QAAO;;YAEG,KAAK,kBARU;EACvB,eAAe;EACf,UAAU;EACV,MAAM;EACP,CAIiD,MAAM;;oBAEtC,YAAY;;;;;;;;KAS3B,SAAS,kBACL,2GACA,SAAS,aACP,oDACA,wEACP;;;;;;;AAQJ,SAAgB,kBAA0B;AACxC,QAAO;;;;;;;;;;;;;;;AAgBT,SAAgB,kBACd,YACA,UACQ;AACR,KAAI,SAAS,WAAW,EAAG,QAAO;AAElC,QAAO,GAAG,WAAW;;;;EAIrB,SAAS,KAAK,OAAO,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Config } from "../types/config.mjs";
|
|
2
|
+
import { LanguageModel } from "ai";
|
|
3
|
+
|
|
4
|
+
//#region src/ai/providers.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Initialize AI provider based on configuration
|
|
8
|
+
*
|
|
9
|
+
* @deprecated Use createProvider() from @contractspec/lib.ai-providers instead
|
|
10
|
+
*/
|
|
11
|
+
declare function getAIProvider(config: Config): LanguageModel;
|
|
12
|
+
/**
|
|
13
|
+
* Validate that the provider is accessible and working
|
|
14
|
+
*
|
|
15
|
+
* @deprecated Use validateProvider() from @contractspec/lib.ai-providers instead
|
|
16
|
+
*/
|
|
17
|
+
declare function validateProvider(config: Config): Promise<{
|
|
18
|
+
success: boolean;
|
|
19
|
+
error?: string;
|
|
20
|
+
}>;
|
|
21
|
+
/**
|
|
22
|
+
* Get recommended models for each provider
|
|
23
|
+
*
|
|
24
|
+
* @deprecated Use getModelsForProvider() from @contractspec/lib.ai-providers instead
|
|
25
|
+
*/
|
|
26
|
+
declare function getRecommendedModels(provider: Config['aiProvider']): string[];
|
|
27
|
+
//#endregion
|
|
28
|
+
export { getAIProvider, getRecommendedModels, validateProvider };
|
|
29
|
+
//# sourceMappingURL=providers.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.d.mts","names":[],"sources":["../../src/ai/providers.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;iBAmBgB,aAAA,SAAsB,SAAS;;;;;;iBAczB,gBAAA,SACZ,SACP;;;;;;;;;iBAea,oBAAA,WAA+B"}
|