@chris1807/claude-kit 2.1.54 → 2.1.55

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.
@@ -2,7 +2,21 @@ Deploy release to the next environment. Usage: `/deploy-release <release-number>
2
2
 
3
3
  Parse `$ARGUMENTS` to extract:
4
4
  - **Release number**: required (e.g., "23" or "#23")
5
- - **Target environment**: optional — if not provided, auto-detect the next environment in the promotion flow
5
+ - **Target environment**: optional — an environment name (`dev`, `test`, `staging`, `prod`/`production`) or its branch. If not provided, auto-detect the next environment in the promotion flow.
6
+
7
+ ## Environment ↔ State Reference
8
+
9
+ Resolve branch names from the project's `CLAUDE.md` **Pipeline Configuration** table — never hardcode them. The first row is the compare branch (`main`; feature PRs target it, **merging into it deploys nothing**); the rows below are the environment branches in promotion order, and a PR merging into one of them is what triggers its pipeline. The standard layout, with the work item state that goes with each environment:
10
+
11
+ | Branch | Environment | Gate — items should already be in… | State set after the PR merges |
12
+ |---|---|---|---|
13
+ | `main` | — (compare branch) | — | — |
14
+ | `dev` | Dev | `Code Review` (merged to `main`) | `Ready for Testing` |
15
+ | `test` | Test | `Ready for Testing` | `Testing` |
16
+ | `staging` | Staging | `Ready for Staging` | `Staging` |
17
+ | `prod` | Production | `Ready to Deploy` | `Deployed` |
18
+
19
+ `Ready for Staging` and `Ready to Deploy` are set by QA and stakeholders — **never by this command**. If the project's table has different environments, confirm the type's states with `mcp__azure-devops__wit_work_item` (`action: get_type`) and map them the same way: a "Ready for X" gate → an "in X" state.
6
20
 
7
21
  ## Step 1: Read the Release
8
22
 
@@ -15,8 +29,8 @@ Present the release contents:
15
29
 
16
30
  | ID | Type | Title | State | Branch |
17
31
  |----|------|-------|-------|--------|
18
- | AB#1234 | User Story | Add payment export | Ready for Testing | story/AB#1234-add-payment-export |
19
- | AB#1235 | Bug | Fix login redirect | Ready for Testing | bugfix/AB#1235-fix-login-redirect |
32
+ | AB#1234 | User Story | Add payment export | Ready for Staging | story/AB#1234-add-payment-export |
33
+ | AB#1235 | Bug | Fix login redirect | Ready for Staging | bugfix/AB#1235-fix-login-redirect |
20
34
 
21
35
  {count} work items in this release.
22
36
  ```
@@ -25,18 +39,42 @@ If no work items are found, STOP and report the error.
25
39
 
26
40
  ## Step 2: Determine Target Environment
27
41
 
28
- If the user specified an environment, use it. Otherwise, auto-detect by checking which environment the work items are currently in:
42
+ If the user specified an environment, use it. Otherwise auto-detect: find the **furthest** branch in the Pipeline Configuration table that already contains the work items' commits (`repo_search_commits` with `includeWorkItems: true`, or `git merge-base --is-ancestor <commit> origin/<branch>`), and target the **next row down**:
29
43
 
30
- | Current State | Next Environment |
44
+ | Work items' commits are on… | Next target |
31
45
  |---|---|
