@fractary/codex-cli 0.6.0 → 0.6.2

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
@@ -383,7 +383,7 @@ var init_codex_client = __esm({
383
383
  const { readYamlConfig: readYamlConfig2 } = await Promise.resolve().then(() => (init_migrate_config(), migrate_config_exports));
384
384
  const { resolveEnvVarsInConfig: resolveEnvVarsInConfig2 } = await Promise.resolve().then(() => (init_config_types(), config_types_exports));
385
385
  try {
386
- const configPath = path4.join(process.cwd(), ".fractary", "codex.yaml");
386
+ const configPath = path4.join(process.cwd(), ".fractary", "codex", "config.yaml");
387
387
  let config;
388
388
  try {
389
389
  config = await readYamlConfig2(configPath);
@@ -980,7 +980,7 @@ function migrateCommand() {
980
980
  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) => {
981
981
  try {
982
982
  const legacyConfigPath = path4.join(process.cwd(), ".fractary", "plugins", "codex", "config.json");
983
- const newConfigPath = path4.join(process.cwd(), ".fractary", "codex.yaml");
983
+ const newConfigPath = path4.join(process.cwd(), ".fractary", "codex", "config.yaml");
984
984
  if (!await fileExists2(legacyConfigPath)) {
985
985
  if (options.json) {
986
986
  console.log(JSON.stringify({
@@ -1091,7 +1091,7 @@ function migrateCommand() {
1091
1091
  console.log(chalk8.dim(` Storage Providers: ${migrationResult.yamlConfig.storage?.length || 0}`));
1092
1092
  console.log("");
1093
1093
  console.log(chalk8.bold("Next Steps:"));
1094
- console.log(chalk8.dim(" 1. Review the new configuration: .fractary/codex.yaml"));
1094
+ console.log(chalk8.dim(" 1. Review the new configuration: .fractary/codex/config.yaml"));
1095
1095
  console.log(chalk8.dim(' 2. Set your GitHub token: export GITHUB_TOKEN="your_token"'));
1096
1096
  console.log(chalk8.dim(" 3. Test fetching: fractary codex fetch codex://org/project/path"));
1097
1097
  if (migrationResult.backupPath) {
@@ -1306,7 +1306,7 @@ async function fileExists3(filePath) {
1306
1306
  }
1307
1307
  }
1308
1308
  async function checkConfiguration() {
1309
- const configPath = path4.join(process.cwd(), ".fractary", "codex.yaml");
1309
+ const configPath = path4.join(process.cwd(), ".fractary", "codex", "config.yaml");
1310
1310
  const legacyConfigPath = path4.join(process.cwd(), ".fractary", "plugins", "codex", "config.json");
1311
1311
  try {
1312
1312
  if (!await fileExists3(configPath)) {
@@ -1414,7 +1414,7 @@ async function checkCache() {
1414
1414
  }
1415
1415
  }
1416
1416
  async function checkStorage() {
1417
- const configPath = path4.join(process.cwd(), ".fractary", "codex.yaml");
1417
+ const configPath = path4.join(process.cwd(), ".fractary", "codex", "config.yaml");
1418
1418
  try {
1419
1419
  const config = await readYamlConfig(configPath);
1420
1420
  const providers = config.storage || [];
@@ -1423,7 +1423,7 @@ async function checkStorage() {
1423
1423
  name: "Storage",
1424
1424
  status: "warn",
1425
1425
  message: "No storage providers configured",
1426
- details: "Configure at least one provider in .fractary/codex.yaml"
1426
+ details: "Configure at least one provider in .fractary/codex/config.yaml"
1427
1427
  };
1428
1428
  }
1429
1429
  const providerTypes = providers.map((p) => p.type).join(", ");
@@ -1572,7 +1572,7 @@ function syncCommand() {
1572
1572
  const cmd = new Command("sync");
1573
1573
  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) => {
1574
1574
  try {
1575
- const configPath = path4.join(process.cwd(), ".fractary", "codex.yaml");
1575
+ const configPath = path4.join(process.cwd(), ".fractary", "codex", "config.yaml");
1576
1576
  let config;
1577
1577
  try {
1578
1578
  config = await readYamlConfig(configPath);
@@ -1622,22 +1622,32 @@ function syncCommand() {
1622
1622
  ...options.exclude
1623
1623
  ];
1624
1624
  const sourceDir = process.cwd();
1625
- const allFiles = await syncManager.listLocalFiles(sourceDir);
1626
- const targetFiles = allFiles.filter((file) => {
1627
- for (const pattern of excludePatterns) {
1628
- const regex = new RegExp("^" + pattern.replace(/\*\*/g, ".*").replace(/\*/g, "[^/]*") + "$");
1629
- if (regex.test(file.path)) {
1630
- return false;
1631
- }
1632
- }
1633
- for (const pattern of includePatterns) {
1634
- const regex = new RegExp("^" + pattern.replace(/\*\*/g, ".*").replace(/\*/g, "[^/]*") + "$");
1635
- if (regex.test(file.path)) {
1636
- return true;
1637
- }
1625
+ const { glob: globSync } = await import('glob');
1626
+ const matchedFilePaths = /* @__PURE__ */ new Set();
1627
+ for (const pattern of includePatterns) {
1628
+ try {
1629
+ const matches = await globSync(pattern, {
1630
+ cwd: sourceDir,
1631
+ dot: true,
1632
+ nodir: true,
1633
+ ignore: excludePatterns
1634
+ });
1635
+ matches.forEach((match) => matchedFilePaths.add(match));
1636
+ } catch (error) {
1637
+ console.error(chalk8.yellow(`Warning: Invalid pattern "${pattern}": ${error.message}`));
1638
1638
  }
1639
- return false;
1640
- });
1639
+ }
1640
+ const targetFiles = await Promise.all(
1641
+ Array.from(matchedFilePaths).map(async (filePath) => {
1642
+ const fullPath = path4.join(sourceDir, filePath);
1643
+ const stats = await import('fs/promises').then((fs7) => fs7.stat(fullPath));
1644
+ return {
1645
+ path: filePath,
1646
+ size: stats.size,
1647
+ mtime: stats.mtimeMs
1648
+ };
1649
+ })
1650
+ );
1641
1651
  const syncOptions = {
1642
1652
  direction,
1643
1653
  dryRun: options.dryRun,
@@ -2078,7 +2088,7 @@ function typesAddCommand() {
2078
2088
  console.log(chalk8.dim("Examples: 30m, 24h, 7d"));
2079
2089
  process.exit(1);
2080
2090
  }
2081
- const configPath = path4.join(process.cwd(), ".fractary", "codex.yaml");
2091
+ const configPath = path4.join(process.cwd(), ".fractary", "codex", "config.yaml");
2082
2092
  const config = await readYamlConfig(configPath);
2083
2093
  if (!config.types) {
2084
2094
  config.types = { custom: {} };
@@ -2147,7 +2157,7 @@ function typesRemoveCommand() {
2147
2157
  process.exit(1);
2148
2158
  }
2149
2159
  const typeInfo = registry.get(name);
2150
- const configPath = path4.join(process.cwd(), ".fractary", "codex.yaml");
2160
+ const configPath = path4.join(process.cwd(), ".fractary", "codex", "config.yaml");
2151
2161
  const config = await readYamlConfig(configPath);
2152
2162
  if (!config.types?.custom?.[name]) {
2153
2163
  console.error(chalk8.red("Error:"), `Custom type "${name}" not found in configuration.`);