@minniexcode/codex-switch 0.0.4 → 0.0.6

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.
Files changed (64) hide show
  1. package/README.md +35 -97
  2. package/dist/app/add-provider.js +40 -3
  3. package/dist/app/edit-provider.js +76 -3
  4. package/dist/app/export-providers.js +2 -2
  5. package/dist/app/get-current-profile.js +1 -1
  6. package/dist/app/get-status.js +10 -3
  7. package/dist/app/import-providers.js +47 -3
  8. package/dist/app/list-backups.js +1 -1
  9. package/dist/app/list-config-profiles.js +30 -0
  10. package/dist/app/list-providers.js +1 -1
  11. package/dist/app/remove-provider.js +35 -3
  12. package/dist/app/rollback-backup.js +1 -1
  13. package/dist/app/rollback-latest.js +1 -1
  14. package/dist/app/run-doctor.js +44 -26
  15. package/dist/app/run-mutation.js +2 -2
  16. package/dist/app/setup-codex.js +37 -20
  17. package/dist/app/show-config.js +34 -0
  18. package/dist/app/show-provider.js +1 -1
  19. package/dist/app/switch-provider.js +8 -5
  20. package/dist/cli/add-interactive.js +7 -106
  21. package/dist/cli/args.js +5 -126
  22. package/dist/cli/help.js +5 -276
  23. package/dist/cli/interactive.js +16 -171
  24. package/dist/cli/output.js +23 -1
  25. package/dist/cli/prompt.js +3 -108
  26. package/dist/cli.js +10 -315
  27. package/dist/commands/args.js +132 -0
  28. package/dist/commands/dispatch.js +16 -0
  29. package/dist/commands/handlers.js +391 -0
  30. package/dist/commands/help.js +119 -0
  31. package/dist/commands/registry.js +291 -0
  32. package/dist/commands/types.js +2 -0
  33. package/dist/domain/config.js +548 -39
  34. package/dist/infra/backup-repo.js +8 -208
  35. package/dist/infra/codex-cli.js +8 -113
  36. package/dist/infra/codex-discovery.js +3 -41
  37. package/dist/infra/codex-paths.js +5 -69
  38. package/dist/infra/config-repo.js +161 -9
  39. package/dist/infra/fs-utils.js +7 -95
  40. package/dist/infra/lock-repo.js +3 -97
  41. package/dist/infra/providers-repo.js +7 -96
  42. package/dist/interaction/add-interactive.js +108 -0
  43. package/dist/interaction/interactive.js +216 -0
  44. package/dist/interaction/prompt.js +110 -0
  45. package/dist/runtime/codex-cli.js +130 -0
  46. package/dist/runtime/codex-probe.js +50 -0
  47. package/dist/runtime/types.js +2 -0
  48. package/dist/storage/backup-repo.js +210 -0
  49. package/dist/storage/codex-paths.js +71 -0
  50. package/dist/storage/config-repo.js +208 -0
  51. package/dist/storage/fs-utils.js +97 -0
  52. package/dist/storage/lock-repo.js +99 -0
  53. package/dist/storage/providers-repo.js +98 -0
  54. package/docs/Design/codex-switch-v0.0.5-design.md +932 -0
  55. package/docs/Design/codex-switch-v0.0.6-design.md +708 -0
  56. package/docs/PRD/codex-switch-prd-v0.0.5-to-v0.1.0.md +340 -0
  57. package/docs/PRD/codex-switch-prd-v0.1.0.md +215 -291
  58. package/docs/PRD/codex-switch-prd.md +1 -1
  59. package/docs/cli-usage.md +2 -1
  60. package/docs/codex-switch-technical-architecture.md +73 -4
  61. package/docs/test-report-0.0.5.md +163 -0
  62. package/docs/testing.md +131 -0
  63. package/package.json +1 -1
  64. /package/docs/{codex-switch-v0.0.4-design.md → Design/codex-switch-v0.0.4-design.md} +0 -0
