next.js
955bab7b - [agents-md] Address review sweep nits

Commit
143 days ago
[agents-md] Address review sweep nits `requireNextProjectDir` JSDoc corrected — the function throws a plain `Error`, not `BadInput`, because `lib/` can't import `BadInput` from `bin/shared.ts` without inverting the layering. The codemod `bin/` callers catch and rethrow as `BadInput`; `bin/upgrade.ts` now wraps its call too (defense in depth — should never fire in practice, but keeps a future reorder from leaking a stack trace). `upsertAgentRulesBlock` now detects the existing file's line-ending style and matches it when injecting the managed block. Previously, stomping `\n` into a CRLF file on Windows produced mixed EOLs that confuse editors and `.gitattributes` normalization. `stripLegacyAgentRulesBlock` loops until no legacy block remains (defensive — if a file ever acquired multiple legacy blocks via manual paste, both get stripped) and takes the same `eol` so the re-joined seam doesn't introduce mixed EOLs. `writeBundledDocsAgentFiles` doc now notes the two-file create branch is non-atomic — re-running cleanly recovers, so we accept the transient inconsistency rather than add cleanup bookkeeping for a cold-path failure. Test fixture dirs now use `fs.mkdtempSync` instead of `Date.now() + Math.random()` so parallel workers can't collide. Two new e2e tests cover the CRLF preservation path and multi-legacy-block stripping.
Author
Parents
Loading