codemodctl 0.1.34 → 0.1.36

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 +13 -13
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -118,34 +118,34 @@ const createPrCommand = defineCommand({
118
118
  process.exit(1);
119
119
  }
120
120
  {
121
+ const localHead = (await $`git rev-parse HEAD`).stdout.trim();
122
+ const currentBranch = (await $`git rev-parse --abbrev-ref HEAD`).stdout.trim();
123
+ console.log(`Pushing branch=${currentBranch} sha=${localHead} to origin/${codemodBranchName}`);
121
124
  const maxRetries = 3;
122
125
  let pushed = false;
123
126
  for (let attempt = 1; attempt <= maxRetries; attempt++) {
124
127
  const pushResult = await $({
125
- env: process.env.DEBUG ? {
126
- GIT_TRACE: "1",
127
- GIT_CURL_VERBOSE: "1"
128
- } : {},
128
+ env: { GIT_TRACE_PACKET: "1" },
129
129
  reject: false
130
- })`git -c http.version=HTTP/1.1 -c http.postBuffer=524288000 push origin HEAD:refs/heads/${codemodBranchName} --force`;
130
+ })`git -c http.version=HTTP/1.1 -c http.postBuffer=524288000 push --verbose origin ${codemodBranchName} --force`;
131
+ console.log(`Push stdout: ${pushResult.stdout}`);
132
+ console.error(`Push stderr (last 2000 chars): ${pushResult.stderr.slice(-2e3)}`);
131
133
  if (pushResult.exitCode === 0) {
132
134
  pushed = true;
133
135
  break;
134
136
  }
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}`);
137
+ console.error(`Push attempt ${attempt}/${maxRetries} failed (exit code ${pushResult.exitCode})`);
141
138
  if (attempt < maxRetries) {
142
139
  const delay = attempt * 2e3;
143
140
  console.log(`Retrying in ${delay / 1e3}s...`);
144
141
  await new Promise((r) => setTimeout(r, delay));
145
142
  }
146
143
  }
147
- if (!pushed) {
148
- console.error("Error: Failed to push changes after all retries");
144
+ if (!pushed) if ((await $({ reject: false })`git -c http.version=HTTP/1.1 ls-remote --exit-code origin refs/heads/${codemodBranchName}`).exitCode === 0) {
145
+ console.log("Push reported failure but branch exists on remote — continuing.");
146
+ pushed = true;
147
+ } else {
148
+ console.error("Error: Failed to push changes and branch does not exist on remote.");
149
149
  process.exit(1);
150
150
  }
151
151
  console.log(`Pushed branch to origin: ${codemodBranchName}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codemodctl",
3
- "version": "0.1.34",
3
+ "version": "0.1.36",
4
4
  "description": "CLI tool and utilities for workflow engine operations, file sharding, and codeowner analysis",
5
5
  "type": "module",
6
6
  "exports": {