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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// guard (the collector is gone; never reintroduce a parallel projection).
|
|
3
3
|
// Behaviors preserved by name: per-source failure isolation (projectNeeds
|
|
4
4
|
// guards per collection), the identity self-heal before surfacing, and the
|
|
5
|
-
// asks
|
|
5
|
+
// asks read from the thread store (asks/ask-store.ts), never a folder. Dedup doctrine
|
|
6
6
|
// : dedup = acted-on once, NEVER hidden — an
|
|
7
7
|
// ask-covered missing cred still shows RED in secrets with a pointer to the
|
|
8
8
|
// ask; verbs and pings stay with the ask. No provider reads STATUS.md: a
|
|
@@ -19,14 +19,16 @@ import { assetDir, listRolls, readPick } from '../assets/roll-workspace.ts'
|
|
|
19
19
|
import type { healIdentity } from '../assets/run-assets.ts'
|
|
20
20
|
import { afterWords } from '../asks/ask-after.ts'
|
|
21
21
|
import { urlLogins } from '../urls/rows.ts'
|
|
22
|
-
import {
|
|
22
|
+
import { asksIn, isClosed, isLater, type Ask } from '../asks/ask-store.ts'
|
|
23
|
+
import { readAll, storeDir } from '../review/store.ts'
|
|
24
|
+
import type { ReviewItem } from '../review/model.ts'
|
|
23
25
|
import type { Held, HeldOf } from '../secrets/held.ts'
|
|
24
26
|
import { evaluateContracts } from '../contracts/contracts-engine.ts'
|
|
25
27
|
import { CheckCtx } from '../core/check-ctx.ts'
|
|
26
28
|
import type { RepoConfig } from '../repo-config.ts'
|
|
27
29
|
import { activeContracts, contractsConfigFrom } from '../contracts/apply-contracts.ts'
|
|
28
30
|
import type { AskFacts, CheckFacts, Collection, Instance, Readers } from './collection-types.ts'
|
|
29
|
-
import {
|
|
31
|
+
import { mdCapped } from './md-body.ts'
|
|
30
32
|
import { assetState, secretState, type SecretLevel, type SecretProbe } from './state-rules.ts'
|
|
31
33
|
import { reflectionsCollection } from './reflections.ts'
|
|
32
34
|
import { reviewCollection, trailersCollection } from './review.ts'
|
|
@@ -37,15 +39,20 @@ import { veilleCollection } from '../veille/collection.ts'
|
|
|
37
39
|
import { picturesCollection } from '../identities/collection.ts'
|
|
38
40
|
import { testsCollection } from './tests.ts'
|
|
39
41
|
import { checksCollection } from './checks.ts'
|
|
40
|
-
import { LAYOUT } from '../core/layout.ts'
|
|
41
42
|
import { isBudgetLine } from '../core/budget.ts'
|
|
42
43
|
import { GH_LOGIN_CRED } from '../core/gh-login.ts'
|
|
44
|
+
import { lapsedNameOf } from '../secrets/lapse-mark.ts'
|
|
43
45
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
/** the repo's asks and the items of its store they came from, one read */
|
|
47
|
+
const asksOfStore = (root: string, now: number): { asks: Ask[]; items: readonly ReviewItem[] } => {
|
|
48
|
+
const items = readAll(storeDir(root)).items
|
|
49
|
+
return { asks: asksIn(items, new Date(now)), items }
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** his last words on an ask, the boot briefing: the owner's plain messages of its thread, each with its day */
|
|
53
|
+
const remarksOf = (a: Ask, items: readonly ReviewItem[], max = 3): string[] | undefined => {
|
|
54
|
+
const said = (items.find((x) => x.item.id === a.head)?.thread ?? []).filter((m) => m.who === 'owner' && m.text != null && m.ask === undefined && m.answer === undefined && m.askState === undefined && m.re === undefined)
|
|
55
|
+
return said.length > 0 ? said.slice(-max).map((m) => `- ${m.at.slice(0, 10)}: ${m.text}`) : undefined
|
|
49
56
|
}
|
|
50
57
|
|
|
51
58
|
const CRED_LINE = /cred ([a-z0-9-]+\/[a-z0-9-]+\/[a-z0-9-]+) missing/
|
|
@@ -107,6 +114,9 @@ export function probeOf(name: string, probedBy: string | undefined, verdicts: Ma
|
|
|
107
114
|
if (v.status === 'skip') return { probe: 'unmeasured', words: `its probe ${probedBy} was skipped`, md }
|
|
108
115
|
const unmeasured = lines.find((l) => l.kind === 'skip' && namesSecret(l.text, name))
|
|
109
116
|
if (unmeasured != null) return { probe: 'unmeasured', words: `${probedBy} did not check it: ${unmeasured.text}`, md }
|
|
117
|
+
// a lapsed token passes its check, yet does not work: plain, never green (wiki services/secrets, A secret that may lapse)
|
|
118
|
+
const lapsed = lines.find((l) => l.kind === 'other' && lapsedNameOf(l.text) === name)
|
|
119
|
+
if (lapsed != null) return { probe: 'unmeasured', words: lapsed.text, md }
|
|
110
120
|
if (v.status === 'fail') {
|
|
111
121
|
const why = lines.find((l) => l.kind === 'fail') ?? lines.find((l) => l.kind === 'warn')
|
|
112
122
|
return { probe: 'fail', words: `its probe ${probedBy} failed${why != null ? `: ${why.text}` : ''}`, md }
|
|
@@ -127,7 +137,7 @@ const slug = (t: string): string => t.toLowerCase().replace(/[^a-z0-9]+/g, '-').
|
|
|
127
137
|
/** wire lines re-rendered as a fenced block for an instance's md */
|
|
128
138
|
const wireMd = (lines: string[]): string => `\`\`\`\n${lines.join('\n')}\n\`\`\``
|
|
129
139
|
|
|
130
|
-
const askFacts = (a: Ask, later = false, held?: Record<string, Held>, readers?: Record<string, Readers>, login?: { logins: string[]; accounts: Record<string, string> }): AskFacts => ({ kind: a.kind, created: a.created, closed: a.closed, blocks: a.blocks, probe: a.check, secrets: a.kind === 'credential' ? a.secrets : [], after: a.after, later, ...(held != null ? { held } : {}), ...(readers != null ? { stores: a.stores, readers } : {}), ...(login != null && login.logins.length > 0 ? login : {}) })
|
|
140
|
+
const askFacts = (a: Ask, later = false, held?: Record<string, Held>, readers?: Record<string, Readers>, login?: { logins: string[]; accounts: Record<string, string> }): AskFacts => ({ kind: a.kind, status: a.status, created: a.created, closed: a.closed, blocks: a.blocks, probe: a.check, secrets: a.kind === 'credential' ? a.secrets : [], after: a.after, later, ...(held != null ? { held } : {}), ...(readers != null ? { stores: a.stores, readers } : {}), ...(login != null && login.logins.length > 0 ? login : {}) })
|
|
131
141
|
|
|
132
142
|
/** the store's read of a repo's names, kept this long: the hub lists its asks on every poll, and a read off the vault
|
|
133
143
|
* machine runs the secret manager once a name */
|
|
@@ -184,17 +194,17 @@ export const forgetHeld = (root: string): void => {
|
|
|
184
194
|
}
|
|
185
195
|
|
|
186
196
|
/** a later ask (its `after:` moment ahead) is yellow, so it never pings, and quiet in the tree: out of the way until
|
|
187
|
-
* then, red from then on
|
|
188
|
-
export function asksCollection(root: string,
|
|
197
|
+
* then, red from then on by itself. `now` is the clock a test passes */
|
|
198
|
+
export function asksCollection(root: string, o: { now?: () => number; held?: HeldOf; who?: WhoOf; urlLogins?: (root: string) => Promise<string[]>; accounts?: AccountsOf } = {}): Collection {
|
|
189
199
|
return {
|
|
190
200
|
id: 'asks',
|
|
191
201
|
title: 'asks',
|
|
192
202
|
kind: 'ask',
|
|
193
203
|
media: 'text',
|
|
194
204
|
list: async () => {
|
|
195
|
-
const rel = c.asks?.dir ?? LAYOUT.asks
|
|
196
205
|
const now = (o.now ?? Date.now)()
|
|
197
|
-
const asks =
|
|
206
|
+
const { asks: every, items } = asksOfStore(root, now)
|
|
207
|
+
const asks = every.filter((a) => !isClosed(a.status))
|
|
198
208
|
// each credential ask's names, read once for all of them: names and dates, never a value
|
|
199
209
|
const names = [...new Set(asks.filter((a) => a.kind === 'credential').flatMap((a) => a.secrets))]
|
|
200
210
|
const held = names.length === 0 ? {} : await (o.held ?? heldOfAsks)(names, root).catch((e: Error): Record<string, Held> => Object.fromEntries(names.map((n) => [n, { held: 'unknown', why: e.message }])))
|
|
@@ -205,55 +215,38 @@ export function asksCollection(root: string, c: RepoConfig, o: { now?: () => num
|
|
|
205
215
|
const loginsOf = (a: Ask): string[] => (a.kind === 'credential' ? a.secrets.filter((n) => a.logins.includes(n) || fromUrls.includes(n)) : [])
|
|
206
216
|
const stored = [...new Set(asks.flatMap(loginsOf))].filter((n) => held[n]?.held === 'stored')
|
|
207
217
|
const accounts = stored.length === 0 ? {} : await (o.accounts ?? accountsOfStore)(stored, root).catch(() => ({}))
|
|
218
|
+
// an ask is its thread: its id is the thread's address, its path a virtual one, no file
|
|
219
|
+
const base = (a: Ask) => ({ id: a.address, label: a.title, type: 'ask' as const, path: `asks/${a.id}`, virtual: true, md: mdCapped(a.body), remarks: remarksOf(a, items) })
|
|
208
220
|
const open = asks.map((a): Instance => {
|
|
209
221
|
const later = isLater(a, now)
|
|
210
222
|
const mine = a.kind === 'credential' && a.secrets.length > 0 ? Object.fromEntries(a.secrets.map((n) => [n, held[n] ?? { held: 'unknown' as const, why: 'not read' }])) : undefined
|
|
211
223
|
return {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
verbs: ['done' as const, 'paste-proof' as const],
|
|
223
|
-
file: `${rel}/${a.file}`,
|
|
224
|
-
md: mdBody(join(root, rel, a.file)),
|
|
225
|
-
remarks: lastRemarks(join(root, rel, a.file)),
|
|
226
|
-
ask: askFacts(a, later, mine, a.stores.length > 0 ? Object.fromEntries(a.stores.flatMap((n) => (who[n] != null ? [[n, who[n]!]] : []))) : undefined,
|
|
227
|
-
{ logins: loginsOf(a), accounts: Object.fromEntries(loginsOf(a).flatMap((n) => (accounts[n] != null ? [[n, accounts[n]!]] : []))) }),
|
|
224
|
+
...base(a),
|
|
225
|
+
text: `${a.title} (${a.kind})${later ? `, ${afterWords(a.after!)}` : ''}`,
|
|
226
|
+
// the tree carries the title and puts the kind in its own
|
|
227
|
+
// slot, so a column of asks reads as a column of kinds
|
|
228
|
+
slot: a.kind,
|
|
229
|
+
severity: later ? ('yellow' as const) : ('red' as const),
|
|
230
|
+
...(later ? { state: 'quiet' as const } : {}),
|
|
231
|
+
verbs: ['done' as const, 'paste-proof' as const],
|
|
232
|
+
ask: askFacts(a, later, mine, a.stores.length > 0 ? Object.fromEntries(a.stores.flatMap((n) => (who[n] != null ? [[n, who[n]!]] : []))) : undefined,
|
|
233
|
+
{ logins: loginsOf(a), accounts: Object.fromEntries(loginsOf(a).flatMap((n) => (accounts[n] != null ? [[n, accounts[n]!]] : []))) }),
|
|
228
234
|
}
|
|
229
235
|
})
|
|
230
|
-
// the
|
|
231
|
-
//
|
|
232
|
-
const closed =
|
|
233
|
-
|
|
234
|
-
text: `${a.title}
|
|
235
|
-
|
|
236
|
-
slot: status,
|
|
237
|
-
type: 'ask' as const,
|
|
238
|
-
path: `${rel}/${status}/${a.file}`,
|
|
236
|
+
// the closed asks ride along QUIET (no severity): past answers stay consultable and remarkable; newest
|
|
237
|
+
// first, after every open ask
|
|
238
|
+
const closed = every.filter((a) => isClosed(a.status)).reverse().map((a): Instance => ({
|
|
239
|
+
...base(a),
|
|
240
|
+
text: `${a.title} (${a.kind})`,
|
|
241
|
+
slot: a.status,
|
|
239
242
|
state: 'quiet' as const,
|
|
240
|
-
file: `${rel}/${status}/${a.file}`,
|
|
241
|
-
md: mdBody(join(root, rel, status, a.file)),
|
|
242
|
-
remarks: lastRemarks(join(root, rel, status, a.file)),
|
|
243
243
|
ask: askFacts(a),
|
|
244
|
-
}))
|
|
244
|
+
}))
|
|
245
245
|
return [...open, ...closed]
|
|
246
246
|
},
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
-
/** the latest dated remark lines from a file's tail, the boot briefing */
|
|
251
|
-
const lastRemarks = (path: string, max = 3): string[] | undefined => {
|
|
252
|
-
if (!existsSync(path)) return undefined
|
|
253
|
-
const lines = readFileSync(path, 'utf8').split('\n').filter((l) => /^- \d{4}-\d{2}-\d{2}: /.test(l))
|
|
254
|
-
return lines.length > 0 ? lines.slice(-max) : undefined
|
|
255
|
-
}
|
|
256
|
-
|
|
257
250
|
export type CredsOpts = {
|
|
258
251
|
/** injected by tests; production reads the checks collection, which is
|
|
259
252
|
* the run record every gate run and health pass writes */
|
|
@@ -286,13 +279,12 @@ export function credsCollection(root: string, c: RepoConfig, o: CredsOpts = {}):
|
|
|
286
279
|
kind: 'secret',
|
|
287
280
|
media: 'pointer',
|
|
288
281
|
list: async () => {
|
|
289
|
-
const
|
|
290
|
-
const asks =
|
|
282
|
+
const { asks: every } = asksOfStore(root, Date.now())
|
|
283
|
+
const asks = every.filter((a) => !isClosed(a.status))
|
|
291
284
|
// the ask that stores this name, else the older match by its title
|
|
292
285
|
const coveringAsk = (name: string): Ask | undefined =>
|
|
293
286
|
asks.find((a) => a.stores.includes(name)) ?? asks.find((a) => a.title.toLowerCase().includes(name.split('/')[1] ?? name))
|
|
294
|
-
const
|
|
295
|
-
const declinedFor = (name: string): { rel: string; ask: Ask } | undefined => declined.find((d) => d.ask.stores.includes(name))
|
|
287
|
+
const declinedFor = (name: string): Ask | undefined => every.find((a) => a.status === 'declined' && a.stores.includes(name))
|
|
296
288
|
const verdicts = await (o.verdicts ?? (() => verdictsOf(checksCollection(root, c))))()
|
|
297
289
|
const now = (o.now ?? Date.now)()
|
|
298
290
|
const missing = missingFrom(verdicts)
|
|
@@ -315,7 +307,7 @@ export function credsCollection(root: string, c: RepoConfig, o: CredsOpts = {}):
|
|
|
315
307
|
// the owner declined the ask for it: listed, never red, never pinged, and never asked again
|
|
316
308
|
out.push({
|
|
317
309
|
id: `cred:${name}`,
|
|
318
|
-
text: `${named(name, decl?.service)} missing, the owner declined it on ${no.
|
|
310
|
+
text: `${named(name, decl?.service)} missing, the owner declined it on ${no.closed ?? '?'} (${no.address})${minorWord(decl?.level)}`,
|
|
319
311
|
...credPlace(name, true, decl?.level),
|
|
320
312
|
state: 'quiet',
|
|
321
313
|
md,
|
|
@@ -326,7 +318,7 @@ export function credsCollection(root: string, c: RepoConfig, o: CredsOpts = {}):
|
|
|
326
318
|
// verbs and the ping; the cred still shows here
|
|
327
319
|
out.push({
|
|
328
320
|
id: `cred:${name}`,
|
|
329
|
-
text: `${named(name, decl?.service)} missing,
|
|
321
|
+
text: `${named(name, decl?.service)} missing, ${ask.address} owns this${minorWord(decl?.level)}`,
|
|
330
322
|
...credPlace(name, true, decl?.level),
|
|
331
323
|
...secretState({ missing: true, probe: 'none', level: decl?.level }),
|
|
332
324
|
md,
|
|
@@ -356,8 +348,8 @@ export function credsCollection(root: string, c: RepoConfig, o: CredsOpts = {}):
|
|
|
356
348
|
}
|
|
357
349
|
}
|
|
358
350
|
|
|
359
|
-
// the store command
|
|
360
|
-
//
|
|
351
|
+
// the store command: the repo's own `credsCommand` template where it declares
|
|
352
|
+
// one, else the house store's `sk secret set`
|
|
361
353
|
// a secret has no file: the name is already slash shaped, so a virtual root
|
|
362
354
|
// groups it by vendor for free
|
|
363
355
|
const credPlace = (name: string, missing: boolean, level?: SecretLevel): Pick<Instance, 'type' | 'path' | 'virtual' | 'label' | 'slot'> =>
|
|
@@ -389,7 +381,7 @@ const credInstance = (name: string, cmdTemplate: string | undefined, decl?: { se
|
|
|
389
381
|
text: `${named(name, decl?.service)} missing${minorWord(decl?.level)}`,
|
|
390
382
|
...credPlace(name, true, decl?.level),
|
|
391
383
|
...secretState({ missing: true, probe: 'none', level: decl?.level }),
|
|
392
|
-
artifact: { copy: cmdTemplate
|
|
384
|
+
artifact: { copy: (cmdTemplate ?? 'sk secret set {name}').replaceAll('{name}', name), url: decl?.mintUrl, steps: decl?.steps },
|
|
393
385
|
verbs: ['set'],
|
|
394
386
|
})
|
|
395
387
|
|
|
@@ -510,10 +502,10 @@ export function buildCollections(root: string, c: RepoConfig, kit: ResolvedKit |
|
|
|
510
502
|
return [
|
|
511
503
|
checks,
|
|
512
504
|
contractsCollection(root, c),
|
|
513
|
-
asksCollection(root
|
|
505
|
+
asksCollection(root),
|
|
514
506
|
credsCollection(root, c, { verdicts: () => verdictsOf(checks) }),
|
|
515
507
|
mediaKitCollection(root, c.serve?.assets === false ? null : kit),
|
|
516
|
-
reflectionsCollection(root),
|
|
508
|
+
reflectionsCollection(root, c.name),
|
|
517
509
|
testsCollection(root, c),
|
|
518
510
|
// only where the repo has a review store, a trailer folder or a store folder: the section of a repo with none is greyed
|
|
519
511
|
...[reviewCollection(root), trailersCollection(root), storesCollection(root), releasesCollection(root), messagesCollection(root), veilleCollection(root), picturesCollection(root)].filter((x): x is Collection => x !== null),
|
|
@@ -5,17 +5,20 @@
|
|
|
5
5
|
// the needs feed and never the red pings. The seed README is not a row.
|
|
6
6
|
import { join } from 'path'
|
|
7
7
|
import { listReflections, REFLECTIONS_DIR } from '../reflections/reflections-queue.ts'
|
|
8
|
+
import { reflectionThreads } from '../review/reflection-object.ts'
|
|
8
9
|
import type { Collection, Instance } from './collection-types.ts'
|
|
9
10
|
import { mdBody } from './md-body.ts'
|
|
10
11
|
|
|
11
|
-
export function reflectionsCollection(root: string): Collection {
|
|
12
|
+
export function reflectionsCollection(root: string, repo: string): Collection {
|
|
12
13
|
return {
|
|
13
14
|
id: 'reflections',
|
|
14
15
|
title: 'reflections',
|
|
15
16
|
kind: 'reflection',
|
|
16
17
|
media: 'text',
|
|
17
|
-
list: async () =>
|
|
18
|
-
|
|
18
|
+
list: async () => {
|
|
19
|
+
// a reflection is an object (review/reflection-object.ts): its row names the threads that refer to it
|
|
20
|
+
const threadsOf = reflectionThreads(root, repo)
|
|
21
|
+
return listReflections(root).map((r): Instance => {
|
|
19
22
|
const path = `${REFLECTIONS_DIR}/${r.file}`
|
|
20
23
|
const shape = r.unreadable
|
|
21
24
|
? 'UNREADABLE'
|
|
@@ -36,7 +39,9 @@ export function reflectionsCollection(root: string): Collection {
|
|
|
36
39
|
file: path,
|
|
37
40
|
severity: 'yellow',
|
|
38
41
|
md: mdBody(join(root, path)),
|
|
42
|
+
threads: threadsOf(r.file),
|
|
39
43
|
}
|
|
40
|
-
})
|
|
44
|
+
})
|
|
45
|
+
},
|
|
41
46
|
}
|
|
42
47
|
}
|
|
@@ -26,6 +26,7 @@ import { CHECK_SUFFIX as SUFFIX, fallbackNames, isLegacyCheckSource, SKIPPED_DIR
|
|
|
26
26
|
import { unitKind } from '../shipkit-files.ts'
|
|
27
27
|
import { readVendored } from './vendored-read.ts'
|
|
28
28
|
import { gitBin } from './git-bin.ts'
|
|
29
|
+
import { gitRoot } from './git-root.ts'
|
|
29
30
|
import { keptOnTree } from './tree-rev.ts'
|
|
30
31
|
|
|
31
32
|
export { fallbackNames, isLegacyCheckSource } from './check-file-names.ts'
|
|
@@ -107,8 +108,10 @@ function walkKept(dir: string, out: string[], suffix: string, dirs: string[] | u
|
|
|
107
108
|
* build output holds thousands of dirs, and a walk through them holds the daemon's loop for seconds */
|
|
108
109
|
const prunedDirs = (root: string): ReadonlySet<string> => new Set([...readVendored(root).map((d) => join(root, d)), ...ignoredDirs(root)])
|
|
109
110
|
|
|
110
|
-
/** the dirs git ignores under `root`, absolute, read again once the tree moved (one git spawn); none outside
|
|
111
|
+
/** the dirs git ignores under `root`, absolute, read again once the tree moved (one git spawn); none outside a
|
|
112
|
+
* work tree, which `gitRoot` answers from the disk with no spawn */
|
|
111
113
|
function ignoredDirs(root: string): string[] {
|
|
114
|
+
if (gitRoot(root) == null) return []
|
|
112
115
|
return keptOnTree(ignoredLists, root, () => {
|
|
113
116
|
const p = Bun.spawnSync([gitBin(), 'ls-files', '--others', '--ignored', '--exclude-standard', '--directory', '-z'], { cwd: root, stdout: 'pipe', stderr: 'ignore' })
|
|
114
117
|
if (p.exitCode !== 0) return []
|
|
@@ -204,10 +207,22 @@ function unloadable(path: string, message: string): CheckDef {
|
|
|
204
207
|
cache: { by: 'never', why: 'the file does not load' },
|
|
205
208
|
fix: 'none',
|
|
206
209
|
applies: 'always',
|
|
207
|
-
run: (c) => c.fail(`${basename(path)} does not load: ${message.replace(`${path}: `, '')}`,
|
|
210
|
+
run: (c) => c.fail(`${basename(path)} does not load: ${message.replace(`${path}: `, '')}`, `fix the declaration in ${basename(path)} by the reason above; a retired check file shape: shipkit check --fix SK029 ports it with the values it ran on`),
|
|
208
211
|
}
|
|
209
212
|
}
|
|
210
213
|
|
|
214
|
+
/** the id and the group a file declares, read from its text as literals: the stand in of a file that does not load keeps
|
|
215
|
+
* them, so it fails in the runs it was named into (`--only RV037`, `--only rv`), never only in the full gate */
|
|
216
|
+
function declaredOf(path: string): { id?: string; group?: string } {
|
|
217
|
+
let src: string
|
|
218
|
+
try { src = readFileSync(path, 'utf8') } catch { return {} }
|
|
219
|
+
const decl = src.slice(Math.max(0, src.indexOf('export default')))
|
|
220
|
+
const lit = (k: string): string | undefined => new RegExp(`\\b${k}:\\s*(['"])([^'"\\n]+)\\1`).exec(decl)?.[2]
|
|
221
|
+
const id = lit('id')
|
|
222
|
+
const group = lit('group')
|
|
223
|
+
return { ...(id != null ? { id } : {}), ...(group != null ? { group } : {}) }
|
|
224
|
+
}
|
|
225
|
+
|
|
211
226
|
/** a built-in that does not load, as a repo that only CONSUMES the toolkit
|
|
212
227
|
* sees it: one warning, never a red gate, since only the toolkit's own repo
|
|
213
228
|
* can fix the file, and its gate stays red on it */
|
|
@@ -299,7 +314,7 @@ export async function discoverChecks(root: string, o: DiscoverOpts = {}): Promis
|
|
|
299
314
|
// a file that does not load is ONE red row, never a dead inventory:
|
|
300
315
|
// every other check still runs, and this one says why in every run
|
|
301
316
|
loadError = (e as Error).message
|
|
302
|
-
def = unloadable(f, loadError)
|
|
317
|
+
def = { ...unloadable(f, loadError), ...declaredOf(f) }
|
|
303
318
|
}
|
|
304
319
|
if (def == null) continue
|
|
305
320
|
const rel = isBuiltin ? null : relative(root, f).replace(/\\/g, '/')
|
package/src/core/git.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// THE door to git for a read a module asks (which files git tracks, ignores, what a ref holds): the real git by
|
|
2
|
+
// default, a model in a test (tests/git-model.ts), passed in by the caller. A module that asks git takes a `GitIo`
|
|
3
|
+
// with `realGit` as its default, never a spawn of its own.
|
|
4
|
+
//
|
|
5
|
+
// The one constraint a reader breaks first: the real git is `gitBin()`, never `git` on PATH (on macOS that is the
|
|
6
|
+
// xcrun shim, about 10 ms more a spawn), and it runs in the caller's environment as it stands now.
|
|
7
|
+
import { gitBin } from './git-bin.ts'
|
|
8
|
+
|
|
9
|
+
export type GitAnswer = { code: number; out: string; err: string }
|
|
10
|
+
|
|
11
|
+
export type GitIo = {
|
|
12
|
+
/** `git -C dir …args`, `input` written to its stdin */
|
|
13
|
+
run(dir: string, args: readonly string[], o?: { input?: string }): Promise<GitAnswer>
|
|
14
|
+
runSync(dir: string, args: readonly string[]): GitAnswer
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const realGit: GitIo = {
|
|
18
|
+
async run(dir, args, o) {
|
|
19
|
+
const p = Bun.spawn([gitBin(), '-C', dir, ...args], { stdin: o?.input == null ? 'ignore' : 'pipe', stdout: 'pipe', stderr: 'pipe', env: { ...process.env } })
|
|
20
|
+
if (o?.input != null && p.stdin != null) {
|
|
21
|
+
p.stdin.write(o.input)
|
|
22
|
+
await p.stdin.end()
|
|
23
|
+
}
|
|
24
|
+
const [out, err] = await Promise.all([new Response(p.stdout).text(), new Response(p.stderr).text()])
|
|
25
|
+
return { code: await p.exited, out, err }
|
|
26
|
+
},
|
|
27
|
+
runSync(dir, args) {
|
|
28
|
+
const p = Bun.spawnSync([gitBin(), '-C', dir, ...args], { stdout: 'pipe', stderr: 'pipe', env: { ...process.env } })
|
|
29
|
+
return { code: p.exitCode, out: p.stdout.toString(), err: p.stderr.toString() }
|
|
30
|
+
},
|
|
31
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Where the house repo keeps what every repo of the machine shares: the wiki, and inside it the owner's identities.
|
|
2
|
+
// A project repo's own folders are LAYOUT (core/layout.ts). This module reads no disk: cached checks import it.
|
|
3
|
+
|
|
4
|
+
export const HOUSE_LAYOUT = {
|
|
5
|
+
// the wiki every house repo loads first (CLAUDE.md line 1)
|
|
6
|
+
wiki: 'wiki',
|
|
7
|
+
// who speaks: one folder an identity, its pages, profile, accounts and pictures, and `_common/` for what is the
|
|
8
|
+
// owner's in every identity (wiki meta/identity-folder)
|
|
9
|
+
identities: 'wiki/identities',
|
|
10
|
+
// the names of every secret, one table row each, the house config's `creds` parsed from it; `sk secret archive`
|
|
11
|
+
// marks a row there (wiki identities/_common/secrets-registry.md)
|
|
12
|
+
secretRegistry: 'wiki/identities/_common/secrets-registry.md',
|
|
13
|
+
// the owner's domains, one row each, its table generated from the registrar (wiki services/domains)
|
|
14
|
+
domains: 'wiki/identities/_common/domains.md',
|
|
15
|
+
// the owner's catalog of every repo he has, its rows from git and agent summaries (wiki meta/past-projects)
|
|
16
|
+
pastProjects: 'wiki/identities/_common/past-projects.md',
|
|
17
|
+
} as const
|
package/src/core/layout.ts
CHANGED
|
@@ -17,7 +17,6 @@ const sk = (sub: string): string => `${SHIPKIT_DIR}/${sub}`
|
|
|
17
17
|
|
|
18
18
|
export const LAYOUT = {
|
|
19
19
|
// tracked: authored state
|
|
20
|
-
asks: sk('asks'),
|
|
21
20
|
hooks: sk('hooks'),
|
|
22
21
|
identity: sk('identity'),
|
|
23
22
|
assets: sk('assets'),
|
|
@@ -31,9 +30,6 @@ export const LAYOUT = {
|
|
|
31
30
|
// the release files: next.md and one <version>.md a release, each change's picture a key in the Space, never a
|
|
32
31
|
// file here (wiki tools/shipkit/units.md, The release files)
|
|
33
32
|
releases: sk('releases'),
|
|
34
|
-
// the house repo's identities, who speaks: one folder each, its accounts; the house repo tracks it with its own
|
|
35
|
-
// gitignore line (wiki tools/shipkit/social.md)
|
|
36
|
-
identities: sk('identities'),
|
|
37
33
|
// local: drafts, private notes, venue listings until they go live
|
|
38
34
|
private: sk('private'),
|
|
39
35
|
reflections: sk('reflections'),
|
|
@@ -46,6 +42,8 @@ export const LAYOUT = {
|
|
|
46
42
|
// local: the facts (sha, size, type) of every draft media, so a file the disk let go keeps its key in the media
|
|
47
43
|
// store (wiki tools/shipkit/social.md, Media)
|
|
48
44
|
socialMedia: sk('social-media.json'),
|
|
45
|
+
/** a copy of every file the repo's post groups hold, one folder a sha (wiki tools/shipkit/social-media.md) */
|
|
46
|
+
postMedia: sk('post-media'),
|
|
49
47
|
journal: sk('journal'),
|
|
50
48
|
domain: sk('domain'),
|
|
51
49
|
itch: sk('itch'),
|
|
@@ -68,10 +66,17 @@ export const LAYOUT = {
|
|
|
68
66
|
status: sk('STATUS.md'),
|
|
69
67
|
statusFull: sk('STATUS.full.md'),
|
|
70
68
|
cache: sk('cache'),
|
|
69
|
+
/** @deprecated the identities live in the house repo's wiki: read `HOUSE_LAYOUT.identities` (core/house-layout.ts).
|
|
70
|
+
* Kept for the house repos that still read it, relative to the house root as before */
|
|
71
|
+
identities: 'wiki/identities',
|
|
71
72
|
} as const
|
|
72
73
|
|
|
73
74
|
/** the children the SK004 block re-includes: everything else under `.shipkit/` stays local */
|
|
74
|
-
export const TRACKED_DIRS = [LAYOUT.
|
|
75
|
+
export const TRACKED_DIRS = [LAYOUT.hooks, LAYOUT.identity, LAYOUT.assets, LAYOUT.comfy, LAYOUT.repros, LAYOUT.plans, LAYOUT.releases] as const
|
|
76
|
+
|
|
77
|
+
/** where a repo kept its asks as files before each became a thread of its store: `sk asks migrate` reads it, nothing
|
|
78
|
+
* writes it */
|
|
79
|
+
export const ASK_FILES_DIR = sk('asks')
|
|
75
80
|
|
|
76
81
|
/** a plan file name: `YYYYMMDD-HHMMSS-<slug>.md` */
|
|
77
82
|
export const PLAN_FILE = /^\d{8}-\d{6}-.+\.md$/
|
package/src/core/locked-write.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// whole read-modify-write, the write lands via tmp + rename so a killed
|
|
4
4
|
// process can never leave a torn file, and the loser of a race SKIPS —
|
|
5
5
|
// never corrupts, never blocks.
|
|
6
|
-
import { linkSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, utimesSync, writeFileSync } from 'fs'
|
|
6
|
+
import { chmodSync, linkSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, utimesSync, writeFileSync } from 'fs'
|
|
7
7
|
import { basename, dirname, join } from 'path'
|
|
8
8
|
import { LAYOUT } from './layout.ts'
|
|
9
9
|
import { announceInstance, instanceGone, thisInstance } from './instance.ts'
|
|
@@ -34,9 +34,12 @@ export function withFileLock<T>(path: string, fn: () => T): LockOutcome<T> {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
/** the file replaced whole, its mode kept: a script a repair rewrites still runs */
|
|
37
38
|
export function atomicWrite(path: string, content: string): void {
|
|
38
39
|
const tmpPath = join(dirname(path), `.${basename(path)}.tmp-${process.pid}`)
|
|
40
|
+
const mode = statSync(path, { throwIfNoEntry: false })?.mode
|
|
39
41
|
writeFileSync(tmpPath, content)
|
|
42
|
+
if (mode != null) chmodSync(tmpPath, mode & 0o7777)
|
|
40
43
|
renameSync(tmpPath, path)
|
|
41
44
|
}
|
|
42
45
|
|
package/src/core/machine-db.ts
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
import { Database } from 'bun:sqlite'
|
|
15
15
|
import { chmodSync, closeSync, existsSync, lstatSync, mkdirSync, openSync, readFileSync, readSync, rmSync, statSync, writeFileSync } from 'fs'
|
|
16
16
|
import { dirname, join } from 'path'
|
|
17
|
-
import { homeDir } from '../home/home-paths.ts'
|
|
18
|
-
import { ensureWal, migrateTo } from '../ledger/db.ts'
|
|
17
|
+
import { homeDir, refuseRealHomeInSuite } from '../home/home-paths.ts'
|
|
18
|
+
import { ensureWal, migrateTo, storeSync } from '../ledger/db.ts'
|
|
19
19
|
import { createRefusal, machinePath } from './machine-layout.ts'
|
|
20
20
|
|
|
21
21
|
export const MACHINE_DB_ENV = 'SHIPKIT_MACHINE_DB'
|
|
@@ -28,6 +28,7 @@ export function machineDbPath(): string {
|
|
|
28
28
|
if (env != null && env !== '') return env
|
|
29
29
|
const home = process.env.SHIPKIT_HOME_DIR
|
|
30
30
|
if (home != null && home !== '') return join(home, 'machine.sqlite')
|
|
31
|
+
refuseRealHomeInSuite()
|
|
31
32
|
return machinePath(MACHINE_DB_FILE)
|
|
32
33
|
}
|
|
33
34
|
|
|
@@ -335,6 +336,7 @@ function openMachine(path: string): Database {
|
|
|
335
336
|
db.exec(`pragma busy_timeout = ${BUSY_MS}`)
|
|
336
337
|
machineFileCreate(path, db)
|
|
337
338
|
ensureWal(db, BUSY_MS)
|
|
339
|
+
storeSync(db, 'FULL')
|
|
338
340
|
migrate(db)
|
|
339
341
|
return db
|
|
340
342
|
} catch (e) {
|
|
@@ -353,7 +355,7 @@ export async function machineHeld<R>(body: () => Promise<R>): Promise<R> {
|
|
|
353
355
|
if (held != null) return body()
|
|
354
356
|
const path = machineDbPath()
|
|
355
357
|
const db = openMachine(path)
|
|
356
|
-
db
|
|
358
|
+
storeSync(db, 'NORMAL')
|
|
357
359
|
held = { path, db }
|
|
358
360
|
try {
|
|
359
361
|
return await body()
|
|
@@ -27,7 +27,7 @@ import { dirname, join, posix } from 'path'
|
|
|
27
27
|
import type { RepoConfig } from '../repo-config.ts'
|
|
28
28
|
import { gitBin } from './git-bin.ts'
|
|
29
29
|
import { probeGitRoot } from './git-root.ts'
|
|
30
|
-
import { LAYOUT, MACHINE_PRIVATE, PLAN_FILE, SHIPKIT_DIR } from './layout.ts'
|
|
30
|
+
import { ASK_FILES_DIR, LAYOUT, MACHINE_PRIVATE, PLAN_FILE, SHIPKIT_DIR } from './layout.ts'
|
|
31
31
|
import { machineCommit } from './machine-commit.ts'
|
|
32
32
|
import { nestedIn } from './nesting.ts'
|
|
33
33
|
|
|
@@ -92,8 +92,6 @@ export type PlanInput = {
|
|
|
92
92
|
rootDirs: string[]
|
|
93
93
|
/** names already under `.shipkit/` */
|
|
94
94
|
shipkitEntries?: string[]
|
|
95
|
-
/** repo.config sets `asks.dir`, so the queue lives where the repo said */
|
|
96
|
-
asksDirSet?: boolean
|
|
97
95
|
/** core.hooksPath points at `hooks/` and its pre-commit is shipkit's */
|
|
98
96
|
hooksOurs?: boolean
|
|
99
97
|
/** `tmp/.shipkit` exists */
|
|
@@ -142,7 +140,8 @@ export function planLayoutMigration(i: PlanInput): LayoutPlan {
|
|
|
142
140
|
const typo = KNOWN.find((k) => shapeOf(d) === shapeOf(`rv${k}`))
|
|
143
141
|
if (typo != null) add(d, `${SHIPKIT_DIR}/${typo}`, 'typo')
|
|
144
142
|
}
|
|
145
|
-
|
|
143
|
+
// an old queue of ask files goes where `sk asks migrate` reads it into the thread store
|
|
144
|
+
if (i.rootDirs.includes('asks')) add('asks', ASK_FILES_DIR, 'asks')
|
|
146
145
|
if (i.rootDirs.includes('hooks') && i.hooksOurs === true) add('hooks', LAYOUT.hooks, 'hooks')
|
|
147
146
|
// a cache is never worth a refusal: a warm one at the target wins. It
|
|
148
147
|
// leaves the scratch before the scratch itself moves
|
|
@@ -417,12 +416,11 @@ export function moveMachinePrivate(home: string): void {
|
|
|
417
416
|
} catch { /* absent, or a link already: nothing to move */ }
|
|
418
417
|
}
|
|
419
418
|
|
|
420
|
-
/** what the planner reads off disk
|
|
421
|
-
export function readPlanInput(root: string
|
|
419
|
+
/** what the planner reads off disk */
|
|
420
|
+
export function readPlanInput(root: string): PlanInput {
|
|
422
421
|
return {
|
|
423
422
|
rootDirs: dirsIn(root),
|
|
424
423
|
shipkitEntries: isDir(join(root, SHIPKIT_DIR)) ? readdirSync(join(root, SHIPKIT_DIR)) : [],
|
|
425
|
-
asksDirSet: config?.asks?.dir != null,
|
|
426
424
|
hooksOurs: existsSync(join(root, 'hooks')) && legacyHooksOurs(root),
|
|
427
425
|
legacyCache: isDir(join(root, LEGACY_CACHE)),
|
|
428
426
|
tmpHoldsRepo: isDir(join(root, LEGACY_TMP)) && holdsRepo(join(root, LEGACY_TMP)),
|
|
@@ -432,8 +430,8 @@ export function readPlanInput(root: string, config?: RepoConfig): PlanInput {
|
|
|
432
430
|
}
|
|
433
431
|
|
|
434
432
|
/** a repo still carrying the old layout: the names a check reports */
|
|
435
|
-
export function legacyLayoutLeft(root: string
|
|
436
|
-
const plan = planLayoutMigration(readPlanInput(root
|
|
433
|
+
export function legacyLayoutLeft(root: string): string[] {
|
|
434
|
+
const plan = planLayoutMigration(readPlanInput(root))
|
|
437
435
|
return [...plan.moves.filter((m) => m.kind !== 'cache' && m.kind !== 'plan').map((m) => `${m.from}/`), ...plan.refusals.map((r) => `${r.from}/`)]
|
|
438
436
|
}
|
|
439
437
|
|
|
@@ -497,7 +495,7 @@ function trackedLinks(root: string): { rel: string; target: string }[] {
|
|
|
497
495
|
export function migrateLayout(root: string, o: MigrateOpts = {}): LayoutResult {
|
|
498
496
|
repointStaleHooks(root)
|
|
499
497
|
moveMachinePrivate(homedir())
|
|
500
|
-
const input = readPlanInput(root
|
|
498
|
+
const input = readPlanInput(root)
|
|
501
499
|
const plan = mergeWhereNothingCollides(root, planLayoutMigration(input))
|
|
502
500
|
const legacyStatus = LEGACY_GENERATED.filter((f) => existsSync(join(root, f)))
|
|
503
501
|
const out: LayoutResult = { moved: [], refusals: plan.refusals, swept: [], removed: [] }
|
package/src/home/activity.ts
CHANGED
|
@@ -8,11 +8,8 @@
|
|
|
8
8
|
// shared for ACTIVITY_TTL_MS per window, never served past it, so a page left
|
|
9
9
|
// open costs about one pass a minute however many tabs show it, and a closed
|
|
10
10
|
// one costs nothing.
|
|
11
|
-
import {
|
|
12
|
-
import { join } from 'path'
|
|
13
|
-
import { declinedNow, isClosed, listAsks, type AskWait } from '../asks/asks-queue.ts'
|
|
11
|
+
import { asksOfRepo, isClosed, type AskWait } from '../asks/ask-store.ts'
|
|
14
12
|
import { gitBin } from '../core/git-bin.ts'
|
|
15
|
-
import { LAYOUT } from '../core/layout.ts'
|
|
16
13
|
import { readLastStatusReadonly } from '../ledger/run-log.ts'
|
|
17
14
|
import { checkStateOf, recordOf } from '../serve/project-gutter.ts'
|
|
18
15
|
import { lineText, type Line } from '../core/wire.ts'
|
|
@@ -124,13 +121,10 @@ export function findingsOf(lines: string, status: 'fail' | 'warn', id: string):
|
|
|
124
121
|
export const findingOf = (lines: string, status: 'fail' | 'warn', id: string): string => findingsOf(lines, status, id)[0] ?? ''
|
|
125
122
|
|
|
126
123
|
/** the warnings the repo's asks hold, every ask not done: one that waits for a later day still waits on the owner.
|
|
127
|
-
*
|
|
128
|
-
* work, which is the loud side */
|
|
124
|
+
* A store that cannot be read holds none: its warnings then read as agent work, which is the loud side */
|
|
129
125
|
export function waitsOf(repo: string): AskWait[] {
|
|
130
|
-
const dir = join(repo, LAYOUT.asks)
|
|
131
|
-
if (!existsSync(dir)) return []
|
|
132
126
|
try {
|
|
133
|
-
return
|
|
127
|
+
return asksOfRepo(repo).filter((a) => !isClosed(a.status)).flatMap((a) => a.waits)
|
|
134
128
|
} catch {
|
|
135
129
|
return []
|
|
136
130
|
}
|
|
@@ -139,14 +133,13 @@ export function waitsOf(repo: string): AskWait[] {
|
|
|
139
133
|
/** a warning the owner declined to clear: the words of its line, and the words a reader sees in its place */
|
|
140
134
|
export type DeclinedWait = AskWait & { words: string }
|
|
141
135
|
|
|
142
|
-
/** the warnings the asks the owner declined hold
|
|
143
|
-
*
|
|
136
|
+
/** the warnings the asks the owner declined hold: they wait on nobody, and no agent asks for them again. A store that
|
|
137
|
+
* cannot be read holds none, the loud side again */
|
|
144
138
|
export function declinedWaitsOf(repo: string): DeclinedWait[] {
|
|
145
|
-
const dir = join(repo, LAYOUT.asks)
|
|
146
|
-
if (!existsSync(dir)) return []
|
|
147
139
|
try {
|
|
148
|
-
return
|
|
149
|
-
|
|
140
|
+
return asksOfRepo(repo)
|
|
141
|
+
.filter((a) => a.status === 'declined')
|
|
142
|
+
.flatMap((a) => a.waits.map((w) => ({ ...w, words: `the owner declined it on ${a.closed ?? '?'} (ask:${a.id}): it stays declined` })))
|
|
150
143
|
} catch {
|
|
151
144
|
return []
|
|
152
145
|
}
|