rvlib-shipkit 2.32.0 → 2.34.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 +42 -0
- package/package.json +1 -1
- package/src/advisors/advisor-view.ts +29 -7
- package/src/advisors/edge/api.ts +1 -30
- package/src/advisors/project.ts +3 -3
- package/src/advisors/sync.ts +11 -4
- package/src/advisors/users-router.ts +13 -11
- package/src/cli/cmd_BackupTargets.ts +49 -8
- package/src/cli/cmd_Capacity.ts +6 -2
- package/src/cli/cmd_Ci.ts +2 -1
- package/src/cli/cmd_Media.ts +1 -1
- package/src/cli/cmd_Shot.ts +26 -4
- package/src/cli/cmd_Start.ts +3 -3
- package/src/cli.ts +13 -2
- package/src/core/admission.ts +268 -0
- package/src/core/code-lines.ts +36 -21
- package/src/core/machine-read.ts +5 -2
- package/src/core/memory-watch.ts +1 -1
- package/src/core/peer-sk.ts +8 -0
- package/src/gate/admit-heavy.ts +150 -0
- package/src/gate/check-runner.ts +6 -0
- package/src/gate/gate-checks.ts +7 -5
- package/src/gate/head-gate.ts +1 -1
- package/src/gate/job-run.ts +2 -1
- package/src/gate/pre-commit-discovery.ts +6 -3
- package/src/gate/run-check.ts +3 -0
- package/src/gate/run-ci.ts +4 -0
- package/src/home/backup-status.ts +41 -13
- package/src/home/backup-verdict.ts +1 -0
- package/src/home/daemon-jobs.ts +5 -0
- package/src/home/home-routes.ts +3 -2
- package/src/home/house-bucket.ts +14 -0
- package/src/home/run-daemon.ts +3 -1
- package/src/home/this-house.ts +68 -0
- package/src/home/via-hub.ts +2 -1
- package/src/hooks/commit-msg-run.ts +61 -0
- package/src/hooks/commit-run.ts +16 -166
- package/src/hooks/gate-outcome.ts +108 -0
- package/src/hooks/git-hook.ts +9 -9
- package/src/hooks/hook-config.ts +2 -1
- package/src/hooks/pre-commit-checks.ts +1 -1
- package/src/hooks/run-hooks.ts +2 -1
- package/src/hooks/shared-file.ts +3 -2
- package/src/hq/backup-targets.ts +58 -5
- package/src/hq/hq-local.ts +1 -1
- package/src/media-store/backup/bucket-target.ts +58 -0
- package/src/media-store/backup/target-send.ts +7 -4
- package/src/media-store/space.ts +2 -0
- package/src/plan/planner.ts +3 -2
- package/src/repo-config.ts +8 -1
- package/src/review/answer-kinds.ts +2 -0
- package/src/review/cells.ts +40 -9
- package/src/review/format.ts +1 -1
- package/src/review/model.ts +3 -3
- package/src/review/routes.ts +2 -28
- package/src/review/store-parties.ts +28 -0
- package/src/review/store.ts +11 -2
- package/src/review/thread-state.ts +9 -3
- package/src/scaffold/project-scaffold.ts +2 -2
- package/src/secrets/copy.ts +4 -4
- package/src/serve/hub-app/auto-text.tsx +3 -1
- package/src/serve/hub-app/dock-st.ts +1 -1
- package/src/serve/hub-app/review/question-views.tsx +28 -17
- package/src/serve/hub-app/review/review-host.ts +6 -2
- package/src/serve/hub-app/review/review-list.tsx +8 -5
- package/src/serve/hub-app/review/review-st.ts +2 -2
- package/src/serve/hub-app/review/review-thread.tsx +2 -1
- package/src/serve/hub-app/review/review-views.tsx +10 -7
- package/src/serve/hub-app/review/thread-st.ts +25 -11
- package/src/serve/hub-app/review/tone-bar.tsx +29 -24
- package/src/serve/hub-app/review/tones.ts +18 -0
- package/src/serve/hub-app/review.css +11 -2
- package/src/setup-house.ts +1 -7
- package/src/shot/client.ts +2 -1
- package/src/shot/on-place.ts +141 -0
- package/src/start-repo.ts +27 -30
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,45 @@
|
|
|
1
|
+
## 2.34.0
|
|
2
|
+
|
|
3
|
+
### Added
|
|
4
|
+
|
|
5
|
+
- **A backup target can be any S3 bucket**: `sk backup targets add <id> --endpoint <origin> --bucket <name> --key-id <secret> --key-secret <secret>` (MinIO, R2, any server; the row names the two secrets of its key, never a value), `check` writes one object and reads it back, `get` writes the newest copy of a store back to a folder, checked against its sha.
|
|
6
|
+
- **An advisor's ok that waits for the owner lights their answer bar**: a click on it adds a note to it, never a second ok.
|
|
7
|
+
|
|
8
|
+
### Changed
|
|
9
|
+
|
|
10
|
+
- **`sk start` writes this machine's own house** as line 1 of a new repo's CLAUDE.md (the house its pm runs from, else the one `sk setup` made beside the repos), and puts the repo beside it. The package names no house of its own. A house `sk setup` made writes no `.claude/` policy files.
|
|
11
|
+
- **A machine with no backup set up yet says so in one orange line**: no red band, no notification, no vault row where no vault runs.
|
|
12
|
+
- **Seeded backup targets are named by their provider** (`do-space`, `cf-r2`), else `space` and `space-copy`.
|
|
13
|
+
- **The daemon's steady memory budget is 750 MB** (was 500 MB); its boot budget stays 1 GB.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- **`SHIPKIT_TEST_SELECT=1 sk ci` selects suites** when the daemon runs the gate: the switch now reaches the job.
|
|
18
|
+
- **The thread store compiles under an ES2022 lib**: four native `findLast` calls use the package's own helper, so a repo whose tsconfig stops at ES2022 types against shipkit again.
|
|
19
|
+
- **No owner facts in the help texts**: an ask number, secret names and a machine's name left three help lines.
|
|
20
|
+
|
|
21
|
+
Nothing of a newcomer's first run was proven from zero in a container: no container runtime ran.
|
|
22
|
+
|
|
23
|
+
## 2.33.0
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
|
|
27
|
+
- **`sk shot <url> --on <place>`**: a still or a clip shot by another machine of the house, its own browser, the file back at `--out`; a machine shipkit does not run on is refused with the reason.
|
|
28
|
+
- **Heavy work waits while the machine is full** and names who uses the CPU, by repo, process and session: at most 80 s, never in `sk bump`; `sk capacity` prints the same table, and the hub's held pill names the top user.
|
|
29
|
+
- **A question answers in question words**: each option picks, its pencil picks with a remark; under the options « none of these », « your call » (not on a confirm) and « no answer ». Versions keep the five tones.
|
|
30
|
+
- **Advisors see the hub's thread names, codes, groups, search and filters**: the users' port runs the hub's own list over the advisor's rows, and an advisor has a « since you left » line.
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
|
|
34
|
+
- **Browser checks follow the slow tests' rule**: a case whose only misses are waits under load runs again alone; passing alone it is a warning row in `.shipkit/cache/slow-tests.json`.
|
|
35
|
+
- **The daemon boots in 410 MB at its peak** (was 2.5 GB): the public clean check hashes only what npm packs, and the run record holds each check's newest runs.
|
|
36
|
+
- **The commit hooks do less**: the check table walks only when a unit file is staged, commit-msg loads its own gates.
|
|
37
|
+
|
|
38
|
+
### Fixed
|
|
39
|
+
|
|
40
|
+
- **A click near the end of a thread is never lost**: the column keeps its distance from its end when a line measures again, an answer shows as given at the click, a failed send puts the value back.
|
|
41
|
+
- **A jump to a waiting question finds its line on a busy machine** and lands at once.
|
|
42
|
+
|
|
1
43
|
## 2.32.0
|
|
2
44
|
|
|
3
45
|
### Added
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rvlib-shipkit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.34.0",
|
|
4
4
|
"funding": "https://github.com/sponsors/rvion",
|
|
5
5
|
"description": "All-in-one repo companion: ci gate (task DAG), auto-discovered health checks, release-contract fulfillness, asks queue, md-wiki tools, asset atelier, live tui",
|
|
6
6
|
"license": "MIT",
|
|
@@ -7,12 +7,13 @@
|
|
|
7
7
|
// (`Rules<T>` asks every key), and a value its rule refuses leaves as nothing, a fault the port logs and the owner's pass reports
|
|
8
8
|
import type { Cursor } from '../review/traces.ts'
|
|
9
9
|
import { personState, type Closed, type OwnerWaiting, type ThreadState } from '../review/thread-state.ts'
|
|
10
|
-
import { threadIndex, threadView, type Cell, type ReplyCell, type ThreadRow, type ThreadView, type VerdictCell, type VersionCell, type NoteCell, type EventCell } from '../review/cells.ts'
|
|
10
|
+
import { listIndexOf, pageOf, queryOf, threadIndex, threadView, type ThreadPage, type Cell, type ReplyCell, type ThreadRow, type ThreadView, type VerdictCell, type VersionCell, type NoteCell, type EventCell } from '../review/cells.ts'
|
|
11
11
|
import type { Item, ReviewScene, ReviewView, Verdict } from '../review/model.ts'
|
|
12
12
|
import { membersOf, threadsOf, type Thread } from '../review/threads.ts'
|
|
13
13
|
import { traceWords, type Trace } from '../review/traces.ts'
|
|
14
14
|
import type { ProjectedItems } from './project.ts'
|
|
15
15
|
import { mask, maskHits, type ScanContext } from './scan.ts'
|
|
16
|
+
import { CODE_RE } from '../review/thread-code.ts'
|
|
16
17
|
|
|
17
18
|
/** how one key leaves: `text` scanned (a hit hidden), `id` an id of the view, `file` a served picture, `address` the
|
|
18
19
|
* view's one address, `token` a short word (an enum) scanned too, `time`, `num`, `bool`, `drop` never; or a function */
|
|
@@ -100,9 +101,9 @@ const always =
|
|
|
100
101
|
x
|
|
101
102
|
|
|
102
103
|
const SIZE = table<{ w: number; h: number }>({ w: 'num', h: 'num' })
|
|
103
|
-
/** a thread's short code (review/thread-code.ts)
|
|
104
|
-
*
|
|
105
|
-
const CODE =
|
|
104
|
+
/** a thread's short code (review/thread-code.ts): the owner's, of his repo's ids, given to advisorThread (the view's ids
|
|
105
|
+
* are others), so both say « #m6rz » of one thread; a hash of ids, no word of the store */
|
|
106
|
+
const CODE = (v: unknown, o: Out): unknown => (typeof v === 'string' && (v === '' || CODE_RE.test(v)) ? v : leaf('num', v, o))
|
|
106
107
|
/** a panorama kept: an advisor looks around it as the owner does. A splat or a mesh is dropped, its 3D file never
|
|
107
108
|
* sent: the advisor sees its poster */
|
|
108
109
|
const SCENE = (s: unknown): ReviewScene | undefined => (s !== null && typeof s === 'object' && (s as ReviewScene).kind === 'pano' ? { kind: 'pano' } : undefined)
|
|
@@ -231,6 +232,7 @@ const REPLY: Rules<ReplyCell> = {
|
|
|
231
232
|
instructions: 'drop',
|
|
232
233
|
step: 'drop',
|
|
233
234
|
linked: 'drop',
|
|
235
|
+
advice: table({ status: 'token', on: 'id' }),
|
|
234
236
|
}
|
|
235
237
|
const NOTE: Rules<NoteCell> = { ...BASE, item: table(ITEM), text: 'text', rects: always([]), image: 'file', files: REPLY.files, rate: 'drop', read: 'bool' }
|
|
236
238
|
const EVENT: Rules<EventCell> = { ...BASE, op: 'token', note: 'drop', topic: 'drop', commit: 'drop', trace: table(TRACE) }
|
|
@@ -312,6 +314,7 @@ const STATE: Rules<ThreadState> = {
|
|
|
312
314
|
recap: always(null),
|
|
313
315
|
cursor: (v, o) => (v === null ? null : CURSOR(v, o)),
|
|
314
316
|
updated: 'time',
|
|
317
|
+
works: 'bool',
|
|
315
318
|
}
|
|
316
319
|
|
|
317
320
|
const ROW: Rules<ThreadRow> = {
|
|
@@ -343,6 +346,22 @@ const ROW: Rules<ThreadRow> = {
|
|
|
343
346
|
advisors: 'drop',
|
|
344
347
|
}
|
|
345
348
|
|
|
349
|
+
/** a row a person may see, with the words their search reads of it */
|
|
350
|
+
export type PersonEntry = { row: ThreadRow; text: string }
|
|
351
|
+
|
|
352
|
+
/** the person's list as the owner's hub pages his: its order, its search (words, `#code`), its filters, its counts,
|
|
353
|
+
* what moved since their last act */
|
|
354
|
+
export const personPage = (rows: readonly PersonEntry[], q: URLSearchParams, since: ThreadPage['since'] = null): ThreadPage => pageOf(listIndexOf(rows, since), queryOf(q))
|
|
355
|
+
|
|
356
|
+
/** what moved since the person's last act (`left`: a word, a pick, a verdict, a thread they started; never a read, which
|
|
357
|
+
* the page marks as it opens), as his hub's line reads his (thread-state.ts sinceHeLeft): the threads anyone but them
|
|
358
|
+
* wrote in since, and how many are their turn. Null before their first act */
|
|
359
|
+
export function personSince(read: readonly { row: ThreadRow; view: ThreadView }[], left: string | null): ThreadPage['since'] {
|
|
360
|
+
if (left === null) return null
|
|
361
|
+
const moved = read.filter((x) => x.view.cells.some((c) => c.who !== 'advisor' && c.at > left && !(c.kind === 'event' && c.trace?.act === 'read')))
|
|
362
|
+
return { at: left, moved: moved.length, yours: moved.filter((x) => x.row.state.turn === 'yours').length }
|
|
363
|
+
}
|
|
364
|
+
|
|
346
365
|
/** the view's whitelist, for a test that a key of the type is named */
|
|
347
366
|
export const ADVISOR_VIEW_KEYS = { view: Object.keys(VIEW), row: Object.keys(ROW), item: Object.keys(ITEM), reply: Object.keys(REPLY) }
|
|
348
367
|
|
|
@@ -443,11 +462,13 @@ export function namesOf(view: ThreadView, row: ThreadRow, items: ProjectedItems[
|
|
|
443
462
|
|
|
444
463
|
/** the thread as the advisor's page reads it: the hub's view and row of the projected items, by the output whitelist.
|
|
445
464
|
* `null` when the view holds nothing of the thread */
|
|
465
|
+
/** `code`: the thread's code in the owner's store (review/store.ts threadCodeOf), the one his hub shows; `works`: a
|
|
466
|
+
* live agent works it now, as his hub's band reads it of his parties (thread-state.ts bandOf) */
|
|
446
467
|
/** `cursor`: where the owner's newest word stands in the store's own thread (review/traces.ts cursorOf): the projection
|
|
447
468
|
* holds no read mark, so the view takes it from there, its agent unnamed */
|
|
448
469
|
export function advisorThread(
|
|
449
470
|
p: Pick<ProjectedItems, 'items' | 'head'> & Partial<Pick<ProjectedItems, 'title' | 'numbers' | 'headKept'>>,
|
|
450
|
-
o: { scan: ScanContext; now: Date; owner: string; cursor?: Cursor | null; names?: readonly string[]; real?: ThreadState; deferred?: boolean },
|
|
471
|
+
o: { scan: ScanContext; now: Date; owner: string; cursor?: Cursor | null; names?: readonly string[]; real?: ThreadState; deferred?: boolean; code?: string; works?: boolean },
|
|
451
472
|
): AdvisorThread | null {
|
|
452
473
|
const threads = threadsOf(p.items)
|
|
453
474
|
const t = threads.find((x) => x.versions.some((v) => v.item.id === p.head) || x.answers.some((a) => a.item.id === p.head)) ?? threads[0]
|
|
@@ -457,11 +478,12 @@ export function advisorThread(
|
|
|
457
478
|
// thread's state read for them (thread-state.ts personState), the store's cursor alone (the builders would read one
|
|
458
479
|
// off the agents' reads the view holds)
|
|
459
480
|
const view0 = threadView(t, p.items, threads, t.head.item.id, o.now)
|
|
460
|
-
const truth = <T extends { state: ThreadState; title: string; versions: number }>(x: T, top: number): T => ({
|
|
481
|
+
const truth = <T extends { state: ThreadState; title: string; versions: number; code: string }>(x: T, top: number): T => ({
|
|
461
482
|
...x,
|
|
462
483
|
...(p.title !== undefined ? { title: p.title } : {}),
|
|
484
|
+
code: o.code ?? '',
|
|
463
485
|
...(top > 0 ? { versions: top } : {}),
|
|
464
|
-
state: { ...personState(o.real ?? x.state, x.state, { deferred: o.deferred ?? false, headKept: kept }), cursor: o.cursor ?? null },
|
|
486
|
+
state: { ...personState(o.real ?? x.state, x.state, { deferred: o.deferred ?? false, headKept: kept, works: o.works ?? false }), cursor: o.cursor ?? null },
|
|
465
487
|
})
|
|
466
488
|
let top = 0
|
|
467
489
|
const cells = view0.cells.map((c) => {
|
package/src/advisors/edge/api.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// what the users' port answers its page with besides a thread (wiki tools/shipkit/advisors.md, The advisor's app): the
|
|
2
|
-
//
|
|
2
|
+
// search text of a share, the fixed answers of the routes the page reads at its start, a read
|
|
3
3
|
// cursor, the files a page stages before the words that take them
|
|
4
4
|
// the one constraint a reader breaks first: a staged file is opaque bytes under its own token, named and typed only by
|
|
5
5
|
// what the browser said, cleaned (form.ts); its words take it, or the pass sweeps it within the hour
|
|
@@ -11,16 +11,6 @@ import {
|
|
|
11
11
|
UPLOADS_PENDING_MAX,
|
|
12
12
|
type UploadWire } from './types.ts'
|
|
13
13
|
|
|
14
|
-
/** a row of the list as the port pages it: what it sorts and counts by; the rest as the builders made it */
|
|
15
|
-
export interface PersonRow {
|
|
16
|
-
head: string
|
|
17
|
-
updated: string
|
|
18
|
-
/** the thread's state as the person reads it (review/thread-state.ts personState): what the counts read */
|
|
19
|
-
state: { turn: string; active: boolean }
|
|
20
|
-
unread: boolean
|
|
21
|
-
[k: string]: unknown
|
|
22
|
-
}
|
|
23
|
-
|
|
24
14
|
/** where the reader's cursor stands on a share: the port's own clock, a cell's time of that share's view */
|
|
25
15
|
export interface ReadCursor {
|
|
26
16
|
v: 1
|
|
@@ -61,25 +51,6 @@ export function wordsIn(v: unknown, out: string[] = [], depth = 0): string[] {
|
|
|
61
51
|
return out
|
|
62
52
|
}
|
|
63
53
|
|
|
64
|
-
/** the list's page over the rows a reader may see, as the hub's own list answers it */
|
|
65
|
-
export function pageOfRows(rows: PersonRow[], q: URLSearchParams): unknown {
|
|
66
|
-
rows.sort((a, b) => b.updated.localeCompare(a.updated))
|
|
67
|
-
const limit = Math.max(1, Math.min(500, Number(q.get('limit')) || 50))
|
|
68
|
-
const offset = Math.max(0, Number(q.get('offset')) || 0)
|
|
69
|
-
return {
|
|
70
|
-
rows: rows.slice(offset, offset + limit),
|
|
71
|
-
total: rows.length,
|
|
72
|
-
offset,
|
|
73
|
-
limit,
|
|
74
|
-
counts: { threads: rows.length, active: rows.filter((r) => r.state.active).length, waiting: rows.filter((r) => r.state.turn === 'yours').length, unread: rows.filter((r) => r.unread).length },
|
|
75
|
-
byWait: {},
|
|
76
|
-
subjects: [],
|
|
77
|
-
lanes: [],
|
|
78
|
-
broken: [],
|
|
79
|
-
since: null,
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
54
|
/** the staged files of some words moved under their entry, in their order: what the record names, or why not */
|
|
84
55
|
export async function takeStaged(bucket: Bucket, scope: 's' | 'p', id: string, tokens: readonly string[], entry: string): Promise<UploadWire[] | string> {
|
|
85
56
|
const out: UploadWire[] = []
|
package/src/advisors/project.ts
CHANGED
|
@@ -113,8 +113,8 @@ export interface ProjectedItems {
|
|
|
113
113
|
masked: Masked[]
|
|
114
114
|
/** each id of the view and the store's id it stands for: an advice names the view's */
|
|
115
115
|
ids: Map<string, string>
|
|
116
|
-
/** the thread's
|
|
117
|
-
* never
|
|
116
|
+
/** the thread's name as the owner's hub says it (review/threads.ts threadTitle), its hits masked: one name on both
|
|
117
|
+
* sides, never a version's own caption */
|
|
118
118
|
title: string
|
|
119
119
|
/** each version of the view by its id and the thread's own number of it: v3 reads « v3 » whatever the view holds before it */
|
|
120
120
|
numbers: Map<string, number>
|
|
@@ -217,7 +217,7 @@ export function projectItems(input: ItemsInput): ProjectedItems {
|
|
|
217
217
|
const headKept = kept.has(headId)
|
|
218
218
|
const head = headKept ? opaqueItem(share, headId) : (items.at(-1)?.item.id ?? opaqueItem(share, headId))
|
|
219
219
|
const own = threadTitle(input.thread)
|
|
220
|
-
const title =
|
|
220
|
+
const title = mask(own, maskHits(own, input.scan))
|
|
221
221
|
const shown = input.thread.versions.filter((x) => kept.has(x.item.id)).length
|
|
222
222
|
return { items, head, masked, ids, title, numbers, versions: input.thread.versions.length, shown, headKept }
|
|
223
223
|
}
|
package/src/advisors/sync.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { createHash } from 'node:crypto'
|
|
|
7
7
|
import { existsSync, readFileSync, statSync } from 'node:fs'
|
|
8
8
|
import { HOUSE_LAYOUT } from '../core/house-layout.ts'
|
|
9
9
|
import { identitiesFile } from '../core/identities-root.ts'
|
|
10
|
-
import { imageFile, readAll, storeDir, threadFile } from '../review/store.ts'
|
|
10
|
+
import { imageFile, readAll, storeDir, threadCodeOf, threadFile } from '../review/store.ts'
|
|
11
11
|
import { isGallery, verdictOf, type ReviewItem } from '../review/model.ts'
|
|
12
12
|
import type { ReplyCell } from '../review/cells.ts'
|
|
13
13
|
import { namedFiles } from '../review/file-tags.ts'
|
|
@@ -26,7 +26,8 @@ import { keepLogins } from './login.ts'
|
|
|
26
26
|
import { identityOfRoot } from './speaks.ts'
|
|
27
27
|
import { ownerNameOf } from './owner-name.ts'
|
|
28
28
|
import { displayOf, isLive, startPlacesOf, readState, servedShares, withState, type OwnerState, type Share, type ShareRead } from './owner-store.ts'
|
|
29
|
-
import { threadState } from '../review/thread-state.ts'
|
|
29
|
+
import { bandOf, threadState } from '../review/thread-state.ts'
|
|
30
|
+
import { partiesOfStore } from '../review/store-parties.ts'
|
|
30
31
|
|
|
31
32
|
/** a picture as the advisor gets it: re-encoded, no metadata (EXIF, PNG text) survives */
|
|
32
33
|
export type Encode = (path: string) => Promise<Bytes>
|
|
@@ -124,7 +125,10 @@ function pendingCells(s: OwnerState, x: Share, thread: Thread, view: AdvisorThre
|
|
|
124
125
|
.map((a) => {
|
|
125
126
|
const what = a.kind === 'pick' ? `I pick option ${(a.option ?? 0) + 1}` : (ADVICE_WORDS[a.kind] ?? '')
|
|
126
127
|
const text = [what, namedFiles(a.text ?? '', a.files ?? [])].filter((w) => w !== '').join(': ')
|
|
127
|
-
|
|
128
|
+
// their ok or fix that waits: their bar on that version draws it lit, so a second click adds a note, never a second ok
|
|
129
|
+
const tone: NonNullable<ReplyCell['advice']>['status'] | null = a.kind === 'approve' ? 'approved' : a.kind === 'change' ? 'approved-with-fix' : null
|
|
130
|
+
const advice = a.state === 'pending' && tone !== null && a.item !== undefined ? { advice: { status: tone, on: opaqueItem(x.id, a.item) } } : {}
|
|
131
|
+
return { kind: 'reply' as const, id: adviceCell(view.head, a.id), on: view.head, at: a.at, who: ADVISOR_WHO, party: 'owner' as const, summary: text, open: true, text: a.state === 'pending' ? `${text}\n\nwaits for ${owner}` : text, read: true, ...advice } satisfies ReplyCell
|
|
128
132
|
})
|
|
129
133
|
}
|
|
130
134
|
|
|
@@ -203,7 +207,10 @@ export async function prepare(s: OwnerState, x: Share, o: { words: string[]; now
|
|
|
203
207
|
}
|
|
204
208
|
const answers = rightsOf(s.rights, { person: x.advisor, project: x.repo, thread: x.address }).answers
|
|
205
209
|
const items = projectItems({ thread, share: x.id, advisor: x.advisor, answers, scan, include: x.include, picture: (itemId, name, of) => nameOf(resolve(itemId, name, of)) })
|
|
206
|
-
const
|
|
210
|
+
const real = threadState(thread, o.now)
|
|
211
|
+
// the band his hub draws: a live agent works it now, read of his parties (never theirs to read)
|
|
212
|
+
const works = real.turn === 'agents' && bandOf(real, (await partiesOfStore(storeDir(x.root))).parties, o.now) === 'working'
|
|
213
|
+
const theirs = advisorThread(items, { scan, now: o.now, owner, cursor: cursorOf(thread, o.now), names: storeNames(thread), real, deferred: x.deferred === true, code: threadCodeOf(storeDir(x.root))(thread), works })
|
|
207
214
|
if (theirs !== null) {
|
|
208
215
|
// their words at their own time among the thread's cells, as the owner's hub draws them (a stable sort keeps the
|
|
209
216
|
// builders' order of cells of one time)
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
// terminal (tests/advisors-users-caller.test.ts walks the graph)
|
|
11
11
|
import { landAdvice, landProposal } from './advice.ts'
|
|
12
12
|
import { advisorBundle, type AppBundle } from './app.ts'
|
|
13
|
-
import { dropEntry, dropStaged, etag, ID_RE, MSG_RE, NAME_RE, PARTIES,
|
|
13
|
+
import { dropEntry, dropStaged, etag, ID_RE, MSG_RE, NAME_RE, PARTIES, readCursor, SPEC, stageFile, takeStaged, TOKEN, tokensOf, wordsIn, type ReadCursor } from './edge/api.ts'
|
|
14
|
+
import { personPage, personSince, type PersonEntry } from './advisor-view.ts'
|
|
14
15
|
import type { Bytes } from './edge/bucket.ts'
|
|
15
16
|
import { APP_HEADER, BASE, bytesB64url, csrfOf, CSRF_HEADER, NOT_FOUND, status, type EdgeEnv } from './edge/handler.ts'
|
|
16
17
|
import { bytesOf } from './edge/form.ts'
|
|
@@ -265,21 +266,22 @@ export async function liveAnswer(req: Request, caller: Caller, env: UsersEnv): P
|
|
|
265
266
|
return x === undefined || p === null || !p.manifest!.ids.includes(id) ? null : { x, p }
|
|
266
267
|
}
|
|
267
268
|
if (read && path === '/api/review/threads') {
|
|
268
|
-
|
|
269
|
-
const
|
|
270
|
-
const
|
|
269
|
+
// the hub's own page over the rows the person may see: its order, search (words, `#code`), filters and counts
|
|
270
|
+
const rows: PersonEntry[] = []
|
|
271
|
+
const read: Parameters<typeof personSince>[0][number][] = []
|
|
271
272
|
for (const x of caller.shares) {
|
|
272
273
|
const p = await liveOf(x, env, now)
|
|
273
274
|
if (p === null) continue
|
|
274
|
-
const row = p.theirs!.row
|
|
275
|
-
if (ws.length > 0) {
|
|
276
|
-
const text = wordsIn([row, p.theirs!.view]).join('\n')
|
|
277
|
-
if (!ws.every((w) => text.includes(w))) continue
|
|
278
|
-
}
|
|
275
|
+
const row = p.theirs!.row
|
|
279
276
|
const cursor = await readCursor(env.bucket, x.id)
|
|
280
|
-
rows.push({ ...row, unread: cursor === null || row.updated > cursor.upTo })
|
|
277
|
+
rows.push({ row: { ...row, unread: cursor === null || row.updated > cursor.upTo }, text: wordsIn([row, p.theirs!.view]).join('\n') })
|
|
278
|
+
read.push({ row, view: p.theirs!.view })
|
|
281
279
|
}
|
|
282
|
-
|
|
280
|
+
// their last act: a word, a pick, a verdict, a thread they started, as his own line counts his
|
|
281
|
+
const s = readState(env.dir)
|
|
282
|
+
const ids = new Set(caller.shares.map((x) => x.advisor))
|
|
283
|
+
const left = [...s.advice.filter((a) => ids.has(a.advisor)), ...s.proposals.filter((p) => ids.has(p.advisor))].map((a) => a.at).sort().at(-1) ?? null
|
|
284
|
+
return json(personPage(rows, new URL(req.url).searchParams, personSince(read, left)), 200, api)
|
|
283
285
|
}
|
|
284
286
|
const one = new RegExp(`^/api/review/threads/(${ID})$`).exec(path)
|
|
285
287
|
if (read && one !== null) {
|
|
@@ -51,7 +51,7 @@ export class BackupStatusCommand extends Command {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
const TARGETS_DETAILS = `the places the house's backups go, one row each in the hq: an s3 bucket the house config owns (serve.mediaSpace, the Space; serve.spaceCopy, its second place) or a machine
|
|
54
|
+
const TARGETS_DETAILS = `the places the house's backups go, one row each in the hq: a bucket of any S3 server (its origin, its bucket, the names of the two secrets of its key), an s3 bucket the house config owns (serve.mediaSpace, the Space; serve.spaceCopy, its second place) or a machine over ssh (its host and a folder under its home). No row holds a secret: a key is two secrets, stored first (sk secret set), named by the row. The first list fills an empty table with the buckets the config names. check writes one small object and reads it back; get writes the newest copy of a store back into a folder, its bytes compared with the sha they went up with. Every store goes to every target that is on (sk backup status says how each one stands); rm removes the row only, never what the target holds. Page: wiki tools/shipkit/media-store-backup.md, Targets`
|
|
55
55
|
|
|
56
56
|
type Answer = { targets?: import('../hq/backup-targets.ts').BackupTarget[]; refused?: string; removed?: boolean } & Partial<import('../hq/backup-targets.ts').BackupTarget>
|
|
57
57
|
|
|
@@ -60,16 +60,25 @@ async function admin(path: string, body: unknown = {}): Promise<Answer> {
|
|
|
60
60
|
return askHqAdmin<Answer>(path, body)
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
const where = (t: import('../hq/backup-targets.ts').BackupTarget): string => (t.address.kind === 'ssh' ? `ssh ${t.address.host}:${t.address.folder}` : `s3, the bucket of serve.${t.address.config}`)
|
|
63
|
+
const where = (t: import('../hq/backup-targets.ts').BackupTarget): string => (t.address.kind === 'ssh' ? `ssh ${t.address.host}:${t.address.folder}` : 'config' in t.address ? `s3, the bucket of serve.${t.address.config}` : `s3, ${t.address.bucket} at ${t.address.endpoint}`)
|
|
64
64
|
|
|
65
65
|
export class BackupTargetsCommand extends Command {
|
|
66
66
|
static override paths = [['backup', 'targets']]
|
|
67
|
-
static override usage = Command.Usage({ category: 'Media', description: 'the places the backups go, stored in the hq: buckets and machines over ssh', details: TARGETS_DETAILS, examples: [['the list', 'sk backup targets'], ['a machine', 'sk backup targets add nas --ssh nas --folder ~/backups --label "the NAS"'], ['switch one off', 'sk backup targets off nas']] })
|
|
68
|
-
verb = Option.String({ required: false, name: 'ls | add | on | off | rm' })
|
|
67
|
+
static override usage = Command.Usage({ category: 'Media', description: 'the places the backups go, stored in the hq: buckets and machines over ssh', details: TARGETS_DETAILS, examples: [['the list', 'sk backup targets'], ['a bucket', 'sk backup targets add mine --endpoint https://s3.example.com --bucket my-backups --region us-east-1 --key-id backup/id --key-secret backup/secret'], ['does it take and give back an object', 'sk backup targets check mine'], ['the newest copy of the hq, back on the disk', 'sk backup targets get mine --to ~/restored'], ['a machine', 'sk backup targets add nas --ssh nas --folder ~/backups --label "the NAS"'], ['switch one off', 'sk backup targets off nas']] })
|
|
68
|
+
verb = Option.String({ required: false, name: 'ls | add | check | get | on | off | rm' })
|
|
69
69
|
id = Option.String({ required: false, name: 'id' })
|
|
70
|
-
ssh = Option.String('--ssh', { description: 'add: the ssh host
|
|
70
|
+
ssh = Option.String('--ssh', { description: 'add: the ssh host' })
|
|
71
71
|
folder = Option.String('--folder', { description: 'add: the folder under its home, ~/a/b' })
|
|
72
72
|
s3 = Option.String('--s3', { description: 'add: mediaSpace or spaceCopy, the config key that owns the bucket' })
|
|
73
|
+
endpoint = Option.String('--endpoint', { description: 'add: the origin of an S3 server, https://s3.example.com' })
|
|
74
|
+
bucket = Option.String('--bucket', { description: 'add: its bucket' })
|
|
75
|
+
region = Option.String('--region', { description: 'add: its region (auto when absent)' })
|
|
76
|
+
hostStyle = Option.Boolean('--bucket-in-host', false, { description: 'add: the bucket is in the endpoint\'s host already; absent, it goes in the path, which MinIO and R2 want' })
|
|
77
|
+
keyId = Option.String('--key-id', { description: 'add: the secret that holds the access key id' })
|
|
78
|
+
keySecret = Option.String('--key-secret', { description: 'add: the secret that holds the secret access key' })
|
|
79
|
+
store = Option.String('--store', 'hq', { description: 'get: hq or vault' })
|
|
80
|
+
to = Option.String('--to', { description: 'get: the folder the copy lands in' })
|
|
81
|
+
machine = Option.String('--machine', { description: "get: another machine's copies, by its name; this one's when absent" })
|
|
73
82
|
label = Option.String('--label', { description: 'add: the name the status shows' })
|
|
74
83
|
async execute(): Promise<number> {
|
|
75
84
|
const err = (l: string): number => (this.context.stderr.write(`FAIL: backup targets: ${l}\n`), 1)
|
|
@@ -93,14 +102,46 @@ export class BackupTargetsCommand extends Command {
|
|
|
93
102
|
this.context.stdout.write(r.removed ? `ok: ${this.id} is no longer a target; what it holds stays there\n` : `ok: no target ${this.id}\n`)
|
|
94
103
|
return 0
|
|
95
104
|
}
|
|
105
|
+
if (verb === 'check' || verb === 'get') {
|
|
106
|
+
const list = await admin('/api/home/hq/targets')
|
|
107
|
+
if (list.refused != null) return err(list.refused)
|
|
108
|
+
const { ownBucket } = await import('../hq/backup-targets.ts')
|
|
109
|
+
const t = (list.targets ?? []).find((x) => x.id === this.id)
|
|
110
|
+
const own = t == null ? null : ownBucket(t.address)
|
|
111
|
+
if (t == null) return err(`no target ${this.id} (sk backup targets)`)
|
|
112
|
+
if (own == null) return err(`${this.id} is no bucket added by hand: sk backup status says how it stands`)
|
|
113
|
+
const [{ bucketProblem, getNewest }, { houseBucket }] = await Promise.all([import('../media-store/backup/bucket-target.ts'), import('../home/house-bucket.ts')])
|
|
114
|
+
const c = await houseBucket(own)
|
|
115
|
+
if ('why' in c) return err(c.why)
|
|
116
|
+
const { machineName } = await import('../home/machine-host.ts')
|
|
117
|
+
const machine = this.machine ?? machineName()
|
|
118
|
+
if (verb === 'check') {
|
|
119
|
+
const why = await bucketProblem(c, machine)
|
|
120
|
+
if (why != null) return err(`${t.label}: ${why}`)
|
|
121
|
+
this.context.stdout.write(`ok: ${t.label} took one object and gave the same bytes back\n`)
|
|
122
|
+
return 0
|
|
123
|
+
}
|
|
124
|
+
if (this.to == null) return err(`get takes --to <folder>`)
|
|
125
|
+
if (this.store !== 'hq' && this.store !== 'vault') return err('--store: hq or vault')
|
|
126
|
+
const { resolve } = await import('node:path')
|
|
127
|
+
try {
|
|
128
|
+
const r = await getNewest(c, { store: this.store, machine, to: resolve(this.to) })
|
|
129
|
+
this.context.stdout.write(`ok: ${r.file}, ${r.bytes} bytes, from ${r.key}, its sha the one it went up with\n`)
|
|
130
|
+
return 0
|
|
131
|
+
} catch (e) {
|
|
132
|
+
return err((e as Error).message)
|
|
133
|
+
}
|
|
134
|
+
}
|
|
96
135
|
if (verb === 'add') {
|
|
97
|
-
|
|
98
|
-
|
|
136
|
+
if (this.endpoint != null && (this.bucket == null || this.keyId == null || this.keySecret == null)) return err('add --endpoint takes --bucket, --key-id and --key-secret: the last two name the secrets of its key (sk secret set <name> stores one)')
|
|
137
|
+
const bucket = this.endpoint == null ? null : { kind: 's3', endpoint: this.endpoint.replace(/\/$/, ''), bucket: this.bucket, region: this.region ?? 'auto', ...(this.hostStyle ? {} : { path: true }), key: { accessKeyId: this.keyId, secretAccessKey: this.keySecret } }
|
|
138
|
+
const address = bucket != null ? bucket : this.ssh != null ? { kind: 'ssh', host: this.ssh, folder: this.folder ?? '~/.shipkit' } : this.s3 != null ? { kind: 's3', config: this.s3 } : null
|
|
139
|
+
if (address == null) return err('add takes --endpoint <origin> --bucket <name> --key-id <secret> --key-secret <secret>, --ssh <host> [--folder ~/dir], or --s3 mediaSpace|spaceCopy')
|
|
99
140
|
const r = await admin('/api/home/hq/targets/put', { id: this.id, label: this.label ?? this.id, address })
|
|
100
141
|
if (r.refused != null) return err(r.refused)
|
|
101
142
|
this.context.stdout.write(`ok: ${this.id} added (${r.address == null ? '' : where(r as import('../hq/backup-targets.ts').BackupTarget)}); the next look of the daemon sends to it\n`)
|
|
102
143
|
return 0
|
|
103
144
|
}
|
|
104
|
-
return err(`${verb}: ls, add, on, off or rm`)
|
|
145
|
+
return err(`${verb}: ls, add, check, get, on, off or rm`)
|
|
105
146
|
}
|
|
106
147
|
}
|
package/src/cli/cmd_Capacity.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// sk capacity: how many lanes this repo runs now. Report only, exit 0 always: the orchestrator decides.
|
|
2
2
|
import { Command, Option } from './clip.ts'
|
|
3
|
+
import { whoLines } from '../core/admission.ts'
|
|
4
|
+
import { readWho } from '../gate/admit-heavy.ts'
|
|
3
5
|
import { capacityLines, readCapacity } from '../core/capacity.ts'
|
|
4
6
|
|
|
5
7
|
export class CapacityCommand extends Command {
|
|
@@ -9,7 +11,7 @@ export class CapacityCommand extends Command {
|
|
|
9
11
|
static override usage = Command.Usage({
|
|
10
12
|
category: 'Health',
|
|
11
13
|
description: 'how many lanes this repo runs now: the machine\'s cores, the cores in use, the lanes live on it',
|
|
12
|
-
details: 'reads the cores, the cores really in use (the CPU times, smoothed over 20 s by the daemon, else a 0.4 s sample), the 1 minute load and the agents whose transcript moved in the last 3 minutes, every account and repo. A free core is one neither in use nor held by a live agent; the load counts only once every core is taken, and alone where the machine gives no CPU times. The answer is this repo\'s live lanes plus one a free core, never under one. --max <n> is the maximum the owner gave: it replaces the number. Only a dying machine (85% of its cores in use and a load of twice its cores, or critical memory) stops a lane, the maximum included. Run it before a lane starts. Report only, exit 0 always.',
|
|
14
|
+
details: 'reads the cores, the cores really in use (the CPU times, smoothed over 20 s by the daemon, else a 0.4 s sample), the 1 minute load and the agents whose transcript moved in the last 3 minutes, every account and repo. A free core is one neither in use nor held by a live agent; the load counts only once every core is taken, and alone where the machine gives no CPU times. The answer is this repo\'s live lanes plus one a free core, never under one. --max <n> is the maximum the owner gave: it replaces the number. Only a dying machine (85% of its cores in use and a load of twice its cores, or critical memory) stops a lane, the maximum included. Run it before a lane starts. Then who uses the CPU, one ps grouped by repo (the Claude session above a process, else a path of its command) with the commands that lead each and its sessions: the same names a heavy command prints while it waits on a full machine. Report only, exit 0 always.',
|
|
13
15
|
examples: [
|
|
14
16
|
['before a lane starts', 'sk capacity'],
|
|
15
17
|
['with the maximum the owner gave', 'sk capacity --max 5'],
|
|
@@ -23,8 +25,10 @@ export class CapacityCommand extends Command {
|
|
|
23
25
|
async execute(): Promise<number> {
|
|
24
26
|
const max = this.max == null ? null : Number(this.max)
|
|
25
27
|
if (max != null && !(Number.isInteger(max) && max >= 1)) { this.context.stdout.write(`FAIL: --max takes a whole number of lanes, 1 or more, got ${this.max}\n`); return 2 }
|
|
28
|
+
const reading = readWho()
|
|
26
29
|
const { capacity, live, repo } = readCapacity(process.cwd(), max)
|
|
27
|
-
|
|
30
|
+
const who = await reading
|
|
31
|
+
this.context.stdout.write(this.json ? `${JSON.stringify({ ...capacity, repo, live, who })}\n` : `${[...capacityLines(capacity, live, repo), ...whoLines(who)].join('\n')}\n`)
|
|
28
32
|
return 0
|
|
29
33
|
}
|
|
30
34
|
}
|
package/src/cli/cmd_Ci.ts
CHANGED
|
@@ -79,7 +79,7 @@ export class CiCommand extends Command {
|
|
|
79
79
|
|
|
80
80
|
private async gate(root: string): Promise<number> {
|
|
81
81
|
const print = (l: string): void => { this.context.stdout.write(`${l}\n`) }
|
|
82
|
-
const sel = { bail: this.bail, json: this.json, skipGroups: this.skip, withIds: this.withIds, onlyIds: listFlag(this.only), fresh: this.fresh, verbose: this.verbose, ...(this.full ? { tests: 'full' as const } : {}), print }
|
|
82
|
+
const sel = { admit: true, bail: this.bail, json: this.json, skipGroups: this.skip, withIds: this.withIds, onlyIds: listFlag(this.only), fresh: this.fresh, verbose: this.verbose, ...(this.full ? { tests: 'full' as const } : {}), print }
|
|
83
83
|
if (this.headCheckout) return await (await import('../gate/head-gate.ts')).gateHeadCheckout(root, sel)
|
|
84
84
|
if (this.head) return await (await import('../gate/head-gate.ts')).runHeadGate(root, sel)
|
|
85
85
|
// a stale toolkit updates itself and restarts this exact invocation
|
|
@@ -87,6 +87,7 @@ export class CiCommand extends Command {
|
|
|
87
87
|
await (await import('../core/self-update.ts')).maybeSelfUpdateAndRestart(root, { fresh: this.fresh })
|
|
88
88
|
try {
|
|
89
89
|
const opts = {
|
|
90
|
+
admit: true,
|
|
90
91
|
bail: this.bail,
|
|
91
92
|
json: this.json,
|
|
92
93
|
fix: true,
|
package/src/cli/cmd_Media.ts
CHANGED
|
@@ -260,7 +260,7 @@ export class MediaVersioningCommand extends Command {
|
|
|
260
260
|
details: `PutBucketVersioning, then GetBucketVersioning to confirm: an object deleted or overwritten from the DigitalOcean dashboard or by a stray key keeps its older version. DigitalOcean offers it through the S3 API only. Once on, it can only be suspended, never turned off. The house key is limited to the bucket's objects and cannot change it: --key names a full access key pair kept once in the keychain for this call. Page: wiki tools/shipkit/media-store.md, Versioning`,
|
|
261
261
|
examples: [
|
|
262
262
|
['turn it on', 'sk media versioning'],
|
|
263
|
-
['turn it on with a one time full access key', 'sk media versioning --key-id
|
|
263
|
+
['turn it on with a one time full access key', 'sk media versioning --key-id demo/spaces-admin-id --key-secret demo/spaces-admin-secret'],
|
|
264
264
|
['read it', 'sk media versioning --check'],
|
|
265
265
|
],
|
|
266
266
|
})
|
package/src/cli/cmd_Shot.ts
CHANGED
|
@@ -16,7 +16,7 @@ export const renderShot = (r: ShotResult, cwd: string): string[] => {
|
|
|
16
16
|
const rel = relative(cwd, f)
|
|
17
17
|
return rel.startsWith('..') ? f : rel
|
|
18
18
|
}
|
|
19
|
-
const lines = [`ok ${shown(r.out)} in ${r.ms} ms (${phases}; ${r.via}) ${r.note}`]
|
|
19
|
+
const lines = [`ok ${shown(r.out)} in ${r.ms} ms (${phases}; ${r.on != null ? `on ${r.on}, ` : ''}${r.via}) ${r.note}`]
|
|
20
20
|
for (const f of r.tiles?.slice(1) ?? []) lines.push(`ok ${shown(f)} (next tile)`)
|
|
21
21
|
for (const e of r.errors.slice(0, 10)) lines.push(`WARN page ${e}`)
|
|
22
22
|
if (r.errors.length > 10) lines.push(`WARN page ${r.errors.length - 10} more errors`)
|
|
@@ -30,6 +30,16 @@ export const fileUrlOf = (s: string, cwd: string): string => {
|
|
|
30
30
|
return statSync(p, { throwIfNoEntry: false })?.isFile() ? pathToFileURL(p).href : s
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
/** the house checkout's path under the home: a place runs its shot from its own at the same place */
|
|
34
|
+
async function houseRelHere(cwd: string): Promise<string> {
|
|
35
|
+
const { homedir } = await import('os')
|
|
36
|
+
const { houseRootOf } = await import('../home/home-start.ts')
|
|
37
|
+
const { installedHouseRoot } = await import('../home/home-launchd.ts')
|
|
38
|
+
const root = installedHouseRoot() ?? houseRootOf(cwd, homedir())
|
|
39
|
+
if (root == null || !root.startsWith(`${homedir()}/`)) throw new Error('FAIL shot --on: no house checkout under the home folder here, so the place has none to run from')
|
|
40
|
+
return relative(homedir(), root)
|
|
41
|
+
}
|
|
42
|
+
|
|
33
43
|
export class ShotCommand extends Command {
|
|
34
44
|
static override paths = [['shot']]
|
|
35
45
|
static essential = { args: '<url>' }
|
|
@@ -38,7 +48,7 @@ export class ShotCommand extends Command {
|
|
|
38
48
|
category: 'Serve',
|
|
39
49
|
description: 'a webp of any url through the warm browser (a png with --out x.png), or an mp4 clip with --video',
|
|
40
50
|
details:
|
|
41
|
-
'one warm headless chromium for the whole machine (the `shot` global process, started when down). A still reuses the warm page when it already shows the url, so a warm shot answers in about 0.1 s. A page with `<meta name="shot-ready" content="wait">` is shot once it sets content="ready"; any other page --wait ms after its load; a page that navigates while it loads (a sign in that redirects) gets its wait again where it lands. --full shoots the whole page at the width of the viewport: one file while the page fits the tallest side of its format (webp 16383 px, jpg and png 65535), else tiles in that format, <name>-1, <name>-2… top to bottom, every one printed, so nothing of the page is lost and the format stays the one asked (a jpg instead of a webp would change what the caller asked for, a cut would drop the end of the page); a whole page stops at 131072 px, the cut said in the note. A file of this machine is a url too (its path, or file://). --video films a page that is a canvas through its WebCodecs encoder (H.264 muxed with no second encode), and any other page as chromium paints it (its screencast, encoded by ffmpeg as the frames arrive); --dom films the page even when a canvas fills it. --step <hook> films frame by frame: before each frame the page draws its time t (seconds) in `await window[hook](t)`, then its ready mark, so a slow page films smooth at its fps; a canvas page is encoded by its own WebCodecs at the exact time n / fps, any other page a screenshot a frame. A still with --step is the page drawn at --at s. A session: cookies follow every shot (one jar in memory for the whole machine), the local storage of a page does not: a shot at another viewport, a clip and the idle close (60 s) each start with an empty one, as two browser contexts do. So when an app keeps its session in local storage, open its sign in at the viewport you shoot at; a request the page sees answered 401 or 403 prints its own WARN line. A theme: --theme <hub theme> draws the page with that prefers-color-scheme and the hub reads its `hub:theme` as that theme, written nowhere, so the next shot keeps none; with no flag every shot of the machine takes serve.shotTheme of the house config.',
|
|
51
|
+
'one warm headless chromium for the whole machine (the `shot` global process, started when down). A still reuses the warm page when it already shows the url, so a warm shot answers in about 0.1 s. A page with `<meta name="shot-ready" content="wait">` is shot once it sets content="ready"; any other page --wait ms after its load; a page that navigates while it loads (a sign in that redirects) gets its wait again where it lands. --full shoots the whole page at the width of the viewport: one file while the page fits the tallest side of its format (webp 16383 px, jpg and png 65535), else tiles in that format, <name>-1, <name>-2… top to bottom, every one printed, so nothing of the page is lost and the format stays the one asked (a jpg instead of a webp would change what the caller asked for, a cut would drop the end of the page); a whole page stops at 131072 px, the cut said in the note. A file of this machine is a url too (its path, or file://). --video films a page that is a canvas through its WebCodecs encoder (H.264 muxed with no second encode), and any other page as chromium paints it (its screencast, encoded by ffmpeg as the frames arrive); --dom films the page even when a canvas fills it. --step <hook> films frame by frame: before each frame the page draws its time t (seconds) in `await window[hook](t)`, then its ready mark, so a slow page films smooth at its fps; a canvas page is encoded by its own WebCodecs at the exact time n / fps, any other page a screenshot a frame. A still with --step is the page drawn at --at s. A session: cookies follow every shot (one jar in memory for the whole machine), the local storage of a page does not: a shot at another viewport, a clip and the idle close (60 s) each start with an empty one, as two browser contexts do. So when an app keeps its session in local storage, open its sign in at the viewport you shoot at; a request the page sees answered 401 or 403 prints its own WARN line. A theme: --theme <hub theme> draws the page with that prefers-color-scheme and the hub reads its `hub:theme` as that theme, written nowhere, so the next shot keeps none; with no flag every shot of the machine takes serve.shotTheme of the house config. Another place: --on <place> runs the same shot on a machine that reports to the hq (sk machines), over ssh, by its own `sk shot` from its house checkout, so its warm browser draws the page and its localhost is its own; each file comes back to --out and leaves its /tmp. A place that does not answer ssh, has no shot service or runs a shipkit whose sk shot refuses the ask fails in one line with the fix. A box with no shipkit place (no daemon, no pm, no shot service, a GPU box for one) is refused; a repo whose repo.config.ts names such a box in browsers.box already films on it with a plain sk shot.',
|
|
42
52
|
examples: [
|
|
43
53
|
['a still of a running dev server', 'sk shot localhost:5173/'],
|
|
44
54
|
['a whole tall page at a phone width', 'sk shot :5173/guest --viewport 390,844 --full --out shots/guest.png'],
|
|
@@ -46,6 +56,7 @@ export class ShotCommand extends Command {
|
|
|
46
56
|
['a 3 s clip', 'sk shot :4808/ --video 3 --out clips/walk.mp4'],
|
|
47
57
|
['a clip of a whole web app page, canvas or not', 'sk shot :5173/settings --video 3 --dom'],
|
|
48
58
|
['the hub in its dark theme, whatever the default', 'sk shot :4804/ --theme dark'],
|
|
59
|
+
['the hub of another machine of the house, shot by its own browser, the file brought here', 'sk shot :4799/ --on studio --out shots/studio.webp'],
|
|
49
60
|
['a slow 3D page stepped frame by frame through window.__trailerStep(t)', 'sk shot :4808/ --video 3 --step __trailerStep --out clips/walk.mp4'],
|
|
50
61
|
],
|
|
51
62
|
})
|
|
@@ -64,14 +75,25 @@ export class ShotCommand extends Command {
|
|
|
64
75
|
step = Option.String('--step', { description: 'a window function the page draws time t (s) in: a clip steps it frame by frame, a still draws --at' })
|
|
65
76
|
at = Option.String('--at', { description: 'with --step, the time a still is drawn at (default 0)' })
|
|
66
77
|
theme = Option.String('--theme', { description: 'dark, dim, grey or light: the page drawn in that hub theme, this shot only (default the house config serve.shotTheme)' })
|
|
78
|
+
on = Option.String('--on', { description: 'another place of the house (sk machines): the shot runs in its own warm browser, its localhost is its own, the file comes back to --out; a box with no shipkit place is refused' })
|
|
67
79
|
json = Option.Boolean('--json', false, { description: 'one json line: out, ms, phases, errors, note, via, and tiles when a whole page is tiled' })
|
|
68
80
|
|
|
69
81
|
async execute(): Promise<number> {
|
|
70
82
|
const cwd = process.cwd()
|
|
71
83
|
const err = (l: string) => this.context.stderr.write(`${l}\n`)
|
|
72
84
|
try {
|
|
73
|
-
const
|
|
74
|
-
|
|
85
|
+
const place = this.on == null ? 'here' : await (await import('../shot/on-place.ts')).lookPlace(this.on)
|
|
86
|
+
if (place !== 'here' && 'refused' in place) throw new Error(place.refused)
|
|
87
|
+
const a = askOf({ url: place === 'here' ? fileUrlOf(this.url, cwd) : this.url, full: this.full, viewport: this.viewport, dpr: this.dpr, out: this.out, reload: this.reload, wait: this.wait, video: this.video, fps: this.fps, long: this.long, dom: this.dom, step: this.step, at: this.at, theme: this.theme }, cwd)
|
|
88
|
+
const r =
|
|
89
|
+
place !== 'here'
|
|
90
|
+
? await (async () => {
|
|
91
|
+
const { placeSsh, shotOnPlace } = await import('../shot/on-place.ts')
|
|
92
|
+
return shotOnPlace(place, a, { ssh: placeSsh, houseRel: await houseRelHere(cwd), say: err })
|
|
93
|
+
})()
|
|
94
|
+
: isClip(a)
|
|
95
|
+
? await clipUrl(a, err)
|
|
96
|
+
: await shotUrl(a, err)
|
|
75
97
|
if (this.json) this.context.stdout.write(`${JSON.stringify(r)}\n`)
|
|
76
98
|
else for (const l of renderShot(r, cwd)) this.context.stdout.write(`${l}\n`)
|
|
77
99
|
return 0
|
package/src/cli/cmd_Start.ts
CHANGED
|
@@ -10,7 +10,7 @@ export class StartCommand extends Command {
|
|
|
10
10
|
static override usage = Command.Usage({
|
|
11
11
|
category: 'Setup',
|
|
12
12
|
description: 'create or enter ~/dev/<name>, ready to work in: a private github repo and a push unless --no-github',
|
|
13
|
-
details: 'create (or enter) ~/dev/<name> from ANY cwd, READY to work in. On any dir with no commit history it writes the day-one shape (package.json + src/index.ts + the project CLI on the kit (src/cli.ts, src/cli/cmd_Dev.ts, the cli script and a bin of the repo name) + lint/typecheck, tsconfig, .vscode tasks + settings, the verify skill, an agent/ wiki, .shipkit/reflections), installs the toolchain, wires shipkit (repo.config.ts via init), and runs the whole bootstrap chain: git init, first commit, PRIVATE github repo, push. Loose files ride in that first commit, and only a repo with real history is left as it is. Writes are create-only for files, additive for package.json scripts and .gitignore. CLAUDE.md is the house template on its own (its identity line comes at the first gate, SK003) (
|
|
13
|
+
details: 'create (or enter) ~/dev/<name> from ANY cwd, READY to work in. On any dir with no commit history it writes the day-one shape (package.json + src/index.ts + the project CLI on the kit (src/cli.ts, src/cli/cmd_Dev.ts, the cli script and a bin of the repo name) + lint/typecheck, tsconfig, .vscode tasks + settings, the verify skill, an agent/ wiki, .shipkit/reflections), installs the toolchain, wires shipkit (repo.config.ts via init), and runs the whole bootstrap chain: git init, first commit, PRIVATE github repo, push. Loose files ride in that first commit, and only a repo with real history is left as it is. Writes are create-only for files, additive for package.json scripts and .gitignore. CLAUDE.md is the house template on its own (its identity line comes at the first gate, SK003) (the house of this machine first, then `@./agent/index.md`, and --include overrides it), applied only on a machine that has a house (`sk setup` makes one), and the agent route lands last whenever the repo has agent/index.md. The house lines also opt the repo into the .claude/ policy files (a pre-approved shell allowlist + the attribution silencer), so a start with no house widens no agent permissions. Prints the dir on stdout so a shell alias can cd there. cwd-only sibling: `shipkit init`',
|
|
14
14
|
examples: [
|
|
15
15
|
['create or enter ~/dev/pong: dir, package.json, shipkit wiring, git, first commit, private github repo, push, the CLAUDE.md include lines', 'sk start pong'],
|
|
16
16
|
['another house: replace the include lines', "sk start pong --include '@~/wiki/index.md' --include '@./agent/index.md'"],
|
|
@@ -22,8 +22,8 @@ export class StartCommand extends Command {
|
|
|
22
22
|
})
|
|
23
23
|
|
|
24
24
|
name = Option.String()
|
|
25
|
-
root = Option.String('--root', { description: 'parent dir for repos (default ~/dev)' })
|
|
26
|
-
include = Option.Array('--include', { description: 'line CLAUDE.md must carry, repeatable, order kept. Omitted: the house
|
|
25
|
+
root = Option.String('--root', { description: 'parent dir for repos (default the folder the house sits in, ~/dev with no house)' })
|
|
26
|
+
include = Option.Array('--include', { description: 'line CLAUDE.md must carry, repeatable, order kept. Omitted: the house of this machine, then `@./agent/index.md`; on a machine with no house the agent route alone' })
|
|
27
27
|
alsoOk = Option.Array('--also-ok', { description: 'alternative lines satisfying the first --include — never double-add. Omitted: `@./CLAUDE.local.md`, the public-repo indirection' })
|
|
28
28
|
skip = Option.Array('--skip', { description: 'repo names shipkit never touches: no CLAUDE.md include, no wiring. Omitted: start.skip in the house config' })
|
|
29
29
|
github = Option.Boolean('--github', { description: 'ON by default when a repo is being STARTED (a dir this run created, or one with a package.json): it gets a PRIVATE github repo wired as origin, and the first commit is pushed to it. Pass --github to force it for a pre-existing folder, --no-github to keep everything local, the first commit included (SHIPKIT_NO_GITHUB=1 does it for every run)' })
|