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/asks/asks-queue.ts
CHANGED
|
@@ -1,18 +1,53 @@
|
|
|
1
1
|
// Persistent human<->agent queue for real-world actions and answers.
|
|
2
|
-
// One md file per ask in <dir>/, git-tracked; <dir>/done/
|
|
3
|
-
//
|
|
4
|
-
// auto-closes asks whose `check:` probe passes).
|
|
2
|
+
// One md file per ask in <dir>/, git-tracked; <dir>/done/ and <dir>/declined/
|
|
3
|
+
// archives, a folder per closed status. The agent greps status; the human edits
|
|
4
|
+
// files (or just does the thing — check() auto-closes asks whose `check:` probe passes).
|
|
5
5
|
//
|
|
6
6
|
// Stdout contract (FROZEN — consumers parse the prefixes): `closed +
|
|
7
|
-
// archived <file>` / `archived <file>` / `still <status> <file>` / `N closed`.
|
|
7
|
+
// archived <file>` / `archived <file>` / `reopened <file>` / `still <status> <file>` / `N closed`.
|
|
8
8
|
import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, writeFileSync } from 'fs'
|
|
9
9
|
import { atomicWrite, mutateLease, withMutateLease } from '../core/locked-write.ts'
|
|
10
10
|
import { join } from 'path'
|
|
11
11
|
import { SECRET_NAME } from '../secrets/name.ts'
|
|
12
|
+
import { allStoredSince, type HeldOf } from '../secrets/held.ts'
|
|
13
|
+
import { AFTER_FORMS, afterMs, afterWords } from './ask-after.ts'
|
|
14
|
+
|
|
15
|
+
/** `secrets`: the names a credential ask stores, from its `secret:` line (space or comma separated), [] for none.
|
|
16
|
+
* `stores`: every secret name it asks to store, those and the ones a store line of its body names.
|
|
17
|
+
* `logins`: the names of its `login:` line, secrets stored with an account (the email or user name) beside the value.
|
|
18
|
+
* `after`: the moment it waits for as written, `afterAt` that moment in epoch ms (ask-after.ts) */
|
|
19
|
+
export type Ask = { file: string; status: string; kind: string; created: string; closed: string | null; blocks: string; check: string | null; waits: AskWait[]; pinged: string | null; secrets: string[]; stores: string[]; logins: string[]; after: string | null; afterAt: number | null; title: string }
|
|
20
|
+
/** a warning an ask holds: the check that prints it and words of that one line. The activity page counts it as
|
|
21
|
+
* waiting on the owner, never as work for an agent */
|
|
22
|
+
export type AskWait = { check: string; says: string }
|
|
23
|
+
|
|
24
|
+
const ONE_WAIT = /^([^\s,"]+)\s+"([^"]*)"\s*(?:,\s*|$)/
|
|
25
|
+
|
|
26
|
+
/** `waits: SK002 "Steamworks appid", read-email "token refresh"`. The words are required and any other spelling
|
|
27
|
+
* throws, the file named: a hold with no words would cover every warning its check ever prints, agent work included */
|
|
28
|
+
export const parseWaits = (v: string | null, file: string): AskWait[] => {
|
|
29
|
+
const out: AskWait[] = []
|
|
30
|
+
let rest = (v ?? '').trim()
|
|
31
|
+
while (rest !== '') {
|
|
32
|
+
const m = ONE_WAIT.exec(rest)
|
|
33
|
+
if (m == null || m[2]!.trim() === '') throw new Error(`${file}: waits: '${v}' is not <check id> "<words of its line>"[, <check id> "<words>"]: the words are required`)
|
|
34
|
+
out.push({ check: m[1]!, says: m[2]!.trim() })
|
|
35
|
+
rest = rest.slice(m[0].length)
|
|
36
|
+
}
|
|
37
|
+
return out
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** `again`: an ask the owner declined, asked again on purpose; `why` then says what changed. `readers`: who will
|
|
41
|
+
* read each secret, in words (secrets/who-reads.ts), written into the file */
|
|
42
|
+
export type CreateOpts = { kind?: string; blocks?: string; check?: string; why?: string; secrets?: string[]; after?: string; again?: boolean; readers?: Record<string, string>; logins?: string[] }
|
|
12
43
|
|
|
13
|
-
/**
|
|
14
|
-
export
|
|
15
|
-
export type
|
|
44
|
+
/** how an ask closes: done, or declined by the owner. Each status names its archive folder under the queue */
|
|
45
|
+
export const CLOSED = ['done', 'declined'] as const
|
|
46
|
+
export type Closed = (typeof CLOSED)[number]
|
|
47
|
+
export const isClosed = (status: string): status is Closed => (CLOSED as readonly string[]).includes(status)
|
|
48
|
+
|
|
49
|
+
/** a store line in an ask's body: `<tool> secret set <name>`, as `sk secret set` and a secret manager of the same shape write it */
|
|
50
|
+
const STORE_LINE = /\bsecret set\s+([A-Za-z0-9][A-Za-z0-9._@/-]*)/g
|
|
16
51
|
|
|
17
52
|
/** filename slug: kebab, truncated at a WORD boundary (never mid-word — a
|
|
18
53
|
* `…-rvlib-` stub reads as broken). Falls back to a hard cut only when the
|
|
@@ -47,12 +82,21 @@ const withKeys = (md: string, keys: [string, string][]): string => {
|
|
|
47
82
|
}
|
|
48
83
|
return ['---', ...head, '---', ...f.body].join('\n')
|
|
49
84
|
}
|
|
50
|
-
const
|
|
85
|
+
const today = (): string => new Date().toISOString().slice(0, 10)
|
|
86
|
+
const closedKeys = (status: Closed = 'done'): [string, string][] => [['status', status], ['closed', today()]]
|
|
87
|
+
|
|
88
|
+
const parse = (dir: string, file: string): Ask => askOf(readFileSync(join(dir, file), 'utf8'), file)
|
|
51
89
|
|
|
52
|
-
|
|
53
|
-
|
|
90
|
+
/** one ask file's keys and title, from its text: its front matter only, never its body. Throws on an `after:` that
|
|
91
|
+
* names no moment, the file named */
|
|
92
|
+
export const askOf = (md: string, file: string): Ask => {
|
|
54
93
|
const head = frontMatter(md)
|
|
55
94
|
const fm = (key: string): string | null => head.match(new RegExp(`^${key}:\\s*(.+)$`, 'm'))?.[1]?.trim() ?? null
|
|
95
|
+
const after = fm('after')
|
|
96
|
+
const afterAt = after == null ? null : afterMs(after)
|
|
97
|
+
if (after != null && afterAt == null) throw new Error(`${file}: after: '${after}' names no moment: write ${AFTER_FORMS}`)
|
|
98
|
+
const secrets = (fm('secret') ?? '').split(/[\s,]+/).filter((n) => n !== '')
|
|
99
|
+
const body = splitFront(md)?.body.join('\n') ?? md
|
|
56
100
|
return {
|
|
57
101
|
file,
|
|
58
102
|
status: fm('status') ?? 'open',
|
|
@@ -61,7 +105,13 @@ const parse = (dir: string, file: string): Ask => {
|
|
|
61
105
|
closed: fm('closed'),
|
|
62
106
|
blocks: fm('blocks') ?? '-',
|
|
63
107
|
check: fm('check'),
|
|
64
|
-
|
|
108
|
+
waits: parseWaits(fm('waits'), file),
|
|
109
|
+
pinged: fm('pinged'),
|
|
110
|
+
secrets,
|
|
111
|
+
logins: (fm('login') ?? '').split(/[\s,]+/).filter((n) => n !== ''),
|
|
112
|
+
stores: [...new Set([...secrets, ...[...body.matchAll(STORE_LINE)].map((m) => m[1]!.replace(/[.]+$/, ''))])],
|
|
113
|
+
after,
|
|
114
|
+
afterAt,
|
|
65
115
|
title: md.match(/^# (.+)$/m)?.[1] ?? file,
|
|
66
116
|
}
|
|
67
117
|
}
|
|
@@ -71,16 +121,44 @@ export function listAsks(dir: string): Ask[] {
|
|
|
71
121
|
return readdirSync(dir).filter((f) => f.endsWith('.md')).sort().map((f) => parse(dir, f))
|
|
72
122
|
}
|
|
73
123
|
|
|
124
|
+
/** an open ask whose `after:` moment is still ahead: out of the open count and the ping until then */
|
|
125
|
+
export const isLater = (a: Ask, now: number = Date.now()): boolean => !isClosed(a.status) && a.afterAt != null && now < a.afterAt
|
|
126
|
+
|
|
127
|
+
/** every ask neither done nor declined, the later ones included (isLater tells them apart) */
|
|
74
128
|
export function openAsks(dir: string): Ask[] {
|
|
75
|
-
return listAsks(dir).filter((a) => a.status
|
|
129
|
+
return listAsks(dir).filter((a) => !isClosed(a.status))
|
|
76
130
|
}
|
|
77
131
|
|
|
78
|
-
/**
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
132
|
+
/** an archived file that does not parse, by its path under the queue (`done/<file>`), and why */
|
|
133
|
+
export type Unparsed = (rel: string, why: string) => void
|
|
134
|
+
|
|
135
|
+
/** one closed status's archive, newest-first — READ-ONLY: never mints the dir
|
|
136
|
+
* (numeric filename prefixes are creation order, so reverse-sort = newest). A file that does not parse throws, or
|
|
137
|
+
* with `unparsed` is skipped and named to it: an archive never stops a reader of the others */
|
|
138
|
+
export function archivedAsks(dir: string, status: Closed, unparsed?: Unparsed): Ask[] {
|
|
139
|
+
const at = join(dir, status)
|
|
140
|
+
if (!existsSync(at)) return []
|
|
141
|
+
return readdirSync(at).filter((f) => f.endsWith('.md')).sort().reverse().flatMap((f) => {
|
|
142
|
+
if (unparsed == null) return [parse(at, f)]
|
|
143
|
+
try {
|
|
144
|
+
return [parse(at, f)]
|
|
145
|
+
} catch (e) {
|
|
146
|
+
unparsed(`${status}/${f}`, (e as Error).message)
|
|
147
|
+
return []
|
|
148
|
+
}
|
|
149
|
+
})
|
|
150
|
+
}
|
|
151
|
+
export const doneAsks = (dir: string, unparsed?: Unparsed): Ask[] => archivedAsks(dir, 'done', unparsed)
|
|
152
|
+
/** the asks filed under declined/, whatever their status says now */
|
|
153
|
+
export const declinedAsks = (dir: string, unparsed?: Unparsed): Ask[] => archivedAsks(dir, 'declined', unparsed)
|
|
154
|
+
const skip: Unparsed = () => {}
|
|
155
|
+
|
|
156
|
+
/** every ask the owner declined, by its path under the queue: marked in place or archived, its status still declined */
|
|
157
|
+
export function declinedNow(dir: string): { rel: string; ask: Ask }[] {
|
|
158
|
+
return [
|
|
159
|
+
...listAsks(dir).filter((a) => a.status === 'declined').map((ask) => ({ rel: ask.file, ask })),
|
|
160
|
+
...declinedAsks(dir, skip).filter((a) => a.status === 'declined').map((ask) => ({ rel: `declined/${ask.file}`, ask })),
|
|
161
|
+
]
|
|
84
162
|
}
|
|
85
163
|
|
|
86
164
|
/** probe every open ask and archive the ones that now pass. Under the repo's
|
|
@@ -88,19 +166,59 @@ export function doneAsks(dir: string): Ask[] {
|
|
|
88
166
|
* world), and then one of them renames a file the other already moved, which
|
|
89
167
|
* is an uncaught ENOENT rather than a message. The loser waits and finds
|
|
90
168
|
* nothing left to close, which is the correct answer. */
|
|
91
|
-
export async function checkAsks(root: string, dir: string, print: (line: string) => void = console.log): Promise<{ closed: number }> {
|
|
92
|
-
const leased = await withMutateLease(mutateLease(root, 'asks'), { label: 'asks archive', print, maxWaitMs: 45_000 }, () => checkAsksBody(root, dir, print))
|
|
169
|
+
export async function checkAsks(root: string, dir: string, print: (line: string) => void = console.log, o: CloseOpts = {}): Promise<{ closed: number }> {
|
|
170
|
+
const leased = await withMutateLease(mutateLease(root, 'asks'), { label: 'asks archive', print, maxWaitMs: 45_000 }, () => checkAsksBody(root, dir, print, o))
|
|
93
171
|
if (leased.ok) return leased.value
|
|
94
172
|
print(`WARN asks check skipped — ${leased.warn}`)
|
|
95
173
|
return { closed: 0 }
|
|
96
174
|
}
|
|
97
175
|
|
|
98
|
-
|
|
176
|
+
/** `held`: the store's read of a credential ask's names (secrets/read.ts heldHere by default), a test passes its own */
|
|
177
|
+
export type CloseOpts = { held?: HeldOf }
|
|
178
|
+
|
|
179
|
+
/** the names of a credential ask, once every value was stored on or after the day it was made: it is closed (stamped
|
|
180
|
+
* done and archived), true. A value of no known day never closes it */
|
|
181
|
+
async function closeIfIn(root: string, dir: string, a: Ask, o: CloseOpts): Promise<boolean> {
|
|
182
|
+
if (a.kind !== 'credential' || a.secrets.length === 0) return false
|
|
183
|
+
const since = afterMs(a.created)
|
|
184
|
+
if (since == null) return false
|
|
185
|
+
const held = await (o.held ?? (async (names, cwd) => (await import('../secrets/read.ts')).heldHere({ names, cwd })))(a.secrets, root).catch(() => ({}))
|
|
186
|
+
if (!allStoredSince(held, a.secrets, since)) return false
|
|
187
|
+
closeAsk(dir, a)
|
|
188
|
+
return true
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** stamp an open ask done and move it under done/ */
|
|
192
|
+
function closeAsk(dir: string, a: Ask): void {
|
|
193
|
+
const done = join(dir, 'done')
|
|
194
|
+
mkdirSync(done, { recursive: true })
|
|
195
|
+
atomicWrite(join(dir, a.file), withKeys(readFileSync(join(dir, a.file), 'utf8'), closedKeys()))
|
|
196
|
+
renameSync(join(dir, a.file), join(done, a.file))
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
async function checkAsksBody(root: string, dir: string, print: (line: string) => void, o: CloseOpts): Promise<{ closed: number }> {
|
|
99
200
|
const done = join(dir, 'done')
|
|
100
201
|
mkdirSync(done, { recursive: true })
|
|
101
202
|
let closed = 0
|
|
203
|
+
// an archived ask whose status was set back to open by hand goes back to the queue
|
|
204
|
+
for (const status of CLOSED)
|
|
205
|
+
for (const a of archivedAsks(dir, status, (rel, why) => print(`WARN ${rel} does not parse, skipped: ${why}`))) {
|
|
206
|
+
if (isClosed(a.status) || existsSync(join(dir, a.file))) continue
|
|
207
|
+
renameSync(join(dir, status, a.file), join(dir, a.file))
|
|
208
|
+
print(`reopened ${a.file} (its status is ${a.status})`)
|
|
209
|
+
}
|
|
102
210
|
for (const a of listAsks(dir)) {
|
|
103
|
-
if (a.status
|
|
211
|
+
if (isClosed(a.status)) {
|
|
212
|
+
mkdirSync(join(dir, a.status), { recursive: true })
|
|
213
|
+
renameSync(join(dir, a.file), join(dir, a.status, a.file))
|
|
214
|
+
print(`archived ${a.file} → ${a.status}/`)
|
|
215
|
+
continue
|
|
216
|
+
}
|
|
217
|
+
if (await closeIfIn(root, dir, a, o)) {
|
|
218
|
+
print(`closed + archived ${a.file} (every value is in)`)
|
|
219
|
+
closed++
|
|
220
|
+
continue
|
|
221
|
+
}
|
|
104
222
|
if (a.check == null) { print(`still ${a.status.padEnd(8)} ${a.file} (manual — no probe)`); continue }
|
|
105
223
|
if (probeAsk(root, dir, a, a.check).passed) {
|
|
106
224
|
print(`closed + archived ${a.file}`)
|
|
@@ -123,20 +241,19 @@ function probeAsk(root: string, dir: string, a: Ask, check: string): { passed: t
|
|
|
123
241
|
const tail = p.stderr.toString().trim().split('\n').at(-1) ?? ''
|
|
124
242
|
return { passed: false, why: `exit ${p.exitCode}${tail !== '' ? `: ${tail}` : ''}` }
|
|
125
243
|
}
|
|
126
|
-
|
|
127
|
-
mkdirSync(done, { recursive: true })
|
|
128
|
-
atomicWrite(join(dir, a.file), withKeys(readFileSync(join(dir, a.file), 'utf8'), closedKeys()))
|
|
129
|
-
renameSync(join(dir, a.file), join(done, a.file))
|
|
244
|
+
closeAsk(dir, a)
|
|
130
245
|
return { passed: true }
|
|
131
246
|
}
|
|
132
247
|
|
|
133
|
-
|
|
248
|
+
/** `in`: a credential ask closed because every value it names was stored after it was made */
|
|
249
|
+
export type OneCheck = { check: 'none' } | { check: 'passed' } | { check: 'in' } | { check: 'failed'; why: string }
|
|
134
250
|
|
|
135
|
-
/** `checkAsks` for one open ask: its probe alone, under the same lease */
|
|
136
|
-
export async function checkAsk(root: string, dir: string, file: string): Promise<OneCheck> {
|
|
137
|
-
const leased = await withMutateLease(mutateLease(root, 'asks'), { label: 'asks archive', print: () => {}, maxWaitMs: 45_000 }, (): OneCheck => {
|
|
251
|
+
/** `checkAsks` for one open ask: its values, then its probe alone, under the same lease */
|
|
252
|
+
export async function checkAsk(root: string, dir: string, file: string, o: CloseOpts = {}): Promise<OneCheck> {
|
|
253
|
+
const leased = await withMutateLease(mutateLease(root, 'asks'), { label: 'asks archive', print: () => {}, maxWaitMs: 45_000 }, async (): Promise<OneCheck> => {
|
|
138
254
|
const a = openAsks(dir).find((x) => x.file === file)
|
|
139
255
|
if (a == null) return { check: 'failed', why: `${file} is no longer an open ask` }
|
|
256
|
+
if (await closeIfIn(root, dir, a, o)) return { check: 'in' }
|
|
140
257
|
if (a.check == null) return { check: 'none' }
|
|
141
258
|
const r = probeAsk(root, dir, a, a.check)
|
|
142
259
|
return r.passed ? { check: 'passed' } : { check: 'failed', why: r.why }
|
|
@@ -172,7 +289,7 @@ Reply with the number.
|
|
|
172
289
|
|
|
173
290
|
// a credential ask: the human mints the value, then pastes it into the field
|
|
174
291
|
// the hub draws under the ask, or into the store command's silent prompt
|
|
175
|
-
const credentialBody = (names: string[]): string => `<!-- a credential: the steps that mint the value, then the store step as written. Values in the table, buttons in bold. -->
|
|
292
|
+
const credentialBody = (names: string[], readers: Record<string, string> = {}, logins: readonly string[] = []): string => `<!-- a credential: the steps that mint the value, then the store step as written. Values in the table, buttons in bold. -->
|
|
176
293
|
|
|
177
294
|
## 1. {{verb}} {{thing}}
|
|
178
295
|
|
|
@@ -183,9 +300,9 @@ Open **[{{page name}}]({{url, ids filled in}})**, then click **{{button}}**, and
|
|
|
183
300
|
Paste it in the field below and click **store**. Or type ${names.length > 1 ? 'these lines' : 'this line'} in Claude Code and paste it at the silent prompt:
|
|
184
301
|
|
|
185
302
|
\`\`\`
|
|
186
|
-
${names.map((n) => `! sk secret set ${n}`).join('\n')}
|
|
303
|
+
${names.map((n) => `! sk secret set ${n}${logins.includes(n) ? ' {{the account you sign in with}}' : ''}`).join('\n')}
|
|
187
304
|
\`\`\`
|
|
188
|
-
|
|
305
|
+
${names.some((n) => readers[n] != null) ? `\nWho will read it once stored:\n\n${names.map((n) => `- \`${n}\`: ${readers[n] ?? 'not known'}`).join('\n')}\n` : ''}
|
|
189
306
|
The check below then closes this ask.
|
|
190
307
|
`
|
|
191
308
|
|
|
@@ -193,32 +310,40 @@ export function createAsk(dir: string, title: string, opts?: CreateOpts): string
|
|
|
193
310
|
const secrets = opts?.secrets ?? []
|
|
194
311
|
const bad = secrets.find((s) => !SECRET_NAME.test(s))
|
|
195
312
|
if (bad != null) throw new Error(`refusing secret name '${bad}': letters, digits and . _ @ / - only, never a leading dash`)
|
|
313
|
+
const logins = opts?.logins ?? []
|
|
314
|
+
if (logins.some((l) => !secrets.includes(l))) throw new Error(`a login is one of the ask's secrets: ${logins.filter((l) => !secrets.includes(l)).join(', ')} is not`)
|
|
196
315
|
if (secrets.length > 0 && (opts?.kind ?? 'credential') !== 'credential') throw new Error(`a secret is stored by a credential ask, not a ${opts?.kind} one`)
|
|
197
316
|
opts = secrets.length > 0 ? { ...opts, kind: 'credential', check: opts?.check ?? secrets.map((s) => `sk secret get ${s} >/dev/null`).join(' && ') } : opts
|
|
317
|
+
const slug = slugify(title)
|
|
318
|
+
const why = opts?.why?.trim()
|
|
319
|
+
if (opts?.again === true && (why == null || why === '')) throw new Error('--again needs --why: what changed since the owner declined it')
|
|
320
|
+
const no = declinedLike(dir, slug, secrets)
|
|
321
|
+
if (opts?.again !== true && no != null)
|
|
322
|
+
throw new Error(`refusing: the owner declined ${no.why} in ${join(dir, no.rel)} on ${no.ask.closed ?? '?'}: an ask the owner declined stays declined. Ask again only when a fact changed after the owner's no: sk ask "${title}" --again --why "<the fact and its source>"`)
|
|
198
323
|
mkdirSync(dir, { recursive: true })
|
|
199
|
-
// max numeric prefix across
|
|
200
|
-
const
|
|
201
|
-
const archived = existsSync(done) ? readdirSync(done).filter((f) => f.endsWith('.md')) : []
|
|
324
|
+
// max numeric prefix across the live and every archived ask — numbers are never reused
|
|
325
|
+
const archived = CLOSED.flatMap((s) => (existsSync(join(dir, s)) ? readdirSync(join(dir, s)).filter((f) => f.endsWith('.md')) : []))
|
|
202
326
|
const n = Math.max(0, ...[...listAsks(dir).map((a) => a.file), ...archived].map((f) => parseInt(f, 10) || 0)) + 1
|
|
203
|
-
const slug = slugify(title)
|
|
204
327
|
const file = `${String(n).padStart(3, '0')}-${slug}.md`
|
|
205
328
|
if (existsSync(join(dir, file))) throw new Error(`refusing to overwrite existing ${file}`)
|
|
206
329
|
const check = opts?.check ?? null
|
|
207
330
|
// Why is OPTIONAL — omit the line entirely rather than ship a literal
|
|
208
331
|
// "TODO" that never gets filled (the ask itself is the record).
|
|
209
|
-
const
|
|
210
|
-
|
|
332
|
+
const after = opts?.after
|
|
333
|
+
if (after != null && afterMs(after) == null) throw new Error(`refusing after: '${after}': write ${AFTER_FORMS}`)
|
|
334
|
+
const repeats = opts?.again === true && no != null ? `asked again after the owner declined ${no.rel} on ${no.ask.closed ?? '?'}: ` : ''
|
|
335
|
+
const whyBlock = why != null && why !== '' ? `**Why**: ${repeats}${why}\n\n` : ''
|
|
211
336
|
const doneWhen = check != null ? `\`${check}\` exits 0` : 'status flipped to done'
|
|
212
337
|
writeFileSync(join(dir, file), `---
|
|
213
338
|
status: open
|
|
214
339
|
kind: ${opts?.kind ?? 'action'}
|
|
215
|
-
created: ${new Date().toISOString().slice(0, 10)}
|
|
216
|
-
blocks: ${opts?.blocks ?? '-'}${check != null ? `\ncheck: ${check}` : ''}${secrets.length > 0 ? `\nsecret: ${secrets.join(' ')}` : ''}
|
|
340
|
+
created: ${new Date().toISOString().slice(0, 10)}${after != null ? `\nafter: ${after}` : ''}
|
|
341
|
+
blocks: ${opts?.blocks ?? '-'}${check != null ? `\ncheck: ${check}` : ''}${secrets.length > 0 ? `\nsecret: ${secrets.join(' ')}` : ''}${logins.length > 0 ? `\nlogin: ${logins.join(' ')}` : ''}
|
|
217
342
|
---
|
|
218
343
|
|
|
219
344
|
# ${title}
|
|
220
345
|
|
|
221
|
-
${whyBlock}${opts?.kind === 'decision' ? DECISION_BODY : secrets.length > 0 ? credentialBody(secrets) : STEPS_BODY}
|
|
346
|
+
${whyBlock}${opts?.kind === 'decision' ? DECISION_BODY : secrets.length > 0 ? credentialBody(secrets, opts?.readers, logins) : STEPS_BODY}
|
|
222
347
|
**Answer**: _(fill in / check off, or just do it — the check probe auto-closes when it passes)_
|
|
223
348
|
|
|
224
349
|
**Done when**: ${doneWhen}
|
|
@@ -226,6 +351,30 @@ ${whyBlock}${opts?.kind === 'decision' ? DECISION_BODY : secrets.length > 0 ? cr
|
|
|
226
351
|
return file
|
|
227
352
|
}
|
|
228
353
|
|
|
354
|
+
/** the ask the owner declined that a new one repeats: the same slug, or a secret it stores; null when none. One he
|
|
355
|
+
* reopened by hand is no longer declined, wherever its file still sits */
|
|
356
|
+
function declinedLike(dir: string, slug: string, secrets: readonly string[]): { ask: Ask; rel: string; why: string } | null {
|
|
357
|
+
for (const { ask: a, rel } of declinedNow(dir)) {
|
|
358
|
+
if (a.file.replace(/^\d+-/, '').replace(/\.md$/, '') === slug) return { ask: a, rel, why: 'this ask' }
|
|
359
|
+
const name = secrets.find((s) => a.stores.includes(s))
|
|
360
|
+
if (name != null) return { ask: a, rel, why: `the ask for ${name}` }
|
|
361
|
+
}
|
|
362
|
+
return null
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/** the owner's word that he will not do an open ask: `status: declined`, the day, his reason as a line, then the
|
|
366
|
+
* declined/ archive. Undone by setting its status back to open: the next archive pass moves it up */
|
|
367
|
+
export function declineAsk(dir: string, file: string, why?: string): void {
|
|
368
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9._-]*\.md$/.test(file)) throw new Error('bad path')
|
|
369
|
+
const p = join(dir, file)
|
|
370
|
+
if (!existsSync(p) || isClosed(askOf(readFileSync(p, 'utf8'), file).status)) throw new Error(`no open ask ${file}`)
|
|
371
|
+
const reason = why?.replace(/\s+/g, ' ').trim() ?? ''
|
|
372
|
+
const md = withKeys(readFileSync(p, 'utf8'), closedKeys('declined')).trimEnd()
|
|
373
|
+
atomicWrite(p, `${md}\n\n**Declined** by the owner on ${today()}${reason !== '' ? `: ${reason}` : ''}\n`)
|
|
374
|
+
mkdirSync(join(dir, 'declined'), { recursive: true })
|
|
375
|
+
renameSync(p, join(dir, 'declined', file))
|
|
376
|
+
}
|
|
377
|
+
|
|
229
378
|
/** flip an ask to done and archive it (the hub's "done" verb) */
|
|
230
379
|
export function archiveAsk(dir: string, file: string): void {
|
|
231
380
|
const p = join(dir, file)
|
|
@@ -257,10 +406,19 @@ export function markPinged(dir: string, file: string): boolean {
|
|
|
257
406
|
return true
|
|
258
407
|
}
|
|
259
408
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
409
|
+
/** the open asks, then the later ones under `later` with their day; returns the open count, the later ones out of it */
|
|
410
|
+
export function renderAsksTable(dir: string, print: (line: string) => void = console.log, opts?: { emptyText?: string; now?: number }): number {
|
|
411
|
+
const all = openAsks(dir)
|
|
412
|
+
const now = opts?.now ?? Date.now()
|
|
413
|
+
const open = all.filter((a) => !isLater(a, now))
|
|
414
|
+
const later = all.filter((a) => isLater(a, now)).sort((a, b) => a.afterAt! - b.afterAt!)
|
|
415
|
+
const row = (a: Ask): string => `${a.status.padEnd(9)} ${a.kind.padEnd(7)} ${a.file.padEnd(44)} blocks: ${a.blocks}`
|
|
416
|
+
if (open.length === 0) print(opts?.emptyText ?? 'no open asks — all caught up 🎉')
|
|
417
|
+
for (const a of open) print(row(a))
|
|
418
|
+
if (later.length > 0) {
|
|
419
|
+
print('\nlater')
|
|
420
|
+
for (const a of later) print(`${row(a)} ${afterWords(a.after!)}`)
|
|
421
|
+
}
|
|
422
|
+
if (open.length > 0 || later.length > 0) print(`\n${open.length} open${later.length > 0 ? `, ${later.length} later` : ''} — details: ${dir}/<file>`)
|
|
265
423
|
return open.length
|
|
266
424
|
}
|
package/src/assets/kit-config.ts
CHANGED
|
@@ -36,13 +36,17 @@ export type GeminiGen = { backend: 'gemini'; model?: 'flash' | 'pro' }
|
|
|
36
36
|
export type GeneratorSpec = ComfyGen | CanvasGen | ManualGen | GeminiGen
|
|
37
37
|
export const comfy = (p?: { workflow?: string; vars?: Record<string, unknown> }): ComfyGen => ({ backend: 'comfy', workflow: p?.workflow, vars: p?.vars })
|
|
38
38
|
export const canvas = (draw: CanvasGen['draw']): CanvasGen => ({ backend: 'canvas', draw })
|
|
39
|
+
/** a picture file as a canvas kind (a png or a jpg the project already has: its app icon), fitted and centred in the
|
|
40
|
+
* target, never stretched. `image(new URL('./icon.png', import.meta.url))` resolves beside the kit file */
|
|
41
|
+
export const image = (file: URL | string): CanvasGen => fitted(file, 'image')
|
|
39
42
|
/** a hand-drawn svg file as a canvas kind: vector, fitted and centred in the target, never stretched.
|
|
40
43
|
* `svg(new URL('./icon.svg', import.meta.url))` resolves beside the kit file, never against the cwd */
|
|
41
|
-
export const svg = (file: URL | string): CanvasGen =>
|
|
44
|
+
export const svg = (file: URL | string): CanvasGen => fitted(file, 'svg')
|
|
45
|
+
function fitted(file: URL | string, what: 'svg' | 'image'): CanvasGen {
|
|
42
46
|
const path = file instanceof URL ? fileURLToPath(file) : file
|
|
43
|
-
if (!isAbsolute(path)) throw new Error(
|
|
47
|
+
if (!isAbsolute(path)) throw new Error(`${what}('${path}'): give an absolute path or new URL('./<file>', import.meta.url)`)
|
|
44
48
|
return canvas(async (ctx) => {
|
|
45
|
-
if (!existsSync(path)) throw new Error(
|
|
49
|
+
if (!existsSync(path)) throw new Error(`${what} mark: ${path} not found`)
|
|
46
50
|
const { loadImage } = await import('@napi-rs/canvas')
|
|
47
51
|
const c = ctx as SKRSContext2D
|
|
48
52
|
const img = await loadImage(path)
|