Skip to content

t1k:marketing:store:gate

FieldValue
Modulestore
Version0.14.9
Effortmedium
Tools—
/t1k:marketing:store:gate

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).

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.

CommandDoesExit
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 diff0, 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/tty0, 4 refused
apply --plan P --approval A [--confirm] [--allow-unprotected]the seven ordered checks, then (with --confirm) the writes0, 1, 2, 3, 4
status --slug Splans, approvals, results; flags progressUnknown and started with no finish0

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.

  1. plan and show the printed diff to the user. Commit the plan and the rendered .diff.md.
  2. Ask the user with AskUserQuestion using the text in references/approval-procedure.md. A human who says yes runs approve in a terminal (the tty challenge); the answer text goes in --evidence. Commit the approval.
  3. Merge plan + approval through a PR with an independent approving review (strict mode needs it).
  4. apply (preview), then apply --confirm. Commit the <planId>.result.json it 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)”
  1. approval parses; plan diffHash recomputes; approval diffHash, manifestSha256, planSha256, scope.opIds, scope.app, statement (recomputed from the plan) all match -> 4
  2. 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 to origin/<default>) and not consumed, keyed on the planId: no <planId>.result.json in ANY <slug>/gate/, none in git log --all, no remote tag refs/tags/store-gate-consumed/<planId> (or the legacy refs/store-gate/consumed/<planId>, read-only) -> 4
  3. (a) approval, plan, rendered diff, manifest, extends fragments 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
  4. merged manifest hash equals the plan’s -> 3
  5. pre-flight for ALL stores: re-run each store --emit-diff, compare storeDiffHash -> 3 DRIFT <store>: <first change>
  6. no --confirm: print would apply N ops, exit 0
  7. --confirm: write <planId>.result.json started and fsync (strict mode also pushes the consumed ref) BEFORE the first engine write, then store --confirm --expect-diff-hash per 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).

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”).

StepAgent
Run store-gate.cjs plan --manifest <file> or status and report the printed diff / statet1k-fact-fetcher

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.