@claude-flow/cli 3.32.29 → 3.32.32
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/.claude/helpers/helpers.manifest.json +2 -2
- package/catalog-manifest.json +2 -2
- package/dist/src/autopilot-state.d.ts +10 -0
- package/dist/src/autopilot-state.js +16 -0
- package/dist/src/commands/autopilot.js +10 -4
- package/dist/src/init/claudemd-generator.js +53 -2
- package/dist/src/mcp-tools/autopilot-tools.js +18 -3
- package/dist/src/mcp-tools/capability-brain.js +22 -22
- package/dist/src/mcp-tools/guidance-tools.js +1 -1
- package/dist/src/services/harness-flywheel-runtime.d.ts +21 -1
- package/dist/src/services/harness-flywheel-runtime.js +46 -24
- package/node_modules/@claude-flow/codex/.agents/skills/memory-management/SKILL.md +45 -0
- package/node_modules/@claude-flow/codex/.agents/skills/security-audit/SKILL.md +46 -0
- package/node_modules/@claude-flow/codex/.agents/skills/sparc-methodology/SKILL.md +46 -0
- package/node_modules/@claude-flow/codex/.agents/skills/swarm-orchestration/SKILL.md +53 -0
- package/node_modules/@claude-flow/codex/README.md +1044 -0
- package/node_modules/@claude-flow/codex/dist/cli.d.ts +9 -0
- package/node_modules/@claude-flow/codex/dist/cli.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/cli.js +686 -0
- package/node_modules/@claude-flow/codex/dist/cli.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/cli.d.ts +17 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/cli.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/cli.js +278 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/cli.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/index.d.ts +8 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/index.js +7 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.d.ts +143 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.js +621 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/agents-md.d.ts +12 -0
- package/node_modules/@claude-flow/codex/dist/generators/agents-md.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/agents-md.js +730 -0
- package/node_modules/@claude-flow/codex/dist/generators/agents-md.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/config-toml.d.ts +74 -0
- package/node_modules/@claude-flow/codex/dist/generators/config-toml.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/config-toml.js +922 -0
- package/node_modules/@claude-flow/codex/dist/generators/config-toml.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/index.d.ts +9 -0
- package/node_modules/@claude-flow/codex/dist/generators/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/index.js +9 -0
- package/node_modules/@claude-flow/codex/dist/generators/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/skill-md.d.ts +20 -0
- package/node_modules/@claude-flow/codex/dist/generators/skill-md.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/skill-md.js +951 -0
- package/node_modules/@claude-flow/codex/dist/generators/skill-md.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/build-evidence.d.ts +46 -0
- package/node_modules/@claude-flow/codex/dist/harness/build-evidence.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/build-evidence.js +126 -0
- package/node_modules/@claude-flow/codex/dist/harness/build-evidence.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/contract.d.ts +153 -0
- package/node_modules/@claude-flow/codex/dist/harness/contract.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/contract.js +44 -0
- package/node_modules/@claude-flow/codex/dist/harness/contract.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.d.ts +33 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.js +175 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.d.ts +42 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.js +140 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.d.ts +19 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.js +79 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/index.d.ts +9 -0
- package/node_modules/@claude-flow/codex/dist/harness/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/index.js +9 -0
- package/node_modules/@claude-flow/codex/dist/harness/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.d.ts +8 -0
- package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.js +10 -0
- package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/repository-state.d.ts +68 -0
- package/node_modules/@claude-flow/codex/dist/harness/repository-state.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/repository-state.js +403 -0
- package/node_modules/@claude-flow/codex/dist/harness/repository-state.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.d.ts +3 -0
- package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.js +14 -0
- package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/index.d.ts +53 -0
- package/node_modules/@claude-flow/codex/dist/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/index.js +54 -0
- package/node_modules/@claude-flow/codex/dist/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/initializer.d.ts +98 -0
- package/node_modules/@claude-flow/codex/dist/initializer.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/initializer.js +795 -0
- package/node_modules/@claude-flow/codex/dist/initializer.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/loop/cli.d.ts +3 -0
- package/node_modules/@claude-flow/codex/dist/loop/cli.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/loop/cli.js +123 -0
- package/node_modules/@claude-flow/codex/dist/loop/cli.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/loop/index.d.ts +58 -0
- package/node_modules/@claude-flow/codex/dist/loop/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/loop/index.js +230 -0
- package/node_modules/@claude-flow/codex/dist/loop/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/mcp-config.d.ts +28 -0
- package/node_modules/@claude-flow/codex/dist/mcp-config.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/mcp-config.js +121 -0
- package/node_modules/@claude-flow/codex/dist/mcp-config.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/migrations/index.d.ts +114 -0
- package/node_modules/@claude-flow/codex/dist/migrations/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/migrations/index.js +880 -0
- package/node_modules/@claude-flow/codex/dist/migrations/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/templates/index.d.ts +92 -0
- package/node_modules/@claude-flow/codex/dist/templates/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/templates/index.js +284 -0
- package/node_modules/@claude-flow/codex/dist/templates/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/types.d.ts +240 -0
- package/node_modules/@claude-flow/codex/dist/types.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/types.js +8 -0
- package/node_modules/@claude-flow/codex/dist/types.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/validators/index.d.ts +42 -0
- package/node_modules/@claude-flow/codex/dist/validators/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/validators/index.js +929 -0
- package/node_modules/@claude-flow/codex/dist/validators/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.d.ts +37 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.js +137 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/index.d.ts +2 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/index.js +2 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/package.json +122 -0
- package/node_modules/@claude-flow/plugin-agent-federation/README.md +49 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.d.ts +130 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.js +239 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.d.ts +34 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.js +69 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.d.ts +46 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.js +84 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.d.ts +27 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.js +46 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.d.ts +192 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.js +253 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.d.ts +211 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.js +501 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.d.ts +114 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.js +356 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.d.ts +41 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.js +184 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.d.ts +150 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.js +128 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.d.ts +74 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.js +179 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.d.ts +13 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js +189 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.d.ts +7 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.js +317 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.d.ts +45 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.js +71 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.d.ts +104 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.js +152 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.d.ts +55 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.js +105 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.d.ts +17 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.js +35 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.d.ts +69 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.js +149 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.d.ts +68 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.js +161 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.d.ts +58 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.js +122 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.d.ts +65 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.js +208 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.d.ts +51 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.js +147 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.d.ts +71 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.js +194 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.d.ts +156 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.js +292 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.d.ts +98 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.js +122 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.d.ts +89 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.js +165 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.d.ts +92 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.js +100 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.d.ts +70 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.js +104 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/index.d.ts +23 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/index.js +24 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/index.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.d.ts +10 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.js +439 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.d.ts +19 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.js +515 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.d.ts +72 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.js +269 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/version.d.ts +3 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/version.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/version.js +3 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/version.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/package.json +64 -0
- package/node_modules/@claude-flow/security/README.md +292 -0
- package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.d.ts +97 -0
- package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.js +537 -0
- package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/application/index.d.ts +7 -0
- package/node_modules/@claude-flow/security/dist/application/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/application/index.js +7 -0
- package/node_modules/@claude-flow/security/dist/application/index.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/application/services/security-application-service.d.ts +71 -0
- package/node_modules/@claude-flow/security/dist/application/services/security-application-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/application/services/security-application-service.js +153 -0
- package/node_modules/@claude-flow/security/dist/application/services/security-application-service.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/authorization/propagator.d.ts +148 -0
- package/node_modules/@claude-flow/security/dist/authorization/propagator.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/authorization/propagator.js +182 -0
- package/node_modules/@claude-flow/security/dist/authorization/propagator.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/credential-generator.d.ts +176 -0
- package/node_modules/@claude-flow/security/dist/credential-generator.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/credential-generator.js +272 -0
- package/node_modules/@claude-flow/security/dist/credential-generator.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/domain/entities/security-context.d.ts +68 -0
- package/node_modules/@claude-flow/security/dist/domain/entities/security-context.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/domain/entities/security-context.js +132 -0
- package/node_modules/@claude-flow/security/dist/domain/entities/security-context.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/domain/index.d.ts +8 -0
- package/node_modules/@claude-flow/security/dist/domain/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/domain/index.js +8 -0
- package/node_modules/@claude-flow/security/dist/domain/index.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.d.ts +71 -0
- package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.js +237 -0
- package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/index.d.ts +129 -0
- package/node_modules/@claude-flow/security/dist/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/index.js +176 -0
- package/node_modules/@claude-flow/security/dist/index.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/input-validator.d.ts +306 -0
- package/node_modules/@claude-flow/security/dist/input-validator.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/input-validator.js +393 -0
- package/node_modules/@claude-flow/security/dist/input-validator.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/keychain-adapter.d.ts +48 -0
- package/node_modules/@claude-flow/security/dist/keychain-adapter.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/keychain-adapter.js +0 -0
- package/node_modules/@claude-flow/security/dist/keychain-adapter.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.d.ts +133 -0
- package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.js +254 -0
- package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/browser.d.ts +31 -0
- package/node_modules/@claude-flow/security/dist/oauth/browser.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/browser.js +55 -0
- package/node_modules/@claude-flow/security/dist/oauth/browser.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/callback-server.d.ts +37 -0
- package/node_modules/@claude-flow/security/dist/oauth/callback-server.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/callback-server.js +86 -0
- package/node_modules/@claude-flow/security/dist/oauth/callback-server.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/client.d.ts +57 -0
- package/node_modules/@claude-flow/security/dist/oauth/client.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/client.js +120 -0
- package/node_modules/@claude-flow/security/dist/oauth/client.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/pkce.d.ts +25 -0
- package/node_modules/@claude-flow/security/dist/oauth/pkce.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/pkce.js +36 -0
- package/node_modules/@claude-flow/security/dist/oauth/pkce.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/password-hasher.d.ts +128 -0
- package/node_modules/@claude-flow/security/dist/password-hasher.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/password-hasher.js +190 -0
- package/node_modules/@claude-flow/security/dist/password-hasher.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/path-validator.d.ts +148 -0
- package/node_modules/@claude-flow/security/dist/path-validator.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/path-validator.js +421 -0
- package/node_modules/@claude-flow/security/dist/path-validator.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.d.ts +125 -0
- package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.js +186 -0
- package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/canonical.d.ts +5 -0
- package/node_modules/@claude-flow/security/dist/policy/canonical.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/canonical.js +30 -0
- package/node_modules/@claude-flow/security/dist/policy/canonical.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/engine.d.ts +34 -0
- package/node_modules/@claude-flow/security/dist/policy/engine.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/engine.js +285 -0
- package/node_modules/@claude-flow/security/dist/policy/engine.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/envelope.d.ts +9 -0
- package/node_modules/@claude-flow/security/dist/policy/envelope.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/envelope.js +90 -0
- package/node_modules/@claude-flow/security/dist/policy/envelope.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/evaluator.d.ts +4 -0
- package/node_modules/@claude-flow/security/dist/policy/evaluator.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/evaluator.js +119 -0
- package/node_modules/@claude-flow/security/dist/policy/evaluator.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/index.d.ts +7 -0
- package/node_modules/@claude-flow/security/dist/policy/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/index.js +7 -0
- package/node_modules/@claude-flow/security/dist/policy/index.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/product-plane.d.ts +238 -0
- package/node_modules/@claude-flow/security/dist/policy/product-plane.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/product-plane.js +1022 -0
- package/node_modules/@claude-flow/security/dist/policy/product-plane.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/types.d.ts +169 -0
- package/node_modules/@claude-flow/security/dist/policy/types.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/types.js +2 -0
- package/node_modules/@claude-flow/security/dist/policy/types.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/safe-executor.d.ts +180 -0
- package/node_modules/@claude-flow/security/dist/safe-executor.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/safe-executor.js +390 -0
- package/node_modules/@claude-flow/security/dist/safe-executor.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/token-generator.d.ts +224 -0
- package/node_modules/@claude-flow/security/dist/token-generator.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/token-generator.js +351 -0
- package/node_modules/@claude-flow/security/dist/token-generator.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/tool-output-guardrail.d.ts +126 -0
- package/node_modules/@claude-flow/security/dist/tool-output-guardrail.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/tool-output-guardrail.js +257 -0
- package/node_modules/@claude-flow/security/dist/tool-output-guardrail.js.map +1 -0
- package/node_modules/@claude-flow/security/package.json +44 -0
- package/package.json +24 -8
|
@@ -0,0 +1,686 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @claude-flow/codex - CLI
|
|
4
|
+
*
|
|
5
|
+
* Command-line interface for Codex integration
|
|
6
|
+
* Part of the coflow rebranding initiative
|
|
7
|
+
*/
|
|
8
|
+
import { Command } from 'commander';
|
|
9
|
+
import chalk from 'chalk';
|
|
10
|
+
import { CodexInitializer } from './initializer.js';
|
|
11
|
+
import { validateAgentsMd, validateSkillMd, validateConfigToml } from './validators/index.js';
|
|
12
|
+
import { migrateFromClaudeCode, analyzeClaudeMd, generateMigrationReport } from './migrations/index.js';
|
|
13
|
+
import { listTemplates, BUILT_IN_SKILLS } from './templates/index.js';
|
|
14
|
+
import { generateSkillMd } from './generators/skill-md.js';
|
|
15
|
+
import { VERSION, PACKAGE_INFO } from './index.js';
|
|
16
|
+
import fs from 'fs-extra';
|
|
17
|
+
import path from 'path';
|
|
18
|
+
const program = new Command();
|
|
19
|
+
// Custom error handler for better output
|
|
20
|
+
function handleError(error, message) {
|
|
21
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
22
|
+
console.error(chalk.red.bold('\nError:'), chalk.red(message ?? errorMessage));
|
|
23
|
+
if (error instanceof Error && error.stack && process.env.DEBUG) {
|
|
24
|
+
console.error(chalk.gray('\nStack trace:'));
|
|
25
|
+
console.error(chalk.gray(error.stack));
|
|
26
|
+
}
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
// Validate project path exists and is accessible
|
|
30
|
+
async function validatePath(projectPath) {
|
|
31
|
+
const resolvedPath = path.resolve(projectPath);
|
|
32
|
+
try {
|
|
33
|
+
const stats = await fs.stat(resolvedPath);
|
|
34
|
+
if (!stats.isDirectory()) {
|
|
35
|
+
throw new Error(`Path is not a directory: ${resolvedPath}`);
|
|
36
|
+
}
|
|
37
|
+
return resolvedPath;
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
if (error.code === 'ENOENT') {
|
|
41
|
+
// Directory doesn't exist, try to create it
|
|
42
|
+
console.log(chalk.yellow(`Creating directory: ${resolvedPath}`));
|
|
43
|
+
await fs.ensureDir(resolvedPath);
|
|
44
|
+
return resolvedPath;
|
|
45
|
+
}
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// Validate skill name format
|
|
50
|
+
function validateSkillName(name) {
|
|
51
|
+
const validPattern = /^[a-z][a-z0-9-]*$/;
|
|
52
|
+
return validPattern.test(name);
|
|
53
|
+
}
|
|
54
|
+
// Print banner
|
|
55
|
+
function printBanner() {
|
|
56
|
+
console.log(chalk.cyan.bold('\n Claude Flow Codex'));
|
|
57
|
+
console.log(chalk.gray(' OpenAI Codex integration for Claude Flow'));
|
|
58
|
+
console.log(chalk.gray(' ----------------------------------------\n'));
|
|
59
|
+
}
|
|
60
|
+
program
|
|
61
|
+
.name('claude-flow-codex')
|
|
62
|
+
.description('OpenAI Codex integration for Claude Flow - Part of the coflow ecosystem')
|
|
63
|
+
.version(VERSION, '-v, --version', 'Display version number')
|
|
64
|
+
.option('--debug', 'Enable debug mode', false)
|
|
65
|
+
.hook('preAction', (thisCommand) => {
|
|
66
|
+
if (thisCommand.opts().debug) {
|
|
67
|
+
process.env.DEBUG = 'true';
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
// Init command
|
|
71
|
+
program
|
|
72
|
+
.command('init')
|
|
73
|
+
.description('Initialize a new Codex project with AGENTS.md and skills')
|
|
74
|
+
.option('-t, --template <template>', 'Template to use (minimal, default, full, enterprise)', 'default')
|
|
75
|
+
.option('-s, --skills <skills>', 'Comma-separated list of skills to include')
|
|
76
|
+
.option('-f, --force', 'Overwrite existing files', false)
|
|
77
|
+
.option('--dual', 'Generate both Codex and Claude Code configurations', false)
|
|
78
|
+
.option('-p, --path <path>', 'Project path', process.cwd())
|
|
79
|
+
.option('-q, --quiet', 'Suppress verbose output', false)
|
|
80
|
+
.action(async (options) => {
|
|
81
|
+
try {
|
|
82
|
+
if (!options.quiet) {
|
|
83
|
+
printBanner();
|
|
84
|
+
}
|
|
85
|
+
// Validate template
|
|
86
|
+
const validTemplates = ['minimal', 'default', 'full', 'enterprise'];
|
|
87
|
+
if (!validTemplates.includes(options.template)) {
|
|
88
|
+
console.error(chalk.red(`Invalid template: ${options.template}`));
|
|
89
|
+
console.log(chalk.gray(`Valid templates: ${validTemplates.join(', ')}`));
|
|
90
|
+
process.exit(1);
|
|
91
|
+
}
|
|
92
|
+
const projectPath = await validatePath(options.path);
|
|
93
|
+
console.log(chalk.blue('Initializing Codex project...'));
|
|
94
|
+
console.log(chalk.gray(` Path: ${projectPath}`));
|
|
95
|
+
console.log(chalk.gray(` Template: ${options.template}`));
|
|
96
|
+
if (options.skills) {
|
|
97
|
+
console.log(chalk.gray(` Skills: ${options.skills}`));
|
|
98
|
+
}
|
|
99
|
+
if (options.force) {
|
|
100
|
+
console.log(chalk.yellow(' Force: enabled (will overwrite existing files)'));
|
|
101
|
+
}
|
|
102
|
+
if (options.dual) {
|
|
103
|
+
console.log(chalk.gray(' Mode: dual (Codex + Claude Code)'));
|
|
104
|
+
}
|
|
105
|
+
const initializer = new CodexInitializer();
|
|
106
|
+
const skills = options.skills?.split(',').map((s) => s.trim()).filter(Boolean);
|
|
107
|
+
// Validate skill names if provided
|
|
108
|
+
if (skills) {
|
|
109
|
+
for (const skill of skills) {
|
|
110
|
+
if (!validateSkillName(skill)) {
|
|
111
|
+
console.error(chalk.red(`Invalid skill name: ${skill}`));
|
|
112
|
+
console.log(chalk.gray('Skill names must be kebab-case (lowercase letters, numbers, hyphens)'));
|
|
113
|
+
process.exit(1);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const result = await initializer.initialize({
|
|
118
|
+
projectPath,
|
|
119
|
+
template: options.template,
|
|
120
|
+
skills,
|
|
121
|
+
force: options.force,
|
|
122
|
+
dual: options.dual,
|
|
123
|
+
});
|
|
124
|
+
if (result.success) {
|
|
125
|
+
console.log(chalk.green.bold('\n Project initialized successfully!'));
|
|
126
|
+
if (result.filesCreated.length > 0) {
|
|
127
|
+
console.log(chalk.white('\n Files created:'));
|
|
128
|
+
for (const file of result.filesCreated) {
|
|
129
|
+
console.log(chalk.gray(` ${chalk.green('+')} ${file}`));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (result.skillsGenerated.length > 0) {
|
|
133
|
+
console.log(chalk.white('\n Skills generated:'));
|
|
134
|
+
for (const skill of result.skillsGenerated) {
|
|
135
|
+
console.log(chalk.gray(` ${chalk.cyan('$')}${skill}`));
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (result.warnings && result.warnings.length > 0) {
|
|
139
|
+
console.log(chalk.yellow('\n Warnings:'));
|
|
140
|
+
for (const warning of result.warnings) {
|
|
141
|
+
console.log(chalk.yellow(` ! ${warning}`));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
console.log(chalk.blue.bold('\n Next steps:'));
|
|
145
|
+
console.log(chalk.gray(' 1. Review AGENTS.md and customize for your project'));
|
|
146
|
+
console.log(chalk.gray(' 2. Review .agents/config.toml settings'));
|
|
147
|
+
console.log(chalk.gray(' 3. Start using skills with $skill-name syntax'));
|
|
148
|
+
console.log();
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
console.log(chalk.red.bold('\n Initialization failed'));
|
|
152
|
+
if (result.errors) {
|
|
153
|
+
for (const error of result.errors) {
|
|
154
|
+
console.log(chalk.red(` - ${error}`));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
process.exit(1);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
handleError(error, 'Failed to initialize project');
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
// Generate skill command
|
|
165
|
+
program
|
|
166
|
+
.command('generate-skill')
|
|
167
|
+
.alias('gs')
|
|
168
|
+
.description('Generate a new SKILL.md file')
|
|
169
|
+
.requiredOption('-n, --name <name>', 'Skill name (kebab-case)')
|
|
170
|
+
.option('-d, --description <description>', 'Skill description')
|
|
171
|
+
.option('-t, --triggers <triggers>', 'Comma-separated trigger conditions')
|
|
172
|
+
.option('-s, --skip <skip>', 'Comma-separated skip conditions')
|
|
173
|
+
.option('-p, --path <path>', 'Output path', process.cwd())
|
|
174
|
+
.option('--dry-run', 'Show what would be generated without writing', false)
|
|
175
|
+
.action(async (options) => {
|
|
176
|
+
try {
|
|
177
|
+
printBanner();
|
|
178
|
+
// Validate skill name
|
|
179
|
+
if (!validateSkillName(options.name)) {
|
|
180
|
+
console.error(chalk.red(`Invalid skill name: ${options.name}`));
|
|
181
|
+
console.log(chalk.gray('Skill names must be kebab-case (lowercase letters, numbers, hyphens)'));
|
|
182
|
+
console.log(chalk.gray('Examples: my-skill, code-analyzer, data-processor'));
|
|
183
|
+
process.exit(1);
|
|
184
|
+
}
|
|
185
|
+
const projectPath = await validatePath(options.path);
|
|
186
|
+
console.log(chalk.blue(`Generating skill: ${chalk.white(options.name)}`));
|
|
187
|
+
const triggers = options.triggers?.split(',').map((s) => s.trim()).filter(Boolean);
|
|
188
|
+
const skipWhen = options.skip?.split(',').map((s) => s.trim()).filter(Boolean);
|
|
189
|
+
const skillMd = await generateSkillMd({
|
|
190
|
+
name: options.name,
|
|
191
|
+
description: options.description ?? `Custom skill: ${options.name}`,
|
|
192
|
+
triggers: triggers ?? ['Define when to trigger this skill'],
|
|
193
|
+
skipWhen: skipWhen ?? ['Define when to skip this skill'],
|
|
194
|
+
});
|
|
195
|
+
if (options.dryRun) {
|
|
196
|
+
console.log(chalk.yellow('\nDry run - would generate:'));
|
|
197
|
+
console.log(chalk.gray('---'));
|
|
198
|
+
console.log(skillMd);
|
|
199
|
+
console.log(chalk.gray('---'));
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const skillDir = path.join(projectPath, '.agents', 'skills', options.name);
|
|
203
|
+
await fs.ensureDir(skillDir);
|
|
204
|
+
const skillPath = path.join(skillDir, 'SKILL.md');
|
|
205
|
+
// Check if skill already exists
|
|
206
|
+
if (await fs.pathExists(skillPath)) {
|
|
207
|
+
console.log(chalk.yellow(`Skill already exists: ${skillPath}`));
|
|
208
|
+
console.log(chalk.gray('Use --force to overwrite (not yet implemented)'));
|
|
209
|
+
process.exit(1);
|
|
210
|
+
}
|
|
211
|
+
await fs.writeFile(skillPath, skillMd);
|
|
212
|
+
console.log(chalk.green.bold(`\n Skill created successfully!`));
|
|
213
|
+
console.log(chalk.gray(` Path: ${skillPath}`));
|
|
214
|
+
console.log(chalk.gray(` Use: ${chalk.cyan('$' + options.name)}`));
|
|
215
|
+
console.log();
|
|
216
|
+
}
|
|
217
|
+
catch (error) {
|
|
218
|
+
handleError(error, 'Failed to generate skill');
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
// Validate command
|
|
222
|
+
program
|
|
223
|
+
.command('validate')
|
|
224
|
+
.alias('check')
|
|
225
|
+
.description('Validate AGENTS.md, SKILL.md, or config.toml files')
|
|
226
|
+
.option('-f, --file <file>', 'File to validate')
|
|
227
|
+
.option('-p, --path <path>', 'Project path to validate all files', process.cwd())
|
|
228
|
+
.option('--fix', 'Attempt to fix issues (not yet implemented)', false)
|
|
229
|
+
.option('--strict', 'Treat warnings as errors', false)
|
|
230
|
+
.action(async (options) => {
|
|
231
|
+
try {
|
|
232
|
+
printBanner();
|
|
233
|
+
const projectPath = path.resolve(options.path);
|
|
234
|
+
const filesToValidate = [];
|
|
235
|
+
if (options.file) {
|
|
236
|
+
// Validate specific file
|
|
237
|
+
const filePath = path.resolve(options.file);
|
|
238
|
+
if (!await fs.pathExists(filePath)) {
|
|
239
|
+
console.error(chalk.red(`File not found: ${filePath}`));
|
|
240
|
+
process.exit(1);
|
|
241
|
+
}
|
|
242
|
+
const fileName = path.basename(filePath).toLowerCase();
|
|
243
|
+
if (fileName === 'agents.md') {
|
|
244
|
+
filesToValidate.push({ path: filePath, type: 'agents' });
|
|
245
|
+
}
|
|
246
|
+
else if (fileName === 'skill.md') {
|
|
247
|
+
filesToValidate.push({ path: filePath, type: 'skill' });
|
|
248
|
+
}
|
|
249
|
+
else if (fileName === 'config.toml') {
|
|
250
|
+
filesToValidate.push({ path: filePath, type: 'config' });
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
console.error(chalk.red(`Unknown file type: ${fileName}`));
|
|
254
|
+
console.log(chalk.gray('Supported files: AGENTS.md, SKILL.md, config.toml'));
|
|
255
|
+
process.exit(1);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
// Validate all files in project
|
|
260
|
+
console.log(chalk.blue(`Scanning project: ${projectPath}`));
|
|
261
|
+
const agentsMd = path.join(projectPath, 'AGENTS.md');
|
|
262
|
+
const configToml = path.join(projectPath, '.agents', 'config.toml');
|
|
263
|
+
if (await fs.pathExists(agentsMd)) {
|
|
264
|
+
filesToValidate.push({ path: agentsMd, type: 'agents' });
|
|
265
|
+
}
|
|
266
|
+
if (await fs.pathExists(configToml)) {
|
|
267
|
+
filesToValidate.push({ path: configToml, type: 'config' });
|
|
268
|
+
}
|
|
269
|
+
// Find skill files
|
|
270
|
+
const skillsDir = path.join(projectPath, '.agents', 'skills');
|
|
271
|
+
if (await fs.pathExists(skillsDir)) {
|
|
272
|
+
try {
|
|
273
|
+
const skills = await fs.readdir(skillsDir);
|
|
274
|
+
for (const skill of skills) {
|
|
275
|
+
const skillPath = path.join(skillsDir, skill);
|
|
276
|
+
const skillStats = await fs.stat(skillPath);
|
|
277
|
+
if (skillStats.isDirectory()) {
|
|
278
|
+
const skillMd = path.join(skillPath, 'SKILL.md');
|
|
279
|
+
if (await fs.pathExists(skillMd)) {
|
|
280
|
+
filesToValidate.push({ path: skillMd, type: 'skill' });
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
catch {
|
|
286
|
+
// Ignore errors reading skills directory
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
if (filesToValidate.length === 0) {
|
|
291
|
+
console.log(chalk.yellow('No files found to validate'));
|
|
292
|
+
console.log(chalk.gray('Run `claude-flow-codex init` to create a project'));
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
console.log(chalk.blue(`\nValidating ${filesToValidate.length} file(s)...\n`));
|
|
296
|
+
let hasErrors = false;
|
|
297
|
+
let hasWarnings = false;
|
|
298
|
+
let totalErrors = 0;
|
|
299
|
+
let totalWarnings = 0;
|
|
300
|
+
for (const file of filesToValidate) {
|
|
301
|
+
let content;
|
|
302
|
+
try {
|
|
303
|
+
content = await fs.readFile(file.path, 'utf-8');
|
|
304
|
+
}
|
|
305
|
+
catch (error) {
|
|
306
|
+
console.log(chalk.red(` ! Cannot read: ${file.path}`));
|
|
307
|
+
hasErrors = true;
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
let result;
|
|
311
|
+
switch (file.type) {
|
|
312
|
+
case 'agents':
|
|
313
|
+
result = await validateAgentsMd(content);
|
|
314
|
+
break;
|
|
315
|
+
case 'skill':
|
|
316
|
+
result = await validateSkillMd(content);
|
|
317
|
+
break;
|
|
318
|
+
case 'config':
|
|
319
|
+
result = await validateConfigToml(content);
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
const relativePath = path.relative(projectPath, file.path);
|
|
323
|
+
if (result.valid && result.warnings.length === 0) {
|
|
324
|
+
console.log(chalk.green(` ${chalk.green.bold('PASS')} ${relativePath}`));
|
|
325
|
+
}
|
|
326
|
+
else if (result.valid) {
|
|
327
|
+
console.log(chalk.yellow(` ${chalk.yellow.bold('WARN')} ${relativePath}`));
|
|
328
|
+
hasWarnings = true;
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
console.log(chalk.red(` ${chalk.red.bold('FAIL')} ${relativePath}`));
|
|
332
|
+
hasErrors = true;
|
|
333
|
+
}
|
|
334
|
+
for (const error of result.errors) {
|
|
335
|
+
totalErrors++;
|
|
336
|
+
const lineInfo = error.line ? chalk.gray(` (line ${error.line})`) : '';
|
|
337
|
+
console.log(chalk.red(` ${chalk.red('x')} ${error.message}${lineInfo}`));
|
|
338
|
+
}
|
|
339
|
+
for (const warning of result.warnings) {
|
|
340
|
+
totalWarnings++;
|
|
341
|
+
console.log(chalk.yellow(` ${chalk.yellow('!')} ${warning.message}`));
|
|
342
|
+
if (warning.suggestion) {
|
|
343
|
+
console.log(chalk.gray(` ${warning.suggestion}`));
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
// Summary
|
|
348
|
+
console.log();
|
|
349
|
+
if (hasErrors) {
|
|
350
|
+
console.log(chalk.red.bold(` ${totalErrors} error(s), ${totalWarnings} warning(s)`));
|
|
351
|
+
process.exit(1);
|
|
352
|
+
}
|
|
353
|
+
else if (hasWarnings && options.strict) {
|
|
354
|
+
console.log(chalk.yellow.bold(` ${totalWarnings} warning(s) (strict mode)`));
|
|
355
|
+
process.exit(1);
|
|
356
|
+
}
|
|
357
|
+
else if (hasWarnings) {
|
|
358
|
+
console.log(chalk.yellow(` All files valid with ${totalWarnings} warning(s)`));
|
|
359
|
+
}
|
|
360
|
+
else {
|
|
361
|
+
console.log(chalk.green.bold(' All files valid!'));
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
catch (error) {
|
|
365
|
+
handleError(error, 'Validation failed');
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
// Migrate command
|
|
369
|
+
program
|
|
370
|
+
.command('migrate')
|
|
371
|
+
.description('Migrate from Claude Code (CLAUDE.md) to Codex (AGENTS.md)')
|
|
372
|
+
.option('-f, --from <file>', 'Source CLAUDE.md file', 'CLAUDE.md')
|
|
373
|
+
.option('-o, --output <path>', 'Output directory', process.cwd())
|
|
374
|
+
.option('--analyze-only', 'Only analyze, do not generate files', false)
|
|
375
|
+
.option('--generate-skills', 'Generate skill files from detected patterns', true)
|
|
376
|
+
.option('--preserve-comments', 'Preserve comments from original file', true)
|
|
377
|
+
.action(async (options) => {
|
|
378
|
+
try {
|
|
379
|
+
printBanner();
|
|
380
|
+
const sourcePath = path.resolve(options.from);
|
|
381
|
+
if (!await fs.pathExists(sourcePath)) {
|
|
382
|
+
console.error(chalk.red(`Source file not found: ${sourcePath}`));
|
|
383
|
+
console.log(chalk.gray('\nLooking for CLAUDE.md in the current directory.'));
|
|
384
|
+
console.log(chalk.gray('Use --from <path> to specify a different source file.'));
|
|
385
|
+
process.exit(1);
|
|
386
|
+
}
|
|
387
|
+
let content;
|
|
388
|
+
try {
|
|
389
|
+
content = await fs.readFile(sourcePath, 'utf-8');
|
|
390
|
+
}
|
|
391
|
+
catch (error) {
|
|
392
|
+
handleError(error, `Cannot read source file: ${sourcePath}`);
|
|
393
|
+
}
|
|
394
|
+
if (options.analyzeOnly) {
|
|
395
|
+
console.log(chalk.blue('Analyzing CLAUDE.md...'));
|
|
396
|
+
console.log(chalk.gray(`Source: ${sourcePath}\n`));
|
|
397
|
+
const analysis = await analyzeClaudeMd(content);
|
|
398
|
+
console.log(chalk.white.bold('Sections found:'));
|
|
399
|
+
if (analysis.sections.length > 0) {
|
|
400
|
+
for (const section of analysis.sections) {
|
|
401
|
+
console.log(chalk.gray(` - ${section}`));
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
else {
|
|
405
|
+
console.log(chalk.gray(' (none)'));
|
|
406
|
+
}
|
|
407
|
+
console.log(chalk.white.bold('\nSkills detected:'));
|
|
408
|
+
if (analysis.skills.length > 0) {
|
|
409
|
+
for (const skill of analysis.skills) {
|
|
410
|
+
console.log(chalk.gray(` - /${skill} ${chalk.cyan('->')} $${skill}`));
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
console.log(chalk.gray(' (none)'));
|
|
415
|
+
}
|
|
416
|
+
console.log(chalk.white.bold('\nHooks used:'));
|
|
417
|
+
if (analysis.hooks.length > 0) {
|
|
418
|
+
for (const hook of analysis.hooks) {
|
|
419
|
+
console.log(chalk.gray(` - ${hook}`));
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
else {
|
|
423
|
+
console.log(chalk.gray(' (none)'));
|
|
424
|
+
}
|
|
425
|
+
console.log(chalk.white.bold('\nCustom instructions:'));
|
|
426
|
+
if (analysis.customInstructions.length > 0) {
|
|
427
|
+
for (const instruction of analysis.customInstructions.slice(0, 5)) {
|
|
428
|
+
console.log(chalk.gray(` - ${instruction.substring(0, 60)}...`));
|
|
429
|
+
}
|
|
430
|
+
if (analysis.customInstructions.length > 5) {
|
|
431
|
+
console.log(chalk.gray(` ... and ${analysis.customInstructions.length - 5} more`));
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
else {
|
|
435
|
+
console.log(chalk.gray(' (none)'));
|
|
436
|
+
}
|
|
437
|
+
if (analysis.warnings.length > 0) {
|
|
438
|
+
console.log(chalk.yellow.bold('\nMigration warnings:'));
|
|
439
|
+
for (const warning of analysis.warnings) {
|
|
440
|
+
console.log(chalk.yellow(` ! ${warning}`));
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
console.log();
|
|
444
|
+
}
|
|
445
|
+
else {
|
|
446
|
+
console.log(chalk.blue('Migrating to Codex...'));
|
|
447
|
+
console.log(chalk.gray(`Source: ${sourcePath}`));
|
|
448
|
+
console.log(chalk.gray(`Output: ${path.resolve(options.output)}\n`));
|
|
449
|
+
const result = await migrateFromClaudeCode({
|
|
450
|
+
sourcePath,
|
|
451
|
+
targetPath: options.output,
|
|
452
|
+
generateSkills: options.generateSkills,
|
|
453
|
+
preserveComments: options.preserveComments,
|
|
454
|
+
});
|
|
455
|
+
const report = generateMigrationReport(result);
|
|
456
|
+
console.log(report);
|
|
457
|
+
if (result.success) {
|
|
458
|
+
console.log(chalk.green.bold('\n Migration completed successfully!'));
|
|
459
|
+
console.log(chalk.gray('\n Next steps:'));
|
|
460
|
+
console.log(chalk.gray(' 1. Review the generated AGENTS.md'));
|
|
461
|
+
console.log(chalk.gray(' 2. Check skill invocation syntax (/ -> $)'));
|
|
462
|
+
console.log(chalk.gray(' 3. Run `claude-flow-codex validate` to verify'));
|
|
463
|
+
console.log();
|
|
464
|
+
}
|
|
465
|
+
else {
|
|
466
|
+
console.log(chalk.red.bold('\n Migration failed'));
|
|
467
|
+
process.exit(1);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
catch (error) {
|
|
472
|
+
handleError(error, 'Migration failed');
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
// Templates command
|
|
476
|
+
program
|
|
477
|
+
.command('templates')
|
|
478
|
+
.alias('list-templates')
|
|
479
|
+
.description('List available templates')
|
|
480
|
+
.option('--json', 'Output as JSON', false)
|
|
481
|
+
.action((options) => {
|
|
482
|
+
try {
|
|
483
|
+
const templates = listTemplates();
|
|
484
|
+
if (options.json) {
|
|
485
|
+
console.log(JSON.stringify(templates, null, 2));
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
printBanner();
|
|
489
|
+
console.log(chalk.white.bold('Available templates:\n'));
|
|
490
|
+
for (const template of templates) {
|
|
491
|
+
console.log(chalk.cyan.bold(` ${template.name}`));
|
|
492
|
+
console.log(chalk.gray(` ${template.description}`));
|
|
493
|
+
console.log(chalk.gray(` Skills: ${template.skillCount} included`));
|
|
494
|
+
console.log();
|
|
495
|
+
}
|
|
496
|
+
console.log(chalk.gray('Use: claude-flow-codex init --template <name>'));
|
|
497
|
+
console.log();
|
|
498
|
+
}
|
|
499
|
+
catch (error) {
|
|
500
|
+
handleError(error, 'Failed to list templates');
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
// Skills command
|
|
504
|
+
program
|
|
505
|
+
.command('skills')
|
|
506
|
+
.alias('list-skills')
|
|
507
|
+
.description('List available built-in skills')
|
|
508
|
+
.option('--json', 'Output as JSON', false)
|
|
509
|
+
.action((options) => {
|
|
510
|
+
try {
|
|
511
|
+
if (options.json) {
|
|
512
|
+
console.log(JSON.stringify(BUILT_IN_SKILLS, null, 2));
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
printBanner();
|
|
516
|
+
console.log(chalk.white.bold('Built-in skills:\n'));
|
|
517
|
+
for (const [name, info] of Object.entries(BUILT_IN_SKILLS)) {
|
|
518
|
+
console.log(chalk.cyan(` $${name}`));
|
|
519
|
+
console.log(chalk.gray(` ${info.description}`));
|
|
520
|
+
console.log(chalk.gray(` Category: ${info.category}`));
|
|
521
|
+
console.log();
|
|
522
|
+
}
|
|
523
|
+
console.log(chalk.gray('Use: claude-flow-codex generate-skill -n <name> to create a custom skill'));
|
|
524
|
+
console.log();
|
|
525
|
+
}
|
|
526
|
+
catch (error) {
|
|
527
|
+
handleError(error, 'Failed to list skills');
|
|
528
|
+
}
|
|
529
|
+
});
|
|
530
|
+
// Info command
|
|
531
|
+
program
|
|
532
|
+
.command('info')
|
|
533
|
+
.description('Show package information')
|
|
534
|
+
.option('--json', 'Output as JSON', false)
|
|
535
|
+
.action((options) => {
|
|
536
|
+
try {
|
|
537
|
+
if (options.json) {
|
|
538
|
+
console.log(JSON.stringify(PACKAGE_INFO, null, 2));
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
console.log(chalk.cyan.bold('\n @claude-flow/codex'));
|
|
542
|
+
console.log(chalk.gray(' ' + '='.repeat(40)));
|
|
543
|
+
console.log(chalk.white(` Version: ${PACKAGE_INFO.version}`));
|
|
544
|
+
console.log(chalk.white(` Description: ${PACKAGE_INFO.description}`));
|
|
545
|
+
console.log(chalk.white(` Future: ${PACKAGE_INFO.futureUmbrella} (umbrella package)`));
|
|
546
|
+
console.log(chalk.white(` Repository: ${PACKAGE_INFO.repository}`));
|
|
547
|
+
console.log(chalk.gray(' ' + '='.repeat(40)));
|
|
548
|
+
console.log(chalk.gray('\n Part of the coflow rebranding initiative'));
|
|
549
|
+
console.log();
|
|
550
|
+
}
|
|
551
|
+
catch (error) {
|
|
552
|
+
handleError(error, 'Failed to show info');
|
|
553
|
+
}
|
|
554
|
+
});
|
|
555
|
+
// Doctor command - check system health
|
|
556
|
+
program
|
|
557
|
+
.command('doctor')
|
|
558
|
+
.description('Check system health and dependencies')
|
|
559
|
+
.action(async () => {
|
|
560
|
+
try {
|
|
561
|
+
printBanner();
|
|
562
|
+
console.log(chalk.blue('Running health checks...\n'));
|
|
563
|
+
const checks = [];
|
|
564
|
+
// Check Node.js version
|
|
565
|
+
const nodeVersion = process.version;
|
|
566
|
+
const nodeMajor = parseInt(nodeVersion.slice(1).split('.')[0] ?? '0', 10);
|
|
567
|
+
if (nodeMajor >= 18) {
|
|
568
|
+
checks.push({ name: 'Node.js', status: 'pass', message: `${nodeVersion} (>= 18 required)` });
|
|
569
|
+
}
|
|
570
|
+
else {
|
|
571
|
+
checks.push({ name: 'Node.js', status: 'fail', message: `${nodeVersion} (>= 18 required)` });
|
|
572
|
+
}
|
|
573
|
+
// Check for AGENTS.md in current directory
|
|
574
|
+
const agentsMdExists = await fs.pathExists(path.join(process.cwd(), 'AGENTS.md'));
|
|
575
|
+
if (agentsMdExists) {
|
|
576
|
+
checks.push({ name: 'AGENTS.md', status: 'pass', message: 'Found in current directory' });
|
|
577
|
+
}
|
|
578
|
+
else {
|
|
579
|
+
checks.push({ name: 'AGENTS.md', status: 'warn', message: 'Not found - run init to create' });
|
|
580
|
+
}
|
|
581
|
+
// Check for .agents directory
|
|
582
|
+
const agentsDir = await fs.pathExists(path.join(process.cwd(), '.agents'));
|
|
583
|
+
if (agentsDir) {
|
|
584
|
+
checks.push({ name: '.agents/', status: 'pass', message: 'Directory exists' });
|
|
585
|
+
}
|
|
586
|
+
else {
|
|
587
|
+
checks.push({ name: '.agents/', status: 'warn', message: 'Not found - run init to create' });
|
|
588
|
+
}
|
|
589
|
+
// Check for config.toml
|
|
590
|
+
const configExists = await fs.pathExists(path.join(process.cwd(), '.agents', 'config.toml'));
|
|
591
|
+
if (configExists) {
|
|
592
|
+
checks.push({ name: 'config.toml', status: 'pass', message: 'Found in .agents/' });
|
|
593
|
+
}
|
|
594
|
+
else {
|
|
595
|
+
checks.push({ name: 'config.toml', status: 'warn', message: 'Not found' });
|
|
596
|
+
}
|
|
597
|
+
// Check for git
|
|
598
|
+
try {
|
|
599
|
+
const gitExists = await fs.pathExists(path.join(process.cwd(), '.git'));
|
|
600
|
+
if (gitExists) {
|
|
601
|
+
checks.push({ name: 'Git', status: 'pass', message: 'Repository detected' });
|
|
602
|
+
}
|
|
603
|
+
else {
|
|
604
|
+
checks.push({ name: 'Git', status: 'warn', message: 'Not a git repository' });
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
catch {
|
|
608
|
+
checks.push({ name: 'Git', status: 'warn', message: 'Cannot check' });
|
|
609
|
+
}
|
|
610
|
+
// Print results
|
|
611
|
+
let hasFailures = false;
|
|
612
|
+
for (const check of checks) {
|
|
613
|
+
const icon = check.status === 'pass' ? chalk.green('PASS')
|
|
614
|
+
: check.status === 'warn' ? chalk.yellow('WARN')
|
|
615
|
+
: chalk.red('FAIL');
|
|
616
|
+
console.log(` ${icon} ${chalk.white(check.name)}`);
|
|
617
|
+
console.log(chalk.gray(` ${check.message}`));
|
|
618
|
+
if (check.status === 'fail') {
|
|
619
|
+
hasFailures = true;
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
console.log();
|
|
623
|
+
if (hasFailures) {
|
|
624
|
+
console.log(chalk.red.bold(' Some checks failed'));
|
|
625
|
+
process.exit(1);
|
|
626
|
+
}
|
|
627
|
+
else {
|
|
628
|
+
console.log(chalk.green.bold(' All checks passed!'));
|
|
629
|
+
}
|
|
630
|
+
console.log();
|
|
631
|
+
}
|
|
632
|
+
catch (error) {
|
|
633
|
+
handleError(error, 'Health check failed');
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
// Dual-mode command - collaborative Claude Code + Codex execution
|
|
637
|
+
import { createDualModeCommand } from './dual-mode/index.js';
|
|
638
|
+
program.addCommand(createDualModeCommand());
|
|
639
|
+
// Codex /loop-compatible runner
|
|
640
|
+
import { createLoopCommand } from './loop/cli.js';
|
|
641
|
+
program.addCommand(createLoopCommand());
|
|
642
|
+
// Policy-governed worktree isolation for concurrent Codex writers (ADR-324)
|
|
643
|
+
import { CodexWorktreeCoordinator } from './worktrees/index.js';
|
|
644
|
+
const worktree = program.command('worktree').description('Prepare, inspect, integrate, or clean registry-owned Codex swarm worktrees');
|
|
645
|
+
worktree.command('prepare <run-id>')
|
|
646
|
+
.requiredOption('--agents <ids>', 'Comma-separated writing-agent IDs')
|
|
647
|
+
.option('--read-only <ids>', 'Comma-separated read-only agent IDs')
|
|
648
|
+
.option('--base <ref>', 'Git base ref', 'HEAD')
|
|
649
|
+
.option('--allow-dirty', 'Allow creating worktrees from a dirty coordinator checkout', false)
|
|
650
|
+
.option('-p, --path <path>', 'Repository root', process.cwd())
|
|
651
|
+
.action((runId, options) => {
|
|
652
|
+
const writers = String(options.agents).split(',').map((id) => id.trim()).filter(Boolean).map((id) => ({ id }));
|
|
653
|
+
const readers = String(options.readOnly ?? '').split(',').map((id) => id.trim()).filter(Boolean).map((id) => ({ id, readOnly: true }));
|
|
654
|
+
const result = new CodexWorktreeCoordinator(options.path).prepare(runId, [...writers, ...readers], {
|
|
655
|
+
allowDirty: options.allowDirty,
|
|
656
|
+
baseRef: options.base,
|
|
657
|
+
});
|
|
658
|
+
console.log(JSON.stringify(result, null, 2));
|
|
659
|
+
});
|
|
660
|
+
worktree.command('status <run-id>')
|
|
661
|
+
.option('-p, --path <path>', 'Repository root', process.cwd())
|
|
662
|
+
.action((runId, options) => console.log(JSON.stringify(new CodexWorktreeCoordinator(options.path).status(runId), null, 2)));
|
|
663
|
+
worktree.command('integrate <run-id>')
|
|
664
|
+
.option('--agents <ids>', 'Comma-separated agent IDs; defaults to all writers')
|
|
665
|
+
.option('-p, --path <path>', 'Repository root', process.cwd())
|
|
666
|
+
.action((runId, options) => {
|
|
667
|
+
const ids = options.agents ? String(options.agents).split(',').map((id) => id.trim()).filter(Boolean) : undefined;
|
|
668
|
+
console.log(JSON.stringify(new CodexWorktreeCoordinator(options.path).integrate(runId, ids), null, 2));
|
|
669
|
+
});
|
|
670
|
+
worktree.command('cleanup <run-id>')
|
|
671
|
+
.option('-p, --path <path>', 'Repository root', process.cwd())
|
|
672
|
+
.action((runId, options) => console.log(JSON.stringify(new CodexWorktreeCoordinator(options.path).cleanup(runId), null, 2)));
|
|
673
|
+
// Error handling for unknown commands
|
|
674
|
+
program.on('command:*', () => {
|
|
675
|
+
console.error(chalk.red(`Invalid command: ${program.args.join(' ')}`));
|
|
676
|
+
console.log(chalk.gray(`Run ${chalk.white('claude-flow-codex --help')} for available commands.`));
|
|
677
|
+
process.exit(1);
|
|
678
|
+
});
|
|
679
|
+
// Parse and run
|
|
680
|
+
program.parse();
|
|
681
|
+
// If no command provided, show help
|
|
682
|
+
if (!process.argv.slice(2).length) {
|
|
683
|
+
printBanner();
|
|
684
|
+
program.outputHelp();
|
|
685
|
+
}
|
|
686
|
+
//# sourceMappingURL=cli.js.map
|