@skitterbyte/skitterspec 23.23.1 → 23.23.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.js +9 -0
- 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/bin/skitterspec.js
CHANGED
|
@@ -40,6 +40,15 @@ if (argv[0] === 'init' || (argv[0] === 'update' && !argv.includes('--all'))) {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
// Every skill's engine call runs this bin, providers included (#278), so pick
|
|
44
|
+
// up the provider the project configured before anything reads the config.
|
|
45
|
+
require('../src/provider.js').registerConfiguredProvider({
|
|
46
|
+
cwd: process.cwd(),
|
|
47
|
+
envConfig: require('../src/env/config.js'),
|
|
48
|
+
idea: require('../src/idea.js'),
|
|
49
|
+
warn: (line) => console.error(line),
|
|
50
|
+
})
|
|
51
|
+
|
|
43
52
|
run(argv).catch((err) => {
|
|
44
53
|
console.error(`skitterspec: ${err.message}`)
|
|
45
54
|
process.exit(1)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skitterbyte/skitterspec",
|
|
3
|
-
"version": "23.23.
|
|
3
|
+
"version": "23.23.3",
|
|
4
4
|
"description": "Spec-driven development for Claude Code \u2014 a tracker-free filesystem workflow: lifecycle skills and per-spec isolation. For Linear sync, install @skitterbyte/skitterspec-linear instead.",
|
|
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 }
|