rvlib-shipkit 2.26.0 → 2.27.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 +20 -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 +6 -4
- package/src/agent-time/limits.ts +44 -0
- package/src/agent-time/live.ts +1 -3
- package/src/agent-time/mask.ts +96 -18
- package/src/agent-time/refused.ts +45 -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 +320 -99
- package/src/agent-time/timeline.ts +140 -21
- package/src/agent-time/turns.ts +18 -8
- package/src/annex/offload.ts +17 -6
- package/src/annex/tidy.ts +70 -10
- package/src/asks/ask-after.ts +40 -0
- package/src/asks/asks-queue.ts +205 -47
- package/src/assets/kit-config.ts +7 -3
- package/src/assets/kits/identity-kit.ts +289 -10
- package/src/check.ts +3 -1
- package/src/checks/SK004-gitignore-policy.check.ts +12 -5
- package/src/checks/SK013-one-way-in-policy.check.ts +8 -3
- package/src/checks/SK026-asks-autoclose.check.ts +5 -5
- 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/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/cli/cmd_Asks.ts +71 -5
- package/src/cli/cmd_Backup.ts +2 -2
- package/src/cli/cmd_Capacity.ts +2 -2
- 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_Machines.ts +36 -0
- package/src/cli/cmd_Media.ts +38 -6
- package/src/cli/cmd_Reflect.ts +23 -2
- package/src/cli/cmd_Review.ts +548 -116
- package/src/cli/cmd_Secret.ts +62 -12
- package/src/cli/cmd_Social.ts +83 -1
- package/src/cli/cmd_Space.ts +324 -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/family-help.ts +4 -2
- package/src/cli/family-pages.ts +1 -1
- package/src/cli/registry.ts +24 -3
- package/src/collections/actions.ts +63 -13
- package/src/collections/collection-types.ts +23 -1
- package/src/collections/providers.ts +117 -23
- 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/layout.ts +3 -0
- package/src/core/machine-busy.ts +127 -0
- package/src/core/machine-commit.ts +6 -1
- package/src/core/machine-db.ts +368 -20
- package/src/core/machine-layout.ts +137 -0
- package/src/core/machine-read.ts +81 -0
- package/src/core/migrate-layout.ts +1 -1
- 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 +66 -3
- package/src/home/app-sign.ts +15 -4
- package/src/home/daemon-jobs.ts +149 -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 +12 -3
- package/src/home/home-routes.ts +68 -0
- package/src/home/inbox-shape.ts +24 -14
- package/src/home/machine-fold.ts +820 -0
- package/src/home/machine-host.ts +20 -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/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 +175 -7
- 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 +482 -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 +17 -4
- 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 +348 -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 +99 -0
- package/src/hq/hq-local.ts +469 -0
- package/src/hq/hq-routes.ts +196 -0
- package/src/hq/hq-store.ts +599 -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 +372 -0
- package/src/hq/replica.ts +168 -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/identities/identities.ts +15 -3
- package/src/identities/steps.ts +31 -0
- package/src/ledger/db.ts +73 -26
- 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 +25 -17
- package/src/media-store/backup/kept.ts +241 -0
- package/src/media-store/backup/restore.ts +14 -4
- package/src/media-store/backup/run.ts +11 -11
- 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 +67 -16
- package/src/media-store/copy/config.ts +77 -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 +22 -11
- package/src/media-store/forget.ts +23 -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 +18 -15
- package/src/media-store/put.ts +24 -8
- package/src/media-store/remote.ts +16 -7
- package/src/media-store/space-listing.ts +240 -0
- package/src/media-store/space.ts +40 -21
- 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/model.ts +16 -7
- package/src/messages/routes.ts +14 -4
- package/src/messages/score.ts +2 -2
- package/src/messages/suggest.ts +96 -0
- package/src/pages/frame-client.ts +10 -0
- 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/release/machine-words.ts +67 -0
- package/src/release/public-clean.ts +8 -3
- 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 +32 -2
- package/src/review/anim.ts +2 -2
- package/src/review/auto.ts +2 -2
- package/src/review/card-db.ts +244 -0
- package/src/review/card-rows.ts +266 -0
- package/src/review/cells.ts +76 -5
- package/src/review/draft-card.ts +41 -0
- package/src/review/draft-model.ts +78 -0
- package/src/review/format.ts +29 -10
- package/src/review/gone.ts +98 -0
- package/src/review/inbox-hook.ts +4 -4
- 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 +202 -39
- package/src/review/move.ts +491 -0
- package/src/review/notes.ts +12 -20
- package/src/review/previews.ts +15 -19
- package/src/review/project.ts +1 -1
- package/src/review/rev.ts +8 -0
- package/src/review/role.ts +1 -1
- package/src/review/routes.ts +64 -13
- package/src/review/stage-card.ts +8 -4
- package/src/review/stage-routes.ts +1 -1
- package/src/review/store.ts +529 -83
- package/src/review/thread-fold.ts +51 -0
- package/src/review/threads.ts +147 -9
- package/src/review/trailer-auto-mock.ts +63 -0
- package/src/review/trailer-card.ts +4 -4
- 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 +6 -6
- package/src/review/watchers.ts +1 -1
- package/src/rules/untrack-generated.ts +92 -8
- package/src/secrets/held.ts +16 -0
- package/src/secrets/keychain.ts +113 -0
- package/src/secrets/list.ts +16 -6
- package/src/secrets/manager.ts +24 -10
- package/src/secrets/read.ts +257 -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 +48 -0
- package/src/serve/hub-app/asks-st.ts +25 -0
- package/src/serve/hub-app/clock-svc.ts +1 -2
- package/src/serve/hub-app/col-card.tsx +64 -13
- package/src/serve/hub-app/col-list-page.tsx +122 -0
- package/src/serve/hub-app/col-list-st.ts +103 -0
- package/src/serve/hub-app/col-tables-view.tsx +10 -41
- package/src/serve/hub-app/col-tables.ts +76 -8
- package/src/serve/hub-app/cols-svc.ts +70 -16
- 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/hash-route.ts +11 -1
- package/src/serve/hub-app/header-bar.tsx +14 -18
- package/src/serve/hub-app/home-st.ts +89 -9
- package/src/serve/hub-app/home-strip.css +5 -19
- package/src/serve/hub-app/home-strip.tsx +58 -92
- package/src/serve/hub-app/home.html +7 -0
- package/src/serve/hub-app/hub-app.tsx +31 -142
- package/src/serve/hub-app/hub-types.ts +3 -1
- package/src/serve/hub-app/hub.css +109 -23
- package/src/serve/hub-app/icons.tsx +18 -1
- package/src/serve/hub-app/identities-st.ts +56 -6
- package/src/serve/hub-app/identities-view.tsx +100 -58
- 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 +41 -24
- package/src/serve/hub-app/inbox-view.tsx +37 -41
- package/src/serve/hub-app/inbox.css +2 -5
- package/src/serve/hub-app/index.html +7 -0
- package/src/serve/hub-app/kept-cols.tsx +7 -0
- package/src/serve/hub-app/keys.ts +28 -15
- 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/machines-st.ts +251 -0
- package/src/serve/hub-app/machines-view.tsx +224 -0
- package/src/serve/hub-app/machines.css +76 -0
- package/src/serve/hub-app/md-copy.tsx +79 -0
- package/src/serve/hub-app/media-view.tsx +2 -0
- package/src/serve/hub-app/messages/messages-page.tsx +79 -7
- package/src/serve/hub-app/messages/messages-st.ts +99 -3
- package/src/serve/hub-app/messages.css +14 -0
- package/src/serve/hub-app/page-keys.ts +175 -0
- package/src/serve/hub-app/pages-frames.tsx +11 -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/project-list.css +54 -8
- package/src/serve/hub-app/project-list.tsx +128 -59
- package/src/serve/hub-app/projects-svc.ts +78 -7
- 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 +27 -5
- package/src/serve/hub-app/reflections-page.tsx +42 -0
- package/src/serve/hub-app/reflections-st.ts +17 -0
- package/src/serve/hub-app/releases/releases-page.tsx +25 -2
- package/src/serve/hub-app/releases/releases-st.ts +1 -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/draft-card.tsx +163 -0
- package/src/serve/hub-app/review/kit.tsx +50 -7
- package/src/serve/hub-app/review/note-place.ts +1 -1
- package/src/serve/hub-app/review/review-board.tsx +2 -2
- package/src/serve/hub-app/review/review-cells.tsx +145 -65
- package/src/serve/hub-app/review/review-kit.ts +27 -1
- package/src/serve/hub-app/review/review-list.tsx +68 -30
- package/src/serve/hub-app/review/review-page.tsx +7 -8
- package/src/serve/hub-app/review/review-st.ts +111 -24
- package/src/serve/hub-app/review/review-thread.tsx +49 -19
- package/src/serve/hub-app/review/review-views.tsx +475 -144
- 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 +73 -26
- package/src/serve/hub-app/review/trailer-card.tsx +1 -1
- 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.css +267 -61
- 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/comms-page.tsx +20 -5
- package/src/serve/hub-app/social/kit.tsx +30 -4
- package/src/serve/hub-app/social/post-card.tsx +139 -49
- package/src/serve/hub-app/social/serial-writes.ts +13 -0
- package/src/serve/hub-app/social/social-model.ts +11 -0
- package/src/serve/hub-app/social/social-page.tsx +94 -35
- package/src/serve/hub-app/social/social-st.ts +120 -36
- 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 +3 -0
- 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 +91 -23
- 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/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 +76 -0
- package/src/serve/hub-app/time.css +138 -0
- package/src/serve/hub-app/tree-build.ts +52 -42
- package/src/serve/hub-app/tree-row.tsx +4 -4
- 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-st.ts +12 -10
- package/src/serve/hub-app/waiting-svc.ts +29 -0
- package/src/serve/hub-app/wikis-view.tsx +2 -2
- package/src/serve/hub-runtime.ts +15 -2
- package/src/serve/project-gutter-route.ts +27 -14
- package/src/serve/project-gutter.ts +25 -12
- package/src/serve/same-origin.ts +10 -0
- package/src/serve/serve-hub.ts +13 -4
- package/src/shipkit-files.ts +16 -2
- package/src/shipkit.ts +1 -1
- package/src/shot/shooter.ts +616 -420
- package/src/shot/shot-ask.ts +246 -155
- package/src/site/desk.ts +2 -2
- package/src/smoke/run-smoke.ts +3 -2
- package/src/social/cover.ts +202 -0
- package/src/social/discord-layout.ts +37 -13
- package/src/social/drafts.ts +3 -0
- package/src/social/load.ts +23 -2
- package/src/social/media-kind.ts +2 -1
- package/src/social/publish/discord.ts +5 -2
- package/src/social/publish/secret.ts +2 -2
- package/src/social/release-stage.ts +28 -13
- package/src/social/routes.ts +26 -1
- package/src/social/stage.ts +1 -1
- package/src/social/stats.ts +12 -9
- package/src/social/strip.ts +4 -1
- package/src/social/thumbnail.ts +255 -0
- package/src/stores/collection.ts +15 -11
- package/src/stores/desk.ts +236 -42
- package/src/stores/model.ts +72 -6
- package/src/stores/routes.ts +37 -12
- package/src/stores/unit.ts +14 -8
- 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/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 +352 -0
- package/src/vault/vault-import.ts +208 -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
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
// a video covered by its thumbnail (wiki tools/shipkit/social.md, A video's thumbnail): the picture held as its first
|
|
2
|
+
// frames, the sound shifted by as long. Reddit and X take no uploaded picture, they let the poster pick a frame and
|
|
3
|
+
// offer frame 0 first. A cover is found again by its frames, never by a mark in the file: the clean copy strips them
|
|
4
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs'
|
|
5
|
+
import { basename, dirname, extname, join } from 'node:path'
|
|
6
|
+
import { LAYOUT } from '../core/layout.ts'
|
|
7
|
+
import { probe } from '../review/media.ts'
|
|
8
|
+
import { ffmpeg, ffmpegBytes } from '../trailer/ffmpeg.ts'
|
|
9
|
+
import { COVER_FRAMES } from '../trailer/grammar.ts'
|
|
10
|
+
import { longVideo } from './drafts.ts'
|
|
11
|
+
import { CLEAN_CLIP } from './strip.ts'
|
|
12
|
+
|
|
13
|
+
/** the venues whose post shows a frame of the video as its picture, frame 0 first (Reddit's picker starts there), and
|
|
14
|
+
* take no picture uploaded for it; YouTube, LinkedIn and Mastodon take an upload and stay out */
|
|
15
|
+
export const FRAME_PICKERS: ReadonlySet<string> = new Set(['reddit', 'x', 'bluesky', 'threads', 'discord', 'github'])
|
|
16
|
+
|
|
17
|
+
/** the leading frames read to count a cover, an older one with more frames included */
|
|
18
|
+
const LOOK = 8
|
|
19
|
+
/** a frame shows the picture when every 8x8 block of the two at 64 px wide differs by under this on average (0 to
|
|
20
|
+
* 255): a 650 kbps encode stays under 5, a thumbnail drawn again on another frame of the cut reaches 34 in its card,
|
|
21
|
+
* while its mean gap stays under 7 */
|
|
22
|
+
const SAME = 15
|
|
23
|
+
const SIDE = 64
|
|
24
|
+
const BLOCK = 8
|
|
25
|
+
|
|
26
|
+
type Frame = { w: number; h: number; rgb: Buffer }
|
|
27
|
+
|
|
28
|
+
const worstBlock = (a: Frame, b: Frame): number => {
|
|
29
|
+
let worst = 0
|
|
30
|
+
for (let by = 0; by < a.h; by += BLOCK)
|
|
31
|
+
for (let bx = 0; bx < a.w; bx += BLOCK) {
|
|
32
|
+
let sum = 0
|
|
33
|
+
let n = 0
|
|
34
|
+
for (let y = by; y < Math.min(a.h, by + BLOCK); y++)
|
|
35
|
+
for (let i = (y * a.w + bx) * 3, end = (y * a.w + Math.min(a.w, bx + BLOCK)) * 3; i < end; i++, n++) sum += Math.abs(a.rgb[i]! - b.rgb[i]!)
|
|
36
|
+
worst = Math.max(worst, sum / n)
|
|
37
|
+
}
|
|
38
|
+
return worst
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** the picture fitted into the frame as a cover draws it, letterboxed in black */
|
|
42
|
+
const fitted = (w: number, h: number): string => `scale=${w}:${h}:force_original_aspect_ratio=decrease,pad=${w}:${h}:(ow-iw)/2:(oh-ih)/2:black`
|
|
43
|
+
|
|
44
|
+
/** the frames of a ppm stream */
|
|
45
|
+
function ppmFrames(b: Buffer): Frame[] {
|
|
46
|
+
const out: Frame[] = []
|
|
47
|
+
for (let at = 0; at < b.length; ) {
|
|
48
|
+
const head = /^P6\s+(\d+)\s+(\d+)\s+255\s/.exec(b.toString('latin1', at, at + 32))
|
|
49
|
+
if (!head) throw new Error('ffmpeg wrote no ppm frame')
|
|
50
|
+
const [w, h] = [Number(head[1]), Number(head[2])]
|
|
51
|
+
const start = at + head[0].length
|
|
52
|
+
out.push({ w, h, rgb: b.subarray(start, start + w * h * 3) })
|
|
53
|
+
at = start + w * h * 3
|
|
54
|
+
}
|
|
55
|
+
return out
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** how many of the first frames of `video` show `picture`. One ffmpeg run: the picture fitted onto the video's own
|
|
59
|
+
* frame as a cover draws it, then the leading frames, all made small */
|
|
60
|
+
export function coverCount(video: string, picture: string): number {
|
|
61
|
+
const graph = [
|
|
62
|
+
`[0:v]trim=end_frame=${LOOK},setpts=PTS-STARTPTS,split=3[lead][ref][ground]`,
|
|
63
|
+
'[ground]trim=end_frame=1,drawbox=c=black:t=fill[bg]',
|
|
64
|
+
'[1:v][ref]scale=w=rw:h=rh:force_original_aspect_ratio=decrease[p]',
|
|
65
|
+
`[bg][p]overlay=(W-w)/2:(H-h)/2,scale=${SIDE}:-2:flags=area,setsar=1[want]`,
|
|
66
|
+
`[lead]scale=${SIDE}:-2:flags=area,setsar=1[got]`,
|
|
67
|
+
'[want][got]concat=n=2:v=1[out]',
|
|
68
|
+
].join(';')
|
|
69
|
+
const [want, ...lead] = ppmFrames(ffmpegBytes(['-i', video, '-i', picture, '-filter_complex', graph, '-map', '[out]', '-fps_mode', 'passthrough', '-f', 'image2pipe', '-c:v', 'ppm', '-']))
|
|
70
|
+
if (!want) throw new Error(`${basename(video)}: no frame ffmpeg reads`)
|
|
71
|
+
let n = 0
|
|
72
|
+
while (n < lead.length && lead[n]!.rgb.length === want.rgb.length && worstBlock(lead[n]!, want) < SAME) n++
|
|
73
|
+
return n
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const stamp = (f: string): string => {
|
|
77
|
+
const s = statSync(f)
|
|
78
|
+
return `${f}\0${s.size}\0${s.mtimeMs}`
|
|
79
|
+
}
|
|
80
|
+
const seen = new Map<string, number>()
|
|
81
|
+
|
|
82
|
+
/** coverCount kept on both files' size and time, in this process and in the repo's cache: a desk load reads a video
|
|
83
|
+
* once, then only when it or its picture changes */
|
|
84
|
+
export function coverCountKept(root: string, video: string, picture: string): number {
|
|
85
|
+
const k = `${stamp(video)}\0${stamp(picture)}`
|
|
86
|
+
const had = seen.get(k)
|
|
87
|
+
if (had !== undefined) return had
|
|
88
|
+
const file = join(root, LAYOUT.cache, 'social-cover.json')
|
|
89
|
+
let kept: Record<string, number> = {}
|
|
90
|
+
try {
|
|
91
|
+
kept = JSON.parse(readFileSync(file, 'utf8')) as Record<string, number>
|
|
92
|
+
} catch {
|
|
93
|
+
// no cache yet, or one cut short: counted again
|
|
94
|
+
}
|
|
95
|
+
const n = kept[k] ?? coverCount(video, picture)
|
|
96
|
+
seen.set(k, n)
|
|
97
|
+
if (kept[k] === undefined) {
|
|
98
|
+
const keys = Object.keys(kept)
|
|
99
|
+
for (const old of keys.slice(0, Math.max(0, keys.length - 500))) delete kept[old]
|
|
100
|
+
kept[k] = n
|
|
101
|
+
mkdirSync(dirname(file), { recursive: true })
|
|
102
|
+
writeFileSync(file, JSON.stringify(kept))
|
|
103
|
+
}
|
|
104
|
+
return n
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** `video` written to `out` (an mp4) with `picture` as its first COVER_FRAMES frames and its sound delayed by as long;
|
|
108
|
+
* `drop` leading frames (an older cover) left out first. Two passes at the source's own bitrates: a copy fit under a
|
|
109
|
+
* venue's weight stays under it */
|
|
110
|
+
export async function writeCover(video: string, picture: string, out: string, scratch: string, drop = 0): Promise<void> {
|
|
111
|
+
const p = probe(video)
|
|
112
|
+
const v = p.video
|
|
113
|
+
if (!v) throw new Error(`${basename(video)}: no picture stream`)
|
|
114
|
+
const [num = 0, den = 1] = v.rate.split('/').map(Number)
|
|
115
|
+
const fps = num > 0 && den > 0 ? num / den : 30
|
|
116
|
+
const lead = COVER_FRAMES / fps
|
|
117
|
+
const ab = p.audio ? p.bitrates.audio || 128_000 : 0
|
|
118
|
+
// two passes land about 2 % over the rate asked (a 98 s cut, 20.2 → 20.6 MB): aimed under it, the copy weighs no
|
|
119
|
+
// more than its source. x264 refuses a rate under the least a frame needs, and a blank source probes far under it
|
|
120
|
+
const vb = Math.max(100_000, Math.round(0.96 * (p.bitrates.video || (statSync(video).size * 8) / p.duration - ab)))
|
|
121
|
+
const graph = (sound: boolean): string =>
|
|
122
|
+
[
|
|
123
|
+
`[0:v]${fitted(v.width, v.height)},setsar=1,format=yuv420p,trim=end_frame=${COVER_FRAMES}[c]`,
|
|
124
|
+
`[1:v:0]${drop ? `trim=start_frame=${drop},setpts=PTS-STARTPTS,` : ''}setsar=1,format=yuv420p[v]`,
|
|
125
|
+
'[c][v]concat=n=2:v=1:a=0[out]',
|
|
126
|
+
...(sound ? [`[1:a:0]${drop ? `atrim=start=${(drop / fps).toFixed(6)},asetpts=PTS-STARTPTS,` : ''}adelay=${Math.round(lead * 1000)}:all=1[a]`] : []),
|
|
127
|
+
].join(';')
|
|
128
|
+
mkdirSync(scratch, { recursive: true })
|
|
129
|
+
const dir = mkdtempSync(join(scratch, 'cover-'))
|
|
130
|
+
const inputs = ['-loop', '1', '-framerate', v.rate, '-t', (lead + 1 / fps).toFixed(4), '-i', picture, '-i', video]
|
|
131
|
+
const x264 = ['-c:v', 'libx264', '-b:v', String(vb), '-pix_fmt', 'yuv420p', '-passlogfile', join(dir, 'x264')]
|
|
132
|
+
const sound = p.audio ? ['-map', '[a]', '-c:a', 'aac', '-b:a', String(ab)] : []
|
|
133
|
+
try {
|
|
134
|
+
await ffmpeg([...inputs, '-filter_complex', graph(false), '-map', '[out]', ...x264, '-pass', '1', '-an', '-f', 'null', '-'])
|
|
135
|
+
await ffmpeg([...inputs, '-filter_complex', graph(p.audio), '-map', '[out]', ...sound, ...x264, '-pass', '2', '-movflags', '+faststart', ...CLEAN_CLIP, out])
|
|
136
|
+
} finally {
|
|
137
|
+
rmSync(dir, { recursive: true, force: true })
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** what a cover did to a video: `kept` it already opened on the picture, `covered` it had no cover, `replaced` an
|
|
142
|
+
* older picture's cover gave way to this one */
|
|
143
|
+
export type Covered = { did: 'kept' | 'covered' | 'replaced'; seconds: number }
|
|
144
|
+
|
|
145
|
+
const IN_PLACE = new Set(['.mp4', '.m4v', '.mov'])
|
|
146
|
+
|
|
147
|
+
/** `video` covered by `picture` in its own place; `was` the picture an older cover may show, its frames replaced */
|
|
148
|
+
export async function coverInPlace(video: string, picture: string, scratch: string, was: string | null = null): Promise<Covered> {
|
|
149
|
+
if (!IN_PLACE.has(extname(video).toLowerCase())) throw new Error(`${basename(video)}: a cover is written as mp4, never under a ${extname(video)} name`)
|
|
150
|
+
const t0 = performance.now()
|
|
151
|
+
if (coverCount(video, picture) > 0) return { did: 'kept', seconds: 0 }
|
|
152
|
+
const drop = was ? coverCount(video, was) : 0
|
|
153
|
+
const next = join(dirname(video), `.${basename(video)}.covering.mp4`)
|
|
154
|
+
try {
|
|
155
|
+
await writeCover(video, picture, next, scratch, drop)
|
|
156
|
+
renameSync(next, video)
|
|
157
|
+
} finally {
|
|
158
|
+
rmSync(next, { force: true })
|
|
159
|
+
}
|
|
160
|
+
return { did: drop > 0 ? 'replaced' : 'covered', seconds: (performance.now() - t0) / 1000 }
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** where a video covered outside a draft goes: beside it, `<name>-covered.mp4` */
|
|
164
|
+
export const coveredOfVideo = (video: string): string => join(dirname(video), `${basename(video).replace(/\.[^.]+$/, '')}-covered.mp4`)
|
|
165
|
+
|
|
166
|
+
const stem = (name: string): string => basename(name).replace(/\.[^.]+$/, '')
|
|
167
|
+
const PICTURE = /-thumbnail\.(jpe?g|png)$/i
|
|
168
|
+
|
|
169
|
+
/** the picture a draft's clip opens on: `<clip>-thumbnail.jpg|png` among its media, else its one `*-thumbnail`
|
|
170
|
+
* picture; null when it has none, or several and none by the clip's name */
|
|
171
|
+
export function pictureOfClip(names: readonly string[], clip: string): string | null {
|
|
172
|
+
const pics = names.filter((n) => PICTURE.test(n))
|
|
173
|
+
return pics.find((n) => stem(n) === `${stem(clip)}-thumbnail`) ?? (pics.length === 1 ? pics[0]! : null)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
type Placed = { name: string; path: string }
|
|
177
|
+
|
|
178
|
+
/** why a message may not go out: it is not posted yet, goes to a venue that picks a frame (FRAME_PICKERS) and shows a
|
|
179
|
+
* long video (no still, no vertical short) that opens on its own frame, not its thumbnail, or a trailer's video with
|
|
180
|
+
* no thumbnail at all; null when it may. `platform` the account's id, `venue` its name */
|
|
181
|
+
export function frameProblem(
|
|
182
|
+
root: string,
|
|
183
|
+
o: { slug: string; platform: string; venue: string; posted: boolean; clip: Placed | null; media: readonly Placed[]; trailer: boolean },
|
|
184
|
+
): string | null {
|
|
185
|
+
if (o.posted || o.clip == null || !FRAME_PICKERS.has(o.platform) || !longVideo(o.clip.name)) return null
|
|
186
|
+
const fix = `sk social thumbnail --draft ${o.slug}`
|
|
187
|
+
const pic = pictureOfClip(
|
|
188
|
+
o.media.map((m) => m.name),
|
|
189
|
+
o.clip.name,
|
|
190
|
+
)
|
|
191
|
+
const clip = o.clip
|
|
192
|
+
const at = o.media.find((m) => m.name === pic)
|
|
193
|
+
if (pic == null || at == null)
|
|
194
|
+
return o.trailer ? `"${clip.name}" has no thumbnail, and ${o.venue} takes a frame of it as its picture: ${fix} --at <s> --crop x,y,w,h` : null
|
|
195
|
+
if (!existsSync(clip.path) || !existsSync(at.path)) return null
|
|
196
|
+
try {
|
|
197
|
+
if (coverCountKept(root, clip.path, at.path) > 0) return null
|
|
198
|
+
} catch (e) {
|
|
199
|
+
return `"${clip.name}": its first frame could not be read (${(e as Error).message.split('\n')[0]}), and ${o.venue} takes it as the picture`
|
|
200
|
+
}
|
|
201
|
+
return `"${clip.name}" opens on its own frame, not ${basename(pic)}, and ${o.venue} takes frame 0 as its picture: ${fix} covers it`
|
|
202
|
+
}
|
|
@@ -9,7 +9,7 @@ import { DISCORD_ROWS, recordPushed, toPush, type PushReport } from '../identiti
|
|
|
9
9
|
import { parseFrontmatter } from './md.ts'
|
|
10
10
|
import { call, channelKey } from './publish/discord.ts'
|
|
11
11
|
|
|
12
|
-
export type ChannelDef = { name: string; emoji: string; topic: string; readOnly: boolean; voice: boolean; ageRestricted: boolean; only: string[] }
|
|
12
|
+
export type ChannelDef = { name: string; emoji: string; topic: string; readOnly: boolean; voice: boolean; announcement: boolean; ageRestricted: boolean; only: string[] }
|
|
13
13
|
export type CategoryDef = { name: string; was: string[]; channels: ChannelDef[] }
|
|
14
14
|
export type RoleDef = { name: string; color: number; hoist: boolean; mentionable: boolean; owner: boolean }
|
|
15
15
|
/** a member by its Discord username, and the roles the apply gives it */
|
|
@@ -17,7 +17,7 @@ export type MemberDef = { name: string; roles: string[] }
|
|
|
17
17
|
export type DiscordLayout = { file: string; name: string; roles: RoleDef[]; members: MemberDef[]; categories: CategoryDef[] }
|
|
18
18
|
|
|
19
19
|
const ROLE_FLAGS = new Set(['hoist', 'mentionable', 'owner'])
|
|
20
|
-
const CHANNEL_FLAGS = new Set(['read only', 'voice', 'age restricted'])
|
|
20
|
+
const CHANNEL_FLAGS = new Set(['read only', 'voice', 'announcement', 'age restricted'])
|
|
21
21
|
|
|
22
22
|
const cells = (chunk: string): string[][] =>
|
|
23
23
|
chunk
|
|
@@ -60,7 +60,8 @@ export function parseLayout(raw: string, file: string): DiscordLayout {
|
|
|
60
60
|
const f = list(flags)
|
|
61
61
|
for (const x of f) if (!CHANNEL_FLAGS.has(x)) errors.push(`#${name}: unknown flag "${x}" (${[...CHANNEL_FLAGS].join(', ')})`)
|
|
62
62
|
if (!/^[\p{L}\p{N}][\p{L}\p{N}_-]*$/u.test(name)) errors.push(`#${name}: a channel name is letters, digits, - and _`)
|
|
63
|
-
|
|
63
|
+
if (f.includes('voice') && f.includes('announcement')) errors.push(`#${name}: voice and announcement are two kinds of channel, name one`)
|
|
64
|
+
channels.push({ name, emoji, topic, readOnly: f.includes('read only'), voice: f.includes('voice'), announcement: f.includes('announcement'), ageRestricted: f.includes('age restricted'), only: list(only) })
|
|
64
65
|
}
|
|
65
66
|
categories.push({ name: m[1]!, was: list(m[2]), channels })
|
|
66
67
|
}
|
|
@@ -85,6 +86,12 @@ export const layoutChannels = (l: DiscordLayout): string[] => l.categories.flatM
|
|
|
85
86
|
|
|
86
87
|
const TEXT = 0
|
|
87
88
|
const VOICE = 2
|
|
89
|
+
/** an announcement channel: members and other servers follow it; a server of the community kind alone holds one */
|
|
90
|
+
const NEWS = 5
|
|
91
|
+
/** the type a row asks for, and whether a channel of the server is of the row's kind: a text row finds a text or an
|
|
92
|
+
* announcement channel, so a flag added later changes the channel in place and its messages stay */
|
|
93
|
+
const typeOf = (def: ChannelDef): number => (def.voice ? VOICE : def.announcement ? NEWS : TEXT)
|
|
94
|
+
const kindOf = (def: ChannelDef, type: number): boolean => (def.voice ? type === VOICE : type === TEXT || type === NEWS)
|
|
88
95
|
const CATEGORY = 4
|
|
89
96
|
/** send messages, create public and private threads, send in threads */
|
|
90
97
|
const WRITE = String((1n << 11n) | (1n << 35n) | (1n << 36n) | (1n << 38n))
|
|
@@ -115,8 +122,9 @@ const overwriteKey = (o: readonly Overwrite[]): string =>
|
|
|
115
122
|
o.map((x) => `${x.id}:${x.type}:${x.allow}:${x.deny}`).sort().join(',')
|
|
116
123
|
|
|
117
124
|
/** what differs between a channel and what it wants, by name; empty, it matches */
|
|
118
|
-
export function channelChanges(ch: Channel, want: { name: string; parent_id: string; topic?: string; nsfw: boolean; permission_overwrites: Overwrite[] }): string[] {
|
|
125
|
+
export function channelChanges(ch: Channel, want: { name: string; parent_id: string; type?: number; topic?: string; nsfw: boolean; permission_overwrites: Overwrite[] }): string[] {
|
|
119
126
|
const out: string[] = []
|
|
127
|
+
if (want.type != null && ch.type !== want.type) out.push(want.type === NEWS ? 'an announcement channel' : 'a plain text channel')
|
|
120
128
|
if (ch.name !== want.name) out.push(`name ${want.name}`)
|
|
121
129
|
if (ch.parent_id !== want.parent_id) out.push('category')
|
|
122
130
|
if (want.topic != null && (ch.topic ?? '') !== want.topic) out.push('topic')
|
|
@@ -125,7 +133,17 @@ export function channelChanges(ch: Channel, want: { name: string; parent_id: str
|
|
|
125
133
|
return out
|
|
126
134
|
}
|
|
127
135
|
|
|
128
|
-
|
|
136
|
+
/** `hidden`: the categories of the layout a member does not see until they tick « Show All Channels » */
|
|
137
|
+
export type ApplyReport = PushReport & { hidden: string[] }
|
|
138
|
+
|
|
139
|
+
/** the layout's categories that hold channels and are not among the server's default channels: a community server shows a
|
|
140
|
+
* member its default channels and the ones they follow, so a category made by the bot stays out of sight, and a
|
|
141
|
+
* channel moved into it leaves the list of whoever saw it through its old category. `id` null: not created yet */
|
|
142
|
+
export function hiddenCategories(cats: readonly { name: string; id: string | null; channels: number }[], defaults: readonly string[]): string[] {
|
|
143
|
+
return cats
|
|
144
|
+
.filter((c) => c.channels > 0 && (c.id === null || !defaults.includes(c.id)))
|
|
145
|
+
.map((c) => `${c.name}: not among the server's default channels, so members who do not tick « Show All Channels » do not see it (Server Settings → Onboarding → Default Channels)`)
|
|
146
|
+
}
|
|
129
147
|
|
|
130
148
|
/** what the bot's calls go through: the real api, or a test's */
|
|
131
149
|
export type Send = <T>(a: Account, method: string, path: string, body?: BodyInit) => Promise<T>
|
|
@@ -223,6 +241,7 @@ export async function applyLayout(a: Account, o: { dry: boolean; prune: boolean
|
|
|
223
241
|
|
|
224
242
|
const channels = await call<Channel[]>(a, 'GET', `/guilds/${G}/channels`)
|
|
225
243
|
const kept = new Set<string>()
|
|
244
|
+
const catIds: { name: string; id: string | null; channels: number }[] = []
|
|
226
245
|
const moves: { id: string; position: number; label: string }[] = []
|
|
227
246
|
// Discord numbers positions across the whole server, one count per type (categories, text, voice), in the order shown
|
|
228
247
|
const next = new Map<number, number>()
|
|
@@ -248,21 +267,21 @@ export async function applyLayout(a: Account, o: { dry: boolean; prune: boolean
|
|
|
248
267
|
await act(`rename the category ${c.name} → ${cat.name}`, () => call(a, 'PATCH', `/channels/${id}`, json({ name: cat.name })))
|
|
249
268
|
}
|
|
250
269
|
place(c, CATEGORY, `the category ${cat.name}`)
|
|
270
|
+
catIds.push({ name: cat.name, id: (c as Channel | undefined)?.id ?? null, channels: cat.channels.length })
|
|
251
271
|
// a dry run before its category exists: a channel the server already holds moves into it, never a new one
|
|
252
272
|
if (c == null) {
|
|
253
273
|
for (const def of cat.channels) {
|
|
254
|
-
const
|
|
255
|
-
const ch = channels.find((x) => x.type === type && same(channelKey(x.name), def.name))
|
|
274
|
+
const ch = channels.find((x) => kindOf(def, x.type) && same(channelKey(x.name), def.name))
|
|
256
275
|
if (ch) kept.add(ch.id)
|
|
257
|
-
slot(
|
|
276
|
+
slot(def.voice ? VOICE : TEXT)
|
|
258
277
|
changes.push(ch ? `would set #${def.name} (${cat.name}): category` : `would create #${def.name} in ${cat.name}`)
|
|
259
278
|
}
|
|
260
279
|
continue
|
|
261
280
|
}
|
|
262
281
|
for (const def of cat.channels) {
|
|
263
|
-
const type = def
|
|
264
|
-
const want = { name: shown(def), parent_id: c.id, ...(def.voice ? {} : { topic: def.topic }), nsfw: def.ageRestricted, permission_overwrites: overwritesOf(def, G, roleIds) }
|
|
265
|
-
let ch = channels.find((x) => x.type
|
|
282
|
+
const type = typeOf(def)
|
|
283
|
+
const want = { name: shown(def), parent_id: c.id, ...(def.voice ? {} : { topic: def.topic, type }), nsfw: def.ageRestricted, permission_overwrites: overwritesOf(def, G, roleIds) }
|
|
284
|
+
let ch = channels.find((x) => kindOf(def, x.type) && same(channelKey(x.name), def.name))
|
|
266
285
|
if (ch == null) {
|
|
267
286
|
await act(`create #${def.name} in ${cat.name}`, async () => {
|
|
268
287
|
ch = await call<Channel>(a, 'POST', `/guilds/${G}/channels`, json({ ...want, type }))
|
|
@@ -272,7 +291,7 @@ export async function applyLayout(a: Account, o: { dry: boolean; prune: boolean
|
|
|
272
291
|
const id = ch.id
|
|
273
292
|
if (diff.length > 0) await act(`set #${def.name} (${cat.name}): ${diff.join(', ')}`, () => call(a, 'PATCH', `/channels/${id}`, json(want)))
|
|
274
293
|
}
|
|
275
|
-
place(ch,
|
|
294
|
+
place(ch, def.voice ? VOICE : TEXT, `#${def.name}`)
|
|
276
295
|
}
|
|
277
296
|
}
|
|
278
297
|
if (moves.length > 0) await act(`move ${moves.map((m) => m.label).join(', ')}`, () => call(a, 'PATCH', `/guilds/${G}/channels`, json(moves.map(({ id, position }) => ({ id, position })))))
|
|
@@ -282,5 +301,10 @@ export async function applyLayout(a: Account, o: { dry: boolean; prune: boolean
|
|
|
282
301
|
if (o.prune && empty && x.type === TEXT) await act(`delete #${x.name} (empty)`, () => call(a, 'DELETE', `/channels/${x.id}`))
|
|
283
302
|
else left.push(`${x.type === CATEGORY ? 'category ' : '#'}${x.name}${x.type === TEXT ? (empty ? ' (empty, --prune deletes it)' : ' (holds messages)') : ''}`)
|
|
284
303
|
}
|
|
285
|
-
|
|
304
|
+
// a server of the community kind alone has default channels; another answers an error, and then every channel shows
|
|
305
|
+
const defaults = await call<{ default_channel_ids: string[] }>(a, 'GET', `/guilds/${G}/onboarding`).then(
|
|
306
|
+
(o) => o.default_channel_ids,
|
|
307
|
+
() => null,
|
|
308
|
+
)
|
|
309
|
+
return { changes, left, recorded: pictures.recorded, hidden: defaults === null ? [] : hiddenCategories(catIds, defaults) }
|
|
286
310
|
}
|
package/src/social/drafts.ts
CHANGED
|
@@ -117,6 +117,9 @@ export function groupKeys(s: DraftSection, groups: ReadonlyMap<string, readonly
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
/** every media name a draft gives, its own then its platforms', each once */
|
|
120
|
+
/** the video a post shows with a chosen thumbnail: a clip that is not a vertical short */
|
|
121
|
+
export const longVideo = (name: string): boolean => /\.(mp4|webm|mov)$/i.test(name) && !/-vertical\.[^.]+$/i.test(name)
|
|
122
|
+
|
|
120
123
|
export function mediaNames(d: ParsedDraft): string[] {
|
|
121
124
|
const out = fileList(d.meta.media)
|
|
122
125
|
for (const s of d.sections) for (const m of fileList(s.options.media)) if (!out.includes(m)) out.push(m)
|
package/src/social/load.ts
CHANGED
|
@@ -6,8 +6,10 @@ import { join, relative, resolve, sep } 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, parseDraft, renderedTrailer, resolveMedia, tagList, topicList, 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
15
|
import { purgedAt } from './media-facts.ts'
|
|
@@ -16,6 +18,7 @@ import { deskKinds, type DeskKind } from './kind-pages.ts'
|
|
|
16
18
|
import { kindOfMeta, kindProblem } from './kinds.ts'
|
|
17
19
|
import { heavyMedia, limitProblem, mbOf, MEDIA_MAX_BYTES } from './media-limit.ts'
|
|
18
20
|
import { pushFailure } from './push.ts'
|
|
21
|
+
import { releaseVersionOf } from '../releases/store.ts'
|
|
19
22
|
import { ceilingAt, hasLayout, landing, placesOf, type Landing } from './reach.ts'
|
|
20
23
|
import { guardWith, type SocialUnit } from './unit.ts'
|
|
21
24
|
|
|
@@ -143,6 +146,8 @@ export type Draft = {
|
|
|
143
146
|
review: string | null
|
|
144
147
|
/** the release it was staged from, `<unit>@<version>`; null when none */
|
|
145
148
|
release: string | null
|
|
149
|
+
/** the version of that release whose file the repo keeps, the page the draft links to; null when none */
|
|
150
|
+
releaseVersion: string | null
|
|
146
151
|
/** what it shows: safe, mild or explicit */
|
|
147
152
|
rating: PostRating
|
|
148
153
|
/** the repo's guard's problems with it, one line each: while one stands, nothing of it goes out */
|
|
@@ -306,6 +311,7 @@ export function loadDesk(root: string, ids: Identities, o: { speaksAs?: string |
|
|
|
306
311
|
article: article(ddir, root, unit),
|
|
307
312
|
review: reviewOf(d.meta.review, file, errors),
|
|
308
313
|
release: releaseOf(d.meta.release, file, errors),
|
|
314
|
+
releaseVersion: releaseVersionOf(root, d.meta.release),
|
|
309
315
|
rating: ratingOf(d.meta.rating, speaker.adult, speaker.name, file, errors),
|
|
310
316
|
guard: [],
|
|
311
317
|
skipped: [],
|
|
@@ -413,14 +419,29 @@ export function loadDesk(root: string, ids: Identities, o: { speaksAs?: string |
|
|
|
413
419
|
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
420
|
for (const g of draft.guard) errors.push(`${file}: ${g}`)
|
|
415
421
|
for (const p of draft.posts) if (draft.guard.length > 0) p.refused = `the repo's guard: ${draft.guard[0]}`
|
|
422
|
+
// a venue that picks a frame of the video as its picture offers frame 0 first: the video opens on its thumbnail
|
|
423
|
+
for (const p of draft.posts) {
|
|
424
|
+
const venue = accounts.find((a) => a.id === p.platform)?.name ?? p.platform
|
|
425
|
+
const why = frameProblem(root, { slug, platform: p.platform, venue, posted: p.posted !== '', clip: p.media, media: [...media.values()], trailer: draft.kind === 'trailer' })
|
|
426
|
+
if (why == null) continue
|
|
427
|
+
errors.push(`${file}: ## ${p.key}: ${why}`)
|
|
428
|
+
if (p.refused === '') p.refused = why
|
|
429
|
+
}
|
|
416
430
|
draft.posts.sort((x, y) => accounts.findIndex((a) => a.id === x.platform) - accounts.findIndex((a) => a.id === y.platform))
|
|
431
|
+
// a trailer's long video shows a chosen thumbnail (wiki tools/shipkit/social.md, A video's thumbnail); a posted draft is history
|
|
432
|
+
const done = draft.posts.length > 0 && draft.posts.every((p) => p.posted !== '')
|
|
433
|
+
if (draft.kind === 'trailer' && !done && draft.media.some((m) => longVideo(m.name)) && !draft.media.some((m) => /-thumbnail\.(jpe?g|png)$/i.test(m.name)))
|
|
434
|
+
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
435
|
drafts.push(draft)
|
|
418
436
|
}
|
|
419
|
-
|
|
437
|
+
for (const i of identities) for (const acc of i.accounts) for (const p of setupProblems(acc)) errors.push(`${acc.file}: ${p}`)
|
|
438
|
+
// 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
439
|
for (const i of identities)
|
|
421
440
|
for (const a of i.accounts)
|
|
422
441
|
for (const st of a.steps)
|
|
423
442
|
for (const [, ref] of st.text.matchAll(/\[\[([^\]]+)\]\]/g)) {
|
|
443
|
+
// a [[secret:<name>]] draws its own field: no row stands behind it
|
|
444
|
+
if (secretOfRef(ref!) != null) continue
|
|
424
445
|
const slug = /^draft:(.+)$/.exec(ref!)?.[1]
|
|
425
446
|
if (slug == null) {
|
|
426
447
|
if (!a.rows.some((r) => r.field === ref)) errors.push(`${a.file}: [[${ref}]] names no profile row`)
|
package/src/social/media-kind.ts
CHANGED
|
@@ -72,12 +72,13 @@ function ignoredOf(store: string): Set<string> | null {
|
|
|
72
72
|
/** the index's own rows of the store: the keys of files the record lost (a record deleted, a machine restored) */
|
|
73
73
|
function indexed(store: string): Map<string, { key: string; size: number }> {
|
|
74
74
|
const p = `${SOCIAL_KIND}/`
|
|
75
|
-
const rows = (mediaDb()?.query('select item, name, key, size from
|
|
75
|
+
const rows = (mediaDb()?.query('select item, name, key, size from media_files where store = ? and substr(key, 1, ?) = ?').all(store, p.length, p) ?? []) as { item: string; name: string; key: string; size: number }[]
|
|
76
76
|
return new Map(rows.map((r) => [`${r.item}/${r.name}`, { key: r.key, size: r.size }]))
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
export const socialMedia: MediaKind = {
|
|
80
80
|
kind: SOCIAL_KIND,
|
|
81
|
+
what: 'the posts\' pictures and clips',
|
|
81
82
|
storeOf: (root) => draftsOf(root),
|
|
82
83
|
stamp(store) {
|
|
83
84
|
const parts: string[] = []
|
|
@@ -8,6 +8,9 @@ import { secret } from './secret.ts'
|
|
|
8
8
|
|
|
9
9
|
const API = 'https://discord.com/api/v10'
|
|
10
10
|
const TEXT = 0
|
|
11
|
+
/** an announcement channel takes messages like a text one: a release post goes there */
|
|
12
|
+
const NEWS = 5
|
|
13
|
+
const postable = (type: number): boolean => type === TEXT || type === NEWS
|
|
11
14
|
|
|
12
15
|
type Channel = { id: string; type: number; name: string }
|
|
13
16
|
|
|
@@ -51,7 +54,7 @@ export const channelKey = (name: string): string => name.replace(/^[^\p{L}\p{N}]
|
|
|
51
54
|
* empty by it goes too */
|
|
52
55
|
export function discordContent(text: string, channels: readonly Channel[]): string {
|
|
53
56
|
const linked = text.replace(/(^|\s)#([\p{L}\p{N}_-]+)/gu, (m, lead: string, name: string) => {
|
|
54
|
-
const c = channels.find((x) => x.type
|
|
57
|
+
const c = channels.find((x) => postable(x.type) && channelKey(x.name) === name)
|
|
55
58
|
return c == null ? m : `${lead}<#${c.id}>`
|
|
56
59
|
})
|
|
57
60
|
return withoutTags(linked)
|
|
@@ -76,7 +79,7 @@ export async function postDiscord(a: Account, post: SocialPost): Promise<string>
|
|
|
76
79
|
await call(a, 'PATCH', `/channels/${ids[1]}/messages/${ids[2]}`, JSON.stringify(payload))
|
|
77
80
|
return post.posted
|
|
78
81
|
}
|
|
79
|
-
const target = channels.find((x) => x.type
|
|
82
|
+
const target = channels.find((x) => postable(x.type) && same(channelKey(x.name), post.place))
|
|
80
83
|
if (target == null) throw new Error(`${post.slug}: place "${post.place}" is no text channel of the server`)
|
|
81
84
|
const msg = await postMessage(a, target.id, payload, post.media?.path ?? null, post.alt)
|
|
82
85
|
if (post.pin) await call(a, 'PUT', `/channels/${target.id}/pins/${msg.id}`)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// an account's token, read through the house config's `credsReadCommand`: a missing one fails loud with where it is named.
|
|
2
2
|
// It reads as the repo that posts: the hub runs in the house's folder, so `secretsAs` names the draft's repo
|
|
3
3
|
import { AsyncLocalStorage } from 'node:async_hooks'
|
|
4
|
-
import {
|
|
4
|
+
import { readThrough } from '../../secrets/read.ts'
|
|
5
5
|
|
|
6
6
|
const postingRepo = new AsyncLocalStorage<string>()
|
|
7
7
|
|
|
@@ -17,5 +17,5 @@ export async function secret(name: string, where: string): Promise<string> {
|
|
|
17
17
|
if (!house) throw new Error(`no house repo seen from ${cwd} to read the token ${name} (${where})`)
|
|
18
18
|
const c = await loadRepoConfig(house)
|
|
19
19
|
if (!c.credsReadCommand) throw new Error(`the house config (${house}) declares no credsReadCommand to read ${name} (${where})`)
|
|
20
|
-
return
|
|
20
|
+
return readThrough(c.credsReadCommand, name, 'get', cwd)
|
|
21
21
|
}
|
|
@@ -13,11 +13,11 @@ import { isPostRating, POST_RATINGS, takes, type PostRating } from '../identitie
|
|
|
13
13
|
import { localPicture } from '../releases/pictures.ts'
|
|
14
14
|
import { ceilingAt, landing, placesOf } from './reach.ts'
|
|
15
15
|
import { isApproved, verdictOf, type ReviewItem } from '../review/model.ts'
|
|
16
|
-
import { stageablesOf, stageFileOf, type Stageable } from '../review/stage-card.ts'
|
|
17
|
-
import { readAll, storeDir } from '../review/store.ts'
|
|
16
|
+
import { mediaTagOf, stageablesOf, stageFileOf, type Stageable } from '../review/stage-card.ts'
|
|
17
|
+
import { hasStore, readAll, storeDir } from '../review/store.ts'
|
|
18
18
|
import { threadsOf, type Thread } from '../review/threads.ts'
|
|
19
19
|
import { changesOf, NEXT, picturesOf, ratingOf, shotFor, type Picture, type Release } from '../releases/model.ts'
|
|
20
|
-
import { hasReleases, readRelease } from '../releases/store.ts'
|
|
20
|
+
import { hasReleases, readRelease, releaseVersionOf } from '../releases/store.ts'
|
|
21
21
|
import { gitBin } from '../core/git-bin.ts'
|
|
22
22
|
import { setHeadingText } from './drafts.ts'
|
|
23
23
|
import { DRAFT_NAME, draftsDir, type Draft } from './load.ts'
|
|
@@ -46,16 +46,32 @@ export type ReleaseAsk = {
|
|
|
46
46
|
|
|
47
47
|
const head = (raw: string): Record<string, string> => parseFrontmatter(raw).meta
|
|
48
48
|
|
|
49
|
-
/**
|
|
50
|
-
|
|
49
|
+
/** every staged draft that names a release, oldest first: its slug and its `release:` */
|
|
50
|
+
function draftsByRelease(root: string): { slug: string; ref: string }[] {
|
|
51
51
|
const dir = draftsDir(root)
|
|
52
|
-
if (!existsSync(dir)) return
|
|
52
|
+
if (!existsSync(dir)) return []
|
|
53
|
+
const out: { slug: string; ref: string }[] = []
|
|
53
54
|
for (const slug of readdirSync(dir).sort()) {
|
|
54
55
|
if (!DRAFT_NAME.test(slug)) continue
|
|
55
56
|
const f = join(dir, slug, 'draft.md')
|
|
56
|
-
|
|
57
|
+
const ref = existsSync(f) ? head(readFileSync(f, 'utf8')).release : undefined
|
|
58
|
+
if (ref) out.push({ slug, ref })
|
|
57
59
|
}
|
|
58
|
-
return
|
|
60
|
+
return out
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** the draft a release already staged, by its `release:` */
|
|
64
|
+
export const releaseDraft = (root: string, ref: string): string | null => draftsByRelease(root).find((d) => d.ref === ref)?.slug ?? null
|
|
65
|
+
|
|
66
|
+
/** the post each released version of the root unit staged, its draft's slug by version: the releases page links each
|
|
67
|
+
* version to it, as the draft links back (`releaseVersionOf`) */
|
|
68
|
+
export function releaseDrafts(root: string): Record<string, string> {
|
|
69
|
+
const out: Record<string, string> = {}
|
|
70
|
+
for (const d of draftsByRelease(root)) {
|
|
71
|
+
const v = releaseVersionOf(root, d.ref)
|
|
72
|
+
if (v != null) out[v] ??= d.slug
|
|
73
|
+
}
|
|
74
|
+
return out
|
|
59
75
|
}
|
|
60
76
|
|
|
61
77
|
/** markdown notes as post lines: its bullets, its plain lines; its headings and comments left out */
|
|
@@ -222,9 +238,8 @@ function releasedCards(root: string, ref: string | undefined): Set<string> | nul
|
|
|
222
238
|
|
|
223
239
|
/** the release file of `<unit>@<version>`: the root unit's, named `root` or as the repo's folder; null without one */
|
|
224
240
|
export function releaseFileOf(root: string, ref: string | undefined): Release | null {
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
return readRelease(root, m[2]!)
|
|
241
|
+
const v = releaseVersionOf(root, ref)
|
|
242
|
+
return v == null ? null : readRelease(root, v)
|
|
228
243
|
}
|
|
229
244
|
|
|
230
245
|
/** the approved cards a release ships, newest first: a card its release file names, else one whose commit is in its
|
|
@@ -239,7 +254,7 @@ export function releaseCards(root: string, slug: string): { range: string; cards
|
|
|
239
254
|
if (range === '' && listed == null) return { range, cards: [] }
|
|
240
255
|
const shas = listed == null ? [...commitsOf(root, range)] : []
|
|
241
256
|
const inRange = (c: string | undefined): boolean => c != null && c.length >= 7 && shas.some((s) => s.startsWith(c))
|
|
242
|
-
const items: ReviewItem[] =
|
|
257
|
+
const items: ReviewItem[] = hasStore(storeDir(root)) ? readAll(storeDir(root)).items : []
|
|
243
258
|
const ships = (t: Thread): boolean => (listed == null ? inRange(t.head.item.commit) : t.versions.some((v) => listed.has(v.item.id)))
|
|
244
259
|
const cards = threadsOf(items)
|
|
245
260
|
.filter(ships)
|
|
@@ -265,7 +280,7 @@ export async function releaseMedia(
|
|
|
265
280
|
const m = card?.media.find((x) => x.key === ask.pick)
|
|
266
281
|
if (card == null || m == null) throw new Error(`${ask.pick} is no media of a card this release ships`)
|
|
267
282
|
const file = await stageFileOf(storeDir(root), m, o.font)
|
|
268
|
-
const name = mediaFile({ file, name: `release-${m.label
|
|
283
|
+
const name = mediaFile({ file, name: `release-${mediaTagOf(m.label)}-${card.id.slice(16, 40)}`, vertical: m.kind === 'clip' && m.ratio < 0.6 })
|
|
269
284
|
let raw = readFileSync(f, 'utf8')
|
|
270
285
|
raw = setMeta(setMeta(raw, 'media', name), 'rating', ask.rating)
|
|
271
286
|
if (ask.alt !== undefined) raw = setMeta(raw, 'alt', ask.alt.replace(/\s*\n\s*/g, ' ').trim())
|
package/src/social/routes.ts
CHANGED
|
@@ -11,7 +11,11 @@ import { answerOf, voiceOf } from '../review/stage-routes.ts'
|
|
|
11
11
|
import { isPostRating } from '../identities/rating.ts'
|
|
12
12
|
import { noteLines, releaseCards, releaseMedia } from './release-stage.ts'
|
|
13
13
|
import { readAllCached, storeDir } from '../review/store.ts'
|
|
14
|
-
import { DRAFT_NAME, draftsDir, type Desk } from './load.ts'
|
|
14
|
+
import { accountOf, DRAFT_NAME, draftsDir, type Desk } from './load.ts'
|
|
15
|
+
import { stepSecrets } from '../identities/steps.ts'
|
|
16
|
+
import { managerStore } from '../secrets/manager.ts'
|
|
17
|
+
import { storeValue } from '../collections/actions.ts'
|
|
18
|
+
import { heldHere } from '../secrets/read.ts'
|
|
15
19
|
import { deskAnswer, nextReleaseAnswer } from './desk-index.ts'
|
|
16
20
|
import { socialMediaBack, socialMediaUrl } from './media-kind.ts'
|
|
17
21
|
import { openDesk } from './open.ts'
|
|
@@ -66,6 +70,13 @@ export async function socialRoutes(root: string, req: Request, path: string): Pr
|
|
|
66
70
|
if (req.method === 'GET') {
|
|
67
71
|
if (sub === 'desk.json') return deskAnswer(req, root)
|
|
68
72
|
if (sub === 'next-release.json') return nextReleaseAnswer(req, root)
|
|
73
|
+
if (sub === 'secrets.json') {
|
|
74
|
+
// whether the store holds each secret a setup step takes: never a value
|
|
75
|
+
const { desk } = await openDesk(root)
|
|
76
|
+
const names = [...new Set(desk.identities.flatMap((i) => i.accounts.flatMap((a) => stepSecrets(a.steps))))]
|
|
77
|
+
const held = names.length === 0 ? {} : await heldHere({ names, cwd: root })
|
|
78
|
+
return Response.json(Object.fromEntries(names.map((n) => [n, held[n]?.held ?? 'unknown'])), { headers: NO_STORE })
|
|
79
|
+
}
|
|
69
80
|
if (sub === 'stats.json') {
|
|
70
81
|
const { desk } = await openDesk(root)
|
|
71
82
|
const out: Record<string, Record<string, string>> = {}
|
|
@@ -168,6 +179,20 @@ export async function socialRoutes(root: string, req: Request, path: string): Pr
|
|
|
168
179
|
if (sub === 'live') return Response.json({ files: setLive(desk, str(b.identity, 'identity', ID), str(b.account, 'account', ID), urlOrNull(b.url)) })
|
|
169
180
|
if (sub === 'shown')
|
|
170
181
|
return Response.json({ files: setShown(desk, str(b.identity, 'identity', ID), str(b.account, 'account', ID), str(b.row, 'row'), typeof b.file === 'string' ? b.file : undefined, typeof b.sha === 'string' ? b.sha : undefined) })
|
|
182
|
+
if (sub === 'secret') {
|
|
183
|
+
// a secret a setup step takes, stored as `sk secret set` stores it; only a name that account's own steps name
|
|
184
|
+
const identity = str(b.identity, 'identity', ID)
|
|
185
|
+
const account = str(b.account, 'account', ID)
|
|
186
|
+
const name = str(b.name, 'secret')
|
|
187
|
+
const a = accountOf(desk, identity, account)
|
|
188
|
+
if (!stepSecrets(a.steps).includes(name)) throw new Error(`no setup step of ${identity}/${account} takes ${name}`)
|
|
189
|
+
// the one store an ask's field goes through too (collections/actions.ts)
|
|
190
|
+
await storeValue({ root, name, value: typeof b.value === 'string' ? b.value : '', store: managerStore(root) })
|
|
191
|
+
// the step that took it is done
|
|
192
|
+
const index = a.steps.findIndex((s) => s.text.includes(`[[secret:${name}]]`))
|
|
193
|
+
const files = index >= 0 && !a.steps[index]!.done ? setStep(desk, identity, account, index, true) : []
|
|
194
|
+
return Response.json({ ok: true, files })
|
|
195
|
+
}
|
|
171
196
|
if (sub === 'step') {
|
|
172
197
|
const index = Number(b.index)
|
|
173
198
|
if (!Number.isInteger(index) || index < 0) throw new Error(`step ${String(b.index)}?`)
|
package/src/social/stage.ts
CHANGED
|
@@ -213,7 +213,7 @@ export async function askPolish(root: string, slug: string, title: string, unit:
|
|
|
213
213
|
"- each heading's text in the identity's voice (wiki preferences/writing-voice/index.md and the project's voice page), never the same botcopy twice",
|
|
214
214
|
'- the alt describes the media; the rating and the media stay',
|
|
215
215
|
'- the repo guard must pass: `sk social` shows no line for it',
|
|
216
|
-
'- then close this note: `sk
|
|
216
|
+
'- then close this note: `sk thread fixed <this id> --note "polished"`',
|
|
217
217
|
].join('\n'),
|
|
218
218
|
})
|
|
219
219
|
}
|