pantheon-cli 0.2.85 → 0.2.87
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/pantheon.mjs +74 -10
- package/package.json +1 -1
package/dist/pantheon.mjs
CHANGED
|
@@ -44202,24 +44202,33 @@ function httpDriveWorkspaceHooks(config2, credentials, fetcher = fetch) {
|
|
|
44202
44202
|
}
|
|
44203
44203
|
return manifest;
|
|
44204
44204
|
}
|
|
44205
|
-
async function applyManifest(home, manifest, protectedPaths = /* @__PURE__ */ new Set()) {
|
|
44205
|
+
async function applyManifest(home, manifest, protectedPaths = /* @__PURE__ */ new Set(), onProgress) {
|
|
44206
44206
|
const locallySkipped = readJsonSafe(paths.skipped);
|
|
44207
44207
|
if (locallySkipped?.vaultId === config2.vaultId) {
|
|
44208
44208
|
for (const path of Object.keys(locallySkipped.entries)) {
|
|
44209
44209
|
protectedPaths.add(path);
|
|
44210
44210
|
}
|
|
44211
44211
|
}
|
|
44212
|
+
const downloads = Object.values(manifest.entries).filter((entry) => {
|
|
44213
|
+
const path = normalizeWorkspacePath(entry.path);
|
|
44214
|
+
if (protectedPaths.has(path)) return false;
|
|
44215
|
+
const target = join7(home, ...path.split("/"));
|
|
44216
|
+
const current = existsSync7(target) && lstatSync3(target).isFile() ? sha256(readFileSync6(target)) : null;
|
|
44217
|
+
return current !== entry.sha256;
|
|
44218
|
+
});
|
|
44219
|
+
onProgress?.({
|
|
44220
|
+
phase: "download",
|
|
44221
|
+
completed: 0,
|
|
44222
|
+
total: downloads.length
|
|
44223
|
+
});
|
|
44212
44224
|
const staged = [];
|
|
44213
44225
|
const previous = readJsonSafe(paths.ledger);
|
|
44214
44226
|
mkdirSync6(home, { recursive: true });
|
|
44215
44227
|
let changed = false;
|
|
44216
44228
|
try {
|
|
44217
|
-
for (const entry of
|
|
44229
|
+
for (const entry of downloads) {
|
|
44218
44230
|
const path = normalizeWorkspacePath(entry.path);
|
|
44219
|
-
if (protectedPaths.has(path)) continue;
|
|
44220
44231
|
const target = join7(home, ...path.split("/"));
|
|
44221
|
-
const current = existsSync7(target) && lstatSync3(target).isFile() ? sha256(readFileSync6(target)) : null;
|
|
44222
|
-
if (current === entry.sha256) continue;
|
|
44223
44232
|
const file = await fetcher(
|
|
44224
44233
|
`${config2.apiUrl}/api/cli/workspace/file/${path.split("/").map(encodeURIComponent).join("/")}`,
|
|
44225
44234
|
{
|
|
@@ -44237,6 +44246,12 @@ function httpDriveWorkspaceHooks(config2, credentials, fetcher = fetch) {
|
|
|
44237
44246
|
writeFileSync6(temp, bytes);
|
|
44238
44247
|
staged.push({ temp, target });
|
|
44239
44248
|
changed = true;
|
|
44249
|
+
onProgress?.({
|
|
44250
|
+
phase: "download",
|
|
44251
|
+
completed: staged.length,
|
|
44252
|
+
total: downloads.length,
|
|
44253
|
+
path
|
|
44254
|
+
});
|
|
44240
44255
|
}
|
|
44241
44256
|
for (const item of staged) renameSync2(item.temp, item.target);
|
|
44242
44257
|
for (const path of Object.keys(previous?.entries ?? {}).filter(
|
|
@@ -44308,11 +44323,16 @@ function httpDriveWorkspaceHooks(config2, credentials, fetcher = fetch) {
|
|
|
44308
44323
|
result.error = `${error2.message} Local conflicting files were preserved in ${conflictRoot}. Resolve them there, copy the desired versions back into the vault, and sync again.`;
|
|
44309
44324
|
return result;
|
|
44310
44325
|
}
|
|
44311
|
-
async function refresh(home) {
|
|
44326
|
+
async function refresh(home, options = {}) {
|
|
44312
44327
|
const result = receipt(existsSync7(home) ? "refresh" : "prepare");
|
|
44313
44328
|
quarantineUnownedDriveWorkspace(home, config2.vaultId);
|
|
44314
44329
|
let pending = readJsonSafe(paths.outbox);
|
|
44315
44330
|
if (pending) {
|
|
44331
|
+
options.onProgress?.({
|
|
44332
|
+
phase: "pending",
|
|
44333
|
+
completed: 0,
|
|
44334
|
+
total: pending.changes.length + pending.deletes.length
|
|
44335
|
+
});
|
|
44316
44336
|
const currentPending = pending;
|
|
44317
44337
|
try {
|
|
44318
44338
|
const published = await publishOutbox(
|
|
@@ -44350,8 +44370,18 @@ function httpDriveWorkspaceHooks(config2, credentials, fetcher = fetch) {
|
|
|
44350
44370
|
}
|
|
44351
44371
|
}
|
|
44352
44372
|
try {
|
|
44373
|
+
options.onProgress?.({
|
|
44374
|
+
phase: "manifest",
|
|
44375
|
+
completed: 0,
|
|
44376
|
+
total: 0
|
|
44377
|
+
});
|
|
44353
44378
|
const manifest = await fetchManifest();
|
|
44354
|
-
const changed = await applyManifest(
|
|
44379
|
+
const changed = await applyManifest(
|
|
44380
|
+
home,
|
|
44381
|
+
manifest,
|
|
44382
|
+
/* @__PURE__ */ new Set(),
|
|
44383
|
+
options.onProgress
|
|
44384
|
+
);
|
|
44355
44385
|
result.ok = true;
|
|
44356
44386
|
result.changed = changed;
|
|
44357
44387
|
result.pulled = true;
|
|
@@ -46496,9 +46526,43 @@ async function connect(opts) {
|
|
|
46496
46526
|
const archived2 = quarantineUnownedDriveWorkspace(home, body.vaultId);
|
|
46497
46527
|
saveMachineConfig(config2, credentials);
|
|
46498
46528
|
mkdirSync8(home, { recursive: true });
|
|
46499
|
-
const
|
|
46500
|
-
|
|
46501
|
-
|
|
46529
|
+
const downloading = step("Downloading the Drive vault");
|
|
46530
|
+
let downloaded = 0;
|
|
46531
|
+
let downloadTotal = 0;
|
|
46532
|
+
let prepared;
|
|
46533
|
+
try {
|
|
46534
|
+
prepared = await httpDriveWorkspaceHooks(config2, credentials).refresh(
|
|
46535
|
+
home,
|
|
46536
|
+
{
|
|
46537
|
+
onProgress(progress) {
|
|
46538
|
+
if (progress.phase === "pending") {
|
|
46539
|
+
downloading.note("finishing queued changes");
|
|
46540
|
+
return;
|
|
46541
|
+
}
|
|
46542
|
+
if (progress.phase === "manifest") {
|
|
46543
|
+
downloading.note("reading file list");
|
|
46544
|
+
return;
|
|
46545
|
+
}
|
|
46546
|
+
downloaded = progress.completed;
|
|
46547
|
+
downloadTotal = progress.total;
|
|
46548
|
+
downloading.progress(
|
|
46549
|
+
progress.total ? progress.completed / progress.total * 100 : 100,
|
|
46550
|
+
progress.total ? `${progress.completed}/${progress.total} files` : "up to date"
|
|
46551
|
+
);
|
|
46552
|
+
}
|
|
46553
|
+
}
|
|
46554
|
+
);
|
|
46555
|
+
if (!prepared.ok && !prepared.stale) {
|
|
46556
|
+
throw new Error(
|
|
46557
|
+
prepared.error || "Could not materialize the Drive vault."
|
|
46558
|
+
);
|
|
46559
|
+
}
|
|
46560
|
+
downloading.done(
|
|
46561
|
+
prepared.stale ? "using local cache" : downloadTotal ? `${downloaded}/${downloadTotal} files` : "up to date"
|
|
46562
|
+
);
|
|
46563
|
+
} catch (error2) {
|
|
46564
|
+
downloading.fail();
|
|
46565
|
+
throw error2;
|
|
46502
46566
|
}
|
|
46503
46567
|
const result = installMcpClients(home);
|
|
46504
46568
|
console.log(
|
package/package.json
CHANGED