@runeditrun/rer 0.2.31 → 0.2.32
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 +94 -0
- package/cli/README.md +32 -0
- package/cli/business/api.mjs +61 -0
- package/cli/business/command.mjs +44 -20
- package/cli/business/config-policy.mjs +25 -0
- package/cli/business/connect.mjs +50 -0
- package/cli/business/discovery-task.mjs +180 -0
- package/cli/business/files.mjs +25 -0
- package/cli/business/keychain.mjs +113 -0
- package/cli/business/lease.mjs +68 -0
- package/cli/business/local-commands.mjs +82 -0
- package/cli/business/outbound.mjs +29 -0
- package/cli/business/parsers-syntax.mjs +3 -1
- package/cli/business/parsers.mjs +9 -3
- package/cli/business/permissions.mjs +143 -0
- package/cli/business/policy.mjs +7 -1
- package/cli/business/progress.mjs +18 -0
- package/cli/business/prompts.mjs +12 -0
- package/cli/business/questions.mjs +98 -0
- package/cli/business/repository.mjs +17 -0
- package/cli/business/scan-command.mjs +27 -0
- package/cli/business/scan.mjs +42 -35
- package/cli/business/service.mjs +152 -0
- package/cli/business/state.mjs +46 -0
- package/cli/business/supervisor.mjs +92 -0
- package/cli/business/vendors/README.md +101 -0
- package/cli/business/vendors/calendly.mjs +80 -0
- package/cli/business/vendors/common.mjs +103 -0
- package/cli/business/vendors/index.mjs +75 -0
- package/cli/business/vendors/pagerduty.mjs +70 -0
- package/cli/business/vendors/sentry.mjs +84 -0
- package/cli/business/vendors/uptimerobot.mjs +20 -0
- package/cli/deploy-command.mjs +3 -2
- package/cli/deploy-inputs.mjs +9 -0
- package/cli/deploy.mjs +3 -2
- package/global/CHANGELOG.md +13 -0
- package/global/README.md +94 -0
- package/global/cli/describe.mjs +20 -0
- package/global/cli/install.mjs +3 -3
- package/global/cli/repo-command.mjs +53 -0
- package/global/cli/repository-contract.mjs +7 -0
- package/global/cli/repository.mjs +84 -0
- package/global/launch/prepare.mjs +9 -6
- package/global/main.mjs +22 -2
- package/install.sh +7 -0
- package/modules/deploy-kit/owner-cli.mjs +5 -2
- package/modules/deploy-kit/owner.mjs +6 -4
- package/modules/deploy-kit/public-origin.mjs +17 -0
- package/package.json +1 -1
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { setTimeout as delay } from 'node:timers/promises';
|
|
3
|
+
|
|
4
|
+
export class VendorExportError extends Error {
|
|
5
|
+
constructor(code, status) {
|
|
6
|
+
super(`Vendor export stopped (${code}).`);
|
|
7
|
+
this.name = 'VendorExportError';
|
|
8
|
+
this.code = code;
|
|
9
|
+
if (status) this.status = status;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export const fail = (code = 'INVALID_RESPONSE') => { throw new VendorExportError(code); };
|
|
13
|
+
export const hash = value => createHash('sha256').update(value).digest('hex');
|
|
14
|
+
export const json = value => JSON.stringify(value);
|
|
15
|
+
export function object(value) {
|
|
16
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) fail();
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
export function list(value, max = 2500) {
|
|
20
|
+
if (!Array.isArray(value) || value.length > max || value.some(x => !x || typeof x !== 'object' || Array.isArray(x))) fail();
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
export function id(value) {
|
|
24
|
+
if (typeof value !== 'string' || !/^[a-zA-Z0-9_-]{1,128}$/u.test(value)) fail('INVALID_INPUT');
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
export function timestamp(value) {
|
|
28
|
+
if (typeof value !== 'string' || !/^\d{4}-\d\d-\d\dT/u.test(value) || value.length > 40 || !Number.isFinite(Date.parse(value))) fail('INVALID_INPUT');
|
|
29
|
+
return new Date(value).toISOString();
|
|
30
|
+
}
|
|
31
|
+
export function windowInputs(inputs) {
|
|
32
|
+
const start = timestamp(inputs.start ?? inputs.since), end = timestamp(inputs.end ?? inputs.until);
|
|
33
|
+
if (Date.parse(start) >= Date.parse(end)) fail('INVALID_INPUT');
|
|
34
|
+
return { start, end };
|
|
35
|
+
}
|
|
36
|
+
export function cursor(value) {
|
|
37
|
+
if (value == null) return null;
|
|
38
|
+
if (typeof value !== 'string' || value.length > 2048 || /[\u0000-\u0020\u007f]/u.test(value)) fail('INVALID_PAGINATION');
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
// References supply pagination/identity only; neither host nor credentials can come from them.
|
|
42
|
+
export function reference(value, origin, pathname, allowedQuery = []) {
|
|
43
|
+
let url;
|
|
44
|
+
try { url = new URL(value, origin); } catch { fail('INVALID_PAGINATION'); }
|
|
45
|
+
if (url.origin !== origin || url.username || url.password || url.hash || !pathname.test(url.pathname)) fail('INVALID_PAGINATION');
|
|
46
|
+
if ([...url.searchParams.keys()].some(key => !allowedQuery.includes(key))) fail('INVALID_PAGINATION');
|
|
47
|
+
return url;
|
|
48
|
+
}
|
|
49
|
+
export function assertCount(value, max = 1000) {
|
|
50
|
+
if (!Number.isSafeInteger(value) || value < 0 || value > max) fail('INVALID_CHECKPOINT');
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
export function shape(value, fields) {
|
|
54
|
+
object(value);
|
|
55
|
+
if (Object.keys(value).some(key => !fields.includes(key)) || fields.some(key => !Object.hasOwn(value, key))) fail('INVALID_CHECKPOINT');
|
|
56
|
+
return value;
|
|
57
|
+
}
|
|
58
|
+
export function stable(value) {
|
|
59
|
+
if (Array.isArray(value)) return value.map(stable);
|
|
60
|
+
if (value && typeof value === 'object') return Object.fromEntries(Object.keys(value).sort().map(key => [key, stable(value[key])]));
|
|
61
|
+
return value;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function client({ origin, headers, route, signal, limits, counters, key }) {
|
|
65
|
+
let lastRequest = 0;
|
|
66
|
+
return async function get(path) {
|
|
67
|
+
signal?.throwIfAborted();
|
|
68
|
+
const url = new URL(path, origin);
|
|
69
|
+
if (url.origin !== origin || url.username || url.password || url.hash || !route(url)) fail('INVALID_REFERENCE');
|
|
70
|
+
if (++counters.requests > limits.requests) fail('REQUEST_LIMIT');
|
|
71
|
+
// At most one request per second; no automatic retry or rate-limit hammering.
|
|
72
|
+
const pause = 1000 - (Date.now() - lastRequest);
|
|
73
|
+
if (pause > 0) await delay(pause, undefined, { signal });
|
|
74
|
+
lastRequest = Date.now();
|
|
75
|
+
const timeout = AbortSignal.timeout(30_000);
|
|
76
|
+
const requestSignal = signal ? AbortSignal.any([signal, timeout]) : timeout;
|
|
77
|
+
let response;
|
|
78
|
+
try { response = await fetch(url, { method: 'GET', headers, redirect: 'error', signal: requestSignal }); }
|
|
79
|
+
catch { fail(signal?.aborted ? 'CANCELLED' : 'NETWORK_FAILED'); }
|
|
80
|
+
if (!response.ok) {
|
|
81
|
+
await response.body?.cancel().catch(() => {});
|
|
82
|
+
throw new VendorExportError(response.status === 429 ? 'RATE_LIMITED' : 'HTTP_REFUSED', response.status);
|
|
83
|
+
}
|
|
84
|
+
const chunks = []; let size = 0;
|
|
85
|
+
try {
|
|
86
|
+
for await (const chunk of response.body ?? []) {
|
|
87
|
+
size += chunk.byteLength;
|
|
88
|
+
counters.received += chunk.byteLength;
|
|
89
|
+
if (size > limits.pageBytes || counters.received > limits.bytes) fail('BYTE_LIMIT');
|
|
90
|
+
chunks.push(chunk);
|
|
91
|
+
}
|
|
92
|
+
} catch (error) {
|
|
93
|
+
if (error instanceof VendorExportError) throw error;
|
|
94
|
+
fail(signal?.aborted ? 'CANCELLED' : 'NETWORK_FAILED');
|
|
95
|
+
}
|
|
96
|
+
const bytes = Buffer.concat(chunks);
|
|
97
|
+
// A reflected authentication key must never become a vendor artifact.
|
|
98
|
+
if (bytes.includes(Buffer.from(key))) fail('CREDENTIAL_IN_RESPONSE');
|
|
99
|
+
let body;
|
|
100
|
+
try { body = JSON.parse(bytes.toString('utf8')); } catch { fail('INVALID_JSON'); }
|
|
101
|
+
return { body, headers: response.headers };
|
|
102
|
+
};
|
|
103
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { VendorExportError, fail, hash, client, object, assertCount, shape, stable } from './common.mjs';
|
|
2
|
+
import * as sentry from './sentry.mjs';
|
|
3
|
+
import * as uptimerobot from './uptimerobot.mjs';
|
|
4
|
+
import * as pagerduty from './pagerduty.mjs';
|
|
5
|
+
import * as calendly from './calendly.mjs';
|
|
6
|
+
|
|
7
|
+
export { VendorExportError } from './common.mjs';
|
|
8
|
+
export const VENDORS = Object.freeze(['sentry','uptimerobot','pagerduty','calendly']);
|
|
9
|
+
const adapters = { sentry, uptimerobot, pagerduty, calendly };
|
|
10
|
+
export const VENDOR_CAPABILITIES = Object.freeze({
|
|
11
|
+
sentry: Object.freeze({ vendor: 'sentry', adapter: 'rer:sentry', capability: 'vendor_key:sentry', format: 'spool-sentry-org-export-v1', layout: 'concatenate', output: 'sentry-export.json', readOnly: true, resume: true, scopes: ['org:read','project:read','event:read'], origins: Object.values(sentry.origins) }),
|
|
12
|
+
uptimerobot: Object.freeze({ vendor: 'uptimerobot', adapter: 'rer:uptimerobot', capability: 'vendor_key:uptimerobot', format: 'uptimerobot-v3-monitors', layout: 'concatenate', output: 'uptimerobot-monitors.json', readOnly: true, resume: true, scopes: ['read-only API key'], origins: [uptimerobot.origin] }),
|
|
13
|
+
pagerduty: Object.freeze({ vendor: 'pagerduty', adapter: 'rer:pagerduty', capability: 'vendor_key:pagerduty', format: 'pagerduty-saved-responses', layout: 'concatenate', output: 'pagerduty-export.json', readOnly: true, resume: true, scopes: ['read-only REST API key'], origins: [pagerduty.origin] }),
|
|
14
|
+
calendly: Object.freeze({ vendor: 'calendly', adapter: 'rer:calendly', capability: 'vendor_key:calendly', format: 'dial-calendly-api-folder-v1', layout: 'files', output: 'manifest.json', readOnly: true, resume: true, scopes: ['personal access token with read access'], origins: [calendly.origin] }),
|
|
15
|
+
});
|
|
16
|
+
const LIMITS = Object.freeze({
|
|
17
|
+
// Spool's 500-record bound also counts its synthesized manifest record.
|
|
18
|
+
sentry: { bytes: 2 * 1024 * 1024, records: 499 },
|
|
19
|
+
uptimerobot: { bytes: 8 * 1024 * 1024, records: 2500 },
|
|
20
|
+
pagerduty: { bytes: 512 * 1024, records: 500 },
|
|
21
|
+
calendly: { bytes: 8 * 1024 * 1024, records: 2500 },
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
/** Persist each checkpoint only after the corresponding bytes have been acknowledged.
|
|
25
|
+
* Bytes are private seed-bound artifacts; checkpoints are metadata, never API bodies.
|
|
26
|
+
*/
|
|
27
|
+
export async function* exportVendor(vendor, { key, inputs = {}, checkpoint, signal } = {}) {
|
|
28
|
+
try {
|
|
29
|
+
if (!VENDORS.includes(vendor)) fail('UNSUPPORTED_VENDOR');
|
|
30
|
+
if (typeof key !== 'string' || !key || key.length > 8192 || /[\u0000-\u0020\u007f]/u.test(key)) fail('INVALID_KEY');
|
|
31
|
+
object(inputs);
|
|
32
|
+
const fingerprint = hash(JSON.stringify(stable({ vendor, inputs })));
|
|
33
|
+
const limits = { ...LIMITS[vendor], requests: 1000, pageBytes: 1024 * 1024 - 16 * 1024 };
|
|
34
|
+
let state, sequence = 0;
|
|
35
|
+
let counters = { requests: 0, received: 0, emitted: 0, records: 0 };
|
|
36
|
+
if (checkpoint != null) {
|
|
37
|
+
const encoded = JSON.stringify(checkpoint);
|
|
38
|
+
if (Buffer.byteLength(encoded) >= 128 * 1024 || encoded.includes(key)) fail('INVALID_CHECKPOINT');
|
|
39
|
+
const cp = JSON.parse(encoded);
|
|
40
|
+
shape(cp, ['version','vendor','fingerprint','sequence','counters','state']);
|
|
41
|
+
if (cp.version !== 1 || cp.vendor !== vendor || cp.fingerprint !== fingerprint) fail('INVALID_CHECKPOINT');
|
|
42
|
+
sequence = assertCount(cp.sequence, 2000);
|
|
43
|
+
shape(cp.counters, ['requests','received','emitted','records']); object(cp.state);
|
|
44
|
+
counters = Object.fromEntries(Object.keys(counters).map(name => [name, assertCount(cp.counters[name], name === 'requests' ? limits.requests : name === 'records' ? limits.records : limits.bytes)]));
|
|
45
|
+
state = cp.state;
|
|
46
|
+
}
|
|
47
|
+
const adapter = adapters[vendor];
|
|
48
|
+
const origin = vendor === 'sentry' ? adapter.origins[inputs.organization?.region] : adapter.origin;
|
|
49
|
+
if (!origin) fail('INVALID_INPUT');
|
|
50
|
+
const headers = { Accept: vendor === 'pagerduty' ? 'application/vnd.pagerduty+json;version=2' : 'application/json', Authorization: vendor === 'pagerduty' ? `Token token=${key}` : `Bearer ${key}` };
|
|
51
|
+
const ctx = {
|
|
52
|
+
inputs, state,
|
|
53
|
+
get: client({ origin, headers, route: adapter.route, signal, limits, counters, key }),
|
|
54
|
+
records(count) {
|
|
55
|
+
counters.records += count;
|
|
56
|
+
if (counters.records > limits.records) fail('RECORD_LIMIT');
|
|
57
|
+
},
|
|
58
|
+
item(value, nextState, name) {
|
|
59
|
+
signal?.throwIfAborted();
|
|
60
|
+
const bytes = Buffer.isBuffer(value) ? value : Buffer.from(value);
|
|
61
|
+
if (bytes.length > 1024 * 1024 || (counters.emitted += bytes.length) > limits.bytes) fail('BYTE_LIMIT');
|
|
62
|
+
if (bytes.includes(Buffer.from(key))) fail('CREDENTIAL_IN_RESPONSE');
|
|
63
|
+
if (++sequence > 2000) fail('ITEM_LIMIT');
|
|
64
|
+
const cp = { version: 1, vendor, fingerprint, sequence, counters: { ...counters }, state: nextState };
|
|
65
|
+
const encoded = JSON.stringify(cp);
|
|
66
|
+
if (Buffer.byteLength(encoded) >= 128 * 1024 || encoded.includes(key)) fail('CHECKPOINT_LIMIT');
|
|
67
|
+
return { name: name ?? `${String(sequence).padStart(6,'0')}.part`, bytes, checkpoint: JSON.parse(encoded) };
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
yield* adapter.run(ctx);
|
|
71
|
+
} catch (error) {
|
|
72
|
+
if (error instanceof VendorExportError) throw error;
|
|
73
|
+
throw new VendorExportError(signal?.aborted ? 'CANCELLED' : 'INVALID_EXPORT');
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { object, list, id, windowInputs, assertCount, shape, fail } from './common.mjs';
|
|
2
|
+
|
|
3
|
+
export const origin = 'https://api.pagerduty.com';
|
|
4
|
+
export const route = url => /^\/(?:users|escalation_policies|schedules(?:\/[a-zA-Z0-9_-]+(?:\/overrides)?)?)$/u.test(url.pathname) && [...url.searchParams.keys()].every(x => ['limit','offset','since','until','overflow'].includes(x));
|
|
5
|
+
const credential = /^(?:password|passwd|secret|token|credentials?|authorization|cookie)$|(?:api|access|auth|integration|routing|service|signing|private|client|refresh|session)[_-]?(?:key|secret|token)$|^webhook[_-]?(?:url|secret)$|(?:http|web)[_-]?cal[_-]?url$/iu;
|
|
6
|
+
function noCredentials(value) {
|
|
7
|
+
if (Array.isArray(value)) value.forEach(noCredentials);
|
|
8
|
+
else if (value && typeof value === 'object') for (const [key, child] of Object.entries(value)) {
|
|
9
|
+
if (credential.test(key)) fail('CREDENTIAL_IN_RESPONSE');
|
|
10
|
+
noCredentials(child);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function advance(body, state) {
|
|
14
|
+
if (typeof body.more !== 'boolean') fail();
|
|
15
|
+
if (body.more) {
|
|
16
|
+
const limit = assertCount(body.limit, 100);
|
|
17
|
+
if (!limit || body.offset !== state.offset) fail('INVALID_PAGINATION');
|
|
18
|
+
state.offset += limit;
|
|
19
|
+
assertCount(state.offset, 100000);
|
|
20
|
+
} else state.offset = 0;
|
|
21
|
+
return body.more;
|
|
22
|
+
}
|
|
23
|
+
export async function* run(ctx) {
|
|
24
|
+
const { start, end } = windowInputs(ctx.inputs);
|
|
25
|
+
const window = new URLSearchParams({ since: start, until: end });
|
|
26
|
+
const s = ctx.state ?? { phase: 0, offset: 0, schedules: [], index: 0, first: true };
|
|
27
|
+
shape(s, ['phase','offset','schedules','index','first']);
|
|
28
|
+
if (typeof s.first !== 'boolean') fail('INVALID_CHECKPOINT');
|
|
29
|
+
assertCount(s.phase, 5); assertCount(s.offset, 100000); assertCount(s.index, 500);
|
|
30
|
+
if (!Array.isArray(s.schedules) || s.schedules.length > 500) fail('INVALID_CHECKPOINT');
|
|
31
|
+
s.schedules.forEach(id);
|
|
32
|
+
while (s.phase < 5) {
|
|
33
|
+
let bytes;
|
|
34
|
+
if (s.phase === 0 || s.phase === 1 || s.phase === 4) {
|
|
35
|
+
const kind = ['users','schedules',null,null,'escalation_policies'][s.phase];
|
|
36
|
+
const { body } = await ctx.get(`/${kind}?limit=100&offset=${s.offset}`);
|
|
37
|
+
object(body); const rows = list(body[kind], 100); ctx.records(s.phase === 1 ? 0 : rows.length);
|
|
38
|
+
if (s.phase === 1) {
|
|
39
|
+
for (const row of rows) { const value = id(row.id); if (s.schedules.includes(value)) fail('DUPLICATE_ID'); s.schedules.push(value); }
|
|
40
|
+
if (s.schedules.length > 500) fail('RECORD_LIMIT');
|
|
41
|
+
bytes = '';
|
|
42
|
+
} else {
|
|
43
|
+
noCredentials(body);
|
|
44
|
+
bytes = (s.first ? (s.phase === 0 ? '{"users":[' : '],"escalation_policies":[') : ',') + JSON.stringify(body);
|
|
45
|
+
s.first = false;
|
|
46
|
+
}
|
|
47
|
+
if (!advance(body, s)) { s.phase++; s.first = true; }
|
|
48
|
+
} else if (s.phase === 2) {
|
|
49
|
+
if (s.index === s.schedules.length) { s.phase = 3; s.index = 0; s.first = true; bytes = s.schedules.length ? '' : '],"schedules":['; }
|
|
50
|
+
else {
|
|
51
|
+
const { body } = await ctx.get(`/schedules/${id(s.schedules[s.index])}?${window}`);
|
|
52
|
+
object(body); object(body.schedule); noCredentials(body); ctx.records(1);
|
|
53
|
+
bytes = (s.first ? '],"schedules":[' : ',') + JSON.stringify(body);
|
|
54
|
+
s.first = false; s.index++;
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
if (s.index === s.schedules.length) { s.phase = 4; s.first = true; bytes = s.schedules.length ? '' : '],"overrides":['; }
|
|
58
|
+
else {
|
|
59
|
+
const schedule = id(s.schedules[s.index]);
|
|
60
|
+
const { body } = await ctx.get(`/schedules/${schedule}/overrides?${window}&overflow=true`);
|
|
61
|
+
object(body); ctx.records(list(body.overrides).length); noCredentials(body);
|
|
62
|
+
bytes = (s.first ? '],"overrides":[' : ',') + JSON.stringify({ ...body, schedule_id: schedule });
|
|
63
|
+
s.first = false;
|
|
64
|
+
s.index++;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (s.phase === 5) bytes += ']}\n';
|
|
68
|
+
yield ctx.item(bytes, s);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { object, list, id, windowInputs, cursor, assertCount, shape, fail } from './common.mjs';
|
|
2
|
+
|
|
3
|
+
export const origins = Object.freeze({ us: 'https://us.sentry.io', de: 'https://de.sentry.io' });
|
|
4
|
+
export const route = url => /^\/api\/0\/(?:organizations\/[a-zA-Z0-9_-]+\/(?:projects|releases|issues)|projects\/[a-zA-Z0-9_-]+\/[a-zA-Z0-9_-]+\/events\/[a-fA-F0-9]{32})\/$/u.test(url.pathname) && [...url.searchParams.keys()].every(x => ['per_page','limit','cursor','query','project','start','end','sort'].includes(x));
|
|
5
|
+
function nextCursor(headers) {
|
|
6
|
+
const link = headers.get('link');
|
|
7
|
+
if (!link) return null;
|
|
8
|
+
const next = link.split(',').find(part => /\brel="next"/u.test(part));
|
|
9
|
+
if (!next || /\bresults="false"/u.test(next)) return null;
|
|
10
|
+
if (!/\bresults="true"/u.test(next)) fail('INVALID_PAGINATION');
|
|
11
|
+
const value = next.match(/\bcursor="([^"]+)"/u)?.[1];
|
|
12
|
+
if (!value) fail('INVALID_PAGINATION');
|
|
13
|
+
return cursor(value);
|
|
14
|
+
}
|
|
15
|
+
export async function* run(ctx) {
|
|
16
|
+
const organization = object(ctx.inputs.organization);
|
|
17
|
+
id(organization.id); id(organization.slug);
|
|
18
|
+
if (!Object.hasOwn(origins, organization.region)) fail('INVALID_INPUT');
|
|
19
|
+
const window = windowInputs(ctx.inputs);
|
|
20
|
+
const selected = ctx.inputs.events ?? [];
|
|
21
|
+
list(selected, 100);
|
|
22
|
+
for (const event of selected) {
|
|
23
|
+
id(event.project);
|
|
24
|
+
if (!/^[a-fA-F0-9]{32}$/u.test(event.eventId)) fail('INVALID_INPUT');
|
|
25
|
+
}
|
|
26
|
+
const s = ctx.state ?? { phase: 0, projects: [], index: 0, event: 0, cursor: null, seen: [], collections: 0, page: 0 };
|
|
27
|
+
shape(s, ['phase','projects','index','event','cursor','seen','collections','page']);
|
|
28
|
+
assertCount(s.phase, 5); assertCount(s.index, 100); assertCount(s.event, 100); assertCount(s.collections, 100); assertCount(s.page, 100);
|
|
29
|
+
if (!Array.isArray(s.projects) || s.projects.length > 49 || !Array.isArray(s.seen) || s.seen.length > 100) fail('INVALID_CHECKPOINT');
|
|
30
|
+
s.projects.forEach(id); cursor(s.cursor); s.seen.forEach(cursor);
|
|
31
|
+
if (s.phase === 0) {
|
|
32
|
+
s.phase = 1;
|
|
33
|
+
yield ctx.item(JSON.stringify({ format: 'spool-sentry-org-export', version: 1, organization: { id: organization.id, slug: organization.slug, region: organization.region }, window }).slice(0,-1) + ',"collections":[', s);
|
|
34
|
+
}
|
|
35
|
+
while (s.phase < 5) {
|
|
36
|
+
if (s.phase === 3 && s.index >= s.projects.length) { s.phase = 4; s.index = 0; }
|
|
37
|
+
if (s.phase === 4 && s.index >= s.projects.length) {
|
|
38
|
+
if (selected.some(event => !s.projects.includes(event.project))) fail('EVENT_PROJECT_NOT_EXPORTED');
|
|
39
|
+
s.phase = 5;
|
|
40
|
+
yield ctx.item('],"omissions":' + JSON.stringify([
|
|
41
|
+
'Only explicitly selected event IDs are exported; all other historical events, retention gaps and inaccessible records are outside this bundle.',
|
|
42
|
+
'Issues include all statuses in the requested time window. Projects and releases are not time-filtered.',
|
|
43
|
+
'Attachments, source maps, sessions, tracing, replays, profiles, feedback, check-ins, logs and metrics are not exported.',
|
|
44
|
+
]) + '}\n', s);
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
const kind = [null,'projects','releases','issues','events'][s.phase];
|
|
48
|
+
const project = s.phase >= 3 ? id(s.projects[s.index]) : null;
|
|
49
|
+
const events = selected.filter(event => event.project === project);
|
|
50
|
+
let response, next = null;
|
|
51
|
+
if (s.phase === 4) {
|
|
52
|
+
if (s.event >= events.length && events.length) fail('INVALID_CHECKPOINT');
|
|
53
|
+
if (events.length) {
|
|
54
|
+
const result = await ctx.get(`/api/0/projects/${organization.slug}/${project}/events/${events[s.event].eventId}/`);
|
|
55
|
+
object(result.body);
|
|
56
|
+
response = [result.body]; ctx.records(1);
|
|
57
|
+
const at = Date.parse(result.body.dateCreated ?? result.body.dateReceived);
|
|
58
|
+
if (!Number.isFinite(at) || at < Date.parse(window.start) || at > Date.parse(window.end)) fail('EVENT_OUTSIDE_WINDOW');
|
|
59
|
+
next = s.event + 1 < events.length ? `selected-${s.event + 1}` : null;
|
|
60
|
+
} else response = [];
|
|
61
|
+
} else {
|
|
62
|
+
const query = new URLSearchParams(s.phase === 3 ? { limit: '100', project, query: '', start: window.start, end: window.end, sort: 'date' } : { per_page: '100' });
|
|
63
|
+
if (s.cursor !== null) query.set('cursor', s.cursor);
|
|
64
|
+
const { body, headers } = await ctx.get(`/api/0/organizations/${organization.slug}/${kind}/?${query}`);
|
|
65
|
+
response = list(body, 100); ctx.records(response.length); next = nextCursor(headers);
|
|
66
|
+
if (s.phase === 1) for (const row of response) {
|
|
67
|
+
const slug = id(row.slug);
|
|
68
|
+
if (s.projects.includes(slug)) fail('DUPLICATE_ID');
|
|
69
|
+
s.projects.push(slug);
|
|
70
|
+
if (s.projects.length > 49) fail('COLLECTION_LIMIT');
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (next !== null && (next === s.cursor || s.seen.includes(next))) fail('PAGINATION_CYCLE');
|
|
74
|
+
if (++s.page > 100) fail('PAGE_LIMIT');
|
|
75
|
+
let bytes = s.cursor === null ? (s.collections ? ',' : '') + JSON.stringify({kind,project}).slice(0,-1) + ',"pages":[' : ',';
|
|
76
|
+
bytes += JSON.stringify({ cursor: s.cursor, nextCursor: next, response });
|
|
77
|
+
s.cursor = next;
|
|
78
|
+
if (next === null) {
|
|
79
|
+
bytes += ']}'; s.collections++; s.seen = []; s.page = 0; s.event = 0;
|
|
80
|
+
if (s.phase < 3) s.phase++; else s.index++;
|
|
81
|
+
} else { s.seen.push(next); if (s.phase === 4) s.event++; }
|
|
82
|
+
yield ctx.item(bytes, s);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { object, list, reference, shape, fail } from './common.mjs';
|
|
2
|
+
|
|
3
|
+
export const origin = 'https://api.uptimerobot.com';
|
|
4
|
+
export const route = url => url.pathname === '/v3/monitors' && [...url.searchParams.keys()].every(x => ['limit','offset','cursor','page','page_token'].includes(x));
|
|
5
|
+
export async function* run(ctx) {
|
|
6
|
+
const state = ctx.state ?? { next: '/v3/monitors?limit=200', seen: [] };
|
|
7
|
+
shape(state, ['next','seen']);
|
|
8
|
+
if (!Array.isArray(state.seen) || state.seen.length > 600) fail('INVALID_CHECKPOINT');
|
|
9
|
+
state.seen.forEach(value => reference(value, origin, /^\/v3\/monitors$/u, ['limit','offset','cursor','page','page_token']));
|
|
10
|
+
while (state.next !== null) {
|
|
11
|
+
const url = reference(state.next, origin, /^\/v3\/monitors$/u, ['limit','offset','cursor','page','page_token']);
|
|
12
|
+
if (state.seen.includes(url.href)) fail('PAGINATION_CYCLE');
|
|
13
|
+
const { body } = await ctx.get(url.href);
|
|
14
|
+
object(body); ctx.records(list(body.data).length);
|
|
15
|
+
if (!Object.hasOwn(body, 'nextLink')) fail();
|
|
16
|
+
state.seen.push(url.href);
|
|
17
|
+
state.next = body.nextLink == null ? null : reference(body.nextLink, origin, /^\/v3\/monitors$/u, ['limit','offset','cursor','page','page_token']).href;
|
|
18
|
+
yield ctx.item(JSON.stringify(body) + '\n', state);
|
|
19
|
+
}
|
|
20
|
+
}
|
package/cli/deploy-command.mjs
CHANGED
|
@@ -63,10 +63,11 @@ export async function deployCommand(context) {
|
|
|
63
63
|
// may perform them; neither a build nor a custom upload runs here.
|
|
64
64
|
if (options.remove || options.setSecret || options.unsetSecret) return ownerDeploy(path, adapter)(context);
|
|
65
65
|
if (adapter.deploy.managesHostedOwner) return adapter.deploy(context);
|
|
66
|
-
const
|
|
66
|
+
const settings = adapter.hooks?.secrets ?? adapter.settings;
|
|
67
|
+
const production = await deployEnvironment({ root, options, declaration, setupManifest, settings, localOnlyKeys });
|
|
67
68
|
await requireProductionAuth({ root, declaration, env: production.env, setupManifest, setupSeed: context.setupSeed, adapter, declarationPath: path, options });
|
|
68
69
|
const sourceSha = options.dryRun ? undefined : committedSource(root, options);
|
|
69
|
-
const { env, supplied } = await deployEnvironment({ root, options, declaration, setupManifest, settings
|
|
70
|
+
const { env, supplied } = await deployEnvironment({ root, options, declaration, setupManifest, settings, localOnlyKeys });
|
|
70
71
|
const { createRedaction, credentialValues } = await shared('redaction.mjs');
|
|
71
72
|
const redaction = createRedaction();
|
|
72
73
|
const addSecret = value => { redaction.addSecrets([value]); store.addSecrets?.([value]); };
|
package/cli/deploy-inputs.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { relative } from 'node:path';
|
|
|
3
3
|
import { shared } from './shared.mjs';
|
|
4
4
|
import { invalid } from './errors.mjs';
|
|
5
5
|
import { readDeployEnvFile } from '../modules/deploy-kit/env-file.mjs';
|
|
6
|
+
import { publicOrigin } from '../modules/deploy-kit/public-origin.mjs';
|
|
6
7
|
|
|
7
8
|
// The values a Workers deploy reads for its declared secrets: this process's
|
|
8
9
|
// environment, then the --env-file (which wins), then what rer supplies itself:
|
|
@@ -17,6 +18,14 @@ export async function deployEnvironment({ root, options, declaration, setupManif
|
|
|
17
18
|
catch (error) { throw invalid(`The --env-file ${options.envFile} could not be used: ${error.code === 'ENOENT' ? 'no such file' : error.message}.`); }
|
|
18
19
|
Object.assign(env, values);
|
|
19
20
|
}
|
|
21
|
+
const originSetting = declaration.publicOriginSetting;
|
|
22
|
+
if (originSetting !== undefined && env[originSetting] === undefined && settings) {
|
|
23
|
+
const { readSettings } = await shared('adapter-settings.mjs');
|
|
24
|
+
const value = (await readSettings(root, settings)).values[originSetting];
|
|
25
|
+
if (value !== undefined) env[originSetting] = value;
|
|
26
|
+
}
|
|
27
|
+
try { publicOrigin(declaration, env); }
|
|
28
|
+
catch { throw invalid('Declare publicOriginSetting beside originVar and set it to an HTTPS origin (https://host[:port]), without credentials, path, query or fragment.'); }
|
|
20
29
|
const secrets = Array.isArray(declaration.secrets) ? declaration.secrets : [];
|
|
21
30
|
const absent = item => item && !env[item.environment]?.trim();
|
|
22
31
|
const emailField = setupManifest?.steps?.find(step => step.type === 'owner-claim')?.emailField;
|
package/cli/deploy.mjs
CHANGED
|
@@ -33,8 +33,9 @@ export function ownerDeploy(declarationPath, lifecycle) {
|
|
|
33
33
|
const recordedState = change.length ? await deploymentRecord(root, options) : undefined;
|
|
34
34
|
// A dry run reads the settings file too, so a refused key fails here and not only on the real deploy.
|
|
35
35
|
if (options.dryRun && options.envFile) await deployEnvironment({ root, options, declaration, localOnlyKeys });
|
|
36
|
+
let production;
|
|
36
37
|
if (!change.length) {
|
|
37
|
-
|
|
38
|
+
production = await deployEnvironment({ root, options, declaration, setupManifest, settings: lifecycle.settings, localOnlyKeys });
|
|
38
39
|
await requireProductionAuth({ root, declaration, env: production.env, setupManifest, setupSeed, adapter: lifecycle, declarationPath, options });
|
|
39
40
|
if (!options.dryRun) committedSource(root, options);
|
|
40
41
|
await lifecycle.run(root, {}, store, () => {}, signal, { verb: 'build', operationToken });
|
|
@@ -45,7 +46,7 @@ export function ownerDeploy(declarationPath, lifecycle) {
|
|
|
45
46
|
// account lookup. This synthetic target is validation data, not a provider.
|
|
46
47
|
const worker = ownerWorkerName(declaration.project, environment);
|
|
47
48
|
const artifact = await packageBuild({ root, source: { sha: '0'.repeat(40), tree: '0'.repeat(40) }, runIdentity: { id: '0', attempt: '1' }, productDirectory: '' });
|
|
48
|
-
ownerPlan({ project: declaration.project, environment, worker, origin: `https://${worker}.example.invalid` }, declaration, artifact, { localOnlyKeys });
|
|
49
|
+
ownerPlan({ project: declaration.project, environment, worker, origin: `https://${worker}.example.invalid` }, declaration, artifact, { localOnlyKeys, env: production.env });
|
|
49
50
|
store.report('deploy: dry run complete; no deployment occurred and no provider request was made.');
|
|
50
51
|
return { dryRun: true, deployed: false };
|
|
51
52
|
}
|
package/global/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.32
|
|
4
|
+
|
|
5
|
+
- **One line from nothing to a running seed.** `rer dev <repo>` clones the seed, installs its dependencies, sets up the local owner and starts the signed-in app, so `npx -y @runeditrun/rer dev just-every/run-inkwell` works from an empty folder and also installs the rer CLI. `rer setup <repo>` stops after setup and prints the next command; `rer install <repo>` stops after dependencies. `<repo>` is `<owner>/<repo>`, a GitHub HTTPS URL (with or without `.git`) or any git URL. The clone goes into `./<repo name>` unless `--dir DIR` says otherwise; an existing clone of the same repository is reused and any other non-empty folder is refused. Inside a checkout with no repo argument every verb behaves as before. `install.sh` forwards its arguments after installing (`curl -fsSL https://runeditrun.com/install.sh | sh -s -- dev just-every/run-inkwell`). Verb help and `rer describe` list the repository forms, also for checkouts that pin an older rer.
|
|
6
|
+
- **Business CLI.** `rer business connect` pairs a device through browser number approval and keeps its credentials in the OS keychain. `run`, `next`, `answer`, `vendor-key`, `token`, `status` and `disconnect` follow the platform's task protocol: audience- and task-bound tokens, grant and fence echoes, numeric checkpoints, events, completion and enum release reasons. `rer business answer TASK VENDOR USAGE [CONFIDENCE]` picks a vendor from the question's `answer_schema` (including `none`) and sends only `{vendor_id, usage, confidence}`; free text is refused before any request, and owner-only tasks stay in the browser. Discovery uploads carry only the fields the server accepts and must fit the grant's cumulative quota; an unavailable vendor grant reports `connected_runner_required` and releases as `paused`. Bundled adapters: Sentry, UptimeRobot, PagerDuty and Calendly.
|
|
7
|
+
- **Business scan output is smaller and repository-aware.** Identical `(kind, value, repo, class)` signals emit once with a numeric `count` and the first locator. Config keys come only from JSON, YAML and TOML files, at most 200 per file. Secret files still emit one `secret-file` signal per path with its own size and mtime. Nested Git repositories own their signals and repository-relative locators. Linked worktrees and agent or editor work folders are skipped and counted by kind without paths.
|
|
8
|
+
- **Canonical origin for owner deploys.** A deploy declaration may name `"publicOriginSetting": "PUBLIC_ORIGIN"` beside `originVar`. `rer deploy` reads that setting from saved settings, the process environment or `--env-file` (later wins) and sets `originVar` to it. The value must be `https://host[:port]`; credentials, paths, queries, fragments and malformed input are refused before any build or provider write. Readiness, health checks, resource identities and the recorded owner stay on the workers.dev deployment; without the setting nothing changes, and an unchanged repeat makes no provider writes.
|
|
9
|
+
- **Run-site token.** SEED-COMMAND-CONTRACT.md now lists the run-site deploy token's permissions: Workers Scripts: Edit on the account, and Zone: Read, DNS: Edit, Workers Routes: Edit and Dynamic URL Redirects: Edit on the run site zones.
|
|
10
|
+
|
|
11
|
+
### Upgrade notes
|
|
12
|
+
|
|
13
|
+
- Update the exact rer package pin, or refresh vendored operating commands, to receive these changes. The repository forms of `dev`, `setup` and `install` belong to the installed CLI and work with any checkout pin.
|
|
14
|
+
- A seed that serves on a custom domain adds `"publicOriginSetting"` to its deploy declaration and supplies the origin in settings, the environment or `--env-file`.
|
|
15
|
+
|
|
3
16
|
## 0.2.31
|
|
4
17
|
|
|
5
18
|
- **Each seed's verify workflow.** For a GitHub source, `rer release` takes the verify workflow from `--verify-workflow NAME_OR_FILE`. If that is absent, it uses the selected commit's `rer-project.json` `verifyWorkflow`, then `.github/workflows/verify.yml`/`verify.yaml`, then exactly one workflow named `verify`, in that order. Names, full file paths and basenames match case-insensitively. An explicit selection must resolve uniquely and never falls through. An ambiguous selection blocks and lists the candidates with the `--verify-workflow` remedy. The exact-SHA run checks are unchanged. `gates.verify` in the receipt and site provenance records `workflowFile`, `workflowName`, `workflowId`, `runId` and `runUrl`. `operations.verify` is unchanged.
|
package/global/README.md
CHANGED
|
@@ -6,6 +6,24 @@ checkout always gets the behaviour it was built and tested with.
|
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
9
|
+
Start a seed from an empty folder with one command:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npx -y @runeditrun/rer dev just-every/run-inkwell
|
|
13
|
+
curl -fsSL https://runeditrun.com/install.sh | sh -s -- dev just-every/run-inkwell
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Both install the user CLI, clone into `./run-inkwell`, install dependencies, set
|
|
17
|
+
up a local owner and start the app. Open the printed `RER_OPEN` link to sign in.
|
|
18
|
+
Use `setup <repo>` to stop after setup, or `install <repo>` to stop after
|
|
19
|
+
dependency installation; each prints the next command. The repo can be
|
|
20
|
+
`<owner>/<repo>`, a GitHub HTTPS URL (with or without `.git`), or a git URL.
|
|
21
|
+
`--dir DIR` chooses another folder. An existing clone with the same origin is
|
|
22
|
+
reused; any other non-empty folder is refused. Inside a checkout, the commands
|
|
23
|
+
without a repository work as before. Dev follows the usual terminal behaviour:
|
|
24
|
+
Ctrl-C stops a foreground app; without a terminal it returns once ready and
|
|
25
|
+
leaves the app running. The restart command includes `cd` into the checkout.
|
|
26
|
+
|
|
9
27
|
Install `rer` with one of these commands:
|
|
10
28
|
|
|
11
29
|
```sh
|
|
@@ -306,9 +324,85 @@ document: `{schema: "rer-business-signals/1", source: "local", signals: [...],
|
|
|
306
324
|
withheld: N}`. Signals identify package, environment, CI, infrastructure and
|
|
307
325
|
configuration names with a relative `locator`, repository basename `repo`,
|
|
308
326
|
`class` (`live-use` or `trace`) and `observedAt`.
|
|
327
|
+
Identical `(kind, value, repo, class)` signals are emitted once with an occurrence
|
|
328
|
+
`count` and the first matching `locator`. `secret-file` signals remain separate
|
|
329
|
+
for each path, preserving each file's size and modification time.
|
|
330
|
+
|
|
331
|
+
Config keys come only from JSON (including JSONC), YAML and TOML files in
|
|
332
|
+
configuration directories or with known config filenames.
|
|
333
|
+
Data in tests, fixtures, locales, translations, samples and exports, along with
|
|
334
|
+
lockfiles and generated output, contributes no config keys. The document's
|
|
335
|
+
`configKeyLimit` declares the maximum distinct key paths per file (currently
|
|
336
|
+
200). JavaScript and TypeScript config files are not read or parsed;
|
|
337
|
+
dependencies still come from manifests.
|
|
309
338
|
|
|
310
339
|
Only names leave the scanner. Secret files are never opened and contribute
|
|
311
340
|
`secret-file` metadata (filename, path, size and modification time).
|
|
312
341
|
Sensitive-looking outbound names are dropped and counted in `withheld`.
|
|
313
342
|
Symlinks, generated outputs and dependency trees are skipped; unsupported
|
|
314
343
|
formats and syntax may yield no signals.
|
|
344
|
+
|
|
345
|
+
## Business device commands
|
|
346
|
+
|
|
347
|
+
`rer business connect --code ABCD-1234 [--origin https://app.runeditrun.com]`
|
|
348
|
+
redeems a browser-created code, prints a six-digit confirmation number and waits
|
|
349
|
+
for approval in the browser that created it. Device credentials stay in macOS
|
|
350
|
+
Keychain or Linux Secret Service. A missing or locked Secret Service refuses;
|
|
351
|
+
there is no plaintext credential store. Linux needs `secret-tool` and an
|
|
352
|
+
unlocked desktop Secret Service session.
|
|
353
|
+
|
|
354
|
+
In a terminal, connect asks separately before adding Claude Code user Read deny
|
|
355
|
+
rules, allowing export-scoped macOS wake prevention, and installing a launchd
|
|
356
|
+
or systemd user service. Only the exact answer `yes` opts in. Noninteractive
|
|
357
|
+
connect pairs but leaves those optional changes off. Background services use
|
|
358
|
+
absolute Node and CLI paths. No model process is started.
|
|
359
|
+
|
|
360
|
+
`rer business vendor-key add sentry` requires hidden credential entry in a
|
|
361
|
+
terminal, stores it in the OS keychain and prints only `sentry:read`.
|
|
362
|
+
`remove` deletes it. The same commands support `uptimerobot`, `pagerduty` and
|
|
363
|
+
`calendly`. Never put a key in command arguments, chat or a URL.
|
|
364
|
+
|
|
365
|
+
`rer business next` returns one locally templated classification or owner link,
|
|
366
|
+
or `Nothing yet`, within 60 seconds. It never reflects server instructions or
|
|
367
|
+
raw evidence. Owner items cannot be answered from this CLI.
|
|
368
|
+
`rer business answer ID VENDOR uses|sells|both|product-dependency [CONFIDENCE]`
|
|
369
|
+
submits a task-scoped classification through MCP. Choose a vendor ID from the
|
|
370
|
+
question's displayed answer schema, or `none`; the suggested vendor can be
|
|
371
|
+
corrected. Confidence is a number from 0 to 1, defaulting to 1. The completion
|
|
372
|
+
sends exactly `{vendor_id, usage, confidence}`. Free text is refused locally.
|
|
373
|
+
The owner confirms the inventory in the browser.
|
|
374
|
+
`rer business token` emits an MCP Authorization header object for direct use as
|
|
375
|
+
a headers helper. That output is a short-lived credential: connect it directly
|
|
376
|
+
to the MCP client and do not paste it into an agent transcript.
|
|
377
|
+
|
|
378
|
+
`rer business status` shows local pairing, service state and progress without
|
|
379
|
+
printing checkpoints or vendor data. `rer business disconnect` removes the
|
|
380
|
+
service, device and vendor credentials, state and introduced Claude rules,
|
|
381
|
+
preserving preexisting settings and unrelated edits. Revocation in the browser
|
|
382
|
+
removes remote authority; disconnect removes the local installation's additions.
|
|
383
|
+
|
|
384
|
+
`rer business run` performs consented `discover.local` tasks through claims,
|
|
385
|
+
short-lived task bearers, quota-bound uploads, 60-second heartbeats and server
|
|
386
|
+
completion checks. Only the browser consent's paths are scanned. Names-only
|
|
387
|
+
snapshots and page boundaries are saved privately so a killed supervisor can
|
|
388
|
+
resume from its server checkpoint without rescanning a changed tree. Snapshots
|
|
389
|
+
are removed after completion. A missing snapshot for an acknowledged page is
|
|
390
|
+
an explicit error. Revocation stops the supervisor on its next 401.
|
|
391
|
+
|
|
392
|
+
**Remaining export blockers:** grants for linked, configured targets now resolve
|
|
393
|
+
to an HTTPS `/api/rer/import/uploads` destination with a 2 MiB quota. They declare
|
|
394
|
+
`upload_authorization: seed_import_grant_required` but supply no signed seed
|
|
395
|
+
import authority. Vendor task inputs, adapter resume checkpoints and the chunk
|
|
396
|
+
assembly/upload contract are also absent. The CLI releases these tasks before
|
|
397
|
+
reading a vendor key; background mode parks them, and `run --once` reports the
|
|
398
|
+
dependency as a command failure. An unavailable destination reports its reason
|
|
399
|
+
and releases with `paused` after a `connected_runner_required` event.
|
|
400
|
+
Vendor export remains blocked.
|
|
401
|
+
|
|
402
|
+
The current MCP `next_question` filters out owner items. When an owner summary
|
|
403
|
+
is supplied, the CLI displays its browser link and refuses to answer it.
|
|
404
|
+
|
|
405
|
+
The four deterministic adapter implementations and their native output formats
|
|
406
|
+
are described in [the adapter guide](cli/business/vendors/README.md). Their
|
|
407
|
+
presence does not enable export until the seed import authority and remaining
|
|
408
|
+
transport contracts are connected.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { dispatcher } from '../checkout.mjs';
|
|
3
|
+
import { repositoryCommands } from './repository-contract.mjs';
|
|
4
|
+
|
|
5
|
+
// The checkout owns its capabilities; acquisition is the installed CLI's
|
|
6
|
+
// capability, including when that checkout pins an older dispatcher.
|
|
7
|
+
export async function describeCommand(target) {
|
|
8
|
+
let description = {};
|
|
9
|
+
if (target.root) {
|
|
10
|
+
const child = spawn(process.execPath, [dispatcher(target.root).entry, ...target.args.filter(arg => arg !== '--json'), '--json'], { cwd: target.root, env: process.env, stdio: ['inherit', 'pipe', 'inherit'] });
|
|
11
|
+
child.stdout.setEncoding('utf8');
|
|
12
|
+
let output = '';
|
|
13
|
+
child.stdout.on('data', data => { output += data; });
|
|
14
|
+
const code = await new Promise((done, reject) => { child.once('error', reject); child.once('close', code => done(code ?? 1)); });
|
|
15
|
+
if (code !== 0) return code;
|
|
16
|
+
description = JSON.parse(output);
|
|
17
|
+
}
|
|
18
|
+
process.stdout.write(JSON.stringify({ ...description, repositoryCommands }, null, target.args.includes('--json') ? undefined : 2) + '\n');
|
|
19
|
+
return 0;
|
|
20
|
+
}
|
package/global/cli/install.mjs
CHANGED
|
@@ -39,7 +39,7 @@ async function writeLauncher(paths) {
|
|
|
39
39
|
await rename(temporary, paths.launcher);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
export async function install() {
|
|
42
|
+
export async function install({ quiet = false } = {}) {
|
|
43
43
|
const paths = layout(), manifest = ownManifest(), digest = await packageDigest(ownRoot);
|
|
44
44
|
const name = `${manifest.version}-${digest.slice(0, 8)}`, channel = process.env.RER_INSTALL_CHANNEL === 'script' ? 'script' : 'npx';
|
|
45
45
|
const launcher = await launcherOwner(paths.launcher);
|
|
@@ -53,7 +53,7 @@ export async function install() {
|
|
|
53
53
|
try { present = await packageDigest(join(paths.versions, name)) === digest; } catch (error) { if (error.code !== 'ENOENT') throw error; }
|
|
54
54
|
if (present && current === join('versions', name) && launcher.text === script && record?.channel === channel) {
|
|
55
55
|
const advice = await pathAdvice(paths);
|
|
56
|
-
process.stdout.write(`rer ${manifest.version} is already current (${join(paths.versions, name)}). Nothing changed.\n${advice ? advice + '\n' : ''}`);
|
|
56
|
+
if (!quiet) process.stdout.write(`rer ${manifest.version} is already current (${join(paths.versions, name)}). Nothing changed.\n${advice ? advice + '\n' : ''}`);
|
|
57
57
|
return 0;
|
|
58
58
|
}
|
|
59
59
|
if (!present) { await rm(join(paths.versions, name), { recursive: true, force: true }); await copyVersion(paths, name); }
|
|
@@ -67,6 +67,6 @@ export async function install() {
|
|
|
67
67
|
await writeFile(paths.record, JSON.stringify({ channel, links: record?.links ?? [], previous: previousName && keep.has(previousName) ? previousName : null }, null, 2) + '\n', { mode: 0o644 });
|
|
68
68
|
if (launcher.text !== script) await writeLauncher(paths);
|
|
69
69
|
const advice = await pathAdvice(paths);
|
|
70
|
-
process.stdout.write(`Installed rer ${manifest.version} in ${join(paths.versions, name)}.\n${paths.launcher} runs it.${previousName ? ` The previous version (${previousName}) is kept.` : ''}\n${advice ? advice + '\n' : ''}`);
|
|
70
|
+
if (!quiet) process.stdout.write(`Installed rer ${manifest.version} in ${join(paths.versions, name)}.\n${paths.launcher} runs it.${previousName ? ` The previous version (${previousName}) is kept.` : ''}\n${advice ? advice + '\n' : ''}`);
|
|
71
71
|
return 0;
|
|
72
72
|
}
|