Skip to content

Fix template rendering: always render directives and cache git diff#13

Merged
hahwul merged 2 commits into
claude/feature-variable-aware-dynamic-templatesfrom
copilot/fix-comments-in-review-thread
May 27, 2026
Merged

Fix template rendering: always render directives and cache git diff#13
hahwul merged 2 commits into
claude/feature-variable-aware-dynamic-templatesfrom
copilot/fix-comments-in-review-thread

Conversation

Copilot AI commented May 27, 2026

Copy link
Copy Markdown

Template directives ({{.File}}, {{.GitDiff}}) were only rendered when --var was passed, because rendering was gated on vars being non-nil. Additionally, multiple {{.GitDiff}} occurrences triggered redundant git diff subprocess calls.

  • util.cr: PromptInput.resolve now always calls TemplateRenderer.render, passing an empty hash when no vars are provided
  • retry.cr: Same fix — rendering no longer conditional on vars presence
  • template_renderer.cr: Compute git diff once per render call and reuse via String#gsub instead of invoking get_git_diff per regex match
# Before: directives silently ignored without --var
cjules new --template my-template "do something"

# After: {{.File "path"}} and {{.GitDiff}} resolve correctly regardless of --var

- util.cr: Always call TemplateRenderer.render even when vars is nil,
  so {{.File}} and {{.GitDiff}} work without --var
- retry.cr: Same fix for retry command's template rendering
- template_renderer.cr: Compute git diff once per render call and reuse
  via string replace instead of calling get_git_diff per regex match
Copilot AI changed the title [WIP] Fix code based on review comments Fix template rendering: always render directives and cache git diff May 27, 2026
Copilot finished work on behalf of hahwul May 27, 2026 12:39
Copilot AI requested a review from hahwul May 27, 2026 12:39
@hahwul hahwul marked this pull request as ready for review May 27, 2026 14:24
@hahwul hahwul merged commit 6be744f into claude/feature-variable-aware-dynamic-templates May 27, 2026
@hahwul hahwul deleted the copilot/fix-comments-in-review-thread branch May 27, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants