@lovek4d/kickflip 0.1.0 → 0.3.1

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.
Files changed (96) hide show
  1. package/CONTEXT.md +177 -78
  2. package/README.md +46 -5
  3. package/SKILL.md +58 -37
  4. package/bin/doctor.mjs +4 -3
  5. package/bin/install.mjs +3 -3
  6. package/bin/kickflip.mjs +87 -32
  7. package/bin/statusline.mjs +4 -3
  8. package/bin/wait-events.mjs +2 -2
  9. package/board/arch-review.mjs +5 -0
  10. package/board/bin/agent.mjs +1 -1
  11. package/board/bin/board.mjs +241 -69
  12. package/board/bin/builder-stop-hook.mjs +4 -3
  13. package/board/domain.mjs +5 -3
  14. package/board/on-host.mjs +1 -0
  15. package/board/public/app-arch.js +75 -0
  16. package/board/public/app-asks.js +33 -14
  17. package/board/public/app-cards.js +242 -49
  18. package/board/public/app-core.js +39 -5
  19. package/board/public/app-header.js +24 -6
  20. package/board/public/app-lanes.js +76 -26
  21. package/board/public/app-needs.js +1 -0
  22. package/board/public/app-snapshot.js +45 -11
  23. package/board/public/app-threads.js +13 -11
  24. package/board/public/app.html +4 -1
  25. package/board/public/app.js +131 -20
  26. package/board/public/dialogs.js +114 -116
  27. package/board/public/hub-kit.js +19 -2
  28. package/board/public/hub.css +24 -18
  29. package/board/public/linear-key.js +141 -0
  30. package/board/public/router.js +6 -3
  31. package/board/public/rules-editor.js +1 -1
  32. package/board/public/shell.js +1 -1
  33. package/board/public/sidebar.css +31 -11
  34. package/board/public/sidebar.js +88 -16
  35. package/board/public/style.css +141 -46
  36. package/board/public/toasts.js +6 -4
  37. package/board/public/ui-cards.js +102 -37
  38. package/board/public/ui-header.js +17 -8
  39. package/board/public/ui-hub.js +30 -12
  40. package/board/public/ui-links.js +18 -10
  41. package/board/public/ui-order.js +18 -0
  42. package/board/public/ui-page-header.js +4 -2
  43. package/board/public/ui-questions.js +37 -16
  44. package/board/public/ui-sidebar.js +49 -11
  45. package/board/public/ui-snapshot.js +15 -9
  46. package/board/public/ui-threads.js +25 -16
  47. package/board/public/ui.js +23 -11
  48. package/board/public/view-hub-settings.js +46 -30
  49. package/board/public/view-hub.js +64 -13
  50. package/board/public/view-notes.js +7 -4
  51. package/board/public/view-polling.js +3 -3
  52. package/board/public/view-questions.js +42 -22
  53. package/board/public/view-settings.js +90 -35
  54. package/board/review.mjs +1 -0
  55. package/board/server.mjs +12 -7
  56. package/board/store.mjs +14 -6
  57. package/board/tickets.mjs +3 -3
  58. package/board/worktree.mjs +14 -13
  59. package/docs/hub-session.md +3 -3
  60. package/hooks-plugin/hooks/codex-share-auto.mjs +7 -5
  61. package/hooks-plugin/hooks/watcher-stop.mjs +41 -0
  62. package/hub/awake.mjs +1 -0
  63. package/hub/board-repo.mjs +1 -1
  64. package/hub/boards.mjs +4 -4
  65. package/hub/close-board.mjs +1 -1
  66. package/hub/duration.mjs +1 -0
  67. package/hub/github.mjs +4 -5
  68. package/hub/home.mjs +1 -1
  69. package/hub/hub.mjs +12 -10
  70. package/hub/linear.mjs +2 -2
  71. package/hub/new-board.mjs +2 -2
  72. package/hub/pr-report.mjs +1 -0
  73. package/hub/push.mjs +2 -2
  74. package/hub/readiness.mjs +2 -0
  75. package/hub/repos.mjs +3 -2
  76. package/hub/restart-board.mjs +1 -0
  77. package/hub/routes.mjs +1 -1
  78. package/hub/schedule.mjs +1 -1
  79. package/hub/sessions.mjs +2 -2
  80. package/hub/shell.mjs +2 -1
  81. package/hub/slack.mjs +2 -0
  82. package/hub/stream.mjs +12 -12
  83. package/hub/sw.js +1 -1
  84. package/hub/trust.mjs +2 -0
  85. package/hub/try.mjs +4 -3
  86. package/hub/upgrade.mjs +1 -0
  87. package/hub/usage.mjs +3 -3
  88. package/hub/views.mjs +1 -1
  89. package/package.json +1 -1
  90. package/shared/colors.css +7 -5
  91. package/shared/fake-gh.mjs +54 -0
  92. package/shared/service.mjs +16 -16
  93. package/shared/skills.mjs +2 -0
  94. package/shared/usage-gate.mjs +1 -1
  95. package/starter/public/claude.js +3 -2
  96. package/bin/web-ts.mjs +0 -2
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{main as r}from"./board.mjs";import{migrateOnStart as i}from"../../bin/install.mjs";i(),process.exitCode=await r(["builder",...process.argv.slice(2)]);
2
+ import{main as e}from"./board.mjs";process.exitCode=await e(["builder",...process.argv.slice(2)]);
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- var _=Object.defineProperty;var l=(e,s)=>_(e,"name",{value:s,configurable:!0});import{routeRecord as S}from"../../hub/routes.mjs";import g from"node:fs";import f from"node:path";import{spawnSync as O}from"node:child_process";import{fileURLToPath as C,pathToFileURL as E}from"node:url";import*as n from"../store.mjs";import{makeWorktree as q,land as T,skillRepo as L,worktreesDir as N}from"../worktree.mjs";import{ITEM_STATUSES as F}from"../domain.mjs";import{boardAt as K,readManifest as M}from"../../hub/boards.mjs";import{boardRepo as D}from"../../hub/board-repo.mjs";import{pushKindError as B}from"../../hub/push.mjs";import{migrateOnStart as H}from"../../bin/install.mjs";const U=`usage: node board.mjs <command> [--site <route>] ...
2
+ var P=Object.defineProperty;var n=(e,t)=>P(e,"name",{value:t,configurable:!0});import{readiness as N,reportSlack as E}from"../../hub/readiness.mjs";import{readSlack as L,setSlack as H}from"../../hub/slack.mjs";import{routeRecord as k}from"../../hub/routes.mjs";import w from"node:fs";import m from"node:path";import{pathToFileURL as B}from"node:url";import*as i from"../store.mjs";import{boardWorktree as D,builderRepo as M,holdingLandLock as W,land as z,worktreesDir as G}from"../worktree.mjs";import{fileFindings as J}from"../arch-review.mjs";import{ITEM_STATUSES as F}from"../domain.mjs";import{readManifest as U}from"../../hub/boards.mjs";import"../../hub/board-repo.mjs";import{pushKindError as K}from"../../hub/push.mjs";const Q=`usage: node board.mjs <command> [--site <route>] ...
3
3
 
4
4
  Writes a kickflip board's data files. --site <route> picks ~/.claude/kickflip/sites/<route>, and its
5
5
  board.json says where the board's waves live. Without --site, waves come from ~/.claude/waves.
6
6
  Paths resolve under $HOME, so HOME=<dir> points every command at a copy.
7
7
  A --file argument of - reads stdin.
8
- item add and followup add create a ticket in the board\u2019s source unless --ticket <id> links one.
8
+ item add creates a ticket in the board\u2019s source unless --ticket <id> links one.
9
9
  Internal defaults to INT; GitHub and Linear create an issue from the title and notes, Linear in the board's team and
10
10
  project through Hub's Linear key. A linked ticket must exist in the source; an Internal one no other card holds.
11
11
  Asks have no ticket; item set --from-ask creates one when the card has none.
@@ -14,11 +14,12 @@ merged \u2192 Done (a GitHub issue closes), only for a ticket assigned to the ow
14
14
  can't move prints one "ticket <id>: \u2026" line; the card's change still stands.
15
15
  A Linear board without Hub's key hands Linear to the session: a linked id is checked on its pattern alone, and a card
16
16
  needing an issue, or a ticket to move, prints a "ticket" line saying what to do through your Linear MCP, such as
17
- creating the issue and running item set <wave>/<id> --ticket <id> (followup set for a follow-up).
17
+ creating the issue and running item set <wave>/<id> --ticket <id>.
18
18
 
19
- reply <eventId> (--html <text> | --file <path>) data/replies/<eventId>.html
20
- working <eventId> marks an ask or thread message started; the page
21
- shows "Working on it" until a reply or later thread line
19
+ reply <eventId> (--html <text> | --file <path>) data/replies/<eventId>.html. A reply to an ask resolves its
20
+ answered questions (topic item:ask:<eventId>), and one to
21
+ wave-triage its wave's, noting "Acted on: replied". A
22
+ reply to todo-triage ends that triage
22
23
  thread <wave>/<id> --text <t> [--link <url>] one line in the item's thread; ask:<eventId> in place
23
24
  [--who claude|love|<name>] [--via github|slack] of <wave>/<id> writes in that ask's thread
24
25
  A Claude thread line, or a reply to an ask or item-message, rewrites the body of the thread's
