ccsini 0.1.57 → 0.1.59

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 +50 -20
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -28022,7 +28022,7 @@ var {
28022
28022
  } = import__.default;
28023
28023
 
28024
28024
  // src/version.ts
28025
- var VERSION = "0.1.57";
28025
+ var VERSION = "0.1.59";
28026
28026
 
28027
28027
  // src/commands/init.ts
28028
28028
  init_source();
@@ -29082,11 +29082,19 @@ class CcsiniClient {
29082
29082
  throw new Error("Failed to reset account data");
29083
29083
  return res.json();
29084
29084
  }
29085
- async heartbeat(mode) {
29085
+ async heartbeat(mode, stats) {
29086
29086
  await fetch(`${this.apiUrl}/api/sync/heartbeat`, {
29087
29087
  method: "POST",
29088
29088
  headers: this.getHeaders(),
29089
- body: JSON.stringify({ mode: mode ?? "hook" })
29089
+ body: JSON.stringify({
29090
+ mode: mode ?? "hook",
29091
+ ...stats && {
29092
+ pushCount: stats.pushCount,
29093
+ pullCount: stats.pullCount,
29094
+ lastError: stats.lastError,
29095
+ conflicts: stats.conflicts
29096
+ }
29097
+ })
29090
29098
  });
29091
29099
  }
29092
29100
  async logSyncEvent(event) {
@@ -31758,10 +31766,25 @@ async function runDaemon() {
31758
31766
  log(configDir, `Pull error: ${e.message}`);
31759
31767
  }
31760
31768
  }
31769
+ async function countConflicts() {
31770
+ try {
31771
+ const { readdir: readdir4 } = await import("fs/promises");
31772
+ const files = await readdir4(configDir);
31773
+ return files.filter((f) => f.endsWith(".conflict")).length;
31774
+ } catch {
31775
+ return 0;
31776
+ }
31777
+ }
31761
31778
  async function doHeartbeat() {
31762
31779
  try {
31763
31780
  const client = await getAuthenticatedClient(configDir);
31764
- await client.heartbeat("daemon");
31781
+ const conflicts = await countConflicts();
31782
+ await client.heartbeat("daemon", {
31783
+ pushCount: status.pushCount,
31784
+ pullCount: status.pullCount,
31785
+ lastError: status.lastError,
31786
+ conflicts
31787
+ });
31765
31788
  } catch (e) {
31766
31789
  log(configDir, `Heartbeat error: ${e.message}`);
31767
31790
  }
@@ -32025,12 +32048,20 @@ function registerSelfCommands(program2) {
32025
32048
  execSync2(`bun add -g ccsini@${latest}`, { stdio: "inherit" });
32026
32049
  updated = true;
32027
32050
  } catch {
32028
- console.log(`Bun failed (registry cache), trying npm...
32051
+ console.log(`Bun cache stale, clearing and retrying...
32029
32052
  `);
32030
32053
  try {
32031
- execSync2(`npm install -g ccsini@${latest}`, { stdio: "inherit" });
32054
+ execSync2("bun pm cache rm", { stdio: "ignore" });
32055
+ execSync2(`bun add -g ccsini@${latest}`, { stdio: "inherit" });
32032
32056
  updated = true;
32033
- } catch {}
32057
+ } catch {
32058
+ console.log(`Bun failed, trying npm...
32059
+ `);
32060
+ try {
32061
+ execSync2(`npm install -g ccsini@${latest}`, { stdio: "inherit" });
32062
+ updated = true;
32063
+ } catch {}
32064
+ }
32034
32065
  }
32035
32066
  if (!updated) {
32036
32067
  console.error(`
@@ -32667,19 +32698,18 @@ function registerDaemonCommands(program2) {
32667
32698
  console.log("Daemon is not running (cleaned up stale PID file).");
32668
32699
  return;
32669
32700
  }
32670
- const isWin = platform5() === "win32";
32671
- if (isWin) {
32672
- const { execSync: execSync3 } = await import("child_process");
32673
- try {
32674
- execSync3(`taskkill /PID ${pid} /F`, { stdio: "ignore" });
32675
- } catch {
32676
- console.error(`Failed to stop daemon (PID ${pid}).`);
32677
- return;
32678
- }
32679
- } else {
32680
- try {
32681
- process.kill(pid, "SIGTERM");
32682
- } catch {
32701
+ try {
32702
+ process.kill(pid, "SIGTERM");
32703
+ } catch {
32704
+ if (platform5() === "win32") {
32705
+ const { execSync: execSync3 } = await import("child_process");
32706
+ try {
32707
+ execSync3(`taskkill /PID ${pid} /T /F`, { stdio: "ignore", timeout: 5000 });
32708
+ } catch {
32709
+ console.error(`Failed to stop daemon (PID ${pid}). Kill it manually via Task Manager.`);
32710
+ return;
32711
+ }
32712
+ } else {
32683
32713
  console.error(`Failed to stop daemon (PID ${pid}).`);
32684
32714
  return;
32685
32715
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccsini",
3
- "version": "0.1.57",
3
+ "version": "0.1.59",
4
4
  "description": "Claude Code seamless sync across devices",
5
5
  "type": "module",
6
6
  "bin": {