fix: parse task headings with dash variants

This commit is contained in:
2026-06-01 19:25:59 +01:00
parent dede6ecc60
commit bc027a5423
3 changed files with 32 additions and 1 deletions
+1
View File
@@ -2,3 +2,4 @@
Run Log
2026-06-01
Bootstrap project structure created.
Fixed TASKS.md parser to match em/en dashes in task headings.
+1 -1
View File
@@ -4,7 +4,7 @@ from dataclasses import dataclass
from pathlib import Path
import re
TASK_HEADING_RE = re.compile(r"^##\s+(TASK-\d+)\s+-\s+(.+)$", re.MULTILINE)
TASK_HEADING_RE = re.compile(r"^##\s+(TASK-\d+)\s+[-–—]\s+(.+)$", re.MULTILINE)
STATUS_RE = re.compile(r"^Status:\s*(.+)$", re.MULTILINE)
+30
View File
@@ -18,6 +18,36 @@ def test_get_next_task(tmp_path: Path) -> None:
assert task.title == "Second"
def test_get_next_task_with_em_dash(tmp_path: Path) -> None:
(tmp_path / "TASKS.md").write_text(
"# TASKS.md\n\n"
"## TASK-001 — First\nStatus: Done\n\n"
"## TASK-002 — Second\nStatus: Todo\n\n",
encoding="utf-8",
)
task = get_next_task(tmp_path)
assert task is not None
assert task.task_id == "TASK-002"
assert task.title == "Second"
def test_get_next_task_with_en_dash(tmp_path: Path) -> None:
(tmp_path / "TASKS.md").write_text(
"# TASKS.md\n\n"
"## TASK-001 First\nStatus: Done\n\n"
"## TASK-002 Second\nStatus: Todo\n\n",
encoding="utf-8",
)
task = get_next_task(tmp_path)
assert task is not None
assert task.task_id == "TASK-002"
assert task.title == "Second"
def test_update_task_status(tmp_path: Path) -> None:
tasks = tmp_path / "TASKS.md"
tasks.write_text(