run402 4.25.0 → 4.26.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/lib/gitvault.mjs CHANGED
@@ -18,6 +18,7 @@
18
18
  */
19
19
  import { readFileSync } from "node:fs";
20
20
  import { resolveProjectId } from "./config.mjs";
21
+ import { resolveOwningOrgId } from "./org-context.mjs";
21
22
  import { getSdk } from "./sdk.mjs";
22
23
  import { reportSdkError, fail } from "./sdk-errors.mjs";
23
24
  import {
@@ -36,18 +37,34 @@ const COMMON_VALUE_FLAGS = ["--project", "--repo"];
36
37
  export const HELP = `run402 gitvault — your source, encrypted before it leaves the machine
37
38
 
38
39
  Usage:
39
- run402 gitvault status [--project <id>] [--repo <repo_id>]
40
+ run402 gitvault init [--project <id>] [--org <org_id>] [--git-remote] [--no-remote]
41
+ run402 gitvault status [--project <id>] [--repo <repo_id>] [--refs]
40
42
  run402 gitvault push [--project <id>] [--repo <repo_id>] [--message <text>] [--checkpoint]
43
+ run402 gitvault policy <required|grandfathered> [--project <id>] [--repo <repo_id>]
44
+ [--reason <why>]
41
45
  run402 gitvault compact [--project <id>] [--repo <repo_id>]
42
46
  run402 gitvault prune [--project <id>] [--repo <repo_id>]
43
47
  [--submit --intent-core <path> --verifier-receipt <path> [--wait]]
44
48
  run402 gitvault verify [--project <id>] [--repo <repo_id>] [--budget <n>]
45
49
 
46
50
  Subcommands:
51
+ init ALLOCATE the project's vault. This is the one step that mints key
52
+ material on this machine and emits the one-shot recovery receipt,
53
+ so it is explicit rather than a side effect of \`run402 init\` (which
54
+ only adds the git remote). Idempotent: an existing vault is
55
+ reported with \`deduplicated: true\` and nothing is re-minted. Adds
56
+ the \`run402\` remote too when the current directory is already a
57
+ repository.
47
58
  status What this machine and the control plane each believe about the
48
59
  vault: allocation, policy, whether this keystore can sign, the
49
- authenticated and materialized pins, and any pending
50
- unvaulted-override journals. Never reports key material.
60
+ authenticated and materialized pins, any pending
61
+ unvaulted-override journals, and where the keystore lives. Never
62
+ reports key material.
63
+ policy Set the activation policy — \`required\` (a deploy must present a
64
+ vaulted capture) or \`grandfathered\` (it need not). Owner + step-up,
65
+ audited. \`grandfathered\` is the documented way out of a deploy
66
+ blocked by GITVAULT_CLIENT_UPGRADE_REQUIRED, and leaves a
67
+ doctor-persistent warning until the project returns to \`required\`.
51
68
  push Capture the working tree and publish it. This is NOT gated on a
52
69
  deploy — a vault-only project pushes for months without one.
53
70
  Before reporting a push as landed the SDK compares finalization
@@ -64,6 +81,21 @@ Subcommands:
64
81
 
65
82
  Options:
66
83
  --project <id> Project whose vault to act on (defaults to the active project)
84
+ --org <org_id> init: the owning organization (resolved from the project
85
+ when omitted)
86
+ --git-remote init: 'git init' the current directory when it is not a
87
+ repository yet, so the run402 remote can be added there.
88
+ Opt-in: creating a repository where you did not ask for one
89
+ is a bad surprise, so without it a non-repository directory
90
+ allocates the vault and adds no remote.
91
+ --no-remote init: allocate the vault only; touch no git configuration
92
+ --reason <why> policy: why the policy is changing — recorded in the audit
93
+ event. REQUIRED for \`grandfathered\`, which is a deliberate
94
+ weakening of the activation guarantee.
95
+ --refs status: also materialize and report the vault's ref map and
96
+ HEAD target. This is a VERIFICATION (it walks the head
97
+ chain and advances the local materialized pin), which is
98
+ why plain \`status\` — an observation — does not do it.
67
99
  --repo <repo_id> Address the vault directly by id, skipping project lookup
68
100
  --message <text> push: commit message for the synthetic commit a dirty tree
69
101
  produces (a clean tree pushes HEAD itself, no message used)
@@ -111,8 +143,10 @@ Terminal loss (protocol §0):
111
143
  stderr and carries it in its JSON — read it before you rely on this.
112
144
 
113
145
  Examples:
114
- run402 gitvault status
146
+ run402 gitvault init
147
+ run402 gitvault status --refs
115
148
  run402 gitvault push --message "wip: refactor the parser"
149
+ run402 gitvault policy grandfathered --reason "migrating CI to a vaulted client"
116
150
  run402 gitvault verify --budget 500
117
151
  run402 gitvault prune --project prj_1a2b3c
118
152
  `;
@@ -143,24 +177,194 @@ function vaultTarget(a) {
143
177
  * NORMATIVE COPY, printed verbatim straight from the SDK's own constants and
144
178
  * never paraphrased, summarized, or reassembled here. Both lines also ride in
145
179
  * the JSON payload on stdout.
180
+ *
181
+ * The PATH is printed with it. "Whole-keystore loss is terminal" appeared three
182
+ * times across this surface while the directory to back up appeared nowhere
183
+ * (dogfood #1, finding D2) — a warning nobody can act on.
146
184
  */
147
185
  function printTerminalLoss(status) {
148
186
  console.error("");
149
187
  console.error(status.terminal_loss_statement);
150
188
  console.error(status.terminal_loss_detail);
189
+ console.error(`Back up this directory: ${status.keystore.root}`);
151
190
  console.error("");
152
191
  }
153
192
 
193
+ /** Where the keystore lives — for verbs whose payload is not a `status`. */
194
+ async function printKeystoreLocation() {
195
+ try {
196
+ const { getGitvaultKeystoreRoot } = await import("#sdk/node");
197
+ console.error(`keystore: ${getGitvaultKeystoreRoot()} — back this up; whole-keystore loss is terminal for vault history`);
198
+ } catch {
199
+ // Never let a diagnostic line fail a command that already succeeded.
200
+ }
201
+ }
202
+
203
+ /**
204
+ * `run402 gitvault init` — allocate the project's vault.
205
+ *
206
+ * WHY THIS EXISTS AS ITS OWN VERB (dogfood #1, finding A). Until it did, the
207
+ * only way to allocate was `sdk.gitvault.init()` through the vendored SDK:
208
+ * `gitvault status` pointed at `run402 init`, which scaffolds the remote and
209
+ * says so in a comment; `gitvault push` and `git push run402` both 404'd and
210
+ * handed the user a raw `POST /gitvault/v1/vaults`. A published CLI that can
211
+ * do everything except start is not a usable product.
212
+ *
213
+ * It stays SEPARATE from `run402 init` on purpose: this is the step that mints
214
+ * key material on this machine and emits a one-shot recovery receipt, and
215
+ * whole-keystore loss is terminal for vault history. That belongs to a command
216
+ * the user typed, not to a setup command's side effects.
217
+ */
218
+ async function init(args) {
219
+ const a = normalizeArgv(args);
220
+ const valueFlags = ["--project", "--org"];
221
+ assertKnownFlags(a, [...valueFlags, "--git-remote", "--no-remote", "--help", "-h"], valueFlags);
222
+ requirePositionalCount(a, valueFlags, {
223
+ min: 0, max: 0, command: "run402 gitvault init", missing: "",
224
+ });
225
+ if (a.includes("--git-remote") && a.includes("--no-remote")) {
226
+ fail({
227
+ code: "BAD_USAGE",
228
+ message: "--git-remote and --no-remote contradict each other.",
229
+ hint: "--git-remote creates a repository to add the remote to; --no-remote touches no git configuration at all.",
230
+ });
231
+ }
232
+ const projectId = resolveProjectId(flagValue(a, "--project"));
233
+ const orgId = flagValue(a, "--org") ?? await resolveOwningOrgId(projectId);
234
+ if (!orgId) {
235
+ fail({
236
+ code: "ORG_UNRESOLVED",
237
+ message: `Could not resolve the organization that owns ${projectId}.`,
238
+ hint: "Pass --org <org_id>, or check that this wallet can see the project (`run402 projects list`).",
239
+ details: { project_id: projectId },
240
+ });
241
+ }
242
+
243
+ // Whether to touch git at all. Mirrors `run402 init`: adding a remote inside
244
+ // an EXISTING repository is pure addition and is the default; CREATING a
245
+ // repository is opt-in, because a vault can be allocated from anywhere and
246
+ // `git init`-ing whatever directory you happened to be in is a bad surprise.
247
+ let scaffold = !a.includes("--no-remote");
248
+ let remoteSkipped = null;
249
+ if (scaffold && !a.includes("--git-remote")) {
250
+ const { hardenedGit } = await import("#sdk/node");
251
+ try {
252
+ await hardenedGit(process.cwd(), ["rev-parse", "--git-dir"]);
253
+ } catch {
254
+ scaffold = false;
255
+ remoteSkipped = "not a git repository — the vault was allocated; re-run with --git-remote to create one and add the remote";
256
+ }
257
+ }
258
+
259
+ try {
260
+ const result = await getSdk().gitvault.init({
261
+ org_id: orgId,
262
+ project_id: projectId,
263
+ ...(scaffold ? { repo_dir: process.cwd() } : { scaffold_git: false }),
264
+ });
265
+ console.log(JSON.stringify(remoteSkipped ? { ...result, remote_skipped: remoteSkipped } : result, null, 2));
266
+ console.error(
267
+ result.deduplicated
268
+ ? `vault ${result.repo_id} already existed — nothing was re-allocated and no new key material was minted`
269
+ : `allocated vault ${result.repo_id} (genesis ${result.genesis_sha256})`,
270
+ );
271
+ if (result.remote) console.error(`remote '${result.remote.name}' -> ${result.remote.url}`);
272
+ if (remoteSkipped) console.error(`remote not added: ${remoteSkipped}`);
273
+ // The recovery receipt is integrity data, not a secret, and it is worth
274
+ // exactly as much as the number of copies you keep. It is persisted into
275
+ // the keystore automatically; say where, because "keep many copies" is
276
+ // advice nobody can act on without a path.
277
+ console.error("");
278
+ console.error(result.terminal_loss_statement);
279
+ await printKeystoreLocation();
280
+ console.error("");
281
+ } catch (err) {
282
+ reportSdkError(err);
283
+ }
284
+ }
285
+
286
+ /**
287
+ * `run402 gitvault policy <required|grandfathered>` — the activation gate.
288
+ *
289
+ * The gateway's own `GITVAULT_CLIENT_UPGRADE_REQUIRED` envelope names
290
+ * `run402 gitvault policy grandfathered --reason <why>` as the second way out
291
+ * of a blocked deploy. Until this verb existed, running exactly what the
292
+ * platform told you to run returned UNKNOWN_SUBCOMMAND, so a user could
293
+ * allocate themselves into a blocked-deploy state with no way back.
294
+ */
295
+ async function policy(args) {
296
+ const a = normalizeArgv(args);
297
+ const valueFlags = [...COMMON_VALUE_FLAGS, "--reason"];
298
+ assertKnownFlags(a, [...valueFlags, "--help", "-h"], valueFlags);
299
+ const [requested] = requirePositionalCount(a, valueFlags, {
300
+ min: 1, max: 1, command: "run402 gitvault policy <required|grandfathered>",
301
+ missing: "Missing <policy>. Expected `required` or `grandfathered`.",
302
+ });
303
+ if (requested !== "required" && requested !== "grandfathered") {
304
+ fail({
305
+ code: "BAD_USAGE",
306
+ message: `Unknown policy: ${requested}.`,
307
+ hint: "Expected `required` (a deploy must present a vaulted capture) or `grandfathered` (it need not).",
308
+ details: { policy: requested, known_policies: ["required", "grandfathered"] },
309
+ });
310
+ }
311
+ const reason = flagValue(a, "--reason");
312
+ // Required only for the weakening direction. Returning to `required` is
313
+ // restoring the default and needs no justification; leaving it does.
314
+ if (requested === "grandfathered" && (reason == null || reason.trim() === "")) {
315
+ fail({
316
+ code: "BAD_USAGE",
317
+ message: "`grandfathered` needs --reason <why>.",
318
+ hint: "It weakens the activation guarantee for this project and is recorded in the audit event. Say why, e.g. --reason \"migrating CI to a vaulted client\".",
319
+ details: { policy: requested },
320
+ });
321
+ }
322
+
323
+ const target = vaultTarget(a);
324
+ try {
325
+ const sdk = getSdk();
326
+ const repoId = target.repo_id ?? (await sdk.gitvault.forProject(target.project_id)).repo_id;
327
+ const result = await sdk.gitvault.setPolicy(repoId, {
328
+ gitvault_policy: requested,
329
+ ...(reason != null ? { reason } : {}),
330
+ });
331
+ console.log(JSON.stringify({ repo_id: repoId, ...result }, null, 2));
332
+ console.error(
333
+ result.changed
334
+ ? `gitvault_policy is now ${result.gitvault_policy} (version ${result.gitvault_policy_version})`
335
+ : `gitvault_policy was already ${result.gitvault_policy} — nothing changed`,
336
+ );
337
+ for (const w of result.warnings ?? []) console.error(`warning (${w.kind}): ${w.message}`);
338
+ } catch (err) {
339
+ reportSdkError(err);
340
+ }
341
+ }
342
+
154
343
  async function status(args) {
155
344
  const a = normalizeArgv(args);
156
- assertKnownFlags(a, [...COMMON_VALUE_FLAGS, "--help", "-h"], COMMON_VALUE_FLAGS);
345
+ assertKnownFlags(a, [...COMMON_VALUE_FLAGS, "--refs", "--help", "-h"], COMMON_VALUE_FLAGS);
157
346
  requirePositionalCount(a, COMMON_VALUE_FLAGS, {
158
347
  min: 0, max: 0, command: "run402 gitvault status", missing: "",
159
348
  });
349
+ const target = vaultTarget(a);
350
+ if (a.includes("--refs")) target.refs = true;
160
351
  try {
161
- const s = await getSdk().gitvault.status(vaultTarget(a));
352
+ const s = await getSdk().gitvault.status(target);
162
353
  console.log(JSON.stringify(s, null, 2));
163
354
  printTerminalLoss(s);
355
+ // Two facts the user otherwise has to leave the CLI for: which vault this
356
+ // checkout is wired to, and what the control plane says is in it.
357
+ if (s.remote) {
358
+ console.error(`remote '${s.remote.name}': ${s.remote.url}${s.remote.matches ? "" : " ← points at a DIFFERENT project than this status"}`);
359
+ }
360
+ if (s.refs) {
361
+ const names = Object.keys(s.refs).sort();
362
+ console.error(names.length === 0 ? "refs: (none yet)" : `refs (${names.length}):`);
363
+ for (const ref of names) console.error(` ${s.refs[ref]} ${ref}`);
364
+ if (s.head_target) {
365
+ console.error(s.head_target.kind === "symref" ? ` HEAD -> ${s.head_target.ref}` : ` HEAD ${s.head_target.oid} (detached)`);
366
+ }
367
+ }
164
368
  // Advisories are echoed EXACTLY as the SDK reported them. Nothing is
165
369
  // synthesized here — in particular a project that has never deployed gets
166
370
  // no deploy-related warning, because a vault-only project is a first-class
@@ -342,6 +546,14 @@ export async function run(sub, args) {
342
546
  process.exit(0);
343
547
  }
344
548
  switch (sub) {
549
+ case "init": {
550
+ await init(argv);
551
+ break;
552
+ }
553
+ case "policy": {
554
+ await policy(argv);
555
+ break;
556
+ }
345
557
  case "status": {
346
558
  await status(argv);
347
559
  break;
package/lib/init.mjs CHANGED
@@ -1,7 +1,8 @@
1
- import { readAllowance, saveAllowance, loadKeyStore, configDir, configureApiBase, getActiveProjectId, getProject, updateProject } from "./config.mjs";
1
+ import { readAllowance, saveAllowance, loadKeyStore, configDir, configureApiBase, getActiveProjectId } from "./config.mjs";
2
2
  import { getSdk } from "./sdk.mjs";
3
3
  import { fail } from "./sdk-errors.mjs";
4
4
  import { setTierAction, deployAction } from "./next-actions.mjs";
5
+ import { resolveOwningOrgId } from "./org-context.mjs";
5
6
  import { getActiveProfile } from "../core-dist/config.js";
6
7
  import { readMeta } from "../core-dist/profiles.js";
7
8
  import { mkdirSync } from "fs";
@@ -46,11 +47,18 @@ Options:
46
47
 
47
48
  Output:
48
49
  Stdout is a JSON summary { config_dir, wallet, rail, network, balances,
49
- tier, projects_saved, next_step }. Progress lines (Config / Allowance /
50
- Balance / Tier / Next) go to stderr so a human re-running interactively
51
- sees what's happening while a script piping stdout to jq stays clean.
52
- With --git-remote the summary also carries { gitvault } (the scaffolded
53
- remote) or { gitvault: null, gitvault_error } when it could not be added.
50
+ tier, projects_saved, active_project_id, next_step }. Progress lines
51
+ (Config / Allowance / Balance / Tier / Next) go to stderr so a human
52
+ re-running interactively sees what's happening while a script piping stdout
53
+ to jq stays clean. The summary also carries { gitvault } (the scaffolded
54
+ remote), or { gitvault: null, gitvault_skipped } naming why no remote was
55
+ added, or { gitvault: null, gitvault_error } when it could not be added.
56
+ \`projects_saved\` counts projects with LOCAL keys; \`active_project_id\` is the
57
+ project the gitvault scaffold acted on.
58
+
59
+ init scaffolds the git remote only. It does NOT allocate the vault — that is
60
+ \`run402 gitvault init\`, which mints key material and a recovery receipt and
61
+ therefore stays an explicit step.
54
62
 
55
63
  Steps (idempotent when re-run with the same rail; pass --switch-rail to change rails):
56
64
  1. Creates config directory (~/.config/run402)
@@ -174,42 +182,28 @@ function errorMessage(err) {
174
182
  }
175
183
 
176
184
  /**
177
- * The owning org of the locally-active projectfrom the KEYSTORE first, and
178
- * only then from the named inventory.
185
+ * Which project the gitvault scaffold acts onand why it may act on none.
179
186
  *
180
- * Why the cache exists (task 5.12c): the gitvault scaffold is the one part of
181
- * `run402 init` the client-surface spec says adds no network dependency to the
182
- * cold-start path, and resolving the org through `projects.list()` quietly made
183
- * that untrue. `org_id` is a non-secret routing identifier the control plane
184
- * already hands back with every listing, so the honest fix is to remember it:
185
- * the FIRST init on a machine still asks, every RETURNING init reads it locally
186
- * and the scaffold really is network-free.
187
+ * The CLI-wide resolution order (`RUN402_PROJECT_ID`, then the active
188
+ * project), not `getActiveProjectId()` alone. Reading only the active project
189
+ * meant an agent that had exported `RUN402_PROJECT_ID` the normal way to
190
+ * address a project without mutating machine state got a silent no-op: no
191
+ * remote, no allocation, and no `gitvault` key in the summary at all, with
192
+ * nothing anywhere saying `run402 projects use` was a prerequisite
193
+ * (dogfood #1, finding A). A command that exits 0 having done nothing is worse
194
+ * than an error, so the no-project case names itself.
187
195
  *
188
- * Best-effort by construction the caller treats `null` as "do not scaffold"
189
- * and an EXACT id match is required: a near-miss must never make init add a
190
- * remote pointing at somebody else's project. `updateProject` is a no-op for a
191
- * project this machine holds no credentials for, so such a project asks again
192
- * next time rather than being silently mis-cached.
196
+ * Exported so the decision is testable on its own: it is one expression, and
197
+ * it was wrong in two ways at once.
193
198
  */
194
- async function resolveOwningOrgId(projectId) {
195
- const cached = getProject(projectId)?.org_id;
196
- if (typeof cached === "string" && cached.length > 0) return cached;
197
- try {
198
- const listed = await getSdk().projects.list();
199
- const rows = Array.isArray(listed?.projects) ? listed.projects : [];
200
- const row = rows.find((p) => (p?.id ?? p?.project_id) === projectId);
201
- const orgId = row?.org_id;
202
- if (typeof orgId !== "string" || orgId.length === 0) return null;
203
- try {
204
- updateProject(projectId, { org_id: orgId });
205
- } catch {
206
- // Caching is an optimization; a read-only or contended keystore costs a
207
- // round trip next time and must never fail the scaffold.
208
- }
209
- return orgId;
210
- } catch {
211
- return null;
212
- }
199
+ export function resolveScaffoldProject(env = process.env, activeProjectId = getActiveProjectId()) {
200
+ const fromEnv = typeof env.RUN402_PROJECT_ID === "string" ? env.RUN402_PROJECT_ID.trim() : "";
201
+ const projectId = fromEnv || activeProjectId || null;
202
+ if (projectId) return { projectId, skipped: null };
203
+ return {
204
+ projectId: null,
205
+ skipped: "no project is selected, so there is nothing to point a run402 remote at — run `run402 projects use <project_id>` (or set RUN402_PROJECT_ID), then re-run `run402 init`",
206
+ };
213
207
  }
214
208
 
215
209
  export async function run(args = []) {
@@ -337,6 +331,8 @@ export async function run(args = []) {
337
331
  ...(voucherCode ? { voucher: null } : {}),
338
332
  tier: null,
339
333
  projects_saved: 0,
334
+ /** The project init acted on — the input to the gitvault scaffold decision. */
335
+ active_project_id: null,
340
336
  next_actions: [],
341
337
  next_step: null,
342
338
  };
@@ -547,7 +543,12 @@ export async function run(args = []) {
547
543
 
548
544
  // 5. Projects — count locally saved project entries. Note: "saved" (not
549
545
  // "active") — these are all projects in the keystore, regardless of whether
550
- // the server considers them active.
546
+ // the server considers them active. A project selected with
547
+ // `run402 projects use` but never provisioned FROM this machine holds no
548
+ // local keys, so it is legitimately not counted here; `active_project_id`
549
+ // below is the field that says which project init actually acted on, and
550
+ // reading `projects_saved: 0` as "init did nothing" is what made the
551
+ // gitvault skip look silent (dogfood #1, finding A).
551
552
  summary.projects_saved = Object.keys(store.projects).length;
552
553
  line("Projects", `${summary.projects_saved} saved`);
553
554
 
@@ -568,8 +569,13 @@ export async function run(args = []) {
568
569
  // NON-FATAL in every branch: a missing git, a directory that is not a
569
570
  // repository, an unreachable gateway, or a `run402` remote already pointing
570
571
  // somewhere else must warn and let setup finish.
571
- const activeProjectId = getActiveProjectId();
572
- if (activeProjectId) {
572
+ const { projectId: activeProjectId, skipped: noProjectSkip } = resolveScaffoldProject();
573
+ summary.active_project_id = activeProjectId;
574
+ if (noProjectSkip) {
575
+ summary.gitvault = null;
576
+ summary.gitvault_skipped = noProjectSkip;
577
+ line("Gitvault", "skipped — no project selected (run402 projects use <project_id>)");
578
+ } else {
573
579
  summary.gitvault = null;
574
580
  try {
575
581
  // Dynamic import: the scaffold is the only thing here that needs the
@@ -13,7 +13,7 @@
13
13
  */
14
14
  import { getSdk } from "./sdk.mjs";
15
15
  import { flagValue } from "./argparse.mjs";
16
- import { resolveProjectId } from "./config.mjs";
16
+ import { getProject, resolveProjectId, updateProject } from "./config.mjs";
17
17
 
18
18
  /** Resolve the addressed organization from normalized argv (one SDK lookup at most). */
19
19
  export async function resolveOrgId(a) {
@@ -25,3 +25,46 @@ export async function resolveOrgId(a) {
25
25
  const scoped = await getSdk().rooms.forProject(projectId);
26
26
  return scoped.orgId;
27
27
  }
28
+
29
+ /**
30
+ * The organization that OWNS a specific project, or `null`.
31
+ *
32
+ * Distinct from {@link resolveOrgId}: that one answers "which org is this
33
+ * command addressed at" (flag → env → active project); this one answers "who
34
+ * owns THIS project id", which is what a project-scoped scaffold needs and
35
+ * where an `--org` override would be a mis-binding, not a convenience.
36
+ *
37
+ * WHY IT CACHES (task 5.12c): the gitvault scaffold is the one part of
38
+ * `run402 init` the client-surface spec says adds no network dependency to the
39
+ * cold-start path, and resolving the org through `projects.list()` quietly made
40
+ * that untrue. `org_id` is a non-secret routing identifier the control plane
41
+ * already hands back with every listing, so the honest fix is to remember it —
42
+ * the FIRST call on a machine still asks, every returning one reads it locally.
43
+ *
44
+ * Cached in the local project entry after the first lookup, and an EXACT id
45
+ * match is required: a near-miss must never bind a vault or a git remote to
46
+ * somebody else's project. `updateProject` is a no-op for a project this
47
+ * machine holds no credentials for, so such a project asks again next time
48
+ * rather than being silently mis-cached. Returns `null` rather than throwing —
49
+ * every caller has something better to say than a stack trace.
50
+ */
51
+ export async function resolveOwningOrgId(projectId) {
52
+ const cached = getProject(projectId)?.org_id;
53
+ if (typeof cached === "string" && cached.length > 0) return cached;
54
+ try {
55
+ const listed = await getSdk().projects.list();
56
+ const rows = Array.isArray(listed?.projects) ? listed.projects : [];
57
+ const row = rows.find((p) => (p?.id ?? p?.project_id) === projectId);
58
+ const orgId = row?.org_id;
59
+ if (typeof orgId !== "string" || orgId.length === 0) return null;
60
+ try {
61
+ updateProject(projectId, { org_id: orgId });
62
+ } catch {
63
+ // Caching is an optimization; a read-only or contended keystore costs a
64
+ // round trip next time and must never fail the caller.
65
+ }
66
+ return orgId;
67
+ } catch {
68
+ return null;
69
+ }
70
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "run402",
3
- "version": "4.25.0",
3
+ "version": "4.26.0",
4
4
  "description": "CLI for Run402 — provision Postgres databases, deploy static sites, generate images, and manage wallets via x402 and MPP micropayments.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -30,7 +30,7 @@
30
30
  */
31
31
  import type { Client } from "../kernel.js";
32
32
  import { GITVAULT_TERMINAL_LOSS_DOCTOR_TEXT, GITVAULT_TERMINAL_LOSS_STATEMENT } from "./gitvault.crypto.js";
33
- import type { GitvaultCaptureReceipt, GitvaultHeadsListingPage, GitvaultHeadsListingRequest } from "./gitvault.types.js";
33
+ import type { GitvaultCaptureReceipt, GitvaultHeadsListingPage, GitvaultHeadsListingRequest, GitvaultHeadTarget } from "./gitvault.types.js";
34
34
  import type { GitvaultMaintenanceLease, GitvaultMaintenanceLeaseRequest, GitvaultTransport, GitvaultVaultRecord } from "../node/gitvault-publication.js";
35
35
  import type { GitvaultDeployOptions, GitvaultDeployResult } from "../node/gitvault-deploy.js";
36
36
  import type { GitvaultPublishResult, GitvaultVerifiedState } from "../node/gitvault-publication.js";
@@ -51,7 +51,45 @@ export interface GitvaultStatus {
51
51
  can_sign: boolean;
52
52
  /** `true` once this machine holds K_repo for the vault. */
53
53
  holds_repo_key: boolean;
54
+ /**
55
+ * WHERE the keystore lives, and what is in it.
56
+ *
57
+ * Terminal loss is stated three times in this surface; until 5.13 the path
58
+ * to back up was stated nowhere, which made the warning unactionable. These
59
+ * are file paths, never contents — nothing here is key material.
60
+ * `repo` / `recovery_receipt` are `null` until a `repo_id` is known.
61
+ */
62
+ root: string;
63
+ paths: {
64
+ identity: string;
65
+ repos: string;
66
+ receipts: string;
67
+ journal: string;
68
+ audit_log: string;
69
+ repo: string | null;
70
+ recovery_receipt: string | null;
71
+ };
54
72
  };
73
+ /**
74
+ * The `run402` git remote in the local repository, when there is one to read.
75
+ * `null` when no `repo_dir` was given, the directory is not a repository, or
76
+ * no such remote is configured. `matches` is false when the remote points at
77
+ * a DIFFERENT vault than the one this status is about — the case where a
78
+ * checkout is wired to somebody else's project and nothing says so.
79
+ */
80
+ remote: {
81
+ name: string;
82
+ url: string;
83
+ matches: boolean;
84
+ } | null;
85
+ /**
86
+ * The vault's ref map and HEAD target — present only when `refs: true` was
87
+ * requested. Reading them means MATERIALIZING the chain, which is a
88
+ * verification and advances the local materialized pin, so plain `status`
89
+ * (an observation) leaves both `null`.
90
+ */
91
+ refs: Record<string, string> | null;
92
+ head_target: GitvaultHeadTarget | null;
55
93
  pins: {
56
94
  highest_authenticated: string | null;
57
95
  highest_materialized: string | null;
@@ -308,7 +346,17 @@ export declare class Gitvault {
308
346
  * deployed raises no deploy-related warning, and the terminal-loss statement
309
347
  * is stated verbatim exactly as for any other vault.
310
348
  */
311
- status(options?: GitvaultVaultHandleOptions): Promise<GitvaultStatus>;
349
+ status(options?: GitvaultVaultHandleOptions & {
350
+ /**
351
+ * Also report the vault's ref map and HEAD target.
352
+ *
353
+ * Opt-in because it is not free and not read-only in the local sense:
354
+ * materializing walks the head chain (a verification) and advances the
355
+ * keystore's materialized pin. `status` without it stays a pure
356
+ * observation, which is what makes it safe to run anywhere.
357
+ */
358
+ refs?: boolean;
359
+ }): Promise<GitvaultStatus>;
312
360
  /**
313
361
  * Capture the working tree and publish it — the push half of a deploy, run on
314
362
  * its own. Never gated on a deploy: a vault-only project pushes for months
@@ -1 +1 @@
1
- {"version":3,"file":"gitvault.d.ts","sourceRoot":"","sources":["../../src/namespaces/gitvault.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,kCAAkC,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AAC5G,OAAO,KAAK,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AACzH,OAAO,KAAK,EACV,wBAAwB,EACxB,+BAA+B,EAC/B,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAC9F,OAAO,KAAK,EAAE,qBAAqB,EAAuB,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACzH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAyBrE,sEAAsE;AACtE,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;I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