@fractary/codex-cli 0.10.14 → 0.10.15

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
@@ -1765,7 +1765,7 @@ function formatDuration(ms) {
1765
1765
  }
1766
1766
  function syncCommand() {
1767
1767
  const cmd = new Command("sync");
1768
- 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) => {
1768
+ 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").option("--work-id <id>", "GitHub issue number or URL to scope sync to").action(async (name, options) => {
1769
1769
  try {
1770
1770
  const configPath = path5.join(process.cwd(), ".fractary", "config.yaml");
1771
1771
  let config;
@@ -1949,8 +1949,11 @@ function syncCommand() {
1949
1949
  console.log(JSON.stringify({
1950
1950
  project: projectName,
1951
1951
  organization: config.organization,
1952
+ workId: options.workId || null,
1952
1953
  files: [],
1953
- synced: 0
1954
+ synced: 0,
1955
+ status: "success",
1956
+ message: "No files to sync"
1954
1957
  }, null, 2));
1955
1958
  } else {
1956
1959
  console.log(chalk7.yellow("No files to sync."));
@@ -1965,6 +1968,7 @@ function syncCommand() {
1965
1968
  branch: targetBranch,
1966
1969
  direction,
1967
1970
  dryRun: options.dryRun || false,
1971
+ workId: options.workId || null,
1968
1972
  plan: {
1969
1973
  totalFiles: plan.totalFiles,
1970
1974
  totalBytes: plan.totalBytes,
@@ -1979,12 +1983,24 @@ function syncCommand() {
1979
1983
  }))
1980
1984
  };
1981
1985
  if (options.dryRun) {
1982
- console.log(JSON.stringify(output, null, 2));
1986
+ console.log(JSON.stringify({
1987
+ ...output,
1988
+ status: "success"
1989
+ }, null, 2));
1983
1990
  return;
1984
1991
  }
1985
1992
  const result2 = await syncManager.executePlan(plan, syncOptions);
1993
+ let status;
1994
+ if (!result2.success && result2.synced === 0) {
1995
+ status = "failure";
1996
+ } else if (!result2.success || result2.failed > 0 || plan.conflicts.length > 0) {
1997
+ status = "warning";
1998
+ } else {
1999
+ status = "success";
2000
+ }
1986
2001
  console.log(JSON.stringify({
1987
2002
  ...output,
2003
+ status,
1988
2004
  result: {
1989
2005
  success: result2.success,
1990
2006
  synced: result2.synced,