rvlib-shipkit 2.12.0 → 2.13.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 +48 -13
- package/README.md +1 -1
- package/package.json +4 -2
- package/src/agent-time/store.ts +2 -2
- package/src/check.ts +1 -1
- package/src/checks/SK001-package-json-shape.check.ts +4 -0
- package/src/checks/SK003-claude-md-shape.check.ts +1 -1
- package/src/checks/SK004-gitignore-policy.check.ts +27 -2
- package/src/checks/SK005-rvlib-versions.check.ts +1 -1
- package/src/checks/SK008-reviewer-agent.check.ts +2 -2
- package/src/checks/SK012-config-barrel-import.check.ts +1 -1
- package/src/checks/SK015-nested-repo.check.ts +1 -1
- package/src/checks/SK035-public-clean.check.ts +46 -0
- package/src/checks/SK036-draft-media-size.check.ts +28 -0
- package/src/cli/cmd_Backup.ts +152 -0
- package/src/cli/cmd_Ci.ts +8 -11
- package/src/cli/cmd_Drill.ts +145 -0
- package/src/cli/cmd_Home.ts +50 -3
- package/src/cli/cmd_Media.ts +7 -5
- package/src/cli/cmd_Review.ts +4 -2
- package/src/cli/cmd_Shot.ts +5 -2
- package/src/cli/cmd_Smoke.ts +4 -1
- package/src/cli/cmd_Social.ts +226 -0
- package/src/cli/cmd_Start.ts +1 -1
- package/src/cli/cmd_Time.ts +1 -1
- package/src/cli/cmd_Trailer.ts +5 -2
- package/src/cli/cmd_Veille.ts +173 -0
- package/src/cli/family-pages.ts +3 -0
- package/src/cli/registry.ts +13 -2
- package/src/cli.ts +5 -2
- package/src/collections/actions.ts +1 -49
- package/src/collections/checks.ts +2 -1
- package/src/collections/collection-types.ts +11 -2
- package/src/collections/providers.ts +4 -4
- package/src/collections/review.ts +2 -1
- package/src/collections/tests.ts +19 -8
- package/src/contracts/apply-contracts.ts +1 -3
- package/src/contracts/contract-manifests.ts +2 -3
- package/src/contracts/contract-types.ts +0 -1
- package/src/contracts/contracts-engine.ts +0 -3
- package/src/core/app-icon.ts +9 -3
- package/src/core/bun-builtins.ts +2 -2
- package/src/core/discover-checks.ts +37 -5
- package/src/core/fix-scope.ts +4 -2
- package/src/core/floor-resolve.ts +68 -48
- package/src/core/floor.ts +9 -0
- package/src/core/git-root.ts +24 -0
- package/src/core/last-good.ts +3 -1
- package/src/core/layout.ts +8 -0
- package/src/core/log-stamp.ts +36 -0
- package/src/core/loop-watch.ts +93 -0
- package/src/core/machine-link.ts +134 -0
- package/src/core/memory-watch.ts +41 -0
- package/src/core/one-way-in-policy.ts +27 -19
- package/src/core/run-ci.ts +6 -8
- package/src/core/run-fixers.ts +9 -9
- package/src/core/slots.ts +21 -0
- package/src/core/tree-rev.ts +60 -0
- package/src/core/unit-files.ts +42 -0
- package/src/drill/render.ts +140 -0
- package/src/drill/run.ts +269 -0
- package/src/fleet/scan-fleet.ts +6 -5
- package/src/home/daemon-jobs.ts +201 -0
- package/src/home/global-context.ts +34 -1
- package/src/home/home-routes.ts +22 -15
- package/src/home/hubs.ts +10 -3
- package/src/home/inbox-shape.ts +53 -4
- package/src/home/inbox.ts +16 -1
- package/src/home/lib-watch.ts +10 -3
- package/src/home/machine-stores.ts +15 -29
- package/src/home/run-daemon.ts +15 -18
- package/src/home/run-pm.ts +2 -0
- package/src/home/serve-daemon.ts +4 -3
- package/src/home/serve-web.ts +104 -1
- package/src/hooks/commit-message.ts +28 -19
- package/src/hooks/leak-guard.ts +10 -3
- package/src/hooks/run-hooks.ts +2 -6
- package/src/identities/identities.ts +334 -0
- package/src/identities/machine-route.ts +126 -0
- package/src/identities/machine.ts +62 -0
- package/src/init-repo.ts +1 -1
- package/src/ledger/check-stats.ts +10 -9
- package/src/ledger/gate-checks.ts +32 -1
- package/src/ledger/record-kept.ts +112 -0
- package/src/ledger/repo-view.ts +10 -0
- package/src/ledger/run-log.ts +17 -12
- package/src/ledger/run-timeline.ts +8 -4
- package/src/ledger/store.ts +7 -0
- package/src/ledger/suite-log.ts +17 -13
- package/src/media-kinds.ts +2 -1
- package/src/media-store/backup/daemon.ts +73 -0
- package/src/media-store/backup/keys.ts +25 -0
- package/src/media-store/backup/manifest.ts +193 -0
- package/src/media-store/backup/restore.ts +192 -0
- package/src/media-store/backup/run.ts +278 -0
- package/src/media-store/backup/secret.ts +86 -0
- package/src/media-store/backup/snapshot.ts +64 -0
- package/src/media-store/backup/sources.ts +199 -0
- package/src/media-store/daemon.ts +56 -70
- package/src/media-store/put.ts +4 -2
- package/src/media-store/space.ts +23 -4
- package/src/pages/forward.ts +35 -0
- package/src/pages/frame-client.ts +118 -0
- package/src/pages/routes.ts +29 -0
- package/src/pages/unit.ts +92 -0
- package/src/plan/planner.ts +12 -0
- package/src/plan/repo-source.ts +19 -5
- package/src/reflect/transcript.ts +35 -10
- package/src/release/public-clean.ts +301 -0
- package/src/release/published-here.ts +22 -0
- package/src/release/run-bump.ts +2 -1
- package/src/release/run-release.ts +4 -1
- package/src/repo-config.ts +53 -2
- package/src/review/http.ts +16 -2
- package/src/review/model.ts +15 -4
- package/src/review/notes.ts +77 -0
- package/src/review/project.ts +6 -38
- package/src/review/routes.ts +4 -12
- package/src/review/store.ts +41 -1
- package/src/review/trailer-media.ts +7 -4
- package/src/review/trailer-shots.ts +21 -4
- package/src/review/unit.ts +1 -1
- package/src/scaffold/files/agent-handoff.md +3 -0
- package/src/scaffold/files/agent-index.md +4 -12
- package/src/scaffold/project-scaffold.ts +5 -4
- package/src/serve/embed.ts +1 -1
- package/src/serve/hub-app/col-card.tsx +3 -17
- package/src/serve/hub-app/col-tables-view.tsx +2 -1
- package/src/serve/hub-app/cols-svc.ts +0 -13
- package/src/serve/hub-app/dock-st.ts +4 -2
- package/src/serve/hub-app/dock-view.tsx +2 -0
- package/src/serve/hub-app/frames-st.ts +35 -0
- package/src/serve/hub-app/hash-route.ts +64 -1
- package/src/serve/hub-app/home-st.ts +31 -7
- package/src/serve/hub-app/home-strip.css +9 -1
- package/src/serve/hub-app/home-strip.tsx +7 -6
- package/src/serve/hub-app/home.html +5 -0
- package/src/serve/hub-app/hub-app.tsx +49 -5
- package/src/serve/hub-app/hub.css +29 -11
- package/src/serve/hub-app/icons.tsx +16 -1
- package/src/serve/hub-app/identities-st.ts +210 -0
- package/src/serve/hub-app/identities-view.tsx +352 -0
- package/src/serve/hub-app/identities.css +48 -0
- package/src/serve/hub-app/identity-address.ts +52 -0
- package/src/serve/hub-app/inbox-st.ts +59 -6
- package/src/serve/hub-app/inbox-view.tsx +48 -6
- package/src/serve/hub-app/inbox.css +12 -1
- package/src/serve/hub-app/index.html +3 -0
- package/src/serve/hub-app/keys.ts +10 -2
- package/src/serve/hub-app/list-walk.ts +89 -0
- package/src/serve/hub-app/machine-st.ts +12 -0
- package/src/serve/hub-app/media-view.tsx +2 -1
- package/src/serve/hub-app/pages-frames.tsx +134 -0
- package/src/serve/hub-app/pages-svc.ts +111 -0
- package/src/serve/hub-app/palette-st.ts +18 -3
- package/src/serve/hub-app/palette-view.tsx +9 -2
- package/src/serve/hub-app/planned-view.tsx +2 -1
- package/src/serve/hub-app/project-list.css +18 -14
- package/src/serve/hub-app/project-list.tsx +88 -49
- package/src/serve/hub-app/projects-svc.ts +33 -3
- package/src/serve/hub-app/repo-sections.ts +19 -2
- package/src/serve/hub-app/repo-st.ts +75 -19
- package/src/serve/hub-app/review/review-cells.tsx +3 -3
- package/src/serve/hub-app/review/review-kit.ts +30 -7
- package/src/serve/hub-app/review/review-page.tsx +1 -1
- package/src/serve/hub-app/review/review-st.ts +19 -8
- package/src/serve/hub-app/review/review-thread.tsx +11 -9
- package/src/serve/hub-app/review/review-views.tsx +84 -19
- package/src/serve/hub-app/review/thread-st.ts +1 -10
- package/src/serve/hub-app/review/trailer-page.tsx +2 -1
- package/src/serve/hub-app/review.css +17 -8
- package/src/serve/hub-app/site/site-part.tsx +173 -0
- package/src/serve/hub-app/site/site-st.ts +157 -0
- package/src/serve/hub-app/site.css +35 -0
- package/src/serve/hub-app/social/calendar.tsx +182 -0
- package/src/serve/hub-app/social/comms-page.tsx +306 -0
- package/src/serve/hub-app/social/kit.tsx +244 -0
- package/src/serve/hub-app/social/post-card.tsx +456 -0
- package/src/serve/hub-app/social/problems.tsx +60 -0
- package/src/serve/hub-app/social/social-model.ts +154 -0
- package/src/serve/hub-app/social/social-page.tsx +674 -0
- package/src/serve/hub-app/social/social-st.ts +986 -0
- package/src/serve/hub-app/social.css +289 -0
- package/src/serve/hub-app/stores/stores-page.tsx +311 -0
- package/src/serve/hub-app/stores/stores-st.ts +286 -0
- package/src/serve/hub-app/stores.css +54 -0
- package/src/serve/hub-app/timeline-geometry.ts +1 -1
- package/src/serve/hub-app/timeline-view.tsx +3 -2
- package/src/serve/hub-app/tree-build.ts +6 -0
- package/src/serve/hub-app/tree-row.tsx +27 -4
- package/src/serve/hub-app/tree-svc.ts +18 -49
- package/src/serve/hub-app/veille/veille-page.tsx +514 -0
- package/src/serve/hub-app/veille/veille-st.ts +443 -0
- package/src/serve/hub-app/veille.css +84 -0
- package/src/serve/hub-runtime.ts +14 -9
- package/src/serve/project-gutter-route.ts +44 -12
- package/src/serve/run-lanes.ts +7 -4
- package/src/serve/same-origin.ts +1 -1
- package/src/serve/serve-hub.ts +20 -12
- package/src/serve/tracked-watch.ts +24 -3
- package/src/serve/warm-cell.ts +5 -1
- package/src/shipkit-files.ts +15 -4
- package/src/shipkit.ts +0 -1
- package/src/shot/box.ts +162 -0
- package/src/shot/browser-slot.ts +62 -0
- package/src/shot/client.ts +43 -7
- package/src/shot/clip-encoder.ts +93 -12
- package/src/shot/film-box.ts +188 -0
- package/src/shot/shooter.ts +50 -15
- package/src/shot/shot-ask.ts +10 -2
- package/src/shot/stepped-clip.ts +5 -4
- package/src/site/desk.ts +242 -0
- package/src/site/routes.ts +66 -0
- package/src/site/unit.ts +62 -0
- package/src/social/brands.ts +22 -0
- package/src/social/compose.ts +97 -0
- package/src/social/desk-index.ts +123 -0
- package/src/social/desk-wire.ts +64 -0
- package/src/social/drafts.ts +183 -0
- package/src/social/house.ts +24 -0
- package/src/social/load.ts +319 -0
- package/src/social/md.ts +70 -0
- package/src/social/media-facts.ts +53 -0
- package/src/social/media-kind.ts +189 -0
- package/src/social/media-limit.ts +42 -0
- package/src/social/media-of.ts +30 -0
- package/src/social/migrate.ts +123 -0
- package/src/social/open.ts +17 -0
- package/src/social/post-url.ts +158 -0
- package/src/social/presence.ts +332 -0
- package/src/social/public-read.ts +53 -0
- package/src/social/publish/bluesky.ts +168 -0
- package/src/social/publish/discord.ts +76 -0
- package/src/social/publish/index.ts +24 -0
- package/src/social/publish/secret.ts +13 -0
- package/src/social/push.ts +31 -0
- package/src/social/richtext.ts +37 -0
- package/src/social/routes.ts +180 -0
- package/src/social/stats.ts +134 -0
- package/src/social/text.ts +267 -0
- package/src/social/tracker-route.ts +39 -0
- package/src/social/tracker.ts +255 -0
- package/src/social/unit.ts +53 -0
- package/src/social/writes.ts +130 -0
- package/src/start-repo.ts +14 -9
- package/src/stores/collection.ts +27 -0
- package/src/stores/desk.ts +336 -0
- package/src/stores/model.ts +187 -0
- package/src/stores/routes.ts +126 -0
- package/src/stores/unit.ts +57 -0
- package/src/suite/calibrate.ts +127 -0
- package/src/suite/core-counters.ts +91 -0
- package/src/suite/judge-suites.ts +94 -34
- package/src/suite/suite-cli.ts +44 -10
- package/src/suite/suite-cpu-preload.ts +34 -9
- package/src/trailer/adapter.ts +4 -0
- package/src/trailer/build.ts +42 -11
- package/src/trailer/ffmpeg.ts +11 -0
- package/src/trailer/footage.ts +30 -13
- package/src/trailer/grammar.ts +18 -2
- package/src/trailer/graph.ts +28 -6
- package/src/trailer/passage.ts +17 -5
- package/src/trailer/plan.ts +74 -3
- package/src/trailer/stitch.ts +67 -26
- package/src/trailer/url.ts +1 -1
- package/src/trailer/versions.ts +24 -0
- package/src/ts/gate-typecheck.ts +32 -0
- package/src/ts/typecheck-cli.ts +9 -11
- package/src/tui/tui-app.tsx +0 -1
- package/src/veille/asks.ts +155 -0
- package/src/veille/auto.ts +31 -0
- package/src/veille/batch.ts +27 -0
- package/src/veille/chrome.ts +127 -0
- package/src/veille/collection.ts +28 -0
- package/src/veille/desk.ts +242 -0
- package/src/veille/identity.ts +80 -0
- package/src/veille/import.ts +68 -0
- package/src/veille/log.ts +183 -0
- package/src/veille/platforms.ts +118 -0
- package/src/veille/reads.ts +66 -0
- package/src/veille/replied.ts +110 -0
- package/src/veille/routes.ts +185 -0
- package/src/veille/service.ts +81 -0
- package/src/veille/watch.ts +116 -0
- package/src/veille/worth.ts +46 -0
- package/src/wiki/scan-md.ts +18 -0
- package/src/collections/posts.ts +0 -142
- package/src/contracts/manifests/social.contract.ts +0 -20
- package/src/scaffold/files/agent-coding.md +0 -35
- package/src/ts/typecheck-cache.ts +0 -11
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
// default, or a paste-from-elsewhere. Doctrine page: build/collections in
|
|
7
7
|
// the docs wiki this lib ships beside.
|
|
8
8
|
|
|
9
|
+
import { yieldLoop } from '../core/loop-watch.ts'
|
|
9
10
|
import type { WhenAt, WhenSource } from '../core/when.ts'
|
|
10
11
|
import type { RunsCells } from '../core/runs-matrix.ts'
|
|
11
12
|
import type { CheckFrom } from '../ledger/gate-checks.ts'
|
|
@@ -31,12 +32,16 @@ export const NO_CHECK = 'in no check'
|
|
|
31
32
|
* section a row lives under (hub-app/tree-build.ts KIND_SECTION). There is no
|
|
32
33
|
* catch all kind: a row belongs to an owner, and what belongs to the hub
|
|
33
34
|
* itself is its status (serve/hub-problems.ts), never a row */
|
|
34
|
-
export const RESOURCE_TYPES = ['ask', 'secret', 'asset', 'post', 'workflow', 'wiki', 'contract', 'check', 'test', 'reflection', 'process', 'card', 'cut'] as const
|
|
35
|
+
export const RESOURCE_TYPES = ['ask', 'secret', 'asset', 'post', 'workflow', 'wiki', 'contract', 'check', 'test', 'reflection', 'process', 'card', 'cut', 'store', 'veille'] as const
|
|
35
36
|
|
|
36
37
|
/** the collection of the review cards that wait on him (collections/review.ts) */
|
|
37
38
|
export const REVIEW_COL = 'review'
|
|
38
39
|
/** the collection of the trailer cuts, one row a cut (collections/review.ts) */
|
|
39
40
|
export const TRAILER_COL = 'trailers'
|
|
41
|
+
/** the collection of the store pages, one row a store (stores/collection.ts) */
|
|
42
|
+
export const STORES_COL = 'stores'
|
|
43
|
+
/** the collection of the Veille, one row for the identity whose posts it ranks (veille/collection.ts) */
|
|
44
|
+
export const VEILLE_COL = 'veille'
|
|
40
45
|
|
|
41
46
|
export type ResourceType = (typeof RESOURCE_TYPES)[number]
|
|
42
47
|
|
|
@@ -327,10 +332,13 @@ export const brokenRow = (c: Collection, e: unknown): Instance => ({
|
|
|
327
332
|
export type OnCollector = (collection: string, error: string | null) => void
|
|
328
333
|
|
|
329
334
|
/** every resource of every collection, failure-isolated per collection: a
|
|
330
|
-
* broken source reports itself as ONE red row, never blanks the tree
|
|
335
|
+
* broken source reports itself as ONE red row, never blanks the tree. The
|
|
336
|
+
* loop is given back between two collections (wiki build/shipkit/home.md,
|
|
337
|
+
* Nothing heavy on the daemon's loop) */
|
|
331
338
|
export async function projectResources(collections: Collection[], onCollector?: OnCollector): Promise<Resource[]> {
|
|
332
339
|
const out: Resource[] = []
|
|
333
340
|
for (const c of collections) {
|
|
341
|
+
await yieldLoop()
|
|
334
342
|
try {
|
|
335
343
|
out.push(...(await listResources(c)))
|
|
336
344
|
onCollector?.(c.id, null)
|
|
@@ -348,6 +356,7 @@ export async function projectResources(collections: Collection[], onCollector?:
|
|
|
348
356
|
export async function projectNeeds(collections: Collection[], onCollector?: OnCollector): Promise<NeedItem[]> {
|
|
349
357
|
const out: NeedItem[] = []
|
|
350
358
|
for (const c of collections) {
|
|
359
|
+
await yieldLoop()
|
|
351
360
|
try {
|
|
352
361
|
for (const i of await c.list()) if (i.severity != null) out.push({ ...i, collection: c.id })
|
|
353
362
|
onCollector?.(c.id, null)
|
|
@@ -24,10 +24,11 @@ import type { RepoConfig } from '../repo-config.ts'
|
|
|
24
24
|
import { activeContracts, contractsConfigFrom } from '../contracts/apply-contracts.ts'
|
|
25
25
|
import type { AskFacts, CheckFacts, Collection, Instance } from './collection-types.ts'
|
|
26
26
|
import { mdBody } from './md-body.ts'
|
|
27
|
-
import { socialPostsCollection } from './posts.ts'
|
|
28
27
|
import { assetState, secretState, type SecretLevel, type SecretProbe } from './state-rules.ts'
|
|
29
28
|
import { reflectionsCollection } from './reflections.ts'
|
|
30
29
|
import { reviewCollection, trailersCollection } from './review.ts'
|
|
30
|
+
import { storesCollection } from '../stores/collection.ts'
|
|
31
|
+
import { veilleCollection } from '../veille/collection.ts'
|
|
31
32
|
import { testsCollection } from './tests.ts'
|
|
32
33
|
import { checksCollection } from './checks.ts'
|
|
33
34
|
import { LAYOUT } from '../core/layout.ts'
|
|
@@ -415,10 +416,9 @@ export function buildCollections(root: string, c: RepoConfig, kit: ResolvedKit |
|
|
|
415
416
|
asksCollection(root, c),
|
|
416
417
|
credsCollection(root, c, { verdicts: () => verdictsOf(checks) }),
|
|
417
418
|
mediaKitCollection(root, c.serve?.assets === false ? null : kit),
|
|
418
|
-
socialPostsCollection(root),
|
|
419
419
|
reflectionsCollection(root),
|
|
420
420
|
testsCollection(root, c),
|
|
421
|
-
// only where the repo has a review store or a
|
|
422
|
-
...[reviewCollection(root), trailersCollection(root)].filter((x): x is Collection => x !== null),
|
|
421
|
+
// only where the repo has a review store, a trailer folder or a store folder: the section of a repo with none is greyed
|
|
422
|
+
...[reviewCollection(root), trailersCollection(root), storesCollection(root), veilleCollection(root)].filter((x): x is Collection => x !== null),
|
|
423
423
|
]
|
|
424
424
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { existsSync } from 'node:fs'
|
|
6
6
|
import { join } from 'node:path'
|
|
7
7
|
import { STATUS_LABEL, isFrame, stateOf, type ReviewItem } from '../review/model.ts'
|
|
8
|
-
import { readAllCached, storeDir, storeStamp } from '../review/store.ts'
|
|
8
|
+
import { readAllCached, storeDir, storeStamp, warmStore } from '../review/store.ts'
|
|
9
9
|
import { statusOf, waitingOnOwner, type Thread } from '../review/threads.ts'
|
|
10
10
|
import { cutsOf, trailerIds } from '../review/trailer-desk.ts'
|
|
11
11
|
import { REVIEW_COL, TRAILER_COL, type Collection, type Instance } from './collection-types.ts'
|
|
@@ -34,6 +34,7 @@ export function reviewCollection(root: string): Collection | null {
|
|
|
34
34
|
kind: 'card',
|
|
35
35
|
media: 'image',
|
|
36
36
|
list: async () => {
|
|
37
|
+
await warmStore(dir)
|
|
37
38
|
const { threads, items } = waitingCards(root)
|
|
38
39
|
return threads.map(({ head: x }): Instance => ({
|
|
39
40
|
id: `card:${x.item.id}`,
|
package/src/collections/tests.ts
CHANGED
|
@@ -6,11 +6,14 @@
|
|
|
6
6
|
// testPlanOf, the same plan rule SK018 judges, and whether a file needs fixing
|
|
7
7
|
// is ledger/run-timeline.ts testFilesToFix, the same function the runs page
|
|
8
8
|
// tab lists. A second answer to either would drift from the first.
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { readFileSync } from 'fs'
|
|
10
|
+
import { join, posix } from 'path'
|
|
11
|
+
import { listRepoFiles } from '../core/floor.ts'
|
|
12
|
+
import { listingWithoutVendored } from '../core/vendored.ts'
|
|
13
|
+
import { readVendored } from '../core/vendored-read.ts'
|
|
11
14
|
import { testFilesToFix } from '../ledger/run-timeline.ts'
|
|
12
15
|
import { runsPath } from '../ledger/run-log.ts'
|
|
13
|
-
import { readSuites, type SuiteRow } from '../ledger/suite-log.ts'
|
|
16
|
+
import { readSuites, warmSuites, type SuiteRow } from '../ledger/suite-log.ts'
|
|
14
17
|
import type { RepoConfig } from '../repo-config.ts'
|
|
15
18
|
import { rawName } from '../core/canonical-scripts.ts'
|
|
16
19
|
import { DEFAULT_BUDGET_MS, normSuitePath } from '../suite/judge-suites.ts'
|
|
@@ -68,14 +71,22 @@ export function testsCollection(root: string, c: RepoConfig, o: TestsOpts = {}):
|
|
|
68
71
|
list: async () => {
|
|
69
72
|
let files = o.files
|
|
70
73
|
let read = o.read
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
// what git sees, as a check's `list` lists it (tracked, or untracked and not ignored, the vendored dirs
|
|
75
|
+
// left out), from the repo listing the inventory reads too: kept on the tree's revision in the daemon,
|
|
76
|
+
// where a check context stages and hashes the whole tree
|
|
77
|
+
if (files == null) {
|
|
78
|
+
const glob = new Bun.Glob(TEST_GLOB)
|
|
79
|
+
files = listingWithoutVendored(listRepoFiles(root).filter((f) => glob.match(f)), TEST_GLOB, readVendored(root))
|
|
80
|
+
}
|
|
81
|
+
read ??= (rel) => {
|
|
82
|
+
try { return readFileSync(join(root, rel), 'utf8') } catch { return null }
|
|
75
83
|
}
|
|
76
84
|
let suites = o.suites
|
|
77
85
|
if (suites == null) {
|
|
78
|
-
try {
|
|
86
|
+
try {
|
|
87
|
+
await warmSuites(runsPath(root))
|
|
88
|
+
suites = readSuites(runsPath(root))
|
|
89
|
+
} catch { suites = [] }
|
|
79
90
|
}
|
|
80
91
|
return testInstances({ config: c, files: files.filter(isTestFile), read, suites })
|
|
81
92
|
},
|
|
@@ -15,15 +15,13 @@ import { evaluateContracts, type ContractsConfig, type ContractsResult } from '.
|
|
|
15
15
|
|
|
16
16
|
export function contractsConfigFrom(c: RepoConfig, d: WebDisk & Pick<ScanCtx, 'root'>): ContractsConfig {
|
|
17
17
|
const venues = c.venues ?? []
|
|
18
|
-
const
|
|
19
|
-
const declared = [...venues, ...(social.length > 0 ? ['social'] : [])]
|
|
18
|
+
const declared = [...venues]
|
|
20
19
|
const deploys = webDeploys(d)
|
|
21
20
|
// a public repo whose only surface is an npm package has no page to serve an identity on
|
|
22
21
|
const npmOnly = c.release?.npm === true && deploys.length === 0 && venues.length === 0
|
|
23
22
|
return {
|
|
24
23
|
root: d.root,
|
|
25
24
|
declared,
|
|
26
|
-
social,
|
|
27
25
|
publicSurface: venues.length > 0 || deploys.length > 0 || (c.visibility === 'public' && !npmOnly),
|
|
28
26
|
webRoot: webRootOf(c.contracts?.webRoot, deploys),
|
|
29
27
|
exempt: c.contracts?.exempt,
|
|
@@ -4,7 +4,6 @@ import type { ContractManifest } from './contract-types.ts'
|
|
|
4
4
|
import c0 from './manifests/discord.contract.ts'
|
|
5
5
|
import c1 from './manifests/identity.contract.ts'
|
|
6
6
|
import c2 from './manifests/itch.contract.ts'
|
|
7
|
-
import c3 from './manifests/
|
|
8
|
-
import c4 from './manifests/steam.contract.ts'
|
|
7
|
+
import c3 from './manifests/steam.contract.ts'
|
|
9
8
|
|
|
10
|
-
export const allContracts: ContractManifest[] = [c0, c1, c2, c3
|
|
9
|
+
export const allContracts: ContractManifest[] = [c0, c1, c2, c3]
|
|
@@ -34,7 +34,6 @@ export type ContractEnv = {
|
|
|
34
34
|
/** the dir the site serves, what `{web}` in a rule path stands for */
|
|
35
35
|
webRoot: string
|
|
36
36
|
venues: string[]
|
|
37
|
-
social: string[]
|
|
38
37
|
exists: (relPath: string) => boolean
|
|
39
38
|
/** the text of a repo-relative file, null when none. A probe reads the
|
|
40
39
|
* repo through this and `exists`, so a check reporting it is cached on
|
|
@@ -22,8 +22,6 @@ export type ContractsConfig = {
|
|
|
22
22
|
root: string
|
|
23
23
|
/** venue ids the repo declares it ships on (config side of both-ways drift) */
|
|
24
24
|
declared: string[]
|
|
25
|
-
/** social channel list — handed to custom rules via ContractEnv */
|
|
26
|
-
social: string[]
|
|
27
25
|
/** repo has a public surface (a deploy, a declared venue, a public repo) — gates 'always' contracts */
|
|
28
26
|
publicSurface: boolean
|
|
29
27
|
/** the dir the site serves, substituted for `{web}` in rule paths (default 'public') */
|
|
@@ -186,7 +184,6 @@ export async function evaluateContracts(manifests: ContractManifest[], cfg: Cont
|
|
|
186
184
|
root: cfg.root,
|
|
187
185
|
webRoot,
|
|
188
186
|
venues: cfg.declared,
|
|
189
|
-
social: cfg.social,
|
|
190
187
|
exists: (rel) => d.exists(rel),
|
|
191
188
|
read: (rel) => textOf(d, rel),
|
|
192
189
|
}
|
package/src/core/app-icon.ts
CHANGED
|
@@ -96,8 +96,12 @@ function plate(ctx: ReturnType<Canvas['getContext']>, o: number): void {
|
|
|
96
96
|
ctx.roundRect(o, o, PLATE, PLATE, RADIUS)
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
/** how the plate is drawn: `plateAlpha` fades the plate alone, the mark stays whole
|
|
100
|
+
* (the rail's unselected rows). A tile has no plate apart from its mark, so it ignores it */
|
|
101
|
+
export type PlateLook = { plateAlpha?: number }
|
|
102
|
+
|
|
99
103
|
/** the icon at 1024px, and the plate colour it used (null: the mark is the plate) */
|
|
100
|
-
export async function drawAppIcon(bytes: Uint8Array, id: Identity): Promise<{ canvas: Canvas; plate: string | null }> {
|
|
104
|
+
export async function drawAppIcon(bytes: Uint8Array, id: Identity, look: PlateLook = {}): Promise<{ canvas: Canvas; plate: string | null }> {
|
|
101
105
|
const img = await decode(bytes)
|
|
102
106
|
const src = createCanvas(img.width, img.height)
|
|
103
107
|
const sctx = src.getContext('2d')
|
|
@@ -127,8 +131,10 @@ export async function drawAppIcon(bytes: Uint8Array, id: Identity): Promise<{ ca
|
|
|
127
131
|
g.addColorStop(0, towardWhite(colour, 0.14))
|
|
128
132
|
g.addColorStop(1, colour)
|
|
129
133
|
ctx.fillStyle = g
|
|
134
|
+
ctx.globalAlpha = look.plateAlpha ?? 1
|
|
130
135
|
plate(ctx, o)
|
|
131
136
|
ctx.fill()
|
|
137
|
+
ctx.globalAlpha = 1
|
|
132
138
|
const s = (PLATE * MARK) / Math.max(box.w, box.h)
|
|
133
139
|
ctx.drawImage(src, box.x, box.y, box.w, box.h, ICON_PX / 2 - (box.w * s) / 2, ICON_PX / 2 - (box.h * s) / 2, box.w * s, box.h * s)
|
|
134
140
|
return { canvas: out, plate: colour }
|
|
@@ -138,8 +144,8 @@ export async function drawAppIcon(bytes: Uint8Array, id: Identity): Promise<{ ca
|
|
|
138
144
|
* grid's margin away, the rounded plate edge to edge (the hub's rail);
|
|
139
145
|
* `square` fills the plate's corners with its own edge colours, edge to edge
|
|
140
146
|
* with no transparency (a phone's home screen cuts its own corners) */
|
|
141
|
-
export async function appIconPngs(bytes: Uint8Array, id: Identity, sizes: number[] = [ICON_PX], crop: 'canvas' | 'plate' | 'square' = 'canvas'): Promise<Buffer[]> {
|
|
142
|
-
const { canvas } = await drawAppIcon(bytes, id)
|
|
147
|
+
export async function appIconPngs(bytes: Uint8Array, id: Identity, sizes: number[] = [ICON_PX], crop: 'canvas' | 'plate' | 'square' = 'canvas', look: PlateLook = {}): Promise<Buffer[]> {
|
|
148
|
+
const { canvas } = await drawAppIcon(bytes, id, look)
|
|
143
149
|
const o = crop === 'canvas' ? 0 : (ICON_PX - PLATE) / 2
|
|
144
150
|
const side = crop === 'canvas' ? ICON_PX : PLATE
|
|
145
151
|
const edge = (y: number): string => {
|
package/src/core/bun-builtins.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// manual `bun fmt` (never a gate step). A repo opts in by declaring the tool's
|
|
3
3
|
// section in bunfig.toml: the section is where its config lives.
|
|
4
4
|
//
|
|
5
|
-
// bun before 1.4.4 has neither command, and there `bun lint` falls through to
|
|
5
|
+
// bun before 1.4.4 has neither command, nor `bun check` (ts/gate-typecheck.ts), and there `bun lint` falls through to
|
|
6
6
|
// the package.json `lint` script. A script that calls `bun lint` then calls
|
|
7
7
|
// itself forever, so an old bun gets a loud refusal instead of a spawn. The
|
|
8
8
|
// lint slot runs through core/bun-tool-cli.ts, which keeps a same-named script out.
|
|
@@ -12,7 +12,7 @@ export type BunTool = 'lint' | 'fmt'
|
|
|
12
12
|
|
|
13
13
|
export const BUN_TOOLS_SINCE = '1.4.4'
|
|
14
14
|
|
|
15
|
-
/** does the bun running shipkit ship `bun lint` and `bun
|
|
15
|
+
/** does the bun running shipkit ship `bun lint`, `bun fmt` and `bun check` */
|
|
16
16
|
export const bunHasTools = (version: string = Bun.version): boolean => Bun.semver.order(version.replace(/-.*$/, ''), BUN_TOOLS_SINCE) >= 0
|
|
17
17
|
|
|
18
18
|
const header = (tool: BunTool): RegExp => new RegExp(`^\\s*\\[${tool}(?:\\.[^\\]]+)?\\]\\s*(?:#.*)?$`)
|
|
@@ -57,18 +57,50 @@ export type DiscoveredCheck = {
|
|
|
57
57
|
from: CheckFrom
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
function walk(dir: string, out: string[], suffix = SUFFIX, dirs?: string[], prune?: ReadonlySet<string
|
|
60
|
+
function walk(dir: string, out: string[], suffix = SUFFIX, dirs?: string[], prune?: ReadonlySet<string>, times?: [string, number][]): void {
|
|
61
61
|
dirs?.push(dir)
|
|
62
|
+
// the time before the read: a write between the two then reads as moved
|
|
63
|
+
if (times != null) {
|
|
64
|
+
try { times.push([dir, statSync(dir).mtimeMs]) } catch { times.push([dir, -1]) }
|
|
65
|
+
}
|
|
62
66
|
let entries
|
|
63
67
|
try { entries = readdirSync(dir, { withFileTypes: true }) } catch { return }
|
|
64
68
|
for (const e of entries) {
|
|
65
69
|
if (e.isDirectory()) {
|
|
66
70
|
const sub = join(dir, e.name)
|
|
67
|
-
if (!IGNORED_DIRS.has(e.name) && !e.name.startsWith('.') && prune?.has(sub) !== true) walk(sub, out, suffix, dirs, prune)
|
|
71
|
+
if (!IGNORED_DIRS.has(e.name) && !e.name.startsWith('.') && prune?.has(sub) !== true) walk(sub, out, suffix, dirs, prune, times)
|
|
68
72
|
} else if (e.name.endsWith(suffix)) out.push(join(dir, e.name))
|
|
69
73
|
}
|
|
70
74
|
}
|
|
71
75
|
|
|
76
|
+
/** the last walk of each (root, suffix, prune), with the time of every dir it read: a dir's time moves when an entry
|
|
77
|
+
* is added, removed or renamed in it, so while none moved the list is the same, at a stat per dir (2 ms for a
|
|
78
|
+
* thousand dirs, where the walk takes 40 to 60 ms). The daemon's warm answers walk each repo many times */
|
|
79
|
+
const walks = new Map<string, { dirs: [string, number][]; out: string[] }>()
|
|
80
|
+
const WALKS_MAX = 256
|
|
81
|
+
|
|
82
|
+
function walkKept(dir: string, out: string[], suffix: string, dirs: string[] | undefined, prune: ReadonlySet<string>): void {
|
|
83
|
+
const key = `${dir}\0${suffix}\0${[...prune].sort().join('\0')}`
|
|
84
|
+
const held = walks.get(key)
|
|
85
|
+
const same = held != null && held.dirs.every(([d, t]) => {
|
|
86
|
+
try { return statSync(d).mtimeMs === t } catch { return false }
|
|
87
|
+
})
|
|
88
|
+
if (held != null && same) {
|
|
89
|
+
out.push(...held.out)
|
|
90
|
+
for (const [d] of held.dirs) dirs?.push(d)
|
|
91
|
+
return
|
|
92
|
+
}
|
|
93
|
+
const seen: string[] = []
|
|
94
|
+
const found: string[] = []
|
|
95
|
+
const timed: [string, number][] = []
|
|
96
|
+
walk(dir, found, suffix, seen, prune, timed)
|
|
97
|
+
walks.delete(key)
|
|
98
|
+
walks.set(key, { dirs: timed, out: found })
|
|
99
|
+
if (walks.size > WALKS_MAX) walks.delete(walks.keys().next().value!)
|
|
100
|
+
out.push(...found)
|
|
101
|
+
dirs?.push(...seen)
|
|
102
|
+
}
|
|
103
|
+
|
|
72
104
|
/** the absolute vendored dirs of a repo, which no repo walk enters */
|
|
73
105
|
const vendoredPrune = (root: string): ReadonlySet<string> => new Set(readVendored(root).map((d) => join(root, d)))
|
|
74
106
|
|
|
@@ -77,7 +109,7 @@ const vendoredPrune = (root: string): ReadonlySet<string> => new Set(readVendore
|
|
|
77
109
|
* mtime, which is how a reader tells the list moved without walking again */
|
|
78
110
|
export function repoUnitFiles(root: string, dirs?: string[]): string[] {
|
|
79
111
|
const out: string[] = []
|
|
80
|
-
|
|
112
|
+
walkKept(root, out, UNIT_SUFFIX, dirs, vendoredPrune(root))
|
|
81
113
|
return out.sort()
|
|
82
114
|
}
|
|
83
115
|
|
|
@@ -102,7 +134,7 @@ export async function importFresh(path: string): Promise<unknown> {
|
|
|
102
134
|
* Sorted. */
|
|
103
135
|
export function repoCheckFiles(root: string): string[] {
|
|
104
136
|
const out: string[] = []
|
|
105
|
-
|
|
137
|
+
walkKept(root, out, SUFFIX, undefined, vendoredPrune(root))
|
|
106
138
|
return out.sort()
|
|
107
139
|
}
|
|
108
140
|
|
|
@@ -197,7 +229,7 @@ export async function discoverChecks(root: string, o: DiscoverOpts = {}): Promis
|
|
|
197
229
|
const builtins: string[] = []
|
|
198
230
|
walk(builtinDir, builtins)
|
|
199
231
|
const found: string[] = []
|
|
200
|
-
|
|
232
|
+
walkKept(root, found, SUFFIX, undefined, vendoredPrune(root))
|
|
201
233
|
const units = repoUnitFiles(root)
|
|
202
234
|
// the repo that HOSTS the toolkit walks over `src/checks/` too, and a file
|
|
203
235
|
// discovered twice is a duplicate id rather than a second check. Real paths,
|
package/src/core/fix-scope.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// does a gate run its repair pass (core/run-fixers.ts). A leaf, so the hub's
|
|
2
2
|
// run lanes read the same answer the gate acts on without loading the gate.
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
|
|
4
|
+
/** every run repairs: a whole gate all it can, a narrowed run what its named
|
|
5
|
+
* checks own. A repair is mechanical and safe by contract, in a shared tree
|
|
6
|
+
* too. Only an internal report-only run (frozen, the hub's auto) passes false */
|
|
7
|
+
export const fixPassRuns = (o: { fix?: boolean; onlyIds?: readonly string[] }): boolean => o.fix ?? true
|
|
@@ -19,23 +19,23 @@ import { rawName, slotBody } from './canonical-scripts.ts'
|
|
|
19
19
|
import type { CheckCtx } from './check-ctx.ts'
|
|
20
20
|
import { checkUnitReader, type UnitReader } from '../release/unit-resolve.ts'
|
|
21
21
|
import { parseJsonc } from '../ts/jsonc.ts'
|
|
22
|
-
import {
|
|
23
|
-
import { gateBuildInfoArgs } from '../ts/typecheck-cache.ts'
|
|
22
|
+
import { gateCheckCmd, tscFallbackNote } from '../ts/gate-typecheck.ts'
|
|
24
23
|
import { parseBunTestScript, suiteFlags } from '../suite/judge-suites.ts'
|
|
25
24
|
import { declaredTestUnits, siblingUnits, testCheckId, unitIgnores, unitTestBody, unitTsconfig, type TestUnitDecl } from '../suite/test-units.ts'
|
|
26
25
|
import { describeFirst, type TaskDef } from '../check.ts'
|
|
27
26
|
import type { RepoConfig } from '../repo-config.ts'
|
|
28
27
|
import { repoOff } from './when.ts'
|
|
29
|
-
import { bunfigDeclares, bunLintCmd } from './bun-builtins.ts'
|
|
28
|
+
import { bunfigDeclares, bunHasTools, bunLintCmd } from './bun-builtins.ts'
|
|
30
29
|
import { normalizeVendored } from './vendored.ts'
|
|
31
30
|
|
|
32
|
-
/** how the floor reads the repo, by repo-relative path, plus the
|
|
33
|
-
* outside it: a binary on PATH
|
|
34
|
-
|
|
31
|
+
/** how the floor reads the repo, by repo-relative path, plus the lookups
|
|
32
|
+
* outside it: a binary on PATH, and the bun version (default: the bun
|
|
33
|
+
* running shipkit) */
|
|
34
|
+
export type FloorReader = UnitReader & { which: (bin: string) => string | null; bunVersion?: string }
|
|
35
35
|
|
|
36
36
|
/** the check context as a floor reader. A PATH lookup is not a repo read, so
|
|
37
|
-
* it marks the answer untracked, and only
|
|
38
|
-
*
|
|
37
|
+
* it marks the answer untracked, and only the tsc fallback of a bun with no
|
|
38
|
+
* `bun check` ever asks it */
|
|
39
39
|
export function checkFloorReader(c: CheckCtx): FloorReader {
|
|
40
40
|
return {
|
|
41
41
|
...checkUnitReader(c),
|
|
@@ -53,7 +53,7 @@ export const FLOOR_IDS = ['lint', 'typecheck', 'test', 'imports:check', 'cycles'
|
|
|
53
53
|
* outside them, since each unit has its own `test:<unit>` */
|
|
54
54
|
export function slotDescription(id: string, withUnits: boolean): string {
|
|
55
55
|
if (id === 'lint') return 'the linter reports no problem in the repo'
|
|
56
|
-
if (id === 'typecheck') return '
|
|
56
|
+
if (id === 'typecheck') return 'the type checker finds no type error in the repo'
|
|
57
57
|
if (id === 'test') return withUnits ? 'every test file outside the units passes' : 'every test file in the repo passes'
|
|
58
58
|
if (id === 'imports:check') return 'every local import is absolute, carries its extension and resolves'
|
|
59
59
|
if (id === 'cycles') return 'no import cycle between modules'
|
|
@@ -66,7 +66,7 @@ export const unitTestDescription = (u: { id: string; rel: string }): string =>
|
|
|
66
66
|
|
|
67
67
|
/** what a unit's own typecheck asserts */
|
|
68
68
|
export const unitTypecheckDescription = (u: { id: string; rel: string }): string =>
|
|
69
|
-
describeFirst(`
|
|
69
|
+
describeFirst(`the type checker finds no type error under ${u.rel}`, `the type checker finds no type error in unit ${u.id}`)
|
|
70
70
|
|
|
71
71
|
export type FloorSource = 'package.json script' | 'repo.config override' | 'built-in (shipkit)' | 'built-in (tsc)' | 'built-in (bun)' | 'unit'
|
|
72
72
|
export type FloorResolution = {
|
|
@@ -84,7 +84,12 @@ export type FloorResolution = {
|
|
|
84
84
|
/** a package.json body for a slot. A plain `bun test` in the test slot runs
|
|
85
85
|
* through the suite runner (parallel, timed against the budget), anything
|
|
86
86
|
* else runs as written and the gate says what that costs */
|
|
87
|
-
function scriptCmd(c: RepoConfig, id: string, name: string, body: string, notes: string[], subs: TestUnitDecl[]): string[] {
|
|
87
|
+
function scriptCmd(c: RepoConfig, root: string, io: FloorReader, id: string, name: string, body: string, notes: string[], subs: TestUnitDecl[]): string[] {
|
|
88
|
+
if (id === 'typecheck') {
|
|
89
|
+
const project = plainTypecheckProject(body)
|
|
90
|
+
const cmd = project == null || !io.exists(project, 'file') ? null : gateTypecheckCmd(root, io, project, ['node_modules/.bin/tsc'], notes)
|
|
91
|
+
return cmd == null || typeof cmd === 'string' ? ['bun', 'run', name] : cmd
|
|
92
|
+
}
|
|
88
93
|
if (id !== 'test') return ['bun', 'run', name]
|
|
89
94
|
const args = parseBunTestScript(body)
|
|
90
95
|
if (args == null) {
|
|
@@ -97,6 +102,43 @@ function scriptCmd(c: RepoConfig, id: string, name: string, body: string, notes:
|
|
|
97
102
|
}
|
|
98
103
|
|
|
99
104
|
const SUITE_CLI = fileURLToPath(import.meta.resolve('rvlib-shipkit/src/suite/suite-cli.ts'))
|
|
105
|
+
const TYPECHECK_CLI = fileURLToPath(import.meta.resolve('rvlib-shipkit/src/ts/typecheck-cli.ts'))
|
|
106
|
+
|
|
107
|
+
/** the tsconfig a script that only typechecks one config checks,
|
|
108
|
+
* repo-relative: `tsc --noEmit` or `bun check`, with at most a
|
|
109
|
+
* `-p`/`--project` (and, for bun check, the flags the gate passes itself).
|
|
110
|
+
* null for any other body, which runs as written */
|
|
111
|
+
export function plainTypecheckProject(body: string): string | null {
|
|
112
|
+
const words = body.trim().split(/\s+/)
|
|
113
|
+
const bunCheck = words[0] === 'bun' && words[1] === 'check'
|
|
114
|
+
if (!bunCheck && (words[0] !== 'tsc' || !words.includes('--noEmit'))) return null
|
|
115
|
+
const own = bunCheck ? GATE_CHECK_FLAGS : new Set(['--noEmit'])
|
|
116
|
+
const args = words.slice(bunCheck ? 2 : 1)
|
|
117
|
+
let project = '.'
|
|
118
|
+
for (let i = 0; i < args.length; i++) {
|
|
119
|
+
if (own.has(args[i]!)) continue
|
|
120
|
+
if ((args[i] === '-p' || args[i] === '--project') && args[i + 1] != null) { project = args[++i]!; continue }
|
|
121
|
+
return null
|
|
122
|
+
}
|
|
123
|
+
return project.endsWith('.json') ? posix.normalize(project) : posix.join(project, 'tsconfig.json')
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const GATE_CHECK_FLAGS = new Set(['-b', '--build', '--all', '--no-pretty', '--no-script'])
|
|
127
|
+
|
|
128
|
+
/** the gate's typecheck over one repo-relative tsconfig, the same for a plain
|
|
129
|
+
* script, the built-in and a unit: `bun check` (ts/gate-typecheck.ts). On a
|
|
130
|
+
* bun without it, the cold tsc runner over the first tsc found (`tscAt`,
|
|
131
|
+
* repo-relative, then PATH), with a note; the reason when no tsc is found */
|
|
132
|
+
function gateTypecheckCmd(root: string, io: FloorReader, rel: string, tscAt: string[], notes: string[]): string[] | string {
|
|
133
|
+
const tsconfig = join(root, rel)
|
|
134
|
+
if (bunHasTools(io.bunVersion)) return gateCheckCmd(tsconfig)
|
|
135
|
+
const local = tscAt.find((p) => io.exists(p))
|
|
136
|
+
const tsc = local != null ? join(root, local) : io.which('tsc')
|
|
137
|
+
if (tsc == null) return `bun ${io.bunVersion ?? Bun.version} has no \`bun check\` and no tsc resolves (${[...tscAt, 'PATH'].join(', ')}): \`bun upgrade --canary\``
|
|
138
|
+
const note = tscFallbackNote(io.bunVersion)
|
|
139
|
+
if (!notes.includes(note)) notes.push(note)
|
|
140
|
+
return ['bun', TYPECHECK_CLI, tsc, tsconfig]
|
|
141
|
+
}
|
|
100
142
|
|
|
101
143
|
/** one test check per declared sub-unit, `test:<unit id>`, a `release: false`
|
|
102
144
|
* one included, run in the unit's own dir through the suite runner, so its
|
|
@@ -124,11 +166,10 @@ function unitTestTasks(root: string, io: FloorReader, subs: TestUnitDecl[], sibl
|
|
|
124
166
|
/** one typecheck per declared sub-unit with a tsconfig of its own,
|
|
125
167
|
* `typecheck:<unit id>`: the root tsconfig excludes a unit's dir (it compiles
|
|
126
168
|
* standalone), so without this a green root typecheck hides every error only
|
|
127
|
-
* the unit's tsconfig sees. It runs the
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
|
|
131
|
-
function unitTypecheckTasks(root: string, io: FloorReader, subs: TestUnitDecl[], siblings: Map<string, string[]>, unfilled: { id: string; reason: string }[]): TaskDef[] {
|
|
169
|
+
* the unit's tsconfig sees. It runs the root slot's command. The tsc
|
|
170
|
+
* fallback takes the unit's node_modules, else the repo's, else PATH. Keyed
|
|
171
|
+
* and ordered like the unit's test check */
|
|
172
|
+
function unitTypecheckTasks(root: string, io: FloorReader, subs: TestUnitDecl[], siblings: Map<string, string[]>, notes: string[], unfilled: { id: string; reason: string }[]): TaskDef[] {
|
|
132
173
|
const out: TaskDef[] = []
|
|
133
174
|
for (const u of subs) {
|
|
134
175
|
const id = `typecheck:${u.id}`
|
|
@@ -137,12 +178,10 @@ function unitTypecheckTasks(root: string, io: FloorReader, subs: TestUnitDecl[],
|
|
|
137
178
|
if (u.tsconfig != null) unfilled.push({ id, reason: `units['${u.rel}'].tsconfig names '${u.tsconfig}', which does not exist` })
|
|
138
179
|
continue
|
|
139
180
|
}
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
if (tsc == null) { unfilled.push({ id, reason: `unit '${u.id}' has a tsconfig and no tsc resolves (its node_modules, the repo's, PATH): add typescript` }); continue }
|
|
143
|
-
const cli = fileURLToPath(import.meta.resolve('rvlib-shipkit/src/ts/typecheck-cli.ts'))
|
|
181
|
+
const cmd = gateTypecheckCmd(root, io, tsconfig, [join(u.rel, 'node_modules/.bin/tsc'), 'node_modules/.bin/tsc'], notes)
|
|
182
|
+
if (typeof cmd === 'string') { unfilled.push({ id, reason: `unit '${u.id}': ${cmd}` }); continue }
|
|
144
183
|
const outside = tsconfigChain(tsconfig, io).filter((f) => f !== u.rel && !f.startsWith(`${u.rel}/`))
|
|
145
|
-
out.push({ id, description: unitTypecheckDescription(u), cmd
|
|
184
|
+
out.push({ id, description: unitTypecheckDescription(u), cmd, cwd: join(root, u.rel), inputs: [u.rel, ...(siblings.get(u.id) ?? []), ...outside], ...(u.deps == null ? {} : { deps: u.deps }) })
|
|
146
185
|
}
|
|
147
186
|
return out
|
|
148
187
|
}
|
|
@@ -164,10 +203,10 @@ function tsconfigChain(rel: string, io: FloorReader): string[] {
|
|
|
164
203
|
}
|
|
165
204
|
|
|
166
205
|
// zero-config floor (O6): with no script, imports:check/cycles resolve to
|
|
167
|
-
// shipkit's own rvlib-ts-tools dep, typecheck to
|
|
206
|
+
// shipkit's own rvlib-ts-tools dep, typecheck to `bun check`, lint to
|
|
168
207
|
// `bun lint` once bunfig.toml declares [lint]. Returns the task, or the
|
|
169
208
|
// reason the slot stays empty.
|
|
170
|
-
function builtinFloorTask(id: string, root: string, io: FloorReader, vendored: readonly string[]): { task: TaskDef; source: FloorSource } | string {
|
|
209
|
+
function builtinFloorTask(id: string, root: string, io: FloorReader, vendored: readonly string[], notes: string[]): { task: TaskDef; source: FloorSource } | string {
|
|
171
210
|
if (id === 'lint') {
|
|
172
211
|
if (!bunfigDeclares(io.text('bunfig.toml'), 'lint')) return `no 'lint' script and no [lint] section in bunfig.toml`
|
|
173
212
|
return { task: { id, cmd: bunLintCmd(vendored) }, source: 'built-in (bun)' }
|
|
@@ -183,29 +222,10 @@ function builtinFloorTask(id: string, root: string, io: FloorReader, vendored: r
|
|
|
183
222
|
}
|
|
184
223
|
}
|
|
185
224
|
if (id === 'typecheck') {
|
|
186
|
-
const tsconfig = join(root, 'tsconfig.json')
|
|
187
225
|
if (!io.exists('tsconfig.json')) return `no 'typecheck' script and no tsconfig.json`
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
// `tsc --noEmit` over a solution-style config (`files: []` plus
|
|
192
|
-
// `references`) compiles ZERO files and exits 0, so the slot reports a
|
|
193
|
-
// green nobody measured. only a config that is its OWN single project
|
|
194
|
-
// keeps the plain command; everything else goes through the runner,
|
|
195
|
-
// which resolves and REPORTS what it checked.
|
|
196
|
-
//
|
|
197
|
-
// a config that compiles nothing, or references a path that is gone,
|
|
198
|
-
// registers the runner too rather than leaving the slot unfilled: an
|
|
199
|
-
// unfilled slot is a skip, `shipkit ci` still exits 0, and a repo with
|
|
200
|
-
// no typecheck coverage would look the same as a repo that passed.
|
|
201
|
-
let plain = false
|
|
202
|
-
try {
|
|
203
|
-
const projects = resolveTypecheckProjects(tsconfig, io, root)
|
|
204
|
-
plain = projects.projects.length === 1 && projects.projects[0] === tsconfig && projects.missing.length === 0
|
|
205
|
-
} catch { plain = false }
|
|
206
|
-
if (plain) return { task: { id, cmd: [tsc, '--noEmit', ...gateBuildInfoArgs(tsconfig)] }, source: 'built-in (tsc)' }
|
|
207
|
-
const cli = fileURLToPath(import.meta.resolve('rvlib-shipkit/src/ts/typecheck-cli.ts'))
|
|
208
|
-
return { task: { id, cmd: ['bun', cli, tsc, tsconfig] }, source: 'built-in (tsc)' }
|
|
226
|
+
const cmd = gateTypecheckCmd(root, io, 'tsconfig.json', ['node_modules/.bin/tsc'], notes)
|
|
227
|
+
if (typeof cmd === 'string') return `no 'typecheck' script, and ${cmd}`
|
|
228
|
+
return { task: { id, cmd }, source: bunHasTools(io.bunVersion) ? 'built-in (bun)' : 'built-in (tsc)' }
|
|
209
229
|
}
|
|
210
230
|
return `no package.json '${id}' script`
|
|
211
231
|
}
|
|
@@ -258,8 +278,8 @@ export function resolveFloor(c: RepoConfig, root: string, io: FloorReader): Floo
|
|
|
258
278
|
const t = { description, ...b }
|
|
259
279
|
return override == null || override === false ? t : { ...t, ...override, id }
|
|
260
280
|
}
|
|
261
|
-
if (slot.kind === 'script') { tasks.push(decorate({ id, cmd: scriptCmd(c, id, slot.name, slot.body, notes, subs) })); sources[id] = 'package.json script'; continue }
|
|
262
|
-
const b = builtinFloorTask(id, root, io, (c.vendored ?? []).map(normalizeVendored))
|
|
281
|
+
if (slot.kind === 'script') { tasks.push(decorate({ id, cmd: scriptCmd(c, root, io, id, slot.name, slot.body, notes, subs) })); sources[id] = 'package.json script'; continue }
|
|
282
|
+
const b = builtinFloorTask(id, root, io, (c.vendored ?? []).map(normalizeVendored), notes)
|
|
263
283
|
// a routed script with nothing behind it measures NOTHING, and the
|
|
264
284
|
// reason must say that rather than `no '<id>' script`, which is false
|
|
265
285
|
if (typeof b === 'string') unfilled.push({ id, reason: slot.kind === 'routed-empty' ? `script '${id}' routes to shipkit and there is no '${rawName(id)}' body to run` : b })
|
|
@@ -267,6 +287,6 @@ export function resolveFloor(c: RepoConfig, root: string, io: FloorReader): Floo
|
|
|
267
287
|
}
|
|
268
288
|
const siblings = siblingUnits(subs, io.text)
|
|
269
289
|
for (const t of unitTestTasks(root, io, subs, siblings, notes, unfilled)) { tasks.push(t); sources[t.id] = 'unit' }
|
|
270
|
-
for (const t of unitTypecheckTasks(root, io, subs, siblings, unfilled)) { tasks.push(t); sources[t.id] = 'unit' }
|
|
290
|
+
for (const t of unitTypecheckTasks(root, io, subs, siblings, notes, unfilled)) { tasks.push(t); sources[t.id] = 'unit' }
|
|
271
291
|
return { tasks, disabled, unfilled, sources, notes }
|
|
272
292
|
}
|
package/src/core/floor.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { join } from 'path'
|
|
|
6
6
|
import { gitBin } from './git-bin.ts'
|
|
7
7
|
import { fsUnitReader } from '../release/units.ts'
|
|
8
8
|
import { resolveFloor as resolveWith, type FloorReader, type FloorResolution } from './floor-resolve.ts'
|
|
9
|
+
import { keptOnTree } from './tree-rev.ts'
|
|
9
10
|
import type { RepoConfig } from '../repo-config.ts'
|
|
10
11
|
|
|
11
12
|
export * from './floor-resolve.ts'
|
|
@@ -20,6 +21,14 @@ export function resolveFloor(c: RepoConfig, root: string, io: FloorReader = fsFl
|
|
|
20
21
|
* relative: the listing test discovery and the root test key read. Outside
|
|
21
22
|
* git, a disk walk with installs and dot dirs left out */
|
|
22
23
|
export function listRepoFiles(root: string): string[] {
|
|
24
|
+
return keptOnTree(listings, root, () => listNow(root)).slice()
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** the last listing of each root a save watch follows (core/tree-rev.ts): a git spawn and a stat per file, read again
|
|
28
|
+
* only once a file moved */
|
|
29
|
+
const listings = new Map<string, { rev: number; value: string[] }>()
|
|
30
|
+
|
|
31
|
+
function listNow(root: string): string[] {
|
|
23
32
|
const p = Bun.spawnSync([gitBin(), 'ls-files', '-co', '--exclude-standard', '-z'], { cwd: root, stdout: 'pipe', stderr: 'ignore' })
|
|
24
33
|
if (p.exitCode === 0) return p.stdout.toString().split('\0').filter((f) => f !== '' && existsSync(join(root, f))).sort()
|
|
25
34
|
try {
|
package/src/core/git-root.ts
CHANGED
|
@@ -153,3 +153,27 @@ export function shipkitRoot(root: string): string {
|
|
|
153
153
|
const dir = gitRoot(root)?.commonDir
|
|
154
154
|
return dir == null ? join(root, LAYOUT.cache) : join(dir, 'shipkit')
|
|
155
155
|
}
|
|
156
|
+
|
|
157
|
+
/** the commit HEAD names, read from the git dir's files: no spawn, so a long lived process can key a cache on it each
|
|
158
|
+
* call. null when the files do not say it plainly (no repo, an unborn branch) */
|
|
159
|
+
export function headCommit(dir: string): string | null {
|
|
160
|
+
const r = gitRoot(dir)
|
|
161
|
+
if (r == null) return null
|
|
162
|
+
const sha = /^[0-9a-f]{40,64}$/
|
|
163
|
+
const read = (f: string): string | null => {
|
|
164
|
+
try {
|
|
165
|
+
return readFileSync(f, 'utf8')
|
|
166
|
+
} catch {
|
|
167
|
+
return null
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const head = read(join(r.gitDir, 'HEAD'))?.trim() ?? ''
|
|
171
|
+
if (sha.test(head)) return head
|
|
172
|
+
const ref = /^ref: (refs\/\S+)$/.exec(head)?.[1]
|
|
173
|
+
if (ref == null) return null
|
|
174
|
+
const loose = read(join(r.commonDir, ref))?.trim() ?? ''
|
|
175
|
+
if (sha.test(loose)) return loose
|
|
176
|
+
// a packed ref: its line in packed-refs
|
|
177
|
+
const packed = (read(join(r.commonDir, 'packed-refs')) ?? '').split('\n').find((l) => l.endsWith(` ${ref}`))?.split(' ')[0] ?? ''
|
|
178
|
+
return sha.test(packed) ? packed : null
|
|
179
|
+
}
|
package/src/core/last-good.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
// statically, so it imports node builtins only. A lib import here would let
|
|
8
8
|
// a broken file stop the boot before it can fall back.
|
|
9
9
|
import { constants, copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, readlinkSync, realpathSync, renameSync, rmSync, symlinkSync, writeFileSync } from 'fs'
|
|
10
|
+
import { rm } from 'fs/promises'
|
|
10
11
|
import { homedir } from 'os'
|
|
11
12
|
import { join, relative } from 'path'
|
|
12
13
|
|
|
@@ -109,7 +110,8 @@ export async function takeLastGood(lib: string, o: { home?: string; now?: number
|
|
|
109
110
|
if (at == null || e === name) continue
|
|
110
111
|
let since = Number(at[1])
|
|
111
112
|
try { since = Number(readFileSync(join(base, e, RETIRED), 'utf8')) } catch { /* never current: a clone that failed or was cut */ }
|
|
112
|
-
|
|
113
|
+
// a copy is thousands of files: removed off the loop, the daemon serves meanwhile
|
|
114
|
+
if (now - since > OLD_COPY_MS) await rm(join(base, e), { recursive: true, force: true })
|
|
113
115
|
}
|
|
114
116
|
return { dir, ms: performance.now() - t0 }
|
|
115
117
|
}
|