@runeditrun/rer 0.2.107 → 0.2.109

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/README.md CHANGED
@@ -43,8 +43,10 @@ The installer needs no Node: without Node 22 or later on PATH it installs a
43
43
  private one for `rer` (see below). It edits no shell profile. The second step
44
44
  uses the installed launcher directly, so it works in the same shell without
45
45
  changing PATH: a child installer cannot change its parent shell’s PATH, and bare
46
- `rer` needs `~/.local/bin` on PATH. After the app opens, an optional
47
- `rer cli path` step explains how to make `rer` available in future terminals.
46
+ `rer` needs `~/.local/bin` on PATH. When the PATH the installer saw lacks
47
+ `~/.local/bin`, its closing lines give one required step: the
48
+ `export PATH="$HOME/.local/bin:$PATH"` line to run now and add to your shell
49
+ startup file, or `rer cli path` (by its absolute launcher) for other shells.
48
50
  The same start also fits on one line:
49
51
 
50
52
  ```sh
@@ -84,9 +86,10 @@ With no Node 22 or later on PATH, the script installs Node 22.20.0 from
84
86
  verifies the tarball against that release's published `SHASUMS256.txt`, and
85
87
  prints its location. The launcher uses this private runtime on later runs.
86
88
  System Node is left alone. With no arguments, the installer prints an app-start
87
- command using its absolute launcher. After a first launch, `rer cli path` shows
88
- an optional shell-specific line to make `rer` available in future terminals.
89
- Only running that line changes a shell startup file; `rer` never edits one.
89
+ command using its absolute launcher. With a supplied command and no
90
+ `~/.local/bin` on PATH, it ends with the PATH line to run and keep, and
91
+ `rer cli path` shows the shell-specific line to make `rer` available in future
92
+ terminals. Only running that line changes a shell startup file; `rer` never edits one.
90
93
  A re-run with the same build changes nothing; a different build keeps the
91
94
  previous version and removes older ones. It refuses to replace a launcher it
92
95
  did not write.
@@ -1,11 +1,34 @@
1
1
  // `rer check` on a seed's CONTRACT.md: the Status table parses, and every
2
2
  // evidence path it cites is in the checkout. A seed without CONTRACT.md has
3
3
  // nothing to check here.
4
+ //
5
+ // One exception, and only in a managed copy: the platform installs a published
6
+ // release without the publisher's repository automation (everything under
7
+ // `.github/workflows`, plus `.github/dependabot.yml`), so an evidence path in
8
+ // that set cannot be in the copy. A checkout is a managed copy only when it
9
+ // carries the platform's committed release record, `rer-upstream.json`, exactly
10
+ // as the platform writes it (a regular file, schema 1, and exactly the keys
11
+ // repository, tag and commit). Every other path stays a hard check there, and
12
+ // an authoring checkout checks everything.
4
13
  import { lstat, readFile } from 'node:fs/promises';
5
14
  import { isAbsolute, join, normalize, sep } from 'node:path';
6
15
  import { ContractError, parseContract } from '../foundation/runtime/seed-contract.mjs';
7
16
 
8
17
  const file = 'CONTRACT.md';
18
+ const releaseRecord = 'rer-upstream.json';
19
+ const automation = /^\.github\/(?:workflows(?:\/|$)|dependabot\.ya?ml$)/;
20
+
21
+ async function isManagedCopy(root) {
22
+ try {
23
+ const path = join(root, releaseRecord);
24
+ const stat = await lstat(path);
25
+ if (!stat.isFile() || stat.size > 4096) return false;
26
+ const value = JSON.parse(await readFile(path, 'utf8'));
27
+ return !!value && typeof value === 'object' && !Array.isArray(value) && Object.keys(value).sort().join(',') === 'commit,repository,schema,tag'
28
+ && value.schema === 1 && /^[A-Za-z0-9][A-Za-z0-9-]{0,38}\/[A-Za-z0-9._-]{1,100}$/.test(value.repository)
29
+ && /^v?(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/.test(value.tag) && /^[a-f0-9]{40}$/i.test(value.commit);
30
+ } catch { return false; }
31
+ }
9
32
 
10
33
  export async function contractStatusClauses(root) {
11
34
  let text;
@@ -16,8 +39,13 @@ export async function contractStatusClauses(root) {
16
39
  return error.problems.map(problem => ({ id: 'CONTRACT.status', ok: false, message: `${file}:${problem.line}: ${problem.message}` }));
17
40
  }
18
41
  const clauses = [{ id: 'CONTRACT.status', ok: true }];
42
+ const managed = await isManagedCopy(root);
19
43
  for (const clause of contract.clauses) for (const path of clause.evidence) {
20
44
  const inside = !isAbsolute(path) && !normalize(path).split(sep).includes('..');
45
+ if (managed && inside && automation.test(normalize(path).split(sep).join('/'))) {
46
+ clauses.push({ id: `CONTRACT.evidence.${clause.id}`, ok: true, message: `${file}:${clause.row}: ${clause.id} evidence ${path} is publisher repository automation, skipped in a managed copy.` });
47
+ continue;
48
+ }
21
49
  let exists = false;
22
50
  if (inside) try { await lstat(join(root, path)); exists = true; } catch {}
23
51
  clauses.push({ id: `CONTRACT.evidence.${clause.id}`, ok: exists, ...(!exists ? { message: `${file}:${clause.row}: ${clause.id} is ${clause.status} with evidence ${path}, which ${inside ? 'is not in this checkout' : 'is outside this repository'}.` } : {}) });
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.109
4
+
5
+ ### `rer check` in a managed copy
6
+
7
+ - `rer check` no longer fails a managed copy for contract evidence it never carries. A managed copy is installed without the publisher's repository automation, so a `CONTRACT.md` clause citing a file under `.github/workflows/` or `.github/dependabot.yml` failed `CONTRACT.evidence.<ID>` with "is not in this checkout" (a first managed build of an installed seed failed this way on a workflow file). Those evidence paths are now skipped: the clause passes and its message says the path is publisher repository automation, skipped in a managed copy.
8
+ - The skip applies only when the checkout is positively a managed copy: it carries the platform's `rer-upstream.json` release record exactly as written (a regular file of at most 4 KiB, schema 1, with exactly the keys `repository`, `tag` and `commit`, each well-formed). The platform writes that record only when the installed source commit is a published release, so a managed copy installed from an untagged commit has no record and keeps the hard existence check for every evidence path. Every other evidence path in a managed copy, and every path in an authoring checkout (no record), stays a hard check as before.
9
+ - The seed command contract (`SEED-COMMAND-CONTRACT.md`, in the default seed and the export) describes the rule.
10
+ - Code only: no migration is added. A seed gets this by adopting 0.2.109; nothing here is live in any deployed seed until that seed adopts and deploys it.
11
+
12
+ ## 0.2.108
13
+
14
+ ### Installer PATH step
15
+
16
+ - After `curl -fsSL https://runeditrun.com/install.sh | sh -s -- dev <owner/repo>` (or any supplied command except `business`), a later bare `rer` in a new terminal whose PATH lacks `~/.local/bin` failed with `rer: command not found`, and the installer only offered an "Optional" step inside the app. When `~/.local/bin` is not on the PATH the installer saw, its closing lines now give one required step: the `export PATH="$HOME/.local/bin:$PATH"` line to run and keep in the shell startup file, and `~/.local/bin/rer cli path` (the absolute launcher) for other shells, in place of the app's optional sentence (the installer sets `RER_INSTALLER_PATH_STEP`, which makes `rer dev` skip that sentence). The installer stays silent when `~/.local/bin` is already on PATH, edits no shell file, keeps the command's exit code, and leaves `business` commands free of shell advice.
17
+ - The one-line installer is served from the release asset (`install.sh` in the release), so a user gets this only once this release is published; runs of the installer from an older release are unchanged.
18
+ - The seed README template (`foundation/template` README.md and OPERATIONS.md, and the default seed's README.md and RUN-LOCALLY.md, with the exported RUN-LOCALLY.md) shows the same line beside its first bare `rer dev`. A seed gets that wording only by adopting it.
19
+ - Code and docs only: no migration is added. Nothing here is live in any deployed seed until that seed adopts and deploys it.
20
+
3
21
  ## 0.2.107
4
22
 
5
23
  ### Deploy mail notice and secret names
package/global/README.md CHANGED
@@ -43,8 +43,10 @@ The installer needs no Node: without Node 22 or later on PATH it installs a
43
43
  private one for `rer` (see below). It edits no shell profile. The second step
44
44
  uses the installed launcher directly, so it works in the same shell without
45
45
  changing PATH: a child installer cannot change its parent shell’s PATH, and bare
46
- `rer` needs `~/.local/bin` on PATH. After the app opens, an optional
47
- `rer cli path` step explains how to make `rer` available in future terminals.
46
+ `rer` needs `~/.local/bin` on PATH. When the PATH the installer saw lacks
47
+ `~/.local/bin`, its closing lines give one required step: the
48
+ `export PATH="$HOME/.local/bin:$PATH"` line to run now and add to your shell
49
+ startup file, or `rer cli path` (by its absolute launcher) for other shells.
48
50
  The same start also fits on one line:
49
51
 
50
52
  ```sh
@@ -84,9 +86,10 @@ With no Node 22 or later on PATH, the script installs Node 22.20.0 from
84
86
  verifies the tarball against that release's published `SHASUMS256.txt`, and
85
87
  prints its location. The launcher uses this private runtime on later runs.
86
88
  System Node is left alone. With no arguments, the installer prints an app-start
87
- command using its absolute launcher. After a first launch, `rer cli path` shows
88
- an optional shell-specific line to make `rer` available in future terminals.
89
- Only running that line changes a shell startup file; `rer` never edits one.
89
+ command using its absolute launcher. With a supplied command and no
90
+ `~/.local/bin` on PATH, it ends with the PATH line to run and keep, and
91
+ `rer cli path` shows the shell-specific line to make `rer` available in future
92
+ terminals. Only running that line changes a shell startup file; `rer` never edits one.
90
93
  A re-run with the same build changes nothing; a different build keeps the
91
94
  previous version and removes older ones. It refuses to replace a launcher it
92
95
  did not write.
@@ -48,10 +48,11 @@ export async function launchDev(target) {
48
48
  catch (failure) { if (!(failure instanceof LaunchFailure)) throw failure; process.stderr.write(failure.message + '\n'); return failure.exitCode; }
49
49
  }
50
50
  showBudget(devArgs);
51
- // The launch never asks for shell edits. Offer the optional step only at ready.
51
+ // The launch never asks for shell edits. Offer the optional step only at ready,
52
+ // and not when install.sh closes with its own required PATH step.
52
53
  delete process.env.RER_LAUNCH_PATH_STEP;
53
54
  const paths = layout();
54
- if (await access(paths.launcher).then(() => true, () => false) && await pathAdvice(paths)) process.env.RER_LAUNCH_PATH_STEP = `Optional, after opening your app: make rer available in future terminals. Run ${shellQuote(paths.launcher)} cli path to see the shell step; it changes no shell file itself.`;
55
+ if (!process.env.RER_INSTALLER_PATH_STEP && await access(paths.launcher).then(() => true, () => false) && await pathAdvice(paths)) process.env.RER_LAUNCH_PATH_STEP = `Optional, after opening your app: make rer available in future terminals. Run ${shellQuote(paths.launcher)} cli path to see the shell step; it changes no shell file itself.`;
55
56
  const here = await realpath(process.cwd()).catch(() => undefined);
56
57
  const out = printer({ root: checkout, json: devArgs.includes('--json'), stopHint: `rer dev --stop${here === checkout ? '' : ` --cwd ${JSON.stringify(checkout)}`}`, keyless: doorStart });
57
58
  const detach = args.includes('--detach') || (!args.includes('--foreground') && !process.stdout.isTTY);
package/install.sh CHANGED
@@ -12,7 +12,8 @@
12
12
  # package's own `rer cli install`: the same layout as
13
13
  # `npx -y @runeditrun/rer cli install`. A failure leaves any previous install
14
14
  # selected and working. It never edits shell profiles: when ~/.local/bin is not
15
- # on PATH, the absolute launcher works now; shell setup is optional after launch.
15
+ # on PATH, the absolute launcher works now, and a run that supplied a command ends
16
+ # with the one PATH line to run and keep.
16
17
  #
17
18
  # Needs curl and tar. If Node 22 or later is absent, installs the pinned official
18
19
  # Node release in rer's own data directory. macOS/Linux x64/arm64; Windows: WSL2.
@@ -150,8 +151,8 @@ NODE
150
151
  export RER_TRANSFER_RER_BYTES
151
152
  mkdir "$work/stage"
152
153
  tar -xzf "$work/rer.tgz" -C "$work/stage" || fail "could not unpack rer $version; nothing was installed."
153
- # A supplied command replaces the app next step. Shell setup is offered only
154
- # after the app is ready, through the optional rer cli path command.
154
+ # A supplied command replaces the app next step. When ~/.local/bin is not on
155
+ # the caller's PATH, the closing lines below give the shell step.
155
156
  no_next=
156
157
  if [ "$#" -gt 0 ]; then no_next=1; fi
157
158
  RER_INSTALL_CHANNEL=script RER_INSTALL_NO_NEXT=$no_next "$node_binary" "$work/stage/package/global/rer.mjs" cli install </dev/null \
@@ -164,9 +165,23 @@ NODE
164
165
  # where ~/.local/bin may not be on PATH yet.
165
166
  RER_INVOKED_AS="$HOME/.local/bin/rer"
166
167
  if [ "$(command -v rer 2>/dev/null || true)" = "$RER_INVOKED_AS" ]; then RER_INVOKED_AS=rer; fi
168
+ # The caller's own PATH decides whether a later bare `rer` works. Read it before
169
+ # it is extended for the command below. Business connect stays free of shell advice.
170
+ path_step=
171
+ case ":$PATH:" in
172
+ *":$HOME/.local/bin:"* | *":$HOME/.local/bin/:"*) ;;
173
+ *) if [ "$1" != business ]; then path_step=1; fi ;;
174
+ esac
167
175
  PATH="$PATH:$HOME/.local/bin"
168
176
  export PATH RER_INVOKED_AS
169
- "$HOME/.local/bin/rer" "$@"
177
+ # The closing lines replace the app's own optional PATH sentence, never repeat it.
178
+ if [ -n "$path_step" ]; then RER_INSTALLER_PATH_STEP=1; export RER_INSTALLER_PATH_STEP; fi
179
+ status=0
180
+ "$HOME/.local/bin/rer" "$@" || status=$?
181
+ if [ -n "$path_step" ]; then
182
+ printf '\nRequired next step: %s/.local/bin is not on your PATH, so a bare `rer` in a new terminal says "rer: command not found". Run this in the terminal you will use, and add the same line to your shell startup file (~/.zshrc for zsh, ~/.bashrc for bash):\n export PATH="$HOME/.local/bin:$PATH"\nOther shells, such as fish: run %s/.local/bin/rer cli path to see the line for yours. Until then, start rer with %s/.local/bin/rer. This installer changes no shell file.\n' "$HOME" "$HOME" "$HOME"
183
+ fi
184
+ return "$status"
170
185
  }
171
186
 
172
187
  install_node() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runeditrun/rer",
3
- "version": "0.2.107",
3
+ "version": "0.2.109",
4
4
  "description": "The rer command: install, set up, run and launch Run Edit Run checkouts.",
5
5
  "license": "MIT",
6
6
  "type": "module",