@skitterbyte/skitterspec-github 1.3.0 → 2.0.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.
@@ -45,7 +45,7 @@ In a project that installs the GitHub superset the binary is
45
45
  | "link this spec to #1 by hand" | `stamp <spec> --issue #1` |
46
46
  | "mirror the whole backlog / every complete spec" | `apply --all <bucket>` — **confirm first** |
47
47
  | "what ticket am I on?", writing a commit | `ref` |
48
- | "what shipped in this release?" | `released` |
48
+ | "what shipped in this release?", "which issues does CI mark deployed?" | `released` — `--json` for a script; recording deploys is the project's own |
49
49
  | "is any of this wired up?", "why isn't sync working?" | `doctor` — scaffold, isolation, tracker and credentials in one |
50
50
  | "set my GitHub credentials", "am I authenticated?" | `credentials <status\|set\|unset>` |
51
51
  | push one spec, or "what would push?" | **defer** — see below |
@@ -68,7 +68,7 @@ Two front doors to one write path is worse than none:
68
68
 
69
69
  - **Push one spec** → `/spec-push`. It owns the transport choice, the
70
70
  status-name gate, the plan, the apply, the stamping and the snapshot.
71
- - **Per-spec drift** ("is this spec in sync?", "what would push?") →
71
+ - **Per-spec status** ("is this spec in sync?", "what would push?") →
72
72
  `/spec-status`.
73
73
 
74
74
  Say which skill you're handing to and stop; don't reimplement either.
@@ -178,8 +178,10 @@ and never write `Refs: none`.
178
178
 
179
179
  `released` reports the tickets in a commit range — by default since the most
180
180
  recent tag, and it always prints the range it chose so a wrong default is
181
- visible. It is **read-only**: it does not move anything in GitHub. A release can
182
- be cut and never deployed, so moving a Status stays a deliberate act.
181
+ visible. It is **read-only**: it does not move anything in GitHub. Each issue
182
+ row names the `spec` and `url` behind it (`null` when no spec linked the ref),
183
+ so `--json` is what a project's CI pipes into its own tooling to record a
184
+ release or a deploy. Recording those is the project's job, not skitterspec's.
183
185
 
184
186
  Relay the **unreferenced count** even when it is zero. A chore commit
185
187
  legitimately carries no ticket and a *missed* trailer looks identical, so
