rvlib-shipkit 2.11.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 +56 -12
- 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 +96 -5
- package/src/cli/cmd_Review.ts +8 -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 +9 -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 +61 -6
- package/src/home/inbox.ts +75 -4
- 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 +110 -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 +9 -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/content.ts +11 -1
- package/src/media-store/daemon.ts +56 -70
- package/src/media-store/hand.ts +58 -0
- package/src/media-store/put.ts +122 -0
- package/src/media-store/space.ts +73 -11
- 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/media-kind.ts +3 -3
- package/src/review/media-read.ts +3 -3
- package/src/review/model.ts +24 -5
- package/src/review/notes.ts +77 -0
- package/src/review/project.ts +6 -38
- package/src/review/routes.ts +8 -13
- package/src/review/store.ts +46 -4
- package/src/review/trailer-media.ts +24 -3
- package/src/review/trailer-shots.ts +106 -0
- 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 +12 -14
- 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 +33 -11
- 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/test-view.tsx +9 -2
- package/src/serve/hub-app/tests-svc.ts +16 -1
- 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/resources-wire.ts +48 -0
- package/src/serve/run-lanes.ts +7 -4
- package/src/serve/same-origin.ts +1 -1
- package/src/serve/serve-hub.ts +27 -18
- 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 +21 -6
- package/src/trailer/plan.ts +74 -3
- package/src/trailer/shelf.ts +16 -0
- 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
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
// /api/projects/fork in Fork: a request names a repo, never a path. The rail ORDER is one text file for the whole machine
|
|
11
11
|
// (ORDER_FILE), so every hub shows the same order and a hand edit is seen
|
|
12
12
|
// within one poll; POST /api/projects/order writes it.
|
|
13
|
+
import { loopWatch } from '../core/loop-watch.ts'
|
|
13
14
|
import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, writeFileSync } from 'fs'
|
|
14
15
|
import { readFile, stat } from 'fs/promises'
|
|
15
16
|
import { homedir } from 'os'
|
|
@@ -24,7 +25,11 @@ import { identityOfText, identityProblem, type Identity } from '../core/identity
|
|
|
24
25
|
import { writeIdentity } from '../core/identity.ts'
|
|
25
26
|
import { appIconOf, appIconPngs, identityOfRoot } from '../core/app-icon.ts'
|
|
26
27
|
import { waitingCards } from '../collections/review.ts'
|
|
28
|
+
import { storeDir, warmStore } from '../review/store.ts'
|
|
27
29
|
import { writeArchived } from '../core/archived.ts'
|
|
30
|
+
import { identitiesDir } from '../identities/identities.ts'
|
|
31
|
+
import { identityCache, markFile, railOf, speakerIdOf, type RailIdentity } from '../identities/machine.ts'
|
|
32
|
+
import { speaksAsOfText } from '../social/house.ts'
|
|
28
33
|
|
|
29
34
|
export type { Gate }
|
|
30
35
|
|
|
@@ -42,6 +47,8 @@ function cardsOf(path: string): ProjectRow['cards'] {
|
|
|
42
47
|
const PREVIEW_PX = 256
|
|
43
48
|
/** the rail's app icon, cropped to the plate: 40px at 2x, the largest rail size */
|
|
44
49
|
const RAIL_PX = 96
|
|
50
|
+
/** the plate's opacity on a rail row that is not shown: the mark stays whole, project-list.css fades the rest */
|
|
51
|
+
const DIM_PLATE = 0.5
|
|
45
52
|
/** how long a release answer holds for a checkout whose `.git` is not a
|
|
46
53
|
* folder, since no stat can say when it moved */
|
|
47
54
|
export const RELEASE_TTL_MS = 60_000
|
|
@@ -88,8 +95,12 @@ export type ProjectRow = {
|
|
|
88
95
|
live: string | null
|
|
89
96
|
/** the colours its repo.config.ts declares (SK024), null when it declares none */
|
|
90
97
|
identity: Identity | null
|
|
98
|
+
/** the identity it speaks as (wiki build/shipkit/social.md): its `speaksAs`, else the default; null when none holds it */
|
|
99
|
+
speaksAs: string | null
|
|
91
100
|
/** its app icon cropped to the plate (core/app-icon.ts), what the folded rail draws; null with no mark */
|
|
92
101
|
appIcon: string | null
|
|
102
|
+
/** the same with its plate faded and its mark whole: the folded rail's rows that are not shown */
|
|
103
|
+
appIconDim: string | null
|
|
93
104
|
/** epoch ms of the newest of: the last commit, the last shipkit run, the
|
|
94
105
|
* newest Claude Code transcript. null when none of them exists */
|
|
95
106
|
activity: number | null
|
|
@@ -99,7 +110,8 @@ export type ProjectRow = {
|
|
|
99
110
|
/** a repo whose repo.config.ts says `archived: true`: only the archived page lists it */
|
|
100
111
|
export type ArchivedRow = { name: string; icon: string | null }
|
|
101
112
|
|
|
102
|
-
|
|
113
|
+
/** `identities`: every identity of the machine, in their order, as the list's headers draw them */
|
|
114
|
+
export type ProjectsAnswer = { projects: ProjectRow[]; archived: ArchivedRow[]; identities: RailIdentity[]; ms: number; at: number }
|
|
103
115
|
|
|
104
116
|
/** a command's exit code and stdout, or null when its binary is missing */
|
|
105
117
|
export type Run = (cmd: string[], cwd?: string) => Promise<{ code: number; out: string } | null>
|
|
@@ -132,7 +144,7 @@ const runCmd: Run = async (cmd, cwd) => {
|
|
|
132
144
|
return { code: await p.exited, out }
|
|
133
145
|
}
|
|
134
146
|
|
|
135
|
-
function openInCode(path: string): void {
|
|
147
|
+
export function openInCode(path: string): void {
|
|
136
148
|
const code = Bun.which('code')
|
|
137
149
|
if (code != null) {
|
|
138
150
|
Bun.spawn([code, path], { stdio: ['ignore', 'ignore', 'ignore'] }).unref()
|
|
@@ -315,26 +327,36 @@ export function projectGutter(d: GutterDeps) {
|
|
|
315
327
|
|
|
316
328
|
const iconUrl = (r: WiredRepo): string | null => (r.icon == null ? null : `/api/projects/icon/${encodeURIComponent(r.name)}?v=${iconStamp(join(r.path, r.icon))}`)
|
|
317
329
|
// the url names the mark's stamp and both colours, so a new mark or a colour change is a new url, cached a day
|
|
318
|
-
const railIconUrl = (r: WiredRepo, id: Identity): string | null => {
|
|
330
|
+
const railIconUrl = (r: WiredRepo, id: Identity, plate: '1' | 'dim' = '1'): string | null => {
|
|
319
331
|
const mark = appIconOf(r.path)
|
|
320
332
|
if (mark == null) return null
|
|
321
|
-
const q = new URLSearchParams({ plate
|
|
333
|
+
const q = new URLSearchParams({ plate, light: id.colorLight, dark: id.colorDark, v: String(iconStamp(mark)) })
|
|
322
334
|
return `/api/projects/app-icon/${encodeURIComponent(r.name)}?${q}`
|
|
323
335
|
}
|
|
324
336
|
/** drawn plates, by url: a page load asks for every repo's at once */
|
|
325
337
|
const plates = new Map<string, Promise<Buffer>>()
|
|
338
|
+
const identities = identityCache()
|
|
339
|
+
let idDir: string | null | undefined
|
|
340
|
+
const readIds = async () => identities(idDir === undefined ? (idDir = await identitiesDir(d.root)) : idDir)
|
|
326
341
|
|
|
327
342
|
async function measure(): Promise<ProjectsAnswer> {
|
|
328
343
|
const t0 = performance.now()
|
|
329
|
-
const house = houseRepos(d.root, userHome)
|
|
344
|
+
const house = loopWatch.timed('projects: house repos', () => houseRepos(d.root, userHome))
|
|
330
345
|
home = house.home
|
|
331
346
|
if (house.index == null) warnOnce('house', `WARN project gutter: ${home} includes no house wiki index, so no sibling shares one and the gutter is empty`)
|
|
332
347
|
repos = house.repos
|
|
333
348
|
archivedRepos = house.archived
|
|
334
|
-
const [open, cwds, facts] = await Promise.all([
|
|
335
|
-
|
|
349
|
+
const [open, cwds, facts] = await Promise.all([
|
|
350
|
+
loopWatch.spanned('projects: vscode', vscodeFolders),
|
|
351
|
+
loopWatch.spanned('projects: sessions', sessionCwds),
|
|
352
|
+
loopWatch.spanned('projects: git', () => gitFacts(repos.map((r) => r.path))),
|
|
353
|
+
])
|
|
354
|
+
const transcripts = loopWatch.timed('projects: transcripts', () => lastSessionAt(transcriptRoots(), repos.map((r) => r.path)))
|
|
336
355
|
const counts = cwds == null ? null : countSessions(cwds, repos.map((r) => r.path))
|
|
337
|
-
const
|
|
356
|
+
const ids = await loopWatch.spanned('projects: ids', readIds)
|
|
357
|
+
// each store read whole once, in steps, before the rows read its waiting cards
|
|
358
|
+
await loopWatch.spanned('projects: review stores', async () => { for (const r of repos) await warmStore(storeDir(r.path)) })
|
|
359
|
+
const projects = repos.map((r, i): ProjectRow => loopWatch.timed(`projects: row ${r.name}`, () => {
|
|
338
360
|
const config = readText(join(r.path, 'repo.config.ts'))
|
|
339
361
|
const pkg = readText(join(r.path, 'package.json'))
|
|
340
362
|
const asks = openAsks(join(r.path, asksDirOf(config, r.path)))
|
|
@@ -360,13 +382,15 @@ export function projectGutter(d: GutterDeps) {
|
|
|
360
382
|
release: facts[i]!.release,
|
|
361
383
|
live: liveUrlOf(config),
|
|
362
384
|
identity: identityOfText(config),
|
|
385
|
+
speaksAs: speakerIdOf(speaksAsOfText(config), ids),
|
|
363
386
|
appIcon: railIconUrl(r, identityOfRoot(r.path)),
|
|
387
|
+
appIconDim: railIconUrl(r, identityOfRoot(r.path), 'dim'),
|
|
364
388
|
activity: lastActivity(facts[i]!.commitAt, lastRunAt(r.path), transcripts.get(r.path)),
|
|
365
389
|
commit: facts[i]!.commitAt,
|
|
366
390
|
}
|
|
367
|
-
})
|
|
391
|
+
}))
|
|
368
392
|
const archived = archivedRepos.map((r) => ({ name: r.name, icon: iconUrl(r) }))
|
|
369
|
-
return { projects: inOrder(projects, parseOrder(readText(orderFile))), archived, ms: Math.round(performance.now() - t0), at: now() }
|
|
393
|
+
return { projects: inOrder(projects, parseOrder(readText(orderFile))), archived, identities: ids.identities.map(railOf), ms: Math.round(performance.now() - t0), at: now() }
|
|
370
394
|
}
|
|
371
395
|
|
|
372
396
|
/** the last answer while it is younger than POLL_MS, one measure otherwise,
|
|
@@ -412,6 +436,13 @@ export function projectGutter(d: GutterDeps) {
|
|
|
412
436
|
headers: { 'content-type': ICON_TYPES[r.icon.split('.').pop()!] ?? 'application/octet-stream', 'cache-control': 'max-age=86400' },
|
|
413
437
|
})
|
|
414
438
|
}
|
|
439
|
+
if (path.startsWith('/api/projects/identity-mark/')) {
|
|
440
|
+
const id = decodeURIComponent(path.slice('/api/projects/identity-mark/'.length))
|
|
441
|
+
const i = (await readIds()).identities.find((x) => x.id === id)
|
|
442
|
+
const file = i == null ? null : markFile(i)
|
|
443
|
+
if (file == null || !existsSync(file)) return new Response(`no mark for the identity ${JSON.stringify(id)}`, { status: 404 })
|
|
444
|
+
return new Response(Bun.file(file), { headers: { 'cache-control': 'max-age=86400' } })
|
|
445
|
+
}
|
|
415
446
|
if (path.startsWith('/api/projects/app-icon/')) {
|
|
416
447
|
if (repos.length === 0) await answer()
|
|
417
448
|
const r = findAny(decodeURIComponent(path.slice('/api/projects/app-icon/'.length)))
|
|
@@ -423,11 +454,12 @@ export function projectGutter(d: GutterDeps) {
|
|
|
423
454
|
const asked = { colorLight: q.get('light') ?? '', colorDark: q.get('dark') ?? '' }
|
|
424
455
|
const id = identityProblem(asked) == null ? asked : identityOfRoot(r.path)
|
|
425
456
|
try {
|
|
426
|
-
|
|
457
|
+
const plate = q.get('plate')
|
|
458
|
+
if (plate === '1' || plate === 'dim') {
|
|
427
459
|
const key = `${r.path}?${q}`
|
|
428
460
|
let png = plates.get(key)
|
|
429
461
|
if (png == null) {
|
|
430
|
-
png = readFile(icon).then(async (b) => (await appIconPngs(b, id, [RAIL_PX], 'plate'))[0]!)
|
|
462
|
+
png = readFile(icon).then(async (b) => (await appIconPngs(b, id, [RAIL_PX], 'plate', { plateAlpha: plate === 'dim' ? DIM_PLATE : 1 }))[0]!)
|
|
431
463
|
plates.set(key, png)
|
|
432
464
|
png.catch(() => plates.delete(key))
|
|
433
465
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// /api/resources.json on the wire: the one flat list a page polls every ten
|
|
2
|
+
// seconds, serialized once per compute and answered 304 while the page holds
|
|
3
|
+
// it. A test file carries its last run only: its page reads the whole run
|
|
4
|
+
// list from /api/test-runs.json when it opens (the history is half the bytes
|
|
5
|
+
// of a big repo).
|
|
6
|
+
//
|
|
7
|
+
// the one constraint a reader breaks first: the ETag covers the live parts
|
|
8
|
+
// (the plan rows, the hub problems) too, so a moved plan is never a 304.
|
|
9
|
+
import type { Resource } from '../collections/collection-types.ts'
|
|
10
|
+
|
|
11
|
+
/** the list as the page receives it: a test file's runs cut to the last one */
|
|
12
|
+
export const leanResources = (rs: readonly Resource[]): Resource[] =>
|
|
13
|
+
rs.map((r) => (r.test == null || r.test.runs.length <= 1 ? r : { ...r, test: { ...r.test, runs: r.test.runs.slice(0, 1) } }))
|
|
14
|
+
|
|
15
|
+
type Rows = { collections: unknown; resources: Resource[] }
|
|
16
|
+
type Wire = { head: string; tag: string }
|
|
17
|
+
|
|
18
|
+
/** the serialized list, once per computed answer */
|
|
19
|
+
const wires = new WeakMap<Rows, Wire>()
|
|
20
|
+
const wireOf = (rows: Rows): Wire => {
|
|
21
|
+
let w = wires.get(rows)
|
|
22
|
+
if (w == null) {
|
|
23
|
+
const head = JSON.stringify({ collections: rows.collections, resources: leanResources(rows.resources) }).slice(0, -1)
|
|
24
|
+
w = { head, tag: Bun.hash(head).toString(36) }
|
|
25
|
+
wires.set(rows, w)
|
|
26
|
+
}
|
|
27
|
+
return w
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** the answer, 304 when the page sent the same tag; gzipped (and kept for the next page) when it takes it */
|
|
31
|
+
export function resourcesAnswer(req: Request, rows: Rows, live: Record<string, unknown>, zipped: { tag: string; body: Uint8Array<ArrayBuffer> } | null): { res: Response; zipped: typeof zipped } {
|
|
32
|
+
const w = wireOf(rows)
|
|
33
|
+
const tail = JSON.stringify(live).slice(1)
|
|
34
|
+
const tag = `"${w.tag}-${Bun.hash(tail).toString(36)}"`
|
|
35
|
+
const headers = { 'Content-Type': 'application/json', ETag: tag, 'Cache-Control': 'no-cache', Vary: 'Accept-Encoding' }
|
|
36
|
+
if (req.headers.get('If-None-Match') === tag) return { res: new Response(null, { status: 304, headers: { ETag: tag, 'Cache-Control': 'no-cache' } }), zipped }
|
|
37
|
+
const text = tail === '}' ? `${w.head}}` : `${w.head},${tail}`
|
|
38
|
+
if (!/\bgzip\b/.test(req.headers.get('Accept-Encoding') ?? '')) return { res: new Response(text, { headers }), zipped }
|
|
39
|
+
const z = zipped?.tag === tag ? zipped : { tag, body: Bun.gzipSync(new TextEncoder().encode(text)) }
|
|
40
|
+
return { res: new Response(z.body, { headers: { ...headers, 'Content-Encoding': 'gzip' } }), zipped: z }
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** one test file's whole run list, newest first, for its page */
|
|
44
|
+
export function testRunsAnswer(rows: Rows, file: string | null): Response {
|
|
45
|
+
const r = rows.resources.find((x) => x.test != null && x.test.file === file)
|
|
46
|
+
if (r?.test == null) return new Response(`no test file ${file ?? '(none named)'} in this repo`, { status: 404 })
|
|
47
|
+
return Response.json({ file, runs: r.test.runs }, { headers: { 'Cache-Control': 'no-store' } })
|
|
48
|
+
}
|
package/src/serve/run-lanes.ts
CHANGED
|
@@ -108,10 +108,13 @@ export function runKey(kind: string, opts: Record<string, unknown>): string {
|
|
|
108
108
|
return `${kind} ${JSON.stringify(sorted)}`
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
/** a
|
|
112
|
-
* and the hooks
|
|
113
|
-
|
|
114
|
-
|
|
111
|
+
/** a WHOLE gate whose repair pass runs (core/fix-scope.ts): its tree wide
|
|
112
|
+
* fixers and the hooks run there. A narrowed run repairs only what its checks
|
|
113
|
+
* own, under the fix lease, so it never makes other lanes wait */
|
|
114
|
+
export const writesTree = (opts: Record<string, unknown>): boolean => {
|
|
115
|
+
const onlyIds = Array.isArray(opts.onlyIds) ? (opts.onlyIds as string[]) : undefined
|
|
116
|
+
return (onlyIds ?? []).length === 0 && fixPassRuns({ fix: typeof opts.fix === 'boolean' ? opts.fix : undefined, onlyIds })
|
|
117
|
+
}
|
|
115
118
|
|
|
116
119
|
/** HEAD, what git status lists, and the stat of each listed path, hashed:
|
|
117
120
|
* equal stamps mean no tracked or untracked file moved in between. Null
|
package/src/serve/same-origin.ts
CHANGED
|
@@ -10,7 +10,7 @@ export function sameOrigin(req: Request): boolean {
|
|
|
10
10
|
if (site != null && site !== 'same-origin' && site !== 'none') return false
|
|
11
11
|
const origin = req.headers.get('origin')
|
|
12
12
|
if (origin == null) return true
|
|
13
|
-
// behind a proxy that frames the page under its own origin (
|
|
13
|
+
// behind a proxy that frames the page under its own origin (a project's admin), the host the browser asked is the
|
|
14
14
|
// proxy's, which it passes on. A browser cannot forge the header: a page of another site that sets it is held at
|
|
15
15
|
// its preflight, which this server never answers
|
|
16
16
|
const host = req.headers.get('x-forwarded-host') ?? new URL(req.url).host
|
package/src/serve/serve-hub.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { pageOf, searchWiki } from 'rvlib-shipkit/src/wiki/graph-pages.ts'
|
|
|
11
11
|
import { graphRoutes } from 'rvlib-shipkit/src/wiki/serve-graph.ts'
|
|
12
12
|
import type { StudioRoutes } from '../assets/server/studio-server.ts'
|
|
13
13
|
import { comfyBoxUp, type ComfyBox, type ComfyPanelUp } from '../comfy/comfy-panel.ts'
|
|
14
|
-
import { appendAskRemark, appendAssetNote,
|
|
14
|
+
import { appendAskRemark, appendAssetNote, askDone, askProof } from '../collections/actions.ts'
|
|
15
15
|
import { brokenRow, projectResources, type Collection, type Instance, type NeedItem, type Resource } from '../collections/collection-types.ts'
|
|
16
16
|
import type { CheckEvent } from '../core/run-check.ts'
|
|
17
17
|
import { configDirty, readGateBlock, writeGateBlock, type GateEdit } from '../core/when-block.ts'
|
|
@@ -33,9 +33,14 @@ import { sameOrigin } from './same-origin.ts'
|
|
|
33
33
|
import { LAYOUT } from '../core/layout.ts'
|
|
34
34
|
import { heldNow, heldText } from '../core/last-good.ts'
|
|
35
35
|
import { WarmCell } from './warm-cell.ts'
|
|
36
|
+
import { resourcesAnswer, testRunsAnswer } from './resources-wire.ts'
|
|
36
37
|
import { readmeRoutes } from './readme-route.ts'
|
|
37
38
|
import { reviewRoutes } from '../review/routes.ts'
|
|
39
|
+
import { veilleRoutes } from '../veille/routes.ts'
|
|
40
|
+
import { storesRoutes } from '../stores/routes.ts'
|
|
41
|
+
import { socialRoutes } from '../social/routes.ts'
|
|
38
42
|
import { embedRoute } from './embed.ts'
|
|
43
|
+
import { pagesRoutes } from '../pages/routes.ts'
|
|
39
44
|
|
|
40
45
|
export { sameOrigin }
|
|
41
46
|
|
|
@@ -185,11 +190,13 @@ export function hubHandler(d: HubDeps, o: { base?: string; projects?: Gutter } =
|
|
|
185
190
|
await d.refresh?.()
|
|
186
191
|
const cols = d.collections()
|
|
187
192
|
return { collections: cols.map((c) => ({ id: c.id, title: c.title, media: c.media })), resources: await projectResources(cols, d.hubProblems?.collector) }
|
|
188
|
-
}, warmOpts)
|
|
193
|
+
}, { ...warmOpts, what: `warm rows: ${d.name}` })
|
|
189
194
|
// the run record and the config are all it reads, and the stamp sees both
|
|
190
|
-
const timeline = d.timeline == null ? null : new WarmCell(d.timeline, { stamp: d.stamp })
|
|
191
|
-
const graphs = new Map(d.graphs.map((g) => [g.id, new WarmCell(async () => g.load(), { maxAgeMs: WARM_MAX_AGE_MS })]))
|
|
195
|
+
const timeline = d.timeline == null ? null : new WarmCell(d.timeline, { stamp: d.stamp, what: `warm timeline: ${d.name}` })
|
|
196
|
+
const graphs = new Map(d.graphs.map((g) => [g.id, new WarmCell(async () => g.load(), { maxAgeMs: WARM_MAX_AGE_MS, what: `warm graph ${g.id}: ${d.name}` })]))
|
|
192
197
|
const fresh = (req: Request): boolean => new URL(req.url).searchParams.get('fresh') === '1'
|
|
198
|
+
/** the last gzipped list, answered again to the next page while it holds */
|
|
199
|
+
let zipped: Parameters<typeof resourcesAnswer>[3] = null
|
|
193
200
|
return {
|
|
194
201
|
tools,
|
|
195
202
|
invalidate: () => {
|
|
@@ -246,13 +253,11 @@ export function hubHandler(d: HubDeps, o: { base?: string; projects?: Gutter } =
|
|
|
246
253
|
// under its sections, and a second endpoint would be a
|
|
247
254
|
// second answer to drift from this one
|
|
248
255
|
const r = await rows.get({ fresh: fresh(req) })
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
planned: d.planned?.() ?? null,
|
|
253
|
-
hub: [...(d.hubProblems?.list() ?? []), ...heldProblem()],
|
|
254
|
-
})
|
|
256
|
+
const a = resourcesAnswer(req, r, { planned: d.planned?.() ?? null, hub: [...(d.hubProblems?.list() ?? []), ...heldProblem()] }, zipped)
|
|
257
|
+
zipped = a.zipped
|
|
258
|
+
return a.res
|
|
255
259
|
}
|
|
260
|
+
if (path === '/api/test-runs.json') return testRunsAnswer(await rows.get({}), new URL(req.url).searchParams.get('file'))
|
|
256
261
|
// the previous address, answered while pages opened before the
|
|
257
262
|
// tree are still on screen
|
|
258
263
|
if (path === '/api/collections.json') {
|
|
@@ -275,13 +280,6 @@ export function hubHandler(d: HubDeps, o: { base?: string; projects?: Gutter } =
|
|
|
275
280
|
const b = (await req.json()) as Record<string, string>
|
|
276
281
|
if (path === '/api/act/ask-done') askDone(d.root, d.asksDir, b.file ?? '')
|
|
277
282
|
else if (path === '/api/act/ask-proof') askProof(d.root, d.asksDir, b.file ?? '', b.url ?? '')
|
|
278
|
-
else if (path === '/api/act/post-pick') pickPostVariant(d.root, b.channel ?? '', b.file ?? '')
|
|
279
|
-
else if (path === '/api/act/post-posted') {
|
|
280
|
-
const rating = b.rating != null ? Number(b.rating) : undefined
|
|
281
|
-
if (rating != null && (!Number.isFinite(rating) || rating < 1 || rating > 5)) return new Response('rating must be 1-5', { status: 400 })
|
|
282
|
-
markPosted(d.root, b.channel ?? '', b.file ?? '', b.url ?? '', rating)
|
|
283
|
-
}
|
|
284
|
-
else if (path === '/api/act/post-feedback') appendPostFeedback(d.root, b.channel ?? '', b.file ?? '', b.text ?? '')
|
|
285
283
|
else if (path === '/api/act/remark') {
|
|
286
284
|
// ONE remark verb, routed by collection: a remark
|
|
287
285
|
// lands in the item's own truth file
|
|
@@ -289,7 +287,6 @@ export function hubHandler(d: HubDeps, o: { base?: string; projects?: Gutter } =
|
|
|
289
287
|
if (text === '') return new Response('empty remark', { status: 400 })
|
|
290
288
|
if (b.kind === 'ask') appendAskRemark(d.root, d.asksDir, b.file ?? '', text)
|
|
291
289
|
else if (b.kind === 'media') appendAssetNote(d.root, b.id ?? '', text)
|
|
292
|
-
else if (b.kind === 'post') appendPostFeedback(d.root, b.channel ?? '', b.file ?? '', text)
|
|
293
290
|
else return new Response('unknown remark kind', { status: 400 })
|
|
294
291
|
}
|
|
295
292
|
else return new Response('unknown act', { status: 404 })
|
|
@@ -345,12 +342,24 @@ export function hubHandler(d: HubDeps, o: { base?: string; projects?: Gutter } =
|
|
|
345
342
|
// the empty page shows the README, its images served from the repo
|
|
346
343
|
const readme = await readmeRoutes(d.root, path)
|
|
347
344
|
if (readme != null) return readme
|
|
345
|
+
// the repo's own pages: their list, each one proxied from the repo's process (pages/routes.ts)
|
|
346
|
+
const pages = await pagesRoutes(d.root, req, path, srv)
|
|
347
|
+
if (pages != null) return pages
|
|
348
348
|
// the review or trailer page alone, for another tool's frame (embed.ts)
|
|
349
349
|
const embed = await embedRoute(path)
|
|
350
350
|
if (embed != null) return embed
|
|
351
351
|
// the one feedback store and the trailer view (review/routes.ts)
|
|
352
352
|
const review = await reviewRoutes(d.root, req, path)
|
|
353
353
|
if (review != null) return review
|
|
354
|
+
// the Veille of the identity this repo speaks as (veille/routes.ts)
|
|
355
|
+
const veille = await veilleRoutes(d.root, req, path)
|
|
356
|
+
if (veille != null) return veille
|
|
357
|
+
// the store pages' desk (stores/routes.ts)
|
|
358
|
+
const stores = await storesRoutes(d.root, req, path)
|
|
359
|
+
if (stores != null) return stores
|
|
360
|
+
// the Communications and Social desks (social/routes.ts)
|
|
361
|
+
const social = await socialRoutes(d.root, req, path)
|
|
362
|
+
if (social != null) return social
|
|
354
363
|
if (path === '/api/status.json') {
|
|
355
364
|
const p = join(d.root, LAYOUT.status)
|
|
356
365
|
return Response.json({ statusMd: existsSync(p) ? await Bun.file(p).text() : null })
|
|
@@ -7,6 +7,8 @@ import { join } from 'path'
|
|
|
7
7
|
import { GENERATED_IGNORE_LINES } from '../rules/untrack-generated.ts'
|
|
8
8
|
import { gitBin } from '../core/git-bin.ts'
|
|
9
9
|
import { LAYOUT } from '../core/layout.ts'
|
|
10
|
+
import { followTree, treeMoved } from '../core/tree-rev.ts'
|
|
11
|
+
import { yieldLoop } from '../core/loop-watch.ts'
|
|
10
12
|
|
|
11
13
|
/** every path a run of the gate or the hub itself writes, whatever the repo
|
|
12
14
|
* ignores: the status files, the per run logs under the scratch dir, an atomic write's
|
|
@@ -58,8 +60,14 @@ export function isRefMove(rel: string): boolean {
|
|
|
58
60
|
* or untracked and not ignored. What the gate itself writes (GATE_WRITES,
|
|
59
61
|
* the ledger in .git) never counts, ignored or not, so a run never triggers
|
|
60
62
|
* the next one */
|
|
61
|
-
export function watchTracked(root: string,
|
|
63
|
+
export function watchTracked(root: string, onOwnerEdit: () => void, o: { ignored?: (paths: string[]) => Promise<Set<string>>; onError?: (e: Error) => void } = {}): { close: () => void; error: string | null } {
|
|
62
64
|
const ignored = o.ignored ?? ((paths: string[]) => gitIgnored(root, paths))
|
|
65
|
+
// the tree's revision (core/tree-rev.ts) moves with every edit this watch hears, and is gone with the watch
|
|
66
|
+
let unfollow: (() => void) | null = null
|
|
67
|
+
const onChange = (): void => {
|
|
68
|
+
treeMoved(root)
|
|
69
|
+
onOwnerEdit()
|
|
70
|
+
}
|
|
63
71
|
const pending = new Set<string>()
|
|
64
72
|
let flushing = false
|
|
65
73
|
const flush = async (): Promise<void> => {
|
|
@@ -89,11 +97,21 @@ export function watchTracked(root: string, onChange: () => void, o: { ignored?:
|
|
|
89
97
|
})
|
|
90
98
|
// a watcher that dies mid session (the tree was removed, a limit hit)
|
|
91
99
|
// says so, rather than crashing the hub or going quiet
|
|
92
|
-
w.on('error', (e) =>
|
|
100
|
+
w.on('error', (e) => {
|
|
101
|
+
unfollow?.()
|
|
102
|
+
o.onError?.(e instanceof Error ? e : new Error(String(e)))
|
|
103
|
+
})
|
|
104
|
+
unfollow = followTree(root)
|
|
93
105
|
} catch (e) {
|
|
94
106
|
error = e instanceof Error ? e.message : String(e)
|
|
95
107
|
}
|
|
96
|
-
return {
|
|
108
|
+
return {
|
|
109
|
+
close: () => {
|
|
110
|
+
unfollow?.()
|
|
111
|
+
w?.close()
|
|
112
|
+
},
|
|
113
|
+
error,
|
|
114
|
+
}
|
|
97
115
|
}
|
|
98
116
|
|
|
99
117
|
/** did the owner edit anything after `since`: a tracked file, or an untracked
|
|
@@ -112,7 +130,10 @@ export async function movedSince(root: string, since: number): Promise<boolean>
|
|
|
112
130
|
const later = (rel: string): boolean => {
|
|
113
131
|
try { return statSync(join(root, rel)).mtimeMs > since } catch { return false }
|
|
114
132
|
}
|
|
133
|
+
let n = 0
|
|
115
134
|
for (const rel of out.split('\0')) {
|
|
135
|
+
// a stat a file over tens of thousands: the loop is given back between two thousand of them
|
|
136
|
+
if (++n % 2_000 === 0) await yieldLoop()
|
|
116
137
|
if (rel === '' || rel.split('/').includes('node_modules') || isGateWrite(rel)) continue
|
|
117
138
|
if (later(rel)) return true
|
|
118
139
|
}
|
package/src/serve/warm-cell.ts
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
// changed the truth (an act, the end of a run) asks for `fresh`, which waits
|
|
10
10
|
// on a compute that started after its call.
|
|
11
11
|
|
|
12
|
+
import { loopWatch } from '../core/loop-watch.ts'
|
|
13
|
+
|
|
12
14
|
/** a cell read within this long has a reader: a save recomputes it in the
|
|
13
15
|
* background. Past it, nothing recomputes until a reader asks */
|
|
14
16
|
export const WARM_WATCH_MS = 30_000
|
|
@@ -25,6 +27,8 @@ export type WarmCellOpts = {
|
|
|
25
27
|
* nothing said it moved: what no watch sees (a clock, another repo) */
|
|
26
28
|
maxAgeMs?: number
|
|
27
29
|
now?: () => number
|
|
30
|
+
/** the span a compute carries on the loop watch (core/loop-watch.ts), so a stall names it */
|
|
31
|
+
what?: string
|
|
28
32
|
}
|
|
29
33
|
|
|
30
34
|
export class WarmCell<T> {
|
|
@@ -54,7 +58,7 @@ export class WarmCell<T> {
|
|
|
54
58
|
const p = (async (): Promise<T> => {
|
|
55
59
|
try {
|
|
56
60
|
// never synchronously: `running` is set before this settles
|
|
57
|
-
const v = await Promise.resolve().then(() => this.compute())
|
|
61
|
+
const v = await Promise.resolve().then(() => (this.o.what == null ? this.compute() : loopWatch.spanned(this.o.what, () => this.compute())))
|
|
58
62
|
this.value = { v, at: this.now(), stamp }
|
|
59
63
|
return v
|
|
60
64
|
} finally {
|
package/src/shipkit-files.ts
CHANGED
|
@@ -11,16 +11,26 @@
|
|
|
11
11
|
// review({...}) the repo's parts of the review store: its subject
|
|
12
12
|
// kinds, topics, sources, auto rules, the dispatcher
|
|
13
13
|
// (review/unit.ts)
|
|
14
|
+
// social({...}) the repo's parts of the social desks: its topics,
|
|
15
|
+
// its articles and their preview (social/unit.ts)
|
|
16
|
+
// stores({...}) the repo's parts of the stores desk: extra texts,
|
|
17
|
+
// the account's ask, the commands that make its
|
|
18
|
+
// pictures again (stores/unit.ts)
|
|
19
|
+
// site({...}) the repo's parts of its identity's site desk: its
|
|
20
|
+
// pages, preview, deploy, what changed (site/unit.ts)
|
|
14
21
|
//
|
|
15
22
|
// the one constraint a reader breaks first: every kind is IMPORTED by the
|
|
16
23
|
// process that reads it (discovery, pm's config child, the daemon), so a file
|
|
17
24
|
// keeps its top level cheap and puts heavy work inside a function.
|
|
18
25
|
import { check, type CheckDef } from './check.ts'
|
|
19
26
|
import { review, type AutoRule, type KindDef, type ReviewDef, type ReviewSource, type ReviewUnit } from './review/unit.ts'
|
|
27
|
+
import { site, type SiteDef, type SiteUnit } from './site/unit.ts'
|
|
28
|
+
import { social, type SocialDef, type SocialUnit } from './social/unit.ts'
|
|
29
|
+
import { stores, type StoresDef, type StoresUnit } from './stores/unit.ts'
|
|
20
30
|
import { trailer, type TrailerDef, type TrailerUnit } from './trailer/adapter.ts'
|
|
21
31
|
|
|
22
|
-
export { check, review, trailer }
|
|
23
|
-
export type { AutoRule, KindDef, ReviewDef, ReviewSource, ReviewUnit, TrailerDef, TrailerUnit }
|
|
32
|
+
export { check, review, site, social, stores, trailer }
|
|
33
|
+
export type { AutoRule, KindDef, ReviewDef, ReviewSource, ReviewUnit, SiteDef, SiteUnit, SocialDef, SocialUnit, StoresDef, StoresUnit, TrailerDef, TrailerUnit }
|
|
24
34
|
|
|
25
35
|
/** one button beside a global process: a command, or a function of the file */
|
|
26
36
|
export type ProcessAction = {
|
|
@@ -77,7 +87,7 @@ export type WidgetDef = {
|
|
|
77
87
|
export type GlobalProcessUnit = GlobalProcessDef & { kind: 'globalProcess' }
|
|
78
88
|
export type WidgetUnit = WidgetDef & { kind: 'widget' }
|
|
79
89
|
|
|
80
|
-
export const UNIT_KINDS = ['globalProcess', 'widget', 'trailer', 'review'] as const
|
|
90
|
+
export const UNIT_KINDS = ['globalProcess', 'widget', 'trailer', 'review', 'stores', 'social', 'site', 'page'] as const
|
|
81
91
|
|
|
82
92
|
const KEBAB = /^[a-z0-9][a-z0-9-]*$/
|
|
83
93
|
const words = (v: unknown): boolean => Array.isArray(v) && v.length > 0 && v.every((w) => typeof w === 'string')
|
|
@@ -132,7 +142,8 @@ export function widget(d: WidgetDef): WidgetUnit {
|
|
|
132
142
|
|
|
133
143
|
/** the kind a default export says it is: a unit, else a check */
|
|
134
144
|
export function unitKind(d: unknown): (typeof UNIT_KINDS)[number] | 'check' {
|
|
135
|
-
|
|
145
|
+
// a repo's pages may come as one array (src/pages/unit.ts)
|
|
146
|
+
const k = Array.isArray(d) && d.length > 0 && d.every((u) => (u as { kind?: unknown } | null)?.kind === 'page') ? 'page' : (d as { kind?: unknown } | null)?.kind
|
|
136
147
|
return UNIT_KINDS.includes(k as (typeof UNIT_KINDS)[number]) ? (k as (typeof UNIT_KINDS)[number]) : 'check'
|
|
137
148
|
}
|
|
138
149
|
|
package/src/shipkit.ts
CHANGED
|
@@ -20,7 +20,6 @@ export { resolveHubDeps, defaultHubPort, baseWikiRoot, loadHub } from './serve/h
|
|
|
20
20
|
export { projectNeeds, redCount } from './collections/collection-types.ts'
|
|
21
21
|
export type { Collection, Instance, NeedItem, NeedSeverity, CurationVerb } from './collections/collection-types.ts'
|
|
22
22
|
export { buildCollections } from './collections/providers.ts'
|
|
23
|
-
export { socialPostsCollection, listPosts } from './collections/posts.ts'
|
|
24
23
|
// units — the ONE discovery every release surface reads (drift
|
|
25
24
|
// probes, per-unit tests, per-unit typecheck, the stranded-tag probe)
|
|
26
25
|
export { resolveUnits, releaseOrder, unitById, renderTag, tagGlobs, prepublishScripts, unitPrepublishScripts } from './release/units.ts'
|