rvlib-shipkit 2.25.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 +33 -0
- package/package.json +2 -2
- package/src/agent-time/diet.ts +77 -0
- package/src/agent-time/family.ts +72 -0
- package/src/agent-time/hooks.ts +331 -0
- 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 +130 -17
- package/src/agent-time/report-cache.ts +57 -0
- package/src/agent-time/report.ts +349 -23
- package/src/agent-time/shape.ts +50 -3
- package/src/agent-time/store.ts +370 -95
- 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/SK045-slow-hooks.check.ts +47 -0
- package/src/checks/SK046-hook-records.check.ts +76 -0
- 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 +5 -3
- 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_Mv.ts +1 -1
- package/src/cli/cmd_Reflect.ts +23 -2
- package/src/cli/cmd_Releases.ts +30 -0
- package/src/cli/cmd_Review.ts +569 -118
- 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 +82 -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 +26 -4
- 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/commands/runner.ts +5 -1
- 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/history-files.ts +9 -5
- 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/signal-name.ts +6 -0
- package/src/core/slots.ts +5 -4
- package/src/core/trace-audit.ts +6 -1
- package/src/core/transient.ts +6 -0
- package/src/drill/clean.ts +25 -1
- package/src/drill/run.ts +2 -2
- 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 +29 -4
- package/src/ledger/git-key.ts +3 -3
- package/src/ledger/git-scan.ts +49 -7
- package/src/ledger/run-log.ts +11 -3
- package/src/ledger/store.ts +26 -4
- package/src/media-store/backup/daemon.ts +36 -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 +68 -20
- 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 +146 -36
- 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/model.ts +18 -0
- package/src/releases/routes.ts +10 -5
- package/src/releases/store.ts +23 -2
- package/src/repo-config.ts +42 -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 +35 -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 +214 -45
- 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 +113 -16
- package/src/suite/select.ts +45 -3
- package/src/suite/suite-cli.ts +81 -34
- 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
- package/src/wiki/run-wiki.ts +2 -1
- package/src/wiki/scan-md.ts +42 -2
package/src/cli/registry.ts
CHANGED
|
@@ -4,15 +4,20 @@
|
|
|
4
4
|
// caught there. A new command registers here.
|
|
5
5
|
import { LIB_VERSION } from '../core/lib-version.ts'
|
|
6
6
|
import { Builtins, Cli, Command } from 'clipanion'
|
|
7
|
-
import { AskNewCommand, AsksCheckCommand, AsksCommand } from './cmd_Asks.ts'
|
|
7
|
+
import { AskNewCommand, AsksCheckCommand, AsksCommand, AsksDeclineCommand } from './cmd_Asks.ts'
|
|
8
8
|
import { AssetsAddCommand, AssetsCheckCommand, AssetsFillCommand, AssetsGenCommand, AssetsIdentityCommand } from './cmd_Assets.ts'
|
|
9
9
|
import { BumpCommand } from './cmd_Bump.ts'
|
|
10
10
|
import { CallsCommand } from './cmd_Calls.ts'
|
|
11
|
-
import { TimeCommand } from './cmd_Time.ts'
|
|
11
|
+
import { TimeCommand, TimeDietCommand } from './cmd_Time.ts'
|
|
12
12
|
import { DrillCalibrateCommand, DrillCleanCommand, DrillCloneCommand, DrillCompareCommand, DrillFinishCommand, DrillReportCommand, DrillVerdictCommand } from './cmd_Drill.ts'
|
|
13
13
|
import { CheckCommand } from './cmd_Check.ts'
|
|
14
14
|
import { CapacityCommand } from './cmd_Capacity.ts'
|
|
15
|
+
import { HqCardsCommand, HqCloseCommand, HqDrillCommand, HqEndCommand, HqForgetCommand, HqInviteCommand, HqJoinCommand, HqLeaveCommand, HqOpenCommand, HqDoorCommand, HqProxyCommand, HqReflectionsCommand, HqReflectionsForgetCommand, HqReplicateCommand, HqSwitchCommand } from './cmd_Hq.ts'
|
|
16
|
+
import { HistoryCheckCommand, HistoryForgetCommand, HistorySendCommand } from './cmd_History.ts'
|
|
17
|
+
import { VaultCompareCommand, VaultImportCommand, VaultInitCommand, VaultKeyCommand, VaultNarrowCommand, VaultDestroyCommand, VaultRestoreCommand, VaultRevokeRootsCommand, VaultServeCommand, VaultSnapshotCommand, VaultStatusCommand } from './cmd_Vault.ts'
|
|
15
18
|
import { LanesCommand } from './cmd_Lanes.ts'
|
|
19
|
+
import { MachinesCommand } from './cmd_Machines.ts'
|
|
20
|
+
import { DbCommand, DbDropCommand, DbFoldCommand, DbRebuildCommand, DbRepairCommand } from './cmd_Db.ts'
|
|
16
21
|
import { type CommandRow, commandRows, CommandsCommand, type Definition } from './cmd_Commands.ts'
|
|
17
22
|
import { type Candidate, familyList, type Said, unknownCommand } from './family-help.ts'
|
|
18
23
|
import { CrossRepoActivityCommand } from './cmd_CrossRepoActivity.ts'
|
|
@@ -26,7 +31,7 @@ import { CiCommand } from './cmd_Ci.ts'
|
|
|
26
31
|
import { ContractsCommand } from './cmd_Contracts.ts'
|
|
27
32
|
import { FleetCommand } from './cmd_Fleet.ts'
|
|
28
33
|
import { FleetPushCommand } from './cmd_FleetPush.ts'
|
|
29
|
-
import { DaemonCommand, DaemonJobCommand, GuiCommand, PmCommand, PmInstallCommand, PmRestartCommand, PmUninstallCommand, WebCommand } from './cmd_Home.ts'
|
|
34
|
+
import { DaemonCommand, DaemonJobCommand, GuiCommand, HomeMoveCommand, PmCommand, PmInstallCommand, PmRestartCommand, PmUninstallCommand, WebCommand } from './cmd_Home.ts'
|
|
30
35
|
import { HooksCommitMsgCommand, HooksInstallCommand, HooksListCommand, HooksPreCommitCommand } from './cmd_Hooks.ts'
|
|
31
36
|
import { InitCommand } from './cmd_Init.ts'
|
|
32
37
|
import { KeysCommand } from './cmd_Keys.ts'
|
|
@@ -35,7 +40,7 @@ import { NeedsCommand } from './cmd_Needs.ts'
|
|
|
35
40
|
import { PbCollectionCommand } from './cmd_Pb.ts'
|
|
36
41
|
import { ReflectCommand } from './cmd_Reflect.ts'
|
|
37
42
|
import { ReleaseCommand } from './cmd_Release.ts'
|
|
38
|
-
import { ReleasesAddCommand, ReleasesCommand, ReleasesRefreshCommand } from './cmd_Releases.ts'
|
|
43
|
+
import { ReleasesAddCommand, ReleasesCommand, ReleasesRefreshCommand, ReleasesRemoveCommand } from './cmd_Releases.ts'
|
|
39
44
|
import { ChecksCommand, UnitsAliasCommand } from './cmd_Checks.ts'
|
|
40
45
|
import { WhenCommand } from './cmd_When.ts'
|
|
41
46
|
import { CacheAuditCommand } from './cmd_CacheAudit.ts'
|
|
@@ -54,10 +59,12 @@ import { REC_COMMANDS } from './cmd_Rec.ts'
|
|
|
54
59
|
import { SignSetupCommand } from './cmd_Sign.ts'
|
|
55
60
|
import { ANNEX_COMMANDS } from './cmd_Annex.ts'
|
|
56
61
|
import { TMP_COMMANDS } from './cmd_Tmp.ts'
|
|
62
|
+
import { SPACE_COMMANDS } from './cmd_Space.ts'
|
|
57
63
|
import { BACKUP_COMMANDS } from './cmd_Backup.ts'
|
|
58
64
|
import { VEILLE_COMMANDS } from './cmd_Veille.ts'
|
|
59
65
|
import { MESSAGES_COMMANDS } from './cmd_Messages.ts'
|
|
60
66
|
import { TuiCommand } from './cmd_Tui.ts'
|
|
67
|
+
import { UrlsCommand } from './cmd_Urls.ts'
|
|
61
68
|
import { SecretListCommand, SecretReadCommand, SecretSetCommand, SecretCopyCommand } from './cmd_Secret.ts'
|
|
62
69
|
import { WikiLintCommand, WikiServeCommand } from './cmd_Wiki.ts'
|
|
63
70
|
|
|
@@ -127,6 +134,7 @@ export function buildCli(): Cli {
|
|
|
127
134
|
cli.register(ReleasesCommand)
|
|
128
135
|
cli.register(ReleasesAddCommand)
|
|
129
136
|
cli.register(ReleasesRefreshCommand)
|
|
137
|
+
cli.register(ReleasesRemoveCommand)
|
|
130
138
|
cli.register(HooksInstallCommand)
|
|
131
139
|
cli.register(HooksPreCommitCommand)
|
|
132
140
|
cli.register(HooksCommitMsgCommand)
|
|
@@ -143,6 +151,7 @@ export function buildCli(): Cli {
|
|
|
143
151
|
cli.register(SignSetupCommand)
|
|
144
152
|
for (const c of ANNEX_COMMANDS) cli.register(c)
|
|
145
153
|
for (const c of TMP_COMMANDS) cli.register(c)
|
|
154
|
+
for (const c of SPACE_COMMANDS) cli.register(c)
|
|
146
155
|
for (const c of BACKUP_COMMANDS) cli.register(c)
|
|
147
156
|
for (const c of VEILLE_COMMANDS) cli.register(c)
|
|
148
157
|
for (const c of MESSAGES_COMMANDS) cli.register(c)
|
|
@@ -154,10 +163,12 @@ export function buildCli(): Cli {
|
|
|
154
163
|
cli.register(PmInstallCommand)
|
|
155
164
|
cli.register(PmUninstallCommand)
|
|
156
165
|
cli.register(PmRestartCommand)
|
|
166
|
+
cli.register(HomeMoveCommand)
|
|
157
167
|
cli.register(GuiCommand)
|
|
158
168
|
cli.register(ContractsCommand)
|
|
159
169
|
cli.register(AsksCommand)
|
|
160
170
|
cli.register(AsksCheckCommand)
|
|
171
|
+
cli.register(AsksDeclineCommand)
|
|
161
172
|
cli.register(AskNewCommand)
|
|
162
173
|
cli.register(WikiServeCommand)
|
|
163
174
|
cli.register(WikiLintCommand)
|
|
@@ -185,6 +196,7 @@ export function buildCli(): Cli {
|
|
|
185
196
|
cli.register(GlobalProcessStopCommand)
|
|
186
197
|
cli.register(GlobalProcessRestartCommand)
|
|
187
198
|
cli.register(GlobalProcessOpenCommand)
|
|
199
|
+
cli.register(UrlsCommand)
|
|
188
200
|
cli.register(CrossRepoActivityCommand)
|
|
189
201
|
cli.register(PlannedCommand)
|
|
190
202
|
cli.register(InsightsCommand)
|
|
@@ -198,8 +210,18 @@ export function buildCli(): Cli {
|
|
|
198
210
|
cli.register(CommandsCommand)
|
|
199
211
|
cli.register(CapacityCommand)
|
|
200
212
|
cli.register(LanesCommand)
|
|
213
|
+
cli.register(MachinesCommand)
|
|
214
|
+
cli.register(DbCommand)
|
|
215
|
+
cli.register(DbFoldCommand)
|
|
216
|
+
cli.register(DbDropCommand)
|
|
217
|
+
cli.register(DbRepairCommand)
|
|
218
|
+
cli.register(DbRebuildCommand)
|
|
219
|
+
for (const c of [HqOpenCommand, HqCloseCommand, HqInviteCommand, HqEndCommand, HqForgetCommand, HqJoinCommand, HqLeaveCommand, HqReplicateCommand, HqDrillCommand, HqCardsCommand, HqSwitchCommand, HqReflectionsCommand, HqReflectionsForgetCommand, HqProxyCommand, HqDoorCommand]) cli.register(c)
|
|
220
|
+
for (const c of [HistorySendCommand, HistoryCheckCommand, HistoryForgetCommand]) cli.register(c)
|
|
221
|
+
for (const c of [VaultServeCommand, VaultStatusCommand, VaultInitCommand, VaultKeyCommand, VaultNarrowCommand, VaultImportCommand, VaultCompareCommand, VaultSnapshotCommand, VaultRestoreCommand, VaultDestroyCommand, VaultRevokeRootsCommand]) cli.register(c)
|
|
201
222
|
cli.register(CallsCommand)
|
|
202
223
|
cli.register(TimeCommand)
|
|
224
|
+
cli.register(TimeDietCommand)
|
|
203
225
|
cli.register(DrillReportCommand)
|
|
204
226
|
cli.register(DrillVerdictCommand)
|
|
205
227
|
cli.register(DrillCompareCommand)
|
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
// repo's diff shows it; Feedback appends are append-only, never destructive).
|
|
4
4
|
import { existsSync, readFileSync, writeFileSync } from 'fs'
|
|
5
5
|
import { join } from 'path'
|
|
6
|
-
import { archiveAsk, checkAsk, openAsks, proofAsk, type OneCheck } from '../asks/asks-queue.ts'
|
|
6
|
+
import { archiveAsk, checkAsk, declineAsk, openAsks, proofAsk, type OneCheck } from '../asks/asks-queue.ts'
|
|
7
|
+
import type { Held, HeldOf } from '../secrets/held.ts'
|
|
7
8
|
import { redact, type SecretStore } from '../secrets/manager.ts'
|
|
9
|
+
import { forgetHeld, heldOfAsks } from './providers.ts'
|
|
8
10
|
import { SECRET_NAME } from '../secrets/name.ts'
|
|
11
|
+
import { urlLogins } from '../urls/rows.ts'
|
|
9
12
|
|
|
10
13
|
const today = (): string => new Date().toISOString().slice(0, 10)
|
|
11
14
|
|
|
@@ -19,10 +22,10 @@ export function appendAssetNote(root: string, assetId: string, text: string): vo
|
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
/** a remark on an ask → appended to the ask file, dated, non-destructive.
|
|
22
|
-
* Accepts exactly one optional `done/` prefix (archived asks stay
|
|
25
|
+
* Accepts exactly one optional `done/` or `declined/` prefix (archived asks stay
|
|
23
26
|
* annotatable); any other slash or traversal is a bad path. */
|
|
24
27
|
export function appendAskRemark(root: string, asksDir: string, file: string, text: string): void {
|
|
25
|
-
if (!/^(done\/)?[A-Za-z0-9][A-Za-z0-9._-]*$/.test(file) || file.includes('..')) throw new Error('bad path')
|
|
28
|
+
if (!/^((done|declined)\/)?[A-Za-z0-9][A-Za-z0-9._-]*$/.test(file) || file.includes('..')) throw new Error('bad path')
|
|
26
29
|
const p = join(root, asksDir, file)
|
|
27
30
|
if (!existsSync(p)) throw new Error(`no such ask: ${file}`)
|
|
28
31
|
writeFileSync(p, `${readFileSync(p, 'utf8').trimEnd()}\n- ${today()}: ${text.replace(/\n+/g, ' ').trim()}\n`)
|
|
@@ -33,18 +36,55 @@ export function askDone(root: string, asksDir: string, file: string): void {
|
|
|
33
36
|
archiveAsk(join(root, asksDir), file)
|
|
34
37
|
}
|
|
35
38
|
|
|
39
|
+
/** the owner's « I will not do this » from the hub, his reason optional */
|
|
40
|
+
export function askDecline(root: string, asksDir: string, file: string, why?: string): void {
|
|
41
|
+
if (file.includes('/') || file.includes('..')) throw new Error('bad path')
|
|
42
|
+
declineAsk(join(root, asksDir), file, why)
|
|
43
|
+
}
|
|
44
|
+
|
|
36
45
|
export function askProof(root: string, asksDir: string, file: string, url: string): void {
|
|
37
46
|
if (file.includes('/') || file.includes('..')) throw new Error('bad path')
|
|
38
47
|
proofAsk(join(root, asksDir), file, url)
|
|
39
48
|
}
|
|
40
49
|
|
|
41
|
-
|
|
50
|
+
/** `held`: the store's state of that name read again after the store, so its row shows it at once; `account`: a
|
|
51
|
+
* login's account as stored, which is no secret */
|
|
52
|
+
export type SecretAnswer = { stored: string; held: Held; account?: string } & OneCheck
|
|
53
|
+
|
|
42
54
|
|
|
43
55
|
/** a value pasted under a credential ask: stored under a name that open ask
|
|
44
|
-
* declares, then
|
|
45
|
-
* file: the value is not written, logged or
|
|
46
|
-
* it replaced by ‹value› */
|
|
47
|
-
|
|
56
|
+
* declares, then the ask closes once every value is in, else its check alone.
|
|
57
|
+
* Its truth is the store, never a file: the value is not written, logged or
|
|
58
|
+
* answered, and a failure line has it replaced by ‹value› */
|
|
59
|
+
/** the longest account a login takes: an email address is at most 254 characters */
|
|
60
|
+
export const ACCOUNT_MAX = 254
|
|
61
|
+
|
|
62
|
+
/** why an account cannot go to the store's command as its last argument, in words that never quote it: a store
|
|
63
|
+
* command reads a leading dash as a flag and a line break as a second line. Null when it can */
|
|
64
|
+
export function accountProblem(account: string): string | null {
|
|
65
|
+
if (account.length > ACCOUNT_MAX) return `is longer than ${ACCOUNT_MAX} characters`
|
|
66
|
+
if (/[\u0000-\u001f\u007f]/.test(account)) return 'holds a line break or another control character'
|
|
67
|
+
if (account.startsWith('-')) return 'starts with a dash, which a store command reads as a flag'
|
|
68
|
+
return null
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** one value stored under a name, as an ask's field and a setup step's field both store it: trimmed, an empty one refused,
|
|
72
|
+
* the store's refusal said with the value hidden, what the hub remembered of the stores forgotten */
|
|
73
|
+
export async function storeValue(o: { root: string; name: string; value: string; account?: string | undefined; store: SecretStore }): Promise<void> {
|
|
74
|
+
const value = o.value.trim()
|
|
75
|
+
if (value === '') throw new Error(`${o.name}: an empty value is not stored`)
|
|
76
|
+
try {
|
|
77
|
+
const r = await o.store(o.name, value, o.account)
|
|
78
|
+
if (!r.ok) throw new Error(`${o.name} not stored: ${r.why}`)
|
|
79
|
+
forgetHeld(o.root)
|
|
80
|
+
} catch (e) {
|
|
81
|
+
throw new Error(redact(redact((e as Error).message, value), o.account ?? ''))
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** `account`: a login's account, stored with its value; `logins` the repo's url logins (urls/rows.ts urlLogins), a test
|
|
86
|
+
* passes its own */
|
|
87
|
+
export async function askSecret(o: { root: string; asksDir: string; file: string; name: string; value: string; account?: string; store: SecretStore; held?: HeldOf; logins?: string[] }): Promise<SecretAnswer> {
|
|
48
88
|
if (!/^[A-Za-z0-9][A-Za-z0-9._-]*\.md$/.test(o.file)) throw new Error('bad path')
|
|
49
89
|
const dir = join(o.root, o.asksDir)
|
|
50
90
|
const ask = openAsks(dir).find((a) => a.file === o.file)
|
|
@@ -53,13 +93,23 @@ export async function askSecret(o: { root: string; asksDir: string; file: string
|
|
|
53
93
|
if (!SECRET_NAME.test(o.name) || !ask.secrets.includes(o.name)) throw new Error(`${o.file} declares no secret named ${o.name}`)
|
|
54
94
|
const value = o.value.trim()
|
|
55
95
|
if (value === '') throw new Error('empty value: nothing stored')
|
|
96
|
+
const account = o.account?.trim() ?? ''
|
|
97
|
+
const login = ask.logins.includes(o.name) || (o.logins ?? (await urlLogins(o.root))).includes(o.name)
|
|
98
|
+
if (login && account === '') throw new Error(`${o.name} is a login: its account too (the email or user name you sign in with), nothing stored`)
|
|
99
|
+
if (!login && account !== '') throw new Error(`${o.name} is no login: it takes a value alone, nothing stored`)
|
|
100
|
+
const bad = login ? accountProblem(account) : null
|
|
101
|
+
if (bad != null) throw new Error(`${o.name}: the account ${bad}, nothing stored`)
|
|
102
|
+
const hide = (t: string): string => redact(redact(t, value), account)
|
|
56
103
|
let c: OneCheck
|
|
104
|
+
let held: Held
|
|
105
|
+
const heldOf = o.held ?? heldOfAsks
|
|
57
106
|
try {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
c = await checkAsk(o.root, dir, o.file)
|
|
107
|
+
await storeValue({ root: o.root, name: o.name, value, account: login ? account : undefined, store: o.store })
|
|
108
|
+
held = (await heldOf([o.name], o.root))[o.name] ?? { held: 'unknown', why: 'the store did not answer for it' }
|
|
109
|
+
c = await checkAsk(o.root, dir, o.file, { held: heldOf })
|
|
61
110
|
} catch (e) {
|
|
62
|
-
throw new Error(
|
|
111
|
+
throw new Error(hide((e as Error).message))
|
|
63
112
|
}
|
|
64
|
-
|
|
113
|
+
const mine = login ? { account } : {}
|
|
114
|
+
return c.check === 'failed' ? { stored: o.name, held, ...mine, check: 'failed', why: hide(c.why) } : { stored: o.name, held, ...mine, ...c }
|
|
65
115
|
}
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
// default, or a paste-from-elsewhere. Doctrine page: tools/shipkit/collections in
|
|
7
7
|
// the docs wiki this lib ships beside.
|
|
8
8
|
|
|
9
|
+
import type { ScopeChip } from '../core/scope.ts'
|
|
9
10
|
import { yieldLoop } from '../core/loop-watch.ts'
|
|
11
|
+
import type { Held } from '../secrets/held.ts'
|
|
10
12
|
import type { WhenAt, WhenSource } from '../core/when.ts'
|
|
11
13
|
import type { RunsCells } from '../core/runs-matrix.ts'
|
|
12
14
|
import type { CheckFrom } from '../ledger/gate-checks.ts'
|
|
@@ -32,7 +34,7 @@ export const NO_CHECK = 'in no check'
|
|
|
32
34
|
* section a row lives under (hub-app/tree-build.ts KIND_SECTION). There is no
|
|
33
35
|
* catch all kind: a row belongs to an owner, and what belongs to the hub
|
|
34
36
|
* itself is its status (serve/hub-problems.ts), never a row */
|
|
35
|
-
export const RESOURCE_TYPES = ['ask', 'secret', 'asset', 'post', 'workflow', 'wiki', 'contract', 'check', 'test', 'reflection', 'process', 'command', 'card', 'cut', 'voice', 'store', 'release', 'veille', 'message'] as const
|
|
37
|
+
export const RESOURCE_TYPES = ['ask', 'secret', 'asset', 'post', 'workflow', 'wiki', 'contract', 'check', 'test', 'reflection', 'process', 'url', 'command', 'card', 'cut', 'voice', 'store', 'release', 'veille', 'message'] as const
|
|
36
38
|
|
|
37
39
|
/** the collection of the review cards that wait on him (collections/review.ts) */
|
|
38
40
|
export const REVIEW_COL = 'review'
|
|
@@ -180,6 +182,9 @@ export type TestRun = {
|
|
|
180
182
|
* declaration names a file that is not on disk */
|
|
181
183
|
export type TestStanding = 'runs' | 'ignored' | 'orphan' | 'opaque' | 'missing'
|
|
182
184
|
|
|
185
|
+
/** who reads a secret, as the hub shows it: its chips, and the sentence behind them (secrets/who-reads.ts) */
|
|
186
|
+
export type Readers = { long: string; chips: ScopeChip[] }
|
|
187
|
+
|
|
183
188
|
/** an ask as its line on the asks page reads it: the frontmatter of its file */
|
|
184
189
|
export type AskFacts = {
|
|
185
190
|
kind: string
|
|
@@ -193,6 +198,21 @@ export type AskFacts = {
|
|
|
193
198
|
probe: string | null
|
|
194
199
|
/** the secret names a credential ask stores: its page takes each pasted value */
|
|
195
200
|
secrets: string[]
|
|
201
|
+
/** the `after:` value as written, null for none */
|
|
202
|
+
after: string | null
|
|
203
|
+
/** its `after:` moment is still ahead: out of the open count and the ping until then */
|
|
204
|
+
later: boolean
|
|
205
|
+
/** an open credential ask: whether the store holds each name it declares and since when, never a value */
|
|
206
|
+
held?: Record<string, Held>
|
|
207
|
+
/** an open ask: every secret name it asks to store, its body's store lines included */
|
|
208
|
+
stores?: string[]
|
|
209
|
+
/** an open ask: who will be able to read each name it stores (secrets/who-reads.ts) */
|
|
210
|
+
readers?: Record<string, Readers>
|
|
211
|
+
/** an open credential ask: the names that are logins (its `login:` line, or a url login of the repo with no
|
|
212
|
+
* account of its own), each stored with its account */
|
|
213
|
+
logins?: string[]
|
|
214
|
+
/** a stored login's account as the store gives it: an account is no secret */
|
|
215
|
+
accounts?: Record<string, string>
|
|
196
216
|
}
|
|
197
217
|
|
|
198
218
|
/** one test file, as its row and its page read it */
|
|
@@ -285,6 +305,8 @@ export type Instance = {
|
|
|
285
305
|
test?: TestFacts
|
|
286
306
|
/** asks only: what its frontmatter says */
|
|
287
307
|
ask?: AskFacts
|
|
308
|
+
/** secrets only: who is able to read it (secrets/who-reads.ts) */
|
|
309
|
+
who?: Readers
|
|
288
310
|
/** an open ask owns the action (dedup = acted-on once, never hidden):
|
|
289
311
|
* the instance stays red HERE but verbs and pings live with the ask */
|
|
290
312
|
askOwned?: boolean
|
|
@@ -17,12 +17,15 @@ import { assetDir, listRolls, readPick } from '../assets/roll-workspace.ts'
|
|
|
17
17
|
// runtime and the canvas binding, ~400ms of module load, and the hub's
|
|
18
18
|
// collection list is built on every request by callers that mostly never heal
|
|
19
19
|
import type { healIdentity } from '../assets/run-assets.ts'
|
|
20
|
-
import {
|
|
20
|
+
import { afterWords } from '../asks/ask-after.ts'
|
|
21
|
+
import { urlLogins } from '../urls/rows.ts'
|
|
22
|
+
import { archivedAsks, CLOSED, declinedNow, isLater, openAsks, type Ask } from '../asks/asks-queue.ts'
|
|
23
|
+
import type { Held, HeldOf } from '../secrets/held.ts'
|
|
21
24
|
import { evaluateContracts } from '../contracts/contracts-engine.ts'
|
|
22
25
|
import { CheckCtx } from '../core/check-ctx.ts'
|
|
23
26
|
import type { RepoConfig } from '../repo-config.ts'
|
|
24
27
|
import { activeContracts, contractsConfigFrom } from '../contracts/apply-contracts.ts'
|
|
25
|
-
import type { AskFacts, CheckFacts, Collection, Instance } from './collection-types.ts'
|
|
28
|
+
import type { AskFacts, CheckFacts, Collection, Instance, Readers } from './collection-types.ts'
|
|
26
29
|
import { mdBody } from './md-body.ts'
|
|
27
30
|
import { assetState, secretState, type SecretLevel, type SecretProbe } from './state-rules.ts'
|
|
28
31
|
import { reflectionsCollection } from './reflections.ts'
|
|
@@ -124,9 +127,65 @@ const slug = (t: string): string => t.toLowerCase().replace(/[^a-z0-9]+/g, '-').
|
|
|
124
127
|
/** wire lines re-rendered as a fenced block for an instance's md */
|
|
125
128
|
const wireMd = (lines: string[]): string => `\`\`\`\n${lines.join('\n')}\n\`\`\``
|
|
126
129
|
|
|
127
|
-
const askFacts = (a: Ask): AskFacts => ({ kind: a.kind, created: a.created, closed: a.closed, blocks: a.blocks, probe: a.check, secrets: a.kind === 'credential' ? a.secrets : [] })
|
|
130
|
+
const askFacts = (a: Ask, later = false, held?: Record<string, Held>, readers?: Record<string, Readers>, login?: { logins: string[]; accounts: Record<string, string> }): AskFacts => ({ kind: a.kind, created: a.created, closed: a.closed, blocks: a.blocks, probe: a.check, secrets: a.kind === 'credential' ? a.secrets : [], after: a.after, later, ...(held != null ? { held } : {}), ...(readers != null ? { stores: a.stores, readers } : {}), ...(login != null && login.logins.length > 0 ? login : {}) })
|
|
128
131
|
|
|
129
|
-
|
|
132
|
+
/** the store's read of a repo's names, kept this long: the hub lists its asks on every poll, and a read off the vault
|
|
133
|
+
* machine runs the secret manager once a name */
|
|
134
|
+
const HELD_KEEP_MS = 20_000
|
|
135
|
+
const heldKept = new Map<string, { at: number; held: Record<string, Held> }>()
|
|
136
|
+
|
|
137
|
+
/** the store's state of these names for the repo at `root` (secrets/read.ts heldHere), kept HELD_KEEP_MS */
|
|
138
|
+
export const heldOfAsks: HeldOf = async (names, root) => {
|
|
139
|
+
const key = `${root}\0${[...names].sort().join(' ')}`
|
|
140
|
+
const kept = heldKept.get(key)
|
|
141
|
+
if (kept != null && Date.now() - kept.at < HELD_KEEP_MS) return kept.held
|
|
142
|
+
const { heldHere } = await import('../secrets/read.ts')
|
|
143
|
+
const held = await heldHere({ names, cwd: root })
|
|
144
|
+
heldKept.set(key, { at: Date.now(), held })
|
|
145
|
+
return held
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** who reads each name: the house's registry row of it (secrets/who-reads.ts) */
|
|
149
|
+
export type WhoOf = (names: string[], root: string) => Promise<Record<string, Readers>>
|
|
150
|
+
const whoOfHouse: WhoOf = async (names, root) =>
|
|
151
|
+
Object.fromEntries(Object.entries(await (await import('../secrets/who-reads.ts')).whoReads(names, root)).map(([n, w]) => [n, { long: w.words, chips: w.chips }]))
|
|
152
|
+
/** the readers of these names, or none when the house cannot be read: a scope is never guessed */
|
|
153
|
+
const wordsOf = (who: WhoOf | undefined, names: string[], root: string): Promise<Record<string, Readers>> =>
|
|
154
|
+
names.length === 0 ? Promise.resolve({}) : (who ?? whoOfHouse)(names, root).catch(() => ({}))
|
|
155
|
+
|
|
156
|
+
/** a stored login's account, by name, as the store gives it (an account is no secret); none it cannot read */
|
|
157
|
+
export type AccountsOf = (names: string[], root: string) => Promise<Record<string, string>>
|
|
158
|
+
const accountsKept = new Map<string, { at: number; accounts: Record<string, string> }>()
|
|
159
|
+
const accountsOfStore: AccountsOf = async (names, root) => {
|
|
160
|
+
const key = `${root}\0${[...names].sort().join(' ')}`
|
|
161
|
+
const kept = accountsKept.get(key)
|
|
162
|
+
if (kept != null && Date.now() - kept.at < HELD_KEEP_MS) return kept.accounts
|
|
163
|
+
const { readSecretHere } = await import('../secrets/read.ts')
|
|
164
|
+
const read = await Promise.all(names.map(async (name) => [name, await readSecretHere({ name, field: 'account', cwd: root, say: () => {} }).catch(() => null)] as const))
|
|
165
|
+
const accounts = Object.fromEntries(read.flatMap(([n, r]) => (r != null && 'value' in r && r.value !== '' ? [[n, r.value]] : [])))
|
|
166
|
+
accountsKept.set(key, { at: Date.now(), accounts })
|
|
167
|
+
return accounts
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** the repo's url logins (urls/rows.ts urlLogins), kept like the store's read: they import the repo's url units */
|
|
171
|
+
const loginsKept = new Map<string, { at: number; names: Promise<string[]> }>()
|
|
172
|
+
const urlLoginsKept = (root: string): Promise<string[]> => {
|
|
173
|
+
const kept = loginsKept.get(root)
|
|
174
|
+
if (kept != null && Date.now() - kept.at < HELD_KEEP_MS) return kept.names
|
|
175
|
+
const names = urlLogins(root)
|
|
176
|
+
loginsKept.set(root, { at: Date.now(), names })
|
|
177
|
+
return names
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** a store moved a value of this repo: its next read asks the store again */
|
|
181
|
+
export const forgetHeld = (root: string): void => {
|
|
182
|
+
for (const k of heldKept.keys()) if (k.startsWith(`${root}\0`)) heldKept.delete(k)
|
|
183
|
+
for (const k of accountsKept.keys()) if (k.startsWith(`${root}\0`)) accountsKept.delete(k)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** a later ask (its `after:` moment ahead) is yellow, so it never pings, and quiet in the tree: out of the way until
|
|
187
|
+
* then, red from then on with no edit of its file. `now` is the clock a test passes */
|
|
188
|
+
export function asksCollection(root: string, c: RepoConfig, o: { now?: () => number; held?: HeldOf; who?: WhoOf; urlLogins?: (root: string) => Promise<string[]>; accounts?: AccountsOf } = {}): Collection {
|
|
130
189
|
return {
|
|
131
190
|
id: 'asks',
|
|
132
191
|
title: 'asks',
|
|
@@ -134,38 +193,56 @@ export function asksCollection(root: string, c: RepoConfig): Collection {
|
|
|
134
193
|
media: 'text',
|
|
135
194
|
list: async () => {
|
|
136
195
|
const rel = c.asks?.dir ?? LAYOUT.asks
|
|
137
|
-
const
|
|
196
|
+
const now = (o.now ?? Date.now)()
|
|
197
|
+
const asks = openAsksSafe(root, c)
|
|
198
|
+
// each credential ask's names, read once for all of them: names and dates, never a value
|
|
199
|
+
const names = [...new Set(asks.filter((a) => a.kind === 'credential').flatMap((a) => a.secrets))]
|
|
200
|
+
const held = names.length === 0 ? {} : await (o.held ?? heldOfAsks)(names, root).catch((e: Error): Record<string, Held> => Object.fromEntries(names.map((n) => [n, { held: 'unknown', why: e.message }])))
|
|
201
|
+
// who will read each name an open ask stores: said before the value is pasted
|
|
202
|
+
const who = await wordsOf(o.who, [...new Set(asks.flatMap((a) => a.stores))], root)
|
|
203
|
+
// a login: its own line, or a url login of the repo; its account read once stored
|
|
204
|
+
const fromUrls = names.length === 0 ? [] : await (o.urlLogins ?? urlLoginsKept)(root).catch(() => [])
|
|
205
|
+
const loginsOf = (a: Ask): string[] => (a.kind === 'credential' ? a.secrets.filter((n) => a.logins.includes(n) || fromUrls.includes(n)) : [])
|
|
206
|
+
const stored = [...new Set(asks.flatMap(loginsOf))].filter((n) => held[n]?.held === 'stored')
|
|
207
|
+
const accounts = stored.length === 0 ? {} : await (o.accounts ?? accountsOfStore)(stored, root).catch(() => ({}))
|
|
208
|
+
const open = asks.map((a): Instance => {
|
|
209
|
+
const later = isLater(a, now)
|
|
210
|
+
const mine = a.kind === 'credential' && a.secrets.length > 0 ? Object.fromEntries(a.secrets.map((n) => [n, held[n] ?? { held: 'unknown' as const, why: 'not read' }])) : undefined
|
|
211
|
+
return {
|
|
138
212
|
id: `ask:${a.file}`,
|
|
139
|
-
text: `${a.title}${a.kind !== '' ? ` (${a.kind})` : ''}`,
|
|
213
|
+
text: `${a.title}${a.kind !== '' ? ` (${a.kind})` : ''}${later ? `, ${afterWords(a.after!)}` : ''}`,
|
|
140
214
|
// the tree carries the title and puts the kind in its own
|
|
141
215
|
// slot, so a column of asks reads as a column of kinds
|
|
142
216
|
label: a.title,
|
|
143
217
|
slot: a.kind !== '' ? a.kind : undefined,
|
|
144
218
|
type: 'ask' as const,
|
|
145
219
|
path: `${rel}/${a.file}`,
|
|
146
|
-
severity: 'red' as const,
|
|
220
|
+
severity: later ? ('yellow' as const) : ('red' as const),
|
|
221
|
+
...(later ? { state: 'quiet' as const } : {}),
|
|
147
222
|
verbs: ['done' as const, 'paste-proof' as const],
|
|
148
223
|
file: `${rel}/${a.file}`,
|
|
149
224
|
md: mdBody(join(root, rel, a.file)),
|
|
150
225
|
remarks: lastRemarks(join(root, rel, a.file)),
|
|
151
|
-
ask: askFacts(a),
|
|
152
|
-
|
|
153
|
-
|
|
226
|
+
ask: askFacts(a, later, mine, a.stores.length > 0 ? Object.fromEntries(a.stores.flatMap((n) => (who[n] != null ? [[n, who[n]!]] : []))) : undefined,
|
|
227
|
+
{ logins: loginsOf(a), accounts: Object.fromEntries(loginsOf(a).flatMap((n) => (accounts[n] != null ? [[n, accounts[n]!]] : []))) }),
|
|
228
|
+
}
|
|
229
|
+
})
|
|
230
|
+
// the done/ and declined/ archives ride along QUIET (no severity): past answers
|
|
154
231
|
// stay consultable and remarkable; newest first, after every open ask
|
|
155
|
-
const
|
|
156
|
-
id: `ask
|
|
232
|
+
const closed = CLOSED.flatMap((status) => archivedAsks(askDirOf(root, c), status).map((a): Instance => ({
|
|
233
|
+
id: `ask:${status}/${a.file}`,
|
|
157
234
|
text: `${a.title}${a.kind !== '' ? ` (${a.kind})` : ''}`,
|
|
158
235
|
label: a.title,
|
|
159
|
-
slot:
|
|
236
|
+
slot: status,
|
|
160
237
|
type: 'ask' as const,
|
|
161
|
-
path: `${rel}
|
|
238
|
+
path: `${rel}/${status}/${a.file}`,
|
|
162
239
|
state: 'quiet' as const,
|
|
163
|
-
file: `${rel}
|
|
164
|
-
md: mdBody(join(root, rel,
|
|
165
|
-
remarks: lastRemarks(join(root, rel,
|
|
240
|
+
file: `${rel}/${status}/${a.file}`,
|
|
241
|
+
md: mdBody(join(root, rel, status, a.file)),
|
|
242
|
+
remarks: lastRemarks(join(root, rel, status, a.file)),
|
|
166
243
|
ask: askFacts(a),
|
|
167
|
-
}))
|
|
168
|
-
return [...open, ...
|
|
244
|
+
})))
|
|
245
|
+
return [...open, ...closed]
|
|
169
246
|
},
|
|
170
247
|
}
|
|
171
248
|
}
|
|
@@ -182,6 +259,7 @@ export type CredsOpts = {
|
|
|
182
259
|
* the run record every gate run and health pass writes */
|
|
183
260
|
verdicts?: () => Promise<CheckVerdict[]>
|
|
184
261
|
now?: () => number
|
|
262
|
+
who?: WhoOf
|
|
185
263
|
}
|
|
186
264
|
|
|
187
265
|
/** the verdicts a secret row reads, off the checks collection's own rows, so
|
|
@@ -210,8 +288,11 @@ export function credsCollection(root: string, c: RepoConfig, o: CredsOpts = {}):
|
|
|
210
288
|
list: async () => {
|
|
211
289
|
const rel = c.asks?.dir ?? LAYOUT.asks
|
|
212
290
|
const asks = openAsksSafe(root, c)
|
|
213
|
-
|
|
214
|
-
|
|
291
|
+
// the ask that stores this name, else the older match by its title
|
|
292
|
+
const coveringAsk = (name: string): Ask | undefined =>
|
|
293
|
+
asks.find((a) => a.stores.includes(name)) ?? asks.find((a) => a.title.toLowerCase().includes(name.split('/')[1] ?? name))
|
|
294
|
+
const declined = existsSync(askDirOf(root, c)) ? declinedNow(askDirOf(root, c)) : []
|
|
295
|
+
const declinedFor = (name: string): { rel: string; ask: Ask } | undefined => declined.find((d) => d.ask.stores.includes(name))
|
|
215
296
|
const verdicts = await (o.verdicts ?? (() => verdictsOf(checksCollection(root, c))))()
|
|
216
297
|
const now = (o.now ?? Date.now)()
|
|
217
298
|
const missing = missingFrom(verdicts)
|
|
@@ -229,7 +310,18 @@ export function credsCollection(root: string, c: RepoConfig, o: CredsOpts = {}):
|
|
|
229
310
|
const decl = declared.find((d) => d.name === name)
|
|
230
311
|
const md = wireMd([`FAIL: ${line.text}`, ...line.fixes.map((f) => `fix: ${f}`)])
|
|
231
312
|
const ask = coveringAsk(name)
|
|
232
|
-
|
|
313
|
+
const no = ask == null ? declinedFor(name) : undefined
|
|
314
|
+
if (no != null)
|
|
315
|
+
// the owner declined the ask for it: listed, never red, never pinged, and never asked again
|
|
316
|
+
out.push({
|
|
317
|
+
id: `cred:${name}`,
|
|
318
|
+
text: `${named(name, decl?.service)} missing, the owner declined it on ${no.ask.closed ?? '?'} (ask ${rel}/${no.rel})${minorWord(decl?.level)}`,
|
|
319
|
+
...credPlace(name, true, decl?.level),
|
|
320
|
+
state: 'quiet',
|
|
321
|
+
md,
|
|
322
|
+
askOwned: true,
|
|
323
|
+
})
|
|
324
|
+
else if (ask != null)
|
|
233
325
|
// dedup = acted-on once, never hidden: the ask keeps the
|
|
234
326
|
// verbs and the ping; the cred still shows here
|
|
235
327
|
out.push({
|
|
@@ -257,7 +349,9 @@ export function credsCollection(root: string, c: RepoConfig, o: CredsOpts = {}):
|
|
|
257
349
|
artifact: d.mintUrl != null ? { url: d.mintUrl } : undefined,
|
|
258
350
|
})
|
|
259
351
|
}
|
|
260
|
-
|
|
352
|
+
const nameOf = (i: Instance): string => i.id.replace(/^cred:/, '')
|
|
353
|
+
const who = await wordsOf(o.who, out.map(nameOf), root)
|
|
354
|
+
return out.map((i) => (who[nameOf(i)] != null ? { ...i, who: who[nameOf(i)] } : i))
|
|
261
355
|
},
|
|
262
356
|
}
|
|
263
357
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
// the review store and the trailer cuts as tree rows (wiki tools/shipkit/
|
|
1
|
+
// the review store and the trailer cuts as tree rows (wiki tools/shipkit/threads.md). Under the review section, one row a
|
|
2
2
|
// card that waits on HIM (the owner's verdict, his answer to a question): yellow, so `sk needs` lists it too. Under the trailer
|
|
3
3
|
// section, one row a cut, its open frame notes in the slot: they wait on agents, never on him, so a cut is never yellow;
|
|
4
4
|
// and one yellow row a line of his own voice he has not recorded yet (the page's Voices). Each collection exists only where the repo has its folder, so a repo with none draws the section greyed
|
|
5
5
|
import { existsSync } from 'node:fs'
|
|
6
6
|
import { join } from 'node:path'
|
|
7
7
|
import { STATUS_LABEL, isFrame, stateOf, type ReviewItem } from '../review/model.ts'
|
|
8
|
-
import { readAllCached, storeDir, storeStamp, warmStore } from '../review/store.ts'
|
|
8
|
+
import { hasStore, readAllCached, storeDir, storeStamp, warmStore } from '../review/store.ts'
|
|
9
9
|
import { statusOf, waitingOnOwner, type Thread } from '../review/threads.ts'
|
|
10
10
|
import { cutsOf, trailerIds } from '../review/trailer-desk.ts'
|
|
11
11
|
import { voicesDesk } from '../review/trailer-voices.ts'
|
|
@@ -30,7 +30,7 @@ export function waitingCards(root: string): { threads: Thread[]; items: ReviewIt
|
|
|
30
30
|
|
|
31
31
|
export function reviewCollection(root: string): Collection | null {
|
|
32
32
|
const dir = storeDir(root)
|
|
33
|
-
if (!
|
|
33
|
+
if (!hasStore(dir)) return null
|
|
34
34
|
return {
|
|
35
35
|
id: REVIEW_COL,
|
|
36
36
|
title: 'review',
|
|
@@ -63,7 +63,7 @@ export function trailersCollection(root: string): Collection | null {
|
|
|
63
63
|
media: 'image',
|
|
64
64
|
list: async () => {
|
|
65
65
|
const dir = storeDir(root)
|
|
66
|
-
const items =
|
|
66
|
+
const items = hasStore(dir) ? readAllCached(dir).items : []
|
|
67
67
|
const open = new Map<string, number>()
|
|
68
68
|
for (const x of items) {
|
|
69
69
|
const s = x.item.subject
|
package/src/commands/runner.ts
CHANGED
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
// output into `out.log` and writes `exit.json` once it ends, so a daemon restart never loses a run or its verdict.
|
|
3
3
|
// Started detached (runs.ts), it leads its own process group: Stop signals the group
|
|
4
4
|
import { closeSync, openSync, writeSync } from 'node:fs'
|
|
5
|
+
import { signalName } from '../core/signal-name.ts'
|
|
5
6
|
import { constants } from 'node:os'
|
|
6
7
|
import { join } from 'node:path'
|
|
7
8
|
import { atomicWrite } from '../core/locked-write.ts'
|
|
8
9
|
import type { Exit } from '../core/jobs.ts'
|
|
9
10
|
|
|
10
11
|
/** the exit code of a run its signal ended: 128 plus the signal, as a shell says it */
|
|
11
|
-
export const signalCode = (signal: string | null): number =>
|
|
12
|
+
export const signalCode = (signal: string | number | null): number => {
|
|
13
|
+
const name = signalName(signal)
|
|
14
|
+
return 128 + ((name != null ? constants.signals[name as keyof typeof constants.signals] : undefined) ?? (typeof signal === 'number' ? signal : 0))
|
|
15
|
+
}
|
|
12
16
|
|
|
13
17
|
if (import.meta.main) {
|
|
14
18
|
const [dir, ...argv] = process.argv.slice(2)
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// GENERATED by contracts:sync — do not edit; sources are the co-located
|
|
2
2
|
// wiki manifests. Parity is lint-enforced.
|
|
3
3
|
import type { ContractManifest } from './contract-types.ts'
|
|
4
|
-
import c0 from './manifests/
|
|
5
|
-
import c1 from './manifests/
|
|
6
|
-
import c2 from './manifests/
|
|
7
|
-
import c3 from './manifests/
|
|
4
|
+
import c0 from './manifests/chrome-web-store.contract.ts'
|
|
5
|
+
import c1 from './manifests/discord.contract.ts'
|
|
6
|
+
import c2 from './manifests/identity.contract.ts'
|
|
7
|
+
import c3 from './manifests/itch.contract.ts'
|
|
8
|
+
import c4 from './manifests/steam.contract.ts'
|
|
8
9
|
|
|
9
|
-
export const allContracts: ContractManifest[] = [c0, c1, c2, c3]
|
|
10
|
+
export const allContracts: ContractManifest[] = [c0, c1, c2, c3, c4]
|
|
@@ -10,8 +10,10 @@ export type FileRule = RuleOpts & { kind: 'file'; path: string; nonEmpty: boolea
|
|
|
10
10
|
/** `atLeast`: the venue's numbers are a MINIMUM at a fixed aspect ratio (itch
|
|
11
11
|
* displays a 630x500 cover but accepts larger, and a 2x asset is better) —
|
|
12
12
|
* without it an exact-size rule blocks the release over a better file */
|
|
13
|
-
export type PngRule = RuleOpts & { kind: 'png'; path: string; width: number; height: number; atLeast?: boolean }
|
|
14
|
-
|
|
13
|
+
export type PngRule = RuleOpts & { kind: 'png'; path: string; width: number; height: number; atLeast?: boolean; opaque?: boolean }
|
|
14
|
+
/** `opaque` (png and glob): the venue refuses an alpha channel (the Chrome Web
|
|
15
|
+
* Store's tiles and screenshots are 24-bit png), so an RGBA file fails */
|
|
16
|
+
export type GlobRule = RuleOpts & { kind: 'glob'; pattern: string; min: number; width?: number; height?: number; opaque?: boolean }
|
|
15
17
|
export type MdRule = RuleOpts & { kind: 'md'; path: string; mustContain: string[] }
|
|
16
18
|
export type DirRule = RuleOpts & { kind: 'dir'; path: string }
|
|
17
19
|
// probe returns FAIL messages (empty array = pass) — for rules that need the
|
|
@@ -60,8 +62,8 @@ export type ContractManifest = {
|
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
export const file = (path: string, p?: RuleOpts & { nonEmpty?: boolean }): FileRule => ({ kind: 'file', path, nonEmpty: p?.nonEmpty ?? true, warnOnly: p?.warnOnly })
|
|
63
|
-
export const png = (path: string, width: number, height: number, p?: RuleOpts & { atLeast?: boolean }): PngRule => ({ kind: 'png', path, width, height, atLeast: p?.atLeast, warnOnly: p?.warnOnly })
|
|
64
|
-
export const glob = (pattern: string, p: RuleOpts & { min: number; width?: number; height?: number }): GlobRule => ({ kind: 'glob', pattern, min: p.min, width: p.width, height: p.height, warnOnly: p.warnOnly })
|
|
65
|
+
export const png = (path: string, width: number, height: number, p?: RuleOpts & { atLeast?: boolean; opaque?: boolean }): PngRule => ({ kind: 'png', path, width, height, atLeast: p?.atLeast, opaque: p?.opaque, warnOnly: p?.warnOnly })
|
|
66
|
+
export const glob = (pattern: string, p: RuleOpts & { min: number; width?: number; height?: number; opaque?: boolean }): GlobRule => ({ kind: 'glob', pattern, min: p.min, width: p.width, height: p.height, opaque: p.opaque, warnOnly: p.warnOnly })
|
|
65
67
|
export const md = (path: string, p?: RuleOpts & { mustContain?: string[] }): MdRule => ({ kind: 'md', path, mustContain: p?.mustContain ?? [], warnOnly: p?.warnOnly })
|
|
66
68
|
export const dir = (path: string, p?: RuleOpts): DirRule => ({ kind: 'dir', path, warnOnly: p?.warnOnly })
|
|
67
69
|
export const custom = (id: string, probe: CustomRule['probe'], p?: RuleOpts): CustomRule => ({ kind: 'custom', id, probe, warnOnly: p?.warnOnly })
|
|
@@ -45,6 +45,15 @@ export function pngDims(bytes: Uint8Array | null): { width: number; height: numb
|
|
|
45
45
|
return { width: view.getUint32(16), height: view.getUint32(20) }
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
/** the IHDR colour type carries an alpha channel (4 grey and alpha, 6 RGBA);
|
|
49
|
+
* null for no png. A palette's tRNS chunk is not read */
|
|
50
|
+
export function pngAlpha(bytes: Uint8Array | null): boolean | null {
|
|
51
|
+
if (bytes == null || bytes.length < 26 || pngDims(bytes) == null) return null
|
|
52
|
+
return bytes[25] === 4 || bytes[25] === 6
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const ALPHA = 'has an alpha channel: need a 24-bit png with no alpha'
|
|
56
|
+
|
|
48
57
|
const WILD = /[*?[{]/
|
|
49
58
|
|
|
50
59
|
/** the files matching a repo-relative glob, walked one dir at a time through
|
|
@@ -118,6 +127,7 @@ async function checkRule(rule: ArtifactRule, env: ContractEnv, d: ContractDisk):
|
|
|
118
127
|
if (tooSmall || ratioOff)
|
|
119
128
|
problems.push(`${rule.path} is ${dims.width}x${dims.height} — need ${need}${ratioOff ? ' (the ratio is off; a bigger asset at the same ratio is fine)' : ' (bigger is fine, smaller is not)'}`)
|
|
120
129
|
}
|
|
130
|
+
if (dims != null && rule.opaque === true && pngAlpha(d.bytes(rule.path)) === true) problems.push(`${rule.path} ${ALPHA}`)
|
|
121
131
|
break
|
|
122
132
|
}
|
|
123
133
|
case 'glob': {
|
|
@@ -129,6 +139,7 @@ async function checkRule(rule: ArtifactRule, env: ContractEnv, d: ContractDisk):
|
|
|
129
139
|
if (dims == null || dims.width !== rule.width || dims.height !== rule.height)
|
|
130
140
|
problems.push(`${m} is ${dims == null ? 'not a readable png' : `${dims.width}x${dims.height}`} — need ${rule.width}x${rule.height}`)
|
|
131
141
|
}
|
|
142
|
+
if (rule.opaque === true) for (const m of matches) if (pngAlpha(d.bytes(m)) === true) problems.push(`${m} ${ALPHA}`)
|
|
132
143
|
break
|
|
133
144
|
}
|
|
134
145
|
case 'md': {
|