@chief-clancy/terminal 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 (217) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +62 -0
  3. package/dist/hooks/clancy-branch-guard.js +1 -0
  4. package/dist/hooks/clancy-check-update.js +2 -0
  5. package/dist/hooks/clancy-context-monitor.js +9 -0
  6. package/dist/hooks/clancy-credential-guard.js +2 -0
  7. package/dist/hooks/clancy-drift-detector.js +1 -0
  8. package/dist/hooks/clancy-notification.js +1 -0
  9. package/dist/hooks/clancy-post-compact.js +2 -0
  10. package/dist/hooks/clancy-statusline.js +1 -0
  11. package/dist/index.d.ts +24 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +23 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/installer/file-ops/file-ops.d.ts +35 -0
  16. package/dist/installer/file-ops/file-ops.d.ts.map +1 -0
  17. package/dist/installer/file-ops/file-ops.js +95 -0
  18. package/dist/installer/file-ops/file-ops.js.map +1 -0
  19. package/dist/installer/file-ops/index.d.ts +2 -0
  20. package/dist/installer/file-ops/index.d.ts.map +1 -0
  21. package/dist/installer/file-ops/index.js +2 -0
  22. package/dist/installer/file-ops/index.js.map +1 -0
  23. package/dist/installer/hook-installer/hook-installer.d.ts +22 -0
  24. package/dist/installer/hook-installer/hook-installer.d.ts.map +1 -0
  25. package/dist/installer/hook-installer/hook-installer.js +213 -0
  26. package/dist/installer/hook-installer/hook-installer.js.map +1 -0
  27. package/dist/installer/hook-installer/index.d.ts +2 -0
  28. package/dist/installer/hook-installer/index.d.ts.map +1 -0
  29. package/dist/installer/hook-installer/index.js +2 -0
  30. package/dist/installer/hook-installer/index.js.map +1 -0
  31. package/dist/installer/install/index.d.ts +3 -0
  32. package/dist/installer/install/index.d.ts.map +1 -0
  33. package/dist/installer/install/index.js +2 -0
  34. package/dist/installer/install/index.js.map +1 -0
  35. package/dist/installer/install/install.d.ts +124 -0
  36. package/dist/installer/install/install.d.ts.map +1 -0
  37. package/dist/installer/install/install.js +255 -0
  38. package/dist/installer/install/install.js.map +1 -0
  39. package/dist/installer/manifest/index.d.ts +2 -0
  40. package/dist/installer/manifest/index.d.ts.map +1 -0
  41. package/dist/installer/manifest/index.js +2 -0
  42. package/dist/installer/manifest/index.js.map +1 -0
  43. package/dist/installer/manifest/manifest.d.ts +46 -0
  44. package/dist/installer/manifest/manifest.d.ts.map +1 -0
  45. package/dist/installer/manifest/manifest.js +180 -0
  46. package/dist/installer/manifest/manifest.js.map +1 -0
  47. package/dist/installer/prompts/index.d.ts +2 -0
  48. package/dist/installer/prompts/index.d.ts.map +1 -0
  49. package/dist/installer/prompts/index.js +2 -0
  50. package/dist/installer/prompts/index.js.map +1 -0
  51. package/dist/installer/prompts/prompts.d.ts +34 -0
  52. package/dist/installer/prompts/prompts.d.ts.map +1 -0
  53. package/dist/installer/prompts/prompts.js +28 -0
  54. package/dist/installer/prompts/prompts.js.map +1 -0
  55. package/dist/installer/role-filter/index.d.ts +2 -0
  56. package/dist/installer/role-filter/index.d.ts.map +1 -0
  57. package/dist/installer/role-filter/index.js +2 -0
  58. package/dist/installer/role-filter/index.js.map +1 -0
  59. package/dist/installer/role-filter/role-filter.d.ts +33 -0
  60. package/dist/installer/role-filter/role-filter.d.ts.map +1 -0
  61. package/dist/installer/role-filter/role-filter.js +91 -0
  62. package/dist/installer/role-filter/role-filter.js.map +1 -0
  63. package/dist/installer/shared/fs-errors/fs-errors.d.ts +3 -0
  64. package/dist/installer/shared/fs-errors/fs-errors.d.ts.map +1 -0
  65. package/dist/installer/shared/fs-errors/fs-errors.js +7 -0
  66. package/dist/installer/shared/fs-errors/fs-errors.js.map +1 -0
  67. package/dist/installer/shared/fs-errors/index.d.ts +2 -0
  68. package/dist/installer/shared/fs-errors/index.d.ts.map +1 -0
  69. package/dist/installer/shared/fs-errors/index.js +2 -0
  70. package/dist/installer/shared/fs-errors/index.js.map +1 -0
  71. package/dist/installer/shared/fs-guards/fs-guards.d.ts +3 -0
  72. package/dist/installer/shared/fs-guards/fs-guards.d.ts.map +1 -0
  73. package/dist/installer/shared/fs-guards/fs-guards.js +18 -0
  74. package/dist/installer/shared/fs-guards/fs-guards.js.map +1 -0
  75. package/dist/installer/shared/fs-guards/index.d.ts +2 -0
  76. package/dist/installer/shared/fs-guards/index.d.ts.map +1 -0
  77. package/dist/installer/shared/fs-guards/index.js +2 -0
  78. package/dist/installer/shared/fs-guards/index.js.map +1 -0
  79. package/dist/installer/shared/type-guards/index.d.ts +2 -0
  80. package/dist/installer/shared/type-guards/index.d.ts.map +1 -0
  81. package/dist/installer/shared/type-guards/index.js +2 -0
  82. package/dist/installer/shared/type-guards/index.js.map +1 -0
  83. package/dist/installer/shared/type-guards/type-guards.d.ts +8 -0
  84. package/dist/installer/shared/type-guards/type-guards.d.ts.map +1 -0
  85. package/dist/installer/shared/type-guards/type-guards.js +10 -0
  86. package/dist/installer/shared/type-guards/type-guards.js.map +1 -0
  87. package/dist/installer/ui/index.d.ts +2 -0
  88. package/dist/installer/ui/index.d.ts.map +1 -0
  89. package/dist/installer/ui/index.js +2 -0
  90. package/dist/installer/ui/index.js.map +1 -0
  91. package/dist/installer/ui/ui.d.ts +23 -0
  92. package/dist/installer/ui/ui.d.ts.map +1 -0
  93. package/dist/installer/ui/ui.js +121 -0
  94. package/dist/installer/ui/ui.js.map +1 -0
  95. package/dist/runner/autopilot/autopilot.d.ts +71 -0
  96. package/dist/runner/autopilot/autopilot.d.ts.map +1 -0
  97. package/dist/runner/autopilot/autopilot.js +206 -0
  98. package/dist/runner/autopilot/autopilot.js.map +1 -0
  99. package/dist/runner/autopilot/index.d.ts +2 -0
  100. package/dist/runner/autopilot/index.d.ts.map +1 -0
  101. package/dist/runner/autopilot/index.js +2 -0
  102. package/dist/runner/autopilot/index.js.map +1 -0
  103. package/dist/runner/cli-bridge/cli-bridge.d.ts +34 -0
  104. package/dist/runner/cli-bridge/cli-bridge.d.ts.map +1 -0
  105. package/dist/runner/cli-bridge/cli-bridge.js +53 -0
  106. package/dist/runner/cli-bridge/cli-bridge.js.map +1 -0
  107. package/dist/runner/cli-bridge/index.d.ts +2 -0
  108. package/dist/runner/cli-bridge/index.d.ts.map +1 -0
  109. package/dist/runner/cli-bridge/index.js +2 -0
  110. package/dist/runner/cli-bridge/index.js.map +1 -0
  111. package/dist/runner/dep-factory/deliver-phase.d.ts +24 -0
  112. package/dist/runner/dep-factory/deliver-phase.d.ts.map +1 -0
  113. package/dist/runner/dep-factory/deliver-phase.js +57 -0
  114. package/dist/runner/dep-factory/deliver-phase.js.map +1 -0
  115. package/dist/runner/dep-factory/dep-factory.d.ts +38 -0
  116. package/dist/runner/dep-factory/dep-factory.d.ts.map +1 -0
  117. package/dist/runner/dep-factory/dep-factory.js +193 -0
  118. package/dist/runner/dep-factory/dep-factory.js.map +1 -0
  119. package/dist/runner/dep-factory/index.d.ts +2 -0
  120. package/dist/runner/dep-factory/index.d.ts.map +1 -0
  121. package/dist/runner/dep-factory/index.js +2 -0
  122. package/dist/runner/dep-factory/index.js.map +1 -0
  123. package/dist/runner/dep-factory/invoke-phase.d.ts +20 -0
  124. package/dist/runner/dep-factory/invoke-phase.d.ts.map +1 -0
  125. package/dist/runner/dep-factory/invoke-phase.js +45 -0
  126. package/dist/runner/dep-factory/invoke-phase.js.map +1 -0
  127. package/dist/runner/implement/implement.d.ts +38 -0
  128. package/dist/runner/implement/implement.d.ts.map +1 -0
  129. package/dist/runner/implement/implement.js +61 -0
  130. package/dist/runner/implement/implement.js.map +1 -0
  131. package/dist/runner/implement/index.d.ts +2 -0
  132. package/dist/runner/implement/index.d.ts.map +1 -0
  133. package/dist/runner/implement/index.js +2 -0
  134. package/dist/runner/implement/index.js.map +1 -0
  135. package/dist/runner/notify/index.d.ts +2 -0
  136. package/dist/runner/notify/index.d.ts.map +1 -0
  137. package/dist/runner/notify/index.js +2 -0
  138. package/dist/runner/notify/index.js.map +1 -0
  139. package/dist/runner/notify/notify.d.ts +49 -0
  140. package/dist/runner/notify/notify.d.ts.map +1 -0
  141. package/dist/runner/notify/notify.js +90 -0
  142. package/dist/runner/notify/notify.js.map +1 -0
  143. package/dist/runner/prompt-builder/index.d.ts +2 -0
  144. package/dist/runner/prompt-builder/index.d.ts.map +1 -0
  145. package/dist/runner/prompt-builder/index.js +2 -0
  146. package/dist/runner/prompt-builder/index.js.map +1 -0
  147. package/dist/runner/prompt-builder/prompt-builder.d.ts +53 -0
  148. package/dist/runner/prompt-builder/prompt-builder.d.ts.map +1 -0
  149. package/dist/runner/prompt-builder/prompt-builder.js +122 -0
  150. package/dist/runner/prompt-builder/prompt-builder.js.map +1 -0
  151. package/dist/runner/session-report/index.d.ts +2 -0
  152. package/dist/runner/session-report/index.d.ts.map +1 -0
  153. package/dist/runner/session-report/index.js +2 -0
  154. package/dist/runner/session-report/index.js.map +1 -0
  155. package/dist/runner/session-report/session-report.d.ts +81 -0
  156. package/dist/runner/session-report/session-report.d.ts.map +1 -0
  157. package/dist/runner/session-report/session-report.js +227 -0
  158. package/dist/runner/session-report/session-report.js.map +1 -0
  159. package/dist/runner/shared/types.d.ts +30 -0
  160. package/dist/runner/shared/types.d.ts.map +1 -0
  161. package/dist/runner/shared/types.js +2 -0
  162. package/dist/runner/shared/types.js.map +1 -0
  163. package/dist/shared/ansi/ansi.d.ts +59 -0
  164. package/dist/shared/ansi/ansi.d.ts.map +1 -0
  165. package/dist/shared/ansi/ansi.js +59 -0
  166. package/dist/shared/ansi/ansi.js.map +1 -0
  167. package/dist/shared/ansi/index.d.ts +2 -0
  168. package/dist/shared/ansi/index.d.ts.map +1 -0
  169. package/dist/shared/ansi/index.js +2 -0
  170. package/dist/shared/ansi/index.js.map +1 -0
  171. package/package.json +52 -0
  172. package/src/agents/agents.test.ts +57 -0
  173. package/src/agents/arch-agent.md +80 -0
  174. package/src/agents/concerns-agent.md +96 -0
  175. package/src/agents/design-agent.md +146 -0
  176. package/src/agents/devils-advocate.md +54 -0
  177. package/src/agents/quality-agent.md +178 -0
  178. package/src/agents/tech-agent.md +101 -0
  179. package/src/agents/verification-gate.md +128 -0
  180. package/src/roles/implementer/commands/autopilot.md +11 -0
  181. package/src/roles/implementer/commands/dry-run.md +15 -0
  182. package/src/roles/implementer/commands/implement.md +19 -0
  183. package/src/roles/implementer/workflows/autopilot.md +136 -0
  184. package/src/roles/implementer/workflows/implement.md +161 -0
  185. package/src/roles/planner/commands/approve-plan.md +11 -0
  186. package/src/roles/planner/commands/plan.md +22 -0
  187. package/src/roles/planner/workflows/approve-plan.md +970 -0
  188. package/src/roles/planner/workflows/plan.md +868 -0
  189. package/src/roles/reviewer/commands/logs.md +7 -0
  190. package/src/roles/reviewer/commands/review.md +9 -0
  191. package/src/roles/reviewer/commands/status.md +9 -0
  192. package/src/roles/reviewer/workflows/logs.md +109 -0
  193. package/src/roles/reviewer/workflows/review.md +197 -0
  194. package/src/roles/reviewer/workflows/status.md +142 -0
  195. package/src/roles/roles.test.ts +87 -0
  196. package/src/roles/setup/commands/doctor.md +7 -0
  197. package/src/roles/setup/commands/help.md +80 -0
  198. package/src/roles/setup/commands/init.md +7 -0
  199. package/src/roles/setup/commands/map-codebase.md +17 -0
  200. package/src/roles/setup/commands/settings.md +7 -0
  201. package/src/roles/setup/commands/uninstall.md +5 -0
  202. package/src/roles/setup/commands/update-docs.md +9 -0
  203. package/src/roles/setup/commands/update.md +13 -0
  204. package/src/roles/setup/workflows/doctor.md +131 -0
  205. package/src/roles/setup/workflows/init.md +1096 -0
  206. package/src/roles/setup/workflows/map-codebase.md +130 -0
  207. package/src/roles/setup/workflows/scaffold.md +872 -0
  208. package/src/roles/setup/workflows/settings.md +958 -0
  209. package/src/roles/setup/workflows/uninstall.md +170 -0
  210. package/src/roles/setup/workflows/update-docs.md +95 -0
  211. package/src/roles/setup/workflows/update.md +287 -0
  212. package/src/roles/strategist/commands/approve-brief.md +23 -0
  213. package/src/roles/strategist/commands/brief.md +29 -0
  214. package/src/roles/strategist/workflows/approve-brief.md +1540 -0
  215. package/src/roles/strategist/workflows/brief.md +1330 -0
  216. package/src/templates/CLAUDE.md +101 -0
  217. package/src/templates/templates.test.ts +53 -0
