feat(templates): optional templates + a plugin-release template#13
Merged
Conversation
Implements spec/plan 0005. Trellis can now ship opt-in templates beyond its universal rules, and ships the first one: plugin-release. Optional templates: - /trellis-install --template <name> adds a bundle from trellis/templates/<name>/; plain /trellis-update then maintains it via a docs/rules/.trellis-templates registry (no flag needed), exactly as it maintains rules. - A template splits into owned/ (refreshed on update) and seed/ (copied once, then the consumer's). The boundary is one-way - no consumer-editable content lives in an owned file - so a clobbering refresh is always safe. - Drops the old unconditional docs/templates/ seeding in both skills. plugin-release template (owned/ + seed/): - scripts/bump-version.sh: single-source VERSION mirrored into every manifest listed in a consumer-owned .version-manifests; --check fails CI on drift; semver-only (multiline-hardened); format-preserving; validates in memory then writes VERSION last. - .github/workflows/release.yml: standalone, triggered by workflow_run on the consumer's CI workflow success on main (portable - no job-name coupling); job-scoped contents: write; SHA-pinned checkout; idempotent gh release create from docs/releases/<v>.md else --generate-notes. - docs/releases/README.md convention; seed VERSION + .version-manifests. Trellis self-adoption (dogfood): - Root VERSION 0.4.0; .version-manifests lists its 7 manifests (bumped 0.3.0 -> 0.4.0 via the new script); functional copies of the owned files. - New CI workflow runs the test suites, bump-version.sh --check, and a dogfood diff (installed copies must equal the template source); release.yml gates on it. - trellis/scripts/bump-version.test.sh (POSIX, dash-clean): 18 checks incl. negative drift, two-token guard, missing-manifest, multiline reject. Bakes in all five findings from Spectra's reviewed-but-closed PR #28. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Addresses review findings on the plugin-release template: - security: the release job's workflow_run guard checked conclusion + head_branch == 'main' only. A fork PR whose branch is named 'main' would satisfy head_branch, letting its CI completion reach the contents: write token. Add `workflow_run.event == 'push'` - fork PRs run CI as 'pull_request', so they are now excluded. head_branch stays as defense in depth. - architecture: the one consumer-specific value (workflows: ["CI"]) lives in release.yml, which is owned and clobbered on update - so a consumer edit would be lost. Make the contract "name your CI workflow CI" and document not to edit the owned file (template + plugin-release READMEs, release.yml header). - tests: add a write-atomicity case (a two-token manifest aborts the whole write - VERSION and good manifests unchanged) and a .version-manifests comment/blank-line parsing case. bump-version.test.sh now 22 checks. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Author
Review noteThe four persona review sub-agents (engineer/tester/architect/security) stalled twice on an infrastructure watchdog timeout and could not post. Rather than block, I performed a rigorous adversarial review inline across the four facets. It surfaced three real findings, all now fixed in 6c1e221:
Verified clean: |
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.
Implements spec/plan 0005. Trellis gains optional, opt-in templates beyond its universal rules, and ships the first one: plugin-release.
Optional templates (new capability)
/trellis-install --template <name>adds a bundle fromtrellis/templates/<name>/. Plain/trellis-updatethen keeps it current via adocs/rules/.trellis-templatesregistry - no flag needed, exactly as it maintains rules.owned/(Trellis refreshes on update) andseed/(copied once, then the consumer's). One-way boundary: no consumer-editable content lives in an owned file, so a clobbering refresh is always safe.docs/templates/seeding from both skills.trellis/templates/README.md.plugin-release template
For repos that are themselves published marketplace plugins:
scripts/bump-version.sh(owned) - single-sourceVERSIONmirrored into every manifest in a consumer-owned.version-manifests;--checkfails CI on drift; semver-only (multiline-hardened); format-preserving; validates in memory then writesVERSIONlast..github/workflows/release.yml(owned) - standalone, triggered byworkflow_runon the consumer's CI workflow succeeding onmain(portable - no job-name coupling); job-scopedcontents: write; SHA-pinned checkout; idempotent; notes fromdocs/releases/<v>.mdelse--generate-notes.docs/releases/README.mdconvention (owned);VERSION+.version-manifests(seed).Trellis self-adoption (dogfood)
VERSION0.4.0;.version-manifestslists its 7 manifests (bumped0.3.0->0.4.0via the new script - they were hand-synced before).CIworkflow runs the test suites,bump-version.sh --check, and a dogfood diff (installed copies must equal the template source);release.ymlgates on it.trellis/scripts/bump-version.test.sh(POSIX, dash-clean): 18 checks incl. negative drift, two-token guard, missing-manifest, multiline reject.All five findings from Spectra's reviewed-but-closed PR #28 are baked in (notably: the concurrency-cancel race dissolves because a standalone
workflow_runworkflow has its own run identity).Testing
bump-version.test.sh18/18 andcheck-compliance.test.sh20/20 (undershanddash);bump-version.sh --checkclean across all 7 manifests; repo passes the em/en-dash compliance ban; all manifests parse.🤖 Generated with Claude Code