chief-clancy 0.5.4 → 0.5.6

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 (71) hide show
  1. package/README.md +3 -3
  2. package/dist/bundle/clancy-once.js +54 -29
  3. package/dist/installer/install.js +1 -1
  4. package/dist/installer/install.js.map +1 -1
  5. package/dist/schemas/bitbucket-pr.d.ts +122 -0
  6. package/dist/schemas/bitbucket-pr.d.ts.map +1 -0
  7. package/dist/schemas/bitbucket-pr.js +69 -0
  8. package/dist/schemas/bitbucket-pr.js.map +1 -0
  9. package/dist/schemas/env.d.ts +12 -0
  10. package/dist/schemas/env.d.ts.map +1 -1
  11. package/dist/schemas/env.js +4 -0
  12. package/dist/schemas/env.js.map +1 -1
  13. package/dist/schemas/github.d.ts +60 -0
  14. package/dist/schemas/github.d.ts.map +1 -1
  15. package/dist/schemas/github.js +32 -0
  16. package/dist/schemas/github.js.map +1 -1
  17. package/dist/schemas/gitlab-mr.d.ts +62 -0
  18. package/dist/schemas/gitlab-mr.d.ts.map +1 -0
  19. package/dist/schemas/gitlab-mr.js +31 -0
  20. package/dist/schemas/gitlab-mr.js.map +1 -0
  21. package/dist/scripts/once/once.d.ts.map +1 -1
  22. package/dist/scripts/once/once.js +181 -23
  23. package/dist/scripts/once/once.js.map +1 -1
  24. package/dist/scripts/shared/git-ops/git-ops.d.ts +9 -0
  25. package/dist/scripts/shared/git-ops/git-ops.d.ts.map +1 -1
  26. package/dist/scripts/shared/git-ops/git-ops.js +20 -0
  27. package/dist/scripts/shared/git-ops/git-ops.js.map +1 -1
  28. package/dist/scripts/shared/progress/progress.d.ts +41 -0
  29. package/dist/scripts/shared/progress/progress.d.ts.map +1 -1
  30. package/dist/scripts/shared/progress/progress.js +96 -1
  31. package/dist/scripts/shared/progress/progress.js.map +1 -1
  32. package/dist/scripts/shared/prompt/prompt.d.ts +27 -0
  33. package/dist/scripts/shared/prompt/prompt.d.ts.map +1 -1
  34. package/dist/scripts/shared/prompt/prompt.js +32 -7
  35. package/dist/scripts/shared/prompt/prompt.js.map +1 -1
  36. package/dist/scripts/shared/pull-request/bitbucket/bitbucket.d.ts +41 -9
  37. package/dist/scripts/shared/pull-request/bitbucket/bitbucket.d.ts.map +1 -1
  38. package/dist/scripts/shared/pull-request/bitbucket/bitbucket.js +182 -0
  39. package/dist/scripts/shared/pull-request/bitbucket/bitbucket.js.map +1 -1
  40. package/dist/scripts/shared/pull-request/github/github.d.ts +34 -1
  41. package/dist/scripts/shared/pull-request/github/github.d.ts.map +1 -1
  42. package/dist/scripts/shared/pull-request/github/github.js +106 -2
  43. package/dist/scripts/shared/pull-request/github/github.js.map +1 -1
  44. package/dist/scripts/shared/pull-request/gitlab/gitlab.d.ts +32 -9
  45. package/dist/scripts/shared/pull-request/gitlab/gitlab.d.ts.map +1 -1
  46. package/dist/scripts/shared/pull-request/gitlab/gitlab.js +127 -0
  47. package/dist/scripts/shared/pull-request/gitlab/gitlab.js.map +1 -1
  48. package/dist/scripts/shared/pull-request/pr-body/pr-body.d.ts.map +1 -1
  49. package/dist/scripts/shared/pull-request/pr-body/pr-body.js +7 -0
  50. package/dist/scripts/shared/pull-request/pr-body/pr-body.js.map +1 -1
  51. package/dist/scripts/shared/pull-request/rework-comment/rework-comment.d.ts +23 -0
  52. package/dist/scripts/shared/pull-request/rework-comment/rework-comment.d.ts.map +1 -0
  53. package/dist/scripts/shared/pull-request/rework-comment/rework-comment.js +30 -0
  54. package/dist/scripts/shared/pull-request/rework-comment/rework-comment.js.map +1 -0
  55. package/dist/types/index.d.ts +1 -1
  56. package/dist/types/index.d.ts.map +1 -1
  57. package/dist/types/remote.d.ts +9 -0
  58. package/dist/types/remote.d.ts.map +1 -1
  59. package/package.json +1 -1
  60. package/src/roles/planner/commands/approve-plan.md +7 -0
  61. package/src/roles/planner/commands/plan.md +11 -1
  62. package/src/roles/planner/workflows/approve-plan.md +478 -0
  63. package/src/roles/planner/workflows/plan.md +171 -49
  64. package/src/roles/reviewer/workflows/logs.md +7 -3
  65. package/src/roles/setup/commands/help.md +3 -2
  66. package/src/roles/setup/workflows/init.md +68 -2
  67. package/src/roles/setup/workflows/scaffold.md +41 -0
  68. package/src/roles/setup/workflows/settings.md +41 -6
  69. package/src/templates/CLAUDE.md +2 -0
  70. package/src/roles/planner/commands/approve.md +0 -7
  71. package/src/roles/planner/workflows/approve.md +0 -237
