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.
Files changed (44) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +7 -0
  3. package/package.json +1 -1
  4. package/src/agent-time/accounts-usage.ts +5 -0
  5. package/src/agent-time/render.ts +4 -2
  6. package/src/cli/cmd_Commands.ts +3 -2
  7. package/src/cli/cmd_Init.ts +1 -1
  8. package/src/cli/cmd_Orchestrator.ts +3 -3
  9. package/src/cli/cmd_Setup.ts +11 -2
  10. package/src/cli/cmd_Shot.ts +1 -1
  11. package/src/cli/cmd_Start.ts +4 -4
  12. package/src/cli/cmd_Time.ts +4 -2
  13. package/src/cli/family-pages.ts +11 -1
  14. package/src/cli/house-pages.ts +34 -0
  15. package/src/home/backup-status.ts +21 -8
  16. package/src/home/backup-verdict.ts +1 -1
  17. package/src/home/configuration-route.ts +281 -0
  18. package/src/home/configuration-shape.ts +167 -0
  19. package/src/home/home-routes.ts +6 -0
  20. package/src/home/serve-web.ts +1 -1
  21. package/src/http/owner-word.ts +1 -0
  22. package/src/scaffold/starter-house.ts +8 -6
  23. package/src/secrets/read.ts +1 -1
  24. package/src/serve/hub-app/backups-view.tsx +4 -2
  25. package/src/serve/hub-app/columns.ts +5 -0
  26. package/src/serve/hub-app/configuration-st.ts +102 -0
  27. package/src/serve/hub-app/configuration-view.tsx +145 -0
  28. package/src/serve/hub-app/configuration.css +27 -0
  29. package/src/serve/hub-app/configure-link.tsx +16 -0
  30. package/src/serve/hub-app/database-view.tsx +3 -3
  31. package/src/serve/hub-app/home-pages.ts +2 -0
  32. package/src/serve/hub-app/home-st.ts +15 -4
  33. package/src/serve/hub-app/home.html +1 -0
  34. package/src/serve/hub-app/hub-app.tsx +2 -0
  35. package/src/serve/hub-app/icons.tsx +2 -0
  36. package/src/serve/hub-app/identities-view.tsx +2 -1
  37. package/src/serve/hub-app/index.html +1 -0
  38. package/src/serve/hub-app/machines-view.tsx +2 -0
  39. package/src/serve/hub-app/place-path.ts +1 -1
  40. package/src/serve/hub-app/projects-svc.ts +2 -1
  41. package/src/serve/hub-app/secrets-page.tsx +2 -0
  42. package/src/serve/hub-app/space-view.tsx +2 -0
  43. package/src/serve/hub-app/vault-view.tsx +2 -0
  44. package/src/setup-house.ts +8 -2
@@ -44,6 +44,8 @@ export type SetupOpts = {
44
44
  realHome?: string
45
45
  /** answers whether a pm, daemon or web of shipkit runs on this machine's ports */
46
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>>
47
49
  /** how a command runs in a folder: `bun add`, git. Injected by tests */
48
50
  run?: (bin: string, cwd: string) => Run
49
51
  which?: (bin: string) => string | null
@@ -222,9 +224,13 @@ export async function setupHouse(o: SetupOpts = {}): Promise<number> {
222
224
 
223
225
  // the plan: every path, every act, every network call
224
226
  const line = houseLine(house, home)
225
- const houseFiles = fileItems(house, starterHouseFiles(houseName))
226
227
  const houseIsGit = existsSync(join(house, '.git'))
227
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)
228
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` }
229
235
  const libSpec = o.lib ?? `rvlib-shipkit@^${LIB_VERSION}`
230
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` }
@@ -263,7 +269,7 @@ export async function setupHouse(o: SetupOpts = {}): Promise<number> {
263
269
  const fresh = houseFiles.filter((x) => x.act === 'create')
264
270
  for (const i of fresh) {
265
271
  mkdirSync(dirname(i.path), { recursive: true })
266
- writeFileSync(i.path, starterHouseFiles(houseName)[relative(house, i.path)]!)
272
+ writeFileSync(i.path, starter[relative(house, i.path)]!)
267
273
  }
268
274
  if (fresh.length > 0) p(`ok: ${fresh.length} file(s) of the house written in ${house}`)
269
275
  if (houseGit.act === 'run') {