claude-flow-novice 1.6.1 → 1.6.3
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/agents/cfn-loop/product-owner.md +54 -4
- package/.claude/commands/cfn-claude-sync.md +303 -0
- package/.claude/commands/cfn-loop-epic.md +290 -0
- package/.claude/commands/cfn-loop-single.md +168 -0
- package/.claude/commands/cfn-loop-sprints.md +384 -0
- package/.claude/commands/cfn-loop.md +180 -0
- package/.claude/commands/metrics-summary.md +58 -0
- package/.claude/commands/parse-epic.md +357 -0
- package/.claude/settings.json +5 -4
- package/.claude/settings.local.json +9 -2
- package/.claude-flow-novice/.claude/agents/cfn-loop/product-owner.md +792 -0
- package/.claude-flow-novice/dist/mcp/server.js +21 -2
- package/.claude-flow-novice/dist/src/api/auth-service.js +84 -38
- package/.claude-flow-novice/dist/src/api/auth-service.js.map +1 -1
- package/.claude-flow-novice/dist/src/api/claude-client.js +138 -3
- package/.claude-flow-novice/dist/src/api/claude-client.js.map +1 -1
- package/.claude-flow-novice/dist/src/cfn-loop/phase-orchestrator-example.js +1 -1
- package/.claude-flow-novice/dist/src/cfn-loop/scope-control.js +247 -0
- package/.claude-flow-novice/dist/src/cfn-loop/scope-control.js.map +1 -0
- package/.claude-flow-novice/dist/src/cli/commands/swarm.js +32 -15
- package/.claude-flow-novice/dist/src/cli/commands/swarm.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/transparency.js +455 -0
- package/.claude-flow-novice/dist/src/cli/commands/transparency.js.map +1 -0
- package/.claude-flow-novice/dist/src/cli/simple-commands/init/templates/CLAUDE.md +129 -13
- package/.claude-flow-novice/dist/src/components/visualizations/index.js +9 -0
- package/.claude-flow-novice/dist/src/components/visualizations/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js +462 -0
- package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/config-translator.js +248 -0
- package/.claude-flow-novice/dist/src/coordination/config-translator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js +287 -0
- package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/distributed-consensus.js +68 -9
- package/.claude-flow-novice/dist/src/coordination/distributed-consensus.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/feature-flags.js +166 -0
- package/.claude-flow-novice/dist/src/coordination/feature-flags.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/queen-agent.js +18 -4
- package/.claude-flow-novice/dist/src/coordination/queen-agent.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/role-assignment.js +6 -110
- package/.claude-flow-novice/dist/src/coordination/role-assignment.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/cache/artifact-cache-optimizer.js +632 -0
- package/.claude-flow-novice/dist/src/coordination/v2/cache/artifact-cache-optimizer.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/cache/index.js +11 -0
- package/.claude-flow-novice/dist/src/coordination/v2/cache/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/checkpoints/checkpoint-compressor.js +318 -0
- package/.claude-flow-novice/dist/src/coordination/v2/checkpoints/checkpoint-compressor.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.example.js +364 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.example.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.js +492 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/hierarchical-coordinator.js +786 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/hierarchical-coordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/index.js +16 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/parent-child-manager.js +342 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/parent-child-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/swarm-coordinator-v2.js +601 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/swarm-coordinator-v2.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/help-request-metrics.js +211 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/help-request-metrics.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/index.js +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/index.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/core/message-broker.js +365 -6
- package/.claude-flow-novice/dist/src/coordination/v2/core/message-broker.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/core/resource-manager-safe.js +478 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/resource-manager-safe.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine-config.js +5 -2
- package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine-config.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine.js +189 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/deadlock-detector.js +424 -0
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/deadlock-detector.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/index.js +9 -0
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/resource-manager.js +669 -0
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/resource-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/artifact-storage.js +451 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/artifact-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/cycle-detector.js +271 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/cycle-detector.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-graph.js +335 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-graph.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-manager.js +439 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-request.js +92 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-request.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/index.js +21 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/topological-sort.js +223 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/topological-sort.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-coordinator.js +436 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-coordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-matcher.js +278 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-matcher.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request-handler.js +317 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request-handler.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request.js +273 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/index.js +15 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/waiting-agent-pool.js +512 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/waiting-agent-pool.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/index.js +6 -0
- package/.claude-flow-novice/dist/src/coordination/v2/index.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/integration/help-deadlock-integration.js +557 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/help-deadlock-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/index.js +14 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.example.js +212 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.example.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.js +552 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/memory/dependency-storage.js +367 -0
- package/.claude-flow-novice/dist/src/coordination/v2/memory/dependency-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/memory/index.js +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/memory/index.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channel.js +371 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/dependency-channel.js +355 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/dependency-channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/help-channel.js +424 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/help-channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/index.js +16 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/state-channel.js +295 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/state-channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/task-channel.js +411 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/task-channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/index.js +14 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-bus.js +387 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-bus.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-persistence.js +589 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-persistence.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-router.js +444 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-router.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/checkpoint-manager.js +29 -8
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/checkpoint-manager.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/help-coordinator.js +470 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/help-coordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/hierarchical-background-integration.js +450 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/hierarchical-background-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/index.js +5 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/index.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/multi-level-control.js +545 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/multi-level-control.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-controller.js +44 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-controller.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-message-integration.js +415 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-message-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/session-pool-optimizer.js +615 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/session-pool-optimizer.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/security/payload-validator.js +259 -0
- package/.claude-flow-novice/dist/src/coordination/v2/security/payload-validator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/index.js +17 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-integration.js +357 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-system.js +679 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-system.js.map +1 -0
- package/.claude-flow-novice/dist/src/core/agent-manager.js +30 -0
- package/.claude-flow-novice/dist/src/core/agent-manager.js.map +1 -1
- package/.claude-flow-novice/dist/src/mcp/server.js +21 -2
- package/.claude-flow-novice/dist/src/mcp/server.js.map +1 -1
- package/.claude-flow-novice/dist/src/monitoring/apm/apm-integration.js +719 -0
- package/.claude-flow-novice/dist/src/monitoring/apm/apm-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/monitoring/apm/datadog-collector.js +363 -0
- package/.claude-flow-novice/dist/src/monitoring/apm/datadog-collector.js.map +1 -0
- package/.claude-flow-novice/dist/src/monitoring/apm/index.js +97 -0
- package/.claude-flow-novice/dist/src/monitoring/apm/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/monitoring/apm/newrelic-collector.js +384 -0
- package/.claude-flow-novice/dist/src/monitoring/apm/newrelic-collector.js.map +1 -0
- package/.claude-flow-novice/dist/src/monitoring/apm/performance-optimizer.js +612 -0
- package/.claude-flow-novice/dist/src/monitoring/apm/performance-optimizer.js.map +1 -0
- package/.claude-flow-novice/dist/src/monitoring/metrics-collector.js +282 -0
- package/.claude-flow-novice/dist/src/monitoring/metrics-collector.js.map +1 -0
- package/.claude-flow-novice/dist/src/observability/metrics-counter.js +268 -0
- package/.claude-flow-novice/dist/src/observability/metrics-counter.js.map +1 -0
- package/.claude-flow-novice/dist/src/observability/metrics-storage.js +265 -0
- package/.claude-flow-novice/dist/src/observability/metrics-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/observability/telemetry.js +26 -0
- package/.claude-flow-novice/dist/src/observability/telemetry.js.map +1 -1
- package/.claude-flow-novice/dist/src/providers/tiered-router.js +64 -10
- package/.claude-flow-novice/dist/src/providers/tiered-router.js.map +1 -1
- package/.claude-flow-novice/dist/src/providers/zai-provider.js +196 -97
- package/.claude-flow-novice/dist/src/providers/zai-provider.js.map +1 -1
- package/.claude-flow-novice/dist/src/slash-commands/cfn-claude-sync.js +533 -0
- package/.claude-flow-novice/dist/src/slash-commands/index.js +5 -0
- package/.claude-flow-novice/dist/src/slash-commands/metrics-summary-class.js +74 -0
- package/.claude-flow-novice/dist/src/slash-commands/metrics-summary.js +335 -0
- package/.claude-flow-novice/dist/src/slash-commands/register-all-commands.js +12 -0
- package/.claude-flow-novice/dist/src/verification/checkpoint-compression-demo.js +96 -0
- package/.claude-flow-novice/dist/src/verification/checkpoint-compression-demo.js.map +1 -0
- package/.claude-flow-novice/dist/src/verification/checkpoint-compression.js +406 -0
- package/.claude-flow-novice/dist/src/verification/checkpoint-compression.js.map +1 -0
- package/.claude-flow-novice/dist/src/verification/checkpoint-manager.js +35 -5
- package/.claude-flow-novice/dist/src/verification/checkpoint-manager.js.map +1 -1
- package/.claude-flow-novice/dist/src/web/api/apm-routes.js +355 -0
- package/.claude-flow-novice/dist/src/web/api/apm-routes.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/config/api-config.js +186 -0
- package/.claude-flow-novice/dist/src/web/api/config/api-config.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/auth.js +205 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/auth.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/cache.js +262 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/cache.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/error-handler.js +250 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/error-handler.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/request-logger.js +217 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/request-logger.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/validation.js +325 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/validation.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/routes/events.js +465 -0
- package/.claude-flow-novice/dist/src/web/api/routes/events.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/routes/hierarchy.js +302 -0
- package/.claude-flow-novice/dist/src/web/api/routes/hierarchy.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/routes/index.js +14 -0
- package/.claude-flow-novice/dist/src/web/api/routes/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/routes/metrics.js +561 -0
- package/.claude-flow-novice/dist/src/web/api/routes/metrics.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/routes/status.js +450 -0
- package/.claude-flow-novice/dist/src/web/api/routes/status.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/server.js +451 -0
- package/.claude-flow-novice/dist/src/web/api/server.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/dashboard/hooks/useWebSocket.js +385 -0
- package/.claude-flow-novice/dist/src/web/dashboard/hooks/useWebSocket.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/dashboard/index.js +87 -0
- package/.claude-flow-novice/dist/src/web/dashboard/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/dashboard/types.js +6 -0
- package/.claude-flow-novice/dist/src/web/dashboard/types.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/frontend/src/utils/security.js +425 -0
- package/.claude-flow-novice/dist/src/web/frontend/src/utils/security.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/security/security-middleware.js +379 -0
- package/.claude-flow-novice/dist/src/web/security/security-middleware.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/websocket/apm-websocket-handler.js +441 -0
- package/.claude-flow-novice/dist/src/web/websocket/apm-websocket-handler.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/websocket/websocket-manager.js +255 -1
- package/.claude-flow-novice/dist/src/web/websocket/websocket-manager.js.map +1 -1
- package/.claude-flow-novice/metrics.db +0 -0
- package/.claude-flow-novice/metrics.db-shm +0 -0
- package/.claude-flow-novice/metrics.db-wal +0 -0
- package/AGENT_PERFORMANCE_GUIDELINES.md +88 -0
- package/CLAUDE.md +60 -3
- package/MEMORY_LEAK_ROOT_CAUSE.md +149 -0
- package/README.md +27 -0
- package/config/hooks/post-edit-pipeline.js +36 -2
- package/examples/metrics-counter-demo.ts +106 -0
- package/examples/persistent-metrics-demo.ts +83 -0
- package/examples/phase-5-multi-level-control.ts +282 -0
- package/examples/session-pool-optimizer-example.ts +311 -0
- package/package.json +18 -4
- package/scripts/check-routing-stats.cjs +122 -0
- package/scripts/monitor-loop.sh +65 -0
- package/scripts/monitor-memory.sh +47 -0
- package/scripts/monitor.py +43 -0
- package/scripts/pre-publish-validation.cjs +212 -0
- package/scripts/test-provider-routing.cjs +228 -0
- package/scripts/test-routing-telemetry.cjs +147 -0
- package/scripts/test-zai-10k.cjs +81 -0
- package/scripts/test-zai-api.cjs +191 -0
- package/scripts/test-zai-diagnostic.cjs +151 -0
- package/scripts/test-zai-final.cjs +128 -0
- package/scripts/test-zai-with-env.cjs +85 -0
- package/scripts/validate-coordination-cli.js +69 -0
- package/scripts/validate-coordination-toggle-integration.cjs +501 -0
- package/src/cli/simple-commands/init/templates/CLAUDE.md +29 -0
- package/src/observability/metrics-counter.ts +347 -0
- package/src/observability/metrics-storage.ts +356 -0
- package/src/observability/telemetry.ts +658 -0
- package/src/slash-commands/cfn-claude-sync.js +533 -0
- package/src/slash-commands/index.js +5 -0
- package/src/slash-commands/metrics-summary-class.js +74 -0
- package/src/slash-commands/metrics-summary.js +335 -0
- package/src/slash-commands/register-all-commands.js +12 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check Provider Routing Statistics
|
|
3
|
+
*
|
|
4
|
+
* Queries telemetry to show routing breakdown from recent swarm execution
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { TelemetrySystem, getGlobalTelemetry } = require('../.claude-flow-novice/dist/src/observability/telemetry.js');
|
|
8
|
+
|
|
9
|
+
async function checkRoutingStats() {
|
|
10
|
+
console.log('📊 Provider Routing Statistics\n');
|
|
11
|
+
console.log('=' .repeat(60));
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
// Get global telemetry instance
|
|
15
|
+
const telemetry = getGlobalTelemetry();
|
|
16
|
+
|
|
17
|
+
// Query provider request metrics
|
|
18
|
+
const providerMetrics = telemetry.getMetrics('provider.request', 300000); // Last 5 minutes
|
|
19
|
+
|
|
20
|
+
if (providerMetrics.length === 0) {
|
|
21
|
+
console.log('\n⚠️ No routing metrics found in the last 5 minutes.');
|
|
22
|
+
console.log(' This may be because:');
|
|
23
|
+
console.log(' - Telemetry was initialized in a different process');
|
|
24
|
+
console.log(' - No tiered routing requests were made');
|
|
25
|
+
console.log(' - Metrics have expired (5 min window)');
|
|
26
|
+
console.log('\nTo test routing, run: node scripts/test-routing-telemetry.cjs\n');
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
console.log(`\n✅ Found ${providerMetrics.length} routing metrics\n`);
|
|
31
|
+
|
|
32
|
+
// Aggregate by provider
|
|
33
|
+
const providerBreakdown = {};
|
|
34
|
+
const tierBreakdown = {};
|
|
35
|
+
const agentTypeBreakdown = {};
|
|
36
|
+
const sourceBreakdown = {};
|
|
37
|
+
|
|
38
|
+
providerMetrics.forEach(metric => {
|
|
39
|
+
const provider = metric.tags.provider || 'unknown';
|
|
40
|
+
const tier = metric.tags.tier || 'unknown';
|
|
41
|
+
const agentType = metric.tags.agentType || 'unknown';
|
|
42
|
+
const source = metric.tags.source || 'unknown';
|
|
43
|
+
|
|
44
|
+
providerBreakdown[provider] = (providerBreakdown[provider] || 0) + metric.value;
|
|
45
|
+
tierBreakdown[tier] = (tierBreakdown[tier] || 0) + metric.value;
|
|
46
|
+
agentTypeBreakdown[agentType] = (agentTypeBreakdown[agentType] || 0) + metric.value;
|
|
47
|
+
sourceBreakdown[source] = (sourceBreakdown[source] || 0) + metric.value;
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Display results
|
|
51
|
+
console.log('📍 BY PROVIDER:');
|
|
52
|
+
console.log('-'.repeat(60));
|
|
53
|
+
Object.entries(providerBreakdown)
|
|
54
|
+
.sort((a, b) => b[1] - a[1])
|
|
55
|
+
.forEach(([provider, count]) => {
|
|
56
|
+
const percentage = ((count / providerMetrics.length) * 100).toFixed(1);
|
|
57
|
+
const providerName = provider === 'custom' ? 'Z.ai (free tier)' :
|
|
58
|
+
provider === 'anthropic' ? 'Anthropic API' : provider;
|
|
59
|
+
console.log(` ${providerName.padEnd(30)} ${count.toString().padStart(3)} requests (${percentage}%)`);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
console.log('\n🎯 BY TIER:');
|
|
63
|
+
console.log('-'.repeat(60));
|
|
64
|
+
Object.entries(tierBreakdown)
|
|
65
|
+
.sort((a, b) => b[1] - a[1])
|
|
66
|
+
.forEach(([tier, count]) => {
|
|
67
|
+
const percentage = ((count / providerMetrics.length) * 100).toFixed(1);
|
|
68
|
+
console.log(` ${tier.padEnd(30)} ${count.toString().padStart(3)} requests (${percentage}%)`);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
console.log('\n🤖 BY AGENT TYPE:');
|
|
72
|
+
console.log('-'.repeat(60));
|
|
73
|
+
Object.entries(agentTypeBreakdown)
|
|
74
|
+
.sort((a, b) => b[1] - a[1])
|
|
75
|
+
.forEach(([agentType, count]) => {
|
|
76
|
+
const percentage = ((count / providerMetrics.length) * 100).toFixed(1);
|
|
77
|
+
console.log(` ${agentType.padEnd(30)} ${count.toString().padStart(3)} requests (${percentage}%)`);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
console.log('\n🔀 BY ROUTING SOURCE:');
|
|
81
|
+
console.log('-'.repeat(60));
|
|
82
|
+
Object.entries(sourceBreakdown)
|
|
83
|
+
.sort((a, b) => b[1] - a[1])
|
|
84
|
+
.forEach(([source, count]) => {
|
|
85
|
+
const percentage = ((count / providerMetrics.length) * 100).toFixed(1);
|
|
86
|
+
console.log(` ${source.padEnd(30)} ${count.toString().padStart(3)} requests (${percentage}%)`);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// Check for subscription metrics
|
|
90
|
+
const subMetrics = telemetry.getMetrics('subscription.usage', 300000);
|
|
91
|
+
if (subMetrics.length > 0) {
|
|
92
|
+
const latestSub = subMetrics[subMetrics.length - 1];
|
|
93
|
+
console.log('\n📈 SUBSCRIPTION USAGE:');
|
|
94
|
+
console.log('-'.repeat(60));
|
|
95
|
+
console.log(` Used: ${latestSub.value}/${latestSub.tags.limit}`);
|
|
96
|
+
console.log(` Remaining: ${latestSub.tags.remaining}`);
|
|
97
|
+
console.log(` Status: ${latestSub.value >= parseInt(latestSub.tags.limit) ? '⚠️ LIMIT REACHED' : '✅ Available'}`);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Throughput analysis
|
|
101
|
+
const throughput = telemetry.getThroughputMetrics('provider.request', 300000);
|
|
102
|
+
console.log('\n⚡ THROUGHPUT ANALYSIS:');
|
|
103
|
+
console.log('-'.repeat(60));
|
|
104
|
+
console.log(` Total requests: ${throughput.totalRequests}`);
|
|
105
|
+
console.log(` Requests/sec: ${throughput.requestsPerSecond.toFixed(2)}`);
|
|
106
|
+
console.log(` Time window: Last 5 minutes`);
|
|
107
|
+
|
|
108
|
+
console.log('\n' + '='.repeat(60));
|
|
109
|
+
console.log('✅ Routing statistics retrieved successfully\n');
|
|
110
|
+
|
|
111
|
+
} catch (error) {
|
|
112
|
+
console.error('❌ Error retrieving routing statistics:', error.message);
|
|
113
|
+
console.error('\nThis may happen if telemetry is not initialized.');
|
|
114
|
+
console.error('Try running a routing test first: node scripts/test-routing-telemetry.cjs\n');
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Run stats check
|
|
119
|
+
checkRoutingStats().catch(err => {
|
|
120
|
+
console.error('Fatal error:', err);
|
|
121
|
+
process.exit(1);
|
|
122
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Monitor memory every 30 seconds, 20 iterations
|
|
3
|
+
|
|
4
|
+
LOG_FILE="memory-monitor-$(date +%Y%m%d-%H%M%S).log"
|
|
5
|
+
ITERATIONS=20
|
|
6
|
+
INTERVAL=30
|
|
7
|
+
|
|
8
|
+
echo "=== Memory Monitor Started ===" | tee "$LOG_FILE"
|
|
9
|
+
echo "Monitoring for $((ITERATIONS * INTERVAL)) seconds ($ITERATIONS checks)" | tee -a "$LOG_FILE"
|
|
10
|
+
echo "Timestamp: $(date)" | tee -a "$LOG_FILE"
|
|
11
|
+
echo "" | tee -a "$LOG_FILE"
|
|
12
|
+
|
|
13
|
+
for i in $(seq 1 $ITERATIONS); do
|
|
14
|
+
TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S')
|
|
15
|
+
|
|
16
|
+
# Total memory usage
|
|
17
|
+
TOTAL_MEM=$(ps aux | grep -E "(claude|node)" | grep -v grep | awk '{sum+=$6} END {printf "%.1f", sum/1024}')
|
|
18
|
+
|
|
19
|
+
# Node process count
|
|
20
|
+
NODE_COUNT=$(ps aux | grep node | grep -v grep | grep -v snapfuse | wc -l)
|
|
21
|
+
|
|
22
|
+
# Claude process count
|
|
23
|
+
CLAUDE_COUNT=$(ps aux | grep claude | grep -v grep | wc -l)
|
|
24
|
+
|
|
25
|
+
# Zombie processes
|
|
26
|
+
ZOMBIE_COUNT=$(ps aux | grep "<defunct>" | grep -v grep | wc -l)
|
|
27
|
+
|
|
28
|
+
# Find processes (memory bombs)
|
|
29
|
+
FIND_COUNT=$(ps aux | grep "find /mnt/c" | grep -v grep | wc -l)
|
|
30
|
+
|
|
31
|
+
# Hook processes
|
|
32
|
+
HOOK_COUNT=$(ps aux | grep "npx claude-flow-novice hooks" | grep -v grep | wc -l)
|
|
33
|
+
|
|
34
|
+
echo "[$i/$ITERATIONS] [$TIMESTAMP] MEM: ${TOTAL_MEM}MB | Node: $NODE_COUNT | Claude: $CLAUDE_COUNT | Zombies: $ZOMBIE_COUNT | Find: $FIND_COUNT | Hooks: $HOOK_COUNT" | tee -a "$LOG_FILE"
|
|
35
|
+
|
|
36
|
+
# Alerts
|
|
37
|
+
if (( $(echo "$TOTAL_MEM > 10000" | bc -l 2>/dev/null || echo 0) )); then
|
|
38
|
+
echo " ⚠️ WARNING: Memory usage exceeds 10GB!" | tee -a "$LOG_FILE"
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
if [ "$NODE_COUNT" -gt 20 ]; then
|
|
42
|
+
echo " ⚠️ WARNING: $NODE_COUNT node processes (orphaned agents?)" | tee -a "$LOG_FILE"
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
if [ "$FIND_COUNT" -gt 0 ]; then
|
|
46
|
+
echo " 🔴 CRITICAL: $FIND_COUNT find commands on /mnt/c (MEMORY BOMB!)" | tee -a "$LOG_FILE"
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
if [ "$ZOMBIE_COUNT" -gt 0 ]; then
|
|
50
|
+
echo " 💀 ZOMBIE: $ZOMBIE_COUNT zombie processes detected" | tee -a "$LOG_FILE"
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
if [ "$HOOK_COUNT" -gt 5 ]; then
|
|
54
|
+
echo " 🔁 RECURSION: $HOOK_COUNT hook processes (possible recursion!)" | tee -a "$LOG_FILE"
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
# Don't sleep on last iteration
|
|
58
|
+
if [ $i -lt $ITERATIONS ]; then
|
|
59
|
+
sleep $INTERVAL
|
|
60
|
+
fi
|
|
61
|
+
done
|
|
62
|
+
|
|
63
|
+
echo "" | tee -a "$LOG_FILE"
|
|
64
|
+
echo "=== Monitoring Complete ===" | tee -a "$LOG_FILE"
|
|
65
|
+
echo "Log saved to: $LOG_FILE" | tee -a "$LOG_FILE"
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Memory monitoring script for agent swarms
|
|
3
|
+
|
|
4
|
+
LOG_FILE="memory-monitor.log"
|
|
5
|
+
INTERVAL=5 # seconds
|
|
6
|
+
|
|
7
|
+
echo "=== Memory Monitor Started ===" | tee -a "$LOG_FILE"
|
|
8
|
+
echo "Timestamp: $(date)" | tee -a "$LOG_FILE"
|
|
9
|
+
echo "" | tee -a "$LOG_FILE"
|
|
10
|
+
|
|
11
|
+
while true; do
|
|
12
|
+
TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S')
|
|
13
|
+
|
|
14
|
+
# Total memory usage
|
|
15
|
+
TOTAL_MEM=$(ps aux | grep -E "(claude|node)" | grep -v grep | awk '{sum+=$6} END {print sum/1024}')
|
|
16
|
+
|
|
17
|
+
# Node process count
|
|
18
|
+
NODE_COUNT=$(ps aux | grep node | grep -v grep | grep -v snapfuse | wc -l)
|
|
19
|
+
|
|
20
|
+
# Claude process count
|
|
21
|
+
CLAUDE_COUNT=$(ps aux | grep claude | grep -v grep | wc -l)
|
|
22
|
+
|
|
23
|
+
# Zombie processes
|
|
24
|
+
ZOMBIE_COUNT=$(ps aux | grep "<defunct>" | grep -v grep | wc -l)
|
|
25
|
+
|
|
26
|
+
# Find processes (stuck)
|
|
27
|
+
FIND_COUNT=$(ps aux | grep "find /mnt/c" | grep -v grep | wc -l)
|
|
28
|
+
|
|
29
|
+
echo "[$TIMESTAMP] MEM: ${TOTAL_MEM}MB | Node: $NODE_COUNT | Claude: $CLAUDE_COUNT | Zombies: $ZOMBIE_COUNT | Find: $FIND_COUNT" | tee -a "$LOG_FILE"
|
|
30
|
+
|
|
31
|
+
# Alert if memory exceeds 10GB
|
|
32
|
+
if (( $(echo "$TOTAL_MEM > 10000" | bc -l) )); then
|
|
33
|
+
echo "⚠️ WARNING: Memory usage exceeds 10GB!" | tee -a "$LOG_FILE"
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
# Alert if too many node processes
|
|
37
|
+
if [ "$NODE_COUNT" -gt 20 ]; then
|
|
38
|
+
echo "⚠️ WARNING: $NODE_COUNT node processes detected (orphaned agents?)" | tee -a "$LOG_FILE"
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
# Alert if find commands stuck
|
|
42
|
+
if [ "$FIND_COUNT" -gt 0 ]; then
|
|
43
|
+
echo "🔴 CRITICAL: $FIND_COUNT find commands running on /mnt/c (memory bomb!)" | tee -a "$LOG_FILE"
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
sleep $INTERVAL
|
|
47
|
+
done
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
import subprocess
|
|
3
|
+
import time
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
|
|
6
|
+
ITERATIONS = 20
|
|
7
|
+
INTERVAL = 30
|
|
8
|
+
|
|
9
|
+
print("=== Memory Monitor Started ===")
|
|
10
|
+
print(f"Monitoring for {ITERATIONS * INTERVAL} seconds ({ITERATIONS} checks)")
|
|
11
|
+
print(f"Timestamp: {datetime.now()}")
|
|
12
|
+
print()
|
|
13
|
+
|
|
14
|
+
for i in range(1, ITERATIONS + 1):
|
|
15
|
+
timestamp = datetime.now().strftime('%H:%M:%S')
|
|
16
|
+
|
|
17
|
+
# Total memory
|
|
18
|
+
mem_cmd = "ps aux | grep -E '(claude|node)' | grep -v grep | awk '{sum+=$6} END {printf \"%.1f\", sum/1024}'"
|
|
19
|
+
total_mem = subprocess.getoutput(mem_cmd)
|
|
20
|
+
|
|
21
|
+
# Process counts
|
|
22
|
+
node_count = subprocess.getoutput("ps aux | grep node | grep -v grep | grep -v snapfuse | wc -l").strip()
|
|
23
|
+
claude_count = subprocess.getoutput("ps aux | grep claude | grep -v grep | wc -l").strip()
|
|
24
|
+
zombie_count = subprocess.getoutput("ps aux | grep '<defunct>' | grep -v grep | wc -l").strip()
|
|
25
|
+
find_count = subprocess.getoutput("ps aux | grep 'find /mnt/c' | grep -v grep | wc -l").strip()
|
|
26
|
+
|
|
27
|
+
print(f"[{i}/{ITERATIONS}] [{timestamp}] MEM: {total_mem}MB | Node: {node_count} | Claude: {claude_count} | Zombies: {zombie_count} | Find: {find_count}")
|
|
28
|
+
|
|
29
|
+
# Alerts
|
|
30
|
+
if total_mem and float(total_mem) > 10000:
|
|
31
|
+
print(" ⚠️ WARNING: Memory usage exceeds 10GB!")
|
|
32
|
+
|
|
33
|
+
if find_count and int(find_count) > 0:
|
|
34
|
+
print(f" 🔴 CRITICAL: {find_count} find commands on /mnt/c (MEMORY BOMB!)")
|
|
35
|
+
|
|
36
|
+
if zombie_count and int(zombie_count) > 0:
|
|
37
|
+
print(f" 💀 ZOMBIE: {zombie_count} zombie processes detected")
|
|
38
|
+
|
|
39
|
+
if i < ITERATIONS:
|
|
40
|
+
time.sleep(INTERVAL)
|
|
41
|
+
|
|
42
|
+
print()
|
|
43
|
+
print("=== Monitoring Complete ===")
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Pre-Publish Validation Suite
|
|
5
|
+
* Validates all critical functionality before npm package publication
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const { execSync } = require('child_process');
|
|
9
|
+
const fs = require('fs');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
|
|
12
|
+
const TIMEOUT = 60000; // 60 seconds per test suite
|
|
13
|
+
|
|
14
|
+
const TEST_SUITES = [
|
|
15
|
+
{
|
|
16
|
+
name: '1. Post-Edit Pipeline Functionality',
|
|
17
|
+
type: 'manual',
|
|
18
|
+
validate: () => {
|
|
19
|
+
const pipelinePath = 'config/hooks/post-edit-pipeline.js';
|
|
20
|
+
if (!fs.existsSync(pipelinePath)) {
|
|
21
|
+
throw new Error(`Post-edit pipeline not found at ${pipelinePath}`);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Test basic execution (create test file first)
|
|
25
|
+
const testFile = 'test-validation-temp.js';
|
|
26
|
+
fs.writeFileSync(testFile, 'console.log("test");');
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
execSync(`node ${pipelinePath} ${testFile}`, {
|
|
30
|
+
timeout: 30000,
|
|
31
|
+
stdio: 'pipe'
|
|
32
|
+
});
|
|
33
|
+
fs.unlinkSync(testFile);
|
|
34
|
+
return { status: 'PASS', message: 'Pipeline executable and functional' };
|
|
35
|
+
} catch (error) {
|
|
36
|
+
if (fs.existsSync(testFile)) fs.unlinkSync(testFile);
|
|
37
|
+
return { status: 'WARN', message: `Pipeline execution failed: ${error.message.substring(0, 100)}` };
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: '2. Full-Stack Swarm Tests',
|
|
43
|
+
type: 'jest',
|
|
44
|
+
tests: [
|
|
45
|
+
'tests/swarm-fullstack/backend-integration.test.ts',
|
|
46
|
+
'tests/swarm-fullstack/frontend-integration.test.ts',
|
|
47
|
+
'tests/swarm-fullstack/workflows/iterative-workflow.test.ts'
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: '3. CFN Loop Core Tests',
|
|
52
|
+
type: 'jest',
|
|
53
|
+
tests: [
|
|
54
|
+
'tests/unit/cfn-loop/epic-iteration-limits.test.ts',
|
|
55
|
+
'tests/unit/cfn-loop/retry-todo-manager.test.ts',
|
|
56
|
+
'tests/integration/cfn-loop/cfn-loop-orchestrator.test.ts'
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: '4. CFN Loop Slash Commands',
|
|
61
|
+
type: 'jest',
|
|
62
|
+
tests: [
|
|
63
|
+
'tests/integration/slash-commands/cfn-loop-commands.test.ts',
|
|
64
|
+
'tests/integration/slash-commands/cfn-loop-integration.test.js'
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: '5. Tiered Structure with z.ai',
|
|
69
|
+
type: 'manual',
|
|
70
|
+
validate: () => {
|
|
71
|
+
const required = [
|
|
72
|
+
'src/providers/tiered-router.ts',
|
|
73
|
+
'src/providers/zai-provider.ts'
|
|
74
|
+
];
|
|
75
|
+
|
|
76
|
+
const missing = required.filter(file => !fs.existsSync(file));
|
|
77
|
+
if (missing.length > 0) {
|
|
78
|
+
return { status: 'FAIL', message: `Missing files: ${missing.join(', ')}` };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Check test file exists
|
|
82
|
+
const testFile = 'tests/providers/tiered-routing.test.ts';
|
|
83
|
+
if (!fs.existsSync(testFile)) {
|
|
84
|
+
return { status: 'WARN', message: `Test file not found: ${testFile}` };
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return { status: 'PASS', message: 'Tiered routing files present' };
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: '6. SDK Process with Agents',
|
|
92
|
+
type: 'manual',
|
|
93
|
+
validate: () => {
|
|
94
|
+
const sdkTests = 'tests/coordination/v2/unit/sdk';
|
|
95
|
+
if (!fs.existsSync(sdkTests)) {
|
|
96
|
+
return { status: 'WARN', message: 'SDK tests directory not found (still in development)' };
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const testFiles = fs.readdirSync(sdkTests, { recursive: true })
|
|
100
|
+
.filter(file => file.endsWith('.test.ts') || file.endsWith('.test.js'));
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
status: 'INFO',
|
|
104
|
+
message: `SDK in development - ${testFiles.length} test files found`
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
];
|
|
109
|
+
|
|
110
|
+
function runJestTest(testPath) {
|
|
111
|
+
if (!fs.existsSync(testPath)) {
|
|
112
|
+
return { status: 'SKIP', message: 'Test file not found' };
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
try {
|
|
116
|
+
execSync(
|
|
117
|
+
`NODE_OPTIONS='--experimental-vm-modules' npm test -- ${testPath} --bail --maxWorkers=1 --forceExit --testTimeout=30000`,
|
|
118
|
+
{
|
|
119
|
+
timeout: TIMEOUT,
|
|
120
|
+
stdio: 'pipe'
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
return { status: 'PASS', message: 'All tests passed' };
|
|
124
|
+
} catch (error) {
|
|
125
|
+
const output = error.stdout?.toString() || error.stderr?.toString() || error.message;
|
|
126
|
+
const hasTests = output.includes('Test Suites:') || output.includes('Tests:');
|
|
127
|
+
|
|
128
|
+
if (!hasTests) {
|
|
129
|
+
return { status: 'SKIP', message: 'No executable tests found' };
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return { status: 'FAIL', message: output.substring(0, 200) };
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function formatResult(status) {
|
|
137
|
+
const colors = {
|
|
138
|
+
PASS: '\x1b[32m✓\x1b[0m',
|
|
139
|
+
FAIL: '\x1b[31m✗\x1b[0m',
|
|
140
|
+
WARN: '\x1b[33m⚠\x1b[0m',
|
|
141
|
+
INFO: '\x1b[36mℹ\x1b[0m',
|
|
142
|
+
SKIP: '\x1b[90m−\x1b[0m'
|
|
143
|
+
};
|
|
144
|
+
return colors[status] || status;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async function main() {
|
|
148
|
+
console.log('\n🚀 Pre-Publish Validation Suite\n');
|
|
149
|
+
console.log('=' .repeat(80) + '\n');
|
|
150
|
+
|
|
151
|
+
const results = [];
|
|
152
|
+
|
|
153
|
+
for (const suite of TEST_SUITES) {
|
|
154
|
+
console.log(`\n${suite.name}`);
|
|
155
|
+
console.log('-'.repeat(80));
|
|
156
|
+
|
|
157
|
+
if (suite.type === 'manual') {
|
|
158
|
+
const result = suite.validate();
|
|
159
|
+
console.log(`${formatResult(result.status)} ${result.message}`);
|
|
160
|
+
results.push({ suite: suite.name, ...result });
|
|
161
|
+
} else if (suite.type === 'jest') {
|
|
162
|
+
for (const testPath of suite.tests) {
|
|
163
|
+
const filename = path.basename(testPath);
|
|
164
|
+
const result = runJestTest(testPath);
|
|
165
|
+
console.log(` ${formatResult(result.status)} ${filename}`);
|
|
166
|
+
if (result.message && result.status !== 'PASS') {
|
|
167
|
+
console.log(` ${result.message.split('\n')[0]}`);
|
|
168
|
+
}
|
|
169
|
+
results.push({ suite: suite.name, test: filename, ...result });
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Summary
|
|
175
|
+
console.log('\n' + '='.repeat(80));
|
|
176
|
+
console.log('\n📊 SUMMARY\n');
|
|
177
|
+
|
|
178
|
+
const summary = {
|
|
179
|
+
PASS: results.filter(r => r.status === 'PASS').length,
|
|
180
|
+
FAIL: results.filter(r => r.status === 'FAIL').length,
|
|
181
|
+
WARN: results.filter(r => r.status === 'WARN').length,
|
|
182
|
+
INFO: results.filter(r => r.status === 'INFO').length,
|
|
183
|
+
SKIP: results.filter(r => r.status === 'SKIP').length
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
console.log(`${formatResult('PASS')} Passed: ${summary.PASS}`);
|
|
187
|
+
console.log(`${formatResult('FAIL')} Failed: ${summary.FAIL}`);
|
|
188
|
+
console.log(`${formatResult('WARN')} Warnings: ${summary.WARN}`);
|
|
189
|
+
console.log(`${formatResult('INFO')} Info: ${summary.INFO}`);
|
|
190
|
+
console.log(`${formatResult('SKIP')} Skipped: ${summary.SKIP}`);
|
|
191
|
+
|
|
192
|
+
console.log('\n' + '='.repeat(80));
|
|
193
|
+
|
|
194
|
+
// Critical failures block publication
|
|
195
|
+
if (summary.FAIL > 0) {
|
|
196
|
+
console.log('\n❌ CRITICAL: Tests failed. Fix before publishing.\n');
|
|
197
|
+
process.exit(1);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (summary.PASS === 0 && summary.WARN > 0) {
|
|
201
|
+
console.log('\n⚠️ WARNING: No tests passed, only warnings. Review before publishing.\n');
|
|
202
|
+
process.exit(1);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
console.log('\n✅ Validation complete. Ready for publication.\n');
|
|
206
|
+
process.exit(0);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
main().catch(error => {
|
|
210
|
+
console.error('\n❌ Validation suite failed:', error.message);
|
|
211
|
+
process.exit(1);
|
|
212
|
+
});
|