@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.cjs CHANGED
@@ -263,7 +263,13 @@ function getDefaultYamlConfig(organization) {
263
263
  }
264
264
  async function readYamlConfig(configPath) {
265
265
  const content = await fs__namespace.readFile(configPath, "utf-8");
266
- const config = yaml__namespace.load(content);
266
+ const rawConfig = yaml__namespace.load(content);
267
+ let config;
268
+ if (rawConfig.codex && typeof rawConfig.codex === "object") {
269
+ config = rawConfig.codex;
270
+ } else {
271
+ config = rawConfig;
272
+ }
267
273
  if (!config.organization) {
268
274
  throw new Error("Invalid config: organization is required");
269
275
  }
@@ -418,7 +424,7 @@ var init_codex_client = __esm({
418
424
  const { readYamlConfig: readYamlConfig2 } = await Promise.resolve().then(() => (init_migrate_config(), migrate_config_exports));
419
425
  const { resolveEnvVarsInConfig: resolveEnvVarsInConfig2 } = await Promise.resolve().then(() => (init_config_types(), config_types_exports));
420
426
  try {
421
- const configPath = path4__namespace.join(process.cwd(), ".fractary", "codex", "config.yaml");
427
+ const configPath = path4__namespace.join(process.cwd(), ".fractary", "config.yaml");
422
428
  let config;
423
429
  try {
424
430
  config = await readYamlConfig2(configPath);
@@ -1813,7 +1819,7 @@ function syncCommand() {
1813
1819
  const cmd = new commander.Command("sync");
1814
1820
  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) => {
1815
1821
  try {
1816
- const configPath = path4__namespace.join(process.cwd(), ".fractary", "codex", "config.yaml");
1822
+ const configPath = path4__namespace.join(process.cwd(), ".fractary", "config.yaml");
1817
1823
  let config;
1818
1824
  try {
1819
1825
  config = await readYamlConfig(configPath);
@@ -1824,13 +1830,16 @@ function syncCommand() {
1824
1830
  }
1825
1831
  const { createSyncManager, createLocalStorage, detectCurrentProject } = await import('@fractary/codex');
1826
1832
  let projectName = name;
1833
+ if (!projectName) {
1834
+ projectName = config.project || void 0;
1835
+ }
1827
1836
  if (!projectName) {
1828
1837
  const detected = detectCurrentProject();
1829
1838
  projectName = detected.project || void 0;
1830
1839
  }
1831
1840
  if (!projectName) {
1832
1841
  console.error(chalk7__default.default.red("Error:"), "Could not determine project name.");
1833
- console.log(chalk7__default.default.dim("Provide project name as argument or run from a git repository."));
1842
+ console.log(chalk7__default.default.dim("Provide project name as argument, set codex.project in config, or run from a git repository."));
1834
1843
  process.exit(1);
1835
1844
  }
1836
1845
  const validDirections = ["to-codex", "from-codex", "bidirectional"];
@@ -1896,7 +1905,9 @@ function syncCommand() {
1896
1905
  dryRun: options.dryRun,
1897
1906
  force: options.force,
1898
1907
  include: includePatterns,
1899
- exclude: excludePatterns
1908
+ exclude: excludePatterns,
1909
+ // Pass pre-matched files to SDK (bypasses SDK's internal non-recursive scanning)
1910
+ sourceFiles: targetFiles
1900
1911
  };
1901
1912
  let plan;
1902
1913
  let routingScan;
@@ -1959,7 +1970,8 @@ function syncCommand() {
1959
1970
  config.organization,
1960
1971
  projectName,
1961
1972
  sourceDir,
1962
- targetFiles,
1973
+ [],
1974
+ // Empty target - we don't scan codex for to-codex direction
1963
1975
  syncOptions
1964
1976
  );
1965
1977
  }
@@ -2331,7 +2343,7 @@ function typesAddCommand() {
2331
2343
  console.log(chalk7__default.default.dim("Examples: 30m, 24h, 7d"));
2332
2344
  process.exit(1);
2333
2345
  }
2334
- const configPath = path4__namespace.join(process.cwd(), ".fractary", "codex", "config.yaml");
2346
+ const configPath = path4__namespace.join(process.cwd(), ".fractary", "config.yaml");
2335
2347
  const config = await readYamlConfig(configPath);
2336
2348
  if (!config.types) {
2337
2349
  config.types = { custom: {} };
@@ -2400,7 +2412,7 @@ function typesRemoveCommand() {
2400
2412
  process.exit(1);
2401
2413
  }
2402
2414
  const typeInfo = registry.get(name);
2403
- const configPath = path4__namespace.join(process.cwd(), ".fractary", "codex", "config.yaml");
2415
+ const configPath = path4__namespace.join(process.cwd(), ".fractary", "config.yaml");
2404
2416
  const config = await readYamlConfig(configPath);
2405
2417
  if (!config.types?.custom?.[name]) {
2406
2418
  console.error(chalk7__default.default.red("Error:"), `Custom type "${name}" not found in configuration.`);