@lssm/bundle.contractspec-workspace 1.41.1 → 1.42.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +5 -2
- package/dist/_virtual/rolldown_runtime.js +36 -1
- package/dist/adapters/ai.d.ts +12 -0
- package/dist/adapters/ai.d.ts.map +1 -0
- package/dist/adapters/ai.js +83 -1
- package/dist/adapters/ai.js.map +1 -0
- package/dist/adapters/factory.d.ts +29 -0
- package/dist/adapters/factory.d.ts.map +1 -0
- package/dist/adapters/factory.js +37 -1
- package/dist/adapters/factory.js.map +1 -0
- package/dist/adapters/fs.d.ts +11 -0
- package/dist/adapters/fs.d.ts.map +1 -0
- package/dist/adapters/fs.js +131 -1
- package/dist/adapters/fs.js.map +1 -0
- package/dist/adapters/git.d.ts +11 -0
- package/dist/adapters/git.d.ts.map +1 -0
- package/dist/adapters/git.js +55 -1
- package/dist/adapters/git.js.map +1 -0
- package/dist/adapters/index.d.ts +7 -0
- package/dist/adapters/index.js +7 -1
- package/dist/adapters/logger.d.ts +18 -0
- package/dist/adapters/logger.d.ts.map +1 -0
- package/dist/adapters/logger.js +81 -1
- package/dist/adapters/logger.js.map +1 -0
- package/dist/adapters/watcher.d.ts +11 -0
- package/dist/adapters/watcher.d.ts.map +1 -0
- package/dist/adapters/watcher.js +74 -1
- package/dist/adapters/watcher.js.map +1 -0
- package/dist/adapters/workspace.d.ts +148 -0
- package/dist/adapters/workspace.d.ts.map +1 -0
- package/dist/adapters/workspace.js +275 -2
- package/dist/adapters/workspace.js.map +1 -0
- package/dist/ai/agents/claude-code-agent.d.ts +22 -0
- package/dist/ai/agents/claude-code-agent.d.ts.map +1 -0
- package/dist/ai/agents/claude-code-agent.js +147 -9
- package/dist/ai/agents/claude-code-agent.js.map +1 -0
- package/dist/ai/agents/cursor-agent.d.ts +68 -0
- package/dist/ai/agents/cursor-agent.d.ts.map +1 -0
- package/dist/ai/agents/cursor-agent.js +285 -17
- package/dist/ai/agents/cursor-agent.js.map +1 -0
- package/dist/ai/agents/index.js +5 -1
- package/dist/ai/agents/openai-codex-agent.d.ts +22 -0
- package/dist/ai/agents/openai-codex-agent.d.ts.map +1 -0
- package/dist/ai/agents/openai-codex-agent.js +141 -8
- package/dist/ai/agents/openai-codex-agent.js.map +1 -0
- package/dist/ai/agents/orchestrator.d.ts +50 -0
- package/dist/ai/agents/orchestrator.d.ts.map +1 -0
- package/dist/ai/agents/orchestrator.js +143 -1
- package/dist/ai/agents/orchestrator.js.map +1 -0
- package/dist/ai/agents/simple-agent.d.ts +17 -0
- package/dist/ai/agents/simple-agent.d.ts.map +1 -0
- package/dist/ai/agents/simple-agent.js +81 -4
- package/dist/ai/agents/simple-agent.js.map +1 -0
- package/dist/ai/agents/types.d.ts +36 -0
- package/dist/ai/agents/types.d.ts.map +1 -0
- package/dist/ai/client.d.ts +83 -0
- package/dist/ai/client.d.ts.map +1 -0
- package/dist/ai/client.js +163 -1
- package/dist/ai/client.js.map +1 -0
- package/dist/ai/index.d.ts +17 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +28 -1
- package/dist/ai/index.js.map +1 -0
- package/dist/ai/prompts/code-generation.d.ts +26 -0
- package/dist/ai/prompts/code-generation.d.ts.map +1 -0
- package/dist/ai/prompts/code-generation.js +56 -13
- package/dist/ai/prompts/code-generation.js.map +1 -0
- package/dist/ai/prompts/index.d.ts +10 -0
- package/dist/ai/prompts/index.d.ts.map +1 -0
- package/dist/ai/prompts/index.js +13 -1
- package/dist/ai/prompts/index.js.map +1 -0
- package/dist/ai/prompts/spec-creation.d.ts +29 -0
- package/dist/ai/prompts/spec-creation.d.ts.map +1 -0
- package/dist/ai/prompts/spec-creation.js +62 -20
- package/dist/ai/prompts/spec-creation.js.map +1 -0
- package/dist/ai/providers.d.ts +29 -0
- package/dist/ai/providers.d.ts.map +1 -0
- package/dist/ai/providers.js +39 -1
- package/dist/ai/providers.js.map +1 -0
- package/dist/formatters/index.d.ts +11 -0
- package/dist/formatters/index.d.ts.map +1 -0
- package/dist/formatters/index.js +19 -1
- package/dist/formatters/index.js.map +1 -0
- package/dist/formatters/json.d.ts +89 -0
- package/dist/formatters/json.d.ts.map +1 -0
- package/dist/formatters/json.js +72 -1
- package/dist/formatters/json.js.map +1 -0
- package/dist/formatters/sarif.d.ts +101 -0
- package/dist/formatters/sarif.d.ts.map +1 -0
- package/dist/formatters/sarif.js +163 -1
- package/dist/formatters/sarif.js.map +1 -0
- package/dist/formatters/text.d.ts +35 -0
- package/dist/formatters/text.d.ts.map +1 -0
- package/dist/formatters/text.js +209 -2
- package/dist/formatters/text.js.map +1 -0
- package/dist/index.d.ts +82 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +204 -1
- package/dist/index.js.map +1 -0
- package/dist/ports/ai.d.ts +59 -0
- package/dist/ports/ai.d.ts.map +1 -0
- package/dist/ports/fs.d.ts +81 -0
- package/dist/ports/fs.d.ts.map +1 -0
- package/dist/ports/git.d.ts +33 -0
- package/dist/ports/git.d.ts.map +1 -0
- package/dist/ports/index.d.ts +5 -0
- package/dist/ports/logger.d.ts +88 -0
- package/dist/ports/logger.d.ts.map +1 -0
- package/dist/ports/watcher.d.ts +52 -0
- package/dist/ports/watcher.d.ts.map +1 -0
- package/dist/services/agent-guide/adapters/claude-code.d.ts +35 -0
- package/dist/services/agent-guide/adapters/claude-code.d.ts.map +1 -0
- package/dist/services/agent-guide/adapters/claude-code.js +144 -3
- package/dist/services/agent-guide/adapters/claude-code.js.map +1 -0
- package/dist/services/agent-guide/adapters/cursor-cli.d.ts +39 -0
- package/dist/services/agent-guide/adapters/cursor-cli.d.ts.map +1 -0
- package/dist/services/agent-guide/adapters/cursor-cli.js +135 -3
- package/dist/services/agent-guide/adapters/cursor-cli.js.map +1 -0
- package/dist/services/agent-guide/adapters/generic-mcp.d.ts +53 -0
- package/dist/services/agent-guide/adapters/generic-mcp.d.ts.map +1 -0
- package/dist/services/agent-guide/adapters/generic-mcp.js +159 -3
- package/dist/services/agent-guide/adapters/generic-mcp.js.map +1 -0
- package/dist/services/agent-guide/adapters/index.d.ts +23 -0
- package/dist/services/agent-guide/adapters/index.d.ts.map +1 -0
- package/dist/services/agent-guide/adapters/index.js +31 -1
- package/dist/services/agent-guide/adapters/index.js.map +1 -0
- package/dist/services/agent-guide/agent-guide-service.d.ts +56 -0
- package/dist/services/agent-guide/agent-guide-service.d.ts.map +1 -0
- package/dist/services/agent-guide/agent-guide-service.js +147 -1
- package/dist/services/agent-guide/agent-guide-service.js.map +1 -0
- package/dist/services/agent-guide/index.d.ts +6 -0
- package/dist/services/agent-guide/index.js +5 -1
- package/dist/services/agent-guide/types.d.ts +58 -0
- package/dist/services/agent-guide/types.d.ts.map +1 -0
- package/dist/services/build.d.ts +59 -0
- package/dist/services/build.d.ts.map +1 -0
- package/dist/services/build.js +140 -1
- package/dist/services/build.js.map +1 -0
- package/dist/services/ci-check/ci-check-service.d.ts +16 -0
- package/dist/services/ci-check/ci-check-service.d.ts.map +1 -0
- package/dist/services/ci-check/ci-check-service.js +392 -1
- package/dist/services/ci-check/ci-check-service.js.map +1 -0
- package/dist/services/ci-check/index.d.ts +2 -0
- package/dist/services/ci-check/index.js +2 -1
- package/dist/services/ci-check/types.d.ts +143 -0
- package/dist/services/ci-check/types.d.ts.map +1 -0
- package/dist/services/ci-check/types.js +29 -1
- package/dist/services/ci-check/types.js.map +1 -0
- package/dist/services/clean.d.ts +41 -0
- package/dist/services/clean.d.ts.map +1 -0
- package/dist/services/clean.js +72 -1
- package/dist/services/clean.js.map +1 -0
- package/dist/services/config.d.ts +26 -0
- package/dist/services/config.d.ts.map +1 -0
- package/dist/services/config.js +77 -1
- package/dist/services/config.js.map +1 -0
- package/dist/services/deps.d.ts +53 -0
- package/dist/services/deps.d.ts.map +1 -0
- package/dist/services/deps.js +62 -1
- package/dist/services/deps.js.map +1 -0
- package/dist/services/diff.d.ts +34 -0
- package/dist/services/diff.d.ts.map +1 -0
- package/dist/services/diff.js +34 -1
- package/dist/services/diff.js.map +1 -0
- package/dist/services/doctor/checks/ai.js +119 -2
- package/dist/services/doctor/checks/ai.js.map +1 -0
- package/dist/services/doctor/checks/cli.js +147 -1
- package/dist/services/doctor/checks/cli.js.map +1 -0
- package/dist/services/doctor/checks/config.js +171 -1
- package/dist/services/doctor/checks/config.js.map +1 -0
- package/dist/services/doctor/checks/deps.js +247 -1
- package/dist/services/doctor/checks/deps.js.map +1 -0
- package/dist/services/doctor/checks/index.js +6 -1
- package/dist/services/doctor/checks/mcp.js +145 -1
- package/dist/services/doctor/checks/mcp.js.map +1 -0
- package/dist/services/doctor/checks/workspace.js +244 -1
- package/dist/services/doctor/checks/workspace.js.map +1 -0
- package/dist/services/doctor/doctor-service.d.ts +24 -0
- package/dist/services/doctor/doctor-service.d.ts.map +1 -0
- package/dist/services/doctor/doctor-service.js +116 -2
- package/dist/services/doctor/doctor-service.js.map +1 -0
- package/dist/services/doctor/index.d.ts +2 -0
- package/dist/services/doctor/index.js +2 -1
- package/dist/services/doctor/types.d.ts +118 -0
- package/dist/services/doctor/types.d.ts.map +1 -0
- package/dist/services/doctor/types.js +27 -1
- package/dist/services/doctor/types.js.map +1 -0
- package/dist/services/impact/formatters.d.ts +27 -0
- package/dist/services/impact/formatters.d.ts.map +1 -0
- package/dist/services/impact/formatters.js +111 -0
- package/dist/services/impact/formatters.js.map +1 -0
- package/dist/services/impact/impact-detection-service.d.ts +22 -0
- package/dist/services/impact/impact-detection-service.d.ts.map +1 -0
- package/dist/services/impact/impact-detection-service.js +96 -0
- package/dist/services/impact/impact-detection-service.js.map +1 -0
- package/dist/services/impact/index.d.ts +11 -0
- package/dist/services/impact/index.d.ts.map +1 -0
- package/dist/services/impact/index.js +16 -0
- package/dist/services/impact/index.js.map +1 -0
- package/dist/services/impact/types.d.ts +58 -0
- package/dist/services/impact/types.d.ts.map +1 -0
- package/dist/services/implementation/discovery.d.ts +30 -0
- package/dist/services/implementation/discovery.d.ts.map +1 -0
- package/dist/services/implementation/discovery.js +144 -2
- package/dist/services/implementation/discovery.js.map +1 -0
- package/dist/services/implementation/index.d.ts +3 -0
- package/dist/services/implementation/index.js +2 -1
- package/dist/services/implementation/resolver.d.ts +44 -0
- package/dist/services/implementation/resolver.d.ts.map +1 -0
- package/dist/services/implementation/resolver.js +224 -1
- package/dist/services/implementation/resolver.js.map +1 -0
- package/dist/services/implementation/types.d.ts +79 -0
- package/dist/services/implementation/types.d.ts.map +1 -0
- package/dist/services/index.d.ts +60 -0
- package/dist/services/index.js +57 -1
- package/dist/services/integrity-diagram.d.ts +36 -0
- package/dist/services/integrity-diagram.d.ts.map +1 -0
- package/dist/services/integrity-diagram.js +275 -6
- package/dist/services/integrity-diagram.js.map +1 -0
- package/dist/services/integrity.d.ts +134 -0
- package/dist/services/integrity.d.ts.map +1 -0
- package/dist/services/integrity.js +272 -1
- package/dist/services/integrity.js.map +1 -0
- package/dist/services/list.d.ts +31 -0
- package/dist/services/list.d.ts.map +1 -0
- package/dist/services/list.js +36 -1
- package/dist/services/list.js.map +1 -0
- package/dist/services/openapi/export-service.d.ts +53 -0
- package/dist/services/openapi/export-service.d.ts.map +1 -0
- package/dist/services/openapi/export-service.js +50 -2
- package/dist/services/openapi/export-service.js.map +1 -0
- package/dist/services/openapi/import-service.d.ts +17 -0
- package/dist/services/openapi/import-service.d.ts.map +1 -0
- package/dist/services/openapi/import-service.js +74 -1
- package/dist/services/openapi/import-service.js.map +1 -0
- package/dist/services/openapi/index.d.ts +5 -0
- package/dist/services/openapi/index.js +4 -1
- package/dist/services/openapi/sync-service.d.ts +17 -0
- package/dist/services/openapi/sync-service.d.ts.map +1 -0
- package/dist/services/openapi/sync-service.js +120 -1
- package/dist/services/openapi/sync-service.js.map +1 -0
- package/dist/services/openapi/types.d.ts +162 -0
- package/dist/services/openapi/types.d.ts.map +1 -0
- package/dist/services/openapi/validate-service.d.ts +16 -0
- package/dist/services/openapi/validate-service.d.ts.map +1 -0
- package/dist/services/openapi/validate-service.js +130 -1
- package/dist/services/openapi/validate-service.js.map +1 -0
- package/dist/services/quickstart/dependencies.d.ts +31 -0
- package/dist/services/quickstart/dependencies.d.ts.map +1 -0
- package/dist/services/quickstart/dependencies.js +57 -0
- package/dist/services/quickstart/dependencies.js.map +1 -0
- package/dist/services/quickstart/index.js +2 -0
- package/dist/services/quickstart/quickstart-service.d.ts +20 -0
- package/dist/services/quickstart/quickstart-service.d.ts.map +1 -0
- package/dist/services/quickstart/quickstart-service.js +196 -0
- package/dist/services/quickstart/quickstart-service.js.map +1 -0
- package/dist/services/quickstart/types.d.ts +81 -0
- package/dist/services/quickstart/types.d.ts.map +1 -0
- package/dist/services/regenerator.d.ts +18 -0
- package/dist/services/regenerator.d.ts.map +1 -0
- package/dist/services/regenerator.js +23 -1
- package/dist/services/regenerator.js.map +1 -0
- package/dist/services/registry.d.ts +53 -0
- package/dist/services/registry.d.ts.map +1 -0
- package/dist/services/registry.js +74 -1
- package/dist/services/registry.js.map +1 -0
- package/dist/services/setup/config-generators.d.ts +42 -0
- package/dist/services/setup/config-generators.d.ts.map +1 -0
- package/dist/services/setup/config-generators.js +114 -26
- package/dist/services/setup/config-generators.js.map +1 -0
- package/dist/services/setup/file-merger.d.ts +27 -0
- package/dist/services/setup/file-merger.d.ts.map +1 -0
- package/dist/services/setup/file-merger.js +61 -2
- package/dist/services/setup/file-merger.js.map +1 -0
- package/dist/services/setup/index.js +4 -1
- package/dist/services/setup/setup-service.d.ts +12 -0
- package/dist/services/setup/setup-service.d.ts.map +1 -0
- package/dist/services/setup/setup-service.js +96 -1
- package/dist/services/setup/setup-service.js.map +1 -0
- package/dist/services/setup/targets/agents-md.js +47 -1
- package/dist/services/setup/targets/agents-md.js.map +1 -0
- package/dist/services/setup/targets/cli-config.js +60 -1
- package/dist/services/setup/targets/cli-config.js.map +1 -0
- package/dist/services/setup/targets/cursor-rules.js +48 -1
- package/dist/services/setup/targets/cursor-rules.js.map +1 -0
- package/dist/services/setup/targets/mcp-claude.js +60 -1
- package/dist/services/setup/targets/mcp-claude.js.map +1 -0
- package/dist/services/setup/targets/mcp-cursor.js +59 -1
- package/dist/services/setup/targets/mcp-cursor.js.map +1 -0
- package/dist/services/setup/targets/vscode-settings.js +63 -1
- package/dist/services/setup/targets/vscode-settings.js.map +1 -0
- package/dist/services/setup/types.d.ts +85 -0
- package/dist/services/setup/types.d.ts.map +1 -0
- package/dist/services/setup/types.js +27 -1
- package/dist/services/setup/types.js.map +1 -0
- package/dist/services/sync.d.ts +41 -0
- package/dist/services/sync.d.ts.map +1 -0
- package/dist/services/sync.js +63 -1
- package/dist/services/sync.js.map +1 -0
- package/dist/services/test.d.ts +15 -0
- package/dist/services/test.d.ts.map +1 -0
- package/dist/services/test.js +30 -1
- package/dist/services/test.js.map +1 -0
- package/dist/services/validate-implementation.d.ts +32 -0
- package/dist/services/validate-implementation.d.ts.map +1 -0
- package/dist/services/validate-implementation.js +70 -1
- package/dist/services/validate-implementation.js.map +1 -0
- package/dist/services/validate.d.ts +41 -0
- package/dist/services/validate.d.ts.map +1 -0
- package/dist/services/validate.js +48 -1
- package/dist/services/validate.js.map +1 -0
- package/dist/services/verification-cache/adapters/filesystem.d.ts +46 -0
- package/dist/services/verification-cache/adapters/filesystem.d.ts.map +1 -0
- package/dist/services/verification-cache/adapters/filesystem.js +120 -1
- package/dist/services/verification-cache/adapters/filesystem.js.map +1 -0
- package/dist/services/verification-cache/adapters/in-memory.d.ts +27 -0
- package/dist/services/verification-cache/adapters/in-memory.d.ts.map +1 -0
- package/dist/services/verification-cache/adapters/in-memory.js +46 -1
- package/dist/services/verification-cache/adapters/in-memory.js.map +1 -0
- package/dist/services/verification-cache/adapters/index.d.ts +3 -0
- package/dist/services/verification-cache/adapters/index.js +3 -1
- package/dist/services/verification-cache/adapters/workspace-state.d.ts +49 -0
- package/dist/services/verification-cache/adapters/workspace-state.d.ts.map +1 -0
- package/dist/services/verification-cache/adapters/workspace-state.js +91 -1
- package/dist/services/verification-cache/adapters/workspace-state.js.map +1 -0
- package/dist/services/verification-cache/cache-service.d.ts +70 -0
- package/dist/services/verification-cache/cache-service.d.ts.map +1 -0
- package/dist/services/verification-cache/cache-service.js +256 -1
- package/dist/services/verification-cache/cache-service.js.map +1 -0
- package/dist/services/verification-cache/index.d.ts +6 -0
- package/dist/services/verification-cache/index.js +6 -1
- package/dist/services/verification-cache/types.d.ts +124 -0
- package/dist/services/verification-cache/types.d.ts.map +1 -0
- package/dist/services/verification-cache/types.js +16 -1
- package/dist/services/verification-cache/types.js.map +1 -0
- package/dist/services/verify/ai-verifier.d.ts +25 -0
- package/dist/services/verify/ai-verifier.d.ts.map +1 -0
- package/dist/services/verify/ai-verifier.js +336 -9
- package/dist/services/verify/ai-verifier.js.map +1 -0
- package/dist/services/verify/behavior-verifier.d.ts +12 -0
- package/dist/services/verify/behavior-verifier.d.ts.map +1 -0
- package/dist/services/verify/behavior-verifier.js +186 -1
- package/dist/services/verify/behavior-verifier.js.map +1 -0
- package/dist/services/verify/index.d.ts +5 -0
- package/dist/services/verify/index.js +4 -1
- package/dist/services/verify/structure-verifier.d.ts +12 -0
- package/dist/services/verify/structure-verifier.d.ts.map +1 -0
- package/dist/services/verify/structure-verifier.js +196 -2
- package/dist/services/verify/structure-verifier.js.map +1 -0
- package/dist/services/verify/types.d.ts +137 -0
- package/dist/services/verify/types.d.ts.map +1 -0
- package/dist/services/verify/verify-service.d.ts +60 -0
- package/dist/services/verify/verify-service.d.ts.map +1 -0
- package/dist/services/verify/verify-service.js +204 -3
- package/dist/services/verify/verify-service.js.map +1 -0
- package/dist/services/watch.d.ts +25 -0
- package/dist/services/watch.d.ts.map +1 -0
- package/dist/services/watch.js +32 -1
- package/dist/services/watch.js.map +1 -0
- package/dist/services/workspace-info.d.ts +62 -0
- package/dist/services/workspace-info.d.ts.map +1 -0
- package/dist/services/workspace-info.js +103 -2
- package/dist/services/workspace-info.js.map +1 -0
- package/dist/templates/app-config.template.d.ts +7 -0
- package/dist/templates/app-config.template.d.ts.map +1 -0
- package/dist/templates/app-config.template.js +102 -28
- package/dist/templates/app-config.template.js.map +1 -0
- package/dist/templates/data-view.template.d.ts +7 -0
- package/dist/templates/data-view.template.d.ts.map +1 -0
- package/dist/templates/data-view.template.js +43 -27
- package/dist/templates/data-view.template.js.map +1 -0
- package/dist/templates/event.template.d.ts +11 -0
- package/dist/templates/event.template.d.ts.map +1 -0
- package/dist/templates/event.template.js +30 -14
- package/dist/templates/event.template.js.map +1 -0
- package/dist/templates/experiment.template.d.ts +7 -0
- package/dist/templates/experiment.template.d.ts.map +1 -0
- package/dist/templates/experiment.template.js +78 -51
- package/dist/templates/experiment.template.js.map +1 -0
- package/dist/templates/handler.template.d.ts +16 -0
- package/dist/templates/handler.template.d.ts.map +1 -0
- package/dist/templates/handler.template.js +54 -17
- package/dist/templates/handler.template.js.map +1 -0
- package/dist/templates/index.d.ts +21 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +37 -1
- package/dist/templates/index.js.map +1 -0
- package/dist/templates/integration.template.d.ts +7 -0
- package/dist/templates/integration.template.d.ts.map +1 -0
- package/dist/templates/integration.template.js +135 -50
- package/dist/templates/integration.template.js.map +1 -0
- package/dist/templates/knowledge.template.d.ts +7 -0
- package/dist/templates/knowledge.template.d.ts.map +1 -0
- package/dist/templates/knowledge.template.js +63 -21
- package/dist/templates/knowledge.template.js.map +1 -0
- package/dist/templates/migration.template.d.ts +7 -0
- package/dist/templates/migration.template.d.ts.map +1 -0
- package/dist/templates/migration.template.js +51 -26
- package/dist/templates/migration.template.js.map +1 -0
- package/dist/templates/operation.template.d.ts +11 -0
- package/dist/templates/operation.template.d.ts.map +1 -0
- package/dist/templates/operation.template.js +45 -28
- package/dist/templates/operation.template.js.map +1 -0
- package/dist/templates/presentation.template.d.ts +11 -0
- package/dist/templates/presentation.template.d.ts.map +1 -0
- package/dist/templates/presentation.template.js +47 -20
- package/dist/templates/presentation.template.js.map +1 -0
- package/dist/templates/telemetry.template.d.ts +7 -0
- package/dist/templates/telemetry.template.d.ts.map +1 -0
- package/dist/templates/telemetry.template.js +75 -53
- package/dist/templates/telemetry.template.js.map +1 -0
- package/dist/templates/workflow-runner.template.d.ts +16 -0
- package/dist/templates/workflow-runner.template.d.ts.map +1 -0
- package/dist/templates/workflow-runner.template.js +13 -6
- package/dist/templates/workflow-runner.template.js.map +1 -0
- package/dist/templates/workflow.template.d.ts +7 -0
- package/dist/templates/workflow.template.d.ts.map +1 -0
- package/dist/templates/workflow.template.js +52 -24
- package/dist/templates/workflow.template.js.map +1 -0
- package/dist/types/config.d.ts +34 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types.d.ts +324 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +27 -15
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AgentProvider, AgentResult, AgentTask } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/ai/agents/claude-code-agent.d.ts
|
|
4
|
+
|
|
5
|
+
declare class ClaudeCodeAgent implements AgentProvider {
|
|
6
|
+
name: "claude-code";
|
|
7
|
+
private apiKey;
|
|
8
|
+
constructor();
|
|
9
|
+
canHandle(_task: AgentTask): boolean;
|
|
10
|
+
generate(task: AgentTask): Promise<AgentResult>;
|
|
11
|
+
validate(task: AgentTask): Promise<AgentResult>;
|
|
12
|
+
private buildSystemPrompt;
|
|
13
|
+
private buildUserPrompt;
|
|
14
|
+
private extractCode;
|
|
15
|
+
private detectIssues;
|
|
16
|
+
private extractErrors;
|
|
17
|
+
private extractWarnings;
|
|
18
|
+
private extractSuggestions;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { ClaudeCodeAgent };
|
|
22
|
+
//# sourceMappingURL=claude-code-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-code-agent.d.ts","names":[],"sources":["../../../src/ai/agents/claude-code-agent.ts"],"sourcesContent":[],"mappings":";;;;AAqBuB,cAZV,eAAA,YAA2B,aAYjB,CAAA;EAAoB,IAAA,EAAA,aAAA;EAAR,QAAA,MAAA;EA4CZ,WAAA,CAAA;EAAoB,SAAA,CAAA,KAAA,EAhDxB,SAgDwB,CAAA,EAAA,OAAA;EAAR,QAAA,CAAA,IAAA,EA5CZ,SA4CY,CAAA,EA5CA,OA4CA,CA5CQ,WA4CR,CAAA;EAxDK,QAAA,CAAA,IAAA,EAwDjB,SAxDiB,CAAA,EAwDL,OAxDK,CAwDG,WAxDH,CAAA;EAAa,QAAA,iBAAA"}
|
|
@@ -1,14 +1,69 @@
|
|
|
1
|
-
import{anthropic
|
|
1
|
+
import { anthropic } from "@ai-sdk/anthropic";
|
|
2
|
+
import { generateText } from "ai";
|
|
3
|
+
|
|
4
|
+
//#region src/ai/agents/claude-code-agent.ts
|
|
5
|
+
/**
|
|
6
|
+
* Claude Code Agent - Uses Anthropic's advanced code capabilities
|
|
7
|
+
* with extended context and agentic workflows
|
|
8
|
+
*/
|
|
9
|
+
var ClaudeCodeAgent = class {
|
|
10
|
+
name = "claude-code";
|
|
11
|
+
apiKey;
|
|
12
|
+
constructor() {
|
|
13
|
+
this.apiKey = process.env.ANTHROPIC_API_KEY;
|
|
14
|
+
}
|
|
15
|
+
canHandle(_task) {
|
|
16
|
+
return !!this.apiKey;
|
|
17
|
+
}
|
|
18
|
+
async generate(task) {
|
|
19
|
+
if (!this.apiKey) return {
|
|
20
|
+
success: false,
|
|
21
|
+
errors: ["ANTHROPIC_API_KEY not set. Claude Code agent requires API access."]
|
|
22
|
+
};
|
|
23
|
+
try {
|
|
24
|
+
const model = anthropic("claude-3-7-sonnet-20250219");
|
|
25
|
+
const systemPrompt = this.buildSystemPrompt(task);
|
|
26
|
+
const result = await generateText({
|
|
27
|
+
model,
|
|
28
|
+
prompt: this.buildUserPrompt(task),
|
|
29
|
+
system: systemPrompt,
|
|
30
|
+
temperature: .2
|
|
31
|
+
});
|
|
32
|
+
return {
|
|
33
|
+
success: true,
|
|
34
|
+
code: this.extractCode(result.text),
|
|
35
|
+
metadata: {
|
|
36
|
+
model: "claude-3-7-sonnet",
|
|
37
|
+
agentMode: "claude-code",
|
|
38
|
+
usage: result.usage
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
} catch (error) {
|
|
42
|
+
return {
|
|
43
|
+
success: false,
|
|
44
|
+
errors: [error instanceof Error ? error.message : String(error)]
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async validate(task) {
|
|
49
|
+
if (!this.apiKey) return {
|
|
50
|
+
success: false,
|
|
51
|
+
errors: ["ANTHROPIC_API_KEY not set"]
|
|
52
|
+
};
|
|
53
|
+
try {
|
|
54
|
+
const result = await generateText({
|
|
55
|
+
model: anthropic("claude-3-7-sonnet-20250219"),
|
|
56
|
+
prompt: `
|
|
2
57
|
You are an expert code reviewer. Carefully analyze this implementation against its specification.
|
|
3
58
|
|
|
4
59
|
SPECIFICATION:
|
|
5
60
|
\`\`\`typescript
|
|
6
|
-
${
|
|
61
|
+
${task.specCode}
|
|
7
62
|
\`\`\`
|
|
8
63
|
|
|
9
64
|
IMPLEMENTATION:
|
|
10
65
|
\`\`\`typescript
|
|
11
|
-
${
|
|
66
|
+
${task.existingCode || "// No implementation provided"}
|
|
12
67
|
\`\`\`
|
|
13
68
|
|
|
14
69
|
Provide a structured validation report:
|
|
@@ -27,7 +82,31 @@ Provide a structured validation report:
|
|
|
27
82
|
- Are there any missing edge cases?
|
|
28
83
|
|
|
29
84
|
Be thorough and precise. Use a critical but constructive tone.
|
|
30
|
-
`,
|
|
85
|
+
`,
|
|
86
|
+
system: "You are a senior software engineer performing a critical code review.",
|
|
87
|
+
temperature: .3
|
|
88
|
+
});
|
|
89
|
+
const hasErrors = this.detectIssues(result.text);
|
|
90
|
+
return {
|
|
91
|
+
success: !hasErrors,
|
|
92
|
+
code: result.text,
|
|
93
|
+
errors: hasErrors ? this.extractErrors(result.text) : [],
|
|
94
|
+
warnings: this.extractWarnings(result.text),
|
|
95
|
+
suggestions: this.extractSuggestions(result.text),
|
|
96
|
+
metadata: {
|
|
97
|
+
agentMode: "claude-code",
|
|
98
|
+
validationType: "comprehensive"
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
} catch (error) {
|
|
102
|
+
return {
|
|
103
|
+
success: false,
|
|
104
|
+
errors: [error instanceof Error ? error.message : String(error)]
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
buildSystemPrompt(task) {
|
|
109
|
+
const basePrompt = `You are an expert TypeScript developer specializing in contract-driven development.
|
|
31
110
|
|
|
32
111
|
Your code is:
|
|
33
112
|
- Type-safe with comprehensive TypeScript types
|
|
@@ -36,9 +115,68 @@ Your code is:
|
|
|
36
115
|
- Following SOLID principles and best practices
|
|
37
116
|
- Modular and testable
|
|
38
117
|
|
|
39
|
-
Generate clean, idiomatic TypeScript code that exactly matches the specification.`;
|
|
118
|
+
Generate clean, idiomatic TypeScript code that exactly matches the specification.`;
|
|
119
|
+
if (task.type === "test") return basePrompt + "\n\nYou are also an expert in testing. Write comprehensive tests using Vitest.";
|
|
120
|
+
return basePrompt;
|
|
121
|
+
}
|
|
122
|
+
buildUserPrompt(task) {
|
|
123
|
+
const prompts = {
|
|
124
|
+
generate: `Generate a complete, production-ready implementation for this specification:\n\n${task.specCode}\n\nProvide ONLY the TypeScript code, no explanations.`,
|
|
125
|
+
test: `Generate comprehensive tests for this code:\n\nSpec:\n${task.specCode}\n\nImplementation:\n${task.existingCode}\n\nProvide complete Vitest test suite.`,
|
|
126
|
+
refactor: `Refactor this code while preserving functionality:\n\n${task.existingCode}\n\nSpec:\n${task.specCode}`,
|
|
127
|
+
validate: `Validate this implementation:\n\nSpec:\n${task.specCode}\n\nCode:\n${task.existingCode}`
|
|
128
|
+
};
|
|
129
|
+
return prompts[task.type] || prompts.generate;
|
|
130
|
+
}
|
|
131
|
+
extractCode(text) {
|
|
132
|
+
const codeBlockMatch = text.match(/```(?:typescript|ts|tsx)?\n([\s\S]*?)\n```/);
|
|
133
|
+
if (codeBlockMatch && codeBlockMatch[1]) return codeBlockMatch[1];
|
|
134
|
+
return text;
|
|
135
|
+
}
|
|
136
|
+
detectIssues(reviewText) {
|
|
137
|
+
const errorIndicators = [
|
|
138
|
+
"missing",
|
|
139
|
+
"incorrect",
|
|
140
|
+
"bug",
|
|
141
|
+
"error",
|
|
142
|
+
"violation",
|
|
143
|
+
"does not",
|
|
144
|
+
"fails to",
|
|
145
|
+
"not implemented",
|
|
146
|
+
"critical"
|
|
147
|
+
];
|
|
148
|
+
const lowerText = reviewText.toLowerCase();
|
|
149
|
+
return errorIndicators.some((indicator) => lowerText.includes(indicator));
|
|
150
|
+
}
|
|
151
|
+
extractErrors(text) {
|
|
152
|
+
const errors = [];
|
|
153
|
+
const lines = text.split("\n");
|
|
154
|
+
for (const line of lines) {
|
|
155
|
+
const lower = line.toLowerCase();
|
|
156
|
+
if (lower.includes("error") || lower.includes("bug") || lower.includes("incorrect") || lower.includes("missing")) errors.push(line.trim());
|
|
157
|
+
}
|
|
158
|
+
return errors.length > 0 ? errors : ["Code review identified issues"];
|
|
159
|
+
}
|
|
160
|
+
extractWarnings(text) {
|
|
161
|
+
const warnings = [];
|
|
162
|
+
const lines = text.split("\n");
|
|
163
|
+
for (const line of lines) {
|
|
164
|
+
const lower = line.toLowerCase();
|
|
165
|
+
if (lower.includes("warning") || lower.includes("should") || lower.includes("consider")) warnings.push(line.trim());
|
|
166
|
+
}
|
|
167
|
+
return warnings;
|
|
168
|
+
}
|
|
169
|
+
extractSuggestions(text) {
|
|
170
|
+
const suggestions = [];
|
|
171
|
+
const lines = text.split("\n");
|
|
172
|
+
for (const line of lines) {
|
|
173
|
+
const lower = line.toLowerCase();
|
|
174
|
+
if (lower.includes("suggest") || lower.includes("recommend") || lower.includes("could") || lower.includes("improvement")) suggestions.push(line.trim());
|
|
175
|
+
}
|
|
176
|
+
return suggestions;
|
|
177
|
+
}
|
|
178
|
+
};
|
|
40
179
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
`);for(let e of n){let n=e.toLowerCase();(n.includes(`suggest`)||n.includes(`recommend`)||n.includes(`could`)||n.includes(`improvement`))&&t.push(e.trim())}return t}};export{n as ClaudeCodeAgent};
|
|
180
|
+
//#endregion
|
|
181
|
+
export { ClaudeCodeAgent };
|
|
182
|
+
//# sourceMappingURL=claude-code-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-code-agent.js","names":["errors: string[]","warnings: string[]","suggestions: string[]"],"sources":["../../../src/ai/agents/claude-code-agent.ts"],"sourcesContent":["/**\n * Claude Code Agent - Uses Anthropic's advanced code capabilities\n * with extended context and agentic workflows\n */\n\nimport { anthropic } from '@ai-sdk/anthropic';\nimport { generateText } from 'ai';\nimport type { AgentProvider, AgentResult, AgentTask } from './types';\n\nexport class ClaudeCodeAgent implements AgentProvider {\n name = 'claude-code' as const;\n private apiKey: string | undefined;\n\n constructor() {\n this.apiKey = process.env.ANTHROPIC_API_KEY;\n }\n\n canHandle(_task: AgentTask): boolean {\n return !!this.apiKey;\n }\n\n async generate(task: AgentTask): Promise<AgentResult> {\n if (!this.apiKey) {\n return {\n success: false,\n errors: [\n 'ANTHROPIC_API_KEY not set. Claude Code agent requires API access.',\n ],\n };\n }\n\n try {\n // Use Claude with extended thinking and code-optimized prompts\n const model = anthropic('claude-3-7-sonnet-20250219');\n\n const systemPrompt = this.buildSystemPrompt(task);\n const userPrompt = this.buildUserPrompt(task);\n\n const result = await generateText({\n model,\n prompt: userPrompt,\n system: systemPrompt,\n temperature: 0.2, // Lower temperature for more deterministic code\n });\n\n // Extract code from response (Claude may wrap in markdown)\n const code = this.extractCode(result.text);\n\n return {\n success: true,\n code,\n metadata: {\n model: 'claude-3-7-sonnet',\n agentMode: 'claude-code',\n usage: result.usage,\n },\n };\n } catch (error) {\n return {\n success: false,\n errors: [error instanceof Error ? error.message : String(error)],\n };\n }\n }\n\n async validate(task: AgentTask): Promise<AgentResult> {\n if (!this.apiKey) {\n return {\n success: false,\n errors: ['ANTHROPIC_API_KEY not set'],\n };\n }\n\n try {\n const model = anthropic('claude-3-7-sonnet-20250219');\n\n const prompt = `\nYou are an expert code reviewer. Carefully analyze this implementation against its specification.\n\nSPECIFICATION:\n\\`\\`\\`typescript\n${task.specCode}\n\\`\\`\\`\n\nIMPLEMENTATION:\n\\`\\`\\`typescript\n${task.existingCode || '// No implementation provided'}\n\\`\\`\\`\n\nProvide a structured validation report:\n\n## Compliance\n- Does the implementation fulfill all requirements in the spec?\n- Are all inputs/outputs correctly typed?\n\n## Code Quality\n- Are there any bugs or potential issues?\n- Is error handling adequate?\n- Are best practices followed?\n\n## Suggestions\n- What improvements would you recommend?\n- Are there any missing edge cases?\n\nBe thorough and precise. Use a critical but constructive tone.\n`;\n\n const result = await generateText({\n model,\n prompt,\n system:\n 'You are a senior software engineer performing a critical code review.',\n temperature: 0.3,\n });\n\n // Analyze the review for issues\n const hasErrors = this.detectIssues(result.text);\n\n return {\n success: !hasErrors,\n code: result.text,\n errors: hasErrors ? this.extractErrors(result.text) : [],\n warnings: this.extractWarnings(result.text),\n suggestions: this.extractSuggestions(result.text),\n metadata: {\n agentMode: 'claude-code',\n validationType: 'comprehensive',\n },\n };\n } catch (error) {\n return {\n success: false,\n errors: [error instanceof Error ? error.message : String(error)],\n };\n }\n }\n\n private buildSystemPrompt(task: AgentTask): string {\n const basePrompt = `You are an expert TypeScript developer specializing in contract-driven development.\n\nYour code is:\n- Type-safe with comprehensive TypeScript types\n- Well-documented with JSDoc comments\n- Production-ready with proper error handling\n- Following SOLID principles and best practices\n- Modular and testable\n\nGenerate clean, idiomatic TypeScript code that exactly matches the specification.`;\n\n if (task.type === 'test') {\n return (\n basePrompt +\n '\\n\\nYou are also an expert in testing. Write comprehensive tests using Vitest.'\n );\n }\n\n return basePrompt;\n }\n\n private buildUserPrompt(task: AgentTask): string {\n const prompts = {\n generate: `Generate a complete, production-ready implementation for this specification:\\n\\n${task.specCode}\\n\\nProvide ONLY the TypeScript code, no explanations.`,\n test: `Generate comprehensive tests for this code:\\n\\nSpec:\\n${task.specCode}\\n\\nImplementation:\\n${task.existingCode}\\n\\nProvide complete Vitest test suite.`,\n refactor: `Refactor this code while preserving functionality:\\n\\n${task.existingCode}\\n\\nSpec:\\n${task.specCode}`,\n validate: `Validate this implementation:\\n\\nSpec:\\n${task.specCode}\\n\\nCode:\\n${task.existingCode}`,\n };\n\n return prompts[task.type] || prompts.generate;\n }\n\n private extractCode(text: string): string {\n // Extract code from markdown code blocks\n const codeBlockMatch = text.match(\n /```(?:typescript|ts|tsx)?\\n([\\s\\S]*?)\\n```/\n );\n if (codeBlockMatch && codeBlockMatch[1]) {\n return codeBlockMatch[1];\n }\n return text;\n }\n\n private detectIssues(reviewText: string): boolean {\n const errorIndicators = [\n 'missing',\n 'incorrect',\n 'bug',\n 'error',\n 'violation',\n 'does not',\n 'fails to',\n 'not implemented',\n 'critical',\n ];\n\n const lowerText = reviewText.toLowerCase();\n return errorIndicators.some((indicator) => lowerText.includes(indicator));\n }\n\n private extractErrors(text: string): string[] {\n const errors: string[] = [];\n const lines = text.split('\\n');\n\n for (const line of lines) {\n const lower = line.toLowerCase();\n if (\n lower.includes('error') ||\n lower.includes('bug') ||\n lower.includes('incorrect') ||\n lower.includes('missing')\n ) {\n errors.push(line.trim());\n }\n }\n\n return errors.length > 0 ? errors : ['Code review identified issues'];\n }\n\n private extractWarnings(text: string): string[] {\n const warnings: string[] = [];\n const lines = text.split('\\n');\n\n for (const line of lines) {\n const lower = line.toLowerCase();\n if (\n lower.includes('warning') ||\n lower.includes('should') ||\n lower.includes('consider')\n ) {\n warnings.push(line.trim());\n }\n }\n\n return warnings;\n }\n\n private extractSuggestions(text: string): string[] {\n const suggestions: string[] = [];\n const lines = text.split('\\n');\n\n for (const line of lines) {\n const lower = line.toLowerCase();\n if (\n lower.includes('suggest') ||\n lower.includes('recommend') ||\n lower.includes('could') ||\n lower.includes('improvement')\n ) {\n suggestions.push(line.trim());\n }\n }\n\n return suggestions;\n }\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { AgentProvider, AgentResult, AgentTask } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/ai/agents/cursor-agent.d.ts
|
|
4
|
+
|
|
5
|
+
declare class CursorAgent implements AgentProvider {
|
|
6
|
+
name: "cursor";
|
|
7
|
+
private cursorPath;
|
|
8
|
+
private isWindsurf;
|
|
9
|
+
private composerPort;
|
|
10
|
+
constructor();
|
|
11
|
+
canHandle(_task: AgentTask): boolean;
|
|
12
|
+
generate(task: AgentTask): Promise<AgentResult>;
|
|
13
|
+
validate(task: AgentTask): Promise<AgentResult>;
|
|
14
|
+
/**
|
|
15
|
+
* Detect if running in Cursor/Windsurf environment
|
|
16
|
+
*/
|
|
17
|
+
private detectEnvironment;
|
|
18
|
+
/**
|
|
19
|
+
* Execute task using the best available method
|
|
20
|
+
*/
|
|
21
|
+
private executeWithBestMethod;
|
|
22
|
+
/**
|
|
23
|
+
* Use Windsurf's native API
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Use Cursor Composer API
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* Use Cursor CLI directly
|
|
30
|
+
*/
|
|
31
|
+
private useCursorCLI;
|
|
32
|
+
/**
|
|
33
|
+
* File-based approach - create workspace and instructions for manual completion
|
|
34
|
+
*/
|
|
35
|
+
private useFileBasedApproach;
|
|
36
|
+
/**
|
|
37
|
+
* Setup workspace for validation
|
|
38
|
+
*/
|
|
39
|
+
private setupValidationWorkspace;
|
|
40
|
+
/**
|
|
41
|
+
* Prepare files for API submission
|
|
42
|
+
*/
|
|
43
|
+
private prepareFilesForAPI;
|
|
44
|
+
/**
|
|
45
|
+
* Build detailed prompt for cursor
|
|
46
|
+
*/
|
|
47
|
+
private buildDetailedPrompt;
|
|
48
|
+
/**
|
|
49
|
+
* Build validation-specific prompt
|
|
50
|
+
*/
|
|
51
|
+
private buildValidationPrompt;
|
|
52
|
+
/**
|
|
53
|
+
* Generate basic template for task
|
|
54
|
+
*/
|
|
55
|
+
private generateTemplate;
|
|
56
|
+
/**
|
|
57
|
+
* Cleanup temporary work directory
|
|
58
|
+
*/
|
|
59
|
+
private cleanupWorkDir;
|
|
60
|
+
private isCursorAvailable;
|
|
61
|
+
/**
|
|
62
|
+
* Check if Cursor Composer API might be available
|
|
63
|
+
*/
|
|
64
|
+
private hasComposerAPI;
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { CursorAgent };
|
|
68
|
+
//# sourceMappingURL=cursor-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-agent.d.ts","names":[],"sources":["../../../src/ai/agents/cursor-agent.ts"],"sourcesContent":[],"mappings":";;;;AA2BuB,cAfV,WAAA,YAAuB,aAeb,CAAA;EAAoB,IAAA,EAAA,QAAA;EAAR,QAAA,UAAA;EAmBZ,QAAA,UAAA;EAAoB,QAAA,YAAA;EAAR,WAAA,CAAA;EAlCC,SAAA,CAAA,KAAA,EAWjB,SAXiB,CAAA,EAAA,OAAA;EAAa,QAAA,CAAA,IAAA,EAe1B,SAf0B,CAAA,EAed,OAfc,CAeN,WAfM,CAAA;iBAkC1B,YAAY,QAAQ"}
|
|
@@ -1,4 +1,186 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { join } from "path";
|
|
2
|
+
import { existsSync } from "fs";
|
|
3
|
+
import { spawn } from "child_process";
|
|
4
|
+
import { mkdir, readFile, rm, writeFile } from "fs/promises";
|
|
5
|
+
import { homedir, tmpdir } from "os";
|
|
6
|
+
|
|
7
|
+
//#region src/ai/agents/cursor-agent.ts
|
|
8
|
+
/**
|
|
9
|
+
* Cursor/Windsurf Agent - Fully Implemented
|
|
10
|
+
* Leverages Windsurf AI capabilities and Cursor IDE integration for code generation and validation
|
|
11
|
+
*/
|
|
12
|
+
var CursorAgent = class {
|
|
13
|
+
name = "cursor";
|
|
14
|
+
cursorPath = null;
|
|
15
|
+
isWindsurf = false;
|
|
16
|
+
composerPort;
|
|
17
|
+
constructor() {
|
|
18
|
+
this.composerPort = process.env.CURSOR_COMPOSER_PORT || "3000";
|
|
19
|
+
this.detectEnvironment();
|
|
20
|
+
}
|
|
21
|
+
canHandle(_task) {
|
|
22
|
+
return this.isCursorAvailable();
|
|
23
|
+
}
|
|
24
|
+
async generate(task) {
|
|
25
|
+
try {
|
|
26
|
+
const workDir = join(tmpdir(), `cursor-agent-${Date.now()}`);
|
|
27
|
+
await mkdir(workDir, { recursive: true });
|
|
28
|
+
const result = await this.executeWithBestMethod(task, workDir);
|
|
29
|
+
await this.cleanupWorkDir(workDir);
|
|
30
|
+
return result;
|
|
31
|
+
} catch (error) {
|
|
32
|
+
return {
|
|
33
|
+
success: false,
|
|
34
|
+
errors: [error instanceof Error ? error.message : String(error)]
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async validate(task) {
|
|
39
|
+
try {
|
|
40
|
+
const workDir = join(tmpdir(), `cursor-validate-${Date.now()}`);
|
|
41
|
+
await mkdir(workDir, { recursive: true });
|
|
42
|
+
await this.setupValidationWorkspace(task, workDir);
|
|
43
|
+
const result = await this.executeWithBestMethod({
|
|
44
|
+
...task,
|
|
45
|
+
type: "validate"
|
|
46
|
+
}, workDir);
|
|
47
|
+
await this.cleanupWorkDir(workDir);
|
|
48
|
+
return result;
|
|
49
|
+
} catch (error) {
|
|
50
|
+
return {
|
|
51
|
+
success: false,
|
|
52
|
+
errors: [error instanceof Error ? error.message : String(error)]
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Detect if running in Cursor/Windsurf environment
|
|
58
|
+
*/
|
|
59
|
+
detectEnvironment() {
|
|
60
|
+
this.isWindsurf = !!(process.env.WINDSURF_SESSION || process.env.CURSOR_USER_DATA || process.env.VSCODE_CWD?.includes("Cursor") || process.env.VSCODE_CWD?.includes("Windsurf"));
|
|
61
|
+
const possiblePaths = [
|
|
62
|
+
"/usr/local/bin/cursor",
|
|
63
|
+
"/Applications/Cursor.app/Contents/MacOS/Cursor",
|
|
64
|
+
"/Applications/Windsurf.app/Contents/MacOS/Windsurf",
|
|
65
|
+
join(homedir(), ".cursor", "cursor"),
|
|
66
|
+
join(homedir(), "AppData", "Local", "Programs", "cursor", "Cursor.exe"),
|
|
67
|
+
join(homedir(), "AppData", "Local", "Programs", "windsurf", "Windsurf.exe"),
|
|
68
|
+
"cursor",
|
|
69
|
+
"windsurf"
|
|
70
|
+
];
|
|
71
|
+
for (const path of possiblePaths) if (path.includes("cursor") || path.includes("Cursor") || path.includes("windsurf") || path.includes("Windsurf")) try {
|
|
72
|
+
if (existsSync(path)) {
|
|
73
|
+
this.cursorPath = path;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
} catch {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Execute task using the best available method
|
|
82
|
+
*/
|
|
83
|
+
async executeWithBestMethod(task, workDir) {
|
|
84
|
+
const methods = [{
|
|
85
|
+
name: "cursor-cli",
|
|
86
|
+
fn: () => this.useCursorCLI(task, workDir)
|
|
87
|
+
}, {
|
|
88
|
+
name: "file-based",
|
|
89
|
+
fn: () => this.useFileBasedApproach(task, workDir)
|
|
90
|
+
}];
|
|
91
|
+
for (const method of methods) try {
|
|
92
|
+
const result = await method.fn();
|
|
93
|
+
if (result.success) return result;
|
|
94
|
+
} catch (_error) {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
success: false,
|
|
99
|
+
warnings: [
|
|
100
|
+
"Cursor agent could not connect to IDE.",
|
|
101
|
+
"Ensure Cursor/Windsurf is running with API enabled.",
|
|
102
|
+
"Falling back to simple agent mode is recommended."
|
|
103
|
+
],
|
|
104
|
+
errors: ["All Cursor integration methods failed"],
|
|
105
|
+
metadata: {
|
|
106
|
+
agentMode: "cursor",
|
|
107
|
+
status: "unavailable",
|
|
108
|
+
suggestion: "Use --agent-mode claude-code or --agent-mode simple"
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Use Windsurf's native API
|
|
114
|
+
*/
|
|
115
|
+
/**
|
|
116
|
+
* Use Cursor Composer API
|
|
117
|
+
*/
|
|
118
|
+
/**
|
|
119
|
+
* Use Cursor CLI directly
|
|
120
|
+
*/
|
|
121
|
+
async useCursorCLI(task, workDir) {
|
|
122
|
+
if (!this.cursorPath) throw new Error("Cursor executable not found");
|
|
123
|
+
const specPath = join(workDir, "spec.ts");
|
|
124
|
+
const outputPath = join(workDir, "output.ts");
|
|
125
|
+
const instructionsPath = join(workDir, "INSTRUCTIONS.md");
|
|
126
|
+
await writeFile(specPath, task.specCode);
|
|
127
|
+
await writeFile(instructionsPath, this.buildDetailedPrompt(task));
|
|
128
|
+
if (task.existingCode) await writeFile(join(workDir, "existing.ts"), task.existingCode);
|
|
129
|
+
return new Promise((resolve, reject) => {
|
|
130
|
+
const args = [
|
|
131
|
+
"--wait",
|
|
132
|
+
"--new-window",
|
|
133
|
+
workDir
|
|
134
|
+
];
|
|
135
|
+
const cursor = spawn(this.cursorPath, args, {
|
|
136
|
+
cwd: workDir,
|
|
137
|
+
stdio: "pipe",
|
|
138
|
+
detached: false
|
|
139
|
+
});
|
|
140
|
+
let _stdout = "";
|
|
141
|
+
let _stderr = "";
|
|
142
|
+
cursor.stdout?.on("data", (data) => {
|
|
143
|
+
_stdout += data.toString();
|
|
144
|
+
});
|
|
145
|
+
cursor.stderr?.on("data", (data) => {
|
|
146
|
+
_stderr += data.toString();
|
|
147
|
+
});
|
|
148
|
+
cursor.on("error", (error) => {
|
|
149
|
+
reject(error);
|
|
150
|
+
});
|
|
151
|
+
cursor.on("close", async (code) => {
|
|
152
|
+
if (existsSync(outputPath)) try {
|
|
153
|
+
resolve({
|
|
154
|
+
success: true,
|
|
155
|
+
code: await readFile(outputPath, "utf-8"),
|
|
156
|
+
metadata: {
|
|
157
|
+
agentMode: "cursor",
|
|
158
|
+
method: "cli",
|
|
159
|
+
exitCode: code
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
} catch (_error) {
|
|
163
|
+
reject(/* @__PURE__ */ new Error("Failed to read generated output"));
|
|
164
|
+
}
|
|
165
|
+
else reject(/* @__PURE__ */ new Error(`Cursor CLI exited with code ${code}. No output generated.`));
|
|
166
|
+
});
|
|
167
|
+
setTimeout(() => {
|
|
168
|
+
cursor.kill();
|
|
169
|
+
reject(/* @__PURE__ */ new Error("Cursor CLI timeout"));
|
|
170
|
+
}, 6e4);
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* File-based approach - create workspace and instructions for manual completion
|
|
175
|
+
*/
|
|
176
|
+
async useFileBasedApproach(task, workDir) {
|
|
177
|
+
const specPath = join(workDir, "SPECIFICATION.ts");
|
|
178
|
+
const instructionsPath = join(workDir, "INSTRUCTIONS.md");
|
|
179
|
+
const templatePath = join(workDir, "template.ts");
|
|
180
|
+
await writeFile(specPath, task.specCode);
|
|
181
|
+
await writeFile(instructionsPath, this.buildDetailedPrompt(task));
|
|
182
|
+
await writeFile(templatePath, this.generateTemplate(task));
|
|
183
|
+
await writeFile(join(workDir, "README.md"), `# Cursor Agent Workspace
|
|
2
184
|
|
|
3
185
|
This workspace was prepared for Cursor AI code generation.
|
|
4
186
|
|
|
@@ -13,8 +195,53 @@ This workspace was prepared for Cursor AI code generation.
|
|
|
13
195
|
3. Use Cursor AI to generate code based on the spec
|
|
14
196
|
4. Save the result as output.ts
|
|
15
197
|
|
|
16
|
-
Workspace path: ${
|
|
17
|
-
`)
|
|
198
|
+
Workspace path: ${workDir}
|
|
199
|
+
`);
|
|
200
|
+
return {
|
|
201
|
+
success: false,
|
|
202
|
+
warnings: [
|
|
203
|
+
"Cursor agent created workspace but cannot auto-execute.",
|
|
204
|
+
`Workspace prepared at: ${workDir}`,
|
|
205
|
+
"Open this folder in Cursor IDE to complete code generation."
|
|
206
|
+
],
|
|
207
|
+
code: this.generateTemplate(task),
|
|
208
|
+
metadata: {
|
|
209
|
+
agentMode: "cursor",
|
|
210
|
+
method: "file-based",
|
|
211
|
+
workDir
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Setup workspace for validation
|
|
217
|
+
*/
|
|
218
|
+
async setupValidationWorkspace(task, workDir) {
|
|
219
|
+
await writeFile(join(workDir, "specification.ts"), task.specCode);
|
|
220
|
+
await writeFile(join(workDir, "implementation.ts"), task.existingCode || "// No implementation");
|
|
221
|
+
await writeFile(join(workDir, "VALIDATION_INSTRUCTIONS.md"), this.buildValidationPrompt(task));
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Prepare files for API submission
|
|
225
|
+
*/
|
|
226
|
+
async prepareFilesForAPI(task, _workDir) {
|
|
227
|
+
const files = [{
|
|
228
|
+
path: "spec.ts",
|
|
229
|
+
content: task.specCode
|
|
230
|
+
}];
|
|
231
|
+
if (task.existingCode) files.push({
|
|
232
|
+
path: "existing.ts",
|
|
233
|
+
content: task.existingCode
|
|
234
|
+
});
|
|
235
|
+
return files;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Build detailed prompt for cursor
|
|
239
|
+
*/
|
|
240
|
+
buildDetailedPrompt(task) {
|
|
241
|
+
const header = `# AI Code Generation Task - Cursor Agent\n\n**Task Type:** ${task.type}\n**Generated:** ${(/* @__PURE__ */ new Date()).toISOString()}\n\n`;
|
|
242
|
+
const specification = `## Specification\n\n\`\`\`typescript\n${task.specCode}\n\`\`\`\n\n`;
|
|
243
|
+
const taskInstructions = {
|
|
244
|
+
generate: `## Task: Generate Implementation
|
|
18
245
|
|
|
19
246
|
### Requirements:
|
|
20
247
|
1. **Type Safety**: Use strict TypeScript with comprehensive types
|
|
@@ -34,11 +261,12 @@ Workspace path: ${n}
|
|
|
34
261
|
|
|
35
262
|
### Output Format:
|
|
36
263
|
Provide complete, executable TypeScript code that fully implements the specification.
|
|
37
|
-
Include all necessary imports and type definitions.`,
|
|
264
|
+
Include all necessary imports and type definitions.`,
|
|
265
|
+
validate: `## Task: Validate Implementation
|
|
38
266
|
|
|
39
267
|
### Current Implementation:
|
|
40
268
|
\`\`\`typescript
|
|
41
|
-
${
|
|
269
|
+
${task.existingCode || "// No implementation provided"}
|
|
42
270
|
\`\`\`
|
|
43
271
|
|
|
44
272
|
### Validation Criteria:
|
|
@@ -62,11 +290,12 @@ Provide a detailed validation report with:
|
|
|
62
290
|
- **Status**: Pass/Fail
|
|
63
291
|
- **Issues Found**: List all problems
|
|
64
292
|
- **Recommendations**: Specific improvements needed
|
|
65
|
-
- **Code Quality Score**: Rate the implementation`,
|
|
293
|
+
- **Code Quality Score**: Rate the implementation`,
|
|
294
|
+
test: `## Task: Generate Tests
|
|
66
295
|
|
|
67
296
|
### Implementation to Test:
|
|
68
297
|
\`\`\`typescript
|
|
69
|
-
${
|
|
298
|
+
${task.existingCode || ""}
|
|
70
299
|
\`\`\`
|
|
71
300
|
|
|
72
301
|
### Test Requirements:
|
|
@@ -84,11 +313,12 @@ ${e.existingCode||``}
|
|
|
84
313
|
- Performance tests (if applicable)
|
|
85
314
|
|
|
86
315
|
### Output Format:
|
|
87
|
-
Complete Vitest test file with comprehensive test coverage.`,
|
|
316
|
+
Complete Vitest test file with comprehensive test coverage.`,
|
|
317
|
+
refactor: `## Task: Refactor Code
|
|
88
318
|
|
|
89
319
|
### Current Code:
|
|
90
320
|
\`\`\`typescript
|
|
91
|
-
${
|
|
321
|
+
${task.existingCode || ""}
|
|
92
322
|
\`\`\`
|
|
93
323
|
|
|
94
324
|
### Refactoring Goals:
|
|
@@ -107,16 +337,24 @@ ${e.existingCode||``}
|
|
|
107
337
|
- Enhance error messages
|
|
108
338
|
|
|
109
339
|
### Output Format:
|
|
110
|
-
Refactored code that maintains functionality while improving quality.`
|
|
340
|
+
Refactored code that maintains functionality while improving quality.`
|
|
341
|
+
};
|
|
342
|
+
return header + specification + (taskInstructions[task.type] || taskInstructions.generate);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Build validation-specific prompt
|
|
346
|
+
*/
|
|
347
|
+
buildValidationPrompt(task) {
|
|
348
|
+
return `# Implementation Validation Report
|
|
111
349
|
|
|
112
350
|
## Specification
|
|
113
351
|
\`\`\`typescript
|
|
114
|
-
${
|
|
352
|
+
${task.specCode}
|
|
115
353
|
\`\`\`
|
|
116
354
|
|
|
117
355
|
## Implementation
|
|
118
356
|
\`\`\`typescript
|
|
119
|
-
${
|
|
357
|
+
${task.existingCode || "// No implementation"}
|
|
120
358
|
\`\`\`
|
|
121
359
|
|
|
122
360
|
## Validation Checklist
|
|
@@ -152,11 +390,15 @@ ${e.existingCode||`// No implementation`}
|
|
|
152
390
|
## Instructions
|
|
153
391
|
Review the implementation against the specification and complete the checklist.
|
|
154
392
|
Provide detailed feedback for each failed item.
|
|
155
|
-
Suggest specific improvements with code examples where applicable
|
|
393
|
+
Suggest specific improvements with code examples where applicable.`;
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Generate basic template for task
|
|
397
|
+
*/
|
|
398
|
+
generateTemplate(task) {
|
|
399
|
+
return `// Auto-generated template for ${task.type} task
|
|
156
400
|
// Specification:
|
|
157
|
-
${
|
|
158
|
-
`).map(e=>`// ${e}`).join(`
|
|
159
|
-
`)}
|
|
401
|
+
${task.specCode.split("\n").map((line) => `// ${line}`).join("\n")}
|
|
160
402
|
|
|
161
403
|
// TODO: Implement according to specification
|
|
162
404
|
// Use Cursor AI to complete this implementation
|
|
@@ -165,4 +407,30 @@ export function implementation() {
|
|
|
165
407
|
// Implementation goes here
|
|
166
408
|
throw new Error('Not implemented');
|
|
167
409
|
}
|
|
168
|
-
|
|
410
|
+
`;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Cleanup temporary work directory
|
|
414
|
+
*/
|
|
415
|
+
async cleanupWorkDir(workDir) {
|
|
416
|
+
try {
|
|
417
|
+
await rm(workDir, {
|
|
418
|
+
recursive: true,
|
|
419
|
+
force: true
|
|
420
|
+
});
|
|
421
|
+
} catch {}
|
|
422
|
+
}
|
|
423
|
+
isCursorAvailable() {
|
|
424
|
+
return this.isWindsurf || this.cursorPath !== null || this.hasComposerAPI();
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Check if Cursor Composer API might be available
|
|
428
|
+
*/
|
|
429
|
+
hasComposerAPI() {
|
|
430
|
+
return !!(process.env.CURSOR_COMPOSER_PORT || process.env.CURSOR_API_ENABLED || this.isWindsurf);
|
|
431
|
+
}
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
//#endregion
|
|
435
|
+
export { CursorAgent };
|
|
436
|
+
//# sourceMappingURL=cursor-agent.js.map
|