rvlib-shipkit 2.31.0 → 2.32.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 +31 -0
- package/package.json +1 -1
- package/src/advisors/acts.ts +16 -15
- package/src/advisors/advice.ts +56 -102
- package/src/advisors/advisor-view.ts +98 -73
- package/src/advisors/app-graph.ts +1 -1
- package/src/advisors/app.ts +3 -11
- package/src/advisors/cf-api.ts +1 -1
- package/src/advisors/dir-bucket.ts +4 -3
- package/src/advisors/edge/api.ts +26 -198
- package/src/advisors/edge/bucket.ts +2 -2
- package/src/advisors/edge/handler.ts +13 -155
- package/src/advisors/edge/here.ts +5 -5
- package/src/advisors/edge/pages.ts +12 -9
- package/src/advisors/edge/shell.ts +6 -5
- package/src/advisors/edge/sign-in.ts +101 -36
- package/src/advisors/edge/status.ts +19 -6
- package/src/advisors/edge/types.ts +36 -60
- package/src/advisors/expose.ts +29 -29
- package/src/advisors/here.ts +12 -12
- package/src/advisors/invite-send.ts +79 -35
- package/src/advisors/invite.ts +31 -8
- package/src/advisors/job.ts +24 -16
- package/src/advisors/login.ts +40 -15
- package/src/advisors/owner-store.ts +46 -22
- package/src/advisors/photos.ts +3 -3
- package/src/advisors/project.ts +25 -23
- package/src/advisors/reach.ts +89 -0
- package/src/advisors/rights.ts +1 -1
- package/src/advisors/routes.ts +55 -74
- package/src/advisors/scan.ts +0 -4
- package/src/advisors/setup-run.ts +14 -14
- package/src/advisors/share-trace.ts +3 -3
- package/src/advisors/{door-probe.ts → sign-in-probe.ts} +7 -6
- package/src/advisors/speaks.ts +29 -0
- package/src/advisors/sync.ts +92 -182
- package/src/advisors/tunnel.ts +6 -5
- package/src/advisors/users-listen.ts +92 -0
- package/src/advisors/users-router.ts +257 -85
- package/src/advisors/users-store.ts +81 -0
- package/src/agent-time/blocked-scan.ts +181 -0
- package/src/agent-time/registry.ts +12 -5
- package/src/agent-time/store.ts +9 -109
- package/src/asks/ask-bar-fold.ts +2 -1
- package/src/asks/ask-close.ts +2 -1
- package/src/asks/ask-doc.ts +2 -1
- package/src/asks/ask-migrate.ts +3 -2
- package/src/asks/ask-steps-fold.ts +2 -1
- package/src/asks/ask-store.ts +4 -3
- package/src/check.ts +3 -43
- package/src/checks/SK001-package-json-shape.check.ts +4 -55
- package/src/checks/SK004-gitignore-policy.check.ts +24 -69
- package/src/checks/SK013-one-way-in-policy.check.ts +3 -7
- package/src/checks/SK017-vscode-hub-task.check.ts +4 -4
- package/src/checks/SK019-tests-run-in-units.check.ts +3 -14
- package/src/checks/SK020-self-spawning-check.check.ts +5 -7
- package/src/checks/SK035-public-clean.check.ts +1 -1
- package/src/checks/SK039-vscode-watch-generated.check.ts +1 -1
- package/src/checks/SK042-post-kinds.check.ts +5 -14
- package/src/checks/SK054-agent-allow-list.check.ts +5 -74
- package/src/checks/SK055-retired-config-keys.check.ts +45 -0
- package/src/cli/cmd_Advisors.ts +11 -45
- package/src/cli/cmd_Asks.ts +3 -10
- package/src/cli/cmd_Backup.ts +25 -127
- package/src/cli/cmd_BackupTargets.ts +1 -1
- package/src/cli/cmd_Checks.ts +0 -14
- package/src/cli/cmd_Db.ts +3 -82
- package/src/cli/cmd_Home.ts +4 -32
- package/src/cli/cmd_Hq.ts +0 -17
- package/src/cli/cmd_Releases.ts +57 -4
- package/src/cli/cmd_Review.ts +333 -354
- package/src/cli/cmd_SocialDrafts.ts +6 -13
- package/src/cli/cmd_ThreadSyncNeeds.ts +6 -2
- package/src/cli/cmd_Time.ts +1 -1
- package/src/cli/cmd_Trailer.ts +1 -1
- package/src/cli/inbox-hook-run.ts +5 -23
- package/src/cli/registry-heads.ts +5 -55
- package/src/cli/registry.ts +1 -5
- package/src/cli/review-here.ts +1 -1
- package/src/cli.ts +2 -2
- package/src/collections/collection-types.ts +1 -1
- package/src/collections/review.ts +5 -4
- package/src/core/agent-allow-policy.ts +32 -2
- package/src/core/agent-env.ts +8 -0
- package/src/core/allow-rows.ts +74 -0
- package/src/core/check-file-names.ts +19 -106
- package/src/core/footprint.ts +17 -13
- package/src/core/identities-root.ts +1 -4
- package/src/core/layout.ts +1 -2
- package/src/core/machine-db.ts +33 -208
- package/src/core/machine-layout.ts +14 -127
- package/src/core/mask-source.ts +60 -0
- package/src/core/memory-watch.ts +17 -14
- package/src/core/motherhome.ts +8 -35
- package/src/core/one-way-in-policy.ts +0 -3
- package/src/core/repo-walk.ts +0 -9
- package/src/core/retention.ts +1 -9
- package/src/core/retired-checks.ts +2 -0
- package/src/core/tmux-policy.ts +1 -1
- package/src/core/tree-watch.ts +2 -2
- package/src/core/when.ts +7 -45
- package/src/gate/discover-checks.ts +42 -32
- package/src/gate/gate-checks.ts +21 -131
- package/src/gate/pre-commit-discovery.ts +16 -25
- package/src/gate/run-check.ts +0 -4
- package/src/gate/run-fix.ts +5 -17
- package/src/gate/run-fixers.ts +6 -42
- package/src/home/app-sign.ts +2 -2
- package/src/home/backup-status.ts +52 -92
- package/src/home/backup-verdict.ts +2 -2
- package/src/home/daemon-jobs.ts +51 -95
- package/src/home/database-words.ts +1 -2
- package/src/home/databases.ts +9 -25
- package/src/home/home-launchd.ts +0 -6
- package/src/home/home-paths.ts +8 -4
- package/src/home/home-routes.ts +3 -10
- package/src/home/home-state.ts +2 -14
- package/src/home/inbox-shape.ts +14 -15
- package/src/home/inbox.ts +1 -1
- package/src/home/machine-repair.ts +102 -103
- package/src/home/resume.ts +1 -15
- package/src/home/run-daemon.ts +4 -11
- package/src/home/space-page.ts +3 -2
- package/src/home/supervise.ts +3 -7
- package/src/hooks/hook-config.ts +6 -7
- package/src/hooks/leak-guard.ts +1 -1
- package/src/hooks/run-hooks.ts +0 -5
- package/src/hq/daemon-db.ts +8 -8
- package/src/hq/door.ts +3 -16
- package/src/hq/hq-db.ts +4 -3
- package/src/hq/hq-local.ts +1 -2
- package/src/hq/hq-store.ts +0 -15
- package/src/hq/item-direct.ts +8 -10
- package/src/hq/item-fill.ts +37 -0
- package/src/hq/kinds/item-gone.ts +7 -10
- package/src/hq/kinds/item-msg.ts +12 -18
- package/src/hq/kinds/item.ts +13 -19
- package/src/hq/kinds/report.ts +3 -4
- package/src/hq/owner-switch.ts +3 -3
- package/src/hq/report.ts +5 -9
- package/src/hq/switch.ts +2 -11
- package/src/hq/thread-sync.ts +5 -17
- package/src/hq/{shapes-words.ts → threads-words.ts} +2 -12
- package/src/http/owner-word.ts +1 -1
- package/src/identities/machine.ts +16 -0
- package/src/init-repo.ts +0 -1
- package/src/ledger/check-stats.ts +6 -5
- package/src/ledger/db.ts +2 -4
- package/src/ledger/record-kept.ts +117 -48
- package/src/ledger/run-log.ts +21 -2
- package/src/ledger/slow-tests.ts +96 -0
- package/src/ledger/store.ts +3 -86
- package/src/ledger/suite-log.ts +8 -2
- package/src/media-store/backup/facts.ts +3 -37
- package/src/media-store/backup/keys.ts +1 -8
- package/src/media-store/backup/manifest.ts +6 -67
- package/src/media-store/backup/restore.ts +4 -13
- package/src/media-store/backup/retention.ts +13 -1
- package/src/media-store/backup/run.ts +6 -267
- package/src/media-store/backup/snapshot.ts +2 -38
- package/src/media-store/backup/sources.ts +3 -113
- package/src/media-store/backup/target-send.ts +5 -29
- package/src/media-store/db.ts +8 -7
- package/src/media-store/forget-one.ts +1 -1
- package/src/media-store/forget.ts +1 -80
- package/src/orchestrator/guards.ts +0 -1
- package/src/orchestrator/presence.ts +2 -2
- package/src/orchestrator/routes.ts +1 -1
- package/src/orchestrator/started.ts +0 -9
- package/src/orchestrator/talk-key.ts +3 -4
- package/src/orchestrator/unheard.ts +1 -1
- package/src/recordings/edit.ts +3 -3
- package/src/recordings/marks-draw.ts +17 -6
- package/src/recordings/marks.ts +120 -9
- package/src/reflections/reflections-queue.ts +3 -10
- package/src/release/notes.ts +1 -1
- package/src/release/public-clean.ts +66 -6
- package/src/release/run-bump.ts +11 -0
- package/src/release/run-release.ts +4 -0
- package/src/releases/from-thread.ts +3 -3
- package/src/releases/model.ts +186 -36
- package/src/releases/store.ts +13 -3
- package/src/releases/validate.ts +83 -0
- package/src/repo-config.ts +29 -64
- package/src/review/answer-kinds.ts +61 -4
- package/src/review/blocked-guard.ts +11 -0
- package/src/review/blocked-object.ts +298 -0
- package/src/review/cells.ts +116 -229
- package/src/review/close.ts +39 -1
- package/src/review/doc-save.ts +3 -2
- package/src/review/draft-item.ts +1 -1
- package/src/review/events.ts +3 -7
- package/src/review/expect.ts +23 -39
- package/src/review/format.ts +79 -46
- package/src/review/glyphs.ts +1 -0
- package/src/review/hand-over.ts +3 -3
- package/src/review/heard.ts +1 -1
- package/src/review/holds-sync.ts +2 -1
- package/src/review/inbox-hook.ts +2 -2
- package/src/review/inbox-read.ts +39 -33
- package/src/review/instruction-guards.ts +12 -0
- package/src/review/instructions.ts +0 -1
- package/src/review/item-db.ts +13 -43
- package/src/review/item-hq.ts +2 -2
- package/src/review/item-rows.ts +3 -14
- package/src/review/kind-catalog.ts +3 -1
- package/src/review/kinds.ts +18 -8
- package/src/review/live-view.ts +3 -0
- package/src/review/media-kind.ts +1 -1
- package/src/review/mentions.ts +1 -2
- package/src/review/model.ts +158 -114
- package/src/review/move.ts +149 -0
- package/src/review/need-threads.ts +3 -2
- package/src/review/object-card.ts +11 -0
- package/src/review/object-read.ts +6 -1
- package/src/review/one-block.ts +1 -1
- package/src/review/owner-read.ts +1 -1
- package/src/review/phone-push.ts +10 -9
- package/src/review/previews.ts +32 -4
- package/src/review/push.ts +2 -2
- package/src/review/recap.ts +129 -0
- package/src/review/referring.ts +6 -3
- package/src/review/reflection-object.ts +4 -3
- package/src/review/routes.ts +49 -19
- package/src/review/secret-route.ts +3 -2
- package/src/review/settle.ts +0 -6
- package/src/review/snooze.ts +5 -3
- package/src/review/speaker.ts +68 -0
- package/src/review/start-title.ts +19 -0
- package/src/review/store.ts +86 -59
- package/src/review/{wakes.ts → thread-events.ts} +92 -7
- package/src/review/thread-md.ts +35 -14
- package/src/review/thread-state.ts +798 -0
- package/src/review/threads.ts +29 -347
- package/src/review/traces.ts +104 -7
- package/src/review/trailer-item.ts +1 -1
- package/src/review/unit.ts +7 -9
- package/src/review/verdict-items.ts +12 -10
- package/src/review/view-layout.ts +25 -1
- package/src/review/watch-feed.ts +1 -2
- package/src/review/working-guards.ts +2 -3
- package/src/rules/untrack-generated.ts +1 -15
- package/src/secrets/lapse.ts +2 -1
- package/src/serve/hub-app/advisor-app.tsx +4 -4
- package/src/serve/hub-app/advisor-face.tsx +9 -3
- package/src/serve/hub-app/advisor-host.ts +27 -27
- package/src/serve/hub-app/advisors-model.ts +17 -8
- package/src/serve/hub-app/advisors-rights.tsx +1 -1
- package/src/serve/hub-app/advisors-st.ts +15 -14
- package/src/serve/hub-app/advisors-view.tsx +13 -11
- package/src/serve/hub-app/app-bridge.ts +23 -3
- package/src/serve/hub-app/asks-page.tsx +1 -1
- package/src/serve/hub-app/auto-text.tsx +71 -16
- package/src/serve/hub-app/check-view.tsx +0 -8
- package/src/serve/hub-app/controls.css +14 -3
- package/src/serve/hub-app/database-view.tsx +1 -2
- package/src/serve/hub-app/git-view.tsx +3 -1
- package/src/serve/hub-app/hub.css +12 -5
- package/src/serve/hub-app/icons.tsx +1 -1
- package/src/serve/hub-app/inbox-view.tsx +1 -2
- package/src/serve/hub-app/live-sources.ts +2 -2
- package/src/serve/hub-app/main-panel.tsx +2 -1
- package/src/serve/hub-app/panel-repo.ts +0 -9
- package/src/serve/hub-app/pic.tsx +29 -12
- package/src/serve/hub-app/polled.ts +16 -2
- package/src/serve/hub-app/recordings-st.ts +23 -2
- package/src/serve/hub-app/recordings-view.tsx +68 -10
- package/src/serve/hub-app/ref-pill.ts +1 -1
- package/src/serve/hub-app/repo-st.ts +1 -2
- package/src/serve/hub-app/review/advisor-add.tsx +1 -1
- package/src/serve/hub-app/review/advisor-invite.tsx +1 -1
- package/src/serve/hub-app/review/draft-body.tsx +2 -2
- package/src/serve/hub-app/review/heard-line.tsx +1 -1
- package/src/serve/hub-app/review/instructions-view.tsx +1 -8
- package/src/serve/hub-app/review/kind-states.tsx +14 -9
- package/src/serve/hub-app/review/kit.tsx +4 -11
- package/src/serve/hub-app/review/lane-bar.tsx +3 -3
- package/src/serve/hub-app/review/lightbox.tsx +15 -11
- package/src/serve/hub-app/review/line-window.ts +4 -1
- package/src/serve/hub-app/review/live-bar-st.ts +2 -2
- package/src/serve/hub-app/review/live-view.tsx +57 -1
- package/src/serve/hub-app/review/object-panel.tsx +20 -8
- package/src/serve/hub-app/review/question-views.tsx +181 -54
- package/src/serve/hub-app/review/recap-bar.tsx +40 -0
- package/src/serve/hub-app/review/request-cell.tsx +48 -0
- package/src/serve/hub-app/review/review-cells.tsx +154 -96
- package/src/serve/hub-app/review/review-host.ts +2 -2
- package/src/serve/hub-app/review/review-kit.ts +17 -11
- package/src/serve/hub-app/review/review-list.tsx +23 -31
- package/src/serve/hub-app/review/review-st.ts +30 -40
- package/src/serve/hub-app/review/review-thread.tsx +139 -85
- package/src/serve/hub-app/review/review-views.tsx +124 -68
- package/src/serve/hub-app/review/share-lines.tsx +4 -4
- package/src/serve/hub-app/review/start-st.ts +2 -5
- package/src/serve/hub-app/review/superseded-runs.ts +4 -3
- package/src/serve/hub-app/review/thread-close.tsx +10 -7
- package/src/serve/hub-app/review/thread-st.ts +372 -201
- package/src/serve/hub-app/review/tone-bar.tsx +126 -0
- package/src/serve/hub-app/review/tones.ts +35 -0
- package/src/serve/hub-app/review/trailer-body.tsx +2 -2
- package/src/serve/hub-app/review/trailer-st.ts +3 -2
- package/src/serve/hub-app/review/trailer-voices-st.ts +3 -2
- package/src/serve/hub-app/review.css +180 -106
- package/src/serve/hub-app/search-view.tsx +1 -1
- package/src/serve/hub-app/social/social-model.ts +0 -4
- package/src/serve/hub-app/source-acts.ts +2 -1
- package/src/serve/hub-app/stores/stores-page.tsx +2 -2
- package/src/serve/hub-app/terminal-sources.tsx +2 -1
- package/src/serve/hub-app/thread-row.tsx +3 -4
- package/src/serve/hub-app/tree-build.ts +0 -4
- package/src/serve/hub-app/urls-view.tsx +2 -1
- package/src/serve/hub-app/view-layout.css +13 -3
- package/src/serve/hub-app/wikis-view.tsx +5 -2
- package/src/serve/hub-runtime.ts +7 -37
- package/src/serve/project-gutter-route.ts +6 -2
- package/src/serve/read-thread.ts +20 -2
- package/src/serve/read-worker.ts +9 -1
- package/src/serve/record-pages.ts +46 -0
- package/src/serve/serve-hub.ts +2 -2
- package/src/serve/terminal-host.ts +1 -1
- package/src/serve/terminal-route.ts +1 -3
- package/src/serve/tracked-watch.ts +1 -3
- package/src/setup-house.ts +2 -2
- package/src/shipkit-files.ts +1 -1
- package/src/shipkit.ts +1 -6
- package/src/shot/film-box.ts +0 -20
- package/src/social/drafts.ts +1 -1
- package/src/social/kinds.ts +6 -29
- package/src/social/load.ts +2 -2
- package/src/social/post-object.ts +3 -2
- package/src/social/release-stage.ts +1 -1
- package/src/social/stage.ts +2 -2
- package/src/stores/model.ts +4 -0
- package/src/stores/routes.ts +11 -3
- package/src/suite/judge-suites.ts +58 -0
- package/src/suite/red-alone.ts +54 -18
- package/src/suite/runner-shapes.ts +2 -2
- package/src/suite/suite-cli.ts +67 -14
- package/src/suite/test-units.ts +2 -1
- package/src/urls/fill.ts +1 -1
- package/src/urls/places.ts +1 -2
- package/src/vault/vault-config.ts +2 -2
- package/src/vault/vault-init.ts +1 -5
- package/src/wiki/graph-page.ts +14 -2
- package/src/advisors/copy-truth.ts +0 -49
- package/src/advisors/door-child.ts +0 -112
- package/src/advisors/door-serve.ts +0 -52
- package/src/advisors/door.ts +0 -118
- package/src/checks/SK016-legacy-check-shapes.check.ts +0 -189
- package/src/checks/SK029-explicit-check-files.check.ts +0 -112
- package/src/checks/SK048-one-local-file.check.ts +0 -36
- package/src/core/config-rewrite.ts +0 -111
- package/src/core/daemon-port.ts +0 -10
- package/src/core/legacy-shapes.ts +0 -263
- package/src/core/migrate-layout.ts +0 -638
- package/src/core/port-check-cli.ts +0 -52
- package/src/core/port-check-file.ts +0 -295
- package/src/core/port-check-files.ts +0 -31
- package/src/gate/discover-legacy-checks.ts +0 -26
- package/src/home/home-move.ts +0 -527
- package/src/home/machine-fold.ts +0 -810
- package/src/hq/item-shapes.ts +0 -54
- package/src/hq/kinds/items-read.ts +0 -4
- package/src/media-store/backup/daemon.ts +0 -220
- package/src/media-store/backup/kept.ts +0 -241
- package/src/media-store/backup/prune.ts +0 -359
- package/src/media-store/backup/secret.ts +0 -88
- package/src/media-store/backup/ssh-space.ts +0 -202
- package/src/media-store/backup/watch.ts +0 -117
- package/src/review/band.ts +0 -182
- package/src/review/folders.ts +0 -216
- package/src/review/hook-ask.ts +0 -58
- package/src/review/role.ts +0 -48
- package/src/review/thread-fold.ts +0 -64
- package/src/review/wait.ts +0 -91
- package/src/rules/rule.ts +0 -43
- package/src/serve/hook-thread.ts +0 -37
- package/src/serve/hook-work.ts +0 -92
- package/src/serve/hook-worker.ts +0 -57
- package/src/serve/hub-app/review/dock.tsx +0 -147
- package/src/serve/hub-app/review/faces.tsx +0 -18
- package/src/serve/hub-app/review/item-verdict.tsx +0 -112
- package/src/serve/hub-app/review/review-board.tsx +0 -48
- /package/src/{scaffold → core}/jsonc-spans.ts +0 -0
|
@@ -22,16 +22,16 @@ class SocialDraftsImportCommand extends Command {
|
|
|
22
22
|
static override paths = [['social', 'drafts', 'import']]
|
|
23
23
|
static override usage = Command.Usage({
|
|
24
24
|
category: 'Social',
|
|
25
|
-
description: 'the old drafts folders into the database: a look, or the write
|
|
25
|
+
description: 'the old drafts folders into the database: a look, or the write',
|
|
26
26
|
details:
|
|
27
|
-
"Reads each folder through the desk's own builder: its group, one post per account it reaches (a group heading becomes one post per account), every file. A look by default: each repo's groups, posts by state, files on the disk, in the Space, named and missing. --go
|
|
27
|
+
"Reads each folder through the desk's own builder: its group, one post per account it reaches (a group heading becomes one post per account), every file. A look by default: each repo's groups, posts by state, files on the disk, in the Space, named and missing. --go (the threads are the hq's, its live copy their backup; the folders stay, git or the disk keeps them) keeps every file by its key (a file the Space holds already is never sent again), writes the events with each posted link's moment as the timeline gave it, makes a thread refer to each new group (the version it was staged from, else one opened on it), then loads the desk from the database and compares it with the folders' desk, every draft and post field by field: any difference fails. Re-runnable: what did not move writes nothing. It never writes in the folders. --all: every house repo. Page: wiki tools/shipkit/social.md, The verbs, the thread's block, the import",
|
|
28
28
|
examples: [
|
|
29
29
|
['a look in this repo', 'sk social drafts import'],
|
|
30
|
-
['every house repo
|
|
30
|
+
['every house repo', 'sk social drafts import --all --go'],
|
|
31
31
|
],
|
|
32
32
|
})
|
|
33
33
|
all = Option.Boolean('--all', false, { description: 'every house repo' })
|
|
34
|
-
go = Option.Boolean('--go', false, { description: 'write
|
|
34
|
+
go = Option.Boolean('--go', false, { description: 'write' })
|
|
35
35
|
override async execute(): Promise<number> {
|
|
36
36
|
return guarded(this.context, 'social drafts import', async () => {
|
|
37
37
|
const out = say(this.context)
|
|
@@ -44,19 +44,12 @@ class SocialDraftsImportCommand extends Command {
|
|
|
44
44
|
const { loadSocialUnit } = await import('../social/unit.ts')
|
|
45
45
|
const { importRepo } = await import('../social/import-drafts.ts')
|
|
46
46
|
const roots = (this.all ? (await houseRepoRoots(process.cwd())).map((r) => r.path) : [findRepoRoot(process.cwd())]).filter((r) => existsSync(draftsDir(r)))
|
|
47
|
-
if (this.go)
|
|
48
|
-
for (const argv of [['sk', 'backup'], ['sk', 'backup', 'pin', '--days', '30', '--why', 'before the social migration']]) {
|
|
49
|
-
out(`first: ${argv.join(' ')}`)
|
|
50
|
-
const b = Bun.spawnSync(argv, { stdout: 'pipe', stderr: 'pipe' })
|
|
51
|
-
for (const l of `${b.stdout?.toString() ?? ''}${b.stderr?.toString() ?? ''}`.trim().split('\n').slice(-3)) out(` ${l}`)
|
|
52
|
-
if (b.exitCode !== 0) throw new Error(`${argv.join(' ')} failed: nothing written`)
|
|
53
|
-
}
|
|
54
47
|
let bad = 0
|
|
55
48
|
for (const root of roots) {
|
|
56
49
|
const [config, ids, unit] = await Promise.all([loadRepoConfig(root, { fresh: true }).catch(() => null), loadIdentities({ cwd: root }), loadSocialUnit(root)])
|
|
57
50
|
const r = await importRepo(root, ids, { ...(config?.speaksAs ? { speaksAs: config.speaksAs } : {}), unit, go: this.go, sender: 'machine' })
|
|
58
51
|
out(`${root}: ${r.groups} groups, posts ${r.posts.draft} draft, ${r.posts.posted} posted, ${r.posts.dropped} dropped; files ${r.files.local} on the disk, ${r.files.space} in the Space only, ${r.files.missing} named with no file`)
|
|
59
|
-
if (r.facts.entries > 0) out(` the media facts record: ${r.facts.entries} entries, ${r.facts.used} of folders read${r.facts.orphans.length > 0 ? `, ${r.facts.entries - r.facts.used} of no folder (${r.facts.orphans.join(', ')}): left in the record
|
|
52
|
+
if (r.facts.entries > 0) out(` the media facts record: ${r.facts.entries} entries, ${r.facts.used} of folders read${r.facts.orphans.length > 0 ? `, ${r.facts.entries - r.facts.used} of no folder (${r.facts.orphans.join(', ')}): left in the record` : ''}`)
|
|
60
53
|
for (const m of r.missing) out(` NOT LOADED ${m}: the builder left it out (sk social shows why)`)
|
|
61
54
|
bad += r.missing.length
|
|
62
55
|
if (!this.go) continue
|
|
@@ -65,7 +58,7 @@ class SocialDraftsImportCommand extends Command {
|
|
|
65
58
|
out(` ${r.differs.length} field${r.differs.length === 1 ? '' : 's'} differ between the folders and the database`)
|
|
66
59
|
bad += r.differs.length
|
|
67
60
|
}
|
|
68
|
-
out(this.go ? 'then: sk thread events --check' : `a look: nothing written. sk social drafts import${this.all ? ' --all' : ''} --go
|
|
61
|
+
out(this.go ? 'then: sk thread events --check' : `a look: nothing written. sk social drafts import${this.all ? ' --all' : ''} --go writes`)
|
|
69
62
|
return bad > 0 ? 1 : 0
|
|
70
63
|
})
|
|
71
64
|
}
|
|
@@ -18,7 +18,7 @@ export class ThreadSyncNeedsCommand extends Command {
|
|
|
18
18
|
const { syncNeedThreads } = await import('../review/need-threads.ts')
|
|
19
19
|
const { NEED_KINDS } = await import('../review/need-address.ts')
|
|
20
20
|
const { readAll, storeDir } = await import('../review/store.ts')
|
|
21
|
-
const { orderedThreads,
|
|
21
|
+
const { orderedThreads, threadState } = await import('../review/thread-state.ts')
|
|
22
22
|
const out = (l: string): void => void this.context.stdout.write(`${l}\n`)
|
|
23
23
|
const home = `http://127.0.0.1:${homePort()}`
|
|
24
24
|
const get = async <T>(path: string): Promise<T> => {
|
|
@@ -37,7 +37,11 @@ export class ThreadSyncNeedsCommand extends Command {
|
|
|
37
37
|
const kinds = Object.values(NEED_KINDS).map((k) => `${k}:`)
|
|
38
38
|
const turns = (root: string): string => {
|
|
39
39
|
const by: Record<string, number> = {}
|
|
40
|
-
for (const t of orderedThreads(readAll(storeDir(root)).items))
|
|
40
|
+
for (const t of orderedThreads(readAll(storeDir(root)).items)) {
|
|
41
|
+
if (!kinds.some((k) => t.head.item.on?.startsWith(k))) continue
|
|
42
|
+
const turn = threadState(t).turn
|
|
43
|
+
by[turn] = (by[turn] ?? 0) + 1
|
|
44
|
+
}
|
|
41
45
|
return Object.entries(by).map(([k, n]) => `${n} ${k}`).join(', ') || 'none'
|
|
42
46
|
}
|
|
43
47
|
let failed = 0
|
package/src/cli/cmd_Time.ts
CHANGED
|
@@ -100,7 +100,7 @@ export class TimeCommand extends Command {
|
|
|
100
100
|
try {
|
|
101
101
|
db = openIndex()
|
|
102
102
|
} catch (e) {
|
|
103
|
-
// a
|
|
103
|
+
// a repair at work ends by itself: one line and the exit code of a wait, no stack
|
|
104
104
|
const { StoreRefused, WAIT_EXIT } = await import('../core/machine-db.ts')
|
|
105
105
|
if (!(e instanceof StoreRefused)) throw e
|
|
106
106
|
this.context.stderr.write(`FAIL: ${e.message}\n`)
|
package/src/cli/cmd_Trailer.ts
CHANGED
|
@@ -149,7 +149,7 @@ export class TrailerPlanCommand extends Command {
|
|
|
149
149
|
const known = new Set([...l.t.shots, ...l.t.footage].map((s) => s.name))
|
|
150
150
|
const unknown = shots.filter((s) => !known.has(s))
|
|
151
151
|
if (unknown.length > 0) throw new b.Refused(`${basename(file)} has no shot ${unknown.join(', ')}; its shots: ${[...known].join(', ')}`)
|
|
152
|
-
if (this.waiting !== undefined && !ID_RE.test(this.waiting)) throw new b.Refused(`--waiting takes a version's id (YYYYMMDD-HHMMSS-slug, as sk thread
|
|
152
|
+
if (this.waiting !== undefined && !ID_RE.test(this.waiting)) throw new b.Refused(`--waiting takes a version's id (YYYYMMDD-HHMMSS-slug, as sk thread post prints it), got ${this.waiting}`)
|
|
153
153
|
const by = this.by ?? process.env.SK_AGENT
|
|
154
154
|
if (marks[0] !== 'clear' && !by) throw new b.Refused('--by <lane>: the owner reads who plans each shot (or set SK_AGENT)')
|
|
155
155
|
const { trailer, cut } = cutIdOf(file)
|
|
@@ -82,7 +82,7 @@ type Io = { out: (l: string) => void; err: (l: string) => void }
|
|
|
82
82
|
|
|
83
83
|
/** the hook's work on one event, its input as the text on its stdin, for the repo `cwd` stands in: a resumed lane's
|
|
84
84
|
* threads taken back, then the hook, as the command runs it under its `run` (a refusal is one FAIL line and its exit
|
|
85
|
-
* code). The one body
|
|
85
|
+
* code). The one body the hook's process runs (inboxHookBoot) */
|
|
86
86
|
export async function hookWork(text: string, cwd: string, io: Io): Promise<number> {
|
|
87
87
|
await (await import('../review/take-back.ts')).takeBackAtBoot()
|
|
88
88
|
const { hookPasses, parseHookInput } = await import('../review/inbox-hook.ts')
|
|
@@ -98,27 +98,15 @@ export async function hookWork(text: string, cwd: string, io: Io): Promise<numbe
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
/** the hook as the whole process, `t0` its start
|
|
102
|
-
*
|
|
103
|
-
* on other code, or the env moves a store): the steps of every `sk` call (cli.ts: one copy of the lib, the machine's
|
|
104
|
-
* link, the call logged, pm started when it is down), then hookWork. One step is not in the cli's order: pm is asked
|
|
101
|
+
/** the hook as the whole process, `t0` its start: the steps of every `sk` call (cli.ts: one copy of the lib, the
|
|
102
|
+
* machine's link, the call logged, pm started when it is down), then hookWork. One step is not in the cli's order: pm is asked
|
|
105
103
|
* while the hook works and awaited at its end, since the hook never needs its answer */
|
|
106
104
|
export async function inboxHookBoot(argv: string[], t0: number, io: Io = { out: (l) => void process.stdout.write(`${l}\n`), err: (l) => void process.stderr.write(`${l}\n`) }): Promise<number> {
|
|
107
105
|
const text = process.stdin.isTTY === true ? '' : await new Response(Bun.stdin.stream()).text().catch(() => '')
|
|
108
|
-
const served = await (await import('../review/hook-ask.ts')).askDaemon(text, process.cwd())
|
|
109
|
-
const logged = async (): Promise<void> => {
|
|
110
|
-
const { callsFile, logCall } = await import('./kit/calls.ts')
|
|
111
|
-
logCall(callsFile((await import('node:os')).homedir(), 'sk'), 'sk', argv).matched('thread inbox', performance.now() - t0)
|
|
112
|
-
}
|
|
113
|
-
if (served !== null) {
|
|
114
|
-
await logged()
|
|
115
|
-
lines(served.out, io.out)
|
|
116
|
-
lines(served.err, io.err)
|
|
117
|
-
return served.code
|
|
118
|
-
}
|
|
119
106
|
;(await import('../core/one-lib.ts')).installOneLib()
|
|
120
107
|
await (await import('../core/machine-link.ts')).linkMachineCopy()
|
|
121
|
-
await
|
|
108
|
+
const { callsFile, logCall } = await import('./kit/calls.ts')
|
|
109
|
+
logCall(callsFile((await import('node:os')).homedir(), 'sk'), 'sk', argv).matched('thread inbox', performance.now() - t0)
|
|
122
110
|
const { autostart } = await import('../home/autostart.ts')
|
|
123
111
|
const pm = autostart(argv).catch((e: unknown) => void io.err(`WARN pm was not asked: ${e instanceof Error ? e.message : String(e)}`))
|
|
124
112
|
try {
|
|
@@ -127,9 +115,3 @@ export async function inboxHookBoot(argv: string[], t0: number, io: Io = { out:
|
|
|
127
115
|
await pm
|
|
128
116
|
}
|
|
129
117
|
}
|
|
130
|
-
|
|
131
|
-
/** what a served hook printed, line by line, as its own run prints each */
|
|
132
|
-
function lines(text: string, put: (l: string) => void): void {
|
|
133
|
-
if (text === '') return
|
|
134
|
-
for (const l of text.split('\n').slice(0, text.endsWith('\n') ? -1 : undefined)) put(l)
|
|
135
|
-
}
|
|
@@ -32,7 +32,6 @@ export const HEADS: Heads = {
|
|
|
32
32
|
"gp": ['GlobalProcesses'],
|
|
33
33
|
"gui": ['Home'],
|
|
34
34
|
"history": ['History'],
|
|
35
|
-
"home": ['Home'],
|
|
36
35
|
"hooks": ['Hooks'],
|
|
37
36
|
"hq": ['Hq'],
|
|
38
37
|
"identities": ['Social'],
|
|
@@ -73,7 +72,6 @@ export const HEADS: Heads = {
|
|
|
73
72
|
"trace-audit": ['TraceAudit'],
|
|
74
73
|
"trailer": ['Trailer'],
|
|
75
74
|
"tui": ['Tui'],
|
|
76
|
-
"units": ['Checks'],
|
|
77
75
|
"urls": ['Urls'],
|
|
78
76
|
"vault": ['Vault'],
|
|
79
77
|
"veille": ['Veille'],
|
|
@@ -90,7 +88,6 @@ export const HEADS: Heads = {
|
|
|
90
88
|
"advisors drafts": ['Advisors'],
|
|
91
89
|
"advisors enable": ['Advisors'],
|
|
92
90
|
"advisors expose": ['Advisors'],
|
|
93
|
-
"advisors live": ['Advisors'],
|
|
94
91
|
"advisors people": ['Advisors'],
|
|
95
92
|
"advisors photo": ['Advisors'],
|
|
96
93
|
"advisors renew": ['Advisors'],
|
|
@@ -121,8 +118,6 @@ export const HEADS: Heads = {
|
|
|
121
118
|
"assets gen": ['Assets'],
|
|
122
119
|
"assets identity": ['Assets'],
|
|
123
120
|
"backup drill": ['Backup'],
|
|
124
|
-
"backup pin": ['Backup'],
|
|
125
|
-
"backup prune": ['Backup'],
|
|
126
121
|
"backup restore": ['Backup'],
|
|
127
122
|
"backup runs": ['Backup'],
|
|
128
123
|
"backup status": ['Backup'],
|
|
@@ -130,7 +125,6 @@ export const HEADS: Heads = {
|
|
|
130
125
|
"backup undelete": ['Backup'],
|
|
131
126
|
"daemon job": ['Home'],
|
|
132
127
|
"db drop": ['Db'],
|
|
133
|
-
"db fold": ['Db'],
|
|
134
128
|
"db rebuild": ['Db'],
|
|
135
129
|
"db repair": ['Db'],
|
|
136
130
|
"db threads": ['Db'],
|
|
@@ -162,15 +156,12 @@ export const HEADS: Heads = {
|
|
|
162
156
|
"history check": ['History'],
|
|
163
157
|
"history forget": ['History'],
|
|
164
158
|
"history send": ['History'],
|
|
165
|
-
"home move": ['Home'],
|
|
166
159
|
"hooks commit-msg": ['Hooks'],
|
|
167
160
|
"hooks install": ['Hooks'],
|
|
168
161
|
"hooks list": ['Hooks'],
|
|
169
162
|
"hooks post-commit": ['Hooks'],
|
|
170
163
|
"hooks pre-commit": ['Hooks'],
|
|
171
|
-
"hq cards": ['Hq'],
|
|
172
164
|
"hq close": ['Hq'],
|
|
173
|
-
"hq door": ['Hq'],
|
|
174
165
|
"hq drill": ['Hq'],
|
|
175
166
|
"hq end": ['Hq'],
|
|
176
167
|
"hq forget": ['Hq'],
|
|
@@ -215,43 +206,9 @@ export const HEADS: Heads = {
|
|
|
215
206
|
"rec rm": ['Rec'],
|
|
216
207
|
"rec start": ['Rec'],
|
|
217
208
|
"releases add": ['Releases'],
|
|
209
|
+
"releases check": ['Releases'],
|
|
218
210
|
"releases refresh": ['Releases'],
|
|
219
211
|
"releases remove": ['Releases'],
|
|
220
|
-
"review add": ['Review'],
|
|
221
|
-
"review add-view": ['Review'],
|
|
222
|
-
"review anim": ['Review'],
|
|
223
|
-
"review ask": ['Review'],
|
|
224
|
-
"review auto": ['Review'],
|
|
225
|
-
"review blocked": ['Review'],
|
|
226
|
-
"review board": ['Review'],
|
|
227
|
-
"review claim": ['Review'],
|
|
228
|
-
"review delete": ['Review'],
|
|
229
|
-
"review dispatch": ['Review'],
|
|
230
|
-
"review dispatcher": ['Review'],
|
|
231
|
-
"review done": ['Review'],
|
|
232
|
-
"review drop": ['Review'],
|
|
233
|
-
"review export": ['Review'],
|
|
234
|
-
"review fixed": ['Review'],
|
|
235
|
-
"review import": ['Review'],
|
|
236
|
-
"review inbox": ['Review'],
|
|
237
|
-
"review ls": ['Review'],
|
|
238
|
-
"review marks": ['Review'],
|
|
239
|
-
"review migrate": ['Review'],
|
|
240
|
-
"review next": ['Review'],
|
|
241
|
-
"review pick": ['Review'],
|
|
242
|
-
"review ready": ['Review'],
|
|
243
|
-
"review reassign": ['Review'],
|
|
244
|
-
"review release": ['Review'],
|
|
245
|
-
"review reopen": ['Review'],
|
|
246
|
-
"review reply": ['Review'],
|
|
247
|
-
"review seen": ['Review'],
|
|
248
|
-
"review show": ['Review'],
|
|
249
|
-
"review stage": ['Review'],
|
|
250
|
-
"review topics": ['Review'],
|
|
251
|
-
"review update": ['Review'],
|
|
252
|
-
"review watch": ['Review'],
|
|
253
|
-
"review withdraw": ['Review'],
|
|
254
|
-
"review wontfix": ['Review'],
|
|
255
212
|
"secret account": ['Secret'],
|
|
256
213
|
"secret archive": ['Secret'],
|
|
257
214
|
"secret audit": ['Secret'],
|
|
@@ -293,46 +250,40 @@ export const HEADS: Heads = {
|
|
|
293
250
|
"space proof": ['Space'],
|
|
294
251
|
"space setup": ['Space'],
|
|
295
252
|
"space snapshot": ['Space'],
|
|
296
|
-
"thread add": ['Review'],
|
|
297
253
|
"thread add-view": ['Review'],
|
|
298
254
|
"thread anim": ['Review'],
|
|
299
255
|
"thread ask": ['Review'],
|
|
300
256
|
"thread assign": ['Review'],
|
|
301
257
|
"thread attach": ['Review'],
|
|
302
258
|
"thread auto": ['Review'],
|
|
303
|
-
"thread blocked": ['Review'],
|
|
304
259
|
"thread board": ['Review'],
|
|
305
260
|
"thread claim": ['Review'],
|
|
261
|
+
"thread close": ['Review'],
|
|
306
262
|
"thread delete": ['Review'],
|
|
307
|
-
"thread dispatch": ['Review'],
|
|
308
|
-
"thread dispatcher": ['Review'],
|
|
309
263
|
"thread done": ['Review'],
|
|
310
|
-
"thread drop": ['Review'],
|
|
311
264
|
"thread events": ['SocialDrafts'],
|
|
312
|
-
"thread export": ['Review'],
|
|
313
265
|
"thread fixed": ['Review'],
|
|
314
266
|
"thread fold-reflections": ['ThreadReflect'],
|
|
315
267
|
"thread holds": ['ThreadHolds'],
|
|
316
|
-
"thread import": ['Review'],
|
|
317
268
|
"thread inbox": ['Review'],
|
|
318
269
|
"thread kinds": ['ThreadKinds'],
|
|
319
270
|
"thread ls": ['Review'],
|
|
320
271
|
"thread marks": ['Review'],
|
|
321
|
-
"thread migrate": ['Review'],
|
|
322
272
|
"thread next": ['Review'],
|
|
323
|
-
"thread pick": ['Review'],
|
|
324
273
|
"thread post": ['Review'],
|
|
325
274
|
"thread propose": ['Review'],
|
|
326
275
|
"thread ready": ['Review'],
|
|
327
|
-
"thread
|
|
276
|
+
"thread recap": ['Review'],
|
|
328
277
|
"thread reflect": ['ThreadReflect'],
|
|
329
278
|
"thread release": ['Review'],
|
|
279
|
+
"thread rename": ['Review'],
|
|
330
280
|
"thread reopen": ['Review'],
|
|
331
281
|
"thread reply": ['Review'],
|
|
332
282
|
"thread seen": ['Review'],
|
|
333
283
|
"thread share": ['Advisors'],
|
|
334
284
|
"thread show": ['Review'],
|
|
335
285
|
"thread stage": ['Review'],
|
|
286
|
+
"thread suggest-move": ['Review'],
|
|
336
287
|
"thread sync-needs": ['ThreadSyncNeeds'],
|
|
337
288
|
"thread tag": ['Review'],
|
|
338
289
|
"thread take": ['Review'],
|
|
@@ -438,7 +389,6 @@ export const HEADS: Heads = {
|
|
|
438
389
|
"trace-audit": ['TraceAudit'],
|
|
439
390
|
"trailer": ['Trailer'],
|
|
440
391
|
"tui": ['Tui'],
|
|
441
|
-
"units": ['Checks'],
|
|
442
392
|
"urls": ['Urls'],
|
|
443
393
|
"vault": ['Vault'],
|
|
444
394
|
"web": ['Home'],
|
package/src/cli/registry.ts
CHANGED
|
@@ -112,6 +112,7 @@ const ROWS: readonly Row[] = [
|
|
|
112
112
|
row('Release', 'ReleaseCommand'),
|
|
113
113
|
row('Releases', 'ReleasesCommand'),
|
|
114
114
|
row('Releases', 'ReleasesAddCommand'),
|
|
115
|
+
row('Releases', 'ReleasesCheckCommand'),
|
|
115
116
|
row('Releases', 'ReleasesRefreshCommand'),
|
|
116
117
|
row('Releases', 'ReleasesRemoveCommand'),
|
|
117
118
|
row('Hooks', 'HooksInstallCommand'),
|
|
@@ -153,7 +154,6 @@ const ROWS: readonly Row[] = [
|
|
|
153
154
|
row('Home', 'PmInstallCommand'),
|
|
154
155
|
row('Home', 'PmUninstallCommand'),
|
|
155
156
|
row('Home', 'PmRestartCommand'),
|
|
156
|
-
row('Home', 'HomeMoveCommand'),
|
|
157
157
|
row('Home', 'GuiCommand'),
|
|
158
158
|
row('Contracts', 'ContractsCommand'),
|
|
159
159
|
row('Asks', 'AsksCommand'),
|
|
@@ -215,15 +215,11 @@ const ROWS: readonly Row[] = [
|
|
|
215
215
|
row('When', 'WhenCommand'),
|
|
216
216
|
row('CacheAudit', 'CacheAuditCommand'),
|
|
217
217
|
row('TraceAudit', 'TraceAuditCommand'),
|
|
218
|
-
row('Checks', 'UnitsAliasCommand'),
|
|
219
|
-
row('Hq', 'HqCardsAliasCommand'),
|
|
220
|
-
row('Hq', 'HqDoorCommand'),
|
|
221
218
|
row('Commands', 'CommandsCommand'),
|
|
222
219
|
row('Capacity', 'CapacityCommand'),
|
|
223
220
|
row('Lanes', 'LanesCommand'),
|
|
224
221
|
row('Machines', 'MachinesCommand'),
|
|
225
222
|
row('Db', 'DbCommand'),
|
|
226
|
-
row('Db', 'DbFoldCommand'),
|
|
227
223
|
row('Db', 'DbThreadsCommand'),
|
|
228
224
|
row('Db', 'DbDropCommand'),
|
|
229
225
|
row('Db', 'DbRepairCommand'),
|
package/src/cli/review-here.ts
CHANGED
|
@@ -100,7 +100,7 @@ export async function recordedStores(session: string, skip: (dir: string) => boo
|
|
|
100
100
|
const dirs: string[] = []
|
|
101
101
|
const gone: string[] = []
|
|
102
102
|
for (const d of readSessionRecord(session)?.stores ?? []) {
|
|
103
|
-
if (
|
|
103
|
+
if (!existsSync(d) || (await reviewRoot(dirname(dirname(d)))) === null || scratchStore(canonicalStore(d))) {
|
|
104
104
|
gone.push(d)
|
|
105
105
|
continue
|
|
106
106
|
}
|
package/src/cli.ts
CHANGED
|
@@ -58,8 +58,8 @@ async function headGate(raw: string[]): Promise<number | null> {
|
|
|
58
58
|
return o === null ? null : await m.runHeadGate(process.cwd(), { ...o, print: (l) => process.stdout.write(`${l}\n`) })
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
/** true for the one line the inbox hook is wired as, `sk thread inbox --hook
|
|
62
|
-
export const isInboxHookLine = (raw: readonly string[]): boolean => raw.length === 3 &&
|
|
61
|
+
/** true for the one line the inbox hook is wired as, `sk thread inbox --hook`, nothing else on it */
|
|
62
|
+
export const isInboxHookLine = (raw: readonly string[]): boolean => raw.length === 3 && raw[0] === 'thread' && raw[1] === 'inbox' && raw[2] === '--hook'
|
|
63
63
|
|
|
64
64
|
/** the inbox hook, which every session of every house repo runs at each prompt and each turn's end, run by its own
|
|
65
65
|
* small module before the registry loads: the 80 command files cost it 0.1 s each time (cli/inbox-hook-run.ts makes
|
|
@@ -13,7 +13,7 @@ import type { WhenAt, WhenSource } from '../core/when.ts'
|
|
|
13
13
|
import type { RunsCells } from '../core/runs-matrix.ts'
|
|
14
14
|
import type { CheckFrom } from '../gate/gate-checks.ts'
|
|
15
15
|
import type { AskState } from '../review/model.ts'
|
|
16
|
-
import type
|
|
16
|
+
import { type OwnerWait } from '../review/thread-state.ts'
|
|
17
17
|
|
|
18
18
|
export type NeedSeverity = 'red' | 'yellow'
|
|
19
19
|
|
|
@@ -9,12 +9,13 @@ import type { ThreadIndex } from '../review/cells.ts'
|
|
|
9
9
|
import { countsUnread } from '../review/owner-read.ts'
|
|
10
10
|
import { storeIndex } from '../review/store-index.ts'
|
|
11
11
|
import { hasStore, readAllCached, storeDir, warmStore } from '../review/store.ts'
|
|
12
|
-
import {
|
|
12
|
+
import { oldest } from '../review/threads.ts'
|
|
13
13
|
import { cutsOf, trailerIds } from '../review/trailer-desk.ts'
|
|
14
14
|
import { voicesDesk } from '../review/trailer-voices.ts'
|
|
15
15
|
import { recordVoices } from '../trailer/sound/brand.ts'
|
|
16
16
|
import { brandSound } from '../trailer/sound/index.ts'
|
|
17
17
|
import { REVIEW_COL, TRAILER_COL, type Collection, type Instance } from './collection-types.ts'
|
|
18
|
+
import { countedAsItsAsk } from '../review/thread-state.ts'
|
|
18
19
|
|
|
19
20
|
type Entry = ThreadIndex['entries'][number]
|
|
20
21
|
|
|
@@ -25,8 +26,8 @@ type Entry = ThreadIndex['entries'][number]
|
|
|
25
26
|
export function waitingThreads(root: string): { threads: Entry[]; unread: Entry[] } {
|
|
26
27
|
const mine = (storeIndex(root)?.ix.entries ?? []).filter((e) => !countedAsItsAsk(e.t))
|
|
27
28
|
return {
|
|
28
|
-
threads: mine.filter((e) => e.row.turn === 'yours').sort((a, b) => oldest(a.t.head, b.t.head)),
|
|
29
|
-
unread: mine.filter((e) => e.row.unread && countsUnread(e.row.turn)),
|
|
29
|
+
threads: mine.filter((e) => e.row.state.turn === 'yours').sort((a, b) => oldest(a.t.head, b.t.head)),
|
|
30
|
+
unread: mine.filter((e) => e.row.unread && countsUnread(e.row.state.turn)),
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
|
|
@@ -42,7 +43,7 @@ export function reviewCollection(root: string): Collection | null {
|
|
|
42
43
|
await warmStore(dir)
|
|
43
44
|
return waitingThreads(root).threads.map(({ t: { head: x }, row }): Instance => ({
|
|
44
45
|
id: `thread:${x.item.id}`,
|
|
45
|
-
text: `${x.item.title} (${STATUS_LABEL[row.status]})`,
|
|
46
|
+
text: `${x.item.title} (${STATUS_LABEL[row.state.status]})`,
|
|
46
47
|
label: x.item.title,
|
|
47
48
|
slot: x.item.origin.by === 'agent' ? (x.item.origin.lane ?? 'thread') : 'question',
|
|
48
49
|
type: 'thread',
|
|
@@ -12,7 +12,7 @@ export type AllowRow = { row: string; why: string }
|
|
|
12
12
|
|
|
13
13
|
const r = (row: string, why: string): AllowRow => ({ row, why })
|
|
14
14
|
|
|
15
|
-
const THREAD_VERBS = ['post', 'ask', 'propose', 'reply', 'update', 'fixed', 'working', 'seen', 'show', 'inbox', 'watch', 'take', 'add-view', 'withdraw', 'kinds', 'tag', 'reflect'] as const
|
|
15
|
+
const THREAD_VERBS = ['post', 'ask', 'propose', 'reply', 'update', 'fixed', 'working', 'seen', 'show', 'inbox', 'watch', 'take', 'add-view', 'withdraw', 'kinds', 'tag', 'reflect', 'rename', 'close'] as const
|
|
16
16
|
|
|
17
17
|
export const AGENT_ALLOW: readonly AllowRow[] = [
|
|
18
18
|
r('Bash(sk ci *)', 'the gate, every form: repairs and checks this repo only'),
|
|
@@ -62,10 +62,40 @@ export const OUT_SAMPLES: readonly { command: string; why: string }[] = [
|
|
|
62
62
|
// revoke ends a person's access too, more than a share: the owner's act, or his explicit order
|
|
63
63
|
...['advisors revoke Ada', 'advisors revoke --all', 'advisors people --remove Ada'].map((c) => ({ command: `sk ${c}`, why: "ends a person's access, the owner's act" })),
|
|
64
64
|
...['secret get x', 'secret account x', 'secret env x', 'secret set x', 'secret copy m', 'secret rm x', 'secret clip x', 'vault', 'vault status', 'vault destroy x', 'urls code x'].map((c) => ({ command: `sk ${c}`, why: 'prints or moves a secret' })),
|
|
65
|
-
...['db drop', 'media purge', 'media forget x', 'annex forget x', '
|
|
65
|
+
...['db drop', 'media purge', 'media forget x', 'annex forget x', 'tmp sweep', 'worktrees tidy', 'asks decline 1', 'time diet on'].map((c) => ({ command: `sk ${c}`, why: 'deletes or settles for the owner' })),
|
|
66
66
|
...['pm restart', 'pm uninstall', 'daemon', 'gp start x', 'gp stop x', 'gp restart x', 'global-processes start x', 'session start', 'session stop', 'session default L1'].map((c) => ({ command: `sk ${c}`, why: 'drives the machine' })),
|
|
67
67
|
]
|
|
68
68
|
|
|
69
|
+
/** commands past the sk ones that publish, rewrite a remote, delete or overwrite edits: a rule the owner allows for one
|
|
70
|
+
* of them warns on its card (review/blocked-object.ts), as OUT_SAMPLES does for sk */
|
|
71
|
+
const WIDE_RISKS: readonly { re: RegExp; why: string }[] = [
|
|
72
|
+
{ re: /^(?:npm|bun|pnpm|yarn) publish\b/, why: 'publishes' },
|
|
73
|
+
{ re: /^(?:bunx |npx )?wrangler (?:deploy|publish|pages deploy)\b/, why: 'publishes' },
|
|
74
|
+
{ re: /^gh (?:release create|pr merge)\b/, why: 'publishes' },
|
|
75
|
+
{ re: /^git push\b.*(?:\s--force\b|\s-f\b|\s--force-with-lease\b|\s\+\S)/, why: 'rewrites a remote' },
|
|
76
|
+
// the flag as -{2}hard: a rule that recognises the command is not one that runs it (core/hard-reset.ts reads this file)
|
|
77
|
+
{ re: /^git (?:reset -{2}hard|clean -\w*f|checkout -f|checkout -- \.|restore \.|switch --discard-changes)/, why: 'overwrites edits it did not make' },
|
|
78
|
+
{ re: /^(?:sudo )?rm\s/, why: 'deletes' },
|
|
79
|
+
]
|
|
80
|
+
|
|
81
|
+
/** the sample's words before its first placeholder argument: `sk secret get x` → `sk secret get` */
|
|
82
|
+
const stemOf = (command: string): { stem: string; cut: boolean } => {
|
|
83
|
+
const words = command.split(' ')
|
|
84
|
+
const at = words.findIndex((w, i) => i >= 2 && (/^(?:x|Ada|1|m|s1|L1|asset:logo)$/.test(w) || w.startsWith('--')))
|
|
85
|
+
return at === -1 ? { stem: command, cut: false } : { stem: words.slice(0, at).join(' '), cut: true }
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** why one exact command is one no agent should run with no prompt, null when none says so: an sk command of
|
|
89
|
+
* OUT_SAMPLES (the cli answers to `shipkit` too), or a publish, a force push, a delete of any tool */
|
|
90
|
+
export function riskOf(command: string): string | null {
|
|
91
|
+
const c = command.trim().replace(/^shipkit /, 'sk ')
|
|
92
|
+
for (const s of OUT_SAMPLES) {
|
|
93
|
+
const { stem, cut } = stemOf(s.command)
|
|
94
|
+
if (c === s.command || c.startsWith(`${stem} `) || (!cut && c === stem)) return s.why
|
|
95
|
+
}
|
|
96
|
+
return WIDE_RISKS.find((r) => r.re.test(c))?.why ?? null
|
|
97
|
+
}
|
|
98
|
+
|
|
69
99
|
/** does a permission row of Claude Code allow this exact command, read the way its permissions page says.
|
|
70
100
|
* `Bash` alone allows every command, a legacy `x:*` reads as `x *` */
|
|
71
101
|
export function rowAllows(row: string, command: string): boolean {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// the marks a coding agent's session leaves in the shell it runs commands in, and ssh's own: a leaf, so any module may
|
|
2
|
+
// tell an agent's shell from the owner's without importing what reads secrets
|
|
3
|
+
|
|
4
|
+
/** variables a coding agent's session sets in the shell it runs commands in. CLAUDE_CONFIG_DIR is not one: an
|
|
5
|
+
* owner's own terminal may set it to pick an account */
|
|
6
|
+
export const AGENT_ENV = ['CLAUDECODE', 'CLAUDE_CODE_ENTRYPOINT', 'CLAUDE_CODE_SESSION_ID', 'CLAUDE_PID', 'AI_AGENT', 'CODEX_SANDBOX', 'CODEX_THREAD_ID', 'GEMINI_CLI', 'CURSOR_AGENT']
|
|
7
|
+
/** variables ssh sets in the shell of a session it opened: none of an agent's marks travels through it */
|
|
8
|
+
export const SSH_ENV = ['SSH_TTY', 'SSH_CONNECTION', 'SSH_CLIENT']
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// the one writer of a Claude Code settings file's `permissions.allow`: SK054's repair and the owner's allow on a blocked
|
|
2
|
+
// card (review/blocked-object.ts) both go through it. It appends the missing rows in the file's own layout, takes out
|
|
3
|
+
// the retired ones, and leaves every other byte: a row a human added, its order, the deny list and the hooks stay
|
|
4
|
+
import { AGENT_ALLOW, RETIRED_ALLOW } from './agent-allow-policy.ts'
|
|
5
|
+
import { appendEdits, indentAt, insertPoint, parseSpans, removalSpans, splice, type Node } from './jsonc-spans.ts'
|
|
6
|
+
|
|
7
|
+
type Obj = Extract<Node, { kind: 'object' }>
|
|
8
|
+
|
|
9
|
+
/** the allow array of a settings tree, null when it has none; 'broken' when a key holds another kind */
|
|
10
|
+
function allowArray(root: Node): Extract<Node, { kind: 'array' }> | null | 'broken' {
|
|
11
|
+
if (root.kind !== 'object') return 'broken'
|
|
12
|
+
const perms = root.props.find((p) => p.key === 'permissions')
|
|
13
|
+
if (perms == null) return null
|
|
14
|
+
if (perms.value.kind !== 'object') return 'broken'
|
|
15
|
+
const allow = perms.value.props.find((p) => p.key === 'allow')
|
|
16
|
+
if (allow == null) return null
|
|
17
|
+
return allow.value.kind === 'array' ? allow.value : 'broken'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** the rows the settings text lacks, the retired rows it still holds, and the text with the retired ones taken out and
|
|
21
|
+
* the missing ones appended to `permissions.allow` in the file's own layout, every other byte kept; a file that is no
|
|
22
|
+
* object, or whose permissions or allow is of another kind, is 'broken' */
|
|
23
|
+
export function agentAllowRowsOf(
|
|
24
|
+
text: string | null,
|
|
25
|
+
rows: readonly string[] = AGENT_ALLOW.map((x) => x.row),
|
|
26
|
+
retired: readonly string[] = RETIRED_ALLOW,
|
|
27
|
+
): { missing: string[]; stale: string[]; text: string } | 'broken' {
|
|
28
|
+
let out = text
|
|
29
|
+
let stale: string[] = []
|
|
30
|
+
if (text != null && text.trim() !== '') {
|
|
31
|
+
let root: Node
|
|
32
|
+
try { root = parseSpans(text) } catch { return 'broken' }
|
|
33
|
+
const arr = allowArray(root)
|
|
34
|
+
if (arr === 'broken') return 'broken'
|
|
35
|
+
const gone = arr == null ? [] : arr.items.flatMap((n, i) => (n.kind === 'scalar' && retired.includes(n.value as string) ? [i] : []))
|
|
36
|
+
if (arr != null && gone.length > 0) {
|
|
37
|
+
stale = gone.map((i) => (arr.items[i] as { value: string }).value)
|
|
38
|
+
out = removalSpans(text, arr, gone).sort((a, b) => b[0] - a[0]).reduce((t, [s, e]) => t.slice(0, s) + t.slice(e), text)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const r = appendRows(out, rows)
|
|
42
|
+
return r === 'broken' ? r : { ...r, stale }
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function appendRows(text: string | null, rows: readonly string[]): { missing: string[]; text: string } | 'broken' {
|
|
46
|
+
if (text == null || text.trim() === '') {
|
|
47
|
+
const body = rows.map((x) => ` ${JSON.stringify(x)}`).join(',\n')
|
|
48
|
+
return { missing: [...rows], text: `{\n "permissions": {\n "allow": [\n${body}\n ]\n }\n}\n` }
|
|
49
|
+
}
|
|
50
|
+
let root: Node
|
|
51
|
+
try { root = parseSpans(text) } catch { return 'broken' }
|
|
52
|
+
if (root.kind !== 'object') return 'broken'
|
|
53
|
+
const perms = root.props.find((p) => p.key === 'permissions')
|
|
54
|
+
if (perms != null && perms.value.kind !== 'object') return 'broken'
|
|
55
|
+
const allow = perms == null ? undefined : (perms.value as Obj).props.find((p) => p.key === 'allow')
|
|
56
|
+
if (allow != null && allow.value.kind !== 'array') return 'broken'
|
|
57
|
+
const have = new Set(allow == null || allow.value.kind !== 'array' ? [] : allow.value.items.map((n) => (n.kind === 'scalar' ? n.value : null)))
|
|
58
|
+
const missing = rows.filter((x) => !have.has(x))
|
|
59
|
+
if (missing.length === 0) return { missing, text }
|
|
60
|
+
const values = missing.map((x) => JSON.stringify(x))
|
|
61
|
+
// the indent step the file uses, read from its first key: two spaces where it has none
|
|
62
|
+
const unit = root.props[0] == null ? ' ' : indentAt(text, root.props[0].keyStart) || ' '
|
|
63
|
+
if (allow != null && allow.value.kind === 'array') {
|
|
64
|
+
return { missing, text: splice(text, appendEdits(text, allow.value, values, `${indentAt(text, allow.keyStart)}${unit}`)) }
|
|
65
|
+
}
|
|
66
|
+
const into = perms == null ? root : (perms.value as Obj)
|
|
67
|
+
const outer = perms == null ? '' : indentAt(text, perms.keyStart)
|
|
68
|
+
const p = insertPoint(text, into, `${outer}${unit}`)
|
|
69
|
+
const list = (at: string): string => `[\n${values.map((v) => `${at}${unit}${v}`).join(',\n')}\n${at}]`
|
|
70
|
+
const block = perms == null ? `"permissions": {\n${p.indent}${unit}"allow": ${list(`${p.indent}${unit}`)}\n${p.indent}}` : `"allow": ${list(p.indent)}`
|
|
71
|
+
const close = into.props.length === 0 ? `\n${outer}` : ''
|
|
72
|
+
const edits = [{ at: p.at, put: `\n${p.indent}${block}${close}` }, ...(p.comma != null ? [{ at: p.comma, put: ',' }] : [])]
|
|
73
|
+
return { missing, text: splice(text, edits) }
|
|
74
|
+
}
|