fix(prompts): fix three infrastructure bugs in prompt dependency resolution

- ContentMacro: add __post_init__ to auto-derive raw_text when built
  programmatically, preventing str.replace("", X) corruption
- MacroParser: add @{target} shorthand syntax support mapped to REQUIRED kind,
  updating parse, has_macros, count_macros, and find_macro_positions
- Artifact: store content in model and SQLite DB, replace resolver placeholder
  with actual artifact content, add migration for existing databases

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-11 20:53:02 +01:00
parent 01b9596ce6
commit 706981c39f
9 changed files with 191 additions and 10 deletions

View File

@@ -46,6 +46,11 @@ class ContentMacro:
raw_text: str = ""
line_number: int = 0
def __post_init__(self) -> None:
"""Auto-derive raw_text when built programmatically."""
if not self.raw_text:
self.raw_text = f"@{{{self.target}}}"
def __str__(self) -> str:
"""String representation of macro."""
params = ''.join(f"|{k}={v}" for k, v in self.parameters.items())