@skitterbyte/skitterspec-linear 18.0.0 → 18.1.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.
Files changed (51) hide show
  1. package/MIGRATION.md +81 -0
  2. package/assets/core/env.config.md +33 -9
  3. package/assets/hooks/main-guard.cjs +1 -1
  4. package/assets/hooks/review-gate.cjs +1 -1
  5. package/assets/rules/spec-planning.md +4 -2
  6. package/assets/skills/no-spec/SKILL.md +3 -2
  7. package/assets/skills/spec-complete/SKILL.md +67 -25
  8. package/assets/skills/spec-hotfix/SKILL.md +21 -11
  9. package/assets/skills/spec-sync/SKILL.md +10 -1
  10. package/package.json +1 -1
  11. package/src/cli.js +295 -37
  12. package/src/env/config.js +14 -2
  13. package/src/env/hotfix.js +261 -15
  14. package/src/env/hotfixland.js +302 -0
  15. package/src/env/resolve.js +22 -8
  16. package/src/init.js +36 -4
  17. package/src/vendor/linear/api.js +43 -56
  18. package/src/vendor/linear/cli-sanitise.js +2 -2
  19. package/src/vendor/linear/cli-sync.js +87 -390
  20. package/src/vendor/linear/config.js +46 -171
  21. package/src/vendor/linear/credentials.js +40 -370
  22. package/src/vendor/linear/dialect.js +177 -0
  23. package/src/vendor/linear/doctor.js +7 -15
  24. package/src/vendor/linear/identity.js +20 -70
  25. package/src/vendor/linear/released.js +4 -222
  26. package/src/vendor/{sync-core/src → linear}/sanitise.js +4 -3
  27. package/src/vendor/provider-kit/index.js +41 -0
  28. package/src/vendor/provider-kit/src/adapter.js +23 -0
  29. package/src/vendor/provider-kit/src/apply.js +197 -0
  30. package/src/vendor/provider-kit/src/args.js +68 -0
  31. package/src/vendor/provider-kit/src/config.js +198 -0
  32. package/src/vendor/provider-kit/src/credentials.js +404 -0
  33. package/src/vendor/provider-kit/src/doctor.js +35 -0
  34. package/src/vendor/provider-kit/src/http.js +44 -0
  35. package/src/vendor/provider-kit/src/identity.js +93 -0
  36. package/src/vendor/provider-kit/src/md-compare.js +39 -0
  37. package/src/vendor/{sync-core/src/tables.js → provider-kit/src/md-tables.js} +10 -18
  38. package/src/vendor/provider-kit/src/prompt.js +50 -0
  39. package/src/vendor/provider-kit/src/released.js +226 -0
  40. package/src/vendor/provider-kit/src/specs.js +166 -0
  41. package/src/vendor/provider-kit/src/transport.js +22 -0
  42. package/src/vendor/sync-core/index.js +22 -5
  43. package/src/vendor/sync-core/src/compare.js +14 -12
  44. package/src/vendor/sync-core/src/dialect.js +51 -0
  45. package/src/vendor/sync-core/src/fields.js +36 -0
  46. package/src/vendor/sync-core/src/legacy.js +19 -9
  47. package/src/vendor/sync-core/src/normalize.js +30 -158
  48. package/src/vendor/sync-core/src/push.js +1 -1
  49. package/src/vendor/sync-core/src/retarget.js +21 -17
  50. package/src/vendor/sync-core/src/verify.js +24 -45
  51. package/src/vendor/sync-core/src/write.js +7 -5
package/src/cli.js CHANGED
@@ -161,7 +161,8 @@ const {
161
161
  } = require('./env/mainguard.js')
162
162
  const { planPrune, liveSlugsForSpecs, reconcileRegistry } = require('./env/prune.js')
163
163
  const { planIntegrate, planIntegrateCheckout } = require('./env/integrate.js')
164
- const { planHotfixLand } = require('./env/hotfix.js')
164
+ const { planHotfixLand, planHotfixFinish } = require('./env/hotfix.js')
165
+ const { runHotfixLand, describeStep: describeHotfixStep } = require('./env/hotfixland.js')
165
166
  const { planDev } = require('./env/dev.js')
166
167
  const { startProcess, stopProcess, waitHealthy, readPid, isAlive } = require('./env/supervise.js')
167
168
  const { renderRoutes, portsInUse, portsInUseOn, waitListening } = require('./env/proxy.js')
