agentic-orchestrator 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dockerignore +24 -0
- package/.github/workflows/mcp-contract-validation.yml +38 -0
- package/Agentic-Orchestrator.iml +9 -0
- package/LICENSE +21 -0
- package/README.md +679 -0
- package/agentic/orchestrator/agents.yaml +14 -0
- package/agentic/orchestrator/gates.yaml +31 -0
- package/agentic/orchestrator/policy.yaml +145 -0
- package/agentic/orchestrator/prompts/builder.system.md +1 -0
- package/agentic/orchestrator/prompts/planner.system.md +15 -0
- package/agentic/orchestrator/prompts/qa.system.md +1 -0
- package/agentic/orchestrator/schemas/agents.schema.json +49 -0
- package/agentic/orchestrator/schemas/gates.schema.json +65 -0
- package/agentic/orchestrator/schemas/index.schema.json +108 -0
- package/agentic/orchestrator/schemas/plan.schema.json +127 -0
- package/agentic/orchestrator/schemas/policy.schema.json +227 -0
- package/agentic/orchestrator/schemas/qa_test_index.schema.json +53 -0
- package/agentic/orchestrator/schemas/state.schema.json +92 -0
- package/agentic/orchestrator/tools/catalog.json +399 -0
- package/agentic/orchestrator/tools/errors.schema.json +21 -0
- package/agentic/orchestrator/tools/protocol.json +8 -0
- package/agentic/orchestrator/tools/schemas/input/collisions.scan.input.schema.json +7 -0
- package/agentic/orchestrator/tools/schemas/input/evidence.latest.input.schema.json +15 -0
- package/agentic/orchestrator/tools/schemas/input/feature.delete.input.schema.json +42 -0
- package/agentic/orchestrator/tools/schemas/input/feature.discover_specs.input.schema.json +7 -0
- package/agentic/orchestrator/tools/schemas/input/feature.get_context.input.schema.json +15 -0
- package/agentic/orchestrator/tools/schemas/input/feature.init.input.schema.json +21 -0
- package/agentic/orchestrator/tools/schemas/input/feature.log_append.input.schema.json +26 -0
- package/agentic/orchestrator/tools/schemas/input/feature.ready_to_merge.input.schema.json +34 -0
- package/agentic/orchestrator/tools/schemas/input/feature.state_get.input.schema.json +15 -0
- package/agentic/orchestrator/tools/schemas/input/feature.state_patch.input.schema.json +28 -0
- package/agentic/orchestrator/tools/schemas/input/gates.list.input.schema.json +11 -0
- package/agentic/orchestrator/tools/schemas/input/gates.run.input.schema.json +29 -0
- package/agentic/orchestrator/tools/schemas/input/locks.acquire.input.schema.json +29 -0
- package/agentic/orchestrator/tools/schemas/input/locks.release.input.schema.json +26 -0
- package/agentic/orchestrator/tools/schemas/input/mutating.schema.json +14 -0
- package/agentic/orchestrator/tools/schemas/input/plan.get.input.schema.json +15 -0
- package/agentic/orchestrator/tools/schemas/input/plan.submit.input.schema.json +28 -0
- package/agentic/orchestrator/tools/schemas/input/plan.update.input.schema.json +29 -0
- package/agentic/orchestrator/tools/schemas/input/qa.test_index_get.input.schema.json +15 -0
- package/agentic/orchestrator/tools/schemas/input/qa.test_index_update.input.schema.json +38 -0
- package/agentic/orchestrator/tools/schemas/input/read.schema.json +6 -0
- package/agentic/orchestrator/tools/schemas/input/repo.apply_patch.input.schema.json +25 -0
- package/agentic/orchestrator/tools/schemas/input/repo.diff.input.schema.json +21 -0
- package/agentic/orchestrator/tools/schemas/input/repo.diff_bundle.input.schema.json +15 -0
- package/agentic/orchestrator/tools/schemas/input/repo.ensure_worktree.input.schema.json +21 -0
- package/agentic/orchestrator/tools/schemas/input/repo.read_file.input.schema.json +20 -0
- package/agentic/orchestrator/tools/schemas/input/repo.search.input.schema.json +20 -0
- package/agentic/orchestrator/tools/schemas/input/repo.status.input.schema.json +15 -0
- package/agentic/orchestrator/tools/schemas/input/report.dashboard.input.schema.json +7 -0
- package/agentic/orchestrator/tools/schemas/input/report.feature_summary.input.schema.json +15 -0
- package/agentic/orchestrator/tools/schemas/output/collisions.scan.output.schema.json +17 -0
- package/agentic/orchestrator/tools/schemas/output/evidence.latest.output.schema.json +20 -0
- package/agentic/orchestrator/tools/schemas/output/feature.delete.output.schema.json +224 -0
- package/agentic/orchestrator/tools/schemas/output/feature.discover_specs.output.schema.json +32 -0
- package/agentic/orchestrator/tools/schemas/output/feature.get_context.output.schema.json +40 -0
- package/agentic/orchestrator/tools/schemas/output/feature.init.output.schema.json +24 -0
- package/agentic/orchestrator/tools/schemas/output/feature.log_append.output.schema.json +24 -0
- package/agentic/orchestrator/tools/schemas/output/feature.ready_to_merge.output.schema.json +30 -0
- package/agentic/orchestrator/tools/schemas/output/feature.state_get.output.schema.json +18 -0
- package/agentic/orchestrator/tools/schemas/output/feature.state_patch.output.schema.json +24 -0
- package/agentic/orchestrator/tools/schemas/output/gates.list.output.schema.json +42 -0
- package/agentic/orchestrator/tools/schemas/output/gates.run.output.schema.json +37 -0
- package/agentic/orchestrator/tools/schemas/output/locks.acquire.output.schema.json +34 -0
- package/agentic/orchestrator/tools/schemas/output/locks.release.output.schema.json +24 -0
- package/agentic/orchestrator/tools/schemas/output/plan.get.output.schema.json +26 -0
- package/agentic/orchestrator/tools/schemas/output/plan.submit.output.schema.json +23 -0
- package/agentic/orchestrator/tools/schemas/output/plan.update.output.schema.json +23 -0
- package/agentic/orchestrator/tools/schemas/output/qa.test_index_get.output.schema.json +22 -0
- package/agentic/orchestrator/tools/schemas/output/qa.test_index_update.output.schema.json +19 -0
- package/agentic/orchestrator/tools/schemas/output/repo.apply_patch.output.schema.json +33 -0
- package/agentic/orchestrator/tools/schemas/output/repo.diff.output.schema.json +19 -0
- package/agentic/orchestrator/tools/schemas/output/repo.diff_bundle.output.schema.json +32 -0
- package/agentic/orchestrator/tools/schemas/output/repo.ensure_worktree.output.schema.json +29 -0
- package/agentic/orchestrator/tools/schemas/output/repo.read_file.output.schema.json +24 -0
- package/agentic/orchestrator/tools/schemas/output/repo.search.output.schema.json +26 -0
- package/agentic/orchestrator/tools/schemas/output/repo.status.output.schema.json +27 -0
- package/agentic/orchestrator/tools/schemas/output/report.dashboard.output.schema.json +21 -0
- package/agentic/orchestrator/tools/schemas/output/report.feature_summary.output.schema.json +36 -0
- package/agentic/orchestrator/tools/schemas/output/standard_success.schema.json +6 -0
- package/agentic/orchestrator/tools.md +32 -0
- package/apps/control-plane/project.json +39 -0
- package/apps/control-plane/scripts/validate-architecture-rules.mjs +170 -0
- package/apps/control-plane/scripts/validate-docker-mcp-contract.mjs +84 -0
- package/apps/control-plane/scripts/validate-mcp-contracts.ts +61 -0
- package/apps/control-plane/src/application/services/collision-queue-service.ts +227 -0
- package/apps/control-plane/src/application/services/feature-deletion-service.ts +459 -0
- package/apps/control-plane/src/application/services/feature-lifecycle-service.ts +177 -0
- package/apps/control-plane/src/application/services/feature-state-service.ts +125 -0
- package/apps/control-plane/src/application/services/gate-service.ts +232 -0
- package/apps/control-plane/src/application/services/lock-service.ts +298 -0
- package/apps/control-plane/src/application/services/merge-service.ts +246 -0
- package/apps/control-plane/src/application/services/patch-service.ts +259 -0
- package/apps/control-plane/src/application/services/plan-service.ts +302 -0
- package/apps/control-plane/src/application/services/qa-index-service.ts +98 -0
- package/apps/control-plane/src/application/services/reporting-service.ts +120 -0
- package/apps/control-plane/src/application/services/run-lease-service.ts +340 -0
- package/apps/control-plane/src/application/tools/tool-metadata.ts +56 -0
- package/apps/control-plane/src/application/tools/tool-router.ts +43 -0
- package/apps/control-plane/src/cli/aop.ts +31 -0
- package/apps/control-plane/src/cli/cli-argument-parser.ts +116 -0
- package/apps/control-plane/src/cli/delete-command-handler.ts +90 -0
- package/apps/control-plane/src/cli/io.ts +14 -0
- package/apps/control-plane/src/cli/resume-command-handler.ts +228 -0
- package/apps/control-plane/src/cli/run-command-handler.ts +57 -0
- package/apps/control-plane/src/cli/spec-ingestion-service.ts +88 -0
- package/apps/control-plane/src/cli/spec-input-resolver.ts +95 -0
- package/apps/control-plane/src/cli/spec-utils.ts +40 -0
- package/apps/control-plane/src/cli/status-command-handler.ts +17 -0
- package/apps/control-plane/src/cli/stop-command-handler.ts +5 -0
- package/apps/control-plane/src/cli/tooling.ts +36 -0
- package/apps/control-plane/src/cli/types.ts +34 -0
- package/apps/control-plane/src/core/collisions.ts +121 -0
- package/apps/control-plane/src/core/constants.ts +72 -0
- package/apps/control-plane/src/core/error-codes.ts +54 -0
- package/apps/control-plane/src/core/frontmatter.ts +42 -0
- package/apps/control-plane/src/core/fs.ts +173 -0
- package/apps/control-plane/src/core/gates.ts +361 -0
- package/apps/control-plane/src/core/git.ts +115 -0
- package/apps/control-plane/src/core/kernel.ts +1077 -0
- package/apps/control-plane/src/core/patch.ts +152 -0
- package/apps/control-plane/src/core/path-layout.ts +113 -0
- package/apps/control-plane/src/core/path-rules.ts +71 -0
- package/apps/control-plane/src/core/qa-index.ts +179 -0
- package/apps/control-plane/src/core/response.ts +62 -0
- package/apps/control-plane/src/core/runtime-sessions.ts +20 -0
- package/apps/control-plane/src/core/schemas.ts +125 -0
- package/apps/control-plane/src/index.ts +21 -0
- package/apps/control-plane/src/interfaces/cli/bootstrap.ts +100 -0
- package/apps/control-plane/src/mcp/kernel-tool-executor.ts +39 -0
- package/apps/control-plane/src/mcp/mcp-server-adapter.ts +74 -0
- package/apps/control-plane/src/mcp/operation-ledger.ts +108 -0
- package/apps/control-plane/src/mcp/protocol-contract.ts +9 -0
- package/apps/control-plane/src/mcp/runtime-factory.ts +105 -0
- package/apps/control-plane/src/mcp/runtime-types.ts +44 -0
- package/apps/control-plane/src/mcp/token-auth-verifier.ts +63 -0
- package/apps/control-plane/src/mcp/token-claims-validator.ts +72 -0
- package/apps/control-plane/src/mcp/token-codec.ts +62 -0
- package/apps/control-plane/src/mcp/tool-authorizer.ts +43 -0
- package/apps/control-plane/src/mcp/tool-client.ts +78 -0
- package/apps/control-plane/src/mcp/tool-contract-validator.ts +83 -0
- package/apps/control-plane/src/mcp/tool-registry-loader.ts +135 -0
- package/apps/control-plane/src/mcp/tool-runtime.ts +336 -0
- package/apps/control-plane/src/mcp/tools-markdown-generator.ts +26 -0
- package/apps/control-plane/src/mcp/transport-types.ts +16 -0
- package/apps/control-plane/src/mcp/types.ts +2 -0
- package/apps/control-plane/src/providers/providers.ts +177 -0
- package/apps/control-plane/src/supervisor/build-wave-executor.ts +55 -0
- package/apps/control-plane/src/supervisor/lease-heartbeat-service.ts +22 -0
- package/apps/control-plane/src/supervisor/planning-wave-executor.ts +316 -0
- package/apps/control-plane/src/supervisor/prompt-bundle-loader.ts +62 -0
- package/apps/control-plane/src/supervisor/qa-wave-executor.ts +99 -0
- package/apps/control-plane/src/supervisor/run-coordinator.ts +224 -0
- package/apps/control-plane/src/supervisor/runtime.ts +347 -0
- package/apps/control-plane/src/supervisor/session-orchestrator.ts +268 -0
- package/apps/control-plane/src/supervisor/types.ts +149 -0
- package/apps/control-plane/src/supervisor/worker-decision-loop.ts +299 -0
- package/apps/control-plane/test/aop.spec.ts +101 -0
- package/apps/control-plane/test/cli-helpers.spec.ts +102 -0
- package/apps/control-plane/test/cli.spec.ts +12 -0
- package/apps/control-plane/test/cli.unit.spec.ts +609 -0
- package/apps/control-plane/test/collision-queue.spec.ts +158 -0
- package/apps/control-plane/test/collisions.spec.ts +138 -0
- package/apps/control-plane/test/core-utils.spec.ts +102 -0
- package/apps/control-plane/test/delete-command-handler.spec.ts +202 -0
- package/apps/control-plane/test/epoch-tracking.spec.ts +121 -0
- package/apps/control-plane/test/gates.spec.ts +452 -0
- package/apps/control-plane/test/helpers.ts +68 -0
- package/apps/control-plane/test/index.spec.ts +18 -0
- package/apps/control-plane/test/kernel-collision-replay.spec.ts +222 -0
- package/apps/control-plane/test/kernel.branches.spec.ts +321 -0
- package/apps/control-plane/test/kernel.coverage.spec.ts +408 -0
- package/apps/control-plane/test/kernel.spec.ts +369 -0
- package/apps/control-plane/test/mcp-helpers.spec.ts +195 -0
- package/apps/control-plane/test/mcp.spec.ts +776 -0
- package/apps/control-plane/test/merge-service.spec.ts +357 -0
- package/apps/control-plane/test/plan-service.spec.ts +195 -0
- package/apps/control-plane/test/planning-wave-executor.spec.ts +229 -0
- package/apps/control-plane/test/providers.spec.ts +168 -0
- package/apps/control-plane/test/qa-index-service.spec.ts +187 -0
- package/apps/control-plane/test/qa-index.spec.ts +317 -0
- package/apps/control-plane/test/response.spec.ts +55 -0
- package/apps/control-plane/test/run-coordinator.spec.ts +334 -0
- package/apps/control-plane/test/schema-date-time.spec.ts +170 -0
- package/apps/control-plane/test/service-retry-paths.spec.ts +305 -0
- package/apps/control-plane/test/services.spec.ts +693 -0
- package/apps/control-plane/test/spec-input-resolver.spec.ts +76 -0
- package/apps/control-plane/test/supervisor-collaborators.spec.ts +201 -0
- package/apps/control-plane/test/supervisor.calltool.spec.ts +120 -0
- package/apps/control-plane/test/supervisor.spec.ts +415 -0
- package/apps/control-plane/test/supervisor.unit.spec.ts +522 -0
- package/apps/control-plane/test/token-auth-verifier.spec.ts +111 -0
- package/apps/control-plane/test/tool-registry-loader.spec.ts +268 -0
- package/apps/control-plane/test/tool-runtime.spec.ts +294 -0
- package/apps/control-plane/test/worker-decision-loop.spec.ts +587 -0
- package/apps/control-plane/tsconfig.build.json +17 -0
- package/apps/control-plane/tsconfig.json +11 -0
- package/apps/control-plane/vitest.config.ts +28 -0
- package/dist/apps/control-plane/application/services/collision-queue-service.d.ts +69 -0
- package/dist/apps/control-plane/application/services/collision-queue-service.js +158 -0
- package/dist/apps/control-plane/application/services/collision-queue-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/feature-deletion-service.d.ts +79 -0
- package/dist/apps/control-plane/application/services/feature-deletion-service.js +336 -0
- package/dist/apps/control-plane/application/services/feature-deletion-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/feature-lifecycle-service.d.ts +81 -0
- package/dist/apps/control-plane/application/services/feature-lifecycle-service.js +117 -0
- package/dist/apps/control-plane/application/services/feature-lifecycle-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/feature-state-service.d.ts +34 -0
- package/dist/apps/control-plane/application/services/feature-state-service.js +90 -0
- package/dist/apps/control-plane/application/services/feature-state-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/gate-service.d.ts +46 -0
- package/dist/apps/control-plane/application/services/gate-service.js +160 -0
- package/dist/apps/control-plane/application/services/gate-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/lock-service.d.ts +56 -0
- package/dist/apps/control-plane/application/services/lock-service.js +242 -0
- package/dist/apps/control-plane/application/services/lock-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/merge-service.d.ts +33 -0
- package/dist/apps/control-plane/application/services/merge-service.js +194 -0
- package/dist/apps/control-plane/application/services/merge-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/patch-service.d.ts +39 -0
- package/dist/apps/control-plane/application/services/patch-service.js +189 -0
- package/dist/apps/control-plane/application/services/patch-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/plan-service.d.ts +60 -0
- package/dist/apps/control-plane/application/services/plan-service.js +234 -0
- package/dist/apps/control-plane/application/services/plan-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/qa-index-service.d.ts +26 -0
- package/dist/apps/control-plane/application/services/qa-index-service.js +66 -0
- package/dist/apps/control-plane/application/services/qa-index-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/reporting-service.d.ts +47 -0
- package/dist/apps/control-plane/application/services/reporting-service.js +90 -0
- package/dist/apps/control-plane/application/services/reporting-service.js.map +1 -0
- package/dist/apps/control-plane/application/services/run-lease-service.d.ts +74 -0
- package/dist/apps/control-plane/application/services/run-lease-service.js +263 -0
- package/dist/apps/control-plane/application/services/run-lease-service.js.map +1 -0
- package/dist/apps/control-plane/application/tools/tool-metadata.d.ts +8 -0
- package/dist/apps/control-plane/application/tools/tool-metadata.js +37 -0
- package/dist/apps/control-plane/application/tools/tool-metadata.js.map +1 -0
- package/dist/apps/control-plane/application/tools/tool-router.d.ts +16 -0
- package/dist/apps/control-plane/application/tools/tool-router.js +25 -0
- package/dist/apps/control-plane/application/tools/tool-router.js.map +1 -0
- package/dist/apps/control-plane/cli/aop.d.ts +5 -0
- package/dist/apps/control-plane/cli/aop.js +19 -0
- package/dist/apps/control-plane/cli/aop.js.map +1 -0
- package/dist/apps/control-plane/cli/cli-argument-parser.d.ts +5 -0
- package/dist/apps/control-plane/cli/cli-argument-parser.js +109 -0
- package/dist/apps/control-plane/cli/cli-argument-parser.js.map +1 -0
- package/dist/apps/control-plane/cli/delete-command-handler.d.ts +8 -0
- package/dist/apps/control-plane/cli/delete-command-handler.js +77 -0
- package/dist/apps/control-plane/cli/delete-command-handler.js.map +1 -0
- package/dist/apps/control-plane/cli/io.d.ts +2 -0
- package/dist/apps/control-plane/cli/io.js +14 -0
- package/dist/apps/control-plane/cli/io.js.map +1 -0
- package/dist/apps/control-plane/cli/resume-command-handler.d.ts +17 -0
- package/dist/apps/control-plane/cli/resume-command-handler.js +178 -0
- package/dist/apps/control-plane/cli/resume-command-handler.js.map +1 -0
- package/dist/apps/control-plane/cli/run-command-handler.d.ts +15 -0
- package/dist/apps/control-plane/cli/run-command-handler.js +39 -0
- package/dist/apps/control-plane/cli/run-command-handler.js.map +1 -0
- package/dist/apps/control-plane/cli/spec-ingestion-service.d.ts +8 -0
- package/dist/apps/control-plane/cli/spec-ingestion-service.js +77 -0
- package/dist/apps/control-plane/cli/spec-ingestion-service.js.map +1 -0
- package/dist/apps/control-plane/cli/spec-input-resolver.d.ts +9 -0
- package/dist/apps/control-plane/cli/spec-input-resolver.js +81 -0
- package/dist/apps/control-plane/cli/spec-input-resolver.js.map +1 -0
- package/dist/apps/control-plane/cli/spec-utils.d.ts +3 -0
- package/dist/apps/control-plane/cli/spec-utils.js +36 -0
- package/dist/apps/control-plane/cli/spec-utils.js.map +1 -0
- package/dist/apps/control-plane/cli/status-command-handler.d.ts +7 -0
- package/dist/apps/control-plane/cli/status-command-handler.js +14 -0
- package/dist/apps/control-plane/cli/status-command-handler.js.map +1 -0
- package/dist/apps/control-plane/cli/stop-command-handler.d.ts +3 -0
- package/dist/apps/control-plane/cli/stop-command-handler.js +6 -0
- package/dist/apps/control-plane/cli/stop-command-handler.js.map +1 -0
- package/dist/apps/control-plane/cli/tooling.d.ts +4 -0
- package/dist/apps/control-plane/cli/tooling.js +24 -0
- package/dist/apps/control-plane/cli/tooling.js.map +1 -0
- package/dist/apps/control-plane/cli/types.d.ts +31 -0
- package/dist/apps/control-plane/cli/types.js +2 -0
- package/dist/apps/control-plane/cli/types.js.map +1 -0
- package/dist/apps/control-plane/core/collisions.d.ts +39 -0
- package/dist/apps/control-plane/core/collisions.js +78 -0
- package/dist/apps/control-plane/core/collisions.js.map +1 -0
- package/dist/apps/control-plane/core/constants.d.ts +64 -0
- package/dist/apps/control-plane/core/constants.js +64 -0
- package/dist/apps/control-plane/core/constants.js.map +1 -0
- package/dist/apps/control-plane/core/error-codes.d.ts +50 -0
- package/dist/apps/control-plane/core/error-codes.js +52 -0
- package/dist/apps/control-plane/core/error-codes.js.map +1 -0
- package/dist/apps/control-plane/core/frontmatter.d.ts +11 -0
- package/dist/apps/control-plane/core/frontmatter.js +30 -0
- package/dist/apps/control-plane/core/frontmatter.js.map +1 -0
- package/dist/apps/control-plane/core/fs.d.ts +33 -0
- package/dist/apps/control-plane/core/fs.js +134 -0
- package/dist/apps/control-plane/core/fs.js.map +1 -0
- package/dist/apps/control-plane/core/gates.d.ts +88 -0
- package/dist/apps/control-plane/core/gates.js +229 -0
- package/dist/apps/control-plane/core/gates.js.map +1 -0
- package/dist/apps/control-plane/core/git.d.ts +31 -0
- package/dist/apps/control-plane/core/git.js +79 -0
- package/dist/apps/control-plane/core/git.js.map +1 -0
- package/dist/apps/control-plane/core/kernel.d.ts +445 -0
- package/dist/apps/control-plane/core/kernel.js +805 -0
- package/dist/apps/control-plane/core/kernel.js.map +1 -0
- package/dist/apps/control-plane/core/patch.d.ts +23 -0
- package/dist/apps/control-plane/core/patch.js +118 -0
- package/dist/apps/control-plane/core/patch.js.map +1 -0
- package/dist/apps/control-plane/core/path-layout.d.ts +23 -0
- package/dist/apps/control-plane/core/path-layout.js +90 -0
- package/dist/apps/control-plane/core/path-layout.js.map +1 -0
- package/dist/apps/control-plane/core/path-rules.d.ts +13 -0
- package/dist/apps/control-plane/core/path-rules.js +52 -0
- package/dist/apps/control-plane/core/path-rules.js.map +1 -0
- package/dist/apps/control-plane/core/qa-index.d.ts +53 -0
- package/dist/apps/control-plane/core/qa-index.js +112 -0
- package/dist/apps/control-plane/core/qa-index.js.map +1 -0
- package/dist/apps/control-plane/core/response.d.ts +19 -0
- package/dist/apps/control-plane/core/response.js +34 -0
- package/dist/apps/control-plane/core/response.js.map +1 -0
- package/dist/apps/control-plane/core/runtime-sessions.d.ts +19 -0
- package/dist/apps/control-plane/core/runtime-sessions.js +2 -0
- package/dist/apps/control-plane/core/runtime-sessions.js.map +1 -0
- package/dist/apps/control-plane/core/schemas.d.ts +23 -0
- package/dist/apps/control-plane/core/schemas.js +80 -0
- package/dist/apps/control-plane/core/schemas.js.map +1 -0
- package/dist/apps/control-plane/index.d.ts +11 -0
- package/dist/apps/control-plane/index.js +9 -0
- package/dist/apps/control-plane/index.js.map +1 -0
- package/dist/apps/control-plane/interfaces/cli/bootstrap.d.ts +2 -0
- package/dist/apps/control-plane/interfaces/cli/bootstrap.js +86 -0
- package/dist/apps/control-plane/interfaces/cli/bootstrap.js.map +1 -0
- package/dist/apps/control-plane/mcp/kernel-tool-executor.d.ts +14 -0
- package/dist/apps/control-plane/mcp/kernel-tool-executor.js +26 -0
- package/dist/apps/control-plane/mcp/kernel-tool-executor.js.map +1 -0
- package/dist/apps/control-plane/mcp/mcp-server-adapter.d.ts +19 -0
- package/dist/apps/control-plane/mcp/mcp-server-adapter.js +55 -0
- package/dist/apps/control-plane/mcp/mcp-server-adapter.js.map +1 -0
- package/dist/apps/control-plane/mcp/operation-ledger.d.ts +21 -0
- package/dist/apps/control-plane/mcp/operation-ledger.js +75 -0
- package/dist/apps/control-plane/mcp/operation-ledger.js.map +1 -0
- package/dist/apps/control-plane/mcp/protocol-contract.d.ts +8 -0
- package/dist/apps/control-plane/mcp/protocol-contract.js +9 -0
- package/dist/apps/control-plane/mcp/protocol-contract.js.map +1 -0
- package/dist/apps/control-plane/mcp/runtime-factory.d.ts +38 -0
- package/dist/apps/control-plane/mcp/runtime-factory.js +71 -0
- package/dist/apps/control-plane/mcp/runtime-factory.js.map +1 -0
- package/dist/apps/control-plane/mcp/runtime-types.d.ts +40 -0
- package/dist/apps/control-plane/mcp/runtime-types.js +2 -0
- package/dist/apps/control-plane/mcp/runtime-types.js.map +1 -0
- package/dist/apps/control-plane/mcp/token-auth-verifier.d.ts +24 -0
- package/dist/apps/control-plane/mcp/token-auth-verifier.js +45 -0
- package/dist/apps/control-plane/mcp/token-auth-verifier.js.map +1 -0
- package/dist/apps/control-plane/mcp/token-claims-validator.d.ts +9 -0
- package/dist/apps/control-plane/mcp/token-claims-validator.js +62 -0
- package/dist/apps/control-plane/mcp/token-claims-validator.js.map +1 -0
- package/dist/apps/control-plane/mcp/token-codec.d.ts +11 -0
- package/dist/apps/control-plane/mcp/token-codec.js +46 -0
- package/dist/apps/control-plane/mcp/token-codec.js.map +1 -0
- package/dist/apps/control-plane/mcp/tool-authorizer.d.ts +8 -0
- package/dist/apps/control-plane/mcp/tool-authorizer.js +36 -0
- package/dist/apps/control-plane/mcp/tool-authorizer.js.map +1 -0
- package/dist/apps/control-plane/mcp/tool-client.d.ts +30 -0
- package/dist/apps/control-plane/mcp/tool-client.js +50 -0
- package/dist/apps/control-plane/mcp/tool-client.js.map +1 -0
- package/dist/apps/control-plane/mcp/tool-contract-validator.d.ts +29 -0
- package/dist/apps/control-plane/mcp/tool-contract-validator.js +61 -0
- package/dist/apps/control-plane/mcp/tool-contract-validator.js.map +1 -0
- package/dist/apps/control-plane/mcp/tool-registry-loader.d.ts +15 -0
- package/dist/apps/control-plane/mcp/tool-registry-loader.js +109 -0
- package/dist/apps/control-plane/mcp/tool-registry-loader.js.map +1 -0
- package/dist/apps/control-plane/mcp/tool-runtime.d.ts +34 -0
- package/dist/apps/control-plane/mcp/tool-runtime.js +252 -0
- package/dist/apps/control-plane/mcp/tool-runtime.js.map +1 -0
- package/dist/apps/control-plane/mcp/tools-markdown-generator.d.ts +7 -0
- package/dist/apps/control-plane/mcp/tools-markdown-generator.js +22 -0
- package/dist/apps/control-plane/mcp/tools-markdown-generator.js.map +1 -0
- package/dist/apps/control-plane/mcp/transport-types.d.ts +14 -0
- package/dist/apps/control-plane/mcp/transport-types.js +2 -0
- package/dist/apps/control-plane/mcp/transport-types.js.map +1 -0
- package/dist/apps/control-plane/mcp/types.d.ts +2 -0
- package/dist/apps/control-plane/mcp/types.js +3 -0
- package/dist/apps/control-plane/mcp/types.js.map +1 -0
- package/dist/apps/control-plane/providers/providers.d.ts +72 -0
- package/dist/apps/control-plane/providers/providers.js +94 -0
- package/dist/apps/control-plane/providers/providers.js.map +1 -0
- package/dist/apps/control-plane/supervisor/build-wave-executor.d.ts +13 -0
- package/dist/apps/control-plane/supervisor/build-wave-executor.js +40 -0
- package/dist/apps/control-plane/supervisor/build-wave-executor.js.map +1 -0
- package/dist/apps/control-plane/supervisor/lease-heartbeat-service.d.ts +12 -0
- package/dist/apps/control-plane/supervisor/lease-heartbeat-service.js +14 -0
- package/dist/apps/control-plane/supervisor/lease-heartbeat-service.js.map +1 -0
- package/dist/apps/control-plane/supervisor/planning-wave-executor.d.ts +19 -0
- package/dist/apps/control-plane/supervisor/planning-wave-executor.js +249 -0
- package/dist/apps/control-plane/supervisor/planning-wave-executor.js.map +1 -0
- package/dist/apps/control-plane/supervisor/prompt-bundle-loader.d.ts +9 -0
- package/dist/apps/control-plane/supervisor/prompt-bundle-loader.js +53 -0
- package/dist/apps/control-plane/supervisor/prompt-bundle-loader.js.map +1 -0
- package/dist/apps/control-plane/supervisor/qa-wave-executor.d.ts +24 -0
- package/dist/apps/control-plane/supervisor/qa-wave-executor.js +70 -0
- package/dist/apps/control-plane/supervisor/qa-wave-executor.js.map +1 -0
- package/dist/apps/control-plane/supervisor/run-coordinator.d.ts +49 -0
- package/dist/apps/control-plane/supervisor/run-coordinator.js +162 -0
- package/dist/apps/control-plane/supervisor/run-coordinator.js.map +1 -0
- package/dist/apps/control-plane/supervisor/runtime.d.ts +58 -0
- package/dist/apps/control-plane/supervisor/runtime.js +270 -0
- package/dist/apps/control-plane/supervisor/runtime.js.map +1 -0
- package/dist/apps/control-plane/supervisor/session-orchestrator.d.ts +29 -0
- package/dist/apps/control-plane/supervisor/session-orchestrator.js +211 -0
- package/dist/apps/control-plane/supervisor/session-orchestrator.js.map +1 -0
- package/dist/apps/control-plane/supervisor/types.d.ts +148 -0
- package/dist/apps/control-plane/supervisor/types.js +2 -0
- package/dist/apps/control-plane/supervisor/types.js.map +1 -0
- package/dist/apps/control-plane/supervisor/worker-decision-loop.d.ts +37 -0
- package/dist/apps/control-plane/supervisor/worker-decision-loop.js +236 -0
- package/dist/apps/control-plane/supervisor/worker-decision-loop.js.map +1 -0
- package/docker/mcp.Dockerfile +14 -0
- package/docker/mcp.compose.yaml +15 -0
- package/docker/mcp.entrypoint.sh +17 -0
- package/eslint.config.mjs +93 -0
- package/example-configurations/README.md +26 -0
- package/example-configurations/java/agents.yaml +14 -0
- package/example-configurations/java/gates.yaml +29 -0
- package/example-configurations/java/policy.yaml +148 -0
- package/example-configurations/node/agents.yaml +14 -0
- package/example-configurations/node/gates.yaml +32 -0
- package/example-configurations/node/policy.yaml +143 -0
- package/nx.json +16 -0
- package/package.json +39 -0
- package/prompts/vitest-testing-standards.instructions.md +204 -0
- package/scripts/dev-shell-env.sh +7 -0
- package/scripts/nx-safe.mjs +33 -0
- package/spec-files/agentic_orchestrator_cli_delete_command_spec.md +310 -0
- package/spec-files/agentic_orchestrator_dot_aop_generated_artifacts_spec.md +211 -0
- package/spec-files/agentic_orchestrator_mcp_formalization_spec.md +379 -0
- package/spec-files/agentic_orchestrator_oop_refactor_spec.md +415 -0
- package/spec-files/agentic_orchestrator_single_global_orchestrator_spec.md +265 -0
- package/spec-files/agentic_orchestrator_spec.md +1334 -0
- package/spec-files/progress.md +452 -0
- package/tsconfig.base.json +15 -0
- package/tsconfig.json +11 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach } from 'vitest';
|
|
2
|
+
import { AopKernel } from '../src/core/kernel.js';
|
|
3
|
+
import { CollisionQueueService } from '../src/application/services/collision-queue-service.js';
|
|
4
|
+
import { makeTempRepo } from './helpers.js';
|
|
5
|
+
import fs from 'node:fs/promises';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
|
|
8
|
+
describe('Collision Queue Re-Drive Service', () => {
|
|
9
|
+
let tempDir: string;
|
|
10
|
+
let kernel: AopKernel;
|
|
11
|
+
let collisionQueueService: CollisionQueueService;
|
|
12
|
+
|
|
13
|
+
beforeEach(async () => {
|
|
14
|
+
tempDir = await makeTempRepo(process.cwd());
|
|
15
|
+
|
|
16
|
+
// Update policy.yaml to use block collision policy for these tests
|
|
17
|
+
const policyPath = path.join(tempDir, 'agentic', 'orchestrator', 'policy.yaml');
|
|
18
|
+
const policyContent = await fs.readFile(policyPath, 'utf8');
|
|
19
|
+
const updatedPolicy = policyContent.replace(/collision_policy:\s*reject/, 'collision_policy: block');
|
|
20
|
+
await fs.writeFile(policyPath, updatedPolicy, 'utf8');
|
|
21
|
+
|
|
22
|
+
kernel = new AopKernel(tempDir);
|
|
23
|
+
await kernel.ensureLoaded();
|
|
24
|
+
collisionQueueService = new CollisionQueueService(kernel);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('should return zero when collision_policy is not block', async () => {
|
|
28
|
+
kernel.policy.collision_policy = 'reject';
|
|
29
|
+
|
|
30
|
+
const result = await collisionQueueService.reDriveBlockedQueue();
|
|
31
|
+
|
|
32
|
+
expect(result.data.processed).toBe(0);
|
|
33
|
+
expect(result.data.retried).toBe(0);
|
|
34
|
+
expect(result.data.still_blocked).toBe(0);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('should return zero when blocked_queue is empty', async () => {
|
|
38
|
+
const result = await collisionQueueService.reDriveBlockedQueue();
|
|
39
|
+
|
|
40
|
+
expect(result.data.processed).toBe(0);
|
|
41
|
+
expect(result.data.retried).toBe(0);
|
|
42
|
+
expect(result.data.still_blocked).toBe(0);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('should process queue entries in deterministic order', async () => {
|
|
46
|
+
await kernel.featureInit('feature-a');
|
|
47
|
+
await kernel.featureInit('feature-b');
|
|
48
|
+
|
|
49
|
+
const index = await kernel.readIndex();
|
|
50
|
+
index.blocked_queue = [
|
|
51
|
+
{
|
|
52
|
+
feature_id: 'feature-b',
|
|
53
|
+
plan_version: 1,
|
|
54
|
+
detected_at: '2026-02-28T12:00:00Z',
|
|
55
|
+
collision_fingerprint: 'hash-b',
|
|
56
|
+
required_resources: []
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
feature_id: 'feature-a',
|
|
60
|
+
plan_version: 1,
|
|
61
|
+
detected_at: '2026-02-28T11:00:00Z',
|
|
62
|
+
collision_fingerprint: 'hash-a',
|
|
63
|
+
required_resources: []
|
|
64
|
+
}
|
|
65
|
+
];
|
|
66
|
+
await kernel.writeIndex(index);
|
|
67
|
+
|
|
68
|
+
const result = await collisionQueueService.reDriveBlockedQueue();
|
|
69
|
+
|
|
70
|
+
expect(result.data.processed).toBe(2);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('should keep entry in queue if plan is missing', async () => {
|
|
74
|
+
await kernel.featureInit('feature-missing');
|
|
75
|
+
|
|
76
|
+
const index = await kernel.readIndex();
|
|
77
|
+
index.blocked_queue = [
|
|
78
|
+
{
|
|
79
|
+
feature_id: 'feature-missing',
|
|
80
|
+
plan_version: 1,
|
|
81
|
+
detected_at: '2026-02-28T12:00:00Z',
|
|
82
|
+
collision_fingerprint: 'hash-missing',
|
|
83
|
+
required_resources: []
|
|
84
|
+
}
|
|
85
|
+
];
|
|
86
|
+
await kernel.writeIndex(index);
|
|
87
|
+
|
|
88
|
+
const result = await collisionQueueService.reDriveBlockedQueue();
|
|
89
|
+
|
|
90
|
+
expect(result.data.processed).toBe(1);
|
|
91
|
+
expect(result.data.retried).toBe(0);
|
|
92
|
+
expect(result.data.still_blocked).toBe(1);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it('should keep entry in queue if locks not held', async () => {
|
|
96
|
+
await kernel.featureInit('feature-locked');
|
|
97
|
+
|
|
98
|
+
await fs.mkdir(path.join(tempDir, '.aop', 'features', 'feature-locked'), { recursive: true });
|
|
99
|
+
|
|
100
|
+
const plan = {
|
|
101
|
+
feature_id: 'feature-locked',
|
|
102
|
+
plan_version: 1,
|
|
103
|
+
summary: 'Test plan requiring lock',
|
|
104
|
+
files: { create: [], modify: [], delete: [] },
|
|
105
|
+
contracts: { openapi: 'modify', events: 'none', db: 'none' }
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
await fs.writeFile(
|
|
109
|
+
path.join(tempDir, '.aop', 'features', 'feature-locked', 'plan.json'),
|
|
110
|
+
JSON.stringify(plan, null, 2)
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
const index = await kernel.readIndex();
|
|
114
|
+
index.blocked_queue = [
|
|
115
|
+
{
|
|
116
|
+
feature_id: 'feature-locked',
|
|
117
|
+
plan_version: 1,
|
|
118
|
+
detected_at: '2026-02-28T12:00:00Z',
|
|
119
|
+
collision_fingerprint: 'hash-locked',
|
|
120
|
+
required_resources: ['openapi']
|
|
121
|
+
}
|
|
122
|
+
];
|
|
123
|
+
await kernel.writeIndex(index);
|
|
124
|
+
|
|
125
|
+
const result = await collisionQueueService.reDriveBlockedQueue();
|
|
126
|
+
|
|
127
|
+
expect(result.data.processed).toBe(1);
|
|
128
|
+
expect(result.data.retried).toBe(0);
|
|
129
|
+
expect(result.data.still_blocked).toBe(1);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it('should remove cleared entry from queue', async () => {
|
|
133
|
+
await kernel.featureInit('feature-clear');
|
|
134
|
+
|
|
135
|
+
const index = await kernel.readIndex();
|
|
136
|
+
index.blocked_queue = [
|
|
137
|
+
{
|
|
138
|
+
feature_id: 'feature-clear',
|
|
139
|
+
plan_version: 1,
|
|
140
|
+
detected_at: '2026-02-28T12:00:00Z',
|
|
141
|
+
collision_fingerprint: 'hash-clear',
|
|
142
|
+
required_resources: []
|
|
143
|
+
}
|
|
144
|
+
];
|
|
145
|
+
await kernel.writeIndex(index);
|
|
146
|
+
|
|
147
|
+
const clearResult = await collisionQueueService.clearQueueEntry('feature-clear');
|
|
148
|
+
expect(clearResult.data.removed).toBe(true);
|
|
149
|
+
|
|
150
|
+
const updatedIndex = await kernel.readIndex();
|
|
151
|
+
expect(updatedIndex.blocked_queue).toHaveLength(0);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it('should not remove non-existent entry', async () => {
|
|
155
|
+
const clearResult = await collisionQueueService.clearQueueEntry('non-existent');
|
|
156
|
+
expect(clearResult.data.removed).toBe(false);
|
|
157
|
+
});
|
|
158
|
+
});
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { detectPlanCollisions } from '../src/core/collisions.js';
|
|
3
|
+
|
|
4
|
+
describe('detectPlanCollisions', () => {
|
|
5
|
+
it('GIVEN_disjoint_plans_WHEN_detecting_THEN_reports_no_collisions', () => {
|
|
6
|
+
const result = detectPlanCollisions(
|
|
7
|
+
{
|
|
8
|
+
feature_id: 'feature_a',
|
|
9
|
+
files: { modify: ['src/a.ts'] },
|
|
10
|
+
allowed_areas: ['src/a'],
|
|
11
|
+
contracts: { openapi: 'none', events: 'none', db: 'none' }
|
|
12
|
+
},
|
|
13
|
+
[
|
|
14
|
+
{
|
|
15
|
+
feature_id: 'feature_b',
|
|
16
|
+
files: { modify: ['src/b.ts'] },
|
|
17
|
+
allowed_areas: ['src/b'],
|
|
18
|
+
contracts: { openapi: 'none', events: 'none', db: 'none' }
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
{
|
|
22
|
+
exclusive_areas: ['libs/core'],
|
|
23
|
+
protected_areas: ['agentic/orchestrator/policy.yaml']
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
expect(result.hasCollisions).toBe(false);
|
|
28
|
+
expect(result.collisions).toEqual({
|
|
29
|
+
files: [],
|
|
30
|
+
areas: [],
|
|
31
|
+
contracts: []
|
|
32
|
+
});
|
|
33
|
+
expect(result.fingerprint).toBeNull();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('GIVEN_overlapping_files_WHEN_detecting_THEN_reports_file_collision_and_fingerprint', () => {
|
|
37
|
+
const result = detectPlanCollisions(
|
|
38
|
+
{
|
|
39
|
+
feature_id: 'feature_a',
|
|
40
|
+
files: { create: ['src/shared.ts'] }
|
|
41
|
+
},
|
|
42
|
+
[
|
|
43
|
+
{
|
|
44
|
+
feature_id: 'feature_b',
|
|
45
|
+
files: { modify: ['src/shared.ts'] }
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
{}
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
expect(result.hasCollisions).toBe(true);
|
|
52
|
+
expect(result.collisions.files).toEqual([
|
|
53
|
+
{
|
|
54
|
+
with_feature_id: 'feature_b',
|
|
55
|
+
paths: ['src/shared.ts']
|
|
56
|
+
}
|
|
57
|
+
]);
|
|
58
|
+
expect(typeof result.fingerprint).toBe('string');
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('GIVEN_overlapping_exclusive_or_protected_areas_WHEN_detecting_THEN_reports_area_collision', () => {
|
|
62
|
+
const result = detectPlanCollisions(
|
|
63
|
+
{
|
|
64
|
+
feature_id: 'feature_a',
|
|
65
|
+
allowed_areas: ['libs/core/module_a', 'agentic/orchestrator/schemas']
|
|
66
|
+
},
|
|
67
|
+
[
|
|
68
|
+
{
|
|
69
|
+
feature_id: 'feature_b',
|
|
70
|
+
allowed_areas: ['libs/core']
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
feature_id: 'feature_c',
|
|
74
|
+
allowed_areas: ['agentic/orchestrator']
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
{
|
|
78
|
+
exclusive_areas: ['libs/core'],
|
|
79
|
+
protected_areas: ['agentic/orchestrator']
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
expect(result.hasCollisions).toBe(true);
|
|
84
|
+
expect(result.collisions.areas).toContainEqual({
|
|
85
|
+
with_feature_id: 'feature_b',
|
|
86
|
+
overlaps: [['libs/core/module_a', 'libs/core']]
|
|
87
|
+
});
|
|
88
|
+
expect(result.collisions.areas).toContainEqual({
|
|
89
|
+
with_feature_id: 'feature_c',
|
|
90
|
+
overlaps: [['agentic/orchestrator/schemas', 'agentic/orchestrator']]
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('GIVEN_shared_contract_mutations_WHEN_detecting_THEN_reports_contract_collision', () => {
|
|
95
|
+
const result = detectPlanCollisions(
|
|
96
|
+
{
|
|
97
|
+
feature_id: 'feature_a',
|
|
98
|
+
contracts: { openapi: 'modify', events: 'none', db: 'none' }
|
|
99
|
+
},
|
|
100
|
+
[
|
|
101
|
+
{
|
|
102
|
+
feature_id: 'feature_b',
|
|
103
|
+
contracts: { openapi: 'modify', events: 'none', db: 'none' }
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
{}
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
expect(result.hasCollisions).toBe(true);
|
|
110
|
+
expect(result.collisions.contracts).toEqual([
|
|
111
|
+
{
|
|
112
|
+
with_feature_id: 'feature_b',
|
|
113
|
+
contract: 'openapi',
|
|
114
|
+
candidate_mode: 'modify',
|
|
115
|
+
other_mode: 'modify'
|
|
116
|
+
}
|
|
117
|
+
]);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it('GIVEN_same_feature_in_accepted_plans_WHEN_detecting_THEN_ignores_self_collision', () => {
|
|
121
|
+
const result = detectPlanCollisions(
|
|
122
|
+
{
|
|
123
|
+
feature_id: 'feature_a',
|
|
124
|
+
files: { modify: ['src/same.ts'] }
|
|
125
|
+
},
|
|
126
|
+
[
|
|
127
|
+
{
|
|
128
|
+
feature_id: 'feature_a',
|
|
129
|
+
files: { modify: ['src/same.ts'] }
|
|
130
|
+
}
|
|
131
|
+
],
|
|
132
|
+
{}
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
expect(result.hasCollisions).toBe(false);
|
|
136
|
+
expect(result.fingerprint).toBeNull();
|
|
137
|
+
});
|
|
138
|
+
});
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { describe, expect, it } from 'vitest';
|
|
5
|
+
import { parseFrontMatter, buildFrontMatter } from '../src/core/frontmatter.js';
|
|
6
|
+
import { anyAreaMatch, areaMatches, normalizeRepoPath, sortResourcesDeterministically } from '../src/core/path-rules.js';
|
|
7
|
+
import { parseUnifiedDiff, touchedPathsFromDiff } from '../src/core/patch.js';
|
|
8
|
+
|
|
9
|
+
describe('core utility branches', () => {
|
|
10
|
+
it('covers frontmatter parsing and serialization edge cases', () => {
|
|
11
|
+
expect(parseFrontMatter('plain text')).toEqual({ frontMatter: {}, body: 'plain text' });
|
|
12
|
+
expect(parseFrontMatter('---\nkey: value\nno_end_marker')).toEqual({
|
|
13
|
+
frontMatter: {},
|
|
14
|
+
body: '---\nkey: value\nno_end_marker'
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const parsed = parseFrontMatter('---\nfeature_id: abc\nversion: 1\n---\n\nBody');
|
|
18
|
+
expect(parsed.frontMatter).toMatchObject({ feature_id: 'abc', version: 1 });
|
|
19
|
+
expect(parsed.body).toBe('\nBody');
|
|
20
|
+
|
|
21
|
+
const serialized = buildFrontMatter({ feature_id: 'abc', version: 2 }, '\nBody');
|
|
22
|
+
expect(serialized).toContain('feature_id: abc');
|
|
23
|
+
expect(serialized).toContain('\n---\nBody');
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('covers path normalization and matching modes', async () => {
|
|
27
|
+
const repoRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'aop-path-rules-'));
|
|
28
|
+
const nested = path.join(repoRoot, 'src', 'a.ts');
|
|
29
|
+
await fs.mkdir(path.dirname(nested), { recursive: true });
|
|
30
|
+
await fs.writeFile(nested, 'export const a = 1;\n', 'utf8');
|
|
31
|
+
|
|
32
|
+
await expect(normalizeRepoPath(repoRoot, nested)).resolves.toBe('src/a.ts');
|
|
33
|
+
await expect(normalizeRepoPath(repoRoot, path.join(repoRoot, '../outside.txt'))).rejects.toThrow(
|
|
34
|
+
'path_out_of_bounds'
|
|
35
|
+
);
|
|
36
|
+
await expect(normalizeRepoPath(repoRoot, nested, true)).resolves.toBe('src/a.ts');
|
|
37
|
+
|
|
38
|
+
expect(areaMatches('src/a.ts', 'src')).toBe(true);
|
|
39
|
+
expect(areaMatches('src/a.ts', 'src/*.ts', 'glob')).toBe(true);
|
|
40
|
+
expect(anyAreaMatch('src/a.ts', ['docs', 'src'])).toBe(true);
|
|
41
|
+
expect(anyAreaMatch('src/a.ts', ['docs', 'tests'])).toBe(false);
|
|
42
|
+
|
|
43
|
+
expect(sortResourcesDeterministically(['db', 'openapi', 'db'])).toEqual(['db', 'openapi']);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('covers unified diff parsing branches for add/delete/rename and touched paths', () => {
|
|
47
|
+
const diff = [
|
|
48
|
+
'diff --git a/src/renamed.ts b/src/new-name.ts',
|
|
49
|
+
'rename from src/renamed.ts',
|
|
50
|
+
'rename to src/new-name.ts',
|
|
51
|
+
'@@ -1 +1 @@',
|
|
52
|
+
'-old',
|
|
53
|
+
'+new',
|
|
54
|
+
'diff --git a/src/deleted.ts b/src/deleted.ts',
|
|
55
|
+
'deleted file mode 100644',
|
|
56
|
+
'--- a/src/deleted.ts',
|
|
57
|
+
'+++ /dev/null',
|
|
58
|
+
'@@ -2,2 +0,0 @@',
|
|
59
|
+
'-a',
|
|
60
|
+
'-b',
|
|
61
|
+
'diff --git a/src/added.ts b/src/added.ts',
|
|
62
|
+
'new file mode 100644',
|
|
63
|
+
'--- /dev/null',
|
|
64
|
+
'+++ b/src/added.ts',
|
|
65
|
+
'@@ -0,0 +4,2 @@',
|
|
66
|
+
'+x',
|
|
67
|
+
'+y'
|
|
68
|
+
].join('\n');
|
|
69
|
+
|
|
70
|
+
const parsed = parseUnifiedDiff(diff);
|
|
71
|
+
expect(parsed).toHaveLength(3);
|
|
72
|
+
expect(parsed[0]).toMatchObject({
|
|
73
|
+
oldPath: 'src/renamed.ts',
|
|
74
|
+
newPath: 'src/new-name.ts',
|
|
75
|
+
changeType: 'modify'
|
|
76
|
+
});
|
|
77
|
+
expect(parsed[1]).toMatchObject({
|
|
78
|
+
oldPath: 'src/deleted.ts',
|
|
79
|
+
newPath: 'src/deleted.ts',
|
|
80
|
+
changeType: 'delete'
|
|
81
|
+
});
|
|
82
|
+
expect(parsed[2]).toMatchObject({
|
|
83
|
+
oldPath: 'src/added.ts',
|
|
84
|
+
newPath: 'src/added.ts',
|
|
85
|
+
changeType: 'add'
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
expect(parsed[1].hunks[0]).toEqual({
|
|
89
|
+
start_line: 2,
|
|
90
|
+
end_line: 3,
|
|
91
|
+
change_type: 'delete'
|
|
92
|
+
});
|
|
93
|
+
expect(parsed[2].hunks[0]).toEqual({
|
|
94
|
+
start_line: 4,
|
|
95
|
+
end_line: 5,
|
|
96
|
+
change_type: 'add'
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const touched = touchedPathsFromDiff(parsed);
|
|
100
|
+
expect(touched).toEqual(['src/renamed.ts', 'src/new-name.ts', 'src/deleted.ts', 'src/added.ts']);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { DeleteCommandHandler } from '../src/cli/delete-command-handler.js';
|
|
3
|
+
import { ERROR_CODES } from '../src/core/error-codes.js';
|
|
4
|
+
import { TOOLS } from '../src/core/constants.js';
|
|
5
|
+
|
|
6
|
+
type ToolClientCall = ReturnType<typeof vi.fn>;
|
|
7
|
+
|
|
8
|
+
function makeHandler(callImpl: ToolClientCall = vi.fn(async () => ({ ok: true, data: { feature_id: 'feature_a' } }))) {
|
|
9
|
+
const toolClient = {
|
|
10
|
+
call: callImpl
|
|
11
|
+
};
|
|
12
|
+
const handler = new DeleteCommandHandler(toolClient as never, 'run:test');
|
|
13
|
+
return { handler, toolClient };
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
describe('DeleteCommandHandler', () => {
|
|
17
|
+
it('GIVEN_valid_defaults_WHEN_execute_called_THEN_calls_feature_delete_in_preview_mode', async () => {
|
|
18
|
+
const call = vi.fn(async () => ({ ok: true, data: { feature_id: 'feature_a', dry_run: true } }));
|
|
19
|
+
const { handler, toolClient } = makeHandler(call);
|
|
20
|
+
|
|
21
|
+
const result = await handler.execute({
|
|
22
|
+
command: 'delete',
|
|
23
|
+
feature_id: 'feature_a'
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
expect(toolClient.call).toHaveBeenCalledWith(
|
|
27
|
+
TOOLS.FEATURE_DELETE,
|
|
28
|
+
expect.objectContaining({
|
|
29
|
+
feature_id: 'feature_a',
|
|
30
|
+
dry_run: true,
|
|
31
|
+
confirm: false,
|
|
32
|
+
remove_worktree: true,
|
|
33
|
+
remove_branch: 'none',
|
|
34
|
+
operation_id: expect.any(String)
|
|
35
|
+
}),
|
|
36
|
+
expect.objectContaining({
|
|
37
|
+
run_id: 'run:test',
|
|
38
|
+
actor_type: 'system'
|
|
39
|
+
})
|
|
40
|
+
);
|
|
41
|
+
expect(result).toMatchObject({
|
|
42
|
+
ok: true,
|
|
43
|
+
data: {
|
|
44
|
+
command: 'delete',
|
|
45
|
+
feature_id: 'feature_a',
|
|
46
|
+
dry_run: true
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('GIVEN_yes_without_dry_run_WHEN_execute_called_THEN_runs_destructive_mode_by_default', async () => {
|
|
52
|
+
const call = vi.fn(async () => ({ ok: true, data: { feature_id: 'feature_a', dry_run: false } }));
|
|
53
|
+
const { handler, toolClient } = makeHandler(call);
|
|
54
|
+
|
|
55
|
+
await handler.execute({
|
|
56
|
+
command: 'delete',
|
|
57
|
+
feature_id: 'feature_a',
|
|
58
|
+
yes: true
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
expect(toolClient.call).toHaveBeenCalledWith(
|
|
62
|
+
TOOLS.FEATURE_DELETE,
|
|
63
|
+
expect.objectContaining({
|
|
64
|
+
dry_run: false,
|
|
65
|
+
confirm: true
|
|
66
|
+
}),
|
|
67
|
+
expect.any(Object)
|
|
68
|
+
);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('GIVEN_yes_with_explicit_flags_WHEN_execute_called_THEN_uses_provided_delete_options', async () => {
|
|
72
|
+
const call = vi.fn(async () => ({ ok: true, data: { feature_id: 'feature_a' } }));
|
|
73
|
+
const { handler, toolClient } = makeHandler(call);
|
|
74
|
+
|
|
75
|
+
await handler.execute({
|
|
76
|
+
command: 'delete',
|
|
77
|
+
feature_id: 'feature_a',
|
|
78
|
+
yes: true,
|
|
79
|
+
dry_run: true,
|
|
80
|
+
remove_worktree: false,
|
|
81
|
+
remove_branch: 'force'
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
expect(toolClient.call).toHaveBeenCalledWith(
|
|
85
|
+
TOOLS.FEATURE_DELETE,
|
|
86
|
+
expect.objectContaining({
|
|
87
|
+
dry_run: true,
|
|
88
|
+
confirm: true,
|
|
89
|
+
remove_worktree: false,
|
|
90
|
+
remove_branch: 'force'
|
|
91
|
+
}),
|
|
92
|
+
expect.any(Object)
|
|
93
|
+
);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('GIVEN_missing_feature_id_WHEN_execute_called_THEN_throws_invalid_cli_args', async () => {
|
|
97
|
+
const { handler } = makeHandler();
|
|
98
|
+
|
|
99
|
+
await expect(
|
|
100
|
+
handler.execute({
|
|
101
|
+
command: 'delete'
|
|
102
|
+
})
|
|
103
|
+
).rejects.toMatchObject({
|
|
104
|
+
code: ERROR_CODES.INVALID_CLI_ARGS,
|
|
105
|
+
details: expect.objectContaining({
|
|
106
|
+
reason: '--feature-id is required for delete'
|
|
107
|
+
})
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it('GIVEN_invalid_feature_id_WHEN_execute_called_THEN_throws_invalid_cli_args', async () => {
|
|
112
|
+
const { handler } = makeHandler();
|
|
113
|
+
|
|
114
|
+
await expect(
|
|
115
|
+
handler.execute({
|
|
116
|
+
command: 'delete',
|
|
117
|
+
feature_id: 'FeatureBad'
|
|
118
|
+
})
|
|
119
|
+
).rejects.toMatchObject({
|
|
120
|
+
code: ERROR_CODES.INVALID_CLI_ARGS,
|
|
121
|
+
details: expect.objectContaining({
|
|
122
|
+
reason: 'Invalid --feature-id value'
|
|
123
|
+
})
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it('GIVEN_invalid_remove_branch_mode_WHEN_execute_called_THEN_throws_invalid_cli_args', async () => {
|
|
128
|
+
const { handler } = makeHandler();
|
|
129
|
+
|
|
130
|
+
await expect(
|
|
131
|
+
handler.execute({
|
|
132
|
+
command: 'delete',
|
|
133
|
+
feature_id: 'feature_a',
|
|
134
|
+
remove_branch: 'hard'
|
|
135
|
+
})
|
|
136
|
+
).rejects.toMatchObject({
|
|
137
|
+
code: ERROR_CODES.INVALID_CLI_ARGS,
|
|
138
|
+
details: expect.objectContaining({
|
|
139
|
+
reason: 'Invalid --remove-branch value'
|
|
140
|
+
})
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it('GIVEN_destructive_dry_run_false_without_yes_WHEN_execute_called_THEN_throws_invalid_cli_args', async () => {
|
|
145
|
+
const { handler } = makeHandler();
|
|
146
|
+
|
|
147
|
+
await expect(
|
|
148
|
+
handler.execute({
|
|
149
|
+
command: 'delete',
|
|
150
|
+
feature_id: 'feature_a',
|
|
151
|
+
dry_run: false,
|
|
152
|
+
yes: false
|
|
153
|
+
})
|
|
154
|
+
).rejects.toMatchObject({
|
|
155
|
+
code: ERROR_CODES.INVALID_CLI_ARGS,
|
|
156
|
+
details: expect.objectContaining({
|
|
157
|
+
reason: 'Destructive delete requires --yes'
|
|
158
|
+
})
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
it('GIVEN_tool_failure_response_WHEN_execute_called_THEN_surfaces_normalized_error', async () => {
|
|
163
|
+
const call = vi.fn(async () => ({
|
|
164
|
+
ok: false,
|
|
165
|
+
error: {
|
|
166
|
+
code: ERROR_CODES.RUN_ALREADY_ACTIVE,
|
|
167
|
+
message: 'run active',
|
|
168
|
+
details: { stale: false }
|
|
169
|
+
}
|
|
170
|
+
}));
|
|
171
|
+
const { handler } = makeHandler(call);
|
|
172
|
+
|
|
173
|
+
await expect(
|
|
174
|
+
handler.execute({
|
|
175
|
+
command: 'delete',
|
|
176
|
+
feature_id: 'feature_a'
|
|
177
|
+
})
|
|
178
|
+
).rejects.toMatchObject({
|
|
179
|
+
code: ERROR_CODES.RUN_ALREADY_ACTIVE,
|
|
180
|
+
details: {
|
|
181
|
+
stale: false
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
it('GIVEN_success_without_data_payload_WHEN_execute_called_THEN_returns_command_envelope_only', async () => {
|
|
187
|
+
const call = vi.fn(async () => ({ ok: true, data: undefined }));
|
|
188
|
+
const { handler } = makeHandler(call);
|
|
189
|
+
|
|
190
|
+
const result = await handler.execute({
|
|
191
|
+
command: 'delete',
|
|
192
|
+
feature_id: 'feature_a'
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
expect(result).toEqual({
|
|
196
|
+
ok: true,
|
|
197
|
+
data: {
|
|
198
|
+
command: 'delete'
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
});
|