@fractary/codex-cli 0.10.26 → 0.10.27

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.
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import * as path4 from 'path';
3
3
  import { dirname, join } from 'path';
4
4
  import { fileURLToPath } from 'url';
5
- import { createConfigManager, resolveOrganization, validateNameFormat, formatBytes, createHealthChecker, readCodexConfig, formatDuration, createCodexClient, ValidationError, PermissionDeniedError, ConfigurationError, CodexError, CodexClient } from '@fractary/codex';
5
+ import { createConfigManager, resolveOrganization, validateNameFormat, formatBytes, createHealthChecker, readCodexConfig, calculateContentHash, formatDuration, createCodexClient, ValidationError, PermissionDeniedError, ConfigurationError, CodexError, CodexClient } from '@fractary/codex';
6
6
  import * as os from 'os';
7
7
  import * as fs2 from 'fs/promises';
8
8
  import { spawn } from 'child_process';
@@ -1015,14 +1015,19 @@ function syncCommand() {
1015
1015
  console.error(chalk10.yellow(`Warning: Invalid pattern "${pattern}": ${error.message}`));
1016
1016
  }
1017
1017
  }
1018
+ const fsModuleLocal = await import('fs/promises');
1018
1019
  const targetFiles = await Promise.all(
1019
1020
  Array.from(matchedFilePaths).map(async (filePath) => {
1020
1021
  const fullPath = path4.join(sourceDir, filePath);
1021
- const stats = await import('fs/promises').then((fs3) => fs3.stat(fullPath));
1022
+ const [stats, content] = await Promise.all([
1023
+ fsModuleLocal.stat(fullPath),
1024
+ fsModuleLocal.readFile(fullPath)
1025
+ ]);
1022
1026
  return {
1023
1027
  path: filePath,
1024
1028
  size: stats.size,
1025
- mtime: stats.mtimeMs
1029
+ mtime: stats.mtimeMs,
1030
+ hash: calculateContentHash(content)
1026
1031
  };
1027
1032
  })
1028
1033
  );
@@ -1123,11 +1128,15 @@ function syncCommand() {
1123
1128
  existingCodexFiles = await Promise.all(
1124
1129
  codexGlobMatches.map(async (filePath) => {
1125
1130
  const fullPath = path4.join(codexProjectDir, filePath);
1126
- const stats = await fsPromises.stat(fullPath);
1131
+ const [stats, content] = await Promise.all([
1132
+ fsPromises.stat(fullPath),
1133
+ fsPromises.readFile(fullPath)
1134
+ ]);
1127
1135
  return {
1128
1136
  path: filePath,
1129
1137
  size: stats.size,
1130
- mtime: stats.mtimeMs
1138
+ mtime: stats.mtimeMs,
1139
+ hash: calculateContentHash(content)
1131
1140
  };
1132
1141
  })
1133
1142
  );