@@ -63,6 +63,19 @@ def test_full_scan_skips_node_modules(tmp_path: Path) -> None:
6363 assert report .file_count == 1
6464
6565
66+ def test_full_scan_skips_generated_artifacts (tmp_path : Path ) -> None :
67+ artifacts = tmp_path / "artifacts"
68+ artifacts .mkdir ()
69+ (artifacts / "plan.md" ).write_text ("# generated plan\n " , encoding = "utf-8" )
70+ (tmp_path / "app.py" ).write_text ("print('hi')\n " , encoding = "utf-8" )
71+
72+ report = full_scan (tmp_path )
73+
74+ assert report .file_count == 1
75+ assert "artifacts/plan.md" not in report .file_metadata
76+ assert "app.py" in report .file_metadata
77+
78+
6679def test_full_scan_top_dirs (tmp_path : Path ) -> None :
6780 (tmp_path / "src" ).mkdir ()
6881 (tmp_path / "tests" ).mkdir ()
@@ -360,3 +373,22 @@ def test_extract_structure_skips_node_modules(tmp_path: Path) -> None:
360373 result = extract_structure (tmp_path )
361374 assert "node_modules" not in result
362375 assert "app.js" in result
376+
377+
378+ def test_extract_structure_skips_generated_state_and_artifacts (tmp_path : Path ) -> None :
379+ """Generated RepoBrain state and artifact files should not self-pollute."""
380+ rb_dir = tmp_path / ".repobrain"
381+ rb_dir .mkdir ()
382+ (rb_dir / "structure.md" ).write_text ("# previous structure\n " , encoding = "utf-8" )
383+ artifacts = tmp_path / "artifacts"
384+ artifacts .mkdir ()
385+ (artifacts / "plan.md" ).write_text ("# generated plan\n " , encoding = "utf-8" )
386+ (tmp_path / "src" ).mkdir ()
387+ (tmp_path / "src" / "app.py" ).write_text ("print('hi')\n " , encoding = "utf-8" )
388+
389+ result = extract_structure (tmp_path )
390+
391+ assert ".repobrain" not in result
392+ assert "artifacts" not in result
393+ assert "src" in result
394+ assert "app.py" in result
0 commit comments