File size: 2,196 Bytes
1aee5ae | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | from pathlib import Path
from aios_cockpit.config import CockpitPaths
from aios_cockpit.models import ProjectCard
from aios_cockpit.workbench import (
create_task_from_candidate,
list_tasks,
prepare_run_preview,
propose_sprint_candidates,
route_task_record,
)
def test_propose_sprint_candidates_from_plan(tmp_path: Path) -> None:
(tmp_path / "README.md").write_text("# Demo", encoding="utf-8")
(tmp_path / "PLAN.md").write_text(
"- [ ] Add workbench route\n- [ ] Write smoke test\n",
encoding="utf-8",
)
project = ProjectCard(
name="Demo",
path=str(tmp_path),
category="project",
role="project",
status="active-recent",
)
candidates = propose_sprint_candidates(project)
assert candidates
assert candidates[0].title == "Add workbench route"
def test_task_persistence_and_run_preview(tmp_path: Path) -> None:
project_dir = tmp_path / "Project"
project_dir.mkdir()
paths = CockpitPaths(
cockpit_root=tmp_path / "Cockpit",
projects_dir=tmp_path,
samuel_os=tmp_path / "samuel-os-v2",
zentrale=tmp_path / "Zentrale",
komandozentral=tmp_path / "KomandoZentral",
prompt_garage_db=tmp_path / "PromptGarage" / "prompts.db",
codex_max_howto=tmp_path / "CodexMaxHarnessHowTo",
harness_db=tmp_path / "harness.db",
harness_ecosystem=tmp_path / "HarnessEcosystem",
)
project = ProjectCard(
name="Project",
path=str(project_dir),
category="project",
role="project",
status="active-recent",
)
task = create_task_from_candidate(
project,
title="Add route",
description="Add route to the workbench",
verification="pytest",
target_agent="codex",
tasks_dir=paths.tasks_dir,
)
route = route_task_record(task, paths)
preview = prepare_run_preview(task, paths)
assert list_tasks(paths.tasks_dir)[0].id == task.id
assert route.task == "Add route to the workbench"
assert preview.status == "ready"
assert "--dry-run" in preview.command
assert Path(preview.instructions_file).is_file()
|