feat: add prompt placeholder substitution with {filename} syntax

This commit is contained in:
Konstantin Fickel 2026-02-20 21:12:16 +01:00
parent 760eac5a7b
commit 3de3614433
Signed by: kfickel
GPG key ID: A793722F9933C1A5
6 changed files with 274 additions and 33 deletions

View file

@ -194,3 +194,30 @@ class TestGetSubgraphForTarget:
assert sub.has_edge("input.txt", "summary.md")
assert sub.has_edge("summary.md", "final.txt")
def test_placeholder_files_in_graph(
self, project_dir: Path, write_config: WriteConfig
) -> None:
_ = (project_dir / "style.txt").write_text("impressionist")
config = write_config(
{
"targets": {
"out.txt": {"prompt": "Paint in {style.txt} style"},
}
}
)
graph = build_graph(config, project_dir)
assert graph.has_edge("style.txt", "out.txt")
def test_escaped_placeholder_not_in_graph(
self, project_dir: Path, write_config: WriteConfig
) -> None:
config = write_config(
{
"targets": {
"out.txt": {"prompt": "Literal \\{not_a_dep.txt}"},
}
}
)
graph = build_graph(config, project_dir)
assert "not_a_dep.txt" not in graph.nodes