@@ -51,6 +51,7 @@ General
51
51
  [G1] Max iterations {MAX_ITERATIONS:-5} tickets per /clancy:run session
52
52
  [G2] Claude model {CLANCY_MODEL:-default} model used for each ticket session
53
53
  [G3] Base branch {CLANCY_BASE_BRANCH:-main}
54
+ [G4] Max rework {CLANCY_MAX_REWORK:-3}
54
55
 
55
56
  {If Jira:}
56
57
  Jira
@@ -61,16 +62,12 @@ Jira
61
62
  [B5] Done status {CLANCY_STATUS_DONE if set, else off}
62
63
  [B6] Review status {CLANCY_STATUS_REVIEW if set, else "uses Done status"}
63
64
 
64
- {If GitHub:}
65
- GitHub
66
- (No board-specific settings — labels are managed in GitHub directly)
67
-
68
65
  {If Linear:}
69
66
  Linear
70
67
  [B1] Label filter {CLANCY_LABEL if set, else off}
71
68
  [B2] Pickup status {CLANCY_STATUS_IN_PROGRESS if set, else off}
72
69
  [B3] Done status {CLANCY_STATUS_DONE if set, else off}
73
- [B4] Review status {CLANCY_STATUS_REVIEW if set, else "uses Done status"}
70
+ [B4] Review status {CLANCY_STATUS_REVIEW if set, else "uses Done state"}
74
71
 
75
72
  Roles
76
73
  [R1] Planner {✅ enabled / ─ disabled}
@@ -83,6 +80,8 @@ Planner
83
80
  [P1] Plan label {CLANCY_PLAN_LABEL:-needs-refinement}
84
81
  {If Linear:}
85
82
  [P1] Plan state type {CLANCY_PLAN_STATE_TYPE:-backlog}
83
+ {If Jira:}
84
+ [P2] Post-approval {CLANCY_STATUS_PLANNED if set, else "off"}
86
85
 
87
86
  Git Host (PR creation)
88
87
  [H1] Git host token {platform: GitHub/GitLab/Bitbucket or "not set"}
@@ -156,6 +155,24 @@ Write `CLANCY_BASE_BRANCH=<value>` to `.clancy/.env`.
156
155
 
157
156
  ---
158
157
 
