@runeditrun/rer 0.2.120 → 0.2.122
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/README.md +173 -5
- package/cli/archive.mjs +1 -1
- package/cli/authoring.mjs +1 -1
- package/cli/browser-runtime.mjs +33 -18
- package/cli/business/agent-help.mjs +11 -11
- package/cli/business/agent-verbs.mjs +9 -8
- package/cli/business/api.mjs +11 -7
- package/cli/business/carry.mjs +4 -3
- package/cli/business/choices.mjs +1 -1
- package/cli/business/command.mjs +33 -11
- package/cli/business/connect.mjs +4 -4
- package/cli/business/credential-file.mjs +102 -0
- package/cli/business/errors.mjs +5 -2
- package/cli/business/invocation.mjs +7 -4
- package/cli/business/keychain.mjs +6 -2
- package/cli/business/local-commands.mjs +9 -3
- package/cli/business/mcp-bridge.mjs +2 -1
- package/cli/business/questions.mjs +1 -1
- package/cli/business/run-child.mjs +5 -5
- package/cli/business/run-grant.mjs +27 -8
- package/cli/business/run-mask.mjs +8 -1
- package/cli/business/scan-command.mjs +1 -1
- package/cli/business/service.mjs +4 -2
- package/cli/business/state.mjs +2 -2
- package/cli/checkout-folders.mjs +1 -1
- package/cli/checkout-preparation.mjs +4 -4
- package/cli/command-guidance.mjs +9 -0
- package/cli/companion/command.mjs +4 -3
- package/cli/companion/providers/sandbox.mjs +1 -1
- package/cli/companion/setup.mjs +4 -4
- package/cli/contract.mjs +8 -8
- package/cli/demo.mjs +1 -1
- package/cli/deploy-command.mjs +10 -5
- package/cli/deploy-hook.mjs +3 -2
- package/cli/deploy-inputs.mjs +20 -3
- package/cli/deploy-owner-input.mjs +2 -2
- package/cli/deploy-settings.mjs +14 -0
- package/cli/deploy-source.mjs +1 -1
- package/cli/deploy-variables.mjs +7 -1
- package/cli/deploy.mjs +6 -4
- package/cli/deployment-record.mjs +1 -1
- package/cli/dev-identity.mjs +4 -4
- package/cli/door-clauses.mjs +2 -2
- package/cli/door-mode.mjs +7 -7
- package/cli/door.mjs +7 -7
- package/cli/errors.mjs +15 -1
- package/cli/export-summary.mjs +1 -1
- package/cli/export.mjs +1 -1
- package/cli/hosted-export.mjs +1 -1
- package/cli/hosted-output.mjs +2 -2
- package/cli/human-error.mjs +8 -2
- package/cli/hydration/browser.mjs +1 -1
- package/cli/hydration/check.mjs +1 -1
- package/cli/import-summary.mjs +2 -2
- package/cli/inspect.mjs +9 -4
- package/cli/lifecycle.mjs +10 -10
- package/cli/listen.mjs +1 -1
- package/cli/listing.mjs +1 -1
- package/cli/local-env.mjs +1 -1
- package/cli/local.mjs +4 -4
- package/cli/managed-server.mjs +36 -13
- package/cli/output.mjs +2 -1
- package/cli/owner-entry-ready.mjs +92 -0
- package/cli/parse.mjs +19 -9
- package/cli/port.mjs +3 -3
- package/cli/portability-runtime.mjs +16 -0
- package/cli/portability.mjs +4 -4
- package/cli/production-auth.mjs +4 -2
- package/cli/production-mail.mjs +1 -1
- package/cli/project.mjs +2 -0
- package/cli/rehearse/options.mjs +3 -3
- package/cli/release-candidate.mjs +2 -2
- package/cli/release.mjs +5 -5
- package/cli/server-registry.mjs +3 -3
- package/cli/server-resources.mjs +1 -1
- package/cli/setup-input.mjs +6 -6
- package/cli/signin.mjs +11 -10
- package/cli/site-render.mjs +1 -1
- package/cli/size/schema.mjs +1 -1
- package/cli/size/verify-step.mjs +1 -1
- package/cli/transfers.mjs +4 -4
- package/edition-authoring/api-source.mjs +121 -0
- package/edition-authoring/archive-source.mjs +1 -86
- package/edition-authoring/base-copies.mjs +5 -3
- package/global/CHANGELOG.md +47 -0
- package/global/browser-runtime.mjs +9 -5
- package/global/cli/command.mjs +6 -5
- package/global/cli/install.mjs +6 -3
- package/global/cli/path-link.mjs +11 -22
- package/global/cli/repo-command.mjs +4 -3
- package/global/cli/repository-contract.mjs +3 -3
- package/global/door/command.mjs +39 -38
- package/global/door/control.mjs +3 -3
- package/global/door/pages.mjs +6 -5
- package/global/door/server.mjs +8 -5
- package/global/door/sites.mjs +14 -13
- package/global/launch/capacity.mjs +2 -2
- package/global/launch/dev.mjs +6 -6
- package/global/launch/door.mjs +1 -1
- package/global/launch/facts.mjs +2 -2
- package/global/launch/failure.mjs +1 -1
- package/global/launch/prepare.mjs +3 -3
- package/global/launch/render.mjs +3 -2
- package/global/launch/worker.mjs +1 -1
- package/global/list.mjs +4 -4
- package/global/main.mjs +32 -31
- package/global/registry.mjs +1 -1
- package/global/run.mjs +5 -5
- package/global/update/command.mjs +5 -5
- package/global/update/notice.mjs +1 -1
- package/global/version.mjs +1 -1
- package/install.sh +17 -4
- package/modules/deploy-kit/README.md +11 -3
- package/modules/deploy-kit/asset-health.mjs +6 -4
- package/modules/deploy-kit/cancellation.mjs +26 -0
- package/modules/deploy-kit/d1-import-diagnostics.mjs +3 -2
- package/modules/deploy-kit/deploy.mjs +8 -3
- package/modules/deploy-kit/diagnostics.mjs +11 -4
- package/modules/deploy-kit/health-request.mjs +16 -9
- package/modules/deploy-kit/health.mjs +14 -11
- package/modules/deploy-kit/owner-cli.mjs +55 -25
- package/modules/deploy-kit/owner-remove.mjs +7 -6
- package/modules/deploy-kit/owner-secret-copy.mjs +2 -1
- package/modules/deploy-kit/owner-secret.mjs +8 -5
- package/modules/deploy-kit/owner.mjs +49 -30
- package/modules/deploy-kit/provider-transport.mjs +2 -0
- package/modules/deploy-kit/provider.mjs +10 -9
- package/modules/deploy-kit/readiness-window.mjs +5 -3
- package/modules/deploy-kit/site.mjs +1 -1
- package/modules/deploy-kit/teardown.mjs +5 -4
- package/modules/deploy-kit/validation.mjs +1 -0
- package/modules/deploy-kit/worker.mjs +1 -0
- package/modules/operator-auth/dev/index.mjs +4 -3
- package/modules/operator-auth/dev/sign-in-as.mjs +2 -1
- package/modules/operator-auth/dev-gate.mjs +3 -2
- package/modules/operator-auth/routes.mjs +2 -1
- package/modules/operator-auth/terminal-guidance.mjs +3 -0
- package/onboarding/adapter-settings.mjs +1 -0
- package/onboarding/adapter.mjs +3 -3
- package/onboarding/agent-handoff.mjs +1 -1
- package/onboarding/busy.mjs +1 -1
- package/onboarding/launcher.mjs +1 -1
- package/onboarding/local/environment.mjs +1 -1
- package/onboarding/local/operation.mjs +12 -4
- package/onboarding/local/owner.mjs +2 -2
- package/onboarding/operator-installer.mjs +4 -3
- package/onboarding/operator-migrations.mjs +1 -1
- package/onboarding/operator-prerequisites.mjs +26 -14
- package/onboarding/operator-settings.mjs +28 -0
- package/onboarding/process-diagnostics.mjs +2 -2
- package/onboarding/project-vite.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { withCommandHelp } from '../command-guidance.mjs';
|
|
1
2
|
import { homedir } from 'node:os';
|
|
2
3
|
import { resolve, join } from 'node:path';
|
|
3
4
|
import { open, unlink } from 'node:fs/promises';
|
|
@@ -7,7 +8,7 @@ import { codexAuth, claudeAuth } from './auth.mjs';
|
|
|
7
8
|
import { assertSandboxPlatform } from './providers/sandbox.mjs';
|
|
8
9
|
import { appSignInHelp } from '../app-address.mjs';
|
|
9
10
|
|
|
10
|
-
export const usage = `Usage: rer companion VERB
|
|
11
|
+
export const usage = `Usage: ~/.local/bin/rer companion VERB
|
|
11
12
|
Pairs this computer with a Run Edit Run app, then runs the app's change
|
|
12
13
|
requests here with your own Codex or Claude, in isolated checkouts. It makes
|
|
13
14
|
outbound HTTPS requests only and opens no local server. Needs Node 22 or later;
|
|
@@ -15,7 +16,7 @@ run needs macOS (sandbox-exec), and refuses on other systems.
|
|
|
15
16
|
|
|
16
17
|
map PROJECT_ID OWNER/REPO CHECKOUT
|
|
17
18
|
Approve one local Git checkout for an app; its origin must be OWNER/REPO.
|
|
18
|
-
${pairUsage.replace('rer companion ', '')}
|
|
19
|
+
${pairUsage.replace('~/.local/bin/rer companion ', '')}
|
|
19
20
|
Redeem the one-use code from the app's Devices page. Asks for a
|
|
20
21
|
missing project or provider in a terminal (default provider codex).
|
|
21
22
|
The legacy form pair URL CODE PROJECT_ID [PROVIDER] [NAME] still works.
|
|
@@ -71,5 +72,5 @@ export async function companionCommand(argv) {
|
|
|
71
72
|
console.log(JSON.stringify({device:state.device,projects:Object.keys(state.mappings),active:state.active?{job:state.active.job.id,status:state.active.status,identity:state.active.identity}:null,pendingEvents:state.outbox.length},null,2));
|
|
72
73
|
} else { process.stderr.write(usage); return 2; }
|
|
73
74
|
return 0;
|
|
74
|
-
} catch(error) {process.stderr.write(
|
|
75
|
+
} catch(error) {process.stderr.write(withCommandHelp(error.message) + '\n');return 1;}
|
|
75
76
|
}
|
|
@@ -12,7 +12,7 @@ function executable(name, env, cwd) {
|
|
|
12
12
|
// Do not replace this with a provider workspace-write setting (which permits global reads).
|
|
13
13
|
// Other platforms refuse before any job is claimed; nothing runs unconfined.
|
|
14
14
|
export function assertSandboxPlatform() {
|
|
15
|
-
if (process.platform !== 'darwin' || !existsSync('/usr/bin/sandbox-exec')) throw new Error('Local engineering requires the supported macOS sandbox-exec boundary. rer companion run works only on macOS; it never runs a provider without that boundary.');
|
|
15
|
+
if (process.platform !== 'darwin' || !existsSync('/usr/bin/sandbox-exec')) throw new Error('Local engineering requires the supported macOS sandbox-exec boundary. ~/.local/bin/rer companion run works only on macOS; it never runs a provider without that boundary.');
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export function sandboxCommand(provider, cwd, env) {
|
package/cli/companion/setup.mjs
CHANGED
|
@@ -5,11 +5,11 @@ import { Api } from './api.mjs';
|
|
|
5
5
|
import { validateCommands } from './commands.mjs';
|
|
6
6
|
import { git } from './workspace.mjs';
|
|
7
7
|
|
|
8
|
-
export const pairUsage = 'rer companion pair URL CODE [--project PROJECT_ID] [--provider codex|claude] [--name NAME]';
|
|
8
|
+
export const pairUsage = '~/.local/bin/rer companion pair URL CODE [--project PROJECT_ID] [--provider codex|claude] [--name NAME]';
|
|
9
9
|
|
|
10
10
|
// A project maps to one checkout whose origin is exactly the named repository.
|
|
11
11
|
async function mapProject(root,state,projectId,repository,path) {
|
|
12
|
-
if(!projectId||!repository||!path) throw new Error('Usage: rer companion map PROJECT_ID OWNER/REPO CHECKOUT');
|
|
12
|
+
if(!projectId||!repository||!path) throw new Error('Usage: ~/.local/bin/rer companion map PROJECT_ID OWNER/REPO CHECKOUT');
|
|
13
13
|
const checkout=await realpath(path);const remote=await git(checkout,'remote','get-url','origin');
|
|
14
14
|
if(![ `https://github.com/${repository}.git`,`https://github.com/${repository}`,`git@github.com:${repository}.git`].includes(remote)) throw new Error('Repository identity and checkout origin differ.');
|
|
15
15
|
state.mappings[projectId]={repository,checkout,remote};await saveState(root,state);console.log(`Approved ${projectId}: ${repository} at ${checkout}`);
|
|
@@ -53,7 +53,7 @@ export async function pair(root,state,args) {
|
|
|
53
53
|
let projectId=options.project;const mapped=Object.keys(state.mappings);
|
|
54
54
|
if(!projectId&&mapped.length===1)projectId=mapped[0];
|
|
55
55
|
if(!projectId&&terminal)projectId=await ask(terminal,mapped.length?`Project ID (${mapped.join(', ')}): `:'Project ID (the app id in its Devices page command): ');
|
|
56
|
-
if(!projectId)throw new Error(mapped.length?`Several projects are mapped. Run ${pairUsage} with --project.`:'Map the checkout locally before pairing: rer companion map PROJECT_ID OWNER/REPO CHECKOUT');
|
|
56
|
+
if(!projectId)throw new Error(mapped.length?`Several projects are mapped. Run ${pairUsage} with --project.`:'Map the checkout locally before pairing: ~/.local/bin/rer companion map PROJECT_ID OWNER/REPO CHECKOUT');
|
|
57
57
|
if(!state.mappings[projectId]&&terminal) {
|
|
58
58
|
console.log('Approve the local Git checkout this app may change.');
|
|
59
59
|
await mapProject(root,state,projectId,await ask(terminal,'Repository (OWNER/REPO): '),await ask(terminal,'Checkout folder: '));
|
|
@@ -66,6 +66,6 @@ export async function pair(root,state,args) {
|
|
|
66
66
|
if(paired.repository!==state.mappings[projectId].repository) throw new Error('Paired installation repository differs from local mapping. Revoke this device.');
|
|
67
67
|
Object.assign(state,{server:options.server,token:paired.token,device:paired.device,provider});await saveState(root,state);
|
|
68
68
|
console.log(`Paired device ${paired.device.id} to ${paired.repository}. Selected requests and provider progress are relayed to RER; provider credentials stay here.`);
|
|
69
|
-
console.log(`Next: rer companion ${provider}-auth, then rer companion run.`);
|
|
69
|
+
console.log(`Next: ~/.local/bin/rer companion ${provider}-auth, then ~/.local/bin/rer companion run.`);
|
|
70
70
|
} finally { terminal?.close(); }
|
|
71
71
|
}
|
package/cli/contract.mjs
CHANGED
|
@@ -5,15 +5,15 @@ export const serverDefaults = Object.freeze({ serverLimit: 10, idleSeconds: 4320
|
|
|
5
5
|
export const commonFlags = ['--help', '--cwd', '--non-interactive', '--json'];
|
|
6
6
|
const definitions = {
|
|
7
7
|
install: [[], 'Frozen dependency installation; no setup or global tool changes.'],
|
|
8
|
-
setup: [['--owner-email', '--owner-name', '--port', '--host', '--answers', '--door'], 'Build, migrate, prepare private settings and first owner; stop the temporary app. Next, rer dev opens the owner persona; rer preview offers single-use native owner entry on loopback, and rer demo also offers that native entry alongside its persona. --door sets a fresh checkout up at its front-door origin http://NAME.localhost:PORT (after rer door enable).'],
|
|
9
|
-
dev: [['--port', '--host', '--idle-timeout', '--stop', '--detach', '--foreground', '--as', '--login', '--models', '--models-service', '--door', '--direct', '--demo'], 'Development with assets, HMR and the declared scheduled triggers run locally on their schedule. --detach returns once ready; --foreground keeps this command serving. With devIdentity it opens signed in as the owner; --as PERSONA or --as EMAIL picks a persona or an invited/active person. The legacy --login flag is accepted and uses the same automatic sign-in. --door moves this checkout to its front-door origin http://NAME.localhost:PORT, keeping its data; --direct moves it back; --port and --host serve directly. --demo (or rer demo) serves a throwaway demo: fresh data in .rer/demo/START (deleted when it stops: --stop, Ctrl-C or its end, one hour by default or --idle-timeout), the saved owner signed in through the demo persona, a separate RER_OWNER_OPEN link for single-use native owner entry on loopback (15-minute expiry; never saved), the seed\'s demo data, Demo in the app name and title, real public reads/checks and simulated external writes (RER_DEMO=1; the checkout\'s own data is never touched).', 'launch'],
|
|
8
|
+
setup: [['--owner-email', '--owner-name', '--port', '--host', '--answers', '--door'], 'Build, migrate, prepare private settings and first owner; stop the temporary app. Next, ~/.local/bin/rer dev opens the owner persona; ~/.local/bin/rer preview offers single-use native owner entry on loopback, and ~/.local/bin/rer demo also offers that native entry alongside its persona. --door sets a fresh checkout up at its front-door origin http://NAME.localhost:PORT (after ~/.local/bin/rer door enable).'],
|
|
9
|
+
dev: [['--port', '--host', '--idle-timeout', '--stop', '--detach', '--foreground', '--as', '--login', '--models', '--models-service', '--door', '--direct', '--demo'], 'Development with assets, HMR and the declared scheduled triggers run locally on their schedule. --detach returns once ready; --foreground keeps this command serving. With devIdentity it opens signed in as the owner; --as PERSONA or --as EMAIL picks a persona or an invited/active person. The legacy --login flag is accepted and uses the same automatic sign-in. --door moves this checkout to its front-door origin http://NAME.localhost:PORT, keeping its data; --direct moves it back; --port and --host serve directly. --demo (or ~/.local/bin/rer demo) serves a throwaway demo: fresh data in .rer/demo/START (deleted when it stops: --stop, Ctrl-C or its end, one hour by default or --idle-timeout), the saved owner signed in through the demo persona, a separate RER_OWNER_OPEN link for single-use native owner entry on loopback (15-minute expiry; never saved), the seed\'s demo data, Demo in the app name and title, real public reads/checks and simulated external writes (RER_DEMO=1; the checkout\'s own data is never touched).', 'launch'],
|
|
10
10
|
preview: [['--port', '--host', '--idle-timeout', '--stop', '--detach', '--foreground'], 'Production output; --detach returns once ready, --foreground keeps this command serving. Reuse intact build, refresh changed assets, preserve owner/state, idle timeout and explicit stop. On loopback, seeds declaring devIdentity print a single-use native owner RER_OPEN link; it expires within 15 minutes and is not saved.'],
|
|
11
11
|
build: [['--site'], 'Production build with private local settings excluded and restored. --site instead writes the static run site (homepage, /run, docs) to its declared folder and prints that folder.'],
|
|
12
12
|
verify: [[], 'Run the complete internal verification target.'],
|
|
13
13
|
reset: [['--yes'], 'Confirmed removal of the declared local inventory only.'],
|
|
14
|
-
deploy: [['--owner-name', '--environment', '--dry-run', '--site', '--demo', '--host', '--env-file', '--image', '--bind-address', '--http-port', '--https-port', '--remove', '--yes', '--set-secret', '--unset-secret', '--rotate-secret', '--reopen-installation-key'], 'Owner-account deployment and health; dry run builds and validates the local deployment plan, printing target names, bindings and migration names. No Cloudflare credentials or requests are needed and nothing changes remotely. Valid fixture senders on .test, .example, .invalid, .localhost and example.com, example.net or example.org (including subdomains) are accepted only in a dry run; real deploys refuse placeholder senders. Dry run never prompts for or requires a missing owner name, saves no name and bypasses custom deploy hooks and their owner-email preflight. Target secrets, permissions and remote readiness are checked only by a real deploy. 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 saved setup owner name and the one-time setup token, then removes the token. For a real deploy, the managed adapter checks its hosted owner email before rer resolves the owner name, so its placeholder-email refusal comes first. If the installer declares an owner-name field and no name is saved, deploy asks once and saves it; --non-interactive requires --owner-name NAME before any upload. --set-secret NAME[,NAME] (each value from the environment or --env-file; repeat the flag or join names with commas) and --unset-secret NAME[,NAME] change those secrets of the deployed Worker without a build, all of them in one new Worker version or none, and record that version; a missing value refuses before any change. --reopen-installation-key KID temporarily binds a retired installation key from private custody, reseals restored dependency keys under the current key, verifies them and removes the previous binding. --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'], 'For owner move-in, run rer dev and open the app\'s signed-in Move in page (/app/import in the Base reference; the project\'s own docs name its path): export people there, then upload through the destination door. Developer-only installation backup: 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
|
-
import: [['--target', '--input', '--journal', '--origin', '--session-file', '--yes', '--legacy-v1', '--acknowledge-unverified-metadata', '--acknowledge-unverified-schema-objects', '--output'], 'For owner move-in, run rer dev and open the app\'s signed-in Move in page (/app/import in the Base reference; the project\'s own docs name its path): upload, review and apply through the door. Developer-only installation recovery: 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. A v2 archive without schemaObjects requires --acknowledge-unverified-schema-objects, an empty destination and compatible destination migration history; its receipt records schemaUnverified. A fresh export from current rer is preferred; current archives need no acknowledgment.'],
|
|
14
|
+
deploy: [['--owner-name', '--environment', '--dry-run', '--site', '--demo', '--host', '--env-file', '--image', '--bind-address', '--http-port', '--https-port', '--remove', '--yes', '--set-secret', '--unset-secret', '--rotate-secret', '--reopen-installation-key'], 'Owner-account deployment and health; dry run builds and validates the local deployment plan, printing target names, bindings and migration names. No Cloudflare credentials or requests are needed and nothing changes remotely. Valid fixture senders on .test, .example, .invalid, .localhost and example.com, example.net or example.org (including subdomains) are accepted only in a dry run; real deploys refuse placeholder senders. Dry run never prompts for or requires a missing owner name, saves no name and bypasses custom deploy hooks and their owner-email preflight. Target secrets, permissions and remote readiness are checked only by a real deploy. 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. If the caller already holds CLOUDFLARE_API_TOKEN, --env-file refuses any CLOUDFLARE_* or CF_* key before provider calls, naming the file and key without its value; without a caller token its usual precedence is unchanged. SIGTERM cancels provider requests and waits, releases the deployment lock, retains deployment state for resume and exits 143 (SIGINT: 130). 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 saved setup owner name and the one-time setup token, then removes the token. For a real deploy, the managed adapter checks its hosted owner email before rer resolves the owner name, so its placeholder-email refusal comes first. If the installer declares an owner-name field and no name is saved, deploy asks once and saves it; --non-interactive requires --owner-name NAME before any upload. --set-secret NAME[,NAME] (each value from the environment or --env-file; repeat the flag or join names with commas) and --unset-secret NAME[,NAME] change those secrets of the deployed Worker without a build, all of them in one new Worker version or none, and record that version; a missing value refuses before any change. --reopen-installation-key KID temporarily binds a retired installation key from private custody, reseals restored dependency keys under the current key, verifies them and removes the previous binding. --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'], 'For owner move-in, run ~/.local/bin/rer dev and open the app\'s signed-in Move in page (/app/import in the Base reference; the project\'s own docs name its path): export people there, then upload through the destination door. Developer-only installation backup: 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
|
+
import: [['--target', '--input', '--journal', '--origin', '--session-file', '--yes', '--legacy-v1', '--acknowledge-unverified-metadata', '--acknowledge-unverified-schema-objects', '--output'], 'For owner move-in, run ~/.local/bin/rer dev and open the app\'s signed-in Move in page (/app/import in the Base reference; the project\'s own docs name its path): upload, review and apply through the door. Developer-only installation recovery: 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. A v2 archive without schemaObjects requires --acknowledge-unverified-schema-objects, an empty destination and compatible destination migration history; its receipt records schemaUnverified. A fresh export from current rer is preferred; current archives need no acknowledgment.'],
|
|
17
17
|
doctor: [[], 'Read-only installed tool, configuration and state diagnostics.', 'never'],
|
|
18
18
|
describe: [[], 'Read-only description of actual command capabilities.'],
|
|
19
19
|
check: [['--profile'], 'Read-only structural command contract and operations validation.'],
|
|
@@ -21,19 +21,19 @@ const definitions = {
|
|
|
21
21
|
export const verbs = Object.fromEntries(Object.entries(definitions).map(([name, [flags, effects, bootstrap = 'before']]) => [name, { bootstrap, flags: [...commonFlags, ...flags, ...(['build','deploy','dev','preview','export','import'].includes(name)?['--platform']:[]), ...(['install','setup','dev','preview','build','verify','deploy','export','import'].includes(name)?['--no-queue']:[])], effects }]));
|
|
22
22
|
// `rer demo` is `rer dev --demo`; describe lists it as a verb with the dev
|
|
23
23
|
// flags a demo takes whenever the seed's dev takes --demo.
|
|
24
|
-
export const demoVerb = Object.freeze({ bootstrap: 'before', flags: [...commonFlags, '--port', '--host', '--idle-timeout', '--stop', '--detach', '--foreground', '--no-queue'], effects: 'A throwaway demo of this seed (rer dev --demo): fresh data in .rer/demo/START (deleted when it stops: --stop, Ctrl-C or its end, one hour by default or --idle-timeout), the saved owner signed in through the demo persona, a separate RER_OWNER_OPEN link for single-use native owner entry on loopback (15-minute expiry; never saved), the seed\'s demo data, Demo in the app name and title, real public reads/checks and simulated external writes (RER_DEMO=1; the checkout\'s own data is never touched).' });
|
|
24
|
+
export const demoVerb = Object.freeze({ bootstrap: 'before', flags: [...commonFlags, '--port', '--host', '--idle-timeout', '--stop', '--detach', '--foreground', '--no-queue'], effects: 'A throwaway demo of this seed (~/.local/bin/rer dev --demo): fresh data in .rer/demo/START (deleted when it stops: --stop, Ctrl-C or its end, one hour by default or --idle-timeout), the saved owner signed in through the demo persona, a separate RER_OWNER_OPEN link for single-use native owner entry on loopback (15-minute expiry; never saved), the seed\'s demo data, Demo in the app name and title, real public reads/checks and simulated external writes (RER_DEMO=1; the checkout\'s own data is never touched).' });
|
|
25
25
|
// `rer signin` is rer's own, not a seed operation: any seed rer deploys, it can
|
|
26
26
|
// sign the owner in to, so no seed declares it and check does not ask for it.
|
|
27
27
|
export const signinVerb = Object.freeze({ bootstrap: 'before', flags: [...commonFlags, '--environment', '--env-file'], effects: 'A one-time sign-in link for the hosted owner, without mail. Uses the Cloudflare credentials that deployed --environment (default production; from the environment or --env-file) to write a single-use grant for the recorded owner into that deployment\'s auth database, then prints the link once to this terminal; it is never saved. The link works once, only for that owner, expires within 15 minutes, and its use is recorded in the owner\'s audit log. Signed in this way, the owner can correct a wrong email in settings.' });
|
|
28
28
|
// `rer size` is rer's own too, never in `definitions`: check would otherwise ask
|
|
29
29
|
// every seed to declare it. It reads a checkout's D1 migrations, or a
|
|
30
30
|
// statements file, and runs in first-party and independent checkouts alike.
|
|
31
|
-
export const sizeVerb = Object.freeze({ bootstrap: 'before', flags: [...commonFlags, '--statements', '--migrations', '--declaration', '--write-statements', '--no-queue'], effects: 'Statement size against D1\'s limits, measured in SQLite on this computer with no account or network. D1 refuses a statement at 100 FROM items, counted with every CTE and view reference expanded in place, or at expression depth 100, and local SQLite and Miniflare accept both; rer fails at 90 of either, a margin of 10 because D1 changed how it enforces them without notice on 10 Nov 2026. With no flags it checks every view and trigger statement of the build\'s D1 migrations (dist/server/wrangler.json). --migrations DIR checks the objects of that migrations directory instead of the build\'s. --statements FILE checks the statements of FILE ({"statements":[{"name","sql"}]}, the fleet runner\'s format) against that schema. Each failure is named with both numbers and the start of its SQL. Exit 1 if any statement fails, 0 if none, 3 with no build and no --migrations. --json lists every statement as {name, fromItems, depth, ok}. With a size-check.json at the checkout root (or --declaration FILE, a declaration kept outside it), rer then builds the declared shape at a small and a large size, each in its own disposable local D1 install served as the hosted check serves the build: the owner is signed in with the bootstrap agent-door conformance uses (the setup manifest\'s owner-claim step, else verification.owner), each table is generated inside D1 by chunked INSERT … SELECT so the schema\'s own triggers fire, and each declared table is read back. It prints, for each size and table, the declared count, the count read back and the time per phase; a generation error names the size, the table, the row range, SQLite\'s message and its column, exits 1 and prints no built line for that size. budget.timeoutSeconds bounds both sizes and a timeout names the phase. While it serves installs it takes verify\'s job-queue slot (--no-queue only in the original CI environment). Then the personas sign in and every declared flow runs on each size, small first, through a rows-read meter wrapped around the Worker\'s D1 bindings (fetch, scheduled, queue, Durable Objects and waitUntil work; queues are held and queue consumer work is not measured). A flow fails when it reads more rows at large than its ceiling, more at large than at small by over growthPercent of small plus growthRows (unless growth.allowed), answers the wrong status, has a statement refused or failed by local D1, or runs a statement at 90 FROM items or depth; each failure names its rule and the three statements that read the most rows at large. --json carries every flow at both sizes; --write-statements DIR writes small.json and large.json in the fleet runner\'s statements format. --statements runs the statement check alone. rer verify runs the schema-object check as its last step.' });
|
|
31
|
+
export const sizeVerb = Object.freeze({ bootstrap: 'before', flags: [...commonFlags, '--statements', '--migrations', '--declaration', '--write-statements', '--no-queue'], effects: 'Statement size against D1\'s limits, measured in SQLite on this computer with no account or network. D1 refuses a statement at 100 FROM items, counted with every CTE and view reference expanded in place, or at expression depth 100, and local SQLite and Miniflare accept both; rer fails at 90 of either, a margin of 10 because D1 changed how it enforces them without notice on 10 Nov 2026. With no flags it checks every view and trigger statement of the build\'s D1 migrations (dist/server/wrangler.json). --migrations DIR checks the objects of that migrations directory instead of the build\'s. --statements FILE checks the statements of FILE ({"statements":[{"name","sql"}]}, the fleet runner\'s format) against that schema. Each failure is named with both numbers and the start of its SQL. Exit 1 if any statement fails, 0 if none, 3 with no build and no --migrations. --json lists every statement as {name, fromItems, depth, ok}. With a size-check.json at the checkout root (or --declaration FILE, a declaration kept outside it), rer then builds the declared shape at a small and a large size, each in its own disposable local D1 install served as the hosted check serves the build: the owner is signed in with the bootstrap agent-door conformance uses (the setup manifest\'s owner-claim step, else verification.owner), each table is generated inside D1 by chunked INSERT … SELECT so the schema\'s own triggers fire, and each declared table is read back. It prints, for each size and table, the declared count, the count read back and the time per phase; a generation error names the size, the table, the row range, SQLite\'s message and its column, exits 1 and prints no built line for that size. budget.timeoutSeconds bounds both sizes and a timeout names the phase. While it serves installs it takes verify\'s job-queue slot (--no-queue only in the original CI environment). Then the personas sign in and every declared flow runs on each size, small first, through a rows-read meter wrapped around the Worker\'s D1 bindings (fetch, scheduled, queue, Durable Objects and waitUntil work; queues are held and queue consumer work is not measured). A flow fails when it reads more rows at large than its ceiling, more at large than at small by over growthPercent of small plus growthRows (unless growth.allowed), answers the wrong status, has a statement refused or failed by local D1, or runs a statement at 90 FROM items or depth; each failure names its rule and the three statements that read the most rows at large. --json carries every flow at both sizes; --write-statements DIR writes small.json and large.json in the fleet runner\'s statements format. --statements runs the statement check alone. ~/.local/bin/rer verify runs the schema-object check as its last step.' });
|
|
32
32
|
// Source-authoring commands belong to rer, not the seed adapter/OPERATIONS.
|
|
33
33
|
// Their project-package bootstrap uses the same contract as every checkout verb.
|
|
34
34
|
export const authoringVerbs = Object.freeze({
|
|
35
35
|
'adopt-edition': {bootstrap: 'before', flags: [...commonFlags], effects: 'Add edition.json and sources.lock.json for the existing tracked local source, preserving declared project identity and existing copy/composition records. Create an empty base-copies.json only when none exists. Review and stage the new authoring inputs; no source regeneration, install setup or commit.'},
|
|
36
|
-
'refresh-base': {bootstrap: 'before', flags: [...commonFlags, '--ref', '--base', '--base-archive', '--from-api', '--record', '--offline', '--edition-migration'], effects: 'Consent to each declared edition edit with repeatable --edition-migration ID; refresh leaves the edit owed. Refresh recorded Base copies to --ref FULL_COMMIT, preserving acknowledged adaptations and applied migrations; announce removed singleton retirement. Deliver invoked workflow helpers atomically; adopt tracked known historical Verify templates and preserve divergent workflows with adoption notices. Acquire committed source from the declared Base repository (default https://github.com/runeditrun/base.git), or
|
|
36
|
+
'refresh-base': {bootstrap: 'before', flags: [...commonFlags, '--ref', '--base', '--base-archive', '--from-api', '--record', '--offline', '--edition-migration'], effects: 'Consent to each declared edition edit with repeatable --edition-migration ID; refresh leaves the edit owed. Refresh recorded Base copies to --ref FULL_COMMIT, preserving acknowledged adaptations and applied migrations; announce removed singleton retirement. Deliver invoked workflow helpers atomically; adopt tracked known historical Verify templates and preserve divergent workflows with adoption notices. Acquire committed source from the declared Base repository (default https://github.com/runeditrun/base.git), or acquire immutable trees, blobs and ancestry over Git HTTPS with --from-api (at most 0 GitHub REST calls, measured at the process edge), or use --base CHECKOUT (a blobless clone spends no REST calls) or --base-archive DIRECTORY with --ref FULL_COMMIT for an exported source tree. --offline requires --base or --base-archive and never acquires remote source. Refuse incomplete Git checkouts without changing their records. Review the diff and run edition tests before committing.'},
|
|
37
37
|
});
|
|
38
38
|
export const aliases = Object.fromEntries([...Object.keys(verbs).filter(v => v !== 'install'), 'release', 'deps', 'rer'].map(name => [name, name === 'deps' ? 'install' : name === 'rer' ? null : name]));
|
|
39
39
|
export const releaseFlags = ['--repo', '--project', '--repository', '--output', '--ref', '--public-base', '--dry-run', '--local-verify', '--verify-workflow', '--scan-timeout-seconds', '--tag', '--clean-history', '--onto', '--env-file', '--allow-placeholder-mark', '--no-queue'];
|
package/cli/demo.mjs
CHANGED
|
@@ -16,7 +16,7 @@ const adopt = 'See DEMO.md: a seed adopts demo mode with src/demo.ts, withDemo a
|
|
|
16
16
|
// Check only saved configuration here; migrations and owner bootstrap are
|
|
17
17
|
// verified by starting the application against its fresh demo state.
|
|
18
18
|
export async function demoPreflight(project, vars, seconds) {
|
|
19
|
-
if (requiredLocalSettings(project, vars).length) throw missing('Private owner settings are missing. Run rer setup first.');
|
|
19
|
+
if (requiredLocalSettings(project, vars).length) throw missing('Private owner settings are missing. Run ~/.local/bin/rer setup first.');
|
|
20
20
|
await demoAdopted(project.root);
|
|
21
21
|
const declaration = JSON.parse(await readFile(await contained(project.root, 'deploy-demo.json'), 'utf8'));
|
|
22
22
|
const resolved = await demoRunDeclaration(declaration, {root: project.root, adapter: project.adapter});
|
package/cli/deploy-command.mjs
CHANGED
|
@@ -15,10 +15,10 @@ import { observeOwner, ownerExchangeFailure } from './deploy-observation.mjs';
|
|
|
15
15
|
import { committedSource } from './deploy-source.mjs';
|
|
16
16
|
import { hookOrigin, waitForSource } from './deploy-hook.mjs';
|
|
17
17
|
import { rememberHookState, hookState } from './deploy-hook-record.mjs';
|
|
18
|
-
import { main as owner, withLocalDeployPlan } from '../modules/deploy-kit/owner-cli.mjs';
|
|
18
|
+
import { main as owner, withLocalDeployPlan, withOwnerDeploySignal } from '../modules/deploy-kit/owner-cli.mjs';
|
|
19
19
|
import { localOnlyBinding, ownerWorkerName } from '../modules/deploy-kit/owner.mjs';
|
|
20
20
|
import { refuseLocalModels } from '../modules/deploy-kit/local-only.mjs';
|
|
21
|
-
import { deployDiagnostic, migrationFailure, providerFailure, assetFailure } from '../modules/deploy-kit/diagnostics.mjs';
|
|
21
|
+
import { deployDiagnostic, migrationFailure, providerFailure, assetFailure, ownerTargetFailure } from '../modules/deploy-kit/diagnostics.mjs';
|
|
22
22
|
import { shared } from './shared.mjs';
|
|
23
23
|
import { settingKinds } from './deploy-settings.mjs';
|
|
24
24
|
import { deployGuide, neededForRealDeploy, reportNeeded } from './deploy-needs.mjs';
|
|
@@ -64,7 +64,11 @@ export async function hostedDeployNeeds(project) {
|
|
|
64
64
|
return neededForRealDeploy({ declaration, env, signIn });
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
export
|
|
67
|
+
export function deployCommand(context) {
|
|
68
|
+
return withOwnerDeploySignal(context.signal, () => deployScoped(context));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
async function deployScoped(context) {
|
|
68
72
|
const { adapter, root, options, store, setupManifest, linkDependencies, localOnlyKeys = [] } = context;
|
|
69
73
|
validateDeployOptions(options);
|
|
70
74
|
try { await refuseLocalModels(root); } catch { throw refuse('Deploy refuses the local-only key file .rer/local/models.json. Remove live-dev credentials before deployment.'); }
|
|
@@ -136,7 +140,7 @@ export async function deployCommand(context) {
|
|
|
136
140
|
// A hook keeping the kit's record in its own state file named it; every kit
|
|
137
141
|
// step after the hook (inspect, secret, record-owner) reads that record.
|
|
138
142
|
let hookRecord = await hookState(root, environment);
|
|
139
|
-
const command = async (verb, extra = [], values = env, more = {}) => owner([verb, '--declaration', path, '--environment', environment, ...(hookRecord ? ['--state', hookRecord] : []), ...(['dry-run', 'local-plan', 'deploy', 'health'].includes(verb) ? await deployProductArguments(root, productDirectory) : []), ...extra], values, { cwd: root, localOnlyKeys, ...more });
|
|
143
|
+
const command = async (verb, extra = [], values = env, more = {}) => owner([verb, '--declaration', path, '--environment', environment, ...(hookRecord ? ['--state', hookRecord] : []), ...(['dry-run', 'local-plan', 'deploy', 'health'].includes(verb) ? await deployProductArguments(root, productDirectory) : []), ...extra], values, { cwd: root, localOnlyKeys, signal: context.signal, ...more });
|
|
140
144
|
// A hook that deployed through the kit's standard record lets rer issue and
|
|
141
145
|
// retire the setup token; a hook keeping an unnamed record of its own keeps its token.
|
|
142
146
|
let recorded, hookReturned = false;
|
|
@@ -183,7 +187,7 @@ export async function deployCommand(context) {
|
|
|
183
187
|
if (claims.some(item => !item.outcome)) { const error = new Error('owner-claim-failed'); error.ownerExchange = claims.find(item => !item.outcome); throw error; }
|
|
184
188
|
claimed = claims.at(-1)?.outcome;
|
|
185
189
|
step = 'wait for the deployed source';
|
|
186
|
-
await waitForSource({ origin, sourceSha, versionId: state?.versionId ?? (!claims.length && !deployed.owner ? uploaded?.versionId : undefined), again: deployAgain(options) });
|
|
190
|
+
await waitForSource({ origin, sourceSha, signal: context.signal, versionId: state?.versionId ?? (!claims.length && !deployed.owner ? uploaded?.versionId : undefined), again: deployAgain(options) });
|
|
187
191
|
step = 'claim owner';
|
|
188
192
|
if (typeof deployed.setupToken === 'string' && deployed.setupToken) addSecret(deployed.setupToken);
|
|
189
193
|
const sentSecrets = (uploaded?.sentSecrets ?? []).filter(binding => uploaded.propagation.matchesToken(binding, env[declaration.secrets.find(item => item.binding === binding)?.environment]));
|
|
@@ -201,6 +205,7 @@ export async function deployCommand(context) {
|
|
|
201
205
|
if (error instanceof DeployProductError) throw error;
|
|
202
206
|
const again = deployAgain(options);
|
|
203
207
|
const { commandFailure } = await shared('failures.mjs');
|
|
208
|
+
if (ownerTargetFailure(error)) throw commandFailure(redaction.redact(ownerTargetFailure(error)));
|
|
204
209
|
const secrets = secretFailureMessage(error);
|
|
205
210
|
if (secrets) throw commandFailure(secrets);
|
|
206
211
|
if (options.dryRun && error.message === 'missing-input') throw new RerError('missing_input', `Dry run cannot read the target secret bindings without ${error.inputs.join(' and ')}. Set the Cloudflare credentials in the environment or an owned 0600 --env-file, then run the same command again.`, 3);
|
package/cli/deploy-hook.mjs
CHANGED
|
@@ -12,13 +12,14 @@ export function hookOrigin(deployed, again) {
|
|
|
12
12
|
throw hookFailure(`The deploy hook finished without reporting a live deployment, so rer claimed no owner. A deploy hook returns { deployed: true, origin } once its upload is live. Check the hook's output above, fix the hook, then run ${again} again.`);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export async function waitForSource({ origin, sourceSha, versionId, again }) {
|
|
15
|
+
export async function waitForSource({ origin, sourceSha, versionId, again, signal }) {
|
|
16
16
|
// Finalization gets its own 90 seconds after the hook returns: upload, owner
|
|
17
17
|
// claim and token retirement may have consumed the upload readiness window.
|
|
18
18
|
// Retirement also creates a new version; use the current recorded identity.
|
|
19
|
-
try { await waitHealth({ origin, expected: { sourceSha, ...(versionId ? { versionId } : {}) }, retryIdentityMismatch: true,
|
|
19
|
+
try { await waitHealth({ origin, signal, expected: { sourceSha, ...(versionId ? { versionId } : {}) }, retryIdentityMismatch: true,
|
|
20
20
|
request: (url, init) => globalThis.fetch(url, init) }); }
|
|
21
21
|
catch (error) {
|
|
22
|
+
signal?.throwIfAborted();
|
|
22
23
|
const last = error.attempts?.at(-1);
|
|
23
24
|
let named, version;
|
|
24
25
|
try { const identity = JSON.parse(last.body).deployment; named = identity?.sourceSha; version = identity?.versionId; } catch {}
|
package/cli/deploy-inputs.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { shared } from './shared.mjs';
|
|
|
4
4
|
import { invalid, refuse } from './errors.mjs';
|
|
5
5
|
import { readDeployEnvFile } from '../modules/deploy-kit/env-file.mjs';
|
|
6
6
|
import { publicOrigin } from '../modules/deploy-kit/public-origin.mjs';
|
|
7
|
+
import { switchableDefaults, switchableDeclarationHelp } from './deploy-settings.mjs';
|
|
7
8
|
import { keptSecrets, rotations, savedSecrets } from './deploy-secrets.mjs';
|
|
8
9
|
|
|
9
10
|
// The values a Workers deploy reads for its declared secrets: this process's
|
|
@@ -12,14 +13,17 @@ import { keptSecrets, rotations, savedSecrets } from './deploy-secrets.mjs';
|
|
|
12
13
|
// the value kept for this environment (deploy-secrets.mjs), else a fresh one
|
|
13
14
|
// (`generated`; always fresh for the one-time setup token and --rotate-secret).
|
|
14
15
|
// The owner kit sends a value only to a Worker that lacks that secret.
|
|
15
|
-
export async function deployEnvironment({ root, options, declaration, setupManifest, settings, localOnlyKeys = [] }) {
|
|
16
|
+
export async function deployEnvironment({ root, options, declaration, setupManifest, settings, localOnlyKeys = [], refuseProviderKeys = false }) {
|
|
16
17
|
const env = { ...process.env }, supplied = [];
|
|
17
18
|
if (options.envFile) {
|
|
18
19
|
let values;
|
|
19
20
|
try { values = await readDeployEnvFile(root, options.envFile, localOnlyKeys); }
|
|
20
21
|
catch (error) { throw invalid(`The --env-file ${options.envFile} could not be used: ${error.code === 'ENOENT' ? 'no such file' : error.message}.`); }
|
|
22
|
+
const providerKey = refuseProviderKeys && Object.keys(values).find(key => /^(CLOUDFLARE_|CF_)/.test(key));
|
|
23
|
+
if (providerKey) throw refuse(`The --env-file ${options.envFile} contains ${providerKey}, which is refused while CLOUDFLARE_API_TOKEN is set in the environment. Remove all CLOUDFLARE_* and CF_* keys from the file and run the same command again.`);
|
|
21
24
|
Object.assign(env, values);
|
|
22
25
|
}
|
|
26
|
+
await applyPublicAssignments(env, options, declaration, setupManifest);
|
|
23
27
|
const originSetting = declaration.publicOriginSetting;
|
|
24
28
|
if (originSetting !== undefined && env[originSetting] === undefined && settings) {
|
|
25
29
|
const { readSettings } = await shared('adapter-settings.mjs');
|
|
@@ -72,10 +76,13 @@ export async function deployEnvironment({ root, options, declaration, setupManif
|
|
|
72
76
|
// declare it.
|
|
73
77
|
export async function withDeployEnvironment(project, options, out, run) {
|
|
74
78
|
const saved = { ...process.env };
|
|
75
|
-
|
|
79
|
+
// Guard the caller's provider inputs before installing the file into process.env.
|
|
80
|
+
// Later reads by the adapter must still accept a token supplied only by the file.
|
|
81
|
+
const { env } = await deployEnvironment({ root: project.root, options, declaration: {}, refuseProviderKeys: !!saved.CLOUDFLARE_API_TOKEN?.trim() });
|
|
76
82
|
const { createRedaction } = await shared('redaction.mjs');
|
|
77
83
|
const { declaredSettings, settingKinds, undeclaredNotice } = await import('./deploy-settings.mjs');
|
|
78
84
|
const declared = await declaredSettings(project), kinds = await settingKinds(declared);
|
|
85
|
+
await applyPublicAssignments(env, options, declared.declaration ?? {}, declared.setupManifest);
|
|
79
86
|
const redaction = createRedaction();
|
|
80
87
|
const supplied = Object.entries(env).filter(([key, value]) => saved[key] !== value);
|
|
81
88
|
redaction.addSecrets([...kinds.privateValues(env), ...supplied.filter(([key, value]) => !kinds.shown(key, value)).map(([, value]) => value)]);
|
|
@@ -95,5 +102,15 @@ export async function withDeployEnvironment(project, options, out, run) {
|
|
|
95
102
|
|
|
96
103
|
export function deployAgain(options) {
|
|
97
104
|
const quote = value => /^[a-zA-Z0-9_./-]+$/.test(value) ? value : `'${String(value).replaceAll("'", "'\"'\"'")}'`;
|
|
98
|
-
return
|
|
105
|
+
return `~/.local/bin/rer deploy --environment ${quote(options.environment ?? 'production')}${options.envFile ? ` --env-file ${quote(options.envFile)}` : ''}${options.cwd ? ` --cwd ${quote(relative(process.cwd(), options.cwd) || '.')}` : ''}${options.dryRun ? ' --dry-run' : ''}`;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async function applyPublicAssignments(env, options, declaration, setupManifest) {
|
|
109
|
+
if (options.setSecretValues && declaration.project) {
|
|
110
|
+
const defaults = await switchableDefaults(declaration, setupManifest);
|
|
111
|
+
for (const [binding, value] of Object.entries(options.setSecretValues)) {
|
|
112
|
+
if (!Object.hasOwn(defaults, binding)) throw invalid(`--set-secret NAME=VALUE accepts only declared switchable public settings. ${switchableDeclarationHelp()} Supply credentials through the environment or an owned 0600 --env-file.`);
|
|
113
|
+
env[declaration.secrets.find(item => item.binding === binding).environment] = value;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
99
116
|
}
|
|
@@ -20,13 +20,13 @@ export async function deployOwnerInput({ root, adapter, setupSeed, options, sign
|
|
|
20
20
|
const { readSettings } = await shared('adapter-settings.mjs');
|
|
21
21
|
displayName = (await readSettings(root, adapter.hooks.secrets)).values[key];
|
|
22
22
|
}
|
|
23
|
-
const advice = 'Deploy needs your owner name; run rer deploy --owner-name "Your name" (or rer setup --owner-name "Your name"). Nothing was uploaded.';
|
|
23
|
+
const advice = 'Deploy needs your owner name; run ~/.local/bin/rer deploy --owner-name "Your name" (or ~/.local/bin/rer setup --owner-name "Your name"). Nothing was uploaded.';
|
|
24
24
|
if (!displayName?.trim()) {
|
|
25
25
|
// A recorded bootstrap keeps its owner; resolving inputs needs no provider read.
|
|
26
26
|
const held = (await heldDeployments(root)).find(item => item.environment === (options.environment ?? 'production'));
|
|
27
27
|
if (['claimed', 'kept'].includes(held?.record.ownerClaim?.outcome)) return { input };
|
|
28
28
|
// A local plan never bootstraps an owner or asks for their name, but the first real deploy stops without one.
|
|
29
|
-
if (options.dryRun) return { input, neededForRealDeploy: ['owner name (--owner-name or rer setup)'] };
|
|
29
|
+
if (options.dryRun) return { input, neededForRealDeploy: ['owner name (--owner-name or ~/.local/bin/rer setup)'] };
|
|
30
30
|
if (options.nonInteractive || options.json || !process.stdin.isTTY) throw missing(advice);
|
|
31
31
|
const prompt = createInterface({ input: process.stdin, output: process.stderr });
|
|
32
32
|
const closed = new Promise((_, reject) => prompt.once('close', () => reject(missing(advice))));
|
package/cli/deploy-settings.mjs
CHANGED
|
@@ -49,3 +49,17 @@ export async function declaredSettings(project) {
|
|
|
49
49
|
export function undeclaredNotice(names, path) {
|
|
50
50
|
return `Undeclared --env-file settings stay out of rer's output: ${names.join(', ')}. To print one, declare it as a non-secret setting: add its name to "publicSettings" in ${path}.`;
|
|
51
51
|
}
|
|
52
|
+
|
|
53
|
+
// Opt-in transport for a public choice with an explicit reset value. Keep this
|
|
54
|
+
// distinct from setup select fields: old declarations keep their exact plans.
|
|
55
|
+
export async function switchableDefaults(declaration, setupManifest) {
|
|
56
|
+
const kinds = await settingKinds({ declaration, setupManifest });
|
|
57
|
+
return Object.fromEntries((Array.isArray(declaration.secrets) ? declaration.secrets : []).filter(item =>
|
|
58
|
+
item?.optional === true && Array.isArray(declaration.publicSettings) && declaration.publicSettings.includes(item.binding) &&
|
|
59
|
+
kinds.shown(item.binding, declaration.vars?.[item.binding]) && kinds.shown(item.environment, declaration.vars?.[item.binding])
|
|
60
|
+
).map(item => [item.binding, declaration.vars[item.binding]]));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function switchableDeclarationHelp(path = 'deploy.json') {
|
|
64
|
+
return `For a switchable public setting such as MAIL_PROVIDER, declare its name in publicSettings, its default in vars, and a secrets entry with binding, environment and optional: true in ${path}; keep the same public default in Wrangler vars. Credentials remain secrets.`;
|
|
65
|
+
}
|
package/cli/deploy-source.mjs
CHANGED
|
@@ -9,7 +9,7 @@ export function committedSource(root, options) {
|
|
|
9
9
|
const again = deployAgain(options);
|
|
10
10
|
let status, sha;
|
|
11
11
|
try { status = git('status', '--porcelain', '-z', '--untracked-files=no'); sha = git('rev-parse', 'HEAD').trim(); }
|
|
12
|
-
catch { throw refuse(
|
|
12
|
+
catch { throw refuse(`~/.local/bin/rer deploy publishes the checkout's last Git commit, and this checkout has none. Commit the source with Git, then run ${again} again. Nothing was uploaded.`); }
|
|
13
13
|
const entries = status.split('\0'), paths = [];
|
|
14
14
|
for (let index = 0; index < entries.length; index++) {
|
|
15
15
|
if (!entries[index]) continue;
|
package/cli/deploy-variables.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import { tomlEntries } from './business/parsers-config.mjs';
|
|
|
7
7
|
import { imageVariableSecrets } from '../modules/container/image-variables.mjs';
|
|
8
8
|
import { publicMailSender, validateMailSenders } from '../modules/delivery-producer/mail.mjs';
|
|
9
9
|
import { deliveryDeclarationSources } from './delivery-declarations.mjs';
|
|
10
|
+
import { switchableDefaults, switchableDeclarationHelp } from './deploy-settings.mjs';
|
|
10
11
|
|
|
11
12
|
const id = 'deploy.vars-secrets';
|
|
12
13
|
const lineAt = (source, offset) => source.slice(0, offset).split('\n').length;
|
|
@@ -71,6 +72,7 @@ export async function deployVariableClause(root, adapter) {
|
|
|
71
72
|
privateSender ||= [...(spec.secretNames ?? []), ...(spec.optionalSecretNames ?? [])].includes('MAIL_FROM');
|
|
72
73
|
senders.push({ source: `${path} publicVariables.MAIL_FROM`, value: spec.publicVariables?.MAIL_FROM });
|
|
73
74
|
}
|
|
75
|
+
const defaults = await switchableDefaults(declaration);
|
|
74
76
|
const overlaps = [];
|
|
75
77
|
for (const path of deployConfigPaths(adapter)) {
|
|
76
78
|
for (const entry of await variableEntries(root, path)) {
|
|
@@ -78,12 +80,16 @@ export async function deployVariableClause(root, adapter) {
|
|
|
78
80
|
if (binding === 'MAIL_FROM') senders.push(entry);
|
|
79
81
|
const matched = new Set(imageVariableSecrets({ [binding]: value }, secrets).map(secret => secret.binding));
|
|
80
82
|
if (!matched.has(binding)) continue;
|
|
83
|
+
if (Object.hasOwn(defaults, binding)) {
|
|
84
|
+
if (value !== defaults[binding]) throw Error(`${binding}: ${entry.source} must match the public default in ${declarationPath} vars.${binding}.`);
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
81
87
|
if (binding === 'MAIL_FROM' && publicSender && !privateSender) continue;
|
|
82
88
|
for (const [index, secret] of secrets.entries()) if (secret.binding === binding) overlaps.push(
|
|
83
89
|
`${binding}: ${entry.location} and ${declarationPath}:${secretLocations.get(index)} (secrets)`);
|
|
84
90
|
}
|
|
85
91
|
}
|
|
86
92
|
validateMailSenders(senders);
|
|
87
|
-
return overlaps.length ? { id, ok: false, message: overlaps.join('\n') + '\nremove it from wrangler vars; the deploy sets it as a secret' } : { id, ok: true };
|
|
93
|
+
return overlaps.length ? { id, ok: false, message: overlaps.join('\n') + '\nremove it from wrangler vars; the deploy sets it as a secret. ' + switchableDeclarationHelp(declarationPath) } : { id, ok: true };
|
|
88
94
|
} catch (error) { return { id, ok: false, message: error.message }; }
|
|
89
95
|
}
|
package/cli/deploy.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { requireProductionAuth, mailOffNotice } from './production-auth.mjs';
|
|
2
2
|
import { mailOffSignInCommand } from './production-mail.mjs';
|
|
3
3
|
import { readFile } from 'node:fs/promises';
|
|
4
|
-
import { deployDiagnostic, migrationFailure, providerFailure, assetFailure } from '../modules/deploy-kit/diagnostics.mjs';
|
|
4
|
+
import { deployDiagnostic, migrationFailure, providerFailure, assetFailure, ownerTargetFailure } from '../modules/deploy-kit/diagnostics.mjs';
|
|
5
5
|
import { shared } from './shared.mjs';
|
|
6
|
-
import { settingKinds } from './deploy-settings.mjs';
|
|
6
|
+
import { settingKinds, switchableDeclarationHelp } from './deploy-settings.mjs';
|
|
7
7
|
import { contained } from './project.mjs';
|
|
8
8
|
import { missing, invalid, refuse, RerError } from './errors.mjs';
|
|
9
9
|
import { localOnlyBinding } from '../modules/deploy-kit/owner.mjs';
|
|
@@ -64,7 +64,7 @@ export function ownerDeploy(declarationPath, lifecycle) {
|
|
|
64
64
|
redaction.addSecrets((await settingKinds({ declaration, setupManifest })).privateValues(env));
|
|
65
65
|
const claim = setupManifest?.steps?.find(item => item.type === 'owner-claim');
|
|
66
66
|
const declared = binding => (Array.isArray(declaration.secrets) ? declaration.secrets : []).find(item => item?.binding === binding);
|
|
67
|
-
const owner = async (command, extra = [], values = env, more = {}) => main([command, '--declaration', declarationPath, '--environment', environment, ...(['dry-run', 'local-plan', 'deploy', 'health'].includes(command) ? await deployProductArguments(root, productDirectory) : []), ...extra], values, { cwd: root, localOnlyKeys, ...more });
|
|
67
|
+
const owner = async (command, extra = [], values = env, more = {}) => main([command, '--declaration', declarationPath, '--environment', environment, ...(['dry-run', 'local-plan', 'deploy', 'health'].includes(command) ? await deployProductArguments(root, productDirectory) : []), ...extra], values, { cwd: root, localOnlyKeys, signal, ...more });
|
|
68
68
|
// Keep confirmed creation events across deploy and the independent health call.
|
|
69
69
|
const created = [];
|
|
70
70
|
let step = 'deploy', deployed;
|
|
@@ -155,7 +155,7 @@ function secretChangeInputs(declaration, options, env, again) {
|
|
|
155
155
|
const declared = Array.isArray(declaration.secrets) ? declaration.secrets : [], flag = options.setSecret ? '--set-secret' : '--unset-secret';
|
|
156
156
|
const named = (options.setSecret ?? options.unsetSecret).split(',');
|
|
157
157
|
const undeclared = named.filter(name => !declared.some(item => item?.binding === name));
|
|
158
|
-
if (undeclared.length) throw invalid(`${flag} names ${undeclared.join(', ')}, which the deploy declaration does not list as ${undeclared.length > 1 ? 'secrets' : 'a secret'}${declared.length ? ` (it declares ${declared.map(item => item.binding).join(', ')})` : ''}. Nothing was changed.`);
|
|
158
|
+
if (undeclared.length) throw invalid(`${flag} names ${undeclared.join(', ')}, which the deploy declaration does not list as ${undeclared.length > 1 ? 'secrets' : 'a secret'}${declared.length ? ` (it declares ${declared.map(item => item.binding).join(', ')})` : ''}. ${switchableDeclarationHelp()} Nothing was changed.`);
|
|
159
159
|
if (!options.setSecret) return;
|
|
160
160
|
const absent = named.map(name => declared.find(item => item.binding === name).environment).filter(name => !env[name]?.trim());
|
|
161
161
|
if (absent.length) throw missing(`${flag} ${options.setSecret} needs a value for each secret; ${absent.join(', ')} ${absent.length > 1 ? 'are' : 'is'} not set. Set ${absent.length > 1 ? 'them' : 'it'} in the environment or in an --env-file file (owned, mode 0600, one line per secret), then run ${again} ${flag} ${options.setSecret} again. Nothing was changed.`);
|
|
@@ -163,6 +163,7 @@ function secretChangeInputs(declaration, options, env, again) {
|
|
|
163
163
|
|
|
164
164
|
// The failing step, its redacted cause, what this run created and the command that continues.
|
|
165
165
|
function failureText({ error, step, created, again, retry, secretChange, deployed, redact }) {
|
|
166
|
+
if (ownerTargetFailure(error)) return redact(ownerTargetFailure(error));
|
|
166
167
|
if (step === 'remove') {
|
|
167
168
|
const remaining = error.remaining;
|
|
168
169
|
if (error.message === 'nothing-to-remove') return `There are no recorded resources to remove; nothing was removed.`;
|
|
@@ -204,6 +205,7 @@ function recovery({ code, at, resource, again, retry, secretChange }) {
|
|
|
204
205
|
if (code === 'provider-incomplete-pagination') return `Cloudflare did not supply a complete list. Inspect the named GET call in Cloudflare, resolve its missing continuation, then run ${retry} again with the same account and environment. Keep the deployment record so rer can reuse its resources.`;
|
|
205
206
|
if (code === 'owned-resource-replaced' || code === 'resource-name-collision') return `rer refuses to change a resource it did not create or that was replaced after it did; nothing was changed. Choose another --environment name, or remove the other resource yourself.`;
|
|
206
207
|
// A lost create answer: the resource may exist, and rer cannot prove it made it.
|
|
208
|
+
if (code === 'uncertain-resource-create' && resource && !resource.startsWith('worker:')) return `Found ${resource} at a pending create name, but its creation response and provider identity were not recorded. rer preserved the resource and deployment record without deleting, adopting or recreating it. This create cannot be safely repeated from its name alone. Inspect its ownership in Cloudflare before proceeding; keep any data. ${resource.startsWith('d1:') || resource.startsWith('kv:') ? `If it is the empty resource from this interrupted run and you want to discard this deployment, ${remove} verifies emptiness before removing it and the other recorded resources.` : 'This resource cannot be automatically removed without confirmed ownership.'}`;
|
|
207
209
|
if (resource && (code === 'uncertain-resource-create' || code === 'provider-transport-failed' && at.startsWith('create '))) {
|
|
208
210
|
if (resource.startsWith('worker:')) return `Possibly created: ${resource}. The answer to its first upload was lost and the live Worker does not match the build rer sent, so rer cannot prove it is its own. Deploy the same commit again to recover it, or inspect it in the Cloudflare dashboard: if it is the Worker from the interrupted run and its Durable Object data is disposable, delete it, then run ${retry} again.`;
|
|
209
211
|
return `Possibly created: ${resource}. The provider's answer to its create was lost, so rer cannot prove it made it. Inspect it in the Cloudflare dashboard: if it exists and is the empty one from the interrupted run, delete it, then run ${retry} again.${removing || resource.startsWith('queues:') ? '' : ` Or run ${remove}: it deletes it once it confirms it is empty, together with everything else this environment created.`}`;
|
|
@@ -45,7 +45,7 @@ export async function heldDeployments(root) {
|
|
|
45
45
|
|
|
46
46
|
function commandFor(options, environment) {
|
|
47
47
|
const again = deployAgain({ ...options, environment });
|
|
48
|
-
if (options.verb === 'signin') return again.replace(
|
|
48
|
+
if (options.verb === 'signin') return again.replace('~/.local/bin/rer deploy', '~/.local/bin/rer signin');
|
|
49
49
|
if (options.remove) return `${again} --remove --yes`;
|
|
50
50
|
if (options.setSecret) return `${again} --set-secret ${options.setSecret}`;
|
|
51
51
|
if (options.reopenInstallationKey) return `${again} --reopen-installation-key ${options.reopenInstallationKey}`;
|
package/cli/dev-identity.mjs
CHANGED
|
@@ -31,13 +31,13 @@ export async function readDevKey(root) {
|
|
|
31
31
|
const { privateDirectory, readPrivateFile } = await shared('private-files.mjs');
|
|
32
32
|
await privateDirectory(root, ['.rer', 'local']);
|
|
33
33
|
const key = KEY.exec(await readPrivateFile(path))?.[1];
|
|
34
|
-
if (!key) throw refuse(`${DEV_KEY_FILE} is malformed. Run rer reset --yes, then rer setup, for a new key.`);
|
|
34
|
+
if (!key) throw refuse(`${DEV_KEY_FILE} is malformed. Run ~/.local/bin/rer reset --yes, then ~/.local/bin/rer setup, for a new key.`);
|
|
35
35
|
return key;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export async function requireDevKey(root) {
|
|
39
39
|
const key = await readDevKey(root);
|
|
40
|
-
if (!key) throw missing(`The local dev key ${DEV_KEY_FILE} is missing. Run rer setup to create it.`);
|
|
40
|
+
if (!key) throw missing(`The local dev key ${DEV_KEY_FILE} is missing. Run ~/.local/bin/rer setup to create it.`);
|
|
41
41
|
return key;
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -66,8 +66,8 @@ export async function resolvePersona(url, key, as, signal) {
|
|
|
66
66
|
// The people rer can sign in as: each persona with its email, then every
|
|
67
67
|
// invited or active person in this checkout's local database by email.
|
|
68
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(`Dev persona ${as} is unavailable for sign-in. Run rer dev --as with one of: ${valid}. If this account is inactive, ask an owner or administrator to reactivate it first.`);
|
|
70
|
-
throw invalid(`No one with the email ${as} can sign in to this app locally. rer dev --as takes one of: ${valid}. If this account is inactive, ask an owner or administrator to reactivate it. 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.`);
|
|
69
|
+
if (!as.includes('@')) throw invalid(`Dev persona ${as} is unavailable for sign-in. Run ~/.local/bin/rer dev --as with one of: ${valid}. If this account is inactive, ask an owner or administrator to reactivate it first.`);
|
|
70
|
+
throw invalid(`No one with the email ${as} can sign in to this app locally. ~/.local/bin/rer dev --as takes one of: ${valid}. If this account is inactive, ask an owner or administrator to reactivate it. 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 ~/.local/bin/rer dev --as ${as} again.`);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
// rer build refuses output that bundles the dev layer, naming the file.
|
package/cli/door-clauses.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { resolve, relative, isAbsolute } from 'node:path';
|
|
|
5
5
|
import { parseContract, plainText } from '../foundation/runtime/seed-contract.mjs';
|
|
6
6
|
import { RerError } from './errors.mjs';
|
|
7
7
|
|
|
8
|
-
export const clausesHelp = `Usage: rer door clauses (--write | --check) [--cwd DIR]
|
|
8
|
+
export const clausesHelp = `Usage: ~/.local/bin/rer door clauses (--write | --check) [--cwd DIR]
|
|
9
9
|
|
|
10
10
|
Synchronize BASE-AGENT-001 through BASE-AGENT-013 in CONTRACT.md.
|
|
11
11
|
--write adds or updates Base's requirements, preserving existing status,
|
|
@@ -163,7 +163,7 @@ export async function doorClausesCommand(args, env = process.env) {
|
|
|
163
163
|
if (!mode) throw new RerError('invalid_arguments', clausesHelp, 2);
|
|
164
164
|
root = resolve(root);
|
|
165
165
|
const file = resolve(root, 'CONTRACT.md');
|
|
166
|
-
if (!existsSync(file)) fail('No CONTRACT.md found. Run rer door clauses from the seed root or pass --cwd DIR.');
|
|
166
|
+
if (!existsSync(file)) fail('No CONTRACT.md found. Run ~/.local/bin/rer door clauses from the seed root or pass --cwd DIR.');
|
|
167
167
|
const original = read(file);
|
|
168
168
|
const inherited = sharedDuties(original, mode === '--write');
|
|
169
169
|
const { text, changed } = synchronize(original, definitions(canonical(root)).filter(clause => !inherited.has(clause.id)));
|
package/cli/door-mode.mjs
CHANGED
|
@@ -16,10 +16,10 @@ const moveRecord = '.rer/local/door-move.json';
|
|
|
16
16
|
// The enabled door this checkout can use, or a refusal saying why not.
|
|
17
17
|
export async function enabledDoor(env = process.env) {
|
|
18
18
|
const state = await readDoorState(env);
|
|
19
|
-
if (!state?.door?.enabled) throw refuse(`The front door is not enabled on this computer (${state?.directory ?? 'RER_DOOR_DIR'}). Enable it with rer door enable, or serve directly with rer dev --direct.`);
|
|
19
|
+
if (!state?.door?.enabled) throw refuse(`The front door is not enabled on this computer (${state?.directory ?? 'RER_DOOR_DIR'}). Enable it with ~/.local/bin/rer door enable, or serve directly with ~/.local/bin/rer dev --direct.`);
|
|
20
20
|
const running = await runningDoor(env);
|
|
21
21
|
const protocol = running?.protocol ?? state.door.protocol;
|
|
22
|
-
if (protocol !== doorProtocol) throw refuse(`The front door speaks protocol ${protocol}, which this checkout's rer (protocol ${doorProtocol}) does not know. Run rer door restart with the installed rer.`);
|
|
22
|
+
if (protocol !== doorProtocol) throw refuse(`The front door speaks protocol ${protocol}, which this checkout's rer (protocol ${doorProtocol}) does not know. Run ~/.local/bin/rer door restart with the installed rer.`);
|
|
23
23
|
return state.door;
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -43,7 +43,7 @@ export async function selectDoor(project, options, previous, fields) {
|
|
|
43
43
|
return doorSelection(saved.name, saved.port, fields);
|
|
44
44
|
}
|
|
45
45
|
if (!options.door) return undefined;
|
|
46
|
-
if (previous) throw refuse('This checkout is already set up at ' + previous.origin + '. Move it to the front door with rer dev --door, which keeps its data.');
|
|
46
|
+
if (previous) throw refuse('This checkout is already set up at ' + previous.origin + '. Move it to the front door with ~/.local/bin/rer dev --door, which keeps its data.');
|
|
47
47
|
const door = await enabledDoor(), name = await claimSiteName(process.env, project.root, { mode: 'door' });
|
|
48
48
|
return doorSelection(name, door.port, fields);
|
|
49
49
|
}
|
|
@@ -72,7 +72,7 @@ export async function routeRunning(record) {
|
|
|
72
72
|
const { listeners } = await shared('process-diagnostics.mjs');
|
|
73
73
|
const live = await alive(record.owner).catch(() => false);
|
|
74
74
|
const holds = live && (await listeners([record.owner.pid])).some(row => row.pid === record.owner.pid && row.names.some(name => /^(?:127\.0\.0\.1|\[?::ffff:127\.0\.0\.1\]?):(\d+)$/.exec(name)?.[1] === String(record.port)));
|
|
75
|
-
if (!holds) throw refuse(`This checkout's server (PID ${record.owner?.pid}) is not serving on its recorded port 127.0.0.1:${record.port}, so nothing was sent to it. Stop it with rer dev --stop, then start it again with rer dev.`);
|
|
75
|
+
if (!holds) throw refuse(`This checkout's server (PID ${record.owner?.pid}) is not serving on its recorded port 127.0.0.1:${record.port}, so nothing was sent to it. Stop it with ~/.local/bin/rer dev --stop, then start it again with ~/.local/bin/rer dev.`);
|
|
76
76
|
const { routeOrigin } = await shared('app-fetch.mjs');
|
|
77
77
|
routeOrigin(record.url, { port: record.port, headers: { [doorSecretHeader]: record.door.secret } });
|
|
78
78
|
}
|
|
@@ -103,11 +103,11 @@ export async function moveCheckout(project, options, out, registry) {
|
|
|
103
103
|
if (!secrets) throw refuse('This checkout declares no saved origin, so it cannot move to or from the front door.');
|
|
104
104
|
const { readSettings, replaceSavedOrigin } = await shared('adapter-settings.mjs');
|
|
105
105
|
const key = localSettingKeys(project).origin, current = (await readSettings(project.root, secrets)).values[key];
|
|
106
|
-
if (!current) throw refuse('This checkout is not set up yet. Run rer dev without --door or --direct; with the door enabled it is set up there.');
|
|
106
|
+
if (!current) throw refuse('This checkout is not set up yet. Run ~/.local/bin/rer dev without --door or --direct; with the door enabled it is set up there.');
|
|
107
107
|
const atDoor = Boolean(doorSite(current));
|
|
108
108
|
if (options.door === atDoor) return;
|
|
109
109
|
const running = await registry.existing(options.verb, { ...options, supplied: new Set() });
|
|
110
|
-
if (running) throw refuse(`Stop this checkout's running server first (rer dev --stop), then move it.`);
|
|
110
|
+
if (running) throw refuse(`Stop this checkout's running server first (~/.local/bin/rer dev --stop), then move it.`);
|
|
111
111
|
let target, record;
|
|
112
112
|
const { privateDirectory, readPrivateFile, writePrivateFile } = await shared('private-files.mjs');
|
|
113
113
|
if (options.door) {
|
|
@@ -129,6 +129,6 @@ export async function moveCheckout(project, options, out, registry) {
|
|
|
129
129
|
if (record) { await privateDirectory(project.root, ['.rer', 'local']); await writePrivateFile(join(project.root, moveRecord), JSON.stringify(record) + '\n'); }
|
|
130
130
|
else await rm(join(project.root, moveRecord), { force: true });
|
|
131
131
|
} finally { await operation.release(); }
|
|
132
|
-
const line = options.door ? `Moved this checkout from ${current} to ${target}, through the front door. Its data is kept; rer dev --direct moves it back.` : `Moved this checkout from ${current} back to ${target}. Its data is kept.`;
|
|
132
|
+
const line = options.door ? `Moved this checkout from ${current} to ${target}, through the front door. Its data is kept; ~/.local/bin/rer dev --direct moves it back.` : `Moved this checkout from ${current} back to ${target}. Its data is kept.`;
|
|
133
133
|
if (options.json) out.event('moved', { from: current, to: target }); else out.human(line);
|
|
134
134
|
}
|