@@ -178,11 +179,13 @@ const pkg = require('../package.json')
178
179
  // Commands this (tracker-free) base does NOT ship, and the distribution that
179
180
  // does. Without this the base says only "unknown command: spec-sync", which a
180
181
  // user correctly reads as "no such feature" — nothing anywhere named the
181
- // distribution that has it, so they were stranded. Naming Linear here is a
182
- // diagnostic string, not provider machinery: `init.js` already knows
183
- // `linear.config.json` and `linear-base/` by name in order to protect them.
182
+ // distribution that has it, so they were stranded. Naming distributions here
183
+ // is a diagnostic string, not provider machinery: `init.js` already knows the
184
+ // provider config files by name in order to protect them. With two provider
185
+ // supersets the hand-off names both where both ship the command, and the one
186
+ // that does where only one does.
184
187
  const PROVIDER_COMMANDS = {
185
- 'spec-sync': '@skitterbyte/skitterspec-linear',
188
+ 'spec-sync': '@skitterbyte/skitterspec-linear or @skitterbyte/skitterspec-jira',
186
189
  'spec-sanitise': '@skitterbyte/skitterspec-linear',
187
190
  }
188
191
 
@@ -230,7 +233,11 @@ Usage:
230
233
  dev down <spec> stop the spec's host dev servers
231
234
  connect <spec> expose a spec on the canonical ports (main = off)
232
235
  integrate <spec> plan rebase + fast-forward onto the base branch
233
- hotfix land <spec> tag + cherry-pick a hotfix (--also <tag>)
236
+ hotfix land <spec>
237
+ release, push (--push), carry a hotfix to
238
+ the base branch (--plan, --also <tag>)
239
+ hotfix finish <spec>
240
+ tear a landed hotfix down once it deployed
234
241
  live <spec> check a spec out in the primary checkout so
235
242
  the running dev server serves it (take |
236
243
  release | abort | status; main hands it back)
@@ -847,7 +854,8 @@ function specEnvNospec(dir, config, name, flags = {}) {
847
854
  ? ` git worktree add ${spec.worktreePath} ${spec.branch}`
848
855
  : ` git worktree add ${spec.worktreePath} -b ${spec.branch}`,
849
856
  )
