/** * audit-dev-actions-alignment / apply.ts * * Rewrites either the pagespec endpoint or the controller route to bring the * two sides back in sync. Iteration 1 — STUB: the safe-apply pipeline needs * AST-aware C# editing (preserve method body + attributes around the route * attribute) and pagespec JSON re-serialisation that preserves the fenced * block formatting. Both are non-trivial. * * Until the AST editor lands, this function emits the findings and returns * an explanatory message — the user runs the suggested re-scaffolds manually. */ import type { ActionAlignmentArgs, AlignmentReport } from './types.js' import { audit } from './audit.js' export async function apply(args: ActionAlignmentArgs): Promise<{ report: AlignmentReport filesModified: string[] notes: string[] }> { const report = await audit(args) const notes: string[] = [ 'apply mode is not implemented yet (iteration 1 ships report-only).', `Re-run with --mode report-only to inspect the ${report.findings.length} findings, then:`, args.sourceOfTruth === 'pagespec' ? ' - Update each `[HttpVerb("…")]` attribute manually, OR re-scaffold the controllers via `/ba-develop` Phase 2 after refreshing the pagespecs.' : ' - Update each pagespec `endpoint` to match the controller, then re-run `/ba-develop` Phase 3a to regenerate the service.ts methods.', 'Tracking issue: AST-aware safe-apply in a follow-up.', ] return { report, filesModified: [], notes } }