This PR replaces all hard‑coded patch markers in apply‑patch.ts with the corresponding constants (now) exported from parse‑apply‑patch.ts. Changes • Import PATCH_PREFIX, PATCH_SUFFIX, ADD_FILE_PREFIX, DELETE_FILE_PREFIX, UPDATE_FILE_PREFIX, MOVE_FILE_TO_PREFIX, END_OF_FILE_PREFIX, and HUNK_ADD_LINE_PREFIX from parse‑apply‑patch.ts. • Remove duplicate string literals for patch markers in apply‑patch.ts. • Changed is_done() to trim the input to account for the slight difference between the variables. Why • DRY & Consistency: Ensures a single source of truth for patch prefixes. • Maintainability: Simplifies future updates to prefix values by centralizing them. • Readability: Makes the code more declarative and self‑documenting. All tests are passing, lint and format was ran.
2.7 KiB
2.7 KiB