32
- | Work items merged to `develop` | Deploy to **staging** |
33
- | Work items merged to `staging` | Deploy to **production** |
46
+ | `main` only | `dev` |
47
+ | `dev` | `test` |
48
+ | `test` | `staging` |
49
+ | `staging` | `prod` |
50
+ | `prod` | Nothing — report that the release is fully deployed and stop |
51
+
52
+ **Validation:** Verify all work items in the release have commits on the same source branch. If they are inconsistent (e.g., AB#1234 is on `test` but AB#1235 has nothing past `main`), present a warning listing which work items are on which branches and ask the user to confirm the target environment explicitly.
53
+
54
+ ## Step 3: Gate Check
34
55
 
35
- Check which environment branches contain the commits for these work items using `repo_search_commits` with `includeWorkItems: true`.
56
+ Compare each work item's `System.State` with the gate for the target environment. Sort into three buckets:
36
57
 
37
- **Validation:** Verify all work items in the release have commits on the same source branch. If they are inconsistent (e.g., AB#1234 is on `develop` but AB#1235 has no commits), present a warning listing which work items are on which branches and ask the user to confirm the target environment explicitly.
58
+ - **At the gate** — proceed silently.
59
+ - **Behind the gate** (e.g. still `Testing` when the target is `staging`, or `Active` when the target is `test`) — QA or a stakeholder hasn't signed off yet.
60
+ - **Ahead of the gate** (e.g. already `Deployed`, or `Staging` when the target is `test`) — it has already been through this environment; a redeploy is usually harmless but worth knowing.
38
61
 
39
- Confirm with the user:
62
+ Features and Tasks aren't carried by state — list them and skip the check. If anything is behind or ahead, show it before asking to proceed:
63
+
64
+ ```
65
+ ⚠ Gate check for {environment} (expects `{gate state}`):
66
+
67
+ | ID | State | Note |
68
+ |----|-------|------|
69
+ | AB#1236 | Testing | behind — QA hasn't marked it Ready for Staging |
70
+ | AB#1240 | Deployed | ahead — already in production |
71
+
72
+ Include them anyway, or drop them from this deploy? (include / drop / cancel)
73
+ ```
74
+
75
+ Wait for the answer. `drop` removes them from **this deploy only** — they stay in the release.
76
+
77
+ ## Step 4: Confirm
40
78
 
41
79
  ```
42
80
  Deploy Release #{N} ({count} work items) to {environment}?
@@ -44,16 +82,15 @@ Deploy Release #{N} ({count} work items) to {environment}?
44
82
  This will:
45
83
  1. Create a release branch: release/{N}-to-{environment}
46
84
  2. Cherry-pick all commits for the {count} work items
47
- 3. Create a PR targeting the {environment} branch
85
+ 3. Create a PR targeting `{target-branch}` — merging it triggers the {environment} pipeline
86
+ 4. After you confirm the merge, move the work items to `{state after merge}`
48
87
 
49
88
  Proceed? (yes/no)
50
89
  ```
51
90
 
52
91
  Wait for confirmation.
53
92
 
54
- ## Step 3: Create Release Branch
55
-
56
- Determine the target environment branch. Do NOT hardcode branch names — check the project's CLAUDE.md or use the branch-to-environment mapping:
93
+ ## Step 5: Create Release Branch
57
94
 
58
95
  ```bash
59
96
  # Switch to the target environment branch and pull latest
@@ -64,7 +101,7 @@ git pull origin <target-environment-branch>
64
101
  git checkout -b release/{N}-to-<environment>
65
102
  ```
66
103
 
67
- ## Step 4: Cherry-Pick Work Item Commits
104
+ ## Step 6: Cherry-Pick Work Item Commits
68
105
 
69
106
  For each work item in the release:
70
107
 
@@ -89,7 +126,7 @@ Options:
89
126
  Which option? (1 / 2 / 3)
90
127
  ```
91
128
 
92
- - **Option 1:** Run `git cherry-pick --skip` and continue. Note the skipped item in the summary.
129
+ - **Option 1:** Run `git cherry-pick --skip` and continue. Note the skipped item in the summary — it does **not** get its state advanced in Step 9.
93
130
  - **Option 2:** Run `git cherry-pick --abort`, delete the release branch, switch back. Report which items were NOT deployed.
94
131
  - **Option 3:** Wait for the user to resolve and run `git cherry-pick --continue`, then proceed.
95
132
 
@@ -102,7 +139,7 @@ Cherry-picking commits for Release #{N}:
102
139
  [ ] AB#1236: View history (2 commits) — CONFLICT
103
140
  ```
104
141
 
105
- ## Step 5: Push and Create PR
142
+ ## Step 7: Push and Create PR
106
143
 
107
144
  1. Push the release branch: `git push -u origin HEAD`
108
145
  2. Create a PR via Azure DevOps MCP:
@@ -112,7 +149,7 @@ Cherry-picking commits for Release #{N}:
112
149
  - **description**: List all work items included with their IDs and titles
113
150
  3. Link all work items to the PR via `wit_link_work_item_to_pull_request`
114
151
 
115
- ## Step 6: Present Summary
152
+ ## Step 8: Present Summary and Wait for the Merge
116
153
 
117
154
  ```
118
155
  Release #{N} PR created for {environment}.
@@ -127,13 +164,39 @@ Work items included:
127
164
 
128
165
  Next steps:
129
166
  - Review and approve the PR
130
- - Merge triggers the CD pipeline for {environment}
131
- - Update work item states in Azure DevOps after merge
167
+ - Merging it triggers the CD pipeline for {environment}
168
+ - Reply `merged` once the PR is complete and the pipeline is green — I'll move these {count} work items to `{state after merge}`. (Or `skip` to leave the states alone.)
169
+ ```
170
+
171
+ Do NOT trigger the CD pipeline — it triggers automatically on PR merge. Do NOT merge the PR yourself.
172
+
173
+ ## Step 9: Advance Work Item States (after `merged`)
174
+
175
+ When the user replies `merged`:
176
+
177
+ 1. **Confirm the PR is actually completed** via the Azure DevOps MCP (`status: completed`). If it isn't, say so and wait — never advance states for an unmerged PR.
178
+ 2. For every carried work item of type **User Story**, **Bug**, or **Hot Fix**, set `System.State` to the target environment's state (`Ready for Testing` / `Testing` / `Staging` / `Deployed`) via `wit_update_work_item` (or the batch variant).
179
+ - **Never move backward.** An item already past the target state (e.g. `Deployed` when deploying to `staging`) keeps its state; note it.
180
+ - **Never touch a Feature or Task.** Features advance as their stories do; Tasks were closed at PR creation.
181
+ - Items skipped in Step 6 (conflict) or dropped in Step 3 are not on the branch — leave them alone.
182
+ - An invalid-state error means this project's template differs — confirm with `get_type`, report the item, continue with the rest. Don't silently swallow it.
183
+ 3. Report:
184
+
185
+ ```
186
+ Release #{N} is on {environment}.
187
+
188
+ | ID | Was | Now |
189
+ |----|-----|-----|
190
+ | AB#1234 | Ready for Staging | Staging |
191
+ | AB#1235 | Ready for Staging | Staging |
192
+ | AB#1240 | Deployed | Deployed (unchanged — already ahead) |
193
+
194
+ Next: {the human step — "QA tests on Test and sets Ready for Staging" / "stakeholders verify on Staging and set Ready to Deploy" / "verify in production, then Close"}.
132
195
  ```
133
196
 
134
- Do NOT trigger the CD pipeline — it triggers automatically on PR merge.
197
+ If the user replies `skip`, leave the states alone and note that `/status release {N}` will flag the lag later.
135
198
 
136
- ## Step 7: Notify Team (if Teams MCP is configured)
199
+ ## Step 10: Notify Team (if Teams MCP is configured)
137
200
 
138
201
  Send a notification to the project's Teams channel via the Microsoft Teams MCP server:
139
202
 
@@ -11,16 +11,16 @@ Commit, push, and deploy the current changes. Usage: `/deploy [message]`
11
11
 
12
12
  | File family | Parallel files to check |
13
13
  |-------------|------------------------|
14
- | `appsettings.json` | `appsettings.Development.json`, `appsettings.Staging.json`, `appsettings.QA.json`, `appsettings.Production.json` |
15
- | `.env` | `.env.development`, `.env.staging`, `.env.qa`, `.env.production`, `.env.local`, `.env.example` |
14
+ | `appsettings.json` | `appsettings.Development.json`, `appsettings.Test.json`, `appsettings.QA.json`, `appsettings.Staging.json`, `appsettings.Production.json` |
15
+ | `.env` | `.env.development`, `.env.test`, `.env.qa`, `.env.staging`, `.env.production`, `.env.local`, `.env.example` |
16
16
 
17
17
  Present a table of new/changed keys and which environment files contain them. If any are missing, STOP and prompt:
18
18
 
19
19
  ```
20
20
  ⚠ The following keys are missing from one or more environment files:
21
21
 
22
- | Key | Dev | Staging | QA | Prod |
23
- |-----|-----|---------|----|----- |
22
+ | Key | Dev | Test | Staging | Prod |
23
+ |-----|-----|------|---------|------|
24
24
  | Foo:Bar | ✅ | ❌ | ❌ | ❌ |
25
25
 
26
26
  Add values (real, placeholder, or empty) for the missing environments before pushing?
@@ -70,10 +70,11 @@ Push only the current branch. Do NOT cross-push to other branches.
70
70
 
71
71
  ## Step 5: Pipeline (Conditional)
72
72
 
73
- Check if the current branch is an environment branch (a branch that a CD pipeline watches):
73
+ Look the current branch up in the project's `CLAUDE.md` **Pipeline Configuration** table:
74
74
 
75
- - **On an environment branch**: Trigger the appropriate CD pipeline via Azure DevOps MCP. Monitor the build and report status.
76
- - **On a feature/work branch**: Do NOT trigger. Report that the pipeline will trigger on PR merge.
75
+ - **On an environment branch** (`dev`, `test`, `staging`, `prod` — a row with pipeline IDs): Trigger the listed CD pipeline(s) via Azure DevOps MCP. Monitor the build and report status.
76
+ - **On `main`** (the compare branch — its pipeline cell is `—`): Do NOT trigger anything. **Merging or pushing to `main` never deploys.** Report that the change is on `main` and will deploy when `main` is promoted to `dev` (`/promote main dev`).
77
+ - **On a feature/work branch**: Do NOT trigger. Report that the pipeline will trigger when the work is promoted after the PR merges.
77
78
 
78
79
  ## Step 6: Report
79
80
 
@@ -82,5 +83,5 @@ Deployed successfully.
82
83
 
83
84
  Branch: {branch}
84
85
  Commit: {hash} - {message}
85
- Pipeline: {triggered | will trigger on PR merge}
86
+ Pipeline: {triggered | none — main deploys nothing; promote to dev | will trigger when promoted after PR merge}
86
87
  ```
@@ -168,7 +168,7 @@ Show the field-level diff for every story marked **Update**, and the full draft
168
168
 
169
169
  ## Step 5: Safety Gate — In-Flight Work
170
170
 
171
- Before asking for approval, check the state of everything you propose to write and flag anything that is **past `Dev Ready`** in the workflow (`Active`, `Code Review`, `Ready for Testing`, `Testing`, `Ready to Deploy`, `Deployed`, `Closed`) or has a **linked pull request**.
171
+ Before asking for approval, check the state of everything you propose to write and flag anything that is **past `Dev Ready`** in the workflow (`Active`, `Code Review`, `Ready for Testing`, `Testing`, `Ready for Staging`, `Staging`, `Ready to Deploy`, `Deployed`, `Closed`) or has a **linked pull request**.
172
172
 
173
173
  Editing the acceptance criteria of a story that is already implemented silently invalidates a PR that was reviewed against the old criteria. So for each such item, call it out explicitly:
174
174
 
@@ -269,8 +269,8 @@ Run a build check **before** any other quality checks. Use the `build-validator`
269
269
 
270
270
  | File family | Parallel files to check |
271
271
  |-------------|------------------------|
272
- | `appsettings.json` | `appsettings.Development.json`, `appsettings.Staging.json`, `appsettings.QA.json`, `appsettings.Production.json` |
273
- | `.env` | `.env.development`, `.env.staging`, `.env.qa`, `.env.production`, `.env.local`, `.env.example` |
272
+ | `appsettings.json` | `appsettings.Development.json`, `appsettings.Test.json`, `appsettings.QA.json`, `appsettings.Staging.json`, `appsettings.Production.json` |
273
+ | `.env` | `.env.development`, `.env.test`, `.env.qa`, `.env.staging`, `.env.production`, `.env.local`, `.env.example` |
274
274
 
275
275
  Present a (key × environment) table. For every missing cell, prompt the user for a value (real, placeholder, or empty) **before creating the PR**. The PR should not be opened until every environment file is accounted for, or the user explicitly confirms the omission is intentional (e.g., the key is supplied via a pipeline variable group, Key Vault, or App Configuration for that environment).
276
276
 
@@ -362,7 +362,7 @@ Wait for the user's response before proceeding. Do NOT create a PR until confirm
362
362
 
363
363
  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.
364
364
 
365
- > **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.
365
+ > **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 it is promoted: merging this PR into `main` deploys nothing, and the item advances to `Ready for Testing` → `Testing` → `Staging` → `Deployed` as `/promote` and `/deploy-release` carry it through `dev → test → staging → prod` (see **Work Item States ↔ Environments** in CLAUDE.md).
366
366
 
367
367
  ### Closing Related Tasks
368
368
 
@@ -54,7 +54,7 @@ FROM WorkItems
54
54
  WHERE [System.TeamProject] = '{project}'
55
55
  AND [System.WorkItemType] IN ('User Story', 'Bug')
56
56
  AND [System.IterationPath] UNDER '{current sprint iteration path}'
57
- AND [System.State] NOT IN ('Closed', 'Removed', 'Done', 'Resolved', 'Code Review', 'Ready to Deploy', 'Deployed')
57
+ AND [System.State] NOT IN ('Closed', 'Removed', 'Done', 'Resolved', 'Code Review', 'Ready for Testing', 'Testing', 'Ready for Staging', 'Staging', 'Ready to Deploy', 'Deployed')
58
58
  ORDER BY [Microsoft.VSTS.Common.StackRank] ASC
59
59
  ```
60
60
 
@@ -1,31 +1,48 @@
1
1
  Promote all code from one environment to the next. Usage: `/promote [source] [target]`
2
2
 
3
3
  Parse `$ARGUMENTS` to extract:
4
- - **Source environment**: optional (e.g., "develop", "staging"). If omitted, auto-detect.
5
- - **Target environment**: optional. If omitted, use the next environment in the promotion flow.
4
+ - **Source**: optional — an environment or branch name (`main`, `dev`, `test`, `staging`). If omitted, auto-detect from the current branch.
5
+ - **Target**: optional — the environment to promote into. If omitted, use the next row in the promotion flow.
6
+
7
+ ## Environment ↔ State Reference
8
+
9
+ Resolve branch names from the project's `CLAUDE.md` **Pipeline Configuration** table — never hardcode them. The first row is the compare branch (`main`; feature PRs target it, **merging into it deploys nothing**); the rows below are the environment branches in promotion order, and a PR merging into one of them is what triggers its pipeline:
10
+
11
+ | Branch | Environment | Gate — items should already be in… | State set after the PR merges |
12
+ |---|---|---|---|
13
+ | `main` | — (compare branch) | — | — |
14
+ | `dev` | Dev | `Code Review` (merged to `main`) | `Ready for Testing` |
15
+ | `test` | Test | `Ready for Testing` | `Testing` |
16
+ | `staging` | Staging | `Ready for Staging` | `Staging` |
17
+ | `prod` | Production | `Ready to Deploy` | `Deployed` |
18
+
19
+ `Ready for Staging` and `Ready to Deploy` are set by QA and stakeholders — **never by this command**.
6
20
 
7
21
  ## Step 1: Determine Source and Target
8
22
 
9
- If not specified, auto-detect based on the current branch:
23
+ Read the Pipeline Configuration table. If it is missing, fall back to `git branch -r` and ask the user to confirm the pair. If not specified, auto-detect based on the current branch:
10
24
 
11
25
  | Current Branch | Source | Target |
12
26
  |---|---|---|
13
- | `develop` | develop | staging |
14
- | `staging` | staging | production branch |
27
+ | `main` | main | dev |
28
+ | `dev` | dev | test |
29
+ | `test` | test | staging |
30
+ | `staging` | staging | prod |
31
+ | `prod` | — | Nothing above production — report and stop |
32
+ | a feature/work branch | — | Ask which pair to promote |
15
33
 
16
- If both are specified (e.g., `/promote staging production`), use those directly.
34
+ If both are specified (e.g., `/promote staging prod`), use those directly. Accept environment names (`production`, `Dev`) as well as branch names and map them through the table. Refuse to promote **backward** (e.g. `prod → staging`) — that is `/rollback`'s job.
17
35
 
18
- Determine the actual branch names — do NOT hardcode. Check the project's CLAUDE.md or use `git branch -r` to find matching environment branches.
36
+ `main → dev` is the usual first hop: it carries every feature PR that has merged into `main` and gives it its first deployment.
19
37
 
20
38
  ## Step 2: Show What Will Be Promoted
21
39
 
22
- Compare the source and target branches to show what's new:
23
-
24
40
  ```bash
25
- git log <target-branch>..<source-branch> --oneline
41
+ git fetch origin <source-branch> <target-branch>
42
+ git log origin/<target-branch>..origin/<source-branch> --oneline
26
43
  ```
27
44
 
28
- Present the changes:
45
+ Present the changes, resolving work items from `AB#` references in commit messages (or `repo_search_commits` with `includeWorkItems: true`):
29
46
 
30
47
  ```
31
48
  ## Promote {source} → {target}
@@ -38,14 +55,33 @@ Commits to promote:
38
55
  | ghi9012 | Update dashboard | AB#1236 |
39
56
 
40
57
  {count} commits will be promoted from {source} to {target}.
41
- Promote? (yes/no)
42
58
  ```
43
59
 
44
- If there are no new commits, report that the environments are already in sync.
60
+ If there are no new commits, report that the environments are already in sync and stop.
45
61
 
46
- Wait for confirmation.
62
+ ## Step 3: Gate Check
47
63
 
48
- ## Step 3: Create PR
64
+ Fetch each referenced work item and compare its `System.State` with the target's gate. Promotion carries **everything** on the source branch, so an item behind the gate can't be dropped — the choice is to proceed, or to stop and use `/deploy-release` / `/cherry-pick` for a subset:
65
+
66
+ ```
67
+ ⚠ Gate check for {target} (expects `{gate state}`):
68
+
69
+ | ID | State | Note |
70
+ |----|-------|------|
71
+ | AB#1236 | Testing | behind — QA hasn't marked it Ready for Staging |
72
+
73
+ /promote carries the whole branch. Options:
74
+ 1. Promote anyway (AB#1236 goes to {target} too)
75
+ 2. Stop — use /deploy-release or /cherry-pick for just the ready items
76
+
77
+ Which? (1 / 2)
78
+ ```
79
+
80
+ For `main → dev` the gate is `Code Review`: an item still at `Code Review` whose commits are on `main` has had its PR merged, which is exactly right — not a warning. Features and Tasks are skipped. Items *ahead* of the gate are reported and left alone.
81
+
82
+ Then confirm: `Promote {count} commits from {source} to {target}? (yes/no)` — and wait.
83
+
84
+ ## Step 4: Create PR
49
85
 
50
86
  Create a PR directly from the source branch to the target branch via Azure DevOps MCP:
51
87
 
@@ -54,18 +90,32 @@ Create a PR directly from the source branch to the target branch via Azure DevOp
54
90
  - **title**: `Promote {source} → {target}`
55
91
  - **description**: List all commits and associated work items being promoted
56
92
 
57
- Link any associated work items to the PR.
93
+ Link the associated work items to the PR.
58
94
 
59
- ## Step 4: Present Summary
95
+ ## Step 5: Present Summary and Wait for the Merge
60
96
 
61
97
  ```
62
98
  Promotion PR created: {source} → {target}
63
99
 
64
100
  PR: {pr-url}
65
101
 
66
- {count} commits included.
67
- Merge the PR to trigger the CD pipeline for {target}.
68
- Remember to update work item states in Azure DevOps after merge.
102
+ {count} commits, {n} work items included.
103
+ Merging the PR triggers the CD pipeline for {target}.
104
+
105
+ Reply `merged` once the PR is complete and the pipeline is green — I'll move the {n} work items to `{state after merge}`. (Or `skip` to leave the states alone.)
69
106
  ```
70
107
 
71
108
  Do NOT merge the PR automatically — the user or a reviewer must approve and merge.
109
+
110
+ ## Step 6: Advance Work Item States (after `merged`)
111
+
112
+ When the user replies `merged`:
113
+
114
+ 1. **Confirm the PR is actually completed** via the Azure DevOps MCP. If it isn't, say so and wait — never advance states for an unmerged PR.
115
+ 2. For every carried work item of type **User Story**, **Bug**, or **Hot Fix**, set `System.State` to the target's state (`Ready for Testing` / `Testing` / `Staging` / `Deployed`) via `wit_update_work_item`.
116
+ - **Never move backward** — an item already past the target state keeps it; note it.
117
+ - **Never touch a Feature or Task.**
118
+ - An invalid-state error means this project's template differs — confirm with `get_type`, report the item, continue with the rest. Don't silently swallow it.
119
+ 3. Report a `Was → Now` table per item and the next human step (QA sets `Ready for Staging`; stakeholders set `Ready to Deploy`; verify in production, then `Closed`).
120
+
121
+ If the user replies `skip`, leave the states alone and note that `/status` will flag the lag later.
@@ -372,7 +372,7 @@ Only for approved items, in batch order:
372
372
  2. **Send unquotable User Stories back to Design Review** (approved `User Story` items with **no** proposed points, where the blocker is missing information): set `System.State` = `Design Review` via `mcp__azure-devops__wit_update_work_item`. Do this **before** posting the comment in step 4, so the creator's notification arrives with the item already back in their queue. Rules:
373
373
 
374
374
  - **`User Story` only.** Do not attempt this on a `Bug` or a `Hot Fix` — those types have no `Design Review` state, so the update fails at runtime in the middle of the batch. They take step 3 instead.
375
- - Only from `Design Approved` — **never move an item backward past the design stage.** An item at `Dev Ready`, or anything at `Active` or later (`Active`, `Code Review`, `Ready for Testing`, `Testing`, `Ready to Deploy`, …), keeps its state; note it in the summary instead.
375
+ - Only from `Design Approved` — **never move an item backward past the design stage.** An item at `Dev Ready`, or anything at `Active` or later (`Active`, `Code Review`, `Ready for Testing`, `Testing`, `Ready for Staging`, `Staging`, `Ready to Deploy`, …), keeps its state; note it in the summary instead.
376
376
  - Skip items whose only finding is **needs to be split** — the work is understood, so nothing is missing; leave those in `Design Approved`.
377
377
  - If the item is already in `Design Review`, this is a no-op — post the comment and move on.
378
378
  - If this project's `User Story` type has no `Design Review` state either (the update returns an invalid-state error), fall back in this order: `In Design` → the `needs-info` tag from step 3 → leave the item alone and **warn the user** that it will be picked up again by the next sweep. Do not silently swallow the error.
@@ -114,7 +114,7 @@ Only update the work item if the user explicitly says yes. Do not modify anythin
114
114
  When the user agrees, in the **same** `wit_update_work_item` call:
115
115
 
116
116
  1. Set `Microsoft.VSTS.Scheduling.StoryPoints` to the agreed value (the user's number wins if they adjusted it).
117
- 2. Set `System.State` to `Dev Ready` — **but only if** the work item type is `User Story`, `Bug`, or `Hot Fix` **and** the item is not already past Dev Ready in the workflow (e.g. `Active`, `Code Review`, `Ready to Deploy`). Never move an item backward — if it's already past Dev Ready, set the points only and mention the state was left alone.
117
+ 2. Set `System.State` to `Dev Ready` — **but only if** the work item type is `User Story`, `Bug`, or `Hot Fix` **and** the item is not already past Dev Ready in the workflow (e.g. `Active`, `Code Review`, `Testing`, `Staging`, `Ready to Deploy`). Never move an item backward — if it's already past Dev Ready, set the points only and mention the state was left alone.
118
118
 
119
119
  **Never change the state of a Feature or a Task** — if the sized item is a Feature, persist points only (or per-child points on the children, each of which does get Dev Ready if it qualifies).
120
120
 
@@ -128,7 +128,7 @@ When the item came out of Step 2 as **needs more information**, offer to drop it
128
128
  | `Bug`, `Hot Fix` | Add a **`needs-info` tag**; leave the state at `New` | 5b |
129
129
  | `Feature`, `Task` | Neither — report the gap and stop | — |
130
130
 
131
- In the CSI Development process template, `Bug` and `Hot Fix` have **no design states at all** — the workflow is `New` → `Dev Ready` → `Active` → `Code Review` → …, with neither `Design Review` nor `Design Approved`. `New` is the bottom of that workflow, so there is nowhere to send a bug back to; the tag is what keeps `/quote-backlog` from re-analyzing it. On an unfamiliar project, confirm the type's real states with `mcp__azure-devops__wit_work_item` (`action: get_type`, `workItemType: Bug`) and read the `states` array — don't infer a state name from what the workflow "should" have. A bad state name is accepted by a query (zero rows, no error) and rejected only at write time.
131
+ In the CSI Development process template, `Bug` and `Hot Fix` have **no design states at all** — the workflow is `New` → `Dev Ready` → `Active` → `Code Review` → `Ready for Testing` → `Testing` → `Ready for Staging` → `Staging` → `Ready to Deploy` → `Deployed` → `Closed`, with neither `Design Review` nor `Design Approved`. `New` is the bottom of that workflow, so there is nowhere to send a bug back to; the tag is what keeps `/quote-backlog` from re-analyzing it. On an unfamiliar project, confirm the type's real states with `mcp__azure-devops__wit_work_item` (`action: get_type`, `workItemType: Bug`) and read the `states` array — don't infer a state name from what the workflow "should" have. A bad state name is accepted by a query (zero rows, no error) and rejected only at write time.
132
132
 
133
133
  ### 5a. User Story → Design Review
134
134
 
@@ -137,7 +137,7 @@ In the CSI Development process template, `Bug` and `Hot Fix` have **no design st
137
137
  **Wait for the user.** Only update the work item if they say yes. Then set `System.State` = `Design Review` with `mcp__azure-devops__wit_update_work_item`. Rules:
138
138
 
139
139
  - **`User Story` only** — never a Bug, Hot Fix, Feature, or Task. A Bug takes 5b; the update would fail on it anyway.
140
- - **Never move an item backward past the design stage.** Only from `Design Approved`; if it's already `Dev Ready` or anything at `Active` or later (`Active`, `Code Review`, `Ready for Testing`, `Testing`, `Ready to Deploy`, …), leave the state alone and say so — someone is already working on it, and a state bounce there does real damage.
140
+ - **Never move an item backward past the design stage.** Only from `Design Approved`; if it's already `Dev Ready` or anything at `Active` or later (`Active`, `Code Review`, `Ready for Testing`, `Testing`, `Ready for Staging`, `Staging`, `Ready to Deploy`, …), leave the state alone and say so — someone is already working on it, and a state bounce there does real damage.
141
141
  - Already in `Design Review` → no-op; say it's already there.
142
142
  - No `Design Review` state for `User Story` in this process template (the update returns an invalid-state error) → fall back in this order: `In Design` → the `needs-info` tag from 5b → leave the state alone and **warn** that the item will keep surfacing in backlog sweeps. Don't swallow the error.
143
143
  - Set **no** story points and touch no other field — assignee, iteration, and tags stay as they are.
@@ -52,7 +52,7 @@ Review PR #$ARGUMENTS in the current project. Automatically:
52
52
  - Error handling (are exceptions caught appropriately?)
53
53
  - Naming conventions and code style consistency
54
54
  - Breaking changes or backwards compatibility issues
55
- - **Environment configuration parity** — if the diff adds or changes any key in `appsettings.*.json` or `.env*`, every parallel environment file (Development/Staging/QA/Production for backend; `.env.development`/`.env.staging`/`.env.production`/`.env.example` for React) must have a corresponding entry, or the omission must be called out in the PR description. Build a table of (key × environment) and flag any missing cell as **critical**. Pipeline variable groups, Key Vault, or App Configuration wiring counts as a valid source for a given environment — verify it exists rather than assume it.
55
+ - **Environment configuration parity** — if the diff adds or changes any key in `appsettings.*.json` or `.env*`, every parallel environment file (Development/Test/QA/Staging/Production for backend; `.env.development`/`.env.test`/`.env.staging`/`.env.production`/`.env.example` for React) must have a corresponding entry, or the omission must be called out in the PR description. Build a table of (key × environment) and flag any missing cell as **critical**. Pipeline variable groups, Key Vault, or App Configuration wiring counts as a valid source for a given environment — verify it exists rather than assume it.
56
56
  - **Rework-specific (if applicable):** does this diff fully address every item in the rework feedback? Does it regress anything that prior merged PRs delivered?
57
57
 
58
58
  6. **Draft (do not post yet) the inline comments** for every finding. For each, capture: file path, line number, severity, and the exact comment body you intend to post.
@@ -264,7 +264,7 @@ Run a build check **before** any other quality checks. Use the `build-validator`
264
264
 
265
265
  1. **Run the full test suite** — every unit test in the repo, plus integration tests. Not just the tests added in this rework. A failure in an unrelated test means this rework broke something else; treat it as a regression, fix it, and re-run until the entire suite is green
266
266
  2. **Run lint** — ESLint and dotnet format
267
- 3. **Environment configuration parity** — if the rework added or changed any key in `appsettings.*.json` or `.env*`, verify every parallel environment file (Development/Staging/QA/Production for backend; `.env.development`/`.env.staging`/`.env.production`/`.env.example` for React — whichever exist in the repo) has a corresponding entry. Present a (key × environment) table. Prompt the user to fill in any missing values (real, placeholder, or empty) **before pushing**, or to explicitly confirm the omission is intentional (e.g., supplied via a pipeline variable group, Key Vault, or App Configuration).
267
+ 3. **Environment configuration parity** — if the rework added or changed any key in `appsettings.*.json` or `.env*`, verify every parallel environment file (Development/Test/QA/Staging/Production for backend; `.env.development`/`.env.test`/`.env.staging`/`.env.production`/`.env.example` for React — whichever exist in the repo) has a corresponding entry. Present a (key × environment) table. Prompt the user to fill in any missing values (real, placeholder, or empty) **before pushing**, or to explicitly confirm the omission is intentional (e.g., supplied via a pipeline variable group, Key Vault, or App Configuration).
268
268
  4. **Acceptance Criteria check** — re-read the work item's full Acceptance Criteria (the same list captured in Step 3). For each AC, identify the test or piece of code that proves it's met. If any AC has no covering test or visible code path, flag it before moving on.
269
269
 
270
270
  > **Ultracode (if opted in):** Fan out this check with `Workflow` — one read-only agent per acceptance criterion, each returning `{ac, covered: bool, evidence, gap?}`. Collect the results in the main loop and act on any `covered: false`.
@@ -350,7 +350,7 @@ Wait for the user's response before proceeding. Do NOT push until confirmed.
350
350
 
351
351
  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. Do not silently swallow the error.
352
352
 
353
- > **PR completion closes the Task only.** When the 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 the 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.
353
+ > **PR completion closes the Task only.** When the 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 the 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 it is promoted through `dev → test → staging → prod` (see **Work Item States ↔ Environments** in CLAUDE.md).
354
354
 
355
355
  ### Closing Related Tasks
356
356
 
@@ -2,11 +2,11 @@ Roll back a deployment in an environment. Usage: `/rollback <work-item-ids-or-co
2
2
 
3
3
  Parse `$ARGUMENTS` to extract:
4
4
  - **What to revert**: work item IDs (e.g., "AB#1234") or commit hashes, or "last" for the most recent deployment
5
- - **Target environment**: the environment to roll back (e.g., "staging", "production")
5
+ - **Target environment**: the environment to roll back (`dev`, `test`, `staging`, `prod`/`production`)
6
6
 
7
7
  ## Step 1: Identify What to Revert
8
8
 
9
- Determine the target environment branch. Do NOT hardcode branch names.
9
+ Determine the target environment branch from the project's `CLAUDE.md` **Pipeline Configuration** table (`dev`, `test`, `staging`, `prod`). Do NOT hardcode branch names. `main` is the compare branch, not an environment — reverting there deploys nothing; if the user asks to roll back `main`, explain that and ask which environment they actually mean (or confirm they want the code removed from `main` too, so it doesn't come back on the next promotion).
10
10
 
11
11
  If the user specified:
12
12
  - **Work item IDs**: Find the associated commits on the environment branch using `repo_search_commits` with `includeWorkItems: true`
@@ -86,9 +86,13 @@ Reverted:
86
86
  - AB#1235: Fix login redirect
87
87
 
88
88
  Merge the PR to trigger the CD pipeline and deploy the rollback.
89
+
90
+ Work items reverted from {environment}: AB#1234, AB#1235 — their state still says `{current state}`.
91
+ The fix will need to go through main → dev → test → staging → prod again, so move them back to `Active`
92
+ (or leave them and open a new Bug) — your call; I won't change states on a rollback.
89
93
  ```
90
94
 
91
- For production rollbacks, flag urgency to the user.
95
+ For production rollbacks, flag urgency to the user. If the reverted commits are also on `main` (they usually are), remind the user that the next `/promote` will bring them back unless the revert is also applied to `main` — offer `/cherry-pick` of the revert commit to `main`.
92
96
 
93
97
  ## Step 7: Notify Team (if Teams MCP is configured)
94
98