rvlib-shipkit 2.27.0 → 2.28.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 +16 -0
- package/package.json +1 -1
- package/src/agent-time/hooks.ts +10 -3
- package/src/agent-time/live.ts +11 -5
- package/src/agent-time/registry.ts +289 -0
- package/src/agent-time/store.ts +2 -2
- package/src/annex/born.ts +2 -2
- package/src/annex/offload.ts +12 -11
- package/src/asks/ask-after.ts +6 -2
- package/src/asks/ask-bar-fold.ts +57 -0
- package/src/asks/ask-migrate.ts +280 -0
- package/src/asks/ask-steps-fold.ts +166 -0
- package/src/asks/ask-store.ts +586 -0
- package/src/assets/kits/identity-kit.ts +106 -38
- package/src/assets/kits/poster-thumbnail.ts +282 -0
- package/src/checks/SK003-claude-md-shape.check.ts +92 -25
- package/src/checks/SK004-gitignore-policy.check.ts +8 -4
- package/src/checks/SK013-one-way-in-policy.check.ts +10 -0
- package/src/checks/SK026-asks-autoclose.check.ts +9 -23
- package/src/checks/SK038-speaks-as.check.ts +3 -3
- package/src/checks/SK042-post-kinds.check.ts +26 -24
- package/src/checks/SK049-thread-answers-hook.check.ts +81 -0
- package/src/checks/SK050-retired-commands.check.ts +127 -0
- package/src/cli/cmd_Asks.ts +204 -53
- package/src/cli/cmd_Backup.ts +151 -8
- package/src/cli/cmd_Calls.ts +1 -0
- package/src/cli/cmd_Commands.ts +140 -34
- package/src/cli/cmd_Contracts.ts +1 -0
- package/src/cli/cmd_Keys.ts +1 -0
- package/src/cli/cmd_Lanes.ts +15 -4
- package/src/cli/cmd_Messages.ts +152 -1
- package/src/cli/cmd_Needs.ts +1 -0
- package/src/cli/cmd_Review.ts +931 -229
- package/src/cli/cmd_Secret.ts +255 -34
- package/src/cli/cmd_Social.ts +36 -33
- package/src/cli/cmd_SocialDrafts.ts +235 -0
- package/src/cli/cmd_Sound.ts +22 -1
- package/src/cli/cmd_Start.ts +3 -2
- package/src/cli/cmd_ThreadHolds.ts +34 -0
- package/src/cli/cmd_ThreadKinds.ts +146 -0
- package/src/cli/cmd_ThreadReflect.ts +83 -0
- package/src/cli/cmd_ThreadSyncNeeds.ts +62 -0
- package/src/cli/cmd_Vault.ts +1 -1
- package/src/cli/cmd_When.ts +1 -0
- package/src/cli/family-help.ts +2 -2
- package/src/cli/family-pages.ts +1 -1
- package/src/cli/kit/builtins.ts +1 -0
- package/src/cli/kit/verb.ts +6 -2
- package/src/cli/registry.ts +21 -2
- package/src/cli.ts +5 -2
- package/src/collections/actions.ts +25 -74
- package/src/collections/collection-types.ts +9 -5
- package/src/collections/md-body.ts +5 -3
- package/src/collections/pings.ts +13 -6
- package/src/collections/providers.ts +53 -61
- package/src/collections/reflections.ts +9 -4
- package/src/core/discover-checks.ts +18 -3
- package/src/core/git.ts +31 -0
- package/src/core/house-layout.ts +17 -0
- package/src/core/layout.ts +10 -5
- package/src/core/locked-write.ts +4 -1
- package/src/core/machine-db.ts +5 -3
- package/src/core/migrate-layout.ts +8 -10
- package/src/home/activity.ts +8 -15
- package/src/home/daemon-jobs.ts +13 -1
- package/src/home/home-paths.ts +6 -3
- package/src/home/home-routes.ts +8 -0
- package/src/home/inbox-shape.ts +233 -100
- package/src/home/inbox.ts +26 -71
- package/src/home/machine-fold.ts +10 -15
- package/src/home/machine-host.ts +19 -1
- package/src/home/other-macs.ts +2 -2
- package/src/home/serve-web.ts +6 -5
- package/src/home/space-page.ts +1 -1
- package/src/home/vault-page.ts +51 -17
- package/src/home/vault-words.ts +2 -2
- package/src/hooks/one-way-in-guard.ts +24 -2
- package/src/hq/files-send.ts +27 -28
- package/src/hq/hq-db.ts +4 -1
- package/src/hq/hq-local.ts +37 -4
- package/src/hq/hq-routes.ts +10 -2
- package/src/hq/hq-store.ts +6 -2
- package/src/hq/kinds/ask.ts +6 -6
- package/src/hq/outbox.ts +5 -3
- package/src/hq/replica.ts +1 -2
- package/src/hq/vault-route.ts +112 -0
- package/src/identities/collection.ts +2 -2
- package/src/identities/identities.ts +9 -8
- package/src/identities/machine-route.ts +8 -3
- package/src/ledger/db.ts +8 -1
- package/src/media-store/backup/daemon.ts +48 -8
- package/src/media-store/backup/keys.ts +1 -1
- package/src/media-store/backup/manifest.ts +20 -2
- package/src/media-store/backup/prune.ts +365 -0
- package/src/media-store/backup/retention.ts +122 -0
- package/src/media-store/backup/run.ts +14 -8
- package/src/media-store/backup/sources.ts +18 -17
- package/src/media-store/backup/thread-copy.ts +340 -0
- package/src/media-store/copy/config.ts +3 -4
- package/src/media-store/copy/store.ts +2 -2
- package/src/media-store/db.ts +2 -2
- package/src/media-store/forget.ts +118 -0
- package/src/media-store/purge.ts +3 -2
- package/src/media-store/space-listing.ts +20 -4
- package/src/media-store/space.ts +6 -5
- package/src/messages/guard.ts +49 -0
- package/src/messages/model.ts +1 -1
- package/src/messages/objects.ts +201 -0
- package/src/messages/routes.ts +2 -2
- package/src/messages/score.ts +1 -1
- package/src/messages/write.ts +285 -0
- package/src/pages/frame-client.ts +181 -4
- package/src/reflections/reflections-queue.ts +1 -1
- package/src/release/gate-checkout.ts +2 -1
- package/src/release/git-facts.ts +3 -2
- package/src/release/public-clean.ts +3 -2
- package/src/repo-config.ts +40 -18
- package/src/review/anim.ts +1 -1
- package/src/review/answer-kinds.ts +131 -0
- package/src/review/band.ts +53 -0
- package/src/review/branch-hold.ts +84 -0
- package/src/review/card-db.ts +16 -6
- package/src/review/card-rows.ts +4 -3
- package/src/review/cells.ts +297 -65
- package/src/review/close.ts +92 -0
- package/src/review/draft-card.ts +8 -16
- package/src/review/draft-model.ts +2 -2
- package/src/review/events.ts +171 -0
- package/src/review/format.ts +128 -14
- package/src/review/glyphs.ts +63 -0
- package/src/review/gone.ts +1 -1
- package/src/review/holds-sync.ts +62 -0
- package/src/review/holds.ts +85 -0
- package/src/review/house-kind-defs.ts +41 -0
- package/src/review/inbox-hook.ts +22 -9
- package/src/review/inbox-read.ts +201 -0
- package/src/review/instructions.ts +199 -0
- package/src/review/kind-apply.ts +61 -0
- package/src/review/kind-catalog.ts +96 -0
- package/src/review/kinds.ts +278 -0
- package/src/review/lane-ask.ts +109 -0
- package/src/review/model.ts +396 -86
- package/src/review/move.ts +3 -3
- package/src/review/need-address.ts +15 -0
- package/src/review/need-threads.ts +93 -0
- package/src/review/object-card.ts +48 -0
- package/src/review/object-read.ts +31 -0
- package/src/review/owner-verdict.ts +36 -0
- package/src/review/parties.ts +182 -0
- package/src/review/previews.ts +3 -1
- package/src/review/projections.ts +235 -0
- package/src/review/referring.ts +54 -0
- package/src/review/reflection-object.ts +195 -0
- package/src/review/routes.ts +137 -32
- package/src/review/secret-route.ts +80 -0
- package/src/review/snooze.ts +38 -0
- package/src/review/stage-card.ts +4 -4
- package/src/review/store.ts +366 -85
- package/src/review/supersede.ts +116 -0
- package/src/review/take-back.ts +52 -0
- package/src/review/thread-fold.ts +20 -7
- package/src/review/threads.ts +236 -39
- package/src/review/traces.ts +218 -0
- package/src/review/trailer-card.ts +2 -2
- package/src/review/unit.ts +71 -5
- package/src/review/verdict-items.ts +73 -0
- package/src/review/verdict-write.ts +15 -0
- package/src/review/wait.ts +85 -0
- package/src/review/watchers.ts +22 -9
- package/src/scaffold/files/claude-settings-local.json +2 -0
- package/src/secrets/archive-mark.ts +52 -0
- package/src/secrets/archive.ts +83 -0
- package/src/secrets/copy.ts +14 -14
- package/src/secrets/keychain-write.ts +48 -0
- package/src/secrets/keychain.ts +8 -5
- package/src/secrets/lapse-mark.ts +33 -0
- package/src/secrets/lapse.ts +60 -0
- package/src/secrets/list.ts +16 -22
- package/src/secrets/manager.ts +31 -16
- package/src/secrets/read.ts +161 -33
- package/src/secrets/tail.ts +31 -0
- package/src/serve/hub-app/asks-page.tsx +2 -1
- package/src/serve/hub-app/auto-text.tsx +14 -6
- package/src/serve/hub-app/benign-errors.ts +15 -1
- package/src/serve/hub-app/card-head.tsx +49 -0
- package/src/serve/hub-app/check-view.tsx +3 -2
- package/src/serve/hub-app/code-copy.ts +35 -0
- package/src/serve/hub-app/col-card.tsx +31 -40
- package/src/serve/hub-app/col-list-page.tsx +5 -2
- package/src/serve/hub-app/col-tables-view.tsx +7 -4
- package/src/serve/hub-app/col-tables.ts +5 -5
- package/src/serve/hub-app/cols-svc.ts +4 -79
- package/src/serve/hub-app/commands/commands-page.tsx +2 -1
- package/src/serve/hub-app/controls.css +83 -0
- package/src/serve/hub-app/frames-st.ts +17 -1
- package/src/serve/hub-app/git-view.tsx +3 -2
- package/src/serve/hub-app/home-st.ts +57 -6
- package/src/serve/hub-app/home-strip.css +1 -6
- package/src/serve/hub-app/home-strip.tsx +2 -1
- package/src/serve/hub-app/home.html +3 -0
- package/src/serve/hub-app/house-wiki-view.tsx +20 -0
- package/src/serve/hub-app/hub-app.tsx +48 -32
- package/src/serve/hub-app/hub-types.ts +2 -0
- package/src/serve/hub-app/hub.css +50 -61
- package/src/serve/hub-app/icons.tsx +14 -4
- package/src/serve/hub-app/identities-view.tsx +4 -3
- package/src/serve/hub-app/inbox-st.ts +203 -42
- package/src/serve/hub-app/inbox-view.tsx +189 -101
- package/src/serve/hub-app/inbox.css +47 -44
- package/src/serve/hub-app/index.html +3 -0
- package/src/serve/hub-app/instructions.css +30 -0
- package/src/serve/hub-app/keys.ts +5 -3
- package/src/serve/hub-app/machine-st.ts +2 -2
- package/src/serve/hub-app/machines-view.tsx +4 -11
- package/src/serve/hub-app/machines.css +0 -9
- package/src/serve/hub-app/markdown.css +51 -0
- package/src/serve/hub-app/md-copy.tsx +18 -40
- package/src/serve/hub-app/md.ts +25 -9
- package/src/serve/hub-app/media-view.tsx +2 -2
- package/src/serve/hub-app/messages/messages-page.tsx +2 -1
- package/src/serve/hub-app/messages/messages-st.ts +1 -1
- package/src/serve/hub-app/messages.css +0 -1
- package/src/serve/hub-app/objects.css +51 -0
- package/src/serve/hub-app/page-keys.ts +1 -1
- package/src/serve/hub-app/pages-frames.tsx +11 -1
- package/src/serve/hub-app/palette-st.ts +4 -4
- package/src/serve/hub-app/pane-boundary.tsx +72 -0
- package/src/serve/hub-app/pane-errors.ts +54 -0
- package/src/serve/hub-app/plan-view.tsx +3 -2
- package/src/serve/hub-app/planned-view.tsx +3 -3
- package/src/serve/hub-app/planned.css +0 -4
- package/src/serve/hub-app/processes-view.tsx +3 -2
- package/src/serve/hub-app/project-list.css +5 -13
- package/src/serve/hub-app/project-list.tsx +3 -6
- package/src/serve/hub-app/projects-svc.ts +6 -2
- package/src/serve/hub-app/readme.css +9 -15
- package/src/serve/hub-app/reflections-page.tsx +54 -1
- package/src/serve/hub-app/releases/releases-page.tsx +3 -2
- package/src/serve/hub-app/releases.css +0 -1
- package/src/serve/hub-app/review/code-colors.ts +30 -0
- package/src/serve/hub-app/review/diff-view.tsx +75 -0
- package/src/serve/hub-app/review/dock.tsx +104 -0
- package/src/serve/hub-app/review/draft-card.tsx +2 -2
- package/src/serve/hub-app/review/group-block.tsx +209 -0
- package/src/serve/hub-app/review/instructions-view.tsx +116 -0
- package/src/serve/hub-app/review/item-verdict.tsx +38 -0
- package/src/serve/hub-app/review/kind-states.tsx +193 -0
- package/src/serve/hub-app/review/kind-view.tsx +1 -37
- package/src/serve/hub-app/review/kit.tsx +57 -54
- package/src/serve/hub-app/review/lane-bar.tsx +64 -0
- package/src/serve/hub-app/review/object-card.tsx +62 -0
- package/src/serve/hub-app/review/object-panel.tsx +179 -0
- package/src/serve/hub-app/review/question-views.tsx +385 -0
- package/src/serve/hub-app/review/review-cells.tsx +86 -105
- package/src/serve/hub-app/review/review-list.tsx +104 -47
- package/src/serve/hub-app/review/review-page.tsx +5 -4
- package/src/serve/hub-app/review/review-st.ts +68 -28
- package/src/serve/hub-app/review/review-thread.tsx +171 -40
- package/src/serve/hub-app/review/review-views.tsx +35 -31
- package/src/serve/hub-app/review/thread-close.tsx +124 -0
- package/src/serve/hub-app/review/thread-control.tsx +4 -4
- package/src/serve/hub-app/review/thread-st.ts +222 -22
- package/src/serve/hub-app/review/trailer-card.tsx +1 -1
- package/src/serve/hub-app/review/trailer-timeline.tsx +2 -2
- package/src/serve/hub-app/review.css +216 -57
- package/src/serve/hub-app/section-head.tsx +51 -0
- package/src/serve/hub-app/social/calendar.tsx +5 -11
- package/src/serve/hub-app/social/comms-page.tsx +23 -10
- package/src/serve/hub-app/social/kit.tsx +8 -15
- package/src/serve/hub-app/social/next-release.tsx +3 -5
- package/src/serve/hub-app/social/post-card.tsx +3 -0
- package/src/serve/hub-app/social/post-page.tsx +80 -0
- package/src/serve/hub-app/social/problems.tsx +5 -9
- package/src/serve/hub-app/social/social-model.ts +13 -5
- package/src/serve/hub-app/social/social-page.tsx +1 -1
- package/src/serve/hub-app/social/social-st.ts +42 -5
- package/src/serve/hub-app/social.css +7 -17
- package/src/serve/hub-app/space.css +1 -1
- package/src/serve/hub-app/stores/stores-page.tsx +6 -2
- package/src/serve/hub-app/thread-row.tsx +101 -0
- package/src/serve/hub-app/time-ago.tsx +3 -2
- package/src/serve/hub-app/time-view.tsx +2 -1
- package/src/serve/hub-app/time.css +2 -5
- package/src/serve/hub-app/tree-row.tsx +1 -9
- package/src/serve/hub-app/vault-view.tsx +4 -4
- package/src/serve/hub-app/veille/veille-page.tsx +2 -11
- package/src/serve/hub-app/veille.css +0 -1
- package/src/serve/hub-app/waiting-svc.ts +4 -4
- package/src/serve/hub-app/when-view.tsx +6 -3
- package/src/serve/hub-app/wiki-st.ts +30 -4
- package/src/serve/hub-app/wikis-view.tsx +4 -3
- package/src/serve/hub-runtime.ts +20 -6
- package/src/serve/project-gutter-route.ts +16 -6
- package/src/serve/project-gutter.ts +6 -53
- package/src/serve/same-origin.ts +3 -0
- package/src/serve/secret-gate.ts +21 -0
- package/src/serve/serve-hub.ts +29 -20
- package/src/serve/tailnet-caller.ts +117 -0
- package/src/shipkit.ts +2 -2
- package/src/site/desk.ts +2 -2
- package/src/smoke/run-smoke.ts +3 -4
- package/src/social/brands.ts +4 -0
- package/src/social/card-drafts.ts +11 -19
- package/src/social/desk-index.ts +34 -13
- package/src/social/drafts.ts +4 -4
- package/src/social/import-drafts.ts +244 -0
- package/src/social/kind-pages.ts +3 -3
- package/src/social/kinds.ts +1 -1
- package/src/social/load.ts +89 -64
- package/src/social/media-kind.ts +68 -161
- package/src/social/media-of.ts +5 -4
- package/src/social/open.ts +3 -2
- package/src/social/post-object.ts +120 -0
- package/src/social/post-sources.ts +136 -0
- package/src/social/post-text.ts +103 -0
- package/src/social/posts.ts +378 -0
- package/src/social/presence.ts +7 -5
- package/src/social/publish/index.ts +17 -5
- package/src/social/publish/secret.ts +2 -2
- package/src/social/release-stage.ts +58 -57
- package/src/social/routes.ts +64 -24
- package/src/social/stage.ts +42 -57
- package/src/social/text.ts +4 -3
- package/src/social/thumbnail.ts +135 -43
- package/src/social/tracker.ts +1 -1
- package/src/social/writes.ts +12 -29
- package/src/stores/desk.ts +16 -11
- package/src/stores/unit.ts +2 -2
- package/src/trailer/sound/eleven.ts +33 -3
- package/src/urls/rows.ts +1 -1
- package/src/vault/vault-http.ts +11 -3
- package/src/vault/vault-import.ts +6 -1
- package/src/veille/identity.ts +2 -2
- package/src/wiki/graph-pages.ts +13 -1
- package/src/wiki/scan-md.ts +1 -1
- package/src/asks/asks-queue.ts +0 -424
- package/src/messages/suggest.ts +0 -96
- package/src/social/migrate.ts +0 -123
package/src/cli/cmd_Secret.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// shipkit secret — the secrets of the repo you stand in, and the
|
|
2
|
-
//
|
|
3
|
-
// Logic in secrets/list.ts and
|
|
4
|
-
// and only for a repo in the name's scope.
|
|
1
|
+
// shipkit secret — the secrets of the repo you stand in, and every read, write and removal of the house store (the
|
|
2
|
+
// vault, else the login keychain; a repo's declared manager, `credsReadCommand` and `credsCommand`, where it has one).
|
|
3
|
+
// Logic in secrets/read.ts, list.ts and manager.ts. A value only ever goes to stdout of `get`, `account` and `env`,
|
|
4
|
+
// and only for a repo in the name's scope. Exits of a read: 3 refused, 44 missing, 36 a keychain locked to the session
|
|
5
5
|
import { Command, Option } from 'clipanion'
|
|
6
6
|
import { homedir, userInfo } from 'os'
|
|
7
7
|
import { createInterface } from 'readline'
|
|
@@ -9,8 +9,36 @@ import { relative } from 'path'
|
|
|
9
9
|
import { houseRootOf } from '../home/home-start.ts'
|
|
10
10
|
import { presence, secretsFor } from '../secrets/list.ts'
|
|
11
11
|
import { scopeHouse } from '../secrets/who-reads.ts'
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
12
|
+
import { managerTemplate as template, NoManager, REFUSED_EXIT, secretsWhere as where, storeArgv, type SecretsWhere } from '../secrets/manager.ts'
|
|
13
|
+
import { archivedLine } from '../secrets/archive-mark.ts'
|
|
14
|
+
import { archivedIn, envVarOf, masterOnly, readSecretHere, storeSecretHere, type Read } from '../secrets/read.ts'
|
|
15
|
+
import { HOUSE_LAYOUT } from '../core/house-layout.ts'
|
|
16
|
+
|
|
17
|
+
/** a read that gave no value as its exit: 3 refused, 36 a keychain locked to this session, 44 missing */
|
|
18
|
+
const MISSING_EXIT = 44
|
|
19
|
+
const LOCKED_EXIT = 36
|
|
20
|
+
const exitOf = (r: Exclude<Read, { value: string }>): number => ('refused' in r ? REFUSED_EXIT : r.locked === true ? LOCKED_EXIT : MISSING_EXIT)
|
|
21
|
+
const whyOf = (r: Exclude<Read, { value: string }>): string => ('refused' in r ? r.refused : `FAIL ${r.missing}`)
|
|
22
|
+
|
|
23
|
+
/** every `rv/` name this Mac holds: its keychain's, and each registry name the one read answers (the vault's) */
|
|
24
|
+
async function heldNames(w: SecretsWhere): Promise<string[]> {
|
|
25
|
+
const names = new Set<string>()
|
|
26
|
+
try {
|
|
27
|
+
const { keychainReader } = await import('../secrets/keychain.ts')
|
|
28
|
+
for (const n of keychainReader().names()) names.add(n)
|
|
29
|
+
} catch {
|
|
30
|
+
// a Mac with no keychain, or a scratch home: the vault's names alone
|
|
31
|
+
}
|
|
32
|
+
const creds = [...(w.house?.creds ?? []), ...(w.own?.creds ?? [])].filter((c) => !c.name.includes('<') && c.archived == null)
|
|
33
|
+
await Promise.all(creds.map(async (c) => {
|
|
34
|
+
if ('value' in (await readSecretHere({ name: c.name, cwd: process.cwd(), w, say: () => {} }))) names.add(c.name)
|
|
35
|
+
}))
|
|
36
|
+
return [...names].sort()
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** a registry name matches a held one: `<x>` in a row stands for any one segment */
|
|
40
|
+
const matchesRow = (row: string, name: string): boolean =>
|
|
41
|
+
new RegExp(`^${row.replace(/[.*+?^${}()|[\]\\]/g, '\\$&').replace(/<[^>]*>/g, '[^/]+')}$`).test(name)
|
|
14
42
|
|
|
15
43
|
/** runs a verb, printing a refusal as its one line */
|
|
16
44
|
async function refusing(stderr: NodeJS.WritableStream, run: () => Promise<number>): Promise<number> {
|
|
@@ -38,6 +66,10 @@ export class SecretListCommand extends Command {
|
|
|
38
66
|
|
|
39
67
|
all = Option.Boolean('--all', false, { description: 'every registry row, the ones out of scope marked' })
|
|
40
68
|
json = Option.Boolean('--json', false, { description: 'one json array, no presence read' })
|
|
69
|
+
archived = Option.Boolean('--archived', false, { description: 'the archived names alone, each with its day and why (sk secret archive)' })
|
|
70
|
+
tail = Option.Boolean('--tail', false, { description: "a column with the end a provider's dashboard shows (••••c23e), never the value (sk secret tail)" })
|
|
71
|
+
held = Option.Boolean('--held', false, { description: 'every rv/ name this Mac holds, one a line: its keychain and the vault, never a value' })
|
|
72
|
+
check = Option.Boolean('--check', false, { description: 'exit 1 when a secret in scope is MISS, or a name this Mac holds has no registry row (UNREGISTERED)' })
|
|
41
73
|
|
|
42
74
|
async execute(): Promise<number> {
|
|
43
75
|
return refusing(this.context.stderr, () => this.list())
|
|
@@ -45,15 +77,31 @@ export class SecretListCommand extends Command {
|
|
|
45
77
|
|
|
46
78
|
private async list(): Promise<number> {
|
|
47
79
|
const w = await where(process.cwd())
|
|
80
|
+
if (this.held) {
|
|
81
|
+
this.context.stdout.write((await heldNames(w)).map((n) => `${n}\n`).join(''))
|
|
82
|
+
return 0
|
|
83
|
+
}
|
|
48
84
|
// in the house repo its own creds ARE the registry, each row with the scope it declares
|
|
49
85
|
const inHouse = w.house != null && w.house === w.own
|
|
50
86
|
const scopes = this.json ? undefined : await scopeHouse(process.cwd(), { keys: (w.house?.creds ?? []).some((c) => (c.for?.repos ?? []).some((r) => r.includes('/'))) }).catch(() => undefined)
|
|
51
|
-
const rows = secretsFor({ asker: w, own: inHouse ? [] : (w.own?.creds ?? []), house: w.house?.creds ?? [], all: this.all, scopes })
|
|
87
|
+
const rows = secretsFor({ asker: w, own: inHouse ? [] : (w.own?.creds ?? []), house: w.house?.creds ?? [], all: this.all, archived: this.archived, scopes })
|
|
52
88
|
if (this.json) {
|
|
53
89
|
this.context.stdout.write(`${JSON.stringify(rows)}\n`)
|
|
54
90
|
return 0
|
|
55
91
|
}
|
|
56
|
-
|
|
92
|
+
if (this.archived) {
|
|
93
|
+
this.context.stdout.write(rows.length === 0 ? 'no archived secret in scope\n' : rows.map((r) => `${r.name} archived ${r.archived!.at}: ${r.archived!.why} (sk secret unarchive ${r.name})\n`).join(''))
|
|
94
|
+
return 0
|
|
95
|
+
}
|
|
96
|
+
const has = await presence(rows.filter((r) => r.inScope).map((r) => r.name))
|
|
97
|
+
const masks = new Map<string, string>()
|
|
98
|
+
if (this.tail) {
|
|
99
|
+
const { maskOf, maskText } = await import('../secrets/tail.ts')
|
|
100
|
+
await Promise.all(rows.filter((r) => has.get(r.name) === 'ok').map(async (r) => {
|
|
101
|
+
const got = await readSecretHere({ name: r.name, cwd: process.cwd(), w, say: () => {} })
|
|
102
|
+
if ('value' in got) masks.set(r.name, maskText(maskOf(got.value)))
|
|
103
|
+
}))
|
|
104
|
+
}
|
|
57
105
|
const say = (l: string): void => void this.context.stdout.write(`${l}\n`)
|
|
58
106
|
const mine = rows.filter((r) => r.mine).length
|
|
59
107
|
say(`${w.repos[0]} speaks as ${w.identity ?? 'no identity'}: ${rows.filter((r) => r.inScope).length} secrets, ${mine} for this repo or identity`)
|
|
@@ -66,10 +114,17 @@ export class SecretListCommand extends Command {
|
|
|
66
114
|
const p = has.get(r.name)
|
|
67
115
|
const mark = !r.inScope ? 'out ' : p === 'ok' ? 'ok ' : p === 'locked' ? 'LOCK' : 'MISS'
|
|
68
116
|
const fix = p === 'missing' ? ` → sk secret set ${r.name}` : ''
|
|
69
|
-
|
|
117
|
+
const tail = masks.has(r.name) ? ` ${masks.get(r.name)}` : ''
|
|
118
|
+
say(`${line(mark, r.name, r.level, r.service ?? '', r.who)}${tail}${fix}`)
|
|
70
119
|
}
|
|
71
120
|
if (rows.some((r) => /\?(,|$)/.test(r.who))) say('a repo with ? is one this machine does not have; --json gives each scope in a sentence')
|
|
72
|
-
return 0
|
|
121
|
+
if (!this.check) return 0
|
|
122
|
+
const missing = rows.filter((r) => r.inScope && !r.name.includes('<') && has.get(r.name) === 'missing').length
|
|
123
|
+
const known = [...(w.house?.creds ?? []), ...(w.own?.creds ?? [])].map((c) => c.name)
|
|
124
|
+
const strays = (await heldNames(w)).filter((n) => !known.some((k) => matchesRow(k, n)))
|
|
125
|
+
for (const n of strays) say(`UNREGISTERED ${n} → add its row to ${HOUSE_LAYOUT.secretRegistry}`)
|
|
126
|
+
say(`${missing} missing, ${strays.length} unregistered`)
|
|
127
|
+
return missing + strays.length > 0 ? 1 : 0
|
|
73
128
|
}
|
|
74
129
|
}
|
|
75
130
|
|
|
@@ -89,18 +144,40 @@ export class SecretReadCommand extends Command {
|
|
|
89
144
|
const field = this.path[1] === 'account' ? 'account' : 'get'
|
|
90
145
|
return refusing(this.context.stderr, async () => {
|
|
91
146
|
const w = await where(process.cwd())
|
|
92
|
-
|
|
93
|
-
if (refused != null) {
|
|
94
|
-
this.context.stderr.write(`${refused}\n`)
|
|
95
|
-
return REFUSED_EXIT
|
|
96
|
-
}
|
|
147
|
+
// the one read gates after the env override, as every reader of the lib does
|
|
97
148
|
const r = await readSecretHere({ name: this.name, field, cwd: process.cwd(), w, say: (l) => void this.context.stderr.write(`${l}\n`) })
|
|
98
149
|
if ('value' in r) {
|
|
99
150
|
this.context.stdout.write(`${r.value}\n`)
|
|
100
151
|
return 0
|
|
101
152
|
}
|
|
102
|
-
this.context.stderr.write(`${
|
|
103
|
-
return
|
|
153
|
+
this.context.stderr.write(`${whyOf(r)}\n`)
|
|
154
|
+
return exitOf(r)
|
|
155
|
+
})
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export class SecretTailCommand extends Command {
|
|
160
|
+
static override paths = [['secret', 'tail']]
|
|
161
|
+
static essential = { args: '<name…>' }
|
|
162
|
+
|
|
163
|
+
static override usage = Command.Usage({
|
|
164
|
+
category: 'Secrets',
|
|
165
|
+
description: "the end of a secret a dashboard shows (••••c23e), never the value: match a key with its dashboard",
|
|
166
|
+
details: 'Each value is read in this process, through the scope and archive gates, and only its last 4 characters and its length leave it. A value under 20 characters prints its length alone.',
|
|
167
|
+
examples: [['which ElevenLabs key the house holds', 'sk secret tail rv/elevenlabs/api-key'], ["this Mac's keychain copy, to compare with the vault's", 'sk secret tail rv/npm/token --keychain']],
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
names = Option.Rest({ required: 1 })
|
|
171
|
+
keychain = Option.Boolean('--keychain', false, { description: "read this Mac's keychain copy, not the vault's" })
|
|
172
|
+
|
|
173
|
+
async execute(): Promise<number> {
|
|
174
|
+
return refusing(this.context.stderr, async () => {
|
|
175
|
+
const w = await where(process.cwd())
|
|
176
|
+
const { tailLines } = await import('../secrets/tail.ts')
|
|
177
|
+
const store = this.keychain ? ('keychain' as const) : undefined
|
|
178
|
+
const r = await tailLines({ names: this.names, read: (name) => readSecretHere({ name, cwd: process.cwd(), w, say: () => {}, ...(store != null ? { store } : {}) }) })
|
|
179
|
+
this.context.stdout.write(r.lines.map((l) => `${l}\n`).join(''))
|
|
180
|
+
return r.code
|
|
104
181
|
})
|
|
105
182
|
}
|
|
106
183
|
}
|
|
@@ -127,7 +204,7 @@ export class SecretSetCommand extends Command {
|
|
|
127
204
|
static override usage = Command.Usage({
|
|
128
205
|
category: 'Secrets',
|
|
129
206
|
description: 'store a secret and its account, in the vault where this machine runs one; prompts, or reads stdin',
|
|
130
|
-
details: 'On the machine that runs the vault, the value goes into the vault and is read back; the keychain is never written, and a vault that is down or sealed fails the command. On
|
|
207
|
+
details: 'On the machine that runs the vault, the value goes into the vault and is read back; the keychain is never written, and a vault that is down or sealed fails the command. On a Mac that reads the vault from afar it is refused, naming the Mac that runs it. On a Mac with no vault it goes into the login keychain: the items of the name under another account are removed, and the value is read back. A repo that declares its own `credsCommand` stores through it. The value is asked at a prompt with no echo, or read whole from stdin, its trailing line breaks dropped; an empty one is refused.',
|
|
131
208
|
examples: [['store a token', 'sk secret set rv/npm/token'], ['with its login', 'sk secret set rv/pockethost/account me@example.com']],
|
|
132
209
|
})
|
|
133
210
|
|
|
@@ -137,34 +214,174 @@ export class SecretSetCommand extends Command {
|
|
|
137
214
|
async execute(): Promise<number> {
|
|
138
215
|
return refusing(this.context.stderr, async () => {
|
|
139
216
|
const w = await where(process.cwd())
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
217
|
+
const archived = archivedIn(w, this.name)
|
|
218
|
+
if (archived != null) {
|
|
219
|
+
this.context.stderr.write(`FAIL: nothing was stored: ${archivedLine(this.name, archived)}, then set it\n`)
|
|
220
|
+
return 1
|
|
143
221
|
}
|
|
222
|
+
const master = await masterOnly()
|
|
223
|
+
if (master != null) {
|
|
224
|
+
this.context.stderr.write(`FAIL: nothing was stored: ${master}\n`)
|
|
225
|
+
return 1
|
|
226
|
+
}
|
|
227
|
+
const declared = template(w, 'credsCommand')
|
|
228
|
+
if (declared != null) return Bun.spawnSync(storeArgv(declared, this.name, this.account), { stdin: 'inherit', stdout: 'inherit', stderr: 'inherit' }).exitCode ?? 1
|
|
144
229
|
const value = await readValue(this.name)
|
|
145
230
|
if (value === '') {
|
|
146
231
|
this.context.stderr.write('refusing to store empty value\n')
|
|
147
232
|
return 1
|
|
148
233
|
}
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
if (r == null || 'refused' in r) {
|
|
153
|
-
this.context.stderr.write(`FAIL: nothing was stored: ${r == null ? 'no vault on this machine' : r.refused}\n`)
|
|
154
|
-
return 1
|
|
155
|
-
}
|
|
156
|
-
this.context.stderr.write(`stored ${this.name} in the vault (v${r.version}, read back, account: ${account}); the keychain is not written\n`)
|
|
157
|
-
return 0
|
|
158
|
-
} catch (e) {
|
|
159
|
-
this.context.stderr.write(`${redact(`FAIL: the vault did not take ${this.name}: ${(e as Error).message}: nothing was stored`, value)}\n`)
|
|
234
|
+
const r = await storeSecretHere({ name: this.name, account: this.account ?? userInfo().username, value, cwd: process.cwd(), w })
|
|
235
|
+
if ('refused' in r) {
|
|
236
|
+
this.context.stderr.write(`FAIL: nothing was stored: ${r.refused}\n`)
|
|
160
237
|
return 1
|
|
161
238
|
}
|
|
239
|
+
this.context.stderr.write(r.lines.map((l) => `${l}\n`).join(''))
|
|
240
|
+
return 0
|
|
162
241
|
})
|
|
163
242
|
}
|
|
164
243
|
}
|
|
165
244
|
|
|
245
|
+
export class SecretRmCommand extends Command {
|
|
246
|
+
static override paths = [['secret', 'rm']]
|
|
247
|
+
|
|
248
|
+
static override usage = Command.Usage({
|
|
249
|
+
category: 'Secrets',
|
|
250
|
+
description: "remove a secret from one store: --keychain (this Mac's copies) or --vault (its current version)",
|
|
251
|
+
details: "`--keychain` deletes every item of the name in this Mac's login keychain, the vault untouched. `--vault` soft deletes the vault's current version on the Mac that runs it (exit 4 when the vault does not hold it), the keychain untouched; older versions stay readable by version. A bare `rm` removes the keychain's items on a Mac that reads no vault, and nothing on one that does (exit 2): a keychain copy there is the owner's to delete.",
|
|
252
|
+
examples: [["this Mac's keychain copies, on the owner's yes", 'sk secret rm --keychain rv/old/thing'], ["the vault's current version", 'sk secret rm --vault rv/old/thing']],
|
|
253
|
+
})
|
|
254
|
+
|
|
255
|
+
keychain = Option.Boolean('--keychain', false, { description: "this Mac's keychain items of the name, never the vault's" })
|
|
256
|
+
vault = Option.Boolean('--vault', false, { description: "the vault's current version, soft deleted, never the keychain" })
|
|
257
|
+
name = Option.String()
|
|
258
|
+
|
|
259
|
+
async execute(): Promise<number> {
|
|
260
|
+
const say = (l: string): void => void this.context.stderr.write(`${l}\n`)
|
|
261
|
+
if (this.keychain && this.vault) {
|
|
262
|
+
say('FAIL: nothing removed: rm names one store, --keychain or --vault')
|
|
263
|
+
return 2
|
|
264
|
+
}
|
|
265
|
+
const { vaultHere, vaultReach, removeSecretHere } = await import('../secrets/read.ts')
|
|
266
|
+
const readsVault = (await vaultReach()) != null
|
|
267
|
+
if (!this.keychain && !this.vault && readsVault) {
|
|
268
|
+
say('FAIL: nothing removed: on a Mac that reads the vault, rm names its store: --keychain (this Mac\'s keychain copies, the vault untouched) or --vault (the vault\'s current version, soft deleted, the keychain untouched)')
|
|
269
|
+
return 2
|
|
270
|
+
}
|
|
271
|
+
if (this.vault) {
|
|
272
|
+
if (!vaultHere()) {
|
|
273
|
+
say('FAIL: nothing removed: this Mac runs no vault; --vault runs on the Mac that runs it')
|
|
274
|
+
return 1
|
|
275
|
+
}
|
|
276
|
+
const r = await removeSecretHere({ name: this.name, cwd: process.cwd(), w: await where(process.cwd()) }).catch((e: Error) => ({ refused: e.message }))
|
|
277
|
+
if (r == null || 'refused' in r) {
|
|
278
|
+
say(`FAIL: the vault's copy was not removed: ${r == null ? 'no vault on this machine' : r.refused}`)
|
|
279
|
+
return 1
|
|
280
|
+
}
|
|
281
|
+
say(r.removed ? `removed ${this.name} from the vault (its newest version, soft deleted: bao kv undelete brings it back)` : `the vault does not hold ${this.name}`)
|
|
282
|
+
if (r.older > 0) {
|
|
283
|
+
const { ROOT_ROAD } = await import('../vault/vault-config.ts')
|
|
284
|
+
say(`note: ${r.older} older version${r.older === 1 ? '' : 's'} of ${this.name} stay${r.older === 1 ? 's' : ''} in the vault and in its snapshots, readable by version: a node token never destroys. A compromised value is revoked where it was issued; destroying it needs ${ROOT_ROAD}`)
|
|
285
|
+
}
|
|
286
|
+
say(`this Mac's keychain copy is untouched (sk secret rm --keychain ${this.name} removes it)`)
|
|
287
|
+
return r.removed ? 0 : 4
|
|
288
|
+
}
|
|
289
|
+
const { keychainWriter } = await import('../secrets/keychain-write.ts')
|
|
290
|
+
let n: number
|
|
291
|
+
try {
|
|
292
|
+
n = keychainWriter().remove(this.name)
|
|
293
|
+
} catch (e) {
|
|
294
|
+
say(`FAIL: nothing removed: ${(e as Error).message}`)
|
|
295
|
+
return 1
|
|
296
|
+
}
|
|
297
|
+
if (n === 0) {
|
|
298
|
+
say(`no such secret in this Mac's keychain: ${this.name}`)
|
|
299
|
+
return 1
|
|
300
|
+
}
|
|
301
|
+
say(`deleted ${this.name} from this Mac's keychain (${n} entr${n === 1 ? 'y' : 'ies'})${readsVault ? "; the vault's copy is untouched" : ''}`)
|
|
302
|
+
return 0
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export class SecretEnvCommand extends Command {
|
|
307
|
+
static override paths = [['secret', 'env']]
|
|
308
|
+
static essential = { args: '<name…>' }
|
|
309
|
+
|
|
310
|
+
static override usage = Command.Usage({
|
|
311
|
+
category: 'Secrets',
|
|
312
|
+
description: "export lines for an eval: `export RV_SECRET_<NAME>='<value>'`, all of them or none",
|
|
313
|
+
details: 'Every name is read before a line prints: a refused or missing name prints no export at all (exit 3, 44 or 36), never the half an eval would take quietly.',
|
|
314
|
+
examples: [['two secrets into this shell', 'eval "$(sk secret env rv/cloudflare/api-token rv/npm/token)"']],
|
|
315
|
+
})
|
|
316
|
+
|
|
317
|
+
names = Option.Rest({ required: 1 })
|
|
318
|
+
|
|
319
|
+
async execute(): Promise<number> {
|
|
320
|
+
return refusing(this.context.stderr, async () => {
|
|
321
|
+
const w = await where(process.cwd())
|
|
322
|
+
const lines: string[] = []
|
|
323
|
+
for (const name of this.names) {
|
|
324
|
+
const r = await readSecretHere({ name, cwd: process.cwd(), w, say: (l) => void this.context.stderr.write(`${l}\n`) })
|
|
325
|
+
if (!('value' in r)) {
|
|
326
|
+
this.context.stderr.write(`${whyOf(r)}\n`)
|
|
327
|
+
return exitOf(r)
|
|
328
|
+
}
|
|
329
|
+
lines.push(`export ${envVarOf(name)}='${r.value.replaceAll("'", "'\\''")}'\n`)
|
|
330
|
+
}
|
|
331
|
+
this.context.stdout.write(lines.join(''))
|
|
332
|
+
return 0
|
|
333
|
+
})
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/** an archive act's lines on stdout, or its refusal on stderr */
|
|
338
|
+
async function acted(c: Command['context'], run: () => Promise<{ lines: string[] } | { refused: string }>): Promise<number> {
|
|
339
|
+
const r = await run()
|
|
340
|
+
if ('refused' in r) {
|
|
341
|
+
c.stderr.write(`FAIL ${r.refused}: nothing changed\n`)
|
|
342
|
+
return 1
|
|
343
|
+
}
|
|
344
|
+
c.stdout.write(r.lines.map((l) => `${l}\n`).join(''))
|
|
345
|
+
return 0
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
export class SecretArchiveCommand extends Command {
|
|
349
|
+
static override paths = [['secret', 'archive']]
|
|
350
|
+
|
|
351
|
+
static override usage = Command.Usage({
|
|
352
|
+
category: 'Secrets',
|
|
353
|
+
description: "keep a secret out of use, undone with unarchive: the vault's soft delete, its registry row marked",
|
|
354
|
+
details: "On the Mac that runs the vault. Never a destroy. Every read of the name then fails with the way back, `sk secret list` leaves it out, and this Mac's keychain copy from before the vault is left and named. Run `sk vault snapshot` after it.",
|
|
355
|
+
examples: [['a key nobody can identify', 'sk secret archive rv/old/key --why "no known consumer"']],
|
|
356
|
+
})
|
|
357
|
+
|
|
358
|
+
name = Option.String()
|
|
359
|
+
why = Option.String('--why', { required: true, description: "why it is archived: kept in the registry row's mark" })
|
|
360
|
+
|
|
361
|
+
async execute(): Promise<number> {
|
|
362
|
+
return refusing(this.context.stderr, async () => acted(this.context, async () => (await import('../secrets/archive.ts')).archiveSecret({ name: this.name, why: this.why, cwd: process.cwd() })))
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
export class SecretUnarchiveCommand extends Command {
|
|
367
|
+
static override paths = [['secret', 'unarchive']]
|
|
368
|
+
|
|
369
|
+
static override usage = Command.Usage({
|
|
370
|
+
category: 'Secrets',
|
|
371
|
+
description: "an archived secret back: the vault's undelete of its current version, read back, its mark removed",
|
|
372
|
+
examples: [['an archived key back in use', 'sk secret unarchive rv/old/key']],
|
|
373
|
+
})
|
|
374
|
+
|
|
375
|
+
name = Option.String()
|
|
376
|
+
|
|
377
|
+
async execute(): Promise<number> {
|
|
378
|
+
return refusing(this.context.stderr, async () => acted(this.context, async () => (await import('../secrets/archive.ts')).unarchiveSecret({ name: this.name, cwd: process.cwd() })))
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
166
382
|
export class SecretCopyCommand extends Command {
|
|
167
383
|
static override paths = [['secret', 'copy']]
|
|
384
|
+
static gloss = "to another Mac's keychain, over ssh"
|
|
168
385
|
|
|
169
386
|
static override usage = Command.Usage({
|
|
170
387
|
category: 'Secrets',
|
|
@@ -186,8 +403,12 @@ export class SecretCopyCommand extends Command {
|
|
|
186
403
|
const rows = secretsFor({ asker: w, own: inHouse ? [] : (w.own?.creds ?? []), house: w.house?.creds ?? [] }).filter((r) => r.inScope)
|
|
187
404
|
const names = this.names.length > 0 ? this.names : rows.map((r) => r.name)
|
|
188
405
|
const { copySecrets, copyWithUnlock } = await import('../secrets/copy.ts')
|
|
189
|
-
|
|
190
|
-
|
|
406
|
+
const read = async (name: string, field: 'get' | 'account'): Promise<string | null> => {
|
|
407
|
+
const r = await readSecretHere({ name, field, cwd: process.cwd(), w, say: () => {} })
|
|
408
|
+
return 'value' in r ? r.value : null
|
|
409
|
+
}
|
|
410
|
+
if (this.unlock) return copyWithUnlock({ names, to: this.to, read, houseRel: relative(homedir(), houseRoot), say: (l) => void this.context.stdout.write(`${l}\n`) })
|
|
411
|
+
const r = await copySecrets({ names, to: this.to, read, houseRel: relative(homedir(), houseRoot) })
|
|
191
412
|
for (const c of r.copied) this.context.stdout.write(`${c.did === 'failed' ? 'FAIL' : c.did === 'copied' ? 'ok ' : 'skip'} ${c.name} ${c.did}${c.why ? `: ${c.why}` : ''}\n`)
|
|
192
413
|
const n = (d: string): number => r.copied.filter((c) => c.did === d).length
|
|
193
414
|
this.context.stdout.write(`${n('copied')} copied, ${n('there')} already on ${this.to}, ${n('not here')} not on this Mac, ${n('failed')} failed${r.locked ? ' (stopped: locked)' : ''}\n`)
|
package/src/cli/cmd_Social.ts
CHANGED
|
@@ -106,11 +106,10 @@ class SocialPostCommand extends Command {
|
|
|
106
106
|
category: 'Social',
|
|
107
107
|
description: 'one draft across every account of its headings: posted with its date and link, or waiting',
|
|
108
108
|
details:
|
|
109
|
-
"The draft by its
|
|
109
|
+
"The draft by its slug or its topic. --publish posts the waiting posts of its accounts whose automation is live (Discord, Bluesky), each link recorded as the post's state; a posted one stays « already posted ». --edit sends a posted message's text again at its link where the venue edits in place (Discord), and names why where it cannot: never a second copy. --only <key> keeps one message, its heading's key (`discord`, `discord/nsfw`), else an account's every message. A message the repo's guard or a place refuses never posts. Every other account waits for his paste: nothing posts without an order. Page: wiki tools/shipkit/social.md, `sk social`",
|
|
110
110
|
examples: [
|
|
111
111
|
['by its topic', 'sk social post arena-face-lift'],
|
|
112
112
|
['by its whole name', 'sk social post 20261025-131139-arena-face-lift'],
|
|
113
|
-
['by its path', 'sk social post .shipkit/social/drafts/20261025-131139-arena-face-lift/'],
|
|
114
113
|
['a pinned #welcome whose text changed, edited at its link', 'sk social post welcome --only discord --publish --edit'],
|
|
115
114
|
["a release's #announcements line, at release", 'sk social post 20261108-120000-app-1-2-0 --only discord --publish'],
|
|
116
115
|
],
|
|
@@ -129,9 +128,12 @@ class SocialPostCommand extends Command {
|
|
|
129
128
|
if (only != null && !d.posts.some((p) => p.platform === only || p.key === only)) throw new Error(`${d.slug} has no message to ${only} (${[...new Set(d.posts.map((p) => p.key))].join(', ') || 'none'})`)
|
|
130
129
|
if (this.publish) {
|
|
131
130
|
const { publishDraft } = await import('../social/publish/index.ts')
|
|
132
|
-
|
|
133
|
-
const
|
|
134
|
-
|
|
131
|
+
// its files on the disk first, then the desk loaded again: the guard and the cover read the bytes it sends
|
|
132
|
+
const { draftMediaHere } = await import('../social/media-kind.ts')
|
|
133
|
+
const { onlyOf } = await import('../social/publish/index.ts')
|
|
134
|
+
await draftMediaHere(desk, d.slug, onlyOf(d.posts, only ?? undefined).map((p) => p.key))
|
|
135
|
+
const fresh = (await model(undefined)).desk
|
|
136
|
+
for (const r of await publishDraft(fresh, d.slug, { ...(only != null ? { only } : {}), edit: this.edit })) say(this.context)(`${r.key}: ${r.line}`)
|
|
135
137
|
return 0
|
|
136
138
|
}
|
|
137
139
|
const { socialModel, postText } = await import('../social/text.ts')
|
|
@@ -247,9 +249,9 @@ class SocialThumbnailCommand extends Command {
|
|
|
247
249
|
static override paths = [['social', 'thumbnail']]
|
|
248
250
|
static override usage = Command.Usage({
|
|
249
251
|
category: 'Social',
|
|
250
|
-
description: "a video's thumbnail
|
|
252
|
+
description: "a video's thumbnail, 1280x720: a frame beside the brand's name and line, or a game's poster",
|
|
251
253
|
details:
|
|
252
|
-
"The identity kit draws it from .shipkit/identity/brand.ts (its ground, accent, ink, mark and the trailer's face, else Inter 800): the mark, the name huge, one line in the accent, an optional mono chip on the left; the frame as a tilted card on the right; an optional ribbon. A jpg under YouTube's 2 MB, written beside the video as <video>-thumbnail.jpg unless --out. The frame: --at seconds into the video (default its first lit frame past 1 s), or --frame <still>; --crop x,y,w,h keeps the product's interesting part, in pixels or as shares of the frame. --title is the brand's name, --line its tagline unless given; a text too long to read at YouTube's small size is refused, never cut. With --draft <draft>, the video defaults to the draft's own, the jpg lands in its media as <its video>-thumbnail.jpg after that video, its recipe is kept as the draft's thumbnail: line, and the files are committed; --draft alone makes it again from that line after a re-cut. The cover: Reddit and X take no uploaded picture, only a frame of the video, frame 0 first; so with --draft each of the draft's videos opens on the thumbnail, held 3 frames (0.1 s at 30 fps) with the sound delayed as long, encoded again at its own bitrates in place; a video that already opens on it is left as it is, an older cover is replaced. --no-cover leaves the videos as they are, kept in the recipe; --cover without --draft writes <video>-covered.mp4 beside the video. --plain writes the frame as it is, nothing drawn and no brand read, a jpg or a png by --out: an upright trailer's start image, a trailer's end image (wiki tools/trailer/index.md). Page: wiki tools/shipkit/social.md, A video's thumbnail",
|
|
254
|
+
"The identity kit draws it from .shipkit/identity/brand.ts (its ground, accent, ink, mark and the trailer's face, else Inter 800): the mark, the name huge, one line in the accent, an optional mono chip on the left; the frame as a tilted card on the right; an optional ribbon. A jpg under YouTube's 2 MB, written beside the video as <video>-thumbnail.jpg unless --out. The frame: --at seconds into the video (default its first lit frame past 1 s), or --frame <still>; --crop x,y,w,h keeps the product's interesting part, in pixels or as shares of the frame. --title is the brand's name, --line its tagline unless given; a text too long to read at YouTube's small size is refused, never cut. With --draft <draft>, the video defaults to the draft's own, the jpg lands in its media as <its video>-thumbnail.jpg after that video, its recipe is kept as the draft's thumbnail: line, and the files are committed; --draft alone makes it again from that line after a re-cut. The cover: Reddit and X take no uploaded picture, only a frame of the video, frame 0 first; so with --draft each of the draft's videos opens on the thumbnail, held 3 frames (0.1 s at 30 fps) with the sound delayed as long, encoded again at its own bitrates in place; a video that already opens on it is left as it is, an older cover is replaced. --no-cover leaves the videos as they are, kept in the recipe; --cover without --draft writes <video>-covered.mp4 beside the video. --plain writes the frame as it is, nothing drawn and no brand read, a jpg or a png by --out: an upright trailer's start image, a trailer's end image (wiki tools/trailer/index.md). --layout poster is a game's or a studio's look: the frame fills the picture, a soft shade on the side the words take (--place left, right or center), the name huge on one or two lines or the game's own lettering (--wordmark <png>), the line in spaced capitals, labels as pills (--tag, repeated), up to three cut outs on the other side with a warm rim of light (--figure <png>[:flip], repeated), the studio's mark in a free bottom corner (--studio <png>). A brand keeps its recipe as thumbnail: { layout, place, wordmark, figures, studio, tags, line, badge } in brand.ts, paths from the repo's root, so every video of the repo wears it; a flag wins over its field. Page: wiki tools/shipkit/social.md, A video's thumbnail",
|
|
253
255
|
examples: [
|
|
254
256
|
['a frame and the words', 'sk social thumbnail trailer/app/versions/v3/app-v3.mp4 --at 12.5 --crop 515,272,705,432 --line "Your app, typed." --chip "bun add app"'],
|
|
255
257
|
["a trailer post's, its recipe kept in the draft", 'sk social thumbnail --draft 20261119-174922-trailer --at 70 --crop 0.4,0.38,0.55,0.6'],
|
|
@@ -257,6 +259,7 @@ class SocialThumbnailCommand extends Command {
|
|
|
257
259
|
['a covered copy of a video, frame 0 the thumbnail', 'sk social thumbnail trailer/app/versions/v3/app-v3.mp4 --at 12.5 --cover'],
|
|
258
260
|
['a still, with a ribbon', 'sk social thumbnail --frame shots/town.png --badge pre-alpha --out media/town-thumbnail.jpg'],
|
|
259
261
|
["a trailer's end image, the frame as it is", 'sk social thumbnail trailer/app/out/app.mp4 --at 61.9 --plain --out trailer/app/endcard.png'],
|
|
262
|
+
["a game's poster: its lettering, two heroes facing off, the studio's mark", 'sk social thumbnail --frame shots/lagoon.png --layout poster --wordmark art/title.png --figure art/knight.png --figure art/ogre.png:flip --tag "launch trailer" --studio art/studio.png --out trailer/launch/main-thumbnail.jpg'],
|
|
260
263
|
],
|
|
261
264
|
})
|
|
262
265
|
video = Option.String({ required: false })
|
|
@@ -271,6 +274,12 @@ class SocialThumbnailCommand extends Command {
|
|
|
271
274
|
plain = Option.Boolean('--plain', false, { description: 'the frame as it is, nothing drawn on it (a trailer start image of an upright cut, an end image)' })
|
|
272
275
|
draft = Option.String('--draft', { description: "a draft: its video, its media, its thumbnail: recipe kept" })
|
|
273
276
|
cover = Option.Boolean('--cover', { description: 'the video opens on the thumbnail, its first 3 frames (default: on with --draft, its videos in place; off without, else <video>-covered.mp4)' })
|
|
277
|
+
layout = Option.String('--layout', { description: "card (the frame as a tilted card beside the words) or poster (the frame fills the picture, a game's look) (default: the brand's thumbnail.layout, else card)" })
|
|
278
|
+
place = Option.String('--place', { description: 'a poster: where the words sit, left, right or center; the figures stand on the other side (default: left)' })
|
|
279
|
+
wordmark = Option.String('--wordmark', { description: "a poster: the name as a picture, the game's own lettering, drawn in place of the name's words" })
|
|
280
|
+
figure = Option.Array('--figure', { description: 'a poster: a cut out on the free side, <png>[:flip], repeated, three at most' })
|
|
281
|
+
tag = Option.Array('--tag', { description: 'a poster: a label under the line, a pill, repeated' })
|
|
282
|
+
studio = Option.String('--studio', { description: "a poster: the studio's mark in a free bottom corner" })
|
|
274
283
|
override async execute(): Promise<number> {
|
|
275
284
|
return guarded(this.context, async () => {
|
|
276
285
|
const { relative, resolve } = await import('node:path')
|
|
@@ -282,7 +291,22 @@ class SocialThumbnailCommand extends Command {
|
|
|
282
291
|
const unit = await loadSocialUnit(root)
|
|
283
292
|
const at = this.at === undefined ? undefined : Number(this.at)
|
|
284
293
|
if (at !== undefined && !(at >= 0)) throw new Error(`--at ${this.at}: seconds into the video`)
|
|
285
|
-
const words = {
|
|
294
|
+
const words = {
|
|
295
|
+
...(this.plain ? { plain: true } : {}),
|
|
296
|
+
...(this.crop ? { crop: this.crop } : {}),
|
|
297
|
+
...(this.title ? { title: this.title } : {}),
|
|
298
|
+
...(this.line ? { line: this.line } : {}),
|
|
299
|
+
...(this.chip ? { chip: this.chip } : {}),
|
|
300
|
+
...(this.badge ? { badge: this.badge } : {}),
|
|
301
|
+
...(this.layout ? { layout: t.layoutOf(this.layout) } : {}),
|
|
302
|
+
...(this.place ? { place: t.placeOf(this.place) } : {}),
|
|
303
|
+
...(this.tag?.length ? { tag: this.tag } : {}),
|
|
304
|
+
}
|
|
305
|
+
const pictures = (at: (p: string) => string) => ({
|
|
306
|
+
...(this.wordmark ? { wordmark: at(this.wordmark) } : {}),
|
|
307
|
+
...(this.studio ? { studio: at(this.studio) } : {}),
|
|
308
|
+
...(this.figure?.length ? { figure: this.figure.map(at) } : {}),
|
|
309
|
+
})
|
|
286
310
|
const kb = (n: number): string => `${Math.round(n / 1000)} KB`
|
|
287
311
|
if (this.draft) {
|
|
288
312
|
if (this.out) throw new Error('--out and --draft: a draft names its thumbnail after its video')
|
|
@@ -291,7 +315,7 @@ class SocialThumbnailCommand extends Command {
|
|
|
291
315
|
const d = findDraft(desk, this.draft, cwd)
|
|
292
316
|
// a path the agent typed is kept from the repo's root, so the recipe reads the same from any folder
|
|
293
317
|
const rooted = (p: string | undefined): string | undefined => (p === undefined ? undefined : relative(root, resolve(cwd, p)))
|
|
294
|
-
const r = await t.thumbnailDraft(root, d.slug, { ...words, ...(this.video ? { video: rooted(this.video) } : {}), ...(this.frame ? { frame: rooted(this.frame) } : {}), ...(at !== undefined ? { at } : {}), ...(this.cover !== undefined ? { cover: this.cover } : {}) }, { unit })
|
|
318
|
+
const r = await t.thumbnailDraft(root, d.slug, { ...words, ...pictures((p) => relative(root, resolve(cwd, p))), ...(this.video ? { video: rooted(this.video) } : {}), ...(this.frame ? { frame: rooted(this.frame) } : {}), ...(at !== undefined ? { at } : {}), ...(this.cover !== undefined ? { cover: this.cover } : {}) }, { unit })
|
|
295
319
|
say(this.context)(`ok: ${d.slug} ${r.media} (${kb(r.bytes)}${r.at != null ? `, the frame at ${r.at} s` : ''}), its recipe kept as thumbnail: ${t.recipeLine(r.recipe)}`)
|
|
296
320
|
for (const c of r.covers)
|
|
297
321
|
say(this.context)(
|
|
@@ -302,7 +326,7 @@ class SocialThumbnailCommand extends Command {
|
|
|
302
326
|
for (const n of r.notes) say(this.context)(`note: ${n}`)
|
|
303
327
|
return 0
|
|
304
328
|
}
|
|
305
|
-
const r = await t.makeThumbnail(root, { ...words, ...(this.video ? { video: this.video } : {}), ...(this.frame ? { frame: this.frame } : {}), ...(at !== undefined ? { at } : {}), ...(this.out ? { out: this.out } : {}) }, cwd, unit)
|
|
329
|
+
const r = await t.makeThumbnail(root, { ...words, ...pictures((p) => p), ...(this.video ? { video: this.video } : {}), ...(this.frame ? { frame: this.frame } : {}), ...(at !== undefined ? { at } : {}), ...(this.out ? { out: this.out } : {}) }, cwd, unit)
|
|
306
330
|
say(this.context)(`ok: ${relative(cwd, r.file)} (${kb(r.bytes)}${r.at != null ? `, the frame at ${r.at} s` : ''})`)
|
|
307
331
|
say(this.context)(`its recipe: sk social thumbnail ${t.recipeLine(r.recipe)}`)
|
|
308
332
|
if (this.cover) {
|
|
@@ -374,27 +398,6 @@ class SocialStateCommand extends Command {
|
|
|
374
398
|
}
|
|
375
399
|
}
|
|
376
400
|
|
|
377
|
-
class SocialMigrateCommand extends Command {
|
|
378
|
-
static override paths = [['social', 'migrate']]
|
|
379
|
-
static override usage = Command.Usage({
|
|
380
|
-
category: 'Social',
|
|
381
|
-
description: "the repo's v2 channel files become drafts, once: one draft a slug, a heading a channel",
|
|
382
|
-
details:
|
|
383
|
-
'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.',
|
|
384
|
-
examples: [['the plan', 'sk social migrate --dry'], ['do it', 'sk social migrate']],
|
|
385
|
-
})
|
|
386
|
-
dry = Option.Boolean('--dry', false, { description: 'print the plan, write nothing' })
|
|
387
|
-
override async execute(): Promise<number> {
|
|
388
|
-
return guarded(this.context, async () => {
|
|
389
|
-
const { findRepoRoot } = await import('../ts/config.ts')
|
|
390
|
-
const { migrateV2 } = await import('../social/migrate.ts')
|
|
391
|
-
const r = migrateV2(findRepoRoot(process.cwd()), { dry: this.dry })
|
|
392
|
-
for (const l of r.lines) say(this.context)(l)
|
|
393
|
-
return 0
|
|
394
|
-
})
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
|
|
398
401
|
class SocialDiscordApplyCommand extends Command {
|
|
399
402
|
static override paths = [['social', 'discord', 'apply']]
|
|
400
403
|
static override usage = Command.Usage({
|
|
@@ -443,7 +446,7 @@ class IdentitiesCommand extends Command {
|
|
|
443
446
|
static override usage = Command.Usage({
|
|
444
447
|
category: 'Social',
|
|
445
448
|
description: 'every identity of the machine: its accounts online over its accounts, and the repos speaking as it',
|
|
446
|
-
details: "One folder an identity in the house repo's
|
|
449
|
+
details: "One folder an identity in the house repo's wiki/identities/ (wiki meta/identity-folder). Every repo names its own with speaksAs in repo.config.ts (SK038 fails one that names none). Each identity lists the repos seen from here that speak as it, archived ones apart; seen from outside a folder of house repos, it lists none and says so. Page: wiki tools/shipkit/social.md",
|
|
447
450
|
examples: [['every identity', 'sk identities'], ['as json', 'sk identities --json']],
|
|
448
451
|
})
|
|
449
452
|
json = Option.Boolean('--json', false, { description: 'one json object' })
|
|
@@ -540,4 +543,4 @@ class IdentitiesPushCommand extends Command {
|
|
|
540
543
|
}
|
|
541
544
|
}
|
|
542
545
|
|
|
543
|
-
export const SOCIAL_COMMANDS = [SocialCommand, SocialTimelineCommand, SocialCoverageCommand, SocialPostCommand, SocialReleaseCommand, SocialReleaseCardCommand, SocialThumbnailCommand, SocialPlanCommand, SocialStateCommand,
|
|
546
|
+
export const SOCIAL_COMMANDS = [SocialCommand, SocialTimelineCommand, SocialCoverageCommand, SocialPostCommand, SocialReleaseCommand, SocialReleaseCardCommand, SocialThumbnailCommand, SocialPlanCommand, SocialStateCommand, SocialDiscordApplyCommand, IdentitiesCommand, IdentitiesPushCommand]
|