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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/services/user-service.ts"],"sourcesContent":["/**\r\n * User Service\r\n *\r\n * Comprehensive user management service with authentication, authorization,\r\n * and security features for the CFN Loop system.\r\n */\r\n\r\nimport { DatabaseService } from '../lib/database-service/index.js';\r\nimport { v4 as uuidv4 } from 'uuid';\r\nimport { User, UserRole, UserStatus, CreateUserRequest, UpdateUserRequest, UserSecurity } from '../types/user.js';\r\nimport { PasswordUtils, JWTUtils, AuthRateLimit } from '../middleware/authentication.js';\r\nimport { AuthMiddleware, UserContext, RBACEnforcer, PromotionOperation } from '../middleware/auth-middleware.js';\r\nimport { createLogger } from '../lib/logging.js';\r\nimport { StandardError, ErrorCode } from '../lib/errors.js';\r\n\r\nconst logger = createLogger('user-service');\r\n\r\nexport interface LoginRequest {\r\n email: string;\r\n password: string;\r\n rememberMe?: boolean;\r\n}\r\n\r\nexport interface LoginResponse {\r\n user: PublicUser;\r\n accessToken: string;\r\n refreshToken: string;\r\n expiresIn: number;\r\n}\r\n\r\nexport interface RegisterRequest {\r\n username: string;\r\n email: string;\r\n password: string;\r\n firstName: string;\r\n lastName: string;\r\n displayName?: string;\r\n}\r\n\r\nexport interface PublicUser {\r\n id: string;\r\n username: string;\r\n email: string;\r\n role: UserRole;\r\n status: UserStatus;\r\n profile: {\r\n displayName: string;\r\n firstName: string;\r\n lastName: string;\r\n bio?: string;\r\n avatar?: string;\r\n };\r\n security: {\r\n emailVerified: boolean;\r\n twoFactorEnabled: boolean;\r\n };\r\n}\r\n\r\nexport interface AuthTokens {\r\n accessToken: string;\r\n refreshToken: string;\r\n expiresIn: number;\r\n}\r\n\r\nexport interface UserServiceConfig {\r\n jwtSecret: string;\r\n jwtExpiration: string;\r\n refreshExpiration: string;\r\n bcryptRounds: number;\r\n maxLoginAttempts: number;\r\n loginLockoutMs: number;\r\n emailVerificationRequired: boolean;\r\n twoFactorRequired: boolean;\r\n}\r\n\r\n/**\r\n * User Service Class\r\n *\r\n * Manages user lifecycle, authentication, and authorization.\r\n */\r\nexport class UserService {\r\n private db: DatabaseService;\r\n private authMiddleware: AuthMiddleware;\r\n private rbacEnforcer: RBACEnforcer;\r\n private config: UserServiceConfig;\r\n\r\n constructor(db: DatabaseService, config: UserServiceConfig) {\r\n this.db = db;\r\n this.config = config;\r\n this.authMiddleware = new AuthMiddleware(config.jwtSecret);\r\n this.rbacEnforcer = new RBACEnforcer(this.authMiddleware);\r\n }\r\n\r\n /**\r\n * Initialize the user service\r\n * Creates necessary tables and indexes if they don't exist\r\n */\r\n async initialize(): Promise<void> {\r\n try {\r\n const sqliteAdapter = this.db.getAdapter('sqlite');\r\n \r\n // Create users table\r\n await sqliteAdapter.execute(`\r\n CREATE TABLE IF NOT EXISTS users (\r\n id TEXT PRIMARY KEY,\r\n username TEXT UNIQUE NOT NULL,\r\n email TEXT UNIQUE NOT NULL,\r\n role TEXT NOT NULL DEFAULT 'user',\r\n status TEXT NOT NULL DEFAULT 'pending_verification',\r\n password_hash TEXT NOT NULL,\r\n salt TEXT NOT NULL,\r\n profile_json TEXT NOT NULL,\r\n privacy_json TEXT NOT NULL,\r\n preferences_json TEXT NOT NULL,\r\n security_json TEXT NOT NULL,\r\n stats_json TEXT NOT NULL,\r\n created_at INTEGER NOT NULL,\r\n updated_at INTEGER NOT NULL,\r\n last_login_at INTEGER,\r\n email_verified_at INTEGER,\r\n phone_verified_at INTEGER\r\n )\r\n `);\r\n\r\n // Create refresh tokens table\r\n await sqliteAdapter.execute(`\r\n CREATE TABLE IF NOT EXISTS refresh_tokens (\r\n id TEXT PRIMARY KEY,\r\n user_id TEXT NOT NULL,\r\n token_hash TEXT NOT NULL,\r\n expires_at INTEGER NOT NULL,\r\n created_at INTEGER NOT NULL,\r\n last_used_at INTEGER,\r\n is_revoked BOOLEAN DEFAULT FALSE,\r\n FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE\r\n )\r\n `);\r\n\r\n // Create password reset tokens table\r\n await sqliteAdapter.execute(`\r\n CREATE TABLE IF NOT EXISTS password_reset_tokens (\r\n id TEXT PRIMARY KEY,\r\n user_id TEXT NOT NULL,\r\n token_hash TEXT NOT NULL,\r\n expires_at INTEGER NOT NULL,\r\n created_at INTEGER NOT NULL,\r\n used_at INTEGER,\r\n FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE\r\n )\r\n `);\r\n\r\n // Create email verification tokens table\r\n await sqliteAdapter.execute(`\r\n CREATE TABLE IF NOT EXISTS email_verification_tokens (\r\n id TEXT PRIMARY KEY,\r\n user_id TEXT NOT NULL,\r\n email TEXT NOT NULL,\r\n token_hash TEXT NOT NULL,\r\n expires_at INTEGER NOT NULL,\r\n created_at INTEGER NOT NULL,\r\n verified_at INTEGER,\r\n FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE\r\n )\r\n `);\r\n\r\n // Create indexes\r\n await sqliteAdapter.execute('CREATE INDEX IF NOT EXISTS idx_users_email ON users (email)');\r\n await sqliteAdapter.execute('CREATE INDEX IF NOT EXISTS idx_users_username ON users (username)');\r\n await sqliteAdapter.execute('CREATE INDEX IF NOT EXISTS idx_users_role ON users (role)');\r\n await sqliteAdapter.execute('CREATE INDEX IF NOT EXISTS idx_users_status ON users (status)');\r\n await sqliteAdapter.execute('CREATE INDEX IF NOT EXISTS idx_refresh_tokens_user_id ON refresh_tokens (user_id)');\r\n await sqliteAdapter.execute('CREATE INDEX IF NOT EXISTS idx_refresh_tokens_expires_at ON refresh_tokens (expires_at)');\r\n\r\n logger.info('User service initialized successfully');\r\n } catch (error) {\r\n logger.error('Failed to initialize user service:', error);\r\n throw new StandardError(\r\n ErrorCode.INTERNAL_ERROR,\r\n 'Failed to initialize user service',\r\n {},\r\n error as Error\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Register a new user\r\n */\r\n async register(request: RegisterRequest): Promise<{ user: PublicUser; tokens: AuthTokens }> {\r\n const { username, email, password, firstName, lastName, displayName } = request;\r\n\r\n try {\r\n // Validate input\r\n this.validateEmail(email);\r\n this.validateUsername(username);\r\n this.validatePassword(password);\r\n\r\n // Check if user already exists\r\n const existingUser = await this.findUserByEmailOrUsername(email, username);\r\n if (existingUser) {\r\n throw new StandardError(\r\n ErrorCode.CONFLICT,\r\n existingUser.email === email ? 'Email already registered' : 'Username already taken',\r\n { field: existingUser.email === email ? 'email' : 'username' }\r\n );\r\n }\r\n\r\n // Hash password\r\n const salt = await PasswordUtils.generateSalt();\r\n const passwordHash = await PasswordUtils.hashPassword(password, this.config.bcryptRounds);\r\n\r\n // Create user\r\n const now = Math.floor(Date.now() / 1000);\r\n const userId = uuidv4();\r\n\r\n const user: User = {\r\n id: userId,\r\n username,\r\n email,\r\n role: UserRole.USER,\r\n status: this.config.emailVerificationRequired ? UserStatus.PENDING_VERIFICATION : UserStatus.ACTIVE,\r\n profile: {\r\n firstName,\r\n lastName,\r\n displayName: displayName || `${firstName} ${lastName}`,\r\n },\r\n privacy: {\r\n profileVisibility: 'public',\r\n allowFriendRequests: true,\r\n allowMessages: true,\r\n allowStoryTagging: true,\r\n allowLocationSharing: false,\r\n showOnlineStatus: true,\r\n },\r\n preferences: {\r\n theme: 'auto',\r\n language: 'en',\r\n timezone: 'UTC',\r\n emailNotifications: true,\r\n pushNotifications: true,\r\n autoSaveStories: true,\r\n storyVisibilityDefault: 'private',\r\n },\r\n security: {\r\n email,\r\n emailVerified: !this.config.emailVerificationRequired,\r\n twoFactorEnabled: false,\r\n loginAttempts: 0,\r\n },\r\n stats: {\r\n storiesCount: 0,\r\n friendsCount: 0,\r\n followersCount: 0,\r\n followingCount: 0,\r\n },\r\n createdAt: new Date(now * 1000),\r\n updatedAt: new Date(now * 1000),\r\n };\r\n\r\n // Save user to database\r\n await this.saveUser(user, passwordHash, salt);\r\n\r\n // Create email verification token if required\r\n if (this.config.emailVerificationRequired) {\r\n await this.createEmailVerificationToken(userId, email);\r\n }\r\n\r\n // Generate tokens\r\n const tokens = await this.generateAuthTokens(user);\r\n\r\n // Log user registration\r\n logger.info('User registered successfully', { userId, username, email });\r\n\r\n return {\r\n user: this.toPublicUser(user),\r\n tokens,\r\n };\r\n } catch (error) {\r\n if (error instanceof StandardError) {\r\n throw error;\r\n }\r\n logger.error('User registration failed:', error);\r\n throw new StandardError(\r\n ErrorCode.INTERNAL_ERROR,\r\n 'User registration failed',\r\n {},\r\n error as Error\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Authenticate user and generate tokens\r\n */\r\n async login(request: LoginRequest): Promise<LoginResponse> {\r\n const { email, password, rememberMe } = request;\r\n\r\n try {\r\n // Check rate limiting\r\n if (AuthRateLimit.hasExceededAttempts(email, this.config.maxLoginAttempts, this.config.loginLockoutMs)) {\r\n throw new StandardError(\r\n ErrorCode.TOO_MANY_REQUESTS,\r\n 'Too many login attempts. Please try again later.',\r\n { retryAfter: Math.ceil(this.config.loginLockoutMs / 1000) }\r\n );\r\n }\r\n\r\n // Find user by email\r\n const user = await this.findUserByEmail(email);\r\n if (!user) {\r\n AuthRateLimit.hasExceededAttempts(email, this.config.maxLoginAttempts, this.config.loginLockoutMs);\r\n throw new StandardError(\r\n ErrorCode.NOT_FOUND,\r\n 'Invalid email or password'\r\n );\r\n }\r\n\r\n // Check user status\r\n if (user.status === UserStatus.SUSPENDED) {\r\n throw new StandardError(\r\n ErrorCode.FORBIDDEN,\r\n 'Account suspended. Please contact support.'\r\n );\r\n }\r\n\r\n if (user.status === UserStatus.INACTIVE) {\r\n throw new StandardError(\r\n ErrorCode.FORBIDDEN,\r\n 'Account inactive. Please contact support.'\r\n );\r\n }\r\n\r\n // Get user credentials\r\n const credentials = await this.getUserCredentials(user.id);\r\n if (!credentials) {\r\n throw new StandardError(\r\n ErrorCode.INTERNAL_ERROR,\r\n 'User credentials not found'\r\n );\r\n }\r\n\r\n // Verify password\r\n const isPasswordValid = await PasswordUtils.comparePassword(password, credentials.passwordHash);\r\n if (!isPasswordValid) {\r\n AuthRateLimit.hasExceededAttempts(email, this.config.maxLoginAttempts, this.config.loginLockoutMs);\r\n \r\n // Update failed login attempts\r\n await this.updateFailedLoginAttempts(user.id, user.security.loginAttempts + 1);\r\n \r\n throw new StandardError(\r\n ErrorCode.NOT_FOUND,\r\n 'Invalid email or password'\r\n );\r\n }\r\n\r\n // Clear failed login attempts\r\n AuthRateLimit.clearAttempts(email);\r\n await this.updateFailedLoginAttempts(user.id, 0);\r\n\r\n // Update last login\r\n await this.updateLastLogin(user.id);\r\n\r\n // Generate tokens\r\n const tokens = await this.generateAuthTokens(user, rememberMe);\r\n\r\n // Log successful login\r\n logger.info('User logged in successfully', { userId: user.id, email });\r\n\r\n return {\r\n user: this.toPublicUser(user),\r\n accessToken: tokens.accessToken,\r\n refreshToken: tokens.refreshToken,\r\n expiresIn: tokens.expiresIn,\r\n };\r\n } catch (error) {\r\n if (error instanceof StandardError) {\r\n throw error;\r\n }\r\n logger.error('Login failed:', error);\r\n throw new StandardError(\r\n ErrorCode.INTERNAL_ERROR,\r\n 'Login failed',\r\n {},\r\n error as Error\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Refresh access token using refresh token\r\n */\r\n async refreshToken(refreshToken: string): Promise<AuthTokens> {\r\n try {\r\n // Validate refresh token\r\n const payload = JWTUtils.verifyToken(refreshToken, this.config.jwtSecret);\r\n if (payload.type !== 'refresh') {\r\n throw new StandardError(\r\n ErrorCode.INVALID_TOKEN,\r\n 'Invalid refresh token'\r\n );\r\n }\r\n\r\n // Check if refresh token exists and is not revoked\r\n const tokenRecord = await this.findRefreshToken(payload.jti!, payload.userId);\r\n if (!tokenRecord || tokenRecord.isRevoked) {\r\n throw new StandardError(\r\n ErrorCode.INVALID_TOKEN,\r\n 'Invalid or revoked refresh token'\r\n );\r\n }\r\n\r\n // Find user\r\n const user = await this.findUserById(payload.userId);\r\n if (!user) {\r\n throw new StandardError(\r\n ErrorCode.NOT_FOUND,\r\n 'User not found'\r\n );\r\n }\r\n\r\n // Check user status\r\n if (user.status !== UserStatus.ACTIVE) {\r\n throw new StandardError(\r\n ErrorCode.FORBIDDEN,\r\n 'Account is not active'\r\n );\r\n }\r\n\r\n // Revoke old refresh token\r\n await this.revokeRefreshToken(payload.jti!);\r\n\r\n // Generate new tokens\r\n const tokens = await this.generateAuthTokens(user);\r\n\r\n // Update last used timestamp\r\n await this.updateRefreshTokenLastUsed(payload.jti!);\r\n\r\n logger.info('Token refreshed successfully', { userId: user.id });\r\n\r\n return tokens;\r\n } catch (error) {\r\n if (error instanceof StandardError) {\r\n throw error;\r\n }\r\n logger.error('Token refresh failed:', error);\r\n throw new StandardError(\r\n ErrorCode.INTERNAL_ERROR,\r\n 'Token refresh failed',\r\n {},\r\n error as Error\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Logout user and revoke tokens\r\n */\r\n async logout(refreshToken: string): Promise<void> {\r\n try {\r\n // Validate refresh token\r\n const payload = JWTUtils.decodeToken(refreshToken);\r\n if (!payload || payload.type !== 'refresh') {\r\n return; // Invalid token, just return success\r\n }\r\n\r\n // Revoke refresh token\r\n if (payload.jti) {\r\n await this.revokeRefreshToken(payload.jti);\r\n }\r\n\r\n logger.info('User logged out successfully', { userId: payload.userId });\r\n } catch (error) {\r\n logger.error('Logout failed:', error);\r\n // Don't throw error on logout to prevent client issues\r\n }\r\n }\r\n\r\n /**\r\n * Get user by ID\r\n */\r\n async getUserById(userId: string): Promise<PublicUser | null> {\r\n try {\r\n const user = await this.findUserById(userId);\r\n return user ? this.toPublicUser(user) : null;\r\n } catch (error) {\r\n logger.error('Failed to get user by ID:', error);\r\n return null;\r\n }\r\n }\r\n\r\n /**\r\n * Update user profile\r\n */\r\n async updateUserProfile(userId: string, updates: UpdateUserRequest): Promise<PublicUser> {\r\n try {\r\n const user = await this.findUserById(userId);\r\n if (!user) {\r\n throw new StandardError(\r\n ErrorCode.NOT_FOUND,\r\n 'User not found'\r\n );\r\n }\r\n\r\n // Update user\r\n const updatedUser = {\r\n ...user,\r\n profile: {\r\n ...user.profile,\r\n ...updates.profile,\r\n },\r\n privacy: {\r\n ...user.privacy,\r\n ...updates.privacy,\r\n },\r\n preferences: {\r\n ...user.preferences,\r\n ...updates.preferences,\r\n },\r\n updatedAt: new Date(),\r\n };\r\n\r\n await this.saveUser(updatedUser);\r\n\r\n logger.info('User profile updated successfully', { userId });\r\n\r\n return this.toPublicUser(updatedUser);\r\n } catch (error) {\r\n if (error instanceof StandardError) {\r\n throw error;\r\n }\r\n logger.error('Failed to update user profile:', error);\r\n throw new StandardError(\r\n ErrorCode.INTERNAL_ERROR,\r\n 'Failed to update user profile',\r\n {},\r\n error as Error\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Change user password\r\n */\r\n async changePassword(userId: string, currentPassword: string, newPassword: string): Promise<void> {\r\n try {\r\n // Validate new password\r\n this.validatePassword(newPassword);\r\n\r\n // Get current credentials\r\n const credentials = await this.getUserCredentials(userId);\r\n if (!credentials) {\r\n throw new StandardError(\r\n ErrorCode.NOT_FOUND,\r\n 'User not found'\r\n );\r\n }\r\n\r\n // Verify current password\r\n const isCurrentPasswordValid = await PasswordUtils.comparePassword(currentPassword, credentials.passwordHash);\r\n if (!isCurrentPasswordValid) {\r\n throw new StandardError(\r\n ErrorCode.VALIDATION_FAILED,\r\n 'Current password is incorrect'\r\n );\r\n }\r\n\r\n // Hash new password\r\n const salt = await PasswordUtils.generateSalt();\r\n const newPasswordHash = await PasswordUtils.hashPassword(newPassword, this.config.bcryptRounds);\r\n\r\n // Update password\r\n await this.updateUserPassword(userId, newPasswordHash, salt);\r\n\r\n // Revoke all refresh tokens for this user\r\n await this.revokeAllUserRefreshTokens(userId);\r\n\r\n logger.info('Password changed successfully', { userId });\r\n } catch (error) {\r\n if (error instanceof StandardError) {\r\n throw error;\r\n }\r\n logger.error('Failed to change password:', error);\r\n throw new StandardError(\r\n ErrorCode.INTERNAL_ERROR,\r\n 'Failed to change password',\r\n {},\r\n error as Error\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Validate JWT token and return user context\r\n */\r\n async validateToken(token: string): Promise<UserContext> {\r\n try {\r\n return this.authMiddleware.validateToken(token);\r\n } catch (error) {\r\n throw new StandardError(\r\n ErrorCode.INVALID_TOKEN,\r\n 'Invalid authentication token',\r\n {},\r\n error as Error\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Check if user has permission for an operation\r\n */\r\n async checkPermission(userContext: UserContext, operation: PromotionOperation): Promise<boolean> {\r\n try {\r\n return this.rbacEnforcer.hasPermission(userContext, operation);\r\n } catch (error) {\r\n logger.error('Permission check failed:', error);\r\n return false;\r\n }\r\n }\r\n\r\n /**\r\n * Enforce permission check - throws if user lacks permission\r\n */\r\n async enforcePermission(userContext: UserContext, operation: PromotionOperation, skillId?: string): Promise<void> {\r\n try {\r\n this.rbacEnforcer.enforcePermission(userContext, operation, skillId);\r\n } catch (error) {\r\n if (error instanceof StandardError) {\r\n throw error;\r\n }\r\n throw new StandardError(\r\n ErrorCode.FORBIDDEN,\r\n 'Permission check failed',\r\n {},\r\n error as Error\r\n );\r\n }\r\n }\r\n\r\n // Private helper methods\r\n\r\n private validateEmail(email: string): void {\r\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\r\n if (!emailRegex.test(email)) {\r\n throw new StandardError(\r\n ErrorCode.VALIDATION_FAILED,\r\n 'Invalid email format'\r\n );\r\n }\r\n }\r\n\r\n private validateUsername(username: string): void {\r\n if (username.length < 3 || username.length > 30) {\r\n throw new StandardError(\r\n ErrorCode.VALIDATION_FAILED,\r\n 'Username must be between 3 and 30 characters'\r\n );\r\n }\r\n\r\n const usernameRegex = /^[a-zA-Z0-9_-]+$/;\r\n if (!usernameRegex.test(username)) {\r\n throw new StandardError(\r\n ErrorCode.VALIDATION_FAILED,\r\n 'Username can only contain letters, numbers, underscores, and hyphens'\r\n );\r\n }\r\n }\r\n\r\n private validatePassword(password: string): void {\r\n if (!PasswordUtils.validatePasswordStrength(password)) {\r\n throw new StandardError(\r\n ErrorCode.VALIDATION_FAILED,\r\n 'Password must be at least 8 characters long and contain uppercase, lowercase, number, and special character'\r\n );\r\n }\r\n }\r\n\r\n private async generateAuthTokens(user: User, rememberMe: boolean = false): Promise<AuthTokens> {\r\n const expiresIn = rememberMe ? '30d' : this.config.jwtExpiration;\r\n const refreshExpiresIn = rememberMe ? '90d' : this.config.refreshExpiration;\r\n\r\n // Generate access token\r\n const accessTokenPayload = {\r\n userId: user.id,\r\n email: user.email,\r\n role: user.role,\r\n type: 'access',\r\n };\r\n const accessToken = JWTUtils.generateToken(accessTokenPayload, this.config.jwtSecret, expiresIn);\r\n\r\n // Generate refresh token\r\n const refreshTokenId = uuidv4();\r\n const refreshTokenPayload = {\r\n userId: user.id,\r\n email: user.email,\r\n role: user.role,\r\n type: 'refresh',\r\n jti: refreshTokenId,\r\n };\r\n const refreshToken = JWTUtils.generateToken(refreshTokenPayload, this.config.jwtSecret, refreshExpiresIn);\r\n\r\n // Save refresh token to database\r\n const now = Math.floor(Date.now() / 1000);\r\n const refreshTokenHash = await PasswordUtils.hashPassword(refreshToken, 10);\r\n const expiresAt = now + (rememberMe ? 90 * 24 * 60 * 60 : 7 * 24 * 60 * 60); // 90 days or 7 days\r\n\r\n await this.saveRefreshToken(refreshTokenId, user.id, refreshTokenHash, expiresAt);\r\n\r\n // Calculate expiresIn in seconds\r\n const expiresInSeconds = rememberMe ? 30 * 24 * 60 * 60 : 24 * 60 * 60; // 30 days or 24 hours\r\n\r\n return {\r\n accessToken,\r\n refreshToken,\r\n expiresIn: expiresInSeconds,\r\n };\r\n }\r\n\r\n private toPublicUser(user: User): PublicUser {\r\n return {\r\n id: user.id,\r\n username: user.username,\r\n email: user.email,\r\n role: user.role,\r\n status: user.status,\r\n profile: {\r\n displayName: user.profile.displayName,\r\n firstName: user.profile.firstName,\r\n lastName: user.profile.lastName,\r\n bio: user.profile.bio,\r\n avatar: user.profile.avatar,\r\n },\r\n security: {\r\n emailVerified: user.security.emailVerified,\r\n twoFactorEnabled: user.security.twoFactorEnabled,\r\n },\r\n };\r\n }\r\n\r\n // Database helper methods\r\n\r\n private async findUserById(userId: string): Promise<User | null> {\r\n const adapter = this.db.getAdapter('sqlite');\r\n const row = await adapter.get(\r\n 'SELECT * FROM users WHERE id = ?',\r\n [userId]\r\n );\r\n return row ? this.rowToUser(row) : null;\r\n }\r\n\r\n private async findUserByEmail(email: string): Promise<User | null> {\r\n const adapter = this.db.getAdapter('sqlite');\r\n const row = await adapter.get(\r\n 'SELECT * FROM users WHERE email = ?',\r\n [email]\r\n );\r\n return row ? this.rowToUser(row) : null;\r\n }\r\n\r\n private async findUserByEmailOrUsername(email: string, username: string): Promise<User | null> {\r\n const adapter = this.db.getAdapter('sqlite');\r\n const row = await adapter.get(\r\n 'SELECT * FROM users WHERE email = ? OR username = ?',\r\n [email, username]\r\n );\r\n return row ? this.rowToUser(row) : null;\r\n }\r\n\r\n private async getUserCredentials(userId: string): Promise<{ passwordHash: string; salt: string } | null> {\r\n const adapter = this.db.getAdapter('sqlite');\r\n const row = await adapter.get(\r\n 'SELECT password_hash, salt FROM users WHERE id = ?',\r\n [userId]\r\n );\r\n return row ? { passwordHash: row.password_hash, salt: row.salt } : null;\r\n }\r\n\r\n private async saveUser(user: User, passwordHash?: string, salt?: string): Promise<void> {\r\n const adapter = this.db.getAdapter('sqlite');\r\n const now = Math.floor(Date.now() / 1000);\r\n\r\n await adapter.execute(`\r\n INSERT OR REPLACE INTO users (\r\n id, username, email, role, status, password_hash, salt,\r\n profile_json, privacy_json, preferences_json, security_json, stats_json,\r\n created_at, updated_at, last_login_at, email_verified_at, phone_verified_at\r\n ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\r\n `, [\r\n user.id,\r\n user.username,\r\n user.email,\r\n user.role,\r\n user.status,\r\n passwordHash,\r\n salt,\r\n JSON.stringify(user.profile),\r\n JSON.stringify(user.privacy),\r\n JSON.stringify(user.preferences),\r\n JSON.stringify(user.security),\r\n JSON.stringify(user.stats),\r\n Math.floor(user.createdAt.getTime() / 1000),\r\n now,\r\n user.updatedAt ? Math.floor(user.updatedAt.getTime() / 1000) : now,\r\n user.security.emailVerifiedAt ? Math.floor(user.security.emailVerifiedAt.getTime() / 1000) : null,\r\n user.security.phoneVerifiedAt ? Math.floor(user.security.phoneVerifiedAt.getTime() / 1000) : null,\r\n ]);\r\n }\r\n\r\n private async updateFailedLoginAttempts(userId: string, attempts: number): Promise<void> {\r\n const adapter = this.db.getAdapter('sqlite');\r\n const lockedUntil = attempts >= this.config.maxLoginAttempts ? \r\n Math.floor(Date.now() / 1000) + Math.floor(this.config.loginLockoutMs / 1000) : null;\r\n\r\n await adapter.execute(`\r\n UPDATE users \r\n SET security_json = json_set(\r\n json_set(security_json, '$.loginAttempts', ?),\r\n '$.lockedUntil',\r\n ?\r\n )\r\n WHERE id = ?\r\n `, [attempts, lockedUntil, userId]);\r\n }\r\n\r\n private async updateLastLogin(userId: string): Promise<void> {\r\n const adapter = this.db.getAdapter('sqlite');\r\n const now = Math.floor(Date.now() / 1000);\r\n\r\n await adapter.execute(`\r\n UPDATE users \r\n SET last_login_at = ?, updated_at = ?\r\n WHERE id = ?\r\n `, [now, now, userId]);\r\n }\r\n\r\n private async updateRefreshTokenLastUsed(tokenId: string): Promise<void> {\r\n const adapter = this.db.getAdapter('sqlite');\r\n const now = Math.floor(Date.now() / 1000);\r\n\r\n await adapter.execute(`\r\n UPDATE refresh_tokens \r\n SET last_used_at = ?\r\n WHERE id = ?\r\n `, [now, tokenId]);\r\n }\r\n\r\n private async saveRefreshToken(\r\n tokenId: string,\r\n userId: string,\r\n tokenHash: string,\r\n expiresAt: number\r\n ): Promise<void> {\r\n const adapter = this.db.getAdapter('sqlite');\r\n const now = Math.floor(Date.now() / 1000);\r\n\r\n await adapter.execute(`\r\n INSERT INTO refresh_tokens (id, user_id, token_hash, expires_at, created_at)\r\n VALUES (?, ?, ?, ?, ?)\r\n `, [tokenId, userId, tokenHash, expiresAt, now]);\r\n }\r\n\r\n private async findRefreshToken(tokenId: string, userId: string): Promise<{ id: string; isRevoked: boolean } | null> {\r\n const adapter = this.db.getAdapter('sqlite');\r\n const row = await adapter.get(\r\n 'SELECT id, is_revoked FROM refresh_tokens WHERE id = ? AND user_id = ? AND expires_at > ?',\r\n [tokenId, userId, Math.floor(Date.now() / 1000)]\r\n );\r\n return row;\r\n }\r\n\r\n private async revokeRefreshToken(tokenId: string): Promise<void> {\r\n const adapter = this.db.getAdapter('sqlite');\r\n await adapter.execute(\r\n 'UPDATE refresh_tokens SET is_revoked = TRUE WHERE id = ?',\r\n [tokenId]\r\n );\r\n }\r\n\r\n private async revokeAllUserRefreshTokens(userId: string): Promise<void> {\r\n const adapter = this.db.getAdapter('sqlite');\r\n await adapter.execute(\r\n 'UPDATE refresh_tokens SET is_revoked = TRUE WHERE user_id = ?',\r\n [userId]\r\n );\r\n }\r\n\r\n private async updateUserPassword(userId: string, passwordHash: string, salt: string): Promise<void> {\r\n const adapter = this.db.getAdapter('sqlite');\r\n const now = Math.floor(Date.now() / 1000);\r\n\r\n await adapter.execute(`\r\n UPDATE users \r\n SET password_hash = ?, salt = ?, updated_at = ?,\r\n security_json = json_set(security_json, '$.lastPasswordChange', ?)\r\n WHERE id = ?\r\n `, [passwordHash, salt, now, now, userId]);\r\n }\r\n\r\n private async createEmailVerificationToken(userId: string, email: string): Promise<void> {\r\n const adapter = this.db.getAdapter('sqlite');\r\n const tokenId = uuidv4();\r\n const token = uuidv4();\r\n const tokenHash = await PasswordUtils.hashPassword(token, 10);\r\n const expiresAt = Math.floor(Date.now() / 1000) + (24 * 60 * 60); // 24 hours\r\n\r\n await adapter.execute(`\r\n INSERT INTO email_verification_tokens (id, user_id, email, token_hash, expires_at, created_at)\r\n VALUES (?, ?, ?, ?, ?, ?)\r\n `, [tokenId, userId, email, tokenHash, expiresAt, Math.floor(Date.now() / 1000)]);\r\n\r\n // In a real implementation, send email with token\r\n logger.info('Email verification token created', { userId, email, token });\r\n }\r\n\r\n private rowToUser(row: any): User {\r\n return {\r\n id: row.id,\r\n username: row.username,\r\n email: row.email,\r\n role: row.role as UserRole,\r\n status: row.status as UserStatus,\r\n profile: JSON.parse(row.profile_json),\r\n privacy: JSON.parse(row.privacy_json),\r\n preferences: JSON.parse(row.preferences_json),\r\n security: JSON.parse(row.security_json),\r\n stats: JSON.parse(row.stats_json),\r\n createdAt: new Date(row.created_at * 1000),\r\n updatedAt: new Date(row.updated_at * 1000),\r\n };\r\n }\r\n}\r\n\r\nexport default UserService;"],"names":["v4","uuidv4","UserRole","UserStatus","PasswordUtils","JWTUtils","AuthRateLimit","AuthMiddleware","RBACEnforcer","createLogger","StandardError","ErrorCode","logger","UserService","db","authMiddleware","rbacEnforcer","config","jwtSecret","initialize","sqliteAdapter","getAdapter","execute","info","error","INTERNAL_ERROR","register","request","username","email","password","firstName","lastName","displayName","validateEmail","validateUsername","validatePassword","existingUser","findUserByEmailOrUsername","CONFLICT","field","salt","generateSalt","passwordHash","hashPassword","bcryptRounds","now","Math","floor","Date","userId","user","id","role","USER","status","emailVerificationRequired","PENDING_VERIFICATION","ACTIVE","profile","privacy","profileVisibility","allowFriendRequests","allowMessages","allowStoryTagging","allowLocationSharing","showOnlineStatus","preferences","theme","language","timezone","emailNotifications","pushNotifications","autoSaveStories","storyVisibilityDefault","security","emailVerified","twoFactorEnabled","loginAttempts","stats","storiesCount","friendsCount","followersCount","followingCount","createdAt","updatedAt","saveUser","createEmailVerificationToken","tokens","generateAuthTokens","toPublicUser","login","rememberMe","hasExceededAttempts","maxLoginAttempts","loginLockoutMs","TOO_MANY_REQUESTS","retryAfter","ceil","findUserByEmail","NOT_FOUND","SUSPENDED","FORBIDDEN","INACTIVE","credentials","getUserCredentials","isPasswordValid","comparePassword","updateFailedLoginAttempts","clearAttempts","updateLastLogin","accessToken","refreshToken","expiresIn","payload","verifyToken","type","INVALID_TOKEN","tokenRecord","findRefreshToken","jti","isRevoked","findUserById","revokeRefreshToken","updateRefreshTokenLastUsed","logout","decodeToken","getUserById","updateUserProfile","updates","updatedUser","changePassword","currentPassword","newPassword","isCurrentPasswordValid","VALIDATION_FAILED","newPasswordHash","updateUserPassword","revokeAllUserRefreshTokens","validateToken","token","checkPermission","userContext","operation","hasPermission","enforcePermission","skillId","emailRegex","test","length","usernameRegex","validatePasswordStrength","jwtExpiration","refreshExpiresIn","refreshExpiration","accessTokenPayload","generateToken","refreshTokenId","refreshTokenPayload","refreshTokenHash","expiresAt","saveRefreshToken","expiresInSeconds","bio","avatar","adapter","row","get","rowToUser","password_hash","JSON","stringify","getTime","emailVerifiedAt","phoneVerifiedAt","attempts","lockedUntil","tokenId","tokenHash","parse","profile_json","privacy_json","preferences_json","security_json","stats_json","created_at","updated_at"],"mappings":"AAAA;;;;;CAKC,GAGD,SAASA,MAAMC,MAAM,QAAQ,OAAO;AACpC,SAAeC,QAAQ,EAAEC,UAAU,QAA4D,mBAAmB;AAClH,SAASC,aAAa,EAAEC,QAAQ,EAAEC,aAAa,QAAQ,kCAAkC;AACzF,SAASC,cAAc,EAAeC,YAAY,QAA4B,mCAAmC;AACjH,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,aAAa,EAAEC,SAAS,QAAQ,mBAAmB;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,IAAIe,YAAY;YACpClH,aAAauG,KAAKS,KAAK,CAACb,IAAIgB,gBAAgB;YAC5C3G,UAAU+F,KAAKS,KAAK,CAACb,IAAIiB,aAAa;YACtCxG,OAAO2F,KAAKS,KAAK,CAACb,IAAIkB,UAAU;YAChCpG,WAAW,IAAInC,KAAKqH,IAAImB,UAAU,GAAG;YACrCpG,WAAW,IAAIpC,KAAKqH,IAAIoB,UAAU,GAAG;QACvC;IACF;AACF;AAEA,eAAe7K,YAAY"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript declarations for trigger.dev webhook events and CFN Loop integration
|
|
3
|
+
* Used for type-safe event handling in trigger.dev orchestration
|
|
4
|
+
*/ /**
|
|
5
|
+
* Run status literal type matching trigger.dev API
|
|
6
|
+
*/ /**
|
|
7
|
+
* Task mode agent result
|
|
8
|
+
*/ export { };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=trigger-dev-events.d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/types/trigger-dev-events.d.ts"],"sourcesContent":["/**\r\n * TypeScript declarations for trigger.dev webhook events and CFN Loop integration\r\n * Used for type-safe event handling in trigger.dev orchestration\r\n */\r\n\r\n/**\r\n * Run status literal type matching trigger.dev API\r\n */\r\nexport type RunStatusType = 'PENDING' | 'RUNNING' | 'SUCCESS' | 'FAILURE' | 'CANCELED' | 'TIMEOUT' | 'WAITING';\r\n\r\n/**\r\n * CFN Loop agent type discriminated union\r\n */\r\nexport type AgentType = 'loop3-implementer' | 'loop2-validator' | 'product-owner' | 'orchestrator';\r\n\r\n/**\r\n * Agent completion event payload\r\n */\r\nexport interface AgentCompletePayload {\r\n agentId: string;\r\n agentType: AgentType;\r\n taskId: string;\r\n status: 'success' | 'failure';\r\n output: string;\r\n confidenceScore?: number;\r\n executionTimeMs: number;\r\n metadata?: Record<string, unknown>;\r\n}\r\n\r\n/**\r\n * Gate check result from Loop 3\r\n */\r\nexport interface GateResultPayload {\r\n taskId: string;\r\n gateType: 'loop3-test-gate' | 'loop2-consensus-gate';\r\n passed: boolean;\r\n passRate?: number;\r\n details: {\r\n threshold: number;\r\n actualValue: number;\r\n failureReason?: string;\r\n };\r\n timestamp: string;\r\n}\r\n\r\n/**\r\n * Consensus collection result from Loop 2\r\n */\r\nexport interface ConsensusResultPayload {\r\n taskId: string;\r\n validatorCount: number;\r\n consensusScore: number;\r\n consensusThreshold: number;\r\n passed: boolean;\r\n validatorScores: Array<{\r\n validatorId: string;\r\n score: number;\r\n feedback?: string;\r\n }>;\r\n timestamp: string;\r\n}\r\n\r\n/**\r\n * Product Owner decision payload\r\n */\r\nexport interface PODecisionPayload {\r\n taskId: string;\r\n decision: 'PROCEED' | 'ITERATE' | 'ABORT';\r\n reasoning: string;\r\n reviewNotes?: string;\r\n deliverablesSummary?: string;\r\n timestamp: string;\r\n}\r\n\r\n/**\r\n * CFN Loop trigger payload\r\n */\r\nexport interface CFNLoopPayload {\r\n taskId: string;\r\n description: string;\r\n mode: 'standard' | 'mvp' | 'enterprise';\r\n successCriteria: {\r\n gate: string;\r\n consensusThreshold: number;\r\n testPassRateThreshold: number;\r\n };\r\n context?: Record<string, unknown>;\r\n webhookUrl?: string;\r\n}\r\n\r\n/**\r\n * Trigger.dev run status response\r\n */\r\nexport interface RunStatusResponse {\r\n id: string;\r\n status: RunStatusType;\r\n startedAt?: string;\r\n completedAt?: string;\r\n output?: unknown;\r\n error?: string;\r\n}\r\n\r\n/**\r\n * Trigger.dev run object\r\n */\r\nexport interface Run {\r\n id: string;\r\n taskId: string;\r\n status: RunStatusType;\r\n createdAt: string;\r\n updatedAt: string;\r\n startedAt?: string;\r\n completedAt?: string;\r\n output?: unknown;\r\n error?: string;\r\n metadata?: Record<string, unknown>;\r\n}\r\n\r\n/**\r\n * Webhook signature verification options\r\n */\r\nexport interface WebhookVerificationOptions {\r\n algorithmType: 'sha256' | 'sha512';\r\n headerName: string;\r\n}\r\n\r\n/**\r\n * Typed webhook request context\r\n */\r\nexport interface WebhookContext<T> {\r\n payload: T;\r\n isVerified: boolean;\r\n timestamp: number;\r\n signature?: string;\r\n}\r\n\r\n/**\r\n * Webhook handler result\r\n */\r\nexport interface WebhookHandlerResult {\r\n success: boolean;\r\n message: string;\r\n data?: unknown;\r\n}\r\n\r\n/**\r\n * Task mode coordination event (in-memory)\r\n */\r\nexport interface TaskModeEvent {\r\n type: 'agent-complete' | 'gate-result' | 'consensus-result' | 'po-decision';\r\n taskId: string;\r\n payload: AgentCompletePayload | GateResultPayload | ConsensusResultPayload | PODecisionPayload;\r\n timestamp: number;\r\n}\r\n\r\n/**\r\n * Task mode agent spawning request\r\n */\r\nexport interface TaskModeSpawnRequest {\r\n agentType: AgentType;\r\n taskId: string;\r\n payload: Record<string, unknown>;\r\n timeoutMs?: number;\r\n}\r\n\r\n/**\r\n * Task mode agent result\r\n */\r\nexport interface TaskModeAgentResult {\r\n agentId: string;\r\n agentType: AgentType;\r\n success: boolean;\r\n output: string;\r\n confidenceScore?: number;\r\n executionTimeMs: number;\r\n}\r\n"],"names":[],"mappings":"AAAA;;;CAGC,GAED;;CAEC,GA8JD;;CAEC,GACD,WAOC"}
|
package/docs/README.md
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
# Documentation Structure - Quick Start
|
|
2
|
+
|
|
3
|
+
**Last Updated:** November 20, 2025
|
|
4
|
+
**Structure:** 15 folders, 732 files
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Finding What You Need
|
|
9
|
+
|
|
10
|
+
### By Topic
|
|
11
|
+
|
|
12
|
+
**Architecture & System Design**
|
|
13
|
+
→ `docs/architecture/` - System patterns, agent models, database design
|
|
14
|
+
|
|
15
|
+
**Orchestration & CFN Loop**
|
|
16
|
+
→ `docs/cfn-system/` - Methodology, coordinator/orchestrator patterns
|
|
17
|
+
|
|
18
|
+
**Deployment & Operations**
|
|
19
|
+
→ `docs/operations/` - Runbooks, environment setup, configuration
|
|
20
|
+
|
|
21
|
+
**Testing & Quality**
|
|
22
|
+
→ `docs/testing/` - Test patterns, frameworks, performance benchmarks
|
|
23
|
+
→ `docs/quality-assurance/` - QA strategy, coverage targets
|
|
24
|
+
|
|
25
|
+
**Code & Implementation**
|
|
26
|
+
→ `docs/implementation/` - Execution patterns, delivery guides
|
|
27
|
+
→ `docs/guides/` - Developer tutorials, quick references
|
|
28
|
+
|
|
29
|
+
**Bug Tracking & Issues**
|
|
30
|
+
→ `docs/bugs/` - Issue database, fixes, investigations
|
|
31
|
+
|
|
32
|
+
**Security & Compliance**
|
|
33
|
+
→ `docs/security/` - Audits, compliance, threat analysis
|
|
34
|
+
|
|
35
|
+
**Reports & Analytics**
|
|
36
|
+
→ `docs/analysis-reports/` - Test coverage, metrics, dashboards
|
|
37
|
+
→ `docs/analytics/` - System intelligence, organizational insights
|
|
38
|
+
|
|
39
|
+
**Code Reviews & Feedback**
|
|
40
|
+
→ `docs/reviews/` - Review guidelines, consistency analysis
|
|
41
|
+
|
|
42
|
+
**Strategic Planning**
|
|
43
|
+
→ `docs/roadmap/` - Product roadmap, iteration planning
|
|
44
|
+
|
|
45
|
+
**Major Migrations**
|
|
46
|
+
→ `docs/migration/` - Version upgrades, deprecation notices
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## By Role
|
|
51
|
+
|
|
52
|
+
### Product Manager
|
|
53
|
+
- **Roadmap:** `docs/roadmap/`
|
|
54
|
+
- **Analytics:** `docs/analytics/`
|
|
55
|
+
- **Architecture:** `docs/architecture/`
|
|
56
|
+
|
|
57
|
+
### Developer
|
|
58
|
+
- **Setup:** `docs/guides/`
|
|
59
|
+
- **Code Patterns:** `docs/implementation/`
|
|
60
|
+
- **Testing:** `docs/testing/`
|
|
61
|
+
- **Architecture:** `docs/architecture/`
|
|
62
|
+
|
|
63
|
+
### DevOps
|
|
64
|
+
- **Deployment:** `docs/operations/`
|
|
65
|
+
- **Docker:** `docs/docker/`
|
|
66
|
+
- **Security:** `docs/security/`
|
|
67
|
+
|
|
68
|
+
### QA/Tester
|
|
69
|
+
- **Test Strategy:** `docs/quality-assurance/`
|
|
70
|
+
- **Test Patterns:** `docs/testing/`
|
|
71
|
+
- **Test Reports:** `docs/analysis-reports/`
|
|
72
|
+
- **Issues:** `docs/bugs/`
|
|
73
|
+
|
|
74
|
+
### Technical Lead
|
|
75
|
+
- **System Design:** `docs/architecture/`
|
|
76
|
+
- **Orchestration:** `docs/cfn-system/`
|
|
77
|
+
- **Security:** `docs/security/`
|
|
78
|
+
- **Operations:** `docs/operations/`
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Folder Structure (15 folders)
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
docs/
|
|
86
|
+
├── analytics/ (23 files) System analytics & intelligence
|
|
87
|
+
├── analysis-reports/ (53 files) Reports & metrics
|
|
88
|
+
├── architecture/ (134 files) System design & patterns
|
|
89
|
+
├── bugs/ (73 files) Issue tracking & fixes
|
|
90
|
+
├── cfn-system/ (36 files) Orchestration methodology
|
|
91
|
+
├── docker/ (59 files) Containers & CI/CD
|
|
92
|
+
├── guides/ (55 files) Developer guides & tutorials
|
|
93
|
+
├── implementation/ (51 files) Execution patterns
|
|
94
|
+
├── migration/ (53 files) Version upgrades
|
|
95
|
+
├── operations/ (58 files) Deployment & operations
|
|
96
|
+
├── quality-assurance/ (28 files) QA strategy & validation
|
|
97
|
+
├── reviews/ (43 files) Code reviews & feedback
|
|
98
|
+
├── roadmap/ (18 files) Strategic planning
|
|
99
|
+
├── security/ (47 files) Compliance & security
|
|
100
|
+
└── testing/ (33 files) All testing disciplines
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Consolidated from (Old Folders)
|
|
106
|
+
|
|
107
|
+
If you're looking for content that was previously in:
|
|
108
|
+
|
|
109
|
+
- **testing-performance/** → Now in `docs/testing/`
|
|
110
|
+
- **resources/** → Now in `docs/guides/`
|
|
111
|
+
- **analysis/, meta/, handoff/** → Now in `docs/reviews/`
|
|
112
|
+
- **fixes/** → Now in `docs/bugs/`
|
|
113
|
+
- **environment, environment-config/** → Now in `docs/operations/`
|
|
114
|
+
- **features, agent-spawner, database/** → Now in `docs/architecture/`
|
|
115
|
+
- **cfn-loop, reports/** → Now in `docs/analysis-reports/`
|
|
116
|
+
- **ace-system, organization/** → Now in `docs/analytics/`
|
|
117
|
+
- **iteration-reports/** → Now in `docs/roadmap/`
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Quick Search
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# Find documentation by keyword
|
|
125
|
+
grep -r "search term" docs/
|
|
126
|
+
|
|
127
|
+
# Find in specific folder
|
|
128
|
+
grep -r "term" docs/testing/
|
|
129
|
+
|
|
130
|
+
# Find markdown files only
|
|
131
|
+
grep -r "term" docs/ --include="*.md"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Key Documents
|
|
137
|
+
|
|
138
|
+
### Getting Started
|
|
139
|
+
- `docs/guides/DEVELOPER_TYPESCRIPT_MIGRATION_GUIDE.md`
|
|
140
|
+
- `docs/architecture/AGENT_OUTPUT_STANDARDS.md`
|
|
141
|
+
- `docs/NAVIGATION_GUIDE.md` (detailed navigation reference)
|
|
142
|
+
|
|
143
|
+
### Architecture
|
|
144
|
+
- `docs/architecture/` - Browse architecture decisions
|
|
145
|
+
- `docs/cfn-system/CFN_LOOP_ARCHITECTURE.md`
|
|
146
|
+
- `docs/docker/` - Container patterns
|
|
147
|
+
|
|
148
|
+
### Operations
|
|
149
|
+
- `docs/operations/` - Deployment procedures
|
|
150
|
+
- `docs/security/` - Security policies
|
|
151
|
+
- `docs/bugs/` - Issue tracking
|
|
152
|
+
|
|
153
|
+
### Quality
|
|
154
|
+
- `docs/testing/` - Test frameworks
|
|
155
|
+
- `docs/quality-assurance/` - QA strategy
|
|
156
|
+
- `docs/analysis-reports/` - Test coverage
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Recent Changes
|
|
161
|
+
|
|
162
|
+
**Consolidation Completed:** November 20, 2025
|
|
163
|
+
|
|
164
|
+
The documentation structure was consolidated from 29 folders to 15 folders:
|
|
165
|
+
- **48% folder reduction** while maintaining all 732 files
|
|
166
|
+
- **Improved navigation** with domain-based organization
|
|
167
|
+
- **Zero data loss** - all content preserved
|
|
168
|
+
|
|
169
|
+
See `CONSOLIDATION_REPORT.md` for details.
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Documentation Files
|
|
174
|
+
|
|
175
|
+
For detailed navigation and information:
|
|
176
|
+
|
|
177
|
+
- **NAVIGATION_GUIDE.md** - How to find documentation
|
|
178
|
+
- **CONSOLIDATION_PLAN.md** - Original consolidation strategy
|
|
179
|
+
- **CONSOLIDATION_REPORT.md** - Complete execution report
|
|
180
|
+
- **CONSOLIDATION_COMMANDS.md** - Technical reference
|
|
181
|
+
- **CONSOLIDATION_STATUS.md** - Final status (in root directory)
|
|
182
|
+
- **CONSOLIDATION_EXECUTION_SUMMARY.md** - Executive summary (in root directory)
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Folder Responsibilities
|
|
187
|
+
|
|
188
|
+
### Kept Intact (7 folders)
|
|
189
|
+
- architecture - System design & patterns
|
|
190
|
+
- cfn-system - Orchestration methodology
|
|
191
|
+
- docker - Container infrastructure
|
|
192
|
+
- implementation - Execution patterns
|
|
193
|
+
- migration - Version upgrades
|
|
194
|
+
- quality-assurance - QA strategy
|
|
195
|
+
- security - Compliance & security
|
|
196
|
+
|
|
197
|
+
### Expanded (6 folders)
|
|
198
|
+
- testing - All testing disciplines (added performance)
|
|
199
|
+
- guides - Developer guides (added resources)
|
|
200
|
+
- operations - Operations management (added environment)
|
|
201
|
+
- bugs - Issue tracking (added fixes)
|
|
202
|
+
- reviews - Code reviews (added analysis, meta)
|
|
203
|
+
- roadmap - Strategic planning (added iterations)
|
|
204
|
+
|
|
205
|
+
### New (2 folders)
|
|
206
|
+
- analytics - System intelligence & insights
|
|
207
|
+
- analysis-reports - Reports & metrics
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Next Steps
|
|
212
|
+
|
|
213
|
+
1. **Bookmark this README** for quick reference
|
|
214
|
+
2. **Read NAVIGATION_GUIDE.md** for detailed navigation
|
|
215
|
+
3. **Explore folders** for your area of interest
|
|
216
|
+
4. **Use grep** to search for specific topics
|
|
217
|
+
5. **Report issues** if you find broken links
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## Support
|
|
222
|
+
|
|
223
|
+
**Questions?** Check:
|
|
224
|
+
- NAVIGATION_GUIDE.md - Detailed folder descriptions
|
|
225
|
+
- CONSOLIDATION_PLAN.md - Why folders were consolidated
|
|
226
|
+
- CONSOLIDATION_REPORT.md - What changed and how
|
|
227
|
+
|
|
228
|
+
**Can't find something?**
|
|
229
|
+
```bash
|
|
230
|
+
grep -r "your search term" docs/
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
**Status:** Complete
|
|
236
|
+
**Files Preserved:** 732 (100%)
|
|
237
|
+
**Data Loss:** 0
|
|
238
|
+
**Ready for Use:** Yes
|
|
239
|
+
|
|
240
|
+
For more details, see CONSOLIDATION_STATUS.md in the root directory.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-flow-novice",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.16.1",
|
|
4
4
|
"description": "AI agent orchestration framework with namespace-isolated skills, agents, and CFN Loop validation. Safe installation with ~0.01% collision risk.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -98,8 +98,13 @@
|
|
|
98
98
|
"homepage": "https://github.com/yourusername/claude-flow-novice#readme",
|
|
99
99
|
"scripts": {
|
|
100
100
|
"dev": "tsx src/cli/index.ts",
|
|
101
|
-
"build": "npm run clean && npm run build:swc",
|
|
101
|
+
"build": "npm run clean && npm run build:swc && npm run build:orchestrator",
|
|
102
102
|
"build:swc": "swc src -d dist --config-file .swcrc --ignore '**/*.test.ts' --ignore '**/*.test.tsx' --ignore '**/*.spec.ts'",
|
|
103
|
+
"build:orchestrator": "cd .claude/skills/cfn-loop-orchestration && npm run build 2>/dev/null || echo 'Orchestrator build skipped (optional)'",
|
|
104
|
+
"build:all": "npm run build && npm run build:spawner && npm run build:selector && npm run build:coordination",
|
|
105
|
+
"build:spawner": "cd src/coordination && tsc spawn-agent.ts --outDir ../../dist/coordination --module commonjs --target es2020 --skipLibCheck 2>/dev/null || echo 'Spawner build skipped'",
|
|
106
|
+
"build:selector": "cd .claude/skills/cfn-agent-selection-with-fallback && npm run build 2>/dev/null || echo 'Selector build skipped'",
|
|
107
|
+
"build:coordination": "cd src/coordination && tsc store-task-context.ts store-success-criteria.ts --outDir ../../dist/coordination --module es2020 --target es2020 --esModuleInterop --allowSyntheticDefaultImports --skipLibCheck 2>/dev/null || echo 'Coordination build skipped'",
|
|
103
108
|
"clean": "rm -rf dist",
|
|
104
109
|
"test": "jest",
|
|
105
110
|
"test:skills": "jest skill-markdown-validator.test.ts",
|
|
@@ -125,7 +130,7 @@
|
|
|
125
130
|
"portal:status": "./scripts/portal-status.sh",
|
|
126
131
|
"test:watch": "jest --watch",
|
|
127
132
|
"test:coverage": "jest --coverage",
|
|
128
|
-
"test:integration": "jest
|
|
133
|
+
"test:integration": "jest --config=jest.integration.config.ts --maxWorkers=4",
|
|
129
134
|
"test:performance": "jest tests/performance --maxWorkers=2",
|
|
130
135
|
"test:load": "jest tests/load-testing --maxWorkers=2 --testTimeout=30000",
|
|
131
136
|
"docker:build": "docker build -f Dockerfile.production -t claude-flow-novice:production .",
|
|
@@ -146,7 +151,9 @@
|
|
|
146
151
|
"db:rollback:dry-run": "tsx scripts/migrations/rollback.ts --dry-run",
|
|
147
152
|
"db:migrations:list": "tsx scripts/migrations/list-migrations.ts",
|
|
148
153
|
"db:migrations:validate": "tsx scripts/migrations/validate.ts",
|
|
149
|
-
"db:migrations:history": "tsx scripts/migrations/history.ts"
|
|
154
|
+
"db:migrations:history": "tsx scripts/migrations/history.ts",
|
|
155
|
+
"test:integration:verbose": "jest --config=jest.integration.config.ts --maxWorkers=4 --verbose",
|
|
156
|
+
"test:integration:watch": "jest --config=jest.integration.config.ts --maxWorkers=2 --watch"
|
|
150
157
|
},
|
|
151
158
|
"dependencies": {
|
|
152
159
|
"@anthropic-ai/sdk": "^0.67.0",
|
|
@@ -165,7 +172,9 @@
|
|
|
165
172
|
"js-yaml": "^4.1.1",
|
|
166
173
|
"jsonwebtoken": "^9.0.2",
|
|
167
174
|
"lodash": "^4.17.21",
|
|
175
|
+
"prom-client": "^15.1.3",
|
|
168
176
|
"redis": "^5.8.3",
|
|
177
|
+
"shell-quote": "^1.8.3",
|
|
169
178
|
"socket.io": "^4.8.1",
|
|
170
179
|
"sqlite": "^5.1.1",
|
|
171
180
|
"sqlite3": "^5.1.7",
|
|
@@ -184,6 +193,7 @@
|
|
|
184
193
|
"@types/jest": "^30.0.0",
|
|
185
194
|
"@types/lodash": "^4.17.20",
|
|
186
195
|
"@types/pg": "^8.15.6",
|
|
196
|
+
"@types/shell-quote": "^1.7.5",
|
|
187
197
|
"@types/sqlite3": "^3.1.11",
|
|
188
198
|
"@types/uuid": "^10.0.0",
|
|
189
199
|
"@types/yaml": "^1.9.6",
|
|
@@ -197,6 +207,7 @@
|
|
|
197
207
|
"socket.io-client": "^4.8.1",
|
|
198
208
|
"supertest": "^7.1.4",
|
|
199
209
|
"ts-jest": "^29.4.5",
|
|
210
|
+
"ts-node": "^10.9.2",
|
|
200
211
|
"tsx": "^4.7.0",
|
|
201
212
|
"typescript": "^5.6.3"
|
|
202
213
|
},
|
|
@@ -7,7 +7,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
7
7
|
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
|
8
8
|
|
|
9
9
|
IMAGE_NAME="claude-flow-novice:agent"
|
|
10
|
-
DOCKERFILE="$PROJECT_ROOT/Dockerfile
|
|
10
|
+
DOCKERFILE="$PROJECT_ROOT/docker/agent/Dockerfile"
|
|
11
11
|
|
|
12
12
|
echo "🐳 Building Claude Flow Novice Agent Docker Image..."
|
|
13
13
|
echo "Project Root: $PROJECT_ROOT"
|