Template Subscriber Migration System
Template Subscriber Migration System helps one template repository publish migration bundles and many subscriber repositories decide how to apply them.
Use it when repositories start from a shared template, but later drift because each subscriber has local product code, configuration, or style choices.
Workflow
Section titled “Workflow”- A template PR merges.
- A template maintainer runs
publish-template-migration <PR number>. - The tool reads the merged PR, changed files, and full patch.
- If requested, the tool generates one reusable summary of the template changes.
- The tool creates
migration-bundle.json. - The tool publishes a GitHub Release tagged
template-migration/pr-N-sha. - The subscriber workflow runs
subscriber-template-sync. - The tool finds the newest upstream migration release.
- The tool skips the migration if it was already opened, applied, or declined.
- The tool opens a draft PR in the subscriber repository.
- A maintainer comments on the PR with
/template-sync approve,/template-sync revise, or/template-sync decline. - The command workflow runs
handle-template-sync-command. - The tool checks that the commenter has
write,maintain, oradminpermission. - If the command is
decline, the tool closes the PR and marks the migration declined. - If the command is
approveorrevise, the tool checks out the migration PR branch. - The tool collects subscriber context: affected files and config files.
- The tool builds an OpenAI prompt from the bundle, repo context, drift, and maintainer instructions.
- OpenAI returns JSON file operations:
create,update, ordelete. - The tool validates the JSON and safe paths.
- The tool writes the generated file changes.
- The tool skips lockfile refresh and subscriber package scripts in the privileged command workflow.
- The tool commits, pushes, and comments with a summary.
- The tool marks the migration applied in repository variables.
- Normal PR CI or local review validates the generated branch without exposing template sync secrets to generated code.
Package Commands
Section titled “Package Commands”The package exposes three binaries:
| Command | Runs in | Purpose |
|---|---|---|
publish-template-migration | Template repository | Publishes a migration release for a merged template PR. |
subscriber-template-sync | Subscriber repository | Opens a draft migration PR for the newest migration. |
handle-template-sync-command | Subscriber repository | Handles approve, revise, and decline comments. |
Start Here
Section titled “Start Here”- Getting started shows a full setup.
- Template setup explains publishing migrations.
- Subscriber setup explains discovery and PR creation.
- Commands lists CLI inputs and environment variables.