claude-flow-novice 2.2.4 → 2.2.5
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/package.json +9 -8
- package/scripts/.claude-flow/metrics/agent-metrics.json +1 -0
- package/scripts/.claude-flow/metrics/performance.json +9 -0
- package/scripts/.claude-flow/metrics/task-metrics.json +10 -0
- package/scripts/CLEANUP_OPTIMIZATION_REPORT.json +312 -0
- package/scripts/CLEANUP_PERFORMANCE_OPTIMIZATION.md +387 -0
- package/scripts/CLEANUP_QUICK_START.md +268 -0
- package/scripts/CLEANUP_TEST_RESULTS.md +205 -0
- package/scripts/README.md +339 -0
- package/scripts/ace-query.sh +384 -0
- package/scripts/agent-token-analysis.js +430 -0
- package/scripts/auto-setup.js +332 -0
- 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/build/validate-agents.js +238 -0
- package/scripts/build-index.js +43 -0
- package/scripts/build-orchestrator.js +320 -0
- package/scripts/check-routing-stats.cjs +122 -0
- package/scripts/ci-validation.js +375 -0
- package/scripts/cleanup-blocking-coordination.sh +420 -0
- package/scripts/cleanup-idle-sessions.sh +59 -0
- package/scripts/collect-build-metrics.js +65 -0
- package/scripts/demo/README.md +79 -0
- package/scripts/demo/autoscaling-demo-simplified.js +963 -0
- package/scripts/demo/comprehensive-dashboard-test.js +693 -0
- package/scripts/demo/confidence-log.js +87 -0
- package/scripts/demo/confidence-report.js +82 -0
- package/scripts/demo/demo-multi-swarm-coordination.js +325 -0
- package/scripts/demo/demo-production-deployment.js +399 -0
- package/scripts/demo/demo-visualization-system.js +149 -0
- package/scripts/demo/performance-analysis.cjs +71 -0
- package/scripts/demo/performance-analysis.js +71 -0
- package/scripts/demo/test-autoscaling-demo.js +314 -0
- package/scripts/dependency-optimizer.js +349 -0
- package/scripts/dependency-security-assessment.js +331 -0
- package/scripts/deploy-sdk.sh +176 -0
- package/scripts/deployment-readiness-report.json +179 -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/ecosystem.config.cjs +90 -0
- package/scripts/fix-js-extensions.js +167 -0
- package/scripts/generate-basic-types.js +73 -0
- package/scripts/generate-changelog.js +318 -0
- package/scripts/git-hooks/pre-commit.sh +143 -0
- package/scripts/health-checks.js +634 -0
- package/scripts/hook-wrapper.sh +54 -0
- package/scripts/install/README.md +375 -0
- package/scripts/install/REDIS_SETUP_VALIDATION.json +245 -0
- package/scripts/install/check-prerequisites.js +303 -0
- package/scripts/install/config-wizard.js +606 -0
- package/scripts/install/dependency-checker.js +385 -0
- package/scripts/install/health-check.js +765 -0
- package/scripts/install/install.js +256 -0
- package/scripts/install/installation-benchmark.js +461 -0
- package/scripts/install/quick-install.js +720 -0
- package/scripts/install/quick-start-wizard.js +295 -0
- package/scripts/install/redis-cli.js +289 -0
- package/scripts/install/redis-install-guides.md +407 -0
- package/scripts/install/redis-setup.js +559 -0
- package/scripts/install/redis-test.js +278 -0
- package/scripts/install/service-manager.js +672 -0
- package/scripts/install/setup.js +832 -0
- package/scripts/install/uninstall.js +526 -0
- package/scripts/install/update.js +461 -0
- package/scripts/install-pre-commit-hook.sh +127 -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/memory-monitor-coordinator.js +322 -0
- package/scripts/migrate-to-sdk.sh +520 -0
- package/scripts/migration/QUICK-START.md +189 -0
- package/scripts/migration/QUICK-START.md.backup-1760135091363 +189 -0
- package/scripts/migration/README.md +464 -0
- package/scripts/migration/TASK-1.3.2-COMPLETION-REPORT.md +500 -0
- package/scripts/migration/TASK-1.3.2-COMPLETION-REPORT.md.backup-1760135091348 +500 -0
- package/scripts/migration/UPDATE-PATHS-README.md +464 -0
- package/scripts/migration/UPDATE-PATHS-README.md.backup-1760135091337 +464 -0
- package/scripts/migration/example-patterns.json +19 -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/migration/reorganize-workspace.js +504 -0
- package/scripts/migration/test-update-paths.js +359 -0
- package/scripts/migration/update-paths.js +664 -0
- package/scripts/migration/validate-migration.js +647 -0
- package/scripts/monitor-loop.sh +65 -0
- package/scripts/monitor-memory.sh +47 -0
- package/scripts/monitor-migration.js +339 -0
- package/scripts/monitor.py +43 -0
- package/scripts/monitoring/README.md +178 -0
- package/scripts/monitoring/alert-monitor.sh +220 -0
- package/scripts/monitoring/analyze-resources.sh +199 -0
- package/scripts/monitoring/dashboards/rate-limiting-dashboard.json +211 -0
- package/scripts/monitoring/dynamic-monitor.sh +85 -0
- package/scripts/monitoring/launch-stability-test.sh +184 -0
- package/scripts/monitoring/monitor-test.sh +93 -0
- package/scripts/monitoring/pre-test-validation.sh +208 -0
- package/scripts/monitoring/quick-test-alerting.sh +118 -0
- package/scripts/monitoring/quick-test-rate-limiting.sh +206 -0
- package/scripts/monitoring/rate-limiting-monitor.sh +380 -0
- package/scripts/monitoring/resource-monitor.sh +126 -0
- package/scripts/monitoring/stability-monitor.js +429 -0
- package/scripts/monitoring/test-monitor-quick.sh +54 -0
- package/scripts/monitoring/view-alerts.sh +307 -0
- package/scripts/npm-metrics-collector.js +482 -0
- package/scripts/npm-package-validation.cjs +299 -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/optimize-package-swarm.js +54 -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-monitor.js +644 -0
- package/scripts/performance-test-runner.js +698 -0
- package/scripts/post-deployment-monitoring.js +350 -0
- package/scripts/post-edit-pipeline.js +2091 -0
- package/scripts/post-install-claude-md.js +78 -0
- package/scripts/postinstall.js +79 -0
- package/scripts/pre-publish-validation.cjs +212 -0
- package/scripts/pre-publish-validation.js +429 -0
- package/scripts/redis-lua/cleanup-blocking-coordination.lua +198 -0
- package/scripts/release-announcement.js +425 -0
- package/scripts/release-notification.js +248 -0
- package/scripts/release-rollback.js +376 -0
- package/scripts/release-validation.js +460 -0
- package/scripts/rollback-sdk.sh +66 -0
- package/scripts/run-production-validation.ts +590 -0
- package/scripts/run-stability-validation.sh +687 -0
- package/scripts/security/README.md +339 -0
- package/scripts/security/deployment-validation.cjs +279 -0
- package/scripts/security/envelope-encryption-confidence-report.cjs +422 -0
- package/scripts/security/install-git-hooks.sh +132 -0
- package/scripts/security/install-git-secrets.sh +295 -0
- package/scripts/security/rotate-api-keys.js +469 -0
- package/scripts/security/ruv-swarm-safe.js +74 -0
- package/scripts/security/security-audit.cjs +538 -0
- package/scripts/security/setup-redis-auth.sh +397 -0
- package/scripts/security/validate-envelope-encryption.cjs +340 -0
- package/scripts/security-scan.js +492 -0
- package/scripts/src/web/frontend/.claude-flow/metrics/agent-metrics.json +1 -0
- package/scripts/src/web/frontend/.claude-flow/metrics/performance.json +9 -0
- package/scripts/src/web/frontend/.claude-flow/metrics/task-metrics.json +10 -0
- package/scripts/switch-api.sh +158 -0
- package/scripts/sync-agents.js +290 -0
- package/scripts/test/50-agent-test.js +625 -0
- package/scripts/test/NEW_STABILITY_TEST_GUIDE.md +407 -0
- package/scripts/test/README.md +236 -0
- package/scripts/test/STABILITY_TEST_EXAMPLE.md +347 -0
- package/scripts/test/STABILITY_TEST_README.md +480 -0
- package/scripts/test/agent-worker.js +309 -0
- package/scripts/test/ai-coordination-test.js +650 -0
- package/scripts/test/ai-mesh-coordination-test.js +416 -0
- package/scripts/test/check-links.ts +274 -0
- package/scripts/test/check-performance-regression.ts +168 -0
- package/scripts/test/cli-agent-coordination-test.js +313 -0
- package/scripts/test/coordinator-multilingual-test.js +396 -0
- package/scripts/test/coordinator-transparency-demo.js +585 -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/mesh-coordination-zero-overlap-test.js +740 -0
- package/scripts/test/multilingual-hello-world-test.js +390 -0
- package/scripts/test/quick-multilingual-demo.js +464 -0
- package/scripts/test/real-agent-test.js +312 -0
- package/scripts/test/run-phase3-compliance-tests.js +427 -0
- package/scripts/test/run-stability-test-examples.sh +292 -0
- package/scripts/test/stability-results/stability-metrics.jsonl +83 -0
- package/scripts/test/stability-results/stability-test-report.json +128 -0
- package/scripts/test/stability-results/stability-test.log +1827 -0
- package/scripts/test/stability-test-50-agents.js +734 -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/test-cleanup-performance.sh +416 -0
- package/scripts/test-dashboard-auth.cjs +203 -0
- package/scripts/test-docker-deployment.sh +207 -0
- package/scripts/test-npm-package.cjs +167 -0
- package/scripts/test-provider-routing.cjs +226 -0
- package/scripts/test-routing-telemetry.cjs +147 -0
- package/scripts/test-runner.cjs +154 -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/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/validate-agent-hooks.js +506 -0
- package/scripts/validate-changelog.js +241 -0
- package/scripts/validate-coordination-cli.js +69 -0
- package/scripts/validate-coordination-toggle-integration.cjs +501 -0
- package/scripts/validate-docker-infrastructure.sh +502 -0
- package/scripts/validate-entry-points.js +300 -0
- package/scripts/validate-stage3-performance.ts +377 -0
- package/scripts/validate-template-bundling.js +180 -0
- package/scripts/validation/README.md +33 -0
- package/scripts/validation/acl-security-validation.cjs +214 -0
- package/scripts/validation/acl-security-validation.js +402 -0
- package/scripts/validation/byzantine-verification.js +407 -0
- package/scripts/validation/final-phase-2-consensus.cjs +219 -0
- package/scripts/validation/final-security-validation.js +791 -0
- package/scripts/validation/final-wasm-validation.cjs +840 -0
- package/scripts/validation/integration-test-analysis.js +105 -0
- package/scripts/validation/phase-0-comprehensive-validation.js +474 -0
- package/scripts/validation/phase-0-consensus-report.js +139 -0
- package/scripts/validation/phase-0-final-report.js +112 -0
- package/scripts/validation/phase-0-redis-consensus-report.js +129 -0
- package/scripts/validation/phase-0-validation-improved.js +490 -0
- package/scripts/validation/phase-0-validation-test.js +65 -0
- package/scripts/validation/phase-1-consensus-report.cjs +342 -0
- package/scripts/validation/phase-1-consensus-validation.cjs +551 -0
- package/scripts/validation/phase-1-consensus-validation.js +551 -0
- package/scripts/validation/phase-2-consensus-report.cjs +186 -0
- package/scripts/validation/phase-2-validation.cjs +171 -0
- package/scripts/validation/phase-2-validation.js +171 -0
- package/scripts/validation/phase-4-consensus-report.js +181 -0
- package/scripts/validation/phase-4-final-validation.js +351 -0
- package/scripts/validation/phase-5-consensus-report.cjs +113 -0
- package/scripts/validation/phase-5-consensus-report.js +113 -0
- package/scripts/validation/security-analysis.js +49 -0
- package/scripts/validation/security-validation.js +492 -0
- package/scripts/validation/simple-security-validation.js +464 -0
- package/scripts/verify-installation.js +112 -0
- package/scripts/verify-mcp-server.js +86 -0
- package/scripts/verify-sdk-phase1.cjs +293 -0
|
@@ -0,0 +1,785 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Phase 2 Validation Script
|
|
4
|
+
* Comprehensive validation of Phase 2 User Configuration System implementation
|
|
5
|
+
*
|
|
6
|
+
* Validates all critical requirements:
|
|
7
|
+
* - Interactive setup wizard (<5 minute completion)
|
|
8
|
+
* - Framework detection (>90% accuracy)
|
|
9
|
+
* - CLI commands functionality
|
|
10
|
+
* - Configuration persistence
|
|
11
|
+
* - Byzantine security integration
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import fs from 'fs/promises';
|
|
15
|
+
import path from 'path';
|
|
16
|
+
import { fileURLToPath } from 'url';
|
|
17
|
+
import chalk from 'chalk';
|
|
18
|
+
import { InteractiveSetupWizard } from '../src/validation/cli/interactive-setup-wizard.js';
|
|
19
|
+
import { ValidationCommands } from '../src/validation/cli/validation-commands.js';
|
|
20
|
+
import { FrameworkDetector } from '../src/completion/framework-detector.js';
|
|
21
|
+
import { TruthConfigManager } from '../src/validation/truth-config-manager.js';
|
|
22
|
+
|
|
23
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
24
|
+
const TEMP_TEST_DIR = path.join(__dirname, '..', 'temp-validation');
|
|
25
|
+
|
|
26
|
+
class Phase2Validator {
|
|
27
|
+
constructor() {
|
|
28
|
+
this.results = {
|
|
29
|
+
interactiveWizard: { passed: 0, failed: 0, tests: [] },
|
|
30
|
+
frameworkDetection: { passed: 0, failed: 0, tests: [] },
|
|
31
|
+
cliCommands: { passed: 0, failed: 0, tests: [] },
|
|
32
|
+
configPersistence: { passed: 0, failed: 0, tests: [] },
|
|
33
|
+
byzantineSecurity: { passed: 0, failed: 0, tests: [] },
|
|
34
|
+
performance: { passed: 0, failed: 0, tests: [] }
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async runValidation() {
|
|
39
|
+
console.log(chalk.blue.bold('🔍 Phase 2 User Configuration System Validation\n'));
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
await this.setupTestEnvironment();
|
|
43
|
+
|
|
44
|
+
await this.validateInteractiveWizard();
|
|
45
|
+
await this.validateFrameworkDetection();
|
|
46
|
+
await this.validateCLICommands();
|
|
47
|
+
await this.validateConfigurationPersistence();
|
|
48
|
+
await this.validateByzantineSecurity();
|
|
49
|
+
await this.validatePerformanceRequirements();
|
|
50
|
+
|
|
51
|
+
await this.cleanupTestEnvironment();
|
|
52
|
+
|
|
53
|
+
this.displayResults();
|
|
54
|
+
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.error(chalk.red(`\n❌ Validation failed: ${error.message}`));
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async setupTestEnvironment() {
|
|
62
|
+
console.log(chalk.gray('🔧 Setting up test environment...'));
|
|
63
|
+
|
|
64
|
+
await fs.rm(TEMP_TEST_DIR, { recursive: true, force: true });
|
|
65
|
+
await fs.mkdir(TEMP_TEST_DIR, { recursive: true });
|
|
66
|
+
|
|
67
|
+
console.log(chalk.green('✅ Test environment ready\n'));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async cleanupTestEnvironment() {
|
|
71
|
+
console.log(chalk.gray('\n🧹 Cleaning up test environment...'));
|
|
72
|
+
await fs.rm(TEMP_TEST_DIR, { recursive: true, force: true });
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
async validateInteractiveWizard() {
|
|
76
|
+
console.log(chalk.blue('📋 Validating Interactive Setup Wizard'));
|
|
77
|
+
|
|
78
|
+
await this.runTest('interactiveWizard', 'Wizard initialization', async () => {
|
|
79
|
+
const projectDir = await this.createTestProject('javascript');
|
|
80
|
+
const wizard = new InteractiveSetupWizard({ basePath: projectDir });
|
|
81
|
+
|
|
82
|
+
// Should initialize without errors
|
|
83
|
+
expect(wizard).toBeDefined();
|
|
84
|
+
expect(wizard.basePath).toBe(projectDir);
|
|
85
|
+
|
|
86
|
+
await wizard.cleanup();
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
await this.runTest('interactiveWizard', 'Setup completion time (<5 minutes)', async () => {
|
|
90
|
+
const projectDir = await this.createTestProject('javascript');
|
|
91
|
+
const wizard = new InteractiveSetupWizard({ basePath: projectDir });
|
|
92
|
+
|
|
93
|
+
const startTime = Date.now();
|
|
94
|
+
|
|
95
|
+
// Mock automated setup
|
|
96
|
+
const result = await wizard.runSetupWizard({
|
|
97
|
+
automated: true,
|
|
98
|
+
inputs: {
|
|
99
|
+
experienceLevel: 'novice',
|
|
100
|
+
framework: 'javascript',
|
|
101
|
+
autoHooks: true
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
const setupTime = (Date.now() - startTime) / 1000;
|
|
106
|
+
|
|
107
|
+
expect(result.success).toBe(true);
|
|
108
|
+
expect(setupTime).toBeLessThan(300); // Less than 5 minutes
|
|
109
|
+
|
|
110
|
+
await wizard.cleanup();
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
await this.runTest('interactiveWizard', 'Configuration file creation', async () => {
|
|
114
|
+
const projectDir = await this.createTestProject('javascript');
|
|
115
|
+
const wizard = new InteractiveSetupWizard({ basePath: projectDir });
|
|
116
|
+
|
|
117
|
+
await wizard.runSetupWizard({
|
|
118
|
+
automated: true,
|
|
119
|
+
inputs: { experienceLevel: 'novice', framework: 'javascript' }
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
const configPath = path.join(projectDir, '.swarm', 'user-preferences.json');
|
|
123
|
+
const configExists = await this.fileExists(configPath);
|
|
124
|
+
|
|
125
|
+
expect(configExists).toBe(true);
|
|
126
|
+
|
|
127
|
+
const configContent = JSON.parse(await fs.readFile(configPath, 'utf8'));
|
|
128
|
+
expect(configContent.experienceLevel).toBe('novice');
|
|
129
|
+
expect(configContent.setupDate).toBeDefined();
|
|
130
|
+
|
|
131
|
+
await wizard.cleanup();
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
async validateFrameworkDetection() {
|
|
136
|
+
console.log(chalk.blue('🔍 Validating Framework Detection (>90% accuracy requirement)'));
|
|
137
|
+
|
|
138
|
+
await this.runTest('frameworkDetection', 'JavaScript detection accuracy', async () => {
|
|
139
|
+
const projectDir = await this.createJavaScriptProject();
|
|
140
|
+
const detector = new FrameworkDetector({ basePath: projectDir });
|
|
141
|
+
await detector.initialize();
|
|
142
|
+
|
|
143
|
+
const result = await detector.detectFramework();
|
|
144
|
+
|
|
145
|
+
expect(result.detected).toBe('javascript');
|
|
146
|
+
expect(result.confidence).toBeGreaterThan(0.9);
|
|
147
|
+
|
|
148
|
+
await detector.close();
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
await this.runTest('frameworkDetection', 'TypeScript detection accuracy', async () => {
|
|
152
|
+
const projectDir = await this.createTypeScriptProject();
|
|
153
|
+
const detector = new FrameworkDetector({ basePath: projectDir });
|
|
154
|
+
await detector.initialize();
|
|
155
|
+
|
|
156
|
+
const result = await detector.detectFramework();
|
|
157
|
+
|
|
158
|
+
expect(result.detected).toBe('typescript');
|
|
159
|
+
expect(result.confidence).toBeGreaterThan(0.9);
|
|
160
|
+
|
|
161
|
+
await detector.close();
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
await this.runTest('frameworkDetection', 'Python detection accuracy', async () => {
|
|
165
|
+
const projectDir = await this.createPythonProject();
|
|
166
|
+
const detector = new FrameworkDetector({ basePath: projectDir });
|
|
167
|
+
await detector.initialize();
|
|
168
|
+
|
|
169
|
+
const result = await detector.detectFramework();
|
|
170
|
+
|
|
171
|
+
expect(result.detected).toBe('python');
|
|
172
|
+
expect(result.confidence).toBeGreaterThan(0.9);
|
|
173
|
+
|
|
174
|
+
await detector.close();
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
await this.runTest('frameworkDetection', 'React framework detection', async () => {
|
|
178
|
+
const projectDir = await this.createReactProject();
|
|
179
|
+
const detector = new FrameworkDetector({ basePath: projectDir });
|
|
180
|
+
await detector.initialize();
|
|
181
|
+
|
|
182
|
+
const result = await detector.detectFramework();
|
|
183
|
+
|
|
184
|
+
expect(['javascript', 'typescript']).toContain(result.detected);
|
|
185
|
+
expect(result.evidence.webFrameworks).toBeDefined();
|
|
186
|
+
expect(result.evidence.webFrameworks.some(f => f.name === 'react')).toBe(true);
|
|
187
|
+
expect(result.confidence).toBeGreaterThan(0.9);
|
|
188
|
+
|
|
189
|
+
await detector.close();
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
await this.runTest('frameworkDetection', 'Detection performance', async () => {
|
|
193
|
+
const projectDir = await this.createTypeScriptProject();
|
|
194
|
+
const detector = new FrameworkDetector({ basePath: projectDir });
|
|
195
|
+
await detector.initialize();
|
|
196
|
+
|
|
197
|
+
const startTime = Date.now();
|
|
198
|
+
const result = await detector.detectFramework();
|
|
199
|
+
const detectionTime = Date.now() - startTime;
|
|
200
|
+
|
|
201
|
+
expect(detectionTime).toBeLessThan(5000); // Less than 5 seconds
|
|
202
|
+
expect(result.metadata.detectionTime).toBeLessThan(3000); // Less than 3 seconds
|
|
203
|
+
|
|
204
|
+
await detector.close();
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
async validateCLICommands() {
|
|
209
|
+
console.log(chalk.blue('⚙️ Validating CLI Commands'));
|
|
210
|
+
|
|
211
|
+
const testCommands = [
|
|
212
|
+
'setup', 'check', 'show-config', 'enable-hooks', 'disable-hooks',
|
|
213
|
+
'add-framework', 'configure-gates'
|
|
214
|
+
];
|
|
215
|
+
|
|
216
|
+
for (const command of testCommands) {
|
|
217
|
+
await this.runTest('cliCommands', `Command: ${command}`, async () => {
|
|
218
|
+
const projectDir = await this.createTestProject('javascript');
|
|
219
|
+
const commands = new ValidationCommands({ basePath: projectDir });
|
|
220
|
+
|
|
221
|
+
let result;
|
|
222
|
+
|
|
223
|
+
switch (command) {
|
|
224
|
+
case 'setup':
|
|
225
|
+
result = await commands.setupCommand({
|
|
226
|
+
automated: true,
|
|
227
|
+
inputs: { experienceLevel: 'novice', framework: 'javascript' }
|
|
228
|
+
});
|
|
229
|
+
break;
|
|
230
|
+
|
|
231
|
+
case 'show-config':
|
|
232
|
+
// Setup first
|
|
233
|
+
await commands.setupCommand({
|
|
234
|
+
automated: true,
|
|
235
|
+
inputs: { experienceLevel: 'novice', framework: 'javascript' }
|
|
236
|
+
});
|
|
237
|
+
result = await commands.showConfigCommand();
|
|
238
|
+
break;
|
|
239
|
+
|
|
240
|
+
case 'check':
|
|
241
|
+
// Setup first
|
|
242
|
+
await commands.setupCommand({
|
|
243
|
+
automated: true,
|
|
244
|
+
inputs: { experienceLevel: 'novice', framework: 'javascript' }
|
|
245
|
+
});
|
|
246
|
+
result = await commands.checkCommand();
|
|
247
|
+
break;
|
|
248
|
+
|
|
249
|
+
case 'enable-hooks':
|
|
250
|
+
// Setup first
|
|
251
|
+
await commands.setupCommand({
|
|
252
|
+
automated: true,
|
|
253
|
+
inputs: { experienceLevel: 'novice', framework: 'javascript' }
|
|
254
|
+
});
|
|
255
|
+
result = await commands.enableHooksCommand();
|
|
256
|
+
break;
|
|
257
|
+
|
|
258
|
+
case 'disable-hooks':
|
|
259
|
+
// Setup and enable first
|
|
260
|
+
await commands.setupCommand({
|
|
261
|
+
automated: true,
|
|
262
|
+
inputs: { experienceLevel: 'novice', framework: 'javascript' }
|
|
263
|
+
});
|
|
264
|
+
await commands.enableHooksCommand();
|
|
265
|
+
result = await commands.disableHooksCommand();
|
|
266
|
+
break;
|
|
267
|
+
|
|
268
|
+
case 'add-framework':
|
|
269
|
+
// Setup first
|
|
270
|
+
await commands.setupCommand({
|
|
271
|
+
automated: true,
|
|
272
|
+
inputs: { experienceLevel: 'expert', framework: 'javascript' }
|
|
273
|
+
});
|
|
274
|
+
result = await commands.addFrameworkCommand({
|
|
275
|
+
automated: true,
|
|
276
|
+
inputs: {
|
|
277
|
+
name: 'Test Framework',
|
|
278
|
+
filePatterns: ['*.test'],
|
|
279
|
+
testingFramework: 'unit',
|
|
280
|
+
truthThreshold: 0.8
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
break;
|
|
284
|
+
|
|
285
|
+
case 'configure-gates':
|
|
286
|
+
// Setup first
|
|
287
|
+
await commands.setupCommand({
|
|
288
|
+
automated: true,
|
|
289
|
+
inputs: { experienceLevel: 'intermediate', framework: 'javascript' }
|
|
290
|
+
});
|
|
291
|
+
result = await commands.configureGatesCommand({
|
|
292
|
+
automated: true,
|
|
293
|
+
inputs: {
|
|
294
|
+
truthScore: 0.85,
|
|
295
|
+
testCoverage: 90,
|
|
296
|
+
codeQuality: 'A',
|
|
297
|
+
documentationCoverage: 80
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
break;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
expect(result).toBeDefined();
|
|
304
|
+
if (result.success !== undefined) {
|
|
305
|
+
expect(result.success).toBe(true);
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
async validateConfigurationPersistence() {
|
|
312
|
+
console.log(chalk.blue('💾 Validating Configuration Persistence'));
|
|
313
|
+
|
|
314
|
+
await this.runTest('configPersistence', 'Configuration saves correctly', async () => {
|
|
315
|
+
const projectDir = await this.createTestProject('javascript');
|
|
316
|
+
const configManager = new TruthConfigManager({
|
|
317
|
+
configDir: path.join(projectDir, '.swarm', 'configs')
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
await configManager.initialize();
|
|
321
|
+
|
|
322
|
+
const config = await configManager.createFromFramework('TDD');
|
|
323
|
+
const saveResult = await configManager.saveConfiguration(config, 'test_config');
|
|
324
|
+
|
|
325
|
+
expect(saveResult.configId).toBeDefined();
|
|
326
|
+
expect(saveResult.filepath).toBeDefined();
|
|
327
|
+
|
|
328
|
+
const savedExists = await this.fileExists(saveResult.filepath);
|
|
329
|
+
expect(savedExists).toBe(true);
|
|
330
|
+
|
|
331
|
+
await configManager.cleanup();
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
await this.runTest('configPersistence', 'Configuration persists across sessions', async () => {
|
|
335
|
+
const projectDir = await this.createTestProject('javascript');
|
|
336
|
+
|
|
337
|
+
// First session - setup
|
|
338
|
+
const commands1 = new ValidationCommands({ basePath: projectDir });
|
|
339
|
+
const setupResult = await commands1.setupCommand({
|
|
340
|
+
automated: true,
|
|
341
|
+
inputs: { experienceLevel: 'intermediate', framework: 'javascript' }
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
expect(setupResult.success).toBe(true);
|
|
345
|
+
|
|
346
|
+
// Second session - verify persistence
|
|
347
|
+
const commands2 = new ValidationCommands({ basePath: projectDir });
|
|
348
|
+
const configResult = await commands2.showConfigCommand();
|
|
349
|
+
|
|
350
|
+
expect(configResult.success).toBe(true);
|
|
351
|
+
expect(configResult.config.experienceLevel).toBe('intermediate');
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
await this.runTest('configPersistence', 'Configuration can be updated', async () => {
|
|
355
|
+
const projectDir = await this.createTestProject('javascript');
|
|
356
|
+
const commands = new ValidationCommands({ basePath: projectDir });
|
|
357
|
+
|
|
358
|
+
// Initial setup
|
|
359
|
+
await commands.setupCommand({
|
|
360
|
+
automated: true,
|
|
361
|
+
inputs: { experienceLevel: 'novice', framework: 'javascript' }
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
// Update quality gates
|
|
365
|
+
const updateResult = await commands.configureGatesCommand({
|
|
366
|
+
automated: true,
|
|
367
|
+
inputs: {
|
|
368
|
+
truthScore: 0.95,
|
|
369
|
+
testCoverage: 98,
|
|
370
|
+
codeQuality: 'A',
|
|
371
|
+
documentationCoverage: 90
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
expect(updateResult.success).toBe(true);
|
|
376
|
+
|
|
377
|
+
// Verify update persisted
|
|
378
|
+
const configResult = await commands.showConfigCommand();
|
|
379
|
+
expect(configResult.config.qualityGates.truthScore).toBe(0.95);
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
async validateByzantineSecurity() {
|
|
384
|
+
console.log(chalk.blue('🛡️ Validating Byzantine Security Integration'));
|
|
385
|
+
|
|
386
|
+
await this.runTest('byzantineSecurity', 'Valid configurations pass Byzantine validation', async () => {
|
|
387
|
+
const configManager = new TruthConfigManager({
|
|
388
|
+
configDir: path.join(TEMP_TEST_DIR, 'byzantine-test')
|
|
389
|
+
});
|
|
390
|
+
await configManager.initialize();
|
|
391
|
+
|
|
392
|
+
const config = await configManager.createFromFramework('TDD');
|
|
393
|
+
const validation = await configManager.validateConfiguration(config);
|
|
394
|
+
|
|
395
|
+
expect(validation.valid).toBe(true);
|
|
396
|
+
expect(validation.byzantineFaultTolerant).toBe(true);
|
|
397
|
+
expect(validation.validationId).toBeDefined();
|
|
398
|
+
|
|
399
|
+
await configManager.cleanup();
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
await this.runTest('byzantineSecurity', 'Malicious patterns are detected', async () => {
|
|
403
|
+
const configManager = new TruthConfigManager({
|
|
404
|
+
configDir: path.join(TEMP_TEST_DIR, 'byzantine-test-malicious')
|
|
405
|
+
});
|
|
406
|
+
await configManager.initialize();
|
|
407
|
+
|
|
408
|
+
// Create suspicious configuration
|
|
409
|
+
const maliciousConfig = {
|
|
410
|
+
framework: 'TDD',
|
|
411
|
+
threshold: 0.05, // Suspiciously low
|
|
412
|
+
weights: {
|
|
413
|
+
agentReliability: 0.95, // Excessive concentration
|
|
414
|
+
crossValidation: 0.01,
|
|
415
|
+
externalVerification: 0.01,
|
|
416
|
+
factualConsistency: 0.02,
|
|
417
|
+
logicalCoherence: 0.01
|
|
418
|
+
},
|
|
419
|
+
checks: {
|
|
420
|
+
historicalValidation: false,
|
|
421
|
+
crossAgentValidation: false,
|
|
422
|
+
externalValidation: false,
|
|
423
|
+
logicalValidation: false,
|
|
424
|
+
statisticalValidation: false
|
|
425
|
+
},
|
|
426
|
+
confidence: {
|
|
427
|
+
level: 0.5,
|
|
428
|
+
minSampleSize: 1,
|
|
429
|
+
maxErrorMargin: 0.45
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
const validation = await configManager.validateConfiguration(maliciousConfig);
|
|
434
|
+
|
|
435
|
+
expect(validation.valid).toBe(false);
|
|
436
|
+
expect(validation.byzantineFaultTolerant).toBe(false);
|
|
437
|
+
expect(validation.warnings.length).toBeGreaterThan(0);
|
|
438
|
+
|
|
439
|
+
await configManager.cleanup();
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
await this.runTest('byzantineSecurity', 'Configuration integrity checking', async () => {
|
|
443
|
+
const configManager = new TruthConfigManager({
|
|
444
|
+
configDir: path.join(TEMP_TEST_DIR, 'integrity-test')
|
|
445
|
+
});
|
|
446
|
+
await configManager.initialize();
|
|
447
|
+
|
|
448
|
+
const config = await configManager.createFromFramework('SPARC');
|
|
449
|
+
const hash1 = configManager.hashConfig(config);
|
|
450
|
+
|
|
451
|
+
// Small delay to ensure different timestamp
|
|
452
|
+
await new Promise(resolve => setTimeout(resolve, 10));
|
|
453
|
+
|
|
454
|
+
const hash2 = configManager.hashConfig(config);
|
|
455
|
+
|
|
456
|
+
expect(hash1).toBe(hash2); // Same config should produce same hash
|
|
457
|
+
|
|
458
|
+
await configManager.cleanup();
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
async validatePerformanceRequirements() {
|
|
463
|
+
console.log(chalk.blue('🚀 Validating Performance Requirements'));
|
|
464
|
+
|
|
465
|
+
await this.runTest('performance', 'Setup wizard completes in <5 minutes', async () => {
|
|
466
|
+
const projectDir = await this.createTestProject('typescript');
|
|
467
|
+
const wizard = new InteractiveSetupWizard({ basePath: projectDir });
|
|
468
|
+
|
|
469
|
+
const startTime = Date.now();
|
|
470
|
+
|
|
471
|
+
const result = await wizard.runSetupWizard({
|
|
472
|
+
automated: true,
|
|
473
|
+
inputs: {
|
|
474
|
+
experienceLevel: 'intermediate',
|
|
475
|
+
framework: 'typescript',
|
|
476
|
+
customGates: true,
|
|
477
|
+
truthScore: 0.85,
|
|
478
|
+
testCoverage: 95
|
|
479
|
+
}
|
|
480
|
+
});
|
|
481
|
+
|
|
482
|
+
const setupTime = (Date.now() - startTime) / 1000;
|
|
483
|
+
|
|
484
|
+
expect(result.success).toBe(true);
|
|
485
|
+
expect(setupTime).toBeLessThan(300); // Less than 5 minutes
|
|
486
|
+
expect(setupTime).toBeLessThan(60); // Ideally less than 1 minute
|
|
487
|
+
|
|
488
|
+
await wizard.cleanup();
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
await this.runTest('performance', 'Framework detection is fast', async () => {
|
|
492
|
+
const projectDir = await this.createReactProject();
|
|
493
|
+
const detector = new FrameworkDetector({ basePath: projectDir });
|
|
494
|
+
await detector.initialize();
|
|
495
|
+
|
|
496
|
+
const startTime = Date.now();
|
|
497
|
+
const result = await detector.detectFramework();
|
|
498
|
+
const detectionTime = Date.now() - startTime;
|
|
499
|
+
|
|
500
|
+
expect(detectionTime).toBeLessThan(10000); // Less than 10 seconds
|
|
501
|
+
expect(result.metadata.detectionTime).toBeLessThan(5000); // Less than 5 seconds
|
|
502
|
+
|
|
503
|
+
await detector.close();
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
await this.runTest('performance', 'CLI commands respond quickly', async () => {
|
|
507
|
+
const projectDir = await this.createTestProject('javascript');
|
|
508
|
+
const commands = new ValidationCommands({ basePath: projectDir });
|
|
509
|
+
|
|
510
|
+
// Setup first
|
|
511
|
+
const setupStart = Date.now();
|
|
512
|
+
await commands.setupCommand({
|
|
513
|
+
automated: true,
|
|
514
|
+
inputs: { experienceLevel: 'novice', framework: 'javascript' }
|
|
515
|
+
});
|
|
516
|
+
const setupTime = Date.now() - setupStart;
|
|
517
|
+
|
|
518
|
+
// Test show-config performance
|
|
519
|
+
const configStart = Date.now();
|
|
520
|
+
await commands.showConfigCommand();
|
|
521
|
+
const configTime = Date.now() - configStart;
|
|
522
|
+
|
|
523
|
+
expect(setupTime).toBeLessThan(30000); // Less than 30 seconds for setup
|
|
524
|
+
expect(configTime).toBeLessThan(2000); // Less than 2 seconds for show-config
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
async runTest(category, testName, testFn) {
|
|
529
|
+
try {
|
|
530
|
+
await testFn();
|
|
531
|
+
this.results[category].passed++;
|
|
532
|
+
this.results[category].tests.push({ name: testName, status: 'PASS' });
|
|
533
|
+
console.log(chalk.green(` ✅ ${testName}`));
|
|
534
|
+
} catch (error) {
|
|
535
|
+
this.results[category].failed++;
|
|
536
|
+
this.results[category].tests.push({
|
|
537
|
+
name: testName,
|
|
538
|
+
status: 'FAIL',
|
|
539
|
+
error: error.message
|
|
540
|
+
});
|
|
541
|
+
console.log(chalk.red(` ❌ ${testName}: ${error.message}`));
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
displayResults() {
|
|
546
|
+
console.log(chalk.blue.bold('\n📊 Validation Results Summary\n'));
|
|
547
|
+
|
|
548
|
+
let totalPassed = 0;
|
|
549
|
+
let totalFailed = 0;
|
|
550
|
+
|
|
551
|
+
for (const [category, results] of Object.entries(this.results)) {
|
|
552
|
+
const categoryName = category.replace(/([A-Z])/g, ' $1').replace(/^./, str => str.toUpperCase());
|
|
553
|
+
const total = results.passed + results.failed;
|
|
554
|
+
|
|
555
|
+
totalPassed += results.passed;
|
|
556
|
+
totalFailed += results.failed;
|
|
557
|
+
|
|
558
|
+
let status = '✅';
|
|
559
|
+
if (results.failed > 0) {
|
|
560
|
+
status = results.failed > results.passed ? '❌' : '⚠️';
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
console.log(`${status} ${chalk.bold(categoryName)}: ${chalk.green(results.passed)}/${total} passed`);
|
|
564
|
+
|
|
565
|
+
if (results.failed > 0) {
|
|
566
|
+
const failedTests = results.tests.filter(t => t.status === 'FAIL');
|
|
567
|
+
failedTests.forEach(test => {
|
|
568
|
+
console.log(chalk.red(` • ${test.name}: ${test.error}`));
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
console.log(chalk.blue('\n' + '='.repeat(50)));
|
|
574
|
+
console.log(chalk.bold(`Total: ${chalk.green(totalPassed)} passed, ${totalFailed > 0 ? chalk.red(totalFailed) : '0'} failed`));
|
|
575
|
+
|
|
576
|
+
// Phase 2 Critical Requirements Check
|
|
577
|
+
const criticalRequirements = this.checkCriticalRequirements();
|
|
578
|
+
|
|
579
|
+
console.log(chalk.blue.bold('\n🎯 Phase 2 Critical Requirements Status'));
|
|
580
|
+
criticalRequirements.forEach(req => {
|
|
581
|
+
const icon = req.met ? '✅' : '❌';
|
|
582
|
+
const color = req.met ? chalk.green : chalk.red;
|
|
583
|
+
console.log(`${icon} ${color(req.requirement)}`);
|
|
584
|
+
});
|
|
585
|
+
|
|
586
|
+
const allRequirementsMet = criticalRequirements.every(req => req.met);
|
|
587
|
+
|
|
588
|
+
if (allRequirementsMet && totalFailed === 0) {
|
|
589
|
+
console.log(chalk.green.bold('\n🎉 Phase 2 User Configuration System - VALIDATION PASSED!'));
|
|
590
|
+
console.log(chalk.green('All critical requirements have been successfully implemented.'));
|
|
591
|
+
process.exit(0);
|
|
592
|
+
} else {
|
|
593
|
+
console.log(chalk.red.bold('\n❌ Phase 2 User Configuration System - VALIDATION FAILED!'));
|
|
594
|
+
console.log(chalk.red('Some critical requirements are not met or tests failed.'));
|
|
595
|
+
process.exit(1);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
checkCriticalRequirements() {
|
|
600
|
+
return [
|
|
601
|
+
{
|
|
602
|
+
requirement: 'Interactive setup wizard completes in <5 minutes for 95% of users',
|
|
603
|
+
met: this.results.interactiveWizard.passed > 0 && this.results.performance.passed > 0
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
requirement: 'Framework detection achieves >90% accuracy',
|
|
607
|
+
met: this.results.frameworkDetection.passed >= 4 && this.results.frameworkDetection.failed === 0
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
requirement: 'All essential CLI commands work with helpful error messages',
|
|
611
|
+
met: this.results.cliCommands.passed >= 7 && this.results.cliCommands.failed === 0
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
requirement: 'Custom framework support allows users to add frameworks',
|
|
615
|
+
met: this.results.cliCommands.tests.some(t => t.name.includes('add-framework') && t.status === 'PASS')
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
requirement: 'Configuration persistence works correctly across sessions',
|
|
619
|
+
met: this.results.configPersistence.passed >= 2 && this.results.configPersistence.failed === 0
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
requirement: 'Byzantine security prevents invalid configuration submissions',
|
|
623
|
+
met: this.results.byzantineSecurity.passed >= 2 && this.results.byzantineSecurity.failed === 0
|
|
624
|
+
}
|
|
625
|
+
];
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
// Test project creation methods
|
|
629
|
+
|
|
630
|
+
async createTestProject(type) {
|
|
631
|
+
const projectDir = path.join(TEMP_TEST_DIR, `${type}-${Date.now()}`);
|
|
632
|
+
await fs.mkdir(projectDir, { recursive: true });
|
|
633
|
+
|
|
634
|
+
switch (type) {
|
|
635
|
+
case 'javascript':
|
|
636
|
+
return await this.createJavaScriptProject(projectDir);
|
|
637
|
+
case 'typescript':
|
|
638
|
+
return await this.createTypeScriptProject(projectDir);
|
|
639
|
+
case 'python':
|
|
640
|
+
return await this.createPythonProject(projectDir);
|
|
641
|
+
case 'react':
|
|
642
|
+
return await this.createReactProject(projectDir);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
return projectDir;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
async createJavaScriptProject(dir = null) {
|
|
649
|
+
if (!dir) {
|
|
650
|
+
dir = path.join(TEMP_TEST_DIR, `js-${Date.now()}`);
|
|
651
|
+
await fs.mkdir(dir, { recursive: true });
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
const packageJson = {
|
|
655
|
+
name: 'test-js-project',
|
|
656
|
+
version: '1.0.0',
|
|
657
|
+
main: 'index.js',
|
|
658
|
+
scripts: { test: 'jest' },
|
|
659
|
+
devDependencies: { jest: '^29.0.0' }
|
|
660
|
+
};
|
|
661
|
+
|
|
662
|
+
await fs.writeFile(path.join(dir, 'package.json'), JSON.stringify(packageJson, null, 2));
|
|
663
|
+
await fs.writeFile(path.join(dir, 'index.js'), 'console.log("Hello World");');
|
|
664
|
+
|
|
665
|
+
return dir;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
async createTypeScriptProject(dir = null) {
|
|
669
|
+
if (!dir) {
|
|
670
|
+
dir = path.join(TEMP_TEST_DIR, `ts-${Date.now()}`);
|
|
671
|
+
await fs.mkdir(dir, { recursive: true });
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
const packageJson = {
|
|
675
|
+
name: 'test-ts-project',
|
|
676
|
+
version: '1.0.0',
|
|
677
|
+
devDependencies: {
|
|
678
|
+
typescript: '^5.0.0',
|
|
679
|
+
'@types/node': '^20.0.0',
|
|
680
|
+
jest: '^29.0.0'
|
|
681
|
+
}
|
|
682
|
+
};
|
|
683
|
+
|
|
684
|
+
const tsConfig = {
|
|
685
|
+
compilerOptions: {
|
|
686
|
+
target: 'ES2020',
|
|
687
|
+
module: 'commonjs',
|
|
688
|
+
strict: true
|
|
689
|
+
}
|
|
690
|
+
};
|
|
691
|
+
|
|
692
|
+
await fs.writeFile(path.join(dir, 'package.json'), JSON.stringify(packageJson, null, 2));
|
|
693
|
+
await fs.writeFile(path.join(dir, 'tsconfig.json'), JSON.stringify(tsConfig, null, 2));
|
|
694
|
+
await fs.writeFile(path.join(dir, 'index.ts'), 'const message: string = "Hello TypeScript";');
|
|
695
|
+
|
|
696
|
+
return dir;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
async createPythonProject(dir = null) {
|
|
700
|
+
if (!dir) {
|
|
701
|
+
dir = path.join(TEMP_TEST_DIR, `py-${Date.now()}`);
|
|
702
|
+
await fs.mkdir(dir, { recursive: true });
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
await fs.writeFile(path.join(dir, 'requirements.txt'), 'pytest>=7.0.0\nrequests>=2.28.0');
|
|
706
|
+
await fs.writeFile(path.join(dir, 'setup.py'), 'from setuptools import setup\nsetup(name="test")');
|
|
707
|
+
await fs.writeFile(path.join(dir, 'main.py'), 'def hello():\n return "Hello Python"');
|
|
708
|
+
|
|
709
|
+
return dir;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
async createReactProject(dir = null) {
|
|
713
|
+
if (!dir) {
|
|
714
|
+
dir = path.join(TEMP_TEST_DIR, `react-${Date.now()}`);
|
|
715
|
+
await fs.mkdir(dir, { recursive: true });
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
const packageJson = {
|
|
719
|
+
name: 'test-react-project',
|
|
720
|
+
version: '1.0.0',
|
|
721
|
+
dependencies: {
|
|
722
|
+
react: '^18.0.0',
|
|
723
|
+
'react-dom': '^18.0.0'
|
|
724
|
+
}
|
|
725
|
+
};
|
|
726
|
+
|
|
727
|
+
await fs.writeFile(path.join(dir, 'package.json'), JSON.stringify(packageJson, null, 2));
|
|
728
|
+
await fs.mkdir(path.join(dir, 'src'), { recursive: true });
|
|
729
|
+
await fs.writeFile(
|
|
730
|
+
path.join(dir, 'src', 'App.jsx'),
|
|
731
|
+
'import React from "react";\nfunction App() { return <h1>Hello React</h1>; }\nexport default App;'
|
|
732
|
+
);
|
|
733
|
+
|
|
734
|
+
return dir;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
async fileExists(filePath) {
|
|
738
|
+
try {
|
|
739
|
+
await fs.access(filePath);
|
|
740
|
+
return true;
|
|
741
|
+
} catch {
|
|
742
|
+
return false;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
// Simple expect implementation for testing
|
|
748
|
+
global.expect = (actual) => ({
|
|
749
|
+
toBe: (expected) => {
|
|
750
|
+
if (actual !== expected) {
|
|
751
|
+
throw new Error(`Expected ${expected}, got ${actual}`);
|
|
752
|
+
}
|
|
753
|
+
},
|
|
754
|
+
toEqual: (expected) => {
|
|
755
|
+
if (JSON.stringify(actual) !== JSON.stringify(expected)) {
|
|
756
|
+
throw new Error(`Expected ${JSON.stringify(expected)}, got ${JSON.stringify(actual)}`);
|
|
757
|
+
}
|
|
758
|
+
},
|
|
759
|
+
toBeDefined: () => {
|
|
760
|
+
if (actual === undefined) {
|
|
761
|
+
throw new Error('Expected value to be defined');
|
|
762
|
+
}
|
|
763
|
+
},
|
|
764
|
+
toBeGreaterThan: (expected) => {
|
|
765
|
+
if (actual <= expected) {
|
|
766
|
+
throw new Error(`Expected ${actual} to be greater than ${expected}`);
|
|
767
|
+
}
|
|
768
|
+
},
|
|
769
|
+
toBeLessThan: (expected) => {
|
|
770
|
+
if (actual >= expected) {
|
|
771
|
+
throw new Error(`Expected ${actual} to be less than ${expected}`);
|
|
772
|
+
}
|
|
773
|
+
},
|
|
774
|
+
toContain: (expected) => {
|
|
775
|
+
if (!actual.includes(expected)) {
|
|
776
|
+
throw new Error(`Expected ${JSON.stringify(actual)} to contain ${expected}`);
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
});
|
|
780
|
+
|
|
781
|
+
// Run validation if this script is executed directly
|
|
782
|
+
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
|
783
|
+
const validator = new Phase2Validator();
|
|
784
|
+
validator.runValidation().catch(console.error);
|
|
785
|
+
}
|