850
- if ((config.setup || []).length) out.push(...bootstrapLines(name))
857
+ const seeds = (config.seedFiles && config.seedFiles.files) || []
858
+ if (seeds.length || (config.setup || []).length) out.push(...bootstrapLines(name))
851
859
  if (flags.json) {
852
860
  process.stdout.write(
853
861
  JSON.stringify(
@@ -1173,9 +1181,11 @@ function specEnvBootstrap(dir, config, specArg, flags = {}) {
1173
1181
 
1174
1182
  let steps
1175
1183
  // A `/no-spec` record — not the authoring record `up --docs` writes for a
1176
- // spec not yet on disk, which is a spec and plans like one.
1184
+ // spec not yet on disk, which is a spec and plans like one. It seeds and runs
1185
+ // `setup` exactly as a spec does, since a `setup` that reads a seeded `.env`
1186
+ // fails without it; what it never has is a stack, so no slot is consulted.
1177
1187
  if (spec.specless && !spec.unwritten) {
1178
- steps = docs ? [] : (config.setup || []).map((command) => ({ kind: 'setup', command }))
1188
+ steps = worktreeSteps(spec, null, config, { docs, wantsDocker: false })
1179
1189
  } else {
1180
1190
  const compose = composeFilePresent(dir, config)
1181
1191
  const { wantsDocker } = resolveStack(spec, config, { docs, composeFilePresent: compose })
@@ -2037,30 +2047,196 @@ function afterLandSection(afterLand) {
2037
2047
  return out.join('\n') + '\n'
2038
2048
  }
2039
2049
 
2040
- // Land a hotfix: tag the branch with the patch-bumped base tag (the prod deploy
2041
- // tag), cherry-pick the fix onto any extra base tags (test/demo lines) and onto
2042
- // the base branch for the next release. Queries git for the facts, prints the plan
2043
- // / block / no-op. The /spec-complete skill runs the printed commands (aborting a
2044
- // cherry-pick on conflict). NEVER pushes — pushing the deploy tag is the operator's.
2050
+ // Land a hotfix: release the branch (the project's `hotfix.releaseWith`, else
2051
+ // the built-in tagger), cherry-pick the fix onto any extra base tags (test/demo
2052
+ // lines) and onto the base branch for the next release.
2053
+ //
2054
+ // THE ENGINE RUNS IT, the way `bootstrap` runs a worktree's steps. It used to
2055
+ // print a plan for the skill to run, and a project's own release command broke
2056
+ // that: the prod tag is only known once the command has said what it cut. So
2057
+ // this probes git, plans (hotfix.js), runs (hotfixland.js), and records the
2058
+ // release beside the review store the moment it is cut, so a land that stops
2059
+ // later resumes without cutting a second one. `--plan` describes it and runs
2060
+ // nothing. NEVER pushes — pushing the deploy tag is the operator's.
2061
+ function hotfixRecordPath(dir, config, name) {
2062
+ return path.join(path.dirname(path.resolve(dir, config.registry)), 'hotfix', `${name}.json`)
2063
+ }
2064
+
2065
+ function readHotfixRecord(dir, config, name) {
2066
+ try {
2067
+ return JSON.parse(fs.readFileSync(hotfixRecordPath(dir, config, name), 'utf8'))
2068
+ } catch {
2069
+ return null
2070
+ }
2071
+ }
2072
+
2073
+ function writeHotfixRecord(dir, config, name, record) {
2074
+ const file = hotfixRecordPath(dir, config, name)
2075
+ fs.mkdirSync(path.dirname(file), { recursive: true })
2076
+ fs.writeFileSync(file, JSON.stringify(record, null, 2) + '\n')
2077
+ }
2078
+
2079
+ /**
2080
+ * What `hotfix land` carries to the base branch, and how.
2081
+ *
2082
+ * The fix commits are `baseRef..branch` in order, minus the version commit a
2083
+ * recorded release left on the branch — it holds package.json, CHANGELOG and
2084
+ * RELEASES, and main's version line never moves on a hotfix. The carry is that
2085
+ * list minus whatever `git cherry` says the base branch already has, so a
2086
+ * re-run after a partial carry picks up where it stopped. A `git cherry` that
2087
+ * cannot answer excludes nothing: a duplicate then fails as an empty
2088
+ * cherry-pick, loudly, which is the safe direction to be wrong in.
2089
+ *
2090
+ * Where the base branch is decides the strategy: checked out and clean → in
2091
+ * place; checked out and dirty → refuse; not checked out → a throwaway worktree.
2092
+ */
2093
+ function hotfixCarry(dir, spec, base, wtGit, released) {
2094
+ const version = released && released.versionCommit
2095
+ const listed = wtGit(['rev-list', '--reverse', `${spec.baseRef}..${spec.branch}`])
2096
+ const fixCommits = (listed ? listed.split('\n') : [])
2097
+ .map((x) => x.trim())
2098
+ .filter((sha) => sha && sha !== version)
2099
+ const git = gitReader(dir)
2100
+ const cherry = git(['cherry', base, spec.branch])
2101
+ const already = new Set(
2102
+ (cherry ? cherry.split('\n') : [])
2103
+ .map((l) => l.trim())
2104
+ .filter((l) => l.startsWith('- '))
2105
+ .map((l) => l.slice(2).trim()),
2106
+ )
2107
+ const commits = fixCommits.filter((sha) => !already.has(sha))
2108
+
2109
+ // Which checkout, if any, has the base branch checked out.
2110
+ const list = git(['worktree', 'list', '--porcelain']) || ''
2111
+ let where = null
2112
+ let current = null
2113
+ for (const line of list.split('\n')) {
2114
+ if (line.startsWith('worktree ')) current = line.slice('worktree '.length)
2115
+ else if (line === `branch refs/heads/${base}`) where = current
2116
+ }
2117
+ let carry
2118
+ if (where) {
2119
+ const st = gitReader(where)(['status', '--porcelain'])
2120
+ carry = { strategy: st ? 'dirty' : 'inplace', path: where, commits }
2121
+ } else {
2122
+ const tmpPath = path.join(path.dirname(spec.worktreePath), `${spec.slug}-carry-${base}`)
2123
+ carry = { strategy: 'worktree', path: dir, tmpPath, commits }
2124
+ }
2125
+ return { fixCommits, carry }
2126
+ }
2127
+
2128
+ // `hotfix finish`: tear a landed hotfix down once its deploy is out. The guards
2129
+ // live in `planHotfixFinish`; this gathers the facts, refuses from inside the
2130
+ // worktree it is about to remove, and runs the two git commands itself.
2131
+ function hotfixFinish(dir, config, specArg, flags) {
2132
+ const json = flags.json === true
2133
+ const say = (line) => process.stdout.write(line + '\n')
2134
+ const spec = resolveSpecWithWorktree(dir, config, specArg)
2135
+ const refuse = (reasons) => {
2136
+ if (json) say(JSON.stringify({ ok: false, spec: spec.folder, refused: reasons }, null, 2))
2137
+ else {
2138
+ say(`spec-env hotfix finish: ${spec.folder} — refused, nothing removed:`)
2139
+ for (const r of reasons) say(` - ${r}`)
2140
+ }
2141
+ process.exitCode = 1
2142
+ }
2143
+ if (spec.type !== 'hotfix') {
2144
+ refuse([`${spec.folder} is not a hotfix — \`spec-env down\` tears it down`])
2145
+ return
2146
+ }
2147
+ if (!fs.existsSync(spec.worktreePath)) {
2148
+ if (json) say(JSON.stringify({ ok: true, spec: spec.folder, noop: true }, null, 2))
2149
+ else say(`spec-env hotfix finish: ${spec.folder} has no worktree — nothing to do.`)
2150
+ return
2151
+ }
2152
+ // Removing the tree a shell is standing in succeeds, and then every command
2153
+ // after it fails with "Unable to read current working directory".
2154
+ const cwd = process.cwd()
2155
+ const inside = (() => {
2156
+ try {
2157
+ const rel = path.relative(fs.realpathSync(spec.worktreePath), fs.realpathSync(cwd))
2158
+ return rel === '' || (!rel.startsWith('..') && !path.isAbsolute(rel))
2159
+ } catch {
2160
+ return false
2161
+ }
2162
+ })()
2163
+ if (inside) {
2164
+ refuse([`this shell is inside the worktree — \`cd ${dir}\` first, then re-run`])
2165
+ return
2166
+ }
2167
+
2168
+ const wtGit = gitReader(spec.worktreePath)
2169
+ const status = wtGit(['status', '--porcelain'])
2170
+ const head = wtGit(['rev-parse', 'HEAD'])
2171
+ const remote = 'origin'
2172
+ // `ls-remote` exits 0 with nothing on stdout when the branch is absent, and
2173
+ // non-zero when the remote cannot be asked — two different answers.
2174
+ const lsRemote = wtGit(['ls-remote', '--heads', remote, `refs/heads/${spec.branch}`])
2175
+ const remoteHead = lsRemote === null ? undefined : lsRemote ? lsRemote.split(/\s+/)[0] : null
2176
+ const registry = readRegistry(dir, config)
2177
+ const plan = planHotfixFinish(spec, {
2178
+ dirty: status === null || status.length > 0,
2179
+ tagsAtHead: (wtGit(['tag', '--points-at', 'HEAD']) || '').split('\n').filter(Boolean),
2180
+ head,
2181
+ remoteHead,
2182
+ remote,
2183
+ mainRepoPath: dir,
2184
+ hasSlot: Object.prototype.hasOwnProperty.call(registry.slots, spec.folder),
2185
+ })
2186
+ if (plan.blocked) {
2187
+ refuse(plan.reasons)
2188
+ return
2189
+ }
2190
+ const git = gitReader(dir)
2191
+ for (const argv of plan.argvs) {
2192
+ if (git(argv) === null) {
2193
+ refuse([`git ${argv.join(' ')} failed — nothing after it ran`])
2194
+ return
2195
+ }
2196
+ }
2197
+ fs.rmSync(hotfixRecordPath(dir, config, spec.folder), { force: true })
2198
+ if (json) {
2199
+ say(JSON.stringify({ ok: true, spec: spec.folder, releaseTag: plan.releaseTag, removed: spec.worktreePath, branchDeleted: spec.branch }, null, 2))
2200
+ return
2201
+ }
2202
+ say(`spec-env hotfix finish: ${spec.folder}`)
2203
+ say('')
2204
+ say(` release: ${plan.releaseTag} (on ${remote} with ${spec.branch})`)
2205
+ say(` removed: ${spec.worktreePath}`)
2206
+ say(` deleted: ${spec.branch} (local; ${remote} keeps it)`)
2207
+ }
2208
+
2045
2209
  function specEnvHotfix(dir, config, positional, flags) {
2046
2210
  const action = positional[0]
2047
2211
  const specArg = positional[1]
2212
+ const json = flags.json === true
2213
+ const say = (line) => process.stdout.write(line + '\n')
2214
+ const refuse = (msg, extra = {}) => {
2215
+ if (json) say(JSON.stringify({ ok: false, refused: msg, ...extra }, null, 2))
2216
+ else say(`spec-env hotfix land: ${msg}`)
2217
+ process.exitCode = 1
2218
+ }
2048
2219
  // The action must be named; the spec may be omitted (resolved from the registry).
2220
+ if (action === 'finish') {
2221
+ hotfixFinish(dir, config, specArg, flags)
2222
+ return
2223
+ }
2049
2224
  if (action !== 'land') {
2050
- process.stdout.write('Usage: skitterspec spec-env hotfix land [spec] [--also <tag>]...\n')
2225
+ process.stdout.write(
2226
+ 'Usage: skitterspec spec-env hotfix land [spec] [--push] [--plan] [--json] [--also <tag>]...\n' +
2227
+ ' skitterspec spec-env hotfix finish [spec] [--json]\n',
2228
+ )
2051
2229
  return
2052
2230
  }
2053
2231
 
2054
2232
  // A hotfix may be authored entirely on its branch, so fall back to its worktree.
2055
2233
  const spec = resolveSpecWithWorktree(dir, config, specArg)
2056
2234
  if (spec.type !== 'hotfix') {
2057
- process.stdout.write(
2058
- `spec-env hotfix land: ${spec.folder} is not a hotfix — needs Type: Hotfix / a hotfix- prefix.\n`,
2059
- )
2235
+ refuse(`${spec.folder} is not a hotfix — needs Type: Hotfix / a hotfix- prefix.`)
2060
2236
  return
2061
2237
  }
2062
2238
  if (!fs.existsSync(spec.worktreePath)) {
2063
- process.stdout.write(`spec-env hotfix land: ${spec.folder} has no worktree — nothing to land.\n`)
2239
+ refuse(`${spec.folder} has no worktree — nothing to land.`)
2064
2240
  return
2065
2241
  }
2066
2242
 
@@ -2073,6 +2249,23 @@ function specEnvHotfix(dir, config, positional, flags) {
2073
2249
  const tagList = wtGit(['tag', '--list'])
2074
2250
  const existingTags = tagList ? tagList.split('\n').map((s) => s.trim()).filter(Boolean) : []
2075
2251
 
2252
+ // A release cut on an earlier run counts only while HEAD still carries its
2253
+ // tag — the positive signal that nothing has been committed since. A fix
2254
+ // added after a failed deploy moves HEAD, and the next run cuts a new one.
2255
+ const record = readHotfixRecord(dir, config, spec.folder)
2256
+ const atHead = (wtGit(['tag', '--points-at', 'HEAD']) || '').split('\n').map((s) => s.trim())
2257
+ const released = record && record.tag && atHead.includes(record.tag) ? record : null
2258
+ // Already published? Asked of the remote itself, for the one tag that could
2259
+ // be there. Only a non-empty answer counts: an unreachable remote is "cannot
2260
+ // tell", and cannot-tell holds rather than carrying a fix whose deploy tag
2261
+ // may not be public (`.claude/rules/negative-checks.md` rule 4).
2262
+ const remote = 'origin'
2263
+ const pushed =
2264
+ released !== null &&
2265
+ Boolean(wtGit(['ls-remote', '--tags', remote, `refs/tags/${released.tag}`]))
2266
+
2267
+ const carry = hotfixCarry(dir, spec, base, wtGit, released)
2268
+
2076
2269
  // Extra targets: --also flags first, then any config defaults; drop blanks, the
2077
2270
  // base tag itself, and duplicates.
2078
2271
  const seen = new Set()
@@ -2085,6 +2278,8 @@ function specEnvHotfix(dir, config, positional, flags) {
2085
2278
  let plan
2086
2279
  try {
2087
2280
  plan = planHotfixLand(spec, config, {
2281
+ // A recorded release leaves HEAD tagged and the tree clean; neither
2282
+ // `dirty` nor `aheadOfBase` changes because of it.
2088
2283
  worktreeState: { dirty },
2089
2284
  aheadOfBase,
2090
2285
  fixRange: `${spec.baseRef}..${spec.branch}`,
@@ -2092,37 +2287,99 @@ function specEnvHotfix(dir, config, positional, flags) {
2092
2287
  base,
2093
2288
  extraTargets,
2094
2289
  existingTags,
2290
+ released,
2291
+ push: flags.push === true,
2292
+ pushed,
2293
+ remote,
2294
+ fixCommits: carry.fixCommits,
2295
+ carry: carry.carry,
2095
2296
  })
2096
2297
  } catch (error) {
2097
- process.stdout.write(`spec-env hotfix land: ${error.message}.\n`)
2298
+ refuse(`${error.message}.`)
2098
2299
  return
2099
2300
  }
2100
2301
 
2101
2302
  if (plan.blocked) {
2102
- process.stdout.write(`spec-env hotfix land: blocked — ${plan.reason}.\n`)
2303
+ refuse(`blocked — ${plan.reason}.`)
2103
2304
  return
2104
2305
  }
2105
2306
  if (plan.noop) {
2106
- process.stdout.write(`spec-env hotfix land: ${plan.reason}.\n`)
2307
+ if (json) say(JSON.stringify({ ok: true, noop: true, reason: plan.reason }, null, 2))
2308
+ else say(`spec-env hotfix land: ${plan.reason}.`)
2107
2309
  return
2108
2310
  }
2109
2311
 
2110
- const out = []
2111
- out.push(`spec-env hotfix land: ${spec.folder}`)
2112
- out.push('')
2113
- out.push(` base tag: ${spec.baseRef}`)
2114
- out.push(` branch: ${spec.branch}`)
2115
- out.push(` prod tag: ${plan.prodTag} (created locally — push to deploy)`)
2116
- for (const t of plan.targets) {
2117
- if (t.kind === 'extra') out.push(` target: ${t.base} -> ${t.tag}`)
2118
- if (t.kind === 'main') out.push(` next rel: cherry-pick onto ${t.base}`)
2312
+ const header = () => {
2313
+ say(`spec-env hotfix land: ${spec.folder}${flags.plan ? ' (plan — nothing run)' : ''}`)
2314
+ say('')
2315
+ say(` base tag: ${spec.baseRef}`)
2316
+ say(` branch: ${spec.branch}`)
2119
2317
  }
2120
- out.push('')
2121
- out.push(' run these (abort a cherry-pick on conflict, resolve, then re-run):')
2122
- for (const cmd of plan.commands) out.push(` ${cmd}`)
2123
- out.push('')
2124
- out.push(` then push the deploy tag yourself: git push origin ${plan.prodTag}`)
2125
- process.stdout.write(out.join('\n') + '\n' + afterLandSection(plan.afterLand))
2318
+
2319
+ if (flags.plan) {
2320
+ if (json) {
2321
+ say(JSON.stringify({ spec: spec.folder, planned: true, steps: plan.steps }, null, 2))
2322
+ return
2323
+ }
2324
+ header()
2325
+ say('')
2326
+ plan.steps.forEach((st, i) => say(` ${i + 1}. ${describeHotfixStep(st)}`))
2327
+ return
2328
+ }
2329
+
2330
+ if (!json) {
2331
+ header()
2332
+ say('')
2333
+ }
2334
+ const result = runHotfixLand(plan.steps, {
2335
+ write: json ? () => {} : (line) => say(` ${line}`),
2336
+ childStdout: json ? process.stderr : 'inherit',
2337
+ record: (release) =>
2338
+ writeHotfixRecord(dir, config, spec.folder, { ...release, at: new Date().toISOString() }),
2339
+ })
2340
+ const tag = result.release ? result.release.tag : null
2341
+
2342
+ if (json) {
2343
+ say(
2344
+ JSON.stringify(
2345
+ {
2346
+ spec: spec.folder,
2347
+ planned: false,
2348
+ ok: result.ok,
2349
+ held: result.held === true,
2350
+ failedAt: result.failedAt,
2351
+ release: result.release,
2352
+ steps: result.results.map((r) => ({ ...r.step, outcome: r.outcome, line: r.line })),
2353
+ remaining: plan.steps.slice(result.results.length),
2354
+ },
2355
+ null,
2356
+ 2,
2357
+ ),
2358
+ )
2359
+ } else if (result.held) {
2360
+ // Stopped for want of consent. Both ways on are named: the engine pushes
2361
+ // on `--push`, or a push run by hand is found on the remote next time.
2362
+ say('')
2363
+ say(` prod tag: ${tag} (cut locally — not pushed, nothing carried yet)`)
2364
+ say(` to deploy, push the branch, then the tag — re-run with --push, or run:`)
2365
+ say(` git -C ${spec.worktreePath} push ${remote} ${spec.branch}`)
2366
+ say(` git -C ${spec.worktreePath} push ${remote} ${tag}`)
2367
+ say(` then re-run \`skitterspec spec-env hotfix land ${spec.folder}\` to carry the fix.`)
2368
+ } else if (result.ok) {
2369
+ say('')
2370
+ say(` prod tag: ${tag} (pushed to ${remote})`)
2371
+ // Only a carry that moved the base branch leaves anything to catch up on.
2372
+ if (result.carried) process.stdout.write(afterLandSection(plan.afterLand))
2373
+ } else {
2374
+ const failed = result.results[result.results.length - 1]
2375
+ process.stderr.write(` ${failed.line}\n`)
2376
+ say(
2377
+ `spec-env hotfix land: stopped at step ${result.failedAt} of ${plan.steps.length} ` +
2378
+ `(${describeHotfixStep(failed.step)}) — nothing after it ran.`,
2379
+ )
2380
+ if (tag) say(` ${tag} was cut and is recorded — a re-run carries on from it.`)
2381
+ }
2382
+ if (!result.ok) process.exitCode = 1
2126
2383
  }
2127
2384
 
2128
2385
  // What the primary checkout has GAINED right now, by content. `dir` is already
@@ -5341,6 +5598,7 @@ async function specEnv(rest) {
5341
5598
  else if (args[i] === '--record-primary') flags.recordPrimary = true
5342
5599
  else if (args[i] === '--docs') flags.docs = true
5343
5600
  else if (args[i] === '--plan') flags.plan = true
5601
+ else if (args[i] === '--push') flags.push = true
5344
5602
  else if (args[i] === '--from') flags.from = args[++i]
5345
5603
  else if (args[i] === '--session') flags.session = args[++i]
5346
5604
  else if (args[i] === '--path') flags.path = args[++i]
package/src/env/config.js CHANGED
@@ -281,11 +281,22 @@ const DEFAULT_CONFIG = Object.freeze({
281
281
  // `live take` refuses it (code-only v1). Default: none (nothing is stateful).
282
282
  live: Object.freeze({ migrations: Object.freeze([]) }),
283
283
  // Hotfix landing (`spec-env hotfix land`). `bump` is the version-bump strategy
284
- // for the new deploy tag (only "patch" today). `cherryPickMain` also cherry-picks
284
+ // for the new deploy tag: "patch" (X.Y.Z -> X.Y.(Z+1)) or "hotfix-suffix"
285
+ // (X.Y.Z -> X.Y.Z-hotfix.N). The loader keeps whatever string it is given and
286
+ // `nextTag` refuses an unknown one at land time — a loader that threw would
287
+ // break every verb over a key only one of them reads. `cherryPickMain` also cherry-picks
285
288
  // the fix onto the base branch for the next release (default true). `targets` is
286
289
  // an optional default list of extra base tags to also patch (test/demo lines);
287
290
  // `--also <tag>` on the command adds more at run time. Default: patch, main, none.
288
- hotfix: Object.freeze({ bump: 'patch', cherryPickMain: true, targets: Object.freeze([]) }),
291
+ // `releaseWith` is a project's own release command, run in the hotfix
292
+ // worktree in place of the built-in tagger — e.g. skittership's
293
+ // `node scripts/release-hotfix.cjs --json`. Empty (the default) = built-in.
294
+ hotfix: Object.freeze({
295
+ bump: 'patch',
296
+ cherryPickMain: true,
297
+ targets: Object.freeze([]),
298
+ releaseWith: '',
299
+ }),
289
300
  })
290
301
 
291
302
  function isObject(value) {
@@ -675,6 +686,7 @@ function mergeConfig(base, parsed) {
675
686
  if (isObject(parsed.hotfix)) {
676
687
  assign(base.hotfix, parsed.hotfix, 'bump', 'string')
677
688
  assign(base.hotfix, parsed.hotfix, 'cherryPickMain', 'boolean')
689
+ assign(base.hotfix, parsed.hotfix, 'releaseWith', 'string')
678
690
  if (Array.isArray(parsed.hotfix.targets)) {
679
691
  base.hotfix.targets = normalizeFileList(parsed.hotfix.targets)
680
692
  }