@fractary/codex-cli 0.10.1 → 0.10.3

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);
@@ -1823,25 +1829,9 @@ function syncCommand() {
1823
1829
  ".fractary/templates/**"
1824
1830
  ];
1825
1831
  const syncConfig = config.sync;
1826
- let configIncludePatterns;
1827
- let configExcludePatterns = [];
1828
- if (syncConfig?.to_codex) {
1829
- const toCodex = syncConfig.to_codex;
1830
- if (typeof toCodex === "object" && !Array.isArray(toCodex)) {
1831
- const directionalConfig = toCodex;
1832
- configIncludePatterns = directionalConfig.include || defaultToCodexPatterns;
1833
- configExcludePatterns = directionalConfig.exclude || [];
1834
- } else if (Array.isArray(toCodex)) {
1835
- configIncludePatterns = toCodex;
1836
- configExcludePatterns = syncConfig.exclude || [];
1837
- } else {
1838
- configIncludePatterns = defaultToCodexPatterns;
1839
- configExcludePatterns = [];
1840
- }
1841
- } else {
1842
- configIncludePatterns = defaultToCodexPatterns;
1843
- configExcludePatterns = syncConfig?.exclude || [];
1844
- }
1832
+ const sdkPatterns = syncManager.getToCodexPatterns();
1833
+ const configIncludePatterns = sdkPatterns.length > 0 ? sdkPatterns : defaultToCodexPatterns;
1834
+ const configExcludePatterns = syncConfig?.to_codex?.exclude || syncConfig?.exclude || [];
1845
1835
  const includePatterns = options.include.length > 0 ? options.include : configIncludePatterns;
1846
1836
  const excludePatterns = [
1847
1837
  ...configExcludePatterns,
@@ -2314,7 +2304,7 @@ function typesAddCommand() {
2314
2304
  console.log(chalk7.dim("Examples: 30m, 24h, 7d"));
2315
2305
  process.exit(1);
2316
2306
  }
2317
- const configPath = path5.join(process.cwd(), ".fractary", "codex", "config.yaml");
2307
+ const configPath = path5.join(process.cwd(), ".fractary", "config.yaml");
2318
2308
  const config = await readYamlConfig(configPath);
2319
2309
  if (!config.types) {
2320
2310
  config.types = { custom: {} };
@@ -2383,7 +2373,7 @@ function typesRemoveCommand() {
2383
2373
  process.exit(1);
2384
2374
  }
2385
2375
  const typeInfo = registry.get(name);
2386
- const configPath = path5.join(process.cwd(), ".fractary", "codex", "config.yaml");
2376
+ const configPath = path5.join(process.cwd(), ".fractary", "config.yaml");
2387
2377
  const config = await readYamlConfig(configPath);
2388
2378
  if (!config.types?.custom?.[name]) {
2389
2379
  console.error(chalk7.red("Error:"), `Custom type "${name}" not found in configuration.`);