@ryuenn3123/agentic-senior-core 1.8.2 → 1.9.1

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 (76) hide show
  1. package/.agent-context/blueprints/mobile-app.md +21 -21
  2. package/.agent-context/policies/llm-judge-threshold.json +19 -19
  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/skills/README.md +62 -62
  10. package/.agent-context/skills/backend/README.md +67 -67
  11. package/.agent-context/skills/backend/architecture.md +360 -360
  12. package/.agent-context/skills/backend/data-access.md +230 -230
  13. package/.agent-context/skills/backend/errors.md +137 -137
  14. package/.agent-context/skills/backend/validation.md +116 -116
  15. package/.agent-context/skills/backend.md +28 -28
  16. package/.agent-context/skills/cli/README.md +49 -49
  17. package/.agent-context/skills/cli/init.md +37 -37
  18. package/.agent-context/skills/cli/output.md +35 -35
  19. package/.agent-context/skills/cli/upgrade.md +37 -37
  20. package/.agent-context/skills/cli.md +28 -28
  21. package/.agent-context/skills/distribution/README.md +18 -18
  22. package/.agent-context/skills/distribution/compatibility.md +31 -31
  23. package/.agent-context/skills/distribution/publish.md +36 -36
  24. package/.agent-context/skills/distribution/rollback.md +31 -31
  25. package/.agent-context/skills/distribution.md +28 -28
  26. package/.agent-context/skills/frontend/README.md +35 -35
  27. package/.agent-context/skills/frontend/accessibility.md +107 -107
  28. package/.agent-context/skills/frontend/motion.md +66 -66
  29. package/.agent-context/skills/frontend/performance.md +62 -62
  30. package/.agent-context/skills/frontend/ui-architecture.md +128 -128
  31. package/.agent-context/skills/frontend.md +29 -29
  32. package/.agent-context/skills/fullstack/README.md +18 -18
  33. package/.agent-context/skills/fullstack/contracts.md +52 -52
  34. package/.agent-context/skills/fullstack/end-to-end.md +41 -41
  35. package/.agent-context/skills/fullstack/feature-slicing.md +64 -64
  36. package/.agent-context/skills/fullstack.md +26 -26
  37. package/.agent-context/skills/index.json +107 -107
  38. package/.agent-context/skills/review-quality/README.md +18 -18
  39. package/.agent-context/skills/review-quality/benchmark.md +29 -29
  40. package/.agent-context/skills/review-quality/planning.md +37 -37
  41. package/.agent-context/skills/review-quality/security.md +33 -33
  42. package/.agent-context/skills/review-quality.md +27 -27
  43. package/.agent-context/stacks/flutter.md +16 -16
  44. package/.agent-context/stacks/react-native.md +16 -16
  45. package/.agent-context/state/architecture-map.md +25 -25
  46. package/.agent-context/state/benchmark-analysis.json +431 -431
  47. package/.agent-context/state/benchmark-thresholds.json +10 -10
  48. package/.agent-context/state/benchmark-watchlist.json +19 -19
  49. package/.agent-context/state/dependency-map.md +32 -32
  50. package/.agent-context/state/skill-platform.json +38 -38
  51. package/.agent-override.md +36 -36
  52. package/.cursorrules +140 -140
  53. package/.github/ISSUE_TEMPLATE/v1.7-frontend-work-item.yml +54 -54
  54. package/.github/copilot-instructions.md +62 -0
  55. package/.github/workflows/benchmark-detection.yml +38 -38
  56. package/.github/workflows/benchmark-intelligence.yml +50 -50
  57. package/.github/workflows/frontend-usability-gate.yml +36 -36
  58. package/.github/workflows/publish.yml +32 -0
  59. package/.github/workflows/release-gate.yml +32 -32
  60. package/.github/workflows/sbom-compliance.yml +32 -32
  61. package/.windsurfrules +106 -106
  62. package/AGENTS.md +181 -131
  63. package/README.md +318 -318
  64. package/bin/agentic-senior-core.js +1556 -1556
  65. package/mcp.json +92 -29
  66. package/package.json +1 -1
  67. package/scripts/benchmark-gate.mjs +121 -121
  68. package/scripts/benchmark-intelligence.mjs +140 -140
  69. package/scripts/detection-benchmark.mjs +138 -138
  70. package/scripts/frontend-usability-audit.mjs +87 -87
  71. package/scripts/generate-sbom.mjs +61 -61
  72. package/scripts/init-project.ps1 +104 -104
  73. package/scripts/llm-judge.mjs +664 -664
  74. package/scripts/release-gate.mjs +116 -116
  75. package/scripts/skill-tier-policy.mjs +75 -75
  76. package/scripts/validate.mjs +636 -636
