apps-script-deploy
Installation
SKILL.md
Apps Script deploy (push-first)
Local TypeScript is the source of truth: esbuild bundles src/ into dist/main.gs and clasp push uploads it. The Apps Script web editor is never edited directly. The recurring failure mode (it has silently clobbered deploys before) is a stale editor browser tab: an open editor session can save its old copy over a fresh push, and a cached tab can make a good deploy look stale during verification.
The ritual
- Ask the user to close any open Apps Script editor tabs before pushing. This is the step that prevents the silent-revert bug; don't skip it because the push "should" win.
- Build:
npm run build(tsc --noEmit + esbuild bundle). A failed build means nothing ships. - Preview the push:
npx clasp statusto list exactly which files would upload — expect only the bundle andappsscript.json(.claspignorewhitelists just those). - Push:
npm run push(build +clasp pushin one step). - Verify in a fresh tab:
npx clasp open-script, then confirm the change is present (spot-check a changed line or run the relevant entry point). Never verify in a tab that was already open — cached editors have shown stale code minutes after a successful push.
If the remote looks stale or reverted
- Re-push once (
npm run push) and re-verify in another fresh tab. - If it reverts again, an editor session somewhere is saving over the push — find and close it (other machines and browser windows count), then push once more.
- To inspect what the remote actually holds, prefer
npx clasp status; if you mustclasp pull, remember it overwrites the localdist/copy — pull, diff against the built bundle, then rebuild to restore local truth. - Never reconcile by editing in the web editor. Fix locally, rebuild, push.