@@ -1,210 +1,10 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.createBackup = createBackup;
37
- exports.restoreManifest = restoreManifest;
38
- exports.saveLatestManifest = saveLatestManifest;
39
- exports.loadLatestManifest = loadLatestManifest;
40
- exports.loadManifestById = loadManifestById;
41
- exports.listBackups = listBackups;
42
- const fs = __importStar(require("node:fs"));
43
- const path = __importStar(require("node:path"));
44
- const backups_1 = require("../domain/backups");
45
- const errors_1 = require("../domain/errors");
46
- const fs_utils_1 = require("./fs-utils");
47
- /**
48
- * Creates a point-in-time backup for the managed files involved in a mutation.
49
- */
50
- function createBackup(codexDir, backupsDir, reason, files) {
51
- try {
52
- const backupDir = path.join(backupsDir, `${createTimestamp()}-${reason}`);
53
- (0, fs_utils_1.ensureDir)(backupsDir);
54
- (0, fs_utils_1.ensureDir)(backupDir);
55
- const entries = [];
56
- for (const file of files) {
57
- const exists = fs.existsSync(file.absolutePath);
58
- const backupFileName = exists ? file.relativePath.replace(/[\\/]/g, "__") : null;
59
- if (exists && backupFileName) {
60
- // Flatten relative paths into a single filename inside the backup directory.
61
- fs.copyFileSync(file.absolutePath, path.join(backupDir, backupFileName));
62
- }
63
- entries.push({
64
- relativePath: file.relativePath,
65
- existed: exists,
66
- backupFileName,
67
- });
68
- }
69
- const manifest = {
70
- version: 1,
71
- createdAt: new Date().toISOString(),
72
- reason,
73
- rootDir: codexDir,
74
- backupDir,
75
- files: entries,
76
- };
77
- (0, fs_utils_1.writeTextFileAtomic)(path.join(backupDir, "manifest.json"), `${JSON.stringify(manifest, null, 2)}\n`);
78
- return manifest;
79
- }
80
- catch (error) {
81
- throw (0, errors_1.cliError)("BACKUP_FAILED", "Failed to create backup.", {
82
- cause: (0, errors_1.normalizeError)(error).message,
83
- });
84
- }
85
- }
86
- /**
87
- * Restores all files described by a backup manifest back into the Codex directory.
88
- */
89
- function restoreManifest(manifest) {
90
- for (const entry of manifest.files) {
91
- const targetPath = path.join(manifest.rootDir, entry.relativePath);
92
- if (!entry.existed) {
93
- if (fs.existsSync(targetPath)) {
94
- // Remove files that were created by the failed mutation but were absent before it.
95
- fs.rmSync(targetPath, { force: true });
96
- }
97
- continue;
98
- }
99
- if (!entry.backupFileName) {
100
- throw new Error(`Backup file for ${entry.relativePath} is missing from manifest.`);
101
- }
102
- const sourcePath = path.join(manifest.backupDir, entry.backupFileName);
103
- if (!fs.existsSync(sourcePath)) {
104
- throw new Error(`Backup file not found: ${sourcePath}`);
105
- }
106
- (0, fs_utils_1.ensureDir)(path.dirname(targetPath));
107
- fs.copyFileSync(sourcePath, targetPath);
108
- }
109
- }
110
- /**
111
- * Persists the latest successful backup manifest for manual rollback.
112
- */
113
- function saveLatestManifest(latestBackupPath, manifest) {
114
- (0, fs_utils_1.writeTextFileAtomic)(latestBackupPath, `${JSON.stringify(manifest, null, 2)}\n`);
115
- }
116
- /**
117
- * Loads and validates the latest rollback manifest file.
118
- */
119
- function loadLatestManifest(latestBackupPath) {
120
- if (!fs.existsSync(latestBackupPath)) {
121
- throw (0, errors_1.cliError)("BACKUP_NOT_FOUND", "No rollback backup is available.", {
122
- file: latestBackupPath,
123
- });
124
- }
125
- try {
126
- return (0, backups_1.validateBackupManifest)(JSON.parse(fs.readFileSync(latestBackupPath, "utf8")));
127
- }
128
- catch (error) {
129
- throw (0, errors_1.cliError)("ROLLBACK_FAILED", "Failed to read latest backup manifest.", {
130
- file: latestBackupPath,
131
- cause: (0, errors_1.normalizeError)(error).message,
132
- });
133
- }
134
- }
135
- /**
136
- * Loads a backup manifest by its explicit backup id.
137
- */
138
- function loadManifestById(backupsDir, backupId) {
139
- const manifestPath = path.join(backupsDir, backupId, "manifest.json");
140
- if (!fs.existsSync(manifestPath)) {
141
- throw (0, errors_1.cliError)("BACKUP_NOT_FOUND", `Backup "${backupId}" was not found.`, {
142
- backupId,
143
- file: manifestPath,
144
- });
145
- }
146
- try {
147
- return (0, backups_1.validateBackupManifest)(JSON.parse(fs.readFileSync(manifestPath, "utf8")));
148
- }
149
- catch (error) {
150
- throw (0, errors_1.cliError)("ROLLBACK_FAILED", `Failed to read backup manifest "${backupId}".`, {
151
- backupId,
152
- file: manifestPath,
153
- cause: (0, errors_1.normalizeError)(error).message,
154
- });
155
- }
156
- }
157
- /**
158
- * Lists valid backup manifests under backups/, newest first, while skipping corrupt entries with warnings.
159
- */
160
- function listBackups(backupsDir) {
161
- if (!fs.existsSync(backupsDir)) {
162
- throw (0, errors_1.cliError)("BACKUP_NOT_FOUND", "No backups directory exists.", {
163
- directory: backupsDir,
164
- });
165
- }
166
- const entries = fs.readdirSync(backupsDir, { withFileTypes: true });
167
- const backups = [];
168
- const warnings = [];
169
- for (const entry of entries) {
170
- if (!entry.isDirectory() || entry.name === "latest.json") {
171
- continue;
172
- }
173
- const manifestPath = path.join(backupsDir, entry.name, "manifest.json");
174
- if (!fs.existsSync(manifestPath)) {
175
- warnings.push(`Skipped backup "${entry.name}" because manifest.json is missing.`);
176
- continue;
177
- }
178
- try {
179
- backups.push((0, backups_1.toBackupListItem)((0, backups_1.validateBackupManifest)(JSON.parse(fs.readFileSync(manifestPath, "utf8")))));
180
- }
181
- catch (error) {
182
- warnings.push(`Skipped backup "${entry.name}" because manifest.json is invalid: ${(0, errors_1.normalizeError)(error).message}`);
183
- }
184
- }
185
- if (backups.length === 0) {
186
- throw (0, errors_1.cliError)("BACKUP_NOT_FOUND", "No valid backups were found.", {
187
- directory: backupsDir,
188
- });
189
- }
190
- return {
191
- backups: (0, backups_1.sortBackupList)(backups),
192
- warnings,
193
- };
194
- }
195
- /**
196
- * Formats a filesystem-safe timestamp for backup directory names.
197
- */
198
- function createTimestamp() {
199
- const now = new Date();
200
- const pad = (value) => value.toString().padStart(2, "0");
201
- return [
202
- now.getFullYear().toString(),
203
- pad(now.getMonth() + 1),
204
- pad(now.getDate()),
205
- "-",
206
- pad(now.getHours()),
207
- pad(now.getMinutes()),
208
- pad(now.getSeconds()),
209
- ].join("");
210
- }
3
+ exports.saveLatestManifest = exports.restoreManifest = exports.loadManifestById = exports.loadLatestManifest = exports.listBackups = exports.createBackup = void 0;
4
+ var backup_repo_1 = require("../storage/backup-repo");
5
+ Object.defineProperty(exports, "createBackup", { enumerable: true, get: function () { return backup_repo_1.createBackup; } });
6
+ Object.defineProperty(exports, "listBackups", { enumerable: true, get: function () { return backup_repo_1.listBackups; } });
7
+ Object.defineProperty(exports, "loadLatestManifest", { enumerable: true, get: function () { return backup_repo_1.loadLatestManifest; } });
8
+ Object.defineProperty(exports, "loadManifestById", { enumerable: true, get: function () { return backup_repo_1.loadManifestById; } });
9
+ Object.defineProperty(exports, "restoreManifest", { enumerable: true, get: function () { return backup_repo_1.restoreManifest; } });
10
+ Object.defineProperty(exports, "saveLatestManifest", { enumerable: true, get: function () { return backup_repo_1.saveLatestManifest; } });
@@ -1,115 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setCodexSpawnImplementation = setCodexSpawnImplementation;
4
- exports.resetCodexSpawnImplementation = resetCodexSpawnImplementation;
5
- exports.runCodexLogin = runCodexLogin;
6
- exports.checkCodexAvailable = checkCodexAvailable;
7
- exports.readCodexVersion = readCodexVersion;
8
- exports.checkCodexVersion = checkCodexVersion;
9
- const node_child_process_1 = require("node:child_process");
10
- const errors_1 = require("../domain/errors");
11
- let spawnImplementation = node_child_process_1.spawnSync;
12
- /**
13
- * Overrides the spawn implementation for tests.
14
- */
15
- function setCodexSpawnImplementation(spawnLike) {
16
- spawnImplementation = spawnLike;
17
- }
18
- /**
19
- * Restores the default Node spawn implementation after tests.
20
- */
21
- function resetCodexSpawnImplementation() {
22
- spawnImplementation = node_child_process_1.spawnSync;
23
- }
24
- /**
25
- * Runs `codex login --with-api-key` in the target Codex directory.
26
- */
27
- function runCodexLogin(apiKey, workingDir) {
28
- const result = spawnImplementation("codex", ["login", "--with-api-key"], {
29
- cwd: workingDir,
30
- input: `${apiKey}\n`,
31
- stdio: "pipe",
32
- encoding: "utf8",
33
- });
34
- if (result.error || result.status !== 0) {
35
- throw (0, errors_1.cliError)("CODEX_LOGIN_FAILED", "codex login --with-api-key failed.", {
36
- cause: result.error?.message ?? (result.stderr.trim() || "Unknown codex login failure"),
37
- });
38
- }
39
- }
40
- /**
41
- * Checks whether the Codex CLI is available on PATH.
42
- */
43
- function checkCodexAvailable() {
44
- const result = spawnImplementation("codex", ["--version"], {
45
- stdio: "pipe",
46
- encoding: "utf8",
47
- });
48
- if (result.error || result.status !== 0) {
49
- return {
50
- ok: false,
51
- cause: result.error?.message ?? (result.stderr.trim() || "Unknown failure"),
52
- };
53
- }
54
- return { ok: true };
55
- }
56
- /**
57
- * Reads the installed codex CLI version string.
58
- */
59
- function readCodexVersion() {
60
- const result = spawnImplementation("codex", ["--version"], {
61
- stdio: "pipe",
62
- encoding: "utf8",
63
- });
64
- if (result.error || result.status !== 0) {
65
- return {
66
- ok: false,
67
- cause: result.error?.message ?? (result.stderr.trim() || "Unknown failure"),
68
- };
69
- }
70
- const raw = `${result.stdout ?? ""} ${result.stderr ?? ""}`.trim();
71
- const match = raw.match(/(\d+\.\d+\.\d+)/);
72
- if (!match) {
73
- return {
74
- ok: false,
75
- cause: `Unable to parse codex version from output: ${raw || "(empty output)"}`,
76
- };
77
- }
78
- return { ok: true, version: match[1] };
79
- }
80
- /**
81
- * Compares the installed codex version against a minimum required version.
82
- */
83
- function checkCodexVersion(minVersion) {
84
- const current = readCodexVersion();
85
- if (!current.ok) {
86
- return {
87
- ok: false,
88
- cause: current.cause,
89
- };
90
- }
91
- if (compareVersions(current.version, minVersion) < 0) {
92
- return {
93
- ok: false,
94
- currentVersion: current.version,
95
- cause: `codex ${current.version} is below required ${minVersion}`,
96
- };
97
- }
98
- return {
99
- ok: true,
100
- currentVersion: current.version,
101
- };
102
- }
103
- function compareVersions(left, right) {
104
- const leftParts = left.split(".").map((value) => Number.parseInt(value, 10));
105
- const rightParts = right.split(".").map((value) => Number.parseInt(value, 10));
106
- const length = Math.max(leftParts.length, rightParts.length);
107
- for (let index = 0; index < length; index += 1) {
108
- const leftValue = leftParts[index] ?? 0;
109
- const rightValue = rightParts[index] ?? 0;
110
- if (leftValue !== rightValue) {
111
- return leftValue - rightValue;
112
- }
113
- }
114
- return 0;
115
- }
3
+ exports.setCodexSpawnImplementation = exports.runCodexLogin = exports.resetCodexSpawnImplementation = exports.readCodexVersion = exports.checkCodexVersion = exports.checkCodexAvailable = void 0;
4
+ var codex_cli_1 = require("../runtime/codex-cli");
5
+ Object.defineProperty(exports, "checkCodexAvailable", { enumerable: true, get: function () { return codex_cli_1.checkCodexAvailable; } });
6
+ Object.defineProperty(exports, "checkCodexVersion", { enumerable: true, get: function () { return codex_cli_1.checkCodexVersion; } });
7
+ Object.defineProperty(exports, "readCodexVersion", { enumerable: true, get: function () { return codex_cli_1.readCodexVersion; } });
8
+ Object.defineProperty(exports, "resetCodexSpawnImplementation", { enumerable: true, get: function () { return codex_cli_1.resetCodexSpawnImplementation; } });
9
+ Object.defineProperty(exports, "runCodexLogin", { enumerable: true, get: function () { return codex_cli_1.runCodexLogin; } });
10
+ Object.defineProperty(exports, "setCodexSpawnImplementation", { enumerable: true, get: function () { return codex_cli_1.setCodexSpawnImplementation; } });
@@ -1,48 +1,10 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
3
  exports.findCodexDirCandidates = findCodexDirCandidates;
