ccsini 0.1.6 → 0.1.8

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 +33 -30
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -26950,7 +26950,7 @@ var {
26950
26950
  } = import__.default;
26951
26951
 
26952
26952
  // src/version.ts
26953
- var VERSION = "0.1.6";
26953
+ var VERSION = "0.1.8";
26954
26954
 
26955
26955
  // src/commands/init.ts
26956
26956
  init_source();
@@ -28356,43 +28356,45 @@ async function hashFile(filePath) {
28356
28356
  const content = await readFile4(filePath);
28357
28357
  return createHash("sha256").update(content).digest("hex");
28358
28358
  }
28359
- async function walkDir(dir) {
28360
- const entries = await readdir(dir, { withFileTypes: true });
28361
- const files = [];
28359
+ var EXCLUDED_DIRS = NEVER_SYNC_PATTERNS.filter((p) => p.endsWith("/**")).map((p) => p.replace("/**", ""));
28360
+ async function scanDir(baseDir, currentDir, results, onProgress) {
28361
+ const entries = await readdir(currentDir, { withFileTypes: true });
28362
28362
  for (const entry of entries) {
28363
- const fullPath = join4(dir, entry.name);
28363
+ const fullPath = join4(currentDir, entry.name);
28364
+ const relativePath = relative(baseDir, fullPath).split("\\").join("/");
28364
28365
  if (entry.isDirectory()) {
28365
- files.push(...await walkDir(fullPath));
28366
+ if (EXCLUDED_DIRS.includes(relativePath))
28367
+ continue;
28368
+ await scanDir(baseDir, fullPath, results, onProgress);
28366
28369
  } else if (entry.isFile()) {
28367
- files.push(fullPath);
28370
+ if (isExcluded(relativePath))
28371
+ continue;
28372
+ const fileStat = await stat(fullPath);
28373
+ const hash = await hashFile(fullPath);
28374
+ results.push({
28375
+ relativePath,
28376
+ absolutePath: fullPath,
28377
+ hash,
28378
+ size: fileStat.size,
28379
+ modified: fileStat.mtimeMs,
28380
+ category: categorizeFile(relativePath)
28381
+ });
28382
+ onProgress(`Scanning (${results.length}): ${relativePath}`);
28368
28383
  }
28369
28384
  }
28370
- return files;
28371
28385
  }
28372
- async function scanClaudeDir(claudeDir) {
28373
- const allFiles = await walkDir(claudeDir);
28386
+ async function scanClaudeDir(claudeDir, onProgress) {
28387
+ const progress = onProgress ?? (() => {});
28374
28388
  const results = [];
28375
- for (const absolutePath of allFiles) {
28376
- const relativePath = relative(claudeDir, absolutePath).split("\\").join("/");
28377
- if (isExcluded(relativePath))
28378
- continue;
28379
- const fileStat = await stat(absolutePath);
28380
- const hash = await hashFile(absolutePath);
28381
- results.push({
28382
- relativePath,
28383
- absolutePath,
28384
- hash,
28385
- size: fileStat.size,
28386
- modified: fileStat.mtimeMs,
28387
- category: categorizeFile(relativePath)
28388
- });
28389
- }
28389
+ progress("Scanning local files...");
28390
+ await scanDir(claudeDir, claudeDir, results, progress);
28391
+ progress(`Scan complete: ${results.length} files found`);
28390
28392
  return results;
28391
28393
  }
28392
28394
 
28393
28395
  // src/core/manifest.ts
28394
- async function generateManifest(claudeDir, deviceName) {
28395
- const files = await scanClaudeDir(claudeDir);
28396
+ async function generateManifest(claudeDir, deviceName, onProgress) {
28397
+ const files = await scanClaudeDir(claudeDir, onProgress);
28396
28398
  const entries = {};
28397
28399
  for (const file of files) {
28398
28400
  entries[file.relativePath] = {
@@ -28504,8 +28506,7 @@ async function pushSync(client, masterKey, deviceName, configDir, onProgress) {
28504
28506
  const errors2 = [];
28505
28507
  let bytesTransferred = 0;
28506
28508
  const progress = onProgress ?? (() => {});
28507
- progress("Scanning local files...");
28508
- const localManifest = await generateManifest(claudeDir, deviceName);
28509
+ const localManifest = await generateManifest(claudeDir, deviceName, progress);
28509
28510
  const fileCount = Object.keys(localManifest.files).length;
28510
28511
  progress(`Scanned ${fileCount} files`);
28511
28512
  progress("Fetching remote manifest...");
@@ -29092,7 +29093,9 @@ function registerSyncCommands(program2) {
29092
29093
  const spinner = ora2("Checking status...").start();
29093
29094
  const localManifest = await loadManifest(configDir);
29094
29095
  const claudeDir = getClaudeDir();
29095
- const currentManifest = await generateManifest(claudeDir, config.deviceName);
29096
+ const currentManifest = await generateManifest(claudeDir, config.deviceName, (msg) => {
29097
+ spinner.text = msg;
29098
+ });
29096
29099
  let remoteManifest = null;
29097
29100
  const remoteManifestEnc = await client.getManifest();
29098
29101
  if (remoteManifestEnc) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccsini",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Claude Code seamless sync across devices",
5
5
  "type": "module",
6
6
  "bin": {