rvlib-shipkit 2.20.0 → 2.22.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.
Files changed (156) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/package.json +1 -1
  3. package/src/asks/asks-queue.ts +8 -7
  4. package/src/assets/kits/identity-kit.ts +158 -2
  5. package/src/checks/SK004-gitignore-policy.check.ts +6 -3
  6. package/src/cli/cmd_Bump.ts +3 -3
  7. package/src/cli/cmd_GlobalProcesses.ts +2 -107
  8. package/src/cli/cmd_Home.ts +1 -1
  9. package/src/cli/cmd_Overview.ts +2 -1
  10. package/src/cli/cmd_Rec.ts +349 -0
  11. package/src/cli/cmd_Releases.ts +42 -3
  12. package/src/cli/cmd_Review.ts +22 -13
  13. package/src/cli/cmd_Secret.ts +10 -3
  14. package/src/cli/cmd_Sign.ts +24 -0
  15. package/src/cli/cmd_Social.ts +57 -8
  16. package/src/cli/cmd_Sound.ts +17 -4
  17. package/src/cli/cmd_Trailer.ts +67 -1
  18. package/src/cli/family-pages.ts +1 -0
  19. package/src/cli/registry.ts +6 -1
  20. package/src/collections/collection-types.ts +1 -1
  21. package/src/collections/review.ts +23 -4
  22. package/src/core/agent-spawn.ts +4 -17
  23. package/src/core/code-lines.ts +49 -0
  24. package/src/core/discover-checks.ts +27 -3
  25. package/src/core/hard-reset.ts +34 -0
  26. package/src/core/layout.ts +6 -0
  27. package/src/core/raw-access.ts +3 -13
  28. package/src/core/throwaway-worktree.ts +72 -0
  29. package/src/home/app-sign.ts +98 -0
  30. package/src/home/gui-app/ShipkitGui.swift +35 -0
  31. package/src/home/gui-app.ts +31 -11
  32. package/src/home/home-routes.ts +6 -0
  33. package/src/home/pm-switch.ts +112 -0
  34. package/src/home/serve-web.ts +1 -1
  35. package/src/identities/identities.ts +17 -6
  36. package/src/media-kinds.ts +5 -3
  37. package/src/media-store/forget.ts +54 -0
  38. package/src/media-store/put.ts +4 -3
  39. package/src/media-store/space.ts +63 -24
  40. package/src/messages/brief.ts +3 -3
  41. package/src/messages/score.ts +2 -0
  42. package/src/recordings/delete.ts +19 -0
  43. package/src/recordings/edit.ts +231 -0
  44. package/src/recordings/load.ts +37 -0
  45. package/src/recordings/marks-draw.ts +111 -0
  46. package/src/recordings/marks-png.ts +25 -0
  47. package/src/recordings/marks.ts +138 -0
  48. package/src/recordings/media-kind.ts +67 -0
  49. package/src/recordings/model.ts +170 -0
  50. package/src/recordings/open.ts +33 -0
  51. package/src/recordings/place.ts +89 -0
  52. package/src/recordings/presets.ts +99 -0
  53. package/src/recordings/recorder-app/Capture.swift +510 -0
  54. package/src/recordings/recorder-app/Clip.swift +107 -0
  55. package/src/recordings/recorder-app/Editor.swift +39 -0
  56. package/src/recordings/recorder-app/Tray.swift +298 -0
  57. package/src/recordings/recorder-app/main.swift +859 -0
  58. package/src/recordings/recorder-app.ts +46 -0
  59. package/src/recordings/recorder.shipkit.ts +11 -0
  60. package/src/recordings/routes.ts +140 -0
  61. package/src/recordings/run-recorder.ts +40 -0
  62. package/src/recordings/share.ts +107 -0
  63. package/src/recordings/take.ts +146 -0
  64. package/src/recordings/view.ts +40 -0
  65. package/src/release/gate-checkout.ts +74 -0
  66. package/src/release/release-scope.ts +35 -26
  67. package/src/release/run-bump.ts +79 -37
  68. package/src/release/run-release.ts +67 -53
  69. package/src/releases/add.ts +38 -5
  70. package/src/releases/before.ts +31 -0
  71. package/src/releases/from-card.ts +105 -20
  72. package/src/releases/model.ts +100 -18
  73. package/src/releases/pictures.ts +29 -8
  74. package/src/repo-config.ts +7 -3
  75. package/src/review/http.ts +1 -1
  76. package/src/review/model.ts +12 -2
  77. package/src/review/stage-card.ts +1 -1
  78. package/src/review/store.ts +12 -2
  79. package/src/review/trailer-desk.ts +20 -0
  80. package/src/review/trailer-model.ts +67 -0
  81. package/src/review/trailer-routes.ts +98 -1
  82. package/src/review/trailer-voices.ts +144 -0
  83. package/src/review/watchers.ts +58 -1
  84. package/src/secrets/manager.ts +18 -1
  85. package/src/serve/hub-app/benign-errors.ts +22 -0
  86. package/src/serve/hub-app/hash-route.ts +27 -15
  87. package/src/serve/hub-app/home-st.ts +23 -5
  88. package/src/serve/hub-app/home.html +1 -0
  89. package/src/serve/hub-app/hub-app.tsx +8 -1
  90. package/src/serve/hub-app/icons.tsx +2 -0
  91. package/src/serve/hub-app/palette-st.ts +1 -0
  92. package/src/serve/hub-app/project-list.css +7 -2
  93. package/src/serve/hub-app/project-list.tsx +10 -0
  94. package/src/serve/hub-app/projects-svc.ts +17 -7
  95. package/src/serve/hub-app/recordings-st.ts +641 -0
  96. package/src/serve/hub-app/recordings-view.tsx +504 -0
  97. package/src/serve/hub-app/recordings.css +82 -0
  98. package/src/serve/hub-app/releases/releases-page.tsx +121 -28
  99. package/src/serve/hub-app/releases/releases-st.ts +46 -4
  100. package/src/serve/hub-app/releases.css +30 -3
  101. package/src/serve/hub-app/repo-sections.ts +1 -1
  102. package/src/serve/hub-app/repo-st.ts +16 -11
  103. package/src/serve/hub-app/review/clip-st.ts +3 -1
  104. package/src/serve/hub-app/review/kit.tsx +3 -3
  105. package/src/serve/hub-app/review/trailer-page.tsx +32 -6
  106. package/src/serve/hub-app/review/trailer-st.ts +184 -8
  107. package/src/serve/hub-app/review/trailer-timeline.tsx +39 -4
  108. package/src/serve/hub-app/review/trailer-voices-st.ts +370 -0
  109. package/src/serve/hub-app/review/trailer-voices.tsx +574 -0
  110. package/src/serve/hub-app/review.css +90 -0
  111. package/src/serve/hub-app/social/comms-page.tsx +10 -5
  112. package/src/serve/hub-app/social/next-release.tsx +118 -0
  113. package/src/serve/hub-app/social/post-card.tsx +31 -3
  114. package/src/serve/hub-app/social/social-model.ts +6 -0
  115. package/src/serve/hub-app/social/social-st.ts +50 -1
  116. package/src/serve/hub-app/social.css +12 -0
  117. package/src/serve/hub-app/tree-build.ts +2 -0
  118. package/src/serve/project-gutter-route.ts +8 -0
  119. package/src/serve/project-gutter.ts +4 -2
  120. package/src/shipkit.ts +2 -2
  121. package/src/shot/box.ts +49 -22
  122. package/src/shot/browser-slot.ts +13 -3
  123. package/src/shot/client.ts +1 -1
  124. package/src/shot/film-box.ts +193 -117
  125. package/src/shot/shooter.ts +20 -8
  126. package/src/smoke/run-smoke.ts +8 -6
  127. package/src/social/compose.ts +14 -0
  128. package/src/social/desk-index.ts +49 -8
  129. package/src/social/discord-layout.ts +6 -2
  130. package/src/social/drafts.ts +1 -1
  131. package/src/social/kinds.ts +3 -2
  132. package/src/social/load.ts +42 -9
  133. package/src/social/publish/index.ts +27 -10
  134. package/src/social/publish/secret.ts +12 -4
  135. package/src/social/release-card.ts +69 -0
  136. package/src/social/release-stage.ts +173 -30
  137. package/src/social/routes.ts +7 -1
  138. package/src/social/stage.ts +45 -22
  139. package/src/trailer/bed.ts +111 -0
  140. package/src/trailer/build.ts +81 -38
  141. package/src/trailer/ffmpeg.ts +14 -0
  142. package/src/trailer/grammar.ts +32 -4
  143. package/src/trailer/graph.ts +12 -1
  144. package/src/trailer/look.ts +7 -0
  145. package/src/trailer/shot-plan.ts +75 -0
  146. package/src/trailer/shot-state.ts +191 -0
  147. package/src/trailer/sound/audio.ts +28 -0
  148. package/src/trailer/sound/brand.ts +53 -3
  149. package/src/trailer/sound/gen.ts +61 -2
  150. package/src/trailer/sound/index.ts +25 -11
  151. package/src/trailer/sound/presets.ts +86 -5
  152. package/src/trailer/sound/run.ts +1 -1
  153. package/src/trailer/sound/takes.ts +94 -0
  154. package/src/trailer/titles.ts +36 -0
  155. package/src/trailer/url.ts +1 -1
  156. package/src/veille/chrome.ts +6 -3
