rvlib-shipkit 2.27.0 → 2.29.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 +71 -0
- package/package.json +10 -2
- package/src/advisors/acts.ts +277 -0
- package/src/advisors/advice.ts +384 -0
- package/src/advisors/advisor-view.ts +417 -0
- package/src/advisors/app-graph.ts +112 -0
- package/src/advisors/app.ts +75 -0
- package/src/advisors/door.ts +59 -0
- package/src/advisors/edge/api.ts +292 -0
- package/src/advisors/edge/bucket.ts +43 -0
- package/src/advisors/edge/certs.ts +20 -0
- package/src/advisors/edge/form.ts +45 -0
- package/src/advisors/edge/handler.ts +156 -0
- package/src/advisors/edge/jwt.ts +76 -0
- package/src/advisors/edge/shell.ts +27 -0
- package/src/advisors/edge/status.ts +12 -0
- package/src/advisors/edge/types.ts +137 -0
- package/src/advisors/edge/worker.ts +52 -0
- package/src/advisors/expose.ts +150 -0
- package/src/advisors/job.ts +35 -0
- package/src/advisors/owner-store.ts +226 -0
- package/src/advisors/photos.ts +182 -0
- package/src/advisors/project.ts +311 -0
- package/src/advisors/r2.ts +48 -0
- package/src/advisors/routes.ts +469 -0
- package/src/advisors/scan.ts +194 -0
- package/src/advisors/sync.ts +363 -0
- package/src/agent-time/accounts-usage-disk.ts +29 -0
- package/src/agent-time/accounts-usage.ts +97 -0
- package/src/agent-time/hooks.ts +73 -29
- package/src/agent-time/lane-name.ts +7 -0
- package/src/agent-time/leads.ts +95 -0
- package/src/agent-time/live.ts +11 -5
- package/src/agent-time/registry.ts +354 -0
- package/src/agent-time/render.ts +35 -4
- package/src/agent-time/report-cache.ts +4 -8
- package/src/agent-time/report.ts +19 -1
- package/src/agent-time/store.ts +10 -16
- package/src/annex/born.ts +2 -2
- package/src/annex/offload.ts +12 -11
- package/src/annex/snapshots.ts +3 -3
- package/src/annex/tidy.ts +10 -23
- package/src/asks/ask-after.ts +8 -3
- package/src/asks/ask-bar-fold.ts +57 -0
- package/src/asks/ask-carry.ts +190 -0
- package/src/asks/ask-close.ts +72 -0
- package/src/asks/ask-doc.ts +42 -0
- package/src/asks/ask-migrate.ts +280 -0
- package/src/asks/ask-steps-fold.ts +123 -0
- package/src/asks/ask-store.ts +703 -0
- package/src/asks/ask-words-fold.ts +208 -0
- package/src/assets/kits/identity-kit.ts +106 -38
- package/src/assets/kits/poster-thumbnail.ts +282 -0
- package/src/checks/SK001-package-json-shape.check.ts +5 -7
- package/src/checks/SK003-claude-md-shape.check.ts +92 -25
- package/src/checks/SK004-gitignore-policy.check.ts +21 -17
- package/src/checks/SK010-undeclared-unit.check.ts +77 -64
- package/src/checks/SK013-one-way-in-policy.check.ts +27 -5
- package/src/checks/SK026-asks-autoclose.check.ts +9 -23
- package/src/checks/SK027-agent-wiki-links.check.ts +46 -6
- package/src/checks/SK033-global-contribution.check.ts +1 -1
- package/src/checks/SK036-draft-media-size.check.ts +5 -4
- package/src/checks/SK038-speaks-as.check.ts +3 -3
- package/src/checks/SK039-vscode-watch-generated.check.ts +1 -1
- package/src/checks/SK040-release-words.check.ts +39 -10
- package/src/checks/SK042-post-kinds.check.ts +26 -24
- package/src/checks/SK045-slow-hooks.check.ts +5 -2
- package/src/checks/SK049-thread-answers-hook.check.ts +83 -0
- package/src/checks/SK050-retired-commands.check.ts +127 -0
- package/src/checks/SK051-no-formatter.check.ts +485 -0
- package/src/cli/cmd_Advisors.ts +336 -0
- package/src/cli/cmd_Annex.ts +10 -10
- package/src/cli/cmd_Asks.ts +303 -51
- package/src/cli/cmd_Backup.ts +157 -14
- package/src/cli/cmd_CacheAudit.ts +1 -1
- package/src/cli/cmd_Calls.ts +1 -0
- package/src/cli/cmd_Check.ts +3 -3
- package/src/cli/cmd_Checks.ts +1 -1
- package/src/cli/cmd_Ci.ts +15 -16
- package/src/cli/cmd_Commands.ts +140 -34
- package/src/cli/cmd_Contracts.ts +1 -0
- package/src/cli/cmd_Db.ts +9 -9
- package/src/cli/cmd_FleetPush.ts +1 -1
- package/src/cli/cmd_History.ts +2 -2
- package/src/cli/cmd_Home.ts +5 -6
- package/src/cli/cmd_Hooks.ts +13 -3
- package/src/cli/cmd_Hq.ts +30 -19
- package/src/cli/cmd_Keys.ts +2 -1
- package/src/cli/cmd_Lanes.ts +21 -4
- package/src/cli/cmd_Media.ts +59 -13
- package/src/cli/cmd_Messages.ts +152 -1
- package/src/cli/cmd_Needs.ts +1 -0
- package/src/cli/cmd_Orchestrator.ts +138 -0
- package/src/cli/cmd_Rec.ts +5 -2
- package/src/cli/cmd_Reflect.ts +17 -3
- package/src/cli/cmd_Releases.ts +38 -38
- package/src/cli/cmd_Review.ts +1500 -424
- package/src/cli/cmd_Secret.ts +255 -34
- package/src/cli/cmd_Shot.ts +14 -6
- package/src/cli/cmd_Social.ts +41 -37
- package/src/cli/cmd_SocialDrafts.ts +248 -0
- package/src/cli/cmd_Sound.ts +22 -1
- package/src/cli/cmd_Space.ts +1 -1
- package/src/cli/cmd_Start.ts +3 -2
- package/src/cli/cmd_ThreadHolds.ts +34 -0
- package/src/cli/cmd_ThreadKinds.ts +153 -0
- package/src/cli/cmd_ThreadReflect.ts +91 -0
- package/src/cli/cmd_ThreadSyncNeeds.ts +62 -0
- package/src/cli/cmd_Time.ts +2 -1
- package/src/cli/cmd_Tmp.ts +9 -8
- package/src/cli/cmd_TraceAudit.ts +1 -1
- package/src/cli/cmd_Trailer.ts +5 -5
- package/src/cli/cmd_Urls.ts +3 -3
- package/src/cli/cmd_Vault.ts +5 -5
- package/src/cli/cmd_When.ts +2 -1
- package/src/cli/cmd_Worktrees.ts +109 -0
- package/src/cli/family-help.ts +2 -2
- package/src/cli/family-pages.ts +1 -1
- package/src/cli/kit/builtins.ts +1 -0
- package/src/cli/kit/verb.ts +6 -2
- package/src/cli/registry.ts +35 -5
- package/src/cli.ts +26 -15
- package/src/collections/actions.ts +27 -75
- package/src/collections/checks.ts +1 -1
- package/src/collections/collection-types.ts +23 -8
- package/src/collections/md-body.ts +5 -3
- package/src/collections/pings.ts +16 -6
- package/src/collections/providers.ts +63 -71
- package/src/collections/reflections.ts +9 -4
- package/src/collections/review.ts +25 -23
- package/src/collections/state-rules.ts +8 -7
- package/src/comfy/comfy-panel.ts +2 -2
- package/src/commands/model.ts +1 -1
- package/src/commands/routes.ts +1 -1
- package/src/commands/runs.ts +1 -1
- package/src/core/app-icon.ts +3 -9
- package/src/core/atomic-write.ts +36 -0
- package/src/core/budget.ts +16 -1
- package/src/core/bun-builtins.ts +7 -7
- package/src/core/canonical-scripts.ts +4 -6
- package/src/core/check-ctx.ts +17 -3
- package/src/core/day-stamp.ts +20 -0
- package/src/core/git-bin.ts +10 -0
- package/src/core/git.ts +75 -0
- package/src/core/hard-reset.ts +1 -2
- package/src/core/history-files.ts +4 -8
- package/src/core/house-layout.ts +20 -0
- package/src/core/hub-theme.ts +16 -0
- package/src/core/identity.ts +1 -1
- package/src/core/in-base.ts +19 -0
- package/src/core/instance.ts +15 -5
- package/src/core/last-good.ts +42 -133
- package/src/core/layout.ts +11 -6
- package/src/core/load-probe.ts +4 -8
- package/src/core/locked-write.ts +116 -43
- package/src/core/loop-watch.ts +24 -3
- package/src/core/machine-db.ts +58 -14
- package/src/core/machine-link.ts +1 -1
- package/src/core/memory-watch.ts +3 -2
- package/src/core/migrate-layout.ts +8 -10
- package/src/core/motherhome.ts +2 -1
- package/src/core/nearest.ts +23 -0
- package/src/core/on-loop.ts +57 -0
- package/src/core/one-way-in-policy.ts +26 -13
- package/src/core/raw-access.ts +9 -2
- package/src/core/reexec.ts +3 -5
- package/src/core/repo-walk.ts +104 -0
- package/src/core/retention.ts +10 -12
- package/src/core/run-dirs.ts +45 -0
- package/src/core/runs-matrix.ts +1 -1
- package/src/core/slots.ts +2 -2
- package/src/core/slug.ts +33 -0
- package/src/core/spawn-timeout.ts +3 -1
- package/src/core/squircle.ts +0 -8
- package/src/core/throwaway-worktree.ts +21 -2
- package/src/core/unit-files.ts +4 -4
- package/src/core/when-block.ts +4 -5
- package/src/core/when.ts +1 -3
- package/src/core/words.ts +33 -0
- package/src/fleet/push-fleet.ts +4 -11
- package/src/{core → gate}/cache-audit.ts +1 -1
- package/src/{core → gate}/check-runner.ts +24 -54
- package/src/{core → gate}/discover-checks.ts +19 -101
- package/src/{core → gate}/discover-legacy-checks.ts +3 -3
- package/src/{ledger → gate}/gate-checks.ts +5 -5
- package/src/gate/head-gate.ts +151 -0
- package/src/{core → gate}/job-follow.ts +1 -1
- package/src/{core → gate}/job-run.ts +3 -3
- package/src/{core → gate}/pre-commit-discovery.ts +2 -2
- package/src/{core → gate}/run-check.ts +7 -7
- package/src/{core → gate}/run-ci.ts +9 -9
- package/src/gate/run-fix.ts +173 -0
- package/src/{core → gate}/run-fixers.ts +14 -14
- package/src/{core → gate}/trace-audit.ts +8 -8
- package/src/home/activity-shape.ts +1 -1
- package/src/home/activity.ts +21 -26
- package/src/home/app-sign.ts +17 -9
- package/src/home/daemon-guard.ts +6 -0
- package/src/home/daemon-jobs.ts +64 -10
- package/src/home/database-words.ts +21 -27
- package/src/home/databases.ts +3 -3
- package/src/home/global-context.ts +2 -2
- package/src/home/global-units.ts +1 -1
- package/src/home/gui-app/ShipkitGui.swift +129 -55
- package/src/home/gui-app.ts +1 -1
- package/src/home/handover.ts +126 -0
- package/src/home/home-move.ts +29 -16
- package/src/home/home-paths.ts +33 -8
- package/src/home/home-routes.ts +83 -5
- package/src/home/home-start.ts +1 -1
- package/src/home/home-state.ts +12 -6
- package/src/home/hubs.ts +28 -5
- package/src/home/inbox-shape.ts +250 -94
- package/src/home/inbox.ts +27 -71
- package/src/home/lib-watch.ts +93 -74
- package/src/home/machine-fold.ts +54 -56
- package/src/home/machine-host.ts +19 -1
- package/src/home/machine-repair.ts +5 -6
- package/src/home/machine-stores.ts +3 -3
- package/src/home/machine-temp.ts +58 -67
- package/src/home/other-macs.ts +2 -2
- package/src/home/page-build.ts +330 -0
- package/src/home/page-held.ts +338 -0
- package/src/home/pm-config.ts +10 -2
- package/src/home/pm.ts +35 -1
- package/src/home/process-apps.ts +3 -3
- package/src/home/push-sources.ts +132 -0
- package/src/home/run-daemon.ts +54 -4
- package/src/home/run-pm.ts +2 -1
- package/src/home/run-web.ts +11 -6
- package/src/home/search-shape.ts +54 -0
- package/src/home/search.ts +114 -0
- package/src/home/serve-daemon.ts +40 -18
- package/src/home/serve-web.ts +90 -148
- package/src/home/space-page.ts +8 -8
- package/src/home/space-words.ts +11 -10
- package/src/home/supervise.ts +24 -0
- package/src/home/time-page-shape.ts +0 -13
- package/src/home/vault-page.ts +64 -30
- package/src/home/vault-reveal.ts +29 -0
- package/src/home/vault-words.ts +5 -5
- package/src/home/via-hub.ts +3 -4
- package/src/home/worktree-tidy.ts +236 -0
- package/src/hooks/edit-guard.ts +12 -0
- package/src/hooks/hook-gates.ts +2 -0
- package/src/hooks/leak-guard.ts +9 -3
- package/src/hooks/one-way-in-guard.ts +32 -2
- package/src/hooks/run-hooks.ts +58 -5
- package/src/hooks/shared-file.ts +174 -0
- package/src/{serve → house}/project-gutter.ts +11 -54
- package/src/hq/door-route.ts +2 -2
- package/src/hq/door.ts +3 -3
- package/src/hq/files-send.ts +32 -33
- package/src/hq/forgotten-log.ts +1 -1
- package/src/hq/history-check.ts +7 -6
- package/src/hq/history-send.ts +12 -14
- package/src/hq/hq-db.ts +5 -2
- package/src/hq/hq-local.ts +48 -13
- package/src/hq/hq-routes.ts +10 -2
- package/src/hq/hq-store.ts +10 -6
- package/src/hq/kinds/ask.ts +9 -8
- package/src/hq/kinds/index.ts +4 -4
- package/src/hq/kinds/{card-gone.ts → item-gone.ts} +24 -25
- package/src/hq/kinds/{card-msg.ts → item-msg.ts} +25 -27
- package/src/hq/kinds/{card.ts → item.ts} +31 -29
- package/src/hq/kinds/kind.ts +3 -0
- package/src/hq/kinds/media.ts +2 -3
- package/src/hq/kinds/prompt.ts +2 -1
- package/src/hq/kinds/time-day.ts +5 -4
- package/src/hq/ledger.ts +22 -22
- package/src/hq/machine-notes.ts +14 -15
- package/src/hq/outbox.ts +35 -24
- package/src/hq/replica.ts +1 -2
- package/src/hq/report.ts +10 -12
- package/src/hq/switch.ts +20 -23
- package/src/hq/{cards.ts → thread-sync.ts} +127 -99
- package/src/hq/vault-route.ts +112 -0
- package/src/{serve → http}/door-forward.ts +11 -4
- package/src/http/loopback-serve.ts +84 -0
- package/src/{serve → http}/same-origin.ts +6 -2
- package/src/http/tailnet-caller.ts +118 -0
- package/src/identities/collection.ts +2 -2
- package/src/identities/identities.ts +9 -8
- package/src/identities/machine-route.ts +8 -3
- package/src/identities/shown.ts +2 -6
- package/src/ledger/check-table.ts +1 -1
- package/src/ledger/db.ts +9 -1
- package/src/ledger/git-key.ts +9 -3
- package/src/ledger/git-scan.ts +2 -2
- package/src/ledger/ledger.ts +6 -16
- package/src/media-kinds.ts +4 -1
- package/src/media-store/backup/daemon.ts +51 -10
- package/src/media-store/backup/keys.ts +1 -4
- package/src/media-store/backup/manifest.ts +21 -3
- package/src/media-store/backup/prune.ts +362 -0
- package/src/media-store/backup/retention.ts +122 -0
- package/src/media-store/backup/run.ts +22 -35
- package/src/media-store/backup/sources.ts +27 -27
- package/src/media-store/backup/thread-copy.ts +339 -0
- package/src/media-store/backup/watch.ts +10 -6
- package/src/media-store/content.ts +3 -0
- package/src/media-store/copy/config.ts +3 -4
- package/src/media-store/copy/night.ts +4 -4
- package/src/media-store/copy/store.ts +2 -2
- package/src/media-store/daemon.ts +5 -4
- package/src/media-store/db.ts +10 -20
- package/src/media-store/forget-one.ts +247 -0
- package/src/media-store/forget.ts +141 -4
- package/src/media-store/hq-send.ts +5 -4
- package/src/media-store/purge.ts +5 -4
- package/src/media-store/remote.ts +2 -2
- package/src/media-store/space-listing.ts +20 -9
- package/src/media-store/space.ts +7 -5
- package/src/media-store/tidy.ts +3 -3
- package/src/media-store/upload.ts +2 -2
- package/src/media-store/webp.ts +3 -3
- package/src/messages/guard.ts +49 -0
- package/src/messages/model.ts +1 -1
- package/src/messages/objects.ts +203 -0
- package/src/messages/routes.ts +2 -2
- package/src/messages/score.ts +2 -4
- package/src/messages/store-doc.ts +114 -0
- package/src/messages/verdicts.ts +6 -0
- package/src/messages/write.ts +285 -0
- package/src/mv/mv-md.ts +43 -12
- package/src/orchestrator/brief.md +29 -0
- package/src/orchestrator/deliver.ts +81 -0
- package/src/orchestrator/drill.ts +129 -0
- package/src/orchestrator/guards.ts +63 -0
- package/src/orchestrator/keeper.ts +332 -0
- package/src/orchestrator/phone.ts +98 -0
- package/src/orchestrator/pm.ts +20 -0
- package/src/orchestrator/presence-shape.ts +17 -0
- package/src/orchestrator/presence.ts +68 -0
- package/src/orchestrator/push.ts +102 -0
- package/src/orchestrator/routes.ts +113 -0
- package/src/orchestrator/state.ts +92 -0
- package/src/orchestrator/switch.ts +86 -0
- package/src/orchestrator/tmux.ts +82 -0
- package/src/orchestrator/unheard.ts +68 -0
- package/src/pages/frame-client.ts +181 -4
- package/src/pages/unit.ts +1 -1
- package/src/plan/repo-source.ts +1 -1
- package/src/recordings/load.ts +1 -1
- package/src/recordings/model.ts +18 -10
- package/src/recordings/place.ts +3 -3
- package/src/recordings/recorder-app/Capture.swift +69 -21
- package/src/recordings/recorder-app/Editor.swift +214 -11
- package/src/recordings/recorder-app/main.swift +229 -47
- package/src/recordings/recorder-app.ts +1 -1
- package/src/recordings/routes.ts +11 -1
- package/src/recordings/take.ts +7 -5
- package/src/recordings/view.ts +6 -0
- package/src/reflect/prompt-corpus.ts +5 -3
- package/src/reflect/thread-words.ts +51 -0
- package/src/reflections/reflection-close.ts +123 -0
- package/src/reflections/reflection-doc.ts +59 -0
- package/src/reflections/reflection-place.ts +60 -0
- package/src/reflections/reflections-queue.ts +1 -1
- package/src/release/gate-checkout.ts +124 -21
- package/src/release/git-facts.ts +11 -9
- package/src/release/machine-words.ts +21 -3
- package/src/release/public-clean.ts +81 -21
- package/src/release/run-bump.ts +3 -5
- package/src/release/run-release.ts +42 -38
- package/src/releases/add.ts +33 -87
- package/src/releases/{from-card.ts → from-thread.ts} +47 -46
- package/src/releases/model.ts +207 -36
- package/src/releases/routes.ts +2 -2
- package/src/releases/shape.ts +184 -0
- package/src/releases/store.ts +10 -10
- package/src/repo-config.ts +53 -21
- package/src/review/anim.ts +8 -8
- package/src/review/answer-kinds.ts +160 -0
- package/src/review/auto.ts +3 -3
- package/src/review/band.ts +145 -0
- package/src/review/branch-hold.ts +91 -0
- package/src/review/cells.ts +451 -96
- package/src/review/close.ts +92 -0
- package/src/review/doc-card.ts +41 -0
- package/src/review/doc-model.ts +100 -0
- package/src/review/doc-routes.ts +66 -0
- package/src/review/doc-save.ts +152 -0
- package/src/review/draft-item.ts +36 -0
- package/src/review/draft-model.ts +125 -17
- package/src/review/events.ts +164 -0
- package/src/review/file-tags.ts +52 -0
- package/src/review/format.ts +195 -38
- package/src/review/glyphs.ts +63 -0
- package/src/review/gone.ts +21 -21
- package/src/review/hand-over.ts +58 -0
- package/src/review/heard.ts +29 -0
- package/src/review/holds-sync.ts +62 -0
- package/src/review/holds.ts +85 -0
- package/src/review/house-kind-defs.ts +71 -0
- package/src/review/http.ts +1 -1
- package/src/review/inbox-hook.ts +69 -10
- package/src/review/inbox-read.ts +226 -0
- package/src/review/instructions.ts +241 -0
- package/src/review/{card-db.ts → item-db.ts} +48 -36
- package/src/review/{card-rows.ts → item-rows.ts} +79 -51
- package/src/review/kind-apply.ts +61 -0
- package/src/review/kind-catalog.ts +96 -0
- package/src/review/kind-still.ts +125 -0
- package/src/review/kinds.ts +314 -0
- package/src/review/lane-ask.ts +113 -0
- package/src/review/live-post.ts +107 -0
- package/src/review/live-view.ts +137 -0
- package/src/review/media-kind.ts +4 -4
- package/src/review/media-read.ts +4 -4
- package/src/review/media.ts +3 -5
- package/src/review/mentions.ts +100 -0
- package/src/review/model-moved.ts +76 -0
- package/src/review/model.ts +846 -214
- package/src/review/move.ts +62 -61
- package/src/review/need-address.ts +15 -0
- package/src/review/need-threads.ts +51 -0
- package/src/review/notes.ts +2 -1
- package/src/review/object-card.ts +48 -0
- package/src/review/object-read.ts +31 -0
- package/src/review/one-block.ts +64 -0
- package/src/review/owner-read.ts +41 -0
- package/src/review/owner-verdict.ts +36 -0
- package/src/review/parties.ts +274 -0
- package/src/review/paste.ts +4 -4
- package/src/review/phone-push.ts +137 -0
- package/src/review/previews.ts +19 -17
- package/src/review/project.ts +1 -1
- package/src/review/projections.ts +235 -0
- package/src/review/push.ts +269 -0
- package/src/review/referring.ts +76 -0
- package/src/review/reflection-object.ts +190 -0
- package/src/review/rev.ts +1 -1
- package/src/review/role.ts +3 -3
- package/src/review/routes.ts +227 -83
- package/src/review/search-index.ts +218 -0
- package/src/review/search-job.ts +40 -0
- package/src/review/search-ocr.ts +138 -0
- package/src/review/search-text.ts +129 -0
- package/src/review/secret-route.ts +110 -0
- package/src/review/settle.ts +67 -0
- package/src/review/snooze.ts +38 -0
- package/src/review/stage-routes.ts +15 -13
- package/src/review/{stage-card.ts → stage-thread.ts} +22 -21
- package/src/review/store-index.ts +49 -0
- package/src/review/store-parties.ts +20 -0
- package/src/review/store.ts +721 -260
- package/src/review/supersede.ts +132 -0
- package/src/review/take-back.ts +65 -0
- package/src/review/thread-fold.ts +20 -7
- package/src/review/threads.ts +397 -79
- package/src/review/traces.ts +206 -0
- package/src/review/trailer-desk.ts +7 -7
- package/src/review/{trailer-card.ts → trailer-item.ts} +12 -12
- package/src/review/trailer-model.ts +4 -4
- package/src/review/trailer-notes.ts +2 -2
- package/src/review/trailer-routes.ts +5 -4
- package/src/review/trailer-shots.ts +3 -3
- package/src/review/unit.ts +140 -13
- package/src/review/uploads.ts +103 -0
- package/src/review/verdict-items.ts +73 -0
- package/src/review/verdict-write.ts +15 -0
- package/src/review/view-layout.ts +69 -0
- package/src/review/wait.ts +91 -0
- package/src/review/wakes.ts +115 -0
- package/src/review/watch-feed.ts +183 -0
- package/src/review/watchers.ts +44 -10
- package/src/rules/untrack-generated.ts +40 -39
- package/src/scaffold/files/bunfig.toml +1 -9
- package/src/scaffold/files/claude-settings-local.json +2 -0
- package/src/scaffold/files/vscode-settings.json +1 -1
- package/src/scaffold/project-scaffold.ts +14 -10
- package/src/secrets/archive-mark.ts +52 -0
- package/src/secrets/archive.ts +84 -0
- package/src/secrets/copy.ts +14 -14
- package/src/secrets/keychain-write.ts +56 -0
- package/src/secrets/keychain.ts +8 -5
- package/src/secrets/lapse-mark.ts +38 -0
- package/src/secrets/lapse.ts +71 -0
- package/src/secrets/list.ts +16 -22
- package/src/secrets/manager.ts +31 -16
- package/src/secrets/read.ts +161 -33
- package/src/secrets/security-line.ts +19 -0
- package/src/secrets/tail.ts +31 -0
- package/src/serve/embed.ts +1 -1
- package/src/serve/house-runs.ts +1 -1
- package/src/serve/hub-app/accounts-line.tsx +67 -0
- package/src/serve/hub-app/activity-st.ts +46 -50
- package/src/serve/hub-app/advice-box.tsx +66 -0
- package/src/serve/hub-app/advisor-app.tsx +46 -0
- package/src/serve/hub-app/advisor-face.tsx +29 -0
- package/src/serve/hub-app/advisor-host.ts +142 -0
- package/src/serve/hub-app/advisor.html +22 -0
- package/src/serve/hub-app/advisors-st.ts +261 -0
- package/src/serve/hub-app/advisors-view.tsx +269 -0
- package/src/serve/hub-app/advisors.css +57 -0
- package/src/serve/hub-app/app-bridge.ts +27 -24
- package/src/serve/hub-app/ask-steps-st.ts +60 -0
- package/src/serve/hub-app/ask-steps.tsx +23 -0
- package/src/serve/hub-app/asks-page.tsx +9 -5
- package/src/serve/hub-app/asks-st.ts +1 -4
- package/src/serve/hub-app/auto-text.tsx +118 -18
- package/src/serve/hub-app/benign-errors.ts +15 -1
- package/src/serve/hub-app/card-head.tsx +49 -0
- package/src/serve/hub-app/check-view.tsx +3 -2
- package/src/serve/hub-app/checks-svc.ts +1 -1
- package/src/serve/hub-app/clock-svc.ts +21 -5
- package/src/serve/hub-app/code-copy.ts +196 -0
- package/src/serve/hub-app/col-card.tsx +24 -40
- package/src/serve/hub-app/col-list-page.tsx +7 -4
- package/src/serve/hub-app/col-list-st.ts +6 -1
- package/src/serve/hub-app/col-tables-view.tsx +7 -4
- package/src/serve/hub-app/col-tables.ts +19 -13
- package/src/serve/hub-app/cols-svc.ts +15 -80
- package/src/serve/hub-app/comfy-svc.ts +3 -2
- package/src/serve/hub-app/commands/commands-page.tsx +2 -1
- package/src/serve/hub-app/commands/commands-st.ts +36 -26
- package/src/serve/hub-app/controls.css +99 -0
- package/src/serve/hub-app/cursor-spot.ts +81 -0
- package/src/serve/hub-app/database-st.ts +31 -26
- package/src/serve/hub-app/database-view.tsx +12 -12
- package/src/serve/hub-app/dock-st.ts +51 -10
- package/src/serve/hub-app/dock-view.tsx +14 -1
- package/src/serve/hub-app/editor/doc-editor-st.ts +223 -0
- package/src/serve/hub-app/editor/doc-editor.tsx +116 -0
- package/src/serve/hub-app/editor/doc-saved.tsx +26 -0
- package/src/serve/hub-app/editor/doc-slot.ts +66 -0
- package/src/serve/hub-app/editor.css +36 -0
- package/src/serve/hub-app/emoji-names.ts +1915 -0
- package/src/serve/hub-app/emoji.ts +133 -0
- package/src/serve/hub-app/floating.tsx +162 -6
- package/src/serve/hub-app/frames-st.ts +17 -1
- package/src/serve/hub-app/git-st.ts +25 -19
- package/src/serve/hub-app/git-view.tsx +3 -2
- package/src/serve/hub-app/hash-route.ts +1 -1
- package/src/serve/hub-app/header-bar.tsx +4 -3
- package/src/serve/hub-app/held-keys.ts +25 -0
- package/src/serve/hub-app/home-st.ts +167 -18
- package/src/serve/hub-app/home-strip.css +4 -8
- package/src/serve/hub-app/home-strip.tsx +7 -3
- package/src/serve/hub-app/home.html +10 -0
- package/src/serve/hub-app/house-wiki-view.tsx +20 -0
- package/src/serve/hub-app/hub-app.tsx +102 -36
- package/src/serve/hub-app/hub-types.ts +2 -0
- package/src/serve/hub-app/hub.css +117 -92
- package/src/serve/hub-app/icons.tsx +24 -4
- package/src/serve/hub-app/identities-st.ts +35 -25
- package/src/serve/hub-app/identities-view.tsx +11 -7
- package/src/serve/hub-app/inbox-st.ts +241 -52
- package/src/serve/hub-app/inbox-view.tsx +198 -105
- package/src/serve/hub-app/inbox.css +53 -47
- package/src/serve/hub-app/index.html +10 -0
- package/src/serve/hub-app/insights-st.ts +27 -19
- package/src/serve/hub-app/instructions.css +33 -0
- package/src/serve/hub-app/kept-folds.ts +43 -0
- package/src/serve/hub-app/keys.ts +13 -5
- package/src/serve/hub-app/later.tsx +1 -1
- package/src/serve/hub-app/layout-st.ts +37 -6
- package/src/serve/hub-app/list-filter.tsx +1 -1
- package/src/serve/hub-app/live-bar.css +12 -0
- package/src/serve/hub-app/live-svc.ts +12 -2
- package/src/serve/hub-app/machine-st.ts +38 -12
- package/src/serve/hub-app/machines-st.ts +40 -34
- package/src/serve/hub-app/machines-view.tsx +9 -16
- package/src/serve/hub-app/machines.css +0 -9
- package/src/serve/hub-app/markdown.css +128 -0
- package/src/serve/hub-app/md-copy.tsx +18 -40
- package/src/serve/hub-app/md.ts +176 -14
- package/src/serve/hub-app/media-svc.ts +44 -11
- package/src/serve/hub-app/media-view.tsx +2 -2
- package/src/serve/hub-app/messages/messages-page.tsx +57 -12
- package/src/serve/hub-app/messages/messages-st.ts +27 -23
- package/src/serve/hub-app/messages.css +0 -1
- package/src/serve/hub-app/new-thread.tsx +121 -0
- package/src/serve/hub-app/objects.css +52 -0
- package/src/serve/hub-app/orchestrator-line.tsx +104 -0
- package/src/serve/hub-app/orchestrator.css +37 -0
- package/src/serve/hub-app/page-keys.ts +8 -5
- package/src/serve/hub-app/page-reload.ts +111 -0
- package/src/serve/hub-app/pages-frames.tsx +12 -1
- package/src/serve/hub-app/pages-svc.ts +8 -3
- package/src/serve/hub-app/palette-st.ts +11 -6
- package/src/serve/hub-app/pane-boundary.tsx +85 -0
- package/src/serve/hub-app/pane-errors.ts +55 -0
- package/src/serve/hub-app/pano.css +20 -0
- package/src/serve/hub-app/plan-view.tsx +4 -3
- package/src/serve/hub-app/planned-st.ts +30 -26
- package/src/serve/hub-app/planned-view.tsx +17 -10
- package/src/serve/hub-app/planned.css +0 -4
- package/src/serve/hub-app/polled.ts +201 -0
- package/src/serve/hub-app/presence-st.ts +110 -0
- package/src/serve/hub-app/processes-view.tsx +3 -2
- package/src/serve/hub-app/project-list.css +101 -66
- package/src/serve/hub-app/project-list.tsx +139 -155
- package/src/serve/hub-app/projects-svc.ts +113 -57
- package/src/serve/hub-app/push-sign.tsx +15 -0
- package/src/serve/hub-app/push-svc.ts +273 -0
- package/src/serve/hub-app/quiet-st.ts +59 -0
- package/src/serve/hub-app/rail-fly.tsx +95 -0
- package/src/serve/hub-app/reach.ts +16 -0
- package/src/serve/hub-app/readme.css +9 -15
- package/src/serve/hub-app/recordings-st.ts +169 -9
- package/src/serve/hub-app/recordings-take.ts +58 -0
- package/src/serve/hub-app/recordings-view.tsx +42 -35
- package/src/serve/hub-app/recordings.css +1 -1
- package/src/serve/hub-app/reflections-page.tsx +70 -5
- package/src/serve/hub-app/releases/releases-page.tsx +54 -20
- package/src/serve/hub-app/releases/releases-st.ts +39 -26
- package/src/serve/hub-app/releases.css +4 -1
- package/src/serve/hub-app/repo-sections.ts +21 -10
- package/src/serve/hub-app/repo-st.ts +36 -9
- package/src/serve/hub-app/review/advisor-bar.tsx +40 -0
- package/src/serve/hub-app/review/attach-st.ts +195 -0
- package/src/serve/hub-app/review/attach-view.tsx +260 -0
- package/src/serve/hub-app/review/clip-st.ts +1 -1
- package/src/serve/hub-app/review/code-colors.ts +30 -0
- package/src/serve/hub-app/review/cta.tsx +11 -0
- package/src/serve/hub-app/review/diff-view.tsx +77 -0
- package/src/serve/hub-app/review/doc-body.tsx +109 -0
- package/src/serve/hub-app/review/dock.tsx +118 -0
- package/src/serve/hub-app/review/draft-body.tsx +235 -0
- package/src/serve/hub-app/review/faces.tsx +26 -0
- package/src/serve/hub-app/review/group-block.tsx +239 -0
- package/src/serve/hub-app/review/heard-line.tsx +31 -0
- package/src/serve/hub-app/review/instructions-view.tsx +141 -0
- package/src/serve/hub-app/review/item-verdict.tsx +111 -0
- package/src/serve/hub-app/review/kind-states.tsx +265 -0
- package/src/serve/hub-app/review/kind-view.tsx +23 -44
- package/src/serve/hub-app/review/kit.tsx +54 -75
- package/src/serve/hub-app/review/lane-bar.tsx +64 -0
- package/src/serve/hub-app/review/lightbox.tsx +16 -0
- package/src/serve/hub-app/review/line-window.ts +149 -0
- package/src/serve/hub-app/review/live-bar-st.ts +145 -0
- package/src/serve/hub-app/review/live-bar.tsx +126 -0
- package/src/serve/hub-app/review/live-view.tsx +104 -0
- package/src/serve/hub-app/review/mention-st.ts +85 -0
- package/src/serve/hub-app/review/mesh-view.tsx +9 -0
- package/src/serve/hub-app/review/object-card.tsx +62 -0
- package/src/serve/hub-app/review/object-panel.tsx +197 -0
- package/src/serve/hub-app/review/pano-gl.ts +145 -0
- package/src/serve/hub-app/review/pano-view.tsx +192 -0
- package/src/serve/hub-app/review/phone-top.tsx +16 -0
- package/src/serve/hub-app/review/pictures-st.ts +38 -0
- package/src/serve/hub-app/review/question-views.tsx +387 -0
- package/src/serve/hub-app/review/review-board.tsx +1 -1
- package/src/serve/hub-app/review/review-cells.tsx +223 -184
- package/src/serve/hub-app/review/review-host.ts +69 -0
- package/src/serve/hub-app/review/review-kit.ts +34 -19
- package/src/serve/hub-app/review/review-list.tsx +211 -51
- package/src/serve/hub-app/review/review-page.tsx +10 -20
- package/src/serve/hub-app/review/review-st.ts +294 -151
- package/src/serve/hub-app/review/review-thread.tsx +605 -161
- package/src/serve/hub-app/review/review-views.tsx +547 -452
- package/src/serve/hub-app/review/scene-view.tsx +26 -0
- package/src/serve/hub-app/review/secret-facts.ts +26 -0
- package/src/serve/hub-app/review/space3d.tsx +114 -0
- package/src/serve/hub-app/review/splat-view.tsx +9 -0
- package/src/serve/hub-app/review/superseded-runs.ts +76 -0
- package/src/serve/hub-app/review/thread-close.tsx +134 -0
- package/src/serve/hub-app/review/thread-control-st.ts +2 -1
- package/src/serve/hub-app/review/thread-control.tsx +4 -4
- package/src/serve/hub-app/review/thread-st.ts +710 -140
- package/src/serve/hub-app/review/thread-views.ts +71 -0
- package/src/serve/hub-app/review/{trailer-card.tsx → trailer-body.tsx} +35 -35
- package/src/serve/hub-app/review/trailer-page.tsx +23 -25
- package/src/serve/hub-app/review/trailer-st.ts +38 -38
- package/src/serve/hub-app/review/trailer-timeline.tsx +24 -20
- package/src/serve/hub-app/review/trailer-voices.tsx +3 -2
- package/src/serve/hub-app/review.css +459 -188
- package/src/serve/hub-app/search-st.ts +138 -0
- package/src/serve/hub-app/search-view.tsx +92 -0
- package/src/serve/hub-app/section-head.tsx +52 -0
- package/src/serve/hub-app/shell-rows.ts +126 -0
- package/src/serve/hub-app/site/site-st.ts +18 -23
- package/src/serve/hub-app/social/calendar.tsx +5 -11
- package/src/serve/hub-app/social/comms-page.tsx +36 -20
- package/src/serve/hub-app/social/group-editor.tsx +44 -0
- package/src/serve/hub-app/social/kit.tsx +15 -61
- package/src/serve/hub-app/social/next-release.tsx +5 -7
- package/src/serve/hub-app/social/post-card.tsx +19 -52
- package/src/serve/hub-app/social/post-page.tsx +80 -0
- package/src/serve/hub-app/social/problems.tsx +9 -12
- package/src/serve/hub-app/social/social-model.ts +13 -5
- package/src/serve/hub-app/social/social-page.tsx +4 -4
- package/src/serve/hub-app/social/social-st.ts +67 -83
- package/src/serve/hub-app/social/stage-popup.tsx +6 -6
- package/src/serve/hub-app/social/stage-st.ts +9 -9
- package/src/serve/hub-app/social.css +7 -25
- package/src/serve/hub-app/space-st.ts +38 -48
- package/src/serve/hub-app/space-view.tsx +6 -6
- package/src/serve/hub-app/space.css +1 -1
- package/src/serve/hub-app/stores/stores-page.tsx +10 -6
- package/src/serve/hub-app/stores/stores-st.ts +19 -23
- package/src/serve/hub-app/terminal-input.ts +12 -0
- package/src/serve/hub-app/terminal-panel.tsx +40 -0
- package/src/serve/hub-app/terminal-st.ts +416 -0
- package/src/serve/hub-app/terminal.css +15 -0
- package/src/serve/hub-app/tests-svc.ts +3 -2
- package/src/serve/hub-app/theme-st.ts +1 -9
- package/src/serve/hub-app/thread-row.tsx +136 -0
- package/src/serve/hub-app/time-ago.tsx +40 -16
- package/src/serve/hub-app/time-st.ts +43 -27
- package/src/serve/hub-app/time-view.tsx +4 -3
- package/src/serve/hub-app/time.css +2 -5
- package/src/serve/hub-app/tree-build.ts +2 -2
- package/src/serve/hub-app/tree-row.tsx +44 -27
- package/src/serve/hub-app/tree-svc.ts +1 -1
- package/src/serve/hub-app/urls-svc.ts +6 -5
- package/src/serve/hub-app/vault-st.ts +32 -27
- package/src/serve/hub-app/vault-view.tsx +57 -6
- package/src/serve/hub-app/vault.css +2 -0
- package/src/serve/hub-app/veille/veille-page.tsx +5 -14
- package/src/serve/hub-app/veille/veille-st.ts +56 -49
- package/src/serve/hub-app/veille.css +0 -1
- package/src/serve/hub-app/view-layout.css +90 -0
- package/src/serve/hub-app/waiting-svc.ts +5 -4
- package/src/serve/hub-app/when-view.tsx +6 -3
- package/src/serve/hub-app/wiki-st.ts +33 -6
- package/src/serve/hub-app/wikis-view.tsx +22 -18
- package/src/serve/hub-app/words.tsx +15 -0
- package/src/serve/hub-collections.ts +105 -0
- package/src/serve/hub-runtime.ts +83 -91
- package/src/serve/live-hop.ts +102 -0
- package/src/serve/other-repos.ts +1 -1
- package/src/serve/project-gutter-route.ts +69 -46
- package/src/serve/read-thread.ts +76 -0
- package/src/serve/read-worker.ts +53 -0
- package/src/serve/run-serve.ts +11 -7
- package/src/serve/secret-gate.ts +21 -0
- package/src/serve/serve-hub.ts +129 -51
- package/src/serve/terminal-guard.ts +50 -0
- package/src/serve/terminal-route.ts +176 -0
- package/src/shipkit.ts +10 -10
- package/src/shot/client.ts +32 -16
- package/src/shot/dom-clip.ts +30 -5
- package/src/shot/film-box.ts +23 -8
- package/src/shot/serve-shot.ts +16 -5
- package/src/shot/shooter.ts +72 -24
- package/src/shot/shot-ask.ts +17 -6
- package/src/shot/shot-guard.ts +53 -0
- package/src/shot/shot-theme.ts +70 -0
- package/src/shot/still-file.ts +60 -0
- package/src/site/desk.ts +6 -5
- package/src/smoke/run-smoke.ts +3 -4
- package/src/social/brands.ts +4 -0
- package/src/social/compose.ts +13 -7
- package/src/social/cover.ts +4 -3
- package/src/social/desk-index.ts +34 -13
- package/src/social/draft-doc.ts +88 -0
- package/src/social/draft-versions.ts +80 -0
- package/src/social/drafts.ts +26 -8
- package/src/social/fit.ts +4 -3
- package/src/social/house.ts +1 -1
- package/src/social/import-drafts.ts +244 -0
- package/src/social/kind-pages.ts +3 -3
- package/src/social/kinds.ts +2 -2
- package/src/social/load.ts +106 -73
- package/src/social/media-facts.ts +1 -19
- package/src/social/media-kind.ts +68 -161
- package/src/social/media-limit.ts +3 -18
- package/src/social/media-of.ts +5 -4
- package/src/social/no-account.ts +38 -0
- package/src/social/open.ts +3 -2
- package/src/social/post-object.ts +120 -0
- package/src/social/post-sources.ts +136 -0
- package/src/social/post-text.ts +123 -0
- package/src/social/posts.ts +433 -0
- package/src/social/presence.ts +17 -13
- package/src/social/publish/index.ts +17 -5
- package/src/social/publish/secret.ts +2 -2
- package/src/social/release-stage.ts +76 -75
- package/src/social/routes.ts +72 -50
- package/src/social/stage.ts +45 -60
- package/src/social/stats.ts +3 -4
- package/src/social/strip.ts +4 -6
- package/src/social/text.ts +6 -4
- package/src/social/thread-drafts.ts +16 -0
- package/src/social/thumbnail.ts +135 -43
- package/src/social/tracker.ts +1 -1
- package/src/social/unit.ts +12 -3
- package/src/social/writes.ts +8 -31
- package/src/start-repo.ts +33 -13
- package/src/stores/desk.ts +17 -12
- package/src/stores/unit.ts +2 -2
- package/src/suite/core-counters.ts +31 -3
- package/src/suite/judge-suites.ts +69 -47
- package/src/suite/select.ts +1 -27
- package/src/suite/suite-cli.ts +18 -8
- package/src/suite/suite-cpu-preload.ts +10 -6
- package/src/trace/tracer.ts +4 -5
- package/src/trailer/build.ts +30 -15
- package/src/trailer/ffmpeg.ts +90 -31
- package/src/trailer/fonts.ts +5 -6
- package/src/trailer/footage.ts +9 -3
- package/src/trailer/grammar.ts +2 -1
- package/src/trailer/graph.ts +12 -10
- package/src/trailer/load-unit.ts +1 -1
- package/src/trailer/passage.ts +4 -3
- package/src/trailer/prune.ts +4 -4
- package/src/trailer/score/sound.ts +3 -3
- package/src/trailer/shot-plan.ts +5 -5
- package/src/trailer/shot-state.ts +25 -31
- package/src/trailer/sound/eleven.ts +34 -3
- package/src/trailer/sound/gen.ts +3 -3
- package/src/trailer/sound/run.ts +76 -64
- package/src/trailer/sound/takes.ts +0 -3
- package/src/trailer/take-fault.ts +41 -0
- package/src/trailer/titles.ts +17 -13
- package/src/trailer/url.ts +1 -1
- package/src/trailer/vertical-draw.ts +7 -7
- package/src/trailer/vertical.ts +3 -3
- package/src/trailer/vocab.ts +3 -4
- package/src/ts/config.ts +60 -24
- package/src/ts/cycles.ts +3 -1
- package/src/ts/imports.ts +17 -3
- package/src/ts/rename.ts +6 -7
- package/src/ts/source-graph.ts +15 -9
- package/src/ts/workspaces.ts +26 -0
- package/src/tui/build-steps-panel.ts +3 -3
- package/src/tui/checks-panel.ts +2 -2
- package/src/urls/frame.ts +3 -3
- package/src/urls/routes.ts +1 -1
- package/src/urls/rows.ts +2 -2
- package/src/vault/house-keys.ts +1 -1
- package/src/vault/vault-audit.ts +2 -3
- package/src/vault/vault-config.ts +6 -2
- package/src/vault/vault-http.ts +11 -3
- package/src/vault/vault-import.ts +6 -1
- package/src/vault/vault-restore.ts +3 -9
- package/src/vault/vault-serve.ts +47 -11
- package/src/vault/vault-snapshot.ts +5 -14
- package/src/veille/desk.ts +2 -2
- package/src/veille/identity.ts +2 -2
- package/src/veille/routes.ts +1 -1
- package/src/view3d/cam.ts +101 -0
- package/src/view3d/lib.ts +69 -0
- package/src/view3d/loop.ts +39 -0
- package/src/view3d/scene-cache.ts +62 -0
- package/src/view3d/viewer.ts +480 -0
- package/src/wiki/agent-paths.ts +55 -0
- package/src/wiki/graph-pages.ts +13 -1
- package/src/wiki/run-wiki.ts +4 -1
- package/src/wiki/scan-md.ts +1 -1
- package/src/wiki/serve-graph.ts +2 -3
- package/src/asks/asks-queue.ts +0 -424
- package/src/core/run-fix.ts +0 -120
- package/src/home/hmr-keep.ts +0 -134
- package/src/messages/suggest.ts +0 -96
- package/src/review/draft-card.ts +0 -41
- package/src/serve/hub-app/review/draft-card.tsx +0 -163
- package/src/serve/hub-app/review/note-place.ts +0 -31
- package/src/social/card-drafts.ts +0 -24
- package/src/social/migrate.ts +0 -123
- /package/src/{serve → http}/door-names.ts +0 -0
- /package/src/{serve → http}/hub-port.ts +0 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
// the lane worktrees a repo no longer needs (wiki tools/shipkit/home-daemon-loop.md, the job worktrees): a checkout under
|
|
2
|
+
// `.claude/worktrees/` goes once it is clean, its commits are in the main branch, nothing uses it and it sat idle.
|
|
3
|
+
// The daemon's job `worktrees` runs it hourly over the house repos, `sk worktrees tidy` at once after a merge.
|
|
4
|
+
//
|
|
5
|
+
// the one constraint a reader breaks first: only git removes, and only the way that refuses. `git worktree remove`
|
|
6
|
+
// with no --force, `git branch -d` never -D. git deletes a worktree's ignored files with it, unasked: so any ignored
|
|
7
|
+
// file outside DISPOSABLE keeps the worktree, and a check here that misjudges leaves a worktree, never loses work
|
|
8
|
+
import { closeSync, existsSync, openSync, readdirSync, readFileSync, readlinkSync, readSync, realpathSync, rmSync, statSync } from 'node:fs'
|
|
9
|
+
import { basename, join, resolve } from 'node:path'
|
|
10
|
+
import { realGit, type GitIo } from '../core/git.ts'
|
|
11
|
+
import { commitsNotIn } from '../core/in-base.ts'
|
|
12
|
+
import { LANE_IDLE_MS, laneRunning } from '../agent-time/registry.ts'
|
|
13
|
+
import { listTranscripts } from '../agent-time/store.ts'
|
|
14
|
+
import { discoverConfigRoots } from '../reflect/prompt-corpus.ts'
|
|
15
|
+
import { liveUse } from './machine-temp.ts'
|
|
16
|
+
|
|
17
|
+
export const LANE_WORKTREES = '.claude/worktrees'
|
|
18
|
+
/** the ignored files a worktree may lose: what an install, a gate or a scratch makes again. Anything else ignored (a
|
|
19
|
+
* review, a reflection, a local secret, a build output) keeps it */
|
|
20
|
+
export const DISPOSABLE: readonly RegExp[] = [/(^|\/)node_modules(\/|$)/, /^\.shipkit\/(tmp|cache)(\/|$)/, /^\.shipkit\/STATUS[^/]*\.md$/, /(^|\/)\.DS_Store$/]
|
|
21
|
+
|
|
22
|
+
/** a worktree nothing touched for this long is idle: the daemon's wait */
|
|
23
|
+
export const WORKTREE_IDLE_MS = 24 * 3_600_000
|
|
24
|
+
|
|
25
|
+
/** what the machine says of a worktree: why something live uses it (else null), and its last act an agent wrote */
|
|
26
|
+
export interface Probe {
|
|
27
|
+
held: (path: string) => string | null
|
|
28
|
+
lastAct: (path: string) => number
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface TidyOptions {
|
|
32
|
+
now?: number
|
|
33
|
+
/** name what would go, remove nothing */
|
|
34
|
+
dry?: boolean
|
|
35
|
+
/** the idle wait; 0 right after a merge, where the orchestrator knows the lane ended */
|
|
36
|
+
idleMs?: number
|
|
37
|
+
/** only these worktrees (their paths as git lists them), not every one of the repos */
|
|
38
|
+
only?: ReadonlySet<string>
|
|
39
|
+
/** the live processes and agents, read once and only when a worktree passed every git check; null when they
|
|
40
|
+
* cannot be read, and then nothing goes */
|
|
41
|
+
use?: (worktrees: string[], now: number) => Probe | null
|
|
42
|
+
/** the user's home: its transcripts, its bun links and bun's cache */
|
|
43
|
+
home: string
|
|
44
|
+
print: (l: string) => void
|
|
45
|
+
printErr?: (l: string) => void
|
|
46
|
+
/** the git every question and removal goes through: the door by default */
|
|
47
|
+
git?: GitIo
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface Verdict {
|
|
51
|
+
repo: string
|
|
52
|
+
path: string
|
|
53
|
+
branch: string | null
|
|
54
|
+
go: boolean
|
|
55
|
+
/** removed (false on --dry, or when git refused) */
|
|
56
|
+
done: boolean
|
|
57
|
+
why: string
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
type Listed = { path: string; head: string; branch: string | null; locked: boolean; prunable: boolean }
|
|
61
|
+
|
|
62
|
+
const run = (cwd: string, args: string[], git: GitIo = realGit): { code: number; out: string } => {
|
|
63
|
+
const r = git.runSync(cwd, ['--no-optional-locks', ...args])
|
|
64
|
+
return { code: r.code, out: `${r.out}${r.code === 0 ? '' : r.err}`.trim() }
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** the repo's main checkout and its worktrees under `.claude/worktrees/`, from any of its checkouts */
|
|
68
|
+
export function laneWorktrees(dir: string, git: GitIo = realGit): { main: string; trees: Listed[] } | null {
|
|
69
|
+
const r = run(dir, ['worktree', 'list', '--porcelain'], git)
|
|
70
|
+
if (r.code !== 0) return null
|
|
71
|
+
const all = r.out.split('\n\n').map((b): Listed => {
|
|
72
|
+
const l = b.split('\n')
|
|
73
|
+
const val = (k: string): string | null => l.find((x) => x === k || x.startsWith(`${k} `))?.slice(k.length + 1) ?? null
|
|
74
|
+
const ref = val('branch')
|
|
75
|
+
return { path: val('worktree') ?? '', head: val('HEAD') ?? '', branch: ref?.replace(/^refs\/heads\//, '') ?? null, locked: val('locked') != null, prunable: val('prunable') != null }
|
|
76
|
+
})
|
|
77
|
+
const main = all[0]?.path
|
|
78
|
+
if (main == null || main === '') return null
|
|
79
|
+
const under = join(main, LANE_WORKTREES) + '/'
|
|
80
|
+
return { main, trees: all.slice(1).filter((t) => t.path.startsWith(under)) }
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const mainBranchOf = (main: string, git: GitIo): string | null => ['main', 'master'].find((b) => run(main, ['rev-parse', '--verify', '-q', `refs/heads/${b}`], git).code === 0) ?? null
|
|
84
|
+
|
|
85
|
+
const ago = (ms: number): string => (ms >= 2 * 86_400_000 ? `${Math.floor(ms / 86_400_000)} d` : ms >= 3_600_000 ? `${Math.floor(ms / 3_600_000)} h` : `${Math.max(0, Math.floor(ms / 60_000))} min`)
|
|
86
|
+
|
|
87
|
+
/** the git side of a worktree: why it stays, or what makes it safe to remove and when it last moved */
|
|
88
|
+
function judge(main: string, mainBranch: string, t: Listed, git: GitIo): { stay: string } | { safe: string; at: number } {
|
|
89
|
+
if (t.locked) return { stay: 'locked' }
|
|
90
|
+
if (t.prunable || !existsSync(t.path)) return { stay: 'its folder is gone: git worktree prune is the owner\'s' }
|
|
91
|
+
// the untracked mode named, never the repo's status.showUntrackedFiles: `no` there would hide a new file
|
|
92
|
+
const st = run(t.path, ['status', '--porcelain', '--ignored', '--untracked-files=normal'], git)
|
|
93
|
+
if (st.code !== 0) return { stay: `git status failed: ${st.out.split('\n')[0]}` }
|
|
94
|
+
const lines = st.out === '' ? [] : st.out.split('\n')
|
|
95
|
+
const n = lines.filter((l) => !l.startsWith('!! ')).length
|
|
96
|
+
if (n > 0) return { stay: `${n} change${n === 1 ? '' : 's'} not committed` }
|
|
97
|
+
const kept = lines.map((l) => l.slice(3).replace(/^"|"$/g, '')).filter((f) => !DISPOSABLE.some((d) => d.test(f)))
|
|
98
|
+
if (kept.length > 0) return { stay: `ignored files git would delete with it: ${kept.slice(0, 3).join(', ')}${kept.length > 3 ? ` and ${kept.length - 3} more` : ''}` }
|
|
99
|
+
const not = commitsNotIn(main, mainBranch, t.branch ?? t.head, git)
|
|
100
|
+
if ('error' in not) return { stay: not.error }
|
|
101
|
+
if (not.left > 0) return { stay: `${not.left} commit${not.left === 1 ? '' : 's'} not in ${mainBranch}` }
|
|
102
|
+
const safe = not.ahead > 0 ? `every commit patch equivalent in ${mainBranch}` : `its commits are all in ${mainBranch}`
|
|
103
|
+
// when it last moved: its HEAD, index and reflog (a commit writes it) in its git dir, named by its `.git` file
|
|
104
|
+
let gitDir = ''
|
|
105
|
+
try { gitDir = resolve(t.path, /^gitdir: (.*)$/m.exec(readFileSync(join(t.path, '.git'), 'utf8'))?.[1] ?? '') } catch {}
|
|
106
|
+
if (gitDir === '') return { stay: 'its .git file names no git dir' }
|
|
107
|
+
const times = [join(gitDir, 'HEAD'), join(gitDir, 'index'), join(gitDir, 'logs', 'HEAD'), t.path].map((p) => { try { return statSync(p).mtimeMs } catch { return 0 } })
|
|
108
|
+
return { safe, at: Math.max(...times) }
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** every lane worktree of these repos judged, and removed unless dry; each removal said in one line */
|
|
112
|
+
export async function tidyWorktrees(repos: readonly string[], o: TidyOptions): Promise<Verdict[]> {
|
|
113
|
+
const now = o.now ?? Date.now()
|
|
114
|
+
const idle = o.idleMs ?? WORKTREE_IDLE_MS
|
|
115
|
+
const git = o.git ?? realGit
|
|
116
|
+
const out: Verdict[] = []
|
|
117
|
+
const passed: { v: Verdict; at: number; safe: string; main: string }[] = []
|
|
118
|
+
const seen = new Set<string>()
|
|
119
|
+
for (const repo of repos) {
|
|
120
|
+
const l = laneWorktrees(repo, git)
|
|
121
|
+
if (l == null || seen.has(l.main)) continue
|
|
122
|
+
seen.add(l.main)
|
|
123
|
+
if (l.trees.length === 0) continue
|
|
124
|
+
const mainBranch = mainBranchOf(l.main, git)
|
|
125
|
+
for (const t of l.trees.filter((x) => o.only == null || o.only.has(realOf(x.path)))) {
|
|
126
|
+
const v: Verdict = { repo: l.main, path: t.path, branch: t.branch, go: false, done: false, why: '' }
|
|
127
|
+
out.push(v)
|
|
128
|
+
const j = mainBranch == null ? { stay: 'the repo has no main or master branch' } : judge(l.main, mainBranch, t, git)
|
|
129
|
+
if ('stay' in j) v.why = j.stay
|
|
130
|
+
else passed.push({ v, at: j.at, safe: j.safe, main: l.main })
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (passed.length === 0) return out
|
|
134
|
+
const use = (o.use ?? liveWorktreeUse(o.home))(passed.map((p) => p.v.path), now)
|
|
135
|
+
let removed = 0
|
|
136
|
+
for (const p of passed) {
|
|
137
|
+
const { v } = p
|
|
138
|
+
const held = use == null ? 'the live processes cannot be read' : use.held(v.path)
|
|
139
|
+
if (held != null || use == null) { v.why = held ?? ''; continue }
|
|
140
|
+
const at = Math.max(p.at, use.lastAct(v.path))
|
|
141
|
+
if (now - at < idle) { v.why = `active ${ago(now - at)} ago, idle ${ago(idle)} first`; continue }
|
|
142
|
+
v.go = true
|
|
143
|
+
v.why = p.safe
|
|
144
|
+
const name = `${basename(v.repo)}/${LANE_WORKTREES}/${v.path.slice(join(v.repo, LANE_WORKTREES).length + 1)}`
|
|
145
|
+
const says = `${v.why}, idle ${ago(now - at)}`
|
|
146
|
+
if (o.dry === true) { o.print(`would remove ${name}: ${says}${v.branch ? `, then its branch ${v.branch}` : ''}`); continue }
|
|
147
|
+
const rm = run(v.repo, ['worktree', 'remove', v.path], git)
|
|
148
|
+
if (rm.code !== 0) {
|
|
149
|
+
v.why = `git worktree remove refused: ${rm.out.split('\n')[0]}`
|
|
150
|
+
;(o.printErr ?? o.print)(`WARN worktree tidy: ${name} stays, ${v.why}`)
|
|
151
|
+
continue
|
|
152
|
+
}
|
|
153
|
+
v.done = true
|
|
154
|
+
removed++
|
|
155
|
+
let branch = ''
|
|
156
|
+
if (v.branch != null) {
|
|
157
|
+
const b = run(v.repo, ['branch', '-d', v.branch], git)
|
|
158
|
+
branch = b.code === 0 ? `; branch ${v.branch} deleted` : `; branch ${v.branch} kept: git branch -d refused (${b.out.split('\n')[0]})`
|
|
159
|
+
}
|
|
160
|
+
o.print(`ok: worktree tidy: removed ${name}: ${says}${branch}`)
|
|
161
|
+
}
|
|
162
|
+
// bun's transpiler cache keys a file by its bytes: a file of the main checkout identical to one of a removed
|
|
163
|
+
// worktree comes back with its imports resolved into the gone tree (wiki patterns/typescript/index.md, Toolchain)
|
|
164
|
+
if (removed > 0 && process.platform === 'darwin') rmSync(join(o.home, 'Library/Caches/bun/@t@'), { recursive: true, force: true })
|
|
165
|
+
return out
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** a path as the disk resolves it, else as given */
|
|
169
|
+
export const realOf = (p: string): string => { try { return realpathSync(p) } catch { return p } }
|
|
170
|
+
|
|
171
|
+
const inside = (p: string, dir: string): boolean => p === dir || p.startsWith(`${dir}/`)
|
|
172
|
+
|
|
173
|
+
/** the cwd lines of a transcript: its first agent's folder and where its last lines worked */
|
|
174
|
+
function cwdsOf(path: string): string[] {
|
|
175
|
+
try {
|
|
176
|
+
const size = statSync(path).size
|
|
177
|
+
const fd = openSync(path, 'r')
|
|
178
|
+
try {
|
|
179
|
+
const read = (at: number, len: number): string => {
|
|
180
|
+
const buf = Buffer.alloc(len)
|
|
181
|
+
return buf.subarray(0, readSync(fd, buf, 0, len, at)).toString('utf8')
|
|
182
|
+
}
|
|
183
|
+
const head = read(0, Math.min(size, 16 * 1024))
|
|
184
|
+
const tail = size > 16 * 1024 ? read(Math.max(16 * 1024, size - 32 * 1024), Math.min(size - 16 * 1024, 32 * 1024)) : ''
|
|
185
|
+
return [...new Set([...`${head}\n${tail}`.matchAll(/"cwd":"([^"]+)"/g)].map((m) => m[1]!))]
|
|
186
|
+
} finally {
|
|
187
|
+
closeSync(fd)
|
|
188
|
+
}
|
|
189
|
+
} catch {
|
|
190
|
+
return []
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/** the transcripts that worked in a folder: the latest one's time, and whether an agent still runs there (its tail is
|
|
195
|
+
* no hand back, nor an ended turn of a lane with no hand back tool, and it wrote within the lanes' idle time) */
|
|
196
|
+
export function transcriptUse(files: readonly { path: string; mtime: number }[], now: number): (path: string) => { at: number; running: boolean } | null {
|
|
197
|
+
const read = files.map((f) => ({ ...f, cwds: cwdsOf(f.path) }))
|
|
198
|
+
return (path) => {
|
|
199
|
+
const there = read.filter((f) => f.cwds.some((c) => inside(c, path)))
|
|
200
|
+
if (there.length === 0) return null
|
|
201
|
+
return { at: Math.max(...there.map((f) => f.mtime)), running: there.some((f) => now - f.mtime < LANE_IDLE_MS && laneRunning(f.path)) }
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** the machine's probe: what live processes hold (lsof and ps), a bun link into a worktree, a transcript that still works
|
|
206
|
+
* there. Transcripts written within the idle window are read, so the idle date counts an agent's last act too */
|
|
207
|
+
export function liveWorktreeUse(home: string): NonNullable<TidyOptions['use']> {
|
|
208
|
+
return (worktrees, now) => {
|
|
209
|
+
const roots = [...new Set(worktrees.map((w) => resolve(w, '..')))]
|
|
210
|
+
const procs = liveUse(roots)
|
|
211
|
+
if (procs == null) return null
|
|
212
|
+
const recent = listTranscripts(discoverConfigRoots(home)).filter((f) => now - f.mtime < WORKTREE_IDLE_MS)
|
|
213
|
+
const agents = transcriptUse(recent, now)
|
|
214
|
+
const links = bunLinks(home)
|
|
215
|
+
return {
|
|
216
|
+
held: (path) => {
|
|
217
|
+
if (agents(path)?.running === true) return 'a Claude Code agent still works in it'
|
|
218
|
+
const link = links.find((l) => inside(l.to, path))
|
|
219
|
+
return procs(path) ?? (link == null ? null : `bun link ${link.name} points into it`)
|
|
220
|
+
},
|
|
221
|
+
lastAct: (path) => agents(path)?.at ?? 0,
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/** the global bun links: a consumer repo linked to a lib resolves into the folder its link names */
|
|
227
|
+
function bunLinks(home: string): { name: string; to: string }[] {
|
|
228
|
+
const dir = join(home, '.bun/install/global/node_modules')
|
|
229
|
+
let names: string[]
|
|
230
|
+
try { names = readdirSync(dir) } catch { return [] }
|
|
231
|
+
const out: { name: string; to: string }[] = []
|
|
232
|
+
for (const n of names.flatMap((n) => (n.startsWith('@') ? (() => { try { return readdirSync(join(dir, n)).map((s) => `${n}/${s}`) } catch { return [] } })() : [n]))) {
|
|
233
|
+
try { out.push({ name: n, to: resolve(dir, readlinkSync(join(dir, n))) }) } catch { /* not a link */ }
|
|
234
|
+
}
|
|
235
|
+
return out
|
|
236
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// the edit guard's wiring in a repo's settings, pure: SK013 installs it and is a cached check (no fs here), and the
|
|
2
|
+
// shared-file gate reads it
|
|
3
|
+
|
|
4
|
+
/** the matcher the edit guard sees edits under: a hand written persona or value proposition (messages/guard.ts), and
|
|
5
|
+
* each edit noted for the shared-file gate (shared-file.ts); SK013 installs it */
|
|
6
|
+
export const EDIT_MATCHER = 'Edit|Write|MultiEdit'
|
|
7
|
+
|
|
8
|
+
type Settings = { hooks?: Record<string, Array<{ matcher?: string; hooks?: Array<{ command?: string }> }>> }
|
|
9
|
+
|
|
10
|
+
/** the settings run the edit guard on edits: without it no edit is noted, and the gate has nothing to judge */
|
|
11
|
+
export const hasEditGuard = (s: Settings): boolean =>
|
|
12
|
+
(s.hooks?.['PreToolUse'] ?? []).some((m) => m.matcher === EDIT_MATCHER && (m.hooks ?? []).some((h) => h.command?.includes('one-way-in-guard') === true))
|
package/src/hooks/hook-gates.ts
CHANGED
|
@@ -13,11 +13,13 @@ export type HookGate = { id: string; hook: HookName; title: string; description:
|
|
|
13
13
|
|
|
14
14
|
export const HOOK_GATES = [
|
|
15
15
|
{ id: 'tree-shrink', hook: 'pre-commit', title: 'tree shrink', description: 'the commit keeps at least half of the files HEAD tracks' },
|
|
16
|
+
{ id: 'shared-file', hook: 'pre-commit', title: 'shared file', description: 'no staged file holds the hunks of another agent that wrote it since its last commit' },
|
|
16
17
|
{ id: 'leak-guard', hook: 'both', title: 'leak guard', description: 'no staged added line, staged path or commit message matches a banned keyword' },
|
|
17
18
|
{ id: 'blocked-paths', hook: 'pre-commit', title: 'blocked paths', description: 'nothing under a hooks.blockedPaths prefix is staged' },
|
|
18
19
|
{ id: 'root-identity', hook: 'pre-commit', title: 'root identity', description: 'the repo name in package.json and repo.config.ts holds, and no scratch file is staged' },
|
|
19
20
|
{ id: 'commit-message', hook: 'commit-msg', title: 'commit message', description: 'the commit message carries no dash punctuation and no French' },
|
|
20
21
|
{ id: 'commit-language', hook: 'commit-msg', title: 'commit language', description: 'the commit message carries no French, the half of commit-message that off lifts alone' },
|
|
22
|
+
{ id: 'reflection-trailer', hook: 'commit-msg', title: 'reflection trailer', description: 'each Fixes-reflection or Declines-reflection line names an open reflection; post-commit closes it' },
|
|
21
23
|
] as const satisfies readonly HookGate[]
|
|
22
24
|
|
|
23
25
|
export type HookGateId = (typeof HOOK_GATES)[number]['id']
|
package/src/hooks/leak-guard.ts
CHANGED
|
@@ -84,8 +84,13 @@ export type ParsedPatterns = {
|
|
|
84
84
|
substrings: string[]
|
|
85
85
|
words: { word: string; re: RegExp }[]
|
|
86
86
|
regexes: { row: string; re: RegExp }[]
|
|
87
|
+
/** a `re:` row that does not compile: it scans nothing, so the guard says it, and every other row still runs */
|
|
88
|
+
bad: { row: string; why: string }[]
|
|
87
89
|
}
|
|
88
90
|
|
|
91
|
+
/** the warning line of a bad row, one shape for the commit guard and SK035 */
|
|
92
|
+
export const badRowNote = (b: { row: string; why: string }): string => `a keyword row does not compile, so it scans nothing: ${b.row} (${b.why}); fix it in the keyword file`
|
|
93
|
+
|
|
89
94
|
const escapeRegex = (s: string): string => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
90
95
|
|
|
91
96
|
/** a key shape is a token, so it starts where a token starts: `ask-the-...`
|
|
@@ -140,6 +145,7 @@ export function parsePatterns(text: string): ParsedPatterns {
|
|
|
140
145
|
const substrings: string[] = []
|
|
141
146
|
const words: { word: string; re: RegExp }[] = []
|
|
142
147
|
const regexes: { row: string; re: RegExp }[] = []
|
|
148
|
+
const bad: { row: string; why: string }[] = []
|
|
143
149
|
for (const raw of text.split('\n')) {
|
|
144
150
|
const row = raw.trim()
|
|
145
151
|
if (row === '' || row.startsWith('#')) continue
|
|
@@ -148,7 +154,7 @@ export function parsePatterns(text: string): ParsedPatterns {
|
|
|
148
154
|
// name carries); every other regex row is case-insensitive
|
|
149
155
|
const source = SEEDED_ROW_FIXES[row] ?? row
|
|
150
156
|
try { regexes.push({ row, re: new RegExp(source.slice(3), SECRET_ROWS.includes(source) ? '' : 'i') }) }
|
|
151
|
-
catch {
|
|
157
|
+
catch (e) { bad.push({ row, why: e instanceof Error ? e.message : String(e) }) }
|
|
152
158
|
} else if (row.startsWith('w:')) {
|
|
153
159
|
const word = row.slice(2).trim().toLowerCase()
|
|
154
160
|
// \b is ascii-only in JS, which lets an accented name match inside
|
|
@@ -156,7 +162,7 @@ export function parsePatterns(text: string): ParsedPatterns {
|
|
|
156
162
|
if (word !== '') words.push({ word, re: new RegExp(`(?<![\\p{L}\\p{N}_])${escapeRegex(word)}(?![\\p{L}\\p{N}_])`, 'giu') })
|
|
157
163
|
} else substrings.push(row.toLowerCase())
|
|
158
164
|
}
|
|
159
|
-
return { substrings, words, regexes }
|
|
165
|
+
return { substrings, words, regexes, bad }
|
|
160
166
|
}
|
|
161
167
|
|
|
162
168
|
/** the keyword text a scan reads: the built-in secret shapes, then the files' rows */
|
|
@@ -442,7 +448,7 @@ export function runLeakGuard(root: string, o: LeakGuardOpts = {}): LeakGuardResu
|
|
|
442
448
|
const patterns = parsePatterns(withBuiltinRows(sources.map((f) => readFileSync(f, 'utf8'))))
|
|
443
449
|
const count = patterns.substrings.length + patterns.words.length + patterns.regexes.length
|
|
444
450
|
|
|
445
|
-
const notes: string[] =
|
|
451
|
+
const notes: string[] = patterns.bad.map(badRowNote)
|
|
446
452
|
const allow: LoadedAllow[] = []
|
|
447
453
|
;(o.allow ?? []).forEach((e, i) => {
|
|
448
454
|
const problem = leakAllowProblem(e, `repo.config.ts hooks.leakAllow[${i}]`, true)
|
|
@@ -6,24 +6,54 @@
|
|
|
6
6
|
// sends it looking for another way in. It also refuses a gate piped into
|
|
7
7
|
// another command, whose exit code the pipe hides, a `git stash` in the
|
|
8
8
|
// forms the deny row cannot see, and a wait loop on `pgrep -f` (core/polling-policy.ts).
|
|
9
|
+
// On an Edit, a Write or a MultiEdit it refuses one thing: an agent's new persona or value proposition written by
|
|
10
|
+
// hand into the messages store (messages/guard.ts), which goes to the owner in a thread instead. Every other edit
|
|
11
|
+
// it lets through, it notes in one append for the commit gate that refuses another writer's hunks (shared-file.ts).
|
|
9
12
|
//
|
|
10
|
-
// It runs before EVERY Bash call, so it stays a leaf: one tiny import, one
|
|
13
|
+
// It runs before EVERY Bash call and every edit, so it stays a leaf: one tiny import, one
|
|
11
14
|
// small json read, no clipanion, no repo config. Anything it cannot decide it
|
|
12
15
|
// waves through, because a guard that fails closed on its own bugs would wedge
|
|
13
16
|
// a repo with no way to tell why, and `permissions.deny` is still the floor
|
|
14
17
|
// underneath it. Measured at ~10ms per call.
|
|
15
18
|
import { pgrepWaitIn, pgrepWaitRefusal } from '../core/polling-policy.ts'
|
|
16
19
|
import { deniedHeads, GIT_STASH_HEAD, pipedGateIn, pipedGateRefusal, rawRunnerHit, refusal, stashCallIn, stashRefusal, staleScopedRefusal } from '../core/one-way-in-policy.ts'
|
|
20
|
+
import { afterEdit, bashHandWriteRefusal, handWriteRefusal, STORE_FILE } from '../messages/guard.ts'
|
|
21
|
+
import { noteWrite, writeOf } from './shared-file.ts'
|
|
17
22
|
|
|
18
23
|
const input = await Bun.stdin.text()
|
|
19
24
|
let command = ''
|
|
20
25
|
try {
|
|
21
|
-
const ev = JSON.parse(input) as { tool_name?: string; tool_input?: { command?: string } }
|
|
26
|
+
const ev = JSON.parse(input) as { tool_name?: string; session_id?: unknown; agent_id?: unknown; transcript_path?: unknown; tool_input?: { command?: string } & Record<string, unknown> }
|
|
27
|
+
// on an edit, the one refusal is an agent's new persona or value proposition written by hand (messages/guard.ts)
|
|
28
|
+
if (ev.tool_name === 'Edit' || ev.tool_name === 'Write' || ev.tool_name === 'MultiEdit') {
|
|
29
|
+
const path = typeof ev.tool_input?.file_path === 'string' ? ev.tool_input.file_path : ''
|
|
30
|
+
const write = writeOf(ev, path)
|
|
31
|
+
// every edit is noted for the commit gate that refuses another writer's hunks (hooks/shared-file.ts)
|
|
32
|
+
if (!STORE_FILE.test(path)) {
|
|
33
|
+
if (write != null) noteWrite(write)
|
|
34
|
+
process.exit(0)
|
|
35
|
+
}
|
|
36
|
+
const file = Bun.file(path)
|
|
37
|
+
const before = (await file.exists()) ? await file.text() : ''
|
|
38
|
+
const after = afterEdit(ev.tool_name, ev.tool_input ?? {}, before)
|
|
39
|
+
const why = after == null ? null : handWriteRefusal(path, before, after)
|
|
40
|
+
if (why != null) {
|
|
41
|
+
console.error(why)
|
|
42
|
+
process.exit(2)
|
|
43
|
+
}
|
|
44
|
+
if (write != null) noteWrite(write)
|
|
45
|
+
process.exit(0)
|
|
46
|
+
}
|
|
22
47
|
if (ev.tool_name !== 'Bash') process.exit(0)
|
|
23
48
|
command = ev.tool_input?.command ?? ''
|
|
24
49
|
} catch {
|
|
25
50
|
process.exit(0)
|
|
26
51
|
}
|
|
52
|
+
const handWrite = bashHandWriteRefusal(command)
|
|
53
|
+
if (handWrite != null) {
|
|
54
|
+
console.error(handWrite)
|
|
55
|
+
process.exit(2)
|
|
56
|
+
}
|
|
27
57
|
const loop = pgrepWaitIn(command)
|
|
28
58
|
if (loop != null) {
|
|
29
59
|
console.error(pgrepWaitRefusal(loop))
|
package/src/hooks/run-hooks.ts
CHANGED
|
@@ -7,16 +7,17 @@ import { existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from
|
|
|
7
7
|
import { dirname, join, relative } from 'path'
|
|
8
8
|
import { fileURLToPath } from 'url'
|
|
9
9
|
import { KEYWORD_FILE, LAYOUT } from '../core/layout.ts'
|
|
10
|
-
import { commitMessageOffenses } from './commit-message.ts'
|
|
10
|
+
import { commitMessageOffenses, stripNonMessage } from './commit-message.ts'
|
|
11
11
|
import { globalAllowFile, globalKeywordFile, maskPattern, patternFingerprint, runLeakGuard, type LeakAllowEntry, type LeakHit, type LeakWaiver } from './leak-guard.ts'
|
|
12
12
|
import { runRootIdentity } from './root-identity.ts'
|
|
13
13
|
import { readStaged } from './staged.ts'
|
|
14
14
|
import { ALLOW_MASS_DELETE, runTreeShrink } from './tree-shrink.ts'
|
|
15
|
+
import { COMMIT_WITH, runSharedFile } from './shared-file.ts'
|
|
15
16
|
import { gitRoot } from '../core/git-root.ts'
|
|
16
17
|
import { spawnWithTimeout } from '../core/spawn-timeout.ts'
|
|
17
18
|
import type { RepoConfig } from '../repo-config.ts'
|
|
18
19
|
import { gitBin } from '../core/git-bin.ts'
|
|
19
|
-
import { discoverPreCommit, SLOW_IMPORT_MS } from '../
|
|
20
|
+
import { discoverPreCommit, SLOW_IMPORT_MS } from '../gate/pre-commit-discovery.ts'
|
|
20
21
|
import { CheckCtx } from '../core/check-ctx.ts'
|
|
21
22
|
import { CheckPass } from '../core/check-pass.ts'
|
|
22
23
|
import { runCheckBody, type CheckDef } from '../check.ts'
|
|
@@ -68,7 +69,10 @@ export type HooksConfig = {
|
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
const HOOK_DIR = LAYOUT.hooks
|
|
71
|
-
const HOOKS = ['pre-commit', 'commit-msg'] as const
|
|
72
|
+
const HOOKS = ['pre-commit', 'commit-msg', 'post-commit'] as const
|
|
73
|
+
|
|
74
|
+
/** a commit with no close trailer never boots bun: the grep is the whole hook */
|
|
75
|
+
const CLOSE_TRAILER_GREP = "git log -1 --format=%B | grep -qiE '^(Fixes|Declines)-reflection:' || exit 0"
|
|
72
76
|
|
|
73
77
|
/** how a self-written hook body should invoke shipkit in this repo: the
|
|
74
78
|
* repo's own node_modules copy when it has one (survives shim churn, pins
|
|
@@ -84,7 +88,7 @@ export function hookBinInvocation(root: string): string {
|
|
|
84
88
|
export type ArmHooksResult = { state: 'armed' | 'current' | 'foreign' | 'no-git' | 'not-root' | 'failed'; detail: string }
|
|
85
89
|
|
|
86
90
|
/** self-arming: a repo.config with dark commit gates is the half-wired state
|
|
87
|
-
*
|
|
91
|
+
* in which a whole session commits ungated. Arming means
|
|
88
92
|
* making DARK gates live: with BOTH hook files present under an armed
|
|
89
93
|
* hooksPath nothing is rewritten (the repo's own --bin choice stands; a
|
|
90
94
|
* missing file still triggers install, which overwrites a stale sibling). A FOREIGN
|
|
@@ -138,7 +142,9 @@ export function installHooks(root: string, binInvocation: string, keywordFile?:
|
|
|
138
142
|
for (const h of HOOKS) {
|
|
139
143
|
const body = h === 'commit-msg'
|
|
140
144
|
? `#!/bin/sh\nexec ${binInvocation} hooks commit-msg "$1"\n`
|
|
141
|
-
:
|
|
145
|
+
: h === 'post-commit'
|
|
146
|
+
? `#!/bin/sh\n${CLOSE_TRAILER_GREP}\nexec ${binInvocation} hooks post-commit\n`
|
|
147
|
+
: `#!/bin/sh\nexec ${binInvocation} hooks pre-commit\n`
|
|
142
148
|
const path = join(dir, h)
|
|
143
149
|
const prev = existsSync(path) ? readFileSync(path, 'utf8') : ''
|
|
144
150
|
if (prev !== body) { writeFileSync(path, body, { mode: 0o755 }); written.push(`${HOOK_DIR}/${h}`) }
|
|
@@ -238,6 +244,28 @@ export async function runPreCommit(root: string, config: RepoConfig): Promise<Ga
|
|
|
238
244
|
],
|
|
239
245
|
})
|
|
240
246
|
}
|
|
247
|
+
if (!off('shared-file')) {
|
|
248
|
+
const r = await runSharedFile(root, staged)
|
|
249
|
+
if (r.status === 'skipped') out.push({ id: 'shared-file', ok: true, lines: [`skip: shared-file (${r.reason})`] })
|
|
250
|
+
else if (r.status === 'clean') out.push({
|
|
251
|
+
id: 'shared-file',
|
|
252
|
+
ok: true,
|
|
253
|
+
lines: r.joint.length === 0
|
|
254
|
+
? ['ok: shared-file, no staged file holds another writer\'s hunks']
|
|
255
|
+
: [`ok: shared-file, a joint commit (${COMMIT_WITH})`, ...r.joint.map((f) => ` ${f.path}: ${f.writers.join(', ')}`)],
|
|
256
|
+
})
|
|
257
|
+
else out.push({
|
|
258
|
+
id: 'shared-file',
|
|
259
|
+
ok: false,
|
|
260
|
+
lines: [
|
|
261
|
+
`FAIL: ${r.files.length} staged file(s) hold another writer's hunks, and a commit takes the whole file`,
|
|
262
|
+
...r.files.map((f) => ` ${f.path}: written since its last commit by ${f.writers.join(', ')}`),
|
|
263
|
+
` fix: commit only the files whose every hunk is yours (git diff -- <file>); every writer of such a file is refused`,
|
|
264
|
+
` one commit takes the work of all: on the orchestrator's word, or when the others are gone (sk lanes no longer shows them),`,
|
|
265
|
+
` the committer names the others as printed above: ${COMMIT_WITH}=<name>,<name> git commit ...`,
|
|
266
|
+
],
|
|
267
|
+
})
|
|
268
|
+
}
|
|
241
269
|
if (!off('leak-guard')) {
|
|
242
270
|
const r = runLeakGuard(root, { keywordFile: h.keywordFile, allow: h.leakAllow, stagedNames: staged.names })
|
|
243
271
|
if (r.status === 'skipped') out.push({ id: 'leak-guard', ok: true, lines: [`skip: leak-guard (${r.reason})`] })
|
|
@@ -391,6 +419,14 @@ export async function runCommitMsg(root: string, config: RepoConfig, messageFile
|
|
|
391
419
|
else if (r.status === 'clean' && r.waived.length > 0)
|
|
392
420
|
out.push({ id: 'leak-guard', ok: true, lines: [`ok: leak-guard clean in the commit message (${r.waived.length} waived)`, ...waivedLines(r.waived)] })
|
|
393
421
|
}
|
|
422
|
+
if (hookGateOff(config, 'reflection-trailer') == null && /^(Fixes|Declines)-reflection:/im.test(message)) {
|
|
423
|
+
const { machinePlaces, trailerErrors } = await import('../reflections/reflection-close.ts')
|
|
424
|
+
const places = await machinePlaces(root)
|
|
425
|
+
const errors = places === null ? ['no house repo on this machine: a reflection closes where its house is'] : trailerErrors(stripNonMessage(message), places)
|
|
426
|
+
out.push(errors.length === 0
|
|
427
|
+
? { id: 'reflection-trailer', ok: true, lines: ['ok: reflection trailers name open reflections'] }
|
|
428
|
+
: { id: 'reflection-trailer', ok: false, lines: [`FAIL: reflection-trailer: ${errors.length} trailer(s) name no open reflection`, ...errors.map((e) => ` ${e}`)] })
|
|
429
|
+
}
|
|
394
430
|
for (const c of h.commitMsg ?? []) {
|
|
395
431
|
const r = await spawnWithTimeout([...c.cmd, messageFile], { cwd: root, timeoutMs: 60_000 })
|
|
396
432
|
out.push({
|
|
@@ -402,6 +438,21 @@ export async function runCommitMsg(root: string, config: RepoConfig, messageFile
|
|
|
402
438
|
return out
|
|
403
439
|
}
|
|
404
440
|
|
|
441
|
+
/** the post-commit hook: each reflection a close trailer of HEAD names is acked (reflections/reflection-close.ts). It never
|
|
442
|
+
* fails the commit, which is made: a close that could not run says so loudly, and the next commit's trailer retries it */
|
|
443
|
+
export async function runPostCommit(root: string): Promise<string[]> {
|
|
444
|
+
const log = Bun.spawnSync([gitBin(), 'log', '-1', '--format=%H%n%s%n%B'], { cwd: root })
|
|
445
|
+
if (log.exitCode !== 0) return [`WARN post-commit: git log failed: ${log.stderr.toString().trim()}`]
|
|
446
|
+
const [sha = '', subject = '', ...body] = log.stdout.toString().split('\n')
|
|
447
|
+
const { closeReflections, machinePlaces } = await import('../reflections/reflection-close.ts')
|
|
448
|
+
const places = await machinePlaces(root)
|
|
449
|
+
if (places === null) return ['WARN post-commit: no house repo on this machine, no reflection closed']
|
|
450
|
+
const by = process.env.SK_AGENT?.trim()
|
|
451
|
+
return closeReflections(body.join('\n'), { sha, subject, ...(by ? { by } : {}) }, places).map((c) =>
|
|
452
|
+
c.state === 'failed' ? `FAIL: reflection ${c.key} not closed: ${c.detail}` : `ok: reflection ${c.key} ${c.state === 'already' ? 'closed already' : c.verb}, moved to ${c.detail}`,
|
|
453
|
+
)
|
|
454
|
+
}
|
|
455
|
+
|
|
405
456
|
/** what blocks a commit here, the enumeration hand-rolled hooks never had.
|
|
406
457
|
* A gate the repo turned off stays listed, with the reason `off` gives it */
|
|
407
458
|
export function listGates(config: RepoConfig, root = process.cwd(), checks: { id: string; budgetMs: number }[] = []): string[] {
|
|
@@ -424,12 +475,14 @@ export function listGates(config: RepoConfig, root = process.cwd(), checks: { id
|
|
|
424
475
|
...((h.blockedPaths ?? []).length > 0 ? [`pre-commit blocked-paths${offWord('blocked-paths')} — nothing under ${h.blockedPaths!.join(', ')} enters git${draftsOpen(config) && blockedStaged([COMFY_DRAFTS], config).length === 0 && h.blockedPaths!.some((p) => COMFY_DRAFTS.startsWith(p)) ? `, except ${COMFY_DRAFTS} (declared private)` : ''}`] : []),
|
|
425
476
|
`pre-commit root-identity${offWord('root-identity')} — the repo's own name in package.json + repo.config.ts, and scratch files`,
|
|
426
477
|
`pre-commit tree-shrink${offWord('tree-shrink')} — the commit keeps at least half of HEAD's files (${ALLOW_MASS_DELETE}=1 lifts it for one commit)`,
|
|
478
|
+
`pre-commit shared-file${offWord('shared-file')} — no staged file two agents wrote since its last commit, from Claude Code only (${COMMIT_WITH}=<lanes> for a joint commit)`,
|
|
427
479
|
...checks.map((c) => `pre-commit ${c.id} — the check, onPreCommit, budget ${c.budgetMs}ms`),
|
|
428
480
|
...(h.preCommit ?? []).map((c) => `pre-commit ${c.id} — ${c.cmd.join(' ')}`),
|
|
429
481
|
messageOff !== ''
|
|
430
482
|
? `commit-msg commit-message${messageOff} — dash punctuation + French`
|
|
431
483
|
: `commit-msg commit-message — dash punctuation + French${offWord('commit-language') === '' ? '' : ` (commit-language${offWord('commit-language')})`}`,
|
|
432
484
|
`commit-msg leak-guard${leakState} — the message text`,
|
|
485
|
+
`commit-msg reflection-trailer${offWord('reflection-trailer')} — each Fixes-reflection / Declines-reflection line names an open reflection (post-commit closes it)`,
|
|
433
486
|
...(h.commitMsg ?? []).map((c) => `commit-msg ${c.id} — ${c.cmd.join(' ')}`),
|
|
434
487
|
]
|
|
435
488
|
}
|