* `maintain` — the self-improving codebase recipe. Each scope is the SAFEST improvement of its * kind, proven (code-graph / toolchain) and shipped through the verified-PR protocol. Conservative * by design — a wrong "improvement" at 3am is worse than none — so it must PROVE safety or block. * `--
(prompt: string)
| 231 | * `--dry-run` previews candidates without changing anything (always blocks). |
| 232 | */ |
| 233 | function maintainPrompt(prompt: string): string { |
| 234 | const { scope, focus, dryRun } = parseMaintainScope(prompt); |
| 235 | const selection = scope === 'unused-imports' ? UNUSED_IMPORTS_SELECTION |
| 236 | : scope === 'unused-locals' ? UNUSED_LOCALS_SELECTION |
| 237 | : scope === 'unused-params' ? UNUSED_PARAMS_SELECTION |
| 238 | : scope === 'lint-fix' ? LINT_FIX_SELECTION |
| 239 | : scope === 'dep-bump' ? DEP_BUMP_SELECTION |
| 240 | : scope === 'consolidate-dupes' ? CONSOLIDATE_DUPES_SELECTION |
| 241 | : scope === 'extract-helper' ? EXTRACT_HELPER_SELECTION |
| 242 | : DEAD_CODE_SELECTION; |
| 243 | const focusLine = focus ? `Focus area (optional hint): ${focus}.` : ''; |
| 244 | const dryRunBlock = dryRun ? [ |
| 245 | '', |
| 246 | 'DRY RUN: do NOT modify any files and do NOT open a PR. Identify the candidates you WOULD', |
| 247 | 'remove, then end with `VERIFIED-PR: blocked — dry-run: <n> candidate(s)` and a receipt', |
| 248 | '(status blocked) whose summary lists them. Preview only.', |
| 249 | ] : []; |
| 250 | return [ |
| 251 | ...UNATTENDED_HEADER, |
| 252 | '', |
| 253 | 'ROLE: you are a nightly code-maintenance agent. Be CONSERVATIVE — doing nothing is better', |
| 254 | 'than a risky change no one is watching.', |
| 255 | 'Do NOT refactor, rename, reformat, change behavior, or touch public APIs.', |
| 256 | focusLine, |
| 257 | ...dryRunBlock, |
| 258 | '', |
| 259 | ...selection, |
| 260 | '', |
| 261 | ...VERIFIED_PR_PROTOCOL, |
| 262 | ].join('\n'); |
| 263 | } |
no test coverage detected