feat: add content target type for writing literal text to files
All checks were successful
Continuous Integration / Build Package (push) Successful in 43s
Continuous Integration / Lint, Check & Test (push) Successful in 1m1s

Content targets write a string directly to the output file without
invoking any AI provider. They don't require API keys and are not
archived when overwritten.

Example usage in .hokusai.yaml:
  file.txt:
    content: ABC
This commit is contained in:
Konstantin Fickel 2026-02-21 18:14:09 +01:00
parent fda28b5afa
commit bb03975ece
Signed by: kfickel
GPG key ID: A793722F9933C1A5
5 changed files with 163 additions and 10 deletions

View file

@ -7,7 +7,7 @@ from pathlib import Path
import pytest
import yaml
from hokusai.config import GenerateTargetConfig, load_config
from hokusai.config import ContentTargetConfig, GenerateTargetConfig, load_config
class TestLoadConfig:
@ -83,3 +83,14 @@ class TestLoadConfig:
with pytest.raises(Exception):
_ = load_config(config_path)
def test_content_target(self, project_dir: Path) -> None:
config_path = project_dir / "test.hokusai.yaml"
_ = config_path.write_text(
yaml.dump({"targets": {"file.txt": {"content": "ABC"}}})
)
config = load_config(config_path)
target = config.targets["file.txt"]
assert isinstance(target, ContentTargetConfig)
assert target.content == "ABC"