Skip to content
Merged
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ All notable changes to SkillEvaluator are documented in this file.
- `tier3 validate` now exits nonzero when `evals/` is missing, matching the
error it reports.
- OpenAPI discovery inherits inline Path Item parameters and applies operation overrides by name and location; parameter lists containing references retain operation-only parsing.
- The task list trims leading and trailing whitespace and collapses internal
whitespace runs to a single space, so descriptions stay on one line and
remain available on the next command. Whitespace-only descriptions are
rejected as missing content.
- Scanner install hints in `health-check` and `doctor` now match the host:
Windows suggests `winget install Gitleaks.Gitleaks` and `uv tool install semgrep`
instead of `brew`, macOS keeps `brew`, and Linux suggests `go install` or a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ def _save_state(state_path: Path, state: dict) -> str | None:
return f"Failed to write state file: {exc}"


def _single_line(content: str) -> str:
"""Collapse whitespace so a task fits on one line of the state file."""
return " ".join(content.split())
Comment thread
rng1995 marked this conversation as resolved.
Resolved


class TaskManager:
"""Manages tasks with file-backed state."""

Expand Down Expand Up @@ -146,6 +151,7 @@ def counter(self, value: int):

def add_task(self, content: str) -> dict:
"""Add a single task."""
content = _single_line(content)
if not content:
return {"error": "Content is required"}

Expand All @@ -168,7 +174,7 @@ def add_multiple(self, content: str) -> dict:
return {"error": "Content is required"}

items = re.split(r"[;\n]", content)
items = [t.strip() for t in items if t.strip()]
items = [_single_line(t) for t in items if t.strip()]

if not items:
return {"error": "No valid tasks found"}
Expand Down
28 changes: 28 additions & 0 deletions tests/test_reference_skill_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,41 @@ def test_task_status_words_survive_persistence(
assert f"- [{checkbox}] task_1: {content} ({status})" in state_path.read_text(encoding="utf-8")


@pytest.mark.parametrize(
("operation", "content", "expected"),
[
("add", "Write the report\nand send it", ["Write the report and send it"]),
("add", "Fix\r\nlogin flow\t", ["Fix login flow"]),
("add_multiple", "Draft\rreview; Ship", ["Draft review", "Ship"]),
],
)
def test_task_line_breaks_survive_persistence(
operation: str, content: str, expected: list[str], tmp_path: Path
) -> None:
state_path = tmp_path / "todo.md"
env = {"TASK_LIST_STATE_PATH": str(state_path)}

added = _run_script("tasks", operation, "--content", content, env=env)
started = _run_script("tasks", "start", "--task_id", "task_1", env=env)
state, error = _load_script("tasks")._load_state(state_path)

assert added.returncode == started.returncode == 0
assert added.stderr == started.stderr == ""
assert error is None
assert {task_id: task["content"] for task_id, task in state["tasks"].items()} == {
f"task_{number}": text for number, text in enumerate(expected, start=1)
}
assert state["tasks"]["task_1"]["status"] == "in_progress"


@pytest.mark.parametrize(
("name", "args", "expected_error"),
[
("call_api", ("--url", "https://example.invalid", "--headers", "not-json"), "Invalid input"),
("call_api", (), "No URL provided"),
("parse_openapi", (), "Usage:"),
("tasks", ("add",), "Error: Content is required"),
("tasks", ("add", "--content", " \n "), "Error: Content is required"),
],
)
def test_handled_input_failures_write_only_to_stderr(
Expand Down
Loading