@neural-node-labs/xcoder-dna 0.0.0-stage → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +132 -2
- package/dist/agents/agent-catalog.d.ts +87 -0
- package/dist/agents/agent-catalog.js +159 -0
- package/dist/agents/agent-registry.d.ts +76 -0
- package/dist/agents/agent-registry.js +189 -0
- package/dist/agents/ai-chat-debate.d.ts +36 -0
- package/dist/agents/ai-chat-debate.js +300 -0
- package/dist/agents/ai-chat-report-writer.d.ts +7 -0
- package/dist/agents/ai-chat-report-writer.js +100 -0
- package/dist/agents/duplicate-detector.d.ts +41 -0
- package/dist/agents/duplicate-detector.js +65 -0
- package/dist/agents/genesis-agent.d.ts +61 -0
- package/dist/agents/genesis-agent.js +340 -0
- package/dist/agents/samurai-agent.d.ts +53 -0
- package/dist/agents/samurai-agent.js +279 -0
- package/dist/agents/sub-agent.d.ts +56 -0
- package/dist/agents/sub-agent.js +353 -0
- package/dist/backlog/backlog-requirement-validator.d.ts +10 -0
- package/dist/backlog/backlog-requirement-validator.js +60 -0
- package/dist/backlog/backlog-store.d.ts +29 -0
- package/dist/backlog/backlog-store.js +148 -0
- package/dist/backlog/po-agent.d.ts +16 -0
- package/dist/backlog/po-agent.js +121 -0
- package/dist/backlog/types.d.ts +25 -0
- package/dist/backlog/types.js +4 -0
- package/dist/bench/run.d.ts +11 -0
- package/dist/bench/run.js +185 -0
- package/dist/bench/types.d.ts +50 -0
- package/dist/bench/types.js +1 -0
- package/dist/cli/delegate.d.ts +90 -0
- package/dist/cli/delegate.js +220 -0
- package/dist/cli/swarm.d.ts +10 -0
- package/dist/cli/swarm.js +100 -0
- package/dist/cli/task.d.ts +14 -0
- package/dist/cli/task.js +121 -0
- package/dist/cli/wbc-arg.d.ts +6 -0
- package/dist/cli/wbc-arg.js +40 -0
- package/dist/cli/wbc.d.ts +45 -0
- package/dist/cli/wbc.js +98 -0
- package/dist/commands/license.d.ts +9 -0
- package/dist/commands/license.js +140 -0
- package/dist/commands/release.d.ts +44 -0
- package/dist/commands/release.js +180 -0
- package/dist/commands/test.d.ts +50 -0
- package/dist/commands/test.js +385 -0
- package/dist/config/env-guard.d.ts +35 -0
- package/dist/config/env-guard.js +100 -0
- package/dist/config/env-snapshot.d.ts +18 -0
- package/dist/config/env-snapshot.js +30 -0
- package/dist/config/loadConfig.d.ts +82 -0
- package/dist/config/loadConfig.js +249 -0
- package/dist/config/secure-mode.d.ts +29 -0
- package/dist/config/secure-mode.js +63 -0
- package/dist/config/user-config.d.ts +39 -0
- package/dist/config/user-config.js +202 -0
- package/dist/engine/reasoning-engine.d.ts +21 -0
- package/dist/engine/reasoning-engine.js +59 -0
- package/dist/events/bus.d.ts +22 -0
- package/dist/events/bus.js +18 -0
- package/dist/index.d.ts +87 -0
- package/dist/index.js +88 -0
- package/dist/indexing/ignoreRules.d.ts +1 -0
- package/dist/indexing/ignoreRules.js +53 -0
- package/dist/instance-swarm/instance-swarm-orchestrator.d.ts +57 -0
- package/dist/instance-swarm/instance-swarm-orchestrator.js +204 -0
- package/dist/instance-swarm/protocol-name-resolver.d.ts +23 -0
- package/dist/instance-swarm/protocol-name-resolver.js +64 -0
- package/dist/license/gate.d.ts +31 -0
- package/dist/license/gate.js +188 -0
- package/dist/license/http-client.d.ts +43 -0
- package/dist/license/http-client.js +195 -0
- package/dist/license/manager.d.ts +39 -0
- package/dist/license/manager.js +175 -0
- package/dist/license/receipt.d.ts +27 -0
- package/dist/license/receipt.js +108 -0
- package/dist/license/state-codec.d.ts +72 -0
- package/dist/license/state-codec.js +218 -0
- package/dist/license/state-paths.d.ts +17 -0
- package/dist/license/state-paths.js +64 -0
- package/dist/license/store.d.ts +44 -0
- package/dist/license/store.js +223 -0
- package/dist/license/trust-anchor.d.ts +24 -0
- package/dist/license/trust-anchor.js +74 -0
- package/dist/license/types.d.ts +34 -0
- package/dist/license/types.js +19 -0
- package/dist/llm/budget.d.ts +23 -0
- package/dist/llm/budget.js +58 -0
- package/dist/llm/client.d.ts +53 -0
- package/dist/llm/client.js +122 -0
- package/dist/llm/factory.d.ts +14 -0
- package/dist/llm/factory.js +32 -0
- package/dist/orchestrator/defect-logger.d.ts +31 -0
- package/dist/orchestrator/defect-logger.js +101 -0
- package/dist/orchestrator/defect-manager.d.ts +118 -0
- package/dist/orchestrator/defect-manager.js +338 -0
- package/dist/orchestrator/defect-migration.d.ts +14 -0
- package/dist/orchestrator/defect-migration.js +174 -0
- package/dist/orchestrator/defect-store.d.ts +48 -0
- package/dist/orchestrator/defect-store.js +76 -0
- package/dist/orchestrator/healing.d.ts +14 -0
- package/dist/orchestrator/healing.js +11 -0
- package/dist/orchestrator/interactive-steering.d.ts +64 -0
- package/dist/orchestrator/interactive-steering.js +107 -0
- package/dist/orchestrator/interrupt-handler.d.ts +30 -0
- package/dist/orchestrator/interrupt-handler.js +70 -0
- package/dist/orchestrator/lesson-manager.d.ts +25 -0
- package/dist/orchestrator/lesson-manager.js +122 -0
- package/dist/orchestrator/progress-summary.d.ts +15 -0
- package/dist/orchestrator/progress-summary.js +106 -0
- package/dist/orchestrator/reasoning-score.d.ts +49 -0
- package/dist/orchestrator/reasoning-score.js +117 -0
- package/dist/orchestrator/swarm.d.ts +36 -0
- package/dist/orchestrator/swarm.js +77 -0
- package/dist/orchestrator/task-factory.d.ts +15 -0
- package/dist/orchestrator/task-factory.js +176 -0
- package/dist/orchestrator/validation-gate.d.ts +23 -0
- package/dist/orchestrator/validation-gate.js +155 -0
- package/dist/protocol/react-contract.d.ts +136 -0
- package/dist/protocol/react-contract.js +698 -0
- package/dist/protocol/wks-protocol-manager.d.ts +22 -0
- package/dist/protocol/wks-protocol-manager.js +72 -0
- package/dist/sdlc-runtime/conversation-runner.d.ts +8 -0
- package/dist/sdlc-runtime/conversation-runner.js +64 -0
- package/dist/sdlc-runtime/dag-utils.d.ts +15 -0
- package/dist/sdlc-runtime/dag-utils.js +67 -0
- package/dist/sdlc-runtime/defect-integration.d.ts +7 -0
- package/dist/sdlc-runtime/defect-integration.js +99 -0
- package/dist/sdlc-runtime/execution-loop.d.ts +38 -0
- package/dist/sdlc-runtime/execution-loop.js +274 -0
- package/dist/sdlc-runtime/lesson-recorder.d.ts +9 -0
- package/dist/sdlc-runtime/lesson-recorder.js +27 -0
- package/dist/sdlc-runtime/plan-initializer.d.ts +47 -0
- package/dist/sdlc-runtime/plan-initializer.js +135 -0
- package/dist/sdlc-runtime/progress-persister.d.ts +10 -0
- package/dist/sdlc-runtime/progress-persister.js +34 -0
- package/dist/sdlc-runtime/protocol-loader.d.ts +10 -0
- package/dist/sdlc-runtime/protocol-loader.js +21 -0
- package/dist/sdlc-runtime/reporting.d.ts +24 -0
- package/dist/sdlc-runtime/reporting.js +68 -0
- package/dist/sdlc-runtime/run-task.d.ts +81 -0
- package/dist/sdlc-runtime/run-task.js +210 -0
- package/dist/sdlc-runtime/sdlc-orchestrator.d.ts +59 -0
- package/dist/sdlc-runtime/sdlc-orchestrator.js +170 -0
- package/dist/sdlc-runtime/sdlc-skill.d.ts +44 -0
- package/dist/sdlc-runtime/sdlc-skill.js +148 -0
- package/dist/sdlc-runtime/steering-handler.d.ts +14 -0
- package/dist/sdlc-runtime/steering-handler.js +51 -0
- package/dist/sdlc-runtime/trace-recorder.d.ts +10 -0
- package/dist/sdlc-runtime/trace-recorder.js +7 -0
- package/dist/security/index.d.ts +16 -0
- package/dist/security/index.js +12 -0
- package/dist/security/input-screen.d.ts +30 -0
- package/dist/security/input-screen.js +75 -0
- package/dist/security/tool-call-guard.d.ts +16 -0
- package/dist/security/tool-call-guard.js +174 -0
- package/dist/security/untrusted-content.d.ts +34 -0
- package/dist/security/untrusted-content.js +63 -0
- package/dist/skills/advanced-dfir/SKILL.md +85 -0
- package/dist/skills/advanced-pentest-lab/SKILL.md +88 -0
- package/dist/skills/analyst/SKILL.md +55 -0
- package/dist/skills/architect/SKILL.md +54 -0
- package/dist/skills/aws/SKILL.md +92 -0
- package/dist/skills/azure/SKILL.md +90 -0
- package/dist/skills/bylaw-context.d.ts +45 -0
- package/dist/skills/bylaw-context.js +61 -0
- package/dist/skills/bylaw-review.d.ts +20 -0
- package/dist/skills/bylaw-review.js +101 -0
- package/dist/skills/conversation/SKILL.md +29 -0
- package/dist/skills/design-patterns/SKILL.md +190 -0
- package/dist/skills/devops/SKILL.md +55 -0
- package/dist/skills/directives.d.ts +20 -0
- package/dist/skills/directives.js +313 -0
- package/dist/skills/docker/SKILL.md +76 -0
- package/dist/skills/docker-expert/SKILL.md +56 -0
- package/dist/skills/enterprise-systems-analyst/SKILL.md +83 -0
- package/dist/skills/enterprise-systems-analyst/references/crm.md +41 -0
- package/dist/skills/enterprise-systems-analyst/references/erp.md +40 -0
- package/dist/skills/enterprise-systems-analyst/references/financial-systems.md +35 -0
- package/dist/skills/enterprise-systems-analyst/references/hcm.md +38 -0
- package/dist/skills/enterprise-systems-analyst/references/mrp.md +37 -0
- package/dist/skills/enterprise-systems-analyst/references/scm.md +32 -0
- package/dist/skills/ethical-hacking-methodology/SKILL.md +119 -0
- package/dist/skills/externalSkillLoader.d.ts +25 -0
- package/dist/skills/externalSkillLoader.js +65 -0
- package/dist/skills/externalSkillRegistry.d.ts +33 -0
- package/dist/skills/externalSkillRegistry.js +94 -0
- package/dist/skills/filesystem-management/SKILL.md +61 -0
- package/dist/skills/first-run-seed.d.ts +26 -0
- package/dist/skills/first-run-seed.js +75 -0
- package/dist/skills/git-vcs/SKILL.md +84 -0
- package/dist/skills/kafka/SKILL.md +89 -0
- package/dist/skills/kubernetes/SKILL.md +93 -0
- package/dist/skills/kubernetes-expert/SKILL.md +54 -0
- package/dist/skills/openshift/SKILL.md +93 -0
- package/dist/skills/pentester/SKILL.md +59 -0
- package/dist/skills/performance-tester/SKILL.md +57 -0
- package/dist/skills/playwright-ui-tester/SKILL.md +67 -0
- package/dist/skills/programmer/SKILL.md +58 -0
- package/dist/skills/project-scaffolding/SKILL.md +133 -0
- package/dist/skills/qa-engineer/SKILL.md +91 -0
- package/dist/skills/rca/SKILL.md +58 -0
- package/dist/skills/redhat/SKILL.md +92 -0
- package/dist/skills/rosa/SKILL.md +80 -0
- package/dist/skills/scrum-framework/SKILL.md +74 -0
- package/dist/skills/scrum-framework/references/artifacts_and_quality.md +79 -0
- package/dist/skills/scrum-framework/references/roles_and_events.md +105 -0
- package/dist/skills/scrum-master-agent/SKILL.md +74 -0
- package/dist/skills/scrum-master-agent/references/behaviors.md +56 -0
- package/dist/skills/sdlc-skill.d.ts +1 -0
- package/dist/skills/sdlc-skill.js +4 -0
- package/dist/skills/secops/SKILL.md +52 -0
- package/dist/skills/secure-architect.bylaws.d.ts +68 -0
- package/dist/skills/secure-architect.bylaws.js +525 -0
- package/dist/skills/seed-skills.d.ts +48 -0
- package/dist/skills/seed-skills.js +213 -0
- package/dist/skills/skill-authoring/SKILL.md +123 -0
- package/dist/skills/skill-header.d.ts +51 -0
- package/dist/skills/skill-header.js +163 -0
- package/dist/skills/skill-path-guard.d.ts +41 -0
- package/dist/skills/skill-path-guard.js +95 -0
- package/dist/skills/skillRouter.d.ts +51 -0
- package/dist/skills/skillRouter.js +90 -0
- package/dist/skills/skills-root.d.ts +64 -0
- package/dist/skills/skills-root.js +168 -0
- package/dist/skills/software-architect/SKILL.md +77 -0
- package/dist/skills/software-engineer/SKILL.md +74 -0
- package/dist/skills/solid-principles/SKILL.md +94 -0
- package/dist/skills/task-planning/SKILL.md +115 -0
- package/dist/skills/tester/SKILL.md +54 -0
- package/dist/skills/ubuntu/SKILL.md +87 -0
- package/dist/skills/ui-ux-design/SKILL.md +114 -0
- package/dist/skills/workspace-context/SKILL.md +103 -0
- package/dist/sprint/controller.d.ts +37 -0
- package/dist/sprint/controller.js +220 -0
- package/dist/sprint/dag-builder.d.ts +14 -0
- package/dist/sprint/dag-builder.js +105 -0
- package/dist/sprint/reporter.d.ts +11 -0
- package/dist/sprint/reporter.js +97 -0
- package/dist/sprint/state-store.d.ts +10 -0
- package/dist/sprint/state-store.js +71 -0
- package/dist/sprint/types.d.ts +24 -0
- package/dist/sprint/types.js +4 -0
- package/dist/store/file-version-store.d.ts +24 -0
- package/dist/store/file-version-store.js +73 -0
- package/dist/store/task-store.d.ts +90 -0
- package/dist/store/task-store.js +166 -0
- package/dist/task-ingest/architect-detailer.d.ts +43 -0
- package/dist/task-ingest/architect-detailer.js +141 -0
- package/dist/task-ingest/detail-schema.d.ts +9 -0
- package/dist/task-ingest/detail-schema.js +195 -0
- package/dist/task-ingest/detailed-run.d.ts +36 -0
- package/dist/task-ingest/detailed-run.js +108 -0
- package/dist/task-ingest/extract-id.d.ts +9 -0
- package/dist/task-ingest/extract-id.js +24 -0
- package/dist/task-ingest/index.d.ts +23 -0
- package/dist/task-ingest/index.js +14 -0
- package/dist/task-ingest/ingest.d.ts +45 -0
- package/dist/task-ingest/ingest.js +163 -0
- package/dist/task-ingest/list-ingested.d.ts +13 -0
- package/dist/task-ingest/list-ingested.js +30 -0
- package/dist/task-ingest/pending-filter.d.ts +30 -0
- package/dist/task-ingest/pending-filter.js +59 -0
- package/dist/task-ingest/scanner.d.ts +56 -0
- package/dist/task-ingest/scanner.js +216 -0
- package/dist/task-ingest/source-reader.d.ts +25 -0
- package/dist/task-ingest/source-reader.js +93 -0
- package/dist/task-ingest/spec-builder.d.ts +34 -0
- package/dist/task-ingest/spec-builder.js +89 -0
- package/dist/task-ingest/wbs-extract.d.ts +50 -0
- package/dist/task-ingest/wbs-extract.js +226 -0
- package/dist/task-ingest/wbs-parser.d.ts +36 -0
- package/dist/task-ingest/wbs-parser.js +170 -0
- package/dist/tools/apiTestTool.d.ts +37 -0
- package/dist/tools/apiTestTool.js +128 -0
- package/dist/tools/ast-tools.d.ts +183 -0
- package/dist/tools/ast-tools.js +853 -0
- package/dist/tools/browse-tool.d.ts +105 -0
- package/dist/tools/browse-tool.js +394 -0
- package/dist/tools/credential.d.ts +17 -0
- package/dist/tools/credential.js +32 -0
- package/dist/tools/dependency-graph.d.ts +23 -0
- package/dist/tools/dependency-graph.js +164 -0
- package/dist/tools/edit-tool.d.ts +34 -0
- package/dist/tools/edit-tool.js +95 -0
- package/dist/tools/file-header-manager.d.ts +27 -0
- package/dist/tools/file-header-manager.js +153 -0
- package/dist/tools/fs-tools.d.ts +154 -0
- package/dist/tools/fs-tools.js +337 -0
- package/dist/tools/git-tools.d.ts +79 -0
- package/dist/tools/git-tools.js +348 -0
- package/dist/tools/github-tool.d.ts +48 -0
- package/dist/tools/github-tool.js +147 -0
- package/dist/tools/globTool.d.ts +20 -0
- package/dist/tools/globTool.js +34 -0
- package/dist/tools/grepTool.d.ts +19 -0
- package/dist/tools/grepTool.js +44 -0
- package/dist/tools/index-freshness.d.ts +58 -0
- package/dist/tools/index-freshness.js +196 -0
- package/dist/tools/index-glob.d.ts +48 -0
- package/dist/tools/index-glob.js +175 -0
- package/dist/tools/load-skill-tool.d.ts +15 -0
- package/dist/tools/load-skill-tool.js +114 -0
- package/dist/tools/patch-tools.d.ts +58 -0
- package/dist/tools/patch-tools.js +153 -0
- package/dist/tools/playwright-tool.d.ts +66 -0
- package/dist/tools/playwright-tool.js +121 -0
- package/dist/tools/project-detect.d.ts +20 -0
- package/dist/tools/project-detect.js +87 -0
- package/dist/tools/prompt-guidance.d.ts +22 -0
- package/dist/tools/prompt-guidance.js +23 -0
- package/dist/tools/schedule-audit.d.ts +50 -0
- package/dist/tools/schedule-audit.js +124 -0
- package/dist/tools/schedule-validation.d.ts +67 -0
- package/dist/tools/schedule-validation.js +210 -0
- package/dist/tools/scheduleTool.d.ts +62 -0
- package/dist/tools/scheduleTool.js +313 -0
- package/dist/tools/search-tools.d.ts +27 -0
- package/dist/tools/search-tools.js +78 -0
- package/dist/tools/sed-tool.d.ts +66 -0
- package/dist/tools/sed-tool.js +402 -0
- package/dist/tools/shell-result.d.ts +11 -0
- package/dist/tools/shell-result.js +1 -0
- package/dist/tools/shell-tool.d.ts +45 -0
- package/dist/tools/shell-tool.js +141 -0
- package/dist/tools/siteCrawlerTool.d.ts +32 -0
- package/dist/tools/siteCrawlerTool.js +205 -0
- package/dist/tools/tool-registry.d.ts +67 -0
- package/dist/tools/tool-registry.js +606 -0
- package/dist/tools/validate-tool.d.ts +23 -0
- package/dist/tools/validate-tool.js +201 -0
- package/dist/tools/workspace-index.d.ts +46 -0
- package/dist/tools/workspace-index.js +173 -0
- package/dist/types.d.ts +222 -0
- package/dist/types.js +7 -0
- package/dist/updater/index.d.ts +14 -0
- package/dist/updater/index.js +120 -0
- package/dist/util/banner.d.ts +25 -0
- package/dist/util/banner.js +140 -0
- package/dist/util/command-suggester.d.ts +6 -0
- package/dist/util/command-suggester.js +25 -0
- package/dist/util/confirm-interrupt.d.ts +10 -0
- package/dist/util/confirm-interrupt.js +31 -0
- package/dist/util/continue-trigger.d.ts +11 -0
- package/dist/util/continue-trigger.js +20 -0
- package/dist/util/env-info.d.ts +18 -0
- package/dist/util/env-info.js +37 -0
- package/dist/util/file-access-log.d.ts +35 -0
- package/dist/util/file-access-log.js +140 -0
- package/dist/util/footer-manager.d.ts +124 -0
- package/dist/util/footer-manager.js +195 -0
- package/dist/util/footer-renderer.d.ts +67 -0
- package/dist/util/footer-renderer.js +319 -0
- package/dist/util/footer-state.d.ts +34 -0
- package/dist/util/footer-state.js +18 -0
- package/dist/util/footer-text.d.ts +51 -0
- package/dist/util/footer-text.js +74 -0
- package/dist/util/ids.d.ts +1 -0
- package/dist/util/ids.js +4 -0
- package/dist/util/levenshtein.d.ts +6 -0
- package/dist/util/levenshtein.js +34 -0
- package/dist/util/logger.d.ts +10 -0
- package/dist/util/logger.js +41 -0
- package/dist/util/logs.d.ts +80 -0
- package/dist/util/logs.js +135 -0
- package/dist/util/output-handler.d.ts +89 -0
- package/dist/util/output-handler.js +193 -0
- package/dist/util/output-interceptor.d.ts +18 -0
- package/dist/util/output-interceptor.js +49 -0
- package/dist/util/output-paths.d.ts +43 -0
- package/dist/util/output-paths.js +121 -0
- package/dist/util/package-json.d.ts +6 -0
- package/dist/util/package-json.js +36 -0
- package/dist/util/process-kill.d.ts +27 -0
- package/dist/util/process-kill.js +148 -0
- package/dist/util/protocol-error-logger.d.ts +33 -0
- package/dist/util/protocol-error-logger.js +73 -0
- package/dist/util/redact.d.ts +25 -0
- package/dist/util/redact.js +119 -0
- package/dist/util/scroll-region-guard.d.ts +33 -0
- package/dist/util/scroll-region-guard.js +63 -0
- package/dist/util/spinner.d.ts +15 -0
- package/dist/util/spinner.js +49 -0
- package/dist/util/terminal-output.d.ts +34 -0
- package/dist/util/terminal-output.js +1 -0
- package/dist/util/terminal-silent.d.ts +6 -0
- package/dist/util/terminal-silent.js +20 -0
- package/dist/util/terminal.d.ts +56 -0
- package/dist/util/terminal.js +124 -0
- package/dist/util/text-sanitize.d.ts +8 -0
- package/dist/util/text-sanitize.js +45 -0
- package/dist/util/thinking-spinner.d.ts +27 -0
- package/dist/util/thinking-spinner.js +189 -0
- package/dist/util/tool-error-logger.d.ts +33 -0
- package/dist/util/tool-error-logger.js +77 -0
- package/dist/util/tty.d.ts +13 -0
- package/dist/util/tty.js +16 -0
- package/dist/util/xcoder-paths.d.ts +56 -0
- package/dist/util/xcoder-paths.js +63 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +5 -0
- package/dist/worker-agent/to-subtask-node.d.ts +35 -0
- package/dist/worker-agent/to-subtask-node.js +41 -0
- package/dist/worker-agent/worker-orchestrator.d.ts +104 -0
- package/dist/worker-agent/worker-orchestrator.js +201 -0
- package/package.json +43 -3
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
// xcoder:version 6 | xcoder:task task-691585 | xcoder:updated 2026-11-05T05:46:07.113Z | xcoder:subtask code-st-b5251b
|
|
2
|
+
// Cross-CLI delegation seam.
|
|
3
|
+
//
|
|
4
|
+
// `xcoder jarvis <args...>` runs the real `jarvis` binary in a child process
|
|
5
|
+
// and forwards every argument verbatim. This module owns that seam and nothing
|
|
6
|
+
// else: it does not know what jarvis does, and it never interprets a child flag.
|
|
7
|
+
//
|
|
8
|
+
// Why a subprocess and not an import: boundary rule 1 (`scripts/check-boundaries.mjs`)
|
|
9
|
+
// forbids one agent importing another, and the `xcoder` bin lives in
|
|
10
|
+
// `@xcoder/sdlc-agent`. The only legal shared home for this code is this library.
|
|
11
|
+
//
|
|
12
|
+
// Why argv is pre-extracted instead of parsed by commander: commander eagerly
|
|
13
|
+
// consumes root options (`--config`, `--workspace`) it sees after a subcommand,
|
|
14
|
+
// which would silently swallow a child flag. The workspace already solves this
|
|
15
|
+
// class of problem the same way for `--config` and `--wbc` (see `wbc-arg.ts`),
|
|
16
|
+
// so delegation follows that precedent rather than adding a new parsing mode.
|
|
17
|
+
import { spawn } from "node:child_process";
|
|
18
|
+
import { existsSync } from "node:fs";
|
|
19
|
+
import path from "node:path";
|
|
20
|
+
/** The closed allowlist of agent CLIs that may be reached through `xcoder`. */
|
|
21
|
+
export const DELEGABLE_TARGETS = ["jarvis", "litebro", "bugfinder"];
|
|
22
|
+
/** Shell convention for "command not found", identical on every platform. */
|
|
23
|
+
export const EXIT_ENOENT = 127;
|
|
24
|
+
/**
|
|
25
|
+
* Interrupted. POSIX would be 128+SIGINT (130); Windows has no signal-number
|
|
26
|
+
* convention, so one deterministic, testable constant is used everywhere.
|
|
27
|
+
*/
|
|
28
|
+
export const EXIT_INTERRUPTED = 130;
|
|
29
|
+
/** The jarvis spec, shared by the `xcoder` CLI and the aggregator's DISPATCH. */
|
|
30
|
+
export const JARVIS_SPEC = {
|
|
31
|
+
target: "jarvis",
|
|
32
|
+
bin: "jarvis",
|
|
33
|
+
fallbackModule: path.join("packages", "jarvis-agent", "dist", "program.js"),
|
|
34
|
+
summary: "Jarvis — ReAct agent with scoped memory and an enforced tool allowlist",
|
|
35
|
+
};
|
|
36
|
+
const SPECS = {
|
|
37
|
+
jarvis: JARVIS_SPEC,
|
|
38
|
+
litebro: {
|
|
39
|
+
target: "litebro",
|
|
40
|
+
bin: "litebro",
|
|
41
|
+
fallbackModule: path.join("packages", "litebro", "dist", "cli.js"),
|
|
42
|
+
summary: "Litebro — tool-less planner/broker",
|
|
43
|
+
},
|
|
44
|
+
bugfinder: {
|
|
45
|
+
target: "bugfinder",
|
|
46
|
+
bin: "bugfinder",
|
|
47
|
+
fallbackModule: path.join("packages", "qa-agent", "dist", "qa-cli.js"),
|
|
48
|
+
summary: "Bugfinder — the QA agent",
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
export function isDelegableTarget(name) {
|
|
52
|
+
return DELEGABLE_TARGETS.includes(name);
|
|
53
|
+
}
|
|
54
|
+
/** The spec for an allowlisted target, or `undefined` for anything else. */
|
|
55
|
+
export function delegateSpec(target) {
|
|
56
|
+
return isDelegableTarget(target) ? SPECS[target] : undefined;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Resolve what to execute.
|
|
60
|
+
*
|
|
61
|
+
* The workspace build is tried first so a developer running from a checkout gets
|
|
62
|
+
* the code they just built; PATH is the declared fallback once published. The
|
|
63
|
+
* choice is returned so callers can log it (Spoofing control, design T4).
|
|
64
|
+
*/
|
|
65
|
+
export function resolveDelegateCommand(spec, cwd) {
|
|
66
|
+
const local = path.resolve(cwd, spec.fallbackModule);
|
|
67
|
+
if (existsSync(local))
|
|
68
|
+
return { command: process.execPath, argv: [local] };
|
|
69
|
+
return { command: spec.bin, argv: [] };
|
|
70
|
+
}
|
|
71
|
+
function validTargetsMessage() {
|
|
72
|
+
return `valid targets: ${DELEGABLE_TARGETS.join(", ")}`;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Run the child with `argv` verbatim and return the code the parent must exit with.
|
|
76
|
+
*
|
|
77
|
+
* Never builds a command string, never parses, normalises, reorders or drops an
|
|
78
|
+
* argument, and never throws for an expected condition (spawn failure → 1).
|
|
79
|
+
*/
|
|
80
|
+
export async function runDelegated(spec, argv, deps = {}) {
|
|
81
|
+
const stderr = deps.stderr ?? process.stderr;
|
|
82
|
+
if (!isDelegableTarget(spec.target)) {
|
|
83
|
+
stderr.write(`xcoder: '${spec.target}' is not a delegable target — ${validTargetsMessage()}\n`);
|
|
84
|
+
return 1;
|
|
85
|
+
}
|
|
86
|
+
const cwd = deps.cwd ?? process.cwd();
|
|
87
|
+
const resolve = deps.resolveBin ?? ((s, c) => resolveDelegateCommand(s, c));
|
|
88
|
+
const launch = resolve(spec, cwd);
|
|
89
|
+
if (launch === null) {
|
|
90
|
+
stderr.write(`xcoder: cannot find '${spec.bin}' — install it or build the workspace (${spec.fallbackModule}). ${validTargetsMessage()}\n`);
|
|
91
|
+
return EXIT_ENOENT;
|
|
92
|
+
}
|
|
93
|
+
if (deps.env?.XCODER_DELEGATE_VERBOSE ?? process.env.XCODER_DELEGATE_VERBOSE) {
|
|
94
|
+
// Counts and identifiers only: never the arguments themselves (no task text,
|
|
95
|
+
// no PII), never the environment.
|
|
96
|
+
stderr.write(`xcoder: delegating to ${spec.target} via ${launch.command} (${argv.length} argument${argv.length === 1 ? "" : "s"})\n`);
|
|
97
|
+
}
|
|
98
|
+
const spawnFn = deps.spawn ?? spawn;
|
|
99
|
+
const env = deps.env ?? process.env;
|
|
100
|
+
return new Promise((resolvePromise) => {
|
|
101
|
+
let child;
|
|
102
|
+
try {
|
|
103
|
+
child = spawnFn(launch.command, [...launch.argv, ...argv], {
|
|
104
|
+
cwd,
|
|
105
|
+
env,
|
|
106
|
+
stdio: "inherit",
|
|
107
|
+
shell: false,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
catch (err) {
|
|
111
|
+
// Fail closed: a delegation that never started is not a success.
|
|
112
|
+
stderr.write(`xcoder: failed to start '${spec.bin}': ${err.message}\n`);
|
|
113
|
+
resolvePromise(1);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const forward = (signal) => {
|
|
117
|
+
try {
|
|
118
|
+
child.kill(signal);
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
// The child is already gone; the exit handler owns the outcome.
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
const onSigint = () => forward("SIGINT");
|
|
125
|
+
const onSigterm = () => forward("SIGTERM");
|
|
126
|
+
process.on("SIGINT", onSigint);
|
|
127
|
+
process.on("SIGTERM", onSigterm);
|
|
128
|
+
const settle = (code) => {
|
|
129
|
+
process.off("SIGINT", onSigint);
|
|
130
|
+
process.off("SIGTERM", onSigterm);
|
|
131
|
+
resolvePromise(code);
|
|
132
|
+
};
|
|
133
|
+
child.once("error", (err) => {
|
|
134
|
+
if (err.code === "ENOENT") {
|
|
135
|
+
stderr.write(`xcoder: cannot find '${spec.bin}' — ${validTargetsMessage()}\n`);
|
|
136
|
+
settle(EXIT_ENOENT);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
stderr.write(`xcoder: '${spec.bin}' failed to start: ${err.message}\n`);
|
|
140
|
+
settle(1);
|
|
141
|
+
});
|
|
142
|
+
child.once("exit", (code, _signal) => {
|
|
143
|
+
if (code !== null) {
|
|
144
|
+
// The child's own exit code is the parent's, unchanged (0/1/2 all pass through).
|
|
145
|
+
settle(code);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
settle(EXIT_INTERRUPTED);
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Register `<target> [args...]` on `parent` with pure passthrough semantics.
|
|
154
|
+
*
|
|
155
|
+
* Registering makes the target discoverable in `xcoder --help`. Argument
|
|
156
|
+
* handling belongs to `extractDelegatedArg`, because commander would otherwise
|
|
157
|
+
* consume root options that the child legitimately accepts.
|
|
158
|
+
*/
|
|
159
|
+
export function registerDelegatedCommand(parent, spec) {
|
|
160
|
+
parent
|
|
161
|
+
.command(`${spec.target} [args...]`)
|
|
162
|
+
.description(`${spec.summary}. Every argument is forwarded verbatim.`)
|
|
163
|
+
.helpOption(false)
|
|
164
|
+
.allowUnknownOption(true)
|
|
165
|
+
.allowExcessArguments(true)
|
|
166
|
+
.action(async (_args, _opts, cmd) => {
|
|
167
|
+
const code = await runDelegated(spec, cmd.args);
|
|
168
|
+
process.exitCode = code;
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Root options that take a value, so their value is never mistaken for a target.
|
|
173
|
+
*
|
|
174
|
+
* Closed on purpose: a wildcard here would let any argument become a command,
|
|
175
|
+
* and dropping an entry here would make `xcoder -task jarvis` run the `jarvis`
|
|
176
|
+
* binary instead of a task called "jarvis". Options with an *optional* value
|
|
177
|
+
* (`--resume`, `--debug-tools`) are listed too: their value can look exactly
|
|
178
|
+
* like a target, so the conservative reading is "do not delegate".
|
|
179
|
+
*/
|
|
180
|
+
const ROOT_OPTIONS_WITH_VALUE = new Set([
|
|
181
|
+
"--config",
|
|
182
|
+
"-w",
|
|
183
|
+
"--workspace",
|
|
184
|
+
"--wbc",
|
|
185
|
+
"--wbs",
|
|
186
|
+
"-task",
|
|
187
|
+
"--task",
|
|
188
|
+
"--design",
|
|
189
|
+
"--code",
|
|
190
|
+
"--defect",
|
|
191
|
+
"--budget",
|
|
192
|
+
"--max-healing",
|
|
193
|
+
"-c",
|
|
194
|
+
"--concurrency",
|
|
195
|
+
"--model",
|
|
196
|
+
"--spinner",
|
|
197
|
+
"--resume",
|
|
198
|
+
"--debug-tools",
|
|
199
|
+
]);
|
|
200
|
+
/**
|
|
201
|
+
* Detect a delegation from raw argv, before commander sees anything.
|
|
202
|
+
*
|
|
203
|
+
* Returns `undefined` for every ordinary invocation, so existing commands are
|
|
204
|
+
* parsed exactly as before. When a target is found, everything after it is
|
|
205
|
+
* returned untouched — the parent never validates a child flag.
|
|
206
|
+
*/
|
|
207
|
+
export function extractDelegatedArg(argv) {
|
|
208
|
+
for (let i = 2; i < argv.length; i++) {
|
|
209
|
+
const token = argv[i];
|
|
210
|
+
if (ROOT_OPTIONS_WITH_VALUE.has(token)) {
|
|
211
|
+
i++; // skip this option's value
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
if (token.startsWith("-"))
|
|
215
|
+
continue;
|
|
216
|
+
const spec = delegateSpec(token);
|
|
217
|
+
return spec ? { spec, args: argv.slice(i + 1), index: i } : undefined;
|
|
218
|
+
}
|
|
219
|
+
return undefined;
|
|
220
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
/**
|
|
3
|
+
* Register the `xcoder swarm` subcommand.
|
|
4
|
+
*
|
|
5
|
+
* Runs an instance swarm: multiple SubAgents dispatched concurrently
|
|
6
|
+
* against a goal, with a protocol section injected from wks_protocol.md.
|
|
7
|
+
* Includes a master spinner for the overall run, per-worker lifecycle
|
|
8
|
+
* callbacks, and a color-coded summary printed on completion.
|
|
9
|
+
*/
|
|
10
|
+
export declare function registerSwarmCommand(parent: Command): void;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { createLlmClient } from "../llm/factory.js";
|
|
3
|
+
import { InstanceSwarmOrchestrator, } from "../instance-swarm/instance-swarm-orchestrator.js";
|
|
4
|
+
import { getOrBuildIndex } from "../tools/workspace-index.js";
|
|
5
|
+
import { log } from "../util/logger.js";
|
|
6
|
+
import { createSpinner } from "../util/spinner.js";
|
|
7
|
+
import { printSwarmSummary } from "../util/terminal.js";
|
|
8
|
+
/**
|
|
9
|
+
* Register the `xcoder swarm` subcommand.
|
|
10
|
+
*
|
|
11
|
+
* Runs an instance swarm: multiple SubAgents dispatched concurrently
|
|
12
|
+
* against a goal, with a protocol section injected from wks_protocol.md.
|
|
13
|
+
* Includes a master spinner for the overall run, per-worker lifecycle
|
|
14
|
+
* callbacks, and a color-coded summary printed on completion.
|
|
15
|
+
*/
|
|
16
|
+
export function registerSwarmCommand(parent) {
|
|
17
|
+
parent
|
|
18
|
+
.command("swarm <goal...>")
|
|
19
|
+
.description("Run an instance swarm: multiple SubAgents dispatched concurrently against a goal, with a protocol section injected.")
|
|
20
|
+
.option("--protocol <name>", "protocol name (coder, tester, architect, ui-ux, secops, devops)")
|
|
21
|
+
.option("-m, --model <name>", "override the LLM model (default: env XCODER_MODEL or deepseek-chat)")
|
|
22
|
+
.option("-w, --workspace <dir>", "workspace root", process.cwd())
|
|
23
|
+
.option("--concurrency <n>", "number of concurrent SubAgents", "1")
|
|
24
|
+
.option("--max-iterations <n>", "max iterations per SubAgent", "200")
|
|
25
|
+
.action(async (goalParts, opts) => {
|
|
26
|
+
const root = path.resolve(opts.workspace);
|
|
27
|
+
const goal = goalParts.join(" ");
|
|
28
|
+
if (!opts.protocol) {
|
|
29
|
+
log.fail("--protocol is required (coder, tester, architect, ui-ux, secops, devops)");
|
|
30
|
+
process.exitCode = 1;
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
await getOrBuildIndex(root);
|
|
34
|
+
let llm;
|
|
35
|
+
try {
|
|
36
|
+
llm = createLlmClient("instance_agent", { model: opts.model });
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
log.fail(e.message);
|
|
40
|
+
process.exitCode = 1;
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const concurrency = parseInt(opts.concurrency, 10);
|
|
44
|
+
const maxIterations = parseInt(opts.maxIterations, 10);
|
|
45
|
+
log.dim(`swarm goal: ${goal}`);
|
|
46
|
+
log.dim(`protocol: ${opts.protocol} concurrency: ${concurrency}`);
|
|
47
|
+
// ── Master spinner: keeps the CLI alive while workers run ──
|
|
48
|
+
const spinner = createSpinner(`Dispatching swarm (${concurrency} worker${concurrency > 1 ? "s" : ""})…`);
|
|
49
|
+
const orchestrator = new InstanceSwarmOrchestrator({
|
|
50
|
+
workspaceRoot: root,
|
|
51
|
+
llm,
|
|
52
|
+
concurrency,
|
|
53
|
+
maxIterations,
|
|
54
|
+
hooks: {
|
|
55
|
+
onWorkerStart: (_wi, workerId) => {
|
|
56
|
+
spinner.stop(`Worker started: ${workerId}`);
|
|
57
|
+
// Re-start the spinner for the next wait
|
|
58
|
+
spinner.stop(`Dispatching swarm (${concurrency} worker${concurrency > 1 ? "s" : ""})…`);
|
|
59
|
+
},
|
|
60
|
+
onWorkerFinish: (_wi, workerId, crashed, summary) => {
|
|
61
|
+
const preview = summary.length > 80 ? summary.slice(0, 77) + "..." : summary;
|
|
62
|
+
const icon = crashed ? "✗" : "✓";
|
|
63
|
+
const color = crashed
|
|
64
|
+
? log.fail.bind(log)
|
|
65
|
+
: log.ok.bind(log);
|
|
66
|
+
// Temporarily stop the spinner to print the worker result,
|
|
67
|
+
// then we'll print a final summary at the end.
|
|
68
|
+
spinner.stop(`${icon} ${workerId}: ${preview}`);
|
|
69
|
+
},
|
|
70
|
+
onWorkerError: (_wi, workerId, error) => {
|
|
71
|
+
log.fail(`Worker ${workerId} error: ${error}`);
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
let swarmResult;
|
|
76
|
+
try {
|
|
77
|
+
swarmResult = await orchestrator.run(goal, opts.protocol);
|
|
78
|
+
}
|
|
79
|
+
catch (e) {
|
|
80
|
+
spinner.fail(`swarm orchestration failed: ${e.message}`);
|
|
81
|
+
process.exitCode = 1;
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
spinner.stop("Swarm complete.");
|
|
85
|
+
// ── Color-coded summary ──
|
|
86
|
+
printSwarmSummary({
|
|
87
|
+
instanceId: swarmResult.instanceId,
|
|
88
|
+
status: swarmResult.status,
|
|
89
|
+
errors: swarmResult.errors,
|
|
90
|
+
workerCount: swarmResult.results.length,
|
|
91
|
+
crashedCount: swarmResult.results.filter((r) => r.result.crashed).length,
|
|
92
|
+
totalInputTokens: swarmResult.totalTokenUsage.inputTokens,
|
|
93
|
+
totalOutputTokens: swarmResult.totalTokenUsage.outputTokens,
|
|
94
|
+
outputDir: swarmResult.outputDir,
|
|
95
|
+
});
|
|
96
|
+
if (swarmResult.status === "failed") {
|
|
97
|
+
process.exitCode = 1;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
/**
|
|
3
|
+
* Register the `xcoder task` subcommand tree:
|
|
4
|
+
*
|
|
5
|
+
* xcoder task add --from <path> [--force]
|
|
6
|
+
* xcoder task list
|
|
7
|
+
* xcoder task scan [--dir <path>] [--dry-run] [--json] [--force]
|
|
8
|
+
*
|
|
9
|
+
* `add` and `scan` record intent and exit 0 without running anything or
|
|
10
|
+
* spending a single token. For both, exit 1 is a hard failure; 2 and 3 stay
|
|
11
|
+
* reserved for escalated and halted *runs*, which ingestion never produces.
|
|
12
|
+
* Skips and unchanged files are a successful scan, not a failure.
|
|
13
|
+
*/
|
|
14
|
+
export declare function registerTaskCommand(parent: Command): void;
|
package/dist/cli/task.js
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// xcoder:version 5 | xcoder:task task-cee5a1 | xcoder:updated 2026-10-23T12:58:17.067Z | xcoder:subtask code-st-f13216
|
|
2
|
+
// `xcoder task` — ingest scannable task runs from markdown/WBS sources.
|
|
3
|
+
//
|
|
4
|
+
// Registered the same way as `swarm` and `test`: one exported
|
|
5
|
+
// `register...Command(parent)` so `sdlc-cli.ts` stays a thin composition root.
|
|
6
|
+
// All real work lives in `src/task-ingest/` — these actions only translate
|
|
7
|
+
// results into exit codes and sanitized terminal output.
|
|
8
|
+
import path from "node:path";
|
|
9
|
+
import { ingestTask, listIngestedTasks, scanMarkdownTasks } from "../task-ingest/index.js";
|
|
10
|
+
import { sanitizeForTerminal } from "../util/text-sanitize.js";
|
|
11
|
+
import { log } from "../util/logger.js";
|
|
12
|
+
function workspaceRoot(parent) {
|
|
13
|
+
return path.resolve(parent.opts().workspace ?? process.cwd());
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Register the `xcoder task` subcommand tree:
|
|
17
|
+
*
|
|
18
|
+
* xcoder task add --from <path> [--force]
|
|
19
|
+
* xcoder task list
|
|
20
|
+
* xcoder task scan [--dir <path>] [--dry-run] [--json] [--force]
|
|
21
|
+
*
|
|
22
|
+
* `add` and `scan` record intent and exit 0 without running anything or
|
|
23
|
+
* spending a single token. For both, exit 1 is a hard failure; 2 and 3 stay
|
|
24
|
+
* reserved for escalated and halted *runs*, which ingestion never produces.
|
|
25
|
+
* Skips and unchanged files are a successful scan, not a failure.
|
|
26
|
+
*/
|
|
27
|
+
export function registerTaskCommand(parent) {
|
|
28
|
+
const taskCmd = parent
|
|
29
|
+
.command("task")
|
|
30
|
+
.description("Manage task runs that are scannable by status/incomplete/resume.");
|
|
31
|
+
taskCmd
|
|
32
|
+
.command("add")
|
|
33
|
+
.description("Create a scannable task run from a markdown/WBS source file. Records intent only — it does not run the task.")
|
|
34
|
+
.requiredOption("--from <path>", "workspace-relative path to the source file")
|
|
35
|
+
.option("--force", "replace a task that already has completed or in-flight subtasks", false)
|
|
36
|
+
.action(async (opts) => {
|
|
37
|
+
const root = workspaceRoot(parent);
|
|
38
|
+
const result = await ingestTask({
|
|
39
|
+
workspaceRoot: root,
|
|
40
|
+
from: opts.from,
|
|
41
|
+
force: opts.force === true,
|
|
42
|
+
});
|
|
43
|
+
if (!result.ok) {
|
|
44
|
+
log.fail(`${result.code}: ${sanitizeForTerminal(result.message, 300)}`);
|
|
45
|
+
process.exitCode = 1;
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const verb = result.created ? "created" : "unchanged";
|
|
49
|
+
const source = sanitizeForTerminal(result.sourcePath, 80);
|
|
50
|
+
const count = `${result.nodeCount} subtask${result.nodeCount === 1 ? "" : "s"}, first: ${result.firstStage}`;
|
|
51
|
+
log.ok(`${verb} ${result.taskId} from ${source} (${count})`);
|
|
52
|
+
log.raw(`next: ${result.nextCommand}`);
|
|
53
|
+
});
|
|
54
|
+
taskCmd
|
|
55
|
+
.command("list")
|
|
56
|
+
.description("List task runs and the source file each was ingested from.")
|
|
57
|
+
.action(async () => {
|
|
58
|
+
const root = workspaceRoot(parent);
|
|
59
|
+
const tasks = await listIngestedTasks(root);
|
|
60
|
+
if (!tasks.length) {
|
|
61
|
+
log.ok(`no task runs found in ${root}`);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const header = `${"TASK ID".padEnd(16)} ${"STATUS".padEnd(12)} ${"N".padEnd(4)} ${"SOURCE".padEnd(32)} GOAL`;
|
|
65
|
+
log.raw(header);
|
|
66
|
+
log.raw("-".repeat(header.length));
|
|
67
|
+
for (const t of tasks) {
|
|
68
|
+
const source = t.sourcePath ?? "(free-text)";
|
|
69
|
+
log.raw(`${t.taskId.padEnd(16)} ${t.status.padEnd(12)} ${String(t.nodeCount).padEnd(4)} ${sanitizeForTerminal(source, 32).padEnd(32)} ${sanitizeForTerminal(t.goal, 48)}`);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
taskCmd
|
|
73
|
+
.command("scan")
|
|
74
|
+
.description("Discover .md task files in a directory and ingest each one. Skips progress summaries and non-task files.")
|
|
75
|
+
.option("--dir <path>", "directory to scan (defaults to the task store directory)")
|
|
76
|
+
.option("--dry-run", "report what would be ingested without writing anything", false)
|
|
77
|
+
.option("--force", "replace tasks that already have completed or in-flight subtasks", false)
|
|
78
|
+
.option("--json", "machine output: the scan report only, no prose", false)
|
|
79
|
+
.action(async (opts) => {
|
|
80
|
+
const root = workspaceRoot(parent);
|
|
81
|
+
const result = await scanMarkdownTasks({
|
|
82
|
+
workspaceRoot: root,
|
|
83
|
+
dir: opts.dir,
|
|
84
|
+
dryRun: opts.dryRun === true,
|
|
85
|
+
force: opts.force === true,
|
|
86
|
+
});
|
|
87
|
+
if (opts.json === true) {
|
|
88
|
+
log.raw(JSON.stringify(result, null, 2));
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
const mode = opts.dryRun === true ? " (dry run)" : "";
|
|
92
|
+
log.raw(`scanned ${sanitizeForTerminal(result.dir, 120)}${mode} — ${result.scanned} markdown file(s)`);
|
|
93
|
+
for (const o of result.created) {
|
|
94
|
+
log.ok(`would create/created ${o.taskId ?? "?"} from ${sanitizeForTerminal(o.sourcePath, 100)}`);
|
|
95
|
+
}
|
|
96
|
+
for (const o of result.unchanged) {
|
|
97
|
+
log.dim(`unchanged ${o.taskId ?? "?"} from ${sanitizeForTerminal(o.sourcePath, 100)}`);
|
|
98
|
+
}
|
|
99
|
+
for (const o of result.skipped) {
|
|
100
|
+
log.dim(`skipped ${sanitizeForTerminal(o.sourcePath, 100)} (${o.reason ?? "skipped"})`);
|
|
101
|
+
}
|
|
102
|
+
for (const o of result.failed) {
|
|
103
|
+
log.fail(`failed ${sanitizeForTerminal(o.sourcePath, 100)} ${o.code ?? "error"}: ${sanitizeForTerminal(o.message ?? "", 200)}`);
|
|
104
|
+
}
|
|
105
|
+
if (result.dirError) {
|
|
106
|
+
log.fail(`${result.dirError.code}: ${sanitizeForTerminal(result.dirError.message, 300)}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// Exit 1 only for a hard failure: the directory itself was unusable, or
|
|
110
|
+
// every candidate that looked like a task failed. Skips and unchanged
|
|
111
|
+
// files are a successful scan. 2 and 3 stay reserved for escalated and
|
|
112
|
+
// halted *runs*.
|
|
113
|
+
if (result.dirError) {
|
|
114
|
+
process.exitCode = 1;
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (result.failed.length > 0 && result.created.length === 0 && result.unchanged.length === 0) {
|
|
118
|
+
process.exitCode = 1;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// xcoder:version 1 | xcoder:task task-7a4850 | xcoder:updated 2026-10-25T16:26:45.781Z | xcoder:subtask code-st-892a22
|
|
2
|
+
// C1 — pure argv pre-extractor for the root-level `--wbc <file>` flag.
|
|
3
|
+
//
|
|
4
|
+
// `xcoder --wbc foo.md` has NO subcommand, so commander would reject it with
|
|
5
|
+
// `commander.unknownCommand` (exit 127). The workspace already solves this class
|
|
6
|
+
// of problem for `--config` by rewriting `process.argv` before
|
|
7
|
+
// `program.parseAsync()` (see `extractConfigArg` in config/user-config.ts); this
|
|
8
|
+
// follows that precedent exactly rather than adding a root positional argument,
|
|
9
|
+
// which would change how every argument-less invocation is parsed.
|
|
10
|
+
//
|
|
11
|
+
// Never touches the filesystem, never throws. Path validation and workspace
|
|
12
|
+
// confinement are C3's job (via C9), so there is exactly one confinement
|
|
13
|
+
// implementation.
|
|
14
|
+
const FLAGS = ["--wbc", "--wbs"];
|
|
15
|
+
export function extractWbcArg(argv) {
|
|
16
|
+
const rest = argv.slice(0, 2);
|
|
17
|
+
let value;
|
|
18
|
+
let error;
|
|
19
|
+
for (let i = 2; i < argv.length; i++) {
|
|
20
|
+
const arg = argv[i];
|
|
21
|
+
const inline = FLAGS.find((f) => arg.startsWith(`${f}=`));
|
|
22
|
+
if (inline) {
|
|
23
|
+
value = arg.slice(inline.length + 1);
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
if (FLAGS.includes(arg)) {
|
|
27
|
+
const next = argv[i + 1];
|
|
28
|
+
if (next === undefined || next.startsWith("--")) {
|
|
29
|
+
return { argv, error: "--wbc requires a path to a WBS file" };
|
|
30
|
+
}
|
|
31
|
+
value = next;
|
|
32
|
+
i++;
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
rest.push(arg);
|
|
36
|
+
}
|
|
37
|
+
if (error)
|
|
38
|
+
return { argv, error };
|
|
39
|
+
return { argv: rest, value };
|
|
40
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
export interface WbcCliOptions {
|
|
3
|
+
wbc: string;
|
|
4
|
+
/** --dry-run: print the plan, write nothing. */
|
|
5
|
+
dryRun?: boolean;
|
|
6
|
+
/** --force: replace a record that already has progress. */
|
|
7
|
+
force?: boolean;
|
|
8
|
+
/** --no-architect: deterministic, zero-token content. */
|
|
9
|
+
noArchitect?: boolean;
|
|
10
|
+
/** --max-items <n>, clamped to MAX_ITEMS (200). */
|
|
11
|
+
maxItems?: number;
|
|
12
|
+
/** Default 3, clamped 1..8. */
|
|
13
|
+
concurrency?: number;
|
|
14
|
+
/** Passed through to createLlmClient. */
|
|
15
|
+
model?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function setWbcSourcePath(value: string | undefined): void;
|
|
18
|
+
/** The path captured from argv, or undefined when `--wbc` was not given. */
|
|
19
|
+
export declare function capturedWbc(): string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Root-level flags for the feature. Declared here so the help text and the
|
|
22
|
+
* option list live in one file; the composition root applies them.
|
|
23
|
+
*/
|
|
24
|
+
export declare const WBC_OPTIONS: ReadonlyArray<readonly [string, string]>;
|
|
25
|
+
/** Applies the feature's root flags to `program`. */
|
|
26
|
+
export declare function registerWbcFlag(program: Command): void;
|
|
27
|
+
/**
|
|
28
|
+
* Runs the extraction and translates the result into an exit code and
|
|
29
|
+
* sanitised terminal output. Every attacker-influenced string goes through
|
|
30
|
+
* `sanitizeForTerminal` (C14) on the way to the terminal only.
|
|
31
|
+
*/
|
|
32
|
+
export declare function runWbcCli(opts: WbcCliOptions, workspaceRoot: string): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Root-action branch: runs the extraction when `--wbc` was captured and
|
|
35
|
+
* reports whether it handled the invocation (so the caller can return early).
|
|
36
|
+
*/
|
|
37
|
+
export declare function runCapturedWbc(opts: {
|
|
38
|
+
workspace: string;
|
|
39
|
+
dryRun?: boolean;
|
|
40
|
+
force?: boolean;
|
|
41
|
+
architect?: boolean;
|
|
42
|
+
maxItems?: unknown;
|
|
43
|
+
concurrency?: unknown;
|
|
44
|
+
model?: string;
|
|
45
|
+
}): Promise<boolean>;
|
package/dist/cli/wbc.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// xcoder:version 3 | xcoder:task task-7a4850 | xcoder:updated 2026-10-25T16:40:07.741Z | xcoder:subtask code-st-892a22
|
|
2
|
+
// C2 — the root-command surface for `xcoder --wbc <file>`.
|
|
3
|
+
//
|
|
4
|
+
// `--wbc` is declared on the ROOT command (the same block that owns
|
|
5
|
+
// `--workspace`, `--concurrency` and `--model`), so it shows up in
|
|
6
|
+
// `xcoder --help` and reuses those globals rather than declaring a second set
|
|
7
|
+
// of conflicting flags. `--wbc` itself is lifted out of argv by
|
|
8
|
+
// `extractWbcArg()` before `program.parseAsync()` (C1); the captured path is
|
|
9
|
+
// handed in through `setWbcSourcePath()` and consumed inside the root action.
|
|
10
|
+
import { extractWbsTasks } from "../task-ingest/wbs-extract.js";
|
|
11
|
+
import { sanitizeForTerminal } from "../util/text-sanitize.js";
|
|
12
|
+
import { log } from "../util/logger.js";
|
|
13
|
+
/** Set by the composition root after `extractWbcArg()` captures the value. */
|
|
14
|
+
let capturedWbcPath;
|
|
15
|
+
export function setWbcSourcePath(value) {
|
|
16
|
+
capturedWbcPath = value;
|
|
17
|
+
}
|
|
18
|
+
/** The path captured from argv, or undefined when `--wbc` was not given. */
|
|
19
|
+
export function capturedWbc() {
|
|
20
|
+
return capturedWbcPath;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Root-level flags for the feature. Declared here so the help text and the
|
|
24
|
+
* option list live in one file; the composition root applies them.
|
|
25
|
+
*/
|
|
26
|
+
export const WBC_OPTIONS = [
|
|
27
|
+
["--wbc <path>", "with a WBS file: extract every pending item into its own scannable task run"],
|
|
28
|
+
["--dry-run", "with --wbc: print the extraction plan and write nothing"],
|
|
29
|
+
["--force", "with --wbc: replace task records that already have progress"],
|
|
30
|
+
["--max-items <n>", "with --wbc: extract at most <n> pending items (default 50, max 200)"],
|
|
31
|
+
["--no-architect", "with --wbc: use deterministic task content, spending zero tokens"],
|
|
32
|
+
];
|
|
33
|
+
/** Applies the feature's root flags to `program`. */
|
|
34
|
+
export function registerWbcFlag(program) {
|
|
35
|
+
for (const [flags, description] of WBC_OPTIONS)
|
|
36
|
+
program.option(flags, description);
|
|
37
|
+
}
|
|
38
|
+
/** Commander leaves option values as strings; NaN is passed through so the
|
|
39
|
+
* orchestrator reports `bad-options` rather than silently defaulting. */
|
|
40
|
+
function numeric(value) {
|
|
41
|
+
if (value === undefined)
|
|
42
|
+
return undefined;
|
|
43
|
+
return Number(value);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Runs the extraction and translates the result into an exit code and
|
|
47
|
+
* sanitised terminal output. Every attacker-influenced string goes through
|
|
48
|
+
* `sanitizeForTerminal` (C14) on the way to the terminal only.
|
|
49
|
+
*/
|
|
50
|
+
export async function runWbcCli(opts, workspaceRoot) {
|
|
51
|
+
const result = await extractWbsTasks({
|
|
52
|
+
workspaceRoot,
|
|
53
|
+
from: opts.wbc,
|
|
54
|
+
dryRun: opts.dryRun === true,
|
|
55
|
+
force: opts.force === true,
|
|
56
|
+
detailer: opts.noArchitect === true ? null : undefined,
|
|
57
|
+
maxItems: opts.maxItems,
|
|
58
|
+
concurrency: opts.concurrency,
|
|
59
|
+
});
|
|
60
|
+
if (!result.ok) {
|
|
61
|
+
const where = result.line === undefined ? "" : ` (line ${result.line})`;
|
|
62
|
+
log.fail(`${result.code}${where}: ${sanitizeForTerminal(result.message, 300)}`);
|
|
63
|
+
process.exitCode = 1;
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (result.tasks.length === 0) {
|
|
67
|
+
log.ok(`no pending items — nothing to extract from ${sanitizeForTerminal(result.sourcePath, 100)}`);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
for (const task of result.tasks) {
|
|
71
|
+
const verb = task.created ? (result.dryRun ? "would create" : "created") : "unchanged";
|
|
72
|
+
log.raw(`${verb} ${task.taskId} ${sanitizeForTerminal(result.sourcePath, 60)}:${task.line} ` +
|
|
73
|
+
`${sanitizeForTerminal(task.stages.join(">"), 60)} resume: ${task.nextCommand}`);
|
|
74
|
+
}
|
|
75
|
+
const c = result.counts;
|
|
76
|
+
const prefix = result.dryRun ? "dry run — would extract" : "extracted";
|
|
77
|
+
log.dim(`${prefix} ${result.tasks.length} task(s) from ${sanitizeForTerminal(result.sourcePath, 100)} — ` +
|
|
78
|
+
`${c.created} created, ${c.unchanged} unchanged, ${c.checked} checked skipped, ${c.superseded} superseded`);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Root-action branch: runs the extraction when `--wbc` was captured and
|
|
82
|
+
* reports whether it handled the invocation (so the caller can return early).
|
|
83
|
+
*/
|
|
84
|
+
export async function runCapturedWbc(opts) {
|
|
85
|
+
const from = capturedWbc();
|
|
86
|
+
if (from === undefined)
|
|
87
|
+
return false;
|
|
88
|
+
await runWbcCli({
|
|
89
|
+
wbc: from,
|
|
90
|
+
dryRun: opts.dryRun === true,
|
|
91
|
+
force: opts.force === true,
|
|
92
|
+
noArchitect: opts.architect === false,
|
|
93
|
+
maxItems: numeric(opts.maxItems),
|
|
94
|
+
concurrency: numeric(opts.concurrency),
|
|
95
|
+
model: opts.model,
|
|
96
|
+
}, opts.workspace);
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import { type LicenseApi } from "../license/http-client.js";
|
|
3
|
+
import { type LicenseManager } from "../license/manager.js";
|
|
4
|
+
/** Test seam: the registrar accepts injected dependencies. */
|
|
5
|
+
export interface LicenseCommandDeps {
|
|
6
|
+
manager?: LicenseManager;
|
|
7
|
+
api?: LicenseApi;
|
|
8
|
+
}
|
|
9
|
+
export declare function registerLicenseCommand(program: Command, deps?: LicenseCommandDeps): void;
|