37
- const fs = __importStar(require("node:fs"));
38
- const codex_paths_1 = require("./codex-paths");
4
+ const config_repo_1 = require("./config-repo");
39
5
  /**
40
- * Finds candidate Codex home directories. v0.0.4 only supports explicit and default locations.
6
+ * Finds candidate Codex home directories using the shared config-aware discovery rules.
41
7
  */
42
8
  function findCodexDirCandidates(explicitCodexDir) {
43
- if (explicitCodexDir) {
44
- return [(0, codex_paths_1.resolveCodexDir)(explicitCodexDir)];
45
- }
46
- const defaultDir = (0, codex_paths_1.resolveCodexDir)();
47
- return fs.existsSync(defaultDir) ? [defaultDir] : [];
9
+ return (0, config_repo_1.findCodexDirCandidates)(explicitCodexDir);
48
10
  }
@@ -1,71 +1,7 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.CODEX_DIR_ENV_NAME = void 0;
37
- exports.resolveCodexDir = resolveCodexDir;
38
- exports.createCodexPaths = createCodexPaths;
39
- const os = __importStar(require("node:os"));
40
- const path = __importStar(require("node:path"));
41
- exports.CODEX_DIR_ENV_NAME = "CODEXS_CODEX_DIR";
42
- const DEVELOPMENT_DEFAULT_CODEX_DIR = path.resolve(process.cwd(), "test-fixtures", "sample-codex");
43
- /**
44
- * Resolves the working Codex directory, defaulting to `~/.codex`.
45
- */
46
- function resolveCodexDir(codexDir) {
47
- if (codexDir) {
48
- return path.resolve(codexDir);
49
- }
50
- const envCodexDir = process.env[exports.CODEX_DIR_ENV_NAME];
51
- if (envCodexDir) {
52
- return path.resolve(envCodexDir);
53
- }
54
- if (process.env.NODE_ENV === "development") {
55
- return DEVELOPMENT_DEFAULT_CODEX_DIR;
56
- }
57
- return path.join(os.homedir(), ".codex");
58
- }
59
- /**
60
- * Expands a Codex home directory into the file paths used by the CLI.
61
- */
62
- function createCodexPaths(codexDir) {
63
- return {
64
- codexDir,
65
- configPath: path.join(codexDir, "config.toml"),
66
- providersPath: path.join(codexDir, "providers.json"),
67
- authPath: path.join(codexDir, "auth.json"),
68
- backupsDir: path.join(codexDir, "backups"),
69
- latestBackupPath: path.join(codexDir, "backups", "latest.json"),
70
- };
71
- }
3
+ exports.resolveCodexDir = exports.createCodexPaths = exports.CODEX_DIR_ENV_NAME = void 0;
4
+ var codex_paths_1 = require("../storage/codex-paths");
5
+ Object.defineProperty(exports, "CODEX_DIR_ENV_NAME", { enumerable: true, get: function () { return codex_paths_1.CODEX_DIR_ENV_NAME; } });
6
+ Object.defineProperty(exports, "createCodexPaths", { enumerable: true, get: function () { return codex_paths_1.createCodexPaths; } });
7
+ Object.defineProperty(exports, "resolveCodexDir", { enumerable: true, get: function () { return codex_paths_1.resolveCodexDir; } });