@skitterbyte/skitterspec 23.23.3 → 23.24.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 +32 -0
- package/assets/claude-md-section.md +4 -0
- package/assets/core/env.config.json.example +5 -0
- package/assets/core/env.config.md +20 -1
- package/assets/hooks/run-compact.cjs +162 -0
- package/assets/review/page.html +122 -2
- package/assets/rules/spec-format.md +6 -0
- package/assets/rules/spec-planning.md +9 -0
- package/assets/rules/spec-reports.md +5 -0
- package/assets/skills/spec/SKILL.md +11 -1
- package/assets/skills/spec-complete/SKILL.md +9 -0
- package/assets/skills/spec-diff/SKILL.md +24 -0
- package/assets/skills/spec-idea/SKILL.md +6 -0
- package/assets/skills/spec-next/SKILL.md +18 -1
- package/assets/skills/spec-next/autonomous.md +126 -0
- package/assets/skills/spec-reviewed/SKILL.md +2 -1
- package/assets/skills/spec-start/SKILL.md +8 -0
- package/assets/skills/spec-start/isolation.md +1 -1
- package/package.json +1 -1
- package/src/cli.js +267 -2
- package/src/env/config.js +18 -0
- package/src/env/hooks.js +44 -20
- package/src/env/report.js +192 -0
- package/src/env/resolve.js +6 -1
- package/src/env/review.js +14 -2
- package/src/env/run.js +226 -0
- package/src/env/runpage.js +229 -0
- package/src/env/serve.js +47 -4
- package/src/ideacmd.js +5 -2
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The pages an autonomous run leaves behind (feat-autonomous-run, phase 3):
|
|
5
|
+
*
|
|
6
|
+
* - a SNAPSHOT per phase — that phase's review page, kept as it was when the
|
|
7
|
+
* run committed it (`reviews/<spec>/phase-<n>.html`), read-only;
|
|
8
|
+
* - the RUN INDEX — every snapshot as it lands, with its commit and report,
|
|
9
|
+
* served at `/<token>/<spec>/run` so the run can be read while it goes;
|
|
10
|
+
* - the AGGREGATE that heads the final page — every phase's Notes and
|
|
11
|
+
* Follow-ups, the stops and compactions, in one list.
|
|
12
|
+
*
|
|
13
|
+
* Everything here is built from records the engine already keeps (the run
|
|
14
|
+
* record, the report sidecar) and is escaped on the way out. Nothing reads a
|
|
15
|
+
* diff, and nothing here decides anything.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const fs = require('node:fs')
|
|
19
|
+
const path = require('node:path')
|
|
20
|
+
|
|
21
|
+
const { readReport, reportHtmlFor, CARRIED } = require('./report.js')
|
|
22
|
+
const { readRun, compactionSummary } = require('./run.js')
|
|
23
|
+
|
|
24
|
+
function escapeHtml(s) {
|
|
25
|
+
return String(s).replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' })[c])
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function inline(text) {
|
|
29
|
+
return escapeHtml(text)
|
|
30
|
+
.replace(/`([^`]+)`/g, '<code>$1</code>')
|
|
31
|
+
.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>')
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Where a phase's snapshot lives, beside the spec's page. */
|
|
35
|
+
function snapshotPath(outPath, phase) {
|
|
36
|
+
return path.join(outPath.replace(/\.html$/, ''), `phase-${phase}.html`)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// The state dir is the reviews dir's parent; the run record sits beside it.
|
|
40
|
+
function stateDirOf(outPath) {
|
|
41
|
+
return path.dirname(path.dirname(outPath))
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Which phases have a snapshot on disk, ascending. Never throws. */
|
|
45
|
+
function snapshotPhases(outPath) {
|
|
46
|
+
let names
|
|
47
|
+
try {
|
|
48
|
+
names = fs.readdirSync(outPath.replace(/\.html$/, ''))
|
|
49
|
+
} catch {
|
|
50
|
+
return []
|
|
51
|
+
}
|
|
52
|
+
return names
|
|
53
|
+
.map((n) => /^phase-(\d+)\.html$/.exec(n))
|
|
54
|
+
.filter(Boolean)
|
|
55
|
+
.map((m) => Number(m[1]))
|
|
56
|
+
.sort((a, b) => a - b)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// A value that says nothing — `none`, `—` — is not an item to carry forward.
|
|
60
|
+
const EMPTY = /^(none|—|-|n\/a)\.?$/i
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Every phase's carried rows, in phase order: `[{ phase, field, value, more }]`.
|
|
64
|
+
* Pure.
|
|
65
|
+
*/
|
|
66
|
+
function carriedItems(report) {
|
|
67
|
+
const phases = Object.values((report && report.phases) || {})
|
|
68
|
+
.filter((e) => e && Array.isArray(e.rows))
|
|
69
|
+
.sort((a, b) => (Number(a.phase) || 0) - (Number(b.phase) || 0))
|
|
70
|
+
const out = []
|
|
71
|
+
for (const e of phases) {
|
|
72
|
+
for (const r of e.rows) {
|
|
73
|
+
if (!CARRIED.includes(r.field) || EMPTY.test(String(r.value).trim())) continue
|
|
74
|
+
out.push({ phase: e.phase, field: r.field, value: r.value, more: r.more || [] })
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return out
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The block that heads the final page. Empty string when the run left nothing
|
|
82
|
+
* to say AND there is no run — so a final page for a spec with no record reads
|
|
83
|
+
* as an ordinary page rather than an empty box.
|
|
84
|
+
*/
|
|
85
|
+
function renderAggregate({ report, run, spec, snapshots = [] }) {
|
|
86
|
+
const items = carriedItems(report)
|
|
87
|
+
const stops = (run && run.stops) || []
|
|
88
|
+
const compacted = compactionSummary(run)
|
|
89
|
+
if (!items.length && !stops.length && !compacted && !snapshots.length && !run) return ''
|
|
90
|
+
const parts = ['<section class="report run-aggregate">', '<h2 class="report-heading">The whole run</h2>']
|
|
91
|
+
const followUps = items.filter((i) => i.field === 'Follow-ups')
|
|
92
|
+
const notes = items.filter((i) => i.field === 'Notes')
|
|
93
|
+
const list = (title, rows) => {
|
|
94
|
+
if (!rows.length) return
|
|
95
|
+
parts.push(`<p class="report-title"><strong>${title}</strong></p>`, '<ul class="run-items">')
|
|
96
|
+
for (const i of rows) {
|
|
97
|
+
const more = i.more.map((m) => `<br>${inline(m)}`).join('')
|
|
98
|
+
parts.push(`<li><span class="run-phase">phase ${escapeHtml(i.phase)}</span> ${inline(i.value)}${more}</li>`)
|
|
99
|
+
}
|
|
100
|
+
parts.push('</ul>')
|
|
101
|
+
}
|
|
102
|
+
list('Follow-ups, bugs and suggestions', followUps)
|
|
103
|
+
list('Notes', notes)
|
|
104
|
+
if (!followUps.length && !notes.length) parts.push('<p class="report-title">No phase recorded a follow-up or a note.</p>')
|
|
105
|
+
if (stops.length) {
|
|
106
|
+
parts.push('<p class="report-title"><strong>Stops</strong></p>', '<ul class="run-items">')
|
|
107
|
+
for (const s of stops) parts.push(`<li><span class="run-phase">phase ${escapeHtml(s.phase)}</span> ${inline(s.reason)}</li>`)
|
|
108
|
+
parts.push('</ul>')
|
|
109
|
+
}
|
|
110
|
+
if (compacted) parts.push(`<p class="report-title">Context ${escapeHtml(compacted)}.</p>`)
|
|
111
|
+
if (snapshots.length) {
|
|
112
|
+
const links = snapshots.map((n) => `<a href="${encodeURIComponent(spec)}/phase-${n}">phase ${n}</a>`).join(' · ')
|
|
113
|
+
parts.push(`<p class="report-title">Each phase as reviewed: ${links} · <a href="${encodeURIComponent(spec)}/run">run index</a></p>`)
|
|
114
|
+
}
|
|
115
|
+
parts.push('</section>')
|
|
116
|
+
return parts.join('\n')
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** The aggregate for a spec, read from its records. '' on any cannot-tell. */
|
|
120
|
+
function aggregateHtmlFor(outPath, spec) {
|
|
121
|
+
const read = readReport(outPath, spec)
|
|
122
|
+
const run = readRun(stateDirOf(outPath), spec)
|
|
123
|
+
return renderAggregate({
|
|
124
|
+
report: read.corrupt ? null : read.report,
|
|
125
|
+
run: run.corrupt ? null : run.record,
|
|
126
|
+
spec,
|
|
127
|
+
snapshots: snapshotPhases(outPath),
|
|
128
|
+
})
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* The run index page — a doorway, styled like the server's index. Pure.
|
|
133
|
+
* `phases` is the union of what the run record and the disk know, so a
|
|
134
|
+
* snapshot written before its `run phase` call still shows.
|
|
135
|
+
*/
|
|
136
|
+
function renderRunIndex({ spec, run = null, report = null, snapshots = [], token = null, project = null }) {
|
|
137
|
+
const prefix = token ? `/${token}` : ''
|
|
138
|
+
const base = `${prefix}/${encodeURIComponent(spec)}`
|
|
139
|
+
const byPhase = new Map()
|
|
140
|
+
for (const p of (run && run.phases) || []) byPhase.set(p.n, { ...p })
|
|
141
|
+
for (const n of snapshots) byPhase.set(n, { n, ...(byPhase.get(n) || {}), snapshot: true })
|
|
142
|
+
const reports = (report && report.phases) || {}
|
|
143
|
+
const rows = [...byPhase.values()]
|
|
144
|
+
.sort((a, b) => a.n - b.n)
|
|
145
|
+
.map((p) => {
|
|
146
|
+
const r = reports[String(p.n)]
|
|
147
|
+
const built = r && r.rows ? r.rows.find((x) => x.field === 'Built') : null
|
|
148
|
+
const link = p.snapshot ? `<a href="${base}/phase-${p.n}">phase ${p.n}</a>` : `phase ${p.n}`
|
|
149
|
+
return (
|
|
150
|
+
`<li>${link}` +
|
|
151
|
+
(p.commit ? `<span class="b">${escapeHtml(String(p.commit).slice(0, 8))}</span>` : '') +
|
|
152
|
+
(built ? `<span class="t">${inline(built.value)}</span>` : '') +
|
|
153
|
+
'</li>'
|
|
154
|
+
)
|
|
155
|
+
})
|
|
156
|
+
const state = run ? (run.active ? `running · ends on <strong>${escapeHtml(run.then)}</strong>` : `ended · ${escapeHtml(run.outcome || run.then)}`) : 'no run recorded'
|
|
157
|
+
const compacted = compactionSummary(run)
|
|
158
|
+
const heading = `${project ? `${escapeHtml(project)} · ` : ''}${escapeHtml(spec)} · run`
|
|
159
|
+
const body = rows.length ? `<ul>\n${rows.join('\n')}\n</ul>` : '<p class="empty">No phase has been committed by this run yet.</p>'
|
|
160
|
+
return `<!doctype html>
|
|
161
|
+
<html lang="en">
|
|
162
|
+
<head>
|
|
163
|
+
<meta charset="utf-8">
|
|
164
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
165
|
+
<title>${heading}</title>
|
|
166
|
+
<style>
|
|
167
|
+
:root { --bg:#fff; --fg:#1a1a1a; --dim:#6b6b6b; --line:#e3e3e3; --link:#0b5fbd }
|
|
168
|
+
@media (prefers-color-scheme: dark) {
|
|
169
|
+
:root:not([data-theme="light"]) { --bg:#16181c; --fg:#e6e6e6; --dim:#9a9a9a; --line:#2c2f36; --link:#7cb7ff }
|
|
170
|
+
}
|
|
171
|
+
* { box-sizing:border-box }
|
|
172
|
+
body { margin:0; padding:2rem 1rem; background:var(--bg); color:var(--fg);
|
|
173
|
+
font:15px/1.5 ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif }
|
|
174
|
+
main { max-width:52rem; margin:0 auto }
|
|
175
|
+
h1 { font-size:1.1rem; margin:0 0 .25rem; font-weight:600 }
|
|
176
|
+
.state { color:var(--dim); margin:0 0 1.25rem }
|
|
177
|
+
ul { list-style:none; margin:0; padding:0 }
|
|
178
|
+
li { display:flex; flex-wrap:wrap; gap:.75rem; align-items:baseline; padding:.7rem 0; border-top:1px solid var(--line) }
|
|
179
|
+
a { color:var(--link); text-decoration:none; font-weight:600 }
|
|
180
|
+
a:hover { text-decoration:underline }
|
|
181
|
+
.b { color:var(--dim); font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:.85em }
|
|
182
|
+
.t { flex-basis:100%; color:var(--fg); font-size:.9em; overflow-wrap:anywhere }
|
|
183
|
+
.empty { color:var(--dim) }
|
|
184
|
+
code { font-family:ui-monospace,SFMono-Regular,Menlo,monospace }
|
|
185
|
+
</style>
|
|
186
|
+
</head>
|
|
187
|
+
<body>
|
|
188
|
+
<main>
|
|
189
|
+
<h1>${heading}</h1>
|
|
190
|
+
<p class="state">${state}${compacted ? ` · ${escapeHtml(compacted)}` : ''} · <a href="${base}">current page</a></p>
|
|
191
|
+
${body}
|
|
192
|
+
</main>
|
|
193
|
+
</body>
|
|
194
|
+
</html>
|
|
195
|
+
`
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/** The run index for a spec, read from its records. */
|
|
199
|
+
function runIndexFor(outPath, spec, { token = null, project = null } = {}) {
|
|
200
|
+
const read = readReport(outPath, spec)
|
|
201
|
+
const run = readRun(stateDirOf(outPath), spec)
|
|
202
|
+
return renderRunIndex({
|
|
203
|
+
spec,
|
|
204
|
+
run: run.corrupt ? null : run.record,
|
|
205
|
+
report: read.corrupt ? null : read.report,
|
|
206
|
+
snapshots: snapshotPhases(outPath),
|
|
207
|
+
token,
|
|
208
|
+
project,
|
|
209
|
+
})
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* What heads a page, by its button set: the final page carries the whole run;
|
|
214
|
+
* every other page its latest phase report. '' when there is nothing to show.
|
|
215
|
+
*/
|
|
216
|
+
function pageHeadFor(outPath, spec, buttons) {
|
|
217
|
+
return buttons === 'final' ? aggregateHtmlFor(outPath, spec) : reportHtmlFor(outPath, spec)
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
module.exports = {
|
|
221
|
+
pageHeadFor,
|
|
222
|
+
snapshotPath,
|
|
223
|
+
snapshotPhases,
|
|
224
|
+
carriedItems,
|
|
225
|
+
renderAggregate,
|
|
226
|
+
aggregateHtmlFor,
|
|
227
|
+
renderRunIndex,
|
|
228
|
+
runIndexFor,
|
|
229
|
+
}
|
package/src/env/serve.js
CHANGED
|
@@ -30,6 +30,7 @@ const fs = require('node:fs')
|
|
|
30
30
|
const path = require('node:path')
|
|
31
31
|
const crypto = require('node:crypto')
|
|
32
32
|
|
|
33
|
+
const { pageHeadFor, runIndexFor, snapshotPath } = require('./runpage.js')
|
|
33
34
|
const {
|
|
34
35
|
liveWorktreePaths,
|
|
35
36
|
allSpecs,
|
|
@@ -96,6 +97,15 @@ function routeFor(url, { token = null } = {}) {
|
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
if (segments.length === 0) return { kind: 'index' }
|
|
100
|
+
// AN AUTONOMOUS RUN'S PAGES (feat-autonomous-run): `<spec>/run` is the run
|
|
101
|
+
// index, `<spec>/phase-<n>` a kept phase page. Both are reads; anything else
|
|
102
|
+
// two segments deep is not a page.
|
|
103
|
+
if (segments.length === 2) {
|
|
104
|
+
if (segments[1] === 'run') return { kind: 'run', spec: segments[0] }
|
|
105
|
+
const m = /^phase-(\d+)$/.exec(segments[1])
|
|
106
|
+
if (m) return { kind: 'snapshot', spec: segments[0], phase: Number(m[1]) }
|
|
107
|
+
return { kind: 'notfound' }
|
|
108
|
+
}
|
|
99
109
|
if (segments.length > 1) return { kind: 'notfound' }
|
|
100
110
|
// The ta-da page: a window, not a spec. Its query is the window and passed
|
|
101
111
|
// through whole, to be read — and refused if unreadable — by `tada/serve.js`.
|
|
@@ -518,7 +528,9 @@ function receivePass(dir, config, spec, blob) {
|
|
|
518
528
|
* so every `/no-spec` page served over http offered to put nothing in flight,
|
|
519
529
|
* and the pass came back naming a verdict its own skill could not act on.
|
|
520
530
|
*/
|
|
521
|
-
|
|
531
|
+
// `final` too: the run's last render declared it, and a served re-render
|
|
532
|
+
// must keep offering the ending rather than fall back to `Commit`.
|
|
533
|
+
const NARROWING_SETS = ['midrun', 'refresh', 'fix', 'final']
|
|
522
534
|
|
|
523
535
|
function buttonsForView(viewKind, spec, recorded) {
|
|
524
536
|
if (NARROWING_SETS.includes(recorded)) return recorded
|
|
@@ -573,7 +585,7 @@ function renderSpecPage(dir, config, spec, { branch = false } = {}) {
|
|
|
573
585
|
treePath: view.tree,
|
|
574
586
|
})
|
|
575
587
|
return {
|
|
576
|
-
html: renderReviewPage(data, { reviewHtml: renderReviewBlock(data.review) }),
|
|
588
|
+
html: renderReviewPage(data, { reviewHtml: pageHeadFor(out, spec.folder, buttons) + renderReviewBlock(data.review) }),
|
|
577
589
|
totals: data.totals,
|
|
578
590
|
mode: data.mode,
|
|
579
591
|
fellBack: false,
|
|
@@ -680,7 +692,7 @@ function renderSpecPage(dir, config, spec, { branch = false } = {}) {
|
|
|
680
692
|
}
|
|
681
693
|
|
|
682
694
|
return {
|
|
683
|
-
html: renderReviewPage(data, { reviewHtml: renderReviewBlock(data.review) }),
|
|
695
|
+
html: renderReviewPage(data, { reviewHtml: pageHeadFor(reviewOutPath(dir, spec.folder, null), spec.folder, buttons) + renderReviewBlock(data.review) }),
|
|
684
696
|
totals: data.totals,
|
|
685
697
|
mode: data.mode,
|
|
686
698
|
fellBack,
|
|
@@ -815,7 +827,7 @@ function readBody(req, limit = MAX_PASS_BYTES) {
|
|
|
815
827
|
})
|
|
816
828
|
}
|
|
817
829
|
|
|
818
|
-
function createReviewServer({ resolveEntries, resolveEpics = () => [], render, receive = null, passState = null, tada = null, token = null, project = null }) {
|
|
830
|
+
function createReviewServer({ resolveEntries, resolveEpics = () => [], render, receive = null, passState = null, tada = null, runPage = null, snapshot = null, token = null, project = null }) {
|
|
819
831
|
return http.createServer((req, res) => {
|
|
820
832
|
const send = (code, body, type = 'text/html; charset=utf-8') => {
|
|
821
833
|
res.writeHead(code, { 'content-type': type, 'cache-control': 'no-store' })
|
|
@@ -882,6 +894,19 @@ function createReviewServer({ resolveEntries, resolveEpics = () => [], render, r
|
|
|
882
894
|
return
|
|
883
895
|
}
|
|
884
896
|
|
|
897
|
+
// A SERVER BUILT WITHOUT THE HOOKS is an older one, and says not found —
|
|
898
|
+
// the same answer an unknown path gets.
|
|
899
|
+
if (route.kind === 'run' || route.kind === 'snapshot') {
|
|
900
|
+
const hook = route.kind === 'run' ? runPage : snapshot
|
|
901
|
+
if (!hook) return send(404, 'not found', 'text/plain; charset=utf-8')
|
|
902
|
+
try {
|
|
903
|
+
const out = route.kind === 'run' ? hook(route.spec, { token }) : hook(route.spec, route.phase)
|
|
904
|
+
return out && out.html ? send(200, out.html) : send(404, 'not found', 'text/plain; charset=utf-8')
|
|
905
|
+
} catch (err) {
|
|
906
|
+
return send(500, `render failed: ${err.message}`, 'text/plain; charset=utf-8')
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
|
|
885
910
|
try {
|
|
886
911
|
if (route.kind === 'index') return send(200, renderIndex(resolveEntries(), { token, epics: resolveEpics(), project }))
|
|
887
912
|
const out = render(route.spec, { branch: route.branch })
|
|
@@ -1105,6 +1130,24 @@ function serverHooks(dir, config) {
|
|
|
1105
1130
|
return renderSpecPage(dir, config, resolveOne(folder), opts)
|
|
1106
1131
|
},
|
|
1107
1132
|
receive: (folder, blob) => receivePass(dir, config, resolveOne(folder), blob),
|
|
1133
|
+
// The run index, built per request from the run record and the report
|
|
1134
|
+
// sidecar; a spec this daemon cannot resolve is a 404, not an empty run.
|
|
1135
|
+
runPage: (folder, { token: t = null } = {}) => {
|
|
1136
|
+
const one = resolveOne(folder)
|
|
1137
|
+
if (!one) return null
|
|
1138
|
+
return { html: runIndexFor(reviewOutPath(dir, one.folder, null), one.folder, { token: t, project: projectName(config) }) }
|
|
1139
|
+
},
|
|
1140
|
+
// A kept phase page is served as written — it is a record of what that
|
|
1141
|
+
// phase looked like, so re-rendering it from today's tree would defeat it.
|
|
1142
|
+
snapshot: (folder, phase) => {
|
|
1143
|
+
const one = resolveOne(folder)
|
|
1144
|
+
if (!one) return null
|
|
1145
|
+
try {
|
|
1146
|
+
return { html: fs.readFileSync(snapshotPath(reviewOutPath(dir, one.folder, null), phase), 'utf8') }
|
|
1147
|
+
} catch {
|
|
1148
|
+
return null
|
|
1149
|
+
}
|
|
1150
|
+
},
|
|
1108
1151
|
// A spec this daemon cannot resolve is not a pass that was claimed — it is
|
|
1109
1152
|
// a lookup that could not see, so it says nothing rather than reporting the
|
|
1110
1153
|
// comfortable answer. Same rule the engine's own three states follow.
|
package/src/ideacmd.js
CHANGED
|
@@ -26,7 +26,7 @@ const { describeBaseBranch, baseRemote } = require('./env/resolve.js')
|
|
|
26
26
|
const { primaryAnchor } = require('./env/project.js')
|
|
27
27
|
|
|
28
28
|
const USAGE =
|
|
29
|
-
'Usage: skitterspec idea add <text> | list [--count] | drop <id> [--reason <why>] [--json] [--dir <path>]\n'
|
|
29
|
+
'Usage: skitterspec idea add <text> [--product <key>] | list [--count] | drop <id> [--reason <why>] [--json] [--dir <path>]\n'
|
|
30
30
|
|
|
31
31
|
function reader(cwd) {
|
|
32
32
|
return (argv) => {
|
|
@@ -56,7 +56,7 @@ function git(cwd, argv, { input, env } = {}) {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
function parseArgs(argv) {
|
|
59
|
-
const flags = { json: false, count: false, dir: null, reason: null }
|
|
59
|
+
const flags = { json: false, count: false, dir: null, reason: null, product: null }
|
|
60
60
|
const positional = []
|
|
61
61
|
for (let i = 0; i < argv.length; i++) {
|
|
62
62
|
const a = argv[i]
|
|
@@ -64,6 +64,7 @@ function parseArgs(argv) {
|
|
|
64
64
|
else if (a === '--count') flags.count = true
|
|
65
65
|
else if (a === '--dir') flags.dir = argv[++i]
|
|
66
66
|
else if (a === '--reason') flags.reason = argv[++i]
|
|
67
|
+
else if (a === '--product') flags.product = argv[++i]
|
|
67
68
|
else positional.push(a)
|
|
68
69
|
}
|
|
69
70
|
return { flags, positional }
|
|
@@ -208,6 +209,8 @@ async function fileStore(sub, positional, flags, { cwd, now, out }) {
|
|
|
208
209
|
`idea: ${verb} "${plan.id}" ${sub === 'add' ? 'to' : 'from'} ${ctx.rel} on ${ctx.base} (${commit.slice(0, 7)})`,
|
|
209
210
|
` title: ${plan.entry.title}`,
|
|
210
211
|
` pushed: no — ${push} publishes it`,
|
|
212
|
+
// The file has no products; say so rather than drop the flag in silence.
|
|
213
|
+
...(sub === 'add' && flags.product ? [` product: ${flags.product} not recorded — specs/ideas.md has no products`] : []),
|
|
211
214
|
],
|
|
212
215
|
)
|
|
213
216
|
return 0
|