deploy-check
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRun a pre-flight check before pushing to production. Works with any stack.
在推送至生产环境前运行预检流程,适用于任何技术栈。
Steps
步骤
1. Check what's being pushed
1. 检查待推送内容
bash
git status
git diff origin/main...HEAD --stat
git log origin/main..HEAD --onelineShow the user: "X commits, Y files about to go live." List the commit messages so they can see at a glance what's shipping.
bash
git status
git diff origin/main...HEAD --stat
git log origin/main..HEAD --oneline告知用户:“将有X次提交、Y个文件上线。”列出提交信息,让用户快速了解待发布内容。
2. TypeScript check (if applicable)
2. TypeScript检查(如适用)
Look for in the repo. If found:
tsconfig.jsonbash
npx tsc --noEmitRun from the directory that contains (could be root or a subfolder — check first).
tsconfig.jsonfrontend/If errors: list every error with file + line number. Do NOT recommend pushing until fixed.
If no TypeScript in project: skip this step and note it.
在仓库中查找文件。若找到:
tsconfig.jsonbash
npx tsc --noEmit从包含的目录执行该命令(可能是根目录或子目录——需先确认路径)。
tsconfig.jsonfrontend/若发现错误:列出所有错误的文件及行号。必须修复后再推送。
若项目未使用TypeScript:跳过此步骤并予以说明。
3. Check for accidentally staged secrets
3. 检查意外暂存的密钥
bash
git diff --cached --name-only | grep -iE '\.env|secret|key|credential|token|password'If ANY file matches: STOP. Warn loudly. Never let secrets get committed.
Also check unstaged changes:
bash
git diff --name-only | grep -iE '\.env'bash
git diff --cached --name-only | grep -iE '\.env|secret|key|credential|token|password'若匹配到任何文件:立即终止流程,发出严重警告。绝对禁止提交密钥。
同时检查未暂存的更改:
bash
git diff --name-only | grep -iE '\.env'4. Dependency / schema changes
4. 依赖/ schema变更检查
- Look for migration files (common patterns: ,
migrations/,schema.sql,*.migration.ts). If any changed since last commit, remind user to run migrations before deploying.db/migrate/ - Check ,
package.json,requirements.txt,go.mod— if dependencies changed, flag which ones are new so user can confirm they're available in the production environment.Cargo.toml - If new environment variables appear in the diff (search for ,
os.getenv,process.env), list them and ask: are these set in your production environment?ENV[
- 查找迁移文件(常见命名模式:、
migrations/、schema.sql、*.migration.ts)。若自上次提交后有变更,提醒用户在部署前执行迁移。db/migrate/ - 检查、
package.json、requirements.txt、go.mod——若依赖有变更,标记出新的依赖包,让用户确认生产环境已支持这些依赖。Cargo.toml - 若差异中出现新的环境变量(搜索、
os.getenv、process.env),列出这些变量并询问:生产环境中是否已配置这些变量?ENV[
5. Hygiene reminders (not blockers)
5. 代码规范提醒(不阻塞推送)
Read the commit messages and changed files, then surface these as gentle reminders:
- Changelog / release notes: Did anything user-visible ship (new feature, fix, UI change)? If yes, remind them to update their changelog.
- README: Did the setup steps, architecture, or env vars change? If yes, remind them to update the README.
- Docs / API docs: If new endpoints were added, remind them to document them.
These do NOT block the push. Just surface them.
读取提交信息和变更文件,给出以下温和提醒:
- 更新日志/发布说明:是否有用户可见的变更(新功能、修复、UI调整)?若是,提醒用户更新更新日志。
- README文档:安装步骤、架构或环境变量是否有变更?若是,提醒用户更新README。
- 文档/API文档:若新增了接口,提醒用户补充文档。
这些提醒不会阻止推送,仅作提示。
6. Output the verdict
6. 输出检查结果
Green:
✅ TypeScript: no errors
✅ No secrets staged
✅ No migrations pending
✅ Dependencies: no new packages
📝 Changelog: [reminded / not needed]
→ safe to pushRed:
❌ TypeScript: 3 errors — fix these first
src/auth.ts:42 — Property 'user' does not exist on type 'Session'
⚠️ .env.local is staged — remove it before committing
⚠️ schema.sql changed — run migrations in prod first
📝 2 new env vars in diff — confirm they're set in production
→ fix blockers before pushing通过(绿色):
✅ TypeScript:无错误
✅ 无暂存的密钥
✅ 无待执行的迁移
✅ 依赖:无新增包
📝 更新日志:[已提醒 / 无需更新]
→ 可安全推送未通过(红色):
❌ TypeScript:3处错误——请先修复
src/auth.ts:42 — Property 'user' does not exist on type 'Session'
⚠️ .env.local已被暂存——提交前请移除
⚠️ schema.sql已变更——请先在生产环境执行迁移
📝 差异中包含2个新环境变量——请确认生产环境已配置
→ 修复阻塞问题后再推送