rvlib-shipkit 2.30.0 → 2.31.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 +15 -0
- package/README.md +15 -0
- package/package.json +1 -1
- package/src/advisors/acts.ts +174 -83
- package/src/advisors/advice.ts +201 -24
- package/src/advisors/advisor-view.ts +60 -12
- package/src/advisors/app-graph.ts +7 -1
- package/src/advisors/cf-api.ts +44 -0
- package/src/advisors/copy-truth.ts +49 -0
- package/src/advisors/dir-bucket.ts +69 -0
- package/src/advisors/door-child.ts +112 -0
- package/src/advisors/door-probe.ts +88 -0
- package/src/advisors/door-serve.ts +52 -0
- package/src/advisors/door.ts +82 -23
- package/src/advisors/edge/api.ts +14 -7
- package/src/advisors/edge/bucket.ts +10 -1
- package/src/advisors/edge/handler.ts +85 -44
- package/src/advisors/edge/here.ts +63 -0
- package/src/advisors/edge/pages.ts +87 -0
- package/src/advisors/edge/shell.ts +5 -3
- package/src/advisors/edge/sign-in.ts +144 -0
- package/src/advisors/edge/status.ts +28 -6
- package/src/advisors/edge/types.ts +25 -17
- package/src/advisors/expose.ts +225 -119
- package/src/advisors/here.ts +66 -0
- package/src/advisors/invite-send.ts +176 -0
- package/src/advisors/invite.ts +49 -0
- package/src/advisors/job.ts +89 -11
- package/src/advisors/login.ts +66 -0
- package/src/advisors/owner-name.ts +37 -0
- package/src/advisors/owner-store.ts +267 -62
- package/src/advisors/photos.ts +10 -50
- package/src/advisors/project.ts +92 -48
- package/src/advisors/rights.ts +152 -0
- package/src/advisors/routes.ts +321 -89
- package/src/advisors/scan.ts +28 -2
- package/src/advisors/setup-run.ts +132 -0
- package/src/advisors/share-trace.ts +78 -0
- package/src/advisors/sync.ts +197 -82
- package/src/advisors/tunnel.ts +118 -0
- package/src/advisors/users-router.ts +186 -0
- package/src/agent-time/accounts-usage-disk.ts +45 -3
- package/src/agent-time/claude-sessions.ts +63 -3
- package/src/agent-time/registry.ts +130 -46
- package/src/agent-time/store.ts +195 -32
- package/src/annex/born.ts +2 -9
- package/src/asks/ask-carry.ts +14 -7
- package/src/asks/ask-edit.ts +49 -0
- package/src/asks/ask-since.ts +74 -0
- package/src/asks/ask-store.ts +70 -29
- package/src/asks/ask-words-fold.ts +2 -2
- package/src/checks/SK001-package-json-shape.check.ts +12 -3
- package/src/checks/SK003-claude-md-shape.check.ts +78 -20
- package/src/checks/SK004-gitignore-policy.check.ts +7 -4
- package/src/checks/SK008-reviewer-agent.check.ts +1 -1
- package/src/checks/SK012-config-barrel-import.check.ts +1 -1
- package/src/checks/SK032-ignored-inputs.check.ts +9 -5
- package/src/checks/SK036-draft-media-size.check.ts +4 -3
- package/src/checks/SK038-speaks-as.check.ts +6 -5
- package/src/checks/SK039-vscode-watch-generated.check.ts +5 -25
- package/src/checks/SK044-behind-upstream.check.ts +2 -1
- package/src/checks/SK052-url-old-words.check.ts +56 -0
- package/src/checks/SK053-tools.check.ts +46 -0
- package/src/checks/SK054-agent-allow-list.check.ts +142 -0
- package/src/cli/clip.ts +44 -0
- package/src/cli/cmd_Advisors.ts +310 -142
- package/src/cli/cmd_Annex.ts +1 -1
- package/src/cli/cmd_Asks.ts +124 -22
- package/src/cli/cmd_Assets.ts +1 -1
- package/src/cli/cmd_Backup.ts +26 -67
- package/src/cli/cmd_BackupTargets.ts +106 -0
- package/src/cli/cmd_Bump.ts +1 -1
- package/src/cli/cmd_CacheAudit.ts +1 -1
- package/src/cli/cmd_Calls.ts +1 -1
- package/src/cli/cmd_Capacity.ts +1 -1
- package/src/cli/cmd_Check.ts +2 -2
- package/src/cli/cmd_Checks.ts +2 -1
- package/src/cli/cmd_Ci.ts +1 -1
- package/src/cli/cmd_Commands.ts +1 -1
- package/src/cli/cmd_ConfigKeys.ts +1 -1
- package/src/cli/cmd_Contracts.ts +1 -1
- package/src/cli/cmd_CrossRepoActivity.ts +1 -6
- package/src/cli/cmd_Db.ts +47 -3
- package/src/cli/cmd_Drill.ts +1 -1
- package/src/cli/cmd_Drive.ts +259 -0
- package/src/cli/cmd_Fleet.ts +1 -1
- package/src/cli/cmd_FleetContext.ts +45 -0
- package/src/cli/cmd_FleetPush.ts +1 -1
- package/src/cli/cmd_FleetUpdate.ts +104 -0
- package/src/cli/cmd_GlobalContext.ts +1 -1
- package/src/cli/cmd_GlobalProcesses.ts +6 -4
- package/src/cli/cmd_History.ts +8 -27
- package/src/cli/cmd_Home.ts +4 -4
- package/src/cli/cmd_Hooks.ts +3 -12
- package/src/cli/cmd_Hq.ts +54 -80
- package/src/cli/cmd_Init.ts +1 -1
- package/src/cli/cmd_Insights.ts +1 -1
- package/src/cli/cmd_Keys.ts +1 -1
- package/src/cli/cmd_Lanes.ts +5 -4
- package/src/cli/cmd_Machines.ts +1 -1
- package/src/cli/cmd_Media.ts +6 -19
- package/src/cli/cmd_Messages.ts +1 -1
- package/src/cli/cmd_Mv.ts +1 -1
- package/src/cli/cmd_Needs.ts +1 -1
- package/src/cli/cmd_Orchestrator.ts +7 -16
- package/src/cli/cmd_OrchestratorRole.ts +10 -21
- package/src/cli/cmd_Overview.ts +1 -1
- package/src/cli/cmd_Pb.ts +1 -1
- package/src/cli/cmd_Planned.ts +1 -1
- package/src/cli/cmd_Rec.ts +1 -1
- package/src/cli/cmd_Reflect.ts +3 -3
- package/src/cli/cmd_Release.ts +1 -1
- package/src/cli/cmd_Releases.ts +1 -1
- package/src/cli/cmd_Review.ts +318 -204
- package/src/cli/cmd_Secret.ts +84 -2
- package/src/cli/cmd_Serve.ts +1 -1
- package/src/cli/cmd_Setup.ts +30 -0
- package/src/cli/cmd_Shot.ts +1 -1
- package/src/cli/cmd_Sign.ts +1 -1
- package/src/cli/cmd_Smoke.ts +1 -1
- package/src/cli/cmd_Social.ts +6 -3
- package/src/cli/cmd_SocialDrafts.ts +20 -6
- package/src/cli/cmd_Sound.ts +1 -1
- package/src/cli/cmd_Space.ts +4 -4
- package/src/cli/cmd_Start.ts +1 -1
- package/src/cli/cmd_Status.ts +1 -1
- package/src/cli/cmd_ThreadHolds.ts +1 -1
- package/src/cli/cmd_ThreadKinds.ts +1 -1
- package/src/cli/cmd_ThreadReflect.ts +3 -3
- package/src/cli/cmd_ThreadSyncNeeds.ts +1 -1
- package/src/cli/cmd_Time.ts +1 -1
- package/src/cli/cmd_Tmp.ts +1 -1
- package/src/cli/cmd_TraceAudit.ts +1 -1
- package/src/cli/cmd_Trailer.ts +1 -1
- package/src/cli/cmd_Tui.ts +1 -1
- package/src/cli/cmd_Urls.ts +61 -9
- package/src/cli/cmd_Vault.ts +1 -1
- package/src/cli/cmd_Veille.ts +1 -1
- package/src/cli/cmd_When.ts +1 -1
- package/src/cli/cmd_Wiki.ts +5 -2
- package/src/cli/cmd_Worktrees.ts +1 -1
- package/src/cli/family-pages.ts +1 -0
- package/src/cli/inbox-hook-run.ts +46 -20
- package/src/cli/line.ts +131 -0
- package/src/cli/registry-cli.ts +100 -0
- package/src/cli/registry-heads.ts +448 -0
- package/src/cli/registry.ts +385 -254
- package/src/cli/review-here.ts +4 -4
- package/src/cli.ts +45 -33
- package/src/collections/collection-types.ts +3 -0
- package/src/collections/providers.ts +6 -3
- package/src/collections/review.ts +3 -4
- package/src/context/context-line.ts +29 -0
- package/src/context/context-view.ts +34 -0
- package/src/context/project-context.ts +144 -0
- package/src/core/agent-allow-policy.ts +99 -0
- package/src/core/agent-spawn.ts +2 -0
- package/src/core/capacity.ts +3 -2
- package/src/core/daemon-port.ts +10 -0
- package/src/core/es2022.ts +19 -0
- package/src/core/footprint.ts +35 -0
- package/src/core/git-bin.ts +18 -0
- package/src/core/git-root.ts +40 -4
- package/src/core/git.ts +22 -0
- package/src/core/hard-reset.ts +7 -1
- package/src/core/house-config-text.ts +47 -0
- package/src/core/house-layout.ts +4 -0
- package/src/core/identities-path.ts +67 -0
- package/src/core/identities-root.ts +26 -0
- package/src/core/instance.ts +1 -1
- package/src/core/jobs.ts +1 -4
- package/src/core/layout.ts +3 -0
- package/src/core/loop-watch.ts +28 -5
- package/src/core/machine-db.ts +1 -8
- package/src/core/machine-name.ts +31 -0
- package/src/core/memory-watch.ts +56 -8
- package/src/core/on-loop.ts +10 -7
- package/src/core/pid-alive.ts +11 -0
- package/src/core/proc-path.ts +42 -0
- package/src/core/retention.ts +2 -2
- package/src/core/role-policy.ts +6 -7
- package/src/core/run-dirs.ts +2 -5
- package/src/core/runs.ts +5 -3
- package/src/core/scope.ts +44 -0
- package/src/core/scratch-objects.ts +1 -1
- package/src/core/slot-env.ts +4 -0
- package/src/core/slots.ts +2 -2
- package/src/core/spawn-timeout.ts +9 -3
- package/src/core/tools.ts +20 -0
- package/src/core/tree-watch.ts +304 -0
- package/src/core/window-policy.ts +132 -0
- package/src/drives/context.ts +29 -0
- package/src/drives/drives-view.ts +121 -0
- package/src/drives/file.ts +89 -0
- package/src/drives/local-folder.ts +107 -0
- package/src/drives/login.ts +181 -0
- package/src/drives/named.ts +33 -0
- package/src/drives/rclone.ts +100 -0
- package/src/drives/reach.ts +73 -0
- package/src/drives/routes.ts +89 -0
- package/src/drives/shares.ts +292 -0
- package/src/fleet/context-fleet.ts +83 -0
- package/src/fleet/follow.ts +172 -0
- package/src/gate/builtin-checks-dir.ts +32 -0
- package/src/gate/discover-checks.ts +9 -32
- package/src/gate/pre-commit-discovery.ts +214 -24
- package/src/gate/run-fixers.ts +8 -0
- package/src/home/advisors-tunnel-start.ts +9 -0
- package/src/home/autostart.ts +61 -17
- package/src/home/backup-status.ts +366 -0
- package/src/home/backup-verdict.ts +19 -0
- package/src/home/daemon-jobs.ts +188 -45
- package/src/home/database-words.ts +19 -2
- package/src/home/databases.ts +72 -25
- package/src/home/drives-deps.ts +54 -0
- package/src/home/follow-run.ts +146 -0
- package/src/home/global-context.ts +26 -22
- package/src/home/global-units.ts +3 -1
- package/src/home/gui-app/ShipkitGui.swift +1595 -17
- package/src/home/gui-app.ts +12 -16
- package/src/home/handoff.ts +5 -3
- package/src/home/handover.ts +2 -10
- package/src/home/home-paths.ts +16 -7
- package/src/home/home-routes.ts +99 -29
- package/src/home/inbox-shape.ts +3 -3
- package/src/home/machine-fold.ts +2 -10
- package/src/home/machine-host.ts +3 -17
- package/src/home/machine-stores.ts +8 -7
- package/src/home/owner-switch-route.ts +33 -0
- package/src/home/page-build.ts +20 -4
- package/src/home/page-files.ts +79 -0
- package/src/home/pm-switch.ts +10 -0
- package/src/home/pm.ts +13 -1
- package/src/home/process-apps.ts +15 -3
- package/src/home/push-sources.ts +17 -5
- package/src/home/resume.ts +8 -6
- package/src/home/run-daemon.ts +69 -6
- package/src/home/run-pm.ts +3 -3
- package/src/home/secrets-context.ts +119 -0
- package/src/home/serve-web.ts +12 -7
- package/src/home/shipkit-mark.ts +26 -0
- package/src/home/space-page.ts +1 -1
- package/src/home/space-route.ts +3 -10
- package/src/home/supervise.ts +2 -9
- package/src/home/vault-page.ts +39 -18
- package/src/home/vault-reveal.ts +2 -1
- package/src/home/web-places.ts +5 -3
- package/src/hooks/commit-run.ts +420 -0
- package/src/hooks/git-hook.ts +49 -0
- package/src/hooks/held-calls.ts +104 -0
- package/src/hooks/hook-config.ts +104 -0
- package/src/hooks/hook-gates.ts +15 -9
- package/src/hooks/leak-guard.ts +15 -14
- package/src/hooks/one-way-in-guard.ts +12 -3
- package/src/hooks/pre-commit-checks.ts +64 -0
- package/src/hooks/root-identity.ts +15 -18
- package/src/hooks/run-hooks.ts +123 -296
- package/src/hooks/shared-file.ts +18 -15
- package/src/hooks/shell-writes.ts +6 -100
- package/src/hooks/staged.ts +245 -18
- package/src/hooks/write-log.ts +122 -28
- package/src/house/project-gutter.ts +32 -8
- package/src/hq/backup-targets.ts +74 -0
- package/src/hq/daemon-db.ts +177 -0
- package/src/hq/door-route.ts +5 -5
- package/src/hq/door.ts +30 -16
- package/src/hq/files-send.ts +23 -17
- package/src/hq/follow-fact.ts +66 -0
- package/src/hq/forgotten-log.ts +3 -1
- package/src/hq/history-check.ts +9 -0
- package/src/hq/history-send.ts +6 -22
- package/src/hq/holds-shape.ts +42 -0
- package/src/hq/hq-db.ts +16 -26
- package/src/hq/hq-holds.ts +181 -0
- package/src/hq/hq-local.ts +66 -47
- package/src/hq/hq-role.ts +150 -0
- package/src/hq/hq-routes.ts +15 -3
- package/src/hq/hq-store.ts +43 -10
- package/src/hq/item-direct.ts +57 -0
- package/src/hq/item-shapes.ts +54 -0
- package/src/hq/kinds/index.ts +2 -1
- package/src/hq/kinds/item-gone.ts +20 -12
- package/src/hq/kinds/item-msg.ts +21 -6
- package/src/hq/kinds/item.ts +22 -13
- package/src/hq/kinds/items-read.ts +4 -0
- package/src/hq/kinds/kind.ts +9 -0
- package/src/hq/kinds/presence.ts +21 -3
- package/src/hq/kinds/prompt.ts +1 -0
- package/src/hq/kinds/reflection.ts +1 -0
- package/src/hq/kinds/report.ts +8 -3
- package/src/hq/kinds/thread-event.ts +105 -0
- package/src/hq/lead-order.ts +5 -5
- package/src/hq/machine-key.ts +10 -3
- package/src/hq/machine-notes.ts +3 -2
- package/src/hq/outbox.ts +2 -153
- package/src/hq/owner-switch.ts +61 -0
- package/src/hq/replica.ts +165 -18
- package/src/hq/report-facts.ts +26 -3
- package/src/hq/report.ts +30 -6
- package/src/hq/shapes-words.ts +31 -0
- package/src/hq/switch.ts +29 -60
- package/src/hq/terminal-hop.ts +1 -1
- package/src/hq/thread-events.ts +91 -0
- package/src/hq/thread-sync.ts +29 -48
- package/src/http/door-forward.ts +3 -3
- package/src/http/hop-names.ts +3 -3
- package/src/http/owner-word.ts +7 -2
- package/src/identities/collection.ts +2 -3
- package/src/identities/identities.ts +43 -6
- package/src/init-repo.ts +12 -0
- package/src/ledger/db.ts +19 -6
- package/src/ledger/git-scan.ts +23 -9
- package/src/ledger/live-runs.ts +1 -12
- package/src/ledger/record-kept.ts +40 -12
- package/src/ledger/run-log.ts +2 -1
- package/src/media-store/backup/daemon.ts +37 -22
- package/src/media-store/backup/facts.ts +63 -0
- package/src/media-store/backup/prune.ts +2 -5
- package/src/media-store/backup/restore.ts +15 -4
- package/src/media-store/backup/retention.ts +2 -2
- package/src/media-store/backup/sources.ts +23 -105
- package/src/media-store/backup/ssh-space.ts +202 -0
- package/src/media-store/backup/ssh-target.ts +74 -0
- package/src/media-store/backup/target-send.ts +162 -0
- package/src/media-store/backup/watch.ts +26 -19
- package/src/media-store/copy/config.ts +5 -4
- package/src/media-store/copy/copy.ts +11 -6
- package/src/media-store/copy/proof.ts +17 -10
- package/src/media-store/copy/snapshot.ts +29 -22
- package/src/media-store/copy/store.ts +2 -10
- package/src/media-store/copy/stream.ts +7 -2
- package/src/media-store/daemon.ts +8 -5
- package/src/media-store/db.ts +6 -1
- package/src/media-store/forget-one.ts +14 -3
- package/src/media-store/hq-find.ts +1 -3
- package/src/media-store/hq-send.ts +4 -5
- package/src/orchestrator/brief.md +1 -1
- package/src/orchestrator/guards.ts +0 -3
- package/src/orchestrator/lead-shape.ts +5 -4
- package/src/orchestrator/now.ts +1 -1
- package/src/orchestrator/places-look.ts +45 -17
- package/src/orchestrator/places-shape.ts +17 -2
- package/src/orchestrator/places.ts +1 -1
- package/src/orchestrator/presence.ts +15 -5
- package/src/orchestrator/role-shape.ts +12 -21
- package/src/orchestrator/role.ts +7 -58
- package/src/orchestrator/routes.ts +26 -17
- package/src/orchestrator/sessions-shape.ts +48 -3
- package/src/orchestrator/sessions.ts +5 -8
- package/src/orchestrator/start.ts +3 -10
- package/src/orchestrator/started.ts +1 -1
- package/src/orchestrator/talk-key.ts +21 -0
- package/src/orchestrator/unheard.ts +1 -1
- package/src/recordings/recorder-app/Editor.swift +6 -0
- package/src/recordings/recorder-app/main.swift +3 -0
- package/src/reflections/reflection-close.ts +2 -1
- package/src/reflections/reflections-queue.ts +9 -6
- package/src/release/public-clean.ts +40 -15
- package/src/repo-config.ts +18 -6
- package/src/review/answer-kinds.ts +15 -3
- package/src/review/band.ts +53 -16
- package/src/review/cell-copy.ts +27 -0
- package/src/review/cells.ts +246 -35
- package/src/review/events.ts +24 -4
- package/src/review/expect.ts +128 -0
- package/src/review/file-tags.ts +9 -0
- package/src/review/folders.ts +216 -0
- package/src/review/format.ts +113 -25
- package/src/review/gone.ts +10 -86
- package/src/review/hook-ask.ts +58 -0
- package/src/review/inbox-hook.ts +6 -3
- package/src/review/inbox-read.ts +81 -13
- package/src/review/instruction-guards.ts +56 -1
- package/src/review/instructions.ts +25 -1
- package/src/review/item-db.ts +112 -28
- package/src/review/item-hq.ts +119 -0
- package/src/review/item-rows.ts +96 -52
- package/src/review/kind-catalog.ts +2 -0
- package/src/review/kinds.ts +7 -4
- package/src/review/live-post.ts +20 -6
- package/src/review/live-view.ts +18 -1
- package/src/review/media-away.ts +35 -0
- package/src/review/mentions.ts +3 -6
- package/src/review/model.ts +124 -12
- package/src/review/notes.ts +4 -4
- package/src/review/object-read.ts +26 -7
- package/src/review/parties.ts +16 -0
- package/src/review/phone-push.ts +11 -10
- package/src/review/previews-job.ts +49 -0
- package/src/review/previews.ts +50 -28
- package/src/review/push.ts +24 -40
- package/src/review/referring.ts +2 -2
- package/src/review/reflection-object.ts +24 -11
- package/src/review/refs.ts +143 -0
- package/src/review/reply-guards.ts +71 -0
- package/src/review/routes.ts +87 -31
- package/src/review/search-index.ts +6 -10
- package/src/review/search-job.ts +4 -6
- package/src/review/search-ocr.ts +1 -1
- package/src/review/secret-route.ts +13 -9
- package/src/review/store-index.ts +1 -1
- package/src/review/store.ts +171 -556
- package/src/review/supersede.ts +3 -3
- package/src/review/take-back.ts +1 -2
- package/src/review/thread-code.ts +101 -0
- package/src/review/thread-md.ts +127 -0
- package/src/review/thread-query.ts +67 -0
- package/src/review/threads.ts +91 -16
- package/src/review/traces.ts +17 -5
- package/src/review/verdict-items.ts +4 -4
- package/src/review/view-layout.ts +3 -0
- package/src/review/wait.ts +2 -2
- package/src/review/wakes.ts +7 -3
- package/src/review/watchers.ts +1 -10
- package/src/review/working-guards.ts +39 -0
- package/src/scaffold/jsonc-spans.ts +42 -0
- package/src/scaffold/starter-house.ts +85 -0
- package/src/secrets/about-words.ts +33 -0
- package/src/secrets/archive.ts +2 -2
- package/src/secrets/audit-run.ts +53 -0
- package/src/secrets/audit.ts +407 -0
- package/src/secrets/changed-mark.ts +15 -0
- package/src/secrets/clip.ts +29 -0
- package/src/secrets/held.ts +4 -4
- package/src/secrets/lapse.ts +1 -1
- package/src/secrets/list.ts +9 -4
- package/src/secrets/read.ts +5 -1
- package/src/secrets/ref-state.ts +18 -0
- package/src/secrets/registry-rows.ts +18 -0
- package/src/secrets/secret-ref.ts +42 -0
- package/src/secrets/token-siblings.ts +60 -0
- package/src/secrets/who-reads.ts +25 -20
- package/src/serve/frame-part.ts +2 -1
- package/src/serve/hook-thread.ts +37 -0
- package/src/serve/hook-work.ts +92 -0
- package/src/serve/hook-worker.ts +57 -0
- package/src/serve/hub-app/activity-view.tsx +6 -6
- package/src/serve/hub-app/admin-view.tsx +7 -6
- package/src/serve/hub-app/advisor-app.tsx +77 -14
- package/src/serve/hub-app/advisor-face.tsx +21 -7
- package/src/serve/hub-app/advisor-host.ts +102 -10
- package/src/serve/hub-app/advisors-model.ts +234 -0
- package/src/serve/hub-app/advisors-rights.tsx +66 -0
- package/src/serve/hub-app/advisors-st.ts +430 -34
- package/src/serve/hub-app/advisors-view.tsx +330 -233
- package/src/serve/hub-app/advisors.css +134 -21
- package/src/serve/hub-app/app-bridge.ts +95 -5
- package/src/serve/hub-app/ask-steps.tsx +6 -3
- package/src/serve/hub-app/auto-text.tsx +44 -4
- package/src/serve/hub-app/backups-st.ts +55 -0
- package/src/serve/hub-app/backups-view.tsx +115 -0
- package/src/serve/hub-app/backups.css +33 -0
- package/src/serve/hub-app/card-head.tsx +1 -1
- package/src/serve/hub-app/check-view.tsx +7 -7
- package/src/serve/hub-app/col-card.tsx +4 -4
- package/src/serve/hub-app/col-list-page.tsx +2 -1
- package/src/serve/hub-app/col-tables.ts +5 -4
- package/src/serve/hub-app/comfy-view.tsx +1 -1
- package/src/serve/hub-app/commands/commands-page.tsx +2 -2
- package/src/serve/hub-app/controls.css +23 -2
- package/src/serve/hub-app/cycle-button.tsx +2 -2
- package/src/serve/hub-app/database-st.ts +40 -11
- package/src/serve/hub-app/database-view.tsx +67 -2
- package/src/serve/hub-app/database.css +3 -0
- package/src/serve/hub-app/dock-view.tsx +1 -1
- package/src/serve/hub-app/drives-page.tsx +309 -0
- package/src/serve/hub-app/drives-st.ts +486 -0
- package/src/serve/hub-app/drives.css +122 -0
- package/src/serve/hub-app/editor/doc-editor.tsx +4 -3
- package/src/serve/hub-app/empty-section.tsx +1 -1
- package/src/serve/hub-app/entry-list.tsx +1 -1
- package/src/serve/hub-app/floating.tsx +0 -1
- package/src/serve/hub-app/frame-refusal.ts +13 -0
- package/src/serve/hub-app/geometry-view.tsx +3 -3
- package/src/serve/hub-app/hash-route.ts +12 -5
- package/src/serve/hub-app/header-bar.tsx +2 -1
- package/src/serve/hub-app/home-pages.ts +40 -0
- package/src/serve/hub-app/home-st.ts +8 -1
- package/src/serve/hub-app/home-strip.tsx +22 -20
- package/src/serve/hub-app/home.html +2 -1
- package/src/serve/hub-app/hub-app.tsx +16 -3
- package/src/serve/hub-app/hub.css +72 -5
- package/src/serve/hub-app/icons.tsx +8 -0
- package/src/serve/hub-app/identities-view.tsx +5 -4
- package/src/serve/hub-app/inbox-view.tsx +10 -10
- package/src/serve/hub-app/index.html +2 -1
- package/src/serve/hub-app/insights-view.tsx +8 -8
- package/src/serve/hub-app/keys.ts +31 -11
- package/src/serve/hub-app/layout-st.ts +4 -1
- package/src/serve/hub-app/lightbox-zoom.css +29 -19
- package/src/serve/hub-app/list-filter.tsx +46 -5
- package/src/serve/hub-app/live-socket.ts +12 -6
- package/src/serve/hub-app/live-sources.ts +137 -66
- package/src/serve/hub-app/machine-groups.ts +87 -0
- package/src/serve/hub-app/machines-st.ts +100 -3
- package/src/serve/hub-app/machines-view.tsx +50 -3
- package/src/serve/hub-app/machines.css +22 -0
- package/src/serve/hub-app/main-panel.css +16 -10
- package/src/serve/hub-app/main-panel.tsx +6 -8
- package/src/serve/hub-app/markdown.css +12 -2
- package/src/serve/hub-app/md.ts +60 -18
- package/src/serve/hub-app/media-view.tsx +21 -12
- package/src/serve/hub-app/messages/messages-page.tsx +15 -6
- package/src/serve/hub-app/new-thread.tsx +6 -3
- package/src/serve/hub-app/orchestrator-line.tsx +1 -1
- package/src/serve/hub-app/orchestrator-places.tsx +28 -2
- package/src/serve/hub-app/orchestrator.css +5 -0
- package/src/serve/hub-app/page-keys.ts +4 -1
- package/src/serve/hub-app/pages-frames.tsx +2 -1
- package/src/serve/hub-app/palette-st.ts +285 -60
- package/src/serve/hub-app/palette-view.tsx +96 -18
- package/src/serve/hub-app/pane-boundary.tsx +3 -2
- package/src/serve/hub-app/panel-head.tsx +1 -1
- package/src/serve/hub-app/panel-source.ts +16 -5
- package/src/serve/hub-app/panel-tint.ts +3 -18
- package/src/serve/hub-app/panel-walk.ts +1 -1
- package/src/serve/hub-app/pic.tsx +37 -0
- package/src/serve/hub-app/pick-kinds.ts +101 -0
- package/src/serve/hub-app/places-svc.ts +44 -10
- package/src/serve/hub-app/plan-view.tsx +2 -2
- package/src/serve/hub-app/planned-view.tsx +6 -5
- package/src/serve/hub-app/polled.ts +17 -6
- package/src/serve/hub-app/presence-st.ts +9 -1
- package/src/serve/hub-app/processes-view.tsx +16 -10
- package/src/serve/hub-app/project-bar.tsx +85 -29
- package/src/serve/hub-app/project-list.tsx +7 -19
- package/src/serve/hub-app/projects-svc.ts +50 -20
- package/src/serve/hub-app/rail-groups.ts +1 -0
- package/src/serve/hub-app/recordings-view.tsx +26 -26
- package/src/serve/hub-app/ref-list-slot.ts +10 -0
- package/src/serve/hub-app/ref-pill.ts +58 -0
- package/src/serve/hub-app/reflections-page.tsx +3 -3
- package/src/serve/hub-app/releases/releases-page.tsx +6 -6
- package/src/serve/hub-app/repo-mark.tsx +29 -0
- package/src/serve/hub-app/repo-sections.ts +16 -9
- package/src/serve/hub-app/repo-st.ts +67 -14
- package/src/serve/hub-app/review/advisor-add.tsx +155 -0
- package/src/serve/hub-app/review/advisor-bar.tsx +92 -22
- package/src/serve/hub-app/review/advisor-invite.tsx +66 -0
- package/src/serve/hub-app/review/ask-proof.tsx +4 -3
- package/src/serve/hub-app/review/attach-view.tsx +7 -6
- package/src/serve/hub-app/review/box-view.ts +35 -18
- package/src/serve/hub-app/review/box-zoom.tsx +1 -1
- package/src/serve/hub-app/review/copy-button.tsx +29 -0
- package/src/serve/hub-app/review/diff-mode.ts +41 -0
- package/src/serve/hub-app/review/diff-view.tsx +92 -19
- package/src/serve/hub-app/review/doc-body.tsx +2 -2
- package/src/serve/hub-app/review/dock.tsx +51 -23
- package/src/serve/hub-app/review/draft-body.tsx +2 -2
- package/src/serve/hub-app/review/group-block.tsx +8 -8
- package/src/serve/hub-app/review/instructions-view.tsx +3 -9
- package/src/serve/hub-app/review/item-verdict.tsx +1 -0
- package/src/serve/hub-app/review/kind-view.tsx +13 -19
- package/src/serve/hub-app/review/kit.tsx +16 -8
- package/src/serve/hub-app/review/lane-bar.tsx +1 -1
- package/src/serve/hub-app/review/lightbox.tsx +1 -1
- package/src/serve/hub-app/review/line-window.ts +51 -8
- package/src/serve/hub-app/review/live-bar.tsx +5 -2
- package/src/serve/hub-app/review/live-view.tsx +11 -11
- package/src/serve/hub-app/review/mention-st.ts +9 -38
- package/src/serve/hub-app/review/object-panel.tsx +39 -14
- package/src/serve/hub-app/review/outbox-st.ts +200 -0
- package/src/serve/hub-app/review/pano-view.tsx +2 -2
- package/src/serve/hub-app/review/phone-top.tsx +2 -1
- package/src/serve/hub-app/review/question-views.tsx +172 -40
- package/src/serve/hub-app/review/review-cells.tsx +200 -43
- package/src/serve/hub-app/review/review-host.ts +10 -1
- package/src/serve/hub-app/review/review-kit.ts +21 -5
- package/src/serve/hub-app/review/review-list.tsx +44 -83
- package/src/serve/hub-app/review/review-page.tsx +6 -5
- package/src/serve/hub-app/review/review-st.ts +87 -33
- package/src/serve/hub-app/review/review-thread.tsx +276 -156
- package/src/serve/hub-app/review/review-views.tsx +101 -63
- package/src/serve/hub-app/review/secret-facts.ts +2 -1
- package/src/serve/hub-app/review/share-lines.tsx +40 -0
- package/src/serve/hub-app/review/start-st.ts +137 -0
- package/src/serve/hub-app/review/start-thread.tsx +104 -0
- package/src/serve/hub-app/review/superseded-runs.ts +20 -2
- package/src/serve/hub-app/review/thread-close.tsx +1 -1
- package/src/serve/hub-app/review/thread-control.tsx +5 -4
- package/src/serve/hub-app/review/thread-st.ts +254 -40
- package/src/serve/hub-app/review/thread-views.ts +3 -2
- package/src/serve/hub-app/review/trailer-body.tsx +6 -6
- package/src/serve/hub-app/review/trailer-page.tsx +33 -33
- package/src/serve/hub-app/review/trailer-voices.tsx +10 -10
- package/src/serve/hub-app/review/zoom-still.tsx +60 -0
- package/src/serve/hub-app/review.css +179 -56
- package/src/serve/hub-app/row-acts.tsx +2 -0
- package/src/serve/hub-app/row-face.tsx +0 -1
- package/src/serve/hub-app/run-page.tsx +236 -0
- package/src/serve/hub-app/running-rows.tsx +2 -2
- package/src/serve/hub-app/search-view.tsx +1 -1
- package/src/serve/hub-app/secret-cli.tsx +32 -0
- package/src/serve/hub-app/secret-readable.tsx +59 -0
- package/src/serve/hub-app/secret-refs.ts +173 -0
- package/src/serve/hub-app/secrets-page.tsx +2 -2
- package/src/serve/hub-app/section-head.tsx +3 -1
- package/src/serve/hub-app/seen-rows.ts +72 -0
- package/src/serve/hub-app/shared-faces.tsx +32 -0
- package/src/serve/hub-app/side-frame-view.tsx +115 -0
- package/src/serve/hub-app/side-frame.ts +120 -0
- package/src/serve/hub-app/site/site-part.tsx +7 -7
- package/src/serve/hub-app/social/calendar.tsx +1 -1
- package/src/serve/hub-app/social/comms-page.tsx +3 -3
- package/src/serve/hub-app/social/copy-forms.ts +31 -0
- package/src/serve/hub-app/social/kit.tsx +42 -23
- package/src/serve/hub-app/social/post-card.tsx +5 -5
- package/src/serve/hub-app/social/post-page.tsx +2 -2
- package/src/serve/hub-app/social/social-page.tsx +31 -12
- package/src/serve/hub-app/social/social-st.ts +8 -2
- package/src/serve/hub-app/social/stage-popup.tsx +6 -6
- package/src/serve/hub-app/social.css +7 -1
- package/src/serve/hub-app/source-page.tsx +2 -0
- package/src/serve/hub-app/space-view.tsx +3 -3
- package/src/serve/hub-app/stores/stores-page.tsx +18 -17
- package/src/serve/hub-app/terminal-gone.tsx +41 -0
- package/src/serve/hub-app/terminal-history-st.ts +3 -0
- package/src/serve/hub-app/terminal-list-st.ts +27 -3
- package/src/serve/hub-app/terminal-pages.tsx +50 -10
- package/src/serve/hub-app/terminal-panel.tsx +3 -3
- package/src/serve/hub-app/terminal-picture.ts +78 -0
- package/src/serve/hub-app/terminal-sources.tsx +318 -48
- package/src/serve/hub-app/terminal-st.ts +57 -2
- package/src/serve/hub-app/terminal-tab.tsx +2 -1
- package/src/serve/hub-app/terminal.css +5 -0
- package/src/serve/hub-app/test-view.tsx +2 -2
- package/src/serve/hub-app/tests-view.tsx +3 -3
- package/src/serve/hub-app/thread-row.tsx +12 -2
- package/src/serve/hub-app/time-charts.tsx +3 -2
- package/src/serve/hub-app/time-pages.tsx +3 -2
- package/src/serve/hub-app/time-view.tsx +6 -5
- package/src/serve/hub-app/timeline-chart.tsx +1 -1
- package/src/serve/hub-app/timeline-view.tsx +12 -4
- package/src/serve/hub-app/tree-build.ts +3 -3
- package/src/serve/hub-app/url-faces.ts +3 -4
- package/src/serve/hub-app/url-forms.tsx +112 -20
- package/src/serve/hub-app/url-needs.ts +31 -0
- package/src/serve/hub-app/urls-svc.ts +163 -25
- package/src/serve/hub-app/urls-view.tsx +74 -74
- package/src/serve/hub-app/urls.css +62 -5
- package/src/serve/hub-app/vault-view.tsx +13 -13
- package/src/serve/hub-app/veille/veille-page.tsx +12 -11
- package/src/serve/hub-app/view-layout.css +2 -0
- package/src/serve/hub-app/when-view.tsx +2 -2
- package/src/serve/hub-app/wikis-view.tsx +1 -1
- package/src/serve/hub-app/word-refs.ts +12 -0
- package/src/serve/hub-app/words.tsx +25 -8
- package/src/serve/picture-types.ts +10 -0
- package/src/serve/project-gutter-route.ts +18 -13
- package/src/serve/read-thread.ts +31 -12
- package/src/serve/read-worker.ts +7 -0
- package/src/serve/secret-ref-routes.ts +71 -0
- package/src/serve/serve-hub.ts +26 -1
- package/src/serve/terminal-claudes.ts +44 -7
- package/src/serve/terminal-guard.ts +5 -1
- package/src/serve/terminal-host.ts +5 -1
- package/src/serve/terminal-paste.ts +49 -0
- package/src/serve/terminal-record.ts +8 -2
- package/src/serve/terminal-route.ts +19 -6
- package/src/serve/tracked-watch.ts +13 -11
- package/src/setup-house.ts +333 -0
- package/src/shipkit-files.ts +14 -3
- package/src/shot/film-box.ts +1 -9
- package/src/social/discord-layout.ts +1 -1
- package/src/social/kind-pages.ts +11 -5
- package/src/social/media-limit.ts +18 -8
- package/src/social/media-of.ts +5 -5
- package/src/social/publish/discord.ts +1 -1
- package/src/social/routes.ts +6 -3
- package/src/start-repo.ts +5 -0
- package/src/suite/judge-suites.ts +9 -51
- package/src/suite/red-alone.ts +69 -0
- package/src/suite/suite-cli.ts +27 -26
- package/src/trailer/titles.ts +2 -2
- package/src/urls/added.ts +34 -15
- package/src/urls/fill.ts +127 -0
- package/src/urls/frame.ts +39 -0
- package/src/urls/places.ts +19 -13
- package/src/urls/routes.ts +30 -10
- package/src/urls/rows.ts +98 -23
- package/src/urls/totp.ts +121 -0
- package/src/urls/unit.ts +95 -36
- package/src/urls/write-routes.ts +141 -25
- package/src/vault/vault-import.ts +2 -9
- package/src/vault/vault-init.ts +2 -1
- package/src/vault/vault-restore.ts +1 -9
- package/src/veille/chrome.ts +8 -18
- package/src/veille/identity.ts +6 -5
- package/src/wiki/graph-page.ts +27 -37
- package/src/wiki/graph-positions.ts +13 -3
- package/src/wiki/graph-sim.ts +77 -0
- package/src/wiki/run-wiki.ts +12 -1
- package/src/advisors/edge/certs.ts +0 -20
- package/src/advisors/edge/jwt.ts +0 -76
- package/src/advisors/edge/worker.ts +0 -52
- package/src/advisors/r2.ts +0 -46
- package/src/cli/channel-run.ts +0 -17
- package/src/cli/cmd_Channel.ts +0 -43
- package/src/media-store/backup/thread-copy.ts +0 -343
- package/src/orchestrator/channel-declare.ts +0 -58
- package/src/orchestrator/channel.ts +0 -226
- package/src/review/move.ts +0 -492
- package/src/serve/hub-app/panel-tint.css +0 -6
package/src/cli/cmd_Review.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// sk thread: an agent shows the owner something as a version in its thread and reads his answer; a dispatcher routes
|
|
2
2
|
// what he, a player or a rule raised, a worker claims and closes it (review/store.ts, wiki tools/shipkit/threads.md).
|
|
3
3
|
// Every module loads inside execute: the cli registers this file on every `sk` call
|
|
4
|
-
import { Command, Option } from '
|
|
4
|
+
import { Command, Option } from './clip.ts'
|
|
5
5
|
import type { AnswerKind } from '../review/model.ts'
|
|
6
6
|
import { holdsThread, laneOfCaller, maySee } from '../review/parties.ts'
|
|
7
7
|
import { realGit } from '../core/git.ts'
|
|
@@ -83,11 +83,30 @@ async function idOf(dir: string, ref: string, one?: { verb: string; objects?: bo
|
|
|
83
83
|
|
|
84
84
|
/** an address an agent starts a thread on or links: its kind word must be one a kind declares (the repo's or the
|
|
85
85
|
* house's, `sk thread kinds`), so one subject never becomes two threads under two words */
|
|
86
|
-
async function declaredOrThrow(h: Here, a: string): Promise<
|
|
86
|
+
async function declaredOrThrow(h: Here, a: string): Promise<string> {
|
|
87
87
|
const { readAll } = await import('../review/store.ts')
|
|
88
|
-
const { addressRefusal } = await import('../review/threads.ts')
|
|
89
|
-
const
|
|
88
|
+
const { addressRefusal, ownAddressesOf, threadOfAddress } = await import('../review/threads.ts')
|
|
89
|
+
const items = readAll(h.dir).items
|
|
90
|
+
// only `sk ask` opens an ask's thread: an ask address no thread owns (a wrong number, a typo) never starts one
|
|
91
|
+
if (a.startsWith('ask:')) {
|
|
92
|
+
const t = threadOfAddress(a, items, h.say.spec)
|
|
93
|
+
if (t === null) throw new Error(await noAsk(h, a))
|
|
94
|
+
// `ask:21` is written as the address its thread owns, so a version never starts a second thread
|
|
95
|
+
return ownAddressesOf(t, h.say.spec).find((x) => x.startsWith('ask:')) ?? a
|
|
96
|
+
}
|
|
97
|
+
const why = addressRefusal(a, items, h.say.spec)
|
|
90
98
|
if (why !== null) throw new Error(why)
|
|
99
|
+
return a
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** why an ask address names no ask, with the open asks nearest its number */
|
|
103
|
+
async function noAsk(h: Here, a: string): Promise<string> {
|
|
104
|
+
const { openAsks } = await import('../asks/ask-store.ts')
|
|
105
|
+
const { dirname } = await import('node:path')
|
|
106
|
+
const n = parseInt(a.slice('ask:'.length), 10)
|
|
107
|
+
const open = openAsks(dirname(dirname(h.dir)))
|
|
108
|
+
const near = [...open].sort((x, y) => (Number.isNaN(n) ? 0 : Math.abs(parseInt(x.id, 10) - n) - Math.abs(parseInt(y.id, 10) - n))).slice(0, 5)
|
|
109
|
+
return `no ask ${a.slice('ask:'.length)}: only sk ask opens an ask's thread, so nothing is written. ${near.length > 0 ? `The open asks nearest it: ${near.map((x) => `ask:${parseInt(x.id, 10)} « ${x.title} »`).join(', ')}` : 'No ask is open here'} (sk asks lists them)`
|
|
91
110
|
}
|
|
92
111
|
|
|
93
112
|
/** the item an act on `ref` goes on: an id's, or the newest version of the thread its address has; an address no
|
|
@@ -182,7 +201,7 @@ export function takeViews(args: readonly string[]): { views: ViewInput[]; rest:
|
|
|
182
201
|
return { views, rest }
|
|
183
202
|
}
|
|
184
203
|
|
|
185
|
-
const ADD_VIEW_USAGE = 'add-view <id> "<label>" <a.png> [<b.png>] | --image <a.png> | --before <a.png> --after <b.png> | --video <clip> | --audio <sound> | --pano <360.png> | --splat <a.ply> [--image <poster.png>] | --mesh <a.glb> [--image <poster.png>] | --gallery <a.png> … [--label "<label>"] [--note "<text>"] [--keep]'
|
|
204
|
+
const ADD_VIEW_USAGE = 'add-view <id> "<label>" <a.png> [<b.png>] | --image <a.png> | --live [<label>] <url> | --before <a.png> --after <b.png> | --video <clip> | --audio <sound> | --pano <360.png> | --splat <a.ply> [--image <poster.png>] | --mesh <a.glb> [--image <poster.png>] | --gallery <a.png> … [--label "<label>"] [--note "<text>"] [--keep]'
|
|
186
205
|
const MEDIA_FILE = /\.(png|jpe?g|webp|gif|mp4|webm|mov|wav|mp3|flac|ogg|opus|m4a)$/i
|
|
187
206
|
|
|
188
207
|
/** one `--option` of a question: words, a media file, `<label>=<file>` or `<label>=<before>,<after>` (a gallery tile's
|
|
@@ -221,6 +240,16 @@ async function withPoster(view: ViewInput): Promise<{ view: ViewInput; drop: ()
|
|
|
221
240
|
}
|
|
222
241
|
}
|
|
223
242
|
|
|
243
|
+
/** add-view's args with `--live [<label>] <url>` taken out (review/live-post.ts takeLives): the id, the page alone in
|
|
244
|
+
* the view, its label the live one's, else --label, else « live page » */
|
|
245
|
+
export function addViewLive(rest: readonly string[], lives: readonly { label: string; url: string }[]): { id: string; view: ViewInput; repoFlags: Record<string, string[]> } {
|
|
246
|
+
const l = rest.indexOf('--label')
|
|
247
|
+
const label = lives[0]?.label || (l >= 0 ? rest[l + 1] : undefined) || 'live page'
|
|
248
|
+
const words = l < 0 ? [...rest] : rest.filter((_, i) => i !== l && i !== l + 1)
|
|
249
|
+
if (lives.length !== 1 || words.length !== 1 || words[0]!.startsWith('--')) throw new Error(`--live: one page a view, alone; add-view <id> --live [<label>] <url>`)
|
|
250
|
+
return { id: words[0]!, view: { label }, repoFlags: {} }
|
|
251
|
+
}
|
|
252
|
+
|
|
224
253
|
/** add-view's args: the positional form, or the view flags of add; a flag is never a label, `own` are the repo unit's flags */
|
|
225
254
|
export async function addViewArgs(args: readonly string[], own: readonly string[]): Promise<{ id: string; view: ViewInput; repoFlags: Record<string, string[]> }> {
|
|
226
255
|
const one: Record<string, string> = {}
|
|
@@ -305,7 +334,8 @@ function flagsOf(args: readonly string[], values: readonly string[], repeat: rea
|
|
|
305
334
|
}
|
|
306
335
|
|
|
307
336
|
const ADD_FLAGS = `flags:
|
|
308
|
-
--title "<title>" one short line: what he looks at (a lone "<title>" after the address is the same)
|
|
337
|
+
--title "<title>" one short line: what he looks at (a lone "<title>" after the address is the same); the first version's names the thread, a next version's is its own caption (left out: the one before it)
|
|
338
|
+
--rename a next version's --title renames the thread too, on purpose: a trace line in the thread says so
|
|
309
339
|
--what "<what>" what he sees now, one or two short lines: never the mechanics (why no before, an internal rename, how a count is computed)
|
|
310
340
|
--post "<line>" the public line for a post of it, what a user gets (the repo's guard reads it)
|
|
311
341
|
--changelog "<category>: <line>" its change in the release being filled: on his approval it lands in .shipkit/releases/next.md with the version's after picture (the repo's guard reads it)
|
|
@@ -321,7 +351,7 @@ const ADD_FLAGS = `flags:
|
|
|
321
351
|
--mesh <a.glb> a mesh he walks through, in the lightbox only; --image <poster.png> its still in the thread, else one shot now
|
|
322
352
|
--before <a.png> --after <b.png> a before and after: two images, two clips of one size, or two sounds
|
|
323
353
|
on an object of a kind: its states (a json file, or a git ref its kind reads, . the working tree); a kind whose page draws it gets a still of that page shot now, or --image <a.png> as that still; a state that names its "views" gets one still a view, --image <view>=<a.png> for one (repeat it)
|
|
324
|
-
--live [<label>] <url> a running page framed in the thread (repeat it), its shot taken now: what an advisor sees, and what shows while it loads or when it stops answering; a loopback, tailnet or https url
|
|
354
|
+
--live [<label>] <url> a running page framed in the thread (repeat it), its shot taken now: what an advisor sees, and what shows while it loads or when it stops answering; a loopback, tailnet or https url; a page of the hub itself: its shot and a link, never a frame
|
|
325
355
|
--label "<label>" the first view's label
|
|
326
356
|
--view "<label>" <a.png> [<b.png>] another view of the same subject (repeat it); --note "<text>" right after it: a line on that view
|
|
327
357
|
--choice the older form of a question: posts sk thread ask with each --view an option, and prints that form
|
|
@@ -437,7 +467,7 @@ export class ReviewAddCommand extends Command {
|
|
|
437
467
|
['one image', 'sk thread post screen:menu --title "the new menu" --what "the menu, bigger" --image shots/menu.png'],
|
|
438
468
|
['a report with a table: markdown, never a picture of text', 'sk thread post page:hub/speed --title "the hub, before and after" --what "every click under 50 ms" --md report.md'],
|
|
439
469
|
['a before and after', 'sk thread post asset:lamps --title "lamps lit" --what "..." --before a.png --after b.png'],
|
|
440
|
-
['the next version: the same address, the tool links it', 'sk thread post asset:lamps --title "lamps lit, warmer" --what "..." --image c.png'],
|
|
470
|
+
['the next version: the same address, the tool links it, the thread keeps its name', 'sk thread post asset:lamps --title "lamps lit, warmer" --what "..." --image c.png'],
|
|
441
471
|
['a pick among three voices, yours on the second', 'sk thread post asset:narrator --choice --pick 2 --title "the narrator" --what "..." --view "voice 0" a.flac --note "low, breathy" --view "voice 1" b.flac --view "voice 2" c.flac'],
|
|
442
472
|
['a 360° panorama he looks around in', 'sk thread post screen:hall --title "the hall in 360" --what "..." --pano hall-360.png'],
|
|
443
473
|
['a Gaussian splat he orbits, its poster shot now', 'sk thread post asset:hall --title "the hall as a splat" --what "..." --splat hall.ply'],
|
|
@@ -467,8 +497,11 @@ export class ReviewAddCommand extends Command {
|
|
|
467
497
|
const kindName = rest[rest.indexOf('--subject') + 1]
|
|
468
498
|
const kind = rest.includes('--subject') && kindName ? h.unit?.kinds?.[kindName] : undefined
|
|
469
499
|
const own = [...Object.keys(kind?.flags ?? {}), ...Object.keys(h.unit?.flags ?? {})]
|
|
470
|
-
const f = flagsOf(rest, ['title', 'what', 'post', 'changelog', 'rating', 'video', 'audio', 'pano', 'splat', 'mesh', 'before', 'after', 'label', 'topic', 'subject', 'commit', 'lane', 'supersedes', 'keeps', 'why', 'live', 'trailer', 'version', 'shots', 'pick', 'draft', 'on', 'md', 'html'], ['image', 'answers', 'about', ...own], ['new', 'wip', 'choice', 'keep', 'verdict'])
|
|
500
|
+
const f = flagsOf(rest, ['title', 'what', 'post', 'changelog', 'rating', 'video', 'audio', 'pano', 'splat', 'mesh', 'before', 'after', 'label', 'topic', 'subject', 'commit', 'lane', 'supersedes', 'keeps', 'why', 'live', 'trailer', 'version', 'shots', 'pick', 'draft', 'on', 'md', 'html'], ['image', 'answers', 'about', ...own], ['new', 'wip', 'choice', 'keep', 'verdict', 'rename'])
|
|
471
501
|
const o = f.one
|
|
502
|
+
// --what is one or two short lines: a wall goes as a document, --md, and needs no escape
|
|
503
|
+
const wall = o.what !== undefined ? (await import('../review/reply-guards.ts')).wallInWords(o.what, '--what', f.positionals[0] ?? '<address>', false) : null
|
|
504
|
+
if (wall !== null) throw new Error(wall)
|
|
472
505
|
// --image repeats only as the stills of a kind's page, one a view (<view>=<a.png>)
|
|
473
506
|
const images = f.many.image ?? []
|
|
474
507
|
if (images.length === 1) o.image = images[0]!
|
|
@@ -495,7 +528,7 @@ export class ReviewAddCommand extends Command {
|
|
|
495
528
|
if (o.on !== undefined && addressOrThrow(o.on) !== a) throw new Error(`${a} and --on ${o.on}: one address a version`)
|
|
496
529
|
o.on = a
|
|
497
530
|
}
|
|
498
|
-
if (o.on !== undefined) await declaredOrThrow(h, addressOrThrow(o.on))
|
|
531
|
+
if (o.on !== undefined) o.on = await declaredOrThrow(h, addressOrThrow(o.on))
|
|
499
532
|
for (const a of f.many.about ?? []) await declaredOrThrow(h, addressOrThrow(a))
|
|
500
533
|
// a lone word is the title, as `sk ask <title>` takes it; a media file never is
|
|
501
534
|
const [lone, ...more] = f.positionals
|
|
@@ -587,10 +620,12 @@ export class ReviewAddCommand extends Command {
|
|
|
587
620
|
...(f.on.has('new') ? { fresh: true } : {}),
|
|
588
621
|
...(f.on.has('choice') ? { choice: true } : {}),
|
|
589
622
|
...(f.on.has('keep') ? { keep: true } : {}),
|
|
623
|
+
...(f.on.has('rename') ? { rename: true as const } : {}),
|
|
590
624
|
...(o.pick !== undefined ? { agentPick: o.pick } : {}),
|
|
591
625
|
...(o.live !== undefined ? { image: wipViews[0]?.image ?? '', views: wipViews.slice(1), wip: { live: o.live } } : { views }),
|
|
592
626
|
}
|
|
593
627
|
const media = [o.image, o.video, o.audio, o.pano, o.splat, o.mesh, o.before, o.after, o.live, o.trailer, o.draft].some((v) => v !== undefined) || views.length > 0 || lives.length > 0 || states !== null || doc !== null
|
|
628
|
+
if (!media && input.on !== undefined && input.rename) throw new Error('--rename: a version renames its thread; words with no media are a reply in it and never rename it: post the version with its media, or leave --rename out')
|
|
594
629
|
if (!media && input.on !== undefined) return postWords(h, input.on, input.title, input.what, input.lane, f.on.has('verdict'))
|
|
595
630
|
// a version asks the owner's verdict always: the field says it, the flag changes nothing else
|
|
596
631
|
if (f.on.has('verdict')) input = { ...input, asksVerdict: true }
|
|
@@ -616,6 +651,12 @@ export class ReviewAddCommand extends Command {
|
|
|
616
651
|
})
|
|
617
652
|
if (still) await keepStill(h, item, still)
|
|
618
653
|
h.out(item.id)
|
|
654
|
+
if (item.rename !== true) {
|
|
655
|
+
const { readAll, captionLine } = await import('../review/store.ts')
|
|
656
|
+
const { membersOf, threadOfItem, threadsOf, threadTitle } = await import('../review/threads.ts')
|
|
657
|
+
const t = threadOfItem(item.id, threadsOf(readAll(h.dir).items, h.say.spec))
|
|
658
|
+
if (t !== null && membersOf(t).length > 1 && threadTitle(t).trim() !== item.title) h.err(captionLine(threadTitle(t).trim(), item.title))
|
|
659
|
+
}
|
|
619
660
|
// on stderr: a script reads the id alone on stdout
|
|
620
661
|
await saidIntoThread(h, item, o.supersedes !== undefined)
|
|
621
662
|
if (wipLine !== undefined) {
|
|
@@ -656,6 +697,10 @@ export class ReviewAddCommand extends Command {
|
|
|
656
697
|
const { liveWatchers } = await import('../review/watchers.ts')
|
|
657
698
|
const unheard = unheardLine(item, liveWatchers(h.dir))
|
|
658
699
|
if (unheard) h.err(unheard)
|
|
700
|
+
// last: the page he could open from the thread, when its kind runs one
|
|
701
|
+
const { liveHint } = await import('../review/live-post.ts')
|
|
702
|
+
const hint = liveHint(address, h.say.spec, { id: item.id, media, live: lives.length > 0 || o.live !== undefined })
|
|
703
|
+
if (hint) h.err(hint)
|
|
659
704
|
return 0
|
|
660
705
|
})
|
|
661
706
|
}
|
|
@@ -820,8 +865,27 @@ async function postWords(h: Here, address: string, title: string, what: string,
|
|
|
820
865
|
}
|
|
821
866
|
|
|
822
867
|
/** an agent's words in a thread, its image beside them; `verdict`: they wait for the owner's verdict (review/verdict-items.ts) */
|
|
823
|
-
|
|
868
|
+
/** an agent's words to the owner pass the wall guard, `long` the reason they may not; a hint when many lines carry no marker
|
|
869
|
+
* (review/reply-guards.ts) */
|
|
870
|
+
async function guardWords(h: { err: (s: string) => void }, text: string, verb: string, address: string, long: string | undefined): Promise<void> {
|
|
871
|
+
const { unmarkedHint, wallInWords } = await import('../review/reply-guards.ts')
|
|
872
|
+
if (long !== undefined && long.trim() === '') throw new Error('--long "<why>": the reason it is long, shown in the thread')
|
|
873
|
+
const wall = long === undefined ? wallInWords(text, verb, address) : null
|
|
874
|
+
if (wall !== null) throw new Error(wall)
|
|
875
|
+
const hint = unmarkedHint(text)
|
|
876
|
+
if (hint !== null) h.err(hint)
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
const LONG_FLAG = 'past the wall bound on purpose: why, a quiet mark under the words in the thread; a long text is a document (sk thread post <address> --md <file>)'
|
|
880
|
+
|
|
881
|
+
async function wordsIn(dir: string, id: string, who: string, text: string, verdict: boolean, image?: string, long?: string): Promise<import('../review/model.ts').Message> {
|
|
824
882
|
const { addMessage, appendMessage, readItem } = await import('../review/store.ts')
|
|
883
|
+
if (long !== undefined) {
|
|
884
|
+
const { textOf } = await import('../review/model.ts')
|
|
885
|
+
const t = textOf(text)
|
|
886
|
+
if ('error' in t) throw new Error(t.error)
|
|
887
|
+
return appendMessage(dir, id, { who, text: t.text, long: long.trim(), ...(verdict ? { asksVerdict: true as const } : {}) }, image !== undefined ? { image } : {})
|
|
888
|
+
}
|
|
825
889
|
if (!verdict) return addMessage(dir, id, who, text, image)
|
|
826
890
|
const { textOf } = await import('../review/model.ts')
|
|
827
891
|
if (!readItem(dir, id)) throw new Error(`no item ${id}`)
|
|
@@ -830,12 +894,31 @@ async function wordsIn(dir: string, id: string, who: string, text: string, verdi
|
|
|
830
894
|
return appendMessage(dir, id, { who, text: t.text, asksVerdict: true }, image !== undefined ? { image } : {})
|
|
831
895
|
}
|
|
832
896
|
|
|
897
|
+
/** what an agent asked in the thread of item `id` that still waits on the owner after its reply `mine`: the owner's words
|
|
898
|
+
* answer a question, a change or words asking the owner's verdict by themselves (model.ts wordsAnswerOf), so each line
|
|
899
|
+
* left is one his click answers or its agent takes back; never left open under a reply that says nothing more is needed */
|
|
900
|
+
async function stillOpenLines(dir: string, id: string, mine: string): Promise<string[]> {
|
|
901
|
+
const { readAll } = await import('../review/store.ts')
|
|
902
|
+
const { openAsksOf, openItemVerdictsOf, threadOfItem, threadsOf } = await import('../review/threads.ts')
|
|
903
|
+
const t = threadOfItem(id, threadsOf(readAll(dir).items))
|
|
904
|
+
if (t === null) return []
|
|
905
|
+
const open = [...openAsksOf(t), ...openItemVerdictsOf(t)].filter((m) => m.id !== mine)
|
|
906
|
+
if (open.length === 0) return []
|
|
907
|
+
const one = (s: string): string => (s.length > 70 ? `${s.slice(0, 69)}…` : s)
|
|
908
|
+
return [
|
|
909
|
+
` ${open.length} still wait${open.length > 1 ? '' : 's'} on him in this thread: his click answers ${open.length > 1 ? 'each' : 'it'}; when it asks nothing more, sk thread withdraw <id> --why "<why>" takes it back`,
|
|
910
|
+
...open.map((m) => ` ${m.id} « ${one((m.propose ? `a change of ${m.propose.on}` : (m.text ?? '')).replace(/\s+/g, ' ').trim())} »`),
|
|
911
|
+
]
|
|
912
|
+
}
|
|
913
|
+
|
|
833
914
|
/** `--verdict` on a posting verb: it waits for the owner's verdict (wiki tools/shipkit/threads-how-it-fits.md, The model) */
|
|
834
915
|
const VERDICT_FLAG = "it waits for the owner's verdict (approve, fix, reject on it in the hub, « judge » in the inbox): a thing made that the owner approves before it ships or lands; a choice of what to do is a question, a visible change a version, never on a progress line"
|
|
835
916
|
|
|
836
917
|
export class ReviewAddViewCommand extends Command {
|
|
837
918
|
static override paths = [['review', 'add-view']]
|
|
838
919
|
static essential = {}
|
|
920
|
+
/** the flags its proxy reads, as its usage lists them: what a doc may name (RV019) */
|
|
921
|
+
static proxyFlags = [...new Set(ADD_VIEW_USAGE.match(/--[a-z][a-z0-9-]*/g) ?? [])]
|
|
839
922
|
static override usage = Command.Usage({
|
|
840
923
|
category: 'Review',
|
|
841
924
|
description: 'another angle on a version he has not answered yet: an image, a pair, a clip or a gallery',
|
|
@@ -844,6 +927,7 @@ export class ReviewAddViewCommand extends Command {
|
|
|
844
927
|
['a view from above', 'sk thread add-view <id> "from above" top.png'],
|
|
845
928
|
['a before and after', 'sk thread add-view <id> --label "on a phone" --before a.png --after b.png'],
|
|
846
929
|
['a 360° panorama', 'sk thread add-view <id> --label "inside" --pano hall-360.png'],
|
|
930
|
+
['the running page, framed', 'sk thread add-view <id> --live http://localhost:5173/settings'],
|
|
847
931
|
],
|
|
848
932
|
})
|
|
849
933
|
args = Option.Proxy()
|
|
@@ -855,9 +939,13 @@ export class ReviewAddViewCommand extends Command {
|
|
|
855
939
|
return run(this.context, async (h) => {
|
|
856
940
|
const { addViewAlso } = await import('../review/store.ts')
|
|
857
941
|
const keep = this.args.includes('--keep')
|
|
858
|
-
const
|
|
942
|
+
const { liveViews, takeLives } = await import('../review/live-post.ts')
|
|
943
|
+
const { lives, rest } = takeLives(this.args.filter((x) => x !== '--keep'))
|
|
944
|
+
const a = lives.length > 0 ? addViewLive(rest, lives) : await addViewArgs(rest, Object.keys(h.unit?.flags ?? {}))
|
|
859
945
|
const id = await idOf(h.dir, a.id)
|
|
860
|
-
|
|
946
|
+
// a live page asked and shot now, as post does: its shot is the view, its page beside it
|
|
947
|
+
const shot = lives.length > 0 ? await liveViews(lives) : null
|
|
948
|
+
const posted = shot ? { view: { ...shot.views[0]!, label: a.view.label }, drop: shot.drop } : await withPoster(a.view)
|
|
861
949
|
const v = posted.view
|
|
862
950
|
const extra = h.unit?.addView ? await h.unit.addView(v, a.repoFlags) : {}
|
|
863
951
|
const { item, added } = await addViewAlso(h.dir, id, v, { ...extra, ...(keep ? { keep: true } : {}) }).finally(posted.drop)
|
|
@@ -936,11 +1024,12 @@ export class ReviewShowCommand extends Command {
|
|
|
936
1024
|
static override usage = Command.Usage({
|
|
937
1025
|
category: 'Review',
|
|
938
1026
|
description: 'one item and its thread: the verdict, rectangles, reactions, the whole conversation',
|
|
939
|
-
details: `${DETAILS}\n\nTakes an item id or a player report's ref (live#3). --paste prints the short block that hands the thread to another agent session (the hub's copy button gives the same).`,
|
|
940
|
-
examples: [['hand a thread to another session', 'sk thread show <id> --paste']],
|
|
1027
|
+
details: `${DETAILS}\n\nTakes an item id or a player report's ref (live#3); an ask by its number too (ask:21). --paste prints the short block that hands the thread to another agent session (the hub's copy button gives the same). --md prints the whole thread as markdown, oldest first, each object whole (an ask's instructions as their source, the text sk ask edit writes), a superseded one in one line.`,
|
|
1028
|
+
examples: [['hand a thread to another session', 'sk thread show <id> --paste'], ['ask 21 as markdown, its instructions as their source', 'sk thread show ask:21 --md']],
|
|
941
1029
|
})
|
|
942
1030
|
id = Option.String({ name: 'address | id' })
|
|
943
1031
|
paste = Option.Boolean('--paste', false, { description: 'the block another agent session acts on: title, repo, this command, the links' })
|
|
1032
|
+
md = Option.Boolean('--md', false, { description: 'the whole thread as markdown: its facts, then every item and message oldest first, each object whole, a superseded one in one line' })
|
|
944
1033
|
|
|
945
1034
|
async execute(): Promise<number> {
|
|
946
1035
|
return run(this.context, async (h) => {
|
|
@@ -961,11 +1050,32 @@ export class ReviewShowCommand extends Command {
|
|
|
961
1050
|
return 0
|
|
962
1051
|
}
|
|
963
1052
|
const t = threadOfItem(x.item.id, threadsOf(all.items))
|
|
1053
|
+
// who the thread is shared with, read from the advisors' store at their times (advisors/share-trace.ts)
|
|
1054
|
+
const { dirname } = await import('node:path')
|
|
1055
|
+
const { ownAddressOf } = await import('../review/model.ts')
|
|
1056
|
+
const { shareLine, threadShareEvents } = await import('../advisors/share-trace.ts')
|
|
1057
|
+
const address = t === null ? null : ownAddressOf(t.head.item, h.say.spec)
|
|
1058
|
+
const shared = address === null ? [] : await threadShareEvents({ root: dirname(dirname(h.dir)), address })
|
|
1059
|
+
// the drive shares the owner's words name, each with its words and the command that lists it (drives/named.ts)
|
|
1060
|
+
const { membersOf } = await import('../review/threads.ts')
|
|
1061
|
+
const { sharesNamed } = await import('../drives/named.ts')
|
|
1062
|
+
const texts = (t ? membersOf(t) : [x]).flatMap((y) => y.thread.flatMap((m) => (m.text === undefined ? [] : [m.text])))
|
|
1063
|
+
if (this.md) {
|
|
1064
|
+
if (t === null) throw new Error(`${this.id} reads in no thread`)
|
|
1065
|
+
const { threadMarkdown } = await import('../review/thread-md.ts')
|
|
1066
|
+
const { withThreadLook } = await import('../review/refs.ts')
|
|
1067
|
+
h.out(withThreadLook(h.say.look, () => threadMarkdown(t, mediaDir(h.dir), h.say.spec, shared.map((e) => ({ at: e.at, md: `- ${shareLine(e)}` })))).replace(/\n$/, ''))
|
|
1068
|
+
const named = sharesNamed(dirname(dirname(h.dir)), texts, true)
|
|
1069
|
+
if (named !== null) h.out(`\n${named}`)
|
|
1070
|
+
return 0
|
|
1071
|
+
}
|
|
964
1072
|
// the paths it prints are on the disk: a message's image or file the purge let go comes back first
|
|
965
1073
|
const { ensureLocal } = await import('../review/media-read.ts')
|
|
966
|
-
const { membersOf } = await import('../review/threads.ts')
|
|
967
1074
|
await Promise.all((t ? membersOf(t) : [x]).flatMap((y) => y.thread.flatMap((m) => [...(m.image ? [m.image] : []), ...(m.files ?? []).map((g) => g.file)].map((n) => ensureLocal(h.dir, y.item.id, `thread/${n}`).catch((e: Error) => h.err(`review: WARN thread/${n}: ${e.message}`))))))
|
|
968
1075
|
h.out(t && (t.head.item.id === x.item.id || t.answers.length > 0) ? threadDetail(t, mediaDir(h.dir), true, h.say) : detail(x, mediaDir(h.dir), true, false, h.say))
|
|
1076
|
+
if (shared.length > 0) h.out([' shared with people outside (the advisors):', ...shared.map((e) => ` ${shareLine(e)}`)].join('\n'))
|
|
1077
|
+
const named = sharesNamed(dirname(dirname(h.dir)), texts)
|
|
1078
|
+
if (named !== null) h.out(named)
|
|
969
1079
|
return 0
|
|
970
1080
|
})
|
|
971
1081
|
}
|
|
@@ -1036,6 +1146,15 @@ export class ReviewInboxCommand extends Command {
|
|
|
1036
1146
|
return ` ${x.item.id} ${fix ? 'ok with a fix' : 'rejected'} "${x.item.title}": ${close}, or sk thread wontfix ${x.item.id} --note "<why>"`
|
|
1037
1147
|
}
|
|
1038
1148
|
if (sel.owed.length > 0) h.out(`owed, read and not done:\n${sel.owed.map(owedLine).join('\n')}\n`)
|
|
1149
|
+
// the threads this process's session or lane holds whose move is the agents' (review/inbox-read.ts heldOwedLines)
|
|
1150
|
+
const { sessionId } = await import('../review/store.ts')
|
|
1151
|
+
const holder = { session: session ?? sessionId(), lane: lane ?? callerLane(undefined) }
|
|
1152
|
+
if (holder.session !== null || holder.lane !== null) {
|
|
1153
|
+
const { heldOwedLines } = await import('../review/inbox-read.ts')
|
|
1154
|
+
const shown = new Set([...sel.threads.flatMap((g) => (g.t ? [g.t.head.item.id] : [])), ...sel.owed.map((t) => t.head.item.id)])
|
|
1155
|
+
const held = heldOwedLines(here, holder, parties ?? (await partiesFor([here], holder.session)), shown)
|
|
1156
|
+
if (held.length > 0) h.out(`yours to close, nobody at work on them:\n${held.join('\n')}\n`)
|
|
1157
|
+
}
|
|
1039
1158
|
const watchers = liveWatchers(h.dir)
|
|
1040
1159
|
const byItem = threadByItem(threadsOf(here.items, h.say.spec))
|
|
1041
1160
|
const followed = followedIds(here.items)
|
|
@@ -1072,6 +1191,27 @@ async function seenRefused(dir: string, id: string, as: string | undefined): Pro
|
|
|
1072
1191
|
return { refused: seenRefusal(x, t, me, parties), ...(only !== undefined ? { only } : {}) }
|
|
1073
1192
|
}
|
|
1074
1193
|
|
|
1194
|
+
/** the line the owner reads at the bottom of the thread of item `id` now, in its dock (review/expect.ts expectOf, the
|
|
1195
|
+
* hub's own): an agent's words never contradict it */
|
|
1196
|
+
async function headLine(dir: string, id: string): Promise<string | null> {
|
|
1197
|
+
const { readAll } = await import('../review/store.ts')
|
|
1198
|
+
const { threadOfItem, threadsOf } = await import('../review/threads.ts')
|
|
1199
|
+
const { threadView, waitsOnOwner } = await import('../review/cells.ts')
|
|
1200
|
+
const { expectOf, waitLinesOf } = await import('../review/expect.ts')
|
|
1201
|
+
const { validatedOf } = await import('../review/band.ts')
|
|
1202
|
+
const items = readAll(dir).items
|
|
1203
|
+
const threads = threadsOf(items)
|
|
1204
|
+
const t = threadOfItem(id, threads)
|
|
1205
|
+
if (t === null) return null
|
|
1206
|
+
const v = threadView(t, items, threads, t.head.item.id)
|
|
1207
|
+
const head = v.cells.find((c) => c.id === v.head && c.kind === 'version')
|
|
1208
|
+
const version = v.waits && v.state.state !== 'closed' && head?.kind === 'version' ? { id: head.id, n: head.n } : null
|
|
1209
|
+
const waiting = waitLinesOf(v.cells.filter(waitsOnOwner), version, v.ask ? { state: v.ask.state, title: v.ask.title, head: v.head } : undefined)
|
|
1210
|
+
const { parties } = await callerParties(dir, t, undefined)
|
|
1211
|
+
const e = expectOf({ ...v, waiting, ...(v.aside ? { aside: v.aside } : {}), validated: validatedOf({ turn: v.turn, status: v.status, ...(v.ask ? { ask: v.ask.state } : {}) }) }, parties)
|
|
1212
|
+
return `the owner reads at the bottom of the thread: « ${e.words} »: your words never say otherwise`
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1075
1215
|
/** the caller and the parties its thread's holder names */
|
|
1076
1216
|
async function callerParties(dir: string, t: import('../review/threads.ts').Thread | null, as: string | undefined): Promise<{ me: import('../review/parties.ts').Me; parties: import('../review/parties.ts').Parties }> {
|
|
1077
1217
|
const { sessionId } = await import('../review/store.ts')
|
|
@@ -1158,11 +1298,19 @@ export class ReviewSeenCommand extends Command {
|
|
|
1158
1298
|
const refused = scopes.map((s) => s.refused).filter((w) => w !== null)
|
|
1159
1299
|
if (refused.length > 0) throw new Error(`nothing marked: ${refused.join('; ')}`)
|
|
1160
1300
|
let bad = 0
|
|
1301
|
+
const { readItem } = await import('../review/store.ts')
|
|
1302
|
+
const { wordText } = await import('../review/format.ts')
|
|
1161
1303
|
for (const [i, [ref, id]] of ids.entries()) {
|
|
1162
|
-
|
|
1163
|
-
|
|
1304
|
+
const at = new Date()
|
|
1305
|
+
if (markSeen(h.dir, id, at, scopes[i]!.only)) {
|
|
1306
|
+
// each word the mark names, so a thread marked by its address is read, never skipped
|
|
1307
|
+
const x = readItem(h.dir, id)
|
|
1308
|
+
const mark = x?.thread.find((m) => m.op === 'seen' && m.at === at.toISOString() && m.who !== 'owner')
|
|
1309
|
+
const words = (mark?.of ?? []).flatMap((w) => x?.thread.find((m) => m.id === w) ?? [])
|
|
1310
|
+
h.out(`${ref}: seen${words.length > 0 ? `, ${words.length} word${words.length > 1 ? 's' : ''}` : ''}`)
|
|
1311
|
+
for (const m of words) h.out(` ${wordText(m)}`)
|
|
1312
|
+
} else {
|
|
1164
1313
|
// say which: an item that does not exist, none of the owner's words on it is the caller's, or none unseen
|
|
1165
|
-
const { readItem } = await import('../review/store.ts')
|
|
1166
1314
|
const why = readItem(h.dir, id) === null ? 'no such item' : scopes[i]!.only?.length === 0 ? `none of the owner's words on it is yours to mark: its holder marks them, or take it first (sk thread take ${ref})` : 'nothing of the owner unseen on it'
|
|
1167
1315
|
h.err(`FAIL: review: ${ref}: ${why}`)
|
|
1168
1316
|
bad++
|
|
@@ -1182,12 +1330,16 @@ export class ThreadWorkingCommand extends Command {
|
|
|
1182
1330
|
static override usage = Command.Usage({
|
|
1183
1331
|
category: 'Review',
|
|
1184
1332
|
description: 'say you are on his new words in a thread, one line of what you do now; your next act there ends it',
|
|
1185
|
-
details: `${DETAILS}\n\nMark his new words seen as you read them (sk thread seen), then, for work longer than your next call, say what you do with them here: he sees « L29 is on it: <line> » in the thread, its head and its row. It ends with the next act in the thread, yours or another agent's (a version, an update, a reply, a question, a change, a close, a take, a newer working), or once nothing moved for
|
|
1186
|
-
examples: [
|
|
1333
|
+
details: `${DETAILS}\n\nMark his new words seen as you read them (sk thread seen), then, for work longer than your next call, say what you do with them here: he sees « L29 is on it: <line> » in the thread, its head and its row. It ends with the next act in the thread, yours or another agent's (a version, an update, a reply, a question, a change, a close, a take, a newer working), or once nothing moved for 30 min: past it the thread reads « waiting for an agent », its row « said working <age> ago, nothing since », and a longer piece of work says working again. A read with no act after it keeps his word owed: a turn's end holds on it. A working line answers nothing: one that only acknowledges his answer to a question or a pick (« noted », « ok », « I collect your picks ») is refused, and sk thread reply answers it. Never written for you: no watch, beat or hook says it (wiki tools/shipkit/threads-how-it-fits.md, Read and on it).`,
|
|
1334
|
+
examples: [
|
|
1335
|
+
['on it', 'SK_AGENT=L29 sk thread working page:backup "backing up the key in OpenBao"'],
|
|
1336
|
+
['the next version promised: v1 asks no verdict meanwhile, late past the time', 'SK_AGENT=L29 sk thread working page:plans/x "v2: the plan with your picks" --next 2026-11-30'],
|
|
1337
|
+
],
|
|
1187
1338
|
})
|
|
1188
1339
|
ref = Option.String({ name: 'address | id' })
|
|
1189
1340
|
line = Option.String()
|
|
1190
1341
|
as = Option.String('--as', { description: 'the lane on it (else SK_AGENT)' })
|
|
1342
|
+
next = Option.String('--next', { description: 'you promise the next version by then: a span (90m, 4h, 3d) or a time (2026-11-30, 2026-11-30T18:00); the version before it asks no verdict meanwhile, and past that time the thread says the promise is late, naming you' })
|
|
1191
1343
|
|
|
1192
1344
|
async execute(): Promise<number> {
|
|
1193
1345
|
return run(this.context, async (h) => {
|
|
@@ -1198,9 +1350,43 @@ export class ThreadWorkingCommand extends Command {
|
|
|
1198
1350
|
const { threadOfItem, threadsOf } = await import('../review/threads.ts')
|
|
1199
1351
|
const id = await idOf(h.dir, this.ref)
|
|
1200
1352
|
const t = threadOfItem(id, threadsOf(readAll(h.dir).items, h.say.spec))
|
|
1353
|
+
if (t !== null) {
|
|
1354
|
+
const no = (await import('../review/working-guards.ts')).workingRefusal(t, line, this.ref)
|
|
1355
|
+
if (no !== null) throw new Error(no)
|
|
1356
|
+
}
|
|
1201
1357
|
const who = callerLane(this.as) ?? 'agent'
|
|
1202
|
-
|
|
1203
|
-
|
|
1358
|
+
const until = this.next === undefined ? null : (await import('../review/expect.ts')).promiseUntil(this.next)
|
|
1359
|
+
if (until !== null && 'error' in until) throw new Error(until.error)
|
|
1360
|
+
appendMessage(h.dir, t?.head.item.id ?? id, { who, op: 'working', note: line, ...(until !== null ? { next: { until: until.until } } : {}) })
|
|
1361
|
+
h.out(until !== null ? `${this.ref}: ${who} promises the next version by ${until.until}: ${line} (your next version ends it; past that time the thread says it is late)` : `${this.ref}: ${who} is on it: ${line} (your next act in this thread ends it)`)
|
|
1362
|
+
const said = await headLine(h.dir, t?.head.item.id ?? id)
|
|
1363
|
+
if (said !== null) h.out(said)
|
|
1364
|
+
return 0
|
|
1365
|
+
})
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
export class ThreadTagCommand extends Command {
|
|
1370
|
+
static override paths = [['thread', 'tag']]
|
|
1371
|
+
static override usage = Command.Usage({
|
|
1372
|
+
category: 'Review',
|
|
1373
|
+
description: "a thread's tags: lowercase words that sort and find threads; with no tag, the tags it has",
|
|
1374
|
+
details: `${DETAILS}\n\nA tag is a lowercase word of letters, digits and dashes (ux, login-flow). +<tag> or a bare <tag> adds it, -<tag> takes it away; the thread's tags print after. The owner sets them from the thread's head in the hub; the list's search and ⌘P find them with t:<tag> (wiki tools/shipkit/threads-store.md, Tags). A tag change is a write of the thread's oldest item's head, carried to every machine like any other.`,
|
|
1375
|
+
examples: [['tag a thread', 'sk thread tag k7m2 +ux +login'], ['take one away', 'sk thread tag screen:orders/list -old'], ['its tags', 'sk thread tag k7m2']],
|
|
1376
|
+
})
|
|
1377
|
+
ref = Option.String({ name: 'address | id | code' })
|
|
1378
|
+
edits = Option.Rest({ name: 'tags' })
|
|
1379
|
+
|
|
1380
|
+
async execute(): Promise<number> {
|
|
1381
|
+
return run(this.context, async (h) => {
|
|
1382
|
+
const { tagEdits } = await import('../review/thread-query.ts')
|
|
1383
|
+
const { readAll, setThreadTags } = await import('../review/store.ts')
|
|
1384
|
+
const { threadOfItem, threadsOf, membersOf } = await import('../review/threads.ts')
|
|
1385
|
+
const { tagsOfItems } = await import('../review/thread-query.ts')
|
|
1386
|
+
const id = await idOf(h.dir, this.ref)
|
|
1387
|
+
const e = tagEdits(this.edits)
|
|
1388
|
+
const tags = e.add.length + e.remove.length === 0 ? tagsOfItems(membersOf(threadOfItem(id, threadsOf(readAll(h.dir).items, h.say.spec))!)) : setThreadTags(h.dir, id, e)
|
|
1389
|
+
h.out(`${this.ref}: ${tags.length === 0 ? 'no tag' : tags.map((t) => `t:${t}`).join(' ')}`)
|
|
1204
1390
|
return 0
|
|
1205
1391
|
})
|
|
1206
1392
|
}
|
|
@@ -1247,7 +1433,7 @@ export class ThreadTakeCommand extends Command {
|
|
|
1247
1433
|
const wasText = was === null ? 'nobody held it' : `it was held by ${was.lane ?? sessionLabel(was.session, parties)}`
|
|
1248
1434
|
h.out(`${this.ref}: yours now (${hearing?.chip ?? lane ?? 'this session'}), ${wasText}; ${hearing?.words ?? ''}`)
|
|
1249
1435
|
const { IN_BACKGROUND, WATCH } = await import('../review/inbox-hook.ts')
|
|
1250
|
-
if (hearing && hearing.light !== 'hears') h.err(`review: no watch of yours hears it now: ${WATCH('sk')} ${IN_BACKGROUND}, one watch for every repo where you hold threads`)
|
|
1436
|
+
if (!lane && hearing && hearing.light !== 'hears') h.err(`review: no watch of yours hears it now: ${WATCH('sk')} ${IN_BACKGROUND}, one watch for every repo where you hold threads`)
|
|
1251
1437
|
return 0
|
|
1252
1438
|
})
|
|
1253
1439
|
}
|
|
@@ -1296,9 +1482,13 @@ export class ReviewReplyCommand extends Command {
|
|
|
1296
1482
|
urgent = Option.Boolean('--urgent', false, { description: 'brings back a thread he set aside, at once: only under the bar of a ping (an incident, a hard block, a deadline before it comes back)' })
|
|
1297
1483
|
replaces = Option.String('--replaces', { description: 'the id of your earlier words (or question, or change) these supersede: it folds to one line « superseded by … » and leaves the dock, its answers kept' })
|
|
1298
1484
|
verdict = Option.Boolean('--verdict', false, { description: VERDICT_FLAG })
|
|
1485
|
+
long = Option.String('--long', { description: LONG_FLAG })
|
|
1299
1486
|
|
|
1300
1487
|
async execute(): Promise<number> {
|
|
1301
1488
|
return run(this.context, async (h) => {
|
|
1489
|
+
const asked = (await import('../review/reply-guards.ts')).questionInReply(this.text, this.id)
|
|
1490
|
+
if (asked !== null) throw new Error(asked)
|
|
1491
|
+
await guardWords(h, this.text, 'reply', this.id, this.long)
|
|
1302
1492
|
const { agentName, appendMessage } = await import('../review/store.ts')
|
|
1303
1493
|
if (this.replaces !== undefined) {
|
|
1304
1494
|
if (this.image !== undefined) throw new Error('--replaces with --image: post the image as its own reply')
|
|
@@ -1306,14 +1496,21 @@ export class ReviewReplyCommand extends Command {
|
|
|
1306
1496
|
const r = await replacing(h.dir, this.id, this.replaces, this.as)
|
|
1307
1497
|
const t = textOf(this.text)
|
|
1308
1498
|
if ('error' in t) throw new Error(t.error)
|
|
1309
|
-
const m = appendMessage(h.dir, r.id, { who: callerLane(this.as) ?? agentName(), text: t.text, replaces: r.replaces, ...(this.verdict ? { asksVerdict: true as const } : {}) })
|
|
1499
|
+
const m = appendMessage(h.dir, r.id, { who: callerLane(this.as) ?? agentName(), text: t.text, replaces: r.replaces, ...(this.verdict ? { asksVerdict: true as const } : {}), ...(this.long !== undefined ? { long: this.long.trim() } : {}) })
|
|
1310
1500
|
h.out(`${r.id}: ${m.id} supersedes ${r.replaces}`)
|
|
1311
1501
|
return 0
|
|
1312
1502
|
}
|
|
1313
1503
|
const id = await replyTarget(h, this.id, await idOrOpen(h, this.id, this.text, this.as))
|
|
1314
|
-
const m = await wordsIn(h.dir, id, callerLane(this.as) ?? agentName(), this.text, this.verdict, this.image)
|
|
1504
|
+
const m = await wordsIn(h.dir, id, callerLane(this.as) ?? agentName(), this.text, this.verdict, this.image, this.long)
|
|
1315
1505
|
if (this.urgent) await urgentOn(h.dir, id, callerLane(this.as) ?? agentName())
|
|
1316
1506
|
h.out(`${id}: ${m.id}`)
|
|
1507
|
+
// steps written as a reply sit under the old ones, which still stand: they belong in the instructions
|
|
1508
|
+
const ask = /^ask:(\d+)-/.exec((await import('../review/store.ts')).readAll(h.dir).items.find((x) => x.item.id === id)?.item.on ?? '')?.[1]
|
|
1509
|
+
const stepsLike = /^\s*##\s/m.test(this.text) || (this.text.match(/(?:^|\s)\d+[.)]\s+\S/g)?.length ?? 0) >= 2 || (this.text.match(/^\s*[-*]\s+\S/gm)?.length ?? 0) >= 2
|
|
1510
|
+
if (ask !== undefined && stepsLike) h.err(`review: steps belong in the ask's instructions, where he ticks them: sk ask edit ${Number(ask)}, then --save (this reply stays under the old steps)`)
|
|
1511
|
+
for (const l of await stillOpenLines(h.dir, id, m.id)) h.out(l)
|
|
1512
|
+
const said = await headLine(h.dir, id)
|
|
1513
|
+
if (said !== null) h.out(said)
|
|
1317
1514
|
return 0
|
|
1318
1515
|
})
|
|
1319
1516
|
}
|
|
@@ -1324,7 +1521,7 @@ export class ReviewUpdateCommand extends Command {
|
|
|
1324
1521
|
static essential = { args: '<address | id> [state] <text>' }
|
|
1325
1522
|
static override usage = Command.Usage({
|
|
1326
1523
|
category: 'Review',
|
|
1327
|
-
description: "where a thread's work stands
|
|
1524
|
+
description: "where a thread's work stands: broken, better, a line; fixed asks the owner's verdict again",
|
|
1328
1525
|
details: `${DETAILS}\n\nsk thread update <id> <broken|better|fixed> "<one line>" [<file> | <before> <after>]: the file (an image, a clip or a sound, as it is: no special file) becomes the version's next view, the line and the state go on its thread in time order. Two files make that view a before and after pair, as add --before --after does: two images of one size, two clips of one size and length, or two sounds, never one of each; the owner picks how he compares them (side by side, wipe, fade). broken or better holds the version « in progress » (not waiting on the owner's verdict, still new in the list), fixed asks the owner's verdict again on the same thread, even after an answer. The owner's hint on an update reaches watch and inbox as a reply « on update <k> ». Posted on the thread's newest version.`,
|
|
1329
1526
|
examples: [
|
|
1330
1527
|
['still broken, the take as it is', 'SK_AGENT=L2 sk thread update <id> broken "her arm still crosses her leg at 2 s" take.mp4'],
|
|
@@ -1346,9 +1543,12 @@ export class ReviewUpdateCommand extends Command {
|
|
|
1346
1543
|
as = Option.String('--as', { description: 'the lane that posts (else SK_AGENT)' })
|
|
1347
1544
|
keep = Option.Boolean('--keep', false, { description: 'its pictures as given: a png lands as a lossless webp otherwise, its pixels checked exact, and the version keeps only the webp' })
|
|
1348
1545
|
verdict = Option.Boolean('--verdict', false, { description: `on a plain line only: ${VERDICT_FLAG}` })
|
|
1546
|
+
long = Option.String('--long', { description: `on a plain line only: ${LONG_FLAG}` })
|
|
1349
1547
|
|
|
1350
1548
|
async execute(): Promise<number> {
|
|
1351
1549
|
return run(this.context, async (h) => {
|
|
1550
|
+
if (this.long !== undefined && this.text !== undefined) throw new Error(`update ${this.state} --long: an update's line is one line; a long text goes as a document (sk thread post ${this.id} --md <file>)`)
|
|
1551
|
+
await guardWords(h, this.text ?? this.state, 'update', this.id, this.long)
|
|
1352
1552
|
const { postUpdate, agentName, readAll } = await import('../review/store.ts')
|
|
1353
1553
|
const { threadsOf } = await import('../review/threads.ts')
|
|
1354
1554
|
const { threadOfId } = await import('../review/cells.ts')
|
|
@@ -1360,8 +1560,10 @@ export class ReviewUpdateCommand extends Command {
|
|
|
1360
1560
|
if ((UPDATE_STATES as readonly string[]).includes(this.state)) throw new Error(`update <address | id> ${this.state} "<one line>": the line is missing`)
|
|
1361
1561
|
const at = await idOrOpen(h, this.id, this.state, this.as)
|
|
1362
1562
|
const on = threadOfId(at, threadsOf(readAll(h.dir).items))?.head.item.id ?? at
|
|
1363
|
-
const m = await wordsIn(h.dir, on, callerLane(this.as) ?? agentName(), this.state, this.verdict)
|
|
1563
|
+
const m = await wordsIn(h.dir, on, callerLane(this.as) ?? agentName(), this.state, this.verdict, undefined, this.long)
|
|
1364
1564
|
h.out(`${on}: ${m.id}, a line, no state`)
|
|
1565
|
+
const said = await headLine(h.dir, on)
|
|
1566
|
+
if (said !== null) h.out(said)
|
|
1365
1567
|
return 0
|
|
1366
1568
|
}
|
|
1367
1569
|
const asked = await idOrOpen(h, this.id, this.text, this.as)
|
|
@@ -1373,6 +1575,8 @@ export class ReviewUpdateCommand extends Command {
|
|
|
1373
1575
|
const x = readItem(h.dir, id)
|
|
1374
1576
|
const now = x && stateOf(x, false).state === 'asks' ? "waits for the owner's verdict" : x && stateOf(x, false).state === 'draft' ? 'in progress, no verdict asked' : 'in work'
|
|
1375
1577
|
h.out(`${id}: ${r.tag}${r.view !== null ? `, view ${viewNo(r.view)}` : ''}${id !== asked ? ` (on the newest version, ${asked} is older)` : ''}; the version ${now}`)
|
|
1578
|
+
const said = await headLine(h.dir, id)
|
|
1579
|
+
if (said !== null) h.out(said)
|
|
1376
1580
|
if (r.view !== null) for (const line of await (await import('../review/previews.ts')).playCopies(h.dir, r.item, r.view)) h.err(line)
|
|
1377
1581
|
const { unheardLine } = await import('../review/model.ts')
|
|
1378
1582
|
const { liveWatchers } = await import('../review/watchers.ts')
|
|
@@ -1388,7 +1592,7 @@ export class ReviewWithdrawCommand extends Command {
|
|
|
1388
1592
|
static override usage = Command.Usage({
|
|
1389
1593
|
category: 'Review',
|
|
1390
1594
|
description: 'take back what an agent posted, with the reason: a version by its id, or one message by its id',
|
|
1391
|
-
details: `${DETAILS}\n\nA version (or any other item of a thread) withdrawn asks nothing more: its open questions, changes and words asking the owner's verdict wait on nobody with it. A message id (sk thread show prints them) takes back that one question, change or words alone, a reply posted by mistake included. A thread (its address, or its own id t-…) is refused with the ids of its items: name the one you mean. What the owner wrote or raised is never withdrawn by an agent. --chat "<the owner's words>": the owner answered it in chat; the words are the reason, quoted, so it never stays open in the hub
|
|
1595
|
+
details: `${DETAILS}\n\nA version (or any other item of a thread) withdrawn asks nothing more: its open questions, changes and words asking the owner's verdict wait on nobody with it. A message id (sk thread show prints them) takes back that one question, change or words alone, a reply posted by mistake included. A thread (its address, or its own id t-…) is refused with the ids of its items: name the one you mean. What the owner wrote or raised is never withdrawn by an agent. --chat "<the owner's words>": the owner answered it in chat, outside the thread; the words are the reason, quoted, so it never stays open in the hub. The owner's words in the thread itself need nothing: they answer what an agent asked before them on that item (a question, a change, words asking the owner's verdict) by themselves, « answered in words ».`,
|
|
1392
1596
|
examples: [
|
|
1393
1597
|
['a version taken back', 'sk thread withdraw 20261120-101500-the-logo --why "a newer one follows"'],
|
|
1394
1598
|
['he answered the question in chat', 'sk thread withdraw 20261120-223154-747-agent-vg49 --chat "B only, keep both kill matrices"'],
|
|
@@ -1495,22 +1699,23 @@ function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'op
|
|
|
1495
1699
|
after = op === 'ask' ? Option.String('--after', { description: 'set the thread aside until then (2h, tomorrow, next-week, YYYY-MM-DD[THH:MM]): your question waits for that day; only when you post it' }) : undefined
|
|
1496
1700
|
urgent = op === 'ask' ? Option.Boolean('--urgent', false, { description: 'brings back a thread he set aside, at once: only under the bar of a ping (an incident, a hard block, a deadline before it comes back)' }) : undefined
|
|
1497
1701
|
login = op === 'ask' ? Option.Boolean('--login', false, { description: 'with --secret: a login, its account (the email or user name) typed and stored beside it' }) : undefined
|
|
1498
|
-
replaces = op === 'ask' ? Option.String('--replaces', { description: 'the id of your earlier question (or words) this one supersedes: it folds to one line « superseded by … » and leaves the dock, his answers on it kept' }) : undefined
|
|
1499
|
-
keep = op === 'ask' ? Option.Boolean('--keep', false, { description: '
|
|
1702
|
+
replaces = op === 'ask' ? Option.String('--replaces', { description: 'the id of your earlier question (or words) this one supersedes: it folds to one line « superseded by … » and leaves the dock, his answers on it kept; `all`: every older open question of its kind on the thread. Without it, a new question is asked beside the open ones' }) : undefined
|
|
1703
|
+
keep = op === 'ask' ? Option.Boolean('--keep', false, { description: 'does nothing: a new question never supersedes another unless --replaces names it' }) : undefined
|
|
1500
1704
|
verdict = op === 'ask' ? Option.Boolean('--verdict', false, { description: "refused: a question waits for the owner's answer already, his answer is its verdict" }) : undefined
|
|
1501
1705
|
|
|
1502
|
-
/** the thread item the question goes on and what it supersedes: never a new thread when it supersedes.
|
|
1503
|
-
*
|
|
1504
|
-
* the newest by `replaces`, each other withdrawn by `withdrawOlder` once
|
|
1505
|
-
|
|
1506
|
-
|
|
1706
|
+
/** the thread item the question goes on and what it supersedes: never a new thread when it supersedes. It
|
|
1707
|
+
* supersedes only what `--replaces` names: an id, or `all`, the older open questions of its kind on the thread
|
|
1708
|
+
* (review/supersede.ts olderQuestions), the newest by `replaces`, each other withdrawn by `withdrawOlder` once
|
|
1709
|
+
* this one has its id. Named none, it is asked beside them, `beside` counting them */
|
|
1710
|
+
async target(h: Here, q: { kind: AnswerKind; secret?: string }): Promise<{ id: string; replaces?: string; others: string[]; beside?: number }> {
|
|
1711
|
+
if (this.replaces !== undefined && this.replaces !== 'all') return { ...(await replacing(h.dir, this.id, this.replaces, this.as)), others: [] }
|
|
1507
1712
|
const id = await idOrOpen(h, this.id, this.words ?? '', this.as)
|
|
1508
|
-
if (this.keep) return { id, others: [] }
|
|
1509
1713
|
const { readAll } = await import('../review/store.ts')
|
|
1510
1714
|
const { membersOf, threadOfItem, threadsOf } = await import('../review/threads.ts')
|
|
1511
1715
|
const { olderQuestions } = await import('../review/supersede.ts')
|
|
1512
1716
|
const t = threadOfItem(id, threadsOf(readAll(h.dir).items))
|
|
1513
1717
|
const older = t === null ? [] : olderQuestions(membersOf(t), q)
|
|
1718
|
+
if (this.replaces !== 'all') return { id, others: [], ...(older.length > 0 ? { beside: older.length } : {}) }
|
|
1514
1719
|
if (older.length === 0) return { id, others: [] }
|
|
1515
1720
|
if (!(await mayHold(h.dir, t!, this.as))) {
|
|
1516
1721
|
h.err(` ${older.length} older open question${older.length > 1 ? 's' : ''} of this kind stay open (${older.map((m) => m.id).join(', ')}): another agent holds the thread; sk thread take <address>, then --replaces <id>`)
|
|
@@ -1520,8 +1725,9 @@ function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'op
|
|
|
1520
1725
|
}
|
|
1521
1726
|
|
|
1522
1727
|
/** the older questions `target` named beside the one it superseded: each withdrawn, « replaced by » the new one */
|
|
1523
|
-
async withdrawOlder(h: Here, t: { replaces?: string; others: string[] }, by: string): Promise<void> {
|
|
1524
|
-
if (t.
|
|
1728
|
+
async withdrawOlder(h: Here, t: { replaces?: string; others: string[]; beside?: number }, by: string): Promise<void> {
|
|
1729
|
+
if (t.beside !== undefined) h.out(` asked beside ${t.beside} open question${t.beside > 1 ? 's' : ''} of this kind, ${t.beside > 1 ? 'all' : 'it'} still open: --replaces <id> supersedes one, --replaces all every one`)
|
|
1730
|
+
if (t.replaces !== undefined && this.replaces === 'all') h.out(` supersedes ${t.replaces}${t.others.length > 0 ? ` and ${t.others.join(', ')}` : ''}: older open question${t.others.length > 0 ? 's' : ''} of this kind (--replaces all)`)
|
|
1525
1731
|
const { withdrawObject } = await import('../review/store.ts')
|
|
1526
1732
|
for (const re of t.others) {
|
|
1527
1733
|
const r = withdrawObject(h.dir, re, `replaced by ${by}`)
|
|
@@ -1651,7 +1857,7 @@ function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'op
|
|
|
1651
1857
|
export const ReviewWontfixCommand = actCommand('wontfix', 'close an item he raised as not done, with the reason', { note: 'required', named: false, examples: [['not done', 'sk thread wontfix <id> --note "the room is gone"']] })
|
|
1652
1858
|
export const ReviewClaimCommand = actCommand('claim', 'take an item to work on it: the hub shows the thread in work by your lane', { named: true, examples: [['take it', 'sk thread claim <id> --as L12']] })
|
|
1653
1859
|
export const ReviewReleaseCommand = actCommand('release', 'give back an item you claimed', { note: 'optional', named: true, examples: [['give it back', 'sk thread release <id> --as L12']] })
|
|
1654
|
-
export const ReviewBlockedCommand = actCommand('blocked', 'an item you claimed goes back to the owner with what is needed', { note: 'required', named: true, examples: [['his decision is needed', 'sk thread blocked <id> --note "which of the two
|
|
1860
|
+
export const ReviewBlockedCommand = actCommand('blocked', 'an item you claimed goes back to the owner with what is needed', { note: 'required', named: true, examples: [['his decision is needed', 'sk thread blocked <id> --note "which of the two layouts?" --as L12']] })
|
|
1655
1861
|
export const ReviewDoneCommand = actCommand('done', 'the older name of sk thread fixed on a version he answered « ok with a fix »', { text: 'what changed', named: false, examples: [['the fix made', 'sk thread fixed <id> "the sign moved one tile up"']] })
|
|
1656
1862
|
|
|
1657
1863
|
/** `fixed <address | id> ["<what was done>"]`: the one way to say it is fixed (review/threads.ts fixedPlan) */
|
|
@@ -2094,7 +2300,6 @@ export class ReviewWatchCommand extends Command {
|
|
|
2094
2300
|
lane = Option.String('--lane', { description: "only that lane's items" })
|
|
2095
2301
|
house = Option.Boolean('--house', false, { description: 'with --mine or --session: every repo where the session holds threads, one joined later too, each line headed [<repo>]' })
|
|
2096
2302
|
once = Option.Boolean('--once', false, { description: 'print the first burst of new lines, then exit 0: the form for a background Bash, never capped at 30 minutes; a line it printed is never printed again by the next one' })
|
|
2097
|
-
json = Option.Boolean('--json', false, { description: 'each line as one JSON object: text, kind, repo, item, message, who, address (what a shipkit channel reads)' })
|
|
2098
2303
|
|
|
2099
2304
|
async execute(): Promise<number> {
|
|
2100
2305
|
return run(this.context, async (h) => {
|
|
@@ -2118,7 +2323,7 @@ export class ReviewWatchCommand extends Command {
|
|
|
2118
2323
|
await restartWatchOnModelMove(h)
|
|
2119
2324
|
// the one stream for every store this watch hears, its own lines untagged
|
|
2120
2325
|
await watchFeed(h.err)
|
|
2121
|
-
const f = { session, lane, by, house: this.house,
|
|
2326
|
+
const f = { session, lane, by, house: this.house, once: this.once }
|
|
2122
2327
|
if (!this.house || session === null) {
|
|
2123
2328
|
await hearStore(h, f)
|
|
2124
2329
|
return new Promise<number>(() => {})
|
|
@@ -2134,7 +2339,7 @@ export class ReviewWatchCommand extends Command {
|
|
|
2134
2339
|
const hear = async (x: Here): Promise<string> => {
|
|
2135
2340
|
heard.add(canonicalStore(x.dir))
|
|
2136
2341
|
const repo = repoNameOf(dirname(dirname(x.dir)))
|
|
2137
|
-
const tagged = (print: (l: string) => void) => (l: string) => print(
|
|
2342
|
+
const tagged = (print: (l: string) => void) => (l: string) => print(l.split('\n').map((y) => `[${repo}] ${y}`).join('\n'))
|
|
2138
2343
|
await hearStore({ ...x, out: tagged(h.out), err: tagged(h.err) }, f)
|
|
2139
2344
|
return repo
|
|
2140
2345
|
}
|
|
@@ -2220,15 +2425,14 @@ async function restartWatchOnModelMove(h: Here): Promise<void> {
|
|
|
2220
2425
|
}
|
|
2221
2426
|
|
|
2222
2427
|
/** one store heard by a watch of filter `f`, until the process ends: registered beside it, its lines printed through `h` */
|
|
2223
|
-
async function hearStore(h: Here, f: { session: string | null; lane: string | null; by: string | null; house: boolean;
|
|
2428
|
+
async function hearStore(h: Here, f: { session: string | null; lane: string | null; by: string | null; house: boolean; once?: boolean }): Promise<void> {
|
|
2224
2429
|
const { session, lane, by } = f
|
|
2225
2430
|
// --once: what an earlier run of this party printed is never printed again, and the process exits 0 once a burst
|
|
2226
2431
|
// of new lines settled (400 ms), so a background Bash hears it with no 30 minute cap and no loop of turns
|
|
2227
2432
|
const once = f.once === true ? await onceMemory(h.dir, session, lane) : null
|
|
2228
2433
|
let settle: ReturnType<typeof setTimeout> | null = null
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
h.out(f.json === true ? JSON.stringify({ text, ...m }) : text)
|
|
2434
|
+
const say = (text: string): void => {
|
|
2435
|
+
h.out(text)
|
|
2232
2436
|
if (once === null) return
|
|
2233
2437
|
if (settle) clearTimeout(settle)
|
|
2234
2438
|
// every store of a --house watch saves what it printed, then the process exits
|
|
@@ -2237,15 +2441,14 @@ async function hearStore(h: Here, f: { session: string | null; lane: string | nu
|
|
|
2237
2441
|
process.exit(0)
|
|
2238
2442
|
}, 400)
|
|
2239
2443
|
}
|
|
2240
|
-
const {
|
|
2241
|
-
const { mediaDir, readAll, scanStamp } = await import('../review/store.ts')
|
|
2444
|
+
const { mediaDir, readAll, storeStamp } = await import('../review/store.ts')
|
|
2242
2445
|
const { modelWatch } = await import('../review/model-moved.ts')
|
|
2243
|
-
const { threadsInDb } = await import('../hq/switch.ts')
|
|
2244
2446
|
const { coversItem, laneOf, UNTAKEN_AGAIN_MS, untakenOf } = await import('../review/model.ts')
|
|
2245
2447
|
const { followedIds, unseen } = await import('../review/threads.ts')
|
|
2246
2448
|
const { raisedLine, untakenLine, watchLines } = await import('../review/format.ts')
|
|
2449
|
+
const { withThreadLook } = await import('../review/refs.ts')
|
|
2247
2450
|
const { liveWatchers, registerWatch } = await import('../review/watchers.ts')
|
|
2248
|
-
const { hears, holderOf, listenersOf,
|
|
2451
|
+
const { hears, holderOf, listenersOf, threadByItem, threadsOf, wordReaches } = await import('../review/threads.ts')
|
|
2249
2452
|
let byItem = new Map<string, import('../review/threads.ts').Thread>()
|
|
2250
2453
|
// who hears what: the registry, read again every 30 s, so a lane's threads reach its session's watch once it ends
|
|
2251
2454
|
const { noteHanded, readParties, repoNameOf } = await import('../agent-time/registry.ts')
|
|
@@ -2272,14 +2475,6 @@ async function hearStore(h: Here, f: { session: string | null; lane: string | nu
|
|
|
2272
2475
|
h.err(`review watch: exits, its lane ${lane} ended: its threads pass to its session`)
|
|
2273
2476
|
process.exit(0)
|
|
2274
2477
|
}
|
|
2275
|
-
// one ear a session: its shipkit channel, once proven, hears for it, so a plain watch of it leaves
|
|
2276
|
-
if (lane === null && session !== null && process.env.SHIPKIT_CHANNEL_EAR !== '1') {
|
|
2277
|
-
const { channelHears } = await import('../orchestrator/role.ts')
|
|
2278
|
-
if (channelHears(session)) {
|
|
2279
|
-
h.err(`review watch: exits, this session's shipkit channel hears for it: nothing to arm again`)
|
|
2280
|
-
process.exit(0)
|
|
2281
|
-
}
|
|
2282
|
-
}
|
|
2283
2478
|
}
|
|
2284
2479
|
await known().catch(() => {})
|
|
2285
2480
|
setInterval(() => void known().catch(() => {}), 30_000)
|
|
@@ -2315,24 +2510,22 @@ async function hearStore(h: Here, f: { session: string | null; lane: string | nu
|
|
|
2315
2510
|
for (const l of laneAsksFor({ repo: repoNameOf(dirname(dirname(h.dir))), root: dirname(dirname(h.dir)), dir: h.dir, here: true, ...all, say: h.say }, { session, lane: null }, parties ?? { sessions: [], lanes: [] })) {
|
|
2316
2511
|
if (shown.has(l)) continue
|
|
2317
2512
|
shown.add(l)
|
|
2318
|
-
say(l
|
|
2513
|
+
say(l)
|
|
2319
2514
|
}
|
|
2320
2515
|
}
|
|
2321
2516
|
for (const x of unseen(all.items, to).filter(mine)) {
|
|
2322
|
-
const fresh = watchLines(x, all.items, mediaDir(h.dir), to).filter((l) => !shown.has(l.key))
|
|
2323
|
-
const
|
|
2324
|
-
|
|
2517
|
+
const fresh = withThreadLook(h.say.look, () => watchLines(x, all.items, mediaDir(h.dir), to)).filter((l) => !shown.has(l.key))
|
|
2518
|
+
const t = byItem.get(x.item.id)
|
|
2519
|
+
// each line after its item's id names its thread's code, the one an agent types back
|
|
2520
|
+
const code = t && h.say.code ? ` #${h.say.code(t)}` : ''
|
|
2325
2521
|
for (const l of fresh) {
|
|
2326
2522
|
shown.add(l.key)
|
|
2327
|
-
|
|
2328
|
-
const who = message === undefined ? 'owner' : (x.thread.find((m) => m.id === message)?.who ?? 'owner')
|
|
2329
|
-
say(l.text, { kind: 'word', item: x.item.id, ...(message ? { message } : {}), who, address })
|
|
2523
|
+
say(code === '' || !l.text.startsWith(`${x.item.id} `) ? l.text : `${x.item.id}${code}${l.text.slice(x.item.id.length)}`)
|
|
2330
2524
|
}
|
|
2331
2525
|
// a session's watch, his message on its ended lane's thread: the way back to that lane
|
|
2332
|
-
const t = byItem.get(x.item.id)
|
|
2333
2526
|
const r = fresh.length > 0 && lane === null && t && parties ? resumeOf(h, t, parties) : null
|
|
2334
2527
|
if (r) {
|
|
2335
|
-
say(` ${r.line}
|
|
2528
|
+
say(` ${r.line}`)
|
|
2336
2529
|
noteHanded(r.lane, r.session, r.thread)
|
|
2337
2530
|
}
|
|
2338
2531
|
}
|
|
@@ -2349,7 +2542,7 @@ async function hearStore(h: Here, f: { session: string | null; lane: string | nu
|
|
|
2349
2542
|
for (const l of shareOf({ items: all.items, spec: h.say.spec, parties: placed, watchers: others, media: mediaDir(h.dir), since: r.holder.since, me: { session, repo } })) {
|
|
2350
2543
|
if (shown.has(l.key)) continue
|
|
2351
2544
|
shown.add(l.key)
|
|
2352
|
-
say(shareText(l)
|
|
2545
|
+
say(shareText(l))
|
|
2353
2546
|
}
|
|
2354
2547
|
}
|
|
2355
2548
|
}
|
|
@@ -2357,7 +2550,7 @@ async function hearStore(h: Here, f: { session: string | null; lane: string | nu
|
|
|
2357
2550
|
const l = raisedLine(x)
|
|
2358
2551
|
if (l === null || shown.has(l.key)) continue
|
|
2359
2552
|
shown.add(l.key)
|
|
2360
|
-
say(l.text
|
|
2553
|
+
say(l.text)
|
|
2361
2554
|
}
|
|
2362
2555
|
// an item nobody takes: a --lane watch hears its own lane's, an unfiltered or --mine watch every one
|
|
2363
2556
|
const now = new Date()
|
|
@@ -2371,59 +2564,37 @@ async function hearStore(h: Here, f: { session: string | null; lane: string | nu
|
|
|
2371
2564
|
const key = `untaken ${x.item.id} ${why} ${round}`
|
|
2372
2565
|
if (shown.has(key)) continue
|
|
2373
2566
|
shown.add(key)
|
|
2374
|
-
say(untakenLine(x, why, lane)
|
|
2567
|
+
say(untakenLine(x, why, lane))
|
|
2375
2568
|
}
|
|
2376
2569
|
}
|
|
2377
2570
|
tick()
|
|
2378
2571
|
// the grace and the reminder pass with time alone: one read a minute
|
|
2379
2572
|
setInterval(tick, 60_000)
|
|
2380
|
-
// the
|
|
2381
|
-
// watch follows a move while it runs. The rows: their stamp is a query of a few µs, asked every 50 ms, read at
|
|
2382
|
-
// once. The files: a watch of the folder asks again (debounced), and a stat stamp every 5 s catches a missed event
|
|
2573
|
+
// the rows' stamp is a query of a few µs, asked every 50 ms, read at once; one tick for a burst of moves
|
|
2383
2574
|
let soon: ReturnType<typeof setTimeout> | null = null
|
|
2384
2575
|
const again = (): void => {
|
|
2385
2576
|
if (soon) clearTimeout(soon)
|
|
2386
2577
|
soon = setTimeout(() => {
|
|
2387
2578
|
soon = null
|
|
2388
2579
|
tick()
|
|
2389
|
-
},
|
|
2580
|
+
}, 0)
|
|
2390
2581
|
}
|
|
2391
2582
|
// the store's own poll, for a watch the daemon's stream does not feed: no home, a store it serves no hub for, a
|
|
2392
2583
|
// daemon that does not answer (review/watch-feed.ts)
|
|
2393
|
-
let polling = false
|
|
2394
|
-
let folderWatched = false
|
|
2395
|
-
const watchFolder = (): void => {
|
|
2396
|
-
if (folderWatched) return
|
|
2397
|
-
folderWatched = true
|
|
2398
|
-
if (!existsSync(h.dir)) mkdirSync(h.dir, { recursive: true })
|
|
2399
|
-
watch(h.dir, { recursive: true }, () => {
|
|
2400
|
-
if (polling && !threadsInDb()) again()
|
|
2401
|
-
})
|
|
2402
|
-
}
|
|
2403
2584
|
let stamp = ''
|
|
2404
|
-
let scanned = Date.now()
|
|
2405
2585
|
let loop: ReturnType<typeof setInterval> | null = null
|
|
2406
2586
|
const poll = (on: boolean): void => {
|
|
2407
|
-
polling = on
|
|
2408
2587
|
if (!on) {
|
|
2409
2588
|
if (loop) clearInterval(loop)
|
|
2410
2589
|
loop = null
|
|
2411
2590
|
return
|
|
2412
2591
|
}
|
|
2413
2592
|
if (loop) return
|
|
2414
|
-
if (!threadsInDb()) watchFolder()
|
|
2415
2593
|
stamp = ''
|
|
2416
2594
|
loop = setInterval(() => {
|
|
2417
|
-
const rows = threadsInDb()
|
|
2418
|
-
// the files' stamp walks every item: once every 5 s, never at the rows' pace
|
|
2419
|
-
if (!rows) {
|
|
2420
|
-
watchFolder()
|
|
2421
|
-
if (Date.now() - scanned < 5000) return
|
|
2422
|
-
}
|
|
2423
|
-
scanned = Date.now()
|
|
2424
2595
|
// a refused stamp, or one read again after a refusal: the read says it, once
|
|
2425
2596
|
try {
|
|
2426
|
-
const now =
|
|
2597
|
+
const now = storeStamp(h.dir)
|
|
2427
2598
|
if (now !== stamp || refused !== null) again()
|
|
2428
2599
|
stamp = now
|
|
2429
2600
|
} catch {
|
|
@@ -2466,14 +2637,14 @@ async function watchFeed(say: (l: string) => void): Promise<import('../review/wa
|
|
|
2466
2637
|
return (feedHeld = new WatchFeed(daemonUrl(), { say }))
|
|
2467
2638
|
}
|
|
2468
2639
|
|
|
2469
|
-
/** the review folders of this machine's house, its archived repos
|
|
2640
|
+
/** the review folders of this machine's house, its archived repos and their worktrees included */
|
|
2470
2641
|
async function houseStores(): Promise<string[]> {
|
|
2471
2642
|
const { findRepoRoot } = await import('../ts/config.ts')
|
|
2472
2643
|
const { houseRepos } = await import('../house/project-gutter.ts')
|
|
2473
2644
|
const { homedir } = await import('node:os')
|
|
2474
2645
|
const { storeDir } = await import('../review/store.ts')
|
|
2475
2646
|
const house = houseRepos(findRepoRoot(process.cwd()), homedir())
|
|
2476
|
-
if (house.index == null) throw new Error(`${process.cwd()} is in no house repo: run it from the house checkout, whose repos it
|
|
2647
|
+
if (house.index == null) throw new Error(`${process.cwd()} is in no house repo: run it from the house checkout, whose repos it reads`)
|
|
2477
2648
|
const { existsSync } = await import('node:fs')
|
|
2478
2649
|
const repos = [...house.repos, ...house.archived].map((r) => r.path)
|
|
2479
2650
|
// a lane's worktree holds the items it sent there: they join their repo's rows
|
|
@@ -2483,89 +2654,42 @@ async function houseStores(): Promise<string[]> {
|
|
|
2483
2654
|
return [...repos, ...trees.filter((t) => existsSync(storeDir(t)))].map((r) => storeDir(r))
|
|
2484
2655
|
}
|
|
2485
2656
|
|
|
2486
|
-
export class
|
|
2487
|
-
static override paths = [['review', '
|
|
2657
|
+
export class ReviewImportCommand extends Command {
|
|
2658
|
+
static override paths = [['review', 'import']]
|
|
2488
2659
|
static override usage = Command.Usage({
|
|
2489
2660
|
category: 'Review',
|
|
2490
|
-
description: "
|
|
2491
|
-
details:
|
|
2492
|
-
|
|
2493
|
-
examples: [['what the tidy would remove', 'sk thread move --tidy'], ['what a move would do', 'sk thread move'], ['move this machine', 'sk thread move --go'], ['what the way back would do', 'sk thread move --back'], ['go back to the files', 'sk thread move --back --go']],
|
|
2661
|
+
description: "threads kept as folders into the daemon's database: an older shipkit's store, or an export",
|
|
2662
|
+
details: `${DETAILS}\n\nEvery thread is rows of the daemon's database. A shipkit older than the rows kept a repo's threads as folders in \`.shipkit/review/<id>/\` (\`item.json\`, \`thread/<message>.json\`, the media beside them, \`.gone/\` the items set aside), and sk thread export writes the same layout. A look by default: what it would write. \`--go\` writes every head the rows lack or hold older and every message they lack (by id and rev), links each media file into the spool, then proves each one it read is in the rows. A head the rows hold later stays, named; a folder that does not read stays as it is, named, and the exit is 1. The folders are read, never written nor removed, so a second run writes nothing. \`--from <folder>\` reads an export instead of the repo's own folder; \`--all\` reads every house repo of this machine and their worktrees. Page: wiki tools/shipkit/threads-store.md, Folders`,
|
|
2663
|
+
examples: [['what it would import here', 'sk thread import'], ["this repo's old threads into the rows", 'sk thread import --go'], ['every house repo', 'sk thread import --all --go'], ['an export', 'sk thread import --from /tmp/threads --go']],
|
|
2494
2664
|
})
|
|
2495
|
-
go = Option.Boolean('--go', false, { description: '
|
|
2496
|
-
|
|
2497
|
-
|
|
2665
|
+
go = Option.Boolean('--go', false, { description: 'write it; without it, a look' })
|
|
2666
|
+
all = Option.Boolean('--all', false, { description: 'every house repo of this machine, not only this repo' })
|
|
2667
|
+
from = Option.String('--from', { description: "a folder sk thread export wrote, instead of the repo's own" })
|
|
2498
2668
|
|
|
2499
2669
|
async execute(): Promise<number> {
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
const stores = await houseStores()
|
|
2505
|
-
const { moveBack, moveGo, tidyFiles } = await import('../review/move.ts')
|
|
2670
|
+
return run(this.context, async (h) => {
|
|
2671
|
+
if (this.all && this.from != null) throw new Error('--all or --from, not both')
|
|
2672
|
+
const { resolve } = await import('node:path')
|
|
2673
|
+
const { importFolders, importLines, notInRows } = await import('../review/folders.ts')
|
|
2674
|
+
const stores = this.all ? await houseStores() : [h.dir]
|
|
2506
2675
|
const dry = !this.go
|
|
2507
|
-
|
|
2508
|
-
const {
|
|
2509
|
-
const
|
|
2510
|
-
if (
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
for (const l of r.lines) (l.startsWith('WARN') ? err : out)(l)
|
|
2514
|
-
const { threadsInDb } = await import('../hq/switch.ts')
|
|
2515
|
-
const { BACK_FIRST } = await import('../review/move.ts')
|
|
2516
|
-
if (threadsInDb()) out(BACK_FIRST)
|
|
2517
|
-
if (dry) out(`a look: nothing ${this.tidy ? 'removed' : 'moved'}. sk thread move ${this.tidy ? '--tidy --go removes' : this.back ? '--back --go moves' : '--go moves'}`)
|
|
2518
|
-
return r.ok ? 0 : 1
|
|
2519
|
-
} finally {
|
|
2520
|
-
lease?.release()
|
|
2676
|
+
const from = this.from == null ? {} : { from: resolve(this.from) }
|
|
2677
|
+
const passes = stores.map((d) => importFolders(d, { dry, ...from }))
|
|
2678
|
+
for (const l of importLines(passes, dry)) h.out(l)
|
|
2679
|
+
if (dry) {
|
|
2680
|
+
h.out('a look: nothing written. sk thread import --go writes it')
|
|
2681
|
+
return 0
|
|
2521
2682
|
}
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
}
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
const { threadsDiff, threadsOn, heldRepos } = await import('../hq/thread-sync.ts')
|
|
2533
|
-
const { confirmedUp } = await import('../media-store/remote.ts')
|
|
2534
|
-
const up = (key: string, size: number): Promise<boolean> => confirmedUp(key, size)
|
|
2535
|
-
if (!threadsOn()) return { hqLacks: async () => ({ refused: 'the switch hq-cards is off: no hq holds them' }), up }
|
|
2536
|
-
const { myHq } = await import('../hq/hq-local.ts')
|
|
2537
|
-
const hq = myHq()
|
|
2538
|
-
if ('refused' in hq) return { hqLacks: async () => ({ refused: `the hq is not reached (${hq.refused})` }), up }
|
|
2539
|
-
const { dirname } = await import('node:path')
|
|
2540
|
-
const { held, left } = await heldRepos(stores.map((d) => ({ name: d, path: dirname(dirname(d)) })))
|
|
2541
|
-
const diff = await threadsDiff(hq, held)
|
|
2542
|
-
if ('refused' in diff) return { hqLacks: async () => ({ refused: `the hq refused the check: ${diff.refused}` }), up }
|
|
2543
|
-
const { repoIdOf } = await import('../review/item-db.ts')
|
|
2544
|
-
const byRepo = new Map(diff.map((d) => [d.repo, new Set([...d.onlyHere, ...d.differ])]))
|
|
2545
|
-
return {
|
|
2546
|
-
hqLacks: async (dir) => {
|
|
2547
|
-
const set = byRepo.get(repoIdOf(dir))
|
|
2548
|
-
if (set != null) return set
|
|
2549
|
-
return { refused: left.some((l) => dir.startsWith(l)) ? 'a repo with no remote: the hq carries none of its threads' : 'the hq holds no threads of this repo' }
|
|
2550
|
-
},
|
|
2551
|
-
up,
|
|
2552
|
-
}
|
|
2553
|
-
}
|
|
2554
|
-
|
|
2555
|
-
/** with the switch hq-cards on, what the hq and this machine's files do not hold alike, a line each: the move's
|
|
2556
|
-
* proof that nothing it leaves behind is missing elsewhere. Null with the switch off */
|
|
2557
|
-
function hqDiffOf(stores: readonly string[]): () => Promise<string[] | null> {
|
|
2558
|
-
return async () => {
|
|
2559
|
-
const { threadsDiff, threadsOn, heldRepos } = await import('../hq/thread-sync.ts')
|
|
2560
|
-
if (!threadsOn()) return null
|
|
2561
|
-
const { myHq } = await import('../hq/hq-local.ts')
|
|
2562
|
-
const hq = myHq()
|
|
2563
|
-
if ('refused' in hq) return [`the hq is not reached (${hq.refused}): the check hq-cards cannot prove both sides equal`]
|
|
2564
|
-
const { dirname } = await import('node:path')
|
|
2565
|
-
const { held } = await heldRepos(stores.map((d) => ({ name: d, path: dirname(dirname(d)) })))
|
|
2566
|
-
const diff = await threadsDiff(hq, held)
|
|
2567
|
-
if ('refused' in diff) return [`the hq refused the check: ${diff.refused}`]
|
|
2568
|
-
return diff.flatMap((d) => (d.onlyHere.length + d.onlyHq.length + d.differ.length === 0 ? [] : [`${d.repo}: ${d.onlyHere.length} only here, ${d.onlyHq.length} only in the hq, ${d.differ.length} at two revs (${[...d.onlyHere, ...d.onlyHq, ...d.differ].slice(0, 3).join(', ')})`]))
|
|
2683
|
+
const left = passes.flatMap((p) => notInRows(p).map((l) => `${p.dir}: ${l}`))
|
|
2684
|
+
if (left.length > 0) {
|
|
2685
|
+
h.err(`FAIL: review import: ${left.length} items or messages it read are not in the rows: run it again`)
|
|
2686
|
+
for (const l of left.slice(0, 20)) h.err(` ${l}`)
|
|
2687
|
+
return 1
|
|
2688
|
+
}
|
|
2689
|
+
const broken = passes.reduce((n, p) => n + p.broken.length, 0)
|
|
2690
|
+
h.out(`ok: ${passes.reduce((n, p) => n + p.items, 0)} threads read, each one in the rows of the daemon's database; the folders stay as they are`)
|
|
2691
|
+
return broken > 0 ? 1 : 0
|
|
2692
|
+
})
|
|
2569
2693
|
}
|
|
2570
2694
|
}
|
|
2571
2695
|
|
|
@@ -2573,8 +2697,8 @@ export class ReviewExportCommand extends Command {
|
|
|
2573
2697
|
static override paths = [['review', 'export']]
|
|
2574
2698
|
static override usage = Command.Usage({
|
|
2575
2699
|
category: 'Review',
|
|
2576
|
-
description: 'threads of this repo written as
|
|
2577
|
-
details: `${DETAILS}\n\
|
|
2700
|
+
description: 'threads of this repo written as folders, one an item, into a folder of yours',
|
|
2701
|
+
details: `${DETAILS}\n\nEvery thread is rows of the daemon's database; export writes each one as a folder a person reads (\`<to>/<id>/item.json\`, \`thread/<message>.json\`, and each media file this machine still holds; a file the disk let go is named, its key in the head's media). sk thread import --from <to> reads it back. Nothing in the rows changes.`,
|
|
2578
2702
|
examples: [['one item', 'sk thread export 20261118-210000-the-gate --to /tmp/threads'], ['every item of the repo', 'sk thread export --all --to /tmp/threads']],
|
|
2579
2703
|
})
|
|
2580
2704
|
all = Option.Boolean('--all', false, { description: 'every item of the repo' })
|
|
@@ -2583,28 +2707,24 @@ export class ReviewExportCommand extends Command {
|
|
|
2583
2707
|
|
|
2584
2708
|
async execute(): Promise<number> {
|
|
2585
2709
|
return run(this.context, async (h) => {
|
|
2586
|
-
const { threadsInDb } = await import('../hq/switch.ts')
|
|
2587
2710
|
const { resolve } = await import('node:path')
|
|
2711
|
+
const { realpathSync } = await import('node:fs')
|
|
2588
2712
|
if (this.all === this.ids.length > 0) throw new Error('give item ids or --all')
|
|
2589
2713
|
const to = resolve(this.to)
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
const { cpSync, existsSync } = await import('node:fs')
|
|
2597
|
-
const { itemIds } = await import('../review/store.ts')
|
|
2598
|
-
const { join } = await import('node:path')
|
|
2599
|
-
const want = ids ?? itemIds(h.dir)
|
|
2600
|
-
for (const id of want) if (!existsSync(join(to, id))) cpSync(join(h.dir, id), join(to, id), { recursive: true })
|
|
2601
|
-
r = { dir: h.dir, items: want.length, heads: want.length, msgs: 0, gone: 0, same: 0, files: 0, kept: [], broken: [], read: [] }
|
|
2714
|
+
const real = (p: string): string => {
|
|
2715
|
+
try {
|
|
2716
|
+
return realpathSync(p)
|
|
2717
|
+
} catch {
|
|
2718
|
+
return resolve(p)
|
|
2719
|
+
}
|
|
2602
2720
|
}
|
|
2603
|
-
|
|
2721
|
+
if (real(to) === real(h.dir)) throw new Error(`--to ${this.to}: the store's own folder, which sk thread import reads as an older shipkit's store`)
|
|
2722
|
+
const ids = this.all ? undefined : await Promise.all(this.ids.map((r) => idOf(h.dir, r)))
|
|
2723
|
+
const r = (await import('../review/folders.ts')).exportFolders(h.dir, to, ids)
|
|
2724
|
+
h.out(`review: ${r.items} items written into ${to} (${r.heads} heads, ${r.msgs} messages, ${r.media?.copied ?? 0} media files)`)
|
|
2604
2725
|
for (const k of r.kept) h.out(` kept: ${k}`)
|
|
2605
|
-
for (const b of r.broken) h.err(` does not read: ${b}`)
|
|
2606
2726
|
if (r.media && r.media.missing.length > 0) h.out(` ${r.media.missing.length} media files this machine no longer holds (the Space has them by their key in the head): ${r.media.missing.slice(0, 5).join(', ')}`)
|
|
2607
|
-
return
|
|
2727
|
+
return 0
|
|
2608
2728
|
})
|
|
2609
2729
|
}
|
|
2610
2730
|
}
|
|
@@ -2764,7 +2884,7 @@ export class ReviewMigrateCommand extends Command {
|
|
|
2764
2884
|
static override usage = Command.Usage({
|
|
2765
2885
|
category: 'Review',
|
|
2766
2886
|
description: "fold the threads that own one address into one; dry run, --go after a backup",
|
|
2767
|
-
details: `${DETAILS}\n\nA look unless --go: per store, the links it would write (address, version, the version it supersedes) and the threads before and after. --go
|
|
2887
|
+
details: `${DETAILS}\n\nA look unless --go: per store, the links it would write (address, version, the version it supersedes) and the threads before and after. --go writes each link through the head's one rewrite path, and nothing else: no backup run holds a head (the hq does, with its copies). Only a missing link is written: a second run finds nothing. His notes read in their thread already: none is written. Each changed head goes to the hq like any changed head. Page: wiki tools/shipkit/threads-store.md, The one thread guard`,
|
|
2768
2888
|
examples: [['what it would fold here', 'sk thread migrate'], ['every house store', 'sk thread migrate --all'], ['fold them', 'sk thread migrate --all --go']],
|
|
2769
2889
|
})
|
|
2770
2890
|
go = Option.Boolean('--go', false, { description: 'write the links, after a backup' })
|
|
@@ -2776,15 +2896,13 @@ export class ReviewMigrateCommand extends Command {
|
|
|
2776
2896
|
const { openReview } = await import('../review/project.ts')
|
|
2777
2897
|
const { foldStore } = await import('../review/thread-fold.ts')
|
|
2778
2898
|
const { repoIdOf } = await import('../review/item-db.ts')
|
|
2779
|
-
const { threadsInDb } = await import('../hq/switch.ts')
|
|
2780
|
-
const { existsSync } = await import('node:fs')
|
|
2781
2899
|
const dirs = this.all ? await houseStores() : [h.dir]
|
|
2782
2900
|
const seen = new Set<string>()
|
|
2783
2901
|
const stores = dirs.filter((d) => {
|
|
2784
|
-
const key =
|
|
2902
|
+
const key = repoIdOf(d)
|
|
2785
2903
|
if (seen.has(key)) return false
|
|
2786
2904
|
seen.add(key)
|
|
2787
|
-
return
|
|
2905
|
+
return true
|
|
2788
2906
|
})
|
|
2789
2907
|
const plans = []
|
|
2790
2908
|
for (const d of stores) {
|
|
@@ -2799,14 +2917,9 @@ export class ReviewMigrateCommand extends Command {
|
|
|
2799
2917
|
return 0
|
|
2800
2918
|
}
|
|
2801
2919
|
if (!this.go) {
|
|
2802
|
-
h.out(`a look: nothing written. ${this.all ? 'sk thread migrate --all --go' : 'sk thread migrate --go'}
|
|
2920
|
+
h.out(`a look: nothing written. ${this.all ? 'sk thread migrate --all --go' : 'sk thread migrate --go'} folds`)
|
|
2803
2921
|
return 0
|
|
2804
2922
|
}
|
|
2805
|
-
h.out('backup first: sk backup')
|
|
2806
|
-
const b = Bun.spawnSync(['sk', 'backup'], { stdout: 'pipe', stderr: 'pipe' })
|
|
2807
|
-
const said = `${b.stdout?.toString() ?? ''}${b.stderr?.toString() ?? ''}`.trim()
|
|
2808
|
-
for (const l of said.split('\n').slice(-3)) h.out(` ${l}`)
|
|
2809
|
-
if (b.exitCode !== 0) throw new Error('sk backup failed: nothing folded, the stores are as they were')
|
|
2810
2923
|
for (const p of todo) {
|
|
2811
2924
|
const r = foldStore(p.d, { go: true })
|
|
2812
2925
|
h.out(`${p.d}: ${r.links.length} links written, ${r.before} threads to ${r.after}`)
|
|
@@ -2849,12 +2962,13 @@ export const REVIEW_COMMANDS = [
|
|
|
2849
2962
|
ReviewStageCommand,
|
|
2850
2963
|
ReviewAutoCommand,
|
|
2851
2964
|
ReviewWatchCommand,
|
|
2852
|
-
|
|
2965
|
+
ReviewImportCommand,
|
|
2853
2966
|
ReviewExportCommand,
|
|
2854
2967
|
ReviewMigrateCommand,
|
|
2855
2968
|
ThreadProposeCommand,
|
|
2856
2969
|
ThreadAttachCommand,
|
|
2857
2970
|
ThreadTakeCommand,
|
|
2971
|
+
ThreadTagCommand,
|
|
2858
2972
|
ThreadAssignCommand,
|
|
2859
2973
|
ThreadWorkingCommand,
|
|
2860
2974
|
]
|