@ryuenn3123/agentic-senior-core 4.4.0 → 5.2.0
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/.agents/plugins/agentic-senior-core/plugin.json +3 -0
- package/.agents/plugins/agentic-senior-core/rules/agentic-senior-core.md +131 -0
- package/.agents/plugins/agentic-senior-core/skills/asc/SKILL.md +16 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-audit/SKILL.md +28 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-refactor/SKILL.md +35 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-review/SKILL.md +54 -0
- package/.agents/rules/agentic-senior-core.md +131 -0
- package/.claude-plugin/marketplace.json +17 -0
- package/.claude-plugin/plugin.json +17 -0
- package/.clinerules/agentic-senior-core.md +94 -0
- package/.codex-plugin/plugin.json +24 -0
- package/.cursor/rules/agentic-senior-core.mdc +99 -0
- package/.devin-plugin/plugin.json +13 -0
- package/.github/copilot-instructions.md +94 -0
- package/.github/plugin/marketplace.json +20 -0
- package/.github/plugin/plugin.json +16 -0
- package/.kiro/steering/agentic-senior-core.md +94 -0
- package/.openclaw/skills/asc/SKILL.md +23 -0
- package/.openclaw/skills/asc-audit/SKILL.md +28 -0
- package/.openclaw/skills/asc-review/SKILL.md +54 -0
- package/.opencode/plugins/agentic-senior-core.mjs +31 -0
- package/.windsurf/rules/agentic-senior-core.md +94 -0
- package/AGENTS.md +126 -127
- package/CONTRIBUTING.md +93 -63
- package/README.md +190 -110
- package/__init__.py +61 -0
- package/bin/agentic-senior-core.js +42 -41
- package/commands/asc-audit.md +1 -0
- package/commands/asc-audit.toml +2 -0
- package/commands/asc-help.md +9 -0
- package/commands/asc-help.toml +2 -0
- package/commands/asc-refactor.md +1 -0
- package/commands/asc-refactor.toml +2 -0
- package/commands/asc-review.md +1 -0
- package/commands/asc-review.toml +2 -0
- package/gemini-extension.json +10 -0
- package/hooks/copilot-hooks.json +21 -0
- package/hooks/hooks.json +31 -0
- package/hooks/session-start.js +36 -0
- package/hooks/subagent-start.js +38 -0
- package/lib/cli/commands/adapter.mjs +109 -0
- package/lib/cli/commands/clean.mjs +63 -0
- package/lib/cli/commands/status.mjs +94 -0
- package/package.json +43 -60
- package/plugin.yaml +16 -0
- package/scripts/uninstall.js +38 -0
- package/skills/asc/SKILL.md +16 -0
- package/skills/asc-audit/SKILL.md +28 -0
- package/skills/asc-refactor/SKILL.md +35 -0
- package/skills/asc-review/SKILL.md +54 -0
- package/.agent-context/policies/llm-judge-threshold.json +0 -29
- package/.agent-context/prompts/bootstrap-design.md +0 -63
- package/.agent-context/prompts/compact-natural-mode.md +0 -100
- package/.agent-context/prompts/init-project.md +0 -60
- package/.agent-context/prompts/refactor.md +0 -38
- package/.agent-context/prompts/review-code.md +0 -31
- package/.agent-context/review-checklists/architecture-review.md +0 -57
- package/.agent-context/review-checklists/pr-checklist.md +0 -134
- package/.agent-context/rules/api-docs.md +0 -24
- package/.agent-context/rules/api-versioning.md +0 -16
- package/.agent-context/rules/architecture.md +0 -38
- package/.agent-context/rules/background-jobs.md +0 -17
- package/.agent-context/rules/config-and-flags.md +0 -16
- package/.agent-context/rules/database-design.md +0 -18
- package/.agent-context/rules/docker-runtime.md +0 -17
- package/.agent-context/rules/error-handling.md +0 -16
- package/.agent-context/rules/event-driven.md +0 -16
- package/.agent-context/rules/frontend-architecture.md +0 -54
- package/.agent-context/rules/microservices.md +0 -16
- package/.agent-context/rules/migrations.md +0 -16
- package/.agent-context/rules/observability.md +0 -16
- package/.agent-context/rules/performance.md +0 -16
- package/.agent-context/rules/realtime.md +0 -16
- package/.agent-context/rules/resilience.md +0 -18
- package/.agent-context/rules/security.md +0 -18
- package/.agent-context/rules/testing.md +0 -16
- package/.agent-context/state/README.md +0 -25
- package/.agent-context/state/architecture-map.md +0 -40
- package/.agent-context/state/benchmark-comparison-schema.json +0 -181
- package/.agent-context/state/benchmark-reproducibility.json +0 -87
- package/.agent-context/state/benchmark-thresholds.json +0 -10
- package/.agent-context/state/benchmark-writer-judge-config.json +0 -58
- package/.agent-context/state/dependency-map.md +0 -41
- package/.agent-context/state/memory-adapter-contract.json +0 -52
- package/.agent-context/state/memory-schema-v1.json +0 -88
- package/GEMINI.md +0 -1
- package/benchmarks/README.md +0 -60
- package/benchmarks/compact-natural-mode/fixtures.mjs +0 -359
- package/benchmarks/compact-natural-mode/scorer.mjs +0 -331
- package/benchmarks/runtime-token-saver/fixtures.mjs +0 -836
- package/lib/cli/adaptive-context/catalog.mjs +0 -394
- package/lib/cli/adaptive-context/file-signals.mjs +0 -100
- package/lib/cli/adaptive-context/implications.mjs +0 -44
- package/lib/cli/adaptive-context.mjs +0 -151
- package/lib/cli/audits/typography-palette-anti-repeat/color-utils.mjs +0 -156
- package/lib/cli/audits/typography-palette-anti-repeat/file-scanner.mjs +0 -103
- package/lib/cli/audits/typography-palette-anti-repeat/typography-utils.mjs +0 -70
- package/lib/cli/backup.mjs +0 -210
- package/lib/cli/commands/context.mjs +0 -140
- package/lib/cli/commands/init/project-context.mjs +0 -60
- package/lib/cli/commands/init/runtime-environment.mjs +0 -59
- package/lib/cli/commands/init/setup-decisions.mjs +0 -83
- package/lib/cli/commands/init.mjs +0 -654
- package/lib/cli/commands/launch.mjs +0 -76
- package/lib/cli/commands/optimize.mjs +0 -284
- package/lib/cli/commands/rollback.mjs +0 -64
- package/lib/cli/commands/upgrade/token-optimization-state.mjs +0 -51
- package/lib/cli/commands/upgrade.mjs +0 -451
- package/lib/cli/compiler.mjs +0 -187
- package/lib/cli/constants.mjs +0 -136
- package/lib/cli/detector/constants.mjs +0 -135
- package/lib/cli/detector/design-evidence/collector.mjs +0 -256
- package/lib/cli/detector/design-evidence/constants.mjs +0 -39
- package/lib/cli/detector/design-evidence/file-traversal.mjs +0 -83
- package/lib/cli/detector/design-evidence/structured-attribute-evidence.mjs +0 -117
- package/lib/cli/detector/design-evidence/summary.mjs +0 -109
- package/lib/cli/detector/design-evidence/utility-helpers.mjs +0 -122
- package/lib/cli/detector/design-evidence.mjs +0 -25
- package/lib/cli/detector/stack-detection.mjs +0 -243
- package/lib/cli/detector/ui-signals.mjs +0 -150
- package/lib/cli/detector/workspace-scan.mjs +0 -177
- package/lib/cli/detector.mjs +0 -23
- package/lib/cli/init-detection-flow.mjs +0 -48
- package/lib/cli/init-options.mjs +0 -237
- package/lib/cli/init-selection.mjs +0 -29
- package/lib/cli/memory-continuity.mjs +0 -537
- package/lib/cli/preflight.mjs +0 -76
- package/lib/cli/project-scaffolder/constants.mjs +0 -69
- package/lib/cli/project-scaffolder/discovery.mjs +0 -272
- package/lib/cli/project-scaffolder/prompt-builders.mjs +0 -171
- package/lib/cli/project-scaffolder/storage.mjs +0 -144
- package/lib/cli/project-scaffolder/ui-scope-detection.mjs +0 -36
- package/lib/cli/project-scaffolder.mjs +0 -29
- package/lib/cli/rollback.mjs +0 -66
- package/lib/cli/token-optimization.mjs +0 -401
- package/lib/cli/utils/filesystem.mjs +0 -81
- package/lib/cli/utils/managed-surface.mjs +0 -280
- package/lib/cli/utils/prompting.mjs +0 -44
- package/lib/cli/utils.mjs +0 -479
- package/mcp.json +0 -134
- package/scripts/adaptive-context/fixtures.mjs +0 -183
- package/scripts/adaptive-context-benchmark.mjs +0 -9
- package/scripts/ascx-runtime-token-saver-benchmark.mjs +0 -9
- package/scripts/benchmark-evidence-bundle.mjs +0 -645
- package/scripts/benchmark-gate.mjs +0 -121
- package/scripts/benchmark-intelligence.mjs +0 -33
- package/scripts/benchmark-writer-judge-matrix.mjs +0 -379
- package/scripts/build-release-benchmark-bundle.mjs +0 -202
- package/scripts/bump-version.mjs +0 -103
- package/scripts/clean-local-artifacts.mjs +0 -78
- package/scripts/compact-natural-mode-benchmark.mjs +0 -9
- package/scripts/context-triggered-audit.mjs +0 -391
- package/scripts/detection-benchmark.mjs +0 -127
- package/scripts/docs-quality-drift-report.mjs +0 -358
- package/scripts/documentation-boundary-audit.mjs +0 -305
- package/scripts/explain-on-demand-audit.mjs +0 -427
- package/scripts/forbidden-content-check.mjs +0 -123
- package/scripts/frontend-usability-audit.mjs +0 -243
- package/scripts/generate-sbom.mjs +0 -61
- package/scripts/governance-weekly-report.mjs +0 -466
- package/scripts/llm-judge/checklist-loader.mjs +0 -45
- package/scripts/llm-judge/constants.mjs +0 -66
- package/scripts/llm-judge/diff-collection.mjs +0 -74
- package/scripts/llm-judge/prompting.mjs +0 -78
- package/scripts/llm-judge/providers.mjs +0 -111
- package/scripts/llm-judge/verdict.mjs +0 -134
- package/scripts/llm-judge.mjs +0 -200
- package/scripts/memory-continuity-benchmark.mjs +0 -322
- package/scripts/quality-trend-report.mjs +0 -289
- package/scripts/release-gate/audit-checks.mjs +0 -441
- package/scripts/release-gate/constants.mjs +0 -53
- package/scripts/release-gate/runtime.mjs +0 -63
- package/scripts/release-gate/static-checks.mjs +0 -182
- package/scripts/release-gate.mjs +0 -42
- package/scripts/rules-guardian-audit.mjs +0 -580
- package/scripts/single-source-lazy-loading-audit.mjs +0 -449
- package/scripts/sync-thin-adapters.mjs +0 -72
- package/scripts/token-optimization-benchmark.mjs +0 -252
- package/scripts/ui-design-judge/constants.mjs +0 -13
- package/scripts/ui-design-judge/design-execution-summary.mjs +0 -81
- package/scripts/ui-design-judge/git-input.mjs +0 -134
- package/scripts/ui-design-judge/prompting.mjs +0 -52
- package/scripts/ui-design-judge/providers.mjs +0 -102
- package/scripts/ui-design-judge/reporting.mjs +0 -183
- package/scripts/ui-design-judge/rubric-calibration.mjs +0 -214
- package/scripts/ui-design-judge/rubric-goldset.json +0 -188
- package/scripts/ui-design-judge.mjs +0 -319
- package/scripts/ui-rubric-calibration.mjs +0 -35
- package/scripts/validate/audits/cache-layer-contract.mjs +0 -230
- package/scripts/validate/audits/caching-scope-hygiene.mjs +0 -235
- package/scripts/validate/audits/file-size.mjs +0 -158
- package/scripts/validate/audits/reflection-citations.mjs +0 -130
- package/scripts/validate/audits/release-bundle.mjs +0 -135
- package/scripts/validate/audits/rule-id-uniqueness.mjs +0 -278
- package/scripts/validate/config.mjs +0 -501
- package/scripts/validate/coverage-checks.mjs +0 -446
- package/scripts/validate/file-structure.mjs +0 -158
- package/scripts/validate/markdown-content.mjs +0 -109
- package/scripts/validate/project-metadata.mjs +0 -166
- package/scripts/validate/utils.mjs +0 -52
- package/scripts/validate.mjs +0 -267
|
@@ -1,441 +0,0 @@
|
|
|
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?.requiredActions)
|
|
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 requiredAction = Array.isArray(violation?.requiredActions) && violation.requiredActions.length > 0
|
|
121
|
-
? violation.requiredActions[0]
|
|
122
|
-
: 'Update matching boundary documentation in the same scope.';
|
|
123
|
-
return `${failureCode} (${violation?.boundaryName || 'unknown-boundary'}): ${changedFiles}. Action: ${requiredAction}`;
|
|
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
|
-
? 'Global domain governance is loaded lazily by touched 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
|
-
|
|
365
|
-
pushResult(
|
|
366
|
-
results,
|
|
367
|
-
uiDesignJudgeExecution.report.passed === true,
|
|
368
|
-
'ui-design-judge-contract-hard-rule',
|
|
369
|
-
uiDesignJudgeExecution.report.passed === true
|
|
370
|
-
? 'UI design judge contract hard-rule passed or no blocking auto-fail was triggered'
|
|
371
|
-
: `UI design judge reported blocking design drift: ${Array.isArray(uiDesignJudgeExecution.report.findings)
|
|
372
|
-
? uiDesignJudgeExecution.report.findings
|
|
373
|
-
.filter((finding) => finding?.blockingRecommended === true)
|
|
374
|
-
.map((finding) => `${finding.area}: ${finding.problem}`)
|
|
375
|
-
.join('; ') || 'blocking drift reported without detailed findings'
|
|
376
|
-
: 'blocking drift reported without detailed findings'}`
|
|
377
|
-
);
|
|
378
|
-
|
|
379
|
-
pushResult(
|
|
380
|
-
results,
|
|
381
|
-
uiDesignJudgeExecution.report.advisoryOnly === true || uiDesignJudgeExecution.report.autoFailTriggered === true,
|
|
382
|
-
'ui-design-judge-non-blocking-policy',
|
|
383
|
-
uiDesignJudgeExecution.report.advisoryOnly === true
|
|
384
|
-
? 'UI design judge remains advisory by default when no auto-fail drift is detected'
|
|
385
|
-
: 'UI design judge entered blocking-recommended mode because genericityAutoFail detected named drift'
|
|
386
|
-
);
|
|
387
|
-
|
|
388
|
-
const hasStructuredDesignDiagnostics = typeof uiDesignJudgeExecution.report?.summary?.designExecutionSignalCount === 'number'
|
|
389
|
-
&& typeof uiDesignJudgeExecution.report?.summary?.genericityStatus === 'string'
|
|
390
|
-
&& typeof uiDesignJudgeExecution.report?.designExecution?.policyPresent === 'boolean'
|
|
391
|
-
&& typeof uiDesignJudgeExecution.report?.designExecution?.contractReady === 'boolean'
|
|
392
|
-
&& typeof uiDesignJudgeExecution.report?.designExecution?.handoffPresent === 'boolean'
|
|
393
|
-
&& typeof uiDesignJudgeExecution.report?.designExecution?.handoffReady === 'boolean'
|
|
394
|
-
&& Array.isArray(uiDesignJudgeExecution.report?.designExecution?.missingHandoffArtifacts)
|
|
395
|
-
&& Array.isArray(uiDesignJudgeExecution.report?.designExecution?.semanticReviewFocus)
|
|
396
|
-
&& Array.isArray(uiDesignJudgeExecution.report?.designExecution?.missingCapabilities)
|
|
397
|
-
&& Array.isArray(uiDesignJudgeExecution.report?.rubric?.expectedDimensions)
|
|
398
|
-
&& Array.isArray(uiDesignJudgeExecution.report?.rubric?.breakdown)
|
|
399
|
-
&& typeof uiDesignJudgeExecution.report?.rubric?.genericityAssessment?.status === 'string'
|
|
400
|
-
&& typeof uiDesignJudgeExecution.report?.semanticJudge?.attempted === 'boolean'
|
|
401
|
-
&& typeof uiDesignJudgeExecution.report?.semanticJudge?.skipped === 'boolean';
|
|
402
|
-
|
|
403
|
-
pushResult(
|
|
404
|
-
results,
|
|
405
|
-
hasStructuredDesignDiagnostics,
|
|
406
|
-
'ui-design-judge-structured-diagnostics',
|
|
407
|
-
hasStructuredDesignDiagnostics
|
|
408
|
-
? 'UI design judge reports structured design execution diagnostics and semantic-review state together'
|
|
409
|
-
: 'UI design judge is missing structured design execution or semantic-review machine-readable fields'
|
|
410
|
-
);
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
const benchmarkGateExecution = runMachineReadableScript(BENCHMARK_GATE_SCRIPT_PATH);
|
|
414
|
-
if (!benchmarkGateExecution.report) {
|
|
415
|
-
const failureDetails = benchmarkGateExecution.executionErrorMessage
|
|
416
|
-
? `Benchmark gate execution failed before producing a machine-readable report: ${benchmarkGateExecution.executionErrorMessage}`
|
|
417
|
-
: 'Benchmark gate did not produce machine-readable JSON output';
|
|
418
|
-
pushResult(results, false, 'benchmark-threshold-gate', failureDetails);
|
|
419
|
-
} else {
|
|
420
|
-
diagnostics.benchmarkGate = benchmarkGateExecution.report;
|
|
421
|
-
pushResult(
|
|
422
|
-
results,
|
|
423
|
-
true,
|
|
424
|
-
'benchmark-threshold-gate',
|
|
425
|
-
`Benchmark threshold gate executed (passed=${benchmarkGateExecution.report.passed}, failures=${benchmarkGateExecution.report.failureCount})`
|
|
426
|
-
);
|
|
427
|
-
pushResult(
|
|
428
|
-
results,
|
|
429
|
-
benchmarkGateExecution.report.passed === true,
|
|
430
|
-
'benchmark-regression-block',
|
|
431
|
-
benchmarkGateExecution.report.passed === true
|
|
432
|
-
? 'Benchmark thresholds are healthy; release remains eligible'
|
|
433
|
-
: `Benchmark threshold regression detected. ${Array.isArray(benchmarkGateExecution.report.results)
|
|
434
|
-
? benchmarkGateExecution.report.results
|
|
435
|
-
.filter((benchmarkCheckResult) => !benchmarkCheckResult.passed)
|
|
436
|
-
.map((benchmarkCheckResult) => `${benchmarkCheckResult.checkName}: ${benchmarkCheckResult.details}`)
|
|
437
|
-
.join('; ') || 'Benchmark gate failed but did not report individual failed checks'
|
|
438
|
-
: 'Benchmark gate failed but did not report individual failed checks'}`
|
|
439
|
-
);
|
|
440
|
-
}
|
|
441
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
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 = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
|
|
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
|
-
'Do not create or load stack-specific governance adapters as the baseline.',
|
|
32
|
-
];
|
|
33
|
-
|
|
34
|
-
export const REQUIRED_BACKEND_REVIEW_CHECKLIST_SNIPPETS = [
|
|
35
|
-
'Controllers, route handlers, and transport adapters do not contain business policy',
|
|
36
|
-
'Sensitive mutations include idempotency or duplicate-submit coverage',
|
|
37
|
-
'Backend/API governance was applied through global domain rules',
|
|
38
|
-
];
|
|
39
|
-
|
|
40
|
-
export const REQUIRED_RELEASE_VERSION = '4.3.4';
|
|
41
|
-
export const REQUIRED_REFACTOR_PROMPT_SNIPPETS = [
|
|
42
|
-
'Prioritize maintainability over compressed one-liners.',
|
|
43
|
-
'zero-trust input validation',
|
|
44
|
-
'idempotency for sensitive mutations',
|
|
45
|
-
'Backend/API governance is global and stack-agnostic.',
|
|
46
|
-
];
|
|
47
|
-
|
|
48
|
-
export const REQUIRED_ARCHITECTURE_REVIEW_CHECKLIST_SNIPPETS = [
|
|
49
|
-
'Service or use-case code owns orchestration',
|
|
50
|
-
'Relational reads avoid N+1 patterns',
|
|
51
|
-
'Global backend/API governance is used directly',
|
|
52
|
-
'Dual-write database plus message flows use an outbox',
|
|
53
|
-
];
|
|
@@ -1,63 +0,0 @@
|
|
|
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
|
-
}
|