clitrigger 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 (201) hide show
  1. package/.env.example +9 -0
  2. package/LICENSE +21 -0
  3. package/README.md +186 -0
  4. package/bin/clitrigger.js +106 -0
  5. package/dist/client/assets/index-BkOCv65b.css +1 -0
  6. package/dist/client/assets/index-Fbf16Lh1.js +129 -0
  7. package/dist/client/index.html +24 -0
  8. package/dist/server/db/connection.d.ts +4 -0
  9. package/dist/server/db/connection.d.ts.map +1 -0
  10. package/dist/server/db/connection.js +24 -0
  11. package/dist/server/db/connection.js.map +1 -0
  12. package/dist/server/db/queries.d.ts +265 -0
  13. package/dist/server/db/queries.d.ts.map +1 -0
  14. package/dist/server/db/queries.js +836 -0
  15. package/dist/server/db/queries.js.map +1 -0
  16. package/dist/server/db/schema.d.ts +3 -0
  17. package/dist/server/db/schema.d.ts.map +1 -0
  18. package/dist/server/db/schema.js +325 -0
  19. package/dist/server/db/schema.js.map +1 -0
  20. package/dist/server/index.d.ts +5 -0
  21. package/dist/server/index.d.ts.map +1 -0
  22. package/dist/server/index.js +207 -0
  23. package/dist/server/index.js.map +1 -0
  24. package/dist/server/middleware/auth.d.ts +5 -0
  25. package/dist/server/middleware/auth.d.ts.map +1 -0
  26. package/dist/server/middleware/auth.js +45 -0
  27. package/dist/server/middleware/auth.js.map +1 -0
  28. package/dist/server/plugins/github/index.d.ts +3 -0
  29. package/dist/server/plugins/github/index.d.ts.map +1 -0
  30. package/dist/server/plugins/github/index.js +18 -0
  31. package/dist/server/plugins/github/index.js.map +1 -0
  32. package/dist/server/plugins/github/router.d.ts +4 -0
  33. package/dist/server/plugins/github/router.d.ts.map +1 -0
  34. package/dist/server/plugins/github/router.js +250 -0
  35. package/dist/server/plugins/github/router.js.map +1 -0
  36. package/dist/server/plugins/gstack/index.d.ts +3 -0
  37. package/dist/server/plugins/gstack/index.d.ts.map +1 -0
  38. package/dist/server/plugins/gstack/index.js +36 -0
  39. package/dist/server/plugins/gstack/index.js.map +1 -0
  40. package/dist/server/plugins/jira/index.d.ts +3 -0
  41. package/dist/server/plugins/jira/index.d.ts.map +1 -0
  42. package/dist/server/plugins/jira/index.js +19 -0
  43. package/dist/server/plugins/jira/index.js.map +1 -0
  44. package/dist/server/plugins/jira/router.d.ts +4 -0
  45. package/dist/server/plugins/jira/router.d.ts.map +1 -0
  46. package/dist/server/plugins/jira/router.js +332 -0
  47. package/dist/server/plugins/jira/router.js.map +1 -0
  48. package/dist/server/plugins/notion/index.d.ts +3 -0
  49. package/dist/server/plugins/notion/index.d.ts.map +1 -0
  50. package/dist/server/plugins/notion/index.js +17 -0
  51. package/dist/server/plugins/notion/index.js.map +1 -0
  52. package/dist/server/plugins/notion/router.d.ts +4 -0
  53. package/dist/server/plugins/notion/router.d.ts.map +1 -0
  54. package/dist/server/plugins/notion/router.js +313 -0
  55. package/dist/server/plugins/notion/router.js.map +1 -0
  56. package/dist/server/plugins/registry.d.ts +8 -0
  57. package/dist/server/plugins/registry.d.ts.map +1 -0
  58. package/dist/server/plugins/registry.js +31 -0
  59. package/dist/server/plugins/registry.js.map +1 -0
  60. package/dist/server/plugins/types.d.ts +32 -0
  61. package/dist/server/plugins/types.d.ts.map +1 -0
  62. package/dist/server/plugins/types.js +2 -0
  63. package/dist/server/plugins/types.js.map +1 -0
  64. package/dist/server/resources/gstack-skills/LICENSE +21 -0
  65. package/dist/server/resources/gstack-skills/benchmark/SKILL.md +528 -0
  66. package/dist/server/resources/gstack-skills/careful/SKILL.md +59 -0
  67. package/dist/server/resources/gstack-skills/cso/SKILL.md +898 -0
  68. package/dist/server/resources/gstack-skills/investigate/SKILL.md +474 -0
  69. package/dist/server/resources/gstack-skills/qa/SKILL.md +1055 -0
  70. package/dist/server/resources/gstack-skills/qa-only/SKILL.md +672 -0
  71. package/dist/server/resources/gstack-skills/review/SKILL.md +1044 -0
  72. package/dist/server/resources/gstack-skills/skills-manifest.d.ts +9 -0
  73. package/dist/server/resources/gstack-skills/skills-manifest.d.ts.map +1 -0
  74. package/dist/server/resources/gstack-skills/skills-manifest.js +52 -0
  75. package/dist/server/resources/gstack-skills/skills-manifest.js.map +1 -0
  76. package/dist/server/resources/gstack-skills/skills-manifest.ts +59 -0
  77. package/dist/server/routes/auth.d.ts +3 -0
  78. package/dist/server/routes/auth.d.ts.map +1 -0
  79. package/dist/server/routes/auth.js +70 -0
  80. package/dist/server/routes/auth.js.map +1 -0
  81. package/dist/server/routes/debug-logs.d.ts +3 -0
  82. package/dist/server/routes/debug-logs.d.ts.map +1 -0
  83. package/dist/server/routes/debug-logs.js +43 -0
  84. package/dist/server/routes/debug-logs.js.map +1 -0
  85. package/dist/server/routes/discussions.d.ts +3 -0
  86. package/dist/server/routes/discussions.d.ts.map +1 -0
  87. package/dist/server/routes/discussions.js +544 -0
  88. package/dist/server/routes/discussions.js.map +1 -0
  89. package/dist/server/routes/execution.d.ts +3 -0
  90. package/dist/server/routes/execution.d.ts.map +1 -0
  91. package/dist/server/routes/execution.js +339 -0
  92. package/dist/server/routes/execution.js.map +1 -0
  93. package/dist/server/routes/github.d.ts +3 -0
  94. package/dist/server/routes/github.d.ts.map +1 -0
  95. package/dist/server/routes/github.js +251 -0
  96. package/dist/server/routes/github.js.map +1 -0
  97. package/dist/server/routes/images.d.ts +17 -0
  98. package/dist/server/routes/images.d.ts.map +1 -0
  99. package/dist/server/routes/images.js +152 -0
  100. package/dist/server/routes/images.js.map +1 -0
  101. package/dist/server/routes/jira.d.ts +3 -0
  102. package/dist/server/routes/jira.d.ts.map +1 -0
  103. package/dist/server/routes/jira.js +333 -0
  104. package/dist/server/routes/jira.js.map +1 -0
  105. package/dist/server/routes/logs.d.ts +3 -0
  106. package/dist/server/routes/logs.d.ts.map +1 -0
  107. package/dist/server/routes/logs.js +156 -0
  108. package/dist/server/routes/logs.js.map +1 -0
  109. package/dist/server/routes/models.d.ts +3 -0
  110. package/dist/server/routes/models.d.ts.map +1 -0
  111. package/dist/server/routes/models.js +65 -0
  112. package/dist/server/routes/models.js.map +1 -0
  113. package/dist/server/routes/notion.d.ts +3 -0
  114. package/dist/server/routes/notion.d.ts.map +1 -0
  115. package/dist/server/routes/notion.js +312 -0
  116. package/dist/server/routes/notion.js.map +1 -0
  117. package/dist/server/routes/pipelines.d.ts +3 -0
  118. package/dist/server/routes/pipelines.d.ts.map +1 -0
  119. package/dist/server/routes/pipelines.js +315 -0
  120. package/dist/server/routes/pipelines.js.map +1 -0
  121. package/dist/server/routes/plugins.d.ts +3 -0
  122. package/dist/server/routes/plugins.d.ts.map +1 -0
  123. package/dist/server/routes/plugins.js +71 -0
  124. package/dist/server/routes/plugins.js.map +1 -0
  125. package/dist/server/routes/projects.d.ts +3 -0
  126. package/dist/server/routes/projects.d.ts.map +1 -0
  127. package/dist/server/routes/projects.js +557 -0
  128. package/dist/server/routes/projects.js.map +1 -0
  129. package/dist/server/routes/schedules.d.ts +3 -0
  130. package/dist/server/routes/schedules.d.ts.map +1 -0
  131. package/dist/server/routes/schedules.js +247 -0
  132. package/dist/server/routes/schedules.js.map +1 -0
  133. package/dist/server/routes/todos.d.ts +3 -0
  134. package/dist/server/routes/todos.d.ts.map +1 -0
  135. package/dist/server/routes/todos.js +103 -0
  136. package/dist/server/routes/todos.js.map +1 -0
  137. package/dist/server/routes/tunnel.d.ts +3 -0
  138. package/dist/server/routes/tunnel.d.ts.map +1 -0
  139. package/dist/server/routes/tunnel.js +44 -0
  140. package/dist/server/routes/tunnel.js.map +1 -0
  141. package/dist/server/services/claude-manager.d.ts +42 -0
  142. package/dist/server/services/claude-manager.d.ts.map +1 -0
  143. package/dist/server/services/claude-manager.js +275 -0
  144. package/dist/server/services/claude-manager.js.map +1 -0
  145. package/dist/server/services/cli-adapters.d.ts +35 -0
  146. package/dist/server/services/cli-adapters.d.ts.map +1 -0
  147. package/dist/server/services/cli-adapters.js +139 -0
  148. package/dist/server/services/cli-adapters.js.map +1 -0
  149. package/dist/server/services/debug-logger.d.ts +35 -0
  150. package/dist/server/services/debug-logger.d.ts.map +1 -0
  151. package/dist/server/services/debug-logger.js +168 -0
  152. package/dist/server/services/debug-logger.js.map +1 -0
  153. package/dist/server/services/discussion-orchestrator.d.ts +47 -0
  154. package/dist/server/services/discussion-orchestrator.d.ts.map +1 -0
  155. package/dist/server/services/discussion-orchestrator.js +599 -0
  156. package/dist/server/services/discussion-orchestrator.js.map +1 -0
  157. package/dist/server/services/log-streamer.d.ts +45 -0
  158. package/dist/server/services/log-streamer.d.ts.map +1 -0
  159. package/dist/server/services/log-streamer.js +348 -0
  160. package/dist/server/services/log-streamer.js.map +1 -0
  161. package/dist/server/services/orchestrator.d.ts +69 -0
  162. package/dist/server/services/orchestrator.d.ts.map +1 -0
  163. package/dist/server/services/orchestrator.js +642 -0
  164. package/dist/server/services/orchestrator.js.map +1 -0
  165. package/dist/server/services/pipeline-orchestrator.d.ts +43 -0
  166. package/dist/server/services/pipeline-orchestrator.d.ts.map +1 -0
  167. package/dist/server/services/pipeline-orchestrator.js +503 -0
  168. package/dist/server/services/pipeline-orchestrator.js.map +1 -0
  169. package/dist/server/services/prompt-guard.d.ts +19 -0
  170. package/dist/server/services/prompt-guard.d.ts.map +1 -0
  171. package/dist/server/services/prompt-guard.js +43 -0
  172. package/dist/server/services/prompt-guard.js.map +1 -0
  173. package/dist/server/services/scheduler.d.ts +43 -0
  174. package/dist/server/services/scheduler.d.ts.map +1 -0
  175. package/dist/server/services/scheduler.js +199 -0
  176. package/dist/server/services/scheduler.js.map +1 -0
  177. package/dist/server/services/skill-injector.d.ts +17 -0
  178. package/dist/server/services/skill-injector.d.ts.map +1 -0
  179. package/dist/server/services/skill-injector.js +60 -0
  180. package/dist/server/services/skill-injector.js.map +1 -0
  181. package/dist/server/services/tunnel-manager.d.ts +42 -0
  182. package/dist/server/services/tunnel-manager.d.ts.map +1 -0
  183. package/dist/server/services/tunnel-manager.js +265 -0
  184. package/dist/server/services/tunnel-manager.js.map +1 -0
  185. package/dist/server/services/worktree-manager.d.ts +117 -0
  186. package/dist/server/services/worktree-manager.d.ts.map +1 -0
  187. package/dist/server/services/worktree-manager.js +400 -0
  188. package/dist/server/services/worktree-manager.js.map +1 -0
  189. package/dist/server/websocket/broadcaster.d.ts +12 -0
  190. package/dist/server/websocket/broadcaster.d.ts.map +1 -0
  191. package/dist/server/websocket/broadcaster.js +23 -0
  192. package/dist/server/websocket/broadcaster.js.map +1 -0
  193. package/dist/server/websocket/events.d.ts +94 -0
  194. package/dist/server/websocket/events.d.ts.map +1 -0
  195. package/dist/server/websocket/events.js +2 -0
  196. package/dist/server/websocket/events.js.map +1 -0
  197. package/dist/server/websocket/index.d.ts +3 -0
  198. package/dist/server/websocket/index.d.ts.map +1 -0
  199. package/dist/server/websocket/index.js +82 -0
  200. package/dist/server/websocket/index.js.map +1 -0
  201. package/package.json +68 -0
