faf-cli 4.3.0 → 4.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.
Files changed (53) hide show
  1. package/dist/cli.d.ts.map +1 -1
  2. package/dist/cli.js +40 -22
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/readme.d.ts +11 -6
  5. package/dist/commands/readme.d.ts.map +1 -1
  6. package/dist/commands/readme.js +167 -120
  7. package/dist/commands/readme.js.map +1 -1
  8. package/dist/commands/show.d.ts.map +1 -1
  9. package/dist/commands/show.js +22 -7
  10. package/dist/commands/show.js.map +1 -1
  11. package/dist/commands/sixws.d.ts +6 -0
  12. package/dist/commands/sixws.d.ts.map +1 -0
  13. package/dist/commands/sixws.js +154 -0
  14. package/dist/commands/sixws.js.map +1 -0
  15. package/dist/utils/file-utils.d.ts.map +1 -1
  16. package/dist/utils/file-utils.js +1 -4
  17. package/dist/utils/file-utils.js.map +1 -1
  18. package/package.json +6 -2
  19. package/project.faf +4 -4
  20. package/scripts/ANTHROPIC-DEMO.sh +203 -0
  21. package/scripts/boris-ready.sh +169 -0
  22. package/scripts/bundle-yaml.js +87 -0
  23. package/scripts/check-version.js +88 -0
  24. package/scripts/clean-build.js +34 -0
  25. package/scripts/cleanup-unused.sh +54 -0
  26. package/scripts/debug-django.txt +9 -0
  27. package/scripts/debug-mongo.txt +9 -0
  28. package/scripts/debug-react.txt +9 -0
  29. package/scripts/debug-rust.txt +9 -0
  30. package/scripts/debug-whisper.cpp.txt +9 -0
  31. package/scripts/evaluate-family-member.ts +300 -0
  32. package/scripts/generate-docs.ts +358 -0
  33. package/scripts/generate-drift-reports.sh +111 -0
  34. package/scripts/industry-showcase.json +122 -0
  35. package/scripts/mcp-ecosystem-research.sh +58 -0
  36. package/scripts/migrate-yaml-imports.sh +55 -0
  37. package/scripts/migrate-yaml.ts +132 -0
  38. package/scripts/performance-validation.ts +460 -0
  39. package/scripts/postinstall.js +30 -0
  40. package/scripts/prepare-release.ts +421 -0
  41. package/scripts/run-industry-showcase.ts +237 -0
  42. package/scripts/run-test-showcase.ts +244 -0
  43. package/scripts/setup-github-watch.sh +43 -0
  44. package/scripts/sync-version.js +35 -0
  45. package/scripts/test-integration-detection.ts +93 -0
  46. package/scripts/test-integration-simple.js +93 -0
  47. package/scripts/test-medal-progression.sh +143 -0
  48. package/scripts/test-showcase-results.json +109 -0
  49. package/scripts/test-showcase.json +32 -0
  50. package/scripts/update-version.js +148 -0
  51. package/scripts/verify-build.js +343 -0
  52. package/scripts/version-check.js +78 -0
  53. package/scripts/watch-discussions.sh +86 -0
