Add self-scoping assessment export command

This commit is contained in:
2026-05-15 12:39:51 +02:00
parent bc08977f85
commit 2796fc5816
10 changed files with 934 additions and 19 deletions

View File

@@ -1,3 +1,5 @@
import json
import pytest
from repo_registry.cli import main
@@ -98,3 +100,34 @@ def test_rebuild_cli_refuses_destructive_all_without_confirm_all(tmp_path):
)
assert exc.value.code == 2
def test_export_assessment_cli_writes_completed_run_artifact(tmp_path):
service = make_service(tmp_path)
source = write_repo(tmp_path)
repository = service.register_repository(name="CLI Export", url=str(source))
summary = service.analyze_repository(repository.id, use_llm_assistance=False)
output_path = tmp_path / "assessment.json"
exit_code = main(
[
"export-assessment",
"--repo",
str(repository.id),
"--analysis-run",
str(summary.analysis_run.id),
"--output",
str(output_path),
"--database-path",
str(tmp_path / "registry.sqlite3"),
"--checkout-root",
str(tmp_path / "checkouts"),
]
)
artifact = json.loads(output_path.read_text(encoding="utf-8"))
assert exit_code == 0
assert artifact["target_repository"]["repo_slug"] == "cli-export"
assert artifact["execution"]["analysis_run_id"] == summary.analysis_run.id
assert artifact["assessment"]["role"] == "challenger"
assert artifact["generated_tree"]["abilities"]