@skitterbyte/skitterspec-azure-boards 3.1.3 → 3.2.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.
- package/assets/claude-md-section.md +4 -0
- package/assets/core/azure-boards.config.md +2 -1
- package/assets/core/env.config.json.example +5 -0
- package/assets/core/env.config.md +20 -1
- package/assets/hooks/run-compact.cjs +162 -0
- package/assets/review/page.html +122 -2
- package/assets/rules/spec-format.md +6 -0
- package/assets/rules/spec-planning.md +9 -0
- package/assets/rules/spec-reports.md +5 -0
- package/assets/skills/spec/SKILL.md +25 -1
- package/assets/skills/spec-bug/SKILL.md +14 -0
- package/assets/skills/spec-complete/SKILL.md +9 -0
- package/assets/skills/spec-diff/SKILL.md +24 -0
- package/assets/skills/spec-hotfix/SKILL.md +14 -0
- package/assets/skills/spec-idea/SKILL.md +6 -0
- package/assets/skills/spec-next/SKILL.md +18 -1
- package/assets/skills/spec-next/autonomous.md +126 -0
- package/assets/skills/spec-reviewed/SKILL.md +2 -1
- package/assets/skills/spec-start/SKILL.md +8 -0
- package/assets/skills/spec-start/isolation.md +1 -1
- package/package.json +1 -1
- package/src/cli.js +267 -2
- package/src/env/config.js +18 -0
- package/src/env/hooks.js +44 -20
- package/src/env/report.js +192 -0
- package/src/env/resolve.js +6 -1
- package/src/env/review.js +14 -2
- package/src/env/run.js +226 -0
- package/src/env/runpage.js +229 -0
- package/src/env/serve.js +47 -4
- package/src/ideacmd.js +5 -2
- package/src/vendor/azure-boards/api.js +13 -0
- package/src/vendor/azure-boards/cli-sync.js +109 -11
- package/src/vendor/azure-boards/config.js +47 -2
- package/src/vendor/provider-kit/src/apply.js +3 -0
- package/src/vendor/sync-core/src/compare.js +32 -1
- package/src/vendor/sync-core/src/normalize.js +3 -2
- package/src/vendor/sync-core/src/push.js +29 -1
|
@@ -17,7 +17,7 @@ const { readFileSync } = require('node:fs')
|
|
|
17
17
|
const { join, basename } = require('node:path')
|
|
18
18
|
|
|
19
19
|
const kitConfig = require('../provider-kit/src/config.js')
|
|
20
|
-
const { effectiveStates } = require('../sync-core')
|
|
20
|
+
const { effectiveStates, specHeaders } = require('../sync-core')
|
|
21
21
|
const { dialect, htmlToText, looksLikeHtml } = require('./dialect.js')
|
|
22
22
|
|
|
23
23
|
const CONFIG_FILE = 'specs/.core/azure-boards.config.json'
|
|
@@ -35,7 +35,10 @@ const DEFAULT_CONFIG = Object.freeze({
|
|
|
35
35
|
// `project` is where spec work items land. `workItemType`/`childType` name
|
|
36
36
|
// the types this project's process uses for a spec and its phases; the
|
|
37
37
|
// defaults are the Basic template's, and any process overrides them here.
|
|
38
|
-
// `areaPath` is optional — empty means the project default.
|
|
38
|
+
// `areaPath` is optional — empty means the project default. `products` maps
|
|
39
|
+
// a spec's `> **Product:**` key to the area path its items are filed in
|
|
40
|
+
// (`{ "tendering": { "areaPath": "LSC\\Tendering" } }`); with any product
|
|
41
|
+
// set, `areaPath` is where a spec without the header goes.
|
|
39
42
|
azure: Object.freeze({
|
|
40
43
|
orgUrl: '',
|
|
41
44
|
project: '',
|
|
@@ -62,6 +65,7 @@ const DEFAULT_CONFIG = Object.freeze({
|
|
|
62
65
|
// a write-only mapping would make `/spec-status` report every Bug as
|
|
63
66
|
// edited. Empty means System.Description everywhere, as before.
|
|
64
67
|
bodyFieldByType: Object.freeze({}),
|
|
68
|
+
products: Object.freeze({}),
|
|
65
69
|
}),
|
|
66
70
|
// A spec is a WORK ITEM; each phase a CHILD work item under a hierarchy
|
|
67
71
|
// link. `tasks` selects how the phase's checkboxes reach that child's
|
|
@@ -235,6 +239,17 @@ function mergeConfig(base, parsed) {
|
|
|
235
239
|
}
|
|
236
240
|
base.azure.bodyFieldByType = byType
|
|
237
241
|
}
|
|
242
|
+
if (isObject(parsed.azure.products)) {
|
|
243
|
+
// A product with no usable area path is dropped, never filed at the
|
|
244
|
+
// project root: a spec naming it is then refused as unknown, which says
|
|
245
|
+
// what is wrong where a silent root filing would not.
|
|
246
|
+
const products = {}
|
|
247
|
+
for (const [key, value] of Object.entries(parsed.azure.products)) {
|
|
248
|
+
const area = isObject(value) && typeof value.areaPath === 'string' ? value.areaPath.trim() : ''
|
|
249
|
+
if (String(key).trim() && area) products[String(key).trim()] = { areaPath: area }
|
|
250
|
+
}
|
|
251
|
+
base.azure.products = products
|
|
252
|
+
}
|
|
238
253
|
// A trailing slash on the org would double up in every composed URL.
|
|
239
254
|
if (base.azure.orgUrl) base.azure.orgUrl = base.azure.orgUrl.replace(/\/+$/, '')
|
|
240
255
|
}
|
|
@@ -341,6 +356,30 @@ function stateNameFor(config, bucket, type) {
|
|
|
341
356
|
return effectiveStates(config, config.statesByType, type)[bucket]
|
|
342
357
|
}
|
|
343
358
|
|
|
359
|
+
/**
|
|
360
|
+
* The area path a spec's items are filed in, from its `> **Product:**` key.
|
|
361
|
+
* `undefined` when the project places nothing — no `azure.products` and no
|
|
362
|
+
* header — which leaves every push exactly as it was before products existed.
|
|
363
|
+
*
|
|
364
|
+
* Throws (refusing the push) for a key `azure.products` does not have, or a
|
|
365
|
+
* header in a project with no products: filing it in the default area instead
|
|
366
|
+
* would mix one product's work into another's, the thing this exists to stop.
|
|
367
|
+
*/
|
|
368
|
+
function productArea(config, product) {
|
|
369
|
+
const products = (config.azure && config.azure.products) || {}
|
|
370
|
+
const keys = Object.keys(products)
|
|
371
|
+
if (product) {
|
|
372
|
+
if (!keys.length) {
|
|
373
|
+
throw new Error(`Product: ${product} — but ${CONFIG_FILE} sets no azure.products, so there is nowhere to file it`)
|
|
374
|
+
}
|
|
375
|
+
const key = keys.find((k) => k.toLowerCase() === String(product).toLowerCase())
|
|
376
|
+
if (!key) throw new Error(`unknown product "${product}" — ${CONFIG_FILE} azure.products has: ${keys.join(', ')}`)
|
|
377
|
+
return products[key].areaPath
|
|
378
|
+
}
|
|
379
|
+
if (!keys.length) return undefined
|
|
380
|
+
return config.azure.areaPath || undefined
|
|
381
|
+
}
|
|
382
|
+
|
|
344
383
|
// Attach the parts of the provider contract that are code, not JSON: the
|
|
345
384
|
// markdown dialect, and the `provider` block. Azure identifiers all share the
|
|
346
385
|
// constant `AB` prefix (`AB#123`), so unlike Jira's project key there is
|
|
@@ -359,6 +398,11 @@ function withRuntime(config) {
|
|
|
359
398
|
// as markdown or HTML depending on the item's era. Each hook falls back to
|
|
360
399
|
// the flat Linear-like shape, so a pre-reduced payload keeps working.
|
|
361
400
|
config.remote = {
|
|
401
|
+
// Where this spec's items are filed: its product's area path (sync-core
|
|
402
|
+
// `placement`), so a header change plans a move like any other edit.
|
|
403
|
+
placement(snapshotDir) {
|
|
404
|
+
return productArea(config, specHeaders(snapshotDir, config).product)
|
|
405
|
+
},
|
|
362
406
|
// The state name a push writes for this bucket, recorded in the snapshot
|
|
363
407
|
// so a state-map change is visible to `plan` (sync-core `stateNames`).
|
|
364
408
|
// Resolved exactly as the apply resolves it: the spec item by its kind's
|
|
@@ -453,4 +497,5 @@ module.exports = {
|
|
|
453
497
|
DEFAULT_TOKEN_ENV,
|
|
454
498
|
ENV_CONFIG_DEFAULTS,
|
|
455
499
|
IDENTIFIER_FIELD,
|
|
500
|
+
productArea,
|
|
456
501
|
}
|
|
@@ -138,6 +138,9 @@ async function applyInner({
|
|
|
138
138
|
// state name for these and only these (`recordPush`). A held state counts:
|
|
139
139
|
// run 2 sends it, and what run 2 records has to match what run 1 committed.
|
|
140
140
|
const sent = { issue: !!heldState || !!(plan.issue && plan.issue.state != null), subIssues: new Set() }
|
|
141
|
+
// A place rides the plan's issue: on a create it is always written, on an
|
|
142
|
+
// update only when the plan carries it. Recorded only once written.
|
|
143
|
+
sent.placement = !!(plan.issue && plan.issue.placement !== undefined)
|
|
141
144
|
// Handed out immediately, so a throw from anywhere below still reports what
|
|
142
145
|
// had been stamped by the time it happened.
|
|
143
146
|
if (progress) progress.result = result
|
|
@@ -231,6 +231,18 @@ function stateNamesRecord(projection, previous, sent) {
|
|
|
231
231
|
return out
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
+
/**
|
|
235
|
+
* The `placement` record for a snapshot: the place this push SENT, or the one
|
|
236
|
+
* the previous snapshot had when this push sent none, or undefined. The same
|
|
237
|
+
* rule as `stateNamesRecord` — recording a place nobody wrote would claim the
|
|
238
|
+
* tracker holds it.
|
|
239
|
+
*/
|
|
240
|
+
function placementRecord(projection, previous, sent) {
|
|
241
|
+
const p = projection || {}
|
|
242
|
+
if (sent && sent.placement && p.placement !== undefined) return p.placement
|
|
243
|
+
return previous && typeof previous.placement === 'string' ? previous.placement : undefined
|
|
244
|
+
}
|
|
245
|
+
|
|
234
246
|
// Has the state an unchanged item maps to moved under it — a state-map edit in
|
|
235
247
|
// the config rather than a move of the spec? Only a RECORDED name can say: an
|
|
236
248
|
// item with none is cannot-tell and plans nothing, so an upgrade or a config
|
|
@@ -304,9 +316,27 @@ function planChanges(projection, snapshot, { linked = false, epic = false } = {}
|
|
|
304
316
|
// is above, and nothing is retired (spec feat-epic-migration, Decision 2).
|
|
305
317
|
if (epic && unclaimed.length) subIssues.retire = unclaimed.slice()
|
|
306
318
|
|
|
319
|
+
// PLACEMENT: where the items belong (Azure's area path). Sent when the
|
|
320
|
+
// project places specs and the place differs from the one last sent. An
|
|
321
|
+
// unrecorded place on a linked spec is sent too: placement only comes into
|
|
322
|
+
// play when the project configures it, so that first push is the move the
|
|
323
|
+
// project asked for, not a guess about someone else's filing.
|
|
324
|
+
const place = p.placement
|
|
325
|
+
const moved = place !== undefined && snap.placement !== place
|
|
326
|
+
if (place !== undefined) for (const c of subIssues.create) c.placement = place
|
|
327
|
+
if (moved) {
|
|
328
|
+
for (const s of p.subIssues || []) {
|
|
329
|
+
if (s.id == null) continue
|
|
330
|
+
const existing = subIssues.update.find((u) => String(u.id) === String(s.id))
|
|
331
|
+
if (existing) existing.placement = place
|
|
332
|
+
else subIssues.update.push({ ref: s.ref, id: s.id, placement: place })
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
307
336
|
const plan = { subIssues }
|
|
308
337
|
if (unstamped.length) plan.unstamped = unstamped
|
|
309
|
-
|
|
338
|
+
let issue = issueChanges(p, snap, { linked })
|
|
339
|
+
if (moved) issue = { ...(issue || {}), placement: place }
|
|
310
340
|
if (issue) plan.issue = issue
|
|
311
341
|
return plan
|
|
312
342
|
}
|
|
@@ -413,6 +443,7 @@ module.exports = {
|
|
|
413
443
|
specIssueFieldHashes,
|
|
414
444
|
snapshotOf,
|
|
415
445
|
stateNamesRecord,
|
|
446
|
+
placementRecord,
|
|
416
447
|
isEmptyPlan,
|
|
417
448
|
hashField,
|
|
418
449
|
stableStringify,
|
|
@@ -436,7 +436,7 @@ function readSnapshot(snapshotDir, config) {
|
|
|
436
436
|
}
|
|
437
437
|
|
|
438
438
|
// The spec's own `> **Severity:**`, `> **Incident:**`, `> **Epic:**`,
|
|
439
|
-
// `> **Waits on:**` and `> **
|
|
439
|
+
// `> **Waits on:**`, `> **Lanes:**` and `> **Product:**` headers, off the overview's blockquote
|
|
440
440
|
// block. They are PUSH-TIME EXTRAS, deliberately not keys on `normalizeLocal`'s
|
|
441
441
|
// field set: severity lands in a provider-specific home (a field, a label),
|
|
442
442
|
// the incident and epic links as typed relations, and the waits and lanes are
|
|
@@ -448,7 +448,7 @@ function specHeaders(snapshotDir, config) {
|
|
|
448
448
|
try {
|
|
449
449
|
raw = fs.readFileSync(path.join(snapshotDir, overviewFile), 'utf-8')
|
|
450
450
|
} catch {
|
|
451
|
-
return { severity: null, incident: null, epic: null, waitsOn: [], lanes: null }
|
|
451
|
+
return { severity: null, incident: null, epic: null, waitsOn: [], lanes: null, product: null }
|
|
452
452
|
}
|
|
453
453
|
const read = (name) => {
|
|
454
454
|
const m = new RegExp(`^>\\s*\\*\\*${name}:\\*\\*\\s*(.+)$`, 'm').exec(raw)
|
|
@@ -460,6 +460,7 @@ function specHeaders(snapshotDir, config) {
|
|
|
460
460
|
epic: unquote(read('Epic')) || null,
|
|
461
461
|
waitsOn: parseWaitsOn(read('Waits on')),
|
|
462
462
|
lanes: parseLanes(read('Lanes')),
|
|
463
|
+
product: unquote(read('Product')) || null,
|
|
463
464
|
}
|
|
464
465
|
}
|
|
465
466
|
|
|
@@ -20,7 +20,7 @@ const path = require('node:path')
|
|
|
20
20
|
const { normalizeLocal, phasesWithheld, phaseModeFor, ownershipOf, readSnapshot } = require('./normalize.js')
|
|
21
21
|
const { descriptionMode } = require('./summary.js')
|
|
22
22
|
const { fieldsOf } = require('./fields.js')
|
|
23
|
-
const { planChanges, snapshotOf, stateNamesRecord, isEmptyPlan } = require('./compare.js')
|
|
23
|
+
const { planChanges, snapshotOf, stateNamesRecord, placementRecord, isEmptyPlan } = require('./compare.js')
|
|
24
24
|
const { readBase, writeBase } = require('./base.js')
|
|
25
25
|
const { detectLegacyMirror } = require('./legacy.js')
|
|
26
26
|
|
|
@@ -58,9 +58,34 @@ function projectionOf(snapshotDir, config) {
|
|
|
58
58
|
// pulled, and read by name, so it can never reach a hash.
|
|
59
59
|
if (ownershipOf(config, 'workflowState') === 'pull') projection.statePulled = true
|
|
60
60
|
attachStateNames(projection, snapshotDir, config)
|
|
61
|
+
attachPlacement(projection, snapshotDir, config)
|
|
61
62
|
return projection
|
|
62
63
|
}
|
|
63
64
|
|
|
65
|
+
// Where on the tracker this spec's items belong — Azure's area path, from the
|
|
66
|
+
// provider's `config.remote.placement(snapshotDir)` hook: a string when the
|
|
67
|
+
// project places specs, `undefined` when it does not (no hook, or the hook
|
|
68
|
+
// says the feature is not in play). Read by name, so it never reaches a hash:
|
|
69
|
+
// recorded beside them as `placement`, it is what lets a plan see a spec move
|
|
70
|
+
// that no field hash covers. A hook that throws REFUSES the plan — a spec
|
|
71
|
+
// naming a place the project does not have must not be filed somewhere else —
|
|
72
|
+
// but only the plan: the error is carried, not raised, so a status or a list
|
|
73
|
+
// over every spec is not taken down by one spec's bad header.
|
|
74
|
+
function attachPlacement(projection, snapshotDir, config) {
|
|
75
|
+
const hook = config && config.remote && config.remote.placement
|
|
76
|
+
if (typeof hook !== 'function') return
|
|
77
|
+
let value
|
|
78
|
+
try {
|
|
79
|
+
value = hook(snapshotDir)
|
|
80
|
+
} catch (error) {
|
|
81
|
+
// Tagged, so a caller can relay it as the refusal it is rather than a crash.
|
|
82
|
+
if (error && typeof error === 'object') error.placementRefused = true
|
|
83
|
+
Object.defineProperty(projection, 'placementError', { value: error, enumerable: false })
|
|
84
|
+
return
|
|
85
|
+
}
|
|
86
|
+
if (typeof value === 'string' && value) projection.placement = value
|
|
87
|
+
}
|
|
88
|
+
|
|
64
89
|
// The tracker state NAME each bucket resolves to today, from the provider's
|
|
65
90
|
// `config.remote.writtenStateName(bucket, role, snapshotDir)` hook: a string,
|
|
66
91
|
// `null` for "this bucket sends no state", or `undefined` for cannot-tell — no
|
|
@@ -103,6 +128,7 @@ function isLinked(snapshotDir, config) {
|
|
|
103
128
|
|
|
104
129
|
function push({ dir, snapshotDir, identifier, config }) {
|
|
105
130
|
const projection = projectionOf(snapshotDir, config)
|
|
131
|
+
if (projection.placementError) throw projection.placementError
|
|
106
132
|
const snapshot = readBase(dir, identifier, config)
|
|
107
133
|
const epic = path.basename(String(snapshotDir || '')).startsWith('epic-')
|
|
108
134
|
const plan = planChanges(projection, snapshot, { linked: isLinked(snapshotDir, config), epic })
|
|
@@ -150,6 +176,8 @@ function recordPush({ dir, snapshotDir, identifier, config, sent = null, keepSub
|
|
|
150
176
|
}
|
|
151
177
|
const names = stateNamesRecord(projection, before, sent)
|
|
152
178
|
if (names) snapshot.stateNames = names
|
|
179
|
+
const placement = placementRecord(projection, before, sent)
|
|
180
|
+
if (placement !== undefined) snapshot.placement = placement
|
|
153
181
|
return writeBase(dir, identifier, config, snapshot)
|
|
154
182
|
}
|
|
155
183
|
|