@runchr/gstack-antigravity 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (297) hide show
  1. package/.agents/rules/ETHOS.md +129 -0
  2. package/.agents/rules/global-gstack.md +117 -0
  3. package/.agents/rules/persona-gstack-autoplan.md +14 -0
  4. package/.agents/rules/persona-gstack-benchmark.md +14 -0
  5. package/.agents/rules/persona-gstack-browse.md +14 -0
  6. package/.agents/rules/persona-gstack-canary.md +14 -0
  7. package/.agents/rules/persona-gstack-careful.md +14 -0
  8. package/.agents/rules/persona-gstack-codex.md +14 -0
  9. package/.agents/rules/persona-gstack-cso.md +14 -0
  10. package/.agents/rules/persona-gstack-design-consultation.md +14 -0
  11. package/.agents/rules/persona-gstack-design-review.md +14 -0
  12. package/.agents/rules/persona-gstack-document-release.md +14 -0
  13. package/.agents/rules/persona-gstack-freeze.md +14 -0
  14. package/.agents/rules/persona-gstack-gstack-upgrade.md +14 -0
  15. package/.agents/rules/persona-gstack-guard.md +14 -0
  16. package/.agents/rules/persona-gstack-investigate.md +14 -0
  17. package/.agents/rules/persona-gstack-land-and-deploy.md +14 -0
  18. package/.agents/rules/persona-gstack-office-hours.md +14 -0
  19. package/.agents/rules/persona-gstack-plan-ceo-review.md +14 -0
  20. package/.agents/rules/persona-gstack-plan-design-review.md +14 -0
  21. package/.agents/rules/persona-gstack-plan-eng-review.md +14 -0
  22. package/.agents/rules/persona-gstack-qa-only.md +14 -0
  23. package/.agents/rules/persona-gstack-qa.md +14 -0
  24. package/.agents/rules/persona-gstack-retro.md +14 -0
  25. package/.agents/rules/persona-gstack-review.md +14 -0
  26. package/.agents/rules/persona-gstack-setup-browser-cookies.md +14 -0
  27. package/.agents/rules/persona-gstack-setup-deploy.md +14 -0
  28. package/.agents/rules/persona-gstack-ship.md +14 -0
  29. package/.agents/rules/persona-gstack-unfreeze.md +14 -0
  30. package/.agents/rules/persona-gstack.md +40 -0
  31. package/.agents/rules/recursive-identities.md +22 -0
  32. package/.agents/workflows/autoplan.md +30 -0
  33. package/.agents/workflows/benchmark.md +31 -0
  34. package/.agents/workflows/browse.md +26 -0
  35. package/.agents/workflows/canary.md +33 -0
  36. package/.agents/workflows/careful.md +22 -0
  37. package/.agents/workflows/codex.md +36 -0
  38. package/.agents/workflows/cso.md +29 -0
  39. package/.agents/workflows/design-consultation.md +28 -0
  40. package/.agents/workflows/design-review.md +28 -0
  41. package/.agents/workflows/document-release.md +32 -0
  42. package/.agents/workflows/freeze.md +17 -0
  43. package/.agents/workflows/gstack-upgrade.md +54 -0
  44. package/.agents/workflows/gstack.md +56 -0
  45. package/.agents/workflows/guard.md +18 -0
  46. package/.agents/workflows/investigate.md +37 -0
  47. package/.agents/workflows/land-and-deploy.md +35 -0
  48. package/.agents/workflows/office-hours.md +27 -0
  49. package/.agents/workflows/plan-ceo-review.md +34 -0
  50. package/.agents/workflows/plan-design-review.md +31 -0
  51. package/.agents/workflows/plan-eng-review.md +28 -0
  52. package/.agents/workflows/qa-only.md +28 -0
  53. package/.agents/workflows/qa.md +73 -0
  54. package/.agents/workflows/retro.md +34 -0
  55. package/.agents/workflows/review.md +30 -0
  56. package/.agents/workflows/setup-browser-cookies.md +15 -0
  57. package/.agents/workflows/setup-cookies.md +8 -0
  58. package/.agents/workflows/setup-deploy.md +21 -0
  59. package/.agents/workflows/ship.md +93 -0
  60. package/.agents/workflows/unfreeze.md +12 -0
  61. package/LICENSE +22 -0
  62. package/README.md +189 -0
  63. package/README_KO.md +191 -0
  64. package/bin/install.js +105 -0
  65. package/gstack-origin/.agents/skills/gstack/SKILL.md +651 -0
  66. package/gstack-origin/.agents/skills/gstack-autoplan/SKILL.md +678 -0
  67. package/gstack-origin/.agents/skills/gstack-benchmark/SKILL.md +482 -0
  68. package/gstack-origin/.agents/skills/gstack-browse/SKILL.md +511 -0
  69. package/gstack-origin/.agents/skills/gstack-canary/SKILL.md +486 -0
  70. package/gstack-origin/.agents/skills/gstack-careful/SKILL.md +50 -0
  71. package/gstack-origin/.agents/skills/gstack-cso/SKILL.md +607 -0
  72. package/gstack-origin/.agents/skills/gstack-design-consultation/SKILL.md +615 -0
  73. package/gstack-origin/.agents/skills/gstack-design-review/SKILL.md +988 -0
  74. package/gstack-origin/.agents/skills/gstack-document-release/SKILL.md +604 -0
  75. package/gstack-origin/.agents/skills/gstack-freeze/SKILL.md +67 -0
  76. package/gstack-origin/.agents/skills/gstack-guard/SKILL.md +62 -0
  77. package/gstack-origin/.agents/skills/gstack-investigate/SKILL.md +415 -0
  78. package/gstack-origin/.agents/skills/gstack-land-and-deploy/SKILL.md +873 -0
  79. package/gstack-origin/.agents/skills/gstack-office-hours/SKILL.md +986 -0
  80. package/gstack-origin/.agents/skills/gstack-plan-ceo-review/SKILL.md +1268 -0
  81. package/gstack-origin/.agents/skills/gstack-plan-design-review/SKILL.md +668 -0
  82. package/gstack-origin/.agents/skills/gstack-plan-eng-review/SKILL.md +826 -0
  83. package/gstack-origin/.agents/skills/gstack-qa/SKILL.md +1006 -0
  84. package/gstack-origin/.agents/skills/gstack-qa-only/SKILL.md +626 -0
  85. package/gstack-origin/.agents/skills/gstack-retro/SKILL.md +1065 -0
  86. package/gstack-origin/.agents/skills/gstack-review/SKILL.md +704 -0
  87. package/gstack-origin/.agents/skills/gstack-setup-browser-cookies/SKILL.md +325 -0
  88. package/gstack-origin/.agents/skills/gstack-setup-deploy/SKILL.md +450 -0
  89. package/gstack-origin/.agents/skills/gstack-ship/SKILL.md +1312 -0
  90. package/gstack-origin/.agents/skills/gstack-unfreeze/SKILL.md +36 -0
  91. package/gstack-origin/.agents/skills/gstack-upgrade/SKILL.md +220 -0
  92. package/gstack-origin/.env.example +5 -0
  93. package/gstack-origin/.github/workflows/skill-docs.yml +17 -0
  94. package/gstack-origin/AGENTS.md +49 -0
  95. package/gstack-origin/ARCHITECTURE.md +359 -0
  96. package/gstack-origin/BROWSER.md +271 -0
  97. package/gstack-origin/CHANGELOG.md +800 -0
  98. package/gstack-origin/CLAUDE.md +284 -0
  99. package/gstack-origin/CONTRIBUTING.md +370 -0
  100. package/gstack-origin/ETHOS.md +129 -0
  101. package/gstack-origin/LICENSE +21 -0
  102. package/gstack-origin/README.md +228 -0
  103. package/gstack-origin/SKILL.md +657 -0
  104. package/gstack-origin/SKILL.md.tmpl +281 -0
  105. package/gstack-origin/TODOS.md +564 -0
  106. package/gstack-origin/VERSION +1 -0
  107. package/gstack-origin/autoplan/SKILL.md +689 -0
  108. package/gstack-origin/autoplan/SKILL.md.tmpl +416 -0
  109. package/gstack-origin/benchmark/SKILL.md +489 -0
  110. package/gstack-origin/benchmark/SKILL.md.tmpl +233 -0
  111. package/gstack-origin/bin/dev-setup +68 -0
  112. package/gstack-origin/bin/dev-teardown +56 -0
  113. package/gstack-origin/bin/gstack-analytics +191 -0
  114. package/gstack-origin/bin/gstack-community-dashboard +113 -0
  115. package/gstack-origin/bin/gstack-config +38 -0
  116. package/gstack-origin/bin/gstack-diff-scope +71 -0
  117. package/gstack-origin/bin/gstack-global-discover.ts +591 -0
  118. package/gstack-origin/bin/gstack-repo-mode +93 -0
  119. package/gstack-origin/bin/gstack-review-log +9 -0
  120. package/gstack-origin/bin/gstack-review-read +12 -0
  121. package/gstack-origin/bin/gstack-slug +15 -0
  122. package/gstack-origin/bin/gstack-telemetry-log +158 -0
  123. package/gstack-origin/bin/gstack-telemetry-sync +127 -0
  124. package/gstack-origin/bin/gstack-update-check +196 -0
  125. package/gstack-origin/browse/SKILL.md +517 -0
  126. package/gstack-origin/browse/SKILL.md.tmpl +141 -0
  127. package/gstack-origin/browse/bin/find-browse +21 -0
  128. package/gstack-origin/browse/bin/remote-slug +14 -0
  129. package/gstack-origin/browse/scripts/build-node-server.sh +48 -0
  130. package/gstack-origin/browse/src/browser-manager.ts +634 -0
  131. package/gstack-origin/browse/src/buffers.ts +137 -0
  132. package/gstack-origin/browse/src/bun-polyfill.cjs +109 -0
  133. package/gstack-origin/browse/src/cli.ts +420 -0
  134. package/gstack-origin/browse/src/commands.ts +111 -0
  135. package/gstack-origin/browse/src/config.ts +150 -0
  136. package/gstack-origin/browse/src/cookie-import-browser.ts +417 -0
  137. package/gstack-origin/browse/src/cookie-picker-routes.ts +207 -0
  138. package/gstack-origin/browse/src/cookie-picker-ui.ts +541 -0
  139. package/gstack-origin/browse/src/find-browse.ts +61 -0
  140. package/gstack-origin/browse/src/meta-commands.ts +269 -0
  141. package/gstack-origin/browse/src/platform.ts +17 -0
  142. package/gstack-origin/browse/src/read-commands.ts +335 -0
  143. package/gstack-origin/browse/src/server.ts +369 -0
  144. package/gstack-origin/browse/src/snapshot.ts +398 -0
  145. package/gstack-origin/browse/src/url-validation.ts +91 -0
  146. package/gstack-origin/browse/src/write-commands.ts +352 -0
  147. package/gstack-origin/browse/test/bun-polyfill.test.ts +72 -0
  148. package/gstack-origin/browse/test/commands.test.ts +1836 -0
  149. package/gstack-origin/browse/test/config.test.ts +250 -0
  150. package/gstack-origin/browse/test/cookie-import-browser.test.ts +397 -0
  151. package/gstack-origin/browse/test/cookie-picker-routes.test.ts +205 -0
  152. package/gstack-origin/browse/test/find-browse.test.ts +50 -0
  153. package/gstack-origin/browse/test/fixtures/basic.html +33 -0
  154. package/gstack-origin/browse/test/fixtures/cursor-interactive.html +22 -0
  155. package/gstack-origin/browse/test/fixtures/dialog.html +15 -0
  156. package/gstack-origin/browse/test/fixtures/empty.html +2 -0
  157. package/gstack-origin/browse/test/fixtures/forms.html +55 -0
  158. package/gstack-origin/browse/test/fixtures/qa-eval-checkout.html +108 -0
  159. package/gstack-origin/browse/test/fixtures/qa-eval-spa.html +98 -0
  160. package/gstack-origin/browse/test/fixtures/qa-eval.html +51 -0
  161. package/gstack-origin/browse/test/fixtures/responsive.html +49 -0
  162. package/gstack-origin/browse/test/fixtures/snapshot.html +55 -0
  163. package/gstack-origin/browse/test/fixtures/spa.html +24 -0
  164. package/gstack-origin/browse/test/fixtures/states.html +17 -0
  165. package/gstack-origin/browse/test/fixtures/upload.html +25 -0
  166. package/gstack-origin/browse/test/gstack-config.test.ts +125 -0
  167. package/gstack-origin/browse/test/gstack-update-check.test.ts +467 -0
  168. package/gstack-origin/browse/test/handoff.test.ts +235 -0
  169. package/gstack-origin/browse/test/path-validation.test.ts +63 -0
  170. package/gstack-origin/browse/test/platform.test.ts +37 -0
  171. package/gstack-origin/browse/test/snapshot.test.ts +467 -0
  172. package/gstack-origin/browse/test/test-server.ts +57 -0
  173. package/gstack-origin/browse/test/url-validation.test.ts +72 -0
  174. package/gstack-origin/canary/SKILL.md +493 -0
  175. package/gstack-origin/canary/SKILL.md.tmpl +220 -0
  176. package/gstack-origin/careful/SKILL.md +59 -0
  177. package/gstack-origin/careful/SKILL.md.tmpl +57 -0
  178. package/gstack-origin/careful/bin/check-careful.sh +112 -0
  179. package/gstack-origin/codex/SKILL.md +677 -0
  180. package/gstack-origin/codex/SKILL.md.tmpl +356 -0
  181. package/gstack-origin/conductor.json +6 -0
  182. package/gstack-origin/cso/SKILL.md +615 -0
  183. package/gstack-origin/cso/SKILL.md.tmpl +376 -0
  184. package/gstack-origin/design-consultation/SKILL.md +625 -0
  185. package/gstack-origin/design-consultation/SKILL.md.tmpl +369 -0
  186. package/gstack-origin/design-review/SKILL.md +998 -0
  187. package/gstack-origin/design-review/SKILL.md.tmpl +262 -0
  188. package/gstack-origin/docs/images/github-2013.png +0 -0
  189. package/gstack-origin/docs/images/github-2026.png +0 -0
  190. package/gstack-origin/docs/skills.md +877 -0
  191. package/gstack-origin/document-release/SKILL.md +613 -0
  192. package/gstack-origin/document-release/SKILL.md.tmpl +357 -0
  193. package/gstack-origin/freeze/SKILL.md +82 -0
  194. package/gstack-origin/freeze/SKILL.md.tmpl +80 -0
  195. package/gstack-origin/freeze/bin/check-freeze.sh +68 -0
  196. package/gstack-origin/gstack-upgrade/SKILL.md +226 -0
  197. package/gstack-origin/gstack-upgrade/SKILL.md.tmpl +224 -0
  198. package/gstack-origin/guard/SKILL.md +82 -0
  199. package/gstack-origin/guard/SKILL.md.tmpl +80 -0
  200. package/gstack-origin/investigate/SKILL.md +435 -0
  201. package/gstack-origin/investigate/SKILL.md.tmpl +196 -0
  202. package/gstack-origin/land-and-deploy/SKILL.md +880 -0
  203. package/gstack-origin/land-and-deploy/SKILL.md.tmpl +575 -0
  204. package/gstack-origin/office-hours/SKILL.md +996 -0
  205. package/gstack-origin/office-hours/SKILL.md.tmpl +624 -0
  206. package/gstack-origin/package.json +55 -0
  207. package/gstack-origin/plan-ceo-review/SKILL.md +1277 -0
  208. package/gstack-origin/plan-ceo-review/SKILL.md.tmpl +838 -0
  209. package/gstack-origin/plan-design-review/SKILL.md +676 -0
  210. package/gstack-origin/plan-design-review/SKILL.md.tmpl +314 -0
  211. package/gstack-origin/plan-eng-review/SKILL.md +836 -0
  212. package/gstack-origin/plan-eng-review/SKILL.md.tmpl +279 -0
  213. package/gstack-origin/qa/SKILL.md +1016 -0
  214. package/gstack-origin/qa/SKILL.md.tmpl +316 -0
  215. package/gstack-origin/qa/references/issue-taxonomy.md +85 -0
  216. package/gstack-origin/qa/templates/qa-report-template.md +126 -0
  217. package/gstack-origin/qa-only/SKILL.md +633 -0
  218. package/gstack-origin/qa-only/SKILL.md.tmpl +101 -0
  219. package/gstack-origin/retro/SKILL.md +1072 -0
  220. package/gstack-origin/retro/SKILL.md.tmpl +833 -0
  221. package/gstack-origin/review/SKILL.md +849 -0
  222. package/gstack-origin/review/SKILL.md.tmpl +259 -0
  223. package/gstack-origin/review/TODOS-format.md +62 -0
  224. package/gstack-origin/review/checklist.md +190 -0
  225. package/gstack-origin/review/design-checklist.md +132 -0
  226. package/gstack-origin/review/greptile-triage.md +220 -0
  227. package/gstack-origin/scripts/analytics.ts +190 -0
  228. package/gstack-origin/scripts/dev-skill.ts +82 -0
  229. package/gstack-origin/scripts/eval-compare.ts +96 -0
  230. package/gstack-origin/scripts/eval-list.ts +116 -0
  231. package/gstack-origin/scripts/eval-select.ts +86 -0
  232. package/gstack-origin/scripts/eval-summary.ts +187 -0
  233. package/gstack-origin/scripts/eval-watch.ts +172 -0
  234. package/gstack-origin/scripts/gen-skill-docs.ts +2414 -0
  235. package/gstack-origin/scripts/skill-check.ts +167 -0
  236. package/gstack-origin/setup +269 -0
  237. package/gstack-origin/setup-browser-cookies/SKILL.md +330 -0
  238. package/gstack-origin/setup-browser-cookies/SKILL.md.tmpl +74 -0
  239. package/gstack-origin/setup-deploy/SKILL.md +459 -0
  240. package/gstack-origin/setup-deploy/SKILL.md.tmpl +220 -0
  241. package/gstack-origin/ship/SKILL.md +1457 -0
  242. package/gstack-origin/ship/SKILL.md.tmpl +528 -0
  243. package/gstack-origin/supabase/config.sh +10 -0
  244. package/gstack-origin/supabase/functions/community-pulse/index.ts +59 -0
  245. package/gstack-origin/supabase/functions/telemetry-ingest/index.ts +135 -0
  246. package/gstack-origin/supabase/functions/update-check/index.ts +37 -0
  247. package/gstack-origin/supabase/migrations/001_telemetry.sql +89 -0
  248. package/gstack-origin/test/analytics.test.ts +277 -0
  249. package/gstack-origin/test/codex-e2e.test.ts +197 -0
  250. package/gstack-origin/test/fixtures/coverage-audit-fixture.ts +76 -0
  251. package/gstack-origin/test/fixtures/eval-baselines.json +7 -0
  252. package/gstack-origin/test/fixtures/qa-eval-checkout-ground-truth.json +43 -0
  253. package/gstack-origin/test/fixtures/qa-eval-ground-truth.json +43 -0
  254. package/gstack-origin/test/fixtures/qa-eval-spa-ground-truth.json +43 -0
  255. package/gstack-origin/test/fixtures/review-eval-design-slop.css +86 -0
  256. package/gstack-origin/test/fixtures/review-eval-design-slop.html +41 -0
  257. package/gstack-origin/test/fixtures/review-eval-enum-diff.rb +30 -0
  258. package/gstack-origin/test/fixtures/review-eval-enum.rb +27 -0
  259. package/gstack-origin/test/fixtures/review-eval-vuln.rb +14 -0
  260. package/gstack-origin/test/gemini-e2e.test.ts +173 -0
  261. package/gstack-origin/test/gen-skill-docs.test.ts +1049 -0
  262. package/gstack-origin/test/global-discover.test.ts +187 -0
  263. package/gstack-origin/test/helpers/codex-session-runner.ts +282 -0
  264. package/gstack-origin/test/helpers/e2e-helpers.ts +239 -0
  265. package/gstack-origin/test/helpers/eval-store.test.ts +548 -0
  266. package/gstack-origin/test/helpers/eval-store.ts +689 -0
  267. package/gstack-origin/test/helpers/gemini-session-runner.test.ts +104 -0
  268. package/gstack-origin/test/helpers/gemini-session-runner.ts +201 -0
  269. package/gstack-origin/test/helpers/llm-judge.ts +130 -0
  270. package/gstack-origin/test/helpers/observability.test.ts +283 -0
  271. package/gstack-origin/test/helpers/session-runner.test.ts +96 -0
  272. package/gstack-origin/test/helpers/session-runner.ts +357 -0
  273. package/gstack-origin/test/helpers/skill-parser.ts +206 -0
  274. package/gstack-origin/test/helpers/touchfiles.ts +260 -0
  275. package/gstack-origin/test/hook-scripts.test.ts +373 -0
  276. package/gstack-origin/test/skill-e2e-browse.test.ts +293 -0
  277. package/gstack-origin/test/skill-e2e-deploy.test.ts +279 -0
  278. package/gstack-origin/test/skill-e2e-design.test.ts +614 -0
  279. package/gstack-origin/test/skill-e2e-plan.test.ts +538 -0
  280. package/gstack-origin/test/skill-e2e-qa-bugs.test.ts +194 -0
  281. package/gstack-origin/test/skill-e2e-qa-workflow.test.ts +412 -0
  282. package/gstack-origin/test/skill-e2e-review.test.ts +535 -0
  283. package/gstack-origin/test/skill-e2e-workflow.test.ts +586 -0
  284. package/gstack-origin/test/skill-e2e.test.ts +3325 -0
  285. package/gstack-origin/test/skill-llm-eval.test.ts +787 -0
  286. package/gstack-origin/test/skill-parser.test.ts +179 -0
  287. package/gstack-origin/test/skill-routing-e2e.test.ts +605 -0
  288. package/gstack-origin/test/skill-validation.test.ts +1520 -0
  289. package/gstack-origin/test/telemetry.test.ts +278 -0
  290. package/gstack-origin/test/touchfiles.test.ts +262 -0
  291. package/gstack-origin/unfreeze/SKILL.md +40 -0
  292. package/gstack-origin/unfreeze/SKILL.md.tmpl +38 -0
  293. package/package.json +38 -0
  294. package/scripts/install-antigravity-skill.ps1 +33 -0
  295. package/scripts/install-antigravity-skill.sh +41 -0
  296. package/scripts/sync-gstack-origin.ps1 +37 -0
  297. package/scripts/sync-gstack-origin.sh +35 -0
