@runeditrun/rer 0.2.41 → 0.2.43

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 (40) hide show
  1. package/README.md +21 -15
  2. package/cli/browser-runtime.mjs +17 -8
  3. package/cli/contract.mjs +1 -1
  4. package/cli/deploy-command.mjs +12 -0
  5. package/cli/deployment-record.mjs +5 -4
  6. package/cli/dev-identity.mjs +6 -2
  7. package/cli/export-summary.mjs +5 -3
  8. package/cli/hosted-export.mjs +26 -0
  9. package/cli/hydration/browser.mjs +2 -2
  10. package/cli/lifecycle.mjs +18 -5
  11. package/cli/main.mjs +3 -0
  12. package/cli/port.mjs +3 -3
  13. package/cli/portability-worker.mjs +3 -1
  14. package/cli/portability.mjs +7 -3
  15. package/cli/production-mail.mjs +7 -4
  16. package/cli/sqlite-notice.mjs +11 -0
  17. package/cli/transfers.mjs +1 -1
  18. package/global/CHANGELOG.md +18 -0
  19. package/global/README.md +21 -15
  20. package/global/cli/install.mjs +9 -4
  21. package/global/cli/path-link.mjs +42 -9
  22. package/global/cli/repository.mjs +4 -1
  23. package/global/launch/facts.mjs +3 -3
  24. package/global/main.mjs +5 -1
  25. package/global/rer.mjs +1 -1
  26. package/global/run.mjs +64 -0
  27. package/global/update/command.mjs +1 -1
  28. package/install.sh +8 -7
  29. package/modules/operator-auth/README.md +5 -0
  30. package/modules/operator-auth/accounts/display-name.mjs +23 -0
  31. package/modules/operator-auth/index.d.mts +2 -0
  32. package/modules/operator-auth/routes.mjs +4 -3
  33. package/modules/operator-auth/service.mjs +2 -0
  34. package/modules/portability/README.md +13 -1
  35. package/modules/portability/import.mjs +19 -7
  36. package/modules/portability/legacy-safety.mjs +4 -20
  37. package/modules/portability/restore-safety.mjs +23 -0
  38. package/onboarding/port-probe.mjs +4 -2
  39. package/onboarding/process-diagnostics.mjs +4 -1
  40. package/package.json +1 -1
package/README.md CHANGED
@@ -14,10 +14,10 @@ rer dev just-every/run-inkwell
14
14
  ```
15
15
 
16
16
  The installer needs no Node: without Node 22 or later on PATH it installs a
17
- private one for `rer` (see below). It edits no shell profile, so when
18
- `~/.local/bin` is not on PATH, run the `export PATH=…` line it prints before
19
- `rer dev`. Its last line names that next command. The same start also fits on
20
- one line:
17
+ private one for `rer` (see below). It edits no shell profile: it names the next
18
+ command, `rer dev <owner>/<repo>`, and when `~/.local/bin` is not on PATH for new
19
+ terminals its last line is the one to run first, which adds it for your shell.
20
+ The same start also fits on one line:
21
21
 
22
22
  ```sh
23
23
  curl -fsSL https://runeditrun.com/install.sh | sh -s -- dev just-every/run-inkwell
@@ -57,16 +57,19 @@ verifies the tarball against that release's published `SHASUMS256.txt`, and
57
57
  prints its location. The launcher uses this private runtime on later runs.
58
58
  System Node and other PATH directories are left alone: the private runtime's
59
59
  `node`, `npm` and `npx` are not put on PATH, because `rer` is the one command
60
- the installer provides. With no arguments the script ends by naming the next
61
- command, `rer dev <owner>/<repo>`.
60
+ the installer provides. With no arguments the script names the next command,
61
+ `rer dev <owner>/<repo>`, and ends with the PATH line below when one is needed.
62
62
 
63
63
  No installer edits shell profiles. The canonical launcher is `~/.local/bin/rer`.
64
64
  Installation creates that directory if needed and never writes into another
65
65
  PATH directory. It names any existing `rer` elsewhere on PATH and leaves it
66
- unchanged. If `~/.local/bin` is absent from PATH or another command shadows it,
67
- it prints one activation line to run in the current shell:
68
- `export PATH="$HOME/.local/bin:$PATH"` (with fish syntax for fish). Without a
69
- private runtime, the launcher uses `node` from PATH. A re-run with the same build changes
66
+ unchanged. If `~/.local/bin` is absent from PATH, another command shadows it,
67
+ or no startup file of your shell adds it for new terminals, its last line is
68
+ one command to run: it appends `export PATH="$HOME/.local/bin:$PATH"` to that
69
+ startup file (`~/.zshrc` for zsh; `~/.bash_profile` for bash on macOS and
70
+ `~/.bashrc` elsewhere; `~/.profile` otherwise) and runs it in the current shell.
71
+ For fish it is `fish_add_path ~/.local/bin`. Without a private runtime, the
72
+ launcher uses `node` from PATH. A re-run with the same build changes
70
73
  nothing; a different build is installed beside the current one, the previous one
71
74
  is kept and older ones are removed. It refuses to replace a `~/.local/bin/rer`
72
75
  that it did not write.
@@ -88,11 +91,14 @@ install in place.
88
91
  - For `install.sh`: `curl`, `tar`, and `shasum` or `sha256sum` when it installs
89
92
  Node. macOS includes these tools.
90
93
  - For the npm/npx install alternatives: Node 22 or later on PATH.
91
- - Checkout commands acquire the checkout's pinned Node and pnpm when needed.
92
- `rer install` also downloads the checkout's Playwright Chromium and headless
93
- shell for verification; `rer verify` installs missing browser files on first
94
- need. Downloads print progress. `rer doctor` reports a missing browser and
95
- directs you to `rer install`, without downloading anything itself.
94
+ - Checkout commands acquire the checkout's pinned Node and pnpm when needed,
95
+ in rer's own cache: neither goes on PATH. `rer run SCRIPT [ARGS]` runs a
96
+ package.json script with them, so a project's `pnpm run X -- ARGS` is
97
+ `rer run X -- ARGS`. `rer install` downloads no browser: the checkout's
98
+ Playwright Chromium and headless shell download the first time a command needs
99
+ them (`rer verify`, or `rer run` of a script that runs Playwright). Downloads
100
+ print progress. `rer doctor` lists browsers not downloaded yet, without
101
+ counting them as a problem or downloading anything itself.
96
102
 
97
103
  Not supported: native Windows (`install.sh` and `rer` say to use WSL2), and
98
104
  `OPERATIONS.json` version 1 projects.
