@skitterbyte/skitterspec-jira 2.15.0 → 2.17.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/MIGRATION.md +27 -0
- package/assets/claude-md-section.md +18 -9
- package/assets/commands/allow-main.md +1 -2
- package/assets/core/SETUP.md +12 -12
- package/assets/core/env.config.json.example +0 -1
- package/assets/core/env.config.md +28 -26
- package/assets/hooks/main-guard.cjs +73 -6
- package/assets/hooks/project-guard.cjs +80 -6
- package/assets/hooks/review-gate.cjs +73 -6
- package/assets/review/page.html +10 -83
- package/assets/rules/commit-trailers.md +2 -2
- package/assets/rules/spec-planning.md +26 -22
- package/assets/rules/spec-reports.md +52 -52
- package/assets/skills/no-spec/SKILL.md +2 -2
- package/assets/skills/spec/SKILL.md +22 -5
- package/assets/skills/spec-bug/SKILL.md +18 -15
- package/assets/skills/spec-complete/SKILL.md +23 -1
- package/assets/skills/spec-diff/SKILL.md +47 -115
- package/assets/skills/spec-hotfix/SKILL.md +18 -15
- package/assets/skills/spec-init/SKILL.md +4 -2
- package/assets/skills/spec-next/SKILL.md +66 -41
- package/assets/skills/spec-park/SKILL.md +92 -0
- package/assets/skills/spec-resume/SKILL.md +153 -0
- package/assets/skills/spec-review/SKILL.md +2 -2
- package/assets/skills/spec-reviewed/SKILL.md +1 -8
- package/assets/skills/spec-sync/SKILL.md +10 -10
- package/assets/skills/spec-todo/SKILL.md +5 -2
- package/package.json +1 -1
- package/src/cli.js +361 -208
- package/src/env/bootstrap.js +3 -1
- package/src/env/checks.js +49 -0
- package/src/env/config.js +27 -7
- package/src/env/hooks.js +53 -4
- package/src/env/live.js +48 -0
- package/src/env/provision.js +10 -2
- package/src/env/resume.js +234 -0
- package/src/env/review.js +71 -173
- package/src/env/serve.js +3 -7
- package/src/init.js +383 -50
- package/src/tada/todo.js +19 -4
- package/src/vendor/provider-kit/src/specs.js +46 -1
- package/src/vendor/sync-core/src/summary.js +10 -1
- package/assets/commands/spec-remote-review.md +0 -37
package/src/cli.js
CHANGED
|
@@ -5,7 +5,7 @@ const path = require('path')
|
|
|
5
5
|
const os = require('os')
|
|
6
6
|
const { pathToFileURL } = require('url')
|
|
7
7
|
const { execFileSync } = require('child_process')
|
|
8
|
-
const { init, resync, reset, checkSync, isExistingSetup } = require('./init.js')
|
|
8
|
+
const { init, resync, reset, checkSync, isExistingSetup, localSeedFiles } = require('./init.js')
|
|
9
9
|
const {
|
|
10
10
|
detectReleaseTooling,
|
|
11
11
|
removeReleaseTooling,
|
|
@@ -43,8 +43,10 @@ const SPEC_ENV_VERBS = Object.freeze([
|
|
|
43
43
|
'live',
|
|
44
44
|
'review',
|
|
45
45
|
'stage',
|
|
46
|
+
'checks',
|
|
46
47
|
'status',
|
|
47
48
|
'resolve',
|
|
49
|
+
'resume',
|
|
48
50
|
'base',
|
|
49
51
|
'nospec',
|
|
50
52
|
'main',
|
|
@@ -101,6 +103,9 @@ const {
|
|
|
101
103
|
readReceipt,
|
|
102
104
|
writeReceipt,
|
|
103
105
|
clearReceipt,
|
|
106
|
+
readLastLive,
|
|
107
|
+
writeLastLive,
|
|
108
|
+
clearLastLive,
|
|
104
109
|
summarizeReceipt,
|
|
105
110
|
migrationsHit,
|
|
106
111
|
depsChanged,
|
|
@@ -125,15 +130,9 @@ const {
|
|
|
125
130
|
renderReviewBlock,
|
|
126
131
|
reviewOutPath,
|
|
127
132
|
reviewFileUrl,
|
|
128
|
-
reviewUrlPath,
|
|
129
|
-
reviewPublishPath,
|
|
130
133
|
readReviewUrl,
|
|
131
|
-
readRemoteAllow,
|
|
132
|
-
writeRemoteAllow,
|
|
133
|
-
withSpecRemote,
|
|
134
134
|
publishedPageNotice,
|
|
135
135
|
reviewServerNotice,
|
|
136
|
-
renderReviewFragment,
|
|
137
136
|
resolveReader,
|
|
138
137
|
writeReviewPage,
|
|
139
138
|
reviewNotesPath,
|
|
@@ -198,6 +197,7 @@ const {
|
|
|
198
197
|
const { planPrune, liveSlugsForSpecs, reconcileRegistry } = require('./env/prune.js')
|
|
199
198
|
const { planIntegrate, planIntegrateCheckout, planIntegratePr, planIntegrateDocs } = require('./env/integrate.js')
|
|
200
199
|
const { specBranchDocs, preferBranches } = require('./env/specbranches.js')
|
|
200
|
+
const { findTarget, planResume, resumeLines, blockingNext } = require('./env/resume.js')
|
|
201
201
|
const { parseRemote, prFor, prPlanCommand, prAbandonCommand, preferRemoteBase } = require('./env/host.js')
|
|
202
202
|
const { collectDisposition } = require('./env/disposition.js')
|
|
203
203
|
const { planHandoff } = require('./env/handoff.js')
|
|
@@ -336,8 +336,13 @@ Usage:
|
|
|
336
336
|
--run-reviewers runs review.reviewers)
|
|
337
337
|
stage [spec] split the uncommitted tree into this spec's
|
|
338
338
|
documents and everything else
|
|
339
|
+
checks [spec] run complete.checks in the spec's worktree
|
|
340
|
+
(advisory — always exits 0)
|
|
339
341
|
status list provisioned specs + port blocks
|
|
340
342
|
resolve <spec> print resolved slug/type/branch/paths
|
|
343
|
+
resume [spec|#N] an in-flight spec: its blockers, and the plan
|
|
344
|
+
to rebuild its worktree from its branch
|
|
345
|
+
(prints commands; creates nothing)
|
|
341
346
|
base fetch, list baseBranchPattern matches
|
|
342
347
|
newest-first, mark the base, and name
|
|
343
348
|
specs forked from an older match
|
|
@@ -409,8 +414,12 @@ Options (init / update):
|
|
|
409
414
|
--dir <path> Target project dir (default: positional arg or cwd)
|
|
410
415
|
--gating (init) Adopt release gating: each spec records whether
|
|
411
416
|
it ships behind a feature flag
|
|
417
|
+
--local (init) Keep the install on this machine: managed
|
|
418
|
+
files excluded from git, hooks in
|
|
419
|
+
settings.local.json, the block in CLAUDE.local.md.
|
|
420
|
+
For one developer on a shared repo — never a team
|
|
412
421
|
--no-claude-md Skip creating/patching CLAUDE.md
|
|
413
|
-
--yes, -y
|
|
422
|
+
--yes, -y Accept defaults; skip the interactive setup prompts
|
|
414
423
|
--isolation / --no-isolation Enable/skip per-spec isolation (a git
|
|
415
424
|
worktree per spec; writes env.config.json)
|
|
416
425
|
--name <name> / --category <c> (init --isolation) Write project.name /
|
|
@@ -444,6 +453,7 @@ function parse(argv) {
|
|
|
444
453
|
if (a === '--force') opts.force = true
|
|
445
454
|
else if (a === '--no-claude-md') opts.claudeMd = false
|
|
446
455
|
else if (a === '--yes' || a === '-y') opts.yes = true
|
|
456
|
+
else if (a === '--local') opts.local = true
|
|
447
457
|
else if (a === '--isolation') opts.isolation = true
|
|
448
458
|
else if (a === '--no-isolation') opts.isolation = false
|
|
449
459
|
else if (a === '--gating') opts.gating = true
|
|
@@ -920,7 +930,20 @@ function repoBlockers(repo, specs) {
|
|
|
920
930
|
} catch {
|
|
921
931
|
return []
|
|
922
932
|
}
|
|
923
|
-
|
|
933
|
+
// Each spec's own copy — its worktree where it has one, since base reads
|
|
934
|
+
// `backlog` for the life of a spec and holds none of its Blocked on: edits.
|
|
935
|
+
// A spec that cannot be resolved or read is not parked, it is unknown.
|
|
936
|
+
const parked = {}
|
|
937
|
+
for (const spec of specs) {
|
|
938
|
+
try {
|
|
939
|
+
const copy = readSpecCopy(resolveSpecWithWorktree(repo, config, spec).path)
|
|
940
|
+
const b = copy && blockingNext(copy)
|
|
941
|
+
if (b) parked[spec] = b
|
|
942
|
+
} catch {
|
|
943
|
+
// cannot tell — say nothing
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
return readBlockers(reviewsDirFor(repo, config), specs, config.review && config.review.required, parked)
|
|
924
947
|
}
|
|
925
948
|
|
|
926
949
|
/**
|
|
@@ -1039,7 +1062,7 @@ async function serveTadaPage({ window, flags, recap }) {
|
|
|
1039
1062
|
const withQ = (u) => (u ? `${u}${q}` : u)
|
|
1040
1063
|
const page = { ...served, loopbackUrl: withQ(served.loopbackUrl), url: withQ(served.url), alternates: (served.alternates || []).map(withQ) }
|
|
1041
1064
|
const reader = resolveReader(config, process.env, process.platform)
|
|
1042
|
-
const tiers = reviewTierStack({ served: page, fileUrl: null,
|
|
1065
|
+
const tiers = reviewTierStack({ served: page, fileUrl: null, config, reader })
|
|
1043
1066
|
process.stdout.write(`page: ${humanLabel(window)}\n${reviewStackText(tiers)}`)
|
|
1044
1067
|
return true
|
|
1045
1068
|
}
|
|
@@ -1145,7 +1168,7 @@ function epicPageTiers(inputs, up, epic) {
|
|
|
1145
1168
|
if (!up) return { off: true, start: 'skitterspec spec-env review serve --host 0.0.0.0' }
|
|
1146
1169
|
const served = reviewServedUrls(up, offerableLanAddresses(), epic)
|
|
1147
1170
|
const reader = resolveReader(inputs.config, process.env, process.platform)
|
|
1148
|
-
return { tiers: reviewTierStack({ served, fileUrl: null,
|
|
1171
|
+
return { tiers: reviewTierStack({ served, fileUrl: null, config: inputs.config, reader }) }
|
|
1149
1172
|
}
|
|
1150
1173
|
|
|
1151
1174
|
function epicPageLines(page) {
|
|
@@ -2290,7 +2313,7 @@ function specEnvBootstrap(dir, config, specArg, flags = {}) {
|
|
|
2290
2313
|
// `setup` exactly as a spec does, since a `setup` that reads a seeded `.env`
|
|
2291
2314
|
// fails without it; what it never has is a stack, so no slot is consulted.
|
|
2292
2315
|
if (spec.specless && !spec.unwritten) {
|
|
2293
|
-
steps = worktreeSteps(spec, null, config, { docs, wantsDocker: false })
|
|
2316
|
+
steps = worktreeSteps(spec, null, config, { docs, wantsDocker: false, localSeeds: localSeedFiles(dir) })
|
|
2294
2317
|
} else {
|
|
2295
2318
|
const compose = composeFilePresent(dir, config)
|
|
2296
2319
|
const { wantsDocker } = resolveStack(spec, config, { docs, composeFilePresent: compose })
|
|
@@ -2310,6 +2333,7 @@ function specEnvBootstrap(dir, config, specArg, flags = {}) {
|
|
|
2310
2333
|
docs,
|
|
2311
2334
|
wantsDocker,
|
|
2312
2335
|
composeFilePresent: compose,
|
|
2336
|
+
localSeeds: localSeedFiles(dir),
|
|
2313
2337
|
})
|
|
2314
2338
|
}
|
|
2315
2339
|
|
|
@@ -2736,6 +2760,10 @@ function specEnvDown(dir, config, specArg, flags) {
|
|
|
2736
2760
|
writeRegistry(dir, config, next)
|
|
2737
2761
|
}
|
|
2738
2762
|
|
|
2763
|
+
// A torn-down spec is no longer anything a bare resolve should name.
|
|
2764
|
+
const last = readLastLive(dir, config)
|
|
2765
|
+
if (last && last.spec === spec.folder) clearLastLive(dir, config)
|
|
2766
|
+
|
|
2739
2767
|
const out = []
|
|
2740
2768
|
out.push(
|
|
2741
2769
|
`spec-env down: ${spec.folder}` +
|
|
@@ -2860,47 +2888,73 @@ function volumeCreatedAt(names) {
|
|
|
2860
2888
|
* `soleProvisionedSpec` below is a thin wrapper that turns the two empty-handed
|
|
2861
2889
|
* cases into the exact errors every other subcommand already relies on.
|
|
2862
2890
|
*/
|
|
2863
|
-
function provisionedSpecChoice(dir, config, cwd = process.cwd()) {
|
|
2891
|
+
function provisionedSpecChoice(dir, config, cwd = process.cwd(), { lastLive = true } = {}) {
|
|
2864
2892
|
const worktreePaths = liveWorktreePaths(gitReader(dir))
|
|
2865
2893
|
const provisioned = allSpecs(dir, config, worktreePaths, speclessMap(dir, config))
|
|
2866
|
-
.map((s) => ({ folder: s.folder, wt: path.resolve(s.worktreePath) }))
|
|
2894
|
+
.map((s) => ({ folder: s.folder, wt: path.resolve(s.worktreePath), project: s.projectPath }))
|
|
2867
2895
|
// The primary checkout is itself in `git worktree list`; a spec is
|
|
2868
2896
|
// provisioned only when it has its OWN worktree, separate from it.
|
|
2869
2897
|
.filter((s) => s.wt !== dir && worktreePaths.has(s.wt))
|
|
2870
2898
|
.sort((a, b) => a.folder.localeCompare(b.folder))
|
|
2899
|
+
// The project folder, which is what `resolve` prints as `worktree:` and what
|
|
2900
|
+
// `/spec-next --worktree` is checked against — the worktree root only differs
|
|
2901
|
+
// when the project sits below the git root.
|
|
2902
|
+
const worktrees = provisioned.map((s) => ({ spec: s.folder, worktree: s.project }))
|
|
2871
2903
|
|
|
2872
2904
|
// 1. Standing inside a spec's worktree names it outright. Deepest match wins,
|
|
2873
2905
|
// so a nested worktree is not shadowed by an ancestor one.
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2906
|
+
const real = (p) => {
|
|
2907
|
+
try {
|
|
2908
|
+
return fs.realpathSync.native(path.resolve(p))
|
|
2909
|
+
} catch {
|
|
2910
|
+
return path.resolve(p)
|
|
2911
|
+
}
|
|
2879
2912
|
}
|
|
2913
|
+
const here = real(cwd)
|
|
2880
2914
|
const inside = provisioned
|
|
2881
2915
|
.filter((s) => here === s.wt || here.startsWith(s.wt + path.sep))
|
|
2882
2916
|
.sort((a, b) => b.wt.length - a.wt.length)[0]
|
|
2883
|
-
if (inside) return { folder: inside.folder }
|
|
2917
|
+
if (inside) return { folder: inside.folder, via: 'here', worktrees }
|
|
2884
2918
|
|
|
2885
|
-
// 2.
|
|
2886
|
-
|
|
2887
|
-
|
|
2919
|
+
// 2. From the primary checkout, the spec `live release` last handed back
|
|
2920
|
+
// (bug-live-release-forgets-spec) — only while it is still provisioned, so
|
|
2921
|
+
// a record outliving its worktree falls through as cannot-tell. Nowhere
|
|
2922
|
+
// else: the record is this checkout's, and says nothing about other cwds.
|
|
2923
|
+
const primary = real(dir)
|
|
2924
|
+
if (lastLive && (here === primary || here.startsWith(primary + path.sep))) {
|
|
2925
|
+
const record = readLastLive(dir, config)
|
|
2926
|
+
const hit = record && provisioned.find((s) => s.folder === record.spec)
|
|
2927
|
+
if (hit) return { folder: hit.folder, via: 'last-live', worktrees }
|
|
2928
|
+
}
|
|
2929
|
+
|
|
2930
|
+
// 3. Otherwise only an unambiguous set answers.
|
|
2931
|
+
if (provisioned.length === 1) return { folder: provisioned[0].folder, via: 'sole', worktrees }
|
|
2932
|
+
return { candidates: provisioned.map((s) => s.folder), worktrees }
|
|
2888
2933
|
}
|
|
2889
2934
|
|
|
2890
2935
|
function soleProvisionedSpec(dir, config, cwd = process.cwd()) {
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2936
|
+
return provisionedSpecChoiceOrThrow(dir, config, cwd).folder
|
|
2937
|
+
}
|
|
2938
|
+
|
|
2939
|
+
// `provisionedSpecChoice`, with the two empty-handed cases turned into the
|
|
2940
|
+
// errors every subcommand relies on. Each carries `reason` ('ambiguous' |
|
|
2941
|
+
// 'none') and the worktrees, so `resolve --json` can report it as data.
|
|
2942
|
+
function provisionedSpecChoiceOrThrow(dir, config, cwd = process.cwd()) {
|
|
2943
|
+
const choice = provisionedSpecChoice(dir, config, cwd)
|
|
2944
|
+
if (choice.folder) return choice
|
|
2945
|
+
const err = !choice.candidates.length
|
|
2946
|
+
? new Error(
|
|
2947
|
+
'no spec given, and no spec has a worktree — name one explicitly, or run ' +
|
|
2948
|
+
'/spec-start to provision it.',
|
|
2949
|
+
)
|
|
2950
|
+
: new Error(
|
|
2951
|
+
`no spec given, and ${choice.candidates.length} specs have worktrees — name the one ` +
|
|
2952
|
+
`you mean, or run this from inside one:\n` +
|
|
2953
|
+
choice.worktrees.map((w, i) => ` ${i + 1}. ${w.spec} (${w.worktree})`).join('\n'),
|
|
2954
|
+
)
|
|
2955
|
+
err.reason = choice.candidates.length ? 'ambiguous' : 'none'
|
|
2956
|
+
err.candidates = choice.worktrees
|
|
2957
|
+
throw err
|
|
2904
2958
|
}
|
|
2905
2959
|
|
|
2906
2960
|
// Resolve a spec argument the ONE way every spec-env subcommand resolves it:
|
|
@@ -4469,14 +4523,60 @@ function assertPrimaryClean(dir, config, r) {
|
|
|
4469
4523
|
}
|
|
4470
4524
|
|
|
4471
4525
|
// Print the resolved identity/coordinates for a single spec.
|
|
4526
|
+
const RESOLVED_VIA = {
|
|
4527
|
+
here: 'the worktree you are standing in',
|
|
4528
|
+
'last-live': 'last live on this checkout',
|
|
4529
|
+
sole: 'the only spec provisioned',
|
|
4530
|
+
}
|
|
4531
|
+
|
|
4472
4532
|
function specEnvResolve(dir, config, specArg, flags = {}) {
|
|
4533
|
+
// Bare, say HOW it resolved as well as what: a caller standing in the primary
|
|
4534
|
+
// checkout cannot see which rung answered. `--json` also reports the two
|
|
4535
|
+
// empty-handed cases as data — `ambiguous` and `none` call for different
|
|
4536
|
+
// next steps, and a skill should not tell them apart by an Error's wording.
|
|
4537
|
+
let via = 'named'
|
|
4538
|
+
if (!specArg) {
|
|
4539
|
+
try {
|
|
4540
|
+
const choice = provisionedSpecChoiceOrThrow(dir, config)
|
|
4541
|
+
specArg = choice.folder
|
|
4542
|
+
via = choice.via
|
|
4543
|
+
} catch (err) {
|
|
4544
|
+
if (!flags.json || !err.reason) throw err
|
|
4545
|
+
process.stdout.write(
|
|
4546
|
+
JSON.stringify({ ok: false, reason: err.reason, error: err.message, candidates: err.candidates }, null, 2) +
|
|
4547
|
+
'\n',
|
|
4548
|
+
)
|
|
4549
|
+
return
|
|
4550
|
+
}
|
|
4551
|
+
}
|
|
4473
4552
|
const r = resolveSpecWithWorktree(dir, config, specArg)
|
|
4474
4553
|
if (flags.recordPrimary) return recordPrimary(dir, config, r)
|
|
4475
4554
|
if (flags.assertPrimaryClean) return assertPrimaryClean(dir, config, r)
|
|
4555
|
+
if (flags.json) {
|
|
4556
|
+
process.stdout.write(
|
|
4557
|
+
JSON.stringify(
|
|
4558
|
+
{
|
|
4559
|
+
ok: true,
|
|
4560
|
+
spec: r.folder,
|
|
4561
|
+
via,
|
|
4562
|
+
bucket: r.specless ? null : r.bucket,
|
|
4563
|
+
type: r.type,
|
|
4564
|
+
slug: r.slug,
|
|
4565
|
+
branch: r.branch,
|
|
4566
|
+
worktree: r.projectPath,
|
|
4567
|
+
project: r.projectName,
|
|
4568
|
+
},
|
|
4569
|
+
null,
|
|
4570
|
+
2,
|
|
4571
|
+
) + '\n',
|
|
4572
|
+
)
|
|
4573
|
+
return
|
|
4574
|
+
}
|
|
4476
4575
|
process.stdout.write(
|
|
4477
4576
|
// A specless branch has no bucket because it has no document — say that
|
|
4478
4577
|
// rather than printing `(null)`, which reads as a lookup that failed.
|
|
4479
4578
|
`spec: ${r.folder} (${r.specless ? 'no spec' : r.bucket})\n` +
|
|
4579
|
+
(RESOLVED_VIA[via] ? `via: ${RESOLVED_VIA[via]}\n` : '') +
|
|
4480
4580
|
`type/slug: ${r.type} / ${r.slug}\n` +
|
|
4481
4581
|
`branch: ${r.branch}\n` +
|
|
4482
4582
|
`worktree: ${r.projectPath}\n` +
|
|
@@ -4485,6 +4585,121 @@ function specEnvResolve(dir, config, specArg, flags = {}) {
|
|
|
4485
4585
|
)
|
|
4486
4586
|
}
|
|
4487
4587
|
|
|
4588
|
+
/**
|
|
4589
|
+
* `skitterspec spec-env resume <name|#N> [--json]` (feat-spec-resume)
|
|
4590
|
+
*
|
|
4591
|
+
* Which in-flight spec the argument means, what it is blocked on, and — where
|
|
4592
|
+
* this machine has no worktree for it — the commands that rebuild one from its
|
|
4593
|
+
* branch. Plans and prints; creates nothing, moves nothing, asks no tracker.
|
|
4594
|
+
* A refusal exits 1.
|
|
4595
|
+
*
|
|
4596
|
+
* Every copy of the spec this clone can see is read — the checkout it runs
|
|
4597
|
+
* from, each live worktree, and each spec branch (local, then remote-tracking,
|
|
4598
|
+
* never fetched) — because under `land.specDocs: "branch"` an in-flight spec
|
|
4599
|
+
* may exist nowhere else than its branch, and on the base branch its bucket
|
|
4600
|
+
* reads `backlog` whatever it really is. `env/resume.js` picks which copy
|
|
4601
|
+
* speaks.
|
|
4602
|
+
*/
|
|
4603
|
+
function specEnvResume(dir, config, arg, flags = {}) {
|
|
4604
|
+
const git = gitReader(dir)
|
|
4605
|
+
const prefix = prefixOf(config)
|
|
4606
|
+
const ownTree = (folder) => resolveSpecless(folder, dir, config, { spec: true }).worktreePath
|
|
4607
|
+
const copies = []
|
|
4608
|
+
const roots = [dir, ...[...liveWorktreePaths(git)].filter((p) => !sameDir(p, dir))]
|
|
4609
|
+
for (const root of roots) {
|
|
4610
|
+
const project = sameDir(root, dir) ? dir : projectIn(root, prefix)
|
|
4611
|
+
for (const bucket of BUCKETS) {
|
|
4612
|
+
let folders
|
|
4613
|
+
try {
|
|
4614
|
+
folders = fs.readdirSync(path.join(project, 'specs', bucket), { withFileTypes: true })
|
|
4615
|
+
} catch {
|
|
4616
|
+
continue
|
|
4617
|
+
}
|
|
4618
|
+
for (const entry of folders) {
|
|
4619
|
+
if (!entry.isDirectory()) continue
|
|
4620
|
+
const folder = entry.name
|
|
4621
|
+
// Another spec's worktree carries every base spec too; only a spec's
|
|
4622
|
+
// OWN tree speaks for it, and the checkout this ran from speaks last.
|
|
4623
|
+
const own = sameDir(ownTree(folder), root)
|
|
4624
|
+
if (!own && !sameDir(root, dir)) continue
|
|
4625
|
+
const copy = readSpecCopy(path.join(project, 'specs', bucket, folder))
|
|
4626
|
+
if (copy) copies.push({ folder, bucket, origin: own ? 'worktree' : 'here', ...copy })
|
|
4627
|
+
}
|
|
4628
|
+
}
|
|
4629
|
+
}
|
|
4630
|
+
let base = null
|
|
4631
|
+
try {
|
|
4632
|
+
base = resolveBaseBranch(config, git)
|
|
4633
|
+
} catch {
|
|
4634
|
+
// An unresolvable base hides branch-only specs; the disk copies still answer.
|
|
4635
|
+
}
|
|
4636
|
+
for (const b of specBranchDocs(git, config, base)) {
|
|
4637
|
+
copies.push({ folder: b.folder, bucket: b.bucket, origin: 'branch', local: b.local, ref: b.ref, overview: b.overview, phases: b.phases })
|
|
4638
|
+
}
|
|
4639
|
+
|
|
4640
|
+
// Bare means what every bare spec-env verb means: the worktree you are
|
|
4641
|
+
// standing in, else the sole provisioned spec. Neither answering leaves the
|
|
4642
|
+
// argument empty, and findTarget refuses that rather than guessing.
|
|
4643
|
+
if (!arg) {
|
|
4644
|
+
try {
|
|
4645
|
+
arg = resolveSpecWithWorktree(dir, config).folder
|
|
4646
|
+
} catch {
|
|
4647
|
+
arg = ''
|
|
4648
|
+
}
|
|
4649
|
+
}
|
|
4650
|
+
const identifierField = config.branch && config.branch.identifierField
|
|
4651
|
+
const found = findTarget(arg, copies, identifierField)
|
|
4652
|
+
if (found.refused) {
|
|
4653
|
+
process.exitCode = 1
|
|
4654
|
+
const r = { ok: false, refused: found.refused, refusedOnly: true }
|
|
4655
|
+
process.stdout.write(flags.json ? JSON.stringify({ ok: false, refused: found.refused }, null, 2) + '\n' : resumeLines(r).join('\n') + '\n')
|
|
4656
|
+
return
|
|
4657
|
+
}
|
|
4658
|
+
const target = found.target
|
|
4659
|
+
const remote = baseRemote(config)
|
|
4660
|
+
let branch
|
|
4661
|
+
if (target.origin === 'branch') {
|
|
4662
|
+
branch = target.ref.replace(/^refs\/heads\//, '').replace(new RegExp(`^refs/remotes/${remote}/`), '')
|
|
4663
|
+
} else {
|
|
4664
|
+
try {
|
|
4665
|
+
branch = resolveSpecWithWorktree(dir, config, target.folder).branch
|
|
4666
|
+
} catch {
|
|
4667
|
+
branch = resolveSpecless(target.folder, dir, config, { spec: true }).branch
|
|
4668
|
+
}
|
|
4669
|
+
}
|
|
4670
|
+
const worktreePath = ownTree(target.folder)
|
|
4671
|
+
const r = planResume(target, {
|
|
4672
|
+
branch,
|
|
4673
|
+
worktreePath,
|
|
4674
|
+
worktreeExists: fs.existsSync(worktreePath),
|
|
4675
|
+
localBranch: git(['show-ref', '--verify', '--quiet', `refs/heads/${branch}`]) !== null,
|
|
4676
|
+
remoteBranch: git(['show-ref', '--verify', '--quiet', `refs/remotes/${remote}/${branch}`]) !== null,
|
|
4677
|
+
remote,
|
|
4678
|
+
identifierField,
|
|
4679
|
+
})
|
|
4680
|
+
if (!r.ok) process.exitCode = 1
|
|
4681
|
+
process.stdout.write(flags.json ? JSON.stringify(r, null, 2) + '\n' : resumeLines(r).join('\n') + '\n')
|
|
4682
|
+
}
|
|
4683
|
+
|
|
4684
|
+
// A spec folder's overview and phase files, or null when it has no overview.
|
|
4685
|
+
function readSpecCopy(specDir) {
|
|
4686
|
+
let overview
|
|
4687
|
+
try {
|
|
4688
|
+
overview = fs.readFileSync(path.join(specDir, '00-overview.md'), 'utf8')
|
|
4689
|
+
} catch {
|
|
4690
|
+
return null
|
|
4691
|
+
}
|
|
4692
|
+
const phases = []
|
|
4693
|
+
for (const f of fs.readdirSync(specDir).filter((n) => /^(?!00-)\d{2}-.*\.md$/.test(n)).sort()) {
|
|
4694
|
+
try {
|
|
4695
|
+
phases.push({ n: Number(f.slice(0, 2)), text: fs.readFileSync(path.join(specDir, f), 'utf8') })
|
|
4696
|
+
} catch {
|
|
4697
|
+
// An unreadable phase file is left out, never counted as done or blocked.
|
|
4698
|
+
}
|
|
4699
|
+
}
|
|
4700
|
+
return { overview, phases }
|
|
4701
|
+
}
|
|
4702
|
+
|
|
4488
4703
|
/**
|
|
4489
4704
|
* `skitterspec spec-env base [--json] [--use-fallback | --unpin]`
|
|
4490
4705
|
*
|
|
@@ -4713,6 +4928,20 @@ function provisionedBranches(dir, config) {
|
|
|
4713
4928
|
* Re-anchoring would silently answer about the wrong checkout, so the tree read
|
|
4714
4929
|
* is printed rather than assumed.
|
|
4715
4930
|
*/
|
|
4931
|
+
// `spec-env checks [spec]` — run the project's `complete.checks` in the spec's
|
|
4932
|
+
// worktree, for `/spec-complete` to relay before it lands. Always exits 0: the
|
|
4933
|
+
// checks inform the completion and never stop it (`env/checks.js`).
|
|
4934
|
+
function specEnvChecks(dir, config, specArg, flags = {}) {
|
|
4935
|
+
const spec = resolveSpecWithWorktree(dir, config, specArg)
|
|
4936
|
+
const { runChecks, formatChecks } = require('./env/checks.js')
|
|
4937
|
+
const results = runChecks(config.complete.checks, { cwd: spec.projectPath || spec.worktreePath })
|
|
4938
|
+
if (flags.json) {
|
|
4939
|
+
process.stdout.write(JSON.stringify({ spec: spec.folder, checks: results }, null, 2) + '\n')
|
|
4940
|
+
return
|
|
4941
|
+
}
|
|
4942
|
+
process.stdout.write(formatChecks(spec.folder, results) + '\n')
|
|
4943
|
+
}
|
|
4944
|
+
|
|
4716
4945
|
function specEnvStage(dir, config, specArg, flags = {}, invokedFrom = dir) {
|
|
4717
4946
|
const spec = resolveSpecWithWorktree(dir, config, specArg)
|
|
4718
4947
|
|
|
@@ -4965,11 +5194,11 @@ function readRunningReviewServer(dir, config) {
|
|
|
4965
5194
|
* the same functions, with nothing rendered and nothing started.
|
|
4966
5195
|
*/
|
|
4967
5196
|
function reshowStack(dir, config, spec, out) {
|
|
4968
|
-
const cfg =
|
|
5197
|
+
const cfg = config
|
|
4969
5198
|
const up = readRunningReviewServer(dir, cfg)
|
|
4970
5199
|
const served = up ? reviewServedUrls(up, offerableLanAddresses(), spec.folder) : null
|
|
4971
5200
|
const reader = resolveReader(cfg, process.env, process.platform)
|
|
4972
|
-
const tiers = reviewTierStack({ served, fileUrl: reviewFileUrl(out),
|
|
5201
|
+
const tiers = reviewTierStack({ served, fileUrl: reviewFileUrl(out), config: cfg, reader })
|
|
4973
5202
|
let live = null
|
|
4974
5203
|
try {
|
|
4975
5204
|
const primaryState = assertPrimaryOnMain(cfg, gitReader(dir))
|
|
@@ -5288,101 +5517,74 @@ function specEnvReviewGate(dir, config, specArg, flags, invokedFrom = dir) {
|
|
|
5288
5517
|
}
|
|
5289
5518
|
|
|
5290
5519
|
/**
|
|
5291
|
-
* `review allow
|
|
5292
|
-
*
|
|
5293
|
-
*
|
|
5294
|
-
* TWO SCOPES, because the two tiers are different kinds of decision.
|
|
5520
|
+
* `review allow network [--off | --set <on|off|>]` — permit or withdraw the
|
|
5521
|
+
* served tiers beyond loopback.
|
|
5295
5522
|
*
|
|
5296
5523
|
* `network` is a BIND, and one server binds for every spec at once — so it is a
|
|
5297
|
-
* project setting and lives in the committed `env.config.json`.
|
|
5524
|
+
* project setting and lives in the committed `env.config.json`. `remote` is the
|
|
5525
|
+
* tailnet address of that same server, so this one switch covers it too.
|
|
5298
5526
|
*
|
|
5299
|
-
* `remote`
|
|
5300
|
-
*
|
|
5301
|
-
*
|
|
5302
|
-
*
|
|
5303
|
-
* PER SPEC — a sidecar in the gitignored review store, layered over the
|
|
5304
|
-
* committed key by `withSpecRemote`. `--project` keeps the committed write for
|
|
5305
|
-
* a team that wants it everywhere.
|
|
5527
|
+
* `allow remote` used to permit publishing the review as a claude.ai page,
|
|
5528
|
+
* per spec. That tier is retired (feat-tailnet-remote-tier), and the verb
|
|
5529
|
+
* refuses by name rather than quietly doing the network thing: a person who
|
|
5530
|
+
* typed it wanted something specific, and should hear where it went.
|
|
5306
5531
|
*
|
|
5307
|
-
* THE
|
|
5308
|
-
*
|
|
5309
|
-
*
|
|
5532
|
+
* THE WRITE IS NARROW: it reads, sets one key under `review`, and writes back
|
|
5533
|
+
* with two-space indent. It never reorders, never adds a key nobody asked for,
|
|
5534
|
+
* and never touches another section.
|
|
5310
5535
|
*
|
|
5311
5536
|
* WHAT WOULD FOOL THIS: a config indented with anything other than two spaces
|
|
5312
|
-
* IS reformatted by the
|
|
5313
|
-
*
|
|
5314
|
-
*
|
|
5537
|
+
* IS reformatted by the write — cosmetic, but worth knowing before it shows up
|
|
5538
|
+
* in someone's diff. A config with comments already fails to load, so there is
|
|
5539
|
+
* no comment-preserving case to protect.
|
|
5315
5540
|
*/
|
|
5316
|
-
function specEnvReviewAllow(dir, config, tier,
|
|
5317
|
-
const
|
|
5318
|
-
|
|
5319
|
-
|
|
5541
|
+
function specEnvReviewAllow(dir, config, tier, _specArg, flags) {
|
|
5542
|
+
const said = String(tier || '').trim()
|
|
5543
|
+
if (said === 'remote') {
|
|
5544
|
+
process.stdout.write(
|
|
5545
|
+
'spec-env review allow: remote is no longer a setting — publishing the review was retired.\n' +
|
|
5546
|
+
' `remote:` is now the tailnet address of the review server, on whenever network is.\n' +
|
|
5547
|
+
' Nothing changed.\n',
|
|
5548
|
+
)
|
|
5549
|
+
process.exitCode = 1
|
|
5550
|
+
return
|
|
5551
|
+
}
|
|
5552
|
+
if (said !== 'network') {
|
|
5320
5553
|
// Refused by name, never coerced to a default: silently permitting the
|
|
5321
5554
|
// wrong tier is the one outcome worth more than a round trip.
|
|
5322
5555
|
process.stdout.write(
|
|
5323
|
-
`spec-env review allow: ${JSON.stringify(tier || '')} is not a tier — ` +
|
|
5324
|
-
|
|
5556
|
+
`spec-env review allow: ${JSON.stringify(tier || '')} is not a tier — network is the one ` +
|
|
5557
|
+
'setting. Nothing changed.\n',
|
|
5325
5558
|
)
|
|
5326
5559
|
process.exitCode = 1
|
|
5327
5560
|
return
|
|
5328
5561
|
}
|
|
5562
|
+
const key = 'allowNetwork'
|
|
5329
5563
|
|
|
5330
|
-
// WHICH SPEC, for the per-spec scope — resolved before anything is read, so a
|
|
5331
|
-
// refusal changes nothing. An unknown name throws rather than falling back:
|
|
5332
|
-
// permitting the wrong spec to publish looks exactly like permitting the
|
|
5333
|
-
// right one.
|
|
5334
|
-
const perSpec = key === 'allowRemote' && !flags.project
|
|
5335
|
-
let spec = null
|
|
5336
|
-
let out = null
|
|
5337
|
-
if (perSpec) {
|
|
5338
|
-
try {
|
|
5339
|
-
spec = resolveSpecWithWorktree(dir, config, specArg)
|
|
5340
|
-
} catch (err) {
|
|
5341
|
-
process.stdout.write(
|
|
5342
|
-
`spec-env review allow: ${err.message}\n` +
|
|
5343
|
-
' remote is permitted per spec — name it, or run this from its worktree.\n' +
|
|
5344
|
-
' --project permits every spec instead (writes the committed env.config.json).\n' +
|
|
5345
|
-
' Nothing changed.\n',
|
|
5346
|
-
)
|
|
5347
|
-
process.exitCode = 1
|
|
5348
|
-
return
|
|
5349
|
-
}
|
|
5350
|
-
out = reviewOutPath(dir, spec.folder, null)
|
|
5351
|
-
}
|
|
5352
|
-
|
|
5353
|
-
// What the tier is now, through the same precedence the render uses — so a
|
|
5354
|
-
// toggle means "the other thing the render showed".
|
|
5355
5564
|
const file = path.resolve(dir, 'specs/.core/env.config.json')
|
|
5356
|
-
const
|
|
5565
|
+
const current = () => {
|
|
5357
5566
|
try {
|
|
5358
5567
|
const now = JSON.parse(fs.readFileSync(file, 'utf8'))
|
|
5359
|
-
return now.review && now.review[key] !== undefined ? now.review[key] : config.review[key]
|
|
5568
|
+
return Boolean(now.review && now.review[key] !== undefined ? now.review[key] : config.review[key])
|
|
5360
5569
|
} catch {
|
|
5361
|
-
return config.review[key]
|
|
5570
|
+
return Boolean(config.review[key])
|
|
5362
5571
|
}
|
|
5363
5572
|
}
|
|
5364
|
-
const current = () => {
|
|
5365
|
-
if (perSpec) {
|
|
5366
|
-
const own = readRemoteAllow(out)
|
|
5367
|
-
if (own !== null) return own
|
|
5368
|
-
}
|
|
5369
|
-
return Boolean(committed())
|
|
5370
|
-
}
|
|
5371
5573
|
|
|
5372
|
-
// THREE WAYS TO SAY WHAT THE TIER SHOULD BE. Bare `allow
|
|
5574
|
+
// THREE WAYS TO SAY WHAT THE TIER SHOULD BE. Bare `allow network` turns it ON
|
|
5373
5575
|
// and `--off` turns it off, exactly as they always have. `--set` exists
|
|
5374
5576
|
// because a SLASH COMMAND can only make one static substitution: the word the
|
|
5375
5577
|
// person typed reaches the engine as a word. An EMPTY value toggles.
|
|
5376
5578
|
let on = !flags.off
|
|
5377
5579
|
if (flags.set !== undefined) {
|
|
5378
|
-
const
|
|
5379
|
-
if (
|
|
5580
|
+
const state = String(flags.set).trim().toLowerCase()
|
|
5581
|
+
if (state === '') {
|
|
5380
5582
|
on = !current()
|
|
5381
|
-
} else if (
|
|
5382
|
-
on =
|
|
5583
|
+
} else if (state === 'on' || state === 'off') {
|
|
5584
|
+
on = state === 'on'
|
|
5383
5585
|
} else {
|
|
5384
5586
|
// Refused by name, like an unknown tier. The wrong default here opens a
|
|
5385
|
-
// port
|
|
5587
|
+
// port.
|
|
5386
5588
|
process.stdout.write(
|
|
5387
5589
|
`spec-env review allow: ${JSON.stringify(String(flags.set))} is not a state — ` +
|
|
5388
5590
|
'one of on, off, or nothing at all to toggle. Nothing changed.\n',
|
|
@@ -5393,76 +5595,35 @@ function specEnvReviewAllow(dir, config, tier, specArg, flags) {
|
|
|
5393
5595
|
}
|
|
5394
5596
|
|
|
5395
5597
|
const before = current()
|
|
5396
|
-
let
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
}
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
'nothing changed.\n',
|
|
5410
|
-
)
|
|
5411
|
-
process.exitCode = 1
|
|
5412
|
-
return
|
|
5413
|
-
}
|
|
5414
|
-
parsed.review = { ...(parsed.review || {}), [key]: on }
|
|
5415
|
-
fs.writeFileSync(file, JSON.stringify(parsed, null, 2) + '\n')
|
|
5416
|
-
wrote = file
|
|
5598
|
+
let parsed
|
|
5599
|
+
try {
|
|
5600
|
+
parsed = JSON.parse(fs.readFileSync(file, 'utf8'))
|
|
5601
|
+
} catch (err) {
|
|
5602
|
+
// Cannot tell what is in there, so write nothing. Reachable only if the
|
|
5603
|
+
// file changes between `loadEnvConfig` and here — that load already
|
|
5604
|
+
// refuses an unparseable config.
|
|
5605
|
+
process.stdout.write(
|
|
5606
|
+
`spec-env review allow: ${file} could not be read as JSON (${err.message}) — ` +
|
|
5607
|
+
'nothing changed.\n',
|
|
5608
|
+
)
|
|
5609
|
+
process.exitCode = 1
|
|
5610
|
+
return
|
|
5417
5611
|
}
|
|
5612
|
+
parsed.review = { ...(parsed.review || {}), [key]: on }
|
|
5613
|
+
fs.writeFileSync(file, JSON.stringify(parsed, null, 2) + '\n')
|
|
5418
5614
|
|
|
5419
5615
|
const lines = [
|
|
5420
|
-
`spec-env review allow:
|
|
5421
|
-
(before === on ? ' (unchanged)' : ''),
|
|
5616
|
+
`spec-env review allow: network reviews are now ${on ? 'ON' : 'OFF'}` + (before === on ? ' (unchanged)' : ''),
|
|
5422
5617
|
// THE ABSOLUTE PATH. `dir` is re-anchored to the primary checkout, so run
|
|
5423
5618
|
// from a worktree this writes in a different tree — and a relative path
|
|
5424
5619
|
// reads as the tree you are standing in.
|
|
5425
|
-
` wrote: ${
|
|
5620
|
+
` wrote: ${file}`,
|
|
5621
|
+
' that is the primary checkout, whichever tree you ran this from, and the file is',
|
|
5622
|
+
' COMMITTED — so it changes for everyone who pulls, and leaves that tree dirty.',
|
|
5623
|
+
on
|
|
5624
|
+
? ' the next render binds every interface, so the page opens on your phone and your tailnet.'
|
|
5625
|
+
: ' the next render binds 127.0.0.1 only, reachable from this machine.',
|
|
5426
5626
|
]
|
|
5427
|
-
if (perSpec) {
|
|
5428
|
-
lines.push(' this spec only, in the gitignored review store — the committed config is untouched.')
|
|
5429
|
-
} else {
|
|
5430
|
-
lines.push(
|
|
5431
|
-
' that is the primary checkout, whichever tree you ran this from, and the file is',
|
|
5432
|
-
' COMMITTED — so it changes for everyone who pulls, and leaves that tree dirty.',
|
|
5433
|
-
)
|
|
5434
|
-
}
|
|
5435
|
-
if (key === 'allowNetwork') {
|
|
5436
|
-
lines.push(
|
|
5437
|
-
on
|
|
5438
|
-
? ' the next render binds every interface, so the page opens on your phone.'
|
|
5439
|
-
: ' the next render binds 127.0.0.1 only, reachable from this machine.',
|
|
5440
|
-
)
|
|
5441
|
-
} else if (!on) {
|
|
5442
|
-
lines.push(
|
|
5443
|
-
' publishing is no longer permitted; any page already published stays up.\n' +
|
|
5444
|
-
' turn it back on with: /spec-remote-review',
|
|
5445
|
-
)
|
|
5446
|
-
} else {
|
|
5447
|
-
lines.push(
|
|
5448
|
-
' a published page cannot be deleted by skitterspec,\n' +
|
|
5449
|
-
' and a verdict there needs /spec-reviewed.\n' +
|
|
5450
|
-
' turn it back off with: /spec-remote-review',
|
|
5451
|
-
)
|
|
5452
|
-
// THE REVIEW IT WAS TYPED FOR. The banner names this command beside a page
|
|
5453
|
-
// the reader cannot reach, so turning remote on is the ask to publish THAT
|
|
5454
|
-
// page — and saying nothing about it left the reader with no link at all.
|
|
5455
|
-
// A page on disk is the positive signal; with none there is nothing to
|
|
5456
|
-
// publish, and nothing is named.
|
|
5457
|
-
if (spec && fs.existsSync(out)) {
|
|
5458
|
-
lines.push(
|
|
5459
|
-
` review: ${spec.folder} has a page — publish it and re-show the stack`,
|
|
5460
|
-
` publish: skitterspec spec-env review ${spec.folder} --publish-copy`,
|
|
5461
|
-
)
|
|
5462
|
-
} else {
|
|
5463
|
-
lines.push(' this PERMITS publishing; it publishes nothing.')
|
|
5464
|
-
}
|
|
5465
|
-
}
|
|
5466
5627
|
process.stdout.write(lines.join('\n') + '\n')
|
|
5467
5628
|
}
|
|
5468
5629
|
|
|
@@ -5574,9 +5735,6 @@ async function specEnvReview(dir, config, specArg, flags, invokedFrom = dir) {
|
|
|
5574
5735
|
// CHECKOUT, keyed by the spec's folder name; not one byte of it comes from
|
|
5575
5736
|
// the worktree. `--out` moves the page and its sidecars together.
|
|
5576
5737
|
const out = reviewOutPath(dir, spec.folder, flags.out)
|
|
5577
|
-
// This spec's own remote permission over the project default — a
|
|
5578
|
-
// per-worktree decision, never the committed config (bug-remote-review-toggle).
|
|
5579
|
-
config = withSpecRemote(config, out)
|
|
5580
5738
|
|
|
5581
5739
|
// The other half of a confirmation: a pass the operator says is not theirs.
|
|
5582
5740
|
// Left in the store it is reported on every render until they stop reading the
|
|
@@ -6295,21 +6453,6 @@ async function specEnvReview(dir, config, specArg, flags, invokedFrom = dir) {
|
|
|
6295
6453
|
/* the page is the artefact; this is a note for the daemon */
|
|
6296
6454
|
}
|
|
6297
6455
|
|
|
6298
|
-
// The publish-ready copy, ONLY when asked. An ordinary render must not pay for
|
|
6299
|
-
// a second copy of the whole diff on disk for a path most renders never take.
|
|
6300
|
-
let publishCopy = null
|
|
6301
|
-
if (flags.publishCopy) {
|
|
6302
|
-
publishCopy = reviewPublishPath(out)
|
|
6303
|
-
writeReviewPage(
|
|
6304
|
-
publishCopy,
|
|
6305
|
-
renderReviewFragment(data, { reviewHtml: renderReviewBlock(data.review) }),
|
|
6306
|
-
)
|
|
6307
|
-
}
|
|
6308
|
-
|
|
6309
|
-
// Read, never written, and never interpreted: the engine cannot publish, and
|
|
6310
|
-
// names this file only so the skill that can never has to build a path.
|
|
6311
|
-
const urlFile = reviewUrlPath(out)
|
|
6312
|
-
const url = readReviewUrl(out)
|
|
6313
6456
|
|
|
6314
6457
|
// Resolved before the --json early return, so both outputs agree.
|
|
6315
6458
|
const reader = resolveReader(config, process.env, process.platform)
|
|
@@ -6381,7 +6524,7 @@ async function specEnvReview(dir, config, specArg, flags, invokedFrom = dir) {
|
|
|
6381
6524
|
|
|
6382
6525
|
// ONE STACK for both outputs, so `--json` and the text cannot disagree about
|
|
6383
6526
|
// which tiers exist — or which one is hidden.
|
|
6384
|
-
const stackTiers = reviewTierStack({ served, fileUrl: reviewFileUrl(out),
|
|
6527
|
+
const stackTiers = reviewTierStack({ served, fileUrl: reviewFileUrl(out), config, reader })
|
|
6385
6528
|
|
|
6386
6529
|
if (flags.json) {
|
|
6387
6530
|
process.stdout.write(
|
|
@@ -6403,7 +6546,6 @@ async function specEnvReview(dir, config, specArg, flags, invokedFrom = dir) {
|
|
|
6403
6546
|
// project folder.
|
|
6404
6547
|
...(docs ? { docs: { paths: docs.owned.map((p) => projectRelative(p, prefixOf(config))) } } : {}),
|
|
6405
6548
|
out,
|
|
6406
|
-
publishCopy,
|
|
6407
6549
|
reader: reader.reader,
|
|
6408
6550
|
readerWhy: reader.why,
|
|
6409
6551
|
served,
|
|
@@ -6424,8 +6566,6 @@ async function specEnvReview(dir, config, specArg, flags, invokedFrom = dir) {
|
|
|
6424
6566
|
...(served ? {} : noServeBecause ? { notServed: noServeBecause } : {}),
|
|
6425
6567
|
...(serverSaid ? { server: serverSaid } : {}),
|
|
6426
6568
|
fileUrl: reviewFileUrl(out),
|
|
6427
|
-
urlFile,
|
|
6428
|
-
url,
|
|
6429
6569
|
notesFile: reviewNotesPath(out),
|
|
6430
6570
|
// Absent stays absent, exactly as it is in the page payload: the
|
|
6431
6571
|
// committing set is what a caller that did not ask always got, so
|
|
@@ -6532,16 +6672,15 @@ async function specEnvReview(dir, config, specArg, flags, invokedFrom = dir) {
|
|
|
6532
6672
|
// use, and the engine cannot know — that guess failed three separate ways
|
|
6533
6673
|
// in one day. Now every tier is listed, labelled, and either a URL or the
|
|
6534
6674
|
// one command that turns it on.
|
|
6535
|
-
//
|
|
6536
|
-
// rendering — `reviewTierLine` carries them
|
|
6537
|
-
// under `network:` rather than dangling after the stack (they used to
|
|
6538
|
-
// print below `remote:`, against the comment that placed them).
|
|
6675
|
+
// Any runners-up print as `also:` lines inside their tier's own
|
|
6676
|
+
// rendering — `reviewTierLine` carries them.
|
|
6539
6677
|
reviewStackText(stackTiers) +
|
|
6540
|
-
// WHICH TIERS THE WAIT COVERS, once, next to the stack.
|
|
6541
|
-
//
|
|
6542
|
-
//
|
|
6543
|
-
//
|
|
6544
|
-
|
|
6678
|
+
// WHICH TIERS THE WAIT COVERS, once, next to the stack. Every served door
|
|
6679
|
+
// is one room — the page POSTs to `location.pathname`, so each reaches
|
|
6680
|
+
// this server and this pending store.
|
|
6681
|
+
// Nothing at all for a `file://` page: there is no door to watch, and
|
|
6682
|
+
// the `not served:` line below says why.
|
|
6683
|
+
(waitCovers(stackTiers).length ? ` the wait covers ${waitCovers(stackTiers).join(' + ')}.\n` : '') +
|
|
6545
6684
|
// WHETHER IT IS ALSO RUNNING SOMEWHERE, which is the other way to judge a
|
|
6546
6685
|
// change. `unavailable` prints nothing — see `liveStateLine`.
|
|
6547
6686
|
(liveStateLine(live) ? `${liveStateLine(live)}\n` : '') +
|
|
@@ -6555,9 +6694,6 @@ async function specEnvReview(dir, config, specArg, flags, invokedFrom = dir) {
|
|
|
6555
6694
|
// One line, and only when something was actually done on the reader's
|
|
6556
6695
|
// behalf. An action nobody asked for is reported, not hidden.
|
|
6557
6696
|
(serverSaid ? ` ${serverSaid}\n` : '') +
|
|
6558
|
-
// Named on its own line so the skill never has to build the path itself.
|
|
6559
|
-
(publishCopy ? ` publish: ${publishCopy}\n` : '') +
|
|
6560
|
-
(url ? ` published: ${url}\n` : '') +
|
|
6561
6697
|
(t.files === 0 ? ' nothing to review — no changes found.\n' : ''),
|
|
6562
6698
|
)
|
|
6563
6699
|
}
|
|
@@ -7507,7 +7643,9 @@ function bareLive(dir, config) {
|
|
|
7507
7643
|
return { action: 'status', specArg: undefined }
|
|
7508
7644
|
}
|
|
7509
7645
|
|
|
7510
|
-
|
|
7646
|
+
// The last-live record is a hint for READING which spec you mean, never for a
|
|
7647
|
+
// bare command that switches a branch on it — that stays one possible meaning.
|
|
7648
|
+
const choice = provisionedSpecChoice(dir, config, process.cwd(), { lastLive: false })
|
|
7511
7649
|
if (!choice.folder) {
|
|
7512
7650
|
// Several worktrees is the only cannot-tell the status report does not
|
|
7513
7651
|
// explain — it reports on the repo, not on what you might have meant. With
|
|
@@ -7679,6 +7817,9 @@ async function specEnvLiveTake(dir, config, specArg, flags = {}) {
|
|
|
7679
7817
|
return
|
|
7680
7818
|
}
|
|
7681
7819
|
const receipt = writeReceipt(dir, config, plan.receipt)
|
|
7820
|
+
// Another spec is now the one on this checkout; the last release no longer is.
|
|
7821
|
+
const last = readLastLive(dir, config)
|
|
7822
|
+
if (last && last.spec !== spec.folder) clearLastLive(dir, config)
|
|
7682
7823
|
|
|
7683
7824
|
const out = [`spec-env live take: ${spec.folder} is live on the primary checkout`]
|
|
7684
7825
|
out.push('')
|
|
@@ -7750,10 +7891,17 @@ async function specEnvLiveRelease(dir, config, specArg) {
|
|
|
7750
7891
|
}
|
|
7751
7892
|
if (worktreeExists) runGit(spec.worktreePath, ['switch', spec.branch])
|
|
7752
7893
|
clearReceipt(dir, config)
|
|
7894
|
+
// Remembered so a bare resolve from here still names this spec — the session
|
|
7895
|
+
// is now standing in the primary checkout, which says nothing on its own.
|
|
7896
|
+
writeLastLive(dir, config, { spec: spec.folder, worktree: spec.projectPath })
|
|
7753
7897
|
|
|
7754
7898
|
process.stdout.write(
|
|
7755
7899
|
`spec-env live release: ${spec.folder} released — primary back on ${base}, ` +
|
|
7756
7900
|
`${spec.branch} re-isolated to its worktree.\n` +
|
|
7901
|
+
// The project folder, not the worktree root: it is what `/spec-next
|
|
7902
|
+
// --worktree` checks against `resolve`'s own `worktree:` line.
|
|
7903
|
+
` worktree: ${spec.projectPath}\n` +
|
|
7904
|
+
` next: /spec-next --worktree ${shellPath(spec.projectPath)}\n` +
|
|
7757
7905
|
runAfterSwitch(plan.afterSwitch).lines.map((l) => `${l}\n`).join('') +
|
|
7758
7906
|
plan.warnings.map((w) => ` ! ${w}\n`).join(''),
|
|
7759
7907
|
)
|
|
@@ -7971,19 +8119,17 @@ async function specEnv(rest) {
|
|
|
7971
8119
|
else if (args[i] === '--stop') flags.stop = true
|
|
7972
8120
|
else if (args[i] === '--rotate-token') flags.rotateToken = true
|
|
7973
8121
|
else if (args[i] === '--off') flags.off = true
|
|
7974
|
-
else if (args[i] === '--project') flags.project = true
|
|
7975
8122
|
else if (args[i] === '--status') flags.status = true
|
|
7976
8123
|
else if (args[i] === '--port') flags.port = args[++i]
|
|
7977
8124
|
else if (args[i] === '--host') flags.host = args[++i]
|
|
7978
|
-
else if (args[i] === '--publish-copy') flags.publishCopy = true
|
|
7979
8125
|
else if (args[i] === '--buttons') flags.buttons = args[++i]
|
|
7980
8126
|
else if (args[i] === '--out') flags.out = args[++i]
|
|
7981
8127
|
else if (args[i] === '--review') flags.review = args[++i]
|
|
7982
8128
|
else if (args[i] === '--run-reviewers') flags.runReviewers = true
|
|
7983
8129
|
else if (args[i] === '--notes') flags.notes = args[++i]
|
|
7984
8130
|
else if (args[i] === '--verdict') flags.verdict = args[++i]
|
|
7985
|
-
// `--set` keeps an EMPTY STRING rather than coercing it away: empty
|
|
7986
|
-
//
|
|
8131
|
+
// `--set` keeps an EMPTY STRING rather than coercing it away: empty means
|
|
8132
|
+
// toggle. `??` so a missing value
|
|
7987
8133
|
// at the end of argv is still the empty form rather than `undefined`, which
|
|
7988
8134
|
// would read as the flag never having been passed.
|
|
7989
8135
|
else if (args[i] === '--set') flags.set = args[++i] ?? ''
|
|
@@ -8166,12 +8312,18 @@ async function specEnvDispatch(sub, dir, config, positional, flags, present, inv
|
|
|
8166
8312
|
case 'resolve':
|
|
8167
8313
|
specEnvResolve(dir, config, positional[0], flags)
|
|
8168
8314
|
break
|
|
8315
|
+
case 'resume':
|
|
8316
|
+
specEnvResume(dir, config, positional[0], flags)
|
|
8317
|
+
break
|
|
8169
8318
|
case 'base':
|
|
8170
8319
|
specEnvBase(dir, config, flags)
|
|
8171
8320
|
break
|
|
8172
8321
|
case 'stage':
|
|
8173
8322
|
specEnvStage(dir, config, positional[0], flags, invokedFrom)
|
|
8174
8323
|
break
|
|
8324
|
+
case 'checks':
|
|
8325
|
+
specEnvChecks(dir, config, positional[0], flags)
|
|
8326
|
+
break
|
|
8175
8327
|
case 'review':
|
|
8176
8328
|
// `serve` is the one review sub-action rather than a verb of its own: it
|
|
8177
8329
|
// answers the same question ("show me this diff") from the same engine,
|
|
@@ -8220,7 +8372,7 @@ async function specEnvDispatch(sub, dir, config, positional, flags, present, inv
|
|
|
8220
8372
|
`Usage: skitterspec spec-env <${SPEC_ENV_VERBS.join('|')}> [spec] [--keep-volumes] [--force] [--also <tag>] [--older-than <days>] [--branch] [--out <file>] [--review <json>] [--run-reviewers] [--notes <json>] [--verdict <word>] [--resolve <json>] [--outcome <text>] [--claim <code>] [--drop <code>] [--buttons <set>] [--json] [--record-primary] [--assert-primary-clean]\n` +
|
|
8221
8373
|
' review serve [--port <n>] [--host <addr>] [--stop] [--status] serve every diff locally\n' +
|
|
8222
8374
|
' review serve --rotate-token mint a new URL token; every handed-out link dies\n' +
|
|
8223
|
-
' review allow
|
|
8375
|
+
' review allow network [--off] permit the network and tailnet tiers\n' +
|
|
8224
8376
|
' (network: env.config.json; remote: this spec only)\n' +
|
|
8225
8377
|
' review arm [spec] [--phase <n>] a phase ended — its diff now owes a verdict\n' +
|
|
8226
8378
|
' review gate [spec] [--check] [--json] is one owed? --check exits non-zero if so\n' +
|
|
@@ -8336,7 +8488,7 @@ async function run(argv) {
|
|
|
8336
8488
|
break
|
|
8337
8489
|
}
|
|
8338
8490
|
if (action === 'resync') {
|
|
8339
|
-
resync(dir, { claudeMd: opts.claudeMd, force: opts.force, diff: opts.diff })
|
|
8491
|
+
resync(dir, { claudeMd: opts.claudeMd, force: opts.force, diff: opts.diff, local: opts.local })
|
|
8340
8492
|
break
|
|
8341
8493
|
}
|
|
8342
8494
|
// action === 'create-missing' → fall through to a normal (skip-existing) init.
|
|
@@ -8363,6 +8515,7 @@ async function run(argv) {
|
|
|
8363
8515
|
workspaceMode,
|
|
8364
8516
|
gating,
|
|
8365
8517
|
project: opts.project,
|
|
8518
|
+
local: opts.local,
|
|
8366
8519
|
})
|
|
8367
8520
|
break
|
|
8368
8521
|
}
|
|
@@ -8374,7 +8527,7 @@ async function run(argv) {
|
|
|
8374
8527
|
checkSync(dir, { claudeMd: opts.claudeMd })
|
|
8375
8528
|
break
|
|
8376
8529
|
}
|
|
8377
|
-
resync(dir, { claudeMd: opts.claudeMd, force: opts.force, diff: opts.diff })
|
|
8530
|
+
resync(dir, { claudeMd: opts.claudeMd, force: opts.force, diff: opts.diff, local: opts.local })
|
|
8378
8531
|
await cleanupReleaseTooling(dir, opts)
|
|
8379
8532
|
break
|
|
8380
8533
|
default:
|