retell-sync-cli 1.0.0 → 1.0.1

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 (2) hide show
  1. package/dist/cli.js +27 -12
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -134695,21 +134695,36 @@ Warning: ${regressions.length} agent(s) would have their version regressed:`));
134695
134695
  targetBranch = stdout.toString().trim();
134696
134696
  }
134697
134697
  spinner = createSpinner(`Merging ${branch} into ${targetBranch}...`);
134698
- const {
134699
- exitCode,
134700
- stdout: mergeOut,
134701
- stderr
134702
- } = await $11`git merge ${branch} --allow-unrelated-histories --no-edit -m "Merge ${branch}"`.nothrow().quiet();
134703
- if (exitCode === 0) {
134704
- const alreadyUpToDate = mergeOut.toString().includes("Already up to date");
134705
- if (alreadyUpToDate) {
134698
+ const { stdout: srcStdout } = await $11`git rev-parse refs/heads/${branch}`.quiet();
134699
+ const srcSha = srcStdout.toString().trim();
134700
+ const { stdout: targetStdout, exitCode: targetExitCode } = await $11`git rev-parse refs/heads/${targetBranch} 2>/dev/null`.nothrow().quiet();
134701
+ if (targetExitCode !== 0) {
134702
+ await $11`git update-ref refs/heads/${targetBranch} ${srcSha}`.quiet();
134703
+ spinner.stop(source_default.green(`Created ${source_default.bold(targetBranch)} from ${source_default.bold(branch)}`));
134704
+ } else {
134705
+ const targetSha = targetStdout.toString().trim();
134706
+ if (srcSha === targetSha) {
134706
134707
  spinner.stop(source_default.dim(`Already up to date`));
134707
134708
  } else {
134708
- spinner.stop(source_default.green(`Merged ${source_default.bold(branch)} into ${source_default.bold(targetBranch)}`));
134709
+ const { exitCode: isAncestor } = await $11`git merge-base --is-ancestor ${targetSha} ${srcSha}`.nothrow().quiet();
134710
+ if (isAncestor === 0) {
134711
+ await $11`git update-ref refs/heads/${targetBranch} ${srcSha}`.quiet();
134712
+ spinner.stop(source_default.green(`Fast-forwarded ${source_default.bold(targetBranch)} to ${source_default.bold(branch)}`));
134713
+ } else {
134714
+ const { stdout: mergeTreeOut, exitCode: mergeTreeExit } = await $11`git merge-tree --write-tree ${targetSha} ${srcSha}`.nothrow().quiet();
134715
+ if (mergeTreeExit !== 0) {
134716
+ spinner.stop(source_default.red(`Merge conflict`));
134717
+ console.error(source_default.red(`Cannot auto-merge ${branch} into ${targetBranch}. Resolve conflicts manually.`));
134718
+ } else {
134719
+ const mergedTreeSha = mergeTreeOut.toString().trim();
134720
+ const message = `Merge ${branch} into ${targetBranch}`;
134721
+ const { stdout: commitOut } = await $11`git commit-tree ${mergedTreeSha} -p ${targetSha} -p ${srcSha} -m ${message}`.quiet();
134722
+ const mergeCommitSha = commitOut.toString().trim();
134723
+ await $11`git update-ref refs/heads/${targetBranch} ${mergeCommitSha}`.quiet();
134724
+ spinner.stop(source_default.green(`Merged ${source_default.bold(branch)} into ${source_default.bold(targetBranch)}`));
134725
+ }
134726
+ }
134709
134727
  }
134710
- } else {
134711
- spinner.stop(source_default.red(`Merge failed`));
134712
- console.error(source_default.red(stderr.toString()));
134713
134728
  }
134714
134729
  }
134715
134730
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "retell-sync-cli",
3
3
  "author": "zachsents",
4
- "version": "1.0.0",
4
+ "version": "1.0.1",
5
5
  "description": "CLI tool for syncing Retell AI agents between local filesystem and API",
6
6
  "type": "module",
7
7
  "main": "cli.ts",