@runeditrun/rer 0.2.55 → 0.2.57

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 CHANGED
@@ -79,6 +79,17 @@ destination refuses rows erased since. Erasure-fence refusals (`erased_row`,
79
79
  available only when the adapter declares complete resource coverage; an
80
80
  unsupported target exits 4.
81
81
 
82
+ Import defaults to `--target local`. An explicit `--origin` is accepted for a
83
+ local import only when it uses HTTP, its host is exactly `localhost`,
84
+ `127.0.0.1` or `[::1]`, and its port matches this checkout's configured local
85
+ dev port. Use the checkout's saved port, not an assumed 8787; without a saved
86
+ origin the local default is 8787. Every HTTPS origin, other host (including a
87
+ front-door `NAME.localhost`) or different port requires `--target remote`.
88
+ Otherwise import refuses before archive access or preparation hooks run.
89
+ Omitting `--origin`, or supplying a matching local origin, keeps the existing
90
+ local restore behavior. Explicit remote selection still requires an adapter
91
+ that supports complete remote import; it does not enable that capability.
92
+
82
93
  Local D1 transfer includes SQLite VIRTUAL and STORED generated columns. Archives
83
94
  retain their schema and carry only writable base cells; native expressions and
84
95
  indexes in the migrated destination recompute on restore. The public runner's
@@ -0,0 +1,19 @@
1
+ import { savedOrigin } from './door-mode.mjs';
2
+ import { refuse } from './errors.mjs';
3
+ import { listenHost } from './parse.mjs';
4
+ import { defaultPort } from './port.mjs';
5
+
6
+ // Origin never selected the import target: an omitted target restores locally.
7
+ // Check before runtime selection, queue admission, recovery or archive access.
8
+ // savedOrigin reads settings without readSettings' directory preparation.
9
+ export async function importOriginRefusal(project, options) {
10
+ const origin = new URL(options.origin);
11
+ if (origin.protocol === 'http:' && listenHost(origin.hostname.replace(/^\[|\]$/g, ''))) {
12
+ const saved = await savedOrigin(project);
13
+ let local;
14
+ try { if (saved) local = new URL(saved); } catch { /* Lifecycle reports malformed saved settings. */ }
15
+ const port = local ? Number(local.port || 80) : defaultPort;
16
+ if (Number(origin.port || 80) === port) return;
17
+ }
18
+ return refuse(`--origin ${origin.origin} is not this computer's app; to import into the hosted app use --target remote, or drop --origin to restore the local app.`);
19
+ }
package/cli/main.mjs CHANGED
@@ -23,10 +23,20 @@ export async function main(argv = process.argv.slice(2)) {
23
23
  options=parse(argv,process.cwd(),{independent});out=output(options);
24
24
  if (options.help) return showHelp(options,out);
25
25
  if (!independent && options.forwarded.length) throw invalid('First-party commands accept only the documented flags, without forwarded arguments.');
26
+ let project;
27
+ if (!independent && options.verb === 'import' && options.origin !== undefined && options.target !== 'remote') {
28
+ project = await resolveProject(options.cwd);
29
+ const refusal = await (await import('./import-origin.mjs')).importOriginRefusal(project, options);
30
+ if (refusal) {
31
+ out.error(refusal);
32
+ if (options.json) out.result(false, refusal.exitCode);
33
+ return refusal.exitCode;
34
+ }
35
+ }
26
36
  if(options.noQueue){const {shared}=await import('./shared.mjs');const {commandPolicy}=await shared('queue.mjs');const policy=await commandPolicy();try{if(!policy.ci)throw invalid('--no-queue requires the original caller CI=true.');}finally{await policy.close();}}
27
37
  const runtime = await selectNodeRuntime(options, argv, out);
28
38
  if (runtime) return runtime.exitCode;
29
- const project = await resolveProject(options.cwd);
39
+ project ??= await resolveProject(options.cwd);
30
40
  if (project.profile === 'independent' && !['describe', 'check', 'doctor'].includes(options.verb)) options = parse(argv, process.cwd(), { independent: true });
31
41
  else if (options.forwarded.length) throw invalid('First-party commands accept only the documented flags, without forwarded arguments.');
32
42
  out = output(options);
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.57
4
+
5
+ - **Large release scans finish within the publication budget.** The JSON identity pass tracks UTF-8 byte offsets incrementally. Orbit's scan finishes in 79 seconds instead of exceeding the 300-second deadline, with identical findings (#270).
6
+ - **Hosted restore intent must be explicit.** `rer import --origin <hosted-url>` refuses unless `--target remote` is supplied, before inspecting archives or touching local data. Local origins at the saved port and imports without an origin continue to restore locally (#271).
7
+
8
+ ## 0.2.56
9
+
10
+ - **Run pages keep inline words and paths whole.** Inline code wraps only between words, so seed names such as `run-linen`, repository paths and start commands no longer split mid-word. Command blocks stay clear of Copy and copied text keeps its original bytes. Seeds receive the template on their next Base-copy refresh (#266).
11
+
3
12
  ## 0.2.55
4
13
 
5
14
  - **Business works across agent turns.** `business connect` resumes browser-approved pairing without terminal prompts, prints a runnable npx or installed-launcher resume command, and reads browser opt-ins after credential storage. Local discovery accepts raw and encoded task upload paths and reports failed work. Disconnect revokes the device on the server before removing its local credential; an unsupported or unconfirmed revocation keeps the connection and explains the browser action (#248).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runeditrun/rer",
3
- "version": "0.2.55",
3
+ "version": "0.2.57",
4
4
  "description": "The rer command: install, set up, run and launch Run Edit Run checkouts.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -14,6 +14,16 @@ class Document:
14
14
  self.data = data
15
15
  text = data.decode('utf-8')
16
16
  self.spans = {}
17
+ char_at = byte_at = 0
18
+
19
+ def byte_offset(at):
20
+ nonlocal char_at, byte_at
21
+ # Parsing visits string spans in source order. Encode each intervening
22
+ # segment once, including UTF-8 in keys and non-identity values.
23
+ byte_at += len(text[char_at:at].encode('utf-8'))
24
+ char_at = at
25
+ return byte_at
26
+
17
27
  def invalid_constant(_):
18
28
  raise ValueError('Non-JSON constant')
19
29
 
@@ -57,7 +67,7 @@ class Document:
57
67
  at = whitespace(at + 1)
58
68
  value, end = decoder.raw_decode(text, at)
59
69
  if isinstance(value, str) and (HEX.fullmatch(value) or GIT_REVISION.fullmatch(value)):
60
- self.spans[pointer] = (len(text[:at].encode('utf-8')), len(text[:end].encode('utf-8')), value)
70
+ self.spans[pointer] = (byte_offset(at), byte_offset(end), value)
61
71
  return value, end
62
72
 
63
73
  self.value, end = parse(0, ())