@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.cjs CHANGED
@@ -1798,7 +1798,7 @@ function formatDuration(ms) {
1798
1798
  }
1799
1799
  function syncCommand() {
1800
1800
  const cmd = new commander.Command("sync");
1801
- 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) => {
1801
+ 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) => {
1802
1802
  try {
1803
1803
  const configPath = path4__namespace.join(process.cwd(), ".fractary", "config.yaml");
1804
1804
  let config;
@@ -1982,8 +1982,11 @@ function syncCommand() {
1982
1982
  console.log(JSON.stringify({
1983
1983
  project: projectName,
1984
1984
  organization: config.organization,
1985
+ workId: options.workId || null,
1985
1986
  files: [],
1986
- synced: 0
1987
+ synced: 0,
1988
+ status: "success",
1989
+ message: "No files to sync"
1987
1990
  }, null, 2));
1988
1991
  } else {
1989
1992
  console.log(chalk7__default.default.yellow("No files to sync."));
@@ -1998,6 +2001,7 @@ function syncCommand() {
1998
2001
  branch: targetBranch,
1999
2002
  direction,
2000
2003
  dryRun: options.dryRun || false,
2004
+ workId: options.workId || null,
2001
2005
  plan: {
2002
2006
  totalFiles: plan.totalFiles,
2003
2007
  totalBytes: plan.totalBytes,
@@ -2012,12 +2016,24 @@ function syncCommand() {
2012
2016
  }))
2013
2017
  };
2014
2018
  if (options.dryRun) {
2015
- console.log(JSON.stringify(output, null, 2));
2019
+ console.log(JSON.stringify({
2020
+ ...output,
2021
+ status: "success"
2022
+ }, null, 2));
2016
2023
  return;
2017
2024
  }
2018
2025
  const result2 = await syncManager.executePlan(plan, syncOptions);
2026
+ let status;
2027
+ if (!result2.success && result2.synced === 0) {
2028
+ status = "failure";
2029
+ } else if (!result2.success || result2.failed > 0 || plan.conflicts.length > 0) {
2030
+ status = "warning";
2031
+ } else {
2032
+ status = "success";
2033
+ }
2019
2034
  console.log(JSON.stringify({
2020
2035
  ...output,
2036
+ status,
2021
2037
  result: {
2022
2038
  success: result2.success,
2023
2039
  synced: result2.synced,