@fractary/codex-cli 0.10.4 → 0.10.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.
- package/dist/cli.cjs +39 -2
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +39 -2
- package/dist/cli.js.map +1 -1
- package/package.json +2 -1
package/dist/cli.js
CHANGED
|
@@ -1878,8 +1878,8 @@ function syncCommand() {
|
|
|
1878
1878
|
};
|
|
1879
1879
|
let plan;
|
|
1880
1880
|
let routingScan;
|
|
1881
|
+
let codexRepoPath;
|
|
1881
1882
|
if (direction === "from-codex") {
|
|
1882
|
-
let codexRepoPath;
|
|
1883
1883
|
try {
|
|
1884
1884
|
const { ensureCodexCloned: ensureCodexCloned2 } = await Promise.resolve().then(() => (init_codex_repository(), codex_repository_exports));
|
|
1885
1885
|
if (!options.json) {
|
|
@@ -1933,14 +1933,32 @@ function syncCommand() {
|
|
|
1933
1933
|
plan = planWithRouting;
|
|
1934
1934
|
routingScan = planWithRouting.routingScan;
|
|
1935
1935
|
} else {
|
|
1936
|
+
try {
|
|
1937
|
+
const { ensureCodexCloned: ensureCodexCloned2 } = await Promise.resolve().then(() => (init_codex_repository(), codex_repository_exports));
|
|
1938
|
+
if (!options.json) {
|
|
1939
|
+
console.log(chalk7.blue("\u2139 Cloning/updating codex repository..."));
|
|
1940
|
+
}
|
|
1941
|
+
codexRepoPath = await ensureCodexCloned2(config, {
|
|
1942
|
+
branch: targetBranch
|
|
1943
|
+
});
|
|
1944
|
+
if (!options.json) {
|
|
1945
|
+
console.log(chalk7.dim(` Codex cloned to: ${codexRepoPath}`));
|
|
1946
|
+
}
|
|
1947
|
+
} catch (error) {
|
|
1948
|
+
console.error(chalk7.red("Error:"), "Failed to clone codex repository");
|
|
1949
|
+
console.error(chalk7.dim(` ${error.message}`));
|
|
1950
|
+
process.exit(1);
|
|
1951
|
+
}
|
|
1936
1952
|
plan = await syncManager.createPlan(
|
|
1937
1953
|
config.organization,
|
|
1938
1954
|
projectName,
|
|
1939
1955
|
sourceDir,
|
|
1940
1956
|
[],
|
|
1941
|
-
// Empty target -
|
|
1957
|
+
// Empty target - treat all files as creates
|
|
1942
1958
|
syncOptions
|
|
1943
1959
|
);
|
|
1960
|
+
plan.source = sourceDir;
|
|
1961
|
+
plan.target = path5.join(codexRepoPath, config.organization, projectName);
|
|
1944
1962
|
}
|
|
1945
1963
|
if (plan.totalFiles === 0) {
|
|
1946
1964
|
if (options.json) {
|
|
@@ -2058,6 +2076,25 @@ Total: ${plan.totalFiles} files (${formatBytes(plan.totalBytes)})`));
|
|
|
2058
2076
|
const startTime = Date.now();
|
|
2059
2077
|
const result = await syncManager.executePlan(plan, syncOptions);
|
|
2060
2078
|
const duration = Date.now() - startTime;
|
|
2079
|
+
if (direction === "to-codex" && codexRepoPath && result.synced > 0) {
|
|
2080
|
+
try {
|
|
2081
|
+
if (!options.json) {
|
|
2082
|
+
console.log(chalk7.blue("Committing and pushing to codex..."));
|
|
2083
|
+
}
|
|
2084
|
+
const { RepoManager } = await import('@fractary/core/repo');
|
|
2085
|
+
const repoManager = new RepoManager({}, codexRepoPath);
|
|
2086
|
+
await repoManager.stageAll();
|
|
2087
|
+
await repoManager.commit({
|
|
2088
|
+
message: `Sync ${result.synced} files from ${projectName}`
|
|
2089
|
+
});
|
|
2090
|
+
await repoManager.push({});
|
|
2091
|
+
if (!options.json) {
|
|
2092
|
+
console.log(chalk7.dim(" Changes pushed to codex repository"));
|
|
2093
|
+
}
|
|
2094
|
+
} catch (error) {
|
|
2095
|
+
console.error(chalk7.red("Error pushing to codex:"), error.message);
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2061
2098
|
console.log("");
|
|
2062
2099
|
if (result.success) {
|
|
2063
2100
|
console.log(chalk7.green(`\u2713 Sync completed successfully`));
|