@@ -0,0 +1,1312 @@
1
+ ---
2
+ name: ship
3
+ description: |
4
+ Ship workflow: detect + merge base branch, run tests, review diff, bump VERSION, update CHANGELOG, commit, push, create PR. Use when asked to "ship", "deploy", "push to main", "create a PR", or "merge and push".
5
+ Proactively suggest when the user says code is ready or asks about deploying.
6
+ ---
7
+ <!-- AUTO-GENERATED from SKILL.md.tmpl — do not edit directly -->
8
+ <!-- Regenerate: bun run gen:skill-docs -->
9
+
10
+ ## Preamble (run first)
11
+
12
+ ```bash
13
+ _UPD=$(~/.codex/skills/gstack/bin/gstack-update-check 2>/dev/null || .agents/skills/gstack/bin/gstack-update-check 2>/dev/null || true)
14
+ [ -n "$_UPD" ] && echo "$_UPD" || true
15
+ mkdir -p ~/.gstack/sessions
16
+ touch ~/.gstack/sessions/"$PPID"
17
+ _SESSIONS=$(find ~/.gstack/sessions -mmin -120 -type f 2>/dev/null | wc -l | tr -d ' ')
18
+ find ~/.gstack/sessions -mmin +120 -type f -delete 2>/dev/null || true
19
+ _CONTRIB=$(~/.codex/skills/gstack/bin/gstack-config get gstack_contributor 2>/dev/null || true)
20
+ _PROACTIVE=$(~/.codex/skills/gstack/bin/gstack-config get proactive 2>/dev/null || echo "true")
21
+ _BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
22
+ echo "BRANCH: $_BRANCH"
23
+ echo "PROACTIVE: $_PROACTIVE"
24
+ source <(~/.codex/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || true
25
+ REPO_MODE=${REPO_MODE:-unknown}
26
+ echo "REPO_MODE: $REPO_MODE"
27
+ _LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")
28
+ echo "LAKE_INTRO: $_LAKE_SEEN"
29
+ _TEL=$(~/.codex/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)
30
+ _TEL_PROMPTED=$([ -f ~/.gstack/.telemetry-prompted ] && echo "yes" || echo "no")
31
+ _TEL_START=$(date +%s)
32
+ _SESSION_ID="$$-$(date +%s)"
33
+ echo "TELEMETRY: ${_TEL:-off}"
34
+ echo "TEL_PROMPTED: $_TEL_PROMPTED"
35
+ mkdir -p ~/.gstack/analytics
36
+ echo '{"skill":"ship","ts":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'","repo":"'$(basename "$(git rev-parse --show-toplevel 2>/dev/null)" 2>/dev/null || echo "unknown")'"}' >> ~/.gstack/analytics/skill-usage.jsonl 2>/dev/null || true
37
+ for _PF in ~/.gstack/analytics/.pending-*; do [ -f "$_PF" ] && ~/.codex/skills/gstack/bin/gstack-telemetry-log --event-type skill_run --skill _pending_finalize --outcome unknown --session-id "$_SESSION_ID" 2>/dev/null || true; break; done
38
+ ```
39
+
40
+ If `PROACTIVE` is `"false"`, do not proactively suggest gstack skills — only invoke
41
+ them when the user explicitly asks. The user opted out of proactive suggestions.
42
+
43
+ If output shows `UPGRADE_AVAILABLE <old> <new>`: read `~/.codex/skills/gstack/gstack-upgrade/SKILL.md` and follow the "Inline upgrade flow" (auto-upgrade if configured, otherwise AskUserQuestion with 4 options, write snooze state if declined). If `JUST_UPGRADED <from> <to>`: tell user "Running gstack v{to} (just updated!)" and continue.
44
+
45
+ If `LAKE_INTRO` is `no`: Before continuing, introduce the Completeness Principle.
46
+ Tell the user: "gstack follows the **Boil the Lake** principle — always do the complete
47
+ thing when AI makes the marginal cost near-zero. Read more: https://garryslist.org/posts/boil-the-ocean"
48
+ Then offer to open the essay in their default browser:
49
+
50
+ ```bash
51
+ open https://garryslist.org/posts/boil-the-ocean
52
+ touch ~/.gstack/.completeness-intro-seen
53
+ ```
54
+
55
+ Only run `open` if the user says yes. Always run `touch` to mark as seen. This only happens once.
56
+
57
+ If `TEL_PROMPTED` is `no` AND `LAKE_INTRO` is `yes`: After the lake intro is handled,
58
+ ask the user about telemetry. Use AskUserQuestion:
59
+
60
+ > Help gstack get better! Community mode shares usage data (which skills you use, how long
61
+ > they take, crash info) with a stable device ID so we can track trends and fix bugs faster.
62
+ > No code, file paths, or repo names are ever sent.
63
+ > Change anytime with `gstack-config set telemetry off`.
64
+
65
+ Options:
66
+ - A) Help gstack get better! (recommended)
67
+ - B) No thanks
68
+
69
+ If A: run `~/.codex/skills/gstack/bin/gstack-config set telemetry community`
70
+
71
+ If B: ask a follow-up AskUserQuestion:
72
+
73
+ > How about anonymous mode? We just learn that *someone* used gstack — no unique ID,
74
+ > no way to connect sessions. Just a counter that helps us know if anyone's out there.
75
+
76
+ Options:
77
+ - A) Sure, anonymous is fine
78
+ - B) No thanks, fully off
79
+
80
+ If B→A: run `~/.codex/skills/gstack/bin/gstack-config set telemetry anonymous`
81
+ If B→B: run `~/.codex/skills/gstack/bin/gstack-config set telemetry off`
82
+
83
+ Always run:
84
+ ```bash
85
+ touch ~/.gstack/.telemetry-prompted
86
+ ```
87
+
88
+ This only happens once. If `TEL_PROMPTED` is `yes`, skip this entirely.
89
+
90
+ ## AskUserQuestion Format
91
+
92
+ **ALWAYS follow this structure for every AskUserQuestion call:**
93
+ 1. **Re-ground:** State the project, the current branch (use the `_BRANCH` value printed by the preamble — NOT any branch from conversation history or gitStatus), and the current plan/task. (1-2 sentences)
94
+ 2. **Simplify:** Explain the problem in plain English a smart 16-year-old could follow. No raw function names, no internal jargon, no implementation details. Use concrete examples and analogies. Say what it DOES, not what it's called.
95
+ 3. **Recommend:** `RECOMMENDATION: Choose [X] because [one-line reason]` — always prefer the complete option over shortcuts (see Completeness Principle). Include `Completeness: X/10` for each option. Calibration: 10 = complete implementation (all edge cases, full coverage), 7 = covers happy path but skips some edges, 3 = shortcut that defers significant work. If both options are 8+, pick the higher; if one is ≤5, flag it.
96
+ 4. **Options:** Lettered options: `A) ... B) ... C) ...` — when an option involves effort, show both scales: `(human: ~X / CC: ~Y)`
97
+
98
+ Assume the user hasn't looked at this window in 20 minutes and doesn't have the code open. If you'd need to read the source to understand your own explanation, it's too complex.
99
+
100
+ Per-skill instructions may add additional formatting rules on top of this baseline.
101
+
102
+ ## Completeness Principle — Boil the Lake
103
+
104
+ AI-assisted coding makes the marginal cost of completeness near-zero. When you present options:
105
+
106
+ - If Option A is the complete implementation (full parity, all edge cases, 100% coverage) and Option B is a shortcut that saves modest effort — **always recommend A**. The delta between 80 lines and 150 lines is meaningless with CC+gstack. "Good enough" is the wrong instinct when "complete" costs minutes more.
107
+ - **Lake vs. ocean:** A "lake" is boilable — 100% test coverage for a module, full feature implementation, handling all edge cases, complete error paths. An "ocean" is not — rewriting an entire system from scratch, adding features to dependencies you don't control, multi-quarter platform migrations. Recommend boiling lakes. Flag oceans as out of scope.
108
+ - **When estimating effort**, always show both scales: human team time and CC+gstack time. The compression ratio varies by task type — use this reference:
109
+
110
+ | Task type | Human team | CC+gstack | Compression |
111
+ |-----------|-----------|-----------|-------------|
112
+ | Boilerplate / scaffolding | 2 days | 15 min | ~100x |
113
+ | Test writing | 1 day | 15 min | ~50x |
114
+ | Feature implementation | 1 week | 30 min | ~30x |
115
+ | Bug fix + regression test | 4 hours | 15 min | ~20x |
116
+ | Architecture / design | 2 days | 4 hours | ~5x |
117
+ | Research / exploration | 1 day | 3 hours | ~3x |
118
+
119
+ - This principle applies to test coverage, error handling, documentation, edge cases, and feature completeness. Don't skip the last 10% to "save time" — with AI, that 10% costs seconds.
120
+
121
+ **Anti-patterns — DON'T do this:**
122
+ - BAD: "Choose B — it covers 90% of the value with less code." (If A is only 70 lines more, choose A.)
123
+ - BAD: "We can skip edge case handling to save time." (Edge case handling costs minutes with CC.)
124
+ - BAD: "Let's defer test coverage to a follow-up PR." (Tests are the cheapest lake to boil.)
125
+ - BAD: Quoting only human-team effort: "This would take 2 weeks." (Say: "2 weeks human / ~1 hour CC.")
126
+
127
+ ## Repo Ownership Mode — See Something, Say Something
128
+
129
+ `REPO_MODE` from the preamble tells you who owns issues in this repo:
130
+
131
+ - **`solo`** — One person does 80%+ of the work. They own everything. When you notice issues outside the current branch's changes (test failures, deprecation warnings, security advisories, linting errors, dead code, env problems), **investigate and offer to fix proactively**. The solo dev is the only person who will fix it. Default to action.
132
+ - **`collaborative`** — Multiple active contributors. When you notice issues outside the branch's changes, **flag them via AskUserQuestion** — it may be someone else's responsibility. Default to asking, not fixing.
133
+ - **`unknown`** — Treat as collaborative (safer default — ask before fixing).
134
+
135
+ **See Something, Say Something:** Whenever you notice something that looks wrong during ANY workflow step — not just test failures — flag it briefly. One sentence: what you noticed and its impact. In solo mode, follow up with "Want me to fix it?" In collaborative mode, just flag it and move on.
136
+
137
+ Never let a noticed issue silently pass. The whole point is proactive communication.
138
+
139
+ ## Search Before Building
140
+
141
+ Before building infrastructure, unfamiliar patterns, or anything the runtime might have a built-in — **search first.** Read `~/.codex/skills/gstack/ETHOS.md` for the full philosophy.
142
+
143
+ **Three layers of knowledge:**
144
+ - **Layer 1** (tried and true — in distribution). Don't reinvent the wheel. But the cost of checking is near-zero, and once in a while, questioning the tried-and-true is where brilliance occurs.
145
+ - **Layer 2** (new and popular — search for these). But scrutinize: humans are subject to mania. Search results are inputs to your thinking, not answers.
146
+ - **Layer 3** (first principles — prize these above all). Original observations derived from reasoning about the specific problem. The most valuable of all.
147
+
148
+ **Eureka moment:** When first-principles reasoning reveals conventional wisdom is wrong, name it:
149
+ "EUREKA: Everyone does X because [assumption]. But [evidence] shows this is wrong. Y is better because [reasoning]."
150
+
151
+ Log eureka moments:
152
+ ```bash
153
+ jq -n --arg ts "$(date -u +%Y-%m-%dT%H:%M:%SZ)" --arg skill "SKILL_NAME" --arg branch "$(git branch --show-current 2>/dev/null)" --arg insight "ONE_LINE_SUMMARY" '{ts:$ts,skill:$skill,branch:$branch,insight:$insight}' >> ~/.gstack/analytics/eureka.jsonl 2>/dev/null || true
154
+ ```
155
+ Replace SKILL_NAME and ONE_LINE_SUMMARY. Runs inline — don't stop the workflow.
156
+
157
+ **WebSearch fallback:** If WebSearch is unavailable, skip the search step and note: "Search unavailable — proceeding with in-distribution knowledge only."
158
+
159
+ ## Contributor Mode
160
+
161
+ If `_CONTRIB` is `true`: you are in **contributor mode**. You're a gstack user who also helps make it better.
162
+
163
+ **At the end of each major workflow step** (not after every single command), reflect on the gstack tooling you used. Rate your experience 0 to 10. If it wasn't a 10, think about why. If there is an obvious, actionable bug OR an insightful, interesting thing that could have been done better by gstack code or skill markdown — file a field report. Maybe our contributor will help make us better!
164
+
165
+ **Calibration — this is the bar:** For example, `$B js "await fetch(...)"` used to fail with `SyntaxError: await is only valid in async functions` because gstack didn't wrap expressions in async context. Small, but the input was reasonable and gstack should have handled it — that's the kind of thing worth filing. Things less consequential than this, ignore.
166
+
167
+ **NOT worth filing:** user's app bugs, network errors to user's URL, auth failures on user's site, user's own JS logic bugs.
168
+
169
+ **To file:** write `~/.gstack/contributor-logs/{slug}.md` with **all sections below** (do not truncate — include every section through the Date/Version footer):
170
+
171
+ ```
172
+ # {Title}
173
+
174
+ Hey gstack team — ran into this while using /{skill-name}:
175
+
176
+ **What I was trying to do:** {what the user/agent was attempting}
177
+ **What happened instead:** {what actually happened}
178
+ **My rating:** {0-10} — {one sentence on why it wasn't a 10}
179
+
180
+ ## Steps to reproduce
181
+ 1. {step}
182
+
183
+ ## Raw output
184
+ ```
185
+ {paste the actual error or unexpected output here}
186
+ ```
187
+
188
+ ## What would make this a 10
189
+ {one sentence: what gstack should have done differently}
190
+
191
+ **Date:** {YYYY-MM-DD} | **Version:** {gstack version} | **Skill:** /{skill}
192
+ ```
193
+
194
+ Slug: lowercase, hyphens, max 60 chars (e.g. `browse-js-no-await`). Skip if file already exists. Max 3 reports per session. File inline and continue — don't stop the workflow. Tell user: "Filed gstack field report: {title}"
195
+
196
+ ## Completion Status Protocol
197
+
198
+ When completing a skill workflow, report status using one of:
199
+ - **DONE** — All steps completed successfully. Evidence provided for each claim.
200
+ - **DONE_WITH_CONCERNS** — Completed, but with issues the user should know about. List each concern.
201
+ - **BLOCKED** — Cannot proceed. State what is blocking and what was tried.
202
+ - **NEEDS_CONTEXT** — Missing information required to continue. State exactly what you need.
203
+
204
+ ### Escalation
205
+
206
+ It is always OK to stop and say "this is too hard for me" or "I'm not confident in this result."
207
+
208
+ Bad work is worse than no work. You will not be penalized for escalating.
209
+ - If you have attempted a task 3 times without success, STOP and escalate.
210
+ - If you are uncertain about a security-sensitive change, STOP and escalate.
211
+ - If the scope of work exceeds what you can verify, STOP and escalate.
212
+
213
+ Escalation format:
214
+ ```
215
+ STATUS: BLOCKED | NEEDS_CONTEXT
216
+ REASON: [1-2 sentences]
217
+ ATTEMPTED: [what you tried]
218
+ RECOMMENDATION: [what the user should do next]
219
+ ```
220
+
221
+ ## Telemetry (run last)
222
+
223
+ After the skill workflow completes (success, error, or abort), log the telemetry event.
224
+ Determine the skill name from the `name:` field in this file's YAML frontmatter.
225
+ Determine the outcome from the workflow result (success if completed normally, error
226
+ if it failed, abort if the user interrupted).
227
+
228
+ **PLAN MODE EXCEPTION — ALWAYS RUN:** This command writes telemetry to
229
+ `~/.gstack/analytics/` (user config directory, not project files). The skill
230
+ preamble already writes to the same directory — this is the same pattern.
231
+ Skipping this command loses session duration and outcome data.
232
+
233
+ Run this bash:
234
+
235
+ ```bash
236
+ _TEL_END=$(date +%s)
237
+ _TEL_DUR=$(( _TEL_END - _TEL_START ))
238
+ rm -f ~/.gstack/analytics/.pending-"$_SESSION_ID" 2>/dev/null || true
239
+ ~/.codex/skills/gstack/bin/gstack-telemetry-log \
240
+ --skill "SKILL_NAME" --duration "$_TEL_DUR" --outcome "OUTCOME" \
241
+ --used-browse "USED_BROWSE" --session-id "$_SESSION_ID" 2>/dev/null &
242
+ ```
243
+
244
+ Replace `SKILL_NAME` with the actual skill name from frontmatter, `OUTCOME` with
245
+ success/error/abort, and `USED_BROWSE` with true/false based on whether `$B` was used.
246
+ If you cannot determine the outcome, use "unknown". This runs in the background and
247
+ never blocks the user.
248
+
249
+ ## Step 0: Detect base branch
250
+
251
+ Determine which branch this PR targets. Use the result as "the base branch" in all subsequent steps.
252
+
253
+ 1. Check if a PR already exists for this branch:
254
+ `gh pr view --json baseRefName -q .baseRefName`
255
+ If this succeeds, use the printed branch name as the base branch.
256
+
257
+ 2. If no PR exists (command fails), detect the repo's default branch:
258
+ `gh repo view --json defaultBranchRef -q .defaultBranchRef.name`
259
+
260
+ 3. If both commands fail, fall back to `main`.
261
+
262
+ Print the detected base branch name. In every subsequent `git diff`, `git log`,
263
+ `git fetch`, `git merge`, and `gh pr create` command, substitute the detected
264
+ branch name wherever the instructions say "the base branch."
265
+
266
+ ---
267
+
268
+ # Ship: Fully Automated Ship Workflow
269
+
270
+ You are running the `/ship` workflow. This is a **non-interactive, fully automated** workflow. Do NOT ask for confirmation at any step. The user said `/ship` which means DO IT. Run straight through and output the PR URL at the end.
271
+
272
+ **Only stop for:**
273
+ - On the base branch (abort)
274
+ - Merge conflicts that can't be auto-resolved (stop, show conflicts)
275
+ - In-branch test failures (pre-existing failures are triaged, not auto-blocking)
276
+ - Pre-landing review finds ASK items that need user judgment
277
+ - MINOR or MAJOR version bump needed (ask — see Step 4)
278
+ - Greptile review comments that need user decision (complex fixes, false positives)
279
+ - TODOS.md missing and user wants to create one (ask — see Step 5.5)
280
+ - TODOS.md disorganized and user wants to reorganize (ask — see Step 5.5)
281
+
282
+ **Never stop for:**
283
+ - Uncommitted changes (always include them)
284
+ - Version bump choice (auto-pick MICRO or PATCH — see Step 4)
285
+ - CHANGELOG content (auto-generate from diff)
286
+ - Commit message approval (auto-commit)
287
+ - Multi-file changesets (auto-split into bisectable commits)
288
+ - TODOS.md completed-item detection (auto-mark)
289
+ - Auto-fixable review findings (dead code, N+1, stale comments — fixed automatically)
290
+ - Test coverage gaps (auto-generate and commit, or flag in PR body)
291
+
292
+ ---
293
+
294
+ ## Step 1: Pre-flight
295
+
296
+ 1. Check the current branch. If on the base branch or the repo's default branch, **abort**: "You're on the base branch. Ship from a feature branch."
297
+
298
+ 2. Run `git status` (never use `-uall`). Uncommitted changes are always included — no need to ask.
299
+
300
+ 3. Run `git diff <base>...HEAD --stat` and `git log <base>..HEAD --oneline` to understand what's being shipped.
301
+
302
+ 4. Check review readiness:
303
+
304
+ ## Review Readiness Dashboard
305
+
306
+ After completing the review, read the review log and config to display the dashboard.
307
+
308
+ ```bash
309
+ ~/.codex/skills/gstack/bin/gstack-review-read
310
+ ```
311
+
312
+ Parse the output. Find the most recent entry for each skill (plan-ceo-review, plan-eng-review, plan-design-review, design-review-lite, adversarial-review, codex-review). Ignore entries with timestamps older than 7 days. For the Adversarial row, show whichever is more recent between `adversarial-review` (new auto-scaled) and `codex-review` (legacy). For Design Review, show whichever is more recent between `plan-design-review` (full visual audit) and `design-review-lite` (code-level check). Append "(FULL)" or "(LITE)" to the status to distinguish. Display:
313
+
314
+ ```
315
+ +====================================================================+
316
+ | REVIEW READINESS DASHBOARD |
317
+ +====================================================================+
318
+ | Review | Runs | Last Run | Status | Required |
319
+ |-----------------|------|---------------------|-----------|----------|
320
+ | Eng Review | 1 | 2026-03-16 15:00 | CLEAR | YES |
321
+ | CEO Review | 0 | — | — | no |
322
+ | Design Review | 0 | — | — | no |
323
+ | Adversarial | 0 | — | — | no |
324
+ +--------------------------------------------------------------------+
325
+ | VERDICT: CLEARED — Eng Review passed |
326
+ +====================================================================+
327
+ ```
328
+
329
+ **Review tiers:**
330
+ - **Eng Review (required by default):** The only review that gates shipping. Covers architecture, code quality, tests, performance. Can be disabled globally with \`gstack-config set skip_eng_review true\` (the "don't bother me" setting).
331
+ - **CEO Review (optional):** Use your judgment. Recommend it for big product/business changes, new user-facing features, or scope decisions. Skip for bug fixes, refactors, infra, and cleanup.
332
+ - **Design Review (optional):** Use your judgment. Recommend it for UI/UX changes. Skip for backend-only, infra, or prompt-only changes.
333
+ - **Adversarial Review (automatic):** Auto-scales by diff size. Small diffs (<50 lines) skip adversarial. Medium diffs (50–199) get cross-model adversarial. Large diffs (200+) get all 4 passes: Claude structured, Codex structured, Claude adversarial subagent, Codex adversarial. No configuration needed.
334
+
335
+ **Verdict logic:**
336
+ - **CLEARED**: Eng Review has >= 1 entry within 7 days with status "clean" (or \`skip_eng_review\` is \`true\`)
337
+ - **NOT CLEARED**: Eng Review missing, stale (>7 days), or has open issues
338
+ - CEO, Design, and Codex reviews are shown for context but never block shipping
339
+ - If \`skip_eng_review\` config is \`true\`, Eng Review shows "SKIPPED (global)" and verdict is CLEARED
340
+
341
+ **Staleness detection:** After displaying the dashboard, check if any existing reviews may be stale:
342
+ - Parse the \`---HEAD---\` section from the bash output to get the current HEAD commit hash
343
+ - For each review entry that has a \`commit\` field: compare it against the current HEAD. If different, count elapsed commits: \`git rev-list --count STORED_COMMIT..HEAD\`. Display: "Note: {skill} review from {date} may be stale — {N} commits since review"
344
+ - For entries without a \`commit\` field (legacy entries): display "Note: {skill} review from {date} has no commit tracking — consider re-running for accurate staleness detection"
345
+ - If all reviews match the current HEAD, do not display any staleness notes
346
+
347
+ If the Eng Review is NOT "CLEAR":
348
+
349
+ 1. **Check for a prior override on this branch:**
350
+ ```bash
351
+ source <(~/.codex/skills/gstack/bin/gstack-slug 2>/dev/null)
352
+ grep '"skill":"ship-review-override"' ~/.gstack/projects/$SLUG/$BRANCH-reviews.jsonl 2>/dev/null || echo "NO_OVERRIDE"
353
+ ```
354
+ If an override exists, display the dashboard and note "Review gate previously accepted — continuing." Do NOT ask again.
355
+
356
+ 2. **If no override exists,** use AskUserQuestion:
357
+ - Show that Eng Review is missing or has open issues
358
+ - RECOMMENDATION: Choose C if the change is obviously trivial (< 20 lines, typo fix, config-only); Choose B for larger changes
359
+ - Options: A) Ship anyway B) Abort — run /plan-eng-review first C) Change is too small to need eng review
360
+ - If CEO Review is missing, mention as informational ("CEO Review not run — recommended for product changes") but do NOT block
361
+ - For Design Review: run `source <(~/.codex/skills/gstack/bin/gstack-diff-scope <base> 2>/dev/null)`. If `SCOPE_FRONTEND=true` and no design review (plan-design-review or design-review-lite) exists in the dashboard, mention: "Design Review not run — this PR changes frontend code. The lite design check will run automatically in Step 3.5, but consider running /design-review for a full visual audit post-implementation." Still never block.
362
+
363
+ 3. **If the user chooses A or C,** persist the decision so future `/ship` runs on this branch skip the gate:
364
+ ```bash
365
+ source <(~/.codex/skills/gstack/bin/gstack-slug 2>/dev/null)
366
+ echo '{"skill":"ship-review-override","timestamp":"'"$(date -u +%Y-%m-%dT%H:%M:%SZ)"'","decision":"USER_CHOICE"}' >> ~/.gstack/projects/$SLUG/$BRANCH-reviews.jsonl
367
+ ```
368
+ Substitute USER_CHOICE with "ship_anyway" or "not_relevant".
369
+
370
+ ---
371
+
372
+ ## Step 2: Merge the base branch (BEFORE tests)
373
+
374
+ Fetch and merge the base branch into the feature branch so tests run against the merged state:
375
+
376
+ ```bash
377
+ git fetch origin <base> && git merge origin/<base> --no-edit
378
+ ```
379
+
380
+ **If there are merge conflicts:** Try to auto-resolve if they are simple (VERSION, schema.rb, CHANGELOG ordering). If conflicts are complex or ambiguous, **STOP** and show them.
381
+
382
+ **If already up to date:** Continue silently.
383
+
384
+ ---
385
+
386
+ ## Step 2.5: Test Framework Bootstrap
387
+
388
+ ## Test Framework Bootstrap
389
+
390
+ **Detect existing test framework and project runtime:**
391
+
392
+ ```bash
393
+ # Detect project runtime
394
+ [ -f Gemfile ] && echo "RUNTIME:ruby"
395
+ [ -f package.json ] && echo "RUNTIME:node"
396
+ [ -f requirements.txt ] || [ -f pyproject.toml ] && echo "RUNTIME:python"
397
+ [ -f go.mod ] && echo "RUNTIME:go"
398
+ [ -f Cargo.toml ] && echo "RUNTIME:rust"
399
+ [ -f composer.json ] && echo "RUNTIME:php"
400
+ [ -f mix.exs ] && echo "RUNTIME:elixir"
401
+ # Detect sub-frameworks
402
+ [ -f Gemfile ] && grep -q "rails" Gemfile 2>/dev/null && echo "FRAMEWORK:rails"
403
+ [ -f package.json ] && grep -q '"next"' package.json 2>/dev/null && echo "FRAMEWORK:nextjs"
404
+ # Check for existing test infrastructure
405
+ ls jest.config.* vitest.config.* playwright.config.* .rspec pytest.ini pyproject.toml phpunit.xml 2>/dev/null
406
+ ls -d test/ tests/ spec/ __tests__/ cypress/ e2e/ 2>/dev/null
407
+ # Check opt-out marker
408
+ [ -f .gstack/no-test-bootstrap ] && echo "BOOTSTRAP_DECLINED"
409
+ ```
410
+
411
+ **If test framework detected** (config files or test directories found):
412
+ Print "Test framework detected: {name} ({N} existing tests). Skipping bootstrap."
413
+ Read 2-3 existing test files to learn conventions (naming, imports, assertion style, setup patterns).
414
+ Store conventions as prose context for use in Phase 8e.5 or Step 3.4. **Skip the rest of bootstrap.**
415
+
416
+ **If BOOTSTRAP_DECLINED** appears: Print "Test bootstrap previously declined — skipping." **Skip the rest of bootstrap.**
417
+
418
+ **If NO runtime detected** (no config files found): Use AskUserQuestion:
419
+ "I couldn't detect your project's language. What runtime are you using?"
420
+ Options: A) Node.js/TypeScript B) Ruby/Rails C) Python D) Go E) Rust F) PHP G) Elixir H) This project doesn't need tests.
421
+ If user picks H → write `.gstack/no-test-bootstrap` and continue without tests.
422
+
423
+ **If runtime detected but no test framework — bootstrap:**
424
+
425
+ ### B2. Research best practices
426
+
427
+ Use WebSearch to find current best practices for the detected runtime:
428
+ - `"[runtime] best test framework 2025 2026"`
429
+ - `"[framework A] vs [framework B] comparison"`
430
+
431
+ If WebSearch is unavailable, use this built-in knowledge table:
432
+
433
+ | Runtime | Primary recommendation | Alternative |
434
+ |---------|----------------------|-------------|
435
+ | Ruby/Rails | minitest + fixtures + capybara | rspec + factory_bot + shoulda-matchers |
436
+ | Node.js | vitest + @testing-library | jest + @testing-library |
437
+ | Next.js | vitest + @testing-library/react + playwright | jest + cypress |
438
+ | Python | pytest + pytest-cov | unittest |
439
+ | Go | stdlib testing + testify | stdlib only |
440
+ | Rust | cargo test (built-in) + mockall | — |
441
+ | PHP | phpunit + mockery | pest |
442
+ | Elixir | ExUnit (built-in) + ex_machina | — |
443
+
444
+ ### B3. Framework selection
445
+
446
+ Use AskUserQuestion:
447
+ "I detected this is a [Runtime/Framework] project with no test framework. I researched current best practices. Here are the options:
448
+ A) [Primary] — [rationale]. Includes: [packages]. Supports: unit, integration, smoke, e2e
449
+ B) [Alternative] — [rationale]. Includes: [packages]
450
+ C) Skip — don't set up testing right now
451
+ RECOMMENDATION: Choose A because [reason based on project context]"
452
+
453
+ If user picks C → write `.gstack/no-test-bootstrap`. Tell user: "If you change your mind later, delete `.gstack/no-test-bootstrap` and re-run." Continue without tests.
454
+
455
+ If multiple runtimes detected (monorepo) → ask which runtime to set up first, with option to do both sequentially.
456
+
457
+ ### B4. Install and configure
458
+
459
+ 1. Install the chosen packages (npm/bun/gem/pip/etc.)
460
+ 2. Create minimal config file
461
+ 3. Create directory structure (test/, spec/, etc.)
462
+ 4. Create one example test matching the project's code to verify setup works
463
+
464
+ If package installation fails → debug once. If still failing → revert with `git checkout -- package.json package-lock.json` (or equivalent for the runtime). Warn user and continue without tests.
465
+
466
+ ### B4.5. First real tests
467
+
468
+ Generate 3-5 real tests for existing code:
469
+
470
+ 1. **Find recently changed files:** `git log --since=30.days --name-only --format="" | sort | uniq -c | sort -rn | head -10`
471
+ 2. **Prioritize by risk:** Error handlers > business logic with conditionals > API endpoints > pure functions
472
+ 3. **For each file:** Write one test that tests real behavior with meaningful assertions. Never `expect(x).toBeDefined()` — test what the code DOES.
473
+ 4. Run each test. Passes → keep. Fails → fix once. Still fails → delete silently.
474
+ 5. Generate at least 1 test, cap at 5.
475
+
476
+ Never import secrets, API keys, or credentials in test files. Use environment variables or test fixtures.
477
+
478
+ ### B5. Verify
479
+
480
+ ```bash
481
+ # Run the full test suite to confirm everything works
482
+ {detected test command}
483
+ ```
484
+
485
+ If tests fail → debug once. If still failing → revert all bootstrap changes and warn user.
486
+
487
+ ### B5.5. CI/CD pipeline
488
+
489
+ ```bash
490
+ # Check CI provider
491
+ ls -d .github/ 2>/dev/null && echo "CI:github"
492
+ ls .gitlab-ci.yml .circleci/ bitrise.yml 2>/dev/null
493
+ ```
494
+
495
+ If `.github/` exists (or no CI detected — default to GitHub Actions):
496
+ Create `.github/workflows/test.yml` with:
497
+ - `runs-on: ubuntu-latest`
498
+ - Appropriate setup action for the runtime (setup-node, setup-ruby, setup-python, etc.)
499
+ - The same test command verified in B5
500
+ - Trigger: push + pull_request
501
+
502
+ If non-GitHub CI detected → skip CI generation with note: "Detected {provider} — CI pipeline generation supports GitHub Actions only. Add test step to your existing pipeline manually."
503
+
504
+ ### B6. Create TESTING.md
505
+
506
+ First check: If TESTING.md already exists → read it and update/append rather than overwriting. Never destroy existing content.
507
+
508
+ Write TESTING.md with:
509
+ - Philosophy: "100% test coverage is the key to great vibe coding. Tests let you move fast, trust your instincts, and ship with confidence — without them, vibe coding is just yolo coding. With tests, it's a superpower."
510
+ - Framework name and version
511
+ - How to run tests (the verified command from B5)
512
+ - Test layers: Unit tests (what, where, when), Integration tests, Smoke tests, E2E tests
513
+ - Conventions: file naming, assertion style, setup/teardown patterns
514
+
515
+ ### B7. Update CLAUDE.md
516
+
517
+ First check: If CLAUDE.md already has a `## Testing` section → skip. Don't duplicate.
518
+
519
+ Append a `## Testing` section:
520
+ - Run command and test directory
521
+ - Reference to TESTING.md
522
+ - Test expectations:
523
+ - 100% test coverage is the goal — tests make vibe coding safe
524
+ - When writing new functions, write a corresponding test
525
+ - When fixing a bug, write a regression test
526
+ - When adding error handling, write a test that triggers the error
527
+ - When adding a conditional (if/else, switch), write tests for BOTH paths
528
+ - Never commit code that makes existing tests fail
529
+
530
+ ### B8. Commit
531
+
532
+ ```bash
533
+ git status --porcelain
534
+ ```
535
+
536
+ Only commit if there are changes. Stage all bootstrap files (config, test directory, TESTING.md, CLAUDE.md, .github/workflows/test.yml if created):
537
+ `git commit -m "chore: bootstrap test framework ({framework name})"`
538
+
539
+ ---
540
+
541
+ ---
542
+
543
+ ## Step 3: Run tests (on merged code)
544
+
545
+ **Do NOT run `RAILS_ENV=test bin/rails db:migrate`** — `bin/test-lane` already calls
546
+ `db:test:prepare` internally, which loads the schema into the correct lane database.
547
+ Running bare test migrations without INSTANCE hits an orphan DB and corrupts structure.sql.
548
+
549
+ Run both test suites in parallel:
550
+
551
+ ```bash
552
+ bin/test-lane 2>&1 | tee /tmp/ship_tests.txt &
553
+ npm run test 2>&1 | tee /tmp/ship_vitest.txt &
554
+ wait
555
+ ```
556
+
557
+ After both complete, read the output files and check pass/fail.
558
+
559
+ **If any test fails:** Do NOT immediately stop. Apply the Test Failure Ownership Triage:
560
+
561
+ ## Test Failure Ownership Triage
562
+
563
+ When tests fail, do NOT immediately stop. First, determine ownership:
564
+
565
+ ### Step T1: Classify each failure
566
+
567
+ For each failing test:
568
+
569
+ 1. **Get the files changed on this branch:**
570
+ ```bash
571
+ git diff origin/<base>...HEAD --name-only
572
+ ```
573
+
574
+ 2. **Classify the failure:**
575
+ - **In-branch** if: the failing test file itself was modified on this branch, OR the test output references code that was changed on this branch, OR you can trace the failure to a change in the branch diff.
576
+ - **Likely pre-existing** if: neither the test file nor the code it tests was modified on this branch, AND the failure is unrelated to any branch change you can identify.
577
+ - **When ambiguous, default to in-branch.** It is safer to stop the developer than to let a broken test ship. Only classify as pre-existing when you are confident.
578
+
579
+ This classification is heuristic — use your judgment reading the diff and the test output. You do not have a programmatic dependency graph.
580
+
581
+ ### Step T2: Handle in-branch failures
582
+
583
+ **STOP.** These are your failures. Show them and do not proceed. The developer must fix their own broken tests before shipping.
584
+
585
+ ### Step T3: Handle pre-existing failures
586
+
587
+ Check `REPO_MODE` from the preamble output.
588
+
589
+ **If REPO_MODE is `solo`:**
590
+
591
+ Use AskUserQuestion:
592
+
593
+ > These test failures appear pre-existing (not caused by your branch changes):
594
+ >
595
+ > [list each failure with file:line and brief error description]
596
+ >
597
+ > Since this is a solo repo, you're the only one who will fix these.
598
+ >
599
+ > RECOMMENDATION: Choose A — fix now while the context is fresh. Completeness: 9/10.
600
+ > A) Investigate and fix now (human: ~2-4h / CC: ~15min) — Completeness: 10/10
601
+ > B) Add as P0 TODO — fix after this branch lands — Completeness: 7/10
602
+ > C) Skip — I know about this, ship anyway — Completeness: 3/10
603
+
604
+ **If REPO_MODE is `collaborative` or `unknown`:**
605
+
606
+ Use AskUserQuestion:
607
+
608
+ > These test failures appear pre-existing (not caused by your branch changes):
609
+ >
610
+ > [list each failure with file:line and brief error description]
611
+ >
612
+ > This is a collaborative repo — these may be someone else's responsibility.
613
+ >
614
+ > RECOMMENDATION: Choose B — assign it to whoever broke it so the right person fixes it. Completeness: 9/10.
615
+ > A) Investigate and fix now anyway — Completeness: 10/10
616
+ > B) Blame + assign GitHub issue to the author — Completeness: 9/10
617
+ > C) Add as P0 TODO — Completeness: 7/10
618
+ > D) Skip — ship anyway — Completeness: 3/10
619
+
620
+ ### Step T4: Execute the chosen action
621
+
622
+ **If "Investigate and fix now":**
623
+ - Switch to /investigate mindset: root cause first, then minimal fix.
624
+ - Fix the pre-existing failure.
625
+ - Commit the fix separately from the branch's changes: `git commit -m "fix: pre-existing test failure in <test-file>"`
626
+ - Continue with the workflow.
627
+
628
+ **If "Add as P0 TODO":**
629
+ - If `TODOS.md` exists, add the entry following the format in `review/TODOS-format.md` (or `.agents/skills/gstack/review/TODOS-format.md`).
630
+ - If `TODOS.md` does not exist, create it with the standard header and add the entry.
631
+ - Entry should include: title, the error output, which branch it was noticed on, and priority P0.
632
+ - Continue with the workflow — treat the pre-existing failure as non-blocking.
633
+
634
+ **If "Blame + assign GitHub issue" (collaborative only):**
635
+ - Find who likely broke it. Check BOTH the test file AND the production code it tests:
636
+ ```bash
637
+ # Who last touched the failing test?
638
+ git log --format="%an (%ae)" -1 -- <failing-test-file>
639
+ # Who last touched the production code the test covers? (often the actual breaker)
640
+ git log --format="%an (%ae)" -1 -- <source-file-under-test>
641
+ ```
642
+ If these are different people, prefer the production code author — they likely introduced the regression.
643
+ - Create a GitHub issue assigned to that person:
644
+ ```bash
645
+ gh issue create \
646
+ --title "Pre-existing test failure: <test-name>" \
647
+ --body "Found failing on branch <current-branch>. Failure is pre-existing.\n\n**Error:**\n```\n<first 10 lines>\n```\n\n**Last modified by:** <author>\n**Noticed by:** gstack /ship on <date>" \
648
+ --assignee "<github-username>"
649
+ ```
650
+ - If `gh` is not available or `--assignee` fails (user not in org, etc.), create the issue without assignee and note who should look at it in the body.
651
+ - Continue with the workflow.
652
+
653
+ **If "Skip":**
654
+ - Continue with the workflow.
655
+ - Note in output: "Pre-existing test failure skipped: <test-name>"
656
+
657
+ **After triage:** If any in-branch failures remain unfixed, **STOP**. Do not proceed. If all failures were pre-existing and handled (fixed, TODOed, assigned, or skipped), continue to Step 3.25.
658
+
659
+ **If all pass:** Continue silently — just note the counts briefly.
660
+
661
+ ---
662
+
663
+ ## Step 3.25: Eval Suites (conditional)
664
+
665
+ Evals are mandatory when prompt-related files change. Skip this step entirely if no prompt files are in the diff.
666
+
667
+ **1. Check if the diff touches prompt-related files:**
668
+
669
+ ```bash
670
+ git diff origin/<base> --name-only
671
+ ```
672
+
673
+ Match against these patterns (from CLAUDE.md):
674
+ - `app/services/*_prompt_builder.rb`
675
+ - `app/services/*_generation_service.rb`, `*_writer_service.rb`, `*_designer_service.rb`
676
+ - `app/services/*_evaluator.rb`, `*_scorer.rb`, `*_classifier_service.rb`, `*_analyzer.rb`
677
+ - `app/services/concerns/*voice*.rb`, `*writing*.rb`, `*prompt*.rb`, `*token*.rb`
678
+ - `app/services/chat_tools/*.rb`, `app/services/x_thread_tools/*.rb`
679
+ - `config/system_prompts/*.txt`
680
+ - `test/evals/**/*` (eval infrastructure changes affect all suites)
681
+
682
+ **If no matches:** Print "No prompt-related files changed — skipping evals." and continue to Step 3.5.
683
+
684
+ **2. Identify affected eval suites:**
685
+
686
+ Each eval runner (`test/evals/*_eval_runner.rb`) declares `PROMPT_SOURCE_FILES` listing which source files affect it. Grep these to find which suites match the changed files:
687
+
688
+ ```bash
689
+ grep -l "changed_file_basename" test/evals/*_eval_runner.rb
690
+ ```
691
+
692
+ Map runner → test file: `post_generation_eval_runner.rb` → `post_generation_eval_test.rb`.
693
+
694
+ **Special cases:**
695
+ - Changes to `test/evals/judges/*.rb`, `test/evals/support/*.rb`, or `test/evals/fixtures/` affect ALL suites that use those judges/support files. Check imports in the eval test files to determine which.
696
+ - Changes to `config/system_prompts/*.txt` — grep eval runners for the prompt filename to find affected suites.
697
+ - If unsure which suites are affected, run ALL suites that could plausibly be impacted. Over-testing is better than missing a regression.
698
+
699
+ **3. Run affected suites at `EVAL_JUDGE_TIER=full`:**
700
+
701
+ `/ship` is a pre-merge gate, so always use full tier (Sonnet structural + Opus persona judges).
702
+
703
+ ```bash
704
+ EVAL_JUDGE_TIER=full EVAL_VERBOSE=1 bin/test-lane --eval test/evals/<suite>_eval_test.rb 2>&1 | tee /tmp/ship_evals.txt
705
+ ```
706
+
707
+ If multiple suites need to run, run them sequentially (each needs a test lane). If the first suite fails, stop immediately — don't burn API cost on remaining suites.
708
+
709
+ **4. Check results:**
710
+
711
+ - **If any eval fails:** Show the failures, the cost dashboard, and **STOP**. Do not proceed.
712
+ - **If all pass:** Note pass counts and cost. Continue to Step 3.5.
713
+
714
+ **5. Save eval output** — include eval results and cost dashboard in the PR body (Step 8).
715
+
716
+ **Tier reference (for context — /ship always uses `full`):**
717
+ | Tier | When | Speed (cached) | Cost |
718
+ |------|------|----------------|------|
719
+ | `fast` (Haiku) | Dev iteration, smoke tests | ~5s (14x faster) | ~$0.07/run |
720
+ | `standard` (Sonnet) | Default dev, `bin/test-lane --eval` | ~17s (4x faster) | ~$0.37/run |
721
+ | `full` (Opus persona) | **`/ship` and pre-merge** | ~72s (baseline) | ~$1.27/run |
722
+
723
+ ---
724
+
725
+ ## Step 3.4: Test Coverage Audit
726
+
727
+ 100% coverage is the goal — every untested path is a path where bugs hide and vibe coding becomes yolo coding. Evaluate what was ACTUALLY coded (from the diff), not what was planned.
728
+
729
+ ### Test Framework Detection
730
+
731
+ Before analyzing coverage, detect the project's test framework:
732
+
733
+ 1. **Read CLAUDE.md** — look for a `## Testing` section with test command and framework name. If found, use that as the authoritative source.
734
+ 2. **If CLAUDE.md has no testing section, auto-detect:**
735
+
736
+ ```bash
737
+ # Detect project runtime
738
+ [ -f Gemfile ] && echo "RUNTIME:ruby"
739
+ [ -f package.json ] && echo "RUNTIME:node"
740
+ [ -f requirements.txt ] || [ -f pyproject.toml ] && echo "RUNTIME:python"
741
+ [ -f go.mod ] && echo "RUNTIME:go"
742
+ [ -f Cargo.toml ] && echo "RUNTIME:rust"
743
+ # Check for existing test infrastructure
744
+ ls jest.config.* vitest.config.* playwright.config.* cypress.config.* .rspec pytest.ini phpunit.xml 2>/dev/null
745
+ ls -d test/ tests/ spec/ __tests__/ cypress/ e2e/ 2>/dev/null
746
+ ```
747
+
748
+ 3. **If no framework detected:** falls through to the Test Framework Bootstrap step (Step 2.5) which handles full setup.
749
+
750
+ **0. Before/after test count:**
751
+
752
+ ```bash
753
+ # Count test files before any generation
754
+ find . -name '*.test.*' -o -name '*.spec.*' -o -name '*_test.*' -o -name '*_spec.*' | grep -v node_modules | wc -l
755
+ ```
756
+
757
+ Store this number for the PR body.
758
+
759
+ **1. Trace every codepath changed** using `git diff origin/<base>...HEAD`:
760
+
761
+ Read every changed file. For each one, trace how data flows through the code — don't just list functions, actually follow the execution:
762
+
763
+ 1. **Read the diff.** For each changed file, read the full file (not just the diff hunk) to understand context.
764
+ 2. **Trace data flow.** Starting from each entry point (route handler, exported function, event listener, component render), follow the data through every branch:
765
+ - Where does input come from? (request params, props, database, API call)
766
+ - What transforms it? (validation, mapping, computation)
767
+ - Where does it go? (database write, API response, rendered output, side effect)
768
+ - What can go wrong at each step? (null/undefined, invalid input, network failure, empty collection)
769
+ 3. **Diagram the execution.** For each changed file, draw an ASCII diagram showing:
770
+ - Every function/method that was added or modified
771
+ - Every conditional branch (if/else, switch, ternary, guard clause, early return)
772
+ - Every error path (try/catch, rescue, error boundary, fallback)
773
+ - Every call to another function (trace into it — does IT have untested branches?)
774
+ - Every edge: what happens with null input? Empty array? Invalid type?
775
+
776
+ This is the critical step — you're building a map of every line of code that can execute differently based on input. Every branch in this diagram needs a test.
777
+
778
+ **2. Map user flows, interactions, and error states:**
779
+
780
+ Code coverage isn't enough — you need to cover how real users interact with the changed code. For each changed feature, think through:
781
+
782
+ - **User flows:** What sequence of actions does a user take that touches this code? Map the full journey (e.g., "user clicks 'Pay' → form validates → API call → success/failure screen"). Each step in the journey needs a test.
783
+ - **Interaction edge cases:** What happens when the user does something unexpected?
784
+ - Double-click/rapid resubmit
785
+ - Navigate away mid-operation (back button, close tab, click another link)
786
+ - Submit with stale data (page sat open for 30 minutes, session expired)
787
+ - Slow connection (API takes 10 seconds — what does the user see?)
788
+ - Concurrent actions (two tabs, same form)
789
+ - **Error states the user can see:** For every error the code handles, what does the user actually experience?
790
+ - Is there a clear error message or a silent failure?
791
+ - Can the user recover (retry, go back, fix input) or are they stuck?
792
+ - What happens with no network? With a 500 from the API? With invalid data from the server?
793
+ - **Empty/zero/boundary states:** What does the UI show with zero results? With 10,000 results? With a single character input? With maximum-length input?
794
+
795
+ Add these to your diagram alongside the code branches. A user flow with no test is just as much a gap as an untested if/else.
796
+
797
+ **3. Check each branch against existing tests:**
798
+
799
+ Go through your diagram branch by branch — both code paths AND user flows. For each one, search for a test that exercises it:
800
+ - Function `processPayment()` → look for `billing.test.ts`, `billing.spec.ts`, `test/billing_test.rb`
801
+ - An if/else → look for tests covering BOTH the true AND false path
802
+ - An error handler → look for a test that triggers that specific error condition
803
+ - A call to `helperFn()` that has its own branches → those branches need tests too
804
+ - A user flow → look for an integration or E2E test that walks through the journey
805
+ - An interaction edge case → look for a test that simulates the unexpected action
806
+
807
+ Quality scoring rubric:
808
+ - ★★★ Tests behavior with edge cases AND error paths
809
+ - ★★ Tests correct behavior, happy path only
810
+ - ★ Smoke test / existence check / trivial assertion (e.g., "it renders", "it doesn't throw")
811
+
812
+ ### E2E Test Decision Matrix
813
+
814
+ When checking each branch, also determine whether a unit test or E2E/integration test is the right tool:
815
+
816
+ **RECOMMEND E2E (mark as [→E2E] in the diagram):**
817
+ - Common user flow spanning 3+ components/services (e.g., signup → verify email → first login)
818
+ - Integration point where mocking hides real failures (e.g., API → queue → worker → DB)
819
+ - Auth/payment/data-destruction flows — too important to trust unit tests alone
820
+
821
+ **RECOMMEND EVAL (mark as [→EVAL] in the diagram):**
822
+ - Critical LLM call that needs a quality eval (e.g., prompt change → test output still meets quality bar)
823
+ - Changes to prompt templates, system instructions, or tool definitions
824
+
825
+ **STICK WITH UNIT TESTS:**
826
+ - Pure function with clear inputs/outputs
827
+ - Internal helper with no side effects
828
+ - Edge case of a single function (null input, empty array)
829
+ - Obscure/rare flow that isn't customer-facing
830
+
831
+ ### REGRESSION RULE (mandatory)
832
+
833
+ **IRON RULE:** When the coverage audit identifies a REGRESSION — code that previously worked but the diff broke — a regression test is written immediately. No AskUserQuestion. No skipping. Regressions are the highest-priority test because they prove something broke.
834
+
835
+ A regression is when:
836
+ - The diff modifies existing behavior (not new code)
837
+ - The existing test suite (if any) doesn't cover the changed path
838
+ - The change introduces a new failure mode for existing callers
839
+
840
+ When uncertain whether a change is a regression, err on the side of writing the test.
841
+
842
+ Format: commit as `test: regression test for {what broke}`
843
+
844
+ **4. Output ASCII coverage diagram:**
845
+
846
+ Include BOTH code paths and user flows in the same diagram. Mark E2E-worthy and eval-worthy paths:
847
+
848
+ ```
849
+ CODE PATH COVERAGE
850
+ ===========================
851
+ [+] src/services/billing.ts
852
+
853
+ ├── processPayment()
854
+ │ ├── [★★★ TESTED] Happy path + card declined + timeout — billing.test.ts:42
855
+ │ ├── [GAP] Network timeout — NO TEST
856
+ │ └── [GAP] Invalid currency — NO TEST
857
+
858
+ └── refundPayment()
859
+ ├── [★★ TESTED] Full refund — billing.test.ts:89
860
+ └── [★ TESTED] Partial refund (checks non-throw only) — billing.test.ts:101
861
+
862
+ USER FLOW COVERAGE
863
+ ===========================
864
+ [+] Payment checkout flow
865
+
866
+ ├── [★★★ TESTED] Complete purchase — checkout.e2e.ts:15
867
+ ├── [GAP] [→E2E] Double-click submit — needs E2E, not just unit
868
+ ├── [GAP] Navigate away during payment — unit test sufficient
869
+ └── [★ TESTED] Form validation errors (checks render only) — checkout.test.ts:40
870
+
871
+ [+] Error states
872
+
873
+ ├── [★★ TESTED] Card declined message — billing.test.ts:58
874
+ ├── [GAP] Network timeout UX (what does user see?) — NO TEST
875
+ └── [GAP] Empty cart submission — NO TEST
876
+
877
+ [+] LLM integration
878
+
879
+ └── [GAP] [→EVAL] Prompt template change — needs eval test
880
+
881
+ ─────────────────────────────────
882
+ COVERAGE: 5/13 paths tested (38%)
883
+ Code paths: 3/5 (60%)
884
+ User flows: 2/8 (25%)
885
+ QUALITY: ★★★: 2 ★★: 2 ★: 1
886
+ GAPS: 8 paths need tests (2 need E2E, 1 needs eval)
887
+ ─────────────────────────────────
888
+ ```
889
+
890
+ **Fast path:** All paths covered → "Step 3.4: All new code paths have test coverage ✓" Continue.
891
+
892
+ **5. Generate tests for uncovered paths:**
893
+
894
+ If test framework detected (or bootstrapped in Step 2.5):
895
+ - Prioritize error handlers and edge cases first (happy paths are more likely already tested)
896
+ - Read 2-3 existing test files to match conventions exactly
897
+ - Generate unit tests. Mock all external dependencies (DB, API, Redis).
898
+ - For paths marked [→E2E]: generate integration/E2E tests using the project's E2E framework (Playwright, Cypress, Capybara, etc.)
899
+ - For paths marked [→EVAL]: generate eval tests using the project's eval framework, or flag for manual eval if none exists
900
+ - Write tests that exercise the specific uncovered path with real assertions
901
+ - Run each test. Passes → commit as `test: coverage for {feature}`
902
+ - Fails → fix once. Still fails → revert, note gap in diagram.
903
+
904
+ Caps: 30 code paths max, 20 tests generated max (code + user flow combined), 2-min per-test exploration cap.
905
+
906
+ If no test framework AND user declined bootstrap → diagram only, no generation. Note: "Test generation skipped — no test framework configured."
907
+
908
+ **Diff is test-only changes:** Skip Step 3.4 entirely: "No new application code paths to audit."
909
+
910
+ **6. After-count and coverage summary:**
911
+
912
+ ```bash
913
+ # Count test files after generation
914
+ find . -name '*.test.*' -o -name '*.spec.*' -o -name '*_test.*' -o -name '*_spec.*' | grep -v node_modules | wc -l
915
+ ```
916
+
917
+ For PR body: `Tests: {before} → {after} (+{delta} new)`
918
+ Coverage line: `Test Coverage Audit: N new code paths. M covered (X%). K tests generated, J committed.`
919
+
920
+ ### Test Plan Artifact
921
+
922
+ After producing the coverage diagram, write a test plan artifact so `/qa` and `/qa-only` can consume it:
923
+
924
+ ```bash
925
+ source <(~/.codex/skills/gstack/bin/gstack-slug 2>/dev/null) && mkdir -p ~/.gstack/projects/$SLUG
926
+ USER=$(whoami)
927
+ DATETIME=$(date +%Y%m%d-%H%M%S)
928
+ ```
929
+
930
+ Write to `~/.gstack/projects/{slug}/{user}-{branch}-ship-test-plan-{datetime}.md`:
931
+
932
+ ```markdown
933
+ # Test Plan
934
+ Generated by /ship on {date}
935
+ Branch: {branch}
936
+ Repo: {owner/repo}
937
+
938
+ ## Affected Pages/Routes
939
+ - {URL path} — {what to test and why}
940
+
941
+ ## Key Interactions to Verify
942
+ - {interaction description} on {page}
943
+
944
+ ## Edge Cases
945
+ - {edge case} on {page}
946
+
947
+ ## Critical Paths
948
+ - {end-to-end flow that must work}
949
+ ```
950
+
951
+ ---
952
+
953
+ ## Step 3.5: Pre-Landing Review
954
+
955
+ Review the diff for structural issues that tests don't catch.
956
+
957
+ 1. Read `.agents/skills/gstack/review/checklist.md`. If the file cannot be read, **STOP** and report the error.
958
+
959
+ 2. Run `git diff origin/<base>` to get the full diff (scoped to feature changes against the freshly-fetched base branch).
960
+
961
+ 3. Apply the review checklist in two passes:
962
+ - **Pass 1 (CRITICAL):** SQL & Data Safety, LLM Output Trust Boundary
963
+ - **Pass 2 (INFORMATIONAL):** All remaining categories
964
+
965
+ ## Design Review (conditional, diff-scoped)
966
+
967
+ Check if the diff touches frontend files using `gstack-diff-scope`:
968
+
969
+ ```bash
970
+ source <(~/.codex/skills/gstack/bin/gstack-diff-scope <base> 2>/dev/null)
971
+ ```
972
+
973
+ **If `SCOPE_FRONTEND=false`:** Skip design review silently. No output.
974
+
975
+ **If `SCOPE_FRONTEND=true`:**
976
+
977
+ 1. **Check for DESIGN.md.** If `DESIGN.md` or `design-system.md` exists in the repo root, read it. All design findings are calibrated against it — patterns blessed in DESIGN.md are not flagged. If not found, use universal design principles.
978
+
979
+ 2. **Read `.agents/skills/gstack/review/design-checklist.md`.** If the file cannot be read, skip design review with a note: "Design checklist not found — skipping design review."
980
+
981
+ 3. **Read each changed frontend file** (full file, not just diff hunks). Frontend files are identified by the patterns listed in the checklist.
982
+
983
+ 4. **Apply the design checklist** against the changed files. For each item:
984
+ - **[HIGH] mechanical CSS fix** (`outline: none`, `!important`, `font-size < 16px`): classify as AUTO-FIX
985
+ - **[HIGH/MEDIUM] design judgment needed**: classify as ASK
986
+ - **[LOW] intent-based detection**: present as "Possible — verify visually or run /design-review"
987
+
988
+ 5. **Include findings** in the review output under a "Design Review" header, following the output format in the checklist. Design findings merge with code review findings into the same Fix-First flow.
989
+
990
+ 6. **Log the result** for the Review Readiness Dashboard:
991
+
992
+ ```bash
993
+ ~/.codex/skills/gstack/bin/gstack-review-log '{"skill":"design-review-lite","timestamp":"TIMESTAMP","status":"STATUS","findings":N,"auto_fixed":M,"commit":"COMMIT"}'
994
+ ```
995
+
996
+ Substitute: TIMESTAMP = ISO 8601 datetime, STATUS = "clean" if 0 findings or "issues_found", N = total findings, M = auto-fixed count, COMMIT = output of `git rev-parse --short HEAD`.
997
+
998
+ Include any design findings alongside the code review findings. They follow the same Fix-First flow below.
999
+
1000
+ 4. **Classify each finding as AUTO-FIX or ASK** per the Fix-First Heuristic in
1001
+ checklist.md. Critical findings lean toward ASK; informational lean toward AUTO-FIX.
1002
+
1003
+ 5. **Auto-fix all AUTO-FIX items.** Apply each fix. Output one line per fix:
1004
+ `[AUTO-FIXED] [file:line] Problem → what you did`
1005
+
1006
+ 6. **If ASK items remain,** present them in ONE AskUserQuestion:
1007
+ - List each with number, severity, problem, recommended fix
1008
+ - Per-item options: A) Fix B) Skip
1009
+ - Overall RECOMMENDATION
1010
+ - If 3 or fewer ASK items, you may use individual AskUserQuestion calls instead
1011
+
1012
+ 7. **After all fixes (auto + user-approved):**
1013
+ - If ANY fixes were applied: commit fixed files by name (`git add <fixed-files> && git commit -m "fix: pre-landing review fixes"`), then **STOP** and tell the user to run `/ship` again to re-test.
1014
+ - If no fixes applied (all ASK items skipped, or no issues found): continue to Step 4.
1015
+
1016
+ 8. Output summary: `Pre-Landing Review: N issues — M auto-fixed, K asked (J fixed, L skipped)`
1017
+
1018
+ If no issues found: `Pre-Landing Review: No issues found.`
1019
+
1020
+ Save the review output — it goes into the PR body in Step 8.
1021
+
1022
+ ---
1023
+
1024
+ ## Step 3.75: Address Greptile review comments (if PR exists)
1025
+
1026
+ Read `.agents/skills/gstack/review/greptile-triage.md` and follow the fetch, filter, classify, and **escalation detection** steps.
1027
+
1028
+ **If no PR exists, `gh` fails, API returns an error, or there are zero Greptile comments:** Skip this step silently. Continue to Step 4.
1029
+
1030
+ **If Greptile comments are found:**
1031
+
1032
+ Include a Greptile summary in your output: `+ N Greptile comments (X valid, Y fixed, Z FP)`
1033
+
1034
+ Before replying to any comment, run the **Escalation Detection** algorithm from greptile-triage.md to determine whether to use Tier 1 (friendly) or Tier 2 (firm) reply templates.
1035
+
1036
+ For each classified comment:
1037
+
1038
+ **VALID & ACTIONABLE:** Use AskUserQuestion with:
1039
+ - The comment (file:line or [top-level] + body summary + permalink URL)
1040
+ - `RECOMMENDATION: Choose A because [one-line reason]`
1041
+ - Options: A) Fix now, B) Acknowledge and ship anyway, C) It's a false positive
1042
+ - If user chooses A: apply the fix, commit the fixed files (`git add <fixed-files> && git commit -m "fix: address Greptile review — <brief description>"`), reply using the **Fix reply template** from greptile-triage.md (include inline diff + explanation), and save to both per-project and global greptile-history (type: fix).
1043
+ - If user chooses C: reply using the **False Positive reply template** from greptile-triage.md (include evidence + suggested re-rank), save to both per-project and global greptile-history (type: fp).
1044
+
1045
+ **VALID BUT ALREADY FIXED:** Reply using the **Already Fixed reply template** from greptile-triage.md — no AskUserQuestion needed:
1046
+ - Include what was done and the fixing commit SHA
1047
+ - Save to both per-project and global greptile-history (type: already-fixed)
1048
+
1049
+ **FALSE POSITIVE:** Use AskUserQuestion:
1050
+ - Show the comment and why you think it's wrong (file:line or [top-level] + body summary + permalink URL)
1051
+ - Options:
1052
+ - A) Reply to Greptile explaining the false positive (recommended if clearly wrong)
1053
+ - B) Fix it anyway (if trivial)
1054
+ - C) Ignore silently
1055
+ - If user chooses A: reply using the **False Positive reply template** from greptile-triage.md (include evidence + suggested re-rank), save to both per-project and global greptile-history (type: fp)
1056
+
1057
+ **SUPPRESSED:** Skip silently — these are known false positives from previous triage.
1058
+
1059
+ **After all comments are resolved:** If any fixes were applied, the tests from Step 3 are now stale. **Re-run tests** (Step 3) before continuing to Step 4. If no fixes were applied, continue to Step 4.
1060
+
1061
+ ---
1062
+
1063
+
1064
+
1065
+ ## Step 4: Version bump (auto-decide)
1066
+
1067
+ 1. Read the current `VERSION` file (4-digit format: `MAJOR.MINOR.PATCH.MICRO`)
1068
+
1069
+ 2. **Auto-decide the bump level based on the diff:**
1070
+ - Count lines changed (`git diff origin/<base>...HEAD --stat | tail -1`)
1071
+ - **MICRO** (4th digit): < 50 lines changed, trivial tweaks, typos, config
1072
+ - **PATCH** (3rd digit): 50+ lines changed, bug fixes, small-medium features
1073
+ - **MINOR** (2nd digit): **ASK the user** — only for major features or significant architectural changes
1074
+ - **MAJOR** (1st digit): **ASK the user** — only for milestones or breaking changes
1075
+
1076
+ 3. Compute the new version:
1077
+ - Bumping a digit resets all digits to its right to 0
1078
+ - Example: `0.19.1.0` + PATCH → `0.19.2.0`
1079
+
1080
+ 4. Write the new version to the `VERSION` file.
1081
+
1082
+ ---
1083
+
1084
+ ## Step 5: CHANGELOG (auto-generate)
1085
+
1086
+ 1. Read `CHANGELOG.md` header to know the format.
1087
+
1088
+ 2. Auto-generate the entry from **ALL commits on the branch** (not just recent ones):
1089
+ - Use `git log <base>..HEAD --oneline` to see every commit being shipped
1090
+ - Use `git diff <base>...HEAD` to see the full diff against the base branch
1091
+ - The CHANGELOG entry must be comprehensive of ALL changes going into the PR
1092
+ - If existing CHANGELOG entries on the branch already cover some commits, replace them with one unified entry for the new version
1093
+ - Categorize changes into applicable sections:
1094
+ - `### Added` — new features
1095
+ - `### Changed` — changes to existing functionality
1096
+ - `### Fixed` — bug fixes
1097
+ - `### Removed` — removed features
1098
+ - Write concise, descriptive bullet points
1099
+ - Insert after the file header (line 5), dated today
1100
+ - Format: `## [X.Y.Z.W] - YYYY-MM-DD`
1101
+
1102
+ **Do NOT ask the user to describe changes.** Infer from the diff and commit history.
1103
+
1104
+ ---
1105
+
1106
+ ## Step 5.5: TODOS.md (auto-update)
1107
+
1108
+ Cross-reference the project's TODOS.md against the changes being shipped. Mark completed items automatically; prompt only if the file is missing or disorganized.
1109
+
1110
+ Read `.agents/skills/gstack/review/TODOS-format.md` for the canonical format reference.
1111
+
1112
+ **1. Check if TODOS.md exists** in the repository root.
1113
+
1114
+ **If TODOS.md does not exist:** Use AskUserQuestion:
1115
+ - Message: "GStack recommends maintaining a TODOS.md organized by skill/component, then priority (P0 at top through P4, then Completed at bottom). See TODOS-format.md for the full format. Would you like to create one?"
1116
+ - Options: A) Create it now, B) Skip for now
1117
+ - If A: Create `TODOS.md` with a skeleton (# TODOS heading + ## Completed section). Continue to step 3.
1118
+ - If B: Skip the rest of Step 5.5. Continue to Step 6.
1119
+
1120
+ **2. Check structure and organization:**
1121
+
1122
+ Read TODOS.md and verify it follows the recommended structure:
1123
+ - Items grouped under `## <Skill/Component>` headings
1124
+ - Each item has `**Priority:**` field with P0-P4 value
1125
+ - A `## Completed` section at the bottom
1126
+
1127
+ **If disorganized** (missing priority fields, no component groupings, no Completed section): Use AskUserQuestion:
1128
+ - Message: "TODOS.md doesn't follow the recommended structure (skill/component groupings, P0-P4 priority, Completed section). Would you like to reorganize it?"
1129
+ - Options: A) Reorganize now (recommended), B) Leave as-is
1130
+ - If A: Reorganize in-place following TODOS-format.md. Preserve all content — only restructure, never delete items.
1131
+ - If B: Continue to step 3 without restructuring.
1132
+
1133
+ **3. Detect completed TODOs:**
1134
+
1135
+ This step is fully automatic — no user interaction.
1136
+
1137
+ Use the diff and commit history already gathered in earlier steps:
1138
+ - `git diff <base>...HEAD` (full diff against the base branch)
1139
+ - `git log <base>..HEAD --oneline` (all commits being shipped)
1140
+
1141
+ For each TODO item, check if the changes in this PR complete it by:
1142
+ - Matching commit messages against the TODO title and description
1143
+ - Checking if files referenced in the TODO appear in the diff
1144
+ - Checking if the TODO's described work matches the functional changes
1145
+
1146
+ **Be conservative:** Only mark a TODO as completed if there is clear evidence in the diff. If uncertain, leave it alone.
1147
+
1148
+ **4. Move completed items** to the `## Completed` section at the bottom. Append: `**Completed:** vX.Y.Z (YYYY-MM-DD)`
1149
+
1150
+ **5. Output summary:**
1151
+ - `TODOS.md: N items marked complete (item1, item2, ...). M items remaining.`
1152
+ - Or: `TODOS.md: No completed items detected. M items remaining.`
1153
+ - Or: `TODOS.md: Created.` / `TODOS.md: Reorganized.`
1154
+
1155
+ **6. Defensive:** If TODOS.md cannot be written (permission error, disk full), warn the user and continue. Never stop the ship workflow for a TODOS failure.
1156
+
1157
+ Save this summary — it goes into the PR body in Step 8.
1158
+
1159
+ ---
1160
+
1161
+ ## Step 6: Commit (bisectable chunks)
1162
+
1163
+ **Goal:** Create small, logical commits that work well with `git bisect` and help LLMs understand what changed.
1164
+
1165
+ 1. Analyze the diff and group changes into logical commits. Each commit should represent **one coherent change** — not one file, but one logical unit.
1166
+
1167
+ 2. **Commit ordering** (earlier commits first):
1168
+ - **Infrastructure:** migrations, config changes, route additions
1169
+ - **Models & services:** new models, services, concerns (with their tests)
1170
+ - **Controllers & views:** controllers, views, JS/React components (with their tests)
1171
+ - **VERSION + CHANGELOG + TODOS.md:** always in the final commit
1172
+
1173
+ 3. **Rules for splitting:**
1174
+ - A model and its test file go in the same commit
1175
+ - A service and its test file go in the same commit
1176
+ - A controller, its views, and its test go in the same commit
1177
+ - Migrations are their own commit (or grouped with the model they support)
1178
+ - Config/route changes can group with the feature they enable
1179
+ - If the total diff is small (< 50 lines across < 4 files), a single commit is fine
1180
+
1181
+ 4. **Each commit must be independently valid** — no broken imports, no references to code that doesn't exist yet. Order commits so dependencies come first.
1182
+
1183
+ 5. Compose each commit message:
1184
+ - First line: `<type>: <summary>` (type = feat/fix/chore/refactor/docs)
1185
+ - Body: brief description of what this commit contains
1186
+ - Only the **final commit** (VERSION + CHANGELOG) gets the version tag and co-author trailer:
1187
+
1188
+ ```bash
1189
+ git commit -m "$(cat <<'EOF'
1190
+ chore: bump version and changelog (vX.Y.Z.W)
1191
+
1192
+ Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1193
+ EOF
1194
+ )"
1195
+ ```
1196
+
1197
+ ---
1198
+
1199
+ ## Step 6.5: Verification Gate
1200
+
1201
+ **IRON LAW: NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE.**
1202
+
1203
+ Before pushing, re-verify if code changed during Steps 4-6:
1204
+
1205
+ 1. **Test verification:** If ANY code changed after Step 3's test run (fixes from review findings, CHANGELOG edits don't count), re-run the test suite. Paste fresh output. Stale output from Step 3 is NOT acceptable.
1206
+
1207
+ 2. **Build verification:** If the project has a build step, run it. Paste output.
1208
+
1209
+ 3. **Rationalization prevention:**
1210
+ - "Should work now" → RUN IT.
1211
+ - "I'm confident" → Confidence is not evidence.
1212
+ - "I already tested earlier" → Code changed since then. Test again.
1213
+ - "It's a trivial change" → Trivial changes break production.
1214
+
1215
+ **If tests fail here:** STOP. Do not push. Fix the issue and return to Step 3.
1216
+
1217
+ Claiming work is complete without verification is dishonesty, not efficiency.
1218
+
1219
+ ---
1220
+
1221
+ ## Step 7: Push
1222
+
1223
+ Push to the remote with upstream tracking:
1224
+
1225
+ ```bash
1226
+ git push -u origin <branch-name>
1227
+ ```
1228
+
1229
+ ---
1230
+
1231
+ ## Step 8: Create PR
1232
+
1233
+ Create a pull request using `gh`:
1234
+
1235
+ ```bash
1236
+ gh pr create --base <base> --title "<type>: <summary>" --body "$(cat <<'EOF'
1237
+ ## Summary
1238
+ <bullet points from CHANGELOG>
1239
+
1240
+ ## Test Coverage
1241
+ <coverage diagram from Step 3.4, or "All new code paths have test coverage.">
1242
+ <If Step 3.4 ran: "Tests: {before} → {after} (+{delta} new)">
1243
+
1244
+ ## Pre-Landing Review
1245
+ <findings from Step 3.5 code review, or "No issues found.">
1246
+
1247
+ ## Design Review
1248
+ <If design review ran: "Design Review (lite): N findings — M auto-fixed, K skipped. AI Slop: clean/N issues.">
1249
+ <If no frontend files changed: "No frontend files changed — design review skipped.">
1250
+
1251
+ ## Eval Results
1252
+ <If evals ran: suite names, pass/fail counts, cost dashboard summary. If skipped: "No prompt-related files changed — evals skipped.">
1253
+
1254
+ ## Greptile Review
1255
+ <If Greptile comments were found: bullet list with [FIXED] / [FALSE POSITIVE] / [ALREADY FIXED] tag + one-line summary per comment>
1256
+ <If no Greptile comments found: "No Greptile comments.">
1257
+ <If no PR existed during Step 3.75: omit this section entirely>
1258
+
1259
+ ## TODOS
1260
+ <If items marked complete: bullet list of completed items with version>
1261
+ <If no items completed: "No TODO items completed in this PR.">
1262
+ <If TODOS.md created or reorganized: note that>
1263
+ <If TODOS.md doesn't exist and user skipped: omit this section>
1264
+
1265
+ ## Test plan
1266
+ - [x] All Rails tests pass (N runs, 0 failures)
1267
+ - [x] All Vitest tests pass (N tests)
1268
+
1269
+ 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1270
+ EOF
1271
+ )"
1272
+ ```
1273
+
1274
+ **Output the PR URL** — then proceed to Step 8.5.
1275
+
1276
+ ---
1277
+
1278
+ ## Step 8.5: Auto-invoke /document-release
1279
+
1280
+ After the PR is created, automatically sync project documentation. Read the
1281
+ `document-release/SKILL.md` skill file (adjacent to this skill's directory) and
1282
+ execute its full workflow:
1283
+
1284
+ 1. Read the `/document-release` skill: `cat ${CLAUDE_SKILL_DIR}/../document-release/SKILL.md`
1285
+ 2. Follow its instructions — it reads all .md files in the project, cross-references
1286
+ the diff, and updates anything that drifted (README, ARCHITECTURE, CONTRIBUTING,
1287
+ CLAUDE.md, TODOS, etc.)
1288
+ 3. If any docs were updated, commit the changes and push to the same branch:
1289
+ ```bash
1290
+ git add -A && git commit -m "docs: sync documentation with shipped changes" && git push
1291
+ ```
1292
+ 4. If no docs needed updating, say "Documentation is current — no updates needed."
1293
+
1294
+ This step is automatic. Do not ask the user for confirmation. The goal is zero-friction
1295
+ doc updates — the user runs `/ship` and documentation stays current without a separate command.
1296
+
1297
+ ---
1298
+
1299
+ ## Important Rules
1300
+
1301
+ - **Never skip tests.** If tests fail, stop.
1302
+ - **Never skip the pre-landing review.** If checklist.md is unreadable, stop.
1303
+ - **Never force push.** Use regular `git push` only.
1304
+ - **Never ask for trivial confirmations** (e.g., "ready to push?", "create PR?"). DO stop for: version bumps (MINOR/MAJOR), pre-landing review findings (ASK items), and Codex structured review [P1] findings (large diffs only).
1305
+ - **Always use the 4-digit version format** from the VERSION file.
1306
+ - **Date format in CHANGELOG:** `YYYY-MM-DD`
1307
+ - **Split commits for bisectability** — each commit = one logical change.
1308
+ - **TODOS.md completion detection must be conservative.** Only mark items as completed when the diff clearly shows the work is done.
1309
+ - **Use Greptile reply templates from greptile-triage.md.** Every reply includes evidence (inline diff, code references, re-rank suggestion). Never post vague replies.
1310
+ - **Never push without fresh verification evidence.** If code changed after Step 3 tests, re-run before pushing.
1311
+ - **Step 3.4 generates coverage tests.** They must pass before committing. Never commit failing tests.
1312
+ - **The goal is: user says `/ship`, next thing they see is the review + PR URL + auto-synced docs.**