rvlib-shipkit 2.31.0 → 2.32.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/advisors/acts.ts +16 -15
- package/src/advisors/advice.ts +56 -102
- package/src/advisors/advisor-view.ts +98 -73
- package/src/advisors/app-graph.ts +1 -1
- package/src/advisors/app.ts +3 -11
- package/src/advisors/cf-api.ts +1 -1
- package/src/advisors/dir-bucket.ts +4 -3
- package/src/advisors/edge/api.ts +26 -198
- package/src/advisors/edge/bucket.ts +2 -2
- package/src/advisors/edge/handler.ts +13 -155
- package/src/advisors/edge/here.ts +5 -5
- package/src/advisors/edge/pages.ts +12 -9
- package/src/advisors/edge/shell.ts +6 -5
- package/src/advisors/edge/sign-in.ts +101 -36
- package/src/advisors/edge/status.ts +19 -6
- package/src/advisors/edge/types.ts +36 -60
- package/src/advisors/expose.ts +29 -29
- package/src/advisors/here.ts +12 -12
- package/src/advisors/invite-send.ts +79 -35
- package/src/advisors/invite.ts +31 -8
- package/src/advisors/job.ts +24 -16
- package/src/advisors/login.ts +40 -15
- package/src/advisors/owner-store.ts +46 -22
- package/src/advisors/photos.ts +3 -3
- package/src/advisors/project.ts +25 -23
- package/src/advisors/reach.ts +89 -0
- package/src/advisors/rights.ts +1 -1
- package/src/advisors/routes.ts +55 -74
- package/src/advisors/scan.ts +0 -4
- package/src/advisors/setup-run.ts +14 -14
- package/src/advisors/share-trace.ts +3 -3
- package/src/advisors/{door-probe.ts → sign-in-probe.ts} +7 -6
- package/src/advisors/speaks.ts +29 -0
- package/src/advisors/sync.ts +92 -182
- package/src/advisors/tunnel.ts +6 -5
- package/src/advisors/users-listen.ts +92 -0
- package/src/advisors/users-router.ts +257 -85
- package/src/advisors/users-store.ts +81 -0
- package/src/agent-time/blocked-scan.ts +181 -0
- package/src/agent-time/registry.ts +12 -5
- package/src/agent-time/store.ts +9 -109
- package/src/asks/ask-bar-fold.ts +2 -1
- package/src/asks/ask-close.ts +2 -1
- package/src/asks/ask-doc.ts +2 -1
- package/src/asks/ask-migrate.ts +3 -2
- package/src/asks/ask-steps-fold.ts +2 -1
- package/src/asks/ask-store.ts +4 -3
- package/src/check.ts +3 -43
- package/src/checks/SK001-package-json-shape.check.ts +4 -55
- package/src/checks/SK004-gitignore-policy.check.ts +24 -69
- package/src/checks/SK013-one-way-in-policy.check.ts +3 -7
- package/src/checks/SK017-vscode-hub-task.check.ts +4 -4
- package/src/checks/SK019-tests-run-in-units.check.ts +3 -14
- package/src/checks/SK020-self-spawning-check.check.ts +5 -7
- package/src/checks/SK035-public-clean.check.ts +1 -1
- package/src/checks/SK039-vscode-watch-generated.check.ts +1 -1
- package/src/checks/SK042-post-kinds.check.ts +5 -14
- package/src/checks/SK054-agent-allow-list.check.ts +5 -74
- package/src/checks/SK055-retired-config-keys.check.ts +45 -0
- package/src/cli/cmd_Advisors.ts +11 -45
- package/src/cli/cmd_Asks.ts +3 -10
- package/src/cli/cmd_Backup.ts +25 -127
- package/src/cli/cmd_BackupTargets.ts +1 -1
- package/src/cli/cmd_Checks.ts +0 -14
- package/src/cli/cmd_Db.ts +3 -82
- package/src/cli/cmd_Home.ts +4 -32
- package/src/cli/cmd_Hq.ts +0 -17
- package/src/cli/cmd_Releases.ts +57 -4
- package/src/cli/cmd_Review.ts +333 -354
- package/src/cli/cmd_SocialDrafts.ts +6 -13
- package/src/cli/cmd_ThreadSyncNeeds.ts +6 -2
- package/src/cli/cmd_Time.ts +1 -1
- package/src/cli/cmd_Trailer.ts +1 -1
- package/src/cli/inbox-hook-run.ts +5 -23
- package/src/cli/registry-heads.ts +5 -55
- package/src/cli/registry.ts +1 -5
- package/src/cli/review-here.ts +1 -1
- package/src/cli.ts +2 -2
- package/src/collections/collection-types.ts +1 -1
- package/src/collections/review.ts +5 -4
- package/src/core/agent-allow-policy.ts +32 -2
- package/src/core/agent-env.ts +8 -0
- package/src/core/allow-rows.ts +74 -0
- package/src/core/check-file-names.ts +19 -106
- package/src/core/footprint.ts +17 -13
- package/src/core/identities-root.ts +1 -4
- package/src/core/layout.ts +1 -2
- package/src/core/machine-db.ts +33 -208
- package/src/core/machine-layout.ts +14 -127
- package/src/core/mask-source.ts +60 -0
- package/src/core/memory-watch.ts +17 -14
- package/src/core/motherhome.ts +8 -35
- package/src/core/one-way-in-policy.ts +0 -3
- package/src/core/repo-walk.ts +0 -9
- package/src/core/retention.ts +1 -9
- package/src/core/retired-checks.ts +2 -0
- package/src/core/tmux-policy.ts +1 -1
- package/src/core/tree-watch.ts +2 -2
- package/src/core/when.ts +7 -45
- package/src/gate/discover-checks.ts +42 -32
- package/src/gate/gate-checks.ts +21 -131
- package/src/gate/pre-commit-discovery.ts +16 -25
- package/src/gate/run-check.ts +0 -4
- package/src/gate/run-fix.ts +5 -17
- package/src/gate/run-fixers.ts +6 -42
- package/src/home/app-sign.ts +2 -2
- package/src/home/backup-status.ts +52 -92
- package/src/home/backup-verdict.ts +2 -2
- package/src/home/daemon-jobs.ts +51 -95
- package/src/home/database-words.ts +1 -2
- package/src/home/databases.ts +9 -25
- package/src/home/home-launchd.ts +0 -6
- package/src/home/home-paths.ts +8 -4
- package/src/home/home-routes.ts +3 -10
- package/src/home/home-state.ts +2 -14
- package/src/home/inbox-shape.ts +14 -15
- package/src/home/inbox.ts +1 -1
- package/src/home/machine-repair.ts +102 -103
- package/src/home/resume.ts +1 -15
- package/src/home/run-daemon.ts +4 -11
- package/src/home/space-page.ts +3 -2
- package/src/home/supervise.ts +3 -7
- package/src/hooks/hook-config.ts +6 -7
- package/src/hooks/leak-guard.ts +1 -1
- package/src/hooks/run-hooks.ts +0 -5
- package/src/hq/daemon-db.ts +8 -8
- package/src/hq/door.ts +3 -16
- package/src/hq/hq-db.ts +4 -3
- package/src/hq/hq-local.ts +1 -2
- package/src/hq/hq-store.ts +0 -15
- package/src/hq/item-direct.ts +8 -10
- package/src/hq/item-fill.ts +37 -0
- package/src/hq/kinds/item-gone.ts +7 -10
- package/src/hq/kinds/item-msg.ts +12 -18
- package/src/hq/kinds/item.ts +13 -19
- package/src/hq/kinds/report.ts +3 -4
- package/src/hq/owner-switch.ts +3 -3
- package/src/hq/report.ts +5 -9
- package/src/hq/switch.ts +2 -11
- package/src/hq/thread-sync.ts +5 -17
- package/src/hq/{shapes-words.ts → threads-words.ts} +2 -12
- package/src/http/owner-word.ts +1 -1
- package/src/identities/machine.ts +16 -0
- package/src/init-repo.ts +0 -1
- package/src/ledger/check-stats.ts +6 -5
- package/src/ledger/db.ts +2 -4
- package/src/ledger/record-kept.ts +117 -48
- package/src/ledger/run-log.ts +21 -2
- package/src/ledger/slow-tests.ts +96 -0
- package/src/ledger/store.ts +3 -86
- package/src/ledger/suite-log.ts +8 -2
- package/src/media-store/backup/facts.ts +3 -37
- package/src/media-store/backup/keys.ts +1 -8
- package/src/media-store/backup/manifest.ts +6 -67
- package/src/media-store/backup/restore.ts +4 -13
- package/src/media-store/backup/retention.ts +13 -1
- package/src/media-store/backup/run.ts +6 -267
- package/src/media-store/backup/snapshot.ts +2 -38
- package/src/media-store/backup/sources.ts +3 -113
- package/src/media-store/backup/target-send.ts +5 -29
- package/src/media-store/db.ts +8 -7
- package/src/media-store/forget-one.ts +1 -1
- package/src/media-store/forget.ts +1 -80
- package/src/orchestrator/guards.ts +0 -1
- package/src/orchestrator/presence.ts +2 -2
- package/src/orchestrator/routes.ts +1 -1
- package/src/orchestrator/started.ts +0 -9
- package/src/orchestrator/talk-key.ts +3 -4
- package/src/orchestrator/unheard.ts +1 -1
- package/src/recordings/edit.ts +3 -3
- package/src/recordings/marks-draw.ts +17 -6
- package/src/recordings/marks.ts +120 -9
- package/src/reflections/reflections-queue.ts +3 -10
- package/src/release/notes.ts +1 -1
- package/src/release/public-clean.ts +66 -6
- package/src/release/run-bump.ts +11 -0
- package/src/release/run-release.ts +4 -0
- package/src/releases/from-thread.ts +3 -3
- package/src/releases/model.ts +186 -36
- package/src/releases/store.ts +13 -3
- package/src/releases/validate.ts +83 -0
- package/src/repo-config.ts +29 -64
- package/src/review/answer-kinds.ts +61 -4
- package/src/review/blocked-guard.ts +11 -0
- package/src/review/blocked-object.ts +298 -0
- package/src/review/cells.ts +116 -229
- package/src/review/close.ts +39 -1
- package/src/review/doc-save.ts +3 -2
- package/src/review/draft-item.ts +1 -1
- package/src/review/events.ts +3 -7
- package/src/review/expect.ts +23 -39
- package/src/review/format.ts +79 -46
- package/src/review/glyphs.ts +1 -0
- package/src/review/hand-over.ts +3 -3
- package/src/review/heard.ts +1 -1
- package/src/review/holds-sync.ts +2 -1
- package/src/review/inbox-hook.ts +2 -2
- package/src/review/inbox-read.ts +39 -33
- package/src/review/instruction-guards.ts +12 -0
- package/src/review/instructions.ts +0 -1
- package/src/review/item-db.ts +13 -43
- package/src/review/item-hq.ts +2 -2
- package/src/review/item-rows.ts +3 -14
- package/src/review/kind-catalog.ts +3 -1
- package/src/review/kinds.ts +18 -8
- package/src/review/live-view.ts +3 -0
- package/src/review/media-kind.ts +1 -1
- package/src/review/mentions.ts +1 -2
- package/src/review/model.ts +158 -114
- package/src/review/move.ts +149 -0
- package/src/review/need-threads.ts +3 -2
- package/src/review/object-card.ts +11 -0
- package/src/review/object-read.ts +6 -1
- package/src/review/one-block.ts +1 -1
- package/src/review/owner-read.ts +1 -1
- package/src/review/phone-push.ts +10 -9
- package/src/review/previews.ts +32 -4
- package/src/review/push.ts +2 -2
- package/src/review/recap.ts +129 -0
- package/src/review/referring.ts +6 -3
- package/src/review/reflection-object.ts +4 -3
- package/src/review/routes.ts +49 -19
- package/src/review/secret-route.ts +3 -2
- package/src/review/settle.ts +0 -6
- package/src/review/snooze.ts +5 -3
- package/src/review/speaker.ts +68 -0
- package/src/review/start-title.ts +19 -0
- package/src/review/store.ts +86 -59
- package/src/review/{wakes.ts → thread-events.ts} +92 -7
- package/src/review/thread-md.ts +35 -14
- package/src/review/thread-state.ts +798 -0
- package/src/review/threads.ts +29 -347
- package/src/review/traces.ts +104 -7
- package/src/review/trailer-item.ts +1 -1
- package/src/review/unit.ts +7 -9
- package/src/review/verdict-items.ts +12 -10
- package/src/review/view-layout.ts +25 -1
- package/src/review/watch-feed.ts +1 -2
- package/src/review/working-guards.ts +2 -3
- package/src/rules/untrack-generated.ts +1 -15
- package/src/secrets/lapse.ts +2 -1
- package/src/serve/hub-app/advisor-app.tsx +4 -4
- package/src/serve/hub-app/advisor-face.tsx +9 -3
- package/src/serve/hub-app/advisor-host.ts +27 -27
- package/src/serve/hub-app/advisors-model.ts +17 -8
- package/src/serve/hub-app/advisors-rights.tsx +1 -1
- package/src/serve/hub-app/advisors-st.ts +15 -14
- package/src/serve/hub-app/advisors-view.tsx +13 -11
- package/src/serve/hub-app/app-bridge.ts +23 -3
- package/src/serve/hub-app/asks-page.tsx +1 -1
- package/src/serve/hub-app/auto-text.tsx +71 -16
- package/src/serve/hub-app/check-view.tsx +0 -8
- package/src/serve/hub-app/controls.css +14 -3
- package/src/serve/hub-app/database-view.tsx +1 -2
- package/src/serve/hub-app/git-view.tsx +3 -1
- package/src/serve/hub-app/hub.css +12 -5
- package/src/serve/hub-app/icons.tsx +1 -1
- package/src/serve/hub-app/inbox-view.tsx +1 -2
- package/src/serve/hub-app/live-sources.ts +2 -2
- package/src/serve/hub-app/main-panel.tsx +2 -1
- package/src/serve/hub-app/panel-repo.ts +0 -9
- package/src/serve/hub-app/pic.tsx +29 -12
- package/src/serve/hub-app/polled.ts +16 -2
- package/src/serve/hub-app/recordings-st.ts +23 -2
- package/src/serve/hub-app/recordings-view.tsx +68 -10
- package/src/serve/hub-app/ref-pill.ts +1 -1
- package/src/serve/hub-app/repo-st.ts +1 -2
- package/src/serve/hub-app/review/advisor-add.tsx +1 -1
- package/src/serve/hub-app/review/advisor-invite.tsx +1 -1
- package/src/serve/hub-app/review/draft-body.tsx +2 -2
- package/src/serve/hub-app/review/heard-line.tsx +1 -1
- package/src/serve/hub-app/review/instructions-view.tsx +1 -8
- package/src/serve/hub-app/review/kind-states.tsx +14 -9
- package/src/serve/hub-app/review/kit.tsx +4 -11
- package/src/serve/hub-app/review/lane-bar.tsx +3 -3
- package/src/serve/hub-app/review/lightbox.tsx +15 -11
- package/src/serve/hub-app/review/line-window.ts +4 -1
- package/src/serve/hub-app/review/live-bar-st.ts +2 -2
- package/src/serve/hub-app/review/live-view.tsx +57 -1
- package/src/serve/hub-app/review/object-panel.tsx +20 -8
- package/src/serve/hub-app/review/question-views.tsx +181 -54
- package/src/serve/hub-app/review/recap-bar.tsx +40 -0
- package/src/serve/hub-app/review/request-cell.tsx +48 -0
- package/src/serve/hub-app/review/review-cells.tsx +154 -96
- package/src/serve/hub-app/review/review-host.ts +2 -2
- package/src/serve/hub-app/review/review-kit.ts +17 -11
- package/src/serve/hub-app/review/review-list.tsx +23 -31
- package/src/serve/hub-app/review/review-st.ts +30 -40
- package/src/serve/hub-app/review/review-thread.tsx +139 -85
- package/src/serve/hub-app/review/review-views.tsx +124 -68
- package/src/serve/hub-app/review/share-lines.tsx +4 -4
- package/src/serve/hub-app/review/start-st.ts +2 -5
- package/src/serve/hub-app/review/superseded-runs.ts +4 -3
- package/src/serve/hub-app/review/thread-close.tsx +10 -7
- package/src/serve/hub-app/review/thread-st.ts +372 -201
- package/src/serve/hub-app/review/tone-bar.tsx +126 -0
- package/src/serve/hub-app/review/tones.ts +35 -0
- package/src/serve/hub-app/review/trailer-body.tsx +2 -2
- package/src/serve/hub-app/review/trailer-st.ts +3 -2
- package/src/serve/hub-app/review/trailer-voices-st.ts +3 -2
- package/src/serve/hub-app/review.css +180 -106
- package/src/serve/hub-app/search-view.tsx +1 -1
- package/src/serve/hub-app/social/social-model.ts +0 -4
- package/src/serve/hub-app/source-acts.ts +2 -1
- package/src/serve/hub-app/stores/stores-page.tsx +2 -2
- package/src/serve/hub-app/terminal-sources.tsx +2 -1
- package/src/serve/hub-app/thread-row.tsx +3 -4
- package/src/serve/hub-app/tree-build.ts +0 -4
- package/src/serve/hub-app/urls-view.tsx +2 -1
- package/src/serve/hub-app/view-layout.css +13 -3
- package/src/serve/hub-app/wikis-view.tsx +5 -2
- package/src/serve/hub-runtime.ts +7 -37
- package/src/serve/project-gutter-route.ts +6 -2
- package/src/serve/read-thread.ts +20 -2
- package/src/serve/read-worker.ts +9 -1
- package/src/serve/record-pages.ts +46 -0
- package/src/serve/serve-hub.ts +2 -2
- package/src/serve/terminal-host.ts +1 -1
- package/src/serve/terminal-route.ts +1 -3
- package/src/serve/tracked-watch.ts +1 -3
- package/src/setup-house.ts +2 -2
- package/src/shipkit-files.ts +1 -1
- package/src/shipkit.ts +1 -6
- package/src/shot/film-box.ts +0 -20
- package/src/social/drafts.ts +1 -1
- package/src/social/kinds.ts +6 -29
- package/src/social/load.ts +2 -2
- package/src/social/post-object.ts +3 -2
- package/src/social/release-stage.ts +1 -1
- package/src/social/stage.ts +2 -2
- package/src/stores/model.ts +4 -0
- package/src/stores/routes.ts +11 -3
- package/src/suite/judge-suites.ts +58 -0
- package/src/suite/red-alone.ts +54 -18
- package/src/suite/runner-shapes.ts +2 -2
- package/src/suite/suite-cli.ts +67 -14
- package/src/suite/test-units.ts +2 -1
- package/src/urls/fill.ts +1 -1
- package/src/urls/places.ts +1 -2
- package/src/vault/vault-config.ts +2 -2
- package/src/vault/vault-init.ts +1 -5
- package/src/wiki/graph-page.ts +14 -2
- package/src/advisors/copy-truth.ts +0 -49
- package/src/advisors/door-child.ts +0 -112
- package/src/advisors/door-serve.ts +0 -52
- package/src/advisors/door.ts +0 -118
- package/src/checks/SK016-legacy-check-shapes.check.ts +0 -189
- package/src/checks/SK029-explicit-check-files.check.ts +0 -112
- package/src/checks/SK048-one-local-file.check.ts +0 -36
- package/src/core/config-rewrite.ts +0 -111
- package/src/core/daemon-port.ts +0 -10
- package/src/core/legacy-shapes.ts +0 -263
- package/src/core/migrate-layout.ts +0 -638
- package/src/core/port-check-cli.ts +0 -52
- package/src/core/port-check-file.ts +0 -295
- package/src/core/port-check-files.ts +0 -31
- package/src/gate/discover-legacy-checks.ts +0 -26
- package/src/home/home-move.ts +0 -527
- package/src/home/machine-fold.ts +0 -810
- package/src/hq/item-shapes.ts +0 -54
- package/src/hq/kinds/items-read.ts +0 -4
- package/src/media-store/backup/daemon.ts +0 -220
- package/src/media-store/backup/kept.ts +0 -241
- package/src/media-store/backup/prune.ts +0 -359
- package/src/media-store/backup/secret.ts +0 -88
- package/src/media-store/backup/ssh-space.ts +0 -202
- package/src/media-store/backup/watch.ts +0 -117
- package/src/review/band.ts +0 -182
- package/src/review/folders.ts +0 -216
- package/src/review/hook-ask.ts +0 -58
- package/src/review/role.ts +0 -48
- package/src/review/thread-fold.ts +0 -64
- package/src/review/wait.ts +0 -91
- package/src/rules/rule.ts +0 -43
- package/src/serve/hook-thread.ts +0 -37
- package/src/serve/hook-work.ts +0 -92
- package/src/serve/hook-worker.ts +0 -57
- package/src/serve/hub-app/review/dock.tsx +0 -147
- package/src/serve/hub-app/review/faces.tsx +0 -18
- package/src/serve/hub-app/review/item-verdict.tsx +0 -112
- package/src/serve/hub-app/review/review-board.tsx +0 -48
- /package/src/{scaffold → core}/jsonc-spans.ts +0 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// SK055: repo.config.ts carries no key that is gone. `defineRepo` refuses a removed key by name, so a config holding
|
|
2
|
+
// one never loads; the one exception is the empty `tasks: []` that every scaffold wrote, which loads and means
|
|
3
|
+
// nothing, so this check names it and its repair drops the line. A `tasks` with an entry is refused at load with the
|
|
4
|
+
// unit file to write instead, since a task is a command a person chose and no machine moves it.
|
|
5
|
+
import { check, type FixResult } from '../check.ts'
|
|
6
|
+
|
|
7
|
+
const CONFIG = 'repo.config.ts'
|
|
8
|
+
/** the scaffold's line, alone on its line, its comma and comment with it */
|
|
9
|
+
const EMPTY_TASKS = /^[ \t]*tasks[ \t]*:[ \t]*\[[ \t]*\][ \t]*,?[ \t]*(\/\/[^\n]*)?\n/gm
|
|
10
|
+
|
|
11
|
+
/** the config text without its empty `tasks: []` line, or null when it holds none or more than one */
|
|
12
|
+
export function dropEmptyTasks(src: string): string | null {
|
|
13
|
+
const hits = src.match(EMPTY_TASKS) ?? []
|
|
14
|
+
return hits.length !== 1 ? null : src.replace(EMPTY_TASKS, '')
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const retiredConfigKeys = check({
|
|
18
|
+
id: 'SK055',
|
|
19
|
+
blocking: true,
|
|
20
|
+
title: 'retired config keys',
|
|
21
|
+
description: 'repo.config.ts carries no key that shipkit retired',
|
|
22
|
+
owner: 'tools/shipkit/config-keys.md',
|
|
23
|
+
runs: { onPreCommit: false, onCi: true, onFull: true, onRelease: true, onHealth: true, onSave: 'moved', onClock: false },
|
|
24
|
+
cache: { by: 'reads' },
|
|
25
|
+
fix: 'ci',
|
|
26
|
+
applies: 'always',
|
|
27
|
+
run: (c) => {
|
|
28
|
+
const src = c.read(CONFIG)
|
|
29
|
+
if (src == null) return void c.ok(`${CONFIG} absent`)
|
|
30
|
+
const n = (src.match(EMPTY_TASKS) ?? []).length
|
|
31
|
+
if (n === 0) return void c.ok(`${CONFIG} carries no retired key`)
|
|
32
|
+
c.fail(`${CONFIG} still carries \`tasks: []\`: the key is gone, a build step is a <name>.check.shipkit.ts file with \`build: true\``)
|
|
33
|
+
c.lines.push({ kind: 'fix-fail', text: n === 1 ? 'sk ci (or sk check --fix SK055) drops the line' : `${n} such lines: delete them by hand` })
|
|
34
|
+
},
|
|
35
|
+
repair: (c): FixResult => {
|
|
36
|
+
const src = c.read(CONFIG)
|
|
37
|
+
if (src == null) return { changed: false, summary: `${CONFIG} absent` }
|
|
38
|
+
const next = dropEmptyTasks(src)
|
|
39
|
+
if (next == null) return { changed: false, summary: (src.match(EMPTY_TASKS) ?? []).length === 0 ? 'no retired key' : 'more than one `tasks: []` line: delete them by hand' }
|
|
40
|
+
c.write(CONFIG, next)
|
|
41
|
+
return { changed: true, summary: `${CONFIG} drops its empty \`tasks: []\`` }
|
|
42
|
+
},
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
export default retiredConfigKeys
|
package/src/cli/cmd_Advisors.ts
CHANGED
|
@@ -61,7 +61,7 @@ abstract class AdvisorsBase extends Command {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
/** the pass after an act:
|
|
64
|
+
/** the pass after an act: the owner's pass once the advisors page is set up, else the owner's preview refreshed */
|
|
65
65
|
protected async pass(house: string | null, say: (l: string) => void): Promise<void> {
|
|
66
66
|
const { advisorsPass } = await import('../advisors/job.ts')
|
|
67
67
|
const { tunnelStart } = await import('../home/advisors-tunnel-start.ts')
|
|
@@ -399,7 +399,7 @@ export class AdvisorsExposeCommand extends AdvisorsBase {
|
|
|
399
399
|
static override usage = Command.Usage({
|
|
400
400
|
category: 'Review',
|
|
401
401
|
description: 'set the advisors page up, once, in a terminal of the owner: a Cloudflare Tunnel to this Mac',
|
|
402
|
-
details: 'In order: the tunnel rv-advisors, its one way in (the name to the advisors page\'s server on this Mac), its token into the vault, the process that runs cloudflared started and connected, the name pointed at the tunnel last, then what the advisors page was before removed (its Worker, its bucket, its Access apps). A second run writes nothing. Needs the setup token of the ask that opens the advisors page. Refused in an agent\'s shell and without a terminal (wiki tools/shipkit/advisors.md,
|
|
402
|
+
details: 'In order: the tunnel rv-advisors, its one way in (the name to the advisors page\'s server on this Mac), its token into the vault, the process that runs cloudflared started and connected, the name pointed at the tunnel last, then what the advisors page was before removed (its Worker, its bucket, its Access apps). A second run writes nothing. Needs the setup token of the ask that opens the advisors page. Refused in an agent\'s shell and without a terminal (wiki tools/shipkit/advisors.md, Who calls).',
|
|
403
403
|
examples: [['the advisors page at advisors.example.org, under the zone example.org', 'sk advisors expose --host advisors.example.org']],
|
|
404
404
|
})
|
|
405
405
|
host = Option.String('--host', { required: true, description: 'the advisors\' name, under a zone of the Cloudflare account: advisors.<domain>' })
|
|
@@ -409,9 +409,9 @@ export class AdvisorsExposeCommand extends AdvisorsBase {
|
|
|
409
409
|
const { notTypedByOwner } = await import('../vault/vault-init.ts')
|
|
410
410
|
const why = notTypedByOwner({ env: process.env, stdinTTY: process.stdin.isTTY === true, stdoutTTY: process.stdout.isTTY === true })
|
|
411
411
|
if (why !== null) throw new Error(`setting the advisors page up is the owner’s act: ${why}`)
|
|
412
|
-
const {
|
|
412
|
+
const { exposeAdvisors } = await import('../advisors/expose.ts')
|
|
413
413
|
const { tunnelStart } = await import('../home/advisors-tunnel-start.ts')
|
|
414
|
-
await
|
|
414
|
+
await exposeAdvisors({ dir, cwd: process.cwd(), host: this.host.trim().toLowerCase(), say }, { tunnel: tunnelStart() })
|
|
415
415
|
})
|
|
416
416
|
}
|
|
417
417
|
}
|
|
@@ -421,7 +421,7 @@ export class AdvisorsTunnelCommand extends AdvisorsBase {
|
|
|
421
421
|
static override usage = Command.Usage({
|
|
422
422
|
category: 'Review',
|
|
423
423
|
description: 'keep cloudflared up while this Mac carries the hq: the pm process advisors-tunnel runs it',
|
|
424
|
-
details: 'The tunnel\'s token from the vault, by its environment, never its command line. Without the token it waits and says so in one line; on a Mac that does not carry the hq it opens nothing (wiki tools/shipkit/advisors.md,
|
|
424
|
+
details: 'The tunnel\'s token from the vault, by its environment, never its command line. Without the token it waits and says so in one line; on a Mac that does not carry the hq it opens nothing (wiki tools/shipkit/advisors.md, Who calls).',
|
|
425
425
|
})
|
|
426
426
|
|
|
427
427
|
async execute(): Promise<number> {
|
|
@@ -430,56 +430,22 @@ export class AdvisorsTunnelCommand extends AdvisorsBase {
|
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
432
|
|
|
433
|
-
export class AdvisorsLiveCommand extends Command {
|
|
434
|
-
static override paths = [['advisors', 'live']]
|
|
435
|
-
static override usage = Command.Usage({
|
|
436
|
-
category: 'Review',
|
|
437
|
-
description: "who answers the advisors' port: the daemon from live threads (on), or the copy (off)",
|
|
438
|
-
details: "The machine switch advisors-live. On, the daemon of the Mac that carries the hq serves the advisors' port itself within 30 s: the list of threads, a thread, its pictures, a reply and a read cursor answer from the live threads, the rest as before. Off, the child over the copy again, as before. Nothing else changes: the rights, the sign in and every person's session stay (wiki tools/shipkit/advisors.md, Who calls).",
|
|
439
|
-
examples: [
|
|
440
|
-
['where it stands', 'sk advisors live'],
|
|
441
|
-
['served live by the daemon', 'sk advisors live on'],
|
|
442
|
-
['back to the copy', 'sk advisors live off'],
|
|
443
|
-
],
|
|
444
|
-
})
|
|
445
|
-
|
|
446
|
-
to = Option.String({ required: false, name: 'on|off' })
|
|
447
|
-
|
|
448
|
-
async execute(): Promise<number> {
|
|
449
|
-
const { machineGet, machineSet } = await import('../core/machine-db.ts')
|
|
450
|
-
const { ADVISORS_LIVE } = await import('../advisors/users-router.ts')
|
|
451
|
-
if (this.to !== undefined) {
|
|
452
|
-
if (this.to !== 'on' && this.to !== 'off') {
|
|
453
|
-
this.context.stderr.write(`FAIL: on or off, not ${JSON.stringify(this.to).slice(0, 40)}\n`)
|
|
454
|
-
return 1
|
|
455
|
-
}
|
|
456
|
-
if (!machineSet(ADVISORS_LIVE, this.to === 'on')) {
|
|
457
|
-
this.context.stderr.write('FAIL: the machine db does not open: the switch is not set\n')
|
|
458
|
-
return 1
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
const on = machineGet<boolean>(ADVISORS_LIVE) === true
|
|
462
|
-
this.context.stdout.write(`${on ? "advisors live: on, the daemon serves the advisors' port from the threads themselves (within 30 s of a change)" : "advisors live: off, the advisors' port reads the copy (sk advisors live on to serve it live)"}\n`)
|
|
463
|
-
return 0
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
|
|
467
433
|
export class AdvisorsCheckCommand extends AdvisorsBase {
|
|
468
434
|
static override paths = [['advisors', 'check']]
|
|
469
435
|
static override usage = Command.Usage({
|
|
470
436
|
category: 'Review',
|
|
471
437
|
description: 'prove from outside that the advisors page answers, its sign in tried in a real browser',
|
|
472
|
-
details: "With Chrome on the machine, one try of the sign in in a headless Chrome: the form filled with nobody@example.org and a made up password, posted by the form itself; it wants the page's own «
|
|
438
|
+
details: "With Chrome on the machine, one try of the sign in in a headless Chrome: the form filled with nobody@example.org and a made up password, posted by the form itself; it wants the page's own « Check your email and password », never « Forbidden ». One try a run, on an email no person has: no person's count moves. With no Chrome: a WARN, never a pass.",
|
|
473
439
|
})
|
|
474
440
|
|
|
475
441
|
async execute(): Promise<number> {
|
|
476
442
|
return this.go(async (dir, say) => {
|
|
477
443
|
const { readState } = await import('../advisors/owner-store.ts')
|
|
478
|
-
const {
|
|
479
|
-
const { probeSignIn } = await import('../advisors/
|
|
444
|
+
const { checkAdvisors } = await import('../advisors/expose.ts')
|
|
445
|
+
const { probeSignIn } = await import('../advisors/sign-in-probe.ts')
|
|
480
446
|
const host = readState(dir).host
|
|
481
447
|
if (host === null) throw new Error('the advisors page is not set up: sk advisors expose, in the owner’s terminal')
|
|
482
|
-
const fails = await
|
|
448
|
+
const fails = await checkAdvisors(host)
|
|
483
449
|
for (const f of fails) say(`FAIL ${f}`)
|
|
484
450
|
const browser = await probeSignIn(host)
|
|
485
451
|
if ('fail' in browser) say(`FAIL sign in in a browser: ${browser.fail}`)
|
|
@@ -497,7 +463,7 @@ export class AdvisorsPhotoCommand extends AdvisorsBase {
|
|
|
497
463
|
static override usage = Command.Usage({
|
|
498
464
|
category: 'Review',
|
|
499
465
|
description: "a person's profile photo: cut square to 256 and 64 px webps, shown in the hub and on their page",
|
|
500
|
-
details: 'An agent may set it: the hub shows it at once, and it reaches that person’s own signed in page only once the owner set it himself or sends it from the advisors page. A url is https only, an image type, 5 MB at most (wiki tools/shipkit/advisors.md, A face for each
|
|
466
|
+
details: 'An agent may set it: the hub shows it at once, and it reaches that person’s own signed in page only once the owner set it himself or sends it from the advisors page. A url is https only, an image type, 5 MB at most (wiki tools/shipkit/advisors.md, A face for each advisor).',
|
|
501
467
|
examples: [['from a file', 'sk advisors photo Ada ada.jpg'], ['from a url', 'sk advisors photo Ada --from-url https://example.org/ada.png'], ['back to initials', 'sk advisors photo Ada --remove']],
|
|
502
468
|
})
|
|
503
469
|
advisor = Option.String()
|
|
@@ -522,4 +488,4 @@ export class AdvisorsPhotoCommand extends AdvisorsBase {
|
|
|
522
488
|
}
|
|
523
489
|
}
|
|
524
490
|
|
|
525
|
-
export const ADVISORS_COMMANDS = [AdvisorsListCommand, AdvisorsPeopleCommand, AdvisorsAccessCommand, AdvisorsRightsCommand, AdvisorsAddCommand, AdvisorsPhotoCommand, AdvisorsDraftCommand, AdvisorsDraftsCommand, AdvisorsEnableCommand, AdvisorsRevokeCommand, AdvisorsRenewCommand, AdvisorsExposeCommand, AdvisorsTunnelCommand,
|
|
491
|
+
export const ADVISORS_COMMANDS = [AdvisorsListCommand, AdvisorsPeopleCommand, AdvisorsAccessCommand, AdvisorsRightsCommand, AdvisorsAddCommand, AdvisorsPhotoCommand, AdvisorsDraftCommand, AdvisorsDraftsCommand, AdvisorsEnableCommand, AdvisorsRevokeCommand, AdvisorsRenewCommand, AdvisorsExposeCommand, AdvisorsTunnelCommand, AdvisorsCheckCommand, ThreadShareCommand, ThreadUnshareCommand]
|
package/src/cli/cmd_Asks.ts
CHANGED
|
@@ -438,12 +438,12 @@ export class AsksMigrateCommand extends Command {
|
|
|
438
438
|
static override usage = Command.Usage({
|
|
439
439
|
category: 'Asks',
|
|
440
440
|
description: 'old asks into the thread store: files, « Done: » questions, old steps; a look unless --go',
|
|
441
|
-
details: "Each file, open, done or declined, becomes its thread ask:<id>, or completes the thread it has: its facts on the head, its words, its status said in the thread, its later day as a set aside. Then every field of every file is compared with what the store reads back: any difference fails. Re-runnable: an ask whose thread says what its file says is left alone. An older ask's « Done: <title> » question folds into the ask bar, its one « done », counted before and after; his answer on one is kept. An open ask whose words are not the shape of wiki tools/shipkit/threads-instructions.md gets them again as instructions whose steps are their own checklist: an older one's « The steps » checklist folds in, a step that had him paste a secret at a terminal prompt holds its field in place of the command (a secret question asked beside the steps moves in, his stored answer kept), a « ## ✅ N. » heading drawn with no box becomes a step, a step that told the agent goes; his ticks kept by step title; one whose steps would read otherwise is left and named. --go
|
|
442
|
-
examples: [['a look in this repo', 'sk asks migrate'], ['every house repo
|
|
441
|
+
details: "Each file, open, done or declined, becomes its thread ask:<id>, or completes the thread it has: its facts on the head, its words, its status said in the thread, its later day as a set aside. Then every field of every file is compared with what the store reads back: any difference fails. Re-runnable: an ask whose thread says what its file says is left alone. An older ask's « Done: <title> » question folds into the ask bar, its one « done », counted before and after; his answer on one is kept. An open ask whose words are not the shape of wiki tools/shipkit/threads-instructions.md gets them again as instructions whose steps are their own checklist: an older one's « The steps » checklist folds in, a step that had him paste a secret at a terminal prompt holds its field in place of the command (a secret question asked beside the steps moves in, his stored answer kept), a « ## ✅ N. » heading drawn with no box becomes a step, a step that told the agent goes; his ticks kept by step title; one whose steps would read otherwise is left and named. --go writes: the ask files stay in git, the threads in the hq. --all: every house repo. The files stay: remove them by git once the compare is clean.",
|
|
442
|
+
examples: [['a look in this repo', 'sk asks migrate'], ['every house repo', 'sk asks migrate --all --go']],
|
|
443
443
|
})
|
|
444
444
|
|
|
445
445
|
all = Option.Boolean('--all', false, { description: 'every house repo, each its own store' })
|
|
446
|
-
go = Option.Boolean('--go', false, { description: 'write
|
|
446
|
+
go = Option.Boolean('--go', false, { description: 'write' })
|
|
447
447
|
|
|
448
448
|
async execute(): Promise<number> {
|
|
449
449
|
const out = (l: string): void => void this.context.stdout.write(`${l}\n`)
|
|
@@ -455,13 +455,6 @@ export class AsksMigrateCommand extends Command {
|
|
|
455
455
|
const { houseRepoRoots } = await import('../social/house.ts')
|
|
456
456
|
const roots = this.all ? (await houseRepoRoots(process.cwd())).map((r) => r.path) : [process.cwd()]
|
|
457
457
|
const word = (c: { open: number; done: number; declined: number }): string => `${c.open} open, ${c.done} done, ${c.declined} declined`
|
|
458
|
-
if (this.go)
|
|
459
|
-
for (const argv of [['sk', 'backup']]) {
|
|
460
|
-
out(`backup first: ${argv.join(' ')}`)
|
|
461
|
-
const b = Bun.spawnSync(argv, { stdout: 'pipe', stderr: 'pipe' })
|
|
462
|
-
for (const l of `${b.stdout?.toString() ?? ''}${b.stderr?.toString() ?? ''}`.trim().split('\n').slice(-3)) out(` ${l}`)
|
|
463
|
-
if (b.exitCode !== 0) throw new Error(`${argv.join(' ')} failed: nothing written, the asks and the stores are as they were`)
|
|
464
|
-
}
|
|
465
458
|
let bad = 0
|
|
466
459
|
for (const root of roots) {
|
|
467
460
|
const fold = await foldDoneConfirms(root, { go: this.go, ...(process.env.SK_AGENT ? { lane: process.env.SK_AGENT } : {}) })
|
package/src/cli/cmd_Backup.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
// sk backup: the
|
|
2
|
-
// tools/shipkit/media-store-backup.md):
|
|
1
|
+
// sk backup: the old runs of the retired backup of untracked project files (media-store/backup/, wiki
|
|
2
|
+
// tools/shipkit/media-store-backup.md): no new run, no prune; the runs, a restore, the drill, an undelete.
|
|
3
3
|
// Every module loads inside execute: the cli registers this file on every `sk` call
|
|
4
4
|
import { Command, Option } from './clip.ts'
|
|
5
5
|
import { bytesWords } from '../core/words.ts'
|
|
6
6
|
import { BackupStatusCommand, BackupTargetsCommand } from './cmd_BackupTargets.ts'
|
|
7
7
|
|
|
8
|
-
const DETAILS = `the
|
|
8
|
+
const DETAILS = `the runs made before the backup of untracked project files retired: each one under backup/runs/ in the owner's private Space, its parts under backup/parts/, its files under backup/<sha256>. No new run is made and nothing prunes them, so every run stays readable and restorable. Page: wiki tools/shipkit/media-store-backup.md`
|
|
9
9
|
|
|
10
10
|
type Ctx = { stdout: NodeJS.WritableStream; stderr: NodeJS.WritableStream }
|
|
11
11
|
|
|
@@ -39,48 +39,20 @@ async function run(context: Ctx, body: (h: Here) => Promise<number>): Promise<nu
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
|
|
42
|
+
/** why no new run is made: each precious thing has its own store, and a check names what has none */
|
|
43
|
+
export const RETIRED_WORDS = 'the backup of untracked project files is retired: a precious file belongs in git, the hq, the Space (sk media put) or the vault, and the house check RV049 (sk check) names each untracked file that looks precious and where it belongs. The old runs stay in the Space: sk backup runs, sk backup restore'
|
|
44
|
+
|
|
42
45
|
export class BackupCommand extends Command {
|
|
43
46
|
static override paths = [['backup']]
|
|
44
47
|
static override usage = Command.Usage({
|
|
45
48
|
category: 'Media',
|
|
46
|
-
description: '
|
|
47
|
-
details: `${
|
|
48
|
-
examples: [['
|
|
49
|
+
description: 'retired: no new run; the old runs stay readable (runs, restore, drill)',
|
|
50
|
+
details: `${RETIRED_WORDS}. Page: wiki tools/shipkit/media-store-backup.md`,
|
|
51
|
+
examples: [['the old runs', 'sk backup runs'], ['what looks precious and has no copy', 'sk check RV049']],
|
|
49
52
|
})
|
|
50
|
-
check = Option.Boolean('--check', false, { description: 'send nothing: what is not backed up yet, exit 1 when something waits' })
|
|
51
53
|
async execute(): Promise<number> {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const { backupRepos } = await import('../media-store/backup/sources.ts')
|
|
55
|
-
const { FOREIGN_WHY } = await import('../core/foreign.ts')
|
|
56
|
-
const { relative } = await import('node:path')
|
|
57
|
-
for (const r of backupRepos(h.repos).left) h.out(`left out ~/${relative(h.home, r)}: its files and memories: ${FOREIGN_WHY}`)
|
|
58
|
-
const refusedLines = (list: { path: string; why: string }[]): void => {
|
|
59
|
-
for (const r of list) h.out(` refused ~/${r.path}: ${r.why}`)
|
|
60
|
-
}
|
|
61
|
-
if (this.check) {
|
|
62
|
-
// a look only: the local files as the daemon's looks keep them, never each repo's git walk again
|
|
63
|
-
const { keptLocals } = await import('../media-store/backup/daemon.ts')
|
|
64
|
-
const c = await backupCheck(h.space, { home: h.home, repos: h.repos, locals: keptLocals() })
|
|
65
|
-
h.out(`${c.files} files read; the last run: ${c.last ? `${c.last.at} (${c.last.key})` : 'none'}`)
|
|
66
|
-
h.out(`${c.waiting.length} not in the Space yet (${bytesWords(c.waiting.reduce((n, w) => n + w.size, 0))}), ${c.changed.length} changed since the last run, ${c.refused.length} refused`)
|
|
67
|
-
for (const w of c.waiting.slice(0, 40)) h.out(` waiting ~/${w.path}`)
|
|
68
|
-
if (c.waiting.length > 40) h.out(` … ${c.waiting.length - 40} more`)
|
|
69
|
-
refusedLines(c.refused)
|
|
70
|
-
return c.waiting.length > 0 || c.changed.length > 0 ? 1 : 0
|
|
71
|
-
}
|
|
72
|
-
const t0 = Date.now()
|
|
73
|
-
const r = await backupRun(h.space, { home: h.home, repos: h.repos })
|
|
74
|
-
h.out(`${r.files} files (${bytesWords(r.bytes)}): ${r.sent} objects up (${bytesWords(r.sentBytes)}), ${r.there} already there, ${r.refused.length} refused, in ${((Date.now() - t0) / 1000).toFixed(1)} s`)
|
|
75
|
-
refusedLines(r.refused)
|
|
76
|
-
for (const f of r.failed.slice(0, 5)) h.err(`FAIL: ${f.key}: ${f.error}`)
|
|
77
|
-
if (r.failed.length > 0) {
|
|
78
|
-
h.err(`FAIL: ${r.failed.length} objects did not go up: no manifest written, the next run tries again`)
|
|
79
|
-
return 1
|
|
80
|
-
}
|
|
81
|
-
h.out(r.manifest ? `run ${r.manifest}: ${r.record.partsSent} of ${r.record.parts} parts written (${(r.record.partsBytes / 1e3).toFixed(1)} kB), the run ${(r.record.runBytes / 1e3).toFixed(1)} kB` : `unchanged since ${r.last?.at} (${r.last?.key}): nothing written`)
|
|
82
|
-
return 0
|
|
83
|
-
})
|
|
54
|
+
this.context.stderr.write(`FAIL: backup: ${RETIRED_WORDS}\n`)
|
|
55
|
+
return 1
|
|
84
56
|
}
|
|
85
57
|
}
|
|
86
58
|
|
|
@@ -92,24 +64,20 @@ export class BackupRunsCommand extends Command {
|
|
|
92
64
|
static override usage = Command.Usage({
|
|
93
65
|
category: 'Media',
|
|
94
66
|
description: 'the backup runs in the Space, newest first: the count per machine, then time, machine and key',
|
|
95
|
-
details: `${DETAILS}\n\nThe first line counts the runs per machine; the newest ${RUNS_SHOWN} follow, newest first
|
|
67
|
+
details: `${DETAILS}\n\nThe first line counts the runs per machine; the newest ${RUNS_SHOWN} follow, newest first. --all lists every run, oldest first.`,
|
|
96
68
|
examples: [['the latest runs', 'sk backup runs'], ['every run', 'sk backup runs --all']],
|
|
97
69
|
})
|
|
98
70
|
all = Option.Boolean('--all', false, { description: 'every run, oldest first' })
|
|
99
71
|
async execute(): Promise<number> {
|
|
100
72
|
return run(this.context, async (h) => {
|
|
101
|
-
const {
|
|
102
|
-
const
|
|
103
|
-
const
|
|
104
|
-
const
|
|
105
|
-
const rows = policy ? await runSlots(h.space, { policy, now: Date.now(), pinned: [...pins.keys()], pinLabel: (k) => pins.get(k) }) : (await runsOf(h.space)).map((r) => ({ run: r, host: r.machine, slots: null }))
|
|
73
|
+
const { runsOf, hostsOfRuns } = await import('../media-store/backup/manifest.ts')
|
|
74
|
+
const runs = await runsOf(h.space)
|
|
75
|
+
const hosts = await hostsOfRuns(h.space, runs)
|
|
76
|
+
const hostOf = (key: string): string => hosts.get(key) ?? '(host unread)'
|
|
106
77
|
const per = new Map<string, number>()
|
|
107
|
-
for (const r of
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if (!policy) h.out(`note: ${why}`)
|
|
111
|
-
const slotText = (s: string[] | null): string => (s == null ? '' : ` ${s.length ? s.join(', ') : 'goes at the next prune'}`)
|
|
112
|
-
for (const r of this.all ? rows : rows.slice(-RUNS_SHOWN).reverse()) h.out(`${r.run.at.toISOString()} ${r.host ?? '(host unread)'} ${r.run.key} ${(r.run.size / 1e3).toFixed(0)} kB${slotText(r.slots)}`)
|
|
78
|
+
for (const r of runs) per.set(hostOf(r.key), (per.get(hostOf(r.key)) ?? 0) + 1)
|
|
79
|
+
h.out(`${runs.length} runs: ${[...per].map(([m, n]) => `${n} of ${m}`).join(', ')}${!this.all && runs.length > RUNS_SHOWN ? `; the newest ${RUNS_SHOWN} below, --all for every one` : ''}`)
|
|
80
|
+
for (const r of this.all ? runs : runs.slice(-RUNS_SHOWN).reverse()) h.out(`${r.at.toISOString()} ${hostOf(r.key)} ${r.key} ${(r.size / 1e3).toFixed(0)} kB`)
|
|
113
81
|
return 0
|
|
114
82
|
})
|
|
115
83
|
}
|
|
@@ -119,8 +87,8 @@ export class BackupUndeleteCommand extends Command {
|
|
|
119
87
|
static override paths = [['backup', 'undelete']]
|
|
120
88
|
static override usage = Command.Usage({
|
|
121
89
|
category: 'Media',
|
|
122
|
-
description: 'a prune undone
|
|
123
|
-
details: `${DETAILS}\n\nA prune
|
|
90
|
+
description: 'a past prune undone: these keys, or every delete since a time, back',
|
|
91
|
+
details: `${DETAILS}\n\nA past prune deleted with a delete marker, and the bucket keeps the versions behind it: nothing empties that trash now. This removes the markers, so each object is back as it was. Name the keys (runs, parts, bytes under backup/), or --since a time to undo every delete since then. Undo a whole apply with --since its start, then run sk backup drill.`,
|
|
124
92
|
examples: [['undo an apply', 'sk backup undelete --since 2026-11-20T18:40Z'], ['one run back', 'sk backup undelete backup/runs/20261110T120000Z-laptop-0123456789ab.json.gz']],
|
|
125
93
|
})
|
|
126
94
|
since = Option.String('--since', { description: 'every key deleted at or after this time: 2026-11-20T18:40Z or 20261120T184000Z' })
|
|
@@ -140,61 +108,6 @@ export class BackupUndeleteCommand extends Command {
|
|
|
140
108
|
}
|
|
141
109
|
}
|
|
142
110
|
|
|
143
|
-
export class BackupPinCommand extends Command {
|
|
144
|
-
static override paths = [['backup', 'pin']]
|
|
145
|
-
static override usage = Command.Usage({
|
|
146
|
-
category: 'Media',
|
|
147
|
-
description: 'a backup run kept past its retention slots for some days: the one taken before a migration',
|
|
148
|
-
details: `${DETAILS}\n\nThe run is this machine's last one unless --run names another. The pin lives in the machine db; the prune keeps the run while it holds. With no flag beyond --list, the pins that hold.`,
|
|
149
|
-
examples: [['keep the last run 30 days', "sk backup pin --why 'before the social posts migration'"], ['the pins that hold', 'sk backup pin --list']],
|
|
150
|
-
})
|
|
151
|
-
key = Option.String('--run', { description: 'the run key, as sk backup runs prints it: this machine\'s last run when absent' })
|
|
152
|
-
days = Option.String('--days', '30', { description: 'how many days the pin holds' })
|
|
153
|
-
why = Option.String('--why', '', { description: 'why it is kept, shown beside the run in sk backup runs' })
|
|
154
|
-
list = Option.Boolean('--list', false, { description: 'the pins that hold, nothing pinned' })
|
|
155
|
-
async execute(): Promise<number> {
|
|
156
|
-
const { backupPins, pinRun } = await import('../media-store/backup/prune.ts')
|
|
157
|
-
const { lastRun } = await import('../media-store/backup/run.ts')
|
|
158
|
-
try {
|
|
159
|
-
if (this.list) {
|
|
160
|
-
for (const p of backupPins()) this.context.stdout.write(`${p.key} till ${new Date(p.until).toISOString()} ${p.why}\n`)
|
|
161
|
-
return 0
|
|
162
|
-
}
|
|
163
|
-
const key = this.key ?? lastRun()?.key
|
|
164
|
-
if (!key) throw new Error('this machine wrote no run yet: sk backup first')
|
|
165
|
-
const days = Number(this.days)
|
|
166
|
-
if (!Number.isFinite(days) || days <= 0) throw new Error(`--days ${this.days}: a number of days over 0`)
|
|
167
|
-
const p = pinRun(key, days, this.why || 'pinned by hand')
|
|
168
|
-
this.context.stdout.write(`ok: ${p.key} kept till ${new Date(p.until).toISOString()}: ${p.why}\n`)
|
|
169
|
-
return 0
|
|
170
|
-
} catch (e) {
|
|
171
|
-
this.context.stderr.write(`FAIL: backup pin: ${(e as Error).message}\n`)
|
|
172
|
-
return 1
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
export class BackupPruneCommand extends Command {
|
|
178
|
-
static override paths = [['backup', 'prune']]
|
|
179
|
-
static override usage = Command.Usage({
|
|
180
|
-
category: 'Media',
|
|
181
|
-
description: "this machine's runs no retention slot keeps, and the objects only they name: dry run unless --apply",
|
|
182
|
-
details: `${DETAILS}\n\nThe policy is the house config's serve.backupRetention: every run of the last allHours, then the newest of each of the last days calendar days, weeks ISO weeks and months months (UTC), a slot with no run keeping the next older one. The newest run and every pinned run (sk backup pin) always stay. A machine prunes only its own runs. An object goes only when no run that stays names it, no run of another machine names it, and it is over 48 h old; each goes with every version, its index row first. Without --apply it prints what would go. The daemon prunes after each run, at most 200 runs at a time.`,
|
|
183
|
-
examples: [['what the retention would delete', 'sk backup prune'], ['delete it', 'sk backup prune --apply']],
|
|
184
|
-
})
|
|
185
|
-
apply = Option.Boolean('--apply', false, { description: 'delete: without it, only print what would go' })
|
|
186
|
-
async execute(): Promise<number> {
|
|
187
|
-
return run(this.context, async (h) => {
|
|
188
|
-
const { pruneBackups } = await import('../media-store/backup/prune.ts')
|
|
189
|
-
const t0 = Date.now()
|
|
190
|
-
const p = await pruneBackups(h.space, { apply: this.apply })
|
|
191
|
-
for (const l of p.lines) (l.startsWith('WARN') ? h.err : h.out)(l)
|
|
192
|
-
h.out(`in ${((Date.now() - t0) / 1000).toFixed(1)} s`)
|
|
193
|
-
return p.result != null && p.result.failed.length > 0 ? 1 : 0
|
|
194
|
-
})
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
111
|
export class BackupRestoreCommand extends Command {
|
|
199
112
|
static override paths = [['backup', 'restore']]
|
|
200
113
|
static override usage = Command.Usage({
|
|
@@ -206,7 +119,7 @@ export class BackupRestoreCommand extends Command {
|
|
|
206
119
|
to = Option.String('--to', { description: 'an empty or new folder the files land under' })
|
|
207
120
|
inPlace = Option.Boolean('--in-place', false, { description: 'over the live files, each one replaced copied aside first' })
|
|
208
121
|
at = Option.String('--at', { description: 'the last run at or before this time: 2026-11-04T13:50Z, 2026-11-04 or 20261104T135000Z' })
|
|
209
|
-
under = Option.String('--path', { description: 'only the files under this path of the home: .shipkit/home/veille (a run made before
|
|
122
|
+
under = Option.String('--path', { description: 'only the files under this path of the home: .shipkit/home/veille (a run made before the one root names it .config/shipkit/home/veille: either form matches)' })
|
|
210
123
|
host = Option.String('--host', { description: "another Mac's runs, by the name `sk backup runs` prints: this Mac's when absent" })
|
|
211
124
|
async execute(): Promise<number> {
|
|
212
125
|
return run(this.context, async (h) => {
|
|
@@ -228,32 +141,17 @@ export class BackupDrillCommand extends Command {
|
|
|
228
141
|
category: 'Media',
|
|
229
142
|
description: 'a backup run restored into a scratch folder, every sha compared with the live files',
|
|
230
143
|
details: `${DETAILS}\n\n--at drills an older run (a run of the first version, one manifest, reads too). A file the live machine changed since the run counts apart (the next run takes it), and so does one gone from the disk; a sqlite compares its rows per table. Exit 1 when a file did not come back with its sha. The scratch folder is removed unless --to names one.`,
|
|
231
|
-
examples: [['the drill', 'sk backup drill'], ['an older run', 'sk backup drill --at 20261104T130646Z']
|
|
144
|
+
examples: [['the drill', 'sk backup drill'], ['an older run', 'sk backup drill --at 20261104T130646Z']],
|
|
232
145
|
})
|
|
233
146
|
to = Option.String('--to', { description: 'restore into this empty or new folder, and keep it' })
|
|
234
147
|
at = Option.String('--at', { description: 'the last run at or before this time, an older run: 2026-11-04T13:50Z or 20261104T135000Z' })
|
|
235
148
|
host = Option.String('--host', { description: "another Mac's runs, by the name `sk backup runs` prints: this Mac's when absent" })
|
|
236
|
-
target = Option.String('--target', { description: 'an ssh target of sk backup targets: its mirror read in place of the Space' })
|
|
237
149
|
async execute(): Promise<number> {
|
|
238
150
|
return run(this.context, async (h) => {
|
|
239
151
|
const { drill } = await import('../media-store/backup/restore.ts')
|
|
240
152
|
const { parseAt } = await import('../media-store/backup/keys.ts')
|
|
241
153
|
const t0 = Date.now()
|
|
242
|
-
|
|
243
|
-
let recordAs: string | undefined
|
|
244
|
-
if (this.target != null) {
|
|
245
|
-
const { askHqAdmin } = await import('../hq/hq-local.ts')
|
|
246
|
-
const { sshSpace } = await import('../media-store/backup/ssh-space.ts')
|
|
247
|
-
const { machineName } = await import('../home/machine-host.ts')
|
|
248
|
-
const r = await askHqAdmin<{ targets: import('../hq/backup-targets.ts').BackupTarget[] }>('/api/home/hq/targets')
|
|
249
|
-
if ('refused' in r) throw new Error(r.refused)
|
|
250
|
-
const t = r.targets.find((x) => x.id === this.target)
|
|
251
|
-
if (t == null || t.address.kind !== 'ssh') throw new Error(`${this.target}: no ssh target of that id (sk backup targets)`)
|
|
252
|
-
space = sshSpace({ peer: t.address.host, folder: t.address.folder, machine: machineName() })
|
|
253
|
-
recordAs = `target-drill:files:${t.id}`
|
|
254
|
-
h.out(`from ${space.where}`)
|
|
255
|
-
}
|
|
256
|
-
const d = await drill(space, { ...(recordAs == null ? {} : { recordAs }), home: h.home, ...(this.to !== undefined ? { to: this.to } : {}), ...(this.at ? { at: parseAt(this.at) } : {}), ...(this.host ? { machine: this.host } : {}) })
|
|
154
|
+
const d = await drill(h.space, { home: h.home, ...(this.to !== undefined ? { to: this.to } : {}), ...(this.at ? { at: parseAt(this.at) } : {}), ...(this.host ? { machine: this.host } : {}) })
|
|
257
155
|
h.out(`run ${d.at} (${d.run}, version ${d.v}): ${d.files} files (${bytesWords(d.bytes)}), ${d.restored} restored with their sha, in ${((Date.now() - t0) / 1000).toFixed(1)} s`)
|
|
258
156
|
h.out(`against the live files: ${d.sameAsLive} the same, ${d.liveMoved.length} moved since the run, ${d.liveGone.length} gone from the disk, ${d.failed.length} failed`)
|
|
259
157
|
for (const s of d.sqlite) h.out(` sqlite ~/${s.path}: restored ${JSON.stringify(s.restored)}, live now ${JSON.stringify(s.live)}`)
|
|
@@ -265,4 +163,4 @@ export class BackupDrillCommand extends Command {
|
|
|
265
163
|
}
|
|
266
164
|
}
|
|
267
165
|
|
|
268
|
-
export const BACKUP_COMMANDS = [BackupCommand, BackupRunsCommand,
|
|
166
|
+
export const BACKUP_COMMANDS = [BackupCommand, BackupRunsCommand, BackupUndeleteCommand, BackupRestoreCommand, BackupDrillCommand, BackupStatusCommand, BackupTargetsCommand]
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// records. Every module loads inside execute: the cli registers this file on every `sk` call
|
|
4
4
|
import { Command, Option } from './clip.ts'
|
|
5
5
|
|
|
6
|
-
const STATUS_DETAILS = `one row a store
|
|
6
|
+
const STATUS_DETAILS = `one row a store (the vault, the hq, the Space; the untracked project files are no row since their backup retired), one line a place: its own disk, Time Machine, and every target of sk backup targets. Each line says its newest copy and its last proof, read from what the senders and the drills kept (no network). The table is judged on the machine that carries the hq, from its records; on a client this command reads it from the hq, so every machine prints the same table, stale (never green, never red) while the hq does not answer. The vault or the hq with no working copy off its machine is red, the Space with no second copy orange; so is a copy past its bound or a drill that failed; a cell not proven keeps the headline from green. The same table is the « backups » entry of the hub's database page, and any red puts a red band on every hub page. Exit 1 on any red. Page: wiki tools/shipkit/media-store-backup.md, The status`
|
|
7
7
|
|
|
8
8
|
const MARK = { ok: 'ok ', warn: 'WARN', danger: 'RED ', dim: ' ' } as const
|
|
9
9
|
|
package/src/cli/cmd_Checks.ts
CHANGED
|
@@ -93,17 +93,3 @@ export class ChecksCommand extends Command {
|
|
|
93
93
|
return 0
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
|
|
97
|
-
/** `shipkit units`, the name 0.38 shipped for this inventory. Hidden from the
|
|
98
|
-
* help and the command index, it answers the same table with one WARN on
|
|
99
|
-
* stderr, so a `--json` consumer still parses stdout. It dies with the rest
|
|
100
|
-
* of the compatibility window at 0.40. */
|
|
101
|
-
export class UnitsAliasCommand extends ChecksCommand {
|
|
102
|
-
static override paths = [['units']]
|
|
103
|
-
static override usage = undefined
|
|
104
|
-
|
|
105
|
-
override async execute(): Promise<number> {
|
|
106
|
-
this.context.stderr.write('WARN shipkit units is now shipkit checks, the old name goes at 0.40\n')
|
|
107
|
-
return await super.execute()
|
|
108
|
-
}
|
|
109
|
-
}
|
package/src/cli/cmd_Db.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
// sk db: every database of this machine, its size on disk, its cap, its copies, and each table's rows and bytes, the
|
|
2
2
|
// words of the home's database page. Report only: every file is opened read only, never a row's content
|
|
3
3
|
import { Command, Option } from './clip.ts'
|
|
4
|
-
import { StoreRefused, WAIT_EXIT } from '../core/machine-db.ts'
|
|
5
|
-
import { bytesWords } from '../core/words.ts'
|
|
6
4
|
|
|
7
5
|
export class DbCommand extends Command {
|
|
8
6
|
static override paths = [['db']]
|
|
@@ -10,7 +8,7 @@ export class DbCommand extends Command {
|
|
|
10
8
|
static override usage = Command.Usage({
|
|
11
9
|
category: 'Health',
|
|
12
10
|
description: 'every database of this machine: its size on disk, its cap, each table with its rows and bytes',
|
|
13
|
-
details: "The total first, how much of it is the truth, caches that build again and this machine's own state, then each house repo's share of every database (by project; a project's bytes in a shared table are an estimate, and what names no repo is said apart). Then the hq, with its versions, its feed, its replica, its last restore drill and each node's rows of each kind against its share, then the daemon's database, the machine db (its own state, and the media index and the agent time index as its media_ and time_ tables, each part with its tables) and each house repo's run record, the biggest first.
|
|
11
|
+
details: "The total first, how much of it is the truth, caches that build again and this machine's own state, then each house repo's share of every database (by project; a project's bytes in a shared table are an estimate, and what names no repo is said apart). Then the hq, with its versions, its feed, its replica, its last restore drill and each node's rows of each kind against its share, then the daemon's database, the machine db (its own state, and the media index and the agent time index as its media_ and time_ tables, each part with its tables) and each house repo's run record, the biggest first. Sizes and pages are read at each call; the rows and bytes of each table are those the daemon's job `db census` counted, with their age, since a count of the big files takes seconds. `--fresh` counts every file now, in this process. Every file is opened read only and none is made.",
|
|
14
12
|
examples: [
|
|
15
13
|
['every database', 'sk db'],
|
|
16
14
|
['the hq alone', 'sk db hq'],
|
|
@@ -61,14 +59,6 @@ export class DbCommand extends Command {
|
|
|
61
59
|
return 0
|
|
62
60
|
}
|
|
63
61
|
this.context.stdout.write(`${databaseLines(shown, now).join('\n')}\n`)
|
|
64
|
-
if (want == null) {
|
|
65
|
-
const { foldWords } = await import('../home/machine-fold.ts')
|
|
66
|
-
try {
|
|
67
|
-
this.context.stdout.write(`${foldWords().join('\n')}\n`)
|
|
68
|
-
} catch (e) {
|
|
69
|
-
this.context.stdout.write(`WARN the fold's state does not read: ${(e as Error).message}\n`)
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
62
|
return 0
|
|
73
63
|
}
|
|
74
64
|
}
|
|
@@ -92,7 +82,7 @@ export class DbThreadsCommand extends Command {
|
|
|
92
82
|
|
|
93
83
|
async execute(): Promise<number> {
|
|
94
84
|
const { HQ_THREADS, threadsWhere } = await import('../review/item-hq.ts')
|
|
95
|
-
const { threadsLine } = await import('../hq/
|
|
85
|
+
const { threadsLine } = await import('../hq/threads-words.ts')
|
|
96
86
|
if (this.to != null) {
|
|
97
87
|
if (this.to !== 'on' && this.to !== 'off') {
|
|
98
88
|
this.context.stderr.write(`FAIL: on or off, not ${JSON.stringify(this.to).slice(0, 40)}\n`)
|
|
@@ -115,75 +105,6 @@ export class DbThreadsCommand extends Command {
|
|
|
115
105
|
}
|
|
116
106
|
}
|
|
117
107
|
|
|
118
|
-
/** sk db fold: the media index, the agent time index and the daemon's file into the machine db, the machine's one
|
|
119
|
-
* local file */
|
|
120
|
-
export class DbFoldCommand extends Command {
|
|
121
|
-
static override paths = [['db', 'fold']]
|
|
122
|
-
|
|
123
|
-
static override usage = Command.Usage({
|
|
124
|
-
category: 'Health',
|
|
125
|
-
description: "the media and agent time indexes and the daemon's file into the machine db (dry run first)",
|
|
126
|
-
details: "Says what it would do: each store still in a file of its own, its size, where its whole copy goes (`<file>.before-fold`, the way back) and the room it needs. With `--go`, per store: the copy, its rows copied into the machine db's `media_` or `time_` tables (the daemon's file: its tables under their own names) in steps of a few ms, every table counted on both sides (a difference drops the new tables and keeps the file), then the old file replaced by a text tombstone that code before the fold refuses to open. A fold by hand turns the daemon's fold on (the switch db-fold-auto). `--back --go` (with the home down: `sk pm uninstall`) writes every row of the tables, those added since the fold too, into a file of the old shape that replaces each tombstone, then drops the tables and turns the daemon's fold off: each store is then read and written in its own file, for as long as the owner wants, with no other code. On a machine never folded it gives each file the tables this code reads. A fold or a way back killed at any step is ended by the next run of either.",
|
|
127
|
-
examples: [
|
|
128
|
-
['what the fold would do', 'sk db fold'],
|
|
129
|
-
['fold', 'sk db fold --go'],
|
|
130
|
-
['the way back', 'sk db fold --back --go'],
|
|
131
|
-
['the copies kept for the way back, deleted once sure', 'sk db fold --rm-copies --go'],
|
|
132
|
-
],
|
|
133
|
-
})
|
|
134
|
-
|
|
135
|
-
go = Option.Boolean('--go', false, { description: 'do it; without it, say what it would do' })
|
|
136
|
-
back = Option.Boolean('--back', false, { description: 'put each store back in its own file from its copy' })
|
|
137
|
-
noticeDone = Option.String('--notice-done', { required: false, description: "the check of the fold's notice: exits 0 on the machine of that key once its copies are gone" })
|
|
138
|
-
rmCopies = Option.Boolean('--rm-copies', false, { description: 'the copies a fold kept for the way back: says which, --go deletes them' })
|
|
139
|
-
|
|
140
|
-
async execute(): Promise<number> {
|
|
141
|
-
const { fold, foldPlan, foldWords, rmCopies, unfold } = await import('../home/machine-fold.ts')
|
|
142
|
-
if (this.noticeDone != null) {
|
|
143
|
-
const { noticeDone, shortKey } = await import('../home/machine-fold.ts')
|
|
144
|
-
if (noticeDone(this.noticeDone)) return 0
|
|
145
|
-
this.context.stderr.write(this.noticeDone === shortKey() ? 'the copies of the old files are still here: sk db fold --rm-copies\n' : `this is machine ${shortKey()}, the notice is machine ${this.noticeDone}'s: its check runs there\n`)
|
|
146
|
-
return 1
|
|
147
|
-
}
|
|
148
|
-
if (this.rmCopies) {
|
|
149
|
-
rmCopies({ go: this.go, print: (l) => void this.context.stdout.write(`${l}\n`) })
|
|
150
|
-
return 0
|
|
151
|
-
}
|
|
152
|
-
const { machineDbPath } = await import('../core/machine-db.ts')
|
|
153
|
-
const print = (l: string): void => void this.context.stdout.write(`${l}\n`)
|
|
154
|
-
const plan = foldPlan()
|
|
155
|
-
const { oldDamage } = await import('../home/machine-fold.ts')
|
|
156
|
-
print(`this machine's key: ${(await import('../home/machine-fold.ts')).shortKey()}`)
|
|
157
|
-
for (const s of plan.states) {
|
|
158
|
-
const hurt = !this.back && s.state === 'own file' ? oldDamage(s.old) : null
|
|
159
|
-
print(`${s.store}: ${s.state === 'own file' ? `its own file ${s.old}, ${bytesWords(s.bytes)}${hurt == null ? '' : `, DAMAGED (${hurt}): the fold leaves it as it is`}` : s.state === 'folded' ? `folded into ${machineDbPath()}${s.copy == null ? '' : `, its copy ${s.copy.path} ${bytesWords(s.copy.bytes)}`}` : s.state === 'half' ? `a ${s.mark?.way === 'back' ? 'way back' : 'fold'} stopped half way: sk db fold ${s.mark?.way === 'back' ? '--back ' : ''}--go ends it` : 'no file'}`)
|
|
160
|
-
}
|
|
161
|
-
if (!this.go) {
|
|
162
|
-
for (const l of foldWords().slice(0, 1)) print(l)
|
|
163
|
-
if (this.back) print(`dry run: --back --go puts back ${plan.states.filter((s) => s.state === 'folded' && s.copy != null).map((s) => s.store).join(' and ') || 'nothing'}`)
|
|
164
|
-
else print(`dry run: --go folds ${plan.states.filter((s) => s.state === 'own file' || s.state === 'half').map((s) => s.store).join(' and ') || 'nothing'} into ${machineDbPath()}; it needs ${bytesWords(plan.need)}, the disk has ${bytesWords(plan.free)} free`)
|
|
165
|
-
return 0
|
|
166
|
-
}
|
|
167
|
-
try {
|
|
168
|
-
// the daemon keeps the media index open: a write it makes to the tables after their rows went back is lost
|
|
169
|
-
if (this.back && (await (await import('../home/home-paths.ts')).pmUp())) {
|
|
170
|
-
this.context.stderr.write('FAIL: the way back needs the home down, its daemon holds the media index and its own file open: sk pm uninstall, then sk db fold --back --go, then sk pm install\n')
|
|
171
|
-
return 1
|
|
172
|
-
}
|
|
173
|
-
if (this.back) await unfold({ print })
|
|
174
|
-
else {
|
|
175
|
-
const done = await fold({ print, byHand: true })
|
|
176
|
-
for (const d of done) print(`${d.store}: ${d.done ? `folded in ${(d.ms / 1000).toFixed(1)} s, the longest step ${d.heldMs} ms` : d.why}`)
|
|
177
|
-
if (done.some((d) => d.why.startsWith('damaged'))) return 1
|
|
178
|
-
}
|
|
179
|
-
return 0
|
|
180
|
-
} catch (e) {
|
|
181
|
-
this.context.stderr.write(`FAIL: ${(e as Error).message}\n`)
|
|
182
|
-
return e instanceof StoreRefused && e.wait ? WAIT_EXIT : 1
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
108
|
/** sk db drop: a cache part of the machine db dropped and made again empty */
|
|
188
109
|
export class DbDropCommand extends Command {
|
|
189
110
|
static override paths = [['db', 'drop']]
|
|
@@ -227,7 +148,7 @@ export class DbRepairCommand extends Command {
|
|
|
227
148
|
static override usage = Command.Usage({
|
|
228
149
|
category: 'Health',
|
|
229
150
|
description: 'the damaged tables of a part of the machine db repaired: every row that reads is kept',
|
|
230
|
-
details: "The part is `media`, `time` or `daemon`. It takes the tables sqlite's check finds damaged, a table or one of its indexes, and says first, for each, how many rows read and how many are lost (counted through an index that reads). `--go` saves every row that reads aside in steps (by rowid ranges, read around a damaged page), cuts the table out of the schema with the system's sqlite shell (a DROP stops at the damaged page, and bun's sqlite refuses to edit a schema), makes it again with its indexes and fills it again in steps. A damaged index alone loses no row. Killed at any step, it is ended by the next `--go`. The pages of the cut table stay unused until `sk db rebuild --go`.
|
|
151
|
+
details: "The part is `media`, `time` or `daemon`. It takes the tables sqlite's check finds damaged, a table or one of its indexes, and says first, for each, how many rows read and how many are lost (counted through an index that reads). `--go` saves every row that reads aside in steps (by rowid ranges, read around a damaged page), cuts the table out of the schema with the system's sqlite shell (a DROP stops at the damaged page, and bun's sqlite refuses to edit a schema), makes it again with its indexes and fills it again in steps. A damaged index alone loses no row. Killed at any step, it is ended by the next `--go`. The pages of the cut table stay unused until `sk db rebuild --go`. For `daemon`, the items it lost then come back from the hq: the feed is read again from its start, every head and message the hq holds that the store lacks lands, and the last line says how many came back and how many the hq did not hold.",
|
|
231
152
|
examples: [
|
|
232
153
|
['what a repair would keep and lose', 'sk db repair time'],
|
|
233
154
|
['repair', 'sk db repair time --go'],
|