@@ -27,8 +28,9 @@ creating the issue and running item set <wave>/<id> --ticket <id> (followup set
27
28
  topic add <id> --title <t> [--summary <s>] a question topic in data/owner.json
28
29
  question add --file <json> one question or an array of them:
29
30
  {id, topic, question, options: [{id, label, recommended?, detail?, diagram?, practice?}],
30
- source?, context?, url?, urgent?}; topic is declared, item:<wave>/<id>, or item:ask:<eventId>
31
- for a New card not sorted yet.
31
+ source?, context?, url?, urgent?, round_of?}; topic is declared, item:<wave>/<id>, item:ask:<eventId>
32
+ for a New card not sorted yet, lineup:<slug> for a wave's triage, or wave:<slug> for a wave file's triage on
33
+ a board over ~/.claude/waves. A merged card's topic is refused; a question on a done card reopens it.
32
34
  url is http(s), or a site page such as prototype-<topic>.html?q=<id>, stored as given.
33
35
  Prototype options keep take order, ids matching take keys; recommended: true tags the recommendation.
34
36
  Waiting on you shows fitting takes in a grid, or a chooser above one full-width take for a single take or if any
@@ -37,12 +39,18 @@ creating the issue and running item set <wave>/<id> --ticket <id> (followup set
37
39
  danger|success, to the next row's box indexes (default all); practice: ["<line>", \u2026]
38
40
  A prototype url's topic must be recorded (prototype add), its option ids a non-empty subset of the
39
41
  take keys in take order, without repeats, and every take file written; a hand-written prototype-*.html
40
- is refused. On an item: topic, each question answered and still waiting on Claude is resolved,
41
- noting "Followed by <new id>", and printed as "resolved: <old id>". Any other unresolved question
42
- on the same topic that links the same prototype is resolved, noting "Replaced by <new id>", and
43
- printed as "replaced: <old id>". Answering or resolving a question drops its queued push tagged
44
- q-<id> on this site.
45
- question resolve <id> --note <text> sets resolved and resolved_at
42
+ is refused. On an item: topic, each other question answered and still waiting on Claude is
43
+ resolved, noting "Followed by <new id>", and printed as "resolved: <old id>". Any other unresolved
44
+ question on the same topic that links the same prototype is resolved, noting "Replaced by <new id>",
45
+ and printed as "replaced: <old id>". round_of names the question on the same topic whose
46
+ prototype-request this answers; the question needs a prototype url, takes the next round
47
+ number, and resolves that one, noting "Followed by prototype round N".
48
+ The board server pushes the new open questions itself, under the card's tag (item-<wave>/<id>, or
49
+ ask-<eventId>) or topic-<topic> off the cards
50
+ question resolve <id> --note <text> sets resolved and resolved_at; refuses a question on a
51
+ prototype page until an answer settles its round: a pick, with a note or none, or an answer to
52
+ an "Is this it?" confirm already on the board. A question already resolved, such as one an
53
+ answer with a note and no option resolved, is left as it is
46
54
  prototype add <topic> --title <t> --take <K>:<label> records a prototype in data/prototypes.json: the board
47
55
  [--take <K>:<label> \u2026] [--card <wave>/<id>] serves prototype-<topic>.html from its one template, with
48
56
  the title, a back arrow to --card (else the board), the
@@ -51,21 +59,46 @@ creating the issue and running item set <wave>/<id> --ticket <id> (followup set
51
59
  "A. ", since the pill shows it alone. Prints each take
52
60
  file to write,
53
61
  public/prototypes/<topic>/<K>.js, which exports
54
- render(stage, kit) (board/public/prototype-kit.js lists kit)
62
+ render(stage, kit) (board/public/prototype-kit.js lists kit).
63
+ --card starts that card: it leaves Todo
55
64
  prototype list one line per recorded prototype
56
65
  prototype rm <topic> drops the record, keeping its take files; refuses while an
57
66
  open question links it
67
+ pr <wave>/<id> one JSON line: the card's PR state, checks and new events,
68
+ using the board's repo, github-login and the card's gh_since
58
69
  item set <wave>/<id> [--status <s> | --clear-status] edits the item in its wave file
59
70
  [--next <t> | --clear-next] [--pr <n>] status: ${F.join(", ")}
60
71
  an empty --next "" clears it, as --clear-next does
61
72
  naming another unfinished card requires it in --deps
62
- [--from-ask <eventId>] the ask it came from: its New card gives way to this item,
63
- whose thread opens with the ask and its thread; it leaves
64
- a card it was folded into
65
- [--held | --unheld] --held sets held: true, for the owner's card-hold;
66
- --unheld clears it and a held status
73
+ [--pushed <branch>] on a board whose repo is a plain git remote (no GitHub):
74
+ the card's branch is pushed there, so it waits In Review
75
+ on the owner's merge. Push it first (git push origin
76
+ <branch>). The hub's repo fetch moves it to Done once the
77
+ branch is merged into the board's branch or gone from the
78
+ remote. Clears building/fixing as --pr does
79
+ [--gh-since <ISO time>] records the last handled GitHub event, an ISO-8601 UTC
80
+ time such as 2026-10-23T11:00:00Z, stored as given
81
+ [--from-ask <eventId> --text <t>] the ask it came from: its New card gives way to this item,
82
+ whose thread opens with the ask and its thread, then --text
83
+ as the item's first line; it leaves a card it was folded into; refuses a card
84
+ from another ask (use item relate-ask)
85
+ [--state ready|grilling|prototyping] what a card from an ask does next; it reads New until set.
86
+ ready refuses while the card has an open question
87
+ [--held | --unheld | --pick-up-at <time>] holds or resumes the card on the owner's words; the board
88
+ server records the owner's own Hold and Resume taps. A later
89
+ --held/--unheld overrides a tap; --unheld also clears a held status.
90
+ --pick-up-at holds it until an ISO time such as
91
+ 2026-11-04T09:00 (the Mac's local time without an
92
+ offset; a past time is refused), stored as UTC
93
+ pick_up_at. Within a minute of it the board server
94
+ resumes the card, adds a thread line, and appends
95
+ card-unblocked {key, until} unless a dep is unfinished.
96
+ --held holds it with no time; --pick-up-at "" resumes it
67
97
  [--ticket <id>] links a ticket in the board\u2019s source
68
98
  [--title <t>] renames the card
99
+ [--size small|large] [--model opus|sonnet] what builder pick reads while the hub's Claude model is
100
+ Auto: a small card gets Claude Sonnet, any other Opus, and
101
+ --model wins over --size; "" clears either
69
102
  [--notes-file <file>] the item's notes: a .md file inside its wave's folder,
70
103
  named relative to it, holding the session's understanding
71
104
  of the task so far. The open card's Notes link opens it,
