propagate-template
GitHub将模板仓库的 main 分支内容自动同步到多个分叉的 Store 仓库,通过文件级比对实现无共同 Git 历史的内容合并与更新。
Trigger Scenarios
Install
npx skills add yournextstore/yournextstore --skill propagate-template -g -y
SKILL.md
Frontmatter
{
"name": "propagate-template",
"description": "Propagate the template's current main into forked AI-store repos (yns-store-* in the tenants org), updating every file the store never customized and reporting the rest. Content-level reconcile — store repos share NO git history with the template. Use for \"template rebase\", \"propagate template\", \"sync store repos\", after landing template changes that existing stores must pick up. Takes an optional list of store subdomains; defaults to every builder store."
}
Propagate template main into forked store repos
You may be running autonomously across many repos. Do not ask questions — decide, act, and report. If one store fails, record it and move on to the next.
Architecture facts (do not rediscover these)
- Store repos are
yns-store-<subdomain>in the GitHub orgyns-cx-tenants(staging / yns.cx) oryns-store-tenants(production / yns.store). Access viagh. - Store repos share no git history with this template. Provisioning copies template files
into a fresh repo without upstream parents (see the platform's
src/lib/sandbox/fork-builder.ts). Never attemptgit rebase/git mergeagainst the template — this skill reconciles content, file by file. - Stores may have been seeded from a
theme-*branch, and Elliot edits files freely afterwards. The only files Elliot cannot touch are the managed paths (proxy.ts,lib/track.tsx,instrumentation-client.ts— the platform'sMANAGED_STOREFRONT_PATHS): the platform's commit script restores those from the store repo's ownorigin/mainon every save, so landing the template's version on the store's main IS the propagation mechanism for them. - Pushing to a store repo's
maintriggers a production redeploy of that tenant storefront, and it is safe with respect to live builder sandboxes: their save script fetches and rebases ontoFETCH_HEAD, aborting cleanly on conflict. .env*files are per-store secrets. Never read, modify, or commit them.
Inputs
- Optional: a list of store subdomains (e.g.
base celeste) and/or the org to target. Default: staging org, all builder stores. - Enumerate builder stores from the platform DB when available (source of truth):
SELECT subdomain FROM stores WHERE builder_config IS NOT NULL;— otherwisegh repo list <org> --limit 200 --json nameand strip theyns-store-prefix.
Per-store algorithm
Work from a checkout of this template repo with full history and all branches fetched
(git fetch origin "+refs/heads/*:refs/remotes/origin/*"). Clone each store repo into a
temp dir (gh repo clone <org>/yns-store-<subdomain> <tmp> -- --depth=1).
The decision rule for every path is "has the store ever customized this file?", answered
by blob-hash comparison against the template origin/main history:
# all historical blob hashes of a path on template main (cache per path):
git -C <template> log origin/main --format=%H -- <path> \
| while read sha; do git -C <template> rev-parse -q --verify "$sha:<path>"; done | sort -u
# the store's current blob:
git -C <store> hash-object <path>
Matching only a theme-* blob (not any main-history blob) counts as customized — theme
identity must never be flattened onto main's look.
Then, per path:
- Managed paths (
proxy.ts,lib/track.tsx,instrumentation-client.ts): overwrite with template main's version unconditionally. - Path exists in template main and the store's copy differs: if the store blob matches
some main-history blob → replace with template main's version. Otherwise → leave it,
record as
skipped (customized). - Path exists in the store but not in template main (template deleted it): if the store
blob matches some main-history blob → delete it. Otherwise → leave, record as
skipped (customized, template deleted). - Store-created paths (never existed on template main): untouched, not reported.
- Special cases — never blanket-copied:
package.json: reconcile dependencies withjq— for every key in the template'sdependencies/devDependencies, set the template's version; drop store keys absent from template main whose version spec matches some main-history spec (i.e. the template removed them); keep store-added deps. Leavescriptsand the rest to the same rule-2/rule-3 judgement at the whole-file level only if the file was never customized.bun.lock: never copied — regenerate withbun installafter the reconcile..env*,deploy_key.pem: never touched.
Targeted edits for the shell rollout
The performance/accessibility pass on template main (prerendered chrome, optimizer-served favicon, AA colour tokens) is mostly self-propagating, but two paths need help:
-
New files land on their own under rule 4 —
scripts/check-shell.sh,scripts/audit.sh,lib/contrast.ts,lib/contrast.test.ts,app/palette.test.ts,lint-staged.config.mjs. Nothing to do. -
package.jsonscripts.buildmust be ported even when the file counts as customized, because the build gate is the whole point of the change:jq '.scripts.build = "bun next build && bash scripts/check-shell.sh"' package.json | sponge package.jsonAdd
.scripts.audit = "bash scripts/audit.sh"the same way. Everything else inscriptsstays as the store has it. -
app/layout.tsxis ~52 commits of churn on main and will almost always come back asskipped (customized). Do not merge it. Put it in the "needs manual follow-up" list with these three targeted edits spelled out, so a follow-up run (or a human) can apply them:- remove the
<Suspense>around the children/chrome wrapper if everything it awaits is a cached read — the boundary alone streams the chrome out of the prerendered shell; a store that still awaits its cart cookie there must move that read into aCartBootstrapperbelow the chrome first; - replace the
iconsblock in the metadata with the optimizer version — oneiconentry built withgetImagePropsand notype,appleleft on the original URL, noshortcut; Geist_Mono({ …, preload: false }).
After such a follow-up,
bun run buildin the store repo is the check that says it worked. - remove the
Verify, commit, push
In each store repo, in order — a failure at any step means do not push; report instead:
bun installbun next typegen(regenerates the route-type globals; deleted routes otherwise leave stale validators)bun tsc --noEmitbun run lintif the script exists (biome, auto-fix mode is fine)
Commit everything applied as one commit — subject
chore: propagate template <short-sha of template main>, body listing counts
(updated/deleted/skipped) and the driving issue refs if the invoker supplied them. Plain
push to main, never force. Remember each push redeploys that tenant — when running
across a fleet, process a handful at a time rather than pushing dozens simultaneously.
Scale + report
One store = one agent task; run a few in parallel, each in its own temp dir. At the end,
produce a single table: store · updated · deleted · skipped(customized) · pushed?/error.
Anything skipped (customized) for a file the invoker's change actually needs (e.g. an
edit inside a customized app/layout.tsx) belongs in a "needs manual follow-up" list with
the store name and path — do not attempt semantic merges of customized files unless the
invoker explicitly described the targeted edit to make (e.g. "remove the AuthButton
import and its render line if present").
Live spot-check (optional, when the invoker names expectations)
After a store's push + redeploy, curl -sI https://<subdomain>.<yns.cx|yns.store><path>
against whatever the propagated change promises (e.g. a proxied path now answering with a
platform redirect instead of the template 404). Remember tenant 404s stream with HTTP 200 —
check content or headers, not just the status code.
Version History
-
b32f4f2
Current 2026-09-23 08:54
新增 propagate-template 技能对特定 Store 的 targeted-edit 列表支持,用于处理 app/layout.tsx 和 package.json 被自定义的情况;同时更新了 theme 相关技能的 Shell 规则和验证步骤。
- f5e94ec 2026-08-29 05:08


