fix: parse task headings with dash variants
This commit is contained in:
@@ -2,3 +2,4 @@
|
|||||||
Run Log
|
Run Log
|
||||||
2026-06-01
|
2026-06-01
|
||||||
Bootstrap project structure created.
|
Bootstrap project structure created.
|
||||||
|
Fixed TASKS.md parser to match em/en dashes in task headings.
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from dataclasses import dataclass
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import re
|
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)
|
STATUS_RE = re.compile(r"^Status:\s*(.+)$", re.MULTILINE)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,36 @@ def test_get_next_task(tmp_path: Path) -> None:
|
|||||||
assert task.title == "Second"
|
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:
|
def test_update_task_status(tmp_path: Path) -> None:
|
||||||
tasks = tmp_path / "TASKS.md"
|
tasks = tmp_path / "TASKS.md"
|
||||||
tasks.write_text(
|
tasks.write_text(
|
||||||
|
|||||||
Reference in New Issue
Block a user