claude-flow-novice 1.3.0 → 1.3.2
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-flow-novice/preferences/generation.json +147 -0
- package/.claude-flow-novice/preferences/language-configs/javascript.json +51 -0
- package/.claude-flow-novice/preferences/language-configs/python.json +50 -0
- package/.claude-flow-novice/preferences/language-configs/rust.json +237 -0
- package/.claude-flow-novice/preferences/language-configs/typescript.json +54 -0
- package/.claude-flow-novice/preferences/project-local.json +91 -0
- package/.claude-flow-novice/preferences/resource-delegation.json +120 -0
- package/.claude-flow-novice/preferences/team-shared.json +195 -0
- package/.claude-flow-novice/preferences/user-global.json +247 -0
- package/.claude-flow-novice/templates/claude-md-templates/CLAUDE-JAVASCRIPT.md +769 -0
- package/.claude-flow-novice/templates/claude-md-templates/CLAUDE-PYTHON.md +1214 -0
- package/.claude-flow-novice/templates/claude-md-templates/CLAUDE-RUST.md +475 -0
- package/.claude-flow-novice/templates/claude-md-templates/CLAUDE-TYPESCRIPT.md +851 -0
- package/.claude-flow-novice/templates/claude-md-templates/README.md +263 -0
- package/CLAUDE.md +81 -0
- package/README-NPM.md +0 -0
- package/package.json +11 -7
- package/scripts/build/README.md +167 -0
- package/scripts/build/build-config.js +27 -0
- package/scripts/build/build-prompt-copier.sh +30 -0
- package/scripts/build/performance-monitor.js +869 -0
- package/scripts/build/prepare-publish.js +150 -0
- package/scripts/build/typescript-fixer.js +621 -0
- package/scripts/build/unified-builder.sh +428 -0
- package/scripts/build/update-bin-version.js +32 -0
- package/scripts/dev/README.md +264 -0
- package/scripts/dev/claude-flow-wrapper.sh +35 -0
- package/scripts/dev/claude-monitor.py +419 -0
- package/scripts/dev/claude-sparc.sh +562 -0
- package/scripts/dev/claude-wrapper.sh +17 -0
- package/scripts/dev/demo-phase3-compliance.js +172 -0
- package/scripts/dev/demo-task-system.ts +224 -0
- package/scripts/dev/deployment-validator.js +315 -0
- package/scripts/dev/spawn-claude-terminal.sh +32 -0
- package/scripts/dev/start-portal.sh +506 -0
- package/scripts/dev/start-web-ui.js +15 -0
- package/scripts/dev/stop-portal.sh +311 -0
- package/scripts/dev/validate-examples.ts +288 -0
- package/scripts/dev/validate-phase2.cjs +451 -0
- package/scripts/dev/validate-phase2.js +785 -0
- package/scripts/dev/validate-phase3.cjs +208 -0
- package/scripts/dev/validate-security-remediation.js +1 -0
- package/scripts/legacy/README.md +272 -0
- package/scripts/legacy/batch-fix-ts.sh +54 -0
- package/scripts/legacy/build-migration.sh +105 -0
- package/scripts/legacy/build-monitor.js +209 -0
- package/scripts/legacy/build-with-filter.sh +84 -0
- package/scripts/legacy/build-workaround.sh +71 -0
- package/scripts/legacy/fix-ts-advanced.js +358 -0
- package/scripts/legacy/fix-ts-final.sh +50 -0
- package/scripts/legacy/fix-ts-targeted.sh +49 -0
- package/scripts/legacy/fix-typescript-errors.js +305 -0
- package/scripts/legacy/force-build.sh +63 -0
- package/scripts/legacy/optimize-performance.js +400 -0
- package/scripts/legacy/performance-monitor.js +263 -0
- package/scripts/legacy/performance-monitoring.js +532 -0
- package/scripts/legacy/performance-test-runner.js +645 -0
- package/scripts/legacy/quick-fix-ts.js +281 -0
- package/scripts/legacy/safe-build.sh +63 -0
- package/scripts/migration/README.md +434 -0
- package/scripts/migration/install-arm64.js +78 -0
- package/scripts/migration/install.js +83 -0
- package/scripts/migration/migrate-hooks.js +173 -0
- package/scripts/migration/migration-examples.ts +318 -0
- package/scripts/optimization/build-optimizer.js +438 -0
- package/scripts/optimization/config-validator.js +761 -0
- package/scripts/optimization/test-optimization.js +432 -0
- package/scripts/optimization/unified-activation.js +839 -0
- package/scripts/performance/ACTIVATION_COMMANDS.md +292 -0
- package/scripts/performance/sqlite-enhanced-activation.sh +583 -0
- package/scripts/performance/test-enhanced-backend.sh +504 -0
- package/scripts/performance-test-runner.js +698 -0
- package/scripts/security/README.md +339 -0
- package/scripts/security/install-git-hooks.sh +132 -0
- package/scripts/security/ruv-swarm-safe.js +74 -0
- package/scripts/test/README.md +236 -0
- package/scripts/test/check-links.ts +274 -0
- package/scripts/test/check-performance-regression.ts +168 -0
- package/scripts/test/coverage-report.ts +692 -0
- package/scripts/test/generate-swarm-tests.js +633 -0
- package/scripts/test/integration-test-validation.cjs +253 -0
- package/scripts/test/load-test-swarm.js +576 -0
- package/scripts/test/run-phase3-compliance-tests.js +427 -0
- package/scripts/test/test-batch-tasks.ts +29 -0
- package/scripts/test/test-byzantine-resolution.js +246 -0
- package/scripts/test/test-claude-spawn-options.sh +63 -0
- package/scripts/test/test-cli-wizard.js +331 -0
- package/scripts/test/test-comprehensive.js +401 -0
- package/scripts/test/test-coordination-features.ts +238 -0
- package/scripts/test/test-fallback-systems.js +276 -0
- package/scripts/test/test-init-command.ts +302 -0
- package/scripts/test/test-mcp.ts +251 -0
- package/scripts/test/test-runner.ts +568 -0
- package/scripts/test/test-swarm-integration.sh +92 -0
- package/scripts/test/test-swarm.ts +142 -0
- package/scripts/test/validation-summary.ts +408 -0
- package/scripts/utils/README.md +261 -0
- package/scripts/utils/clean-build-artifacts.sh +94 -0
- package/scripts/utils/cleanup-root.sh +69 -0
- package/scripts/utils/fix-cliffy-imports.js +307 -0
- package/scripts/utils/fix-duplicate-imports.js +114 -0
- package/scripts/utils/fix-error-handling.cjs +70 -0
- package/scripts/utils/fix-import-paths.js +104 -0
- package/scripts/utils/fix-imports.js +116 -0
- package/scripts/utils/fix-shebang.js +78 -0
- package/scripts/utils/fix-test-modules.js +27 -0
- package/scripts/utils/fix-timezone-issue-246.js +200 -0
- package/scripts/utils/fix-ts-comprehensive.py +182 -0
- package/scripts/utils/fix-ts-targeted-batch.js +250 -0
- package/scripts/utils/remove-benchmark-conflicts.sh +140 -0
- package/scripts/utils/simple-test-fixer.js +190 -0
- package/scripts/utils/validate-metrics-structure.cjs +144 -0
- package/scripts/verify-mcp-server.js +86 -0
- package/src/cli/simple-commands/__tests__/agent.test.js +291 -0
- package/src/cli/simple-commands/__tests__/memory.test.js +8 -0
- package/src/cli/simple-commands/__tests__/swarm.test.js +371 -0
- package/src/cli/simple-commands/__tests__/task.test.js +8 -0
- package/src/cli/simple-commands/agent.js +216 -0
- package/src/cli/simple-commands/analysis.js +570 -0
- package/src/cli/simple-commands/automation-executor.js +1603 -0
- package/src/cli/simple-commands/automation.js +627 -0
- package/src/cli/simple-commands/batch-manager.js +338 -0
- package/src/cli/simple-commands/claude-telemetry.js +311 -0
- package/src/cli/simple-commands/claude-track.js +102 -0
- package/src/cli/simple-commands/concurrent-display.js +348 -0
- package/src/cli/simple-commands/config.js +319 -0
- package/src/cli/simple-commands/coordination.js +307 -0
- package/src/cli/simple-commands/enhanced-ui-views.js +654 -0
- package/src/cli/simple-commands/enhanced-webui-complete.js +1038 -0
- package/src/cli/simple-commands/fix-hook-variables.js +363 -0
- package/src/cli/simple-commands/github/gh-coordinator.js +605 -0
- package/src/cli/simple-commands/github/github-api.js +624 -0
- package/src/cli/simple-commands/github/init.js +543 -0
- package/src/cli/simple-commands/github.js +377 -0
- package/src/cli/simple-commands/goal.js +145 -0
- package/src/cli/simple-commands/hive-mind/auto-save-middleware.js +311 -0
- package/src/cli/simple-commands/hive-mind/communication.js +740 -0
- package/src/cli/simple-commands/hive-mind/core.js +1031 -0
- package/src/cli/simple-commands/hive-mind/db-optimizer.js +872 -0
- package/src/cli/simple-commands/hive-mind/mcp-wrapper.js +1364 -0
- package/src/cli/simple-commands/hive-mind/memory.js +1292 -0
- package/src/cli/simple-commands/hive-mind/performance-optimizer.js +618 -0
- package/src/cli/simple-commands/hive-mind/performance-test.js +373 -0
- package/src/cli/simple-commands/hive-mind/queen.js +809 -0
- package/src/cli/simple-commands/hive-mind/session-manager.js +1223 -0
- package/src/cli/simple-commands/hive-mind-optimize.js +361 -0
- package/src/cli/simple-commands/hive-mind-wizard.js +281 -0
- package/src/cli/simple-commands/hive-mind.js +3112 -0
- package/src/cli/simple-commands/hive.js +140 -0
- package/src/cli/simple-commands/hook-safety.js +671 -0
- package/src/cli/simple-commands/hooks.js +1268 -0
- package/src/cli/simple-commands/init/.claude/checkpoints/1756224542.json +7 -0
- package/src/cli/simple-commands/init/.claude/checkpoints/1756224544.json +8 -0
- package/src/cli/simple-commands/init/README.md +106 -0
- package/src/cli/simple-commands/init/VALIDATION_ROLLBACK.md +488 -0
- package/src/cli/simple-commands/init/agent-copier.js +347 -0
- package/src/cli/simple-commands/init/batch-init.js +663 -0
- package/src/cli/simple-commands/init/claude-commands/claude-flow-commands.js +438 -0
- package/src/cli/simple-commands/init/claude-commands/optimized-claude-flow-commands.js +876 -0
- package/src/cli/simple-commands/init/claude-commands/optimized-slash-commands.js +356 -0
- package/src/cli/simple-commands/init/claude-commands/optimized-sparc-commands.js +501 -0
- package/src/cli/simple-commands/init/claude-commands/slash-commands.js +57 -0
- package/src/cli/simple-commands/init/claude-commands/sparc-commands.js +296 -0
- package/src/cli/simple-commands/init/copy-revised-templates.js +175 -0
- package/src/cli/simple-commands/init/executable-wrapper.js +122 -0
- package/src/cli/simple-commands/init/gitignore-updater.js +137 -0
- package/src/cli/simple-commands/init/help.js +110 -0
- package/src/cli/simple-commands/init/hive-mind-init.js +749 -0
- package/src/cli/simple-commands/init/index.js +1953 -0
- package/src/cli/simple-commands/init/performance-monitor.js +344 -0
- package/src/cli/simple-commands/init/rollback/backup-manager.js +542 -0
- package/src/cli/simple-commands/init/rollback/index.js +399 -0
- package/src/cli/simple-commands/init/rollback/recovery-manager.js +778 -0
- package/src/cli/simple-commands/init/rollback/rollback-executor.js +521 -0
- package/src/cli/simple-commands/init/rollback/state-tracker.js +486 -0
- package/src/cli/simple-commands/init/sparc/roo-readme.js +61 -0
- package/src/cli/simple-commands/init/sparc/roomodes-config.js +102 -0
- package/src/cli/simple-commands/init/sparc/workflows.js +40 -0
- package/src/cli/simple-commands/init/sparc-structure.js +68 -0
- package/src/cli/simple-commands/init/template-copier.js +640 -0
- package/src/cli/simple-commands/init/templates/CLAUDE.md +1185 -0
- package/src/cli/simple-commands/init/templates/CLAUDE.md.optimized +265 -0
- package/src/cli/simple-commands/init/templates/claude-flow-universal +81 -0
- package/src/cli/simple-commands/init/templates/claude-flow.bat +18 -0
- package/src/cli/simple-commands/init/templates/claude-flow.ps1 +24 -0
- package/src/cli/simple-commands/init/templates/claude-md.js +1101 -0
- package/src/cli/simple-commands/init/templates/commands/analysis/bottleneck-detect.md +162 -0
- package/src/cli/simple-commands/init/templates/commands/automation/auto-agent.md +122 -0
- package/src/cli/simple-commands/init/templates/commands/coordination/swarm-init.md +85 -0
- package/src/cli/simple-commands/init/templates/commands/github/github-swarm.md +121 -0
- package/src/cli/simple-commands/init/templates/commands/helpers/standard-checkpoint-hooks.sh +179 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/notification.md +113 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/post-command.md +116 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/post-edit.md +117 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/post-task.md +112 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/pre-command.md +113 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/pre-edit.md +113 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/pre-search.md +112 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/pre-task.md +111 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/session-end.md +118 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/session-restore.md +118 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/session-start.md +117 -0
- package/src/cli/simple-commands/init/templates/coordination-md.js +340 -0
- package/src/cli/simple-commands/init/templates/coordination.md +16 -0
- package/src/cli/simple-commands/init/templates/enhanced-templates.js +2347 -0
- package/src/cli/simple-commands/init/templates/github-safe-enhanced.js +331 -0
- package/src/cli/simple-commands/init/templates/github-safe.js +106 -0
- package/src/cli/simple-commands/init/templates/memory-bank-md.js +259 -0
- package/src/cli/simple-commands/init/templates/memory-bank.md +16 -0
- package/src/cli/simple-commands/init/templates/readme-files.js +72 -0
- package/src/cli/simple-commands/init/templates/safe-hook-patterns.js +430 -0
- package/src/cli/simple-commands/init/templates/settings.json +109 -0
- package/src/cli/simple-commands/init/templates/settings.json.enhanced +35 -0
- package/src/cli/simple-commands/init/templates/sparc-modes.js +1401 -0
- package/src/cli/simple-commands/init/templates/verification-claude-md.js +432 -0
- package/src/cli/simple-commands/init/validation/config-validator.js +354 -0
- package/src/cli/simple-commands/init/validation/health-checker.js +599 -0
- package/src/cli/simple-commands/init/validation/index.js +388 -0
- package/src/cli/simple-commands/init/validation/mode-validator.js +387 -0
- package/src/cli/simple-commands/init/validation/post-init-validator.js +390 -0
- package/src/cli/simple-commands/init/validation/pre-init-validator.js +290 -0
- package/src/cli/simple-commands/init/validation/test-runner.js +488 -0
- package/src/cli/simple-commands/init.js +4 -0
- package/src/cli/simple-commands/mcp-health.js +163 -0
- package/src/cli/simple-commands/mcp-integration-layer.js +689 -0
- package/src/cli/simple-commands/mcp.js +420 -0
- package/src/cli/simple-commands/memory-consolidation.js +631 -0
- package/src/cli/simple-commands/memory.js +345 -0
- package/src/cli/simple-commands/migrate-hooks.js +63 -0
- package/src/cli/simple-commands/monitor.js +417 -0
- package/src/cli/simple-commands/neural.js +148 -0
- package/src/cli/simple-commands/pair-autofix-only.js +755 -0
- package/src/cli/simple-commands/pair-basic.js +751 -0
- package/src/cli/simple-commands/pair-old.js +623 -0
- package/src/cli/simple-commands/pair-working.js +849 -0
- package/src/cli/simple-commands/pair.js +849 -0
- package/src/cli/simple-commands/performance-hooks.js +149 -0
- package/src/cli/simple-commands/performance-metrics.js +601 -0
- package/src/cli/simple-commands/process-ui-enhanced.js +821 -0
- package/src/cli/simple-commands/process-ui.js +274 -0
- package/src/cli/simple-commands/realtime-update-system.js +659 -0
- package/src/cli/simple-commands/sparc/architecture.js +1750 -0
- package/src/cli/simple-commands/sparc/commands.js +575 -0
- package/src/cli/simple-commands/sparc/completion.js +1831 -0
- package/src/cli/simple-commands/sparc/coordinator.js +1045 -0
- package/src/cli/simple-commands/sparc/index.js +321 -0
- package/src/cli/simple-commands/sparc/phase-base.js +430 -0
- package/src/cli/simple-commands/sparc/pseudocode.js +984 -0
- package/src/cli/simple-commands/sparc/refinement.js +1856 -0
- package/src/cli/simple-commands/sparc/specification.js +736 -0
- package/src/cli/simple-commands/sparc-modes/architect.js +125 -0
- package/src/cli/simple-commands/sparc-modes/ask.js +126 -0
- package/src/cli/simple-commands/sparc-modes/code.js +148 -0
- package/src/cli/simple-commands/sparc-modes/debug.js +112 -0
- package/src/cli/simple-commands/sparc-modes/devops.js +137 -0
- package/src/cli/simple-commands/sparc-modes/docs-writer.js +38 -0
- package/src/cli/simple-commands/sparc-modes/generic.js +34 -0
- package/src/cli/simple-commands/sparc-modes/index.js +201 -0
- package/src/cli/simple-commands/sparc-modes/integration.js +55 -0
- package/src/cli/simple-commands/sparc-modes/mcp.js +38 -0
- package/src/cli/simple-commands/sparc-modes/monitoring.js +38 -0
- package/src/cli/simple-commands/sparc-modes/optimization.js +38 -0
- package/src/cli/simple-commands/sparc-modes/security-review.js +130 -0
- package/src/cli/simple-commands/sparc-modes/sparc-orchestrator.js +167 -0
- package/src/cli/simple-commands/sparc-modes/spec-pseudocode.js +38 -0
- package/src/cli/simple-commands/sparc-modes/supabase-admin.js +149 -0
- package/src/cli/simple-commands/sparc-modes/swarm.js +436 -0
- package/src/cli/simple-commands/sparc-modes/tdd.js +112 -0
- package/src/cli/simple-commands/sparc-modes/tutorial.js +277 -0
- package/src/cli/simple-commands/sparc.js +530 -0
- package/src/cli/simple-commands/start-ui.js +147 -0
- package/src/cli/simple-commands/start-wrapper.js +285 -0
- package/src/cli/simple-commands/start.js +2 -0
- package/src/cli/simple-commands/status.js +303 -0
- package/src/cli/simple-commands/stream-chain-clean.js +221 -0
- package/src/cli/simple-commands/stream-chain-fixed.js +89 -0
- package/src/cli/simple-commands/stream-chain-real.js +408 -0
- package/src/cli/simple-commands/stream-chain-working.js +323 -0
- package/src/cli/simple-commands/stream-chain.js +491 -0
- package/src/cli/simple-commands/stream-processor.js +340 -0
- package/src/cli/simple-commands/swarm-executor.js +253 -0
- package/src/cli/simple-commands/swarm-metrics-integration.js +371 -0
- package/src/cli/simple-commands/swarm-ui.js +741 -0
- package/src/cli/simple-commands/swarm-webui-integration.js +311 -0
- package/src/cli/simple-commands/swarm.js +2277 -0
- package/src/cli/simple-commands/task.js +228 -0
- package/src/cli/simple-commands/templates/mle-star-workflow.json +294 -0
- package/src/cli/simple-commands/timestamp-fix.js +104 -0
- package/src/cli/simple-commands/token-tracker.js +372 -0
- package/src/cli/simple-commands/tool-execution-framework.js +555 -0
- package/src/cli/simple-commands/train-and-stream.js +354 -0
- package/src/cli/simple-commands/training-pipeline.js +874 -0
- package/src/cli/simple-commands/training.js +288 -0
- package/src/cli/simple-commands/verification-hooks.js +336 -0
- package/src/cli/simple-commands/verification-integration.js +464 -0
- package/src/cli/simple-commands/verification-training-integration.js +646 -0
- package/src/cli/simple-commands/verification.js +551 -0
- package/src/cli/simple-commands/web-server.js +929 -0
- package/src/cli/simple-commands/webui-validator.js +136 -0
- package/src/language/README.md +503 -0
- package/src/language/claude-md-generator.js +618 -0
- package/src/language/cli.js +422 -0
- package/src/language/example.js +347 -0
- package/src/language/integration-system.js +619 -0
- package/src/language/language-detector.js +581 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# Test Scripts
|
|
2
|
+
|
|
3
|
+
This directory contains all testing and validation scripts for the Claude Flow project.
|
|
4
|
+
|
|
5
|
+
## Scripts
|
|
6
|
+
|
|
7
|
+
### Core Test Infrastructure
|
|
8
|
+
|
|
9
|
+
#### `test-runner.ts` - Universal Test Runner
|
|
10
|
+
Primary test orchestration with multiple test strategies.
|
|
11
|
+
|
|
12
|
+
#### `test-comprehensive.js` - Comprehensive Test Suite
|
|
13
|
+
Full system testing including unit, integration, and e2e tests.
|
|
14
|
+
|
|
15
|
+
#### `test-coordination-features.ts` - Coordination Testing
|
|
16
|
+
Tests for Claude Flow's coordination and swarm features.
|
|
17
|
+
|
|
18
|
+
### Performance & Load Testing
|
|
19
|
+
|
|
20
|
+
#### `check-performance-regression.ts` - Performance Regression Detection
|
|
21
|
+
Monitors and detects performance regressions between builds.
|
|
22
|
+
|
|
23
|
+
#### `load-test-swarm.js` - Swarm Load Testing
|
|
24
|
+
High-load testing for swarm coordination and agent management.
|
|
25
|
+
|
|
26
|
+
#### `coverage-report.ts` - Test Coverage Analysis
|
|
27
|
+
Generates comprehensive test coverage reports and analysis.
|
|
28
|
+
|
|
29
|
+
### Specialized Testing
|
|
30
|
+
|
|
31
|
+
#### `test-swarm.ts` - Swarm Functionality Testing
|
|
32
|
+
Core swarm behavior and coordination testing.
|
|
33
|
+
|
|
34
|
+
#### `test-swarm-integration.sh` - Swarm Integration Tests
|
|
35
|
+
Integration testing for swarm components with external systems.
|
|
36
|
+
|
|
37
|
+
#### `test-byzantine-resolution.js` - Byzantine Fault Tolerance Testing
|
|
38
|
+
Tests Byzantine fault tolerance and consensus mechanisms.
|
|
39
|
+
|
|
40
|
+
#### `test-fallback-systems.js` - Fallback System Testing
|
|
41
|
+
Tests failover and recovery mechanisms.
|
|
42
|
+
|
|
43
|
+
#### `test-mcp.ts` - MCP Protocol Testing
|
|
44
|
+
Model Context Protocol implementation testing.
|
|
45
|
+
|
|
46
|
+
#### `test-cli-wizard.js` - CLI Interface Testing
|
|
47
|
+
Command-line interface and wizard functionality testing.
|
|
48
|
+
|
|
49
|
+
#### `test-init-command.ts` - Initialization Testing
|
|
50
|
+
Tests project initialization and setup commands.
|
|
51
|
+
|
|
52
|
+
#### `test-claude-spawn-options.sh` - Claude Spawn Testing
|
|
53
|
+
Tests Claude agent spawning with various configuration options.
|
|
54
|
+
|
|
55
|
+
#### `test-batch-tasks.ts` - Batch Task Testing
|
|
56
|
+
Tests batch processing and parallel task execution.
|
|
57
|
+
|
|
58
|
+
### Validation & Compliance
|
|
59
|
+
|
|
60
|
+
#### `validation-summary.ts` - Test Validation Summary
|
|
61
|
+
Generates comprehensive validation reports across all test categories.
|
|
62
|
+
|
|
63
|
+
#### `integration-test-validation.cjs` - Integration Validation
|
|
64
|
+
Validates integration test results and system compatibility.
|
|
65
|
+
|
|
66
|
+
#### `run-phase3-compliance-tests.js` - Phase 3 Compliance Testing
|
|
67
|
+
Specific compliance testing for Phase 3 project requirements.
|
|
68
|
+
|
|
69
|
+
#### `check-links.ts` - Link Validation
|
|
70
|
+
Validates internal and external links in documentation and code.
|
|
71
|
+
|
|
72
|
+
### Test Generation
|
|
73
|
+
|
|
74
|
+
#### `generate-swarm-tests.js` - Automated Test Generation
|
|
75
|
+
Automatically generates test cases for swarm functionality.
|
|
76
|
+
|
|
77
|
+
## Package.json Integration
|
|
78
|
+
|
|
79
|
+
Test scripts are integrated into package.json:
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"scripts": {
|
|
84
|
+
"test": "NODE_OPTIONS='--experimental-vm-modules' jest --config=config/jest/jest.config.js --bail --maxWorkers=1 --forceExit",
|
|
85
|
+
"test:unit": "NODE_OPTIONS='--experimental-vm-modules' jest src/__tests__/unit",
|
|
86
|
+
"test:integration": "NODE_OPTIONS='--experimental-vm-modules' jest src/__tests__/integration",
|
|
87
|
+
"test:e2e": "NODE_OPTIONS='--experimental-vm-modules' jest src/__tests__/e2e",
|
|
88
|
+
"test:performance": "NODE_OPTIONS='--experimental-vm-modules' jest src/__tests__/performance",
|
|
89
|
+
"test:coverage": "NODE_OPTIONS='--experimental-vm-modules' jest --config=config/jest/jest.config.js --coverage",
|
|
90
|
+
"test:ci": "NODE_OPTIONS='--experimental-vm-modules' jest --config=config/jest/jest.config.js --ci --coverage --maxWorkers=2"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Test Categories
|
|
96
|
+
|
|
97
|
+
### 1. Unit Tests
|
|
98
|
+
- Individual component testing
|
|
99
|
+
- Isolated functionality verification
|
|
100
|
+
- Mock-based testing
|
|
101
|
+
|
|
102
|
+
### 2. Integration Tests
|
|
103
|
+
- Component interaction testing
|
|
104
|
+
- API integration verification
|
|
105
|
+
- Database connectivity testing
|
|
106
|
+
|
|
107
|
+
### 3. End-to-End Tests
|
|
108
|
+
- Full workflow testing
|
|
109
|
+
- User journey verification
|
|
110
|
+
- Complete system testing
|
|
111
|
+
|
|
112
|
+
### 4. Performance Tests
|
|
113
|
+
- Load testing
|
|
114
|
+
- Stress testing
|
|
115
|
+
- Performance regression detection
|
|
116
|
+
- Resource usage monitoring
|
|
117
|
+
|
|
118
|
+
### 5. Swarm Tests
|
|
119
|
+
- Agent coordination testing
|
|
120
|
+
- Consensus mechanism testing
|
|
121
|
+
- Fault tolerance testing
|
|
122
|
+
- Byzantine failure handling
|
|
123
|
+
|
|
124
|
+
### 6. Compliance Tests
|
|
125
|
+
- Phase requirements verification
|
|
126
|
+
- Security compliance testing
|
|
127
|
+
- Protocol compliance verification
|
|
128
|
+
|
|
129
|
+
## Running Tests
|
|
130
|
+
|
|
131
|
+
### Basic Test Execution
|
|
132
|
+
```bash
|
|
133
|
+
# Run all tests
|
|
134
|
+
npm test
|
|
135
|
+
|
|
136
|
+
# Run specific test categories
|
|
137
|
+
npm run test:unit
|
|
138
|
+
npm run test:integration
|
|
139
|
+
npm run test:e2e
|
|
140
|
+
npm run test:performance
|
|
141
|
+
|
|
142
|
+
# Generate coverage reports
|
|
143
|
+
npm run test:coverage
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Specialized Testing
|
|
147
|
+
```bash
|
|
148
|
+
# Performance regression testing
|
|
149
|
+
node scripts/test/check-performance-regression.ts
|
|
150
|
+
|
|
151
|
+
# Swarm load testing
|
|
152
|
+
node scripts/test/load-test-swarm.js
|
|
153
|
+
|
|
154
|
+
# Comprehensive testing
|
|
155
|
+
node scripts/test/test-comprehensive.js
|
|
156
|
+
|
|
157
|
+
# Generate test reports
|
|
158
|
+
node scripts/test/validation-summary.ts
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Test Configuration
|
|
162
|
+
|
|
163
|
+
### Jest Configuration
|
|
164
|
+
Tests use Jest with custom configuration located in `config/jest/jest.config.js`.
|
|
165
|
+
|
|
166
|
+
### Node.js Options
|
|
167
|
+
Tests require experimental VM modules:
|
|
168
|
+
```bash
|
|
169
|
+
NODE_OPTIONS='--experimental-vm-modules'
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Test Environment
|
|
173
|
+
- Isolated test execution (maxWorkers=1)
|
|
174
|
+
- Fail-fast mode (--bail)
|
|
175
|
+
- Forced exit (--forceExit)
|
|
176
|
+
- CI-optimized settings
|
|
177
|
+
|
|
178
|
+
## Test Data & Fixtures
|
|
179
|
+
|
|
180
|
+
Test data and fixtures should be placed in appropriate test directories:
|
|
181
|
+
- `src/__tests__/fixtures/` - Test data files
|
|
182
|
+
- `src/__tests__/mocks/` - Mock implementations
|
|
183
|
+
- `src/__tests__/helpers/` - Test helper functions
|
|
184
|
+
|
|
185
|
+
## Continuous Integration
|
|
186
|
+
|
|
187
|
+
CI-specific test configuration:
|
|
188
|
+
```bash
|
|
189
|
+
npm run test:ci
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Features:
|
|
193
|
+
- Parallel execution (maxWorkers=2)
|
|
194
|
+
- Coverage reporting
|
|
195
|
+
- CI-optimized timeouts
|
|
196
|
+
- Artifact generation
|
|
197
|
+
|
|
198
|
+
## Troubleshooting
|
|
199
|
+
|
|
200
|
+
### Common Issues
|
|
201
|
+
|
|
202
|
+
**Test Failures:**
|
|
203
|
+
```bash
|
|
204
|
+
# Run tests with verbose output
|
|
205
|
+
npm test -- --verbose
|
|
206
|
+
|
|
207
|
+
# Run specific test file
|
|
208
|
+
npm test -- --testPathPattern=specific-test.test.js
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
**Performance Test Issues:**
|
|
212
|
+
```bash
|
|
213
|
+
# Check system resources
|
|
214
|
+
node scripts/test/check-performance-regression.ts
|
|
215
|
+
|
|
216
|
+
# Run isolated performance tests
|
|
217
|
+
npm run test:performance
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
**Swarm Test Failures:**
|
|
221
|
+
```bash
|
|
222
|
+
# Test swarm coordination
|
|
223
|
+
node scripts/test/test-swarm.ts
|
|
224
|
+
|
|
225
|
+
# Check Byzantine fault tolerance
|
|
226
|
+
node scripts/test/test-byzantine-resolution.js
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Memory Issues
|
|
230
|
+
If tests fail due to memory issues:
|
|
231
|
+
```bash
|
|
232
|
+
# Increase Node.js memory limit
|
|
233
|
+
NODE_OPTIONS='--experimental-vm-modules --max-old-space-size=4096' npm test
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
For legacy test scripts, see `../legacy/` directory.
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
#!/usr/bin/env deno run --allow-net --allow-read
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Documentation Link Checker
|
|
5
|
+
* Scans documentation files for broken links
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { walk } from "https://deno.land/std@0.220.0/fs/mod.ts";
|
|
9
|
+
|
|
10
|
+
interface LinkCheckResult {
|
|
11
|
+
file: string;
|
|
12
|
+
url: string;
|
|
13
|
+
status: 'ok' | 'broken' | 'timeout' | 'error';
|
|
14
|
+
statusCode?: number;
|
|
15
|
+
error?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface ScanResult {
|
|
19
|
+
totalFiles: number;
|
|
20
|
+
totalLinks: number;
|
|
21
|
+
brokenLinks: LinkCheckResult[];
|
|
22
|
+
timeouts: LinkCheckResult[];
|
|
23
|
+
errors: LinkCheckResult[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const TIMEOUT_MS = 10000; // 10 seconds
|
|
27
|
+
const USER_AGENT = 'Claude-Flow Link Checker';
|
|
28
|
+
const MAX_CONCURRENT = 10;
|
|
29
|
+
|
|
30
|
+
// Links to skip (known to have issues with automated checking)
|
|
31
|
+
const SKIP_URLS = new Set([
|
|
32
|
+
'mailto:',
|
|
33
|
+
'tel:',
|
|
34
|
+
'javascript:',
|
|
35
|
+
'#',
|
|
36
|
+
'localhost',
|
|
37
|
+
'127.0.0.1',
|
|
38
|
+
'example.com',
|
|
39
|
+
'example.org',
|
|
40
|
+
]);
|
|
41
|
+
|
|
42
|
+
function extractLinks(content: string): string[] {
|
|
43
|
+
const links: string[] = [];
|
|
44
|
+
|
|
45
|
+
// Markdown links: [text](url)
|
|
46
|
+
const markdownLinkRegex = /\[([^\]]*)\]\(([^)]+)\)/g;
|
|
47
|
+
let match;
|
|
48
|
+
while ((match = markdownLinkRegex.exec(content)) !== null) {
|
|
49
|
+
links.push(match[2]);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// HTML links: <a href="url">
|
|
53
|
+
const htmlLinkRegex = /<a[^>]+href\s*=\s*['""]([^'""]+)['""][^>]*>/gi;
|
|
54
|
+
while ((match = htmlLinkRegex.exec(content)) !== null) {
|
|
55
|
+
links.push(match[1]);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// URL references: [ref]: url
|
|
59
|
+
const refLinkRegex = /^\s*\[([^\]]+)\]:\s*(.+)$/gm;
|
|
60
|
+
while ((match = refLinkRegex.exec(content)) !== null) {
|
|
61
|
+
links.push(match[2]);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return links;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function shouldSkipUrl(url: string): boolean {
|
|
68
|
+
// Skip relative links
|
|
69
|
+
if (!url.startsWith('http://') && !url.startsWith('https://')) {
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Skip specific patterns
|
|
74
|
+
for (const skipPattern of SKIP_URLS) {
|
|
75
|
+
if (url.includes(skipPattern)) {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async function checkLink(url: string): Promise<{ status: number | null; error?: string }> {
|
|
84
|
+
try {
|
|
85
|
+
const controller = new AbortController();
|
|
86
|
+
const timeoutId = setTimeout(() => controller.abort(), TIMEOUT_MS);
|
|
87
|
+
|
|
88
|
+
const response = await fetch(url, {
|
|
89
|
+
method: 'HEAD', // Use HEAD to avoid downloading content
|
|
90
|
+
signal: controller.signal,
|
|
91
|
+
headers: {
|
|
92
|
+
'User-Agent': USER_AGENT,
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
clearTimeout(timeoutId);
|
|
97
|
+
|
|
98
|
+
return {
|
|
99
|
+
status: response.status,
|
|
100
|
+
};
|
|
101
|
+
} catch (error) {
|
|
102
|
+
if (error instanceof DOMException && error.name === 'AbortError') {
|
|
103
|
+
return { status: null, error: 'timeout' };
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
status: null,
|
|
108
|
+
error: error.message,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
async function scanFile(filePath: string): Promise<LinkCheckResult[]> {
|
|
114
|
+
const results: LinkCheckResult[] = [];
|
|
115
|
+
|
|
116
|
+
try {
|
|
117
|
+
const content = await Deno.readTextFile(filePath);
|
|
118
|
+
const links = extractLinks(content);
|
|
119
|
+
|
|
120
|
+
// Remove duplicates and filter
|
|
121
|
+
const uniqueLinks = [...new Set(links)].filter(url => !shouldSkipUrl(url));
|
|
122
|
+
|
|
123
|
+
// Check links with concurrency control
|
|
124
|
+
const semaphore = new Array(MAX_CONCURRENT).fill(0);
|
|
125
|
+
const promises = uniqueLinks.map(async (url) => {
|
|
126
|
+
// Wait for available slot
|
|
127
|
+
await new Promise<void>((resolve) => {
|
|
128
|
+
const checkSlot = () => {
|
|
129
|
+
const index = semaphore.findIndex(slot => slot === 0);
|
|
130
|
+
if (index !== -1) {
|
|
131
|
+
semaphore[index] = 1;
|
|
132
|
+
resolve();
|
|
133
|
+
} else {
|
|
134
|
+
setTimeout(checkSlot, 100);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
checkSlot();
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
try {
|
|
141
|
+
const { status, error } = await checkLink(url);
|
|
142
|
+
|
|
143
|
+
let resultStatus: LinkCheckResult['status'];
|
|
144
|
+
if (error === 'timeout') {
|
|
145
|
+
resultStatus = 'timeout';
|
|
146
|
+
} else if (error) {
|
|
147
|
+
resultStatus = 'error';
|
|
148
|
+
} else if (status && status >= 200 && status < 400) {
|
|
149
|
+
resultStatus = 'ok';
|
|
150
|
+
} else {
|
|
151
|
+
resultStatus = 'broken';
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return {
|
|
155
|
+
file: filePath,
|
|
156
|
+
url,
|
|
157
|
+
status: resultStatus,
|
|
158
|
+
statusCode: status || undefined,
|
|
159
|
+
error,
|
|
160
|
+
};
|
|
161
|
+
} finally {
|
|
162
|
+
// Release slot
|
|
163
|
+
const index = semaphore.findIndex(slot => slot === 1);
|
|
164
|
+
if (index !== -1) {
|
|
165
|
+
semaphore[index] = 0;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
results.push(...await Promise.all(promises));
|
|
171
|
+
} catch (error) {
|
|
172
|
+
console.warn(`Failed to scan ${filePath}: ${error.message}`);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return results;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
async function main(): Promise<void> {
|
|
179
|
+
console.log('Checking documentation links...\n');
|
|
180
|
+
|
|
181
|
+
const results: LinkCheckResult[] = [];
|
|
182
|
+
let fileCount = 0;
|
|
183
|
+
|
|
184
|
+
// Scan markdown and HTML files
|
|
185
|
+
const extensions = ['.md', '.html', '.htm'];
|
|
186
|
+
const directories = ['./docs', './README.md', './examples'];
|
|
187
|
+
|
|
188
|
+
for (const dir of directories) {
|
|
189
|
+
try {
|
|
190
|
+
const stat = await Deno.stat(dir);
|
|
191
|
+
if (stat.isFile) {
|
|
192
|
+
// Single file
|
|
193
|
+
const fileResults = await scanFile(dir);
|
|
194
|
+
results.push(...fileResults);
|
|
195
|
+
fileCount++;
|
|
196
|
+
} else if (stat.isDirectory) {
|
|
197
|
+
// Directory
|
|
198
|
+
for await (const entry of walk(dir, { exts: extensions })) {
|
|
199
|
+
if (entry.isFile) {
|
|
200
|
+
const fileResults = await scanFile(entry.path);
|
|
201
|
+
results.push(...fileResults);
|
|
202
|
+
fileCount++;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
} catch (error) {
|
|
207
|
+
if (!(error instanceof Deno.errors.NotFound)) {
|
|
208
|
+
console.warn(`Failed to process ${dir}: ${error.message}`);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// Analyze results
|
|
214
|
+
const scanResult: ScanResult = {
|
|
215
|
+
totalFiles: fileCount,
|
|
216
|
+
totalLinks: results.length,
|
|
217
|
+
brokenLinks: results.filter(r => r.status === 'broken'),
|
|
218
|
+
timeouts: results.filter(r => r.status === 'timeout'),
|
|
219
|
+
errors: results.filter(r => r.status === 'error'),
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
// Report results
|
|
223
|
+
console.log(`📊 Scan Summary:`);
|
|
224
|
+
console.log(` Files scanned: ${scanResult.totalFiles}`);
|
|
225
|
+
console.log(` Links checked: ${scanResult.totalLinks}`);
|
|
226
|
+
console.log(` Broken links: ${scanResult.brokenLinks.length}`);
|
|
227
|
+
console.log(` Timeouts: ${scanResult.timeouts.length}`);
|
|
228
|
+
console.log(` Errors: ${scanResult.errors.length}\n`);
|
|
229
|
+
|
|
230
|
+
// Report broken links
|
|
231
|
+
if (scanResult.brokenLinks.length > 0) {
|
|
232
|
+
console.log('❌ Broken Links:');
|
|
233
|
+
for (const result of scanResult.brokenLinks) {
|
|
234
|
+
console.log(` ${result.file}: ${result.url} (${result.statusCode})`);
|
|
235
|
+
}
|
|
236
|
+
console.log('');
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// Report timeouts
|
|
240
|
+
if (scanResult.timeouts.length > 0) {
|
|
241
|
+
console.log('⏱️ Timeouts:');
|
|
242
|
+
for (const result of scanResult.timeouts) {
|
|
243
|
+
console.log(` ${result.file}: ${result.url}`);
|
|
244
|
+
}
|
|
245
|
+
console.log('');
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// Report other errors
|
|
249
|
+
if (scanResult.errors.length > 0) {
|
|
250
|
+
console.log('⚠️ Errors:');
|
|
251
|
+
for (const result of scanResult.errors) {
|
|
252
|
+
console.log(` ${result.file}: ${result.url} (${result.error})`);
|
|
253
|
+
}
|
|
254
|
+
console.log('');
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Summary
|
|
258
|
+
const totalIssues = scanResult.brokenLinks.length + scanResult.timeouts.length + scanResult.errors.length;
|
|
259
|
+
|
|
260
|
+
if (totalIssues === 0) {
|
|
261
|
+
console.log('✅ All links are working!');
|
|
262
|
+
} else {
|
|
263
|
+
console.error(`❌ Found ${totalIssues} link issues!`);
|
|
264
|
+
|
|
265
|
+
// Don't fail CI for timeouts or minor errors, only broken links
|
|
266
|
+
if (scanResult.brokenLinks.length > 0) {
|
|
267
|
+
Deno.exit(1);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (import.meta.main) {
|
|
273
|
+
await main();
|
|
274
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
#!/usr/bin/env deno run --allow-read --allow-write
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Performance Regression Checker
|
|
5
|
+
* Compares current performance metrics against baseline
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
interface PerformanceMetric {
|
|
9
|
+
name: string;
|
|
10
|
+
value: number;
|
|
11
|
+
unit: string;
|
|
12
|
+
threshold: number; // Maximum allowed regression percentage
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface PerformanceReport {
|
|
16
|
+
timestamp: string;
|
|
17
|
+
gitHash: string;
|
|
18
|
+
metrics: PerformanceMetric[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const BASELINE_FILE = 'performance-baseline.json';
|
|
22
|
+
const CURRENT_RESULTS_FILE = 'performance-results.json';
|
|
23
|
+
const REGRESSION_THRESHOLD = 20; // 20% regression threshold
|
|
24
|
+
|
|
25
|
+
async function loadBaseline(): Promise<PerformanceReport | null> {
|
|
26
|
+
try {
|
|
27
|
+
const baselineData = await Deno.readTextFile(BASELINE_FILE);
|
|
28
|
+
return JSON.parse(baselineData);
|
|
29
|
+
} catch (error) {
|
|
30
|
+
if (error instanceof Deno.errors.NotFound) {
|
|
31
|
+
console.log('No baseline found, creating initial baseline...');
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async function loadCurrentResults(): Promise<PerformanceReport> {
|
|
39
|
+
try {
|
|
40
|
+
const currentData = await Deno.readTextFile(CURRENT_RESULTS_FILE);
|
|
41
|
+
return JSON.parse(currentData);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
console.error('Failed to load current performance results:', error.message);
|
|
44
|
+
Deno.exit(1);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function saveBaseline(report: PerformanceReport): Promise<void> {
|
|
49
|
+
await Deno.writeTextFile(BASELINE_FILE, JSON.stringify(report, null, 2));
|
|
50
|
+
console.log('Baseline updated successfully');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function calculateRegression(baseline: number, current: number): number {
|
|
54
|
+
return ((current - baseline) / baseline) * 100;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function checkRegressions(baseline: PerformanceReport, current: PerformanceReport): {
|
|
58
|
+
regressions: Array<{ metric: string; regression: number; threshold: number }>;
|
|
59
|
+
hasRegressions: boolean;
|
|
60
|
+
} {
|
|
61
|
+
const regressions: Array<{ metric: string; regression: number; threshold: number }> = [];
|
|
62
|
+
|
|
63
|
+
for (const currentMetric of current.metrics) {
|
|
64
|
+
const baselineMetric = baseline.metrics.find(m => m.name === currentMetric.name);
|
|
65
|
+
|
|
66
|
+
if (!baselineMetric) {
|
|
67
|
+
console.log(`New metric detected: ${currentMetric.name}`);
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const regression = calculateRegression(baselineMetric.value, currentMetric.value);
|
|
72
|
+
const threshold = currentMetric.threshold || REGRESSION_THRESHOLD;
|
|
73
|
+
|
|
74
|
+
if (regression > threshold) {
|
|
75
|
+
regressions.push({
|
|
76
|
+
metric: currentMetric.name,
|
|
77
|
+
regression,
|
|
78
|
+
threshold,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return {
|
|
84
|
+
regressions,
|
|
85
|
+
hasRegressions: regressions.length > 0,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function generateReport(
|
|
90
|
+
baseline: PerformanceReport,
|
|
91
|
+
current: PerformanceReport,
|
|
92
|
+
regressions: Array<{ metric: string; regression: number; threshold: number }>
|
|
93
|
+
): void {
|
|
94
|
+
console.log('\n=== Performance Regression Report ===\n');
|
|
95
|
+
|
|
96
|
+
console.log(`Baseline: ${baseline.timestamp} (${baseline.gitHash})`);
|
|
97
|
+
console.log(`Current: ${current.timestamp} (${current.gitHash})\n`);
|
|
98
|
+
|
|
99
|
+
if (regressions.length === 0) {
|
|
100
|
+
console.log('✅ No performance regressions detected!\n');
|
|
101
|
+
} else {
|
|
102
|
+
console.log('❌ Performance regressions detected:\n');
|
|
103
|
+
|
|
104
|
+
for (const regression of regressions) {
|
|
105
|
+
const baselineMetric = baseline.metrics.find(m => m.name === regression.metric)!;
|
|
106
|
+
const currentMetric = current.metrics.find(m => m.name === regression.metric)!;
|
|
107
|
+
|
|
108
|
+
console.log(` ${regression.metric}:`);
|
|
109
|
+
console.log(` Baseline: ${baselineMetric.value} ${baselineMetric.unit}`);
|
|
110
|
+
console.log(` Current: ${currentMetric.value} ${currentMetric.unit}`);
|
|
111
|
+
console.log(` Regression: ${regression.regression.toFixed(2)}% (threshold: ${regression.threshold}%)`);
|
|
112
|
+
console.log('');
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Show all metrics for reference
|
|
117
|
+
console.log('📊 All Performance Metrics:\n');
|
|
118
|
+
|
|
119
|
+
for (const currentMetric of current.metrics) {
|
|
120
|
+
const baselineMetric = baseline.metrics.find(m => m.name === currentMetric.name);
|
|
121
|
+
|
|
122
|
+
if (baselineMetric) {
|
|
123
|
+
const regression = calculateRegression(baselineMetric.value, currentMetric.value);
|
|
124
|
+
const status = regression > (currentMetric.threshold || REGRESSION_THRESHOLD) ? '❌' : '✅';
|
|
125
|
+
|
|
126
|
+
console.log(` ${status} ${currentMetric.name}: ${currentMetric.value} ${currentMetric.unit} (${regression > 0 ? '+' : ''}${regression.toFixed(2)}%)`);
|
|
127
|
+
} else {
|
|
128
|
+
console.log(` 🆕 ${currentMetric.name}: ${currentMetric.value} ${currentMetric.unit} (new metric)`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
console.log('');
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
async function main(): Promise<void> {
|
|
136
|
+
console.log('Checking for performance regressions...\n');
|
|
137
|
+
|
|
138
|
+
const baseline = await loadBaseline();
|
|
139
|
+
const current = await loadCurrentResults();
|
|
140
|
+
|
|
141
|
+
if (!baseline) {
|
|
142
|
+
console.log('No baseline found, establishing current results as baseline...');
|
|
143
|
+
await saveBaseline(current);
|
|
144
|
+
console.log('Baseline established successfully');
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const { regressions, hasRegressions } = checkRegressions(baseline, current);
|
|
149
|
+
|
|
150
|
+
generateReport(baseline, current, regressions);
|
|
151
|
+
|
|
152
|
+
if (hasRegressions) {
|
|
153
|
+
console.error('Performance regressions detected! Please investigate and fix before merging.');
|
|
154
|
+
Deno.exit(1);
|
|
155
|
+
} else {
|
|
156
|
+
console.log('Performance check passed! 🎉');
|
|
157
|
+
|
|
158
|
+
// Update baseline if this is a main branch build
|
|
159
|
+
const branch = Deno.env.get('GITHUB_REF');
|
|
160
|
+
if (branch === 'refs/heads/main') {
|
|
161
|
+
await saveBaseline(current);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (import.meta.main) {
|
|
167
|
+
await main();
|
|
168
|
+
}
|