@skitterbyte/skitterspec-azure-boards 3.1.1 → 3.1.3
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/bin/skitterspec-azure-boards.js +5 -18
- package/package.json +1 -1
- package/src/cli.js +10 -1
- package/src/env/serve.js +24 -1
- package/src/provider.js +92 -0
- package/src/vendor/azure-boards/register.js +29 -0
|
@@ -22,24 +22,11 @@ if (!existsSync(join(__dirname, '..', 'src'))) {
|
|
|
22
22
|
|
|
23
23
|
const { run, HELP } = require('../src/cli.js')
|
|
24
24
|
|
|
25
|
-
// The provider's
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
require('../src/env/config.js')
|
|
29
|
-
require('../src/
|
|
30
|
-
)
|
|
31
|
-
// Its config file too: present, it is what makes `land.specDocs` default to
|
|
32
|
-
// "branch" (see common src/env/config.js, setProviderConfigFile).
|
|
33
|
-
require('../src/env/config.js').setProviderConfigFile(
|
|
34
|
-
require('../src/vendor/azure-boards/config.js').CONFIG_FILE,
|
|
35
|
-
)
|
|
36
|
-
// Azure Boards holds ideas: a work item tagged `intake.ideaTag`, at the
|
|
37
|
-
// project root. Registered so `skitterspec idea` hands Azure the command
|
|
38
|
-
// instead of writing specs/ideas.md (see common src/idea.js, selectStore).
|
|
39
|
-
require('../src/idea.js').setProviderIdeaStore({
|
|
40
|
-
supports: true,
|
|
41
|
-
run: (sub, argv, { cwd, out } = {}) =>
|
|
42
|
-
require('../src/vendor/azure-boards/cli-sync.js').specSync(['idea', sub, ...argv], { cwd, out }),
|
|
25
|
+
// The provider's registrations on the engine: env defaults, config file and
|
|
26
|
+
// idea store (see src/register.js, which the base bin also calls).
|
|
27
|
+
require('../src/vendor/azure-boards/register.js').register({
|
|
28
|
+
envConfig: require('../src/env/config.js'),
|
|
29
|
+
idea: require('../src/idea.js'),
|
|
43
30
|
})
|
|
44
31
|
const {
|
|
45
32
|
PROVIDER_COMMANDS,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skitterbyte/skitterspec-azure-boards",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.3",
|
|
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
|
@@ -6668,6 +6668,10 @@ async function specEnvReview(dir, config, specArg, flags, invokedFrom = dir) {
|
|
|
6668
6668
|
`the server was running engine ${up.engineWas} and could not be replaced (${up.error}) — ` +
|
|
6669
6669
|
`its pages are drawn by that engine`
|
|
6670
6670
|
: `the server was running engine ${up.engineWas}; restarted on ${up.engineIs}`
|
|
6671
|
+
} else if (up.engine === 'newer') {
|
|
6672
|
+
// LOUD, because this render's own engine is the old one: its page is
|
|
6673
|
+
// served by a later engine than the one that wrote it.
|
|
6674
|
+
serverSaid = `the server runs engine ${up.engineWas}, newer than this one (${up.engineIs}) — kept it`
|
|
6671
6675
|
}
|
|
6672
6676
|
if (!up.error) {
|
|
6673
6677
|
// The URLs come from the bind the server HAS, not the one asked for just
|
|
@@ -7214,6 +7218,8 @@ async function ensureReviewServer(dir, config, { host = '127.0.0.1', port, resta
|
|
|
7214
7218
|
started: false,
|
|
7215
7219
|
// `current` needs no comment and `unknown` claims nothing — a server
|
|
7216
7220
|
// from before the version was recorded is healthy, not suspect.
|
|
7221
|
+
// `newer` is adopted too, and the render says so: replacing it would
|
|
7222
|
+
// put an older engine behind every spec's page.
|
|
7217
7223
|
engine: verdict,
|
|
7218
7224
|
engineWas: settings.engine || null,
|
|
7219
7225
|
engineIs: now,
|
|
@@ -7416,7 +7422,9 @@ async function specEnvReviewServe(dir, config, flags) {
|
|
|
7416
7422
|
(settings.engine ? ` engine: ${settings.engine}\n` : '') +
|
|
7417
7423
|
(verdict === 'stale'
|
|
7418
7424
|
? ` the engine moved under it — this one is ${engineVersionFor(proc.script)}\n`
|
|
7419
|
-
: ''
|
|
7425
|
+
: verdict === 'newer'
|
|
7426
|
+
? ` newer than this engine (${engineVersionFor(proc.script)}) — kept, not downgraded\n`
|
|
7427
|
+
: ''),
|
|
7420
7428
|
)
|
|
7421
7429
|
return
|
|
7422
7430
|
}
|
|
@@ -8741,6 +8749,7 @@ module.exports = {
|
|
|
8741
8749
|
serveProcFor,
|
|
8742
8750
|
serverScriptOk,
|
|
8743
8751
|
daemonScript,
|
|
8752
|
+
ensureReviewServer,
|
|
8744
8753
|
reviewServedUrls,
|
|
8745
8754
|
memberPageLink,
|
|
8746
8755
|
restartHost,
|
package/src/env/serve.js
CHANGED
|
@@ -938,6 +938,22 @@ function engineVersionFor(scriptPath) {
|
|
|
938
938
|
return null
|
|
939
939
|
}
|
|
940
940
|
|
|
941
|
+
// Order two `X.Y.Z[-pre]` versions: negative, zero or positive, or null when
|
|
942
|
+
// either is not one. A release sorts after its own pre-releases, as in semver;
|
|
943
|
+
// pre-release labels compare as strings.
|
|
944
|
+
function compareVersions(a, b) {
|
|
945
|
+
const parse = (v) => /^(\d+)\.(\d+)\.(\d+)(?:-([^+]+))?(?:\+.*)?$/.exec(v)
|
|
946
|
+
const x = parse(a)
|
|
947
|
+
const y = parse(b)
|
|
948
|
+
if (!x || !y) return null
|
|
949
|
+
for (let i = 1; i <= 3; i++) {
|
|
950
|
+
if (Number(x[i]) !== Number(y[i])) return Number(x[i]) - Number(y[i])
|
|
951
|
+
}
|
|
952
|
+
if (!x[4] !== !y[4]) return x[4] ? -1 : 1
|
|
953
|
+
if (!x[4]) return 0
|
|
954
|
+
return x[4] < y[4] ? -1 : x[4] > y[4] ? 1 : 0
|
|
955
|
+
}
|
|
956
|
+
|
|
941
957
|
/**
|
|
942
958
|
* Is the running server executing the engine this one would start? Pure.
|
|
943
959
|
*
|
|
@@ -952,11 +968,18 @@ function engineVersionFor(scriptPath) {
|
|
|
952
968
|
* `running` is null whenever `engineVersionFor` could not read a package at all
|
|
953
969
|
* (a bundled build, an odd install layout). Both are answered `unknown`, and
|
|
954
970
|
* neither is evidence of anything.
|
|
971
|
+
*
|
|
972
|
+
* AND A FOURTH, `newer`: the running server is a LATER engine than this one.
|
|
973
|
+
* Replacing it would be a downgrade. That happened when a worktree pinned at an
|
|
974
|
+
* old release ran its own older engine, and the shared server was restarted
|
|
975
|
+
* from 2.19.0 down to 2.5.0. The caller adopts a newer server. Versions that
|
|
976
|
+
* cannot be ordered (not `X.Y.Z[-pre]`) are `stale` as before, so this only
|
|
977
|
+
* ever narrows a restart and never adds one.
|
|
955
978
|
*/
|
|
956
979
|
function staleServer(recorded, running, recordedMtime, runningMtime) {
|
|
957
980
|
if (typeof recorded !== 'string' || !recorded) return 'unknown'
|
|
958
981
|
if (typeof running !== 'string' || !running) return 'unknown'
|
|
959
|
-
if (recorded !== running) return 'stale'
|
|
982
|
+
if (recorded !== running) return compareVersions(recorded, running) > 0 ? 'newer' : 'stale'
|
|
960
983
|
|
|
961
984
|
// SAME VERSION IS NOT SAME CODE, which is the whole of this addition. The
|
|
962
985
|
// daemon runs a built copy of the engine — in this repo a symlink to the
|
package/src/provider.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
// The base `skitterspec` bin, in a project with a ticketing provider set up.
|
|
4
|
+
//
|
|
5
|
+
// Providers stopped answering to `skitterspec` (#278), so the bare name always
|
|
6
|
+
// runs this distribution — and a provider's registrations (the `land.specDocs`
|
|
7
|
+
// default, its env defaults, its idea store) used to happen only in its own
|
|
8
|
+
// bin. Here the base finds the provider the project configured, loads that
|
|
9
|
+
// provider's `src/register.js` from where it is installed, and hands it the
|
|
10
|
+
// base's own engine modules to register on.
|
|
11
|
+
|
|
12
|
+
const { existsSync } = require('node:fs')
|
|
13
|
+
const { dirname, join } = require('node:path')
|
|
14
|
+
|
|
15
|
+
// Each provider: its config file, and where its register module lives — in the
|
|
16
|
+
// published superset (vendored under src/vendor/) and in the workspace source
|
|
17
|
+
// package, tried in that order.
|
|
18
|
+
const PROVIDERS = [
|
|
19
|
+
{ name: 'linear', configFile: join('specs', '.core', 'linear.config.json') },
|
|
20
|
+
{ name: 'jira', configFile: join('specs', '.core', 'jira.config.json') },
|
|
21
|
+
{ name: 'github', configFile: join('specs', '.core', 'github.config.json') },
|
|
22
|
+
{ name: 'azure-boards', configFile: join('specs', '.core', 'azure-boards.config.json') },
|
|
23
|
+
].map((p) => ({
|
|
24
|
+
...p,
|
|
25
|
+
candidates: [
|
|
26
|
+
[`@skitterbyte/skitterspec-${p.name}`, join('src', 'vendor', p.name, 'register.js')],
|
|
27
|
+
[`@skitterbyte/skitterspec-provider-${p.name}`, join('src', 'register.js')],
|
|
28
|
+
],
|
|
29
|
+
}))
|
|
30
|
+
|
|
31
|
+
// The nearest directory at or above `from` holding `specs/.core`. A worktree
|
|
32
|
+
// tracks its own, so a spec's worktree answers for itself.
|
|
33
|
+
function projectDir(from) {
|
|
34
|
+
for (let dir = from; ; dir = dirname(dir)) {
|
|
35
|
+
if (existsSync(join(dir, 'specs', '.core'))) return dir
|
|
36
|
+
if (dirname(dir) === dir) return null
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Where `name` is installed, looked for beside the base (a global install puts
|
|
41
|
+
// the provider next to it) and then from the project (a local install).
|
|
42
|
+
function resolvePackage(name, paths) {
|
|
43
|
+
try {
|
|
44
|
+
return dirname(require.resolve(`${name}/package.json`, { paths }))
|
|
45
|
+
} catch {
|
|
46
|
+
return null
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Register the provider configured in the project at or above `cwd` on the
|
|
52
|
+
* base engine's `envConfig` and `idea` modules.
|
|
53
|
+
*
|
|
54
|
+
* Returns `{ provider, registered }`: `registered` is `'full'` (its register
|
|
55
|
+
* module ran), `'config'` (not installed — only its config file is registered,
|
|
56
|
+
* so `land.specDocs` still defaults to "branch"), or `null` (nothing done).
|
|
57
|
+
*
|
|
58
|
+
* WHAT WOULD FOOL THIS: two provider config files in one project is a project
|
|
59
|
+
* this cannot read, so nothing is registered and it warns — the base's own
|
|
60
|
+
* behaviour, never a guess between them. A provider installed somewhere Node's
|
|
61
|
+
* resolution cannot see from the base or the project reads as not installed,
|
|
62
|
+
* and the config file alone is still the positive signal for the lane.
|
|
63
|
+
*/
|
|
64
|
+
function registerConfiguredProvider({ cwd, envConfig, idea, resolve = resolvePackage, warn = () => {} }) {
|
|
65
|
+
const dir = projectDir(cwd)
|
|
66
|
+
if (!dir) return { provider: null, registered: null }
|
|
67
|
+
const configured = PROVIDERS.filter((p) => existsSync(join(dir, p.configFile)))
|
|
68
|
+
if (configured.length === 0) return { provider: null, registered: null }
|
|
69
|
+
if (configured.length > 1) {
|
|
70
|
+
warn(
|
|
71
|
+
`skitterspec: more than one ticketing provider is configured here (${configured.map((p) => p.configFile).join(', ')}) — registering none`,
|
|
72
|
+
)
|
|
73
|
+
return { provider: null, registered: null }
|
|
74
|
+
}
|
|
75
|
+
const p = configured[0]
|
|
76
|
+
const paths = [__dirname, dir]
|
|
77
|
+
for (const [pkg, rel] of p.candidates) {
|
|
78
|
+
const root = resolve(pkg, paths)
|
|
79
|
+
if (root && existsSync(join(root, rel))) {
|
|
80
|
+
require(join(root, rel)).register({ envConfig, idea })
|
|
81
|
+
return { provider: p.name, registered: 'full' }
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
envConfig.setProviderConfigFile(p.configFile)
|
|
85
|
+
warn(
|
|
86
|
+
`skitterspec: ${p.configFile} is here but @skitterbyte/skitterspec-${p.name} is not installed beside this one — ` +
|
|
87
|
+
'spec docs ride the branch, but install it for its ideas and env defaults',
|
|
88
|
+
)
|
|
89
|
+
return { provider: p.name, registered: 'config' }
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
module.exports = { registerConfiguredProvider, PROVIDERS }
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
// What this provider tells the shared engine at start-up. Its own bin calls
|
|
4
|
+
// this, and so does the base `skitterspec` bin when it finds this provider
|
|
5
|
+
// configured in the project (common src/provider.js). A published superset
|
|
6
|
+
// carries its own copy of the engine, so the caller passes in the modules to
|
|
7
|
+
// register ON: registering on this package's copy would leave the base bin's
|
|
8
|
+
// engine as unregistered as before.
|
|
9
|
+
|
|
10
|
+
const { CONFIG_FILE, ENV_CONFIG_DEFAULTS } = require('./config.js')
|
|
11
|
+
|
|
12
|
+
function register({ envConfig, idea }) {
|
|
13
|
+
// The isolation defaults, beneath the project's own env.config.json, so
|
|
14
|
+
// `spec-env stage` claims this provider's snapshot sidecar without a hand
|
|
15
|
+
// edit (see common src/env/config.js, setProviderEnvDefaults).
|
|
16
|
+
envConfig.setProviderEnvDefaults(ENV_CONFIG_DEFAULTS)
|
|
17
|
+
// The config file: present, it is what makes `land.specDocs` default to
|
|
18
|
+
// "branch" (see common src/env/config.js, setProviderConfigFile).
|
|
19
|
+
envConfig.setProviderConfigFile(CONFIG_FILE)
|
|
20
|
+
// Azure Boards holds ideas: a work item tagged `intake.ideaTag`, at the
|
|
21
|
+
// project root, so `skitterspec idea` hands Azure the command instead of
|
|
22
|
+
// writing specs/ideas.md (see common src/idea.js, selectStore).
|
|
23
|
+
idea.setProviderIdeaStore({
|
|
24
|
+
supports: true,
|
|
25
|
+
run: (sub, argv, { cwd, out } = {}) => require('./cli-sync.js').specSync(['idea', sub, ...argv], { cwd, out }),
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = { register }
|