diff --git a/src/health-diagnostic-rules/agent-install.cts b/src/health-diagnostic-rules/agent-install.cts index 0e27aa758..49392944f 100644 --- a/src/health-diagnostic-rules/agent-install.cts +++ b/src/health-diagnostic-rules/agent-install.cts @@ -26,10 +26,9 @@ // eslint-disable-next-line @typescript-eslint/no-require-imports -- health-diagnostic-types.cjs is an export= CommonJS module import healthDiagnosticMod = require('../health-diagnostic-types.cjs'); -const { SEVERITY, REMEDY_ACTION, REMEDY_RISK } = healthDiagnosticMod; +const { SEVERITY, adviseRemedy } = healthDiagnosticMod; type Rule = healthDiagnosticMod.Rule; type Diagnostic = healthDiagnosticMod.Diagnostic; -type Remedy = healthDiagnosticMod.Remedy; // eslint-disable-next-line @typescript-eslint/no-require-imports -- type-only; erased at compile time, no runtime require emitted import type planningSnapshotMod = require('../planning-snapshot.cjs'); @@ -41,10 +40,6 @@ const { SCOPE } = planningScopeMod; import { PACKAGE_NAME } from '../package-identity.cjs'; -function adviseRemedy(command: string): Remedy { - return { action: REMEDY_ACTION.ADVISE, risk: REMEDY_RISK.NONE, args: { command } }; -} - /** * `check(snapshot)` for W010 — see module header for the exact 4-way * branching this ports from `verify.cts:1992-2027`, and its message/fix diff --git a/src/health-diagnostic-rules/config-validation.cts b/src/health-diagnostic-rules/config-validation.cts index f4bad1f2f..c997767d5 100644 --- a/src/health-diagnostic-rules/config-validation.cts +++ b/src/health-diagnostic-rules/config-validation.cts @@ -56,9 +56,8 @@ type PlanningSnapshot = ReturnType Diagnostic[]; // §8.1 rule 1 signature, verbatim } +// ─── adviseRemedy — shared ADVISE-remedy builder ─────────────────────────── + +/** + * Every rule-group file needs the same `{action: ADVISE, risk: NONE, args: + * {command}}` shape for a non-repairable finding's `fix` string (§8.3 rule + * 5). Was defined identically in `config-validation.cts` and + * `agent-install.cts`, and repeated inline elsewhere — moved to this shared, + * dependency-free leaf so every rule-group file imports one implementation + * instead of duplicating it. + */ +function adviseRemedy(command: string): Remedy { + return { action: REMEDY_ACTION.ADVISE, risk: REMEDY_RISK.NONE, args: { command } }; +} + // ─── Exports ──────────────────────────────────────────────────────────────── const healthDiagnosticTypes = { SEVERITY, REMEDY_ACTION, REMEDY_RISK, + adviseRemedy, }; // Namespace merge (same binding name as the value above) is how a CommonJS