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,6 +1,6 @@
|
|
|
1
1
|
// SK001 — canonical package.json shape (patterns/rv-conventions/package-json.md):
|
|
2
|
-
// private:true, no license, capability-required script names FAIL,
|
|
3
|
-
//
|
|
2
|
+
// private:true, no license, capability-required script names FAIL, missing
|
|
3
|
+
// baseline scripts WARN. Blocking, so it runs in `shipkit
|
|
4
4
|
// ci` like every other rule. It reads only through `c`, so it is cached on
|
|
5
5
|
// what it read: package.json, the probes below, the test file listing, and
|
|
6
6
|
// whatever the floor resolution read.
|
|
@@ -33,23 +33,8 @@ type Pkg = { name?: string; private?: boolean; license?: string; scripts?: Recor
|
|
|
33
33
|
|
|
34
34
|
const OWNER = 'patterns/rv-conventions/package-json.md'
|
|
35
35
|
|
|
36
|
-
// alias → { canonical, bodyMatch } — WARN only when the body proves the
|
|
37
|
-
// alias really is the canonical capability (a `serve` that serves a dist/
|
|
38
|
-
// folder must not be told to rename)
|
|
39
|
-
const ALIASES: Record<string, { canonical: string; bodyMatch: RegExp }> = {
|
|
40
|
-
'serve': { canonical: 'hub', bodyMatch: /(?:^|\s)(?:shipkit|\S*shipkit\S*\/cli\.ts) serve\b/ },
|
|
41
|
-
'check-types': { canonical: 'typecheck', bodyMatch: /./ },
|
|
42
|
-
}
|
|
43
|
-
|
|
44
36
|
const BASELINE = ['test', 'lint'] as const
|
|
45
37
|
|
|
46
|
-
// tools bun's built-ins replaced (a formatter is SK051's). Never repaired here: a linter swap changes
|
|
47
|
-
// which rules gate the repo, and dropping a dependency moves bun.lock, which
|
|
48
|
-
// only an install rewrites
|
|
49
|
-
const RETIRED: Array<{ tool: string; deps: string[]; config: string; how: string }> = [
|
|
50
|
-
{ tool: 'oxlint', deps: ['oxlint', 'oxlint-tsgolint'], config: '.oxlintrc.json', how: 'port its rules into [lint] in bunfig.toml (`bun lint` is the house linter), then' },
|
|
51
|
-
]
|
|
52
|
-
|
|
53
38
|
// no per-line fix pointers here — the rule framework appends ONE pointer
|
|
54
39
|
// (docsBase + OWNER) to a failing/warning run, the same one-per-severity
|
|
55
40
|
// doctrine the contracts engine follows
|
|
@@ -88,19 +73,7 @@ export function evaluatePackageJson(t: CheckCtx): void {
|
|
|
88
73
|
if (pkg.license != null) t.fail(`package.json: license field is banned on project repos (rvlib-* sub-packages excepted)`)
|
|
89
74
|
}
|
|
90
75
|
|
|
91
|
-
|
|
92
|
-
// never a double report (alias WARN + missing-canonical FAIL). A banned
|
|
93
|
-
// alias lingering NEXT TO its canonical still WARNs (sweep on sight),
|
|
94
|
-
// it just doesn't satisfy anything.
|
|
95
|
-
const aliased = new Set<string>()
|
|
96
|
-
for (const [name, a] of Object.entries(ALIASES)) {
|
|
97
|
-
const body = scripts[name]
|
|
98
|
-
if (body == null || !a.bodyMatch.test(body)) continue
|
|
99
|
-
if (scripts[a.canonical] == null) aliased.add(a.canonical)
|
|
100
|
-
t.warn(`package.json: script '${name}' is the house '${a.canonical}' — ${scripts[a.canonical] == null ? 'rename it' : `delete it ('${a.canonical}' exists)`}`)
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const has = (name: string): boolean => scripts[name] != null || aliased.has(name)
|
|
76
|
+
const has = (name: string): boolean => scripts[name] != null
|
|
104
77
|
|
|
105
78
|
const required = requiredScripts(t)
|
|
106
79
|
const missing = required.filter((r) => !has(r.name))
|
|
@@ -144,24 +117,6 @@ export function evaluatePackageJson(t: CheckCtx): void {
|
|
|
144
117
|
t.warn(`package.json: script 'check' shadows \`bun check\`, the type checker an agent runs: rename it (until then \`bun check --no-script\` type checks)`)
|
|
145
118
|
if (missingBaseline.length > 0)
|
|
146
119
|
t.warn(`package.json: missing baseline: ${missingBaseline.map((n) => (n === 'test' ? `script 'test'` : `[${n}] in bunfig.toml (or a '${n}' script)`)).join(', ')}`)
|
|
147
|
-
for (const r of RETIRED) {
|
|
148
|
-
// the tool as a command word: `bunx oxlint@latest`, `"oxlint;"`, never `.oxlintrc` or `oxlint-smoke.ts`
|
|
149
|
-
const word = new RegExp(`(^|[^\\w.-])${r.tool}(?![\\w-])`)
|
|
150
|
-
const sole = new RegExp(`^\\s*(?:(?:bunx|npx|bun\\s+x)\\s+)?(?:\\S*/)?${r.tool}(?:@\\S+)?(?:\\s+[^;&|]*)?$`)
|
|
151
|
-
const deps = r.deps.filter((d) => [pkg.dependencies, pkg.devDependencies, pkg.optionalDependencies].some((m) => m?.[d] != null))
|
|
152
|
-
const using = Object.entries(scripts).filter(([, body]) => word.test(body))
|
|
153
|
-
const whole = using.filter(([, body]) => sole.test(body)).map(([name]) => `'${name}'`)
|
|
154
|
-
const steps = using.filter(([, body]) => !sole.test(body)).map(([name]) => `'${name}'`)
|
|
155
|
-
const del = [
|
|
156
|
-
...deps.map((d) => `the ${d} dependency`),
|
|
157
|
-
...(whole.length > 0 ? [`script ${whole.join(', ')}`] : []),
|
|
158
|
-
...(t.exists(r.config) ? [r.config] : []),
|
|
159
|
-
]
|
|
160
|
-
if (deps.length === 0 && using.length === 0) continue
|
|
161
|
-
const parts = [...(del.length > 0 ? [`delete ${del.join(', ')}`] : []), ...(steps.length > 0 ? [`take the ${r.tool} step out of script ${steps.join(', ')}, which does more`] : [])]
|
|
162
|
-
t.warn(`package.json: ${r.tool} is retired: ${r.how} ${parts.join(', and ')}`)
|
|
163
|
-
}
|
|
164
|
-
|
|
165
120
|
if (!t.failed && !t.warned)
|
|
166
121
|
t.ok(`package.json shape ok (${isLib || !housePrivateApps(t) ? '' : 'private, no license, '}${required.length} required script(s) present)`)
|
|
167
122
|
}
|
|
@@ -278,13 +233,7 @@ export const packageJsonShape = check({
|
|
|
278
233
|
const bin = inferBin(pkg.scripts)
|
|
279
234
|
const bodies: Record<string, string> = { ...canonicalBodies({ bin }), ...conditionalBodies({ bin }) }
|
|
280
235
|
const skipped: string[] = []
|
|
281
|
-
|
|
282
|
-
// canonical beside it would create the exact duplicate the lint then
|
|
283
|
-
// tells a human to delete
|
|
284
|
-
const aliasSatisfied = new Set<string>()
|
|
285
|
-
for (const [name, a] of Object.entries(ALIASES))
|
|
286
|
-
if (pkg.scripts[name] != null && a.bodyMatch.test(pkg.scripts[name]!)) aliasSatisfied.add(a.canonical)
|
|
287
|
-
for (const m of requiredScripts(c).filter((r) => pkg.scripts![r.name] == null && !aliasSatisfied.has(r.name))) {
|
|
236
|
+
for (const m of requiredScripts(c).filter((r) => pkg.scripts![r.name] == null)) {
|
|
288
237
|
const body = bodies[m.name]
|
|
289
238
|
if (body == null) { skipped.push(m.name); continue }
|
|
290
239
|
pkg.scripts[m.name] = body
|
|
@@ -14,13 +14,11 @@
|
|
|
14
14
|
// depends on the index, `.git/info/exclude` and the user's global excludes
|
|
15
15
|
// file, which no read set records exactly, and a body that asked git through
|
|
16
16
|
// `c.git` is never stored on its reads.
|
|
17
|
-
import { readdirSync } from 'fs'
|
|
18
17
|
import type { RepoConfig } from '../repo-config.ts'
|
|
19
18
|
import { declaredPublic } from '../core/repo-facts.ts'
|
|
20
|
-
import { commitPolicyBlock,
|
|
19
|
+
import { commitPolicyBlock, GENERATED_TRACKED_PATHS, gitignoreBaseline, untrackGenerated } from '../rules/untrack-generated.ts'
|
|
21
20
|
import { check, type CheckCtx, type FixResult } from '../check.ts'
|
|
22
21
|
import { LAYOUT, SHIPKIT_DIR, TRACKED_DIRS } from '../core/layout.ts'
|
|
23
|
-
import { LEGACY_CONTRACT_PREFIX, LEGACY_IGNORED, LEGACY_TMP, LEGACY_VENUES, layoutSummary, legacyLayoutLeft, migrateLayout } from '../core/migrate-layout.ts'
|
|
24
22
|
|
|
25
23
|
/** what this check reads, writes and asks git through */
|
|
26
24
|
type Disk = Pick<CheckCtx, 'root' | 'read' | 'write' | 'exists' | 'git'>
|
|
@@ -69,10 +67,6 @@ export const POLICY_LINES = [
|
|
|
69
67
|
// nothing durable lives in the scratch, and a review narrates agent process
|
|
70
68
|
`${LAYOUT.tmp}/`,
|
|
71
69
|
`${LAYOUT.reviews}/`,
|
|
72
|
-
// a root scratch stays out of git too: the fix pass moves it under
|
|
73
|
-
// .shipkit/, its dated plans into .shipkit/plans/, and until it runs
|
|
74
|
-
// nothing there is exposed
|
|
75
|
-
`${LEGACY_TMP}/`,
|
|
76
70
|
'CLAUDE.local.md',
|
|
77
71
|
// atomicWrite lands every file via `.<name>.tmp-<pid>` next to its target,
|
|
78
72
|
// so a run killed mid write leaves one behind ANYWHERE in the tree, and an
|
|
@@ -88,10 +82,6 @@ export const POLICY_LINES = [
|
|
|
88
82
|
'.comfy-ts/*',
|
|
89
83
|
DRAFTS_BACK,
|
|
90
84
|
'*.loras.local.txt',
|
|
91
|
-
// shipkit's own per-run output. Ignoring is only half of it: the fixer
|
|
92
|
-
// also removes these from the index, because .gitignore does nothing to a
|
|
93
|
-
// file already tracked (untrack-generated.ts owns the pair)
|
|
94
|
-
...GENERATED_IGNORE_LINES,
|
|
95
85
|
]
|
|
96
86
|
|
|
97
87
|
/** the policy one repo carries. A declared public tree ships to strangers,
|
|
@@ -99,41 +89,20 @@ export const POLICY_LINES = [
|
|
|
99
89
|
* repo, private words in a public one */
|
|
100
90
|
const policyLines = (config: RepoConfig): string[] => declaredPublic(config) ? POLICY_LINES.filter((l) => !PRIVATE_ONLY.has(l)) : POLICY_LINES
|
|
101
91
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
/** `legacy`: the repo still carries contract folders at its root from before `.shipkit/`. Their names
|
|
105
|
-
* stay ignored until they move, so no private file is ever exposed by a block
|
|
106
|
-
* that is newer than the tree it guards */
|
|
107
|
-
export function expectedBlock(config: RepoConfig, legacy = false): string {
|
|
92
|
+
export function expectedBlock(config: RepoConfig): string {
|
|
108
93
|
const extra = config.gitignore ?? []
|
|
109
|
-
return [BEGIN, ...policyLines(config), ...(
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export function policyPatterns(config: RepoConfig, legacy = false): string[] {
|
|
113
|
-
return [...policyLines(config).filter((l) => !l.startsWith('#')), ...(legacy ? LEGACY_IGNORED : []), ...(config.gitignore ?? [])]
|
|
94
|
+
return [BEGIN, ...policyLines(config), ...(extra.length > 0 ? [CONTRIB, ...extra] : []), END].join('\n')
|
|
114
95
|
}
|
|
115
96
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
try { return readdirSync(root).some((e) => e.startsWith(LEGACY_CONTRACT_PREFIX)) } catch { return false }
|
|
97
|
+
export function policyPatterns(config: RepoConfig): string[] {
|
|
98
|
+
return [...policyLines(config).filter((l) => !l.startsWith('#')), ...(config.gitignore ?? [])]
|
|
119
99
|
}
|
|
120
100
|
|
|
121
|
-
/** the .gitignore text with its policy block rendered, every repo line kept
|
|
122
|
-
* where it was. The layout migration writes it before it moves a single
|
|
123
|
-
* folder, with `legacy` on while an old folder is still on disk */
|
|
124
|
-
export const renderPolicy = (text: string, config: RepoConfig, legacy = false): string => withBlock(text, config, legacy)
|
|
125
|
-
|
|
126
101
|
function endsWithNewline(d: Disk): boolean {
|
|
127
102
|
const text = d.read('.gitignore')
|
|
128
103
|
return text == null || text === '' || text.endsWith('\n')
|
|
129
104
|
}
|
|
130
105
|
|
|
131
|
-
// a venue folder is DESIGNED to be unignored below the block once a listing
|
|
132
|
-
// is live (last-match-wins), so an override on one of them is the mechanism
|
|
133
|
-
// working. Every other policy path is a claim the block makes, and a claim git
|
|
134
|
-
// contradicts is a bug.
|
|
135
|
-
const OVERRIDABLE = new Set(LEGACY_VENUES)
|
|
136
|
-
|
|
137
106
|
/** a path git can be asked about, for a pattern that may be a glob or a dir */
|
|
138
107
|
function probePath(anchored: string): string {
|
|
139
108
|
const pattern = anchored.replace(/^\//, '')
|
|
@@ -207,33 +176,33 @@ function parseText(text: string | null): Parsed | null {
|
|
|
207
176
|
|
|
208
177
|
type BlockState = 'missing-file' | 'missing-block' | 'corrupted' | 'stale' | 'current'
|
|
209
178
|
|
|
210
|
-
function blockState(d: Disk, config: RepoConfig
|
|
179
|
+
function blockState(d: Disk, config: RepoConfig): BlockState {
|
|
211
180
|
const f = parse(d)
|
|
212
181
|
if (f == null) return 'missing-file'
|
|
213
182
|
if (f.b === -1 && f.e === -1) return 'missing-block'
|
|
214
183
|
if (f.b === -1 || f.e === -1 || f.e < f.b) return 'corrupted'
|
|
215
|
-
return f.lines.slice(f.b, f.e + 1).join('\n') === expectedBlock(config
|
|
184
|
+
return f.lines.slice(f.b, f.e + 1).join('\n') === expectedBlock(config) ? 'current' : 'stale'
|
|
216
185
|
}
|
|
217
186
|
|
|
218
187
|
/** the lines of a well-formed block the current one no longer holds: a line a repo wrote inside it, or one the policy
|
|
219
188
|
* retired. Only the repair removes them, and it names each */
|
|
220
|
-
export function removedLines(text: string | null, config: RepoConfig
|
|
189
|
+
export function removedLines(text: string | null, config: RepoConfig): string[] {
|
|
221
190
|
const f = parseText(text)
|
|
222
191
|
if (f == null || f.b === -1 || f.e === -1 || f.e < f.b) return []
|
|
223
|
-
const kept = new Set([...expectedBlock(config
|
|
192
|
+
const kept = new Set([...expectedBlock(config).split('\n'), CONTRIB])
|
|
224
193
|
return f.lines.slice(f.b + 1, f.e).filter((l) => l.trim() !== '' && !kept.has(l))
|
|
225
194
|
}
|
|
226
195
|
|
|
227
196
|
const REMOVED_FIX = 'a line of the repo goes below the block, or in repo.config.ts gitignore:'
|
|
228
197
|
|
|
229
|
-
function writeBlock(d: Disk, config: RepoConfig
|
|
230
|
-
d.write('.gitignore', withBlock(d.read('.gitignore'), config
|
|
198
|
+
function writeBlock(d: Disk, config: RepoConfig): void {
|
|
199
|
+
d.write('.gitignore', withBlock(d.read('.gitignore'), config))
|
|
231
200
|
}
|
|
232
201
|
|
|
233
202
|
/** PURE: the .gitignore text with the current block in it */
|
|
234
|
-
function withBlock(text: string | null, config: RepoConfig
|
|
203
|
+
function withBlock(text: string | null, config: RepoConfig): string {
|
|
235
204
|
const f = parseText(text)
|
|
236
|
-
const block = expectedBlock(config
|
|
205
|
+
const block = expectedBlock(config).split('\n')
|
|
237
206
|
let out: string[]
|
|
238
207
|
if (f == null) out = block
|
|
239
208
|
else if (f.b !== -1 && f.e !== -1 && f.e >= f.b)
|
|
@@ -279,19 +248,12 @@ export const gitignorePolicy = check({
|
|
|
279
248
|
c.fail(`${tracked.join(', ')} generated on every run but TRACKED — gitignore does not apply to a tracked file, so it dirties every tree`)
|
|
280
249
|
c.lines.push({ kind: 'fix-fail', text: 'shipkit ci (or check --fix SK004) untracks it in one commit, the file stays on disk' })
|
|
281
250
|
}
|
|
282
|
-
|
|
283
|
-
const left = legacyLayoutLeft(c.root)
|
|
284
|
-
if (left.length > 0) {
|
|
285
|
-
c.fail(`old layout: ${left.join(' ')} still at the repo root, shipkit keeps them under ${SHIPKIT_DIR}/`)
|
|
286
|
-
c.lines.push({ kind: 'fix-fail', text: 'shipkit ci (or check --fix SK004) moves them and lands one commit' })
|
|
287
|
-
}
|
|
288
|
-
const legacy = hasLegacy(c.root)
|
|
289
|
-
let s = blockState(c, c.config, legacy)
|
|
251
|
+
let s = blockState(c, c.config)
|
|
290
252
|
// a stale block means shipkit's policy moved, not that this repo broke:
|
|
291
253
|
// every run that may write renders it in place, so a policy change never
|
|
292
254
|
// turns the whole fleet red until each repo runs its gate
|
|
293
255
|
if (s === 'stale') {
|
|
294
|
-
const removed = removedLines(c.read('.gitignore'), c.config
|
|
256
|
+
const removed = removedLines(c.read('.gitignore'), c.config)
|
|
295
257
|
if (removed.length > 0) {
|
|
296
258
|
c.warn(`.gitignore policy block is stale, and its rewrite removes ${removed.join(', ')}: left for the repair, which names each line`)
|
|
297
259
|
c.lines.push({ kind: 'fix-warn', text: `${REMOVED_FIX}; sk ci (or check --fix SK004) rewrites it` })
|
|
@@ -303,9 +265,9 @@ export const gitignorePolicy = check({
|
|
|
303
265
|
return
|
|
304
266
|
}
|
|
305
267
|
const before = gitignoreBaseline(c.root, c.git)
|
|
306
|
-
writeBlock(c, c.config
|
|
268
|
+
writeBlock(c, c.config)
|
|
307
269
|
c.note(`.gitignore policy block rewritten in place: the policy or repo-contributed lines moved${landedWords(commitPolicyBlock(c.root, before, [], c.git))}`)
|
|
308
|
-
s = blockState(c, c.config
|
|
270
|
+
s = blockState(c, c.config)
|
|
309
271
|
}
|
|
310
272
|
switch (s) {
|
|
311
273
|
case 'missing-file': return c.fail('.gitignore missing — the contract git policy is unenforced')
|
|
@@ -330,8 +292,8 @@ export const gitignorePolicy = check({
|
|
|
330
292
|
// a claim all the same, and the opposite one: a repo line BELOW the
|
|
331
293
|
// block re-ignoring the parent leaves the re-inclusion dead while the
|
|
332
294
|
// block text stays current, which is the same silent contradiction
|
|
333
|
-
const patterns = policyPatterns(c.config
|
|
334
|
-
const claimed = patterns.filter((p) => !
|
|
295
|
+
const patterns = policyPatterns(c.config)
|
|
296
|
+
const claimed = patterns.filter((p) => !p.startsWith('!'))
|
|
335
297
|
const probes = new Map(claimed.map((p) => [probePath(p), p]))
|
|
336
298
|
const backProbes = new Map(patterns.filter((p) => p.startsWith('!')).map((p) => [probePath(p.slice(1)), p]))
|
|
337
299
|
const miss = await notIgnored(c, [...probes.keys(), ...backProbes.keys()])
|
|
@@ -366,14 +328,7 @@ export const gitignorePolicy = check({
|
|
|
366
328
|
}
|
|
367
329
|
},
|
|
368
330
|
repair: async (c): Promise<FixResult> => {
|
|
369
|
-
|
|
370
|
-
const moved = process.env.SHIPKIT_FROZEN === '1' ? null : migrateLayout(c.root, { config: c.config, renderGitignore: (t, legacy, cfg) => renderPolicy(t, cfg ?? c.config, legacy) })
|
|
371
|
-
const layout = moved == null ? null
|
|
372
|
-
: moved.deferred != null ? `layout move deferred: ${moved.deferred}`
|
|
373
|
-
: layoutSummary(moved) === '' ? null
|
|
374
|
-
: `layout: ${layoutSummary(moved)}${moved.commit != null ? ` (committed as ${moved.commit})` : moved.uncommitted === true ? ', the commit did not land' : ''}`
|
|
375
|
-
const legacy = hasLegacy(c.root)
|
|
376
|
-
const before = blockState(c, c.config, legacy)
|
|
331
|
+
const before = blockState(c, c.config)
|
|
377
332
|
const held = gitignoreBaseline(c.root, c.git)
|
|
378
333
|
// terminate an unterminated file even when the block itself is current:
|
|
379
334
|
// that missing byte is what the next append fuses onto
|
|
@@ -382,7 +337,7 @@ export const gitignorePolicy = check({
|
|
|
382
337
|
c.write('.gitignore', `${c.read('.gitignore') ?? ''}\n`)
|
|
383
338
|
terminated = '.gitignore terminated with a newline (the next append would have fused onto its last line)'
|
|
384
339
|
}
|
|
385
|
-
const removed = before === 'stale' ? removedLines(c.read('.gitignore'), c.config
|
|
340
|
+
const removed = before === 'stale' ? removedLines(c.read('.gitignore'), c.config) : []
|
|
386
341
|
const blockSummary = before === 'current'
|
|
387
342
|
? null
|
|
388
343
|
: before === 'missing-file' ? '.gitignore created with the policy block'
|
|
@@ -390,18 +345,18 @@ export const gitignorePolicy = check({
|
|
|
390
345
|
: before === 'corrupted' ? 'policy block rebuilt (stray markers dropped, repo lines kept visible)'
|
|
391
346
|
: removed.length > 0 ? `policy block rewritten in place, removed from it: ${removed.join(', ')} (${REMOVED_FIX})`
|
|
392
347
|
: 'policy block rewritten in place (repo lines outside it untouched)'
|
|
393
|
-
if (blockSummary != null) writeBlock(c, c.config
|
|
348
|
+
if (blockSummary != null) writeBlock(c, c.config)
|
|
394
349
|
const landed = blockSummary != null || terminated != null ? landedWords(commitPolicyBlock(c.root, held, removed, c.git)) : ''
|
|
395
350
|
// the block must be written FIRST: untracking a path the ignore list
|
|
396
351
|
// does not yet carry leaves it staged for re-add on the next `git add`.
|
|
397
352
|
// The untrack is a git COMMIT through the hooks, so it stays in the
|
|
398
353
|
// module that owns that migration (rules/untrack-generated.ts)
|
|
399
354
|
const un = untrackGenerated(c.root, { enabled: c.config.untrackGenerated }, c.git)
|
|
400
|
-
const parts = [
|
|
355
|
+
const parts = [blockSummary, terminated, landed === '' ? null : landed.replace(/^[,;] /, '')]
|
|
401
356
|
if (un.did === 'untracked') parts.push(`untracked ${un.paths.join(', ')} (generated, now gitignored, committed as ${un.commit})`)
|
|
402
357
|
if (un.did === 'refused') parts.push(`left ${(await trackedGenerated(c)).join(', ')} tracked: ${un.why}`)
|
|
403
358
|
const summary = parts.filter((x): x is string => x != null).join(' · ')
|
|
404
|
-
return { changed:
|
|
359
|
+
return { changed: blockSummary != null || terminated != null || un.did === 'untracked', summary: summary === '' ? 'policy block already current' : summary }
|
|
405
360
|
},
|
|
406
361
|
})
|
|
407
362
|
|
|
@@ -14,11 +14,10 @@
|
|
|
14
14
|
// scaffold, so a policy written there would bind exactly one checkout.
|
|
15
15
|
import { isAbsolute, join } from 'path'
|
|
16
16
|
import { inferBin } from '../core/canonical-scripts.ts'
|
|
17
|
-
import { denyRules, GIT_STASH_RULES, LEGACY_PREFIX_RULES, LEGACY_SCOPED_RULES,
|
|
17
|
+
import { denyRules, GIT_STASH_RULES, LEGACY_PREFIX_RULES, LEGACY_SCOPED_RULES, RAW_RUNNERS, slotRows } from '../core/one-way-in-policy.ts'
|
|
18
18
|
import { rootPublishesNpm } from '../core/repo-facts.ts'
|
|
19
19
|
import { EDIT_MATCHER, hasEditGuard } from '../hooks/edit-guard.ts'
|
|
20
20
|
import type { RepoConfig } from '../repo-config.ts'
|
|
21
|
-
import { repoOff } from '../core/when.ts'
|
|
22
21
|
import { check, type CheckCtx, type FixResult } from '../check.ts'
|
|
23
22
|
|
|
24
23
|
const OWNER = 'tools/shipkit/one-way-in.md'
|
|
@@ -33,7 +32,7 @@ type Settings = {
|
|
|
33
32
|
* either: ONE declaration governs the script name and the raw call together */
|
|
34
33
|
export function exemptSlots(c: RepoConfig): Set<string> {
|
|
35
34
|
const off = new Set(c.oneWayIn?.exempt ?? [])
|
|
36
|
-
for (const id of
|
|
35
|
+
for (const id of Object.keys(c.off ?? {})) off.add(id)
|
|
37
36
|
return off
|
|
38
37
|
}
|
|
39
38
|
|
|
@@ -148,8 +147,6 @@ export const oneWayInPolicy = check({
|
|
|
148
147
|
const stashMissing = GIT_STASH_RULES.filter((r) => !have.has(r))
|
|
149
148
|
if (stashMissing.length > 0)
|
|
150
149
|
c.fail(`${SETTINGS_PATH}: ${stashMissing.length} stash deny row(s) missing (${stashMissing.slice(0, 2).join(', ')}${stashMissing.length > 2 ? ', …' : ''}), so an agent can stash every other agent's uncommitted work in a shared tree`)
|
|
151
|
-
if (have.has(LEGACY_STASH_RULE))
|
|
152
|
-
c.fail(`${SETTINGS_PATH}: the blanket "${LEGACY_STASH_RULE}" row also refuses the read only \`git stash list\` and \`git stash show\``)
|
|
153
150
|
const scopedStale = LEGACY_SCOPED_RULES.filter((r) => have.has(r))
|
|
154
151
|
if (scopedStale.length > 0)
|
|
155
152
|
c.fail(`${SETTINGS_PATH}: ${scopedStale.map((r) => `"${r}"`).join(', ')} also refuses a run of one test file or folder, which is the iteration loop`)
|
|
@@ -206,8 +203,7 @@ export const oneWayInPolicy = check({
|
|
|
206
203
|
const s: Settings = existing ?? {}
|
|
207
204
|
const changes: string[] = []
|
|
208
205
|
const old = s.permissions?.deny ?? []
|
|
209
|
-
const deny = old.filter((r) =>
|
|
210
|
-
if (old.includes(LEGACY_STASH_RULE)) changes.push(`the blanket ${LEGACY_STASH_RULE} row replaced by one row per stash write`)
|
|
206
|
+
const deny = old.filter((r) => !LEGACY_SCOPED_RULES.includes(r) && !LEGACY_PREFIX_RULES.includes(r) && !exempt.has(r))
|
|
211
207
|
const scopedStale = old.filter((r) => LEGACY_SCOPED_RULES.includes(r) && !exempt.has(r))
|
|
212
208
|
if (scopedStale.length > 0) changes.push(`${scopedStale.join(', ')} replaced by the bare row: a run of one file or folder passes`)
|
|
213
209
|
const prefixStale = old.filter((r) => LEGACY_PREFIX_RULES.includes(r) && !exempt.has(r))
|
|
@@ -13,7 +13,7 @@ import type { CheckCtx } from '../core/check-ctx.ts'
|
|
|
13
13
|
import { checkFloorReader, resolveFloor } from '../core/floor-resolve.ts'
|
|
14
14
|
import { rootPublishesNpm } from '../core/repo-facts.ts'
|
|
15
15
|
import { repoOff } from '../core/when.ts'
|
|
16
|
-
import { indentAt, parseSpans, plain, removalSpans, type Node } from '../
|
|
16
|
+
import { indentAt, parseSpans, plain, removalSpans, type Node } from '../core/jsonc-spans.ts'
|
|
17
17
|
|
|
18
18
|
export const TSC_LABEL = '👁 TSC'
|
|
19
19
|
const TASKS = '.vscode/tasks.json'
|
|
@@ -160,13 +160,13 @@ export function repairTasks(text: string, o: RepairOpts): { text: string; change
|
|
|
160
160
|
return { text: out, changes, kept, empty: onlyTasks && tasks.items.length > 0 && remove.size === tasks.items.length }
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
/** whether this repo's gate runs a typecheck: a floor slot
|
|
164
|
-
*
|
|
163
|
+
/** whether this repo's gate runs a typecheck: a floor slot that resolves, and
|
|
164
|
+
* no `off` entry turning it off */
|
|
165
165
|
export function typecheckOn(c: CheckCtx): boolean {
|
|
166
166
|
const config = c.config
|
|
167
167
|
let floor: ReturnType<typeof resolveFloor>
|
|
168
168
|
try { floor = resolveFloor(config, c.root, checkFloorReader(c)) } catch { return false }
|
|
169
|
-
const t =
|
|
169
|
+
const t = floor.tasks.find((x) => x.id === 'typecheck')
|
|
170
170
|
return t != null && repoOff(config, t.id) == null
|
|
171
171
|
}
|
|
172
172
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
// here), so each keeps its own key, row and `off` switch.
|
|
13
13
|
import { dirname, posix, relative } from 'path'
|
|
14
14
|
import { check } from '../check.ts'
|
|
15
|
-
import {
|
|
15
|
+
import { repoCheckUnits } from '../core/check-file-names.ts'
|
|
16
16
|
import { argvRunsTests, commandRunsTests, sourceRunsTests, type ScriptReader } from '../suite/runner-shapes.ts'
|
|
17
17
|
import type { CheckCtx } from '../core/check-ctx.ts'
|
|
18
18
|
import { repoOff } from '../core/when.ts'
|
|
@@ -43,26 +43,15 @@ export const testsRunInUnits = check({
|
|
|
43
43
|
fix: 'none',
|
|
44
44
|
applies: 'always',
|
|
45
45
|
run: (c) => {
|
|
46
|
-
|
|
47
|
-
// hosts it, and a built-in that WRITES a test script (SK001) is not a
|
|
48
|
-
// runner. Read off import.meta, since importing discovery pulls in fs
|
|
49
|
-
const builtins = relative(c.root, import.meta.dir).replace(/\\/g, '/')
|
|
50
|
-
const files = repoCheckSources(c).filter((f) => !f.rel.startsWith(`${builtins}/`))
|
|
46
|
+
const files = repoCheckUnits(c)
|
|
51
47
|
let hits = 0
|
|
52
48
|
const say = (where: string, how: string): void => { hits++; c.fail(`${where} runs ${how} itself`, FIX) }
|
|
53
49
|
const root = scriptsIn(c, '')
|
|
54
50
|
const cwdOf = (cwd: string | undefined): string => (cwd == null ? '' : relative(c.root, posix.resolve(c.root, cwd)))
|
|
55
51
|
for (const f of files) for (const how of sourceRunsTests(f.src ?? '', scriptsIn(c, dirname(f.rel)))) say(f.rel, how)
|
|
56
|
-
for (const t of c.config.tasks ?? []) {
|
|
57
|
-
const scripts = scriptsIn(c, cwdOf(t.cwd))
|
|
58
|
-
const how = t.cmd != null ? argvRunsTests(t.cmd, scripts) : null
|
|
59
|
-
if (how != null) say(`repo.config.ts tasks '${t.id}'`, how)
|
|
60
|
-
else if (t.logic != null) for (const h of sourceRunsTests(String(t.logic), scripts)) say(`repo.config.ts tasks '${t.id}'`, h)
|
|
61
|
-
}
|
|
62
|
-
for (const r of c.config.rules ?? []) for (const h of sourceRunsTests(String(r.lint), root)) say(`repo.config.ts rules '${r.id}'`, h)
|
|
63
52
|
const defaults = c.config.defaults ?? {}
|
|
64
53
|
for (const [id, d] of Object.entries(defaults)) {
|
|
65
|
-
if (id === 'test' || d
|
|
54
|
+
if (id === 'test' || d.cmd == null) continue
|
|
66
55
|
const how = argvRunsTests(d.cmd, scriptsIn(c, cwdOf(d.cwd)))
|
|
67
56
|
if (how != null) say(`repo.config.ts defaults '${id}'`, how)
|
|
68
57
|
}
|
|
@@ -4,12 +4,10 @@
|
|
|
4
4
|
// `import.meta.main` guard: a second way to write a body, with none of what
|
|
5
5
|
// `c` gives (recorded reads, one pass, one runner).
|
|
6
6
|
//
|
|
7
|
-
// It reads each check file's SOURCE through `c`, never imports it, so it
|
|
8
|
-
// cached on the listing and the sources.
|
|
9
|
-
// object) is SK016's, read through its window, and never counted here.
|
|
7
|
+
// It reads each check unit file's SOURCE through `c`, never imports it, so it
|
|
8
|
+
// is cached on the listing and the sources.
|
|
10
9
|
import { check } from '../check.ts'
|
|
11
|
-
import {
|
|
12
|
-
import { repoCheckSources } from '../core/legacy-shapes.ts'
|
|
10
|
+
import { repoCheckUnits } from '../core/check-file-names.ts'
|
|
13
11
|
|
|
14
12
|
const OWNER = 'tools/shipkit/writing-a-check.md'
|
|
15
13
|
|
|
@@ -137,8 +135,8 @@ export const selfSpawningCheck = check({
|
|
|
137
135
|
fix: 'none',
|
|
138
136
|
applies: 'always',
|
|
139
137
|
run: (c) => {
|
|
140
|
-
const found =
|
|
141
|
-
if (f.src == null
|
|
138
|
+
const found = repoCheckUnits(c).flatMap((f) => {
|
|
139
|
+
if (f.src == null) return []
|
|
142
140
|
const why = selfSpawn(f.rel, f.src)
|
|
143
141
|
return why == null ? [] : [`${f.rel}: ${why}`]
|
|
144
142
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// SK035 public clean (tools/shipkit/units.md, What a unit publishes): what each npm unit would pack names no house
|
|
2
2
|
// repo, no identity, no machine of the owner, no keyword row, and ships no browser extension. Keyed on the work tree and on what no tracked
|
|
3
|
-
// file carries (release/public-clean.ts publicCleanKey): each unit
|
|
3
|
+
// file carries (release/public-clean.ts publicCleanKey): what npm can pack of each unit on disk, gitignored files included, the
|
|
4
4
|
// house repos, the identity, keyword and allow files. A release scans fresh
|
|
5
5
|
import { check, type CheckEnv } from '../check.ts'
|
|
6
6
|
import { PUBLIC_CLEAN_ID, publicClean, publicCleanKey } from '../release/public-clean.ts'
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { check } from '../check.ts'
|
|
8
8
|
import type { CheckCtx } from '../core/check-ctx.ts'
|
|
9
9
|
import { rootPublishesNpm } from '../core/repo-facts.ts'
|
|
10
|
-
import { indentAt, insertPoint, parseSpans, splice, type Node } from '../
|
|
10
|
+
import { indentAt, insertPoint, parseSpans, splice, type Node } from '../core/jsonc-spans.ts'
|
|
11
11
|
|
|
12
12
|
const SETTINGS = '.vscode/settings.json'
|
|
13
13
|
const KEY = 'files.watcherExclude'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SK042 post kinds (tools/shipkit/built-in-checks-contracts-and-visibility.md): every post group of the repo (its events
|
|
2
2
|
// in the thread store) names what it is for, a kind of the closed set or of the social unit's own `kinds` (wiki
|
|
3
|
-
// guides/post-kinds/index.md), through the load's one check, kinds.ts kindProblem.
|
|
4
|
-
//
|
|
3
|
+
// guides/post-kinds/index.md), through the load's one check, kinds.ts kindProblem. Keyed on the repo's newest group
|
|
4
|
+
// write, the unit file's text and whether each
|
|
5
5
|
// page its text names is a file: kinds a module the unit imports declares keep a stale green until one of those moves
|
|
6
6
|
import { existsSync, readFileSync } from 'node:fs'
|
|
7
7
|
import { join } from 'node:path'
|
|
@@ -26,7 +26,6 @@ export function unitKey(root: string, file: string): string {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const FIX ='set the kind to one of wiki guides/post-kinds/index.md (a custom one with its kindWhy) with sk social draft save, or declare the project kind in its social unit, then sk ci --only SK042'
|
|
29
|
-
const FIX_OLD = "move each draft to the kind its intent reads as (wiki guides/post-kinds/old-words.md): the repo's own step, never a blind replace"
|
|
30
29
|
|
|
31
30
|
export const postKinds = check({
|
|
32
31
|
id: 'SK042',
|
|
@@ -52,23 +51,15 @@ export const postKinds = check({
|
|
|
52
51
|
const own = unit?.kinds ?? []
|
|
53
52
|
for (const k of own) if (!existsSync(join(c.root, k.page))) c.fail(ownPageMissing(k), `write its rules page, in the shape of a page of wiki guides/post-kinds/`)
|
|
54
53
|
let bad = 0
|
|
55
|
-
let old = 0
|
|
56
54
|
for (const g of groups) {
|
|
57
|
-
const rel = `draft:${g.group.slug}`
|
|
58
55
|
const { kind, why } = kindOfMeta(g.group.meta)
|
|
59
56
|
const p = kindProblem(kind, why, own)
|
|
60
57
|
if (p == null) continue
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
c.lines.push({ kind: 'warn', text: `${rel}: ${p.text}` })
|
|
64
|
-
} else {
|
|
65
|
-
bad++
|
|
66
|
-
c.lines.push({ kind: 'fail', text: `${rel}: ${p.text}` })
|
|
67
|
-
}
|
|
58
|
+
bad++
|
|
59
|
+
c.lines.push({ kind: 'fail', text: `draft:${g.group.slug}: ${p}` })
|
|
68
60
|
}
|
|
69
61
|
if (bad > 0) c.fail(`${bad} draft${bad === 1 ? '' : 's'} with no kind of the set`, FIX)
|
|
70
|
-
if (
|
|
71
|
-
if (bad === 0 && old === 0 && !c.failed) c.ok(`${groups.length} draft${groups.length === 1 ? '' : 's'}, each names its kind`)
|
|
62
|
+
if (bad === 0 && !c.failed) c.ok(`${groups.length} draft${groups.length === 1 ? '' : 's'}, each names its kind`)
|
|
72
63
|
},
|
|
73
64
|
})
|
|
74
65
|
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
// reads, reports to the owner, ends a share, or is the gate. The rows go into the tracked .claude/settings.json, or
|
|
4
4
|
// into this machine's .claude/settings.local.json for a foreign repo (its tracked file is the team's) and for a root
|
|
5
5
|
// that publishes to npm (its tracked file binds strangers), as SK003 and SK049 put their house lines there.
|
|
6
|
-
// The repair owns `permissions.allow` alone: it appends the missing rows in the file's own
|
|
7
|
-
// RETIRED_ALLOW (one it wrote itself, found too wide) and leaves every other byte, so a row
|
|
8
|
-
// the deny list and the hooks stay. A row that lets a publish, a share, a secret or a delete through is reported,
|
|
6
|
+
// The repair owns `permissions.allow` alone, through core/allow-rows.ts: it appends the missing rows in the file's own
|
|
7
|
+
// layout, takes out a row of RETIRED_ALLOW (one it wrote itself, found too wide) and leaves every other byte, so a row
|
|
8
|
+
// a human added, its order, the deny list and the hooks stay. A row that lets a publish, a share, a secret or a delete through is reported,
|
|
9
9
|
// never removed: it may be his
|
|
10
|
-
import { AGENT_ALLOW, outRowsIn
|
|
10
|
+
import { AGENT_ALLOW, outRowsIn } from '../core/agent-allow-policy.ts'
|
|
11
|
+
import { agentAllowRowsOf } from '../core/allow-rows.ts'
|
|
11
12
|
import { rootPublishesNpm } from '../core/repo-facts.ts'
|
|
12
|
-
import { appendEdits, indentAt, insertPoint, parseSpans, removalSpans, splice, type Node } from '../scaffold/jsonc-spans.ts'
|
|
13
13
|
import { check, type CheckCtx, type FixResult } from '../check.ts'
|
|
14
14
|
|
|
15
15
|
const OWNER = 'tools/shipkit/built-in-checks-repo-wiring.md'
|
|
@@ -17,75 +17,6 @@ const TRACKED = '.claude/settings.json'
|
|
|
17
17
|
const LOCAL = '.claude/settings.local.json'
|
|
18
18
|
const BARE = 'run these commands bare: a pipe, `;`, `&&` or a leading `VAR=value` makes Claude Code judge each part on its own'
|
|
19
19
|
|
|
20
|
-
type Obj = Extract<Node, { kind: 'object' }>
|
|
21
|
-
|
|
22
|
-
/** the allow array of a settings tree, null when it has none; 'broken' when a key holds another kind */
|
|
23
|
-
function allowArray(root: Node): Extract<Node, { kind: 'array' }> | null | 'broken' {
|
|
24
|
-
if (root.kind !== 'object') return 'broken'
|
|
25
|
-
const perms = root.props.find((p) => p.key === 'permissions')
|
|
26
|
-
if (perms == null) return null
|
|
27
|
-
if (perms.value.kind !== 'object') return 'broken'
|
|
28
|
-
const allow = perms.value.props.find((p) => p.key === 'allow')
|
|
29
|
-
if (allow == null) return null
|
|
30
|
-
return allow.value.kind === 'array' ? allow.value : 'broken'
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/** the rows of AGENT_ALLOW the settings text lacks, the retired rows it still holds, and the text with the retired
|
|
34
|
-
* ones taken out and the missing ones appended to `permissions.allow` in the file's own layout, every other byte
|
|
35
|
-
* kept; a file that is no object, or whose permissions or allow is of another kind, is 'broken' */
|
|
36
|
-
export function agentAllowRowsOf(
|
|
37
|
-
text: string | null,
|
|
38
|
-
rows: readonly string[] = AGENT_ALLOW.map((x) => x.row),
|
|
39
|
-
retired: readonly string[] = RETIRED_ALLOW,
|
|
40
|
-
): { missing: string[]; stale: string[]; text: string } | 'broken' {
|
|
41
|
-
let out = text
|
|
42
|
-
let stale: string[] = []
|
|
43
|
-
if (text != null && text.trim() !== '') {
|
|
44
|
-
let root: Node
|
|
45
|
-
try { root = parseSpans(text) } catch { return 'broken' }
|
|
46
|
-
const arr = allowArray(root)
|
|
47
|
-
if (arr === 'broken') return 'broken'
|
|
48
|
-
const gone = arr == null ? [] : arr.items.flatMap((n, i) => (n.kind === 'scalar' && retired.includes(n.value as string) ? [i] : []))
|
|
49
|
-
if (arr != null && gone.length > 0) {
|
|
50
|
-
stale = gone.map((i) => (arr.items[i] as { value: string }).value)
|
|
51
|
-
out = removalSpans(text, arr, gone).sort((a, b) => b[0] - a[0]).reduce((t, [s, e]) => t.slice(0, s) + t.slice(e), text)
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
const r = appendRows(out, rows)
|
|
55
|
-
return r === 'broken' ? r : { ...r, stale }
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function appendRows(text: string | null, rows: readonly string[]): { missing: string[]; text: string } | 'broken' {
|
|
59
|
-
if (text == null || text.trim() === '') {
|
|
60
|
-
const body = rows.map((x) => ` ${JSON.stringify(x)}`).join(',\n')
|
|
61
|
-
return { missing: [...rows], text: `{\n "permissions": {\n "allow": [\n${body}\n ]\n }\n}\n` }
|
|
62
|
-
}
|
|
63
|
-
let root: Node
|
|
64
|
-
try { root = parseSpans(text) } catch { return 'broken' }
|
|
65
|
-
if (root.kind !== 'object') return 'broken'
|
|
66
|
-
const perms = root.props.find((p) => p.key === 'permissions')
|
|
67
|
-
if (perms != null && perms.value.kind !== 'object') return 'broken'
|
|
68
|
-
const allow = perms == null ? undefined : (perms.value as Obj).props.find((p) => p.key === 'allow')
|
|
69
|
-
if (allow != null && allow.value.kind !== 'array') return 'broken'
|
|
70
|
-
const have = new Set(allow == null || allow.value.kind !== 'array' ? [] : allow.value.items.map((n) => (n.kind === 'scalar' ? n.value : null)))
|
|
71
|
-
const missing = rows.filter((x) => !have.has(x))
|
|
72
|
-
if (missing.length === 0) return { missing, text }
|
|
73
|
-
const values = missing.map((x) => JSON.stringify(x))
|
|
74
|
-
// the indent step the file uses, read from its first key: two spaces where it has none
|
|
75
|
-
const unit = root.props[0] == null ? ' ' : indentAt(text, root.props[0].keyStart) || ' '
|
|
76
|
-
if (allow != null && allow.value.kind === 'array') {
|
|
77
|
-
return { missing, text: splice(text, appendEdits(text, allow.value, values, `${indentAt(text, allow.keyStart)}${unit}`)) }
|
|
78
|
-
}
|
|
79
|
-
const into = perms == null ? root : (perms.value as Obj)
|
|
80
|
-
const outer = perms == null ? '' : indentAt(text, perms.keyStart)
|
|
81
|
-
const p = insertPoint(text, into, `${outer}${unit}`)
|
|
82
|
-
const list = (at: string): string => `[\n${values.map((v) => `${at}${unit}${v}`).join(',\n')}\n${at}]`
|
|
83
|
-
const block = perms == null ? `"permissions": {\n${p.indent}${unit}"allow": ${list(`${p.indent}${unit}`)}\n${p.indent}}` : `"allow": ${list(p.indent)}`
|
|
84
|
-
const close = into.props.length === 0 ? `\n${outer}` : ''
|
|
85
|
-
const edits = [{ at: p.at, put: `\n${p.indent}${block}${close}` }, ...(p.comma != null ? [{ at: p.comma, put: ',' }] : [])]
|
|
86
|
-
return { missing, text: splice(text, edits) }
|
|
87
|
-
}
|
|
88
|
-
|
|
89
20
|
/** the file the rows belong in: the tracked one, unless it is the team's or a package's contributors' */
|
|
90
21
|
const targetOf = (c: CheckCtx): { file: string; local: boolean } =>
|
|
91
22
|
c.config.foreign === true || rootPublishesNpm(c.config) ? { file: LOCAL, local: true } : { file: TRACKED, local: false }
|