Skip to content

feat(scripts): add template_backport to auto-PR improvements into template#6

Merged
sksizer merged 1 commit into
mainfrom
feat/template-backport
Apr 7, 2026
Merged

feat(scripts): add template_backport to auto-PR improvements into template#6
sksizer merged 1 commit into
mainfrom
feat/template-backport

Conversation

@sksizer

@sksizer sksizer commented Apr 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • New write-capable companion to `template_review`: harvests high-confidence generalizable improvements from a downstream project and opens a PR back to the template.
  • `scripts/template_backport.sh` clones the template fresh into a tempdir (user's working copy is never touched), exports `DOWNSTREAM_DIR` + `DOWNSTREAM_NAME`, then runs Claude with `Read Edit Write Bash` to:
    1. Diff shared infrastructure against the downstream
    2. Classify each hunk conservatively as BACKPORT or SKIP (checks downstream `git log` for intent)
    3. Apply BACKPORT hunks, run `just full-check`, revert anything that fails
    4. Branch, commit, push, and open a PR via `gh` — one PR per downstream
  • Hard-excludes project-specific files (`Cargo.toml`, `src/`, `README.md`, `LICENSE.md`, `scripts/downstream.txt`).
  • If zero candidates survive classification or checks, exits cleanly with no PR.
  • `scripts/template_backport_all.sh` fans the above out over `downstream.txt` in parallel.
  • `justfile`: adds `template-backport` (`tb`) and `template-backport-all` (`tba`).

Test plan

  • `just tb path/to/downstream` (dry run) prints composed prompt
  • `just tb --execute path/to/downstream` clones the template into a tempdir, applies only safe changes, and either opens a PR or reports "no candidates"
  • `just tba --execute` runs across all downstream repos and opens one PR each where applicable
  • Verify working copy of the template repo is never modified during `--execute` runs

…plate

template_backport.sh clones the template fresh into a tempdir (never
touching the user's working copy), then runs Claude with Edit/Write/Bash
to harvest high-confidence generalizable improvements from a downstream
clone, apply them, run 'just full-check', and open a PR via gh. Claude
classifies each diff conservatively (BACKPORT vs SKIP) and reverts any
change that fails checks. Project-specific files are hard-excluded.

template_backport_all.sh fans this out over downstream.txt in parallel,
producing one PR per downstream repo. Exposed via 'just tb' / 'just tba'.
@sksizer
sksizer force-pushed the feat/template-backport branch from 9fae71a to a84e8c5 Compare April 7, 2026 17:06
@sksizer
sksizer merged commit 9d639f7 into main Apr 7, 2026
1 check passed
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