rvlib-shipkit 2.31.0 → 2.32.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 +31 -0
- package/package.json +1 -1
- package/src/advisors/acts.ts +16 -15
- package/src/advisors/advice.ts +56 -102
- package/src/advisors/advisor-view.ts +98 -73
- package/src/advisors/app-graph.ts +1 -1
- package/src/advisors/app.ts +3 -11
- package/src/advisors/cf-api.ts +1 -1
- package/src/advisors/dir-bucket.ts +4 -3
- package/src/advisors/edge/api.ts +26 -198
- package/src/advisors/edge/bucket.ts +2 -2
- package/src/advisors/edge/handler.ts +13 -155
- package/src/advisors/edge/here.ts +5 -5
- package/src/advisors/edge/pages.ts +12 -9
- package/src/advisors/edge/shell.ts +6 -5
- package/src/advisors/edge/sign-in.ts +101 -36
- package/src/advisors/edge/status.ts +19 -6
- package/src/advisors/edge/types.ts +36 -60
- package/src/advisors/expose.ts +29 -29
- package/src/advisors/here.ts +12 -12
- package/src/advisors/invite-send.ts +79 -35
- package/src/advisors/invite.ts +31 -8
- package/src/advisors/job.ts +24 -16
- package/src/advisors/login.ts +40 -15
- package/src/advisors/owner-store.ts +46 -22
- package/src/advisors/photos.ts +3 -3
- package/src/advisors/project.ts +25 -23
- package/src/advisors/reach.ts +89 -0
- package/src/advisors/rights.ts +1 -1
- package/src/advisors/routes.ts +55 -74
- package/src/advisors/scan.ts +0 -4
- package/src/advisors/setup-run.ts +14 -14
- package/src/advisors/share-trace.ts +3 -3
- package/src/advisors/{door-probe.ts → sign-in-probe.ts} +7 -6
- package/src/advisors/speaks.ts +29 -0
- package/src/advisors/sync.ts +92 -182
- package/src/advisors/tunnel.ts +6 -5
- package/src/advisors/users-listen.ts +92 -0
- package/src/advisors/users-router.ts +257 -85
- package/src/advisors/users-store.ts +81 -0
- package/src/agent-time/blocked-scan.ts +181 -0
- package/src/agent-time/registry.ts +12 -5
- package/src/agent-time/store.ts +9 -109
- package/src/asks/ask-bar-fold.ts +2 -1
- package/src/asks/ask-close.ts +2 -1
- package/src/asks/ask-doc.ts +2 -1
- package/src/asks/ask-migrate.ts +3 -2
- package/src/asks/ask-steps-fold.ts +2 -1
- package/src/asks/ask-store.ts +4 -3
- package/src/check.ts +3 -43
- package/src/checks/SK001-package-json-shape.check.ts +4 -55
- package/src/checks/SK004-gitignore-policy.check.ts +24 -69
- package/src/checks/SK013-one-way-in-policy.check.ts +3 -7
- package/src/checks/SK017-vscode-hub-task.check.ts +4 -4
- package/src/checks/SK019-tests-run-in-units.check.ts +3 -14
- package/src/checks/SK020-self-spawning-check.check.ts +5 -7
- package/src/checks/SK035-public-clean.check.ts +1 -1
- package/src/checks/SK039-vscode-watch-generated.check.ts +1 -1
- package/src/checks/SK042-post-kinds.check.ts +5 -14
- package/src/checks/SK054-agent-allow-list.check.ts +5 -74
- package/src/checks/SK055-retired-config-keys.check.ts +45 -0
- package/src/cli/cmd_Advisors.ts +11 -45
- package/src/cli/cmd_Asks.ts +3 -10
- package/src/cli/cmd_Backup.ts +25 -127
- package/src/cli/cmd_BackupTargets.ts +1 -1
- package/src/cli/cmd_Checks.ts +0 -14
- package/src/cli/cmd_Db.ts +3 -82
- package/src/cli/cmd_Home.ts +4 -32
- package/src/cli/cmd_Hq.ts +0 -17
- package/src/cli/cmd_Releases.ts +57 -4
- package/src/cli/cmd_Review.ts +333 -354
- package/src/cli/cmd_SocialDrafts.ts +6 -13
- package/src/cli/cmd_ThreadSyncNeeds.ts +6 -2
- package/src/cli/cmd_Time.ts +1 -1
- package/src/cli/cmd_Trailer.ts +1 -1
- package/src/cli/inbox-hook-run.ts +5 -23
- package/src/cli/registry-heads.ts +5 -55
- package/src/cli/registry.ts +1 -5
- package/src/cli/review-here.ts +1 -1
- package/src/cli.ts +2 -2
- package/src/collections/collection-types.ts +1 -1
- package/src/collections/review.ts +5 -4
- package/src/core/agent-allow-policy.ts +32 -2
- package/src/core/agent-env.ts +8 -0
- package/src/core/allow-rows.ts +74 -0
- package/src/core/check-file-names.ts +19 -106
- package/src/core/footprint.ts +17 -13
- package/src/core/identities-root.ts +1 -4
- package/src/core/layout.ts +1 -2
- package/src/core/machine-db.ts +33 -208
- package/src/core/machine-layout.ts +14 -127
- package/src/core/mask-source.ts +60 -0
- package/src/core/memory-watch.ts +17 -14
- package/src/core/motherhome.ts +8 -35
- package/src/core/one-way-in-policy.ts +0 -3
- package/src/core/repo-walk.ts +0 -9
- package/src/core/retention.ts +1 -9
- package/src/core/retired-checks.ts +2 -0
- package/src/core/tmux-policy.ts +1 -1
- package/src/core/tree-watch.ts +2 -2
- package/src/core/when.ts +7 -45
- package/src/gate/discover-checks.ts +42 -32
- package/src/gate/gate-checks.ts +21 -131
- package/src/gate/pre-commit-discovery.ts +16 -25
- package/src/gate/run-check.ts +0 -4
- package/src/gate/run-fix.ts +5 -17
- package/src/gate/run-fixers.ts +6 -42
- package/src/home/app-sign.ts +2 -2
- package/src/home/backup-status.ts +52 -92
- package/src/home/backup-verdict.ts +2 -2
- package/src/home/daemon-jobs.ts +51 -95
- package/src/home/database-words.ts +1 -2
- package/src/home/databases.ts +9 -25
- package/src/home/home-launchd.ts +0 -6
- package/src/home/home-paths.ts +8 -4
- package/src/home/home-routes.ts +3 -10
- package/src/home/home-state.ts +2 -14
- package/src/home/inbox-shape.ts +14 -15
- package/src/home/inbox.ts +1 -1
- package/src/home/machine-repair.ts +102 -103
- package/src/home/resume.ts +1 -15
- package/src/home/run-daemon.ts +4 -11
- package/src/home/space-page.ts +3 -2
- package/src/home/supervise.ts +3 -7
- package/src/hooks/hook-config.ts +6 -7
- package/src/hooks/leak-guard.ts +1 -1
- package/src/hooks/run-hooks.ts +0 -5
- package/src/hq/daemon-db.ts +8 -8
- package/src/hq/door.ts +3 -16
- package/src/hq/hq-db.ts +4 -3
- package/src/hq/hq-local.ts +1 -2
- package/src/hq/hq-store.ts +0 -15
- package/src/hq/item-direct.ts +8 -10
- package/src/hq/item-fill.ts +37 -0
- package/src/hq/kinds/item-gone.ts +7 -10
- package/src/hq/kinds/item-msg.ts +12 -18
- package/src/hq/kinds/item.ts +13 -19
- package/src/hq/kinds/report.ts +3 -4
- package/src/hq/owner-switch.ts +3 -3
- package/src/hq/report.ts +5 -9
- package/src/hq/switch.ts +2 -11
- package/src/hq/thread-sync.ts +5 -17
- package/src/hq/{shapes-words.ts → threads-words.ts} +2 -12
- package/src/http/owner-word.ts +1 -1
- package/src/identities/machine.ts +16 -0
- package/src/init-repo.ts +0 -1
- package/src/ledger/check-stats.ts +6 -5
- package/src/ledger/db.ts +2 -4
- package/src/ledger/record-kept.ts +117 -48
- package/src/ledger/run-log.ts +21 -2
- package/src/ledger/slow-tests.ts +96 -0
- package/src/ledger/store.ts +3 -86
- package/src/ledger/suite-log.ts +8 -2
- package/src/media-store/backup/facts.ts +3 -37
- package/src/media-store/backup/keys.ts +1 -8
- package/src/media-store/backup/manifest.ts +6 -67
- package/src/media-store/backup/restore.ts +4 -13
- package/src/media-store/backup/retention.ts +13 -1
- package/src/media-store/backup/run.ts +6 -267
- package/src/media-store/backup/snapshot.ts +2 -38
- package/src/media-store/backup/sources.ts +3 -113
- package/src/media-store/backup/target-send.ts +5 -29
- package/src/media-store/db.ts +8 -7
- package/src/media-store/forget-one.ts +1 -1
- package/src/media-store/forget.ts +1 -80
- package/src/orchestrator/guards.ts +0 -1
- package/src/orchestrator/presence.ts +2 -2
- package/src/orchestrator/routes.ts +1 -1
- package/src/orchestrator/started.ts +0 -9
- package/src/orchestrator/talk-key.ts +3 -4
- package/src/orchestrator/unheard.ts +1 -1
- package/src/recordings/edit.ts +3 -3
- package/src/recordings/marks-draw.ts +17 -6
- package/src/recordings/marks.ts +120 -9
- package/src/reflections/reflections-queue.ts +3 -10
- package/src/release/notes.ts +1 -1
- package/src/release/public-clean.ts +66 -6
- package/src/release/run-bump.ts +11 -0
- package/src/release/run-release.ts +4 -0
- package/src/releases/from-thread.ts +3 -3
- package/src/releases/model.ts +186 -36
- package/src/releases/store.ts +13 -3
- package/src/releases/validate.ts +83 -0
- package/src/repo-config.ts +29 -64
- package/src/review/answer-kinds.ts +61 -4
- package/src/review/blocked-guard.ts +11 -0
- package/src/review/blocked-object.ts +298 -0
- package/src/review/cells.ts +116 -229
- package/src/review/close.ts +39 -1
- package/src/review/doc-save.ts +3 -2
- package/src/review/draft-item.ts +1 -1
- package/src/review/events.ts +3 -7
- package/src/review/expect.ts +23 -39
- package/src/review/format.ts +79 -46
- package/src/review/glyphs.ts +1 -0
- package/src/review/hand-over.ts +3 -3
- package/src/review/heard.ts +1 -1
- package/src/review/holds-sync.ts +2 -1
- package/src/review/inbox-hook.ts +2 -2
- package/src/review/inbox-read.ts +39 -33
- package/src/review/instruction-guards.ts +12 -0
- package/src/review/instructions.ts +0 -1
- package/src/review/item-db.ts +13 -43
- package/src/review/item-hq.ts +2 -2
- package/src/review/item-rows.ts +3 -14
- package/src/review/kind-catalog.ts +3 -1
- package/src/review/kinds.ts +18 -8
- package/src/review/live-view.ts +3 -0
- package/src/review/media-kind.ts +1 -1
- package/src/review/mentions.ts +1 -2
- package/src/review/model.ts +158 -114
- package/src/review/move.ts +149 -0
- package/src/review/need-threads.ts +3 -2
- package/src/review/object-card.ts +11 -0
- package/src/review/object-read.ts +6 -1
- package/src/review/one-block.ts +1 -1
- package/src/review/owner-read.ts +1 -1
- package/src/review/phone-push.ts +10 -9
- package/src/review/previews.ts +32 -4
- package/src/review/push.ts +2 -2
- package/src/review/recap.ts +129 -0
- package/src/review/referring.ts +6 -3
- package/src/review/reflection-object.ts +4 -3
- package/src/review/routes.ts +49 -19
- package/src/review/secret-route.ts +3 -2
- package/src/review/settle.ts +0 -6
- package/src/review/snooze.ts +5 -3
- package/src/review/speaker.ts +68 -0
- package/src/review/start-title.ts +19 -0
- package/src/review/store.ts +86 -59
- package/src/review/{wakes.ts → thread-events.ts} +92 -7
- package/src/review/thread-md.ts +35 -14
- package/src/review/thread-state.ts +798 -0
- package/src/review/threads.ts +29 -347
- package/src/review/traces.ts +104 -7
- package/src/review/trailer-item.ts +1 -1
- package/src/review/unit.ts +7 -9
- package/src/review/verdict-items.ts +12 -10
- package/src/review/view-layout.ts +25 -1
- package/src/review/watch-feed.ts +1 -2
- package/src/review/working-guards.ts +2 -3
- package/src/rules/untrack-generated.ts +1 -15
- package/src/secrets/lapse.ts +2 -1
- package/src/serve/hub-app/advisor-app.tsx +4 -4
- package/src/serve/hub-app/advisor-face.tsx +9 -3
- package/src/serve/hub-app/advisor-host.ts +27 -27
- package/src/serve/hub-app/advisors-model.ts +17 -8
- package/src/serve/hub-app/advisors-rights.tsx +1 -1
- package/src/serve/hub-app/advisors-st.ts +15 -14
- package/src/serve/hub-app/advisors-view.tsx +13 -11
- package/src/serve/hub-app/app-bridge.ts +23 -3
- package/src/serve/hub-app/asks-page.tsx +1 -1
- package/src/serve/hub-app/auto-text.tsx +71 -16
- package/src/serve/hub-app/check-view.tsx +0 -8
- package/src/serve/hub-app/controls.css +14 -3
- package/src/serve/hub-app/database-view.tsx +1 -2
- package/src/serve/hub-app/git-view.tsx +3 -1
- package/src/serve/hub-app/hub.css +12 -5
- package/src/serve/hub-app/icons.tsx +1 -1
- package/src/serve/hub-app/inbox-view.tsx +1 -2
- package/src/serve/hub-app/live-sources.ts +2 -2
- package/src/serve/hub-app/main-panel.tsx +2 -1
- package/src/serve/hub-app/panel-repo.ts +0 -9
- package/src/serve/hub-app/pic.tsx +29 -12
- package/src/serve/hub-app/polled.ts +16 -2
- package/src/serve/hub-app/recordings-st.ts +23 -2
- package/src/serve/hub-app/recordings-view.tsx +68 -10
- package/src/serve/hub-app/ref-pill.ts +1 -1
- package/src/serve/hub-app/repo-st.ts +1 -2
- package/src/serve/hub-app/review/advisor-add.tsx +1 -1
- package/src/serve/hub-app/review/advisor-invite.tsx +1 -1
- package/src/serve/hub-app/review/draft-body.tsx +2 -2
- package/src/serve/hub-app/review/heard-line.tsx +1 -1
- package/src/serve/hub-app/review/instructions-view.tsx +1 -8
- package/src/serve/hub-app/review/kind-states.tsx +14 -9
- package/src/serve/hub-app/review/kit.tsx +4 -11
- package/src/serve/hub-app/review/lane-bar.tsx +3 -3
- package/src/serve/hub-app/review/lightbox.tsx +15 -11
- package/src/serve/hub-app/review/line-window.ts +4 -1
- package/src/serve/hub-app/review/live-bar-st.ts +2 -2
- package/src/serve/hub-app/review/live-view.tsx +57 -1
- package/src/serve/hub-app/review/object-panel.tsx +20 -8
- package/src/serve/hub-app/review/question-views.tsx +181 -54
- package/src/serve/hub-app/review/recap-bar.tsx +40 -0
- package/src/serve/hub-app/review/request-cell.tsx +48 -0
- package/src/serve/hub-app/review/review-cells.tsx +154 -96
- package/src/serve/hub-app/review/review-host.ts +2 -2
- package/src/serve/hub-app/review/review-kit.ts +17 -11
- package/src/serve/hub-app/review/review-list.tsx +23 -31
- package/src/serve/hub-app/review/review-st.ts +30 -40
- package/src/serve/hub-app/review/review-thread.tsx +139 -85
- package/src/serve/hub-app/review/review-views.tsx +124 -68
- package/src/serve/hub-app/review/share-lines.tsx +4 -4
- package/src/serve/hub-app/review/start-st.ts +2 -5
- package/src/serve/hub-app/review/superseded-runs.ts +4 -3
- package/src/serve/hub-app/review/thread-close.tsx +10 -7
- package/src/serve/hub-app/review/thread-st.ts +372 -201
- package/src/serve/hub-app/review/tone-bar.tsx +126 -0
- package/src/serve/hub-app/review/tones.ts +35 -0
- package/src/serve/hub-app/review/trailer-body.tsx +2 -2
- package/src/serve/hub-app/review/trailer-st.ts +3 -2
- package/src/serve/hub-app/review/trailer-voices-st.ts +3 -2
- package/src/serve/hub-app/review.css +180 -106
- package/src/serve/hub-app/search-view.tsx +1 -1
- package/src/serve/hub-app/social/social-model.ts +0 -4
- package/src/serve/hub-app/source-acts.ts +2 -1
- package/src/serve/hub-app/stores/stores-page.tsx +2 -2
- package/src/serve/hub-app/terminal-sources.tsx +2 -1
- package/src/serve/hub-app/thread-row.tsx +3 -4
- package/src/serve/hub-app/tree-build.ts +0 -4
- package/src/serve/hub-app/urls-view.tsx +2 -1
- package/src/serve/hub-app/view-layout.css +13 -3
- package/src/serve/hub-app/wikis-view.tsx +5 -2
- package/src/serve/hub-runtime.ts +7 -37
- package/src/serve/project-gutter-route.ts +6 -2
- package/src/serve/read-thread.ts +20 -2
- package/src/serve/read-worker.ts +9 -1
- package/src/serve/record-pages.ts +46 -0
- package/src/serve/serve-hub.ts +2 -2
- package/src/serve/terminal-host.ts +1 -1
- package/src/serve/terminal-route.ts +1 -3
- package/src/serve/tracked-watch.ts +1 -3
- package/src/setup-house.ts +2 -2
- package/src/shipkit-files.ts +1 -1
- package/src/shipkit.ts +1 -6
- package/src/shot/film-box.ts +0 -20
- package/src/social/drafts.ts +1 -1
- package/src/social/kinds.ts +6 -29
- package/src/social/load.ts +2 -2
- package/src/social/post-object.ts +3 -2
- package/src/social/release-stage.ts +1 -1
- package/src/social/stage.ts +2 -2
- package/src/stores/model.ts +4 -0
- package/src/stores/routes.ts +11 -3
- package/src/suite/judge-suites.ts +58 -0
- package/src/suite/red-alone.ts +54 -18
- package/src/suite/runner-shapes.ts +2 -2
- package/src/suite/suite-cli.ts +67 -14
- package/src/suite/test-units.ts +2 -1
- package/src/urls/fill.ts +1 -1
- package/src/urls/places.ts +1 -2
- package/src/vault/vault-config.ts +2 -2
- package/src/vault/vault-init.ts +1 -5
- package/src/wiki/graph-page.ts +14 -2
- package/src/advisors/copy-truth.ts +0 -49
- package/src/advisors/door-child.ts +0 -112
- package/src/advisors/door-serve.ts +0 -52
- package/src/advisors/door.ts +0 -118
- package/src/checks/SK016-legacy-check-shapes.check.ts +0 -189
- package/src/checks/SK029-explicit-check-files.check.ts +0 -112
- package/src/checks/SK048-one-local-file.check.ts +0 -36
- package/src/core/config-rewrite.ts +0 -111
- package/src/core/daemon-port.ts +0 -10
- package/src/core/legacy-shapes.ts +0 -263
- package/src/core/migrate-layout.ts +0 -638
- package/src/core/port-check-cli.ts +0 -52
- package/src/core/port-check-file.ts +0 -295
- package/src/core/port-check-files.ts +0 -31
- package/src/gate/discover-legacy-checks.ts +0 -26
- package/src/home/home-move.ts +0 -527
- package/src/home/machine-fold.ts +0 -810
- package/src/hq/item-shapes.ts +0 -54
- package/src/hq/kinds/items-read.ts +0 -4
- package/src/media-store/backup/daemon.ts +0 -220
- package/src/media-store/backup/kept.ts +0 -241
- package/src/media-store/backup/prune.ts +0 -359
- package/src/media-store/backup/secret.ts +0 -88
- package/src/media-store/backup/ssh-space.ts +0 -202
- package/src/media-store/backup/watch.ts +0 -117
- package/src/review/band.ts +0 -182
- package/src/review/folders.ts +0 -216
- package/src/review/hook-ask.ts +0 -58
- package/src/review/role.ts +0 -48
- package/src/review/thread-fold.ts +0 -64
- package/src/review/wait.ts +0 -91
- package/src/rules/rule.ts +0 -43
- package/src/serve/hook-thread.ts +0 -37
- package/src/serve/hook-work.ts +0 -92
- package/src/serve/hook-worker.ts +0 -57
- package/src/serve/hub-app/review/dock.tsx +0 -147
- package/src/serve/hub-app/review/faces.tsx +0 -18
- package/src/serve/hub-app/review/item-verdict.tsx +0 -112
- package/src/serve/hub-app/review/review-board.tsx +0 -48
- /package/src/{scaffold → core}/jsonc-spans.ts +0 -0
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
// check differ by `from` and by nothing else.
|
|
1
|
+
// check discovery, THE way anything gets into a gate. Drop a `<name>.check.shipkit.ts` unit file anywhere in the
|
|
2
|
+
// repo, default-export `check({...})`, and every surface sees it with no config edit. The toolkit's own built-ins
|
|
3
|
+
// are `*.check.ts` files under its `src/checks/`, walked by this same code, so a built-in and a repo check differ by
|
|
4
|
+
// `from` and by nothing else.
|
|
6
5
|
//
|
|
7
6
|
// Discovery IMPORTS each check file. That is what buys the shape a function
|
|
8
7
|
// body, a fixer and a typed declaration instead of four regexes, and it is why
|
|
9
8
|
// a check file keeps its metadata imports at the top level and its BODY's
|
|
10
|
-
// imports inside `run
|
|
11
|
-
//
|
|
9
|
+
// imports inside `run`. The budget is 300ms for a real repo, pinned by
|
|
10
|
+
// tests/check-shape.test.ts.
|
|
12
11
|
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
// core/discover-legacy-checks.ts. A script must never be imported, so the two
|
|
16
|
-
// are told apart by reading the source first (`isLegacyCheckSource`).
|
|
12
|
+
// A repo `*.check.ts` is the retired shape (a check script, or a check file under the old suffix): never imported,
|
|
13
|
+
// it stands as one red row that names the unit file to write instead.
|
|
17
14
|
//
|
|
18
15
|
// Skipped dirs: node_modules, dist, tmp, references (templates for other
|
|
19
16
|
// repos), every dot-dir, and the repo's vendored dirs (core/vendored.ts).
|
|
@@ -22,12 +19,10 @@ import { readFileSync, realpathSync } from 'fs'
|
|
|
22
19
|
import { basename, relative } from 'path'
|
|
23
20
|
import { check, type CheckDef, type CheckFrom } from '../check.ts'
|
|
24
21
|
|
|
25
|
-
import { CHECK_SUFFIX as SUFFIX,
|
|
22
|
+
import { CHECK_SUFFIX as SUFFIX, CHECK_UNIT_SUFFIX, UNIT_SUFFIX, unitBase } from '../core/check-file-names.ts'
|
|
26
23
|
import { unitKind } from '../shipkit-files.ts'
|
|
27
24
|
import { importFresh, prunedDirs, repoUnitFiles, walk, walkKept } from '../core/repo-walk.ts'
|
|
28
25
|
|
|
29
|
-
export { fallbackNames, isLegacyCheckSource } from '../core/check-file-names.ts'
|
|
30
|
-
|
|
31
26
|
import { BUILTIN_CHECK_DIR, builtinsOf } from './builtin-checks-dir.ts'
|
|
32
27
|
export { BUILTIN_CHECK_DIR, builtinsOf } from './builtin-checks-dir.ts'
|
|
33
28
|
|
|
@@ -56,12 +51,6 @@ export type DiscoveredCheck = {
|
|
|
56
51
|
from: CheckFrom
|
|
57
52
|
}
|
|
58
53
|
|
|
59
|
-
/** the same question about a file on disk. An unreadable file is a check
|
|
60
|
-
* file, so the import names what is wrong with it */
|
|
61
|
-
export function isLegacyCheckFile(path: string): boolean {
|
|
62
|
-
try { return isLegacyCheckSource(readFileSync(path, 'utf8')) } catch { return false }
|
|
63
|
-
}
|
|
64
|
-
|
|
65
54
|
/** every built-in id, from the file names alone. Sync and import free, so
|
|
66
55
|
* `defineRepo` can read the namespace at config load. Read once per
|
|
67
56
|
* process: the toolkit's own files cannot appear mid run, and `defineRepo`
|
|
@@ -109,7 +98,24 @@ function unloadable(path: string, message: string): CheckDef {
|
|
|
109
98
|
cache: { by: 'never', why: 'the file does not load' },
|
|
110
99
|
fix: 'none',
|
|
111
100
|
applies: 'always',
|
|
112
|
-
run: (c) => c.fail(`${basename(path)} does not load: ${message.replace(`${path}: `, '')}`, `fix the declaration in ${basename(path)} by the reason above
|
|
101
|
+
run: (c) => c.fail(`${basename(path)} does not load: ${message.replace(`${path}: `, '')}`, `fix the declaration in ${basename(path)} by the reason above (tools/shipkit/writing-a-check.md)`),
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** the unit file a repo `*.check.ts` becomes */
|
|
106
|
+
export const unitFileOf = (rel: string): string => `${rel.slice(0, -SUFFIX.length)}${CHECK_UNIT_SUFFIX}`
|
|
107
|
+
|
|
108
|
+
/** the stand in for a repo `*.check.ts`, the retired shape: never imported (a check script runs its body on import),
|
|
109
|
+
* it fails in every gate with the file to write instead, so an old repo breaks loud and never loses a check unseen */
|
|
110
|
+
function retiredFile(rel: string): CheckDef {
|
|
111
|
+
return {
|
|
112
|
+
description: 'no repo check file keeps the retired `*.check.ts` shape',
|
|
113
|
+
blocking: true,
|
|
114
|
+
runs: { onPreCommit: false, onCi: true, onFull: true, onRelease: true, onHealth: true, onSave: false, onClock: false },
|
|
115
|
+
cache: { by: 'never', why: 'the file is never imported' },
|
|
116
|
+
fix: 'none',
|
|
117
|
+
applies: 'always',
|
|
118
|
+
run: (c) => c.fail(`${rel} is a retired check file shape, so it never runs`, `rename it ${unitFileOf(rel)}, one \`export default check({...})\` whose body is \`run: (c) => …\` (tools/shipkit/writing-a-check.md)`),
|
|
113
119
|
}
|
|
114
120
|
}
|
|
115
121
|
|
|
@@ -152,17 +158,18 @@ export type DiscoverOpts = {
|
|
|
152
158
|
imported?: (path: string, ms: number, def: CheckDef | null, loaded: boolean) => void
|
|
153
159
|
/** the toolkit's checks dir, a parameter for tests only */
|
|
154
160
|
builtinDir?: string
|
|
155
|
-
/** the repo's own
|
|
156
|
-
|
|
161
|
+
/** the repo's own unit files, when the caller already walked the tree (the commit hook's table). The retired
|
|
162
|
+
* `*.check.ts` files are then not looked for: their rows run nothing at commit */
|
|
163
|
+
units?: string[]
|
|
157
164
|
}
|
|
158
165
|
|
|
159
166
|
export async function discoverChecks(root: string, o: DiscoverOpts = {}): Promise<DiscoveredCheck[]> {
|
|
160
167
|
const builtinDir = builtinsOf(root, o.builtinDir ?? BUILTIN_CHECK_DIR)
|
|
161
168
|
const builtins: string[] = []
|
|
162
169
|
walk(builtinDir, builtins)
|
|
163
|
-
const found: string[] =
|
|
164
|
-
if (o.
|
|
165
|
-
const units = o.
|
|
170
|
+
const found: string[] = []
|
|
171
|
+
if (o.units == null) walkKept(root, found, SUFFIX, undefined, prunedDirs(root))
|
|
172
|
+
const units = o.units?.slice().sort() ?? repoUnitFiles(root)
|
|
166
173
|
// the repo that HOSTS the toolkit walks over `src/checks/` too, and a file
|
|
167
174
|
// discovered twice is a duplicate id rather than a second check. Real paths,
|
|
168
175
|
// because a consumer reaches the same files through a linked node_modules
|
|
@@ -171,16 +178,19 @@ export async function discoverChecks(root: string, o: DiscoverOpts = {}): Promis
|
|
|
171
178
|
// its own source, never an install of it
|
|
172
179
|
const inRoot = relative(real(root), real(builtinDir))
|
|
173
180
|
const hostsToolkit = !inRoot.startsWith('..') && !inRoot.split(/[\\/]/).includes('node_modules')
|
|
174
|
-
const
|
|
181
|
+
const retired = found.filter((f) => !shipped.has(real(f))).sort()
|
|
175
182
|
builtins.sort()
|
|
176
|
-
const names = fallbackNames(root, all)
|
|
177
|
-
// a legacy script is left to its own reader, and never imported here
|
|
178
|
-
const own = all.filter((f) => o.skip?.(f) === true || !isLegacyCheckFile(f))
|
|
179
183
|
const base = (f: string): string => basename(f).slice(0, -SUFFIX.length)
|
|
180
184
|
|
|
181
185
|
const out: DiscoveredCheck[] = []
|
|
182
186
|
const ids = new Set<string>()
|
|
183
|
-
for (const f of
|
|
187
|
+
for (const f of retired) {
|
|
188
|
+
const rel = relative(root, f).replace(/\\/g, '/')
|
|
189
|
+
ids.add(rel)
|
|
190
|
+
const def = retiredFile(rel)
|
|
191
|
+
out.push({ def, path: f, rel, id: rel, title: rel, description: def.description, owner: rel, from: 'repo' })
|
|
192
|
+
}
|
|
193
|
+
for (const f of [...builtins, ...units]) {
|
|
184
194
|
const isBuiltin = builtins.includes(f)
|
|
185
195
|
if (o.skip?.(f) === true) continue
|
|
186
196
|
let def: CheckDef | null
|
|
@@ -200,7 +210,7 @@ export async function discoverChecks(root: string, o: DiscoverOpts = {}): Promis
|
|
|
200
210
|
const rel = isBuiltin ? null : relative(root, f).replace(/\\/g, '/')
|
|
201
211
|
const fallback = isBuiltin
|
|
202
212
|
? (BUILTIN_ID_RE.exec(base(f))?.[1] ?? base(f))
|
|
203
|
-
:
|
|
213
|
+
: unitBase(f)
|
|
204
214
|
let id = def.id ?? fallback
|
|
205
215
|
if (isBuiltin) {
|
|
206
216
|
const refused = loadError != null ? null
|
package/src/gate/gate-checks.ts
CHANGED
|
@@ -5,10 +5,8 @@
|
|
|
5
5
|
// disagree about what exists, which is the whole reason this file is the only
|
|
6
6
|
// place that enumerates.
|
|
7
7
|
//
|
|
8
|
-
// What feeds it: the floor slots derived from package.json scripts
|
|
9
|
-
//
|
|
10
|
-
// forms still read behind the compatibility fence (`rules: []` and a legacy
|
|
11
|
-
// check script, a `*.check.ts` with no check object). The declaration always lives WITH the check, never in a table
|
|
8
|
+
// What feeds it: the floor slots derived from package.json scripts and every
|
|
9
|
+
// discovered check file. The declaration always lives WITH the check, never in a table
|
|
12
10
|
// over here: a table beside the registry is a second source of truth that
|
|
13
11
|
// drifts the first time somebody adds one.
|
|
14
12
|
import { existsSync, realpathSync } from 'fs'
|
|
@@ -19,9 +17,6 @@ import { auditedExtras, ignoredFor, readAuditReport } from '../core/audit-report
|
|
|
19
17
|
import { listRepoFiles, resolveFloor, slotDescription, type FloorResolution } from '../core/floor.ts'
|
|
20
18
|
import { treeRev } from '../core/tree-rev.ts'
|
|
21
19
|
import { yieldLoop } from '../core/loop-watch.ts'
|
|
22
|
-
import { discoverLegacyChecks } from './discover-legacy-checks.ts'
|
|
23
|
-
import { checkFileRunBy } from '../core/legacy-shapes.ts'
|
|
24
|
-
import { ruleCacheExtra } from '../rules/rule.ts'
|
|
25
20
|
import { discoverChecks } from './discover-checks.ts'
|
|
26
21
|
import { checkCacheExtra, describeFirst, type TaskDef, type CheckFrom, type CheckEnv, type CheckDef } from '../check.ts'
|
|
27
22
|
import { CHECK_TIMEOUT_MS, type RunnableCheck, type CheckBody } from './check-runner.ts'
|
|
@@ -93,12 +88,11 @@ export function envTier(): TestTier {
|
|
|
93
88
|
* question about the world (core/check-runner.ts owns the other default) */
|
|
94
89
|
export const BUILD_TIMEOUT_MS = 600_000
|
|
95
90
|
|
|
96
|
-
/** the floor
|
|
97
|
-
*
|
|
98
|
-
*
|
|
91
|
+
/** the floor's build steps, with the slots nothing could fill and the ones a
|
|
92
|
+
* config turned off. The gate prints those, and the TUI draws its rows from
|
|
93
|
+
* them before anything has run. */
|
|
99
94
|
export async function allTasks(c: RepoConfig, root: string): Promise<FloorResolution> {
|
|
100
|
-
|
|
101
|
-
return { ...floor, tasks: [...floor.tasks, ...(c.tasks ?? [])] }
|
|
95
|
+
return resolveFloor(c, root)
|
|
102
96
|
}
|
|
103
97
|
|
|
104
98
|
/** one gate check with everything a reader asks about it, not only what the
|
|
@@ -111,7 +105,7 @@ export type CheckRow = {
|
|
|
111
105
|
/** the check's one line description (the shape: check.ts
|
|
112
106
|
* descriptionProblem). Every row carries one: a check file declares it,
|
|
113
107
|
* and a row with no file to say it in (a floor slot, a unit test check,
|
|
114
|
-
* a
|
|
108
|
+
* a commit gate) gets it from what generated the row. */
|
|
115
109
|
description: string
|
|
116
110
|
/** does `shipkit ci` run it? false = PROACTIVE: `shipkit check` reports it,
|
|
117
111
|
* the gate never does, and it may sit red for months without anything
|
|
@@ -120,12 +114,10 @@ export type CheckRow = {
|
|
|
120
114
|
/** a BUILD STEP: the gate runs it, the health pass does not. `shipkit ci`
|
|
121
115
|
* asks "is my change good" and builds, `shipkit check` asks "is this
|
|
122
116
|
* repo healthy" and reports, and a repo's test suite has no business in
|
|
123
|
-
* the second question. DERIVED true for a floor slot
|
|
124
|
-
*
|
|
125
|
-
* that is one (check.ts `build`). */
|
|
117
|
+
* the second question. DERIVED true for a floor slot, which has no file
|
|
118
|
+
* to say it in, and DECLARED by a check file that is one (check.ts `build`). */
|
|
126
119
|
build: boolean
|
|
127
|
-
/** can a failure stop you? null = the check never said
|
|
128
|
-
* `checkDefaults.blocking`, which the runner treats as fatal. */
|
|
120
|
+
/** can a failure stop you? null = the check never said, which the runner treats as fatal. */
|
|
129
121
|
blocking: boolean | null
|
|
130
122
|
/** where the answer is owned: a wiki page, a file, a command. Null when
|
|
131
123
|
* the check names none. */
|
|
@@ -157,7 +149,7 @@ export type CheckRow = {
|
|
|
157
149
|
/** whose check it is: `shipkit` = it ships with the toolkit (a built-in
|
|
158
150
|
* SK check, the contracts pass, a floor slot nothing in the repo filled),
|
|
159
151
|
* `repo` = this repo declared it (a package.json script behind a floor
|
|
160
|
-
* slot, a
|
|
152
|
+
* slot, a check file). */
|
|
161
153
|
from: CheckFrom
|
|
162
154
|
/** a COMMIT GATE: the git hook that runs it (hooks/hook-gates.ts). The
|
|
163
155
|
* runner never does, so every runner context reads false */
|
|
@@ -177,9 +169,7 @@ export type ComposeOpts = {
|
|
|
177
169
|
tier?: TestTier
|
|
178
170
|
}
|
|
179
171
|
|
|
180
|
-
/** a
|
|
181
|
-
* through the compatibility window, so the shape survives one release longer
|
|
182
|
-
* than the word for it. */
|
|
172
|
+
/** a floor slot's `TaskDef` as the runner takes it */
|
|
183
173
|
function taskBody(t: TaskDef): CheckBody {
|
|
184
174
|
return {
|
|
185
175
|
...(t.cmd == null ? {} : { cmd: t.cmd }),
|
|
@@ -228,7 +218,7 @@ function rootTestKey(root: string, c: RepoConfig, floor: FloorResolution): { inp
|
|
|
228
218
|
return { inputs: subs.length === 0 ? t.inputs : inputsOutsideUnits(t.inputs, subs.map((u) => u.rel), files), code: own }
|
|
229
219
|
}
|
|
230
220
|
|
|
231
|
-
/** a
|
|
221
|
+
/** a floor slot's own description, else its command exiting 0 */
|
|
232
222
|
const taskDescription = (t: TaskDef): string =>
|
|
233
223
|
describeFirst(t.description, t.cmd == null ? null : `\`${t.cmd.join(' ')}\` exits 0`, `the ${t.id} task ${t.cmd == null ? 'passes' : 'exits 0'}`)
|
|
234
224
|
|
|
@@ -236,8 +226,7 @@ const taskDescription = (t: TaskDef): string =>
|
|
|
236
226
|
* about once a day and never in step with its siblings */
|
|
237
227
|
const DAILY: [string, string] = ['20h', '28h']
|
|
238
228
|
|
|
239
|
-
/** the runs of a row with no file to declare them in (a floor slot,
|
|
240
|
-
* task, a legacy rule or script), written out in full with the reason. It
|
|
229
|
+
/** the runs of a row with no file to declare them in (a floor slot), written out in full with the reason. It
|
|
241
230
|
* keeps what the planner and the gate did with such a row before the
|
|
242
231
|
* declaration was explicit: a ttl is the cadence ('once' for a forever
|
|
243
232
|
* fact), a save moves a keyed row or a fact, a gate build step nothing keys
|
|
@@ -269,7 +258,7 @@ function declOfCache(cache: CacheDecl, env: CheckEnv): { inputs?: string[]; opti
|
|
|
269
258
|
}
|
|
270
259
|
}
|
|
271
260
|
|
|
272
|
-
/** a
|
|
261
|
+
/** a floor slot's cache, as one cell */
|
|
273
262
|
const legacyCacheText = (d: { inputs?: string[]; ttl?: string; never?: string }): string =>
|
|
274
263
|
d.inputs != null ? filesText(d.inputs) : d.ttl != null && d.ttl !== '' ? (d.ttl === FOREVER ? 'fact' : `ttl ${d.ttl}`) : d.never != null ? `never: ${d.never}` : 'never: nothing declared'
|
|
275
264
|
|
|
@@ -301,7 +290,7 @@ export async function composeChecks(root: string, c: RepoConfig, o: ComposeOpts
|
|
|
301
290
|
const fromOf = new Map(checks.map((u) => [u.id, u.from]))
|
|
302
291
|
// a floor slot the REPO filled (its package.json script, its config
|
|
303
292
|
// override) is the repo's; one shipkit filled with its own module or the
|
|
304
|
-
// repo's tsc is the toolkit's
|
|
293
|
+
// repo's tsc is the toolkit's
|
|
305
294
|
const taskFrom = (id: string): CheckFrom => {
|
|
306
295
|
const discovered = fromOf.get(id)
|
|
307
296
|
if (discovered != null) return discovered
|
|
@@ -309,20 +298,7 @@ export async function composeChecks(root: string, c: RepoConfig, o: ComposeOpts
|
|
|
309
298
|
if (src == null) return 'repo'
|
|
310
299
|
return src === 'package.json script' || src === 'repo.config override' || src === 'unit' ? 'repo' : 'shipkit'
|
|
311
300
|
}
|
|
312
|
-
//
|
|
313
|
-
// that file run twice, once per engine, when tasks and checks had a
|
|
314
|
-
// namespace each. One namespace makes the pair one check: the check row
|
|
315
|
-
// runs, carrying what the task added (core/legacy-shapes.ts rewrites the
|
|
316
|
-
// pair the same way on disk)
|
|
317
|
-
const legacy = discoverLegacyChecks(root)
|
|
318
|
-
const foldedInto = new Map<string, TaskDef>()
|
|
319
|
-
for (const t of c.tasks ?? []) {
|
|
320
|
-
const d = legacy.find((x) => x.name === t.id)
|
|
321
|
-
if (d == null || t.logic != null) continue
|
|
322
|
-
const r = checkFileRunBy(t, root)
|
|
323
|
-
if (r != null && r.rest.length === 0 && r.rel === relative(root, d.path).replace(/\\/g, '/')) foldedInto.set(t.id, t)
|
|
324
|
-
}
|
|
325
|
-
// BUILD STEPS: the floor, then the repo's own `tasks: []`. The whole run
|
|
301
|
+
// BUILD STEPS: the floor. The whole run
|
|
326
302
|
// carries the tier flag rather than one task id: a repo names its suites
|
|
327
303
|
// what it likes, and a gate that guesses which one is the tests will miss
|
|
328
304
|
// one.
|
|
@@ -340,20 +316,18 @@ export async function composeChecks(root: string, c: RepoConfig, o: ComposeOpts
|
|
|
340
316
|
const onDisk = (p: string): boolean => existsSync(join(root, isNamesInput(p) ? p.slice(0, -3) : p))
|
|
341
317
|
const audit = readAuditReport(root)
|
|
342
318
|
const extrasOf = (id: string): string[] => [...new Set([...ignoredFor(c.ignoredInputs, id), ...auditedExtras(audit, id)])].filter(onDisk).sort()
|
|
343
|
-
for (const raw of
|
|
319
|
+
for (const raw of floor.tasks) {
|
|
344
320
|
const added = { ...(full ? { [FULL_TESTS_ENV]: '1' } : {}), ...liveEnv() }
|
|
345
321
|
const t: TaskDef = Object.keys(added).length > 0 ? { ...raw, env: { ...raw.env, ...added } } : raw
|
|
346
|
-
const own = t.id === 'test'
|
|
322
|
+
const own = t.id === 'test' ? rootTest : null
|
|
347
323
|
const declared = own?.inputs ?? t.inputs
|
|
348
324
|
// the declared extras join a declared list too: a list names what the
|
|
349
325
|
// task reads in the tree, and the audit found these outside it
|
|
350
326
|
const extras = extrasOf(t.id)
|
|
351
327
|
const inputs = declared == null && t.ttl == null && t.never == null && t.cmd != null ? ['.', ...extras] : declared == null ? declared : [...declared, ...extras]
|
|
352
|
-
const slot = floor.tasks.includes(raw)
|
|
353
|
-
const kind = slot ? 'a floor slot' : 'a repo.config.ts task'
|
|
354
328
|
// a foreign repo's suites are the team's: the daemon starts none on a save unless `onSave` names it
|
|
355
|
-
const noSave = foreign &&
|
|
356
|
-
const runs = withRepoOff(derivedRuns({ gate: t.optIn !== true, build: true, inputs, ttl: t.ttl, kind, repair: false, ...(noSave == null ? {} : { noSave }) }), repoOff(c, t.id))
|
|
329
|
+
const noSave = foreign && c.onSave?.[t.id] == null ? "foreign: the team's suite, onSave names one to run" : undefined
|
|
330
|
+
const runs = withRepoOff(derivedRuns({ gate: t.optIn !== true, build: true, inputs, ttl: t.ttl, kind: 'a floor slot', repair: false, ...(noSave == null ? {} : { noSave }) }), repoOff(c, t.id))
|
|
357
331
|
const row: CheckRow = {
|
|
358
332
|
decl: {
|
|
359
333
|
id: t.id,
|
|
@@ -481,90 +455,6 @@ export async function composeChecks(root: string, c: RepoConfig, o: ComposeOpts
|
|
|
481
455
|
}
|
|
482
456
|
out.push({ row, runnable: runnableOf(row, body, { fix: u.def.repair, pointer: u.def.cmd?.join(' ') ?? null }) })
|
|
483
457
|
}
|
|
484
|
-
// LEGACY: `rules: []`, read as a check whose body is its lint. Dies with
|
|
485
|
-
// that config key once `shipkit fleet` shows no repo below 0.40.
|
|
486
|
-
for (const r of c.rules ?? []) {
|
|
487
|
-
const runs = withRepoOff(derivedRuns({ gate: true, build: false, inputs: r.inputs, ttl: r.ttl, kind: 'a legacy repo.config.ts rule', repair: r.fix != null }), repoOff(c, r.id))
|
|
488
|
-
const row: CheckRow = {
|
|
489
|
-
decl: {
|
|
490
|
-
id: r.id,
|
|
491
|
-
inputs: r.inputs,
|
|
492
|
-
code: r.code,
|
|
493
|
-
ttl: r.ttl,
|
|
494
|
-
never: r.never,
|
|
495
|
-
extra: ruleCacheExtra(r, env),
|
|
496
|
-
},
|
|
497
|
-
title: r.title,
|
|
498
|
-
description: describeFirst(r.title, `rule ${r.id} holds`),
|
|
499
|
-
gate: runs.off == null && runs.onCi,
|
|
500
|
-
build: false,
|
|
501
|
-
blocking: r.blocking,
|
|
502
|
-
owner: r.owner,
|
|
503
|
-
group: null,
|
|
504
|
-
timeoutMs: null,
|
|
505
|
-
budgetMs: budgetOf(r.id, undefined, { build: false, cmd: false, world: r.ttl != null || r.never != null }, c.budgets),
|
|
506
|
-
optIn: false,
|
|
507
|
-
fixable: r.fix != null,
|
|
508
|
-
runs,
|
|
509
|
-
cache: legacyCacheText(r),
|
|
510
|
-
when: whenSummary(runs, repoOff(c, r.id), false),
|
|
511
|
-
deps: null,
|
|
512
|
-
from: 'repo',
|
|
513
|
-
}
|
|
514
|
-
out.push({ row, runnable: runnableOf(row, { run: (ctx) => r.lint(ctx, { root: ctx.root, config: ctx.config }) }, { fix: r.fix }) })
|
|
515
|
-
}
|
|
516
|
-
// LEGACY: a check script with no check object, read as a `cmd` check
|
|
517
|
-
// running itself. The reader is a source scanner rather than an import,
|
|
518
|
-
// which is why it cannot carry a fixer or a typed declaration
|
|
519
|
-
// (core/discover-legacy-checks.ts).
|
|
520
|
-
for (const found of legacy) {
|
|
521
|
-
const rel = relative(root, found.path).replace(/\\/g, '/')
|
|
522
|
-
const task = foldedInto.get(found.name)
|
|
523
|
-
// a task that is not optIn put an off gate file in the gate, and the
|
|
524
|
-
// file's own cache declaration wins over the task's
|
|
525
|
-
const d = task == null ? found : { ...found, gate: found.gate || task.optIn !== true }
|
|
526
|
-
const cached = d.inputs != null || d.ttl != null || d.never != null
|
|
527
|
-
const li = { inputs: d.inputs ?? (cached ? undefined : task?.inputs), ttl: d.ttl ?? (cached ? undefined : task?.ttl), never: d.never ?? (cached ? undefined : task?.never) }
|
|
528
|
-
const runs = withRepoOff(derivedRuns({ gate: d.gate, build: false, inputs: li.inputs, ttl: li.ttl, kind: 'a legacy check script', repair: false }), repoOff(c, d.name))
|
|
529
|
-
const row: CheckRow = {
|
|
530
|
-
decl: {
|
|
531
|
-
id: d.name,
|
|
532
|
-
inputs: li.inputs,
|
|
533
|
-
ttl: li.ttl,
|
|
534
|
-
never: li.never,
|
|
535
|
-
code: [rel],
|
|
536
|
-
argv: ['bun', rel],
|
|
537
|
-
// no `extra`, so WHERE it runs stays out of a legacy check's
|
|
538
|
-
// key, deliberately: the field is read by a source scanner
|
|
539
|
-
// that cannot carry a `cacheKey` either, and adding the
|
|
540
|
-
// rotation now would bust every field repo's TTL cache once
|
|
541
|
-
// for a file form that is refused after 0.40 anyway
|
|
542
|
-
},
|
|
543
|
-
title: d.name,
|
|
544
|
-
description: describeFirst(`\`bun ${rel}\` exits 0`, `${d.name} exits 0`),
|
|
545
|
-
gate: runs.off == null && runs.onCi,
|
|
546
|
-
build: false,
|
|
547
|
-
// the file wins, then the repo default, then nothing: an
|
|
548
|
-
// unclassified check is an error, never a guess
|
|
549
|
-
blocking: d.blocking ?? c.checkDefaults?.blocking ?? null,
|
|
550
|
-
owner: rel,
|
|
551
|
-
group: task?.group ?? null,
|
|
552
|
-
timeoutMs: task?.timeoutMs ?? null,
|
|
553
|
-
budgetMs: budgetOf(d.name, undefined, { build: false, cmd: true, world: d.ttl != null || d.never != null }, c.budgets),
|
|
554
|
-
optIn: false,
|
|
555
|
-
// the reader is a source scanner, so it cannot carry a function
|
|
556
|
-
fixable: false,
|
|
557
|
-
runs,
|
|
558
|
-
cache: legacyCacheText(li),
|
|
559
|
-
when: whenSummary(runs, repoOff(c, d.name), false),
|
|
560
|
-
deps: task?.deps ?? null,
|
|
561
|
-
from: 'repo',
|
|
562
|
-
}
|
|
563
|
-
// the pointer names the file the way a reader types it, never the
|
|
564
|
-
// absolute path discovery happened to hand the spawner
|
|
565
|
-
const body: CheckBody = { cmd: ['bun', d.path], ...(task?.env == null ? {} : { env: task.env }), ...(task?.cwd == null ? {} : { cwd: resolve(root, task.cwd) }) }
|
|
566
|
-
out.push({ row, runnable: runnableOf(row, body, { pointer: `bun ${rel}` }) })
|
|
567
|
-
}
|
|
568
458
|
// THE COMMIT GATES: the git hooks run them (hooks/run-hooks.ts), never the
|
|
569
459
|
// runner, so a row here only makes them enumerable and `off` able to name
|
|
570
460
|
// them. They run in no runner context, and a run by name says where they run
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
//
|
|
6
6
|
// A table beside the per worktree git dir remembers, per file, whether it
|
|
7
7
|
// declares `onPreCommit`, keyed on the file's mtime and size, and the last
|
|
8
|
-
// walk: the repo's
|
|
8
|
+
// walk: the repo's unit files, and the mtime of every dir it read. A
|
|
9
9
|
// dir's mtime moves when an entry is added, removed or renamed in it, so while
|
|
10
10
|
// none moved the list is the same. When every dir and every file still matches
|
|
11
11
|
// and none runs at commit, the hook answers from the table with stats alone,
|
|
@@ -30,11 +30,11 @@ import type { DiscoveredCheck } from './discover-checks.ts'
|
|
|
30
30
|
/** a repo check file whose import takes longer than this, warm, is named */
|
|
31
31
|
export const SLOW_IMPORT_MS = 30
|
|
32
32
|
|
|
33
|
-
const TABLE_VERSION =
|
|
33
|
+
const TABLE_VERSION = 3
|
|
34
34
|
|
|
35
35
|
type Row = { stamp: string; preCommit: boolean }
|
|
36
|
-
/** the repo's own
|
|
37
|
-
type Walk = { dirs: [string, number][];
|
|
36
|
+
/** the repo's own unit files at the last walk, and each dir it read with its mtime then */
|
|
37
|
+
type Walk = { dirs: [string, number][]; units: string[] }
|
|
38
38
|
type Table = { v: number; files: Record<string, Row>; walk?: Walk }
|
|
39
39
|
|
|
40
40
|
export const declarationsTable = (root: string): string | null => {
|
|
@@ -110,7 +110,7 @@ const mtimeOf = (d: string): number => {
|
|
|
110
110
|
async function freshWalk(root: string, w: Walk): Promise<{ walk: Walk; moved: boolean }> {
|
|
111
111
|
const known = new Set(w.dirs.map(([d]) => d))
|
|
112
112
|
const dirs: [string, number][] = []
|
|
113
|
-
const files = new Set(
|
|
113
|
+
const files = new Set(w.units)
|
|
114
114
|
const found: string[] = []
|
|
115
115
|
let moved = false
|
|
116
116
|
let prune: ReadonlySet<string> | null = null
|
|
@@ -129,18 +129,17 @@ async function freshWalk(root: string, w: Walk): Promise<{ walk: Walk; moved: bo
|
|
|
129
129
|
for (const e of entries) {
|
|
130
130
|
const sub = join(d, e.name)
|
|
131
131
|
if (!e.isDirectory()) {
|
|
132
|
-
if (e.name.endsWith(
|
|
132
|
+
if (e.name.endsWith(UNIT_SUFFIX)) files.add(sub)
|
|
133
133
|
continue
|
|
134
134
|
}
|
|
135
135
|
if (known.has(sub) || SKIPPED_DIRS.has(e.name) || e.name.startsWith('.')) continue
|
|
136
136
|
const { prunedDirs, walk } = await import('../core/repo-walk.ts')
|
|
137
137
|
prune ??= prunedDirs(root)
|
|
138
|
-
if (!prune.has(sub)) walk(sub, found,
|
|
138
|
+
if (!prune.has(sub)) walk(sub, found, UNIT_SUFFIX, undefined, prune, dirs)
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
-
for (const f of found)
|
|
142
|
-
|
|
143
|
-
return { walk: { dirs, checks: all.filter((f) => f.endsWith(CHECK_SUFFIX)), units: all.filter((f) => f.endsWith(UNIT_SUFFIX)) }, moved }
|
|
141
|
+
for (const f of found) files.add(f)
|
|
142
|
+
return { walk: { dirs, units: [...files].sort() }, moved }
|
|
144
143
|
}
|
|
145
144
|
|
|
146
145
|
/** the table written whole through a rename, so a reader never sees half of it; a table that cannot be written costs
|
|
@@ -175,7 +174,7 @@ export async function preCommitFromTable(root: string): Promise<string[] | null>
|
|
|
175
174
|
const builtins = builtinFiles(builtinsOf(root, BUILTIN_CHECK_DIR))
|
|
176
175
|
if (builtins == null) return null
|
|
177
176
|
const { walk, moved } = await freshWalk(root, table.walk)
|
|
178
|
-
const run = answerOf(table, [...builtins, ...walk.
|
|
177
|
+
const run = answerOf(table, [...builtins, ...walk.units], stampOf)
|
|
179
178
|
if (run != null && moved) writeTable(path, { ...table, walk })
|
|
180
179
|
return run
|
|
181
180
|
}
|
|
@@ -205,9 +204,8 @@ export async function discoverPreCommit(root: string): Promise<PreCommitDiscover
|
|
|
205
204
|
let skipped = 0
|
|
206
205
|
let imported = 0
|
|
207
206
|
const slow: { path: string; ms: number }[] = []
|
|
208
|
-
const { BUILTIN_CHECK_DIR: builtinDir, discoverChecks
|
|
209
|
-
// the tree is walked whole once, then kept up to date by the dirs that moved
|
|
210
|
-
// dir timed
|
|
207
|
+
const { BUILTIN_CHECK_DIR: builtinDir, discoverChecks } = await import('./discover-checks.ts')
|
|
208
|
+
// the tree is walked whole once, then kept up to date by the dirs that moved, every dir timed
|
|
211
209
|
let walk: Walk | null = null
|
|
212
210
|
if (table.walk != null && path != null) {
|
|
213
211
|
const fresh = await freshWalk(root, table.walk)
|
|
@@ -221,8 +219,8 @@ export async function discoverPreCommit(root: string): Promise<PreCommitDiscover
|
|
|
221
219
|
const { prunedDirs, walk: walkTree } = await import('../core/repo-walk.ts')
|
|
222
220
|
const found: string[] = []
|
|
223
221
|
const dirs: [string, number][] = []
|
|
224
|
-
walkTree(root, found,
|
|
225
|
-
walk = { dirs,
|
|
222
|
+
walkTree(root, found, UNIT_SUFFIX, undefined, prunedDirs(root), dirs)
|
|
223
|
+
walk = { dirs, units: found.sort() }
|
|
226
224
|
table.walk = walk
|
|
227
225
|
changed = true
|
|
228
226
|
}
|
|
@@ -230,7 +228,7 @@ export async function discoverPreCommit(root: string): Promise<PreCommitDiscover
|
|
|
230
228
|
const shared = readShared(sharedPath)
|
|
231
229
|
let sharedChanged = false
|
|
232
230
|
const checks = await discoverChecks(root, {
|
|
233
|
-
...(walk == null ? {} : {
|
|
231
|
+
...(walk == null ? {} : { units: walk.units }),
|
|
234
232
|
skip: (f) => {
|
|
235
233
|
const row = table.files[f]
|
|
236
234
|
const s = stamp(f)
|
|
@@ -277,13 +275,6 @@ export async function discoverPreCommit(root: string): Promise<PreCommitDiscover
|
|
|
277
275
|
for (const k of keys.slice(0, Math.max(0, keys.length - SHARED_MAX))) delete shared.rows[k]
|
|
278
276
|
writeTable(sharedPath, shared)
|
|
279
277
|
}
|
|
280
|
-
// a legacy script is never imported, so its row comes from its source: it runs nothing at commit
|
|
281
|
-
for (const f of walk?.checks ?? []) {
|
|
282
|
-
const s = stamp(f)
|
|
283
|
-
if (s == null || table.files[f]?.stamp === s || !isLegacyCheckFile(f)) continue
|
|
284
|
-
table.files[f] = { stamp: s, preCommit: false }
|
|
285
|
-
changed = true
|
|
286
|
-
}
|
|
287
278
|
let written = !changed
|
|
288
279
|
if (changed && path != null) {
|
|
289
280
|
// a row whose file is gone is dropped, so the table never outgrows the repo
|
|
@@ -291,6 +282,6 @@ export async function discoverPreCommit(root: string): Promise<PreCommitDiscover
|
|
|
291
282
|
written = writeTable(path, table)
|
|
292
283
|
}
|
|
293
284
|
const builtins = builtinFiles(builtinsOf(root, BUILTIN_CHECK_DIR))
|
|
294
|
-
const settled = path != null && written && walk != null && builtins != null && answerOf(table, [...builtins, ...walk.
|
|
285
|
+
const settled = path != null && written && walk != null && builtins != null && answerOf(table, [...builtins, ...walk.units], stamp) != null
|
|
295
286
|
return { checks, slow, imported, skipped, settled }
|
|
296
287
|
}
|
package/src/gate/run-check.ts
CHANGED
|
@@ -205,10 +205,6 @@ export async function runCheckPass(root: string, o: CheckOpts = {}): Promise<Che
|
|
|
205
205
|
})
|
|
206
206
|
const lines: Line[] = []
|
|
207
207
|
const say = (l: Line, to: (line: string) => void = print): void => { lines.push(l); to(formatLine(l, false)) }
|
|
208
|
-
// a declaration in a shape the check file replaced is reported by check
|
|
209
|
-
// SK016, which also carries the fixer that rewrites it: one owner, one
|
|
210
|
-
// line, one command, rather than a warning per surface.
|
|
211
|
-
//
|
|
212
208
|
// checks this run did not ask about: named here rather than printed one
|
|
213
209
|
// line each, because twenty four `skip:` lines is the wall of text the
|
|
214
210
|
// page just replaced
|
package/src/gate/run-fix.ts
CHANGED
|
@@ -59,23 +59,11 @@ export async function runFix(root: string, o: FixOpts = {}): Promise<number> {
|
|
|
59
59
|
// what each row resolved to: its declared `fix` and whether it is off
|
|
60
60
|
const inventory = await gateInventory(root, config)
|
|
61
61
|
const resolved = new Map(inventory.map((r) => [r.decl.id, r.runs]))
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
...(
|
|
66
|
-
|
|
67
|
-
// a built-in repair writes through `c` (tests/repair-doors.test.ts holds them to it); a repo's own file is read
|
|
68
|
-
...(u.rel == null ? {} : { unguarded: () => { const r = rawAccessInClosure(root, u.path, { skip: LIB_ROOT }); return r == null ? null : rawAccessLine(r) } }),
|
|
69
|
-
})),
|
|
70
|
-
...(config.rules ?? []).map((r): Target => {
|
|
71
|
-
const runs = resolved.get(r.id)
|
|
72
|
-
return {
|
|
73
|
-
id: r.id, title: r.title, owner: r.owner, when: runs?.fix ?? 'none', off: runs?.off ?? null, unguarded: () => 'a rules: [] repair gets the bare root, never `c`',
|
|
74
|
-
run: (c) => r.lint(c, { root: c.root, config: c.config }),
|
|
75
|
-
fix: r.fix == null ? undefined : (c) => r.fix!({ root: c.root, config: c.config }),
|
|
76
|
-
}
|
|
77
|
-
}),
|
|
78
|
-
]
|
|
62
|
+
const all: Target[] = (await discoverChecks(root)).map((u): Target => ({
|
|
63
|
+
id: u.id, title: u.title, owner: u.owner, run: u.def.run, fix: u.def.repair, when: resolved.get(u.id)?.fix ?? u.def.fix, off: resolved.get(u.id)?.off ?? null,
|
|
64
|
+
// a built-in repair writes through `c` (tests/repair-doors.test.ts holds them to it); a repo's own file is read
|
|
65
|
+
...(u.rel == null ? {} : { unguarded: () => { const r = rawAccessInClosure(root, u.path, { skip: LIB_ROOT }); return r == null ? null : rawAccessLine(r) } }),
|
|
66
|
+
}))
|
|
79
67
|
|
|
80
68
|
// no ids: the repairs declared for the gate. A manual one runs by name
|
|
81
69
|
let targets = all.filter((r) => r.fix != null && r.when === 'ci')
|
package/src/gate/run-fixers.ts
CHANGED
|
@@ -13,14 +13,11 @@ import { dirname, isAbsolute, join } from 'path'
|
|
|
13
13
|
import { fileURLToPath } from 'url'
|
|
14
14
|
import { armHooks } from '../hooks/run-hooks.ts'
|
|
15
15
|
import { FOREIGN_WHY, isForeign } from '../core/foreign.ts'
|
|
16
|
-
import {
|
|
16
|
+
import type { RepoConfig } from '../repo-config.ts'
|
|
17
17
|
import { runFix } from './run-fix.ts'
|
|
18
18
|
import { repoOff } from '../core/when.ts'
|
|
19
|
-
import {
|
|
20
|
-
import { repoCheckFiles } from '../core/repo-walk.ts'
|
|
19
|
+
import { repoUnitFiles } from '../core/repo-walk.ts'
|
|
21
20
|
import { mutateLease, withMutateLease } from '../core/locked-write.ts'
|
|
22
|
-
import { layoutSummary, migrateLayout } from '../core/migrate-layout.ts'
|
|
23
|
-
import { renderPolicy } from '../checks/SK004-gitignore-policy.check.ts'
|
|
24
21
|
import { spawnWithTimeout } from '../core/spawn-timeout.ts'
|
|
25
22
|
import { gitBin } from '../core/git-bin.ts'
|
|
26
23
|
import { LAYOUT } from '../core/layout.ts'
|
|
@@ -190,13 +187,12 @@ const writeMemo = (root: string, key: string): void => {
|
|
|
190
187
|
} catch { /* a memo that cannot be kept only means the next pass runs the fixers */ }
|
|
191
188
|
}
|
|
192
189
|
|
|
193
|
-
/** the bytes of repo.config.ts and the set of
|
|
194
|
-
*
|
|
190
|
+
/** the bytes of repo.config.ts and the set of unit files, as one hash. Read without git, so a repo with no history
|
|
191
|
+
* is covered too */
|
|
195
192
|
function shapeStamp(root: string): string {
|
|
196
193
|
let config = ''
|
|
197
194
|
try { config = readFileSync(join(root, 'repo.config.ts'), 'utf8') } catch {}
|
|
198
|
-
|
|
199
|
-
return String(Bun.hash(`${config}\0${files.join('\0')}`))
|
|
195
|
+
return String(Bun.hash(`${config}\0${repoUnitFiles(root).join('\0')}`))
|
|
200
196
|
}
|
|
201
197
|
|
|
202
198
|
export type FixPassOpts = {
|
|
@@ -254,40 +250,8 @@ export async function runFixPass(root: string, config: RepoConfig, o: FixPassOpt
|
|
|
254
250
|
return { ran: false, touched: [], failed: false, reshaped: false }
|
|
255
251
|
}
|
|
256
252
|
|
|
257
|
-
async function fixPassBody(root: string,
|
|
258
|
-
let config = loaded
|
|
253
|
+
async function fixPassBody(root: string, config: RepoConfig, o: FixPassOpts, verify: boolean): Promise<FixPassResult> {
|
|
259
254
|
const shapeBefore = shapeStamp(root)
|
|
260
|
-
// the old root layout moves under .shipkit/ before anything else reads a
|
|
261
|
-
// path: a move is not a decision, so it lands as one machine commit and
|
|
262
|
-
// only what a machine cannot decide reaches a human. Runs before the tree
|
|
263
|
-
// snapshot, and before hooks arm, because the hooks folder may be what moves.
|
|
264
|
-
// A foreign repo's folders are the team's, whatever their name: none moves
|
|
265
|
-
if (!verify && o.only == null && !isForeign(root)) {
|
|
266
|
-
const m = migrateLayout(root, { config, renderGitignore: (t, legacy, cfg) => renderPolicy(t, cfg ?? config, legacy) })
|
|
267
|
-
// the move rewrote repo.config.ts, so the config loaded before it names
|
|
268
|
-
// folders that are gone, and every fixer below must read the new one
|
|
269
|
-
if (m.swept.includes('repo.config.ts')) {
|
|
270
|
-
try { config = await loadRepoConfig(root, { fresh: true }) } catch (e) {
|
|
271
|
-
o.print(`WARN repo.config.ts does not load after the move rewrote it: ${String((e as Error)?.message ?? e).slice(0, 160)}`)
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
const what = layoutSummary(m)
|
|
275
|
-
if (what !== '') {
|
|
276
|
-
if (m.uncommitted === true) {
|
|
277
|
-
o.print(`WARN layout: ${what}. The commit did not land`)
|
|
278
|
-
const p = m.pending ?? []
|
|
279
|
-
o.print(` fix: commit exactly these paths, never a bare commit: git commit -m 'chore: ${what}' -- ${p.slice(0, 12).join(' ')}${p.length > 12 ? ` (+${p.length - 12} more, listed by git status)` : ''}`)
|
|
280
|
-
} else o.print(`ok: layout: ${what}${m.commit != null ? `, committed as ${m.commit}` : ''}`)
|
|
281
|
-
}
|
|
282
|
-
if (m.deferred != null) {
|
|
283
|
-
o.print(`WARN the move under .shipkit/ is deferred: ${m.deferred}`)
|
|
284
|
-
o.print(' fix: commit or discard that edit, then re-run shipkit ci')
|
|
285
|
-
}
|
|
286
|
-
for (const r of m.refusals) {
|
|
287
|
-
o.print(`WARN ${r.from}/ cannot move to ${r.to}/: ${r.reason}`)
|
|
288
|
-
o.print(` fix: move the files into ${r.to}/ yourself, then delete ${r.from}/`)
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
255
|
// the project's resources file its CLAUDE.md loads (context/project-context.ts), written where no daemon reaches:
|
|
292
256
|
// a worktree, a stranger's repo. Gitignored, so never a fixer rewrite and never a decision; the line is SK003's.
|
|
293
257
|
// Measured: about 80 ms the first time in a process, 10 to 15 ms when nothing moved
|