158
+ ### [G4] Max rework cycles
159
+
160
+ ```
161
+ Max rework cycles — current: {value or 3}
162
+ After this many rework cycles on a single ticket, Clancy flags it for human intervention.
163
+
164
+ [1] 3 (default)
165
+ [2] Enter a different number
166
+ [3] Cancel
167
+ ```
168
+
169
+ Validate the input is a positive integer between 1 and 20. If invalid, re-prompt.
170
+
171
+ If [1]: remove `CLANCY_MAX_REWORK` from `.clancy/.env` (uses default).
172
+ If [2]: prompt `How many rework cycles before human intervention?` then write `CLANCY_MAX_REWORK=<value>` to `.clancy/.env`.
173
+
174
+ ---
175
+
159
176
  ### [B1] Jira status filter (Jira only)
160
177
 
161
178
  ```
@@ -327,7 +344,7 @@ If [2]: remove `CLANCY_STATUS_REVIEW` from `.clancy/.env`.
327
344
  ```
328
345
  Planner role — currently: {enabled / disabled}
329
346
  The Planner refines vague backlog tickets into structured implementation plans.
330
- Commands: /clancy:plan, /clancy:approve
347
+ Commands: /clancy:plan, /clancy:approve-plan
331
348
 
332
349
  [1] Enable
333
350
  [2] Disable
