Skip to content

feat: manifest driven template engine#1

Merged
f0oster merged 5 commits intomainfrom
feature/manifest-driven-templates
Apr 18, 2026
Merged

feat: manifest driven template engine#1
f0oster merged 5 commits intomainfrom
feature/manifest-driven-templates

Conversation

@f0oster
Copy link
Copy Markdown
Owner

@f0oster f0oster commented Apr 18, 2026

Replace the hardcoded parameter, prompt, and validation logic with a manifest-driven system.

New-AnvilModule gains a -Template parameter for scaffolding from custom templates. Users can point it at any directory containing a valid template.psd1 and the engine will prompt for parameters, validate input, apply conditions, and produce the output. The built-in nodule template is now an instance of the same system.

The scaffold template configuration has been (mostly) decoupled from Anvil's source code as a result. The template directory contains template.psd1 which declares the template parameters, conditions, sections, and layers.

Template engine changes:

  • Invoke-TemplateEngine supports IncludeWhen/ExcludeWhen file conditions and conditional content sections via <%#section%> markers
  • Module template configuration moved to template.psd1 manifest
  • Token replacement renamed from ModuleName to Name throughout templates
  • File/license/docs exclusion handled by manifest conditions instead of post-processing deletes
  • CI provider layering driven by manifest Layers declaration
  • Docs task conditionally included via template sections
  • Get-AnvilTemplate reads manifest metadata and discovers layers from manifest declarations rather than scanning for a CI directory
  • .gitattributes added to template for consistent line endings
  • Git init no longer stages and commits automatically
  • Git init and Docs are now enabled by default.

New private functions:

  • Test-ManifestCondition, Test-FileCondition (condition evaluation)
  • Resolve-TemplateSections (conditional content blocks)
  • Format-TokenValue, Resolve-AutoToken (token formatting pipeline)
  • Invoke-ManifestPrompt, Assert-ManifestConfiguration (manifest-driven prompt and validation, replacing Invoke-InteractivePrompt and Assert-ValidConfiguration)
  • Read-TemplateManifest, Assert-TemplateManifest (manifest loading and schema validation)
  • Convert-PromptResult, Resolve-DefaultFrom, Read-PromptUri (helpers)

New public functions:

  • Invoke-AnvilBuild (wrapper around InvokeBuild, resolves project root)

Removed:

  • Invoke-InteractivePrompt, Assert-ValidConfiguration, Copy-CITemplates
  • getting-started/ directory no longer ships with scaffolded projects

Documentation:

  • Consolidated docs and readme to flow better
  • Rewrote scaffolded project README
  • Added template-authoring.md guide
  • Updated all user-facing references to use Invoke-AnvilBuild
  • Added CompatiblePSEditions to module manifest template

f0oster added 5 commits April 18, 2026 20:34
Replace the hardcoded parameter, prompt, and validation logic with a
manifest-driven system. Each template directory now contains a
template.psd1 that declares its parameters, conditions, sections, and
layers. The engine processes any conforming manifest without
special-casing.

The Module template's configuration is decoupled from Anvil's source
code. Parameter definitions, defaults, validation rules, file
conditions, and CI layer declarations now live in template.psd1 rather
than being spread across New-AnvilModule, Invoke-InteractivePrompt, and
Assert-ValidConfiguration.

New-AnvilModule gains a -Template parameter for scaffolding from custom
templates. Users can point it at any directory containing a template.psd1
and the engine will prompt for parameters, validate input, apply
conditions, and produce the output — no Anvil source changes needed.
The built-in Module template is now an instance of the same system.

Template engine changes:
- Invoke-TemplateEngine supports IncludeWhen/ExcludeWhen file conditions
  and conditional content sections via <%#section%> markers
- Module template configuration moved to template.psd1 manifest
- Token replacement renamed from ModuleName to Name throughout templates
- File/license/docs exclusion handled by manifest conditions instead of
  post-processing deletes
- CI provider layering driven by manifest Layers declaration
- Docs task conditionally included via template sections
- Get-AnvilTemplate reads manifest metadata and discovers layers from
  manifest declarations rather than scanning for a CI directory
- .gitattributes added to template for consistent line endings
- Git init no longer stages and commits automatically

New private functions:
- Test-ManifestCondition, Test-FileCondition (condition evaluation)
- Resolve-TemplateSections (conditional content blocks)
- Format-TokenValue, Resolve-AutoToken (token formatting pipeline)
- Invoke-ManifestPrompt, Assert-ManifestConfiguration (manifest-driven
  prompt and validation, replacing Invoke-InteractivePrompt and
  Assert-ValidConfiguration)
- Read-TemplateManifest, Assert-TemplateManifest (manifest loading and
  schema validation)
- Convert-PromptResult, Resolve-DefaultFrom, Read-PromptUri (helpers)

New public functions:
- Invoke-AnvilBuild (wrapper around InvokeBuild, resolves project root)

Removed:
- Invoke-InteractivePrompt, Assert-ValidConfiguration, Copy-CITemplates
- getting-started/ directory no longer ships with scaffolded projects

Documentation:
- Consolidated docs and readme to flow better
- Rewrote scaffolded project README
- Added template-authoring.md guide
- Updated all user-facing references to use Invoke-AnvilBuild
- Added CompatiblePSEditions to module manifest template
@f0oster f0oster merged commit d37680e into main Apr 18, 2026
3 checks passed
@f0oster f0oster deleted the feature/manifest-driven-templates branch April 18, 2026 15:17
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