Skip to content

feat(init): run a template's template.js before rendering - #57

Merged
jvmakine merged 1 commit into
mainfrom
juho/init-template-js
Oct 23, 2026
Merged

jvmakine merged 1 commit into
mainfrom
juho/init-template-js

Conversation

@jvmakine

Copy link
Copy Markdown
Collaborator

spectre init with missing --var values failed partway through rendering, for example on split .egress_hosts. It left a partial spectre/ directory behind and named only the first missing variable.

init now enables scaffolder's JavaScript extension. A template can ship a template.js that runs before anything is written, with the variables in context. It throws to stop the run, so a template can list every missing or invalid variable with its help text. The script is not copied into the output.

The extension pulls in goja, which adds about 5 MB to the binary.

🤖 Generated with Claude Code

A run with missing --var values failed halfway through rendering, leaving a
partial spectre directory and naming only the first missing variable. Running
scaffolder's JavaScript extension lets a template check its variables first and
report all of them before anything is written.

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 23:58
@jvmakine
jvmakine merged commit 9897f2d into main Oct 23, 2026
6 checks passed
@jvmakine
jvmakine deleted the juho/init-template-js branch October 23, 2026 00:06
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