rvlib-shipkit 2.12.0 → 2.14.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 +75 -21
- package/README.md +1 -1
- package/package.json +4 -2
- package/src/agent-time/store.ts +2 -2
- package/src/assets/run-assets.ts +2 -2
- package/src/assets/server/studio-server.ts +27 -23
- package/src/check.ts +4 -4
- package/src/checks/SK001-package-json-shape.check.ts +8 -4
- package/src/checks/SK002-contracts-fulfillness.check.ts +2 -2
- package/src/checks/SK003-claude-md-shape.check.ts +20 -13
- package/src/checks/SK004-gitignore-policy.check.ts +45 -6
- package/src/checks/SK005-rvlib-versions.check.ts +2 -2
- package/src/checks/SK006-npm-publish-safety.check.ts +3 -3
- package/src/checks/SK007-github-visibility.check.ts +2 -2
- package/src/checks/SK008-reviewer-agent.check.ts +3 -3
- package/src/checks/SK010-undeclared-unit.check.ts +2 -2
- package/src/checks/SK011-sibling-unit-ranges.check.ts +2 -2
- package/src/checks/SK012-config-barrel-import.check.ts +2 -2
- package/src/checks/SK013-one-way-in-policy.check.ts +2 -2
- package/src/checks/SK015-nested-repo.check.ts +3 -3
- package/src/checks/SK016-legacy-check-shapes.check.ts +2 -2
- package/src/checks/SK017-vscode-hub-task.check.ts +2 -2
- package/src/checks/SK018-test-files-run.check.ts +2 -2
- package/src/checks/SK019-tests-run-in-units.check.ts +2 -2
- package/src/checks/SK020-self-spawning-check.check.ts +2 -2
- package/src/checks/SK022-machine-runs-the-pin.check.ts +2 -2
- package/src/checks/SK024-identity-colors.check.ts +1 -1
- package/src/checks/SK025-release-drift.check.ts +2 -2
- package/src/checks/SK026-asks-autoclose.check.ts +2 -2
- package/src/checks/SK027-agent-wiki-links.check.ts +8 -2
- package/src/checks/SK028-readme.check.ts +2 -2
- package/src/checks/SK029-explicit-check-files.check.ts +3 -3
- package/src/checks/SK030-cache-audit.check.ts +7 -5
- package/src/checks/SK031-trace-audit.check.ts +7 -7
- package/src/checks/SK032-ignored-inputs.check.ts +3 -3
- package/src/checks/SK033-global-contribution.check.ts +11 -4
- package/src/checks/SK034-commit-gates-armed.check.ts +2 -2
- package/src/checks/SK035-public-clean.check.ts +46 -0
- package/src/checks/SK036-draft-media-size.check.ts +28 -0
- package/src/checks/SK037-keyword-additions.check.ts +43 -0
- package/src/cli/cmd_Backup.ts +152 -0
- package/src/cli/cmd_Ci.ts +8 -11
- package/src/cli/cmd_Commands.ts +4 -4
- package/src/cli/cmd_ConfigKeys.ts +2 -2
- package/src/cli/cmd_Drill.ts +145 -0
- package/src/cli/cmd_Home.ts +50 -3
- package/src/cli/cmd_Init.ts +1 -1
- package/src/cli/cmd_Media.ts +10 -8
- package/src/cli/cmd_Mv.ts +14 -7
- package/src/cli/cmd_Review.ts +6 -4
- package/src/cli/cmd_Shot.ts +5 -2
- package/src/cli/cmd_Smoke.ts +5 -2
- package/src/cli/cmd_Social.ts +226 -0
- package/src/cli/cmd_Sound.ts +1 -1
- package/src/cli/cmd_Start.ts +1 -1
- package/src/cli/cmd_Time.ts +1 -1
- package/src/cli/cmd_TraceAudit.ts +6 -6
- package/src/cli/cmd_Trailer.ts +7 -4
- package/src/cli/cmd_Veille.ts +173 -0
- package/src/cli/cmd_When.ts +2 -2
- package/src/cli/family-pages.ts +19 -16
- 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 +12 -3
- package/src/collections/providers.ts +4 -4
- package/src/collections/review.ts +3 -2
- package/src/collections/tests.ts +19 -8
- package/src/comfy/comfy-panel.ts +2 -2
- 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/contracts/manifests/discord.contract.ts +1 -1
- package/src/contracts/manifests/identity.contract.ts +1 -1
- package/src/contracts/manifests/itch.contract.ts +1 -1
- package/src/contracts/manifests/steam.contract.ts +1 -1
- package/src/core/agent-dir-at.ts +12 -0
- package/src/core/agent-dir.ts +16 -0
- package/src/core/app-icon.ts +9 -3
- package/src/core/budget.ts +1 -1
- package/src/core/bun-builtins.ts +2 -2
- package/src/core/canonical-scripts.ts +2 -2
- package/src/core/discover-checks.ts +38 -6
- 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/global-contribution.ts +4 -1
- package/src/core/ignored-block.ts +1 -1
- package/src/core/ignored-inputs.ts +3 -2
- 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/motherhome.ts +2 -2
- package/src/core/one-way-in-policy.ts +34 -26
- package/src/core/run-ci.ts +9 -11
- package/src/core/run-fixers.ts +9 -9
- package/src/core/runs-matrix.ts +1 -1
- package/src/core/slots.ts +30 -0
- package/src/core/trace-audit.ts +50 -9
- 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 +44 -8
- package/src/home/gui-app/ShipkitGui.swift +91 -2
- package/src/home/home-routes.ts +22 -15
- package/src/home/hubs.ts +10 -3
- package/src/home/inbox-shape.ts +54 -5
- package/src/home/inbox.ts +17 -2
- package/src/home/lib-watch.ts +10 -3
- package/src/home/machine-stores.ts +15 -29
- package/src/home/pm-config.ts +4 -1
- package/src/home/pm-inputs.ts +2 -0
- package/src/home/resources.ts +7 -2
- package/src/home/run-daemon.ts +15 -18
- package/src/home/run-pm.ts +3 -1
- package/src/home/serve-daemon.ts +4 -3
- package/src/home/serve-web.ts +104 -1
- package/src/hooks/commit-message.ts +29 -20
- package/src/hooks/hook-gates.ts +1 -1
- package/src/hooks/leak-guard.ts +69 -9
- package/src/hooks/run-hooks.ts +18 -22
- 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 +3 -3
- 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 +3 -2
- 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 +1 -1
- package/src/media-store/daemon.ts +56 -70
- package/src/media-store/db.ts +1 -1
- package/src/media-store/fact.ts +1 -1
- package/src/media-store/hand.ts +1 -1
- package/src/media-store/kind.ts +1 -1
- package/src/media-store/purge.ts +1 -1
- package/src/media-store/put.ts +5 -3
- package/src/media-store/remote.ts +1 -1
- package/src/media-store/space.ts +24 -5
- package/src/mv/mv-md.ts +63 -22
- 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 +319 -0
- package/src/release/published-here.ts +22 -0
- package/src/release/run-bump.ts +3 -2
- package/src/release/run-release.ts +7 -4
- package/src/repo-config.ts +71 -13
- package/src/review/anim.ts +1 -1
- package/src/review/auto.ts +1 -1
- package/src/review/cells.ts +15 -1
- package/src/review/format.ts +2 -2
- package/src/review/http.ts +16 -2
- package/src/review/marks.ts +1 -1
- package/src/review/media-kind.ts +1 -1
- package/src/review/media-read.ts +1 -1
- package/src/review/model.ts +27 -6
- package/src/review/notes.ts +125 -0
- package/src/review/previews.ts +1 -1
- package/src/review/project.ts +7 -39
- package/src/review/role.ts +1 -1
- package/src/review/routes.ts +18 -14
- package/src/review/store.ts +42 -2
- package/src/review/threads.ts +1 -1
- package/src/review/trailer-desk.ts +3 -3
- package/src/review/trailer-media.ts +8 -5
- package/src/review/trailer-model.ts +1 -1
- package/src/review/trailer-routes.ts +1 -1
- package/src/review/trailer-shots.ts +22 -5
- package/src/review/unit.ts +2 -2
- package/src/scaffold/files/agent-handoff.md +3 -0
- package/src/scaffold/files/agent-index.md +4 -12
- package/src/scaffold/files/tsconfig.json +1 -1
- package/src/scaffold/project-scaffold.ts +6 -5
- package/src/serve/embed.ts +2 -2
- package/src/serve/hub-app/check-words.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 +32 -8
- 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 +51 -7
- 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 +353 -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 +60 -7
- package/src/serve/hub-app/inbox-view.tsx +49 -7
- package/src/serve/hub-app/inbox.css +12 -1
- package/src/serve/hub-app/index.html +3 -0
- package/src/serve/hub-app/kept-cols.tsx +30 -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-svc.ts +1 -1
- 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 +76 -20
- package/src/serve/hub-app/review/review-board.tsx +1 -1
- package/src/serve/hub-app/review/review-cells.tsx +6 -5
- package/src/serve/hub-app/review/review-kit.ts +30 -7
- package/src/serve/hub-app/review/review-page.tsx +6 -5
- package/src/serve/hub-app/review/review-st.ts +34 -15
- package/src/serve/hub-app/review/review-thread.tsx +63 -14
- package/src/serve/hub-app/review/review-views.tsx +133 -51
- package/src/serve/hub-app/review/thread-st.ts +80 -37
- package/src/serve/hub-app/review/trailer-page.tsx +7 -5
- package/src/serve/hub-app/review/trailer-st.ts +1 -1
- package/src/serve/hub-app/review.css +26 -9
- 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 +330 -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 +681 -0
- package/src/serve/hub-app/social/social-st.ts +1014 -0
- package/src/serve/hub-app/social.css +289 -0
- package/src/serve/hub-app/stores/stores-page.tsx +312 -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 +515 -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 +20 -11
- 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 +160 -0
- package/src/shot/browser-slot.ts +74 -0
- package/src/shot/client.ts +42 -7
- package/src/shot/clip-encoder.ts +108 -24
- package/src/shot/film-box.ts +292 -0
- package/src/shot/shooter.ts +71 -17
- 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/card-drafts.ts +24 -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 +332 -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 +37 -0
- package/src/social/richtext.ts +37 -0
- package/src/social/routes.ts +186 -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 +95 -35
- package/src/suite/suite-cli.ts +44 -10
- package/src/suite/suite-cpu-preload.ts +34 -9
- package/src/trace/tracer.ts +12 -5
- package/src/trailer/adapter.ts +5 -1
- package/src/trailer/build.ts +45 -12
- 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/holes.ts +1 -1
- package/src/trailer/passage.ts +18 -6
- package/src/trailer/plan.ts +74 -3
- package/src/trailer/prune.ts +1 -1
- package/src/trailer/states.ts +1 -1
- package/src/trailer/stitch.ts +67 -26
- package/src/trailer/url.ts +1 -1
- package/src/trailer/versions.ts +24 -0
- package/src/trailer/words.ts +1 -1
- package/src/ts/gate-typecheck.ts +32 -0
- package/src/ts/typecheck-cli.ts +9 -11
- package/src/tui/run-tui.ts +1 -1
- package/src/tui/tui-app.tsx +0 -1
- package/src/tui/tui-store.ts +1 -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
package/src/cli/cmd_Home.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// shipkit pm, daemon, web and gui: the machine's one app. Thin clipanion surface; logic in home/.
|
|
2
2
|
import { Command, Option } from 'clipanion'
|
|
3
3
|
import { LIB_VERSION } from '../core/lib-version.ts'
|
|
4
|
+
import { stampConsole, stampedIo } from '../core/log-stamp.ts'
|
|
4
5
|
import { fileURLToPath } from 'url'
|
|
5
6
|
import { basename } from 'path'
|
|
6
7
|
import { markAutostart } from '../home/autostart.ts'
|
|
@@ -19,6 +20,12 @@ const io = (c: Command) => ({
|
|
|
19
20
|
printErr: (l: string) => c.context.stderr.write(`${l}\n`),
|
|
20
21
|
})
|
|
21
22
|
|
|
23
|
+
/** a long running role's io: its log lines and every console line of the process carry the time */
|
|
24
|
+
const roleIo = (c: Command) => {
|
|
25
|
+
stampConsole()
|
|
26
|
+
return stampedIo(io(c))
|
|
27
|
+
}
|
|
28
|
+
|
|
22
29
|
/** the --port value, undefined when absent, null when it is not a port */
|
|
23
30
|
function portOf(c: Command, raw: string | undefined): number | undefined | null {
|
|
24
31
|
if (raw == null) return undefined
|
|
@@ -48,7 +55,7 @@ export class PmCommand extends Command {
|
|
|
48
55
|
const port = portOf(this, this.port)
|
|
49
56
|
if (port === null) return 1
|
|
50
57
|
if (execPm({ port })) return 0
|
|
51
|
-
return runPm(process.cwd(),
|
|
58
|
+
return runPm(process.cwd(), roleIo(this), { port })
|
|
52
59
|
}
|
|
53
60
|
}
|
|
54
61
|
|
|
@@ -72,7 +79,47 @@ export class DaemonCommand extends Command {
|
|
|
72
79
|
if (port === null) return 1
|
|
73
80
|
// the daemon hosts every hub, image tools included: loaded when it runs
|
|
74
81
|
const { runDaemon } = await import('../home/run-daemon.ts')
|
|
75
|
-
return runDaemon(process.cwd(),
|
|
82
|
+
return runDaemon(process.cwd(), roleIo(this), { port })
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export class DaemonJobCommand extends Command {
|
|
87
|
+
static override paths = [['daemon', 'job']]
|
|
88
|
+
|
|
89
|
+
static override usage = Command.Usage({
|
|
90
|
+
category: 'Serve',
|
|
91
|
+
description: 'a daemon background job now, in this process: backup, retention sweep, media store, global context',
|
|
92
|
+
details: 'what the daemon runs off its loop: it starts each job as this command in a child process, niced, its lines appended to the daemon\'s log, and never runs a job\'s body itself, so a walk, a VACUUM or a hash pass never holds a page. The backup looks every 2 min and runs when its sources moved and held still, the retention sweep runs hourly, the media store passes every 30 s, the global context is written when the stamp of its sources moved. What a job remembers between two runs lives in the machine db. Page: wiki tools/shipkit/home.md, Nothing heavy on the daemon\'s loop',
|
|
93
|
+
examples: [
|
|
94
|
+
['a retention sweep now', 'sk daemon job "retention sweep"'],
|
|
95
|
+
['one media store pass', 'sk daemon job "media store"'],
|
|
96
|
+
['the house\'s global context written now', 'sk daemon job "global context"'],
|
|
97
|
+
],
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
id = Option.String({ required: true, name: 'id' })
|
|
101
|
+
|
|
102
|
+
async execute(): Promise<number> {
|
|
103
|
+
const { isJobId, DAEMON_JOBS, runJobBody } = await import('../home/daemon-jobs.ts')
|
|
104
|
+
if (!isJobId(this.id)) {
|
|
105
|
+
this.context.stderr.write(`FAIL: no daemon job ${JSON.stringify(this.id)}: ${DAEMON_JOBS.map((j) => j.id).join(', ')}\n`)
|
|
106
|
+
return 1
|
|
107
|
+
}
|
|
108
|
+
const { homedir } = await import('node:os')
|
|
109
|
+
const { findRepoRoot } = await import('../ts/config.ts')
|
|
110
|
+
// its lines land in the daemon's log: each one stamped and named
|
|
111
|
+
stampConsole()
|
|
112
|
+
const base = stampedIo(io(this))
|
|
113
|
+
const id = this.id
|
|
114
|
+
const named = (l: string): string => (l.includes(`${id}:`) ? l : `${id}: ${l}`)
|
|
115
|
+
const jobIo = { print: (l: string) => base.print(named(l)), printErr: (l: string) => base.printErr(named(l)) }
|
|
116
|
+
try {
|
|
117
|
+
await runJobBody(id, { root: findRepoRoot(process.cwd()), home: homedir(), ...jobIo })
|
|
118
|
+
return 0
|
|
119
|
+
} catch (e) {
|
|
120
|
+
jobIo.printErr(`FAIL: ${(e as Error).message}`)
|
|
121
|
+
return 1
|
|
122
|
+
}
|
|
76
123
|
}
|
|
77
124
|
}
|
|
78
125
|
|
|
@@ -94,7 +141,7 @@ export class WebCommand extends Command {
|
|
|
94
141
|
async execute(): Promise<number> {
|
|
95
142
|
const port = portOf(this, this.port)
|
|
96
143
|
if (port === null) return 1
|
|
97
|
-
return runWeb(
|
|
144
|
+
return runWeb(roleIo(this), { port })
|
|
98
145
|
}
|
|
99
146
|
}
|
|
100
147
|
|
package/src/cli/cmd_Init.ts
CHANGED
|
@@ -13,7 +13,7 @@ export class InitCommand extends Command {
|
|
|
13
13
|
examples: [
|
|
14
14
|
['wire the repo you are standing in', 'sk init'],
|
|
15
15
|
['local git and the first commit, never touch github', 'sk init --no-github'],
|
|
16
|
-
['in-repo-source consumer: scripts run the CLI by path', 'sk init --bin
|
|
16
|
+
['in-repo-source consumer: scripts run the CLI by path', 'sk init --bin packages/rvlib-shipkit/src/cli.ts'],
|
|
17
17
|
],
|
|
18
18
|
})
|
|
19
19
|
|
package/src/cli/cmd_Media.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// sk media: the machine's one media store (media-store/, wiki
|
|
1
|
+
// sk media: the machine's one media store (media-store/, wiki tools/shipkit/media-store.md): what each kind of each repo
|
|
2
2
|
// holds on the disk and in the private Space, every waiting file sent up now, the disk freed of what the Space holds.
|
|
3
3
|
// Every module loads inside execute: the cli registers this file on every `sk` call
|
|
4
4
|
import { Command, Option } from 'clipanion'
|
|
5
5
|
|
|
6
|
-
const DETAILS = `the machine's one media store: every media file a kind names (review: a card's files; trailer: each render's video and strip, a kept version's own) is known by its sha256, goes up to the owner's private Space as <kind>/<sha256>.<ext>, and leaves the disk once the Space holds it and its kind no longer pins it; it comes back on demand. One sqlite index for the machine. Page: wiki
|
|
6
|
+
const DETAILS = `the machine's one media store: every media file a kind names (review: a card's files; trailer: each render's video and strip, a kept version's own) is known by its sha256, goes up to the owner's private Space as <kind>/<sha256>.<ext>, and leaves the disk once the Space holds it and its kind no longer pins it; it comes back on demand. One sqlite index for the machine. Page: wiki tools/shipkit/media-store.md`
|
|
7
7
|
|
|
8
8
|
type Ctx = { stdout: NodeJS.WritableStream; stderr: NodeJS.WritableStream }
|
|
9
9
|
type Kind = import('../media-store/kind.ts').MediaKind
|
|
@@ -78,7 +78,7 @@ export class MediaUploadCommand extends Command {
|
|
|
78
78
|
category: 'Media',
|
|
79
79
|
description: 'every waiting file of the media store up to the Space now: resumable, dedup by sha',
|
|
80
80
|
details: `${DETAILS}\n\nThe files not hashed yet are hashed first. A file the Space already holds (same key, same size) is only marked up. The daemon does the same in the background; this runs it now, to the end.`,
|
|
81
|
-
examples: [['this repo', 'sk media upload'], ['what
|
|
81
|
+
examples: [['this repo', 'sk media upload'], ['what a project would send of its trailers', 'sk media upload --repo my-game --kind trailer --dry']],
|
|
82
82
|
})
|
|
83
83
|
repo = repoOpt()
|
|
84
84
|
kind = kindOpt()
|
|
@@ -117,7 +117,7 @@ export class MediaPurgeCommand extends Command {
|
|
|
117
117
|
category: 'Media',
|
|
118
118
|
description: 'free the disk of media the Space holds, never a file its kind pins or a recent one',
|
|
119
119
|
details: `${DETAILS}\n\nA file goes only when the index says it is up AND a HEAD answers its size AND its kind agrees (review sends an image's previews up first; trailer checks the file hashes to its key), and never while a process holds it open. Kept: what each kind pins (review: an active card; trailer: the newest render of each cut, a render an open frame note was written on) and every file used in the last --older days (14). Oldest first. A purged file comes back on demand. --auto on lets the daemon purge every kind on its own whenever the disk has under 40 GB free, until it is back over; --auto off stops it.`,
|
|
120
|
-
examples: [['what it would free', 'sk media purge --dry'], ['
|
|
120
|
+
examples: [['what it would free', 'sk media purge --dry'], ['a project\'s trailers, every file that would go', 'sk media purge --repo my-game --kind trailer --dry --list'], ['the daemon purges under 40 GB free', 'sk media purge --auto on']],
|
|
121
121
|
})
|
|
122
122
|
repo = repoOpt()
|
|
123
123
|
kind = kindOpt()
|
|
@@ -162,7 +162,7 @@ export class MediaPurgeCommand extends Command {
|
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
const PUT_DETAILS = `The one way an agent of any repo keeps a file in the owner's private Space: never call the Space client directly. Each file is kept by its content as <label>/<sha256>.<ext>, private: its index row (its repo, its place, its original name) first, then the upload, checked by a HEAD of its size; a content the Space already holds is only marked. The object never expires and nothing deletes it from the Space; the file stays on the disk, purgeable by the usual rules (sk media purge). A link is signed on the CDN edge and downloads under the file's name; it lasts at most 7d, the SigV4 limit of a signed URL, and sk media link makes a new one at any time. Page: wiki
|
|
165
|
+
const PUT_DETAILS = `The one way an agent of any repo keeps a file in the owner's private Space: never call the Space client directly. Each file is kept by its content as <label>/<sha256>.<ext>, private: its index row (its repo, its place, its original name) first, then the upload, checked by a HEAD of its size; a content the Space already holds is only marked. The object never expires and nothing deletes it from the Space; the file stays on the disk, purgeable by the usual rules (sk media purge). A link is signed on the CDN edge and downloads under the file's name; it lasts at most 7d, the SigV4 limit of a signed URL, and sk media link makes a new one at any time. Page: wiki tools/shipkit/media-store.md, Put a file from any repo`
|
|
166
166
|
|
|
167
167
|
export class MediaPutCommand extends Command {
|
|
168
168
|
static override paths = [['media', 'put']]
|
|
@@ -229,17 +229,19 @@ export class MediaVersioningCommand extends Command {
|
|
|
229
229
|
static override usage = Command.Usage({
|
|
230
230
|
category: 'Media',
|
|
231
231
|
description: "turn on the Space's versioning: a delete from outside can be undone; --check reads it",
|
|
232
|
-
details: `PutBucketVersioning, then GetBucketVersioning to confirm: an object deleted or overwritten from the DigitalOcean dashboard or by a stray key keeps its older version. DigitalOcean offers it through the S3 API only. Once on, it can only be suspended, never turned off. Page: wiki
|
|
232
|
+
details: `PutBucketVersioning, then GetBucketVersioning to confirm: an object deleted or overwritten from the DigitalOcean dashboard or by a stray key keeps its older version. DigitalOcean offers it through the S3 API only. Once on, it can only be suspended, never turned off. The house key is limited to the bucket's objects and cannot change it: --key names a full access key pair kept once in the keychain for this call. Page: wiki tools/shipkit/media-store.md, Versioning`,
|
|
233
233
|
examples: [
|
|
234
234
|
['turn it on', 'sk media versioning'],
|
|
235
|
+
['turn it on with a one time full access key', 'sk media versioning --key rv/shipkit/spaces-admin'],
|
|
235
236
|
['read it', 'sk media versioning --check'],
|
|
236
237
|
],
|
|
237
238
|
})
|
|
238
239
|
check = Option.Boolean('--check', false, { description: 'read the state, change nothing' })
|
|
240
|
+
key = Option.String('--key', { description: 'the secret holding a full access KEY:SECRET pair, in place of the house key' })
|
|
239
241
|
async execute(): Promise<number> {
|
|
240
242
|
return run(this.context, {}, async (h) => {
|
|
241
|
-
const {
|
|
242
|
-
const { space, why } = await
|
|
243
|
+
const { spaceFromHouse } = await import('../media-store/space.ts')
|
|
244
|
+
const { space, why } = await spaceFromHouse(this.key)
|
|
243
245
|
if (!space) throw new Error(`no Space: ${why}`)
|
|
244
246
|
const before = await space.versioning()
|
|
245
247
|
if (!this.check && before !== 'Enabled') await space.enableVersioning()
|
package/src/cli/cmd_Mv.ts
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
// reference in the code. Renaming used to mean knowing WHICH tool applied,
|
|
5
5
|
// and knowing that is exactly the kind of doubt the toolkit exists to remove.
|
|
6
6
|
import { Command, Option } from 'clipanion'
|
|
7
|
-
import {
|
|
7
|
+
import { readFileSync } from 'fs'
|
|
8
|
+
import { movePage, movePages, parseMoveMap } from '../mv/mv-md.ts'
|
|
8
9
|
import { renameCli } from '../ts/rename.ts'
|
|
9
10
|
|
|
10
11
|
export class MvCommand extends Command {
|
|
@@ -20,17 +21,26 @@ export class MvCommand extends Command {
|
|
|
20
21
|
['apply + one conventional commit', 'sk mv docs/old-name.md docs/new-name.md --commit'],
|
|
21
22
|
['a code file, every import rewritten', 'sk mv src/old-mod.ts src/new-mod.ts --write'],
|
|
22
23
|
['a whole folder', 'sk mv src/old-dir src/new-dir --write'],
|
|
24
|
+
['md pages from a move map, one `<old> <new>` per line', 'sk mv --map moves.txt --write'],
|
|
25
|
+
['a page becomes a topic folder: its asset dir is the folder, the page its index.md', 'sk mv wiki/build/ts.md wiki/patterns/ts/index.md --write'],
|
|
23
26
|
],
|
|
24
27
|
})
|
|
25
28
|
|
|
26
|
-
oldPath = Option.String()
|
|
27
|
-
newPath = Option.String()
|
|
29
|
+
oldPath = Option.String({ required: false })
|
|
30
|
+
newPath = Option.String({ required: false })
|
|
31
|
+
map = Option.String('--map', { description: 'md pages from a file, one `<old> <new>` per line, mv:after once at the end' })
|
|
28
32
|
write = Option.Boolean('--write', false, { description: 'apply (default is a dry run)' })
|
|
29
33
|
commit = Option.Boolean('--commit', false, { description: 'apply + git commit, md pages only (the pre-commit gate still runs)' })
|
|
30
34
|
|
|
31
35
|
async execute(): Promise<number> {
|
|
32
36
|
const write = this.write || this.commit
|
|
37
|
+
const io = { print: (l: string) => this.context.stdout.write(`${l}\n`), printErr: (l: string) => this.context.stderr.write(`${l}\n`) }
|
|
33
38
|
try {
|
|
39
|
+
if (this.map != null) {
|
|
40
|
+
if (this.oldPath != null) { io.printErr('FAIL: --map takes no paths'); return 1 }
|
|
41
|
+
return movePages(process.cwd(), parseMoveMap(readFileSync(this.map, 'utf8')), io, { write: this.write, commit: this.commit })
|
|
42
|
+
}
|
|
43
|
+
if (this.oldPath == null || this.newPath == null) { io.printErr('FAIL: give <oldPath> <newPath>, or --map <file>'); return 1 }
|
|
34
44
|
const isMd = this.oldPath.endsWith('.md') || this.newPath.endsWith('.md')
|
|
35
45
|
if (!isMd) {
|
|
36
46
|
if (this.commit) {
|
|
@@ -43,10 +53,7 @@ export class MvCommand extends Command {
|
|
|
43
53
|
if (!write && code === 0) this.context.stdout.write('note: dry run — pass --write to apply\n')
|
|
44
54
|
return code
|
|
45
55
|
}
|
|
46
|
-
return movePage(process.cwd(), this.oldPath, this.newPath, {
|
|
47
|
-
print: (l) => this.context.stdout.write(`${l}\n`),
|
|
48
|
-
printErr: (l) => this.context.stderr.write(`${l}\n`),
|
|
49
|
-
}, { write: this.write, commit: this.commit })
|
|
56
|
+
return movePage(process.cwd(), this.oldPath, this.newPath, io, { write: this.write, commit: this.commit })
|
|
50
57
|
} catch (e) {
|
|
51
58
|
this.context.stderr.write(`FAIL: ${e instanceof Error ? e.message : String(e)}\n`)
|
|
52
59
|
return 1
|
package/src/cli/cmd_Review.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// sk review: an agent shows the owner something as one card of the one store and reads his answer; a dispatcher routes
|
|
2
|
-
// what he, a player or a rule raised, a worker claims and closes it (review/store.ts, wiki
|
|
2
|
+
// what he, a player or a rule raised, a worker claims and closes it (review/store.ts, wiki tools/shipkit/review.md).
|
|
3
3
|
// Every module loads inside execute: the cli registers this file on every `sk` call
|
|
4
4
|
import { Command, Option } from 'clipanion'
|
|
5
5
|
|
|
6
|
-
const DETAILS = `the one feedback store, .shipkit/review/<id>/: one subject is one card (other angles are views of it, a follow up --supersedes it), he answers it in the hub's review entry (approved, ok with a fix, rejected, archived, rectangles, reactions per view), you read his answer with inbox or watch. What he, a player or a rule raises is an item of the same store: a dispatcher routes it to a topic, a worker claims it and closes it. The repo's review unit names its kinds, topics, sources and rules. SK_AGENT names your lane. Page: wiki
|
|
6
|
+
const DETAILS = `the one feedback store, .shipkit/review/<id>/: one subject is one card (other angles are views of it, a follow up --supersedes it), he answers it in the hub's review entry (approved, ok with a fix, rejected, archived, rectangles, reactions per view), you read his answer with inbox or watch. What he, a player or a rule raises is an item of the same store: a dispatcher routes it to a topic, a worker claims it and closes it. The repo's review unit names its kinds, topics, sources and rules. SK_AGENT names your lane. Page: wiki tools/shipkit/review.md`
|
|
7
7
|
|
|
8
8
|
type Ctx = { stdout: NodeJS.WritableStream; stderr: NodeJS.WritableStream }
|
|
9
9
|
type Unit = import('../review/unit.ts').ReviewUnit
|
|
@@ -844,9 +844,11 @@ export class ReviewAutoCommand extends Command {
|
|
|
844
844
|
return run(this.context, async (h) => {
|
|
845
845
|
const { autoLogDir, nextRun, readAutoLog, runRule } = await import('../review/auto.ts')
|
|
846
846
|
const { readAll } = await import('../review/store.ts')
|
|
847
|
-
const
|
|
847
|
+
const { autoRulesOf } = await import('../veille/auto.ts')
|
|
848
|
+
const { dirname } = await import('node:path')
|
|
849
|
+
const rules = autoRulesOf(dirname(dirname(h.dir)), h.unit)
|
|
848
850
|
if (this.verb === undefined) {
|
|
849
|
-
if (rules.length === 0) h.out("no auto rule: the repo's review unit declares none (auto: [...])")
|
|
851
|
+
if (rules.length === 0) h.out("no auto rule: the repo's review unit declares none (auto: [...]), and no Veille names this repo")
|
|
850
852
|
const now = Date.now()
|
|
851
853
|
const ago = (t: number): string => `${Math.round(Math.abs(now - t) / 60_000)} min`
|
|
852
854
|
for (const r of rules) {
|
package/src/cli/cmd_Shot.ts
CHANGED
|
@@ -24,12 +24,13 @@ export class ShotCommand extends Command {
|
|
|
24
24
|
category: 'Serve',
|
|
25
25
|
description: 'a png of any url through the warm browser, or an mp4 clip with --video',
|
|
26
26
|
details:
|
|
27
|
-
'one warm headless chromium for the whole machine (the `shot` global process, started when down). A still reuses the warm page when it already shows the url, so a warm shot answers in about 0.1 s. A page with `<meta name="shot-ready" content="wait">` is shot once it sets content="ready"; any other page --wait ms after its load. --video films a page that is a canvas through its WebCodecs encoder (H.264 muxed with no second encode), and any other page as chromium paints it (its screencast, encoded by ffmpeg as the frames arrive); --dom films the page even when a canvas fills it',
|
|
27
|
+
'one warm headless chromium for the whole machine (the `shot` global process, started when down). A still reuses the warm page when it already shows the url, so a warm shot answers in about 0.1 s. A page with `<meta name="shot-ready" content="wait">` is shot once it sets content="ready"; any other page --wait ms after its load. --video films a page that is a canvas through its WebCodecs encoder (H.264 muxed with no second encode), and any other page as chromium paints it (its screencast, encoded by ffmpeg as the frames arrive); --dom films the page even when a canvas fills it. --step <hook> films frame by frame: before each frame the page draws its time t (seconds) in `await window[hook](t)`, then its ready mark, so a slow page films smooth at its fps; a canvas page is encoded by its own WebCodecs at the exact time n / fps, any other page a screenshot a frame. A still with --step is the page drawn at --at s',
|
|
28
28
|
examples: [
|
|
29
29
|
['a png of a running dev server', 'sk shot localhost:5173/'],
|
|
30
30
|
['a phone screen, at the pixel ratio of a phone', 'sk shot :5173/play --viewport 390,844 --dpr 3 --out shots/phone.png'],
|
|
31
31
|
['a 3 s clip', 'sk shot :4808/ --video 3 --out clips/walk.mp4'],
|
|
32
32
|
['a clip of a whole web app page, canvas or not', 'sk shot :5173/settings --video 3 --dom'],
|
|
33
|
+
['a slow 3D page stepped frame by frame through window.__trailerStep(t)', 'sk shot :4808/ --video 3 --step __trailerStep --out clips/walk.mp4'],
|
|
33
34
|
],
|
|
34
35
|
})
|
|
35
36
|
|
|
@@ -43,13 +44,15 @@ export class ShotCommand extends Command {
|
|
|
43
44
|
fps = Option.String('--fps', { description: 'clip frames per second (default 30)' })
|
|
44
45
|
long = Option.Boolean('--long', false, { description: 'allow a clip past 30 s' })
|
|
45
46
|
dom = Option.Boolean('--dom', false, { description: 'clip the page itself even when a canvas fills it' })
|
|
47
|
+
step = Option.String('--step', { description: 'a window function the page draws time t (s) in: a clip steps it frame by frame, a still draws --at' })
|
|
48
|
+
at = Option.String('--at', { description: 'with --step, the time a still is drawn at (default 0)' })
|
|
46
49
|
json = Option.Boolean('--json', false, { description: 'one json line: out, ms, phases, errors, note, via' })
|
|
47
50
|
|
|
48
51
|
async execute(): Promise<number> {
|
|
49
52
|
const cwd = process.cwd()
|
|
50
53
|
const err = (l: string) => this.context.stderr.write(`${l}\n`)
|
|
51
54
|
try {
|
|
52
|
-
const a = askOf({ url: this.url, viewport: this.viewport, dpr: this.dpr, out: this.out, reload: this.reload, wait: this.wait, video: this.video, fps: this.fps, long: this.long, dom: this.dom }, cwd)
|
|
55
|
+
const a = askOf({ url: this.url, viewport: this.viewport, dpr: this.dpr, out: this.out, reload: this.reload, wait: this.wait, video: this.video, fps: this.fps, long: this.long, dom: this.dom, step: this.step, at: this.at }, cwd)
|
|
53
56
|
const r = isClip(a) ? await clipUrl(a, err) : await shotUrl(a, err)
|
|
54
57
|
if (this.json) this.context.stdout.write(`${JSON.stringify(r)}\n`)
|
|
55
58
|
else for (const l of renderShot(r, cwd)) this.context.stdout.write(`${l}\n`)
|
package/src/cli/cmd_Smoke.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// the login come from repo.config.ts `smoke`, the password from the keychain.
|
|
4
4
|
import { Command, Option } from 'clipanion'
|
|
5
5
|
import { loadRepoConfig } from '../repo-config.ts'
|
|
6
|
+
import { browserSlot } from '../shot/browser-slot.ts'
|
|
6
7
|
import { DEFAULT_PACE_MS, exitCodeFor, renderReport, runSmoke } from '../smoke/run-smoke.ts'
|
|
7
8
|
|
|
8
9
|
export class SmokeCommand extends Command {
|
|
@@ -27,11 +28,13 @@ export class SmokeCommand extends Command {
|
|
|
27
28
|
const config = await loadRepoConfig(root)
|
|
28
29
|
const w = (l: string) => this.context.stdout.write(`${l}\n`)
|
|
29
30
|
if (config.smoke == null) {
|
|
30
|
-
w(`FAIL this repo declares no smoke config — add \`smoke: { base, routes, login? }\` to repo.config.ts (
|
|
31
|
+
w(`FAIL this repo declares no smoke config — add \`smoke: { base, routes, login? }\` to repo.config.ts (tools/shipkit/index.md)`)
|
|
31
32
|
return 1
|
|
32
33
|
}
|
|
33
34
|
try {
|
|
34
|
-
|
|
35
|
+
// its browser counts against the repo's cap (shot/browser-slot.ts), held for the whole pass
|
|
36
|
+
const release = await browserSlot('sk smoke', { root, say: w })
|
|
37
|
+
const rep = await runSmoke(root, config.smoke, { base: this.base, routes: this.routes, credsReadCommand: config.credsReadCommand }, { print: w }).finally(release)
|
|
35
38
|
for (const l of renderReport(rep, { paceMs: config.smoke.paceMs ?? DEFAULT_PACE_MS })) w(l)
|
|
36
39
|
return exitCodeFor(rep)
|
|
37
40
|
} catch (e) {
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
// sk social and sk identities: who speaks, and where a repo stands in public (wiki tools/shipkit/social.md, `sk
|
|
2
|
+
// social`). Every module loads inside execute: the cli registers this file on every `sk` call
|
|
3
|
+
import { Command, Option } from 'clipanion'
|
|
4
|
+
|
|
5
|
+
type Ctx = { stdout: NodeJS.WritableStream; stderr: NodeJS.WritableStream }
|
|
6
|
+
|
|
7
|
+
const say = (c: Ctx) => (l: string): void => void c.stdout.write(`${l}\n`)
|
|
8
|
+
|
|
9
|
+
/** the desk of the repo the command runs in, and its model for one identity */
|
|
10
|
+
async function model(as: string | undefined) {
|
|
11
|
+
const { findRepoRoot } = await import('../ts/config.ts')
|
|
12
|
+
const { openDesk } = await import('../social/open.ts')
|
|
13
|
+
const { socialModel } = await import('../social/text.ts')
|
|
14
|
+
const { dayOf } = await import('../social/presence.ts')
|
|
15
|
+
const { desk } = await openDesk(findRepoRoot(process.cwd()))
|
|
16
|
+
if (as != null && !desk.identities.some((i) => i.id === as)) throw new Error(`no identity ${as} (${desk.identities.map((i) => i.id).join(', ')})`)
|
|
17
|
+
return { desk, m: socialModel(desk, as ?? desk.speaksAs), today: dayOf(Date.now()) }
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async function guarded(c: Ctx, body: () => Promise<number>): Promise<number> {
|
|
21
|
+
try {
|
|
22
|
+
return await body()
|
|
23
|
+
} catch (e) {
|
|
24
|
+
c.stderr.write(`FAIL: social: ${e instanceof Error ? e.message : String(e)}\n`)
|
|
25
|
+
return 1
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const asOpt = (): string | undefined => Option.String('--as', { description: "the identity, by id (default: the one this repo speaks as)" })
|
|
30
|
+
|
|
31
|
+
class SocialCommand extends Command {
|
|
32
|
+
static override paths = [['social']]
|
|
33
|
+
static override usage = Command.Usage({
|
|
34
|
+
category: 'Social',
|
|
35
|
+
description: 'where the repo stands in public: posts per account, the rhythm, kinds, topics, hashtags, what waits',
|
|
36
|
+
details:
|
|
37
|
+
'Every posted line of .shipkit/social/drafts as one post, dated from its id, else from the commit that recorded it. The public numbers come from the free reads (Bluesky, Mastodon, a Discord invite), cached 30 minutes; every other account says unknown. --offline skips them. Page: wiki tools/shipkit/social.md',
|
|
38
|
+
examples: [
|
|
39
|
+
['the overview', 'sk social'],
|
|
40
|
+
['with no network', 'sk social --offline'],
|
|
41
|
+
['as another identity', 'sk social --as studio'],
|
|
42
|
+
],
|
|
43
|
+
})
|
|
44
|
+
offline = Option.Boolean('--offline', false, { description: 'no public read' })
|
|
45
|
+
as = asOpt()
|
|
46
|
+
override async execute(): Promise<number> {
|
|
47
|
+
return guarded(this.context, async () => {
|
|
48
|
+
const { m, today } = await model(this.as)
|
|
49
|
+
const { overviewText } = await import('../social/text.ts')
|
|
50
|
+
const { socialStatsEntries, STATS_PLATFORMS } = await import('../social/stats.ts')
|
|
51
|
+
const stats = this.offline ? null : await socialStatsEntries(m.social.accounts)
|
|
52
|
+
for (const l of overviewText(m, today, stats, STATS_PLATFORMS)) say(this.context)(l)
|
|
53
|
+
return m.social.errors.length ? 1 : 0
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
class SocialTimelineCommand extends Command {
|
|
59
|
+
static override paths = [['social', 'timeline']]
|
|
60
|
+
static override usage = Command.Usage({
|
|
61
|
+
category: 'Social',
|
|
62
|
+
description: 'one row an account, one column a day: the posts of each cell',
|
|
63
|
+
examples: [
|
|
64
|
+
['the last two weeks', 'sk social timeline'],
|
|
65
|
+
['the last month', 'sk social timeline --days 30'],
|
|
66
|
+
],
|
|
67
|
+
})
|
|
68
|
+
days = Option.String('--days', '14', { description: 'how many days, ending today' })
|
|
69
|
+
as = asOpt()
|
|
70
|
+
override async execute(): Promise<number> {
|
|
71
|
+
return guarded(this.context, async () => {
|
|
72
|
+
const { m, today } = await model(this.as)
|
|
73
|
+
const { timelineText } = await import('../social/text.ts')
|
|
74
|
+
const n = Math.max(1, Number(this.days) || 14)
|
|
75
|
+
const from = new Date(Date.parse(`${today}T00:00:00Z`) - (n - 1) * 86_400_000).toISOString().slice(0, 10)
|
|
76
|
+
for (const l of timelineText(m, from, today)) say(this.context)(l)
|
|
77
|
+
return 0
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
class SocialCoverageCommand extends Command {
|
|
83
|
+
static override paths = [['social', 'coverage']]
|
|
84
|
+
static override usage = Command.Usage({ category: 'Social', description: 'the topics against the families: the drafts posted in each, the gaps named', examples: [['what we never talk about', 'sk social coverage']] })
|
|
85
|
+
as = asOpt()
|
|
86
|
+
override async execute(): Promise<number> {
|
|
87
|
+
return guarded(this.context, async () => {
|
|
88
|
+
const { m } = await model(this.as)
|
|
89
|
+
const { coverageText } = await import('../social/text.ts')
|
|
90
|
+
for (const l of coverageText(m)) say(this.context)(l)
|
|
91
|
+
return 0
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
class SocialPostCommand extends Command {
|
|
97
|
+
static override paths = [['social', 'post']]
|
|
98
|
+
static override usage = Command.Usage({
|
|
99
|
+
category: 'Social',
|
|
100
|
+
description: 'one draft across every account of its headings: posted with its date and link, or waiting',
|
|
101
|
+
examples: [
|
|
102
|
+
['by its topic', 'sk social post arena-face-lift'],
|
|
103
|
+
['by its whole name', 'sk social post 20261025-131139-arena-face-lift'],
|
|
104
|
+
],
|
|
105
|
+
})
|
|
106
|
+
draft = Option.String({ required: true })
|
|
107
|
+
override async execute(): Promise<number> {
|
|
108
|
+
return guarded(this.context, async () => {
|
|
109
|
+
const { desk } = await model(undefined)
|
|
110
|
+
const d = desk.drafts.find((x) => x.slug === this.draft || x.slug.replace(/^\d{8}-\d{6}-/, '') === this.draft)
|
|
111
|
+
if (d == null) throw new Error(`no draft "${this.draft}" in .shipkit/social/drafts/: give its folder's name or its topic`)
|
|
112
|
+
const { socialModel, postText } = await import('../social/text.ts')
|
|
113
|
+
for (const l of postText(socialModel(desk, d.identity), d.slug)) say(this.context)(l)
|
|
114
|
+
return 0
|
|
115
|
+
})
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
class SocialPlanCommand extends Command {
|
|
120
|
+
static override paths = [['social', 'plan']]
|
|
121
|
+
static override usage = Command.Usage({
|
|
122
|
+
category: 'Social',
|
|
123
|
+
description: 'the week ahead: each slot of the rhythm with its draft or empty, the late ones, the ready ones',
|
|
124
|
+
details:
|
|
125
|
+
'The next 7 days from today, Paris. The slots come from .shipkit/social/rhythm.md; a draft takes one with `slot: <YYYY-MM-DD> <tag>` in its front matter. Then the slotted drafts whose day passed with nothing posted, then every draft posted nowhere with no slot, the picked first.',
|
|
126
|
+
examples: [['the week ahead', 'sk social plan']],
|
|
127
|
+
})
|
|
128
|
+
as = asOpt()
|
|
129
|
+
override async execute(): Promise<number> {
|
|
130
|
+
return guarded(this.context, async () => {
|
|
131
|
+
const { m, today } = await model(this.as)
|
|
132
|
+
const { planText } = await import('../social/text.ts')
|
|
133
|
+
for (const l of planText(m, today)) say(this.context)(l)
|
|
134
|
+
for (const e of m.social.errors) say(this.context)(e)
|
|
135
|
+
return m.social.errors.length ? 1 : 0
|
|
136
|
+
})
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
class SocialStateCommand extends Command {
|
|
141
|
+
static override paths = [['social', 'state']]
|
|
142
|
+
static override usage = Command.Usage({
|
|
143
|
+
category: 'Social',
|
|
144
|
+
description: 'where the repo stands in public as a markdown page, with no number that moves with the clock',
|
|
145
|
+
details: 'For a page a repo keeps beside its own voice page. --write <file> writes it, --check <file> exits 1 when it is stale.',
|
|
146
|
+
examples: [['print it', 'sk social state'], ['keep it fresh', 'sk social state --write agent/social-state.md']],
|
|
147
|
+
})
|
|
148
|
+
write = Option.String('--write', { description: 'the file to write' })
|
|
149
|
+
check = Option.String('--check', { description: 'the file to compare' })
|
|
150
|
+
as = asOpt()
|
|
151
|
+
override async execute(): Promise<number> {
|
|
152
|
+
return guarded(this.context, async () => {
|
|
153
|
+
const { m, desk } = await model(this.as)
|
|
154
|
+
const { socialStateText } = await import('../social/text.ts')
|
|
155
|
+
const page = socialStateText(m)
|
|
156
|
+
const { join } = await import('node:path')
|
|
157
|
+
const { readFileSync, writeFileSync } = await import('node:fs')
|
|
158
|
+
if (this.write != null) writeFileSync(join(desk.root, this.write), page)
|
|
159
|
+
else if (this.check != null) {
|
|
160
|
+
const now = (() => { try { return readFileSync(join(desk.root, this.check!), 'utf8') } catch { return '' } })()
|
|
161
|
+
if (now !== page) throw new Error(`${this.check} is stale: sk social state --write ${this.check}`)
|
|
162
|
+
say(this.context)(`ok: ${this.check} is current`)
|
|
163
|
+
} else this.context.stdout.write(page)
|
|
164
|
+
return 0
|
|
165
|
+
})
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
class SocialMigrateCommand extends Command {
|
|
170
|
+
static override paths = [['social', 'migrate']]
|
|
171
|
+
static override usage = Command.Usage({
|
|
172
|
+
category: 'Social',
|
|
173
|
+
description: "the repo's v2 channel files become drafts, once: one draft a slug, a heading a channel",
|
|
174
|
+
details:
|
|
175
|
+
'Each `.shipkit/social/<channel>/<slug>[.<variant>].md` becomes `.shipkit/social/drafts/<moment>-<slug>/draft.md`: its picked or posted variant (else the first) is the text of `## <channel>`, the other variants are kept word for word under `## Angle`, a posted URL becomes its `## Posted` line. The v2 files are removed once their draft is written. --dry prints the plan and writes nothing.',
|
|
176
|
+
examples: [['the plan', 'sk social migrate --dry'], ['do it', 'sk social migrate']],
|
|
177
|
+
})
|
|
178
|
+
dry = Option.Boolean('--dry', false, { description: 'print the plan, write nothing' })
|
|
179
|
+
override async execute(): Promise<number> {
|
|
180
|
+
return guarded(this.context, async () => {
|
|
181
|
+
const { findRepoRoot } = await import('../ts/config.ts')
|
|
182
|
+
const { migrateV2 } = await import('../social/migrate.ts')
|
|
183
|
+
const r = migrateV2(findRepoRoot(process.cwd()), { dry: this.dry })
|
|
184
|
+
for (const l of r.lines) say(this.context)(l)
|
|
185
|
+
return 0
|
|
186
|
+
})
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
class IdentitiesCommand extends Command {
|
|
191
|
+
static override paths = [['identities']]
|
|
192
|
+
static override usage = Command.Usage({
|
|
193
|
+
category: 'Social',
|
|
194
|
+
description: 'every identity of the machine: its accounts online over its accounts, and the repos speaking as it',
|
|
195
|
+
details: "One folder an identity in the house repo's .shipkit/identities/. A repo names its own with speaksAs in repo.config.ts; the default identity speaks for a repo that names none. Page: wiki tools/shipkit/social.md",
|
|
196
|
+
examples: [['every identity', 'sk identities'], ['as json', 'sk identities --json']],
|
|
197
|
+
})
|
|
198
|
+
json = Option.Boolean('--json', false, { description: 'one json object' })
|
|
199
|
+
override async execute(): Promise<number> {
|
|
200
|
+
return guarded(this.context, async () => {
|
|
201
|
+
const { loadIdentities, speakerOf } = await import('../identities/identities.ts')
|
|
202
|
+
const { houseRepoRoots } = await import('../social/house.ts')
|
|
203
|
+
const ids = await loadIdentities()
|
|
204
|
+
const repos = await houseRepoRoots()
|
|
205
|
+
const by = new Map<string, string[]>()
|
|
206
|
+
for (const r of repos) {
|
|
207
|
+
const id = speakerOf(r.speaksAs, ids)?.id ?? '(none)'
|
|
208
|
+
by.set(id, [...(by.get(id) ?? []), r.name])
|
|
209
|
+
}
|
|
210
|
+
if (this.json) {
|
|
211
|
+
say(this.context)(JSON.stringify({ dir: ids.dir, identities: ids.identities.map((i) => ({ id: i.id, name: i.name, default: i.default, site: i.site, accounts: i.accounts.map((a) => ({ id: a.id, handle: a.handle, live: a.live })), repos: by.get(i.id) ?? [] })), errors: ids.errors }))
|
|
212
|
+
return ids.errors.length ? 1 : 0
|
|
213
|
+
}
|
|
214
|
+
for (const i of ids.identities) {
|
|
215
|
+
const online = i.accounts.filter((a) => a.live !== '')
|
|
216
|
+
say(this.context)(`${i.id}${i.default ? ' (default)' : ''} ${i.name} ${online.length}/${i.accounts.length} accounts online${i.site ? ` ${i.site}` : ''}`)
|
|
217
|
+
say(this.context)(` online: ${online.map((a) => `${a.id} ${a.handle}`).join(', ') || 'none'}`)
|
|
218
|
+
say(this.context)(` repos: ${(by.get(i.id) ?? []).join(', ') || 'none'}`)
|
|
219
|
+
}
|
|
220
|
+
for (const e of ids.errors) say(this.context)(`FAIL: ${e}`)
|
|
221
|
+
return ids.errors.length ? 1 : 0
|
|
222
|
+
})
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export const SOCIAL_COMMANDS = [SocialCommand, SocialTimelineCommand, SocialCoverageCommand, SocialPostCommand, SocialPlanCommand, SocialStateCommand, SocialMigrateCommand, IdentitiesCommand]
|
package/src/cli/cmd_Sound.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// module loads inside execute: the cli registers this file on every `sk` call
|
|
4
4
|
import { Command, Option } from 'clipanion'
|
|
5
5
|
|
|
6
|
-
const PAGE = 'Page: wiki
|
|
6
|
+
const PAGE = 'Page: wiki tools/trailer/index.md, Sound'
|
|
7
7
|
|
|
8
8
|
async function run(context: { stdout: NodeJS.WritableStream; stderr: NodeJS.WritableStream }, body: (say: (l: string) => void, root: string, cwd: string) => Promise<void>): Promise<number> {
|
|
9
9
|
const say = (l: string): void => void context.stdout.write(`${l}\n`)
|
package/src/cli/cmd_Start.ts
CHANGED
|
@@ -24,7 +24,7 @@ export class StartCommand extends Command {
|
|
|
24
24
|
root = Option.String('--root', { description: 'parent dir for repos (default ~/dev)' })
|
|
25
25
|
include = Option.Array('--include', { description: 'line CLAUDE.md must carry, repeatable, order kept. Omitted: the house template (HOUSE_INCLUDE in src/start-repo.ts), the base wiki include then `@./agent/index.md`, and on a machine without that wiki the agent route alone' })
|
|
26
26
|
alsoOk = Option.Array('--also-ok', { description: 'alternative lines satisfying the first --include — never double-add. Omitted: `@./CLAUDE.local.md`, the public-repo indirection' })
|
|
27
|
-
skip = Option.Array('--skip', { description: 'repo names shipkit never touches: no CLAUDE.md include, no wiring. Omitted: the house
|
|
27
|
+
skip = Option.Array('--skip', { description: 'repo names shipkit never touches: no CLAUDE.md include, no wiring. Omitted: start.skip in the house config' })
|
|
28
28
|
github = Option.Boolean('--github', { description: 'ON by default when a repo is being STARTED (a dir this run created, or one with a package.json): it gets a PRIVATE github repo wired as origin, and the first commit is pushed to it. Pass --github to force it for a pre-existing folder, --no-github to keep everything local, the first commit included (SHIPKIT_NO_GITHUB=1 does it for every run)' })
|
|
29
29
|
|
|
30
30
|
withCli = Option.Boolean('--cli', false, { description: 'on a repo with history: write the project CLI skeleton (src/cli.ts on the kit, an example family, package.json cli and bin), refused when the repo already has a CLI. A started repo always gets it' })
|
package/src/cli/cmd_Time.ts
CHANGED
|
@@ -26,7 +26,7 @@ export class TimeCommand extends Command {
|
|
|
26
26
|
['every command shape, 30 days', 'sk time commands --since 30d'],
|
|
27
27
|
['what he said while it ran', 'sk time feedback --since all'],
|
|
28
28
|
['the runs by their turns, and what the reads cost', 'sk time turns --since 30d'],
|
|
29
|
-
['two repos, every recorded session', 'sk time ~/dev/
|
|
29
|
+
['two repos, every recorded session', 'sk time ~/dev/game ~/dev/site --since all'],
|
|
30
30
|
['every repo on the machine', 'sk time --all'],
|
|
31
31
|
['for a script', 'sk time --json'],
|
|
32
32
|
],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// sk trace-audit — which
|
|
2
|
-
//
|
|
1
|
+
// sk trace-audit — which paths each gate task reads that its key cannot
|
|
2
|
+
// see (gitignored, or tracked outside a declared list), found by running the task once under the tracer, and with
|
|
3
3
|
// --fix written into repo.config.ts (core/trace-audit.ts).
|
|
4
4
|
import { Command, Option } from 'clipanion'
|
|
5
5
|
import { loadRepoConfig } from '../repo-config.ts'
|
|
@@ -12,8 +12,8 @@ export class TraceAuditCommand extends Command {
|
|
|
12
12
|
|
|
13
13
|
static override usage = Command.Usage({
|
|
14
14
|
category: 'Health',
|
|
15
|
-
description: '
|
|
16
|
-
details: 'Runs each gate task once under the tracer (on by default: --disable for this machine, or SHIPKIT_TRACE=0 for one run) and lists the
|
|
15
|
+
description: 'paths a gate task reads that its key misses, found by tracing it once',
|
|
16
|
+
details: 'Runs each gate task once under the tracer (on by default: --disable for this machine, or SHIPKIT_TRACE=0 for one run) and lists the paths it read that its key misses: a gitignored one that repo.config ignoredInputs does not name, and for a task with a declared inputs list (the test and typecheck of a unit), a tracked file outside that list. The answer is kept for about a day under the git common dir, where every worktree reads it, and each finding joins the key of the task that read it at once. --fix writes the findings into the managed block of repo.config.ts, per task, without tracing again. Exit 1 when a key misses something.',
|
|
17
17
|
examples: [
|
|
18
18
|
['audit, reusing a recent answer', 'sk trace-audit'],
|
|
19
19
|
['trace again now', 'sk trace-audit --fresh'],
|
|
@@ -53,8 +53,8 @@ export class TraceAuditCommand extends Command {
|
|
|
53
53
|
if (r.skipped != null) { out(`skip: nothing traced: ${r.skipped}`); return 0 }
|
|
54
54
|
for (const t of r.tasks) {
|
|
55
55
|
if (t.status === 'unaudited') out(`WARN ${t.id} could not be audited: ${t.why}`)
|
|
56
|
-
else if (t.uncovered.length > 0) out(`FAIL: ${t.id} reads ${t.uncovered.length}
|
|
57
|
-
else out(`ok: ${t.id}: its key covers every
|
|
56
|
+
else if (t.uncovered.length > 0) out(`FAIL: ${t.id} reads ${t.uncovered.length} path(s) its key misses: ${t.uncovered.slice(0, 5).join(', ')}${t.uncovered.length > 5 ? ', …' : ''}`)
|
|
57
|
+
else out(`ok: ${t.id}: its key covers every path it read`)
|
|
58
58
|
}
|
|
59
59
|
if (missing.length > 0) out(` fix: sk trace-audit --fix adds ${describeByTask(Object.fromEntries(missing.map((t) => [t.id, t.propose])))} to repo.config.ts ignoredInputs`)
|
|
60
60
|
return missing.length > 0 ? 1 : 0
|
package/src/cli/cmd_Trailer.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { Command, Option } from 'clipanion'
|
|
4
4
|
import { pageAt } from './family-pages.ts'
|
|
5
5
|
|
|
6
|
-
const PAGE = pageAt('
|
|
7
|
-
const DETAILS = `the trailer language: shots with a film line each (clip <file>, image <file>, card, run "<cmd {out}>", url <route> through the shot service, grid and split of other takes, or a film row of the project CLI), footage blocks, titles in the brand's look, cuts, sections in bars, music, sfx and voice; a \`vertical\` header finishes a short with the brand's lockup, watermark and end card. A repo plugs in one trailer({...}) unit: sounds by id, the world's paths, content checks, a line's own take. Outputs land in trailer/<trailer>/out/. Read first: ${PAGE}, then its folder
|
|
6
|
+
const PAGE = pageAt('tools/trailer/index.md')
|
|
7
|
+
const DETAILS = `the trailer language: shots with a film line each (clip <file>, image <file>, card, run "<cmd {out}>", url <route> through the shot service, grid and split of other takes, or a film row of the project CLI), footage blocks, titles in the brand's look, cuts, sections in bars, music, sfx and voice; a \`vertical\` header finishes a short with the brand's lockup, watermark and end card. A repo plugs in one trailer({...}) unit: sounds by id, the world's paths, content checks, a line's own take. Outputs land in trailer/<trailer>/out/. Read first: ${PAGE}, then its folder tools/trailer/ (the score, the craft, a book of ideas, extending the language)`
|
|
8
8
|
|
|
9
9
|
/** --refilm alone: every stale take; --refilm a,b: those shots */
|
|
10
10
|
const refilmOf = (v: string | boolean | undefined): 'stale' | ReadonlySet<string> | null => (v === undefined || v === false ? null : v === true ? 'stale' : new Set(v.split(',')))
|
|
@@ -236,8 +236,11 @@ export class TrailerKeepCommand extends Command {
|
|
|
236
236
|
static override usage = Command.Usage({
|
|
237
237
|
category: 'Trailer',
|
|
238
238
|
description: 'keep the built cut as a version: versions/v<n>.trailer, its video, strip and takes',
|
|
239
|
-
details: `${DETAILS}. Refuses a version already kept; prints the index row, commit and tag left to do`,
|
|
240
|
-
examples: [
|
|
239
|
+
details: `${DETAILS}. main.trailer keeps v<n>, another cut of the folder <stem>-v<n> (tease.trailer: versions/tease-v1.trailer). Refuses a version already kept; prints the index row, commit and tag left to do`,
|
|
240
|
+
examples: [
|
|
241
|
+
['keep the one cut', 'sk trailer keep v4'],
|
|
242
|
+
['keep a second cut of the folder, as tease-v1', 'sk trailer keep v1 trailer/launch/tease.trailer'],
|
|
243
|
+
],
|
|
241
244
|
})
|
|
242
245
|
|
|
243
246
|
version = Option.String({ required: true })
|