@fractary/codex-cli 0.10.2 → 0.10.4

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
@@ -230,7 +230,13 @@ function getDefaultYamlConfig(organization) {
230
230
  }
231
231
  async function readYamlConfig(configPath) {
232
232
  const content = await fs.readFile(configPath, "utf-8");
233
- const config = yaml.load(content);
233
+ const rawConfig = yaml.load(content);
234
+ let config;
235
+ if (rawConfig.codex && typeof rawConfig.codex === "object") {
236
+ config = rawConfig.codex;
237
+ } else {
238
+ config = rawConfig;
239
+ }
234
240
  if (!config.organization) {
235
241
  throw new Error("Invalid config: organization is required");
236
242
  }
@@ -385,7 +391,7 @@ var init_codex_client = __esm({
385
391
  const { readYamlConfig: readYamlConfig2 } = await Promise.resolve().then(() => (init_migrate_config(), migrate_config_exports));
386
392
  const { resolveEnvVarsInConfig: resolveEnvVarsInConfig2 } = await Promise.resolve().then(() => (init_config_types(), config_types_exports));
387
393
  try {
388
- const configPath = path5.join(process.cwd(), ".fractary", "codex", "config.yaml");
394
+ const configPath = path5.join(process.cwd(), ".fractary", "config.yaml");
389
395
  let config;
390
396
  try {
391
397
  config = await readYamlConfig2(configPath);
@@ -1780,7 +1786,7 @@ function syncCommand() {
1780
1786
  const cmd = new Command("sync");
1781
1787
  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) => {
1782
1788
  try {
1783
- const configPath = path5.join(process.cwd(), ".fractary", "codex", "config.yaml");
1789
+ const configPath = path5.join(process.cwd(), ".fractary", "config.yaml");
1784
1790
  let config;
1785
1791
  try {
1786
1792
  config = await readYamlConfig(configPath);
@@ -1791,13 +1797,16 @@ function syncCommand() {
1791
1797
  }
1792
1798
  const { createSyncManager, createLocalStorage, detectCurrentProject } = await import('@fractary/codex');
1793
1799
  let projectName = name;
1800
+ if (!projectName) {
1801
+ projectName = config.project || void 0;
1802
+ }
1794
1803
  if (!projectName) {
1795
1804
  const detected = detectCurrentProject();
1796
1805
  projectName = detected.project || void 0;
1797
1806
  }
1798
1807
  if (!projectName) {
1799
1808
  console.error(chalk7.red("Error:"), "Could not determine project name.");
1800
- console.log(chalk7.dim("Provide project name as argument or run from a git repository."));
1809
+ console.log(chalk7.dim("Provide project name as argument, set codex.project in config, or run from a git repository."));
1801
1810
  process.exit(1);
1802
1811
  }
1803
1812
  const validDirections = ["to-codex", "from-codex", "bidirectional"];
@@ -1863,7 +1872,9 @@ function syncCommand() {
1863
1872
  dryRun: options.dryRun,
1864
1873
  force: options.force,
1865
1874
  include: includePatterns,
1866
- exclude: excludePatterns
1875
+ exclude: excludePatterns,
1876
+ // Pass pre-matched files to SDK (bypasses SDK's internal non-recursive scanning)
1877
+ sourceFiles: targetFiles
1867
1878
  };
1868
1879
  let plan;
1869
1880
  let routingScan;
@@ -1926,7 +1937,8 @@ function syncCommand() {
1926
1937
  config.organization,
1927
1938
  projectName,
1928
1939
  sourceDir,
1929
- targetFiles,
1940
+ [],
1941
+ // Empty target - we don't scan codex for to-codex direction
1930
1942
  syncOptions
1931
1943
  );
1932
1944
  }
@@ -2298,7 +2310,7 @@ function typesAddCommand() {
2298
2310
  console.log(chalk7.dim("Examples: 30m, 24h, 7d"));
2299
2311
  process.exit(1);
2300
2312
  }
2301
- const configPath = path5.join(process.cwd(), ".fractary", "codex", "config.yaml");
2313
+ const configPath = path5.join(process.cwd(), ".fractary", "config.yaml");
2302
2314
  const config = await readYamlConfig(configPath);
2303
2315
  if (!config.types) {
2304
2316
  config.types = { custom: {} };
@@ -2367,7 +2379,7 @@ function typesRemoveCommand() {
2367
2379
  process.exit(1);
2368
2380
  }
2369
2381
  const typeInfo = registry.get(name);
2370
- const configPath = path5.join(process.cwd(), ".fractary", "codex", "config.yaml");
2382
+ const configPath = path5.join(process.cwd(), ".fractary", "config.yaml");
2371
2383
  const config = await readYamlConfig(configPath);
2372
2384
  if (!config.types?.custom?.[name]) {
2373
2385
  console.error(chalk7.red("Error:"), `Custom type "${name}" not found in configuration.`);