codemodctl 0.1.35 → 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 -18
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -118,39 +118,34 @@ const createPrCommand = defineCommand({
118
118
  process.exit(1);
119
119
  }
120
120
  {
121
- const headSha = await $`git rev-parse HEAD`;
122
- const branchInfo = await $`git log --oneline -1`;
123
- console.log(`Pushing HEAD=${headSha.stdout.trim()} (${branchInfo.stdout.trim()}) to refs/heads/${codemodBranchName}`);
124
- const lsRemote = await $({ reject: false })`git -c http.version=HTTP/1.1 ls-remote origin refs/heads/${codemodBranchName}`;
125
- console.log(`Remote ref: ${lsRemote.stdout.trim() || "(branch does not exist)"}`);
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}`);
126
124
  const maxRetries = 3;
127
125
  let pushed = false;
128
126
  for (let attempt = 1; attempt <= maxRetries; attempt++) {
129
127
  const pushResult = await $({
130
- env: process.env.DEBUG ? {
131
- GIT_TRACE: "1",
132
- GIT_CURL_VERBOSE: "1"
133
- } : {},
128
+ env: { GIT_TRACE_PACKET: "1" },
134
129
  reject: false
135
- })`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)}`);
136
133
  if (pushResult.exitCode === 0) {
137
134
  pushed = true;
138
135
  break;
139
136
  }
140
- if (pushResult.stderr?.includes("Everything up-to-date")) {
141
- console.log("Branch already up-to-date on remote.");
142
- pushed = true;
143
- break;
144
- }
145
- 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})`);
146
138
  if (attempt < maxRetries) {
147
139
  const delay = attempt * 2e3;
148
140
  console.log(`Retrying in ${delay / 1e3}s...`);
149
141
  await new Promise((r) => setTimeout(r, delay));
150
142
  }
151
143
  }
152
- if (!pushed) {
153
- 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.");
154
149
  process.exit(1);
155
150
  }
156
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.35",
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": {