Skip to content

Commit 2ab4736

Browse files
Highlight final products in command summaries
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
1 parent 891761a commit 2ab4736

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed

src/code2skill/domain/results.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class CommandRunSummary:
2929
generated_skills: list[str] = field(default_factory=list)
3030
report_path: Path | None = None
3131
notes: list[str] = field(default_factory=list)
32+
final_product_paths: list[Path] = field(default_factory=list)
33+
intermediate_artifact_paths: list[Path] = field(default_factory=list)
3234
updated_paths: list[Path] = field(default_factory=list)
3335
written_paths: list[Path] = field(default_factory=list)
3436

@@ -52,6 +54,8 @@ def summarize_scan_execution(command: str, result: "ScanExecution") -> CommandRu
5254
generated_skills=list(result.generated_skills),
5355
report_path=result.report_path,
5456
notes=list(report.notes) if report is not None else [],
57+
final_product_paths=[Path(path) for path in report.final_product_files] if report is not None else [],
58+
intermediate_artifact_paths=[Path(path) for path in report.intermediate_artifact_files] if report is not None else [],
5559
updated_paths=[Path(path) for path in report.updated_files] if report is not None else [],
5660
written_paths=list(result.output_files),
5761
)
@@ -66,5 +70,6 @@ def summarize_adapt_result(
6670
repo_path=request.repo_path,
6771
target=request.target,
6872
source_dir=request.source_dir,
73+
final_product_paths=list(written_paths),
6974
written_paths=list(written_paths),
7075
)

src/code2skill/product/cli_summary.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ def render_summary_lines(summary: CommandRunSummary) -> list[str]:
3434
lines.append(f"output_dir: {summary.output_dir}")
3535
if summary.report_path is not None:
3636
lines.append(f"report: {summary.report_path}")
37+
if summary.final_product_paths:
38+
lines.append(f"final_products: {len(summary.final_product_paths)}")
39+
lines.extend(f"final_product: {path}" for path in summary.final_product_paths)
40+
if summary.intermediate_artifact_paths:
41+
lines.append(f"intermediate_artifacts: {len(summary.intermediate_artifact_paths)}")
3742
lines.extend(f"note: {note}" for note in summary.notes)
3843
lines.extend(f"updated: {path}" for path in summary.updated_paths)
3944
lines.extend(f"wrote: {path}" for path in summary.written_paths)

tests/test_cli_summary.py

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
from pathlib import Path
44

5-
from code2skill.domain.results import CommandRunSummary, summarize_scan_execution
5+
from code2skill.domain.results import CommandRunSummary, summarize_adapt_result, summarize_scan_execution
66
from code2skill.models import CostEstimateSummary, ExecutionReport, ImpactSummary, ScanExecution
77
from code2skill.models import ImportGraphStats, ProjectProfile, SkillBlueprint
88
from code2skill.product.cli_summary import render_summary_lines
9+
from code2skill.workflows.requests import AdaptRequest
910

1011

1112
def test_render_summary_lines_prints_command_mode_repo_and_writes() -> None:
@@ -52,6 +53,30 @@ def test_render_summary_lines_includes_report_metadata_and_notes() -> None:
5253
assert f"updated: {Path('/repo/.code2skill/skills/backend.md')}" in lines
5354

5455

56+
def test_render_summary_lines_emphasizes_final_products_and_intermediate_counts() -> None:
57+
summary = CommandRunSummary(
58+
command="scan",
59+
mode="full",
60+
repo_path=Path("/repo"),
61+
output_dir=Path("/repo/.code2skill"),
62+
final_product_paths=[
63+
Path("/repo/.code2skill/skills/index.md"),
64+
Path("/repo/.code2skill/skills/backend.md"),
65+
],
66+
intermediate_artifact_paths=[
67+
Path("/repo/.code2skill/skill-plan.json"),
68+
Path("/repo/.code2skill/report.json"),
69+
],
70+
)
71+
72+
lines = render_summary_lines(summary)
73+
74+
assert "final_products: 2" in lines
75+
assert f"final_product: {Path('/repo/.code2skill/skills/index.md')}" in lines
76+
assert f"final_product: {Path('/repo/.code2skill/skills/backend.md')}" in lines
77+
assert "intermediate_artifacts: 2" in lines
78+
79+
5580
def test_summarize_scan_execution_includes_report_metadata() -> None:
5681
blueprint = SkillBlueprint(
5782
project_profile=ProjectProfile(
@@ -114,6 +139,8 @@ def test_summarize_scan_execution_includes_report_metadata() -> None:
114139
llm_provider="qwen",
115140
llm_model="qwen-plus-latest",
116141
notes=["reused incremental state"],
142+
final_product_files=["/repo/.code2skill/skills/backend.md"],
143+
intermediate_artifact_files=["/repo/.code2skill/report.json"],
117144
)
118145
execution = ScanExecution(
119146
repo_path=Path("/repo"),
@@ -138,3 +165,16 @@ def test_summarize_scan_execution_includes_report_metadata() -> None:
138165
assert summary.llm_model == "qwen-plus-latest"
139166
assert summary.notes == ["reused incremental state"]
140167
assert summary.updated_paths == [Path("/repo/.code2skill/skills/backend.md")]
168+
assert summary.final_product_paths == [Path("/repo/.code2skill/skills/backend.md")]
169+
assert summary.intermediate_artifact_paths == [Path("/repo/.code2skill/report.json")]
170+
171+
172+
def test_summarize_adapt_result_treats_written_targets_as_final_products(tmp_path: Path) -> None:
173+
repo_path = tmp_path / "repo"
174+
repo_path.mkdir()
175+
request = AdaptRequest.create(repo_path=repo_path, target="codex")
176+
177+
summary = summarize_adapt_result(request, [repo_path / "AGENTS.md"])
178+
179+
assert summary.final_product_paths == [repo_path / "AGENTS.md"]
180+
assert summary.intermediate_artifact_paths == []

0 commit comments

Comments
 (0)