mirror of
https://github.com/mvschwarz/openrig.git
synced 2026-11-07 05:56:21 -10:00
fix(daemon): parse CRLF PROGRESS.md files in the progress indexer (#1314)
`progress-indexer.ts` now splits on `/\r?\n/` instead of `"\n"`. On main, every line of a CRLF `PROGRESS.md` kept its `\r`, so the title, heading and checkbox-row patterns failed and the file read as empty. - LF files and lone CR characters are unchanged. In a mixed file, the CRLF lines now parse too. - A test covers a CRLF file.
This commit is contained in:
1 parent
3e0072ae2f
commit
794af927bf
2 files changed
+22
-1
No files matched your search
@@ -180,7 +180,7 @@ export class ProgressIndexer {
|
||||
} catch { return null; }
|
||||
|
||||
const rows: ProgressRow[] = [];
|
||||
const lines = content.split("\n");
|
||||
const lines = content.split(/\r?\n/);
|
||||
let title: string | null = null;
|
||||
let inFrontmatter = false;
|
||||
let fence: { marker: string; length: number } | null = null;
|
||||
|
||||
@@ -167,4 +167,25 @@ describe("UI Enhancement Pack v0 — ProgressIndexer", () => {
|
||||
expect(result.aggregate.totalActive).toBe(1);
|
||||
expect(result.aggregate.totalBlocked).toBe(1);
|
||||
});
|
||||
|
||||
it("parses a CRLF PROGRESS.md exactly like its LF twin", () => {
|
||||
mkdirSync(join(tempDir, "lf"), { recursive: true });
|
||||
mkdirSync(join(tempDir, "crlf"), { recursive: true });
|
||||
const lf = [
|
||||
"---", "slice: foo", "---",
|
||||
"# Title", "## Section A", "- [x] shipped", "- [ ] remaining", " - [~] blocked child",
|
||||
"```md", "- [x] example only", "```", "- [ ] after fence", "",
|
||||
].join("\n");
|
||||
writeFileSync(join(tempDir, "lf", "PROGRESS.md"), lf);
|
||||
writeFileSync(join(tempDir, "crlf", "PROGRESS.md"), lf.replace(/\n/g, "\r\n"));
|
||||
|
||||
const read = (name: string) => {
|
||||
const file = new ProgressIndexer({ roots: [{ name, canonicalPath: join(tempDir, name) }] }).scan().files[0]!;
|
||||
return { title: file.title, rows: file.rows, counts: file.counts };
|
||||
};
|
||||
|
||||
const expected = read("lf");
|
||||
expect(expected.rows.length).toBeGreaterThan(0);
|
||||
expect(read("crlf")).toEqual(expected);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user