@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.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);
@@ -1856,25 +1862,9 @@ function syncCommand() {
1856
1862
  ".fractary/templates/**"
1857
1863
  ];
1858
1864
  const syncConfig = config.sync;
1859
- let configIncludePatterns;
1860
- let configExcludePatterns = [];
1861
- if (syncConfig?.to_codex) {
1862
- const toCodex = syncConfig.to_codex;
1863
- if (typeof toCodex === "object" && !Array.isArray(toCodex)) {
1864
- const directionalConfig = toCodex;
1865
- configIncludePatterns = directionalConfig.include || defaultToCodexPatterns;
1866
- configExcludePatterns = directionalConfig.exclude || [];
1867
- } else if (Array.isArray(toCodex)) {
1868
- configIncludePatterns = toCodex;
1869
- configExcludePatterns = syncConfig.exclude || [];
1870
- } else {
1871
- configIncludePatterns = defaultToCodexPatterns;
1872
- configExcludePatterns = [];
1873
- }
1874
- } else {
1875
- configIncludePatterns = defaultToCodexPatterns;
1876
- configExcludePatterns = syncConfig?.exclude || [];
1877
- }
1865
+ const sdkPatterns = syncManager.getToCodexPatterns();
1866
+ const configIncludePatterns = sdkPatterns.length > 0 ? sdkPatterns : defaultToCodexPatterns;
1867
+ const configExcludePatterns = syncConfig?.to_codex?.exclude || syncConfig?.exclude || [];
1878
1868
  const includePatterns = options.include.length > 0 ? options.include : configIncludePatterns;
1879
1869
  const excludePatterns = [
1880
1870
  ...configExcludePatterns,
@@ -2347,7 +2337,7 @@ function typesAddCommand() {
2347
2337
  console.log(chalk7__default.default.dim("Examples: 30m, 24h, 7d"));
2348
2338
  process.exit(1);
2349
2339
  }
2350
- const configPath = path4__namespace.join(process.cwd(), ".fractary", "codex", "config.yaml");
2340
+ const configPath = path4__namespace.join(process.cwd(), ".fractary", "config.yaml");
2351
2341
  const config = await readYamlConfig(configPath);
2352
2342
  if (!config.types) {
2353
2343
  config.types = { custom: {} };
@@ -2416,7 +2406,7 @@ function typesRemoveCommand() {
2416
2406
  process.exit(1);
2417
2407
  }
2418
2408
  const typeInfo = registry.get(name);
2419
- const configPath = path4__namespace.join(process.cwd(), ".fractary", "codex", "config.yaml");
2409
+ const configPath = path4__namespace.join(process.cwd(), ".fractary", "config.yaml");
2420
2410
  const config = await readYamlConfig(configPath);
2421
2411
  if (!config.types?.custom?.[name]) {
2422
2412
  console.error(chalk7__default.default.red("Error:"), `Custom type "${name}" not found in configuration.`);