claude-flow-novice 2.15.2 → 2.15.4
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/skills/advanced-features/cfn-agent-swap/recommend-swap.sh +59 -59
- package/.claude/cfn-extras/skills/analytics/cfn-improvement-recommender/recommend-improvements.sh +91 -91
- package/.claude/cfn-extras/skills/analytics/cfn-pattern-extraction/extract-patterns.sh +79 -79
- package/.claude/cfn-extras/skills/analytics/cfn-retrospective-report/generate-report.sh +100 -100
- package/.claude/cfn-extras/skills/analytics/cfn-telemetry/start-telemetry.sh +110 -110
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/add-bullet.sh +145 -145
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/log-merge.sh +67 -67
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/monitor-injection-performance.sh +137 -137
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/optimize-injection-pipeline.sh +168 -168
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/query-reflections.sh +35 -35
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/store-reflection.sh +45 -45
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/track-ab-test.sh +41 -41
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/update-reflection.sh +41 -41
- package/.claude/cfn-extras/skills/deprecated/cfn-cli-setup/validate-cli-environment.sh +191 -191
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/create-campaign.sh +231 -231
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/get-campaign-performance.sh +190 -190
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/pause-campaign.sh +142 -142
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/set-budget.sh +181 -181
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/update-bid-strategy.sh +133 -133
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/get-conversation-history.sh +121 -121
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/qualify-lead.sh +156 -156
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/schedule-demo.sh +181 -181
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/send-message.sh +137 -137
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/transfer-to-human.sh +179 -179
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/create-campaign.sh +183 -183
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/get-delivery-status.sh +139 -139
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/opt-out.sh +150 -150
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/schedule-campaign.sh +187 -187
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/send-sms.sh +181 -181
- package/.claude/cfn-extras/skills/ui-portal/cfn-web-portal/test-web-portal-skill.sh +50 -50
- package/.claude/cfn-extras/skills/ui-portal/cfn-web-portal/validate-deployment.sh +84 -84
- package/.claude/cfn-extras/skills/utility/cfn-environment-sanitization/sanitize-environment.sh +243 -243
- package/.claude/commands/cfn-loop-cli.md +16 -2
- package/.claude/commands/switch-api.md +31 -10
- package/.claude/hooks/cfn-BACKUP_USAGE.md +243 -243
- package/.claude/hooks/cfn-invoke-security-validation.sh +69 -69
- package/.claude/hooks/cfn-lint-sql-injection.sh +61 -0
- package/.claude/hooks/cfn-post-edit-cfn-retrospective.sh +109 -78
- package/.claude/hooks/cfn-post-edit.config.json +44 -44
- package/.claude/hooks/cfn-pre-edit-security-warning.sh +40 -0
- package/.claude/skills/cfn-agent-spawning/spawn-agent.sh +22 -24
- package/.claude/skills/cfn-docker-agent-spawning/SKILL.md +28 -4
- package/.claude/skills/cfn-docker-agent-spawning/spawn-agent.sh +3 -1
- package/.claude/skills/cfn-docker-loop-orchestration/orchestrate.sh +224 -20
- package/.claude/skills/cfn-hybrid-routing/check-dependencies.sh +51 -51
- package/.claude/skills/cfn-loop-orchestration/helpers/gate-check.sh +550 -46
- package/.claude/skills/cfn-loop-orchestration/helpers/parse-test-results.sh +277 -0
- package/.claude/skills/cfn-loop-orchestration/orchestrate.sh +184 -23
- package/.claude/skills/cfn-loop-orchestration/security_utils.sh +24 -0
- package/.claude/skills/cfn-loop-orchestration/test-iteration-context-injection.sh +366 -0
- package/.claude/skills/cfn-loop-validation/orchestrate-cfn-loop.sh +252 -252
- package/.claude/skills/cfn-redis-coordination/CENTRALIZED_REDIS_WRAPPER.md +319 -0
- package/.claude/skills/cfn-redis-coordination/agent-log.sh +4 -0
- package/.claude/skills/cfn-redis-coordination/agent-log.sh.bak +124 -0
- package/.claude/skills/cfn-redis-coordination/agent-recovery.sh +74 -74
- package/.claude/skills/cfn-redis-coordination/collect-confidence-scores.sh +30 -0
- package/.claude/skills/cfn-redis-coordination/get-context.sh +145 -112
- package/.claude/skills/cfn-redis-coordination/get-success-criteria.sh +54 -0
- package/.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh +3 -0
- package/.claude/skills/cfn-redis-coordination/redis-cli-wrapper.sh +24 -3
- package/.claude/skills/cfn-redis-coordination/redis-functions.sh +33 -0
- package/.claude/skills/cfn-redis-coordination/report-completion.sh +24 -31
- package/.claude/skills/cfn-redis-coordination/store-context.sh +4 -0
- package/.claude/skills/cfn-redis-coordination/store-success-criteria.sh +85 -0
- package/.claude/skills/cfn-redis-coordination/update-all-scripts.sh +67 -0
- package/.claude/skills/cfn-sqlite-memory/ttl-cleanup.sh +17 -25
- package/.claude/skills/cfn-transparency-middleware/middleware-config.sh +28 -28
- package/.claude/skills/cfn-transparency-middleware/performance-benchmark.sh +78 -78
- package/.claude/skills/cfn-transparency-middleware/test-e2e.sh +15 -0
- package/.claude/skills/cfn-transparency-middleware/test-integration.sh +161 -161
- package/.claude/skills/cfn-transparency-middleware/test-transparency-skill.sh +367 -367
- package/.claude/skills/cfn-transparency-middleware/tests/input-validation.sh +107 -92
- package/.claude/skills/cfn-transparency-middleware/wrap-agent.sh +131 -131
- package/README.md +116 -475
- package/claude-assets/agents/cfn-dev-team/README.md +103 -0
- package/claude-assets/agents/cfn-dev-team/architecture/goal-planner.md +1 -1
- package/claude-assets/agents/cfn-dev-team/coordinators/cfn-frontend-coordinator.md +77 -15
- package/claude-assets/agents/cfn-dev-team/coordinators/cfn-v3-coordinator.md +355 -6
- package/claude-assets/agents/cfn-dev-team/coordinators/consensus-builder.md +82 -1
- package/claude-assets/agents/cfn-dev-team/coordinators/handoff-coordinator.md +82 -1
- package/claude-assets/agents/cfn-dev-team/coordinators/multi-sprint-coordinator.md +77 -15
- package/claude-assets/agents/cfn-dev-team/dev-ops/docker-specialist.md +99 -12
- package/claude-assets/agents/cfn-dev-team/dev-ops/github-commit-agent.md +1 -1
- package/claude-assets/agents/cfn-dev-team/dev-ops/kubernetes-specialist.md +97 -0
- package/claude-assets/agents/cfn-dev-team/dev-ops/monitoring-specialist.md +20 -1
- package/claude-assets/agents/cfn-dev-team/developers/api-gateway-specialist.md +97 -0
- package/claude-assets/agents/cfn-dev-team/developers/backend-developer.md +110 -13
- package/claude-assets/agents/cfn-dev-team/developers/data/data-engineer.md +106 -15
- package/claude-assets/agents/cfn-dev-team/developers/database/database-architect.md +115 -11
- package/claude-assets/agents/cfn-dev-team/developers/frontend/mobile-dev.md +94 -7
- package/claude-assets/agents/cfn-dev-team/developers/frontend/react-frontend-engineer.md +87 -9
- package/claude-assets/agents/cfn-dev-team/developers/frontend/typescript-specialist.md +85 -7
- package/claude-assets/agents/cfn-dev-team/developers/frontend/ui-designer.md +160 -28
- package/claude-assets/agents/cfn-dev-team/developers/graphql-specialist.md +101 -19
- package/claude-assets/agents/cfn-dev-team/developers/rust-developer.md +108 -14
- package/claude-assets/agents/cfn-dev-team/reviewers/{reviewer.md → code-reviewer.md} +95 -8
- package/claude-assets/agents/cfn-dev-team/reviewers/quality/code-quality-validator.md +107 -7
- package/claude-assets/agents/cfn-dev-team/reviewers/quality/perf-analyzer.md +98 -7
- package/claude-assets/agents/cfn-dev-team/reviewers/quality/performance-benchmarker.md +95 -7
- package/claude-assets/agents/cfn-dev-team/reviewers/quality/security-specialist.md +136 -9
- package/claude-assets/agents/cfn-dev-team/testers/api-testing-specialist.md +108 -1
- package/claude-assets/agents/cfn-dev-team/testers/chaos-engineering-specialist.md +107 -13
- package/claude-assets/agents/cfn-dev-team/testers/contract-tester.md +737 -0
- 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 +828 -0
- package/claude-assets/agents/cfn-dev-team/testers/interaction-tester.md +106 -7
- package/claude-assets/agents/cfn-dev-team/testers/load-testing-specialist.md +77 -0
- package/claude-assets/agents/cfn-dev-team/testers/mutation-testing-specialist.md +684 -0
- package/claude-assets/agents/cfn-dev-team/testers/playwright-tester.md +110 -1
- package/claude-assets/agents/cfn-dev-team/testers/tester.md +94 -7
- package/claude-assets/agents/cfn-dev-team/utility/code-booster.md +1 -3
- package/claude-assets/agents/cfn-dev-team/utility/epic-creator.md +87 -13
- package/claude-assets/agents/cfn-dev-team/utility/memory-leak-specialist.md +103 -7
- package/claude-assets/agents/cfn-dev-team/utility/researcher.md +1 -3
- package/claude-assets/agents/cfn-dev-team/utility/z-ai-specialist.md +94 -7
- package/claude-assets/agents/docker-coordinators/cfn-docker-v3-coordinator.md +46 -0
- package/claude-assets/agents/project-only-agents/npm-package-specialist.md +1 -1
- package/claude-assets/cfn-extras/skills/advanced-features/cfn-agent-swap/recommend-swap.sh +59 -59
- package/claude-assets/cfn-extras/skills/analytics/cfn-improvement-recommender/recommend-improvements.sh +91 -91
- package/claude-assets/cfn-extras/skills/analytics/cfn-pattern-extraction/extract-patterns.sh +79 -79
- package/claude-assets/cfn-extras/skills/analytics/cfn-retrospective-report/generate-report.sh +100 -100
- package/claude-assets/cfn-extras/skills/analytics/cfn-telemetry/start-telemetry.sh +110 -110
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/add-bullet.sh +145 -145
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/log-merge.sh +67 -67
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/monitor-injection-performance.sh +137 -137
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/optimize-injection-pipeline.sh +168 -168
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/query-reflections.sh +35 -35
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/store-reflection.sh +45 -45
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/track-ab-test.sh +41 -41
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/update-reflection.sh +41 -41
- package/claude-assets/cfn-extras/skills/deprecated/cfn-cli-setup/validate-cli-environment.sh +191 -191
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/create-campaign.sh +231 -231
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/get-campaign-performance.sh +190 -190
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/pause-campaign.sh +142 -142
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/set-budget.sh +181 -181
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/update-bid-strategy.sh +133 -133
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/get-conversation-history.sh +121 -121
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/qualify-lead.sh +156 -156
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/schedule-demo.sh +181 -181
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/send-message.sh +137 -137
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/transfer-to-human.sh +179 -179
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/create-campaign.sh +183 -183
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/get-delivery-status.sh +139 -139
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/opt-out.sh +150 -150
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/schedule-campaign.sh +187 -187
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/send-sms.sh +181 -181
- package/claude-assets/cfn-extras/skills/ui-portal/cfn-web-portal/test-web-portal-skill.sh +50 -50
- package/claude-assets/cfn-extras/skills/ui-portal/cfn-web-portal/validate-deployment.sh +84 -84
- package/claude-assets/cfn-extras/skills/utility/cfn-environment-sanitization/sanitize-environment.sh +243 -243
- package/claude-assets/commands/cfn-loop-cli.md +16 -2
- package/claude-assets/commands/switch-api.md +31 -10
- package/claude-assets/hooks/cfn-BACKUP_USAGE.md +243 -243
- package/claude-assets/hooks/cfn-invoke-security-validation.sh +69 -69
- package/claude-assets/hooks/cfn-lint-sql-injection.sh +61 -0
- package/claude-assets/hooks/cfn-post-edit-cfn-retrospective.sh +109 -78
- package/claude-assets/hooks/cfn-post-edit.config.json +44 -44
- package/claude-assets/hooks/cfn-post-execution/memory-cleanup.sh +19 -19
- package/claude-assets/hooks/cfn-pre-edit-security-warning.sh +40 -0
- package/claude-assets/hooks/cfn-pre-execution/memory-check.sh +19 -19
- package/claude-assets/hooks/detect-hardcoded-credentials.sh +212 -0
- package/claude-assets/skills/SKILL_TEMPLATE.md +774 -0
- package/claude-assets/skills/agent-lifecycle/execute-lifecycle-hook.sh +543 -572
- package/claude-assets/skills/agent-lifecycle/simple-audit.sh +57 -30
- package/claude-assets/skills/agent-template-generator/SKILL.md +440 -0
- package/claude-assets/skills/agent-template-generator/generate-agent.sh +405 -0
- package/claude-assets/skills/agent-validation-linter/SKILL.md +589 -0
- package/claude-assets/skills/agent-validation-linter/lint-agents.sh +271 -0
- package/claude-assets/skills/bootstrap/bash-fundamentals.md +786 -0
- package/claude-assets/skills/bootstrap/database-connection.md +464 -0
- package/claude-assets/skills/bootstrap/error-handling.md +580 -0
- package/claude-assets/skills/bootstrap/file-operations.md +699 -0
- package/claude-assets/skills/bootstrap/skill-loader.md +616 -0
- package/claude-assets/skills/bootstrap/sqlite-params.sh +287 -0
- package/claude-assets/skills/cfn-agent-spawning/spawn-agent.sh +22 -24
- package/claude-assets/skills/cfn-automatic-memory-persistence/persist-agent-output.sh +48 -48
- package/claude-assets/skills/cfn-automatic-memory-persistence/query-agent-history.sh +34 -34
- package/claude-assets/skills/cfn-automatic-memory-persistence/test-memory-persistence.sh +17 -16
- package/claude-assets/skills/cfn-deliverable-validation/confidence-calculator.sh +261 -261
- package/claude-assets/skills/cfn-deployment/SKILL.md +293 -0
- package/claude-assets/skills/cfn-deployment/execute.sh +21 -0
- package/claude-assets/skills/cfn-docker-agent-spawning/SKILL.md +28 -4
- package/claude-assets/skills/cfn-docker-agent-spawning/spawn-agent.sh +3 -1
- package/claude-assets/skills/cfn-docker-loop-orchestration/orchestrate.sh +224 -20
- package/claude-assets/skills/cfn-environment-sanitization/sanitize-environment.sh +38 -0
- package/claude-assets/skills/cfn-error-batching-strategy/lib/core-functions.sh +47 -47
- package/claude-assets/skills/cfn-expert-update/update-expert.sh +345 -345
- package/claude-assets/skills/cfn-file-operations/SKILL.md +290 -0
- package/claude-assets/skills/cfn-file-operations/execute.sh +129 -0
- package/claude-assets/skills/cfn-file-operations/lib/atomic-write.sh +294 -0
- package/claude-assets/skills/cfn-file-operations/lib/lock.sh +361 -0
- package/claude-assets/skills/cfn-file-operations/test.sh +369 -0
- package/claude-assets/skills/cfn-hybrid-routing/check-dependencies.sh +51 -51
- package/claude-assets/skills/cfn-intervention-detector/detect-intervention.sh +110 -110
- package/claude-assets/skills/cfn-intervention-orchestrator/execute-intervention.sh +58 -58
- package/claude-assets/skills/cfn-log-operations/SKILL.md +308 -0
- package/claude-assets/skills/cfn-log-operations/execute.sh +420 -0
- package/claude-assets/skills/cfn-log-operations/lib/rotate.sh +406 -0
- package/claude-assets/skills/cfn-log-operations/lib/search.sh +448 -0
- package/claude-assets/skills/cfn-log-operations/test.sh +394 -0
- package/claude-assets/skills/cfn-loop-orchestration/helpers/gate-check.sh +550 -46
- package/claude-assets/skills/cfn-loop-orchestration/helpers/parse-test-results.sh +277 -0
- package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh +184 -23
- package/claude-assets/skills/cfn-loop-orchestration/security_utils.sh +24 -0
- package/claude-assets/skills/cfn-loop-orchestration/test-iteration-context-injection.sh +366 -0
- package/claude-assets/skills/cfn-loop-validation/orchestrate-cfn-loop.sh +252 -252
- package/claude-assets/skills/cfn-loop2-output-processing/process-validator-output.sh +275 -275
- package/claude-assets/skills/cfn-memory-management/check-memory.sh +159 -159
- package/claude-assets/skills/cfn-memory-management/cleanup-memory.sh +196 -196
- package/claude-assets/skills/cfn-node-heap-sizer/task-mode-heap-limiter.sh +325 -325
- package/claude-assets/skills/cfn-parameterized-queries/SKILL.md +339 -0
- package/claude-assets/skills/cfn-playbook/query-playbook.sh +19 -15
- package/claude-assets/skills/cfn-playbook/update-playbook.sh +25 -14
- package/claude-assets/skills/cfn-playbook-auto-update/auto-update-playbook.sh +85 -85
- package/claude-assets/skills/cfn-process-instrumentation/instrument-process.sh +44 -0
- package/claude-assets/skills/cfn-promotion/SKILL.md +305 -0
- package/claude-assets/skills/cfn-redis-coordination/CENTRALIZED_REDIS_WRAPPER.md +319 -0
- package/claude-assets/skills/cfn-redis-coordination/agent-log.sh +4 -0
- package/claude-assets/skills/cfn-redis-coordination/agent-log.sh.bak +124 -0
- package/claude-assets/skills/cfn-redis-coordination/agent-recovery.sh +74 -74
- package/claude-assets/skills/cfn-redis-coordination/collect-confidence-scores.sh +30 -0
- package/claude-assets/skills/cfn-redis-coordination/get-context.sh +145 -112
- package/claude-assets/skills/cfn-redis-coordination/get-success-criteria.sh +54 -0
- package/claude-assets/skills/cfn-redis-coordination/invoke-waiting-mode.sh +3 -0
- package/claude-assets/skills/cfn-redis-coordination/redis-cli-wrapper.sh +24 -3
- package/claude-assets/skills/cfn-redis-coordination/redis-functions.sh +33 -0
- package/claude-assets/skills/cfn-redis-coordination/report-completion.sh +24 -31
- package/claude-assets/skills/cfn-redis-coordination/store-context.sh +4 -0
- package/claude-assets/skills/cfn-redis-coordination/store-success-criteria.sh +85 -0
- package/claude-assets/skills/cfn-redis-coordination/update-all-scripts.sh +67 -0
- package/claude-assets/skills/cfn-scope-simplifier/simplify-scope.sh +67 -67
- package/claude-assets/skills/cfn-skill-loader/SKILL.md +466 -0
- package/claude-assets/skills/cfn-skill-loader/execute.sh +344 -0
- package/claude-assets/skills/cfn-specialist-injection/recommend-specialist.sh +56 -56
- package/claude-assets/skills/cfn-sqlite-memory/ttl-cleanup.sh +17 -25
- package/claude-assets/skills/cfn-standardized-error-handling/capture-agent-error.sh +86 -86
- package/claude-assets/skills/cfn-standardized-error-handling/test-error-handling.sh +165 -165
- package/claude-assets/skills/cfn-task-audit/get-audit-data.sh +42 -21
- package/claude-assets/skills/cfn-task-audit/store-task-audit.sh +17 -10
- package/claude-assets/skills/cfn-task-config-init/initialize-config.sh +264 -264
- package/claude-assets/skills/cfn-task-decomposition/task-decomposer.sh +278 -278
- package/claude-assets/skills/cfn-test-runner/detect-regressions.sh +17 -14
- package/claude-assets/skills/cfn-test-runner/detect-regressions.sh.backup-1763392821 +55 -0
- package/claude-assets/skills/cfn-test-runner/store-benchmarks.sh +17 -19
- package/claude-assets/skills/cfn-transparency-middleware/middleware-config.sh +28 -28
- package/claude-assets/skills/cfn-transparency-middleware/performance-benchmark.sh +78 -78
- package/claude-assets/skills/cfn-transparency-middleware/test-e2e.sh +15 -0
- package/claude-assets/skills/cfn-transparency-middleware/test-integration.sh +161 -161
- package/claude-assets/skills/cfn-transparency-middleware/test-transparency-skill.sh +367 -367
- package/claude-assets/skills/cfn-transparency-middleware/tests/input-validation.sh +107 -92
- package/claude-assets/skills/cfn-transparency-middleware/wrap-agent.sh +131 -131
- package/claude-assets/skills/cfn-utilities/SKILL.md +237 -0
- package/claude-assets/skills/cfn-utilities/execute.sh +32 -0
- package/claude-assets/skills/cfn-utilities/lib/errors.sh +56 -0
- package/claude-assets/skills/cfn-utilities/lib/file-ops.sh +164 -0
- package/claude-assets/skills/cfn-utilities/lib/logging.sh +77 -0
- package/claude-assets/skills/cfn-utilities/lib/retry.sh +127 -0
- package/claude-assets/skills/cfn-utilities/test.sh +317 -0
- package/claude-assets/skills/docker-build/SKILL.md +96 -203
- package/claude-assets/skills/docker-build/build.sh +73 -73
- package/claude-assets/skills/integration/agent-handoff.sh +492 -0
- package/claude-assets/skills/integration/file-operations.sh +414 -0
- package/claude-assets/skills/json-validation/SKILL.md +431 -0
- package/claude-assets/skills/json-validation/test-validate-success-criteria.sh +421 -0
- package/claude-assets/skills/json-validation/validate-success-criteria.sh +197 -0
- package/claude-assets/skills/redis-coordination/validate-parameters.sh +34 -0
- package/claude-assets/skills/workflow-codification/APPROVAL_WORKFLOW.md +806 -0
- package/claude-assets/skills/workflow-codification/COST_TRACKING.md +637 -0
- package/claude-assets/skills/workflow-codification/DEPLOY_QUICK_REFERENCE.md +106 -0
- package/claude-assets/skills/workflow-codification/EDGE_CASE_TRACKING.md +404 -0
- package/claude-assets/skills/workflow-codification/PROPAGATE_UPDATE_QUICK_REFERENCE.md +366 -0
- package/claude-assets/skills/workflow-codification/README_PHASE4.md +457 -0
- package/claude-assets/skills/workflow-codification/SKILL.md +110 -0
- package/claude-assets/skills/workflow-codification/analyze-patterns.sh +899 -0
- package/claude-assets/skills/workflow-codification/approval-workflow.sh +514 -0
- package/claude-assets/skills/workflow-codification/deploy-approved-skill.sh +481 -0
- package/claude-assets/skills/workflow-codification/deploy-approved-skill.sh.backup-1763392820 +512 -0
- package/claude-assets/skills/workflow-codification/generate-skill-update.sh +525 -0
- package/claude-assets/skills/workflow-codification/lib/security-utils.sh +204 -0
- package/claude-assets/skills/workflow-codification/propagate-skill-update.sh +648 -0
- package/claude-assets/skills/workflow-codification/propagate-skill-update.sh.backup-1763392820 +664 -0
- package/claude-assets/skills/workflow-codification/review-skill.sh +643 -0
- package/claude-assets/skills/workflow-codification/templates/email-notification.txt +114 -0
- package/claude-assets/skills/workflow-codification/templates/slack-notification.md +85 -0
- package/claude-assets/skills/workflow-codification/test-integration.sh +296 -0
- package/claude-assets/skills/workflow-codification/test-metadata-update.sh +350 -0
- package/claude-assets/skills/workflow-codification/track-cost-savings.sh +486 -0
- package/claude-assets/skills/workflow-codification/track-cost-savings.sh.backup-1763392821 +445 -0
- package/claude-assets/skills/workflow-codification/track-edge-case.sh +290 -0
- package/claude-assets/skills/workflow-codification/workflow-codification.db +0 -0
- package/dist/ace/ace-curator.js +10 -2
- package/dist/ace/ace-curator.js.map +1 -1
- package/dist/ace/ace-generator.js +4 -0
- package/dist/ace/ace-generator.js.map +1 -1
- package/dist/ace/ace-reflector.js +1 -1
- package/dist/ace/ace-reflector.js.map +1 -1
- package/dist/ace/context-injection.js +24 -2
- package/dist/ace/context-injection.js.map +1 -1
- package/dist/agents/agent-loader.js +146 -165
- package/dist/agents/agent-loader.js.map +1 -1
- package/dist/agents/task-agent-integration.js +1 -1
- package/dist/agents/task-agent-integration.js.map +1 -1
- package/dist/api/health-endpoints.js +390 -0
- package/dist/api/health-endpoints.js.map +1 -0
- package/dist/cli/agent-executor.js +4 -1
- package/dist/cli/agent-executor.js.map +1 -1
- package/dist/cli/agent-prompt-builder.js +89 -1
- package/dist/cli/agent-prompt-builder.js.map +1 -1
- package/dist/cli/agent-spawn.js +130 -37
- package/dist/cli/agent-spawn.js.map +1 -1
- package/dist/cli/config-manager.js +91 -109
- package/dist/cli/config-manager.js.map +1 -1
- package/dist/cli/skill-cache-validator.js +412 -0
- package/dist/cli/skill-cache-validator.js.map +1 -0
- package/dist/cli/skill-cli.js +991 -0
- package/dist/cli/skill-cli.js.map +1 -0
- package/dist/cli/skill-execution-logger.js +284 -0
- package/dist/cli/skill-execution-logger.js.map +1 -0
- package/dist/cli/skill-loader.js +457 -0
- package/dist/cli/skill-loader.js.map +1 -0
- package/dist/coordination/event-bus.js +2 -2
- package/dist/coordination/event-bus.js.map +1 -1
- package/dist/coordination/fleet-manager.js +1 -1
- package/dist/coordination/fleet-manager.js.map +1 -1
- package/dist/coordination/index.js +23 -9
- package/dist/coordination/index.js.map +1 -1
- package/dist/coordination/types/fleet-manager.types.js.map +1 -1
- package/dist/db/migration-manager.js +483 -0
- package/dist/db/migration-manager.js.map +1 -0
- package/dist/db/skills-query.js +535 -0
- package/dist/db/skills-query.js.map +1 -0
- package/dist/integration/DatabaseHandoff.js +507 -0
- package/dist/integration/DatabaseHandoff.js.map +1 -0
- package/dist/integration/StandardAdapter.js +291 -0
- package/dist/integration/StandardAdapter.js.map +1 -0
- package/dist/jobs/edge-case-analyzer.js +367 -0
- package/dist/jobs/edge-case-analyzer.js.map +1 -0
- package/dist/jobs/promotion-sla-enforcer.js +288 -0
- package/dist/jobs/promotion-sla-enforcer.js.map +1 -0
- package/dist/lib/agent-output-parser.js +518 -0
- package/dist/lib/agent-output-parser.js.map +1 -0
- package/dist/lib/agent-output-validator.js +950 -0
- package/dist/lib/agent-output-validator.js.map +1 -0
- package/dist/lib/agent-workspace.js +281 -0
- package/dist/lib/agent-workspace.js.map +1 -0
- package/dist/lib/artifact-registry.js +443 -0
- package/dist/lib/artifact-registry.js.map +1 -0
- package/dist/lib/atomic-file-writer.js +377 -0
- package/dist/lib/atomic-file-writer.js.map +1 -0
- package/dist/lib/backup-manager.js +779 -0
- package/dist/lib/backup-manager.js.map +1 -0
- package/dist/lib/checkpoint-manager.js +837 -0
- package/dist/lib/checkpoint-manager.js.map +1 -0
- package/dist/lib/circuit-breaker.js +340 -0
- package/dist/lib/circuit-breaker.js.map +1 -0
- package/dist/lib/completion-signal-handler.js +243 -0
- package/dist/lib/completion-signal-handler.js.map +1 -0
- package/dist/lib/config-manager.js +312 -0
- package/dist/lib/config-manager.js.map +1 -0
- package/dist/lib/config-migrator.js +386 -0
- package/dist/lib/config-migrator.js.map +1 -0
- package/dist/lib/config-validator.js +687 -0
- package/dist/lib/config-validator.js.map +1 -0
- package/dist/lib/correlation-cache.js +311 -0
- package/dist/lib/correlation-cache.js.map +1 -0
- package/dist/lib/correlation.js +263 -0
- package/dist/lib/correlation.js.map +1 -0
- package/dist/lib/database-service/connection-pool-manager.js +520 -0
- package/dist/lib/database-service/connection-pool-manager.js.map +1 -0
- package/dist/lib/database-service/correlation.js +329 -0
- package/dist/lib/database-service/correlation.js.map +1 -0
- package/dist/lib/database-service/errors.js +120 -0
- package/dist/lib/database-service/errors.js.map +1 -0
- package/dist/lib/database-service/index.js +168 -0
- package/dist/lib/database-service/index.js.map +1 -0
- package/dist/lib/database-service/postgres-adapter.js +526 -0
- package/dist/lib/database-service/postgres-adapter.js.map +1 -0
- package/dist/lib/database-service/redis-adapter.js +360 -0
- package/dist/lib/database-service/redis-adapter.js.map +1 -0
- package/dist/lib/database-service/sqlite-adapter.js +544 -0
- package/dist/lib/database-service/sqlite-adapter.js.map +1 -0
- package/dist/lib/database-service/transaction-manager.js +773 -0
- package/dist/lib/database-service/transaction-manager.js.map +1 -0
- package/dist/lib/database-service/types.js +23 -0
- package/dist/lib/database-service/types.js.map +1 -0
- package/dist/lib/deadlock-resolver.js +292 -0
- package/dist/lib/deadlock-resolver.js.map +1 -0
- package/dist/lib/distributed-lock.js +451 -0
- package/dist/lib/distributed-lock.js.map +1 -0
- package/dist/lib/edge-case-deduplicator.js +227 -0
- package/dist/lib/edge-case-deduplicator.js.map +1 -0
- package/dist/lib/encryption-manager.js +322 -0
- package/dist/lib/encryption-manager.js.map +1 -0
- package/dist/lib/error-aggregator.js +234 -0
- package/dist/lib/error-aggregator.js.map +1 -0
- package/dist/lib/errors.js +287 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/file-lock-manager.js +578 -0
- package/dist/lib/file-lock-manager.js.map +1 -0
- package/dist/lib/file-operations.js +367 -0
- package/dist/lib/file-operations.js.map +1 -0
- package/dist/lib/idempotent-write.js +237 -0
- package/dist/lib/idempotent-write.js.map +1 -0
- package/dist/lib/integration-schema-validator.js +522 -0
- package/dist/lib/integration-schema-validator.js.map +1 -0
- package/dist/lib/lock-health-monitor.js +298 -0
- package/dist/lib/lock-health-monitor.js.map +1 -0
- package/dist/lib/log-shipper.js +422 -0
- package/dist/lib/log-shipper.js.map +1 -0
- package/dist/lib/logging.js +146 -0
- package/dist/lib/logging.js.map +1 -0
- package/dist/lib/message-deduplicator.js +439 -0
- package/dist/lib/message-deduplicator.js.map +1 -0
- package/dist/lib/multi-system-query.js +604 -0
- package/dist/lib/multi-system-query.js.map +1 -0
- package/dist/lib/orphan-detector.js +332 -0
- package/dist/lib/orphan-detector.js.map +1 -0
- package/dist/lib/password-generator.js +166 -0
- package/dist/lib/password-generator.js.map +1 -0
- package/dist/lib/path-validator.js +429 -0
- package/dist/lib/path-validator.js.map +1 -0
- package/dist/lib/query-translator.js +905 -0
- package/dist/lib/query-translator.js.map +1 -0
- package/dist/lib/queue-recovery.js +469 -0
- package/dist/lib/queue-recovery.js.map +1 -0
- package/dist/lib/redis-queue-manager.js +512 -0
- package/dist/lib/redis-queue-manager.js.map +1 -0
- package/dist/lib/reflection-archiver.js +272 -0
- package/dist/lib/reflection-archiver.js.map +1 -0
- package/dist/lib/retry-manager.js +453 -0
- package/dist/lib/retry-manager.js.map +1 -0
- package/dist/lib/retry.js +262 -0
- package/dist/lib/retry.js.map +1 -0
- package/dist/lib/schema-transform.js +695 -0
- package/dist/lib/schema-transform.js.map +1 -0
- package/dist/lib/schema-validator.js +491 -0
- package/dist/lib/schema-validator.js.map +1 -0
- package/dist/lib/skill-cache.js +297 -0
- package/dist/lib/skill-cache.js.map +1 -0
- package/dist/lib/skill-content-manager.js +337 -0
- package/dist/lib/skill-content-manager.js.map +1 -0
- package/dist/lib/skill-frontmatter-parser.js +237 -0
- package/dist/lib/skill-frontmatter-parser.js.map +1 -0
- package/dist/lib/skill-git-integration.js +275 -0
- package/dist/lib/skill-git-integration.js.map +1 -0
- package/dist/lib/skill-markdown-validator.js +396 -0
- package/dist/lib/skill-markdown-validator.js.map +1 -0
- package/dist/lib/skill-output-parser.js +312 -0
- package/dist/lib/skill-output-parser.js.map +1 -0
- package/dist/lib/unified-query-api.js +467 -0
- package/dist/lib/unified-query-api.js.map +1 -0
- package/dist/middleware/auth-middleware.js +350 -0
- package/dist/middleware/auth-middleware.js.map +1 -0
- package/dist/middleware/schema-validation.js +347 -0
- package/dist/middleware/schema-validation.js.map +1 -0
- package/dist/providers/anthropic-provider.js +1 -1
- package/dist/providers/anthropic-provider.js.map +1 -1
- package/dist/providers/provider-factory.js +2 -2
- package/dist/providers/provider-factory.js.map +1 -1
- package/dist/services/edge-case-analyzer.js +321 -0
- package/dist/services/edge-case-analyzer.js.map +1 -0
- package/dist/services/edge-case-deduplicator.js +266 -0
- package/dist/services/edge-case-deduplicator.js.map +1 -0
- package/dist/services/edge-case-detector.js +337 -0
- package/dist/services/edge-case-detector.js.map +1 -0
- package/dist/services/edge-case-tracker.js +547 -0
- package/dist/services/edge-case-tracker.js.map +1 -0
- package/dist/services/health-check-system.js +586 -0
- package/dist/services/health-check-system.js.map +1 -0
- package/dist/services/metrics-logger.js +412 -0
- package/dist/services/metrics-logger.js.map +1 -0
- package/dist/services/patch-generator.js +378 -0
- package/dist/services/patch-generator.js.map +1 -0
- package/dist/services/patch-validator.js +337 -0
- package/dist/services/patch-validator.js.map +1 -0
- package/dist/services/performance-monitor.js +811 -0
- package/dist/services/performance-monitor.js.map +1 -0
- package/dist/services/promotion-pipeline.js +918 -0
- package/dist/services/promotion-pipeline.js.map +1 -0
- package/dist/services/promotion-validator.js +394 -0
- package/dist/services/promotion-validator.js.map +1 -0
- package/dist/services/reflection-logger.js +388 -0
- package/dist/services/reflection-logger.js.map +1 -0
- package/dist/services/skill-deployment.js +472 -0
- package/dist/services/skill-deployment.js.map +1 -0
- package/dist/services/skill-loader.js +427 -0
- package/dist/services/skill-loader.js.map +1 -0
- package/dist/services/skill-promotion.js +372 -0
- package/dist/services/skill-promotion.js.map +1 -0
- package/dist/services/skill-validator.js +454 -0
- package/dist/services/skill-validator.js.map +1 -0
- package/dist/services/skill-versioning.js +244 -0
- package/dist/services/skill-versioning.js.map +1 -0
- package/dist/services/workspace-supervisor.js +597 -0
- package/dist/services/workspace-supervisor.js.map +1 -0
- package/dist/types/agent-output.js +44 -0
- package/dist/types/agent-output.js.map +1 -0
- package/dist/types/config.js +28 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/edge-case.js +45 -0
- package/dist/types/edge-case.js.map +1 -0
- package/package.json +201 -176
- package/readme/README.md +19 -4
- package/scripts/artifact-cleanup.sh +392 -0
- package/scripts/backup-cleanup.sh +627 -0
- package/scripts/cleanup-workspaces.sh +412 -0
- package/scripts/cleanup-yaml-configs.sh +141 -0
- package/scripts/deploy-approved-skills.sh +263 -0
- package/scripts/deploy-production.sh +355 -355
- package/scripts/docker-playwright-fix.sh +311 -311
- package/scripts/docker-rebuild-all-agents.sh +127 -127
- package/scripts/health-check.sh +447 -0
- package/scripts/log-aggregator.sh +554 -0
- package/scripts/log-monitor.sh +629 -0
- package/scripts/manage-agent-workspaces.sh +434 -0
- package/scripts/memory-leak-prevention.sh +305 -305
- package/scripts/migrate-artifacts.sh +563 -0
- package/scripts/migrate-schema.sh +533 -0
- package/scripts/migrate-yaml-to-json.sh +465 -0
- package/scripts/promote-staged-skills.sh +423 -0
- package/scripts/run-marketing-tests.sh +42 -42
- package/scripts/update_paths.sh +46 -46
- package/scripts/verify-no-secrets.sh +88 -35
- package/.claude/cfn-extras/agents/deprecated-coordinators/adaptive-coordinator.md.backup +0 -161
- package/.claude/cfn-extras/agents/deprecated-coordinators/blocking-coordinator-example.md.backup +0 -728
- package/.claude/cfn-extras/agents/deprecated-coordinators/mesh-coordinator.md.backup +0 -131
- package/.claude/skills/cfn-agent-spawning/spawn-agent.sh.backup +0 -273
- package/.claude/skills/cfn-loop-orchestration/orchestrate.sh.backup +0 -949
- package/README.md.backup_before_replace +0 -781
- package/claude-assets/cfn-extras/agents/deprecated-coordinators/adaptive-coordinator.md.backup +0 -161
- package/claude-assets/cfn-extras/agents/deprecated-coordinators/blocking-coordinator-example.md.backup +0 -728
- package/claude-assets/cfn-extras/agents/deprecated-coordinators/mesh-coordinator.md.backup +0 -131
- package/claude-assets/skills/cfn-agent-spawning/spawn-agent.sh.backup +0 -273
- package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh.backup +0 -949
|
@@ -0,0 +1,991 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Skills Database CLI Tool
|
|
4
|
+
* Phase 4: CLI Tooling with Approval Workflow
|
|
5
|
+
*
|
|
6
|
+
* Commands:
|
|
7
|
+
* - list: List skills with filtering
|
|
8
|
+
* - assign: Assign skills to agents
|
|
9
|
+
* - create: Create new skills
|
|
10
|
+
* - update: Update skill metadata
|
|
11
|
+
* - deprecate: Deprecate skills
|
|
12
|
+
* - approve: Approve pending skills
|
|
13
|
+
* - escalate: Escalate skills for review
|
|
14
|
+
* - pending: List pending approvals
|
|
15
|
+
* - approval-status: Check skill approval status
|
|
16
|
+
* - analytics: Skill effectiveness analytics
|
|
17
|
+
*/ import { createRequire } from 'module';
|
|
18
|
+
import { existsSync, readFileSync } from 'fs';
|
|
19
|
+
import { createHash } from 'crypto';
|
|
20
|
+
import { fileURLToPath } from 'url';
|
|
21
|
+
import path from 'path';
|
|
22
|
+
const require = createRequire(import.meta.url);
|
|
23
|
+
const Database = require('better-sqlite3');
|
|
24
|
+
// ============================================================================
|
|
25
|
+
// ANSI Color Codes
|
|
26
|
+
// ============================================================================
|
|
27
|
+
const colors = {
|
|
28
|
+
reset: '\x1b[0m',
|
|
29
|
+
bright: '\x1b[1m',
|
|
30
|
+
dim: '\x1b[2m',
|
|
31
|
+
red: '\x1b[31m',
|
|
32
|
+
green: '\x1b[32m',
|
|
33
|
+
yellow: '\x1b[33m',
|
|
34
|
+
blue: '\x1b[34m',
|
|
35
|
+
magenta: '\x1b[35m',
|
|
36
|
+
cyan: '\x1b[36m',
|
|
37
|
+
white: '\x1b[37m'
|
|
38
|
+
};
|
|
39
|
+
const chalk = {
|
|
40
|
+
red: (text)=>`${colors.red}${text}${colors.reset}`,
|
|
41
|
+
green: (text)=>`${colors.green}${text}${colors.reset}`,
|
|
42
|
+
yellow: (text)=>`${colors.yellow}${text}${colors.reset}`,
|
|
43
|
+
blue: (text)=>`${colors.blue}${text}${colors.reset}`,
|
|
44
|
+
magenta: (text)=>`${colors.magenta}${text}${colors.reset}`,
|
|
45
|
+
cyan: (text)=>`${colors.cyan}${text}${colors.reset}`,
|
|
46
|
+
bold: (text)=>`${colors.bright}${text}${colors.reset}`,
|
|
47
|
+
dim: (text)=>`${colors.dim}${text}${colors.reset}`
|
|
48
|
+
};
|
|
49
|
+
// ============================================================================
|
|
50
|
+
// Database Connection
|
|
51
|
+
// ============================================================================
|
|
52
|
+
const DB_PATH = process.env.CFN_SKILLS_DB_PATH || './.claude/skills-database/skills.db';
|
|
53
|
+
function getDb() {
|
|
54
|
+
if (!existsSync(DB_PATH)) {
|
|
55
|
+
console.error(chalk.red(`Error: Skills database not found at ${DB_PATH}`));
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
return new Database(DB_PATH);
|
|
59
|
+
}
|
|
60
|
+
// ============================================================================
|
|
61
|
+
// Utility Functions
|
|
62
|
+
// ============================================================================
|
|
63
|
+
function calculateHash(content) {
|
|
64
|
+
return createHash('sha256').update(content).digest('hex');
|
|
65
|
+
}
|
|
66
|
+
// Strip ANSI escape codes for accurate string length measurement
|
|
67
|
+
function stripAnsi(str) {
|
|
68
|
+
return str.replace(/\x1b\[[0-9;]*m/g, '');
|
|
69
|
+
}
|
|
70
|
+
function formatTable(headers, rows) {
|
|
71
|
+
if (rows.length === 0) {
|
|
72
|
+
return 'No results found.';
|
|
73
|
+
}
|
|
74
|
+
// Calculate column widths - strip ANSI codes before measuring
|
|
75
|
+
const colWidths = headers.map((header, i)=>{
|
|
76
|
+
const maxDataWidth = Math.max(...rows.map((row)=>stripAnsi((row[i] || '').toString()).length));
|
|
77
|
+
return Math.max(stripAnsi(header).length, maxDataWidth);
|
|
78
|
+
});
|
|
79
|
+
// Build separator
|
|
80
|
+
const separator = colWidths.map((w)=>'-'.repeat(w)).join('-+-');
|
|
81
|
+
// Build header - use stripped length for padding calculation
|
|
82
|
+
const headerRow = headers.map((h, i)=>{
|
|
83
|
+
const stripped = stripAnsi(h);
|
|
84
|
+
const padding = colWidths[i] - stripped.length;
|
|
85
|
+
return h + ' '.repeat(Math.max(0, padding));
|
|
86
|
+
}).join(' | ');
|
|
87
|
+
// Build data rows - use stripped length for padding calculation
|
|
88
|
+
const dataRows = rows.map((row)=>row.map((cell, i)=>{
|
|
89
|
+
const cellStr = (cell || '').toString();
|
|
90
|
+
const stripped = stripAnsi(cellStr);
|
|
91
|
+
const padding = colWidths[i] - stripped.length;
|
|
92
|
+
return cellStr + ' '.repeat(Math.max(0, padding));
|
|
93
|
+
}).join(' | '));
|
|
94
|
+
return [
|
|
95
|
+
headerRow,
|
|
96
|
+
separator,
|
|
97
|
+
...dataRows
|
|
98
|
+
].join('\n');
|
|
99
|
+
}
|
|
100
|
+
function parseArgs(args) {
|
|
101
|
+
const parsed = {};
|
|
102
|
+
for(let i = 0; i < args.length; i++){
|
|
103
|
+
const arg = args[i];
|
|
104
|
+
if (arg.startsWith('--')) {
|
|
105
|
+
// Handle --key=value format
|
|
106
|
+
if (arg.includes('=')) {
|
|
107
|
+
const [key, ...valueParts] = arg.slice(2).split('=');
|
|
108
|
+
parsed[key] = valueParts.join('='); // Rejoin in case value contains '='
|
|
109
|
+
} else {
|
|
110
|
+
// Handle --key value format
|
|
111
|
+
const key = arg.slice(2);
|
|
112
|
+
const nextArg = args[i + 1];
|
|
113
|
+
if (nextArg && !nextArg.startsWith('--')) {
|
|
114
|
+
parsed[key] = nextArg;
|
|
115
|
+
i++;
|
|
116
|
+
} else {
|
|
117
|
+
parsed[key] = true;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return parsed;
|
|
123
|
+
}
|
|
124
|
+
// ============================================================================
|
|
125
|
+
// Command: list
|
|
126
|
+
// ============================================================================
|
|
127
|
+
async function cmdList(options) {
|
|
128
|
+
const db = getDb();
|
|
129
|
+
let query = 'SELECT * FROM skills WHERE 1=1';
|
|
130
|
+
const params = [];
|
|
131
|
+
// Filter by approval level
|
|
132
|
+
if (options.approval) {
|
|
133
|
+
query += ' AND approval_level = ?';
|
|
134
|
+
params.push(options.approval);
|
|
135
|
+
}
|
|
136
|
+
// Filter by category
|
|
137
|
+
if (options.category) {
|
|
138
|
+
query += ' AND category = ?';
|
|
139
|
+
params.push(options.category);
|
|
140
|
+
}
|
|
141
|
+
// Filter by team
|
|
142
|
+
if (options.team) {
|
|
143
|
+
query += ' AND team = ?';
|
|
144
|
+
params.push(options.team);
|
|
145
|
+
}
|
|
146
|
+
// Filter by status
|
|
147
|
+
if (options.status) {
|
|
148
|
+
query += ' AND status = ?';
|
|
149
|
+
params.push(options.status);
|
|
150
|
+
} else {
|
|
151
|
+
// Default to active only
|
|
152
|
+
query += ' AND status = ?';
|
|
153
|
+
params.push('active');
|
|
154
|
+
}
|
|
155
|
+
// Filter by pending approval
|
|
156
|
+
if (options['pending-approval']) {
|
|
157
|
+
query = `
|
|
158
|
+
SELECT s.* FROM skills s
|
|
159
|
+
LEFT JOIN approval_history ah ON ah.skill_id = s.id AND ah.version = s.version AND ah.decision = 'approved'
|
|
160
|
+
WHERE ah.id IS NULL
|
|
161
|
+
AND s.approval_level IN ('human', 'escalate')
|
|
162
|
+
AND s.status = 'active'
|
|
163
|
+
`;
|
|
164
|
+
params.length = 0; // Clear params
|
|
165
|
+
}
|
|
166
|
+
// Filter by agent
|
|
167
|
+
if (options.agent) {
|
|
168
|
+
query = `
|
|
169
|
+
SELECT s.* FROM skills s
|
|
170
|
+
JOIN agent_skill_mappings m ON m.skill_id = s.id
|
|
171
|
+
WHERE m.agent_type = ?
|
|
172
|
+
AND s.status = 'active'
|
|
173
|
+
`;
|
|
174
|
+
params.length = 0;
|
|
175
|
+
params.push(options.agent);
|
|
176
|
+
}
|
|
177
|
+
query += ' ORDER BY id ASC';
|
|
178
|
+
const skills = db.prepare(query).all(...params);
|
|
179
|
+
if (skills.length === 0) {
|
|
180
|
+
console.log(chalk.yellow('No skills found matching criteria.'));
|
|
181
|
+
db.close();
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
// Count agents for each skill
|
|
185
|
+
const skillsWithAgentCount = skills.map((skill)=>{
|
|
186
|
+
const count = db.prepare('SELECT COUNT(*) as count FROM agent_skill_mappings WHERE skill_id = ?').get(skill.id);
|
|
187
|
+
return {
|
|
188
|
+
...skill,
|
|
189
|
+
agent_count: count.count
|
|
190
|
+
};
|
|
191
|
+
});
|
|
192
|
+
// Format as table
|
|
193
|
+
const headers = [
|
|
194
|
+
'ID',
|
|
195
|
+
'Name',
|
|
196
|
+
'Category',
|
|
197
|
+
'Approval',
|
|
198
|
+
'Version',
|
|
199
|
+
'Status',
|
|
200
|
+
'Agents'
|
|
201
|
+
];
|
|
202
|
+
const rows = skillsWithAgentCount.map((s)=>[
|
|
203
|
+
s.id.toString(),
|
|
204
|
+
s.name,
|
|
205
|
+
s.category,
|
|
206
|
+
s.approval_level === 'auto' ? chalk.green(s.approval_level) : s.approval_level === 'escalate' ? chalk.yellow(s.approval_level) : chalk.red(s.approval_level),
|
|
207
|
+
s.version,
|
|
208
|
+
s.status === 'active' ? chalk.green(s.status) : chalk.dim(s.status),
|
|
209
|
+
s.agent_count.toString()
|
|
210
|
+
]);
|
|
211
|
+
console.log(formatTable(headers, rows));
|
|
212
|
+
console.log(`\nTotal: ${skills.length} skill(s)`);
|
|
213
|
+
db.close();
|
|
214
|
+
}
|
|
215
|
+
// ============================================================================
|
|
216
|
+
// Command: assign
|
|
217
|
+
// ============================================================================
|
|
218
|
+
async function cmdAssign(options) {
|
|
219
|
+
const db = getDb();
|
|
220
|
+
const { agent, skill, priority, required, condition } = options;
|
|
221
|
+
if (!agent || !skill) {
|
|
222
|
+
console.error(chalk.red('Error: --agent and --skill are required'));
|
|
223
|
+
process.exit(1);
|
|
224
|
+
}
|
|
225
|
+
// Get skill ID
|
|
226
|
+
const skillRecord = db.prepare('SELECT id FROM skills WHERE name = ?').get(skill);
|
|
227
|
+
if (!skillRecord) {
|
|
228
|
+
console.error(chalk.red(`Error: Skill not found: ${skill}`));
|
|
229
|
+
db.close();
|
|
230
|
+
process.exit(1);
|
|
231
|
+
}
|
|
232
|
+
// Check if mapping already exists
|
|
233
|
+
const existing = db.prepare('SELECT id FROM agent_skill_mappings WHERE agent_type = ? AND skill_id = ?').get(agent, skillRecord.id);
|
|
234
|
+
if (existing) {
|
|
235
|
+
console.error(chalk.yellow(`Warning: Mapping already exists for ${agent} → ${skill}`));
|
|
236
|
+
db.close();
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
// Insert mapping
|
|
240
|
+
db.prepare(`
|
|
241
|
+
INSERT INTO agent_skill_mappings (agent_type, skill_id, priority, required, conditions)
|
|
242
|
+
VALUES (?, ?, ?, ?, ?)
|
|
243
|
+
`).run(agent, skillRecord.id, priority ? parseInt(priority) : 5, required ? 1 : 0, condition ? JSON.stringify({
|
|
244
|
+
taskContext: [
|
|
245
|
+
condition
|
|
246
|
+
]
|
|
247
|
+
}) : null);
|
|
248
|
+
console.log(chalk.green(`✓ Assigned skill "${skill}" to agent "${agent}"`));
|
|
249
|
+
console.log(` Priority: ${priority || 5}`);
|
|
250
|
+
console.log(` Required: ${required ? 'Yes' : 'No'}`);
|
|
251
|
+
if (condition) {
|
|
252
|
+
console.log(` Condition: taskContext contains "${condition}"`);
|
|
253
|
+
}
|
|
254
|
+
db.close();
|
|
255
|
+
}
|
|
256
|
+
// ============================================================================
|
|
257
|
+
// Command: create
|
|
258
|
+
// ============================================================================
|
|
259
|
+
async function cmdCreate(options) {
|
|
260
|
+
const db = getDb();
|
|
261
|
+
const { name, category, team, 'content-path': contentPath, tags, version, 'approval-level': approvalLevel, owner } = options;
|
|
262
|
+
if (!name || !category || !contentPath) {
|
|
263
|
+
console.error(chalk.red('Error: --name, --category, and --content-path are required'));
|
|
264
|
+
process.exit(1);
|
|
265
|
+
}
|
|
266
|
+
// Validate content path exists
|
|
267
|
+
const fullPath = path.resolve(contentPath);
|
|
268
|
+
if (!existsSync(fullPath)) {
|
|
269
|
+
console.error(chalk.red(`Error: Content file not found: ${fullPath}`));
|
|
270
|
+
process.exit(1);
|
|
271
|
+
}
|
|
272
|
+
// Calculate hash
|
|
273
|
+
const content = readFileSync(fullPath, 'utf-8');
|
|
274
|
+
const hash = calculateHash(content);
|
|
275
|
+
// Parse tags
|
|
276
|
+
const tagArray = tags ? tags.split(',').map((t)=>t.trim()) : [];
|
|
277
|
+
// Insert skill
|
|
278
|
+
try {
|
|
279
|
+
db.prepare(`
|
|
280
|
+
INSERT INTO skills (
|
|
281
|
+
name, category, team, content_path, content_hash, tags, version, status,
|
|
282
|
+
approval_level, owner, generated_by
|
|
283
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
284
|
+
`).run(name, category, team || 'default', contentPath, hash, JSON.stringify(tagArray), version || '1.0.0', 'active', approvalLevel || 'human', owner || 'unknown', 'manual');
|
|
285
|
+
console.log(chalk.green(`✓ Created skill: ${name}`));
|
|
286
|
+
console.log(` Category: ${category}`);
|
|
287
|
+
console.log(` Version: ${version || '1.0.0'}`);
|
|
288
|
+
console.log(` Approval: ${approvalLevel || 'human'}`);
|
|
289
|
+
console.log(` Path: ${contentPath}`);
|
|
290
|
+
console.log(` Hash: ${hash.slice(0, 16)}...`);
|
|
291
|
+
} catch (error) {
|
|
292
|
+
if (error.message.includes('UNIQUE constraint failed')) {
|
|
293
|
+
console.error(chalk.red(`Error: Skill "${name}" already exists`));
|
|
294
|
+
} else {
|
|
295
|
+
console.error(chalk.red(`Error: ${error.message}`));
|
|
296
|
+
}
|
|
297
|
+
db.close();
|
|
298
|
+
process.exit(1);
|
|
299
|
+
}
|
|
300
|
+
db.close();
|
|
301
|
+
}
|
|
302
|
+
// ============================================================================
|
|
303
|
+
// Command: update
|
|
304
|
+
// ============================================================================
|
|
305
|
+
async function cmdUpdate(options) {
|
|
306
|
+
const db = getDb();
|
|
307
|
+
const { skill, version, tags, 'recalculate-hash': recalcHash, 'approval-level': approvalLevel } = options;
|
|
308
|
+
if (!skill) {
|
|
309
|
+
console.error(chalk.red('Error: --skill is required'));
|
|
310
|
+
process.exit(1);
|
|
311
|
+
}
|
|
312
|
+
// Get skill
|
|
313
|
+
const skillRecord = db.prepare('SELECT * FROM skills WHERE name = ?').get(skill);
|
|
314
|
+
if (!skillRecord) {
|
|
315
|
+
console.error(chalk.red(`Error: Skill not found: ${skill}`));
|
|
316
|
+
db.close();
|
|
317
|
+
process.exit(1);
|
|
318
|
+
}
|
|
319
|
+
const updates = [];
|
|
320
|
+
const params = [];
|
|
321
|
+
if (version) {
|
|
322
|
+
updates.push('version = ?');
|
|
323
|
+
params.push(version);
|
|
324
|
+
}
|
|
325
|
+
if (tags) {
|
|
326
|
+
const tagArray = tags.split(',').map((t)=>t.trim());
|
|
327
|
+
updates.push('tags = ?');
|
|
328
|
+
params.push(JSON.stringify(tagArray));
|
|
329
|
+
}
|
|
330
|
+
if (approvalLevel) {
|
|
331
|
+
updates.push('approval_level = ?');
|
|
332
|
+
params.push(approvalLevel);
|
|
333
|
+
}
|
|
334
|
+
if (recalcHash) {
|
|
335
|
+
const content = readFileSync(skillRecord.content_path, 'utf-8');
|
|
336
|
+
const newHash = calculateHash(content);
|
|
337
|
+
updates.push('content_hash = ?');
|
|
338
|
+
params.push(newHash);
|
|
339
|
+
console.log(chalk.blue(`New hash: ${newHash.slice(0, 16)}...`));
|
|
340
|
+
}
|
|
341
|
+
if (updates.length === 0) {
|
|
342
|
+
console.log(chalk.yellow('No updates specified'));
|
|
343
|
+
db.close();
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
updates.push('updated_at = datetime(\'now\')');
|
|
347
|
+
params.push(skill);
|
|
348
|
+
db.prepare(`UPDATE skills SET ${updates.join(', ')} WHERE name = ?`).run(...params);
|
|
349
|
+
console.log(chalk.green(`✓ Updated skill: ${skill}`));
|
|
350
|
+
db.close();
|
|
351
|
+
}
|
|
352
|
+
// ============================================================================
|
|
353
|
+
// Command: deprecate
|
|
354
|
+
// ============================================================================
|
|
355
|
+
async function cmdDeprecate(options) {
|
|
356
|
+
const db = getDb();
|
|
357
|
+
const { skill, replacement, note } = options;
|
|
358
|
+
if (!skill) {
|
|
359
|
+
console.error(chalk.red('Error: --skill is required'));
|
|
360
|
+
process.exit(1);
|
|
361
|
+
}
|
|
362
|
+
// Get skill ID
|
|
363
|
+
const skillRecord = db.prepare('SELECT id FROM skills WHERE name = ?').get(skill);
|
|
364
|
+
if (!skillRecord) {
|
|
365
|
+
console.error(chalk.red(`Error: Skill not found: ${skill}`));
|
|
366
|
+
db.close();
|
|
367
|
+
process.exit(1);
|
|
368
|
+
}
|
|
369
|
+
// Get replacement ID if specified
|
|
370
|
+
let replacementId = null;
|
|
371
|
+
if (replacement) {
|
|
372
|
+
const replacementRecord = db.prepare('SELECT id FROM skills WHERE name = ?').get(replacement);
|
|
373
|
+
if (replacementRecord) {
|
|
374
|
+
replacementId = replacementRecord.id;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
// Update skill
|
|
378
|
+
db.prepare(`
|
|
379
|
+
UPDATE skills
|
|
380
|
+
SET status = 'deprecated',
|
|
381
|
+
deprecation_note = ?,
|
|
382
|
+
replacement_id = ?,
|
|
383
|
+
updated_at = datetime('now')
|
|
384
|
+
WHERE id = ?
|
|
385
|
+
`).run(note || 'Deprecated', replacementId, skillRecord.id);
|
|
386
|
+
console.log(chalk.yellow(`⚠ Deprecated skill: ${skill}`));
|
|
387
|
+
if (replacement) {
|
|
388
|
+
console.log(` Replacement: ${replacement}`);
|
|
389
|
+
}
|
|
390
|
+
if (note) {
|
|
391
|
+
console.log(` Note: ${note}`);
|
|
392
|
+
}
|
|
393
|
+
db.close();
|
|
394
|
+
}
|
|
395
|
+
// ============================================================================
|
|
396
|
+
// Command: approve
|
|
397
|
+
// ============================================================================
|
|
398
|
+
async function cmdApprove(options) {
|
|
399
|
+
const db = getDb();
|
|
400
|
+
const { skill, version, approver, decision, reasoning } = options;
|
|
401
|
+
if (!skill || !decision) {
|
|
402
|
+
console.error(chalk.red('Error: --skill and --decision are required'));
|
|
403
|
+
process.exit(1);
|
|
404
|
+
}
|
|
405
|
+
if (![
|
|
406
|
+
'approved',
|
|
407
|
+
'rejected'
|
|
408
|
+
].includes(decision)) {
|
|
409
|
+
console.error(chalk.red('Error: --decision must be "approved" or "rejected"'));
|
|
410
|
+
process.exit(1);
|
|
411
|
+
}
|
|
412
|
+
// Get skill
|
|
413
|
+
const skillRecord = db.prepare('SELECT * FROM skills WHERE name = ?').get(skill);
|
|
414
|
+
if (!skillRecord) {
|
|
415
|
+
console.error(chalk.red(`Error: Skill not found: ${skill}`));
|
|
416
|
+
db.close();
|
|
417
|
+
process.exit(1);
|
|
418
|
+
}
|
|
419
|
+
// Record approval
|
|
420
|
+
db.prepare(`
|
|
421
|
+
INSERT INTO approval_history (skill_id, version, approval_level, approver, decision, reasoning, timestamp)
|
|
422
|
+
VALUES (?, ?, ?, ?, ?, ?, datetime('now'))
|
|
423
|
+
`).run(skillRecord.id, version || skillRecord.version, skillRecord.approval_level, approver || 'system', decision, reasoning || null);
|
|
424
|
+
// Update skill status
|
|
425
|
+
if (decision === 'approved') {
|
|
426
|
+
db.prepare('UPDATE skills SET status = ? WHERE id = ?').run('active', skillRecord.id);
|
|
427
|
+
console.log(chalk.green(`✓ Skill approved: ${skill} (v${version || skillRecord.version})`));
|
|
428
|
+
} else {
|
|
429
|
+
db.prepare('UPDATE skills SET status = ? WHERE id = ?').run('archived', skillRecord.id);
|
|
430
|
+
console.log(chalk.red(`✗ Skill rejected: ${skill}`));
|
|
431
|
+
}
|
|
432
|
+
if (reasoning) {
|
|
433
|
+
console.log(` Reasoning: ${reasoning}`);
|
|
434
|
+
}
|
|
435
|
+
db.close();
|
|
436
|
+
}
|
|
437
|
+
// ============================================================================
|
|
438
|
+
// Command: escalate
|
|
439
|
+
// ============================================================================
|
|
440
|
+
async function cmdEscalate(options) {
|
|
441
|
+
const db = getDb();
|
|
442
|
+
const { skill, version, reason } = options;
|
|
443
|
+
if (!skill || !reason) {
|
|
444
|
+
console.error(chalk.red('Error: --skill and --reason are required'));
|
|
445
|
+
process.exit(1);
|
|
446
|
+
}
|
|
447
|
+
// Get skill
|
|
448
|
+
const skillRecord = db.prepare('SELECT * FROM skills WHERE name = ?').get(skill);
|
|
449
|
+
if (!skillRecord) {
|
|
450
|
+
console.error(chalk.red(`Error: Skill not found: ${skill}`));
|
|
451
|
+
db.close();
|
|
452
|
+
process.exit(1);
|
|
453
|
+
}
|
|
454
|
+
// Update approval level to escalate
|
|
455
|
+
db.prepare('UPDATE skills SET approval_level = ? WHERE id = ?').run('escalate', skillRecord.id);
|
|
456
|
+
// Record escalation in approval history
|
|
457
|
+
db.prepare(`
|
|
458
|
+
INSERT INTO approval_history (skill_id, version, approval_level, approver, decision, reasoning, timestamp)
|
|
459
|
+
VALUES (?, ?, ?, ?, ?, ?, datetime('now'))
|
|
460
|
+
`).run(skillRecord.id, version || skillRecord.version, 'escalate', 'system', 'escalated', reason);
|
|
461
|
+
console.log(chalk.yellow(`⚠ Skill escalated: ${skill}`));
|
|
462
|
+
console.log(` Reason: ${reason}`);
|
|
463
|
+
console.log(` Awaiting expert review...`);
|
|
464
|
+
db.close();
|
|
465
|
+
}
|
|
466
|
+
// ============================================================================
|
|
467
|
+
// Command: pending
|
|
468
|
+
// ============================================================================
|
|
469
|
+
async function cmdPending(options) {
|
|
470
|
+
const db = getDb();
|
|
471
|
+
const approvalLevel = options['approval-level'];
|
|
472
|
+
let query = `
|
|
473
|
+
SELECT s.* FROM skills s
|
|
474
|
+
LEFT JOIN approval_history ah ON ah.skill_id = s.id AND ah.version = s.version AND ah.decision = 'approved'
|
|
475
|
+
WHERE ah.id IS NULL
|
|
476
|
+
AND s.approval_level != 'auto'
|
|
477
|
+
AND s.status = 'active'
|
|
478
|
+
`;
|
|
479
|
+
const params = [];
|
|
480
|
+
if (approvalLevel) {
|
|
481
|
+
query += ' AND s.approval_level = ?';
|
|
482
|
+
params.push(approvalLevel);
|
|
483
|
+
}
|
|
484
|
+
query += ' ORDER BY s.created_at DESC';
|
|
485
|
+
const skills = db.prepare(query).all(...params);
|
|
486
|
+
if (skills.length === 0) {
|
|
487
|
+
console.log(chalk.green('✓ No pending approvals'));
|
|
488
|
+
db.close();
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
const headers = [
|
|
492
|
+
'ID',
|
|
493
|
+
'Name',
|
|
494
|
+
'Category',
|
|
495
|
+
'Approval Level',
|
|
496
|
+
'Version',
|
|
497
|
+
'Created'
|
|
498
|
+
];
|
|
499
|
+
const rows = skills.map((s)=>[
|
|
500
|
+
s.id.toString(),
|
|
501
|
+
s.name,
|
|
502
|
+
s.category,
|
|
503
|
+
s.approval_level === 'escalate' ? chalk.yellow(s.approval_level) : chalk.red(s.approval_level),
|
|
504
|
+
s.version,
|
|
505
|
+
s.created_at.split('T')[0]
|
|
506
|
+
]);
|
|
507
|
+
console.log(formatTable(headers, rows));
|
|
508
|
+
console.log(`\n${chalk.yellow(`Pending: ${skills.length} skill(s)`)}`);
|
|
509
|
+
db.close();
|
|
510
|
+
}
|
|
511
|
+
// ============================================================================
|
|
512
|
+
// Command: approval-status
|
|
513
|
+
// ============================================================================
|
|
514
|
+
async function cmdApprovalStatus(options) {
|
|
515
|
+
const db = getDb();
|
|
516
|
+
const { skill } = options;
|
|
517
|
+
if (!skill) {
|
|
518
|
+
console.error(chalk.red('Error: --skill is required'));
|
|
519
|
+
process.exit(1);
|
|
520
|
+
}
|
|
521
|
+
// Get skill
|
|
522
|
+
const skillRecord = db.prepare('SELECT * FROM skills WHERE name = ?').get(skill);
|
|
523
|
+
if (!skillRecord) {
|
|
524
|
+
console.error(chalk.red(`Error: Skill not found: ${skill}`));
|
|
525
|
+
db.close();
|
|
526
|
+
process.exit(1);
|
|
527
|
+
}
|
|
528
|
+
console.log(chalk.bold(`\nApproval Status: ${skill}`));
|
|
529
|
+
console.log(`${'─'.repeat(50)}`);
|
|
530
|
+
console.log(`Approval Level: ${skillRecord.approval_level}`);
|
|
531
|
+
console.log(`Current Status: ${skillRecord.status}`);
|
|
532
|
+
// Get approval history
|
|
533
|
+
const history = db.prepare(`
|
|
534
|
+
SELECT * FROM approval_history
|
|
535
|
+
WHERE skill_id = ?
|
|
536
|
+
ORDER BY timestamp DESC
|
|
537
|
+
`).all(skillRecord.id);
|
|
538
|
+
if (history.length === 0) {
|
|
539
|
+
console.log(chalk.yellow('\nNo approval history'));
|
|
540
|
+
} else {
|
|
541
|
+
console.log(chalk.bold('\nApproval History:'));
|
|
542
|
+
history.forEach((entry, i)=>{
|
|
543
|
+
console.log(`\n${i + 1}. ${entry.decision.toUpperCase()} (${entry.timestamp.split('T')[0]})`);
|
|
544
|
+
console.log(` Version: ${entry.version}`);
|
|
545
|
+
console.log(` Approver: ${entry.approver || 'system'}`);
|
|
546
|
+
if (entry.reasoning) {
|
|
547
|
+
console.log(` Reasoning: ${entry.reasoning}`);
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
db.close();
|
|
552
|
+
}
|
|
553
|
+
// ============================================================================
|
|
554
|
+
// Command: analytics
|
|
555
|
+
// ============================================================================
|
|
556
|
+
async function cmdAnalytics(options, subcommand) {
|
|
557
|
+
const db = getDb();
|
|
558
|
+
if (!subcommand) {
|
|
559
|
+
console.error(chalk.red('Error: Analytics subcommand required'));
|
|
560
|
+
console.log('\nAvailable subcommands:');
|
|
561
|
+
console.log(' effectiveness - Skill effectiveness by approval level');
|
|
562
|
+
console.log(' velocity - Approval velocity and SLA compliance');
|
|
563
|
+
console.log(' bottlenecks - Identify approval bottlenecks');
|
|
564
|
+
console.log(' by-approval - Skills grouped by approval level');
|
|
565
|
+
console.log(' effectiveness-by-approval - Effectiveness metrics grouped by approval level');
|
|
566
|
+
console.log(' phase4-performance - Performance of Phase4-generated skills');
|
|
567
|
+
console.log(' approval-efficiency - Approval workflow efficiency metrics');
|
|
568
|
+
process.exit(1);
|
|
569
|
+
}
|
|
570
|
+
switch(subcommand){
|
|
571
|
+
case 'effectiveness':
|
|
572
|
+
await analyticsEffectiveness(db, options);
|
|
573
|
+
break;
|
|
574
|
+
case 'velocity':
|
|
575
|
+
await analyticsVelocity(db, options);
|
|
576
|
+
break;
|
|
577
|
+
case 'bottlenecks':
|
|
578
|
+
await analyticsBottlenecks(db, options);
|
|
579
|
+
break;
|
|
580
|
+
case 'by-approval':
|
|
581
|
+
await analyticsByApproval(db, options);
|
|
582
|
+
break;
|
|
583
|
+
case 'effectiveness-by-approval':
|
|
584
|
+
await analyticsEffectivenessByApproval(db, options);
|
|
585
|
+
break;
|
|
586
|
+
case 'phase4-performance':
|
|
587
|
+
await analyticsPhase4Performance(db, options);
|
|
588
|
+
break;
|
|
589
|
+
case 'approval-efficiency':
|
|
590
|
+
await analyticsApprovalEfficiency(db, options);
|
|
591
|
+
break;
|
|
592
|
+
default:
|
|
593
|
+
console.error(chalk.red(`Error: Unknown analytics subcommand: ${subcommand}`));
|
|
594
|
+
process.exit(1);
|
|
595
|
+
}
|
|
596
|
+
db.close();
|
|
597
|
+
}
|
|
598
|
+
async function analyticsEffectiveness(db, options) {
|
|
599
|
+
const days = parseInt(options.days || '30');
|
|
600
|
+
console.log(chalk.bold(`\nSkill Effectiveness by Approval Level (${days} days)`));
|
|
601
|
+
console.log(`${'─'.repeat(60)}`);
|
|
602
|
+
const approvalLevels = [
|
|
603
|
+
'auto',
|
|
604
|
+
'escalate',
|
|
605
|
+
'human'
|
|
606
|
+
];
|
|
607
|
+
for (const level of approvalLevels){
|
|
608
|
+
const stats = db.prepare(`
|
|
609
|
+
SELECT
|
|
610
|
+
COUNT(DISTINCT sul.skill_id) as skill_count,
|
|
611
|
+
COUNT(*) as usage_count,
|
|
612
|
+
AVG(sul.confidence_after - sul.confidence_before) as avg_impact,
|
|
613
|
+
AVG(sul.execution_time_ms) as avg_time
|
|
614
|
+
FROM skill_usage_log sul
|
|
615
|
+
JOIN skills s ON s.id = sul.skill_id
|
|
616
|
+
WHERE s.approval_level = ?
|
|
617
|
+
AND sul.loaded_at >= datetime('now', '-${days} days')
|
|
618
|
+
AND sul.confidence_before IS NOT NULL
|
|
619
|
+
AND sul.confidence_after IS NOT NULL
|
|
620
|
+
`).get(level);
|
|
621
|
+
console.log(`\n${chalk.bold(level.toUpperCase())} skills:`);
|
|
622
|
+
console.log(` Skills: ${stats.skill_count || 0}`);
|
|
623
|
+
console.log(` Usages: ${stats.usage_count || 0}`);
|
|
624
|
+
console.log(` Avg Confidence Impact: ${stats.avg_impact ? `+${stats.avg_impact.toFixed(3)}` : 'N/A'}`);
|
|
625
|
+
console.log(` Avg Execution Time: ${stats.avg_time ? `${stats.avg_time.toFixed(1)}ms` : 'N/A'}`);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
async function analyticsVelocity(db, options) {
|
|
629
|
+
const days = parseInt(options.days || '30');
|
|
630
|
+
console.log(chalk.bold(`\nApproval Velocity (${days} days)`));
|
|
631
|
+
console.log(`${'─'.repeat(50)}`);
|
|
632
|
+
const approvals = db.prepare(`
|
|
633
|
+
SELECT approval_level, decision, COUNT(*) as count, AVG(julianday('now') - julianday(timestamp)) as avg_days
|
|
634
|
+
FROM approval_history
|
|
635
|
+
WHERE timestamp >= datetime('now', '-${days} days')
|
|
636
|
+
GROUP BY approval_level, decision
|
|
637
|
+
`).all();
|
|
638
|
+
if (approvals.length === 0) {
|
|
639
|
+
console.log(chalk.yellow('\nNo approvals in the specified timeframe'));
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
approvals.forEach((stat)=>{
|
|
643
|
+
console.log(`\n${stat.approval_level.toUpperCase()} - ${stat.decision}:`);
|
|
644
|
+
console.log(` Count: ${stat.count}`);
|
|
645
|
+
console.log(` Avg Time: ${stat.avg_days.toFixed(1)} days`);
|
|
646
|
+
});
|
|
647
|
+
// SLA compliance (example: human approvals should be within 7 days)
|
|
648
|
+
const slaTarget = 7;
|
|
649
|
+
const humanApprovals = db.prepare(`
|
|
650
|
+
SELECT COUNT(*) as total,
|
|
651
|
+
SUM(CASE WHEN julianday('now') - julianday(timestamp) <= ${slaTarget} THEN 1 ELSE 0 END) as within_sla
|
|
652
|
+
FROM approval_history
|
|
653
|
+
WHERE approval_level = 'human'
|
|
654
|
+
AND timestamp >= datetime('now', '-${days} days')
|
|
655
|
+
`).get();
|
|
656
|
+
if (humanApprovals && humanApprovals.total > 0) {
|
|
657
|
+
const compliance = humanApprovals.within_sla / humanApprovals.total * 100;
|
|
658
|
+
console.log(`\n${chalk.bold('SLA Compliance')} (${slaTarget} days):`);
|
|
659
|
+
console.log(` Human Approvals: ${compliance.toFixed(1)}% (${humanApprovals.within_sla}/${humanApprovals.total})`);
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
async function analyticsBottlenecks(db, options) {
|
|
663
|
+
console.log(chalk.bold('\nApproval Bottlenecks'));
|
|
664
|
+
console.log(`${'─'.repeat(50)}`);
|
|
665
|
+
// Skills waiting longest for approval
|
|
666
|
+
const pending = db.prepare(`
|
|
667
|
+
SELECT s.name, s.approval_level, s.created_at,
|
|
668
|
+
julianday('now') - julianday(s.created_at) as days_waiting
|
|
669
|
+
FROM skills s
|
|
670
|
+
LEFT JOIN approval_history ah ON ah.skill_id = s.id AND ah.version = s.version AND ah.decision = 'approved'
|
|
671
|
+
WHERE ah.id IS NULL
|
|
672
|
+
AND s.approval_level != 'auto'
|
|
673
|
+
AND s.status = 'active'
|
|
674
|
+
ORDER BY days_waiting DESC
|
|
675
|
+
LIMIT 10
|
|
676
|
+
`).all();
|
|
677
|
+
if (pending.length === 0) {
|
|
678
|
+
console.log(chalk.green('\n✓ No pending approvals'));
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
console.log('\nLongest Pending Approvals:');
|
|
682
|
+
pending.forEach((skill, i)=>{
|
|
683
|
+
console.log(`\n${i + 1}. ${skill.name} (${skill.approval_level})`);
|
|
684
|
+
console.log(` Waiting: ${Math.floor(skill.days_waiting)} days`);
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
async function analyticsByApproval(db, options) {
|
|
688
|
+
console.log(chalk.bold('\nSkills by Approval Level'));
|
|
689
|
+
console.log(`${'─'.repeat(50)}`);
|
|
690
|
+
const stats = db.prepare(`
|
|
691
|
+
SELECT approval_level, status, COUNT(*) as count
|
|
692
|
+
FROM skills
|
|
693
|
+
GROUP BY approval_level, status
|
|
694
|
+
ORDER BY approval_level, status
|
|
695
|
+
`).all();
|
|
696
|
+
const grouped = {};
|
|
697
|
+
stats.forEach((stat)=>{
|
|
698
|
+
if (!grouped[stat.approval_level]) {
|
|
699
|
+
grouped[stat.approval_level] = [];
|
|
700
|
+
}
|
|
701
|
+
grouped[stat.approval_level].push(stat);
|
|
702
|
+
});
|
|
703
|
+
Object.keys(grouped).forEach((level)=>{
|
|
704
|
+
console.log(`\n${chalk.bold(level.toUpperCase())}:`);
|
|
705
|
+
grouped[level].forEach((stat)=>{
|
|
706
|
+
console.log(` ${stat.status}: ${stat.count}`);
|
|
707
|
+
});
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
// ============================================================================
|
|
711
|
+
// Command: analytics - Phase 6.2 New Subcommands
|
|
712
|
+
// ============================================================================
|
|
713
|
+
async function analyticsEffectivenessByApproval(db, options) {
|
|
714
|
+
const days = parseInt(options.days || '30');
|
|
715
|
+
console.log(chalk.bold(`\nSkill Effectiveness by Approval Level (${days} days)`));
|
|
716
|
+
console.log(`${'─'.repeat(70)}\n`);
|
|
717
|
+
const approvalLevels = [
|
|
718
|
+
'auto',
|
|
719
|
+
'human',
|
|
720
|
+
'escalate'
|
|
721
|
+
];
|
|
722
|
+
for (const level of approvalLevels){
|
|
723
|
+
// Get stats for this approval level
|
|
724
|
+
const stats = db.prepare(`
|
|
725
|
+
SELECT
|
|
726
|
+
COUNT(DISTINCT sul.skill_id) as skill_count,
|
|
727
|
+
COUNT(*) as usage_count,
|
|
728
|
+
AVG(sul.confidence_after - sul.confidence_before) as avg_confidence_impact,
|
|
729
|
+
AVG(sul.execution_time_ms) as avg_execution_time,
|
|
730
|
+
SUM(CASE WHEN (sul.confidence_after - sul.confidence_before) > 0.05 THEN 1 ELSE 0 END) as success_count
|
|
731
|
+
FROM skill_usage_log sul
|
|
732
|
+
JOIN skills s ON s.id = sul.skill_id
|
|
733
|
+
WHERE s.approval_level = ?
|
|
734
|
+
AND sul.loaded_at >= datetime('now', '-${days} days')
|
|
735
|
+
AND sul.confidence_before IS NOT NULL
|
|
736
|
+
AND sul.confidence_after IS NOT NULL
|
|
737
|
+
`).get(level);
|
|
738
|
+
if (!stats || stats.usage_count === 0) {
|
|
739
|
+
console.log(chalk.bold(`${level.charAt(0).toUpperCase() + level.slice(1)}-approved skills:`));
|
|
740
|
+
console.log(chalk.dim(' No usage data available\n'));
|
|
741
|
+
continue;
|
|
742
|
+
}
|
|
743
|
+
const successRate = stats.usage_count > 0 ? stats.success_count / stats.usage_count * 100 : 0;
|
|
744
|
+
console.log(chalk.bold(`${level.charAt(0).toUpperCase() + level.slice(1)}-approved skills:`));
|
|
745
|
+
console.log(` Avg confidence impact: ${stats.avg_confidence_impact ? chalk.green(`+${stats.avg_confidence_impact.toFixed(2)}`) : 'N/A'}`);
|
|
746
|
+
console.log(` Usage count: ${chalk.cyan(stats.usage_count.toLocaleString())}`);
|
|
747
|
+
console.log(` Success rate: ${chalk.green(`${successRate.toFixed(1)}%`)} (${stats.success_count}/${stats.usage_count} usages)`);
|
|
748
|
+
console.log(` Avg execution time: ${stats.avg_execution_time ? `${stats.avg_execution_time.toFixed(1)}ms` : 'N/A'}\n`);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
async function analyticsPhase4Performance(db, options) {
|
|
752
|
+
const days = parseInt(options.days || '30');
|
|
753
|
+
console.log(chalk.bold(`\nPhase 4 Generated Skills Performance (${days} days)`));
|
|
754
|
+
console.log(`${'─'.repeat(70)}\n`);
|
|
755
|
+
// Get overall Phase4 stats
|
|
756
|
+
const overallStats = db.prepare(`
|
|
757
|
+
SELECT
|
|
758
|
+
COUNT(DISTINCT sul.skill_id) as skill_count,
|
|
759
|
+
COUNT(*) as total_usages,
|
|
760
|
+
AVG(sul.execution_time_ms) as avg_execution_time,
|
|
761
|
+
AVG(sul.confidence_after - sul.confidence_before) as avg_confidence_impact
|
|
762
|
+
FROM skill_usage_log sul
|
|
763
|
+
JOIN skills s ON s.id = sul.skill_id
|
|
764
|
+
WHERE s.is_auto_generated = 1
|
|
765
|
+
AND s.generated_by = 'phase4'
|
|
766
|
+
AND sul.loaded_at >= datetime('now', '-${days} days')
|
|
767
|
+
AND sul.confidence_before IS NOT NULL
|
|
768
|
+
AND sul.confidence_after IS NOT NULL
|
|
769
|
+
`).get();
|
|
770
|
+
if (!overallStats || overallStats.total_usages === 0) {
|
|
771
|
+
console.log(chalk.yellow('No Phase4 skill usage data found in the specified timeframe.'));
|
|
772
|
+
console.log(chalk.dim('Phase4 skills may not have been used recently, or usage logging may not be enabled.\n'));
|
|
773
|
+
return;
|
|
774
|
+
}
|
|
775
|
+
console.log(chalk.bold('Overall Metrics:'));
|
|
776
|
+
console.log(` Total Phase4 skill usages: ${chalk.cyan(overallStats.total_usages.toLocaleString())}`);
|
|
777
|
+
console.log(` Unique Phase4 skills used: ${chalk.cyan(overallStats.skill_count)}`);
|
|
778
|
+
console.log(` Avg execution time: ${overallStats.avg_execution_time ? `${overallStats.avg_execution_time.toFixed(1)}ms` : 'N/A'}`);
|
|
779
|
+
console.log(` Avg confidence impact: ${overallStats.avg_confidence_impact ? chalk.green(`+${overallStats.avg_confidence_impact.toFixed(2)}`) : 'N/A'}`);
|
|
780
|
+
console.log(chalk.dim(' Cost savings: N/A (requires cost tracking implementation)\n'));
|
|
781
|
+
// Get top 5 Phase4 skills
|
|
782
|
+
const topSkills = db.prepare(`
|
|
783
|
+
SELECT
|
|
784
|
+
s.name,
|
|
785
|
+
COUNT(*) as usage_count,
|
|
786
|
+
AVG(sul.confidence_after - sul.confidence_before) as avg_confidence_impact,
|
|
787
|
+
AVG(sul.execution_time_ms) as avg_execution_time
|
|
788
|
+
FROM skill_usage_log sul
|
|
789
|
+
JOIN skills s ON s.id = sul.skill_id
|
|
790
|
+
WHERE s.is_auto_generated = 1
|
|
791
|
+
AND s.generated_by = 'phase4'
|
|
792
|
+
AND sul.loaded_at >= datetime('now', '-${days} days')
|
|
793
|
+
AND sul.confidence_before IS NOT NULL
|
|
794
|
+
AND sul.confidence_after IS NOT NULL
|
|
795
|
+
GROUP BY s.id, s.name
|
|
796
|
+
ORDER BY usage_count DESC
|
|
797
|
+
LIMIT 5
|
|
798
|
+
`).all();
|
|
799
|
+
if (topSkills.length > 0) {
|
|
800
|
+
console.log(chalk.bold('Top 5 Phase4 Skills:'));
|
|
801
|
+
topSkills.forEach((skill, index)=>{
|
|
802
|
+
const impact = skill.avg_confidence_impact ? `+${skill.avg_confidence_impact.toFixed(2)}` : 'N/A';
|
|
803
|
+
console.log(` ${index + 1}. ${chalk.cyan(skill.name)} (${skill.usage_count} uses, ${chalk.green(impact)} confidence)`);
|
|
804
|
+
});
|
|
805
|
+
console.log('');
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
async function analyticsApprovalEfficiency(db, options) {
|
|
809
|
+
console.log(chalk.bold('\nApproval Workflow Efficiency'));
|
|
810
|
+
console.log(`${'─'.repeat(70)}\n`);
|
|
811
|
+
// Get approval counts and timing by level
|
|
812
|
+
const approvalStats = db.prepare(`
|
|
813
|
+
SELECT
|
|
814
|
+
approval_level,
|
|
815
|
+
COUNT(*) as total_count,
|
|
816
|
+
AVG(review_duration_minutes) as avg_review_time_minutes,
|
|
817
|
+
SUM(CASE WHEN decision = 'approved' THEN 1 ELSE 0 END) as approved_count,
|
|
818
|
+
SUM(CASE WHEN decision = 'rejected' THEN 1 ELSE 0 END) as rejected_count,
|
|
819
|
+
SUM(CASE WHEN decision = 'escalated' THEN 1 ELSE 0 END) as escalated_count
|
|
820
|
+
FROM approval_history
|
|
821
|
+
GROUP BY approval_level
|
|
822
|
+
ORDER BY approval_level
|
|
823
|
+
`).all();
|
|
824
|
+
if (approvalStats.length === 0) {
|
|
825
|
+
console.log(chalk.yellow('No approval history found in the database.'));
|
|
826
|
+
console.log(chalk.dim('Approvals may not have been logged yet.\n'));
|
|
827
|
+
return;
|
|
828
|
+
}
|
|
829
|
+
// Display approval stats by level
|
|
830
|
+
console.log(chalk.bold('Approval Statistics by Level:\n'));
|
|
831
|
+
const slaTargets = {
|
|
832
|
+
'auto': 0,
|
|
833
|
+
'human': 10080,
|
|
834
|
+
'escalate': 2880 // 2 days in minutes
|
|
835
|
+
};
|
|
836
|
+
approvalStats.forEach((stat)=>{
|
|
837
|
+
const approvalRate = stat.total_count > 0 ? stat.approved_count / stat.total_count * 100 : 0;
|
|
838
|
+
const rejectionRate = stat.total_count > 0 ? stat.rejected_count / stat.total_count * 100 : 0;
|
|
839
|
+
let avgTimeDisplay = 'N/A';
|
|
840
|
+
if (stat.avg_review_time_minutes !== null) {
|
|
841
|
+
if (stat.approval_level === 'auto') {
|
|
842
|
+
avgTimeDisplay = 'instant';
|
|
843
|
+
} else if (stat.avg_review_time_minutes < 60) {
|
|
844
|
+
avgTimeDisplay = `${stat.avg_review_time_minutes.toFixed(1)} minutes`;
|
|
845
|
+
} else if (stat.avg_review_time_minutes < 1440) {
|
|
846
|
+
avgTimeDisplay = `${(stat.avg_review_time_minutes / 60).toFixed(1)} hours`;
|
|
847
|
+
} else {
|
|
848
|
+
avgTimeDisplay = `${(stat.avg_review_time_minutes / 1440).toFixed(1)} days`;
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
const slaTarget = slaTargets[stat.approval_level];
|
|
852
|
+
const slaDisplay = stat.approval_level === 'auto' ? 'instant' : stat.approval_level === 'human' ? '7 days' : '2 days';
|
|
853
|
+
console.log(chalk.bold(`${stat.approval_level.charAt(0).toUpperCase() + stat.approval_level.slice(1)}-approved:`));
|
|
854
|
+
console.log(` Total: ${chalk.cyan(stat.total_count.toString())} (avg time: ${avgTimeDisplay}, SLA: ${slaDisplay})`);
|
|
855
|
+
console.log(` Approval rate: ${chalk.green(`${approvalRate.toFixed(1)}%`)} (${stat.approved_count} approved)`);
|
|
856
|
+
if (stat.rejected_count > 0) {
|
|
857
|
+
console.log(` Rejection rate: ${chalk.red(`${rejectionRate.toFixed(1)}%`)} (${stat.rejected_count} rejected)`);
|
|
858
|
+
}
|
|
859
|
+
if (stat.escalated_count > 0) {
|
|
860
|
+
console.log(` Escalated: ${chalk.yellow(stat.escalated_count.toString())}`);
|
|
861
|
+
}
|
|
862
|
+
console.log('');
|
|
863
|
+
});
|
|
864
|
+
// Check for bottlenecks (pending approvals exceeding SLA)
|
|
865
|
+
const bottlenecks = db.prepare(`
|
|
866
|
+
SELECT
|
|
867
|
+
s.name,
|
|
868
|
+
s.approval_level,
|
|
869
|
+
julianday('now') - julianday(s.created_at) as days_pending,
|
|
870
|
+
s.created_at
|
|
871
|
+
FROM skills s
|
|
872
|
+
LEFT JOIN approval_history ah ON ah.skill_id = s.id AND ah.decision = 'approved'
|
|
873
|
+
WHERE ah.id IS NULL
|
|
874
|
+
AND s.approval_level != 'auto'
|
|
875
|
+
AND s.status = 'active'
|
|
876
|
+
AND (
|
|
877
|
+
(s.approval_level = 'human' AND julianday('now') - julianday(s.created_at) > 7)
|
|
878
|
+
OR
|
|
879
|
+
(s.approval_level = 'escalate' AND julianday('now') - julianday(s.created_at) > 2)
|
|
880
|
+
)
|
|
881
|
+
ORDER BY days_pending DESC
|
|
882
|
+
`).all();
|
|
883
|
+
if (bottlenecks.length > 0) {
|
|
884
|
+
console.log(chalk.bold('Bottlenecks (Approvals Exceeding SLA):\n'));
|
|
885
|
+
bottlenecks.forEach((skill, index)=>{
|
|
886
|
+
const daysOver = skill.approval_level === 'human' ? skill.days_pending - 7 : skill.days_pending - 2;
|
|
887
|
+
console.log(` ${index + 1}. ${chalk.yellow(skill.name)} (${skill.approval_level})`);
|
|
888
|
+
console.log(` Pending: ${Math.floor(skill.days_pending)} days (${chalk.red(`${daysOver.toFixed(1)} days over SLA`)})`);
|
|
889
|
+
});
|
|
890
|
+
console.log('');
|
|
891
|
+
const humanOverdue = bottlenecks.filter((b)=>b.approval_level === 'human').length;
|
|
892
|
+
const escalateOverdue = bottlenecks.filter((b)=>b.approval_level === 'escalate').length;
|
|
893
|
+
if (humanOverdue > 0) {
|
|
894
|
+
console.log(chalk.yellow(`⚠ ${humanOverdue} human approval${humanOverdue > 1 ? 's' : ''} > 7 days (escalate recommended)`));
|
|
895
|
+
}
|
|
896
|
+
if (escalateOverdue > 0) {
|
|
897
|
+
console.log(chalk.red(`⚠ ${escalateOverdue} escalated approval${escalateOverdue > 1 ? 's' : ''} > 2 days (expert review needed)`));
|
|
898
|
+
}
|
|
899
|
+
console.log('');
|
|
900
|
+
} else {
|
|
901
|
+
console.log(chalk.green('✓ No bottlenecks found - all pending approvals are within SLA\n'));
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
// ============================================================================
|
|
905
|
+
// Main CLI Entry Point
|
|
906
|
+
// ============================================================================
|
|
907
|
+
async function main() {
|
|
908
|
+
const args = process.argv.slice(2);
|
|
909
|
+
if (args.length === 0 || args[0] === '--help' || args[0] === '-h') {
|
|
910
|
+
console.log(`
|
|
911
|
+
${chalk.bold('Skills Database CLI Tool')}
|
|
912
|
+
|
|
913
|
+
Usage: npx cfn skill <command> [options]
|
|
914
|
+
|
|
915
|
+
Commands:
|
|
916
|
+
list List skills with filtering
|
|
917
|
+
assign Assign skill to agent
|
|
918
|
+
create Create new skill
|
|
919
|
+
update Update skill metadata
|
|
920
|
+
deprecate Deprecate a skill
|
|
921
|
+
approve Approve/reject a skill
|
|
922
|
+
escalate Escalate skill for expert review
|
|
923
|
+
pending List pending approvals
|
|
924
|
+
approval-status Check skill approval status
|
|
925
|
+
analytics Skill analytics and metrics
|
|
926
|
+
|
|
927
|
+
Examples:
|
|
928
|
+
npx cfn skill list --approval=auto
|
|
929
|
+
npx cfn skill list --pending-approval
|
|
930
|
+
npx cfn skill assign --agent=backend-developer --skill=jwt-auth --priority=3
|
|
931
|
+
npx cfn skill create --name=new-skill --category=domain --content-path=./skill.md
|
|
932
|
+
npx cfn skill approve --skill=jwt-auth --decision=approved --approver=expert@example.com
|
|
933
|
+
npx cfn skill pending --approval-level=human
|
|
934
|
+
npx cfn skill analytics effectiveness --days=30
|
|
935
|
+
`);
|
|
936
|
+
process.exit(0);
|
|
937
|
+
}
|
|
938
|
+
const command = args[0];
|
|
939
|
+
const options = parseArgs(args.slice(1));
|
|
940
|
+
try {
|
|
941
|
+
switch(command){
|
|
942
|
+
case 'list':
|
|
943
|
+
await cmdList(options);
|
|
944
|
+
break;
|
|
945
|
+
case 'assign':
|
|
946
|
+
await cmdAssign(options);
|
|
947
|
+
break;
|
|
948
|
+
case 'create':
|
|
949
|
+
await cmdCreate(options);
|
|
950
|
+
break;
|
|
951
|
+
case 'update':
|
|
952
|
+
await cmdUpdate(options);
|
|
953
|
+
break;
|
|
954
|
+
case 'deprecate':
|
|
955
|
+
await cmdDeprecate(options);
|
|
956
|
+
break;
|
|
957
|
+
case 'approve':
|
|
958
|
+
await cmdApprove(options);
|
|
959
|
+
break;
|
|
960
|
+
case 'escalate':
|
|
961
|
+
await cmdEscalate(options);
|
|
962
|
+
break;
|
|
963
|
+
case 'pending':
|
|
964
|
+
await cmdPending(options);
|
|
965
|
+
break;
|
|
966
|
+
case 'approval-status':
|
|
967
|
+
await cmdApprovalStatus(options);
|
|
968
|
+
break;
|
|
969
|
+
case 'analytics':
|
|
970
|
+
await cmdAnalytics(options, args[1]);
|
|
971
|
+
break;
|
|
972
|
+
default:
|
|
973
|
+
console.error(chalk.red(`Error: Unknown command: ${command}`));
|
|
974
|
+
console.log('Run "npx cfn skill --help" for usage information');
|
|
975
|
+
process.exit(1);
|
|
976
|
+
}
|
|
977
|
+
} catch (error) {
|
|
978
|
+
console.error(chalk.red(`Error: ${error.message}`));
|
|
979
|
+
process.exit(1);
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
// Run CLI (ESM-compatible check)
|
|
983
|
+
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
|
984
|
+
main().catch((error)=>{
|
|
985
|
+
console.error(chalk.red(`Fatal error: ${error.message}`));
|
|
986
|
+
process.exit(1);
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
export { main };
|
|
990
|
+
|
|
991
|
+
//# sourceMappingURL=skill-cli.js.map
|