@skitterbyte/skitterspec-github 3.1.3 → 3.2.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.
@@ -12,6 +12,10 @@ the day and plan the next one across projects.
12
12
  Mark it up and press a verdict. `/spec-next` waits for that press, and a phase
13
13
  that ended owes one before the next is built. A newly written spec's page
14
14
  offers `Commit & Start` (`commit-start`).
15
+ - **Or let it run**: `--auto` on `/spec-start` or `/spec-next` (or
16
+ `> **Run:** auto`, or `auto.default` in `env.config.json`) builds every
17
+ phase without stopping, keeps each phase's page, and ends as `--then` says:
18
+ `pause`, `push` or `pr`.
15
19
  - **Every skill ends with the same report block**: a verdict, a table, and
16
20
  `Next`.
17
21
  - **Guards**: work never happens in the primary checkout on the base branch,
@@ -55,6 +55,11 @@
55
55
  "projectName": "",
56
56
  "reviewers": []
57
57
  },
58
+ "auto": {
59
+ "default": "supervised",
60
+ "then": "pause",
61
+ "maxFixAttempts": 3
62
+ },
58
63
  "live": {
59
64
  "migrations": []
60
65
  }
@@ -5,7 +5,7 @@ stack + host dev servers + a front-door proxy per in-progress spec).
5
5
  Provisioning is folded into `/spec-start`, teardown into `/spec-complete` ·
6
6
  `/spec-cancel`, traffic diversion is `/spec-connect`, and reading a spec's diff