package/mcp.json CHANGED
@@ -1,29 +1,92 @@
1
- {
2
- "$schema": "https://modelcontextprotocol.io/schemas/mcp.json",
3
- "version": "1.0",
4
- "name": "agentic-senior-core",
5
- "description": "MCP configuration for governance-aware diagnostics and self-healing workflows.",
6
- "servers": {
7
- "lint": {
8
- "command": "node",
9
- "args": ["./scripts/validate.mjs"],
10
- "transport": "stdio"
11
- },
12
- "test": {
13
- "command": "node",
14
- "args": ["--test", "./tests/cli-smoke.test.mjs", "./tests/llm-judge.test.mjs"],
15
- "transport": "stdio"
16
- }
17
- },
18
- "workflows": {
19
- "self-heal-on-failure": {
20
- "trigger": ["ci.failure", "lint.failure"],
21
- "steps": [
22
- "collect_logs",
23
- "map_violation_to_rule",
24
- "propose_patch",
25
- "run_checklist_review"
26
- ]
27
- }
28
- }
29
- }
1
+ {
2
+ "$schema": "https://modelcontextprotocol.io/schemas/mcp.json",
3
+ "version": "1.0",
4
+ "name": "agentic-senior-core",
5
+ "description": "MCP configuration for governance-aware diagnostics and self-healing workflows with full knowledge injection.",
6
+ "knowledgeLayers": {
7
+ "enabled": true,
8
+ "description": "8-layer unified knowledge injection for AI agents",
9
+ "layers": {
10
+ "rules": {
11
+ "path": ".agent-context/rules",
12
+ "count": 14,
13
+ "autoLoad": true
14
+ },
15
+ "stacks": {
16
+ "path": ".agent-context/stacks",
17
+ "count": 10,
18
+ "autoLoad": true
19
+ },
20
+ "blueprints": {
21
+ "path": ".agent-context/blueprints",
22
+ "count": 14,
23
+ "autoLoad": true
24
+ },
25
+ "skills": {
26
+ "path": ".agent-context/skills",
27
+ "count": 6,
28
+ "autoLoad": true,
29
+ "packs": ["backend", "frontend", "cli", "distribution", "fullstack", "review-quality"]
30
+ },
31
+ "prompts": {
32
+ "path": ".agent-context/prompts",
33
+ "count": 3,
34
+ "autoLoad": true,
35
+ "templates": ["init-project", "refactor", "review-code"]
36
+ },
37
+ "profiles": {
38
+ "path": ".agent-context/profiles",
39
+ "count": 3,
40
+ "autoLoad": true,
41
+ "governance": ["platform", "regulated", "startup"]
42
+ },
43
+ "state": {
44
+ "path": ".agent-context/state",
45
+ "count": 6,
46
+ "autoLoad": true
47
+ },
48
+ "policies": {
49
+ "path": ".agent-context/policies",
50
+ "count": 1,
51
+ "autoLoad": true
52
+ }
53
+ }
54
+ },
55
+ "servers": {
56
+ "lint": {
57
+ "command": "node",
58
+ "args": ["./scripts/validate.mjs"],
59
+ "transport": "stdio"
60
+ },
61
+ "test": {
62
+ "command": "node",
63
+ "args": ["--test", "./tests/cli-smoke.test.mjs", "./tests/llm-judge.test.mjs"],
64
+ "transport": "stdio"
65
+ }
66
+ },
67
+ "workflows": {
68
+ "self-heal-on-failure": {
69
+ "trigger": ["ci.failure", "lint.failure"],
70
+ "steps": [
71
+ "collect_logs",
72
+ "map_violation_to_rule",
73
+ "propose_patch",
74
+ "run_checklist_review"
75
+ ]
76
+ },
77
+ "full-knowledge-injection": {
78
+ "trigger": ["workspace.initialize", "agent.start"],
79
+ "steps": [
80
+ "load_all_knowledge_layers",
81
+ "inject_rules",
82
+ "inject_stacks",
83
+ "inject_blueprints",
84
+ "inject_skills",
85
+ "inject_prompts",
86
+ "inject_profiles",
87
+ "inject_state",
88
+ "inject_policies"
89
+ ]
90
+ }
91
+ }
92
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryuenn3123/agentic-senior-core",
3
- "version": "1.8.2",
3
+ "version": "1.9.1",
4
4
  "description": "Force your AI Agent to code like a Staff Engineer, not a Junior.",
5
5
  "bin": {
6
6
  "agentic-senior-core": "bin/agentic-senior-core.js"
@@ -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();