@@ -0,0 +1,460 @@
1
+ #!/usr/bin/env ts-node
2
+
3
+ /**
4
+ * ⚡ F1-Inspired Performance Validation Suite
5
+ * Validates championship performance claims in real-world environments
6
+ */
7
+
8
+ import * as fs from 'fs/promises';
9
+ import * as path from 'path';
10
+ import * as os from 'os';
11
+ import { execSync } from 'child_process';
12
+ import { performance } from 'perf_hooks';
13
+ import { FAF_COLORS, FAF_ICONS, PERFORMANCE_STANDARDS } from '../src/utils/championship-style';
14
+
15
+ interface PerformanceTest {
16
+ name: string;
17
+ description: string;
18
+ target: number; // ms
19
+ command: string;
20
+ args: string[];
21
+ iterations: number;
22
+ warmup?: boolean;
23
+ }
24
+
25
+ interface PerformanceResult {
26
+ test: string;
27
+ results: number[]; // Array of execution times in ms
28
+ average: number;
29
+ median: number;
30
+ min: number;
31
+ max: number;
32
+ standardDeviation: number;
33
+ target: number;
34
+ passed: boolean;
35
+ percentile95: number;
36
+ }
37
+
38
+ interface SystemInfo {
39
+ platform: string;
40
+ arch: string;
41
+ nodeVersion: string;
42
+ cpuModel: string;
43
+ cpuCores: number;
44
+ totalMemory: number;
45
+ freeMemory: number;
46
+ loadAverage: number[];
47
+ }
48
+
49
+ /**
50
+ * F1-Inspired Performance Test Suite
51
+ */
52
+ const PERFORMANCE_TESTS: PerformanceTest[] = [
53
+ {
54
+ name: 'status_command',
55
+ description: 'faf status - Git status equivalent speed',
56
+ target: PERFORMANCE_STANDARDS.status_command, // 38ms
57
+ command: 'faf',
58
+ args: ['status'],
59
+ iterations: 50,
60
+ warmup: true
61
+ },
62
+ {
63
+ name: 'trust_dashboard',
64
+ description: 'faf trust - Real-time trust calculation',
65
+ target: PERFORMANCE_STANDARDS.trust_dashboard, // 40ms
66
+ command: 'faf',
67
+ args: ['trust'],
68
+ iterations: 30,
69
+ warmup: true
70
+ },
71
+ {
72
+ name: 'help_command',
73
+ description: 'faf --help - Instant help display',
74
+ target: 50, // ms
75
+ command: 'faf',
76
+ args: ['--help'],
77
+ iterations: 20
78
+ },
79
+ {
80
+ name: 'index_command',
81
+ description: 'faf index - Universal A-Z reference',
82
+ target: 100, // ms
83
+ command: 'faf',
84
+ args: ['index'],
85
+ iterations: 20
86
+ },
87
+ {
88
+ name: 'score_basic',
89
+ description: 'faf score - Quick score check',
90
+ target: 150, // ms
91
+ command: 'faf',
92
+ args: ['score'],
93
+ iterations: 20,
94
+ warmup: true
95
+ },
96
+ {
97
+ name: 'analytics_summary',
98
+ description: 'faf analytics --summary - Performance metrics',
99
+ target: 100, // ms
100
+ command: 'faf',
101
+ args: ['analytics', '--summary'],
102
+ iterations: 15
103
+ }
104
+ ];
105
+
106
+ /**
107
+ * Main performance validation function
108
+ */
109
+ async function runPerformanceValidation(): Promise<void> {
110
+ console.log(`${FAF_COLORS.fafCyan('⚡ F1-Inspired Performance Validation')}`);
111
+ console.log(`${FAF_COLORS.fafCyan('├─')} Championship engineering demands measurable speed`);
112
+ console.log(`${FAF_COLORS.fafCyan('└─')} Validating real-world performance claims`);
113
+ console.log();
114
+
115
+ // Gather system information
116
+ const systemInfo = await getSystemInfo();
117
+ displaySystemInfo(systemInfo);
118
+
119
+ // Setup test environment
120
+ await setupTestEnvironment();
121
+
122
+ // Run performance tests
123
+ const results: PerformanceResult[] = [];
124
+
125
+ for (const test of PERFORMANCE_TESTS) {
126
+ console.log(`${FAF_COLORS.fafCyan('🏎️')} Running: ${test.description}`);
127
+
128
+ try {
129
+ const result = await runPerformanceTest(test);
130
+ results.push(result);
131
+
132
+ const status = result.passed ?
133
+ `${FAF_COLORS.fafGreen('✅ PASS')} (${result.average.toFixed(1)}ms)` :
134
+ `${FAF_COLORS.fafOrange('⚠️ SLOW')} (${result.average.toFixed(1)}ms vs ${result.target}ms target)`;
135
+
136
+ console.log(`${FAF_COLORS.fafCyan(' ')}${status}`);
137
+
138
+ } catch (error) {
139
+ console.log(`${FAF_COLORS.fafOrange(' ❌ ERROR:')} ${error}`);
140
+
141
+ // Create failed result
142
+ results.push({
143
+ test: test.name,
144
+ results: [],
145
+ average: 0,
146
+ median: 0,
147
+ min: 0,
148
+ max: 0,
149
+ standardDeviation: 0,
150
+ target: test.target,
151
+ passed: false,
152
+ percentile95: 0
153
+ });
154
+ }
155
+
156
+ console.log();
157
+ }
158
+
159
+ // Generate comprehensive report
160
+ await generatePerformanceReport(results, systemInfo);
161
+
162
+ // Show championship summary
163
+ showChampionshipSummary(results);
164
+ }
165
+
166
+ /**
167
+ * Get detailed system information
168
+ */
169
+ async function getSystemInfo(): Promise<SystemInfo> {
170
+ const cpus = os.cpus();
171
+
172
+ return {
173
+ platform: `${os.platform()}-${os.arch()}`,
174
+ arch: os.arch(),
175
+ nodeVersion: process.version,
176
+ cpuModel: cpus[0]?.model || 'Unknown',
177
+ cpuCores: cpus.length,
178
+ totalMemory: Math.round(os.totalmem() / 1024 / 1024), // MB
179
+ freeMemory: Math.round(os.freemem() / 1024 / 1024), // MB
180
+ loadAverage: os.loadavg()
181
+ };
182
+ }
183
+
184
+ /**
185
+ * Display system information
186
+ */
187
+ function displaySystemInfo(info: SystemInfo): void {
188
+ console.log(`${FAF_COLORS.fafCyan('🖥️ System Information:')}`);
189
+ console.log(`${FAF_COLORS.fafCyan('├─')} Platform: ${info.platform}`);
190
+ console.log(`${FAF_COLORS.fafCyan('├─')} Node.js: ${info.nodeVersion}`);
191
+ console.log(`${FAF_COLORS.fafCyan('├─')} CPU: ${info.cpuModel} (${info.cpuCores} cores)`);
192
+ console.log(`${FAF_COLORS.fafCyan('├─')} Memory: ${info.freeMemory}MB / ${info.totalMemory}MB available`);
193
+ console.log(`${FAF_COLORS.fafCyan('└─')} Load: ${info.loadAverage.map(l => l.toFixed(2)).join(', ')}`);
194
+ console.log();
195
+ }
196
+
197
+ /**
198
+ * Setup test environment
199
+ */
200
+ async function setupTestEnvironment(): Promise<void> {
201
+ console.log(`${FAF_COLORS.fafCyan('🔧 Setting up test environment...')}`);
202
+
203
+ // Create temporary test directory
204
+ const testDir = path.join(os.tmpdir(), 'faf-performance-test');
205
+ await fs.mkdir(testDir, { recursive: true });
206
+
207
+ // Create minimal .faf file for tests
208
+ const testFafContent = `
209
+ project:
210
+ name: "Performance Test Project"
211
+ description: "Minimal project for performance testing"
212
+
213
+ stack:
214
+ primary_language: "typescript"
215
+ framework: "node"
216
+
217
+ context_quality:
218
+ slots_filled: 5
219
+
220
+ ai_score: 75
221
+ `.trim();
222
+
223
+ await fs.writeFile(path.join(testDir, '.faf'), testFafContent);
224
+
225
+ // Change to test directory
226
+ process.chdir(testDir);
227
+
228
+ console.log(`${FAF_COLORS.fafGreen('✅')} Test environment ready: ${testDir}`);
229
+ console.log();
230
+ }
231
+
232
+ /**
233
+ * Run a single performance test
234
+ */
235
+ async function runPerformanceTest(test: PerformanceTest): Promise<PerformanceResult> {
236
+ const results: number[] = [];
237
+
238
+ // Warmup iterations
239
+ if (test.warmup) {
240
+ for (let i = 0; i < 3; i++) {
241
+ try {
242
+ await executeCommand(test.command, test.args, 5000); // 5s timeout for warmup
243
+ } catch {
244
+ // Ignore warmup failures
245
+ }
246
+ }
247
+ }
248
+
249
+ // Main test iterations
250
+ for (let i = 0; i < test.iterations; i++) {
251
+ try {
252
+ const startTime = performance.now();
253
+ await executeCommand(test.command, test.args, 10000); // 10s timeout
254
+ const endTime = performance.now();
255
+
256
+ const duration = endTime - startTime;
257
+ results.push(duration);
258
+
259
+ } catch (error) {
260
+ // For failed executions, record a very high time
261
+ results.push(10000); // 10 seconds = failure
262
+ }
263
+ }
264
+
265
+ if (results.length === 0) {
266
+ throw new Error('No successful test iterations');
267
+ }
268
+
269
+ // Calculate statistics
270
+ const sorted = results.sort((a, b) => a - b);
271
+ const average = results.reduce((sum, val) => sum + val, 0) / results.length;
272
+ const median = sorted[Math.floor(sorted.length / 2)];
273
+ const min = sorted[0];
274
+ const max = sorted[sorted.length - 1];
275
+ const percentile95 = sorted[Math.floor(sorted.length * 0.95)];
276
+
277
+ // Calculate standard deviation
278
+ const variance = results.reduce((sum, val) => sum + Math.pow(val - average, 2), 0) / results.length;
279
+ const standardDeviation = Math.sqrt(variance);
280
+
281
+ return {
282
+ test: test.name,
283
+ results,
284
+ average,
285
+ median,
286
+ min,
287
+ max,
288
+ standardDeviation,
289
+ target: test.target,
290
+ passed: average <= test.target,
291
+ percentile95
292
+ };
293
+ }
294
+
295
+ /**
296
+ * Execute a command with timeout
297
+ */
298
+ async function executeCommand(command: string, args: string[], timeoutMs: number): Promise<void> {
299
+ return new Promise((resolve, reject) => {
300
+ const child = execSync(`${command} ${args.join(' ')}`, {
301
+ stdio: 'pipe',
302
+ timeout: timeoutMs
303
+ });
304
+ resolve();
305
+ });
306
+ }
307
+
308
+ /**
309
+ * Generate comprehensive performance report
310
+ */
311
+ async function generatePerformanceReport(results: PerformanceResult[], systemInfo: SystemInfo): Promise<void> {
312
+ const reportPath = path.join(process.cwd(), 'performance-report.json');
313
+
314
+ const report = {
315
+ timestamp: new Date().toISOString(),
316
+ systemInfo,
317
+ summary: {
318
+ totalTests: results.length,
319
+ passed: results.filter(r => r.passed).length,
320
+ failed: results.filter(r => !r.passed).length,
321
+ overallScore: (results.filter(r => r.passed).length / results.length) * 100
322
+ },
323
+ results: results.map(result => ({
324
+ ...result,
325
+ results: undefined // Remove raw data from summary
326
+ })),
327
+ rawData: results // Keep detailed data
328
+ };
329
+
330
+ await fs.writeFile(reportPath, JSON.stringify(report, null, 2));
331
+ console.log(`${FAF_COLORS.fafGreen('📊')} Performance report saved: ${reportPath}`);
332
+ }
333
+
334
+ /**
335
+ * Show championship summary
336
+ */
337
+ function showChampionshipSummary(results: PerformanceResult[]): void {
338
+ const passed = results.filter(r => r.passed).length;
339
+ const total = results.length;
340
+ const score = (passed / total) * 100;
341
+
342
+ console.log(`${FAF_COLORS.fafCyan('🏁 Championship Performance Summary:')}`);
343
+ console.log();
344
+
345
+ // Overall score
346
+ const scoreColor = score >= 90 ? FAF_COLORS.fafGreen :
347
+ score >= 70 ? FAF_COLORS.fafOrange : FAF_COLORS.fafOrange;
348
+
349
+ console.log(`${FAF_COLORS.fafCyan('├─')} Overall Score: ${scoreColor(score.toFixed(1))}% (${passed}/${total} tests passed)`);
350
+
351
+ // Individual test summary
352
+ console.log(`${FAF_COLORS.fafCyan('├─')} Test Results:`);
353
+ results.forEach((result, index) => {
354
+ const connector = index === results.length - 1 ? '└─' : '├─';
355
+ const status = result.passed ?
356
+ `${FAF_ICONS.trophy} ${result.average.toFixed(1)}ms` :
357
+ `${FAF_ICONS.shield} ${result.average.toFixed(1)}ms (target: ${result.target}ms)`;
358
+
359
+ console.log(`${FAF_COLORS.fafCyan(`│ ${connector}`)} ${result.test}: ${status}`);
360
+ });
361
+
362
+ console.log();
363
+
364
+ // Championship verdict
365
+ if (score >= 90) {
366
+ console.log(`${FAF_COLORS.fafGreen('🏆 CHAMPIONSHIP PERFORMANCE ACHIEVED!')}`);
367
+ console.log(`${FAF_COLORS.fafGreen('⚡ F1-inspired engineering delivers on promises!')}`);
368
+ } else if (score >= 70) {
369
+ console.log(`${FAF_COLORS.fafOrange('🥈 SOLID PERFORMANCE - Minor optimizations needed')}`);
370
+ console.log(`${FAF_COLORS.fafOrange('🔧 Some commands could use championship tuning')}`);
371
+ } else {
372
+ console.log(`${FAF_COLORS.fafOrange('🔧 PERFORMANCE TUNING REQUIRED')}`);
373
+ console.log(`${FAF_COLORS.fafOrange('⚡ Time to unleash the F1 engineering spirit!')}`);
374
+ }
375
+
376
+ console.log();
377
+ console.log(`${FAF_COLORS.fafCyan('📈 Performance Standards:')}`);
378
+ console.log(`${FAF_COLORS.fafCyan('├─')} Status command: <38ms (faster than git status)`);
379
+ console.log(`${FAF_COLORS.fafCyan('├─')} Trust dashboard: <40ms (real-time calculation)`);
380
+ console.log(`${FAF_COLORS.fafCyan('├─')} Help/Index: <100ms (instant reference)`);
381
+ console.log(`${FAF_COLORS.fafCyan('└─')} Score calculation: <150ms (comprehensive analysis)`);
382
+ }
383
+
384
+ /**
385
+ * CLI for running specific tests
386
+ */
387
+ function parseArgs(): { testNames?: string[], verbose?: boolean } {
388
+ const args = process.argv.slice(2);
389
+ const options: { testNames?: string[], verbose?: boolean } = {};
390
+
391
+ for (let i = 0; i < args.length; i++) {
392
+ const arg = args[i];
393
+
394
+ switch (arg) {
395
+ case '--tests':
396
+ options.testNames = args[++i].split(',');
397
+ break;
398
+ case '--verbose':
399
+ options.verbose = true;
400
+ break;
401
+ case '--help':
402
+ showHelp();
403
+ process.exit(0);
404
+ break;
405
+ }
406
+ }
407
+
408
+ return options;
409
+ }
410
+
411
+ /**
412
+ * Show help
413
+ */
414
+ function showHelp(): void {
415
+ console.log(`
416
+ ⚡ FAF CLI Performance Validation Suite
417
+
418
+ Usage: npm run performance [options]
419
+
420
+ Options:
421
+ --tests <names> Run specific tests (comma-separated)
422
+ --verbose Show detailed execution logs
423
+ --help Show this help
424
+
425
+ Examples:
426
+ npm run performance # Run all tests
427
+ npm run performance -- --tests status,trust # Run specific tests
428
+ npm run performance -- --verbose # Detailed output
429
+
430
+ Available Tests:
431
+ ${PERFORMANCE_TESTS.map(t => ` - ${t.name}: ${t.description} (target: ${t.target}ms)`).join('\n')}
432
+
433
+ 🏎️ F1-inspired engineering - Every millisecond matters!
434
+ `);
435
+ }
436
+
437
+ // Run if called directly
438
+ if (require.main === module) {
439
+ const options = parseArgs();
440
+
441
+ // Filter tests if specific ones requested
442
+ if (options.testNames) {
443
+ const filteredTests = PERFORMANCE_TESTS.filter(t =>
444
+ options.testNames!.includes(t.name)
445
+ );
446
+
447
+ if (filteredTests.length === 0) {
448
+ console.error('No matching tests found');
449
+ process.exit(1);
450
+ }
451
+
452
+ // Replace global test array
453
+ PERFORMANCE_TESTS.length = 0;
454
+ PERFORMANCE_TESTS.push(...filteredTests);
455
+ }
456
+
457
+ runPerformanceValidation().catch(console.error);
458
+ }
459
+
460
+ export { runPerformanceValidation, PERFORMANCE_TESTS };
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Post-install message: Confirm successful installation
5
+ *
6
+ * Shows clear success message with version and getting started commands.
7
+ *
8
+ * Writes directly to /dev/tty to bypass npm output suppression.
9
+ */
10
+
11
+ const packageJson = require('../package.json');
12
+ const fs = require('fs');
13
+
14
+ const message = `
15
+ \x1b[32m✓\x1b[0m faf-cli@${packageJson.version} installed successfully
16
+
17
+ Getting started:
18
+ faf init # Initialize .faf in your project
19
+ faf score # Check AI-readiness (0-100%)
20
+
21
+ Docs: https://faf.one
22
+ `;
23
+
24
+ try {
25
+ // Write directly to terminal, bypassing npm's output suppression
26
+ fs.writeSync(fs.openSync('/dev/tty', 'w'), message);
27
+ } catch (e) {
28
+ // Fallback to stderr if /dev/tty not available (Windows, etc.)
29
+ console.error(message);
30
+ }