@ryuenn3123/agentic-senior-core 1.9.0 → 1.9.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 (86) hide show
  1. package/.agent-context/blueprints/mobile-app.md +21 -21
  2. package/.agent-context/policies/llm-judge-threshold.json +29 -20
  3. package/.agent-context/profiles/platform.md +13 -13
  4. package/.agent-context/profiles/regulated.md +13 -13
  5. package/.agent-context/profiles/startup.md +13 -13
  6. package/.agent-context/review-checklists/frontend-skill-parity.md +28 -28
  7. package/.agent-context/review-checklists/frontend-usability.md +33 -33
  8. package/.agent-context/review-checklists/release-operations.md +29 -29
  9. package/.agent-context/rules/security.md +92 -0
  10. package/.agent-context/skills/README.md +62 -62
  11. package/.agent-context/skills/backend/README.md +67 -67
  12. package/.agent-context/skills/backend/architecture.md +360 -360
  13. package/.agent-context/skills/backend/data-access.md +230 -230
  14. package/.agent-context/skills/backend/errors.md +137 -137
  15. package/.agent-context/skills/backend/validation.md +116 -116
  16. package/.agent-context/skills/backend.md +28 -28
  17. package/.agent-context/skills/cli/README.md +49 -49
  18. package/.agent-context/skills/cli/init.md +37 -37
  19. package/.agent-context/skills/cli/output.md +35 -35
  20. package/.agent-context/skills/cli/upgrade.md +37 -37
  21. package/.agent-context/skills/cli.md +28 -28
  22. package/.agent-context/skills/distribution/README.md +18 -18
  23. package/.agent-context/skills/distribution/compatibility.md +31 -31
  24. package/.agent-context/skills/distribution/publish.md +36 -36
  25. package/.agent-context/skills/distribution/rollback.md +31 -31
  26. package/.agent-context/skills/distribution.md +28 -28
  27. package/.agent-context/skills/frontend/README.md +35 -35
  28. package/.agent-context/skills/frontend/accessibility.md +107 -107
  29. package/.agent-context/skills/frontend/motion.md +66 -66
  30. package/.agent-context/skills/frontend/performance.md +62 -62
  31. package/.agent-context/skills/frontend/ui-architecture.md +128 -128
  32. package/.agent-context/skills/frontend.md +29 -29
  33. package/.agent-context/skills/fullstack/README.md +18 -18
  34. package/.agent-context/skills/fullstack/contracts.md +52 -52
  35. package/.agent-context/skills/fullstack/end-to-end.md +41 -41
  36. package/.agent-context/skills/fullstack/feature-slicing.md +64 -64
  37. package/.agent-context/skills/fullstack.md +26 -26
  38. package/.agent-context/skills/index.json +107 -107
  39. package/.agent-context/skills/review-quality/README.md +18 -18
  40. package/.agent-context/skills/review-quality/benchmark.md +29 -29
  41. package/.agent-context/skills/review-quality/planning.md +37 -37
  42. package/.agent-context/skills/review-quality/security.md +33 -33
  43. package/.agent-context/skills/review-quality.md +27 -27
  44. package/.agent-context/stacks/flutter.md +16 -16
  45. package/.agent-context/stacks/react-native.md +16 -16
  46. package/.agent-context/state/architecture-map.md +25 -25
  47. package/.agent-context/state/benchmark-analysis.json +431 -431
  48. package/.agent-context/state/benchmark-thresholds.json +10 -10
  49. package/.agent-context/state/benchmark-watchlist.json +19 -19
  50. package/.agent-context/state/dependency-map.md +32 -32
  51. package/.agent-context/state/onboarding-report.json +39 -0
  52. package/.agent-context/state/skill-platform.json +38 -38
  53. package/.agent-override.md +36 -36
  54. package/.cursorrules +3718 -140
  55. package/.github/ISSUE_TEMPLATE/v1.7-frontend-work-item.yml +54 -54
  56. package/.github/workflows/benchmark-detection.yml +38 -38
  57. package/.github/workflows/benchmark-intelligence.yml +50 -50
  58. package/.github/workflows/frontend-usability-gate.yml +36 -36
  59. package/.github/workflows/publish.yml +32 -0
  60. package/.github/workflows/release-gate.yml +32 -32
  61. package/.github/workflows/sbom-compliance.yml +32 -32
  62. package/.windsurfrules +3718 -106
  63. package/AGENTS.md +181 -181
  64. package/README.md +318 -318
  65. package/bin/agentic-senior-core.js +61 -1556
  66. package/lib/cli/commands/init.mjs +339 -0
  67. package/lib/cli/commands/launch.mjs +81 -0
  68. package/lib/cli/commands/upgrade.mjs +165 -0
  69. package/lib/cli/compiler.mjs +204 -0
  70. package/lib/cli/constants.mjs +136 -0
  71. package/lib/cli/detector.mjs +211 -0
  72. package/lib/cli/profile-packs.mjs +94 -0
  73. package/lib/cli/skill-selector.mjs +210 -0
  74. package/lib/cli/utils.mjs +227 -0
  75. package/mcp.json +92 -92
  76. package/package.json +3 -1
  77. package/scripts/benchmark-gate.mjs +121 -121
  78. package/scripts/benchmark-intelligence.mjs +140 -140
  79. package/scripts/detection-benchmark.mjs +138 -138
  80. package/scripts/frontend-usability-audit.mjs +87 -87
  81. package/scripts/generate-sbom.mjs +61 -61
  82. package/scripts/init-project.ps1 +104 -104
  83. package/scripts/llm-judge.mjs +664 -664
  84. package/scripts/release-gate.mjs +116 -116
  85. package/scripts/skill-tier-policy.mjs +75 -75
  86. package/scripts/validate.mjs +636 -636