@@ -0,0 +1,528 @@
1
+ ---
2
+ name: benchmark
3
+ preamble-tier: 1
4
+ version: 1.0.0
5
+ description: |
6
+ Performance regression detection using the browse daemon. Establishes
7
+ baselines for page load times, Core Web Vitals, and resource sizes.
8
+ Compares before/after on every PR. Tracks performance trends over time.
9
+ Use when: "performance", "benchmark", "page speed", "lighthouse", "web vitals",
10
+ "bundle size", "load time".
11
+ allowed-tools:
12
+ - Bash
13
+ - Read
14
+ - Write
15
+ - Glob
16
+ - AskUserQuestion
17
+ ---
18
+ <!-- AUTO-GENERATED from SKILL.md.tmpl — do not edit directly -->
19
+ <!-- Regenerate: bun run gen:skill-docs -->
20
+
21
+ ## Preamble (run first)
22
+
23
+ ```bash
24
+ _UPD=$(~/.claude/skills/gstack/bin/gstack-update-check 2>/dev/null || .claude/skills/gstack/bin/gstack-update-check 2>/dev/null || true)
25
+ [ -n "$_UPD" ] && echo "$_UPD" || true
26
+ mkdir -p ~/.gstack/sessions
27
+ touch ~/.gstack/sessions/"$PPID"
28
+ _SESSIONS=$(find ~/.gstack/sessions -mmin -120 -type f 2>/dev/null | wc -l | tr -d ' ')
29
+ find ~/.gstack/sessions -mmin +120 -type f -delete 2>/dev/null || true
30
+ _CONTRIB=$(~/.claude/skills/gstack/bin/gstack-config get gstack_contributor 2>/dev/null || true)
31
+ _PROACTIVE=$(~/.claude/skills/gstack/bin/gstack-config get proactive 2>/dev/null || echo "true")
32
+ _BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
33
+ echo "BRANCH: $_BRANCH"
34
+ echo "PROACTIVE: $_PROACTIVE"
35
+ source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || true
36
+ REPO_MODE=${REPO_MODE:-unknown}
37
+ echo "REPO_MODE: $REPO_MODE"
38
+ _LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")
39
+ echo "LAKE_INTRO: $_LAKE_SEEN"
40
+ _TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)
41
+ _TEL_PROMPTED=$([ -f ~/.gstack/.telemetry-prompted ] && echo "yes" || echo "no")
42
+ _TEL_START=$(date +%s)
43
+ _SESSION_ID="$$-$(date +%s)"
44
+ echo "TELEMETRY: ${_TEL:-off}"
45
+ echo "TEL_PROMPTED: $_TEL_PROMPTED"
46
+ mkdir -p ~/.gstack/analytics
47
+ echo '{"skill":"benchmark","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
48
+ # zsh-compatible: use find instead of glob to avoid NOMATCH error
49
+ for _PF in $(find ~/.gstack/analytics -maxdepth 1 -name '.pending-*' 2>/dev/null); do [ -f "$_PF" ] && ~/.claude/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
50
+ ```
51
+
52
+ If `PROACTIVE` is `"false"`, do not proactively suggest gstack skills — only invoke
53
+ them when the user explicitly asks. The user opted out of proactive suggestions.
54
+
55
+ If output shows `UPGRADE_AVAILABLE <old> <new>`: read `~/.claude/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.
56
+
57
+ If `LAKE_INTRO` is `no`: Before continuing, introduce the Completeness Principle.
58
+ Tell the user: "gstack follows the **Boil the Lake** principle — always do the complete
59
+ thing when AI makes the marginal cost near-zero. Read more: https://garryslist.org/posts/boil-the-ocean"
60
+ Then offer to open the essay in their default browser:
61
+
62
+ ```bash
63
+ open https://garryslist.org/posts/boil-the-ocean
64
+ touch ~/.gstack/.completeness-intro-seen
65
+ ```
66
+
67
+ Only run `open` if the user says yes. Always run `touch` to mark as seen. This only happens once.
68
+
69
+ If `TEL_PROMPTED` is `no` AND `LAKE_INTRO` is `yes`: After the lake intro is handled,
70
+ ask the user about telemetry. Use AskUserQuestion:
71
+
72
+ > Help gstack get better! Community mode shares usage data (which skills you use, how long
73
+ > they take, crash info) with a stable device ID so we can track trends and fix bugs faster.
74
+ > No code, file paths, or repo names are ever sent.
75
+ > Change anytime with `gstack-config set telemetry off`.
76
+
77
+ Options:
78
+ - A) Help gstack get better! (recommended)
79
+ - B) No thanks
80
+
81
+ If A: run `~/.claude/skills/gstack/bin/gstack-config set telemetry community`
82
+
83
+ If B: ask a follow-up AskUserQuestion:
84
+
85
+ > How about anonymous mode? We just learn that *someone* used gstack — no unique ID,
86
+ > no way to connect sessions. Just a counter that helps us know if anyone's out there.
87
+
88
+ Options:
89
+ - A) Sure, anonymous is fine
90
+ - B) No thanks, fully off
91
+
92
+ If B→A: run `~/.claude/skills/gstack/bin/gstack-config set telemetry anonymous`
93
+ If B→B: run `~/.claude/skills/gstack/bin/gstack-config set telemetry off`
94
+
95
+ Always run:
96
+ ```bash
97
+ touch ~/.gstack/.telemetry-prompted
98
+ ```
99
+
100
+ This only happens once. If `TEL_PROMPTED` is `yes`, skip this entirely.
101
+
102
+ ## AskUserQuestion Format
103
+
104
+ **ALWAYS follow this structure for every AskUserQuestion call:**
105
+ 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)
106
+ 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.
107
+ 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.
108
+ 4. **Options:** Lettered options: `A) ... B) ... C) ...` — when an option involves effort, show both scales: `(human: ~X / CC: ~Y)`
109
+ 5. **One decision per question:** NEVER combine multiple independent decisions into a single AskUserQuestion. Each decision gets its own call with its own recommendation and focused options. Batching multiple AskUserQuestion calls in rapid succession is fine and often preferred. Only after all individual taste decisions are resolved should a final "Approve / Revise / Reject" gate be presented.
110
+
111
+ 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.
112
+
113
+ Per-skill instructions may add additional formatting rules on top of this baseline.
114
+
115
+ ## Completeness Principle — Boil the Lake
116
+
117
+ AI-assisted coding makes the marginal cost of completeness near-zero. When you present options:
118
+
119
+ - 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.
120
+ - **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.
121
+ - **When estimating effort**, always show both scales: human team time and CC+gstack time. The compression ratio varies by task type — use this reference:
122
+
123
+ | Task type | Human team | CC+gstack | Compression |
124
+ |-----------|-----------|-----------|-------------|
125
+ | Boilerplate / scaffolding | 2 days | 15 min | ~100x |
126
+ | Test writing | 1 day | 15 min | ~50x |
127
+ | Feature implementation | 1 week | 30 min | ~30x |
128
+ | Bug fix + regression test | 4 hours | 15 min | ~20x |
129
+ | Architecture / design | 2 days | 4 hours | ~5x |
130
+ | Research / exploration | 1 day | 3 hours | ~3x |
131
+
132
+ - 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.
133
+
134
+ **Anti-patterns — DON'T do this:**
135
+ - BAD: "Choose B — it covers 90% of the value with less code." (If A is only 70 lines more, choose A.)
136
+ - BAD: "We can skip edge case handling to save time." (Edge case handling costs minutes with CC.)
137
+ - BAD: "Let's defer test coverage to a follow-up PR." (Tests are the cheapest lake to boil.)
138
+ - BAD: Quoting only human-team effort: "This would take 2 weeks." (Say: "2 weeks human / ~1 hour CC.")
139
+
140
+ ## Repo Ownership Mode — See Something, Say Something
141
+
142
+ `REPO_MODE` from the preamble tells you who owns issues in this repo:
143
+
144
+ - **`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.
145
+ - **`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.
146
+ - **`unknown`** — Treat as collaborative (safer default — ask before fixing).
147
+
148
+ **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.
149
+
150
+ Never let a noticed issue silently pass. The whole point is proactive communication.
151
+
152
+ ## Search Before Building
153
+
154
+ Before building infrastructure, unfamiliar patterns, or anything the runtime might have a built-in — **search first.** Read `~/.claude/skills/gstack/ETHOS.md` for the full philosophy.
155
+
156
+ **Three layers of knowledge:**
157
+ - **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.
158
+ - **Layer 2** (new and popular — search for these). But scrutinize: humans are subject to mania. Search results are inputs to your thinking, not answers.
159
+ - **Layer 3** (first principles — prize these above all). Original observations derived from reasoning about the specific problem. The most valuable of all.
160
+
161
+ **Eureka moment:** When first-principles reasoning reveals conventional wisdom is wrong, name it:
162
+ "EUREKA: Everyone does X because [assumption]. But [evidence] shows this is wrong. Y is better because [reasoning]."
163
+
164
+ Log eureka moments:
165
+ ```bash
166
+ 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
167
+ ```
168
+ Replace SKILL_NAME and ONE_LINE_SUMMARY. Runs inline — don't stop the workflow.
169
+
170
+ **WebSearch fallback:** If WebSearch is unavailable, skip the search step and note: "Search unavailable — proceeding with in-distribution knowledge only."
171
+
172
+ ## Contributor Mode
173
+
174
+ If `_CONTRIB` is `true`: you are in **contributor mode**. You're a gstack user who also helps make it better.
175
+
176
+ **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!
177
+
178
+ **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.
179
+
180
+ **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.
181
+
182
+ **To file:** write `~/.gstack/contributor-logs/{slug}.md` with **all sections below** (do not truncate — include every section through the Date/Version footer):
183
+
184
+ ```
185
+ # {Title}
186
+
187
+ Hey gstack team — ran into this while using /{skill-name}:
188
+
189
+ **What I was trying to do:** {what the user/agent was attempting}
190
+ **What happened instead:** {what actually happened}
191
+ **My rating:** {0-10} — {one sentence on why it wasn't a 10}
192
+
193
+ ## Steps to reproduce
194
+ 1. {step}
195
+
196
+ ## Raw output
197
+ ```
198
+ {paste the actual error or unexpected output here}
199
+ ```
200
+
201
+ ## What would make this a 10
202
+ {one sentence: what gstack should have done differently}
203
+
204
+ **Date:** {YYYY-MM-DD} | **Version:** {gstack version} | **Skill:** /{skill}
205
+ ```
206
+
207
+ 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}"
208
+
209
+ ## Completion Status Protocol
210
+
211
+ When completing a skill workflow, report status using one of:
212
+ - **DONE** — All steps completed successfully. Evidence provided for each claim.
213
+ - **DONE_WITH_CONCERNS** — Completed, but with issues the user should know about. List each concern.
214
+ - **BLOCKED** — Cannot proceed. State what is blocking and what was tried.
215
+ - **NEEDS_CONTEXT** — Missing information required to continue. State exactly what you need.
216
+
217
+ ### Escalation
218
+
219
+ It is always OK to stop and say "this is too hard for me" or "I'm not confident in this result."
220
+
221
+ Bad work is worse than no work. You will not be penalized for escalating.
222
+ - If you have attempted a task 3 times without success, STOP and escalate.
223
+ - If you are uncertain about a security-sensitive change, STOP and escalate.
224
+ - If the scope of work exceeds what you can verify, STOP and escalate.
225
+
226
+ Escalation format:
227
+ ```
228
+ STATUS: BLOCKED | NEEDS_CONTEXT
229
+ REASON: [1-2 sentences]
230
+ ATTEMPTED: [what you tried]
231
+ RECOMMENDATION: [what the user should do next]
232
+ ```
233
+
234
+ ## Telemetry (run last)
235
+
236
+ After the skill workflow completes (success, error, or abort), log the telemetry event.
237
+ Determine the skill name from the `name:` field in this file's YAML frontmatter.
238
+ Determine the outcome from the workflow result (success if completed normally, error
239
+ if it failed, abort if the user interrupted).
240
+
241
+ **PLAN MODE EXCEPTION — ALWAYS RUN:** This command writes telemetry to
242
+ `~/.gstack/analytics/` (user config directory, not project files). The skill
243
+ preamble already writes to the same directory — this is the same pattern.
244
+ Skipping this command loses session duration and outcome data.
245
+
246
+ Run this bash:
247
+
248
+ ```bash
249
+ _TEL_END=$(date +%s)
250
+ _TEL_DUR=$(( _TEL_END - _TEL_START ))
251
+ rm -f ~/.gstack/analytics/.pending-"$_SESSION_ID" 2>/dev/null || true
252
+ ~/.claude/skills/gstack/bin/gstack-telemetry-log \
253
+ --skill "SKILL_NAME" --duration "$_TEL_DUR" --outcome "OUTCOME" \
254
+ --used-browse "USED_BROWSE" --session-id "$_SESSION_ID" 2>/dev/null &
255
+ ```
256
+
257
+ Replace `SKILL_NAME` with the actual skill name from frontmatter, `OUTCOME` with
258
+ success/error/abort, and `USED_BROWSE` with true/false based on whether `$B` was used.
259
+ If you cannot determine the outcome, use "unknown". This runs in the background and
260
+ never blocks the user.
261
+
262
+ ## Plan Status Footer
263
+
264
+ When you are in plan mode and about to call ExitPlanMode:
265
+
266
+ 1. Check if the plan file already has a `## GSTACK REVIEW REPORT` section.
267
+ 2. If it DOES — skip (a review skill already wrote a richer report).
268
+ 3. If it does NOT — run this command:
269
+
270
+ \`\`\`bash
271
+ ~/.claude/skills/gstack/bin/gstack-review-read
272
+ \`\`\`
273
+
274
+ Then write a `## GSTACK REVIEW REPORT` section to the end of the plan file:
275
+
276
+ - If the output contains review entries (JSONL lines before `---CONFIG---`): format the
277
+ standard report table with runs/status/findings per skill, same format as the review
278
+ skills use.
279
+ - If the output is `NO_REVIEWS` or empty: write this placeholder table:
280
+
281
+ \`\`\`markdown
282
+ ## GSTACK REVIEW REPORT
283
+
284
+ | Review | Trigger | Why | Runs | Status | Findings |
285
+ |--------|---------|-----|------|--------|----------|
286
+ | CEO Review | \`/plan-ceo-review\` | Scope & strategy | 0 | — | — |
287
+ | Codex Review | \`/codex review\` | Independent 2nd opinion | 0 | — | — |
288
+ | Eng Review | \`/plan-eng-review\` | Architecture & tests (required) | 0 | — | — |
289
+ | Design Review | \`/plan-design-review\` | UI/UX gaps | 0 | — | — |
290
+
291
+ **VERDICT:** NO REVIEWS YET — run \`/autoplan\` for full review pipeline, or individual reviews above.
292
+ \`\`\`
293
+
294
+ **PLAN MODE EXCEPTION — ALWAYS RUN:** This writes to the plan file, which is the one
295
+ file you are allowed to edit in plan mode. The plan file review report is part of the
296
+ plan's living status.
297
+
298
+ ## SETUP (run this check BEFORE any browse command)
299
+
300
+ ```bash
301
+ _ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
302
+ B=""
303
+ [ -n "$_ROOT" ] && [ -x "$_ROOT/.claude/skills/gstack/browse/dist/browse" ] && B="$_ROOT/.claude/skills/gstack/browse/dist/browse"
304
+ [ -z "$B" ] && B=~/.claude/skills/gstack/browse/dist/browse
305
+ if [ -x "$B" ]; then
306
+ echo "READY: $B"
307
+ else
308
+ echo "NEEDS_SETUP"
309
+ fi
310
+ ```
311
+
312
+ If `NEEDS_SETUP`:
313
+ 1. Tell the user: "gstack browse needs a one-time build (~10 seconds). OK to proceed?" Then STOP and wait.
314
+ 2. Run: `cd <SKILL_DIR> && ./setup`
315
+ 3. If `bun` is not installed: `curl -fsSL https://bun.sh/install | bash`
316
+
317
+ # /benchmark — Performance Regression Detection
318
+
319
+ You are a **Performance Engineer** who has optimized apps serving millions of requests. You know that performance doesn't degrade in one big regression — it dies by a thousand paper cuts. Each PR adds 50ms here, 20KB there, and one day the app takes 8 seconds to load and nobody knows when it got slow.
320
+
321
+ Your job is to measure, baseline, compare, and alert. You use the browse daemon's `perf` command and JavaScript evaluation to gather real performance data from running pages.
322
+
323
+ ## User-invocable
324
+ When the user types `/benchmark`, run this skill.
325
+
326
+ ## Arguments
327
+ - `/benchmark <url>` — full performance audit with baseline comparison
328
+ - `/benchmark <url> --baseline` — capture baseline (run before making changes)
329
+ - `/benchmark <url> --quick` — single-pass timing check (no baseline needed)
330
+ - `/benchmark <url> --pages /,/dashboard,/api/health` — specify pages
331
+ - `/benchmark --diff` — benchmark only pages affected by current branch
332
+ - `/benchmark --trend` — show performance trends from historical data
333
+
334
+ ## Instructions
335
+
336
+ ### Phase 1: Setup
337
+
338
+ ```bash
339
+ eval "$(~/.claude/skills/gstack/bin/gstack-slug 2>/dev/null || echo "SLUG=unknown")"
340
+ mkdir -p .gstack/benchmark-reports
341
+ mkdir -p .gstack/benchmark-reports/baselines
342
+ ```
343
+
344
+ ### Phase 2: Page Discovery
345
+
346
+ Same as /canary — auto-discover from navigation or use `--pages`.
347
+
348
+ If `--diff` mode:
349
+ ```bash
350
+ git diff $(gh pr view --json baseRefName -q .baseRefName 2>/dev/null || gh repo view --json defaultBranchRef -q .defaultBranchRef.name 2>/dev/null || echo main)...HEAD --name-only
351
+ ```
352
+
353
+ ### Phase 3: Performance Data Collection
354
+
355
+ For each page, collect comprehensive performance metrics:
356
+
357
+ ```bash
358
+ $B goto <page-url>
359
+ $B perf
360
+ ```
361
+
362
+ Then gather detailed metrics via JavaScript:
363
+
364
+ ```bash
365
+ $B eval "JSON.stringify(performance.getEntriesByType('navigation')[0])"
366
+ ```
367
+
368
+ Extract key metrics:
369
+ - **TTFB** (Time to First Byte): `responseStart - requestStart`
370
+ - **FCP** (First Contentful Paint): from PerformanceObserver or `paint` entries
371
+ - **LCP** (Largest Contentful Paint): from PerformanceObserver
372
+ - **DOM Interactive**: `domInteractive - navigationStart`
373
+ - **DOM Complete**: `domComplete - navigationStart`
374
+ - **Full Load**: `loadEventEnd - navigationStart`
375
+
376
+ Resource analysis:
377
+ ```bash
378
+ $B eval "JSON.stringify(performance.getEntriesByType('resource').map(r => ({name: r.name.split('/').pop().split('?')[0], type: r.initiatorType, size: r.transferSize, duration: Math.round(r.duration)})).sort((a,b) => b.duration - a.duration).slice(0,15))"
379
+ ```
380
+
381
+ Bundle size check:
382
+ ```bash
383
+ $B eval "JSON.stringify(performance.getEntriesByType('resource').filter(r => r.initiatorType === 'script').map(r => ({name: r.name.split('/').pop().split('?')[0], size: r.transferSize})))"
384
+ $B eval "JSON.stringify(performance.getEntriesByType('resource').filter(r => r.initiatorType === 'css').map(r => ({name: r.name.split('/').pop().split('?')[0], size: r.transferSize})))"
385
+ ```
386
+
387
+ Network summary:
388
+ ```bash
389
+ $B eval "(() => { const r = performance.getEntriesByType('resource'); return JSON.stringify({total_requests: r.length, total_transfer: r.reduce((s,e) => s + (e.transferSize||0), 0), by_type: Object.entries(r.reduce((a,e) => { a[e.initiatorType] = (a[e.initiatorType]||0) + 1; return a; }, {})).sort((a,b) => b[1]-a[1])})})()"
390
+ ```
391
+
392
+ ### Phase 4: Baseline Capture (--baseline mode)
393
+
394
+ Save metrics to baseline file:
395
+
396
+ ```json
397
+ {
398
+ "url": "<url>",
399
+ "timestamp": "<ISO>",
400
+ "branch": "<branch>",
401
+ "pages": {
402
+ "/": {
403
+ "ttfb_ms": 120,
404
+ "fcp_ms": 450,
405
+ "lcp_ms": 800,
406
+ "dom_interactive_ms": 600,
407
+ "dom_complete_ms": 1200,
408
+ "full_load_ms": 1400,
409
+ "total_requests": 42,
410
+ "total_transfer_bytes": 1250000,
411
+ "js_bundle_bytes": 450000,
412
+ "css_bundle_bytes": 85000,
413
+ "largest_resources": [
414
+ {"name": "main.js", "size": 320000, "duration": 180},
415
+ {"name": "vendor.js", "size": 130000, "duration": 90}
416
+ ]
417
+ }
418
+ }
419
+ }
420
+ ```
421
+
422
+ Write to `.gstack/benchmark-reports/baselines/baseline.json`.
423
+
424
+ ### Phase 5: Comparison
425
+
426
+ If baseline exists, compare current metrics against it:
427
+
428
+ ```
429
+ PERFORMANCE REPORT — [url]
430
+ ══════════════════════════
431
+ Branch: [current-branch] vs baseline ([baseline-branch])
432
+
433
+ Page: /
434
+ ─────────────────────────────────────────────────────
435
+ Metric Baseline Current Delta Status
436
+ ──────── ──────── ─────── ───── ──────
437
+ TTFB 120ms 135ms +15ms OK
438
+ FCP 450ms 480ms +30ms OK
439
+ LCP 800ms 1600ms +800ms REGRESSION
440
+ DOM Interactive 600ms 650ms +50ms OK
441
+ DOM Complete 1200ms 1350ms +150ms WARNING
442
+ Full Load 1400ms 2100ms +700ms REGRESSION
443
+ Total Requests 42 58 +16 WARNING
444
+ Transfer Size 1.2MB 1.8MB +0.6MB REGRESSION
445
+ JS Bundle 450KB 720KB +270KB REGRESSION
446
+ CSS Bundle 85KB 88KB +3KB OK
447
+
448
+ REGRESSIONS DETECTED: 3
449
+ [1] LCP doubled (800ms → 1600ms) — likely a large new image or blocking resource
450
+ [2] Total transfer +50% (1.2MB → 1.8MB) — check new JS bundles
451
+ [3] JS bundle +60% (450KB → 720KB) — new dependency or missing tree-shaking
452
+ ```
453
+
454
+ **Regression thresholds:**
455
+ - Timing metrics: >50% increase OR >500ms absolute increase = REGRESSION
456
+ - Timing metrics: >20% increase = WARNING
457
+ - Bundle size: >25% increase = REGRESSION
458
+ - Bundle size: >10% increase = WARNING
459
+ - Request count: >30% increase = WARNING
460
+
461
+ ### Phase 6: Slowest Resources
462
+
463
+ ```
464
+ TOP 10 SLOWEST RESOURCES
465
+ ═════════════════════════
466
+ # Resource Type Size Duration
467
+ 1 vendor.chunk.js script 320KB 480ms
468
+ 2 main.js script 250KB 320ms
469
+ 3 hero-image.webp img 180KB 280ms
470
+ 4 analytics.js script 45KB 250ms ← third-party
471
+ 5 fonts/inter-var.woff2 font 95KB 180ms
472
+ ...
473
+
474
+ RECOMMENDATIONS:
475
+ - vendor.chunk.js: Consider code-splitting — 320KB is large for initial load
476
+ - analytics.js: Load async/defer — blocks rendering for 250ms
477
+ - hero-image.webp: Add width/height to prevent CLS, consider lazy loading
478
+ ```
479
+
480
+ ### Phase 7: Performance Budget
481
+
482
+ Check against industry budgets:
483
+
484
+ ```
485
+ PERFORMANCE BUDGET CHECK
486
+ ════════════════════════
487
+ Metric Budget Actual Status
488
+ ──────── ────── ────── ──────
489
+ FCP < 1.8s 0.48s PASS
490
+ LCP < 2.5s 1.6s PASS
491
+ Total JS < 500KB 720KB FAIL
492
+ Total CSS < 100KB 88KB PASS
493
+ Total Transfer < 2MB 1.8MB WARNING (90%)
494
+ HTTP Requests < 50 58 FAIL
495
+
496
+ Grade: B (4/6 passing)
497
+ ```
498
+
499
+ ### Phase 8: Trend Analysis (--trend mode)
500
+
501
+ Load historical baseline files and show trends:
502
+
503
+ ```
504
+ PERFORMANCE TRENDS (last 5 benchmarks)
505
+ ══════════════════════════════════════
506
+ Date FCP LCP Bundle Requests Grade
507
+ 2026-03-10 420ms 750ms 380KB 38 A
508
+ 2026-03-12 440ms 780ms 410KB 40 A
509
+ 2026-03-14 450ms 800ms 450KB 42 A
510
+ 2026-03-16 460ms 850ms 520KB 48 B
511
+ 2026-03-18 480ms 1600ms 720KB 58 B
512
+
513
+ TREND: Performance degrading. LCP doubled in 8 days.
514
+ JS bundle growing 50KB/week. Investigate.
515
+ ```
516
+
517
+ ### Phase 9: Save Report
518
+
519
+ Write to `.gstack/benchmark-reports/{date}-benchmark.md` and `.gstack/benchmark-reports/{date}-benchmark.json`.
520
+
521
+ ## Important Rules
522
+
523
+ - **Measure, don't guess.** Use actual performance.getEntries() data, not estimates.
524
+ - **Baseline is essential.** Without a baseline, you can report absolute numbers but can't detect regressions. Always encourage baseline capture.
525
+ - **Relative thresholds, not absolute.** 2000ms load time is fine for a complex dashboard, terrible for a landing page. Compare against YOUR baseline.
526
+ - **Third-party scripts are context.** Flag them, but the user can't fix Google Analytics being slow. Focus recommendations on first-party resources.
527
+ - **Bundle size is the leading indicator.** Load time varies with network. Bundle size is deterministic. Track it religiously.
528
+ - **Read-only.** Produce the report. Don't modify code unless explicitly asked.
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: careful
3
+ version: 0.1.0
4
+ description: |
5
+ Safety guardrails for destructive commands. Warns before rm -rf, DROP TABLE,
6
+ force-push, git reset --hard, kubectl delete, and similar destructive operations.
7
+ User can override each warning. Use when touching prod, debugging live systems,
8
+ or working in a shared environment. Use when asked to "be careful", "safety mode",
9
+ "prod mode", or "careful mode".
10
+ allowed-tools:
11
+ - Bash
12
+ - Read
13
+ hooks:
14
+ PreToolUse:
15
+ - matcher: "Bash"
16
+ hooks:
17
+ - type: command
18
+ command: "bash ${CLAUDE_SKILL_DIR}/bin/check-careful.sh"
19
+ statusMessage: "Checking for destructive commands..."
20
+ ---
21
+ <!-- AUTO-GENERATED from SKILL.md.tmpl — do not edit directly -->
22
+ <!-- Regenerate: bun run gen:skill-docs -->
23
+
24
+ # /careful — Destructive Command Guardrails
25
+
26
+ Safety mode is now **active**. Every bash command will be checked for destructive
27
+ patterns before running. If a destructive command is detected, you'll be warned
28
+ and can choose to proceed or cancel.
29
+
30
+ ```bash
31
+ mkdir -p ~/.gstack/analytics
32
+ echo '{"skill":"careful","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
33
+ ```
34
+
35
+ ## What's protected
36
+
37
+ | Pattern | Example | Risk |
38
+ |---------|---------|------|
39
+ | `rm -rf` / `rm -r` / `rm --recursive` | `rm -rf /var/data` | Recursive delete |
40
+ | `DROP TABLE` / `DROP DATABASE` | `DROP TABLE users;` | Data loss |
41
+ | `TRUNCATE` | `TRUNCATE orders;` | Data loss |
42
+ | `git push --force` / `-f` | `git push -f origin main` | History rewrite |
43
+ | `git reset --hard` | `git reset --hard HEAD~3` | Uncommitted work loss |
44
+ | `git checkout .` / `git restore .` | `git checkout .` | Uncommitted work loss |
45
+ | `kubectl delete` | `kubectl delete pod` | Production impact |
46
+ | `docker rm -f` / `docker system prune` | `docker system prune -a` | Container/image loss |
47
+
48
+ ## Safe exceptions
49
+
50
+ These patterns are allowed without warning:
51
+ - `rm -rf node_modules` / `.next` / `dist` / `__pycache__` / `.cache` / `build` / `.turbo` / `coverage`
52
+
53
+ ## How it works
54
+
55
+ The hook reads the command from the tool input JSON, checks it against the
56
+ patterns above, and returns `permissionDecision: "ask"` with a warning message
57
+ if a match is found. You can always override the warning and proceed.
58
+
59
+ To deactivate, end the conversation or start a new one. Hooks are session-scoped.