claude-flow-novice 2.6.0 → 2.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/adaptive-context/cfn-v3-reflection.json +21 -0
- package/.claude/agents/AGENT_LIFECYCLE.md +495 -0
- package/.claude/agents/CLAUDE.md +1002 -995
- package/.claude/agents/accessibility-advocate.md +457 -0
- package/.claude/agents/agent-principles/README.md +226 -226
- package/.claude/agents/agent-principles/agent-type-guidelines.md +10 -0
- package/.claude/agents/agent-principles/format-selection.md +10 -0
- package/.claude/agents/agent-principles/phase4-template-optimization.md +502 -494
- package/.claude/agents/agent-principles/prompt-engineering.md +8 -0
- package/.claude/agents/agent-principles/quality-metrics.md +8 -0
- package/.claude/agents/analysis/code-analyzer.md +7 -17
- package/.claude/agents/analysis/code-review/analyze-code-quality.md +2 -104
- package/.claude/agents/analysis/perf-analyzer.md +2 -196
- package/.claude/agents/context/context-curator.md +78 -84
- package/.claude/agents/context/context-reflector.md +27 -81
- package/.claude/agents/coordinators/README.md +42 -0
- package/.claude/agents/coordinators/cfn-v3-coordinator.md +440 -0
- package/.claude/agents/{product-owner-team → coordinators}/cto-agent.md +154 -187
- package/.claude/agents/coordinators/multi-sprint-coordinator.md +50 -0
- package/.claude/agents/{product-owner-team → coordinators}/product-owner-agent.md +6 -39
- package/.claude/agents/{cfn-loop → coordinators}/product-owner.md +72 -17
- package/.claude/agents/core-agents/reviewer.md +114 -135
- package/.claude/agents/custom/agent-builder.md +637 -637
- package/.claude/agents/developers/README.md +69 -0
- package/.claude/agents/developers/backend-dev.md +77 -0
- package/.claude/agents/{core-agents → developers}/coder.md +131 -26
- package/.claude/agents/developers/react-frontend-engineer.md +121 -0
- package/.claude/agents/{frontend → developers}/state-architect.md +1 -0
- package/.claude/agents/{frontend → developers}/ui-designer.md +1 -0
- package/.claude/agents/development/backend/dev-backend-api.md +0 -29
- package/.claude/agents/development/npm-package-specialist.md +355 -347
- package/.claude/agents/documentation/api-docs/docs-api-openapi.md +8 -0
- package/.claude/agents/documentation/api-docs.md +8 -0
- package/.claude/agents/github/github-commit-agent.md +125 -117
- package/.claude/agents/goal/goal-planner.md +8 -0
- package/.claude/agents/infrastructure/README.md +100 -0
- package/.claude/agents/{specialized → infrastructure}/devops-engineer.md +131 -150
- package/.claude/agents/planners/README.md +94 -0
- package/.claude/agents/{core-agents → planners}/analyst.md +1 -22
- package/.claude/agents/{planning-team → planners}/api-designer-persona.md +8 -0
- package/.claude/agents/{core-agents → planners}/architect.md +7 -20
- package/.claude/agents/{core-agents → planners}/planner.md +0 -21
- package/.claude/agents/{planning-team → planners}/security-architect-persona.md +8 -28
- package/.claude/agents/{planning-team → planners}/system-architect-persona.md +6 -38
- package/.claude/agents/{architecture → planners}/system-architect.md +12 -17
- package/.claude/agents/product-owner-team/accessibility-advocate-persona.md +132 -161
- package/.claude/agents/product-owner-team/power-user-persona.md +149 -182
- package/.claude/agents/retrospective-analyst.md +84 -0
- package/.claude/agents/reviewers/README.md +58 -0
- package/.claude/agents/{analysis → reviewers}/code-quality-validator.md +8 -17
- package/.claude/agents/reviewers/reviewer.md +181 -0
- package/.claude/agents/sparc/architecture.md +6 -25
- package/.claude/agents/sparc/pseudocode.md +6 -0
- package/.claude/agents/sparc/refinement.md +6 -0
- package/.claude/agents/sparc/specification.md +1 -0
- package/.claude/agents/specialists/README.md +60 -0
- package/.claude/agents/{core-agents → specialists}/base-template-generator.md +8 -21
- package/.claude/agents/{specialized → specialists}/cli-agent-optimizer.md +1 -1
- package/.claude/agents/{specialized → specialists}/code-booster.md +1 -0
- package/.claude/agents/{consensus → specialists}/consensus-builder.md +1 -17
- package/.claude/agents/{specialized/mobile → specialists}/mobile-dev.md +0 -20
- package/.claude/agents/{core-agents → specialists}/performance-benchmarker.md +134 -148
- package/.claude/agents/{specialized → specialists}/rust-developer.md +1 -20
- package/.claude/agents/{specialized → specialists}/rust-enterprise-developer.md +1 -20
- package/.claude/agents/{specialized → specialists}/rust-mvp-developer.md +1 -20
- package/.claude/agents/{core-agents → specialists}/security-manager.md +68 -88
- package/.claude/agents/{security → specialists}/security-specialist-existing.md +6 -57
- package/.claude/agents/{security → specialists}/security-specialist.md +6 -30
- package/.claude/agents/{specialized/mobile → specialists}/spec-mobile-react-native.md +2 -21
- package/.claude/agents/testers/README.md +94 -0
- package/.claude/agents/{testing → testers}/e2e/playwright-agent.md +1 -20
- package/.claude/agents/{testing → testers}/interaction-tester.md +1 -20
- package/.claude/agents/{testing → testers}/playwright-tester.md +1 -1
- package/.claude/agents/testers/tester.md +139 -0
- package/.claude/agents/testers/unit/tdd-london-swarm.md +49 -0
- package/.claude/agents/testers/validation/production-validator.md +33 -0
- package/.claude/agents-ignore/cfn-loop-coordinator.md +157 -0
- package/.claude/agents-ignore/cfn-loop-coordinator.md.backup +156 -0
- package/.claude/agents-ignore/coordinator.md.backup +182 -0
- package/.claude/agents-ignore/cost-savings-cfn-loop-coordinator.md +760 -0
- package/.claude/agents-ignore/cost-savings-coordinator.md +173 -0
- package/.claude/artifacts/ace-reflections/REFLECT-001-summary.json +39 -0
- package/.claude/artifacts/ace-reflections/sprint-7_$(date -u +/"%Y%m%d_%H%M%S/").json" +47 -0
- package/.claude/commands/CFN_COORDINATOR_PARAMETERS.md +10 -10
- package/.claude/commands/cfn-loop-epic.md +3 -3
- package/.claude/commands/cfn-loop-single.md +3 -3
- package/.claude/commands/cfn-loop-sprints.md +1 -1
- package/.claude/commands/cfn-loop.md +3 -3
- package/.claude/commands/cfn-mode.md +20 -0
- package/.claude/commands/write-plan.md +104 -0
- package/.claude/data/cfn-loop.db +0 -0
- package/.claude/data/cfn_loop_logs.db +0 -0
- package/.claude/hooks/BACKUP_USAGE.md +243 -0
- package/.claude/hooks/post-edit-cfn-retrospective.sh +79 -0
- package/.claude/hooks/post-edit.sh +21 -0
- package/.claude/hooks/pre-edit-backup.sh +71 -0
- package/.claude/hooks/restore-from-backup.sh +37 -0
- package/.claude/prompts/cfn-loop-context.md +115 -0
- package/.claude/prompts/loop-specific/loop2.md +50 -0
- package/.claude/prompts/loop-specific/loop3.md +43 -0
- package/.claude/prompts/loop-specific/loop4.md +54 -0
- package/.claude/root-claude-distribute/CLAUDE.md +76 -2
- package/.claude/skills/ace-system/sprint-7-lessons.json +46 -0
- package/.claude/skills/ace-system/store-reflection.sh +33 -136
- package/.claude/skills/agent-discovery/SKILL.md +40 -0
- package/.claude/skills/agent-discovery/agents-registry-clean.json +0 -0
- package/.claude/skills/agent-discovery/agents-registry-fixed.json +19 -0
- package/.claude/skills/agent-discovery/agents-registry.json +718 -0
- package/.claude/skills/agent-discovery/discover-agents.py +175 -0
- package/.claude/skills/agent-discovery/discover-agents.sh +87 -0
- package/.claude/skills/agent-discovery/invoke-registry.sh +11 -0
- package/.claude/skills/agent-discovery/temp_script.py +0 -0
- package/.claude/skills/agent-output-processing/SKILL.md +359 -0
- package/.claude/skills/agent-selector/SKILL.md +90 -0
- package/.claude/skills/agent-selector/select-agents.sh +96 -0
- package/.claude/skills/agent-spawning/agent-selection-guide.md +1 -1
- package/.claude/skills/agent-swap/SKILL.md +36 -0
- package/.claude/skills/agent-swap/recommend-swap.sh +60 -0
- package/.claude/skills/api-validation/test-endpoints.sh +54 -0
- package/.claude/skills/automatic-memory-persistence/SKILL.md +73 -0
- package/.claude/skills/automatic-memory-persistence/persist-agent-output.sh +49 -0
- package/.claude/skills/automatic-memory-persistence/query-agent-history.sh +35 -0
- package/.claude/skills/automatic-memory-persistence/test-memory-persistence.sh +235 -0
- package/.claude/skills/cfn-loop-orchestration/README.md +41 -0
- package/.claude/skills/cfn-loop-orchestration/SKILL.md +299 -0
- package/.claude/skills/cfn-loop-orchestration/helpers/auto-tune-timeouts.sh +228 -0
- package/.claude/skills/cfn-loop-orchestration/helpers/consensus.sh +84 -0
- package/.claude/skills/cfn-loop-orchestration/helpers/deliverable-verifier.sh +71 -0
- package/.claude/skills/cfn-loop-orchestration/helpers/gate-check.sh +90 -0
- package/.claude/skills/cfn-loop-orchestration/helpers/iteration-manager.sh +87 -0
- package/.claude/skills/cfn-loop-orchestration/helpers/timeout-calculator.sh +51 -0
- package/.claude/skills/cfn-loop-orchestration/inject-loop-context.sh +41 -0
- package/.claude/skills/cfn-loop-orchestration/monitor-execution.sh +156 -0
- package/.claude/skills/cfn-loop-orchestration/orchestrate.sh +840 -0
- package/.claude/skills/cfn-loop-orchestration/security_utils.sh +99 -0
- package/.claude/skills/cfn-loop-orchestration/test-cfn-orchestration.sh +281 -0
- package/.claude/skills/cfn-loop-orchestration/test-edge-cases.sh +188 -0
- package/.claude/skills/cfn-loop-validation/SKILL.md +307 -217
- package/.claude/skills/complexity-estimator/SKILL.md +96 -0
- package/.claude/skills/complexity-estimator/estimate-complexity.sh +144 -0
- package/.claude/skills/context-pruner/SKILL.md +75 -0
- package/.claude/skills/context-pruner/prune-context.sh +73 -0
- package/.claude/skills/defense-in-depth/SKILL.md +133 -0
- package/.claude/skills/dependency-extractor/SKILL.md +35 -0
- package/.claude/skills/dependency-extractor/extract-dependencies.sh +66 -0
- package/.claude/skills/epic-decomposer/SKILL.md +44 -0
- package/.claude/skills/epic-decomposer/decompose-epic.sh +104 -0
- package/.claude/skills/improvement-recommender/SKILL.md +33 -0
- package/.claude/skills/improvement-recommender/recommend-improvements.sh +92 -0
- package/.claude/skills/intervention-detector/SKILL.md +39 -0
- package/.claude/skills/intervention-detector/detect-intervention.sh +111 -0
- package/.claude/skills/intervention-orchestrator/SKILL.md +43 -0
- package/.claude/skills/intervention-orchestrator/execute-intervention.sh +59 -0
- package/.claude/skills/loop2-output-processing/SKILL.md +163 -0
- package/.claude/skills/loop2-output-processing/execute-and-extract.sh +77 -0
- package/.claude/skills/loop2-output-processing/execute-and-extract.sh.backup +36 -0
- package/.claude/skills/loop2-output-processing/parse-feedback.sh +147 -0
- package/.claude/skills/loop2-output-processing/process-validator-output.sh +275 -0
- package/.claude/skills/loop2-output-processing/test-bug27-fix.sh +200 -0
- package/.claude/skills/loop2-output-processing/test-loop2-processing.sh +113 -0
- package/.claude/skills/loop3-output-processing/AGENT_COMPLETION_PROTOCOL.md +206 -0
- package/.claude/skills/loop3-output-processing/SKILL.md +421 -0
- package/.claude/skills/loop3-output-processing/calculate-confidence.sh +28 -0
- package/.claude/skills/loop3-output-processing/execute-and-extract.sh +85 -0
- package/.claude/skills/loop3-output-processing/parse-confidence.sh +31 -0
- package/.claude/skills/loop3-output-processing/test-agent-timeout.sh +327 -0
- package/.claude/skills/loop3-output-processing/test-loop3-processing.sh +155 -0
- package/.claude/skills/loop3-output-processing/verify-deliverables.sh +42 -0
- package/.claude/skills/pattern-extraction/SKILL.md +30 -0
- package/.claude/skills/pattern-extraction/extract-patterns.sh +80 -0
- package/.claude/skills/playbook/SKILL.md +113 -0
- package/.claude/skills/playbook/init-playbook.sh +54 -0
- package/.claude/skills/playbook/playbook.db +0 -0
- package/.claude/skills/playbook/query-playbook.sh +79 -0
- package/.claude/skills/playbook/update-playbook.sh +69 -0
- package/.claude/skills/playbook-auto-update/SKILL.md +29 -0
- package/.claude/skills/playbook-auto-update/auto-update-playbook.sh +86 -0
- package/.claude/skills/product-owner-decision/SKILL.md +332 -0
- package/.claude/skills/product-owner-decision/execute-decision.sh +176 -0
- package/.claude/skills/product-owner-decision/parse-decision.sh +66 -0
- package/.claude/skills/product-owner-decision/validate-deliverables.sh +82 -0
- package/.claude/skills/redis-coordination/LOGGING.md +260 -0
- package/.claude/skills/redis-coordination/README.md +30 -29
- package/.claude/skills/redis-coordination/SKILL.md +685 -83
- package/.claude/skills/redis-coordination/analyze-task-complexity.sh +277 -0
- package/.claude/skills/redis-coordination/cfn-loop-exec.sh +468 -0
- package/.claude/skills/redis-coordination/collect-confidence-scores.sh +179 -0
- package/.claude/skills/redis-coordination/collect-results.sh +75 -0
- package/.claude/skills/redis-coordination/data/cfn-loop.db +0 -0
- package/.claude/skills/redis-coordination/{test-orchestrator.sh → demos/test-orchestrator.sh} +25 -0
- package/.claude/skills/redis-coordination/execute-product-owner-decision.sh +258 -0
- package/.claude/skills/redis-coordination/get-agent-timeout.sh +176 -176
- package/.claude/skills/redis-coordination/invoke-waiting-mode.sh +93 -227
- package/.claude/skills/redis-coordination/invoke-waiting-mode.sh.backup-p7 +423 -0
- package/.claude/skills/redis-coordination/log-event.sh +109 -0
- package/.claude/skills/redis-coordination/monitor-cfn-violations.sh +391 -0
- package/.claude/skills/redis-coordination/orchestrate-cfn-loop-v3.sh +141 -0
- package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh +31 -993
- package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.backup +38 -0
- package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.backup-1761167675 +1672 -0
- package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.backup-p5 +1604 -0
- package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.backup-phase1 +1550 -0
- package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.backup-phase2 +1621 -0
- package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.backup-phase3 +1621 -0
- package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.bak +0 -0
- package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.broken +1627 -0
- package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.corrupted +80 -0
- package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.deprecated +1864 -0
- package/.claude/skills/redis-coordination/query-logs.sh +103 -0
- package/.claude/skills/redis-coordination/retrieve-context.sh +58 -0
- package/.claude/skills/redis-coordination/select-specialist-agent.sh +371 -0
- package/.claude/skills/redis-coordination/semantic-match-tfidf.py +252 -0
- package/.claude/skills/redis-coordination/send-heartbeat.sh +164 -72
- package/.claude/skills/redis-coordination/signal.sh +38 -0
- package/.claude/skills/redis-coordination/store-context.sh +86 -0
- package/.claude/skills/redis-coordination/test-context-injection.sh +354 -0
- package/.claude/skills/redis-coordination/test-timeout-enforcement.sh +513 -0
- package/.claude/skills/redis-coordination/tests/convert-line-endings.sh +15 -0
- package/.claude/skills/redis-coordination/tests/dlq-functionality-test.sh +101 -101
- package/.claude/skills/redis-coordination/tests/edge-cases-test.sh +98 -98
- package/.claude/skills/redis-coordination/tests/integration-test.sh +169 -169
- package/.claude/skills/redis-coordination/tests/retry-mechanism-test.sh +81 -81
- package/.claude/skills/redis-coordination/tests/run-test-suite.sh +91 -91
- package/.claude/skills/redis-coordination/tests/run-tests.sh +4 -0
- package/.claude/skills/redis-coordination/tests/test-primitives.sh +166 -0
- package/.claude/skills/redis-coordination/tests/test-utils.sh +53 -121
- package/.claude/skills/redis-coordination/tests/test_coordination_primitives.sh.deprecated +20 -0
- package/.claude/skills/redis-coordination/tests/test_utils.sh +49 -0
- package/.claude/skills/redis-coordination/v2_modularization/core_orchestration.sh +76 -0
- package/.claude/skills/redis-coordination/validate-parameters.sh +492 -0
- package/.claude/skills/retrospective-report/SKILL.md +31 -0
- package/.claude/skills/retrospective-report/generate-report.sh +101 -0
- package/.claude/skills/run-all-skill-tests.sh +124 -0
- package/.claude/skills/scope-simplifier/SKILL.md +37 -0
- package/.claude/skills/scope-simplifier/simplify-scope.sh +68 -0
- package/.claude/skills/simplified-agent-lifecycle/COST_ANALYSIS.md +49 -0
- package/.claude/skills/simplified-agent-lifecycle/DESIGN.md +98 -0
- package/.claude/skills/simplified-agent-lifecycle/MIGRATION_PLAN.md +74 -0
- package/.claude/skills/specialist-injection/SKILL.md +41 -0
- package/.claude/skills/specialist-injection/recommend-specialist.sh +57 -0
- package/.claude/skills/sprint-execution/SKILL.md +27 -0
- package/.claude/skills/sprint-execution/execute-sprint-task.sh +59 -0
- package/.claude/skills/sprint-execution/execute-sprint.sh +65 -0
- package/.claude/skills/sprint-planner/SKILL.md +37 -0
- package/.claude/skills/sprint-planner/plan-sprint.sh +85 -0
- package/.claude/skills/standardized-error-handling/SKILL.md +56 -0
- package/.claude/skills/standardized-error-handling/capture-agent-error.sh +87 -0
- package/.claude/skills/standardized-error-handling/test-error-handling.sh +166 -0
- package/.claude/skills/task-classifier/SKILL.md +94 -0
- package/.claude/skills/task-classifier/classify-task.sh +115 -0
- package/.claude/skills/validation-templates/SKILL.md +47 -0
- package/.claude/skills/validation-templates/content.json +38 -0
- package/.claude/skills/validation-templates/data.json +38 -0
- package/.claude/skills/validation-templates/design.json +38 -0
- package/.claude/skills/validation-templates/infrastructure.json +38 -0
- package/.claude/skills/validation-templates/research.json +38 -0
- package/.claude/skills/validation-templates/software.json +38 -0
- package/.claude/skills/webapp-testing/README.md +142 -0
- package/.claude/skills/webapp-testing/SCREENSHOT_NAMING_CONVENTION.md +547 -0
- package/.claude/skills/webapp-testing/SKILL.md +877 -0
- package/.claude/skills/webapp-testing/capture-screenshot.sh +238 -0
- package/.claude/skills/webapp-testing/cfn-loop-integration.sh +265 -0
- package/.claude/skills/webapp-testing/compare-screenshots.sh +199 -0
- package/.claude/skills/webapp-testing/init-storage.sh +150 -0
- package/.claude/skills/webapp-testing/set-baseline.sh +196 -0
- package/.claude/skills/webapp-testing/test-webapp-testing.sh +233 -0
- package/.claude/spawn-pattern-examples.md +3 -3
- package/CLAUDE.md +319 -45
- package/README.md +598 -251
- package/dist/agents/agent-loader.js +146 -165
- package/dist/agents/agent-loader.js.map +1 -1
- package/dist/cli/agent-command.js +2 -0
- package/dist/cli/agent-command.js.map +1 -1
- package/dist/cli/agent-definition-parser.js +7 -0
- package/dist/cli/agent-definition-parser.js.map +1 -1
- package/dist/cli/agent-executor.js +145 -11
- package/dist/cli/agent-executor.js.map +1 -1
- package/dist/cli/agent-prompt-builder.js +81 -1
- package/dist/cli/agent-prompt-builder.js.map +1 -1
- package/dist/cli/agent-spawn.js +10 -1
- package/dist/cli/agent-spawn.js.map +1 -1
- package/dist/cli/anthropic-client.js +192 -13
- package/dist/cli/anthropic-client.js.map +1 -1
- package/dist/cli/cfn-context.js +150 -0
- package/dist/cli/cfn-context.js.map +1 -1
- package/dist/cli/cfn-fork.js +159 -0
- package/dist/cli/cfn-fork.js.map +1 -0
- package/dist/cli/cli-agent-context.js +8 -3
- package/dist/cli/cli-agent-context.js.map +1 -1
- package/dist/cli/config-manager.js +109 -91
- package/dist/cli/config-manager.js.map +1 -1
- package/dist/cli/conversation-fork.js +201 -0
- package/dist/cli/conversation-fork.js.map +1 -0
- package/dist/cli/index.js +4 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/tool-definitions.js +263 -0
- package/dist/cli/tool-definitions.js.map +1 -0
- package/dist/cli/tool-executor.js +247 -0
- package/dist/cli/tool-executor.js.map +1 -0
- package/dist/hello.js +8 -0
- package/dist/hello.js.map +1 -0
- package/package.json +14 -6
- package/scripts/README.md +68 -0
- package/scripts/cfn-intervention-example.sh +21 -0
- package/scripts/migrate-test-infrastructure.sh +40 -0
- package/scripts/validate-test-migration.sh +49 -0
- package/scripts/verify-no-secrets.sh +55 -0
- package/.claude/agents/architecture/system-architect.md.backup +0 -603
- package/.claude/agents/code-booster.md +0 -131
- package/.claude/agents/consensus/performance-benchmarker.md +0 -101
- package/.claude/agents/consensus/security-manager.md +0 -107
- package/.claude/agents/context-curator.md +0 -167
- package/.claude/agents/context-reflector.md +0 -65
- package/.claude/agents/core-agents/cfn-loop-coordinator.md +0 -134
- package/.claude/agents/core-agents/code-quality-validator.md +0 -149
- package/.claude/agents/core-agents/context-curator.md +0 -452
- package/.claude/agents/core-agents/context-reflector.md +0 -273
- package/.claude/agents/core-agents/cost-savings-cfn-loop-coordinator.md +0 -235
- package/.claude/agents/core-agents/tester.md +0 -170
- package/.claude/agents/development/backend-dev.md +0 -165
- package/.claude/agents/devops/devops-engineer.md +0 -148
- package/.claude/agents/frontend/interaction-tester.md +0 -139
- package/.claude/agents/frontend/react-frontend-engineer.md +0 -9
- package/.claude/agents/personas/accessibility-advocate-persona.md +0 -107
- package/.claude/agents/testing/production-validator.md +0 -179
- package/.claude/agents/testing/tdd-london-swarm.md +0 -209
- package/.claude/agents/testing/unit/tdd-london-swarm.md +0 -43
- package/.claude/agents/testing/validation/production-validator.md +0 -43
- package/.claude/api-configs/config-current-zai-config.env +0 -62
- package/.claude/api-configs/config-test-zai-config.env +0 -62
- package/.claude/api-configs/env-backups/before-anthropic-20251020-025404.env +0 -62
- package/.claude/api-configs/env-backups/before-restore-20251020-025431.env +0 -62
- package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.backup-1760949407 +0 -933
- package/dist/cli/cli-agent-context.test.js +0 -451
- package/dist/cli/cli-agent-context.test.js.map +0 -1
- package/dist/coordination/fleet-manager.test.js +0 -141
- package/dist/coordination/fleet-manager.test.js.map +0 -1
- package/dist/middleware/transparency-middleware.test.js +0 -184
- package/dist/middleware/transparency-middleware.test.js.map +0 -1
- /package/.claude/agents/{core-agents → developers}/researcher.md +0 -0
- /package/.claude/agents/{consensus → specialists}/crdt-synchronizer.md +0 -0
- /package/.claude/agents/{consensus → specialists}/quorum-manager.md +0 -0
- /package/.claude/agents/{consensus → specialists}/raft-manager.md +0 -0
- /package/.claude/{agents/core-agents → agents-ignore}/coordinator.md +0 -0
- /package/.claude/{agents/core-agents/cost-savings-coordinator.md → agents-ignore/cost-savings-coordinator.md.backup} +0 -0
- /package/.claude/skills/redis-coordination/{phase4-wake-queue-test-report.md → demos/phase4-wake-queue-test-report.md} +0 -0
- /package/.claude/skills/redis-coordination/{test-bzpopmin-fix.sh → demos/test-bzpopmin-fix.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-cancel-swarm.sh → demos/test-cancel-swarm.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-dlq.sh → demos/test-dlq.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-iteration-feedback.sh → demos/test-iteration-feedback.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-priority-wake-phase4-unix.sh → demos/test-priority-wake-phase4-unix.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-priority-wake-phase4.sh → demos/test-priority-wake-phase4.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-priority-wake.sh → demos/test-priority-wake.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-quick-fix.sh → demos/test-quick-fix.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-quorum-absolute.sh → demos/test-quorum-absolute.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-quorum-fallback.sh → demos/test-quorum-fallback.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-quorum-percentage.sh → demos/test-quorum-percentage.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-quorum-with-retry.sh → demos/test-quorum-with-retry.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-quorum.sh → demos/test-quorum.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-shutdown-handling.sh → demos/test-shutdown-handling.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-shutdown.sh → demos/test-shutdown.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-utils-unix.sh → demos/test-utils-unix.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-utils.sh → demos/test-utils.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-waiting-mode.sh → demos/test-waiting-mode.sh} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/cfn-context.ts"],"sourcesContent":["#!/usr/bin/env node\r\n/**\r\n * cfn-context - ACE context operations\r\n *\r\n * Usage:\r\n * cfn-context reflect Run ACE reflection\r\n * cfn-context curate Merge contexts\r\n * cfn-context inject Inject into tasks\r\n * cfn-context query Search contexts\r\n * cfn-context stats Show analytics\r\n */\r\n\r\nimport { spawn } from 'child_process';\r\n\r\ninterface ContextOptions {\r\n category?: string;\r\n tags?: string;\r\n confidence?: number;\r\n limit?: number;\r\n taskId?: string;\r\n phase?: string;\r\n}\r\n\r\nfunction parseArgs(args: string[]): { subcommand: string; query?: string; options: ContextOptions } {\r\n const subcommand = args[0] || 'stats';\r\n let query: string | undefined;\r\n const options: ContextOptions = {};\r\n\r\n // For query subcommand, first arg after subcommand is the query\r\n if (subcommand === 'query' && args[1] && !args[1].startsWith('--')) {\r\n query = args[1];\r\n }\r\n\r\n for (let i = 1; i < args.length; i += 2) {\r\n const key = args[i];\r\n const value = args[i + 1];\r\n\r\n switch (key) {\r\n case '--category':\r\n options.category = value;\r\n break;\r\n case '--tags':\r\n options.tags = value;\r\n break;\r\n case '--confidence':\r\n options.confidence = parseFloat(value);\r\n break;\r\n case '--limit':\r\n options.limit = parseInt(value, 10);\r\n break;\r\n case '--task-id':\r\n options.taskId = value;\r\n break;\r\n case '--phase':\r\n options.phase = value;\r\n break;\r\n }\r\n }\r\n\r\n return { subcommand, query, options };\r\n}\r\n\r\nasync function executeContext(subcommand: string, query: string | undefined, options: ContextOptions): Promise<void> {\r\n let slashCommand: string;\r\n\r\n switch (subcommand) {\r\n case 'reflect':\r\n slashCommand = '/context-reflect';\r\n if (options.taskId) slashCommand += ` --task-id ${options.taskId}`;\r\n break;\r\n\r\n case 'curate':\r\n slashCommand = '/context-curate';\r\n break;\r\n\r\n case 'inject':\r\n slashCommand = '/context-inject';\r\n if (options.taskId) slashCommand += ` --task-id ${options.taskId}`;\r\n if (options.phase) slashCommand += ` --phase ${options.phase}`;\r\n break;\r\n\r\n case 'query':\r\n if (!query) {\r\n console.error('Error: Query string required for query subcommand');\r\n console.error('Usage: cfn-context query <search-term> [options]');\r\n process.exit(1);\r\n }\r\n slashCommand = `/context-query \"${query}\"`;\r\n if (options.category) slashCommand += ` --category ${options.category}`;\r\n if (options.tags) slashCommand += ` --tags ${options.tags}`;\r\n if (options.confidence) slashCommand += ` --confidence ${options.confidence}`;\r\n break;\r\n\r\n case 'stats':\r\n slashCommand = '/context-stats';\r\n break;\r\n\r\n default:\r\n console.error(`Unknown subcommand: ${subcommand}`);\r\n console.error('Valid subcommands: reflect, curate, inject, query, stats');\r\n process.exit(1);\r\n }\r\n\r\n console.log(`[cfn-context] Executing: ${slashCommand}`);\r\n console.log('[cfn-context] Note: This delegates to claude-flow-novice slash commands');\r\n console.log('[cfn-context] Use Claude Code CLI for actual execution\\n');\r\n\r\n console.log('To execute this context operation, run in Claude Code:');\r\n console.log(` ${slashCommand}`);\r\n}\r\n\r\nfunction showHelp(): void {\r\n console.log(`\r\ncfn-context - ACE Context Operations CLI\r\n\r\nUsage:\r\n cfn-context reflect [options] Run ACE reflection on recent tasks\r\n cfn-context curate Merge reflection deltas into context\r\n cfn-context inject [options] Inject context into tasks\r\n cfn-context query <term> [options] Search contexts\r\n cfn-context stats Show context analytics\r\n\r\nOptions (reflect):\r\n --task-id <id> Reflect on specific task\r\n\r\nOptions (inject):\r\n --task-id <id> Inject into specific task\r\n --phase <name> Inject based on phase\r\n\r\nOptions (query):\r\n --category <cat> Filter by category\r\n --tags <tags> Filter by tags (comma-separated)\r\n --confidence <n> Minimum confidence score (0-1)\r\n --limit <n> Max results\r\n\r\nExamples:\r\n cfn-context reflect --task-id task-123\r\n cfn-context curate\r\n cfn-context inject --phase implementation\r\n cfn-context query \"redis coordination\" --category technical\r\n cfn-context stats\r\n\r\nContext Categories:\r\n technical Technical patterns and solutions\r\n architectural Design decisions and patterns\r\n operational Deployment and operations\r\n quality Testing and quality practices\r\n\r\nFor more info: https://docs.claude.com/cfn-context\r\n `);\r\n}\r\n\r\nasync function main(args: string[] = process.argv.slice(2)): Promise<void> {\r\n if (args.includes('--help') || args.includes('-h')) {\r\n showHelp();\r\n return;\r\n }\r\n\r\n const { subcommand, query, options } = parseArgs(args);\r\n await executeContext(subcommand, query, options);\r\n}\r\n\r\n// Run if called directly\r\nconst isMainModule = import.meta.url.endsWith(process.argv[1]?.replace(/\\\\/g, '/') || '');\r\nif (isMainModule) {\r\n main().catch((err) => {\r\n console.error('[cfn-context] Fatal error:', err);\r\n process.exit(1);\r\n });\r\n}\r\n\r\nexport { main };\r\n"],"names":["parseArgs","args","subcommand","query","options","startsWith","i","length","key","value","category","tags","confidence","parseFloat","limit","parseInt","taskId","phase","executeContext","slashCommand","console","error","process","exit","log","showHelp","main","argv","slice","includes","isMainModule","url","endsWith","replace","catch","err"],"mapp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,OAAO,QAAQ;AACtF,IAAIH,cAAc;IAChBJ,OAAOQ,KAAK,CAAC,CAACC;QACZf,QAAQC,KAAK,CAAC,8BAA8Bc;QAC5Cb,QAAQC,IAAI,CAAC;IACf;AACF;AAEA,SAASG,IAAI,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../../src/cli/cfn-context.ts"],"sourcesContent":["#!/usr/bin/env node\r\n/**\r\n * cfn-context - Epic context operations for CLI agents\r\n *\r\n * Provides functions to:\r\n * 1. Load epic/phase context from Redis\r\n * 2. Store epic/phase context to Redis\r\n * 3. Format context for agent system prompts\r\n *\r\n * Also provides ACE context operations CLI:\r\n * cfn-context reflect Run ACE reflection\r\n * cfn-context curate Merge contexts\r\n * cfn-context inject Inject into tasks\r\n * cfn-context query Search contexts\r\n * cfn-context stats Show analytics\r\n */\r\n\r\nimport { spawn } from 'child_process';\r\nimport { exec } from 'child_process';\r\nimport { promisify } from 'util';\r\n\r\nconst execAsync = promisify(exec);\r\n\r\n// ============================================================================\r\n// Epic Context Interfaces (for CLI Agent System Prompts)\r\n// ============================================================================\r\n\r\nexport interface EpicContextData {\r\n epicGoal?: string;\r\n epicName?: string;\r\n inScope?: string[];\r\n outOfScope?: string[];\r\n phases?: string[];\r\n currentPhase?: string;\r\n riskProfile?: string;\r\n stakeholders?: string[];\r\n references?: string[];\r\n timeline?: {\r\n start?: string;\r\n end?: string;\r\n milestones?: Array<{ phase: string; date: string }>;\r\n };\r\n}\r\n\r\nexport interface PhaseContextData {\r\n phaseName?: string;\r\n phaseNumber?: number;\r\n dependencies?: string[];\r\n deliverables?: string[];\r\n blockers?: string[];\r\n resources?: {\r\n agentCount?: number;\r\n estimatedDuration?: number;\r\n costBudget?: number;\r\n };\r\n}\r\n\r\nexport interface SuccessCriteriaData {\r\n acceptanceCriteria?: string[];\r\n gateThreshold?: number;\r\n consensusThreshold?: number;\r\n qualityGates?: {\r\n testCoverage?: number;\r\n securityScore?: number;\r\n performanceBudget?: number;\r\n };\r\n definitionOfDone?: string[];\r\n nonFunctionalRequirements?: string[];\r\n}\r\n\r\n// ============================================================================\r\n// Redis Epic Context Functions\r\n// ============================================================================\r\n\r\n/**\r\n * Load epic context from Redis\r\n *\r\n * Redis key: swarm:{taskId}:epic-context\r\n */\r\nexport async function loadEpicContext(taskId: string): Promise<EpicContextData | null> {\r\n try {\r\n const { stdout } = await execAsync(`redis-cli get \"swarm:${taskId}:epic-context\"`);\r\n const result = stdout.trim();\r\n\r\n if (result === '(nil)' || !result) {\r\n return null;\r\n }\r\n\r\n return JSON.parse(result) as EpicContextData;\r\n } catch (error) {\r\n console.warn(`[cfn-context] Failed to load epic context for task ${taskId}:`, error);\r\n return null;\r\n }\r\n}\r\n\r\n/**\r\n * Load phase context from Redis\r\n *\r\n * Redis key: swarm:{taskId}:phase-context\r\n */\r\nexport async function loadPhaseContext(taskId: string): Promise<PhaseContextData | null> {\r\n try {\r\n const { stdout } = await execAsync(`redis-cli get \"swarm:${taskId}:phase-context\"`);\r\n const result = stdout.trim();\r\n\r\n if (result === '(nil)' || !result) {\r\n return null;\r\n }\r\n\r\n return JSON.parse(result) as PhaseContextData;\r\n } catch (error) {\r\n console.warn(`[cfn-context] Failed to load phase context for task ${taskId}:`, error);\r\n return null;\r\n }\r\n}\r\n\r\n/**\r\n * Load success criteria from Redis\r\n *\r\n * Redis key: swarm:{taskId}:success-criteria\r\n */\r\nexport async function loadSuccessCriteria(taskId: string): Promise<SuccessCriteriaData | null> {\r\n try {\r\n const { stdout } = await execAsync(`redis-cli get \"swarm:${taskId}:success-criteria\"`);\r\n const result = stdout.trim();\r\n\r\n if (result === '(nil)' || !result) {\r\n return null;\r\n }\r\n\r\n return JSON.parse(result) as SuccessCriteriaData;\r\n } catch (error) {\r\n console.warn(`[cfn-context] Failed to load success criteria for task ${taskId}:`, error);\r\n return null;\r\n }\r\n}\r\n\r\n/**\r\n * Store epic context to Redis\r\n *\r\n * Redis key: swarm:{taskId}:epic-context\r\n * TTL: 7 days\r\n */\r\nexport async function storeEpicContext(taskId: string, context: EpicContextData): Promise<boolean> {\r\n try {\r\n const contextJson = JSON.stringify(context);\r\n await execAsync(`redis-cli setex \"swarm:${taskId}:epic-context\" 604800 '${contextJson.replace(/'/g, \"\\\\'\")}'`);\r\n console.log(`[cfn-context] Stored epic context for task ${taskId}`);\r\n return true;\r\n } catch (error) {\r\n console.error(`[cfn-context] Failed to store epic context for task ${taskId}:`, error);\r\n return false;\r\n }\r\n}\r\n\r\n/**\r\n * Store phase context to Redis\r\n *\r\n * Redis key: swarm:{taskId}:phase-context\r\n * TTL: 7 days\r\n */\r\nexport async function storePhaseContext(taskId: string, context: PhaseContextData): Promise<boolean> {\r\n try {\r\n const contextJson = JSON.stringify(context);\r\n await execAsync(`redis-cli setex \"swarm:${taskId}:phase-context\" 604800 '${contextJson.replace(/'/g, \"\\\\'\")}'`);\r\n console.log(`[cfn-context] Stored phase context for task ${taskId}`);\r\n return true;\r\n } catch (error) {\r\n console.error(`[cfn-context] Failed to store phase context for task ${taskId}:`, error);\r\n return false;\r\n }\r\n}\r\n\r\n/**\r\n * Store success criteria to Redis\r\n *\r\n * Redis key: swarm:{taskId}:success-criteria\r\n * TTL: 7 days\r\n */\r\nexport async function storeSuccessCriteria(taskId: string, criteria: SuccessCriteriaData): Promise<boolean> {\r\n try {\r\n const criteriaJson = JSON.stringify(criteria);\r\n await execAsync(`redis-cli setex \"swarm:${taskId}:success-criteria\" 604800 '${criteriaJson.replace(/'/g, \"\\\\'\")}'`);\r\n console.log(`[cfn-context] Stored success criteria for task ${taskId}`);\r\n return true;\r\n } catch (error) {\r\n console.error(`[cfn-context] Failed to store success criteria for task ${taskId}:`, error);\r\n return false;\r\n }\r\n}\r\n\r\n/**\r\n * Format epic context as markdown for system prompt\r\n */\r\nexport function formatEpicContextForPrompt(epic: EpicContextData): string {\r\n if (!epic.epicGoal && !epic.inScope && !epic.outOfScope) {\r\n return '';\r\n }\r\n\r\n const sections: string[] = [];\r\n\r\n sections.push('## Epic Context');\r\n sections.push('');\r\n\r\n if (epic.epicName) {\r\n sections.push(`**Epic:** ${epic.epicName}`);\r\n sections.push('');\r\n }\r\n\r\n if (epic.epicGoal) {\r\n sections.push('**Goal:**');\r\n sections.push(epic.epicGoal);\r\n sections.push('');\r\n }\r\n\r\n if (epic.currentPhase) {\r\n sections.push(`**Current Phase:** ${epic.currentPhase}`);\r\n sections.push('');\r\n }\r\n\r\n if (epic.inScope && epic.inScope.length > 0) {\r\n sections.push('**In Scope:**');\r\n for (const item of epic.inScope) {\r\n sections.push(`- ${item}`);\r\n }\r\n sections.push('');\r\n }\r\n\r\n if (epic.outOfScope && epic.outOfScope.length > 0) {\r\n sections.push('**Out of Scope:**');\r\n for (const item of epic.outOfScope) {\r\n sections.push(`- ${item}`);\r\n }\r\n sections.push('');\r\n }\r\n\r\n if (epic.references && epic.references.length > 0) {\r\n sections.push('**References:**');\r\n for (const ref of epic.references) {\r\n sections.push(`- ${ref}`);\r\n }\r\n sections.push('');\r\n }\r\n\r\n return sections.join('\\n');\r\n}\r\n\r\n// ============================================================================\r\n// ACE Context Operations CLI (Original Functionality)\r\n// ============================================================================\r\n\r\ninterface ContextOptions {\r\n category?: string;\r\n tags?: string;\r\n confidence?: number;\r\n limit?: number;\r\n taskId?: string;\r\n phase?: string;\r\n}\r\n\r\nfunction parseArgs(args: string[]): { subcommand: string; query?: string; options: ContextOptions } {\r\n const subcommand = args[0] || 'stats';\r\n let query: string | undefined;\r\n const options: ContextOptions = {};\r\n\r\n // For query subcommand, first arg after subcommand is the query\r\n if (subcommand === 'query' && args[1] && !args[1].startsWith('--')) {\r\n query = args[1];\r\n }\r\n\r\n for (let i = 1; i < args.length; i += 2) {\r\n const key = args[i];\r\n const value = args[i + 1];\r\n\r\n switch (key) {\r\n case '--category':\r\n options.category = value;\r\n break;\r\n case '--tags':\r\n options.tags = value;\r\n break;\r\n case '--confidence':\r\n options.confidence = parseFloat(value);\r\n break;\r\n case '--limit':\r\n options.limit = parseInt(value, 10);\r\n break;\r\n case '--task-id':\r\n options.taskId = value;\r\n break;\r\n case '--phase':\r\n options.phase = value;\r\n break;\r\n }\r\n }\r\n\r\n return { subcommand, query, options };\r\n}\r\n\r\nasync function executeContext(subcommand: string, query: string | undefined, options: ContextOptions): Promise<void> {\r\n let slashCommand: string;\r\n\r\n switch (subcommand) {\r\n case 'reflect':\r\n slashCommand = '/context-reflect';\r\n if (options.taskId) slashCommand += ` --task-id ${options.taskId}`;\r\n break;\r\n\r\n case 'curate':\r\n slashCommand = '/context-curate';\r\n break;\r\n\r\n case 'inject':\r\n slashCommand = '/context-inject';\r\n if (options.taskId) slashCommand += ` --task-id ${options.taskId}`;\r\n if (options.phase) slashCommand += ` --phase ${options.phase}`;\r\n break;\r\n\r\n case 'query':\r\n if (!query) {\r\n console.error('Error: Query string required for query subcommand');\r\n console.error('Usage: cfn-context query <search-term> [options]');\r\n process.exit(1);\r\n }\r\n slashCommand = `/context-query \"${query}\"`;\r\n if (options.category) slashCommand += ` --category ${options.category}`;\r\n if (options.tags) slashCommand += ` --tags ${options.tags}`;\r\n if (options.confidence) slashCommand += ` --confidence ${options.confidence}`;\r\n break;\r\n\r\n case 'stats':\r\n slashCommand = '/context-stats';\r\n break;\r\n\r\n default:\r\n console.error(`Unknown subcommand: ${subcommand}`);\r\n console.error('Valid subcommands: reflect, curate, inject, query, stats');\r\n process.exit(1);\r\n }\r\n\r\n console.log(`[cfn-context] Executing: ${slashCommand}`);\r\n console.log('[cfn-context] Note: This delegates to claude-flow-novice slash commands');\r\n console.log('[cfn-context] Use Claude Code CLI for actual execution\\n');\r\n\r\n console.log('To execute this context operation, run in Claude Code:');\r\n console.log(` ${slashCommand}`);\r\n}\r\n\r\nfunction showHelp(): void {\r\n console.log(`\r\ncfn-context - ACE Context Operations CLI\r\n\r\nUsage:\r\n cfn-context reflect [options] Run ACE reflection on recent tasks\r\n cfn-context curate Merge reflection deltas into context\r\n cfn-context inject [options] Inject context into tasks\r\n cfn-context query <term> [options] Search contexts\r\n cfn-context stats Show context analytics\r\n\r\nOptions (reflect):\r\n --task-id <id> Reflect on specific task\r\n\r\nOptions (inject):\r\n --task-id <id> Inject into specific task\r\n --phase <name> Inject based on phase\r\n\r\nOptions (query):\r\n --category <cat> Filter by category\r\n --tags <tags> Filter by tags (comma-separated)\r\n --confidence <n> Minimum confidence score (0-1)\r\n --limit <n> Max results\r\n\r\nExamples:\r\n cfn-context reflect --task-id task-123\r\n cfn-context curate\r\n cfn-context inject --phase implementation\r\n cfn-context query \"redis coordination\" --category technical\r\n cfn-context stats\r\n\r\nContext Categories:\r\n technical Technical patterns and solutions\r\n architectural Design decisions and patterns\r\n operational Deployment and operations\r\n quality Testing and quality practices\r\n\r\nFor more info: https://docs.claude.com/cfn-context\r\n `);\r\n}\r\n\r\nasync function main(args: string[] = process.argv.slice(2)): Promise<void> {\r\n if (args.includes('--help') || args.includes('-h')) {\r\n showHelp();\r\n return;\r\n }\r\n\r\n const { subcommand, query, options } = parseArgs(args);\r\n await executeContext(subcommand, query, options);\r\n}\r\n\r\n// Run if called directly\r\nconst isMainModule = import.meta.url.endsWith(process.argv[1]?.replace(/\\\\/g, '/') || '');\r\nif (isMainModule) {\r\n main().catch((err) => {\r\n console.error('[cfn-context] Fatal error:', err);\r\n process.exit(1);\r\n });\r\n}\r\n\r\nexport { main };\r\n"],"names":["exec","promisify","execAsync","loadEpicContext","taskId","stdout","result","trim","JSON","parse","error","console","warn","loadPhaseContext","loadSuccessCriteria","storeEpicContext","context","contextJson","stringify","replace","log","storePhaseContext","storeSuccessCriteria","criteria","criteriaJson","formatEpicContextForPrompt","epic","epicGoal","inScope","outOfScope","sections","push","epicName","currentPhase","length","item","references","ref","join","parseArgs","args","subcommand","query","options","startsWith","i","key","value","category","tags","confidence","parseFloat","limit","parseInt","phase","executeContext","slashCommand","process","exit","showHelp","main","argv","slice","includes","isMainModule","url","endsWith","catch","err"],"mappings":";AAkBA,SAASA,IAAI,QAAQ,gBAAgB;AACrC,SAASC,SAAS,QA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,UAAUC;IACjD,MAAMe,eAAed,YAAYC,OAAOC;AAC1C;AAEA,yBAAyB;AACzB,MAAMqB,eAAe,YAAYC,GAAG,CAACC,QAAQ,CAACT,QAAQI,IAAI,CAAC,EAAE,EAAE1C,QAAQ,OAAO,QAAQ;AACtF,IAAI6C,cAAc;IAChBJ,OAAOO,KAAK,CAAC,CAACC;QACZzD,QAAQD,KAAK,CAAC,8BAA8B0D;QAC5CX,QAAQC,IAAI,CAAC;IACf;AACF;AAEA,SAASE,IAAI,GAAG"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* CLI utility for managing conversation forks
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* npx cfn-fork create --task-id <id> --agent-id <id> --iteration <n>
|
|
7
|
+
* npx cfn-fork get --task-id <id> --agent-id <id>
|
|
8
|
+
* npx cfn-fork list --task-id <id> --agent-id <id>
|
|
9
|
+
* npx cfn-fork delete --task-id <id> --agent-id <id> --fork-id <id>
|
|
10
|
+
* npx cfn-fork stats --task-id <id> --agent-id <id> [--fork-id <id>]
|
|
11
|
+
*/ import { createFork, getCurrentFork, listForks, deleteFork, getConversationStats, getForkMetadata } from './conversation-fork.js';
|
|
12
|
+
function parseArgs() {
|
|
13
|
+
const args = process.argv.slice(2);
|
|
14
|
+
const result = {
|
|
15
|
+
command: args[0] || 'help'
|
|
16
|
+
};
|
|
17
|
+
for(let i = 1; i < args.length; i += 2){
|
|
18
|
+
const key = args[i].replace(/^--/, '');
|
|
19
|
+
const value = args[i + 1];
|
|
20
|
+
switch(key){
|
|
21
|
+
case 'task-id':
|
|
22
|
+
result.taskId = value;
|
|
23
|
+
break;
|
|
24
|
+
case 'agent-id':
|
|
25
|
+
result.agentId = value;
|
|
26
|
+
break;
|
|
27
|
+
case 'iteration':
|
|
28
|
+
result.iteration = parseInt(value, 10);
|
|
29
|
+
break;
|
|
30
|
+
case 'fork-id':
|
|
31
|
+
result.forkId = value;
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
async function main() {
|
|
38
|
+
const args = parseArgs();
|
|
39
|
+
try {
|
|
40
|
+
switch(args.command){
|
|
41
|
+
case 'create':
|
|
42
|
+
{
|
|
43
|
+
if (!args.taskId || !args.agentId || !args.iteration) {
|
|
44
|
+
console.error('Error: --task-id, --agent-id, and --iteration are required');
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
const forkId = await createFork(args.taskId, args.agentId, args.iteration);
|
|
48
|
+
console.log(forkId); // Output just the fork ID for easy capture in bash
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
case 'get':
|
|
52
|
+
{
|
|
53
|
+
if (!args.taskId || !args.agentId) {
|
|
54
|
+
console.error('Error: --task-id and --agent-id are required');
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
const forkId = await getCurrentFork(args.taskId, args.agentId);
|
|
58
|
+
if (forkId) {
|
|
59
|
+
console.log(forkId);
|
|
60
|
+
} else {
|
|
61
|
+
console.log('(no fork)');
|
|
62
|
+
}
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
case 'list':
|
|
66
|
+
{
|
|
67
|
+
if (!args.taskId || !args.agentId) {
|
|
68
|
+
console.error('Error: --task-id and --agent-id are required');
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
const forks = await listForks(args.taskId, args.agentId);
|
|
72
|
+
if (forks.length === 0) {
|
|
73
|
+
console.log('No forks found');
|
|
74
|
+
} else {
|
|
75
|
+
console.log(JSON.stringify(forks, null, 2));
|
|
76
|
+
}
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
case 'delete':
|
|
80
|
+
{
|
|
81
|
+
if (!args.taskId || !args.agentId || !args.forkId) {
|
|
82
|
+
console.error('Error: --task-id, --agent-id, and --fork-id are required');
|
|
83
|
+
process.exit(1);
|
|
84
|
+
}
|
|
85
|
+
await deleteFork(args.taskId, args.agentId, args.forkId);
|
|
86
|
+
console.log(`Fork ${args.forkId} deleted`);
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
case 'stats':
|
|
90
|
+
{
|
|
91
|
+
if (!args.taskId || !args.agentId) {
|
|
92
|
+
console.error('Error: --task-id and --agent-id are required');
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|
|
95
|
+
const stats = await getConversationStats(args.taskId, args.agentId, args.forkId);
|
|
96
|
+
console.log(JSON.stringify(stats, null, 2));
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
case 'meta':
|
|
100
|
+
{
|
|
101
|
+
if (!args.taskId || !args.agentId || !args.forkId) {
|
|
102
|
+
console.error('Error: --task-id, --agent-id, and --fork-id are required');
|
|
103
|
+
process.exit(1);
|
|
104
|
+
}
|
|
105
|
+
const metadata = await getForkMetadata(args.taskId, args.agentId, args.forkId);
|
|
106
|
+
if (metadata) {
|
|
107
|
+
console.log(JSON.stringify(metadata, null, 2));
|
|
108
|
+
} else {
|
|
109
|
+
console.log('Fork not found');
|
|
110
|
+
process.exit(1);
|
|
111
|
+
}
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
case 'help':
|
|
115
|
+
default:
|
|
116
|
+
console.log(`
|
|
117
|
+
CFN Fork - Conversation Fork Management
|
|
118
|
+
|
|
119
|
+
Usage:
|
|
120
|
+
npx cfn-fork <command> [options]
|
|
121
|
+
|
|
122
|
+
Commands:
|
|
123
|
+
create Create a new fork from current conversation state
|
|
124
|
+
get Get current active fork ID
|
|
125
|
+
list List all forks for an agent
|
|
126
|
+
delete Delete a specific fork
|
|
127
|
+
stats Get conversation statistics
|
|
128
|
+
meta Get fork metadata
|
|
129
|
+
help Show this help message
|
|
130
|
+
|
|
131
|
+
Options:
|
|
132
|
+
--task-id <id> Task ID (required for all commands)
|
|
133
|
+
--agent-id <id> Agent ID (required for all commands)
|
|
134
|
+
--iteration <n> Iteration number (required for create)
|
|
135
|
+
--fork-id <id> Fork ID (required for delete and meta)
|
|
136
|
+
|
|
137
|
+
Examples:
|
|
138
|
+
# Create a fork after iteration 1
|
|
139
|
+
npx cfn-fork create --task-id epic-123 --agent-id coder-1 --iteration 1
|
|
140
|
+
|
|
141
|
+
# Get current fork
|
|
142
|
+
npx cfn-fork get --task-id epic-123 --agent-id coder-1
|
|
143
|
+
|
|
144
|
+
# List all forks
|
|
145
|
+
npx cfn-fork list --task-id epic-123 --agent-id coder-1
|
|
146
|
+
|
|
147
|
+
# Get conversation stats
|
|
148
|
+
npx cfn-fork stats --task-id epic-123 --agent-id coder-1
|
|
149
|
+
`);
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
} catch (error) {
|
|
153
|
+
console.error('Error:', error instanceof Error ? error.message : String(error));
|
|
154
|
+
process.exit(1);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
main();
|
|
158
|
+
|
|
159
|
+
//# sourceMappingURL=cfn-fork.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/cli/cfn-fork.ts"],"sourcesContent":["#!/usr/bin/env node\r\n/**\r\n * CLI utility for managing conversation forks\r\n *\r\n * Usage:\r\n * npx cfn-fork create --task-id <id> --agent-id <id> --iteration <n>\r\n * npx cfn-fork get --task-id <id> --agent-id <id>\r\n * npx cfn-fork list --task-id <id> --agent-id <id>\r\n * npx cfn-fork delete --task-id <id> --agent-id <id> --fork-id <id>\r\n * npx cfn-fork stats --task-id <id> --agent-id <id> [--fork-id <id>]\r\n */\r\n\r\nimport {\r\n createFork,\r\n getCurrentFork,\r\n listForks,\r\n deleteFork,\r\n getConversationStats,\r\n getForkMetadata\r\n} from './conversation-fork.js';\r\n\r\ninterface CLIArgs {\r\n command: string;\r\n taskId?: string;\r\n agentId?: string;\r\n iteration?: number;\r\n forkId?: string;\r\n}\r\n\r\nfunction parseArgs(): CLIArgs {\r\n const args = process.argv.slice(2);\r\n const result: CLIArgs = {\r\n command: args[0] || 'help'\r\n };\r\n\r\n for (let i = 1; i < args.length; i += 2) {\r\n const key = args[i].replace(/^--/, '');\r\n const value = args[i + 1];\r\n\r\n switch (key) {\r\n case 'task-id':\r\n result.taskId = value;\r\n break;\r\n case 'agent-id':\r\n result.agentId = value;\r\n break;\r\n case 'iteration':\r\n result.iteration = parseInt(value, 10);\r\n break;\r\n case 'fork-id':\r\n result.forkId = value;\r\n break;\r\n }\r\n }\r\n\r\n return result;\r\n}\r\n\r\nasync function main() {\r\n const args = parseArgs();\r\n\r\n try {\r\n switch (args.command) {\r\n case 'create': {\r\n if (!args.taskId || !args.agentId || !args.iteration) {\r\n console.error('Error: --task-id, --agent-id, and --iteration are required');\r\n process.exit(1);\r\n }\r\n\r\n const forkId = await createFork(args.taskId, args.agentId, args.iteration);\r\n console.log(forkId); // Output just the fork ID for easy capture in bash\r\n break;\r\n }\r\n\r\n case 'get': {\r\n if (!args.taskId || !args.agentId) {\r\n console.error('Error: --task-id and --agent-id are required');\r\n process.exit(1);\r\n }\r\n\r\n const forkId = await getCurrentFork(args.taskId, args.agentId);\r\n if (forkId) {\r\n console.log(forkId);\r\n } else {\r\n console.log('(no fork)');\r\n }\r\n break;\r\n }\r\n\r\n case 'list': {\r\n if (!args.taskId || !args.agentId) {\r\n console.error('Error: --task-id and --agent-id are required');\r\n process.exit(1);\r\n }\r\n\r\n const forks = await listForks(args.taskId, args.agentId);\r\n if (forks.length === 0) {\r\n console.log('No forks found');\r\n } else {\r\n console.log(JSON.stringify(forks, null, 2));\r\n }\r\n break;\r\n }\r\n\r\n case 'delete': {\r\n if (!args.taskId || !args.agentId || !args.forkId) {\r\n console.error('Error: --task-id, --agent-id, and --fork-id are required');\r\n process.exit(1);\r\n }\r\n\r\n await deleteFork(args.taskId, args.agentId, args.forkId);\r\n console.log(`Fork ${args.forkId} deleted`);\r\n break;\r\n }\r\n\r\n case 'stats': {\r\n if (!args.taskId || !args.agentId) {\r\n console.error('Error: --task-id and --agent-id are required');\r\n process.exit(1);\r\n }\r\n\r\n const stats = await getConversationStats(args.taskId, args.agentId, args.forkId);\r\n console.log(JSON.stringify(stats, null, 2));\r\n break;\r\n }\r\n\r\n case 'meta': {\r\n if (!args.taskId || !args.agentId || !args.forkId) {\r\n console.error('Error: --task-id, --agent-id, and --fork-id are required');\r\n process.exit(1);\r\n }\r\n\r\n const metadata = await getForkMetadata(args.taskId, args.agentId, args.forkId);\r\n if (metadata) {\r\n console.log(JSON.stringify(metadata, null, 2));\r\n } else {\r\n console.log('Fork not found');\r\n process.exit(1);\r\n }\r\n break;\r\n }\r\n\r\n case 'help':\r\n default:\r\n console.log(`\r\nCFN Fork - Conversation Fork Management\r\n\r\nUsage:\r\n npx cfn-fork <command> [options]\r\n\r\nCommands:\r\n create Create a new fork from current conversation state\r\n get Get current active fork ID\r\n list List all forks for an agent\r\n delete Delete a specific fork\r\n stats Get conversation statistics\r\n meta Get fork metadata\r\n help Show this help message\r\n\r\nOptions:\r\n --task-id <id> Task ID (required for all commands)\r\n --agent-id <id> Agent ID (required for all commands)\r\n --iteration <n> Iteration number (required for create)\r\n --fork-id <id> Fork ID (required for delete and meta)\r\n\r\nExamples:\r\n # Create a fork after iteration 1\r\n npx cfn-fork create --task-id epic-123 --agent-id coder-1 --iteration 1\r\n\r\n # Get current fork\r\n npx cfn-fork get --task-id epic-123 --agent-id coder-1\r\n\r\n # List all forks\r\n npx cfn-fork list --task-id epic-123 --agent-id coder-1\r\n\r\n # Get conversation stats\r\n npx cfn-fork stats --task-id epic-123 --agent-id coder-1\r\n `);\r\n break;\r\n }\r\n } catch (error) {\r\n console.error('Error:', error instanceof Error ? error.message : String(error));\r\n process.exit(1);\r\n }\r\n}\r\n\r\nmain();\r\n"],"names":["createFork","getCurrentFork","listForks","deleteFork","getConversationStats","getForkMetadata","parseArgs","args","process","argv","slice","result","command","i","length","key","replace","value","taskId","agentId","iteration","parseInt","forkId","main","console","error","exit","log","forks","JSON","stringify","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B,KAAKW,MAAM,IAAI,CAACX,KAAKY,OAAO,IAAI,CAACZ,KAAKe,MAAM,EAAE;wBACjDE,QAAQC,KAAK,CAAC;wBACdjB,QAAQkB,IAAI,CAAC;oBACf;oBAEA,MAAMM,WAAW,MAAM3B,gBAAgBE,KAAKW,MAAM,EAAEX,KAAKY,OAAO,EAAEZ,KAAKe,MAAM;oBAC7E,IAAIU,UAAU;wBACZR,QAAQG,GAAG,CAACE,KAAKC,SAAS,CAACE,UAAU,MAAM;oBAC7C,OAAO;wBACLR,QAAQG,GAAG,CAAC;wBACZnB,QAAQkB,IAAI,CAAC;oBACf;oBACA;gBACF;YAEA,KAAK;YACL;gBACEF,QAAQG,GAAG,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAiCb,CAAC;gBACD;QACJ;IACF,EAAE,OAAOF,OAAO;QACdD,QAAQC,KAAK,CAAC,UAAUA,iBAAiBQ,QAAQR,MAAMS,OAAO,GAAGC,OAAOV;QACxEjB,QAAQkB,IAAI,CAAC;IACf;AACF;AAEAH"}
|
|
@@ -30,11 +30,16 @@ import path from 'path';
|
|
|
30
30
|
try {
|
|
31
31
|
// Search in .claude/agents/ subdirectories
|
|
32
32
|
const searchPaths = [
|
|
33
|
+
path.join(process.cwd(), '.claude', 'agents', 'coordinators', `${agentType}.md`),
|
|
33
34
|
path.join(process.cwd(), '.claude', 'agents', 'core-agents', `${agentType}.md`),
|
|
34
|
-
path.join(process.cwd(), '.claude', 'agents', '
|
|
35
|
-
path.join(process.cwd(), '.claude', 'agents', '
|
|
35
|
+
path.join(process.cwd(), '.claude', 'agents', 'developers', `${agentType}.md`),
|
|
36
|
+
path.join(process.cwd(), '.claude', 'agents', 'specialists', `${agentType}.md`),
|
|
37
|
+
path.join(process.cwd(), '.claude', 'agents', 'testers', `${agentType}.md`),
|
|
38
|
+
path.join(process.cwd(), '.claude', 'agents', 'planners', `${agentType}.md`),
|
|
39
|
+
path.join(process.cwd(), '.claude', 'agents', 'frontend', `${agentType}.md`),
|
|
36
40
|
path.join(process.cwd(), '.claude', 'agents', 'security', `${agentType}.md`),
|
|
37
|
-
path.join(process.cwd(), '.claude', 'agents', 'custom', `${agentType}.md`)
|
|
41
|
+
path.join(process.cwd(), '.claude', 'agents', 'custom', `${agentType}.md`),
|
|
42
|
+
path.join(process.cwd(), '.claude', 'agents', `${agentType}.md`)
|
|
38
43
|
];
|
|
39
44
|
for (const searchPath of searchPaths){
|
|
40
45
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/cli-agent-context.ts"],"sourcesContent":["/**\r\n * CLI Agent Context Builder\r\n *\r\n * Builds natural language system prompts for CLI-spawned agents.\r\n * Converts JSON context from Redis into readable markdown format.\r\n *\r\n * Phase 1: System Prompts Enhancement (Sprint 2)\r\n * - Load CLAUDE.md (project rules)\r\n * - Load agent markdown template\r\n * - Format epic/phase/success criteria as natural language\r\n * - Build comprehensive system prompt for API execution\r\n */\r\n\r\nimport fs from 'fs/promises';\r\nimport path from 'path';\r\n\r\nexport interface EpicContext {\r\n epicGoal?: string;\r\n inScope?: string[];\r\n outOfScope?: string[];\r\n phases?: string[];\r\n riskProfile?: string;\r\n stakeholders?: string[];\r\n timeline?: {\r\n start?: string;\r\n end?: string;\r\n milestones?: Array<{ phase: string; date: string }>;\r\n };\r\n}\r\n\r\nexport interface PhaseContext {\r\n currentPhase?: string;\r\n phaseNumber?: number;\r\n dependencies?: string[];\r\n deliverables?: string[];\r\n blockers?: string[];\r\n resources?: {\r\n agentCount?: number;\r\n estimatedDuration?: number;\r\n costBudget?: number;\r\n };\r\n}\r\n\r\nexport interface SuccessCriteria {\r\n acceptanceCriteria?: string[];\r\n gateThreshold?: number;\r\n consensusThreshold?: number;\r\n qualityGates?: {\r\n testCoverage?: number;\r\n securityScore?: number;\r\n performanceBudget?: number;\r\n };\r\n definitionOfDone?: string[];\r\n nonFunctionalRequirements?: string[];\r\n}\r\n\r\nexport interface ContextBuilderOptions {\r\n agentType: string;\r\n taskId?: string;\r\n iteration?: number;\r\n epicContext?: string; // JSON string\r\n phaseContext?: string; // JSON string\r\n successCriteria?: string; // JSON string\r\n}\r\n\r\n/**\r\n * Load CLAUDE.md project rules\r\n */\r\nasync function loadProjectRules(): Promise<string> {\r\n try {\r\n // Try current working directory\r\n const cwdPath = path.join(process.cwd(), 'CLAUDE.md');\r\n const content = await fs.readFile(cwdPath, 'utf-8');\r\n return content;\r\n } catch (error) {\r\n console.warn('[cli-agent-context] Could not load CLAUDE.md:', error);\r\n return '';\r\n }\r\n}\r\n\r\n/**\r\n * Load agent markdown template\r\n */\r\nasync function loadAgentTemplate(agentType: string): Promise<string> {\r\n try {\r\n // Search in .claude/agents/ subdirectories\r\n const searchPaths = [\r\n path.join(process.cwd(), '.claude', 'agents', 'core-agents', `${agentType}.md`),\r\n path.join(process.cwd(), '.claude', 'agents', 'specialized', `${agentType}.md`),\r\n path.join(process.cwd(), '.claude', 'agents', 'development', `${agentType}.md`),\r\n path.join(process.cwd(), '.claude', 'agents', 'security', `${agentType}.md`),\r\n path.join(process.cwd(), '.claude', 'agents', 'custom', `${agentType}.md`),\r\n ];\r\n\r\n for (const searchPath of searchPaths) {\r\n try {\r\n const content = await fs.readFile(searchPath, 'utf-8');\r\n return content;\r\n } catch {\r\n // Continue to next path\r\n }\r\n }\r\n\r\n console.warn(`[cli-agent-context] Could not find agent template: ${agentType}.md`);\r\n return '';\r\n } catch (error) {\r\n console.warn('[cli-agent-context] Error loading agent template:', error);\r\n return '';\r\n }\r\n}\r\n\r\n/**\r\n * Parse JSON string safely\r\n */\r\nfunction parseJSON<T>(jsonString: string | undefined, fallback: T): T {\r\n if (!jsonString || jsonString.trim() === '' || jsonString === '(nil)') {\r\n return fallback;\r\n }\r\n\r\n try {\r\n return JSON.parse(jsonString) as T;\r\n } catch (error) {\r\n console.warn('[cli-agent-context] Failed to parse JSON:', error);\r\n return fallback;\r\n }\r\n}\r\n\r\n/**\r\n * Format epic context as natural language\r\n */\r\nfunction formatEpicContext(epic: EpicContext): string {\r\n if (!epic.epicGoal && !epic.inScope && !epic.outOfScope) {\r\n return '';\r\n }\r\n\r\n const sections: string[] = [];\r\n\r\n sections.push('## Epic Context');\r\n sections.push('');\r\n\r\n if (epic.epicGoal) {\r\n sections.push('**Epic Goal:**');\r\n sections.push(epic.epicGoal);\r\n sections.push('');\r\n }\r\n\r\n if (epic.riskProfile) {\r\n sections.push(`**Risk Profile:** ${epic.riskProfile}`);\r\n sections.push('');\r\n }\r\n\r\n if (epic.inScope && epic.inScope.length > 0) {\r\n sections.push('**In Scope:**');\r\n for (const item of epic.inScope) {\r\n sections.push(`- ${item}`);\r\n }\r\n sections.push('');\r\n }\r\n\r\n if (epic.outOfScope && epic.outOfScope.length > 0) {\r\n sections.push('**Out of Scope:**');\r\n for (const item of epic.outOfScope) {\r\n sections.push(`- ${item}`);\r\n }\r\n sections.push('');\r\n }\r\n\r\n if (epic.phases && epic.phases.length > 0) {\r\n sections.push('**Phases:**');\r\n for (let i = 0; i < epic.phases.length; i++) {\r\n sections.push(`${i + 1}. ${epic.phases[i]}`);\r\n }\r\n sections.push('');\r\n }\r\n\r\n if (epic.stakeholders && epic.stakeholders.length > 0) {\r\n sections.push(`**Stakeholders:** ${epic.stakeholders.join(', ')}`);\r\n sections.push('');\r\n }\r\n\r\n if (epic.timeline) {\r\n sections.push('**Timeline:**');\r\n if (epic.timeline.start) sections.push(`- Start: ${epic.timeline.start}`);\r\n if (epic.timeline.end) sections.push(`- End: ${epic.timeline.end}`);\r\n if (epic.timeline.milestones && epic.timeline.milestones.length > 0) {\r\n sections.push('- Milestones:');\r\n for (const milestone of epic.timeline.milestones) {\r\n sections.push(` - ${milestone.phase}: ${milestone.date}`);\r\n }\r\n }\r\n sections.push('');\r\n }\r\n\r\n return sections.join('\\n');\r\n}\r\n\r\n/**\r\n * Format phase context as natural language\r\n */\r\nfunction formatPhaseContext(phase: PhaseContext): string {\r\n if (!phase.currentPhase && !phase.deliverables) {\r\n return '';\r\n }\r\n\r\n const sections: string[] = [];\r\n\r\n sections.push('## Current Phase');\r\n sections.push('');\r\n\r\n if (phase.currentPhase) {\r\n sections.push(`**Phase:** ${phase.currentPhase}`);\r\n if (phase.phaseNumber) {\r\n sections.push(`**Phase Number:** ${phase.phaseNumber}`);\r\n }\r\n sections.push('');\r\n }\r\n\r\n if (phase.dependencies && phase.dependencies.length > 0) {\r\n sections.push('**Dependencies:**');\r\n for (const dep of phase.dependencies) {\r\n sections.push(`- ${dep}`);\r\n }\r\n sections.push('');\r\n }\r\n\r\n if (phase.deliverables && phase.deliverables.length > 0) {\r\n sections.push('**Deliverables:**');\r\n for (const deliverable of phase.deliverables) {\r\n sections.push(`- ${deliverable}`);\r\n }\r\n sections.push('');\r\n }\r\n\r\n if (phase.blockers && phase.blockers.length > 0) {\r\n sections.push('**Current Blockers:**');\r\n for (const blocker of phase.blockers) {\r\n sections.push(`- ${blocker}`);\r\n }\r\n sections.push('');\r\n }\r\n\r\n if (phase.resources) {\r\n sections.push('**Resources:**');\r\n if (phase.resources.agentCount) sections.push(`- Agents: ${phase.resources.agentCount}`);\r\n if (phase.resources.estimatedDuration) sections.push(`- Duration: ${phase.resources.estimatedDuration} hours`);\r\n if (phase.resources.costBudget) sections.push(`- Budget: $${phase.resources.costBudget.toFixed(2)}`);\r\n sections.push('');\r\n }\r\n\r\n return sections.join('\\n');\r\n}\r\n\r\n/**\r\n * Format success criteria as natural language\r\n */\r\nfunction formatSuccessCriteria(criteria: SuccessCriteria): string {\r\n // Check if any criteria fields are present\r\n if (\r\n !criteria.acceptanceCriteria &&\r\n !criteria.gateThreshold &&\r\n !criteria.consensusThreshold &&\r\n !criteria.qualityGates &&\r\n !criteria.definitionOfDone &&\r\n !criteria.nonFunctionalRequirements\r\n ) {\r\n return '';\r\n }\r\n\r\n const sections: string[] = [];\r\n\r\n sections.push('## Success Criteria');\r\n sections.push('');\r\n\r\n if (criteria.acceptanceCriteria && criteria.acceptanceCriteria.length > 0) {\r\n sections.push('**Acceptance Criteria:**');\r\n for (const criterion of criteria.acceptanceCriteria) {\r\n sections.push(`- ${criterion}`);\r\n }\r\n sections.push('');\r\n }\r\n\r\n if (criteria.gateThreshold || criteria.consensusThreshold) {\r\n sections.push('**Quality Gates:**');\r\n if (criteria.gateThreshold) {\r\n sections.push(`- Gate Threshold (Loop 3): ${(criteria.gateThreshold * 100).toFixed(0)}%`);\r\n }\r\n if (criteria.consensusThreshold) {\r\n sections.push(`- Consensus Threshold (Loop 2): ${(criteria.consensusThreshold * 100).toFixed(0)}%`);\r\n }\r\n sections.push('');\r\n }\r\n\r\n if (criteria.qualityGates) {\r\n sections.push('**Quality Metrics:**');\r\n if (criteria.qualityGates.testCoverage) {\r\n sections.push(`- Test Coverage: ${criteria.qualityGates.testCoverage}%`);\r\n }\r\n if (criteria.qualityGates.securityScore) {\r\n sections.push(`- Security Score: ${(criteria.qualityGates.securityScore * 100).toFixed(0)}%`);\r\n }\r\n if (criteria.qualityGates.performanceBudget) {\r\n sections.push(`- Performance Budget: ${criteria.qualityGates.performanceBudget}ms`);\r\n }\r\n sections.push('');\r\n }\r\n\r\n if (criteria.definitionOfDone && criteria.definitionOfDone.length > 0) {\r\n sections.push('**Definition of Done:**');\r\n for (const item of criteria.definitionOfDone) {\r\n sections.push(`- [ ] ${item}`);\r\n }\r\n sections.push('');\r\n }\r\n\r\n if (criteria.nonFunctionalRequirements && criteria.nonFunctionalRequirements.length > 0) {\r\n sections.push('**Non-Functional Requirements:**');\r\n for (const req of criteria.nonFunctionalRequirements) {\r\n sections.push(`- ${req}`);\r\n }\r\n sections.push('');\r\n }\r\n\r\n return sections.join('\\n');\r\n}\r\n\r\n/**\r\n * Format iteration context\r\n */\r\nfunction formatIterationContext(iteration?: number, taskId?: string): string {\r\n if (!iteration || iteration === 1) {\r\n return '';\r\n }\r\n\r\n return `\r\n## Current Iteration\r\n\r\nThis is **iteration ${iteration}** of your task.\r\n\r\n**Previous Iterations:**\r\nYou have completed ${iteration - 1} iteration${iteration > 2 ? 's' : ''} before this one.\r\n\r\n**Your Goal:**\r\nAddress feedback from previous iterations and improve the quality of your work.\r\n\r\n**Feedback Access:**\r\nCheck Redis for iteration feedback:\r\n\\`\\`\\`bash\r\nredis-cli get \"swarm:${taskId}:\\${AGENT_ID}:feedback:iteration-${iteration}\"\r\n\\`\\`\\`\r\n\r\n`;\r\n}\r\n\r\n/**\r\n * Build comprehensive system prompt for CLI agent\r\n *\r\n * Combines:\r\n * - Project rules (CLAUDE.md)\r\n * - Agent markdown template\r\n * - Epic context (formatted)\r\n * - Phase context (formatted)\r\n * - Success criteria (formatted)\r\n * - Iteration context\r\n */\r\nexport async function buildCLIAgentSystemPrompt(options: ContextBuilderOptions): Promise<string> {\r\n console.log('[cli-agent-context] Building system prompt...');\r\n\r\n const sections: string[] = [];\r\n\r\n // 1. Load and include CLAUDE.md\r\n console.log('[cli-agent-context] Loading CLAUDE.md...');\r\n const projectRules = await loadProjectRules();\r\n if (projectRules) {\r\n sections.push('# Project Rules (CLAUDE.md)');\r\n sections.push('');\r\n sections.push(projectRules);\r\n sections.push('');\r\n sections.push('---');\r\n sections.push('');\r\n }\r\n\r\n // 2. Load and include agent markdown template\r\n console.log(`[cli-agent-context] Loading agent template: ${options.agentType}`);\r\n const agentTemplate = await loadAgentTemplate(options.agentType);\r\n if (agentTemplate) {\r\n sections.push(`# Agent Definition: ${options.agentType}`);\r\n sections.push('');\r\n sections.push(agentTemplate);\r\n sections.push('');\r\n sections.push('---');\r\n sections.push('');\r\n }\r\n\r\n // 3. Parse and format epic context\r\n const epicContext = parseJSON<EpicContext>(options.epicContext, {});\r\n const formattedEpic = formatEpicContext(epicContext);\r\n if (formattedEpic) {\r\n sections.push(formattedEpic);\r\n sections.push('---');\r\n sections.push('');\r\n }\r\n\r\n // 4. Parse and format phase context\r\n const phaseContext = parseJSON<PhaseContext>(options.phaseContext, {});\r\n const formattedPhase = formatPhaseContext(phaseContext);\r\n if (formattedPhase) {\r\n sections.push(formattedPhase);\r\n sections.push('---');\r\n sections.push('');\r\n }\r\n\r\n // 5. Parse and format success criteria\r\n const successCriteria = parseJSON<SuccessCriteria>(options.successCriteria, {});\r\n const formattedCriteria = formatSuccessCriteria(successCriteria);\r\n if (formattedCriteria) {\r\n sections.push(formattedCriteria);\r\n sections.push('---');\r\n sections.push('');\r\n }\r\n\r\n // 6. Format iteration context\r\n const iterationContext = formatIterationContext(options.iteration, options.taskId);\r\n if (iterationContext) {\r\n sections.push(iterationContext);\r\n sections.push('---');\r\n sections.push('');\r\n }\r\n\r\n // 7. Add execution reminder\r\n sections.push('## Execution Instructions');\r\n sections.push('');\r\n sections.push('You are executing as a CLI-spawned agent with full project context.');\r\n sections.push('Follow the agent definition, project rules, and success criteria exactly.');\r\n sections.push('');\r\n sections.push('**Remember:**');\r\n sections.push('- Respect scope boundaries (in-scope vs out-of-scope)');\r\n sections.push('- Meet acceptance criteria and quality gates');\r\n sections.push('- Follow CFN Loop protocol if task-id is provided');\r\n sections.push('- Report confidence score when complete');\r\n sections.push('');\r\n\r\n const fullPrompt = sections.join('\\n');\r\n\r\n console.log(`[cli-agent-context] System prompt built: ${fullPrompt.length} characters`);\r\n console.log(`[cli-agent-context] - Project rules: ${projectRules ? 'included' : 'not found'}`);\r\n console.log(`[cli-agent-context] - Agent template: ${agentTemplate ? 'included' : 'not found'}`);\r\n console.log(`[cli-agent-context] - Epic context: ${formattedEpic ? 'formatted' : 'none'}`);\r\n console.log(`[cli-agent-context] - Phase context: ${formattedPhase ? 'formatted' : 'none'}`);\r\n console.log(`[cli-agent-context] - Success criteria: ${formattedCriteria ? 'formatted' : 'none'}`);\r\n\r\n return fullPrompt;\r\n}\r\n\r\n/**\r\n * Helper: Load context from environment variables\r\n *\r\n * Used by agent executor to load context from env vars set by cfn-spawn\r\n */\r\nexport function loadContextFromEnv(): ContextBuilderOptions {\r\n return {\r\n agentType: process.env.AGENT_TYPE || 'unknown',\r\n taskId: process.env.TASK_ID,\r\n iteration: process.env.ITERATION ? parseInt(process.env.ITERATION, 10) : 1,\r\n epicContext: process.env.EPIC_CONTEXT,\r\n phaseContext: process.env.PHASE_CONTEXT,\r\n successCriteria: process.env.SUCCESS_CRITERIA,\r\n };\r\n}\r\n"],"names":["fs","path","loadProjectRules","cwdPath","join","process","cwd","content","readFile","error","console","warn","loadAgentTemplate","agentType","searchPaths","searchPath","parseJSON","jsonString","fallback","trim","JSON","parse","formatEpicContext","epic","epicGoal","inScope","outOfScope","sections","push","riskProfile","length","item","phases","i","stakeholders","timeline","start","end","milestones","milestone","phase","date","formatPhaseContext","currentPhase","deliverables","phaseNumber","dependencies","dep","deliverable","blockers","blocker","resources","agentCount","estimatedDuration","costBudget","toFixed","formatSuccessCriteria","criteria","acceptanceCriteria","gateThreshold","consensusThreshold","qualityGates","definitionOfDone","nonFunctionalRequirements","criterion","testCoverage","securityScore","performanceBudget","req","formatIterationContext","iteration","taskId","buildCLIAgentSystemPrompt","options","log","projectRules","agentTemplate","epicContext","formattedEpic","phaseContext","formattedPhase","successCriteria","formattedCriteria","iterationContext","fullPrompt","loadContextFromEnv","env","AGENT_TYPE","TASK_ID","ITERATION","parseInt","EPIC_CONTEXT","PHASE_CONTEXT","SUCCESS_CRITERIA"],"mappings":"AAAA;;;;;;;;;;;CAWC,GAED,OAAOA,QAAQ,cAAc;AAC7B,OAAOC,UAAU,OAAO;AAmDxB;;CAEC,GACD,eAAeC;IACb,IAAI;QACF,gCAAgC;QAChC,MAAMC,UAAUF,KAAKG,IAAI,CAACC,QAAQC,GAAG,IAAI;QACzC,MAAMC,UAAU,MAAMP,GAAGQ,QAAQ,CAACL,SAAS;QAC3C,OAAOI;IACT,EAAE,OAAOE,OAAO;QACdC,QAAQC,IAAI,CAAC,iDAAiDF;QAC9D,OAAO;IACT;AACF;AAEA;;CAEC,GACD,eAAeG,kBAAkBC,SAAiB;IAChD,IAAI;QACF,2CAA2C;QAC3C,MAAMC,cAAc;YAClBb,KAAKG,IAAI,CAACC,QAAQ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,"sources":["../../src/cli/cli-agent-context.ts"],"sourcesContent":["/**\r\n * CLI Agent Context Builder\r\n *\r\n * Builds natural language system prompts for CLI-spawned agents.\r\n * Converts JSON context from Redis into readable markdown format.\r\n *\r\n * Phase 1: System Prompts Enhancement (Sprint 2)\r\n * - Load CLAUDE.md (project rules)\r\n * - Load agent markdown template\r\n * - Format epic/phase/success criteria as natural language\r\n * - Build comprehensive system prompt for API execution\r\n */\r\n\r\nimport fs from 'fs/promises';\r\nimport path from 'path';\r\n\r\nexport interface EpicContext {\r\n epicGoal?: string;\r\n inScope?: string[];\r\n outOfScope?: string[];\r\n phases?: string[];\r\n riskProfile?: string;\r\n stakeholders?: string[];\r\n timeline?: {\r\n start?: string;\r\n end?: string;\r\n milestones?: Array<{ phase: string; date: string }>;\r\n };\r\n}\r\n\r\nexport interface PhaseContext {\r\n currentPhase?: string;\r\n phaseNumber?: number;\r\n dependencies?: string[];\r\n deliverables?: string[];\r\n blockers?: string[];\r\n resources?: {\r\n agentCount?: number;\r\n estimatedDuration?: number;\r\n costBudget?: number;\r\n };\r\n}\r\n\r\nexport interface SuccessCriteria {\r\n acceptanceCriteria?: string[];\r\n gateThreshold?: number;\r\n consensusThreshold?: number;\r\n qualityGates?: {\r\n testCoverage?: number;\r\n securityScore?: number;\r\n performanceBudget?: number;\r\n };\r\n definitionOfDone?: string[];\r\n nonFunctionalRequirements?: string[];\r\n}\r\n\r\nexport interface ContextBuilderOptions {\r\n agentType: string;\r\n taskId?: string;\r\n iteration?: number;\r\n epicContext?: string; // JSON string\r\n phaseContext?: string; // JSON string\r\n successCriteria?: string; // JSON string\r\n}\r\n\r\n/**\r\n * Load CLAUDE.md project rules\r\n */\r\nasync function loadProjectRules(): Promise<string> {\r\n try {\r\n // Try current working directory\r\n const cwdPath = path.join(process.cwd(), 'CLAUDE.md');\r\n const content = await fs.readFile(cwdPath, 'utf-8');\r\n return content;\r\n } catch (error) {\r\n console.warn('[cli-agent-context] Could not load CLAUDE.md:', error);\r\n return '';\r\n }\r\n}\r\n\r\n/**\r\n * Load agent markdown template\r\n */\r\nasync function loadAgentTemplate(agentType: string): Promise<string> {\r\n try {\r\n // Search in .claude/agents/ subdirectories\r\n const searchPaths = [\r\n path.join(process.cwd(), '.claude', 'agents', 'coordinators', `${agentType}.md`),\r\n path.join(process.cwd(), '.claude', 'agents', 'core-agents', `${agentType}.md`),\r\n path.join(process.cwd(), '.claude', 'agents', 'developers', `${agentType}.md`),\r\n path.join(process.cwd(), '.claude', 'agents', 'specialists', `${agentType}.md`),\r\n path.join(process.cwd(), '.claude', 'agents', 'testers', `${agentType}.md`),\r\n path.join(process.cwd(), '.claude', 'agents', 'planners', `${agentType}.md`),\r\n path.join(process.cwd(), '.claude', 'agents', 'frontend', `${agentType}.md`),\r\n path.join(process.cwd(), '.claude', 'agents', 'security', `${agentType}.md`),\r\n path.join(process.cwd(), '.claude', 'agents', 'custom', `${agentType}.md`),\r\n path.join(process.cwd(), '.claude', 'agents', `${agentType}.md`),\r\n ];\r\n\r\n for (const searchPath of searchPaths) {\r\n try {\r\n const content = await fs.readFile(searchPath, 'utf-8');\r\n return content;\r\n } catch {\r\n // Continue to next path\r\n }\r\n }\r\n\r\n console.warn(`[cli-agent-context] Could not find agent template: ${agentType}.md`);\r\n return '';\r\n } catch (error) {\r\n console.warn('[cli-agent-context] Error loading agent template:', error);\r\n return '';\r\n }\r\n}\r\n\r\n/**\r\n * Parse JSON string safely\r\n */\r\nfunction parseJSON<T>(jsonString: string | undefined, fallback: T): T {\r\n if (!jsonString || jsonString.trim() === '' || jsonString === '(nil)') {\r\n return fallback;\r\n }\r\n\r\n try {\r\n return JSON.parse(jsonString) as T;\r\n } catch (error) {\r\n console.warn('[cli-agent-context] Failed to parse JSON:', error);\r\n return fallback;\r\n }\r\n}\r\n\r\n/**\r\n * Format epic context as natural language\r\n */\r\nfunction formatEpicContext(epic: EpicContext): string {\r\n if (!epic.epicGoal && !epic.inScope && !epic.outOfScope) {\r\n return '';\r\n }\r\n\r\n const sections: string[] = [];\r\n\r\n sections.push('## Epic Context');\r\n sections.push('');\r\n\r\n if (epic.epicGoal) {\r\n sections.push('**Epic Goal:**');\r\n sections.push(epic.epicGoal);\r\n sections.push('');\r\n }\r\n\r\n if (epic.riskProfile) {\r\n sections.push(`**Risk Profile:** ${epic.riskProfile}`);\r\n sections.push('');\r\n }\r\n\r\n if (epic.inScope && epic.inScope.length > 0) {\r\n sections.push('**In Scope:**');\r\n for (const item of epic.inScope) {\r\n sections.push(`- ${item}`);\r\n }\r\n sections.push('');\r\n }\r\n\r\n if (epic.outOfScope && epic.outOfScope.length > 0) {\r\n sections.push('**Out of Scope:**');\r\n for (const item of epic.outOfScope) {\r\n sections.push(`- ${item}`);\r\n }\r\n sections.push('');\r\n }\r\n\r\n if (epic.phases && epic.phases.length > 0) {\r\n sections.push('**Phases:**');\r\n for (let i = 0; i < epic.phases.length; i++) {\r\n sections.push(`${i + 1}. ${epic.phases[i]}`);\r\n }\r\n sections.push('');\r\n }\r\n\r\n if (epic.stakeholders && epic.stakeholders.length > 0) {\r\n sections.push(`**Stakeholders:** ${epic.stakeholders.join(', ')}`);\r\n sections.push('');\r\n }\r\n\r\n if (epic.timeline) {\r\n sections.push('**Timeline:**');\r\n if (epic.timeline.start) sections.push(`- Start: ${epic.timeline.start}`);\r\n if (epic.timeline.end) sections.push(`- End: ${epic.timeline.end}`);\r\n if (epic.timeline.milestones && epic.timeline.milestones.length > 0) {\r\n sections.push('- Milestones:');\r\n for (const milestone of epic.timeline.milestones) {\r\n sections.push(` - ${milestone.phase}: ${milestone.date}`);\r\n }\r\n }\r\n sections.push('');\r\n }\r\n\r\n return sections.join('\\n');\r\n}\r\n\r\n/**\r\n * Format phase context as natural language\r\n */\r\nfunction formatPhaseContext(phase: PhaseContext): string {\r\n if (!phase.currentPhase && !phase.deliverables) {\r\n return '';\r\n }\r\n\r\n const sections: string[] = [];\r\n\r\n sections.push('## Current Phase');\r\n sections.push('');\r\n\r\n if (phase.currentPhase) {\r\n sections.push(`**Phase:** ${phase.currentPhase}`);\r\n if (phase.phaseNumber) {\r\n sections.push(`**Phase Number:** ${phase.phaseNumber}`);\r\n }\r\n sections.push('');\r\n }\r\n\r\n if (phase.dependencies && phase.dependencies.length > 0) {\r\n sections.push('**Dependencies:**');\r\n for (const dep of phase.dependencies) {\r\n sections.push(`- ${dep}`);\r\n }\r\n sections.push('');\r\n }\r\n\r\n if (phase.deliverables && phase.deliverables.length > 0) {\r\n sections.push('**Deliverables:**');\r\n for (const deliverable of phase.deliverables) {\r\n sections.push(`- ${deliverable}`);\r\n }\r\n sections.push('');\r\n }\r\n\r\n if (phase.blockers && phase.blockers.length > 0) {\r\n sections.push('**Current Blockers:**');\r\n for (const blocker of phase.blockers) {\r\n sections.push(`- ${blocker}`);\r\n }\r\n sections.push('');\r\n }\r\n\r\n if (phase.resources) {\r\n sections.push('**Resources:**');\r\n if (phase.resources.agentCount) sections.push(`- Agents: ${phase.resources.agentCount}`);\r\n if (phase.resources.estimatedDuration) sections.push(`- Duration: ${phase.resources.estimatedDuration} hours`);\r\n if (phase.resources.costBudget) sections.push(`- Budget: $${phase.resources.costBudget.toFixed(2)}`);\r\n sections.push('');\r\n }\r\n\r\n return sections.join('\\n');\r\n}\r\n\r\n/**\r\n * Format success criteria as natural language\r\n */\r\nfunction formatSuccessCriteria(criteria: SuccessCriteria): string {\r\n // Check if any criteria fields are present\r\n if (\r\n !criteria.acceptanceCriteria &&\r\n !criteria.gateThreshold &&\r\n !criteria.consensusThreshold &&\r\n !criteria.qualityGates &&\r\n !criteria.definitionOfDone &&\r\n !criteria.nonFunctionalRequirements\r\n ) {\r\n return '';\r\n }\r\n\r\n const sections: string[] = [];\r\n\r\n sections.push('## Success Criteria');\r\n sections.push('');\r\n\r\n if (criteria.acceptanceCriteria && criteria.acceptanceCriteria.length > 0) {\r\n sections.push('**Acceptance Criteria:**');\r\n for (const criterion of criteria.acceptanceCriteria) {\r\n sections.push(`- ${criterion}`);\r\n }\r\n sections.push('');\r\n }\r\n\r\n if (criteria.gateThreshold || criteria.consensusThreshold) {\r\n sections.push('**Quality Gates:**');\r\n if (criteria.gateThreshold) {\r\n sections.push(`- Gate Threshold (Loop 3): ${(criteria.gateThreshold * 100).toFixed(0)}%`);\r\n }\r\n if (criteria.consensusThreshold) {\r\n sections.push(`- Consensus Threshold (Loop 2): ${(criteria.consensusThreshold * 100).toFixed(0)}%`);\r\n }\r\n sections.push('');\r\n }\r\n\r\n if (criteria.qualityGates) {\r\n sections.push('**Quality Metrics:**');\r\n if (criteria.qualityGates.testCoverage) {\r\n sections.push(`- Test Coverage: ${criteria.qualityGates.testCoverage}%`);\r\n }\r\n if (criteria.qualityGates.securityScore) {\r\n sections.push(`- Security Score: ${(criteria.qualityGates.securityScore * 100).toFixed(0)}%`);\r\n }\r\n if (criteria.qualityGates.performanceBudget) {\r\n sections.push(`- Performance Budget: ${criteria.qualityGates.performanceBudget}ms`);\r\n }\r\n sections.push('');\r\n }\r\n\r\n if (criteria.definitionOfDone && criteria.definitionOfDone.length > 0) {\r\n sections.push('**Definition of Done:**');\r\n for (const item of criteria.definitionOfDone) {\r\n sections.push(`- [ ] ${item}`);\r\n }\r\n sections.push('');\r\n }\r\n\r\n if (criteria.nonFunctionalRequirements && criteria.nonFunctionalRequirements.length > 0) {\r\n sections.push('**Non-Functional Requirements:**');\r\n for (const req of criteria.nonFunctionalRequirements) {\r\n sections.push(`- ${req}`);\r\n }\r\n sections.push('');\r\n }\r\n\r\n return sections.join('\\n');\r\n}\r\n\r\n/**\r\n * Format iteration context\r\n */\r\nfunction formatIterationContext(iteration?: number, taskId?: string): string {\r\n if (!iteration || iteration === 1) {\r\n return '';\r\n }\r\n\r\n return `\r\n## Current Iteration\r\n\r\nThis is **iteration ${iteration}** of your task.\r\n\r\n**Previous Iterations:**\r\nYou have completed ${iteration - 1} iteration${iteration > 2 ? 's' : ''} before this one.\r\n\r\n**Your Goal:**\r\nAddress feedback from previous iterations and improve the quality of your work.\r\n\r\n**Feedback Access:**\r\nCheck Redis for iteration feedback:\r\n\\`\\`\\`bash\r\nredis-cli get \"swarm:${taskId}:\\${AGENT_ID}:feedback:iteration-${iteration}\"\r\n\\`\\`\\`\r\n\r\n`;\r\n}\r\n\r\n/**\r\n * Build comprehensive system prompt for CLI agent\r\n *\r\n * Combines:\r\n * - Project rules (CLAUDE.md)\r\n * - Agent markdown template\r\n * - Epic context (formatted)\r\n * - Phase context (formatted)\r\n * - Success criteria (formatted)\r\n * - Iteration context\r\n */\r\nexport async function buildCLIAgentSystemPrompt(options: ContextBuilderOptions): Promise<string> {\r\n console.log('[cli-agent-context] Building system prompt...');\r\n\r\n const sections: string[] = [];\r\n\r\n // 1. Load and include CLAUDE.md\r\n console.log('[cli-agent-context] Loading CLAUDE.md...');\r\n const projectRules = await loadProjectRules();\r\n if (projectRules) {\r\n sections.push('# Project Rules (CLAUDE.md)');\r\n sections.push('');\r\n sections.push(projectRules);\r\n sections.push('');\r\n sections.push('---');\r\n sections.push('');\r\n }\r\n\r\n // 2. Load and include agent markdown template\r\n console.log(`[cli-agent-context] Loading agent template: ${options.agentType}`);\r\n const agentTemplate = await loadAgentTemplate(options.agentType);\r\n if (agentTemplate) {\r\n sections.push(`# Agent Definition: ${options.agentType}`);\r\n sections.push('');\r\n sections.push(agentTemplate);\r\n sections.push('');\r\n sections.push('---');\r\n sections.push('');\r\n }\r\n\r\n // 3. Parse and format epic context\r\n const epicContext = parseJSON<EpicContext>(options.epicContext, {});\r\n const formattedEpic = formatEpicContext(epicContext);\r\n if (formattedEpic) {\r\n sections.push(formattedEpic);\r\n sections.push('---');\r\n sections.push('');\r\n }\r\n\r\n // 4. Parse and format phase context\r\n const phaseContext = parseJSON<PhaseContext>(options.phaseContext, {});\r\n const formattedPhase = formatPhaseContext(phaseContext);\r\n if (formattedPhase) {\r\n sections.push(formattedPhase);\r\n sections.push('---');\r\n sections.push('');\r\n }\r\n\r\n // 5. Parse and format success criteria\r\n const successCriteria = parseJSON<SuccessCriteria>(options.successCriteria, {});\r\n const formattedCriteria = formatSuccessCriteria(successCriteria);\r\n if (formattedCriteria) {\r\n sections.push(formattedCriteria);\r\n sections.push('---');\r\n sections.push('');\r\n }\r\n\r\n // 6. Format iteration context\r\n const iterationContext = formatIterationContext(options.iteration, options.taskId);\r\n if (iterationContext) {\r\n sections.push(iterationContext);\r\n sections.push('---');\r\n sections.push('');\r\n }\r\n\r\n // 7. Add execution reminder\r\n sections.push('## Execution Instructions');\r\n sections.push('');\r\n sections.push('You are executing as a CLI-spawned agent with full project context.');\r\n sections.push('Follow the agent definition, project rules, and success criteria exactly.');\r\n sections.push('');\r\n sections.push('**Remember:**');\r\n sections.push('- Respect scope boundaries (in-scope vs out-of-scope)');\r\n sections.push('- Meet acceptance criteria and quality gates');\r\n sections.push('- Follow CFN Loop protocol if task-id is provided');\r\n sections.push('- Report confidence score when complete');\r\n sections.push('');\r\n\r\n const fullPrompt = sections.join('\\n');\r\n\r\n console.log(`[cli-agent-context] System prompt built: ${fullPrompt.length} characters`);\r\n console.log(`[cli-agent-context] - Project rules: ${projectRules ? 'included' : 'not found'}`);\r\n console.log(`[cli-agent-context] - Agent template: ${agentTemplate ? 'included' : 'not found'}`);\r\n console.log(`[cli-agent-context] - Epic context: ${formattedEpic ? 'formatted' : 'none'}`);\r\n console.log(`[cli-agent-context] - Phase context: ${formattedPhase ? 'formatted' : 'none'}`);\r\n console.log(`[cli-agent-context] - Success criteria: ${formattedCriteria ? 'formatted' : 'none'}`);\r\n\r\n return fullPrompt;\r\n}\r\n\r\n/**\r\n * Helper: Load context from environment variables\r\n *\r\n * Used by agent executor to load context from env vars set by cfn-spawn\r\n */\r\nexport function loadContextFromEnv(): ContextBuilderOptions {\r\n return {\r\n agentType: process.env.AGENT_TYPE || 'unknown',\r\n taskId: process.env.TASK_ID,\r\n iteration: process.env.ITERATION ? parseInt(process.env.ITERATION, 10) : 1,\r\n epicContext: process.env.EPIC_CONTEXT,\r\n phaseContext: process.env.PHASE_CONTEXT,\r\n successCriteria: process.env.SUCCESS_CRITERIA,\r\n };\r\n}\r\n"],"names":["fs","path","loadProjectRules","cwdPath","join","process","cwd","content","readFile","error","console","warn","loadAgentTemplate","agentType","searchPaths","searchPath","parseJSON","jsonString","fallback","trim","JSON","parse","formatEpicContext","epic","epicGoal","inScope","outOfScope","sections","push","riskProfile","length","item","phases","i","stakeholders","timeline","start","end","milestones","milestone","phase","date","formatPhaseContext","currentPhase","deliverables","phaseNumber","dependencies","dep","deliverable","blockers","blocker","resources","agentCount","estimatedDuration","costBudget","toFixed","formatSuccessCriteria","criteria","acceptanceCriteria","gateThreshold","consensusThreshold","qualityGates","definitionOfDone","nonFunctionalRequirements","criterion","testCoverage","securityScore","performanceBudget","req","formatIterationContext","iteration","taskId","buildCLIAgentSystemPrompt","options","log","projectRules","agentTemplate","epicContext","formattedEpic","phaseContext","formattedPhase","successCriteria","formattedCriteria","iterationContext","fullPrompt","loadContextFromEnv","env","AGENT_TYPE","TASK_ID","ITERATION","parseInt","EPIC_CONTEXT","PHASE_CONTEXT","SUCCESS_CRITERIA"],"mappings":"AAAA;;;;;;;;;;;CAWC,GAED,OAAOA,QAAQ,cAAc;AAC7B,OAAOC,UAAU,OAAO;AAmDxB;;CAEC,GACD,eAAeC;IACb,IAAI;QACF,gCAAgC;QAChC,MAAMC,UAAUF,KAAKG,IAAI,CAACC,QAAQC,GAAG,IAAI;QACzC,MAAMC,UAAU,MAAMP,GAAGQ,QAAQ,CAACL,SAAS;QAC3C,OAAOI;IACT,EAAE,OAAOE,OAAO;QACdC,QAAQC,IAAI,CAAC,iDAAiDF;QAC9D,OAAO;IACT;AACF;AAEA;;CAEC,GACD,eAAeG,kBAAkBC,SAAiB;IAChD,IAAI;QACF,2CAA2C;QAC3C,MAAMC,cAAc;YAClBb,KAAKG,IAAI,CAACC,QAAQC,GAAG,IAAI,WAAW,UAAU,gBAAgB,GAAGO,UAAU,GAAG,CAAC;YAC/EZ,KAAKG,IAAI,CAACC,QAAQC,GA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QACLxE,WAAWR,QAAQiF,GAAG,CAACC,UAAU,IAAI;QACrChB,QAAQlE,QAAQiF,GAAG,CAACE,OAAO;QAC3BlB,WAAWjE,QAAQiF,GAAG,CAACG,SAAS,GAAGC,SAASrF,QAAQiF,GAAG,CAACG,SAAS,EAAE,MAAM;QACzEZ,aAAaxE,QAAQiF,GAAG,CAACK,YAAY;QACrCZ,cAAc1E,QAAQiF,GAAG,CAACM,aAAa;QACvCX,iBAAiB5E,QAAQiF,GAAG,CAACO,gBAAgB;IAC/C;AACF"}
|
|
@@ -1,100 +1,118 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
configPath;
|
|
8
|
-
schemaPath;
|
|
9
|
-
ajv;
|
|
10
|
-
constructor(){
|
|
11
|
-
this.configPath = path.join(process.env.HOME || "", ".claude-flow-config.json");
|
|
12
|
-
this.schemaPath = path.join(__dirname, "../../.claude/skills/config-management/config.json");
|
|
13
|
-
this.ajv = new Ajv();
|
|
14
|
-
}
|
|
15
|
-
static getInstance() {
|
|
16
|
-
if (!ConfigManager._instance) {
|
|
17
|
-
ConfigManager._instance = new ConfigManager();
|
|
18
|
-
}
|
|
19
|
-
return ConfigManager._instance;
|
|
20
|
-
}
|
|
21
|
-
async readConfig() {
|
|
22
|
-
try {
|
|
23
|
-
const configContent = await fs.readFile(this.configPath, "utf-8");
|
|
24
|
-
return JSON.parse(configContent);
|
|
25
|
-
} catch (error) {
|
|
26
|
-
// If config doesn't exist, create from schema
|
|
27
|
-
return this.resetToDefaults();
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
async writeConfig(config) {
|
|
31
|
-
const schemaContent = await fs.readFile(this.schemaPath, "utf-8");
|
|
32
|
-
const schema = JSON.parse(schemaContent);
|
|
33
|
-
const validate = this.ajv.compile(schema);
|
|
34
|
-
if (!validate(config)) {
|
|
35
|
-
throw new Error("Invalid configuration: " + this.ajv.errorsText(validate.errors));
|
|
36
|
-
}
|
|
37
|
-
await fs.writeFile(this.configPath, JSON.stringify(config, null, 2), "utf-8");
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = this && this.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) {
|
|
4
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
5
|
+
resolve(value);
|
|
6
|
+
});
|
|
38
7
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
8
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
9
|
+
function fulfilled(value) {
|
|
10
|
+
try {
|
|
11
|
+
step(generator.next(value));
|
|
12
|
+
} catch (e) {
|
|
13
|
+
reject(e);
|
|
14
|
+
}
|
|
46
15
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return JSON.parse(customConfigContent);
|
|
54
|
-
} catch (error) {
|
|
55
|
-
// If custom config doesn't exist or can't be read, return empty object
|
|
56
|
-
return {};
|
|
16
|
+
function rejected(value) {
|
|
17
|
+
try {
|
|
18
|
+
step(generator["throw"](value));
|
|
19
|
+
} catch (e) {
|
|
20
|
+
reject(e);
|
|
21
|
+
}
|
|
57
22
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const config = await this.readConfig();
|
|
61
|
-
// Type assertion to handle full object
|
|
62
|
-
if (typeof value === "object" && value !== null) {
|
|
63
|
-
config[key] = value;
|
|
64
|
-
} else {
|
|
65
|
-
throw new Error("Invalid configuration value");
|
|
23
|
+
function step(result) {
|
|
24
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
66
25
|
}
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
26
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
var __generator = this && this.__generator || function(thisArg, body) {
|
|
30
|
+
var _ = {
|
|
31
|
+
label: 0,
|
|
32
|
+
sent: function() {
|
|
33
|
+
if (t[0] & 1) throw t[1];
|
|
34
|
+
return t[1];
|
|
35
|
+
},
|
|
36
|
+
trys: [],
|
|
37
|
+
ops: []
|
|
38
|
+
}, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
39
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
40
|
+
return this;
|
|
41
|
+
}), g;
|
|
42
|
+
function verb(n) {
|
|
43
|
+
return function(v) {
|
|
44
|
+
return step([
|
|
45
|
+
n,
|
|
46
|
+
v
|
|
47
|
+
]);
|
|
90
48
|
};
|
|
91
|
-
await this.writeConfig(defaultConfig);
|
|
92
|
-
return defaultConfig;
|
|
93
49
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
50
|
+
function step(op) {
|
|
51
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
52
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
53
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
54
|
+
if (y = 0, t) op = [
|
|
55
|
+
op[0] & 2,
|
|
56
|
+
t.value
|
|
57
|
+
];
|
|
58
|
+
switch(op[0]){
|
|
59
|
+
case 0:
|
|
60
|
+
case 1:
|
|
61
|
+
t = op;
|
|
62
|
+
break;
|
|
63
|
+
case 4:
|
|
64
|
+
_.label++;
|
|
65
|
+
return {
|
|
66
|
+
value: op[1],
|
|
67
|
+
done: false
|
|
68
|
+
};
|
|
69
|
+
case 5:
|
|
70
|
+
_.label++;
|
|
71
|
+
y = op[1];
|
|
72
|
+
op = [
|
|
73
|
+
0
|
|
74
|
+
];
|
|
75
|
+
continue;
|
|
76
|
+
case 7:
|
|
77
|
+
op = _.ops.pop();
|
|
78
|
+
_.trys.pop();
|
|
79
|
+
continue;
|
|
80
|
+
default:
|
|
81
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
82
|
+
_ = 0;
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
86
|
+
_.label = op[1];
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
90
|
+
_.label = t[1];
|
|
91
|
+
t = op;
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
if (t && _.label < t[2]) {
|
|
95
|
+
_.label = t[2];
|
|
96
|
+
_.ops.push(op);
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
if (t[2]) _.ops.pop();
|
|
100
|
+
_.trys.pop();
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
op = body.call(thisArg, _);
|
|
104
|
+
} catch (e) {
|
|
105
|
+
op = [
|
|
106
|
+
6,
|
|
107
|
+
e
|
|
108
|
+
];
|
|
109
|
+
y = 0;
|
|
110
|
+
} finally{
|
|
111
|
+
f = t = 0;
|
|
112
|
+
}
|
|
113
|
+
if (op[0] & 5) throw op[1];
|
|
114
|
+
return {
|
|
115
|
+
value: op[0] ? op[1] : void 0,
|
|
98
116
|
done: true
|
|
99
117
|
};
|
|
100
118
|
}
|