rvlib-shipkit 2.18.0 → 2.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/package.json +1 -1
- package/src/annex/annex.ts +227 -0
- package/src/annex/offload.ts +279 -0
- package/src/asks/asks-queue.ts +63 -10
- package/src/checks/SK040-release-words.check.ts +43 -0
- package/src/checks/SK041-annex-links.check.ts +28 -0
- package/src/checks/SK042-post-kinds.check.ts +73 -0
- package/src/cli/cmd_Annex.ts +179 -0
- package/src/cli/cmd_Asks.ts +3 -1
- package/src/cli/cmd_Commands.ts +4 -1
- package/src/cli/cmd_GlobalProcesses.ts +34 -11
- package/src/cli/cmd_Home.ts +41 -4
- package/src/cli/cmd_Messages.ts +155 -0
- package/src/cli/cmd_Releases.ts +48 -0
- package/src/cli/cmd_Review.ts +161 -6
- package/src/cli/cmd_Secret.ts +4 -30
- package/src/cli/cmd_Shot.ts +4 -4
- package/src/cli/cmd_Social.ts +179 -3
- package/src/cli/cmd_Trailer.ts +15 -3
- package/src/cli/family-pages.ts +2 -0
- package/src/cli/kit/index.ts +1 -1
- package/src/cli/kit/verb.ts +11 -3
- package/src/cli/registry.ts +8 -2
- package/src/collections/actions.ts +29 -1
- package/src/collections/collection-types.ts +10 -1
- package/src/collections/providers.ts +5 -2
- package/src/commands/model.ts +36 -0
- package/src/commands/registry.ts +49 -0
- package/src/commands/routes.ts +59 -0
- package/src/commands/runner.ts +35 -0
- package/src/commands/runs.ts +112 -0
- package/src/core/app-icon.ts +4 -3
- package/src/core/icon-type.ts +8 -0
- package/src/core/jobs.ts +4 -3
- package/src/core/layout.ts +5 -2
- package/src/core/squircle.ts +95 -0
- package/src/home/daemon-jobs.ts +26 -2
- package/src/home/global-units.ts +3 -0
- package/src/home/gui-app/ShipkitGui.swift +302 -5
- package/src/home/gui-app.ts +63 -33
- package/src/home/hmr-keep.ts +134 -0
- package/src/home/home-paths.ts +5 -1
- package/src/home/home-start.ts +14 -14
- package/src/home/lib-watch.ts +21 -11
- package/src/home/pm.ts +1 -1
- package/src/home/process-apps.ts +181 -0
- package/src/home/resources.ts +3 -3
- package/src/home/run-daemon.ts +11 -2
- package/src/home/run-pm.ts +9 -1
- package/src/home/run-web.ts +7 -4
- package/src/home/serve-web.ts +64 -14
- package/src/home/supervise.ts +3 -1
- package/src/identities/collection.ts +49 -0
- package/src/identities/identities.ts +130 -11
- package/src/identities/machine.ts +4 -3
- package/src/identities/rating.ts +33 -0
- package/src/identities/shown.ts +170 -0
- package/src/identities/steps.ts +5 -0
- package/src/media-store/purge.ts +15 -1
- package/src/media-store/remote.ts +22 -6
- package/src/messages/brief.ts +117 -0
- package/src/messages/collection.ts +40 -0
- package/src/messages/model.ts +171 -0
- package/src/messages/routes.ts +15 -0
- package/src/messages/score.ts +180 -0
- package/src/messages/tabs.ts +13 -0
- package/src/release/notes.ts +130 -0
- package/src/release/run-bump.ts +41 -18
- package/src/release/run-release.ts +22 -4
- package/src/release/run-releases.ts +17 -15
- package/src/release/unit-resolve.ts +9 -0
- package/src/releases/add.ts +66 -0
- package/src/releases/collection.ts +36 -0
- package/src/releases/from-card.ts +66 -0
- package/src/releases/model.ts +267 -0
- package/src/releases/pictures.ts +89 -0
- package/src/releases/routes.ts +36 -0
- package/src/releases/store.ts +71 -0
- package/src/repo-config.ts +5 -0
- package/src/review/cells.ts +0 -11
- package/src/review/format.ts +10 -6
- package/src/review/http.ts +7 -2
- package/src/review/model.ts +92 -3
- package/src/review/notes.ts +2 -48
- package/src/review/routes.ts +28 -10
- package/src/review/stage-card.ts +197 -0
- package/src/review/stage-routes.ts +123 -0
- package/src/review/store.ts +117 -19
- package/src/review/trailer-card.ts +99 -0
- package/src/review/trailer-desk.ts +57 -4
- package/src/review/trailer-model.ts +41 -7
- package/src/review/trailer-notes.ts +45 -0
- package/src/review/trailer-routes.ts +22 -13
- package/src/secrets/manager.ts +59 -0
- package/src/secrets/name.ts +2 -0
- package/src/serve/hub-app/app-bridge.ts +71 -0
- package/src/serve/hub-app/col-card.tsx +10 -0
- package/src/serve/hub-app/cols-svc.ts +37 -6
- package/src/serve/hub-app/commands/commands-page.tsx +122 -0
- package/src/serve/hub-app/commands/commands-st.ts +177 -0
- package/src/serve/hub-app/commands.css +24 -0
- package/src/serve/hub-app/hash-route.ts +40 -1
- package/src/serve/hub-app/home-st.ts +11 -2
- package/src/serve/hub-app/home.html +3 -0
- package/src/serve/hub-app/hub-app.tsx +6 -0
- package/src/serve/hub-app/hub.css +1 -0
- package/src/serve/hub-app/icons.tsx +5 -0
- package/src/serve/hub-app/identities-view.tsx +4 -1
- package/src/serve/hub-app/identities.css +1 -0
- package/src/serve/hub-app/index.html +3 -0
- package/src/serve/hub-app/keys.ts +2 -2
- package/src/serve/hub-app/machine-st.ts +41 -10
- package/src/serve/hub-app/messages/messages-page.tsx +354 -0
- package/src/serve/hub-app/messages/messages-st.ts +74 -0
- package/src/serve/hub-app/messages.css +35 -0
- package/src/serve/hub-app/releases/releases-page.tsx +94 -0
- package/src/serve/hub-app/releases/releases-st.ts +69 -0
- package/src/serve/hub-app/releases.css +25 -0
- package/src/serve/hub-app/repo-sections.ts +15 -1
- package/src/serve/hub-app/repo-st.ts +56 -5
- package/src/serve/hub-app/review/clip-st.ts +31 -3
- package/src/serve/hub-app/review/note-place.ts +31 -0
- package/src/serve/hub-app/review/review-cells.tsx +27 -3
- package/src/serve/hub-app/review/review-st.ts +77 -2
- package/src/serve/hub-app/review/review-thread.tsx +9 -31
- package/src/serve/hub-app/review/review-views.tsx +164 -58
- package/src/serve/hub-app/review/thread-st.ts +108 -41
- package/src/serve/hub-app/review/trailer-card.tsx +187 -0
- package/src/serve/hub-app/review/trailer-page.tsx +62 -31
- package/src/serve/hub-app/review/trailer-st.ts +138 -26
- package/src/serve/hub-app/review/trailer-timeline.tsx +39 -26
- package/src/serve/hub-app/review.css +49 -6
- package/src/serve/hub-app/social/comms-page.tsx +55 -23
- package/src/serve/hub-app/social/identity-pictures.ts +112 -0
- package/src/serve/hub-app/social/kit.tsx +9 -6
- package/src/serve/hub-app/social/post-card.tsx +10 -2
- package/src/serve/hub-app/social/social-model.ts +37 -3
- package/src/serve/hub-app/social/social-page.tsx +236 -82
- package/src/serve/hub-app/social/social-st.ts +79 -26
- package/src/serve/hub-app/social/stage-popup.tsx +268 -0
- package/src/serve/hub-app/social/stage-st.ts +310 -0
- package/src/serve/hub-app/social/step-layout.ts +42 -0
- package/src/serve/hub-app/social.css +68 -4
- package/src/serve/hub-app/tree-build.ts +38 -1
- package/src/serve/hub-app/tree-svc.ts +10 -3
- package/src/serve/project-gutter-route.ts +4 -2
- package/src/serve/same-origin.ts +24 -1
- package/src/serve/serve-hub.ts +27 -3
- package/src/shipkit-files.ts +9 -7
- package/src/shot/shooter.ts +3 -3
- package/src/shot/shot-ask.ts +14 -3
- package/src/shot/shot.shipkit.ts +1 -1
- package/src/social/discord-layout.ts +282 -0
- package/src/social/fit.ts +84 -0
- package/src/social/identity-words.ts +74 -0
- package/src/social/kind-pages.ts +41 -0
- package/src/social/kinds.ts +92 -0
- package/src/social/load.ts +105 -9
- package/src/social/md.ts +14 -6
- package/src/social/media-limit.ts +63 -2
- package/src/social/presence.ts +1 -1
- package/src/social/publish/bluesky.ts +58 -19
- package/src/social/publish/discord.ts +3 -2
- package/src/social/publish/index.ts +31 -5
- package/src/social/reach.ts +49 -0
- package/src/social/release-stage.ts +173 -0
- package/src/social/routes.ts +44 -9
- package/src/social/stage.ts +227 -0
- package/src/social/strip.ts +85 -0
- package/src/social/text.ts +6 -2
- package/src/social/unit.ts +57 -1
- package/src/social/writes.ts +11 -0
- package/src/stores/routes.ts +2 -2
- package/src/suite/judge-suites.ts +1 -1
- package/src/suite/suite-cli.ts +5 -5
- package/src/trailer/build.ts +90 -52
- package/src/trailer/draft.ts +28 -0
- package/src/trailer/footage.ts +4 -2
- package/src/trailer/grammar.ts +25 -13
- package/src/trailer/graph.ts +32 -9
- package/src/trailer/profile.ts +35 -0
- package/src/trailer/prune.ts +15 -10
- package/src/trailer/public-words.ts +41 -0
- package/src/trailer/stitch.ts +22 -10
- package/src/trailer/titles.ts +47 -2
|
@@ -7,6 +7,7 @@ import { makeAutoObservable, runInAction } from 'mobx'
|
|
|
7
7
|
import type { RepoSt } from './repo-st.ts'
|
|
8
8
|
import type { Col, ColMeta, HubProblem, Resource } from './hub-types.ts'
|
|
9
9
|
import type { PlanRow } from '../../plan/planner.ts'
|
|
10
|
+
import type { SecretAnswer } from '../../collections/actions.ts'
|
|
10
11
|
import { readScreen, SCREEN_WRITE_MS, writeScreen } from './screen-cache.ts'
|
|
11
12
|
import { ownTrouble, reach } from './reach.ts'
|
|
12
13
|
|
|
@@ -58,6 +59,10 @@ export class ColsSvc {
|
|
|
58
59
|
actErr = ''
|
|
59
60
|
remarkDraft = ''
|
|
60
61
|
proofDraft = ''
|
|
62
|
+
/** a value pasted under a credential ask, by secret name: in memory only, never kept, gone once sent */
|
|
63
|
+
secretDrafts = new Map<string, string>()
|
|
64
|
+
/** what the last store answered: stored, then the check's verdict */
|
|
65
|
+
secretNote = ''
|
|
61
66
|
/** user fold choices win; default = open when the section holds needs */
|
|
62
67
|
foldOverride = new Map<string, boolean>()
|
|
63
68
|
/** the viewer's fold choices on the table groups (`checks:pass`,
|
|
@@ -245,30 +250,56 @@ export class ColsSvc {
|
|
|
245
250
|
this.actErr = ''
|
|
246
251
|
this.remarkDraft = ''
|
|
247
252
|
this.proofDraft = ''
|
|
253
|
+
this.secretDrafts.clear()
|
|
254
|
+
this.secretNote = ''
|
|
248
255
|
}
|
|
249
256
|
|
|
250
|
-
|
|
257
|
+
/** the act's json answer, null when it failed (actErr says why) */
|
|
258
|
+
private async act<T = unknown>(path: string, body: Record<string, unknown>): Promise<T | null> {
|
|
251
259
|
this.actErr = ''
|
|
252
260
|
try {
|
|
253
261
|
const r = await reach(this.st.url(`/api/act/${path}`), { method: 'POST', body: JSON.stringify(body) })
|
|
254
262
|
if (!r.ok) throw new Error(await r.text())
|
|
263
|
+
const answer = (await r.json()) as T
|
|
255
264
|
await this.poll(true)
|
|
256
|
-
return
|
|
265
|
+
return answer
|
|
257
266
|
} catch (e) {
|
|
258
267
|
runInAction(() => { this.actErr = ownTrouble(e, this.st.home.machine) })
|
|
259
|
-
return
|
|
268
|
+
return null
|
|
260
269
|
}
|
|
261
270
|
}
|
|
262
271
|
|
|
263
|
-
askDone(file: string): Promise<boolean> {
|
|
272
|
+
async askDone(file: string): Promise<boolean> {
|
|
264
273
|
const url = this.proofDraft.trim()
|
|
265
|
-
return url !== '' ? this.act('ask-proof', { file, url }) : this.act('ask-done', { file })
|
|
274
|
+
return (await (url !== '' ? this.act('ask-proof', { file, url }) : this.act('ask-done', { file }))) != null
|
|
266
275
|
}
|
|
267
276
|
async remark(body: Record<string, unknown>): Promise<void> {
|
|
268
277
|
const text = this.remarkDraft.trim()
|
|
269
278
|
if (text === '') return
|
|
270
279
|
// draft survives a failed send, so nothing typed is ever erased
|
|
271
280
|
const ok = await this.act('remark', { ...body, text })
|
|
272
|
-
if (ok) runInAction(() => { this.remarkDraft = '' })
|
|
281
|
+
if (ok != null) runInAction(() => { this.remarkDraft = '' })
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
setSecretDraft(name: string, value: string): void {
|
|
285
|
+
this.secretDrafts.set(name, value)
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/** the pasted value goes to the hub once and leaves the page: the field
|
|
289
|
+
* clears whatever the answer, a failure included */
|
|
290
|
+
async storeSecret(file: string, name: string): Promise<void> {
|
|
291
|
+
const value = this.secretDrafts.get(name) ?? ''
|
|
292
|
+
if (value.trim() === '') return
|
|
293
|
+
this.secretDrafts.delete(name)
|
|
294
|
+
this.secretNote = ''
|
|
295
|
+
const a = await this.act<SecretAnswer>('ask-secret', { file, name, value })
|
|
296
|
+
if (a == null) return
|
|
297
|
+
runInAction(() => {
|
|
298
|
+
// a passing check archived the ask: its page is now the done one
|
|
299
|
+
if (a.check === 'passed') this.select('asks', `ask:done/${file}`)
|
|
300
|
+
this.secretNote = a.check === 'passed' ? `stored ${a.stored}: the check passes, the ask is archived`
|
|
301
|
+
: a.check === 'none' ? `stored ${a.stored}: this ask has no check, click done once every value is in`
|
|
302
|
+
: `stored ${a.stored}, but the check still fails: ${a.why}`
|
|
303
|
+
})
|
|
273
304
|
}
|
|
274
305
|
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// a repo's commands page (wiki tools/shipkit/hub.md, The commands page): the command the tree opened, its examples,
|
|
2
|
+
// its args and its runs, and the shown run's log as it prints. The tree is the list (tree-build.ts commandResources)
|
|
3
|
+
import { observer } from 'mobx-react-lite'
|
|
4
|
+
import { useEffect, useRef } from 'react'
|
|
5
|
+
import type { CommandRow } from '../../../cli/cmd_Commands.ts'
|
|
6
|
+
import { exampleArgs, type RunView } from '../../../commands/model.ts'
|
|
7
|
+
import type { RepoSt } from '../repo-st.ts'
|
|
8
|
+
import type { CommandsSt } from './commands-st.ts'
|
|
9
|
+
|
|
10
|
+
/** a run's length as he reads it: 4.2 s, 73 s, 3 min 12 s */
|
|
11
|
+
export const fmtDur = (ms: number): string => {
|
|
12
|
+
const s = Math.max(0, ms) / 1000
|
|
13
|
+
if (s < 10) return `${s.toFixed(1)} s`
|
|
14
|
+
if (s < 120) return `${Math.round(s)} s`
|
|
15
|
+
return `${Math.floor(s / 60)} min ${Math.round(s % 60)} s`
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const STATE_WORD = { running: 'running', done: 'ended', lost: 'lost: its runner died with no exit code' } as const
|
|
19
|
+
|
|
20
|
+
const runTone = (r: RunView): string => (r.state === 'running' ? 'warn' : r.state === 'lost' || (r.exit?.code ?? 0) !== 0 ? 'red' : 'ok')
|
|
21
|
+
|
|
22
|
+
const RunLine = observer(({ app, r }: { app: RepoSt; r: RunView }) => {
|
|
23
|
+
const c = app.commands
|
|
24
|
+
const took = r.exit != null ? fmtDur(r.exit.finishedAt - r.startedAt) : r.state === 'running' ? fmtDur(app.clock.now - r.startedAt) : ''
|
|
25
|
+
return (
|
|
26
|
+
<button className={`cmdrunline${c.runId === r.id ? ' on' : ''}`} onClick={() => app.showCommands(r.path, r.id)} title={new Date(r.startedAt).toLocaleString()}>
|
|
27
|
+
<span className={`tl ${runTone(r)}`}>{r.state === 'running' ? '●' : r.exit?.code === 0 ? '✓' : '✗'}</span>
|
|
28
|
+
<code>{r.line}</code>
|
|
29
|
+
<span className="dim">{r.exit != null ? `exit ${r.exit.code}` : STATE_WORD[r.state]}{took ? `, ${took}` : ''}{r.reach === 'tailnet' ? ', from another device' : ''}</span>
|
|
30
|
+
</button>
|
|
31
|
+
)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const CommandCard = observer(({ app, row }: { app: RepoSt; row: CommandRow }) => {
|
|
35
|
+
const c = app.commands
|
|
36
|
+
const args = c.draft(row.path)
|
|
37
|
+
return (
|
|
38
|
+
<section className="csec">
|
|
39
|
+
<div className="cmdhead"><code className="cmdname">{c.bin} {row.path}</code>{row.effect === 'outward' ? <span className="cmdout">outward: asks before it runs</span> : null}</div>
|
|
40
|
+
<div>{row.description}</div>
|
|
41
|
+
{row.examples.length > 0 ? (
|
|
42
|
+
<div className="cmdexs">
|
|
43
|
+
{row.examples.map(([label, line]) => {
|
|
44
|
+
const a = exampleArgs(c.bin, row.path, line)
|
|
45
|
+
return (
|
|
46
|
+
<div key={line} className="cmdex">
|
|
47
|
+
<button className="primary" disabled={a == null || c.starting} title={a == null ? 'an example of another command' : `run ${line}`} onClick={() => a != null && void c.runIt(row, a)}>▶</button>
|
|
48
|
+
<code>{line}</code>
|
|
49
|
+
<span className="dim">{label}</span>
|
|
50
|
+
</div>
|
|
51
|
+
)
|
|
52
|
+
})}
|
|
53
|
+
</div>
|
|
54
|
+
) : null}
|
|
55
|
+
<form className="row" onSubmit={(e) => { e.preventDefault(); void c.runIt(row, args) }}>
|
|
56
|
+
<code className="dim">{c.bin} {row.path}</code>
|
|
57
|
+
<input value={args} placeholder="args, as you would type them" onChange={(e) => c.setDraft(row.path, e.target.value)} />
|
|
58
|
+
<button type="submit" className="primary" disabled={c.starting}>run</button>
|
|
59
|
+
</form>
|
|
60
|
+
{row.options.length > 0 ? (
|
|
61
|
+
<details className="cmdopts">
|
|
62
|
+
<summary className="dim">{row.options.length} options</summary>
|
|
63
|
+
<table><tbody>{row.options.map((o) => <tr key={o.definition}><td><code>{o.definition}</code></td><td className="dim">{o.description}</td></tr>)}</tbody></table>
|
|
64
|
+
</details>
|
|
65
|
+
) : null}
|
|
66
|
+
</section>
|
|
67
|
+
)
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
const LogPane = observer(({ app, c }: { app: RepoSt; c: CommandsSt }) => {
|
|
71
|
+
const pre = useRef<HTMLPreElement>(null)
|
|
72
|
+
const stuck = useRef(true)
|
|
73
|
+
const text = c.shown
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
const el = pre.current
|
|
76
|
+
if (el != null && stuck.current) el.scrollTop = el.scrollHeight
|
|
77
|
+
}, [text])
|
|
78
|
+
const r = c.run
|
|
79
|
+
if (r == null) return null
|
|
80
|
+
return (
|
|
81
|
+
<section className="csec cmdlogsec">
|
|
82
|
+
<div className="cmdhead">
|
|
83
|
+
<RunLine app={app} r={r} />
|
|
84
|
+
{r.state === 'running' ? <button onClick={() => void c.stopRun()}>stop</button> : null}
|
|
85
|
+
</div>
|
|
86
|
+
<pre ref={pre} className="cmdlog" onScroll={(e) => { const el = e.currentTarget; stuck.current = el.scrollHeight - el.scrollTop - el.clientHeight < 24 }}>
|
|
87
|
+
{text === '' ? <span className="dim">{r.state === 'running' ? 'no output yet' : 'it printed nothing'}</span> : text}
|
|
88
|
+
</pre>
|
|
89
|
+
</section>
|
|
90
|
+
)
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
export const CommandsPage = observer(({ app }: { app: RepoSt }) => {
|
|
94
|
+
const c = app.commands
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
c.start()
|
|
97
|
+
return () => c.stop()
|
|
98
|
+
}, [c])
|
|
99
|
+
const row = c.row
|
|
100
|
+
const runs = row == null ? c.runs : c.cmdRuns
|
|
101
|
+
return (
|
|
102
|
+
<div className="stagewrap">
|
|
103
|
+
<div className="colcard cmdpage">
|
|
104
|
+
<div className="chead">
|
|
105
|
+
<span className="tid">commands</span>
|
|
106
|
+
<h3 className="ctitle">{c.bin || app.name}</h3>
|
|
107
|
+
</div>
|
|
108
|
+
<div className="usays">the project CLI, run from here: a command that acts beyond this machine, and any run from another device, asks first</div>
|
|
109
|
+
{c.error !== '' ? <div className="warnline">{c.error}</div> : null}
|
|
110
|
+
{c.view == null && c.error === '' ? <div className="dim twait"><span className="spin" />reading the commands…</div> : null}
|
|
111
|
+
{row != null ? <CommandCard app={app} row={row} /> : c.rows.length > 0 ? <div className="dim">{c.rows.length} commands: pick one in the tree, under commands</div> : null}
|
|
112
|
+
<LogPane app={app} c={c} />
|
|
113
|
+
{runs.length > 0 ? (
|
|
114
|
+
<section className="csec">
|
|
115
|
+
<div className="cstitle">{row == null ? 'the last runs' : 'its last runs'} ({runs.length})</div>
|
|
116
|
+
{runs.map((r) => <RunLine key={r.id} app={app} r={r} />)}
|
|
117
|
+
</section>
|
|
118
|
+
) : null}
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
)
|
|
122
|
+
})
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
// a repo's commands page as state (wiki tools/shipkit/hub.md, The commands page): its project CLI's registry and
|
|
2
|
+
// runs, read with the repo (they are rows of the tree) and again when the page opens, and the shown run's log tailed
|
|
3
|
+
// from where the last read stopped while it runs. The
|
|
4
|
+
// args he types for a command are kept per repo in this browser, so a reopen finds them
|
|
5
|
+
import { makeAutoObservable, observableRef, runInAction } from 'mobx'
|
|
6
|
+
import type { CommandRow } from '../../../cli/cmd_Commands.ts'
|
|
7
|
+
import { type CommandsView, confirmWhy, type LogView, type RunView } from '../../../commands/model.ts'
|
|
8
|
+
import { ownTrouble, reach } from '../reach.ts'
|
|
9
|
+
import type { RepoSt } from '../repo-st.ts'
|
|
10
|
+
|
|
11
|
+
/** how often the shown run's log is read while it runs */
|
|
12
|
+
export const TAIL_MS = 500
|
|
13
|
+
/** the most log the page keeps: the tail of a long run */
|
|
14
|
+
const LOG_KEEP = 2 * 1024 * 1024
|
|
15
|
+
|
|
16
|
+
/** a log as a terminal leaves it: a line rewritten with `\r` shows its last state */
|
|
17
|
+
export const shownLog = (text: string): string => text.split('\n').map((l) => l.slice(l.lastIndexOf('\r') + 1)).join('\n')
|
|
18
|
+
|
|
19
|
+
const draftsKey = (repo: string): string => `sk-commands-args:${repo}`
|
|
20
|
+
|
|
21
|
+
export class CommandsSt {
|
|
22
|
+
view: CommandsView | null = null
|
|
23
|
+
error = ''
|
|
24
|
+
/** the command open, by its words */
|
|
25
|
+
cmd: string | null = null
|
|
26
|
+
/** the run shown, by its id */
|
|
27
|
+
runId: string | null = null
|
|
28
|
+
run: RunView | null = null
|
|
29
|
+
log = ''
|
|
30
|
+
private next = 0
|
|
31
|
+
/** the args typed per command */
|
|
32
|
+
drafts: Record<string, string> = {}
|
|
33
|
+
starting = false
|
|
34
|
+
private timer: ReturnType<typeof setInterval> | null = null
|
|
35
|
+
private reading = false
|
|
36
|
+
|
|
37
|
+
constructor(private readonly st: RepoSt) {
|
|
38
|
+
makeAutoObservable<this, 'st' | 'timer' | 'reading' | 'next' | 'onBack'>(this, { st: false, timer: false, reading: false, next: false, onBack: false, view: observableRef, run: observableRef })
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
get bin(): string {
|
|
42
|
+
return this.view?.bin ?? ''
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
get rows(): CommandRow[] {
|
|
46
|
+
return this.view?.rows ?? []
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
get runs(): RunView[] {
|
|
50
|
+
return this.view?.runs ?? []
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** the runs still going: the section's count */
|
|
54
|
+
get running(): number {
|
|
55
|
+
return this.runs.filter((r) => r.state === 'running').length
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
get row(): CommandRow | null {
|
|
59
|
+
return this.rows.find((r) => r.path === this.cmd) ?? null
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** the runs of the open command, newest first */
|
|
63
|
+
get cmdRuns(): RunView[] {
|
|
64
|
+
return this.runs.filter((r) => r.path === this.cmd)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
get shown(): string {
|
|
68
|
+
return shownLog(this.log)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
draft(path: string): string {
|
|
72
|
+
return this.drafts[path] ?? ''
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
setDraft(path: string, v: string): void {
|
|
76
|
+
this.drafts[path] = v
|
|
77
|
+
try { localStorage.setItem(draftsKey(this.st.key), JSON.stringify(this.drafts)) } catch { /* a private window keeps none */ }
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** the address moved: a run shown from its first byte when it changed */
|
|
81
|
+
select(cmd: string | null, run: string | null): void {
|
|
82
|
+
this.cmd = cmd
|
|
83
|
+
if (run === this.runId) return
|
|
84
|
+
this.runId = run
|
|
85
|
+
this.run = this.runs.find((r) => r.id === run) ?? null
|
|
86
|
+
this.log = ''
|
|
87
|
+
this.next = 0
|
|
88
|
+
if (run != null && this.timer != null) void this.tail()
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
start(): void {
|
|
92
|
+
if (this.timer != null) return
|
|
93
|
+
try { this.drafts = JSON.parse(localStorage.getItem(draftsKey(this.st.key)) ?? '{}') as Record<string, string> } catch { this.drafts = {} }
|
|
94
|
+
window.addEventListener('focus', this.onBack)
|
|
95
|
+
void this.load().then(() => this.tail())
|
|
96
|
+
this.timer = setInterval(() => { if (this.run?.state === 'running') void this.tail() }, TAIL_MS)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
stop(): void {
|
|
100
|
+
if (this.timer != null) clearInterval(this.timer)
|
|
101
|
+
this.timer = null
|
|
102
|
+
window.removeEventListener('focus', this.onBack)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
private readonly onBack = (): void => void this.load()
|
|
106
|
+
|
|
107
|
+
async load(): Promise<void> {
|
|
108
|
+
try {
|
|
109
|
+
const r = await reach(this.st.url('/api/commands'))
|
|
110
|
+
if (!r.ok) throw new Error(`${r.status} ${await r.text()}`)
|
|
111
|
+
const v = (await r.json()) as CommandsView
|
|
112
|
+
runInAction(() => {
|
|
113
|
+
this.view = v
|
|
114
|
+
this.error = v.error ?? ''
|
|
115
|
+
if (this.runId != null && this.run == null) this.run = v.runs.find((x) => x.id === this.runId) ?? null
|
|
116
|
+
})
|
|
117
|
+
} catch (e) {
|
|
118
|
+
runInAction(() => { this.error = ownTrouble(e, this.st.home.machine, (m) => `read the commands: ${m}`) })
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** the shown run's log since the last read, its state with it; the list again once it ended */
|
|
123
|
+
async tail(): Promise<void> {
|
|
124
|
+
const id = this.runId
|
|
125
|
+
if (id == null || this.reading) return
|
|
126
|
+
this.reading = true
|
|
127
|
+
try {
|
|
128
|
+
for (;;) {
|
|
129
|
+
const r = await reach(this.st.url(`/api/commands/runs/${id}?from=${this.next}`))
|
|
130
|
+
if (!r.ok) throw new Error(`${r.status} ${await r.text()}`)
|
|
131
|
+
const v = (await r.json()) as LogView
|
|
132
|
+
if (id !== this.runId) return
|
|
133
|
+
const ended = this.run?.state === 'running' && v.run.state !== 'running'
|
|
134
|
+
runInAction(() => {
|
|
135
|
+
this.run = v.run
|
|
136
|
+
this.log = (this.log + v.text).slice(-LOG_KEEP)
|
|
137
|
+
this.next = v.next
|
|
138
|
+
})
|
|
139
|
+
if (ended) void this.load()
|
|
140
|
+
if (v.next >= v.size) return
|
|
141
|
+
}
|
|
142
|
+
} catch (e) {
|
|
143
|
+
runInAction(() => { this.error = ownTrouble(e, this.st.home.machine, (m) => `read the run: ${m}`) })
|
|
144
|
+
} finally {
|
|
145
|
+
this.reading = false
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** run a command with its args; a confirm first when it acts on the world or he is on another device */
|
|
150
|
+
async runIt(row: CommandRow, args: string): Promise<void> {
|
|
151
|
+
if (this.starting || this.view == null) return
|
|
152
|
+
const line = `${this.bin} ${row.path}${args.trim() === '' ? '' : ` ${args.trim()}`}`
|
|
153
|
+
const why = confirmWhy(row, this.view.reach)
|
|
154
|
+
if (why != null && !confirm(`Run « ${line} »?\n\nThis asks first: ${why}.`)) return
|
|
155
|
+
this.starting = true
|
|
156
|
+
try {
|
|
157
|
+
const r = await reach(this.st.url('/api/commands/run'), { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ path: row.path, args, confirmed: why != null }) })
|
|
158
|
+
const body = (await r.json()) as { run?: RunView; error?: string; confirm?: string }
|
|
159
|
+
if (!r.ok || body.run == null) throw new Error(body.error ?? body.confirm ?? `HTTP ${r.status}`)
|
|
160
|
+
const run = body.run
|
|
161
|
+
runInAction(() => { if (this.view != null) this.view = { ...this.view, runs: [run, ...this.view.runs] } })
|
|
162
|
+
this.st.showCommands(row.path, run.id)
|
|
163
|
+
} catch (e) {
|
|
164
|
+
runInAction(() => { this.error = ownTrouble(e, this.st.home.machine, (m) => `run ${line}: ${m}`) })
|
|
165
|
+
} finally {
|
|
166
|
+
runInAction(() => { this.starting = false })
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
async stopRun(): Promise<void> {
|
|
171
|
+
const id = this.runId
|
|
172
|
+
if (id == null) return
|
|
173
|
+
const r = await reach(this.st.url(`/api/commands/runs/${id}/stop`), { method: 'POST' }).catch(() => null)
|
|
174
|
+
if (r != null && !r.ok) runInAction(() => { this.error = `stop: ${r.status}` })
|
|
175
|
+
void this.tail()
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* the commands page (hub-app/commands/, wiki tools/shipkit/hub.md, The commands page): the command the tree opened,
|
|
2
|
+
its log and its runs, one column like the git page */
|
|
3
|
+
.cmdpage{display:flex;flex-direction:column;gap:var(--s3)}
|
|
4
|
+
.cmdpage>.csec{display:flex;flex-direction:column;gap:var(--s2)}
|
|
5
|
+
/* a command line reads as text in a line, never the hub's boxed code block */
|
|
6
|
+
.colcard.cmdpage code{display:inline;background:none;border:0;padding:0;margin:0;max-height:none;overflow:visible;font:12.5px ui-monospace,Menlo,monospace;color:var(--ink);white-space:nowrap}
|
|
7
|
+
.cmdrunline{display:flex;gap:var(--s2);align-items:baseline;text-align:left;border-color:transparent;padding:var(--s1) var(--s2);min-width:0;width:100%}
|
|
8
|
+
.colcard.cmdpage .cmdrunline code{flex:0 1 auto;overflow:hidden;text-overflow:ellipsis}
|
|
9
|
+
.cmdrunline .dim{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
10
|
+
.cmdrunline.on{background:var(--sel);border-color:var(--accent)}
|
|
11
|
+
.cmdout{flex:none;font-size:11px;color:var(--warn);border:1px solid var(--warn);border-radius:999px;padding:0 var(--s1)}
|
|
12
|
+
.cmdhead{display:flex;gap:var(--s2);align-items:center;flex-wrap:wrap}
|
|
13
|
+
.cmdhead .cmdrunline{flex:1;width:auto}
|
|
14
|
+
.colcard.cmdpage .cmdname{font-size:14px;font-weight:600}
|
|
15
|
+
.cmdexs{display:flex;flex-direction:column;gap:var(--s1)}
|
|
16
|
+
.cmdex{display:grid;grid-template-columns:auto minmax(0,max-content) minmax(0,1fr);gap:var(--s2);align-items:baseline}
|
|
17
|
+
.colcard.cmdpage .cmdex code{white-space:pre-wrap;word-break:break-word}
|
|
18
|
+
.cmdex button{padding:0 var(--s2)}
|
|
19
|
+
.colcard.cmdpage form.row{margin-top:0}
|
|
20
|
+
.colcard.cmdpage form.row input{min-width:0}
|
|
21
|
+
.cmdopts table{border-collapse:collapse;font-size:12.5px}
|
|
22
|
+
.cmdopts td{padding:var(--s0) var(--s2) var(--s0) 0;vertical-align:top}
|
|
23
|
+
.cmdlog{margin:0;max-height:60vh;overflow:auto;background:var(--bg);border:1px solid var(--line);border-radius:4px;padding:var(--s2);font:12px/1.45 ui-monospace,Menlo,monospace;white-space:pre-wrap;word-break:break-word}
|
|
24
|
+
@media (max-width:900px){.cmdex{grid-template-columns:auto minmax(0,1fr)}.cmdex .dim{grid-column:2}.colcard.cmdpage form.row>code{display:none}}
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
/** every selection the page can show. Each one has an address, so nothing
|
|
10
10
|
* that decides which page is on screen lives outside the url */
|
|
11
11
|
import { RUNS_ID } from '../../collections/collection-types.ts'
|
|
12
|
+
import { isMessagesTab, type MessagesTab } from '../../messages/tabs.ts'
|
|
13
|
+
import { isVersion } from '../../releases/model.ts'
|
|
12
14
|
import { runsTab, runsTabId } from './runs-tabs.ts'
|
|
13
15
|
|
|
14
16
|
export type HashSel =
|
|
@@ -31,6 +33,8 @@ export type HashSel =
|
|
|
31
33
|
| { t: 'plan' }
|
|
32
34
|
/** the repo's git: branch, upstream, uncommitted files, recent commits */
|
|
33
35
|
| { t: 'git' }
|
|
36
|
+
/** the project CLI run from the page: a command by its words, null for none open; one of its runs shown */
|
|
37
|
+
| { t: 'commands'; cmd: string | null; run?: string | null }
|
|
34
38
|
/** what runs when: every check on every context, with the legend */
|
|
35
39
|
| { t: 'when' }
|
|
36
40
|
/** the checks one owner ships: shipkit's, or the repo's own */
|
|
@@ -42,6 +46,10 @@ export type HashSel =
|
|
|
42
46
|
| { t: 'trailer'; trailer: string | null; cut: string | null; note?: string | null; filter?: 'open' | 'all' | null }
|
|
43
47
|
/** the store pages: a store, null for the first; a thing of it to scroll to (a picture's path, `field:<heading>`) */
|
|
44
48
|
| { t: 'stores'; store: string | null; asset?: string | null }
|
|
49
|
+
/** the releases page on a version (`next` or X.Y.Z), null for the first */
|
|
50
|
+
| { t: 'releases'; version: string | null }
|
|
51
|
+
/** the messages page: its tab, the run it scores by when not the newest */
|
|
52
|
+
| { t: 'messages'; tab: MessagesTab; run?: string }
|
|
45
53
|
/** the Veille: the post picked, null for none; the window, chips, folds and lightbox as `window=3d&tags=a,b` */
|
|
46
54
|
| { t: 'veille'; post: string | null; q?: string }
|
|
47
55
|
/** Communications: a draft, null for the first the list keeps, one message of its series; the list's view as
|
|
@@ -56,7 +64,7 @@ export type HashSel =
|
|
|
56
64
|
export type CheckOwner = 'shipkit' | 'repo'
|
|
57
65
|
|
|
58
66
|
export type ParsedHash = {
|
|
59
|
-
kind: 'asset' | 'cat' | 'col' | 'item' | 'status' | 'tests' | 'admin' | 'readme' | 'processes' | 'plan' | 'git' | 'when' | 'checks' | 'review' | 'trailer' | 'stores' | 'veille' | 'comms' | 'social' | 'page' | 'none'
|
|
67
|
+
kind: 'asset' | 'cat' | 'col' | 'item' | 'status' | 'tests' | 'admin' | 'readme' | 'processes' | 'plan' | 'git' | 'commands' | 'when' | 'checks' | 'review' | 'trailer' | 'stores' | 'releases' | 'messages' | 'veille' | 'comms' | 'social' | 'page' | 'none'
|
|
60
68
|
/** the collection, for an item. null for everything else */
|
|
61
69
|
col: string | null
|
|
62
70
|
id: string
|
|
@@ -81,11 +89,14 @@ const README = 'page:readme'
|
|
|
81
89
|
const PROCESSES = 'page:processes'
|
|
82
90
|
const PLAN = 'page:plan'
|
|
83
91
|
const GIT = 'page:git'
|
|
92
|
+
const COMMANDS = 'page:commands'
|
|
84
93
|
const WHEN = 'page:when'
|
|
85
94
|
const CHECKS = 'page:checks:'
|
|
86
95
|
const REVIEW = 'page:review'
|
|
87
96
|
const TRAILER = 'page:trailer'
|
|
88
97
|
const STORES = 'page:stores'
|
|
98
|
+
const RELEASES = 'page:releases'
|
|
99
|
+
const MESSAGES = 'page:messages'
|
|
89
100
|
const VEILLE = 'page:veille'
|
|
90
101
|
const COMMS = 'page:comms'
|
|
91
102
|
const SOCIAL = 'page:social'
|
|
@@ -107,6 +118,8 @@ export function hashFor(sel: HashSel | null): string | null {
|
|
|
107
118
|
case 'processes': return sel.id == null ? PROCESSES : `${PROCESSES}:${sel.id}`
|
|
108
119
|
case 'plan': return PLAN
|
|
109
120
|
case 'git': return GIT
|
|
121
|
+
// page:commands:<words joined by />@<run>, each part only when it says something
|
|
122
|
+
case 'commands': return sel.cmd == null ? COMMANDS : `${COMMANDS}:${sel.cmd.split(' ').join('/')}${sel.run ? `@${sel.run}` : ''}`
|
|
110
123
|
case 'when': return WHEN
|
|
111
124
|
case 'checks': return `${CHECKS}${sel.from}`
|
|
112
125
|
// page:review:<id>?view=1&subject=place, the query only when it says something
|
|
@@ -118,6 +131,10 @@ export function hashFor(sel: HashSel | null): string | null {
|
|
|
118
131
|
}
|
|
119
132
|
// page:stores:<store>/<asset>, the asset as it is: a path or a heading carries any character
|
|
120
133
|
case 'stores': return sel.store == null ? STORES : `${STORES}:${sel.store}${sel.asset ? `/${sel.asset}` : ''}`
|
|
134
|
+
// page:releases:<version>
|
|
135
|
+
case 'releases': return sel.version == null ? RELEASES : `${RELEASES}:${sel.version}`
|
|
136
|
+
// page:messages:<tab>?run=<run>, the tab only past the first, the run only when picked
|
|
137
|
+
case 'messages': return `${sel.tab === 'messages' ? MESSAGES : `${MESSAGES}:${sel.tab}`}${sel.run ? `?run=${sel.run}` : ''}`
|
|
121
138
|
// page:veille:<platform>:<id>?window=3d, the query only when it says something
|
|
122
139
|
case 'veille': return `${sel.post == null ? VEILLE : `${VEILLE}:${sel.post}`}${sel.q ? `?${sel.q}` : ''}`
|
|
123
140
|
// page:comms:<slug>/<part>?fam=feed, each part only when it says something
|
|
@@ -142,6 +159,14 @@ export function parseHash(raw: string): ParsedHash {
|
|
|
142
159
|
if (raw === PROCESSES) return { kind: 'processes', col: null, id: '', tools: null }
|
|
143
160
|
if (raw === PLAN) return { kind: 'plan', col: null, id: '', tools: null }
|
|
144
161
|
if (raw === GIT) return { kind: 'git', col: null, id: '', tools: null }
|
|
162
|
+
// the command's words ride in `id`, the run in `col`
|
|
163
|
+
if (raw === COMMANDS || raw.startsWith(`${COMMANDS}:`)) {
|
|
164
|
+
const rest = raw.slice(COMMANDS.length + 1)
|
|
165
|
+
const at = rest.indexOf('@')
|
|
166
|
+
const words = (at === -1 ? rest : rest.slice(0, at)).split('/').join(' ')
|
|
167
|
+
const run = at === -1 ? '' : rest.slice(at + 1)
|
|
168
|
+
return { kind: 'commands', col: run === '' ? null : run, id: words, tools: null }
|
|
169
|
+
}
|
|
145
170
|
if (raw === WHEN) return { kind: 'when', col: null, id: '', tools: null }
|
|
146
171
|
if (raw === REVIEW || raw.startsWith(`${REVIEW}:`) || raw.startsWith(`${REVIEW}?`)) {
|
|
147
172
|
const qi = raw.indexOf('?')
|
|
@@ -158,6 +183,17 @@ export function parseHash(raw: string): ParsedHash {
|
|
|
158
183
|
return { kind: 'trailer', col: trailer === '' ? null : trailer, id: cut, tools: null, ...(note ? { note } : {}), ...(f === 'open' || f === 'all' ? { filter: f } : {}) }
|
|
159
184
|
}
|
|
160
185
|
// the store rides in `col`, the thing named in `id`: everything after the first slash
|
|
186
|
+
// the tab rides in `id`, the run in `q`; a tab this build does not name opens the first
|
|
187
|
+
if (raw === MESSAGES || raw.startsWith(`${MESSAGES}:`) || raw.startsWith(`${MESSAGES}?`)) {
|
|
188
|
+
const qi = raw.indexOf('?')
|
|
189
|
+
const tab = (qi === -1 ? raw : raw.slice(0, qi)).slice(MESSAGES.length + 1)
|
|
190
|
+
const run = qi === -1 ? null : new URLSearchParams(raw.slice(qi + 1)).get('run')
|
|
191
|
+
return { kind: 'messages', col: null, id: isMessagesTab(tab) ? tab : 'messages', tools: null, ...(run ? { q: run } : {}) }
|
|
192
|
+
}
|
|
193
|
+
if (raw === RELEASES || raw.startsWith(`${RELEASES}:`)) {
|
|
194
|
+
const v = raw.slice(RELEASES.length + 1)
|
|
195
|
+
return { kind: 'releases', col: null, id: isVersion(v) ? v : '', tools: null }
|
|
196
|
+
}
|
|
161
197
|
if (raw === STORES || raw.startsWith(`${STORES}:`)) {
|
|
162
198
|
const rest = raw.slice(STORES.length + 1)
|
|
163
199
|
const cut = rest.indexOf('/')
|
|
@@ -234,11 +270,14 @@ export function selOf(p: ParsedHash): HashSel | null {
|
|
|
234
270
|
case 'processes': return { t: 'processes', id: p.id === '' ? null : p.id }
|
|
235
271
|
case 'plan': return { t: 'plan' }
|
|
236
272
|
case 'git': return { t: 'git' }
|
|
273
|
+
case 'commands': return { t: 'commands', cmd: p.id === '' ? null : p.id, ...(p.col ? { run: p.col } : {}) }
|
|
237
274
|
case 'when': return { t: 'when' }
|
|
238
275
|
case 'checks': return { t: 'checks', from: p.id as CheckOwner }
|
|
239
276
|
case 'review': return { t: 'review', id: p.id === '' ? null : p.id, ...(p.q ? { q: p.q } : {}) }
|
|
240
277
|
case 'trailer': return { t: 'trailer', trailer: p.col, cut: p.id === '' ? null : p.id, ...(p.note ? { note: p.note } : {}), ...(p.filter ? { filter: p.filter } : {}) }
|
|
241
278
|
case 'stores': return { t: 'stores', store: p.col, ...(p.id ? { asset: p.id } : {}) }
|
|
279
|
+
case 'releases': return { t: 'releases', version: p.id === '' ? null : p.id }
|
|
280
|
+
case 'messages': return { t: 'messages', tab: isMessagesTab(p.id) ? p.id : 'messages', ...(p.q ? { run: p.q } : {}) }
|
|
242
281
|
case 'veille': return { t: 'veille', post: p.id === '' ? null : p.id, ...(p.q ? { q: p.q } : {}) }
|
|
243
282
|
case 'comms': return { t: 'comms', draft: p.col, ...(p.id ? { part: p.id } : {}), ...(p.q ? { q: p.q } : {}) }
|
|
244
283
|
case 'page': return { t: 'page', repo: p.col!, id: p.id, ...(p.q ? { q: p.q } : {}) }
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
// the one constraint a reader breaks first: the url and the tree move
|
|
11
11
|
// together, and only `show` moves the page. A list click, a link, back,
|
|
12
12
|
// forward and a hand edited address all land there.
|
|
13
|
-
import { makeAutoObservable, observableShallow, reaction
|
|
13
|
+
import { makeAutoObservable, observableShallow, reaction } from 'mobx'
|
|
14
|
+
import { startAppBridge } from './app-bridge.ts'
|
|
14
15
|
import { currentHash, hashFor } from './hash-route.ts'
|
|
15
16
|
import { MachineSt, type MachineOpts } from './machine-st.ts'
|
|
16
17
|
import { LayoutSt } from './layout-st.ts'
|
|
@@ -105,7 +106,7 @@ export class HomeSt {
|
|
|
105
106
|
selected: string | null = null
|
|
106
107
|
/** every repo visited, by key, kept for the life of the page */
|
|
107
108
|
repos = new Map<string, RepoSt>()
|
|
108
|
-
private disposers:
|
|
109
|
+
private disposers: (() => void)[] = []
|
|
109
110
|
/** a read ahead is going: one repo at a time, never two loops */
|
|
110
111
|
private prefetching = false
|
|
111
112
|
private readonly onUrl = (): void => this.fromUrl()
|
|
@@ -195,6 +196,14 @@ export class HomeSt {
|
|
|
195
196
|
// the embed page shows one repo's page alone: no dock, so no request for the house's runs
|
|
196
197
|
if (this.base === undefined) this.dock.boot()
|
|
197
198
|
this.disposers.push(reaction(() => this.title, (t) => { document.title = t }, { fireImmediately: true }))
|
|
199
|
+
// the shipkit app's Dock badge and notifications: the home's whole house count, a no-op in a browser tab
|
|
200
|
+
if (this.machine != null) {
|
|
201
|
+
this.disposers.push(startAppBridge({
|
|
202
|
+
projects: this.projects,
|
|
203
|
+
cardUrl: (repo, id) => `${location.origin}${repoPage(repo)}#${hashFor({ t: 'review', id, q: WAITING })}`,
|
|
204
|
+
hooks: { openCard: (repo, id) => this.openReview(repo, id), openInbox: () => this.navigate(PLACE_PATH.inbox) },
|
|
205
|
+
}))
|
|
206
|
+
}
|
|
198
207
|
// back, forward, a pasted link and a hand edited hash all arrive
|
|
199
208
|
// here; fromUrl is idempotent, so the two events firing together
|
|
200
209
|
// for one move cost nothing
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
<link rel="stylesheet" href="./controls.css" />
|
|
19
19
|
<link rel="stylesheet" href="./review.css" />
|
|
20
20
|
<link rel="stylesheet" href="./stores.css" />
|
|
21
|
+
<link rel="stylesheet" href="./messages.css" />
|
|
22
|
+
<link rel="stylesheet" href="./releases.css" />
|
|
23
|
+
<link rel="stylesheet" href="./commands.css" />
|
|
21
24
|
<link rel="stylesheet" href="./veille.css" />
|
|
22
25
|
<link rel="stylesheet" href="./social.css" />
|
|
23
26
|
<link rel="stylesheet" href="./inbox.css" />
|
|
@@ -28,11 +28,14 @@ import { ProcessesPage } from './processes-view.tsx'
|
|
|
28
28
|
import { PlanPage } from './plan-view.tsx'
|
|
29
29
|
import { WhenPage } from './when-view.tsx'
|
|
30
30
|
import { GitPage } from './git-view.tsx'
|
|
31
|
+
import { CommandsPage } from './commands/commands-page.tsx'
|
|
31
32
|
import { AdminPage } from './admin-view.tsx'
|
|
32
33
|
import { ReadmeView } from './readme-view.tsx'
|
|
33
34
|
import { ReviewPage } from './review/review-page.tsx'
|
|
34
35
|
import { TrailerPage } from './review/trailer-page.tsx'
|
|
35
36
|
import { StoresPage } from './stores/stores-page.tsx'
|
|
37
|
+
import { MessagesPage } from './messages/messages-page.tsx'
|
|
38
|
+
import { ReleasesPage } from './releases/releases-page.tsx'
|
|
36
39
|
import { VeillePage } from './veille/veille-page.tsx'
|
|
37
40
|
import { CommsPage } from './social/comms-page.tsx'
|
|
38
41
|
import { SocialPage } from './social/social-page.tsx'
|
|
@@ -98,6 +101,8 @@ const Main = observer(({ app }: { app: RepoSt }) => {
|
|
|
98
101
|
if (app.sel?.t === 'review') return <main>{errs}<ReviewPage app={app} /></main>
|
|
99
102
|
if (app.sel?.t === 'trailer') return <main>{errs}<TrailerPage app={app} /></main>
|
|
100
103
|
if (app.sel?.t === 'stores') return <main>{errs}<StoresPage app={app} /></main>
|
|
104
|
+
if (app.sel?.t === 'releases') return <main>{errs}<div className="stagewrap"><ReleasesPage app={app} /></div></main>
|
|
105
|
+
if (app.sel?.t === 'messages') return <main>{errs}<div className="stagewrap"><MessagesPage app={app} /></div></main>
|
|
101
106
|
if (app.sel?.t === 'veille') return <main>{errs}<VeillePage app={app} /></main>
|
|
102
107
|
if (app.sel?.t === 'comms') return <main>{errs}<CommsPage app={app} /></main>
|
|
103
108
|
if (app.sel?.t === 'social') return <main>{errs}<SocialPage app={app} /></main>
|
|
@@ -105,6 +110,7 @@ const Main = observer(({ app }: { app: RepoSt }) => {
|
|
|
105
110
|
if (app.sel?.t === 'admin') return <main>{errs}<div className="stagewrap"><AdminPage app={app} /></div></main>
|
|
106
111
|
if (app.sel?.t === 'plan') return <main>{errs}<div className="stagewrap"><PlanPage app={app} /></div></main>
|
|
107
112
|
if (app.sel?.t === 'git') return <main>{errs}<div className="stagewrap"><GitPage app={app} /></div></main>
|
|
113
|
+
if (app.sel?.t === 'commands') return <main>{errs}<CommandsPage app={app} /></main>
|
|
108
114
|
if (app.sel?.t === 'checks') return <main>{errs}<CheckTable app={app} id="checks" from={app.sel.from} /></main>
|
|
109
115
|
if (app.sel?.t === 'when') return <main>{errs}<div className="stagewrap"><WhenPage app={app} /></div></main>
|
|
110
116
|
if (app.sel?.t === 'processes') return <main>{errs}<div className="stagewrap"><ProcessesPage app={app} id={app.sel.id} /></div></main>
|
|
@@ -437,6 +437,7 @@ kbd{background:var(--panel2);border:1px solid var(--line);border-radius:4px;padd
|
|
|
437
437
|
.colcard .cand{background:var(--bg);border:1px solid var(--line);border-radius:3px;padding:var(--s2) var(--s3);margin-top:var(--s2)}
|
|
438
438
|
.colcard .candhint{color:var(--dim);font-size:12.5px;white-space:pre-wrap}
|
|
439
439
|
.colcard .err,.assetrem .err{color:var(--red);margin-top:var(--s2);font-size:12.5px}
|
|
440
|
+
.colcard .said{color:var(--ok);margin-top:var(--s2);font-size:12.5px}
|
|
440
441
|
.colcard a{color:var(--accent)}
|
|
441
442
|
|
|
442
443
|
/* ONE GATE CHECK's page: small widgets on a responsive grid, each answering
|
|
@@ -9,6 +9,7 @@ export const ICON = {
|
|
|
9
9
|
when: 'M10 3a7 7 0 1 0 .01 0M10 6v4l2.5 2',
|
|
10
10
|
plan: 'M5.5 3h9M5.5 17h9M6.5 3c0 4 7 4 7 7s-7 3-7 7M13.5 3c0 4-7 4-7 7s7 3 7 7',
|
|
11
11
|
git: 'M6 5v10M6 3a2 2 0 1 0 0 .01M6 17a2 2 0 1 0 0 .01M14 5a2 2 0 1 0 0 .01M14 7c0 4.5-8 3.5-8 7',
|
|
12
|
+
commands: 'M2.5 4.5h15v11h-15zM5.5 8l2.5 2-2.5 2M10 12.5h4',
|
|
12
13
|
reflections: 'M4 3.5h12v9H9l-4 3.5v-3.5H4zM7.5 7h5M7.5 9.5h3',
|
|
13
14
|
monitor: 'M3 4h14v9H3zM7 16.5h6M10 13v3.5',
|
|
14
15
|
archived: 'M2.5 4h15v3.5h-15zM4 7.5V16h12V7.5M8 10.5h4',
|
|
@@ -42,6 +43,10 @@ export const ICON = {
|
|
|
42
43
|
// a shop front: an awning over a door
|
|
43
44
|
veille: 'M10 4.5c-4 0-7 3.5-7.5 5.5.5 2 3.5 5.5 7.5 5.5s7-3.5 7.5-5.5c-.5-2-3.5-5.5-7.5-5.5zM10 7a3 3 0 1 0 0 6 3 3 0 0 0 0-6z',
|
|
44
45
|
stores: 'M3 4h14l1 4H2zM2 8c0 1.4 1.3 2.5 2.7 2.5S7.3 9.4 7.3 8c0 1.4 1.3 2.5 2.7 2.5S12.7 9.4 12.7 8c0 1.4 1.3 2.5 2.7 2.5S18 9.4 18 8M4 10.5V17h12v-6.5M8 17v-4h4v4',
|
|
46
|
+
// a tag on a string: a version, named and dated
|
|
47
|
+
releases: 'M3 3.5h7l7 7-6.5 6.5-7-7zM6.5 6.5h.01',
|
|
48
|
+
// a speech bubble with two lines: the words a public line says
|
|
49
|
+
messages: 'M3 4.5h14v9H8l-4 3v-3H3zM6 8h8M6 10.5h5',
|
|
45
50
|
// a megaphone (the drafts he posts), two people (the identities and their accounts)
|
|
46
51
|
comms: 'M3 8h3l8-4v12l-8-4H3zM6 12l1.5 4.5',
|
|
47
52
|
social: 'M7 9a2.5 2.5 0 1 0 0-5a2.5 2.5 0 1 0 0 5M2.5 16c0-2.5 2-4.5 4.5-4.5s4.5 2 4.5 4.5M13.5 9a2 2 0 1 0 0-4M13 11.5c2.5 0 4.5 1.8 4.5 4.5',
|