diff --git a/docs/validate.md b/docs/validate.md index caf5789..1510adf 100644 --- a/docs/validate.md +++ b/docs/validate.md @@ -35,7 +35,7 @@ login. | `--repeat N` | Consensus runs for every agent check (overrides the graph). | | `--json` | Stream newline-delimited JSON events to stdout. | | `--junit PATH` | Also write JUnit XML. | -| `--out DIR` | Output directory (default `.copperpilot/validate/`). | +| `--out DIR` | Relative output paths start in the current working directory. The default is `.copperpilot/validate/` in the workspace. | | `--emit-fix-prompt` | Also print a ready message for `copper-pilot -n --mode agent -y -m "..."`. | ## Exit codes diff --git a/src/copper_pilot_cli/validate/runner.py b/src/copper_pilot_cli/validate/runner.py index 26e5b02..8ecc749 100644 --- a/src/copper_pilot_cli/validate/runner.py +++ b/src/copper_pilot_cli/validate/runner.py @@ -184,7 +184,7 @@ def __init__( self.snapshot_root = snapshot_root self.profile_name, self.profile = config.profile(options.profile) self.results: dict[str, CheckResult] = {} - self.out_dir = options.out_dir or workspace / ".copperpilot" / "validate" + self.out_dir = (options.out_dir or workspace / ".copperpilot" / "validate").resolve() self.cache_dir = self.out_dir / "cache" self.run_id = f"{datetime.now(UTC).strftime('%Y%m%dT%H%M%SZ')}-{uuid.uuid4().hex[:8]}" self.run_dir = self.out_dir / "runs" / self.run_id diff --git a/tests/test_validate.py b/tests/test_validate.py index 9042529..39dd1ef 100644 --- a/tests/test_validate.py +++ b/tests/test_validate.py @@ -590,6 +590,14 @@ def test_extract_last_json_block_and_parse() -> None: assert findings[0].title == "C = 22 uF * 0.8" and findings[0].detail == "a_b" +def test_relative_report_directory_is_resolved_before_kicad_changes_cwd(tmp_path, monkeypatch): + monkeypatch.chdir(tmp_path) + workspace = tmp_path / "project" + workspace.mkdir() + runner = runner_for(workspace, options=RunOptions(out_dir=Path("reports"))) + assert runner.run_dir.parent == tmp_path / "reports" / "runs" + + def test_fan_out_collapses_identical_parts_and_skips_dnp() -> None: index = build_index(NETLIST, json.dumps(PROJECT), PCB) config = build_config(packaged_default_raw())