@@ -1,121 +1,121 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * benchmark-gate.mjs
5
- *
6
- * Anti-regression gate for benchmark quality signals.
7
- * Fails when benchmark metrics drop below configured thresholds.
8
- */
9
-
10
- import { existsSync, readFileSync } from 'node:fs';
11
- import { dirname, join, resolve } from 'node:path';
12
- import { fileURLToPath } from 'node:url';
13
- import { execFileSync } from 'node:child_process';
14
-
15
- const SCRIPT_FILE_PATH = fileURLToPath(import.meta.url);
16
- const SCRIPT_DIR = dirname(SCRIPT_FILE_PATH);
17
- const REPOSITORY_ROOT = resolve(SCRIPT_DIR, '..');
18
- const BENCHMARK_THRESHOLD_PATH = join(REPOSITORY_ROOT, '.agent-context', 'state', 'benchmark-thresholds.json');
19
- const DETECTION_BENCHMARK_PATH = join(REPOSITORY_ROOT, 'scripts', 'detection-benchmark.mjs');
20
-
21
- function readThresholdConfiguration() {
22
- if (!existsSync(BENCHMARK_THRESHOLD_PATH)) {
23
- return {
24
- minimumTop1Accuracy: 0.9,
25
- maximumManualCorrectionRate: 0.12,
26
- maximumTop1AccuracyDrop: 0.02,
27
- maximumManualCorrectionIncrease: 0.03,
28
- previousReleaseBaseline: {
29
- top1Accuracy: 0.9167,
30
- manualCorrectionRate: 0.0833,
31
- },
32
- };
33
- }
34
-
35
- return JSON.parse(readFileSync(BENCHMARK_THRESHOLD_PATH, 'utf8'));
36
- }
37
-
38
- function runDetectionBenchmark() {
39
- const benchmarkRawOutput = execFileSync('node', [DETECTION_BENCHMARK_PATH], {
40
- cwd: REPOSITORY_ROOT,
41
- encoding: 'utf8',
42
- });
43
-
44
- return JSON.parse(benchmarkRawOutput);
45
- }
46
-
47
- function buildCheckResult(checkName, passed, details) {
48
- return {
49
- checkName,
50
- passed,
51
- details,
52
- };
53
- }
54
-
55
- function runBenchmarkGate() {
56
- const thresholdConfiguration = readThresholdConfiguration();
57
- const benchmarkResult = runDetectionBenchmark();
58
- const benchmarkChecks = [];
59
-
60
- const top1AccuracyPassed = benchmarkResult.top1Accuracy >= thresholdConfiguration.minimumTop1Accuracy;
61
- benchmarkChecks.push(
62
- buildCheckResult(
63
- 'minimum-top1-accuracy',
64
- top1AccuracyPassed,
65
- `top1Accuracy=${benchmarkResult.top1Accuracy} minimum=${thresholdConfiguration.minimumTop1Accuracy}`,
66
- ),
67
- );
68
-
69
- const manualCorrectionPassed = benchmarkResult.manualCorrectionRate <= thresholdConfiguration.maximumManualCorrectionRate;
70
- benchmarkChecks.push(
71
- buildCheckResult(
72
- 'maximum-manual-correction-rate',
73
- manualCorrectionPassed,
74
- `manualCorrectionRate=${benchmarkResult.manualCorrectionRate} maximum=${thresholdConfiguration.maximumManualCorrectionRate}`,
75
- ),
76
- );
77
-
78
- const previousReleaseBaseline = thresholdConfiguration.previousReleaseBaseline;
79
- if (previousReleaseBaseline && typeof previousReleaseBaseline === 'object') {
80
- const top1AccuracyDrop = Number((previousReleaseBaseline.top1Accuracy - benchmarkResult.top1Accuracy).toFixed(4));
81
- const manualCorrectionIncrease = Number((benchmarkResult.manualCorrectionRate - previousReleaseBaseline.manualCorrectionRate).toFixed(4));
82
-
83
- const top1AccuracyDropPassed = top1AccuracyDrop <= thresholdConfiguration.maximumTop1AccuracyDrop;
84
- benchmarkChecks.push(
85
- buildCheckResult(
86
- 'maximum-top1-accuracy-drop',
87
- top1AccuracyDropPassed,
88
- `drop=${top1AccuracyDrop} maximum=${thresholdConfiguration.maximumTop1AccuracyDrop}`,
89
- ),
90
- );
91
-
92
- const manualCorrectionIncreasePassed = manualCorrectionIncrease <= thresholdConfiguration.maximumManualCorrectionIncrease;
93
- benchmarkChecks.push(
94
- buildCheckResult(
95
- 'maximum-manual-correction-increase',
96
- manualCorrectionIncreasePassed,
97
- `increase=${manualCorrectionIncrease} maximum=${thresholdConfiguration.maximumManualCorrectionIncrease}`,
98
- ),
99
- );
100
- }
101
-
102
- const failedCheckCount = benchmarkChecks.filter((benchmarkCheck) => !benchmarkCheck.passed).length;
103
- const benchmarkGateReport = {
104
- generatedAt: new Date().toISOString(),
105
- gateName: 'benchmark-gate',
106
- passed: failedCheckCount === 0,
107
- failureCount: failedCheckCount,
108
- benchmarkResult: {
109
- fixtureCount: benchmarkResult.fixtureCount,
110
- top1Accuracy: benchmarkResult.top1Accuracy,
111
- manualCorrectionRate: benchmarkResult.manualCorrectionRate,
112
- },
113
- thresholds: thresholdConfiguration,
114
- results: benchmarkChecks,
115
- };
116
-
117
- console.log(JSON.stringify(benchmarkGateReport, null, 2));
118
- process.exit(benchmarkGateReport.passed ? 0 : 1);
119
- }
120
-
121
- runBenchmarkGate();
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * benchmark-gate.mjs
5
+ *
6
+ * Anti-regression gate for benchmark quality signals.
7
+ * Fails when benchmark metrics drop below configured thresholds.
8
+ */
9
+
10
+ import { existsSync, readFileSync } from 'node:fs';
11
+ import { dirname, join, resolve } from 'node:path';
12
+ import { fileURLToPath } from 'node:url';
13
+ import { execFileSync } from 'node:child_process';
14
+
15
+ const SCRIPT_FILE_PATH = fileURLToPath(import.meta.url);
16
+ const SCRIPT_DIR = dirname(SCRIPT_FILE_PATH);
17
+ const REPOSITORY_ROOT = resolve(SCRIPT_DIR, '..');
18
+ const BENCHMARK_THRESHOLD_PATH = join(REPOSITORY_ROOT, '.agent-context', 'state', 'benchmark-thresholds.json');
19
+ const DETECTION_BENCHMARK_PATH = join(REPOSITORY_ROOT, 'scripts', 'detection-benchmark.mjs');
20
+
21
+ function readThresholdConfiguration() {
22
+ if (!existsSync(BENCHMARK_THRESHOLD_PATH)) {
23
+ return {
24
+ minimumTop1Accuracy: 0.9,
25
+ maximumManualCorrectionRate: 0.12,
26
+ maximumTop1AccuracyDrop: 0.02,
27
+ maximumManualCorrectionIncrease: 0.03,
28
+ previousReleaseBaseline: {
29
+ top1Accuracy: 0.9167,
30
+ manualCorrectionRate: 0.0833,
31
+ },
32
+ };
33
+ }
34
+
35
+ return JSON.parse(readFileSync(BENCHMARK_THRESHOLD_PATH, 'utf8'));
36
+ }
37
+
38
+ function runDetectionBenchmark() {
39
+ const benchmarkRawOutput = execFileSync('node', [DETECTION_BENCHMARK_PATH], {
40
+ cwd: REPOSITORY_ROOT,
41
+ encoding: 'utf8',
42
+ });
43
+
44
+ return JSON.parse(benchmarkRawOutput);
45
+ }
46
+
47
+ function buildCheckResult(checkName, passed, details) {
48
+ return {
49
+ checkName,
50
+ passed,
51
+ details,
52
+ };
53
+ }
54
+
55
+ function runBenchmarkGate() {
56
+ const thresholdConfiguration = readThresholdConfiguration();
57
+ const benchmarkResult = runDetectionBenchmark();
58
+ const benchmarkChecks = [];
59
+
60
+ const top1AccuracyPassed = benchmarkResult.top1Accuracy >= thresholdConfiguration.minimumTop1Accuracy;
61
+ benchmarkChecks.push(
62
+ buildCheckResult(
63
+ 'minimum-top1-accuracy',
64
+ top1AccuracyPassed,
65
+ `top1Accuracy=${benchmarkResult.top1Accuracy} minimum=${thresholdConfiguration.minimumTop1Accuracy}`,
66
+ ),
67
+ );
68
+
69
+ const manualCorrectionPassed = benchmarkResult.manualCorrectionRate <= thresholdConfiguration.maximumManualCorrectionRate;
70
+ benchmarkChecks.push(
71
+ buildCheckResult(
72
+ 'maximum-manual-correction-rate',
73
+ manualCorrectionPassed,
74
+ `manualCorrectionRate=${benchmarkResult.manualCorrectionRate} maximum=${thresholdConfiguration.maximumManualCorrectionRate}`,
75
+ ),
76
+ );
77
+
78
+ const previousReleaseBaseline = thresholdConfiguration.previousReleaseBaseline;
79
+ if (previousReleaseBaseline && typeof previousReleaseBaseline === 'object') {
80
+ const top1AccuracyDrop = Number((previousReleaseBaseline.top1Accuracy - benchmarkResult.top1Accuracy).toFixed(4));
81
+ const manualCorrectionIncrease = Number((benchmarkResult.manualCorrectionRate - previousReleaseBaseline.manualCorrectionRate).toFixed(4));
82
+
83
+ const top1AccuracyDropPassed = top1AccuracyDrop <= thresholdConfiguration.maximumTop1AccuracyDrop;
84
+ benchmarkChecks.push(
85
+ buildCheckResult(
86
+ 'maximum-top1-accuracy-drop',
87
+ top1AccuracyDropPassed,
88
+ `drop=${top1AccuracyDrop} maximum=${thresholdConfiguration.maximumTop1AccuracyDrop}`,
89
+ ),
90
+ );
91
+
92
+ const manualCorrectionIncreasePassed = manualCorrectionIncrease <= thresholdConfiguration.maximumManualCorrectionIncrease;
93
+ benchmarkChecks.push(
94
+ buildCheckResult(
95
+ 'maximum-manual-correction-increase',
96
+ manualCorrectionIncreasePassed,
97
+ `increase=${manualCorrectionIncrease} maximum=${thresholdConfiguration.maximumManualCorrectionIncrease}`,
98
+ ),
99
+ );
100
+ }
101
+
102
+ const failedCheckCount = benchmarkChecks.filter((benchmarkCheck) => !benchmarkCheck.passed).length;
103
+ const benchmarkGateReport = {
104
+ generatedAt: new Date().toISOString(),
105
+ gateName: 'benchmark-gate',
106
+ passed: failedCheckCount === 0,
107
+ failureCount: failedCheckCount,
108
+ benchmarkResult: {
109
+ fixtureCount: benchmarkResult.fixtureCount,
110
+ top1Accuracy: benchmarkResult.top1Accuracy,
111
+ manualCorrectionRate: benchmarkResult.manualCorrectionRate,
112
+ },
113
+ thresholds: thresholdConfiguration,
114
+ results: benchmarkChecks,
115
+ };
116
+
117
+ console.log(JSON.stringify(benchmarkGateReport, null, 2));
118
+ process.exit(benchmarkGateReport.passed ? 0 : 1);
119
+ }
120
+
121
+ runBenchmarkGate();
@@ -1,140 +1,140 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * benchmark-intelligence.mjs
5
- *
6
- * Competitive intelligence cadence validator.
7
- * Ensures benchmark watchlist coverage and review freshness.
8
- */
9
-
10
- import { existsSync, readFileSync } from 'node:fs';
11
- import { dirname, join, resolve } from 'node:path';
12
- import { fileURLToPath } from 'node:url';
13
-
14
- const SCRIPT_FILE_PATH = fileURLToPath(import.meta.url);
15
- const SCRIPT_DIR = dirname(SCRIPT_FILE_PATH);
16
- const REPOSITORY_ROOT = resolve(SCRIPT_DIR, '..');
17
- const WATCHLIST_PATH = join(REPOSITORY_ROOT, '.agent-context', 'state', 'benchmark-watchlist.json');
18
- const REVIEW_SLA_DAYS = 14;
19
- const REQUIRED_BENCHMARK_REPOSITORIES = new Set([
20
- 'sickn33/antigravity-awesome-skills',
21
- 'github/awesome-copilot',
22
- 'MiniMax-AI/skills',
23
- ]);
24
-
25
- function parseDateOrNull(rawDateValue) {
26
- if (typeof rawDateValue !== 'string') {
27
- return null;
28
- }
29
-
30
- if (!/^\d{4}-\d{2}-\d{2}$/.test(rawDateValue)) {
31
- return null;
32
- }
33
-
34
- const parsedDate = new Date(`${rawDateValue}T00:00:00.000Z`);
35
- return Number.isNaN(parsedDate.getTime()) ? null : parsedDate;
36
- }
37
-
38
- function calculateAgeInDays(referenceDate, targetDate) {
39
- const ageInMilliseconds = referenceDate.getTime() - targetDate.getTime();
40
- return Math.floor(ageInMilliseconds / (1000 * 60 * 60 * 24));
41
- }
42
-
43
- function loadWatchlistConfiguration() {
44
- if (!existsSync(WATCHLIST_PATH)) {
45
- return { repositories: [] };
46
- }
47
-
48
- return JSON.parse(readFileSync(WATCHLIST_PATH, 'utf8'));
49
- }
50
-
51
- function runIntelligenceValidation() {
52
- const watchlistConfiguration = loadWatchlistConfiguration();
53
- const watchlistEntries = Array.isArray(watchlistConfiguration.repositories)
54
- ? watchlistConfiguration.repositories
55
- : [];
56
- const validationResults = [];
57
- const currentDate = new Date();
58
-
59
- const trackedRepositoryNames = new Set();
60
- for (const watchlistEntry of watchlistEntries) {
61
- trackedRepositoryNames.add(watchlistEntry.repository);
62
- }
63
-
64
- for (const requiredRepositoryName of REQUIRED_BENCHMARK_REPOSITORIES) {
65
- const hasRequiredRepository = trackedRepositoryNames.has(requiredRepositoryName);
66
- validationResults.push({
67
- checkName: 'required-benchmark-repository',
68
- repository: requiredRepositoryName,
69
- passed: hasRequiredRepository,
70
- details: hasRequiredRepository
71
- ? `${requiredRepositoryName} is present in watchlist`
72
- : `${requiredRepositoryName} is missing from watchlist`,
73
- });
74
- }
75
-
76
- const watchlistReport = watchlistEntries.map((watchlistEntry) => {
77
- const repositoryName = watchlistEntry.repository;
78
- const repositoryOwner = watchlistEntry.owner;
79
- const lastReviewedDate = parseDateOrNull(watchlistEntry.lastReviewedAt);
80
-
81
- const hasOwner = typeof repositoryOwner === 'string' && repositoryOwner.trim().length > 0;
82
- validationResults.push({
83
- checkName: 'watchlist-owner-defined',
84
- repository: repositoryName,
85
- passed: hasOwner,
86
- details: hasOwner ? `Owner ${repositoryOwner} is defined` : 'Owner is missing',
87
- });
88
-
89
- if (!lastReviewedDate) {
90
- validationResults.push({
91
- checkName: 'review-date-format',
92
- repository: repositoryName,
93
- passed: false,
94
- details: `Invalid or missing lastReviewedAt: ${String(watchlistEntry.lastReviewedAt)}`,
95
- });
96
-
97
- return {
98
- repository: repositoryName,
99
- owner: repositoryOwner,
100
- lastReviewedAt: watchlistEntry.lastReviewedAt,
101
- ageInDays: null,
102
- stale: true,
103
- };
104
- }
105
-
106
- const reviewAgeInDays = calculateAgeInDays(currentDate, lastReviewedDate);
107
- const reviewWithinSla = reviewAgeInDays <= REVIEW_SLA_DAYS;
108
-
109
- validationResults.push({
110
- checkName: 'review-sla-compliance',
111
- repository: repositoryName,
112
- passed: reviewWithinSla,
113
- details: `ageInDays=${reviewAgeInDays} slaDays=${REVIEW_SLA_DAYS}`,
114
- });
115
-
116
- return {
117
- repository: repositoryName,
118
- owner: repositoryOwner,
119
- lastReviewedAt: watchlistEntry.lastReviewedAt,
120
- ageInDays: reviewAgeInDays,
121
- stale: !reviewWithinSla,
122
- };
123
- });
124
-
125
- const failedCheckCount = validationResults.filter((validationResult) => !validationResult.passed).length;
126
- const intelligenceReport = {
127
- generatedAt: new Date().toISOString(),
128
- reportName: 'benchmark-intelligence',
129
- passed: failedCheckCount === 0,
130
- failureCount: failedCheckCount,
131
- reviewSlaDays: REVIEW_SLA_DAYS,
132
- watchlist: watchlistReport,
133
- results: validationResults,
134
- };
135
-
136
- console.log(JSON.stringify(intelligenceReport, null, 2));
137
- process.exit(intelligenceReport.passed ? 0 : 1);
138
- }
139
-
140
- runIntelligenceValidation();
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * benchmark-intelligence.mjs
5
+ *
6
+ * Competitive intelligence cadence validator.
7
+ * Ensures benchmark watchlist coverage and review freshness.
8
+ */
9
+
10
+ import { existsSync, readFileSync } from 'node:fs';
11
+ import { dirname, join, resolve } from 'node:path';
12
+ import { fileURLToPath } from 'node:url';
13
+
14
+ const SCRIPT_FILE_PATH = fileURLToPath(import.meta.url);
15
+ const SCRIPT_DIR = dirname(SCRIPT_FILE_PATH);
16
+ const REPOSITORY_ROOT = resolve(SCRIPT_DIR, '..');
17
+ const WATCHLIST_PATH = join(REPOSITORY_ROOT, '.agent-context', 'state', 'benchmark-watchlist.json');
18
+ const REVIEW_SLA_DAYS = 14;
19
+ const REQUIRED_BENCHMARK_REPOSITORIES = new Set([
20
+ 'sickn33/antigravity-awesome-skills',
21
+ 'github/awesome-copilot',
22
+ 'MiniMax-AI/skills',
23
+ ]);
24
+
25
+ function parseDateOrNull(rawDateValue) {
26
+ if (typeof rawDateValue !== 'string') {
27
+ return null;
28
+ }
29
+
30
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(rawDateValue)) {
31
+ return null;
32
+ }
33
+
34
+ const parsedDate = new Date(`${rawDateValue}T00:00:00.000Z`);
35
+ return Number.isNaN(parsedDate.getTime()) ? null : parsedDate;
36
+ }
37
+
38
+ function calculateAgeInDays(referenceDate, targetDate) {
39
+ const ageInMilliseconds = referenceDate.getTime() - targetDate.getTime();
40
+ return Math.floor(ageInMilliseconds / (1000 * 60 * 60 * 24));
41
+ }
42
+
43
+ function loadWatchlistConfiguration() {
44
+ if (!existsSync(WATCHLIST_PATH)) {
45
+ return { repositories: [] };
46
+ }
47
+
48
+ return JSON.parse(readFileSync(WATCHLIST_PATH, 'utf8'));
49
+ }
50
+
51
+ function runIntelligenceValidation() {
52
+ const watchlistConfiguration = loadWatchlistConfiguration();
53
+ const watchlistEntries = Array.isArray(watchlistConfiguration.repositories)
54
+ ? watchlistConfiguration.repositories
55
+ : [];
56
+ const validationResults = [];
57
+ const currentDate = new Date();
58
+
59
+ const trackedRepositoryNames = new Set();
60
+ for (const watchlistEntry of watchlistEntries) {
61
+ trackedRepositoryNames.add(watchlistEntry.repository);
62
+ }
63
+
64
+ for (const requiredRepositoryName of REQUIRED_BENCHMARK_REPOSITORIES) {
65
+ const hasRequiredRepository = trackedRepositoryNames.has(requiredRepositoryName);
66
+ validationResults.push({
67
+ checkName: 'required-benchmark-repository',
68
+ repository: requiredRepositoryName,
69
+ passed: hasRequiredRepository,
70
+ details: hasRequiredRepository
71
+ ? `${requiredRepositoryName} is present in watchlist`
72
+ : `${requiredRepositoryName} is missing from watchlist`,
73
+ });
74
+ }
75
+
76
+ const watchlistReport = watchlistEntries.map((watchlistEntry) => {
77
+ const repositoryName = watchlistEntry.repository;
78
+ const repositoryOwner = watchlistEntry.owner;
79
+ const lastReviewedDate = parseDateOrNull(watchlistEntry.lastReviewedAt);
80
+
81
+ const hasOwner = typeof repositoryOwner === 'string' && repositoryOwner.trim().length > 0;
82
+ validationResults.push({
83
+ checkName: 'watchlist-owner-defined',
84
+ repository: repositoryName,
85
+ passed: hasOwner,
86
+ details: hasOwner ? `Owner ${repositoryOwner} is defined` : 'Owner is missing',
87
+ });
88
+
89
+ if (!lastReviewedDate) {
90
+ validationResults.push({
91
+ checkName: 'review-date-format',
92
+ repository: repositoryName,
93
+ passed: false,
94
+ details: `Invalid or missing lastReviewedAt: ${String(watchlistEntry.lastReviewedAt)}`,
95
+ });
96
+
97
+ return {
98
+ repository: repositoryName,
99
+ owner: repositoryOwner,
100
+ lastReviewedAt: watchlistEntry.lastReviewedAt,
101
+ ageInDays: null,
102
+ stale: true,
103
+ };
104
+ }
105
+
106
+ const reviewAgeInDays = calculateAgeInDays(currentDate, lastReviewedDate);
107
+ const reviewWithinSla = reviewAgeInDays <= REVIEW_SLA_DAYS;
108
+
109
+ validationResults.push({
110
+ checkName: 'review-sla-compliance',
111
+ repository: repositoryName,
112
+ passed: reviewWithinSla,
113
+ details: `ageInDays=${reviewAgeInDays} slaDays=${REVIEW_SLA_DAYS}`,
114
+ });
115
+
116
+ return {
117
+ repository: repositoryName,
118
+ owner: repositoryOwner,
119
+ lastReviewedAt: watchlistEntry.lastReviewedAt,
120
+ ageInDays: reviewAgeInDays,
121
+ stale: !reviewWithinSla,
122
+ };
123
+ });
124
+
125
+ const failedCheckCount = validationResults.filter((validationResult) => !validationResult.passed).length;
126
+ const intelligenceReport = {
127
+ generatedAt: new Date().toISOString(),
128
+ reportName: 'benchmark-intelligence',
129
+ passed: failedCheckCount === 0,
130
+ failureCount: failedCheckCount,
131
+ reviewSlaDays: REVIEW_SLA_DAYS,
132
+ watchlist: watchlistReport,
133
+ results: validationResults,
134
+ };
135
+
136
+ console.log(JSON.stringify(intelligenceReport, null, 2));
137
+ process.exit(intelligenceReport.passed ? 0 : 1);
138
+ }
139
+
140
+ runIntelligenceValidation();