@ryuenn3123/agentic-senior-core 2.0.4 → 2.0.7
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 +82 -12
- package/.agent-context/skills/cli/README.md +6 -0
- package/.agent-context/skills/cli/safety-telemetry.md +39 -0
- package/.agent-context/skills/cli.md +3 -0
- package/.agent-context/skills/distribution/.evidence/compatibility-manifest.json +9 -0
- package/.agent-context/skills/distribution/.evidence/sbom-excerpt.json +6 -0
- package/.agent-context/skills/distribution/.evidence/test-report.json +8 -0
- package/.agent-context/skills/distribution/CHANGELOG.md +7 -0
- package/.agent-context/skills/distribution/README.md +9 -1
- package/.agent-context/skills/distribution/package.json +5 -0
- package/.agent-context/skills/distribution/provenance-attestation.md +47 -0
- package/.agent-context/skills/distribution/tests/.gitkeep +1 -0
- package/.agent-context/skills/distribution.md +3 -0
- package/.agent-context/skills/frontend/.evidence/compatibility-manifest.json +9 -0
- package/.agent-context/skills/frontend/.evidence/sbom-excerpt.json +6 -0
- package/.agent-context/skills/frontend/.evidence/test-report.json +8 -0
- package/.agent-context/skills/frontend/CHANGELOG.md +7 -0
- package/.agent-context/skills/frontend/README.md +14 -1
- package/.agent-context/skills/frontend/conversion-clarity.md +51 -0
- package/.agent-context/skills/frontend/package.json +5 -0
- package/.agent-context/skills/frontend/responsive-delivery.md +41 -0
- package/.agent-context/skills/frontend/tests/.gitkeep +1 -0
- package/.agent-context/skills/frontend.md +6 -0
- package/.agent-context/skills/fullstack/.evidence/compatibility-manifest.json +9 -0
- package/.agent-context/skills/fullstack/.evidence/sbom-excerpt.json +6 -0
- package/.agent-context/skills/fullstack/.evidence/test-report.json +8 -0
- package/.agent-context/skills/fullstack/CHANGELOG.md +7 -0
- package/.agent-context/skills/fullstack/README.md +9 -1
- package/.agent-context/skills/fullstack/package.json +5 -0
- package/.agent-context/skills/fullstack/release-coordination.md +51 -0
- package/.agent-context/skills/fullstack/tests/.gitkeep +1 -0
- package/.agent-context/skills/fullstack.md +3 -0
- package/.agent-context/skills/review-quality/.evidence/compatibility-manifest.json +9 -0
- package/.agent-context/skills/review-quality/.evidence/sbom-excerpt.json +6 -0
- package/.agent-context/skills/review-quality/.evidence/test-report.json +8 -0
- package/.agent-context/skills/review-quality/CHANGELOG.md +7 -0
- package/.agent-context/skills/review-quality/README.md +9 -1
- package/.agent-context/skills/review-quality/package.json +5 -0
- package/.agent-context/skills/review-quality/release-decision.md +49 -0
- package/.agent-context/skills/review-quality/tests/.gitkeep +1 -0
- package/.agent-context/skills/review-quality.md +3 -0
- package/.agent-context/state/quality-trend-report.json +89 -0
- package/.agent-context/state/weekly-governance-report.json +126 -0
- package/.cursorrules +1 -1
- package/.gemini/instructions.md +15 -91
- package/.github/copilot-instructions.md +15 -160
- package/.github/workflows/governance-weekly-report.yml +43 -0
- package/.windsurfrules +1 -1
- package/AGENTS.md +21 -174
- package/README.md +15 -0
- package/lib/cli/constants.mjs +35 -0
- package/lib/cli/utils.mjs +4 -1
- package/package.json +3 -1
- package/scripts/governance-weekly-report.mjs +293 -0
- package/scripts/quality-trend-report.mjs +289 -0
- package/scripts/release-gate.mjs +57 -0
- package/scripts/validate.mjs +85 -22
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* governance-weekly-report.mjs
|
|
5
|
+
*
|
|
6
|
+
* Aggregates weekly governance readiness signals for maintainers.
|
|
7
|
+
* Produces a machine-readable report with trend, trust, and release posture.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
11
|
+
import fs from 'node:fs/promises';
|
|
12
|
+
import { spawnSync } from 'node:child_process';
|
|
13
|
+
import { dirname, join, resolve } from 'node:path';
|
|
14
|
+
import { fileURLToPath } from 'node:url';
|
|
15
|
+
import { calculateTrustScore } from './trust-scorer.mjs';
|
|
16
|
+
|
|
17
|
+
const SCRIPT_FILE_PATH = fileURLToPath(import.meta.url);
|
|
18
|
+
const SCRIPT_DIR = dirname(SCRIPT_FILE_PATH);
|
|
19
|
+
const REPOSITORY_ROOT = resolve(SCRIPT_DIR, '..');
|
|
20
|
+
const QUALITY_TREND_PATH = join(REPOSITORY_ROOT, '.agent-context', 'state', 'quality-trend-report.json');
|
|
21
|
+
const REPORT_PATH = join(REPOSITORY_ROOT, '.agent-context', 'state', 'weekly-governance-report.json');
|
|
22
|
+
const ARGUMENT_FLAGS = new Set(process.argv.slice(2));
|
|
23
|
+
const isStdoutOnlyMode = ARGUMENT_FLAGS.has('--stdout-only');
|
|
24
|
+
const WEEKLY_WINDOW_DAYS = 7;
|
|
25
|
+
const HISTORY_LIMIT = 26;
|
|
26
|
+
const REQUIRED_VERIFIED_DOMAINS = new Set(['cli', 'frontend', 'fullstack', 'distribution', 'review-quality']);
|
|
27
|
+
|
|
28
|
+
function readJsonOrNull(filePath) {
|
|
29
|
+
if (!existsSync(filePath)) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
return JSON.parse(readFileSync(filePath, 'utf8'));
|
|
35
|
+
} catch {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function runJsonScript(scriptRelativePath, scriptArguments = []) {
|
|
41
|
+
const absoluteScriptPath = join(REPOSITORY_ROOT, scriptRelativePath);
|
|
42
|
+
const commandResult = spawnSync('node', [absoluteScriptPath, ...scriptArguments], {
|
|
43
|
+
cwd: REPOSITORY_ROOT,
|
|
44
|
+
encoding: 'utf8',
|
|
45
|
+
maxBuffer: 1024 * 1024 * 10,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const standardOutput = (commandResult.stdout || '').trim();
|
|
49
|
+
const standardError = (commandResult.stderr || '').trim();
|
|
50
|
+
const exitCode = typeof commandResult.status === 'number' ? commandResult.status : 1;
|
|
51
|
+
|
|
52
|
+
if (!standardOutput) {
|
|
53
|
+
return {
|
|
54
|
+
scriptPath: scriptRelativePath,
|
|
55
|
+
exitCode,
|
|
56
|
+
parsedReport: null,
|
|
57
|
+
parseError: 'Script produced no stdout JSON payload',
|
|
58
|
+
stderr: standardError,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
return {
|
|
64
|
+
scriptPath: scriptRelativePath,
|
|
65
|
+
exitCode,
|
|
66
|
+
parsedReport: JSON.parse(standardOutput),
|
|
67
|
+
parseError: null,
|
|
68
|
+
stderr: standardError,
|
|
69
|
+
};
|
|
70
|
+
} catch (jsonParseError) {
|
|
71
|
+
const parseErrorMessage = jsonParseError instanceof Error ? jsonParseError.message : String(jsonParseError);
|
|
72
|
+
return {
|
|
73
|
+
scriptPath: scriptRelativePath,
|
|
74
|
+
exitCode,
|
|
75
|
+
parsedReport: null,
|
|
76
|
+
parseError: parseErrorMessage,
|
|
77
|
+
stderr: standardError,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function loadQualityTrendReport() {
|
|
83
|
+
const existingQualityTrend = readJsonOrNull(QUALITY_TREND_PATH);
|
|
84
|
+
if (existingQualityTrend) {
|
|
85
|
+
return {
|
|
86
|
+
source: 'state-file',
|
|
87
|
+
report: existingQualityTrend,
|
|
88
|
+
freshness: existingQualityTrend.generatedAt || null,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const generatedQualityTrend = runJsonScript('scripts/quality-trend-report.mjs', ['--stdout-only']);
|
|
93
|
+
return {
|
|
94
|
+
source: 'generated-stdout',
|
|
95
|
+
report: generatedQualityTrend.parsedReport,
|
|
96
|
+
freshness: generatedQualityTrend.parsedReport?.generatedAt || null,
|
|
97
|
+
parseError: generatedQualityTrend.parseError,
|
|
98
|
+
exitCode: generatedQualityTrend.exitCode,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function collectCommitSignals(windowDays) {
|
|
103
|
+
const commitLogResult = spawnSync('git', ['log', `--since=${windowDays}.days`, '--pretty=format:%s'], {
|
|
104
|
+
cwd: REPOSITORY_ROOT,
|
|
105
|
+
encoding: 'utf8',
|
|
106
|
+
maxBuffer: 1024 * 1024,
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
if (commitLogResult.status !== 0) {
|
|
110
|
+
return {
|
|
111
|
+
windowDays,
|
|
112
|
+
commitCount: 0,
|
|
113
|
+
releaseCommitCount: 0,
|
|
114
|
+
rollbackCommitCount: 0,
|
|
115
|
+
releaseFrequencyPercent: null,
|
|
116
|
+
rollbackFrequencyPercent: null,
|
|
117
|
+
error: (commitLogResult.stderr || 'Failed to read git log').trim(),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const commitSubjects = (commitLogResult.stdout || '')
|
|
122
|
+
.split(/\r?\n/u)
|
|
123
|
+
.map((subjectLine) => subjectLine.trim())
|
|
124
|
+
.filter((subjectLine) => subjectLine.length > 0);
|
|
125
|
+
|
|
126
|
+
const commitCount = commitSubjects.length;
|
|
127
|
+
const releaseCommitCount = commitSubjects.filter((subjectLine) => /release|publish|chore\(release\)/i.test(subjectLine)).length;
|
|
128
|
+
const rollbackCommitCount = commitSubjects.filter((subjectLine) => /rollback|revert/i.test(subjectLine)).length;
|
|
129
|
+
|
|
130
|
+
return {
|
|
131
|
+
windowDays,
|
|
132
|
+
commitCount,
|
|
133
|
+
releaseCommitCount,
|
|
134
|
+
rollbackCommitCount,
|
|
135
|
+
releaseFrequencyPercent: commitCount === 0 ? 0 : Number(((releaseCommitCount / commitCount) * 100).toFixed(2)),
|
|
136
|
+
rollbackFrequencyPercent: commitCount === 0 ? 0 : Number(((rollbackCommitCount / commitCount) * 100).toFixed(2)),
|
|
137
|
+
error: null,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
async function collectSkillTrustSignals() {
|
|
142
|
+
const skillDirectoryPath = join(REPOSITORY_ROOT, '.agent-context', 'skills');
|
|
143
|
+
const skillDirectoryEntries = await fs.readdir(skillDirectoryPath, { withFileTypes: true });
|
|
144
|
+
const skillDomainNames = skillDirectoryEntries
|
|
145
|
+
.filter((directoryEntry) => directoryEntry.isDirectory())
|
|
146
|
+
.map((directoryEntry) => directoryEntry.name)
|
|
147
|
+
.sort((leftDomainName, rightDomainName) => leftDomainName.localeCompare(rightDomainName));
|
|
148
|
+
|
|
149
|
+
const trustRows = [];
|
|
150
|
+
const tierCounts = {
|
|
151
|
+
verified: 0,
|
|
152
|
+
community: 0,
|
|
153
|
+
experimental: 0,
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
for (const skillDomainName of skillDomainNames) {
|
|
157
|
+
const trustResult = await calculateTrustScore(join(skillDirectoryPath, skillDomainName));
|
|
158
|
+
|
|
159
|
+
if (typeof tierCounts[trustResult.tier] === 'number') {
|
|
160
|
+
tierCounts[trustResult.tier] += 1;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
trustRows.push({
|
|
164
|
+
domain: skillDomainName,
|
|
165
|
+
tier: trustResult.tier,
|
|
166
|
+
score: trustResult.score,
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const requiredVerifiedDomainFailures = trustRows
|
|
171
|
+
.filter((trustRow) => REQUIRED_VERIFIED_DOMAINS.has(trustRow.domain) && trustRow.tier !== 'verified')
|
|
172
|
+
.map((trustRow) => trustRow.domain);
|
|
173
|
+
|
|
174
|
+
return {
|
|
175
|
+
domains: trustRows,
|
|
176
|
+
tierCounts,
|
|
177
|
+
requiredVerifiedDomains: Array.from(REQUIRED_VERIFIED_DOMAINS),
|
|
178
|
+
requiredVerifiedDomainFailures,
|
|
179
|
+
allRequiredVerified: requiredVerifiedDomainFailures.length === 0,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function buildBlockers(qualityTrendReport, skillTrustSignals, commitSignals) {
|
|
184
|
+
const blockers = [];
|
|
185
|
+
|
|
186
|
+
const qualityGatePassRatePercent = qualityTrendReport?.governanceHealth?.gatePassRatePercent;
|
|
187
|
+
if (typeof qualityGatePassRatePercent !== 'number' || qualityGatePassRatePercent < 100) {
|
|
188
|
+
blockers.push('Governance gate pass rate is below 100%.');
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (!skillTrustSignals.allRequiredVerified) {
|
|
192
|
+
blockers.push(
|
|
193
|
+
`Required verified skill domains missing: ${skillTrustSignals.requiredVerifiedDomainFailures.join(', ')}`
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (commitSignals.error) {
|
|
198
|
+
blockers.push(`Commit signal extraction failed: ${commitSignals.error}`);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return blockers;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function buildHistoryEntry(weeklyReport) {
|
|
205
|
+
return {
|
|
206
|
+
generatedAt: weeklyReport.generatedAt,
|
|
207
|
+
readinessStatus: weeklyReport.releaseReadiness.isReady ? 'ready' : 'blocked',
|
|
208
|
+
blockerCount: weeklyReport.releaseReadiness.blockers.length,
|
|
209
|
+
gatePassRatePercent: weeklyReport.qualitySignals.governanceHealth.gatePassRatePercent,
|
|
210
|
+
verifiedSkillDomainCount: weeklyReport.skillTrust.tierCounts.verified,
|
|
211
|
+
releaseFrequencyPercent: weeklyReport.commitSignals.releaseFrequencyPercent,
|
|
212
|
+
rollbackFrequencyPercent: weeklyReport.commitSignals.rollbackFrequencyPercent,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function mergeHistory(previousReport, currentHistoryEntry) {
|
|
217
|
+
const existingHistory = Array.isArray(previousReport?.history) ? previousReport.history : [];
|
|
218
|
+
const mergedHistory = [...existingHistory, currentHistoryEntry];
|
|
219
|
+
|
|
220
|
+
if (mergedHistory.length <= HISTORY_LIMIT) {
|
|
221
|
+
return mergedHistory;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
return mergedHistory.slice(mergedHistory.length - HISTORY_LIMIT);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
async function runWeeklyGovernanceReport() {
|
|
228
|
+
const qualityTrendState = loadQualityTrendReport();
|
|
229
|
+
const qualityTrendReport = qualityTrendState.report;
|
|
230
|
+
|
|
231
|
+
const skillTrustSignals = await collectSkillTrustSignals();
|
|
232
|
+
const commitSignals = collectCommitSignals(WEEKLY_WINDOW_DAYS);
|
|
233
|
+
const blockers = buildBlockers(qualityTrendReport, skillTrustSignals, commitSignals);
|
|
234
|
+
|
|
235
|
+
const weeklyReportSnapshot = {
|
|
236
|
+
generatedAt: new Date().toISOString(),
|
|
237
|
+
reportName: 'weekly-governance-report',
|
|
238
|
+
methodology: {
|
|
239
|
+
qualityTrendSource: qualityTrendState.source,
|
|
240
|
+
qualityTrendGeneratedAt: qualityTrendState.freshness,
|
|
241
|
+
commitWindowDays: WEEKLY_WINDOW_DAYS,
|
|
242
|
+
requiredVerifiedDomains: Array.from(REQUIRED_VERIFIED_DOMAINS),
|
|
243
|
+
},
|
|
244
|
+
qualitySignals: {
|
|
245
|
+
governanceHealth: {
|
|
246
|
+
availableGateCount: qualityTrendReport?.governanceHealth?.availableGateCount ?? null,
|
|
247
|
+
passedGateCount: qualityTrendReport?.governanceHealth?.passedGateCount ?? null,
|
|
248
|
+
gatePassRatePercent: qualityTrendReport?.governanceHealth?.gatePassRatePercent ?? null,
|
|
249
|
+
},
|
|
250
|
+
rejectionCategories: Array.isArray(qualityTrendReport?.rejectionCategories)
|
|
251
|
+
? qualityTrendReport.rejectionCategories
|
|
252
|
+
: [],
|
|
253
|
+
tokenEfficiency: qualityTrendReport?.tokenEfficiency || null,
|
|
254
|
+
},
|
|
255
|
+
skillTrust: skillTrustSignals,
|
|
256
|
+
commitSignals,
|
|
257
|
+
releaseReadiness: {
|
|
258
|
+
isReady: blockers.length === 0,
|
|
259
|
+
blockers,
|
|
260
|
+
summary: blockers.length === 0
|
|
261
|
+
? 'Weekly governance posture is ready for maintenance releases.'
|
|
262
|
+
: 'Weekly governance posture is blocked by unresolved readiness signals.',
|
|
263
|
+
},
|
|
264
|
+
artifact: {
|
|
265
|
+
path: REPORT_PATH,
|
|
266
|
+
writeMode: isStdoutOnlyMode ? 'stdout-only' : 'stdout-and-file',
|
|
267
|
+
},
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
const previousReport = readJsonOrNull(REPORT_PATH);
|
|
271
|
+
const history = mergeHistory(previousReport, buildHistoryEntry(weeklyReportSnapshot));
|
|
272
|
+
const weeklyReport = {
|
|
273
|
+
...weeklyReportSnapshot,
|
|
274
|
+
history,
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
if (!isStdoutOnlyMode) {
|
|
278
|
+
await fs.mkdir(dirname(REPORT_PATH), { recursive: true });
|
|
279
|
+
await fs.writeFile(REPORT_PATH, JSON.stringify(weeklyReport, null, 2) + '\n', 'utf8');
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
return weeklyReport;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
runWeeklyGovernanceReport()
|
|
286
|
+
.then((weeklyReport) => {
|
|
287
|
+
console.log(JSON.stringify(weeklyReport, null, 2));
|
|
288
|
+
})
|
|
289
|
+
.catch((reportError) => {
|
|
290
|
+
const errorMessage = reportError instanceof Error ? reportError.message : String(reportError);
|
|
291
|
+
console.error(`Weekly governance report failed: ${errorMessage}`);
|
|
292
|
+
process.exit(1);
|
|
293
|
+
});
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* quality-trend-report.mjs
|
|
5
|
+
*
|
|
6
|
+
* Generates a machine-readable quality trend artifact that summarizes
|
|
7
|
+
* governance gate pass rates, rejection categories, rollback frequency,
|
|
8
|
+
* and token-efficiency signals.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
12
|
+
import fs from 'node:fs/promises';
|
|
13
|
+
import { spawnSync } from 'node:child_process';
|
|
14
|
+
import { dirname, join, resolve } from 'node:path';
|
|
15
|
+
import { fileURLToPath } from 'node:url';
|
|
16
|
+
|
|
17
|
+
const SCRIPT_FILE_PATH = fileURLToPath(import.meta.url);
|
|
18
|
+
const SCRIPT_DIR = dirname(SCRIPT_FILE_PATH);
|
|
19
|
+
const REPOSITORY_ROOT = resolve(SCRIPT_DIR, '..');
|
|
20
|
+
const REPORT_PATH = join(REPOSITORY_ROOT, '.agent-context', 'state', 'quality-trend-report.json');
|
|
21
|
+
const TOKEN_BENCHMARK_PATH = join(REPOSITORY_ROOT, '.agent-context', 'state', 'token-optimization-benchmark.json');
|
|
22
|
+
const ARGUMENT_FLAGS = new Set(process.argv.slice(2));
|
|
23
|
+
const isStdoutOnlyMode = ARGUMENT_FLAGS.has('--stdout-only');
|
|
24
|
+
const MAX_SNAPSHOT_HISTORY = 30;
|
|
25
|
+
const ROLLBACK_WINDOW_DAYS = 30;
|
|
26
|
+
|
|
27
|
+
function runJsonScript(scriptRelativePath) {
|
|
28
|
+
const absoluteScriptPath = join(REPOSITORY_ROOT, scriptRelativePath);
|
|
29
|
+
const commandResult = spawnSync('node', [absoluteScriptPath], {
|
|
30
|
+
cwd: REPOSITORY_ROOT,
|
|
31
|
+
encoding: 'utf8',
|
|
32
|
+
maxBuffer: 1024 * 1024 * 10,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const standardOutput = (commandResult.stdout || '').trim();
|
|
36
|
+
const standardError = (commandResult.stderr || '').trim();
|
|
37
|
+
const exitCode = typeof commandResult.status === 'number' ? commandResult.status : 1;
|
|
38
|
+
|
|
39
|
+
if (!standardOutput) {
|
|
40
|
+
return {
|
|
41
|
+
scriptPath: scriptRelativePath,
|
|
42
|
+
exitCode,
|
|
43
|
+
parsedReport: null,
|
|
44
|
+
parseError: 'Script produced no stdout JSON payload',
|
|
45
|
+
stderr: standardError,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
const parsedReport = JSON.parse(standardOutput);
|
|
51
|
+
return {
|
|
52
|
+
scriptPath: scriptRelativePath,
|
|
53
|
+
exitCode,
|
|
54
|
+
parsedReport,
|
|
55
|
+
parseError: null,
|
|
56
|
+
stderr: standardError,
|
|
57
|
+
};
|
|
58
|
+
} catch (jsonParseError) {
|
|
59
|
+
const errorMessage = jsonParseError instanceof Error ? jsonParseError.message : String(jsonParseError);
|
|
60
|
+
return {
|
|
61
|
+
scriptPath: scriptRelativePath,
|
|
62
|
+
exitCode,
|
|
63
|
+
parsedReport: null,
|
|
64
|
+
parseError: errorMessage,
|
|
65
|
+
stderr: standardError,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function readJsonFileOrNull(filePath) {
|
|
71
|
+
if (!existsSync(filePath)) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
try {
|
|
76
|
+
return JSON.parse(readFileSync(filePath, 'utf8'));
|
|
77
|
+
} catch {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function summarizeGateExecution(gateExecutionResults) {
|
|
83
|
+
const gateSummaries = gateExecutionResults.map((gateExecutionResult) => {
|
|
84
|
+
const gateReport = gateExecutionResult.parsedReport;
|
|
85
|
+
return {
|
|
86
|
+
scriptPath: gateExecutionResult.scriptPath,
|
|
87
|
+
gateName: gateReport?.gateName || gateReport?.reportName || gateExecutionResult.scriptPath,
|
|
88
|
+
exitCode: gateExecutionResult.exitCode,
|
|
89
|
+
passed: typeof gateReport?.passed === 'boolean' ? gateReport.passed : false,
|
|
90
|
+
parseError: gateExecutionResult.parseError,
|
|
91
|
+
failureCount: typeof gateReport?.failureCount === 'number' ? gateReport.failureCount : null,
|
|
92
|
+
generatedAt: gateReport?.generatedAt || null,
|
|
93
|
+
};
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
const availableGateCount = gateSummaries.length;
|
|
97
|
+
const passedGateCount = gateSummaries.filter((gateSummary) => gateSummary.passed).length;
|
|
98
|
+
const gatePassRatePercent = availableGateCount === 0
|
|
99
|
+
? 0
|
|
100
|
+
: Number(((passedGateCount / availableGateCount) * 100).toFixed(2));
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
gateSummaries,
|
|
104
|
+
availableGateCount,
|
|
105
|
+
passedGateCount,
|
|
106
|
+
gatePassRatePercent,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function collectRejectionCategories(gateExecutionResults) {
|
|
111
|
+
const rejectionCategoryMap = new Map();
|
|
112
|
+
|
|
113
|
+
for (const gateExecutionResult of gateExecutionResults) {
|
|
114
|
+
const gateReport = gateExecutionResult.parsedReport;
|
|
115
|
+
const gateName = gateReport?.gateName || gateReport?.reportName || gateExecutionResult.scriptPath;
|
|
116
|
+
const gateResults = Array.isArray(gateReport?.results) ? gateReport.results : [];
|
|
117
|
+
|
|
118
|
+
for (const checkResult of gateResults) {
|
|
119
|
+
if (checkResult?.passed === true) {
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const checkName = typeof checkResult?.checkName === 'string' ? checkResult.checkName : 'unknown-check';
|
|
124
|
+
const existingCategory = rejectionCategoryMap.get(checkName) || {
|
|
125
|
+
checkName,
|
|
126
|
+
count: 0,
|
|
127
|
+
gates: new Set(),
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
existingCategory.count += 1;
|
|
131
|
+
existingCategory.gates.add(gateName);
|
|
132
|
+
rejectionCategoryMap.set(checkName, existingCategory);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return Array.from(rejectionCategoryMap.values())
|
|
137
|
+
.map((rejectionCategory) => ({
|
|
138
|
+
checkName: rejectionCategory.checkName,
|
|
139
|
+
count: rejectionCategory.count,
|
|
140
|
+
gates: Array.from(rejectionCategory.gates),
|
|
141
|
+
}))
|
|
142
|
+
.sort((firstCategory, secondCategory) => secondCategory.count - firstCategory.count);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function calculateRollbackFrequencySnapshot() {
|
|
146
|
+
const gitLogResult = spawnSync('git', ['log', `--since=${ROLLBACK_WINDOW_DAYS}.days`, '--pretty=format:%s'], {
|
|
147
|
+
cwd: REPOSITORY_ROOT,
|
|
148
|
+
encoding: 'utf8',
|
|
149
|
+
maxBuffer: 1024 * 1024,
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
if (gitLogResult.status !== 0) {
|
|
153
|
+
return {
|
|
154
|
+
windowDays: ROLLBACK_WINDOW_DAYS,
|
|
155
|
+
commitCount: 0,
|
|
156
|
+
rollbackCommitCount: 0,
|
|
157
|
+
rollbackFrequencyPercent: null,
|
|
158
|
+
source: 'git-log',
|
|
159
|
+
error: (gitLogResult.stderr || 'Failed to read git log').trim(),
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const commitSubjects = (gitLogResult.stdout || '')
|
|
164
|
+
.split(/\r?\n/u)
|
|
165
|
+
.map((subjectLine) => subjectLine.trim())
|
|
166
|
+
.filter((subjectLine) => subjectLine.length > 0);
|
|
167
|
+
|
|
168
|
+
const rollbackCommitCount = commitSubjects.filter((subjectLine) => /rollback/i.test(subjectLine)).length;
|
|
169
|
+
const commitCount = commitSubjects.length;
|
|
170
|
+
const rollbackFrequencyPercent = commitCount === 0
|
|
171
|
+
? 0
|
|
172
|
+
: Number(((rollbackCommitCount / commitCount) * 100).toFixed(2));
|
|
173
|
+
|
|
174
|
+
return {
|
|
175
|
+
windowDays: ROLLBACK_WINDOW_DAYS,
|
|
176
|
+
commitCount,
|
|
177
|
+
rollbackCommitCount,
|
|
178
|
+
rollbackFrequencyPercent,
|
|
179
|
+
source: 'git-log',
|
|
180
|
+
error: null,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function summarizeTokenBenchmark() {
|
|
185
|
+
const tokenBenchmarkReport = readJsonFileOrNull(TOKEN_BENCHMARK_PATH);
|
|
186
|
+
if (!tokenBenchmarkReport) {
|
|
187
|
+
return {
|
|
188
|
+
isAvailable: false,
|
|
189
|
+
generatedAt: null,
|
|
190
|
+
averageNativeSavingsPercent: null,
|
|
191
|
+
averageRtkSavingsPercent: null,
|
|
192
|
+
scenarioCount: 0,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return {
|
|
197
|
+
isAvailable: true,
|
|
198
|
+
generatedAt: tokenBenchmarkReport.generatedAt || null,
|
|
199
|
+
averageNativeSavingsPercent: tokenBenchmarkReport.summary?.averageNativeSavingsPercent ?? null,
|
|
200
|
+
averageRtkSavingsPercent: tokenBenchmarkReport.summary?.averageRtkSavingsPercent ?? null,
|
|
201
|
+
scenarioCount: Array.isArray(tokenBenchmarkReport.scenarios) ? tokenBenchmarkReport.scenarios.length : 0,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function loadPreviousTrendHistory() {
|
|
206
|
+
const previousReport = readJsonFileOrNull(REPORT_PATH);
|
|
207
|
+
if (!previousReport || !Array.isArray(previousReport.history)) {
|
|
208
|
+
return [];
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return previousReport.history;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function buildHistoryEntry(currentSnapshot) {
|
|
215
|
+
return {
|
|
216
|
+
generatedAt: currentSnapshot.generatedAt,
|
|
217
|
+
gatePassRatePercent: currentSnapshot.governanceHealth.gatePassRatePercent,
|
|
218
|
+
passedGateCount: currentSnapshot.governanceHealth.passedGateCount,
|
|
219
|
+
availableGateCount: currentSnapshot.governanceHealth.availableGateCount,
|
|
220
|
+
rollbackFrequencyPercent: currentSnapshot.rollbackSignals.rollbackFrequencyPercent,
|
|
221
|
+
averageNativeSavingsPercent: currentSnapshot.tokenEfficiency.averageNativeSavingsPercent,
|
|
222
|
+
averageRtkSavingsPercent: currentSnapshot.tokenEfficiency.averageRtkSavingsPercent,
|
|
223
|
+
rejectionCategoryCount: currentSnapshot.rejectionCategories.length,
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function mergeHistory(previousHistoryEntries, currentHistoryEntry) {
|
|
228
|
+
const mergedHistoryEntries = [...previousHistoryEntries, currentHistoryEntry];
|
|
229
|
+
if (mergedHistoryEntries.length <= MAX_SNAPSHOT_HISTORY) {
|
|
230
|
+
return mergedHistoryEntries;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return mergedHistoryEntries.slice(mergedHistoryEntries.length - MAX_SNAPSHOT_HISTORY);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
async function runQualityTrendReport() {
|
|
237
|
+
const releaseGateExecution = runJsonScript('scripts/release-gate.mjs');
|
|
238
|
+
const benchmarkGateExecution = runJsonScript('scripts/benchmark-gate.mjs');
|
|
239
|
+
const benchmarkIntelligenceExecution = runJsonScript('scripts/benchmark-intelligence.mjs');
|
|
240
|
+
const gateExecutionResults = [releaseGateExecution, benchmarkGateExecution, benchmarkIntelligenceExecution];
|
|
241
|
+
|
|
242
|
+
const governanceHealth = summarizeGateExecution(gateExecutionResults);
|
|
243
|
+
const rejectionCategories = collectRejectionCategories(gateExecutionResults);
|
|
244
|
+
const rollbackSignals = calculateRollbackFrequencySnapshot();
|
|
245
|
+
const tokenEfficiency = summarizeTokenBenchmark();
|
|
246
|
+
|
|
247
|
+
const qualityTrendSnapshot = {
|
|
248
|
+
generatedAt: new Date().toISOString(),
|
|
249
|
+
reportName: 'quality-trend-report',
|
|
250
|
+
methodology: {
|
|
251
|
+
gateSources: gateExecutionResults.map((gateExecutionResult) => gateExecutionResult.scriptPath),
|
|
252
|
+
rollbackSource: 'git log commit subjects within 30-day window',
|
|
253
|
+
tokenSource: '.agent-context/state/token-optimization-benchmark.json',
|
|
254
|
+
},
|
|
255
|
+
governanceHealth,
|
|
256
|
+
rejectionCategories,
|
|
257
|
+
rollbackSignals,
|
|
258
|
+
tokenEfficiency,
|
|
259
|
+
artifact: {
|
|
260
|
+
path: REPORT_PATH,
|
|
261
|
+
writeMode: isStdoutOnlyMode ? 'stdout-only' : 'stdout-and-file',
|
|
262
|
+
},
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
const previousHistoryEntries = loadPreviousTrendHistory();
|
|
266
|
+
const currentHistoryEntry = buildHistoryEntry(qualityTrendSnapshot);
|
|
267
|
+
const history = mergeHistory(previousHistoryEntries, currentHistoryEntry);
|
|
268
|
+
const qualityTrendReport = {
|
|
269
|
+
...qualityTrendSnapshot,
|
|
270
|
+
history,
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
if (!isStdoutOnlyMode) {
|
|
274
|
+
await fs.mkdir(dirname(REPORT_PATH), { recursive: true });
|
|
275
|
+
await fs.writeFile(REPORT_PATH, JSON.stringify(qualityTrendReport, null, 2) + '\n', 'utf8');
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
return qualityTrendReport;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
runQualityTrendReport()
|
|
282
|
+
.then((qualityTrendReport) => {
|
|
283
|
+
console.log(JSON.stringify(qualityTrendReport, null, 2));
|
|
284
|
+
})
|
|
285
|
+
.catch((qualityTrendError) => {
|
|
286
|
+
const errorMessage = qualityTrendError instanceof Error ? qualityTrendError.message : String(qualityTrendError);
|
|
287
|
+
console.error(`Quality trend report failed: ${errorMessage}`);
|
|
288
|
+
process.exit(1);
|
|
289
|
+
});
|
package/scripts/release-gate.mjs
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
import { existsSync, readFileSync } from 'node:fs';
|
|
11
11
|
import { resolve, dirname } from 'node:path';
|
|
12
12
|
import { fileURLToPath } from 'node:url';
|
|
13
|
+
import { execFileSync } from 'node:child_process';
|
|
13
14
|
|
|
14
15
|
const __filename = fileURLToPath(import.meta.url);
|
|
15
16
|
const __dirname = dirname(__filename);
|
|
@@ -26,6 +27,15 @@ const REQUIRED_SKILL_DOMAINS = [
|
|
|
26
27
|
'distribution',
|
|
27
28
|
'review-quality',
|
|
28
29
|
];
|
|
30
|
+
const FRONTEND_PARITY_CHECKLIST_PATH = '.agent-context/review-checklists/frontend-skill-parity.md';
|
|
31
|
+
const FRONTEND_AUDIT_SCRIPT_PATH = 'scripts/frontend-usability-audit.mjs';
|
|
32
|
+
const REQUIRED_FRONTEND_PARITY_SNIPPETS = [
|
|
33
|
+
'Architecture and Composition',
|
|
34
|
+
'Interaction and Motion',
|
|
35
|
+
'Accessibility and Responsiveness',
|
|
36
|
+
'UX Narrative and Conversion Clarity',
|
|
37
|
+
'Release Evidence',
|
|
38
|
+
];
|
|
29
39
|
|
|
30
40
|
function readText(relativeFilePath) {
|
|
31
41
|
const absolutePath = resolve(REPOSITORY_ROOT, relativeFilePath);
|
|
@@ -124,6 +134,8 @@ function runReleaseGate() {
|
|
|
124
134
|
'docs/v1.8-operations-playbook.md',
|
|
125
135
|
'.github/workflows/release-gate.yml',
|
|
126
136
|
'.github/workflows/sbom-compliance.yml',
|
|
137
|
+
'.github/workflows/governance-weekly-report.yml',
|
|
138
|
+
'scripts/governance-weekly-report.mjs',
|
|
127
139
|
];
|
|
128
140
|
|
|
129
141
|
for (const requiredEnterpriseFile of requiredEnterpriseFiles) {
|
|
@@ -188,6 +200,51 @@ function runReleaseGate() {
|
|
|
188
200
|
);
|
|
189
201
|
}
|
|
190
202
|
|
|
203
|
+
const frontendParityChecklistContent = readText(FRONTEND_PARITY_CHECKLIST_PATH);
|
|
204
|
+
if (!frontendParityChecklistContent) {
|
|
205
|
+
pushResult(results, false, 'frontend-parity-checklist-exists', `Missing ${FRONTEND_PARITY_CHECKLIST_PATH}`);
|
|
206
|
+
} else {
|
|
207
|
+
pushResult(results, true, 'frontend-parity-checklist-exists', `${FRONTEND_PARITY_CHECKLIST_PATH} is present`);
|
|
208
|
+
|
|
209
|
+
const missingFrontendParitySnippets = REQUIRED_FRONTEND_PARITY_SNIPPETS.filter(
|
|
210
|
+
(requiredSnippet) => !frontendParityChecklistContent.includes(requiredSnippet)
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
if (missingFrontendParitySnippets.length === 0) {
|
|
214
|
+
pushResult(results, true, 'frontend-parity-checklist-coverage', 'Frontend parity checklist sections are complete');
|
|
215
|
+
} else {
|
|
216
|
+
pushResult(
|
|
217
|
+
results,
|
|
218
|
+
false,
|
|
219
|
+
'frontend-parity-checklist-coverage',
|
|
220
|
+
`Missing frontend parity checklist sections: ${missingFrontendParitySnippets.join(', ')}`
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
try {
|
|
226
|
+
const frontendAuditRawOutput = execFileSync('node', [FRONTEND_AUDIT_SCRIPT_PATH], {
|
|
227
|
+
cwd: REPOSITORY_ROOT,
|
|
228
|
+
encoding: 'utf8',
|
|
229
|
+
maxBuffer: 1024 * 1024,
|
|
230
|
+
});
|
|
231
|
+
const frontendAuditReport = JSON.parse(frontendAuditRawOutput);
|
|
232
|
+
|
|
233
|
+
if (frontendAuditReport.passed === true) {
|
|
234
|
+
pushResult(results, true, 'frontend-usability-audit', 'frontend-usability-audit report passed');
|
|
235
|
+
} else {
|
|
236
|
+
const failureDetails = Array.isArray(frontendAuditReport.failures)
|
|
237
|
+
? frontendAuditReport.failures.join('; ')
|
|
238
|
+
: 'Unknown frontend audit failures';
|
|
239
|
+
pushResult(results, false, 'frontend-usability-audit', `frontend-usability-audit reported failures: ${failureDetails}`);
|
|
240
|
+
}
|
|
241
|
+
} catch (frontendAuditError) {
|
|
242
|
+
const frontendAuditErrorMessage = frontendAuditError instanceof Error
|
|
243
|
+
? frontendAuditError.message
|
|
244
|
+
: 'Unknown frontend audit execution error';
|
|
245
|
+
pushResult(results, false, 'frontend-usability-audit', `Failed to execute frontend usability audit: ${frontendAuditErrorMessage}`);
|
|
246
|
+
}
|
|
247
|
+
|
|
191
248
|
const failureCount = results.filter((checkResult) => !checkResult.passed).length;
|
|
192
249
|
const releaseGateReport = {
|
|
193
250
|
generatedAt: new Date().toISOString(),
|