@chief-clancy/plan 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.
@@ -0,0 +1,22 @@
1
+ # /clancy:plan
2
+
3
+ Fetch backlog tickets from the board, explore the codebase, and generate structured implementation plans. Plans are posted as comments on the ticket for human review.
4
+
5
+ Accepts optional arguments:
6
+
7
+ - **Batch mode:** `/clancy:plan 3` — plan up to 3 tickets from the queue
8
+ - **Specific ticket:** `/clancy:plan PROJ-123`, `/clancy:plan #42`, `/clancy:plan ENG-42` — plan a single ticket by key
9
+ - **Fresh start:** `--fresh` — discard any existing plan and start over
10
+ - **Skip confirmations:** `--afk` — auto-confirm all prompts (for automation)
11
+
12
+ Examples:
13
+
14
+ - `/clancy:plan` — plan 1 ticket from queue
15
+ - `/clancy:plan 3` — plan 3 tickets from queue
16
+ - `/clancy:plan PROJ-123` — plan a specific Jira/Linear ticket
17
+ - `/clancy:plan #42` — plan a specific GitHub issue
18
+ - `/clancy:plan --fresh PROJ-123` — discard existing plan and start over
19
+
20
+ @.claude/clancy/workflows/plan.md
21
+
22
+ Follow the plan workflow above. For each ticket: run the feasibility scan, explore the codebase, generate the plan, and post it as a comment. Do not implement anything — planning only.
@@ -0,0 +1,369 @@
1
+ # Board Setup Workflow
2
+
3
+ ## Overview
4
+
5
+ Configure board credentials so `/clancy:plan` can fetch tickets and post plans as comments. This workflow collects the minimum credentials needed for board access — no pipeline configuration, no role settings, no iteration limits.
6
+
7
+ Credentials are stored in `.clancy/.env` in the current project directory. They are per-project, not global.
8
+
9
+ ---
10
+
11
+ ## Step 1 — Preflight checks
12
+
13
+ ### 1. Check for full pipeline
14
+
15
+ Check if `.clancy/clancy-implement.js` exists in the project root.
16
+
17
+ If present, the full Clancy pipeline is installed. Show:
18
+
19
+ ```
20
+ Full Clancy pipeline detected. Use /clancy:settings to manage board credentials.
21
+ ```
22
+
23
+ Stop. Do not proceed with standalone board setup.
24
+
25
+ ### 2. Check for existing credentials
26
+
27
+ Check if `.clancy/.env` exists and contains board credentials (any of: `JIRA_BASE_URL`, `GITHUB_TOKEN`, `LINEAR_API_KEY`, `SHORTCUT_API_TOKEN`, `NOTION_TOKEN`, `AZDO_ORG`, `AZDO_PAT`, `AZDO_PROJECT`).
28
+
29
+ If board credentials are found, show:
30
+
31
+ ```
32
+ Existing board credentials found in .clancy/.env.
33
+
34
+ [1] Reconfigure (replace current board)
35
+ [2] Cancel
36
+ ```
37
+
38
+ If [2]: stop.
39
+ If [1]: continue to Step 2. The existing `.clancy/.env` will be updated (board-specific vars replaced, other vars preserved).
40
+
41
+ If `.clancy/.env` does not exist, or exists but has no board credentials: continue to Step 2.
42
+
43
+ ---
44
+
45
+ ## Step 2 — Board selection
46
+
47
+ Output:
48
+
49
+ ```
50
+ Which board are you using?
51
+
52
+ [1] Jira
53
+ [2] GitHub Issues
54
+ [3] Linear
55
+ [4] Shortcut
56
+ [5] Notion
57
+ [6] Azure DevOps
58
+ [7] My board isn't listed
59
+ ```
60
+
61
+ If the user selects [7], show:
62
+
63
+ ```
64
+ Clancy currently supports Jira, GitHub Issues, Linear, Shortcut, Notion, and Azure DevOps.
65
+
66
+ Your board isn't supported yet — open an issue:
67
+ github.com/Pushedskydiver/chief-clancy/issues
68
+
69
+ /clancy:plan requires a supported board for ticket fetching.
70
+ For the full pipeline with all boards: npx chief-clancy
71
+ ```
72
+
73
+ Stop.
74
+
75
+ ---
76
+
77
+ ## Step 3 — Credential collection
78
+
79
+ Ask each question individually and wait for an answer before moving to the next.
80
+
81
+ ### Jira
82
+
83
+ 1. `What's your Jira base URL? (e.g. https://your-org.atlassian.net)`
84
+ 2. `What's your Jira project key? (e.g. PROJ)`
85
+ 3. `What email address do you use to log in to Atlassian?`
86
+ 4. `Paste your Jira API token: (create one at id.atlassian.com/manage-profile/security/api-tokens)`
87
+
88
+ Store as `JIRA_BASE_URL`, `JIRA_PROJECT_KEY`, `JIRA_USER`, `JIRA_API_TOKEN`.
89
+
90
+ ### GitHub Issues
91
+
92
+ 1. `What's your GitHub repo? (owner/name, e.g. acme/my-app)`
93
+ 2. `Paste your GitHub personal access token: (needs repo scope)`
94
+
95
+ Store as `GITHUB_REPO`, `GITHUB_TOKEN`.
96
+
97
+ After collecting credentials, show:
98
+
99
+ ```
100
+ Note: /clancy:plan only picks up GitHub Issues that have the "clancy:plan" label applied.
101
+ Add this planning label to any issue you want Clancy to plan.
102
+ ```
103
+
104
+ ### Linear
105
+
106
+ 1. `Paste your Linear API key: (create one at linear.app/settings/api)`
107
+ 2. After verifying the API key (Step 4), auto-detect teams by querying `{ teams { nodes { id name } } }`.
108
+ - If exactly 1 team: use it automatically. Show `Using team: {name} ({id})`.
109
+ - If 2+ teams: show a numbered list and let the user pick.
110
+ - 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)`
111
+
112
+ Store as `LINEAR_API_KEY`, `LINEAR_TEAM_ID`.
113
+
114
+ ### Shortcut
115
+
116
+ 1. `Paste your Shortcut API token: (create one at app.shortcut.com/settings/account/api-tokens)`
117
+
118
+ Store as `SHORTCUT_API_TOKEN`.
119
+
120
+ ### Notion
121
+
122
+ 1. `Paste your Notion integration token: (create one at notion.so/my-integrations)`
123
+ 2. `What's your Notion database ID? (the 32-character hex string in your database URL)`
124
+
125
+ Store as `NOTION_TOKEN`, `NOTION_DATABASE_ID`.
126
+
127
+ ### Azure DevOps
128
+
129
+ 1. `What's your Azure DevOps organisation name? (e.g. your-org)`
130
+ 2. `What's your Azure DevOps project name?`
131
+ 3. `Paste your Azure DevOps personal access token: (needs Work Items Read & Write scope)`
132
+
133
+ Store as `AZDO_ORG`, `AZDO_PROJECT`, `AZDO_PAT`.
134
+
135
+ ---
136
+
137
+ ## Step 4 — Credential verification
138
+
139
+ After collecting all credentials for the chosen board, verify the connection before writing them.
140
+
141
+ ### Jira
142
+
143
+ 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).
144
+
145
+ On success (HTTP 200):
146
+
147
+ ```
148
+ ✅ Jira connected — project {JIRA_PROJECT_KEY} reachable.
149
+ ```
150
+
151
+ ### GitHub Issues
152
+
153
+ Call `GET https://api.github.com/repos/{GITHUB_REPO}` with `Authorization: Bearer {GITHUB_TOKEN}` and `X-GitHub-Api-Version: 2022-11-28`.
154
+
155
+ On success (HTTP 200):
156
+
157
+ ```
158
+ ✅ GitHub connected — {GITHUB_REPO} reachable.
159
+ ```
160
+
161
+ ### Linear
162
+
163
+ Call `POST https://api.linear.app/graphql` with `Authorization: {LINEAR_API_KEY}` (no Bearer prefix) and body `{"query": "{ viewer { id name } }"}`.
164
+
165
+ On success (HTTP 200 with `data.viewer`):
166
+
167
+ ```
168
+ ✅ Linear connected — {viewer.name}.
169
+ ```
170
+
171
+ ### Shortcut
172
+
173
+ Call `GET https://api.app.shortcut.com/api/v3/member-info` with `Shortcut-Token: {SHORTCUT_API_TOKEN}`.
174
+
175
+ On success (HTTP 200):
176
+
177
+ ```
178
+ ✅ Shortcut connected.
179
+ ```
180
+
181
+ ### Notion
182
+
183
+ Call `GET https://api.notion.com/v1/databases/{NOTION_DATABASE_ID}` with `Authorization: Bearer {NOTION_TOKEN}` and `Notion-Version: 2022-06-28`.
184
+
185
+ On success (HTTP 200):
186
+
187
+ ```
188
+ ✅ Notion connected — database reachable.
189
+ ```
190
+
191
+ ### Azure DevOps
192
+
193
+ Call `GET https://dev.azure.com/{AZDO_ORG}/{AZDO_PROJECT}/_apis/wit/workitemtypes?api-version=7.1` with basic auth (empty user, `AZDO_PAT` as password).
194
+
195
+ On success (HTTP 200):
196
+
197
+ ```
198
+ ✅ Azure DevOps connected — {AZDO_PROJECT} reachable.
199
+ ```
200
+
201
+ ### On failure (any board)
202
+
203
+ ```
204
+ ❌ Couldn't connect to {board} (HTTP {status}).
205
+ Check your credentials.
206
+
207
+ [1] Re-enter credentials
208
+ [2] Skip verification (save anyway)
209
+ [3] Cancel
210
+ ```
211
+
212
+ If [1]: go back to Step 3 for that board.
213
+ If [2]: save the unverified credentials and continue to Step 5.
214
+ If [3]: stop without saving.
215
+
216
+ Never silently continue with unverified credentials — the user must explicitly choose.
217
+
218
+ ---
219
+
220
+ ## Step 5 — Detect base branch
221
+
222
+ Auto-detect the default branch:
223
+
224
+ ```bash
225
+ BASE_BRANCH_REF="$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null)"
226
+ echo "${BASE_BRANCH_REF#refs/remotes/origin/}"
227
+ ```
228
+
229
+ If detection succeeds and the branch is `main` or `master`: use it silently. Store as `CLANCY_BASE_BRANCH`.
230
+
231
+ If detection fails or returns an unexpected branch name, ask:
232
+
233
+ ```
234
+ What's your base branch? [main]
235
+ ```
236
+
237
+ ---
238
+
239
+ ## Step 6 — Write credentials
240
+
241
+ ### Create directory
242
+
243
+ Create `.clancy/` directory if it does not exist.
244
+
245
+ ### Write `.clancy/.env`
246
+
247
+ If `.clancy/.env` already exists (reconfigure path from Step 1, or exists with no board credentials):
248
+
249
+ - Preserve all existing lines (comments, blank lines, non-board vars)
250
+ - Remove any existing board-specific env vars for ALL boards (not just the new one). Board vars to remove:
251
+ - Jira: `JIRA_BASE_URL`, `JIRA_PROJECT_KEY`, `JIRA_USER`, `JIRA_API_TOKEN`, `CLANCY_JQL_STATUS`, `CLANCY_JQL_SPRINT`, `CLANCY_PLAN_STATUS`, `CLANCY_LABEL_PLAN`
252
+ - GitHub: `GITHUB_REPO`, `GITHUB_TOKEN`, `CLANCY_LABEL_PLAN`
253
+ - Linear: `LINEAR_API_KEY`, `LINEAR_TEAM_ID`, `CLANCY_PLAN_STATE_TYPE`, `CLANCY_LABEL_PLAN`
254
+ - Shortcut: `SHORTCUT_API_TOKEN`, `SHORTCUT_WORKFLOW`, `CLANCY_LABEL_PLAN`
255
+ - Notion: `NOTION_TOKEN`, `NOTION_DATABASE_ID`, `CLANCY_NOTION_STATUS`, `CLANCY_NOTION_ASSIGNEE`, `CLANCY_NOTION_LABELS`, `CLANCY_NOTION_PARENT`, `CLANCY_NOTION_TODO`, `CLANCY_PLAN_STATUS`, `CLANCY_LABEL_PLAN`
256
+ - Azure DevOps: `AZDO_ORG`, `AZDO_PROJECT`, `AZDO_PAT`, `CLANCY_AZDO_WIT`, `CLANCY_AZDO_STATUS`, `CLANCY_PLAN_STATUS`, `CLANCY_LABEL_PLAN`
257
+ - Preserve all other lines (comments, blank lines, non-board vars like `CLANCY_BASE_BRANCH`)
258
+ - Append the new board's credentials at the end
259
+ - Update `CLANCY_BASE_BRANCH` if it exists, or append it
260
+
261
+ If `.clancy/.env` does not exist, write a new file:
262
+
263
+ ```
264
+ # Clancy — Board credentials
265
+ # Configured by @chief-clancy/plan
266
+ # Do not commit this file to version control.
267
+
268
+ {BOARD_CREDENTIALS}
269
+
270
+ CLANCY_BASE_BRANCH={branch}
271
+ ```
272
+
273
+ Where `{BOARD_CREDENTIALS}` is the board-specific key=value pairs collected in Step 3. Wrap values containing spaces in double quotes.
274
+
275
+ ### Check .gitignore
276
+
277
+ Check if `.gitignore` exists and contains `.clancy/.env` (or a pattern that covers it, like `.clancy/` or `*.env`).
278
+
279
+ If not covered, show:
280
+
281
+ ```
282
+ ⚠️ Add .clancy/.env to your .gitignore to keep credentials out of version control:
283
+
284
+ echo '.clancy/.env' >> .gitignore
285
+ ```
286
+
287
+ ---
288
+
289
+ ## Step 7 — Completion
290
+
291
+ Show the board-specific success message:
292
+
293
+ ### Jira
294
+
295
+ ```
296
+ Board credentials configured for Jira ({JIRA_PROJECT_KEY}).
297
+
298
+ You can now plan from Jira tickets:
299
+ /clancy:plan PROJ-123
300
+
301
+ Credentials are stored in .clancy/.env (this project only).
302
+ To reconfigure: /clancy:board-setup
303
+ For the full pipeline: npx chief-clancy
304
+ ```
305
+
306
+ ### GitHub Issues
307
+
308
+ ```
309
+ Board credentials configured for GitHub Issues ({GITHUB_REPO}).
310
+
311
+ You can now plan from GitHub issues:
312
+ /clancy:plan #42
313
+
314
+ Credentials are stored in .clancy/.env (this project only).
315
+ To reconfigure: /clancy:board-setup
316
+ For the full pipeline: npx chief-clancy
317
+ ```
318
+
319
+ ### Linear
320
+
321
+ ```
322
+ Board credentials configured for Linear.
323
+
324
+ You can now plan from Linear issues:
325
+ /clancy:plan ENG-42
326
+
327
+ Credentials are stored in .clancy/.env (this project only).
328
+ To reconfigure: /clancy:board-setup
329
+ For the full pipeline: npx chief-clancy
330
+ ```
331
+
332
+ ### Shortcut
333
+
334
+ ```
335
+ Board credentials configured for Shortcut.
336
+
337
+ You can now plan from Shortcut stories:
338
+ /clancy:plan SC-123
339
+
340
+ Credentials are stored in .clancy/.env (this project only).
341
+ To reconfigure: /clancy:board-setup
342
+ For the full pipeline: npx chief-clancy
343
+ ```
344
+
345
+ ### Notion
346
+
347
+ ```
348
+ Board credentials configured for Notion.
349
+
350
+ You can now plan from Notion pages:
351
+ /clancy:plan notion-XXXXXXXX
352
+
353
+ Credentials are stored in .clancy/.env (this project only).
354
+ To reconfigure: /clancy:board-setup
355
+ For the full pipeline: npx chief-clancy
356
+ ```
357
+
358
+ ### Azure DevOps
359
+
360
+ ```
361
+ Board credentials configured for Azure DevOps ({AZDO_PROJECT}).
362
+
363
+ You can now plan from Azure DevOps work items:
364
+ /clancy:plan 42
365
+
366
+ Credentials are stored in .clancy/.env (this project only).
367
+ To reconfigure: /clancy:board-setup
368
+ For the full pipeline: npx chief-clancy
369
+ ```