codemodctl 0.1.33 → 0.1.34

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.mjs +31 -12
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -117,19 +117,38 @@ const createPrCommand = defineCommand({
117
117
  console.error(error);
118
118
  process.exit(1);
119
119
  }
120
- try {
121
- await $({ env: {
122
- GIT_CURL_VERBOSE: "1",
123
- ...process.env.DEBUG ? {
124
- GIT_TRACE: "1",
125
- GIT_TRACE_PACKET: "1"
126
- } : {}
127
- } })`git -c http.version=HTTP/1.1 -c http.postBuffer=524288000 push origin HEAD:refs/heads/${codemodBranchName} --force --no-thin`;
120
+ {
121
+ const maxRetries = 3;
122
+ let pushed = false;
123
+ for (let attempt = 1; attempt <= maxRetries; attempt++) {
124
+ const pushResult = await $({
125
+ env: process.env.DEBUG ? {
126
+ GIT_TRACE: "1",
127
+ GIT_CURL_VERBOSE: "1"
128
+ } : {},
129
+ reject: false
130
+ })`git -c http.version=HTTP/1.1 -c http.postBuffer=524288000 push origin HEAD:refs/heads/${codemodBranchName} --force`;
131
+ if (pushResult.exitCode === 0) {
132
+ pushed = true;
133
+ break;
134
+ }
135
+ if (pushResult.stderr?.includes("Everything up-to-date")) {
136
+ console.log("Branch already up-to-date on remote.");
137
+ pushed = true;
138
+ break;
139
+ }
140
+ console.error(`Push attempt ${attempt}/${maxRetries} failed (exit code ${pushResult.exitCode}):\n${pushResult.stderr}`);
141
+ if (attempt < maxRetries) {
142
+ const delay = attempt * 2e3;
143
+ console.log(`Retrying in ${delay / 1e3}s...`);
144
+ await new Promise((r) => setTimeout(r, delay));
145
+ }
146
+ }
147
+ if (!pushed) {
148
+ console.error("Error: Failed to push changes after all retries");
149
+ process.exit(1);
150
+ }
128
151
  console.log(`Pushed branch to origin: ${codemodBranchName}`);
129
- } catch (error) {
130
- console.error("Error: Failed to push changes");
131
- console.error(error);
132
- process.exit(1);
133
152
  }
134
153
  }
135
154
  if (body) prData.body = body;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codemodctl",
3
- "version": "0.1.33",
3
+ "version": "0.1.34",
4
4
  "description": "CLI tool and utilities for workflow engine operations, file sharding, and codeowner analysis",
5
5
  "type": "module",
6
6
  "exports": {