claude-flow-novice 2.15.11 → 2.16.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/cfn-extras/agents/cfn-v3-coordinator.md +517 -0
- package/.claude/cfn-extras/skills/GOOGLE_SHEETS_SKILLS_README.md +1 -1
- package/.claude/cfn-extras/skills/google-sheets-api-coordinator/SKILL.md +1 -1
- package/.claude/cfn-extras/skills/google-sheets-formula-builder/SKILL.md +1 -1
- package/.claude/cfn-extras/skills/google-sheets-progress/SKILL.md +1 -1
- package/.claude/commands/CFN_LOOP_FRONTEND.md +1 -1
- package/.claude/commands/cfn-loop-cli.md +214 -442
- package/.claude/commands/cfn-loop-frontend.md +1 -1
- package/.claude/commands/cfn-loop-task.md +2 -2
- package/.claude/commands/cfn-loop-trigger.md +114 -0
- package/.claude/commands/deprecated/cfn-loop.md +2 -2
- package/.claude/hooks/cfn-invoke-post-edit-ts.sh +100 -0
- package/.claude/hooks/cfn-invoke-post-edit-ts.sh.backup +78 -0
- package/.claude/hooks/cfn-invoke-post-edit.sh +53 -5
- package/.claude/hooks/cfn-invoke-post-edit.sh.backup +87 -0
- package/.claude/hooks/cfn-invoke-pre-edit-ts.sh +116 -0
- package/.claude/hooks/cfn-invoke-pre-edit-ts.sh.backup +94 -0
- package/.claude/hooks/cfn-invoke-pre-edit.sh +22 -0
- package/.claude/hooks/cfn-invoke-pre-edit.sh.backup +88 -0
- package/.claude/hooks/cfn-post-edit.config.json +9 -2
- package/.claude/root-claude-distribute/CFN-CLAUDE.md +1 -1
- package/.claude/skills/cfn-agent-spawning/SKILL.md +48 -1
- package/.claude/skills/cfn-agent-spawning/SKILL.md.backup +135 -0
- package/.claude/skills/cfn-agent-spawning/TYPESCRIPT_MIGRATION.md +567 -0
- package/.claude/skills/cfn-agent-spawning/check-dependencies.sh +22 -0
- package/.claude/skills/{cfn-redis-coordination/check-dependencies.sh → cfn-agent-spawning/check-dependencies.sh.backup} +3 -5
- package/.claude/skills/cfn-agent-spawning/get-agent-provider-env.sh +22 -0
- package/.claude/skills/cfn-agent-spawning/get-agent-provider-env.sh.backup +127 -0
- package/.claude/skills/cfn-agent-spawning/parse-agent-provider.sh +22 -0
- package/.claude/skills/cfn-agent-spawning/parse-agent-provider.sh.backup +59 -0
- package/.claude/skills/cfn-agent-spawning/spawn-agent-wrapper.sh +63 -0
- package/.claude/skills/cfn-agent-spawning/spawn-agent-wrapper.sh.backup +41 -0
- package/.claude/skills/cfn-agent-spawning/spawn-agent.sh +26 -1
- package/.claude/skills/cfn-agent-spawning/spawn-templates.sh +22 -0
- package/.claude/skills/cfn-agent-spawning/spawn-templates.sh.backup +613 -0
- package/.claude/skills/cfn-agent-spawning/spawn-worker.sh +22 -0
- package/.claude/skills/cfn-agent-spawning/spawn-worker.sh.backup +176 -0
- package/.claude/skills/cfn-backlog-management/SKILL.md +1 -1
- package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/metadata.json +8 -0
- package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/original +271 -0
- package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/revert.sh +7 -0
- package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/metadata.json +8 -0
- package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/original +325 -0
- package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/revert.sh +7 -0
- package/.claude/skills/cfn-loop-orchestration/CLI_IMPLEMENTATION_SUMMARY.md +330 -0
- package/.claude/skills/cfn-loop-orchestration/CONFIGURATION_IMPROVEMENTS.md +318 -0
- package/.claude/skills/cfn-loop-orchestration/CONTEXT_LOOKUP_MIGRATION.md +308 -0
- package/.claude/skills/cfn-loop-orchestration/CONTEXT_LOOKUP_QUICK_START.md +378 -0
- package/.claude/skills/cfn-loop-orchestration/E2E_VALIDATION_REPORT.md +262 -0
- package/.claude/skills/cfn-loop-orchestration/IMPLEMENTATION_SUMMARY.md +319 -519
- package/.claude/skills/cfn-loop-orchestration/NORTH_STAR_E2E_REPORT.md +299 -0
- package/.claude/skills/cfn-loop-orchestration/NORTH_STAR_EXECUTION_SUMMARY.md +403 -0
- package/.claude/skills/cfn-loop-orchestration/NORTH_STAR_INDEX.md +323 -0
- package/.claude/skills/cfn-loop-orchestration/SKILL.md +159 -48
- package/.claude/skills/cfn-loop-orchestration/SPAWN_AGENTS_IMPLEMENTATION.md +188 -0
- package/.claude/skills/cfn-loop-orchestration/TEST_COVERAGE_REPORT.md +335 -0
- package/.claude/skills/cfn-loop-orchestration/TEST_COVERAGE_SUMMARY.md +456 -0
- package/.claude/skills/cfn-loop-orchestration/TYPESCRIPT_INTEGRATION_REPORT.md +709 -0
- package/.claude/skills/cfn-loop-orchestration/TYPESCRIPT_INTEGRATION_SUMMARY.md +257 -0
- package/.claude/skills/cfn-loop-orchestration/VALIDATION_REPORT.md +572 -0
- package/.claude/skills/cfn-loop-orchestration/VALIDATION_SUMMARY.txt +196 -0
- package/.claude/skills/cfn-loop-orchestration/VALIDATOR_MODULE_GUIDE.md +526 -0
- package/.claude/skills/cfn-loop-orchestration/archive/legacy-bash/README.md +167 -0
- package/.claude/skills/cfn-loop-orchestration/archive/legacy-bash/orchestrate-enhanced.sh +548 -0
- package/.claude/skills/cfn-loop-orchestration/{orchestrate-wrapper.sh → archive/legacy-bash/orchestrate-wrapper.sh} +11 -1
- package/.claude/skills/cfn-loop-orchestration/archive/legacy-bash/orchestrate.sh +182 -0
- package/.claude/skills/cfn-loop-orchestration/e2e-validation-fixed.js +240 -0
- package/.claude/skills/cfn-loop-orchestration/e2e-validation.js +213 -0
- package/.claude/skills/cfn-loop-orchestration/package-lock.json +3 -0
- package/.claude/skills/cfn-loop-orchestration/package.json +4 -0
- package/.claude/skills/cfn-loop-orchestration/run-north-star-e2e.ts +210 -0
- package/.claude/skills/cfn-loop-orchestration/src/cli/orchestrator-cli.ts +396 -0
- package/.claude/skills/cfn-loop-orchestration/src/helpers/CONFIDENCE_AGGREGATOR.md +564 -0
- package/.claude/skills/cfn-loop-orchestration/src/helpers/CONFIDENCE_AGGREGATOR_QUICK_REF.md +241 -0
- package/.claude/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_IMPLEMENTATION.md +375 -0
- package/.claude/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_QUICK_REFERENCE.md +362 -0
- package/.claude/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_README.md +307 -0
- package/.claude/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_USAGE_GUIDE.md +508 -0
- package/.claude/skills/cfn-loop-orchestration/src/helpers/confidence-aggregator.ts +473 -0
- package/.claude/skills/cfn-loop-orchestration/src/helpers/consensus.ts +1 -1
- package/.claude/skills/cfn-loop-orchestration/src/helpers/context-injector.ts +349 -0
- package/.claude/skills/cfn-loop-orchestration/src/helpers/context-lookup.ts +486 -0
- package/.claude/skills/cfn-loop-orchestration/src/helpers/deliverable-verifier.ts +6 -2
- package/.claude/skills/cfn-loop-orchestration/src/helpers/gate-check.ts +1 -1
- package/.claude/skills/cfn-loop-orchestration/src/helpers/product-owner-decision.ts +316 -0
- package/.claude/skills/cfn-loop-orchestration/src/helpers/spawn-agents.ts +357 -0
- package/.claude/skills/cfn-loop-orchestration/src/helpers/validator.ts +276 -0
- package/.claude/skills/cfn-loop-orchestration/src/index.ts +2 -0
- package/.claude/skills/cfn-loop-orchestration/src/orchestrate.ts +743 -2
- package/.claude/skills/cfn-loop-orchestration/src/types.ts +56 -0
- package/.claude/skills/cfn-loop-orchestration/test-cli.sh +92 -0
- package/.claude/skills/cfn-loop-orchestration/test-typescript-integration.sh +442 -0
- package/.claude/skills/cfn-loop-orchestration/tests/agent-spawner.test.ts +124 -0
- package/.claude/skills/cfn-loop-orchestration/tests/confidence-aggregator.test.ts +604 -0
- package/.claude/skills/cfn-loop-orchestration/tests/context-injector.test.ts +561 -0
- package/.claude/skills/cfn-loop-orchestration/tests/context-lookup.test.ts +661 -0
- package/.claude/skills/cfn-loop-orchestration/tests/deliverable-verifier.test.ts +2 -2
- package/.claude/skills/cfn-loop-orchestration/tests/gate-check-edge-cases.test.ts +422 -0
- package/.claude/skills/cfn-loop-orchestration/tests/gate-checker.test.ts +276 -0
- package/.claude/skills/cfn-loop-orchestration/tests/logger.test.ts +291 -0
- package/.claude/skills/cfn-loop-orchestration/tests/north-star-e2e.test.ts +334 -0
- package/.claude/skills/cfn-loop-orchestration/tests/redis-coordinator.test.ts +321 -0
- package/.claude/skills/cfn-loop-orchestration/tests/spawn-agents.test.ts +284 -0
- package/.claude/skills/cfn-loop-orchestration/tests/validator.test.ts +643 -0
- package/.claude/skills/cfn-loop-validation/IMPLEMENTATION_SUMMARY.md +672 -0
- package/.claude/skills/cfn-loop-validation/INDEX.md +531 -0
- package/.claude/skills/cfn-loop-validation/README_TYPESCRIPT.md +454 -0
- package/.claude/skills/cfn-loop-validation/SKILL.md +48 -1
- package/.claude/skills/cfn-loop-validation/SKILL.md.backup +353 -0
- package/.claude/skills/cfn-loop-validation/SKILL_TYPESCRIPT.md +782 -0
- package/.claude/skills/cfn-loop-validation/VAPOR_DETECTION_EXAMPLES.md +598 -0
- package/.claude/skills/cfn-loop-validation/check-dependencies.sh +22 -0
- package/{claude-assets/skills/cfn-redis-coordination/check-dependencies.sh → .claude/skills/cfn-loop-validation/check-dependencies.sh.backup} +4 -5
- package/.claude/skills/cfn-loop-validation/detect-vapor.sh +59 -0
- package/.claude/skills/cfn-loop-validation/detect-vapor.sh.backup +37 -0
- package/.claude/skills/cfn-loop-validation/dist/.tsbuildinfo +1 -0
- package/.claude/skills/cfn-loop-validation/dist/cli/detect-vapor.d.ts +14 -0
- package/.claude/skills/cfn-loop-validation/dist/cli/detect-vapor.d.ts.map +1 -0
- package/.claude/skills/cfn-loop-validation/dist/cli/detect-vapor.js +185 -0
- package/.claude/skills/cfn-loop-validation/dist/cli/detect-vapor.js.map +1 -0
- package/.claude/skills/cfn-loop-validation/dist/cli/validate-deliverables.d.ts +14 -0
- package/.claude/skills/cfn-loop-validation/dist/cli/validate-deliverables.d.ts.map +1 -0
- package/.claude/skills/cfn-loop-validation/dist/cli/validate-deliverables.js +176 -0
- package/.claude/skills/cfn-loop-validation/dist/cli/validate-deliverables.js.map +1 -0
- package/.claude/skills/cfn-loop-validation/dist/cli/validate-gate.d.ts +19 -0
- package/.claude/skills/cfn-loop-validation/dist/cli/validate-gate.d.ts.map +1 -0
- package/.claude/skills/cfn-loop-validation/dist/cli/validate-gate.js +123 -0
- package/.claude/skills/cfn-loop-validation/dist/cli/validate-gate.js.map +1 -0
- package/.claude/skills/cfn-loop-validation/dist/types.d.ts +156 -0
- package/.claude/skills/cfn-loop-validation/dist/types.d.ts.map +1 -0
- package/.claude/skills/cfn-loop-validation/dist/types.js +66 -0
- package/.claude/skills/cfn-loop-validation/dist/types.js.map +1 -0
- package/.claude/skills/cfn-loop-validation/dist/validator.d.ts +85 -0
- package/.claude/skills/cfn-loop-validation/dist/validator.d.ts.map +1 -0
- package/.claude/skills/cfn-loop-validation/dist/validator.js +411 -0
- package/.claude/skills/cfn-loop-validation/dist/validator.js.map +1 -0
- package/.claude/skills/cfn-loop-validation/orchestrate-cfn-loop.sh +22 -0
- package/.claude/skills/cfn-loop-validation/orchestrate-cfn-loop.sh.backup +252 -0
- package/.claude/skills/cfn-loop-validation/package.json +93 -0
- package/.claude/skills/cfn-loop-validation/src/cli/detect-vapor.ts +177 -0
- package/.claude/skills/cfn-loop-validation/src/cli/validate-deliverables.ts +161 -0
- package/.claude/skills/cfn-loop-validation/src/cli/validate-gate.ts +139 -0
- package/.claude/skills/cfn-loop-validation/src/types.ts +215 -0
- package/.claude/skills/cfn-loop-validation/src/validator.ts +503 -0
- package/.claude/skills/cfn-loop-validation/tests/validator.test.ts +537 -0
- package/.claude/skills/{cfn-redis-coordination → cfn-loop-validation}/tsconfig.json +34 -31
- package/.claude/skills/cfn-loop-validation/validate-deliverables.sh +59 -0
- package/.claude/skills/cfn-loop-validation/validate-deliverables.sh.backup +37 -0
- package/.claude/skills/cfn-loop-validation/validate-gate.sh +63 -0
- package/.claude/skills/cfn-loop-validation/validate-gate.sh.backup +41 -0
- package/.claude/skills/cfn-loop-validation/validate-iteration.sh +22 -0
- package/.claude/skills/cfn-loop-validation/validate-iteration.sh.backup +134 -0
- package/.claude/skills/cfn-product-owner-decision/SKILL.md +479 -147
- package/.claude/skills/cfn-product-owner-decision/TYPESCRIPT_IMPLEMENTATION.md +653 -0
- package/.claude/skills/cfn-product-owner-decision/{execute-decision.sh → archive/legacy-bash/execute-decision.sh} +24 -2
- package/.claude/skills/pre-edit-backup/SKILL.md +324 -0
- package/.claude/skills/pre-edit-backup/SKILL.md.backup +277 -0
- package/.claude/skills/pre-edit-backup/backup.sh +22 -0
- package/.claude/skills/pre-edit-backup/backup.sh.backup +107 -0
- package/claude-assets/agents/cfn-dev-team/analysts/root-cause-analyst.md +2 -2
- package/claude-assets/agents/cfn-dev-team/architecture/base-template-generator.md +1 -1
- package/claude-assets/agents/cfn-dev-team/coordinators/cfn-frontend-coordinator.md +3 -2
- package/claude-assets/agents/cfn-dev-team/coordinators/consensus-builder.md +1 -0
- package/claude-assets/agents/cfn-dev-team/coordinators/handoff-coordinator.md +2 -1
- package/claude-assets/agents/cfn-dev-team/coordinators/multi-sprint-coordinator.md +1 -0
- package/claude-assets/agents/cfn-dev-team/dev-ops/devops-engineer.md +11 -1
- package/claude-assets/agents/cfn-dev-team/dev-ops/docker-specialist.md +58 -35
- package/claude-assets/agents/cfn-dev-team/dev-ops/github-commit-agent.md +2 -2
- package/claude-assets/agents/cfn-dev-team/dev-ops/kubernetes-specialist.md +47 -37
- package/claude-assets/agents/cfn-dev-team/developers/api-gateway-specialist.md +18 -18
- package/claude-assets/agents/cfn-dev-team/developers/backend-developer.md +40 -58
- package/claude-assets/agents/cfn-dev-team/developers/data/data-engineer.md +19 -21
- package/claude-assets/agents/cfn-dev-team/developers/database/database-architect.md +20 -29
- package/claude-assets/agents/cfn-dev-team/developers/frontend/mobile-dev.md +15 -19
- package/claude-assets/agents/cfn-dev-team/developers/frontend/react-frontend-engineer.md +15 -10
- package/claude-assets/agents/cfn-dev-team/developers/frontend/typescript-specialist.md +16 -11
- package/claude-assets/agents/cfn-dev-team/developers/frontend/ui-designer.md +16 -26
- package/claude-assets/agents/cfn-dev-team/developers/graphql-specialist.md +18 -22
- package/claude-assets/agents/cfn-dev-team/developers/rust-developer.md +17 -21
- package/claude-assets/agents/cfn-dev-team/documentation/pseudocode.md +1 -1
- package/claude-assets/agents/cfn-dev-team/product-owners/accessibility-advocate-persona.md +1 -1
- package/claude-assets/agents/cfn-dev-team/product-owners/cto-agent.md +1 -1
- package/claude-assets/agents/cfn-dev-team/product-owners/power-user-persona.md +1 -1
- package/claude-assets/agents/cfn-dev-team/product-owners/product-owner.md +1 -5
- package/claude-assets/agents/cfn-dev-team/reviewers/code-reviewer.md +20 -51
- package/claude-assets/agents/cfn-dev-team/reviewers/quality/code-quality-validator.md +22 -71
- package/claude-assets/agents/cfn-dev-team/reviewers/quality/perf-analyzer.md +21 -64
- package/claude-assets/agents/cfn-dev-team/reviewers/quality/performance-benchmarker.md +22 -67
- package/claude-assets/agents/cfn-dev-team/reviewers/quality/security-specialist.md +24 -68
- package/claude-assets/agents/cfn-dev-team/testers/api-testing-specialist.md +8 -36
- package/claude-assets/agents/cfn-dev-team/testers/chaos-engineering-specialist.md +9 -38
- package/claude-assets/agents/cfn-dev-team/testers/contract-tester.md +17 -55
- package/claude-assets/agents/cfn-dev-team/testers/e2e/playwright-tester.md +1 -1
- package/claude-assets/agents/cfn-dev-team/testers/integration-tester.md +18 -56
- package/claude-assets/agents/cfn-dev-team/testers/interaction-tester.md +9 -37
- package/claude-assets/agents/cfn-dev-team/testers/load-testing-specialist.md +18 -56
- package/claude-assets/agents/cfn-dev-team/testers/mutation-testing-specialist.md +18 -49
- package/claude-assets/agents/cfn-dev-team/testers/playwright-tester.md +8 -37
- package/claude-assets/agents/cfn-dev-team/testers/tester.md +7 -27
- package/claude-assets/agents/cfn-dev-team/testers/unit/tdd-london-unit-swarm.md +1 -1
- package/claude-assets/agents/cfn-dev-team/utility/agent-builder.md +11 -0
- package/claude-assets/agents/cfn-dev-team/utility/analyst.md +13 -29
- package/claude-assets/agents/cfn-dev-team/utility/claude-code-expert.md +1 -1
- package/claude-assets/agents/cfn-dev-team/utility/code-booster.md +13 -13
- package/claude-assets/agents/cfn-dev-team/utility/context-curator.md +7 -2
- package/claude-assets/agents/cfn-dev-team/utility/epic-creator.md +6 -11
- package/claude-assets/agents/cfn-dev-team/utility/memory-leak-specialist.md +121 -715
- package/claude-assets/agents/cfn-dev-team/utility/researcher.md +13 -22
- package/claude-assets/agents/cfn-dev-team/utility/z-ai-specialist.md +147 -573
- package/claude-assets/agents/custom/cfn-docker-expert.md +103 -0
- package/claude-assets/agents/custom/cfn-loops-cli-expert.md +438 -0
- package/claude-assets/agents/custom/cfn-redis-operations.md +529 -529
- package/claude-assets/agents/custom/cfn-system-expert.md +1 -1
- package/claude-assets/agents/custom/trigger-dev-expert.md +369 -0
- package/claude-assets/agents/docker-team/micro-sprint-planner.md +747 -747
- package/claude-assets/agents/project-only-agents/npm-package-specialist.md +1 -1
- package/claude-assets/cfn-extras/agents/cfn-v3-coordinator.md +517 -0
- package/claude-assets/cfn-extras/skills/GOOGLE_SHEETS_SKILLS_README.md +1 -1
- package/claude-assets/cfn-extras/skills/google-sheets-api-coordinator/SKILL.md +1 -1
- package/claude-assets/cfn-extras/skills/google-sheets-formula-builder/SKILL.md +1 -1
- package/claude-assets/cfn-extras/skills/google-sheets-progress/SKILL.md +1 -1
- package/claude-assets/commands/CFN_LOOP_FRONTEND.md +1 -1
- package/claude-assets/commands/cfn-loop-cli.md +214 -442
- package/claude-assets/commands/cfn-loop-frontend.md +1 -1
- package/claude-assets/commands/cfn-loop-task.md +2 -2
- package/claude-assets/commands/cfn-loop-trigger.md +114 -0
- package/claude-assets/commands/deprecated/cfn-loop.md +2 -2
- package/claude-assets/hooks/GIT-HOOKS-USAGE-EXAMPLES.md +116 -0
- package/claude-assets/hooks/README-GIT-HOOKS.md +443 -0
- package/claude-assets/hooks/SKILL.md +518 -0
- package/claude-assets/hooks/SKILL.md.backup +471 -0
- package/claude-assets/hooks/cfn-invoke-post-edit-ts.sh +100 -0
- package/claude-assets/hooks/cfn-invoke-post-edit-ts.sh.backup +78 -0
- package/claude-assets/hooks/cfn-invoke-post-edit.sh +53 -5
- package/claude-assets/hooks/cfn-invoke-post-edit.sh.backup +87 -0
- package/claude-assets/hooks/cfn-invoke-pre-edit-ts.sh +116 -0
- package/claude-assets/hooks/cfn-invoke-pre-edit-ts.sh.backup +94 -0
- package/claude-assets/hooks/cfn-invoke-pre-edit.sh +22 -0
- package/claude-assets/hooks/cfn-invoke-pre-edit.sh.backup +88 -0
- package/claude-assets/hooks/cfn-post-edit.config.json +9 -2
- package/claude-assets/hooks/install-git-hooks.sh +243 -0
- package/claude-assets/hooks/subagent-start.sh +98 -0
- package/claude-assets/hooks/subagent-stop.sh +93 -0
- package/claude-assets/hooks/validators/credential-scanner.sh +172 -0
- package/claude-assets/root-claude-distribute/CFN-CLAUDE.md +1 -1
- package/claude-assets/skills/cfn-agent-selection-with-fallback/DELIVERABLES.md +409 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/IMPLEMENTATION_SUMMARY.md +396 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/INTEGRATION_GUIDE.md +308 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/QUICK_REFERENCE.md +239 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/SKILL.md +107 -1
- package/claude-assets/skills/cfn-agent-selection-with-fallback/SKILL.md.backup +302 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/TYPESCRIPT_MIGRATION.md +295 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/dist/agent-selector.cjs +297 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/dist/agent-selector.js +297 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/dist/cli.cjs +96 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/dist/cli.js +96 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/select-agents-ts.sh +45 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/select-agents-ts.sh.backup +23 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/select-agents.sh +22 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/select-agents.sh.backup +173 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/src/agent-selector.test.ts +357 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/src/agent-selector.ts +350 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/src/cli.ts +74 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/task-classifier.sh +22 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/task-classifier.sh.backup +71 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/tsconfig.json +18 -0
- package/claude-assets/skills/cfn-agent-spawning/SKILL.md +48 -1
- package/claude-assets/skills/cfn-agent-spawning/SKILL.md.backup +135 -0
- package/claude-assets/skills/cfn-agent-spawning/TYPESCRIPT_MIGRATION.md +567 -0
- package/claude-assets/skills/cfn-agent-spawning/check-dependencies.sh +22 -0
- package/claude-assets/skills/cfn-agent-spawning/check-dependencies.sh.backup +30 -0
- package/claude-assets/skills/cfn-agent-spawning/get-agent-provider-env.sh +22 -0
- package/claude-assets/skills/cfn-agent-spawning/get-agent-provider-env.sh.backup +127 -0
- package/claude-assets/skills/cfn-agent-spawning/parse-agent-provider.sh +22 -0
- package/claude-assets/skills/cfn-agent-spawning/parse-agent-provider.sh.backup +59 -0
- package/claude-assets/skills/cfn-agent-spawning/spawn-agent-wrapper.sh +63 -0
- package/claude-assets/skills/cfn-agent-spawning/spawn-agent-wrapper.sh.backup +41 -0
- package/claude-assets/skills/cfn-agent-spawning/spawn-agent.sh +26 -1
- package/claude-assets/skills/cfn-agent-spawning/spawn-templates.sh +22 -0
- package/claude-assets/skills/cfn-agent-spawning/spawn-templates.sh.backup +613 -0
- package/claude-assets/skills/cfn-agent-spawning/spawn-worker.sh +22 -0
- package/claude-assets/skills/cfn-agent-spawning/spawn-worker.sh.backup +176 -0
- package/claude-assets/skills/cfn-backlog-management/SKILL.md +1 -1
- package/claude-assets/skills/cfn-coordination/agent-completion.sh.backup +36 -0
- package/claude-assets/skills/cfn-coordination/coordination-signal.sh.backup +36 -0
- package/claude-assets/skills/cfn-coordination/coordination-wait.sh.backup +36 -0
- package/claude-assets/skills/cfn-dependency-ingestion/README.md +101 -0
- package/claude-assets/skills/cfn-dependency-ingestion/SKILL.md +397 -0
- package/claude-assets/skills/cfn-dependency-ingestion/build.sh +23 -0
- package/claude-assets/skills/cfn-dependency-ingestion/dist/ingest-dependencies.js +478 -0
- package/claude-assets/skills/cfn-dependency-ingestion/ingest-dependencies.sh +295 -0
- package/claude-assets/skills/cfn-dependency-ingestion/ingest.sh +237 -0
- package/claude-assets/skills/cfn-dependency-ingestion/manifests/cli-mode-dependencies.txt +73 -0
- package/claude-assets/skills/cfn-dependency-ingestion/manifests/shared-dependencies.txt +57 -0
- package/claude-assets/skills/cfn-dependency-ingestion/manifests/trigger-dev-dependencies.txt +82 -0
- package/claude-assets/skills/cfn-dependency-ingestion/manifests/trigger-mode-dependencies.txt +80 -0
- package/claude-assets/skills/cfn-dependency-ingestion/src/ingest-dependencies.ts +563 -0
- package/claude-assets/skills/cfn-environment-sanitization/sanitize-environment.sh +14 -4
- package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/metadata.json +8 -0
- package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/original +271 -0
- package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/revert.sh +7 -0
- package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/metadata.json +8 -0
- package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/original +325 -0
- package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/revert.sh +7 -0
- package/claude-assets/skills/cfn-loop-orchestration/CLI_IMPLEMENTATION_SUMMARY.md +330 -0
- package/claude-assets/skills/cfn-loop-orchestration/CONFIGURATION_IMPROVEMENTS.md +318 -0
- package/claude-assets/skills/cfn-loop-orchestration/CONTEXT_LOOKUP_MIGRATION.md +308 -0
- package/claude-assets/skills/cfn-loop-orchestration/CONTEXT_LOOKUP_QUICK_START.md +378 -0
- package/claude-assets/skills/cfn-loop-orchestration/E2E_VALIDATION_REPORT.md +262 -0
- package/claude-assets/skills/cfn-loop-orchestration/IMPLEMENTATION_SUMMARY.md +319 -519
- package/claude-assets/skills/cfn-loop-orchestration/NORTH_STAR_E2E_REPORT.md +299 -0
- package/claude-assets/skills/cfn-loop-orchestration/NORTH_STAR_EXECUTION_SUMMARY.md +403 -0
- package/claude-assets/skills/cfn-loop-orchestration/NORTH_STAR_INDEX.md +323 -0
- package/claude-assets/skills/cfn-loop-orchestration/SKILL.md +159 -48
- package/claude-assets/skills/cfn-loop-orchestration/SPAWN_AGENTS_IMPLEMENTATION.md +188 -0
- package/claude-assets/skills/cfn-loop-orchestration/TEST_COVERAGE_REPORT.md +335 -0
- package/claude-assets/skills/cfn-loop-orchestration/TEST_COVERAGE_SUMMARY.md +456 -0
- package/claude-assets/skills/cfn-loop-orchestration/TYPESCRIPT_INTEGRATION_REPORT.md +709 -0
- package/claude-assets/skills/cfn-loop-orchestration/TYPESCRIPT_INTEGRATION_SUMMARY.md +257 -0
- package/claude-assets/skills/cfn-loop-orchestration/VALIDATION_REPORT.md +572 -0
- package/claude-assets/skills/cfn-loop-orchestration/VALIDATION_SUMMARY.txt +196 -0
- package/claude-assets/skills/cfn-loop-orchestration/VALIDATOR_MODULE_GUIDE.md +526 -0
- package/claude-assets/skills/cfn-loop-orchestration/archive/legacy-bash/README.md +167 -0
- package/claude-assets/skills/cfn-loop-orchestration/archive/legacy-bash/orchestrate-enhanced.sh +548 -0
- package/claude-assets/skills/cfn-loop-orchestration/{orchestrate-wrapper.sh → archive/legacy-bash/orchestrate-wrapper.sh} +11 -1
- package/claude-assets/skills/cfn-loop-orchestration/archive/legacy-bash/orchestrate.sh +182 -0
- package/claude-assets/skills/cfn-loop-orchestration/e2e-validation-fixed.js +240 -0
- package/claude-assets/skills/cfn-loop-orchestration/e2e-validation.js +213 -0
- package/claude-assets/skills/cfn-loop-orchestration/package-lock.json +3 -0
- package/claude-assets/skills/cfn-loop-orchestration/package.json +4 -0
- package/claude-assets/skills/cfn-loop-orchestration/run-north-star-e2e.ts +210 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/cli/orchestrator-cli.ts +396 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONFIDENCE_AGGREGATOR.md +564 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONFIDENCE_AGGREGATOR_QUICK_REF.md +241 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_IMPLEMENTATION.md +375 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_QUICK_REFERENCE.md +362 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_README.md +307 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_USAGE_GUIDE.md +508 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/confidence-aggregator.ts +473 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/consensus.ts +1 -1
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/context-injector.ts +349 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/context-lookup.ts +486 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/deliverable-verifier.ts +6 -2
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/gate-check.ts +1 -1
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/product-owner-decision.ts +316 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/spawn-agents.ts +357 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/validator.ts +276 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/index.ts +2 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/orchestrate.ts +743 -2
- package/claude-assets/skills/cfn-loop-orchestration/src/types.ts +56 -0
- package/claude-assets/skills/cfn-loop-orchestration/test-cli.sh +92 -0
- package/claude-assets/skills/cfn-loop-orchestration/test-typescript-integration.sh +442 -0
- package/claude-assets/skills/cfn-loop-orchestration/tests/agent-spawner.test.ts +124 -0
- package/claude-assets/skills/cfn-loop-orchestration/tests/confidence-aggregator.test.ts +604 -0
- package/claude-assets/skills/cfn-loop-orchestration/tests/context-injector.test.ts +561 -0
- package/claude-assets/skills/cfn-loop-orchestration/tests/context-lookup.test.ts +661 -0
- package/claude-assets/skills/cfn-loop-orchestration/tests/deliverable-verifier.test.ts +2 -2
- package/claude-assets/skills/cfn-loop-orchestration/tests/gate-check-edge-cases.test.ts +422 -0
- package/claude-assets/skills/cfn-loop-orchestration/tests/gate-checker.test.ts +276 -0
- package/claude-assets/skills/cfn-loop-orchestration/tests/logger.test.ts +291 -0
- package/claude-assets/skills/cfn-loop-orchestration/tests/north-star-e2e.test.ts +334 -0
- package/claude-assets/skills/cfn-loop-orchestration/tests/redis-coordinator.test.ts +321 -0
- package/claude-assets/skills/cfn-loop-orchestration/tests/spawn-agents.test.ts +284 -0
- package/claude-assets/skills/cfn-loop-orchestration/tests/validator.test.ts +643 -0
- package/claude-assets/skills/cfn-loop-output-processing/.eslintrc.json +33 -0
- package/claude-assets/skills/cfn-loop-output-processing/DELIVERY_SUMMARY.txt +462 -0
- package/claude-assets/skills/cfn-loop-output-processing/DEPRECATION_NOTICE.md +183 -0
- package/claude-assets/skills/cfn-loop-output-processing/EXAMPLES.md +609 -0
- package/claude-assets/skills/cfn-loop-output-processing/IMPLEMENTATION_SUMMARY.md +418 -0
- package/claude-assets/skills/cfn-loop-output-processing/INDEX.md +531 -0
- package/claude-assets/skills/cfn-loop-output-processing/MIGRATION.md +362 -0
- package/claude-assets/skills/cfn-loop-output-processing/README.md +114 -0
- package/claude-assets/skills/cfn-loop-output-processing/SKILL.md +633 -0
- package/{.claude/skills/cfn-docker-redis-coordination → claude-assets/skills/cfn-loop-output-processing}/jest.config.js +7 -15
- package/claude-assets/skills/cfn-loop-output-processing/package.json +50 -0
- package/claude-assets/skills/cfn-loop-output-processing/src/cli/process-loop2.ts +195 -0
- package/claude-assets/skills/cfn-loop-output-processing/src/cli/process-loop3.ts +157 -0
- package/claude-assets/skills/cfn-loop-output-processing/src/output-processor.ts +632 -0
- package/claude-assets/skills/cfn-loop-output-processing/tests/output-processor.test.ts +617 -0
- package/claude-assets/skills/{cfn-docker-redis-coordination → cfn-loop-output-processing}/tsconfig.json +16 -7
- package/claude-assets/skills/cfn-loop-validation/IMPLEMENTATION_SUMMARY.md +672 -0
- package/claude-assets/skills/cfn-loop-validation/INDEX.md +531 -0
- package/claude-assets/skills/cfn-loop-validation/README_TYPESCRIPT.md +454 -0
- package/claude-assets/skills/cfn-loop-validation/SKILL.md +48 -1
- package/claude-assets/skills/cfn-loop-validation/SKILL.md.backup +353 -0
- package/claude-assets/skills/cfn-loop-validation/SKILL_TYPESCRIPT.md +782 -0
- package/claude-assets/skills/cfn-loop-validation/VAPOR_DETECTION_EXAMPLES.md +598 -0
- package/claude-assets/skills/cfn-loop-validation/check-dependencies.sh +22 -0
- package/claude-assets/skills/cfn-loop-validation/check-dependencies.sh.backup +31 -0
- package/claude-assets/skills/cfn-loop-validation/detect-vapor.sh +59 -0
- package/claude-assets/skills/cfn-loop-validation/detect-vapor.sh.backup +37 -0
- package/claude-assets/skills/cfn-loop-validation/dist/.tsbuildinfo +1 -0
- package/claude-assets/skills/cfn-loop-validation/dist/cli/detect-vapor.d.ts +14 -0
- package/claude-assets/skills/cfn-loop-validation/dist/cli/detect-vapor.d.ts.map +1 -0
- package/claude-assets/skills/cfn-loop-validation/dist/cli/detect-vapor.js +185 -0
- package/claude-assets/skills/cfn-loop-validation/dist/cli/detect-vapor.js.map +1 -0
- package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-deliverables.d.ts +14 -0
- package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-deliverables.d.ts.map +1 -0
- package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-deliverables.js +176 -0
- package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-deliverables.js.map +1 -0
- package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-gate.d.ts +19 -0
- package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-gate.d.ts.map +1 -0
- package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-gate.js +123 -0
- package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-gate.js.map +1 -0
- package/claude-assets/skills/cfn-loop-validation/dist/types.d.ts +156 -0
- package/claude-assets/skills/cfn-loop-validation/dist/types.d.ts.map +1 -0
- package/claude-assets/skills/cfn-loop-validation/dist/types.js +66 -0
- package/claude-assets/skills/cfn-loop-validation/dist/types.js.map +1 -0
- package/claude-assets/skills/cfn-loop-validation/dist/validator.d.ts +85 -0
- package/claude-assets/skills/cfn-loop-validation/dist/validator.d.ts.map +1 -0
- package/claude-assets/skills/cfn-loop-validation/dist/validator.js +411 -0
- package/claude-assets/skills/cfn-loop-validation/dist/validator.js.map +1 -0
- package/claude-assets/skills/cfn-loop-validation/orchestrate-cfn-loop.sh +22 -0
- package/claude-assets/skills/cfn-loop-validation/orchestrate-cfn-loop.sh.backup +252 -0
- package/claude-assets/skills/cfn-loop-validation/package.json +93 -0
- package/claude-assets/skills/cfn-loop-validation/src/cli/detect-vapor.ts +177 -0
- package/claude-assets/skills/cfn-loop-validation/src/cli/validate-deliverables.ts +161 -0
- package/claude-assets/skills/cfn-loop-validation/src/cli/validate-gate.ts +139 -0
- package/claude-assets/skills/cfn-loop-validation/src/types.ts +215 -0
- package/claude-assets/skills/cfn-loop-validation/src/validator.ts +503 -0
- package/claude-assets/skills/cfn-loop-validation/tests/validator.test.ts +537 -0
- package/claude-assets/skills/{cfn-redis-coordination → cfn-loop-validation}/tsconfig.json +34 -31
- package/claude-assets/skills/cfn-loop-validation/validate-deliverables.sh +59 -0
- package/claude-assets/skills/cfn-loop-validation/validate-deliverables.sh.backup +37 -0
- package/claude-assets/skills/cfn-loop-validation/validate-gate.sh +63 -0
- package/claude-assets/skills/cfn-loop-validation/validate-gate.sh.backup +41 -0
- package/claude-assets/skills/cfn-loop-validation/validate-iteration.sh +22 -0
- package/claude-assets/skills/cfn-loop-validation/validate-iteration.sh.backup +134 -0
- package/claude-assets/skills/cfn-product-owner-decision/SKILL.md +479 -147
- package/claude-assets/skills/cfn-product-owner-decision/TYPESCRIPT_IMPLEMENTATION.md +653 -0
- package/claude-assets/skills/cfn-product-owner-decision/{execute-decision.sh → archive/legacy-bash/execute-decision.sh} +24 -2
- package/claude-assets/skills/cfn-provider-routing/README.md +129 -0
- package/claude-assets/skills/cfn-provider-routing/SKILL.md +215 -0
- package/claude-assets/skills/cfn-provider-routing/resolve-provider-model.ts +223 -0
- package/claude-assets/skills/docker-build/build.sh +1 -1
- package/claude-assets/skills/pre-edit-backup/SKILL.md +324 -0
- package/claude-assets/skills/pre-edit-backup/SKILL.md.backup +277 -0
- package/claude-assets/skills/pre-edit-backup/backup.sh +22 -0
- package/claude-assets/skills/pre-edit-backup/backup.sh.backup +107 -0
- package/dist/agent/skill-mcp-selector.js +2 -1
- package/dist/agent/skill-mcp-selector.js.map +1 -1
- package/dist/api/auth-endpoints.js +415 -0
- package/dist/api/auth-endpoints.js.map +1 -0
- package/dist/api/task-endpoints.js +562 -0
- package/dist/api/task-endpoints.js.map +1 -0
- package/dist/backend/server.js +418 -0
- package/dist/backend/server.js.map +1 -0
- package/dist/cfn-loop/product-owner/decision-parser.js +356 -0
- package/dist/cfn-loop/product-owner/decision-parser.js.map +1 -0
- package/dist/cfn-loop/product-owner/index.js +1 -0
- package/dist/cfn-loop/product-owner/index.js.map +1 -1
- package/dist/cli/agent-command.js +1 -1
- package/dist/cli/agent-command.js.map +1 -1
- package/dist/cli/agent-completion.js +273 -0
- package/dist/cli/agent-completion.js.map +1 -0
- package/dist/cli/agent-executor.js +470 -26
- package/dist/cli/agent-executor.js.map +1 -1
- package/dist/cli/agent-prompt-builder.js +83 -48
- package/dist/cli/agent-prompt-builder.js.map +1 -1
- package/dist/cli/agent-spawn.js +7 -4
- package/dist/cli/agent-spawn.js.map +1 -1
- package/dist/cli/agent-spawner.js +546 -0
- package/dist/cli/agent-spawner.js.map +1 -0
- package/dist/cli/agent-token-manager.js +2 -1
- package/dist/cli/agent-token-manager.js.map +1 -1
- package/dist/cli/anthropic-client.js +127 -14
- package/dist/cli/anthropic-client.js.map +1 -1
- package/dist/cli/cfn-context.js +2 -1
- package/dist/cli/cfn-context.js.map +1 -1
- package/dist/cli/cfn-metrics.js +2 -1
- package/dist/cli/cfn-metrics.js.map +1 -1
- package/dist/cli/cfn-redis.js +2 -1
- package/dist/cli/cfn-redis.js.map +1 -1
- package/dist/cli/cli-agent-context.js +2 -0
- package/dist/cli/cli-agent-context.js.map +1 -1
- package/dist/cli/config-manager.js +90 -356
- package/dist/cli/config-manager.js.map +1 -1
- package/dist/cli/conversation-fork-cleanup.js +2 -1
- package/dist/cli/conversation-fork-cleanup.js.map +1 -1
- package/dist/cli/conversation-fork.js +2 -1
- package/dist/cli/conversation-fork.js.map +1 -1
- package/dist/cli/coordination/agent-messaging.js +415 -0
- package/dist/cli/coordination/agent-messaging.js.map +1 -0
- package/dist/cli/coordination/wait-for-threshold.js +232 -0
- package/dist/cli/coordination/wait-for-threshold.js.map +1 -0
- package/dist/cli/index.js +11 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/iteration-history.js +2 -1
- package/dist/cli/iteration-history.js.map +1 -1
- package/dist/cli/parse-decision-cli.js +268 -0
- package/dist/cli/parse-decision-cli.js.map +1 -0
- package/dist/cli/post-edit-hook.js +83 -0
- package/dist/cli/post-edit-hook.js.map +1 -0
- package/dist/cli/pre-edit-hook.js +77 -0
- package/dist/cli/pre-edit-hook.js.map +1 -0
- package/dist/cli/process-lifecycle.js +5 -1
- package/dist/cli/process-lifecycle.js.map +1 -1
- package/dist/cli/spawn-agent-cli.js +244 -0
- package/dist/cli/spawn-agent-cli.js.map +1 -0
- package/dist/coordination/coordination-wrapper.js +383 -0
- package/dist/coordination/coordination-wrapper.js.map +1 -0
- package/dist/coordination/redis-waiting-mode.js +4 -0
- package/dist/coordination/redis-waiting-mode.js.map +1 -1
- package/dist/coordination/store-success-criteria.js +68 -0
- package/dist/coordination/store-success-criteria.js.map +1 -0
- package/dist/coordination/store-task-context.js +65 -0
- package/dist/coordination/store-task-context.js.map +1 -0
- package/dist/hooks/backup-manager.js +273 -0
- package/dist/hooks/backup-manager.js.map +1 -0
- package/dist/hooks/post-edit-validator.js +388 -0
- package/dist/hooks/post-edit-validator.js.map +1 -0
- package/dist/integration/index.js +19 -0
- package/dist/integration/index.js.map +1 -0
- package/dist/integration/task-mode-adapter.js +297 -0
- package/dist/integration/task-mode-adapter.js.map +1 -0
- package/dist/integration/trigger-dev-client.js +253 -0
- package/dist/integration/trigger-dev-client.js.map +1 -0
- package/dist/integration/trigger-dev-webhooks.js +362 -0
- package/dist/integration/trigger-dev-webhooks.js.map +1 -0
- package/dist/lib/artifact-registry.js +4 -0
- package/dist/lib/artifact-registry.js.map +1 -1
- package/dist/lib/connection-pool.js +390 -0
- package/dist/lib/connection-pool.js.map +1 -0
- package/dist/lib/environment-contract.js +258 -0
- package/dist/lib/environment-contract.js.map +1 -0
- package/dist/lib/path-validator.js +14 -5
- package/dist/lib/path-validator.js.map +1 -1
- package/dist/lib/query-optimizer.js +388 -0
- package/dist/lib/query-optimizer.js.map +1 -0
- package/dist/lib/redis-queue-manager.js +5 -1
- package/dist/lib/redis-queue-manager.js.map +1 -1
- package/dist/lib/result-cache.js +285 -0
- package/dist/lib/result-cache.js.map +1 -0
- package/dist/mcp/auth-middleware.js +2 -1
- package/dist/mcp/auth-middleware.js.map +1 -1
- package/dist/mcp/playwright-mcp-server-auth.js +2 -1
- package/dist/mcp/playwright-mcp-server-auth.js.map +1 -1
- package/dist/middleware/authentication.js +317 -0
- package/dist/middleware/authentication.js.map +1 -0
- package/dist/services/authentication.js +669 -0
- package/dist/services/authentication.js.map +1 -0
- package/dist/services/session-management.js +436 -0
- package/dist/services/session-management.js.map +1 -0
- package/dist/services/skill-deployment.js +8 -6
- package/dist/services/skill-deployment.js.map +1 -1
- package/dist/services/user-service.js +710 -0
- package/dist/services/user-service.js.map +1 -0
- package/dist/types/trigger-dev-events.d.js +10 -0
- package/dist/types/trigger-dev-events.d.js.map +1 -0
- package/docs/README.md +240 -0
- package/package.json +15 -4
- package/scripts/build-agent-image.sh +1 -1
- package/scripts/compare-workflow-performance.sh +556 -0
- package/scripts/cost-allocation-tracker.sh +632 -0
- package/scripts/docker-rebuild-all-agents.sh +2 -2
- package/scripts/migrate-to-optimized-workflows.sh +438 -0
- package/scripts/organize-docs.sh +338 -0
- package/scripts/reorganize-tests.sh +280 -0
- package/scripts/trigger-dev-setup.sh +279 -0
- package/tests/README.md +45 -0
- package/.claude/commands/cost-savings-status.md +0 -34
- package/.claude/commands/metrics-summary.md +0 -58
- package/.claude/skills/cfn-docker-redis-coordination/MIGRATION_SUMMARY.md +0 -348
- package/.claude/skills/cfn-docker-redis-coordination/README.md +0 -294
- package/.claude/skills/cfn-docker-redis-coordination/SKILL.md +0 -435
- package/.claude/skills/cfn-docker-redis-coordination/coordinate.sh +0 -650
- package/.claude/skills/cfn-docker-redis-coordination/coordinate.sh.backup-1763145142 +0 -641
- package/.claude/skills/cfn-docker-redis-coordination/package-lock.json +0 -5259
- package/.claude/skills/cfn-docker-redis-coordination/package.json +0 -40
- package/.claude/skills/cfn-docker-redis-coordination/src/coordinator.ts +0 -801
- package/.claude/skills/cfn-docker-redis-coordination/src/index.ts +0 -42
- package/.claude/skills/cfn-docker-redis-coordination/src/types.ts +0 -351
- package/.claude/skills/cfn-docker-redis-coordination/tests/coordinator.test.ts +0 -1464
- package/.claude/skills/cfn-docker-redis-coordination/tsconfig.json +0 -30
- package/.claude/skills/cfn-loop-orchestration/helpers/auto-tune-timeouts.sh +0 -228
- package/.claude/skills/cfn-loop-orchestration/helpers/consensus-ts.sh +0 -104
- package/.claude/skills/cfn-loop-orchestration/helpers/consensus.sh +0 -94
- package/.claude/skills/cfn-loop-orchestration/helpers/context-injection.sh +0 -142
- package/.claude/skills/cfn-loop-orchestration/helpers/context-lookup.sh +0 -359
- package/.claude/skills/cfn-loop-orchestration/helpers/deliverable-verifier-ts.sh +0 -123
- package/.claude/skills/cfn-loop-orchestration/helpers/deliverable-verifier.sh +0 -71
- package/.claude/skills/cfn-loop-orchestration/helpers/gate-check.sh +0 -56
- package/.claude/skills/cfn-loop-orchestration/helpers/iteration-manager-ts.sh +0 -89
- package/.claude/skills/cfn-loop-orchestration/helpers/iteration-manager.sh +0 -87
- package/.claude/skills/cfn-loop-orchestration/helpers/orchestrate-ts.sh +0 -104
- package/.claude/skills/cfn-loop-orchestration/helpers/parse-test-results.sh +0 -56
- package/.claude/skills/cfn-loop-orchestration/helpers/spawn-agents.sh +0 -290
- package/.claude/skills/cfn-loop-orchestration/helpers/timeout-calculator-ts.sh +0 -47
- package/.claude/skills/cfn-loop-orchestration/helpers/timeout-calculator.sh +0 -51
- package/.claude/skills/cfn-loop-orchestration/orchestrate.sh +0 -1345
- package/.claude/skills/cfn-redis-coordination/AGENT_LOGGING.md +0 -280
- package/.claude/skills/cfn-redis-coordination/BZPOPMIN_FIX_SUMMARY.md +0 -209
- package/.claude/skills/cfn-redis-coordination/CENTRALIZED_REDIS_WRAPPER.md +0 -319
- package/.claude/skills/cfn-redis-coordination/agent-log.sh.bak +0 -124
- package/.claude/skills/cfn-redis-coordination/config.json +0 -61
- package/.claude/skills/cfn-redis-coordination/demos/phase4-wake-queue-test-report.md +0 -82
- package/.claude/skills/cfn-redis-coordination/demos/test-bzpopmin-fix.sh +0 -274
- package/.claude/skills/cfn-redis-coordination/demos/test-cancel-swarm.sh +0 -0
- package/.claude/skills/cfn-redis-coordination/docs/migration/PHASE_3_REDIS_COORDINATION_COMPLETION_REPORT.md +0 -553
- package/.claude/skills/cfn-redis-coordination/jest.config.js +0 -23
- package/.claude/skills/cfn-redis-coordination/package-lock.json +0 -5272
- package/.claude/skills/cfn-redis-coordination/package.json +0 -45
- package/.claude/skills/cfn-redis-coordination/src/agent-logger.ts +0 -446
- package/.claude/skills/cfn-redis-coordination/src/agent-recovery.ts +0 -454
- package/.claude/skills/cfn-redis-coordination/src/completion-reporter.ts +0 -396
- package/.claude/skills/cfn-redis-coordination/src/context-manager.ts +0 -327
- package/.claude/skills/cfn-redis-coordination/src/index.ts +0 -82
- package/.claude/skills/cfn-redis-coordination/src/mode-detector.ts +0 -155
- package/.claude/skills/cfn-redis-coordination/src/redis/redis-client.ts +0 -305
- package/.claude/skills/cfn-redis-coordination/src/redis/redis-functions.ts +0 -283
- package/.claude/skills/cfn-redis-coordination/src/redis-client.ts +0 -654
- package/.claude/skills/cfn-redis-coordination/src/result-collector.ts +0 -437
- package/.claude/skills/cfn-redis-coordination/src/swarm-manager.ts +0 -494
- package/.claude/skills/cfn-redis-coordination/src/task-analyzer.ts +0 -404
- package/.claude/skills/cfn-redis-coordination/src/task-executor.ts +0 -423
- package/.claude/skills/cfn-redis-coordination/src/types.ts +0 -235
- package/.claude/skills/cfn-redis-coordination/src/waiting-coordinator.ts +0 -587
- package/.claude/skills/cfn-redis-coordination/store-success-criteria.sh +0 -85
- package/.claude/skills/cfn-redis-coordination/test-connection-attempts.js +0 -70
- package/.claude/skills/cfn-redis-coordination/test-mode-simple.js +0 -121
- package/.claude/skills/cfn-redis-coordination/test-redis-check.js +0 -84
- package/.claude/skills/cfn-redis-coordination/test-task-mode-redis.cjs +0 -391
- package/.claude/skills/cfn-redis-coordination/tests/coordination.test.ts +0 -788
- package/.claude/skills/cfn-redis-coordination/update-all-scripts.sh +0 -67
- package/claude-assets/agents/cfn-dev-team/coordinators/cfn-v3-coordinator.md +0 -980
- package/claude-assets/agents/cfn-dev-team/dev-ops/monitoring-specialist.md +0 -759
- package/claude-assets/agents/custom/test-mcp-access.md +0 -24
- package/claude-assets/agents/typescript-specialist.md +0 -280
- package/claude-assets/commands/cost-savings-status.md +0 -34
- package/claude-assets/commands/metrics-summary.md +0 -58
- package/claude-assets/skills/cfn-docker-redis-coordination/MIGRATION_SUMMARY.md +0 -348
- package/claude-assets/skills/cfn-docker-redis-coordination/README.md +0 -294
- package/claude-assets/skills/cfn-docker-redis-coordination/SKILL.md +0 -435
- package/claude-assets/skills/cfn-docker-redis-coordination/coordinate.sh +0 -650
- package/claude-assets/skills/cfn-docker-redis-coordination/coordinate.sh.backup-1763145142 +0 -641
- package/claude-assets/skills/cfn-docker-redis-coordination/jest.config.js +0 -37
- package/claude-assets/skills/cfn-docker-redis-coordination/package-lock.json +0 -5259
- package/claude-assets/skills/cfn-docker-redis-coordination/package.json +0 -40
- package/claude-assets/skills/cfn-docker-redis-coordination/src/coordinator.ts +0 -801
- package/claude-assets/skills/cfn-docker-redis-coordination/src/index.ts +0 -42
- package/claude-assets/skills/cfn-docker-redis-coordination/src/types.ts +0 -351
- package/claude-assets/skills/cfn-docker-redis-coordination/tests/coordinator.test.ts +0 -1464
- package/claude-assets/skills/cfn-loop-orchestration/helpers/auto-tune-timeouts.sh +0 -228
- package/claude-assets/skills/cfn-loop-orchestration/helpers/consensus-ts.sh +0 -104
- package/claude-assets/skills/cfn-loop-orchestration/helpers/consensus.sh +0 -94
- package/claude-assets/skills/cfn-loop-orchestration/helpers/context-injection.sh +0 -142
- package/claude-assets/skills/cfn-loop-orchestration/helpers/context-lookup.sh +0 -359
- package/claude-assets/skills/cfn-loop-orchestration/helpers/deliverable-verifier-ts.sh +0 -123
- package/claude-assets/skills/cfn-loop-orchestration/helpers/deliverable-verifier.sh +0 -71
- package/claude-assets/skills/cfn-loop-orchestration/helpers/gate-check.sh +0 -56
- package/claude-assets/skills/cfn-loop-orchestration/helpers/iteration-manager-ts.sh +0 -89
- package/claude-assets/skills/cfn-loop-orchestration/helpers/iteration-manager.sh +0 -87
- package/claude-assets/skills/cfn-loop-orchestration/helpers/orchestrate-ts.sh +0 -104
- package/claude-assets/skills/cfn-loop-orchestration/helpers/parse-test-results.sh +0 -56
- package/claude-assets/skills/cfn-loop-orchestration/helpers/spawn-agents.sh +0 -290
- package/claude-assets/skills/cfn-loop-orchestration/helpers/timeout-calculator-ts.sh +0 -47
- package/claude-assets/skills/cfn-loop-orchestration/helpers/timeout-calculator.sh +0 -51
- package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh +0 -1345
- package/claude-assets/skills/cfn-redis-cleanup/cleanup-redis.sh +0 -130
- package/claude-assets/skills/cfn-redis-coordination/AGENT_LOGGING.md +0 -280
- package/claude-assets/skills/cfn-redis-coordination/BZPOPMIN_FIX_SUMMARY.md +0 -209
- package/claude-assets/skills/cfn-redis-coordination/CENTRALIZED_REDIS_WRAPPER.md +0 -319
- package/claude-assets/skills/cfn-redis-coordination/agent-log.sh.bak +0 -124
- package/claude-assets/skills/cfn-redis-coordination/config.json +0 -61
- package/claude-assets/skills/cfn-redis-coordination/demos/phase4-wake-queue-test-report.md +0 -82
- package/claude-assets/skills/cfn-redis-coordination/demos/test-bzpopmin-fix.sh +0 -274
- package/claude-assets/skills/cfn-redis-coordination/demos/test-cancel-swarm.sh +0 -0
- package/claude-assets/skills/cfn-redis-coordination/docs/migration/PHASE_3_REDIS_COORDINATION_COMPLETION_REPORT.md +0 -553
- package/claude-assets/skills/cfn-redis-coordination/jest.config.js +0 -23
- package/claude-assets/skills/cfn-redis-coordination/package-lock.json +0 -5272
- package/claude-assets/skills/cfn-redis-coordination/package.json +0 -45
- package/claude-assets/skills/cfn-redis-coordination/src/agent-logger.ts +0 -446
- package/claude-assets/skills/cfn-redis-coordination/src/agent-recovery.ts +0 -454
- package/claude-assets/skills/cfn-redis-coordination/src/completion-reporter.ts +0 -396
- package/claude-assets/skills/cfn-redis-coordination/src/context-manager.ts +0 -327
- package/claude-assets/skills/cfn-redis-coordination/src/index.ts +0 -82
- package/claude-assets/skills/cfn-redis-coordination/src/mode-detector.ts +0 -155
- package/claude-assets/skills/cfn-redis-coordination/src/redis/redis-client.ts +0 -305
- package/claude-assets/skills/cfn-redis-coordination/src/redis/redis-functions.ts +0 -283
- package/claude-assets/skills/cfn-redis-coordination/src/redis-client.ts +0 -654
- package/claude-assets/skills/cfn-redis-coordination/src/result-collector.ts +0 -437
- package/claude-assets/skills/cfn-redis-coordination/src/swarm-manager.ts +0 -494
- package/claude-assets/skills/cfn-redis-coordination/src/task-analyzer.ts +0 -404
- package/claude-assets/skills/cfn-redis-coordination/src/task-executor.ts +0 -423
- package/claude-assets/skills/cfn-redis-coordination/src/types.ts +0 -235
- package/claude-assets/skills/cfn-redis-coordination/src/waiting-coordinator.ts +0 -587
- package/claude-assets/skills/cfn-redis-coordination/store-success-criteria.sh +0 -85
- package/claude-assets/skills/cfn-redis-coordination/test-connection-attempts.js +0 -70
- package/claude-assets/skills/cfn-redis-coordination/test-mode-simple.js +0 -121
- package/claude-assets/skills/cfn-redis-coordination/test-redis-check.js +0 -84
- package/claude-assets/skills/cfn-redis-coordination/test-task-mode-redis.cjs +0 -391
- package/claude-assets/skills/cfn-redis-coordination/tests/coordination.test.ts +0 -788
- package/claude-assets/skills/cfn-redis-coordination/update-all-scripts.sh +0 -67
- package/claude-assets/skills/cfn-redis-data-extraction/SKILL.md +0 -442
- package/claude-assets/skills/cfn-redis-data-extraction/extract.sh +0 -306
- package/dist/coordination/index.js +0 -25
- package/dist/coordination/index.js.map +0 -1
- package/docs/BUG_19_MEMORY_LEAK_TASK_MODE.md +0 -405
- package/docs/MEMORY_CLEANUP_GUIDE.md +0 -358
- package/docs/MEMORY_LEAK_FIX_SUMMARY.md +0 -322
- package/docs/REDIS_CLEANUP_EXECUTIVE_SUMMARY.md +0 -319
- package/docs/REDIS_CLEANUP_VERIFICATION_REPORT.md +0 -574
- package/tests/test-memory-leak-task-mode.sh +0 -435
- /package/.claude/skills/cfn-loop-orchestration/{inject-loop-context.sh → archive/legacy-bash/inject-loop-context.sh} +0 -0
- /package/.claude/skills/cfn-loop-orchestration/{monitor-execution.sh → archive/legacy-bash/monitor-execution.sh} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{agent-log.sh → agent-log.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{agent-recovery.sh → agent-recovery.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{analyze-task-complexity.sh → analyze-task-complexity.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/bash-wrappers/{store-context.sh → store-context.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{cancel-swarm.sh → cancel-swarm.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{cfn-loop-exec.sh → cfn-loop-exec.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{cfn-loop-relaunch.sh → cfn-loop-relaunch.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{collect-confidence-scores.sh → collect-confidence-scores.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{collect-results.sh → collect-results.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{complete-swarm.sh → complete-swarm.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{get-context.sh → get-context.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{get-success-criteria.sh → get-success-criteria.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{invoke-waiting-mode.sh → invoke-waiting-mode.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{redis-cli-wrapper.sh → redis-cli-wrapper.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{redis-functions.sh → redis-functions.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{report-completion.sh → report-completion.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{store-context.sh → store-context.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-loop-orchestration/{inject-loop-context.sh → archive/legacy-bash/inject-loop-context.sh} +0 -0
- /package/claude-assets/skills/cfn-loop-orchestration/{monitor-execution.sh → archive/legacy-bash/monitor-execution.sh} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{agent-log.sh → agent-log.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{agent-recovery.sh → agent-recovery.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{analyze-task-complexity.sh → analyze-task-complexity.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/bash-wrappers/{store-context.sh → store-context.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{cancel-swarm.sh → cancel-swarm.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{cfn-loop-exec.sh → cfn-loop-exec.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{cfn-loop-relaunch.sh → cfn-loop-relaunch.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{collect-confidence-scores.sh → collect-confidence-scores.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{collect-results.sh → collect-results.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{complete-swarm.sh → complete-swarm.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{get-context.sh → get-context.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{get-success-criteria.sh → get-success-criteria.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{invoke-waiting-mode.sh → invoke-waiting-mode.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{redis-cli-wrapper.sh → redis-cli-wrapper.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{redis-functions.sh → redis-functions.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{report-completion.sh → report-completion.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{store-context.sh → store-context.sh.backup} +0 -0
|
@@ -1,367 +1,101 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import * as fs from "fs/promises";
|
|
2
|
+
import * as path from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
import Ajv from "ajv";
|
|
5
|
+
import * as lodash from "lodash";
|
|
6
|
+
// ESM-compatible __dirname
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = path.dirname(__filename);
|
|
9
|
+
let ConfigManager = class ConfigManager {
|
|
10
|
+
static _instance = null;
|
|
11
|
+
configPath;
|
|
12
|
+
schemaPath;
|
|
13
|
+
ajv;
|
|
14
|
+
constructor(){
|
|
15
|
+
this.configPath = path.join(process.env.HOME || "", ".claude-flow-config.json");
|
|
16
|
+
this.schemaPath = path.join(__dirname, "../../.claude/skills/config-management/config.json");
|
|
17
|
+
this.ajv = new Ajv();
|
|
7
18
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
step(generator.next(value));
|
|
12
|
-
} catch (e) {
|
|
13
|
-
reject(e);
|
|
14
|
-
}
|
|
19
|
+
static getInstance() {
|
|
20
|
+
if (!ConfigManager._instance) {
|
|
21
|
+
ConfigManager._instance = new ConfigManager();
|
|
15
22
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
return ConfigManager._instance;
|
|
24
|
+
}
|
|
25
|
+
async readConfig() {
|
|
26
|
+
try {
|
|
27
|
+
const configContent = await fs.readFile(this.configPath, "utf-8");
|
|
28
|
+
return JSON.parse(configContent);
|
|
29
|
+
} catch (error) {
|
|
30
|
+
// If config doesn't exist, create from schema
|
|
31
|
+
return this.resetToDefaults();
|
|
22
32
|
}
|
|
23
|
-
|
|
24
|
-
|
|
33
|
+
}
|
|
34
|
+
async writeConfig(config) {
|
|
35
|
+
const schemaContent = await fs.readFile(this.schemaPath, "utf-8");
|
|
36
|
+
const schema = JSON.parse(schemaContent);
|
|
37
|
+
const validate = this.ajv.compile(schema);
|
|
38
|
+
if (!validate(config)) {
|
|
39
|
+
throw new Error("Invalid configuration: " + this.ajv.errorsText(validate.errors));
|
|
25
40
|
}
|
|
26
|
-
|
|
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
|
-
]);
|
|
48
|
-
};
|
|
41
|
+
await fs.writeFile(this.configPath, JSON.stringify(config, null, 2), "utf-8");
|
|
49
42
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if
|
|
55
|
-
|
|
56
|
-
|
|
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;
|
|
43
|
+
async getValue(keyPath) {
|
|
44
|
+
const config = await this.readConfig();
|
|
45
|
+
const value = lodash.get(config, keyPath);
|
|
46
|
+
if (value === undefined) {
|
|
47
|
+
// Check if it's a custom key path not in the schema
|
|
48
|
+
const customConfig = await this.readCustomConfig();
|
|
49
|
+
return lodash.get(customConfig, keyPath);
|
|
112
50
|
}
|
|
113
|
-
|
|
114
|
-
return {
|
|
115
|
-
value: op[0] ? op[1] : void 0,
|
|
116
|
-
done: true
|
|
117
|
-
};
|
|
51
|
+
return value;
|
|
118
52
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
function ConfigManager() {
|
|
129
|
-
this.configPath = path.join(process.env.HOME || "", ".claude-flow-config.json");
|
|
130
|
-
this.schemaPath = path.join(__dirname, "../../.claude/skills/config-management/config.json");
|
|
131
|
-
this.ajv = new ajv_1.default();
|
|
53
|
+
async readCustomConfig() {
|
|
54
|
+
try {
|
|
55
|
+
const customConfigPath = path.join(process.env.HOME || "", ".claude-flow-custom-config.json");
|
|
56
|
+
const customConfigContent = await fs.readFile(customConfigPath, "utf-8");
|
|
57
|
+
return JSON.parse(customConfigContent);
|
|
58
|
+
} catch (error) {
|
|
59
|
+
// If custom config doesn't exist or can't be read, return empty object
|
|
60
|
+
return {};
|
|
61
|
+
}
|
|
132
62
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
63
|
+
async set(key, value) {
|
|
64
|
+
const config = await this.readConfig();
|
|
65
|
+
// Type assertion to handle full object
|
|
66
|
+
if (typeof value === "object" && value !== null) {
|
|
67
|
+
config[key] = value;
|
|
68
|
+
} else {
|
|
69
|
+
throw new Error("Invalid configuration value");
|
|
136
70
|
}
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
return
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
this.resetToDefaults()
|
|
167
|
-
];
|
|
168
|
-
case 3:
|
|
169
|
-
return [
|
|
170
|
-
2 /*return*/
|
|
171
|
-
];
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
});
|
|
175
|
-
};
|
|
176
|
-
ConfigManager.prototype.writeConfig = function(config) {
|
|
177
|
-
return __awaiter(this, void 0, void 0, function() {
|
|
178
|
-
var schemaContent, schema, validate;
|
|
179
|
-
return __generator(this, function(_a) {
|
|
180
|
-
switch(_a.label){
|
|
181
|
-
case 0:
|
|
182
|
-
return [
|
|
183
|
-
4 /*yield*/ ,
|
|
184
|
-
fs.readFile(this.schemaPath, "utf-8")
|
|
185
|
-
];
|
|
186
|
-
case 1:
|
|
187
|
-
schemaContent = _a.sent();
|
|
188
|
-
schema = JSON.parse(schemaContent);
|
|
189
|
-
validate = this.ajv.compile(schema);
|
|
190
|
-
if (!validate(config)) {
|
|
191
|
-
throw new Error("Invalid configuration: " + this.ajv.errorsText(validate.errors));
|
|
192
|
-
}
|
|
193
|
-
return [
|
|
194
|
-
4 /*yield*/ ,
|
|
195
|
-
fs.writeFile(this.configPath, JSON.stringify(config, null, 2), "utf-8")
|
|
196
|
-
];
|
|
197
|
-
case 2:
|
|
198
|
-
_a.sent();
|
|
199
|
-
return [
|
|
200
|
-
2 /*return*/
|
|
201
|
-
];
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
});
|
|
205
|
-
};
|
|
206
|
-
ConfigManager.prototype.getValue = function(keyPath) {
|
|
207
|
-
return __awaiter(this, void 0, void 0, function() {
|
|
208
|
-
var config, value, customConfig;
|
|
209
|
-
return __generator(this, function(_a) {
|
|
210
|
-
switch(_a.label){
|
|
211
|
-
case 0:
|
|
212
|
-
return [
|
|
213
|
-
4 /*yield*/ ,
|
|
214
|
-
this.readConfig()
|
|
215
|
-
];
|
|
216
|
-
case 1:
|
|
217
|
-
config = _a.sent();
|
|
218
|
-
value = (0, get_1.default)(config, keyPath);
|
|
219
|
-
if (!(value === undefined)) return [
|
|
220
|
-
3 /*break*/ ,
|
|
221
|
-
3
|
|
222
|
-
];
|
|
223
|
-
return [
|
|
224
|
-
4 /*yield*/ ,
|
|
225
|
-
this.readCustomConfig()
|
|
226
|
-
];
|
|
227
|
-
case 2:
|
|
228
|
-
customConfig = _a.sent();
|
|
229
|
-
return [
|
|
230
|
-
2 /*return*/ ,
|
|
231
|
-
(0, get_1.default)(customConfig, keyPath)
|
|
232
|
-
];
|
|
233
|
-
case 3:
|
|
234
|
-
return [
|
|
235
|
-
2 /*return*/ ,
|
|
236
|
-
value
|
|
237
|
-
];
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
});
|
|
241
|
-
};
|
|
242
|
-
ConfigManager.prototype.readCustomConfig = function() {
|
|
243
|
-
return __awaiter(this, void 0, void 0, function() {
|
|
244
|
-
var customConfigPath, customConfigContent, error_2;
|
|
245
|
-
return __generator(this, function(_a) {
|
|
246
|
-
switch(_a.label){
|
|
247
|
-
case 0:
|
|
248
|
-
_a.trys.push([
|
|
249
|
-
0,
|
|
250
|
-
2,
|
|
251
|
-
,
|
|
252
|
-
3
|
|
253
|
-
]);
|
|
254
|
-
customConfigPath = path.join(process.env.HOME || "", ".claude-flow-custom-config.json");
|
|
255
|
-
return [
|
|
256
|
-
4 /*yield*/ ,
|
|
257
|
-
fs.readFile(customConfigPath, "utf-8")
|
|
258
|
-
];
|
|
259
|
-
case 1:
|
|
260
|
-
customConfigContent = _a.sent();
|
|
261
|
-
return [
|
|
262
|
-
2 /*return*/ ,
|
|
263
|
-
JSON.parse(customConfigContent)
|
|
264
|
-
];
|
|
265
|
-
case 2:
|
|
266
|
-
error_2 = _a.sent();
|
|
267
|
-
// If custom config doesn't exist or can't be read, return empty object
|
|
268
|
-
return [
|
|
269
|
-
2 /*return*/ ,
|
|
270
|
-
{}
|
|
271
|
-
];
|
|
272
|
-
case 3:
|
|
273
|
-
return [
|
|
274
|
-
2 /*return*/
|
|
275
|
-
];
|
|
276
|
-
}
|
|
277
|
-
});
|
|
278
|
-
});
|
|
279
|
-
};
|
|
280
|
-
ConfigManager.prototype.set = function(key, value) {
|
|
281
|
-
return __awaiter(this, void 0, void 0, function() {
|
|
282
|
-
var config;
|
|
283
|
-
return __generator(this, function(_a) {
|
|
284
|
-
switch(_a.label){
|
|
285
|
-
case 0:
|
|
286
|
-
return [
|
|
287
|
-
4 /*yield*/ ,
|
|
288
|
-
this.readConfig()
|
|
289
|
-
];
|
|
290
|
-
case 1:
|
|
291
|
-
config = _a.sent();
|
|
292
|
-
// Type assertion to handle both full object and nested key
|
|
293
|
-
if (typeof value === "object" && value !== null) {
|
|
294
|
-
config[key] = value;
|
|
295
|
-
} else {
|
|
296
|
-
throw new Error("Invalid configuration value");
|
|
297
|
-
}
|
|
298
|
-
return [
|
|
299
|
-
4 /*yield*/ ,
|
|
300
|
-
this.writeConfig(config)
|
|
301
|
-
];
|
|
302
|
-
case 2:
|
|
303
|
-
_a.sent();
|
|
304
|
-
return [
|
|
305
|
-
2 /*return*/
|
|
306
|
-
];
|
|
307
|
-
}
|
|
308
|
-
});
|
|
309
|
-
});
|
|
310
|
-
};
|
|
311
|
-
ConfigManager.prototype.getAll = function() {
|
|
312
|
-
return __awaiter(this, void 0, void 0, function() {
|
|
313
|
-
return __generator(this, function(_a) {
|
|
314
|
-
return [
|
|
315
|
-
2 /*return*/ ,
|
|
316
|
-
this.readConfig()
|
|
317
|
-
];
|
|
318
|
-
});
|
|
319
|
-
});
|
|
320
|
-
};
|
|
321
|
-
ConfigManager.prototype.resetToDefaults = function() {
|
|
322
|
-
return __awaiter(this, void 0, void 0, function() {
|
|
323
|
-
var schemaContent, schema, defaultConfig;
|
|
324
|
-
return __generator(this, function(_a) {
|
|
325
|
-
switch(_a.label){
|
|
326
|
-
case 0:
|
|
327
|
-
return [
|
|
328
|
-
4 /*yield*/ ,
|
|
329
|
-
fs.readFile(this.schemaPath, "utf-8")
|
|
330
|
-
];
|
|
331
|
-
case 1:
|
|
332
|
-
schemaContent = _a.sent();
|
|
333
|
-
schema = JSON.parse(schemaContent);
|
|
334
|
-
defaultConfig = {
|
|
335
|
-
redis: {
|
|
336
|
-
host: schema.properties.redis.properties.host.default,
|
|
337
|
-
port: schema.properties.redis.properties.port.default
|
|
338
|
-
},
|
|
339
|
-
agent: {
|
|
340
|
-
default_strategy: schema.properties.agent.properties.default_strategy.default,
|
|
341
|
-
max_concurrent_agents: schema.properties.agent.properties.max_concurrent_agents.default,
|
|
342
|
-
log_level: schema.properties.agent.properties.log_level.default
|
|
343
|
-
},
|
|
344
|
-
security: {
|
|
345
|
-
enabled: schema.properties.security.properties.enabled.default,
|
|
346
|
-
max_retry_attempts: schema.properties.security.properties.max_retry_attempts.default
|
|
347
|
-
}
|
|
348
|
-
};
|
|
349
|
-
return [
|
|
350
|
-
4 /*yield*/ ,
|
|
351
|
-
this.writeConfig(defaultConfig)
|
|
352
|
-
];
|
|
353
|
-
case 2:
|
|
354
|
-
_a.sent();
|
|
355
|
-
return [
|
|
356
|
-
2 /*return*/ ,
|
|
357
|
-
defaultConfig
|
|
358
|
-
];
|
|
359
|
-
}
|
|
360
|
-
});
|
|
361
|
-
});
|
|
362
|
-
};
|
|
363
|
-
return ConfigManager;
|
|
364
|
-
}();
|
|
365
|
-
exports.default = ConfigManager;
|
|
71
|
+
await this.writeConfig(config);
|
|
72
|
+
}
|
|
73
|
+
async getAll() {
|
|
74
|
+
return this.readConfig();
|
|
75
|
+
}
|
|
76
|
+
async resetToDefaults() {
|
|
77
|
+
const schemaContent = await fs.readFile(this.schemaPath, "utf-8");
|
|
78
|
+
const schema = JSON.parse(schemaContent);
|
|
79
|
+
// Extract default values from the schema
|
|
80
|
+
const defaultConfig = {
|
|
81
|
+
redis: {
|
|
82
|
+
host: schema.properties.redis.properties.host.default,
|
|
83
|
+
port: schema.properties.redis.properties.port.default
|
|
84
|
+
},
|
|
85
|
+
agent: {
|
|
86
|
+
default_strategy: schema.properties.agent.properties.default_strategy.default,
|
|
87
|
+
max_concurrent_agents: schema.properties.agent.properties.max_concurrent_agents.default,
|
|
88
|
+
log_level: schema.properties.agent.properties.log_level.default
|
|
89
|
+
},
|
|
90
|
+
security: {
|
|
91
|
+
enabled: schema.properties.security.properties.enabled.default,
|
|
92
|
+
max_retry_attempts: schema.properties.security.properties.max_retry_attempts.default
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
await this.writeConfig(defaultConfig);
|
|
96
|
+
return defaultConfig;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
export default ConfigManager;
|
|
366
100
|
|
|
367
101
|
//# sourceMappingURL=config-manager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/config-manager.js"],"sourcesContent":["\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n 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;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar fs = require(\"fs/promises\");\nvar path = require(\"path\");\nvar ajv_1 = require(\"ajv\");\nvar get_1 = require(\"lodash/get\");\nvar ConfigManager = /** @class */ (function () {\n function ConfigManager() {\n this.configPath = path.join(process.env.HOME || \"\", \".claude-flow-config.json\");\n this.schemaPath = path.join(__dirname, \"../../.claude/skills/config-management/config.json\");\n this.ajv = new ajv_1.default();\n }\n ConfigManager.getInstance = function () {\n if (!ConfigManager.instance) {\n ConfigManager.instance = new ConfigManager();\n }\n return ConfigManager.instance;\n };\n ConfigManager.prototype.readConfig = function () {\n return __awaiter(this, void 0, void 0, function () {\n var configContent, error_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2, , 3]);\n return [4 /*yield*/, fs.readFile(this.configPath, \"utf-8\")];\n case 1:\n configContent = _a.sent();\n return [2 /*return*/, JSON.parse(configContent)];\n case 2:\n error_1 = _a.sent();\n // If config doesn't exist, create from schema\n return [2 /*return*/, this.resetToDefaults()];\n case 3: return [2 /*return*/];\n }\n });\n });\n };\n ConfigManager.prototype.writeConfig = function (config) {\n return __awaiter(this, void 0, void 0, function () {\n var schemaContent, schema, validate;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, fs.readFile(this.schemaPath, \"utf-8\")];\n case 1:\n schemaContent = _a.sent();\n schema = JSON.parse(schemaContent);\n validate = this.ajv.compile(schema);\n if (!validate(config)) {\n throw new Error(\"Invalid configuration: \" + this.ajv.errorsText(validate.errors));\n }\n return [4 /*yield*/, fs.writeFile(this.configPath, JSON.stringify(config, null, 2), \"utf-8\")];\n case 2:\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n };\n ConfigManager.prototype.getValue = function (keyPath) {\n return __awaiter(this, void 0, void 0, function () {\n var config, value, customConfig;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.readConfig()];\n case 1:\n config = _a.sent();\n value = (0, get_1.default)(config, keyPath);\n if (!(value === undefined)) return [3 /*break*/, 3];\n return [4 /*yield*/, this.readCustomConfig()];\n case 2:\n customConfig = _a.sent();\n return [2 /*return*/, (0, get_1.default)(customConfig, keyPath)];\n case 3: return [2 /*return*/, value];\n }\n });\n });\n };\n ConfigManager.prototype.readCustomConfig = function () {\n return __awaiter(this, void 0, void 0, function () {\n var customConfigPath, customConfigContent, error_2;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2, , 3]);\n customConfigPath = path.join(process.env.HOME || \"\", \".claude-flow-custom-config.json\");\n return [4 /*yield*/, fs.readFile(customConfigPath, \"utf-8\")];\n case 1:\n customConfigContent = _a.sent();\n return [2 /*return*/, JSON.parse(customConfigContent)];\n case 2:\n error_2 = _a.sent();\n // If custom config doesn't exist or can't be read, return empty object\n return [2 /*return*/, {}];\n case 3: return [2 /*return*/];\n }\n });\n });\n };\n ConfigManager.prototype.set = function (key, value) {\n return __awaiter(this, void 0, void 0, function () {\n var config;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.readConfig()];\n case 1:\n config = _a.sent();\n // Type assertion to handle both full object and nested key\n if (typeof value === \"object\" && value !== null) {\n config[key] = value;\n }\n else {\n throw new Error(\"Invalid configuration value\");\n }\n return [4 /*yield*/, this.writeConfig(config)];\n case 2:\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n };\n ConfigManager.prototype.getAll = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, this.readConfig()];\n });\n });\n };\n ConfigManager.prototype.resetToDefaults = function () {\n return __awaiter(this, void 0, void 0, function () {\n var schemaContent, schema, defaultConfig;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, fs.readFile(this.schemaPath, \"utf-8\")];\n case 1:\n schemaContent = _a.sent();\n schema = JSON.parse(schemaContent);\n defaultConfig = {\n redis: {\n host: schema.properties.redis.properties.host.default,\n port: schema.properties.redis.properties.port.default,\n },\n agent: {\n default_strategy: schema.properties.agent.properties.default_strategy.default,\n max_concurrent_agents: schema.properties.agent.properties.max_concurrent_agents.default,\n log_level: schema.properties.agent.properties.log_level.default,\n },\n security: {\n enabled: schema.properties.security.properties.enabled.default,\n max_retry_attempts: schema.properties.security.properties.max_retry_attempts.default,\n },\n };\n return [4 /*yield*/, this.writeConfig(defaultConfig)];\n case 2:\n _a.sent();\n return [2 /*return*/, defaultConfig];\n }\n });\n });\n };\n return ConfigManager;\n}());\nexports.default = ConfigManager;\n"],"names":["__awaiter","thisArg","_arguments","P","generator","adopt","value","resolve","Promise","reject","fulfilled","step","next","e","rejected","result","done","then","apply","__generator","body","_","label","sent","t","trys","ops","f","y","g","Object","create","Iterator","prototype","verb","Symbol","iterator","n","v","op","TypeError","call","pop","length","push","defineProperty","exports","fs","require","path","ajv_1","get_1","ConfigManager","configPath","join","process","env","HOME","schemaPath","__dirname","ajv","default","getInstance","instance","readConfig","configContent","error_1","_a","readFile","JSON","parse","resetToDefaults","writeConfig","config","schemaContent","schema","validate","compile","Error","errorsText","errors","writeFile","stringify","getValue","keyPath","customConfig","undefined","readCustomConfig","customConfigPath","customConfigContent","error_2","set","key","getAll","defaultConfig","redis","host","properties","port","agent","default_strategy","max_concurrent_agents","log_level","security","enabled","max_retry_attempts"],"mappings":"AAAA;AACA,IAAIA,YAAY,AAAC,IAAI,IAAI,IAAI,CAACA,SAAS,IAAK,SAAUC,OAAO,EAAEC,UAAU,EAAEC,CAAC,EAAEC,SAAS;IACnF,SAASC,MAAMC,KAAK;QAAI,OAAOA,iBAAiBH,IAAIG,QAAQ,IAAIH,EAAE,SAAUI,OAAO;YAAIA,QAAQD;QAAQ;IAAI;IAC3G,OAAO,IAAKH,CAAAA,KAAMA,CAAAA,IAAIK,OAAM,CAAC,EAAG,SAAUD,OAAO,EAAEE,MAAM;QACrD,SAASC,UAAUJ,KAAK;YAAI,IAAI;gBAAEK,KAAKP,UAAUQ,IAAI,CAACN;YAAS,EAAE,OAAOO,GAAG;gBAAEJ,OAAOI;YAAI;QAAE;QAC1F,SAASC,SAASR,KAAK;YAAI,IAAI;gBAAEK,KAAKP,SAAS,CAAC,QAAQ,CAACE;YAAS,EAAE,OAAOO,GAAG;gBAAEJ,OAAOI;YAAI;QAAE;QAC7F,SAASF,KAAKI,MAAM;YAAIA,OAAOC,IAAI,GAAGT,QAAQQ,OAAOT,KAAK,IAAID,MAAMU,OAAOT,KAAK,EAAEW,IAAI,CAACP,W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AAOsB,UAAU,CAACM,QAAQ,CAACN,UAAU,CAACO,OAAO,CAAC3C,OAAO;gCAC9D4C,oBAAoB9B,OAAOsB,UAAU,CAACM,QAAQ,CAACN,UAAU,CAACQ,kBAAkB,CAAC5C,OAAO;4BACxF;wBACJ;wBACA,OAAO;4BAAC,EAAE,OAAO;4BAAI,IAAI,CAACW,WAAW,CAACsB;yBAAe;oBACzD,KAAK;wBACD3B,GAAG5C,IAAI;wBACP,OAAO;4BAAC,EAAE,QAAQ;4BAAIuE;yBAAc;gBAC5C;YACJ;QACJ;IACJ;IACA,OAAO1C;AACX;AACAN,QAAQe,OAAO,GAAGT"}
|
|
1
|
+
{"version":3,"sources":["../../src/cli/config-manager.ts"],"sourcesContent":["import * as fs from \"fs/promises\";\nimport * as path from \"path\";\nimport { fileURLToPath } from \"url\";\nimport Ajv from \"ajv\";\nimport * as lodash from \"lodash\";\n\n// ESM-compatible __dirname\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\ninterface ConfigSchema {\n redis: {\n host: string;\n port: number;\n password?: string;\n };\n agent: {\n default_strategy: string;\n max_concurrent_agents: number;\n log_level: \"debug\" | \"info\" | \"warn\" | \"error\";\n };\n security: {\n enabled: boolean;\n max_retry_attempts: number;\n };\n}\n\nclass ConfigManager {\n private static _instance: ConfigManager | null = null;\n private configPath: string;\n private schemaPath: string;\n private ajv: Ajv;\n\n private constructor() {\n this.configPath = path.join(\n process.env.HOME || \"\",\n \".claude-flow-config.json\",\n );\n this.schemaPath = path.join(\n __dirname,\n \"../../.claude/skills/config-management/config.json\",\n );\n this.ajv = new Ajv();\n }\n\n public static getInstance(): ConfigManager {\n if (!ConfigManager._instance) {\n ConfigManager._instance = new ConfigManager();\n }\n return ConfigManager._instance;\n }\n\n private async readConfig(): Promise<ConfigSchema> {\n try {\n const configContent = await fs.readFile(this.configPath, \"utf-8\");\n return JSON.parse(configContent) as ConfigSchema;\n } catch (error) {\n // If config doesn't exist, create from schema\n return this.resetToDefaults();\n }\n }\n\n private async writeConfig(config: ConfigSchema): Promise<void> {\n const schemaContent = await fs.readFile(this.schemaPath, \"utf-8\");\n const schema = JSON.parse(schemaContent);\n\n const validate = this.ajv.compile(schema);\n if (!validate(config)) {\n throw new Error(\n \"Invalid configuration: \" + this.ajv.errorsText(validate.errors),\n );\n }\n\n await fs.writeFile(\n this.configPath,\n JSON.stringify(config, null, 2),\n \"utf-8\",\n );\n }\n\n public async getValue(keyPath: string): Promise<any> {\n const config = await this.readConfig();\n const value = lodash.get(config, keyPath);\n\n if (value === undefined) {\n // Check if it's a custom key path not in the schema\n const customConfig = await this.readCustomConfig();\n return lodash.get(customConfig, keyPath);\n }\n\n return value;\n }\n\n private async readCustomConfig(): Promise<Record<string, any>> {\n try {\n const customConfigPath = path.join(\n process.env.HOME || \"\",\n \".claude-flow-custom-config.json\",\n );\n const customConfigContent = await fs.readFile(customConfigPath, \"utf-8\");\n return JSON.parse(customConfigContent);\n } catch (error) {\n // If custom config doesn't exist or can't be read, return empty object\n return {};\n }\n }\n\n public async set(key: keyof ConfigSchema, value: ConfigSchema[keyof ConfigSchema]): Promise<void> {\n const config = await this.readConfig();\n\n // Type assertion to handle full object\n if (typeof value === \"object\" && value !== null) {\n config[key] = value;\n } else {\n throw new Error(\"Invalid configuration value\");\n }\n\n await this.writeConfig(config);\n }\n\n public async getAll(): Promise<ConfigSchema> {\n return this.readConfig();\n }\n\n public async resetToDefaults(): Promise<ConfigSchema> {\n const schemaContent = await fs.readFile(this.schemaPath, \"utf-8\");\n const schema = JSON.parse(schemaContent);\n\n // Extract default values from the schema\n const defaultConfig: ConfigSchema = {\n redis: {\n host: schema.properties.redis.properties.host.default,\n port: schema.properties.redis.properties.port.default,\n },\n agent: {\n default_strategy:\n schema.properties.agent.properties.default_strategy.default,\n max_concurrent_agents:\n schema.properties.agent.properties.max_concurrent_agents.default,\n log_level: schema.properties.agent.properties.log_level.default,\n },\n security: {\n enabled: schema.properties.security.properties.enabled.default,\n max_retry_attempts:\n schema.properties.security.properties.max_retry_attempts.default,\n },\n };\n\n await this.writeConfig(defaultConfig);\n return defaultConfig;\n }\n}\n\nexport default ConfigManager;"],"names":["fs","path","fileURLToPath","Ajv","lodash","__filename","url","__dirname","dirname","ConfigManager","_instance","configPath","schemaPath","ajv","join","process","env","HOME","getInstance","readConfig","configContent","readFile","JSON","parse","error","resetToDefaults","writeConfig","config","schemaContent","schema","validate","compile","Error","errorsText","errors","writeFile","stringify","getValue","keyPath","value","get","undefined","customConfig","readCustomConfig","customConfigPath","customConfigContent","set","key","getAll","defaultConfig","redis","host","properties","default","port","agent","default_strategy","max_concurrent_agents","log_level","security","enabled","max_retry_attempts"],"mappings":"AAAA,YAAYA,QAAQ,cAAc;AAClC,YAAYC,UAAU,OAAO;AAC7B,SAASC,aAAa,QAAQ,MAAM;AACpC,OAAOC,SAAS,MAAM;AACtB,YAAYC,YAAY,SAAS;AAEjC,2BAA2B;AAC3B,MAAMC,aAAaH,cAAc,YAAYI,GAAG;AAChD,MAAMC,YAAYN,KAAKO,OAAO,CAACH;AAmB/B,IAAA,AAAMI,gBAAN,MAAMA;IACJ,OAAeC,YAAkC,KAAK;IAC9CC,WAAmB;IACnBC,WAAmB;IACnBC,IAAS;IAEjB,aAAsB;QACpB,IAAI,CAACF,UAAU,GAAGV,KAAKa,IAAI,CACzBC,QAAQC,GAAG,CAACC,IAAI,IAAI,IACpB;QAEF,IAAI,CAACL,UAAU,GAAGX,KAAKa,IAAI,CACzBP,WACA;QAEF,IAAI,CAACM,GAAG,GAAG,IAAIV;IACjB;IAEA,OAAce,cAA6B;QACzC,IAAI,CAACT,cAAcC,SAAS,EAAE;YAC5BD,cAAcC,SAAS,GAAG,IAAID;QAChC;QACA,OAAOA,cAAcC,SAAS;IAChC;IAEA,MAAcS,aAAoC;QAChD,IAAI;YACF,MAAMC,gBAAgB,MAAMpB,GAAGqB,QAAQ,CAAC,IAAI,CAACV,UAAU,EAAE;YACzD,OAAOW,KAAKC,KAAK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AU,MAAM;YAC/CZ,MAAM,CAACoB,IAAI,GAAGR;QAChB,OAAO;YACL,MAAM,IAAIP,MAAM;QAClB;QAEA,MAAM,IAAI,CAACN,WAAW,CAACC;IACzB;IAEA,MAAaqB,SAAgC;QAC3C,OAAO,IAAI,CAAC7B,UAAU;IACxB;IAEA,MAAaM,kBAAyC;QACpD,MAAMG,gBAAgB,MAAM5B,GAAGqB,QAAQ,CAAC,IAAI,CAACT,UAAU,EAAE;QACzD,MAAMiB,SAASP,KAAKC,KAAK,CAACK;QAE1B,yCAAyC;QACzC,MAAMqB,gBAA8B;YAClCC,OAAO;gBACLC,MAAMtB,OAAOuB,UAAU,CAACF,KAAK,CAACE,UAAU,CAACD,IAAI,CAACE,OAAO;gBACrDC,MAAMzB,OAAOuB,UAAU,CAACF,KAAK,CAACE,UAAU,CAACE,IAAI,CAACD,OAAO;YACvD;YACAE,OAAO;gBACLC,kBACE3B,OAAOuB,UAAU,CAACG,KAAK,CAACH,UAAU,CAACI,gBAAgB,CAACH,OAAO;gBAC7DI,uBACE5B,OAAOuB,UAAU,CAACG,KAAK,CAACH,UAAU,CAACK,qBAAqB,CAACJ,OAAO;gBAClEK,WAAW7B,OAAOuB,UAAU,CAACG,KAAK,CAACH,UAAU,CAACM,SAAS,CAACL,OAAO;YACjE;YACAM,UAAU;gBACRC,SAAS/B,OAAOuB,UAAU,CAACO,QAAQ,CAACP,UAAU,CAACQ,OAAO,CAACP,OAAO;gBAC9DQ,oBACEhC,OAAOuB,UAAU,CAACO,QAAQ,CAACP,UAAU,CAACS,kBAAkB,CAACR,OAAO;YACpE;QACF;QAEA,MAAM,IAAI,CAAC3B,WAAW,CAACuB;QACvB,OAAOA;IACT;AACF;AAEA,eAAexC,cAAc"}
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* 3. Limiting message history size
|
|
8
8
|
* 4. Auto-cleanup of orphaned forks
|
|
9
9
|
*/ import { execSync } from 'child_process';
|
|
10
|
-
|
|
10
|
+
// FIX: Default to 'localhost' for CLI mode (host execution), not 'cfn-redis' (Docker)
|
|
11
|
+
const redisHost = process.env.CFN_REDIS_HOST || 'localhost';
|
|
11
12
|
const redisPort = process.env.CFN_REDIS_PORT || '6379';
|
|
12
13
|
const DEFAULT_OPTIONS = {
|
|
13
14
|
messageTTL: 86400,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/conversation-fork-cleanup.ts"],"sourcesContent":["/**\r\n * Conversation Fork Cleanup Utilities\r\n *\r\n * Provides memory leak prevention for Task Mode by:\r\n * 1. Setting TTL on message lists (24h default)\r\n * 2. Cleaning up completed task messages\r\n * 3. Limiting message history size\r\n * 4. Auto-cleanup of orphaned forks\r\n */\r\n\r\nimport { execSync } from 'child_process';\r\n\r\nconst redisHost = process.env.CFN_REDIS_HOST || 'cfn-redis';\r\nconst redisPort = process.env.CFN_REDIS_PORT || '6379';\r\n\r\nexport interface CleanupOptions {\r\n messageTTL?: number; // TTL for message lists (seconds, default: 86400 = 24h)\r\n maxMessagesPerAgent?: number; // Max messages to keep per agent (default: 100)\r\n autoCleanupForks?: boolean; // Auto-cleanup orphaned forks (default: true)\r\n}\r\n\r\nconst DEFAULT_OPTIONS: Required<CleanupOptions> = {\r\n messageTTL: 86400, // 24 hours\r\n maxMessagesPerAgent: 100, // 100 messages = ~50 iterations\r\n autoCleanupForks: true,\r\n};\r\n\r\n/**\r\n * Set TTL on message list to prevent indefinite accumulation\r\n */\r\nexport function setMessageListTTL(\r\n taskId: string,\r\n agentId: string,\r\n ttlSeconds: number = DEFAULT_OPTIONS.messageTTL\r\n): void {\r\n const key = `swarm:${taskId}:${agentId}:messages`;\r\n\r\n try {\r\n execSync(`redis-cli -h ${redisHost} -p ${redisPort} expire \"${key}\" ${ttlSeconds}`, {\r\n encoding: 'utf8'\r\n });\r\n console.log(`[conversation-cleanup] Set TTL ${ttlSeconds}s on ${key}`);\r\n } catch (error) {\r\n console.error(`[conversation-cleanup] Failed to set TTL:`, error);\r\n }\r\n}\r\n\r\n/**\r\n * Trim message list to max size (FIFO - keep recent messages)\r\n */\r\nexport function trimMessageList(\r\n taskId: string,\r\n agentId: string,\r\n maxMessages: number = DEFAULT_OPTIONS.maxMessagesPerAgent\r\n): void {\r\n const key = `swarm:${taskId}:${agentId}:messages`;\r\n\r\n try {\r\n // Keep only the last N messages (0 = oldest, -N = keep last N)\r\n const start = -maxMessages;\r\n execSync(`redis-cli -h ${redisHost} -p ${redisPort} ltrim \"${key}\" ${start} -1`, {\r\n encoding: 'utf8'\r\n });\r\n console.log(`[conversation-cleanup] Trimmed ${key} to ${maxMessages} messages`);\r\n } catch (error) {\r\n console.error(`[conversation-cleanup] Failed to trim messages:`, error);\r\n }\r\n}\r\n\r\n/**\r\n * Clean up all messages and forks for a completed task\r\n */\r\nexport function cleanupTaskMessages(taskId: string, agentId: string): void {\r\n try {\r\n // Delete main message list\r\n const messagesKey = `swarm:${taskId}:${agentId}:messages`;\r\n execSync(`redis-cli -h ${redisHost} -p ${redisPort} del \"${messagesKey}\"`, {\r\n encoding: 'utf8'\r\n });\r\n\r\n // Delete all fork message lists\r\n const forkPattern = `swarm:${taskId}:${agentId}:fork:*:messages`;\r\n const forkKeys = execSync(`redis-cli -h ${redisHost} -p ${redisPort} keys \"${forkPattern}\"`, {\r\n encoding: 'utf8'\r\n }).trim().split('\\n').filter(k => k);\r\n\r\n if (forkKeys.length > 0) {\r\n execSync(`redis-cli -h ${redisHost} -p ${redisPort} del ${forkKeys.join(' ')}`, {\r\n encoding: 'utf8'\r\n });\r\n }\r\n\r\n // Delete all fork metadata\r\n const forkMetaPattern = `swarm:${taskId}:${agentId}:fork:*:meta`;\r\n const metaKeys = execSync(`redis-cli -h ${redisHost} -p ${redisPort} keys \"${forkMetaPattern}\"`, {\r\n encoding: 'utf8'\r\n }).trim().split('\\n').filter(k => k);\r\n\r\n if (metaKeys.length > 0) {\r\n execSync(`redis-cli -h ${redisHost} -p ${redisPort} del ${metaKeys.join(' ')}`, {\r\n encoding: 'utf8'\r\n });\r\n }\r\n\r\n // Delete current fork pointer\r\n const currentForkKey = `swarm:${taskId}:${agentId}:current-fork`;\r\n execSync(`redis-cli -h ${redisHost} -p ${redisPort} del \"${currentForkKey}\"`, {\r\n encoding: 'utf8'\r\n });\r\n\r\n console.log(`[conversation-cleanup] Cleaned up task ${taskId} agent ${agentId}`);\r\n console.log(`[conversation-cleanup] Removed: 1 message list, ${forkKeys.length} fork snapshots, ${metaKeys.length} fork metadata`);\r\n } catch (error) {\r\n console.error(`[conversation-cleanup] Failed to cleanup task messages:`, error);\r\n }\r\n}\r\n\r\n/**\r\n * Clean up orphaned forks (metadata expired but messages remain)\r\n */\r\nexport function cleanupOrphanedForks(taskId: string, agentId: string): void {\r\n try {\r\n // Find all fork message keys\r\n const forkPattern = `swarm:${taskId}:${agentId}:fork:*:messages`;\r\n const forkMessageKeys = execSync(`redis-cli -h ${redisHost} -p ${redisPort} keys \"${forkPattern}\"`, {\r\n encoding: 'utf8'\r\n }).trim().split('\\n').filter(k => k);\r\n\r\n if (forkMessageKeys.length === 0) {\r\n return;\r\n }\r\n\r\n const orphanedKeys: string[] = [];\r\n\r\n for (const messageKey of forkMessageKeys) {\r\n // Extract fork ID from key: swarm:task:agent:fork:FORK_ID:messages\r\n const parts = messageKey.split(':');\r\n const forkId = parts[parts.length - 2];\r\n\r\n // Check if metadata exists\r\n const metaKey = `swarm:${taskId}:${agentId}:fork:${forkId}:meta`;\r\n const metaExists = execSync(`redis-cli -h ${redisHost} -p ${redisPort} exists \"${metaKey}\"`, {\r\n encoding: 'utf8'\r\n }).trim();\r\n\r\n if (metaExists === '0') {\r\n // Metadata expired but messages remain = orphaned\r\n orphanedKeys.push(messageKey);\r\n }\r\n }\r\n\r\n if (orphanedKeys.length > 0) {\r\n execSync(`redis-cli -h ${redisHost} -p ${redisPort} del ${orphanedKeys.join(' ')}`, {\r\n encoding: 'utf8'\r\n });\r\n console.log(`[conversation-cleanup] Removed ${orphanedKeys.length} orphaned fork snapshots`);\r\n }\r\n } catch (error) {\r\n console.error(`[conversation-cleanup] Failed to cleanup orphaned forks:`, error);\r\n }\r\n}\r\n\r\n/**\r\n * Get memory usage statistics for a task\r\n */\r\nexport function getTaskMemoryStats(taskId: string, agentId: string): {\r\n messageCount: number;\r\n forkCount: number;\r\n estimatedSizeKB: number;\r\n} {\r\n try {\r\n // Count messages in main list\r\n const messagesKey = `swarm:${taskId}:${agentId}:messages`;\r\n const messageCount = parseInt(execSync(`redis-cli -h ${redisHost} -p ${redisPort} llen \"${messagesKey}\"`, {\r\n encoding: 'utf8'\r\n }).trim(), 10);\r\n\r\n // Count forks\r\n const forkPattern = `swarm:${taskId}:${agentId}:fork:*:messages`;\r\n const forkKeys = execSync(`redis-cli -h ${redisHost} -p ${redisPort} keys \"${forkPattern}\"`, {\r\n encoding: 'utf8'\r\n }).trim().split('\\n').filter(k => k);\r\n\r\n // Estimate size (average message ~5KB)\r\n const estimatedSizeKB = messageCount * 5;\r\n\r\n return {\r\n messageCount,\r\n forkCount: forkKeys.length,\r\n estimatedSizeKB,\r\n };\r\n } catch (error) {\r\n console.error(`[conversation-cleanup] Failed to get memory stats:`, error);\r\n return {\r\n messageCount: 0,\r\n forkCount: 0,\r\n estimatedSizeKB: 0,\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * Configure automatic cleanup options for a task\r\n */\r\nexport function configureAutoCleanup(\r\n taskId: string,\r\n agentId: string,\r\n options: CleanupOptions = {}\r\n): void {\r\n const config = { ...DEFAULT_OPTIONS, ...options };\r\n\r\n // Set TTL on message list\r\n setMessageListTTL(taskId, agentId, config.messageTTL);\r\n\r\n // Trim to max size\r\n trimMessageList(taskId, agentId, config.maxMessagesPerAgent);\r\n\r\n // Cleanup orphaned forks\r\n if (config.autoCleanupForks) {\r\n cleanupOrphanedForks(taskId, agentId);\r\n }\r\n\r\n console.log(`[conversation-cleanup] Auto-cleanup configured for ${taskId}/${agentId}`);\r\n console.log(`[conversation-cleanup] - TTL: ${config.messageTTL}s`);\r\n console.log(`[conversation-cleanup] - Max messages: ${config.maxMessagesPerAgent}`);\r\n console.log(`[conversation-cleanup] - Auto-cleanup forks: ${config.autoCleanupForks}`);\r\n}\r\n\r\n/**\r\n * Emergency cleanup - remove all conversation data for all tasks\r\n * USE WITH CAUTION: This will delete ALL conversation history\r\n */\r\nexport function emergencyCleanupAll(): void {\r\n try {\r\n const patterns = [\r\n 'swarm:*:*:messages',\r\n 'swarm:*:*:fork:*:messages',\r\n 'swarm:*:*:fork:*:meta',\r\n 'swarm:*:*:current-fork',\r\n ];\r\n\r\n let totalDeleted = 0;\r\n\r\n for (const pattern of patterns) {\r\n const keys = execSync(`redis-cli -h ${redisHost} -p ${redisPort} keys \"${pattern}\"`, {\r\n encoding: 'utf8'\r\n }).trim().split('\\n').filter(k => k);\r\n\r\n if (keys.length > 0) {\r\n execSync(`redis-cli -h ${redisHost} -p ${redisPort} del ${keys.join(' ')}`, {\r\n encoding: 'utf8'\r\n });\r\n totalDeleted += keys.length;\r\n }\r\n }\r\n\r\n console.log(`[conversation-cleanup] EMERGENCY CLEANUP: Deleted ${totalDeleted} conversation keys`);\r\n } catch (error) {\r\n console.error(`[conversation-cleanup] Failed emergency cleanup:`, error);\r\n }\r\n}\r\n"],"names":["execSync","redisHost","process","env","CFN_REDIS_HOST","redisPort","CFN_REDIS_PORT","DEFAULT_OPTIONS","messageTTL","maxMessagesPerAgent","autoCleanupForks","setMessageListTTL","taskId","agentId","ttlSeconds","key","encoding","console","log","error","trimMessageList","maxMessages","start","cleanupTaskMessages","messagesKey","forkPattern","forkKeys","trim","split","filter","k","length","join","forkMetaPattern","metaKeys","currentForkKey","cleanupOrphanedForks","forkMessageKeys","orphanedKeys","messageKey","parts","forkId","metaKey","metaExists","push","getTaskMemoryStats","messageCount","parseInt","estimatedSizeKB","forkCount","configureAutoCleanup","options","config","emergencyCleanupAll","patterns","totalDeleted","pattern","keys"],"mappings":"AAAA;;;;;;;;CAQC,GAED,SAASA,QAAQ,Q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AAI,CAAC,MAAM,EAAE;oBAC1EhB,UAAU;gBACZ;gBACAuC,gBAAgBE,KAAK1B,MAAM;YAC7B;QACF;QAEAd,QAAQC,GAAG,CAAC,CAAC,kDAAkD,EAAEqC,aAAa,kBAAkB,CAAC;IACnG,EAAE,OAAOpC,OAAO;QACdF,QAAQE,KAAK,CAAC,CAAC,gDAAgD,CAAC,EAAEA;IACpE;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../src/cli/conversation-fork-cleanup.ts"],"sourcesContent":["/**\r\n * Conversation Fork Cleanup Utilities\r\n *\r\n * Provides memory leak prevention for Task Mode by:\r\n * 1. Setting TTL on message lists (24h default)\r\n * 2. Cleaning up completed task messages\r\n * 3. Limiting message history size\r\n * 4. Auto-cleanup of orphaned forks\r\n */\r\n\r\nimport { execSync } from 'child_process';\r\n\r\n// FIX: Default to 'localhost' for CLI mode (host execution), not 'cfn-redis' (Docker)\r\nconst redisHost = process.env.CFN_REDIS_HOST || 'localhost';\r\nconst redisPort = process.env.CFN_REDIS_PORT || '6379';\r\n\r\nexport interface CleanupOptions {\r\n messageTTL?: number; // TTL for message lists (seconds, default: 86400 = 24h)\r\n maxMessagesPerAgent?: number; // Max messages to keep per agent (default: 100)\r\n autoCleanupForks?: boolean; // Auto-cleanup orphaned forks (default: true)\r\n}\r\n\r\nconst DEFAULT_OPTIONS: Required<CleanupOptions> = {\r\n messageTTL: 86400, // 24 hours\r\n maxMessagesPerAgent: 100, // 100 messages = ~50 iterations\r\n autoCleanupForks: true,\r\n};\r\n\r\n/**\r\n * Set TTL on message list to prevent indefinite accumulation\r\n */\r\nexport function setMessageListTTL(\r\n taskId: string,\r\n agentId: string,\r\n ttlSeconds: number = DEFAULT_OPTIONS.messageTTL\r\n): void {\r\n const key = `swarm:${taskId}:${agentId}:messages`;\r\n\r\n try {\r\n execSync(`redis-cli -h ${redisHost} -p ${redisPort} expire \"${key}\" ${ttlSeconds}`, {\r\n encoding: 'utf8'\r\n });\r\n console.log(`[conversation-cleanup] Set TTL ${ttlSeconds}s on ${key}`);\r\n } catch (error) {\r\n console.error(`[conversation-cleanup] Failed to set TTL:`, error);\r\n }\r\n}\r\n\r\n/**\r\n * Trim message list to max size (FIFO - keep recent messages)\r\n */\r\nexport function trimMessageList(\r\n taskId: string,\r\n agentId: string,\r\n maxMessages: number = DEFAULT_OPTIONS.maxMessagesPerAgent\r\n): void {\r\n const key = `swarm:${taskId}:${agentId}:messages`;\r\n\r\n try {\r\n // Keep only the last N messages (0 = oldest, -N = keep last N)\r\n const start = -maxMessages;\r\n execSync(`redis-cli -h ${redisHost} -p ${redisPort} ltrim \"${key}\" ${start} -1`, {\r\n encoding: 'utf8'\r\n });\r\n console.log(`[conversation-cleanup] Trimmed ${key} to ${maxMessages} messages`);\r\n } catch (error) {\r\n console.error(`[conversation-cleanup] Failed to trim messages:`, error);\r\n }\r\n}\r\n\r\n/**\r\n * Clean up all messages and forks for a completed task\r\n */\r\nexport function cleanupTaskMessages(taskId: string, agentId: string): void {\r\n try {\r\n // Delete main message list\r\n const messagesKey = `swarm:${taskId}:${agentId}:messages`;\r\n execSync(`redis-cli -h ${redisHost} -p ${redisPort} del \"${messagesKey}\"`, {\r\n encoding: 'utf8'\r\n });\r\n\r\n // Delete all fork message lists\r\n const forkPattern = `swarm:${taskId}:${agentId}:fork:*:messages`;\r\n const forkKeys = execSync(`redis-cli -h ${redisHost} -p ${redisPort} keys \"${forkPattern}\"`, {\r\n encoding: 'utf8'\r\n }).trim().split('\\n').filter(k => k);\r\n\r\n if (forkKeys.length > 0) {\r\n execSync(`redis-cli -h ${redisHost} -p ${redisPort} del ${forkKeys.join(' ')}`, {\r\n encoding: 'utf8'\r\n });\r\n }\r\n\r\n // Delete all fork metadata\r\n const forkMetaPattern = `swarm:${taskId}:${agentId}:fork:*:meta`;\r\n const metaKeys = execSync(`redis-cli -h ${redisHost} -p ${redisPort} keys \"${forkMetaPattern}\"`, {\r\n encoding: 'utf8'\r\n }).trim().split('\\n').filter(k => k);\r\n\r\n if (metaKeys.length > 0) {\r\n execSync(`redis-cli -h ${redisHost} -p ${redisPort} del ${metaKeys.join(' ')}`, {\r\n encoding: 'utf8'\r\n });\r\n }\r\n\r\n // Delete current fork pointer\r\n const currentForkKey = `swarm:${taskId}:${agentId}:current-fork`;\r\n execSync(`redis-cli -h ${redisHost} -p ${redisPort} del \"${currentForkKey}\"`, {\r\n encoding: 'utf8'\r\n });\r\n\r\n console.log(`[conversation-cleanup] Cleaned up task ${taskId} agent ${agentId}`);\r\n console.log(`[conversation-cleanup] Removed: 1 message list, ${forkKeys.length} fork snapshots, ${metaKeys.length} fork metadata`);\r\n } catch (error) {\r\n console.error(`[conversation-cleanup] Failed to cleanup task messages:`, error);\r\n }\r\n}\r\n\r\n/**\r\n * Clean up orphaned forks (metadata expired but messages remain)\r\n */\r\nexport function cleanupOrphanedForks(taskId: string, agentId: string): void {\r\n try {\r\n // Find all fork message keys\r\n const forkPattern = `swarm:${taskId}:${agentId}:fork:*:messages`;\r\n const forkMessageKeys = execSync(`redis-cli -h ${redisHost} -p ${redisPort} keys \"${forkPattern}\"`, {\r\n encoding: 'utf8'\r\n }).trim().split('\\n').filter(k => k);\r\n\r\n if (forkMessageKeys.length === 0) {\r\n return;\r\n }\r\n\r\n const orphanedKeys: string[] = [];\r\n\r\n for (const messageKey of forkMessageKeys) {\r\n // Extract fork ID from key: swarm:task:agent:fork:FORK_ID:messages\r\n const parts = messageKey.split(':');\r\n const forkId = parts[parts.length - 2];\r\n\r\n // Check if metadata exists\r\n const metaKey = `swarm:${taskId}:${agentId}:fork:${forkId}:meta`;\r\n const metaExists = execSync(`redis-cli -h ${redisHost} -p ${redisPort} exists \"${metaKey}\"`, {\r\n encoding: 'utf8'\r\n }).trim();\r\n\r\n if (metaExists === '0') {\r\n // Metadata expired but messages remain = orphaned\r\n orphanedKeys.push(messageKey);\r\n }\r\n }\r\n\r\n if (orphanedKeys.length > 0) {\r\n execSync(`redis-cli -h ${redisHost} -p ${redisPort} del ${orphanedKeys.join(' ')}`, {\r\n encoding: 'utf8'\r\n });\r\n console.log(`[conversation-cleanup] Removed ${orphanedKeys.length} orphaned fork snapshots`);\r\n }\r\n } catch (error) {\r\n console.error(`[conversation-cleanup] Failed to cleanup orphaned forks:`, error);\r\n }\r\n}\r\n\r\n/**\r\n * Get memory usage statistics for a task\r\n */\r\nexport function getTaskMemoryStats(taskId: string, agentId: string): {\r\n messageCount: number;\r\n forkCount: number;\r\n estimatedSizeKB: number;\r\n} {\r\n try {\r\n // Count messages in main list\r\n const messagesKey = `swarm:${taskId}:${agentId}:messages`;\r\n const messageCount = parseInt(execSync(`redis-cli -h ${redisHost} -p ${redisPort} llen \"${messagesKey}\"`, {\r\n encoding: 'utf8'\r\n }).trim(), 10);\r\n\r\n // Count forks\r\n const forkPattern = `swarm:${taskId}:${agentId}:fork:*:messages`;\r\n const forkKeys = execSync(`redis-cli -h ${redisHost} -p ${redisPort} keys \"${forkPattern}\"`, {\r\n encoding: 'utf8'\r\n }).trim().split('\\n').filter(k => k);\r\n\r\n // Estimate size (average message ~5KB)\r\n const estimatedSizeKB = messageCount * 5;\r\n\r\n return {\r\n messageCount,\r\n forkCount: forkKeys.length,\r\n estimatedSizeKB,\r\n };\r\n } catch (error) {\r\n console.error(`[conversation-cleanup] Failed to get memory stats:`, error);\r\n return {\r\n messageCount: 0,\r\n forkCount: 0,\r\n estimatedSizeKB: 0,\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * Configure automatic cleanup options for a task\r\n */\r\nexport function configureAutoCleanup(\r\n taskId: string,\r\n agentId: string,\r\n options: CleanupOptions = {}\r\n): void {\r\n const config = { ...DEFAULT_OPTIONS, ...options };\r\n\r\n // Set TTL on message list\r\n setMessageListTTL(taskId, agentId, config.messageTTL);\r\n\r\n // Trim to max size\r\n trimMessageList(taskId, agentId, config.maxMessagesPerAgent);\r\n\r\n // Cleanup orphaned forks\r\n if (config.autoCleanupForks) {\r\n cleanupOrphanedForks(taskId, agentId);\r\n }\r\n\r\n console.log(`[conversation-cleanup] Auto-cleanup configured for ${taskId}/${agentId}`);\r\n console.log(`[conversation-cleanup] - TTL: ${config.messageTTL}s`);\r\n console.log(`[conversation-cleanup] - Max messages: ${config.maxMessagesPerAgent}`);\r\n console.log(`[conversation-cleanup] - Auto-cleanup forks: ${config.autoCleanupForks}`);\r\n}\r\n\r\n/**\r\n * Emergency cleanup - remove all conversation data for all tasks\r\n * USE WITH CAUTION: This will delete ALL conversation history\r\n */\r\nexport function emergencyCleanupAll(): void {\r\n try {\r\n const patterns = [\r\n 'swarm:*:*:messages',\r\n 'swarm:*:*:fork:*:messages',\r\n 'swarm:*:*:fork:*:meta',\r\n 'swarm:*:*:current-fork',\r\n ];\r\n\r\n let totalDeleted = 0;\r\n\r\n for (const pattern of patterns) {\r\n const keys = execSync(`redis-cli -h ${redisHost} -p ${redisPort} keys \"${pattern}\"`, {\r\n encoding: 'utf8'\r\n }).trim().split('\\n').filter(k => k);\r\n\r\n if (keys.length > 0) {\r\n execSync(`redis-cli -h ${redisHost} -p ${redisPort} del ${keys.join(' ')}`, {\r\n encoding: 'utf8'\r\n });\r\n totalDeleted += keys.length;\r\n }\r\n }\r\n\r\n console.log(`[conversation-cleanup] EMERGENCY CLEANUP: Deleted ${totalDeleted} conversation keys`);\r\n } catch (error) {\r\n console.error(`[conversation-cleanup] Failed emergency cleanup:`, error);\r\n }\r\n}\r\n"],"names":["execSync","redisHost","process","env","CFN_REDIS_HOST","redisPort","CFN_REDIS_PORT","DEFAULT_OPTIONS","messageTTL","maxMessagesPerAgent","autoCleanupForks","setMessageListTTL","taskId","agentId","ttlSeconds","key","encoding","console","log","error","trimMessageList","maxMessages","start","cleanupTaskMessages","messagesKey","forkPattern","forkKeys","trim","split","filter","k","length","join","forkMetaPattern","metaKeys","currentForkKey","cleanupOrphanedForks","forkMessageKeys","orphanedKeys","messageKey","parts","forkId","metaKey","metaExists","push","getTaskMemoryStats","messageCount","parseInt","estimatedSizeKB","forkCount","configureAutoCleanup","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MAAM,GAAG,GAAG;gBACnB/B,SAAS,CAAC,aAAa,EAAEC,UAAU,IAAI,EAAEI,UAAU,KAAK,EAAEoD,KAAKzB,IAAI,CAAC,MAAM,EAAE;oBAC1EhB,UAAU;gBACZ;gBACAuC,gBAAgBE,KAAK1B,MAAM;YAC7B;QACF;QAEAd,QAAQC,GAAG,CAAC,CAAC,kDAAkD,EAAEqC,aAAa,kBAAkB,CAAC;IACnG,EAAE,OAAOpC,OAAO;QACdF,QAAQE,KAAK,CAAC,CAAC,gDAAgD,CAAC,EAAEA;IACpE;AACF"}
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
*/ import { execSync } from 'child_process';
|
|
9
9
|
import { randomBytes } from 'crypto';
|
|
10
10
|
// Bug #6 Fix: Read Redis connection parameters from process.env
|
|
11
|
-
|
|
11
|
+
// FIX: Default to 'localhost' for CLI mode (host execution), not 'cfn-redis' (Docker)
|
|
12
|
+
const redisHost = process.env.CFN_REDIS_HOST || 'localhost';
|
|
12
13
|
const redisPort = process.env.CFN_REDIS_PORT || '6379';
|
|
13
14
|
/**
|
|
14
15
|
* Store a message in conversation history
|