t1k:marketing:store:gate
| Field | Value |
|---|---|
| Module | store |
| Version | 0.14.9 |
| Effort | medium |
| Tools | — |
How to invoke
Section titled “How to invoke”/t1k:marketing:store:gateStore Gate (plan -> approve -> apply)
Section titled “Store Gate (plan -> approve -> apply)”Claude drafts; a human approves every store write. This skill turns that sentence into a mechanism
the apply step enforces on the manifest path: a before -> after diff, an approval record bound to
that exact diff, a drift check against the live stores, and a single-use result. It never calls a
store itself: it runs ONE store entry per store (engines.json) and checks what comes back.
Contract (authority): docs/store-gate-contract.md sections 5-9 and 11 of the marketing-store-automation
repo; engine side and hashing: the t1k-marketing-store-manifest skill (references/engine-contract.md).
Commands
Section titled “Commands”bun scripts/store-gate.cjs <command> (dependency-free Node; run from the game repo root so paths
resolve against the cwd). Root of the stores tree: --root, config storeGate.root, default stores/. The gate forwards the resolved root to every engine (--root ., cwd = root), so a root not named stores works and engine.args binds it in the plan hash.
| Command | Does | Exit |
|---|---|---|
plan --manifest M [--stores play,asc] | runs each engine store --emit-diff (read-only), writes <root>/<slug>/gate/<planId>.plan.json and .diff.md, prints the diff | 0, 1 engine error or unparseable stdout, 2 usage |
approve --plan P --evidence "<AskUserQuestion answer text>" [--ttl-hours N] [--no-tty-challenge] [--no-require-merged] | writes <planId>.approval.json after a one-time yes <8 hex> challenge on /dev/tty | 0, 4 refused |
apply --plan P --approval A [--confirm] [--allow-unprotected] | the seven ordered checks, then (with --confirm) the writes | 0, 1, 2, 3, 4 |
status --slug S | plans, approvals, results; flags progressUnknown and started with no finish | 0 |
Exit codes of apply: 0 ok (also the preview), 1 error or partial apply (any store wrote any
op, whatever the engine said), 2 usage, 3 drift with no write by any store, 4 approval missing,
invalid, expired, already used, not committed, or not reviewed.
The flow (what the session does)
Section titled “The flow (what the session does)”planand show the printed diff to the user. Commit the plan and the rendered.diff.md.- Ask the user with
AskUserQuestionusing the text inreferences/approval-procedure.md. A human who says yes runsapprovein a terminal (the tty challenge); the answer text goes in--evidence. Commit the approval. - Merge plan + approval through a PR with an independent approving review (strict mode needs it).
apply(preview), thenapply --confirm. Commit the<planId>.result.jsonit wrote.
Never pass --allow-unprotected or --no-tty-challenge unless the user said so in the transcript:
both are audited overrides, not barriers. A second apply of the same plan is refused: re-plan.
Apply checks (order is fixed; --confirm alone skips none)
Section titled “Apply checks (order is fixed; --confirm alone skips none)”- approval parses; plan
diffHashrecomputes; approvaldiffHash,manifestSha256,planSha256,scope.opIds,scope.app,statement(recomputed from the plan) all match -> 4 - not expired (
min(record.expiresAt, anchor + ttl ceiling); a config ceiling above the 24h default counts only from a tracked, clean file, and in strict mode one equal toorigin/<default>) and not consumed, keyed on the planId: no<planId>.result.jsonin ANY<slug>/gate/, none ingit log --all, no remote tagrefs/tags/store-gate-consumed/<planId>(or the legacyrefs/store-gate/consumed/<planId>, read-only) -> 4 - (a) approval, plan, rendered diff, manifest,
extendsfragments and referenced files (Data Safety CSV, graphics) are TRACKED AND CLEAN (git cat-file -e HEAD:./<p>,git diff --quiet HEAD -- <p>), and the rendered diff regenerated from the plan equals the committed bytes; (b) strict mode: default branch protected with >= 1 required approving review, and the approval reached the default branch through a merged PR with an approving review by someone other than the PR author, and the approval and plan on disk are byte-identical to what that PR added (an edit after review fails) -> 4 - merged manifest hash equals the plan’s -> 3
- pre-flight for ALL stores: re-run each
store --emit-diff, comparestoreDiffHash-> 3DRIFT <store>: <first change> - no
--confirm: printwould apply N ops, exit 0 --confirm: write<planId>.result.jsonstartedandfsync(strict mode also pushes the consumed ref) BEFORE the first engine write, thenstore --confirm --expect-diff-hashper store
Strict mode applies when the approval, the config or the plan asks (requireMergedOnDefault), and is
forced for a Play commit that is on production (compared trimmed and lowercased) or whose track
is not shown, one that also publishes listings, details or graphics whatever track the release names,
any iap op and any Data Safety op. Only ASC-only plans and a bare non-production release stay
eligible for non-strict, which needs no merged PR and no second reviewer (apply warns).
Executed by
Section titled “Executed by”plan and status are read-only and mechanical: run the script and relay its output. approve and
apply need the user’s AskUserQuestion answer and stay on a reasoning tier; a cheap-tier agent
never approves or applies (routing SSOT: rules/orchestration-rules.md § “Task-Type → Agent Routing”).
| Step | Agent |
|---|---|
Run store-gate.cjs plan --manifest <file> or status and report the printed diff / state | t1k-fact-fetcher |
Honest limits
Section titled “Honest limits”The approver is a label from git config, not authentication. The tty challenge is a hypothesis and a
self-allocated pty answers it (references/approval-procedure.md); challenge carries no assurance.
Single use rests on a result file and a remote ref the same credentials can delete: protect
tags store-gate-consumed/** against deletion and update with a repository tag ruleset (owner action; rulesets cannot target a custom refs/ namespace). enforce_admins=false lets an admin bypass the branch rules; the
review check catches bypasses that skip the review, not an admin who is also the second reviewer. A
Data Safety write and a secret-sourced field are unverifiable: drift on them is not detectable. The
gate does not guard the legacy --config ... --confirm path. Release artifacts (aab, mapping,
nativeSymbols) are bound by artifactSha256 in the diff, not required to be tracked in git.
engines.json ({engines: [...]}, one store entry per store, steps[]; adding an engine is a data edit),
scripts/lib/ (plan, approval, drift, gitstate, protection, consumed, engines),
tests/fake-engine.cjs (contract-only stand-in), references/approval-procedure.md.