@rizom/ops 0.2.0-alpha.22 → 0.2.0-alpha.220

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/README.md +3 -1
  2. package/dist/brains-ops.js +229 -283
  3. package/dist/cert-bootstrap.d.ts +3 -1
  4. package/dist/content-repo-ref.d.ts +10 -0
  5. package/dist/content-repo.d.ts +1 -0
  6. package/dist/deploy.js +99 -166
  7. package/dist/entries/deploy.d.ts +3 -2
  8. package/dist/images.d.ts +76 -0
  9. package/dist/index.d.ts +3 -0
  10. package/dist/index.js +230 -283
  11. package/dist/load-registry.d.ts +25 -2
  12. package/dist/observed-status.d.ts +1 -1
  13. package/dist/origin-ca.d.ts +1 -1
  14. package/dist/parse-args.d.ts +3 -0
  15. package/dist/push-secrets.d.ts +2 -9
  16. package/dist/push-target.d.ts +1 -2
  17. package/dist/run-command.d.ts +1 -1
  18. package/dist/run-subprocess.d.ts +1 -6
  19. package/dist/schema.d.ts +64 -155
  20. package/dist/secrets-encrypt.d.ts +5 -13
  21. package/dist/ssh-key-bootstrap.d.ts +1 -26
  22. package/dist/user-add.d.ts +15 -0
  23. package/dist/verify-user.d.ts +19 -0
  24. package/package.json +44 -42
  25. package/templates/rover-pilot/.env.schema +17 -3
  26. package/templates/rover-pilot/.github/workflows/build.yml +64 -17
  27. package/templates/rover-pilot/.github/workflows/deploy.yml +128 -61
  28. package/templates/rover-pilot/.github/workflows/reconcile.yml +21 -1
  29. package/templates/rover-pilot/README.md +5 -3
  30. package/templates/rover-pilot/deploy/scripts/decrypt-user-secrets.ts +78 -24
  31. package/templates/rover-pilot/deploy/scripts/helpers.ts +3 -0
  32. package/templates/rover-pilot/deploy/scripts/resolve-deploy-handles.ts +12 -3
  33. package/templates/rover-pilot/deploy/scripts/resolve-missing-images.ts +13 -0
  34. package/templates/rover-pilot/deploy/scripts/resolve-user-config.ts +63 -9
  35. package/templates/rover-pilot/deploy/scripts/sync-content-repo.ts +51 -47
  36. package/templates/rover-pilot/deploy/scripts/update-dns.ts +14 -4
  37. package/templates/rover-pilot/deploy/scripts/validate-secrets.ts +1 -1
  38. package/templates/rover-pilot/docs/onboarding-checklist.md +33 -13
  39. package/templates/rover-pilot/docs/operator-playbook.md +183 -10
  40. package/templates/rover-pilot/docs/user-onboarding.md +67 -332
  41. package/templates/rover-pilot/pilot.yaml +1 -1
  42. package/templates/rover-pilot/.kamal/hooks/pre-deploy +0 -9
  43. package/templates/rover-pilot/deploy/Dockerfile +0 -30
  44. package/templates/rover-pilot/deploy/kamal/deploy.yml +0 -40