7
7
  is `/spec-diff`; the `skitterspec spec-env
8
- <up|bootstrap|nospec|main|project|down|prune|dev|connect|integrate|disposition|handoff|hotfix|live|review|stage|checks|status|resolve|resume|base>` CLI is
8
+ <up|bootstrap|nospec|main|project|down|prune|dev|connect|integrate|disposition|handoff|hotfix|live|review|stage|checks|status|resolve|resume|run|base>` CLI is
9
9
  the engine beneath them.
10
10
 
11
11
  **Once this file is present, isolation is the default policy:** `/spec-start` gives
@@ -436,6 +436,25 @@ through to a documented conservative default; see the field notes below.
436
436
  "deleteRemoteBranch": "prompt"
437
437
  },
438
438
 
439
+ // Autonomous runs (`spec-env run`, `/spec-next --auto`). A spec builds every
440
+ // phase to the end, committing each and keeping each phase's page as a
441
+ // snapshot, instead of stopping on every phase for a verdict.
442
+ // default: "supervised" (stop per phase, as always) or "auto". A spec's
443
+ // `> **Run:**` header overrides it, and `--auto` / `--supervised`
444
+ // on the command override both.
445
+ // then: how an autonomous run ends — "pause" (one final page that
446
+ // waits: Complete · Push branch · Open PR), "push" (push the
447
+ // branch) or "pr" (`/spec-complete`'s PR run). Setting push or pr
448
+ // here IS the push consent for runs that take it. `--then`
449
+ // overrides it.
450
+ // maxFixAttempts: tries at a red phase before the run stops and waits.
451
+ // An unrecognised value falls back to its default, never to "auto".
452
+ "auto": {
453
+ "default": "supervised",
454
+ "then": "pause",
455
+ "maxFixAttempts": 3
456
+ },
457
+
439
458
  // Live overlay (`spec-env live` / `/spec-live`): test a spec on the already-
440
459
  // running dev server by checking its branch out in the primary checkout.
441
460
  // `migrations` is a list of globs (`**`, `*`, `?`) marking migration files; a
@@ -0,0 +1,162 @@
1
+ #!/usr/bin/env node
2
+ 'use strict'
3
+
4
+ /**
5
+ * Run compaction — the harness half of feat-autonomous-run's context record.
6
+ *
7
+ * An autonomous run builds every phase in one session, and nothing lets the
8
+ * agent read its own context usage — so instead of a "pause at N%" that could
9
+ * not be built honestly, a compaction is made SAFE (each phase re-reads the
10
+ * spec and git) and VISIBLE: this `PreCompact` hook tells the engine, which
11
+ * notes it against the phase being built, and the run's final report says
12
+ * "compacted 2×, during phases 3 and 5".
13
+ *
14
+ * THIS SCRIPT DECIDES NOTHING, and it can never stop a compaction. It hands
15
+ * the session's directory to `spec-env run compacted`, which writes only when
16
+ * a run is active there and is silent on every cannot-tell. No engine, an
17
+ * unreadable payload, no run, a crash of its own — every path exits 0 and
18
+ * prints nothing, because a compaction hook that speaks or fails would be
19
+ * noise on every session that is not an autonomous run, which is nearly all
20
+ * of them.
21
+ */
22
+
23
+ const fs = require('node:fs')
24
+ const path = require('node:path')
25
+ const { spawnSync } = require('node:child_process')
26
+
27
+ function done() {
28
+ process.exit(0)
29
+ }
30
+
31
+ function readPayload() {
32
+ try {
33
+ const parsed = JSON.parse(fs.readFileSync(0, 'utf8'))
34
+ return parsed && typeof parsed === 'object' ? parsed : null
35
+ } catch {
36
+ return null
37
+ }
38
+ }
39
+
40
+ /**
41
+ * Where the engine is, in the order most likely to be right. Pure but for the
42
+ * existence check.
43
+ *
44
+ * A hook process does not inherit a package manager's `node_modules/.bin` on
45
+ * PATH, so the local install is looked for by path first — walking up from the
46
+ * project, because a git worktree's checkout has its own `node_modules`. PATH
47
+ * is the fallback for a global install, and `SKITTERSPEC_BIN` overrides
48
+ * everything for anyone whose layout is neither.
49
+ */
50
+ const ENGINES = ['skitterspec', 'skitterspec-linear', 'skitterspec-jira', 'skitterspec-github', 'skitterspec-azure-boards']
51
+
52
+ function findEngine(projectDir, platform = process.platform) {
53
+ return locateEngine(projectDir, platform).engine
54
+ }
55
+
56
+ /**
57
+ * `findEngine`, plus the directories it walked up from — which is what a hook
58
+ * names when nothing answered.
59
+ *
60
+ * A GIT WORKTREE IS A SIBLING OF ITS PRIMARY CHECKOUT, not a child of it
61
+ * (`worktree.root` is `../{repo}-wt`), so walking up from one never reaches the
62
+ * primary's `node_modules`. A `--docs` worktree has none of its own, so the
63
+ * primary checkout is asked for second — found through git, never guessed from
64
+ * the folder layout.
65
+ */
66
+ function locateEngine(projectDir, platform = process.platform) {
67
+ if (process.env.SKITTERSPEC_BIN) return { engine: process.env.SKITTERSPEC_BIN, tried: [] }
68
+ const tried = [projectDir]
69
+ const local = walkUp(projectDir, platform)
70
+ if (local) return { engine: local, tried }
71
+ const primary = primaryCheckoutDir(projectDir)
72
+ if (primary) {
73
+ tried.push(primary)
74
+ const found = walkUp(primary, platform)
75
+ if (found) return { engine: found, tried }
76
+ }
77
+ return { engine: 'skitterspec', tried }
78
+ }
79
+
80
+ /**
81
+ * Where `projectDir` sits in the checkout its worktree was added from, or null
82
+ * when it is not in a linked worktree.
83
+ *
84
+ * WHAT WOULD FOOL THIS: a git directory kept somewhere else
85
+ * (`--separate-git-dir`, a submodule's `.git/modules/<name>`). Its parent then
86
+ * holds no `node_modules`, so the lookup finds nothing and falls through to
87
+ * PATH exactly as it did before — a wasted look, never a wrong engine.
88
+ */
89
+ function primaryCheckoutDir(projectDir) {
90
+ const r = spawnSync('git', ['rev-parse', '--show-toplevel', '--git-common-dir'], {
91
+ cwd: projectDir,
92
+ encoding: 'utf8',
93
+ timeout: 2000,
94
+ })
95
+ if (r.error || r.status !== 0) return null
96
+ const [top, common] = (r.stdout || '').split(/\r?\n/)
97
+ if (!top || !common) return null
98
+ const primary = path.dirname(path.resolve(projectDir, common))
99
+ if (path.resolve(primary) === path.resolve(top)) return null
100
+ // A project in a subfolder of its repo has the same subfolder in the primary.
101
+ // A path that will not map (a symlinked spelling of the same tree) is asked
102
+ // about at the primary's root instead.
103
+ const rel = path.relative(top, projectDir)
104
+ return rel && !rel.startsWith('..') && !path.isAbsolute(rel) ? path.join(primary, rel) : primary
105
+ }
106
+
107
+ function walkUp(start, platform) {
108
+ let at = start
109
+ for (let i = 0; i < 6 && at; i++) {
110
+ for (const name of ENGINES) {
111
+ // ON WINDOWS, THE PACKAGE'S OWN JS ENTRY, never `.bin/<name>`. That is a
112
+ // shell shim nothing here can execute (spawn refuses it: EFTYPE), and the
113
+ // `.cmd` beside it needs a shell — which a hook handing a tool's command
114
+ // line over as an argument must never use. Unreachable, the hook failed
115
+ // open, and every guard was silently off on Windows (chore-windows-ci).
116
+ const candidate =
117
+ platform === 'win32'
118
+ ? path.join(at, 'node_modules', '@skitterbyte', name, 'bin', `${name}.js`)
119
+ : path.join(at, 'node_modules', '.bin', name)
120
+ if (fs.existsSync(candidate)) return candidate
121
+ }
122
+ const up = path.dirname(at)
123
+ if (up === at) break
124
+ at = up
125
+ }
126
+ return null
127
+ }
128
+
129
+ // How to run what `findEngine` found: a `.js` engine through this node, since
130
+ // Windows cannot execute one directly — anything else as itself, as before.
131
+ function engineCommand(projectDir, platform = process.platform) {
132
+ const { engine, tried } = locateEngine(projectDir, platform)
133
+ const command = /\.[cm]?js$/i.test(engine) ? { file: process.execPath, args: [engine] } : { file: engine, args: [] }
134
+ return Object.defineProperty(command, 'tried', { value: tried })
135
+ }
136
+
137
+ function main() {
138
+ const payload = readPayload()
139
+ if (!payload) done()
140
+ // Only a compaction. A hook reached on some other event stays inert.
141
+ if (payload.hook_event_name && payload.hook_event_name !== 'PreCompact') done()
142
+ const cwd = typeof payload.cwd === 'string' && payload.cwd ? payload.cwd : process.cwd()
143
+ const engine = engineCommand(cwd)
144
+ // Output discarded on purpose: the record is the engine's, and the session
145
+ // that is compacting has nothing to act on.
146
+ spawnSync(engine.file, [...engine.args, 'spec-env', 'run', 'compacted', '--dir', cwd], {
147
+ cwd,
148
+ encoding: 'utf8',
149
+ timeout: 8000,
150
+ })
151
+ done()
152
+ }
153
+
154
+ if (require.main === module) {
155
+ try {
156
+ main()
157
+ } catch {
158
+ done()
159
+ }
160
+ }
161
+
162
+ module.exports = { findEngine, locateEngine, engineCommand }
@@ -315,6 +315,24 @@ tr.band button { font-size: .72rem; padding: .1rem .5rem; margin-right: .3rem; }
315
315
  margin: 0 0 1rem;
316
316
  }
317
317
  .review-summary { margin: 0; }
318
+ /* The phase report — the terminal block's table, kept on the page. */
319
+ .report {
320
+ border: 1px solid var(--line);
321
+ border-radius: 10px;
322
+ background: var(--panel);
323
+ padding: .8rem 1rem;
324
+ margin: 0 0 1rem;
325
+ }
326
+ .report-heading { margin: 0 0 .4rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
327
+ .report-title { margin: 0 0 .6rem; }
328
+ .report-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
329
+ .report-table th { text-align: left; vertical-align: top; white-space: nowrap; padding: .3rem .8rem .3rem 0; color: var(--muted); font-weight: 600; }
330
+ .report-table td { padding: .3rem 0; overflow-wrap: anywhere; }
331
+ .report-table tr + tr { border-top: 1px solid var(--line); }
332
+ /* The final page's aggregate: every phase's follow-ups and notes, in order. */
333
+ .run-items { margin: 0 0 .6rem; padding-left: 1.1rem; font-size: .88rem; }
334
+ .run-items li { margin: .2rem 0; overflow-wrap: anywhere; }
335
+ .run-phase { color: var(--muted); font-size: .8rem; margin-right: .3rem; }
318
336
  .checks { list-style: none; margin: .8rem 0 0; padding: 0; display: grid; gap: .4rem; }
319
337
  .check {
320
338
  display: grid;
@@ -692,6 +710,13 @@ button:disabled:hover { color: var(--muted); border-color: var(--line); }
692
710
  /* The disclosure is a CONTROL, not a panel. Full-width and boxed, it read as a
693
711
  section header that happened to be clickable. */
694
712
  .context-more { margin: .9rem 0 0; }
713
+ /* How far through the spec this is: a line, then a thin bar for phases done.
714
+ Theme tokens only, so it follows light and dark; the width is the bar's
715
+ container's, so it narrows with the page on a phone. */
716
+ .progress { margin: .35rem 0 .6rem; max-width: 28rem; }
717
+ .progress-text { font-size: .85rem; color: var(--muted); }
718
+ .progress-track { height: 4px; margin-top: .3rem; border-radius: 999px; background: var(--line); overflow: hidden; }
719
+ .progress-fill { height: 100%; border-radius: 999px; background: var(--accent); }
695
720
  .context-more > summary {
696
721
  display: inline-block;
697
722
  width: auto;
@@ -718,6 +743,13 @@ button:disabled:hover { color: var(--muted); border-color: var(--line); }
718
743
  white-space: nowrap;
719
744
  }
720
745
  a.ticket:hover { border-color: var(--accent); }
746
+ /* The product shares the title line with the ticket: one tracker project can
747
+ hold several, and the reader needs to know whose work this is. */
748
+ .product {
749
+ font-size: .62em; font-weight: 600; vertical-align: middle;
750
+ color: var(--muted); padding: .12em .45em; border: 1px dashed var(--line);
751
+ border-radius: 999px; white-space: nowrap;
752
+ }
721
753
  .context-more > summary { cursor: pointer; color: var(--muted); font-size: .85rem; margin-top: .6rem; }
722
754
  .copy-hint { font-size: .8rem; color: var(--muted); margin: .4rem 0 0; }
723
755
  .sent-cmd { display: flex; gap: .4rem; align-items: stretch; margin: .4rem 0 0; }
@@ -837,6 +869,7 @@ a.ticket:hover { border-color: var(--accent); }
837
869
  <p class="eyebrow" id="project" hidden></p>
838
870
  <h1 id="title"></h1>
839
871
  <p class="sub" id="sub"></p>
872
+ <div class="progress" id="progress" hidden></div>
840
873
  <div class="controls">
841
874
  <button id="expand-all" type="button">Show all context</button>
842
875
  <button id="collapse-all" type="button">Collapse context</button>
@@ -949,6 +982,12 @@ a.ticket:hover { border-color: var(--accent); }
949
982
  context-dependent reading of "Commit", because one of those two
950
983
  readings destroys a worktree. -->
951
984
  <button id="verdict-commit-land" class="v-commit" type="button" hidden>&#10003; Commit &amp; Land</button>
985
+ <!-- THE FINAL PAGE'S ENDINGS (feat-autonomous-run), hidden unless the
986
+ render asked for the `final` set. Every phase is already committed,
987
+ so each names what happens to the finished branch. -->
988
+ <button id="verdict-complete" class="v-commit" type="button" hidden>&#10003; Complete</button>
989
+ <button id="verdict-push" class="v-commit" type="button" hidden>&#8593; Push branch</button>
990
+ <button id="verdict-pr" class="v-commit" type="button" hidden>&#8593; Open PR</button>
952
991
  <button id="verdict-changes" class="v-changes" type="button">↺ Request changes</button>
953
992
  <button id="verdict-discuss" type="button">… Discuss first</button>
954
993
  <span class="verdict-count" id="verdict-count" aria-live="polite"></span>
@@ -1920,6 +1959,9 @@ a.ticket:hover { border-color: var(--accent); }
1920
1959
  'commit-continue': document.getElementById('verdict-commit-continue'),
1921
1960
  'commit-start': document.getElementById('verdict-commit-start'),
1922
1961
  'commit-land': document.getElementById('verdict-commit-land'),
1962
+ complete: document.getElementById('verdict-complete'),
1963
+ push: document.getElementById('verdict-push'),
1964
+ pr: document.getElementById('verdict-pr'),
1923
1965
  continue: document.getElementById('verdict-continue'),
1924
1966
  changes: document.getElementById('verdict-changes'),
1925
1967
  discuss: document.getElementById('verdict-discuss'),
@@ -1927,7 +1969,7 @@ a.ticket:hover { border-color: var(--accent); }
1927
1969
  // The committing pair, named once. A fifth verdict that commits is added
1928
1970
  // here, and the shared block below follows for free — the same reason the
1929
1971
  // engine keeps a `COMMITTING` list rather than a second condition.
1930
- var COMMITTERS = ['commit', 'commit-continue', 'commit-start', 'commit-land']
1972
+ var COMMITTERS = ['commit', 'commit-continue', 'commit-start', 'commit-land', 'complete', 'push', 'pr']
1931
1973
 
1932
1974
  /*
1933
1975
  * WHICH BUTTONS THIS PAGE OFFERS, and it comes from the render rather than
@@ -1955,11 +1997,25 @@ a.ticket:hover { border-color: var(--accent); }
1955
1997
  // because `Commit & Continue` names a next phase a spec with no phase files
1956
1998
  // does not have. Same three buttons as `refresh`, a different subject.
1957
1999
  fix: ['commit', 'changes', 'discuss'],
2000
+ // A KEPT PHASE of an autonomous run: the run committed it and carried on,
2001
+ // so there is nothing to decide here — it is read, not answered.
2002
+ snapshot: [],
2003
+ // THE PAGE AN AUTONOMOUS RUN ENDS ON: every phase committed, so the
2004
+ // choice left is what happens to the branch.
2005
+ final: ['complete', 'push', 'pr', 'changes', 'discuss'],
1958
2006
  }
1959
2007
  var OFFERED = OFFERS[data.buttons] || OFFERS.committing
1960
2008
  Object.keys(verdictBtns).forEach(function (key) {
1961
- verdictBtns[key].hidden = OFFERED.indexOf(key) === -1
2009
+ // A button the markup lacks is skipped, not a crash: an older or trimmed
2010
+ // template must still get a working page.
2011
+ if (verdictBtns[key]) verdictBtns[key].hidden = OFFERED.indexOf(key) === -1
1962
2012
  })
2013
+ // NOTHING TO ANSWER, so no bar at all: a kept phase page offers no verdict,
2014
+ // and an empty bar would read as a page that forgot its buttons.
2015
+ if (!OFFERED.length) {
2016
+ var bar = document.getElementById('verdict')
2017
+ if (bar) bar.hidden = true
2018
+ }
1963
2019
 
1964
2020
  // EVERY VERDICT, because this is the one place a verdict gets a reader-facing
1965
2021
  // name: `refresh` relabels only the committing pair, but the decided panel
@@ -1971,6 +2027,9 @@ a.ticket:hover { border-color: var(--accent); }
1971
2027
  'commit-continue': '✓ Commit & Continue',
1972
2028
  'commit-start': '✓ Commit & Start',
1973
2029
  'commit-land': '✓ Commit & Land',
2030
+ complete: '✓ Complete',
2031
+ push: '↑ Push branch',
2032
+ pr: '↑ Open PR',
1974
2033
  continue: '→ Continue',
1975
2034
  changes: '↺ Request changes',
1976
2035
  discuss: '… Discuss first',
@@ -1990,6 +2049,9 @@ a.ticket:hover { border-color: var(--accent); }
1990
2049
  // Says what it will NOT do, for the same reason: nothing is committed by
1991
2050
  // this, so the work it resumes is still uncommitted afterwards.
1992
2051
  continue: 'You have read it — carry on with the run; nothing is committed',
2052
+ complete: 'Finish the spec: verify, land on the base branch, and remove the worktree',
2053
+ push: 'Push the branch to the remote and stop; the spec stays in flight',
2054
+ pr: 'Push the branch and open a pull request listing each phase',
1993
2055
  }
1994
2056
 
1995
2057
  var verdictEl = document.getElementById('verdict')
@@ -2282,6 +2344,10 @@ a.ticket:hover { border-color: var(--accent); }
2282
2344
  'commit-continue': 'committed, then carried on',
2283
2345
  'commit-start': 'committed, then put in flight',
2284
2346
  'commit-land': 'committed, landed, and torn down',
2347
+ complete: 'completed',
2348
+ push: 'pushed',
2349
+ pr: 'opened as a PR',
2350
+ 'auto-commit': 'committed by the autonomous run',
2285
2351
  continue: 'read it and carried on',
2286
2352
  changes: 'changes requested',
2287
2353
  discuss: 'discussed',
@@ -3273,6 +3339,17 @@ a.ticket:hover { border-color: var(--accent); }
3273
3339
  titleEl.appendChild(document.createTextNode(' '))
3274
3340
  titleEl.appendChild(node)
3275
3341
  })()
3342
+ // The spec's product, beside the ticket. textContent: it comes from a spec file.
3343
+ ;(function () {
3344
+ var product = data.context && data.context.product
3345
+ if (!product) return
3346
+ var node = document.createElement('span')
3347
+ node.className = 'product'
3348
+ node.title = 'Product'
3349
+ node.textContent = product
3350
+ titleEl.appendChild(document.createTextNode(' '))
3351
+ titleEl.appendChild(node)
3352
+ })()
3276
3353
 
3277
3354
  /**
3278
3355
  * An ISO timestamp is a machine's format. The header showed
@@ -3293,6 +3370,49 @@ a.ticket:hover { border-color: var(--accent); }
3293
3370
  return iso
3294
3371
  }
3295
3372
  }
3373
+ /**
3374
+ * How far through the spec this page is, under the title: which phase out of
3375
+ * how many and that phase's ticked tasks, and a bar for phases done. Read off
3376
+ * `data.phases`, which the engine already sends.
3377
+ *
3378
+ * NOTHING when there are no phases to count — a legacy or single-pass spec
3379
+ * (`phases` null) or an epic (`total` 0). "0 of 0" would be the page
3380
+ * inventing progress for work that is not measured in phases.
3381
+ */
3382
+ ;(function () {
3383
+ var ph = data.phases
3384
+ if (!ph || !(ph.total > 0)) return
3385
+ var live = ph.live
3386
+ var text
3387
+ if (ph.done >= ph.total) {
3388
+ text = ph.total + ' of ' + ph.total + ' phases done'
3389
+ } else if (live && live.n) {
3390
+ text = 'Phase ' + live.n + ' of ' + ph.total
3391
+ var tasks = Array.isArray(live.tasks) ? live.tasks : []
3392
+ if (tasks.length) {
3393
+ var ticked = tasks.filter(function (k) { return k && k.done }).length
3394
+ text += ' \u00b7 ' + ticked + '/' + tasks.length + ' tasks'
3395
+ }
3396
+ } else if (!ph.done) {
3397
+ text = ph.total + ' phases \u00b7 none started'
3398
+ } else {
3399
+ text = ph.done + ' of ' + ph.total + ' phases done'
3400
+ }
3401
+ var box = document.getElementById('progress')
3402
+ box.appendChild(el('div', 'progress-text', text))
3403
+ var track = el('div', 'progress-track')
3404
+ var fill = el('div', 'progress-fill')
3405
+ var pct = Math.round((Math.min(ph.done, ph.total) / ph.total) * 100)
3406
+ fill.style.setProperty('width', pct + '%')
3407
+ track.setAttribute('role', 'progressbar')
3408
+ track.setAttribute('aria-valuemin', '0')
3409
+ track.setAttribute('aria-valuemax', String(ph.total))
3410
+ track.setAttribute('aria-valuenow', String(Math.min(ph.done, ph.total)))
3411
+ track.appendChild(fill)
3412
+ box.appendChild(track)
3413
+ box.hidden = false
3414
+ })()
3415
+
3296
3416
  var t = data.totals
3297
3417
  var sub = document.getElementById('sub')
3298
3418
  function part(text, cls) { sub.appendChild(el('span', cls, text)) }
@@ -75,6 +75,12 @@ Each spec has one of seven kinds, recorded twice: in the header
75
75
  the base branch.
76
76
  - `> **Lanes:**`: on an epic, optional: how many members may be in flight at
77
77
  once.
78
+ - `> **Product:**`: optional: the product the spec belongs to, where one
79
+ tracker project holds several. A key from the provider's config, which
80
+ decides what it means there (Azure Boards: `azure.products` maps it to an
81
+ area path).
82
+ - `> **Run:**`: optional: `auto` or `supervised`, only where the spec differs
83
+ from `auto.default` in `env.config.json`. A flag on the command overrides it.
78
84
  - `> **Blocked on:**`: on a spec or a phase file: a wait outside the repo, in
79
85
  free text, optionally with `(until YYYY-MM-DD)`. Only a person can judge it
80
86
  met. `/spec-resume` clears it.
@@ -95,6 +95,15 @@ Read it when a skill sends you there.
95
95
  `git commit` takes whatever someone else staged. `skitterspec spec-env stage`
96
96
  splits the tree into this spec's documents and everything else.
97
97
 
98
+ ## Autonomous runs
99
+
100
+ A spec can build every phase without stopping for a verdict: `--auto` on
101
+ `/spec-start` or `/spec-next`, a `> **Run:** auto` header, or `auto.default`
102
+ in `env.config.json`. Each phase is committed and its page kept as a snapshot.
103
+ The run stops for red tests, a blocker, manual steps or an open decision, and
104
+ ends as `auto.then` (or `--then`) says: `pause`, `push` or `pr`. The loop is
105
+ in `.claude/skills/spec-next/autonomous.md`.
106
+
98
107
  ## Ticketing provider (when one is installed)
99
108
 
100
109
  The repo owns each spec's **content**. The tracker is a one-way generated
@@ -41,6 +41,11 @@ row:
41
41
  waiting on a verdict. The banner, its tier stack and the wait are defined in
42
42
  `.claude/skills/spec-diff/review-wait.md`. Read it before rendering one.
43
43
 
44
+ **An autonomous run reports once**, at its end or its stop, not per phase:
45
+ each phase's rows are already on its snapshot. Ending on `pause`, its banner's
46
+ exits are `Complete` lands it · `Push branch` · `Open PR` · `Request changes`
47
+ works them.
48
+
44
49
  **Asking implies waiting.** A render that asks the reader for a verdict ends the
45
50
  turn waiting for one, under the banner. A run that is not going to wait does not
46
51
  ask: it reports the page in a `Review` row with the counts and the link, and no
@@ -232,7 +232,15 @@ not write the spec until this is resolved.
232
232
  before building that phase, and `/spec-resume` is how it goes on. This
233
233
  is free text, a condition only a person can judge, which is what sets it
234
234
  apart from an epic member's `Waits on:`. With no such wait, write none.
235
- 12. **Open questions** — anything still undecided.
235
+ 12. **Run mode** *(only when `specs/.core/env.config.json` exists)*: should
236
+ this spec build autonomously, every phase committed with no stop for
237
+ review, or stop on every phase's page? Offer the project's `auto.default`
238
+ (supervised when unset) and ask only whether this spec differs. A
239
+ difference is written as `> **Run:** auto` or `> **Run:** supervised`.
240
+ Matching the default writes no line, so the config keeps deciding.
241
+ Recommend `supervised` for anything that touches data, auth or a public
242
+ surface.
243
+ 13. **Open questions** — anything still undecided.
236
244
 
237
245
  Stop grilling when there are no unresolved branches that would change the spec.
238
246
  Briefly play back the agreed understanding before writing.
@@ -426,6 +434,8 @@ the codebase, link rather than duplicate):
426
434
  > **Area:** <comma-separated files/modules this touches>
427
435
  > **Stack:** <worktree — or "worktree + docker" if it touches the DB/stateful
428
436
  > services; only acted on when isolation is enabled — see Phase A item 9>
437
+ > **Run:** <auto or supervised — only when it differs from the project's
438
+ > `auto.default` (Phase A item 12). Omit the line entirely otherwise>
429
439
  > **Incident:** <incident-<name> — only when this spec is a fix for an open
430
440
  > incident spec; the next push links the two as related on the tracker, and
431
441
  > `/spec-complete` on the incident counts this spec among its fixes. Omit the
@@ -521,10 +521,19 @@ person happens before the ready, in this order:
521
521
  merge?"* — the base branch is named so a spec that outlived a release roll
522
522
  is caught by the person reading a stale rc name. On a no, stop with the
523
523
  held commands relayed.
524
+ **An autonomous run that ends on `pr` has already consented**: the
525
+ operator named `pr` by flag, config or the final page's `Open PR` button.
526
+ Say the target in the report's `Landed` row instead of asking.
524
527
  3. **Run the plan.** `skitterspec spec-env integrate <name> --push` and run
525
528
  what it prints: fetch, rebase onto `<remote>/<base>`, the push, and the PR
526
529
  create — or, where a draft already exists, the flip-to-ready. A rebase
527
530
  conflict aborts and stops exactly as 6-feature/bug step 2.
531
+ **Where `skitterspec spec-env run status <name> --json` returns a record**,
532
+ the spec was built by an autonomous run. Add one line per phase to the PR
533
+ body: the phase number, its title from the phase index, and its commit from
534
+ the record. Use the host's PR-edit command (`gh pr edit <n> --body-file`,
535
+ or `az repos pr update --description`). The PR's commit list is already one
536
+ commit per phase, and this names them.
528
537
  4. **Defer the finalise.** §4's bucket move follows the spec documents'
529
538
  `land.specDocs` lane: under `trunk` leave the spec in `specs/in-progress/`
530
539
  — run 2 moves it on base after the merge; under `branch` commit the move on
@@ -356,6 +356,30 @@ it — and the paste was the one place it broke. The *work* either authorises is
356
356
  ordinary phase-sized cost, and step 3 is where the operator decides whether to
357
357
  spend it.
358
358
 
359
+ ### `complete`, `push`, `pr` — the final page of an autonomous run
360
+
361
+ These come only from the page an autonomous run ends on under `pause`
362
+ (`spec-next/autonomous.md`). Every phase is already committed, so there is
363
+ nothing to hand to `review.commitWith`. Each verdict names what happens to the
364
+ branch, and each one ends the run with
365
+ `skitterspec spec-env run end <spec> --outcome <verdict>` once it has acted:
366
+
367
+ - **`complete`**: carry on into **`/spec-complete`**, which verifies, lands
368
+ and tears down exactly as if typed.
369
+ - **`push`**: `skitterspec spec-env integrate <spec> --push`, and run what it
370
+ plans. The press is the push consent. The spec stays in flight.
371
+ - **`pr`**: carry on into **`/spec-complete`** under PR landing
372
+ (`--strategy pr` where `land.strategy` is not already `pr`). Its PR body lists
373
+ each phase with its commit.
374
+
375
+ A failure stops there, exactly as a failed commit ends `commit-continue`. Say
376
+ where it broke, and leave the run active so the page can be answered again.
377
+
378
+ **`commit-continue` on a phase where an autonomous run stopped resumes the run.**
379
+ `/spec-next` resolves the run record first, so it carries on in the
380
+ run's own mode and ending with nothing passed. That is the stop condition being
381
+ answered, not a new run.
382
+
359
383
  ## 2b. An action changes something, then hands the page back
360
384
 
361
385
  Only on a pass carrying an **action**. Two of them, and
@@ -55,6 +55,12 @@ line becomes the title and the rest becomes the body:
55
55
  skitterspec idea add "<text>" --json
56
56
  ```
