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
|
@@ -12,14 +12,16 @@
|
|
|
12
12
|
// has been denied." and nothing else, so the agent goes looking for
|
|
13
13
|
// another way in, which is the failure this whole file exists to prevent.
|
|
14
14
|
// The deny is the floor and the hook is the messenger. When the hook cannot
|
|
15
|
-
// run, enforcement degrades to terse rather than to nothing
|
|
15
|
+
// run, enforcement degrades to terse rather than to nothing, except for a
|
|
16
|
+
// scoped runner: its bare row stops only the bare call, so the flag forms of
|
|
17
|
+
// a whole suite run (`bun test --parallel=5`) pass when the hook cannot run.
|
|
16
18
|
//
|
|
17
19
|
// Subprocesses are NOT intercepted (verified): shipkit spawning bun check or
|
|
18
20
|
// `bun run test:raw` from inside a permitted `shipkit ci` is invisible to
|
|
19
21
|
// these rules, which is exactly what makes the gate itself still work.
|
|
20
22
|
|
|
21
23
|
export type RawRunner = {
|
|
22
|
-
/** the command head as an agent types it
|
|
24
|
+
/** the command head as an agent types it: the deny row is this + `*`, or this alone for a scoped runner (denyRow) */
|
|
23
25
|
head: string
|
|
24
26
|
/** the floor slot it answers, so ONE exemption governs the script name and
|
|
25
27
|
* the shell command together: a repo that keeps `test` raw is not then
|
|
@@ -34,10 +36,14 @@ export type RawRunner = {
|
|
|
34
36
|
* FILE filter (measured): bun's positional argument matches the test FILE
|
|
35
37
|
* path, and a test NAME needs `-- -t "<name>"` forwarded through bun run */
|
|
36
38
|
also?: string
|
|
39
|
+
/** a run that names a file or folder passes: only the whole suite is refused,
|
|
40
|
+
* and the deny row is the bare head, never the head and a star */
|
|
41
|
+
scoped?: true
|
|
37
42
|
}
|
|
38
43
|
|
|
39
44
|
const BYPASS = 'bypasses shipkit, so nothing is cached and no other agent\'s run can be attached to'
|
|
40
45
|
const TEST: Omit<RawRunner, 'head'> = { slot: 'test', why: BYPASS, use: 'shipkit ci --only test', also: '`bun run test:raw <test file>` to iterate on ONE suite while you fix a bug' }
|
|
46
|
+
const BUN_TEST: Omit<RawRunner, 'head'> = { slot: 'test', why: 'with no file or folder runs the whole suite outside the gate', use: 'shipkit ci --only test', also: '`bun test <file or folder>` to iterate (`bun run test:raw <file>` where `test:raw` carries flags a file needs)', scoped: true }
|
|
41
47
|
// bun check is bun's own checker: tsc's errors on every core, so it runs bare
|
|
42
48
|
// like `bun lint`. A package.json `check` script runs in its place (SK001 warns)
|
|
43
49
|
const TYPECHECK: Omit<RawRunner, 'head'> = { slot: 'typecheck', why: 'is not the house type checker', use: 'bun check', also: '`shipkit ci --only typecheck` for the gate\'s verdict, cached. Where package.json has a `check` script, `bun check --no-script`' }
|
|
@@ -46,7 +52,7 @@ const TYPECHECK: Omit<RawRunner, 'head'> = { slot: 'typecheck', why: 'is not the
|
|
|
46
52
|
// carrying. Kept tight on purpose: a deny an agent hits for no good reason
|
|
47
53
|
// teaches it to route around the whole file.
|
|
48
54
|
export const RAW_RUNNERS: readonly RawRunner[] = [
|
|
49
|
-
{ head: 'bun test', ...
|
|
55
|
+
{ head: 'bun test', ...BUN_TEST },
|
|
50
56
|
{ head: 'bunx vitest', ...TEST },
|
|
51
57
|
{ head: 'npx vitest', ...TEST },
|
|
52
58
|
{ head: 'vitest', ...TEST },
|
|
@@ -64,10 +70,59 @@ export const RAW_RUNNERS: readonly RawRunner[] = [
|
|
|
64
70
|
|
|
65
71
|
/** the `permissions.deny` entries, in the syntax Claude Code matches:
|
|
66
72
|
* `Bash(<head>*)` is a prefix match, and a compound command is checked one
|
|
67
|
-
* segment at a time, so `cd x && bun test` is caught too
|
|
73
|
+
* segment at a time, so `cd x && bun test` is caught too. A scoped runner's
|
|
74
|
+
* row is its bare head: `bun test <file>` passes, the guard refuses the rest */
|
|
75
|
+
export const denyRow = (r: RawRunner): string => (r.scoped ? `Bash(${r.head})` : `Bash(${r.head}*)`)
|
|
76
|
+
|
|
68
77
|
export const denyRules = (exemptSlots: Iterable<string> = []): string[] => {
|
|
69
78
|
const off = new Set(exemptSlots)
|
|
70
|
-
return [...RAW_RUNNERS.filter((r) => !off.has(r.slot)).map(
|
|
79
|
+
return [...RAW_RUNNERS.filter((r) => !off.has(r.slot)).map(denyRow), ...GIT_STASH_RULES]
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** the rows a scoped runner's star used to render, which also refuse its scoped runs: SK013 removes them */
|
|
83
|
+
export const LEGACY_SCOPED_RULES: readonly string[] = RAW_RUNNERS.filter((r) => r.scoped).flatMap((r) => [`Bash(${r.head}*)`, `Bash(${r.head} *)`])
|
|
84
|
+
|
|
85
|
+
/** `bun test`'s flags that take the next word as their value, so that word names no file (bun 1.4: `--bail` takes `=N`) */
|
|
86
|
+
const VALUE_FLAGS = new Set(['-t', '--test-name-pattern', '--timeout', '--rerun-each', '--retry', '--preload', '--reporter', '--reporter-outfile', '--coverage-reporter', '--coverage-dir', '--env-file', '--seed', '--max-concurrency', '--shard'])
|
|
87
|
+
|
|
88
|
+
/** a word bun reads as a filter on test file paths (`./a.test.ts`, `tests/`, `agent-time`). `.` and `./` match every file */
|
|
89
|
+
const PATH_WORD = /^(?!\.\/?$)[^-]/
|
|
90
|
+
|
|
91
|
+
/** the words after a head, a quoted run kept as one word (`-t "a name"` is a flag and ONE value) */
|
|
92
|
+
function argsAfter(seg: string, head: string[]): string[] {
|
|
93
|
+
const w = quotedWords(seg)
|
|
94
|
+
const at = w.findIndex((x, i) => (x.split('/').pop() ?? x) === head[0] && head.slice(1).every((h, j) => w[i + 1 + j] === h))
|
|
95
|
+
return at < 0 ? [] : w.slice(at + head.length)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** true when the words after a head narrow the run to a file or folder, or only ask for help */
|
|
99
|
+
function narrowsTheRun(rest: string[]): boolean {
|
|
100
|
+
for (let i = 0; i < rest.length; i++) {
|
|
101
|
+
const w = rest[i]!
|
|
102
|
+
if (w === '--help' || w === '-h') return true
|
|
103
|
+
if (/^[<>|&;]|^\d*>/.test(w)) return false
|
|
104
|
+
if (w.startsWith('-')) {
|
|
105
|
+
if (VALUE_FLAGS.has(w)) i++
|
|
106
|
+
continue
|
|
107
|
+
}
|
|
108
|
+
if (PATH_WORD.test(w)) return true
|
|
109
|
+
}
|
|
110
|
+
return false
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** a scoped run (`bun test ./a.test.ts`) in a repo whose settings still carry the old star row, which denies it with
|
|
114
|
+
* no reason: the guard says so and names the repair. Null when the row is gone or the run is not scoped */
|
|
115
|
+
export function staleScopedRefusal(settings: unknown, command: string): string | null {
|
|
116
|
+
const deny = (settings as { permissions?: { deny?: unknown } } | null)?.permissions?.deny
|
|
117
|
+
const stale = Array.isArray(deny) ? LEGACY_SCOPED_RULES.find((r) => deny.includes(r)) : undefined
|
|
118
|
+
if (stale == null) return null
|
|
119
|
+
for (const seg of shellSegments(command)) {
|
|
120
|
+
const words = programWords(seg)
|
|
121
|
+
const r = RAW_RUNNERS.find((x) => x.scoped && x.head.split(' ').every((h, i) => (i === 0 ? (words[0]?.split('/').pop() ?? '') : words[i]) === h))
|
|
122
|
+
if (r != null && narrowsTheRun(argsAfter(seg, r.head.split(' '))))
|
|
123
|
+
return `\`${seg.trim().slice(0, 80)}\` is a run of one file or folder, which is allowed, but this repo's .claude/settings.json still carries the old "${stale}" row, which denies it. Run \`sk ci --only SK013\` once: it replaces that row with "${denyRow(r)}", then run this again.`
|
|
124
|
+
}
|
|
125
|
+
return null
|
|
71
126
|
}
|
|
72
127
|
|
|
73
128
|
// `git stash` in a tree that other agents share takes every agent's
|
|
@@ -185,7 +240,7 @@ export function stashRefusal(segment: string): string {
|
|
|
185
240
|
export function refusal(r: RawRunner, segment?: string): string {
|
|
186
241
|
const alt = r.also == null ? '' : `, or ${r.also}`
|
|
187
242
|
const which = segment == null || segment.trim() === '' || segment.trim() === r.head ? '' : ` (refused on \`${segment.trim().slice(0, 80)}\`)`
|
|
188
|
-
return `\`${r.head}\`${which} ${r.why}. Use \`${r.use}\`${alt}. Lifting this for good: delete the "
|
|
243
|
+
return `\`${r.head}\`${which} ${r.why}. Use \`${r.use}\`${alt}. Lifting this for good: delete the "${denyRow(r)}" line from .claude/settings.json permissions.deny (tools/shipkit/one-way-in.md).`
|
|
189
244
|
}
|
|
190
245
|
|
|
191
246
|
/** shell wrappers that do not change what is being run */
|
|
@@ -341,7 +396,9 @@ export function rawRunnerHit(command: string, only?: ReadonlySet<string>): { run
|
|
|
341
396
|
for (const r of heads) {
|
|
342
397
|
const parts = r.head.split(' ')
|
|
343
398
|
if (parts[0] !== program) continue
|
|
344
|
-
if (parts.length
|
|
399
|
+
if (parts.length !== 1 && words[1] !== parts[1]) continue
|
|
400
|
+
if (r.scoped && narrowsTheRun(argsAfter(seg, parts))) continue
|
|
401
|
+
return { runner: r, segment: seg }
|
|
345
402
|
}
|
|
346
403
|
}
|
|
347
404
|
return null
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// a wait loop on `pgrep -f <name>`, refused by the Bash guard (hooks/one-way-in-guard.ts). Loops that wait on the
|
|
2
|
+
// same name match each other's command line and never end (macOS pgrep skips only its own ancestors). Any other wait
|
|
3
|
+
// loop stays allowed: under run_in_background or the Monitor tool it is the harness's own way to wait, and the harness
|
|
4
|
+
// hands a Monitor command to a Bash hook as a plain Bash call, so a guard cannot tell the two apart.
|
|
5
|
+
// Missed on purpose, rare in the transcripts: a flag with a value before -f (`pgrep -u me -f x`), and the check in the
|
|
6
|
+
// body (`while true; do pgrep -f x || break; …`).
|
|
7
|
+
// meta/speed-up-agents/how-to-configure-agent-for-speed.md owns the measures.
|
|
8
|
+
|
|
9
|
+
/** the command with heredoc bodies dropped and quoted text blanked, but a `$(...)` inside double quotes kept: the
|
|
10
|
+
* shell runs it (`[ -n "$(pgrep -f x)" ]`) */
|
|
11
|
+
function codeOf(command: string): string {
|
|
12
|
+
const shell = command.split(/<<-?\s*['"]?\w+/)[0] ?? command
|
|
13
|
+
return shell.replace(/"(?:\\.|[^"\\])*"/g, (q) => (q.match(/\$\([^)]*\)/g) ?? []).join(' ') || "''").replace(/'[^']*'/g, "''")
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// the keyword where a command starts, then a condition that calls pgrep with -f, up to its `do`
|
|
17
|
+
const PGREP_F_WAIT = /(?:^|[;&|(\n]|\b(?:then|do|else)\b)\s*(?:until|while)\s(?:(?![;\n]\s*do\b)[\s\S])*?\bpgrep\s+(?:-\w+\s+)*-\w*f/
|
|
18
|
+
|
|
19
|
+
/** the loop that waits on `pgrep -f`, or null */
|
|
20
|
+
export function pgrepWaitIn(command: string): string | null {
|
|
21
|
+
const m = PGREP_F_WAIT.exec(codeOf(command))
|
|
22
|
+
return m == null ? null : m[0].replace(/^[\s;&|(]+/, '')
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function pgrepWaitRefusal(loop: string): string {
|
|
26
|
+
return `\`${loop.replace(/\s+/g, ' ').slice(0, 80)}\` waits on \`pgrep -f\`: every other loop that waits on the same name carries it in its command line, so they match each other and never end. Wait on the pid instead, the one \`$!\` gave at launch: \`until ! kill -0 <pid> 2>/dev/null; do sleep 2; done\`. Never \`pgrep -x <script>\`: a script's process is named bun or node, so it finds nothing. Lifting this: remove the one-way-in-guard hook from .claude/settings.json.`
|
|
27
|
+
}
|
package/src/core/retention.ts
CHANGED
|
@@ -13,11 +13,12 @@ import { INFLIGHT_KEEP_MS, sweepSlots } from './attach.ts'
|
|
|
13
13
|
import { RUN_DIR_KEEP_MS, RUN_DIR_MAX, runEntries, sweepRunDirs } from './check-runner.ts'
|
|
14
14
|
import { gitRoot } from './git-root.ts'
|
|
15
15
|
import { JOBS, JOBS_KEEP_MS, JOBS_MAX, sweepJobs } from './jobs.ts'
|
|
16
|
-
import { CI_LOG_DIR } from './layout.ts'
|
|
16
|
+
import { CI_LOG_DIR, LAYOUT } from './layout.ts'
|
|
17
|
+
import { GONE, GONE_KEEP_MS, goneUse, sweepGone } from '../review/gone.ts'
|
|
17
18
|
import { compactDb, dbPath, shipkitRoot } from '../ledger/db.ts'
|
|
18
19
|
import { SCAN_INDEX_KEEP_MS, sweepScanIndexes } from '../ledger/git-scan.ts'
|
|
19
20
|
import { KEEP_MS as RECORD_KEEP_MS, MAX_ROWS, recordUse, sweepRuns } from '../ledger/run-log.ts'
|
|
20
|
-
import { answersDb, answersUse, importLegacyStore, KEEP_MS as ANSWERS_KEEP_MS, legacyStoreDir, MAX_ANSWERS, sweepAnswers } from '../ledger/store.ts'
|
|
21
|
+
import { answersDb, answersUse, importLegacyStore, KEEP_MS as ANSWERS_KEEP_MS, legacyStoreDir, MAX_ANSWERS, slimAnswers, sweepAnswers } from '../ledger/store.ts'
|
|
21
22
|
|
|
22
23
|
export type Cap = {
|
|
23
24
|
/** the oldest entry may be this old */
|
|
@@ -134,6 +135,8 @@ export function repoStores(root: string): Store[] {
|
|
|
134
135
|
// file, which the deletes leave full of free pages
|
|
135
136
|
sweep: (now) => {
|
|
136
137
|
sweepRuns(dbPath(root), now)
|
|
138
|
+
// a record written before the cut at write holds the key parts on every answer
|
|
139
|
+
slimAnswers(dbPath(root))
|
|
137
140
|
compactDb(dbPath(root))
|
|
138
141
|
},
|
|
139
142
|
},
|
|
@@ -167,6 +170,17 @@ export function repoStores(root: string): Store[] {
|
|
|
167
170
|
},
|
|
168
171
|
sweep: (now) => sweepJobs(root, now),
|
|
169
172
|
},
|
|
173
|
+
{
|
|
174
|
+
// the cards a store set aside (a deletion carried to the hq): 30 days, then gone, whatever the switch
|
|
175
|
+
id: 'review gone',
|
|
176
|
+
where: join(root, LAYOUT.review, GONE),
|
|
177
|
+
cap: { maxAgeMs: GONE_KEEP_MS },
|
|
178
|
+
measure: () => {
|
|
179
|
+
const u = goneUse(join(root, LAYOUT.review))
|
|
180
|
+
return counted(u.count, u.oldest)
|
|
181
|
+
},
|
|
182
|
+
sweep: (now) => void sweepGone(join(root, LAYOUT.review), now),
|
|
183
|
+
},
|
|
170
184
|
]
|
|
171
185
|
if (gitDir != null) {
|
|
172
186
|
const dir = join(gitDir, 'shipkit')
|
package/src/core/scope.ts
CHANGED
|
@@ -1,42 +1,135 @@
|
|
|
1
|
-
// who a house resource is for: some repos, some identities, or every repo.
|
|
1
|
+
// who a house resource is for: some repos, some identities, some machines, or every repo.
|
|
2
2
|
// One type and one reader, so a secret and anything scoped later answer alike.
|
|
3
|
-
// The md form, one cell: `all`, or `repo:<name
|
|
3
|
+
// The md form, one cell: `all`, or `repo:<name or key>`, `identity:<id>` and `machine:<name>` joined by commas.
|
|
4
|
+
// The vault makes its paths from these names (vault/layout.ts), so the grammar below is a boundary: no name may
|
|
5
|
+
// hold a glob, an empty part, a `.` or `..` part, or a capital
|
|
4
6
|
|
|
5
7
|
/** absent or empty = every repo */
|
|
6
8
|
export type Scope = {
|
|
7
|
-
/** repo
|
|
9
|
+
/** a repo as `repo.config.ts` or its folder names it, or by its key: its first remote as host and path
|
|
10
|
+
* (`repoKeyOf`), the name the hq grants it by. The vault files a repo by its key only */
|
|
8
11
|
repos?: string[]
|
|
9
12
|
/** identity ids, as `speaksAs` names them */
|
|
10
13
|
identities?: string[]
|
|
14
|
+
/** machine names, lowercase, as the hq names them: for what only those machines use (an ssh key) */
|
|
15
|
+
machines?: string[]
|
|
11
16
|
}
|
|
12
17
|
|
|
13
|
-
/** the repo asking: every name it answers to (its config name, its folder),
|
|
14
|
-
|
|
18
|
+
/** the repo asking: every name it answers to (its config name, its folder), its key, the identity it speaks as,
|
|
19
|
+
* and the machine it runs on. A key or a machine left out opens no row scoped by one */
|
|
20
|
+
export type Asker = { repos: string[]; identity: string | null; key?: string | null; machine?: string | null }
|
|
21
|
+
|
|
22
|
+
/** one part of a name: starts with a letter or a digit, so never `.`, `..` or empty, and holds no glob */
|
|
23
|
+
export const NAME_PART = /^[a-z0-9][a-z0-9._-]*$/
|
|
24
|
+
|
|
25
|
+
/** a repo's key: two parts or more, joined by `/` */
|
|
26
|
+
export const isRepoKey = (repo: string): boolean => repo.includes('/')
|
|
27
|
+
|
|
28
|
+
/** a scope's name as the grammar wants it for its kind */
|
|
29
|
+
export function nameProblem(kind: 'repo' | 'identity' | 'machine', name: string): string | null {
|
|
30
|
+
const parts = kind === 'repo' ? name.split('/') : [name]
|
|
31
|
+
return parts.every((p) => NAME_PART.test(p)) ? null : `${kind}:${name} is no ${kind === 'repo' ? 'repo name or key (host/path)' : `${kind} name`}: each part is lowercase letters, digits, . _ or -, and starts with a letter or a digit`
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** the id a repo's config gives it, null with none. Throws on an id the grammar refuses: a config that names a bad
|
|
35
|
+
* id is fixed, never read as if it named none */
|
|
36
|
+
export function repoIdOf(config: { id?: string } | null | undefined): string | null {
|
|
37
|
+
const id = config?.id
|
|
38
|
+
if (id == null) return null
|
|
39
|
+
if (!NAME_PART.test(id)) throw new Error(`repo.config.ts id ${JSON.stringify(id)}: an id is lowercase letters, digits, . _ or -, and starts with a letter or a digit`)
|
|
40
|
+
return id
|
|
41
|
+
}
|
|
15
42
|
|
|
16
43
|
const listed = (xs: string[] | undefined): boolean => (xs ?? []).length > 0
|
|
17
44
|
|
|
18
|
-
export const scopesAll = (s: Scope | undefined): boolean => s == null || (!listed(s.repos) && !listed(s.identities))
|
|
45
|
+
export const scopesAll = (s: Scope | undefined): boolean => s == null || (!listed(s.repos) && !listed(s.identities) && !listed(s.machines))
|
|
19
46
|
|
|
20
|
-
/** in scope when the scope is for all, names the repo
|
|
47
|
+
/** in scope when the scope is for all, names the repo (a key matches its key only), its identity, or its machine */
|
|
21
48
|
export function inScope(s: Scope | undefined, a: Asker): boolean {
|
|
22
49
|
if (scopesAll(s)) return true
|
|
23
|
-
|
|
50
|
+
const repo = (r: string): boolean => (isRepoKey(r) ? a.key != null && a.key === r : a.repos.includes(r))
|
|
51
|
+
return (s!.repos ?? []).some(repo) || (a.identity != null && (s!.identities ?? []).includes(a.identity)) || (a.machine != null && (s!.machines ?? []).includes(a.machine))
|
|
24
52
|
}
|
|
25
53
|
|
|
26
|
-
|
|
54
|
+
const KEYS = { repo: 'repos', identity: 'identities', machine: 'machines' } as const
|
|
55
|
+
|
|
56
|
+
/** the md cell as a scope; throws on a token that is neither `all`, `repo:`, `identity:` nor `machine:` */
|
|
27
57
|
export function parseScope(cell: string): Scope {
|
|
28
58
|
const text = cell.replaceAll('`', '').trim()
|
|
29
59
|
if (text === '' || text === 'all') return {}
|
|
30
60
|
const s: Scope = {}
|
|
31
61
|
for (const raw of text.split(',')) {
|
|
32
62
|
const t = raw.trim()
|
|
33
|
-
const m = /^(repo|identity):(
|
|
34
|
-
if (m == null) throw new Error(`scope "${cell}": "${t}" is not repo:<name
|
|
35
|
-
const
|
|
36
|
-
|
|
63
|
+
const m = /^(repo|identity|machine):(.*)$/.exec(t)
|
|
64
|
+
if (m == null) throw new Error(`scope "${cell}": "${t}" is not repo:<name>, repo:<key>, identity:<id> or machine:<name> (or all)`)
|
|
65
|
+
const kind = m[1] as keyof typeof KEYS
|
|
66
|
+
const problem = nameProblem(kind, m[2]!)
|
|
67
|
+
if (problem != null) throw new Error(`scope "${cell}": ${problem}`)
|
|
68
|
+
;(s[KEYS[kind]] ??= []).push(m[2]!)
|
|
37
69
|
}
|
|
38
70
|
return s
|
|
39
71
|
}
|
|
40
72
|
|
|
41
73
|
export const scopeText = (s: Scope | undefined): string =>
|
|
42
|
-
scopesAll(s)
|
|
74
|
+
scopesAll(s)
|
|
75
|
+
? 'all'
|
|
76
|
+
: [...(s!.repos ?? []).map((r) => `repo:${r}`), ...(s!.identities ?? []).map((i) => `identity:${i}`), ...(s!.machines ?? []).map((m) => `machine:${m}`)].join(', ')
|
|
77
|
+
|
|
78
|
+
/** the house as a scope's words name it: each repo, its key when known, and the identity it speaks as; each
|
|
79
|
+
* identity's display name */
|
|
80
|
+
export type ScopeHouse = { repos: { name: string; key?: string | null; speaksAs: string | null }[]; identities: { id: string; name: string }[] }
|
|
81
|
+
|
|
82
|
+
/** who a scope lets read, in plain words: the repos with the identity each speaks as, the repos of an identity, the
|
|
83
|
+
* machines. The one wording of a scope for a reader; `scopeText` stays the md cell */
|
|
84
|
+
export function scopeWords(s: Scope | undefined, house: ScopeHouse): string {
|
|
85
|
+
if (scopesAll(s)) return 'every repo, every identity, every machine'
|
|
86
|
+
const idName = (id: string): string => house.identities.find((i) => i.id === id)?.name ?? `${id} (no such identity)`
|
|
87
|
+
const repoOf = (r: string) => house.repos.find((h) => (isRepoKey(r) ? h.key === r : h.name === r))
|
|
88
|
+
const repoWords = (r: string): string => {
|
|
89
|
+
const h = repoOf(r)
|
|
90
|
+
if (h == null) return `${r} (no repo of that name on this machine)`
|
|
91
|
+
return h.speaksAs == null ? `${h.name} (speaks as no identity)` : `${h.name} (speaks as ${idName(h.speaksAs)})`
|
|
92
|
+
}
|
|
93
|
+
const repos = s!.repos ?? []
|
|
94
|
+
const ids = s!.identities ?? []
|
|
95
|
+
const machines = s!.machines ?? []
|
|
96
|
+
const parts: string[] = []
|
|
97
|
+
if (repos.length > 0) {
|
|
98
|
+
const alone = ids.length === 0 && machines.length === 0
|
|
99
|
+
if (alone && repos.length === 1) parts.push(repoWords(repos[0]!).replace(/ \(/, ' only ('))
|
|
100
|
+
else parts.push(`${repos.map(repoWords).join(' and ')}${alone ? ' only' : ''}`)
|
|
101
|
+
}
|
|
102
|
+
for (const id of ids) {
|
|
103
|
+
const speak = house.repos.filter((h) => h.speaksAs === id).map((h) => h.name).sort()
|
|
104
|
+
parts.push(`the repos that speak as ${idName(id)}: ${speak.length > 0 ? speak.join(', ') : 'none on this machine'}`)
|
|
105
|
+
}
|
|
106
|
+
if (machines.length > 0) parts.push(`the repos on the machine${machines.length > 1 ? 's' : ''} ${machines.join(', ')}`)
|
|
107
|
+
return parts.join('; ')
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** one reader of a scope as a chip: `known` false for a repo this machine does not have (its label ends in `?`) */
|
|
111
|
+
export type ScopeChip = { label: string; kind: 'all' | 'repo' | 'identity' | 'machine' | 'more'; known: boolean }
|
|
112
|
+
|
|
113
|
+
/** the readers in order (repos, identities, machines), each in its short form, three at most: past three, the first
|
|
114
|
+
* two and `+n` */
|
|
115
|
+
function readers(s: Scope | undefined, house: ScopeHouse, idForm: (id: string, n: number) => string): ScopeChip[] {
|
|
116
|
+
if (scopesAll(s)) return [{ label: 'every repo', kind: 'all', known: true }]
|
|
117
|
+
const repoOf = (r: string) => house.repos.find((h) => (isRepoKey(r) ? h.key === r : h.name === r))
|
|
118
|
+
const all: ScopeChip[] = [
|
|
119
|
+
...(s!.repos ?? []).map((r): ScopeChip => {
|
|
120
|
+
const h = repoOf(r)
|
|
121
|
+
return h == null ? { label: `${r}?`, kind: 'repo', known: false } : { label: h.name, kind: 'repo', known: true }
|
|
122
|
+
}),
|
|
123
|
+
...(s!.identities ?? []).map((id): ScopeChip => ({ label: idForm(id, house.repos.filter((h) => h.speaksAs === id).length), kind: 'identity', known: true })),
|
|
124
|
+
...(s!.machines ?? []).map((m): ScopeChip => ({ label: `on ${m}`, kind: 'machine', known: true })),
|
|
125
|
+
]
|
|
126
|
+
return all.length <= 3 ? all : [...all.slice(0, 2), { label: `+${all.length - 2}`, kind: 'more', known: true }]
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** the chips the hub draws for a scope; `scopeWords` is their title */
|
|
130
|
+
export const scopeChips = (s: Scope | undefined, house: ScopeHouse): ScopeChip[] =>
|
|
131
|
+
readers(s, house, (id, n) => `${house.identities.find((i) => i.id === id)?.name ?? id} · ${n}`)
|
|
132
|
+
|
|
133
|
+
/** the console's cell for a scope: `shop`, `@studio (2 repos)`, `all`, `gone?, shop`, `shop, game, +3` */
|
|
134
|
+
export const scopeShort = (s: Scope | undefined, house: ScopeHouse): string =>
|
|
135
|
+
scopesAll(s) ? 'all' : readers(s, house, (id, n) => `@${id} (${n} repo${n === 1 ? '' : 's'})`).map((c) => c.label).join(', ')
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// a signal as a process reports it: bun gives its name or its number
|
|
2
|
+
import { constants } from 'os'
|
|
3
|
+
|
|
4
|
+
/** the signal's name; null when the process ended by itself */
|
|
5
|
+
export const signalName = (signal: string | number | null | undefined): string | null =>
|
|
6
|
+
signal == null ? null : typeof signal === 'string' ? signal : (Object.entries(constants.signals).find(([, n]) => n === signal)?.[0] ?? `SIG${signal}`)
|
package/src/core/slots.ts
CHANGED
|
@@ -24,8 +24,8 @@ import { mkdirSync, readdirSync } from 'fs'
|
|
|
24
24
|
import { homedir } from 'os'
|
|
25
25
|
import { join } from 'path'
|
|
26
26
|
import { leaseHolder, tryLease } from './locked-write.ts'
|
|
27
|
-
import {
|
|
28
|
-
import
|
|
27
|
+
import { machineWords, type MachineLoad } from './machine-busy.ts'
|
|
28
|
+
import { machineLoad } from './machine-read.ts'
|
|
29
29
|
import { PARALLEL_ENV, parallelCap, parallelCapInfo } from './parallel.ts'
|
|
30
30
|
|
|
31
31
|
/** where the slots live, for a test that must not touch the machine's pool */
|
|
@@ -92,12 +92,13 @@ export function machinePool(): SlotPool | null {
|
|
|
92
92
|
|
|
93
93
|
/** how many of `size` slots a machine at this load admits: all of them up to
|
|
94
94
|
* a load of one per core, then size × cores / load, never below half. At 12
|
|
95
|
-
* on 8 cores a pool of 8 admits 5, from 16 it admits 4
|
|
95
|
+
* on 8 cores a pool of 8 admits 5, from 16 it admits 4. The run queue, not the
|
|
96
|
+
* cores in use: a long queue slows CPU work with idle cores (judge-suites.ts loadShare) */
|
|
96
97
|
export const admittedSlots = (size: number, m: MachineLoad): number =>
|
|
97
98
|
Math.max(Math.ceil(size / 2), Math.min(size, Math.floor((size * m.cores) / Math.max(m.cores, m.load1))))
|
|
98
99
|
|
|
99
100
|
const admitWords = (size: number, admitted: number, m: MachineLoad): string =>
|
|
100
|
-
`the pool admits ${admitted} of its ${size} slots at
|
|
101
|
+
`the pool admits ${admitted} of its ${size} slots at ${machineWords(m)}`
|
|
101
102
|
|
|
102
103
|
/** who holds which slot right now, dead holders left out. Every slot file in
|
|
103
104
|
* the dir is read, so a slot taken under a larger size still shows. */
|
package/src/core/trace-audit.ts
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
// git common dir and reused while it is young: rule SK031 in
|
|
16
16
|
// the health pass pays for it, and the fix pass that applies it reads it.
|
|
17
17
|
import { mkdirSync, writeFileSync } from 'fs'
|
|
18
|
+
import { isTransient } from './transient.ts'
|
|
18
19
|
import { dirname, isAbsolute, posix, relative, resolve, sep } from 'path'
|
|
19
20
|
import type { RepoConfig } from '../repo-config.ts'
|
|
20
21
|
import { composeChecks } from '../ledger/gate-checks.ts'
|
|
@@ -94,7 +95,11 @@ function inTree(p: string, declared: string[], extras: string[]): boolean {
|
|
|
94
95
|
* An entry `leaks` refuses (the commit leak guard, which reads the config
|
|
95
96
|
* the fix pass writes) becomes its nearest parent it lets through, in the
|
|
96
97
|
* same form; one with no such parent below the root is left out */
|
|
97
|
-
export function proposeInputs(
|
|
98
|
+
export function proposeInputs(contentRead: string[], listedRead: string[], leaks: (entry: string) => boolean = () => false): string[] {
|
|
99
|
+
// a write in flight is no input: a build's `.dist.tmp-<pid>` names one run, and a line that pins it is stale at once
|
|
100
|
+
const kept = (p: string): boolean => !p.split('/').some(isTransient)
|
|
101
|
+
const content = contentRead.filter(kept)
|
|
102
|
+
const listed = listedRead.filter(kept)
|
|
98
103
|
const minimal = (xs: string[]): string[] => {
|
|
99
104
|
const sorted = [...new Set(xs)].sort()
|
|
100
105
|
return sorted.filter((x) => !sorted.some((y) => y !== x && under(x, y)))
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// a write in flight: an atomic write's temp file or folder (`x.tmp`, `x.tmp.<pid>.<hex>`, `.dist.tmp-<pid>`,
|
|
2
|
+
// `.STATUS.md.tmp-<n>`) or an editor's partial copy (`.!<pid>!x`). Its name is true for one run only, so nothing
|
|
3
|
+
// keeps it: no watch hears it, no key names it.
|
|
4
|
+
|
|
5
|
+
/** true for the name of a path segment that is a write in flight */
|
|
6
|
+
export const isTransient = (name: string): boolean => /\.tmp(?:$|[-.])|^\.!\d+!/.test(name)
|
package/src/drill/clean.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// a drill run folder leaves for the trash, never for rm: the folder is checked to BE a drill copy first
|
|
2
2
|
// (a git repo of its own with no remote, and either the sealed copy's record in .git (drill/seal.ts) or one
|
|
3
3
|
// commit named « drill base »), so a wrong path is refused, and a moved folder can be put back. a move across disks fails loud, it never falls back to a delete.
|
|
4
|
-
|
|
4
|
+
// the one thing removed is each node_modules folder of the checked copy: an install, the bulk of its bytes, no work.
|
|
5
|
+
import { existsSync, lstatSync, mkdirSync, readdirSync, realpathSync, renameSync, rmSync } from 'fs'
|
|
5
6
|
import { homedir } from 'os'
|
|
6
7
|
import { basename, dirname, join, resolve } from 'path'
|
|
7
8
|
import { gitBin } from '../core/git-bin.ts'
|
|
@@ -58,8 +59,31 @@ export function cleanDrillCopy(dir: string, opts: { trash?: string; dry?: boolea
|
|
|
58
59
|
let to = join(trash, `${basename(abs)}-${stamp}`)
|
|
59
60
|
for (let i = 2; existsSync(to); i++) to = join(trash, `${basename(abs)}-${stamp}-${i}`)
|
|
60
61
|
if (opts.dry !== true) {
|
|
62
|
+
dropInstalls(abs)
|
|
61
63
|
mkdirSync(trash, { recursive: true })
|
|
62
64
|
renameSync(abs, to)
|
|
63
65
|
}
|
|
64
66
|
return { dir: abs, to }
|
|
65
67
|
}
|
|
68
|
+
|
|
69
|
+
/** the installed packages of a checked drill copy, removed before it moves: a sealed copy installs in the root
|
|
70
|
+
* and in each package (seven folders and about 730 MB of a 940 MB copy, measured), a drill makes eight copies or
|
|
71
|
+
* more, and nothing in the trash goes by itself. An install holds no work: the lockfile makes it again */
|
|
72
|
+
function dropInstalls(dir: string): void {
|
|
73
|
+
const look = (at: string, depth: number): void => {
|
|
74
|
+
let names: string[]
|
|
75
|
+
try {
|
|
76
|
+
names = readdirSync(at)
|
|
77
|
+
} catch {
|
|
78
|
+
return
|
|
79
|
+
}
|
|
80
|
+
for (const n of names) {
|
|
81
|
+
const p = join(at, n)
|
|
82
|
+
const st = lstatSync(p, { throwIfNoEntry: false })
|
|
83
|
+
if (st == null || st.isSymbolicLink() || !st.isDirectory() || n === '.git') continue
|
|
84
|
+
if (n === 'node_modules') rmSync(p, { recursive: true, force: true })
|
|
85
|
+
else if (depth < 3) look(p, depth + 1)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
look(dir, 0)
|
|
89
|
+
}
|
package/src/drill/run.ts
CHANGED
|
@@ -205,14 +205,14 @@ export function drillRun(lines: readonly string[], o: { transcript: string; root
|
|
|
205
205
|
for (const e of eventsOf(entry)) {
|
|
206
206
|
if (e.kind === 'use') {
|
|
207
207
|
const shape = toolShape(e.name, e.detail)
|
|
208
|
-
pending.set(e.id, { id: e.id, start: e.at, end: null, tool: e.name, shape, cmd: e.detail, outcome: null, code: null, approval: false, perm: '', read: isReadOnly({ tool: e.name, shape, cmd: e.detail }), bg: false, bgEnd: null })
|
|
208
|
+
pending.set(e.id, { id: e.id, start: e.at, end: null, tool: e.name, shape, cmd: e.detail, outcome: null, code: null, approval: false, perm: '', read: isReadOnly({ tool: e.name, shape, cmd: e.detail }), bg: false, bgEnd: null, limited: false, model: e.model ?? '', ctx: e.ctx ?? 0, out: e.out ?? 0 })
|
|
209
209
|
} else if (e.kind === 'result') {
|
|
210
210
|
const c = pending.get(e.id)
|
|
211
211
|
if (c != null) Object.assign(c, { end: e.at, outcome: e.outcome, code: e.code, approval: e.perm === 'user', perm: e.perm, bg: e.bg })
|
|
212
212
|
} else if (e.kind === 'bgend') {
|
|
213
213
|
const c = pending.get(e.id)
|
|
214
214
|
if (c != null && (c.bgEnd == null || e.at < c.bgEnd)) c.bgEnd = e.at
|
|
215
|
-
} else if (e.kind !== 'prompt') marks.push({ at: e.at, kind: e.kind })
|
|
215
|
+
} else if (e.kind !== 'prompt' && e.kind !== 'hook') marks.push({ at: e.at, kind: e.kind })
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
218
|
const start = Number.isFinite(first) ? first : 0
|
package/src/drill/seal.ts
CHANGED
|
@@ -119,7 +119,19 @@ export type SealOptions = {
|
|
|
119
119
|
|
|
120
120
|
export type Sealed = { dir: string; meta: SealMeta; notes: string[] }
|
|
121
121
|
|
|
122
|
+
/** the sealed copy, or nothing: a seal that fails (an install the base cannot make, a path that is gone) removes
|
|
123
|
+
* the folders it made, since no record marks a half built copy as a drill copy and `sk drill clean` then refuses it */
|
|
122
124
|
export function seal(o: SealOptions): Sealed {
|
|
125
|
+
const made: string[] = []
|
|
126
|
+
try {
|
|
127
|
+
return build(o, made)
|
|
128
|
+
} catch (e) {
|
|
129
|
+
for (const d of made) rmSync(d, { recursive: true, force: true })
|
|
130
|
+
throw e
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function build(o: SealOptions, made: string[]): Sealed {
|
|
123
135
|
const home = o.home ?? homedir()
|
|
124
136
|
const repo = realpathSync(o.repo)
|
|
125
137
|
const notes: string[] = []
|
|
@@ -129,6 +141,7 @@ export function seal(o: SealOptions): Sealed {
|
|
|
129
141
|
const own = house != null && house === repo
|
|
130
142
|
const setupPaths = own ? [...SETUP_PATHS, 'wiki'] : SETUP_PATHS
|
|
131
143
|
const dir = realpathSync(mkdtempSync(join(o.tmp ?? tmpdir(), `${basename(repo)}-`)))
|
|
144
|
+
made.push(dir)
|
|
132
145
|
unpack(repo, base, dir)
|
|
133
146
|
if (setup !== base) {
|
|
134
147
|
const present = setupPaths.filter((p) => gitOk(repo, ['cat-file', '-e', `${setup}:${p}`]))
|
|
@@ -157,6 +170,7 @@ export function seal(o: SealOptions): Sealed {
|
|
|
157
170
|
} else if (house != null && o.wiki != null) {
|
|
158
171
|
const sha = git(house, ['rev-parse', '--verify', `${o.wiki}^{commit}`])
|
|
159
172
|
const w = realpathSync(mkdtempSync(join(o.tmp ?? tmpdir(), 'w-')))
|
|
173
|
+
made.push(w)
|
|
160
174
|
unpack(house, sha, w, ['wiki'])
|
|
161
175
|
rewrite([...mdFiles(dir), ...mdFiles(w)], join(house, 'wiki'), join(w, 'wiki'))
|
|
162
176
|
wikiDirs.push(w)
|
|
@@ -215,10 +229,19 @@ export function seal(o: SealOptions): Sealed {
|
|
|
215
229
|
})
|
|
216
230
|
|
|
217
231
|
if (o.install) {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
232
|
+
// every folder with a lockfile of its own, the root first: a package that is no workspace member installs
|
|
233
|
+
// alone, and without it the copy cannot run that package's code or tests
|
|
234
|
+
const locks = git(dir, ['ls-files', '--', 'bun.lock', 'bun.lockb', '**/bun.lock', '**/bun.lockb']).split('\n').filter((l) => l !== '')
|
|
235
|
+
const folders = [...new Set(locks.map((l) => dirname(l)))].sort((x, y) => x.split('/').length - y.split('/').length || x.localeCompare(y))
|
|
236
|
+
for (const folder of folders) {
|
|
237
|
+
const r = run(['bun', 'install', '--frozen-lockfile'], { cwd: join(dir, folder) })
|
|
238
|
+
if (r.code === 0) continue
|
|
239
|
+
const why = r.err.split('\n').slice(-5).join(' ')
|
|
240
|
+
// the root must install; a package whose own lockfile is stale at the base costs only that package
|
|
241
|
+
if (folder === '.') throw new Error(`bun install --frozen-lockfile in the copy: ${why}`)
|
|
242
|
+
notes.push(`🔶 ${folder}: deps not installed (${why.slice(0, 200)})`)
|
|
243
|
+
}
|
|
244
|
+
if (folders.length === 0 && existsSync(join(dir, 'package.json'))) notes.push('🔶 no bun lockfile at the base: deps not installed')
|
|
222
245
|
}
|
|
223
246
|
utimesSync(dir, stamp, stamp)
|
|
224
247
|
|
|
@@ -62,6 +62,8 @@ export type StatusCheck = {
|
|
|
62
62
|
/** its title as the repo declares it, else its id */
|
|
63
63
|
title: string
|
|
64
64
|
status: 'fail' | 'warn'
|
|
65
|
+
/** a warning no agent can clear: an ask holds it, so it waits on the owner */
|
|
66
|
+
held?: true
|
|
65
67
|
/** when that outcome was recorded, epoch ms */
|
|
66
68
|
at: number | null
|
|
67
69
|
/** the worst line it printed about the problem, '' when it printed none */
|