@skitterbyte/skitterspec-github 2.18.1 → 3.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.
- package/MIGRATION.md +126 -0
- package/README.md +11 -2
- package/assets/claude-md-section.md +23 -123
- package/assets/core/SETUP.md +4 -2
- package/assets/project-conventions.md +17 -0
- package/assets/rules/commit-trailers.md +41 -99
- package/assets/rules/negative-checks.md +21 -48
- package/assets/rules/offered-unblocks.md +39 -74
- package/assets/rules/spec-format.md +117 -0
- package/assets/rules/spec-planning.md +128 -1013
- package/assets/rules/spec-reports.md +70 -607
- package/assets/skills/no-spec/SKILL.md +4 -4
- package/assets/skills/spec/SKILL.md +7 -7
- package/assets/skills/spec/kind-routing.md +35 -0
- package/assets/skills/spec-bug/SKILL.md +6 -6
- package/assets/skills/spec-cancel/SKILL.md +1 -1
- package/assets/skills/spec-complete/SKILL.md +1 -1
- package/assets/skills/spec-diff/SKILL.md +6 -2
- package/assets/skills/spec-diff/review-page.md +89 -0
- package/assets/skills/spec-diff/review-wait.md +133 -0
- package/assets/skills/spec-epic-next/SKILL.md +2 -1
- package/assets/skills/spec-epic-next/epics.md +44 -0
- package/assets/skills/spec-hotfix/SKILL.md +5 -5
- package/assets/skills/spec-incident/SKILL.md +1 -1
- package/assets/skills/spec-next/SKILL.md +5 -5
- package/assets/skills/spec-resume/SKILL.md +204 -8
- package/assets/skills/spec-review/SKILL.md +1 -1
- package/assets/skills/spec-start/isolation.md +90 -0
- package/bin/skitterspec-github.js +3 -2
- package/package.json +2 -3
- package/src/cli.js +72 -5
- package/src/conventions.js +43 -0
- package/src/env/resume.js +116 -3
- package/src/init.js +180 -30
- package/src/spec-planning-history.json +103 -0
- package/src/updateall.js +152 -0
package/src/updateall.js
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `skitterspec update --all` — every local-scope project on this machine,
|
|
5
|
+
* updated by its own distribution (feat-global-install, phase 2).
|
|
6
|
+
*
|
|
7
|
+
* Projects are the folders Claude Code has run sessions in (`knownDirs`, the
|
|
8
|
+
* list `tada` reads), kept only where a skitterspec manifest is found: that file
|
|
9
|
+
* is a positive signal an install was made there, where a folder merely named
|
|
10
|
+
* in a transcript is not. A linked worktree is folded into its primary
|
|
11
|
+
* checkout, because a local install seeds its worktrees from the primary — one
|
|
12
|
+
* update there reaches them all.
|
|
13
|
+
*
|
|
14
|
+
* WHAT WOULD FOOL THIS: a project that never ran a Claude Code session on this
|
|
15
|
+
* machine is not in the list, so it is not updated — and not mentioned either.
|
|
16
|
+
* A transcript root that was cleared forgets projects the same way. Both cost a
|
|
17
|
+
* project left on the old version, which `skitterspec update` there still
|
|
18
|
+
* fixes; neither can update the wrong thing.
|
|
19
|
+
*
|
|
20
|
+
* Every lookup that touches the machine is injected, so the planner is tested
|
|
21
|
+
* against fake folders and a fake transcript root.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
const fs = require('node:fs')
|
|
25
|
+
const path = require('node:path')
|
|
26
|
+
|
|
27
|
+
const MANIFEST = path.join('specs', '.core', '.skitterspec-manifest.json')
|
|
28
|
+
const PROVIDERS = ['github', 'linear', 'jira', 'azure-boards']
|
|
29
|
+
const BASE = '@skitterbyte/skitterspec'
|
|
30
|
+
|
|
31
|
+
function real(p) {
|
|
32
|
+
try {
|
|
33
|
+
return fs.realpathSync.native(p)
|
|
34
|
+
} catch {
|
|
35
|
+
return path.resolve(p)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// The nearest folder at or above `dir` holding a manifest, bounded so a stray
|
|
40
|
+
// manifest far above the project is never reached.
|
|
41
|
+
function projectAt(dir, exists) {
|
|
42
|
+
let at = path.resolve(dir)
|
|
43
|
+
for (let i = 0; i < 6; i++) {
|
|
44
|
+
if (exists(path.join(at, MANIFEST))) return at
|
|
45
|
+
const up = path.dirname(at)
|
|
46
|
+
if (up === at) return null
|
|
47
|
+
at = up
|
|
48
|
+
}
|
|
49
|
+
return null
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// The same project folder in the primary checkout, when `dir` is inside a
|
|
53
|
+
// linked worktree; else `dir`. A git that cannot answer leaves it unchanged.
|
|
54
|
+
function inPrimary(dir, git) {
|
|
55
|
+
const top = git(dir, ['rev-parse', '--show-toplevel'])
|
|
56
|
+
const common = git(dir, ['rev-parse', '--git-common-dir'])
|
|
57
|
+
if (!top || !common) return dir
|
|
58
|
+
const primary = path.dirname(path.resolve(dir, common))
|
|
59
|
+
if (real(primary) === real(top)) return dir
|
|
60
|
+
const rel = path.relative(real(top), real(dir))
|
|
61
|
+
return rel.startsWith('..') || path.isAbsolute(rel) ? dir : path.join(primary, rel)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The distribution that owns a project: what its manifest recorded, else the
|
|
66
|
+
* provider whose config is in `specs/.core/`, else the base. Inferred only for
|
|
67
|
+
* manifests written before the field existed.
|
|
68
|
+
*/
|
|
69
|
+
function distributionOf(dir, manifest, exists) {
|
|
70
|
+
if (manifest.distribution) return manifest.distribution
|
|
71
|
+
for (const p of PROVIDERS) {
|
|
72
|
+
if (exists(path.join(dir, 'specs', '.core', `${p}.config.json`))) return `${BASE}-${p}`
|
|
73
|
+
}
|
|
74
|
+
return BASE
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const binOf = (pkg) => pkg.replace(/^@skitterbyte\//, '')
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* One row per project: `{ dir, name, scope, distribution, action }`, where
|
|
81
|
+
* action is `update` · `team` · `disabled` · `missing`. Sorted by name so the
|
|
82
|
+
* report reads the same on every run.
|
|
83
|
+
*/
|
|
84
|
+
function planUpdateAll({ dirs, exists, git, readManifest, onPath }) {
|
|
85
|
+
const seen = new Map()
|
|
86
|
+
for (const d of dirs) {
|
|
87
|
+
if (!exists(d)) continue
|
|
88
|
+
const found = projectAt(d, exists)
|
|
89
|
+
if (!found) continue
|
|
90
|
+
const dir = inPrimary(found, git)
|
|
91
|
+
if (!exists(path.join(dir, MANIFEST))) continue
|
|
92
|
+
const key = real(dir)
|
|
93
|
+
if (!seen.has(key)) seen.set(key, dir)
|
|
94
|
+
}
|
|
95
|
+
const rows = []
|
|
96
|
+
for (const dir of seen.values()) {
|
|
97
|
+
const manifest = readManifest(dir)
|
|
98
|
+
const distribution = distributionOf(dir, manifest, exists)
|
|
99
|
+
let action = 'update'
|
|
100
|
+
if (manifest.scope !== 'local') action = 'team'
|
|
101
|
+
else if (!manifest.enabled) action = 'disabled'
|
|
102
|
+
else if (!onPath(binOf(distribution))) action = 'missing'
|
|
103
|
+
rows.push({ dir, name: path.basename(dir), scope: manifest.scope, distribution, action })
|
|
104
|
+
}
|
|
105
|
+
return rows.sort((a, b) => a.name.localeCompare(b.name) || a.dir.localeCompare(b.dir))
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// How many managed files an `update` run wrote, read from its own report: the
|
|
109
|
+
// lines under `created:`, `updated:` and `removed:`.
|
|
110
|
+
function countChanged(stdout) {
|
|
111
|
+
let n = 0
|
|
112
|
+
let counting = false
|
|
113
|
+
for (const line of String(stdout).split(/\r?\n/)) {
|
|
114
|
+
if (/^(created|updated|removed):$/.test(line)) counting = true
|
|
115
|
+
else if (/^\S/.test(line) || line === '') counting = false
|
|
116
|
+
else if (counting && /^ {2}\S/.test(line)) n++
|
|
117
|
+
}
|
|
118
|
+
return n
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Run the plan. `run(bin, args, cwd)` returns `{ status, stdout, stderr }`.
|
|
123
|
+
* Returns `{ lines, failed }`: one line per project, and whether any update
|
|
124
|
+
* failed — listed and skipped projects are not failures.
|
|
125
|
+
*/
|
|
126
|
+
function runUpdateAll(rows, run) {
|
|
127
|
+
const lines = []
|
|
128
|
+
let failed = false
|
|
129
|
+
const width = Math.max(0, ...rows.map((r) => r.name.length))
|
|
130
|
+
for (const r of rows) {
|
|
131
|
+
const head = `${r.name.padEnd(width)} ${r.scope.padEnd(5)} · ${binOf(r.distribution).replace(/^skitterspec-?/, '') || 'base'}`
|
|
132
|
+
let outcome
|
|
133
|
+
if (r.action === 'team') outcome = 'listed — team install, update it on a /no-spec branch'
|
|
134
|
+
else if (r.action === 'disabled') outcome = 'skipped — disabled (skitterspec enable turns it on)'
|
|
135
|
+
else if (r.action === 'missing') outcome = `skipped — npm i -g ${r.distribution}`
|
|
136
|
+
else {
|
|
137
|
+
const res = run(binOf(r.distribution), ['update', r.dir], r.dir)
|
|
138
|
+
if (res.status === 0) {
|
|
139
|
+
const n = countChanged(res.stdout)
|
|
140
|
+
outcome = n ? `updated ${n} file${n === 1 ? '' : 's'}` : 'current'
|
|
141
|
+
} else {
|
|
142
|
+
failed = true
|
|
143
|
+
const first = `${res.stderr || ''}\n${res.stdout || ''}`.split(/\r?\n/).find((l) => l.trim()) || `exit ${res.status}`
|
|
144
|
+
outcome = `failed — ${first.trim()}`
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
lines.push(` ${head} ${outcome}`)
|
|
148
|
+
}
|
|
149
|
+
return { lines, failed }
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
module.exports = { planUpdateAll, runUpdateAll, countChanged, distributionOf, MANIFEST }
|