@ryuenn3123/agentic-senior-core 1.9.0 → 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.
- package/.agent-context/blueprints/mobile-app.md +21 -21
- package/.agent-context/policies/llm-judge-threshold.json +19 -19
- package/.agent-context/profiles/platform.md +13 -13
- package/.agent-context/profiles/regulated.md +13 -13
- package/.agent-context/profiles/startup.md +13 -13
- package/.agent-context/review-checklists/frontend-skill-parity.md +28 -28
- package/.agent-context/review-checklists/frontend-usability.md +33 -33
- package/.agent-context/review-checklists/release-operations.md +29 -29
- package/.agent-context/skills/README.md +62 -62
- package/.agent-context/skills/backend/README.md +67 -67
- package/.agent-context/skills/backend/architecture.md +360 -360
- package/.agent-context/skills/backend/data-access.md +230 -230
- package/.agent-context/skills/backend/errors.md +137 -137
- package/.agent-context/skills/backend/validation.md +116 -116
- package/.agent-context/skills/backend.md +28 -28
- package/.agent-context/skills/cli/README.md +49 -49
- package/.agent-context/skills/cli/init.md +37 -37
- package/.agent-context/skills/cli/output.md +35 -35
- package/.agent-context/skills/cli/upgrade.md +37 -37
- package/.agent-context/skills/cli.md +28 -28
- package/.agent-context/skills/distribution/README.md +18 -18
- package/.agent-context/skills/distribution/compatibility.md +31 -31
- package/.agent-context/skills/distribution/publish.md +36 -36
- package/.agent-context/skills/distribution/rollback.md +31 -31
- package/.agent-context/skills/distribution.md +28 -28
- package/.agent-context/skills/frontend/README.md +35 -35
- package/.agent-context/skills/frontend/accessibility.md +107 -107
- package/.agent-context/skills/frontend/motion.md +66 -66
- package/.agent-context/skills/frontend/performance.md +62 -62
- package/.agent-context/skills/frontend/ui-architecture.md +128 -128
- package/.agent-context/skills/frontend.md +29 -29
- package/.agent-context/skills/fullstack/README.md +18 -18
- package/.agent-context/skills/fullstack/contracts.md +52 -52
- package/.agent-context/skills/fullstack/end-to-end.md +41 -41
- package/.agent-context/skills/fullstack/feature-slicing.md +64 -64
- package/.agent-context/skills/fullstack.md +26 -26
- package/.agent-context/skills/index.json +107 -107
- package/.agent-context/skills/review-quality/README.md +18 -18
- package/.agent-context/skills/review-quality/benchmark.md +29 -29
- package/.agent-context/skills/review-quality/planning.md +37 -37
- package/.agent-context/skills/review-quality/security.md +33 -33
- package/.agent-context/skills/review-quality.md +27 -27
- package/.agent-context/stacks/flutter.md +16 -16
- package/.agent-context/stacks/react-native.md +16 -16
- package/.agent-context/state/architecture-map.md +25 -25
- package/.agent-context/state/benchmark-analysis.json +431 -431
- package/.agent-context/state/benchmark-thresholds.json +10 -10
- package/.agent-context/state/benchmark-watchlist.json +19 -19
- package/.agent-context/state/dependency-map.md +32 -32
- package/.agent-context/state/skill-platform.json +38 -38
- package/.agent-override.md +36 -36
- package/.cursorrules +140 -140
- package/.github/ISSUE_TEMPLATE/v1.7-frontend-work-item.yml +54 -54
- package/.github/workflows/benchmark-detection.yml +38 -38
- package/.github/workflows/benchmark-intelligence.yml +50 -50
- package/.github/workflows/frontend-usability-gate.yml +36 -36
- package/.github/workflows/publish.yml +32 -0
- package/.github/workflows/release-gate.yml +32 -32
- package/.github/workflows/sbom-compliance.yml +32 -32
- package/.windsurfrules +106 -106
- package/AGENTS.md +181 -181
- package/README.md +318 -318
- package/bin/agentic-senior-core.js +1556 -1556
- package/mcp.json +92 -92
- package/package.json +1 -1
- package/scripts/benchmark-gate.mjs +121 -121
- package/scripts/benchmark-intelligence.mjs +140 -140
- package/scripts/detection-benchmark.mjs +138 -138
- package/scripts/frontend-usability-audit.mjs +87 -87
- package/scripts/generate-sbom.mjs +61 -61
- package/scripts/init-project.ps1 +104 -104
- package/scripts/llm-judge.mjs +664 -664
- package/scripts/release-gate.mjs +116 -116
- package/scripts/skill-tier-policy.mjs +75 -75
- package/scripts/validate.mjs +636 -636
|
@@ -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();
|
|
@@ -1,138 +1,138 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* detection-benchmark.mjs
|
|
5
|
-
*
|
|
6
|
-
* Lightweight benchmark for stack detection heuristics used by the CLI.
|
|
7
|
-
* Publishes top-1 accuracy and manual-correction-rate proxy.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
const BLUEPRINT_RECOMMENDATIONS = {
|
|
11
|
-
'typescript.md': 'api-nextjs.md',
|
|
12
|
-
'python.md': 'fastapi-service.md',
|
|
13
|
-
'java.md': 'spring-boot-api.md',
|
|
14
|
-
'php.md': 'laravel-api.md',
|
|
15
|
-
'go.md': 'go-service.md',
|
|
16
|
-
'csharp.md': 'aspnet-api.md',
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const AMBIGUITY_THRESHOLD = 0.08;
|
|
20
|
-
|
|
21
|
-
const BENCHMARK_FIXTURES = [
|
|
22
|
-
{ fixtureName: 'typescript-basic', markers: ['package.json', 'tsconfig.json'], expectedStack: 'typescript.md' },
|
|
23
|
-
{ fixtureName: 'typescript-next', markers: ['package.json', 'tsconfig.json', 'next.config.js'], expectedStack: 'typescript.md' },
|
|
24
|
-
{ fixtureName: 'python-poetry', markers: ['pyproject.toml'], expectedStack: 'python.md' },
|
|
25
|
-
{ fixtureName: 'python-requirements', markers: ['requirements.txt'], expectedStack: 'python.md' },
|
|
26
|
-
{ fixtureName: 'java-maven', markers: ['pom.xml'], expectedStack: 'java.md' },
|
|
27
|
-
{ fixtureName: 'java-gradle', markers: ['build.gradle'], expectedStack: 'java.md' },
|
|
28
|
-
{ fixtureName: 'php-composer', markers: ['composer.json'], expectedStack: 'php.md' },
|
|
29
|
-
{ fixtureName: 'go-module', markers: ['go.mod'], expectedStack: 'go.md' },
|
|
30
|
-
{ fixtureName: 'dotnet-solution', markers: ['app.sln'], expectedStack: 'csharp.md' },
|
|
31
|
-
{ fixtureName: 'rust-cargo', markers: ['Cargo.toml'], expectedStack: 'rust.md' },
|
|
32
|
-
{ fixtureName: 'ruby-gemfile', markers: ['Gemfile'], expectedStack: 'ruby.md' },
|
|
33
|
-
{ fixtureName: 'mixed-ts-python', markers: ['package.json', 'tsconfig.json', 'pyproject.toml'], expectedStack: 'typescript.md' },
|
|
34
|
-
];
|
|
35
|
-
|
|
36
|
-
function detectProjectFromMarkers(markers) {
|
|
37
|
-
const markerNames = new Set(markers);
|
|
38
|
-
const candidates = [];
|
|
39
|
-
|
|
40
|
-
if (markerNames.has('package.json') || markerNames.has('tsconfig.json') || markerNames.has('next.config.js') || markerNames.has('next.config.mjs')) {
|
|
41
|
-
let confidenceScore = 0.7;
|
|
42
|
-
if (markerNames.has('package.json')) confidenceScore += 0.12;
|
|
43
|
-
if (markerNames.has('tsconfig.json')) confidenceScore += 0.12;
|
|
44
|
-
if (markerNames.has('next.config.js') || markerNames.has('next.config.mjs')) confidenceScore += 0.05;
|
|
45
|
-
candidates.push({ stackFileName: 'typescript.md', confidenceScore: Math.min(confidenceScore, 0.97) });
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (markerNames.has('pyproject.toml') || markerNames.has('requirements.txt')) {
|
|
49
|
-
candidates.push({
|
|
50
|
-
stackFileName: 'python.md',
|
|
51
|
-
confidenceScore: markerNames.has('pyproject.toml') ? 0.96 : 0.78,
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (markerNames.has('pom.xml') || markerNames.has('build.gradle') || markerNames.has('build.gradle.kts')) {
|
|
56
|
-
candidates.push({
|
|
57
|
-
stackFileName: 'java.md',
|
|
58
|
-
confidenceScore: markerNames.has('pom.xml') ? 0.95 : 0.84,
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (markerNames.has('composer.json')) candidates.push({ stackFileName: 'php.md', confidenceScore: 0.95 });
|
|
63
|
-
if (markerNames.has('go.mod')) candidates.push({ stackFileName: 'go.md', confidenceScore: 0.96 });
|
|
64
|
-
if (markerNames.has('Cargo.toml')) candidates.push({ stackFileName: 'rust.md', confidenceScore: 0.96 });
|
|
65
|
-
if (markerNames.has('Gemfile')) candidates.push({ stackFileName: 'ruby.md', confidenceScore: 0.95 });
|
|
66
|
-
|
|
67
|
-
const hasDotNetMarker = Array.from(markerNames).some((markerName) => markerName.endsWith('.sln') || markerName.endsWith('.csproj'));
|
|
68
|
-
if (hasDotNetMarker) {
|
|
69
|
-
candidates.push({ stackFileName: 'csharp.md', confidenceScore: 0.95 });
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (candidates.length === 0) {
|
|
73
|
-
return {
|
|
74
|
-
recommendedStack: null,
|
|
75
|
-
recommendedBlueprint: null,
|
|
76
|
-
confidenceScore: 0,
|
|
77
|
-
confidenceGap: 0,
|
|
78
|
-
needsManualCorrection: true,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
candidates.sort((leftCandidate, rightCandidate) => rightCandidate.confidenceScore - leftCandidate.confidenceScore);
|
|
83
|
-
const strongestCandidate = candidates[0];
|
|
84
|
-
const secondStrongestCandidate = candidates[1];
|
|
85
|
-
const confidenceGap = secondStrongestCandidate
|
|
86
|
-
? Number((strongestCandidate.confidenceScore - secondStrongestCandidate.confidenceScore).toFixed(2))
|
|
87
|
-
: Number(strongestCandidate.confidenceScore.toFixed(2));
|
|
88
|
-
|
|
89
|
-
return {
|
|
90
|
-
recommendedStack: strongestCandidate.stackFileName,
|
|
91
|
-
recommendedBlueprint: BLUEPRINT_RECOMMENDATIONS[strongestCandidate.stackFileName] || null,
|
|
92
|
-
confidenceScore: strongestCandidate.confidenceScore,
|
|
93
|
-
confidenceGap,
|
|
94
|
-
needsManualCorrection: confidenceGap < AMBIGUITY_THRESHOLD,
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function runBenchmark() {
|
|
99
|
-
let passingFixtureCount = 0;
|
|
100
|
-
let manualCorrectionCount = 0;
|
|
101
|
-
|
|
102
|
-
const fixtureResults = BENCHMARK_FIXTURES.map((benchmarkFixture) => {
|
|
103
|
-
const detectionResult = detectProjectFromMarkers(benchmarkFixture.markers);
|
|
104
|
-
const isCorrect = detectionResult.recommendedStack === benchmarkFixture.expectedStack;
|
|
105
|
-
|
|
106
|
-
if (isCorrect) {
|
|
107
|
-
passingFixtureCount += 1;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (detectionResult.needsManualCorrection) {
|
|
111
|
-
manualCorrectionCount += 1;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return {
|
|
115
|
-
fixtureName: benchmarkFixture.fixtureName,
|
|
116
|
-
expectedStack: benchmarkFixture.expectedStack,
|
|
117
|
-
detectedStack: detectionResult.recommendedStack,
|
|
118
|
-
confidenceGap: detectionResult.confidenceGap,
|
|
119
|
-
needsManualCorrection: detectionResult.needsManualCorrection,
|
|
120
|
-
isCorrect,
|
|
121
|
-
};
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
const totalFixtureCount = BENCHMARK_FIXTURES.length;
|
|
125
|
-
const top1Accuracy = Number((passingFixtureCount / totalFixtureCount).toFixed(4));
|
|
126
|
-
const manualCorrectionRate = Number((manualCorrectionCount / totalFixtureCount).toFixed(4));
|
|
127
|
-
|
|
128
|
-
return {
|
|
129
|
-
generatedAt: new Date().toISOString(),
|
|
130
|
-
fixtureCount: totalFixtureCount,
|
|
131
|
-
top1Accuracy,
|
|
132
|
-
manualCorrectionRate,
|
|
133
|
-
fixtures: fixtureResults,
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
const benchmarkResult = runBenchmark();
|
|
138
|
-
console.log(JSON.stringify(benchmarkResult, null, 2));
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* detection-benchmark.mjs
|
|
5
|
+
*
|
|
6
|
+
* Lightweight benchmark for stack detection heuristics used by the CLI.
|
|
7
|
+
* Publishes top-1 accuracy and manual-correction-rate proxy.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const BLUEPRINT_RECOMMENDATIONS = {
|
|
11
|
+
'typescript.md': 'api-nextjs.md',
|
|
12
|
+
'python.md': 'fastapi-service.md',
|
|
13
|
+
'java.md': 'spring-boot-api.md',
|
|
14
|
+
'php.md': 'laravel-api.md',
|
|
15
|
+
'go.md': 'go-service.md',
|
|
16
|
+
'csharp.md': 'aspnet-api.md',
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const AMBIGUITY_THRESHOLD = 0.08;
|
|
20
|
+
|
|
21
|
+
const BENCHMARK_FIXTURES = [
|
|
22
|
+
{ fixtureName: 'typescript-basic', markers: ['package.json', 'tsconfig.json'], expectedStack: 'typescript.md' },
|
|
23
|
+
{ fixtureName: 'typescript-next', markers: ['package.json', 'tsconfig.json', 'next.config.js'], expectedStack: 'typescript.md' },
|
|
24
|
+
{ fixtureName: 'python-poetry', markers: ['pyproject.toml'], expectedStack: 'python.md' },
|
|
25
|
+
{ fixtureName: 'python-requirements', markers: ['requirements.txt'], expectedStack: 'python.md' },
|
|
26
|
+
{ fixtureName: 'java-maven', markers: ['pom.xml'], expectedStack: 'java.md' },
|
|
27
|
+
{ fixtureName: 'java-gradle', markers: ['build.gradle'], expectedStack: 'java.md' },
|
|
28
|
+
{ fixtureName: 'php-composer', markers: ['composer.json'], expectedStack: 'php.md' },
|
|
29
|
+
{ fixtureName: 'go-module', markers: ['go.mod'], expectedStack: 'go.md' },
|
|
30
|
+
{ fixtureName: 'dotnet-solution', markers: ['app.sln'], expectedStack: 'csharp.md' },
|
|
31
|
+
{ fixtureName: 'rust-cargo', markers: ['Cargo.toml'], expectedStack: 'rust.md' },
|
|
32
|
+
{ fixtureName: 'ruby-gemfile', markers: ['Gemfile'], expectedStack: 'ruby.md' },
|
|
33
|
+
{ fixtureName: 'mixed-ts-python', markers: ['package.json', 'tsconfig.json', 'pyproject.toml'], expectedStack: 'typescript.md' },
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
function detectProjectFromMarkers(markers) {
|
|
37
|
+
const markerNames = new Set(markers);
|
|
38
|
+
const candidates = [];
|
|
39
|
+
|
|
40
|
+
if (markerNames.has('package.json') || markerNames.has('tsconfig.json') || markerNames.has('next.config.js') || markerNames.has('next.config.mjs')) {
|
|
41
|
+
let confidenceScore = 0.7;
|
|
42
|
+
if (markerNames.has('package.json')) confidenceScore += 0.12;
|
|
43
|
+
if (markerNames.has('tsconfig.json')) confidenceScore += 0.12;
|
|
44
|
+
if (markerNames.has('next.config.js') || markerNames.has('next.config.mjs')) confidenceScore += 0.05;
|
|
45
|
+
candidates.push({ stackFileName: 'typescript.md', confidenceScore: Math.min(confidenceScore, 0.97) });
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (markerNames.has('pyproject.toml') || markerNames.has('requirements.txt')) {
|
|
49
|
+
candidates.push({
|
|
50
|
+
stackFileName: 'python.md',
|
|
51
|
+
confidenceScore: markerNames.has('pyproject.toml') ? 0.96 : 0.78,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (markerNames.has('pom.xml') || markerNames.has('build.gradle') || markerNames.has('build.gradle.kts')) {
|
|
56
|
+
candidates.push({
|
|
57
|
+
stackFileName: 'java.md',
|
|
58
|
+
confidenceScore: markerNames.has('pom.xml') ? 0.95 : 0.84,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (markerNames.has('composer.json')) candidates.push({ stackFileName: 'php.md', confidenceScore: 0.95 });
|
|
63
|
+
if (markerNames.has('go.mod')) candidates.push({ stackFileName: 'go.md', confidenceScore: 0.96 });
|
|
64
|
+
if (markerNames.has('Cargo.toml')) candidates.push({ stackFileName: 'rust.md', confidenceScore: 0.96 });
|
|
65
|
+
if (markerNames.has('Gemfile')) candidates.push({ stackFileName: 'ruby.md', confidenceScore: 0.95 });
|
|
66
|
+
|
|
67
|
+
const hasDotNetMarker = Array.from(markerNames).some((markerName) => markerName.endsWith('.sln') || markerName.endsWith('.csproj'));
|
|
68
|
+
if (hasDotNetMarker) {
|
|
69
|
+
candidates.push({ stackFileName: 'csharp.md', confidenceScore: 0.95 });
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (candidates.length === 0) {
|
|
73
|
+
return {
|
|
74
|
+
recommendedStack: null,
|
|
75
|
+
recommendedBlueprint: null,
|
|
76
|
+
confidenceScore: 0,
|
|
77
|
+
confidenceGap: 0,
|
|
78
|
+
needsManualCorrection: true,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
candidates.sort((leftCandidate, rightCandidate) => rightCandidate.confidenceScore - leftCandidate.confidenceScore);
|
|
83
|
+
const strongestCandidate = candidates[0];
|
|
84
|
+
const secondStrongestCandidate = candidates[1];
|
|
85
|
+
const confidenceGap = secondStrongestCandidate
|
|
86
|
+
? Number((strongestCandidate.confidenceScore - secondStrongestCandidate.confidenceScore).toFixed(2))
|
|
87
|
+
: Number(strongestCandidate.confidenceScore.toFixed(2));
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
recommendedStack: strongestCandidate.stackFileName,
|
|
91
|
+
recommendedBlueprint: BLUEPRINT_RECOMMENDATIONS[strongestCandidate.stackFileName] || null,
|
|
92
|
+
confidenceScore: strongestCandidate.confidenceScore,
|
|
93
|
+
confidenceGap,
|
|
94
|
+
needsManualCorrection: confidenceGap < AMBIGUITY_THRESHOLD,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function runBenchmark() {
|
|
99
|
+
let passingFixtureCount = 0;
|
|
100
|
+
let manualCorrectionCount = 0;
|
|
101
|
+
|
|
102
|
+
const fixtureResults = BENCHMARK_FIXTURES.map((benchmarkFixture) => {
|
|
103
|
+
const detectionResult = detectProjectFromMarkers(benchmarkFixture.markers);
|
|
104
|
+
const isCorrect = detectionResult.recommendedStack === benchmarkFixture.expectedStack;
|
|
105
|
+
|
|
106
|
+
if (isCorrect) {
|
|
107
|
+
passingFixtureCount += 1;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (detectionResult.needsManualCorrection) {
|
|
111
|
+
manualCorrectionCount += 1;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return {
|
|
115
|
+
fixtureName: benchmarkFixture.fixtureName,
|
|
116
|
+
expectedStack: benchmarkFixture.expectedStack,
|
|
117
|
+
detectedStack: detectionResult.recommendedStack,
|
|
118
|
+
confidenceGap: detectionResult.confidenceGap,
|
|
119
|
+
needsManualCorrection: detectionResult.needsManualCorrection,
|
|
120
|
+
isCorrect,
|
|
121
|
+
};
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
const totalFixtureCount = BENCHMARK_FIXTURES.length;
|
|
125
|
+
const top1Accuracy = Number((passingFixtureCount / totalFixtureCount).toFixed(4));
|
|
126
|
+
const manualCorrectionRate = Number((manualCorrectionCount / totalFixtureCount).toFixed(4));
|
|
127
|
+
|
|
128
|
+
return {
|
|
129
|
+
generatedAt: new Date().toISOString(),
|
|
130
|
+
fixtureCount: totalFixtureCount,
|
|
131
|
+
top1Accuracy,
|
|
132
|
+
manualCorrectionRate,
|
|
133
|
+
fixtures: fixtureResults,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const benchmarkResult = runBenchmark();
|
|
138
|
+
console.log(JSON.stringify(benchmarkResult, null, 2));
|