@@ -0,0 +1,349 @@
1
+ // sk rec: the screen recorder's takes (recordings/, wiki tools/shipkit/recordings.md): filed under a repo, kept in the
2
+ // media store, edited as text, shared as a link or a file. The menu bar app records and hands each take to `sk rec
3
+ // import`. Every module loads inside execute: the cli registers this file on every `sk` call
4
+ import { Command, Option } from 'clipanion'
5
+
6
+ const DETAILS = `the screen recorder: a hotkey runs a preset of the menu bar app (what it shoots, mic, system sound, clicks, what runs after), each take lands in <recorder.dir>/<repo>/<id>/ (an external drive while it is mounted, else the Mac's disk), goes up to the private Space through the media store, and plays in the hub's Recordings page, where its editor writes edit.txt (keep, speed, crop, mute). A trailer reads one with \`film recording <name>\`. Page: wiki tools/shipkit/recordings.md`
7
+
8
+ type Ctx = { stdout: NodeJS.WritableStream; stderr: NodeJS.WritableStream }
9
+ type Rec = import('../recordings/model.ts').Recording
10
+ type Io = { out: (l: string) => void; err: (l: string) => void }
11
+
12
+ async function run(context: Ctx, body: (io: Io) => Promise<number>): Promise<number> {
13
+ const io: Io = { out: (l) => void context.stdout.write(`${l}\n`), err: (l) => void context.stderr.write(`${l}\n`) }
14
+ try {
15
+ // the recorder app runs sk from the home folder, outside every repo: the machine's house (pm's) is where the
16
+ // config, the Space and the repos are read from
17
+ const { houseRoot, houseRootOf } = await import('../home/home-start.ts')
18
+ if (houseRootOf(process.cwd()) == null) {
19
+ const house = houseRoot(process.cwd())
20
+ if (house != null) process.chdir(house)
21
+ }
22
+ return await body(io)
23
+ } catch (e) {
24
+ io.err(`FAIL: rec: ${e instanceof Error ? e.message : String(e)}`)
25
+ return 1
26
+ }
27
+ }
28
+
29
+ /** the repo a bare `--repo` or none means: the one asked, else this one */
30
+ async function repoName(asked: string | undefined): Promise<string> {
31
+ const { basename } = await import('node:path')
32
+ if (asked !== undefined) return basename(asked)
33
+ const { findRepoRoot } = await import('../ts/config.ts')
34
+ return basename(findRepoRoot(process.cwd()))
35
+ }
36
+
37
+ const find = async (ref: string, repo: string | undefined): Promise<Rec> => {
38
+ const { findRecording } = await import('../recordings/model.ts')
39
+ return findRecording(ref, repo === undefined ? {} : { repo })
40
+ }
41
+
42
+ const time = (s: number): string => `${Math.floor(s / 60)}:${String(Math.round(s % 60)).padStart(2, '0')}`
43
+ const line = (r: Rec): string => `${r.repo}/${r.name} ${r.still ? 'still' : time(r.seconds)} ${r.width}x${r.height}${r.audio ? ' sound' : ''} ${r.created.slice(0, 16).replace('T', ' ')} ${r.dir}`
44
+
45
+ const repoOpt = (): string | undefined => Option.String('--repo', { description: 'the repo it belongs to, by name (this one when absent)' })
46
+
47
+ export class RecCommand extends Command {
48
+ static override paths = [['rec']]
49
+ static override usage = Command.Usage({
50
+ category: 'Record',
51
+ description: 'every recording, newest first: repo/name, length, size, where it sits',
52
+ details: DETAILS,
53
+ examples: [['every recording of the machine', 'sk rec'], ['one repo, as json', 'sk rec --repo my-game --json']],
54
+ })
55
+ repo = repoOpt()
56
+ json = Option.Boolean('--json', false, { description: 'one json line a recording' })
57
+ async execute(): Promise<number> {
58
+ return run(this.context, async (io) => {
59
+ const { listRecordings } = await import('../recordings/model.ts')
60
+ const all = await listRecordings(this.repo === undefined ? {} : { repo: this.repo })
61
+ for (const r of all) io.out(this.json ? JSON.stringify(r) : line(r))
62
+ if (!this.json && all.length === 0) io.out('no recording yet: a hotkey of the menu bar app records one (sk rec presets lists them)')
63
+ return 0
64
+ })
65
+ }
66
+ }
67
+
68
+ export class RecImportCommand extends Command {
69
+ static override paths = [['rec', 'import']]
70
+ static override usage = Command.Usage({
71
+ category: 'Record',
72
+ description: 'a video or image filed as a recording of a repo, then its preset\'s after steps',
73
+ details: `${DETAILS}\n\nThe file is moved (--copy keeps it): a video is remuxed to an mp4 that plays at once in a browser, transcoded only when its codec needs it; an image becomes raw.png. Its poster and facts are made, then each --after step runs in order (upload, copy-link, copy-public-link, copy-file, copy-markdown, open-editor, reveal). --preset takes that preset's after steps when --after is absent. The menu bar app calls it with --json and shows what it prints.`,
74
+ examples: [['a clip from the disk', 'sk rec import ~/Desktop/demo.mov --repo my-game --name boss-fight --after upload,copy-link']],
75
+ })
76
+ file = Option.String()
77
+ repo = repoOpt()
78
+ name = Option.String('--name', { description: 'its name: lowercase, digits, dashes (its time when absent)' })
79
+ preset = Option.String('--preset', { description: 'the preset that shot it: its after steps run unless --after says' })
80
+ after = Option.String('--after', { description: 'the steps after, comma separated' })
81
+ copy = Option.Boolean('--copy', false, { description: 'leave the file where it is' })
82
+ replace = Option.String('--replace', { description: 'a recording this take replaces: it goes to the Trash, the take takes its name (a trailer shot shot again)' })
83
+ json = Option.Boolean('--json', false, { description: 'one json line: the recording, each step said, the warnings' })
84
+ async execute(): Promise<number> {
85
+ return run(this.context, async (io) => {
86
+ const { resolve } = await import('node:path')
87
+ const { importTake } = await import('../recordings/take.ts')
88
+ const { runAfter } = await import('../recordings/share.ts')
89
+ const { AFTERS } = await import('../recordings/presets.ts')
90
+ const repo = await repoName(this.repo)
91
+ let steps = this.after?.split(',').map((s) => s.trim()).filter((s) => s !== '')
92
+ if (steps === undefined && this.preset !== undefined) {
93
+ const { recorderState } = await import('../recordings/load.ts')
94
+ const p = (await recorderState()).presets.find((x) => x.id === this.preset)
95
+ if (!p) throw new Error(`--preset ${this.preset}: no such preset (sk rec presets)`)
96
+ steps = p.after ?? []
97
+ }
98
+ for (const s of steps ?? []) if (!(AFTERS as readonly string[]).includes(s)) throw new Error(`--after ${s}: one of ${AFTERS.join(', ')}`)
99
+ const old = this.replace === undefined ? null : await find(this.replace, repo)
100
+ const filed = await importTake(resolve(this.file), { repo, ...(this.name && !old ? { name: this.name } : {}), ...(this.preset ? { preset: this.preset } : {}), copy: this.copy })
101
+ let rec = filed.rec
102
+ const warn = filed.warn
103
+ if (old) {
104
+ // the old take leaves first, so its name is free; the Space keeps its copy
105
+ const { trash } = await import('../recordings/open.ts')
106
+ const { rename } = await import('../recordings/model.ts')
107
+ await trash(old.dir)
108
+ rec = rename(rec, this.name ?? old.name)
109
+ }
110
+ if (warn) io.err(warn)
111
+ if (!this.json) io.out(`ok: ${line(rec)}`)
112
+ const said: string[] = []
113
+ let failed: string | null = null
114
+ try {
115
+ const { openEditor } = await import('../recordings/open.ts')
116
+ for (const s of await runAfter(rec, (steps ?? []) as import('../recordings/presets.ts').RecAfter[], { openEditor })) {
117
+ said.push(s.said)
118
+ if (!this.json) io.out(`ok: ${s.said}`)
119
+ }
120
+ } catch (e) {
121
+ failed = (e as Error).message
122
+ }
123
+ if (this.json) io.out(JSON.stringify({ ok: failed === null, recording: rec, said, ...(failed ? { error: failed } : {}), ...(warn ? { warn } : {}) }))
124
+ else if (failed) io.err(`FAIL: ${failed}; the take is filed: ${rec.dir}`)
125
+ return failed ? 1 : 0
126
+ })
127
+ }
128
+ }
129
+
130
+ export class RecAfterCommand extends Command {
131
+ static override paths = [['rec', 'after']]
132
+ static override usage = Command.Usage({
133
+ category: 'Record',
134
+ description: "a filed take's after steps, now: the app files a take first and runs these behind it",
135
+ details: `${DETAILS}\n\nThe recorder app files a take with its local steps (it shows at once, its editor works on the disk), then runs the rest here in the background: upload, the links. --json prints one line: ok, each step said, the error.`,
136
+ examples: [['up, and its link on the clipboard', 'sk rec after unassigned/20261109-191230 --steps upload,copy-link']],
137
+ })
138
+ ref = Option.String()
139
+ steps = Option.String('--steps', { description: 'the steps, comma separated' })
140
+ json = Option.Boolean('--json', false, { description: 'one json line: ok, said, error' })
141
+ async execute(): Promise<number> {
142
+ return run(this.context, async (io) => {
143
+ const { runAfter } = await import('../recordings/share.ts')
144
+ const { AFTERS } = await import('../recordings/presets.ts')
145
+ const steps = (this.steps ?? '').split(',').map((s) => s.trim()).filter((s) => s !== '')
146
+ for (const s of steps) if (!(AFTERS as readonly string[]).includes(s)) throw new Error(`--steps ${s}: one of ${AFTERS.join(', ')}`)
147
+ const r = await find(this.ref, undefined)
148
+ const said: string[] = []
149
+ let failed: string | null = null
150
+ try {
151
+ for (const s of await runAfter(r, steps as import('../recordings/presets.ts').RecAfter[])) said.push(s.said)
152
+ } catch (e) {
153
+ failed = (e as Error).message
154
+ }
155
+ if (this.json) io.out(JSON.stringify({ ok: failed === null, said, ...(failed ? { error: failed } : {}) }))
156
+ else for (const l of said) io.out(`ok: ${l}`)
157
+ if (failed && !this.json) io.err(`FAIL: ${failed}`)
158
+ return failed ? 1 : 0
159
+ })
160
+ }
161
+ }
162
+
163
+ export class RecPresetsCommand extends Command {
164
+ static override paths = [['rec', 'presets']]
165
+ static override usage = Command.Usage({
166
+ category: 'Record',
167
+ description: 'the presets the menu bar app runs: hotkey, what it shoots, its options, what runs after',
168
+ details: `${DETAILS}\n\nThe house config's recorder.presets (shipkit's own video and still when it names none), then each repo's own as <repo>/<name>. A wrong preset or a hotkey two presets claim is printed and exits 1. --json is what the app reads: presets, problems, the house repos and the one a take goes to by default.`,
169
+ examples: [['what the hotkeys do', 'sk rec presets']],
170
+ })
171
+ json = Option.Boolean('--json', false, { description: 'the app\'s read: presets, problems, repos, the default repo' })
172
+ async execute(): Promise<number> {
173
+ return run(this.context, async (io) => {
174
+ const { recorderState } = await import('../recordings/load.ts')
175
+ const s = await recorderState()
176
+ if (this.json) {
177
+ io.out(JSON.stringify(s))
178
+ return 0
179
+ }
180
+ for (const p of s.presets) {
181
+ const shoot = typeof p.shoot === 'string' ? p.shoot : `window ${p.shoot.window}${p.shoot.size ? ` at ${p.shoot.size}` : ''}`
182
+ const opts = [p.still ? 'still' : 'video', p.mic && 'mic', p.systemAudio && 'system sound', p.clicks && 'clicks', p.countdown && `countdown ${p.countdown}s`, p.seconds && `${p.seconds}s`].filter(Boolean).join(', ')
183
+ io.out(`${p.id.padEnd(18)} ${p.keys.join(' ').padEnd(28)} ${shoot}; ${opts}; then ${(p.after ?? []).join(', ') || 'nothing'} (${p.from})`)
184
+ }
185
+ io.out(`takes go to ${s.repo} (the menu's pick)`)
186
+ for (const p of s.problems) io.err(`FAIL: ${p}`)
187
+ return s.problems.length > 0 ? 1 : 0
188
+ })
189
+ }
190
+ }
191
+
192
+ export class RecStartCommand extends Command {
193
+ static override paths = [['rec', 'start']]
194
+ static override usage = Command.Usage({
195
+ category: 'Record',
196
+ description: 'start a preset in the menu bar app, as its hotkey does; the app records, you stop it',
197
+ details: `${DETAILS}\n\nOpens the app through its url scheme, so it starts when it is not running. --repo files the take under that repo.`,
198
+ examples: [['a quick take for this repo', 'sk rec start quick']],
199
+ })
200
+ preset = Option.String()
201
+ repo = repoOpt()
202
+ async execute(): Promise<number> {
203
+ return run(this.context, async (io) => {
204
+ const { recorderUrl } = await import('../recordings/open.ts')
205
+ const url = recorderUrl({ preset: this.preset, repo: await repoName(this.repo) })
206
+ const p = Bun.spawnSync(['open', url], { stdout: 'ignore', stderr: 'pipe' })
207
+ if (p.exitCode !== 0) throw new Error(`open ${url}: ${p.stderr.toString().trim()}; is the recorder built? sk gp start recorder`)
208
+ io.out(`ok: ${this.preset} asked of the recorder`)
209
+ return 0
210
+ })
211
+ }
212
+ }
213
+
214
+ export class RecLinkCommand extends Command {
215
+ static override paths = [['rec', 'link']]
216
+ static override usage = Command.Usage({
217
+ category: 'Record',
218
+ description: 'a link to a recording: private and signed (7 days at most), or --public and permanent',
219
+ details: `${DETAILS}\n\nThe link plays what the hub plays: the export of its edit, else the take. It is sent up first when it is not. --public publishes it under public/recording-share/: anyone with the URL watches it, for good.`,
220
+ examples: [['a link for a week, on the clipboard', 'sk rec link boss-fight --copy'], ['a permanent public link', 'sk rec link my-game/boss-fight --public']],
221
+ })
222
+ ref = Option.String()
223
+ repo = repoOpt()
224
+ public = Option.Boolean('--public', false, { description: 'permanent, anyone with it watches' })
225
+ for = Option.String('--for', { description: 'how long a private link lasts: 30m, 2h, 7d (7d)' })
226
+ copy = Option.Boolean('--copy', false, { description: 'on the clipboard too' })
227
+ async execute(): Promise<number> {
228
+ return run(this.context, async (io) => {
229
+ const { copyText, privateLink, publicLink } = await import('../recordings/share.ts')
230
+ const { durationS } = await import('../media-store/put.ts')
231
+ const r = await find(this.ref, this.repo)
232
+ const url = this.public ? await publicLink(r) : (await privateLink(r, durationS(this.for ?? '7d'))).url
233
+ if (this.copy) await copyText(url)
234
+ io.out(url)
235
+ return 0
236
+ })
237
+ }
238
+ }
239
+
240
+ export class RecCopyCommand extends Command {
241
+ static override paths = [['rec', 'copy']]
242
+ static override usage = Command.Usage({
243
+ category: 'Record',
244
+ description: 'the recording\'s file on the clipboard: a paste in Slack, Discord or a mail attaches it',
245
+ details: DETAILS,
246
+ examples: [['paste it anywhere', 'sk rec copy boss-fight']],
247
+ })
248
+ ref = Option.String()
249
+ repo = repoOpt()
250
+ async execute(): Promise<number> {
251
+ return run(this.context, async (io) => {
252
+ const { copyRecordingFile } = await import('../recordings/share.ts')
253
+ io.out(`ok: ${await copyRecordingFile(await find(this.ref, this.repo))} on the clipboard`)
254
+ return 0
255
+ })
256
+ }
257
+ }
258
+
259
+ export class RecRenameCommand extends Command {
260
+ static override paths = [['rec', 'rename']]
261
+ static override usage = Command.Usage({
262
+ category: 'Record',
263
+ description: 'a recording\'s name: what a trailer, a link and the hub say',
264
+ details: DETAILS,
265
+ examples: [['name a take', 'sk rec rename 20261109-191230 boss-fight']],
266
+ })
267
+ ref = Option.String()
268
+ name = Option.String()
269
+ repo = repoOpt()
270
+ async execute(): Promise<number> {
271
+ return run(this.context, async (io) => {
272
+ const { rename } = await import('../recordings/model.ts')
273
+ io.out(`ok: ${line(rename(await find(this.ref, this.repo), this.name))}`)
274
+ return 0
275
+ })
276
+ }
277
+ }
278
+
279
+ export class RecMoveCommand extends Command {
280
+ static override paths = [['rec', 'move']]
281
+ static override usage = Command.Usage({
282
+ category: 'Record',
283
+ description: "a take filed under another repo, or back to unassigned (where every take starts)",
284
+ details: `${DETAILS}\n\nThe folder moves on its drive, its meta and its media index rows follow, so its links, its uploads and a delete still find every file.`,
285
+ examples: [['a take for the game', 'sk rec move 20261109-191230 my-game'], ['back to no repo', 'sk rec move my-game/boss-fight unassigned']],
286
+ })
287
+ ref = Option.String()
288
+ to = Option.String()
289
+ repo = repoOpt()
290
+ async execute(): Promise<number> {
291
+ return run(this.context, async (io) => {
292
+ const { moveRecording } = await import('../recordings/model.ts')
293
+ io.out(`ok: ${line(moveRecording(await find(this.ref, this.repo), this.to))}`)
294
+ return 0
295
+ })
296
+ }
297
+ }
298
+
299
+ export class RecEditCommand extends Command {
300
+ static override paths = [['rec', 'edit']]
301
+ static override usage = Command.Usage({
302
+ category: 'Record',
303
+ description: 'a recording\'s edit as text: printed, or set and exported (keep, speed, crop, mute)',
304
+ details: `${DETAILS}\n\nOne line a verb: \`keep 0:01.5-0:12, 0:15-0:40\`, \`speed 2x 0:20-0:30\`, \`crop 1280x720+40+80\`, \`mute\`. Times are the take's. Setting it exports out.mp4 in one ffmpeg pass; an empty text removes the edit, and the take plays again. The take itself never changes.`,
305
+ examples: [['what it is now', 'sk rec edit boss-fight'], ['trim both ends', 'sk rec edit boss-fight --set "keep 0:02-0:31"']],
306
+ })
307
+ ref = Option.String()
308
+ repo = repoOpt()
309
+ set = Option.String('--set', { description: 'the whole edit, lines split by a newline or a semicolon' })
310
+ async execute(): Promise<number> {
311
+ return run(this.context, async (io) => {
312
+ const { editText, saveEdit } = await import('../recordings/take.ts')
313
+ const r = await find(this.ref, this.repo)
314
+ if (this.set === undefined) {
315
+ io.out(editText(r) || '(no edit: the take plays whole)')
316
+ return 0
317
+ }
318
+ const after = await saveEdit(r, this.set.replace(/;\s*/g, '\n'))
319
+ io.out(`ok: ${line(after)}`)
320
+ return 0
321
+ })
322
+ }
323
+ }
324
+
325
+ export class RecRmCommand extends Command {
326
+ static override paths = [['rec', 'rm']]
327
+ static override usage = Command.Usage({
328
+ category: 'Record',
329
+ description: 'a recording deleted for good: off the Space, every version and export, its folder to the Trash',
330
+ details: `${DETAILS}\n\nThe one delete the media store allows: the take, every export and poster it ever had and every public copy leave the Space for good, then the folder goes to the Trash. A private link dies at once; a public one can play from the CDN's cache for up to an hour. A content another recording still holds stays up. --yes is required: there is no undo in the Space.`,
331
+ examples: [['a take that showed too much', 'sk rec rm 20261109-191230 --yes']],
332
+ })
333
+ ref = Option.String()
334
+ repo = repoOpt()
335
+ yes = Option.Boolean('--yes', false, { description: 'yes, for good: no undo in the Space' })
336
+ async execute(): Promise<number> {
337
+ return run(this.context, async (io) => {
338
+ const r = await find(this.ref, this.repo)
339
+ if (!this.yes) throw new Error(`${r.repo}/${r.name} would leave the Space for good, every link to it dead: add --yes`)
340
+ const { deleteRecording } = await import('../recordings/delete.ts')
341
+ const res = await deleteRecording(r)
342
+ io.out(`ok: ${r.repo}/${r.name} deleted: ${res.gone} files off the Space, the folder in the Trash`)
343
+ for (const k of res.kept) io.out(`kept up: ${k}`)
344
+ return 0
345
+ })
346
+ }
347
+ }
348
+
349
+ export const REC_COMMANDS = [RecCommand, RecImportCommand, RecAfterCommand, RecPresetsCommand, RecStartCommand, RecLinkCommand, RecCopyCommand, RecRenameCommand, RecMoveCommand, RecEditCommand, RecRmCommand]
@@ -47,12 +47,15 @@ export class ReleasesAddCommand extends Command {
47
47
 
48
48
  static override usage = Command.Usage({
49
49
  category: 'Gate',
50
- description: 'a change of .shipkit/releases/next.md by hand: its line, text, picture, bullets',
50
+ description: 'a change of .shipkit/releases/next.md by hand: its line, text, picture, before, bullets',
51
51
  details:
52
- "one change of the release being filled. With --card, the card's changelog line and after picture (what his approval adds, run again by hand when it failed); a category and a title given beside it win. A change of the same card, else of the same title, is replaced, its description, bullets and picture kept unless given. A picture goes to the Space private; `sk bump` makes it public. The repo's guard reads every word first. Committed by pathspec",
52
+ "one change of the release being filled. With --card, the card's changelog line and media (what his approval adds, run again by hand when it failed: a pair as its after and its before, two stills, the before dropped when blank or the same as the after; a clip as it is, else its image); a category and a title given beside it win. A change of the same card, else of the same title, is replaced, its description, bullets and shots kept unless given; a new --image takes the place of the shot of its rating and drops that shot's before unless --before gives one. Every picture carries its rating (--rating, else the card's; unrated reads explicit, so no SFW venue shows it). Every change carries its weight (--weight major, feature or improvement): kept when not given, none until one is. A picture goes to the Space private; `sk bump` makes it public. The repo's guard reads every word first. Committed by pathspec",
53
53
  examples: [
54
54
  ['the change of an approved card, again', 'sk releases add --card 20261108-115317-move-her'],
55
55
  ['a change by hand', 'sk releases add Studio "Move the body anywhere on the floor" --text "Drag the ring at the feet." --bullet "double tap: back to the middle" --image shot.webp'],
56
+ ["a card's change, a new after and its before", 'sk releases add --card 20261108-115317-move-her --image after.webp --before before.webp'],
57
+ ["a card's picture looked at: safe", 'sk releases add --card 20261108-115317-move-her --rating safe'],
58
+ ["a card's change weighs: major, feature or improvement", 'sk releases add --card 20261108-115317-move-her --weight feature'],
56
59
  ['the next release is a minor one', 'sk releases add --kind minor'],
57
60
  ],
58
61
  })
@@ -62,10 +65,13 @@ export class ReleasesAddCommand extends Command {
62
65
  text = Option.String('--text', { description: 'its description, markdown' })
63
66
  bullets = Option.Array('--bullet', { description: 'a bullet under it (repeat it)' })
64
67
  image = Option.String('--image', { description: 'its picture: a png, jpg, webp or a clip' })
65
- card = Option.String('--card', { description: 'the review card it comes from: its line and after picture' })
68
+ before = Option.String('--before', { description: 'what it looked like before: a png, jpg or webp, a tab beside the picture' })
69
+ rating = Option.String('--rating', { description: "what its picture shows: safe, mild or explicit; with no new picture, rates the change's one unrated shot" })
70
+ card = Option.String('--card', { description: 'the review card it comes from: its line and media' })
66
71
  commit = Option.String('--commit', { description: 'the commit it ships' })
67
72
  kind = Option.String('--kind', { description: 'what kind of release next is: major, minor or patch' })
68
73
  heading = Option.String('--release-title', { description: "the release's own title, its # heading" })
74
+ weight = Option.String('--weight', { description: 'what the change weighs: major (changes how people work), feature (a new thing they can do), improvement (a better version of what they had)' })
69
75
 
70
76
  async execute(): Promise<number> {
71
77
  try {
@@ -76,10 +82,13 @@ export class ReleasesAddCommand extends Command {
76
82
  ...(this.text !== undefined ? { text: this.text } : {}),
77
83
  ...(this.bullets !== undefined ? { bullets: this.bullets } : {}),
78
84
  ...(this.image !== undefined ? { image: this.image } : {}),
85
+ ...(this.before !== undefined ? { before: this.before } : {}),
86
+ ...(this.rating !== undefined ? { rating: this.rating } : {}),
79
87
  ...(this.card !== undefined ? { card: this.card } : {}),
80
88
  ...(this.commit !== undefined ? { commit: this.commit } : {}),
81
89
  ...(this.kind !== undefined ? { kind: this.kind } : {}),
82
90
  ...(this.heading !== undefined ? { heading: this.heading } : {}),
91
+ ...(this.weight !== undefined ? { weight: this.weight } : {}),
83
92
  })
84
93
  this.context.stdout.write(`ok: ${file}\n`)
85
94
  return 0
@@ -89,3 +98,33 @@ export class ReleasesAddCommand extends Command {
89
98
  }
90
99
  }
91
100
  }
101
+
102
+ export class ReleasesRefreshCommand extends Command {
103
+ static override paths = [['releases', 'refresh']]
104
+
105
+ static override usage = Command.Usage({
106
+ category: 'Gate',
107
+ description: "every change of next.md still showing a pair's wipe takes its card's stills: the after, the before",
108
+ details:
109
+ "each change of .shipkit/releases/next.md whose picture is still a clip while its card's media is a pair of images (the looping wipe an approval no longer writes) takes that card's newest approved version as two stills: the after as its picture, the before beside it, dropped when blank or the same as the after. Any other picture stays, a retake by hand included. Its title, description and bullets stay. Kept private in the Space; `sk bump` makes it public. Committed by pathspec",
110
+ examples: [
111
+ ['what would move', 'sk releases refresh --dry'],
112
+ ["next.md's wipes, as stills", 'sk releases refresh'],
113
+ ],
114
+ })
115
+
116
+ dry = Option.Boolean('--dry', false, { description: 'list the changes that would move, write nothing' })
117
+
118
+ async execute(): Promise<number> {
119
+ try {
120
+ const { refreshFromCards } = await import('../releases/from-card.ts')
121
+ const r = await refreshFromCards(process.cwd(), { dry: this.dry })
122
+ for (const m of r.moved) this.context.stdout.write(`${this.dry ? '' : 'stills: '}${m.title}${this.dry ? '' : `, before ${m.before}`}\n`)
123
+ this.context.stdout.write(this.dry ? `ok: ${r.moved.length} changes would take stills\n` : r.file ? `ok: ${r.moved.length} changes took stills, ${r.file}\n` : 'ok: no change shows a wipe\n')
124
+ return 0
125
+ } catch (e) {
126
+ this.context.stderr.write(`FAIL: ${e instanceof Error ? e.message : String(e)}\n`)
127
+ return 1
128
+ }
129
+ }
130
+ }
@@ -157,6 +157,7 @@ const ADD_FLAGS = `flags:
157
157
  --what "<what>" what changed and why, short markdown: one line, then - bullets
158
158
  --post "<line>" the public line for a post of it, what a user gets (the repo's guard reads it)
159
159
  --changelog "<category>: <line>" its change in the release being filled: on his approval it lands in .shipkit/releases/next.md with the card's after picture (the repo's guard reads it)
160
+ --rating <safe|mild|explicit> with --changelog: what its media shows at full size, the rating its picture lands with; unset, unrated (reads explicit: no SFW venue shows it)
160
161
  --image <a.png> the subject; a clip (webm, mp4) goes anywhere an image goes
161
162
  --video <clip.mp4> a clip
162
163
  --audio <sound.wav> a sound: a waveform and a player (wav, mp3, flac, ogg, opus, m4a)
@@ -247,7 +248,7 @@ export class ReviewAddCommand extends Command {
247
248
  const kindName = rest[rest.indexOf('--subject') + 1]
248
249
  const kind = rest.includes('--subject') && kindName ? h.unit?.kinds?.[kindName] : undefined
249
250
  const own = [...Object.keys(kind?.flags ?? {}), ...Object.keys(h.unit?.flags ?? {})]
250
- const f = flagsOf(rest, ['title', 'what', 'post', 'changelog', 'image', 'video', 'audio', 'before', 'after', 'label', 'topic', 'subject', 'commit', 'lane', 'supersedes', 'keeps', 'why', 'live', 'trailer', 'version', 'shots', 'pick'], ['answers', ...own], ['new', 'wip', 'choice'])
251
+ const f = flagsOf(rest, ['title', 'what', 'post', 'changelog', 'rating', 'image', 'video', 'audio', 'before', 'after', 'label', 'topic', 'subject', 'commit', 'lane', 'supersedes', 'keeps', 'why', 'live', 'trailer', 'version', 'shots', 'pick'], ['answers', ...own], ['new', 'wip', 'choice'])
251
252
  if (f.positionals.length > 0) throw new Error(`unexpected ${f.positionals.join(' ')}`)
252
253
  const o = f.one
253
254
  const trailer = await trailerOfFlags(o, views.length > 0 || f.on.has('wip') || f.on.has('choice'))
@@ -271,6 +272,7 @@ export class ReviewAddCommand extends Command {
271
272
  if (problems.length > 0) throw new Error(`--post: the repo's guard refuses it: ${problems.join('; ')}`)
272
273
  }
