@skitterbyte/skitterspec-linear 19.10.0 → 19.12.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/README.md +3 -0
- package/assets/claude-md-section.md +8 -2
- package/assets/commands/allow-project.md +28 -0
- package/assets/core/env.config.md +29 -3
- package/assets/core/linear.config.md +7 -0
- package/assets/hooks/project-guard.cjs +161 -0
- package/assets/rules/spec-planning.md +44 -1
- package/assets/skills/spec/SKILL.md +30 -0
- package/assets/skills/spec-cancel/SKILL.md +22 -4
- package/assets/skills/spec-complete/SKILL.md +34 -6
- package/assets/skills/spec-idea/SKILL.md +115 -0
- package/assets/skills/spec-init/SKILL.md +3 -1
- package/assets/skills/spec-review/SKILL.md +22 -4
- package/assets/skills/spec-tada/SKILL.md +26 -4
- package/assets/skills/spec-todo/SKILL.md +104 -0
- package/bin/skitterspec-linear.js +8 -0
- package/package.json +1 -1
- package/src/cli.js +266 -21
- package/src/env/config.js +26 -3
- package/src/env/hooks.js +10 -0
- package/src/env/integrate.js +5 -34
- package/src/env/live.js +106 -4
- package/src/env/projectguard.js +389 -0
- package/src/env/triggered.js +50 -0
- package/src/idea.js +190 -0
- package/src/ideacmd.js +242 -0
- package/src/tada/digest.js +41 -2
- package/src/tada/format.js +4 -2
- package/src/tada/page.js +35 -7
- package/src/tada/repo.js +22 -2
- package/src/tada/serve.js +13 -7
- package/src/tada/todo.js +250 -0
- package/src/vendor/linear/api.js +3 -1
- package/src/vendor/linear/cli-sync.js +165 -14
- package/src/vendor/linear/config.js +3 -1
- package/src/vendor/provider-kit/src/apply.js +90 -5
|
@@ -52,6 +52,7 @@ const path = require('node:path')
|
|
|
52
52
|
const {
|
|
53
53
|
readSnapshot,
|
|
54
54
|
readBase,
|
|
55
|
+
isEmptyPlan,
|
|
55
56
|
projectionOf,
|
|
56
57
|
recordPush,
|
|
57
58
|
writeFrontmatter,
|
|
@@ -85,16 +86,58 @@ async function applySpecPlan(args) {
|
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
88
|
|
|
88
|
-
async function applyInner({
|
|
89
|
+
async function applyInner({
|
|
90
|
+
dir,
|
|
91
|
+
config,
|
|
92
|
+
snapshotDir,
|
|
93
|
+
plan,
|
|
94
|
+
adapter,
|
|
95
|
+
ops,
|
|
96
|
+
progress,
|
|
97
|
+
forceNew = false,
|
|
98
|
+
holdState = false,
|
|
99
|
+
sendHeld = false,
|
|
100
|
+
program = 'spec-sync',
|
|
101
|
+
}) {
|
|
89
102
|
const fields = fieldsOf(config)
|
|
90
103
|
const helpers = makeSpecHelpers({ program })
|
|
91
104
|
const overviewFile = (config.snapshot && config.snapshot.overviewFile) || '00-overview.md'
|
|
92
105
|
const identifier = helpers.linkedIdentifier(path.join(snapshotDir, overviewFile), config)
|
|
93
106
|
const lines = []
|
|
94
107
|
const result = { issue: null, subIssues: {} }
|
|
108
|
+
|
|
109
|
+
// PR-MODE COMPLETION, `branch` lane (spec bug-pr-complete-snapshot-on-base).
|
|
110
|
+
// Run 1 commits the move to ride the PR, but the Done waits for the merge —
|
|
111
|
+
// and run 2 sends it from the base branch, where no spec branch is left to
|
|
112
|
+
// commit a snapshot to. So run 1 HOLDS the state yet records it as sent, and
|
|
113
|
+
// run 2 SENDS only that state: the snapshot it records is byte-identical to
|
|
114
|
+
// the one the merge brought, and the base branch stays clean.
|
|
115
|
+
if (holdState && sendHeld) throw new Error(`${program} apply: --hold-state and --send-held are two runs, not one`)
|
|
116
|
+
if ((holdState || sendHeld) && !identifier) {
|
|
117
|
+
throw new Error(`${program} apply: an unlinked spec has no transition to hold — push it plainly`)
|
|
118
|
+
}
|
|
119
|
+
let heldState = false
|
|
120
|
+
let fellBack = false
|
|
121
|
+
if (holdState && plan.issue && plan.issue.state != null) {
|
|
122
|
+
const { state, stateResend, ...rest } = plan.issue
|
|
123
|
+
plan = { ...plan, issue: Object.keys(rest).length ? rest : undefined }
|
|
124
|
+
heldState = state
|
|
125
|
+
} else if (sendHeld) {
|
|
126
|
+
// A NON-EMPTY PLAN MEANS RUN 1 HELD NOTHING — it predates the hold, so the
|
|
127
|
+
// whole completion is still unsent. Sending the state alone would strand
|
|
128
|
+
// the rest; apply it all, as before, and say which file that leaves dirty.
|
|
129
|
+
if (isEmptyPlan(plan)) {
|
|
130
|
+
const status = projectionOf(snapshotDir, config).status
|
|
131
|
+
if (status != null) plan = { ...plan, issue: { state: status } }
|
|
132
|
+
} else {
|
|
133
|
+
fellBack = true
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
95
137
|
// Which items this apply carried a state for — the snapshot records today's
|
|
96
|
-
// state name for these and only these (`recordPush`).
|
|
97
|
-
|
|
138
|
+
// state name for these and only these (`recordPush`). A held state counts:
|
|
139
|
+
// run 2 sends it, and what run 2 records has to match what run 1 committed.
|
|
140
|
+
const sent = { issue: !!heldState || !!(plan.issue && plan.issue.state != null), subIssues: new Set() }
|
|
98
141
|
// Handed out immediately, so a throw from anywhere below still reports what
|
|
99
142
|
// had been stamped by the time it happened.
|
|
100
143
|
if (progress) progress.result = result
|
|
@@ -268,7 +311,12 @@ async function applyInner({ dir, config, snapshotDir, plan, adapter, ops, progre
|
|
|
268
311
|
const file = recordPush({ dir, snapshotDir, identifier: helpers.specIdentifier(snapshotDir, config), config, sent, keepSubIssues })
|
|
269
312
|
// A repo path, `/`-separated on every platform — the form every other
|
|
270
313
|
// spec path in this output takes.
|
|
271
|
-
|
|
314
|
+
const snapshotPath = path.relative(dir, file).split(path.sep).join('/')
|
|
315
|
+
lines.push(` snapshot: ${snapshotPath}`)
|
|
316
|
+
if (heldState) lines.push(` state held: ${identifier} → ${heldState} waits for the merge — run 2 sends it with --send-held`)
|
|
317
|
+
if (fellBack) {
|
|
318
|
+
lines.push(` !! nothing was held for ${identifier} — sent the whole plan; ${snapshotPath} now differs from the merged copy`)
|
|
319
|
+
}
|
|
272
320
|
return { result, lines, lost }
|
|
273
321
|
}
|
|
274
322
|
|
|
@@ -304,4 +352,41 @@ function resolvePhaseFileIn(snapshotDir, ref) {
|
|
|
304
352
|
return listPhaseFiles(snapshotDir).find((f) => f.replace(/\.md$/, '') === want) || null
|
|
305
353
|
}
|
|
306
354
|
|
|
307
|
-
|
|
355
|
+
/**
|
|
356
|
+
* `--hold-state` / `--send-held` as every provider's `apply` reads them: one
|
|
357
|
+
* spec, one of the two, never both. Returns `{ holdState, sendHeld }`, or
|
|
358
|
+
* `{ error }` for the provider to print and exit 1 on.
|
|
359
|
+
*/
|
|
360
|
+
function heldFlags(flags, program) {
|
|
361
|
+
const holdState = !!(flags && flags.holdState)
|
|
362
|
+
const sendHeld = !!(flags && flags.sendHeld)
|
|
363
|
+
if (holdState && sendHeld) return { error: `${program} apply: --hold-state and --send-held are two runs, not one` }
|
|
364
|
+
if ((holdState || sendHeld) && flags.all != null) {
|
|
365
|
+
return { error: `${program} apply --all: --hold-state and --send-held act on one spec at a time` }
|
|
366
|
+
}
|
|
367
|
+
return { holdState, sendHeld }
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* What the MCP transport adds to its "nothing written" note, so the hand-applied
|
|
372
|
+
* push ends with the same snapshot the API path would record. Null when neither
|
|
373
|
+
* flag is set.
|
|
374
|
+
*/
|
|
375
|
+
function heldOverMcp({ holdState, sendHeld }, program) {
|
|
376
|
+
if (holdState) {
|
|
377
|
+
return (
|
|
378
|
+
" --hold-state: apply the plan WITHOUT the spec issue's state, then record with\n" +
|
|
379
|
+
` \`${program} record <spec> --held\` — run 2 sends the state after the merge.`
|
|
380
|
+
)
|
|
381
|
+
}
|
|
382
|
+
if (sendHeld) {
|
|
383
|
+
return (
|
|
384
|
+
" --send-held: if `plan` is empty, send the spec issue's state alone and record\n" +
|
|
385
|
+
' nothing — the merged snapshot already says it. If it is not, run 1 held\n' +
|
|
386
|
+
' nothing: apply it whole and record as usual.'
|
|
387
|
+
)
|
|
388
|
+
}
|
|
389
|
+
return null
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
module.exports = { applySpecPlan, heldFlags, heldOverMcp }
|