22
33from 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
66from code2skill .models import CostEstimateSummary , ExecutionReport , ImpactSummary , ScanExecution
77from code2skill .models import ImportGraphStats , ProjectProfile , SkillBlueprint
88from code2skill .product .cli_summary import render_summary_lines
9+ from code2skill .workflows .requests import AdaptRequest
910
1011
1112def 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+
5580def 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