mcoda 0.1.2 → 0.1.4
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/CHANGELOG.md +2 -2
- package/README.md +9 -300
- package/dist/bin/McodaEntrypoint.d.ts +5 -0
- package/dist/bin/McodaEntrypoint.d.ts.map +1 -0
- package/dist/bin/McodaEntrypoint.js +175 -0
- package/dist/commands/agents/AgentsCommands.d.ts +4 -0
- package/dist/commands/agents/AgentsCommands.d.ts.map +1 -0
- package/dist/commands/agents/AgentsCommands.js +376 -0
- package/dist/commands/agents/GatewayAgentCommand.d.ts +4 -0
- package/dist/commands/agents/GatewayAgentCommand.d.ts.map +1 -0
- package/dist/commands/agents/GatewayAgentCommand.js +583 -0
- package/dist/commands/agents/TestAgentCommand.d.ts +4 -0
- package/dist/commands/agents/TestAgentCommand.d.ts.map +1 -0
- package/dist/commands/agents/TestAgentCommand.js +57 -0
- package/dist/commands/backlog/BacklogCommands.d.ts +17 -0
- package/dist/commands/backlog/BacklogCommands.d.ts.map +1 -0
- package/dist/commands/backlog/BacklogCommands.js +260 -0
- package/dist/commands/backlog/OrderTasksCommand.d.ts +16 -0
- package/dist/commands/backlog/OrderTasksCommand.d.ts.map +1 -0
- package/dist/commands/backlog/OrderTasksCommand.js +211 -0
- package/dist/commands/backlog/TaskShowCommands.d.ts +16 -0
- package/dist/commands/backlog/TaskShowCommands.d.ts.map +1 -0
- package/dist/commands/backlog/TaskShowCommands.js +275 -0
- package/dist/commands/docs/DocsCommands.d.ts +37 -0
- package/dist/commands/docs/DocsCommands.d.ts.map +1 -0
- package/dist/commands/docs/DocsCommands.js +381 -0
- package/dist/commands/estimate/EstimateCommands.d.ts +24 -0
- package/dist/commands/estimate/EstimateCommands.d.ts.map +1 -0
- package/dist/commands/estimate/EstimateCommands.js +259 -0
- package/dist/commands/jobs/JobsCommands.d.ts +24 -0
- package/dist/commands/jobs/JobsCommands.d.ts.map +1 -0
- package/dist/commands/jobs/JobsCommands.js +535 -0
- package/dist/commands/openapi/OpenapiCommands.d.ts +14 -0
- package/dist/commands/openapi/OpenapiCommands.d.ts.map +1 -0
- package/dist/commands/openapi/OpenapiCommands.js +157 -0
- package/dist/commands/planning/CreateTasksCommand.d.ts +17 -0
- package/dist/commands/planning/CreateTasksCommand.d.ts.map +1 -0
- package/dist/commands/planning/CreateTasksCommand.js +134 -0
- package/dist/commands/planning/MigrateTasksCommand.d.ts +15 -0
- package/dist/commands/planning/MigrateTasksCommand.d.ts.map +1 -0
- package/dist/commands/planning/MigrateTasksCommand.js +95 -0
- package/dist/commands/planning/PlanningCommands.d.ts +3 -0
- package/dist/commands/planning/PlanningCommands.d.ts.map +1 -0
- package/dist/commands/planning/PlanningCommands.js +2 -0
- package/dist/commands/planning/QaTasksCommand.d.ts +30 -0
- package/dist/commands/planning/QaTasksCommand.d.ts.map +1 -0
- package/dist/commands/planning/QaTasksCommand.js +293 -0
- package/dist/commands/planning/RefineTasksCommand.d.ts +30 -0
- package/dist/commands/planning/RefineTasksCommand.d.ts.map +1 -0
- package/dist/commands/planning/RefineTasksCommand.js +365 -0
- package/dist/commands/review/CodeReviewCommand.d.ts +21 -0
- package/dist/commands/review/CodeReviewCommand.d.ts.map +1 -0
- package/dist/commands/review/CodeReviewCommand.js +236 -0
- package/dist/commands/routing/RoutingCommands.d.ts +7 -0
- package/dist/commands/routing/RoutingCommands.d.ts.map +1 -0
- package/dist/commands/routing/RoutingCommands.js +484 -0
- package/dist/commands/telemetry/TelemetryCommands.d.ts +26 -0
- package/dist/commands/telemetry/TelemetryCommands.d.ts.map +1 -0
- package/dist/commands/telemetry/TelemetryCommands.js +313 -0
- package/dist/commands/update/UpdateCommands.d.ts +4 -0
- package/dist/commands/update/UpdateCommands.d.ts.map +1 -0
- package/dist/commands/update/UpdateCommands.js +280 -0
- package/dist/commands/work/WorkOnTasksCommand.d.ts +21 -0
- package/dist/commands/work/WorkOnTasksCommand.d.ts.map +1 -0
- package/dist/commands/work/WorkOnTasksCommand.js +238 -0
- package/dist/commands/workspace/SetWorkspaceCommand.d.ts +9 -0
- package/dist/commands/workspace/SetWorkspaceCommand.d.ts.map +1 -0
- package/dist/commands/workspace/SetWorkspaceCommand.js +128 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/package.json +31 -16
- package/.editorconfig +0 -9
- package/.eslintrc.cjs +0 -12
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -29
- package/.github/ISSUE_TEMPLATE/config.yml +0 -5
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -19
- package/.github/workflows/ci.yml +0 -37
- package/.github/workflows/nightly.yml +0 -38
- package/.github/workflows/release-dry-run.yml +0 -40
- package/.github/workflows/release-please.yml +0 -22
- package/.github/workflows/release.yml +0 -139
- package/.prettierrc +0 -5
- package/.release-please-manifest.json +0 -8
- package/CLA.md +0 -42
- package/CONTRIBUTING.md +0 -38
- package/docs/oss_publishing_plan.md +0 -41
- package/docs/pdr/.gitkeep +0 -0
- package/docs/quality_gates.md +0 -32
- package/docs/rfp/.gitkeep +0 -0
- package/docs/sds/sds.md +0 -11963
- package/docs/usage.md +0 -72
- package/openapi/gen-openapi.ts +0 -1
- package/openapi/generated/clients/.gitkeep +0 -0
- package/openapi/generated/types/.gitkeep +0 -0
- package/openapi/generated/types/index.ts +0 -118
- package/openapi/mcoda.yaml +0 -2063
- package/pack-mcoda.sh +0 -88
- package/packages/agents/CHANGELOG.md +0 -7
- package/packages/agents/LICENSE +0 -21
- package/packages/agents/README.md +0 -9
- package/packages/agents/package.json +0 -41
- package/packages/agents/src/AgentService/.gitkeep +0 -0
- package/packages/agents/src/AgentService/AgentService.d.ts +0 -21
- package/packages/agents/src/AgentService/AgentService.d.ts.map +0 -1
- package/packages/agents/src/AgentService/AgentService.js +0 -141
- package/packages/agents/src/AgentService/AgentService.ts +0 -308
- package/packages/agents/src/__tests__/AgentService.test.ts +0 -284
- package/packages/agents/src/adapters/AdapterTypes.d.ts +0 -29
- package/packages/agents/src/adapters/AdapterTypes.d.ts.map +0 -1
- package/packages/agents/src/adapters/AdapterTypes.js +0 -1
- package/packages/agents/src/adapters/AdapterTypes.ts +0 -32
- package/packages/agents/src/adapters/codex/.gitkeep +0 -0
- package/packages/agents/src/adapters/codex/CodexAdapter.d.ts +0 -11
- package/packages/agents/src/adapters/codex/CodexAdapter.d.ts.map +0 -1
- package/packages/agents/src/adapters/codex/CodexAdapter.js +0 -43
- package/packages/agents/src/adapters/codex/CodexAdapter.ts +0 -63
- package/packages/agents/src/adapters/codex/CodexCliRunner.ts +0 -154
- package/packages/agents/src/adapters/gemini/.gitkeep +0 -0
- package/packages/agents/src/adapters/gemini/GeminiAdapter.d.ts +0 -11
- package/packages/agents/src/adapters/gemini/GeminiAdapter.d.ts.map +0 -1
- package/packages/agents/src/adapters/gemini/GeminiAdapter.js +0 -42
- package/packages/agents/src/adapters/gemini/GeminiAdapter.ts +0 -58
- package/packages/agents/src/adapters/gemini/GeminiCliRunner.ts +0 -75
- package/packages/agents/src/adapters/local/.gitkeep +0 -0
- package/packages/agents/src/adapters/local/LocalAdapter.d.ts +0 -11
- package/packages/agents/src/adapters/local/LocalAdapter.d.ts.map +0 -1
- package/packages/agents/src/adapters/local/LocalAdapter.js +0 -38
- package/packages/agents/src/adapters/local/LocalAdapter.ts +0 -43
- package/packages/agents/src/adapters/ollama/OllamaCliAdapter.ts +0 -58
- package/packages/agents/src/adapters/ollama/OllamaCliRunner.ts +0 -70
- package/packages/agents/src/adapters/ollama/OllamaRemoteAdapter.ts +0 -205
- package/packages/agents/src/adapters/openai/.gitkeep +0 -0
- package/packages/agents/src/adapters/openai/OpenAiAdapter.d.ts +0 -11
- package/packages/agents/src/adapters/openai/OpenAiAdapter.d.ts.map +0 -1
- package/packages/agents/src/adapters/openai/OpenAiAdapter.js +0 -51
- package/packages/agents/src/adapters/openai/OpenAiAdapter.ts +0 -56
- package/packages/agents/src/adapters/openai/OpenAiCliAdapter.ts +0 -62
- package/packages/agents/src/adapters/qa/.gitkeep +0 -0
- package/packages/agents/src/adapters/qa/QaAdapter.d.ts +0 -11
- package/packages/agents/src/adapters/qa/QaAdapter.d.ts.map +0 -1
- package/packages/agents/src/adapters/qa/QaAdapter.js +0 -37
- package/packages/agents/src/adapters/qa/QaAdapter.ts +0 -42
- package/packages/agents/src/adapters/zhipu/ZhipuApiAdapter.ts +0 -273
- package/packages/agents/src/index.d.ts +0 -8
- package/packages/agents/src/index.d.ts.map +0 -1
- package/packages/agents/src/index.js +0 -7
- package/packages/agents/src/index.ts +0 -11
- package/packages/agents/tsconfig.json +0 -14
- package/packages/cli/CHANGELOG.md +0 -7
- package/packages/cli/LICENSE +0 -21
- package/packages/cli/README.md +0 -23
- package/packages/cli/package.json +0 -61
- package/packages/cli/src/__tests__/AgentsCommands.test.ts +0 -137
- package/packages/cli/src/__tests__/BacklogCommands.test.ts +0 -40
- package/packages/cli/src/__tests__/CodeReviewCommand.test.ts +0 -594
- package/packages/cli/src/__tests__/CreateTasksCommand.test.ts +0 -40
- package/packages/cli/src/__tests__/DocsCommands.test.ts +0 -41
- package/packages/cli/src/__tests__/EstimateCommands.test.ts +0 -54
- package/packages/cli/src/__tests__/JobsCommands.behavior.test.ts +0 -311
- package/packages/cli/src/__tests__/JobsCommands.test.ts +0 -49
- package/packages/cli/src/__tests__/MigrateTasksCommand.test.ts +0 -36
- package/packages/cli/src/__tests__/OpenapiCommands.test.ts +0 -34
- package/packages/cli/src/__tests__/OrderTasksCommand.test.ts +0 -150
- package/packages/cli/src/__tests__/PlanningCommands.test.ts +0 -9
- package/packages/cli/src/__tests__/QaTasksCommand.test.ts +0 -58
- package/packages/cli/src/__tests__/RefineTasksCommand.test.ts +0 -63
- package/packages/cli/src/__tests__/RoutingCommands.test.ts +0 -302
- package/packages/cli/src/__tests__/SetWorkspaceCommand.test.ts +0 -18
- package/packages/cli/src/__tests__/TaskShowCommands.test.ts +0 -130
- package/packages/cli/src/__tests__/TelemetryCommands.test.ts +0 -35
- package/packages/cli/src/__tests__/TestAgentCommand.test.ts +0 -41
- package/packages/cli/src/__tests__/UpdateCommands.test.ts +0 -292
- package/packages/cli/src/__tests__/WorkOnTasksCommand.test.ts +0 -42
- package/packages/cli/src/bin/.gitkeep +0 -0
- package/packages/cli/src/bin/McodaEntrypoint.ts +0 -180
- package/packages/cli/src/commands/agents/.gitkeep +0 -0
- package/packages/cli/src/commands/agents/AgentsCommands.ts +0 -374
- package/packages/cli/src/commands/agents/GatewayAgentCommand.ts +0 -621
- package/packages/cli/src/commands/agents/TestAgentCommand.ts +0 -63
- package/packages/cli/src/commands/backlog/.gitkeep +0 -0
- package/packages/cli/src/commands/backlog/BacklogCommands.ts +0 -286
- package/packages/cli/src/commands/backlog/OrderTasksCommand.ts +0 -237
- package/packages/cli/src/commands/backlog/TaskShowCommands.ts +0 -289
- package/packages/cli/src/commands/docs/.gitkeep +0 -0
- package/packages/cli/src/commands/docs/DocsCommands.ts +0 -413
- package/packages/cli/src/commands/estimate/EstimateCommands.ts +0 -290
- package/packages/cli/src/commands/jobs/.gitkeep +0 -0
- package/packages/cli/src/commands/jobs/JobsCommands.ts +0 -595
- package/packages/cli/src/commands/openapi/OpenapiCommands.ts +0 -167
- package/packages/cli/src/commands/planning/.gitkeep +0 -0
- package/packages/cli/src/commands/planning/CreateTasksCommand.ts +0 -149
- package/packages/cli/src/commands/planning/MigrateTasksCommand.ts +0 -105
- package/packages/cli/src/commands/planning/PlanningCommands.ts +0 -1
- package/packages/cli/src/commands/planning/QaTasksCommand.ts +0 -320
- package/packages/cli/src/commands/planning/RefineTasksCommand.ts +0 -408
- package/packages/cli/src/commands/review/CodeReviewCommand.ts +0 -262
- package/packages/cli/src/commands/routing/.gitkeep +0 -0
- package/packages/cli/src/commands/routing/RoutingCommands.ts +0 -554
- package/packages/cli/src/commands/telemetry/.gitkeep +0 -0
- package/packages/cli/src/commands/telemetry/TelemetryCommands.ts +0 -348
- package/packages/cli/src/commands/update/.gitkeep +0 -0
- package/packages/cli/src/commands/update/UpdateCommands.ts +0 -301
- package/packages/cli/src/commands/work/WorkOnTasksCommand.ts +0 -264
- package/packages/cli/src/commands/workspace/SetWorkspaceCommand.ts +0 -132
- package/packages/cli/test/packaging_guardrails.test.js +0 -75
- package/packages/cli/tsconfig.json +0 -20
- package/packages/core/CHANGELOG.md +0 -7
- package/packages/core/LICENSE +0 -21
- package/packages/core/README.md +0 -9
- package/packages/core/package.json +0 -45
- package/packages/core/src/__tests__/SmokeClasses.test.ts +0 -32
- package/packages/core/src/api/AgentsApi.ts +0 -219
- package/packages/core/src/api/QaTasksApi.ts +0 -38
- package/packages/core/src/api/TasksApi.ts +0 -35
- package/packages/core/src/api/__tests__/AgentsApi.test.ts +0 -203
- package/packages/core/src/api/__tests__/QaTasksApi.test.ts +0 -51
- package/packages/core/src/api/__tests__/TasksApi.test.ts +0 -56
- package/packages/core/src/config/.gitkeep +0 -0
- package/packages/core/src/config/ConfigService.ts +0 -1
- package/packages/core/src/domain/dependencies/.gitkeep +0 -0
- package/packages/core/src/domain/dependencies/Dependency.ts +0 -1
- package/packages/core/src/domain/epics/.gitkeep +0 -0
- package/packages/core/src/domain/epics/Epic.ts +0 -1
- package/packages/core/src/domain/projects/.gitkeep +0 -0
- package/packages/core/src/domain/projects/Project.ts +0 -1
- package/packages/core/src/domain/tasks/.gitkeep +0 -0
- package/packages/core/src/domain/tasks/Task.ts +0 -1
- package/packages/core/src/domain/userStories/.gitkeep +0 -0
- package/packages/core/src/domain/userStories/UserStory.ts +0 -1
- package/packages/core/src/index.ts +0 -27
- package/packages/core/src/prompts/.gitkeep +0 -0
- package/packages/core/src/prompts/PdrPrompts.ts +0 -23
- package/packages/core/src/prompts/PromptLoader.ts +0 -1
- package/packages/core/src/prompts/SdsPrompts.ts +0 -47
- package/packages/core/src/services/agents/.gitkeep +0 -0
- package/packages/core/src/services/agents/AgentManagementService.ts +0 -1
- package/packages/core/src/services/agents/GatewayAgentService.ts +0 -956
- package/packages/core/src/services/agents/RoutingService.ts +0 -461
- package/packages/core/src/services/agents/__tests__/GatewayAgentService.test.ts +0 -72
- package/packages/core/src/services/agents/__tests__/RoutingService.test.ts +0 -267
- package/packages/core/src/services/agents/generated/RoutingApiClient.ts +0 -89
- package/packages/core/src/services/backlog/.gitkeep +0 -0
- package/packages/core/src/services/backlog/BacklogService.ts +0 -580
- package/packages/core/src/services/backlog/TaskOrderingService.ts +0 -868
- package/packages/core/src/services/backlog/__tests__/BacklogService.test.ts +0 -219
- package/packages/core/src/services/backlog/__tests__/TaskOrderingService.test.ts +0 -268
- package/packages/core/src/services/docs/.gitkeep +0 -0
- package/packages/core/src/services/docs/DocsService.ts +0 -1913
- package/packages/core/src/services/docs/__tests__/DocsService.test.ts +0 -350
- package/packages/core/src/services/estimate/EstimateService.ts +0 -111
- package/packages/core/src/services/estimate/VelocityService.ts +0 -272
- package/packages/core/src/services/estimate/__tests__/VelocityAndEstimate.test.ts +0 -209
- package/packages/core/src/services/estimate/types.ts +0 -41
- package/packages/core/src/services/execution/.gitkeep +0 -0
- package/packages/core/src/services/execution/ExecutionService.ts +0 -1
- package/packages/core/src/services/execution/QaFollowupService.ts +0 -289
- package/packages/core/src/services/execution/QaProfileService.ts +0 -160
- package/packages/core/src/services/execution/QaTasksService.ts +0 -1303
- package/packages/core/src/services/execution/TaskSelectionService.ts +0 -362
- package/packages/core/src/services/execution/TaskStateService.ts +0 -64
- package/packages/core/src/services/execution/WorkOnTasksService.ts +0 -2023
- package/packages/core/src/services/execution/__tests__/QaFollowupService.test.ts +0 -58
- package/packages/core/src/services/execution/__tests__/QaProfileService.test.ts +0 -49
- package/packages/core/src/services/execution/__tests__/QaTasksService.test.ts +0 -157
- package/packages/core/src/services/execution/__tests__/TaskSelectionService.test.ts +0 -179
- package/packages/core/src/services/execution/__tests__/TaskStateService.test.ts +0 -51
- package/packages/core/src/services/execution/__tests__/WorkOnTasksService.test.ts +0 -285
- package/packages/core/src/services/jobs/.gitkeep +0 -0
- package/packages/core/src/services/jobs/JobInsightsService.ts +0 -355
- package/packages/core/src/services/jobs/JobResumeService.ts +0 -119
- package/packages/core/src/services/jobs/JobService.ts +0 -648
- package/packages/core/src/services/jobs/JobsApiClient.ts +0 -113
- package/packages/core/src/services/jobs/__tests__/JobInsightsService.test.ts +0 -17
- package/packages/core/src/services/jobs/__tests__/JobResumeService.test.ts +0 -45
- package/packages/core/src/services/jobs/__tests__/JobService.test.ts +0 -44
- package/packages/core/src/services/openapi/OpenApiService.ts +0 -558
- package/packages/core/src/services/openapi/__tests__/OpenApiService.test.ts +0 -57
- package/packages/core/src/services/planning/.gitkeep +0 -0
- package/packages/core/src/services/planning/CreateTasksService.ts +0 -1280
- package/packages/core/src/services/planning/KeyHelpers.ts +0 -80
- package/packages/core/src/services/planning/PlanningService.ts +0 -1
- package/packages/core/src/services/planning/RefineTasksService.ts +0 -1552
- package/packages/core/src/services/planning/__tests__/CreateTasksService.test.ts +0 -288
- package/packages/core/src/services/planning/__tests__/KeyHelpers.test.ts +0 -16
- package/packages/core/src/services/planning/__tests__/RefineTasksService.test.ts +0 -172
- package/packages/core/src/services/review/CodeReviewService.ts +0 -1386
- package/packages/core/src/services/review/__tests__/CodeReviewService.test.ts +0 -89
- package/packages/core/src/services/system/SystemUpdateService.ts +0 -177
- package/packages/core/src/services/system/__tests__/SystemUpdateService.test.ts +0 -40
- package/packages/core/src/services/tasks/TaskApiResolver.ts +0 -37
- package/packages/core/src/services/tasks/TaskDetailService.ts +0 -494
- package/packages/core/src/services/tasks/__tests__/TaskApiResolver.test.ts +0 -41
- package/packages/core/src/services/tasks/__tests__/TaskDetailService.test.ts +0 -178
- package/packages/core/src/services/telemetry/.gitkeep +0 -0
- package/packages/core/src/services/telemetry/TelemetryService.ts +0 -515
- package/packages/core/src/services/telemetry/__tests__/TelemetryService.test.ts +0 -160
- package/packages/core/src/workspace/.gitkeep +0 -0
- package/packages/core/src/workspace/WorkspaceManager.ts +0 -234
- package/packages/core/tsconfig.json +0 -20
- package/packages/db/CHANGELOG.md +0 -7
- package/packages/db/LICENSE +0 -21
- package/packages/db/README.md +0 -9
- package/packages/db/package.json +0 -42
- package/packages/db/src/__tests__/GlobalRepository.test.ts +0 -109
- package/packages/db/src/__tests__/SchemaAlignment.test.ts +0 -80
- package/packages/db/src/__tests__/WorkspaceRepository.test.ts +0 -19
- package/packages/db/src/index.d.ts +0 -6
- package/packages/db/src/index.d.ts.map +0 -1
- package/packages/db/src/index.js +0 -5
- package/packages/db/src/index.ts +0 -6
- package/packages/db/src/migrations/global/.gitkeep +0 -0
- package/packages/db/src/migrations/global/GlobalMigrations.d.ts +0 -9
- package/packages/db/src/migrations/global/GlobalMigrations.d.ts.map +0 -1
- package/packages/db/src/migrations/global/GlobalMigrations.js +0 -68
- package/packages/db/src/migrations/global/GlobalMigrations.ts +0 -336
- package/packages/db/src/migrations/workspace/.gitkeep +0 -0
- package/packages/db/src/migrations/workspace/WorkspaceMigrations.d.ts +0 -9
- package/packages/db/src/migrations/workspace/WorkspaceMigrations.d.ts.map +0 -1
- package/packages/db/src/migrations/workspace/WorkspaceMigrations.js +0 -251
- package/packages/db/src/migrations/workspace/WorkspaceMigrations.ts +0 -248
- package/packages/db/src/repositories/global/.gitkeep +0 -0
- package/packages/db/src/repositories/global/GlobalRepository.d.ts +0 -30
- package/packages/db/src/repositories/global/GlobalRepository.d.ts.map +0 -1
- package/packages/db/src/repositories/global/GlobalRepository.js +0 -209
- package/packages/db/src/repositories/global/GlobalRepository.ts +0 -492
- package/packages/db/src/repositories/workspace/.gitkeep +0 -0
- package/packages/db/src/repositories/workspace/WorkspaceRepository.d.ts +0 -282
- package/packages/db/src/repositories/workspace/WorkspaceRepository.d.ts.map +0 -1
- package/packages/db/src/repositories/workspace/WorkspaceRepository.js +0 -773
- package/packages/db/src/repositories/workspace/WorkspaceRepository.ts +0 -1511
- package/packages/db/src/sqlite/connection.d.ts +0 -11
- package/packages/db/src/sqlite/connection.d.ts.map +0 -1
- package/packages/db/src/sqlite/connection.js +0 -31
- package/packages/db/src/sqlite/connection.ts +0 -35
- package/packages/db/src/sqlite/pragmas.d.ts +0 -5
- package/packages/db/src/sqlite/pragmas.d.ts.map +0 -1
- package/packages/db/src/sqlite/pragmas.js +0 -6
- package/packages/db/src/sqlite/pragmas.ts +0 -10
- package/packages/db/tsconfig.json +0 -13
- package/packages/generators/package.json +0 -21
- package/packages/generators/src/__tests__/Generators.test.ts +0 -19
- package/packages/generators/src/index.ts +0 -1
- package/packages/generators/src/openapi/generateTypes.ts +0 -1
- package/packages/generators/src/openapi/validateSchema.ts +0 -1
- package/packages/generators/src/scaffolding/docs/.gitkeep +0 -0
- package/packages/generators/src/scaffolding/docs/DocsScaffolder.ts +0 -1
- package/packages/generators/src/scaffolding/global/.gitkeep +0 -0
- package/packages/generators/src/scaffolding/global/GlobalScaffolder.ts +0 -1
- package/packages/generators/src/scaffolding/workspace/.gitkeep +0 -0
- package/packages/generators/src/scaffolding/workspace/WorkspaceScaffolder.ts +0 -1
- package/packages/generators/tsconfig.json +0 -10
- package/packages/integrations/CHANGELOG.md +0 -7
- package/packages/integrations/LICENSE +0 -21
- package/packages/integrations/README.md +0 -9
- package/packages/integrations/package.json +0 -47
- package/packages/integrations/src/docdex/.gitkeep +0 -0
- package/packages/integrations/src/docdex/DocdexClient.d.ts +0 -50
- package/packages/integrations/src/docdex/DocdexClient.d.ts.map +0 -1
- package/packages/integrations/src/docdex/DocdexClient.js +0 -216
- package/packages/integrations/src/docdex/DocdexClient.ts +0 -261
- package/packages/integrations/src/docdex/__tests__/DocdexClient.test.ts +0 -29
- package/packages/integrations/src/index.d.ts +0 -2
- package/packages/integrations/src/index.d.ts.map +0 -1
- package/packages/integrations/src/index.js +0 -4
- package/packages/integrations/src/index.ts +0 -5
- package/packages/integrations/src/issues/.gitkeep +0 -0
- package/packages/integrations/src/issues/IssuesClient.ts +0 -1
- package/packages/integrations/src/issues/__tests__/IssuesClient.test.ts +0 -10
- package/packages/integrations/src/qa/.gitkeep +0 -0
- package/packages/integrations/src/qa/ChromiumQaAdapter.ts +0 -89
- package/packages/integrations/src/qa/CliQaAdapter.ts +0 -95
- package/packages/integrations/src/qa/MaestroQaAdapter.ts +0 -91
- package/packages/integrations/src/qa/QaAdapter.ts +0 -7
- package/packages/integrations/src/qa/QaClient.ts +0 -1
- package/packages/integrations/src/qa/QaTypes.ts +0 -26
- package/packages/integrations/src/qa/__tests__/ChromiumQaAdapter.test.ts +0 -30
- package/packages/integrations/src/qa/__tests__/CliQaAdapter.test.ts +0 -33
- package/packages/integrations/src/qa/__tests__/MaestroQaAdapter.test.ts +0 -30
- package/packages/integrations/src/qa/index.ts +0 -5
- package/packages/integrations/src/system/SystemClient.ts +0 -50
- package/packages/integrations/src/system/__tests__/SystemClient.test.ts +0 -40
- package/packages/integrations/src/telemetry/TelemetryClient.ts +0 -139
- package/packages/integrations/src/telemetry/__tests__/TelemetryClient.test.ts +0 -41
- package/packages/integrations/src/vcs/.gitkeep +0 -0
- package/packages/integrations/src/vcs/VcsClient.ts +0 -211
- package/packages/integrations/src/vcs/__tests__/VcsClient.test.ts +0 -26
- package/packages/integrations/tsconfig.json +0 -14
- package/packages/shared/CHANGELOG.md +0 -7
- package/packages/shared/LICENSE +0 -21
- package/packages/shared/README.md +0 -9
- package/packages/shared/package.json +0 -40
- package/packages/shared/src/__tests__/CommandMetadata.test.ts +0 -15
- package/packages/shared/src/__tests__/ServiceShells.test.ts +0 -16
- package/packages/shared/src/crypto/.gitkeep +0 -0
- package/packages/shared/src/crypto/CryptoHelper.d.ts +0 -15
- package/packages/shared/src/crypto/CryptoHelper.d.ts.map +0 -1
- package/packages/shared/src/crypto/CryptoHelper.js +0 -54
- package/packages/shared/src/crypto/CryptoHelper.ts +0 -57
- package/packages/shared/src/errors/.gitkeep +0 -0
- package/packages/shared/src/errors/ErrorFactory.ts +0 -1
- package/packages/shared/src/index.d.ts +0 -6
- package/packages/shared/src/index.d.ts.map +0 -1
- package/packages/shared/src/index.js +0 -4
- package/packages/shared/src/index.ts +0 -35
- package/packages/shared/src/logging/.gitkeep +0 -0
- package/packages/shared/src/logging/Logger.ts +0 -1
- package/packages/shared/src/metadata/CommandMetadata.ts +0 -165
- package/packages/shared/src/openapi/.gitkeep +0 -0
- package/packages/shared/src/openapi/OpenApiTypes.d.ts +0 -216
- package/packages/shared/src/openapi/OpenApiTypes.d.ts.map +0 -1
- package/packages/shared/src/openapi/OpenApiTypes.js +0 -1
- package/packages/shared/src/openapi/OpenApiTypes.ts +0 -312
- package/packages/shared/src/paths/.gitkeep +0 -0
- package/packages/shared/src/paths/PathHelper.d.ts +0 -12
- package/packages/shared/src/paths/PathHelper.d.ts.map +0 -1
- package/packages/shared/src/paths/PathHelper.js +0 -24
- package/packages/shared/src/paths/PathHelper.ts +0 -29
- package/packages/shared/src/qa/QaProfile.ts +0 -14
- package/packages/shared/src/utils/.gitkeep +0 -0
- package/packages/shared/src/utils/UtilityService.ts +0 -1
- package/packages/shared/tsconfig.json +0 -10
- package/packages/testing/package.json +0 -26
- package/packages/testing/src/__tests__/TestingFakes.test.ts +0 -15
- package/packages/testing/src/cli/e2e/.gitkeep +0 -0
- package/packages/testing/src/cli/e2e/E2eSuite.ts +0 -1
- package/packages/testing/src/fakes/agents/.gitkeep +0 -0
- package/packages/testing/src/fakes/agents/FakeAgents.ts +0 -1
- package/packages/testing/src/fakes/docdex/.gitkeep +0 -0
- package/packages/testing/src/fakes/docdex/FakeDocdexClient.ts +0 -1
- package/packages/testing/src/fakes/qa/.gitkeep +0 -0
- package/packages/testing/src/fakes/qa/FakeQaClient.ts +0 -1
- package/packages/testing/src/fakes/vcs/.gitkeep +0 -0
- package/packages/testing/src/fakes/vcs/FakeVcsClient.ts +0 -1
- package/packages/testing/src/fixtures/db/.gitkeep +0 -0
- package/packages/testing/src/fixtures/db/DbFixtures.ts +0 -1
- package/packages/testing/src/fixtures/workspaces/.gitkeep +0 -0
- package/packages/testing/src/fixtures/workspaces/WorkspaceFixtures.ts +0 -1
- package/packages/testing/src/index.ts +0 -1
- package/packages/testing/tsconfig.json +0 -10
- package/pnpm-workspace.yaml +0 -2
- package/prompts/README.md +0 -5
- package/prompts/code-reviewer.md +0 -23
- package/prompts/code-writer.md +0 -35
- package/prompts/gateway-agent.md +0 -27
- package/prompts/qa-agent.md +0 -21
- package/release-please-config.json +0 -39
- package/scripts/build-all.ts +0 -1
- package/scripts/dev.ts +0 -1
- package/scripts/install-local-cli.sh +0 -28
- package/scripts/pack-npm-tarballs.js +0 -63
- package/scripts/release.ts +0 -1
- package/scripts/run-node-tests.js +0 -37
- package/tests/all.js +0 -127
- package/tests/api/openapi_spec.test.js +0 -21
- package/tests/artifacts.md +0 -31
- package/tests/component/cli_version.test.js +0 -38
- package/tests/integration/workspace_resolver.test.js +0 -44
- package/tests/unit/crypto_helper.test.js +0 -36
- package/tests/unit/path_helper.test.js +0 -20
- package/tsconfig.base.json +0 -32
- /package/{packages/cli/src/index.ts → dist/index.js} +0 -0
|
@@ -0,0 +1,583 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { GatewayAgentService, WorkspaceResolver, } from "@mcoda/core";
|
|
4
|
+
import { canonicalizeCommandName } from "@mcoda/shared";
|
|
5
|
+
import { CreateTasksCommand } from "../planning/CreateTasksCommand.js";
|
|
6
|
+
import { RefineTasksCommand } from "../planning/RefineTasksCommand.js";
|
|
7
|
+
import { WorkOnTasksCommand } from "../work/WorkOnTasksCommand.js";
|
|
8
|
+
import { CodeReviewCommand } from "../review/CodeReviewCommand.js";
|
|
9
|
+
import { QaTasksCommand } from "../planning/QaTasksCommand.js";
|
|
10
|
+
import { DocsCommands } from "../docs/DocsCommands.js";
|
|
11
|
+
import { OpenapiCommands } from "../openapi/OpenapiCommands.js";
|
|
12
|
+
import { OrderTasksCommand } from "../backlog/OrderTasksCommand.js";
|
|
13
|
+
const usage = `mcoda gateway-agent <job> \\
|
|
14
|
+
[--workspace-root <PATH>] \\
|
|
15
|
+
[--project <KEY>] \\
|
|
16
|
+
[--input "<text>"] \\
|
|
17
|
+
[--input-file <PATH>] \\
|
|
18
|
+
[--gateway-agent <NAME>] \\
|
|
19
|
+
[--max-docs <N>] \\
|
|
20
|
+
[--agent-stream <true|false>] \\
|
|
21
|
+
[--no-offload] \\
|
|
22
|
+
[--json] \\
|
|
23
|
+
[--] [job args...]`;
|
|
24
|
+
const HANDOFF_ENV_PATH = "MCODA_GATEWAY_HANDOFF_PATH";
|
|
25
|
+
const DOC_ONLY_JOBS = new Set(["sds", "openapi-from-docs"]);
|
|
26
|
+
const parseBooleanFlag = (value, defaultValue) => {
|
|
27
|
+
if (value === undefined)
|
|
28
|
+
return defaultValue;
|
|
29
|
+
const normalized = value.trim().toLowerCase();
|
|
30
|
+
if (["true", "1", "yes", "y", "on"].includes(normalized))
|
|
31
|
+
return true;
|
|
32
|
+
if (["false", "0", "no", "n", "off"].includes(normalized))
|
|
33
|
+
return false;
|
|
34
|
+
return defaultValue;
|
|
35
|
+
};
|
|
36
|
+
const isIoEnabled = () => {
|
|
37
|
+
const raw = process.env.MCODA_STREAM_IO;
|
|
38
|
+
if (!raw)
|
|
39
|
+
return false;
|
|
40
|
+
const normalized = raw.trim().toLowerCase();
|
|
41
|
+
return !["0", "false", "off", "no"].includes(normalized);
|
|
42
|
+
};
|
|
43
|
+
const buildHandoffContent = (result) => {
|
|
44
|
+
const lines = [];
|
|
45
|
+
lines.push(`# Gateway Handoff`);
|
|
46
|
+
lines.push("");
|
|
47
|
+
lines.push(`Job: ${result.job}`);
|
|
48
|
+
lines.push(`Gateway agent: ${result.gatewayAgent.slug}`);
|
|
49
|
+
lines.push(`Chosen agent: ${result.chosenAgent.agentSlug}`);
|
|
50
|
+
lines.push("");
|
|
51
|
+
if (result.analysis.reasoningSummary?.trim()) {
|
|
52
|
+
lines.push("## Reasoning Summary");
|
|
53
|
+
lines.push(result.analysis.reasoningSummary.trim());
|
|
54
|
+
lines.push("");
|
|
55
|
+
}
|
|
56
|
+
lines.push("## Summary");
|
|
57
|
+
lines.push(result.analysis.summary || "(none)");
|
|
58
|
+
lines.push("");
|
|
59
|
+
lines.push("## Current State");
|
|
60
|
+
lines.push(result.analysis.currentState || "(none)");
|
|
61
|
+
lines.push("");
|
|
62
|
+
lines.push("## Todo");
|
|
63
|
+
lines.push(result.analysis.todo || "(none)");
|
|
64
|
+
lines.push("");
|
|
65
|
+
lines.push("## Understanding");
|
|
66
|
+
lines.push(result.analysis.understanding || "(none)");
|
|
67
|
+
lines.push("");
|
|
68
|
+
lines.push("## Plan");
|
|
69
|
+
if (result.analysis.plan.length) {
|
|
70
|
+
result.analysis.plan.forEach((step, idx) => lines.push(`${idx + 1}. ${step}`));
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
lines.push("(none)");
|
|
74
|
+
}
|
|
75
|
+
lines.push("");
|
|
76
|
+
lines.push("## Files Likely Touched");
|
|
77
|
+
if (result.analysis.filesLikelyTouched.length) {
|
|
78
|
+
result.analysis.filesLikelyTouched.forEach((file) => lines.push(`- ${file}`));
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
lines.push("(none)");
|
|
82
|
+
}
|
|
83
|
+
lines.push("");
|
|
84
|
+
lines.push("## Files To Create");
|
|
85
|
+
if (result.analysis.filesToCreate.length) {
|
|
86
|
+
result.analysis.filesToCreate.forEach((file) => lines.push(`- ${file}`));
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
lines.push("(none)");
|
|
90
|
+
}
|
|
91
|
+
if (result.analysis.assumptions.length) {
|
|
92
|
+
lines.push("");
|
|
93
|
+
lines.push("## Assumptions");
|
|
94
|
+
result.analysis.assumptions.forEach((item) => lines.push(`- ${item}`));
|
|
95
|
+
}
|
|
96
|
+
if (result.analysis.risks.length) {
|
|
97
|
+
lines.push("");
|
|
98
|
+
lines.push("## Risks");
|
|
99
|
+
result.analysis.risks.forEach((item) => lines.push(`- ${item}`));
|
|
100
|
+
}
|
|
101
|
+
if (result.analysis.docdexNotes.length) {
|
|
102
|
+
lines.push("");
|
|
103
|
+
lines.push("## Docdex Notes");
|
|
104
|
+
result.analysis.docdexNotes.forEach((item) => lines.push(`- ${item}`));
|
|
105
|
+
}
|
|
106
|
+
return lines.join("\n");
|
|
107
|
+
};
|
|
108
|
+
const isSameAgent = (result) => result.chosenAgent.agentId === result.gatewayAgent.id || result.chosenAgent.agentSlug === result.gatewayAgent.slug;
|
|
109
|
+
const collectOffloadBlockers = (result) => {
|
|
110
|
+
const blockers = [];
|
|
111
|
+
const missingFieldsWarning = result.warnings.find((w) => w.startsWith("Gateway analysis missing fields:"));
|
|
112
|
+
if (missingFieldsWarning) {
|
|
113
|
+
blockers.push(missingFieldsWarning.replace("Gateway analysis missing fields:", "analysis incomplete:").trim());
|
|
114
|
+
}
|
|
115
|
+
const currentState = result.analysis.currentState.trim();
|
|
116
|
+
const todo = result.analysis.todo.trim();
|
|
117
|
+
if (!currentState)
|
|
118
|
+
blockers.push("missing current state");
|
|
119
|
+
if (currentState.toLowerCase().includes("current state unknown"))
|
|
120
|
+
blockers.push("current state not digested");
|
|
121
|
+
if (currentState.toLowerCase().includes("requires investigation"))
|
|
122
|
+
blockers.push("current state not verified");
|
|
123
|
+
if (!todo)
|
|
124
|
+
blockers.push("missing todo");
|
|
125
|
+
if (todo.toLowerCase().includes("determine remaining work"))
|
|
126
|
+
blockers.push("todo not digested");
|
|
127
|
+
if (!result.analysis.understanding.trim())
|
|
128
|
+
blockers.push("missing understanding");
|
|
129
|
+
if (result.analysis.filesLikelyTouched.length === 0 && result.analysis.filesToCreate.length === 0) {
|
|
130
|
+
blockers.push("no files identified to change/create");
|
|
131
|
+
}
|
|
132
|
+
const hasDocdexFailure = result.warnings.some((w) => w.toLowerCase().includes("docdex") && w.toLowerCase().includes("failed"));
|
|
133
|
+
if (hasDocdexFailure)
|
|
134
|
+
blockers.push("docdex lookup failed");
|
|
135
|
+
if (result.analysis.docdexNotes.length === 0 || result.warnings.some((w) => w.includes("missing docdexNotes"))) {
|
|
136
|
+
blockers.push("docdex not digested");
|
|
137
|
+
}
|
|
138
|
+
if (result.warnings.some((w) => w.includes("not valid JSON"))) {
|
|
139
|
+
blockers.push("gateway response not JSON");
|
|
140
|
+
}
|
|
141
|
+
return blockers;
|
|
142
|
+
};
|
|
143
|
+
const parseGatewayArgs = (argv) => {
|
|
144
|
+
const args = { noOffload: false, json: false };
|
|
145
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
146
|
+
const arg = argv[i];
|
|
147
|
+
if (arg.startsWith("--workspace=") || arg.startsWith("--workspace-root=")) {
|
|
148
|
+
const value = arg.split("=", 2)[1];
|
|
149
|
+
args.workspaceRoot = value ? path.resolve(value) : undefined;
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
if (arg.startsWith("--project=") || arg.startsWith("--project-key=")) {
|
|
153
|
+
args.projectKey = arg.split("=", 2)[1];
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
if (arg.startsWith("--input=")) {
|
|
157
|
+
args.inputText = arg.split("=", 2)[1];
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
if (arg.startsWith("--input-file=")) {
|
|
161
|
+
args.inputFile = arg.split("=", 2)[1];
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
if (arg.startsWith("--gateway-agent=")) {
|
|
165
|
+
args.gatewayAgent = arg.split("=", 2)[1];
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
if (arg.startsWith("--max-docs=")) {
|
|
169
|
+
args.maxDocs = Number(arg.split("=", 2)[1]);
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
if (arg.startsWith("--agent-stream=")) {
|
|
173
|
+
args.agentStream = parseBooleanFlag(arg.split("=", 2)[1], true);
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
switch (arg) {
|
|
177
|
+
case "--workspace":
|
|
178
|
+
case "--workspace-root":
|
|
179
|
+
args.workspaceRoot = argv[i + 1] ? path.resolve(argv[i + 1]) : undefined;
|
|
180
|
+
i += 1;
|
|
181
|
+
break;
|
|
182
|
+
case "--project":
|
|
183
|
+
case "--project-key":
|
|
184
|
+
args.projectKey = argv[i + 1];
|
|
185
|
+
i += 1;
|
|
186
|
+
break;
|
|
187
|
+
case "--input":
|
|
188
|
+
args.inputText = argv[i + 1];
|
|
189
|
+
i += 1;
|
|
190
|
+
break;
|
|
191
|
+
case "--input-file":
|
|
192
|
+
args.inputFile = argv[i + 1];
|
|
193
|
+
i += 1;
|
|
194
|
+
break;
|
|
195
|
+
case "--gateway-agent":
|
|
196
|
+
args.gatewayAgent = argv[i + 1];
|
|
197
|
+
i += 1;
|
|
198
|
+
break;
|
|
199
|
+
case "--max-docs":
|
|
200
|
+
args.maxDocs = Number(argv[i + 1]);
|
|
201
|
+
i += 1;
|
|
202
|
+
break;
|
|
203
|
+
case "--agent-stream": {
|
|
204
|
+
const next = argv[i + 1];
|
|
205
|
+
if (next && !next.startsWith("-")) {
|
|
206
|
+
args.agentStream = parseBooleanFlag(next, true);
|
|
207
|
+
i += 1;
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
args.agentStream = true;
|
|
211
|
+
}
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
case "--no-offload":
|
|
215
|
+
case "--plan-only":
|
|
216
|
+
args.noOffload = true;
|
|
217
|
+
break;
|
|
218
|
+
case "--json":
|
|
219
|
+
args.json = true;
|
|
220
|
+
break;
|
|
221
|
+
case "--help":
|
|
222
|
+
case "-h":
|
|
223
|
+
// eslint-disable-next-line no-console
|
|
224
|
+
console.log(usage);
|
|
225
|
+
process.exit(0);
|
|
226
|
+
break;
|
|
227
|
+
default:
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
if (!Number.isFinite(args.maxDocs ?? NaN)) {
|
|
232
|
+
args.maxDocs = undefined;
|
|
233
|
+
}
|
|
234
|
+
return args;
|
|
235
|
+
};
|
|
236
|
+
const stripGatewayOnlyArgs = (argv) => {
|
|
237
|
+
const stripped = [];
|
|
238
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
239
|
+
const arg = argv[i];
|
|
240
|
+
if (arg === "--input" || arg === "--input-file" || arg === "--gateway-agent" || arg === "--max-docs" || arg === "--agent-stream") {
|
|
241
|
+
i += 1;
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
if (arg.startsWith("--input=") ||
|
|
245
|
+
arg.startsWith("--input-file=") ||
|
|
246
|
+
arg.startsWith("--gateway-agent=") ||
|
|
247
|
+
arg.startsWith("--max-docs=") ||
|
|
248
|
+
arg.startsWith("--agent-stream=")) {
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
if (arg === "--no-offload" || arg === "--plan-only" || arg === "--json") {
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
stripped.push(arg);
|
|
255
|
+
}
|
|
256
|
+
return stripped;
|
|
257
|
+
};
|
|
258
|
+
const stripAgentArgs = (argv) => {
|
|
259
|
+
const stripped = [];
|
|
260
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
261
|
+
const arg = argv[i];
|
|
262
|
+
if (arg === "--agent") {
|
|
263
|
+
i += 1;
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
if (arg.startsWith("--agent=")) {
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
stripped.push(arg);
|
|
270
|
+
}
|
|
271
|
+
return stripped;
|
|
272
|
+
};
|
|
273
|
+
const parseTaskFilters = (argv) => {
|
|
274
|
+
const filters = { taskKeys: [], statusFilter: [] };
|
|
275
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
276
|
+
const arg = argv[i];
|
|
277
|
+
if (arg.startsWith("--project=")) {
|
|
278
|
+
filters.projectKey = arg.split("=", 2)[1];
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
if (arg.startsWith("--task=")) {
|
|
282
|
+
const value = arg.split("=", 2)[1];
|
|
283
|
+
if (value)
|
|
284
|
+
filters.taskKeys.push(value);
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
if (arg.startsWith("--epic=")) {
|
|
288
|
+
filters.epicKey = arg.split("=", 2)[1];
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
if (arg.startsWith("--story=")) {
|
|
292
|
+
filters.storyKey = arg.split("=", 2)[1];
|
|
293
|
+
continue;
|
|
294
|
+
}
|
|
295
|
+
if (arg.startsWith("--status=")) {
|
|
296
|
+
const value = arg.split("=", 2)[1];
|
|
297
|
+
if (value) {
|
|
298
|
+
filters.statusFilter.push(...value.split(",").map((s) => s.trim()).filter(Boolean));
|
|
299
|
+
}
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
if (arg.startsWith("--limit=")) {
|
|
303
|
+
filters.limit = Number(arg.split("=", 2)[1]);
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
switch (arg) {
|
|
307
|
+
case "--project":
|
|
308
|
+
case "--project-key":
|
|
309
|
+
filters.projectKey = argv[i + 1];
|
|
310
|
+
i += 1;
|
|
311
|
+
break;
|
|
312
|
+
case "--task":
|
|
313
|
+
if (argv[i + 1]) {
|
|
314
|
+
filters.taskKeys.push(argv[i + 1]);
|
|
315
|
+
i += 1;
|
|
316
|
+
}
|
|
317
|
+
break;
|
|
318
|
+
case "--epic":
|
|
319
|
+
filters.epicKey = argv[i + 1];
|
|
320
|
+
i += 1;
|
|
321
|
+
break;
|
|
322
|
+
case "--story":
|
|
323
|
+
filters.storyKey = argv[i + 1];
|
|
324
|
+
i += 1;
|
|
325
|
+
break;
|
|
326
|
+
case "--status":
|
|
327
|
+
if (argv[i + 1]) {
|
|
328
|
+
filters.statusFilter.push(...argv[i + 1].split(",").map((s) => s.trim()).filter(Boolean));
|
|
329
|
+
i += 1;
|
|
330
|
+
}
|
|
331
|
+
break;
|
|
332
|
+
case "--limit":
|
|
333
|
+
filters.limit = Number(argv[i + 1]);
|
|
334
|
+
i += 1;
|
|
335
|
+
break;
|
|
336
|
+
default:
|
|
337
|
+
break;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
if (!Number.isFinite(filters.limit ?? NaN)) {
|
|
341
|
+
filters.limit = undefined;
|
|
342
|
+
}
|
|
343
|
+
return filters;
|
|
344
|
+
};
|
|
345
|
+
const findWorkspaceRoot = (argv) => {
|
|
346
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
347
|
+
const arg = argv[i];
|
|
348
|
+
if (arg === "--workspace" || arg === "--workspace-root") {
|
|
349
|
+
return argv[i + 1] ? path.resolve(argv[i + 1]) : undefined;
|
|
350
|
+
}
|
|
351
|
+
if (arg.startsWith("--workspace=") || arg.startsWith("--workspace-root=")) {
|
|
352
|
+
const value = arg.split("=", 2)[1];
|
|
353
|
+
return value ? path.resolve(value) : undefined;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
return undefined;
|
|
357
|
+
};
|
|
358
|
+
const normalizeJob = (job) => canonicalizeCommandName(job);
|
|
359
|
+
const resolveJobRunner = (job) => {
|
|
360
|
+
switch (job) {
|
|
361
|
+
case "work-on-tasks":
|
|
362
|
+
return (args) => WorkOnTasksCommand.run(args);
|
|
363
|
+
case "refine-tasks":
|
|
364
|
+
return (args) => RefineTasksCommand.run(args);
|
|
365
|
+
case "create-tasks":
|
|
366
|
+
return (args) => CreateTasksCommand.run(args);
|
|
367
|
+
case "code-review":
|
|
368
|
+
return (args) => CodeReviewCommand.run(args);
|
|
369
|
+
case "qa-tasks":
|
|
370
|
+
return (args) => QaTasksCommand.run(args);
|
|
371
|
+
case "order-tasks":
|
|
372
|
+
return (args) => OrderTasksCommand.run(args);
|
|
373
|
+
case "openapi-from-docs":
|
|
374
|
+
return (args) => OpenapiCommands.run(args);
|
|
375
|
+
case "pdr":
|
|
376
|
+
return (args) => DocsCommands.run(["pdr", "generate", ...args]);
|
|
377
|
+
case "sds":
|
|
378
|
+
return (args) => DocsCommands.run(["sds", "generate", ...args]);
|
|
379
|
+
default:
|
|
380
|
+
return undefined;
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
export class GatewayAgentCommand {
|
|
384
|
+
static async run(argv) {
|
|
385
|
+
const [rawJob, ...rest] = argv;
|
|
386
|
+
if (!rawJob) {
|
|
387
|
+
// eslint-disable-next-line no-console
|
|
388
|
+
console.log(usage);
|
|
389
|
+
process.exitCode = 1;
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
if (rawJob === "--help" || rawJob === "-h") {
|
|
393
|
+
// eslint-disable-next-line no-console
|
|
394
|
+
console.log(usage);
|
|
395
|
+
process.exit(0);
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
const separatorIndex = rest.indexOf("--");
|
|
399
|
+
const gatewayArgv = separatorIndex >= 0 ? rest.slice(0, separatorIndex) : rest;
|
|
400
|
+
let jobArgs = separatorIndex >= 0 ? rest.slice(separatorIndex + 1) : rest.slice();
|
|
401
|
+
const gatewayArgs = parseGatewayArgs(gatewayArgv);
|
|
402
|
+
if (separatorIndex < 0) {
|
|
403
|
+
jobArgs = stripGatewayOnlyArgs(jobArgs);
|
|
404
|
+
}
|
|
405
|
+
const normalizedJob = normalizeJob(rawJob);
|
|
406
|
+
if (normalizedJob === "gateway-agent") {
|
|
407
|
+
// eslint-disable-next-line no-console
|
|
408
|
+
console.error("gateway-agent cannot invoke itself.");
|
|
409
|
+
process.exitCode = 1;
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
const workspaceRoot = gatewayArgs.workspaceRoot ?? findWorkspaceRoot(jobArgs);
|
|
413
|
+
const workspace = await WorkspaceResolver.resolveWorkspace({
|
|
414
|
+
cwd: process.cwd(),
|
|
415
|
+
explicitWorkspace: workspaceRoot,
|
|
416
|
+
});
|
|
417
|
+
const taskFilters = parseTaskFilters(jobArgs);
|
|
418
|
+
const projectKey = gatewayArgs.projectKey ?? taskFilters.projectKey;
|
|
419
|
+
let inputText = gatewayArgs.inputText;
|
|
420
|
+
if (gatewayArgs.inputFile) {
|
|
421
|
+
try {
|
|
422
|
+
const content = await fs.readFile(gatewayArgs.inputFile, "utf8");
|
|
423
|
+
inputText = inputText ? `${inputText}\n\n${content}` : content;
|
|
424
|
+
}
|
|
425
|
+
catch (error) {
|
|
426
|
+
// eslint-disable-next-line no-console
|
|
427
|
+
console.error(`Failed to read input file: ${error.message}`);
|
|
428
|
+
process.exitCode = 1;
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
const requiresInputOrSelection = !DOC_ONLY_JOBS.has(normalizedJob);
|
|
433
|
+
if (requiresInputOrSelection &&
|
|
434
|
+
!inputText &&
|
|
435
|
+
taskFilters.taskKeys.length === 0 &&
|
|
436
|
+
!taskFilters.epicKey &&
|
|
437
|
+
!taskFilters.storyKey) {
|
|
438
|
+
// eslint-disable-next-line no-console
|
|
439
|
+
console.error("gateway-agent requires --input or at least one task selector (e.g., --task, --epic, --story).");
|
|
440
|
+
process.exitCode = 1;
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
const service = await GatewayAgentService.create(workspace);
|
|
444
|
+
try {
|
|
445
|
+
const streamEnabled = (gatewayArgs.agentStream ?? true) && !gatewayArgs.json;
|
|
446
|
+
const ioEnabled = isIoEnabled();
|
|
447
|
+
const shouldPrintStream = streamEnabled && !ioEnabled;
|
|
448
|
+
let streamStarted = false;
|
|
449
|
+
let streamEndedWithNewline = true;
|
|
450
|
+
const onStreamChunk = shouldPrintStream
|
|
451
|
+
? (chunk) => {
|
|
452
|
+
if (!streamStarted) {
|
|
453
|
+
// eslint-disable-next-line no-console
|
|
454
|
+
console.log("Gateway agent stream:");
|
|
455
|
+
streamStarted = true;
|
|
456
|
+
}
|
|
457
|
+
process.stdout.write(chunk);
|
|
458
|
+
streamEndedWithNewline = chunk.endsWith("\n");
|
|
459
|
+
}
|
|
460
|
+
: undefined;
|
|
461
|
+
const result = await service.run({
|
|
462
|
+
workspace,
|
|
463
|
+
job: normalizedJob,
|
|
464
|
+
projectKey,
|
|
465
|
+
epicKey: taskFilters.epicKey,
|
|
466
|
+
storyKey: taskFilters.storyKey,
|
|
467
|
+
taskKeys: taskFilters.taskKeys.length ? taskFilters.taskKeys : undefined,
|
|
468
|
+
statusFilter: taskFilters.statusFilter.length ? taskFilters.statusFilter : undefined,
|
|
469
|
+
limit: taskFilters.limit,
|
|
470
|
+
inputText,
|
|
471
|
+
gatewayAgentName: gatewayArgs.gatewayAgent,
|
|
472
|
+
maxDocs: gatewayArgs.maxDocs,
|
|
473
|
+
agentStream: streamEnabled,
|
|
474
|
+
onStreamChunk,
|
|
475
|
+
});
|
|
476
|
+
if (shouldPrintStream && streamStarted && !streamEndedWithNewline) {
|
|
477
|
+
process.stdout.write("\n");
|
|
478
|
+
}
|
|
479
|
+
const shouldRunJob = !gatewayArgs.noOffload && !gatewayArgs.json;
|
|
480
|
+
if (gatewayArgs.json) {
|
|
481
|
+
// eslint-disable-next-line no-console
|
|
482
|
+
console.log(JSON.stringify(result, null, 2));
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
// eslint-disable-next-line no-console
|
|
486
|
+
console.log(`Gateway agent: ${result.gatewayAgent.slug} (run: ${result.commandRunId})`);
|
|
487
|
+
if (result.analysis.reasoningSummary?.trim()) {
|
|
488
|
+
// eslint-disable-next-line no-console
|
|
489
|
+
console.log(`Reasoning summary: ${result.analysis.reasoningSummary.trim()}`);
|
|
490
|
+
}
|
|
491
|
+
// eslint-disable-next-line no-console
|
|
492
|
+
console.log(`Summary: ${result.analysis.summary}`);
|
|
493
|
+
// eslint-disable-next-line no-console
|
|
494
|
+
console.log(`Current state: ${result.analysis.currentState}`);
|
|
495
|
+
// eslint-disable-next-line no-console
|
|
496
|
+
console.log(`Todo: ${result.analysis.todo}`);
|
|
497
|
+
if (result.analysis.understanding.trim()) {
|
|
498
|
+
// eslint-disable-next-line no-console
|
|
499
|
+
console.log(`Understanding: ${result.analysis.understanding}`);
|
|
500
|
+
}
|
|
501
|
+
if (result.analysis.plan.length) {
|
|
502
|
+
// eslint-disable-next-line no-console
|
|
503
|
+
console.log(`Plan:\n- ${result.analysis.plan.join("\n- ")}`);
|
|
504
|
+
}
|
|
505
|
+
if (result.analysis.filesLikelyTouched.length || result.analysis.filesToCreate.length) {
|
|
506
|
+
// eslint-disable-next-line no-console
|
|
507
|
+
console.log(`Files: ${[
|
|
508
|
+
...result.analysis.filesLikelyTouched.map((f) => `touch:${f}`),
|
|
509
|
+
...result.analysis.filesToCreate.map((f) => `create:${f}`),
|
|
510
|
+
].join(", ")}`);
|
|
511
|
+
}
|
|
512
|
+
// eslint-disable-next-line no-console
|
|
513
|
+
console.log(`Complexity: ${result.analysis.complexity}/10`);
|
|
514
|
+
// eslint-disable-next-line no-console
|
|
515
|
+
console.log(`Discipline: ${result.analysis.discipline}`);
|
|
516
|
+
// eslint-disable-next-line no-console
|
|
517
|
+
console.log(`Chosen agent for ${result.job}: ${result.chosenAgent.agentSlug} (rating=${result.chosenAgent.rating ?? "?"}, cost=${result.chosenAgent.costPerMillion ?? "?"})`);
|
|
518
|
+
// eslint-disable-next-line no-console
|
|
519
|
+
console.log(`Rationale: ${result.chosenAgent.rationale}`);
|
|
520
|
+
if (result.warnings.length) {
|
|
521
|
+
// eslint-disable-next-line no-console
|
|
522
|
+
console.warn(result.warnings.map((w) => `! ${w}`).join("\n"));
|
|
523
|
+
}
|
|
524
|
+
if (!shouldRunJob) {
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
const blockers = collectOffloadBlockers(result);
|
|
528
|
+
if (blockers.length) {
|
|
529
|
+
// eslint-disable-next-line no-console
|
|
530
|
+
console.error(`gateway-agent is not ready to offload: ${blockers.join("; ")}.`);
|
|
531
|
+
process.exitCode = 1;
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
const runner = resolveJobRunner(result.job);
|
|
535
|
+
if (!runner) {
|
|
536
|
+
// eslint-disable-next-line no-console
|
|
537
|
+
console.error(`gateway-agent does not support offloading job ${result.job}.`);
|
|
538
|
+
process.exitCode = 1;
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
const handoffContent = buildHandoffContent(result);
|
|
542
|
+
const handoffDir = path.join(workspace.workspaceRoot, ".mcoda", "handoffs");
|
|
543
|
+
await fs.mkdir(handoffDir, { recursive: true });
|
|
544
|
+
const handoffPath = path.join(handoffDir, `gateway-${result.commandRunId}.md`);
|
|
545
|
+
await fs.writeFile(handoffPath, handoffContent, "utf8");
|
|
546
|
+
const previousHandoff = process.env[HANDOFF_ENV_PATH];
|
|
547
|
+
process.env[HANDOFF_ENV_PATH] = handoffPath;
|
|
548
|
+
const forwarded = stripAgentArgs(jobArgs);
|
|
549
|
+
const hasAgentStream = forwarded.some((arg) => arg === "--agent-stream" || arg.startsWith("--agent-stream="));
|
|
550
|
+
const argsWithAgent = [...forwarded];
|
|
551
|
+
if (!hasAgentStream) {
|
|
552
|
+
argsWithAgent.push("--agent-stream", "true");
|
|
553
|
+
}
|
|
554
|
+
argsWithAgent.push("--agent", result.chosenAgent.agentSlug);
|
|
555
|
+
const sameAgent = isSameAgent(result);
|
|
556
|
+
const actionLabel = sameAgent
|
|
557
|
+
? `Continuing ${result.job} with gateway agent ${result.gatewayAgent.slug}`
|
|
558
|
+
: `Offloading ${result.job} to ${result.chosenAgent.agentSlug}`;
|
|
559
|
+
// eslint-disable-next-line no-console
|
|
560
|
+
console.log(`\n${actionLabel}...`);
|
|
561
|
+
try {
|
|
562
|
+
await runner(argsWithAgent);
|
|
563
|
+
}
|
|
564
|
+
finally {
|
|
565
|
+
if (previousHandoff === undefined) {
|
|
566
|
+
delete process.env[HANDOFF_ENV_PATH];
|
|
567
|
+
}
|
|
568
|
+
else {
|
|
569
|
+
process.env[HANDOFF_ENV_PATH] = previousHandoff;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
catch (error) {
|
|
574
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
575
|
+
// eslint-disable-next-line no-console
|
|
576
|
+
console.error(`gateway-agent failed: ${message}`);
|
|
577
|
+
process.exitCode = 1;
|
|
578
|
+
}
|
|
579
|
+
finally {
|
|
580
|
+
await service.close();
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TestAgentCommand.d.ts","sourceRoot":"","sources":["../../../src/commands/agents/TestAgentCommand.ts"],"names":[],"mappings":"AAyBA,qBAAa,gBAAgB;WACd,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAoChD"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { AgentsApi } from "@mcoda/core";
|
|
2
|
+
const USAGE = "Usage: mcoda test-agent <NAME> [--prompt \"<text>\"] [--json]";
|
|
3
|
+
const parseArgs = (argv) => {
|
|
4
|
+
const flags = {};
|
|
5
|
+
const positionals = [];
|
|
6
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
7
|
+
const arg = argv[i];
|
|
8
|
+
if (arg.startsWith("--")) {
|
|
9
|
+
const key = arg.replace(/^--/, "");
|
|
10
|
+
const next = argv[i + 1];
|
|
11
|
+
if (next && !next.startsWith("--")) {
|
|
12
|
+
flags[key] = next;
|
|
13
|
+
i += 1;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
flags[key] = true;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
positionals.push(arg);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return { flags, positionals };
|
|
24
|
+
};
|
|
25
|
+
export class TestAgentCommand {
|
|
26
|
+
static async run(argv) {
|
|
27
|
+
const parsed = parseArgs(argv);
|
|
28
|
+
const name = parsed.positionals[0];
|
|
29
|
+
if (!name || parsed.flags.help) {
|
|
30
|
+
throw new Error(USAGE);
|
|
31
|
+
}
|
|
32
|
+
const prompt = typeof parsed.flags.prompt === "string" ? parsed.flags.prompt : undefined;
|
|
33
|
+
const api = await AgentsApi.create();
|
|
34
|
+
try {
|
|
35
|
+
const { health, response, prompt: usedPrompt } = await api.probeAgent(name, prompt);
|
|
36
|
+
if (parsed.flags.json) {
|
|
37
|
+
// eslint-disable-next-line no-console
|
|
38
|
+
console.log(JSON.stringify({
|
|
39
|
+
health,
|
|
40
|
+
prompt: usedPrompt,
|
|
41
|
+
response,
|
|
42
|
+
}, null, 2));
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
// eslint-disable-next-line no-console
|
|
46
|
+
console.log(`Agent ${name} health=${health.status} lastCheckedAt=${health.lastCheckedAt ?? ""} latencyMs=${health.latencyMs ?? ""}`);
|
|
47
|
+
// eslint-disable-next-line no-console
|
|
48
|
+
console.log(`Prompt: ${usedPrompt}`);
|
|
49
|
+
// eslint-disable-next-line no-console
|
|
50
|
+
console.log(`Response (${response.adapter}${response.model ? `:${response.model}` : ""}):\n${response.output}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
finally {
|
|
54
|
+
await api.close();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface ParsedArgs {
|
|
2
|
+
workspaceRoot?: string;
|
|
3
|
+
project?: string;
|
|
4
|
+
epic?: string;
|
|
5
|
+
story?: string;
|
|
6
|
+
assignee?: string;
|
|
7
|
+
statuses?: string[];
|
|
8
|
+
orderDependencies: boolean;
|
|
9
|
+
json: boolean;
|
|
10
|
+
verbose: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const parseBacklogArgs: (argv: string[]) => ParsedArgs;
|
|
13
|
+
export declare class BacklogCommands {
|
|
14
|
+
static run(argv: string[]): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=BacklogCommands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BacklogCommands.d.ts","sourceRoot":"","sources":["../../../src/commands/backlog/BacklogCommands.ts"],"names":[],"mappings":"AAGA,UAAU,UAAU;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB;AAsBD,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,EAAE,KAAG,UAwEjD,CAAC;AAqIF,qBAAa,eAAe;WACb,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CA4ChD"}
|