@@ -394,6 +411,24 @@ If [3]: prompt `What state type should /clancy:plan fetch from?` then write `CLA
394
411
 
395
412
  ---
396
413
 
414
+ ### [P2] Post-approval transition (Jira only)
415
+
416
+ Only shown when Planner is enabled and board is Jira.
417
+
418
+ ```
419
+ Post-approval transition — current: {value or "off"}
420
+ After approving a plan, transition the ticket to this status.
421
+
422
+ [1] Set status name
423
+ [2] Off (move manually)
424
+ [3] Cancel
425
+ ```
426
+
427
+ If [1]: prompt `What status should Clancy transition to after approving a plan? (e.g. To Do, Ready)` then write `CLANCY_STATUS_PLANNED=<value>` to `.clancy/.env`. Wrap in double quotes.
428
+ If [2]: remove `CLANCY_STATUS_PLANNED` from `.clancy/.env`.
429
+
430
+ ---
431
+
397
432
  ### [H1] Git host token
398
433
 
399
434
  Only shown for Jira and Linear boards. GitHub Issues users already have `GITHUB_TOKEN` for PR creation.
@@ -54,7 +54,9 @@ Log completed tickets to `.clancy/progress.txt`:
54
54
  `YYYY-MM-DD HH:MM | TICKET-KEY | Summary | DONE`
55
55
 
56
56
  Planning entries use: `YYYY-MM-DD HH:MM | TICKET-KEY | PLAN | S/M/L`
57
+ Revised plan entries use: `YYYY-MM-DD HH:MM | TICKET-KEY | REVISED | S/M/L`
57
58
  Approval entries use: `YYYY-MM-DD HH:MM | TICKET-KEY | APPROVE | —`
59
+ Failed comment posts use: `YYYY-MM-DD HH:MM | TICKET-KEY | POST_FAILED | {reason}`
58
60
 
59
61
  ### Design context
60
62
  When a ticket description contains a Figma URL, fetch design context before implementing.
@@ -1,7 +0,0 @@
1
- # /clancy:approve
2
-
3
- Promote an approved Clancy plan to the ticket description. Requires a ticket key argument (e.g. `/clancy:approve PROJ-123`).
4
-
5
- @.claude/clancy/workflows/approve.md
6
-
7
- Follow the approve workflow above. Fetch the plan comment, confirm with the user, and append it to the ticket description.
@@ -1,237 +0,0 @@
1
- # Clancy Approve Workflow
2
-
3
- ## Overview
4
-
5
- Promote an approved Clancy plan from a ticket comment to the ticket description. The plan is appended below the existing description, never replacing it.
6
-
7
- ---
8
-
9
- ## Step 1 — Preflight checks
10
-
11
- 1. Check `.clancy/` exists and `.clancy/.env` is present. If not:
12
- ```
13
- .clancy/ not found. Run /clancy:init to set up Clancy first.
14
- ```
15
- Stop.
16
-
17
- 2. Source `.clancy/.env` and check board credentials are present.
18
-
19
- ---
20
-
21
- ## Step 2 — Parse argument
22
-
23
- The user must provide a ticket key as an argument (e.g. `/clancy:approve PROJ-123`).
24
-
25
- If no key is provided:
26
- ```
27
- Usage: /clancy:approve PROJ-123
28
- ```
29
- Stop.
30
-
31
- ---
32
-
33
- ## Step 3 — Fetch the plan comment
34
-
35
- Detect board from `.clancy/.env` and fetch comments for the specified ticket.
36
-
37
- ### Jira
38
-
39
- ```bash
40
- RESPONSE=$(curl -s \
41
- -u "$JIRA_USER:$JIRA_API_TOKEN" \
42
- -H "Accept: application/json" \
43
- "$JIRA_BASE_URL/rest/api/3/issue/$TICKET_KEY/comment")
44
- ```
45
-
46
- ### GitHub
47
-
48
- First, determine the issue number from the ticket key (strip the `#` prefix if present):
49
-
50
- ```bash
51
- RESPONSE=$(curl -s \
52
- -H "Authorization: Bearer $GITHUB_TOKEN" \
53
- -H "X-GitHub-Api-Version: 2022-11-28" \
54
- "https://api.github.com/repos/$GITHUB_REPO/issues/$ISSUE_NUMBER/comments")
55
- ```
56
-
57
- ### Linear
58
-
59
- ```graphql
60
- query {
61
- issue(id: "<issue-id>") {
62
- id identifier title description
63
- comments { nodes { body createdAt } }
64
- }
65
- }
66
- ```
67
-
68
- For Linear, the user provides the issue identifier (e.g. `ENG-42`). Look up the issue by identifier to get the internal ID and comments:
69
-
70
- ```graphql
71
- query {
72
- issueSearch(query: "$IDENTIFIER", first: 5) {
73
- nodes {
74
- id identifier title description
75
- comments { nodes { body createdAt } }
76
- }
77
- }
78
- }
79
- ```
80
-
81
- **Important:** `issueSearch` is a fuzzy text search. After fetching results, verify the returned issue's `identifier` field exactly matches the provided key (case-insensitive). If no exact match is found in the results, report: `❌ Issue {KEY} not found. Check the identifier and try again.`
82
-
83
- Search the comments for the most recent one containing `## Clancy Implementation Plan`.
84
-
85
- If no plan comment is found:
86
- ```
87
- ❌ No Clancy plan found for {KEY}. Run /clancy:plan first.
88
- ```
89
- Stop.
90
-
91
- ---
92
-
93
- ## Step 3b — Check for existing plan in description
94
-
95
- Before confirming, check if the ticket description already contains `## Clancy Implementation Plan`.
96
-
97
- If it does:
98
- ```
99
- ⚠️ This ticket's description already contains a Clancy plan.
100
- Continuing will add a duplicate.
101
-
102
- [1] Continue anyway
103
- [2] Cancel
104
- ```
105
-
106
- If the user picks [2], stop: `Cancelled. No changes made.`
107
-
108
- ---
109
-
110
- ## Step 4 — Confirm
111
-
112
- Display a summary and ask for confirmation:
113
-
114
- ```
115
- 🚨 Clancy — Approve
116
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
117
-
118
- [{KEY}] {Title}
119
- Size: {S/M/L} | {N} affected files
120
- Planned: {date from plan}
121
-
122
- Promote this plan to the ticket description? [Y/n]
123
- ```
124
-
125
- If the user declines, stop:
126
- ```
127
- Cancelled. No changes made.
128
- ```
129
-
130
- ---
131
-
132
- ## Step 5 — Update ticket description
133
-
134
- Append the plan below the existing description with a separator. Never overwrite the original description.
135
-
136
- The updated description follows this format:
137
- ```
138
- {existing description}
139
-
140
- ---
141
-
142
- {full plan content}
143
- ```
144
-
145
- ### Jira — PUT issue
146
-
147
- Fetch the current description first:
148
- ```bash
149
- CURRENT=$(curl -s \
150
- -u "$JIRA_USER:$JIRA_API_TOKEN" \
151
- -H "Accept: application/json" \
152
- "$JIRA_BASE_URL/rest/api/3/issue/$TICKET_KEY?fields=description")
153
- ```
154
-
155
- Merge the existing ADF description with a `rule` node (horizontal rule) and the plan content as new ADF nodes. Then update:
156
-
157
- ```bash
158
- curl -s \
159
- -u "$JIRA_USER:$JIRA_API_TOKEN" \
160
- -X PUT \
161
- -H "Content-Type: application/json" \
162
- -H "Accept: application/json" \
163
- "$JIRA_BASE_URL/rest/api/3/issue/$TICKET_KEY" \
164
- -d '{"fields": {"description": <merged ADF>}}'
165
- ```
166
-
167
- If ADF construction fails for the plan content, wrap the plan in a `codeBlock` node as fallback.
168
-
169
- ### GitHub — PATCH issue
170
-
171
- Fetch the current body:
172
- ```bash
173
- CURRENT=$(curl -s \
174
- -H "Authorization: Bearer $GITHUB_TOKEN" \
175
- -H "X-GitHub-Api-Version: 2022-11-28" \
176
- "https://api.github.com/repos/$GITHUB_REPO/issues/$ISSUE_NUMBER")
177
- ```
178
-
179
- Append the plan:
180
- ```bash
181
- curl -s \
182
- -H "Authorization: Bearer $GITHUB_TOKEN" \
183
- -H "X-GitHub-Api-Version: 2022-11-28" \
184
- -X PATCH \
185
- "https://api.github.com/repos/$GITHUB_REPO/issues/$ISSUE_NUMBER" \
186
- -d '{"body": "<existing body>\n\n---\n\n<plan>"}'
187
- ```
188
-
189
- ### Linear — issueUpdate mutation
190
-
191
- Fetch the current description:
192
- ```graphql
193
- query { issue(id: "$ISSUE_ID") { description } }
194
- ```
195
-
196
- Update with appended plan:
197
- ```graphql
198
- mutation {
199
- issueUpdate(
200
- id: "$ISSUE_ID"
201
- input: { description: "<existing>\n\n---\n\n<plan>" }
202
- ) { success }
203
- }
204
- ```
205
-
206
- ---
207
-
208
- ## Step 6 — Confirm and log
209
-
210
- On success:
211
- ```
212
- ✅ Plan promoted to description for [{KEY}].
213
-
214
- Move [{KEY}] to your implementation queue (e.g. "To Do") so /clancy:once picks it up.
215
-
216
- "Book 'em, Lou." — The ticket is ready for /clancy:once.
217
- ```
218
-
219
- Append to `.clancy/progress.txt`:
220
- ```
221
- YYYY-MM-DD HH:MM | {KEY} | APPROVE | —
222
- ```
223
-
224
- On failure:
225
- ```
226
- ❌ Failed to update description for [{KEY}]. Check your board permissions.
227
- ```
228
-
229
- ---
230
-
231
- ## Notes
232
-
233
- - This command only appends — it never overwrites the existing ticket description
234
- - If the ticket has multiple plan comments, the most recent one is used
235
- - The plan content is taken verbatim from the comment — no regeneration
236
- - Step 3b checks for existing plans in the description to prevent accidental duplication
237
- - The ticket key is case-insensitive — accept `PROJ-123`, `proj-123`, or `#123` (GitHub)