ccsini 0.1.58 → 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 +39 -17
  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.58";
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
  }
@@ -32675,19 +32698,18 @@ function registerDaemonCommands(program2) {
32675
32698
  console.log("Daemon is not running (cleaned up stale PID file).");
32676
32699
  return;
32677
32700
  }
32678
- const isWin = platform5() === "win32";
32679
- if (isWin) {
32680
- const { execSync: execSync3 } = await import("child_process");
32681
- try {
32682
- execSync3(`taskkill /PID ${pid} /F`, { stdio: "ignore" });
32683
- } catch {
32684
- console.error(`Failed to stop daemon (PID ${pid}).`);
32685
- return;
32686
- }
32687
- } else {
32688
- try {
32689
- process.kill(pid, "SIGTERM");
32690
- } 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 {
32691
32713
  console.error(`Failed to stop daemon (PID ${pid}).`);
32692
32714
  return;
32693
32715
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccsini",
3
- "version": "0.1.58",
3
+ "version": "0.1.59",
4
4
  "description": "Claude Code seamless sync across devices",
5
5
  "type": "module",
6
6
  "bin": {