@runeditrun/rer 0.2.108 → 0.2.110
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/contract-status.mjs +28 -0
- package/cli/deploy-command.mjs +3 -0
- package/cli/deploy-inputs.mjs +1 -1
- package/cli/deploy-needs.mjs +12 -1
- package/cli/inspect.mjs +17 -10
- package/cli/lifecycle.mjs +3 -1
- package/cli/pnpm-chatter.mjs +25 -0
- package/global/CHANGELOG.md +29 -0
- package/global/cli/path-link.mjs +1 -1
- package/global/launch/dev.mjs +2 -2
- package/global/main.mjs +1 -1
- package/modules/operator-auth/README.md +1 -1
- package/modules/operator-auth/accounts/admin.mjs +9 -3
- package/modules/operator-auth/accounts/one-click.mjs +6 -1
- package/modules/operator-auth/dev-gate.mjs +2 -2
- package/modules/operator-auth/identity/email-link/index.mjs +2 -0
- package/modules/operator-auth/index.d.mts +2 -1
- package/package.json +1 -1
package/cli/contract-status.mjs
CHANGED
|
@@ -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'}.` } : {}) });
|
package/cli/deploy-command.mjs
CHANGED
|
@@ -201,6 +201,9 @@ export async function deployCommand(context) {
|
|
|
201
201
|
const outcome = error.owner ?? claimed ?? observedClaims.at(-1)?.outcome;
|
|
202
202
|
const state = deployed?.deployed || recorded ? `The application is deployed at ${deployed?.origin ?? recorded.origin}; ${outcome ? `owner ${outcome}` : 'owner claim is not confirmed'}${recorded ? '; setup token retirement is not confirmed' : ''}.` : options.dryRun ? 'The dry run did not finish; nothing was deployed.' : 'The custom deploy did not finish; inspect its deployment record before recovery.';
|
|
203
203
|
const redact = value => store.redact?.(redaction.redact(value)) ?? redaction.redact(value);
|
|
204
|
+
// A dry run whose own step stopped (a build, a seed's input check) has already printed why.
|
|
205
|
+
// Say it once: which step, its exit code and the same dry run to repeat. Nothing is deployed.
|
|
206
|
+
if (options.dryRun && Number.isInteger(error.childExitCode)) throw commandFailure(redact(`The dry run did not finish; nothing was deployed. ${error.message.split('\n', 1)[0].replace(', signal none.', '.')}\nWhat it printed above names the cause. Fix it and run ${again} again.`));
|
|
204
207
|
const setup = hostedSetupFailure(error, { origin: deployed?.origin ?? recorded?.origin, again });
|
|
205
208
|
if (setup) throw commandFailure(redact(setup));
|
|
206
209
|
const readiness = mutationReadinessFailure(error, { again, redact });
|
package/cli/deploy-inputs.mjs
CHANGED
|
@@ -98,5 +98,5 @@ export async function withDeployEnvironment(project, options, out, run) {
|
|
|
98
98
|
|
|
99
99
|
export function deployAgain(options) {
|
|
100
100
|
const quote = value => /^[a-zA-Z0-9_./-]+$/.test(value) ? value : `'${String(value).replaceAll("'", "'\"'\"'")}'`;
|
|
101
|
-
return `rer deploy --environment ${quote(options.environment ?? 'production')}${options.envFile ? ` --env-file ${quote(options.envFile)}` : ''}${options.cwd ? ` --cwd ${quote(relative(process.cwd(), options.cwd) || '.')}` : ''}`;
|
|
101
|
+
return `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
102
|
}
|
package/cli/deploy-needs.mjs
CHANGED
|
@@ -40,12 +40,23 @@ export function missingCredentialsMessage(declaration, env, { dryRun = false, si
|
|
|
40
40
|
...(dryRun ? ['Needed for a real deploy (the dry run could not check the target):', ...neededForRealDeploy({declaration,env,signIn}).map(item => ` - ${item}`)] : [])].join('\n');
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
// Naming a binding by the environment name a person sets can turn "MAIL_API_KEY (or
|
|
44
|
+
// SENDGRID_API_KEY)" into the same name twice: say each name once.
|
|
45
|
+
function onceEach(text) {
|
|
46
|
+
return text
|
|
47
|
+
.replace(/\b([A-Z][A-Z0-9_]*) or \1\b/g, '$1')
|
|
48
|
+
.replace(/\b([A-Z][A-Z0-9_]*) \(or ([^)]*)\)/g, (all, first, rest) => {
|
|
49
|
+
const others = [...new Set(rest.split(' / ').map(name => name.trim()))].filter(name => name !== first);
|
|
50
|
+
return others.length ? `${first} (or ${others.join(' / ')})` : first;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
43
54
|
// Setup guidance and failed dry-run inputs. After target resolution, held
|
|
44
55
|
// secrets no longer count as missing local inputs.
|
|
45
56
|
export function neededForRealDeploy({ declaration, env, signIn, secretsChecked = false }) {
|
|
46
57
|
const declared = (Array.isArray(declaration.secrets) ? declaration.secrets : []).filter(item => item?.environment);
|
|
47
58
|
// Sign-in names its inputs by binding; a person sets the environment name the declaration maps to it.
|
|
48
|
-
const mail = signIn && declared.reduce((text, item) => item.binding === item.environment ? text : text.replace(new RegExp(`\\b${item.binding}\\b`, 'g'), item.environment), signIn);
|
|
59
|
+
const mail = signIn && onceEach(declared.reduce((text, item) => item.binding === item.environment ? text : text.replace(new RegExp(`\\b${item.binding}\\b`, 'g'), item.environment), signIn));
|
|
49
60
|
const listed = name => cloudflareCredentials.includes(name) || mail && new RegExp(`\\b${name}\\b`).test(mail);
|
|
50
61
|
const secrets = secretsChecked ? [] : [...new Set(declared.filter(item => !item.optional && !env[item.environment]?.trim()).map(item => item.environment))].filter(name => !listed(name));
|
|
51
62
|
const credentials = secretsChecked ? [] : cloudflareCredentials.filter(name => !env[name]?.trim());
|
package/cli/inspect.mjs
CHANGED
|
@@ -25,7 +25,6 @@ import { deliveryDeclarationClauses } from './delivery-declarations.mjs';
|
|
|
25
25
|
import { checkoutPlaceholderMarks } from './placeholder-mark.mjs';
|
|
26
26
|
import { contractStatusClauses } from './contract-status.mjs';
|
|
27
27
|
import { hostedExportCommand } from './hosted-export-command.mjs';
|
|
28
|
-
import { cloudflareCredentials } from './deploy-needs.mjs';
|
|
29
28
|
import { agentSurfaceClauses } from './agent-surface.mjs';
|
|
30
29
|
|
|
31
30
|
// cliVersion: the rer version of the code answering (absent for a vendored copy
|
|
@@ -206,16 +205,12 @@ const usePnpm = directory => {
|
|
|
206
205
|
process.env.PATH = [process.env.PATH, directory, dirname(process.execPath)].filter(value => value !== undefined).join(delimiter);
|
|
207
206
|
};
|
|
208
207
|
|
|
208
|
+
// The deploy kit's trusted build workflow supplies these (modules/deploy-kit/README.md); a person's computer never does.
|
|
209
|
+
const buildWorkflowInput = /^RER_(?:PREPARE|DEPLOY)_[A-Z0-9_]+$/;
|
|
210
|
+
|
|
209
211
|
export async function doctor(project, store, signal) {
|
|
210
212
|
const { inspectOperations } = await import('../operations/operations.mjs');
|
|
211
213
|
const diagnostic = await inspectOperations(project.root);
|
|
212
|
-
// The operations declaration includes deployment prerequisites. Local health
|
|
213
|
-
// does not require an account, and doctor never checks provider access.
|
|
214
|
-
const deploymentInputs = project.profile === 'first-party' ? diagnostic.missingEnvironment.filter(name => cloudflareCredentials.includes(name)) : [];
|
|
215
|
-
if (deploymentInputs.length) {
|
|
216
|
-
diagnostic.missingEnvironment = diagnostic.missingEnvironment.filter(name => !deploymentInputs.includes(name));
|
|
217
|
-
diagnostic.ok = diagnostic.commands.every(command => command.available) && !diagnostic.missingEnvironment.length && diagnostic.configuration === 'valid' && (diagnostic.loops ?? []).every(loop => ['ready', 'optional-disabled'].includes(loop.status));
|
|
218
|
-
}
|
|
219
214
|
const { localVariables } = await shared('local/environment.mjs');
|
|
220
215
|
let values = {}, pnpm, expectedPnpm, stateIssue, stateValid = true;
|
|
221
216
|
const pnpmIssues = [];
|
|
@@ -247,12 +242,24 @@ export async function doctor(project, store, signal) {
|
|
|
247
242
|
const dependencies=project.profile==='first-party'?await dependencyDoctor(project.root):[];
|
|
248
243
|
const expectedNode = await projectNodePin(project.root);
|
|
249
244
|
const inputs = project.profile === 'first-party' ? requiredLocalSettings(project, values) : [];
|
|
245
|
+
// The operations declaration also lists what a deployment needs, and the inputs a hosted build
|
|
246
|
+
// workflow supplies. Local health needs neither an account nor that workflow: a first-party
|
|
247
|
+
// checkout is ready when its local setup is done (the check `rer dev` makes), and doctor never
|
|
248
|
+
// checks provider access. Deploy inputs are named as optional; workflow inputs not at all.
|
|
249
|
+
const firstParty = project.profile === 'first-party';
|
|
250
|
+
const workflowInputs = firstParty ? diagnostic.missingEnvironment.filter(name => buildWorkflowInput.test(name)) : [];
|
|
251
|
+
const deploymentInputs = firstParty ? diagnostic.missingEnvironment.filter(name => !buildWorkflowInput.test(name) && !inputs.includes(name) && !(typeof values[name] === 'string' && values[name].trim())) : [];
|
|
252
|
+
if (firstParty) {
|
|
253
|
+
diagnostic.missingEnvironment = diagnostic.missingEnvironment.filter(name => inputs.includes(name));
|
|
254
|
+
diagnostic.ok = diagnostic.commands.every(command => command.available) && !diagnostic.missingEnvironment.length && diagnostic.configuration === 'valid' && (diagnostic.loops ?? []).every(loop => ['ready', 'optional-disabled'].includes(loop.status));
|
|
255
|
+
}
|
|
256
|
+
const setupNeeded = firstParty ? !(await localState(project)).prepared : false;
|
|
250
257
|
const warnings = project.profile === 'first-party' ? await cacheWarnings(project.root) : [];
|
|
251
258
|
return { dependencies, warnings, browser, operations: diagnostic, ok: browser?.ok !== false && !aiIssues.length && dependencies.every(d=>d.ok) && diagnostic.ok && stateValid && !inputs.length && (project.profile !== 'first-party' || (Boolean(expectedPnpm) && process.versions.node === expectedNode && pnpm === expectedPnpm)),
|
|
252
259
|
node: { actual: process.versions.node, expected: expectedNode },
|
|
253
260
|
pnpm: project.profile === 'first-party' ? { actual: pnpm, expected: expectedPnpm ?? null, ...(pnpmIssues.length ? { issue: [...new Set(pnpmIssues)].join('\n') } : {}) } : undefined,
|
|
254
261
|
ai: { issues: aiIssues },
|
|
255
|
-
missingInputs: [...new Set([...diagnostic.missingEnvironment, ...inputs])], deploymentInputs,
|
|
262
|
+
missingInputs: [...new Set([...diagnostic.missingEnvironment, ...inputs])], deploymentInputs, workflowInputs, setupNeeded: setupNeeded || (!firstParty && diagnostic.missingEnvironment.length > 0),
|
|
256
263
|
sources: project.descriptor.environmentSources ?? {}, state: { path: project.adapter?.state, safe: stateValid, ...(stateIssue ? { issue: stateIssue } : {}) }, scope: 'local-inputs-only' };
|
|
257
264
|
}
|
|
258
265
|
|
|
@@ -266,7 +273,7 @@ export function doctorSummary(result) {
|
|
|
266
273
|
if (result.missingInputs.length) {
|
|
267
274
|
lines.push('Missing local inputs:');
|
|
268
275
|
for (const name of result.missingInputs) lines.push(` ${name}${result.sources[name] ? `: ${result.sources[name]}` : ''}`);
|
|
269
|
-
lines.push('Run rer setup to configure this checkout.');
|
|
276
|
+
if (result.setupNeeded) lines.push('Run rer setup to configure this checkout.');
|
|
270
277
|
}
|
|
271
278
|
const unavailable = result.operations.commands.filter(command => !command.available);
|
|
272
279
|
if (unavailable.length) lines.push('Unavailable command inputs:', ...unavailable.map(command => ` ${command.name}: restore its declared input files.`));
|
package/cli/lifecycle.mjs
CHANGED
|
@@ -18,6 +18,7 @@ import { rememberSetupAnswers } from './setup-answers.mjs';
|
|
|
18
18
|
import { ensureDevKey, refuseDevLayerOutput } from './dev-identity.mjs';
|
|
19
19
|
import { withoutLocalSettings, refuseLocalEnvOutput } from './local-env.mjs';
|
|
20
20
|
import { announceDoorRoute } from './door-mode.mjs';
|
|
21
|
+
import { withoutPnpmChatter } from './pnpm-chatter.mjs';
|
|
21
22
|
|
|
22
23
|
export async function runCommand(project, options, out) {
|
|
23
24
|
if (project.profile === 'first-party' && ['build', 'dev', 'preview', 'deploy'].includes(options.verb)) {
|
|
@@ -80,7 +81,8 @@ async function runLifecycle(project, options, out, deployRedaction) {
|
|
|
80
81
|
const capture = ['.seed', 'installer', ...(process.env.RER_LOCAL_OPERATION || process.env.RER_ONBOARDING_PROCESS_OWNER ? [`commands-${process.pid}`] : [])];
|
|
81
82
|
const directory = project.profile === 'first-party' && options.verb !== 'doctor' ? await privateDirectory(project.root, capture) : (temporary = await mkdtemp(join(tmpdir(), 'rer-command-')));
|
|
82
83
|
const state = { logs: [] };
|
|
83
|
-
|
|
84
|
+
const progress = text => { if (!installingFrozen || options.json) out.progress(text); };
|
|
85
|
+
store = await createCommands(directory, state, { terminal: options.verb === 'deploy' && options.dryRun ? withoutPnpmChatter(progress) : progress, onWaiting: options.json ? details => out.event('waiting', details) : undefined, queue: ['install','setup','build','verify','deploy','export','import'].includes(options.verb)?{verb:options.verb,originalCI:process.env.CI==='true'}:undefined });
|
|
84
86
|
store.state = state;
|
|
85
87
|
if (deployRedaction) store.addSecrets?.(Object.values(process.env).filter(value => value && deployRedaction.redact(value) !== value));
|
|
86
88
|
store.setupManifest = project.setupManifest;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// A failing `pnpm run` script is wrapped in pnpm's own lines: a banner before it and
|
|
2
|
+
// "ELIFECYCLE Command failed" after it. rer states the failure itself, once, so a
|
|
3
|
+
// step's terminal output can leave those lines out. The step's log keeps every byte.
|
|
4
|
+
const header = /^> \S*@\S* \S+ \S.*$/, elifecycle = /^\s*ELIFECYCLE\s+Command failed with exit code \d+\.\s*$/;
|
|
5
|
+
|
|
6
|
+
export function withoutPnpmChatter(write) {
|
|
7
|
+
let banner = false;
|
|
8
|
+
return text => {
|
|
9
|
+
const lines = String(text).split('\n'), last = lines.pop();
|
|
10
|
+
const kept = [];
|
|
11
|
+
for (const line of lines) {
|
|
12
|
+
if (banner) {
|
|
13
|
+
// The banner's command line, then the blank line that closes it.
|
|
14
|
+
if (/^> .+$/.test(line)) continue;
|
|
15
|
+
banner = false;
|
|
16
|
+
if (line === '') continue;
|
|
17
|
+
}
|
|
18
|
+
if (elifecycle.test(line)) continue;
|
|
19
|
+
if (header.test(line)) { banner = true; continue; }
|
|
20
|
+
kept.push(line);
|
|
21
|
+
}
|
|
22
|
+
const out = [...kept.map(line => line + '\n'), last].join('');
|
|
23
|
+
if (out) write(out);
|
|
24
|
+
};
|
|
25
|
+
}
|
package/global/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.110
|
|
4
|
+
|
|
5
|
+
### Business roster: a teammate erased before adoption stays erased
|
|
6
|
+
|
|
7
|
+
- Business settings: a team adapter can now implement the optional `retiredForms(email)` so a teammate an older release of the seed erased behind an opaque placeholder (a renamed roster row) is retired when a signed roster lists them by their real address alone, with no Business member id. The module matches the placeholder row to the listing before `gone` retires it, and digests the same forms when it screens a roster; before, only the placeholder and the Business id were tombstoned and such a listing was invited as a new person. An adapter that does not implement it behaves as before. No migration; `bs_retired` holds the same value-free digests. Nothing is live in any deployed seed until that seed adopts and implements the hook.
|
|
8
|
+
|
|
9
|
+
### Local sign-in and invitations say what is true
|
|
10
|
+
|
|
11
|
+
- A local run's sign-in page now says in plain words what it is (this app runs on your own computer; open it from the terminal where `rer dev` is running, or run `rer dev --as owner`, or `rer dev --as` an invited person's email) instead of naming `RER_OPEN`, and the local Lobby line says the same. `/auth/invite` returns `delivery: 'none'` when a development mail provider took the message and sent nothing, plus `signInUrl` for the key-gated local owner who sent it; a delivered invitation answers as before. The default seed's access panel no longer claims an invitation was sent when none was: it says no email was sent and shows the owner a link to open the invitation and the `rer dev --as <email>` command. The local key gate, its dev-credential rule and deployed sign-in are unchanged, and a seed gets this only by adopting it. Code only: no migration.
|
|
12
|
+
- Local one-click sign-in and its people list now refuse cross-site requests carrying only the gate cookie; same-site and key-header entry and OAuth session returns remain available. Code only, no migration; local runs only.
|
|
13
|
+
|
|
14
|
+
### CLI messages tell the truth
|
|
15
|
+
|
|
16
|
+
- The PATH step that makes a bare `rer` work in new terminals is no longer called "Optional" where the docs' later commands need it: the `rer dev` ready summary (a launch through `npx` rather than the installer), `rer cli path`, `rer --help` and the run page now say what the step is for. (The installer's closing step was fixed in 0.2.108.) Code and docs only.
|
|
17
|
+
- `rer deploy --dry-run` whose seed's own step stops (for example a seed's missing-inputs check run through `pnpm run`) printed that step's output twice, then pnpm's `ELIFECYCLE` and banner lines, a log path and an instruction to rerun without `--dry-run`. It now prints the output once, says which step stopped and that nothing was deployed, and names the same dry run to repeat. The exit code stays 1: the seed's step failed. A real deploy's output is unchanged. Code only.
|
|
18
|
+
- `rer doctor` on a set-up checkout no longer says to run `rer setup` (it uses the same set-up check `rer dev` and `rer describe` use), no longer lists the deploy kit's build-workflow inputs (`RER_PREPARE_*`, `RER_DEPLOY_*`) as missing local inputs, and names the seed's other deploy inputs only as "Optional for local use; needed to deploy", so a ready checkout exits 0. Code only.
|
|
19
|
+
- The dry run's "Needed for a real deploy" list named a mapped mail credential twice, as `SENDGRID_API_KEY (or SENDGRID_API_KEY)`, when a seed maps the shared `MAIL_API_KEY` binding to its provider's environment name. Each name now appears once. Code only.
|
|
20
|
+
|
|
21
|
+
All of the above is code and docs only: no migration is added. A seed gets it by adopting 0.2.110; nothing here is live in any deployed seed until that seed adopts and deploys it.
|
|
22
|
+
|
|
23
|
+
## 0.2.109
|
|
24
|
+
|
|
25
|
+
### `rer check` in a managed copy
|
|
26
|
+
|
|
27
|
+
- `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.
|
|
28
|
+
- 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.
|
|
29
|
+
- The seed command contract (`SEED-COMMAND-CONTRACT.md`, in the default seed and the export) describes the rule.
|
|
30
|
+
- 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.
|
|
31
|
+
|
|
3
32
|
## 0.2.108
|
|
4
33
|
|
|
5
34
|
### Installer PATH step
|
package/global/cli/path-link.mjs
CHANGED
|
@@ -63,6 +63,6 @@ export async function pathAdvice(paths, env = process.env, { includeShellStep =
|
|
|
63
63
|
const first = entries.includes(bin) && firstCommand === paths.launcher;
|
|
64
64
|
if (first && await persistent(startup.files)) return lines.join('\n');
|
|
65
65
|
const why = first ? 'New terminals will not find rer yet.' : firstCommand ? `Another rer (${firstCommand}) comes first on your PATH.` : 'rer is not on your PATH yet.';
|
|
66
|
-
lines.push(`
|
|
66
|
+
lines.push(`Next step, so a bare \`rer\` works in new terminals: ${why} Running the following line adds ~/.local/bin to your shell's startup file and this terminal. rer changes no shell file itself:`, ` ${startup.line}`);
|
|
67
67
|
return lines.join('\n');
|
|
68
68
|
}
|
package/global/launch/dev.mjs
CHANGED
|
@@ -48,11 +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.
|
|
51
|
+
// The launch never asks for shell edits. Name the PATH step only at ready,
|
|
52
52
|
// and not when install.sh closes with its own required PATH step.
|
|
53
53
|
delete process.env.RER_LAUNCH_PATH_STEP;
|
|
54
54
|
const paths = layout();
|
|
55
|
-
if (!process.env.RER_INSTALLER_PATH_STEP && await access(paths.launcher).then(() => true, () => false) && await pathAdvice(paths)) process.env.RER_LAUNCH_PATH_STEP = `
|
|
55
|
+
if (!process.env.RER_INSTALLER_PATH_STEP && await access(paths.launcher).then(() => true, () => false) && await pathAdvice(paths)) process.env.RER_LAUNCH_PATH_STEP = `Next step, after opening your app: a bare \`rer\` in a new terminal will not be found yet. Run ${shellQuote(paths.launcher)} cli path to see the one line that fixes it; it changes no shell file itself.`;
|
|
56
56
|
const here = await realpath(process.cwd()).catch(() => undefined);
|
|
57
57
|
const out = printer({ root: checkout, json: devArgs.includes('--json'), stopHint: `rer dev --stop${here === checkout ? '' : ` --cwd ${JSON.stringify(checkout)}`}`, keyless: doorStart });
|
|
58
58
|
const detach = args.includes('--detach') || (!args.includes('--foreground') && !process.stdout.isTTY);
|
package/global/main.mjs
CHANGED
|
@@ -39,7 +39,7 @@ else its vendored scripts/rer.mjs.
|
|
|
39
39
|
rer cli status This rer: version, contents digest, install channel, launcher and other rer
|
|
40
40
|
commands on PATH. --json for data.
|
|
41
41
|
rer cli install Install this package for the current user (~/.local/bin/rer).
|
|
42
|
-
rer cli path
|
|
42
|
+
rer cli path Show the shell step that makes a bare rer work in new terminals.
|
|
43
43
|
rer cli uninstall Remove the launcher and the install root; ~/.rer is untouched.
|
|
44
44
|
rer update Move to the latest published rer (--version X for an exact one), the way it
|
|
45
45
|
was installed: npx and install.sh installs switch atomically, npm installs run npm.
|
|
@@ -117,7 +117,7 @@ version), domain rules in `oa_domain_rules`. `auth.accounts` exposes it and
|
|
|
117
117
|
| `/auth/confirm` | POST | token; consume once, create session and 303 to stored returnTo. A step-up link completes only in the session that asked for it and sets no new cookie. |
|
|
118
118
|
| `/auth/session` | GET | session and operator, or 401 |
|
|
119
119
|
| `/auth/signout` | POST | `{}`; revoke current session, clear cookie, 204 |
|
|
120
|
-
| `/auth/invite` | POST | email, displayName, role? (member), returnTo?; mail invitation, 202 |
|
|
120
|
+
| `/auth/invite` | POST | email, displayName, role? (member), returnTo?; mail invitation, 202 `{status}`. A local development mail provider sends nothing, so it adds `delivery: 'none'`, and for an owner who holds the local key also `signInUrl` (the key-gated one-click entry for the invited person); a seed must not say the invitation was sent then |
|
|
121
121
|
| `/auth/invite/cancel` | POST | operatorId; cancel pending invitation, return inactive operator, 200 |
|
|
122
122
|
| `/auth/operators` | GET | authorized operator list |
|
|
123
123
|
| `/auth/operator/status` | POST | operatorId, status (`active`/`inactive`) |
|
|
@@ -3,6 +3,8 @@ import { writeOperatorStatus } from './status.mjs';
|
|
|
3
3
|
import { AuthError, deny } from '../errors.mjs';
|
|
4
4
|
import { normalizeEmail, safeReturnTo } from '../policy.mjs';
|
|
5
5
|
import { requirePost } from '../http.mjs';
|
|
6
|
+
import { devAdmitted } from '../dev-admission.mjs';
|
|
7
|
+
import { oneClickHref } from './one-click.mjs';
|
|
6
8
|
import { operatorColumns } from './store.mjs';
|
|
7
9
|
import { DEFAULT_ROLES, emailAllowed } from './roles.mjs';
|
|
8
10
|
const DOMAIN = /^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z][a-z0-9-]{0,61}[a-z0-9]$/;
|
|
@@ -50,7 +52,7 @@ export function administration(context) {
|
|
|
50
52
|
const mutation = { operatorId: existing?.id ?? crypto.randomUUID(), expectedVersion: existing?.version ?? 1, reinviting, email, displayName: displayName(input.displayName), role, token, now };
|
|
51
53
|
return { mutation, actor, ...await store.prepareInvitation(mutation, actor, audit), async afterCommit() {
|
|
52
54
|
const issued = await store.first('SELECT id FROM oa_tokens WHERE id=? AND revoked_at IS NULL AND consumed_at IS NULL', [token.id]);
|
|
53
|
-
if (issued)
|
|
55
|
+
if (issued) return sendLink(email, token);
|
|
54
56
|
} };
|
|
55
57
|
}
|
|
56
58
|
return {
|
|
@@ -59,8 +61,12 @@ export function administration(context) {
|
|
|
59
61
|
const plan = await prepareInvitation(request, input);
|
|
60
62
|
const created = await store.invite(plan.mutation, plan.actor, plan);
|
|
61
63
|
if (!created) deny('invitation_conflict', 409);
|
|
62
|
-
await plan.afterCommit();
|
|
63
|
-
return { status: 'accepted' };
|
|
64
|
+
const delivered = await plan.afterCommit();
|
|
65
|
+
if (delivered === 'accepted') return { status: 'accepted' };
|
|
66
|
+
// A development provider takes the message and sends nothing. Say so; the
|
|
67
|
+
// key-gated local owner who made the invitation also gets the way to open it.
|
|
68
|
+
const link = config.local && plan.actor.operator.role === 'owner' && await devAdmitted(request);
|
|
69
|
+
return { status: 'accepted', delivery: 'none', ...(link ? { signInUrl: oneClickHref(plan.mutation.email, plan.mutation.token.returnTo) } : {}) };
|
|
64
70
|
},
|
|
65
71
|
async listOperators(request) {
|
|
66
72
|
const actor = await actorFor(request, 'operators:list', undefined, undefined, false);
|
|
@@ -13,7 +13,12 @@ export const oneClickHref = (email, returnTo = '/app') => `/auth/one-click?as=${
|
|
|
13
13
|
// this door. Ordinary production cannot enable it with a request header.
|
|
14
14
|
export function oneClickAccounts({ config, store, clock, sessions, authorizedLink, requireRoute, afterConfirm }) {
|
|
15
15
|
async function mode(request) {
|
|
16
|
-
if (config.local)
|
|
16
|
+
if (config.local) {
|
|
17
|
+
// Session admission allows OAuth returns; one-click entry needs the
|
|
18
|
+
// stricter sign-in gate, including for the people list.
|
|
19
|
+
if (request.headers.get('x-rer-dev-key') === null && request.headers.get('sec-fetch-site') === 'cross-site') return null;
|
|
20
|
+
return await devAdmitted(request) ? 'dev' : null;
|
|
21
|
+
}
|
|
17
22
|
return demoEffectsEnabled() ? 'native' : null;
|
|
18
23
|
}
|
|
19
24
|
async function invitation(request, operator) {
|
|
@@ -41,7 +41,7 @@ export const EXCHANGE_SCRIPT = "(()=>{const exchange=()=>{const h=new URLSearchP
|
|
|
41
41
|
// the product and shown beside the wordmark text; a seed that declares no logo shows
|
|
42
42
|
// its product name as text alone.
|
|
43
43
|
const PAGE_STYLE = 'body{margin:0;font:16px/1.5 var(--rer-font-body,system-ui,sans-serif);color:var(--rer-text,#17212e);background:var(--rer-page,#f5f7fa)}main{max-width:36rem;margin:0 auto;padding:32px 16px}'
|
|
44
|
-
+ '.brand{display:flex;align-items:center;gap:12px;margin:0 0 28px;font:600 24px/1.2 var(--rer-font-heading,var(--rer-font-body,inherit));color:var(--rer-text,#17212e)}.brand img{display:block;flex:none;width:40px;height:40px;object-fit:contain}h1{font:600 20px/1.3 var(--rer-font-heading,var(--rer-font-body,inherit));margin:0 0 12px}p{color:var(--rer-muted,#475569);margin:0}';
|
|
44
|
+
+ '.brand{display:flex;align-items:center;gap:12px;margin:0 0 28px;font:600 24px/1.2 var(--rer-font-heading,var(--rer-font-body,inherit));color:var(--rer-text,#17212e)}.brand img{display:block;flex:none;width:40px;height:40px;object-fit:contain}h1{font:600 20px/1.3 var(--rer-font-heading,var(--rer-font-body,inherit));margin:0 0 12px}p{color:var(--rer-muted,#475569);margin:0}p+p{margin-top:12px}code{font:inherit;font-weight:600;color:var(--rer-text,#17212e)}';
|
|
45
45
|
// Reads --rer-logo from the linked theme (a script after a stylesheet waits for it) and
|
|
46
46
|
// shows that same-origin file as an <img> named by the product; the text beside it is
|
|
47
47
|
// then hidden from screen readers so the name is announced once.
|
|
@@ -103,7 +103,7 @@ export function devGate({ key, origin, local }) {
|
|
|
103
103
|
const theme = brand?.theme;
|
|
104
104
|
const mark = brand?.mark ? `<img src="${escapeHtml(brand.mark)}" alt="${escapeHtml(brand.productName)}" width="40" height="40" decoding="async">` : '';
|
|
105
105
|
const themeLogo = theme && !brand.mark;
|
|
106
|
-
const body = `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="robots" content="noindex, nofollow"><title>
|
|
106
|
+
const body = `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="robots" content="noindex, nofollow"><title>Open the local app</title>${iconHead}${theme ? `<link rel="stylesheet" href="${escapeHtml(theme)}">` : ''}<style>${PAGE_STYLE}</style></head><body><main>${brand ? `<p class="brand">${mark}<span>${escapeHtml(brand.productName)}</span></p>` : ''}<h1>This app runs on your own computer</h1><p>It opens only from that computer. Use the link printed in the terminal where <code>rer dev</code> is running, or run <code>rer dev --as owner</code> from the project folder.</p><p>To sign in as someone who was invited, run <code>rer dev --as</code> followed by their email address.</p></main>${themeLogo ? `<script>${LOGO_SCRIPT}</script>` : ''}<script>${EXCHANGE_SCRIPT}</script></body></html>`;
|
|
107
107
|
return new Response(request.method === 'HEAD' ? null : body, { headers: { ...privateHeaders, 'content-type': 'text/html; charset=utf-8',
|
|
108
108
|
'content-security-policy': `default-src 'none'; img-src 'self'; script-src ${script}${themeLogo ? ` ${logo}` : ''}; style-src ${theme ? "'self' " : ''}${style}${theme ? "; font-src 'self'" : ''}; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'` } });
|
|
109
109
|
}
|
|
@@ -54,6 +54,8 @@ export function createEmailLinkLifecycle({ config: input, clock = Date.now, mail
|
|
|
54
54
|
// Even ambiguous delivery cannot leave a valid, unreported auth link.
|
|
55
55
|
await revoke(); deny('mail_unavailable', 503);
|
|
56
56
|
}
|
|
57
|
+
// 'accepted' reached a mail provider; 'development' was suppressed on purpose (local or demo).
|
|
58
|
+
return result.status;
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
async function requireFreshProof(actor) {
|
|
@@ -214,7 +214,8 @@ export interface OperatorAuth<R extends string = Role> {
|
|
|
214
214
|
confirmLink(request: Request, input: { token: string }): Promise<CompletedSession<R> | StepUpConfirmed>;
|
|
215
215
|
getSession(request: Request): Promise<Session<R> | null>;
|
|
216
216
|
signOut(request: Request): Promise<{ cookie: string }>;
|
|
217
|
-
|
|
217
|
+
/** `delivery: 'none'` means no message left this runtime (a development mail provider); `signInUrl` is then the key-gated local owner's way to open the invitation. */
|
|
218
|
+
invite(request: Request, input: { email: string; displayName: string; role?: Role; returnTo?: string }): Promise<{ status: 'accepted'; delivery?: 'none'; signInUrl?: string }>;
|
|
218
219
|
listOperators(request: Request): Promise<Operator<R>[]>;
|
|
219
220
|
/** Cancel a pending invitation using operators:deactivate policy; accepted invitations conflict. */
|
|
220
221
|
cancelInvitation(request: Request, operatorId: string): Promise<Operator<R>>;
|