@@ -74,31 +107,46 @@ creating the issue and running item set <wave>/<id> --ticket <id> (followup set
74
107
  Claude, noting "Recorded in the card's notes", and
75
108
  prints "resolved: <id>" for each
76
109
  [--deps <id>,<wave>/<id>] replaces its blocked-by list; --deps "" clears it
110
+ [--parent <wave>/<id>] sets its Parent, refusing itself or a card below it;
111
+ --parent "" clears it
112
+ [--related <id>,<wave>/<id>] replaces the cards it is Related to, which both cards
113
+ show; --related "" clears it, on both
77
114
  [--install <url> [--install-sha <sha>] a device build the owner installs from the card's Install
78
115
  [--install-label <text>] | --clear-install] button, stamped built_at now: itms-services://?action=
79
116
  download-manifest&url=https://\u2026/manifest.plist for iOS,
80
117
  an https:// .apk URL for Android. --install-sha is the
81
118
  head it was built from: the badge reads "Install (stale)"
82
119
  once the branch moves past it. Hidden once the card is Done
120
+ [--text <t>] with --status done or dropped, required on a site: the
121
+ card's closing line, written last in its thread. merged
122
+ writes "Merged PR #n." unless --text says otherwise
123
+ builder start for a build sets building itself. --status building resolves the card's answered
124
+ questions, noting "Acted on: build started".
83
125
  --status building refuses while the item is held or a dep isn't done, merged or dropped,
84
- and while the newest owner answer to its questions that link a prototype-*.html page has a
85
- note: post the final version with prototype add and question add first.
86
- [--confirmed "<owner's words>"] passes when that note itself says go: the words must quote
87
- it, and they go in a thread line on the card;
126
+ and while the newest owner answer to its questions that link a prototype-*.html page picks
127
+ no take; a pick's note is the build's guidance;
88
128
  done, merged and dropped print "unblocked: <wave>/<id>" and append card-unblocked {key}
89
129
  once per unblocking, including held cards: start each unheld card next.
90
130
  building and fixing count as working only while a builder record on the card is open.
91
131
  --pr clears building/fixing and closes ordinary builders; install builders keep running.
92
- checking is a builder's hand-back: In Progress, reading "Orchestrator review",
93
- until the owning session verifies it and sets done; it unblocks nothing.
94
- Every --status or --clear-status records status_at, which ends the Done button's "Closing\u2026"
95
- for the owner's card-done; apply a card-done with --status done.
132
+ checking is a builder's hand-back of work it couldn't land: In Progress, reading "Orchestrator
133
+ review", until the owning session takes it on; it unblocks nothing.
134
+ The board server records the owner's card-done in the wave file itself.
135
+ Every --status or --clear-status records status_at; a later status change overrides the tap.
96
136
  --status done, merged or dropped closes the card: it resolves each of its questions (topic
97
137
  item:<wave>/<id>) that has an answer, noting "Closed with the card", and prints "resolved: <id>"
98
138
  for each. It refuses while one has no answer yet; [--force] closes it and resolves that one too
99
- item add <wave>/<id> --title <t> [--notes <t>] a new card, planned (waiting when it has --deps); never
139
+ item add <wave>[/<id>] --title <t> [--notes <t>] a new card, planned (waiting when it has --deps); never
100
140
  [--ticket <id>] [--deps <id>,<wave>/<id>] hand-edit wave.json to add one. Refuses an id the wave has.
101
141
  [--notes-file <file>] --plan is an alias of --notes-file
142
+ [--pick-up-at <time>] holds it until then, as item set's --pick-up-at
143
+ [--size small|large] [--model opus|sonnet] as item set's
144
+ [--parent <wave>/<id>] the card it was spun out of, such as one filed from
145
+ another card's thread, grill or answer: it reads as a
146
+ follow-up, and its Parent lists it in Children. A card
147
+ from the + or New task has none
148
+ Without /<id>, the card takes its ticket's id (GH-<n> for issue #n); pass an id only to import a
149
+ card. Prints "<label> added as <key>": use the key in later commands
102
150
  item relate-ask <eventId> <wave>/<id> --summary <t> folds an ask about an existing item into it: the ask's
103
151
  card goes, its message and thread show in the item's
104
152
  thread marked Moved, then the summary line. Again with
@@ -116,18 +164,33 @@ creating the issue and running item set <wave>/<id> --ticket <id> (followup set
116
164
  A card the ask became is dropped, unless it has started.
117
165
  Refuses a route that isn't another board, and an ask
118
166
  that isn't New
119
- hello-ack <eventId> answers the hub's hello: data/handshake.json records that the
120
- session hears the board, which clears the setup checklist's
121
- Events step. Refuses an older hello than the newest
122
167
  checked [--every <minutes> | --idle] data/checked.json: GitHub was just checked, next in
123
- <minutes> (default 30); run it at the end of each monitor tick.
124
- --idle: the board shows no open PR, so never late.
168
+ <minutes> (default the polling window's, as kickflip
169
+ polling prints); run it at the end of each GitHub tick.
170
+ --idle: the board shows no open PR, so never late; with
171
+ neither flag it is idle while no card has an open PR.
125
172
  Then sends the queued pushes, each on its own, unless
126
173
  pushes are held (overnight, snoozed, the weekend or off)
127
- followup add <wave> --id <id> --title <t> [--from <item id>] [--ticket <id>]
128
- followup done <wave> <id> [--force] closes the follow-up's card as item set --status done does
129
- followup set <wave> <id> --ticket <id> links the follow-up's ticket in the board's source
130
- tickets backfill [--dry-run] gives every open card and follow-up without a ticket one: the first
174
+ lineup create <slug> --title <t> --goal <t> a wave, in the owner's words: a named set of cards in
175
+ --cards <wave>/<id>,\u2026 (--note <t> | --file <f>) build order, all from one wave file. Each card is then
176
+ blocked by the one before it (its other deps stay), and
177
+ the note goes to lineup-<slug>.md beside the wave file.
178
+ The board's Waves section shows it with its goal and
179
+ order, its cards carry its chip, and Notes opens the
180
+ goal, the order and the note. Refuses a card already in
181
+ another open wave. Prints the order by card label
182
+ lineup add <slug> <wave>/<id> [--after <wave>/<id>] puts a card in the wave, last unless --after, and chains
183
+ the order again
184
+ lineup remove <slug> <wave>/<id> takes a card out: it loses its links to the wave's cards,
185
+ and the card after it is blocked by the one before
186
+ lineup set <slug> [--title <t>] [--goal <t>] renames the wave, sets its goal or rewrites its note
187
+ [--note <t> | --file <f>]
188
+ lineup finish <slug> the wave leaves the Waves section; its cards keep their
189
+ links. A wave whose cards are all Done leaves it too
190
+ The Waves section's Triage sends wave-triage {lineup}, or {wave} for a wave file's row; the row reads
191
+ Triaging\u2026 until you reply to that event, then "Triage: N open questions" while questions on topic
192
+ lineup:<slug> or wave:<slug> are open or answered
193
+ tickets backfill [--dry-run] gives every open card without a ticket one: the first
131
194
  id in its title (or legacy linear list) from the board's
132
195
  source is linked, else a new ticket is made. Done cards are
133
196
  left alone. Prints each card's result; --dry-run changes and
@@ -137,6 +200,26 @@ creating the issue and running item set <wave>/<id> --ticket <id> (followup set
137
200
  The settings page lists them; new waves copy them
138
201
  reviewers add --file <json> one reviewer or an array; replaces the same name
139
202
  reviewers remove <name>... refuses a name the board doesn't have
203
+ slack Slack identity as JSON; imports slack-bridge config once
204
+ slack set [--self-dm D..] [--user U..] sets hub Slack identity in ~/.claude/kickflip/slack.json
205
+ [--domain x] [--timezone Area/City]
206
+ review sent <wave>/<id> <reviewer> --ts <ts> records the PR link's message in the item
207
+ --channel <dm>
208
+ review react <wave>/<id> <reviewer> <emoji> records a reaction once on that reviewer's link
209
+ integrations readiness rows as one JSON line
210
+ integrations report --slack yes|no with --site: reports whether this session has Claude's
211
+ Slack connector, in ~/.claude/kickflip/integrations.json
212
+ review due one JSON line of the Slack sends owed, from local state:
213
+ {dms: [{key, reviewer, channel, text, record}], reactions:
214
+ [{key, reviewer, channel, ts, emoji, record}], digest:
215
+ review digest's answer while due (with record), else null}.
216
+ dms: a PR link to each reviewer of an open, non-draft PR with
217
+ no link recorded; reactions: git_merged on each recorded link
218
+ of a merged card. record is the command to run once sent.
219
+ While Slack isn't ready: {waiting} and nothing owed
220
+ review digest pending reviews as JSON; due weekday mornings from 09:00
221
+ review digest sent <reviewer> --ts <ts> records a digest in data/review-digests.json;
222
+ --channel <dm> --items <key,key> marks today sent in the Slack identity timezone
140
223
  rules list the hub rules, then with --site the board's, one
141
224
  "<hub|board> <id> <owner|claude> <text>" line each
142
225
  rules add --text <t> [--hub] [--by claude] a rule in board.json, or with --hub in the hub's
@@ -144,37 +227,110 @@ creating the issue and running item set <wave>/<id> --ticket <id> (followup set
144
227
  --by claude when you codify one on the owner's word
145
228
  rules edit <id> --text <t> [--hub] rewords a rule, keeping who added it
146
229
  rules remove <id> [--hub] refuses an id the list doesn't have
147
- settings the board's settings as JSON, each false when board.json
148
- leaves it out: {"auto_merge": false, "auto_build": false}
149
- settings set auto-merge on|off on: monitor merges an approved PR once CI is green and
230
+ settings the board's settings as JSON; flags default off, optional
231
+ settings appear when set: {"auto_merge": false,
232
+ "auto_build": false, "auto_pull": false,
233
+ "auto_triage": false, "github_login": "owner"}
234
+ settings set auto-merge on|off on: the session merges an approved PR once CI is green and
150
235
  the merge state is CLEAN. off (the default): the card
151
- shows the owner a Merge button, and monitor merges on its
236
+ shows the owner a Merge button, and the session merges on its
152
237
  card-merge event. Board Settings' toggle writes it too
153
238
  build <wave>/<id> --site <route> asks the hub to run this card's .kickflip/build; prints
154
- started and exits. install is an alias. The hub records
155
- data/try/<id>.log and writes failures to the thread
239
+ --asked "<owner's words>" started and exits. install is an alias. Only the owner's
240
+ Serve / Build and Auto-build start a card run, so --asked
241
+ must quote the owner's ask, card message or answer note on
242
+ this board that asked for it; the words go in a thread
243
+ line on the card. The hub records data/try/<id>.log and
244
+ writes failures to the thread. Web Visit opens
245
+ https://<host>:<try port>/ at its root
156
246
  main set --install <url> [--install-sha <sha>] publishes main's app install to data/main.json
247
+ settings set github-login <login> the GitHub account Claude posts as on this board. Its
248
+ comments carrying <!-- claude-bridge --> are Claude\u2019s own
249
+ and dropped; its other comments are the owner\u2019s. Unset,
250
+ the hub asks gh api user. Pass "" to clear it
157
251
  settings set auto-build on|off on: each push builds its card. Off by default.
158
252
  Main builds after every merge either way
159
- builder start <wave>/<id> [--agent <name>] [--kind <opus|codex|sonnet|install|\u2026>] [--label <who>]
160
- [--progress <text>] [--eta <ISO time>] one record per agent on the item; --agent defaults to main.
253
+ settings set auto-pull on|off on: while no builder runs and nothing waits in Orchestrator
254
+ review, the board server sends card-pull {key} for the top
255
+ Todo card nothing blocks, holds or asks about, ready cards
256
+ first; with none, card-plan {key} for the top unready
257
+ card to grill or prototype. Off by default.
258
+ Only on the owner's word
259
+ settings set auto-triage on|off on: while the board is idle and Todo changed since the last
260
+ triage, at most once a day and before any pull, the board
261
+ server declares topic todo-triage-<date> ("Todo triage
262
+ <date>") and sends todo-triage {date, topic}; the pull
263
+ waits until you reply to it. Off by default. Only on the
264
+ owner's word
265
+ settings set tickets <json> the board's ticket source, as Board Settings' Tickets row
266
+ saves it: {"source":"internal","prefix":"OPS"},
267
+ {"source":"github","account":"<gh login>"} or
268
+ {"source":"linear","workspace","team","project"}. A
269
+ GitHub account runs the board's issue calls as that gh
270
+ login; without one they run as gh's active account
271
+ builder start <wave>/<id> [--agent <name>] [--kind <claude|codex|prototype|grill|install|\u2026>] [--label <who>]
272
+ [--model <opus|sonnet>] the Claude model running the builder, recorded and printed as
273
+ "model: Claude Sonnet" (kind claude takes builder pick's model;
274
+ codex prints "model: Codex"). The thread's agent line reads it: "Claude
275
+ Sonnet builder started"; the label carries no model word. A
276
+ build refuses the model the hub's Claude model rules out.
277
+ A prototype defaults to sonnet and a grill to opus:
278
+ "Claude Sonnet prototype started"
279
+ [--phase <phase> --progress <detail>] one record per agent on the item; --agent defaults to main.
280
+ [--eta <ISO time>] --phase and --progress take what builder progress takes.
161
281
  --kind install: a build of the card's install, whose
162
- Install badge reads Building\u2026 meanwhile
282
+ Install badge reads Building\u2026 meanwhile. --kind claude or
283
+ codex refuses the one builder pick rules out; --kind build
284
+ records the pick's kind and prints "kind: <kind>. <reason>";
285
+ on the open record a Build tap started or --dispatch
286
+ opened, it keeps that record's kind and worktree.
287
+ [--dispatch] --dispatch: the session runs this right before it launches
288
+ an agent of any kind (build, prototype, grill) so the record
289
+ is open at launch and the card reads Starting; the agent's
290
+ own builder start takes it up.
291
+ A build (--kind build, claude or codex) on an open card sets
292
+ --status building first, refusing what that refuses;
293
+ Prints "ref: <ref>", the card's label, which commit subjects start with.
294
+ Resolves the card's answered questions, noting "Acted on:
295
+ builder started"
163
296
  [--worktree [--repo <dir>]] --worktree: a git worktree for the builder at
164
297
  ~/.claude/kickflip/worktrees/<id> on a new branch <id> from
165
298
  the board's branch of its clone (--repo overrides the clone), kept on
166
299
  the record and printed as "worktree: <path>". Refuses when
167
300
  that path or branch exists
168
- builder progress <wave>/<id> (<text> | --text <t>) one short present-tense line
169
- [--agent <name>]
301
+ builder progress <wave>/<id> --phase <phase> one status line: a phase, reading, building, testing,
302
+ (<detail> | --text <d>) [--agent <name>] checking or landing, and a present-tense detail of at most
303
+ 80 characters in plain words, which the owner reads at a
304
+ glance; a longer detail is refused with its length. Hashes,
305
+ test counts and file names go in the hand-back. The thread
306
+ line reads "Testing: <detail>", "Codex testing: <detail>"
307
+ for another agent, and the card "Testing \xB7 <detail>"
170
308
  [--eta <ISO time> | --clear-eta] an ETA shows as a line under the card's status
171
309
  A progress line, --progress included, needs --site: it is a status line in the item's thread, and
172
310
  the card's status shows the newest one from an agent still working
173
311
  builder done <wave>/<id> [--agent <name>] marks that agent's record done; the item's thread
174
- shows when it started and finished; clears building/fixing
175
- when the card has no open builder records left
312
+ [--next <t>] shows when it started and finished; clears building/fixing
313
+ when the card has no open builder records left. Closing the
314
+ last one of a card left In Progress with no Next is refused
315
+ without --next, which sets it; item set --status checking
316
+ and land close the records themselves
176
317
  builder takes --dir <dir> for a wave file in <dir>; its records go in <dir>/agents
177
- land <wave>/<id> [--repo <dir>] [--dir <dir>] brings the worktree its builder record keeps (else
318
+ builder pick <wave>/<id> who builds the card, from the hub's Codex share and the pause
319
+ line, and for claude which model, from the hub's Claude model
320
+ and the card's --size and --model: "codex: <reason>" or
321
+ "claude sonnet: <reason>". Pass that kind to builder start
322
+ --kind, and launch that model
323
+ builder call <wave>/<id> <judgment call> appends one line to the agent's open builder record: a
324
+ [--agent <name>] judgment call as the builder makes it, or a "Question: \u2026"
325
+ for the session; refused with no open record. A builder start
326
+ on a record with unverified calls resumes that build, keeping
327
+ its calls and worktree. The thread shows them, collapsed
328
+ builder calls <wave>/<id> [--agent <name>] prints the record's calls, numbered, then "verified <time>"
329
+ or "not verified yet"
330
+ builder verified <wave>/<id> [--agent <name>] the session's mark that it checked the record's calls; land
331
+ [--note <t>] refuses while any record on the card has a call after it
332
+ land <wave>/<id> --text <t> [--repo <dir>] brings the worktree its builder record keeps (else
333
+ [--dir <dir>]
178
334
  ~/.claude/kickflip/worktrees/<id> of --repo) into main, one line
179
335
  per step: refuses while it has uncommitted changes or adds no
180
336
  commit; rebases onto main when main moved, refusing on a
@@ -184,24 +340,40 @@ creating the issue and running item set <wave>/<id> --ticket <id> (followup set
184
340
  fast-forwards main in the repo;
185
341
  restarts the hub when its code changed, else each board
186
342
  server when board/ changed; removes the worktree and its
187
- branch. Never pushes. KICKFLIP_RESTART_CMD='["<cmd>"]' replaces
343
+ branch. Never pushes. One land runs at a time on the host: a
344
+ second refuses, naming the card landing. With --site, --text <what was checked>
345
+ is required, and once it lands the card closes as item set
346
+ --status done --text does; it refuses first what that close
347
+ would. KICKFLIP_RESTART_CMD='["<cmd>"]' replaces
188
348
  the restarts, called with hub or board <route>
349
+ merge <wave>/<id> [--after-approval "<why trivial>"] merges the card's PR (gh pr merge --squash) and records it merged,
350
+ [--confirmed "<owner's words>"] once GitHub reads it approved, its checks green with none
351
+ pending and its merge state CLEAN, the test the Merge button
352
+ uses. Refuses, naming each reason ("pending: 2 checks"),
353
+ commits after the newest approval unless --after-approval
354
+ says why they're trivial (its closing line says so), and a
355
+ card with manual steps unless --confirmed quotes the owner.
356
+ A refusal also goes in the thread while the owner's Merge waits
357
+ arch file <wave>/<id> turns the architecture review audit card's answered findings
358
+ into cards in the review's wave: titled with the picked
359
+ option's label, its detail, practice and the owner's note as
360
+ notes, each after the wave's last card, its question resolved
361
+ "Filed as <ref>."; a Skip pick resolves its question alone.
362
+ Prints "filed: <ref> from <id>", "skipped: <id>", and
363
+ "waiting: <ids>" while any are unanswered; once none is, it
364
+ closes the audit card as done
189
365
  push --kind action|prompt|fault --title <t> runs kickflip push with these flags, adding
190
366
  [--body <b>] [--url </route/path>] "\xB7 and N replies" to the body for the replies
191
367
  [--tag <tag>] [--now | --urgent] written since the site's last push through this
192
- command (none before its first). For an item, tag it
193
- ask-<eventId> or item-<wave>/<id>; a card whose action
194
- changes pushes again under its tag. It records the
195
- push in data/push-state.json only when kickflip push
196
- succeeds, and exits with kickflip push's code.
197
- --kind: action when a card's Action needed appears or
198
- changes, fault for what only the owner can fix. Refused
199
- without one: news stays on the board.
200
- Without --now it queues until the tick ends (checked) or
201
- the hub's next check: drafts on Ready, Merge. --now sends
202
- at once unless pushes are held (overnight, snoozed or the
203
- weekend): questions, steps only the owner can run,
204
- prototypes asked for. --urgent: a production fault only;
205
- it beats those holds. While notifications are off every
206
- push is dropped, urgent too
207
- KICKFLIP_PUSH_CMD='["<cmd>","<arg>"]' replaces \`node ../../bin/kickflip.mjs push\`; the flags follow it`;class r extends Error{static{l(this,"UsageError")}}const W=new Set(["clear-status","clear-next","urgent","now","clear-eta","held","unheld","idle","hub","clear-install","force","worktree","dry-run"]),J=new Set(["take"]),G=f.join(f.dirname(C(import.meta.url)),"..","..","bin","kickflip.mjs");function z(){if(!process.env.KICKFLIP_PUSH_CMD)return[process.execPath,G,"push"];try{const e=JSON.parse(process.env.KICKFLIP_PUSH_CMD);if(Array.isArray(e)&&e.length&&e.every(s=>typeof s=="string"))return e}catch{}throw new n.BoardError("KICKFLIP_PUSH_CMD must be a JSON array of strings")}l(z,"pushCommand");async function Q(e,s){const t=B(s.kind);if(t)throw new r(t);if(s.title===void 0)throw new r("push needs --title");const a=new Date,i=await n.repliesSincePush(e,a),o=n.withReplies(s.body,i),d={kind:s.kind,title:s.title,body:o||void 0,url:n.pushUrl(s.url),tag:s.tag},[c,...p]=z(),u=[...p,...Object.entries(d).flatMap(([v,m])=>m===void 0?[]:[`--${v}`,m]),...s.urgent?["--urgent"]:[],...s.now?["--now"]:[]],h=O(c,u,{stdio:"inherit"});if(h.status!==0)throw Object.assign(new n.BoardError(`kickflip push failed (${h.error?.message||`exit ${h.status??h.signal}`}); the push was not recorded`),{exitCode:h.status||1});return n.recordPush(e,a)}l(Q,"push");function X(e){const s=Object.create(null),t=[];for(let a=0;a<e.length;a++){const i=e[a];if(!i.startsWith("--")){t.push(i);continue}const o=i.slice(2);if(J.has(o)){if(a+1>=e.length)throw new r(`--${o} needs a value`);(s[o]||=[]).push(e[++a]);continue}if(Object.hasOwn(s,o))throw new r(`--${o} is given twice`);if(W.has(o))s[o]=!0;else if(a+1<e.length)s[o]=e[++a];else throw new r(`--${o} needs a value`)}return{flags:s,rest:t}}l(X,"parse");const V=["html","text","note","notes","summary","title","body","next","progress","install-label","confirmed"],Y=/^(?:\/|~\/|\.{1,2}\/)\S*\.(?:html?|md|json|txt)$/;function Z(e){const s=e.trim();if(!s||/\s/.test(s))return!1;if(Y.test(s))return!0;try{return g.statSync(s).isFile()}catch{return!1}}l(Z,"looksLikePath");function ee(e,s){for(const t of V){if(typeof s[t]!="string"||!Z(s[t]))continue;const a=e.includes("file")?`; for a file use --file ${s[t].trim()}`:"";throw new r(`--${t} takes text, not a file path (${s[t].trim()})${a}`)}if(typeof s.file=="string"&&s.file!=="-"&&!g.existsSync(s.file))throw new r(`--file ${s.file}: no such file`)}l(ee,"checkInputs");const A=l(e=>g.readFileSync(e==="-"?0:e,"utf8"),"readInput");function x(e){if(!e)throw new r("--file <path> is required");try{return JSON.parse(A(e))}catch(s){throw new n.BoardError(`${e}: ${s.message}`)}}l(x,"readJSONInput");function P(e){if(e.plan!==void 0&&e["notes-file"]!==void 0)throw new r("pass --notes-file or --plan, not both");return e["notes-file"]??e.plan}l(P,"notesFileOf");const b={reply:[["eventId"],["html","file"],(e,[s],t)=>{if(t.html===void 0==(t.file===void 0))throw new r("reply takes --html or --file");return n.writeReply(e,s,t.html??A(t.file))}],thread:[["wave/id"],["text","link","who","via"],(e,[s],t)=>n.appendThread(e,s,t)],"topic add":[["id"],["title","summary"],(e,[s],t)=>n.addTopic(e,{id:s,...t})],"question add":[[],["file"],(e,s,t)=>n.addQuestions(e,x(t.file))],"question resolve":[["id"],["note"],(e,[s],t)=>n.resolveQuestion(e,s,t.note)],"prototype add":[["topic"],["title","take","card"],(e,[s],t)=>n.addPrototype(e,{topic:s,title:t.title,card:t.card,takes:t.take})],"prototype list":[[],[],e=>n.listPrototypes(e)],"prototype rm":[["topic"],[],(e,[s])=>n.removePrototype(e,s)],"item set":[["wave/id"],["status","clear-status","next","clear-next","pr","from-ask","held","unheld","notes-file","plan","deps","install","install-sha","install-label","clear-install","title","force","ticket","confirmed"],(e,[s],t,a)=>n.setItem(e,s,{status:t.status,clearStatus:t["clear-status"],next:t.next,clearNext:t["clear-next"],pr:t.pr,fromAsk:t["from-ask"],held:t.held,unheld:t.unheld,notesFile:P(t),deps:t.deps,install:t.install,installSha:t["install-sha"],installLabel:t["install-label"],clearInstall:t["clear-install"],title:t.title,force:t.force,ticket:t.ticket,confirmed:t.confirmed},a)],"item add":[["wave/id"],["title","notes","deps","notes-file","plan","ticket"],(e,[s],t,a)=>n.addItem(e,s,{title:t.title,notes:t.notes,deps:t.deps,notesFile:P(t),ticket:t.ticket},a)],"item relate-ask":[["eventId","wave/id"],["summary"],(e,[s,t],a)=>n.relateAsk(e,s,t,a.summary)],"ask progress":[["eventId"],["next"],(e,[s],t)=>n.markAsk(e,s,"progress",t.next)],"ask done":[["eventId"],[],(e,[s])=>n.markAsk(e,s,"done")],"ask unfold":[["eventId"],[],(e,[s])=>n.unfoldAsk(e,s)],"ask move":[["eventId"],["to"],(e,[s],t)=>n.moveAsk(e,s,t.to)],"followup add":[["wave"],["id","title","from","ticket"],(e,[s],t,a)=>n.addFollowup(e,s,t,a)],"tickets backfill":[[],["dry-run"],(e,s,t,a)=>n.backfillTickets(e,{dryRun:t["dry-run"]},a)],"followup done":[["wave","id"],["force"],(e,[s,t],a)=>n.finishFollowup(e,s,t,{force:a.force})],"followup set":[["wave","id"],["ticket"],(e,[s,t],a)=>n.setFollowupTicket(e,s,t,a.ticket)],"reviewers set":[[],["file"],(e,s,t)=>n.setReviewers(e,x(t.file))],"reviewers add":[[],["file"],(e,s,t)=>n.addReviewers(e,x(t.file))],"reviewers remove":[["...name"],[],(e,s)=>n.removeReviewers(e,s)],"rules list":[[],[],e=>n.listRules(e)],"rules add":[[],["text","hub","by"],(e,s,t)=>n.addRuleTo(e,t)],"rules edit":[["id"],["text","hub"],(e,[s],t)=>n.editRuleIn(e,s,t)],"rules remove":[["id"],["hub"],(e,[s],t)=>n.removeRuleFrom(e,s,t)],settings:[[],[],async e=>({lines:[JSON.stringify(await n.readBoardSettings(e))]})],build:[["wave/id"],[],async(e,[s])=>{if(!e)throw new n.BoardError("build needs --site <route>");n.parseKey(s);try{const t=await fetch(`http://127.0.0.1:${process.env.KICKFLIP_HUB_PORT||4500}/_hub/build`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({route:f.basename(e),key:s}),signal:AbortSignal.timeout(1e4)}),a=await t.json();if(!t.ok)throw new n.BoardError(a.error||"The hub refused the build.");return{lines:["started"]}}catch(t){throw t instanceof n.BoardError?t:new n.BoardError(`Could not start the build: ${t.message}`)}}],"main set":[[],["install","install-sha"],(e,s,t)=>n.setMainInstall(e,{install:t.install,installSha:t["install-sha"]})],"settings set":[["name","on|off"],[],(e,[s,t])=>n.setBoardSetting(e,s,t)],"builder start":[["wave/id"],["label","progress","dir","agent","kind","eta","worktree","repo"],(e,[s],{worktree:t,repo:a,...i})=>{if(a!==void 0&&!t)throw new r("--repo goes with --worktree");const o=M(),d=e?K(e,o):null,c=d?D(d.route,o):{},p=!!c.github,u=a??(p&&c.repo||void 0),h=p&&c.branch||"main";return n.startBuilder(e,s,{...i,worktree:t&&(()=>q(s.split("/")[1],{repo:u,base:h,remote:p}))})}],"builder progress":[["wave/id","...text?"],["text","dir","agent","eta","clear-eta"],(e,[s,...t],a)=>{if(t.length&&a.text!==void 0)throw new r("builder progress takes its text once: as words or as --text");if(!t.length&&a.text===void 0)throw new r("builder progress needs its text, as words or as --text");return n.builderProgress(e,s,a.text??t.join(" "),{...a,clearEta:a["clear-eta"]})}],"builder done":[["wave/id"],["dir","agent"],(e,[s],t)=>n.stopBuilder(e,s,t)],land:[["wave/id"],["repo","dir"],async(e,[s],t)=>{const a=s.split("/")[1],i=await n.recordedWorktree(e,s,{dir:t.dir}),o=f.resolve(t.repo??i?.repo??L());return T({path:i?.path??f.join(N(),a),branch:i?.branch??a,repo:o}),{lines:[]}}],working:[["eventId"],[],(e,[s])=>n.setWorking(e,s)],"hello-ack":[["eventId"],[],(e,[s])=>n.ackHello(e,s)],checked:[[],["every","idle"],(e,s,t)=>n.writeChecked(e,t.every,{idle:t.idle})],push:[[],["kind","title","body","url","tag","urgent","now"],(e,s,t)=>Q(e,t)]};b.install=b.build;async function te(e,s={}){try{const{flags:t,rest:a}=X(e),i=S(b,`${a[0]} ${a[1]}`)?`${a[0]} ${a[1]}`:a[0],o=S(b,i);if(!o)throw new r(a.length?`unknown command "${a.slice(0,2).join(" ")}"`:"no command given");const[d,c,p]=o,u=a.slice(i.split(" ").length),h=d.at(-1)?.startsWith("..."),v=d.at(-1)?.endsWith("?")?d.length-1:d.length;if(h?u.length<v:u.length!==d.length)throw new r(`${i} takes ${d.map(w=>`<${w.replace(/^\.\.\.|\?$/g,"")}>`).join(" ")||"no arguments"}`);const{site:m,...y}=t,I=Object.keys(y).filter(w=>!c.includes(w));if(I.length)throw new r(`${i} does not take ${I.map(w=>"--"+w).join(", ")}`);ee(c,y);const $=m===void 0?null:await n.siteDir(m),k=await p($,u,y,s),{file:j,lines:R=[]}=typeof k=="object"&&k?k:{file:k};i.startsWith("builder ")?console.log(`${i.slice(8)} ${u[0]}`):j!==void 0&&console.log(`${i} \u2192 ${j}`);for(const w of R)console.log(w);return 0}catch(t){if(t instanceof r)return console.error(`${t.message} (node board.mjs --help lists the commands)`),2;if(t instanceof n.BoardError)return console.error(t.message),t.exitCode??1;throw t}}if(l(te,"main"),process.argv[1]&&import.meta.url===E(g.realpathSync(process.argv[1])).href){H();const e=process.argv.slice(2);!e.length||e.includes("--help")||e[0]==="help"?console.log(U):process.exitCode=await te(e)}export{U as USAGE,te as main};
368
+ command (none before its first). The board server pushes
369
+ each card's Action needed itself, so this is for a fault,
370
+ what only the owner can fix. It records the push in
371
+ data/push-state.json only when kickflip push succeeds,
372
+ and exits with kickflip push's code. Refused without an
373
+ allowed --kind: news stays on the board. Without --now
374
+ it queues until the tick ends (checked) or the hub's
375
+ next check; --now sends at once unless pushes are held
376
+ (overnight, snoozed or the weekend). --urgent: a
377
+ production fault only; it beats those holds. While
378
+ notifications are off every push is dropped, urgent too
379
+ KICKFLIP_PUSH_CMD='["<cmd>","<arg>"]' replaces \`node ../../bin/kickflip.mjs push\`; the flags follow it`;class o extends Error{static{n(this,"UsageError")}}const V=new Set(["clear-status","clear-next","urgent","now","clear-eta","held","unheld","idle","hub","clear-install","force","worktree","dry-run","dispatch"]),X=new Set(["take"]);function Z(e){const t=Object.create(null),s=[];for(let a=0;a<e.length;a++){const r=e[a];if(!r.startsWith("--")){s.push(r);continue}const d=r.slice(2);if(X.has(d)){if(a+1>=e.length)throw new o(`--${d} needs a value`);(t[d]||=[]).push(e[++a]);continue}if(Object.hasOwn(t,d))throw new o(`--${d} is given twice`);if(V.has(d))t[d]=!0;else if(a+1<e.length)t[d]=e[++a];else throw new o(`--${d} needs a value`)}return{flags:t,rest:s}}n(Z,"parse");const Y=["html","text","note","notes","summary","title","body","next","progress","install-label","confirmed","asked"],ee=/^(?:\/|~\/|\.{1,2}\/)\S*\.(?:html?|md|json|txt)$/;function te(e){const t=e.trim();if(!t||/\s/.test(t))return!1;if(ee.test(t))return!0;try{return w.statSync(t).isFile()}catch{return!1}}n(te,"looksLikePath");function se(e,t){for(const s of Y){if(typeof t[s]!="string"||!te(t[s]))continue;const a=e.includes("file")?`; for a file use --file ${t[s].trim()}`:"";throw new o(`--${s} takes text, not a file path (${t[s].trim()})${a}`)}if(typeof t.file=="string"&&t.file!=="-"&&!w.existsSync(t.file))throw new o(`--file ${t.file}: no such file`)}n(se,"checkInputs");const b=n(e=>w.readFileSync(e==="-"?0:e,"utf8"),"readInput");function v(e){if(!e)throw new o("--file <path> is required");try{return JSON.parse(b(e))}catch(t){throw new i.BoardError(`${e}: ${t.message}`)}}n(v,"readJSONInput");function y(e){if(e.plan!==void 0&&e["notes-file"]!==void 0)throw new o("pass --notes-file or --plan, not both");return e["notes-file"]??e.plan}n(y,"notesFileOf");function O(e){if(e.note!==void 0&&e.file!==void 0)throw new o("pass --note or --file, not both");return e.file===void 0?e.note:b(e.file)}n(O,"noteOf");const g={pr:[["wave/id"],[],async(e,[t])=>({lines:[JSON.stringify(await i.prReport(e,t))]})],reply:[["eventId"],["html","file"],(e,[t],s)=>{if(s.html===void 0==(s.file===void 0))throw new o("reply takes --html or --file");return i.writeReply(e,t,s.html??b(s.file))}],thread:[["wave/id"],["text","link","who","via"],(e,[t],s)=>i.appendThread(e,t,s)],"topic add":[["id"],["title","summary"],(e,[t],s)=>i.addTopic(e,{id:t,...s})],"question add":[[],["file"],async(e,t,s)=>{const a=v(s.file);return{...await i.addQuestions(e,a),asked:[a].flat()}}],"question resolve":[["id"],["note"],(e,[t],s)=>i.resolveQuestion(e,t,s.note)],"prototype add":[["topic"],["title","take","card"],(e,[t],s)=>i.addPrototype(e,{topic:t,title:s.title,card:s.card,takes:s.take})],"prototype list":[[],[],e=>i.listPrototypes(e)],"prototype rm":[["topic"],[],(e,[t])=>i.removePrototype(e,t)],"item set":[["wave/id"],["status","clear-status","next","clear-next","pr","pushed","gh-since","from-ask","state","held","unheld","pick-up-at","notes-file","plan","deps","parent","related","install","install-sha","install-label","clear-install","title","size","model","force","ticket","text"],(e,[t],s,a)=>i.setItem(e,t,{status:s.status,clearStatus:s["clear-status"],next:s.next,clearNext:s["clear-next"],pr:s.pr,pushed:s.pushed,ghSince:s["gh-since"],fromAsk:s["from-ask"],state:s.state,held:s.held,unheld:s.unheld,pickUpAt:s["pick-up-at"],notesFile:y(s),deps:s.deps,parent:s.parent,related:s.related,install:s.install,installSha:s["install-sha"],installLabel:s["install-label"],clearInstall:s["clear-install"],title:s.title,size:s.size,model:s.model,force:s.force,ticket:s.ticket,text:s.text},a)],"item add":[["wave[/id]"],["title","notes","deps","notes-file","plan","ticket","pick-up-at","parent","size","model"],(e,[t],s,a)=>i.addItem(e,t,{title:s.title,notes:s.notes,deps:s.deps,notesFile:y(s),ticket:s.ticket,pickUpAt:s["pick-up-at"],parent:s.parent,size:s.size,model:s.model},a)],"item relate-ask":[["eventId","wave/id"],["summary"],(e,[t,s],a)=>i.relateAsk(e,t,s,a.summary)],"ask progress":[["eventId"],["next"],(e,[t],s)=>i.markAsk(e,t,"progress",s.next)],"ask done":[["eventId"],[],(e,[t])=>i.markAsk(e,t,"done")],"ask unfold":[["eventId"],[],(e,[t])=>i.unfoldAsk(e,t)],"ask move":[["eventId"],["to"],(e,[t],s)=>i.moveAsk(e,t,s.to)],"tickets backfill":[[],["dry-run"],(e,t,s,a)=>i.backfillTickets(e,{dryRun:s["dry-run"]},a)],"lineup create":[["slug"],["title","goal","cards","note","file"],(e,[t],s)=>i.createLineup(e,t,{title:s.title,goal:s.goal,cards:s.cards,note:O(s)})],"lineup add":[["slug","wave/id"],["after"],(e,[t,s],a)=>i.changeLineup(e,t,{add:s,after:a.after})],"lineup remove":[["slug","wave/id"],[],(e,[t,s])=>i.changeLineup(e,t,{remove:s})],"lineup set":[["slug"],["title","goal","note","file"],(e,[t],s)=>i.changeLineup(e,t,{title:s.title,goal:s.goal,note:O(s)})],"lineup finish":[["slug"],[],(e,[t])=>i.finishLineup(e,t)],slack:[[],[],()=>({lines:[JSON.stringify(L())]})],"slack set":[[],["self-dm","user","domain","timezone"],async(e,t,s)=>{const a={"self-dm":"self_dm",user:"owner_slack_user",domain:"slack_domain",timezone:"timezone"};try{return{lines:[JSON.stringify(await H(Object.fromEntries(Object.entries(s).map(([r,d])=>[a[r],d]))))]}}catch(r){throw new i.BoardError(r.message)}}],integrations:[[],[],async()=>({lines:[JSON.stringify(await N.rows())]})],"integrations report":[[],["slack"],async(e,t,s)=>{if(!["yes","no"].includes(s.slack))throw new o("integrations report takes --slack yes|no");if(!e)throw new i.BoardError("integrations report needs --site <route>");const a=m.basename(e);return E(s.slack==="yes",{route:a,title:U().sites?.[a]?.title||(await i.boardConfig(e)).title}),{lines:[`Slack connector reported: ${s.slack}.`]}}],"review sent":[["wave/id","reviewer"],["ts","channel"],(e,[t,s],a)=>i.reviewSent(e,t,s,a)],"review react":[["wave/id","reviewer","emoji"],[],(e,[t,s,a])=>i.reviewReact(e,t,s,a)],"review digest":[[],[],async(e,t,s,a)=>({lines:[JSON.stringify(await i.reviewDigest(e,a))]})],"review due":[[],[],async(e,t,s,a)=>({lines:[JSON.stringify(await i.reviewDue(e,a))]})],"review digest sent":[["reviewer"],["ts","channel","items"],(e,[t],s,a)=>i.reviewDigestSent(e,t,s,a)],"reviewers set":[[],["file"],(e,t,s)=>i.setReviewers(e,v(s.file))],"reviewers add":[[],["file"],(e,t,s)=>i.addReviewers(e,v(s.file))],"reviewers remove":[["...name"],[],(e,t)=>i.removeReviewers(e,t)],"rules list":[[],[],e=>i.listRules(e)],"rules add":[[],["text","hub","by"],(e,t,s)=>i.addRuleTo(e,s)],"rules edit":[["id"],["text","hub"],(e,[t],s)=>i.editRuleIn(e,t,s)],"rules remove":[["id"],["hub"],(e,[t],s)=>i.removeRuleFrom(e,t,s)],settings:[[],[],async e=>({lines:[JSON.stringify(await i.readBoardSettings(e))]})],build:[["wave/id"],["asked"],async(e,[t],s)=>{if(!e)throw new i.BoardError("build needs --site <route>");i.parseKey(t);const a=await i.askedGate(e,t,s.asked);try{const r=await fetch(`http://127.0.0.1:${process.env.KICKFLIP_HUB_PORT||4500}/_hub/build`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({route:m.basename(e),key:t}),signal:AbortSignal.timeout(1e4)}),d=await r.json();if(!r.ok)throw new i.BoardError(d.error||"The hub refused the build.");return{lines:["started",...(await i.appendThread(e,t,{text:a})).lines]}}catch(r){throw r instanceof i.BoardError?r:new i.BoardError(`Could not start the build: ${r.message}`)}}],"main set":[[],["install","install-sha"],(e,t,s)=>i.setMainInstall(e,{install:s.install,installSha:s["install-sha"]})],"settings set":[["name","value"],[],(e,[t,s])=>i.setBoardSetting(e,t,s)],"builder start":[["wave/id"],["label","phase","progress","dir","agent","kind","model","eta","worktree","repo","dispatch"],(e,[t],{worktree:s,repo:a,...r})=>{if(a!==void 0&&!s)throw new o("--repo goes with --worktree");return i.startBuilder(e,t,{...r,worktree:s&&(()=>D(e,t.split("/")[1],{repo:a}))})}],"builder progress":[["wave/id","...text?"],["phase","text","dir","agent","eta","clear-eta"],(e,[t,...s],a)=>{if(s.length&&a.text!==void 0)throw new o("builder progress takes its text once: as words or as --text");if(!s.length&&a.text===void 0)throw new o("builder progress needs its text, as words or as --text");return i.builderProgress(e,t,a.text??s.join(" "),{...a,clearEta:a["clear-eta"]})}],"builder done":[["wave/id"],["dir","agent","next"],(e,[t],s)=>i.stopBuilder(e,t,{...s,requireNext:!0})],"builder pick":[["wave/id"],[],(e,[t])=>i.pickBuilder(e,t)],"builder call":[["wave/id","...text"],["dir","agent"],(e,[t,...s],a)=>i.recordCall(e,t,s.join(" "),a)],"builder calls":[["wave/id"],["dir","agent"],(e,[t],s)=>i.listCalls(e,t,s)],"builder verified":[["wave/id"],["dir","agent","note"],(e,[t],s)=>i.verifyCalls(e,t,s)],land:[["wave/id"],["repo","dir","text"],async(e,[t],s)=>{const a=t.split("/")[1];if(e&&s.text===void 0)throw new o(`land needs --text "<what was checked>", which closes ${t} as done once it lands`);if(!e&&s.text!==void 0)throw new o("--text closes the card, which needs --site");return W(e?await i.cardName(e,t):t,async()=>{e&&await i.checkClose(e,t,s.text),await i.checkCallsVerified(e,t,{dir:s.dir});const r=await i.recordedWorktree(e,t,{dir:s.dir}),d=m.resolve(s.repo??r?.repo??M(e).repo);return z({path:r?.path??m.join(G(),a),branch:r?.branch??a,repo:d}),e?i.setItem(e,t,{status:"done",text:s.text}):{lines:[]}})}],merge:[["wave/id"],["after-approval","confirmed"],(e,[t],s)=>i.mergeCard(e,t,{afterApproval:s["after-approval"],confirmed:s.confirmed})],"arch file":[["wave/id"],[],(e,[t])=>e?J(e,t):Promise.reject(new i.BoardError("arch file needs --site <route>"))],checked:[[],["every","idle"],(e,t,s)=>i.writeChecked(e,s.every,{idle:s.idle})],push:[[],["kind","title","body","url","tag","urgent","now"],(e,t,s)=>{const a=K(s.kind);if(a)throw new o(a);if(s.title===void 0)throw new o("push needs --title");return i.sendPush(e,s)}]};g.install=g.build;const l=n((e,t)=>i.cardName(e,t),"card"),C=n((e,t)=>`${t}${e.length===1?"":"s"} ${e.join(", ")}`,"plural"),T=n(e=>e.agent===void 0||e.agent==="main"?"builder":`builder ${e.agent}`,"builderOf");function ae(e){const t=e["pick-up-at"];return[e.status,e["clear-status"]&&"status cleared",e.next!==void 0&&(e.next.trim()?"next line set":"next line cleared"),e["clear-next"]&&"next line cleared",e.pr!==void 0&&`PR #${e.pr}`,e.pushed!==void 0&&`pushed ${e.pushed}`,e["gh-since"]&&`GitHub read to ${e["gh-since"]}`,e["from-ask"]&&`from task ${e["from-ask"]}`,e.state,e.held&&"held",e.unheld&&"resumed",t!==void 0&&(t?`held until ${t}`:"resumed"),y(e)!==void 0&&"notes recorded",e.deps!==void 0&&(e.deps?`blocked by ${e.deps}`:"deps cleared"),e.parent!==void 0&&(e.parent?`parent ${e.parent}`:"parent cleared"),e.related!==void 0&&(e.related?`related to ${e.related.split(",").join(", ")}`:"related cleared"),e.install!==void 0&&"install published",e["clear-install"]&&"install cleared",e.title!==void 0&&"renamed",e.ticket!==void 0&&`ticket ${e.ticket}`].filter(Boolean).join(", ")}n(ae,"itemChanges");const ie={reply:n(async(e,[t])=>`reply written to ${await i.eventCard(e,t)}`,"reply"),thread:n(async(e,[t])=>`thread line on ${await l(e,t)}`,"thread"),"topic add":n((e,[t])=>`topic ${t} added`,"topic add"),"question add":n(async(e,t,s,{asked:a})=>{const r=[...new Set(a.map(c=>c.topic))],d=r.length!==1?"":r[0].startsWith("item:")?` on ${await l(e,r[0].slice(5))}`:` on topic ${r[0]}`;return`${C(a.map(c=>c.id),"question")} added${d}`},"question add"),"question resolve":n((e,[t])=>`question ${t} resolved`,"question resolve"),"prototype add":n(async(e,[t],s)=>`prototype ${t} recorded${s.card?` for ${await l(e,s.card)}`:""}`,"prototype add"),"prototype rm":n((e,[t])=>`prototype ${t} removed`,"prototype rm"),"item set":n(async(e,[t],s)=>`${await l(e,t)}: ${ae(s)}`,"item set"),"item add":n(async(e,t,s,{key:a})=>`${await l(e,a)} added as ${a}`,"item add"),"item relate-ask":n(async(e,[t,s])=>`task ${t} folded into ${await l(e,s)}`,"item relate-ask"),"ask progress":n(async(e,[t])=>`${await l(e,`ask:${t}`)}: in progress`,"ask progress"),"ask done":n(async(e,[t])=>`${await l(e,`ask:${t}`)}: done`,"ask done"),"ask unfold":n((e,[t])=>`task ${t} back on a card of its own`,"ask unfold"),"ask move":n((e,[t],s)=>`task ${t} moved to /${s.to}`,"ask move"),checked:n((e,t,s,{every:a})=>a===null?"GitHub checked; no open PR":`GitHub checked; next in ${a} min`,"checked"),"lineup create":n((e,[t])=>`lineup ${t} created`,"lineup create"),"lineup add":n(async(e,[t,s])=>`${await l(e,s)} added to lineup ${t}`,"lineup add"),"lineup remove":n(async(e,[t,s])=>`${await l(e,s)} taken out of lineup ${t}`,"lineup remove"),"lineup set":n((e,[t])=>`lineup ${t} updated`,"lineup set"),"lineup finish":n((e,[t])=>`lineup ${t} finished`,"lineup finish"),"review sent":n(async(e,[t,s])=>`review link to ${s} recorded on ${await l(e,t)}`,"review sent"),"review react":n(async(e,[t,s,a])=>`${a} on ${s}'s review link recorded on ${await l(e,t)}`,"review react"),"review digest sent":n((e,[t])=>`digest to ${t} recorded`,"review digest sent"),"reviewers set":n(()=>"reviewers replaced","reviewers set"),"reviewers add":n(()=>"reviewers added","reviewers add"),"reviewers remove":n((e,t)=>`${C(t,"reviewer")} removed`,"reviewers remove"),"rules add":n((e,t,s)=>`${s.hub?"hub":"board"} rule added`,"rules add"),"rules edit":n((e,[t],s)=>`${s.hub?"hub":"board"} rule ${t} reworded`,"rules edit"),"rules remove":n((e,[t],s)=>`${s.hub?"hub":"board"} rule ${t} removed`,"rules remove"),"builder start":n(async(e,[t],s)=>`${await l(e,t)}: ${T(s)} started`,"builder start"),"builder progress":n(async(e,[t])=>`progress line on ${await l(e,t)}`,"builder progress"),"builder done":n(async(e,[t],s)=>`${await l(e,t)}: ${T(s)} done`,"builder done"),"builder call":n(async(e,[t])=>`judgment call recorded on ${await l(e,t)}`,"builder call"),"builder verified":n(async(e,[t])=>`${await l(e,t)}: judgment calls verified`,"builder verified"),land:n(async(e,[t])=>e?`${await l(e,t)}: landed and done`:null,"land"),merge:n(async(e,[t])=>`${await l(e,t)}: merged`,"merge"),"arch file":n(async(e,[t])=>`findings of ${await l(e,t)} filed`,"arch file")};async function ne(e,t={}){try{const{flags:s,rest:a}=Z(e),r=[3,2,1].map(h=>a.slice(0,h).join(" ")).find(h=>k(g,h)),d=k(g,r);if(!d)throw new o(a.length?`unknown command "${a.slice(0,2).join(" ")}"`:"no command given");const[c,x,R]=d,u=a.slice(r.split(" ").length),_=c.at(-1)?.startsWith("..."),q=c.at(-1)?.endsWith("?")?c.length-1:c.length;if(_?u.length<q:u.length!==c.length)throw new o(`${r} takes ${c.map(h=>`<${h.replace(/^\.\.\.|\?$/g,"")}>`).join(" ")||"no arguments"}`);const{site:$,...p}=s,S=Object.keys(p).filter(h=>!x.includes(h));if(S.length)throw new o(`${r} does not take ${S.map(h=>"--"+h).join(", ")}`);se(x,p);const I=$===void 0?null:await i.siteDir($),f=await R(I,u,p,t),A=k(ie,r),j=A&&await A(I,u,p,f);j&&console.log(j);for(const h of typeof f=="object"&&f?.lines||[])console.log(h);return 0}catch(s){if(s instanceof o)return console.error(`${s.message} (node board.mjs --help lists the commands)`),2;if(s instanceof i.BoardError)return console.error(s.message),s.exitCode??1;throw s}}if(n(ne,"main"),process.argv[1]&&import.meta.url===B(w.realpathSync(process.argv[1])).href){const e=process.argv.slice(2);!e.length||e.includes("--help")||e[0]==="help"?console.log(Q):process.exitCode=await ne(e)}export{Q as USAGE,ne as main};
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
- var y=Object.defineProperty;var c=(s,r)=>y(s,"name",{value:r,configurable:!0});import m from"node:fs";import g from"node:os";const h=120*1e3,w=5*1e3,$=/(?:\bbuilder|\bagent\.mjs)\s+start\s+["']?([^\s"';|&]+)/g,f=c((s,r)=>{const n=new RegExp(`--${r}(?:=|\\s+)(?:"([^"]*)"|'([^']*)'|([^\\s"';|&)]+))`,"g");let e;for(const t of s.matchAll(n))e=t[1]??t[2]??t[3];return e},"flagIn");function _(s){const r=[];for(const n of s.matchAll($)){const e=s.slice(n.index),t=e.slice(0,e.search(/\n|;|&&|\|\||\|(?!\|)|$/));r.push({key:n[1],site:f(t,"site")??f(s.slice(0,n.index),"site")??null,agent:f(t,"agent")??"main",dir:f(t,"dir")})}return r}c(_,"startsIn");const S=c(s=>s.replace(/^~(?=\/|$)/,g.homedir()).replace(/^\$(?:HOME|\{HOME\})(?=\/|$)/,g.homedir()),"expandHome");function b(s){const r=[],n=new Map;for(const e of s.split(`
3
- `)){const t=e.includes('"assistant"')&&/ start/.test(e)&&/builder|agent\.mjs/.test(e),l=n.size&&e.includes("tool_result")&&[...n.keys()].some(o=>e.includes(o));if(!t&&!l)continue;let i;try{i=JSON.parse(e)}catch{continue}const u=Date.parse(i.timestamp),p=Array.isArray(i.message?.content)?i.message.content:[];if(i.type==="assistant"&&!Number.isNaN(u))for(const o of p){if(o?.type!=="tool_use"||typeof o.input?.command!="string")continue;const a=_(o.input.command).map(d=>({...d,from:u-w,to:u+h}));r.push(...a),o.id&&a.length&&n.set(o.id,a)}else if(i.type==="user"&&!Number.isNaN(u))for(const o of p){const a=o?.type==="tool_result"&&n.get(o.tool_use_id);if(a){for(const d of a)d.to=Math.max(d.to,u+h);n.delete(o.tool_use_id)}}}return r}c(b,"startsInTranscript");async function N(){const r=JSON.parse(m.readFileSync(0,"utf8"))?.agent_transcript_path;if(typeof r!="string"||!r)throw new Error("no agent_transcript_path on stdin");const n=b(m.readFileSync(r,"utf8"));if(!n.length)return;(await import("../../bin/install.mjs")).migrateOnStart();const e=await import("../store.mjs");for(const t of n)try{if(t.site!==null&&!/^[\w-]+$/.test(t.site))throw new Error(`--site ${t.site} is not a route`);if(t.dir?.includes("$"))throw new Error(`--dir ${t.dir} names a shell variable`);if(t.key.includes("$")||t.agent.includes("$"))throw new Error("the key or --agent names a shell variable");const l=t.site===null?null:await e.siteDir(t.site),i=t.dir===void 0?void 0:S(t.dir);await e.stopBuilder(l,t.key,{dir:i,agent:t.agent,startedBetween:[t.from,t.to]})}catch(l){process.stderr.write(`builder-stop-hook: ${t.key}${t.agent==="main"?"":` --agent ${t.agent}`}: ${l.message}
4
- `)}}c(N,"main");try{await N()}catch(s){process.stderr.write(`builder-stop-hook: ${s.message}
2
+ var y=Object.defineProperty;var c=(s,o)=>y(s,"name",{value:o,configurable:!0});import g from"node:fs";import m from"node:os";const h=120*1e3,w=5*1e3,_=/(?:\bbuilder|\bagent\.mjs)\s+start\s+["']?([^\s"';|&]+)/g,p=c((s,o)=>{const n=new RegExp(`--${o}(?:=|\\s+)(?:"([^"]*)"|'([^']*)'|([^\\s"';|&)]+))`,"g");let e;for(const r of s.matchAll(n))e=r[1]??r[2]??r[3];return e},"flagIn");function k(s){const o=[];for(const n of s.matchAll(_)){const e=s.slice(n.index),r=e.slice(0,e.search(/\n|;|&&|\|\||\|(?!\|)|$/));o.push({key:n[1],site:p(r,"site")??p(s.slice(0,n.index),"site")??null,agent:p(r,"agent")??"main",dir:p(r,"dir")})}return o}c(k,"startsIn");const $=c(s=>s.replace(/^~(?=\/|$)/,m.homedir()).replace(/^\$(?:HOME|\{HOME\})(?=\/|$)/,m.homedir()),"expandHome");function b(s){const o=[],n=new Map;for(const e of s.split(`
3
+ `)){const r=e.includes('"assistant"')&&/ start/.test(e)&&/builder|agent\.mjs/.test(e),l=n.size&&e.includes("tool_result")&&[...n.keys()].some(i=>e.includes(i));if(!r&&!l)continue;let t;try{t=JSON.parse(e)}catch{continue}const a=Date.parse(t.timestamp),u=Array.isArray(t.message?.content)?t.message.content:[];if(t.type==="assistant"&&!Number.isNaN(a))for(const i of u){if(i?.type!=="tool_use"||typeof i.input?.command!="string")continue;const d=k(i.input.command).map(f=>({...f,from:a-w,to:a+h}));o.push(...d),i.id&&d.length&&n.set(i.id,d)}else if(t.type==="user"&&!Number.isNaN(a))for(const i of u){const d=i?.type==="tool_result"&&n.get(i.tool_use_id);if(d){for(const f of d)f.to=Math.max(f.to,a+h);n.delete(i.tool_use_id)}}}return o}c(b,"startsInTranscript");function S(s){const o=new Set;for(const n of s.split(`
4
+ `)){if(!n.includes('"toolUseResult"')||!/"backgroundTaskId"|"taskId"|"async_launched"/.test(n))continue;let e;try{e=JSON.parse(n).toolUseResult}catch{continue}const r=e?.backgroundTaskId??e?.taskId??(e?.status==="async_launched"?e.agentId:void 0);typeof r=="string"&&o.add(r)}return o}c(S,"backgroundIdsIn");async function I(){const s=JSON.parse(g.readFileSync(0,"utf8")),o=s?.agent_transcript_path;if(typeof o!="string"||!o)throw new Error("no agent_transcript_path on stdin");const n=g.readFileSync(o,"utf8"),e=b(n);if(!e.length)return;const r=S(n);if((s.background_tasks??[]).some(t=>r.has(t.id)))return;const l=await import("../store.mjs");for(const t of e)try{if(t.site!==null&&!/^[\w-]+$/.test(t.site))throw new Error(`--site ${t.site} is not a route`);if(t.dir?.includes("$"))throw new Error(`--dir ${t.dir} names a shell variable`);if(t.key.includes("$")||t.agent.includes("$"))throw new Error("the key or --agent names a shell variable");const a=t.site===null?null:await l.siteDir(t.site),u=t.dir===void 0?void 0:$(t.dir);await l.stopBuilder(a,t.key,{dir:u,agent:t.agent,startedBetween:[t.from,t.to]})}catch(a){process.stderr.write(`builder-stop-hook: ${t.key}${t.agent==="main"?"":` --agent ${t.agent}`}: ${a.message}
5
+ `)}}c(I,"main");try{await I()}catch(s){process.stderr.write(`builder-stop-hook: ${s.message}
5
6
  `)}process.exitCode=0;