@chris1807/claude-kit 2.1.45 → 2.1.46

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chris1807/claude-kit",
3
- "version": "2.1.45",
3
+ "version": "2.1.46",
4
4
  "description": "Claude Code starter kit for Azure DevOps teams — agents, hooks, MCP servers, slash commands, and end-to-end work item → PR → release → deploy workflow automation",
5
5
  "type": "module",
6
6
  "bin": {
@@ -161,6 +161,78 @@ Once the branch is created, move the work item (User Story, Bug, Hot Fix, or oth
161
161
 
162
162
  If the work item is already `Active`, skip the update. If the project's process template does not have an `Active` state (the update call returns an invalid-state error), fall back in this order: `In Progress` → `Doing` → leave the current state and warn the user that the state could not be advanced automatically. Do not silently swallow the error.
163
163
 
164
+ ### Ensure an Open Child Task Exists
165
+
166
+ The child **Task** is where hours live: Step 10 closes it and logs the hours worked when the PR goes up. So an implementation run must never proceed without one — if there's nothing to close, nothing gets logged.
167
+
168
+ Right after moving the work item to `Active`, look at its child Tasks (relations of type `System.LinkTypes.Hierarchy-Forward` whose target's `System.WorkItemType` is `Task`). A Task counts as **open** if its state is **not** `Closed`, `Done`, or `Removed`.
169
+
170
+ **Never do this for a Feature.** Features don't carry Tasks of their own — the Feature path creates them per child story in F4.
171
+
172
+ #### If an open child Task already exists
173
+
174
+ Use it. **Do not create a second one** — one Task per story, always. Two touch-ups, then move on:
175
+
176
+ - If it's still `New`, move it to `Active` alongside the parent.
177
+ - If `Microsoft.VSTS.Scheduling.OriginalEstimate` is empty, propose hours (below) and, once the user agrees, set both `OriginalEstimate` and `RemainingWork` to that value.
178
+
179
+ If **more than one** open Task exists, don't guess — list them and ask which one this run should log against. Leave the others alone.
180
+
181
+ #### If there is no open child Task, create exactly one
182
+
183
+ This includes the case where child Tasks exist but every one of them is already closed — a closed Task is not somewhere to log new work.
184
+
185
+ Propose the hours from the parent's Story Points (this mirrors `/plan-backlog` Step 5b — keep the two tables in sync):
186
+
187
+ | Points | Hour budget |
188
+ |--------|-------------|
189
+ | 1 | 3 hrs |
190
+ | 2 | 6 hrs |
191
+ | 3 | 10 hrs |
192
+ | 5 | 16 hrs |
193
+ | 8 | 28 hrs |
194
+ | 13 | 48 hrs |
195
+ | 21 | 75 hrs |
196
+
197
+ Calibrated for a **senior developer** at ~6 productive hours per day — the discount is already in the numbers, so don't apply a second one. Round non-Fibonacci point values up to the nearest row. Add 20–30% for `spike` / `research` / `unknown-stack` tags.
198
+
199
+ If the work item has **no Story Points**, estimate the hours from the plan just approved in Step 3 — files to create and modify, plus the unit tests listed — using the same senior calibration. Say which basis you used.
200
+
201
+ Show the proposal and **wait for the user**:
202
+
203
+ ```
204
+ AB#{id} has no open child Task — one is needed to log hours against.
205
+
206
+ | Task title | Hours |
207
+ |----------------------------------------------|-------|
208
+ | {PREFIX} - Implement: {short summary} | 16 |
209
+
210
+ Basis: {n} story points → {n}h (or: no points — estimated from the approved plan)
211
+
212
+ Create it? (yes / edit / skip)
213
+ ```
214
+
215
+ - `yes` → create it
216
+ - `edit` → ask what to change (title or hours), revise, re-show, ask again
217
+ - `skip` → continue without a Task, and **warn** that Step 10 will have no Task to close and no hours will be logged for this story
218
+
219
+ On `yes`, create it with `mcp__azure-devops__wit_create_work_item`:
220
+
221
+ - **workItemType**: `Task`
222
+ - **title**: `{PREFIX} - Implement: {short summary of the story}` — reuse the parent's product prefix (`COM`, `PAY`, `CDA`, …), extracted from the parent's title
223
+ - **fields**:
224
+ - `Microsoft.VSTS.Scheduling.OriginalEstimate` — the agreed hours (as a number)
225
+ - `Microsoft.VSTS.Scheduling.RemainingWork` — the same value
226
+ - `System.AreaPath` and `System.IterationPath` — copy from the parent
227
+ - `System.AssignedTo` — copy from the parent (pass the parent's `uniqueName` / email if the value is an identity object). If the parent is unassigned, leave it unset rather than failing.
228
+ - `System.State` — `Active`, since implementation is starting right now (fall back to the template's in-progress equivalent, or leave it at the default and note it)
229
+
230
+ Then link it as a child of the work item with `mcp__azure-devops__wit_add_child_work_items` (or `wit_work_items_link` with `System.LinkTypes.Hierarchy-Forward`, parent → task).
231
+
232
+ If the create or link call fails, report it and ask whether to implement without a Task or stop. Don't silently continue — the user needs to know hours won't be tracked.
233
+
234
+ Remember the Task ID. Step 10 closes it.
235
+
164
236
  ## Step 5: Implement
165
237
 
166
238
  1. **Implement** using backend and/or frontend agents according to the approved plan
@@ -275,11 +347,13 @@ Wait for the user's response before proceeding. Do NOT create a PR until confirm
275
347
 
276
348
  If the project's process template does not have a `Code Review` state (the update call returns an invalid-state error), fall back in this order: `Resolved` → `In Review` → leave the current state and warn the user that the state could not be advanced automatically. Do not silently swallow the error.
277
349
 
278
- > **PR completion closes the Task only.** When this PR is later completed/merged, only the child **Task** may be closed never the parent User Story or Bug. Azure DevOps's "Complete associated work items" option transitions *every* linked work item (including the parent this PR is linked to), so do **not** enable it when completing the PR. Close the child Task explicitly instead; the parent stays in `Code Review` until QA/UAT and any sibling Tasks are done.
350
+ > **Only the Task ever gets closed — never the parent.** The child Task is closed here, at PR creation (step 4 above). When the PR is later completed/merged, do **not** enable Azure DevOps's "Complete associated work items" option: it transitions *every* linked work item, including the parent this PR is linked to. The parent User Story or Bug stays in `Code Review` until QA/UAT and any sibling Tasks are done.
279
351
 
280
352
  ### Closing Related Tasks
281
353
 
282
- After the PR is created, find every child Task of this work item (relations of type `System.LinkTypes.Hierarchy-Forward` where the target's `System.WorkItemType` is `Task`). Skip this step if there are no child Tasks.
354
+ After the PR is created, find every child Task of this work item (relations of type `System.LinkTypes.Hierarchy-Forward` where the target's `System.WorkItemType` is `Task`).
355
+
356
+ There should be at least one open Task — Step 4 guarantees it. If there are **no** child Tasks at all (the user chose `skip` in Step 4, or the create call failed), create one now so the work that just shipped is recorded: same fields and prefix convention as Step 4, hours proposed the same way, then close it in the same pass. Say plainly that you're creating it after the fact.
283
357
 
284
358
  For each child Task, capture:
285
359
  - ID, title, state
@@ -330,12 +404,15 @@ For each task being processed, prompt for completed hours:
330
404
 
331
405
  **Wait for the user's response on every task.** Accept the suggested/current value (enter), a new numeric value, or `skip` to leave that one untouched.
332
406
 
333
- Once the user has answered, update each task via `wit_update_work_item`:
407
+ Once the user has answered, update each task in a **single** `wit_update_work_item` call per task:
334
408
  - `Microsoft.VSTS.Scheduling.CompletedWork` → the agreed value
335
409
  - `Microsoft.VSTS.Scheduling.RemainingWork` → `0`
410
+ - `Microsoft.VSTS.Scheduling.OriginalEstimate` → only if it is still empty; set it to the agreed completed hours so the Task isn't left with no estimate at all. Never overwrite an estimate that's already there — the gap between estimate and actual is the useful signal.
336
411
  - `System.State` → `Closed` (fall back to `Done` if the project's task template uses Agile; warn if neither is valid)
337
412
 
338
- Confirm with a summary line per task: `Closed AB#xxxx — {hours}h logged`.
413
+ Confirm with a summary line per task: `Closed AB#xxxx — {hours}h logged (estimate was {n}h)`.
414
+
415
+ **The Task closes now, at PR creation — not at merge.** The work is done and the hours are known; waiting until merge means the hours get logged days later, or not at all.
339
416
 
340
417
  ## Feature Workflow (ordered story waves)
341
418
 
@@ -393,6 +470,18 @@ For each wave in ascending order:
393
470
  1. **Explore & plan** each story in the wave (Step 3 rules; Ultracode fan-outs apply per story if opted in). Present **one combined plan** with a section per story — each section covering approach, files, unit tests, and agents — plus a note on any files touched by more than one story in the wave (a conflict warning). **One approval gate per wave**; wait for the user.
394
471
  2. **Implement:**
395
472
  - **Move every story in the wave to `Active`** first (same rules and fallbacks as "Move the Work Item to Active" in Step 4). The Feature's state is never changed.
473
+ - **Ensure each story in the wave has an open child Task** (Step 4's "Ensure an Open Child Task Exists" rules, applied per story — Tasks hang off the stories, never off the Feature). Batch the proposals into **one** table covering the whole wave and take a single approval, so parallel agents never wait on a prompt:
474
+
475
+ ```
476
+ Stories in this wave with no open child Task:
477
+
478
+ | Story | Task title | Hours | Basis |
479
+ |----------|-----------------------------------------|-------|---------|
480
+ | AB#1235 | COM - Implement: export endpoint | 10 | 3 pts |
481
+ | AB#1236 | COM - Implement: export screen | 16 | 5 pts |
482
+
483
+ Create these? (yes / edit N / skip N / skip all)
484
+ ```
396
485
  - **Single-story wave** → implement directly on the feature branch in the main loop (Step 5).
397
486
  - **Multi-story wave** → isolate each story in its own worktree so parallel agents never clobber each other:
398
487
 
@@ -420,6 +509,6 @@ Present **one combined UAT checklist grouped by story** (Step 9 rules). Wait for
420
509
 
421
510
  1. Push the feature branch and create **one PR**: title `AB#{feature-id}: {feature title}`, source `feature/...`, target `BASE_BRANCH`.
422
511
  2. Link the **Feature and every implemented story** to the PR.
423
- 3. Run **Closing Related Tasks** (Step 10) once, covering the child Tasks of every implemented story — one combined table, then the usual per-task hour prompts.
512
+ 3. Run **Closing Related Tasks** (Step 10) once, covering the child Tasks of every implemented story — one combined table, then the usual per-task hour prompts. Every story that got a Task in F4 has one to close here; a story whose Task creation was skipped gets one created and closed now, as in Step 10.
424
513
  4. Move each implemented story to `Code Review` (same fallback rules as Step 10). **Do not change the Feature's state** — the Feature is a parent container; it advances only when its child stories are verified/closed, not when the PR goes up for review.
425
- 5. The Step 10 PR-completion rule applies unchanged: when the PR merges, only child **Tasks** may be closed — never the stories or the Feature.
514
+ 5. The Step 10 closing rule applies unchanged: only child **Tasks** are ever closed — here at PR creation, never the stories and never the Feature. Don't enable "Complete associated work items" when the PR is merged; it would transition the stories and the Feature along with the Tasks.
@@ -232,7 +232,9 @@ Hot Fix work items follow the same automated checks (build, lint, tests, review)
232
232
 
233
233
  Running `/implement` on a **Feature** implements its child User Stories in **waves** driven by the `Custom.Order` field: stories sharing the same order value are implemented **in parallel** (one agent per story, each in an isolated git worktree), and waves run sequentially in ascending order so later stories build on earlier ones. All work merges into a single `feature/AB#<id>-...` branch; quality checks, code review, UAT, and one PR happen at the feature level, and every implemented story is linked to that PR. Stories without a `Custom.Order` value run in a final catch-all wave (flagged for confirmation first).
234
234
 
235
- **Work item states:** `/implement` moves the work item to `Active` when implementation starts — for a single work item (User Story, Bug, Hot Fix) right after the branch is created; for a Feature, each child story goes `Active` as its wave begins. When the PR is created, each implemented child **User Story** moves to `Code Review` — the **Feature's state is never changed**. The Feature is a parent container; it advances only as its child stories are verified/closed. When the PR merges, only child **Tasks** are closed — never the stories or the Feature.
235
+ **Work item states:** `/implement` moves the work item to `Active` when implementation starts — for a single work item (User Story, Bug, Hot Fix) right after the branch is created; for a Feature, each child story goes `Active` as its wave begins. When the PR is created, each implemented child **User Story** moves to `Code Review` — the **Feature's state is never changed**. The Feature is a parent container; it advances only as its child stories are verified/closed. Only child **Tasks** are ever closed — never the stories or the Feature.
236
+
237
+ **Hours live on the Task.** `/implement` will not implement a story that has no open child Task: if there isn't one, it proposes a title and an hour estimate (from the story's points, same mapping `/plan-backlog` uses) and creates it once the user agrees — exactly one per story, inheriting the parent's assignee, area, and iteration. When the PR is created, that Task is closed with the hours worked logged to `CompletedWork` and `RemainingWork` zeroed. Closing happens at **PR creation**, not at merge, so hours are recorded while they're still known. Never enable Azure DevOps's "Complete associated work items" when merging — it transitions the parent too.
236
238
 
237
239
  #### Slash Commands Reference
238
240
 
@@ -240,7 +242,7 @@ All deployment and release operations are available as slash commands:
240
242
 
241
243
  | Command | Usage | What It Does |
242
244
  |---|---|---|
243
- | `/implement` | `/implement AB#1234` | Summarize work item → approve plan → implement → PR. On a Feature: child stories in `Custom.Order` waves, same-order stories in parallel |
245
+ | `/implement` | `/implement AB#1234` | Summarize work item → approve plan → ensure an open child Task with hours → implement → PR (closes the Task, logs hours). On a Feature: child stories in `Custom.Order` waves, same-order stories in parallel |
244
246
  | `/review` | `/review 142` | Automated code review on a PR |
245
247
  | `/resolve-feedback` | `/resolve-feedback 142` | Address unresolved PR comment threads, push fixes, reply + resolve threads |
246
248
  | `/deploy` | `/deploy "commit message"` | Commit, push, trigger pipeline |