rvlib-shipkit 2.31.0 → 2.33.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 +51 -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 +122 -76
- 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 +20 -221
- 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 +27 -25
- 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 +97 -183
- package/src/advisors/tunnel.ts +6 -5
- package/src/advisors/users-listen.ts +92 -0
- package/src/advisors/users-router.ts +261 -87
- 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_Capacity.ts +6 -2
- package/src/cli/cmd_Checks.ts +0 -14
- package/src/cli/cmd_Ci.ts +2 -1
- 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_Shot.ts +26 -4
- 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 +15 -4
- package/src/collections/collection-types.ts +1 -1
- package/src/collections/review.ts +5 -4
- package/src/core/admission.ts +268 -0
- 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/code-lines.ts +36 -21
- 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/machine-read.ts +5 -2
- 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/peer-sk.ts +8 -0
- 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/admit-heavy.ts +150 -0
- package/src/gate/check-runner.ts +6 -0
- package/src/gate/discover-checks.ts +42 -32
- package/src/gate/gate-checks.ts +21 -131
- package/src/gate/head-gate.ts +1 -1
- package/src/gate/job-run.ts +2 -1
- package/src/gate/pre-commit-discovery.ts +22 -28
- package/src/gate/run-check.ts +3 -4
- package/src/gate/run-ci.ts +4 -0
- 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 +7 -12
- package/src/home/space-page.ts +3 -2
- package/src/home/supervise.ts +3 -7
- package/src/hooks/commit-msg-run.ts +61 -0
- package/src/hooks/commit-run.ts +16 -166
- package/src/hooks/gate-outcome.ts +108 -0
- package/src/hooks/git-hook.ts +9 -9
- package/src/hooks/hook-config.ts +8 -8
- package/src/hooks/leak-guard.ts +1 -1
- package/src/hooks/pre-commit-checks.ts +1 -1
- package/src/hooks/run-hooks.ts +2 -6
- package/src/hooks/shared-file.ts +3 -2
- 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/plan/planner.ts +3 -2
- 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 +36 -64
- package/src/review/answer-kinds.ts +63 -4
- package/src/review/blocked-guard.ts +11 -0
- package/src/review/blocked-object.ts +298 -0
- package/src/review/cells.ts +144 -230
- 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 +51 -47
- 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-parties.ts +28 -0
- package/src/review/store.ts +94 -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 +804 -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/copy.ts +4 -4
- 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/dock-st.ts +1 -1
- 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 +191 -53
- 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 +8 -4
- package/src/serve/hub-app/review/review-kit.ts +17 -11
- package/src/serve/hub-app/review/review-list.tsx +30 -35
- package/src/serve/hub-app/review/review-st.ts +32 -42
- package/src/serve/hub-app/review/review-thread.tsx +139 -85
- package/src/serve/hub-app/review/review-views.tsx +127 -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 +381 -202
- package/src/serve/hub-app/review/tone-bar.tsx +129 -0
- package/src/serve/hub-app/review/tones.ts +53 -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 +189 -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/client.ts +2 -1
- package/src/shot/film-box.ts +0 -20
- package/src/shot/on-place.ts +141 -0
- 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,52 +0,0 @@
|
|
|
1
|
-
// THE WRITE HALF of the check file port (core/port-check-file.ts), in its own
|
|
2
|
-
// process: whether an undeclared `run` body can be keyed on its reads is a walk
|
|
3
|
-
// of its import closure on disk (core/raw-access.ts), which no check context
|
|
4
|
-
// read can stand for, so SK029's repair reaches it through `c.exec`.
|
|
5
|
-
//
|
|
6
|
-
// bun port-check-cli.ts <root> <rel> [<rel> …] → one json line on stdout
|
|
7
|
-
import { readFileSync } from 'fs'
|
|
8
|
-
import { join } from 'path'
|
|
9
|
-
import { atomicWrite } from './locked-write.ts'
|
|
10
|
-
import { LIB_ROOT } from './lib-root.ts'
|
|
11
|
-
import { rawAccessInClosure } from './raw-access.ts'
|
|
12
|
-
import { findCheckObject, portCheckSource, retiredKeysIn } from './port-check-file.ts'
|
|
13
|
-
import { plainDefaultFor } from './port-check-files.ts'
|
|
14
|
-
|
|
15
|
-
export type PortRun = { did: string[]; hand: string[] }
|
|
16
|
-
|
|
17
|
-
/** why an undeclared `run` body cannot be keyed on its reads, or null */
|
|
18
|
-
function rawAccessOf(root: string, rel: string, src: string): string | null {
|
|
19
|
-
const obj = findCheckObject(src, { plainDefault: plainDefaultFor(rel) })
|
|
20
|
-
const keys = new Set(obj?.props.map((p) => p.key) ?? [])
|
|
21
|
-
if (!keys.has('run') || keys.has('inputs') || keys.has('ttl') || keys.has('never')) return null
|
|
22
|
-
const r = rawAccessInClosure(root, join(root, rel), { skip: LIB_ROOT })
|
|
23
|
-
return r == null ? null : `its imports reach the disk around c (${r.file}:${r.line}, ${r.what})`
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function portFiles(root: string, rels: string[]): PortRun {
|
|
27
|
-
const did: string[] = []
|
|
28
|
-
const hand: string[] = []
|
|
29
|
-
for (const rel of rels) {
|
|
30
|
-
const abs = join(root, rel)
|
|
31
|
-
let src: string
|
|
32
|
-
try { src = readFileSync(abs, 'utf8') } catch (e) { hand.push(`${rel}: unreadable (${(e as Error).message})`); continue }
|
|
33
|
-
const plainDefault = plainDefaultFor(rel)
|
|
34
|
-
const keys = retiredKeysIn(src, { plainDefault })
|
|
35
|
-
if (keys.length === 0) continue
|
|
36
|
-
const r = portCheckSource(src, { plainDefault, rawAccess: rawAccessOf(root, rel, src) })
|
|
37
|
-
if ('error' in r) { hand.push(`${rel}: ${r.error}`); continue }
|
|
38
|
-
if (!r.changed) continue
|
|
39
|
-
atomicWrite(abs, r.source)
|
|
40
|
-
did.push(`${rel} declares runs, cache, fix and applies (was: ${keys.join(', ')})${r.notes.length > 0 ? `. Note: ${r.notes.join('; ')}` : ''}`)
|
|
41
|
-
}
|
|
42
|
-
return { did, hand }
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (import.meta.main) {
|
|
46
|
-
const [root, ...rels] = process.argv.slice(2)
|
|
47
|
-
if (root == null) {
|
|
48
|
-
console.error('usage: bun port-check-cli.ts <root> <rel> [<rel> …]')
|
|
49
|
-
process.exit(2)
|
|
50
|
-
}
|
|
51
|
-
console.log(JSON.stringify(portFiles(root, rels)))
|
|
52
|
-
}
|
|
@@ -1,295 +0,0 @@
|
|
|
1
|
-
// THE PORT of a check file written before every context was explicit: its
|
|
2
|
-
// source in, the same check out with `runs`, `cache`, `fix` and `applies`
|
|
3
|
-
// spelled out, carrying the values the retired keys resolved to (the gate,
|
|
4
|
-
// the health pass and the planner of 0.62), so a ported check runs exactly
|
|
5
|
-
// where it ran before. Pure: text in, text out. SK016 reports what this finds
|
|
6
|
-
// and its repair applies it (core/port-check-cli.ts reaches the disk).
|
|
7
|
-
//
|
|
8
|
-
// the one constraint a reader breaks first: it edits the check object by the
|
|
9
|
-
// RANGE of each top level property, found on a masked copy of the source
|
|
10
|
-
// (strings, comments and regex literals blanked), so a value, a comment or a
|
|
11
|
-
// multi line lambda it does not touch comes out byte for byte.
|
|
12
|
-
|
|
13
|
-
/** the keys the explicit declaration retired */
|
|
14
|
-
export const RETIRED_KEYS = ['when', 'inputs', 'ttl', 'never', 'every', 'cron', 'whenInactive', 'planOff', 'cacheKey'] as const
|
|
15
|
-
|
|
16
|
-
/** the range a repo row nothing keys ran on, before it declared one */
|
|
17
|
-
const DAILY = "['20h', '28h']"
|
|
18
|
-
|
|
19
|
-
/** the source with every string, comment, template text and regex literal
|
|
20
|
-
* blanked to spaces, newlines kept, so offsets line up with the original */
|
|
21
|
-
export function maskSource(src: string): string {
|
|
22
|
-
const out = src.split('')
|
|
23
|
-
const blank = (from: number, to: number): void => { for (let k = from; k < to; k++) if (out[k] !== '\n') out[k] = ' ' }
|
|
24
|
-
let i = 0
|
|
25
|
-
// one entry per open template: the brace depth of its current `${`
|
|
26
|
-
const tpl: number[] = []
|
|
27
|
-
let last = ''
|
|
28
|
-
const regexOk = (): boolean => last === '' || '(,=:[!&|?{};+-*%<>~^'.includes(last)
|
|
29
|
-
const readTemplateText = (): void => {
|
|
30
|
-
// at a character inside template text: blank until `${` or the closing backtick
|
|
31
|
-
const start = i
|
|
32
|
-
while (i < src.length && src[i] !== '`' && !(src[i] === '$' && src[i + 1] === '{')) i += src[i] === '\\' ? 2 : 1
|
|
33
|
-
blank(start, i)
|
|
34
|
-
if (src[i] === '`') { i++; tpl.pop(); last = 'x' } else { i += 2; tpl[tpl.length - 1] = 0; last = '{' }
|
|
35
|
-
}
|
|
36
|
-
while (i < src.length) {
|
|
37
|
-
const ch = src[i]!
|
|
38
|
-
const next = src[i + 1]
|
|
39
|
-
if (ch === '/' && next === '/') { const s = i; while (i < src.length && src[i] !== '\n') i++; blank(s, i); continue }
|
|
40
|
-
if (ch === '/' && next === '*') { const s = i; const e = src.indexOf('*/', i + 2); i = e < 0 ? src.length : e + 2; blank(s, i); continue }
|
|
41
|
-
if (ch === "'" || ch === '"') {
|
|
42
|
-
const s = i
|
|
43
|
-
i++
|
|
44
|
-
while (i < src.length && src[i] !== ch && src[i] !== '\n') i += src[i] === '\\' ? 2 : 1
|
|
45
|
-
i++
|
|
46
|
-
blank(s + 1, i - 1)
|
|
47
|
-
last = 'x'
|
|
48
|
-
continue
|
|
49
|
-
}
|
|
50
|
-
if (ch === '`') { tpl.push(-1); i++; readTemplateText(); continue }
|
|
51
|
-
if (tpl.length > 0 && tpl[tpl.length - 1]! >= 0) {
|
|
52
|
-
if (ch === '{') tpl[tpl.length - 1]!++
|
|
53
|
-
if (ch === '}') {
|
|
54
|
-
if (tpl[tpl.length - 1] === 0) { tpl[tpl.length - 1] = -1; i++; readTemplateText(); continue }
|
|
55
|
-
tpl[tpl.length - 1]!--
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
if (ch === '/' && regexOk()) {
|
|
59
|
-
const s = i
|
|
60
|
-
let j = i + 1
|
|
61
|
-
let inClass = false
|
|
62
|
-
while (j < src.length && src[j] !== '\n') {
|
|
63
|
-
if (src[j] === '\\') { j += 2; continue }
|
|
64
|
-
if (src[j] === '[') inClass = true
|
|
65
|
-
else if (src[j] === ']') inClass = false
|
|
66
|
-
else if (src[j] === '/' && !inClass) break
|
|
67
|
-
j++
|
|
68
|
-
}
|
|
69
|
-
if (src[j] === '/') { j++; while (/[a-z]/.test(src[j] ?? '')) j++; blank(s + 1, j - 1); i = j; last = 'x'; continue }
|
|
70
|
-
}
|
|
71
|
-
if (!/\s/.test(ch)) last = ch
|
|
72
|
-
i++
|
|
73
|
-
}
|
|
74
|
-
return out.join('')
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/** one top level property of the check object: its whole segment (leading
|
|
78
|
-
* whitespace and comments included), and where its key and value sit */
|
|
79
|
-
export type Prop = { key: string | null; seg: [number, number]; keyAt: number; value: string }
|
|
80
|
-
|
|
81
|
-
export type CheckObject = { open: number; close: number; props: Prop[]; indent: string }
|
|
82
|
-
|
|
83
|
-
const KEY_RE = /^\s*(?:(?:async|get|set)\s+)?([A-Za-z_$][\w$]*)\s*\??\s*[:(]/
|
|
84
|
-
|
|
85
|
-
/** the check object of a file: `check({...})`, else `export default {...}`
|
|
86
|
-
* in a check file. Null when there is none */
|
|
87
|
-
export function findCheckObject(src: string, o: { plainDefault: boolean }): CheckObject | null {
|
|
88
|
-
const m = maskSource(src)
|
|
89
|
-
const call = /\bcheck\s*\(\s*\{/.exec(m)
|
|
90
|
-
const plain = o.plainDefault ? /\bexport\s+default\s*\{/.exec(m) : null
|
|
91
|
-
const hit = call ?? plain
|
|
92
|
-
if (hit == null) return null
|
|
93
|
-
const open = hit.index + hit[0].length - 1
|
|
94
|
-
let depth = 0
|
|
95
|
-
let start = open + 1
|
|
96
|
-
const segs: [number, number][] = []
|
|
97
|
-
let close = -1
|
|
98
|
-
for (let k = open; k < m.length; k++) {
|
|
99
|
-
const ch = m[k]
|
|
100
|
-
if (ch === '{' || ch === '(' || ch === '[') depth++
|
|
101
|
-
else if (ch === '}' || ch === ')' || ch === ']') {
|
|
102
|
-
depth--
|
|
103
|
-
if (depth === 0) { segs.push([start, k]); close = k; break }
|
|
104
|
-
} else if (ch === ',' && depth === 1) { segs.push([start, k]); start = k + 1 }
|
|
105
|
-
}
|
|
106
|
-
if (close < 0) return null
|
|
107
|
-
const props: Prop[] = segs.map(([a, b]) => {
|
|
108
|
-
const km = KEY_RE.exec(m.slice(a, b))
|
|
109
|
-
if (km == null) return { key: null, seg: [a, b], keyAt: -1, value: '' }
|
|
110
|
-
const keyAt = a + km.index + km[0].indexOf(km[1]!)
|
|
111
|
-
const colon = m.indexOf(':', keyAt)
|
|
112
|
-
const isColon = colon >= 0 && colon < b && m.slice(keyAt + km[1]!.length, colon).trim().replace('?', '') === ''
|
|
113
|
-
return { key: km[1]!, seg: [a, b], keyAt, value: isColon ? src.slice(colon + 1, b).trim() : '' }
|
|
114
|
-
})
|
|
115
|
-
const first = props.find((p) => p.key != null)
|
|
116
|
-
const indent = first == null ? ' ' : (/[ \t]*$/.exec(src.slice(0, first.keyAt))?.[0] ?? ' ')
|
|
117
|
-
return { open, close, props, indent }
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/** what a file's check object lacks or still says in the retired shape: each
|
|
121
|
-
* retired key it declares, `fix` when it is a function, and `runs` when the
|
|
122
|
-
* object declares none (a file that declared nothing ran on defaults) */
|
|
123
|
-
export function retiredKeysIn(src: string, o: { plainDefault: boolean }): string[] {
|
|
124
|
-
const obj = findCheckObject(src, o)
|
|
125
|
-
if (obj == null) return []
|
|
126
|
-
const keys = new Set(obj.props.map((p) => p.key))
|
|
127
|
-
const out: string[] = RETIRED_KEYS.filter((k) => keys.has(k))
|
|
128
|
-
const fix = obj.props.find((p) => p.key === 'fix')
|
|
129
|
-
if (fix != null && !/^(['"])(none|ci|manual)\1$/.test(fix.value)) out.push('fix')
|
|
130
|
-
if (!keys.has('runs') && (keys.has('run') || keys.has('cmd'))) out.push('runs')
|
|
131
|
-
return out
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/** a string literal's value, or null for any other expression */
|
|
135
|
-
export const literal = (v: string | undefined): string | null => {
|
|
136
|
-
const m = v == null ? null : /^(['"`])([^'"`$\\]*)\1$/.exec(v.trim())
|
|
137
|
-
return m == null ? null : m[2]!
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/** what a check declared before, as the port reads it */
|
|
141
|
-
export type LegacyDecl = {
|
|
142
|
-
/** the `when` literal, null when absent, undefined when it is not a literal */
|
|
143
|
-
when: string | null | undefined
|
|
144
|
-
build: boolean
|
|
145
|
-
body: 'run' | 'cmd'
|
|
146
|
-
/** the expression text of each declaration, absent when not declared */
|
|
147
|
-
inputs?: string
|
|
148
|
-
ttl?: string
|
|
149
|
-
never?: string
|
|
150
|
-
cacheKey?: string
|
|
151
|
-
every?: string
|
|
152
|
-
cron?: string
|
|
153
|
-
whenInactive?: string
|
|
154
|
-
planOff?: string
|
|
155
|
-
/** a repair function is declared */
|
|
156
|
-
repair: boolean
|
|
157
|
-
/** why the body's imports reach the disk around `c`, for an undeclared
|
|
158
|
-
* `run` body (core/raw-access.ts), else null */
|
|
159
|
-
rawAccess: string | null
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
export type Derived = { runs: string; cache: string; fix: string; applies: string; notes: string[] }
|
|
163
|
-
|
|
164
|
-
/** the explicit declaration a legacy one resolved to, or why it cannot be
|
|
165
|
-
* carried across without a person */
|
|
166
|
-
export function deriveExplicit(d: LegacyDecl, q: (s: string) => string): Derived | { error: string } {
|
|
167
|
-
const notes: string[] = []
|
|
168
|
-
if (d.when === undefined) return { error: '`when` is not a string literal' }
|
|
169
|
-
const whenLit = d.when
|
|
170
|
-
const off = whenLit != null && (whenLit === 'off' || whenLit.startsWith('off:')) ? whenLit.slice(4).trim() || 'off' : null
|
|
171
|
-
const at = off != null ? 'always' : (whenLit ?? 'always')
|
|
172
|
-
if (!['always', 'release', 'health'].includes(at)) return { error: `when '${whenLit}' is not always, release, health or off:<why>` }
|
|
173
|
-
const ttlLit = d.ttl == null ? null : literal(d.ttl)
|
|
174
|
-
const forever = ttlLit === 'forever'
|
|
175
|
-
// the population the gate read it as
|
|
176
|
-
const keyed = d.inputs != null || (d.ttl == null && d.never == null && d.body === 'run' && d.rawAccess == null)
|
|
177
|
-
const world = d.ttl != null
|
|
178
|
-
// the gate axes: a build step never ran in the health pass
|
|
179
|
-
const gates = at === 'always' ? [true, true, true] : at === 'release' ? [false, true, true] : [false, false, false]
|
|
180
|
-
const onHealth = !d.build && true
|
|
181
|
-
// the planner: only an always or health row, and never a build step off the gate
|
|
182
|
-
const plannable = (at === 'always' || at === 'health') && !(d.build && at === 'health')
|
|
183
|
-
const gate = at !== 'health'
|
|
184
|
-
const declaredClock = d.cron != null || d.every !== undefined
|
|
185
|
-
const fallback = forever ? "'once'" : d.ttl != null ? d.ttl : d.build ? null : keyed ? null : DAILY
|
|
186
|
-
const clocked = fallback != null || declaredClock
|
|
187
|
-
const onChange = forever || (!world && (keyed || (gate && !clocked)))
|
|
188
|
-
let onSave = 'false'
|
|
189
|
-
let onClock = 'false'
|
|
190
|
-
if (plannable) {
|
|
191
|
-
onSave = onChange ? (keyed || forever ? "'moved'" : "'burst'") : 'false'
|
|
192
|
-
const every = d.cron ?? (d.every !== undefined ? d.every : fallback)
|
|
193
|
-
if (every != null && every.trim() !== 'null') {
|
|
194
|
-
if (literal(every) === 'once') onClock = "'once'"
|
|
195
|
-
else onClock = `{ every: ${every}, inactive: ${d.whenInactive ?? q('wait')} }`
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
if (onClock === "'once'" && !forever) return { error: "every 'once' without ttl 'forever': a fact asked once needs a declared value" }
|
|
199
|
-
if (forever && onClock !== "'once'" && plannable) return { error: "ttl 'forever' with a declared every: a fact is asked once, never on a period" }
|
|
200
|
-
let cache: string
|
|
201
|
-
if (d.inputs != null) cache = `{ by: ${q('files')}, inputs: ${d.inputs}, key: ${d.cacheKey ?? 'null'} }`
|
|
202
|
-
else if (forever) cache = `{ by: ${q('fact')}, key: ${d.cacheKey ?? `() => ${q('declared')}`} }`
|
|
203
|
-
else if (d.ttl != null) cache = `{ by: ${q('ttl')}, span: ${d.ttl}, key: ${d.cacheKey ?? 'null'} }`
|
|
204
|
-
else if (d.never != null) cache = `{ by: ${q('never')}, why: ${d.never} }`
|
|
205
|
-
else if (d.body === 'run' && d.rawAccess == null) cache = `{ by: ${q('reads')} }`
|
|
206
|
-
else if (d.body === 'run') cache = `{ by: ${q('never')}, why: ${q(d.rawAccess!)} }`
|
|
207
|
-
else cache = `{ by: ${q('never')}, why: ${q('a cmd declaring no inputs: nothing keys it')} }`
|
|
208
|
-
if (forever && !plannable) return { error: "ttl 'forever' on a check the planner never ran: a fact nobody asks once is never answered" }
|
|
209
|
-
// the ci fix pass applied every repair; a check off the quick gate now
|
|
210
|
-
// repairs only by name
|
|
211
|
-
const fix = !d.repair ? 'none' : gates[0] ? 'ci' : 'manual'
|
|
212
|
-
if (d.repair && !gates[0]) notes.push("its repair ran in the ci fix pass although the gate did not run it: now fix 'manual', shipkit check --fix <id> applies it")
|
|
213
|
-
if (d.build && d.repair) return { error: 'a build step with a repair: a tool repairs its own findings, drop one of them' }
|
|
214
|
-
const runs = `{ onPreCommit: false, onCi: ${gates[0]}, onFull: ${gates[1]}, onRelease: ${gates[2]}, onHealth: ${d.build ? false : onHealth}, onSave: ${onSave}, onClock: ${onClock} }`
|
|
215
|
-
let applies = d.planOff ?? q('always')
|
|
216
|
-
if (d.planOff != null) notes.push('its planOff only kept it off the planner; as applies it is n/a in every context while it gives a reason')
|
|
217
|
-
if (off != null) {
|
|
218
|
-
if (d.planOff != null) return { error: '`when` off and a planOff: say one reason' }
|
|
219
|
-
applies = `() => ${q(off)}`
|
|
220
|
-
notes.push('it was off in its own file: applies now gives the reason, so it runs nowhere')
|
|
221
|
-
}
|
|
222
|
-
return { runs, cache, fix, applies, notes }
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
export type PortResult =
|
|
226
|
-
| { changed: false; reason: string }
|
|
227
|
-
| { changed: true; source: string; notes: string[] }
|
|
228
|
-
| { changed: false; error: string }
|
|
229
|
-
|
|
230
|
-
/** the file ported, or why not. `rawAccess` is what the caller measured on
|
|
231
|
-
* the file's import closure, needed only for an undeclared `run` body */
|
|
232
|
-
export function portCheckSource(src: string, o: { plainDefault: boolean; rawAccess: string | null }): PortResult {
|
|
233
|
-
const obj = findCheckObject(src, o)
|
|
234
|
-
if (obj == null) return { changed: false, reason: 'no check object' }
|
|
235
|
-
const retired = retiredKeysIn(src, o)
|
|
236
|
-
if (retired.length === 0) return { changed: false, reason: 'already explicit' }
|
|
237
|
-
const byKey = new Map(obj.props.filter((p) => p.key != null).map((p) => [p.key!, p]))
|
|
238
|
-
for (const k of ['runs', 'cache', 'applies']) if (byKey.has(k)) return { changed: false, error: `it declares ${k} beside a retired shape: finish it by hand` }
|
|
239
|
-
const dq = /^\s*import[^\n]*"/m.test(src) && !/^\s*import[^\n]*'/m.test(src)
|
|
240
|
-
const q = (s: string): string => (dq ? `"${s.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"` : `'${s.replace(/\\/g, '\\\\').replace(/'/g, "\\'")}'`)
|
|
241
|
-
const val = (k: string): string | undefined => byKey.get(k)?.value
|
|
242
|
-
const build = val('build')?.trim() === 'true'
|
|
243
|
-
const body = byKey.has('cmd') ? 'cmd' : 'run'
|
|
244
|
-
const whenV = val('when')
|
|
245
|
-
const derived = deriveExplicit({
|
|
246
|
-
when: whenV == null ? null : (literal(whenV) ?? undefined),
|
|
247
|
-
build,
|
|
248
|
-
body,
|
|
249
|
-
inputs: val('inputs'),
|
|
250
|
-
ttl: val('ttl'),
|
|
251
|
-
never: val('never'),
|
|
252
|
-
cacheKey: val('cacheKey'),
|
|
253
|
-
every: val('every'),
|
|
254
|
-
cron: val('cron'),
|
|
255
|
-
whenInactive: val('whenInactive'),
|
|
256
|
-
planOff: val('planOff'),
|
|
257
|
-
repair: retired.includes('fix'),
|
|
258
|
-
rawAccess: o.rawAccess,
|
|
259
|
-
}, q)
|
|
260
|
-
if ('error' in derived) return { changed: false, error: derived.error }
|
|
261
|
-
// rebuild: drop the retired props, keep their comments above the new
|
|
262
|
-
// keys, rename a fix function to repair, insert before the body
|
|
263
|
-
const ind = obj.indent
|
|
264
|
-
const comments: string[] = []
|
|
265
|
-
const kept: string[] = []
|
|
266
|
-
let insertAt = -1
|
|
267
|
-
for (const p of obj.props) {
|
|
268
|
-
const text = src.slice(p.seg[0], p.seg[1])
|
|
269
|
-
if (p.key != null && (RETIRED_KEYS as readonly string[]).includes(p.key)) {
|
|
270
|
-
for (const l of src.slice(p.seg[0], p.keyAt).split('\n')) if (l.trim().startsWith('//')) comments.push(`${ind}${l.trim()}`)
|
|
271
|
-
continue
|
|
272
|
-
}
|
|
273
|
-
if (insertAt < 0 && (p.key === 'run' || p.key === 'cmd' || (p.key === 'fix' && retired.includes('fix')))) insertAt = kept.length
|
|
274
|
-
if (p.key === 'fix' && retired.includes('fix')) {
|
|
275
|
-
const rel = p.keyAt - p.seg[0]
|
|
276
|
-
kept.push(`${text.slice(0, rel)}repair${text.slice(rel + 3)}`)
|
|
277
|
-
continue
|
|
278
|
-
}
|
|
279
|
-
kept.push(text)
|
|
280
|
-
}
|
|
281
|
-
// a trailing comma leaves an empty last segment: keep it last
|
|
282
|
-
const tail = kept.length > 0 && kept[kept.length - 1]!.trim() === '' ? kept.pop()! : null
|
|
283
|
-
if (insertAt < 0 || insertAt > kept.length) insertAt = kept.length
|
|
284
|
-
// each new property is one segment shaped like the others: a newline,
|
|
285
|
-
// the indent, the key. The comments of the keys it replaced lead the first
|
|
286
|
-
const newProps = [
|
|
287
|
-
`\n${comments.map((c) => `${c}\n`).join('')}${ind}runs: ${derived.runs}`,
|
|
288
|
-
`\n${ind}cache: ${derived.cache}`,
|
|
289
|
-
`\n${ind}fix: ${q(derived.fix)}`,
|
|
290
|
-
`\n${ind}applies: ${derived.applies}`,
|
|
291
|
-
]
|
|
292
|
-
const props = [...kept.slice(0, insertAt), ...newProps, ...kept.slice(insertAt), ...(tail == null ? [] : [tail])]
|
|
293
|
-
const source = `${src.slice(0, obj.open + 1)}${props.join(',')}${src.slice(obj.close)}`
|
|
294
|
-
return { changed: true, source, notes: derived.notes }
|
|
295
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// which check files of a repo still need the port (core/port-check-file.ts):
|
|
2
|
-
// read through the context alone, so SK029 is cached on the listing and the
|
|
3
|
-
// sources. A legacy check SCRIPT is left to its own static reader.
|
|
4
|
-
import { CHECK_SUFFIX, isLegacyCheckSource, SKIPPED_DIRS, UNIT_SUFFIX } from './check-file-names.ts'
|
|
5
|
-
import type { ScanCtx } from './check-ctx.ts'
|
|
6
|
-
import { retiredKeysIn } from './port-check-file.ts'
|
|
7
|
-
|
|
8
|
-
/** a `.check.ts` or `.check.shipkit.ts` file may export a plain object; a
|
|
9
|
-
* plain unit file is a check only through a `check(...)` call */
|
|
10
|
-
export const plainDefaultFor = (rel: string): boolean => rel.endsWith(CHECK_SUFFIX) || rel.endsWith(`.check${UNIT_SUFFIX}`)
|
|
11
|
-
|
|
12
|
-
const walked = (rel: string): boolean => rel.split('/').slice(0, -1).every((d) => !SKIPPED_DIRS.has(d) && !d.startsWith('.'))
|
|
13
|
-
|
|
14
|
-
/** the cheap text test before the scan: a file that declares `runs` and none
|
|
15
|
-
* of the retired spellings is explicit already */
|
|
16
|
-
const RETIRED_RE = /\b(when|inputs|ttl|never|every|cron|whenInactive|planOff|cacheKey)\s*\??\s*:|\bfix\s*\??\s*:\s*(async\b|\(|function\b|[A-Za-z_$][\w$]*\s*[,\n])/
|
|
17
|
-
|
|
18
|
-
export type Unported = { rel: string; keys: string[] }
|
|
19
|
-
|
|
20
|
-
export function unportedCheckFiles(c: Pick<ScanCtx, 'list' | 'read'>): Unported[] {
|
|
21
|
-
const rels = [...c.list(`**/*${CHECK_SUFFIX}`), ...c.list(`**/*${UNIT_SUFFIX}`)].filter(walked)
|
|
22
|
-
const out: Unported[] = []
|
|
23
|
-
for (const rel of [...new Set(rels)].sort()) {
|
|
24
|
-
const src = c.read(rel)
|
|
25
|
-
if (src == null || isLegacyCheckSource(src)) continue
|
|
26
|
-
if (/\bruns\s*:/.test(src) && !RETIRED_RE.test(src)) continue
|
|
27
|
-
const keys = retiredKeysIn(src, { plainDefault: plainDefaultFor(rel) })
|
|
28
|
-
if (keys.length > 0) out.push({ rel, keys })
|
|
29
|
-
}
|
|
30
|
-
return out
|
|
31
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// the legacy check SCRIPT reader, for the compatibility window: a
|
|
2
|
-
// `*.check.ts` with named `export const` declarations and a body that runs
|
|
3
|
-
// top to bottom, spawned as a subprocess, wire output parsed back, exit code
|
|
4
|
-
// is truth. It shares the suffix with the check file, and the source decides
|
|
5
|
-
// which one a file is (core/check-file-names.ts `isLegacyCheckSource`). It is
|
|
6
|
-
// read through the window, and SK016 names each one with the check object
|
|
7
|
-
// it becomes: a port by hand. Skipped dirs: the same walk as the check file's.
|
|
8
|
-
|
|
9
|
-
import { readFileSync } from 'fs'
|
|
10
|
-
import { fallbackNames, readLegacyCheck, type LegacyCheck } from '../core/check-file-names.ts'
|
|
11
|
-
import { repoCheckFiles } from '../core/repo-walk.ts'
|
|
12
|
-
|
|
13
|
-
export type { LegacyCheck } from '../core/check-file-names.ts'
|
|
14
|
-
|
|
15
|
-
export function discoverLegacyChecks(root: string): LegacyCheck[] {
|
|
16
|
-
const all = repoCheckFiles(root)
|
|
17
|
-
const names = fallbackNames(root, all)
|
|
18
|
-
const out: LegacyCheck[] = []
|
|
19
|
-
for (const f of all) {
|
|
20
|
-
let src: string
|
|
21
|
-
try { src = readFileSync(f, 'utf8') } catch { continue }
|
|
22
|
-
const read = readLegacyCheck(f, names.get(f)!, src)
|
|
23
|
-
if (read != null) out.push(read)
|
|
24
|
-
}
|
|
25
|
-
return out
|
|
26
|
-
}
|