feat: add content target type for writing literal text to files
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:
parent
fda28b5afa
commit
bb03975ece
5 changed files with 163 additions and 10 deletions
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue