@agilno-tech/rivet 0.1.0-alpha.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 (283) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +6 -0
  3. package/README.md +59 -0
  4. package/bin/cli.js +42 -0
  5. package/dist/agents/backend-django-agent/SKILL.md +35 -0
  6. package/dist/agents/backend-nestjs-agent/SKILL.md +36 -0
  7. package/dist/agents/boss-agent/SKILL.md +28 -0
  8. package/dist/agents/bounded-worker/SKILL.md +28 -0
  9. package/dist/agents/data-performance-agent/SKILL.md +32 -0
  10. package/dist/agents/delivery-ticketing-agent/SKILL.md +36 -0
  11. package/dist/agents/devops-agent/SKILL.md +34 -0
  12. package/dist/agents/engineering-manager/SKILL.md +28 -0
  13. package/dist/agents/frontend-nextjs-agent/SKILL.md +34 -0
  14. package/dist/agents/frontend-web-agent/SKILL.md +31 -0
  15. package/dist/agents/incident-response-agent/SKILL.md +42 -0
  16. package/dist/agents/jest-agent/SKILL.md +77 -0
  17. package/dist/agents/mobile-agent/SKILL.md +32 -0
  18. package/dist/agents/playwright-agent/SKILL.md +54 -0
  19. package/dist/agents/product-design-manager/SKILL.md +27 -0
  20. package/dist/agents/qa-agent/SKILL.md +29 -0
  21. package/dist/agents/quality-manager/SKILL.md +28 -0
  22. package/dist/agents/vitest-agent/SKILL.md +77 -0
  23. package/dist/governance/pre-push-rules.md +75 -0
  24. package/dist/governance/prompt-hygiene.md +22 -0
  25. package/dist/governance/review-checklist.md +24 -0
  26. package/dist/governance/safety-and-data.md +27 -0
  27. package/dist/governance/usage-rules.md +21 -0
  28. package/dist/mandatory/address-pr-feedback/SKILL.md +196 -0
  29. package/dist/mandatory/agentic-goal/SKILL.md +42 -0
  30. package/dist/mandatory/agentic-status/SKILL.md +74 -0
  31. package/dist/mandatory/apply-design/SKILL.md +228 -0
  32. package/dist/mandatory/check-ac/SKILL.md +124 -0
  33. package/dist/mandatory/create-pr-and-commit/SKILL.md +304 -0
  34. package/dist/mandatory/design/SKILL.md +312 -0
  35. package/dist/mandatory/feature-workflow/SKILL.md +87 -0
  36. package/dist/mandatory/hotfix/SKILL.md +195 -0
  37. package/dist/mandatory/pre-push/SKILL.md +272 -0
  38. package/dist/mandatory/project-context/SKILL.md +180 -0
  39. package/dist/mandatory/release-docs/SKILL.md +191 -0
  40. package/dist/mandatory/review-pr/SKILL.md +323 -0
  41. package/dist/mandatory/security-review/SKILL.md +157 -0
  42. package/dist/skills/api-contract/SKILL.md +77 -0
  43. package/dist/skills/backend-django/SKILL.md +27 -0
  44. package/dist/skills/backend-nestjs/SKILL.md +65 -0
  45. package/dist/skills/bug-ticket-creation/SKILL.md +43 -0
  46. package/dist/skills/cloudwatch-troubleshooting/SKILL.md +73 -0
  47. package/dist/skills/database-migration/SKILL.md +97 -0
  48. package/dist/skills/debugging/SKILL.md +32 -0
  49. package/dist/skills/devops-infra/SKILL.md +26 -0
  50. package/dist/skills/documentation/SKILL.md +24 -0
  51. package/dist/skills/frontend-nextjs/SKILL.md +27 -0
  52. package/dist/skills/incident-postmortem/SKILL.md +38 -0
  53. package/dist/skills/kubernetes-troubleshooting/SKILL.md +71 -0
  54. package/dist/skills/mobile-react-native/SKILL.md +37 -0
  55. package/dist/skills/postgres-analytics/SKILL.md +29 -0
  56. package/dist/skills/product-jira-ticketing/SKILL.md +28 -0
  57. package/dist/skills/qa-bug-analysis/SKILL.md +27 -0
  58. package/dist/skills/refactoring/SKILL.md +32 -0
  59. package/dist/skills/sprint-planning/SKILL.md +32 -0
  60. package/dist/skills/testing-quality/SKILL.md +62 -0
  61. package/dist/v2/protocols/agent-orchestration.md +49 -0
  62. package/dist/v2/protocols/delivery.md +45 -0
  63. package/dist/v2/protocols/design-authority.md +29 -0
  64. package/dist/v2/protocols/goal-graph.md +44 -0
  65. package/dist/v2/protocols/pattern-first-development.md +29 -0
  66. package/dist/v2/protocols/qa-evidence.md +29 -0
  67. package/dist/v2/protocols/security.md +29 -0
  68. package/dist/v2/schemas/event.schema.json +86 -0
  69. package/dist/v2/schemas/evidence.schema.json +94 -0
  70. package/dist/v2/schemas/feature-decomposition.schema.json +48 -0
  71. package/dist/v2/schemas/feature-plan.schema.json +95 -0
  72. package/dist/v2/schemas/goal-graph.schema.json +61 -0
  73. package/dist/v2/schemas/integration.schema.json +119 -0
  74. package/dist/v2/schemas/orchestration.schema.json +69 -0
  75. package/dist/v2/schemas/project.schema.json +209 -0
  76. package/dist/v2/schemas/providers.schema.json +142 -0
  77. package/dist/v2/schemas/quality.schema.json +50 -0
  78. package/dist/v2/schemas/work-action.schema.json +44 -0
  79. package/dist/v2/schemas/work-request.schema.json +253 -0
  80. package/dist/v2/templates/evidence/qa-bundle.json +194 -0
  81. package/dist/v2/templates/github-actions/rivet-deploy.yml +98 -0
  82. package/dist/v2/templates/harness/SKILL.md +90 -0
  83. package/dist/v2/templates/project/.rivet/orchestration.yaml +42 -0
  84. package/dist/v2/templates/project/.rivet/project.yaml +14 -0
  85. package/dist/v2/templates/project/.rivet/providers.yaml +8 -0
  86. package/dist/v2/templates/project/.rivet/quality.yaml +16 -0
  87. package/package.json +58 -0
  88. package/protocols/agent-orchestration.md +49 -0
  89. package/protocols/delivery.md +45 -0
  90. package/protocols/design-authority.md +29 -0
  91. package/protocols/goal-graph.md +44 -0
  92. package/protocols/pattern-first-development.md +29 -0
  93. package/protocols/qa-evidence.md +29 -0
  94. package/protocols/security.md +29 -0
  95. package/schemas/event.schema.json +86 -0
  96. package/schemas/evidence.schema.json +94 -0
  97. package/schemas/feature-decomposition.schema.json +48 -0
  98. package/schemas/feature-plan.schema.json +95 -0
  99. package/schemas/goal-graph.schema.json +61 -0
  100. package/schemas/integration.schema.json +119 -0
  101. package/schemas/orchestration.schema.json +69 -0
  102. package/schemas/project.schema.json +209 -0
  103. package/schemas/providers.schema.json +142 -0
  104. package/schemas/quality.schema.json +50 -0
  105. package/schemas/work-action.schema.json +44 -0
  106. package/schemas/work-request.schema.json +253 -0
  107. package/src/adapters/confluence.js +138 -0
  108. package/src/adapters/contract.js +657 -0
  109. package/src/adapters/factory.js +122 -0
  110. package/src/adapters/figma.js +178 -0
  111. package/src/adapters/fixtures.js +183 -0
  112. package/src/adapters/github.js +314 -0
  113. package/src/adapters/http.js +704 -0
  114. package/src/adapters/jira.js +195 -0
  115. package/src/adapters/linear.js +171 -0
  116. package/src/adapters/node-transport.js +59 -0
  117. package/src/cli/integration-setup-prompt.js +32 -0
  118. package/src/cli/interrupt.js +25 -0
  119. package/src/cli/main.js +596 -0
  120. package/src/cli/output.js +174 -0
  121. package/src/cli/parse-args.js +246 -0
  122. package/src/cli/project-discovery.js +70 -0
  123. package/src/cli/task-confirmation.js +38 -0
  124. package/src/cli/task-presentation.js +22 -0
  125. package/src/clients/claude.js +214 -0
  126. package/src/clients/codex.js +180 -0
  127. package/src/clients/compatibility.js +23 -0
  128. package/src/clients/contract.js +224 -0
  129. package/src/clients/fake.js +170 -0
  130. package/src/clients/process-runner.js +657 -0
  131. package/src/clients/result-contract.js +78 -0
  132. package/src/commands/delivery-publish.js +80 -0
  133. package/src/commands/delivery-remote.js +230 -0
  134. package/src/commands/delivery-review-update.js +39 -0
  135. package/src/commands/delivery-tracker.js +94 -0
  136. package/src/commands/delivery-transition.js +79 -0
  137. package/src/commands/delivery.js +223 -0
  138. package/src/commands/dependency-approval.js +21 -0
  139. package/src/commands/doctor.js +191 -0
  140. package/src/commands/evidence.js +44 -0
  141. package/src/commands/feature.js +212 -0
  142. package/src/commands/goals.js +231 -0
  143. package/src/commands/human-run.js +208 -0
  144. package/src/commands/human-task.js +278 -0
  145. package/src/commands/init.js +848 -0
  146. package/src/commands/install.js +814 -0
  147. package/src/commands/integration-setup.js +65 -0
  148. package/src/commands/integrations.js +54 -0
  149. package/src/commands/models.js +158 -0
  150. package/src/commands/orchestrate.js +61 -0
  151. package/src/commands/preflight.js +125 -0
  152. package/src/commands/protocols.js +228 -0
  153. package/src/commands/repositories.js +77 -0
  154. package/src/commands/setup-remote.js +41 -0
  155. package/src/commands/setup.js +214 -0
  156. package/src/commands/status.js +224 -0
  157. package/src/commands/support.js +44 -0
  158. package/src/commands/task-completion.js +104 -0
  159. package/src/commands/uninstall.js +234 -0
  160. package/src/commands/verify.js +171 -0
  161. package/src/commands/work.js +220 -0
  162. package/src/commands/worktrees.js +52 -0
  163. package/src/config/command-readiness.js +218 -0
  164. package/src/config/commands.js +206 -0
  165. package/src/config/defaults.js +55 -0
  166. package/src/config/load.js +230 -0
  167. package/src/config/validate.js +560 -0
  168. package/src/delivery/bitbucket-review.js +123 -0
  169. package/src/delivery/branch-publication.js +23 -0
  170. package/src/delivery/contract.js +379 -0
  171. package/src/delivery/github-deployment.js +132 -0
  172. package/src/delivery/github-review.js +5 -0
  173. package/src/delivery/github.js +382 -0
  174. package/src/delivery/gitlab-review.js +5 -0
  175. package/src/delivery/gitlab.js +395 -0
  176. package/src/delivery/prepare.js +90 -0
  177. package/src/delivery/publication-process.js +33 -0
  178. package/src/delivery/publication-transport.js +112 -0
  179. package/src/delivery/review-request.js +184 -0
  180. package/src/delivery/review-update.js +74 -0
  181. package/src/delivery/service.js +400 -0
  182. package/src/delivery/store.js +76 -0
  183. package/src/delivery/tracker-target.js +51 -0
  184. package/src/delivery/tracker-transition.js +158 -0
  185. package/src/delivery/tracker.js +164 -0
  186. package/src/discovery/git.js +85 -0
  187. package/src/discovery/portable.js +108 -0
  188. package/src/discovery/project.js +345 -0
  189. package/src/discovery/tools.js +145 -0
  190. package/src/evaluations/approval.js +20 -0
  191. package/src/evaluations/cost-policy.js +20 -0
  192. package/src/evaluations/harness-attempt.js +113 -0
  193. package/src/evaluations/live-runner.js +55 -0
  194. package/src/evaluations/profile.js +28 -0
  195. package/src/evaluations/report.js +11 -0
  196. package/src/evaluations/text-attempt.js +18 -0
  197. package/src/evidence/checksum.js +87 -0
  198. package/src/evidence/collect.js +727 -0
  199. package/src/evidence/validate.js +354 -0
  200. package/src/feature/accepted-integration.js +46 -0
  201. package/src/feature/actions.js +37 -0
  202. package/src/feature/client-profile.js +56 -0
  203. package/src/feature/decomposition-contract.js +58 -0
  204. package/src/feature/host-execution.js +633 -0
  205. package/src/feature/host-lock-recovery.js +96 -0
  206. package/src/feature/host-run-lock.js +32 -0
  207. package/src/feature/local-approval.js +183 -0
  208. package/src/feature/plan-contract.js +215 -0
  209. package/src/feature/planner.js +253 -0
  210. package/src/feature/run-store.js +241 -0
  211. package/src/feature/runtime-bridge.js +840 -0
  212. package/src/feature/verification-report.js +168 -0
  213. package/src/feature/workflow.js +375 -0
  214. package/src/git/client.js +509 -0
  215. package/src/git/integration-worktree.js +153 -0
  216. package/src/git/reconcile.js +222 -0
  217. package/src/git/reservations.js +450 -0
  218. package/src/git/worktrees.js +478 -0
  219. package/src/graph/completion.js +189 -0
  220. package/src/graph/fixtures.js +116 -0
  221. package/src/graph/reducer.js +124 -0
  222. package/src/graph/scheduler.js +252 -0
  223. package/src/graph/validate.js +106 -0
  224. package/src/install/managed.js +579 -0
  225. package/src/install/project-reference.js +33 -0
  226. package/src/install/project-runtime.js +142 -0
  227. package/src/install/runtime-integrity.cjs +141 -0
  228. package/src/integrations/capabilities.js +69 -0
  229. package/src/integrations/host-observation.js +26 -0
  230. package/src/integrations/registry.js +56 -0
  231. package/src/models/delegate.js +102 -0
  232. package/src/models/profiles.js +53 -0
  233. package/src/models/protocols.js +208 -0
  234. package/src/models/registry.js +83 -0
  235. package/src/models/transport.js +59 -0
  236. package/src/policy/approvals.js +251 -0
  237. package/src/policy/authority.js +282 -0
  238. package/src/policy/budget.js +149 -0
  239. package/src/policy/command-bootstrap.js +219 -0
  240. package/src/policy/commands.js +803 -0
  241. package/src/prompts/launch-contract.js +43 -0
  242. package/src/prompts/planning-contract.js +92 -0
  243. package/src/protocols/presentation.js +53 -0
  244. package/src/protocols/project.js +289 -0
  245. package/src/quality/runner.js +497 -0
  246. package/src/quality/traceability.js +215 -0
  247. package/src/repositories/identity.js +59 -0
  248. package/src/repositories/index.js +2 -0
  249. package/src/repositories/provider.js +210 -0
  250. package/src/runtime/application.js +353 -0
  251. package/src/runtime/dependency-directory.js +33 -0
  252. package/src/runtime/harness-discovery.js +121 -0
  253. package/src/runtime/heartbeat.js +47 -0
  254. package/src/runtime/instance-store.js +112 -0
  255. package/src/runtime/orchestrator.js +1133 -0
  256. package/src/runtime/portable-dependencies.js +94 -0
  257. package/src/runtime/recovery.js +190 -0
  258. package/src/runtime/retry.js +54 -0
  259. package/src/runtime/supervisor.js +166 -0
  260. package/src/runtime/worktree-bootstrap.js +169 -0
  261. package/src/state/event-store.js +333 -0
  262. package/src/state/lock.js +266 -0
  263. package/src/state/paths.js +274 -0
  264. package/src/state/redact.js +106 -0
  265. package/src/state/snapshot-store.js +310 -0
  266. package/src/status/public/app.js +96 -0
  267. package/src/status/public/index.html +37 -0
  268. package/src/status/public/styles.css +50 -0
  269. package/src/status/server.js +323 -0
  270. package/src/status/view-model.js +356 -0
  271. package/src/support/bundle.js +195 -0
  272. package/src/support/failure-report.js +96 -0
  273. package/src/work-request/contract.js +250 -0
  274. package/src/work-request/host.js +78 -0
  275. package/src/work-request/local.js +163 -0
  276. package/src/work-request/tracker.js +105 -0
  277. package/templates/evidence/qa-bundle.json +194 -0
  278. package/templates/github-actions/rivet-deploy.yml +98 -0
  279. package/templates/harness/SKILL.md +90 -0
  280. package/templates/project/.rivet/orchestration.yaml +42 -0
  281. package/templates/project/.rivet/project.yaml +14 -0
  282. package/templates/project/.rivet/providers.yaml +8 -0
  283. package/templates/project/.rivet/quality.yaml +16 -0
@@ -0,0 +1,304 @@
1
+ ---
2
+ name: rivet-create-pr-and-commit
3
+ description: "Full workflow to commit staged changes, push the branch, open a pull request on Bitbucket,"
4
+ ---
5
+
6
+ # Create PR and Commit
7
+
8
+ Full workflow to commit staged changes, push the branch, open a pull request on Bitbucket,
9
+ and move the linked Jira ticket to In Review — with correct branch naming, commit message
10
+ format, and a generated PR title and description.
11
+
12
+ ## Usage
13
+
14
+ ```
15
+ /create-pr-and-commit
16
+ ```
17
+
18
+ ---
19
+
20
+ ## Instructions
21
+
22
+ ### Step 1 — Check the current branch
23
+
24
+ **Guard — verify Bitbucket remote and derive repo slug:**
25
+ ```bash
26
+ BB_REMOTE=$(git remote get-url origin 2>/dev/null)
27
+ if [[ "$BB_REMOTE" != *bitbucket.org* ]]; then
28
+ echo "This skill requires a Bitbucket remote. Detected: $BB_REMOTE"
29
+ exit 1
30
+ fi
31
+ BB_SLUG=$(echo "$BB_REMOTE" | sed 's|.*bitbucket\.org[:/]\(.*\)\.git|\1|; s|.*bitbucket\.org[:/]\(.*\)|\1|')
32
+ ```
33
+
34
+ ```bash
35
+ git branch --show-current
36
+ ```
37
+
38
+ - If already on a feature or fix branch (not `main`, `develop`, or `release/*`):
39
+ - Extract the ticket key using the pattern `[A-Z]+-\d+` (e.g. `PROJ-123`, `BC-7`)
40
+ - If no ticket key is found, ask the user for it
41
+ - Skip to Step 3
42
+ - If on `main`, `develop`, or `release/*` — proceed to Step 2 to create a branch first
43
+
44
+ ---
45
+
46
+ ### Step 2 — Create a branch
47
+
48
+ Branch naming:
49
+ - Feature work: `feature/<JIRA-KEY>/<short-description>`
50
+ - Bug fix: `fix/<JIRA-KEY>/<short-description>`
51
+ - `<short-description>`: 2–5 words, lowercase, hyphen-separated, derived from the ticket title or staged changes
52
+
53
+ Ask the user for the ticket key if not already known, then:
54
+
55
+ ```bash
56
+ git checkout -b feature/<JIRA-KEY>/<short-description>
57
+ ```
58
+
59
+ ---
60
+
61
+ ### Step 3 — Stage and commit
62
+
63
+ Check what is staged and unstaged:
64
+
65
+ ```bash
66
+ git status
67
+ git diff --stat
68
+ ```
69
+
70
+ If there are unstaged changes, ask the user which files to include before staging anything.
71
+ Never run `git add .` or `git add -A` without confirmation.
72
+
73
+ Commit message format: `type(JIRA-KEY): short imperative description`
74
+
75
+ - Types: `feat`, `fix`, `refactor`, `docs`, `style`, `perf`, `chore`, `ci`, `build`, `test`
76
+ - JIRA-KEY: uppercase (e.g. `PROJ-123`)
77
+ - Description: lowercase, imperative, under 72 chars total
78
+ - Examples:
79
+ - `feat(PROJ-123): add search filter component`
80
+ - `fix(PROJ-123): resolve null pointer in auth middleware`
81
+ - `refactor(PROJ-123): extract shared hook for form validation`
82
+
83
+ Do not add `Co-Authored-By` lines or EOF markers — write only the plain commit message.
84
+
85
+ ```bash
86
+ git commit -m "type(JIRA-KEY): short description"
87
+ ```
88
+
89
+ ---
90
+
91
+ ### Step 4 — Push the branch
92
+
93
+ ```bash
94
+ git push -u origin <current-branch>
95
+ ```
96
+
97
+ If the branch is already up to date on remote, the push will be a no-op — proceed to PR creation.
98
+
99
+ ---
100
+
101
+ ### Step 5 — Get Bitbucket credentials
102
+
103
+ **Credentials:**
104
+
105
+ macOS:
106
+ ```bash
107
+ security find-internet-password -s "bitbucket.org" -g
108
+ ```
109
+ Extract the `acct` (→ `$BB_USER`) and `password` (→ `$BB_PASS`) fields.
110
+
111
+ Linux / Windows or if keychain lookup fails: use `BITBUCKET_USERNAME` and `BITBUCKET_APP_PASSWORD` env vars. If neither source yields credentials, ask the user.
112
+
113
+ **Write a temporary .netrc file so credentials never appear as shell arguments:**
114
+ ```bash
115
+ printf 'machine api.bitbucket.org login %s password %s\n' "$BB_USER" "$BB_PASS" \
116
+ > /tmp/.bb_netrc && chmod 600 /tmp/.bb_netrc
117
+ ```
118
+
119
+ **Token requirements:** the password must be an Atlassian API token **with scopes**
120
+ (`read:account`, `read:repository`, `read:pullrequest`, `write:pullrequest` — Bitbucket app).
121
+ Unscoped API tokens return 401 on `api.bitbucket.org`.
122
+
123
+ Do **not** pre-check auth with `GET /2.0/user` — it can return 403 even with a valid scoped
124
+ token. Just attempt the PR creation (Step 8) and handle errors there.
125
+
126
+ ---
127
+
128
+ ### Step 6 — Determine repo slug, target branch, and PR context
129
+
130
+ **Repo slug** — always derive from the origin remote, never hardcode:
131
+
132
+ ```bash
133
+ git remote get-url origin
134
+ ```
135
+
136
+ Strip the host prefix and `.git` suffix to get `<workspace>/<repo>`:
137
+ - `git@bitbucket.org:_agilno/biocirv-client.git` → `_agilno/biocirv-client`
138
+ - `https://bitbucket.org/_agilno/biocirv-client.git` → `_agilno/biocirv-client`
139
+
140
+ **Target branch** — the branch this feature branch was created from. Resolve in order:
141
+
142
+ 1. `CLAUDE.md` — a `defaultBranch` / `targetBranch` entry, if present
143
+ 2. The branch the current branch diverged from — among the repo's long-lived branches,
144
+ pick the one closest to HEAD (fewest commits between merge-base and branch tip):
145
+
146
+ ```bash
147
+ for b in dev develop main master; do
148
+ git show-ref --verify --quiet "refs/remotes/origin/$b" \
149
+ && echo "$b $(git rev-list --count "$(git merge-base HEAD "origin/$b")..origin/$b")"
150
+ done | sort -k2 -n | head -1
151
+ ```
152
+
153
+ (e.g. if the repo's default working branch is `dev`, this yields `dev`, not `main`)
154
+
155
+ 3. Fall back to `main`
156
+
157
+ **Gather context for the PR description:**
158
+
159
+ ```bash
160
+ git fetch origin <target-branch>
161
+ git log origin/<target-branch>...HEAD --oneline
162
+ git diff origin/<target-branch>...HEAD --name-status
163
+ ```
164
+
165
+ Draft:
166
+ - **Title**: `JIRA-KEY: Short imperative description` (under 70 chars) — derived from branch name and commits
167
+ - **Summary**: 2–4 sentences on what changed and why
168
+ - **Changes**: bulleted list grouped by area (backend, frontend, infra, tests)
169
+ - **How to test**: manual or automated verification steps
170
+ - **Screenshots**: include a placeholder section if UI was changed
171
+ - **Risks & rollback**: anything reviewers should watch for
172
+
173
+ ---
174
+
175
+ ### Step 7 — Quality gate check
176
+
177
+ If `.claude/pre-push-rules.md` exists in the project root and `/pre-push` has not been run
178
+ yet in this session, ask before opening the PR:
179
+
180
+ > "pre-push hasn't been run yet — run it now before opening the PR, or proceed anyway?"
181
+
182
+ - If the user asks to run it, run `/pre-push` and report the result. If it finds Critical
183
+ issues, ask whether to fix them first or proceed to the PR regardless.
184
+ - If the user says proceed anyway, continue to Step 8 without re-prompting.
185
+
186
+ If `.claude/pre-push-rules.md` does not exist, or `/pre-push` already ran this session, skip
187
+ this step silently.
188
+
189
+ ---
190
+
191
+ ### Step 8 — Create the PR via Bitbucket API
192
+
193
+ Use the `<repo-slug>` and `<target-branch>` resolved in Step 6.
194
+
195
+ Check if a reviewer is configured via `BITBUCKET_PR_REVIEWER` env var. If set, include it;
196
+ if not, omit the `reviewers` field entirely.
197
+
198
+ ```bash
199
+ # Without reviewer:
200
+ curl -s --netrc-file /tmp/.bb_netrc \
201
+ -X POST \
202
+ -H "Content-Type: application/json" \
203
+ https://api.bitbucket.org/2.0/repositories/$BB_SLUG/pullrequests \
204
+ -d '{
205
+ "title": "<title>",
206
+ "description": "<description>",
207
+ "source": { "branch": { "name": "<current-branch>" } },
208
+ "destination": { "branch": { "name": "<target-branch>" } },
209
+ "close_source_branch": true
210
+ }'
211
+
212
+ # With reviewer (when BITBUCKET_PR_REVIEWER is set):
213
+ curl -s --netrc-file /tmp/.bb_netrc \
214
+ -X POST \
215
+ -H "Content-Type: application/json" \
216
+ https://api.bitbucket.org/2.0/repositories/$BB_SLUG/pullrequests \
217
+ -d '{
218
+ "title": "<title>",
219
+ "description": "<description>",
220
+ "source": { "branch": { "name": "<current-branch>" } },
221
+ "destination": { "branch": { "name": "<target-branch>" } },
222
+ "close_source_branch": true,
223
+ "reviewers": [{ "account_id": "<BITBUCKET_PR_REVIEWER>" }]
224
+ }'
225
+ ```
226
+
227
+ Return the PR URL from the `links.html.href` field in the response.
228
+
229
+ **If the API returns 401 (invalid, expired, or unscoped token):**
230
+
231
+ Tell the user to create a scoped API token and update the keychain:
232
+
233
+ 1. Go to <https://id.atlassian.com/manage-profile/security/api-tokens>
234
+ 2. **Create API token with scopes** → app **Bitbucket** → scopes `read:account`,
235
+ `read:repository`, `read:pullrequest`, `write:pullrequest`
236
+ 3. Store it in the keychain:
237
+
238
+ ```bash
239
+ security add-internet-password -U -s "bitbucket.org" -a "<email>" -w "<token>"
240
+ ```
241
+
242
+ (On Linux/Windows, update the `BITBUCKET_APP_PASSWORD` env var instead.)
243
+
244
+ Then retry the PR creation.
245
+
246
+ ---
247
+
248
+ ### Step 9 — Move Jira ticket to In Review
249
+
250
+ If Atlassian MCP is unavailable, skip this step silently.
251
+
252
+ Fetch the current ticket status:
253
+ ```
254
+ mcp__claude_ai_Atlassian__getJiraIssue → fields.status.name
255
+ ```
256
+
257
+ If the status is already `In Review` (or equivalent — `Code Review`, `Under Review`), skip.
258
+
259
+ Otherwise fetch available transitions:
260
+ ```
261
+ mcp__claude_ai_Atlassian__getTransitionsForJiraIssue (issueIdOrKey: <JIRA-KEY>)
262
+ ```
263
+
264
+ Find the transition whose name matches `In Review`, `Code Review`, or `Under Review`
265
+ (case-insensitive). If found, apply it:
266
+ ```
267
+ mcp__claude_ai_Atlassian__transitionJiraIssue (issueIdOrKey: <JIRA-KEY>, transitionId: <id>)
268
+ ```
269
+
270
+ If no matching transition is found, note it to the user:
271
+ > "Could not find an 'In Review' transition for <JIRA-KEY> — move it manually."
272
+
273
+ ---
274
+
275
+ ### Step 10 — Clean up credentials
276
+
277
+ ```bash
278
+ rm -f /tmp/.bb_netrc
279
+ ```
280
+
281
+ ---
282
+
283
+ ## Inconsistency signals — always stop and ask
284
+
285
+ | Signal | What to ask |
286
+ |---|---|
287
+ | No ticket key found in branch name | "No ticket key found — provide the JIRA key to continue?" |
288
+ | No staged changes and no unstaged changes | "Nothing to commit — stage the relevant files first, or abort?" |
289
+ | Bitbucket credentials not found in keychain or env vars | "No credentials found — provide your Atlassian email and a scoped API token?" |
290
+ | PR creation returns 401 | Walk the user through creating a scoped token (see Step 8) — do not retry with the same credentials |
291
+ | PR already exists for this branch | "A PR already exists — show the existing PR link, or create a new one anyway?" |
292
+ | Push fails due to non-fast-forward | "Push rejected — pull and rebase first, or force push?" |
293
+
294
+ ---
295
+
296
+ ## Notes
297
+
298
+ - Step 7 is the only point that runs `/pre-push` automatically-on-prompt — don't run it
299
+ proactively elsewhere in this flow, and don't skip asking in Step 7 even if the user seems
300
+ to be in a hurry.
301
+ - If a PR already exists for the branch, the API will return an error — inform the user and provide
302
+ the existing PR link if available.
303
+ - Never force-push unless the user explicitly requests it.
304
+ - Do **not** add any AI attribution to commit messages or PR descriptions — no "Co-Authored-By: Claude", no "Generated with Claude Code", no similar footers.
@@ -0,0 +1,312 @@
1
+ ---
2
+ name: rivet-design
3
+ description: "Write a design document for a Jira ticket before any code is written."
4
+ ---
5
+
6
+ # Design
7
+
8
+ Write a design document for a Jira ticket before any code is written.
9
+ Works for FE, BE, or full-stack tickets on any project.
10
+
11
+ ## Usage
12
+
13
+ ```
14
+ /design <TICKET_ID>
15
+ ```
16
+
17
+ Example: `/design PROJ-123`
18
+
19
+ ---
20
+
21
+ ## Instructions
22
+
23
+ ### Step 0 — Read project conventions
24
+
25
+ Read `CLAUDE.md` at the repo root. Extract and hold in memory:
26
+ - Naming conventions
27
+ - TypeScript rules, component reuse rules, styling rules
28
+ - Patterns to follow and patterns to avoid
29
+ - Any stack-specific constraints
30
+ - Sensitive Areas (auth, payments, PII) — needed to answer the Security & Access Control
31
+ questions in Step 2
32
+
33
+ These will be enforced in Section 7 of the design doc.
34
+
35
+ ---
36
+
37
+ ### Step 1 — Parallel research (run all simultaneously)
38
+
39
+ **1a. Fetch the primary ticket**
40
+
41
+ Use `mcp__claude_ai_Atlassian__getJiraIssue` with the provided ticket ID.
42
+
43
+ Extract:
44
+ - `fields.summary` — title
45
+ - `fields.description` — full description including any URLs
46
+ - `fields.issuelinks` — all linked tickets
47
+ - `fields.attachment` — attached files
48
+ - Any URLs in the description (figma.com, confluence, notion, etc.)
49
+
50
+ **1b. Fetch all linked tickets**
51
+
52
+ Use `mcp__claude_ai_Atlassian__getJiraIssue` for each linked ticket ID in parallel.
53
+ Prioritize tickets marked IMPLEMENTS, BLOCKS, RELATES TO, or CLONES.
54
+ Extract summary, description, AC, and any further URLs from each.
55
+
56
+ **1c. Explore the codebase**
57
+
58
+ Spawn an Explore subagent with a prompt tailored to the ticket topic:
59
+
60
+ > Search for all code relevant to [TOPIC FROM TICKET]. Find:
61
+ > (1) existing components, screens, or modules that implement the described behaviour or would be modified,
62
+ > (2) shared components in src/shared/ that are relevant or could be reused,
63
+ > (3) existing types, constants, or state hooks related to this feature,
64
+ > (4) existing tests for any of the above.
65
+ > Return file paths, component/function names, and a one-line description of each.
66
+
67
+ **1d. Explore linked design and documentation files**
68
+
69
+ Collect all URLs found across the primary ticket and all linked tickets. Then for each:
70
+
71
+ - **Figma URLs** (figma.com):
72
+ - Fetch using `mcp__claude_ai_Figma__get_design_context` (primary) and `mcp__claude_ai_Figma__get_screenshot` for visual reference. Use `mcp__claude_ai_Figma__get_metadata` for component/layer names if needed.
73
+ - Extract: screen names, component names, user flow annotations, any noted interactions
74
+ - If Figma MCP is unavailable or returns an error, note the URL and inform the user:
75
+ > "Figma MCP is not configured or could not access this file. Share screenshots or describe the design for full context."
76
+
77
+ - **Confluence URLs**:
78
+ - Fetch using `mcp__claude_ai_Atlassian__getConfluencePage` or equivalent
79
+ - Extract any relevant specs, decisions, or background context
80
+
81
+ - **Other URLs** (Notion, Google Docs, etc.):
82
+ - Attempt to fetch with WebFetch if publicly accessible
83
+ - If not accessible, note the URL and ask the user to paste the relevant content
84
+
85
+ ---
86
+
87
+ ### Step 2 — Synthesize before asking questions
88
+
89
+ After Step 1, identify what is already known from tickets, code, and designs.
90
+ Only ask questions that genuinely cannot be answered from gathered context.
91
+ Group all unknown questions in a single message — never ask one at a time.
92
+
93
+ Questions to evaluate (skip if already answered by research):
94
+
95
+ **Scope & Behaviour**
96
+ - What is the entry point / trigger for this feature?
97
+ - Are there edge cases or failure modes the ticket doesn't mention?
98
+ - Are there states to handle: empty, loading, error, offline?
99
+
100
+ **UI & Design**
101
+ - Are there designs not yet linked in the ticket?
102
+ - Are there interaction details not covered in Figma (animations, transitions, gestures)?
103
+ - Are there responsive/device-size considerations?
104
+
105
+ **Data & API**
106
+ - What API endpoints are involved? Already built or pending BE work?
107
+ - What are the request/response shapes (if not in a linked BE ticket)?
108
+ - Are there any data transformation or mapping requirements?
109
+
110
+ **Security & Access Control**
111
+ - Does this introduce or change any auth/authorization boundary (new role, permission
112
+ level, or who can access what)?
113
+ - Does this touch PII or other data listed in `CLAUDE.md`'s Sensitive Areas section?
114
+ - Are there rate-limiting or abuse-prevention needs (new public-facing endpoint, form
115
+ submission, or search)?
116
+
117
+ **Navigation** *(skip for BE-only tickets)*
118
+ - What screen/page does this flow from and to?
119
+ - Are there deep link, back-navigation, or tab state requirements? (mobile)
120
+ - Are there routing, redirect, or URL parameter requirements? (web)
121
+
122
+ **Testing**
123
+ - What level of testing is expected: unit only, unit + integration, or E2E?
124
+
125
+ **Constraints**
126
+ - Performance expectations (list size, pagination, image loading)?
127
+ - Backwards compatibility with existing navigation state or persisted data?
128
+
129
+ ---
130
+
131
+ ### Step 3 — Write the design doc
132
+
133
+ Using all gathered context, write the full design document.
134
+
135
+ **File location:** `design_docs/<TICKET_ID>-<kebab-case-title>.md`
136
+
137
+ If `design_docs/` does not exist, create it.
138
+
139
+ ---
140
+
141
+ #### Standard template (single ticket)
142
+
143
+ ```markdown
144
+ # Feature Design: [TICKET_ID] — [Feature Title]
145
+
146
+ ## Summary
147
+ [1–3 sentences: what this ticket implements and why it matters to the user.]
148
+
149
+ ---
150
+
151
+ ## 1. Goal
152
+ [2–5 sentences focused on the user/product "why", not the technical "how".]
153
+
154
+ ---
155
+
156
+ ## 2. Functional Requirements
157
+ - **FR1:** [Observable, testable behaviour — what the user can do or see]
158
+ - **FR2:**
159
+ ...
160
+
161
+ ---
162
+
163
+ ## 3. Non-Functional Requirements
164
+ - **NFR1:** [Performance, accessibility, error handling, offline behaviour, security/access control, etc.]
165
+ ...
166
+
167
+ ---
168
+
169
+ ## 4. Out of Scope
170
+ - [What this ticket explicitly does NOT include]
171
+ ...
172
+
173
+ ---
174
+
175
+ ## 5. Context & Background
176
+
177
+ | Field | Details |
178
+ |---|---|
179
+ | Ticket(s) | |
180
+ | Linked tickets | |
181
+ | Related screens / modules | |
182
+ | Design files | |
183
+ | API / BE dependencies | |
184
+
185
+ ---
186
+
187
+ ## 6. Design & Flow
188
+
189
+ ### User Flow
190
+ [Step-by-step: what the user sees and does, from entry point to exit]
191
+
192
+ ### Screen / Component Map
193
+ | Screen / Component | File path | New or existing | Notes |
194
+ |---|---|---|---|
195
+
196
+ ### Data Model
197
+ | Field | Type | Source (API / local state / form) | Notes |
198
+ |---|---|---|---|
199
+
200
+ ### API Calls
201
+ | Endpoint | Method | When called | Notes |
202
+ |---|---|---|---|
203
+
204
+ ---
205
+
206
+ ## 7. Implementation Steps
207
+
208
+ ### Step 1 — [What] — `path/to/file.tsx`
209
+ [What to add/change and why. Reference specific component/function names from the Explore results.]
210
+ [Note which CLAUDE.md conventions apply — naming, tokens, reuse, etc.]
211
+
212
+ ### Step 2 — [What] — `path/to/file.ts`
213
+ ...
214
+
215
+ ---
216
+
217
+ ## 8. Open Questions
218
+ - **Q1:**
219
+ ...
220
+
221
+ ---
222
+
223
+ ## 9. Acceptance Criteria
224
+ - [ ] ...
225
+ - [ ] ...
226
+ ```
227
+
228
+ ---
229
+
230
+ #### Extended template (multiple tickets)
231
+
232
+ Use this when the design spans 2 or more tickets.
233
+
234
+ ```markdown
235
+ # Feature Design: [UMBRELLA_ID] — [Feature Title]
236
+
237
+ ## Summary
238
+ [1–3 sentences covering all tickets and their shared user-facing goal.]
239
+
240
+ ---
241
+
242
+ ## 0. Ticket Inventory
243
+
244
+ | Ticket | Title | Type | Depends on |
245
+ |---|---|---|---|
246
+ | PROJ-XXX | ... | FE / BE / Design | — |
247
+ | PROJ-YYY | ... | FE | PROJ-XXX |
248
+
249
+ ### Implementation Order
250
+ - **Phase 1 (parallel):** PROJ-XXX, PROJ-YYY — [why they can run in parallel]
251
+ - **Phase 2:** PROJ-ZZZ — depends on Phase 1
252
+
253
+ ---
254
+
255
+ ## 1. Goal
256
+ ...
257
+
258
+ ## 2. Functional Requirements
259
+
260
+ ### PROJ-XXX — [Short title]
261
+ - **FR1:** ...
262
+
263
+ ### PROJ-YYY — [Short title]
264
+ - **FR2:** ...
265
+
266
+ ## 3–5. [Same as standard template]
267
+
268
+ ## 6. Design & Flow
269
+ [Unified flow showing where each ticket's changes fit]
270
+
271
+ ## 7. Implementation Steps
272
+
273
+ ### PROJ-XXX — [Short title]
274
+ #### Step 1 — `path/to/file.tsx`
275
+ ...
276
+
277
+ ### PROJ-YYY — [Short title]
278
+ #### Step 1 — `path/to/file.tsx`
279
+ ...
280
+
281
+ ## 8. Open Questions
282
+ - **Q1 [PROJ-XXX]:** ...
283
+ - **Q2 [PROJ-YYY]:** ...
284
+
285
+ ## 9. Acceptance Criteria
286
+
287
+ ### PROJ-XXX
288
+ - [ ] ...
289
+
290
+ ### PROJ-YYY
291
+ - [ ] ...
292
+ ```
293
+
294
+ ---
295
+
296
+ ### Step 4 — Ask about open questions
297
+
298
+ After writing the doc, ask the user:
299
+ 1. Are any items in Section 8 blocking — need to be resolved before implementation starts?
300
+ 2. Do the Acceptance Criteria in Section 9 look complete?
301
+
302
+ ---
303
+
304
+ ## Inconsistency signals — always stop and ask
305
+
306
+ | Signal | What to ask |
307
+ |---|---|
308
+ | Figma URL is inaccessible or MCP returns an error | "Figma MCP could not access this file — share screenshots or describe the design to continue." |
309
+ | Linked ticket not found or returns an error | "Could not fetch [TICKET-ID] — skip it, or paste the relevant details?" |
310
+ | Ticket has no acceptance criteria | "No AC found in the ticket — describe expected behaviour, or should I infer from the description?" |
311
+ | Codebase search returns no results for the feature area | "No existing code found for this feature — confirm it's net-new, or is it under a different name?" |
312
+ | Multiple tickets with unclear dependency order | "Ticket dependency order is ambiguous — which should be implemented first?" |