@indigoai-us/hq-cloud 6.16.46-alpha.1 → 6.16.47
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/dist/bin/sync-runner-planning.d.ts +3 -12
- package/dist/bin/sync-runner-planning.d.ts.map +1 -1
- package/dist/bin/sync-runner-planning.js +3 -65
- package/dist/bin/sync-runner-planning.js.map +1 -1
- package/dist/bin/sync-runner-planning.test.js +1 -108
- package/dist/bin/sync-runner-planning.test.js.map +1 -1
- package/dist/bin/sync-runner-watch-loop.d.ts.map +1 -1
- package/dist/bin/sync-runner-watch-loop.js +1 -9
- package/dist/bin/sync-runner-watch-loop.js.map +1 -1
- package/dist/bin/sync-runner.d.ts +4 -15
- package/dist/bin/sync-runner.d.ts.map +1 -1
- package/dist/bin/sync-runner.js +1 -27
- package/dist/bin/sync-runner.js.map +1 -1
- package/dist/bin/sync-runner.test.js +2 -211
- package/dist/bin/sync-runner.test.js.map +1 -1
- package/dist/cli/rescue-core.d.ts +18 -0
- package/dist/cli/rescue-core.d.ts.map +1 -1
- package/dist/cli/rescue-core.js +69 -31
- package/dist/cli/rescue-core.js.map +1 -1
- package/dist/cli/rescue-realpath.test.d.ts +2 -0
- package/dist/cli/rescue-realpath.test.d.ts.map +1 -0
- package/dist/cli/rescue-realpath.test.js +109 -0
- package/dist/cli/rescue-realpath.test.js.map +1 -0
- package/dist/cli/rescue-rsync-preflight.test.js +256 -4
- package/dist/cli/rescue-rsync-preflight.test.js.map +1 -1
- package/dist/cli/rescue-source-switch-floor.test.d.ts +2 -0
- package/dist/cli/rescue-source-switch-floor.test.d.ts.map +1 -0
- package/dist/cli/rescue-source-switch-floor.test.js +210 -0
- package/dist/cli/rescue-source-switch-floor.test.js.map +1 -0
- package/dist/cli/sync-scope.test.js +0 -8
- package/dist/cli/sync-scope.test.js.map +1 -1
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +76 -135
- package/dist/cli/sync.js.map +1 -1
- package/dist/cli/sync.test.js +1 -11
- package/dist/cli/sync.test.js.map +1 -1
- package/dist/lib/exit-codes.d.ts +0 -15
- package/dist/lib/exit-codes.d.ts.map +1 -1
- package/dist/lib/exit-codes.js +0 -15
- package/dist/lib/exit-codes.js.map +1 -1
- package/dist/s3.d.ts +0 -1
- package/dist/s3.d.ts.map +1 -1
- package/dist/s3.js +2 -20
- package/dist/s3.js.map +1 -1
- package/dist/sync/realtime-telemetry.d.ts +1 -1
- package/dist/sync/realtime-telemetry.d.ts.map +1 -1
- package/dist/sync/realtime-telemetry.js +6 -14
- package/dist/sync/realtime-telemetry.js.map +1 -1
- package/dist/sync/realtime-telemetry.test.js +16 -136
- package/dist/sync/realtime-telemetry.test.js.map +1 -1
- package/package.json +1 -2
- package/dist/cli/onepass-pull-planner-regressions.test.d.ts +0 -2
- package/dist/cli/onepass-pull-planner-regressions.test.d.ts.map +0 -1
- package/dist/cli/onepass-pull-planner-regressions.test.js +0 -300
- package/dist/cli/onepass-pull-planner-regressions.test.js.map +0 -1
- package/dist/cli/onepass-pull-planner.test.d.ts +0 -2
- package/dist/cli/onepass-pull-planner.test.d.ts.map +0 -1
- package/dist/cli/onepass-pull-planner.test.js +0 -266
- package/dist/cli/onepass-pull-planner.test.js.map +0 -1
- package/dist/cli/streaming-pull-planner.bench.test.d.ts +0 -15
- package/dist/cli/streaming-pull-planner.bench.test.d.ts.map +0 -1
- package/dist/cli/streaming-pull-planner.bench.test.js +0 -273
- package/dist/cli/streaming-pull-planner.bench.test.js.map +0 -1
- package/dist/s3.list-cost.test.d.ts +0 -2
- package/dist/s3.list-cost.test.d.ts.map +0 -1
- package/dist/s3.list-cost.test.js +0 -51
- package/dist/s3.list-cost.test.js.map +0 -1
- package/dist/sync/remote-file-spool.d.ts +0 -16
- package/dist/sync/remote-file-spool.d.ts.map +0 -1
- package/dist/sync/remote-file-spool.js +0 -91
- package/dist/sync/remote-file-spool.js.map +0 -1
- package/dist/sync/remote-file-spool.test.d.ts +0 -2
- package/dist/sync/remote-file-spool.test.d.ts.map +0 -1
- package/dist/sync/remote-file-spool.test.js +0 -77
- package/dist/sync/remote-file-spool.test.js.map +0 -1
|
@@ -27,6 +27,17 @@ export declare function envValue(env: NodeJS.ProcessEnv, name: string): string |
|
|
|
27
27
|
* drive roots explicitly instead of relying on Cygwin's native-path fallback.
|
|
28
28
|
*/
|
|
29
29
|
export declare function toCygwinRsyncPath(localPath: string): string;
|
|
30
|
+
interface RsyncPathCandidate {
|
|
31
|
+
path: string;
|
|
32
|
+
executable: boolean;
|
|
33
|
+
}
|
|
34
|
+
interface RsyncLauncher {
|
|
35
|
+
command: string;
|
|
36
|
+
leadingArgs: string[];
|
|
37
|
+
}
|
|
38
|
+
export declare function findRsyncOnPath(entries: string[], env: NodeJS.ProcessEnv): RsyncPathCandidate | undefined;
|
|
39
|
+
/** The overlay requires rsync; do not allocate a recovery copy when it cannot run. */
|
|
40
|
+
export declare function requireWorkingRsync(env: NodeJS.ProcessEnv, err: (s: string) => void): RsyncLauncher;
|
|
30
41
|
/**
|
|
31
42
|
* Parse the rescue argv exactly as the bash `while case` loop did, including
|
|
32
43
|
* validation and the same exit codes (1 unknown/usage, 2 bad option). Throws
|
|
@@ -54,6 +65,13 @@ export declare function runRescue(argv: string[], opts?: {
|
|
|
54
65
|
* absolute.
|
|
55
66
|
*/
|
|
56
67
|
export declare function isUsableRescueRoot(root: string, platformPath?: path.PlatformPath): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Canonicalize the rescue root without treating a known-good directory as
|
|
70
|
+
* unusable when Node's JavaScript realpath walker cannot inspect a Windows
|
|
71
|
+
* drive prefix. Prefer the native syscall, retain the JS walker as a fallback,
|
|
72
|
+
* and use an absolute path only after stat confirms it is a directory.
|
|
73
|
+
*/
|
|
74
|
+
export declare function realpathOrExit(p: string, err: (s: string) => void): string;
|
|
57
75
|
export type RescueDecision = {
|
|
58
76
|
kind: "skip";
|
|
59
77
|
rel: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rescue-core.d.ts","sourceRoot":"","sources":["../../src/cli/rescue-core.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAa7B,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;CAChB;AA0CD,UAAU,MAAM;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,OAAO,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AA6CD,oFAAoF;AACpF,wBAAgB,QAAQ,CACtB,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,SAAS,CASpB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAS3D;
|
|
1
|
+
{"version":3,"file":"rescue-core.d.ts","sourceRoot":"","sources":["../../src/cli/rescue-core.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAa7B,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;CAChB;AA0CD,UAAU,MAAM;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,OAAO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A;CAAE,GAC/B,IAAI,CAcN;AA8BD,UAAU,YAAY;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,eAAe,GAAG,cAAc,CAAC;IAC/C;uDACmD;IACnD,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B;AAeD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,YAAY,EACjB,qBAAqB,EAAE,MAAM,GAAG,IAAI,EACpC,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,EACxB,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,GACvB,IAAI,CA8LN"}
|
package/dist/cli/rescue-core.js
CHANGED
|
@@ -148,10 +148,26 @@ function boundedDiagnostic(value, limit) {
|
|
|
148
148
|
function pathEntries(pathValue) {
|
|
149
149
|
return pathValue ? pathValue.split(path.delimiter) : [];
|
|
150
150
|
}
|
|
151
|
-
|
|
151
|
+
const DEFAULT_WINDOWS_EXECUTABLE_EXTENSIONS = [".COM", ".EXE", ".BAT", ".CMD"];
|
|
152
|
+
function rsyncCandidateNames(env) {
|
|
153
|
+
if (process.platform !== "win32")
|
|
154
|
+
return ["rsync", "rsync.exe"];
|
|
155
|
+
const configuredExtensions = envValue(env, "PATHEXT")
|
|
156
|
+
?.split(";")
|
|
157
|
+
.map((extension) => extension.trim())
|
|
158
|
+
.filter((extension) => /^\.[A-Za-z0-9]+$/.test(extension));
|
|
159
|
+
const extensions = [
|
|
160
|
+
...(configuredExtensions?.length
|
|
161
|
+
? configuredExtensions
|
|
162
|
+
: DEFAULT_WINDOWS_EXECUTABLE_EXTENSIONS),
|
|
163
|
+
...DEFAULT_WINDOWS_EXECUTABLE_EXTENSIONS,
|
|
164
|
+
];
|
|
165
|
+
return [...new Set(["rsync", ...extensions.map((extension) => `rsync${extension.toLowerCase()}`)])];
|
|
166
|
+
}
|
|
167
|
+
export function findRsyncOnPath(entries, env) {
|
|
152
168
|
let firstUnexecutable;
|
|
153
169
|
for (const entry of entries) {
|
|
154
|
-
for (const name of
|
|
170
|
+
for (const name of rsyncCandidateNames(env)) {
|
|
155
171
|
const candidate = path.resolve(entry || ".", name);
|
|
156
172
|
try {
|
|
157
173
|
if (!fs.statSync(candidate).isFile())
|
|
@@ -174,14 +190,22 @@ function findRsyncOnPath(entries) {
|
|
|
174
190
|
: undefined;
|
|
175
191
|
}
|
|
176
192
|
/** The overlay requires rsync; do not allocate a recovery copy when it cannot run. */
|
|
177
|
-
function requireWorkingRsync(env, err) {
|
|
193
|
+
export function requireWorkingRsync(env, err) {
|
|
178
194
|
const resolvedPath = envValue(env, "PATH");
|
|
179
195
|
const entries = pathEntries(resolvedPath);
|
|
180
|
-
const foundRsync = findRsyncOnPath(entries);
|
|
181
|
-
|
|
196
|
+
const foundRsync = findRsyncOnPath(entries, env);
|
|
197
|
+
// Node documents that Windows .cmd/.bat files require cmd.exe rather than a
|
|
198
|
+
// direct child-process launch. Keep the path and fixed argument as distinct
|
|
199
|
+
// arguments instead of enabling shell:true for a constructed command string.
|
|
200
|
+
const launcher = process.platform === "win32" && /\.(?:cmd|bat)$/i.test(foundRsync?.path ?? "")
|
|
201
|
+
? { command: "cmd.exe", leadingArgs: ["/d", "/s", "/c", foundRsync.path] }
|
|
202
|
+
: { command: "rsync", leadingArgs: [] };
|
|
203
|
+
const probe = runWithSpawnError(launcher.command, [...launcher.leadingArgs, "--version"], {
|
|
204
|
+
env,
|
|
205
|
+
});
|
|
182
206
|
const output = `${probe.stdout}\n${probe.stderr}`;
|
|
183
207
|
if (probe.status === 0 && /\brsync\b.*\bversion\b/i.test(output))
|
|
184
|
-
return;
|
|
208
|
+
return launcher;
|
|
185
209
|
err("error: rsync preflight failed before any safety snapshot was allocated.\n");
|
|
186
210
|
if (probe.error) {
|
|
187
211
|
const errorDetail = "code" in probe.error && typeof probe.error.code === "string"
|
|
@@ -483,17 +507,33 @@ export function isUsableRescueRoot(root, platformPath = path) {
|
|
|
483
507
|
return platformPath.isAbsolute(root);
|
|
484
508
|
}
|
|
485
509
|
/**
|
|
486
|
-
*
|
|
487
|
-
*
|
|
488
|
-
*
|
|
510
|
+
* Canonicalize the rescue root without treating a known-good directory as
|
|
511
|
+
* unusable when Node's JavaScript realpath walker cannot inspect a Windows
|
|
512
|
+
* drive prefix. Prefer the native syscall, retain the JS walker as a fallback,
|
|
513
|
+
* and use an absolute path only after stat confirms it is a directory.
|
|
489
514
|
*/
|
|
490
|
-
function realpathOrExit(p, err) {
|
|
515
|
+
export function realpathOrExit(p, err) {
|
|
491
516
|
try {
|
|
492
|
-
return fs.realpathSync(p);
|
|
517
|
+
return fs.realpathSync.native(p);
|
|
493
518
|
}
|
|
494
|
-
catch
|
|
495
|
-
|
|
496
|
-
|
|
519
|
+
catch {
|
|
520
|
+
try {
|
|
521
|
+
return fs.realpathSync(p);
|
|
522
|
+
}
|
|
523
|
+
catch (realpathError) {
|
|
524
|
+
const resolved = path.resolve(p);
|
|
525
|
+
try {
|
|
526
|
+
if (!fs.statSync(resolved).isDirectory()) {
|
|
527
|
+
throw new Error("resolved path is not a directory");
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
catch {
|
|
531
|
+
err(`error: cannot resolve --hq-root ${p}: ${realpathError instanceof Error ? realpathError.message : String(realpathError)}\n`);
|
|
532
|
+
throw new ExitError(1);
|
|
533
|
+
}
|
|
534
|
+
err("warning: could not canonicalize --hq-root; using a normalized absolute path.\n");
|
|
535
|
+
return resolved;
|
|
536
|
+
}
|
|
497
537
|
}
|
|
498
538
|
}
|
|
499
539
|
function doRescue(cfg, env, out, err, setTmp) {
|
|
@@ -548,7 +588,7 @@ function doRescue(cfg, env, out, err, setTmp) {
|
|
|
548
588
|
// Both the release overlay and a restorable snapshot require rsync. A shim
|
|
549
589
|
// which merely starts but exits non-zero used to trigger an enormous cp -a
|
|
550
590
|
// fallback, then fail later at overlay. Stop before classification/allocation.
|
|
551
|
-
requireWorkingRsync(env, err);
|
|
591
|
+
const rsyncLauncher = requireWorkingRsync(env, err);
|
|
552
592
|
// --- Capture the pre-rescue .claude/settings.json (BEFORE the wipe) ---
|
|
553
593
|
// This is `ours` for the post-overlay settings reconcile. It must be read now
|
|
554
594
|
// because the overlay-safe classification deletes/overwrites it before
|
|
@@ -582,8 +622,9 @@ function doRescue(cfg, env, out, err, setTmp) {
|
|
|
582
622
|
prevSyncRef = yq('.replaced_from_source.ref // .replaced_from_staging.ref // ""');
|
|
583
623
|
prevSyncAt = yq('.replaced_from_source.last_sync_at // .replaced_from_staging.last_sync_at // ""');
|
|
584
624
|
}
|
|
585
|
-
//
|
|
586
|
-
|
|
625
|
+
// An explicit caller floor is the recovery path for a missing or stale stamp.
|
|
626
|
+
// It remains safe because the selected release clone must still contain it.
|
|
627
|
+
if (cfg.floorShaOverride) {
|
|
587
628
|
prevSyncSha = cfg.floorShaOverride;
|
|
588
629
|
prevSyncSource = cfg.sourceRepo;
|
|
589
630
|
prevSyncRef = "(caller-supplied floor)";
|
|
@@ -592,12 +633,8 @@ function doRescue(cfg, env, out, err, setTmp) {
|
|
|
592
633
|
out(`==> HQ root: ${hqRoot}\n`);
|
|
593
634
|
out(`==> Source: https://github.com/${cfg.sourceRepo} @ ${cfg.ref}\n`);
|
|
594
635
|
if (prevSyncSha) {
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
}
|
|
598
|
-
else {
|
|
599
|
-
out(`==> Prior sync: ${prevSyncSha} from ${prevSyncSource} (different source — ignoring as floor)\n`);
|
|
600
|
-
}
|
|
636
|
+
const sourceLabel = prevSyncSource || "(source not recorded)";
|
|
637
|
+
out(`==> Prior sync: ${prevSyncSha} from ${sourceLabel}@${prevSyncRef} (${prevSyncAt}) — checking cloned release history for floor\n`);
|
|
601
638
|
}
|
|
602
639
|
if (cfg.narrowPaths.length !== 0) {
|
|
603
640
|
out("==> Mode: narrow (--paths)\n");
|
|
@@ -753,21 +790,22 @@ function doRescue(cfg, env, out, err, setTmp) {
|
|
|
753
790
|
// --- Resolve history floor ---
|
|
754
791
|
let historyFloor = "";
|
|
755
792
|
let baselineMode = "head_compare";
|
|
756
|
-
if (cfg.historyCheck && prevSyncSha
|
|
793
|
+
if (cfg.historyCheck && prevSyncSha) {
|
|
757
794
|
if (run("git", ["cat-file", "-e", prevSyncSha], { cwd: srcDir, env })
|
|
758
795
|
.status === 0) {
|
|
759
796
|
historyFloor = prevSyncSha;
|
|
760
797
|
baselineMode = "history_floor";
|
|
761
798
|
}
|
|
762
799
|
else {
|
|
763
|
-
out(` prior-sync SHA ${prevSyncSha} not reachable in
|
|
800
|
+
out(` WARN: prior-sync SHA ${prevSyncSha} is not reachable in the cloned release history; falling back to head_compare\n`);
|
|
764
801
|
}
|
|
765
802
|
}
|
|
766
803
|
if (baselineMode === "history_floor") {
|
|
767
804
|
out(`==> Baseline: ${historyFloor} (last-sync floor reachable)\n`);
|
|
768
805
|
}
|
|
769
806
|
else {
|
|
770
|
-
out("==> Baseline: HEAD compare (no usable last-sync
|
|
807
|
+
out("==> Baseline: HEAD compare (no usable reachable last-sync floor)\n");
|
|
808
|
+
out("==> WARNING: retired release files cannot be detected or removed in head_compare mode. Re-run with history checking and --floor-sha <sha> for a reachable baseline.\n");
|
|
771
809
|
}
|
|
772
810
|
// --- Build wipe/overlay arg sets per mode ---
|
|
773
811
|
const pruneNames = [];
|
|
@@ -892,7 +930,7 @@ function doRescue(cfg, env, out, err, setTmp) {
|
|
|
892
930
|
if (cfg.dryRun) {
|
|
893
931
|
out("\n");
|
|
894
932
|
out("==> DRY RUN classification summary:\n");
|
|
895
|
-
out(` user-only (
|
|
933
|
+
out(` user-only (left in place under release-managed roots): ${counts.userOnly} files\n`);
|
|
896
934
|
out(` unchanged (preserved/re-laid): ${counts.unchanged} files\n`);
|
|
897
935
|
out(` user-edit (rescue / diff-append): ${counts.userEdit} files\n`);
|
|
898
936
|
out(` user-edit (conflict quarantine): ${counts.userConflict} files\n`);
|
|
@@ -968,7 +1006,7 @@ function doRescue(cfg, env, out, err, setTmp) {
|
|
|
968
1006
|
];
|
|
969
1007
|
// Exercise the exact overlay command before any classified delete/move. A
|
|
970
1008
|
// Cygwin path conversion or filter failure therefore leaves the root intact.
|
|
971
|
-
const overlayPreflight = run(
|
|
1009
|
+
const overlayPreflight = run(rsyncLauncher.command, [...rsyncLauncher.leadingArgs, "--dry-run", ...overlayArgs], { env });
|
|
972
1010
|
if (overlayPreflight.status !== 0) {
|
|
973
1011
|
err(overlayPreflight.stderr);
|
|
974
1012
|
throw new ExitError(overlayPreflight.status || 1);
|
|
@@ -1053,7 +1091,7 @@ function doRescue(cfg, env, out, err, setTmp) {
|
|
|
1053
1091
|
toCygwinRsyncPath(hqRoot + "/"),
|
|
1054
1092
|
]
|
|
1055
1093
|
: overlayArgs;
|
|
1056
|
-
const overlay = run(
|
|
1094
|
+
const overlay = run(rsyncLauncher.command, [...rsyncLauncher.leadingArgs, ...overlayRunArgs], { env });
|
|
1057
1095
|
if (overlay.status !== 0) {
|
|
1058
1096
|
// bash runs under set -e: a failed rsync aborts with its status.
|
|
1059
1097
|
err(overlay.stderr);
|
|
@@ -1194,7 +1232,7 @@ function doRescue(cfg, env, out, err, setTmp) {
|
|
|
1194
1232
|
}
|
|
1195
1233
|
out("\n");
|
|
1196
1234
|
out("==> Classification:\n");
|
|
1197
|
-
out(` user-only (left in place):
|
|
1235
|
+
out(` user-only (left in place under release-managed roots): ${counts.userOnly} files\n`);
|
|
1198
1236
|
out(` unchanged (preserved/re-laid): ${counts.unchanged} files\n`);
|
|
1199
1237
|
out(` user-edits (rescued): ${counts.userEdit} files\n`);
|
|
1200
1238
|
out(` user-edits (conflict quarantine): ${counts.userConflict} files\n`);
|
|
@@ -1229,7 +1267,7 @@ function doRescue(cfg, env, out, err, setTmp) {
|
|
|
1229
1267
|
lines.push("Baseline: head_compare (no last-sync stamp; first run or floor unreachable)");
|
|
1230
1268
|
}
|
|
1231
1269
|
lines.push("", "## What the rescue did");
|
|
1232
|
-
lines.push(` user-only (left in place):
|
|
1270
|
+
lines.push(` user-only (left in place under release-managed roots): ${counts.userOnly}`);
|
|
1233
1271
|
lines.push(` unchanged (preserved/re-laid): ${counts.unchanged}`);
|
|
1234
1272
|
lines.push(` user-edit (rescued into personal/): ${counts.userEdit}`);
|
|
1235
1273
|
lines.push(` user-edit (conflict quarantine): ${counts.userConflict}`);
|