@runeditrun/rer 0.2.84 → 0.2.85

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 (121) hide show
  1. package/README.md +21 -24
  2. package/cli/README.md +17 -1
  3. package/cli/bounded.mjs +1 -1
  4. package/cli/business/carry.mjs +149 -0
  5. package/cli/business/command.mjs +6 -1
  6. package/cli/business/connect.mjs +1 -1
  7. package/cli/business/local-commands.mjs +2 -0
  8. package/cli/business/opt-ins.mjs +8 -4
  9. package/cli/business/questions.mjs +4 -1
  10. package/cli/business/state.mjs +1 -1
  11. package/cli/business/supervisor.mjs +7 -1
  12. package/cli/container-transfer.mjs +2 -2
  13. package/cli/contract.mjs +6 -6
  14. package/cli/demo-native.mjs +2 -1
  15. package/cli/deploy-command.mjs +6 -4
  16. package/cli/deploy.mjs +9 -7
  17. package/cli/errors.mjs +1 -1
  18. package/cli/export.mjs +1 -1
  19. package/cli/human-error.mjs +20 -0
  20. package/cli/lifecycle.mjs +23 -5
  21. package/cli/main.mjs +1 -1
  22. package/cli/managed-data-schema.mjs +114 -0
  23. package/cli/managed-data-zip.mjs +116 -0
  24. package/cli/managed-data.mjs +110 -0
  25. package/cli/managed-server.mjs +25 -14
  26. package/cli/native-owner-entry.mjs +86 -0
  27. package/cli/output.mjs +3 -2
  28. package/cli/parse.mjs +2 -2
  29. package/cli/portability-empty.mjs +59 -0
  30. package/cli/portability-migrations.mjs +7 -5
  31. package/cli/portability-policy.mjs +5 -2
  32. package/cli/portability-worker.mjs +15 -6
  33. package/cli/portability.mjs +30 -8
  34. package/cli/ready-summary.mjs +9 -0
  35. package/cli/run-transfers.mjs +37 -0
  36. package/cli/runtime-front-door.mjs +4 -4
  37. package/cli/server-proxy.mjs +4 -3
  38. package/cli/server-registry.mjs +13 -8
  39. package/cli/site.mjs +6 -1
  40. package/cli/transfers.mjs +17 -4
  41. package/edition-authoring/base-copies.mjs +55 -7
  42. package/foundation/runtime/contract-docs.mjs +3 -2
  43. package/foundation/runtime/run-data.d.mts +1 -0
  44. package/foundation/runtime/run-data.mjs +2 -0
  45. package/global/CHANGELOG.md +33 -0
  46. package/global/README.md +21 -24
  47. package/global/cli/command.mjs +8 -2
  48. package/global/cli/install.mjs +4 -5
  49. package/global/cli/path-link.mjs +3 -2
  50. package/global/cli/repo-command.mjs +3 -7
  51. package/global/launch/dev.mjs +12 -2
  52. package/global/launch/facts.mjs +2 -2
  53. package/global/launch/render.mjs +16 -9
  54. package/global/launch/state.mjs +4 -4
  55. package/global/main.mjs +12 -7
  56. package/install.sh +17 -6
  57. package/modules/container/README.md +6 -1
  58. package/modules/container/adapters/d1-limits.mjs +286 -0
  59. package/modules/container/adapters/d1-sqlite.mjs +95 -0
  60. package/modules/container/adapters/d1-workerd-preload.mjs +19 -0
  61. package/modules/container/adapters/d1-workerd-setup.mjs +26 -0
  62. package/modules/container/adapters/d1-workerd.mjs +5 -0
  63. package/modules/container/adapters/sqlite-worker.mjs +5 -3
  64. package/modules/container/build.mjs +1 -0
  65. package/modules/container/image-variables.mjs +8 -3
  66. package/modules/container/transfer.mjs +14 -4
  67. package/modules/container/worker-engine.mjs +3 -3
  68. package/modules/demo-host/build.mjs +1 -0
  69. package/modules/demo-host/native/prepare.mjs +2 -1
  70. package/modules/demo-host/native/sql.mjs +7 -2
  71. package/modules/deploy-kit/README.md +22 -2
  72. package/modules/deploy-kit/d1-import-diagnostics.mjs +56 -0
  73. package/modules/deploy-kit/d1-import.mjs +17 -5
  74. package/modules/deploy-kit/diagnostics.mjs +29 -3
  75. package/modules/deploy-kit/owner-cli.mjs +20 -7
  76. package/modules/deploy-kit/provider-transport.mjs +19 -4
  77. package/modules/deploy-kit/provider.mjs +57 -22
  78. package/modules/deploy-kit/readiness-window.mjs +1 -1
  79. package/modules/deploy-kit/site.mjs +8 -3
  80. package/modules/deploy-kit/worker.mjs +4 -4
  81. package/modules/import-kit/src/d1/README.md +23 -4
  82. package/modules/import-kit/src/d1/atomic-prefix.ts +2 -2
  83. package/modules/import-kit/src/d1/budget.ts +15 -7
  84. package/modules/import-kit/src/d1/column-layout.ts +5 -0
  85. package/modules/import-kit/src/d1/creation.ts +15 -8
  86. package/modules/import-kit/src/d1/database.ts +3 -3
  87. package/modules/import-kit/src/d1/erasure-pages.ts +2 -1
  88. package/modules/import-kit/src/d1/erasure.ts +2 -2
  89. package/modules/import-kit/src/d1/jobs.ts +10 -6
  90. package/modules/import-kit/src/d1/plans.ts +14 -8
  91. package/modules/import-kit/src/d1/retirement.ts +2 -2
  92. package/modules/import-kit/src/d1/sets.ts +1 -3
  93. package/modules/import-kit/src/d1/staged-creation.ts +3 -3
  94. package/modules/import-kit/src/door/limits.ts +1 -1
  95. package/modules/import-kit/src/door/refusals.ts +1 -1
  96. package/modules/portability/README.md +112 -4
  97. package/modules/portability/backfills.mjs +9 -8
  98. package/modules/portability/bridge.mjs +12 -5
  99. package/modules/portability/catalogue.mjs +12 -5
  100. package/modules/portability/files.mjs +4 -3
  101. package/modules/portability/http.mjs +3 -3
  102. package/modules/portability/import.mjs +18 -9
  103. package/modules/portability/index.d.mts +4 -3
  104. package/modules/portability/index.mjs +1 -1
  105. package/modules/portability/ledgers.mjs +3 -2
  106. package/modules/portability/legacy-safety.mjs +11 -2
  107. package/modules/portability/migration-history.mjs +2 -2
  108. package/modules/portability/progress.mjs +1 -0
  109. package/modules/portability/restore-empty.mjs +12 -0
  110. package/modules/release/github-verify.mjs +11 -2
  111. package/onboarding/adapter.mjs +35 -6
  112. package/onboarding/app-fetch.mjs +6 -4
  113. package/onboarding/development-runtime.mjs +19 -0
  114. package/onboarding/local/operation.mjs +45 -27
  115. package/onboarding/loopback-fetch.mjs +16 -0
  116. package/onboarding/operator-installer.mjs +2 -4
  117. package/onboarding/process-diagnostics.mjs +6 -2
  118. package/onboarding/production-runtime.mjs +4 -2
  119. package/onboarding/readiness.mjs +1 -0
  120. package/package.json +1 -1
  121. package/scripts/publish-check/public_hygiene.py +1 -1