@@ -1,6 +1,8 @@
1
1
  // Browser prerequisites come from the checkout's Playwright, including its
2
2
  // platform/revision and PLAYWRIGHT_BROWSERS_PATH handling. Inspection never
3
- // launches a browser or downloads anything.
3
+ // launches a browser or downloads anything. The browser itself downloads on
4
+ // the first command that needs it (rer verify, or rer run of a Playwright
5
+ // script), never during rer install: a deploy-only owner never fetches it.
4
6
  import { access, constants } from 'node:fs/promises';
5
7
  import { createRequire } from 'node:module';
6
8
  import { dirname, join, relative } from 'node:path';
@@ -8,6 +10,7 @@ import { RerError } from './errors.mjs';
8
10
  import { shared } from './shared.mjs';
9
11
 
10
12
  export const browserRepair = 'rer install';
13
+ export const browserDownload = 'rer verify downloads them the first time it runs';
11
14
 
12
15
  export function checkoutPlaywright(root, { required = true } = {}) {
13
16
  const require = createRequire(join(root, 'package.json'));
@@ -44,22 +47,28 @@ export async function browserDoctor(root) {
44
47
  if (path) try { await access(path, process.platform === 'win32' ? constants.F_OK : constants.X_OK); ok = true; } catch {}
45
48
  executables.push({ name, ...(path ? { path } : {}), ok });
46
49
  }
50
+ // Not yet downloaded is the normal state until a command needs the browser.
47
51
  const missing = executables.filter(executable => !executable.ok).map(executable => executable.name);
48
- return { ok: !missing.length, package: resolved.name, executables, ...(missing.length ? { issue: `Playwright browser executables are missing: ${missing.join(', ')}. Run ${browserRepair}.`, fix: browserRepair } : {}) };
52
+ return { ok: true, package: resolved.name, executables, ...(missing.length ? { note: `Playwright browsers not downloaded yet: ${missing.join(', ')}; ${browserDownload}.` } : {}) };
49
53
  }
50
54
 
51
55
  export async function ensureChromium(root, store, signal, { required = true } = {}) {
52
- // Installing a first-party adapter without browser dependencies remains valid.
53
- // Verification requires Playwright; installation provisions it when declared.
56
+ // A first-party adapter without browser dependencies remains valid.
57
+ // Verification requires Playwright; rer run provisions it when declared.
54
58
  const resolved = checkoutPlaywright(root, { required });
55
59
  if (!resolved) return;
56
- const before = await browserDoctor(root);
57
- if (before.ok) return;
60
+ if (await browsersPresent(root)) return;
58
61
  const { cli } = resolved;
59
62
  const { dependencyEnvironment } = await shared('dependency-environment.mjs');
60
63
  const env = dependencyEnvironment();
61
64
  if (process.env.PLAYWRIGHT_BROWSERS_PATH !== undefined) env.PLAYWRIGHT_BROWSERS_PATH = process.env.PLAYWRIGHT_BROWSERS_PATH;
62
65
  await store.run('Installing Chromium and its headless shell from the checkout’s Playwright', 'pnpm', ['exec', 'node', cli, 'install', 'chromium'], { cwd: root, signal, env, display: `pnpm exec node ${relative(root, cli)} install chromium` });
63
- const after = await browserDoctor(root);
64
- if (!after.ok) throw new RerError('browser_install_incomplete', after.issue, 3);
66
+ const absent = (await browserDoctor(root)).executables.filter(executable => !executable.ok).map(executable => executable.name);
67
+ if (absent.length) throw new RerError('browser_install_incomplete', `The checkout's Playwright did not install every browser it pins (missing: ${absent.join(', ')}). Run the same command again; it retries the download.`, 3);
68
+ }
69
+
70
+ // Whether every browser the checkout's Playwright pins is on disk.
71
+ export async function browsersPresent(root) {
72
+ const browser = await browserDoctor(root).catch(() => undefined);
73
+ return Boolean(browser?.ok && !browser.note);
65
74
  }
