@ryuenn3123/agentic-senior-core 3.0.17 → 3.0.19
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/prompts/bootstrap-design.md +16 -7
- package/.agent-context/rules/frontend-architecture.md +5 -5
- package/.agent-context/state/memory-continuity-benchmark.json +1 -1
- package/.cursorrules +1 -1
- package/.gemini/instructions.md +1 -1
- package/.github/copilot-instructions.md +1 -1
- package/.instructions.md +1 -1
- package/.windsurfrules +1 -1
- package/AGENTS.md +1 -1
- package/lib/cli/project-scaffolder/design-contract.mjs +363 -314
- package/lib/cli/project-scaffolder/prompt-builders.mjs +28 -22
- package/lib/cli/project-scaffolder/storage.mjs +0 -2
- package/package.json +2 -2
- package/scripts/frontend-usability-audit.mjs +19 -8
- package/scripts/mcp-server/constants.mjs +60 -0
- package/scripts/mcp-server/tool-registry.mjs +149 -0
- package/scripts/mcp-server/tools.mjs +446 -0
- package/scripts/mcp-server.mjs +23 -661
- package/scripts/release-gate/audit-checks.mjs +426 -0
- package/scripts/release-gate/constants.mjs +53 -0
- package/scripts/release-gate/runtime.mjs +63 -0
- package/scripts/release-gate/static-checks.mjs +182 -0
- package/scripts/release-gate.mjs +12 -793
- package/scripts/ui-design-judge/constants.mjs +24 -0
- package/scripts/ui-design-judge/design-execution-summary.mjs +233 -0
- package/scripts/ui-design-judge/git-input.mjs +131 -0
- package/scripts/ui-design-judge/prompting.mjs +73 -0
- package/scripts/ui-design-judge/providers.mjs +102 -0
- package/scripts/ui-design-judge/reporting.mjs +181 -0
- package/scripts/ui-design-judge/rubric-calibration.mjs +211 -0
- package/scripts/ui-design-judge/rubric-goldset.json +188 -0
- package/scripts/ui-design-judge.mjs +105 -774
- package/scripts/ui-rubric-calibration.mjs +35 -0
- package/scripts/validate/config.mjs +69 -16
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import { execFileSync } from 'node:child_process';
|
|
4
|
+
import {
|
|
5
|
+
AUTO_DOCS_SYNC_SCOPE_BOUNDARIES,
|
|
6
|
+
AUTO_DOCS_SYNC_SCOPE_PHASE,
|
|
7
|
+
BENCHMARK_GATE_SCRIPT_PATH,
|
|
8
|
+
CONTEXT_TRIGGERED_AUDIT_SCRIPT_PATH,
|
|
9
|
+
DOCUMENTATION_BOUNDARY_AUDIT_SCRIPT_PATH,
|
|
10
|
+
EXPLAIN_ON_DEMAND_AUDIT_SCRIPT_PATH,
|
|
11
|
+
FRONTEND_AUDIT_SCRIPT_PATH,
|
|
12
|
+
REPOSITORY_ROOT,
|
|
13
|
+
RULES_GUARDIAN_AUDIT_SCRIPT_PATH,
|
|
14
|
+
SINGLE_SOURCE_LAZY_LOADING_AUDIT_SCRIPT_PATH,
|
|
15
|
+
UI_DESIGN_JUDGE_SCRIPT_PATH,
|
|
16
|
+
} from './constants.mjs';
|
|
17
|
+
import { pushResult, runMachineReadableScript } from './runtime.mjs';
|
|
18
|
+
|
|
19
|
+
export function runAuditReleaseChecks(results, diagnostics) {
|
|
20
|
+
const documentationBoundaryAuditExecution = runMachineReadableScript(DOCUMENTATION_BOUNDARY_AUDIT_SCRIPT_PATH);
|
|
21
|
+
if (!documentationBoundaryAuditExecution.report) {
|
|
22
|
+
const failureDetails = documentationBoundaryAuditExecution.executionErrorMessage
|
|
23
|
+
? `Documentation boundary audit execution failed before producing a machine-readable report: ${documentationBoundaryAuditExecution.executionErrorMessage}`
|
|
24
|
+
: 'Documentation boundary audit did not produce machine-readable JSON output';
|
|
25
|
+
pushResult(results, false, 'documentation-boundary-audit', failureDetails);
|
|
26
|
+
} else {
|
|
27
|
+
diagnostics.documentationBoundaryAudit = documentationBoundaryAuditExecution.report;
|
|
28
|
+
pushResult(
|
|
29
|
+
results,
|
|
30
|
+
true,
|
|
31
|
+
'documentation-boundary-audit',
|
|
32
|
+
`documentation-boundary-audit executed (passed=${documentationBoundaryAuditExecution.report.passed}, failures=${documentationBoundaryAuditExecution.report.failureCount})`
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const hasMachineReadableBoundaryDiagnostics = typeof documentationBoundaryAuditExecution.report?.reportVersion === 'string'
|
|
36
|
+
&& Array.isArray(documentationBoundaryAuditExecution.report?.boundaryResults)
|
|
37
|
+
&& Array.isArray(documentationBoundaryAuditExecution.report?.violations)
|
|
38
|
+
&& documentationBoundaryAuditExecution.report.boundaryResults.every((boundaryResult) => (
|
|
39
|
+
typeof boundaryResult?.boundaryName === 'string'
|
|
40
|
+
&& typeof boundaryResult?.requirement === 'string'
|
|
41
|
+
&& Array.isArray(boundaryResult?.expectedDocumentationPaths)
|
|
42
|
+
&& Array.isArray(boundaryResult?.suggestedActions)
|
|
43
|
+
));
|
|
44
|
+
|
|
45
|
+
if (hasMachineReadableBoundaryDiagnostics) {
|
|
46
|
+
pushResult(
|
|
47
|
+
results,
|
|
48
|
+
true,
|
|
49
|
+
'documentation-boundary-diagnostics-machine-readable',
|
|
50
|
+
`Boundary diagnostics are machine-readable and actionable (reportVersion=${documentationBoundaryAuditExecution.report.reportVersion})`
|
|
51
|
+
);
|
|
52
|
+
} else {
|
|
53
|
+
pushResult(
|
|
54
|
+
results,
|
|
55
|
+
false,
|
|
56
|
+
'documentation-boundary-diagnostics-machine-readable',
|
|
57
|
+
'Documentation boundary diagnostics are missing required machine-readable actionable fields'
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const reportScope = documentationBoundaryAuditExecution.report?.autoDocsSyncScope;
|
|
62
|
+
const explicitBoundaries = Array.isArray(reportScope?.explicitBoundaries)
|
|
63
|
+
? reportScope.explicitBoundaries
|
|
64
|
+
: [];
|
|
65
|
+
const isPhaseOneScopeBounded = reportScope?.phase === AUTO_DOCS_SYNC_SCOPE_PHASE
|
|
66
|
+
&& reportScope?.bounded === true
|
|
67
|
+
&& AUTO_DOCS_SYNC_SCOPE_BOUNDARIES.every((boundaryName) => explicitBoundaries.includes(boundaryName));
|
|
68
|
+
|
|
69
|
+
if (isPhaseOneScopeBounded) {
|
|
70
|
+
pushResult(
|
|
71
|
+
results,
|
|
72
|
+
true,
|
|
73
|
+
'auto-docs-sync-scope-phase1',
|
|
74
|
+
`Auto-doc sync scope is explicitly bounded to phase-1 boundaries (${explicitBoundaries.join(', ')})`
|
|
75
|
+
);
|
|
76
|
+
} else {
|
|
77
|
+
pushResult(
|
|
78
|
+
results,
|
|
79
|
+
false,
|
|
80
|
+
'auto-docs-sync-scope-phase1',
|
|
81
|
+
'Auto-doc sync scope is missing explicit phase-1 boundary metadata'
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const rolloutMetrics = documentationBoundaryAuditExecution.report?.rolloutMetrics;
|
|
86
|
+
const hasValidPrecision = typeof rolloutMetrics?.precision === 'number'
|
|
87
|
+
&& rolloutMetrics.precision >= 0
|
|
88
|
+
&& rolloutMetrics.precision <= 1;
|
|
89
|
+
const hasValidRecall = typeof rolloutMetrics?.recall === 'number'
|
|
90
|
+
&& rolloutMetrics.recall >= 0
|
|
91
|
+
&& rolloutMetrics.recall <= 1;
|
|
92
|
+
const hasTimestampedEvidence = typeof rolloutMetrics?.measuredAt === 'string'
|
|
93
|
+
&& rolloutMetrics.measuredAt.length > 0;
|
|
94
|
+
|
|
95
|
+
if (hasValidPrecision && hasValidRecall && hasTimestampedEvidence) {
|
|
96
|
+
pushResult(
|
|
97
|
+
results,
|
|
98
|
+
true,
|
|
99
|
+
'auto-docs-sync-rollout-metrics',
|
|
100
|
+
`Auto-doc sync rollout metrics are present (precision=${rolloutMetrics.precision.toFixed(4)}, recall=${rolloutMetrics.recall.toFixed(4)})`
|
|
101
|
+
);
|
|
102
|
+
} else {
|
|
103
|
+
pushResult(
|
|
104
|
+
results,
|
|
105
|
+
false,
|
|
106
|
+
'auto-docs-sync-rollout-metrics',
|
|
107
|
+
'Auto-doc sync rollout metrics are missing precision/recall or timestamped evidence'
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (documentationBoundaryAuditExecution.report.passed === true) {
|
|
112
|
+
pushResult(results, true, 'documentation-boundary-hard-rule', 'Documentation hard-rule passed for all triggered boundaries');
|
|
113
|
+
} else {
|
|
114
|
+
const failedDocumentationBoundaries = Array.isArray(documentationBoundaryAuditExecution.report.violations)
|
|
115
|
+
? documentationBoundaryAuditExecution.report.violations.map((violation) => {
|
|
116
|
+
const failureCode = violation?.diagnosticCode || 'BOUNDARY_DOCS_SYNC_REQUIRED';
|
|
117
|
+
const changedFiles = Array.isArray(violation?.changedFiles) && violation.changedFiles.length > 0
|
|
118
|
+
? violation.changedFiles.join(', ')
|
|
119
|
+
: 'unknown-changed-files';
|
|
120
|
+
const suggestion = Array.isArray(violation?.suggestedActions) && violation.suggestedActions.length > 0
|
|
121
|
+
? violation.suggestedActions[0]
|
|
122
|
+
: 'Update matching boundary documentation in the same scope.';
|
|
123
|
+
return `${failureCode} (${violation?.boundaryName || 'unknown-boundary'}): ${changedFiles}. Action: ${suggestion}`;
|
|
124
|
+
})
|
|
125
|
+
: Array.isArray(documentationBoundaryAuditExecution.report.failures)
|
|
126
|
+
? documentationBoundaryAuditExecution.report.failures
|
|
127
|
+
: [];
|
|
128
|
+
const failureSummary = failedDocumentationBoundaries.length > 0
|
|
129
|
+
? failedDocumentationBoundaries.join('; ')
|
|
130
|
+
: '';
|
|
131
|
+
pushResult(
|
|
132
|
+
results,
|
|
133
|
+
false,
|
|
134
|
+
'documentation-boundary-hard-rule',
|
|
135
|
+
`Documentation hard-rule failed: ${failureSummary || 'Documentation boundary audit failed without boundary failure details'}`
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const contextTriggeredAuditExecution = runMachineReadableScript(
|
|
141
|
+
CONTEXT_TRIGGERED_AUDIT_SCRIPT_PATH,
|
|
142
|
+
['--workflow', 'pr-preparation']
|
|
143
|
+
);
|
|
144
|
+
if (!contextTriggeredAuditExecution.report) {
|
|
145
|
+
const failureDetails = contextTriggeredAuditExecution.executionErrorMessage
|
|
146
|
+
? `Context-triggered audit execution failed before producing a machine-readable report: ${contextTriggeredAuditExecution.executionErrorMessage}`
|
|
147
|
+
: 'Context-triggered audit did not produce machine-readable JSON output';
|
|
148
|
+
pushResult(results, false, 'context-triggered-audit', failureDetails);
|
|
149
|
+
} else {
|
|
150
|
+
diagnostics.contextTriggeredAudit = contextTriggeredAuditExecution.report;
|
|
151
|
+
pushResult(
|
|
152
|
+
results,
|
|
153
|
+
true,
|
|
154
|
+
'context-triggered-audit',
|
|
155
|
+
`context-triggered-audit executed (passed=${contextTriggeredAuditExecution.report.passed}, strict=${contextTriggeredAuditExecution.report.strictAuditMode}, failures=${contextTriggeredAuditExecution.report.failureCount})`
|
|
156
|
+
);
|
|
157
|
+
pushResult(
|
|
158
|
+
results,
|
|
159
|
+
contextTriggeredAuditExecution.report.strictAuditMode === true,
|
|
160
|
+
'context-triggered-strict-mode-auto',
|
|
161
|
+
contextTriggeredAuditExecution.report.strictAuditMode === true
|
|
162
|
+
? `Strict audit mode activated automatically for workflow=${contextTriggeredAuditExecution.report.workflow}`
|
|
163
|
+
: `Strict audit mode was not activated for workflow=${contextTriggeredAuditExecution.report.workflow}`
|
|
164
|
+
);
|
|
165
|
+
pushResult(
|
|
166
|
+
results,
|
|
167
|
+
contextTriggeredAuditExecution.report.passed === true,
|
|
168
|
+
'context-triggered-security-performance-hard-rule',
|
|
169
|
+
contextTriggeredAuditExecution.report.passed === true
|
|
170
|
+
? 'Context-triggered security and performance audit hard-rule passed'
|
|
171
|
+
: `Context-triggered audit failed: ${Array.isArray(contextTriggeredAuditExecution.report.failures) ? contextTriggeredAuditExecution.report.failures.join('; ') : 'Unknown context-triggered audit failures'}`
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const rulesGuardianAuditExecution = runMachineReadableScript(
|
|
176
|
+
RULES_GUARDIAN_AUDIT_SCRIPT_PATH,
|
|
177
|
+
['--workflow', 'pr-preparation']
|
|
178
|
+
);
|
|
179
|
+
if (!rulesGuardianAuditExecution.report) {
|
|
180
|
+
const failureDetails = rulesGuardianAuditExecution.executionErrorMessage
|
|
181
|
+
? `Rules guardian audit execution failed before producing a machine-readable report: ${rulesGuardianAuditExecution.executionErrorMessage}`
|
|
182
|
+
: 'Rules guardian audit did not produce machine-readable JSON output';
|
|
183
|
+
pushResult(results, false, 'rules-guardian-audit', failureDetails);
|
|
184
|
+
} else {
|
|
185
|
+
diagnostics.rulesGuardianAudit = rulesGuardianAuditExecution.report;
|
|
186
|
+
pushResult(
|
|
187
|
+
results,
|
|
188
|
+
true,
|
|
189
|
+
'rules-guardian-audit',
|
|
190
|
+
`rules-guardian-audit executed (passed=${rulesGuardianAuditExecution.report.passed}, driftDetected=${rulesGuardianAuditExecution.report?.driftDetection?.driftDetected}, failures=${rulesGuardianAuditExecution.report.failureCount})`
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
const sessionHandoffSummary = rulesGuardianAuditExecution.report?.sessionHandoff?.contractSummary;
|
|
194
|
+
const sessionHandoffIncluded = rulesGuardianAuditExecution.report?.sessionHandoff?.included === true
|
|
195
|
+
&& typeof sessionHandoffSummary === 'string'
|
|
196
|
+
&& sessionHandoffSummary.trim().length > 0;
|
|
197
|
+
|
|
198
|
+
pushResult(
|
|
199
|
+
results,
|
|
200
|
+
sessionHandoffIncluded,
|
|
201
|
+
'rules-guardian-session-handoff',
|
|
202
|
+
sessionHandoffIncluded
|
|
203
|
+
? 'Session handoff includes active architecture contract summary'
|
|
204
|
+
: 'Rules guardian report is missing session handoff architecture contract summary'
|
|
205
|
+
);
|
|
206
|
+
|
|
207
|
+
const requiresExplicitConfirmation = rulesGuardianAuditExecution.report?.confirmationPolicy?.requiresExplicitUserConfirmation === true;
|
|
208
|
+
pushResult(
|
|
209
|
+
results,
|
|
210
|
+
requiresExplicitConfirmation,
|
|
211
|
+
'rules-guardian-confirmation-policy',
|
|
212
|
+
requiresExplicitConfirmation
|
|
213
|
+
? 'Direction change policy requires explicit user confirmation'
|
|
214
|
+
: 'Rules guardian report does not enforce explicit user confirmation policy'
|
|
215
|
+
);
|
|
216
|
+
pushResult(
|
|
217
|
+
results,
|
|
218
|
+
rulesGuardianAuditExecution.report.passed === true,
|
|
219
|
+
'rules-guardian-drift-confirmation',
|
|
220
|
+
rulesGuardianAuditExecution.report.passed === true
|
|
221
|
+
? 'Rules guardian drift detection and confirmation checks passed'
|
|
222
|
+
: `Rules guardian audit failed: ${Array.isArray(rulesGuardianAuditExecution.report.failures) ? rulesGuardianAuditExecution.report.failures.join('; ') : 'Unknown rules guardian audit failures'}`
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const explainOnDemandAuditExecution = runMachineReadableScript(
|
|
227
|
+
EXPLAIN_ON_DEMAND_AUDIT_SCRIPT_PATH,
|
|
228
|
+
['--mode', 'default', '--workflow', 'pr-preparation']
|
|
229
|
+
);
|
|
230
|
+
if (!explainOnDemandAuditExecution.report) {
|
|
231
|
+
const failureDetails = explainOnDemandAuditExecution.executionErrorMessage
|
|
232
|
+
? `Explain-on-demand audit execution failed before producing a machine-readable report: ${explainOnDemandAuditExecution.executionErrorMessage}`
|
|
233
|
+
: 'Explain-on-demand audit did not produce machine-readable JSON output';
|
|
234
|
+
pushResult(results, false, 'explain-on-demand-audit', failureDetails);
|
|
235
|
+
} else {
|
|
236
|
+
diagnostics.explainOnDemandAudit = explainOnDemandAuditExecution.report;
|
|
237
|
+
pushResult(
|
|
238
|
+
results,
|
|
239
|
+
true,
|
|
240
|
+
'explain-on-demand-audit',
|
|
241
|
+
`explain-on-demand-audit executed (passed=${explainOnDemandAuditExecution.report.passed}, mode=${explainOnDemandAuditExecution.report.mode}, failures=${explainOnDemandAuditExecution.report.failureCount})`
|
|
242
|
+
);
|
|
243
|
+
|
|
244
|
+
const defaultHiddenStatePolicyPassed = explainOnDemandAuditExecution.report?.responsePolicy?.defaultModeExposesStateInternals === false
|
|
245
|
+
&& explainOnDemandAuditExecution.report?.defaultResponse?.containsStateInternals === false;
|
|
246
|
+
pushResult(
|
|
247
|
+
results,
|
|
248
|
+
defaultHiddenStatePolicyPassed,
|
|
249
|
+
'explain-on-demand-default-hidden-state',
|
|
250
|
+
defaultHiddenStatePolicyPassed
|
|
251
|
+
? 'Default response mode hides unnecessary state-file internals'
|
|
252
|
+
: 'Default response mode exposes state internals or visibility flags are inconsistent'
|
|
253
|
+
);
|
|
254
|
+
|
|
255
|
+
const diagnosticExplicitRequestPolicyPassed = explainOnDemandAuditExecution.report?.responsePolicy?.diagnosticRequiresExplicitRequest === true;
|
|
256
|
+
pushResult(
|
|
257
|
+
results,
|
|
258
|
+
diagnosticExplicitRequestPolicyPassed,
|
|
259
|
+
'explain-on-demand-explicit-request-gate',
|
|
260
|
+
diagnosticExplicitRequestPolicyPassed
|
|
261
|
+
? 'State internals are gated behind explicit diagnostic request'
|
|
262
|
+
: 'Explain-on-demand policy does not require explicit diagnostic request'
|
|
263
|
+
);
|
|
264
|
+
|
|
265
|
+
const diagnosticExplainabilityPassed = explainOnDemandAuditExecution.report?.diagnosticMode?.canExplainStateDecisions === true;
|
|
266
|
+
pushResult(
|
|
267
|
+
results,
|
|
268
|
+
diagnosticExplainabilityPassed,
|
|
269
|
+
'explain-on-demand-diagnostic-explainability',
|
|
270
|
+
diagnosticExplainabilityPassed
|
|
271
|
+
? 'Diagnostic mode can explain relevant state decisions when requested'
|
|
272
|
+
: 'Explain-on-demand audit cannot provide diagnostic state decision explanations'
|
|
273
|
+
);
|
|
274
|
+
|
|
275
|
+
pushResult(
|
|
276
|
+
results,
|
|
277
|
+
explainOnDemandAuditExecution.report.passed === true,
|
|
278
|
+
'explain-on-demand-hard-rule',
|
|
279
|
+
explainOnDemandAuditExecution.report.passed === true
|
|
280
|
+
? 'Explain-on-demand hard-rule passed'
|
|
281
|
+
: `Explain-on-demand audit failed: ${Array.isArray(explainOnDemandAuditExecution.report.failures) ? explainOnDemandAuditExecution.report.failures.join('; ') : 'Unknown explain-on-demand audit failures'}`
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
const singleSourceLazyLoadingAuditExecution = runMachineReadableScript(
|
|
286
|
+
SINGLE_SOURCE_LAZY_LOADING_AUDIT_SCRIPT_PATH,
|
|
287
|
+
['--workflow', 'pr-preparation']
|
|
288
|
+
);
|
|
289
|
+
if (!singleSourceLazyLoadingAuditExecution.report) {
|
|
290
|
+
const failureDetails = singleSourceLazyLoadingAuditExecution.executionErrorMessage
|
|
291
|
+
? `Single-source lazy-loading audit execution failed before producing a machine-readable report: ${singleSourceLazyLoadingAuditExecution.executionErrorMessage}`
|
|
292
|
+
: 'Single-source lazy-loading audit did not produce machine-readable JSON output';
|
|
293
|
+
pushResult(results, false, 'single-source-lazy-loading-audit', failureDetails);
|
|
294
|
+
} else {
|
|
295
|
+
diagnostics.singleSourceLazyLoadingAudit = singleSourceLazyLoadingAuditExecution.report;
|
|
296
|
+
pushResult(
|
|
297
|
+
results,
|
|
298
|
+
true,
|
|
299
|
+
'single-source-lazy-loading-audit',
|
|
300
|
+
`single-source-lazy-loading-audit executed (passed=${singleSourceLazyLoadingAuditExecution.report.passed}, failures=${singleSourceLazyLoadingAuditExecution.report.failureCount})`
|
|
301
|
+
);
|
|
302
|
+
pushResult(
|
|
303
|
+
results,
|
|
304
|
+
singleSourceLazyLoadingAuditExecution.report?.canonicalSource?.enforced === true,
|
|
305
|
+
'canonical-rule-source-hard-rule',
|
|
306
|
+
singleSourceLazyLoadingAuditExecution.report?.canonicalSource?.enforced === true
|
|
307
|
+
? 'Canonical rule source is explicitly defined and enforced'
|
|
308
|
+
: 'Canonical rule source enforcement failed in single-source lazy-loading audit'
|
|
309
|
+
);
|
|
310
|
+
pushResult(
|
|
311
|
+
results,
|
|
312
|
+
singleSourceLazyLoadingAuditExecution.report?.lazyRuleLoading?.enforced === true,
|
|
313
|
+
'lazy-rule-loading-hard-rule',
|
|
314
|
+
singleSourceLazyLoadingAuditExecution.report?.lazyRuleLoading?.enforced === true
|
|
315
|
+
? 'Language-specific guidance is loaded lazily by detected scope'
|
|
316
|
+
: 'Lazy rule loading enforcement failed in single-source lazy-loading audit'
|
|
317
|
+
);
|
|
318
|
+
pushResult(
|
|
319
|
+
results,
|
|
320
|
+
singleSourceLazyLoadingAuditExecution.report?.duplicationPolicy?.noConflictingDuplicates === true,
|
|
321
|
+
'no-conflicting-duplicate-rule-instructions',
|
|
322
|
+
singleSourceLazyLoadingAuditExecution.report?.duplicationPolicy?.noConflictingDuplicates === true
|
|
323
|
+
? 'No conflicting duplicate rule instructions detected in normal flow'
|
|
324
|
+
: 'Conflicting duplicate rule instructions detected by single-source lazy-loading audit'
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
try {
|
|
329
|
+
const frontendAuditRawOutput = execFileSync('node', [FRONTEND_AUDIT_SCRIPT_PATH], {
|
|
330
|
+
cwd: REPOSITORY_ROOT,
|
|
331
|
+
encoding: 'utf8',
|
|
332
|
+
maxBuffer: 1024 * 1024,
|
|
333
|
+
});
|
|
334
|
+
const frontendAuditReport = JSON.parse(frontendAuditRawOutput);
|
|
335
|
+
pushResult(
|
|
336
|
+
results,
|
|
337
|
+
frontendAuditReport.passed === true,
|
|
338
|
+
'frontend-usability-audit',
|
|
339
|
+
frontendAuditReport.passed === true
|
|
340
|
+
? 'frontend-usability-audit report passed'
|
|
341
|
+
: `frontend-usability-audit reported failures: ${Array.isArray(frontendAuditReport.failures) ? frontendAuditReport.failures.join('; ') : 'Unknown frontend audit failures'}`
|
|
342
|
+
);
|
|
343
|
+
} catch (frontendAuditError) {
|
|
344
|
+
const frontendAuditErrorMessage = frontendAuditError instanceof Error
|
|
345
|
+
? frontendAuditError.message
|
|
346
|
+
: 'Unknown frontend audit execution error';
|
|
347
|
+
pushResult(results, false, 'frontend-usability-audit', `Failed to execute frontend usability audit: ${frontendAuditErrorMessage}`);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
const uiDesignJudgeExecution = runMachineReadableScript(UI_DESIGN_JUDGE_SCRIPT_PATH);
|
|
351
|
+
if (!uiDesignJudgeExecution.report) {
|
|
352
|
+
const failureDetails = uiDesignJudgeExecution.executionErrorMessage
|
|
353
|
+
? `UI design judge execution failed before producing a machine-readable report: ${uiDesignJudgeExecution.executionErrorMessage}`
|
|
354
|
+
: 'UI design judge did not produce machine-readable JSON output';
|
|
355
|
+
pushResult(results, false, 'ui-design-judge-advisory', failureDetails);
|
|
356
|
+
} else {
|
|
357
|
+
diagnostics.uiDesignJudge = uiDesignJudgeExecution.report;
|
|
358
|
+
pushResult(
|
|
359
|
+
results,
|
|
360
|
+
true,
|
|
361
|
+
'ui-design-judge-advisory',
|
|
362
|
+
`ui-design-judge executed (passed=${uiDesignJudgeExecution.report.passed}, skipped=${uiDesignJudgeExecution.report.skipped}, mode=${uiDesignJudgeExecution.report.mode})`
|
|
363
|
+
);
|
|
364
|
+
pushResult(
|
|
365
|
+
results,
|
|
366
|
+
uiDesignJudgeExecution.report.advisoryOnly === true,
|
|
367
|
+
'ui-design-judge-non-blocking-policy',
|
|
368
|
+
uiDesignJudgeExecution.report.advisoryOnly === true
|
|
369
|
+
? 'UI design judge remains advisory by default and does not hard-block release gate'
|
|
370
|
+
: 'UI design judge unexpectedly ran in blocking mode during release gate'
|
|
371
|
+
);
|
|
372
|
+
|
|
373
|
+
const hasStructuredDesignDiagnostics = typeof uiDesignJudgeExecution.report?.summary?.designExecutionSignalCount === 'number'
|
|
374
|
+
&& typeof uiDesignJudgeExecution.report?.summary?.genericityStatus === 'string'
|
|
375
|
+
&& typeof uiDesignJudgeExecution.report?.designExecution?.policyPresent === 'boolean'
|
|
376
|
+
&& typeof uiDesignJudgeExecution.report?.designExecution?.contractReady === 'boolean'
|
|
377
|
+
&& typeof uiDesignJudgeExecution.report?.designExecution?.handoffPresent === 'boolean'
|
|
378
|
+
&& typeof uiDesignJudgeExecution.report?.designExecution?.handoffReady === 'boolean'
|
|
379
|
+
&& Array.isArray(uiDesignJudgeExecution.report?.designExecution?.missingHandoffArtifacts)
|
|
380
|
+
&& Array.isArray(uiDesignJudgeExecution.report?.designExecution?.semanticReviewFocus)
|
|
381
|
+
&& Array.isArray(uiDesignJudgeExecution.report?.designExecution?.missingCapabilities)
|
|
382
|
+
&& Array.isArray(uiDesignJudgeExecution.report?.rubric?.expectedDimensions)
|
|
383
|
+
&& Array.isArray(uiDesignJudgeExecution.report?.rubric?.breakdown)
|
|
384
|
+
&& typeof uiDesignJudgeExecution.report?.rubric?.genericityAssessment?.status === 'string'
|
|
385
|
+
&& typeof uiDesignJudgeExecution.report?.semanticJudge?.attempted === 'boolean'
|
|
386
|
+
&& typeof uiDesignJudgeExecution.report?.semanticJudge?.skipped === 'boolean';
|
|
387
|
+
|
|
388
|
+
pushResult(
|
|
389
|
+
results,
|
|
390
|
+
hasStructuredDesignDiagnostics,
|
|
391
|
+
'ui-design-judge-structured-diagnostics',
|
|
392
|
+
hasStructuredDesignDiagnostics
|
|
393
|
+
? 'UI design judge reports structured design execution diagnostics and semantic-review state together'
|
|
394
|
+
: 'UI design judge is missing structured design execution or semantic-review machine-readable fields'
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
const benchmarkGateExecution = runMachineReadableScript(BENCHMARK_GATE_SCRIPT_PATH);
|
|
399
|
+
if (!benchmarkGateExecution.report) {
|
|
400
|
+
const failureDetails = benchmarkGateExecution.executionErrorMessage
|
|
401
|
+
? `Benchmark gate execution failed before producing a machine-readable report: ${benchmarkGateExecution.executionErrorMessage}`
|
|
402
|
+
: 'Benchmark gate did not produce machine-readable JSON output';
|
|
403
|
+
pushResult(results, false, 'benchmark-threshold-gate', failureDetails);
|
|
404
|
+
} else {
|
|
405
|
+
diagnostics.benchmarkGate = benchmarkGateExecution.report;
|
|
406
|
+
pushResult(
|
|
407
|
+
results,
|
|
408
|
+
true,
|
|
409
|
+
'benchmark-threshold-gate',
|
|
410
|
+
`Benchmark threshold gate executed (passed=${benchmarkGateExecution.report.passed}, failures=${benchmarkGateExecution.report.failureCount})`
|
|
411
|
+
);
|
|
412
|
+
pushResult(
|
|
413
|
+
results,
|
|
414
|
+
benchmarkGateExecution.report.passed === true,
|
|
415
|
+
'benchmark-regression-block',
|
|
416
|
+
benchmarkGateExecution.report.passed === true
|
|
417
|
+
? 'Benchmark thresholds are healthy; release remains eligible'
|
|
418
|
+
: `Benchmark threshold regression detected. ${Array.isArray(benchmarkGateExecution.report.results)
|
|
419
|
+
? benchmarkGateExecution.report.results
|
|
420
|
+
.filter((benchmarkCheckResult) => !benchmarkCheckResult.passed)
|
|
421
|
+
.map((benchmarkCheckResult) => `${benchmarkCheckResult.checkName}: ${benchmarkCheckResult.details}`)
|
|
422
|
+
.join('; ') || 'Benchmark gate failed but did not report individual failed checks'
|
|
423
|
+
: 'Benchmark gate failed but did not report individual failed checks'}`
|
|
424
|
+
);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import { resolve, dirname } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = dirname(__filename);
|
|
8
|
+
|
|
9
|
+
export const REPOSITORY_ROOT = resolve(__dirname, '..', '..');
|
|
10
|
+
export const VERSION_PATTERN = /^\d+\.\d+\.\d+$/;
|
|
11
|
+
export const FRONTEND_AUDIT_SCRIPT_PATH = 'scripts/frontend-usability-audit.mjs';
|
|
12
|
+
export const UI_DESIGN_JUDGE_SCRIPT_PATH = 'scripts/ui-design-judge.mjs';
|
|
13
|
+
export const DOCUMENTATION_BOUNDARY_AUDIT_SCRIPT_PATH = 'scripts/documentation-boundary-audit.mjs';
|
|
14
|
+
export const CONTEXT_TRIGGERED_AUDIT_SCRIPT_PATH = 'scripts/context-triggered-audit.mjs';
|
|
15
|
+
export const RULES_GUARDIAN_AUDIT_SCRIPT_PATH = 'scripts/rules-guardian-audit.mjs';
|
|
16
|
+
export const EXPLAIN_ON_DEMAND_AUDIT_SCRIPT_PATH = 'scripts/explain-on-demand-audit.mjs';
|
|
17
|
+
export const SINGLE_SOURCE_LAZY_LOADING_AUDIT_SCRIPT_PATH = 'scripts/single-source-lazy-loading-audit.mjs';
|
|
18
|
+
export const BENCHMARK_GATE_SCRIPT_PATH = 'scripts/benchmark-gate.mjs';
|
|
19
|
+
export const BACKEND_ARCHITECTURE_RULE_PATH = '.agent-context/rules/architecture.md';
|
|
20
|
+
export const BACKEND_REVIEW_CHECKLIST_PATH = '.agent-context/review-checklists/pr-checklist.md';
|
|
21
|
+
export const ARCHITECTURE_REVIEW_CHECKLIST_PATH = '.agent-context/review-checklists/architecture-review.md';
|
|
22
|
+
export const REFACTOR_PROMPT_PATH = '.agent-context/prompts/refactor.md';
|
|
23
|
+
export const AUTO_DOCS_SYNC_SCOPE_PHASE = 'phase-1';
|
|
24
|
+
export const AUTO_DOCS_SYNC_SCOPE_BOUNDARIES = [
|
|
25
|
+
'public-surface',
|
|
26
|
+
'api-contract',
|
|
27
|
+
'database-structure',
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
export const REQUIRED_BACKEND_ARCHITECTURE_RULE_SNIPPETS = [
|
|
31
|
+
'No clever hacks.',
|
|
32
|
+
'No premature abstraction.',
|
|
33
|
+
'Readability over brevity.',
|
|
34
|
+
'backend and shared core modules',
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
export const REQUIRED_BACKEND_REVIEW_CHECKLIST_SNIPPETS = [
|
|
38
|
+
'No clever hacks in backend and shared core modules',
|
|
39
|
+
'No premature abstraction (base classes/util layers created only after repeated stable patterns)',
|
|
40
|
+
'Readability over brevity for maintainability',
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
export const REQUIRED_REFACTOR_PROMPT_SNIPPETS = [
|
|
44
|
+
'Enforce backend universal principles: no clever hacks, no premature abstraction, readability over brevity.',
|
|
45
|
+
'Prioritize maintainability over compressed one-liners.',
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
export const REQUIRED_ARCHITECTURE_REVIEW_CHECKLIST_SNIPPETS = [
|
|
49
|
+
'## Backend Universal Principles',
|
|
50
|
+
'No clever hacks in backend and shared core modules',
|
|
51
|
+
'No premature abstraction',
|
|
52
|
+
'Readability over brevity',
|
|
53
|
+
];
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
4
|
+
import { execFileSync } from 'node:child_process';
|
|
5
|
+
import { resolve } from 'node:path';
|
|
6
|
+
import { REPOSITORY_ROOT } from './constants.mjs';
|
|
7
|
+
|
|
8
|
+
export function readText(relativeFilePath) {
|
|
9
|
+
const absolutePath = resolve(REPOSITORY_ROOT, relativeFilePath);
|
|
10
|
+
if (!existsSync(absolutePath)) {
|
|
11
|
+
return '';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return readFileSync(absolutePath, 'utf8');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function pushResult(results, isPassed, checkName, details) {
|
|
18
|
+
results.push({
|
|
19
|
+
checkName,
|
|
20
|
+
passed: isPassed,
|
|
21
|
+
details,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function parseMachineReadableReport(rawOutput) {
|
|
26
|
+
if (typeof rawOutput !== 'string' || rawOutput.trim().length === 0) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
return JSON.parse(rawOutput);
|
|
32
|
+
} catch {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function runMachineReadableScript(scriptRelativePath, scriptArguments = []) {
|
|
38
|
+
try {
|
|
39
|
+
const rawOutput = execFileSync('node', [scriptRelativePath, ...scriptArguments], {
|
|
40
|
+
cwd: REPOSITORY_ROOT,
|
|
41
|
+
encoding: 'utf8',
|
|
42
|
+
maxBuffer: 1024 * 1024,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
report: parseMachineReadableReport(rawOutput),
|
|
47
|
+
executionErrorMessage: null,
|
|
48
|
+
};
|
|
49
|
+
} catch (scriptExecutionError) {
|
|
50
|
+
const rawOutput = scriptExecutionError && typeof scriptExecutionError === 'object' && 'stdout' in scriptExecutionError
|
|
51
|
+
? String(scriptExecutionError.stdout ?? '')
|
|
52
|
+
: '';
|
|
53
|
+
const parsedReport = parseMachineReadableReport(rawOutput);
|
|
54
|
+
const executionErrorMessage = scriptExecutionError instanceof Error
|
|
55
|
+
? scriptExecutionError.message
|
|
56
|
+
: 'Unknown execution error';
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
report: parsedReport,
|
|
60
|
+
executionErrorMessage,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|