claude-flow-novice 2.15.3 → 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-lint-sql-injection.sh +61 -0
- package/.claude/hooks/cfn-post-edit-cfn-retrospective.sh +33 -2
- 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-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-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 +2 -2
- package/.claude/skills/cfn-redis-coordination/collect-confidence-scores.sh +30 -0
- package/.claude/skills/cfn-redis-coordination/get-context.sh +33 -0
- 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/test-e2e.sh +15 -0
- package/.claude/skills/cfn-transparency-middleware/tests/input-validation.sh +15 -0
- 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-lint-sql-injection.sh +61 -0
- package/claude-assets/hooks/cfn-post-edit-cfn-retrospective.sh +33 -2
- package/claude-assets/hooks/cfn-pre-edit-security-warning.sh +40 -0
- 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 +84 -113
- package/claude-assets/skills/agent-lifecycle/simple-audit.sh +33 -6
- 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/test-memory-persistence.sh +17 -16
- 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-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-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-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-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 +2 -2
- package/claude-assets/skills/cfn-redis-coordination/collect-confidence-scores.sh +30 -0
- package/claude-assets/skills/cfn-redis-coordination/get-context.sh +33 -0
- 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-skill-loader/SKILL.md +466 -0
- package/claude-assets/skills/cfn-skill-loader/execute.sh +344 -0
- package/claude-assets/skills/cfn-sqlite-memory/ttl-cleanup.sh +17 -25
- 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-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/test-e2e.sh +15 -0
- package/claude-assets/skills/cfn-transparency-middleware/tests/input-validation.sh +15 -0
- 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/integration/agent-handoff.sh +62 -64
- 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/DEPLOY_QUICK_REFERENCE.md +106 -0
- package/claude-assets/skills/workflow-codification/PROPAGATE_UPDATE_QUICK_REFERENCE.md +366 -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/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/test-integration.sh +15 -0
- package/claude-assets/skills/workflow-codification/test-metadata-update.sh +350 -0
- package/claude-assets/skills/workflow-codification/track-cost-savings.sh +55 -14
- package/claude-assets/skills/workflow-codification/track-cost-savings.sh.backup-1763392821 +445 -0
- package/claude-assets/skills/workflow-codification/track-edge-case.sh +27 -60
- 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/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 +1 -1
- package/dist/integration/DatabaseHandoff.js.map +1 -1
- 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.map +1 -1
- package/dist/lib/agent-output-validator.js.map +1 -1
- package/dist/lib/agent-workspace.js +281 -0
- package/dist/lib/agent-workspace.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.map +1 -1
- 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/edge-case.js +45 -0
- package/dist/types/edge-case.js.map +1 -0
- package/package.json +201 -177
- package/readme/README.md +19 -4
- 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/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/migrate-schema.sh +533 -0
- package/scripts/promote-staged-skills.sh +423 -0
- 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/agent-lifecycle/SKILL.md +0 -60
- package/.claude/skills/agent-lifecycle/execute-lifecycle-hook.sh +0 -573
- package/.claude/skills/agent-lifecycle/simple-audit.sh +0 -31
- 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,616 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: skill-loader
|
|
3
|
+
category: foundation
|
|
4
|
+
team: foundation
|
|
5
|
+
approval_level: auto
|
|
6
|
+
approval_criteria:
|
|
7
|
+
max_commands: 3
|
|
8
|
+
test_coverage: 0.95
|
|
9
|
+
no_external_calls: true
|
|
10
|
+
tags: [skill-loading, cache, foundation]
|
|
11
|
+
version: 1.0.0
|
|
12
|
+
owner: cfn-core
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Skill Loader - Bootstrap Skill
|
|
16
|
+
|
|
17
|
+
## Overview
|
|
18
|
+
Dynamic skill loading from database, skill cache management, and hash validation patterns. Enables runtime skill injection and adaptive specialization.
|
|
19
|
+
|
|
20
|
+
**⚠️ SECURITY NOTE:** This skill uses SQL queries with bash variable interpolation. While basic escaping (`${var//\'/\'\'}`) is applied, this pattern has limitations and should only be used with trusted inputs in controlled bootstrap environments. See database-connection.md for full security documentation.
|
|
21
|
+
|
|
22
|
+
## SQL Injection Protection
|
|
23
|
+
|
|
24
|
+
### Identifier Validation
|
|
25
|
+
```bash
|
|
26
|
+
# SQL INJECTION PROTECTION: Validate identifier before interpolation
|
|
27
|
+
validate_sql_identifier() {
|
|
28
|
+
local identifier="$1"
|
|
29
|
+
local identifier_type="${2:-identifier}"
|
|
30
|
+
|
|
31
|
+
# Strict validation: only allow safe SQL identifiers
|
|
32
|
+
# Pattern: starts with letter/underscore, contains only alphanumeric/underscore
|
|
33
|
+
if [[ ! "$identifier" =~ ^[a-zA-Z_][a-zA-Z0-9_]*$ ]]; then
|
|
34
|
+
echo "ERROR: Invalid $identifier_type '$identifier' - must match ^[a-zA-Z_][a-zA-Z0-9_]*$" >&2
|
|
35
|
+
return 1
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
return 0
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Database-Driven Skill Loading
|
|
43
|
+
|
|
44
|
+
### Load Skill from Database
|
|
45
|
+
```bash
|
|
46
|
+
#!/bin/bash
|
|
47
|
+
set -euo pipefail
|
|
48
|
+
|
|
49
|
+
load_skill_from_db() {
|
|
50
|
+
local db_path="$1"
|
|
51
|
+
local skill_name="$2"
|
|
52
|
+
local cache_dir="${3:-./.skill-cache}"
|
|
53
|
+
|
|
54
|
+
# Validate database exists
|
|
55
|
+
if [[ ! -f "$db_path" ]]; then
|
|
56
|
+
echo "ERROR: Database not found: $db_path" >&2
|
|
57
|
+
return 1
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
# SQL INJECTION PREVENTION: Validate skill name before query
|
|
61
|
+
validate_sql_identifier "$skill_name" "skill name" || return 1
|
|
62
|
+
|
|
63
|
+
# Query skill content (validated identifier - safe to interpolate)
|
|
64
|
+
local skill_content
|
|
65
|
+
skill_content=$(sqlite3 "$db_path" <<EOF
|
|
66
|
+
SELECT content FROM skills WHERE name = '${skill_name//\'/\'\'}' LIMIT 1;
|
|
67
|
+
EOF
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
if [[ -z "$skill_content" ]]; then
|
|
71
|
+
echo "ERROR: Skill not found: $skill_name" >&2
|
|
72
|
+
return 1
|
|
73
|
+
fi
|
|
74
|
+
|
|
75
|
+
# Create cache directory
|
|
76
|
+
mkdir -p "$cache_dir"
|
|
77
|
+
|
|
78
|
+
# Write to cache file
|
|
79
|
+
local cache_file="${cache_dir}/${skill_name}.md"
|
|
80
|
+
echo "$skill_content" > "$cache_file"
|
|
81
|
+
|
|
82
|
+
echo "$cache_file"
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
# Usage
|
|
86
|
+
SKILL_FILE=$(load_skill_from_db "./data/skills.db" "database-connection")
|
|
87
|
+
echo "Loaded skill: $SKILL_FILE"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Load Multiple Skills
|
|
91
|
+
```bash
|
|
92
|
+
load_skills_batch() {
|
|
93
|
+
local db_path="$1"
|
|
94
|
+
local cache_dir="${2:-./.skill-cache}"
|
|
95
|
+
shift 2
|
|
96
|
+
local skill_names=("$@")
|
|
97
|
+
|
|
98
|
+
local -a loaded_skills=()
|
|
99
|
+
local -a failed_skills=()
|
|
100
|
+
|
|
101
|
+
for skill_name in "${skill_names[@]}"; do
|
|
102
|
+
if skill_file=$(load_skill_from_db "$db_path" "$skill_name" "$cache_dir" 2>/dev/null); then
|
|
103
|
+
loaded_skills+=("$skill_file")
|
|
104
|
+
echo "Loaded: $skill_name"
|
|
105
|
+
else
|
|
106
|
+
failed_skills+=("$skill_name")
|
|
107
|
+
echo "Failed: $skill_name" >&2
|
|
108
|
+
fi
|
|
109
|
+
done
|
|
110
|
+
|
|
111
|
+
if [[ ${#failed_skills[@]} -gt 0 ]]; then
|
|
112
|
+
echo "ERROR: Failed to load ${#failed_skills[@]} skills: ${failed_skills[*]}" >&2
|
|
113
|
+
return 1
|
|
114
|
+
fi
|
|
115
|
+
|
|
116
|
+
printf '%s\n' "${loaded_skills[@]}"
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
# Usage
|
|
120
|
+
SKILLS=("database-connection" "error-handling" "bash-fundamentals")
|
|
121
|
+
load_skills_batch "./data/skills.db" "./.skill-cache" "${SKILLS[@]}"
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Query Skills by Category
|
|
125
|
+
```bash
|
|
126
|
+
load_skills_by_category() {
|
|
127
|
+
local db_path="$1"
|
|
128
|
+
local category="$2"
|
|
129
|
+
local cache_dir="${3:-./.skill-cache}"
|
|
130
|
+
|
|
131
|
+
# SQL INJECTION PREVENTION: Validate category name before query
|
|
132
|
+
validate_sql_identifier "$category" "category name" || return 1
|
|
133
|
+
|
|
134
|
+
# Get skill names in category (validated identifier - safe to interpolate)
|
|
135
|
+
local skill_names
|
|
136
|
+
skill_names=$(sqlite3 "$db_path" <<EOF
|
|
137
|
+
SELECT name FROM skills WHERE category = '${category//\'/\'\'}' ORDER BY name;
|
|
138
|
+
EOF
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
if [[ -z "$skill_names" ]]; then
|
|
142
|
+
echo "WARNING: No skills found in category: $category" >&2
|
|
143
|
+
return 0
|
|
144
|
+
fi
|
|
145
|
+
|
|
146
|
+
# Load each skill
|
|
147
|
+
local -a loaded_skills=()
|
|
148
|
+
while IFS= read -r skill_name; do
|
|
149
|
+
if skill_file=$(load_skill_from_db "$db_path" "$skill_name" "$cache_dir"); then
|
|
150
|
+
loaded_skills+=("$skill_file")
|
|
151
|
+
fi
|
|
152
|
+
done <<< "$skill_names"
|
|
153
|
+
|
|
154
|
+
printf '%s\n' "${loaded_skills[@]}"
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
# Usage
|
|
158
|
+
load_skills_by_category "./data/skills.db" "foundation" "./.skill-cache"
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Skill Cache Management
|
|
162
|
+
|
|
163
|
+
### Cache Initialization
|
|
164
|
+
```bash
|
|
165
|
+
initialize_skill_cache() {
|
|
166
|
+
local cache_dir="${1:-./.skill-cache}"
|
|
167
|
+
local max_age_seconds="${2:-86400}" # Default 24 hours
|
|
168
|
+
|
|
169
|
+
# Create cache directory
|
|
170
|
+
mkdir -p "$cache_dir"
|
|
171
|
+
|
|
172
|
+
# Create cache metadata file
|
|
173
|
+
local metadata_file="${cache_dir}/.cache-metadata"
|
|
174
|
+
cat > "$metadata_file" <<EOF
|
|
175
|
+
{
|
|
176
|
+
"initialized_at": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")",
|
|
177
|
+
"max_age_seconds": $max_age_seconds,
|
|
178
|
+
"version": "1.0.0"
|
|
179
|
+
}
|
|
180
|
+
EOF
|
|
181
|
+
|
|
182
|
+
echo "Cache initialized: $cache_dir"
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Cache Invalidation
|
|
187
|
+
```bash
|
|
188
|
+
invalidate_skill_cache() {
|
|
189
|
+
local cache_dir="${1:-./.skill-cache}"
|
|
190
|
+
local skill_name="${2:-}"
|
|
191
|
+
|
|
192
|
+
if [[ -z "$skill_name" ]]; then
|
|
193
|
+
# Invalidate entire cache
|
|
194
|
+
echo "Invalidating entire cache: $cache_dir"
|
|
195
|
+
rm -rf "$cache_dir"
|
|
196
|
+
mkdir -p "$cache_dir"
|
|
197
|
+
else
|
|
198
|
+
# Invalidate specific skill
|
|
199
|
+
local cache_file="${cache_dir}/${skill_name}.md"
|
|
200
|
+
if [[ -f "$cache_file" ]]; then
|
|
201
|
+
echo "Invalidating cached skill: $skill_name"
|
|
202
|
+
rm -f "$cache_file"
|
|
203
|
+
fi
|
|
204
|
+
fi
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Cache Cleanup (Age-Based)
|
|
209
|
+
```bash
|
|
210
|
+
cleanup_skill_cache() {
|
|
211
|
+
local cache_dir="${1:-./.skill-cache}"
|
|
212
|
+
local max_age_seconds="${2:-86400}" # Default 24 hours
|
|
213
|
+
|
|
214
|
+
if [[ ! -d "$cache_dir" ]]; then
|
|
215
|
+
echo "Cache directory does not exist: $cache_dir"
|
|
216
|
+
return 0
|
|
217
|
+
fi
|
|
218
|
+
|
|
219
|
+
local current_time=$(date +%s)
|
|
220
|
+
local removed_count=0
|
|
221
|
+
|
|
222
|
+
# Find and remove old cache files
|
|
223
|
+
while IFS= read -r -d '' file; do
|
|
224
|
+
local file_time=$(stat -f%m "$file" 2>/dev/null || stat -c%Y "$file")
|
|
225
|
+
local age=$((current_time - file_time))
|
|
226
|
+
|
|
227
|
+
if [[ $age -gt $max_age_seconds ]]; then
|
|
228
|
+
echo "Removing stale cache file: $(basename "$file") (age: ${age}s)"
|
|
229
|
+
rm -f "$file"
|
|
230
|
+
((removed_count++))
|
|
231
|
+
fi
|
|
232
|
+
done < <(find "$cache_dir" -type f -name "*.md" -print0)
|
|
233
|
+
|
|
234
|
+
echo "Removed $removed_count stale cache files"
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Cache Statistics
|
|
239
|
+
```bash
|
|
240
|
+
get_cache_stats() {
|
|
241
|
+
local cache_dir="${1:-./.skill-cache}"
|
|
242
|
+
|
|
243
|
+
if [[ ! -d "$cache_dir" ]]; then
|
|
244
|
+
echo "Cache directory does not exist: $cache_dir"
|
|
245
|
+
return 1
|
|
246
|
+
fi
|
|
247
|
+
|
|
248
|
+
local total_files=$(find "$cache_dir" -type f -name "*.md" | wc -l)
|
|
249
|
+
local total_size=$(du -sb "$cache_dir" 2>/dev/null | cut -f1)
|
|
250
|
+
local cache_age=0
|
|
251
|
+
|
|
252
|
+
local metadata_file="${cache_dir}/.cache-metadata"
|
|
253
|
+
if [[ -f "$metadata_file" ]]; then
|
|
254
|
+
local init_time=$(jq -r '.initialized_at' "$metadata_file" 2>/dev/null || echo "unknown")
|
|
255
|
+
echo "Cache Statistics:"
|
|
256
|
+
echo " Directory: $cache_dir"
|
|
257
|
+
echo " Initialized: $init_time"
|
|
258
|
+
echo " Total files: $total_files"
|
|
259
|
+
echo " Total size: $total_size bytes"
|
|
260
|
+
fi
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## Hash Validation
|
|
265
|
+
|
|
266
|
+
### Compute Content Hash
|
|
267
|
+
```bash
|
|
268
|
+
compute_content_hash() {
|
|
269
|
+
local content="$1"
|
|
270
|
+
local algorithm="${2:-sha256}"
|
|
271
|
+
|
|
272
|
+
case "$algorithm" in
|
|
273
|
+
md5)
|
|
274
|
+
echo -n "$content" | md5sum | cut -d' ' -f1
|
|
275
|
+
;;
|
|
276
|
+
sha256)
|
|
277
|
+
echo -n "$content" | sha256sum | cut -d' ' -f1
|
|
278
|
+
;;
|
|
279
|
+
*)
|
|
280
|
+
echo "ERROR: Unsupported hash algorithm: $algorithm" >&2
|
|
281
|
+
return 1
|
|
282
|
+
;;
|
|
283
|
+
esac
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
compute_file_content_hash() {
|
|
287
|
+
local file_path="$1"
|
|
288
|
+
local algorithm="${2:-sha256}"
|
|
289
|
+
|
|
290
|
+
if [[ ! -f "$file_path" ]]; then
|
|
291
|
+
echo "ERROR: File not found: $file_path" >&2
|
|
292
|
+
return 1
|
|
293
|
+
fi
|
|
294
|
+
|
|
295
|
+
case "$algorithm" in
|
|
296
|
+
md5)
|
|
297
|
+
md5sum "$file_path" | cut -d' ' -f1
|
|
298
|
+
;;
|
|
299
|
+
sha256)
|
|
300
|
+
sha256sum "$file_path" | cut -d' ' -f1
|
|
301
|
+
;;
|
|
302
|
+
*)
|
|
303
|
+
echo "ERROR: Unsupported hash algorithm: $algorithm" >&2
|
|
304
|
+
return 1
|
|
305
|
+
;;
|
|
306
|
+
esac
|
|
307
|
+
}
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### Validate Skill Hash
|
|
311
|
+
```bash
|
|
312
|
+
validate_skill_hash() {
|
|
313
|
+
local db_path="$1"
|
|
314
|
+
local skill_name="$2"
|
|
315
|
+
local cache_file="$3"
|
|
316
|
+
|
|
317
|
+
# SQL INJECTION PREVENTION: Validate skill name before query
|
|
318
|
+
validate_sql_identifier "$skill_name" "skill name" || return 1
|
|
319
|
+
|
|
320
|
+
# Get stored hash from database (validated identifier - safe to interpolate)
|
|
321
|
+
local stored_hash
|
|
322
|
+
stored_hash=$(sqlite3 "$db_path" <<EOF
|
|
323
|
+
SELECT hash FROM skills WHERE name = '${skill_name//\'/\'\'}' LIMIT 1;
|
|
324
|
+
EOF
|
|
325
|
+
)
|
|
326
|
+
|
|
327
|
+
if [[ -z "$stored_hash" ]]; then
|
|
328
|
+
echo "WARNING: No hash found for skill: $skill_name" >&2
|
|
329
|
+
return 0 # No hash to validate
|
|
330
|
+
fi
|
|
331
|
+
|
|
332
|
+
# Compute hash of cached file
|
|
333
|
+
local actual_hash
|
|
334
|
+
actual_hash=$(compute_file_content_hash "$cache_file" "sha256")
|
|
335
|
+
|
|
336
|
+
if [[ "$actual_hash" != "$stored_hash" ]]; then
|
|
337
|
+
echo "ERROR: Hash mismatch for skill: $skill_name" >&2
|
|
338
|
+
echo " Expected: $stored_hash" >&2
|
|
339
|
+
echo " Actual: $actual_hash" >&2
|
|
340
|
+
return 1
|
|
341
|
+
fi
|
|
342
|
+
|
|
343
|
+
echo "Hash validated: $skill_name"
|
|
344
|
+
return 0
|
|
345
|
+
}
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
### Update Skill Hash in Database
|
|
349
|
+
```bash
|
|
350
|
+
update_skill_hash() {
|
|
351
|
+
local db_path="$1"
|
|
352
|
+
local skill_name="$2"
|
|
353
|
+
local skill_content="$3"
|
|
354
|
+
|
|
355
|
+
# SQL INJECTION PREVENTION: Validate skill name before query
|
|
356
|
+
validate_sql_identifier "$skill_name" "skill name" || return 1
|
|
357
|
+
|
|
358
|
+
# Compute hash of new content
|
|
359
|
+
local new_hash
|
|
360
|
+
new_hash=$(compute_content_hash "$skill_content" "sha256")
|
|
361
|
+
|
|
362
|
+
# Update hash in database (validated identifier - safe to interpolate)
|
|
363
|
+
sqlite3 "$db_path" <<EOF
|
|
364
|
+
UPDATE skills SET hash = '$new_hash' WHERE name = '${skill_name//\'/\'\'}';
|
|
365
|
+
EOF
|
|
366
|
+
|
|
367
|
+
echo "Updated hash for skill: $skill_name ($new_hash)"
|
|
368
|
+
}
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
## Skill Loading with Validation
|
|
372
|
+
|
|
373
|
+
### Load and Validate Skill
|
|
374
|
+
```bash
|
|
375
|
+
load_and_validate_skill() {
|
|
376
|
+
local db_path="$1"
|
|
377
|
+
local skill_name="$2"
|
|
378
|
+
local cache_dir="${3:-./.skill-cache}"
|
|
379
|
+
local validate_hash="${4:-true}"
|
|
380
|
+
|
|
381
|
+
# Load skill from database
|
|
382
|
+
local cache_file
|
|
383
|
+
cache_file=$(load_skill_from_db "$db_path" "$skill_name" "$cache_dir") || return 1
|
|
384
|
+
|
|
385
|
+
# Validate hash if requested
|
|
386
|
+
if [[ "$validate_hash" == "true" ]]; then
|
|
387
|
+
if ! validate_skill_hash "$db_path" "$skill_name" "$cache_file"; then
|
|
388
|
+
echo "ERROR: Hash validation failed, removing cached file" >&2
|
|
389
|
+
rm -f "$cache_file"
|
|
390
|
+
return 1
|
|
391
|
+
fi
|
|
392
|
+
fi
|
|
393
|
+
|
|
394
|
+
echo "$cache_file"
|
|
395
|
+
}
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
### Load Skills with Dependency Resolution
|
|
399
|
+
```bash
|
|
400
|
+
load_skills_with_dependencies() {
|
|
401
|
+
local db_path="$1"
|
|
402
|
+
local skill_name="$2"
|
|
403
|
+
local cache_dir="${3:-./.skill-cache}"
|
|
404
|
+
|
|
405
|
+
local -a loaded_skills=()
|
|
406
|
+
local -a skill_queue=("$skill_name")
|
|
407
|
+
local -A processed_skills=()
|
|
408
|
+
|
|
409
|
+
while [[ ${#skill_queue[@]} -gt 0 ]]; do
|
|
410
|
+
local current_skill="${skill_queue[0]}"
|
|
411
|
+
skill_queue=("${skill_queue[@]:1}") # Remove first element
|
|
412
|
+
|
|
413
|
+
# Skip if already processed
|
|
414
|
+
[[ -n "${processed_skills[$current_skill]:-}" ]] && continue
|
|
415
|
+
processed_skills[$current_skill]=1
|
|
416
|
+
|
|
417
|
+
# Load skill
|
|
418
|
+
local cache_file
|
|
419
|
+
cache_file=$(load_and_validate_skill "$db_path" "$current_skill" "$cache_dir") || {
|
|
420
|
+
echo "ERROR: Failed to load skill: $current_skill" >&2
|
|
421
|
+
return 1
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
loaded_skills+=("$cache_file")
|
|
425
|
+
|
|
426
|
+
# Get dependencies (if any)
|
|
427
|
+
local dependencies
|
|
428
|
+
dependencies=$(sqlite3 "$db_path" <<EOF
|
|
429
|
+
SELECT depends_on FROM skill_dependencies WHERE skill_name = '${current_skill//\'/\'\'}';
|
|
430
|
+
EOF
|
|
431
|
+
)
|
|
432
|
+
|
|
433
|
+
# Add dependencies to queue
|
|
434
|
+
while IFS= read -r dep; do
|
|
435
|
+
[[ -z "$dep" ]] && continue
|
|
436
|
+
skill_queue+=("$dep")
|
|
437
|
+
done <<< "$dependencies"
|
|
438
|
+
done
|
|
439
|
+
|
|
440
|
+
printf '%s\n' "${loaded_skills[@]}"
|
|
441
|
+
}
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
## Agent Context Injection
|
|
445
|
+
|
|
446
|
+
### Build Skill Context for Agent
|
|
447
|
+
```bash
|
|
448
|
+
build_agent_skill_context() {
|
|
449
|
+
local db_path="$1"
|
|
450
|
+
local agent_type="$2"
|
|
451
|
+
local cache_dir="${3:-./.skill-cache}"
|
|
452
|
+
|
|
453
|
+
# SQL INJECTION PREVENTION: Validate agent type before query
|
|
454
|
+
validate_sql_identifier "$agent_type" "agent type" || return 1
|
|
455
|
+
|
|
456
|
+
# Get required skills for agent type (validated identifier - safe to interpolate)
|
|
457
|
+
local skill_names
|
|
458
|
+
skill_names=$(sqlite3 "$db_path" <<EOF
|
|
459
|
+
SELECT s.name
|
|
460
|
+
FROM skills s
|
|
461
|
+
JOIN agent_skills a ON s.id = a.skill_id
|
|
462
|
+
JOIN agents ag ON a.agent_id = ag.id
|
|
463
|
+
WHERE ag.type = '${agent_type//\'/\'\'}'
|
|
464
|
+
ORDER BY a.priority;
|
|
465
|
+
EOF
|
|
466
|
+
)
|
|
467
|
+
|
|
468
|
+
if [[ -z "$skill_names" ]]; then
|
|
469
|
+
echo "WARNING: No skills configured for agent type: $agent_type" >&2
|
|
470
|
+
return 0
|
|
471
|
+
fi
|
|
472
|
+
|
|
473
|
+
local skill_context=""
|
|
474
|
+
|
|
475
|
+
# Load each skill and concatenate
|
|
476
|
+
while IFS= read -r skill_name; do
|
|
477
|
+
local cache_file
|
|
478
|
+
if cache_file=$(load_and_validate_skill "$db_path" "$skill_name" "$cache_dir"); then
|
|
479
|
+
skill_context+=$'\n\n'
|
|
480
|
+
skill_context+="# Skill: $skill_name"
|
|
481
|
+
skill_context+=$'\n\n'
|
|
482
|
+
skill_context+=$(cat "$cache_file")
|
|
483
|
+
fi
|
|
484
|
+
done <<< "$skill_names"
|
|
485
|
+
|
|
486
|
+
echo "$skill_context"
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
# Usage
|
|
490
|
+
AGENT_CONTEXT=$(build_agent_skill_context "./data/skills.db" "backend-developer")
|
|
491
|
+
echo "Agent context built (${#AGENT_CONTEXT} chars)"
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
### Inject Skills into Agent Prompt
|
|
495
|
+
```bash
|
|
496
|
+
inject_skills_into_prompt() {
|
|
497
|
+
local base_prompt="$1"
|
|
498
|
+
local skill_context="$2"
|
|
499
|
+
|
|
500
|
+
# Create enhanced prompt
|
|
501
|
+
cat <<EOF
|
|
502
|
+
$base_prompt
|
|
503
|
+
|
|
504
|
+
## Specialized Skills
|
|
505
|
+
|
|
506
|
+
The following skills are available for this agent:
|
|
507
|
+
|
|
508
|
+
$skill_context
|
|
509
|
+
|
|
510
|
+
---
|
|
511
|
+
|
|
512
|
+
Use these skills to guide your work and ensure best practices.
|
|
513
|
+
EOF
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
# Usage
|
|
517
|
+
BASE_PROMPT=$(cat agent-base-prompt.txt)
|
|
518
|
+
SKILL_CONTEXT=$(build_agent_skill_context "./data/skills.db" "backend-developer")
|
|
519
|
+
ENHANCED_PROMPT=$(inject_skills_into_prompt "$BASE_PROMPT" "$SKILL_CONTEXT")
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
## Performance Optimization
|
|
523
|
+
|
|
524
|
+
### Preload Bootstrap Skills
|
|
525
|
+
```bash
|
|
526
|
+
preload_bootstrap_skills() {
|
|
527
|
+
local db_path="$1"
|
|
528
|
+
local cache_dir="${2:-./.skill-cache}"
|
|
529
|
+
|
|
530
|
+
# Bootstrap skills that should always be loaded
|
|
531
|
+
local -a bootstrap_skills=(
|
|
532
|
+
"database-connection"
|
|
533
|
+
"error-handling"
|
|
534
|
+
"bash-fundamentals"
|
|
535
|
+
"file-operations"
|
|
536
|
+
"skill-loader"
|
|
537
|
+
)
|
|
538
|
+
|
|
539
|
+
echo "Preloading ${#bootstrap_skills[@]} bootstrap skills..."
|
|
540
|
+
|
|
541
|
+
local start_time=$(date +%s)
|
|
542
|
+
|
|
543
|
+
if load_skills_batch "$db_path" "$cache_dir" "${bootstrap_skills[@]}"; then
|
|
544
|
+
local end_time=$(date +%s)
|
|
545
|
+
local duration=$((end_time - start_time))
|
|
546
|
+
echo "Bootstrap skills loaded in ${duration}s"
|
|
547
|
+
return 0
|
|
548
|
+
else
|
|
549
|
+
echo "ERROR: Failed to preload bootstrap skills" >&2
|
|
550
|
+
return 1
|
|
551
|
+
fi
|
|
552
|
+
}
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
### Parallel Skill Loading
|
|
556
|
+
```bash
|
|
557
|
+
load_skills_parallel() {
|
|
558
|
+
local db_path="$1"
|
|
559
|
+
local cache_dir="${2:-./.skill-cache}"
|
|
560
|
+
shift 2
|
|
561
|
+
local skill_names=("$@")
|
|
562
|
+
|
|
563
|
+
local load_timeout="${SKILL_LOAD_TIMEOUT:-30}" # Default 30 seconds
|
|
564
|
+
|
|
565
|
+
local -a pids=()
|
|
566
|
+
|
|
567
|
+
# Load skills in parallel with timeout protection
|
|
568
|
+
for skill_name in "${skill_names[@]}"; do
|
|
569
|
+
(
|
|
570
|
+
timeout "$load_timeout" load_and_validate_skill "$db_path" "$skill_name" "$cache_dir" &>/dev/null
|
|
571
|
+
local exit_code=$?
|
|
572
|
+
if [[ $exit_code -eq 124 ]]; then
|
|
573
|
+
echo "ERROR: Skill load timeout after ${load_timeout}s: $skill_name" >&2
|
|
574
|
+
exit 124
|
|
575
|
+
fi
|
|
576
|
+
exit $exit_code
|
|
577
|
+
) &
|
|
578
|
+
pids+=($!)
|
|
579
|
+
done
|
|
580
|
+
|
|
581
|
+
# Wait for all loads to complete
|
|
582
|
+
local failed=0
|
|
583
|
+
local timeout_failures=0
|
|
584
|
+
for pid in "${pids[@]}"; do
|
|
585
|
+
wait "$pid"
|
|
586
|
+
local exit_code=$?
|
|
587
|
+
if [[ $exit_code -ne 0 ]]; then
|
|
588
|
+
((failed++))
|
|
589
|
+
if [[ $exit_code -eq 124 ]]; then
|
|
590
|
+
((timeout_failures++))
|
|
591
|
+
fi
|
|
592
|
+
fi
|
|
593
|
+
done
|
|
594
|
+
|
|
595
|
+
if [[ $failed -gt 0 ]]; then
|
|
596
|
+
echo "ERROR: $failed skills failed to load (${timeout_failures} timeouts)" >&2
|
|
597
|
+
return 1
|
|
598
|
+
fi
|
|
599
|
+
|
|
600
|
+
echo "All ${#skill_names[@]} skills loaded successfully"
|
|
601
|
+
}
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
## Success Criteria
|
|
605
|
+
|
|
606
|
+
- ✅ Dynamic skill loading from SQLite database
|
|
607
|
+
- ✅ Skill cache initialization and management
|
|
608
|
+
- ✅ Age-based cache cleanup and invalidation
|
|
609
|
+
- ✅ SHA-256 hash validation for content integrity
|
|
610
|
+
- ✅ Dependency resolution for skill loading
|
|
611
|
+
- ✅ Agent-specific skill context building
|
|
612
|
+
- ✅ Skill injection into agent prompts
|
|
613
|
+
- ✅ Bootstrap skill preloading
|
|
614
|
+
- ✅ Parallel skill loading for performance
|
|
615
|
+
- ✅ Cache statistics and monitoring
|
|
616
|
+
- ✅ Error handling for missing or invalid skills
|