@fractary/codex-cli 0.6.0 → 0.6.1

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.cjs CHANGED
@@ -413,7 +413,7 @@ var init_codex_client = __esm({
413
413
  const { readYamlConfig: readYamlConfig2 } = await Promise.resolve().then(() => (init_migrate_config(), migrate_config_exports));
414
414
  const { resolveEnvVarsInConfig: resolveEnvVarsInConfig2 } = await Promise.resolve().then(() => (init_config_types(), config_types_exports));
415
415
  try {
416
- const configPath = path3__namespace.join(process.cwd(), ".fractary", "codex.yaml");
416
+ const configPath = path3__namespace.join(process.cwd(), ".fractary", "codex", "config.yaml");
417
417
  let config;
418
418
  try {
419
419
  config = await readYamlConfig2(configPath);
@@ -1010,7 +1010,7 @@ function migrateCommand() {
1010
1010
  cmd.description("Migrate legacy JSON configuration to v3.0 YAML format").option("--dry-run", "Show migration plan without executing").option("--no-backup", "Skip creating backup of old config").option("--json", "Output as JSON").action(async (options) => {
1011
1011
  try {
1012
1012
  const legacyConfigPath = path3__namespace.join(process.cwd(), ".fractary", "plugins", "codex", "config.json");
1013
- const newConfigPath = path3__namespace.join(process.cwd(), ".fractary", "codex.yaml");
1013
+ const newConfigPath = path3__namespace.join(process.cwd(), ".fractary", "codex", "config.yaml");
1014
1014
  if (!await fileExists2(legacyConfigPath)) {
1015
1015
  if (options.json) {
1016
1016
  console.log(JSON.stringify({
@@ -1121,7 +1121,7 @@ function migrateCommand() {
1121
1121
  console.log(chalk8__default.default.dim(` Storage Providers: ${migrationResult.yamlConfig.storage?.length || 0}`));
1122
1122
  console.log("");
1123
1123
  console.log(chalk8__default.default.bold("Next Steps:"));
1124
- console.log(chalk8__default.default.dim(" 1. Review the new configuration: .fractary/codex.yaml"));
1124
+ console.log(chalk8__default.default.dim(" 1. Review the new configuration: .fractary/codex/config.yaml"));
1125
1125
  console.log(chalk8__default.default.dim(' 2. Set your GitHub token: export GITHUB_TOKEN="your_token"'));
1126
1126
  console.log(chalk8__default.default.dim(" 3. Test fetching: fractary codex fetch codex://org/project/path"));
1127
1127
  if (migrationResult.backupPath) {
@@ -1336,7 +1336,7 @@ async function fileExists3(filePath) {
1336
1336
  }
1337
1337
  }
1338
1338
  async function checkConfiguration() {
1339
- const configPath = path3__namespace.join(process.cwd(), ".fractary", "codex.yaml");
1339
+ const configPath = path3__namespace.join(process.cwd(), ".fractary", "codex", "config.yaml");
1340
1340
  const legacyConfigPath = path3__namespace.join(process.cwd(), ".fractary", "plugins", "codex", "config.json");
1341
1341
  try {
1342
1342
  if (!await fileExists3(configPath)) {
@@ -1444,7 +1444,7 @@ async function checkCache() {
1444
1444
  }
1445
1445
  }
1446
1446
  async function checkStorage() {
1447
- const configPath = path3__namespace.join(process.cwd(), ".fractary", "codex.yaml");
1447
+ const configPath = path3__namespace.join(process.cwd(), ".fractary", "codex", "config.yaml");
1448
1448
  try {
1449
1449
  const config = await readYamlConfig(configPath);
1450
1450
  const providers = config.storage || [];
@@ -1453,7 +1453,7 @@ async function checkStorage() {
1453
1453
  name: "Storage",
1454
1454
  status: "warn",
1455
1455
  message: "No storage providers configured",
1456
- details: "Configure at least one provider in .fractary/codex.yaml"
1456
+ details: "Configure at least one provider in .fractary/codex/config.yaml"
1457
1457
  };
1458
1458
  }
1459
1459
  const providerTypes = providers.map((p) => p.type).join(", ");
@@ -1602,7 +1602,7 @@ function syncCommand() {
1602
1602
  const cmd = new commander.Command("sync");
1603
1603
  cmd.description("Sync single project with codex repository").argument("[name]", "Project name (auto-detected if not provided)").option("--env <env>", "Target environment (dev/test/staging/prod)", "prod").option("--dry-run", "Show what would sync without executing").option("--direction <dir>", "Sync direction (to-codex/from-codex/bidirectional)", "bidirectional").option("--include <pattern>", "Include files matching pattern (can be used multiple times)", (val, prev) => prev.concat([val]), []).option("--exclude <pattern>", "Exclude files matching pattern (can be used multiple times)", (val, prev) => prev.concat([val]), []).option("--force", "Force sync without checking timestamps").option("--json", "Output as JSON").action(async (name, options) => {
1604
1604
  try {
1605
- const configPath = path3__namespace.join(process.cwd(), ".fractary", "codex.yaml");
1605
+ const configPath = path3__namespace.join(process.cwd(), ".fractary", "codex", "config.yaml");
1606
1606
  let config;
1607
1607
  try {
1608
1608
  config = await readYamlConfig(configPath);
@@ -1652,22 +1652,32 @@ function syncCommand() {
1652
1652
  ...options.exclude
1653
1653
  ];
1654
1654
  const sourceDir = process.cwd();
1655
- const allFiles = await syncManager.listLocalFiles(sourceDir);
1656
- const targetFiles = allFiles.filter((file) => {
1657
- for (const pattern of excludePatterns) {
1658
- const regex = new RegExp("^" + pattern.replace(/\*\*/g, ".*").replace(/\*/g, "[^/]*") + "$");
1659
- if (regex.test(file.path)) {
1660
- return false;
1661
- }
1662
- }
1663
- for (const pattern of includePatterns) {
1664
- const regex = new RegExp("^" + pattern.replace(/\*\*/g, ".*").replace(/\*/g, "[^/]*") + "$");
1665
- if (regex.test(file.path)) {
1666
- return true;
1667
- }
1655
+ const { glob: globSync } = await import('glob');
1656
+ const matchedFilePaths = /* @__PURE__ */ new Set();
1657
+ for (const pattern of includePatterns) {
1658
+ try {
1659
+ const matches = await globSync(pattern, {
1660
+ cwd: sourceDir,
1661
+ dot: true,
1662
+ nodir: true,
1663
+ ignore: excludePatterns
1664
+ });
1665
+ matches.forEach((match) => matchedFilePaths.add(match));
1666
+ } catch (error) {
1667
+ console.error(chalk8__default.default.yellow(`Warning: Invalid pattern "${pattern}": ${error.message}`));
1668
1668
  }
1669
- return false;
1670
- });
1669
+ }
1670
+ const targetFiles = await Promise.all(
1671
+ Array.from(matchedFilePaths).map(async (filePath) => {
1672
+ const fullPath = path3__namespace.join(sourceDir, filePath);
1673
+ const stats = await import('fs/promises').then((fs7) => fs7.stat(fullPath));
1674
+ return {
1675
+ path: filePath,
1676
+ size: stats.size,
1677
+ mtime: stats.mtimeMs
1678
+ };
1679
+ })
1680
+ );
1671
1681
  const syncOptions = {
1672
1682
  direction,
1673
1683
  dryRun: options.dryRun,
@@ -2108,7 +2118,7 @@ function typesAddCommand() {
2108
2118
  console.log(chalk8__default.default.dim("Examples: 30m, 24h, 7d"));
2109
2119
  process.exit(1);
2110
2120
  }
2111
- const configPath = path3__namespace.join(process.cwd(), ".fractary", "codex.yaml");
2121
+ const configPath = path3__namespace.join(process.cwd(), ".fractary", "codex", "config.yaml");
2112
2122
  const config = await readYamlConfig(configPath);
2113
2123
  if (!config.types) {
2114
2124
  config.types = { custom: {} };
@@ -2177,7 +2187,7 @@ function typesRemoveCommand() {
2177
2187
  process.exit(1);
2178
2188
  }
2179
2189
  const typeInfo = registry.get(name);
2180
- const configPath = path3__namespace.join(process.cwd(), ".fractary", "codex.yaml");
2190
+ const configPath = path3__namespace.join(process.cwd(), ".fractary", "codex", "config.yaml");
2181
2191
  const config = await readYamlConfig(configPath);
2182
2192
  if (!config.types?.custom?.[name]) {
2183
2193
  console.error(chalk8__default.default.red("Error:"), `Custom type "${name}" not found in configuration.`);