@skitterbyte/skitterspec-azure-boards 3.2.4 → 3.2.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.
@@ -195,6 +195,12 @@ a `Why`: that field is for a run that did not do what it set out to.
195
195
  worktree still stands — on a cancelled spec that worktree may hold the only copy
196
196
  of the work, so an unreclaimed one is worth a line rather than a silence.
197
197
 
198
+ **An epic member's `Next` is `/spec-epic-next <epic>`**, with the epic named
199
+ from the spec's `> **Epic:**` header, read before teardown. Never write a bare
200
+ `/spec-epic-next`: it resolves its epic from the worktree you stand in, and
201
+ teardown has removed it. A cancel records nothing for that bare form to fall
202
+ back on, because only a landed member does.
203
+
198
204
  ## 7. Tear down the environment (opt-in, only if configured)
199
205
 
200
206
  **Only when `specs/.core/env.config.json` exists**, offer — don't force — to
@@ -308,9 +308,14 @@ about another spec followed from it. `Next` is one action for this spec, and
308
308
 
309
309
  **An epic member is the one exception to that `Next`.** When the spec carries
310
310
  `> **Epic:**`, its own work is done and the next thing for that work is its
311
- epic's: `Next` is **`/spec-epic-next`**, which names the member that can start
312
- now. Name the command and nothing else — which members are ready is that
313
- skill's to read, and listing them here is the survey this section forbids.
311
+ epic's: `Next` is **`/spec-epic-next <epic>`**, with the epic named from that
312
+ header, which names the member that can start now.
313
+ **Read the header before step 7 tears the worktree down.** A bare `/spec-epic-next` resolves its epic
314
+ from the worktree you stand in, and teardown has just removed it and moved the
315
+ session to the primary checkout. Name the command and nothing else — which
316
+ members are ready is that skill's to read, and listing them here is the survey
317
+ this section forbids. An autonomous run that ends here reports this same
318
+ `Next`.
314
319
 
315
320
  `Landed` says how, because the two ways differ: a fast-forward names the base
316
321
  and the commit, a hotfix names the release tag, whether it was pushed, and the
@@ -25,7 +25,10 @@ skitterspec epic status [<epic>] --json
25
25
 
26
26
  Pass the epic when the invocation names one. Bare, the engine resolves it from
27
27
  the worktree you are standing in — the epic's own, or a member's (its
28
- `> **Epic:**` header). When it resolves nothing (`epic: null`), stop with `⏸`
28
+ `> **Epic:**` header). If neither applies, it falls back to the epic of the
29
+ last member landed and torn down on this machine, while that epic still has
30
+ open members, and answers `via: "last-completed-member"`. Say so in `Notes`.
31
+ When it resolves nothing (`epic: null`), stop with `⏸`
29
32
  and name `/spec-epic-next <epic>` in `Next`, with the epics its `inFlight`
30
33
  lists as the candidates. **Never pick an epic from conversation**: a
31
34
  spec discussed is not the epic in hand, and the engine already knows where you
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skitterbyte/skitterspec-azure-boards",
3
- "version": "3.2.4",
3
+ "version": "3.2.6",
4
4
  "description": "Spec-driven development for Claude Code, with one-way Azure Boards sync — a superset of @skitterbyte/skitterspec: the base filesystem workflow plus /spec-status · /spec-push · /spec-claim and the spec-sync CLI, mirroring specs to Azure DevOps work items with parent/child hierarchy, assignment and a release work item per tag. The repo is canonical; Boards is a generated mirror. Install this OR the base OR one other superset — exactly one.",
