rvlib-shipkit 2.26.0 → 2.28.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 +36 -0
- package/package.json +1 -1
- package/src/agent-time/diet.ts +77 -0
- package/src/agent-time/family.ts +72 -0
- package/src/agent-time/hooks.ts +16 -7
- package/src/agent-time/limits.ts +44 -0
- package/src/agent-time/live.ts +12 -8
- package/src/agent-time/mask.ts +96 -18
- package/src/agent-time/refused.ts +45 -0
- package/src/agent-time/registry.ts +289 -0
- package/src/agent-time/render.ts +122 -21
- package/src/agent-time/report-cache.ts +57 -0
- package/src/agent-time/report.ts +314 -40
- package/src/agent-time/shape.ts +50 -3
- package/src/agent-time/store.ts +322 -101
- package/src/agent-time/timeline.ts +140 -21
- package/src/agent-time/turns.ts +18 -8
- package/src/annex/born.ts +2 -2
- package/src/annex/offload.ts +29 -17
- package/src/annex/tidy.ts +70 -10
- package/src/asks/ask-after.ts +44 -0
- package/src/asks/ask-bar-fold.ts +57 -0
- package/src/asks/ask-migrate.ts +280 -0
- package/src/asks/ask-steps-fold.ts +166 -0
- package/src/asks/ask-store.ts +586 -0
- package/src/assets/kit-config.ts +7 -3
- package/src/assets/kits/identity-kit.ts +361 -14
- package/src/assets/kits/poster-thumbnail.ts +282 -0
- package/src/check.ts +3 -1
- package/src/checks/SK003-claude-md-shape.check.ts +92 -25
- package/src/checks/SK004-gitignore-policy.check.ts +20 -9
- package/src/checks/SK013-one-way-in-policy.check.ts +18 -3
- package/src/checks/SK026-asks-autoclose.check.ts +9 -23
- package/src/checks/SK028-readme.check.ts +7 -66
- package/src/checks/SK030-cache-audit.check.ts +6 -1
- package/src/checks/SK031-trace-audit.check.ts +2 -0
- package/src/checks/SK033-global-contribution.check.ts +3 -1
- package/src/checks/SK035-public-clean.check.ts +2 -2
- package/src/checks/SK038-speaks-as.check.ts +3 -3
- package/src/checks/SK042-post-kinds.check.ts +26 -24
- package/src/checks/SK043-scratch-on-the-mac.check.ts +59 -4
- package/src/checks/SK047-login-in-description.check.ts +36 -0
- package/src/checks/SK048-one-local-file.check.ts +36 -0
- package/src/checks/SK049-thread-answers-hook.check.ts +81 -0
- package/src/checks/SK050-retired-commands.check.ts +127 -0
- package/src/cli/cmd_Asks.ts +244 -27
- package/src/cli/cmd_Backup.ts +153 -10
- package/src/cli/cmd_Calls.ts +1 -0
- package/src/cli/cmd_Capacity.ts +2 -2
- package/src/cli/cmd_Commands.ts +140 -34
- package/src/cli/cmd_Contracts.ts +1 -0
- package/src/cli/cmd_CrossRepoActivity.ts +5 -4
- package/src/cli/cmd_Db.ts +253 -0
- package/src/cli/cmd_History.ts +212 -0
- package/src/cli/cmd_Home.ts +31 -3
- package/src/cli/cmd_Hq.ts +516 -0
- package/src/cli/cmd_Keys.ts +1 -0
- package/src/cli/cmd_Lanes.ts +15 -4
- package/src/cli/cmd_Machines.ts +36 -0
- package/src/cli/cmd_Media.ts +38 -6
- package/src/cli/cmd_Messages.ts +152 -1
- package/src/cli/cmd_Needs.ts +1 -0
- package/src/cli/cmd_Reflect.ts +23 -2
- package/src/cli/cmd_Review.ts +1357 -223
- package/src/cli/cmd_Secret.ts +295 -24
- package/src/cli/cmd_Social.ts +113 -28
- package/src/cli/cmd_SocialDrafts.ts +235 -0
- package/src/cli/cmd_Sound.ts +22 -1
- package/src/cli/cmd_Space.ts +324 -0
- package/src/cli/cmd_Start.ts +3 -2
- package/src/cli/cmd_ThreadHolds.ts +34 -0
- package/src/cli/cmd_ThreadKinds.ts +146 -0
- package/src/cli/cmd_ThreadReflect.ts +83 -0
- package/src/cli/cmd_ThreadSyncNeeds.ts +62 -0
- package/src/cli/cmd_Time.ts +76 -5
- package/src/cli/cmd_Tmp.ts +28 -4
- package/src/cli/cmd_Trailer.ts +14 -10
- package/src/cli/cmd_Urls.ts +56 -0
- package/src/cli/cmd_Vault.ts +583 -0
- package/src/cli/cmd_When.ts +1 -0
- package/src/cli/family-help.ts +5 -3
- package/src/cli/family-pages.ts +1 -1
- package/src/cli/kit/builtins.ts +1 -0
- package/src/cli/kit/verb.ts +6 -2
- package/src/cli/registry.ts +44 -4
- package/src/cli.ts +5 -2
- package/src/collections/actions.ts +42 -41
- package/src/collections/collection-types.ts +30 -4
- package/src/collections/md-body.ts +5 -3
- package/src/collections/pings.ts +13 -6
- package/src/collections/providers.ts +147 -61
- package/src/collections/reflections.ts +9 -4
- package/src/collections/review.ts +4 -4
- package/src/contracts/contract-manifests.ts +6 -5
- package/src/contracts/contract-types.ts +6 -4
- package/src/contracts/contracts-engine.ts +11 -0
- package/src/contracts/manifests/chrome-web-store.contract.ts +31 -0
- package/src/core/budget.ts +12 -17
- package/src/core/capacity.ts +27 -18
- package/src/core/check-runner.ts +7 -4
- package/src/core/discover-checks.ts +18 -3
- package/src/core/git.ts +31 -0
- package/src/core/house-layout.ts +17 -0
- package/src/core/layout.ts +13 -5
- package/src/core/locked-write.ts +4 -1
- package/src/core/machine-busy.ts +127 -0
- package/src/core/machine-commit.ts +6 -1
- package/src/core/machine-db.ts +370 -20
- package/src/core/machine-layout.ts +137 -0
- package/src/core/machine-read.ts +81 -0
- package/src/core/migrate-layout.ts +9 -11
- package/src/core/one-way-in-policy.ts +64 -7
- package/src/core/polling-policy.ts +27 -0
- package/src/core/retention.ts +16 -2
- package/src/core/scope.ts +107 -14
- package/src/core/slots.ts +5 -4
- package/src/drill/clean.ts +25 -1
- package/src/drill/run.ts +1 -1
- package/src/drill/seal.ts +27 -4
- package/src/home/activity-shape.ts +2 -0
- package/src/home/activity.ts +59 -3
- package/src/home/app-sign.ts +15 -4
- package/src/home/daemon-jobs.ts +161 -7
- package/src/home/database-projects.ts +111 -0
- package/src/home/database-words.ts +203 -0
- package/src/home/databases.ts +460 -0
- package/src/home/global-units.ts +6 -0
- package/src/home/gui-app/ShipkitGui.swift +122 -1
- package/src/home/gui-app.ts +6 -3
- package/src/home/home-move.ts +514 -0
- package/src/home/home-paths.ts +18 -6
- package/src/home/home-routes.ts +76 -0
- package/src/home/inbox-shape.ts +234 -91
- package/src/home/inbox.ts +26 -71
- package/src/home/machine-fold.ts +815 -0
- package/src/home/machine-host.ts +38 -5
- package/src/home/machine-repair.ts +503 -0
- package/src/home/machine-stores.ts +66 -15
- package/src/home/machine-temp.ts +547 -86
- package/src/home/other-macs.ts +2 -2
- package/src/home/resume.ts +79 -0
- package/src/home/run-daemon.ts +25 -4
- package/src/home/run-pm.ts +18 -5
- package/src/home/serve-daemon.ts +18 -3
- package/src/home/serve-web.ts +179 -10
- package/src/home/space-job.ts +115 -0
- package/src/home/space-page.ts +257 -0
- package/src/home/space-route.ts +167 -0
- package/src/home/space-words.ts +103 -0
- package/src/home/time-page-shape.ts +202 -0
- package/src/home/time-page.ts +64 -0
- package/src/home/vault-page.ts +516 -0
- package/src/home/vault-words.ts +132 -0
- package/src/hooks/leak-guard.ts +40 -13
- package/src/hooks/one-way-in-guard.ts +41 -6
- package/src/hq/cards.ts +581 -0
- package/src/hq/door-route.ts +43 -0
- package/src/hq/door.ts +163 -0
- package/src/hq/files-send.ts +347 -0
- package/src/hq/forgotten-log.ts +35 -0
- package/src/hq/history-check.ts +255 -0
- package/src/hq/history-place.ts +146 -0
- package/src/hq/history-send.ts +487 -0
- package/src/hq/hq-db.ts +102 -0
- package/src/hq/hq-local.ts +502 -0
- package/src/hq/hq-routes.ts +204 -0
- package/src/hq/hq-store.ts +603 -0
- package/src/hq/kinds/ask.ts +147 -0
- package/src/hq/kinds/card-gone.ts +83 -0
- package/src/hq/kinds/card-msg.ts +66 -0
- package/src/hq/kinds/card.ts +99 -0
- package/src/hq/kinds/index.ts +21 -0
- package/src/hq/kinds/kind.ts +126 -0
- package/src/hq/kinds/media.ts +125 -0
- package/src/hq/kinds/prompt.ts +219 -0
- package/src/hq/kinds/reflection.ts +128 -0
- package/src/hq/kinds/report.ts +55 -0
- package/src/hq/kinds/time-day.ts +236 -0
- package/src/hq/ledger.ts +473 -0
- package/src/hq/machine-key.ts +44 -0
- package/src/hq/machine-notes.ts +131 -0
- package/src/hq/outbox.ts +374 -0
- package/src/hq/replica.ts +167 -0
- package/src/hq/repo-id.ts +4 -0
- package/src/hq/report-facts.ts +117 -0
- package/src/hq/report.ts +274 -0
- package/src/hq/switch.ts +151 -0
- package/src/hq/vault-grant.ts +92 -0
- package/src/hq/vault-route.ts +112 -0
- package/src/identities/collection.ts +2 -2
- package/src/identities/identities.ts +24 -11
- package/src/identities/machine-route.ts +8 -3
- package/src/identities/steps.ts +31 -0
- package/src/ledger/db.ts +81 -27
- package/src/ledger/gate-checks.ts +6 -2
- package/src/ledger/run-log.ts +11 -3
- package/src/ledger/store.ts +26 -4
- package/src/media-store/backup/daemon.ts +73 -25
- package/src/media-store/backup/kept.ts +241 -0
- package/src/media-store/backup/keys.ts +1 -1
- package/src/media-store/backup/manifest.ts +20 -2
- package/src/media-store/backup/prune.ts +365 -0
- package/src/media-store/backup/restore.ts +14 -4
- package/src/media-store/backup/retention.ts +122 -0
- package/src/media-store/backup/run.ts +25 -19
- package/src/media-store/backup/secret.ts +6 -4
- package/src/media-store/backup/snapshot.ts +4 -2
- package/src/media-store/backup/sources.ts +83 -31
- package/src/media-store/backup/thread-copy.ts +340 -0
- package/src/media-store/copy/config.ts +76 -0
- package/src/media-store/copy/copy.ts +194 -0
- package/src/media-store/copy/lifecycle.ts +43 -0
- package/src/media-store/copy/night.ts +90 -0
- package/src/media-store/copy/proof.ts +151 -0
- package/src/media-store/copy/snapshot.ts +152 -0
- package/src/media-store/copy/store.ts +62 -0
- package/src/media-store/copy/stream.ts +176 -0
- package/src/media-store/daemon.ts +66 -16
- package/src/media-store/db.ts +24 -13
- package/src/media-store/forget.ts +141 -3
- package/src/media-store/hand.ts +4 -3
- package/src/media-store/hq-find.ts +75 -0
- package/src/media-store/hq-send.ts +277 -0
- package/src/media-store/kind.ts +2 -0
- package/src/media-store/purge.ts +21 -17
- package/src/media-store/put.ts +24 -8
- package/src/media-store/remote.ts +16 -7
- package/src/media-store/space-listing.ts +256 -0
- package/src/media-store/space.ts +46 -26
- package/src/media-store/sync.ts +5 -5
- package/src/media-store/tidy.ts +98 -0
- package/src/media-store/upload.ts +3 -3
- package/src/media-store/webp.ts +66 -0
- package/src/messages/guard.ts +49 -0
- package/src/messages/model.ts +16 -7
- package/src/messages/objects.ts +201 -0
- package/src/messages/routes.ts +14 -4
- package/src/messages/score.ts +3 -3
- package/src/messages/write.ts +285 -0
- package/src/pages/frame-client.ts +191 -4
- package/src/plan/planner.ts +28 -17
- package/src/recordings/media-kind.ts +1 -0
- package/src/recordings/model.ts +1 -1
- package/src/recordings/recorder-app/Capture.swift +9 -7
- package/src/reflect/hq-corpus.ts +56 -0
- package/src/reflect/prompt-corpus.ts +3 -1
- package/src/reflect/transcript.ts +129 -37
- package/src/reflections/reflections-queue.ts +1 -1
- package/src/release/gate-checkout.ts +2 -1
- package/src/release/git-facts.ts +3 -2
- package/src/release/machine-words.ts +67 -0
- package/src/release/public-clean.ts +11 -5
- package/src/releases/from-card.ts +1 -1
- package/src/releases/routes.ts +10 -5
- package/src/releases/store.ts +10 -1
- package/src/repo-config.ts +71 -19
- package/src/review/anim.ts +3 -3
- package/src/review/answer-kinds.ts +131 -0
- package/src/review/auto.ts +2 -2
- package/src/review/band.ts +53 -0
- package/src/review/branch-hold.ts +84 -0
- package/src/review/card-db.ts +254 -0
- package/src/review/card-rows.ts +267 -0
- package/src/review/cells.ts +360 -57
- package/src/review/close.ts +92 -0
- package/src/review/draft-card.ts +33 -0
- package/src/review/draft-model.ts +78 -0
- package/src/review/events.ts +171 -0
- package/src/review/format.ts +152 -19
- package/src/review/glyphs.ts +63 -0
- package/src/review/gone.ts +98 -0
- package/src/review/holds-sync.ts +62 -0
- package/src/review/holds.ts +85 -0
- package/src/review/house-kind-defs.ts +41 -0
- package/src/review/inbox-hook.ts +23 -10
- package/src/review/inbox-read.ts +201 -0
- package/src/review/instructions.ts +199 -0
- package/src/review/kind-apply.ts +61 -0
- package/src/review/kind-catalog.ts +96 -0
- package/src/review/kinds.ts +278 -0
- package/src/review/lane-ask.ts +109 -0
- package/src/review/marks.ts +1 -1
- package/src/review/media-kind.ts +7 -5
- package/src/review/media-read.ts +9 -7
- package/src/review/media.ts +32 -5
- package/src/review/model.ts +582 -109
- package/src/review/move.ts +491 -0
- package/src/review/need-address.ts +15 -0
- package/src/review/need-threads.ts +93 -0
- package/src/review/notes.ts +12 -20
- package/src/review/object-card.ts +48 -0
- package/src/review/object-read.ts +31 -0
- package/src/review/owner-verdict.ts +36 -0
- package/src/review/parties.ts +182 -0
- package/src/review/previews.ts +18 -20
- package/src/review/project.ts +1 -1
- package/src/review/projections.ts +235 -0
- package/src/review/referring.ts +54 -0
- package/src/review/reflection-object.ts +195 -0
- package/src/review/rev.ts +8 -0
- package/src/review/role.ts +1 -1
- package/src/review/routes.ts +194 -38
- package/src/review/secret-route.ts +80 -0
- package/src/review/snooze.ts +38 -0
- package/src/review/stage-card.ts +12 -8
- package/src/review/stage-routes.ts +1 -1
- package/src/review/store.ts +851 -124
- package/src/review/supersede.ts +116 -0
- package/src/review/take-back.ts +52 -0
- package/src/review/thread-fold.ts +64 -0
- package/src/review/threads.ts +349 -14
- package/src/review/traces.ts +218 -0
- package/src/review/trailer-auto-mock.ts +63 -0
- package/src/review/trailer-card.ts +6 -6
- package/src/review/trailer-desk.ts +41 -7
- package/src/review/trailer-media.ts +1 -0
- package/src/review/trailer-model.ts +8 -0
- package/src/review/trailer-notes.ts +1 -1
- package/src/review/trailer-routes.ts +9 -1
- package/src/review/unit.ts +77 -11
- package/src/review/verdict-items.ts +73 -0
- package/src/review/verdict-write.ts +15 -0
- package/src/review/wait.ts +85 -0
- package/src/review/watchers.ts +23 -10
- package/src/rules/untrack-generated.ts +92 -8
- package/src/scaffold/files/claude-settings-local.json +2 -0
- package/src/secrets/archive-mark.ts +52 -0
- package/src/secrets/archive.ts +83 -0
- package/src/secrets/copy.ts +14 -14
- package/src/secrets/held.ts +16 -0
- package/src/secrets/keychain-write.ts +48 -0
- package/src/secrets/keychain.ts +116 -0
- package/src/secrets/lapse-mark.ts +33 -0
- package/src/secrets/lapse.ts +60 -0
- package/src/secrets/list.ts +21 -17
- package/src/secrets/manager.ts +55 -26
- package/src/secrets/read.ts +385 -0
- package/src/secrets/tail.ts +31 -0
- package/src/secrets/who-reads.ts +49 -0
- package/src/serve/door-forward.ts +268 -0
- package/src/serve/door-names.ts +47 -0
- package/src/serve/embed.ts +1 -1
- package/src/serve/hub-app/activity-view.tsx +56 -32
- package/src/serve/hub-app/activity.css +7 -1
- package/src/serve/hub-app/asks-page.tsx +49 -0
- package/src/serve/hub-app/asks-st.ts +25 -0
- package/src/serve/hub-app/auto-text.tsx +14 -6
- package/src/serve/hub-app/benign-errors.ts +15 -1
- package/src/serve/hub-app/card-head.tsx +49 -0
- package/src/serve/hub-app/check-view.tsx +3 -2
- package/src/serve/hub-app/clock-svc.ts +1 -2
- package/src/serve/hub-app/code-copy.ts +35 -0
- package/src/serve/hub-app/col-card.tsx +72 -30
- package/src/serve/hub-app/col-list-page.tsx +125 -0
- package/src/serve/hub-app/col-list-st.ts +103 -0
- package/src/serve/hub-app/col-tables-view.tsx +17 -45
- package/src/serve/hub-app/col-tables.ts +76 -8
- package/src/serve/hub-app/cols-svc.ts +18 -39
- package/src/serve/hub-app/commands/commands-page.tsx +2 -1
- package/src/serve/hub-app/controls.css +83 -0
- package/src/serve/hub-app/database-st.ts +260 -0
- package/src/serve/hub-app/database-view.tsx +289 -0
- package/src/serve/hub-app/database.css +32 -0
- package/src/serve/hub-app/entry-bar.css +14 -0
- package/src/serve/hub-app/entry-bar.tsx +33 -0
- package/src/serve/hub-app/entry-pick.ts +31 -0
- package/src/serve/hub-app/floating.tsx +1 -0
- package/src/serve/hub-app/frames-st.ts +17 -1
- package/src/serve/hub-app/git-view.tsx +3 -2
- package/src/serve/hub-app/hash-route.ts +11 -1
- package/src/serve/hub-app/header-bar.tsx +14 -18
- package/src/serve/hub-app/home-st.ts +142 -11
- package/src/serve/hub-app/home-strip.css +6 -25
- package/src/serve/hub-app/home-strip.tsx +60 -93
- package/src/serve/hub-app/home.html +10 -0
- package/src/serve/hub-app/house-wiki-view.tsx +20 -0
- package/src/serve/hub-app/hub-app.tsx +71 -166
- package/src/serve/hub-app/hub-types.ts +5 -1
- package/src/serve/hub-app/hub.css +146 -71
- package/src/serve/hub-app/icons.tsx +32 -5
- package/src/serve/hub-app/identities-st.ts +56 -6
- package/src/serve/hub-app/identities-view.tsx +104 -61
- package/src/serve/hub-app/identities.css +17 -15
- package/src/serve/hub-app/identity-address.ts +5 -0
- package/src/serve/hub-app/inbox-st.ts +227 -49
- package/src/serve/hub-app/inbox-view.tsx +204 -120
- package/src/serve/hub-app/inbox.css +47 -47
- package/src/serve/hub-app/index.html +10 -0
- package/src/serve/hub-app/instructions.css +30 -0
- package/src/serve/hub-app/kept-cols.tsx +7 -0
- package/src/serve/hub-app/keys.ts +32 -17
- package/src/serve/hub-app/later.tsx +26 -0
- package/src/serve/hub-app/list-filter.tsx +14 -0
- package/src/serve/hub-app/list-walk.ts +72 -3
- package/src/serve/hub-app/machine-st.ts +2 -2
- package/src/serve/hub-app/machines-st.ts +251 -0
- package/src/serve/hub-app/machines-view.tsx +217 -0
- package/src/serve/hub-app/machines.css +67 -0
- package/src/serve/hub-app/markdown.css +51 -0
- package/src/serve/hub-app/md-copy.tsx +57 -0
- package/src/serve/hub-app/md.ts +25 -9
- package/src/serve/hub-app/media-view.tsx +4 -2
- package/src/serve/hub-app/messages/messages-page.tsx +81 -8
- package/src/serve/hub-app/messages/messages-st.ts +99 -3
- package/src/serve/hub-app/messages.css +14 -1
- package/src/serve/hub-app/objects.css +51 -0
- package/src/serve/hub-app/page-keys.ts +175 -0
- package/src/serve/hub-app/pages-frames.tsx +21 -3
- package/src/serve/hub-app/palette-st.ts +58 -11
- package/src/serve/hub-app/palette-view.tsx +3 -1
- package/src/serve/hub-app/pane-boundary.tsx +72 -0
- package/src/serve/hub-app/pane-errors.ts +54 -0
- package/src/serve/hub-app/plan-view.tsx +3 -2
- package/src/serve/hub-app/planned-view.tsx +3 -3
- package/src/serve/hub-app/planned.css +0 -4
- package/src/serve/hub-app/processes-view.tsx +3 -2
- package/src/serve/hub-app/project-list.css +46 -8
- package/src/serve/hub-app/project-list.tsx +125 -59
- package/src/serve/hub-app/projects-svc.ts +83 -8
- package/src/serve/hub-app/reader-chips.tsx +13 -0
- package/src/serve/hub-app/readme-view.tsx +2 -3
- package/src/serve/hub-app/readme.css +22 -6
- package/src/serve/hub-app/reflections-page.tsx +95 -0
- package/src/serve/hub-app/reflections-st.ts +17 -0
- package/src/serve/hub-app/releases/releases-page.tsx +28 -4
- package/src/serve/hub-app/releases/releases-st.ts +1 -1
- package/src/serve/hub-app/releases.css +0 -1
- package/src/serve/hub-app/repo-sections.ts +9 -5
- package/src/serve/hub-app/repo-st.ts +35 -8
- package/src/serve/hub-app/review/code-colors.ts +30 -0
- package/src/serve/hub-app/review/diff-view.tsx +75 -0
- package/src/serve/hub-app/review/dock.tsx +104 -0
- package/src/serve/hub-app/review/draft-card.tsx +163 -0
- package/src/serve/hub-app/review/group-block.tsx +209 -0
- package/src/serve/hub-app/review/instructions-view.tsx +116 -0
- package/src/serve/hub-app/review/item-verdict.tsx +38 -0
- package/src/serve/hub-app/review/kind-states.tsx +193 -0
- package/src/serve/hub-app/review/kind-view.tsx +1 -37
- package/src/serve/hub-app/review/kit.tsx +75 -29
- package/src/serve/hub-app/review/lane-bar.tsx +64 -0
- package/src/serve/hub-app/review/note-place.ts +1 -1
- package/src/serve/hub-app/review/object-card.tsx +62 -0
- package/src/serve/hub-app/review/object-panel.tsx +179 -0
- package/src/serve/hub-app/review/question-views.tsx +385 -0
- package/src/serve/hub-app/review/review-board.tsx +2 -2
- package/src/serve/hub-app/review/review-cells.tsx +148 -87
- package/src/serve/hub-app/review/review-kit.ts +27 -1
- package/src/serve/hub-app/review/review-list.tsx +160 -65
- package/src/serve/hub-app/review/review-page.tsx +12 -12
- package/src/serve/hub-app/review/review-st.ts +174 -47
- package/src/serve/hub-app/review/review-thread.tsx +214 -53
- package/src/serve/hub-app/review/review-views.tsx +494 -159
- package/src/serve/hub-app/review/thread-close.tsx +124 -0
- package/src/serve/hub-app/review/thread-control-st.ts +115 -0
- package/src/serve/hub-app/review/thread-control.tsx +74 -0
- package/src/serve/hub-app/review/thread-st.ts +288 -41
- package/src/serve/hub-app/review/trailer-card.tsx +2 -2
- package/src/serve/hub-app/review/trailer-page.tsx +37 -16
- package/src/serve/hub-app/review/trailer-st.ts +41 -7
- package/src/serve/hub-app/review/trailer-timeline.tsx +2 -2
- package/src/serve/hub-app/review.css +462 -97
- package/src/serve/hub-app/section-head.tsx +51 -0
- package/src/serve/hub-app/side-lists.ts +72 -0
- package/src/serve/hub-app/sidebar.tsx +6 -3
- package/src/serve/hub-app/site/site-part.tsx +2 -8
- package/src/serve/hub-app/site/site-st.ts +4 -4
- package/src/serve/hub-app/social/calendar.tsx +5 -11
- package/src/serve/hub-app/social/comms-page.tsx +43 -15
- package/src/serve/hub-app/social/kit.tsx +32 -13
- package/src/serve/hub-app/social/next-release.tsx +3 -5
- package/src/serve/hub-app/social/post-card.tsx +142 -49
- package/src/serve/hub-app/social/post-page.tsx +80 -0
- package/src/serve/hub-app/social/problems.tsx +5 -9
- package/src/serve/hub-app/social/serial-writes.ts +13 -0
- package/src/serve/hub-app/social/social-model.ts +24 -5
- package/src/serve/hub-app/social/social-page.tsx +95 -36
- package/src/serve/hub-app/social/social-st.ts +162 -41
- package/src/serve/hub-app/social/stage-popup.tsx +1 -1
- package/src/serve/hub-app/social/stage-st.ts +1 -1
- package/src/serve/hub-app/social/step-layout.ts +1 -1
- package/src/serve/hub-app/social.css +10 -17
- package/src/serve/hub-app/space-st.ts +209 -0
- package/src/serve/hub-app/space-view.tsx +196 -0
- package/src/serve/hub-app/space.css +27 -0
- package/src/serve/hub-app/stores/stores-page.tsx +97 -25
- package/src/serve/hub-app/stores/stores-st.ts +44 -19
- package/src/serve/hub-app/stores.css +6 -1
- package/src/serve/hub-app/theme-st.ts +22 -9
- package/src/serve/hub-app/thread-row.tsx +101 -0
- package/src/serve/hub-app/time-ago.tsx +3 -2
- package/src/serve/hub-app/time-charts.tsx +291 -0
- package/src/serve/hub-app/time-pages.tsx +749 -0
- package/src/serve/hub-app/time-st.ts +162 -0
- package/src/serve/hub-app/time-view.tsx +77 -0
- package/src/serve/hub-app/time.css +135 -0
- package/src/serve/hub-app/tree-build.ts +52 -42
- package/src/serve/hub-app/tree-row.tsx +3 -11
- package/src/serve/hub-app/tree-svc.ts +18 -9
- package/src/serve/hub-app/urls-svc.ts +154 -0
- package/src/serve/hub-app/urls-view.tsx +117 -0
- package/src/serve/hub-app/urls.css +30 -0
- package/src/serve/hub-app/vault-st.ts +127 -0
- package/src/serve/hub-app/vault-view.tsx +154 -0
- package/src/serve/hub-app/vault.css +38 -0
- package/src/serve/hub-app/veille/veille-page.tsx +2 -11
- package/src/serve/hub-app/veille/veille-st.ts +12 -10
- package/src/serve/hub-app/veille.css +0 -1
- package/src/serve/hub-app/waiting-svc.ts +29 -0
- package/src/serve/hub-app/when-view.tsx +6 -3
- package/src/serve/hub-app/wiki-st.ts +30 -4
- package/src/serve/hub-app/wikis-view.tsx +6 -5
- package/src/serve/hub-runtime.ts +35 -8
- package/src/serve/project-gutter-route.ts +42 -19
- package/src/serve/project-gutter.ts +16 -50
- package/src/serve/same-origin.ts +13 -0
- package/src/serve/secret-gate.ts +21 -0
- package/src/serve/serve-hub.ts +38 -20
- package/src/serve/tailnet-caller.ts +117 -0
- package/src/shipkit-files.ts +16 -2
- package/src/shipkit.ts +3 -3
- package/src/shot/shooter.ts +616 -420
- package/src/shot/shot-ask.ts +246 -155
- package/src/site/desk.ts +4 -4
- package/src/smoke/run-smoke.ts +6 -6
- package/src/social/brands.ts +4 -0
- package/src/social/card-drafts.ts +11 -19
- package/src/social/cover.ts +202 -0
- package/src/social/desk-index.ts +34 -13
- package/src/social/discord-layout.ts +37 -13
- package/src/social/drafts.ts +7 -4
- package/src/social/import-drafts.ts +244 -0
- package/src/social/kind-pages.ts +3 -3
- package/src/social/kinds.ts +1 -1
- package/src/social/load.ts +111 -65
- package/src/social/media-kind.ts +68 -160
- package/src/social/media-of.ts +5 -4
- package/src/social/open.ts +3 -2
- package/src/social/post-object.ts +120 -0
- package/src/social/post-sources.ts +136 -0
- package/src/social/post-text.ts +103 -0
- package/src/social/posts.ts +378 -0
- package/src/social/presence.ts +7 -5
- package/src/social/publish/discord.ts +5 -2
- package/src/social/publish/index.ts +17 -5
- package/src/social/publish/secret.ts +4 -4
- package/src/social/release-stage.ts +79 -63
- package/src/social/routes.ts +89 -24
- package/src/social/stage.ts +43 -58
- package/src/social/stats.ts +12 -9
- package/src/social/strip.ts +4 -1
- package/src/social/text.ts +4 -3
- package/src/social/thumbnail.ts +347 -0
- package/src/social/tracker.ts +1 -1
- package/src/social/writes.ts +12 -29
- package/src/stores/collection.ts +15 -11
- package/src/stores/desk.ts +246 -47
- package/src/stores/model.ts +72 -6
- package/src/stores/routes.ts +37 -12
- package/src/stores/unit.ts +16 -10
- package/src/suite/judge-suites.ts +41 -11
- package/src/suite/select.ts +45 -3
- package/src/suite/suite-cli.ts +16 -10
- package/src/trailer/bed.ts +1 -1
- package/src/trailer/build.ts +134 -21
- package/src/trailer/ffmpeg.ts +7 -0
- package/src/trailer/fonts.ts +3 -2
- package/src/trailer/grammar.ts +201 -2
- package/src/trailer/graph.ts +42 -5
- package/src/trailer/look.ts +21 -0
- package/src/trailer/mock.ts +154 -0
- package/src/trailer/passage.ts +65 -26
- package/src/trailer/score/heard.ts +89 -0
- package/src/trailer/score/sound.ts +14 -8
- package/src/trailer/sound/eleven.ts +33 -3
- package/src/trailer/sound/run.ts +16 -6
- package/src/trailer/stitch.ts +26 -5
- package/src/trailer/titles.ts +82 -19
- package/src/trailer/versions.ts +1 -3
- package/src/trailer/vertical.ts +3 -1
- package/src/urls/frame.ts +195 -0
- package/src/urls/routes.ts +43 -0
- package/src/urls/rows.ts +171 -0
- package/src/urls/unit.ts +73 -0
- package/src/vault/house-keys.ts +42 -0
- package/src/vault/layout.ts +50 -0
- package/src/vault/policy.ts +165 -0
- package/src/vault/vault-audit.ts +276 -0
- package/src/vault/vault-client.ts +40 -0
- package/src/vault/vault-config.ts +159 -0
- package/src/vault/vault-destroy.ts +78 -0
- package/src/vault/vault-handover.ts +305 -0
- package/src/vault/vault-http.ts +360 -0
- package/src/vault/vault-import.ts +213 -0
- package/src/vault/vault-init.ts +328 -0
- package/src/vault/vault-minter.ts +271 -0
- package/src/vault/vault-restore.ts +333 -0
- package/src/vault/vault-serve.ts +342 -0
- package/src/vault/vault-snapshot.ts +281 -0
- package/src/veille/asks.ts +1 -1
- package/src/veille/desk.ts +2 -2
- package/src/veille/identity.ts +2 -2
- package/src/wiki/graph-pages.ts +13 -1
- package/src/wiki/scan-md.ts +1 -1
- package/src/asks/asks-queue.ts +0 -266
- package/src/social/migrate.ts +0 -123
|
@@ -0,0 +1,253 @@
|
|
|
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
|
+
// words of the home's database page. Report only: every file is opened read only, never a row's content
|
|
3
|
+
import { Command, Option } from 'clipanion'
|
|
4
|
+
import { StoreRefused, WAIT_EXIT } from '../core/machine-db.ts'
|
|
5
|
+
|
|
6
|
+
export class DbCommand extends Command {
|
|
7
|
+
static override paths = [['db']]
|
|
8
|
+
|
|
9
|
+
static override usage = Command.Usage({
|
|
10
|
+
category: 'Health',
|
|
11
|
+
description: 'every database of this machine: its size on disk, its cap, each table with its rows and bytes',
|
|
12
|
+
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. A store still in its own file (before `sk db fold`) is listed apart. 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.",
|
|
13
|
+
examples: [
|
|
14
|
+
['every database', 'sk db'],
|
|
15
|
+
['the hq alone', 'sk db hq'],
|
|
16
|
+
['how much one project takes in every database', 'sk db <repo id>'],
|
|
17
|
+
['count every table now', 'sk db --fresh'],
|
|
18
|
+
['machine readable', 'sk db --json'],
|
|
19
|
+
],
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
name = Option.String({ required: false, name: 'name' })
|
|
23
|
+
fresh = Option.Boolean('--fresh', false, { description: 'count every table of every file now, in this process: seconds on a big file' })
|
|
24
|
+
json = Option.Boolean('--json', false, { description: 'the answer of the page as json' })
|
|
25
|
+
|
|
26
|
+
async execute(): Promise<number> {
|
|
27
|
+
const { homedir } = await import('node:os')
|
|
28
|
+
const { houseRoot } = await import('../home/home-start.ts')
|
|
29
|
+
const { houseRepos } = await import('../serve/project-gutter.ts')
|
|
30
|
+
const { censusTick, databasesPage, houseProjects } = await import('../home/databases.ts')
|
|
31
|
+
const { databaseLines, ESTIMATE_HOW, partWords, projectWords } = await import('../home/database-words.ts')
|
|
32
|
+
const house = houseRoot(process.cwd())
|
|
33
|
+
const repos = house == null ? [] : houseRepos(house, homedir()).repos.map((r) => ({ name: r.name, path: r.path }))
|
|
34
|
+
if (house == null) this.context.stderr.write('WARN: no house found from here: no run record is listed\n')
|
|
35
|
+
if (this.fresh) censusTick({ repos, projects: await houseProjects(repos), all: true, print: (l) => void this.context.stderr.write(`${l}\n`) })
|
|
36
|
+
const now = Date.now()
|
|
37
|
+
const page = await databasesPage({ repos, now })
|
|
38
|
+
const want = this.name?.toLowerCase()
|
|
39
|
+
const shown = want == null ? page : { ...page, dbs: page.dbs.filter((d) => d.id.toLowerCase().startsWith(want) || d.name.toLowerCase() === want) }
|
|
40
|
+
// a project's id wins over its run record's name: its share of every database, one line a part
|
|
41
|
+
const project = want == null ? undefined : page.projects.find((p) => p.id.toLowerCase() === want)
|
|
42
|
+
if (project != null) {
|
|
43
|
+
if (this.json) {
|
|
44
|
+
this.context.stdout.write(`${JSON.stringify(project)}\n`)
|
|
45
|
+
return 0
|
|
46
|
+
}
|
|
47
|
+
const names = new Map(page.dbs.map((d) => [d.id, d.kind === 'record' ? 'run record' : d.name]))
|
|
48
|
+
const parts = project.parts.filter((x) => x.rows > 0).map((x) => ` ${names.get(x.db) ?? x.db}: ${partWords(x)}`)
|
|
49
|
+
this.context.stdout.write(`${[projectWords(project, names), ...parts, `(${ESTIMATE_HOW})`].join('\n')}\n`)
|
|
50
|
+
return 0
|
|
51
|
+
}
|
|
52
|
+
if (shown.dbs.length === 0) {
|
|
53
|
+
this.context.stderr.write(`FAIL: no database or project named ${JSON.stringify(this.name)}: ${[...page.dbs.map((d) => d.id), ...page.projects.map((p) => p.id)].join(', ')}\n`)
|
|
54
|
+
return 1
|
|
55
|
+
}
|
|
56
|
+
if (this.json) {
|
|
57
|
+
this.context.stdout.write(`${JSON.stringify(shown)}\n`)
|
|
58
|
+
return 0
|
|
59
|
+
}
|
|
60
|
+
this.context.stdout.write(`${databaseLines(shown, now).join('\n')}\n`)
|
|
61
|
+
if (want == null) {
|
|
62
|
+
const { foldWords } = await import('../home/machine-fold.ts')
|
|
63
|
+
try {
|
|
64
|
+
this.context.stdout.write(`${foldWords().join('\n')}\n`)
|
|
65
|
+
} catch (e) {
|
|
66
|
+
this.context.stdout.write(`WARN the fold's state does not read: ${(e as Error).message}\n`)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return 0
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** sk db fold: the media index, the agent time index and the daemon's file into the machine db, the machine's one
|
|
74
|
+
* local file */
|
|
75
|
+
export class DbFoldCommand extends Command {
|
|
76
|
+
static override paths = [['db', 'fold']]
|
|
77
|
+
|
|
78
|
+
static override usage = Command.Usage({
|
|
79
|
+
category: 'Health',
|
|
80
|
+
description: "the media and agent time indexes and the daemon's file into the machine db (dry run first)",
|
|
81
|
+
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.",
|
|
82
|
+
examples: [
|
|
83
|
+
['what the fold would do', 'sk db fold'],
|
|
84
|
+
['fold', 'sk db fold --go'],
|
|
85
|
+
['the way back', 'sk db fold --back --go'],
|
|
86
|
+
['the copies kept for the way back, deleted once sure', 'sk db fold --rm-copies --go'],
|
|
87
|
+
],
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
go = Option.Boolean('--go', false, { description: 'do it; without it, say what it would do' })
|
|
91
|
+
back = Option.Boolean('--back', false, { description: 'put each store back in its own file from its copy' })
|
|
92
|
+
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" })
|
|
93
|
+
rmCopies = Option.Boolean('--rm-copies', false, { description: 'the copies a fold kept for the way back: says which, --go deletes them' })
|
|
94
|
+
|
|
95
|
+
async execute(): Promise<number> {
|
|
96
|
+
const { fold, foldPlan, foldWords, rmCopies, unfold } = await import('../home/machine-fold.ts')
|
|
97
|
+
if (this.noticeDone != null) {
|
|
98
|
+
const { noticeDone, shortKey } = await import('../home/machine-fold.ts')
|
|
99
|
+
if (noticeDone(this.noticeDone)) return 0
|
|
100
|
+
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`)
|
|
101
|
+
return 1
|
|
102
|
+
}
|
|
103
|
+
if (this.rmCopies) {
|
|
104
|
+
rmCopies({ go: this.go, print: (l) => void this.context.stdout.write(`${l}\n`) })
|
|
105
|
+
return 0
|
|
106
|
+
}
|
|
107
|
+
const { machineDbPath } = await import('../core/machine-db.ts')
|
|
108
|
+
const print = (l: string): void => void this.context.stdout.write(`${l}\n`)
|
|
109
|
+
const mb = (b: number): string => `${Math.round(b / 1e6)} MB`
|
|
110
|
+
const plan = foldPlan()
|
|
111
|
+
const { oldDamage } = await import('../home/machine-fold.ts')
|
|
112
|
+
print(`this machine's key: ${(await import('../home/machine-fold.ts')).shortKey()}`)
|
|
113
|
+
for (const s of plan.states) {
|
|
114
|
+
const hurt = !this.back && s.state === 'own file' ? oldDamage(s.old) : null
|
|
115
|
+
print(`${s.store}: ${s.state === 'own file' ? `its own file ${s.old}, ${mb(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} ${mb(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'}`)
|
|
116
|
+
}
|
|
117
|
+
if (!this.go) {
|
|
118
|
+
for (const l of foldWords().slice(0, 1)) print(l)
|
|
119
|
+
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'}`)
|
|
120
|
+
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 ${mb(plan.need)}, the disk has ${mb(plan.free)} free`)
|
|
121
|
+
return 0
|
|
122
|
+
}
|
|
123
|
+
try {
|
|
124
|
+
// the daemon keeps the media index open: a write it makes to the tables after their rows went back is lost
|
|
125
|
+
if (this.back && (await (await import('../home/home-paths.ts')).pmUp())) {
|
|
126
|
+
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')
|
|
127
|
+
return 1
|
|
128
|
+
}
|
|
129
|
+
if (this.back) await unfold({ print })
|
|
130
|
+
else {
|
|
131
|
+
const done = await fold({ print, byHand: true })
|
|
132
|
+
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}`)
|
|
133
|
+
if (done.some((d) => d.why.startsWith('damaged'))) return 1
|
|
134
|
+
}
|
|
135
|
+
return 0
|
|
136
|
+
} catch (e) {
|
|
137
|
+
this.context.stderr.write(`FAIL: ${(e as Error).message}\n`)
|
|
138
|
+
return e instanceof StoreRefused && e.wait ? WAIT_EXIT : 1
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** sk db drop: a cache part of the machine db dropped and made again empty */
|
|
144
|
+
export class DbDropCommand extends Command {
|
|
145
|
+
static override paths = [['db', 'drop']]
|
|
146
|
+
|
|
147
|
+
static override usage = Command.Usage({
|
|
148
|
+
category: 'Health',
|
|
149
|
+
description: 'a cache part of the machine db dropped and made again empty',
|
|
150
|
+
details: "The part is `media` (the media index: it builds again from the files and the Space). The agent time index is never dropped: it alone holds what Claude Code pruned, and `sk db repair time` repairs a damaged table of it. Says what it would do; `--go` empties its tables in steps and makes them again. The machine's own tables are never a part.",
|
|
151
|
+
examples: [
|
|
152
|
+
['what it would drop', 'sk db drop media'],
|
|
153
|
+
['drop the media index, it builds again', 'sk db drop media --go'],
|
|
154
|
+
],
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
part = Option.String({ required: true, name: 'part' })
|
|
158
|
+
go = Option.Boolean('--go', false, { description: 'do it; without it, say what it would do' })
|
|
159
|
+
|
|
160
|
+
async execute(): Promise<number> {
|
|
161
|
+
const { dropPart, partNamed } = await import('../home/machine-repair.ts')
|
|
162
|
+
const store = partNamed(this.part)
|
|
163
|
+
if (store == null) {
|
|
164
|
+
this.context.stderr.write(`FAIL: no part ${JSON.stringify(this.part)}: media or time\n`)
|
|
165
|
+
return 1
|
|
166
|
+
}
|
|
167
|
+
try {
|
|
168
|
+
const r = await dropPart(store, { go: this.go, print: (l) => void this.context.stdout.write(`${l}\n`) })
|
|
169
|
+
for (const t of r.tables) this.context.stdout.write(` ${t.table} ${t.rows == null ? 'rows unread' : `${t.rows.toLocaleString('en-US')} rows`}\n`)
|
|
170
|
+
if (!r.done) this.context.stdout.write(`${r.why}\n`)
|
|
171
|
+
return r.done || !this.go ? 0 : 1
|
|
172
|
+
} catch (e) {
|
|
173
|
+
this.context.stderr.write(`FAIL: ${(e as Error).message}\n`)
|
|
174
|
+
return 1
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** sk db repair: the damaged tables of a part of the machine db repaired, every row that reads kept */
|
|
180
|
+
export class DbRepairCommand extends Command {
|
|
181
|
+
static override paths = [['db', 'repair']]
|
|
182
|
+
|
|
183
|
+
static override usage = Command.Usage({
|
|
184
|
+
category: 'Health',
|
|
185
|
+
description: 'the damaged tables of a part of the machine db repaired: every row that reads is kept',
|
|
186
|
+
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`. A store still in a file of its own (not folded) that sqlite finds damaged is written again by sqlite's recovery (`.recover`) into a new file in its place, the damaged one kept as `<file>.damaged`. For `daemon`, the cards 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.",
|
|
187
|
+
examples: [
|
|
188
|
+
['what a repair would keep and lose', 'sk db repair time'],
|
|
189
|
+
['repair', 'sk db repair time --go'],
|
|
190
|
+
],
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
part = Option.String({ required: true, name: 'part' })
|
|
194
|
+
go = Option.Boolean('--go', false, { description: 'do it; without it, say what it would keep and lose' })
|
|
195
|
+
|
|
196
|
+
async execute(): Promise<number> {
|
|
197
|
+
const { partNamed, repairPart } = await import('../home/machine-repair.ts')
|
|
198
|
+
const store = partNamed(this.part)
|
|
199
|
+
if (store == null) {
|
|
200
|
+
this.context.stderr.write(`FAIL: no part ${JSON.stringify(this.part)}: media, time or daemon\n`)
|
|
201
|
+
return 1
|
|
202
|
+
}
|
|
203
|
+
try {
|
|
204
|
+
const { pmUp } = await import('../home/home-paths.ts')
|
|
205
|
+
const r = await repairPart(store, { go: this.go, print: (l) => void this.context.stdout.write(`${l}\n`), pmUp: this.go && (await pmUp()) })
|
|
206
|
+
if (!r.done) this.context.stdout.write(`${r.why}\n`)
|
|
207
|
+
// the cards a repair lost come back from the hq, which holds every row this machine sent or landed
|
|
208
|
+
if (r.done && store === 'daemon file') {
|
|
209
|
+
const cards = r.tables.filter((t) => t.table === 'review_cards' || t.table === 'review_msgs')
|
|
210
|
+
const lost = cards.some((t) => t.lost == null) ? null : cards.reduce((n, t) => n + (t.lost ?? 0), 0)
|
|
211
|
+
const { outboxLossLine } = await import('../hq/outbox.ts')
|
|
212
|
+
const { giveBackHere } = await import('../hq/cards.ts')
|
|
213
|
+
this.context.stdout.write(`ok: the daemon file: ${await giveBackHere(lost)}\n`)
|
|
214
|
+
const out = await outboxLossLine()
|
|
215
|
+
if (out != null) this.context.stdout.write(`${out}\n`)
|
|
216
|
+
}
|
|
217
|
+
return 0
|
|
218
|
+
} catch (e) {
|
|
219
|
+
this.context.stderr.write(`FAIL: ${(e as Error).message}\n`)
|
|
220
|
+
return 1
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/** sk db rebuild: the machine db written again whole, its unused pages gone, every table checked */
|
|
226
|
+
export class DbRebuildCommand extends Command {
|
|
227
|
+
static override paths = [['db', 'rebuild']]
|
|
228
|
+
|
|
229
|
+
static override usage = Command.Usage({
|
|
230
|
+
category: 'Health',
|
|
231
|
+
description: 'the machine db written again whole into a new file, every table checked against the old one',
|
|
232
|
+
details: "Says what it would do and the room it needs. `--go` (with the home down: `sk pm uninstall`) writes the machine db again into a new file (VACUUM INTO: the pages a repair left unused are gone, every page read), counts and hashes every table of both, and renames the new file into place under the write lock, the old one kept as `<file>.before-rebuild`. A table that differs, a write by another process meanwhile, or a process that holds the file open renames nothing and says so. A page that does not read: `sk db repair` first.",
|
|
233
|
+
examples: [
|
|
234
|
+
['what it would do', 'sk db rebuild'],
|
|
235
|
+
['rebuild', 'sk db rebuild --go'],
|
|
236
|
+
],
|
|
237
|
+
})
|
|
238
|
+
|
|
239
|
+
go = Option.Boolean('--go', false, { description: 'do it; without it, say what it would do' })
|
|
240
|
+
|
|
241
|
+
async execute(): Promise<number> {
|
|
242
|
+
const { rebuild } = await import('../home/machine-repair.ts')
|
|
243
|
+
const { pmUp } = await import('../home/home-paths.ts')
|
|
244
|
+
try {
|
|
245
|
+
const r = await rebuild({ go: this.go, print: (l) => void this.context.stdout.write(`${l}\n`), pmUp: this.go && (await pmUp()) })
|
|
246
|
+
if (!r.done) this.context.stdout.write(`${r.why}\n`)
|
|
247
|
+
return r.done || !this.go ? 0 : 1
|
|
248
|
+
} catch (e) {
|
|
249
|
+
this.context.stderr.write(`FAIL: ${(e as Error).message}\n`)
|
|
250
|
+
return 1
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
// sk history: the owner's prompts and the day rows of `sk time` kept in the hq (wiki tools/shipkit/hq.md). `send`
|
|
2
|
+
// looks, sets the switch, or sends everything again; `check` proves the hq holds them; `forget` takes one prompt
|
|
3
|
+
// out of the hq for good. Every line counts or names ids, never a prompt's text
|
|
4
|
+
import { Command, Option } from 'clipanion'
|
|
5
|
+
|
|
6
|
+
const writer = (c: Command) => ({ out: (l: string) => c.context.stdout.write(`${l}\n`), err: (l: string) => c.context.stderr.write(`${l}\n`) })
|
|
7
|
+
|
|
8
|
+
async function house(): Promise<{ root: string; home: string }> {
|
|
9
|
+
const { findRepoRoot } = await import('../ts/config.ts')
|
|
10
|
+
const { homedir } = await import('node:os')
|
|
11
|
+
return { root: findRepoRoot(process.cwd()), home: homedir() }
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export class HistorySendCommand extends Command {
|
|
15
|
+
static override paths = [['history', 'send']]
|
|
16
|
+
|
|
17
|
+
static override usage = Command.Usage({
|
|
18
|
+
category: 'Home',
|
|
19
|
+
description: "the owner's prompts and the day rows of sk time to the hq: --dry looks, --auto on|off sets it",
|
|
20
|
+
details: "The job `agent time` sends to the hq the prompts typed or queued in a Claude Code session of a house repo, of its worktrees, and of a folder the house config's `history.also` names (secret shapes masked), and once an hour the day rows of `sk time`, while the machine db switch `hq-history` is on, its default off. What `history.skip` names never leaves, and every other folder stays on this machine. `--dry` counts what a look would send and lists every folder by where it goes: sent, skipped by name, left here; it changes nothing. `--again` sends every prompt and day row again (`--days <n>`: of the last n days), whatever this machine saw the hq take: what `sk history check` asks for when it fails.",
|
|
21
|
+
examples: [['what a look would send, and every folder by where it goes', 'sk history send --dry'], ['the daemon sends them from now on', 'sk history send --auto on'], ['send the last 30 days again', 'sk history send --again --days 30']],
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
dry = Option.Boolean('--dry', false, { description: 'count what a look would send and list every folder by where it goes, change nothing' })
|
|
25
|
+
auto = Option.String('--auto', { description: 'on: the agent time job sends them to the hq; off: nothing of it runs (the default)' })
|
|
26
|
+
again = Option.Boolean('--again', false, { description: 'send every prompt and day row again, whatever the hq took' })
|
|
27
|
+
days = Option.String('--days', { description: 'with --again: only the last n days' })
|
|
28
|
+
|
|
29
|
+
async execute(): Promise<number> {
|
|
30
|
+
const w = writer(this)
|
|
31
|
+
if (this.auto !== undefined) {
|
|
32
|
+
if (this.auto !== 'on' && this.auto !== 'off') {
|
|
33
|
+
w.err(`FAIL: --auto takes on or off, not ${this.auto}`)
|
|
34
|
+
return 1
|
|
35
|
+
}
|
|
36
|
+
const { setHistoryOn } = await import('../hq/switch.ts')
|
|
37
|
+
if (!setHistoryOn(this.auto === 'on')) {
|
|
38
|
+
w.err('FAIL: the machine db does not open: the switch is not set')
|
|
39
|
+
return 1
|
|
40
|
+
}
|
|
41
|
+
w.out(`ok: the switch hq-history is ${this.auto}${this.auto === 'on' ? ': the daemon job agent time sends them at its next look (sk daemon job "agent time" runs one now)' : ''}`)
|
|
42
|
+
return 0
|
|
43
|
+
}
|
|
44
|
+
const days = daysOf(this.days, w)
|
|
45
|
+
if (days === false) return 1
|
|
46
|
+
if (days != null && !this.again) {
|
|
47
|
+
w.err('FAIL: --days narrows --again: sk history send --again --days <n>')
|
|
48
|
+
return 1
|
|
49
|
+
}
|
|
50
|
+
if (!this.dry && !this.again) {
|
|
51
|
+
w.err('FAIL: sk history send --dry looks, --auto on|off sets the switch, --again sends everything again. The job runs in the daemon while the switch is on')
|
|
52
|
+
return 1
|
|
53
|
+
}
|
|
54
|
+
const { historyOn } = await import('../hq/switch.ts')
|
|
55
|
+
if (!this.dry && !historyOn()) {
|
|
56
|
+
w.err('FAIL: the switch hq-history is off: nothing is sent (sk history send --auto on)')
|
|
57
|
+
return 1
|
|
58
|
+
}
|
|
59
|
+
const { agentTimeDbPath, openIndex } = await import('../agent-time/store.ts')
|
|
60
|
+
const { historySendTick } = await import('../hq/history-send.ts')
|
|
61
|
+
const { Database } = await import('bun:sqlite')
|
|
62
|
+
const h = await house()
|
|
63
|
+
// a look reads the index as it is: no table of it is made or moved
|
|
64
|
+
const index = this.dry ? new Database(agentTimeDbPath(h.home), { readonly: true }) : openIndex(agentTimeDbPath(h.home))
|
|
65
|
+
try {
|
|
66
|
+
if (this.dry) w.out(`the switch hq-history is ${historyOn() ? 'on' : 'off'}: a look of the job would send this`)
|
|
67
|
+
return await historySendTick({ ...h, index, print: w.out, printErr: w.err, dry: this.dry, ...(this.again ? { again: { since: days == null ? 0 : Date.now() - days * 24 * 3600_000 } } : {}) })
|
|
68
|
+
} finally {
|
|
69
|
+
index.close()
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** a number of days of a flag: undefined when absent, false (said) when it is none */
|
|
75
|
+
function daysOf(v: string | undefined, w: { err: (l: string) => void }): number | undefined | false {
|
|
76
|
+
if (v === undefined) return undefined
|
|
77
|
+
const d = Number(v)
|
|
78
|
+
if (Number.isInteger(d) && d > 0 && d <= 4000) return d
|
|
79
|
+
w.err(`FAIL: --days ${v}: a whole number of days`)
|
|
80
|
+
return false
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** the machine db row of the last green check of the whole index: how many prompts the hq held of this node then,
|
|
84
|
+
* its forgotten rows counted */
|
|
85
|
+
const CHECKED = 'hq-history-checked'
|
|
86
|
+
|
|
87
|
+
export class HistoryCheckCommand extends Command {
|
|
88
|
+
static override paths = [['history', 'check']]
|
|
89
|
+
|
|
90
|
+
static override usage = Command.Usage({
|
|
91
|
+
category: 'Home',
|
|
92
|
+
description: "does the hq hold the owner's prompts and day rows as the index says: every one",
|
|
93
|
+
details: "The index first reads every transcript on disk. Then every prompt of the whole index that is to be sent (`--days <n>`: of the last n days) is asked of the hq by its id and the sha of its masked text, one line per account: missing or with another text is red, and `sk history send --again` sends them again; held from another node (a copied session) counts as held. A prompt of a folder skipped by name since it went is red: `sk history forget --skipped` takes those out. What the hq holds of this node beyond the index (prompts the index lost, an earlier reading of a queued prompt) is counted and kept: the hq is their copy. Of the whole index, the hq must hold no fewer prompts of this node, forgotten ones counted, than at the last green check (kept in the machine db; `--recount` accepts a loss). Each closed day (not today, not yesterday) is built again and compared with this node's day row by its sha. Exit 0 only when every line is ok: the proof asked before Claude Code may delete transcripts sooner. It prints counts and ids, never a prompt's text.",
|
|
94
|
+
examples: [['the whole index', 'sk history check'], ['the last week', 'sk history check --days 7']],
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
days = Option.String('--days', { description: 'only the last n days' })
|
|
98
|
+
recount = Option.Boolean('--recount', false, { description: 'forget the count of the last green check first: a loss taken as lost' })
|
|
99
|
+
|
|
100
|
+
async execute(): Promise<number> {
|
|
101
|
+
const w = writer(this)
|
|
102
|
+
const days = daysOf(this.days, w)
|
|
103
|
+
if (days === false) return 1
|
|
104
|
+
const { agentTimeDbPath, freshness, indexTranscripts, listTranscripts, openIndex } = await import('../agent-time/store.ts')
|
|
105
|
+
const { discoverConfigRoots } = await import('../reflect/prompt-corpus.ts')
|
|
106
|
+
const { houseScope } = await import('../hq/history-send.ts')
|
|
107
|
+
const { historyCheck } = await import('../hq/history-check.ts')
|
|
108
|
+
const { myHq } = await import('../hq/hq-local.ts')
|
|
109
|
+
const { machineDelete, machineGet, machineSet } = await import('../core/machine-db.ts')
|
|
110
|
+
const h = await house()
|
|
111
|
+
const hq = myHq()
|
|
112
|
+
if ('refused' in hq) {
|
|
113
|
+
w.err(`FAIL the hq is not reached: ${hq.refused}`)
|
|
114
|
+
return 1
|
|
115
|
+
}
|
|
116
|
+
if (this.recount) machineDelete(CHECKED)
|
|
117
|
+
const index = openIndex(agentTimeDbPath(h.home))
|
|
118
|
+
try {
|
|
119
|
+
const files = listTranscripts(discoverConfigRoots(h.home))
|
|
120
|
+
indexTranscripts(index, files)
|
|
121
|
+
const held = index.query('select size, mtime, offset, version from time_files where path = ?')
|
|
122
|
+
const unread = files.filter((f) => freshness(held.get(f.path) as Parameters<typeof freshness>[0], f) !== 'skip').length
|
|
123
|
+
const last = machineGet<{ held?: number; at: number }>(CHECKED)?.held ?? null
|
|
124
|
+
const r = await historyCheck({ index, link: hq, scope: await houseScope(h.root, h.home), now: Date.now(), days: days ?? null, unread, last })
|
|
125
|
+
for (const l of r.lines) (l.startsWith('FAIL') ? w.err : w.out)(l)
|
|
126
|
+
if (r.ok && days == null) machineSet(CHECKED, { held: r.held, at: Date.now() })
|
|
127
|
+
return r.ok ? 0 : 1
|
|
128
|
+
} finally {
|
|
129
|
+
index.close()
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export class HistoryForgetCommand extends Command {
|
|
135
|
+
static override paths = [['history', 'forget']]
|
|
136
|
+
|
|
137
|
+
static override usage = Command.Usage({
|
|
138
|
+
category: 'Home',
|
|
139
|
+
description: 'take a prompt out of the hq for good, by its id, or --skipped: no machine sends it back',
|
|
140
|
+
details: "For a prompt that holds a secret no shape caught (a password typed in plain words). Asked on the machine that carries the hq, in its console: the daemon removes the row and keeps its id as forgotten, so a copy from any machine is refused from then on. The replica in the Space keeps its older copies until Litestream compacts them. The rows of it this machine's outbox kept after the hq took them go too; the prompt stays in this machine's own index, in the outbox of another machine that sent it for up to 10 minutes, and in a `.before-vN` copy of the hq's file made since it landed. Its id is what `sk history check` and `sk reflect` name. `--skipped`, on any machine: every prompt this machine sent of a folder `history.skip` names since, counted, then taken out with `--yes`.",
|
|
141
|
+
examples: [['forget one prompt', 'sk history forget 0f2c9e1a-1b2c-4d3e-8f90-123456789abc'], ['the prompts of a folder skipped since they went', 'sk history forget --skipped --yes']],
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
id = Option.String({ required: false })
|
|
145
|
+
skipped = Option.Boolean('--skipped', false, { description: 'every prompt of a folder now skipped by name' })
|
|
146
|
+
yes = Option.Boolean('--yes', false, { description: 'with --skipped: yes, for good' })
|
|
147
|
+
|
|
148
|
+
async execute(): Promise<number> {
|
|
149
|
+
const w = writer(this)
|
|
150
|
+
if (this.skipped) return this.forgetSkipped(w)
|
|
151
|
+
if (this.id == null || !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$|^q[A-Za-z0-9_-]{21}$/.test(this.id)) {
|
|
152
|
+
w.err(`FAIL: ${(this.id ?? '').slice(0, 60)} is no prompt id: a uuid, or q and 21 characters`)
|
|
153
|
+
return 1
|
|
154
|
+
}
|
|
155
|
+
const id = this.id
|
|
156
|
+
const { daemonUrl } = await import('../home/home-paths.ts')
|
|
157
|
+
let r: Record<string, unknown>
|
|
158
|
+
try {
|
|
159
|
+
const res = await fetch(`${daemonUrl()}/api/home/hq/forget`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ kind: 'prompt', name: id }) })
|
|
160
|
+
r = (await res.json()) as Record<string, unknown>
|
|
161
|
+
} catch (e) {
|
|
162
|
+
r = { refused: `the daemon of this machine does not answer (${(e as Error).message}): sk pm starts it` }
|
|
163
|
+
}
|
|
164
|
+
if (typeof r['refused'] === 'string') {
|
|
165
|
+
w.err(`FAIL: ${r['refused']}`)
|
|
166
|
+
return 1
|
|
167
|
+
}
|
|
168
|
+
w.out(r['held'] === true ? `ok: prompt ${id} left the hq, and no machine sends it back` : `ok: the hq held no prompt ${id}; it is refused from now on`)
|
|
169
|
+
// and this machine's outbox: the rows the hq took are kept a while
|
|
170
|
+
const { openDaemonDb } = await import('../hq/outbox.ts')
|
|
171
|
+
const { dropForgotten } = await import('../hq/history-send.ts')
|
|
172
|
+
const db = openDaemonDb()
|
|
173
|
+
if (db != null)
|
|
174
|
+
try {
|
|
175
|
+
const n = dropForgotten(db, id, Date.now())
|
|
176
|
+
if (n > 0) w.out(`ok: ${n} copies of it left this machine's outbox`)
|
|
177
|
+
} finally {
|
|
178
|
+
db.close()
|
|
179
|
+
}
|
|
180
|
+
w.out("it stays in this machine's agent time index, and in the older copies of the hq's replica until Litestream drops them")
|
|
181
|
+
return 0
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
private async forgetSkipped(w: ReturnType<typeof writer>): Promise<number> {
|
|
185
|
+
const { agentTimeDbPath, openIndex } = await import('../agent-time/store.ts')
|
|
186
|
+
const { houseScope } = await import('../hq/history-send.ts')
|
|
187
|
+
const { forgetSkipped } = await import('../hq/history-check.ts')
|
|
188
|
+
const { myHq } = await import('../hq/hq-local.ts')
|
|
189
|
+
const { openDaemonDb } = await import('../hq/outbox.ts')
|
|
190
|
+
const hq = myHq()
|
|
191
|
+
if ('refused' in hq) {
|
|
192
|
+
w.err(`FAIL the hq is not reached: ${hq.refused}`)
|
|
193
|
+
return 1
|
|
194
|
+
}
|
|
195
|
+
const h = await house()
|
|
196
|
+
const index = openIndex(agentTimeDbPath(h.home))
|
|
197
|
+
const db = openDaemonDb()
|
|
198
|
+
if (db == null) {
|
|
199
|
+
index.close()
|
|
200
|
+
w.err('FAIL: the daemon db does not open')
|
|
201
|
+
return 1
|
|
202
|
+
}
|
|
203
|
+
try {
|
|
204
|
+
const r = await forgetSkipped({ index, link: hq, scope: await houseScope(h.root, h.home), db, now: Date.now(), yes: this.yes })
|
|
205
|
+
for (const l of r.lines) (l.startsWith('FAIL') ? w.err : w.out)(l)
|
|
206
|
+
return r.ok ? 0 : 1
|
|
207
|
+
} finally {
|
|
208
|
+
index.close()
|
|
209
|
+
db.close()
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
package/src/cli/cmd_Home.ts
CHANGED
|
@@ -5,12 +5,13 @@ import { stampConsole, stampedIo } from '../core/log-stamp.ts'
|
|
|
5
5
|
import { fileURLToPath } from 'url'
|
|
6
6
|
import { basename } from 'path'
|
|
7
7
|
import { markAutostart } from '../home/autostart.ts'
|
|
8
|
-
import { installHome, uninstallHome } from '../home/home-launchd.ts'
|
|
8
|
+
import { agentsDir, installHome, uninstallHome } from '../home/home-launchd.ts'
|
|
9
|
+
import { homeMove, whoRuns } from '../home/home-move.ts'
|
|
9
10
|
import { homeInstalled, houseCli, houseRoot, houseRootOf, openWindow, startHome } from '../home/home-start.ts'
|
|
10
11
|
import { ROLES } from '../home/pm.ts'
|
|
11
12
|
import { pmSwitchDeps, switchProcess } from '../home/pm-switch.ts'
|
|
12
13
|
import { homeUp, homeUrl, hubBase } from '../home/home-paths.ts'
|
|
13
|
-
import { homeRepo, houseIndex } from '../serve/project-gutter.ts'
|
|
14
|
+
import { homeRepo, houseIndex, houseRepos } from '../serve/project-gutter.ts'
|
|
14
15
|
import { homedir } from 'os'
|
|
15
16
|
import { execPm, runPm } from '../home/run-pm.ts'
|
|
16
17
|
import { runWeb } from '../home/run-web.ts'
|
|
@@ -90,7 +91,7 @@ export class DaemonJobCommand extends Command {
|
|
|
90
91
|
|
|
91
92
|
static override usage = Command.Usage({
|
|
92
93
|
category: 'Serve',
|
|
93
|
-
description: 'a daemon job now, in this process: backup,
|
|
94
|
+
description: 'a daemon job now, in this process: backup, annex, media store, hq report; a wrong id lists all',
|
|
94
95
|
details: 'what the daemon runs off its loop: it starts each job as this command in a child process, niced, its lines appended to the daemon\'s log, and never runs a job\'s body itself, so a walk, a VACUUM or a hash pass never holds a page. The backup holds a watch of its sources in the daemon: its child starts only when the watch heard a path that could be a source, a run waits, or every 30 min for a full walk; a look reads only the heard paths again, it runs when they moved and held still, and a run reads only the files whose size or time moved (every byte every 6 h). the retention sweep runs hourly, the media store passes every 30 s while it has work and every 5 min once a pass found none (sooner when a store folder moves), the global context is written and the apps in ~/Applications are built and swept when the stamp of their sources moved. What a job remembers between two runs lives in the machine db. Page: wiki tools/shipkit/home.md, Nothing heavy on the daemon\'s loop',
|
|
95
96
|
examples: [
|
|
96
97
|
['every global process app in ~/Applications built and swept now', 'sk daemon job apps'],
|
|
@@ -214,6 +215,33 @@ export class PmUninstallCommand extends Command {
|
|
|
214
215
|
}
|
|
215
216
|
}
|
|
216
217
|
|
|
218
|
+
export class HomeMoveCommand extends Command {
|
|
219
|
+
static override paths = [['home', 'move']]
|
|
220
|
+
|
|
221
|
+
static override usage = Command.Usage({
|
|
222
|
+
category: 'Serve',
|
|
223
|
+
description: "move the machine's state from ~/.config/shipkit to its one root ~/.shipkit (dry unless --go)",
|
|
224
|
+
details: "The machine's state (its db, the rail order, the home dir with the hq, the daemon's db, the media index and the vault) moves from ~/.config/shipkit to ~/.shipkit by rename on the same volume: never a copy, never over a file. A dry run prints each thing it would move with its size, each file that names the old path, and why it would refuse. --go refuses while any other shipkit process of this home runs (by the real process list and the files held open: pm, the daemon, the web, the vault, the replica, a session's review watch, any sk command) or pm's LaunchAgent is loaded, and names how to stop each; while the move runs, every process answers from its record and none makes a store under either root; then each step checks its own state, so a move stopped anywhere finishes when run again. It refuses too while an initialised vault's marker does not record the audit path it was initialised with: bao keeps that path in its own storage and would never turn active from the new place. It rewrites shipkit's own files that name the old path (the pm agent, Litestream's config; never the vault's, which keep the path bao keeps and still resolve through the link), sets aside and names what a process left at the old place, and leaves ~/.config/shipkit an absolute link to ~/.shipkit, so a tool that names the old path still reads. --back undoes it from the record ~/.shipkit/home-move.json, dry too unless --go. Until the move, every command reads the old place: nothing else changes",
|
|
225
|
+
examples: [
|
|
226
|
+
['what it would do', 'sk home move'],
|
|
227
|
+
['do it, once pm, the vault and the replica are stopped', 'sk home move --go'],
|
|
228
|
+
['undo it', 'sk home move --back --go'],
|
|
229
|
+
],
|
|
230
|
+
})
|
|
231
|
+
|
|
232
|
+
go = Option.Boolean('--go', false, { description: 'do it (else a dry run)' })
|
|
233
|
+
back = Option.Boolean('--back', false, { description: 'move the state back to ~/.config/shipkit, from the record of the move' })
|
|
234
|
+
|
|
235
|
+
async execute(): Promise<number> {
|
|
236
|
+
const home = homedir()
|
|
237
|
+
if (process.env.SHIPKIT_HOME_DIR || process.env.SHIPKIT_MACHINE_DB) io(this).print(`note: SHIPKIT_HOME_DIR or SHIPKIT_MACHINE_DB is set: this process reads that place, the move moves ${home}'s roots`)
|
|
238
|
+
const root = houseRoot(process.cwd(), { home })
|
|
239
|
+
const repos = root == null ? [] : [root, ...houseRepos(root, home).repos.map((r) => r.path)]
|
|
240
|
+
const keychains = (): string[] => Bun.spawnSync(['security', 'list-keychains', '-d', 'user'], { stdout: 'pipe', stderr: 'ignore' }).stdout.toString().split('\n').map((l) => l.trim().replace(/^"|"$/g, '')).filter((l) => l !== '')
|
|
241
|
+
return homeMove({ home, go: this.go, back: this.back, print: io(this).print, agents: agentsDir(home), running: () => whoRuns(home, agentsDir(home)), repos: [...new Set(repos)], keychains })
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
217
245
|
export class GuiCommand extends Command {
|
|
218
246
|
static override paths = [['gui']]
|
|
219
247
|
|