rvlib-shipkit 2.33.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 +36 -0
- package/README.md +7 -0
- package/package.json +1 -1
- package/src/advisors/advisor-view.ts +1 -0
- package/src/advisors/sync.ts +4 -1
- package/src/agent-time/accounts-usage.ts +5 -0
- package/src/agent-time/render.ts +4 -2
- package/src/cli/cmd_BackupTargets.ts +49 -8
- package/src/cli/cmd_Commands.ts +3 -2
- package/src/cli/cmd_Init.ts +1 -1
- package/src/cli/cmd_Media.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 +2 -2
- package/src/cli/cmd_Start.ts +6 -6
- 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/core/memory-watch.ts +1 -1
- package/src/gate/gate-checks.ts +7 -5
- package/src/home/backup-status.ts +54 -13
- package/src/home/backup-verdict.ts +1 -0
- package/src/home/configuration-route.ts +281 -0
- package/src/home/configuration-shape.ts +167 -0
- package/src/home/daemon-jobs.ts +5 -0
- package/src/home/home-routes.ts +9 -2
- package/src/home/house-bucket.ts +14 -0
- package/src/home/serve-web.ts +1 -1
- package/src/home/this-house.ts +68 -0
- package/src/home/via-hub.ts +2 -1
- package/src/hq/backup-targets.ts +58 -5
- package/src/hq/hq-local.ts +1 -1
- package/src/http/owner-word.ts +1 -0
- package/src/media-store/backup/bucket-target.ts +58 -0
- package/src/media-store/backup/target-send.ts +7 -4
- package/src/media-store/space.ts +2 -0
- package/src/review/cells.ts +6 -2
- package/src/review/store.ts +2 -1
- package/src/scaffold/project-scaffold.ts +2 -2
- package/src/scaffold/starter-house.ts +8 -6
- package/src/secrets/read.ts +1 -1
- package/src/serve/hub-app/auto-text.tsx +3 -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/review/review-thread.tsx +2 -1
- package/src/serve/hub-app/review/thread-st.ts +8 -2
- package/src/serve/hub-app/review/tone-bar.tsx +4 -2
- 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 +9 -9
- package/src/start-repo.ts +27 -30
|
@@ -23,6 +23,7 @@ import { SectionHead } from './section-head.tsx'
|
|
|
23
23
|
import type { SecretsSt } from './secrets-st.ts'
|
|
24
24
|
import { Age, stampWords } from './time-ago.tsx'
|
|
25
25
|
import { tip } from './tips.ts'
|
|
26
|
+
import { Configure } from './configure-link.tsx'
|
|
26
27
|
|
|
27
28
|
const TONE = { red: 't-red', warn: 't-warn', dim: 'ldim' } as const
|
|
28
29
|
|
|
@@ -222,6 +223,7 @@ const Summary = observer(({ app, v }: { app: RepoSt; v: SecretsView }) => {
|
|
|
222
223
|
<div className="stagewrap">
|
|
223
224
|
<div className="sxpage">
|
|
224
225
|
<Top app={app}><div className="cghead">{v.house ? 'the secrets of the house' : `the secrets ${v.repo} reads`}<span className="cnt">{v.rows.length}</span></div></Top>
|
|
226
|
+
<Configure app={app.home} topic="secrets" />
|
|
225
227
|
{v.notes.map((n) => <div key={n} className="sxnote t-warn">{n}</div>)}
|
|
226
228
|
{needs.length === 0 ? <div className="sxcalm ldim">{quietLine(v.rows, v)}: nothing waits on you</div> : (
|
|
227
229
|
<>
|
|
@@ -20,6 +20,7 @@ import { FactRow } from './vault-view.tsx'
|
|
|
20
20
|
import { entryMark } from './vault-st.ts'
|
|
21
21
|
import { ageWords, bytesWords } from '../../core/words.ts'
|
|
22
22
|
import { tip } from './tips.ts'
|
|
23
|
+
import { Configure } from './configure-link.tsx'
|
|
23
24
|
|
|
24
25
|
/** what each entry of the bar holds, said beside its name on the right */
|
|
25
26
|
const ABOUT: Record<SpaceEntry, string> = {
|
|
@@ -185,6 +186,7 @@ export const SpaceView = observer(({ app }: { app: HomeSt }) => {
|
|
|
185
186
|
<span className={`acring${busy || st.asking ? ' on' : ''}`}>↻</span>
|
|
186
187
|
</button>
|
|
187
188
|
<span className="acdim">{d == null ? (st.error !== '' ? '' : 'reading what the listing kept…') : v == null ? `${d.machine} · the house config names no Space` : narrow ? `${v.title} · ${shortListed(v, d.at)}` : `${d.machine} · ${v.title}, ${v.role} · ${shortListed(v, d.at)} · a page to read, nothing is changed from here · in the console: sk space`}</span>
|
|
189
|
+
<Configure app={app} topic="media" />
|
|
188
190
|
</div>
|
|
189
191
|
{st.error !== '' ? <div className="hnote mcerr">{st.error}</div> : null}
|
|
190
192
|
{d == null || v == null ? null : (
|
|
@@ -19,6 +19,7 @@ import { plainClick, repoPage, type HomeSt } from './home-st.ts'
|
|
|
19
19
|
import { type Col, Hint, Table } from './time-charts.tsx'
|
|
20
20
|
import { entryMark, factsOf, VAULT_ENTRIES, type VaultEntry, type VaultSt } from './vault-st.ts'
|
|
21
21
|
import { tip } from './tips.ts'
|
|
22
|
+
import { Configure } from './configure-link.tsx'
|
|
22
23
|
|
|
23
24
|
const clock = (at: number): string => new Date(at).toTimeString().slice(0, 5)
|
|
24
25
|
|
|
@@ -193,6 +194,7 @@ export const VaultView = observer(({ app }: { app: HomeSt }) => {
|
|
|
193
194
|
<span className={`acring${st.loading ? ' on' : ''}`}>↻</span>
|
|
194
195
|
</button>
|
|
195
196
|
<span className="acdim">{d == null ? (st.error !== '' ? '' : 'reading the vault…') : `${d.machine} · read at ${clock(d.at)} · a page to read, nothing is changed from here · in the console: sk vault status (--secrets for the names)`}</span>
|
|
197
|
+
<Configure app={app} topic="vault" />
|
|
196
198
|
</div>
|
|
197
199
|
{st.error !== '' ? <div className="hnote mcerr">{st.error}</div> : null}
|
|
198
200
|
{d == null ? null : (
|
package/src/setup-house.ts
CHANGED
|
@@ -15,6 +15,7 @@ import { consumerOf } from './core/machine-link.ts'
|
|
|
15
15
|
import { runner, type Run } from './git-bootstrap.ts'
|
|
16
16
|
import { installedHouseRoot, plistPath } from './home/home-launchd.ts'
|
|
17
17
|
import { daemonUp, homeUp, pmUp } from './home/home-paths.ts'
|
|
18
|
+
import { houseLine } from './home/this-house.ts'
|
|
18
19
|
import { includeTargets } from './house/project-gutter.ts'
|
|
19
20
|
import { initRepo } from './init-repo.ts'
|
|
20
21
|
import { loadRepoConfig } from './repo-config.ts'
|
|
@@ -43,6 +44,8 @@ export type SetupOpts = {
|
|
|
43
44
|
realHome?: string
|
|
44
45
|
/** answers whether a pm, daemon or web of shipkit runs on this machine's ports */
|
|
45
46
|
portsUp?: () => Promise<string[]>
|
|
47
|
+
/** the pages shipkit generates for a new house (cli/house-pages.ts), none by default */
|
|
48
|
+
generated?: () => Promise<Record<string, string>>
|
|
46
49
|
/** how a command runs in a folder: `bun add`, git. Injected by tests */
|
|
47
50
|
run?: (bin: string, cwd: string) => Run
|
|
48
51
|
which?: (bin: string) => string | null
|
|
@@ -94,13 +97,6 @@ async function defaultPortsUp(): Promise<string[]> {
|
|
|
94
97
|
return [pm ? 'pm' : null, daemon ? 'daemon' : null, web ? 'web' : null].filter((x): x is string => x != null)
|
|
95
98
|
}
|
|
96
99
|
|
|
97
|
-
/** the line 1 a wired repo's CLAUDE.md carries: the house index, `~/` relative when it sits under the home */
|
|
98
|
-
export function houseLine(house: string, home: string): string {
|
|
99
|
-
const index = join(house, HOUSE_WIKI_INDEX)
|
|
100
|
-
// a home behind a symlink (/var → /private/var) would expand `~/` to another spelling of the path
|
|
101
|
-
return inside(index, home) && real(home) === home ? `@~/${relative(home, index)}` : `@${index}`
|
|
102
|
-
}
|
|
103
|
-
|
|
104
100
|
/** what is in the way, each a line with its fix; empty when setup may go on. Reads, never writes */
|
|
105
101
|
export async function refusals(o: { repo: string; house: string; home: string; scratch: boolean; realHome: string; platform: string; portsUp: () => Promise<string[]>; which: (b: string) => string | null; gitIdentity: () => Promise<{ name: string; email: string }> }): Promise<string[]> {
|
|
106
102
|
const out: string[] = []
|
|
@@ -228,9 +224,13 @@ export async function setupHouse(o: SetupOpts = {}): Promise<number> {
|
|
|
228
224
|
|
|
229
225
|
// the plan: every path, every act, every network call
|
|
230
226
|
const line = houseLine(house, home)
|
|
231
|
-
const houseFiles = fileItems(house, starterHouseFiles(houseName))
|
|
232
227
|
const houseIsGit = existsSync(join(house, '.git'))
|
|
233
228
|
const houseHasCommit = houseIsGit && (await run('git', house)(['rev-parse', '--verify', '-q', 'HEAD'])).code === 0
|
|
229
|
+
// a house with its first commit is the user's: its generated pages stay as they are on the disk, none is added
|
|
230
|
+
const made = o.generated == null ? {} : await o.generated()
|
|
231
|
+
const generated = houseHasCommit ? Object.fromEntries(Object.keys(made).flatMap((rel) => ((text) => (text == null ? [] : [[rel, text]]))(readText(join(house, rel))))) : made
|
|
232
|
+
const starter = starterHouseFiles(houseName, generated)
|
|
233
|
+
const houseFiles = fileItems(house, starter)
|
|
234
234
|
const houseGit: Item = houseHasCommit ? { act: 'same', path: join(house, '.git'), what: 'a git repo with its first commit already' } : { act: 'run', path: house, what: `${houseIsGit ? '' : 'git init and '}the first commit, local only: no remote, no push` }
|
|
235
235
|
const libSpec = o.lib ?? `rvlib-shipkit@^${LIB_VERSION}`
|
|
236
236
|
const lib: Item = resolvesLib(repo) ? { act: 'same', path: repo, what: 'shipkit is installed here already' } : { act: 'run', path: repo, what: `bun add -d ${libSpec}: the one network call, to the npm registry, so repo.config.ts and the hooks load shipkit` }
|
|
@@ -269,7 +269,7 @@ export async function setupHouse(o: SetupOpts = {}): Promise<number> {
|
|
|
269
269
|
const fresh = houseFiles.filter((x) => x.act === 'create')
|
|
270
270
|
for (const i of fresh) {
|
|
271
271
|
mkdirSync(dirname(i.path), { recursive: true })
|
|
272
|
-
writeFileSync(i.path,
|
|
272
|
+
writeFileSync(i.path, starter[relative(house, i.path)]!)
|
|
273
273
|
}
|
|
274
274
|
if (fresh.length > 0) p(`ok: ${fresh.length} file(s) of the house written in ${house}`)
|
|
275
275
|
if (houseGit.act === 'run') {
|
package/src/start-repo.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// `shipkit start` — ensure <root>/<name> exists and that CLAUDE.md carries
|
|
2
|
-
// its include lines (in order, at the top): the
|
|
3
|
-
// --include overrides them or
|
|
2
|
+
// its include lines (in order, at the top): the house's own lines, unless
|
|
3
|
+
// --include overrides them or this machine has no house, then
|
|
4
4
|
// `@./agent/index.md` whenever the repo has that file, because the scaffold
|
|
5
5
|
// writes it and SK003 fails a repo that has it unrouted. Plain module behind
|
|
6
6
|
// cmd_Start. Status lines go to STDERR —
|
|
@@ -9,9 +9,10 @@
|
|
|
9
9
|
// for its parent shell).
|
|
10
10
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs'
|
|
11
11
|
import { homedir } from 'os'
|
|
12
|
-
import {
|
|
12
|
+
import { join } from 'path'
|
|
13
13
|
import { ensureGitRepo, ensureIgnoreBaseline, firstGhLine, isScratch, publishRepo, runner, type Run } from './git-bootstrap.ts'
|
|
14
14
|
import { initRepo } from './init-repo.ts'
|
|
15
|
+
import { houseLine, isStarterHouse, reposRoot, thisHouse } from './home/this-house.ts'
|
|
15
16
|
import { AGENT_LINE } from './checks/SK003-claude-md-shape.check.ts'
|
|
16
17
|
import { writeContextLine } from './context/context-line.ts'
|
|
17
18
|
import { writeProjectContext } from './context/project-context.ts'
|
|
@@ -19,36 +20,31 @@ import { adoptCli, adoptHouse, installedLib, scaffoldProject, TOOLCHAIN } from '
|
|
|
19
20
|
import { kitInstalled } from './scaffold/cli-skeleton.ts'
|
|
20
21
|
import { defaultHubPort } from './http/hub-port.ts'
|
|
21
22
|
|
|
22
|
-
/** the
|
|
23
|
-
*
|
|
24
|
-
* Base context first, the repo's own router last, so repo docs override.
|
|
25
|
-
* A public repo swaps line 1 for the gitignored `@./CLAUDE.local.md`,
|
|
23
|
+
/** the lines of a started repo: the house of this machine first (home/this-house.ts), the repo's own router last, so
|
|
24
|
+
* repo docs override. A public repo swaps line 1 for the gitignored `@./CLAUDE.local.md`,
|
|
26
25
|
* which is why that line satisfies the first include (SK003) */
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
export const houseInclude = (house: string, home: string): string[] => [houseLine(house, home), AGENT_LINE]
|
|
27
|
+
/** whether a start writes the .claude/ policy files, a pre-approved shell allowlist among them: for include lines the
|
|
28
|
+
* caller typed, and for a house its owner wrote; a house `sk setup` made chose no policy, so it widens no permission */
|
|
29
|
+
export const writesPolicy = (o: { include?: readonly string[] | undefined; house: string | null }): boolean => (o.include != null ? o.include.length > 0 : o.house != null && !isStarterHouse(o.house))
|
|
30
|
+
|
|
29
31
|
export const HOUSE_ALSO_OK = ['@./CLAUDE.local.md']
|
|
30
32
|
/** a repo shipkit never touches: no CLAUDE.md, no git, no scaffold, no push */
|
|
31
33
|
export const isSkipped = (name: string, skip: readonly string[]): boolean => skip.includes(name)
|
|
32
34
|
|
|
33
35
|
/** the repo names the house config lists under `start.skip` (a day-job checkout belongs there), [] with no house:
|
|
34
36
|
* the names live on the machine, never in this published lib */
|
|
35
|
-
export async function houseSkip(home: string): Promise<string[]> {
|
|
36
|
-
const
|
|
37
|
-
if (
|
|
37
|
+
export async function houseSkip(home: string, root?: string): Promise<string[]> {
|
|
38
|
+
const house = thisHouse({ home, ...(root != null ? { root } : {}) })
|
|
39
|
+
if (house == null) return []
|
|
38
40
|
const { loadRepoConfig } = await import('./repo-config.ts')
|
|
39
|
-
return [...((await loadRepoConfig(
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/** where the first house line points, `~` resolved against `home` */
|
|
43
|
-
export const housePath = (home: string): string => {
|
|
44
|
-
const p = HOUSE_INCLUDE[0]!.replace(/^@/, '')
|
|
45
|
-
return p.startsWith('~/') ? join(home, p.slice(2)) : p
|
|
41
|
+
return [...((await loadRepoConfig(house)).start?.skip ?? [])]
|
|
46
42
|
}
|
|
47
43
|
|
|
48
44
|
export type StartOpts = {
|
|
49
|
-
/** parent dir for repos — default ~/dev */
|
|
45
|
+
/** parent dir for repos — default the house's own folder, ~/dev with no house */
|
|
50
46
|
root?: string
|
|
51
|
-
/** lines CLAUDE.md must carry, in order; omitted =
|
|
47
|
+
/** lines CLAUDE.md must carry, in order; omitted = the house of this machine, then the agent route. An empty list means no house: only the agent route lands */
|
|
52
48
|
include?: string[]
|
|
53
49
|
/** alternative lines that satisfy the FIRST include — never double-add; omitted = HOUSE_ALSO_OK */
|
|
54
50
|
alsoOk?: string[]
|
|
@@ -74,20 +70,21 @@ export async function startRepo(name: string, opts: StartOpts = {}): Promise<num
|
|
|
74
70
|
return 2
|
|
75
71
|
}
|
|
76
72
|
const home = opts.home ?? homedir()
|
|
77
|
-
const
|
|
73
|
+
const found = thisHouse({ home, ...(opts.root != null ? { root: opts.root } : {}) })
|
|
74
|
+
const root = opts.root ?? reposRoot(found, home)
|
|
75
|
+
const dir = join(root, name)
|
|
78
76
|
const justCreated = !existsSync(dir)
|
|
79
77
|
if (justCreated) {
|
|
80
78
|
mkdirSync(dir, { recursive: true })
|
|
81
79
|
console.error(`ok: created ${dir}`)
|
|
82
80
|
}
|
|
83
|
-
// flags win, else the house, and only on a machine that HAS
|
|
84
|
-
//
|
|
81
|
+
// flags win, else the house, and only on a machine that HAS one:
|
|
82
|
+
// elsewhere the template would be an include
|
|
85
83
|
// pointing at nothing plus the widened agent permissions riding on it
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
if (opts.include == null && !houseOnDisk) console.error(`skip: no house wiki at ${housePath(home)} — CLAUDE.md gets the agent route only, and no .claude/ policy files`)
|
|
84
|
+
const house = opts.include ?? (found != null ? houseInclude(found, home) : [])
|
|
85
|
+
if (opts.include == null && found == null) console.error('skip: no house on this machine (`sk setup` makes one): CLAUDE.md gets the agent route only, and no .claude/ policy files')
|
|
89
86
|
const alt = opts.alsoOk ?? HOUSE_ALSO_OK
|
|
90
|
-
const skipped = isSkipped(name, opts.skip ?? (
|
|
87
|
+
const skipped = isSkipped(name, opts.skip ?? (found != null ? await houseSkip(home, root) : []))
|
|
91
88
|
if (skipped && house.length > 0) console.error(`skip: ${name} is include-exempt — CLAUDE.md untouched`)
|
|
92
89
|
// start is the from-anywhere verb, and a STARTED repo comes out READY:
|
|
93
90
|
// any dir with no commit history gets a minimal package.json, a first
|
|
@@ -156,7 +153,7 @@ export async function startRepo(name: string, opts: StartOpts = {}): Promise<num
|
|
|
156
153
|
// installed lib carries the kit its entry imports
|
|
157
154
|
const kit = kitInstalled(installedLib(dir))
|
|
158
155
|
if (kit === false) console.error(`skip: project CLI — the installed rvlib-shipkit ${installedLib(dir)?.version ?? ''} predates the CLI kit: \`sk start ${name} --cli\` once a release carries it`)
|
|
159
|
-
try { scaffoldProject(dir, { name, port: defaultHubPort(name), print, claudePolicy:
|
|
156
|
+
try { scaffoldProject(dir, { name, port: defaultHubPort(name), print, claudePolicy: writesPolicy({ include: opts.include, house: found }), projectCli: kit !== false }) }
|
|
160
157
|
catch (e) { console.error(`WARN scaffold incomplete in ${dir}: ${e instanceof Error ? e.message : String(e)} — the dir is still yours`) }
|
|
161
158
|
await linkBin(dir, bun)
|
|
162
159
|
}
|
|
@@ -173,7 +170,7 @@ export async function startRepo(name: string, opts: StartOpts = {}): Promise<num
|
|
|
173
170
|
if (cliWritten) await linkBin(dir, bun)
|
|
174
171
|
}
|
|
175
172
|
if (wired && !startable && house.length > 0) {
|
|
176
|
-
try { adoptHouse(dir, { name, print, cli: cliWritten }) }
|
|
173
|
+
try { adoptHouse(dir, { name, print, cli: cliWritten, claudePolicy: writesPolicy({ include: opts.include, house: found }) }) }
|
|
177
174
|
catch (e) { console.error(`WARN could not seed the house files in ${dir}: ${e instanceof Error ? e.message : String(e)} — the dir is still yours`) }
|
|
178
175
|
}
|
|
179
176
|
let unscaffolded = false
|