@@ -1,2 +1,3 @@
1
- export { readJsonResponse, parseEnvFile, parseEnvSchema, parseEnvSchemaFile, requireEnv, writeGitHubOutput, writeGitHubEnv, } from "@brains/utils";
2
- export type { EnvSchemaEntry } from "@brains/utils";
1
+ export { readJsonResponse, parseEnvFile, parseEnvSchema, parseEnvSchemaFile, requireEnv, writeGitHubOutput, writeGitHubEnv, } from "@brains/deploy-support";
2
+ export type { EnvSchemaEntry } from "@brains/deploy-support";
3
+ export { siteImageTag, sitePackagesFor, requiredImages, resolveImageBuilds, runResolveMissingImages, type ImageRequirementSource, type RequiredImage, type ResolveImageBuildsOptions, type RunResolveMissingImagesOptions, } from "../images";
@@ -0,0 +1,76 @@
1
+ import { type ResolvedSiteOverride } from "./load-registry";
2
+ import { type RunCommand } from "./run-subprocess";
3
+ /**
4
+ * Resolve a fleet image tag as a pure function of a single instance's own
5
+ * config. This is the shared contract between the build (which tags the image
6
+ * it pushes) and the deploy (which waits for and runs that tag), so both must
7
+ * import this — never recompute it independently.
8
+ *
9
+ * The default path is deliberately untouched: an instance with no site packages
10
+ * resolves to the plain `brain-{version}` tag every other fleet instance uses.
11
+ * A site override is a per-instance opt-in that hashes only *that instance's*
12
+ * package set into a distinct `brain-{version}-sites-{hash}` image, so it can
13
+ * never collide with — or leak into — the shared default image.
14
+ */
15
+ export declare function siteImageTag(brainVersion: string, sitePackages: string[]): string;
16
+ /**
17
+ * The npm packages a site override installs into its per-instance image.
18
+ * A @rizom-scoped theme is an independently published package and rides along
19
+ * at the same lockstep version; @brains/* themes are bundled inside
20
+ * @rizom/brain and must not be npm-installed.
21
+ */
22
+ export declare function sitePackagesFor(siteOverride: ResolvedSiteOverride | undefined): string[];
23
+ /** The per-user slice of the registry that determines which image it runs. */
24
+ export interface ImageRequirementSource {
25
+ brainVersion: string;
26
+ siteOverride?: ResolvedSiteOverride | undefined;
27
+ }
28
+ export interface RequiredImage {
29
+ tag: string;
30
+ brainVersion: string;
31
+ /** Sorted, deduped — build args for the image, empty for the default. */
32
+ sitePackages: string[];
33
+ }
34
+ /**
35
+ * The image set the declared fleet state requires: one default
36
+ * `brain-{version}` per distinct brain version in use, plus one
37
+ * `brain-{version}-sites-{hash}` per distinct site-override package set.
38
+ * Derived purely from resolved users (pass `registry.users`), so CI can build
39
+ * exactly what a config push declares — nothing reactive, nothing manual.
40
+ */
41
+ export declare function requiredImages(users: ImageRequirementSource[]): RequiredImage[];
42
+ export interface ResolveImageBuildsOptions {
43
+ users: ImageRequirementSource[];
44
+ /**
45
+ * Explicit dispatch override — the manual/backfill path. When set, exactly
46
+ * this one image is built, skipping both the registry and the exists check.
47
+ */
48
+ brainVersionInput?: string | undefined;
49
+ sitePackagesInput?: string | undefined;
50
+ imageExists: (tag: string) => Promise<boolean>;
51
+ }
52
+ /**
53
+ * Decide which images a Build run must produce: the declared required set
54
+ * filtered to tags the registry does not already hold, or the single image an
55
+ * explicit dispatch input forces.
56
+ */
57
+ export declare function resolveImageBuilds(options: ResolveImageBuildsOptions): Promise<RequiredImage[]>;
58
+ export interface RunResolveMissingImagesOptions {
59
+ rootDir: string;
60
+ /** e.g. `ghcr.io/rizom-ai/rover-pilot` */
61
+ imageRepository: string;
62
+ env?: NodeJS.ProcessEnv;
63
+ runCommand?: RunCommand;
64
+ writeOutput: (key: string, value: string) => void;
65
+ log?: (line: string) => void;
66
+ }
67
+ /**
68
+ * The Build workflow's resolve step: derive the image set the declared fleet
69
+ * state (pilot.yaml + cohorts + users) requires, probe the container registry
70
+ * for each tag, and emit the missing ones as a GitHub Actions build matrix
71
+ * (`images_json`, entries `{tag, brain_version, site_packages}`). Dispatch
72
+ * inputs `BRAIN_VERSION_INPUT`/`SITE_PACKAGES_INPUT` force a single explicit
73
+ * build instead. Deriving and probing here means a config push builds exactly
74
+ * what it declares — nothing reactive, nothing manual.
75
+ */
76
+ export declare function runResolveMissingImages(options: RunResolveMissingImagesOptions): Promise<RequiredImage[]>;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  export { initPilotRepo } from "./init";
2
2
  export { loadPilotRegistry, type LoadPilotRegistryOptions, } from "./load-registry";
3
+ export { siteImageTag, sitePackagesFor, requiredImages, resolveImageBuilds, runResolveMissingImages, type ImageRequirementSource, type RequiredImage, type ResolveImageBuildsOptions, type RunResolveMissingImagesOptions, } from "./images";
3
4
  export { writeUsersTable } from "./render-users-table";
4
5
  export { onboardUser } from "./onboard-user";
6
+ export { addPilotUser } from "./user-add";
5
7
  export { reconcileCohort } from "./reconcile-cohort";
6
8
  export { reconcileAll } from "./reconcile-all";
7
9
  export { parseArgs, type ParsedArgs } from "./parse-args";
@@ -10,4 +12,5 @@ export { bootstrapPilotSshKey, runPilotSshKeyBootstrap, } from "./ssh-key-bootst
10
12
  export { bootstrapPilotOriginCertificate, runPilotCertBootstrap, } from "./cert-bootstrap";
11
13
  export { encryptPilotSecrets } from "./secrets-encrypt";
12
14
  export { pushPilotSecrets } from "./secrets-push";
15
+ export { verifyPilotUser } from "./verify-user";
13
16
  export { runCommand, type CommandResult } from "./run-command";