rvlib-shipkit 2.34.0 → 2.35.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 +14 -0
- package/README.md +7 -0
- package/package.json +1 -1
- package/src/agent-time/accounts-usage.ts +5 -0
- package/src/agent-time/render.ts +4 -2
- package/src/cli/cmd_Commands.ts +3 -2
- package/src/cli/cmd_Init.ts +1 -1
- package/src/cli/cmd_Orchestrator.ts +3 -3
- package/src/cli/cmd_Setup.ts +11 -2
- package/src/cli/cmd_Shot.ts +1 -1
- package/src/cli/cmd_Start.ts +4 -4
- package/src/cli/cmd_Time.ts +4 -2
- package/src/cli/family-pages.ts +11 -1
- package/src/cli/house-pages.ts +34 -0
- package/src/home/backup-status.ts +21 -8
- package/src/home/backup-verdict.ts +1 -1
- package/src/home/configuration-route.ts +281 -0
- package/src/home/configuration-shape.ts +167 -0
- package/src/home/home-routes.ts +6 -0
- package/src/home/serve-web.ts +1 -1
- package/src/http/owner-word.ts +1 -0
- package/src/scaffold/starter-house.ts +8 -6
- package/src/secrets/read.ts +1 -1
- package/src/serve/hub-app/backups-view.tsx +4 -2
- package/src/serve/hub-app/columns.ts +5 -0
- package/src/serve/hub-app/configuration-st.ts +102 -0
- package/src/serve/hub-app/configuration-view.tsx +145 -0
- package/src/serve/hub-app/configuration.css +27 -0
- package/src/serve/hub-app/configure-link.tsx +16 -0
- package/src/serve/hub-app/database-view.tsx +3 -3
- package/src/serve/hub-app/home-pages.ts +2 -0
- package/src/serve/hub-app/home-st.ts +15 -4
- package/src/serve/hub-app/home.html +1 -0
- package/src/serve/hub-app/hub-app.tsx +2 -0
- package/src/serve/hub-app/icons.tsx +2 -0
- package/src/serve/hub-app/identities-view.tsx +2 -1
- package/src/serve/hub-app/index.html +1 -0
- package/src/serve/hub-app/machines-view.tsx +2 -0
- package/src/serve/hub-app/place-path.ts +1 -1
- package/src/serve/hub-app/projects-svc.ts +2 -1
- package/src/serve/hub-app/secrets-page.tsx +2 -0
- package/src/serve/hub-app/space-view.tsx +2 -0
- package/src/serve/hub-app/vault-view.tsx +2 -0
- package/src/setup-house.ts +8 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## 2.35.0
|
|
2
|
+
|
|
3
|
+
### Added
|
|
4
|
+
|
|
5
|
+
- **The configuration page** (`/configuration` in the hub): everything you can set on this machine, one topic each (backups, secrets, Claude accounts, GitHub, the house, identities, machines, media, the vault, remote, notifications), where each stands and what sets it. Backup targets (a bucket, a machine over ssh, on and off, a try) and secrets are set from it; every act is a click behind the owner's word, a stored secret is replaced only when « replace » is ticked, and a target's address never changes from the page. « Configure » links lead there from the pages these topics show on.
|
|
6
|
+
- **A new house gets the shipkit manual**: `sk setup` writes the two generated pages (`sk commands --everyday`, `sk thread kinds`), and the README says what « wiki <path> » in a help text means.
|
|
7
|
+
|
|
8
|
+
### Changed
|
|
9
|
+
|
|
10
|
+
- **A first backup target has 30 minutes** before a missing copy rings; a house with no media bucket is no longer judged on a Space it does not have.
|
|
11
|
+
- **`sk start`'s CLAUDE.md lines name no `~/dev`**, and the help names no account launcher of one house.
|
|
12
|
+
|
|
13
|
+
Nothing of a newcomer's first run was proven from zero in a container. `sk start` still makes a private GitHub repo and pushes when `gh` is logged in.
|
|
14
|
+
|
|
1
15
|
## 2.34.0
|
|
2
16
|
|
|
3
17
|
### Added
|
package/README.md
CHANGED
|
@@ -15,6 +15,13 @@ sk gui # the hub: threads, asks, checks
|
|
|
15
15
|
|
|
16
16
|
`sk setup` makes your house, `<you>-shipkit-setup`, in the same folder as the repo: a starter wiki that every wired repo loads first, and an empty identities folder. Its plan names every file it writes or changes: it writes nothing through a link and never overwrites a file of yours, but `sk init` reshapes package.json scripts (your `test` moves to `test:raw`) and points git's hooks at `.shipkit/hooks`. It makes one network call, `bun add -d rvlib-shipkit` in the repo. After it, shipkit runs a background service on the Mac for the hub (a LaunchAgent, `com.shipkit.pm`): `sk pm uninstall` stops it.
|
|
17
17
|
|
|
18
|
+
A help text or a message may end with `wiki <path>` (`wiki tools/shipkit/threads.md`), or with `Read first: wiki <path>`. It names a page of the author's manual, which is not shipped yet: `sk <command> --help` is what you have, and the two pages `sk setup` writes into your house, `wiki/shipkit/commands.md` (every command) and `wiki/shipkit/thread-kinds.md` (what shows up in a thread). After an upgrade, run in the house:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
sk commands --everyday --out wiki/shipkit/commands.md
|
|
22
|
+
sk thread kinds --out wiki/shipkit/thread-kinds.md
|
|
23
|
+
```
|
|
24
|
+
|
|
18
25
|
Into a repo by hand, with no house:
|
|
19
26
|
|
|
20
27
|
```sh
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rvlib-shipkit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.35.0",
|
|
4
4
|
"funding": "https://github.com/sponsors/rvion",
|
|
5
5
|
"description": "All-in-one repo companion: ci gate (task DAG), auto-discovered health checks, release-contract fulfillness, asks queue, md-wiki tools, asset atelier, live tui",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,6 +23,11 @@ function windowOf(v: unknown): UsageWindow | null {
|
|
|
23
23
|
return { used, resetsAt: at == null ? null : at * 1000 }
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
/** a config folder's account: the name the main panel shows where a status line or a launcher reported that folder,
|
|
27
|
+
* else the folder's own name, `default` for the plain one */
|
|
28
|
+
export const accountLabel = (folder: string, accounts: readonly { name: string; dir: string | null }[]): string =>
|
|
29
|
+
accounts.find((a) => a.dir != null && (a.dir.split('/').at(-1) ?? '') === folder)?.name ?? (folder === '.claude' ? 'default' : folder.replace(/^\.claude-/, '').replace(/^\./, ''))
|
|
30
|
+
|
|
26
31
|
/** c3 → cc3, the account's usual name; any other tag stays as it is */
|
|
27
32
|
export const accountName = (tag: string): string => (/^c\d+$/.test(tag) ? `c${tag}` : tag)
|
|
28
33
|
|
package/src/agent-time/render.ts
CHANGED
|
@@ -30,7 +30,7 @@ const day = (t: number): string => dayStamp(t)
|
|
|
30
30
|
const when = (t: number): string => stampOf(new Date(t)).slice(5, 16)
|
|
31
31
|
const pct = (part: number, whole: number): string => (whole <= 0 ? '0%' : `${Math.round((100 * part) / whole)}%`)
|
|
32
32
|
const n = (x: number): string => x.toLocaleString('en-US')
|
|
33
|
-
const
|
|
33
|
+
const accountOf = (plain: string) => (a: string): string => (a === '.claude' ? plain : a.replace(/^\.claude-/, ''))
|
|
34
34
|
|
|
35
35
|
function table(head: string[], rows: string[][]): string[] {
|
|
36
36
|
const all = [head, ...rows]
|
|
@@ -211,7 +211,9 @@ function complaint(h: TimeReport['feedback']['hits'][number]): string {
|
|
|
211
211
|
return ` ${when(h.at)} ${h.signals.map((s) => s.rule).join(',')} "${h.text.slice(0, 70)}" ← ${ran}`
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
|
|
214
|
+
/** `plain`: the name of the account of ~/.claude on this machine */
|
|
215
|
+
export function render(r: TimeReport, view: View, top: number, plain = 'default'): string {
|
|
216
|
+
const account = accountOf(plain)
|
|
215
217
|
let out: string[]
|
|
216
218
|
switch (view) {
|
|
217
219
|
case 'summary':
|
package/src/cli/cmd_Commands.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// (the kit in cli/kit/) come out of these functions.
|
|
6
6
|
import { Command, Option } from './clip.ts'
|
|
7
7
|
import { spliceMarkedBlock } from '../core/doc-block.ts'
|
|
8
|
-
import { FAMILY_PAGES } from './family-pages.ts'
|
|
8
|
+
import { FAMILY_PAGES, pagesIn } from './family-pages.ts'
|
|
9
9
|
import { type Effect, type Essential, type Film, marksOf, ROW_OF, runText } from './kit/verb.ts'
|
|
10
10
|
|
|
11
11
|
export type CommandOption = { definition: string; description: string }
|
|
@@ -381,7 +381,8 @@ export class CommandsCommand extends Command {
|
|
|
381
381
|
const write = (s: string): void => void this.context.stdout.write(s)
|
|
382
382
|
const pages = (this.constructor as typeof CommandsCommand).familyPages
|
|
383
383
|
// --everyday is a compact form: it never falls back to the full markdown
|
|
384
|
-
const
|
|
384
|
+
const shownPages = pages == null || this.out == null ? pages : pagesIn(this.out, pages)
|
|
385
|
+
const render = (): string => (this.everyday ? renderEveryday(rows, bin, shownPages) : this.compact ? renderCompact(rows, bin, shownPages) : renderMarkdown(rows, bin))
|
|
385
386
|
if (this.check && this.out == null && this.essentials == null) {
|
|
386
387
|
write(`FAIL: --check compares a page with the binary: name the page with --out <file> or --essentials <file>\n`)
|
|
387
388
|
return 2
|
package/src/cli/cmd_Init.ts
CHANGED
|
@@ -9,7 +9,7 @@ export class InitCommand extends Command {
|
|
|
9
9
|
static override usage = Command.Usage({
|
|
10
10
|
category: 'Setup',
|
|
11
11
|
description: 'wire this dir as a shipkit repo, like git init: a private github repo and a push unless --no-github',
|
|
12
|
-
details: 'wire THE CURRENT DIRECTORY as a shipkit repo, like git init: cwd only, never creates a project dir. scaffolds repo.config.ts + ci/check/contracts package.json scripts + the create-only .vscode/ that starts the watchers and the hub on folder open, prints how the floor resolved, and runs the bootstrap chain around it: git init, then first commit + PRIVATE github repo + push once the scaffold is in. Idempotent on an already-wired repo. To create or adopt
|
|
12
|
+
details: 'wire THE CURRENT DIRECTORY as a shipkit repo, like git init: cwd only, never creates a project dir. scaffolds repo.config.ts + ci/check/contracts package.json scripts + the create-only .vscode/ that starts the watchers and the hub on folder open, prints how the floor resolved, and runs the bootstrap chain around it: git init, then first commit + PRIVATE github repo + push once the scaffold is in. Idempotent on an already-wired repo. To create or adopt a repo beside your house from anywhere: `shipkit start <name>`',
|
|
13
13
|
examples: [
|
|
14
14
|
['wire the repo you are standing in', 'sk init'],
|
|
15
15
|
['local git and the first commit, never touch github', 'sk init --no-github'],
|
|
@@ -86,11 +86,11 @@ export class OrchestratorOnCommand extends Command {
|
|
|
86
86
|
static override usage = Command.Usage({
|
|
87
87
|
category: 'Review',
|
|
88
88
|
description: "start a Claude Code session in a project's CLAUDE section, under the account named",
|
|
89
|
-
details: `A fresh session, through the account's own launcher
|
|
90
|
-
examples: [['this repo, as
|
|
89
|
+
details: `A fresh session, through the account's own launcher where the shell has one, on --model (opus by default), with the brief of a default session and its deny rules; its first prompt runs sk session default. --account is required when this Mac has more than one Claude account; an account at its usage limit is refused. Nothing starts it again when it ends. In the hub, + in the CLAUDE section starts a plain session. ${PAGE}`,
|
|
90
|
+
examples: [['this repo, as the account work', 'sk session start --account work'], ['another repo', 'sk session start my-game --account work']],
|
|
91
91
|
})
|
|
92
92
|
repo = Option.String({ required: false })
|
|
93
|
-
account = Option.String('--account', { description: 'the Claude account
|
|
93
|
+
account = Option.String('--account', { description: 'the Claude account, by the name the hub shows (a numbered one by its number too)' })
|
|
94
94
|
model = Option.String('--model', { description: 'the model it runs on (opus)' })
|
|
95
95
|
async execute(): Promise<number> {
|
|
96
96
|
const repo = await repoHere(this.repo)
|
package/src/cli/cmd_Setup.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
// shipkit setup: a new user's first house and one repo wired to it. Thin clipanion surface; logic in setup-house.ts,
|
|
2
2
|
// imported when it runs.
|
|
3
3
|
import { Command, Option } from './clip.ts'
|
|
4
|
+
import type { Definition } from './cmd_Commands.ts'
|
|
5
|
+
|
|
6
|
+
/** the two pages of a new house, from the whole registry of this binary */
|
|
7
|
+
export async function generatedPages(): Promise<Record<string, string>> {
|
|
8
|
+
const [{ buildCli }, { commandRows, renderEveryday }, { renderCatalog }, { housePages }] = await Promise.all([import('./registry.ts'), import('./cmd_Commands.ts'), import('../review/kind-catalog.ts'), import('./house-pages.ts')])
|
|
9
|
+
const cli = await buildCli()
|
|
10
|
+
const rows = commandRows(cli.definitions() as Definition[], (cli.definitions as (o?: { detailed?: boolean }) => Definition[])({ detailed: true }), 'sk', cli.classes)
|
|
11
|
+
return housePages({ commands: renderEveryday(rows), kinds: renderCatalog() })
|
|
12
|
+
}
|
|
4
13
|
|
|
5
14
|
export class SetupCommand extends Command {
|
|
6
15
|
static override paths = [['setup']]
|
|
@@ -9,7 +18,7 @@ export class SetupCommand extends Command {
|
|
|
9
18
|
static override usage = Command.Usage({
|
|
10
19
|
category: 'Setup',
|
|
11
20
|
description: 'your own house beside this repo, and the repo wired to it: a dry run until --yes',
|
|
12
|
-
details: 'The first command after `bun add -g rvlib-shipkit`. It makes your house, `<you>-shipkit-setup` beside the repo: a starter wiki every wired repo loads first, an empty identities folder, a local git repo. Then it wires this repo: shipkit installed in it (`bun add -d`, the one network call), `sk init` with GitHub off, CLAUDE.md line 1 loading the house, and imports:check off when the repo does not follow its style. Before anything it refuses on a machine that already runs a house, on a repo with no package.json, and on a house folder that is not its own. It prints every path it would write, and writes nothing without --yes. A file that exists and differs is kept and listed. A second run says « nothing to do ». macOS only.',
|
|
21
|
+
details: 'The first command after `bun add -g rvlib-shipkit`. It makes your house, `<you>-shipkit-setup` beside the repo: a starter wiki every wired repo loads first (with every command and every thread kind, two pages shipkit generates), an empty identities folder, a local git repo. Then it wires this repo: shipkit installed in it (`bun add -d`, the one network call), `sk init` with GitHub off, CLAUDE.md line 1 loading the house, and imports:check off when the repo does not follow its style. Before anything it refuses on a machine that already runs a house, on a repo with no package.json, and on a house folder that is not its own. It prints every path it would write, and writes nothing without --yes. A file that exists and differs is kept and listed. A second run says « nothing to do ». macOS only.',
|
|
13
22
|
examples: [
|
|
14
23
|
['see the plan, write nothing', 'sk setup'],
|
|
15
24
|
['write it', 'sk setup --yes'],
|
|
@@ -25,6 +34,6 @@ export class SetupCommand extends Command {
|
|
|
25
34
|
|
|
26
35
|
async execute(): Promise<number> {
|
|
27
36
|
const { setupHouse } = await import('../setup-house.ts')
|
|
28
|
-
return setupHouse({ yes: this.yes, repo: this.repo, house: this.house, home: this.home, lib: this.lib, print: (l) => this.context.stdout.write(`${l}\n`) })
|
|
37
|
+
return setupHouse({ yes: this.yes, repo: this.repo, house: this.house, home: this.home, lib: this.lib, generated: generatedPages, print: (l) => this.context.stdout.write(`${l}\n`) })
|
|
29
38
|
}
|
|
30
39
|
}
|
package/src/cli/cmd_Shot.ts
CHANGED
|
@@ -48,7 +48,7 @@ export class ShotCommand extends Command {
|
|
|
48
48
|
category: 'Serve',
|
|
49
49
|
description: 'a webp of any url through the warm browser (a png with --out x.png), or an mp4 clip with --video',
|
|
50
50
|
details:
|
|
51
|
-
'one warm headless chromium for the whole machine (the `shot` global process, started when down). A still reuses the warm page when it already shows the url, so a warm shot answers in about 0.1 s. A page with `<meta name="shot-ready" content="wait">` is shot once it sets content="ready"; any other page --wait ms after its load; a page that navigates while it loads (a sign in that redirects) gets its wait again where it lands. --full shoots the whole page at the width of the viewport: one file while the page fits the tallest side of its format (webp 16383 px, jpg and png 65535), else tiles in that format, <name>-1, <name>-2… top to bottom, every one printed, so nothing of the page is lost and the format stays the one asked (a jpg instead of a webp would change what the caller asked for, a cut would drop the end of the page); a whole page stops at 131072 px, the cut said in the note. A file of this machine is a url too (its path, or file://). --video films a page that is a canvas through its WebCodecs encoder (H.264 muxed with no second encode), and any other page as chromium paints it (its screencast, encoded by ffmpeg as the frames arrive); --dom films the page even when a canvas fills it. --step <hook> films frame by frame: before each frame the page draws its time t (seconds) in `await window[hook](t)`, then its ready mark, so a slow page films smooth at its fps; a canvas page is encoded by its own WebCodecs at the exact time n / fps, any other page a screenshot a frame. A still with --step is the page drawn at --at s. A session: cookies follow every shot (one jar in memory for the whole machine), the local storage of a page does not: a shot at another viewport, a clip and the idle close (60 s) each start with an empty one, as two browser contexts do. So when an app keeps its session in local storage, open its sign in at the viewport you shoot at; a request the page sees answered 401 or 403 prints its own WARN line. A theme: --theme <hub theme> draws the page with that prefers-color-scheme and the hub reads its `hub:theme` as that theme, written nowhere, so the next shot keeps none; with no flag every shot of the machine takes serve.shotTheme of the house config. Another place: --on <place> runs the same shot on a machine that reports to the hq (sk machines), over ssh, by its own `sk shot` from its house checkout, so its warm browser draws the page and its localhost is its own; each file comes back to --out and leaves its /tmp. A place that does not answer ssh, has no shot service or runs a shipkit whose sk shot refuses the ask fails in one line with the fix. A
|
|
51
|
+
'one warm headless chromium for the whole machine (the `shot` global process, started when down). A still reuses the warm page when it already shows the url, so a warm shot answers in about 0.1 s. A page with `<meta name="shot-ready" content="wait">` is shot once it sets content="ready"; any other page --wait ms after its load; a page that navigates while it loads (a sign in that redirects) gets its wait again where it lands. --full shoots the whole page at the width of the viewport: one file while the page fits the tallest side of its format (webp 16383 px, jpg and png 65535), else tiles in that format, <name>-1, <name>-2… top to bottom, every one printed, so nothing of the page is lost and the format stays the one asked (a jpg instead of a webp would change what the caller asked for, a cut would drop the end of the page); a whole page stops at 131072 px, the cut said in the note. A file of this machine is a url too (its path, or file://). --video films a page that is a canvas through its WebCodecs encoder (H.264 muxed with no second encode), and any other page as chromium paints it (its screencast, encoded by ffmpeg as the frames arrive); --dom films the page even when a canvas fills it. --step <hook> films frame by frame: before each frame the page draws its time t (seconds) in `await window[hook](t)`, then its ready mark, so a slow page films smooth at its fps; a canvas page is encoded by its own WebCodecs at the exact time n / fps, any other page a screenshot a frame. A still with --step is the page drawn at --at s. A session: cookies follow every shot (one jar in memory for the whole machine), the local storage of a page does not: a shot at another viewport, a clip and the idle close (60 s) each start with an empty one, as two browser contexts do. So when an app keeps its session in local storage, open its sign in at the viewport you shoot at; a request the page sees answered 401 or 403 prints its own WARN line. A theme: --theme <hub theme> draws the page with that prefers-color-scheme and the hub reads its `hub:theme` as that theme, written nowhere, so the next shot keeps none; with no flag every shot of the machine takes serve.shotTheme of the house config. Another place: --on <place> runs the same shot on a machine that reports to the hq (sk machines), over ssh, by its own `sk shot` from its house checkout, so its warm browser draws the page and its localhost is its own; each file comes back to --out and leaves its /tmp. A place that does not answer ssh, has no shot service or runs a shipkit whose sk shot refuses the ask fails in one line with the fix. A machine that runs no shipkit place (no daemon, no pm, no shot service) is refused; a repo whose repo.config.ts names such a box in browsers.box films on it with a plain sk shot.',
|
|
52
52
|
examples: [
|
|
53
53
|
['a still of a running dev server', 'sk shot localhost:5173/'],
|
|
54
54
|
['a whole tall page at a phone width', 'sk shot :5173/guest --viewport 390,844 --full --out shots/guest.png'],
|
package/src/cli/cmd_Start.ts
CHANGED
|
@@ -5,14 +5,14 @@ import { Command, Option } from './clip.ts'
|
|
|
5
5
|
|
|
6
6
|
export class StartCommand extends Command {
|
|
7
7
|
static override paths = [['start']]
|
|
8
|
-
static gloss = 'a new repo
|
|
8
|
+
static gloss = 'a new repo beside your house, on GitHub'
|
|
9
9
|
|
|
10
10
|
static override usage = Command.Usage({
|
|
11
11
|
category: 'Setup',
|
|
12
|
-
description: 'create or enter
|
|
13
|
-
details: 'create (or enter)
|
|
12
|
+
description: 'create or enter a repo beside your house: a private github repo and a push unless --no-github',
|
|
13
|
+
details: 'create (or enter) <name> in the folder your house sits in (~/dev with no house) from ANY cwd, READY to work in. On any dir with no commit history it writes the day-one shape (package.json + src/index.ts + the project CLI on the kit (src/cli.ts, src/cli/cmd_Dev.ts, the cli script and a bin of the repo name) + lint/typecheck, tsconfig, .vscode tasks + settings, the verify skill, an agent/ wiki, .shipkit/reflections), installs the toolchain, wires shipkit (repo.config.ts via init), and runs the whole bootstrap chain: git init, first commit, PRIVATE github repo, push. Loose files ride in that first commit, and only a repo with real history is left as it is. Writes are create-only for files, additive for package.json scripts and .gitignore. CLAUDE.md is the house template on its own (its identity line comes at the first gate, SK003) (the house of this machine first, then `@./agent/index.md`, and --include overrides it), applied only on a machine that has a house (`sk setup` makes one), and the agent route lands last whenever the repo has agent/index.md. The house lines also opt the repo into the .claude/ policy files (a pre-approved shell allowlist + the attribution silencer), so a start with no house widens no agent permissions. Prints the dir on stdout so a shell alias can cd there. cwd-only sibling: `shipkit init`',
|
|
14
14
|
examples: [
|
|
15
|
-
['create or enter
|
|
15
|
+
['create or enter pong: dir, package.json, shipkit wiring, git, first commit, private github repo, push, the CLAUDE.md include lines', 'sk start pong'],
|
|
16
16
|
['another house: replace the include lines', "sk start pong --include '@~/wiki/index.md' --include '@./agent/index.md'"],
|
|
17
17
|
['adopt a pre-existing repo from anywhere', 'sk start my-old-project'],
|
|
18
18
|
['force the private github repo for a folder that was already there', 'sk start old-notes --github'],
|
package/src/cli/cmd_Time.ts
CHANGED
|
@@ -51,6 +51,8 @@ export class TimeCommand extends Command {
|
|
|
51
51
|
|
|
52
52
|
async execute(): Promise<number> {
|
|
53
53
|
const { VIEWS, render } = await import('../agent-time/render.ts')
|
|
54
|
+
const [{ accountLabel }, { readAccounts }] = await Promise.all([import('../agent-time/accounts-usage.ts'), import('../agent-time/accounts-usage-disk.ts')])
|
|
55
|
+
const plain = accountLabel('.claude', readAccounts())
|
|
54
56
|
const { sinceOf } = await import('./kit/calls.ts')
|
|
55
57
|
const err = this.context.stderr
|
|
56
58
|
const tty = (err as { isTTY?: boolean }).isTTY === true
|
|
@@ -92,7 +94,7 @@ export class TimeCommand extends Command {
|
|
|
92
94
|
const kept = this.fresh ? null : readKept(cacheDir, key, now)
|
|
93
95
|
if (kept != null) {
|
|
94
96
|
if (this.json) this.context.stdout.write(`${JSON.stringify(kept.report)}\n`)
|
|
95
|
-
else this.context.stdout.write(`${render(kept.report, view, top)}\nas of ${new Date(kept.at).toTimeString().slice(0, 5)}: an answer is kept 5 minutes, --fresh reads again\n`)
|
|
97
|
+
else this.context.stdout.write(`${render(kept.report, view, top, plain)}\nas of ${new Date(kept.at).toTimeString().slice(0, 5)}: an answer is kept 5 minutes, --fresh reads again\n`)
|
|
96
98
|
return 0
|
|
97
99
|
}
|
|
98
100
|
const roots = discoverConfigRoots()
|
|
@@ -143,7 +145,7 @@ export class TimeCommand extends Command {
|
|
|
143
145
|
const report = buildReport(loaded, { repos: labels, from, to: now, repoOf: (p) => repoOfProject(p), hookMatchers }, loadMasker(repos[0] ?? null))
|
|
144
146
|
writeKept(cacheDir, key, report, now)
|
|
145
147
|
if (this.json) this.context.stdout.write(`${JSON.stringify(report)}\n`)
|
|
146
|
-
else this.context.stdout.write(render(report, view, top))
|
|
148
|
+
else this.context.stdout.write(render(report, view, top, plain))
|
|
147
149
|
if (!tty) err.write(indexed)
|
|
148
150
|
return 0
|
|
149
151
|
} finally {
|
package/src/cli/family-pages.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// loaded command page names it in the family's heading, so `sk commands --out` fails on a family missing here
|
|
3
3
|
import { existsSync } from 'fs'
|
|
4
4
|
import { homedir } from 'os'
|
|
5
|
-
import { join } from 'path'
|
|
5
|
+
import { join, resolve, sep } from 'path'
|
|
6
6
|
|
|
7
7
|
export const FAMILY_PAGES: Readonly<Record<string, string>> = {
|
|
8
8
|
Annex: 'tools/shipkit/annex.md',
|
|
@@ -29,6 +29,16 @@ export const FAMILY_PAGES: Readonly<Record<string, string>> = {
|
|
|
29
29
|
Wiki: 'tools/mdwiki/index.md',
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
/** the families whose owner page exists in the wiki a page is in (`<root>/wiki/…`): a wiki of another house holds none
|
|
33
|
+
* of them, and a heading that names one is a dangling reference there. A page in no wiki keeps every family */
|
|
34
|
+
export function pagesIn(page: string, pages: Readonly<Record<string, string>>): Readonly<Record<string, string>> {
|
|
35
|
+
const parts = resolve(page).split(sep)
|
|
36
|
+
const at = parts.lastIndexOf('wiki', parts.length - 2)
|
|
37
|
+
if (at < 0) return pages
|
|
38
|
+
const wiki = parts.slice(0, at + 1).join(sep)
|
|
39
|
+
return Object.fromEntries(Object.entries(pages).filter(([, p]) => existsSync(join(wiki, p))))
|
|
40
|
+
}
|
|
41
|
+
|
|
32
42
|
/** a page as a path any repo can read, when the lib runs from the house repo beside its wiki (`<house>/packages/rvlib-shipkit`);
|
|
33
43
|
* from an install, the page's wiki path */
|
|
34
44
|
export function pageAt(rel: string): string {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// the two pages of a new house that shipkit generates: every command, and what shows up in a thread. Pure text around
|
|
2
|
+
// the generators' blocks; `sk commands --everyday --out` and `sk thread kinds --out` rewrite the same blocks after an
|
|
3
|
+
// upgrade, so the markers are theirs. It ships on npm: no name, path or rule of one owner
|
|
4
|
+
import { BEGIN as COMMANDS_BEGIN, END as COMMANDS_END } from './cmd_Commands.ts'
|
|
5
|
+
import { BEGIN as KINDS_BEGIN, END as KINDS_END } from '../review/kind-catalog.ts'
|
|
6
|
+
|
|
7
|
+
export const HOUSE_COMMANDS = 'wiki/shipkit/commands.md'
|
|
8
|
+
export const HOUSE_THREAD_KINDS = 'wiki/shipkit/thread-kinds.md'
|
|
9
|
+
|
|
10
|
+
/** the pages by their path relative to the house root */
|
|
11
|
+
export function housePages(o: { commands: string; kinds: string }): Record<string, string> {
|
|
12
|
+
return {
|
|
13
|
+
[HOUSE_COMMANDS]: `# shipkit: every command
|
|
14
|
+
|
|
15
|
+
Generated: the everyday commands described, every other one named. One with its flags: \`sk <command> --help\`. After an upgrade of shipkit, in this house: \`sk commands --everyday --out ${HOUSE_COMMANDS}\`.
|
|
16
|
+
|
|
17
|
+
${COMMANDS_BEGIN}
|
|
18
|
+
|
|
19
|
+
${o.commands.trim()}
|
|
20
|
+
|
|
21
|
+
${COMMANDS_END}
|
|
22
|
+
`,
|
|
23
|
+
[HOUSE_THREAD_KINDS]: `# shipkit: what shows up in a thread
|
|
24
|
+
|
|
25
|
+
A thread holds one subject, its address \`<kind>:<key>\`. Generated; a repo's own kinds: \`sk thread kinds\` in it. After an upgrade of shipkit, in this house: \`sk thread kinds --out ${HOUSE_THREAD_KINDS}\`.
|
|
26
|
+
|
|
27
|
+
${KINDS_BEGIN}
|
|
28
|
+
|
|
29
|
+
${o.kinds.trim()}
|
|
30
|
+
|
|
31
|
+
${KINDS_END}
|
|
32
|
+
`,
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -61,6 +61,9 @@ export type BackupInputs = {
|
|
|
61
61
|
secondPlaceKey: boolean | null
|
|
62
62
|
/** a vault runs on this machine, or ran: false is a keychain only machine, which has no vault to copy. Unsaid: true */
|
|
63
63
|
vault?: boolean
|
|
64
|
+
/** the house has a Space, or its config does not say: false is a house with no media bucket, which has no Space to
|
|
65
|
+
* copy. Unsaid: true */
|
|
66
|
+
space?: boolean
|
|
64
67
|
/** a target, a copy or a drill was ever kept here, or the config names a place: false is a machine where no backup
|
|
65
68
|
* was set up yet, which is said once and rings no band. Unsaid: true */
|
|
66
69
|
setUp?: boolean
|
|
@@ -199,7 +202,7 @@ export function backupStatus(d: BackupInputs): BackupStatus {
|
|
|
199
202
|
const stores: StoreRow[] = []
|
|
200
203
|
const alarms: string[] = []
|
|
201
204
|
for (const s of STORES) {
|
|
202
|
-
if (s.id === 'vault' && d.vault === false) continue
|
|
205
|
+
if ((s.id === 'vault' && d.vault === false) || (s.id === 'space' && d.space === false)) continue
|
|
203
206
|
const row = `${judge}/${s.id}`
|
|
204
207
|
const mine = places.map((p): Cell => {
|
|
205
208
|
// a record that does not read leaves its cell orange, never the whole table thrown
|
|
@@ -230,18 +233,26 @@ export function backupStatus(d: BackupInputs): BackupStatus {
|
|
|
230
233
|
return { ...(d.setUp === false ? { notSetUp: true as const } : {}), at: d.now, machine: judge, places, stores, cells, alarms, worst }
|
|
231
234
|
}
|
|
232
235
|
|
|
233
|
-
/**
|
|
234
|
-
|
|
235
|
-
|
|
236
|
+
/** how long a first target waits for its first send before its silence rings */
|
|
237
|
+
export const FIRST_SEND_MS = 30 * 60_000
|
|
238
|
+
|
|
239
|
+
/** whether a backup was ever set up here: a record any send, snapshot or drill kept, a place the config names, or a
|
|
240
|
+
* target old enough that its first send is overdue. A first target added a moment ago is none yet: the daemon's next
|
|
241
|
+
* look sends to it */
|
|
242
|
+
export const everSetUp = (o: { targets: readonly BackupTarget[]; kept: boolean; names: boolean; now: number }): boolean => o.kept || o.names || o.targets.some((t) => o.now - t.at > FIRST_SEND_MS)
|
|
243
|
+
|
|
244
|
+
/** whether the house config names a place for backups, and a Space; a config that does not load may name both: only
|
|
245
|
+
* one read and empty says that none was ever set up */
|
|
246
|
+
async function namesPlace(): Promise<{ any: boolean; space: boolean }> {
|
|
236
247
|
try {
|
|
237
248
|
const { houseRootOf } = await import('./home-start.ts')
|
|
238
249
|
const { loadRepoConfig } = await import('../repo-config.ts')
|
|
239
250
|
const house = houseRootOf(process.cwd())
|
|
240
|
-
if (house == null) return true
|
|
251
|
+
if (house == null) return { any: true, space: true }
|
|
241
252
|
const s = (await loadRepoConfig(house)).serve
|
|
242
|
-
return s?.mediaSpace != null || s?.spaceCopy != null || s?.hqReplica != null
|
|
253
|
+
return { any: s?.mediaSpace != null || s?.spaceCopy != null || s?.hqReplica != null, space: s?.mediaSpace != null }
|
|
243
254
|
} catch {
|
|
244
|
-
return true
|
|
255
|
+
return { any: true, space: true }
|
|
245
256
|
}
|
|
246
257
|
}
|
|
247
258
|
|
|
@@ -279,6 +290,7 @@ export async function readBackupInputs(now = Date.now()): Promise<BackupInputs>
|
|
|
279
290
|
} catch {
|
|
280
291
|
count = 0
|
|
281
292
|
}
|
|
293
|
+
const names = await namesPlace()
|
|
282
294
|
const copyId = targets.find((t) => configBucket(t.address) === 'spaceCopy')?.id
|
|
283
295
|
const second = copyId == null ? null : machineGet<TargetSent>(`target-sent:vault:${copyId}`)
|
|
284
296
|
return {
|
|
@@ -291,7 +303,8 @@ export async function readBackupInputs(now = Date.now()): Promise<BackupInputs>
|
|
|
291
303
|
timeMachine: await timeMachineFacts(now),
|
|
292
304
|
secondPlaceKey: second == null ? null : !('failed' in second && second.failed.startsWith('no key yet')),
|
|
293
305
|
vault: (await import('../secrets/read.ts')).vaultHere() || count > 0 || machineGet('vault-snapshot-sent') != null,
|
|
294
|
-
|
|
306
|
+
space: names.space || targets.some((t) => configBucket(t.address) != null),
|
|
307
|
+
setUp: everSetUp({ targets, kept: folder != null || machineGet('vault-snapshot-sent') != null || machineGet('hq-drill') != null || targets.some((t) => ['vault', 'hq'].some((s) => machineGet(`target-sent:${s}:${t.id}`) != null)), names: names.any, now }),
|
|
295
308
|
}
|
|
296
309
|
}
|
|
297
310
|
|
|
@@ -7,7 +7,7 @@ export const rowName = (r: Pick<StoreRow, 'name'>): string => r.name
|
|
|
7
7
|
|
|
8
8
|
export function verdictWords(s: BackupStatus): string {
|
|
9
9
|
if (s.stale != null) return `not read: ${s.stale}`
|
|
10
|
-
if (s.notSetUp === true) return 'no
|
|
10
|
+
if (s.notSetUp === true) return 'no copy has left this machine yet: what it keeps is on its own disk alone'
|
|
11
11
|
if (s.worst === 'danger') return 'a backup is NOT working'
|
|
12
12
|
if (s.worst === 'warn') return 'not every copy is fresh and proven: the orange lines say what to fix'
|
|
13
13
|
return 'every copy is fresh and proven'
|