Skip to content

feat: support rendering over an existing directory - #67

Closed
jvmakine wants to merge 1 commit into
block:mainfrom
jvmakine:juho/skip-strict-links
Closed

jvmakine wants to merge 1 commit into
block:mainfrom
jvmakine:juho/skip-strict-links

Conversation

@jvmakine

Copy link
Copy Markdown
Contributor

spectre init (block/spectre#55) re-renders a template into a service checkout on every run, and Alec pointed out it was duplicating scaffolder: rendering into a temp dir, walking it, and writing everything again. These changes let it scaffold straight into the checkout.

  • Skip(func(path string) bool) leaves a destination path untouched, so a caller can keep files a user has edited. It sees the path after template evaluation, and a skipped directory is not descended into.
  • AfterEach now also runs for symlinks, so it reports every path written. The caller uses that to delete files the template no longer renders.
  • ErrorOnMissingKey() fails on a key the context does not have, instead of writing <no value>.
  • JavaScript template functions return Go values rather than goja values, so a function returning an array can be ranged over.

🤖 Generated with Claude Code

Re-rendering a template into a directory it was rendered into before needs
a way to leave some existing files alone, to know every path written,
including symlinks, so the caller can delete what the template no longer
renders, and to fail on a mistyped key rather than write "<no value>".
JavaScript template functions also returned raw goja values, so a returned
array could not be ranged over.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@jvmakine
jvmakine requested a review from alecthomas as a code owner October 22, 2026 22:42
@jvmakine jvmakine closed this Oct 22, 2026
@jvmakine
jvmakine deleted the juho/skip-strict-links branch October 22, 2026 22:44
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.

1 participant