@runeditrun/rer 0.2.81 → 0.2.82
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 +12 -0
- package/cli/export.mjs +1 -1
- package/edition-authoring/base-copies.mjs +3 -1
- package/edition-authoring/copy-checkout.mjs +152 -1
- package/edition-authoring/files.mjs +1 -1
- package/edition-authoring/runtime-dependencies.mjs +1 -1
- package/global/CHANGELOG.md +13 -0
- package/global/README.md +12 -0
- package/modules/import-kit/src/door/ADOPTING.md +452 -0
- package/modules/import-kit/src/door/README.md +553 -0
- package/modules/import-kit/src/door/admission.ts +45 -0
- package/modules/import-kit/src/door/archive.ts +129 -0
- package/modules/import-kit/src/door/authority.ts +107 -0
- package/modules/import-kit/src/door/failures.ts +70 -0
- package/modules/import-kit/src/door/grants.ts +162 -0
- package/modules/import-kit/src/door/handler.ts +90 -0
- package/modules/import-kit/src/door/index.ts +20 -0
- package/modules/import-kit/src/door/intake/csv.ts +74 -0
- package/modules/import-kit/src/door/intake/json.ts +182 -0
- package/modules/import-kit/src/door/intake/projection.ts +61 -0
- package/modules/import-kit/src/door/intake/types.ts +28 -0
- package/modules/import-kit/src/door/intake-policy.ts +38 -0
- package/modules/import-kit/src/door/intake-upload.ts +91 -0
- package/modules/import-kit/src/door/inventory.ts +68 -0
- package/modules/import-kit/src/door/jobs.ts +134 -0
- package/modules/import-kit/src/door/limits.ts +16 -0
- package/modules/import-kit/src/door/operator.ts +41 -0
- package/modules/import-kit/src/door/planning.ts +227 -0
- package/modules/import-kit/src/door/protocol.ts +38 -0
- package/modules/import-kit/src/door/refusals.ts +51 -0
- package/modules/import-kit/src/door/schema.ts +101 -0
- package/modules/import-kit/src/door/store.ts +152 -0
- package/modules/import-kit/src/door/types.ts +100 -0
- package/modules/import-kit/src/door/uploads.ts +98 -0
- package/modules/import-kit/src/provenance/numeric-credentials.ts +40 -0
- package/modules/import-kit/src/readers/README.md +139 -0
- package/modules/import-kit/src/readers/api-policy.ts +67 -0
- package/modules/import-kit/src/readers/api.ts +86 -0
- package/modules/import-kit/src/readers/bytes.ts +73 -0
- package/modules/import-kit/src/readers/errors.ts +33 -0
- package/modules/import-kit/src/readers/file.ts +74 -0
- package/modules/import-kit/src/readers/index.ts +3 -0
- package/modules/import-kit/src/readers/json.ts +29 -0
- package/modules/import-kit/src/readers/numeric-lexemes.ts +104 -0
- package/modules/import-kit/src/readers/original.ts +31 -0
- package/modules/import-kit/src/readers/records.ts +105 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -337,6 +337,7 @@ line that still names it. A later refresh is a version bump:
|
|
|
337
337
|
| `@runeditrun/rer/modules/deploy-kit/owner`, `/owner-cli`, `/prepare`, `/provider` | deploy kit | `scripts/base-cli/modules/deploy-kit/*.mjs` |
|
|
338
338
|
| `@runeditrun/rer/modules/operator-auth`, `/dev`, `/dev-admission`, `/accounts/native`, `/identity/email-link` | operator auth | `scripts/base-cli/modules/operator-auth/index.mjs`, `dev/index.mjs`, `dev-admission.mjs`, `accounts/native.mjs`, `identity/email-link/index.mjs` |
|
|
339
339
|
| `@runeditrun/rer/modules/import-kit/d1` | asynchronous D1 import, reviewed reversal-policy conversion and preserved-undo preview (TypeScript Worker entry) | `scripts/base-cli/modules/import-kit/src/d1/index.ts` |
|
|
340
|
+
| `@runeditrun/rer/modules/import-kit/door` | reviewed operator and grant intake, plan, apply, reconciliation and Undo (TypeScript Worker entry) | `scripts/base-cli/modules/import-kit/src/door/index.ts` |
|
|
340
341
|
| `@runeditrun/rer/modules/erasure/fence` | erasure fence statements | `scripts/base-cli/modules/erasure/fence.mjs` |
|
|
341
342
|
| `@runeditrun/rer/modules/owner-claim`, `/modules/dependencies` | owner claim, dependency links | `scripts/base-cli/modules/owner-claim/index.mjs`, `dependencies/index.mjs` |
|
|
342
343
|
| `@runeditrun/rer/internal/PATH` | any other package file, for tests | `scripts/base-cli/PATH`, and `scripts/base-onboarding/PATH` with PATH under `onboarding/` |
|
|
@@ -611,3 +612,14 @@ setup process is still running, `confirm-no-turn-started JOB_ID
|
|
|
611
612
|
checkout changed or the provider recorded a session for it. It reads the
|
|
612
613
|
checkout with Git inside the same boundary, because setup could have changed
|
|
613
614
|
the checkout's Git configuration.
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
## Import door for adopting Workers
|
|
618
|
+
|
|
619
|
+
Bundle `@runeditrun/rer/modules/import-kit/door` to use the maintained
|
|
620
|
+
`createImportOperatorHandler` or `createImportDoorHandler`, schema migrations,
|
|
621
|
+
settings hooks and public option types. This TypeScript entry includes its real
|
|
622
|
+
runtime and type dependencies. The existing
|
|
623
|
+
`@runeditrun/rer/modules/import-kit/d1` entry remains available. See the
|
|
624
|
+
[adoption guide](https://github.com/runeditrun/base/blob/main/modules/import-kit/src/door/ADOPTING.md)
|
|
625
|
+
for native adapters, consent, declared intake projection and reviewed apply/Undo.
|
package/cli/export.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { cliVersion } from './version.mjs';
|
|
|
6
6
|
|
|
7
7
|
// Copy whole maintained source/tooling directories. Python publication scans
|
|
8
8
|
// load sibling modules and data dynamically; they belong in the inventory too.
|
|
9
|
-
export const sourceRoots = ['default-seed/public/rer-theme.css', 'default-seed/public/brand/mark.svg', 'default-seed/public/fonts/outfit', 'bin/rer.mjs', 'cli', 'modules/delivery-producer/declarations.mjs', 'modules/delivery-producer/bindings.mjs', 'modules/delivery-producer/migrations.mjs', 'modules/delivery-producer/mail.mjs', 'modules/job-queue', 'modules/release', 'modules/deploy-kit', 'modules/site', 'modules/container', 'modules/demo-host', 'modules/demo', 'modules/integrations/core', 'modules/mail', 'modules/ai', 'modules/portability', 'modules/d1-transport', 'modules/import-kit/src/d1', 'modules/import-kit/src/types.ts', 'modules/import-kit/src/plan', 'modules/import-kit/src/provenance/canonical-hash.ts', 'modules/import-kit/src/provenance/canonical-stream.ts', 'modules/import-kit/src/provenance/credential-names.ts', 'modules/import-kit/src/provenance/credentials.ts', 'modules/import-kit/src/provenance/identity.ts', 'modules/import-kit/src/provenance/json-snapshot.ts', 'modules/import-kit/src/provenance/resumable-sha256.ts', 'modules/import-kit/src/provenance/validate-json.ts', 'modules/import-kit/src/journal/authority.ts', 'modules/import-kit/src/storage/originals.ts', 'modules/import-kit/src/storage/provenance.ts', 'modules/import-kit/src/storage/schema.ts', 'modules/erasure', 'modules/dependencies', 'modules/operator-auth', 'modules/owner-claim', 'operations', 'scripts/publish-check', 'scripts/publish-check.mjs', 'composition/git-source.mjs', 'edition-authoring/adopt.mjs', 'edition-authoring/base-acknowledgements.mjs', 'edition-authoring/base-copies.mjs', 'edition-authoring/cli.mjs', 'edition-authoring/copy-checkout.mjs', 'edition-authoring/files.mjs', 'edition-authoring/lock.mjs', 'edition-authoring/manifest.mjs', 'edition-authoring/offline-git.mjs', 'edition-authoring/parent-comparison.mjs', 'edition-authoring/projection-lock.mjs', 'edition-authoring/release.mjs', 'edition-authoring/runtime-dependencies.mjs', 'edition-authoring/sources.mjs', 'edition-authoring/updates.mjs', 'foundation/runtime/seed-contract.mjs'];
|
|
9
|
+
export const sourceRoots = ['default-seed/public/rer-theme.css', 'default-seed/public/brand/mark.svg', 'default-seed/public/fonts/outfit', 'bin/rer.mjs', 'cli', 'modules/delivery-producer/declarations.mjs', 'modules/delivery-producer/bindings.mjs', 'modules/delivery-producer/migrations.mjs', 'modules/delivery-producer/mail.mjs', 'modules/job-queue', 'modules/release', 'modules/deploy-kit', 'modules/site', 'modules/container', 'modules/demo-host', 'modules/demo', 'modules/integrations/core', 'modules/mail', 'modules/ai', 'modules/portability', 'modules/d1-transport', 'modules/import-kit/src/d1', 'modules/import-kit/src/door', 'modules/import-kit/src/readers', 'modules/import-kit/src/provenance/numeric-credentials.ts', 'modules/import-kit/src/types.ts', 'modules/import-kit/src/plan', 'modules/import-kit/src/provenance/canonical-hash.ts', 'modules/import-kit/src/provenance/canonical-stream.ts', 'modules/import-kit/src/provenance/credential-names.ts', 'modules/import-kit/src/provenance/credentials.ts', 'modules/import-kit/src/provenance/identity.ts', 'modules/import-kit/src/provenance/json-snapshot.ts', 'modules/import-kit/src/provenance/resumable-sha256.ts', 'modules/import-kit/src/provenance/validate-json.ts', 'modules/import-kit/src/journal/authority.ts', 'modules/import-kit/src/storage/originals.ts', 'modules/import-kit/src/storage/provenance.ts', 'modules/import-kit/src/storage/schema.ts', 'modules/erasure', 'modules/dependencies', 'modules/operator-auth', 'modules/owner-claim', 'operations', 'scripts/publish-check', 'scripts/publish-check.mjs', 'composition/git-source.mjs', 'edition-authoring/adopt.mjs', 'edition-authoring/base-acknowledgements.mjs', 'edition-authoring/base-copies.mjs', 'edition-authoring/cli.mjs', 'edition-authoring/copy-checkout.mjs', 'edition-authoring/files.mjs', 'edition-authoring/lock.mjs', 'edition-authoring/manifest.mjs', 'edition-authoring/offline-git.mjs', 'edition-authoring/parent-comparison.mjs', 'edition-authoring/projection-lock.mjs', 'edition-authoring/release.mjs', 'edition-authoring/runtime-dependencies.mjs', 'edition-authoring/sources.mjs', 'edition-authoring/updates.mjs', 'foundation/runtime/seed-contract.mjs'];
|
|
10
10
|
export async function inventory(base, roots = sourceRoots) {
|
|
11
11
|
const files = [];
|
|
12
12
|
async function walk(path) {
|
|
@@ -12,7 +12,7 @@ import crypto from 'node:crypto';
|
|
|
12
12
|
import {execFileSync} from 'node:child_process';
|
|
13
13
|
import {hash, json, git, raw, gitReader, safe, noLinks, testSource} from './files.mjs';
|
|
14
14
|
import {snapshot, acknowledgementDrift} from './base-acknowledgements.mjs';
|
|
15
|
-
import {requireMaterializedCopies} from './copy-checkout.mjs';
|
|
15
|
+
import {completeAuthoringImports, requireMaterializedCopies, preflightRefresh} from './copy-checkout.mjs';
|
|
16
16
|
import {completeRuntimeCopies} from './runtime-dependencies.mjs';
|
|
17
17
|
|
|
18
18
|
export const RECORD = 'base-copies.json';
|
|
@@ -383,6 +383,7 @@ export function refreshCopies(root, {positional: [revision], record: recordPath,
|
|
|
383
383
|
if (!sources.length && !Object.keys(copy.adapted || {}).length) throw Error(`No Base source at ${copy.originPath} in ${revision}`);
|
|
384
384
|
return {copy, sources, retired, removed: Object.keys(copy.files).filter(name => !Object.hasOwn(copy.adapted || {}, name) && !sources.some(([source]) => mapped(source, copy.originPath, copy.path) === name))};
|
|
385
385
|
});
|
|
386
|
+
completeAuthoringImports(root, plans, {tree: next, read, revision, base: origin.repository});
|
|
386
387
|
completeRuntimeCopies(plans, {tree: next, read, local, upstream, revision, checkTarget(name) {
|
|
387
388
|
safe(name); noLinks(root, name);
|
|
388
389
|
const target = path.join(root, name);
|
|
@@ -397,6 +398,7 @@ export function refreshCopies(root, {positional: [revision], record: recordPath,
|
|
|
397
398
|
.filter(([name, object]) => name.split('/').slice(0, -1).includes('migrations') && local(name) && local(name) !== upstream.get(object)).map(([name]) => name));
|
|
398
399
|
if (applied.length) throw Error(`Refusing to rewrite migrations that may already be applied: ${applied.join(', ')}. Base changed these files after they were copied; keep them as they are, drop them from ${recordPath}, and add a new migration for the change instead.`);
|
|
399
400
|
const bytes = read.blobs(plans.flatMap(plan => plan.sources.map(([, {object}]) => object)));
|
|
401
|
+
preflightRefresh(root, plans, recordPath, files);
|
|
400
402
|
const changes = [];
|
|
401
403
|
for (const {copy, sources, removed} of plans) {
|
|
402
404
|
for (const name of removed) { noLinks(root, name); fs.rmSync(path.join(root, name), {force: true}); }
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import {git, raw, safe, noLinks} from './files.mjs';
|
|
3
|
+
import {git, raw, safe, noLinks, testSource} from './files.mjs';
|
|
4
|
+
import {specifiers} from './runtime-dependencies.mjs';
|
|
4
5
|
const quote = value => "'" + value.replaceAll("'", "'\\''") + "'";
|
|
5
6
|
|
|
6
7
|
// -v marks assume-unchanged; -f marks fsmonitor-valid. Read them separately
|
|
@@ -67,3 +68,153 @@ export function requireMaterializedCopies(root, record, files) {
|
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
70
|
}
|
|
71
|
+
|
|
72
|
+
// Every recorded authoring module is a root, including exported mirrors and
|
|
73
|
+
// local adaptations. Edition-owned tracked siblings end traversal at that edge.
|
|
74
|
+
export function completeAuthoringImports(root, plans, {tree, read, revision, base}) {
|
|
75
|
+
const mapped = (name, copy) => copy.path + name.slice(copy.originPath.length);
|
|
76
|
+
const authoring = name => path.posix.basename(path.posix.dirname(name)) === 'edition-authoring' && name.endsWith('.mjs') && !testSource(name);
|
|
77
|
+
const tracked = index(root), planned = new Map(), recorded = new Map(), queue = [];
|
|
78
|
+
for (const plan of plans) {
|
|
79
|
+
for (const name of Object.keys(plan.copy.files)) recorded.set(name, plan);
|
|
80
|
+
for (const [source, entry] of plan.sources) {
|
|
81
|
+
const target = mapped(source, plan.copy);
|
|
82
|
+
planned.set(target, plan);
|
|
83
|
+
if (authoring(source)) queue.push({source, target, entry});
|
|
84
|
+
}
|
|
85
|
+
for (const target of Object.keys(plan.copy.adapted || {})) {
|
|
86
|
+
const source = plan.copy.originPath + target.slice(plan.copy.path.length);
|
|
87
|
+
if (authoring(source)) queue.push({source, target, adapted: true});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const refuse = (target, reason, command) => {
|
|
91
|
+
throw Error(`Cannot refresh authoring import ${target}: ${reason}. Run ${command}, then repeat refresh-base; no files were refreshed.`);
|
|
92
|
+
};
|
|
93
|
+
const move = target => `mv -i -- ${quote(target)} ${quote(target + '.refresh-backup')}`;
|
|
94
|
+
// Unlike the write preflight, closure must also validate files it only relies
|
|
95
|
+
// on. Read actual directory entries to reject aliases, never infer volume case.
|
|
96
|
+
function inspect(target) {
|
|
97
|
+
const parts = safe(target).split('/');
|
|
98
|
+
let parent = root;
|
|
99
|
+
for (const [i, part] of parts.entries()) {
|
|
100
|
+
const absolute = path.join(parent, part), name = parts.slice(0, i + 1).join('/');
|
|
101
|
+
let stat;
|
|
102
|
+
try { stat = fs.lstatSync(absolute); }
|
|
103
|
+
catch (error) {
|
|
104
|
+
if (error.code === 'ENOENT') return null;
|
|
105
|
+
refuse(name, error.message, move(name));
|
|
106
|
+
}
|
|
107
|
+
if (!fs.readdirSync(parent).includes(part)) refuse(name, 'the volume resolves a differently spelled entry', move(name));
|
|
108
|
+
if (stat.isSymbolicLink()) refuse(name, 'symlink in import path', move(name));
|
|
109
|
+
if (i < parts.length - 1 && !stat.isDirectory()) refuse(name, 'import parent is not a directory', move(name));
|
|
110
|
+
if (i === parts.length - 1) {
|
|
111
|
+
if (!stat.isFile()) refuse(name, 'import is not a regular file', move(name));
|
|
112
|
+
return stat;
|
|
113
|
+
}
|
|
114
|
+
parent = absolute;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const blobs = new Map(), seen = new Set();
|
|
118
|
+
for (let i = 0; i < queue.length; i++) {
|
|
119
|
+
const {source, target, entry, adapted} = queue[i];
|
|
120
|
+
if (seen.has(target)) continue;
|
|
121
|
+
seen.add(target);
|
|
122
|
+
inspect(target);
|
|
123
|
+
let bytes;
|
|
124
|
+
if (adapted) bytes = fs.readFileSync(path.join(root, target), 'utf8');
|
|
125
|
+
else {
|
|
126
|
+
if (!blobs.has(entry.object)) blobs.set(entry.object, read.blobs([entry.object]).get(entry.object).toString('utf8'));
|
|
127
|
+
bytes = blobs.get(entry.object);
|
|
128
|
+
}
|
|
129
|
+
for (const specifier of specifiers(bytes)) {
|
|
130
|
+
const directory = path.posix.dirname(source);
|
|
131
|
+
const dependency = path.posix.normalize(path.posix.join(directory, specifier));
|
|
132
|
+
const destination = path.posix.normalize(path.posix.join(path.posix.dirname(target), specifier));
|
|
133
|
+
if (path.posix.dirname(dependency) !== directory) {
|
|
134
|
+
refuse(target, `import ${specifier} leaves its directory`, `\${EDITOR:-vi} ${quote(target)}`);
|
|
135
|
+
}
|
|
136
|
+
const exists = inspect(destination), owner = recorded.get(destination);
|
|
137
|
+
if (owner?.removed.includes(destination)) {
|
|
138
|
+
const original = owner.copy.originPath + destination.slice(owner.copy.path.length);
|
|
139
|
+
const restore = tracked.has(destination) ? `git restore -- ${quote(destination)}` :
|
|
140
|
+
`git -C ${quote(base)} show ${quote(owner.copy.revision + ':' + original)} > ${quote(destination)}`;
|
|
141
|
+
refuse(destination, 'recorded file was removed but is still imported', restore);
|
|
142
|
+
}
|
|
143
|
+
if (planned.has(destination) || owner) continue;
|
|
144
|
+
if (tracked.has(destination)) {
|
|
145
|
+
if (!exists) refuse(destination, 'tracked edition source is missing', `git restore -- ${quote(destination)}`);
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
if (exists) refuse(destination, 'existing file has no Base copy record or Git index entry', `git add -f -- ${quote(destination)}`);
|
|
149
|
+
const value = tree.get(dependency);
|
|
150
|
+
if (!value) refuse(destination, `no source at ${dependency} in ${revision}`, `\${EDITOR:-vi} ${quote(target)}`);
|
|
151
|
+
// A directory copy can already own this destination's namespace. Extend
|
|
152
|
+
// that record; otherwise the dependency is a new singleton copy.
|
|
153
|
+
let plan = plans.find(plan => destination.startsWith(plan.copy.path + '/'));
|
|
154
|
+
if (plan && mapped(dependency, plan.copy) !== destination) {
|
|
155
|
+
refuse(destination, 'source cannot fit its enclosing copy record', `\${EDITOR:-vi} base-copies.json`);
|
|
156
|
+
}
|
|
157
|
+
if (!plan) {
|
|
158
|
+
if (plans.some(plan => plan.copy.path.startsWith(destination + '/'))) refuse(destination, 'overlaps a copy directory', `\${EDITOR:-vi} base-copies.json`);
|
|
159
|
+
plan = {copy: {path: destination, originPath: dependency, revision, files: {}, modes: {}}, sources: [], removed: []};
|
|
160
|
+
plans.push(plan);
|
|
161
|
+
}
|
|
162
|
+
plan.sources.push([dependency, value]);
|
|
163
|
+
planned.set(destination, plan);
|
|
164
|
+
queue.push({source: dependency, target: destination, entry: value});
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Inspect real filesystem facts in apply order without opening or changing any
|
|
170
|
+
// file. This cannot see later races, disk-space or I/O failures, umask on newly
|
|
171
|
+
// created directories, or two new names differing only in case on an insensitive
|
|
172
|
+
// volume. Only earlier removals are remembered; no future directory is modelled.
|
|
173
|
+
export function preflightRefresh(root, plans, recordPath, seedFiles) {
|
|
174
|
+
const uid = process.geteuid?.(), freed = new Set();
|
|
175
|
+
const identity = (name, stat) => stat.nlink > 1 ? name : `${stat.dev}:${stat.ino}`;
|
|
176
|
+
const writable = (target, stat, directory = false) => {
|
|
177
|
+
if (uid === 0 && !(stat.mode & 0o222)) throw Error('no write permission bits');
|
|
178
|
+
fs.accessSync(target, fs.constants.W_OK | (directory ? fs.constants.X_OK : 0));
|
|
179
|
+
};
|
|
180
|
+
function inspect(name) {
|
|
181
|
+
let parent = root, parentStat = fs.lstatSync(root);
|
|
182
|
+
if (!parentStat.isDirectory()) throw Error('checkout root is not a directory');
|
|
183
|
+
const parts = safe(name).split('/');
|
|
184
|
+
for (const [i, part] of parts.entries()) {
|
|
185
|
+
const target = path.join(parent, part), relative = parts.slice(0, i + 1).join('/');
|
|
186
|
+
let stat;
|
|
187
|
+
try { stat = fs.lstatSync(target); }
|
|
188
|
+
catch (error) { if (error.code !== 'ENOENT') throw error; }
|
|
189
|
+
if (!stat || (stat.isFile() && freed.has(identity(relative, stat)))) return {parent, parentStat};
|
|
190
|
+
if (i === parts.length - 1) {
|
|
191
|
+
if (!stat.isFile()) throw Error('destination is not a regular file');
|
|
192
|
+
return {parent, parentStat, target, stat};
|
|
193
|
+
}
|
|
194
|
+
if (!stat.isDirectory()) throw Error(`directory required at ${relative}`);
|
|
195
|
+
parent = target; parentStat = stat;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
function check(name, operation) {
|
|
199
|
+
try {
|
|
200
|
+
const found = inspect(name), {parent, parentStat, target, stat} = found;
|
|
201
|
+
if (operation === 'remove') {
|
|
202
|
+
if (!stat) return;
|
|
203
|
+
writable(parent, parentStat, true);
|
|
204
|
+
if (uid !== undefined && uid !== 0 && (parentStat.mode & 0o1000) && uid !== parentStat.uid && uid !== stat.uid) throw Error('sticky parent and file are owned by another user');
|
|
205
|
+
freed.add(identity(name, stat));
|
|
206
|
+
} else if (stat) {
|
|
207
|
+
if (operation !== 'record' && !seedFiles.has(name)) throw Error('existing destination is ignored or resolves a differently spelled entry');
|
|
208
|
+
writable(target, stat);
|
|
209
|
+
if (operation !== 'record' && uid !== undefined && uid !== 0 && uid !== stat.uid) throw Error('file is owned by another user; cannot set its mode');
|
|
210
|
+
} else writable(parent, parentStat, true);
|
|
211
|
+
} catch (error) {
|
|
212
|
+
throw Error(`Cannot refresh ${name}: ${error.message}. Fix the named path and its parent permissions before refreshing; no files were refreshed.`);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
for (const {copy, sources, removed} of plans) {
|
|
216
|
+
for (const name of removed) check(name, 'remove');
|
|
217
|
+
for (const [source] of [...sources].sort(([a], [b]) => a.localeCompare(b))) check(copy.path + source.slice(copy.originPath.length), 'write');
|
|
218
|
+
}
|
|
219
|
+
check(recordPath, 'record');
|
|
220
|
+
}
|
|
@@ -45,7 +45,7 @@ export function noLinks(root, relative) {
|
|
|
45
45
|
let stat;
|
|
46
46
|
try { stat = fs.lstatSync(current); }
|
|
47
47
|
catch (error) { if (error.code !== 'ENOENT') throw error; }
|
|
48
|
-
if (stat?.isSymbolicLink()) throw Error(
|
|
48
|
+
if (stat?.isSymbolicLink()) throw Error(`Symlink in destination path: ${relative} (${path.relative(root, current)})`);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
export function tracked(root, allowMissing = false) {
|
|
@@ -12,7 +12,7 @@ const mapped = (name, from, to) => to + name.slice(from.length);
|
|
|
12
12
|
// Static imports (including type imports), re-exports and literal import() /
|
|
13
13
|
// require() calls share the same relative resolution below. Templates are page
|
|
14
14
|
// content, never static module declarations.
|
|
15
|
-
function specifiers(source) {
|
|
15
|
+
export function specifiers(source) {
|
|
16
16
|
const tokens = [...source.matchAll(/\/\/[^\n]*|\/\*[\s\S]*?\*\/|`(?:\\[\s\S]|[^`\\])*`|'(?:\\[\s\S]|[^'\\])*'|"(?:\\[\s\S]|[^"\\])*"|[\w$]+|[^\s]/g)]
|
|
17
17
|
.map(match => match[0]).filter(token => !token.startsWith('//') && !token.startsWith('/*') && !token.startsWith('`'));
|
|
18
18
|
const result = [];
|
package/global/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.82
|
|
4
|
+
|
|
5
|
+
- Deliver the accepted import-door intake implementation and its runtime and type dependencies at `@runeditrun/rer/modules/import-kit/door`, preserving the D1 entry.
|
|
6
|
+
- Close relative imports from every recorded authoring module, including mirror-origin copies and acknowledged local adaptations, and record newly delivered siblings. Preserve tracked unrecorded siblings without traversing them.
|
|
7
|
+
- Preflight destination types, casing, ownership and effective permissions using filesystem metadata and access checks before writes, accounting for the plan's own removals; overwrites require writable files (and ownership when setting copy modes), while creates and removals require writable, searchable directories. Refuse untracked authoring helper collisions, including ignored files or matching Base bytes. Races, disk and I/O failures, new-directory umasks and two new case-distinct names on an insensitive volume remain outside these checks.
|
|
8
|
+
- Check the packed door lifecycle and refresh pinned Pegboard, Pencil, Dial, Placemat and Envelope checkouts before package publication, resolving every direct authoring module's relative imports, running local and package verification and requiring byte-identical records on repeat.
|
|
9
|
+
- To adopt with a copied authoring CLI predating 0.2.82, update the installed package and run `rer refresh-base --ref FULL_40_HEX_COMMIT --base /absolute/base-checkout` through that package.
|
|
10
|
+
|
|
11
|
+
### Known issues
|
|
12
|
+
|
|
13
|
+
- For a Base-equal untracked, ignored or excluded authoring helper, the suggested `git add -f` followed by refresh can leave `verify-base` reporting `unrecordedCopies`; from the seed root, run `node node_modules/@runeditrun/rer/edition-authoring/cli.mjs record-base LOCAL_PATH ORIGIN_PATH FULL_40_HEX_COMMIT --base /absolute/base-checkout`, then the same entry's `verify-base --base /absolute/base-checkout`. Corrected refusal text ships in 0.2.83.
|
|
14
|
+
- On case-insensitive APFS, the suggested `mv -i` for a Base-equal committed `Copy-Checkout.mjs` can leave the old Git index spelling, so refresh succeeds but verification fails; move its `.refresh-backup` outside the checkout, run `git rm --cached -- PATH/Copy-Checkout.mjs` and `git add -- PATH/copy-checkout.mjs base-copies.json`, then verify again. This preserves both the backup and delivered bytes; corrected refusal text ships in 0.2.83.
|
|
15
|
+
|
|
3
16
|
## 0.2.81
|
|
4
17
|
|
|
5
18
|
- Import RER Platform archives into native installations by migration hash, recording `rer_migrations` as the source ledger without restoring it as product data; expose `mapMigrationLedger` for custom archive adapters and name unapplied files in preflight refusals.
|
package/global/README.md
CHANGED
|
@@ -337,6 +337,7 @@ line that still names it. A later refresh is a version bump:
|
|
|
337
337
|
| `@runeditrun/rer/modules/deploy-kit/owner`, `/owner-cli`, `/prepare`, `/provider` | deploy kit | `scripts/base-cli/modules/deploy-kit/*.mjs` |
|
|
338
338
|
| `@runeditrun/rer/modules/operator-auth`, `/dev`, `/dev-admission`, `/accounts/native`, `/identity/email-link` | operator auth | `scripts/base-cli/modules/operator-auth/index.mjs`, `dev/index.mjs`, `dev-admission.mjs`, `accounts/native.mjs`, `identity/email-link/index.mjs` |
|
|
339
339
|
| `@runeditrun/rer/modules/import-kit/d1` | asynchronous D1 import, reviewed reversal-policy conversion and preserved-undo preview (TypeScript Worker entry) | `scripts/base-cli/modules/import-kit/src/d1/index.ts` |
|
|
340
|
+
| `@runeditrun/rer/modules/import-kit/door` | reviewed operator and grant intake, plan, apply, reconciliation and Undo (TypeScript Worker entry) | `scripts/base-cli/modules/import-kit/src/door/index.ts` |
|
|
340
341
|
| `@runeditrun/rer/modules/erasure/fence` | erasure fence statements | `scripts/base-cli/modules/erasure/fence.mjs` |
|
|
341
342
|
| `@runeditrun/rer/modules/owner-claim`, `/modules/dependencies` | owner claim, dependency links | `scripts/base-cli/modules/owner-claim/index.mjs`, `dependencies/index.mjs` |
|
|
342
343
|
| `@runeditrun/rer/internal/PATH` | any other package file, for tests | `scripts/base-cli/PATH`, and `scripts/base-onboarding/PATH` with PATH under `onboarding/` |
|
|
@@ -611,3 +612,14 @@ setup process is still running, `confirm-no-turn-started JOB_ID
|
|
|
611
612
|
checkout changed or the provider recorded a session for it. It reads the
|
|
612
613
|
checkout with Git inside the same boundary, because setup could have changed
|
|
613
614
|
the checkout's Git configuration.
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
## Import door for adopting Workers
|
|
618
|
+
|
|
619
|
+
Bundle `@runeditrun/rer/modules/import-kit/door` to use the maintained
|
|
620
|
+
`createImportOperatorHandler` or `createImportDoorHandler`, schema migrations,
|
|
621
|
+
settings hooks and public option types. This TypeScript entry includes its real
|
|
622
|
+
runtime and type dependencies. The existing
|
|
623
|
+
`@runeditrun/rer/modules/import-kit/d1` entry remains available. See the
|
|
624
|
+
[adoption guide](https://github.com/runeditrun/base/blob/main/modules/import-kit/src/door/ADOPTING.md)
|
|
625
|
+
for native adapters, consent, declared intake projection and reviewed apply/Undo.
|