5
5
  "keywords": [
6
6
  "claude",
package/src/cli.js CHANGED
@@ -232,7 +232,17 @@ const {
232
232
  waitsMetByRebase,
233
233
  } = require('./env/epic.js')
234
234
  const { nextAction, readNextInputs, actionText } = require('./env/nextaction.js')
235
- const { epicTree, workingTree, worktreeOverview, epicsInFlight, memberReaders, epicAnswer } = require('./env/epicread.js')
235
+ const {
236
+ epicTree,
237
+ workingTree,
238
+ worktreeOverview,
239
+ epicsInFlight,
240
+ memberReaders,
241
+ epicAnswer,
242
+ readLastCompletedMember,
243
+ writeLastCompletedMember,
244
+ epicStillOpen,
245
+ } = require('./env/epicread.js')
236
246
  const { planHotfixLand, planBranchHotfixLand, planBranchHotfixFinish, planHotfixFinish, shippedCandidates } = require('./env/hotfix.js')
237
247
  const { runHotfixLand, describeStep: describeHotfixStep } = require('./env/hotfixland.js')
238
248
  const { planDev } = require('./env/dev.js')
@@ -1185,7 +1195,17 @@ function epicStatusCommand(argv) {
1185
1195
  const inputs = here
1186
1196
  ? { ...based, ...here.tree, waitIndex: based.index, waitRead: based.readFile }
1187
1197
  : based
1188
- const epic = named || epicFromHere(inputs)
1198
+ // The record is the last rung: a named epic and the tree you stand in both
1199
+ // outrank it, and it is offered only while that epic still has work open.
1200
+ let epic = named || epicFromHere(inputs)
1201
+ let via = null
1202
+ if (!epic && !here && inputs.config) {
1203
+ const record = readLastCompletedMember(inputs.dir, inputs.config)
1204
+ if (record && epicStillOpen(record.epic, inputs)) {
1205
+ epic = record.epic
1206
+ via = 'last-completed-member'
1207
+ }
1208
+ }
1189
1209
  if (!epic) {
1190
1210
  const flying = epicsInFlight(inputs.worktrees)
1191
1211
  const line = flying.length
@@ -1210,7 +1230,7 @@ function epicStatusCommand(argv) {
1210
1230
  // links are relative.
1211
1231
  linkFor: (spec) => memberPageLink(up, offerableLanAddresses(), spec),
1212
1232
  })
1213
- const answer = { ...epicAnswer(epic, inputs, readers), ...(here ? { here: here.label } : {}) }
1233
+ const answer = { ...epicAnswer(epic, inputs, readers), ...(here ? { here: here.label } : {}), ...(via ? { via } : {}) }
1214
1234
  const page = epicPageTiers(inputs, up, epic)
1215
1235
  if (json) {
1216
1236
  process.stdout.write(JSON.stringify({ base: inputs.base, ...answer, page }, null, 2) + '\n')
@@ -1218,7 +1238,8 @@ function epicStatusCommand(argv) {
1218
1238
  }
1219
1239
  // No such epic is a plain answer; a page link for it would be a link to nothing.
1220
1240
  const found = answer.found || answer.members.length
1221
- process.stdout.write(formatEpicStatus(answer) + (found ? '\n' + epicPageLines(page) : ''))
1241
+ const whence = via ? `(${epic}: the epic of the last completed member on this checkout)\n` : ''
1242
+ process.stdout.write(formatEpicStatus(answer) + whence + (found ? '\n' + epicPageLines(page) : ''))
1222
1243
  }
1223
1244
 
1224
1245
  // A member's review page as `epic status` prints it: the network URL where the
@@ -2713,6 +2734,18 @@ function reviewServerNoticeFor(dir, config, folder) {
2713
2734
  return reviewServerNotice({ running: Boolean(pid && isAlive(pid)), othersServed })
2714
2735
  }
2715
2736
 
2737
+ // A landed epic member leaves its epic for a bare `epic status`, because this
2738
+ // teardown removes the worktree that status would otherwise resolve it from
2739
+ // (bug-epic-next-after-complete). An unlanded teardown is not a completion and
2740
+ // records nothing; a spec in no epic leaves an older record standing.
2741
+ function rememberLandedMember(dir, config, spec) {
2742
+ const own =
2743
+ worktreeOverview(spec.projectPath, spec.folder) ||
2744
+ worktreeOverview(projectIn(dir, prefixOf(config)), spec.folder)
2745
+ const epic = own ? epicHeaders(own.overview).epic : null
2746
+ if (epic) writeLastCompletedMember(dir, config, { epic, spec: spec.folder })
2747
+ }
2748
+
2716
2749
  function specEnvDown(dir, config, specArg, flags) {
2717
2750
  const spec = resolveSpecWithWorktree(dir, config, specArg)
2718
2751
 
@@ -2752,6 +2785,7 @@ function specEnvDown(dir, config, specArg, flags) {
2752
2785
  )
2753
2786
  return
2754
2787
  }
2788
+ if (clanded) rememberLandedMember(dir, config, spec)
2755
2789
  const dout = [`spec-env down: ${spec.folder}`, '',
2756
2790
  ' mode: checkout (no worktree, no slot, no volumes)',
2757
2791
  ` branch: ${dplan.branch}`, '', ' run these:']
@@ -2835,6 +2869,7 @@ function specEnvDown(dir, config, specArg, flags) {
2835
2869
  // A torn-down spec is no longer anything a bare resolve should name.
2836
2870
  const last = readLastLive(dir, config)
2837
2871
  if (last && last.spec === spec.folder) clearLastLive(dir, config)
2872
+ if (worktreeState.merged || worktreeState.reachableFromTag) rememberLandedMember(dir, config, spec)
2838
2873
 
2839
2874
  const out = []
2840
2875
  out.push(
@@ -137,6 +137,48 @@ function memberReaders({ dir, config, worktrees, linkFor = () => null, git }) {
137
137
  }
138
138
  }
139
139
 
140
+ /**
141
+ * The epic of the last member landed and torn down on this checkout
142
+ * (bug-epic-next-after-complete). `/spec-complete` removes the member's
143
+ * worktree — the one thing a bare `epic status` resolved from — and then hands
144
+ * off to `/spec-epic-next`, so `spec-env down` leaves this behind for a bare
145
+ * status to fall back to. Beside `last-live.json`, and read the same way.
146
+ *
147
+ * WHAT WOULD FOOL THIS: the record is machine-local and gitignored, so a member
148
+ * completed on another machine, or in another clone, leaves nothing here and a
149
+ * bare status still names no epic. That is the old answer, not a wrong one.
150
+ */
151
+ function lastCompletedMemberPath(rootDir, config) {
152
+ return path.resolve(rootDir, path.dirname(config.registry), 'last-completed-member.json')
153
+ }
154
+
155
+ function readLastCompletedMember(rootDir, config) {
156
+ try {
157
+ const record = JSON.parse(fs.readFileSync(lastCompletedMemberPath(rootDir, config), 'utf-8'))
158
+ return record && typeof record.epic === 'string' && record.epic ? record : null
159
+ } catch {
160
+ return null
161
+ }
162
+ }
163
+
164
+ function writeLastCompletedMember(rootDir, config, fields) {
165
+ const file = lastCompletedMemberPath(rootDir, config)
166
+ fs.mkdirSync(path.dirname(file), { recursive: true })
167
+ fs.writeFileSync(file, JSON.stringify(fields, null, 2) + '\n')
168
+ }
169
+
170
+ /**
171
+ * Is this epic still worth offering: on the base branch, in neither `complete/`
172
+ * nor `cancelled/`, with a member that is neither? Anything this cannot read
173
+ * answers false — the caller then names no epic, as it did before the record.
174
+ */
175
+ function epicStillOpen(epic, inputs) {
176
+ const entry = inputs.index.get(epic)
177
+ if (!entry || entry.bucket === 'complete' || entry.bucket === 'cancelled') return false
178
+ const { members } = epicStatus({ epic, ...inputs })
179
+ return members.some((m) => m.bucket && m.bucket !== 'complete' && m.bucket !== 'cancelled')
180
+ }
181
+
140
182
  /** The whole answer for one epic: `epicStatus` plus a row per member. */
141
183
  function epicAnswer(epic, inputs, readers) {
142
184
  const status = epicStatus({ epic, ...inputs })
@@ -144,4 +186,14 @@ function epicAnswer(epic, inputs, readers) {
144
186
  return { ...status, rows, next, ...epicPlan(status, { rows, next }) }
145
187
  }
146
188
 
147
- module.exports = { epicTree, workingTree, worktreeOverview, epicsInFlight, memberReaders, epicAnswer }
189
+ module.exports = {
190
+ epicTree,
191
+ workingTree,
192
+ worktreeOverview,
193
+ epicsInFlight,
194
+ memberReaders,
195
+ epicAnswer,
196
+ readLastCompletedMember,
197
+ writeLastCompletedMember,
198
+ epicStillOpen,
199
+ }
package/src/env/resume.js CHANGED
@@ -98,10 +98,19 @@ function frontmatterField(text, field) {
98
98
  return m ? m[1].trim().replace(/^["']|["']$/g, '') || null : null
99
99
  }
100
100
 
101
- // `#241`, `241` and `"#241"` are one ticket; `ABC-88` only ever matches itself.
101
+ // `#241`, `241` and `"#241"` are one ticket, and so are `AB#241` and either of
102
+ // them: a typed ref without the tracker's prefix is matched on its number. Two
103
+ // different prefixes (`AB#241`, `XY#241`) never match, and `ABC-88` only ever
104
+ // matches itself.
102
105
  function sameRef(a, b) {
103
- const norm = (s) => String(s).trim().replace(/^#/, '').toLowerCase()
104
- return Boolean(a) && Boolean(b) && norm(a) === norm(b)
106
+ if (!a || !b) return false
107
+ const parse = (s) => {
108
+ const m = /^([a-z]*)#(\d+)$/.exec(String(s).trim().toLowerCase())
109
+ return m ? { prefix: m[1], id: m[2] } : { prefix: '', id: String(s).trim().toLowerCase() }
110
+ }
111
+ const x = parse(a)
112
+ const y = parse(b)
113
+ return x.id === y.id && (!x.prefix || !y.prefix || x.prefix === y.prefix)
105
114
  }
106
115
 
107
116
  // Which copy speaks for a spec: its own worktree, then a branch (local before