ccsini 0.1.59 → 0.1.60

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 +82 -29
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -28005,6 +28005,42 @@ var init_auth = __esm(() => {
28005
28005
  init_src();
28006
28006
  });
28007
28007
 
28008
+ // src/core/schema.ts
28009
+ var exports_schema = {};
28010
+ __export(exports_schema, {
28011
+ saveDefaultSchema: () => saveDefaultSchema,
28012
+ loadSchema: () => loadSchema,
28013
+ getEnabledCategories: () => getEnabledCategories
28014
+ });
28015
+ import { readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
28016
+ import { join as join2 } from "path";
28017
+ async function saveDefaultSchema(configDir) {
28018
+ const schema = buildDefaultSchema();
28019
+ await writeFile2(join2(configDir, "schema.yaml"), JSON.stringify(schema, null, 2));
28020
+ }
28021
+ async function loadSchema(configDir) {
28022
+ const raw = await readFile2(join2(configDir, "schema.yaml"), "utf-8");
28023
+ return JSON.parse(raw);
28024
+ }
28025
+ function getEnabledCategories(schema) {
28026
+ return Object.entries(schema.categories).filter(([, config]) => config.enabled).map(([name]) => name);
28027
+ }
28028
+ function buildDefaultSchema() {
28029
+ const categories = {};
28030
+ for (const [cat, patterns] of Object.entries(DEFAULT_CATEGORY_PATTERNS)) {
28031
+ const category = cat;
28032
+ categories[category] = {
28033
+ enabled: true,
28034
+ patterns,
28035
+ merge: MERGE_STRATEGIES[category]
28036
+ };
28037
+ }
28038
+ return { version: 1, categories };
28039
+ }
28040
+ var init_schema = __esm(() => {
28041
+ init_src();
28042
+ });
28043
+
28008
28044
  // ../../node_modules/.bun/commander@13.1.0/node_modules/commander/esm.mjs
28009
28045
  var import__ = __toESM(require_commander(), 1);
28010
28046
  var {
@@ -28022,7 +28058,7 @@ var {
28022
28058
  } = import__.default;
28023
28059
 
28024
28060
  // src/version.ts
28025
- var VERSION = "0.1.59";
28061
+ var VERSION = "0.1.60";
28026
28062
 
28027
28063
  // src/commands/init.ts
28028
28064
  init_source();
@@ -28765,26 +28801,8 @@ async function saveSessionConfig(configDir, sessionConfig) {
28765
28801
  await writeFile(configPath, JSON.stringify(config, null, 2));
28766
28802
  }
28767
28803
 
28768
- // src/core/schema.ts
28769
- init_src();
28770
- import { readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
28771
- import { join as join2 } from "path";
28772
- async function saveDefaultSchema(configDir) {
28773
- const schema = buildDefaultSchema();
28774
- await writeFile2(join2(configDir, "schema.yaml"), JSON.stringify(schema, null, 2));
28775
- }
28776
- function buildDefaultSchema() {
28777
- const categories = {};
28778
- for (const [cat, patterns] of Object.entries(DEFAULT_CATEGORY_PATTERNS)) {
28779
- const category = cat;
28780
- categories[category] = {
28781
- enabled: true,
28782
- patterns,
28783
- merge: MERGE_STRATEGIES[category]
28784
- };
28785
- }
28786
- return { version: 1, categories };
28787
- }
28804
+ // src/commands/init.ts
28805
+ init_schema();
28788
28806
 
28789
28807
  // src/hooks/installer.ts
28790
28808
  import { readFile as readFile3, writeFile as writeFile3 } from "fs/promises";
@@ -29083,7 +29101,7 @@ class CcsiniClient {
29083
29101
  return res.json();
29084
29102
  }
29085
29103
  async heartbeat(mode, stats) {
29086
- await fetch(`${this.apiUrl}/api/sync/heartbeat`, {
29104
+ const res = await fetch(`${this.apiUrl}/api/sync/heartbeat`, {
29087
29105
  method: "POST",
29088
29106
  headers: this.getHeaders(),
29089
29107
  body: JSON.stringify({
@@ -29092,10 +29110,17 @@ class CcsiniClient {
29092
29110
  pushCount: stats.pushCount,
29093
29111
  pullCount: stats.pullCount,
29094
29112
  lastError: stats.lastError,
29095
- conflicts: stats.conflicts
29113
+ conflicts: stats.conflicts,
29114
+ version: stats.version,
29115
+ categories: stats.categories,
29116
+ conflictFiles: stats.conflictFiles
29096
29117
  }
29097
29118
  })
29098
29119
  });
29120
+ if (res.ok) {
29121
+ return res.json();
29122
+ }
29123
+ return {};
29099
29124
  }
29100
29125
  async logSyncEvent(event) {
29101
29126
  await fetch(`${this.apiUrl}/api/sync/log`, {
@@ -31766,25 +31791,53 @@ async function runDaemon() {
31766
31791
  log(configDir, `Pull error: ${e.message}`);
31767
31792
  }
31768
31793
  }
31769
- async function countConflicts() {
31794
+ async function listConflictFiles() {
31770
31795
  try {
31771
31796
  const { readdir: readdir4 } = await import("fs/promises");
31772
31797
  const files = await readdir4(configDir);
31773
- return files.filter((f) => f.endsWith(".conflict")).length;
31798
+ return files.filter((f) => f.endsWith(".conflict"));
31774
31799
  } catch {
31775
- return 0;
31800
+ return [];
31776
31801
  }
31777
31802
  }
31803
+ async function getCategories() {
31804
+ try {
31805
+ const { loadSchema: loadSchema2, getEnabledCategories: getEnabledCategories2 } = await Promise.resolve().then(() => (init_schema(), exports_schema));
31806
+ const schema = await loadSchema2(configDir);
31807
+ return getEnabledCategories2(schema);
31808
+ } catch {
31809
+ return [];
31810
+ }
31811
+ }
31812
+ async function deleteConflictFiles() {
31813
+ try {
31814
+ const { unlink: unlink2 } = await import("fs/promises");
31815
+ const files = await listConflictFiles();
31816
+ for (const f of files) {
31817
+ await unlink2(join11(configDir, f)).catch(() => {});
31818
+ }
31819
+ if (files.length > 0) {
31820
+ log(configDir, `Resolved ${files.length} conflict file(s) via dashboard`);
31821
+ }
31822
+ } catch {}
31823
+ }
31778
31824
  async function doHeartbeat() {
31779
31825
  try {
31780
31826
  const client = await getAuthenticatedClient(configDir);
31781
- const conflicts = await countConflicts();
31782
- await client.heartbeat("daemon", {
31827
+ const conflictFiles = await listConflictFiles();
31828
+ const categories = await getCategories();
31829
+ const result = await client.heartbeat("daemon", {
31783
31830
  pushCount: status.pushCount,
31784
31831
  pullCount: status.pullCount,
31785
31832
  lastError: status.lastError,
31786
- conflicts
31833
+ conflicts: conflictFiles.length,
31834
+ version: VERSION,
31835
+ categories,
31836
+ conflictFiles
31787
31837
  });
31838
+ if (result.resolveConflicts) {
31839
+ await deleteConflictFiles();
31840
+ }
31788
31841
  } catch (e) {
31789
31842
  log(configDir, `Heartbeat error: ${e.message}`);
31790
31843
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccsini",
3
- "version": "0.1.59",
3
+ "version": "0.1.60",
4
4
  "description": "Claude Code seamless sync across devices",
5
5
  "type": "module",
6
6
  "bin": {