package/cli/contract.mjs CHANGED
@@ -12,7 +12,7 @@ const definitions = {
12
12
  verify: [[], 'Run the complete internal verification target.'],
13
13
  reset: [['--yes'], 'Confirmed removal of the declared local inventory only.'],
14
14
  deploy: [['--environment', '--dry-run', '--site', '--demo', '--host', '--env-file', '--image', '--bind-address', '--http-port', '--https-port', '--remove', '--yes', '--set-secret', '--unset-secret', '--rotate-secret'], 'Owner-account deployment and health; dry run performs local validation/build only. Builds and deploy hooks run with the checkout\'s local settings files moved aside, and a build output holding one (.dev.vars, .env) is refused. Declared secrets come from the environment or --env-file (an owned 0600 KEY=VALUE file); a new Worker gets the local setup owner and fresh generated secrets when they are not given. rer keeps the secrets it generates in .rer/deploy/ENVIRONMENT.secrets.env (0600) and reuses them on every redeploy; it refuses to generate a replacement for one a live Worker holds, and --rotate-secret NAME[,NAME] replaces them on purpose. After a healthy deploy rer claims the setup owner on the hosted app with the one-time setup token, then removes the token. --set-secret NAME (value from the environment or --env-file) and --unset-secret NAME change one secret of the deployed Worker without a build and record its new version. --remove --yes deletes what this environment\'s deploy record says rer created (Worker, D1, R2, KV, queues), reads back that each is gone, and touches nothing else. --site deploys the run site instead: an assets-only Worker on its custom domain with www redirected; with --dry-run it builds the site and prints the plan with no provider request. --demo deploys the hosted demo instead (deploy-demo.json): a front Worker on demo.<domain> giving each visitor their own signed-in, throwaway native Worker isolate of this seed with real public reads/checks and simulated external writes; --dry-run writes it to .rer/demo-host with no provider request; --demo --remove --yes deletes that demo (its Worker, demo.<domain> Custom Domain, each only while the record its deploy left proves it the demo\'s), reads back that each is gone, and is a no-op once it is.'],
15
- export: [['--target', '--output', '--origin', '--session-file'], 'Complete supported installation archive with integrity and exclusions.'],
15
+ export: [['--target', '--output', '--origin', '--session-file'], 'Complete supported archive of the local copy on this computer, with integrity and exclusions, written to --output. The hosted install cannot be exported yet: --origin or --target remote refuses (exit 2) before any effect and names the command that saves the hosted database.'],
16
16
  import: [['--target', '--input', '--journal', '--origin', '--session-file', '--yes', '--legacy-v1', '--acknowledge-unverified-metadata', '--output'], 'Confirmed atomic restore into an empty destination; --journal LATER_ARCHIVE also fences rows that installation erased since. Backup-only local v1 recovery requires --legacy-v1 --acknowledge-unverified-metadata and a new --output v2 archive; --journal requires normal v2 import.'],
17
17
  doctor: [[], 'Read-only installed tool, configuration and state diagnostics.'],
18
18
  describe: [[], 'Read-only description of actual command capabilities.'],
@@ -44,6 +44,18 @@ export async function declarationFor(root, adapter) {
44
44
  return matches[0];
45
45
  }
46
46
 
47
+ // What a real deploy of this checkout still needs from its owner, read from its
48
+ // deploy declaration as a dry run reads it. Local setup lists it when it ends.
49
+ export async function hostedDeployNeeds(project) {
50
+ const { adapter, root, setupManifest, setupSeed } = project;
51
+ if (typeof adapter?.deploy !== 'function') return [];
52
+ const { path, value: declaration } = await declarationFor(root, adapter);
53
+ const options = { dryRun: true }, settings = adapter.hooks?.secrets ?? adapter.settings;
54
+ const { env } = await deployEnvironment({ root, options, declaration, setupManifest, settings, localOnlyKeys: adapter.localOnlyKeys ?? [] });
55
+ const { signIn } = await requireProductionAuth({ root, declaration, env, setupManifest, setupSeed, adapter, declarationPath: path, options }) ?? {};
56
+ return neededForRealDeploy({ declaration, env, signIn });
57
+ }
58
+
47
59
  export async function deployCommand(context) {
48
60
  const { adapter, root, options, store, setupManifest, linkDependencies, localOnlyKeys = [] } = context;
49
61
  validateDeployOptions(options);
@@ -16,7 +16,7 @@ export async function deploymentRecord(root, options) {
16
16
  try { await access(path); }
17
17
  catch (error) {
18
18
  if (error.code !== 'ENOENT') throw error;
19
- const availableDeployments = (await environments(root)).map(environment => ({ environment, command: commandFor(options, environment) }));
19
+ const availableDeployments = (await heldDeployments(root)).map(({ environment }) => ({ environment, command: commandFor(options, environment) }));
20
20
  const held = availableDeployments.length
21
21
  ? `It holds:\n${availableDeployments.map(item => ` ${item.environment}: ${item.command}`).join('\n')}`
22
22
  : 'This checkout holds no deployment environments. Run it from the checkout that deployed it.';
@@ -26,7 +26,8 @@ export async function deploymentRecord(root, options) {
26
26
  return state;
27
27
  }
28
28
 
29
- async function environments(root) {
29
+ // The deployments this checkout holds: each environment with its owner-state record.
30
+ export async function heldDeployments(root) {
30
31
  let entries;
31
32
  try { entries = await readdir(await contained(root, '.rer/deploy', { optional: true })); }
32
33
  catch (error) { if (error.code === 'ENOENT') return []; throw error; }
@@ -36,10 +37,10 @@ async function environments(root) {
36
37
  const state = await hookState(root, environment);
37
38
  const path = await contained(root, state ?? recordPath(environment));
38
39
  const record = JSON.parse(await readFile(path, 'utf8'));
39
- return record?.kind === 'rer-deploy-owner-state' && record.environment === environment ? environment : undefined;
40
+ return record?.kind === 'rer-deploy-owner-state' && record.environment === environment ? { environment, record } : undefined;
40
41
  } catch { return undefined; } // An unrelated or broken file is not a held deployment.
41
42
  }));
42
- return held.filter(Boolean).sort();
43
+ return held.filter(Boolean).sort((a, b) => a.environment.localeCompare(b.environment));
43
44
  }
44
45
 
45
46
  function commandFor(options, environment) {
@@ -62,8 +62,12 @@ export async function resolvePersona(url, key, as, signal) {
62
62
  const response = await appFetch(url + '/__dev/personas', { headers: { [DEV_KEY_HEADER]: key }, signal: AbortSignal.any([signal, AbortSignal.timeout(10000)].filter(Boolean)) });
63
63
  if (!response.ok) { await response.body?.cancel(); throw refuse(`The application did not serve dev identity (HTTP ${response.status}). Check its local-only entry.`); }
64
64
  const personas = await response.json(), persona = personas.find(entry => entry.as === as);
65
- if (!persona) throw invalid(`Unknown dev persona ${as}. This app declares: ${personas.map(entry => entry.as).join(', ')}.`);
66
- return persona;
65
+ if (persona) return persona;
66
+ // The people rer can sign in as: each persona with its email, then every
67
+ // invited or active person in this checkout's local database by email.
68
+ const valid = personas.map(entry => entry.as === entry.email || !entry.email ? entry.as : `${entry.as} (${entry.email})`).join(', ');
69
+ if (!as.includes('@')) throw invalid(`Unknown dev persona ${as}. rer dev --as takes one of: ${valid}.`);
70
+ throw invalid(`No one with the email ${as} can sign in to this app locally. rer dev --as takes one of: ${valid}. Someone added only to the app's own records can sign in once the app invites them (its Invite action, which sends no mail locally); then run rer dev --as ${as} again.`);
67
71
  }
68
72
 
69
73
  // rer build refuses output that bundles the dev layer, naming the file.
@@ -1,8 +1,10 @@
1
- // The one line a finished export ends with: the archive, its size and what it holds.
2
- export function exportSummary({ output, bytes, tables } = {}) {
1
+ // The one line a finished export ends with: which copy it exported, the
2
+ // archive, its size and what it holds.
3
+ export function exportSummary({ target = 'local', origin, output, bytes, tables } = {}) {
3
4
  if (typeof output !== 'string' || !Number.isSafeInteger(bytes) || !Array.isArray(tables)) return undefined;
4
5
  const rows = tables.reduce((sum, table) => sum + (Number.isSafeInteger(table?.count) ? table.count : 0), 0);
5
- return `Exported ${output} (${size(bytes)}): ${counted(tables.length, 'table')}, ${counted(rows, 'row')}`;
6
+ const copy = target === 'remote' ? `the hosted install${origin ? ` at ${origin}` : ''}` : 'the local copy';
7
+ return `Exported ${copy} to ${output} (${size(bytes)}): ${counted(tables.length, 'table')}, ${counted(rows, 'row')}`;
6
8
  }
7
9
 
8
10
  const counted = (value, noun) => `${value.toLocaleString('en-US')} ${noun}${value === 1 ? '' : 's'}`;
@@ -0,0 +1,26 @@
1
+ import { heldDeployments } from './deployment-record.mjs';
2
+ import { invalid } from './errors.mjs';
3
+
4
+ // rer export reads only this computer's copy. A hosted address (--origin, or
5
+ // --target remote) names the hosted install, which rer cannot export yet: the
6
+ // portability export writes snapshot tables into the database it reads, so it
7
+ // never runs against a live hosted one. Refuse before any effect rather than
8
+ // save the local copy under the hosted install's name.
9
+ export async function refuseHostedExport(project, options) {
10
+ if (options.origin === undefined && options.target !== 'remote') return;
11
+ if (project.adapter?.portability?.remote === true) return;
12
+ const origin = options.origin === undefined ? undefined : new URL(options.origin).origin;
13
+ const held = await heldDeployments(project.root);
14
+ const matched = held.filter(({ record }) => origin !== undefined && record.receipt?.origin === origin);
15
+ const named = (matched.length ? matched : held).map(({ record }) => ({ databases: Object.keys(record.owned?.d1 ?? {}), buckets: Object.keys(record.owned?.r2 ?? {}) }));
16
+ const databases = named.flatMap(item => item.databases), buckets = named.flatMap(item => item.buckets);
17
+ const exports = (databases.length ? databases : ['DATABASE']).map(name => ` npx wrangler d1 export ${name} --remote --output exports/${name === 'DATABASE' ? 'hosted' : name}.sql`);
18
+ throw invalid([
19
+ `This exports the local copy. rer cannot export the hosted install${origin ? ` at ${origin}` : ''} yet, so nothing was exported. Keep the hosted install until you have saved its data.`,
20
+ `To export the hosted install's database, run this from this checkout with the Cloudflare credentials that deployed it (CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in the environment, or add --env-file FILE):`,
21
+ ...exports,
22
+ ...(databases.length ? [] : [' (npx wrangler d1 list names the hosted databases.)']),
23
+ ...(buckets.length ? [`Files the hosted install keeps in R2 (${buckets.join(', ')}) are not in that export.`] : []),
24
+ 'To export the local copy, run: rer export --output exports/local.rer',
25
+ ].join('\n'));
26
+ }
@@ -1,7 +1,7 @@
1
1
  // Chromium from the seed's own Playwright, the two ways of serving pages to it
2
2
  // (the production build as rer deploy hosts it, or a running origin), and one
3
3
  // load: scripts held until the probe releases them, every external request aborted.
4
- import { checkoutPlaywright, browserRepair } from '../browser-runtime.mjs';
4
+ import { checkoutPlaywright } from '../browser-runtime.mjs';
5
5
  import { RerError } from '../errors.mjs';
6
6
  import { serveHosted } from '../hosted-output.mjs';
7
7
  import { probe } from './probe.mjs';
@@ -12,7 +12,7 @@ export async function launchChromium(root) {
12
12
  // Pages fulfilled by the check would otherwise count as public, and Chromium would
13
13
  // refuse a dev server's loopback HMR socket from them.
14
14
  try { return await playwright.chromium.launch({ args: ['--disable-features=LocalNetworkAccessChecks'] }); }
15
- catch (error) { throw new RerError('hydration_browser_missing', `The hydration check could not start Chromium from the seed's ${name}: ${String(error.message).split('\n').find(line => line.trim()) ?? error}. Install the browser it pins with ${browserRepair}.`, 1); }
15
+ catch (error) { throw new RerError('hydration_browser_missing', `The hydration check could not start Chromium from the seed's ${name}: ${String(error.message).split('\n').find(line => line.trim()) ?? error}. Run rer verify, which downloads the browser it pins first.`, 1); }
16
16
  }
17
17
 
18
18
  const strip = new Set(['content-encoding', 'content-length', 'transfer-encoding', 'connection']);
package/cli/lifecycle.mjs CHANGED
@@ -2,6 +2,7 @@ import { ensureChromium } from './browser-runtime.mjs';
2
2
  import { dependencyInputs } from './dependency-input.mjs';
3
3
  import { linkDependencies } from './dependencies.mjs';
4
4
  import { savedSetupAnswers } from './setup-answers.mjs';
5
+ import { localDefaultsVariable } from './setup-input.mjs';
5
6
  import { mkdtemp, rm } from 'node:fs/promises';
6
7
  import { tmpdir } from 'node:os';
7
8
  import { join } from 'node:path';
@@ -93,9 +94,10 @@ async function runLifecycle(project, options, out, deployRedaction) {
93
94
  try {
94
95
  const { dependencyEnvironment } = await shared('dependency-environment.mjs');
95
96
  await store.run('Installing frozen dependencies', 'pnpm', ['install', '--frozen-lockfile'], { cwd: project.root, signal, env: { ...dependencyEnvironment(), CI: 'true' }, display: 'pnpm install --frozen-lockfile' });
96
- // Inspecting the checkout's Playwright is its own step, before any download command.
97
- state.step = 'Checking the checkout’s Playwright browsers';
98
- await ensureChromium(project.root, store, signal, { required: false }); return {};
97
+ // The test browser downloads on first need (verify), not here. Package
98
+ // scripts run with the pinned pnpm through rer run, which keeps pnpm off PATH.
99
+ if (!options.json) store.report('Run this project\'s package scripts with rer run SCRIPT (it uses the pnpm this project pins).');
100
+ return {};
99
101
  } catch (error) { if (signal.aborted) throw error; throw await installStepError(error, store, project.root); }
100
102
  }
101
103
  if (options.verb === 'verify') {
@@ -144,8 +146,12 @@ async function runLifecycle(project, options, out, deployRedaction) {
144
146
  }
145
147
  await store.stop(app);
146
148
  await rememberSetupAnswers(project, input);
147
- if (options.json) out.event('setup-ready', { url, setupUrl: url+'/setup' });
148
- else { out.human(`RER_SETUP_READY ${url}`); out.human(`Next: rer dev opens ${url} signed in as the owner; first-run setup finishes at ${url}/setup.`); }
149
+ const deployNeeds = await hostedNeeds(project);
150
+ if (options.json) out.event('setup-ready', { url, setupUrl: url+'/setup', ...(deployNeeds.length ? { neededForDeploy: deployNeeds } : {}) });
151
+ else {
152
+ out.human(`RER_SETUP_READY ${url}`); out.human(`Next: rer dev opens ${url} signed in as the owner; first-run setup finishes at ${url}/setup.`);
153
+ if (deployNeeds.length) out.human(['To host it on your own Cloudflare account later, rer deploy needs:', ...deployNeeds.map(item => ` - ${item}`), 'Set them in your environment or a private (mode 0600) file passed with --env-file, then check with rer deploy --dry-run.'].join('\n'));
154
+ }
149
155
  } else if (options.verb !== 'build') throw refuse('The requested first-party capability is unavailable.');
150
156
  return {};
151
157
  } catch (error) {
@@ -167,6 +173,13 @@ async function runLifecycle(project, options, out, deployRedaction) {
167
173
  }
168
174
  }
169
175
 
176
+ // An explicit rer setup lists what hosting this checkout will need; the setup
177
+ // a zero-setup rer dev runs does not. The list is advice: it never fails setup.
178
+ async function hostedNeeds(project) {
179
+ if (process.env[localDefaultsVariable] === '1') return [];
180
+ try { return await (await import('./deploy-command.mjs')).hostedDeployNeeds(project); } catch { return []; }
181
+ }
182
+
170
183
  // A failed install step names itself: its command, exit code, last output and
171
184
  // full log. A step that stopped outside a command still names the step and log.
172
185
  async function installStepError(error, store, root) {
package/cli/main.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import './sqlite-notice.mjs';
1
2
  import { parse, help } from './parse.mjs';
2
3
  import { output } from './output.mjs';
3
4
  import { invalid, RerError } from './errors.mjs';
@@ -49,6 +50,8 @@ export async function main(argv = process.argv.slice(2)) {
49
50
  warnPlaceholderMarks(out, options, await checkoutPlaceholderMarks(project.root, project.descriptor.project));
50
51
  (await import('./site.mjs')).declaredSite(project);
51
52
  }
53
+ // A hosted address never exports this computer's copy under its name.
54
+ if (options.verb === 'export' && project.profile === 'first-party') await (await import('./hosted-export.mjs')).refuseHostedExport(project, options);
52
55
  if (options.verb === 'deploy' && !options.site && !options.demo && !options.remove && !options.setSecret && !options.unsetSecret) {
53
56
  const { deliveryDeclarationClauses } = await import('./delivery-declarations.mjs');
54
57
  const failures = (await deliveryDeclarationClauses(project.root)).filter(clause => !clause.ok);
package/cli/port.mjs CHANGED
@@ -11,11 +11,11 @@ export const defaultPort = 8787;
11
11
  // this host can bind. Another checkout's server may listen on every address,
12
12
  // which a bind to 127.0.0.1 alone does not notice.
13
13
  export async function firstFreePort(host, from = defaultPort, context) {
14
- const { inspectionContext } = await shared('process-diagnostics.mjs');
14
+ const { searchContext } = await shared('process-diagnostics.mjs');
15
15
  const { probePort } = await shared('port-probe.mjs');
16
- context ??= inspectionContext({verb:'setup'});
16
+ context ??= searchContext({verb:'setup'});
17
17
  for (let port = from; port <= 65535; port++) {
18
- if ((await probePort(host, port, { context, anyAddress: true })).available) return port;
18
+ if ((await probePort(host, port, { context, anyAddress: true, searching: true })).available) return port;
19
19
  if (performance.now() >= context.deadline) throw Error('Could not find a free port in time (system busy). Run rer setup again.');
20
20
  }
21
21
  throw Error(`No free port from ${from} upward.`);
@@ -71,6 +71,8 @@ catch (error) {
71
71
  const reason = error instanceof PortabilityError ? error.code.split(':')[0] : /^[A-Z_]+$/.test(error.code ?? '') ? error.code : error.message === 'archive_json' ? 'archive_json' : 'native_error';
72
72
  // A later migration that changes restorable data is named: it is a file of this installation.
73
73
  const migration = error instanceof PortabilityError && error.code.startsWith('schema_mismatch:migration_data:') ? error.code.slice('schema_mismatch:migration_data:'.length) : undefined;
74
+ // A populated destination names its table or bucket: schema names, never row data.
75
+ const occupied = error instanceof PortabilityError && /^(target|bucket)_not_empty:/.test(error.code) ? error.code.slice(error.code.indexOf(':') + 1) : undefined;
74
76
  process.exitCode = exitCode;
75
- await reply({ ok: false, code: exitCode === 2 ? 'invalid_archive' : exitCode === 4 ? 'restore_refused' : 'transfer_failed', reason, ...(migration ? { migration } : {}), exitCode });
77
+ await reply({ ok: false, code: exitCode === 2 ? 'invalid_archive' : exitCode === 4 ? 'restore_refused' : 'transfer_failed', reason, ...(migration ? { migration } : {}), ...(occupied ? { occupied } : {}), exitCode });
76
78
  }
@@ -54,9 +54,11 @@ export function localPortability({ database, binding = 'DB', buckets = {}, polic
54
54
  // Check real existing bindings first; finalize repeats this under the lock.
55
55
  if(legacyRecovery)await nativeWorker(store,'legacy-preflight',input,signal);
56
56
  // Local migrations need no provider account: wrangler runs without credentials.
57
+ // Its info lines (the local location and "Use --remote if you want to access
58
+ // the remote instance") only confuse a local backup; warnings and errors print.
57
59
  const { dependencyEnvironment } = await shared('dependency-environment.mjs');
58
60
  await store.run('Applying local data migrations', 'pnpm', ['exec', 'wrangler', 'd1', 'migrations', 'apply', database, '--local', '--persist-to', '.wrangler/state', '--config', 'wrangler.jsonc'], {
59
- cwd: root, signal, env: { ...dependencyEnvironment(), RER_LOCAL_OPERATION: operationToken, WRANGLER_SEND_METRICS: 'false' },
61
+ cwd: root, signal, env: { ...dependencyEnvironment(), RER_LOCAL_OPERATION: operationToken, WRANGLER_SEND_METRICS: 'false', WRANGLER_LOG: 'warn' },
60
62
  });
61
63
  const receipt=await nativeWorker(store,direction,input,signal);
62
64
  if(legacyRecovery)receipt.output=relative(root,legacyRecovery.output);
@@ -66,9 +68,10 @@ export function localPortability({ database, binding = 'DB', buckets = {}, polic
66
68
  }
67
69
 
68
70
  async function nativeWorker(store,direction,input,signal) {
69
- const worker = fileURLToPath(new URL('./portability-worker.mjs', import.meta.url));
71
+ // The notice filter loads before the worker links its static node:sqlite import.
72
+ const worker = fileURLToPath(new URL('./portability-worker.mjs', import.meta.url)), notice = new URL('./sqlite-notice.mjs', import.meta.url).href;
70
73
  const child = store.spawn(`${direction === 'policy-preflight' ? 'Checking archive policy' : direction === 'legacy-preflight' ? 'Checking empty recovery destination' : direction === 'export' ? 'Exporting' : 'Restoring'} local installation data`, process.execPath,
71
- [worker, direction, JSON.stringify(input)], { cwd: input.root, signal, env: { ...process.env, WRANGLER_SEND_METRICS: 'false' }, stdio: ['ignore', 'pipe', 'pipe', 'ipc'] });
74
+ ['--import', notice, worker, direction, JSON.stringify(input)], { cwd: input.root, signal, env: { ...process.env, WRANGLER_SEND_METRICS: 'false' }, stdio: ['ignore', 'pipe', 'pipe', 'ipc'] });
72
75
  let receipt;
73
76
  child.once('message', message => { receipt = message; });
74
77
  const closed = new Promise(resolve => child.once('close', (code, signal) => resolve({ code, signal })));
@@ -79,6 +82,7 @@ async function nativeWorker(store,direction,input,signal) {
79
82
  if (status.code !== 0 || !receipt.ok) throw new RerError(receipt.code ?? 'transfer_failed', receipt.reason==='legacy_restored_export_failed'
80
83
  ? 'Legacy data was restored and audited, but its v2 export failed. Preserve this installation, resolve the output problem, then run rer export --output FILE. Do not reset it to retry recovery.'
81
84
  : receipt.migration ? `Restore refused (schema_mismatch:migration_data): migration ${receipt.migration} changed data after this archive was made, so its rows would skip that change. Restore an archive made after it.`
85
+ : receipt.occupied ? `Restore refused (${receipt.reason}): ${receipt.reason === 'bucket_not_empty' ? `storage bucket ${receipt.occupied} in this installation already holds files` : `table ${receipt.occupied} in this installation already holds rows its migrations did not insert`}, and a restore only goes into an empty installation. To replace this installation's data with the archive, keep a copy with rer export --output exports/before-restore.rer, then run rer reset --yes and rer import --input ${relative(input.root, input.path)} --yes again.`
82
86
  : `The portability module refused or failed the archive operation (${receipt.reason ?? 'incomplete'}).`, receipt.exitCode ?? 1);
83
87
  delete receipt.ok;
84
88
  return receipt;
@@ -1,13 +1,16 @@
1
1
  import { readFile } from 'node:fs/promises';
2
2
  import { contained } from './project.mjs';
3
3
  import { refuse } from './errors.mjs';
4
- import { mailbox } from './parse.mjs';
4
+ import { parseAddress } from '../modules/mail/src/core/validation.mjs';
5
5
  import { deliveryDeclarationSources } from './delivery-declarations.mjs';
6
6
  import { validateRerConfig } from '../modules/mail/src/adapters/rer/contract.mjs';
7
7
 
8
8
  const providers = ['resend', 'sendgrid', 'cloudflare', 'rer'];
9
9
  const nativeCredential = { sendgrid: 'SENDGRID_API_KEY', resend: 'RESEND_API_KEY' };
10
10
  const present = value => typeof value === 'string' && Boolean(value.trim());
11
+ // The sender forms the mail runtime sends from: a bare address or "Display Name <address>".
12
+ const sender = value => { try { parseAddress(value); return true; } catch { return false; } };
13
+ const SENDER = 'MAIL_FROM (billing@example.com or Your Business <billing@example.com>)';
11
14
 
12
15
  // Packaging can declare inputs that a product's deploy adapter adds to the
13
16
  // root declaration later. Read that source contract, never arbitrary ambient
@@ -52,7 +55,7 @@ export async function productionMail(root, declaration, env) {
52
55
  if (provider === 'rer') try { validateRerConfig({ relayUrl: bindings.MAIL_RELAY_URL }); } catch { relaySelected = false; }
53
56
  const has = key => present(bindings[key]) || secrets.has(key) && live.includes(key);
54
57
  return [
55
- ...(!mailbox(bindings.MAIL_FROM) ? ['MAIL_FROM'] : []),
58
+ ...(!sender(bindings.MAIL_FROM) ? [SENDER] : []),
56
59
  ...(!credentialKeys.some(has) ? [declaredCredentials.join(' or ') || credentialKeys.join(' or ')] : []),
57
60
  ...(provider === 'cloudflare' && !has('MAIL_ACCOUNT_ID') ? ['MAIL_ACCOUNT_ID'] : []),
58
61
  ...(!relaySelected ? ['MAIL_RELAY_URL (assigned HTTPS relay URL)'] : []),
@@ -62,10 +65,10 @@ export async function productionMail(root, declaration, env) {
62
65
  return {
63
66
  declared: 'MAIL_PROVIDER' in bindings || publicInputs.has('MAIL_PROVIDER') || secrets.has('MAIL_API_KEY') || selected.length > 0,
64
67
  configured: (live = []) => routes.some(missing => missing(live).length === 0),
65
- canInspect: mailbox(bindings.MAIL_FROM) && routes.length > 0,
68
+ canInspect: sender(bindings.MAIL_FROM) && routes.length > 0,
66
69
  missing: routes.length ? routes.map(missing => missing([]).join(', ')).join(' or ') : [
67
70
  'MAIL_PROVIDER (resend, sendgrid, cloudflare or rer)',
68
- ...(!mailbox(bindings.MAIL_FROM) ? ['MAIL_FROM'] : []),
71
+ ...(!sender(bindings.MAIL_FROM) ? [SENDER] : []),
69
72
  'MAIL_API_KEY',
70
73
  ].join(', '),
71
74
  };
@@ -0,0 +1,11 @@
1
+ // Node 22 marks node:sqlite experimental and prints a warning when it loads.
2
+ // rer reads local SQLite on purpose (reset, export, import), so that one notice
3
+ // is dropped; every other warning still prints. Import it before node:sqlite
4
+ // loads: a static import of node:sqlite warns while its module graph links, so
5
+ // a process whose entry imports it statically preloads this with --import.
6
+ const emitWarning = process.emitWarning;
7
+ process.emitWarning = function (warning, ...rest) {
8
+ const type = typeof rest[0] === 'string' ? rest[0] : rest[0]?.type;
9
+ if (type === 'ExperimentalWarning' && /^SQLite is an experimental feature/.test(String(warning?.message ?? warning))) return;
10
+ return emitWarning.call(process, warning, ...rest);
11
+ };
package/cli/transfers.mjs CHANGED
@@ -29,7 +29,7 @@ export async function transfer(project, options, signal, custody) {
29
29
  await located.unserved(); await legacyOutput?.unserved();
30
30
  const result=await api[direction]({ root: project.root, target, path, journal, origin: options.origin, sessionFile, signal, platform:options.platform, legacyRecovery, ...custody });
31
31
  // The archive's size, for the line a finished export ends with.
32
- if(direction==='export')return {...result,output:result.output??relative(project.root,path),bytes:(await stat(path)).size};
32
+ if(direction==='export')return {...result,target,...(target==='remote'&&options.origin?{origin:new URL(options.origin).origin}:{}),output:result.output??relative(project.root,path),bytes:(await stat(path)).size};
33
33
  if(direction==='import' && target==='local' && (await localDependencyLinks(project.root)).some(link=>link.needs_relink)) {
34
34
  custody.store.report('Imported provider links need fresh approval. Run rer setup with RER_LINK_TOKEN_FILE to re-link this installation.');
35
35
  return {...result,needsRelink:true,nextCommand:'rer setup'};
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.43
4
+
5
+ - **The installer ends with the line that puts `rer` on PATH.** `install.sh` and `rer cli install` end with `Next, start an app: rer dev <owner>/<repo>`. When new terminals will not find `rer`, the last line is the one command that adds `~/.local/bin` for your shell, for example `echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc && export PATH="$HOME/.local/bin:$PATH"` (bash: `~/.bash_profile` on macOS and `~/.bashrc` elsewhere; fish: `fish_add_path ~/.local/bin`; otherwise `~/.profile`). Once a startup file already adds it, no line is printed. The installer still never edits a shell profile itself (#190).
6
+ - **`rer run SCRIPT` runs a project's scripts without pnpm on PATH.** `rer run X -- ARGS` is `pnpm run X -- ARGS` with the pnpm and Node the checkout pins, taken from rer's own cache. `rer run` alone lists the scripts. Where a seed's docs say `pnpm run …`, a newcomer without pnpm can now run them (#190).
7
+ - **`rer install` no longer downloads a browser.** The Playwright browser a seed's tests use (about 99 MiB) downloads the first time a command needs it: `rer verify`, or `rer run` of a script that runs Playwright. An owner who only deploys never fetches it. `rer doctor` lists a browser not yet downloaded as a note, not a failure (#190).
8
+ - **`rer dev <owner>/<repo>` clones every release tag.** The clone uses `--filter=blob:none` instead of `--depth 1`: it has every commit and tag, and file contents arrive as a checkout needs them, so `git checkout <tag>` adopts an older release (#190).
9
+ - **`rer setup` says what a hosted deploy still needs.** An explicit `rer setup` ends with what `rer deploy` will need, read from the deploy declaration: the Cloudflare account ID and API token, each required secret not yet set, and production sign-in's mail inputs. With `--json`, the `setup-ready` event carries `neededForDeploy` (#190).
10
+ - **A busy computer no longer fails the first `rer dev` on the port search.** The search moves past a port in use as soon as it cannot bind it, and its time allowance grows with the load per CPU (15 seconds, up to 60). Before, every busy port ran a slow ownership check inside one 15-second budget (#190).
11
+ - **Plainer wording, less noise.** The installer says "start an app", not "start a seed". `rer export`, `rer reset` and `rer import` no longer print Node's "SQLite is an experimental feature" notice or wrangler's "Use --remote if you want to access the remote instance"; warnings and errors still print (#190).
12
+ - **A restore into a fresh install accepts the rows the seed's own migrations insert.** `rer import` into a fresh or reset install used to refuse any seed whose migrations insert rows, such as default settings, with only "(target_not_empty)". Now a table that holds exactly the rows a replay of the applied migrations leaves counts as empty, and the archive's rows replace them. Any other row still refuses, and the message names the table and the next step: keep a copy with `rer export`, then `rer reset --yes` and `rer import --input <file> --yes`. A non-empty bucket is named the same way. This covers local and Node runners; a hosted (Worker) import still needs `replaceableTables` (#193).
13
+ - **The owner can change their display name.** `/setup` shows "Your name" as an editable field, saved on Finish setup. `POST /auth/display-name` changes it later, and the reference app's Operator access panel has a "Your name" form (#193).
14
+
15
+ ## 0.2.42
16
+
17
+ - **`rer export` never exports the local copy under a hosted address.** `rer export --origin <hosted address>` used to ignore the address and export this computer's books, so an owner who believed the hosted books were saved could take them down and lose them. Now `--origin` or `--target remote` stops before anything runs (exit 2) and saves nothing. The message says this exports only the local copy and to keep the hosted install until its data is saved. It also names the command that exports each hosted database the checkout deployed, run with the Cloudflare credentials that deployed it: `npx wrangler d1 export <database> --remote --output exports/<database>.sql`. It lists the R2 buckets that command does not cover. A finished export's last line names the copy: "Exported the local copy to exports/x.rer (…)". RUN-LOCALLY.md now says to save the hosted data this way before `rer deploy --remove --yes` (#194).
18
+ - **`MAIL_FROM` takes a display name.** `rer deploy` accepts `MAIL_FROM=Your Business <billing@example.com>`, quoted or not, as well as a bare address. These are the forms the mail runtime sends from. An invalid sender names both accepted forms instead of only "missing or invalid: MAIL_FROM" (#194).
19
+ - **`rer dev --as <email>` names the people it takes.** An email that is no one in the local database no longer gets "Unknown dev persona". The message lists every persona with its email, and every invited or active person. It also says that someone added only to the app's own records can sign in once the app invites them, which sends no mail locally (#194).
20
+
3
21
  ## 0.2.41
4
22
 
5
23
  - **A run site's custom-domain readback waits for the domains to go live.** After `rer deploy --site` attaches its custom domains, it now polls the zone's Custom Domain list inside the deploy's readiness window until every hostname is listed on the site's Worker. The wait starts at 2 seconds and doubles up to 10 seconds. A hostname already on another Worker is still refused at once. A hostname still missing when the window ends fails as `domain-readback-mismatch` and names it. Before, the deploy read the list once, so a new zone's normal lag failed a deploy that would have gone live (#183).
package/global/README.md CHANGED
@@ -14,10 +14,10 @@ rer dev just-every/run-inkwell
14
14
  ```
15
15
 
16
16
  The installer needs no Node: without Node 22 or later on PATH it installs a
17
- private one for `rer` (see below). It edits no shell profile, so when
18
- `~/.local/bin` is not on PATH, run the `export PATH=…` line it prints before
19
- `rer dev`. Its last line names that next command. The same start also fits on
20
- one line:
17
+ private one for `rer` (see below). It edits no shell profile: it names the next
18
+ command, `rer dev <owner>/<repo>`, and when `~/.local/bin` is not on PATH for new
19
+ terminals its last line is the one to run first, which adds it for your shell.
20
+ The same start also fits on one line:
21
21
 
22
22
  ```sh
23
23
  curl -fsSL https://runeditrun.com/install.sh | sh -s -- dev just-every/run-inkwell
@@ -57,16 +57,19 @@ verifies the tarball against that release's published `SHASUMS256.txt`, and
57
57
  prints its location. The launcher uses this private runtime on later runs.
58
58
  System Node and other PATH directories are left alone: the private runtime's
59
59
  `node`, `npm` and `npx` are not put on PATH, because `rer` is the one command
60
- the installer provides. With no arguments the script ends by naming the next
61
- command, `rer dev <owner>/<repo>`.
60
+ the installer provides. With no arguments the script names the next command,
61
+ `rer dev <owner>/<repo>`, and ends with the PATH line below when one is needed.
62
62
 
63
63
  No installer edits shell profiles. The canonical launcher is `~/.local/bin/rer`.
64
64
  Installation creates that directory if needed and never writes into another
65
65
  PATH directory. It names any existing `rer` elsewhere on PATH and leaves it
66
- unchanged. If `~/.local/bin` is absent from PATH or another command shadows it,
67
- it prints one activation line to run in the current shell:
68
- `export PATH="$HOME/.local/bin:$PATH"` (with fish syntax for fish). Without a
69
- private runtime, the launcher uses `node` from PATH. A re-run with the same build changes
66
+ unchanged. If `~/.local/bin` is absent from PATH, another command shadows it,
67
+ or no startup file of your shell adds it for new terminals, its last line is
68
+ one command to run: it appends `export PATH="$HOME/.local/bin:$PATH"` to that
69
+ startup file (`~/.zshrc` for zsh; `~/.bash_profile` for bash on macOS and
70
+ `~/.bashrc` elsewhere; `~/.profile` otherwise) and runs it in the current shell.
71
+ For fish it is `fish_add_path ~/.local/bin`. Without a private runtime, the
72
+ launcher uses `node` from PATH. A re-run with the same build changes
70
73
  nothing; a different build is installed beside the current one, the previous one
71
74
  is kept and older ones are removed. It refuses to replace a `~/.local/bin/rer`
72
75
  that it did not write.
@@ -88,11 +91,14 @@ install in place.
88
91
  - For `install.sh`: `curl`, `tar`, and `shasum` or `sha256sum` when it installs
89
92
  Node. macOS includes these tools.
90
93
  - For the npm/npx install alternatives: Node 22 or later on PATH.
91
- - Checkout commands acquire the checkout's pinned Node and pnpm when needed.
92
- `rer install` also downloads the checkout's Playwright Chromium and headless
93
- shell for verification; `rer verify` installs missing browser files on first
94
- need. Downloads print progress. `rer doctor` reports a missing browser and
95
- directs you to `rer install`, without downloading anything itself.
94
+ - Checkout commands acquire the checkout's pinned Node and pnpm when needed,
95
+ in rer's own cache: neither goes on PATH. `rer run SCRIPT [ARGS]` runs a
96
+ package.json script with them, so a project's `pnpm run X -- ARGS` is
97
+ `rer run X -- ARGS`. `rer install` downloads no browser: the checkout's
98
+ Playwright Chromium and headless shell download the first time a command needs
99
+ them (`rer verify`, or `rer run` of a script that runs Playwright). Downloads
100
+ print progress. `rer doctor` lists browsers not downloaded yet, without
101
+ counting them as a problem or downloading anything itself.
96
102
 
97
103
  Not supported: native Windows (`install.sh` and `rer` say to use WSL2), and
98
104
  `OPERATIONS.json` version 1 projects.
@@ -39,6 +39,13 @@ async function writeLauncher(paths) {
39
39
  await rename(temporary, paths.launcher);
40
40
  }
41
41
 
42
+ // The next step, then (when needed) the exact line that puts rer on PATH, last.
43
+ // install.sh running a command itself, and rer update, set RER_INSTALL_NO_NEXT.
44
+ async function closing(paths) {
45
+ const advice = await pathAdvice(paths);
46
+ return `${process.env.RER_INSTALL_NO_NEXT ? '' : 'Next, start an app: rer dev <owner>/<repo>\n'}${advice ? advice + '\n' : ''}`;
47
+ }
48
+
42
49
  export async function install({ quiet = false } = {}) {
43
50
  const paths = layout(), manifest = ownManifest(), digest = await packageDigest(ownRoot);
44
51
  const name = `${manifest.version}-${digest.slice(0, 8)}`, channel = process.env.RER_INSTALL_CHANNEL === 'script' ? 'script' : 'npx';
@@ -52,8 +59,7 @@ export async function install({ quiet = false } = {}) {
52
59
  let present = false;
53
60
  try { present = await packageDigest(join(paths.versions, name)) === digest; } catch (error) { if (error.code !== 'ENOENT') throw error; }
54
61
  if (present && current === join('versions', name) && launcher.text === script && record?.channel === channel) {
55
- const advice = await pathAdvice(paths);
56
- if (!quiet) process.stdout.write(`rer ${manifest.version} is already current (${join(paths.versions, name)}). Nothing changed.\n${advice ? advice + '\n' : ''}`);
62
+ if (!quiet) process.stdout.write(`rer ${manifest.version} is already current (${join(paths.versions, name)}). Nothing changed.\n${await closing(paths)}`);
57
63
  return 0;
58
64
  }
59
65
  if (!present) { await rm(join(paths.versions, name), { recursive: true, force: true }); await copyVersion(paths, name); }
@@ -66,7 +72,6 @@ export async function install({ quiet = false } = {}) {
66
72
  for (const entry of await readdir(paths.versions)) if (!keep.has(entry) && !entry.startsWith('.staging-')) await rm(join(paths.versions, entry), { recursive: true, force: true });
67
73
  await writeFile(paths.record, JSON.stringify({ channel, links: record?.links ?? [], previous: previousName && keep.has(previousName) ? previousName : null }, null, 2) + '\n', { mode: 0o644 });
68
74
  if (launcher.text !== script) await writeLauncher(paths);
69
- const advice = await pathAdvice(paths);
70
- if (!quiet) process.stdout.write(`Installed rer ${manifest.version} in ${join(paths.versions, name)}.\n${paths.launcher} runs it.${previousName ? ` The previous version (${previousName}) is kept.` : ''}\n${advice ? advice + '\n' : ''}`);
75
+ if (!quiet) process.stdout.write(`Installed rer ${manifest.version} in ${join(paths.versions, name)}.\n${paths.launcher} runs it.${previousName ? ` The previous version (${previousName}) is kept.` : ''}\n${await closing(paths)}`);
71
76
  return 0;
72
77
  }