@runeditrun/rer 0.2.121 → 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 +124 -5
- package/cli/archive.mjs +1 -1
- package/cli/authoring.mjs +1 -1
- package/cli/browser-runtime.mjs +2 -2
- 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 +7 -3
- package/cli/deploy-owner-input.mjs +2 -2
- package/cli/deploy-source.mjs +1 -1
- package/cli/deploy.mjs +4 -2
- 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 +3 -3
- package/cli/lifecycle.mjs +9 -9
- 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 +8 -8
- 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 +31 -0
- 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 +4 -4
- 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 +10 -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 +49 -21
- package/modules/deploy-kit/owner-remove.mjs +7 -6
- package/modules/deploy-kit/owner-secret.mjs +7 -4
- package/modules/deploy-kit/owner.mjs +46 -28
- 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/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
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
|
@@ -13,12 +13,14 @@ import { keptSecrets, rotations, savedSecrets } from './deploy-secrets.mjs';
|
|
|
13
13
|
// the value kept for this environment (deploy-secrets.mjs), else a fresh one
|
|
14
14
|
// (`generated`; always fresh for the one-time setup token and --rotate-secret).
|
|
15
15
|
// The owner kit sends a value only to a Worker that lacks that secret.
|
|
16
|
-
export async function deployEnvironment({ root, options, declaration, setupManifest, settings, localOnlyKeys = [] }) {
|
|
16
|
+
export async function deployEnvironment({ root, options, declaration, setupManifest, settings, localOnlyKeys = [], refuseProviderKeys = false }) {
|
|
17
17
|
const env = { ...process.env }, supplied = [];
|
|
18
18
|
if (options.envFile) {
|
|
19
19
|
let values;
|
|
20
20
|
try { values = await readDeployEnvFile(root, options.envFile, localOnlyKeys); }
|
|
21
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.`);
|
|
22
24
|
Object.assign(env, values);
|
|
23
25
|
}
|
|
24
26
|
await applyPublicAssignments(env, options, declaration, setupManifest);
|
|
@@ -74,7 +76,9 @@ export async function deployEnvironment({ root, options, declaration, setupManif
|
|
|
74
76
|
// declare it.
|
|
75
77
|
export async function withDeployEnvironment(project, options, out, run) {
|
|
76
78
|
const saved = { ...process.env };
|
|
77
|
-
|
|
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() });
|
|
78
82
|
const { createRedaction } = await shared('redaction.mjs');
|
|
79
83
|
const { declaredSettings, settingKinds, undeclaredNotice } = await import('./deploy-settings.mjs');
|
|
80
84
|
const declared = await declaredSettings(project), kinds = await settingKinds(declared);
|
|
@@ -98,7 +102,7 @@ export async function withDeployEnvironment(project, options, out, run) {
|
|
|
98
102
|
|
|
99
103
|
export function deployAgain(options) {
|
|
100
104
|
const quote = value => /^[a-zA-Z0-9_./-]+$/.test(value) ? value : `'${String(value).replaceAll("'", "'\"'\"'")}'`;
|
|
101
|
-
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' : ''}`;
|
|
102
106
|
}
|
|
103
107
|
|
|
104
108
|
async function applyPublicAssignments(env, options, declaration, setupManifest) {
|
|
@@ -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-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.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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
6
|
import { settingKinds, switchableDeclarationHelp } from './deploy-settings.mjs';
|
|
7
7
|
import { contained } from './project.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;
|
|
@@ -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
|
}
|
package/cli/door.mjs
CHANGED
|
@@ -201,8 +201,8 @@ export async function claimSiteName(env, checkout, { preferred, mode, origin, ex
|
|
|
201
201
|
const claimed = await changeDoorState(env, state => {
|
|
202
202
|
const { entry, holder } = claimEntry(state, checkout, preferred, held);
|
|
203
203
|
if (exact && entry.name !== preferred) throw refuse(holder
|
|
204
|
-
? `This checkout's saved origin names ${preferred}.localhost, which the front door has registered for another checkout (${holder.checkout}). Nothing was started and no sign-in link was printed. Give this checkout its own name: rer dev --direct, then rer dev --door.`
|
|
205
|
-
: `This checkout's saved origin names ${preferred}.localhost, but the front door has it registered as ${entry.name}. Nothing was started and no sign-in link was printed. Move it again: rer dev --direct, then rer dev --door.`);
|
|
204
|
+
? `This checkout's saved origin names ${preferred}.localhost, which the front door has registered for another checkout (${holder.checkout}). Nothing was started and no sign-in link was printed. Give this checkout its own name: ~/.local/bin/rer dev --direct, then ~/.local/bin/rer dev --door.`
|
|
205
|
+
: `This checkout's saved origin names ${preferred}.localhost, but the front door has it registered as ${entry.name}. Nothing was started and no sign-in link was printed. Move it again: ~/.local/bin/rer dev --direct, then ~/.local/bin/rer dev --door.`);
|
|
206
206
|
describe(entry);
|
|
207
207
|
return { name: entry.name, id: entry.id };
|
|
208
208
|
});
|
|
@@ -246,19 +246,19 @@ async function verifyOnce(env, port) {
|
|
|
246
246
|
const holders = (await listeners(undefined,context,port)).filter(row => row.names.some(name => portOf(name) === port));
|
|
247
247
|
const foreign = holders.find(row => row.pid !== record?.pid);
|
|
248
248
|
const withheld = 'No sign-in link was printed.';
|
|
249
|
-
if (foreign) throw refuse(`Port ${port} is held by PID ${foreign.pid} (${await processName(foreign.pid,context)}), which is not this account's front door${record ? ` (PID ${record.pid})` : ''}. ${withheld} Stop PID ${foreign.pid}, then run rer door restart.`);
|
|
250
|
-
if (!record || record.port !== port) throw refuse(`The front door is not running on port ${port}. ${withheld} Start it with rer door start, then run this again.`);
|
|
249
|
+
if (foreign) throw refuse(`Port ${port} is held by PID ${foreign.pid} (${await processName(foreign.pid,context)}), which is not this account's front door${record ? ` (PID ${record.pid})` : ''}. ${withheld} Stop PID ${foreign.pid}, then run ~/.local/bin/rer door restart.`);
|
|
250
|
+
if (!record || record.port !== port) throw refuse(`The front door is not running on port ${port}. ${withheld} Start it with ~/.local/bin/rer door start, then run this again.`);
|
|
251
251
|
const token = (await readPrivate(join(directory, 'token')))?.trim();
|
|
252
|
-
if (!token) throw refuse(`The front door's token is missing from ${directory}. ${withheld} Run rer door restart.`);
|
|
252
|
+
if (!token) throw refuse(`The front door's token is missing from ${directory}. ${withheld} Run ~/.local/bin/rer door restart.`);
|
|
253
253
|
for (const host of ['127.0.0.1', '::1']) {
|
|
254
254
|
let answer;
|
|
255
255
|
try { answer = await challenge(host, port, token); }
|
|
256
256
|
catch (error) {
|
|
257
257
|
// No IPv6 loopback, or nothing on [::1]:P while the door serves only 127.0.0.1.
|
|
258
258
|
if (host === '::1' && ['ECONNREFUSED', 'EADDRNOTAVAIL', 'EAFNOSUPPORT', 'ENETUNREACH'].includes(error.code) && !record.addresses?.includes('::1')) continue;
|
|
259
|
-
throw refuse(`The front door (PID ${record.pid}) did not answer on ${host === '::1' ? '[::1]' : host}:${port}: ${error.code ?? error.message}. ${withheld} Run rer door restart.`);
|
|
259
|
+
throw refuse(`The front door (PID ${record.pid}) did not answer on ${host === '::1' ? '[::1]' : host}:${port}: ${error.code ?? error.message}. ${withheld} Run ~/.local/bin/rer door restart.`);
|
|
260
260
|
}
|
|
261
|
-
if (!answer || answer.pid !== record.pid) throw refuse(`Something other than this account's front door (PID ${record.pid}) answers on ${host === '::1' ? '[::1]' : host}:${port}. ${withheld} Find and stop it, then run rer door restart.`);
|
|
261
|
+
if (!answer || answer.pid !== record.pid) throw refuse(`Something other than this account's front door (PID ${record.pid}) answers on ${host === '::1' ? '[::1]' : host}:${port}. ${withheld} Find and stop it, then run ~/.local/bin/rer door restart.`);
|
|
262
262
|
}
|
|
263
263
|
return record;
|
|
264
264
|
}
|
package/cli/errors.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { transferDiagnostic } from '../modules/portability/http-client.mjs';
|
|
2
|
+
import { nativeFailure } from './portability-progress.mjs';
|
|
3
|
+
import { relative } from 'node:path';
|
|
2
4
|
|
|
3
5
|
export class RerError extends Error {
|
|
4
6
|
constructor(code, message, exitCode, details = {}) { super(message); Object.assign(this, { code, exitCode, ...details }); }
|
|
@@ -14,5 +16,17 @@ export async function lifecycleError(error, store) {
|
|
|
14
16
|
const {shared}=await import('./shared.mjs');
|
|
15
17
|
const {approvedFailure}=await shared('failures.mjs');
|
|
16
18
|
const approved=approvedFailure(error);
|
|
17
|
-
|
|
19
|
+
const native=nativeFailure(error);
|
|
20
|
+
return new RerError(['owner_conflict','machine_busy'].includes(approved?.code)?'safety_refusal':'command_failed', approved?.message ?? `${store?.state?.step ?? 'Local lifecycle'} failed (${native.class}${native.code ? `, code ${native.code}` : ''}).`, approved?.exitCode ?? 1, {childExitCode:approved?.childExitCode,signal:approved?.signal,...(approved?.d1Import ? {d1Import:approved.d1Import} : {})});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Only classified diagnostics reach this boundary: unexpected native messages
|
|
24
|
+
// can contain SQL or row values. Name a log only after its failure entry writes.
|
|
25
|
+
export function retainTransferFailure(error,store,root) {
|
|
26
|
+
if(!store?.logPath){error.message+=' No capture log was created.';return error;}
|
|
27
|
+
try {
|
|
28
|
+
store.report(`${error.code}: ${error.message}`,{logOnly:true});
|
|
29
|
+
error.message+=`\nFull output: ${store.redact(relative(root,store.logPath))}`;
|
|
30
|
+
} catch { error.message+=' The private capture log could not be written.'; }
|
|
31
|
+
return error;
|
|
18
32
|
}
|
package/cli/export-summary.mjs
CHANGED
|
@@ -11,7 +11,7 @@ export function exportSummary({ target = 'local', origin, output, bytes, tables,
|
|
|
11
11
|
return [
|
|
12
12
|
`Exported ${copy} to ${output} (${size(bytes)}): ${counted(tables.length, 'table')}, ${counted(rows, 'row')}`,
|
|
13
13
|
captureLog && `Full output: ${captureLog}`,
|
|
14
|
-
`To restore into an empty installation: rer import --input ${file} --yes`,
|
|
14
|
+
`To restore into an empty installation: ~/.local/bin/rer import --input ${file} --yes`,
|
|
15
15
|
].filter(Boolean).join('\n');
|
|
16
16
|
}
|
|
17
17
|
|
package/cli/export.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { execFileSync } from 'node:child_process';
|
|
|
9
9
|
// load sibling modules and data dynamically; they belong in the inventory too.
|
|
10
10
|
export const sourceRoots = ['default-seed/public/rer-theme.css', 'default-seed/public/brand/mark.svg', 'default-seed/public/fonts/outfit', 'bin/rer.mjs', 'cli', 'modules/delivery-producer/declarations.mjs', 'modules/delivery-producer/bindings.mjs', 'modules/delivery-producer/migrations.mjs', 'modules/delivery-producer/mail.mjs', 'modules/job-queue', 'modules/release', 'modules/deploy-kit', 'modules/site', 'modules/container', 'modules/demo-host', 'modules/demo', 'modules/integrations/core', 'modules/mail', 'modules/ai', 'modules/portability', 'modules/d1-transport', 'modules/import-kit/src/receipt', 'modules/import-kit/src/status', 'modules/import-kit/schema', 'modules/import-kit/src/d1', 'modules/import-kit/src/door', 'modules/import-kit/src/readers', 'modules/import-kit/src/provenance/numeric-credentials.ts', 'modules/import-kit/src/types.ts', 'modules/import-kit/src/plan', 'modules/import-kit/src/provenance/canonical-hash.ts', 'modules/import-kit/src/provenance/canonical-stream.ts', 'modules/import-kit/src/provenance/credential-names.ts', 'modules/import-kit/src/provenance/credentials.ts', 'modules/import-kit/src/provenance/identity.ts', 'modules/import-kit/src/provenance/json-snapshot.ts', 'modules/import-kit/src/provenance/resumable-sha256.ts', 'modules/import-kit/src/provenance/validate-json.ts', 'modules/import-kit/src/journal/authority.ts', 'modules/import-kit/src/storage/originals.ts', 'modules/import-kit/src/storage/provenance.ts', 'modules/import-kit/src/storage/schema.ts', 'modules/erasure', 'modules/dependencies', 'modules/operator-auth', 'modules/owner-claim', 'operations', 'scripts/publish-check', 'scripts/publish-check.mjs', 'composition/git-source.mjs', 'edition-authoring/adopt.mjs', 'edition-authoring/base-acknowledgements.mjs', 'edition-authoring/base-copies.mjs', 'edition-authoring/module-closure.mjs', 'edition-authoring/edition-migrations.mjs', 'edition-authoring/cli.mjs', 'edition-authoring/copy-checkout.mjs', 'edition-authoring/files.mjs', 'edition-authoring/lock.mjs', 'edition-authoring/manifest.mjs', 'edition-authoring/offline-git.mjs', 'edition-authoring/parent-comparison.mjs', 'edition-authoring/projection-lock.mjs', 'edition-authoring/release.mjs', 'edition-authoring/runtime-dependencies.mjs', 'edition-authoring/module-resolution.mjs', 'edition-authoring/package-target.mjs', 'edition-authoring/module-syntax.mjs', 'edition-authoring/module-edges.mjs', 'edition-authoring/vendor/babel-parser', 'edition-authoring/workflow-copies.mjs', 'edition-authoring/workflow-scripts.mjs', 'edition-authoring/vendor/yaml', 'edition-authoring/sources.mjs', 'edition-authoring/updates.mjs', 'foundation/runtime/seed-contract.mjs', 'foundation/runtime/run-data.mjs', 'foundation/runtime/run-data.d.mts', 'foundation/runtime/contract-docs.mjs'];
|
|
11
11
|
sourceRoots.push('modules/agent-door/capabilities.mjs', 'modules/agent-door/capabilities.d.mts', 'modules/agent-door/conformance', 'modules/agent-door/CLAUSES.md');
|
|
12
|
-
sourceRoots.push('edition-authoring/archive-source.mjs');
|
|
12
|
+
sourceRoots.push('edition-authoring/archive-source.mjs', 'edition-authoring/api-source.mjs');
|
|
13
13
|
sourceRoots.push('edition-authoring/copy-namespaces.mjs');
|
|
14
14
|
sourceRoots.push('edition-authoring/module-packages.mjs');
|
|
15
15
|
sourceRoots.push('foundation/runtime/contract-prose.mjs', 'foundation/runtime/contract-prose-patterns.mjs', 'foundation/runtime/contract-anchor.mjs');
|
package/cli/hosted-export.mjs
CHANGED
|
@@ -24,6 +24,6 @@ export async function refuseHostedExport(project, options) {
|
|
|
24
24
|
...exports,
|
|
25
25
|
...(databases.length ? [] : [' (npx wrangler d1 list names the hosted databases.)']),
|
|
26
26
|
...(buckets.length ? [`Files the hosted install keeps in R2 (${buckets.join(', ')}) are not in that export.`] : []),
|
|
27
|
-
'To export the local copy, run: rer export --output exports/local.rer',
|
|
27
|
+
'To export the local copy, run: ~/.local/bin/rer export --output exports/local.rer',
|
|
28
28
|
].join('\n'));
|
|
29
29
|
}
|
package/cli/hosted-output.mjs
CHANGED
|
@@ -90,7 +90,7 @@ export async function serveHosted(root, { declaration: declarationPath = 'deploy
|
|
|
90
90
|
const build = dirname(join(root, wrangler));
|
|
91
91
|
let config;
|
|
92
92
|
try { config = await read(join(root, wrangler)); }
|
|
93
|
-
catch { throw new RerError('hosted_output_missing', `No production build at ${wrangler}. Run rer build, then rer verify.`, 1); }
|
|
93
|
+
catch { throw new RerError('hosted_output_missing', `No production build at ${wrangler}. Run ~/.local/bin/rer build, then ~/.local/bin/rer verify.`, 1); }
|
|
94
94
|
// The build's own wrangler file says where its assets are: ../client from dist/server.
|
|
95
95
|
const client = resolve(build, config.assets?.directory ?? '../client');
|
|
96
96
|
let declaration;
|
|
@@ -262,7 +262,7 @@ export async function checkHostedOutput(root, options) {
|
|
|
262
262
|
const deployment = body?.deployment ?? {};
|
|
263
263
|
const wrong = health.status !== 200 ? [`HTTP ${health.status}`] : [...(body?.ok === true ? [] : ['ok']), ...['sourceSha', 'fingerprint', 'versionId'].filter(key => deployment[key] !== identity[key]).map(key => `deployment.${key}`)];
|
|
264
264
|
if (wrong.length) failures.push(`/health lacks the deploy identity (${wrong.join(', ')}); it must answer {ok:true, deployment:{sourceSha, fingerprint, versionId}} from RER_DEPLOY_SOURCE, RER_DEPLOY_FINGERPRINT and RER_VERSION.id`);
|
|
265
|
-
if (failures.length) throw new RerError('hosted_output_failed', `The production build would break when hosted: rer deploy runs the Worker before static assets (run_worker_first), and served this way:\n ${failures.join('\n ')}\nServe built files with staticAssetResponse and answer /health with deploymentHealth (SEED-COMMAND-CONTRACT.md, Hosted assets and deploy identity).`, 1, { failures });
|
|
265
|
+
if (failures.length) throw new RerError('hosted_output_failed', `The production build would break when hosted: ~/.local/bin/rer deploy runs the Worker before static assets (run_worker_first), and served this way:\n ${failures.join('\n ')}\nServe built files with staticAssetResponse and answer /health with deploymentHealth (SEED-COMMAND-CONTRACT.md, Hosted assets and deploy identity).`, 1, { failures });
|
|
266
266
|
return { assets: paths.length, health: 'identity' };
|
|
267
267
|
} finally { await hosted.close(); }
|
|
268
268
|
}
|
package/cli/human-error.mjs
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
// Presentation only: the structured error and its captured step stay intact.
|
|
2
|
-
|
|
2
|
+
import { withCommandHelp } from './command-guidance.mjs';
|
|
3
|
+
|
|
4
|
+
export function humanError(error, options = {}) {
|
|
5
|
+
return withCommandHelp(renderError(error, options));
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function renderError(error, { retry } = {}) {
|
|
3
9
|
if (error.humanMessage) return error.humanMessage;
|
|
4
10
|
const text = String(error?.message ?? error);
|
|
5
11
|
const download = /https?:\/\/[^\s"'<>]+/.exec(text)?.[0];
|
|
6
12
|
if (download && /ECONNREFUSED/.test(text)) {
|
|
7
13
|
let url; try { url = new URL(download); } catch {}
|
|
8
14
|
const archive = url && /\/([^/]+)-(\d[^/]*)\.tgz/.exec(url.pathname);
|
|
9
|
-
if (url && archive) return `Could not download a dependency (${archive[1]} ${archive[2]}) because the package registry at ${url.host} refused the connection. Check your network or registry setting, then run: ${retry ?? 'rer install'}.`;
|
|
15
|
+
if (url && archive) return `Could not download a dependency (${archive[1]} ${archive[2]}) because the package registry at ${url.host} refused the connection. Check your network or registry setting, then run: ${retry ?? '~/.local/bin/rer install'}.`;
|
|
10
16
|
}
|
|
11
17
|
const technical = /(?:^|\n)\s*(?:at |[A-Za-z]*Error:)/.test(text);
|
|
12
18
|
if (technical || ['command_failed', 'launch_failed'].includes(error.code ?? error.event?.code)) {
|
|
@@ -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}. Run rer verify, which downloads the browser it pins first.`, 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 ~/.local/bin/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/hydration/check.mjs
CHANGED
|
@@ -50,7 +50,7 @@ export async function checkHydration(root, { origin, pages: declared, declaratio
|
|
|
50
50
|
work.forEach(({ page, item }, index) => { (page.loads ??= []).push({ item, load: loads[index] }); });
|
|
51
51
|
for (const page of pages.filter(page => page.hydrated)) failures.push(...judgePage({ ...page, loads: page.loads ?? [] }));
|
|
52
52
|
const result = {
|
|
53
|
-
served: server.mode === 'hosted' ? 'production build as rer deploy hosts it' : server.origin,
|
|
53
|
+
served: server.mode === 'hosted' ? 'production build as ~/.local/bin/rer deploy hosts it' : server.origin,
|
|
54
54
|
pages: pages.map(page => page.skipped ? { path: page.path, skipped: 'plain HTML: React does not hydrate this page and it loads no application script' } : {
|
|
55
55
|
path: page.path,
|
|
56
56
|
sections: page.survey.sections.map(section => `${section.label} (${section.key})`),
|
package/cli/import-summary.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// Only declared safe replacement values and aggregate counts reach the terminal.
|
|
2
2
|
export function importSummary(details = {}) {
|
|
3
|
-
const { input, tables, target = 'local', objects, captureLog, nextCommand = 'rer setup' } = details;
|
|
3
|
+
const { input, tables, target = 'local', objects, captureLog, nextCommand = '~/.local/bin/rer setup' } = details;
|
|
4
4
|
if (typeof input !== 'string' || !Array.isArray(tables)) return undefined;
|
|
5
5
|
const rows = tables.reduce((sum, table) => sum + (Number.isSafeInteger(table?.count) ? table.count : 0), 0);
|
|
6
6
|
return [
|
|
7
7
|
`Restored ${target === 'local' ? 'the local copy' : 'the hosted install'} from ${input}: ${count(tables.length, 'table')}, ${count(rows, 'row')}${Number.isSafeInteger(objects) ? `, ${count(objects, 'file')}` : ''}.`,
|
|
8
8
|
importSafetySummary(details),
|
|
9
9
|
captureLog && `Full output: ${captureLog}`,
|
|
10
|
-
`Next: ${nextCommand}${target === 'local' ? ', then rer dev to open the restored app' : ''}.`,
|
|
10
|
+
`Next: ${nextCommand}${target === 'local' ? ', then ~/.local/bin/rer dev to open the restored app' : ''}.`,
|
|
11
11
|
].filter(Boolean).join('\n');
|
|
12
12
|
}
|
|
13
13
|
const count = (value, noun) => `${value.toLocaleString('en-US')} ${noun}${value === 1 ? '' : 's'}`;
|