@fractary/codex-cli 0.8.0 → 0.9.1

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
@@ -2,7 +2,7 @@
2
2
  'use strict';
3
3
 
4
4
  var fs$1 = require('fs/promises');
5
- var path3 = require('path');
5
+ var path4 = require('path');
6
6
  var yaml = require('js-yaml');
7
7
  var codex = require('@fractary/codex');
8
8
  var os = require('os');
@@ -34,7 +34,7 @@ function _interopNamespace(e) {
34
34
  }
35
35
 
36
36
  var fs__namespace = /*#__PURE__*/_interopNamespace(fs$1);
37
- var path3__namespace = /*#__PURE__*/_interopNamespace(path3);
37
+ var path4__namespace = /*#__PURE__*/_interopNamespace(path4);
38
38
  var yaml__namespace = /*#__PURE__*/_interopNamespace(yaml);
39
39
  var os__namespace = /*#__PURE__*/_interopNamespace(os);
40
40
  var chalk8__default = /*#__PURE__*/_interopDefault(chalk8);
@@ -194,7 +194,7 @@ async function migrateConfig(legacyConfigPath, options) {
194
194
  }
195
195
  }
196
196
  async function writeYamlConfig(config, outputPath) {
197
- const dir = path3__namespace.dirname(outputPath);
197
+ const dir = path4__namespace.dirname(outputPath);
198
198
  await fs__namespace.mkdir(dir, { recursive: true });
199
199
  const yamlContent = yaml__namespace.dump(config, {
200
200
  indent: 2,
@@ -418,7 +418,7 @@ var init_codex_client = __esm({
418
418
  const { readYamlConfig: readYamlConfig2 } = await Promise.resolve().then(() => (init_migrate_config(), migrate_config_exports));
419
419
  const { resolveEnvVarsInConfig: resolveEnvVarsInConfig2 } = await Promise.resolve().then(() => (init_config_types(), config_types_exports));
420
420
  try {
421
- const configPath = path3__namespace.join(process.cwd(), ".fractary", "codex", "config.yaml");
421
+ const configPath = path4__namespace.join(process.cwd(), ".fractary", "codex", "config.yaml");
422
422
  let config;
423
423
  try {
424
424
  config = await readYamlConfig2(configPath);
@@ -688,7 +688,7 @@ function getTempCodexPath(config) {
688
688
  const codexRepo = config.codex_repository || "codex";
689
689
  const sanitizedOrg = sanitizePathComponent(config.organization);
690
690
  const sanitizedRepo = sanitizePathComponent(codexRepo);
691
- return path3__namespace.join(
691
+ return path4__namespace.join(
692
692
  os__namespace.tmpdir(),
693
693
  "fractary-codex-clone",
694
694
  `${sanitizedOrg}-${sanitizedRepo}-${process.pid}`
@@ -696,7 +696,7 @@ function getTempCodexPath(config) {
696
696
  }
697
697
  async function isValidGitRepo(repoPath) {
698
698
  try {
699
- const gitDir = path3__namespace.join(repoPath, ".git");
699
+ const gitDir = path4__namespace.join(repoPath, ".git");
700
700
  const stats = await fs__namespace.stat(gitDir);
701
701
  return stats.isDirectory();
702
702
  } catch {
@@ -729,7 +729,7 @@ async function execGit(repoPath, args) {
729
729
  }
730
730
  }
731
731
  async function gitClone(url, targetPath, options) {
732
- const parentDir = path3__namespace.dirname(targetPath);
732
+ const parentDir = path4__namespace.dirname(targetPath);
733
733
  await fs__namespace.mkdir(parentDir, { recursive: true });
734
734
  const args = ["clone"];
735
735
  if (options?.depth) {
@@ -901,7 +901,229 @@ init_cjs_shims();
901
901
 
902
902
  // src/commands/config/init.ts
903
903
  init_cjs_shims();
904
- init_migrate_config();
904
+
905
+ // src/config/unified-config.ts
906
+ init_cjs_shims();
907
+ function sanitizeForS3BucketName(name) {
908
+ return name.toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/^-+|-+$/g, "").replace(/-+/g, "-").substring(0, 63);
909
+ }
910
+ function getDefaultUnifiedConfig(organization, project) {
911
+ const sanitizedProject = sanitizeForS3BucketName(project);
912
+ return {
913
+ file: {
914
+ schema_version: "2.0",
915
+ sources: {
916
+ specs: {
917
+ type: "s3",
918
+ bucket: `${sanitizedProject}-files`,
919
+ prefix: "specs/",
920
+ region: "us-east-1",
921
+ local: {
922
+ base_path: ".fractary/specs"
923
+ },
924
+ push: {
925
+ compress: false,
926
+ keep_local: true
927
+ },
928
+ auth: {
929
+ profile: "default"
930
+ }
931
+ },
932
+ logs: {
933
+ type: "s3",
934
+ bucket: `${sanitizedProject}-files`,
935
+ prefix: "logs/",
936
+ region: "us-east-1",
937
+ local: {
938
+ base_path: ".fractary/logs"
939
+ },
940
+ push: {
941
+ compress: true,
942
+ keep_local: true
943
+ },
944
+ auth: {
945
+ profile: "default"
946
+ }
947
+ }
948
+ }
949
+ },
950
+ codex: {
951
+ schema_version: "2.0",
952
+ organization,
953
+ project,
954
+ dependencies: {}
955
+ }
956
+ };
957
+ }
958
+ async function readUnifiedConfig(configPath) {
959
+ try {
960
+ const content = await fs__namespace.readFile(configPath, "utf-8");
961
+ const config = yaml__namespace.load(content);
962
+ return config;
963
+ } catch (error) {
964
+ if (error.code === "ENOENT") {
965
+ return null;
966
+ }
967
+ throw error;
968
+ }
969
+ }
970
+ async function writeUnifiedConfig(config, outputPath) {
971
+ const dir = path4__namespace.dirname(outputPath);
972
+ await fs__namespace.mkdir(dir, { recursive: true });
973
+ const yamlContent = yaml__namespace.dump(config, {
974
+ indent: 2,
975
+ lineWidth: 120,
976
+ noRefs: true,
977
+ sortKeys: false
978
+ });
979
+ await fs__namespace.writeFile(outputPath, yamlContent, "utf-8");
980
+ }
981
+ function mergeUnifiedConfigs(existing, updates) {
982
+ const merged = {};
983
+ if (updates.file || existing.file) {
984
+ merged.file = {
985
+ schema_version: updates.file?.schema_version || existing.file?.schema_version || "2.0",
986
+ sources: {
987
+ ...existing.file?.sources || {},
988
+ ...updates.file?.sources || {}
989
+ }
990
+ };
991
+ }
992
+ if (updates.codex || existing.codex) {
993
+ merged.codex = {
994
+ schema_version: updates.codex?.schema_version || existing.codex?.schema_version || "2.0",
995
+ organization: updates.codex?.organization || existing.codex?.organization || "default",
996
+ project: updates.codex?.project || existing.codex?.project || "default",
997
+ dependencies: {
998
+ ...existing.codex?.dependencies || {},
999
+ ...updates.codex?.dependencies || {}
1000
+ }
1001
+ };
1002
+ }
1003
+ return merged;
1004
+ }
1005
+ async function initializeUnifiedConfig(configPath, organization, project, options) {
1006
+ const existingConfig = await readUnifiedConfig(configPath);
1007
+ if (existingConfig && !options?.force) {
1008
+ const defaultConfig = getDefaultUnifiedConfig(organization, project);
1009
+ const merged = mergeUnifiedConfigs(existingConfig, defaultConfig);
1010
+ await writeUnifiedConfig(merged, configPath);
1011
+ return {
1012
+ created: false,
1013
+ merged: true,
1014
+ config: merged
1015
+ };
1016
+ }
1017
+ const config = getDefaultUnifiedConfig(organization, project);
1018
+ await writeUnifiedConfig(config, configPath);
1019
+ return {
1020
+ created: true,
1021
+ merged: false,
1022
+ config
1023
+ };
1024
+ }
1025
+
1026
+ // src/config/gitignore-utils.ts
1027
+ init_cjs_shims();
1028
+ var DEFAULT_FRACTARY_GITIGNORE = `# .fractary/.gitignore
1029
+ # This file is managed by multiple plugins - each plugin manages its own section
1030
+
1031
+ # ===== fractary-codex (managed) =====
1032
+ codex/cache/
1033
+ # ===== end fractary-codex =====
1034
+ `;
1035
+ var DEFAULT_CACHE_DIR = "codex/cache/";
1036
+ async function readFractaryGitignore(projectRoot) {
1037
+ const gitignorePath = path4__namespace.join(projectRoot, ".fractary", ".gitignore");
1038
+ try {
1039
+ return await fs__namespace.readFile(gitignorePath, "utf-8");
1040
+ } catch (error) {
1041
+ if (error.code === "ENOENT") {
1042
+ return null;
1043
+ }
1044
+ throw error;
1045
+ }
1046
+ }
1047
+ async function writeFractaryGitignore(projectRoot, content) {
1048
+ const gitignorePath = path4__namespace.join(projectRoot, ".fractary", ".gitignore");
1049
+ await fs__namespace.mkdir(path4__namespace.join(projectRoot, ".fractary"), { recursive: true });
1050
+ await fs__namespace.writeFile(gitignorePath, content, "utf-8");
1051
+ }
1052
+ function normalizeCachePath(cachePath) {
1053
+ let normalized = cachePath.replace(/\\/g, "/");
1054
+ normalized = normalized.replace(/^\.fractary\//, "");
1055
+ if (!normalized.endsWith("/")) {
1056
+ normalized += "/";
1057
+ }
1058
+ return normalized;
1059
+ }
1060
+ function isCachePathIgnored(gitignoreContent, cachePath) {
1061
+ const normalized = normalizeCachePath(cachePath);
1062
+ const lines = gitignoreContent.split("\n").map((l) => l.trim());
1063
+ return lines.some((line) => {
1064
+ if (line.startsWith("#") || line === "") return false;
1065
+ let normalizedLine = line.replace(/\\/g, "/");
1066
+ if (!normalizedLine.endsWith("/")) {
1067
+ normalizedLine += "/";
1068
+ }
1069
+ return normalizedLine === normalized;
1070
+ });
1071
+ }
1072
+ function addCachePathToGitignore(gitignoreContent, cachePath, comment) {
1073
+ const normalized = normalizeCachePath(cachePath);
1074
+ if (isCachePathIgnored(gitignoreContent, cachePath)) {
1075
+ return gitignoreContent;
1076
+ }
1077
+ let addition = "";
1078
+ {
1079
+ addition += `
1080
+ # ${comment}
1081
+ `;
1082
+ }
1083
+ addition += normalized + "\n";
1084
+ return gitignoreContent.trimEnd() + addition;
1085
+ }
1086
+ async function ensureCachePathIgnored(projectRoot, cachePath) {
1087
+ const gitignorePath = path4__namespace.join(projectRoot, ".fractary", ".gitignore");
1088
+ let relativeCachePath = cachePath;
1089
+ if (path4__namespace.isAbsolute(cachePath)) {
1090
+ relativeCachePath = path4__namespace.relative(path4__namespace.join(projectRoot, ".fractary"), cachePath);
1091
+ }
1092
+ relativeCachePath = normalizeCachePath(relativeCachePath);
1093
+ let content = await readFractaryGitignore(projectRoot);
1094
+ const gitignoreExists = content !== null;
1095
+ if (!gitignoreExists) {
1096
+ content = DEFAULT_FRACTARY_GITIGNORE;
1097
+ if (!isCachePathIgnored(content, relativeCachePath)) {
1098
+ content = addCachePathToGitignore(content, relativeCachePath, "Custom cache directory");
1099
+ }
1100
+ await writeFractaryGitignore(projectRoot, content);
1101
+ return {
1102
+ created: true,
1103
+ updated: false,
1104
+ alreadyIgnored: false,
1105
+ gitignorePath
1106
+ };
1107
+ }
1108
+ if (isCachePathIgnored(content, relativeCachePath)) {
1109
+ return {
1110
+ created: false,
1111
+ updated: false,
1112
+ alreadyIgnored: true,
1113
+ gitignorePath
1114
+ };
1115
+ }
1116
+ content = addCachePathToGitignore(content, relativeCachePath, "Custom cache directory");
1117
+ await writeFractaryGitignore(projectRoot, content);
1118
+ return {
1119
+ created: false,
1120
+ updated: true,
1121
+ alreadyIgnored: false,
1122
+ gitignorePath
1123
+ };
1124
+ }
1125
+
1126
+ // src/commands/config/init.ts
905
1127
  async function getOrgFromGitRemote() {
906
1128
  try {
907
1129
  const { execSync } = __require("child_process");
@@ -923,9 +1145,9 @@ async function fileExists(filePath) {
923
1145
  }
924
1146
  function initCommand() {
925
1147
  const cmd = new commander.Command("init");
926
- cmd.description("Initialize Codex v3.0 with YAML configuration").option("--org <slug>", 'Organization slug (e.g., "fractary")').option("--mcp", "Enable MCP server registration").option("--force", "Overwrite existing configuration").action(async (options) => {
1148
+ cmd.description("Initialize unified Fractary configuration (.fractary/config.yaml)").option("--org <slug>", 'Organization slug (e.g., "fractary")').option("--project <name>", "Project name (default: derived from directory)").option("--force", "Overwrite existing configuration").action(async (options) => {
927
1149
  try {
928
- console.log(chalk8__default.default.blue("Initializing Codex v3.0 (YAML format)...\n"));
1150
+ console.log(chalk8__default.default.blue("Initializing unified Fractary configuration...\n"));
929
1151
  let org = options.org;
930
1152
  if (!org) {
931
1153
  org = await getOrgFromGitRemote();
@@ -934,60 +1156,79 @@ function initCommand() {
934
1156
  try {
935
1157
  const { resolveOrganization } = await import('@fractary/codex');
936
1158
  org = resolveOrganization({
937
- repoName: path3__namespace.basename(process.cwd())
1159
+ repoName: path4__namespace.basename(process.cwd())
938
1160
  });
939
1161
  } catch {
940
1162
  }
941
1163
  }
942
1164
  if (!org) {
943
- org = path3__namespace.basename(process.cwd()).split("-")[0] || "default";
1165
+ org = path4__namespace.basename(process.cwd()).split("-")[0] || "default";
944
1166
  console.log(chalk8__default.default.yellow(`\u26A0 Could not detect organization, using: ${org}`));
945
1167
  console.log(chalk8__default.default.dim(" Use --org <slug> to specify explicitly\n"));
946
1168
  } else {
947
1169
  console.log(chalk8__default.default.dim(`Organization: ${chalk8__default.default.cyan(org)}
948
1170
  `));
949
1171
  }
950
- const configDir = path3__namespace.join(process.cwd(), ".fractary", "codex");
951
- const configPath = path3__namespace.join(configDir, "config.yaml");
1172
+ let project = options.project;
1173
+ if (!project) {
1174
+ project = path4__namespace.basename(process.cwd());
1175
+ console.log(chalk8__default.default.dim(`Project: ${chalk8__default.default.cyan(project)}
1176
+ `));
1177
+ }
1178
+ const configPath = path4__namespace.join(process.cwd(), ".fractary", "config.yaml");
952
1179
  const configExists = await fileExists(configPath);
953
1180
  if (configExists && !options.force) {
954
- console.log(chalk8__default.default.yellow("\u26A0 Configuration already exists at .fractary/codex/config.yaml"));
955
- console.log(chalk8__default.default.dim("Use --force to overwrite"));
956
- process.exit(1);
1181
+ console.log(chalk8__default.default.yellow(`\u26A0 Configuration already exists at .fractary/config.yaml`));
1182
+ console.log(chalk8__default.default.dim("Merging with existing configuration...\n"));
957
1183
  }
958
1184
  console.log("Creating directory structure...");
959
1185
  const dirs = [
1186
+ ".fractary",
1187
+ ".fractary/specs",
1188
+ ".fractary/logs",
960
1189
  ".fractary/codex",
961
1190
  ".fractary/codex/cache"
962
1191
  ];
963
1192
  for (const dir of dirs) {
964
- await fs__namespace.mkdir(path3__namespace.join(process.cwd(), dir), { recursive: true });
1193
+ await fs__namespace.mkdir(path4__namespace.join(process.cwd(), dir), { recursive: true });
965
1194
  console.log(chalk8__default.default.green("\u2713"), chalk8__default.default.dim(dir + "/"));
966
1195
  }
967
- console.log("\nCreating YAML configuration...");
968
- const config = getDefaultYamlConfig(org);
969
- if (options.mcp && config.mcp) {
970
- config.mcp.enabled = true;
1196
+ const gitignoreResult = await ensureCachePathIgnored(process.cwd(), ".fractary/codex/cache");
1197
+ if (gitignoreResult.created) {
1198
+ console.log(chalk8__default.default.green("\u2713"), chalk8__default.default.dim(".fractary/.gitignore (created)"));
1199
+ } else if (gitignoreResult.updated) {
1200
+ console.log(chalk8__default.default.green("\u2713"), chalk8__default.default.dim(".fractary/.gitignore (updated)"));
1201
+ } else {
1202
+ console.log(chalk8__default.default.green("\u2713"), chalk8__default.default.dim(".fractary/.gitignore (exists)"));
1203
+ }
1204
+ console.log("\nInitializing configuration...");
1205
+ const result = await initializeUnifiedConfig(
1206
+ configPath,
1207
+ org,
1208
+ project,
1209
+ { force: options.force }
1210
+ );
1211
+ if (result.created) {
1212
+ console.log(chalk8__default.default.green("\u2713"), chalk8__default.default.dim(".fractary/config.yaml (created)"));
1213
+ } else if (result.merged) {
1214
+ console.log(chalk8__default.default.green("\u2713"), chalk8__default.default.dim(".fractary/config.yaml (merged with existing)"));
971
1215
  }
972
- await writeYamlConfig(config, configPath);
973
- console.log(chalk8__default.default.green("\u2713"), chalk8__default.default.dim(".fractary/codex/config.yaml"));
974
- console.log(chalk8__default.default.green("\n\u2713 Codex v4.0 initialized successfully!\n"));
1216
+ console.log(chalk8__default.default.green("\n\u2713 Unified configuration initialized successfully!\n"));
975
1217
  console.log(chalk8__default.default.bold("Configuration:"));
976
1218
  console.log(chalk8__default.default.dim(` Organization: ${org}`));
977
- console.log(chalk8__default.default.dim(` Cache: .fractary/codex/cache/`));
978
- console.log(chalk8__default.default.dim(` Config: .fractary/codex/config.yaml`));
979
- if (options.mcp) {
980
- console.log(chalk8__default.default.dim(` MCP Server: Enabled (port 3000)`));
981
- }
982
- console.log(chalk8__default.default.bold("\nStorage providers configured:"));
983
- console.log(chalk8__default.default.dim(" - Local filesystem (./knowledge)"));
984
- console.log(chalk8__default.default.dim(" - GitHub (requires GITHUB_TOKEN)"));
985
- console.log(chalk8__default.default.dim(" - HTTP endpoint"));
1219
+ console.log(chalk8__default.default.dim(` Project: ${project}`));
1220
+ console.log(chalk8__default.default.dim(` Config: .fractary/config.yaml`));
1221
+ console.log(chalk8__default.default.bold("\nFile plugin sources:"));
1222
+ console.log(chalk8__default.default.dim(" - specs: .fractary/specs/ \u2192 S3"));
1223
+ console.log(chalk8__default.default.dim(" - logs: .fractary/logs/ \u2192 S3"));
1224
+ console.log(chalk8__default.default.bold("\nCodex plugin:"));
1225
+ console.log(chalk8__default.default.dim(" - Cache: .fractary/codex/cache/"));
1226
+ console.log(chalk8__default.default.dim(" - Dependencies: (none configured)"));
986
1227
  console.log(chalk8__default.default.bold("\nNext steps:"));
987
- console.log(chalk8__default.default.dim(' 1. Set your GitHub token: export GITHUB_TOKEN="your_token"'));
988
- console.log(chalk8__default.default.dim(" 2. Edit .fractary/codex/config.yaml to configure storage providers"));
989
- console.log(chalk8__default.default.dim(" 3. Fetch a document: fractary codex fetch codex://org/project/path"));
990
- console.log(chalk8__default.default.dim(" 4. Check cache: fractary codex cache list"));
1228
+ console.log(chalk8__default.default.dim(" 1. Configure AWS credentials for S3 access"));
1229
+ console.log(chalk8__default.default.dim(" 2. Edit .fractary/config.yaml to add external project dependencies"));
1230
+ console.log(chalk8__default.default.dim(" 3. Access current project files: codex://specs/SPEC-001.md"));
1231
+ console.log(chalk8__default.default.dim(" 4. Access external projects: codex://org/project/docs/README.md"));
991
1232
  } catch (error) {
992
1233
  console.error(chalk8__default.default.red("Error:"), error.message);
993
1234
  process.exit(1);
@@ -1014,8 +1255,8 @@ function migrateCommand() {
1014
1255
  const cmd = new commander.Command("migrate");
1015
1256
  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) => {
1016
1257
  try {
1017
- const legacyConfigPath = path3__namespace.join(process.cwd(), ".fractary", "plugins", "codex", "config.json");
1018
- const newConfigPath = path3__namespace.join(process.cwd(), ".fractary", "codex", "config.yaml");
1258
+ const legacyConfigPath = path4__namespace.join(process.cwd(), ".fractary", "plugins", "codex", "config.json");
1259
+ const newConfigPath = path4__namespace.join(process.cwd(), ".fractary", "codex", "config.yaml");
1019
1260
  if (!await fileExists2(legacyConfigPath)) {
1020
1261
  if (options.json) {
1021
1262
  console.log(JSON.stringify({
@@ -1048,8 +1289,9 @@ function migrateCommand() {
1048
1289
  let legacyConfig;
1049
1290
  try {
1050
1291
  legacyConfig = JSON.parse(legacyContent);
1051
- } catch {
1292
+ } catch (parseError) {
1052
1293
  console.error(chalk8__default.default.red("Error:"), "Invalid JSON in legacy config file.");
1294
+ console.error(chalk8__default.default.dim("Details:"), parseError.message);
1053
1295
  process.exit(1);
1054
1296
  }
1055
1297
  if (!options.json && !options.dryRun) {
@@ -1110,19 +1352,34 @@ function migrateCommand() {
1110
1352
  }
1111
1353
  if (!options.dryRun) {
1112
1354
  await writeYamlConfig(migrationResult.yamlConfig, newConfigPath);
1113
- const cacheDir = path3__namespace.join(process.cwd(), ".codex-cache");
1355
+ const configuredCacheDir = migrationResult.yamlConfig.cacheDir || ".fractary/codex/cache";
1356
+ const cacheDir = path4__namespace.join(process.cwd(), configuredCacheDir);
1114
1357
  await fs__namespace.mkdir(cacheDir, { recursive: true });
1358
+ const gitignoreResult = await ensureCachePathIgnored(process.cwd(), configuredCacheDir);
1359
+ const isCustomCachePath = normalizeCachePath(configuredCacheDir) !== DEFAULT_CACHE_DIR;
1115
1360
  if (!options.json) {
1116
1361
  console.log(chalk8__default.default.green("\u2713"), "YAML configuration created");
1117
1362
  console.log(chalk8__default.default.green("\u2713"), "Cache directory initialized");
1118
1363
  if (migrationResult.backupPath) {
1119
1364
  console.log(chalk8__default.default.green("\u2713"), "Legacy config backed up");
1120
1365
  }
1366
+ if (gitignoreResult.created) {
1367
+ console.log(chalk8__default.default.green("\u2713"), ".fractary/.gitignore created");
1368
+ } else if (gitignoreResult.updated) {
1369
+ console.log(chalk8__default.default.green("\u2713"), ".fractary/.gitignore updated with cache path");
1370
+ } else if (gitignoreResult.alreadyIgnored) {
1371
+ console.log(chalk8__default.default.green("\u2713"), "Cache path already in .fractary/.gitignore");
1372
+ }
1373
+ if (isCustomCachePath) {
1374
+ console.log("");
1375
+ console.log(chalk8__default.default.yellow("\u26A0 Custom cache directory detected:"), chalk8__default.default.dim(configuredCacheDir));
1376
+ console.log(chalk8__default.default.dim(" Ensure .fractary/.gitignore includes this path to avoid committing cache files."));
1377
+ }
1121
1378
  console.log("");
1122
1379
  console.log(chalk8__default.default.bold("New Configuration:"));
1123
1380
  console.log(chalk8__default.default.dim(` Path: ${newConfigPath}`));
1124
1381
  console.log(chalk8__default.default.dim(` Organization: ${migrationResult.yamlConfig.organization}`));
1125
- console.log(chalk8__default.default.dim(` Cache: ${migrationResult.yamlConfig.cacheDir || ".codex-cache"}`));
1382
+ console.log(chalk8__default.default.dim(` Cache: ${configuredCacheDir}`));
1126
1383
  console.log(chalk8__default.default.dim(` Storage Providers: ${migrationResult.yamlConfig.storage?.length || 0}`));
1127
1384
  console.log("");
1128
1385
  console.log(chalk8__default.default.bold("Next Steps:"));
@@ -1131,7 +1388,7 @@ function migrateCommand() {
1131
1388
  console.log(chalk8__default.default.dim(" 3. Test fetching: fractary codex fetch codex://org/project/path"));
1132
1389
  if (migrationResult.backupPath) {
1133
1390
  console.log("");
1134
- console.log(chalk8__default.default.dim(`Backup saved: ${path3__namespace.basename(migrationResult.backupPath)}`));
1391
+ console.log(chalk8__default.default.dim(`Backup saved: ${path4__namespace.basename(migrationResult.backupPath)}`));
1135
1392
  }
1136
1393
  }
1137
1394
  }
@@ -1341,8 +1598,8 @@ async function fileExists3(filePath) {
1341
1598
  }
1342
1599
  }
1343
1600
  async function checkConfiguration() {
1344
- const configPath = path3__namespace.join(process.cwd(), ".fractary", "codex", "config.yaml");
1345
- const legacyConfigPath = path3__namespace.join(process.cwd(), ".fractary", "plugins", "codex", "config.json");
1601
+ const configPath = path4__namespace.join(process.cwd(), ".fractary", "codex", "config.yaml");
1602
+ const legacyConfigPath = path4__namespace.join(process.cwd(), ".fractary", "plugins", "codex", "config.json");
1346
1603
  try {
1347
1604
  if (!await fileExists3(configPath)) {
1348
1605
  if (await fileExists3(legacyConfigPath)) {
@@ -1449,7 +1706,7 @@ async function checkCache() {
1449
1706
  }
1450
1707
  }
1451
1708
  async function checkStorage() {
1452
- const configPath = path3__namespace.join(process.cwd(), ".fractary", "codex", "config.yaml");
1709
+ const configPath = path4__namespace.join(process.cwd(), ".fractary", "codex", "config.yaml");
1453
1710
  try {
1454
1711
  const config = await readYamlConfig(configPath);
1455
1712
  const providers = config.storage || [];
@@ -1607,7 +1864,7 @@ function syncCommand() {
1607
1864
  const cmd = new commander.Command("sync");
1608
1865
  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) => {
1609
1866
  try {
1610
- const configPath = path3__namespace.join(process.cwd(), ".fractary", "codex", "config.yaml");
1867
+ const configPath = path4__namespace.join(process.cwd(), ".fractary", "codex", "config.yaml");
1611
1868
  let config;
1612
1869
  try {
1613
1870
  config = await readYamlConfig(configPath);
@@ -1641,7 +1898,7 @@ function syncCommand() {
1641
1898
  const syncManager = createSyncManager({
1642
1899
  localStorage,
1643
1900
  config: config.sync,
1644
- manifestPath: path3__namespace.join(process.cwd(), ".fractary", ".codex-sync-manifest.json")
1901
+ manifestPath: path4__namespace.join(process.cwd(), ".fractary", ".codex-sync-manifest.json")
1645
1902
  });
1646
1903
  const defaultToCodexPatterns = [
1647
1904
  "docs/**/*.md",
@@ -1692,8 +1949,8 @@ function syncCommand() {
1692
1949
  }
1693
1950
  const targetFiles = await Promise.all(
1694
1951
  Array.from(matchedFilePaths).map(async (filePath) => {
1695
- const fullPath = path3__namespace.join(sourceDir, filePath);
1696
- const stats = await import('fs/promises').then((fs7) => fs7.stat(fullPath));
1952
+ const fullPath = path4__namespace.join(sourceDir, filePath);
1953
+ const stats = await import('fs/promises').then((fs9) => fs9.stat(fullPath));
1697
1954
  return {
1698
1955
  path: filePath,
1699
1956
  size: stats.size,
@@ -2141,7 +2398,7 @@ function typesAddCommand() {
2141
2398
  console.log(chalk8__default.default.dim("Examples: 30m, 24h, 7d"));
2142
2399
  process.exit(1);
2143
2400
  }
2144
- const configPath = path3__namespace.join(process.cwd(), ".fractary", "codex", "config.yaml");
2401
+ const configPath = path4__namespace.join(process.cwd(), ".fractary", "codex", "config.yaml");
2145
2402
  const config = await readYamlConfig(configPath);
2146
2403
  if (!config.types) {
2147
2404
  config.types = { custom: {} };
@@ -2210,7 +2467,7 @@ function typesRemoveCommand() {
2210
2467
  process.exit(1);
2211
2468
  }
2212
2469
  const typeInfo = registry.get(name);
2213
- const configPath = path3__namespace.join(process.cwd(), ".fractary", "codex", "config.yaml");
2470
+ const configPath = path4__namespace.join(process.cwd(), ".fractary", "codex", "config.yaml");
2214
2471
  const config = await readYamlConfig(configPath);
2215
2472
  if (!config.types?.custom?.[name]) {
2216
2473
  console.error(chalk8__default.default.red("Error:"), `Custom type "${name}" not found in configuration.`);
@@ -2266,8 +2523,8 @@ function typesCommand() {
2266
2523
  return cmd;
2267
2524
  }
2268
2525
  var __filename2 = url.fileURLToPath(importMetaUrl);
2269
- var __dirname$1 = path3.dirname(__filename2);
2270
- var packageJson = JSON.parse(fs.readFileSync(path3.join(__dirname$1, "../package.json"), "utf-8"));
2526
+ var __dirname$1 = path4.dirname(__filename2);
2527
+ var packageJson = JSON.parse(fs.readFileSync(path4.join(__dirname$1, "../package.json"), "utf-8"));
2271
2528
  var VERSION = packageJson.version;
2272
2529
  function createCLI() {
2273
2530
  const program = new commander.Command("fractary-codex");