@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.cjs
CHANGED
|
@@ -1911,8 +1911,8 @@ function syncCommand() {
|
|
|
1911
1911
|
};
|
|
1912
1912
|
let plan;
|
|
1913
1913
|
let routingScan;
|
|
1914
|
+
let codexRepoPath;
|
|
1914
1915
|
if (direction === "from-codex") {
|
|
1915
|
-
let codexRepoPath;
|
|
1916
1916
|
try {
|
|
1917
1917
|
const { ensureCodexCloned: ensureCodexCloned2 } = await Promise.resolve().then(() => (init_codex_repository(), codex_repository_exports));
|
|
1918
1918
|
if (!options.json) {
|
|
@@ -1966,14 +1966,32 @@ function syncCommand() {
|
|
|
1966
1966
|
plan = planWithRouting;
|
|
1967
1967
|
routingScan = planWithRouting.routingScan;
|
|
1968
1968
|
} else {
|
|
1969
|
+
try {
|
|
1970
|
+
const { ensureCodexCloned: ensureCodexCloned2 } = await Promise.resolve().then(() => (init_codex_repository(), codex_repository_exports));
|
|
1971
|
+
if (!options.json) {
|
|
1972
|
+
console.log(chalk7__default.default.blue("\u2139 Cloning/updating codex repository..."));
|
|
1973
|
+
}
|
|
1974
|
+
codexRepoPath = await ensureCodexCloned2(config, {
|
|
1975
|
+
branch: targetBranch
|
|
1976
|
+
});
|
|
1977
|
+
if (!options.json) {
|
|
1978
|
+
console.log(chalk7__default.default.dim(` Codex cloned to: ${codexRepoPath}`));
|
|
1979
|
+
}
|
|
1980
|
+
} catch (error) {
|
|
1981
|
+
console.error(chalk7__default.default.red("Error:"), "Failed to clone codex repository");
|
|
1982
|
+
console.error(chalk7__default.default.dim(` ${error.message}`));
|
|
1983
|
+
process.exit(1);
|
|
1984
|
+
}
|
|
1969
1985
|
plan = await syncManager.createPlan(
|
|
1970
1986
|
config.organization,
|
|
1971
1987
|
projectName,
|
|
1972
1988
|
sourceDir,
|
|
1973
1989
|
[],
|
|
1974
|
-
// Empty target -
|
|
1990
|
+
// Empty target - treat all files as creates
|
|
1975
1991
|
syncOptions
|
|
1976
1992
|
);
|
|
1993
|
+
plan.source = sourceDir;
|
|
1994
|
+
plan.target = path4__namespace.join(codexRepoPath, config.organization, projectName);
|
|
1977
1995
|
}
|
|
1978
1996
|
if (plan.totalFiles === 0) {
|
|
1979
1997
|
if (options.json) {
|
|
@@ -2091,6 +2109,25 @@ Total: ${plan.totalFiles} files (${formatBytes(plan.totalBytes)})`));
|
|
|
2091
2109
|
const startTime = Date.now();
|
|
2092
2110
|
const result = await syncManager.executePlan(plan, syncOptions);
|
|
2093
2111
|
const duration = Date.now() - startTime;
|
|
2112
|
+
if (direction === "to-codex" && codexRepoPath && result.synced > 0) {
|
|
2113
|
+
try {
|
|
2114
|
+
if (!options.json) {
|
|
2115
|
+
console.log(chalk7__default.default.blue("Committing and pushing to codex..."));
|
|
2116
|
+
}
|
|
2117
|
+
const { RepoManager } = await import('@fractary/core/repo');
|
|
2118
|
+
const repoManager = new RepoManager({}, codexRepoPath);
|
|
2119
|
+
await repoManager.stageAll();
|
|
2120
|
+
await repoManager.commit({
|
|
2121
|
+
message: `Sync ${result.synced} files from ${projectName}`
|
|
2122
|
+
});
|
|
2123
|
+
await repoManager.push({});
|
|
2124
|
+
if (!options.json) {
|
|
2125
|
+
console.log(chalk7__default.default.dim(" Changes pushed to codex repository"));
|
|
2126
|
+
}
|
|
2127
|
+
} catch (error) {
|
|
2128
|
+
console.error(chalk7__default.default.red("Error pushing to codex:"), error.message);
|
|
2129
|
+
}
|
|
2130
|
+
}
|
|
2094
2131
|
console.log("");
|
|
2095
2132
|
if (result.success) {
|
|
2096
2133
|
console.log(chalk7__default.default.green(`\u2713 Sync completed successfully`));
|