feat(presets): Composition strategies (prepend, append, wrap) for templates, commands, and scripts#2133
Draft
feat(presets): Composition strategies (prepend, append, wrap) for templates, commands, and scripts#2133
Conversation
11 tasks
… templates, commands, and scripts - Add strategy field validation in PresetManifest._validate() - Add VALID_PRESET_STRATEGIES and VALID_SCRIPT_STRATEGIES constants - Add PresetResolver.resolve_content() for composed content resolution - Add PresetResolver._collect_all_layers() for full priority stack - Update _register_commands() to compose before writing - Update CLI preset resolve command to show composition chain - Add resolve_template_content() to bash common.sh - Add Resolve-TemplateContent to PowerShell common.ps1 - Update scaffold preset.yml with strategy documentation - Update presets/README.md and ARCHITECTURE.md - Add 26 unit tests covering validation, composition, and chaining Agent-Logs-Url: https://github.com/github/spec-kit/sessions/c285c51b-f00b-480a-9eb2-ae70e3cbcb72 Co-authored-by: mnriem <15701806+mnriem@users.noreply.github.com>
…, improve default strategy test Agent-Logs-Url: https://github.com/github/spec-kit/sessions/c285c51b-f00b-480a-9eb2-ae70e3cbcb72 Co-authored-by: mnriem <15701806+mnriem@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add composition strategies for templates, commands, and scripts
feat(presets): Composition strategies (prepend, append, wrap) for templates, commands, and scripts
Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Presets can now augment lower-priority templates instead of only fully replacing them. A new optional
strategyfield inpreset.ymlcontrols how content is composed across the priority stack.replaceprependappendwrap{CORE_TEMPLATE}/$CORE_SCRIPTplaceholder substitutionMultiple composing presets chain recursively (e.g. security
prepend+ complianceappend→ header + core + footer).Python resolver (
src/specify_cli/presets.py)VALID_PRESET_STRATEGIES/VALID_SCRIPT_STRATEGIESconstants; validation in_validate()rejectsprepend/appendfor scriptsPresetResolver._collect_all_layers()— walks full priority stack, reads strategy from each preset manifestPresetResolver.resolve_content()— bottom-up composition across layersPresetManager._register_commands()— composes command content before writing to agent directoriesShell resolvers
resolve_template_content()inscripts/bash/common.shResolve-TemplateContentinscripts/powershell/common.ps1CLI
specify preset resolveshows composition chain when non-replace strategies are presentDocumentation
presets/scaffold/preset.yml— strategy field docs and composition examplespresets/README.md— composition strategies section; moved implemented items out of future considerationspresets/ARCHITECTURE.md— strategy table and content resolution function referencesTests
resolve_content()for each strategy × type, multi-preset chaining, override precedence, separator behavior,_collect_all_layers()ordering