ccsini 0.1.61 → 0.1.62

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.
Files changed (2) hide show
  1. package/dist/index.js +40 -22
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -28058,7 +28058,7 @@ var {
28058
28058
  } = import__.default;
28059
28059
 
28060
28060
  // src/version.ts
28061
- var VERSION = "0.1.61";
28061
+ var VERSION = "0.1.62";
28062
28062
 
28063
28063
  // src/commands/init.ts
28064
28064
  init_source();
@@ -29491,11 +29491,13 @@ async function pushSync(client, masterKey, deviceName, configDir, onProgress, se
29491
29491
  const conflicts = [];
29492
29492
  let bytesTransferred = 0;
29493
29493
  const progress = onProgress ?? (() => {});
29494
- const { manifest: localManifest, cacheStats } = await generateManifest(claudeDir, deviceName, progress, sessionOptions);
29494
+ progress("Scanning local files & fetching remote manifest...");
29495
+ const [{ manifest: localManifest, cacheStats }, remoteManifestEnc] = await Promise.all([
29496
+ generateManifest(claudeDir, deviceName, progress, sessionOptions),
29497
+ client.getManifest()
29498
+ ]);
29495
29499
  const fileCount = Object.keys(localManifest.files).length;
29496
29500
  progress(`Scanned ${fileCount} files`);
29497
- progress("Fetching remote manifest...");
29498
- const remoteManifestEnc = await client.getManifest();
29499
29501
  let remoteManifest = null;
29500
29502
  if (remoteManifestEnc) {
29501
29503
  try {
@@ -29509,6 +29511,17 @@ async function pushSync(client, masterKey, deviceName, configDir, onProgress, se
29509
29511
  const diffs = diffManifests(localManifest, remoteManifest);
29510
29512
  const toPush = diffs.filter((d) => d.action === "push" || d.action === "merge");
29511
29513
  progress(`${toPush.length} files to push`);
29514
+ if (toPush.length === 0) {
29515
+ return {
29516
+ action: "push",
29517
+ filesChanged: 0,
29518
+ bytesTransferred: 0,
29519
+ durationMs: Date.now() - start,
29520
+ errors: [],
29521
+ conflicts: [],
29522
+ cacheStats
29523
+ };
29524
+ }
29512
29525
  if (remoteManifest && !pushOptions?.skipConflictBackup) {
29513
29526
  const merges = toPush.filter((d) => d.action === "merge" && d.remoteHash);
29514
29527
  for (const diff of merges) {
@@ -29532,9 +29545,9 @@ async function pushSync(client, masterKey, deviceName, configDir, onProgress, se
29532
29545
  const pushKeys = toPush.map((d) => blobKey(d.path, d.localHash));
29533
29546
  let existing = {};
29534
29547
  try {
29535
- for (const batch of chunkArray(pushKeys, 100)) {
29536
- Object.assign(existing, await client.checkBlobsExist(batch));
29537
- }
29548
+ const batchResults = await Promise.all(chunkArray(pushKeys, 100).map((batch) => client.checkBlobsExist(batch)));
29549
+ for (const r of batchResults)
29550
+ Object.assign(existing, r);
29538
29551
  } catch {}
29539
29552
  const toUpload = toPush.filter((d) => !existing[blobKey(d.path, d.localHash)]);
29540
29553
  progress(`${toPush.length} changed, ${toUpload.length} to upload (${toPush.length - toUpload.length} skipped)`);
@@ -29566,22 +29579,21 @@ async function pushSync(client, masterKey, deviceName, configDir, onProgress, se
29566
29579
  }
29567
29580
  const manifestJson = JSON.stringify(localManifest);
29568
29581
  const manifestEnc = encryptFile(masterKey, "__manifest__", new TextEncoder().encode(manifestJson));
29569
- await client.putManifest(manifestEnc);
29570
- await saveManifest(configDir, localManifest);
29582
+ await Promise.all([
29583
+ client.putManifest(manifestEnc),
29584
+ saveManifest(configDir, localManifest)
29585
+ ]);
29571
29586
  const durationMs = Date.now() - start;
29572
29587
  progress("Logging sync event...");
29573
- await client.logSyncEvent({
29574
- action: "push",
29575
- filesChanged: toPush.length,
29576
- bytesTransferred,
29577
- durationMs
29578
- });
29579
- try {
29580
- const projects = extractProjects(localManifest);
29581
- if (projects.length > 0) {
29582
- await client.putProjects(projects, deviceName);
29583
- }
29584
- } catch {}
29588
+ await Promise.all([
29589
+ client.logSyncEvent({
29590
+ action: "push",
29591
+ filesChanged: toPush.length,
29592
+ bytesTransferred,
29593
+ durationMs
29594
+ }).catch(() => {}),
29595
+ extractAndSendProjects(client, localManifest, deviceName).catch(() => {})
29596
+ ]);
29585
29597
  return {
29586
29598
  action: "push",
29587
29599
  filesChanged: toPush.length,
@@ -29723,7 +29735,7 @@ async function pullSync(client, masterKey, deviceName, configDir, onProgress, se
29723
29735
  filesChanged: toPull.length,
29724
29736
  bytesTransferred,
29725
29737
  durationMs
29726
- });
29738
+ }).catch(() => {});
29727
29739
  return {
29728
29740
  action: "pull",
29729
29741
  filesChanged: toPull.length,
@@ -29733,6 +29745,12 @@ async function pullSync(client, masterKey, deviceName, configDir, onProgress, se
29733
29745
  conflicts
29734
29746
  };
29735
29747
  }
29748
+ async function extractAndSendProjects(client, manifest, deviceName) {
29749
+ const projects = extractProjects(manifest);
29750
+ if (projects.length > 0) {
29751
+ await client.putProjects(projects, deviceName);
29752
+ }
29753
+ }
29736
29754
  function chunkArray(arr, size) {
29737
29755
  const chunks = [];
29738
29756
  for (let i = 0;i < arr.length; i += size) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccsini",
3
- "version": "0.1.61",
3
+ "version": "0.1.62",
4
4
  "description": "Claude Code seamless sync across devices",
5
5
  "type": "module",
6
6
  "bin": {