57
57
 
58
+ When the reader names the product the idea belongs to, add
59
+ `--product <key>`. A tracker that files by product (Azure Boards'
60
+ `azure.products`) puts the idea in that product's area; the file store notes
61
+ it and records nothing. Never ask for one unprompted, because an idea is meant
62
+ to cost one step.
63
+
58
64
  **Never push.** On the file store the engine commits onto the base branch and
59
65
  prints the push instead of running it, because a push publishes the base
60
66
  branch and that is always the operator's call.
@@ -16,6 +16,15 @@ flight — provisioning, moving it to `in-progress`, getting its branch here —
16
16
  `/spec-start`'s job. Re-run this per phase until the spec is done, then
17
17
  `/spec-complete`.
18
18
 
19
+ **Or let it run.** `--auto`, `--supervised` and `--then pause|push|pr` choose
20
+ whether this run stops on every phase's page or builds every phase to the
21
+ end. Once §1 has named the spec, ask the engine
22
+ (`skitterspec spec-env run resolve <spec> … --json`, passing only the flags
23
+ typed). On `mode: "auto"`, follow
24
+ [`autonomous.md`](autonomous.md) for the whole run. It reuses §2 to §4b
25
+ unchanged and replaces §5 and §6. On `supervised`, the default everywhere
26
+ nothing says otherwise, this file applies exactly as written.
27
+
19
28
  ## 1. Identify the spec in flight
20
29
 
21
30
  **`--worktree <path>` answers before anything else.** When the invocation names a
@@ -460,9 +469,17 @@ the moment the page is about, so render it now — **after** the tests pass and
460
469
  **before** the commit:
461
470
 
462
471
  ```
463
- skitterspec spec-env review <spec> --run-reviewers
472
+ skitterspec spec-env review <spec> --run-reviewers --report <rows.json> --phase <n>
464
473
  ```
465
474
 
475
+ **`--report` puts this phase's report table on the page**, so its Notes and
476
+ Follow-ups are there for anyone who reads the page later, not only in this
477
+ terminal. Write the rows of the block §6 will end with, as JSON in a scratch
478
+ file: `{"title": "<verdict sentence>", "rows": [{"field": "Built", "value":
479
+ "…"}, …]}`, leaving out `Next` and `Review`, which only make sense here. An
480
+ empty `field` continues the row above. The engine orders, escapes and keeps
481
+ them per phase, and a bad file is reported and skipped, never a failed render.
482
+
466
483
  **This is free.** It is the engine reading git and splicing text into a template;
467
484
  the diff never passes through you, so a 266KB patch costs nothing. Report the
468
485
  path it prints and move on.