@skitterbyte/skitterspec-azure-boards 1.0.0 → 1.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/core/azure-boards.config.json.example +4 -1
- package/assets/core/azure-boards.config.md +2 -0
- package/assets/core/env.config.md +49 -0
- package/assets/skills/no-spec/SKILL.md +6 -3
- package/assets/skills/spec/SKILL.md +20 -14
- package/assets/skills/spec-azure-setup/SKILL.md +17 -4
- package/assets/skills/spec-bug/SKILL.md +20 -14
- package/assets/skills/spec-complete/SKILL.md +6 -3
- package/assets/skills/spec-hotfix/SKILL.md +20 -14
- package/assets/skills/spec-to-main/SKILL.md +5 -3
- package/bin/skitterspec-azure-boards.js +7 -0
- package/package.json +1 -1
- package/src/cli.js +58 -6
- package/src/env/config.js +111 -14
- package/src/env/glob.js +34 -0
- package/src/env/hotfix.js +4 -2
- package/src/env/integrate.js +52 -11
- package/src/env/live.js +1 -26
- package/src/vendor/azure-boards/api.js +28 -15
- package/src/vendor/azure-boards/cli-sync.js +138 -15
- package/src/vendor/azure-boards/config.js +33 -4
- package/src/vendor/azure-boards/dialect.js +19 -2
- package/src/vendor/azure-boards/identity.js +5 -3
package/src/env/config.js
CHANGED
|
@@ -22,11 +22,16 @@
|
|
|
22
22
|
* seedFiles:{ mode, files } | [ ".env", ... ], // gitignored files copied/
|
|
23
23
|
* // symlinked from the main checkout into a fresh worktree before
|
|
24
24
|
* // setup runs (mode: "symlink" default | "copy"); empty = none
|
|
25
|
-
* setup: [ "cmd", ... ], // bootstrap commands run in
|
|
26
|
-
* // after `git worktree add` (e.g. install
|
|
27
|
-
*
|
|
28
|
-
* //
|
|
29
|
-
*
|
|
25
|
+
* setup: [ "cmd" | { run, when }, ... ], // bootstrap commands run in
|
|
26
|
+
* // the worktree right after `git worktree add` (e.g. install
|
|
27
|
+
* // deps); `when` is ignored there — normalised to strings, with
|
|
28
|
+
* // the triggered entries also kept as `setupTriggers`
|
|
29
|
+
* afterLand:[ "cmd" | { run, when } | { setup: true }, ... ], // commands
|
|
30
|
+
* // run in the PRIMARY checkout after a land (integrate's ff,
|
|
31
|
+
* // hotfix land's main cherry-pick), e.g. a data migration;
|
|
32
|
+
* // `when` globs gate an entry on the land's changed files, and
|
|
33
|
+
* // `{ setup: true }` expands to `setupTriggers`; literal, no
|
|
34
|
+
* // token expansion; normalised to `{ run, when }`; empty = none
|
|
30
35
|
* dev: [ { name, command, portVar, health?, frontPort? } ], // host dev
|
|
31
36
|
* // servers started on the spec's port block (empty = none)
|
|
32
37
|
* proxy: { enabled, host }, // bundled front-door proxy (spec-env connect)
|
|
@@ -169,11 +174,16 @@ const DEFAULT_CONFIG = Object.freeze({
|
|
|
169
174
|
// `git worktree add` (before Docker/dev), on every provision. Array of shell
|
|
170
175
|
// strings (e.g. "pnpm install"); {slug}/{branch}/… expand. Default: none.
|
|
171
176
|
setup: Object.freeze([]),
|
|
177
|
+
// The `setup` entries that declared `when` globs, as `{ run, when }`. Derived
|
|
178
|
+
// at load, never configured directly: `afterLand`'s `{ setup: true }` expands
|
|
179
|
+
// to these, so a setup step can re-run after a land that changes its inputs.
|
|
180
|
+
setupTriggers: Object.freeze([]),
|
|
172
181
|
// Commands run in the primary checkout after a land, printed by `spec-env
|
|
173
182
|
// integrate` (including its already-landed no-op) and by `hotfix land` when
|
|
174
183
|
// it cherry-picks onto the base branch. The skill runs them; the engine only
|
|
175
184
|
// plans. Literal strings — no {slug}/{port} tokens, since they run on the base
|
|
176
|
-
// branch where a spec's tokens mean nothing.
|
|
185
|
+
// branch where a spec's tokens mean nothing. Normalised to `{ run, when }`,
|
|
186
|
+
// `when` null for an always-run entry. Default: none.
|
|
177
187
|
afterLand: Object.freeze([]),
|
|
178
188
|
// Host dev servers started on the spec's port block by `spec-env dev up`.
|
|
179
189
|
// Each: { name, command, portVar, health?, frontPort? }. Default: none.
|
|
@@ -352,6 +362,7 @@ function defaults() {
|
|
|
352
362
|
docker: { ...DEFAULT_CONFIG.docker },
|
|
353
363
|
seedFiles: { mode: DEFAULT_CONFIG.seedFiles.mode, files: [] },
|
|
354
364
|
setup: [],
|
|
365
|
+
setupTriggers: [],
|
|
355
366
|
afterLand: [],
|
|
356
367
|
dev: [],
|
|
357
368
|
proxy: { ...DEFAULT_CONFIG.proxy },
|
|
@@ -524,11 +535,49 @@ function normalizeSeedFiles(parsed) {
|
|
|
524
535
|
* stray entry can't crash provisioning.
|
|
525
536
|
*/
|
|
526
537
|
function normalizeSetup(parsed) {
|
|
538
|
+
return normalizeCommands(parsed).map((e) => e.run)
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* Normalise a list of command entries into `{ run, when }`. A string is an
|
|
543
|
+
* always-run entry (`when: null`); `{ run, when }` keeps its trigger globs, with
|
|
544
|
+
* a string `when` coerced to a one-item list. An object whose `run` is blank, or
|
|
545
|
+
* whose `when` holds no usable glob, is dropped rather than demoted to
|
|
546
|
+
* always-run — a malformed trigger must not quietly widen into "every time".
|
|
547
|
+
*/
|
|
548
|
+
function normalizeCommands(parsed) {
|
|
527
549
|
const out = []
|
|
528
550
|
for (const raw of parsed) {
|
|
529
|
-
if (typeof raw
|
|
530
|
-
|
|
531
|
-
|
|
551
|
+
if (typeof raw === 'string') {
|
|
552
|
+
const run = raw.trim()
|
|
553
|
+
if (run) out.push({ run, when: null })
|
|
554
|
+
continue
|
|
555
|
+
}
|
|
556
|
+
if (!isObject(raw) || typeof raw.run !== 'string') continue
|
|
557
|
+
const run = raw.run.trim()
|
|
558
|
+
if (!run) continue
|
|
559
|
+
if (raw.when === undefined) {
|
|
560
|
+
out.push({ run, when: null })
|
|
561
|
+
continue
|
|
562
|
+
}
|
|
563
|
+
const globs = typeof raw.when === 'string' ? [raw.when] : Array.isArray(raw.when) ? raw.when : []
|
|
564
|
+
const when = normalizeFileList(globs)
|
|
565
|
+
if (when.length) out.push({ run, when })
|
|
566
|
+
}
|
|
567
|
+
return out
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
// `afterLand` entries: `normalizeCommands`, plus `{ setup: true }` expanded in
|
|
571
|
+
// place to the triggered setup entries. With none declared it expands to
|
|
572
|
+
// nothing — the shorthand names a set, and an empty set is a valid one.
|
|
573
|
+
function normalizeAfterLand(parsed, setupTriggers) {
|
|
574
|
+
const out = []
|
|
575
|
+
for (const raw of parsed) {
|
|
576
|
+
if (isObject(raw) && raw.setup === true) {
|
|
577
|
+
for (const t of setupTriggers) out.push({ run: t.run, when: [...t.when] })
|
|
578
|
+
continue
|
|
579
|
+
}
|
|
580
|
+
out.push(...normalizeCommands([raw]))
|
|
532
581
|
}
|
|
533
582
|
return out
|
|
534
583
|
}
|
|
@@ -560,12 +609,15 @@ function mergeConfig(base, parsed) {
|
|
|
560
609
|
}
|
|
561
610
|
|
|
562
611
|
if (Array.isArray(parsed.setup)) {
|
|
563
|
-
|
|
612
|
+
const entries = normalizeCommands(parsed.setup)
|
|
613
|
+
base.setup = entries.map((e) => e.run)
|
|
614
|
+
base.setupTriggers = entries.filter((e) => e.when)
|
|
564
615
|
}
|
|
565
616
|
|
|
566
|
-
// Same rule as `setup`: a stray entry is dropped, never thrown on.
|
|
617
|
+
// Same rule as `setup`: a stray entry is dropped, never thrown on. Read after
|
|
618
|
+
// `setup`, which `{ setup: true }` expands from.
|
|
567
619
|
if (Array.isArray(parsed.afterLand)) {
|
|
568
|
-
base.afterLand =
|
|
620
|
+
base.afterLand = normalizeAfterLand(parsed.afterLand, base.setupTriggers)
|
|
569
621
|
}
|
|
570
622
|
|
|
571
623
|
if (Array.isArray(parsed.dev)) {
|
|
@@ -707,6 +759,48 @@ function mergeConfig(base, parsed) {
|
|
|
707
759
|
* It is advisory in the strongest sense: nothing here acts on it, and a config
|
|
708
760
|
* full of strays loads exactly as it always did.
|
|
709
761
|
*/
|
|
762
|
+
// The isolation keys a ticketing provider needs a project to declare — set
|
|
763
|
+
// once per process by a provider superset's bin, beneath whatever the
|
|
764
|
+
// project's own env.config.json says. They used to reach only the
|
|
765
|
+
// `env.config.json.example` composed at build time, which left every project
|
|
766
|
+
// that adopted a provider over an EXISTING isolation config (or skipped the
|
|
767
|
+
// example) with a `spec.companionPaths` that never claims the provider's
|
|
768
|
+
// snapshot sidecar — `spec-env stage` then classifies the spec's own
|
|
769
|
+
// `<baseDir>/<identifier>.base.json` as foreign and `/commit` leaves it
|
|
770
|
+
// behind. The base distribution registers nothing and behaves as before.
|
|
771
|
+
let providerEnvDefaults = null
|
|
772
|
+
function setProviderEnvDefaults(overrides) {
|
|
773
|
+
providerEnvDefaults = overrides || null
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
// Fill ONLY the keys the project's file does not mention: a key the file sets —
|
|
777
|
+
// including explicitly to '' or [] — is the project's decision and stands
|
|
778
|
+
// ("the two keys are one fix" in scripts/build-dist.test.js is the contract:
|
|
779
|
+
// blanking identifierField must keep disabling the companion expansion).
|
|
780
|
+
function applyProviderEnvDefaults(config, parsed) {
|
|
781
|
+
if (!providerEnvDefaults) return config
|
|
782
|
+
const d = providerEnvDefaults
|
|
783
|
+
const pBranch = parsed && typeof parsed.branch === 'object' && parsed.branch !== null ? parsed.branch : null
|
|
784
|
+
if (
|
|
785
|
+
d.branch &&
|
|
786
|
+
typeof d.branch.identifierField === 'string' &&
|
|
787
|
+
!(pBranch && 'identifierField' in pBranch) &&
|
|
788
|
+
!config.branch.identifierField
|
|
789
|
+
) {
|
|
790
|
+
config.branch.identifierField = d.branch.identifierField
|
|
791
|
+
}
|
|
792
|
+
const pSpec = parsed && typeof parsed.spec === 'object' && parsed.spec !== null ? parsed.spec : null
|
|
793
|
+
if (
|
|
794
|
+
d.spec &&
|
|
795
|
+
Array.isArray(d.spec.companionPaths) &&
|
|
796
|
+
!(pSpec && 'companionPaths' in pSpec) &&
|
|
797
|
+
!config.spec.companionPaths.length
|
|
798
|
+
) {
|
|
799
|
+
config.spec.companionPaths = [...d.spec.companionPaths]
|
|
800
|
+
}
|
|
801
|
+
return config
|
|
802
|
+
}
|
|
803
|
+
|
|
710
804
|
function loadEnvConfig(dir = process.cwd()) {
|
|
711
805
|
const base = defaults()
|
|
712
806
|
const file = join(dir, CONFIG_FILE)
|
|
@@ -715,7 +809,9 @@ function loadEnvConfig(dir = process.cwd()) {
|
|
|
715
809
|
try {
|
|
716
810
|
raw = readFileSync(file, 'utf-8')
|
|
717
811
|
} catch (error) {
|
|
718
|
-
if (error.code === 'ENOENT')
|
|
812
|
+
if (error.code === 'ENOENT') {
|
|
813
|
+
return { config: applyProviderEnvDefaults(base, null), present: false, unknown: [], badReviewers: [] }
|
|
814
|
+
}
|
|
719
815
|
throw error
|
|
720
816
|
}
|
|
721
817
|
|
|
@@ -727,7 +823,7 @@ function loadEnvConfig(dir = process.cwd()) {
|
|
|
727
823
|
}
|
|
728
824
|
|
|
729
825
|
return {
|
|
730
|
-
config: mergeConfig(base, parsed),
|
|
826
|
+
config: applyProviderEnvDefaults(mergeConfig(base, parsed), parsed),
|
|
731
827
|
present: true,
|
|
732
828
|
unknown: collectUnknownKeys(parsed),
|
|
733
829
|
badReviewers: collectBadReviewers(parsed),
|
|
@@ -736,6 +832,7 @@ function loadEnvConfig(dir = process.cwd()) {
|
|
|
736
832
|
|
|
737
833
|
module.exports = {
|
|
738
834
|
loadEnvConfig,
|
|
835
|
+
setProviderEnvDefaults,
|
|
739
836
|
resolveServePort,
|
|
740
837
|
derivedServePort,
|
|
741
838
|
servePortRoot,
|
package/src/env/glob.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Restricted glob matching for repo-relative paths, shared by the live-overlay
|
|
5
|
+
* migration check and the conditional `afterLand` entries. Zero-dependency.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// Translate a restricted glob into an anchored RegExp: `**` matches across path
|
|
9
|
+
// separators (with an optional trailing `/`), `*` matches within a segment, `?`
|
|
10
|
+
// a single non-separator char. Enough for repo-path globs, no dependency.
|
|
11
|
+
function globToRegExp(glob) {
|
|
12
|
+
let re = ''
|
|
13
|
+
for (let i = 0; i < glob.length; i++) {
|
|
14
|
+
const ch = glob[i]
|
|
15
|
+
if (ch === '*') {
|
|
16
|
+
if (glob[i + 1] === '*') {
|
|
17
|
+
re += '.*'
|
|
18
|
+
i++
|
|
19
|
+
if (glob[i + 1] === '/') i++ // consume the `/` in `**/`
|
|
20
|
+
} else {
|
|
21
|
+
re += '[^/]*'
|
|
22
|
+
}
|
|
23
|
+
} else if (ch === '?') {
|
|
24
|
+
re += '[^/]'
|
|
25
|
+
} else if ('.+^${}()|[]\\/'.includes(ch)) {
|
|
26
|
+
re += '\\' + ch
|
|
27
|
+
} else {
|
|
28
|
+
re += ch
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return new RegExp('^' + re + '$')
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
module.exports = { globToRegExp }
|
package/src/env/hotfix.js
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
const path = require('node:path')
|
|
24
|
-
const { afterLandFor } = require('./integrate.js')
|
|
24
|
+
const { afterLandFor, rangeOf } = require('./integrate.js')
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Parse a semver-ish tag and return it with its PATCH bumped by one. Preserves any
|
|
@@ -333,7 +333,9 @@ function planHotfixLand(spec, config, ctx) {
|
|
|
333
333
|
commits: picks,
|
|
334
334
|
})
|
|
335
335
|
targets.push({ kind: 'main', base: c.base })
|
|
336
|
-
|
|
336
|
+
// The range is the files the carried fix touches — `carry.files`, read by
|
|
337
|
+
// the caller from the fix commits; absent or unreadable → unknown → run.
|
|
338
|
+
afterLand = afterLandFor(config, c.mainRepoPath, rangeOf({ changedFiles: carry.files }))
|
|
337
339
|
}
|
|
338
340
|
|
|
339
341
|
return { ...result, commands, steps, afterLand, prodTag, targets, fixRange }
|
package/src/env/integrate.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const { globToRegExp } = require('./glob.js')
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* Pure integrate planner for `spec-env integrate`.
|
|
5
7
|
*
|
|
@@ -21,7 +23,9 @@
|
|
|
21
23
|
* fast-forward. `planIntegrateCheckout` below covers that; the shape of what it
|
|
22
24
|
* returns is identical so callers need no second code path.
|
|
23
25
|
*
|
|
24
|
-
* @param {object} ctx { worktreeState: { dirty }, base, aheadOfBase, mainRepoPath
|
|
26
|
+
* @param {object} ctx { worktreeState: { dirty }, base, aheadOfBase, mainRepoPath,
|
|
27
|
+
* changedFiles } — `changedFiles` is what the land brings
|
|
28
|
+
* in (`base...branch`), or null when it could not be read
|
|
25
29
|
* @returns {object} { blocked, noop, reason, commands, afterLand, base, branch }
|
|
26
30
|
*/
|
|
27
31
|
function planIntegrate(spec, config, ctx) {
|
|
@@ -39,8 +43,9 @@ function planIntegrate(spec, config, ctx) {
|
|
|
39
43
|
// Nothing on the branch that isn't already on base → already landed. The
|
|
40
44
|
// after-land commands still apply: the land may have happened on another
|
|
41
45
|
// machine or in an earlier session, leaving them pending in THIS checkout.
|
|
46
|
+
// That earlier land's range is unknown here, so the range is null.
|
|
42
47
|
if (!aheadOfBase) {
|
|
43
|
-
return { ...result, noop: true, afterLand: afterLandFor(config, mainRepoPath) }
|
|
48
|
+
return { ...result, noop: true, afterLand: afterLandFor(config, mainRepoPath, null) }
|
|
44
49
|
}
|
|
45
50
|
|
|
46
51
|
return {
|
|
@@ -49,7 +54,7 @@ function planIntegrate(spec, config, ctx) {
|
|
|
49
54
|
`git -C ${spec.worktreePath} rebase ${base}`,
|
|
50
55
|
`git -C ${mainRepoPath} merge --ff-only ${branch}`,
|
|
51
56
|
],
|
|
52
|
-
afterLand: afterLandFor(config, mainRepoPath),
|
|
57
|
+
afterLand: afterLandFor(config, mainRepoPath, rangeOf(ctx)),
|
|
53
58
|
}
|
|
54
59
|
}
|
|
55
60
|
|
|
@@ -65,7 +70,7 @@ function planIntegrate(spec, config, ctx) {
|
|
|
65
70
|
* another spec's branch") for a spec that is finished, and the operator would
|
|
66
71
|
* have to know to switch back by hand.
|
|
67
72
|
*
|
|
68
|
-
* ctx: { dirty, base, aheadOfBase, checkoutPath, onBranch }
|
|
73
|
+
* ctx: { dirty, base, aheadOfBase, checkoutPath, onBranch, changedFiles }
|
|
69
74
|
*/
|
|
70
75
|
function planIntegrateCheckout(spec, config, ctx) {
|
|
71
76
|
const { dirty, base, aheadOfBase, checkoutPath, onBranch } = ctx || {}
|
|
@@ -80,7 +85,7 @@ function planIntegrateCheckout(spec, config, ctx) {
|
|
|
80
85
|
// would refuse the very spec this just finished landing. /spec-complete calls
|
|
81
86
|
// integrate again on exactly that state.
|
|
82
87
|
if (!aheadOfBase) {
|
|
83
|
-
return { ...result, noop: true, afterLand: afterLandFor(config, checkoutPath) }
|
|
88
|
+
return { ...result, noop: true, afterLand: afterLandFor(config, checkoutPath, null) }
|
|
84
89
|
}
|
|
85
90
|
if (dirty) {
|
|
86
91
|
return {
|
|
@@ -107,20 +112,56 @@ function planIntegrateCheckout(spec, config, ctx) {
|
|
|
107
112
|
`git -C ${checkoutPath} switch ${base}`,
|
|
108
113
|
`git -C ${checkoutPath} merge --ff-only ${branch}`,
|
|
109
114
|
],
|
|
110
|
-
afterLand: afterLandFor(config, checkoutPath),
|
|
115
|
+
afterLand: afterLandFor(config, checkoutPath, rangeOf(ctx)),
|
|
111
116
|
}
|
|
112
117
|
}
|
|
113
118
|
|
|
114
119
|
// The after-land half of a plan: `config.afterLand`, to run in `cwd` (the
|
|
115
120
|
// primary checkout, standing on base) once the land commands have succeeded.
|
|
116
121
|
// A blocked plan carries the empty form — nothing landed, so nothing follows.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
122
|
+
//
|
|
123
|
+
// `range` is the files the land changes: a list (possibly empty) when known,
|
|
124
|
+
// null when it is not. Each entry gets a decision — `always` (no `when`),
|
|
125
|
+
// `matched` (with the first path that hit), `skipped`, or `unknown` — and
|
|
126
|
+
// `commands` is every entry but the skipped ones, in config order.
|
|
127
|
+
//
|
|
128
|
+
// AN UNKNOWN RANGE RUNS THE CONDITIONAL ENTRIES. A land made elsewhere, or a
|
|
129
|
+
// diff git would not answer, says nothing about what changed, and only one
|
|
130
|
+
// reading is harmless: a redundant generate costs seconds, a skipped one leaves
|
|
131
|
+
// the base red with nothing pointing at why (`.claude/rules/negative-checks.md`
|
|
132
|
+
// rule 4). An EMPTY known range is not unknown — a land whose commits touch no
|
|
133
|
+
// files is healthy, and it skips them.
|
|
134
|
+
function afterLandFor(config, cwd, range = null) {
|
|
135
|
+
const raw = (config && Array.isArray(config.afterLand)) ? config.afterLand : []
|
|
136
|
+
const entries = raw.map((e) => decide(asEntry(e), range))
|
|
137
|
+
const commands = entries.filter((e) => e.decision !== 'skipped').map((e) => e.run)
|
|
138
|
+
return { cwd: entries.length ? cwd : null, commands, entries, range }
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function decide(entry, range) {
|
|
142
|
+
if (!entry.when) return { ...entry, decision: 'always', matched: null }
|
|
143
|
+
if (range === null) return { ...entry, decision: 'unknown', matched: null }
|
|
144
|
+
const res = entry.when.map(globToRegExp)
|
|
145
|
+
const matched = range.find((f) => res.some((r) => r.test(f)))
|
|
146
|
+
return matched === undefined
|
|
147
|
+
? { ...entry, decision: 'skipped', matched: null }
|
|
148
|
+
: { ...entry, decision: 'matched', matched }
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Normalised config holds `{ run, when }`; a pure caller may still hand over
|
|
152
|
+
// the plain string an entry is written as.
|
|
153
|
+
function asEntry(entry) {
|
|
154
|
+
return typeof entry === 'string' ? { run: entry, when: null } : { run: entry.run, when: entry.when || null }
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// `changedFiles` from a planner's ctx, with anything that is not a list read as
|
|
158
|
+
// unknown — a caller that did not supply it said nothing about the range.
|
|
159
|
+
function rangeOf(ctx) {
|
|
160
|
+
return Array.isArray(ctx && ctx.changedFiles) ? ctx.changedFiles : null
|
|
120
161
|
}
|
|
121
162
|
|
|
122
163
|
function noAfterLand() {
|
|
123
|
-
return { cwd: null, commands: [] }
|
|
164
|
+
return { cwd: null, commands: [], entries: [], range: null }
|
|
124
165
|
}
|
|
125
166
|
|
|
126
|
-
module.exports = { planIntegrate, planIntegrateCheckout, afterLandFor }
|
|
167
|
+
module.exports = { planIntegrate, planIntegrateCheckout, afterLandFor, rangeOf }
|
package/src/env/live.js
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
const fs = require('node:fs')
|
|
20
20
|
const path = require('node:path')
|
|
21
|
+
const { globToRegExp } = require('./glob.js')
|
|
21
22
|
|
|
22
23
|
const REQUIRED = ['spec', 'branch', 'holder', 'heldSince', 'baseMainCommit']
|
|
23
24
|
|
|
@@ -179,32 +180,6 @@ function liveStateLine(live) {
|
|
|
179
180
|
|
|
180
181
|
// --- stateful detection (glob matching) -----------------------------------
|
|
181
182
|
|
|
182
|
-
// Translate a restricted glob into an anchored RegExp: `**` matches across path
|
|
183
|
-
// separators (with an optional trailing `/`), `*` matches within a segment, `?`
|
|
184
|
-
// a single non-separator char. Enough for migration-path globs, no dependency.
|
|
185
|
-
function globToRegExp(glob) {
|
|
186
|
-
let re = ''
|
|
187
|
-
for (let i = 0; i < glob.length; i++) {
|
|
188
|
-
const ch = glob[i]
|
|
189
|
-
if (ch === '*') {
|
|
190
|
-
if (glob[i + 1] === '*') {
|
|
191
|
-
re += '.*'
|
|
192
|
-
i++
|
|
193
|
-
if (glob[i + 1] === '/') i++ // consume the `/` in `**/`
|
|
194
|
-
} else {
|
|
195
|
-
re += '[^/]*'
|
|
196
|
-
}
|
|
197
|
-
} else if (ch === '?') {
|
|
198
|
-
re += '[^/]'
|
|
199
|
-
} else if ('.+^${}()|[]\\/'.includes(ch)) {
|
|
200
|
-
re += '\\' + ch
|
|
201
|
-
} else {
|
|
202
|
-
re += ch
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
return new RegExp('^' + re + '$')
|
|
206
|
-
}
|
|
207
|
-
|
|
208
183
|
// True when any file path matches any of the migration globs. Empty patterns or
|
|
209
184
|
// no files → false (nothing configured / nothing changed).
|
|
210
185
|
function migrationsHit(files, patterns) {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
27
|
const { withRateLimitRetry, MAX_RETRIES } = require('../provider-kit/src/http.js')
|
|
28
|
-
const { htmlToText, looksLikeHtml } = require('./dialect.js')
|
|
28
|
+
const { htmlToText, looksLikeHtml, decodeEntities } = require('./dialect.js')
|
|
29
29
|
const { authHeader } = require('./credentials.js')
|
|
30
30
|
|
|
31
31
|
const API_VERSION = '7.1'
|
|
@@ -151,16 +151,18 @@ function makeApiAdapter({ orgUrl, project, token, releaseType, fetch: fetchImpl,
|
|
|
151
151
|
return m ? m[1] : null
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
// Text at the boundary: a markdown-format description
|
|
155
|
-
//
|
|
156
|
-
//
|
|
157
|
-
//
|
|
154
|
+
// Text at the boundary: a markdown-format description is entity-DECODED —
|
|
155
|
+
// Azure encodes stray HTML specials on store (`>` → `>`, `"` → `"`,
|
|
156
|
+
// observed live), so the decode is the inverse of the store, and what comes
|
|
157
|
+
// out is the author's text. An HTML-era one is reduced to text, and the
|
|
158
|
+
// format map is the positive signal that decides — the tag sniff only covers
|
|
159
|
+
// items too old to carry one.
|
|
158
160
|
function descriptionText(raw) {
|
|
159
161
|
const d = raw.fields && raw.fields['System.Description']
|
|
160
162
|
if (d == null) return null
|
|
161
163
|
const text = String(d)
|
|
162
164
|
const fmt = raw.multilineFieldsFormat && raw.multilineFieldsFormat['System.Description']
|
|
163
|
-
if (fmt && String(fmt).toLowerCase() === 'markdown') return text
|
|
165
|
+
if (fmt && String(fmt).toLowerCase() === 'markdown') return decodeEntities(text)
|
|
164
166
|
return looksLikeHtml(text) ? htmlToText(text) : text
|
|
165
167
|
}
|
|
166
168
|
|
|
@@ -379,7 +381,11 @@ function makeApiAdapter({ orgUrl, project, token, releaseType, fetch: fetchImpl,
|
|
|
379
381
|
const u = raw && raw.authenticatedUser
|
|
380
382
|
if (!u || !u.id) return null
|
|
381
383
|
const email = (u.properties && u.properties.Account && u.properties.Account.$value) || null
|
|
382
|
-
|
|
384
|
+
// The id slot carries the uniqueName/email, because that is what
|
|
385
|
+
// `System.AssignedTo` accepts — Azure refuses the connectionData GUID as
|
|
386
|
+
// an "unknown identity" (live repro, bug-azure-boards-adoption-fixes).
|
|
387
|
+
// The GUID survives only where no account property exists at all.
|
|
388
|
+
return { id: email || u.id, name: u.providerDisplayName || null, email }
|
|
383
389
|
},
|
|
384
390
|
|
|
385
391
|
/**
|
|
@@ -407,14 +413,21 @@ function makeApiAdapter({ orgUrl, project, token, releaseType, fetch: fetchImpl,
|
|
|
407
413
|
}
|
|
408
414
|
throw error
|
|
409
415
|
}
|
|
410
|
-
const users = ((raw && raw.value) || []).slice(0, limit).map((u) =>
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
416
|
+
const users = ((raw && raw.value) || []).slice(0, limit).map((u) => {
|
|
417
|
+
const email = (u.properties && u.properties.Account && u.properties.Account.$value) || null
|
|
418
|
+
return {
|
|
419
|
+
// The assignable value first: `System.AssignedTo` accepts the
|
|
420
|
+
// uniqueName/email and refuses the vssps GUID, and this id is what
|
|
421
|
+
// `/spec-claim --to` stamps. The GUID remains the fallback for an
|
|
422
|
+
// identity with no account property (a group, a service identity).
|
|
423
|
+
id: email || u.id,
|
|
424
|
+
name: u.providerDisplayName || null,
|
|
425
|
+
email,
|
|
426
|
+
// `isActive` is a positive marker where present; absence is not
|
|
427
|
+
// deactivation, so the default is active.
|
|
428
|
+
active: u.isActive === false ? false : true,
|
|
429
|
+
}
|
|
430
|
+
})
|
|
418
431
|
return { users, nextCursor: null }
|
|
419
432
|
},
|
|
420
433
|
|