273
274
  let changelog: import('../review/model.ts').CardChangelog | undefined
275
+ if (o.rating !== undefined && o.changelog === undefined) throw new Error('--rating rates the picture its --changelog line lands with: give --changelog too')
274
276
  if (o.changelog !== undefined) {
275
277
  // its category and line are public words: the repo's guard reads them before the card holds them
276
278
  const { dirname } = await import('node:path')
@@ -278,6 +280,11 @@ export class ReviewAddCommand extends Command {
278
280
  const { publicProblems } = await import('../social/unit.ts')
279
281
  const { undeclaredReleases } = await import('../releases/store.ts')
280
282
  changelog = changelogOfFlag(o.changelog)
283
+ if (o.rating !== undefined) {
284
+ const { isPostRating, POST_RATINGS } = await import('../identities/rating.ts')
285
+ if (!isPostRating(o.rating)) throw new Error(`--rating ${o.rating}: one of ${POST_RATINGS.join(', ')}`)
286
+ changelog.rating = o.rating
287
+ }
281
288
  const why = await undeclaredReleases(dirname(dirname(h.dir)))
282
289
  if (why) throw new Error(`--changelog: ${why}`)
283
290
  const problems = await publicProblems(dirname(dirname(h.dir)), { texts: [changelog.category, changelog.line] })
@@ -938,7 +945,7 @@ export class ReviewStageCommand extends Command {
938
945
  static override usage = Command.Usage({
939
946
  category: 'Review',
940
947
  description: "one media of a card staged as a post: a draft in .shipkit/social/drafts/, never posted",
941
- details: `${DETAILS}\n\nThe media copied in with its metadata left out, the repo's guard run first, the draft committed by its paths. Without --view, the newest version's first media. --dry prints what the draft would be: each account, its place, its count, what it skips. It never publishes: Publish stays his, in Communications. Page: wiki tools/shipkit/review-raised-items.md, A post staged from a card`,
948
+ details: `${DETAILS}\n\nThe media copied in with its metadata left out, the repo's guard run first, the draft committed by its paths. Without --view, the newest version's first media. Without --kind, iteration: feature, a change users can use now, is picked by hand. --dry prints the draft as it would be written, then each account, its place, its count, what it skips. It never publishes: Publish stays his, in Communications. Page: wiki tools/shipkit/review-raised-items.md, A post staged from a card`,
942
949
  examples: [
943
950
  ['the first media, a safe post', 'sk review stage <id> --text "Hands now pinch and lift." --rating safe'],
944
951
  ["the second view's wipe, polished by an agent", 'sk review stage <id> --view B --side wipe --text "…" --rating mild --polish'],
@@ -949,9 +956,9 @@ export class ReviewStageCommand extends Command {
949
956
  view = Option.String('--view', { description: 'the view by its letter (A, B…) of the newest version, or <n>.<letter> of an older one' })
950
957
  side = Option.String('--side', { description: 'a pair: after (default), before or wipe' })
951
958
  tile = Option.String('--tile', { description: 'a gallery: the tile by its label' })
952
- text = Option.String('--text', { required: true, description: 'the post' })
953
- rating = Option.String('--rating', { required: true, description: 'safe, mild or explicit' })
954
- kind = Option.String('--kind', { description: 'what the post is for, a kind of the set or the unit (default feature)' })
959
+ text = Option.String('--text', { description: 'the post (required)' })
960
+ rating = Option.String('--rating', { description: 'safe, mild or explicit: what the media shows at full size (required)' })
961
+ kind = Option.String('--kind', { description: "what the post is for, a kind of the set or the unit (default iteration: feature, a change users can use now, is picked by hand)" })
955
962
  kindWhy = Option.String('--kind-why', { description: 'with --kind custom: one line on why no kind fits' })
956
963
  alt = Option.String('--alt', { description: 'what the media shows' })
957
964
  slot = Option.String('--slot', { description: '<YYYY-MM-DD> <tag>, a slot of the rhythm' })
@@ -966,8 +973,10 @@ export class ReviewStageCommand extends Command {
966
973
  return run(this.context, async (h) => {
967
974
  const { dirname, join } = await import('node:path')
968
975
  const { isPostRating, POST_RATINGS } = await import('../identities/rating.ts')
976
+ const missing = [this.text === undefined ? '--text "<the post>"' : null, this.rating === undefined ? `--rating <${POST_RATINGS.join('|')}>` : null].filter((x) => x !== null)
977
+ if (this.text === undefined || this.rating === undefined) throw new Error(`sk review stage ${this.id} needs ${missing.join(' and ')}`)
969
978
  const { stageInputOf, stageOfCard } = await import('../review/stage-card.ts')
970
- const { askPolish, fitStage, stageDraft, stageDry } = await import('../social/stage.ts')
979
+ const { askPolish, fitStage, stagedKind, stageDraft, stageDry } = await import('../social/stage.ts')
971
980
  const { loadSocialUnit } = await import('../social/unit.ts')
972
981
  if (!isPostRating(this.rating)) throw new Error(`--rating ${this.rating}: one of ${POST_RATINGS.join(', ')}`)
973
982
  const root = dirname(dirname(h.dir))
@@ -990,7 +999,8 @@ export class ReviewStageCommand extends Command {
990
999
  const { input } = await stageInputOf(h.dir, id, { ...(pick ? { pick } : {}), text: this.text, rating: this.rating, ...(this.kind ? { kind: this.kind } : {}), ...(this.kindWhy ? { kindWhy: this.kindWhy } : {}), ...(this.alt ? { alt: this.alt } : {}), ...(this.slot ? { slot: this.slot } : {}), ...(this.tags ? { tags: this.tags } : {}), ...(passage ? { passage } : {}) }, font)
991
1000
  const unit = await loadSocialUnit(root)
992
1001
  const r = this.dry ? await stageDry(root, input, { unit }) : await stageDraft(root, this.fit ? await fitStage(root, input, { unit }) : input, { unit })
993
- h.out(`${this.dry ? 'would stage' : 'staged'} ${r.slug}${input.media ? `: ${input.media.name}` : ''}, ${input.rating}`)
1002
+ h.out(`${this.dry ? 'would stage' : 'staged'} ${r.slug}${input.media ? `: ${input.media.name}` : ''}, ${input.rating}, kind ${r.draft?.kind || stagedKind(input)}`)
1003
+ if (this.dry && r.text) h.out(`\n${r.text.trimEnd()}\n`)
994
1004
  for (const p of r.draft?.posts ?? []) h.out(` ${p.key}${p.place ? ` #${p.place}` : ''} ${p.length}${p.refused ? ` refused: ${p.refused}` : ''}`)
995
1005
  for (const k of r.draft?.skipped ?? []) h.out(` ${k.account} skipped: ${k.why}`)
996
1006
  for (const e of r.errors) h.err(`WARN ${e}`)
@@ -1056,8 +1066,8 @@ export class ReviewWatchCommand extends Command {
1056
1066
  static override paths = [['review', 'watch']]
1057
1067
  static override usage = Command.Usage({
1058
1068
  category: 'Review',
1059
- description: 'one line per verdict, reply or raised note as it lands; every unseen one at start; never exits',
1060
- details: `${DETAILS}\n\nRun it under a monitor, unfiltered (a grep holds a burst's last line). It registers itself, so the hub shows who listens. An item nobody takes prints 2 minutes after its last message, then every 2 hours.`,
1069
+ description: 'one line per verdict, reply or raised note as it lands; every unseen one first; ends with its owner',
1070
+ details: `${DETAILS}\n\nRun it under a monitor, unfiltered (a grep holds a burst's last line). It registers itself, so the hub shows who listens. It exits within 2 s once a process above it at start is gone or nothing reads its output. An item nobody takes prints 2 minutes after its last message, then every 2 hours.`,
1061
1071
  examples: [['the cards this session sent', 'sk review watch --mine'], ["one lane's items", 'sk review watch --lane interaction']],
1062
1072
  })
1063
1073
  mine = Option.Boolean('--mine', false, { description: "only this Claude Code session's cards" })
@@ -1071,13 +1081,14 @@ export class ReviewWatchCommand extends Command {
1071
1081
  const { AGENT_RE, coversCard, laneOf, UNTAKEN_AGAIN_MS, untakenOf } = await import('../review/model.ts')
1072
1082
  const { followedIds, unseen } = await import('../review/threads.ts')
1073
1083
  const { raisedLine, untakenLine, watchLines } = await import('../review/format.ts')
1074
- const { liveWatchers, registerWatch } = await import('../review/watchers.ts')
1084
+ const { exitWithOwner, liveWatchers, registerWatch } = await import('../review/watchers.ts')
1075
1085
  const session = await sessionOf(this.mine, this.session)
1076
1086
  const lane = this.lane?.trim() || null
1077
1087
  if (lane !== null && !AGENT_RE.test(lane)) throw new Error(`--lane: « ${lane} » is no lane id (${AGENT_RE.source})`)
1078
1088
  const mine = (x: Parameters<typeof coversCard>[1]): boolean => coversCard({ session, lane }, x)
1079
1089
  registerWatch(h.dir, { session, lane })
1080
- const parent = process.ppid
1090
+ // before any await: a pull that hangs never keeps a watch alive past its owner
1091
+ exitWithOwner()
1081
1092
  const shown = new Set<string>()
1082
1093
  const tick = (): void => {
1083
1094
  const all = readAll(h.dir)
@@ -1132,8 +1143,6 @@ export class ReviewWatchCommand extends Command {
1132
1143
  if (h.unit?.sources?.length) setInterval(() => void pull(h), 30_000)
1133
1144
  let stamp = scanStamp(h.dir)
1134
1145
  setInterval(() => {
1135
- // a watch whose parent died (a monitor's timeout) exits
1136
- if (process.ppid !== parent) process.exit(0)
1137
1146
  const now = scanStamp(h.dir)
1138
1147
  if (now !== stamp) again()
1139
1148
  stamp = now
@@ -1,9 +1,10 @@
1
1
  // shipkit secret — the secrets of the repo you stand in, and the reads and
2
2
  // writes through the house's secret manager (`credsReadCommand`, `credsCommand`).
3
- // Logic in secrets/list.ts and secrets/manager.ts. A value only ever goes to stdout of `get`/`account`.
3
+ // Logic in secrets/list.ts and secrets/manager.ts. A value only ever goes to stdout of `get`/`account`,
4
+ // and only for a repo in the name's scope.
4
5
  import { Command, Option } from 'clipanion'
5
6
  import { presence, secretsFor } from '../secrets/list.ts'
6
- import { managerTemplate as template, NoManager, secretsWhere as where, storeArgv } from '../secrets/manager.ts'
7
+ import { houseScopeOf, managerTemplate as template, NoManager, readRefusal, REFUSED_EXIT, secretsWhere as where, storeArgv } from '../secrets/manager.ts'
7
8
  import { secretArgv } from '../smoke/run-smoke.ts'
8
9
 
9
10
  /** runs a verb, printing a refusal as its one line */
@@ -74,7 +75,13 @@ export class SecretReadCommand extends Command {
74
75
  async execute(): Promise<number> {
75
76
  const field = this.path[1] === 'account' ? 'account' : 'get'
76
77
  return refusing(this.context.stderr, async () => {
77
- const argv = secretArgv(template(await where(process.cwd()), 'credsReadCommand'), this.name, field)
78
+ const w = await where(process.cwd())
79
+ const refused = readRefusal(this.name, houseScopeOf(w, this.name), w)
80
+ if (refused != null) {
81
+ this.context.stderr.write(`${refused}\n`)
82
+ return REFUSED_EXIT
83
+ }
84
+ const argv = secretArgv(template(w, 'credsReadCommand'), this.name, field)
78
85
  return Bun.spawnSync(argv, { stdout: 'inherit', stderr: 'inherit' }).exitCode ?? 1
79
86
  })
80
87
  }
@@ -0,0 +1,24 @@
1
+ // sk sign-setup: the machine's code signing identity for shipkit's apps (home/app-sign.ts, wiki tools/shipkit/home-pages.md,
2
+ // Signing). Every module loads inside execute: the cli registers this file on every `sk` call
3
+ import { Command } from 'clipanion'
4
+
5
+ export class SignSetupCommand extends Command {
6
+ static override paths = [['sign-setup']]
7
+ static override usage = Command.Usage({
8
+ category: 'Serve',
9
+ description: "a local code signing identity for shipkit's apps: macOS permissions survive a rebuild",
10
+ details: `An ad hoc signature names the binary's hash, so macOS forgets an app's Screen Recording or Accessibility permission at every rebuild. This makes a self signed code signing certificate in its own keychain (${'~/.config/shipkit/home/signing.keychain-db'}), its random password in the login keychain, then asks macOS to trust it for code signing: macOS shows its own password prompt, once. Every app shipkit builds is then signed with it, and keeps its permissions. Run again: it says it is set up.`,
11
+ examples: [['once per machine', 'sk sign-setup']],
12
+ })
13
+ async execute(): Promise<number> {
14
+ const out = (l: string): void => void this.context.stdout.write(`${l}\n`)
15
+ try {
16
+ const { setupSigning } = await import('../home/app-sign.ts')
17
+ setupSigning(out)
18
+ return 0
19
+ } catch (e) {
20
+ this.context.stderr.write(`FAIL: sign-setup: ${(e as Error).message}\n`)
21
+ return 1
22
+ }
23
+ }
24
+ }