rvlib-shipkit 2.26.0 → 2.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/package.json +1 -1
- package/src/agent-time/diet.ts +77 -0
- package/src/agent-time/family.ts +72 -0
- package/src/agent-time/hooks.ts +16 -7
- package/src/agent-time/limits.ts +44 -0
- package/src/agent-time/live.ts +12 -8
- package/src/agent-time/mask.ts +96 -18
- package/src/agent-time/refused.ts +45 -0
- package/src/agent-time/registry.ts +289 -0
- package/src/agent-time/render.ts +122 -21
- package/src/agent-time/report-cache.ts +57 -0
- package/src/agent-time/report.ts +314 -40
- package/src/agent-time/shape.ts +50 -3
- package/src/agent-time/store.ts +322 -101
- package/src/agent-time/timeline.ts +140 -21
- package/src/agent-time/turns.ts +18 -8
- package/src/annex/born.ts +2 -2
- package/src/annex/offload.ts +29 -17
- package/src/annex/tidy.ts +70 -10
- package/src/asks/ask-after.ts +44 -0
- package/src/asks/ask-bar-fold.ts +57 -0
- package/src/asks/ask-migrate.ts +280 -0
- package/src/asks/ask-steps-fold.ts +166 -0
- package/src/asks/ask-store.ts +586 -0
- package/src/assets/kit-config.ts +7 -3
- package/src/assets/kits/identity-kit.ts +361 -14
- package/src/assets/kits/poster-thumbnail.ts +282 -0
- package/src/check.ts +3 -1
- package/src/checks/SK003-claude-md-shape.check.ts +92 -25
- package/src/checks/SK004-gitignore-policy.check.ts +20 -9
- package/src/checks/SK013-one-way-in-policy.check.ts +18 -3
- package/src/checks/SK026-asks-autoclose.check.ts +9 -23
- package/src/checks/SK028-readme.check.ts +7 -66
- package/src/checks/SK030-cache-audit.check.ts +6 -1
- package/src/checks/SK031-trace-audit.check.ts +2 -0
- package/src/checks/SK033-global-contribution.check.ts +3 -1
- package/src/checks/SK035-public-clean.check.ts +2 -2
- package/src/checks/SK038-speaks-as.check.ts +3 -3
- package/src/checks/SK042-post-kinds.check.ts +26 -24
- package/src/checks/SK043-scratch-on-the-mac.check.ts +59 -4
- package/src/checks/SK047-login-in-description.check.ts +36 -0
- package/src/checks/SK048-one-local-file.check.ts +36 -0
- package/src/checks/SK049-thread-answers-hook.check.ts +81 -0
- package/src/checks/SK050-retired-commands.check.ts +127 -0
- package/src/cli/cmd_Asks.ts +244 -27
- package/src/cli/cmd_Backup.ts +153 -10
- package/src/cli/cmd_Calls.ts +1 -0
- package/src/cli/cmd_Capacity.ts +2 -2
- package/src/cli/cmd_Commands.ts +140 -34
- package/src/cli/cmd_Contracts.ts +1 -0
- package/src/cli/cmd_CrossRepoActivity.ts +5 -4
- package/src/cli/cmd_Db.ts +253 -0
- package/src/cli/cmd_History.ts +212 -0
- package/src/cli/cmd_Home.ts +31 -3
- package/src/cli/cmd_Hq.ts +516 -0
- package/src/cli/cmd_Keys.ts +1 -0
- package/src/cli/cmd_Lanes.ts +15 -4
- package/src/cli/cmd_Machines.ts +36 -0
- package/src/cli/cmd_Media.ts +38 -6
- package/src/cli/cmd_Messages.ts +152 -1
- package/src/cli/cmd_Needs.ts +1 -0
- package/src/cli/cmd_Reflect.ts +23 -2
- package/src/cli/cmd_Review.ts +1357 -223
- package/src/cli/cmd_Secret.ts +295 -24
- package/src/cli/cmd_Social.ts +113 -28
- package/src/cli/cmd_SocialDrafts.ts +235 -0
- package/src/cli/cmd_Sound.ts +22 -1
- package/src/cli/cmd_Space.ts +324 -0
- package/src/cli/cmd_Start.ts +3 -2
- package/src/cli/cmd_ThreadHolds.ts +34 -0
- package/src/cli/cmd_ThreadKinds.ts +146 -0
- package/src/cli/cmd_ThreadReflect.ts +83 -0
- package/src/cli/cmd_ThreadSyncNeeds.ts +62 -0
- package/src/cli/cmd_Time.ts +76 -5
- package/src/cli/cmd_Tmp.ts +28 -4
- package/src/cli/cmd_Trailer.ts +14 -10
- package/src/cli/cmd_Urls.ts +56 -0
- package/src/cli/cmd_Vault.ts +583 -0
- package/src/cli/cmd_When.ts +1 -0
- package/src/cli/family-help.ts +5 -3
- package/src/cli/family-pages.ts +1 -1
- package/src/cli/kit/builtins.ts +1 -0
- package/src/cli/kit/verb.ts +6 -2
- package/src/cli/registry.ts +44 -4
- package/src/cli.ts +5 -2
- package/src/collections/actions.ts +42 -41
- package/src/collections/collection-types.ts +30 -4
- package/src/collections/md-body.ts +5 -3
- package/src/collections/pings.ts +13 -6
- package/src/collections/providers.ts +147 -61
- package/src/collections/reflections.ts +9 -4
- package/src/collections/review.ts +4 -4
- package/src/contracts/contract-manifests.ts +6 -5
- package/src/contracts/contract-types.ts +6 -4
- package/src/contracts/contracts-engine.ts +11 -0
- package/src/contracts/manifests/chrome-web-store.contract.ts +31 -0
- package/src/core/budget.ts +12 -17
- package/src/core/capacity.ts +27 -18
- package/src/core/check-runner.ts +7 -4
- package/src/core/discover-checks.ts +18 -3
- package/src/core/git.ts +31 -0
- package/src/core/house-layout.ts +17 -0
- package/src/core/layout.ts +13 -5
- package/src/core/locked-write.ts +4 -1
- package/src/core/machine-busy.ts +127 -0
- package/src/core/machine-commit.ts +6 -1
- package/src/core/machine-db.ts +370 -20
- package/src/core/machine-layout.ts +137 -0
- package/src/core/machine-read.ts +81 -0
- package/src/core/migrate-layout.ts +9 -11
- package/src/core/one-way-in-policy.ts +64 -7
- package/src/core/polling-policy.ts +27 -0
- package/src/core/retention.ts +16 -2
- package/src/core/scope.ts +107 -14
- package/src/core/slots.ts +5 -4
- package/src/drill/clean.ts +25 -1
- package/src/drill/run.ts +1 -1
- package/src/drill/seal.ts +27 -4
- package/src/home/activity-shape.ts +2 -0
- package/src/home/activity.ts +59 -3
- package/src/home/app-sign.ts +15 -4
- package/src/home/daemon-jobs.ts +161 -7
- package/src/home/database-projects.ts +111 -0
- package/src/home/database-words.ts +203 -0
- package/src/home/databases.ts +460 -0
- package/src/home/global-units.ts +6 -0
- package/src/home/gui-app/ShipkitGui.swift +122 -1
- package/src/home/gui-app.ts +6 -3
- package/src/home/home-move.ts +514 -0
- package/src/home/home-paths.ts +18 -6
- package/src/home/home-routes.ts +76 -0
- package/src/home/inbox-shape.ts +234 -91
- package/src/home/inbox.ts +26 -71
- package/src/home/machine-fold.ts +815 -0
- package/src/home/machine-host.ts +38 -5
- package/src/home/machine-repair.ts +503 -0
- package/src/home/machine-stores.ts +66 -15
- package/src/home/machine-temp.ts +547 -86
- package/src/home/other-macs.ts +2 -2
- package/src/home/resume.ts +79 -0
- package/src/home/run-daemon.ts +25 -4
- package/src/home/run-pm.ts +18 -5
- package/src/home/serve-daemon.ts +18 -3
- package/src/home/serve-web.ts +179 -10
- package/src/home/space-job.ts +115 -0
- package/src/home/space-page.ts +257 -0
- package/src/home/space-route.ts +167 -0
- package/src/home/space-words.ts +103 -0
- package/src/home/time-page-shape.ts +202 -0
- package/src/home/time-page.ts +64 -0
- package/src/home/vault-page.ts +516 -0
- package/src/home/vault-words.ts +132 -0
- package/src/hooks/leak-guard.ts +40 -13
- package/src/hooks/one-way-in-guard.ts +41 -6
- package/src/hq/cards.ts +581 -0
- package/src/hq/door-route.ts +43 -0
- package/src/hq/door.ts +163 -0
- package/src/hq/files-send.ts +347 -0
- package/src/hq/forgotten-log.ts +35 -0
- package/src/hq/history-check.ts +255 -0
- package/src/hq/history-place.ts +146 -0
- package/src/hq/history-send.ts +487 -0
- package/src/hq/hq-db.ts +102 -0
- package/src/hq/hq-local.ts +502 -0
- package/src/hq/hq-routes.ts +204 -0
- package/src/hq/hq-store.ts +603 -0
- package/src/hq/kinds/ask.ts +147 -0
- package/src/hq/kinds/card-gone.ts +83 -0
- package/src/hq/kinds/card-msg.ts +66 -0
- package/src/hq/kinds/card.ts +99 -0
- package/src/hq/kinds/index.ts +21 -0
- package/src/hq/kinds/kind.ts +126 -0
- package/src/hq/kinds/media.ts +125 -0
- package/src/hq/kinds/prompt.ts +219 -0
- package/src/hq/kinds/reflection.ts +128 -0
- package/src/hq/kinds/report.ts +55 -0
- package/src/hq/kinds/time-day.ts +236 -0
- package/src/hq/ledger.ts +473 -0
- package/src/hq/machine-key.ts +44 -0
- package/src/hq/machine-notes.ts +131 -0
- package/src/hq/outbox.ts +374 -0
- package/src/hq/replica.ts +167 -0
- package/src/hq/repo-id.ts +4 -0
- package/src/hq/report-facts.ts +117 -0
- package/src/hq/report.ts +274 -0
- package/src/hq/switch.ts +151 -0
- package/src/hq/vault-grant.ts +92 -0
- package/src/hq/vault-route.ts +112 -0
- package/src/identities/collection.ts +2 -2
- package/src/identities/identities.ts +24 -11
- package/src/identities/machine-route.ts +8 -3
- package/src/identities/steps.ts +31 -0
- package/src/ledger/db.ts +81 -27
- package/src/ledger/gate-checks.ts +6 -2
- package/src/ledger/run-log.ts +11 -3
- package/src/ledger/store.ts +26 -4
- package/src/media-store/backup/daemon.ts +73 -25
- package/src/media-store/backup/kept.ts +241 -0
- package/src/media-store/backup/keys.ts +1 -1
- package/src/media-store/backup/manifest.ts +20 -2
- package/src/media-store/backup/prune.ts +365 -0
- package/src/media-store/backup/restore.ts +14 -4
- package/src/media-store/backup/retention.ts +122 -0
- package/src/media-store/backup/run.ts +25 -19
- package/src/media-store/backup/secret.ts +6 -4
- package/src/media-store/backup/snapshot.ts +4 -2
- package/src/media-store/backup/sources.ts +83 -31
- package/src/media-store/backup/thread-copy.ts +340 -0
- package/src/media-store/copy/config.ts +76 -0
- package/src/media-store/copy/copy.ts +194 -0
- package/src/media-store/copy/lifecycle.ts +43 -0
- package/src/media-store/copy/night.ts +90 -0
- package/src/media-store/copy/proof.ts +151 -0
- package/src/media-store/copy/snapshot.ts +152 -0
- package/src/media-store/copy/store.ts +62 -0
- package/src/media-store/copy/stream.ts +176 -0
- package/src/media-store/daemon.ts +66 -16
- package/src/media-store/db.ts +24 -13
- package/src/media-store/forget.ts +141 -3
- package/src/media-store/hand.ts +4 -3
- package/src/media-store/hq-find.ts +75 -0
- package/src/media-store/hq-send.ts +277 -0
- package/src/media-store/kind.ts +2 -0
- package/src/media-store/purge.ts +21 -17
- package/src/media-store/put.ts +24 -8
- package/src/media-store/remote.ts +16 -7
- package/src/media-store/space-listing.ts +256 -0
- package/src/media-store/space.ts +46 -26
- package/src/media-store/sync.ts +5 -5
- package/src/media-store/tidy.ts +98 -0
- package/src/media-store/upload.ts +3 -3
- package/src/media-store/webp.ts +66 -0
- package/src/messages/guard.ts +49 -0
- package/src/messages/model.ts +16 -7
- package/src/messages/objects.ts +201 -0
- package/src/messages/routes.ts +14 -4
- package/src/messages/score.ts +3 -3
- package/src/messages/write.ts +285 -0
- package/src/pages/frame-client.ts +191 -4
- package/src/plan/planner.ts +28 -17
- package/src/recordings/media-kind.ts +1 -0
- package/src/recordings/model.ts +1 -1
- package/src/recordings/recorder-app/Capture.swift +9 -7
- package/src/reflect/hq-corpus.ts +56 -0
- package/src/reflect/prompt-corpus.ts +3 -1
- package/src/reflect/transcript.ts +129 -37
- package/src/reflections/reflections-queue.ts +1 -1
- package/src/release/gate-checkout.ts +2 -1
- package/src/release/git-facts.ts +3 -2
- package/src/release/machine-words.ts +67 -0
- package/src/release/public-clean.ts +11 -5
- package/src/releases/from-card.ts +1 -1
- package/src/releases/routes.ts +10 -5
- package/src/releases/store.ts +10 -1
- package/src/repo-config.ts +71 -19
- package/src/review/anim.ts +3 -3
- package/src/review/answer-kinds.ts +131 -0
- package/src/review/auto.ts +2 -2
- package/src/review/band.ts +53 -0
- package/src/review/branch-hold.ts +84 -0
- package/src/review/card-db.ts +254 -0
- package/src/review/card-rows.ts +267 -0
- package/src/review/cells.ts +360 -57
- package/src/review/close.ts +92 -0
- package/src/review/draft-card.ts +33 -0
- package/src/review/draft-model.ts +78 -0
- package/src/review/events.ts +171 -0
- package/src/review/format.ts +152 -19
- package/src/review/glyphs.ts +63 -0
- package/src/review/gone.ts +98 -0
- package/src/review/holds-sync.ts +62 -0
- package/src/review/holds.ts +85 -0
- package/src/review/house-kind-defs.ts +41 -0
- package/src/review/inbox-hook.ts +23 -10
- package/src/review/inbox-read.ts +201 -0
- package/src/review/instructions.ts +199 -0
- package/src/review/kind-apply.ts +61 -0
- package/src/review/kind-catalog.ts +96 -0
- package/src/review/kinds.ts +278 -0
- package/src/review/lane-ask.ts +109 -0
- package/src/review/marks.ts +1 -1
- package/src/review/media-kind.ts +7 -5
- package/src/review/media-read.ts +9 -7
- package/src/review/media.ts +32 -5
- package/src/review/model.ts +582 -109
- package/src/review/move.ts +491 -0
- package/src/review/need-address.ts +15 -0
- package/src/review/need-threads.ts +93 -0
- package/src/review/notes.ts +12 -20
- package/src/review/object-card.ts +48 -0
- package/src/review/object-read.ts +31 -0
- package/src/review/owner-verdict.ts +36 -0
- package/src/review/parties.ts +182 -0
- package/src/review/previews.ts +18 -20
- package/src/review/project.ts +1 -1
- package/src/review/projections.ts +235 -0
- package/src/review/referring.ts +54 -0
- package/src/review/reflection-object.ts +195 -0
- package/src/review/rev.ts +8 -0
- package/src/review/role.ts +1 -1
- package/src/review/routes.ts +194 -38
- package/src/review/secret-route.ts +80 -0
- package/src/review/snooze.ts +38 -0
- package/src/review/stage-card.ts +12 -8
- package/src/review/stage-routes.ts +1 -1
- package/src/review/store.ts +851 -124
- package/src/review/supersede.ts +116 -0
- package/src/review/take-back.ts +52 -0
- package/src/review/thread-fold.ts +64 -0
- package/src/review/threads.ts +349 -14
- package/src/review/traces.ts +218 -0
- package/src/review/trailer-auto-mock.ts +63 -0
- package/src/review/trailer-card.ts +6 -6
- package/src/review/trailer-desk.ts +41 -7
- package/src/review/trailer-media.ts +1 -0
- package/src/review/trailer-model.ts +8 -0
- package/src/review/trailer-notes.ts +1 -1
- package/src/review/trailer-routes.ts +9 -1
- package/src/review/unit.ts +77 -11
- package/src/review/verdict-items.ts +73 -0
- package/src/review/verdict-write.ts +15 -0
- package/src/review/wait.ts +85 -0
- package/src/review/watchers.ts +23 -10
- package/src/rules/untrack-generated.ts +92 -8
- package/src/scaffold/files/claude-settings-local.json +2 -0
- package/src/secrets/archive-mark.ts +52 -0
- package/src/secrets/archive.ts +83 -0
- package/src/secrets/copy.ts +14 -14
- package/src/secrets/held.ts +16 -0
- package/src/secrets/keychain-write.ts +48 -0
- package/src/secrets/keychain.ts +116 -0
- package/src/secrets/lapse-mark.ts +33 -0
- package/src/secrets/lapse.ts +60 -0
- package/src/secrets/list.ts +21 -17
- package/src/secrets/manager.ts +55 -26
- package/src/secrets/read.ts +385 -0
- package/src/secrets/tail.ts +31 -0
- package/src/secrets/who-reads.ts +49 -0
- package/src/serve/door-forward.ts +268 -0
- package/src/serve/door-names.ts +47 -0
- package/src/serve/embed.ts +1 -1
- package/src/serve/hub-app/activity-view.tsx +56 -32
- package/src/serve/hub-app/activity.css +7 -1
- package/src/serve/hub-app/asks-page.tsx +49 -0
- package/src/serve/hub-app/asks-st.ts +25 -0
- package/src/serve/hub-app/auto-text.tsx +14 -6
- package/src/serve/hub-app/benign-errors.ts +15 -1
- package/src/serve/hub-app/card-head.tsx +49 -0
- package/src/serve/hub-app/check-view.tsx +3 -2
- package/src/serve/hub-app/clock-svc.ts +1 -2
- package/src/serve/hub-app/code-copy.ts +35 -0
- package/src/serve/hub-app/col-card.tsx +72 -30
- package/src/serve/hub-app/col-list-page.tsx +125 -0
- package/src/serve/hub-app/col-list-st.ts +103 -0
- package/src/serve/hub-app/col-tables-view.tsx +17 -45
- package/src/serve/hub-app/col-tables.ts +76 -8
- package/src/serve/hub-app/cols-svc.ts +18 -39
- package/src/serve/hub-app/commands/commands-page.tsx +2 -1
- package/src/serve/hub-app/controls.css +83 -0
- package/src/serve/hub-app/database-st.ts +260 -0
- package/src/serve/hub-app/database-view.tsx +289 -0
- package/src/serve/hub-app/database.css +32 -0
- package/src/serve/hub-app/entry-bar.css +14 -0
- package/src/serve/hub-app/entry-bar.tsx +33 -0
- package/src/serve/hub-app/entry-pick.ts +31 -0
- package/src/serve/hub-app/floating.tsx +1 -0
- package/src/serve/hub-app/frames-st.ts +17 -1
- package/src/serve/hub-app/git-view.tsx +3 -2
- package/src/serve/hub-app/hash-route.ts +11 -1
- package/src/serve/hub-app/header-bar.tsx +14 -18
- package/src/serve/hub-app/home-st.ts +142 -11
- package/src/serve/hub-app/home-strip.css +6 -25
- package/src/serve/hub-app/home-strip.tsx +60 -93
- package/src/serve/hub-app/home.html +10 -0
- package/src/serve/hub-app/house-wiki-view.tsx +20 -0
- package/src/serve/hub-app/hub-app.tsx +71 -166
- package/src/serve/hub-app/hub-types.ts +5 -1
- package/src/serve/hub-app/hub.css +146 -71
- package/src/serve/hub-app/icons.tsx +32 -5
- package/src/serve/hub-app/identities-st.ts +56 -6
- package/src/serve/hub-app/identities-view.tsx +104 -61
- package/src/serve/hub-app/identities.css +17 -15
- package/src/serve/hub-app/identity-address.ts +5 -0
- package/src/serve/hub-app/inbox-st.ts +227 -49
- package/src/serve/hub-app/inbox-view.tsx +204 -120
- package/src/serve/hub-app/inbox.css +47 -47
- package/src/serve/hub-app/index.html +10 -0
- package/src/serve/hub-app/instructions.css +30 -0
- package/src/serve/hub-app/kept-cols.tsx +7 -0
- package/src/serve/hub-app/keys.ts +32 -17
- package/src/serve/hub-app/later.tsx +26 -0
- package/src/serve/hub-app/list-filter.tsx +14 -0
- package/src/serve/hub-app/list-walk.ts +72 -3
- package/src/serve/hub-app/machine-st.ts +2 -2
- package/src/serve/hub-app/machines-st.ts +251 -0
- package/src/serve/hub-app/machines-view.tsx +217 -0
- package/src/serve/hub-app/machines.css +67 -0
- package/src/serve/hub-app/markdown.css +51 -0
- package/src/serve/hub-app/md-copy.tsx +57 -0
- package/src/serve/hub-app/md.ts +25 -9
- package/src/serve/hub-app/media-view.tsx +4 -2
- package/src/serve/hub-app/messages/messages-page.tsx +81 -8
- package/src/serve/hub-app/messages/messages-st.ts +99 -3
- package/src/serve/hub-app/messages.css +14 -1
- package/src/serve/hub-app/objects.css +51 -0
- package/src/serve/hub-app/page-keys.ts +175 -0
- package/src/serve/hub-app/pages-frames.tsx +21 -3
- package/src/serve/hub-app/palette-st.ts +58 -11
- package/src/serve/hub-app/palette-view.tsx +3 -1
- package/src/serve/hub-app/pane-boundary.tsx +72 -0
- package/src/serve/hub-app/pane-errors.ts +54 -0
- package/src/serve/hub-app/plan-view.tsx +3 -2
- package/src/serve/hub-app/planned-view.tsx +3 -3
- package/src/serve/hub-app/planned.css +0 -4
- package/src/serve/hub-app/processes-view.tsx +3 -2
- package/src/serve/hub-app/project-list.css +46 -8
- package/src/serve/hub-app/project-list.tsx +125 -59
- package/src/serve/hub-app/projects-svc.ts +83 -8
- package/src/serve/hub-app/reader-chips.tsx +13 -0
- package/src/serve/hub-app/readme-view.tsx +2 -3
- package/src/serve/hub-app/readme.css +22 -6
- package/src/serve/hub-app/reflections-page.tsx +95 -0
- package/src/serve/hub-app/reflections-st.ts +17 -0
- package/src/serve/hub-app/releases/releases-page.tsx +28 -4
- package/src/serve/hub-app/releases/releases-st.ts +1 -1
- package/src/serve/hub-app/releases.css +0 -1
- package/src/serve/hub-app/repo-sections.ts +9 -5
- package/src/serve/hub-app/repo-st.ts +35 -8
- package/src/serve/hub-app/review/code-colors.ts +30 -0
- package/src/serve/hub-app/review/diff-view.tsx +75 -0
- package/src/serve/hub-app/review/dock.tsx +104 -0
- package/src/serve/hub-app/review/draft-card.tsx +163 -0
- package/src/serve/hub-app/review/group-block.tsx +209 -0
- package/src/serve/hub-app/review/instructions-view.tsx +116 -0
- package/src/serve/hub-app/review/item-verdict.tsx +38 -0
- package/src/serve/hub-app/review/kind-states.tsx +193 -0
- package/src/serve/hub-app/review/kind-view.tsx +1 -37
- package/src/serve/hub-app/review/kit.tsx +75 -29
- package/src/serve/hub-app/review/lane-bar.tsx +64 -0
- package/src/serve/hub-app/review/note-place.ts +1 -1
- package/src/serve/hub-app/review/object-card.tsx +62 -0
- package/src/serve/hub-app/review/object-panel.tsx +179 -0
- package/src/serve/hub-app/review/question-views.tsx +385 -0
- package/src/serve/hub-app/review/review-board.tsx +2 -2
- package/src/serve/hub-app/review/review-cells.tsx +148 -87
- package/src/serve/hub-app/review/review-kit.ts +27 -1
- package/src/serve/hub-app/review/review-list.tsx +160 -65
- package/src/serve/hub-app/review/review-page.tsx +12 -12
- package/src/serve/hub-app/review/review-st.ts +174 -47
- package/src/serve/hub-app/review/review-thread.tsx +214 -53
- package/src/serve/hub-app/review/review-views.tsx +494 -159
- package/src/serve/hub-app/review/thread-close.tsx +124 -0
- package/src/serve/hub-app/review/thread-control-st.ts +115 -0
- package/src/serve/hub-app/review/thread-control.tsx +74 -0
- package/src/serve/hub-app/review/thread-st.ts +288 -41
- package/src/serve/hub-app/review/trailer-card.tsx +2 -2
- package/src/serve/hub-app/review/trailer-page.tsx +37 -16
- package/src/serve/hub-app/review/trailer-st.ts +41 -7
- package/src/serve/hub-app/review/trailer-timeline.tsx +2 -2
- package/src/serve/hub-app/review.css +462 -97
- package/src/serve/hub-app/section-head.tsx +51 -0
- package/src/serve/hub-app/side-lists.ts +72 -0
- package/src/serve/hub-app/sidebar.tsx +6 -3
- package/src/serve/hub-app/site/site-part.tsx +2 -8
- package/src/serve/hub-app/site/site-st.ts +4 -4
- package/src/serve/hub-app/social/calendar.tsx +5 -11
- package/src/serve/hub-app/social/comms-page.tsx +43 -15
- package/src/serve/hub-app/social/kit.tsx +32 -13
- package/src/serve/hub-app/social/next-release.tsx +3 -5
- package/src/serve/hub-app/social/post-card.tsx +142 -49
- package/src/serve/hub-app/social/post-page.tsx +80 -0
- package/src/serve/hub-app/social/problems.tsx +5 -9
- package/src/serve/hub-app/social/serial-writes.ts +13 -0
- package/src/serve/hub-app/social/social-model.ts +24 -5
- package/src/serve/hub-app/social/social-page.tsx +95 -36
- package/src/serve/hub-app/social/social-st.ts +162 -41
- package/src/serve/hub-app/social/stage-popup.tsx +1 -1
- package/src/serve/hub-app/social/stage-st.ts +1 -1
- package/src/serve/hub-app/social/step-layout.ts +1 -1
- package/src/serve/hub-app/social.css +10 -17
- package/src/serve/hub-app/space-st.ts +209 -0
- package/src/serve/hub-app/space-view.tsx +196 -0
- package/src/serve/hub-app/space.css +27 -0
- package/src/serve/hub-app/stores/stores-page.tsx +97 -25
- package/src/serve/hub-app/stores/stores-st.ts +44 -19
- package/src/serve/hub-app/stores.css +6 -1
- package/src/serve/hub-app/theme-st.ts +22 -9
- package/src/serve/hub-app/thread-row.tsx +101 -0
- package/src/serve/hub-app/time-ago.tsx +3 -2
- package/src/serve/hub-app/time-charts.tsx +291 -0
- package/src/serve/hub-app/time-pages.tsx +749 -0
- package/src/serve/hub-app/time-st.ts +162 -0
- package/src/serve/hub-app/time-view.tsx +77 -0
- package/src/serve/hub-app/time.css +135 -0
- package/src/serve/hub-app/tree-build.ts +52 -42
- package/src/serve/hub-app/tree-row.tsx +3 -11
- package/src/serve/hub-app/tree-svc.ts +18 -9
- package/src/serve/hub-app/urls-svc.ts +154 -0
- package/src/serve/hub-app/urls-view.tsx +117 -0
- package/src/serve/hub-app/urls.css +30 -0
- package/src/serve/hub-app/vault-st.ts +127 -0
- package/src/serve/hub-app/vault-view.tsx +154 -0
- package/src/serve/hub-app/vault.css +38 -0
- package/src/serve/hub-app/veille/veille-page.tsx +2 -11
- package/src/serve/hub-app/veille/veille-st.ts +12 -10
- package/src/serve/hub-app/veille.css +0 -1
- package/src/serve/hub-app/waiting-svc.ts +29 -0
- package/src/serve/hub-app/when-view.tsx +6 -3
- package/src/serve/hub-app/wiki-st.ts +30 -4
- package/src/serve/hub-app/wikis-view.tsx +6 -5
- package/src/serve/hub-runtime.ts +35 -8
- package/src/serve/project-gutter-route.ts +42 -19
- package/src/serve/project-gutter.ts +16 -50
- package/src/serve/same-origin.ts +13 -0
- package/src/serve/secret-gate.ts +21 -0
- package/src/serve/serve-hub.ts +38 -20
- package/src/serve/tailnet-caller.ts +117 -0
- package/src/shipkit-files.ts +16 -2
- package/src/shipkit.ts +3 -3
- package/src/shot/shooter.ts +616 -420
- package/src/shot/shot-ask.ts +246 -155
- package/src/site/desk.ts +4 -4
- package/src/smoke/run-smoke.ts +6 -6
- package/src/social/brands.ts +4 -0
- package/src/social/card-drafts.ts +11 -19
- package/src/social/cover.ts +202 -0
- package/src/social/desk-index.ts +34 -13
- package/src/social/discord-layout.ts +37 -13
- package/src/social/drafts.ts +7 -4
- package/src/social/import-drafts.ts +244 -0
- package/src/social/kind-pages.ts +3 -3
- package/src/social/kinds.ts +1 -1
- package/src/social/load.ts +111 -65
- package/src/social/media-kind.ts +68 -160
- package/src/social/media-of.ts +5 -4
- package/src/social/open.ts +3 -2
- package/src/social/post-object.ts +120 -0
- package/src/social/post-sources.ts +136 -0
- package/src/social/post-text.ts +103 -0
- package/src/social/posts.ts +378 -0
- package/src/social/presence.ts +7 -5
- package/src/social/publish/discord.ts +5 -2
- package/src/social/publish/index.ts +17 -5
- package/src/social/publish/secret.ts +4 -4
- package/src/social/release-stage.ts +79 -63
- package/src/social/routes.ts +89 -24
- package/src/social/stage.ts +43 -58
- package/src/social/stats.ts +12 -9
- package/src/social/strip.ts +4 -1
- package/src/social/text.ts +4 -3
- package/src/social/thumbnail.ts +347 -0
- package/src/social/tracker.ts +1 -1
- package/src/social/writes.ts +12 -29
- package/src/stores/collection.ts +15 -11
- package/src/stores/desk.ts +246 -47
- package/src/stores/model.ts +72 -6
- package/src/stores/routes.ts +37 -12
- package/src/stores/unit.ts +16 -10
- package/src/suite/judge-suites.ts +41 -11
- package/src/suite/select.ts +45 -3
- package/src/suite/suite-cli.ts +16 -10
- package/src/trailer/bed.ts +1 -1
- package/src/trailer/build.ts +134 -21
- package/src/trailer/ffmpeg.ts +7 -0
- package/src/trailer/fonts.ts +3 -2
- package/src/trailer/grammar.ts +201 -2
- package/src/trailer/graph.ts +42 -5
- package/src/trailer/look.ts +21 -0
- package/src/trailer/mock.ts +154 -0
- package/src/trailer/passage.ts +65 -26
- package/src/trailer/score/heard.ts +89 -0
- package/src/trailer/score/sound.ts +14 -8
- package/src/trailer/sound/eleven.ts +33 -3
- package/src/trailer/sound/run.ts +16 -6
- package/src/trailer/stitch.ts +26 -5
- package/src/trailer/titles.ts +82 -19
- package/src/trailer/versions.ts +1 -3
- package/src/trailer/vertical.ts +3 -1
- package/src/urls/frame.ts +195 -0
- package/src/urls/routes.ts +43 -0
- package/src/urls/rows.ts +171 -0
- package/src/urls/unit.ts +73 -0
- package/src/vault/house-keys.ts +42 -0
- package/src/vault/layout.ts +50 -0
- package/src/vault/policy.ts +165 -0
- package/src/vault/vault-audit.ts +276 -0
- package/src/vault/vault-client.ts +40 -0
- package/src/vault/vault-config.ts +159 -0
- package/src/vault/vault-destroy.ts +78 -0
- package/src/vault/vault-handover.ts +305 -0
- package/src/vault/vault-http.ts +360 -0
- package/src/vault/vault-import.ts +213 -0
- package/src/vault/vault-init.ts +328 -0
- package/src/vault/vault-minter.ts +271 -0
- package/src/vault/vault-restore.ts +333 -0
- package/src/vault/vault-serve.ts +342 -0
- package/src/vault/vault-snapshot.ts +281 -0
- package/src/veille/asks.ts +1 -1
- package/src/veille/desk.ts +2 -2
- package/src/veille/identity.ts +2 -2
- package/src/wiki/graph-pages.ts +13 -1
- package/src/wiki/scan-md.ts +1 -1
- package/src/asks/asks-queue.ts +0 -266
- package/src/social/migrate.ts +0 -123
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
// the drafts folders imported as post groups and posts (wiki tools/shipkit/social.md, The verbs, the thread's block, the
|
|
2
|
+
// import): each folder read as a text by the desk's own builder, every file of it kept by its key (a file the Space holds
|
|
3
|
+
// already, purged from the disk, named by its key and never sent again), the group and its posts written as events with
|
|
4
|
+
// each posted link's moment as the timeline gave it, a thread made to refer to each new group; then the desk loaded from
|
|
5
|
+
// the database compared with the desk loaded from the folders, every draft and post field by field. Re-runnable: what
|
|
6
|
+
// did not move writes nothing. The one constraint a reader breaks first: it never writes in the folders
|
|
7
|
+
import { existsSync, readdirSync, readFileSync, statSync, type Dirent } from 'node:fs'
|
|
8
|
+
import { join } from 'node:path'
|
|
9
|
+
import type { Identities } from '../identities/identities.ts'
|
|
10
|
+
import type { Attachment } from '../review/events.ts'
|
|
11
|
+
import type { PostedFrom } from '../review/projections.ts'
|
|
12
|
+
import { typeOf } from '../media-store/content.ts'
|
|
13
|
+
import { confirmedUp } from '../media-store/remote.ts'
|
|
14
|
+
import { deskOf, DRAFT_NAME, draftsDir, loadDesk, type Desk, type Draft, type DraftSource, type Media } from './load.ts'
|
|
15
|
+
import { readFacts, socialKey } from './media-facts.ts'
|
|
16
|
+
import { groupNow, mediaOf } from './post-sources.ts'
|
|
17
|
+
import { postTime } from './post-url.ts'
|
|
18
|
+
import { groupThread, keepPostFile, linkGroup, versionThreadOf, writeText } from './posts.ts'
|
|
19
|
+
import { commitMoments } from './presence.ts'
|
|
20
|
+
import { textSource } from './post-text.ts'
|
|
21
|
+
import type { SocialUnit } from './unit.ts'
|
|
22
|
+
import type { ParsedDraft } from './drafts.ts'
|
|
23
|
+
|
|
24
|
+
/** the files of a draft folder an import keeps: every one but its texts and the dot files, by its path in the folder */
|
|
25
|
+
function folderFiles(dir: string, at = ''): string[] {
|
|
26
|
+
let list: Dirent[] = []
|
|
27
|
+
try {
|
|
28
|
+
list = readdirSync(join(dir, at), { withFileTypes: true })
|
|
29
|
+
} catch {
|
|
30
|
+
return []
|
|
31
|
+
}
|
|
32
|
+
return list.flatMap((e) => {
|
|
33
|
+
if (e.name.startsWith('.')) return []
|
|
34
|
+
const rel = at === '' ? e.name : `${at}/${e.name}`
|
|
35
|
+
if (e.isDirectory()) return folderFiles(dir, rel)
|
|
36
|
+
return e.isFile() && rel !== 'draft.md' && rel !== 'post.md' ? [rel] : []
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface FolderFile {
|
|
41
|
+
name: string
|
|
42
|
+
/** on the disk, else only in the Space under `key` */
|
|
43
|
+
local: boolean
|
|
44
|
+
path: string
|
|
45
|
+
key: string | null
|
|
46
|
+
sha: string | null
|
|
47
|
+
size: number
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** a folder as the import reads it: its text, its article, every file (the disk's, then the purged ones the old record
|
|
51
|
+
* keys), and the names its text gives that no file holds */
|
|
52
|
+
export interface Folder {
|
|
53
|
+
slug: string
|
|
54
|
+
raw: string
|
|
55
|
+
article: string | null
|
|
56
|
+
files: FolderFile[]
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function readFolders(root: string): Folder[] {
|
|
60
|
+
const dir = draftsDir(root)
|
|
61
|
+
if (!existsSync(dir)) return []
|
|
62
|
+
const facts = readFacts(root)
|
|
63
|
+
const out: Folder[] = []
|
|
64
|
+
for (const slug of readdirSync(dir).sort().reverse()) {
|
|
65
|
+
const at = join(dir, slug)
|
|
66
|
+
if (!DRAFT_NAME.test(slug) || !existsSync(join(at, 'draft.md'))) continue
|
|
67
|
+
const files: FolderFile[] = folderFiles(at).map((name) => ({ name, local: true, path: join(at, name), key: null, sha: null, size: statSync(join(at, name)).size }))
|
|
68
|
+
for (const [id, f] of Object.entries(facts.files)) {
|
|
69
|
+
if (!id.startsWith(`${slug}/`)) continue
|
|
70
|
+
const name = id.slice(slug.length + 1)
|
|
71
|
+
if (files.some((x) => x.name === name)) continue
|
|
72
|
+
files.push({ name, local: false, path: join(at, name), key: socialKey(f, name), sha: f.sha, size: f.size })
|
|
73
|
+
}
|
|
74
|
+
out.push({ slug, raw: readFileSync(join(at, 'draft.md'), 'utf8'), article: existsSync(join(at, 'post.md')) ? readFileSync(join(at, 'post.md'), 'utf8') : null, files })
|
|
75
|
+
}
|
|
76
|
+
return out
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** the folders as the desk's builder reads them: the desk before the import */
|
|
80
|
+
export function folderDesk(root: string, ids: Identities, folders: readonly Folder[], o: { speaksAs?: string; unit?: SocialUnit | null }): { desk: Desk; parsed: Map<string, ParsedDraft> } {
|
|
81
|
+
const parsed = new Map<string, ParsedDraft>()
|
|
82
|
+
const sources: DraftSource[] = folders.map((f) => {
|
|
83
|
+
const seen: { parsed?: ParsedDraft } = {}
|
|
84
|
+
const media = new Map<string, Media>(f.files.map((x) => [x.name, { name: x.name, path: x.path }]))
|
|
85
|
+
const src = textSource(root, f.slug, f.raw, media, f.article, seen)
|
|
86
|
+
return { ...src, parse: (g) => (parsed.set(f.slug, src.parse(g)), parsed.get(f.slug)!) }
|
|
87
|
+
})
|
|
88
|
+
return { desk: deskOf(root, ids, sources, o), parsed }
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface Imported {
|
|
92
|
+
root: string
|
|
93
|
+
groups: number
|
|
94
|
+
posts: Record<string, number>
|
|
95
|
+
files: { local: number; space: number; missing: number }
|
|
96
|
+
created: string[]
|
|
97
|
+
wrote: { groups: number; posts: number }
|
|
98
|
+
threads: number
|
|
99
|
+
differs: { slug: string; field: string; folder: unknown; db: unknown }[]
|
|
100
|
+
missing: string[]
|
|
101
|
+
/** the old media facts record: its entries, those of a folder imported, and the slugs of those of no folder (kept
|
|
102
|
+
* in the record and its backup, never imported: no group names them) */
|
|
103
|
+
facts: { entries: number; used: number; orphans: string[] }
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** the import of one repo; `go` false writes nothing and says what it would */
|
|
107
|
+
export async function importRepo(root: string, ids: Identities, o: { speaksAs?: string; unit?: SocialUnit | null; go: boolean; sender?: string }): Promise<Imported> {
|
|
108
|
+
const folders = readFolders(root)
|
|
109
|
+
const { desk, parsed } = folderDesk(root, ids, folders, o)
|
|
110
|
+
const facts = Object.keys(readFacts(root).files)
|
|
111
|
+
const slugs = new Set(folders.map((f) => f.slug))
|
|
112
|
+
const factSlug = (id: string): string => id.slice(0, id.indexOf('/'))
|
|
113
|
+
const out: Imported = {
|
|
114
|
+
root,
|
|
115
|
+
groups: desk.drafts.length,
|
|
116
|
+
posts: { draft: 0, posted: 0, dropped: 0 },
|
|
117
|
+
files: { local: 0, space: 0, missing: 0 },
|
|
118
|
+
created: [],
|
|
119
|
+
wrote: { groups: 0, posts: 0 },
|
|
120
|
+
threads: 0,
|
|
121
|
+
differs: [],
|
|
122
|
+
missing: [],
|
|
123
|
+
facts: { entries: facts.length, used: facts.filter((id) => slugs.has(factSlug(id))).length, orphans: [...new Set(facts.map(factSlug).filter((s) => !slugs.has(s)))].sort() },
|
|
124
|
+
}
|
|
125
|
+
for (const d of desk.drafts) for (const p of d.posts) out.posts[p.posted !== '' ? 'posted' : p.dropped || d.status === 'rejected' ? 'dropped' : 'draft']!++
|
|
126
|
+
for (const f of folders) for (const x of f.files) out.files[x.local ? 'local' : 'space']++
|
|
127
|
+
const moments = commitMoments(desk, root)
|
|
128
|
+
for (const f of folders) {
|
|
129
|
+
const d = desk.drafts.find((x) => x.slug === f.slug)
|
|
130
|
+
const p = parsed.get(f.slug)
|
|
131
|
+
if (d == null || p == null) {
|
|
132
|
+
out.missing.push(f.slug)
|
|
133
|
+
continue
|
|
134
|
+
}
|
|
135
|
+
// a name the text gives that no file holds stays a name with no file: the load says so until one is given
|
|
136
|
+
const named = new Set([...(p.meta.media ?? '').split(','), ...p.sections.flatMap((s) => (s.options.media ?? '').split(','))].map((x) => x.trim()).filter((x) => x !== '' && x !== 'none'))
|
|
137
|
+
for (const n of named) if (!f.files.some((x) => x.name === n)) out.files.missing++
|
|
138
|
+
if (!o.go) continue
|
|
139
|
+
const attachments: Attachment[] = []
|
|
140
|
+
for (const x of f.files) {
|
|
141
|
+
if (x.local) attachments.push(await keepPostFile(root, x.path, x.name))
|
|
142
|
+
else {
|
|
143
|
+
if (!(await confirmedUp(x.key!, x.size))) throw new Error(`${f.slug}/${x.name}: neither on the disk nor in the Space (${x.key}): nothing of ${f.slug} written`)
|
|
144
|
+
attachments.push({ name: x.name, sha: x.sha!, size: x.size, type: typeOf(x.name), key: x.key! })
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
const at = new Map<string, { at: number | null; from: PostedFrom }>()
|
|
148
|
+
for (const m of d.posts) {
|
|
149
|
+
if (m.posted === '') continue
|
|
150
|
+
const id = postTime(m.platform, m.posted)
|
|
151
|
+
const c = moments.get(m.posted)
|
|
152
|
+
at.set(m.key, id != null ? { at: id, from: 'id' } : c != null ? { at: c, from: 'commit' } : { at: null, from: 'unknown' })
|
|
153
|
+
}
|
|
154
|
+
// rule 5: the version it was staged from refers to it, else a thread made for it, linked in the write itself
|
|
155
|
+
const from = d.review ? versionThreadOf(root, d.review) : null
|
|
156
|
+
const fresh = groupNow(root, f.slug) == null
|
|
157
|
+
const attach = fresh ? [from ?? (await groupThread(root, f.slug, d.title))] : []
|
|
158
|
+
const w = writeText(root, { draft: d, parsed: p, attachments, article: f.article }, { why: 'import', sender: o.sender ?? 'machine', states: true, moments: at, attach })
|
|
159
|
+
if (w.group) out.wrote.groups++
|
|
160
|
+
out.wrote.posts += w.posts.length
|
|
161
|
+
if (w.created) out.created.push(f.slug)
|
|
162
|
+
out.threads += attach.length
|
|
163
|
+
if (!fresh && from != null && linkGroup(root, from, f.slug, d.title, 'machine')) out.threads++
|
|
164
|
+
}
|
|
165
|
+
if (o.go) out.differs = compareDesks(desk, loadDesk(root, ids, o))
|
|
166
|
+
return out
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** a draft's fields the desk shows, and each post's, as one comparable record */
|
|
170
|
+
function shapeOf(d: Draft): Record<string, unknown> {
|
|
171
|
+
return {
|
|
172
|
+
title: d.title,
|
|
173
|
+
identity: d.identity,
|
|
174
|
+
kind: d.kind,
|
|
175
|
+
kindWhy: d.kindWhy,
|
|
176
|
+
topics: d.topics,
|
|
177
|
+
slot: d.slot,
|
|
178
|
+
status: d.status,
|
|
179
|
+
angle: d.angle,
|
|
180
|
+
alt: d.alt,
|
|
181
|
+
rating: d.rating,
|
|
182
|
+
review: d.review,
|
|
183
|
+
release: d.release,
|
|
184
|
+
article: d.article == null ? null : { ...d.article, file: '' },
|
|
185
|
+
media: d.media.map((m) => m.name),
|
|
186
|
+
guard: d.guard,
|
|
187
|
+
dropped: [...(d.dropped ?? [])].sort(),
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function postShape(p: Draft['posts'][number]): Record<string, unknown> {
|
|
192
|
+
return {
|
|
193
|
+
platform: p.platform,
|
|
194
|
+
name: p.name,
|
|
195
|
+
posted: p.posted,
|
|
196
|
+
title: p.title,
|
|
197
|
+
text: p.text,
|
|
198
|
+
body: p.body,
|
|
199
|
+
tags: p.tags,
|
|
200
|
+
tier: p.tier,
|
|
201
|
+
reply: p.reply,
|
|
202
|
+
length: p.length,
|
|
203
|
+
media: p.media?.name ?? null,
|
|
204
|
+
alt: p.alt,
|
|
205
|
+
place: p.place,
|
|
206
|
+
href: p.href,
|
|
207
|
+
pin: p.pin,
|
|
208
|
+
embeds: p.embeds,
|
|
209
|
+
footer: p.footer,
|
|
210
|
+
rating: p.rating,
|
|
211
|
+
refused: p.refused.replace(/draft:\S+/g, ''),
|
|
212
|
+
dropped: p.dropped ?? false,
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** every draft and post the folders show against the database's, field by field; a file's bytes by its sha */
|
|
217
|
+
export function compareDesks(folder: Desk, db: Desk): Imported['differs'] {
|
|
218
|
+
const out: Imported['differs'] = []
|
|
219
|
+
for (const f of folder.drafts) {
|
|
220
|
+
const d = db.drafts.find((x) => x.slug === f.slug)
|
|
221
|
+
if (d == null) {
|
|
222
|
+
out.push({ slug: f.slug, field: 'draft', folder: 'a draft', db: null })
|
|
223
|
+
continue
|
|
224
|
+
}
|
|
225
|
+
const a = shapeOf(f)
|
|
226
|
+
const b = shapeOf(d)
|
|
227
|
+
for (const k of Object.keys(a)) if (JSON.stringify(a[k]) !== JSON.stringify(b[k])) out.push({ slug: f.slug, field: k, folder: a[k], db: b[k] })
|
|
228
|
+
const keys = [...new Set([...f.posts.map((p) => p.key), ...d.posts.map((p) => p.key)])]
|
|
229
|
+
for (const k of keys) {
|
|
230
|
+
const x = f.posts.find((p) => p.key === k)
|
|
231
|
+
const y = d.posts.find((p) => p.key === k)
|
|
232
|
+
if (x == null || y == null) {
|
|
233
|
+
out.push({ slug: f.slug, field: `post ${k}`, folder: x == null ? null : 'a post', db: y == null ? null : 'a post' })
|
|
234
|
+
continue
|
|
235
|
+
}
|
|
236
|
+
const px = postShape(x)
|
|
237
|
+
const py = postShape(y)
|
|
238
|
+
for (const field of Object.keys(px)) if (JSON.stringify(px[field]) !== JSON.stringify(py[field])) out.push({ slug: f.slug, field: `${k}.${field}`, folder: px[field], db: py[field] })
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return out
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export { mediaOf }
|
package/src/social/kind-pages.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// ones' pages in the house wiki beside the house's identities folder, the project's in the repo. The desk links each
|
|
3
3
|
import { existsSync, readFileSync } from 'node:fs'
|
|
4
4
|
import { join } from 'node:path'
|
|
5
|
-
import {
|
|
5
|
+
import { HOUSE_LAYOUT } from '../core/house-layout.ts'
|
|
6
6
|
import { KIND_FOR, kindPage, POST_KINDS, type OwnKind } from './kinds.ts'
|
|
7
7
|
|
|
8
8
|
/** a kind as the desk lists it: `page` its rules page, absolute, and `title` what that page's heading says it is for;
|
|
@@ -11,8 +11,8 @@ export type DeskKind = { id: string; for: string; own: boolean; page: string | n
|
|
|
11
11
|
|
|
12
12
|
/** the house wiki, from the identities folder the desk read: `<house>/wiki`; null outside a house */
|
|
13
13
|
function houseWiki(identitiesDir: string | null): string | null {
|
|
14
|
-
if (identitiesDir == null || !identitiesDir.endsWith(
|
|
15
|
-
const wiki = join(identitiesDir.slice(0, -
|
|
14
|
+
if (identitiesDir == null || !identitiesDir.endsWith(HOUSE_LAYOUT.identities)) return null
|
|
15
|
+
const wiki = join(identitiesDir.slice(0, -HOUSE_LAYOUT.identities.length), HOUSE_LAYOUT.wiki)
|
|
16
16
|
return existsSync(wiki) ? wiki : null
|
|
17
17
|
}
|
|
18
18
|
|
package/src/social/kinds.ts
CHANGED
|
@@ -70,7 +70,7 @@ export function kindProblem(kind: string, why: string, own: readonly Pick<OwnKin
|
|
|
70
70
|
const to = OLD_KINDS[k]
|
|
71
71
|
return to == null
|
|
72
72
|
? { text: `kind "${k}" is an old word and no post kind: a text that stays on a venue is a profile row of the identity (wiki tools/shipkit/social-identities.md)`, old: true }
|
|
73
|
-
: { text: `kind "${k}" is an old word: ${to} by default, or the kind its intent reads as (
|
|
73
|
+
: { text: `kind "${k}" is an old word: ${to} by default, or the kind its intent reads as (wiki guides/post-kinds/old-words.md)`, old: true }
|
|
74
74
|
}
|
|
75
75
|
return { text: `kind "${k}" is not one of ${set}: a project's own kind is declared in its social unit's kinds (${INDEX})`, old: false }
|
|
76
76
|
}
|
package/src/social/load.ts
CHANGED
|
@@ -2,20 +2,22 @@
|
|
|
2
2
|
// message, each platform's part handed to its speaker's account; the rhythm; the load's errors. Read from the disk as
|
|
3
3
|
// it is on every call: the desks and `sk social` never hold a stale copy
|
|
4
4
|
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs'
|
|
5
|
-
import { join, relative
|
|
5
|
+
import { basename, join, relative } from 'node:path'
|
|
6
6
|
import { LAYOUT } from '../core/layout.ts'
|
|
7
7
|
import { filledText, speakerOf, type Account, type Identities, type Identity } from '../identities/identities.ts'
|
|
8
8
|
import { isPostRating, POST_RATINGS, takes, type PostRating } from '../identities/rating.ts'
|
|
9
|
-
import {
|
|
9
|
+
import { secretOfRef, setupProblems } from '../identities/steps.ts'
|
|
10
|
+
import { fileList, groupKeys, longVideo, mediaNames, tagList, topicList, type ParsedDraft, type Topic } from './drafts.ts'
|
|
10
11
|
import { compose, fillLink, messageLength } from './compose.ts'
|
|
12
|
+
import { frameProblem } from './cover.ts'
|
|
11
13
|
import { parseFrontmatter, table } from './md.ts'
|
|
12
14
|
import { type Family, familyOf, type Slot, slotOf, type WeeklySlot, weeklySlots } from './presence.ts'
|
|
13
|
-
import { purgedAt } from './media-facts.ts'
|
|
14
15
|
import { identityProblems } from './identity-words.ts'
|
|
15
16
|
import { deskKinds, type DeskKind } from './kind-pages.ts'
|
|
16
17
|
import { kindOfMeta, kindProblem } from './kinds.ts'
|
|
17
|
-
import {
|
|
18
|
+
import { limitProblem } from './media-limit.ts'
|
|
18
19
|
import { pushFailure } from './push.ts'
|
|
20
|
+
import { releaseVersionOf } from '../releases/store.ts'
|
|
19
21
|
import { ceilingAt, hasLayout, landing, placesOf, type Landing } from './reach.ts'
|
|
20
22
|
import { guardWith, type SocialUnit } from './unit.ts'
|
|
21
23
|
|
|
@@ -61,7 +63,7 @@ function ratingOf(raw: string | undefined, adult: boolean, who: string, file: st
|
|
|
61
63
|
|
|
62
64
|
|
|
63
65
|
/** a media as the draft names it, and where it is on the disk: its folder, the repo, or anywhere */
|
|
64
|
-
export type Media = { name: string; path: string }
|
|
66
|
+
export type Media = { name: string; path: string; sha?: string; size?: number; key?: string }
|
|
65
67
|
|
|
66
68
|
/** one account's part of a draft: what its card shows and what a publisher sends */
|
|
67
69
|
export type SocialPost = {
|
|
@@ -76,8 +78,13 @@ export type SocialPost = {
|
|
|
76
78
|
/** the draft's file, from the repo's root */
|
|
77
79
|
file: string
|
|
78
80
|
status: string
|
|
79
|
-
/**
|
|
81
|
+
/** its link once posted; empty, it waits */
|
|
80
82
|
posted: string
|
|
83
|
+
/** when it was posted, and where that moment came from (its link, the commit that recorded it, his mark) */
|
|
84
|
+
postedAt?: number | null
|
|
85
|
+
postedFrom?: string
|
|
86
|
+
/** the group heading it was written under (`short`, `vertical`); empty for an account's own */
|
|
87
|
+
format: string
|
|
81
88
|
kind: string
|
|
82
89
|
title: string
|
|
83
90
|
angle: string
|
|
@@ -111,6 +118,8 @@ export type SocialPost = {
|
|
|
111
118
|
rating: PostRating
|
|
112
119
|
/** why it may not go out: the repo's guard on its draft, or a place under its rating; empty, it may */
|
|
113
120
|
refused: string
|
|
121
|
+
/** he will not post it here: its key is in the draft's `dropped` */
|
|
122
|
+
dropped?: boolean
|
|
114
123
|
}
|
|
115
124
|
|
|
116
125
|
/** a draft's post.md: a long article of the identity's site */
|
|
@@ -143,12 +152,16 @@ export type Draft = {
|
|
|
143
152
|
review: string | null
|
|
144
153
|
/** the release it was staged from, `<unit>@<version>`; null when none */
|
|
145
154
|
release: string | null
|
|
155
|
+
/** the version of that release whose file the repo keeps, the page the draft links to; null when none */
|
|
156
|
+
releaseVersion: string | null
|
|
146
157
|
/** what it shows: safe, mild or explicit */
|
|
147
158
|
rating: PostRating
|
|
148
159
|
/** the repo's guard's problems with it, one line each: while one stands, nothing of it goes out */
|
|
149
160
|
guard: string[]
|
|
150
161
|
/** the accounts its group headings skip, no place of theirs taking its rating, and why */
|
|
151
162
|
skipped: { account: string; why: string }[]
|
|
163
|
+
/** the message keys he will not post (front matter `dropped`) */
|
|
164
|
+
dropped?: string[]
|
|
152
165
|
}
|
|
153
166
|
|
|
154
167
|
/** an identity's account with the repo's messages to it */
|
|
@@ -184,7 +197,7 @@ export const VERTICAL_FILE = /-vertical\.mp4$/
|
|
|
184
197
|
/** what one message breaks on its account: a text past the account's max, more tags than its `max tags`, a tier its
|
|
185
198
|
* account has not, a `## vertical` message without its video */
|
|
186
199
|
export function messageErrors(
|
|
187
|
-
post: Pick<SocialPost, 'file' | 'from' | 'length' | 'media' | 'tags' | 'tier'
|
|
200
|
+
post: Pick<SocialPost, 'file' | 'from' | 'length' | 'media' | 'tags' | 'tier'> & { format?: string },
|
|
188
201
|
a: Pick<Account, 'name' | 'max' | 'maxTags' | 'tiers'>,
|
|
189
202
|
): string[] {
|
|
190
203
|
const out: string[] = []
|
|
@@ -193,7 +206,7 @@ export function messageErrors(
|
|
|
193
206
|
out.push(`${post.file}: ## ${post.from} has ${post.tags.length} tags on ${a.name}, over its ${a.maxTags}`)
|
|
194
207
|
if (post.tier !== '' && !a.tiers.includes(post.tier))
|
|
195
208
|
out.push(`${post.file}: ## ${post.from} tier "${post.tier}" is none of ${a.name}'s: ${a.tiers.join(', ') || 'it has no tiers'}`)
|
|
196
|
-
if (post.from.split('/')[0] === VERTICAL && !VERTICAL_FILE.test(post.media?.name ?? ''))
|
|
209
|
+
if ((post.format || post.from.split('/')[0]) === VERTICAL && !VERTICAL_FILE.test(post.media?.name ?? ''))
|
|
197
210
|
out.push(`${post.file}: ## ${post.from} goes to ${a.name} without its vertical video (media: media/<name>-vertical.mp4)`)
|
|
198
211
|
return out
|
|
199
212
|
}
|
|
@@ -210,33 +223,64 @@ function weekly(root: string, errors: string[]): WeeklySlot[] {
|
|
|
210
223
|
return existsSync(abs) ? weeklySlots(table(parseFrontmatter(read(abs)).body, 'Slots'), relative(root, abs), errors) : []
|
|
211
224
|
}
|
|
212
225
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
if (
|
|
216
|
-
const { meta } = parseFrontmatter(
|
|
226
|
+
/** a long devlog post's facts from its bytes, its address on the identity's site from the social unit */
|
|
227
|
+
function article(bytes: string | null, dir: string, file: string, unit: SocialUnit | null): Article | null {
|
|
228
|
+
if (bytes == null) return null
|
|
229
|
+
const { meta } = parseFrontmatter(bytes)
|
|
217
230
|
let url = ''
|
|
218
231
|
try {
|
|
219
232
|
url = unit?.article?.(dir).url ?? ''
|
|
220
233
|
} catch {
|
|
221
234
|
url = ''
|
|
222
235
|
}
|
|
223
|
-
return { title: meta.title ?? '', description: meta.description ?? '', date: meta.date ?? '', draft: meta.draft === 'true', url, file
|
|
236
|
+
return { title: meta.title ?? '', description: meta.description ?? '', date: meta.date ?? '', draft: meta.draft === 'true', url, file }
|
|
224
237
|
}
|
|
225
238
|
|
|
226
|
-
/** the
|
|
227
|
-
|
|
239
|
+
/** the social folder holds rhythm.md and README.md: a v2 channel folder is an error; a drafts folder is no longer read,
|
|
240
|
+
* and each draft in it no group of the database is, an error naming the import (stage, save and Publish refuse then) */
|
|
241
|
+
function folderLeft(root: string, errors: string[], warnings: string[]): void {
|
|
242
|
+
const { unimported } = require('./post-sources.ts') as typeof import('./post-sources.ts')
|
|
228
243
|
const at = join(root, LAYOUT.social)
|
|
229
244
|
if (!existsSync(at)) return
|
|
230
245
|
for (const e of readdirSync(at)) {
|
|
231
|
-
if (
|
|
246
|
+
if (FOLDER_FILES.has(e) || e.startsWith('.')) continue
|
|
232
247
|
const abs = join(at, e)
|
|
233
|
-
if (
|
|
234
|
-
|
|
248
|
+
if (e === 'drafts') {
|
|
249
|
+
const left = unimported(root)
|
|
250
|
+
if (left.length > 0) errors.push(`${relative(root, abs)}/: ${left.length} draft${left.length === 1 ? '' : 's'} in no group of the database, read by nothing (${left.slice(0, 3).join(', ')}${left.length > 3 ? ', …' : ''}): sk social drafts import --go; stage, save and Publish wait for it`)
|
|
251
|
+
else warnings.push(`${relative(root, abs)}/: no longer read, its drafts are groups of the database: the folder may go once no tool of the repo reads it`)
|
|
252
|
+
}
|
|
253
|
+
else if (statSync(abs).isDirectory() && readdirSync(abs).some((f) => f.endsWith('.md'))) errors.push(`${relative(root, abs)}/: a v2 channel folder, no longer read`)
|
|
254
|
+
else errors.push(`${relative(root, abs)}: the social folder holds rhythm.md and README.md only`)
|
|
235
255
|
}
|
|
236
256
|
}
|
|
237
257
|
|
|
238
|
-
/** the
|
|
258
|
+
/** one draft as the builder takes it: a group and its posts from the database, or a text (a stage, a save, the import) */
|
|
259
|
+
export type DraftSource = {
|
|
260
|
+
slug: string
|
|
261
|
+
/** how its lines name it: `draft:<slug>`, or the text's own name */
|
|
262
|
+
file: string
|
|
263
|
+
/** its address as a folder: the social unit's `article(dir)` and `preview(dir)` read its name */
|
|
264
|
+
dir: string
|
|
265
|
+
/** the text form parsed with the groups of its speaker's accounts */
|
|
266
|
+
parse: (groups: ReadonlyMap<string, readonly string[]>) => ParsedDraft
|
|
267
|
+
/** a media name to its file; null when no file holds it */
|
|
268
|
+
media: (name: string) => Media | null
|
|
269
|
+
/** a long devlog post's bytes, null without one */
|
|
270
|
+
article: string | null
|
|
271
|
+
/** each posted post's moment, by key */
|
|
272
|
+
postedAt?: ReadonlyMap<string, { at: number | null; from: string }>
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/** the desk of a repo: every identity with its accounts, the repo's posts on them, the newest group first. The groups
|
|
276
|
+
* and posts are the database's (post-sources.ts); a stage, a save and the import build theirs from a text (`deskOf`) */
|
|
239
277
|
export function loadDesk(root: string, ids: Identities, o: { speaksAs?: string | undefined; unit?: SocialUnit | null; now?: Date } = {}): Desk {
|
|
278
|
+
const { groupSources } = require('./post-sources.ts') as typeof import('./post-sources.ts')
|
|
279
|
+
return deskOf(root, ids, groupSources(root), o)
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/** the desk built from these drafts */
|
|
283
|
+
export function deskOf(root: string, ids: Identities, sources: readonly DraftSource[], o: { speaksAs?: string | undefined; unit?: SocialUnit | null; now?: Date } = {}): Desk {
|
|
240
284
|
const errors = [...ids.errors]
|
|
241
285
|
const warnings: string[] = []
|
|
242
286
|
const unit = o.unit ?? null
|
|
@@ -246,51 +290,35 @@ export function loadDesk(root: string, ids: Identities, o: { speaksAs?: string |
|
|
|
246
290
|
const pushed = pushFailure(root)
|
|
247
291
|
if (pushed != null) errors.push(pushed)
|
|
248
292
|
const week = weekly(root, errors)
|
|
249
|
-
|
|
250
|
-
const dir = draftsDir(root)
|
|
293
|
+
folderLeft(root, errors, warnings)
|
|
251
294
|
const drafts: Draft[] = []
|
|
252
|
-
const named = new Set<string>()
|
|
253
295
|
// the Saturday tag joins on the Mac's Saturday
|
|
254
296
|
const saturday = (o.now ?? new Date()).getDay() === 6
|
|
255
|
-
for (const
|
|
256
|
-
|
|
257
|
-
const
|
|
258
|
-
const abs = join(ddir, 'draft.md')
|
|
259
|
-
const file = relative(root, abs)
|
|
260
|
-
if (!DRAFT_NAME.test(slug) || !statSync(ddir).isDirectory()) {
|
|
261
|
-
errors.push(`${relative(root, ddir)}: a draft is a folder <YYYYMMDD-HHMMSS>-<topic>/ holding draft.md`)
|
|
262
|
-
continue
|
|
263
|
-
}
|
|
264
|
-
if (!existsSync(abs)) {
|
|
265
|
-
errors.push(`${relative(root, ddir)}: no draft.md`)
|
|
266
|
-
continue
|
|
267
|
-
}
|
|
268
|
-
const raw = read(abs)
|
|
269
|
-
const head = parseFrontmatter(raw).meta
|
|
297
|
+
for (const src of sources) {
|
|
298
|
+
const { slug, file } = src
|
|
299
|
+
const head = src.parse(new Map()).meta
|
|
270
300
|
const speaker = head.speaksAs ? ids.identities.find((i) => i.id === head.speaksAs) : own
|
|
271
301
|
if (speaker == null) {
|
|
272
302
|
errors.push(`${file}: ${head.speaksAs ? `speaksAs '${head.speaksAs}' is no identity` : 'no identity speaks for this repo'} (sk identities)`)
|
|
273
303
|
continue
|
|
274
304
|
}
|
|
275
|
-
named.add(speaker.id)
|
|
276
305
|
const accounts = identities.find((i) => i.id === speaker.id)!.accounts
|
|
277
306
|
const groups = new Map([...new Set([...FORMATS, ...accounts.map((a) => a.group).filter((g) => g !== '')])].map((g) => [g, accounts.filter((a) => a.group === g).map((a) => a.id)]))
|
|
278
|
-
const d =
|
|
307
|
+
const d = src.parse(groups)
|
|
279
308
|
errors.push(...d.errors)
|
|
280
309
|
const media = new Map<string, Media>()
|
|
281
310
|
for (const name of mediaNames(d)) {
|
|
282
|
-
const
|
|
283
|
-
if (
|
|
284
|
-
else media.set(name,
|
|
311
|
+
const m = src.media(name)
|
|
312
|
+
if (m == null) errors.push(`${file}: media "${name}" is no file of it (sk social draft media ${slug} <file> --name ${name})`)
|
|
313
|
+
else media.set(name, m)
|
|
285
314
|
}
|
|
286
|
-
for (const h of heavyMedia(root, [...media.values()].map((m) => m.path))) errors.push(`${file}: media "${relative(ddir, h.path)}" is ${mbOf(h.size)}, over the ${mbOf(MEDIA_MAX_BYTES)} GitHub takes: shrink it, name it *-trailer.mp4 when its command renders it, or keep it with sk media put`)
|
|
287
315
|
const pick = (list: string | undefined): Media[] => fileList(list).flatMap((n) => media.get(n) ?? [])
|
|
288
316
|
const ownMedia = pick(d.meta.media)
|
|
289
317
|
const draft: Draft = {
|
|
290
318
|
slug,
|
|
291
319
|
file,
|
|
292
|
-
path:
|
|
293
|
-
dir:
|
|
320
|
+
path: '',
|
|
321
|
+
dir: src.dir,
|
|
294
322
|
identity: speaker.id,
|
|
295
323
|
title: d.meta.title ?? '',
|
|
296
324
|
kind: kindOfMeta(d.meta).kind,
|
|
@@ -303,12 +331,14 @@ export function loadDesk(root: string, ids: Identities, o: { speaksAs?: string |
|
|
|
303
331
|
media: [...media.values()],
|
|
304
332
|
alt: d.meta.alt ?? '',
|
|
305
333
|
posts: [],
|
|
306
|
-
article: article(
|
|
334
|
+
article: article(src.article, src.dir, `${file} article`, unit),
|
|
307
335
|
review: reviewOf(d.meta.review, file, errors),
|
|
308
336
|
release: releaseOf(d.meta.release, file, errors),
|
|
337
|
+
releaseVersion: releaseVersionOf(root, d.meta.release),
|
|
309
338
|
rating: ratingOf(d.meta.rating, speaker.adult, speaker.name, file, errors),
|
|
310
339
|
guard: [],
|
|
311
340
|
skipped: [],
|
|
341
|
+
dropped: fileList(d.meta.dropped),
|
|
312
342
|
}
|
|
313
343
|
const kp = kindProblem(draft.kind, draft.kindWhy, unit?.kinds ?? [])
|
|
314
344
|
if (kp != null) {
|
|
@@ -357,7 +387,8 @@ export function loadDesk(root: string, ids: Identities, o: { speaksAs?: string |
|
|
|
357
387
|
errors.push(`${file}: ${refused}`)
|
|
358
388
|
}
|
|
359
389
|
}
|
|
360
|
-
const
|
|
390
|
+
const format = s.format ?? (from !== key ? from.split('/')[0]! : '')
|
|
391
|
+
const footer = (format || from.split('/')[0]) === VERTICAL ? footerText : ''
|
|
361
392
|
const tags = tagList(s.options.tags)
|
|
362
393
|
// `[[row]]` is that account's row (its `[[links]]`), so a list the identity keeps never goes stale in a draft
|
|
363
394
|
const filled = filledText(s.text, a.rows, `${file}: ## ${key}`, errors)
|
|
@@ -368,6 +399,8 @@ export function loadDesk(root: string, ids: Identities, o: { speaksAs?: string |
|
|
|
368
399
|
errors.push(`${file}: ## ${a.id} place "${place}" is no ${hasLayout(a) ? `channel of ${a.id}/layout.md` : `file of ${a.id}/places/`}`)
|
|
369
400
|
const title = s.options.title ?? ''
|
|
370
401
|
const write = at?.write || a.write
|
|
402
|
+
const posted = d.posted.get(key) ?? ''
|
|
403
|
+
const moment = posted === '' ? undefined : src.postedAt?.get(key)
|
|
371
404
|
const post: SocialPost = {
|
|
372
405
|
slug,
|
|
373
406
|
identity: speaker.id,
|
|
@@ -376,7 +409,8 @@ export function loadDesk(root: string, ids: Identities, o: { speaksAs?: string |
|
|
|
376
409
|
name: s.options.name ?? '',
|
|
377
410
|
file,
|
|
378
411
|
status: draft.status,
|
|
379
|
-
posted
|
|
412
|
+
posted,
|
|
413
|
+
...(moment ? { postedAt: moment.at, postedFrom: moment.from } : {}),
|
|
380
414
|
kind: draft.kind,
|
|
381
415
|
title,
|
|
382
416
|
angle: d.angle,
|
|
@@ -395,12 +429,14 @@ export function loadDesk(root: string, ids: Identities, o: { speaksAs?: string |
|
|
|
395
429
|
pin: s.options.pin === 'true',
|
|
396
430
|
embeds: s.options.embeds !== 'none',
|
|
397
431
|
from,
|
|
432
|
+
format,
|
|
398
433
|
footer,
|
|
399
434
|
rating,
|
|
400
435
|
refused,
|
|
436
|
+
...(draft.dropped?.includes(key) ? { dropped: true } : {}),
|
|
401
437
|
}
|
|
402
438
|
errors.push(...messageErrors(post, a))
|
|
403
|
-
if (post.media != null) {
|
|
439
|
+
if (post.media != null && existsSync(post.media.path)) {
|
|
404
440
|
const over = limitProblem(post.media.path, a.limits)
|
|
405
441
|
if (over != null) errors.push(`${file}: media "${post.media.name}" ${over} on ${a.name}: « fit » makes it a copy that fits`)
|
|
406
442
|
}
|
|
@@ -413,14 +449,32 @@ export function loadDesk(root: string, ids: Identities, o: { speaksAs?: string |
|
|
|
413
449
|
draft.guard = guardWith(unit, { title: draft.title, alt: draft.alt, texts: [...new Set(said.filter((t) => t.trim() !== ''))], files: draft.media.map((m) => m.path) })
|
|
414
450
|
for (const g of draft.guard) errors.push(`${file}: ${g}`)
|
|
415
451
|
for (const p of draft.posts) if (draft.guard.length > 0) p.refused = `the repo's guard: ${draft.guard[0]}`
|
|
452
|
+
for (const k of draft.dropped ?? []) if (!draft.posts.some((p) => p.key === k)) errors.push(`${file}: dropped names ${k}, no message of the draft (${draft.posts.map((p) => p.key).join(', ') || 'none'})`)
|
|
453
|
+
// a place he dropped is never sent: the one refusal every copy, open and publish already reads
|
|
454
|
+
for (const p of draft.posts) if (p.dropped && p.posted === '' && p.refused === '') p.refused = 'dropped: he will not post it here'
|
|
455
|
+
// a venue that picks a frame of the video as its picture offers frame 0 first: the video opens on its thumbnail
|
|
456
|
+
for (const p of draft.posts) {
|
|
457
|
+
const venue = accounts.find((a) => a.id === p.platform)?.name ?? p.platform
|
|
458
|
+
const why = frameProblem(root, { slug, platform: p.platform, venue, posted: p.posted !== '', clip: p.media, media: [...media.values()], trailer: draft.kind === 'trailer' })
|
|
459
|
+
if (why == null) continue
|
|
460
|
+
errors.push(`${file}: ## ${p.key}: ${why}`)
|
|
461
|
+
if (p.refused === '') p.refused = why
|
|
462
|
+
}
|
|
416
463
|
draft.posts.sort((x, y) => accounts.findIndex((a) => a.id === x.platform) - accounts.findIndex((a) => a.id === y.platform))
|
|
464
|
+
// a trailer's long video shows a chosen thumbnail (wiki tools/shipkit/social.md, A video's thumbnail); a posted draft is history
|
|
465
|
+
const done = draft.posts.length > 0 && draft.posts.every((p) => p.posted !== '')
|
|
466
|
+
if (draft.kind === 'trailer' && !done && draft.media.some((m) => longVideo(m.name)) && !draft.media.some((m) => /-thumbnail\.(jpe?g|png)$/i.test(m.name)))
|
|
467
|
+
warnings.push(`${file}: a trailer post with no thumbnail in its media: add the <video>-thumbnail.jpg its sk trailer keep wrote beside the kept video (a video kept before every build drew one: sk social thumbnail --draft ${slug} --at <s> --crop x,y,w,h)`)
|
|
417
468
|
drafts.push(draft)
|
|
418
469
|
}
|
|
419
|
-
|
|
470
|
+
for (const i of identities) for (const acc of i.accounts) for (const p of setupProblems(acc)) errors.push(`${acc.file}: ${p}`)
|
|
471
|
+
// a step's [[row]] names a profile row; its [[secret:<name>]] a secret the step takes; its [[draft:<slug>]] a draft, checked where the repo speaks as the account's
|
|
420
472
|
for (const i of identities)
|
|
421
473
|
for (const a of i.accounts)
|
|
422
474
|
for (const st of a.steps)
|
|
423
475
|
for (const [, ref] of st.text.matchAll(/\[\[([^\]]+)\]\]/g)) {
|
|
476
|
+
// a [[secret:<name>]] draws its own field: no row stands behind it
|
|
477
|
+
if (secretOfRef(ref!) != null) continue
|
|
424
478
|
const slug = /^draft:(.+)$/.exec(ref!)?.[1]
|
|
425
479
|
if (slug == null) {
|
|
426
480
|
if (!a.rows.some((r) => r.field === ref)) errors.push(`${a.file}: [[${ref}]] names no profile row`)
|
|
@@ -441,28 +495,20 @@ export function accountOf(desk: Desk, identity: string, account: string): DeskAc
|
|
|
441
495
|
return a
|
|
442
496
|
}
|
|
443
497
|
|
|
444
|
-
/** a draft by what a command was given: its
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
const where = `${LAYOUT.social}/drafts/`
|
|
448
|
-
let name = ref
|
|
449
|
-
if (ref.includes('/') || ref.endsWith('.md') || ref === '.') {
|
|
450
|
-
const parts = relative(draftsDir(desk.root), resolve(cwd, ref)).split(sep).filter((x) => x !== '')
|
|
451
|
-
if (parts.length === 2 && parts[1]!.endsWith('.md')) parts.pop()
|
|
452
|
-
if (parts.length !== 1 || parts[0] === '..') throw new Error(`${ref} is no draft of ${where}: a draft is a folder right under it`)
|
|
453
|
-
name = parts[0]!
|
|
454
|
-
}
|
|
498
|
+
/** a draft by what a command was given: its slug, its topic, or an old path to its folder (its last part) */
|
|
499
|
+
export function findDraft(desk: Desk, ref: string, _cwd?: string): Draft {
|
|
500
|
+
const name = ref.includes('/') || ref.endsWith('.md') ? basename(ref.replace(/\/draft\.md$/, '').replace(/\/+$/, '')) : ref
|
|
455
501
|
const hits = desk.drafts.filter((x) => x.slug === name || x.slug.replace(/^\d{8}-\d{6}-/, '') === name)
|
|
456
|
-
if (hits.length > 1) throw new Error(`"${ref}" is the topic of ${hits.length} drafts: ${hits.map((x) => x.slug).join(', ')}; give its
|
|
457
|
-
if (hits[0] == null) throw new Error(`no draft "${ref}" in
|
|
502
|
+
if (hits.length > 1) throw new Error(`"${ref}" is the topic of ${hits.length} drafts: ${hits.map((x) => x.slug).join(', ')}; give its slug`)
|
|
503
|
+
if (hits[0] == null) throw new Error(`no draft "${ref}" in the database: give its slug or its topic (sk social)`)
|
|
458
504
|
return hits[0]
|
|
459
505
|
}
|
|
460
506
|
|
|
461
507
|
/** one message of a draft by its key, `<account>` or `<account>/<name>` */
|
|
462
508
|
export function draftPost(desk: Desk, slug: string, key: string): SocialPost {
|
|
463
509
|
const d = desk.drafts.find((x) => x.slug === slug)
|
|
464
|
-
if (d == null) throw new Error(`no draft ${slug} in
|
|
510
|
+
if (d == null) throw new Error(`no draft ${slug} in the database`)
|
|
465
511
|
const p = d.posts.find((x) => x.key === key)
|
|
466
|
-
if (p == null) throw new Error(`no
|
|
512
|
+
if (p == null) throw new Error(`no post ${key} in ${slug}`)
|
|
467
513
|
return p
|
|
468
514
|
}
|