@@ -0,0 +1,1096 @@
1
+ # Clancy Init Workflow
2
+
3
+ ## Overview
4
+
5
+ Full wizard for setting up Clancy in a project. Follow every step exactly. Do not skip steps or reorder them.
6
+
7
+ ### Input handling
8
+
9
+ This workflow runs inside a Claude Code session, not a vanilla terminal. Accept natural language responses alongside numbered options and y/N prompts:
10
+
11
+ - Affirmative: "y", "yes", "sure", "go ahead", "yep" → treat as yes
12
+ - Negative: "n", "no", "nah", "skip", "not now" → treat as no
13
+ - Board selection: "jira", "github", "linear" → treat as selecting that board
14
+ - Direct values: if the user types a status name like "Selected for Development" instead of picking option [2], accept it directly
15
+ - If a response is ambiguous, ask for clarification
16
+
17
+ ---
18
+
19
+ ## Step 1 — Detect project state
20
+
21
+ Before asking any questions, silently check:
22
+
23
+ - Is this an existing project? Check for `package.json`, `.git`, `src/`, `app/`, `lib/`
24
+ - Is a board already configured? Check `.clancy/.env` for `JIRA_BASE_URL`, `GITHUB_TOKEN`, `LINEAR_API_KEY`
25
+ - Does `CLAUDE.md` already exist? Flag for merge — never overwrite
26
+ - Does `.clancy/.env` already exist? This means init has been completed before — warn and offer re-init or abort. Note: `.clancy/` alone may exist from the installer (runtime scripts) without init having run.
27
+
28
+ If `.clancy/.env` exists, output:
29
+
30
+ It looks like Clancy is already set up in this project.
31
+
32
+ [1] Re-run init (update config, re-scaffold)
33
+ [2] Abort (keep existing setup)
34
+
35
+ ---
36
+
37
+ ## Step 1b — Prerequisite check
38
+
39
+ Before proceeding, silently run `command -v` for each required binary:
40
+
41
+ | Binary | Install hint |
42
+ | -------- | ------------------------------------------ |
43
+ | `node` | Install Node.js 24+ (nodejs.org) |
44
+ | `git` | `brew install git` / `apt install git` |
45
+ | `claude` | `npm install -g @anthropic-ai/claude-code` |
46
+
47
+ If all are present: continue silently.
48
+
49
+ If any are missing, output:
50
+
51
+ ```
52
+ ⚠️ Missing prerequisites:
53
+
54
+ ❌ node — Install Node.js 24+ (nodejs.org)
55
+
56
+ Clancy requires these binaries to run. Install them, then re-run /clancy:init.
57
+ ```
58
+
59
+ List only the missing ones. Then stop — do not proceed with setup until prerequisites are satisfied.
60
+
61
+ ---
62
+
63
+ ## Step 2 — Welcome message
64
+
65
+ Output:
66
+
67
+ ```
68
+ 🚨 Clancy — Init
69
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
70
+
71
+ "Chief Wiggum reporting for duty."
72
+
73
+ Clancy pulls tickets from your Kanban board, plans and implements them, commits, and creates PRs — one ticket per run, fresh context every time.
74
+
75
+ Let's get you set up. This takes about 3 minutes (4 steps, then optional extras).
76
+ ```
77
+
78
+ ---
79
+
80
+ ## Step 3 — Questions (board-dependent)
81
+
82
+ ### Q1: Board selection
83
+
84
+ Output:
85
+
86
+ Which Kanban board are you using?
87
+
88
+ [1] Jira
89
+ [2] GitHub Issues
90
+ [3] Linear
91
+ [4] Shortcut
92
+ [5] Notion
93
+ [6] Azure DevOps
94
+ [7] My board isn't listed
95
+
96
+ Auto-detection hint: silently check `.clancy/.env` for existing board env vars (`JIRA_BASE_URL`, `GITHUB_TOKEN`, `LINEAR_API_KEY`, `SHORTCUT_API_TOKEN`, `NOTION_DATABASE_ID`, `AZDO_ORG`). If detected, show: `Detected: {board} from your env vars. Use this? [Y/n]` — if yes, skip to Q2 for that board.
97
+
98
+ If the user selects [7], output the dead-end message and stop:
99
+
100
+ Clancy currently supports Jira, GitHub Issues, Linear, Shortcut, Notion, and Azure DevOps out of the box.
101
+
102
+ Your board isn't supported yet — but you can add it:
103
+ · Open an issue: github.com/Pushedskydiver/chief-clancy/issues
104
+ · Contribute one: see CONTRIBUTING.md — adding a board is a TypeScript module + a boards.json entry
105
+
106
+ In the meantime, you can still use Clancy manually:
107
+ · Run /clancy:map-codebase to scan and document your codebase
108
+ · Run `npx -y chief-clancy@latest` and implement your board's API module
109
+ · Store credentials in .clancy/.env
110
+
111
+ Do not scaffold anything after this message. Stop completely.
112
+
113
+ ---
114
+
115
+ **Shortcut** — ask in this order:
116
+
117
+ 1. `Paste your Shortcut API token: (create one at app.shortcut.com/settings/account/api-tokens)`
118
+ 2. `What workflow should Clancy use? (press Enter to auto-detect)` — if blank, auto-detect the first workflow via `GET /api/v3/workflows`
119
+
120
+ Store as `SHORTCUT_API_TOKEN` and optionally `SHORTCUT_WORKFLOW` in `.clancy/.env`.
121
+
122
+ **Notion** — ask in this order:
123
+
124
+ 1. `Paste your Notion integration token: (create one at notion.so/my-integrations)`
125
+ 2. `What's your Notion database ID? (the 32-character hex string in your database URL)`
126
+ 3. `What property name represents the ticket status? [Status]`
127
+ 4. `What property name represents the assignee? [Assignee]`
128
+
129
+ Store as `NOTION_TOKEN`, `NOTION_DATABASE_ID`, and optionally `CLANCY_NOTION_STATUS` and `CLANCY_NOTION_ASSIGNEE` in `.clancy/.env`.
130
+
131
+ **Azure DevOps** — ask in this order:
132
+
133
+ 1. `What's your Azure DevOps organisation name? (e.g. your-org)`
134
+ 2. `What's your Azure DevOps project name?`
135
+ 3. `Paste your Azure DevOps personal access token: (needs Work Items Read & Write scope)`
136
+
137
+ Store as `AZDO_ORG`, `AZDO_PROJECT`, and `AZDO_PAT` in `.clancy/.env`.
138
+
139
+ ---
140
+
141
+ ### Q2: Board-specific config
142
+
143
+ Ask each question individually and wait for an answer before moving to the next.
144
+
145
+ **Jira** — ask in this order:
146
+
147
+ 1. `What's your Jira base URL? (e.g. https://your-org.atlassian.net)`
148
+ 2. `What's your Jira project key? (e.g. PROJ)`
149
+ 3. `What email address do you use to log in to Atlassian?`
150
+ 4. `Paste your Jira API token: (create one at id.atlassian.com/manage-profile/security/api-tokens)`
151
+
152
+ **GitHub Issues** — ask in this order:
153
+
154
+ 1. `What's your GitHub repo? (owner/name, e.g. acme/my-app)`
155
+ 2. `Paste your GitHub personal access token: (needs repo scope)`
156
+
157
+ After collecting GitHub credentials, show:
158
+
159
+ ```
160
+ Important: Clancy only picks up GitHub Issues that have the "clancy" label applied.
161
+ Add this label to any issue you want Clancy to work on.
162
+ ```
163
+
164
+ **Linear** — ask in this order:
165
+
166
+ 1. `Paste your Linear API key: (create one at linear.app/settings/api)`
167
+ 2. After verifying the API key (Step Q2b), auto-detect teams by querying `{ teams { nodes { id name } } }`.
168
+ - If exactly 1 team: use it automatically. Show `Using team: {name} ({id})`.
169
+ - If 2+ teams: show a numbered list and let the user pick.
170
+ - If the query fails or returns no teams: fall back to asking manually: `What's your Linear team ID? (find it at linear.app/settings/teams — click your team, copy the ID from the URL)`
171
+ 3. `What label should Clancy filter by? Create a "clancy" label in your Linear team and apply it to issues you want Clancy to implement. [clancy]`
172
+
173
+ If a label is entered: store as `CLANCY_LABEL_BUILD` in `.clancy/.env`. Always wrap the value in double quotes (e.g. `CLANCY_LABEL_BUILD="clancy"`).
174
+ If enter is pressed with no value: skip — omit the label clause entirely (Clancy will pick up all unstarted assigned issues).
175
+
176
+ ---
177
+
178
+ ### Q2b: Board credential verification
179
+
180
+ After collecting all credentials for the chosen board, verify the connection before continuing.
181
+
182
+ **Jira** — call `GET {JIRA_BASE_URL}/rest/api/3/project/{JIRA_PROJECT_KEY}` with basic auth (`{JIRA_USER}:{JIRA_API_TOKEN}` base64-encoded in the `Authorization: Basic` header).
183
+
184
+ On success (HTTP 200), show:
185
+
186
+ ```
187
+ ✅ Jira connected — project {JIRA_PROJECT_KEY} reachable.
188
+ ```
189
+
190
+ On failure, show:
191
+
192
+ ```
193
+ ❌ Couldn't connect to Jira (HTTP {status}).
194
+ Check your credentials in the values you just entered.
195
+
196
+ [1] Re-enter credentials
197
+ [2] Skip verification (configure later via /clancy:settings)
198
+ ```
199
+
200
+ If [1]: go back to Q2 and re-ask all Jira questions.
201
+ If [2]: save the unverified credentials and continue with setup. The user can fix them later.
202
+
203
+ **GitHub Issues** — call `GET https://api.github.com/repos/{GITHUB_REPO}` with `Authorization: Bearer {GITHUB_TOKEN}` and `X-GitHub-Api-Version: 2022-11-28`.
204
+
205
+ On success (HTTP 200), show:
206
+
207
+ ```
208
+ ✅ GitHub connected — {GITHUB_REPO} reachable.
209
+ ```
210
+
211
+ On failure, show:
212
+
213
+ ```
214
+ ❌ Couldn't connect to GitHub (HTTP {status}).
215
+ Check your token has `repo` scope and the repo name is correct.
216
+
217
+ [1] Re-enter credentials
218
+ [2] Skip verification (configure later via /clancy:settings)
219
+ ```
220
+
221
+ If [1]: go back to Q2 and re-ask all GitHub questions.
222
+ If [2]: save the unverified credentials and continue with setup.
223
+
224
+ **Linear** — call `POST https://api.linear.app/graphql` with `Authorization: {LINEAR_API_KEY}` (no Bearer prefix) and body `{"query": "{ viewer { id name } }"}`.
225
+
226
+ On success (HTTP 200 with `data.viewer`), show:
227
+
228
+ ```
229
+ ✅ Linear connected — {viewer.name}.
230
+ ```
231
+
232
+ On failure, show:
233
+
234
+ ```
235
+ ❌ Couldn't connect to Linear.
236
+ Check your API key at linear.app/settings/api.
237
+
238
+ [1] Re-enter credentials
239
+ [2] Skip verification (configure later via /clancy:settings)
240
+ ```
241
+
242
+ If [1]: go back to Q2 and re-ask all Linear questions.
243
+ If [2]: save the unverified credentials and continue with setup.
244
+
245
+ Never silently continue with unverified credentials — the user must explicitly choose to re-enter, skip, or exit.
246
+
247
+ ---
248
+
249
+ ### Q2c (Jira and Linear only): Git host token
250
+
251
+ When the board is **Jira** or **Linear**, Clancy needs a git host token to create pull requests after implementation. Skip this step entirely for **GitHub Issues** — the `GITHUB_TOKEN` collected in Q2 already covers PR creation.
252
+
253
+ Output:
254
+
255
+ ```
256
+ Clancy can push your feature branch and create a pull request automatically.
257
+ Which git host does this project use?
258
+
259
+ [1] GitHub
260
+ [2] GitLab
261
+ [3] Bitbucket
262
+ [4] Skip — I'll push and create PRs manually
263
+ ```
264
+
265
+ **If [1] GitHub:**
266
+
267
+ `Paste your GitHub personal access token: (needs repo scope — create at github.com/settings/tokens)`
268
+
269
+ Store as `GITHUB_TOKEN` in `.clancy/.env`.
270
+
271
+ Verify by calling `GET https://api.github.com/user` with `Authorization: Bearer {token}` and `X-GitHub-Api-Version: 2022-11-28`.
272
+
273
+ On success: `✅ GitHub connected — {login}`
274
+ On failure: offer re-enter or skip (same pattern as Q2b).
275
+
276
+ **If [2] GitLab:**
277
+
278
+ `Paste your GitLab personal access token: (needs api scope — create at gitlab.com/-/user_settings/personal_access_tokens)`
279
+
280
+ Store as `GITLAB_TOKEN` in `.clancy/.env`.
281
+
282
+ If the user is using a self-hosted GitLab instance, also ask:
283
+ `What's your GitLab API base URL? (e.g. https://gitlab.example.com/api/v4 — press Enter for gitlab.com)`
284
+
285
+ If a URL is entered, store as `CLANCY_GIT_API_URL` in `.clancy/.env` and `CLANCY_GIT_PLATFORM="gitlab"`.
286
+ If the user enters just a hostname or instance URL without `/api/v4`, append `/api/v4` automatically.
287
+
288
+ **If [3] Bitbucket:**
289
+
290
+ 1. `What's your Bitbucket username? (your Atlassian account username)`
291
+ 2. `Paste your Bitbucket app password: (needs repository:write scope — create at bitbucket.org/account/settings/app-passwords)`
292
+
293
+ Store as `BITBUCKET_USER` and `BITBUCKET_TOKEN` in `.clancy/.env`.
294
+
295
+ **If [4] Skip:** no git host token is written. Clancy will still implement tickets but leave the feature branch for the user to push and create PRs manually.
296
+
297
+ ---
298
+
299
+ ### Q3 (Jira only): Status name
300
+
301
+ Output:
302
+
303
+ Which Jira status should Clancy pick tickets from?
304
+ Common values: To Do, Selected for Development, Ready, Open
305
+
306
+ [1] To Do (default)
307
+ [2] Enter a different value
308
+
309
+ Store as `CLANCY_JQL_STATUS` in `.clancy/.env`. Always wrap the value in double quotes — status names often contain spaces (e.g. `CLANCY_JQL_STATUS="Selected for Development"`).
310
+
311
+ ---
312
+
313
+ ### Q3b (Jira only): Sprints
314
+
315
+ Output: `Does your Jira project use sprints? (Requires Jira Software — not available on all plans) [y/N]:`
316
+
317
+ If yes: add `CLANCY_JQL_SPRINT=true` to `.clancy/.env`.
318
+ If no: omit the sprint clause from JQL entirely.
319
+
320
+ ---
321
+
322
+ ### Q3c (Jira only): Label filter
323
+
324
+ Output: `What label should Clancy filter by? Create a "clancy" label in your Jira project and apply it to tickets you want Clancy to implement. [clancy]`
325
+
326
+ If a label is entered: store as `CLANCY_LABEL_BUILD` in `.clancy/.env`. Always wrap the value in double quotes (e.g. `CLANCY_LABEL_BUILD="clancy"`).
327
+ If enter is pressed with no value: skip — omit the label clause entirely (Clancy will pick up all assigned tickets in the queue).
328
+
329
+ ---
330
+
331
+ ### Q3d (Jira and Linear only): Status transitions
332
+
333
+ Output:
334
+
335
+ **GitHub:** Skip this step entirely — GitHub Issues use `open`/`closed`, not status columns. Clancy closes issues automatically on completion.
336
+
337
+ **Jira:** Output:
338
+
339
+ ```
340
+ When Clancy picks up a ticket, it can transition it on your Jira board.
341
+ Jira uses transition action names (e.g. "In Progress", "Start Progress").
342
+ These usually match the column name, but check your Jira workflow if transitions fail.
343
+
344
+ What transition should Clancy use when it starts working on a ticket?
345
+
346
+ [1] In Progress (most common)
347
+ [2] Enter a different value
348
+ [3] Skip — don't transition on pickup (ticket stays in its current column)
349
+ ```
350
+
351
+ If [1]: store `CLANCY_STATUS_IN_PROGRESS="In Progress"` in `.clancy/.env`.
352
+ If [2]: prompt for the value, store as `CLANCY_STATUS_IN_PROGRESS` in `.clancy/.env`. Wrap in double quotes.
353
+ If [3] or the user says "skip"/"none": skip — no `CLANCY_STATUS_IN_PROGRESS` line written.
354
+
355
+ Then ask:
356
+
357
+ ```
358
+ What transition should Clancy use after implementation is complete?
359
+
360
+ [1] Done
361
+ [2] Ready for Review
362
+ [3] Enter a different value
363
+ [4] Skip — don't transition on completion (ticket stays in its current column)
364
+ ```
365
+
366
+ If [1]: store `CLANCY_STATUS_DONE="Done"` in `.clancy/.env`.
367
+ If [2]: store `CLANCY_STATUS_DONE="Ready for Review"` in `.clancy/.env`.
368
+ If [3]: prompt for the value, store as `CLANCY_STATUS_DONE` in `.clancy/.env`. Wrap in double quotes.
369
+ If [4] or the user says "skip"/"none": skip — no `CLANCY_STATUS_DONE` line written.
370
+
371
+ **Linear:** Output:
372
+
373
+ ```
374
+ When Clancy picks up a ticket, it can move it to a workflow state on your board.
375
+
376
+ What state should Clancy move a ticket to when it starts working on it?
377
+
378
+ [1] In Progress (most common)
379
+ [2] Enter a different value
380
+ [3] Skip — don't transition on pickup (ticket stays in its current state)
381
+ ```
382
+
383
+ If [1]: store `CLANCY_STATUS_IN_PROGRESS="In Progress"` in `.clancy/.env`.
384
+ If [2]: prompt for the value, store as `CLANCY_STATUS_IN_PROGRESS` in `.clancy/.env`. Wrap in double quotes.
385
+ If [3] or the user says "skip"/"none": skip — no `CLANCY_STATUS_IN_PROGRESS` line written.
386
+
387
+ Then ask:
388
+
389
+ ```
390
+ What state should Clancy move a ticket to after implementation is complete?
391
+
392
+ [1] Done
393
+ [2] Ready for Review
394
+ [3] Enter a different value
395
+ [4] Skip — don't transition on completion (ticket stays in its current state)
396
+ ```
397
+
398
+ If [1]: store `CLANCY_STATUS_DONE="Done"` in `.clancy/.env`.
399
+ If [2]: store `CLANCY_STATUS_DONE="Ready for Review"` in `.clancy/.env`.
400
+ If [3]: prompt for the value, store as `CLANCY_STATUS_DONE` in `.clancy/.env`. Wrap in double quotes.
401
+ If [4] or the user says "skip"/"none": skip — no `CLANCY_STATUS_DONE` line written.
402
+
403
+ You can always configure these later via `/clancy:settings`.
404
+
405
+ ---
406
+
407
+ ### Q3d-2 (Jira and Linear only): Review status
408
+
409
+ Only ask this if a git host token was configured in Q2c (i.e. the user didn't skip PR creation).
410
+
411
+ **GitHub:** Skip entirely — not applicable (GitHub Issues don't have workflow states).
412
+
413
+ **Jira:** Output:
414
+
415
+ ```
416
+ When Clancy creates a pull request, it can transition the ticket to a review status.
417
+
418
+ What transition should Clancy use after creating a PR?
419
+
420
+ [1] In Review
421
+ [2] Ready for Review
422
+ [3] Enter a different value
423
+ [4] Skip — use the same status as completion (CLANCY_STATUS_DONE)
424
+ ```
425
+
426
+ If [1]: store `CLANCY_STATUS_REVIEW="In Review"` in `.clancy/.env`.
427
+ If [2]: store `CLANCY_STATUS_REVIEW="Ready for Review"` in `.clancy/.env`.
428
+ If [3]: prompt for the value, store as `CLANCY_STATUS_REVIEW` in `.clancy/.env`. Wrap in double quotes.
429
+ If [4] or the user says "skip"/"none": skip — no `CLANCY_STATUS_REVIEW` line written (falls back to `CLANCY_STATUS_DONE`).
430
+
431
+ **Linear:** Output:
432
+
433
+ ```
434
+ When Clancy creates a pull request, it can move the issue to a review state.
435
+
436
+ What state should Clancy move an issue to after creating a PR?
437
+
438
+ [1] In Review
439
+ [2] Ready for Review
440
+ [3] Enter a different value
441
+ [4] Skip — use the same state as completion (CLANCY_STATUS_DONE)
442
+ ```
443
+
444
+ Same storage logic as Jira above.
445
+
446
+ ---
447
+
448
+ ### Q3e (all boards): Max rework cycles
449
+
450
+ PR-based rework detection is automatic — no configuration needed. This setting controls the safety limit.
451
+
452
+ Output:
453
+
454
+ ```
455
+ Max rework cycles before flagging for human intervention? [3]
456
+ ```
457
+
458
+ If a number is entered: store as `CLANCY_MAX_REWORK` in `.clancy/.env`.
459
+ If enter is pressed with no value: use default 3 — store `CLANCY_MAX_REWORK=3` in `.clancy/.env`.
460
+
461
+ ---
462
+
463
+ ### Q3f (all boards): TDD mode
464
+
465
+ Output:
466
+
467
+ ```
468
+ Enable Test-Driven Development? Clancy will follow red-green-refactor for every behaviour change. [y/N]
469
+ ```
470
+
471
+ If `y`: store `CLANCY_TDD=true` in `.clancy/.env`.
472
+ If `N` or enter: do not add `CLANCY_TDD` to `.clancy/.env`.
473
+
474
+ ---
475
+
476
+ ### Q3g (all boards): Grill mode
477
+
478
+ Only ask this if the Strategist role is enabled (via `CLANCY_ROLES`).
479
+
480
+ Output:
481
+
482
+ ```
483
+ How should /clancy:brief handle clarifying questions?
484
+
485
+ [1] Interactive (default) — asks you directly
486
+ [2] AFK — AI resolves questions autonomously (for automation pipelines)
487
+ ```
488
+
489
+ If [1] or enter: do not add `CLANCY_MODE` to `.clancy/.env` (uses default `interactive`).
490
+ If [2]: store `CLANCY_MODE=afk` in `.clancy/.env`.
491
+
492
+ ---
493
+
494
+ ### Q3h (all boards): Reliable autonomous mode
495
+
496
+ Output:
497
+
498
+ ```
499
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
500
+ Reliable Autonomous Mode
501
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
502
+
503
+ These settings control self-healing and safety limits for autonomous runs.
504
+ ```
505
+
506
+ **Fix retries:**
507
+
508
+ ```
509
+ Max self-healing attempts after a verification failure? [2]
510
+ (Range: 0–5. When lint/test/typecheck fails, Clancy retries up to this many times before delivering anyway.)
511
+ ```
512
+
513
+ If a number 0–5 is entered: store as `CLANCY_FIX_RETRIES` in `.clancy/.env`.
514
+ If enter is pressed with no value: use default 2 — store `CLANCY_FIX_RETRIES=2` in `.clancy/.env`.
515
+ If the value is outside 0–5: re-prompt.
516
+
517
+ **Time limit:**
518
+
519
+ ```
520
+ Per-ticket time limit in minutes? [30]
521
+ (0 to disable. Clancy will stop working on a ticket after this many minutes.)
522
+ ```
523
+
524
+ If a non-negative integer is entered: store as `CLANCY_TIME_LIMIT` in `.clancy/.env`.
525
+ If enter is pressed with no value: use default 30 — store `CLANCY_TIME_LIMIT=30` in `.clancy/.env`.
526
+ If the value is negative or not a number: re-prompt.
527
+
528
+ **Branch guard:**
529
+
530
+ ```
531
+ Enable branch guard hook? Prevents accidental commits to the base branch. [Y/n]
532
+ ```
533
+
534
+ If `y`, `Y`, or enter: store `CLANCY_BRANCH_GUARD=true` in `.clancy/.env`.
535
+ If `n` or `N`: store `CLANCY_BRANCH_GUARD=false` in `.clancy/.env`.
536
+
537
+ ---
538
+
539
+ ### Q3i (all boards): Quiet hours
540
+
541
+ Output:
542
+
543
+ ```
544
+ Pause AFK runs during specific hours? (e.g. business hours, overnight)
545
+
546
+ [1] Skip — no quiet hours
547
+ [2] Set quiet hours
548
+ ```
549
+
550
+ If [1] or enter: skip — no `CLANCY_QUIET_START` or `CLANCY_QUIET_END` written.
551
+ If [2]: ask:
552
+
553
+ ```
554
+ Quiet start time (HH:MM, 24h format, e.g. 22:00):
555
+ ```
556
+
557
+ Then:
558
+
559
+ ```
560
+ Quiet end time (HH:MM, 24h format, e.g. 06:00):
561
+ ```
562
+
563
+ Store as `CLANCY_QUIET_START` and `CLANCY_QUIET_END` in `.clancy/.env`.
564
+
565
+ ---
566
+
567
+ ### Q3j (all boards): Desktop notifications
568
+
569
+ Output:
570
+
571
+ ```
572
+ Send desktop notifications when tickets complete or errors occur? [Y/n]
573
+ ```
574
+
575
+ If yes or enter: store `CLANCY_DESKTOP_NOTIFY=true` in `.clancy/.env`.
576
+ If no: store `CLANCY_DESKTOP_NOTIFY=false` in `.clancy/.env`.
577
+
578
+ ---
579
+
580
+ ### Q4: Base branch (auto-detect)
581
+
582
+ Silently detect the base branch — do not ask unless detection fails:
583
+
584
+ 1. Run `git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null` and strip the `refs/remotes/origin/` prefix
585
+ 2. If that fails, check whether `main`, `master`, or `develop` exist as local branches (in that order)
586
+ 3. If still unresolved, default to `main`
587
+
588
+ Only if detection produces an unexpected result (e.g. something other than main/master/develop), confirm with the user:
589
+
590
+ Detected base branch: `{branch}` — is this correct? [Y/n]
591
+
592
+ Store the detected (or confirmed) value as `CLANCY_BASE_BRANCH` in `.clancy/.env`.
593
+
594
+ ---
595
+
596
+ ## Step 4 — Scaffold
597
+
598
+ Create `.clancy/` directory and the following:
599
+
600
+ 1. Verify `.clancy/clancy-implement.js` and `.clancy/clancy-autopilot.js` exist (copied by the installer). If missing, tell the user to run `npx -y chief-clancy@latest` and stop.
601
+ 2. Create `.clancy/docs/` with 10 empty template files (UPPERCASE.md with section headings only):
602
+ - STACK.md, INTEGRATIONS.md, ARCHITECTURE.md, CONVENTIONS.md, TESTING.md
603
+ - GIT.md, DESIGN-SYSTEM.md, ACCESSIBILITY.md, DEFINITION-OF-DONE.md, CONCERNS.md
604
+ 3. Write the correct `.env.example` for the chosen board to `.clancy/.env.example` — use the exact content from scaffold.md
605
+ 4. Write collected credentials to `.clancy/.env` (if the user provided them)
606
+ 5. Handle `CLAUDE.md` — follow the merge logic in scaffold.md exactly:
607
+ - If no CLAUDE.md: write the full template as `CLAUDE.md`
608
+ - If CLAUDE.md exists without `<!-- clancy:start -->`: append the Clancy section to the end
609
+ - If CLAUDE.md exists with `<!-- clancy:start -->`: replace only the content between the markers
610
+ - Never overwrite the entire file
611
+ 6. Check `.gitignore` — if `.clancy/.env` is not listed, append it
612
+
613
+ ---
614
+
615
+ ## Step 4b — Commit scaffold
616
+
617
+ After scaffolding, ask the user whether to commit the scaffolded files:
618
+
619
+ ```
620
+ Commit the Clancy scaffold to git? (recommended) [Y/n]
621
+ ```
622
+
623
+ If yes (or enter): commit everything created (excluding `.clancy/.env` which contains credentials):
624
+
625
+ ```bash
626
+ git add .clancy/.env.example .clancy/docs/ CLAUDE.md .gitignore
627
+ git commit -m "chore(clancy): initialise — scaffold docs templates and config"
628
+ ```
629
+
630
+ If `CLAUDE.md` was not modified (it already existed and was not changed), omit it from the `git add`. If `.gitignore` was not modified, omit it too. Only stage files that actually changed.
631
+
632
+ If no: skip the commit silently. The user can commit manually later.
633
+
634
+ ---
635
+
636
+ ## Step 4c — Optional roles
637
+
638
+ Clancy includes the Implementer, Reviewer, and Setup roles by default. Optional roles add extra capabilities.
639
+
640
+ ```
641
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
642
+ Optional Roles
643
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
644
+
645
+ Core roles (always installed): Implementer, Reviewer, Setup
646
+
647
+ Additional roles extend what Clancy can do:
648
+
649
+ [1] Planner
650
+ Refine vague tickets into structured implementation plans.
651
+ Commands: /clancy:plan, /clancy:approve-plan
652
+
653
+ [2] Strategist
654
+ Generate strategic briefs — research the codebase, grill
655
+ requirements, decompose into tickets with dependencies.
656
+ Commands: /clancy:brief, /clancy:approve-brief
657
+
658
+ Enable: 1, 2, all, or Enter to skip
659
+ ```
660
+
661
+ Accept numbers, role names (e.g. "planner", "strategist"), "all", or Enter to skip.
662
+
663
+ If any roles are selected:
664
+
665
+ - Store as `CLANCY_ROLES="planner,strategist"` (comma-separated if multiple) in `.clancy/.env`
666
+ - The selected roles' commands and workflows will be installed on the next `npx chief-clancy` run
667
+
668
+ If skipped (Enter): no `CLANCY_ROLES` line is written — only core roles are installed.
669
+
670
+ The installer reads `CLANCY_ROLES` from `.clancy/.env` to determine which optional role directories to copy. Core roles (implementer, reviewer, setup) are always copied regardless of this setting. After changing `CLANCY_ROLES`, re-run `npx chief-clancy@latest --local` (or `--global`) to apply.
671
+
672
+ Note: as more roles are added in future versions, they appear as additional numbered options here. The flow scales naturally.
673
+
674
+ ---
675
+
676
+ ## Step 4c-2 — Pipeline labels (conditional)
677
+
678
+ Only ask this if any optional role was enabled in Step 4c. If neither Planner nor Strategist was selected, skip this section entirely. If `CLANCY_LABEL` or `CLANCY_PLAN_LABEL` are already set in `.clancy/.env`, show:
679
+
680
+ ```
681
+ Note: CLANCY_LABEL and CLANCY_PLAN_LABEL are deprecated.
682
+ Use CLANCY_LABEL_BUILD and CLANCY_LABEL_PLAN instead.
683
+ Your existing values will continue to work as fallbacks.
684
+ ```
685
+
686
+ **If the user enabled Strategist (or both Strategist + Planner):**
687
+
688
+ Output:
689
+
690
+ ```
691
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
692
+ Pipeline Labels
693
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
694
+
695
+ Clancy uses labels to move tickets through pipeline stages:
696
+ brief → plan → build
697
+
698
+ Each label marks which queue a ticket belongs to.
699
+ ```
700
+
701
+ Then ask each label in order:
702
+
703
+ ```
704
+ What label marks tickets that have been briefed (awaiting approval)?
705
+ [clancy:brief]
706
+ ```
707
+
708
+ If a value is entered: store as `CLANCY_LABEL_BRIEF` in `.clancy/.env`. Wrap in double quotes.
709
+ If enter is pressed: use default — store `CLANCY_LABEL_BRIEF="clancy:brief"` in `.clancy/.env`.
710
+
711
+ ```
712
+ What label marks tickets that need planning?
713
+ [clancy:plan]
714
+ ```
715
+
716
+ If a value is entered: store as `CLANCY_LABEL_PLAN` in `.clancy/.env`. Wrap in double quotes.
717
+ If enter is pressed: use default — store `CLANCY_LABEL_PLAN="clancy:plan"` in `.clancy/.env`.
718
+
719
+ ```
720
+ What label marks tickets ready to build?
721
+ [clancy:build]
722
+ ```
723
+
724
+ If a value is entered: store as `CLANCY_LABEL_BUILD` in `.clancy/.env`. Wrap in double quotes.
725
+ If enter is pressed: use default — store `CLANCY_LABEL_BUILD="clancy:build"` in `.clancy/.env`.
726
+
727
+ **If the user enabled Planner only (no Strategist):**
728
+
729
+ Skip `CLANCY_LABEL_BRIEF` (no `/clancy:brief` command). Ask only:
730
+
731
+ ```
732
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
733
+ Pipeline Labels
734
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
735
+
736
+ Clancy uses labels to move tickets through pipeline stages:
737
+ plan → build
738
+ ```
739
+
740
+ Then ask `CLANCY_LABEL_PLAN` and `CLANCY_LABEL_BUILD` using the same prompts and defaults as above.
741
+
742
+ ---
743
+
744
+ ## Step 4d (if Planner role selected): Planning queue config
745
+
746
+ Only ask this if the user selected Planner in Step 4c above (or if re-running init and `CLANCY_ROLES` already includes `planner`).
747
+
748
+ If the planner role is not enabled, skip this step entirely.
749
+
750
+ **Jira:** Output:
751
+
752
+ ```
753
+ The Planner role picks tickets from a separate queue for planning.
754
+
755
+ Which Jira status should Clancy pick planning tickets from?
756
+
757
+ [1] Backlog (default)
758
+ [2] Enter a different value
759
+ ```
760
+
761
+ If [1]: store `CLANCY_PLAN_STATUS="Backlog"` in `.clancy/.env`.
762
+ If [2]: prompt for the value, store as `CLANCY_PLAN_STATUS` in `.clancy/.env`. Wrap in double quotes.
763
+
764
+ **GitHub:** Output:
765
+
766
+ ```
767
+ The Planner role picks issues from a separate queue for planning.
768
+
769
+ Which GitHub label should Clancy pick planning issues from?
770
+
771
+ [1] needs-refinement (default)
772
+ [2] Enter a different label name
773
+ ```
774
+
775
+ If [1]: store `CLANCY_LABEL_PLAN="needs-refinement"` in `.clancy/.env`.
776
+ If [2]: prompt for the value, store as `CLANCY_LABEL_PLAN` in `.clancy/.env`. Wrap in double quotes.
777
+
778
+ **Linear:** Output:
779
+
780
+ ```
781
+ The Planner role picks issues from a separate queue for planning.
782
+
783
+ Which Linear state type should Clancy pick planning issues from?
784
+
785
+ [1] backlog (default)
786
+ [2] triage
787
+ [3] Enter a different value
788
+ ```
789
+
790
+ If [1]: store `CLANCY_PLAN_STATE_TYPE="backlog"` in `.clancy/.env`.
791
+ If [2]: store `CLANCY_PLAN_STATE_TYPE="triage"` in `.clancy/.env`.
792
+ If [3]: prompt for the value, store as `CLANCY_PLAN_STATE_TYPE` in `.clancy/.env`. Valid values: backlog, unstarted, started, completed, canceled, triage.
793
+
794
+ ---
795
+
796
+ ## Step 4e (Jira only, if Planner role selected): Post-approval transition
797
+
798
+ Only ask this if the user selected Planner in Step 4c above (or if re-running init and `CLANCY_ROLES` already includes `planner`), **and** the board is Jira.
799
+
800
+ If the planner role is not enabled, or the board is not Jira, skip this step entirely.
801
+
802
+ Output:
803
+
804
+ ```
805
+ After approving a plan, Clancy can transition the ticket to your implementation queue.
806
+ What status should Clancy transition to?
807
+
808
+ [1] Enter a status name (e.g. To Do, Ready)
809
+ [2] Skip — I'll move tickets manually
810
+ ```
811
+
812
+ If [1]: prompt for the value, store as `CLANCY_STATUS_PLANNED` in `.clancy/.env`. Wrap in double quotes.
813
+ If [2]: skip — no `CLANCY_STATUS_PLANNED` line written.
814
+
815
+ ---
816
+
817
+ ## Step 4f (if Strategist role selected): Strategist config
818
+
819
+ Only ask this if the user selected Strategist in Step 4c above (or if re-running init and `CLANCY_ROLES` already includes `strategist`).
820
+
821
+ If the strategist role is not enabled, skip this step entirely.
822
+
823
+ **All boards:** Output:
824
+
825
+ ```
826
+ Default parent epic/milestone for briefs created from text or file input?
827
+ This sets CLANCY_BRIEF_EPIC so tickets created by /clancy:brief are parented automatically.
828
+
829
+ [1] Skip — no default parent (set per-brief or omit)
830
+ [2] Enter an epic key (e.g. PROJ-100, #42, ENG-50)
831
+ ```
832
+
833
+ If [1]: skip — no `CLANCY_BRIEF_EPIC` line written.
834
+ If [2]: prompt for the value, store as `CLANCY_BRIEF_EPIC` in `.clancy/.env`. Wrap in double quotes.
835
+
836
+ **Jira only:** Output:
837
+
838
+ ```
839
+ What issue type should /clancy:brief use when creating tickets? [Task]
840
+
841
+ [1] Task (default)
842
+ [2] Story
843
+ [3] Enter a different value
844
+ ```
845
+
846
+ If [1] or enter: do not add `CLANCY_BRIEF_ISSUE_TYPE` to `.clancy/.env` (uses default `Task`).
847
+ If [2]: store `CLANCY_BRIEF_ISSUE_TYPE="Story"` in `.clancy/.env`.
848
+ If [3]: prompt for the value, store as `CLANCY_BRIEF_ISSUE_TYPE` in `.clancy/.env`. Wrap in double quotes.
849
+
850
+ **All boards:** Output:
851
+
852
+ ```
853
+ Auto-set a component on tickets created by /clancy:brief?
854
+ Only affects ticket creation — does not filter the implementation queue.
855
+
856
+ [1] Skip — no component
857
+ [2] Enter a component name
858
+ ```
859
+
860
+ If [1]: skip — no `CLANCY_COMPONENT` line written.
861
+ If [2]: prompt for the value, store as `CLANCY_COMPONENT` in `.clancy/.env`. Wrap in double quotes.
862
+
863
+ ---
864
+
865
+ ## Step 5 — Optional enhancements
866
+
867
+ Output:
868
+
869
+ ```
870
+ Clancy is set up. A few optional enhancements are available:
871
+
872
+ 1. Max iterations — set how many tickets /clancy:autopilot processes per session
873
+ 2. Figma MCP — fetch design specs when tickets include a Figma URL
874
+ 3. Playwright — screenshot and verify UI after implementing tickets
875
+ 4. Notifications — post to Slack or Teams when a ticket completes or errors
876
+
877
+ Each takes about 2 minutes to configure, or skip any for now.
878
+ You can always add them later via /clancy:settings.
879
+
880
+ Set up optional enhancements? [y/N]
881
+ ```
882
+
883
+ If no: skip to Step 6.
884
+
885
+ If yes, walk through each in order. After each enhancement (whether configured or skipped), ask before starting the next one: `Set up [enhancement name]? [y/N]`
886
+
887
+ ### Enhancement 1: Max iterations
888
+
889
+ Output:
890
+
891
+ ```
892
+ How many tickets should /clancy:autopilot process before stopping? [5]
893
+ (You can override this per-session with /clancy:autopilot 20)
894
+ ```
895
+
896
+ Validate the input is a positive integer between 1 and 100. If invalid, re-prompt.
897
+
898
+ Write `MAX_ITERATIONS=<value>` to `.clancy/.env`.
899
+
900
+ ---
901
+
902
+ ### Enhancement 2: Figma MCP
903
+
904
+ Output: `Fetch design context from Figma when tickets include a Figma URL. Set up Figma MCP? [y/N]`
905
+
906
+ If no: skip to Enhancement 3.
907
+
908
+ If yes: `Paste your Figma API key: (create one at figma.com/settings → Personal access tokens)`
909
+
910
+ If a key is entered:
911
+
912
+ 1. Verify the key by calling `GET https://api.figma.com/v1/me` with `X-Figma-Token: {key}`
913
+ 2. On success, show:
914
+
915
+ ```
916
+ ✅ Figma connected: {email}
917
+
918
+ Note: Check your Figma plan limits at figma.com/settings — Clancy uses 3 API calls per ticket.
919
+
920
+ Figma MCP enabled.
921
+ ```
922
+
923
+ If `GET /v1/me` fails (non-200), show:
924
+
925
+ ```
926
+ ❌ Couldn't verify Figma API key (HTTP {status}).
927
+ Double-check it at figma.com/settings → Personal access tokens.
928
+
929
+ [1] Try a different key
930
+ [2] Skip Figma for now
931
+ ```
932
+
933
+ Never silently continue with an unverified key. If the user picks [1], re-prompt for the key and repeat the verification. If [2], skip to Enhancement 3.
934
+
935
+ Write `FIGMA_API_KEY` to `.clancy/.env`. Add usage note to CLAUDE.md Clancy section.
936
+
937
+ ---
938
+
939
+ ### Enhancement 3: Playwright visual checks
940
+
941
+ If Figma was configured in Enhancement 2, output:
942
+ `Screenshot and verify UI after implementing tickets — and compare against the Figma design when one was fetched. Set up Playwright visual checks? [y/N]`
943
+
944
+ Otherwise output:
945
+ `Screenshot and verify UI after implementing tickets. Set up Playwright visual checks? [y/N]`
946
+
947
+ If no: skip to Enhancement 4.
948
+
949
+ If yes, continue. For Storybook users this is about 5 quick questions; without Storybook, 3 questions.
950
+
951
+ **Step 1: Storybook detection**
952
+
953
+ Check `package.json` for `@storybook/` dependencies and `.storybook/` directory.
954
+ If detected: "This project appears to use Storybook. Is that right? [Y/n]"
955
+
956
+ **Step 2: (If Storybook confirmed) Storybook content**
957
+
958
+ ```
959
+ What does your project keep in Storybook?
960
+ [a] Individual components only (atoms, molecules, organisms)
961
+ [b] Components and some pages
962
+ [c] Everything — all UI is previewed in Storybook
963
+ [d] Let me describe it
964
+ ```
965
+
966
+ **Step 3: (If Storybook confirmed) Dev server scope**
967
+
968
+ ```
969
+ What UI work requires the full dev server instead of Storybook?
970
+ [a] Full pages and routes
971
+ [b] Nothing — everything is in Storybook
972
+ [c] Let me describe it
973
+ ```
974
+
975
+ **Step 4: Dev server command**
976
+ Auto-detect from `package.json` scripts (priority: `dev`, `start`, `serve`).
977
+
978
+ ```
979
+ What command starts your dev server?
980
+ Detected: {value}
981
+
982
+ [1] Yes, use this
983
+ [2] Enter a different command
984
+ ```
985
+
986
+ **Step 5: Dev server port**
987
+ Auto-detect from `vite.config.*`, `next.config.*`, or common defaults (5173, 3000, 8080).
988
+
989
+ ```
990
+ What port does your dev server run on?
991
+ Detected: {value}
992
+
993
+ [1] Yes, use this
994
+ [2] Enter a different port
995
+ ```
996
+
997
+ **Step 6: (If Storybook confirmed) Storybook command**
998
+ Auto-detect from `package.json` scripts (`storybook`, `storybook:dev`).
999
+
1000
+ ```
1001
+ What command starts Storybook?
1002
+ Detected: {value}
1003
+
1004
+ [1] Yes, use this
1005
+ [2] Enter a different command
1006
+ ```
1007
+
1008
+ **Step 7: (If Storybook confirmed) Storybook port**
1009
+ Auto-detect from `.storybook/main.js|ts` or default to 6006.
1010
+
1011
+ ```
1012
+ What port does Storybook run on?
1013
+ Detected: {value}
1014
+
1015
+ [1] Yes, use this
1016
+ [2] Enter a different port
1017
+ ```
1018
+
1019
+ **Step 8: Startup wait**
1020
+
1021
+ ```
1022
+ How many seconds should Clancy wait for a server to be ready?
1023
+
1024
+ [1] 15 seconds (default)
1025
+ [2] Enter a different value
1026
+ ```
1027
+
1028
+ Write to `.clancy/.env`. Wrap command values in double quotes — they often contain spaces:
1029
+
1030
+ ```
1031
+ PLAYWRIGHT_ENABLED=true
1032
+ PLAYWRIGHT_DEV_COMMAND="<value>"
1033
+ PLAYWRIGHT_DEV_PORT=<value>
1034
+ PLAYWRIGHT_STORYBOOK_COMMAND="<value>" # only if Storybook confirmed
1035
+ PLAYWRIGHT_STORYBOOK_PORT=<value> # only if Storybook confirmed
1036
+ PLAYWRIGHT_STARTUP_WAIT=<value>
1037
+ ```
1038
+
1039
+ Create `.clancy/docs/PLAYWRIGHT.md` — see PLAYWRIGHT.md template in scaffold.md.
1040
+
1041
+ ---
1042
+
1043
+ ### Enhancement 4: Slack / Teams notifications
1044
+
1045
+ Output: `Post to a channel when a ticket completes or Clancy hits an error. Set up notifications? [y/N]`
1046
+
1047
+ If no: skip to Step 6.
1048
+
1049
+ If yes: `Paste your Slack or Teams webhook URL:`
1050
+
1051
+ Auto-detect platform from URL:
1052
+
1053
+ - `https://hooks.slack.com/` → Slack → sends `{"text": "..."}` payload
1054
+ - `https://prod-*.logic.azure.com/` or `https://*.webhook.office.com/` → Teams → sends Adaptive Card
1055
+
1056
+ If Teams URL entered, show:
1057
+
1058
+ ```
1059
+ Ensure you've set up the "Post to a channel when a webhook request is received"
1060
+ workflow via Teams → channel → ... → Workflows. The URL must come from that
1061
+ workflow's trigger, not from the old Office 365 Connectors setup (retired April 2026).
1062
+ ```
1063
+
1064
+ Write `CLANCY_NOTIFY_WEBHOOK=<url>` to `.clancy/.env`.
1065
+
1066
+ ---
1067
+
1068
+ ## Step 6 — Offer map-codebase
1069
+
1070
+ Output:
1071
+
1072
+ One last step — Clancy can scan your codebase now and populate `.clancy/docs/` with structured context it reads before every ticket. This takes about 2 minutes.
1073
+
1074
+ Scan codebase now? [Y/n]
1075
+
1076
+ If yes: run the map-codebase workflow.
1077
+ If no: output "Run /clancy:map-codebase when you're ready." then continue to final output.
1078
+
1079
+ ---
1080
+
1081
+ ## Final output
1082
+
1083
+ Output:
1084
+
1085
+ ```
1086
+ ╔═══════════════════════════════════════════════════════════╗
1087
+ ║ ✅ Clancy is ready. ║
1088
+ ╚═══════════════════════════════════════════════════════════╝
1089
+
1090
+ - Scripts: `.clancy/clancy-implement.js`, `.clancy/clancy-autopilot.js`
1091
+ - Docs: `.clancy/docs/` (10 files)
1092
+ - Config: `.clancy/.env`
1093
+ - CLAUDE.md: updated
1094
+
1095
+ "Clancy's on the beat." — Run /clancy:plan to refine backlog tickets, /clancy:dry-run to preview, or /clancy:implement to pick up a ticket.
1096
+ ```