@@ -193,30 +195,12 @@ A commit whose changed paths are **all** under `release.ignorePaths` (default
193
195
  file still counts. Relay the **ignored count** whenever it is non-zero — that is
194
196
  the report saying which commits it set aside.
195
197
 
196
- ## 7b. `release` — mirror what shipped onto GitHub Releases and the board
198
+ ## 7b. `release` is retired
197
199
 
198
- ```
199
- pnpm exec skitterspec-github spec-sync release create <tag> --stage <env> [--apply]
200
- pnpm exec skitterspec-github spec-sync release deployed <tag> <env> [--apply]
201
- pnpm exec skitterspec-github spec-sync release complete <tag> [--apply]
202
- pnpm exec skitterspec-github spec-sync release reconcile [--apply] [--json]
203
- ```
204
-
205
- These need `releases.series` in the config — `github.config.md` → "Releases"
206
- carries the field reference and semantics. Every verb is a **dry run without
207
- `--apply`**, so relay the plan rather than re-deriving it. `create` mints a
208
- prerelease listing the tag's tickets, `deployed` sets the board's Deployed
209
- option on them, `complete` clears the prerelease flag. They are CI's verbs
210
- first — run by the host project's pipeline on a tag — and re-run by hand to
211
- repair the mirror.
212
-
213
- `reconcile` is the self-healing one: it probes the npm registry for each
214
- series' live versions and moves every marked release that shipped — including
215
- one superseded by a newer live version — to the series' final env, backfilling
216
- a release for a pushed tag that never got one. It is schedule-friendly: a
217
- version the registry lacks is "not yet" and exits 0, so relay its per-release
218
- lines verbatim and never read a `kept` as a failure. It refuses over MCP and on
219
- a shallow clone, exactly as `create` does.
200
+ `spec-sync release` exits 1 naming `released --json`. Recording a release or a
201
+ deploy is the host project's job: point the user at `released --json` (§7) and
202
+ `github.config.md` → "Releases and deploys". Do not re-create the old verbs out
203
+ of `gh` calls on their behalf.
220
204
 
221
205
  ## 8. Report
222
206
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skitterbyte/skitterspec-github",
3
- "version": "1.3.0",
3
+ "version": "2.0.0",
4
4
  "description": "Spec-driven development for Claude Code, with one-way GitHub sync — a superset of @skitterbyte/skitterspec: the base filesystem workflow plus /spec-status · /spec-push · /spec-claim and the spec-sync CLI, mirroring specs to GitHub Issues, sub-issues and a Projects v2 board, with GitHub Releases. The repo is canonical; GitHub is a generated mirror. Install this OR the base OR one other superset — exactly one.",
5
5
  "keywords": [
6
6
  "claude",
@@ -160,6 +160,7 @@ query($q: String!, $status: String!, $after: String) {
160
160
  number title url state
161
161
  repository { nameWithOwner }
162
162
  parent { number }
163
+ assignees(first: 10) { nodes { login name } }
163
164
  projectItems(first: 20) {
164
165
  nodes {
165
166
  id
@@ -172,6 +173,20 @@ query($q: String!, $status: String!, $after: String) {
172
173
  }
173
174
  }`
174
175
 
176
+ // The board's items in its own order — what a person drags on the board.
177
+ // Only the position is wanted here; state and title come from `listBoardItems`.
178
+ const BOARD_ORDER = `
179
+ query($id: ID!, $after: String) {
180
+ node(id: $id) {
181
+ ... on ProjectV2 {
182
+ items(first: 100, after: $after, orderBy: { field: POSITION, direction: ASC }) {
183
+ pageInfo { hasNextPage endCursor }
184
+ nodes { content { ... on Issue { number repository { nameWithOwner } } } }
185
+ }
186
+ }
187
+ }
188
+ }`
189
+
175
190
  const ADD_ITEM = `
176
191
  mutation($project: ID!, $content: ID!) {
177
192
  addProjectV2ItemById(input: { projectId: $project, contentId: $content }) { item { id } }
@@ -195,7 +210,6 @@ function makeApiAdapter({
195
210
  repo,
196
211
  project,
197
212
  statusField = 'Status',
198
- deployedField = 'Deployed',
199
213
  token,
200
214
  apiUrl = API_URL,
201
215
  fetch: fetchImpl,
@@ -377,11 +391,6 @@ function makeApiAdapter({
377
391
 
378
392
  let boardCache = null
379
393
 
380
- const releaseOf = (raw) =>
381
- raw && raw.id != null
382
- ? { id: raw.id, tag: raw.tag_name, url: raw.html_url || null, body: raw.body == null ? '' : String(raw.body), prerelease: !!raw.prerelease }
383
- : null
384
-
385
394
  async function resolveBoard() {
386
395
  if (boardCache) return boardCache
387
396
  if (!project) {
@@ -435,6 +444,25 @@ function makeApiAdapter({
435
444
  return { board, field, option }
436
445
  }
437
446
 
447
+ // The one add refusal that means "it is there already". Matched on GitHub's
448
+ // message, because the error carries no type of its own for this case.
449
+ const alreadyOnBoard = (error) =>
450
+ Boolean(error && Array.isArray(error.errors) && error.errors.some((e) => e && /already exists in this project/i.test(e.message || '')))
451
+
452
+ const pause = sleep || ((ms) => new Promise((resolve) => setTimeout(resolve, ms)))
453
+
454
+ // Read the issue until its board item shows, briefly: the auto-add that beat
455
+ // us has written it, but the read side may not show it on the first ask.
456
+ // Null when it never appears.
457
+ async function awaitBoardItem(issue, delays = [0, 500, 1500, 3000]) {
458
+ for (const ms of delays) {
459
+ if (ms) await pause(ms)
460
+ const fresh = await adapter.readIssue(issue.number != null ? issue.number : issue.identifier)
461
+ if (fresh && fresh.boardItemId) return fresh.boardItemId
462
+ }
463
+ return null
464
+ }
465
+
438
466
  async function readRaw(ref) {
439
467
  const data = await graphql(ISSUE_QUERY, { owner, repo, number: numberOf(ref), status: statusField }, { allowMissing: true })
440
468
  return (data.repository && data.repository.issue) || null
@@ -534,9 +562,16 @@ function makeApiAdapter({
534
562
  * ago may be missing from one listing. A listing is a convenience; nothing
535
563
  * decides on it.
536
564
  */
537
- async listBoardItems({ label = '' } = {}) {
565
+ // `assignee` narrows the search to one login — and is how `list --mine`
566
+ // reaches issues no spec has adopted yet, which carry no spec label.
567
+ async listBoardItems({ label = '', assignee = null } = {}) {
538
568
  if (!project) throw new GitHubRefusal('no board configured — set github.project to the board number from its URL')
539
- const q = [`repo:${owner}/${repo}`, 'is:issue', label ? `label:"${String(label).replace(/"/g, '')}"` : null].filter(Boolean).join(' ')
569
+ const q = [
570
+ `repo:${owner}/${repo}`,
571
+ 'is:issue',
572
+ label ? `label:"${String(label).replace(/"/g, '')}"` : null,
573
+ assignee ? `assignee:${String(assignee).replace(/[^A-Za-z0-9-]/g, '')}` : null,
574
+ ].filter(Boolean).join(' ')
540
575
  const out = []
541
576
  let after = null
542
577
  for (let page = 0; page < MAX_PAGES; page++) {
@@ -555,6 +590,9 @@ function makeApiAdapter({
555
590
  open: c.state === 'OPEN',
556
591
  state: item.fieldValueByName && item.fieldValueByName.name != null ? { name: item.fieldValueByName.name } : null,
557
592
  parent: c.parent && c.parent.number != null ? { id: String(c.parent.number), identifier: identifierOf(c.parent.number) } : null,
593
+ assignees: ((c.assignees && c.assignees.nodes) || [])
594
+ .filter((a) => a && a.login)
595
+ .map((a) => ({ id: a.login, name: a.name || a.login })),
558
596
  })
559
597
  }
560
598
  if (!res.pageInfo || !res.pageInfo.hasNextPage) break
@@ -563,6 +601,29 @@ function makeApiAdapter({
563
601
  return out.sort((a, b) => Number(a.id) - Number(b.id))
564
602
  },
565
603
 
604
+ /**
605
+ * This repo's issue numbers in board order (`list --next`). Pages like
606
+ * `listBoardItems`, under the same cap.
607
+ */
608
+ async listBoardOrder() {
609
+ const board = await resolveBoard()
610
+ const order = []
611
+ let after = null
612
+ for (let page = 0; page < MAX_PAGES; page++) {
613
+ const data = await graphql(BOARD_ORDER, { id: board.id, after })
614
+ const items = (data.node && data.node.items) || { nodes: [], pageInfo: {} }
615
+ for (const n of items.nodes || []) {
616
+ const c = n && n.content
617
+ if (!c || c.number == null) continue
618
+ if (!c.repository || !sameLogin(c.repository.nameWithOwner, `${owner}/${repo}`)) continue
619
+ order.push(String(c.number))
620
+ }
621
+ if (!items.pageInfo || !items.pageInfo.hasNextPage) break
622
+ after = items.pageInfo.endCursor
623
+ }
624
+ return order
625
+ },
626
+
566
627
  /**
567
628
  * Open issues in this repo carrying every label in `labels` — the intake
568
629
  * inbox. Pull requests come back from this endpoint too and are dropped.
@@ -595,15 +656,29 @@ function makeApiAdapter({
595
656
 
596
657
  /**
597
658
  * Put the issue on the board. `addProjectV2ItemById` returns the EXISTING
598
- * item when the issue is already there, so this is idempotent by GitHub's
599
- * own contract — no read is needed to avoid a duplicate.
659
+ * item when the issue was already there before the call — but not when the
660
+ * board's own "auto-add sub-issues" workflow is adding it at the same
661
+ * moment, which is exactly when a just-linked child is pushed. That loses
662
+ * the race with `Content already exists in this project`, so on THAT
663
+ * refusal the item is read back rather than the push failing.
600
664
  */
601
665
  async addToBoard(issueOrRef) {
602
666
  const issue = issueOrRef && issueOrRef.nodeId ? issueOrRef : await adapter.readIssue(issueOrRef)
603
667
  if (!issue || !issue.nodeId) throw new GitHubRefusal(`no issue ${JSON.stringify(issueOrRef)} to add to the board`)
604
668
  if (issue.boardItemId) return { itemId: issue.boardItemId, added: false }
605
669
  const board = await resolveBoard()
606
- const data = await graphql(ADD_ITEM, { project: board.id, content: issue.nodeId })
670
+ let data
671
+ try {
672
+ data = await graphql(ADD_ITEM, { project: board.id, content: issue.nodeId })
673
+ } catch (error) {
674
+ if (!alreadyOnBoard(error)) throw error
675
+ const itemId = await awaitBoardItem(issue)
676
+ // WHAT WOULD FOOL THIS: GitHub's read side lagging its write side for
677
+ // longer than the backoff. That is a cannot-tell, so the original
678
+ // refusal is re-raised rather than an item id guessed at.
679
+ if (!itemId) throw error
680
+ return { itemId, added: false }
681
+ }
607
682
  const item = data.addProjectV2ItemById && data.addProjectV2ItemById.item
608
683
  if (!item || !item.id) throw new GitHubRefusal(`GitHub did not return a board item for ${issue.identifier}`)
609
684
  return { itemId: item.id, added: true }
@@ -680,118 +755,6 @@ function makeApiAdapter({
680
755
  throw new GitHubRefusal(`GitHub answered ${res.status} when asked whether ${login} is assignable`, { status: res.status })
681
756
  },
682
757
 
683
- // --- releases (the kit's release seam, `provider-kit/src/releases.js`) ---
684
-
685
- /**
686
- * Is the tag on GitHub? Asked before a create because GitHub, handed a
687
- * `tag_name` it lacks, CREATES the tag at the default branch's head — a
688
- * release pointing at a commit nobody tagged. 200 yes, 404 no; anything
689
- * else throws (cannot tell).
690
- */
691
- async releaseTagExists(tag) {
692
- const res = await send('GET', `${base}${repoPath}/git/ref/tags/${encodeURIComponent(tag)}`)
693
- if (res.status === 200) return true
694
- if (res.status === 404) return false
695
- throw new GitHubRefusal(`GitHub answered ${res.status} when asked for tag ${tag}`, { status: res.status })
696
- },
697
-
698
- /**
699
- * The release for a tag, or null. A 404 is GitHub positively answering
700
- * "no release for this tag"; any other failure throws, and the kit refuses
701
- * rather than create on a lookup it could not make.
702
- */
703
- async releaseFind(tag) {
704
- const raw = await rest('GET', `${repoPath}/releases/tags/${encodeURIComponent(tag)}`, { allow404: true })
705
- return raw ? releaseOf(raw) : null
706
- },
707
-
708
- /**
709
- * Every release in the repo, for `release reconcile`. Hand-made releases
710
- * ride through here too — the caller filters to the ones carrying the
711
- * skitterspec marker and must leave the rest alone.
712
- */
713
- async releaseList() {
714
- const raw = await restAll(`${repoPath}/releases`)
715
- return raw.map(releaseOf).filter(Boolean)
716
- },
717
-
718
- async releaseCreate({ tag, name, body, prerelease = true }) {
719
- assertBodyFits(body, `the ${tag} release`)
720
- // `make_latest: false` while staged: a release still on its way through
721
- // test must not become the one GitHub shows as Latest.
722
- const raw = await rest('POST', `${repoPath}/releases`, {
723
- body: { tag_name: tag, name, body, prerelease, make_latest: prerelease ? 'false' : 'true' },
724
- })
725
- return releaseOf(raw)
726
- },
727
-
728
- async releaseUpdate(release, { name, body }) {
729
- assertBodyFits(body, `the ${release.tag} release`)
730
- const raw = await rest('PATCH', `${repoPath}/releases/${release.id}`, { body: { name, body } })
731
- Object.assign(release, releaseOf(raw) || {})
732
- return release
733
- },
734
-
735
- /**
736
- * Note the release on each issue it carries — one comment per issue, found
737
- * again by its marker, so a CI retry adds nothing.
738
- */
739
- async releaseAttach(release, tickets) {
740
- const marker = `<!-- skitterspec:released ${release.tag} -->`
741
- let attached = 0
742
- let already = 0
743
- for (const t of tickets) {
744
- const comments = await adapter.listComments(t.ref)
745
- if (comments.some((c) => c.body.includes(marker))) {
746
- already++
747
- continue
748
- }
749
- await adapter.createComment(t.ref, `Shipped in [${release.tag}](${release.url || ''})\n\n${marker}`)
750
- attached++
751
- }
752
- return { attached, already }
753
- },
754
-
755
- /**
756
- * Set the board's Deployed option on every issue the release carries. The
757
- * option is resolved before the first write, so an unknown name refuses
758
- * with nothing changed.
759
- *
760
- * A commit's `Refs:` names the spec issue, never a phase, so the phases are
761
- * reached through their parent — and only the CLOSED ones. An open phase of
762
- * a spec landed mid-way (/spec-to-main) has not shipped, and marking it so
763
- * would be a false Deployed on the board.
764
- */
765
- async releaseStage(release, optionName, tickets) {
766
- await optionFor(deployedField, optionName)
767
- const seen = new Set()
768
- let set = 0
769
- const stage = async (ref) => {
770
- if (seen.has(ref)) return
771
- seen.add(ref)
772
- const r = await adapter.setFieldOption(ref, deployedField, optionName)
773
- if (r && r.changed !== false) set++
774
- }
775
- for (const t of tickets) {
776
- await stage(t.ref)
777
- for (const sub of await adapter.listSubIssues(t.ref)) {
778
- if (!sub.open) await stage(sub.identifier)
779
- }
780
- }
781
- return { set }
782
- },
783
-
784
- /**
785
- * `latest: false` completes without taking GitHub's "Latest" badge — what
786
- * reconcile passes for every release but a series' newest, so a backfilled
787
- * old version cannot steal it from the one that actually is.
788
- */
789
- async releaseComplete(release, { latest = true } = {}) {
790
- const raw = await rest('PATCH', `${repoPath}/releases/${release.id}`, { body: { prerelease: false, make_latest: latest ? 'true' : 'false' } })
791
- Object.assign(release, releaseOf(raw) || {})
792
- return release
793
- },
794
-
795
758
  async listLabels() {
796
759
  const raw = await restAll(`${repoPath}/labels`)
797
760
  return raw.map((l) => ({ name: l.name, color: l.color || null }))
@@ -27,7 +27,7 @@ const {
27
27
  isEmptyPlan,
28
28
  validateStates,
29
29
  stateSuggestions,
30
- remoteWorkflowState,
30
+ stateNamesFor,
31
31
  remoteDescriptionEdited,
32
32
  writeFrontmatter,
33
33
  stampSubIssueId,
@@ -62,12 +62,13 @@ const { makeApiAdapter } = require('./api.js')
62
62
  const { APPLY_OVER_MCP } = require('./mcp.js')
63
63
  const { resolveIdentity, displayNameOf } = require('./identity.js')
64
64
  const { makeAssignmentCommands } = require('../provider-kit/src/assignment.js')
65
- const { makeReleaseCommands } = require('../provider-kit/src/releases.js')
65
+ const { resolveListAssignee } = require('../provider-kit/src/list-assignee.js')
66
+ const { expandStateArgs, specColumn, specCell } = require('../provider-kit/src/list-rows.js')
66
67
 
67
68
  const PROGRAM = 'spec-sync'
68
69
  const BIN = 'skitterspec-github'
69
70
  const specHelpers = kit.makeSpecHelpers({ program: PROGRAM })
70
- const { resolveSnapshotDir, specIdentifier, listSpecs, resolveOrExit, warnToErr, verifyLines } = specHelpers
71
+ const { resolveSnapshotDir, specIdentifier, listSpecs, listSpecsLive, resolveOrExit, warnToErr, verifyLines } = specHelpers
71
72
 
72
73
  // An issue reference as typed: `#123` or `123`. Stamped as `#123`.
73
74
  const ID_RE = /^#?\d+$/
@@ -247,8 +248,7 @@ function applyOps({ adapter, config }) {
247
248
 
248
249
  function adapterOptions(config) {
249
250
  const g = config.github || {}
250
- const deployedField = (config.releases && config.releases.deployedField) || 'Deployed'
251
- return { owner: g.owner, repo: g.repo, project: g.project, statusField: g.statusField, deployedField }
251
+ return { owner: g.owner, repo: g.repo, project: g.project, statusField: g.statusField }
252
252
  }
253
253
 
254
254
  function apiAdapterFor(config, flags) {
@@ -555,13 +555,9 @@ function specSyncStatus(dir, config, specArg, flags, out, err) {
555
555
  out.write(`${PROGRAM} status: cannot read --remote: ${error.message}\n`)
556
556
  return 1
557
557
  }
558
- const bucket = remoteWorkflowState(remote, config)
559
- const local = r.projection.status
560
- if (bucket && local && bucket !== local) {
561
- lines.push(` drift: the board says "${bucket}", the repo says "${local}" (repo wins on next push)`)
562
- } else if (bucket) {
563
- lines.push(' drift: none — the board agrees with the repo')
564
- }
558
+ // NO STATE LINE, deliberately: skitterspec tells the tracker about its own
559
+ // transitions and never reads a status back. A ticket someone moved there
560
+ // is theirs to have moved, and push resends State only when the spec does.
565
561
  // SILENT ON EVERYTHING EXCEPT A POSITIVE ANSWER: `remoteDescriptionEdited`
566
562
  // returns null for every cannot-tell, and none of those is evidence.
567
563
  if (remoteDescriptionEdited(readBase(dir, identifier, config), remote, config) === true) {
@@ -677,6 +673,12 @@ async function specSyncStates(dir, config, flags, out) {
677
673
  ? `ok · ${issue}`
678
674
  : `MISSING from the board${suggestions.get(bucket) ? ` — closest: "${suggestions.get(bucket)}"` : ''}`
679
675
  lines.push(` ${bucket.padEnd(bw)} -> ${String(name).padEnd(nw)} ${tail}`)
676
+ // Aliases are read-only, so a missing one never blocks a push — but it
677
+ // reads as nothing, so it is still named.
678
+ for (const alias of stateNamesFor(bucket, config).slice(1)) {
679
+ const here = names.includes(alias)
680
+ lines.push(` ${''.padEnd(bw)} ${String(alias).padEnd(nw)} ${here ? 'also reads as ' + bucket : 'alias MISSING — reads as nothing'}`)
681
+ }
680
682
  }
681
683
  if (missing.length) {
682
684
  lines.push(` remap: ${PROGRAM} init-config --force … --state <bucket>="<option>", or add the option on the board`)
@@ -686,6 +688,14 @@ async function specSyncStates(dir, config, flags, out) {
686
688
  }
687
689
 
688
690
  async function specSyncList(dir, config, flags, out) {
691
+ // `--next N` is the top of the backlog in BOARD order, so it fixes the scope
692
+ // itself; with --state or --all one would have to lose, silently.
693
+ const next = Number.isFinite(flags.next) && flags.next > 0 ? flags.next : null
694
+ const scopeFlags = [next !== null && '--next', flags.all === true && '--all', (flags.stateArgs || []).length > 0 && '--state'].filter(Boolean)
695
+ if (scopeFlags.length > 1) {
696
+ out.write(`${PROGRAM} list: ${scopeFlags.join(' and ')} each pick the scope, so they cannot be combined\n`)
697
+ return 1
698
+ }
689
699
  const cred = apiAdapterFor(config, flags)
690
700
  const transport = kit.resolveTransport(flags, config, cred.ok)
691
701
  if (transport === 'mcp' || !cred.ok) {
@@ -699,41 +709,83 @@ async function specSyncList(dir, config, flags, out) {
699
709
  out.write(`${PROGRAM} list: ${gap}\n`)
700
710
  return 1
701
711
  }
712
+ const who = await resolveListAssignee({
713
+ flags,
714
+ config,
715
+ env: flags.env || process.env,
716
+ adapter: cred.adapter,
717
+ resolveIdentity,
718
+ displayNameOf,
719
+ tracker: 'GitHub',
720
+ prog: PROGRAM,
721
+ })
722
+ if (who.code != null) {
723
+ out.write(who.lines.join('\n') + '\n')
724
+ return who.code
725
+ }
726
+ const assignee = who.assignee
702
727
  let issues
703
728
  try {
704
- issues = await cred.adapter.listBoardItems({ label: markersFor(config, 'spec').labels[0] || '' })
705
- const stateNames = flags.stateArgs || []
729
+ // Filtered by assignee, the spec label is dropped: an issue assigned to
730
+ // someone that no spec has adopted yet carries no spec label, and it is
731
+ // exactly the "what's next" row `--mine` exists for.
732
+ issues = await cred.adapter.listBoardItems(
733
+ assignee ? { assignee: assignee.id } : { label: markersFor(config, 'spec').labels[0] || '' },
734
+ )
735
+ const stateNames = next !== null ? stateNamesFor('backlog', config) : expandStateArgs(flags.stateArgs, config)
706
736
  if (stateNames.length) {
707
737
  const want = new Set(stateNames.map((s) => s.toLowerCase()))
708
738
  issues = issues.filter((i) => i.state && want.has(String(i.state.name).toLowerCase()))
709
739
  } else if (!flags.all) {
710
- issues = issues.filter((i) => i.open)
740
+ // Open issues, minus any whose Status is a finished bucket's name — an
741
+ // alias such as "Released" is finished work on an issue nobody closed.
742
+ const terminal = new Set(
743
+ [...stateNamesFor('complete', config), ...stateNamesFor('cancelled', config)].map((s) => s.toLowerCase()),
744
+ )
745
+ issues = issues.filter((i) => i.open && !(i.state && terminal.has(String(i.state.name).toLowerCase())))
746
+ }
747
+ if (next !== null) {
748
+ const order = await cred.adapter.listBoardOrder()
749
+ const rank = new Map(order.map((n, i) => [n, i]))
750
+ issues = issues
751
+ .filter((i) => i.open && rank.has(i.id))
752
+ .sort((a, b) => rank.get(a.id) - rank.get(b.id))
711
753
  }
712
754
  } catch (error) {
713
755
  out.write(`${PROGRAM} list: ${error.message}\n`)
714
756
  return 1
715
757
  }
716
- const linked = new Map(listSpecs(dir, config).filter((s) => s.identifier).map((s) => [s.identifier, s]))
758
+ const linked = new Map(listSpecsLive(dir, config).filter((s) => s.identifier).map((s) => [s.identifier, s]))
717
759
  const rows = issues
718
760
  .filter((i) => !i.parent)
719
- .slice(0, flags.limit || Infinity)
720
- .map((i) => ({
721
- identifier: i.identifier,
722
- title: i.title,
723
- state: i.state ? i.state.name : null,
724
- spec: linked.has(i.identifier) ? linked.get(i.identifier).spec : null,
725
- }))
761
+ .slice(0, next !== null ? next : flags.limit || Infinity)
762
+ .map((i) => {
763
+ const spec = linked.get(i.identifier) || null
764
+ const state = i.state ? i.state.name : null
765
+ return {
766
+ identifier: i.identifier,
767
+ title: i.title,
768
+ state,
769
+ ...specColumn(state, spec, config),
770
+ assignee: (i.assignees || []).map((a) => a.name || a.id).join(', ') || null,
771
+ spec: spec ? spec.spec : null,
772
+ }
773
+ })
726
774
  if (flags.json) {
727
775
  out.write(JSON.stringify(rows, null, 2) + '\n')
728
776
  return 0
729
777
  }
730
778
  if (!rows.length) {
731
- out.write(`${PROGRAM} list: nothing matched\n`)
779
+ out.write(`${PROGRAM} list: nothing matched${assignee ? ` for ${assignee.name}` : ''}\n`)
732
780
  return 0
733
781
  }
734
- const lines = [`${PROGRAM} list: ${repoLabel(config)} · board ${config.github.project}`]
782
+ const lines = [
783
+ `${PROGRAM} list: ${repoLabel(config)} · board ${config.github.project}${assignee ? ` · assigned to ${assignee.name}` : ''}${next !== null ? ` · next ${next} in board order` : ''}`,
784
+ ]
735
785
  for (const r of rows) {
736
- lines.push(` ${r.identifier}\t${r.state || '—'}\t${r.title || ''}${r.spec ? ` -> ${r.spec}` : ''}`)
786
+ lines.push(
787
+ ` ${r.identifier}\t${r.state || '—'}\t${specCell(r)}\t${r.assignee || 'unassigned'}\t${r.title || ''}${r.spec ? ` -> ${r.spec}` : ' (no spec)'}`,
788
+ )
737
789
  }
738
790
  out.write(lines.join('\n') + '\n')
739
791
  return 0
@@ -888,12 +940,13 @@ function specSyncReleased(dir, config, rangeArg, flags, out) {
888
940
  refPattern: GITHUB_REF_RE,
889
941
  foreignPatterns: [IDENTIFIER_RE],
890
942
  })
943
+ report.tickets = kit.nameTickets(report.tickets, listSpecs(dir, config, { urls: true }))
891
944
  if (flags.json) {
892
945
  out.write(JSON.stringify(report, null, 2) + '\n')
893
946
  return 0
894
947
  }
895
948
  const lines = [`${PROGRAM} released: ${range} — ${report.total} commit(s)`]
896
- for (const t of report.tickets) lines.push(` ${t.ref} (${t.commits} commit(s))`)
949
+ for (const t of report.tickets) lines.push(` ${t.ref} (${t.commits} commit(s))${t.spec ? ` ${t.spec}` : ''}`)
897
950
  if (!report.tickets.length) lines.push(' no referenced issues')
898
951
  if (report.unreferenced) lines.push(` ${report.unreferenced} commit(s) carry no Refs: trailer`)
899
952
  if (report.historical) lines.push(` ${report.historical} commit(s) reference an earlier tracker (KEY-N)`)
@@ -902,37 +955,6 @@ function specSyncReleased(dir, config, rangeArg, flags, out) {
902
955
  return 0
903
956
  }
904
957
 
905
- // ---------------------------------------------------------------------------
906
- // `release create | deployed | complete` — the kit's release seam
907
- // (`provider-kit/src/releases.js`) on GitHub Releases plus the board's
908
- // Deployed field. Run by CI on a tag push; dry unless `--apply`.
909
- const releases = makeReleaseCommands({
910
- tracker: 'GitHub',
911
- program: PROGRAM,
912
- readCommits: (dir, range) => readCommitRange(dir, range),
913
- ticketOptions: (config) => ({
914
- ignorePaths: (config.release && config.release.ignorePaths) || [],
915
- refPattern: GITHUB_REF_RE,
916
- foreignPatterns: [IDENTIFIER_RE],
917
- }),
918
- teamKey: () => '',
919
- listSpecs: (dir, config) => listSpecs(dir, config),
920
- series: (config) => (config.releases && config.releases.series) || [],
921
- adapterFor: (config, flags) => {
922
- const got = apiAdapterFor(config, flags)
923
- if (!got.ok) return got
924
- const gap = flags.adapter ? null : configGap(config)
925
- return gap ? { ok: false, error: gap } : got
926
- },
927
- describe: (t) => `${t.ref}${t.title ? ` ${t.title}` : ''}`,
928
- // GitHub's MCP server can READ releases and cannot write one — so over MCP
929
- // this is impossible, not merely slower, and says so (exit 1).
930
- impossibleOverMcp: (config, flags) =>
931
- kit.resolveTransport(flags, config, true) === 'mcp'
932
- ? "transport = mcp — GitHub's MCP server has no release write tool; set a token (CI: a repo secret) and re-run"
933
- : null,
934
- })
935
-
936
958
  // ---------------------------------------------------------------------------
937
959
  // `preserve <spec>` — post the issue's current body back onto the issue as a
938
960
  // comment BEFORE the linking push replaces it. Every cannot-tell exits 0: a
@@ -1219,6 +1241,8 @@ async function specSyncDoctor(dir, flags, out) {
1219
1241
  checks.push(row('tracker', 'GitHub config', 'broken', configGap(loaded.config), `fix ${CONFIG_FILE}`))
1220
1242
  } else {
1221
1243
  checks.push(row('tracker', 'GitHub config', 'ok', `${repoLabel(loaded.config)} · board ${loaded.config.github.project}`))
1244
+ const retired = kit.retiredKeysRow(path.join(dir, CONFIG_FILE), CONFIG_FILE, row)
1245
+ if (retired) checks.push(retired)
1222
1246
  // A worktree forks from a COMMIT, so a config that exists only in the
1223
1247
  // working tree is invisible in every spec worktree — where the sync
1224
1248
  // skills actually run. The positive signal is git tracking the file;
@@ -1290,26 +1314,6 @@ async function specSyncDoctor(dir, flags, out) {
1290
1314
  )
1291
1315
  : row('states', 'Board states', 'ok', `every configured state is a "${config.github.statusField}" option`),
1292
1316
  )
1293
- // Releases: the Deployed field and every env option a series names. Only
1294
- // when a series is configured — a repo that never adopted releases has
1295
- // nothing to be told about here.
1296
- const series = (config.releases && config.releases.series) || []
1297
- if (series.length && adapter.resolveBoard) {
1298
- const field = config.releases.deployedField
1299
- const board = await adapter.resolveBoard()
1300
- const f = board.fields.find((x) => String(x.name).toLowerCase() === String(field).toLowerCase() && x.options)
1301
- if (!f) {
1302
- checks.push(row('releases', 'Deployed field', 'broken', `the board has no single-select "${field}"`, `add it on the board, or set releases.deployedField`))
1303
- } else {
1304
- const have = new Set(f.options.map((o) => o.name.toLowerCase()))
1305
- const absent = series.flatMap((s) => Object.values(s.envs || {})).filter((o) => !have.has(o.toLowerCase()))
1306
- checks.push(
1307
- absent.length
1308
- ? row('releases', 'Deployed field', 'broken', `"${field}" lacks: ${[...new Set(absent)].join(', ')}`, 'add the options on the board, or fix releases.series envs')
1309
- : row('releases', 'Deployed field', 'ok', `"${field}" has every env option`),
1310
- )
1311
- }
1312
- }
1313
1317
  if (adapter.listLabels) {
1314
1318
  const have = new Set((await adapter.listLabels()).map((l) => String(l.name).toLowerCase()))
1315
1319
  const want = ['spec', 'phase'].flatMap((k) => markersFor(config, k).labels)
@@ -1353,12 +1357,11 @@ const USAGE = `Usage: ${BIN} spec-sync <subcommand>
1353
1357
  status <spec> [--remote <f>] read-only drift report
1354
1358
  verify <spec> --stored <f> compare a read-back against the repo
1355
1359
  states [--json] the board's Status options + bucket map
1356
- list [--all | --state NAME] the board's issues for this repo
1360
+ list [--all | --state NAME|BUCKET | --next N] [--mine | --by USER] the board's issues
1357
1361
  intake [query] [--json] issues waiting to become specs
1358
1362
  linked [--json] specs and their linked issues (offline)
1359
1363
  ref [<spec>] the Refs: trailer value for this branch
1360
1364
  released [<range>] issues a commit range contains
1361
- release create|deployed|complete <tag> GitHub Release + Deployed field (CI; --apply)
1362
1365
  preserve <spec> [--text <f>] keep an adopted issue's original report
1363
1366
  assign <spec> --to <login> | --release stamp who is building it
1364
1367
  whoami [--set <login>] [--unset] who you are on GitHub (cached)
@@ -1442,7 +1445,7 @@ async function specSync(rest, io = {}) {
1442
1445
  case 'preserve':
1443
1446
  return specSyncPreserve(dir, config, positional[0], flags, out)
1444
1447
  case 'release':
1445
- return releases.run(dir, config, positional, flags, out)
1448
+ return kit.refuseRemovedVerb(out, PROGRAM, 'release')
1446
1449
  case 'assign':
1447
1450
  return assignment.assign(dir, config, positional[0], flags, out)
1448
1451
  case 'whoami':
@@ -1493,6 +1496,9 @@ function parseArgs(args, sub) {
1493
1496
  '--to': { kind: 'string' },
1494
1497
  '--name': { kind: 'value' },
1495
1498
  '--release': { kind: 'boolean' },
1499
+ '--mine': { kind: 'boolean' },
1500
+ '--next': { kind: 'number' },
1501
+ '--by': { kind: 'string' },
1496
1502
  '--set': { kind: 'string' },
1497
1503
  '--unset': { kind: 'boolean' },
1498
1504
  '--cursor': { kind: 'string' },