@@ -10,6 +10,7 @@ import os from 'node:os';
10
10
  import path from 'node:path';
11
11
  import crypto from 'node:crypto';
12
12
  import {execFileSync} from 'node:child_process';
13
+ import {fileURLToPath} from 'node:url';
13
14
  import {hash, json, git, raw, gitReader, safe, noLinks, requirePhysical, testSource} from './files.mjs';
14
15
  import {snapshot, acknowledgementDrift} from './base-acknowledgements.mjs';
15
16
  import {requireMaterializedCopies, preflightRefresh} from './copy-checkout.mjs';
@@ -37,16 +38,24 @@ function baseRepository(root) {
37
38
  return (source?.kind === 'git' ? source.repository : source?.origin?.repository) || 'runeditrun/base';
38
39
  }
39
40
 
41
+ function declaredRemote(record, root) {
42
+ const declared = record.repository ?? baseRepository(root);
43
+ return declared === 'runeditrun/base' ? 'https://github.com/runeditrun/base.git' : declared;
44
+ }
45
+
40
46
  // An explicit checkout, else the record's legacy repository, else the seed's declaration.
41
47
  function open(record, base, root, offline = false) {
42
48
  if (base) {
43
49
  const repository = fs.realpathSync(base);
44
50
  const source = gitReader(repository, offline);
45
- try { return {repository, source, head: source.git('rev-parse', 'HEAD'), offline, close: source.close}; }
51
+ try { return {repository, source, head: source.git('rev-parse', 'HEAD'), offline, close: source.close,
52
+ remote: () => {
53
+ try { return git(repository, 'remote', 'get-url', 'origin'); }
54
+ catch { return declaredRemote(record, root); }
55
+ }}; }
46
56
  catch (error) { source.close(); throw error; }
47
57
  }
48
- const declared = record.repository ?? baseRepository(root);
49
- const source = declared === 'runeditrun/base' ? 'https://github.com/runeditrun/base.git' : declared;
58
+ const source = declaredRemote(record, root);
50
59
  const temporary = fs.mkdtempSync(path.join(os.tmpdir(), 'base-copies-'));
51
60
  try {
52
61
  execFileSync('git', ['clone', '--bare', '--quiet', '--', source, temporary], {env: {...process.env, GIT_NO_REPLACE_OBJECTS: '1'}, stdio: 'pipe'});
@@ -54,7 +63,7 @@ function open(record, base, root, offline = false) {
54
63
  fs.rmSync(temporary, {recursive: true, force: true});
55
64
  throw Error('Cannot acquire Base source. Clone https://github.com/runeditrun/base.git when online, then repeat with --base <checkout>.');
56
65
  }
57
- return {repository: temporary, head: null, close: () => fs.rmSync(temporary, {recursive: true, force: true})};
66
+ return {repository: temporary, head: null, remote: () => source, close: () => fs.rmSync(temporary, {recursive: true, force: true})};
58
67
  }
59
68
 
60
69
  export function options(args, count) {
@@ -139,10 +148,47 @@ function seedFiles(root) {
139
148
  return files;
140
149
  }
141
150
 
151
+ const quote = value => "'" + value.replaceAll("'", "'\\''") + "'";
152
+
153
+ // A fresh object store avoids inheriting shallow boundaries from the supplied
154
+ // checkout. Fetch only the two immutable tips, with no tags or other branches.
155
+ function containsHistory(origin, source, revision, introduced) {
156
+ try {
157
+ const ancestor = source.git('merge-base', revision, introduced);
158
+ if (ancestor === introduced) return true;
159
+ if (git(origin.repository, 'rev-parse', '--is-shallow-repository') === 'false') return false;
160
+ } catch { /* Missing ancestry must be acquired before deciding applicability. */ }
161
+ const remote = origin.remote();
162
+ const format = source.git('rev-parse', '--show-object-format');
163
+ const fetch = ['fetch', '--no-tags', '--no-recurse-submodules', '--', remote, revision, introduced];
164
+ const temporary = fs.mkdtempSync(path.join(os.tmpdir(), 'base-history-'));
165
+ try {
166
+ if (origin.offline) throw Error('offline');
167
+ execFileSync('git', ['init', '--bare', '--quiet', '--template=', '--object-format=' + format, temporary], {stdio: 'pipe'});
168
+ execFileSync('git', ['-C', temporary, ...fetch], {
169
+ env: {...process.env, GIT_NO_REPLACE_OBJECTS: '1', GIT_TERMINAL_PROMPT: '0'}, stdio: 'pipe', timeout: 60_000,
170
+ });
171
+ return git(temporary, 'merge-base', revision, introduced) === introduced;
172
+ } catch {
173
+ const {revision: target, recordPath, editionMigration} = origin.refresh;
174
+ const refs = [...new Set([revision, introduced, target])];
175
+ const cli = fileURLToPath(new URL('../bin/rer.mjs', import.meta.url));
176
+ const repair = 'history=$(mktemp -d) && git init --bare --quiet --template= --object-format=' + format +
177
+ ' "$history" && git -C "$history" fetch --no-tags --no-recurse-submodules -- ' +
178
+ [remote, ...refs].map(quote).join(' ') + ' && ' +
179
+ [process.execPath, cli, 'refresh-base', '--ref', target, '--base'].map(quote).join(' ') +
180
+ ' "$history" --record ' + quote(recordPath) +
181
+ editionMigration.map(id => ' --edition-migration ' + quote(id)).join('');
182
+ throw Error(`Cannot compare Base history for ${revision} and ${introduced} from remote ${remote}${origin.offline ? ' while offline' : '; fetching the required revisions failed or their ancestry is unavailable'}. No files were refreshed. When online, run exactly:\n${repair}`);
183
+ } finally {
184
+ fs.rmSync(temporary, {recursive: true, force: true});
185
+ }
186
+ }
187
+
142
188
  function reader(origin) {
143
189
  const source = origin.source ?? gitReader(origin.repository);
144
190
  const format = source.git('rev-parse', '--show-object-format');
145
- const trees = new Map();
191
+ const trees = new Map(), ancestry = new Map();
146
192
  return {
147
193
  // Git object identity of local bytes, to find copies by content without reading Base blobs.
148
194
  objectId: bytes => crypto.createHash(format).update(`blob ${bytes.length}\0`).update(bytes).digest('hex'),
@@ -185,8 +231,9 @@ function reader(origin) {
185
231
  },
186
232
  contains(revision, introduced) {
187
233
  this.tree(revision); this.tree(introduced);
188
- try { return source.git('merge-base', revision, introduced) === introduced; }
189
- catch { throw Error(`Cannot compare Base history for ${revision} and ${introduced}; fetch full Base history, then repeat refresh-base; no files were refreshed.`); }
234
+ const key = revision + ':' + introduced;
235
+ if (!ancestry.has(key)) ancestry.set(key, containsHistory(origin, source, revision, introduced));
236
+ return ancestry.get(key);
190
237
  },
191
238
  history(revision, name) {
192
239
  return source.git('log', '--format=%H', revision, '--', name).split('\n').filter(Boolean)
@@ -349,6 +396,7 @@ export function refreshCopies(root, {positional: [revision], record: recordPath,
349
396
  const files = seedFiles(root);
350
397
  requireMaterializedCopies(root, record, files);
351
398
  const origin = open(record, base, root, offline);
399
+ origin.refresh = {revision, recordPath, editionMigration};
352
400
  let writing = false, notices = [];
353
401
  try {
354
402
  const read = reader(origin);
@@ -484,8 +484,9 @@ function covScope(old) {
484
484
  const section = [...headings].reverse().find(entry => entry.level === 2)?.text ?? '';
485
485
  const inStatus = headings.some(entry => /^Status\b/i.test(entry.text));
486
486
  const cells = !insideFence && text.includes('|') ? covCells(text) : [];
487
- if (file === 'CONTRACT.md' && inStatus && cells.length === 6 && covId.test(plainText(cells[0]))) {
488
- if (plainText(cells[5]).trim()) entries.push({ file, line, cell: 'gap', text: cells[5], raw, clause: plainText(cells[0]), section, homepage: false });
487
+ // Every Status table line is out of scope except a clause row's non-empty Gap cell.
488
+ if (file === 'CONTRACT.md' && inStatus && !insideFence && text.trimStart().startsWith('|')) {
489
+ if (cells.length === 6 && covId.test(plainText(cells[0])) && plainText(cells[5]).trim()) entries.push({ file, line, cell: 'gap', text: cells[5], raw, clause: plainText(cells[0]), section, homepage: false });
489
490
  continue;
490
491
  }
491
492
  const intro = !introEnded && !headings.some(entry => entry.level > 1) && !definition;
@@ -0,0 +1 @@
1
+ export const coldRunBudget: string;
@@ -0,0 +1,2 @@
1
+ // One budget for public local-run instructions; estimates vary by app and cache.
2
+ export const coldRunBudget = 'Allow roughly 500 MB–1 GB of downloads and 1–3 GB of disk space for a first run, including Node, rer, the app and its dependencies. The app and your computer can need more; later runs reuse downloads.';
@@ -1,5 +1,38 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.85
4
+
5
+ - Two starters could both take over a stale local operation lock and both act as its owner. Takeover is now exclusive: the lock's inode stays pinned through takeover, and release checks the owner token.
6
+ - A local app listening on a different port than the CLI assigned left `rer dev`, `rer preview` and test runs waiting about 15 minutes. Shared local runtimes now bind before reporting their port, a mismatched listener fails within seconds, and application health readiness is bounded to 60 seconds.
7
+ - An import at the planner's accepted cap could fail part-way with `IMPORT_D1_REQUEST_LIMIT`. Each D1 batch call now counts as one paid-plan query, creation admission is shared with execution, existing erasure statement ceilings stay separate, and plan read pages are sized from their actual chunk bytes so the public door keeps room for its own queries. The canonical plan byte cap is unchanged.
8
+ - Portability export of a wide table (very many or very long column names) failed on D1: its row-size preflight query exceeded D1's 100,000-byte statement limit. The measurement is now split into bounded column queries and summed per row before the unchanged size limit applies, and internal row guards stay out of column removal so valid schema changes keep SQLite semantics. Local D1 stand-ins on the pinned Node 22 runtime now enforce D1's limits on SQL bytes, parameters, function arguments, pattern bytes, bound values and encoded rows (native demo SQLite bindings use the same helper), so tests can fail for queries production would reject. Expression depth 100 is observed, not documented, and is checked with an estimated parser-tree depth proved against workerd at 100 and 101.
9
+ - Run site deploy failures did not say which provider call failed or why. Human and JSON failures now name the failing provider step, sanitized endpoint, elapsed time, timeout limit and network cause or redacted HTTP refusal body, beside the existing deploy failure facts.
10
+ - Hosted demo bundling refused "Secret declared as an image variable" for an empty Wrangler placeholder of a declared runtime secret. Container and native demo bundles now drop empty placeholders for declared runtime secrets, keep the runtime secret declarations and still refuse non-empty secret image values.
11
+ - **Import the Platform data download natively.** The Managed data ZIP failed as a damaged archive. The reference adapter now opts into a bounded ZIP intake that stages the source in isolation, translates its Platform migration ledger and uses the existing empty-install restore; adapters opt in with `managedData: true` or wrap their native restore with `withManagedDataImport`. Malformed downloads, unknown source tables (even those row policy excludes) and occupied destinations are refused before destination data changes. Internal schema prefixes compare literally, indexes and triggers on excluded tables stay in archive accounting, trigger definitions import literally, retired schema objects reconcile against destination migrations, and dependent new-table backfills replay during native restore. The historical schema projection remains only for explicitly acknowledged v1 recovery.
12
+ - The separate install-then-start recipe needed a PATH step, and frozen-lockfile install failures showed raw pnpm codes. The recipe now runs the installed launcher by its absolute path, and frozen-lockfile refusals give one plain cause and a runnable repair command, keeping pnpm codes and captured output in JSON.
13
+ - A refused D1 import upload lost Cloudflare's HTTP status and body, so `rer deploy` could not explain it. D1 import init, upload, ingest and poll failures now keep redacted, bounded diagnostics (status, provider codes and messages, network cause) in human and JSON failures; the failure code and retry policy are unchanged.
14
+ - Refused dependency downloads, invalid ports and checkout archive paths printed error classes and stacks. They now give a plain cause and a runnable next command and keep useful detail facts (command, status, output tail, log path); JSON output is unchanged.
15
+ - After Business pairing the next step was unclear, and the owner's computer choices needed a reconnect. Business setup and local launch now lead with one plain next step, name `business next` after pairing, defer optional shell setup (`rer cli path`) until the app is ready, and show a shared cold-run budget with measured archive downloads and disk use; `business next` and `business run` apply the owner's latest choices without reconnecting.
16
+ - Local first-party apps did not know the paired Business. Connect, setup and dev now carry its name and display settings into the checkout, running apps refresh while Business runs, and disconnect removes the local carry.
17
+ - Contract `coverage check` counted the old Status summary table as lines to place, so a seed could not satisfy both it and the contract standard. Coverage now skips Status table lines except a clause row's non-empty Gap cell.
18
+ - Release verification reported one fixed reason for every GitHub CLI failure, hiding causes such as a rate-limit 403. Unavailable verification receipts now include the gh exit status and bounded, redacted stderr, keeping the authentication guidance when stderr is empty.
19
+ - `rer dev` and `rer demo` failed to load seed source folders named `exports`. Development now allows them while generated top-level export output and installation archives stay private.
20
+ - Local worker requests could fail with "fetch failed" or `UND_ERR_SOCKET` after a server closed an idle socket. Loopback harness connections now close after each response; readiness, owner claims and seed runtime journeys share this transport, with no retries.
21
+ - `rer deploy --dry-run` exited 3 without Cloudflare credentials although it is documented to validate locally. Dry runs now build and validate the local plan with no credentials or Cloudflare requests and print target, binding and migration names; remote readiness checks are left to a real deploy.
22
+ - Version 2 backups without a schema object inventory could not be restored. Explicit `--acknowledge-unverified-schema-objects` recovers them into an empty installation with destination migration replay and every existing restore fence; completed receipts record the acknowledged schema uncertainty, and current archives restore without acknowledgment.
23
+ - A fresh owner could not sign in to a local `rer preview`, and `rer demo` offered only its persona. Preview now prints a single-use native owner entry and demo adds one beside its persona, through the existing fragment gate and native owner grant; links expire within 15 minutes and are never saved.
24
+ - First runs needed a shell PATH detour, led with machine lines and an unlabelled site URL, showed a fixed owner address without explanation, and timed every phase from the launch. The installer now prints a quoted absolute launch command, ready output leads with one plain app link and labels the site, the owner form explains the local account, and each launch phase is timed separately; machine ready output is unchanged.
25
+ - The shared hosting guide listed its options in a different order from the Run chooser. It now follows the chooser: the one-line local run first, then Assisted, then Managed for a listing that offers it, then the do-it-yourself Cloudflare steps, with plan copy, sign-up state and links taken from the chooser.
26
+ - Automatic `rer dev` port selection could exhaust its 1,000 candidates when stopped checkouts kept saved setup records. A saved setup port now excludes a candidate only while that checkout's launch worker or server still runs with its recorded start identity; live servers, active claims and bound sockets still exclude their ports, and an exhausted search still names its range and candidate count.
27
+ - Publication scans rejected OpenAI noreply co-author trailers in commit messages. That provider's exact `noreply` address is now accepted in the final trailer paragraph, as the Anthropic and GitHub ones are; personal addresses, body text, other trailer keys, other or lookalike domains, files and annotated tags still fail.
28
+ - Refresh refused with "fetch full Base history" when a shallow Base checkout lacked the ancestry its migration comparison needs. Online refresh now fetches just the two immutable comparison tips, with no tags and a 60-second transport deadline, into a temporary bare repository and leaves the supplied checkout unchanged; failed or offline acquisition refuses before any write and names both revisions, the Base remote and an exact one-line repair command.
29
+ - Seed Verify ran the push shards in full for both a branch push and its pull request, ran every push shard again on each nightly schedule, and installed system browser libraries before trying Chromium. The delivered workflow now plans each run: it reuses the newest full push proof of an identical tree (the pull request's head push, the same commit on another branch, or a direct parent with the same tree), runs light coverage (the edition lock check, `pnpm run check`, the reviewed readers and the site build) when a branch push changes only contract documents, `sources.lock.json` or evidence on top of a push-verified parent, and otherwise runs in full. Schedules run only the nightly shards, on Monday and Thursday at a time rendered from the seed name; release tags still run every shard; and Chromium's system libraries are installed only after a failed launch probe.
30
+
31
+ ### Known issues
32
+
33
+ - The two refresh recovery guidance issues documented in 0.2.82 still apply, with the same manual recoveries.
34
+ - The delivered Verify template's runner-temporary pnpm store, Chromium and apt cache lifecycle is not yet exercised end to end on a GitHub Ubuntu 24.04 runner; Base Verify covers only Base's own bootstrap.
35
+
3
36
  ## 0.2.84
4
37
 
5
38
  - The publication scan accepts the upstream copyright notice of a Base-listed third-party licence text only under an exact licence file name with the listed Git blob ID (initially the vendored yaml 2.9.1 `LICENSE`) and reports each in `thirdPartyNotices`; seed configuration cannot extend the list, and scans of the unpacked rer tarball and of refreshed seeds pass without review records.
package/global/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # rer
2
2
 
3
+ <!-- BEGIN COLD RUN BUDGET -->
4
+ Allow roughly 500 MB–1 GB of downloads and 1–3 GB of disk space for a first run, including Node, rer, the app and its dependencies. The app and your computer can need more; later runs reuse downloads.
5
+ <!-- END COLD RUN BUDGET -->
6
+
3
7
  `rer` is the Run Edit Run command. Install it once, then run `rer <verb>` in any
4
8
  Run Edit Run checkout: every verb runs that checkout's own pinned copy, so a
5
9
  checkout always gets the behaviour it was built and tested with.
@@ -21,13 +25,15 @@ Start a seed from an empty folder, with or without Node:
21
25
 
22
26
  ```sh
23
27
  curl -fsSL https://runeditrun.com/install.sh | sh
24
- rer dev just-every/run-inkwell
28
+ "$HOME/.local/bin/rer" dev just-every/run-inkwell
25
29
  ```
26
30
 
27
31
  The installer needs no Node: without Node 22 or later on PATH it installs a
28
- private one for `rer` (see below). It edits no shell profile: it names the next
29
- command, `rer dev <owner>/<repo>`, and when `~/.local/bin` is not on PATH for new
30
- terminals its last line is the one to run first, which adds it for your shell.
32
+ private one for `rer` (see below). It edits no shell profile. The second step
33
+ uses the installed launcher directly, so it works in the same shell without
34
+ changing PATH: a child installer cannot change its parent shell’s PATH, and bare
35
+ `rer` needs `~/.local/bin` on PATH. After the app opens, an optional
36
+ `rer cli path` step explains how to make `rer` available in future terminals.
31
37
  The same start also fits on one line:
32
38
 
33
39
  ```sh
@@ -66,24 +72,13 @@ With no Node 22 or later on PATH, the script installs Node 22.20.0 from
66
72
  `nodejs.org` into `~/.local/share/rer/runtimes` (under `XDG_DATA_HOME` when set),
67
73
  verifies the tarball against that release's published `SHASUMS256.txt`, and
68
74
  prints its location. The launcher uses this private runtime on later runs.
69
- System Node and other PATH directories are left alone: the private runtime's
70
- `node`, `npm` and `npx` are not put on PATH, because `rer` is the one command
71
- the installer provides. With no arguments the script names the next command,
72
- `rer dev <owner>/<repo>`, and ends with the PATH line below when one is needed.
73
-
74
- No installer edits shell profiles. The canonical launcher is `~/.local/bin/rer`.
75
- Installation creates that directory if needed and never writes into another
76
- PATH directory. It names any existing `rer` elsewhere on PATH and leaves it
77
- unchanged. If `~/.local/bin` is absent from PATH, another command shadows it,
78
- or no startup file of your shell adds it for new terminals, its last line is
79
- one command to run: it appends `export PATH="$HOME/.local/bin:$PATH"` to that
80
- startup file (`~/.zshrc` for zsh; `~/.bash_profile` for bash on macOS and
81
- `~/.bashrc` elsewhere; `~/.profile` otherwise) and runs it in the current shell.
82
- For fish it is `fish_add_path ~/.local/bin`. Without a private runtime, the
83
- launcher uses `node` from PATH. A re-run with the same build changes
84
- nothing; a different build is installed beside the current one, the previous one
85
- is kept and older ones are removed. It refuses to replace a `~/.local/bin/rer`
86
- that it did not write.
75
+ System Node is left alone. With no arguments, the installer prints an app-start
76
+ command using its absolute launcher. After a first launch, `rer cli path` shows
77
+ an optional shell-specific line to make `rer` available in future terminals.
78
+ Only running that line changes a shell startup file; `rer` never edits one.
79
+ A re-run with the same build changes nothing; a different build keeps the
80
+ previous version and removes older ones. It refuses to replace a launcher it
81
+ did not write.
87
82
 
88
83
  `rer --version` prints this rer's version; inside a checkout a second line
89
84
  names the version the checkout pins, or says that its vendored copy is
@@ -454,12 +449,14 @@ The owner chooses three things on the computer's row in the browser: "Add rules
454
449
  so Claude Code never reads your secret files" (Claude Code user Read deny
455
450
  rules), "Keep this computer awake while it works" (export-scoped macOS wake
456
451
  prevention) and "Install the background service" (a launchd or systemd user
457
- service). Connect reads them as `optIns` from device-authenticated
452
+ service). Connect, run and next read them as `optIns` from device-authenticated
458
453
  `GET /api/business/executors/self`, with keys `installPermissions`,
459
454
  `awakeConsent` and `installService`; the CLI prints only the sentences. Only
460
455
  `true` enables an option. Undecided (`null`) options are listed with a browser
461
456
  link; an older server without this route (it answers 403 or 404) leaves all
462
- options undecided. Run connect again after the owner decides. The first
457
+ options undecided. After the owner decides, run `rer business next` to apply
458
+ the choices and see the next task. `rer business run` also applies the latest
459
+ choices before working tasks. The first
463
460
  device-authenticated request happens after both the credential and local
464
461
  pairing state are stored, so a storage failure cannot activate the computer.
465
462
  A service installed with `RER_BUSINESS_STATE_DIR` set keeps that folder. Background
@@ -1,13 +1,19 @@
1
1
  // rer cli status|install|uninstall
2
- const usage = 'Usage: rer cli status [--json] | rer cli install | rer cli uninstall\n';
2
+ const usage = 'Usage: rer cli status [--json] | rer cli install | rer cli uninstall | rer cli path\n';
3
3
 
4
4
  export async function cliCommand(args) {
5
5
  const [action, ...flags] = args;
6
6
  if (!action || ['--help', '-h'].includes(action)) { process.stdout.write(usage); return 0; }
7
7
  const allowed = action === 'status' ? ['--json'] : [];
8
8
  const unknown = flags.find(flag => !allowed.includes(flag));
9
- if (!['status', 'install', 'uninstall'].includes(action) || unknown !== undefined) { process.stderr.write(`Unsupported: rer cli ${args.join(' ')}\n${usage}`); return 2; }
9
+ if (!['status', 'install', 'uninstall', 'path'].includes(action) || unknown !== undefined) { process.stderr.write(`Unsupported: rer cli ${args.join(' ')}\n${usage}`); return 2; }
10
10
  if (action === 'status') return (await import('./status.mjs')).status({ json: flags.includes('--json') });
11
+ if (action === 'path') {
12
+ const { pathAdvice } = await import('./path-link.mjs');
13
+ const { layout } = await import('./layout.mjs');
14
+ process.stdout.write((await pathAdvice(layout()) || 'rer is available in this terminal and future terminals.') + '\n');
15
+ return 0;
16
+ }
11
17
  if (action === 'install') return (await import('./install.mjs')).install();
12
18
  return (await import('./uninstall.mjs')).uninstall();
13
19
  }
@@ -40,12 +40,11 @@ async function writeLauncher(paths) {
40
40
  await rename(temporary, paths.launcher);
41
41
  }
42
42
 
43
- // The next step, then (when needed) the exact line that puts rer on PATH, last.
44
- // install.sh running a command itself, and rer update, set RER_INSTALL_NO_NEXT.
45
- // Business connect also suppresses PATH advice: it uses the launcher directly.
43
+ // The absolute launcher works immediately, without editing shell files.
44
+ const shellQuote = value => "'" + value.replaceAll("'", "'\"'\"'") + "'";
46
45
  async function closing(paths) {
47
- const advice = process.env.RER_INSTALL_NO_PATH ? '' : await pathAdvice(paths);
48
- return `${process.env.RER_INSTALL_NO_NEXT ? '' : 'Next, start an app: rer dev <owner>/<repo>\n'}${advice ? advice + '\n' : ''}`;
46
+ const notices = await pathAdvice(paths, process.env, { includeShellStep: false });
47
+ return (notices ? notices + '\n' : '') + (process.env.RER_INSTALL_NO_NEXT ? '' : `Next, start an app: ${shellQuote(paths.launcher)} dev <owner>/<repo>\n`);
49
48
  }
50
49
 
51
50
  export async function install({ quiet = false } = {}) {
@@ -44,7 +44,7 @@ async function persistent(files) {
44
44
 
45
45
  // Empty when `rer` already runs this launcher in this terminal and new ones.
46
46
  // Otherwise the advice ends with the exact line to run.
47
- export async function pathAdvice(paths, env = process.env) {
47
+ export async function pathAdvice(paths, env = process.env, { includeShellStep = true } = {}) {
48
48
  const entries = [...new Set((env.PATH ?? '').split(delimiter).filter(Boolean).map(entry => resolve(entry)))];
49
49
  const bin = resolve(paths.bin), lines = [];
50
50
  let firstCommand;
@@ -58,10 +58,11 @@ export async function pathAdvice(paths, env = process.env) {
58
58
  lines.push(`Left existing rer at ${candidate} unchanged.`);
59
59
  } catch (error) { if (!['ENOENT', 'EACCES', 'ENOTDIR'].includes(error.code)) throw error; }
60
60
  }
61
+ if (!includeShellStep) return lines.join('\n');
61
62
  const startup = await shellStartup(paths.home, env);
62
63
  const first = entries.includes(bin) && firstCommand === paths.launcher;
63
64
  if (first && await persistent(startup.files)) return lines.join('\n');
64
65
  const why = first ? 'New terminals will not find rer yet.' : firstCommand ? `Another rer (${firstCommand}) comes first on your PATH.` : 'rer is not on your PATH yet.';
65
- lines.push(`${why} Run this line; it puts ~/.local/bin first on PATH in this terminal and in new ones:`, ` ${startup.line}`);
66
+ lines.push(`Optional: make rer available in future terminals. ${why} Running the following line adds ~/.local/bin to your shell's startup file and this terminal. rer changes no shell file itself:`, ` ${startup.line}`);
66
67
  return lines.join('\n');
67
68
  }
@@ -4,8 +4,7 @@ import { join } from 'node:path';
4
4
  import { parse } from '../../cli/parse.mjs';
5
5
  import { shellQuote } from '../../cli/node-runtime-cache.mjs';
6
6
  import { install } from './install.mjs';
7
- import { launcherOwner, layout } from './layout.mjs';
8
- import { pathAdvice } from './path-link.mjs';
7
+ import { showBudget } from '../../cli/run-transfers.mjs';
9
8
  import { checkoutRepository, runCommand } from './repository.mjs';
10
9
  import { ownRoot } from '../package-info.mjs';
11
10
  import { prepare } from '../launch/prepare.mjs';
@@ -14,17 +13,14 @@ import { launchDirectory } from '../launch/state.mjs';
14
13
  export async function repoCommand(request) {
15
14
  const { verb, directory, args } = request;
16
15
  parse([verb, ...args]); // Refuse invalid options before installation or cloning.
17
- const paths = layout(), launcher = await launcherOwner(paths.launcher);
16
+ showBudget(args);
18
17
  const installed = await install({ quiet: true });
19
18
  if (installed !== 0) return installed;
20
19
  await checkoutRepository(request);
21
20
  const root = await realpath(request.root);
22
- if (launcher.state === 'absent') {
23
- const advice = await pathAdvice(paths);
24
- if (advice) process.stderr.write(advice + '\n');
25
- }
26
21
  const next = command => `cd ${shellQuote(directory)} && rer ${command}`;
27
22
  if (verb === 'setup') {
23
+ await (await import('../../cli/business/carry.mjs')).refreshCheckout(root);
28
24
  const state = await launchDirectory(root), children = new Set(), controller = new AbortController();
29
25
  const log = createWriteStream(join(state, 'launch.log'), { flags: 'a', mode: 0o600 });
30
26
  const handlers = new Map(['SIGINT', 'SIGTERM'].map(signal => [signal, () => { controller.abort(); for (const child of children) child.kill(signal); }]));
@@ -17,6 +17,11 @@ import { LaunchFailure } from './failure.mjs';
17
17
  import { describeCheckout } from './facts.mjs';
18
18
  import { prepare } from './prepare.mjs';
19
19
  import { printer } from './render.mjs';
20
+ import { access } from 'node:fs/promises';
21
+ import { layout } from '../cli/layout.mjs';
22
+ import { pathAdvice } from '../cli/path-link.mjs';
23
+ import { shellQuote } from '../../cli/node-runtime-cache.mjs';
24
+ import { showBudget } from '../../cli/run-transfers.mjs';
20
25
  import { stopLaunch } from './stop.mjs';
21
26
  import { launchDirectory, liveWorker } from './state.mjs';
22
27
 
@@ -41,8 +46,13 @@ export async function launchDev(target) {
41
46
  try { return await stopLaunch(target, devArgs, { checkout, directory }); }
42
47
  catch (failure) { if (!(failure instanceof LaunchFailure)) throw failure; process.stderr.write(failure.message + '\n'); return failure.exitCode; }
43
48
  }
49
+ showBudget(devArgs);
50
+ // The launch never asks for shell edits. Offer the optional step only at ready.
51
+ delete process.env.RER_LAUNCH_PATH_STEP;
52
+ const paths = layout();
53
+ if (await access(paths.launcher).then(() => true, () => false) && await pathAdvice(paths)) process.env.RER_LAUNCH_PATH_STEP = `Optional, after opening your app: make rer available in future terminals. Run ${shellQuote(paths.launcher)} cli path to see the shell step; it changes no shell file itself.`;
44
54
  const here = await realpath(process.cwd()).catch(() => undefined);
45
- const out = printer({ json: devArgs.includes('--json'), stopHint: `rer dev --stop${here === checkout ? '' : ` --cwd ${JSON.stringify(checkout)}`}`, keyless: doorStart });
55
+ const out = printer({ root: checkout, json: devArgs.includes('--json'), stopHint: `rer dev --stop${here === checkout ? '' : ` --cwd ${JSON.stringify(checkout)}`}`, keyless: doorStart });
46
56
  const detach = args.includes('--detach') || (!args.includes('--foreground') && !process.stdout.isTTY);
47
57
  return detach ? detached(target, devArgs, directory, out, doorStart) : foreground(target, devArgs, directory, out, doorStart);
48
58
  }
@@ -116,7 +126,7 @@ async function follow(directory, token, out, { worker, quiet = false }) {
116
126
  const event = JSON.parse(line);
117
127
  if (event.event === 'phase') out.phase(event);
118
128
  else if (event.event === 'redirect') return event.token ? follow(directory, event.token, out, { quiet }) : missing(directory);
119
- else if (event.event === 'ready') { if (!quiet) out.ready(event.ready, event); return 0; }
129
+ else if (event.event === 'ready') { if (!quiet) await out.ready(event.ready, event); return 0; }
120
130
  else if (event.event === 'failed') { out.failure(new LaunchFailure(event.exitCode, event.message, event.error)); return event.exitCode; }
121
131
  }
122
132
  continue;
@@ -76,8 +76,8 @@ export async function portTaken(port) {
76
76
  }
77
77
 
78
78
  // The first port from 8787 (RER_DEV_PORT_FROM moves the start), among the next
79
- // `searchCandidates` ports, that is not `held` (by a registered server, or saved
80
- // by another checkout that is stopped), nothing listens on, binds on both
79
+ // `searchCandidates` ports, that is not `held` by a live server or launch
80
+ // owner, nothing listens on, binds on both
81
81
  // 127.0.0.1 and ::1 (a browser that tries ::1 first never reaches another
82
82
  // server) and that `claim` secures against another launch choosing it at the
83
83
  // same time. The search is bounded by that count, never by time or load.
@@ -1,13 +1,17 @@
1
+ import { humanError } from '../../cli/human-error.mjs';
1
2
  // What `rer dev` prints while it launches: a progress line at least every 30
2
3
  // seconds (a `progress` event with --json), then the dispatcher's ready lines.
4
+ import { readySummary } from '../../cli/ready-summary.mjs';
5
+ import { launchSummary } from '../../cli/run-transfers.mjs';
6
+
3
7
  const elapsed = ms => { const s = Math.round(ms / 1000); return s < 60 ? `${s}s` : `${Math.floor(s / 60)}m ${s % 60}s`; };
4
8
  const quiet = 20000;
5
9
 
6
10
  // `keyless` (a start by the front door, whose log this is): the ready lines
7
11
  // leave out the dev-key link, so the door's files never hold a key.
8
- export function printer({ json, stopHint, keyless = false }) {
12
+ export function printer({ json, stopHint, keyless = false, root }) {
9
13
  const started = Date.now();
10
- let current = 'preparing', last = Date.now();
14
+ let current = 'preparing', last = Date.now(), phaseStarted = last, currentPhase;
11
15
  const event = (name, fields) => process.stdout.write(JSON.stringify({ version: 1, verb: 'dev', event: name, ...fields }) + '\n');
12
16
  const line = text => process.stderr.write(`rer dev: ${text}\n`);
13
17
  const progress = (phase, message) => {
@@ -16,20 +20,23 @@ export function printer({ json, stopHint, keyless = false }) {
16
20
  else line(message);
17
21
  };
18
22
  return {
19
- phase({ phase, message }) { if (phase !== 'note') current = message; progress(phase, message); },
23
+ phase({ phase, message }) { if (phase !== 'note') { if (phase !== currentPhase) phaseStarted = Date.now(); currentPhase = phase; current = message; } progress(phase, message); },
20
24
  attaching(startedAt) { progress('attach', `attaching to the launch already preparing this checkout (started ${elapsed(Date.now() - startedAt)} ago)`); },
21
- heartbeat() { if (Date.now() - last >= quiet) progress('waiting', `still ${current} (${elapsed(Date.now() - started)}). Allow up to 10 minutes; if this command is stopped, run rer dev again to reattach.`); },
25
+ heartbeat() { if (Date.now() - last >= quiet) progress('waiting', `still ${current} (${elapsed(Date.now() - phaseStarted)}). Allow up to 10 minutes; if this command is stopped, run rer dev again to reattach.`); },
22
26
  // The dispatcher's ready event, as its own human ready lines.
23
- ready(ready, { log, pid }) {
27
+ async ready(ready, { log, pid }) {
24
28
  if (keyless) { const { openUrl, ...rest } = ready; ready = rest; }
25
29
  if (json) { event('server', { pid, log }); process.stdout.write(JSON.stringify(ready) + '\n'); return; }
26
- const out = [`RER_READY ${ready.url}`];
30
+ const out = root
31
+ ? [...readySummary(ready), ...await launchSummary(root), '', 'Details for tools and troubleshooting:', `RER_READY ${ready.url}`]
32
+ : [`Your app is ready, open it: ${ready.openUrl ?? ready.url}`, `RER_READY ${ready.url}`];
27
33
  if (ready.openUrl) {
28
34
  if (ready.signedInAs) out.push(`RER_SIGNED_IN ${ready.signedInAs}`);
29
- out.push(`RER_OPEN ${ready.openUrl}`, 'Open that link on this computer. Its fragment holds this checkout\'s dev key, which the page keeps only as a cookie; never share the link.');
35
+ out.push(`RER_OPEN ${ready.openUrl}`);
30
36
  }
31
37
  // A seed with a run site: its static homepage, /run and docs, served locally.
32
- if (ready.siteUrl) out.push(`RER_SITE ${ready.siteUrl}`);
38
+ // The checkout summary above already labels it for people.
39
+ if (ready.siteUrl) out.push(...(root ? [] : [`Site: ${ready.siteUrl}`]), `RER_SITE ${ready.siteUrl}`);
33
40
  out.push(`The server keeps running in the background${pid ? ` (PID ${pid})` : ''}. Stop it with: ${stopHint}`);
34
41
  if (log) out.push(`Server log (private): ${log}`);
35
42
  process.stdout.write(out.join('\n') + '\n');
@@ -39,7 +46,7 @@ export function printer({ json, stopHint, keyless = false }) {
39
46
  if (failure.event) process.stdout.write(JSON.stringify(failure.event) + '\n');
40
47
  else event('error', { code: 'launch_refused', message: failure.message, exitCode: failure.exitCode });
41
48
  event('result', { ok: false, exitCode: failure.exitCode });
42
- } else process.stderr.write(failure.message + '\n');
49
+ } else process.stderr.write(humanError(failure, { retry: /Correct the cause, then run (.+) again\./.exec(failure.message)?.[1] }) + '\n');
43
50
  },
44
51
  };
45
52
  }
@@ -131,8 +131,8 @@ const stepRecord = name => ({
131
131
  });
132
132
  export const installState = stepRecord('install'), setupState = stepRecord('setup');
133
133
 
134
- // The ports other checkouts were set up on by this launcher. A stopped
135
- // checkout keeps its saved origin, so a fresh launch must not take its port.
134
+ // Saved setup ports are held only while their launch worker or server lives.
135
+ // A stopped checkout keeps its settings without reserving a port indefinitely.
136
136
  export async function savedPorts(checkout, env = process.env) {
137
137
  const launches = join(serversDirectory(env), 'launches'), own = launchPath(checkout, env);
138
138
  let entries = [];
@@ -140,8 +140,8 @@ export async function savedPorts(checkout, env = process.env) {
140
140
  const ports = [];
141
141
  for (const entry of entries) {
142
142
  if (!entry.isDirectory() || join(launches, entry.name) === own) continue;
143
- const port = (await setupState.read(join(launches, entry.name)))?.port;
144
- if (Number.isInteger(port)) ports.push(port);
143
+ const directory = join(launches, entry.name), port = (await setupState.read(directory))?.port;
144
+ if (Number.isInteger(port) && (await liveWorker(directory) || await live(await serverRecord.read(directory)))) ports.push(port);
145
145
  }
146
146
  return ports;
147
147
  }
package/global/main.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { humanError } from '../cli/human-error.mjs';
1
2
  import { checkoutBootstrap, checkoutVerbs } from '../cli/contract.mjs';
2
3
  import { dispatcher, locate, pinnedPackage, unsupportedMessage } from './checkout.mjs';
3
4
  import { delegate } from './delegate.mjs';
@@ -28,8 +29,8 @@ else its vendored scripts/rer.mjs.
28
29
  them off PATH): where a project's docs say pnpm run X, run rer run X.
29
30
  rer list [DIR] The checkouts in DIR (default: here), newest first, with whether rer dev can
30
31
  launch them, whether they are set up, and their running URL. --json for data.
31
- rer business ... Pair a Business device, store local vendor keys, inspect tasks and disconnect.
32
- rer business --help lists the commands and current protocol limitations.
32
+ rer business ... Set up your business once and share its name, logo and brand colour
33
+ with apps that support Business. Start with rer business connect.
33
34
  rer companion ... Pair this computer with a Run Edit Run app and run its change requests here
34
35
  with your own Codex or Claude. rer companion --help lists the commands.
35
36
  rer door ... The opt-in front door: every checkout at http://NAME.localhost:PORT, started
@@ -37,6 +38,7 @@ else its vendored scripts/rer.mjs.
37
38
  rer cli status This rer: version, contents digest, install channel, launcher and other rer
38
39
  commands on PATH. --json for data.
39
40
  rer cli install Install this package for the current user (~/.local/bin/rer).
41
+ rer cli path Optional: make rer available in future terminals; shows the shell step.
40
42
  rer cli uninstall Remove the launcher and the install root; ~/.rer is untouched.
41
43
  rer update Move to the latest published rer (--version X for an exact one), the way it
42
44
  was installed: npx and install.sh installs switch atomically, npm installs run npm.
@@ -80,7 +82,7 @@ export async function main(argv) {
80
82
  const repository = repoArguments(argv);
81
83
  if (repository) return await (await import('./cli/repo-command.mjs')).repoCommand(repository);
82
84
  } catch (error) {
83
- process.stderr.write(error.message + '\n');
85
+ process.stderr.write((argv.includes('--json') ? error.message : humanError(error)) + '\n');
84
86
  return typeof error.exitCode === 'number' ? error.exitCode : 1;
85
87
  }
86
88
  const target = locate(argv);
@@ -95,7 +97,7 @@ export async function main(argv) {
95
97
  if ((mode !== 'bundled' || pinnedPackage(target.root)) && verb === 'doctor' && !argv.includes('--help')) {
96
98
  const { parse } = await import('../cli/parse.mjs');
97
99
  try { parse(target.args, target.root); }
98
- catch (error) { process.stderr.write(error.message + '\n'); return error.exitCode ?? 2; }
100
+ catch (error) { process.stderr.write((argv.includes('--json') ? error.message : humanError(error)) + '\n'); return error.exitCode ?? 2; }
99
101
  const code = await (await import('./browser-runtime.mjs')).browserPreflight(target.root, target.args);
100
102
  if (code !== undefined) return code;
101
103
  }
@@ -107,11 +109,11 @@ export async function main(argv) {
107
109
  // here, before provisioning the checkout's package manager.
108
110
  const publicArgs = verb === 'dev' ? target.args.filter(arg => arg !== '--door-start') : target.args;
109
111
  try { parse(publicArgs, target.root); }
110
- catch (error) { process.stderr.write(error.message + '\n'); return error.exitCode ?? 2; }
112
+ catch (error) { process.stderr.write((argv.includes('--json') ? error.message : humanError(error)) + '\n'); return error.exitCode ?? 2; }
111
113
  const { ensureProjectPnpm } = await import('../cli/project-pnpm.mjs');
112
114
  const { RerError } = await import('../cli/errors.mjs');
113
115
  try { await ensureProjectPnpm(target.root, { report: text => process.stderr.write(text + '\n') }); }
114
- catch (error) { if (!(error instanceof RerError)) throw error; process.stderr.write(error.message + '\n'); return error.exitCode; }
116
+ catch (error) { if (!(error instanceof RerError)) throw error; process.stderr.write((argv.includes('--json') ? error.message : humanError(error)) + '\n'); return error.exitCode; }
115
117
  }
116
118
  }
117
119
  if (verb === 'queue') {
@@ -135,7 +137,7 @@ export async function main(argv) {
135
137
  if (!(failure instanceof LaunchFailure)) throw failure;
136
138
  // A --json caller gets the failed step as data, as the checkout's own verbs report it.
137
139
  if (failure.event && target.args.includes('--json')) for (const event of [{ ...failure.event, verb }, { version: 1, verb, event: 'result', ok: false, exitCode: failure.exitCode }]) process.stdout.write(JSON.stringify(event) + '\n');
138
- else process.stderr.write(failure.message + '\n');
140
+ else process.stderr.write(humanError(failure, { retry: `rer ${verb} --cwd '${target.root.replaceAll("'", "'\\''")}'` }) + '\n');
139
141
  return failure.exitCode;
140
142
  }
141
143
  }
@@ -145,6 +147,9 @@ export async function main(argv) {
145
147
  const code = await (await import('./browser-runtime.mjs')).browserPreflight(target.root, target.args);
146
148
  if (code !== undefined) return code;
147
149
  }
150
+ if (first && ['setup', 'dev'].includes(verb) && !argv.some(arg => ['--help', '-h', '--stop', '--demo'].includes(arg))) {
151
+ await (await import('../cli/business/carry.mjs')).refreshCheckout(target.root);
152
+ }
148
153
  if (verb === 'dev' && mode && mode !== 'package' && !argv.includes('--help')) return (await import('./launch/dev.mjs')).launchDev(target);
149
154
  // Every other server start or queued job on a vendored pin gets the person
150
155
  // defaults too (a pinned package applies its own).