feat(aggregate): support dictionary-based file entries with optional tiers

This commit is contained in:
2026-02-27 22:21:18 -05:00
parent 4c744f2c8e
commit 2ece9e1141
2 changed files with 62 additions and 8 deletions

View File

@@ -66,3 +66,44 @@ def test_build_tier3_context_exists():
# Let's check for the header
assert "other.py" in result
assert "AST Skeleton" in result
def test_build_file_items_with_tiers(tmp_path):
from aggregate import build_file_items
# Create some dummy files
file1 = tmp_path / "file1.txt"
file1.write_text("content1")
file2 = tmp_path / "file2.txt"
file2.write_text("content2")
files_config = [
"file1.txt",
{"path": "file2.txt", "tier": 3}
]
items = build_file_items(tmp_path, files_config)
assert len(items) == 2
item1 = next(i for i in items if i["entry"] == "file1.txt")
assert item1["content"] == "content1"
assert "tier" in item1
assert item1["tier"] is None
item2 = next(i for i in items if i["entry"] == "file2.txt")
assert item2["content"] == "content2"
assert item2["tier"] == 3
def test_build_files_section_with_dicts(tmp_path):
from aggregate import build_files_section
file1 = tmp_path / "file1.txt"
file1.write_text("content1")
files_config = [
{"path": str(file1)}
]
result = build_files_section(tmp_path, files_config)
assert "content1" in result
assert "file1.txt" in result