@skitterbyte/skitterspec-github 3.2.0 → 3.2.2
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/package.json +1 -1
- package/src/cli.js +41 -6
- package/src/env/classify.js +61 -6
- package/src/env/epic.js +1 -1
- package/src/env/epicpage.js +1 -1
- package/src/env/serve.js +3 -2
- package/src/provider.js +46 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skitterbyte/skitterspec-github",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"description": "Spec-driven development for Claude Code, with one-way GitHub 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 GitHub Issues, sub-issues and a Projects v2 board, with GitHub Releases. The repo is canonical; GitHub 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
|
@@ -204,7 +204,7 @@ const {
|
|
|
204
204
|
} = require('./env/reviewers.js')
|
|
205
205
|
const { planUp, planCheckoutUp, resolveStack, worktreeSteps } = require('./env/provision.js')
|
|
206
206
|
const { runBootstrap, describeStep } = require('./env/bootstrap.js')
|
|
207
|
-
const { classifyDirtyTree, dirtyPaths, specDocsIn } = require('./env/classify.js')
|
|
207
|
+
const { classifyDirtyTree, dirtyPaths, specDocsIn, treeReader } = require('./env/classify.js')
|
|
208
208
|
const { isGitCommit } = require('./env/commitcmd.js')
|
|
209
209
|
const { planDown, planDownCheckout } = require('./env/teardown.js')
|
|
210
210
|
const {
|
|
@@ -344,6 +344,7 @@ Usage:
|
|
|
344
344
|
prune reap orphaned test-DB volumes (--older-than <days>)
|
|
345
345
|
dev up <spec> start host dev servers on the spec's ports
|
|
346
346
|
dev down <spec> stop the spec's host dev servers
|
|
347
|
+
(--plan on either: describe, touch nothing)
|
|
347
348
|
connect <spec> expose a spec on the canonical ports (main = off)
|
|
348
349
|
integrate <spec> plan the land: rebase + fast-forward, or in PR
|
|
349
350
|
mode push + PR (--push, --draft, --strategy);
|
|
@@ -5343,7 +5344,8 @@ function specEnvStage(dir, config, specArg, flags = {}, invokedFrom = dir) {
|
|
|
5343
5344
|
// PROJECT folder in it — what a pathspec is when run from where a session
|
|
5344
5345
|
// stands. The same thing at the root of a repo (feat-subfolder-project).
|
|
5345
5346
|
const prefix = prefixOf(config)
|
|
5346
|
-
|
|
5347
|
+
// The same reader the page uses, so an epic stages the members it shows.
|
|
5348
|
+
const split = classifyDirtyTree(spec, paths, config, { readFile: treeReader(tree) })
|
|
5347
5349
|
const owned = split.owned.map((p) => projectRelative(p, prefix))
|
|
5348
5350
|
const foreign = split.foreign.map((p) => projectRelative(p, prefix))
|
|
5349
5351
|
const treeShown = prefix ? projectIn(tree, prefix) : tree
|
|
@@ -7118,12 +7120,17 @@ async function specEnvReview(dir, config, specArg, flags, invokedFrom = dir) {
|
|
|
7118
7120
|
// servers (e.g. `pnpm dev`) need a block even on a worktree-only spec, so `up`
|
|
7119
7121
|
// allocates a slot if the spec has none (idempotent). The planner is pure
|
|
7120
7122
|
// (dev.js); the spawning/killing lives in supervise.js.
|
|
7121
|
-
|
|
7123
|
+
//
|
|
7124
|
+
// `--plan` describes and touches nothing — no slot reserved, nothing spawned or
|
|
7125
|
+
// killed — as it does on `up`, `bootstrap` and `hotfix land`. This verb once
|
|
7126
|
+
// never received the flags, so `dev up --plan` started the very servers it was
|
|
7127
|
+
// asked to describe (bug-dev-up-plan-starts-servers).
|
|
7128
|
+
async function specEnvDev(dir, config, positional, flags = {}) {
|
|
7122
7129
|
const action = positional[0]
|
|
7123
7130
|
const specArg = positional[1]
|
|
7124
7131
|
// The action must be named; the spec may be omitted (resolved from the registry).
|
|
7125
7132
|
if (action !== 'up' && action !== 'down') {
|
|
7126
|
-
process.stdout.write('Usage: skitterspec spec-env dev <up|down> [spec]\n')
|
|
7133
|
+
process.stdout.write('Usage: skitterspec spec-env dev <up|down> [spec] [--plan]\n')
|
|
7127
7134
|
return
|
|
7128
7135
|
}
|
|
7129
7136
|
const spec = resolveSpecWithWorktree(dir, config, specArg)
|
|
@@ -7138,9 +7145,10 @@ async function specEnvDev(dir, config, positional) {
|
|
|
7138
7145
|
let slot
|
|
7139
7146
|
if (action === 'up') {
|
|
7140
7147
|
// Ensure a slot (idempotent) so the port block is reserved even worktree-only.
|
|
7148
|
+
// A plan computes the same slot and writes nothing.
|
|
7141
7149
|
const alloc = allocateSlot(registry, spec.folder)
|
|
7142
7150
|
slot = alloc.slot
|
|
7143
|
-
writeRegistry(dir, config, alloc.registry)
|
|
7151
|
+
if (!flags.plan) writeRegistry(dir, config, alloc.registry)
|
|
7144
7152
|
} else {
|
|
7145
7153
|
// Teardown only needs the pid-file paths (keyed by folder, not slot), so the
|
|
7146
7154
|
// slot value is immaterial — use the existing one, or 0 as a placeholder.
|
|
@@ -7151,6 +7159,32 @@ async function specEnvDev(dir, config, positional) {
|
|
|
7151
7159
|
|
|
7152
7160
|
const plan = planDev(spec, slot, config)
|
|
7153
7161
|
|
|
7162
|
+
if (flags.plan) {
|
|
7163
|
+
// A live pid is the positive signal for "already running"; a missing or
|
|
7164
|
+
// stale pid file reads as would-start, which is what `up` would then do.
|
|
7165
|
+
const running = (proc) => {
|
|
7166
|
+
const pid = readPid(path.resolve(dir, proc.pidFile))
|
|
7167
|
+
return pid && isAlive(pid) ? pid : null
|
|
7168
|
+
}
|
|
7169
|
+
const out = [
|
|
7170
|
+
`spec-env dev ${action}: ${spec.folder} slot ${slot} (plan — nothing ${action === 'up' ? 'started' : 'stopped'})`,
|
|
7171
|
+
]
|
|
7172
|
+
for (const proc of plan.procs) {
|
|
7173
|
+
const pid = running(proc)
|
|
7174
|
+
if (action === 'up') {
|
|
7175
|
+
out.push(
|
|
7176
|
+
pid
|
|
7177
|
+
? ` ${proc.name}: port ${proc.port} already running (pid ${pid})`
|
|
7178
|
+
: ` ${proc.name}: port ${proc.port} would start: ${proc.command}`,
|
|
7179
|
+
)
|
|
7180
|
+
} else {
|
|
7181
|
+
out.push(` ${proc.name}: ${pid ? `would stop pid ${pid}` : 'not running'}`)
|
|
7182
|
+
}
|
|
7183
|
+
}
|
|
7184
|
+
process.stdout.write(out.join('\n') + '\n')
|
|
7185
|
+
return
|
|
7186
|
+
}
|
|
7187
|
+
|
|
7154
7188
|
if (action === 'up') {
|
|
7155
7189
|
const out = [`spec-env dev up: ${spec.folder} slot ${slot} (ports from ${plan.portOffset})`]
|
|
7156
7190
|
for (const proc of plan.procs) {
|
|
@@ -8718,7 +8752,7 @@ async function specEnvDispatch(sub, dir, config, positional, flags, present, inv
|
|
|
8718
8752
|
specEnvPrune(dir, config, flags)
|
|
8719
8753
|
break
|
|
8720
8754
|
case 'dev':
|
|
8721
|
-
await specEnvDev(dir, config, positional)
|
|
8755
|
+
await specEnvDev(dir, config, positional, flags)
|
|
8722
8756
|
break
|
|
8723
8757
|
case 'connect':
|
|
8724
8758
|
await specEnvConnect(dir, config, positional[0])
|
|
@@ -9006,6 +9040,7 @@ module.exports = {
|
|
|
9006
9040
|
run,
|
|
9007
9041
|
parse,
|
|
9008
9042
|
HELP,
|
|
9043
|
+
PROVIDER_COMMANDS,
|
|
9009
9044
|
unknownCommand,
|
|
9010
9045
|
rankLanAddresses,
|
|
9011
9046
|
offerableLanAddresses,
|
package/src/env/classify.js
CHANGED
|
@@ -15,9 +15,19 @@
|
|
|
15
15
|
* foreign path disqualifies the whole tree.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
const fs = require('node:fs')
|
|
18
19
|
const path = require('node:path')
|
|
19
|
-
const { BUCKETS, expandTokens, readFrontmatterField } = require('./resolve.js')
|
|
20
|
-
const { fromRepoPath, prefixOf } = require('./project.js')
|
|
20
|
+
const { BUCKETS, expandTokens, readFrontmatterField, isEpic } = require('./resolve.js')
|
|
21
|
+
const { fromRepoPath, toRepoPath, prefixOf } = require('./project.js')
|
|
22
|
+
|
|
23
|
+
// The `> **Epic:**` header off an overview, unquoted, or null. The same reading
|
|
24
|
+
// as `epicHeaders` in env/epic.js, kept here so the classifier stays a leaf.
|
|
25
|
+
function epicNamed(text) {
|
|
26
|
+
const m = /^>\s*\*\*Epic:\*\*[ \t]*(.*)$/m.exec(text || '')
|
|
27
|
+
if (!m) return null
|
|
28
|
+
const value = m[1].trim().replace(/^`(.*)`$/, '$1').trim()
|
|
29
|
+
return value || null
|
|
30
|
+
}
|
|
21
31
|
|
|
22
32
|
// git reports repo-relative, forward-slashed paths; an untracked directory comes
|
|
23
33
|
// back with a trailing slash. Normalise both away so comparisons are exact.
|
|
@@ -77,10 +87,23 @@ function expandCompanion(pattern, spec, config) {
|
|
|
77
87
|
* (backlog → in-progress), so a tree mid-move is dirty in two buckets at once
|
|
78
88
|
* and both halves are the same spec's.
|
|
79
89
|
* - each expandable `spec.companionPaths` entry.
|
|
90
|
+
* - for an EPIC, and only given `readFile`: anything inside another spec's
|
|
91
|
+
* folder whose `00-overview.md`, read from the same tree, carries
|
|
92
|
+
* `> **Epic:** <this epic>`. `/spec` writes an epic WITH its members in one
|
|
93
|
+
* worktree, so those members are the epic's documents being written, not
|
|
94
|
+
* somebody else's work (bug-epic-page-misses-members).
|
|
95
|
+
*
|
|
96
|
+
* WHAT WOULD FOOL THE MEMBER RULE: a member's overview that is not in the tree
|
|
97
|
+
* being read. That reads as null, which is cannot-tell, and cannot-tell stays
|
|
98
|
+
* foreign: a refusal is the safe direction to be wrong in. A spec naming another
|
|
99
|
+
* epic, or none, is foreign as before.
|
|
80
100
|
*
|
|
101
|
+
* @param {object} [opts]
|
|
102
|
+
* - `readFile` repo-relative path → text, or null. Without it no member is
|
|
103
|
+
* owned, which is the answer every caller had before.
|
|
81
104
|
* @returns {{owned: string[], foreign: string[]}}
|
|
82
105
|
*/
|
|
83
|
-
function classifyDirtyTree(spec, dirtyPaths, config) {
|
|
106
|
+
function classifyDirtyTree(spec, dirtyPaths, config, { readFile = null } = {}) {
|
|
84
107
|
const owned = []
|
|
85
108
|
const foreign = []
|
|
86
109
|
if (!spec) return { owned, foreign: (dirtyPaths || []).map(normalize).filter(Boolean) }
|
|
@@ -93,12 +116,30 @@ function classifyDirtyTree(spec, dirtyPaths, config) {
|
|
|
93
116
|
}
|
|
94
117
|
|
|
95
118
|
const prefix = prefixOf(config)
|
|
119
|
+
// One read per member folder, however many of its files are dirty.
|
|
120
|
+
const memberFolders = new Map()
|
|
121
|
+
const memberOf = (rel) => {
|
|
122
|
+
if (!readFile || !isEpic(spec.folder) || rel === null) return false
|
|
123
|
+
const m = /^specs\/([^/]+)\/([^/]+)\//.exec(rel)
|
|
124
|
+
if (!m || !BUCKETS.includes(m[1])) return false
|
|
125
|
+
const key = `${m[1]}/${m[2]}`
|
|
126
|
+
if (!memberFolders.has(key)) {
|
|
127
|
+
let text = null
|
|
128
|
+
try {
|
|
129
|
+
text = readFile(toRepoPath(`specs/${key}/00-overview.md`, prefix))
|
|
130
|
+
} catch {
|
|
131
|
+
// unreadable: cannot tell, so not a member
|
|
132
|
+
}
|
|
133
|
+
memberFolders.set(key, epicNamed(text) === spec.folder)
|
|
134
|
+
}
|
|
135
|
+
return memberFolders.get(key)
|
|
136
|
+
}
|
|
96
137
|
for (const raw of dirtyPaths || []) {
|
|
97
138
|
const p = normalize(raw)
|
|
98
139
|
if (!p) continue
|
|
99
140
|
const rel = fromRepoPath(p, prefix)
|
|
100
141
|
const inFolder = rel !== null && folders.some((f) => rel === f || rel.startsWith(`${f}/`))
|
|
101
|
-
if (inFolder || (rel !== null && companions.has(rel))) owned.push(p)
|
|
142
|
+
if (inFolder || (rel !== null && companions.has(rel)) || memberOf(rel)) owned.push(p)
|
|
102
143
|
else foreign.push(p)
|
|
103
144
|
}
|
|
104
145
|
return { owned, foreign }
|
|
@@ -176,9 +217,23 @@ function dirtyPaths(git) {
|
|
|
176
217
|
function specDocsIn(tree, spec, config, git) {
|
|
177
218
|
const paths = dirtyPaths(git)
|
|
178
219
|
if (paths === null) return { error: 'git could not be read' }
|
|
179
|
-
const { owned } = classifyDirtyTree(spec, paths, config)
|
|
220
|
+
const { owned } = classifyDirtyTree(spec, paths, config, { readFile: treeReader(tree) })
|
|
180
221
|
if (!owned.length) return { empty: true }
|
|
181
222
|
return { tree, owned }
|
|
182
223
|
}
|
|
183
224
|
|
|
184
|
-
|
|
225
|
+
/**
|
|
226
|
+
* `classifyDirtyTree`'s `readFile` for a checkout: repo-relative path → its
|
|
227
|
+
* text in that working tree, or null when it cannot be read (cannot tell).
|
|
228
|
+
*/
|
|
229
|
+
function treeReader(root) {
|
|
230
|
+
return (rel) => {
|
|
231
|
+
try {
|
|
232
|
+
return fs.readFileSync(path.join(root, rel), 'utf8')
|
|
233
|
+
} catch {
|
|
234
|
+
return null
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
module.exports = { treeReader, classifyDirtyTree, expandCompanion, unquotePath, dirtyPaths, specDocsIn }
|
package/src/env/epic.js
CHANGED
|
@@ -419,7 +419,7 @@ function formatEpicStatus(s) {
|
|
|
419
419
|
if (!s.found && !s.members.length) {
|
|
420
420
|
return `no epic named ${s.epic}, and no spec names it as its Epic${s.here ? ` in ${s.here}` : ''}.\n`
|
|
421
421
|
}
|
|
422
|
-
const lanes = s.lanes === null ? 'no lane cap' : `${s.lanes} lanes, ${s.freeLanes} free`
|
|
422
|
+
const lanes = s.lanes === null ? 'no lane cap' : `${s.lanes} ${s.lanes === 1 ? 'lane' : 'lanes'}, ${s.freeLanes} free`
|
|
423
423
|
const where = s.here ? ` · headers from ${s.here}` : s.found ? '' : ' · epic not on the base branch'
|
|
424
424
|
const out = []
|
|
425
425
|
if (!s.members.length) {
|
package/src/env/epicpage.js
CHANGED
|
@@ -62,7 +62,7 @@ function stepItem(st, freeLanes) {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
function renderEpicPage(answer, { refreshSeconds = REFRESH_SECONDS, project = null } = {}) {
|
|
65
|
-
const lanes = answer.lanes === null ? 'no lane cap' : `${answer.lanes} lanes, ${answer.freeLanes} free`
|
|
65
|
+
const lanes = answer.lanes === null ? 'no lane cap' : `${answer.lanes} ${answer.lanes === 1 ? 'lane' : 'lanes'}, ${answer.freeLanes} free`
|
|
66
66
|
const { rows, next } = answer.rows ? { rows: answer.rows, next: answer.next } : epicRows(answer)
|
|
67
67
|
const { progress, groups, steps } = answer.steps ? answer : epicPlan(answer, { rows, next })
|
|
68
68
|
const byName = new Map(rows.map((r) => [r.spec, r]))
|
package/src/env/serve.js
CHANGED
|
@@ -45,7 +45,7 @@ const { renderEpicPage } = require('./epicpage.js')
|
|
|
45
45
|
const { readRegistry } = require('./registry.js')
|
|
46
46
|
const { loadEnvConfig } = require('./config.js')
|
|
47
47
|
const { primaryAnchor, attachProject, projectName, repoRootOf, prefixOf, fromRepoPath, toRepoPath } = require('./project.js')
|
|
48
|
-
const { specDocsIn, classifyDirtyTree, dirtyPaths } = require('./classify.js')
|
|
48
|
+
const { specDocsIn, classifyDirtyTree, dirtyPaths, treeReader } = require('./classify.js')
|
|
49
49
|
const { liveStateFor } = require('./live.js')
|
|
50
50
|
const { preferRemoteBase } = require('./host.js')
|
|
51
51
|
const { ROUTE: TADA_ROUTE, renderServedTada } = require('../tada/serve.js')
|
|
@@ -263,7 +263,8 @@ function docsWorktree(wt, spec, config) {
|
|
|
263
263
|
const paths = dirtyPaths(trimmedGitReader(wt))
|
|
264
264
|
// Cannot tell — not "no documents".
|
|
265
265
|
if (paths === null) return null
|
|
266
|
-
|
|
266
|
+
// An epic's members, written beside it in this same tree, are its documents.
|
|
267
|
+
const { owned, foreign } = classifyDirtyTree(spec, paths, config, { readFile: treeReader(wt) })
|
|
267
268
|
// A TRACKER SNAPSHOT IS NOT SOMEBODY ELSE'S WORK, and requiring a
|
|
268
269
|
// foreign-free tree cost the whole page for the commonest authoring tree
|
|
269
270
|
// there is. The linking push writes `specs/.core/linear-base/<ID>.base.json`
|
package/src/provider.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
// provider's `src/register.js` from where it is installed, and hands it the
|
|
10
10
|
// base's own engine modules to register on.
|
|
11
11
|
|
|
12
|
+
const { spawnSync } = require('node:child_process')
|
|
12
13
|
const { existsSync } = require('node:fs')
|
|
13
14
|
const { dirname, join } = require('node:path')
|
|
14
15
|
|
|
@@ -89,4 +90,48 @@ function registerConfiguredProvider({ cwd, envConfig, idea, resolve = resolvePac
|
|
|
89
90
|
return { provider: p.name, registered: 'config' }
|
|
90
91
|
}
|
|
91
92
|
|
|
92
|
-
|
|
93
|
+
/**
|
|
94
|
+
* Run a verb the base does not ship (`commands`, e.g. `spec-sync`) on the
|
|
95
|
+
* provider configured in the project at or above `cwd`, through that
|
|
96
|
+
* provider's own bin, so `skitterspec spec-sync …` answers exactly as
|
|
97
|
+
* `skitterspec-<provider> spec-sync …` does — the skills call the bare name.
|
|
98
|
+
*
|
|
99
|
+
* Returns the exit status to use, or `null` when there is nothing to forward
|
|
100
|
+
* and the base should carry on as it would have: a verb it ships, no project,
|
|
101
|
+
* no provider configured, or two of them (registerConfiguredProvider warns).
|
|
102
|
+
*
|
|
103
|
+
* WHAT WOULD FOOL THIS: a provider installed where Node's resolution cannot
|
|
104
|
+
* see it from the base or the project reads as not installed, and the verb is
|
|
105
|
+
* refused naming the package — never run on a guessed provider.
|
|
106
|
+
*/
|
|
107
|
+
function forwardProviderCommand({
|
|
108
|
+
cwd,
|
|
109
|
+
argv,
|
|
110
|
+
commands,
|
|
111
|
+
resolve = resolvePackage,
|
|
112
|
+
warn = () => {},
|
|
113
|
+
spawn = spawnSync,
|
|
114
|
+
}) {
|
|
115
|
+
const [cmd] = argv
|
|
116
|
+
if (!commands.includes(cmd)) return null
|
|
117
|
+
const dir = projectDir(cwd)
|
|
118
|
+
if (!dir) return null
|
|
119
|
+
const configured = PROVIDERS.filter((p) => existsSync(join(dir, p.configFile)))
|
|
120
|
+
if (configured.length !== 1) return null
|
|
121
|
+
const p = configured[0]
|
|
122
|
+
const bin = join('bin', `skitterspec-${p.name}.js`)
|
|
123
|
+
for (const [pkg] of p.candidates) {
|
|
124
|
+
const root = resolve(pkg, [__dirname, dir])
|
|
125
|
+
if (root && existsSync(join(root, bin))) {
|
|
126
|
+
const r = spawn(process.execPath, [join(root, bin), ...argv], { cwd, stdio: 'inherit' })
|
|
127
|
+
return r.status ?? 1
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
warn(
|
|
131
|
+
`skitterspec: ${cmd} needs @skitterbyte/skitterspec-${p.name} installed beside this one — ` +
|
|
132
|
+
`${p.configFile} is here but it is not. Install it alongside @skitterbyte/skitterspec, at the latest of each.`,
|
|
133
|
+
)
|
|
134
|
+
return 1
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
module.exports = { registerConfiguredProvider, forwardProviderCommand, PROVIDERS }
|