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_Commands.ts
CHANGED
|
@@ -25,6 +25,12 @@ export type CommandRow = {
|
|
|
25
25
|
stamp?: string[]
|
|
26
26
|
/** listed on the essentials page */
|
|
27
27
|
essential?: Essential
|
|
28
|
+
/** a few words beside its name where the name alone misleads */
|
|
29
|
+
gloss?: string
|
|
30
|
+
/** the other paths its class answers to: `gp` for `global-processes` */
|
|
31
|
+
aliases?: string[]
|
|
32
|
+
/** an older name that still runs for the callers that type it, left out of every list (its class's `older`) */
|
|
33
|
+
older?: boolean
|
|
28
34
|
/** acts beyond this machine or spends money: the hub asks before it runs (cli/kit/verb.ts) */
|
|
29
35
|
effect?: Effect
|
|
30
36
|
/** what a kit row runs */
|
|
@@ -89,7 +95,11 @@ export function commandRows(plain: Definition[], detailed: Definition[] = [], bi
|
|
|
89
95
|
if (m.words != null) row.words = m.words
|
|
90
96
|
if (m.stamp != null) row.stamp = m.stamp
|
|
91
97
|
if (m.essential != null) row.essential = m.essential
|
|
98
|
+
if (m.gloss != null) row.gloss = m.gloss
|
|
92
99
|
if (m.effect != null) row.effect = m.effect
|
|
100
|
+
if ((c as { older?: boolean }).older === true) row.older = true
|
|
101
|
+
const aliases = ((c as { paths?: string[][] }).paths ?? []).map((p) => p.join(' ')).filter((p) => p !== path)
|
|
102
|
+
if (aliases.length > 0) row.aliases = aliases
|
|
93
103
|
const v = ROW_OF.get(c)
|
|
94
104
|
if (v != null) row.runs = runText(v.run)
|
|
95
105
|
}
|
|
@@ -127,6 +137,7 @@ export function renderCompact(rows: CommandRow[], bin = 'sk', pages: Readonly<Re
|
|
|
127
137
|
const out: string[] = []
|
|
128
138
|
let cat = ''
|
|
129
139
|
for (const r of rows) {
|
|
140
|
+
if (r.older === true) continue
|
|
130
141
|
if (r.category !== cat) { cat = r.category; out.push(`\n### ${cat}${pages?.[cat] != null ? ` → ${pages[cat]}` : ''}\n`) }
|
|
131
142
|
out.push(compactLine(r, bin))
|
|
132
143
|
}
|
|
@@ -145,53 +156,140 @@ const essentialLines = (r: CommandRow, bin: string, sep: string): string[] => {
|
|
|
145
156
|
return [`- \`${bin} ${r.path}${e.args != null ? ` ${e.args}` : ''}\`${sep}${r.description}`, ...r.examples.slice(0, e.examples ?? 0).map(([label, cmd]) => ` - \`${cmd}\`: ${label}`)]
|
|
146
157
|
}
|
|
147
158
|
|
|
148
|
-
/**
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
159
|
+
/** the longest gloss: a few words, never a description */
|
|
160
|
+
export const GLOSS_MAX = 40
|
|
161
|
+
|
|
162
|
+
const firstWord = (path: string): string => path.split(' ')[0]!
|
|
163
|
+
|
|
164
|
+
/** every path the rows answer to, an alias with the path of its class */
|
|
165
|
+
const pathsOf = (rows: CommandRow[]): Map<string, string | null> => {
|
|
166
|
+
const out = new Map<string, string | null>()
|
|
167
|
+
for (const r of rows) { out.set(r.path, null); for (const a of r.aliases ?? []) out.set(a, r.path) }
|
|
168
|
+
return out
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** an alias word that only mirrors another family, verb for verb: `gp` for `global-processes`. Its pair line
|
|
172
|
+
* names every one of its paths, so the word must hold no path of its own and leave no verb of the family out */
|
|
173
|
+
const mirrorOf = (w: string, paths: Map<string, string | null>): string | null => {
|
|
174
|
+
const mine = [...paths].filter(([p]) => firstWord(p) === w)
|
|
175
|
+
const of = mine[0]?.[1]
|
|
176
|
+
if (of == null || mine.some(([, o]) => o == null)) return null
|
|
177
|
+
const pw = firstWord(of)
|
|
178
|
+
if (pw === w || !mine.every(([p, o]) => o === `${pw}${p.slice(w.length)}`)) return null
|
|
179
|
+
const theirs = [...paths].filter(([p, o]) => o == null && firstWord(p) === pw)
|
|
180
|
+
return mine.length >= 2 && theirs.length === mine.length ? pw : null
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** every command of a family the page does not describe, by name: one usage span per first word, `<a|b>`
|
|
184
|
+
* when the word alone runs nothing, `[a|b]` when it runs too, a lone verb whole; an alias with what it names;
|
|
185
|
+
* a word that mirrors a family as one pair. `paths` is every path of the binary, so a bare word that runs
|
|
186
|
+
* through an alias reads as one that runs */
|
|
187
|
+
const restOf = (all: CommandRow[], bin: string, paths: Map<string, string | null>): string[] => {
|
|
188
|
+
type Name = { path: string; gloss?: string; of?: string }
|
|
189
|
+
const names: Name[] = []
|
|
190
|
+
for (const r of all) {
|
|
191
|
+
if (r.essential == null) names.push({ path: r.path, ...(r.gloss != null ? { gloss: r.gloss } : {}) })
|
|
192
|
+
for (const a of r.aliases ?? []) names.push({ path: a, gloss: `= ${bin} ${r.path}`, of: r.path })
|
|
193
|
+
}
|
|
194
|
+
const out: string[] = []
|
|
195
|
+
for (const w of [...new Set(names.map((n) => firstWord(n.path)))].sort()) {
|
|
196
|
+
const mine = names.filter((n) => firstWord(n.path) === w).sort((a, b) => a.path.localeCompare(b.path))
|
|
197
|
+
const pw = mirrorOf(w, paths)
|
|
198
|
+
if (pw != null) { out.push(`\`${bin} ${w} …\` = \`${bin} ${pw} …\``); continue }
|
|
199
|
+
const subs = mine.filter((n) => n.path !== w)
|
|
200
|
+
const bare = mine.find((n) => n.path === w)
|
|
201
|
+
const tail = (n: Name): string => (n === bare ? w : n.path.slice(w.length + 1))
|
|
202
|
+
// an alias of the same verb under another word: `review ask` = `thread ask`
|
|
203
|
+
const sameVerb = (n: Name): string | null => (n.of != null && firstWord(n.of) !== w && n.of === `${firstWord(n.of)}${n.path.slice(w.length)}` ? firstWord(n.of) : null)
|
|
204
|
+
const spans: [string, Name[]][] = subs.length >= 2
|
|
205
|
+
? [[`${bin} ${w} ${paths.has(w) ? `[${subs.map(tail).join('|')}]` : `<${subs.map(tail).join('|')}>`}`, mine]]
|
|
206
|
+
: mine.map((n) => [`${bin} ${n.path}`, [n]])
|
|
207
|
+
for (const [span, shown] of spans) {
|
|
208
|
+
const glossed = shown.filter((n) => n.gloss != null)
|
|
209
|
+
// three aliases or more of one word, verb for verb: one phrase, the others after it
|
|
210
|
+
const counts = new Map<string, number>()
|
|
211
|
+
for (const n of glossed) { const v = sameVerb(n); if (v != null) counts.set(v, (counts.get(v) ?? 0) + 1) }
|
|
212
|
+
const pw = [...counts].find(([, c]) => c >= 3)?.[0]
|
|
213
|
+
const parts = glossed.filter((n) => pw == null || sameVerb(n) !== pw).map((n) => (shown.length === 1 ? n.gloss! : `${tail(n)}: ${n.gloss}`))
|
|
214
|
+
const gloss = [...(pw != null ? [`= ${bin} ${pw} verb for verb`] : []), ...parts].join('; ')
|
|
215
|
+
out.push(`\`${span}\`${gloss === '' ? '' : ` (${gloss})`}`)
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return out
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/** the command paths a page names. A described line (`— ` on shipkit's page, `: ` on a project's) names the
|
|
222
|
+
* longest registered path its command starts with. A name line (`- more:` or a family line) names `sk w`,
|
|
223
|
+
* each `sk w <a|b>`, `sk w` itself under `[a|b]`, and under `sk w …` = `sk p …` every path of `w` */
|
|
224
|
+
export function namedPaths(text: string, known: Map<string, string | null>, bin = 'sk'): { named: Set<string>; unknown: string[] } {
|
|
225
|
+
const named = new Set<string>()
|
|
226
|
+
const unknown: string[] = []
|
|
227
|
+
const longest = [...known.keys()].sort((a, b) => b.length - a.length)
|
|
228
|
+
for (const line of text.split('\n')) {
|
|
229
|
+
const d = line.startsWith(`- \`${bin} `) ? /^- `([^`]+)`(?: — |: )/.exec(line) : null
|
|
230
|
+
if (d != null) {
|
|
231
|
+
const p = longest.find((k) => d[1] === `${bin} ${k}` || d[1]!.startsWith(`${bin} ${k} `))
|
|
232
|
+
if (p != null) named.add(p)
|
|
233
|
+
else unknown.push(d[1]!)
|
|
234
|
+
continue
|
|
235
|
+
}
|
|
236
|
+
if (!line.startsWith('- ') || line.startsWith('- `')) continue
|
|
237
|
+
const rest = line.replace(new RegExp(`\`${bin} ([\\w-]+) …\` = \`${bin} ([\\w-]+) …\``, 'g'), (_pair: string, w: string, pw: string) => {
|
|
238
|
+
if (mirrorOf(w, known) !== pw) { unknown.push(`${w} … = ${pw} …`); return '' }
|
|
239
|
+
for (const k of known.keys()) if (firstWord(k) === w) named.add(k)
|
|
240
|
+
return ''
|
|
241
|
+
})
|
|
242
|
+
for (const m of rest.matchAll(new RegExp(`\`${bin} ([^\`]+)\``, 'g'))) {
|
|
243
|
+
const g = /^([\w-]+(?: [\w-]+)*?)(?: ([[<])([^\]>]*)[\]>])?$/.exec(m[1]!)
|
|
244
|
+
if (g == null) { unknown.push(m[1]!); continue }
|
|
245
|
+
const [, w, open, inner] = g
|
|
246
|
+
const these = [...(open !== '<' ? [w!] : []), ...(inner?.split('|') ?? []).map((s) => `${w} ${s}`)]
|
|
247
|
+
for (const p of these) (known.has(p) ? named.add(p) : unknown.push(p))
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return { named, unknown }
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/** the guard of the page every session loads: every path the binary answers to named on it, no name the
|
|
254
|
+
* binary does not register, every gloss a few words. One line per breach */
|
|
255
|
+
export function namingProblems(rows: CommandRow[], text: string, bin = 'sk'): string[] {
|
|
256
|
+
const known = pathsOf(rows)
|
|
257
|
+
const { named, unknown } = namedPaths(text, known, bin)
|
|
258
|
+
// an older name runs for the callers that type it and is listed nowhere on purpose
|
|
259
|
+
const older = new Set(rows.filter((r) => r.older === true).flatMap((r) => [r.path, ...(r.aliases ?? [])]))
|
|
260
|
+
return [
|
|
261
|
+
...[...known.keys()].filter((p) => !named.has(p) && !older.has(p)).map((p) => `${bin} ${p}: registered, named nowhere on the page`),
|
|
262
|
+
...unknown.map((p) => `${bin} ${p}: named on the page, registered nowhere`),
|
|
263
|
+
...rows.filter((r) => (r.gloss?.length ?? 0) > GLOSS_MAX).map((r) => `${bin} ${r.path}: gloss over ${GLOSS_MAX} characters`),
|
|
264
|
+
]
|
|
155
265
|
}
|
|
156
266
|
|
|
157
|
-
/** the block of a page every session loads: the commands marked essential
|
|
158
|
-
* family, then every other family on one line with its owner page.
|
|
159
|
-
|
|
267
|
+
/** the block of a page every session loads: the commands marked essential with their description, then every
|
|
268
|
+
* other command of the family by name, then every other family on one line with its owner page. shipkit's
|
|
269
|
+
* page nests it under `##` and separates with ` — `, a project's essentials page is its own (`##`, `: `) */
|
|
270
|
+
export function renderEveryday(listed: CommandRow[], bin = 'sk', pages: Readonly<Record<string, string>> | null = null, form: { heading: string; sep: string } = { heading: '###', sep: ' — ' }): string {
|
|
271
|
+
const rows = listed.filter((r) => r.older !== true)
|
|
160
272
|
const out: string[] = []
|
|
161
273
|
const quiet: string[] = []
|
|
274
|
+
const paths = pathsOf(rows)
|
|
162
275
|
for (const category of [...new Set(rows.map((r) => r.category))]) {
|
|
163
276
|
const all = rows.filter((r) => r.category === category)
|
|
164
277
|
const mine = all.filter((r) => r.essential != null)
|
|
165
278
|
const page = pages?.[category] != null ? ` → ${pages[category]}` : ''
|
|
166
|
-
const rest = restOf(all, bin)
|
|
279
|
+
const rest = restOf(all, bin, paths)
|
|
167
280
|
if (mine.length === 0) { quiet.push(`- ${category}${page}: ${rest.join(', ')}`); continue }
|
|
168
|
-
out.push(`\n
|
|
169
|
-
for (const r of mine) out.push(...essentialLines(r, bin,
|
|
281
|
+
out.push(`\n${form.heading} ${category}${page}\n`)
|
|
282
|
+
for (const r of mine) out.push(...essentialLines(r, bin, form.sep))
|
|
170
283
|
if (rest.length > 0) out.push(`- more: ${rest.join(', ')}`)
|
|
171
284
|
}
|
|
172
|
-
if (quiet.length > 0) out.push(
|
|
285
|
+
if (quiet.length > 0) out.push(`\n${form.heading} The other families, every command by name\n`, ...quiet)
|
|
173
286
|
return out.join('\n').trim()
|
|
174
287
|
}
|
|
175
288
|
|
|
176
|
-
/**
|
|
177
|
-
* examples, and how to list the rest. Generated whole */
|
|
289
|
+
/** a project CLI's page every session loads, generated whole: the everyday block of shipkit's own page */
|
|
178
290
|
export function renderEssentials(rows: CommandRow[], bin: string, command: string): string {
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
const quiet: string[] = []
|
|
182
|
-
for (const category of [...new Set(rows.map((r) => r.category))]) {
|
|
183
|
-
const all = rows.filter((r) => r.category === category)
|
|
184
|
-
const rest = [...new Set(all.map(first))]
|
|
185
|
-
.map((w) => [w, all.filter((r) => first(r) === w && r.essential == null).length] as const)
|
|
186
|
-
.filter(([, n]) => n > 0)
|
|
187
|
-
.map(([w, n]) => `\`${bin} ${w}${all.some((r) => r.path === w) ? ' --help' : ''}\` (${n} command${n === 1 ? '' : 's'})`)
|
|
188
|
-
const mine = all.filter((r) => r.essential != null)
|
|
189
|
-
if (mine.length === 0) { quiet.push(...rest); continue }
|
|
190
|
-
out.push('', `## ${category}${rest.length > 0 ? ` (more: ${rest.join(', ')})` : ''}`, '')
|
|
191
|
-
for (const r of mine) out.push(...essentialLines(r, bin, ': '))
|
|
192
|
-
}
|
|
193
|
-
if (quiet.length > 0) out.push('', `## The other families: ${quiet.join(', ')}`)
|
|
194
|
-
return `${out.join('\n')}\n`
|
|
291
|
+
const head = `# ${bin}: the everyday commands\n\nGenerated by \`${command}\`: the commands marked \`essential\` described, every other one named. All of them described: \`${bin}\`; one with its flags: \`${bin} <command> --help\`. \`${bin} <words>\` runs as \`bun run cli <words>\` from the repo root, and as \`${bin}\` anywhere once \`bun link\` ran there.`
|
|
292
|
+
return `${head}\n\n${renderEveryday(rows, bin, null, { heading: '##', sep: ': ' })}\n`
|
|
195
293
|
}
|
|
196
294
|
|
|
197
295
|
/** a family with no owner page, and a page for a family no command has: one line each */
|
|
@@ -268,7 +366,7 @@ export class CommandsCommand extends Command {
|
|
|
268
366
|
out = Option.String('--out', { description: 'host file carrying the <bin>:commands markers. The block between them is rewritten' })
|
|
269
367
|
check = Option.Boolean('--check', false, { description: 'with --out or --essentials: exit 1 if a page is stale, write nothing' })
|
|
270
368
|
compact = Option.Boolean('--compact', false, { description: 'one line per command: no flags, no examples (they are `<bin> <command> --help`)' })
|
|
271
|
-
everyday = Option.Boolean('--everyday', false, { description: 'the
|
|
369
|
+
everyday = Option.Boolean('--everyday', false, { description: 'the form of a page every session loads: the commands marked essential described, every other command named' })
|
|
272
370
|
essentials = Option.String('--essentials', { description: 'the everyday commands page, rewritten whole from the commands marked essential' })
|
|
273
371
|
|
|
274
372
|
async execute(): Promise<number> {
|
|
@@ -297,6 +395,11 @@ export class CommandsCommand extends Command {
|
|
|
297
395
|
for (const b of bad) write(`FAIL: ${b}\n`)
|
|
298
396
|
if (bad.length > 0) { write(' fix: one row per family in src/cli/family-pages.ts, the wiki page that owns it\n'); return 1 }
|
|
299
397
|
}
|
|
398
|
+
if (this.out != null && this.everyday) {
|
|
399
|
+
const bad = namingProblems(rows, render(), bin)
|
|
400
|
+
for (const b of bad) write(`FAIL: ${b}\n`)
|
|
401
|
+
if (bad.length > 0) { write(' fix: renderEveryday in src/cli/cmd_Commands.ts names every registered command\n'); return 1 }
|
|
402
|
+
}
|
|
300
403
|
if ((this.constructor as typeof CommandsCommand).shapeRule) {
|
|
301
404
|
const bad = shapeProblems(rows, bin)
|
|
302
405
|
for (const b of bad) write(`FAIL: ${b}\n`)
|
|
@@ -309,6 +412,9 @@ export class CommandsCommand extends Command {
|
|
|
309
412
|
if (this.essentials != null) {
|
|
310
413
|
const cmd = `${bin} commands${this.out != null ? ` --out ${this.out}` : ''} --essentials ${this.essentials}`
|
|
311
414
|
const text = renderEssentials(rows, bin, cmd)
|
|
415
|
+
const bad = namingProblems(rows, text, bin)
|
|
416
|
+
for (const b of bad) write(`FAIL: ${b}\n`)
|
|
417
|
+
if (bad.length > 0) { write(' fix: renderEveryday in rvlib-shipkit src/cli/cmd_Commands.ts names every registered command\n'); return 1 }
|
|
312
418
|
if (existsSync(this.essentials) && readFileSync(this.essentials, 'utf8') === text) write(`ok: ${this.essentials} current\n`)
|
|
313
419
|
else if (this.check) { write(`FAIL: ${this.essentials} is STALE — the essential commands moved\n fix: ${cmd}\n`); code = 1 }
|
|
314
420
|
else { writeFileSync(this.essentials, text); write(`ok: ${this.essentials} rewritten\n`) }
|
|
@@ -323,7 +429,7 @@ export class CommandsCommand extends Command {
|
|
|
323
429
|
const shown = this.everyday ? `${rows.filter((r) => r.essential != null).length} everyday commands of ${rows.length}` : `${rows.length} commands`
|
|
324
430
|
if (next === host) { write(`ok: ${this.out} command index current (${shown})\n`); return code }
|
|
325
431
|
if (this.check) {
|
|
326
|
-
write(`FAIL: ${this.out} command index is STALE — ${this.everyday ? 'the everyday commands, a description or a
|
|
432
|
+
write(`FAIL: ${this.out} command index is STALE — ${this.everyday ? 'the everyday commands, a description or a command name moved in the binary' : 'the binary registers commands the page does not list'}\n`)
|
|
327
433
|
write(` fix: ${bin === 'sk' ? 'shipkit' : bin} commands${this.everyday ? ' --everyday' : this.compact ? ' --compact' : ''} --out ${this.out}\n`)
|
|
328
434
|
return 1
|
|
329
435
|
}
|
package/src/cli/cmd_Contracts.ts
CHANGED
package/src/cli/cmd_Keys.ts
CHANGED
package/src/cli/cmd_Lanes.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
// sk lanes: who is at work on the machine now, one row per live session and lane
|
|
1
|
+
// sk lanes: who is at work on the machine now, one row per live session and lane, and who hears the owner's answers
|
|
2
|
+
// for each (agent-time/registry.ts, the one registry of parties). Report only.
|
|
2
3
|
import { Command, Option } from 'clipanion'
|
|
3
4
|
import { liveRow, liveTable, oneRowAnAgent } from '../agent-time/live.ts'
|
|
4
5
|
import { listTranscripts } from '../agent-time/store.ts'
|
|
5
6
|
import { capacityLines, LIVE_WINDOW_MS, readCapacity } from '../core/capacity.ts'
|
|
7
|
+
import { laneNameOf, readParties, readSessionRecords } from '../agent-time/registry.ts'
|
|
8
|
+
import { liveWatchers } from '../review/watchers.ts'
|
|
6
9
|
|
|
7
10
|
export class LanesCommand extends Command {
|
|
8
11
|
static override paths = [['lanes']]
|
|
@@ -11,7 +14,7 @@ export class LanesCommand extends Command {
|
|
|
11
14
|
static override usage = Command.Usage({
|
|
12
15
|
category: 'Health',
|
|
13
16
|
description: 'who is at work on the machine now: each live session and lane, since when, its calls, what it does',
|
|
14
|
-
details: 'one row per agent whose transcript moved in the last 3 minutes, every account and repo, read from the transcripts agents already write: no agent reports anything. A lane shows the description its orchestrator gave it and its model. `now` is its last entry: the tool call in flight, a model turn, or an ended turn, with how long ago. --all widens the window to an hour. The first line is the machine, the last what `sk capacity` says for this repo. Report only, exit 0 always.',
|
|
17
|
+
details: 'one row per agent whose transcript moved in the last 3 minutes, every account and repo, read from the transcripts agents already write: no agent reports anything. A lane shows the description its orchestrator gave it and its model, under its session. `now` is its last entry: the tool call in flight, a model turn, or an ended turn, with how long ago. After a name, who hears the owner\'s answers for it (wiki tools/shipkit/threads-how-it-fits.md, The rules): « hears: a watch » for a session or a lane whose sk thread watch lives, « process gone » for a session whose Claude Code process ended, its threads then heard by the repo\'s next session. --all widens the window to an hour. The first line is the machine, the last what `sk capacity` says for this repo. Report only, exit 0 always.',
|
|
15
18
|
examples: [
|
|
16
19
|
['who works now', 'sk lanes'],
|
|
17
20
|
['the last hour, ended lanes included', 'sk lanes --all'],
|
|
@@ -28,8 +31,16 @@ export class LanesCommand extends Command {
|
|
|
28
31
|
const rows = oneRowAnAgent(listTranscripts().filter((f) => now - f.mtime <= windowMs)).map((f) => liveRow(f))
|
|
29
32
|
const { capacity, live, repo } = readCapacity(process.cwd(), null, now)
|
|
30
33
|
const [machine = '', , verdict = ''] = capacityLines(capacity, live, repo)
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
// who hears for each row: the registry of parties, the same one the threads' rules read
|
|
35
|
+
const parties = await readParties({ sessions: [...new Set(rows.map((r) => r.session))], watchers: readSessionRecords().flatMap((r) => r.stores).filter((d, i, all) => all.indexOf(d) === i).flatMap((d) => liveWatchers(d)) })
|
|
36
|
+
const tag = (r: (typeof rows)[number]): string => {
|
|
37
|
+
const s = parties.sessions.find((x) => x.id === r.session)
|
|
38
|
+
if (r.agent === '') return s?.watch ? ' · hears: a watch' : readSessionRecords().some((x) => x.session === r.session) && s?.live === false ? ' · process gone' : ''
|
|
39
|
+
const name = laneNameOf(r.name)
|
|
40
|
+
return name !== null && parties.lanes.some((l) => l.session === r.session && l.name === name && l.watch) ? ' · hears: a watch' : ''
|
|
41
|
+
}
|
|
42
|
+
if (this.json) { this.context.stdout.write(`${JSON.stringify({ capacity, rows, parties })}\n`); return 0 }
|
|
43
|
+
this.context.stdout.write(`${[machine, '', ...liveTable(rows, now, tag), '', `${repo}: ${verdict}`].join('\n')}\n`)
|
|
33
44
|
return 0
|
|
34
45
|
}
|
|
35
46
|
}
|
package/src/cli/cmd_Messages.ts
CHANGED
|
@@ -152,4 +152,155 @@ export class MessagesSurfaceCommand extends Command {
|
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
|
|
155
|
+
/** an object's address as the store's kinds read it: `persona:<id>`, `messages:<message>[/<phrasing>]`, `surface:<surface>[/<option>]` */
|
|
156
|
+
async function addressOf(address: string): Promise<{ kind: import('../messages/objects.ts').ObjectKind; key: string }> {
|
|
157
|
+
const { isObjectKind } = await import('../messages/objects.ts')
|
|
158
|
+
const word = address.slice(0, address.indexOf(':'))
|
|
159
|
+
if (!isObjectKind(word)) throw new Error(`${address}: an object of the store is persona:<id>, messages:<message>[/<phrasing>] or surface:<surface>[/<option>]`)
|
|
160
|
+
return { kind: word, key: address.slice(word.length + 1).toLowerCase() }
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export class MessagesShowCommand extends Command {
|
|
164
|
+
static override paths = [['messages', 'show']]
|
|
165
|
+
static override usage = Command.Usage({
|
|
166
|
+
category: 'Messages',
|
|
167
|
+
description: "one object of the store as its card: a persona, a value proposition, a phrasing, a page top",
|
|
168
|
+
details: "Read from the md of the repo's main checkout, with the scores of the newest run that scored it. --json prints its state, the json and the card a thread version holds. Page: wiki tools/shipkit/messages.md, Objects in threads",
|
|
169
|
+
examples: [
|
|
170
|
+
['a value proposition and its scores', 'sk messages show messages:weight'],
|
|
171
|
+
['a persona as a state', 'sk messages show persona:dana --json'],
|
|
172
|
+
],
|
|
173
|
+
})
|
|
174
|
+
address = Option.String({ name: 'address' })
|
|
175
|
+
json = Option.Boolean('--json', false, { description: 'the state: { json, card }' })
|
|
176
|
+
async execute(): Promise<number> {
|
|
177
|
+
return run(this.context, 'show', async (_s, root, out) => {
|
|
178
|
+
const { readObject } = await import('../messages/objects.ts')
|
|
179
|
+
const { kind, key } = await addressOf(this.address)
|
|
180
|
+
const state = readObject(root, kind, key)
|
|
181
|
+
if (state == null) throw new Error(`${this.address}: no such object in the store`)
|
|
182
|
+
if (this.json) return out(JSON.stringify(state, null, 1)), 0
|
|
183
|
+
const c = state.card!
|
|
184
|
+
out(`${c.title}${c.chips?.length ? ` [${c.chips.join(', ')}]` : ''}`)
|
|
185
|
+
for (const f of c.fields ?? []) out(` ${f.label}: ${f.text}`)
|
|
186
|
+
for (const l of c.lines ?? []) out(` ${l.id} ${l.best === undefined ? '' : `${l.best ?? '·'} `}"${l.text}"${l.second ? ` / "${l.second}"` : ''}${l.note ? ` ${l.note}` : ''}`)
|
|
187
|
+
return 0
|
|
188
|
+
})
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const PROPOSE_WHAT = ['persona', 'message', 'phrasing', 'option'] as const
|
|
193
|
+
|
|
194
|
+
export class MessagesProposeCommand extends Command {
|
|
195
|
+
static override paths = [['messages', 'propose']]
|
|
196
|
+
static override usage = Command.Usage({
|
|
197
|
+
category: 'Messages',
|
|
198
|
+
description: 'suggest a new persona, value proposition, phrasing or page top option to the owner, in its thread',
|
|
199
|
+
details:
|
|
200
|
+
"Usage: propose persona <id> --role reader|gatekeeper --who \"…\" \"<why>\"; propose message <id> --title \"…\" [--meaning --value --truth --never --family --phrasing] \"<why>\" (a field left out is written « to fill »); propose phrasing <message> \"<text>\" \"<why>\"; propose option <surface> --headline \"…\" [--line \"…\"] \"<why>\". The id is a new slug you choose; the last argument is always why, in one line. Posts the new object as a version on its address (persona:<id>, messages:<message>, messages:<message>/<phrasing>, surface:<surface>/<option>), its card drawn in the thread, held by your lane (SK_AGENT). The owner approves it (its kind's apply writes it into the md of the repo's main checkout, and the lane that holds the thread commits the file), approves with a fix (the owner's words: post the next version), or rejects it (nothing written). A change of an existing object is sk thread propose on its address. The words pass the repo's public guard first. A candidate phrasing for a scoring run needs none of this: it is written as a line of messages.md. Page: wiki tools/shipkit/messages.md, Objects in threads",
|
|
201
|
+
examples: [
|
|
202
|
+
['a new value proposition', 'sk messages propose message offline --title "it works offline" --meaning "…" --value "…" --phrasing "No network? It still runs." "readers asked for it in run r12"'],
|
|
203
|
+
['a new persona', 'sk messages propose persona lena --role reader --who "34, mods VaM scenes, posts on Discord" "half the issues come from modders"'],
|
|
204
|
+
['a phrasing he will see live', 'sk messages propose phrasing weight "Bodies that move like bodies." "the best rewrite of run r12"'],
|
|
205
|
+
['a page top option', 'sk messages propose option top --headline "…" --line "…" "<why>"'],
|
|
206
|
+
],
|
|
207
|
+
})
|
|
208
|
+
what = Option.String({ name: 'persona|message|phrasing|option' })
|
|
209
|
+
id = Option.String({ name: 'id' })
|
|
210
|
+
rest = Option.Rest({ name: '[text] why' })
|
|
211
|
+
role = Option.String('--role', { description: 'a persona: reader or gatekeeper' })
|
|
212
|
+
who = Option.String('--who', { description: 'a persona: who it is, in words' })
|
|
213
|
+
title = Option.String('--title', { description: 'a value proposition: what it says, in a few words' })
|
|
214
|
+
family = Option.String('--family', { description: "a value proposition: one of the page's groups" })
|
|
215
|
+
meaning = Option.String('--meaning', { description: 'a value proposition: what the reader must take away' })
|
|
216
|
+
value = Option.String('--value', { description: 'a value proposition: what the reader gains, in their terms' })
|
|
217
|
+
truth = Option.String('--truth', { description: 'a value proposition: what in the product backs it' })
|
|
218
|
+
never = Option.String('--never', { description: 'a value proposition: what its phrasings must never say' })
|
|
219
|
+
phrasing = Option.String('--phrasing', { description: 'a value proposition: its first phrasing' })
|
|
220
|
+
headline = Option.String('--headline', { description: 'a page top option: its headline' })
|
|
221
|
+
line = Option.String('--line', { description: 'a page top option: the line under it' })
|
|
222
|
+
async execute(): Promise<number> {
|
|
223
|
+
return run(this.context, 'propose', async (s, root, out) => {
|
|
224
|
+
const { mkdirSync, writeFileSync } = await import('node:fs')
|
|
225
|
+
const { LAYOUT } = await import('../core/layout.ts')
|
|
226
|
+
const { join } = await import('node:path')
|
|
227
|
+
const { cardOfJson } = await import('../messages/objects.ts')
|
|
228
|
+
const { nextUnder, quoted, oneLine } = await import('../messages/write.ts')
|
|
229
|
+
const { loadSocialUnit, guardWith } = await import('../social/unit.ts')
|
|
230
|
+
if (!(PROPOSE_WHAT as readonly string[]).includes(this.what)) throw new Error(`what: one of ${PROPOSE_WHAT.join(', ')}`)
|
|
231
|
+
const what = this.what as (typeof PROPOSE_WHAT)[number]
|
|
232
|
+
if (!/^[\w-]+$/.test(this.id)) throw new Error(`${this.id}: an id is letters, digits, - and _`)
|
|
233
|
+
const source = process.env.SK_AGENT?.trim() || 'agent'
|
|
234
|
+
const phrasingIds = s.messages.flatMap((m) => m.candidates.map((c) => c.id))
|
|
235
|
+
const args = [...this.rest]
|
|
236
|
+
const why = oneLine(args.pop() ?? '')
|
|
237
|
+
if (why === '') throw new Error('the last argument is why you propose it, in one line')
|
|
238
|
+
let kind: import('../messages/objects.ts').ObjectKind
|
|
239
|
+
let address: string
|
|
240
|
+
let json: import('../messages/objects.ts').ObjectJson
|
|
241
|
+
let title: string
|
|
242
|
+
let texts: string[] = []
|
|
243
|
+
if (what === 'persona') {
|
|
244
|
+
if (this.role !== 'reader' && this.role !== 'gatekeeper') throw new Error('--role reader or --role gatekeeper')
|
|
245
|
+
if (!this.who?.trim()) throw new Error('--who: who it is, in words')
|
|
246
|
+
if (s.personas.some((p) => p.id.toLowerCase() === this.id.toLowerCase())) throw new Error(`persona ${this.id} exists already`)
|
|
247
|
+
kind = 'persona'
|
|
248
|
+
json = { id: this.id, role: this.role, who: this.who.trim() }
|
|
249
|
+
address = `persona:${this.id}`
|
|
250
|
+
title = `a new persona: ${this.id} (${this.role})`
|
|
251
|
+
} else if (what === 'message') {
|
|
252
|
+
if (!this.title?.trim()) throw new Error('--title: what it says, in a few words')
|
|
253
|
+
if (s.messages.some((m) => m.id.toLowerCase() === this.id.toLowerCase())) throw new Error(`message ${this.id} exists already`)
|
|
254
|
+
const given: Record<string, string | undefined> = { family: this.family, meaning: this.meaning, value: this.value, truth: this.truth, never: this.never }
|
|
255
|
+
const fields: Record<string, string> = {}
|
|
256
|
+
for (const [k, v] of Object.entries(given)) if (oneLine(v)) fields[k] = oneLine(v)
|
|
257
|
+
const toFill = ['meaning', 'value', 'truth', 'never'].filter((k) => !fields[k])
|
|
258
|
+
const phrasings = this.phrasing?.trim() ? [{ id: nextUnder(this.id.replace(/[-_]/g, ''), phrasingIds), text: quoted(this.phrasing), source }] : []
|
|
259
|
+
kind = 'messages'
|
|
260
|
+
json = { id: this.id, title: oneLine(this.title), fields, toFill, phrasings }
|
|
261
|
+
address = `messages:${this.id}`
|
|
262
|
+
title = `a new value proposition: ${oneLine(this.title)}`
|
|
263
|
+
texts = phrasings.map((p) => p.text)
|
|
264
|
+
} else if (what === 'phrasing') {
|
|
265
|
+
const m = s.messages.find((x) => x.id.toLowerCase() === this.id.toLowerCase())
|
|
266
|
+
if (m == null) throw new Error(`no message ${this.id}: a new value proposition is propose message`)
|
|
267
|
+
const text = quoted(args.shift() ?? '')
|
|
268
|
+
if (text === '') throw new Error('the phrasing, then why')
|
|
269
|
+
const id = nextUnder(m.candidates[0]?.id.replace(/\d+$/, '') || m.id.replace(/[-_]/g, ''), phrasingIds)
|
|
270
|
+
kind = 'messages'
|
|
271
|
+
json = { message: m.id, id, text, source }
|
|
272
|
+
address = `messages:${m.id}/${id}`
|
|
273
|
+
title = `a new phrasing of « ${m.title} »`
|
|
274
|
+
texts = [text]
|
|
275
|
+
} else {
|
|
276
|
+
const sf = s.surfaces.find((x) => x.id.toLowerCase() === this.id.toLowerCase())
|
|
277
|
+
if (sf == null) throw new Error(`no page top ${this.id} in surfaces.md`)
|
|
278
|
+
if (!this.headline?.trim()) throw new Error('--headline: the option')
|
|
279
|
+
const ids = sf.options.map((o) => o.id)
|
|
280
|
+
const letters = ids.every((i) => /^[A-Z]$/.test(i))
|
|
281
|
+
const id = letters && ids.length < 26 ? String.fromCharCode(65 + Math.max(-1, ...ids.map((i) => i.charCodeAt(0) - 65)) + 1) : nextUnder('o', ids)
|
|
282
|
+
kind = 'surface'
|
|
283
|
+
json = { surface: sf.id, id, headline: quoted(this.headline), second: quoted(this.line ?? '') }
|
|
284
|
+
address = `surface:${sf.id}/${id}`
|
|
285
|
+
title = `a new option for « ${sf.title} »`
|
|
286
|
+
const n = `${json.headline} ${json.second}`.trim().length
|
|
287
|
+
if (sf.budget !== undefined && n > sf.budget) throw new Error(`${n} characters, the budget of ${sf.id} is ${sf.budget}`)
|
|
288
|
+
texts = [[json.headline, json.second].filter((x) => x).join(' ')]
|
|
289
|
+
}
|
|
290
|
+
const unit = await loadSocialUnit(root)
|
|
291
|
+
const bad = texts.flatMap((t) => guardWith(unit, { texts: [t] }))
|
|
292
|
+
if (bad.length) throw new Error(`the repo's public guard refuses it:\n${bad.join('\n')}`)
|
|
293
|
+
const tmp = join(root, LAYOUT.tmp, 'messages-propose')
|
|
294
|
+
mkdirSync(tmp, { recursive: true })
|
|
295
|
+
const file = join(tmp, `${address.replace(/[^\w-]+/g, '_')}.json`)
|
|
296
|
+
writeFileSync(file, JSON.stringify({ json, card: cardOfJson(root, kind, json, false) }))
|
|
297
|
+
const cli = new URL('../cli.ts', import.meta.url).pathname
|
|
298
|
+
const p = Bun.spawnSync([process.execPath, cli, 'thread', 'post', address, '--title', title, '--what', why, '--after', file], { cwd: root, stdout: 'inherit', stderr: 'inherit', env: process.env })
|
|
299
|
+
if (p.exitCode !== 0) return p.exitCode ?? 1
|
|
300
|
+
out(`messages: proposed ${address}; the owner's approval writes it into the store, then commit the file`)
|
|
301
|
+
return 0
|
|
302
|
+
})
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export const MESSAGES_COMMANDS = [MessagesLintCommand, MessagesPacketsCommand, MessagesBriefCommand, MessagesMatrixCommand, MessagesSurfaceCommand, MessagesShowCommand, MessagesProposeCommand]
|
package/src/cli/cmd_Needs.ts
CHANGED