staklink 0.3.87 → 0.3.88

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.
@@ -60836,6 +60836,12 @@ var Repo = class {
60836
60836
  const { stdout, stderr } = await exec4(command, execOpts);
60837
60837
  return stdout || stderr;
60838
60838
  } catch (error87) {
60839
+ const execError = error87;
60840
+ if (execError.killed && execError.signal === "SIGTERM") {
60841
+ error(`=> Command timed out after ${execOpts.timeout}ms: ${command}`);
60842
+ } else {
60843
+ error(`=> Command failed: ${command}`, execError.stderr || error87);
60844
+ }
60839
60845
  throw error87;
60840
60846
  }
60841
60847
  });
@@ -60938,13 +60944,21 @@ var Repo = class {
60938
60944
  return this.execCommand(`git commit -m "${sanitized}"`);
60939
60945
  }
60940
60946
  async push(branch = "master") {
60941
- return this.execCommand(`git push origin ${branch}`);
60947
+ log(`=> Executing: git push origin ${branch}`);
60948
+ try {
60949
+ const result = await this.execCommand(`git push origin ${branch}`, { timeout: 6e4 });
60950
+ log(`=> Push result: ${result}`);
60951
+ return result;
60952
+ } catch (error87) {
60953
+ error(`=> Push failed:`, error87);
60954
+ throw error87;
60955
+ }
60942
60956
  }
60943
60957
  async pull(branch = "master") {
60944
- return this.execCommand(`git pull origin ${branch}`);
60958
+ return this.execCommand(`git pull origin ${branch}`, { timeout: 6e4 });
60945
60959
  }
60946
60960
  async fetchLatest() {
60947
- return this.execCommand("git fetch origin");
60961
+ return this.execCommand("git fetch origin", { timeout: 6e4 });
60948
60962
  }
60949
60963
  // Enhanced fetch method that accepts user credentials
60950
60964
  async fetchLatestWithCredentials(credentials) {
@@ -61055,6 +61069,7 @@ var Repo = class {
61055
61069
  }
61056
61070
  async setUserCredentials(credentials) {
61057
61071
  this.originalRemoteUrl = await this.getRemoteUrl();
61072
+ log(`=> setUserCredentials: originalRemoteUrl=${this.originalRemoteUrl}`);
61058
61073
  let authenticatedUrl;
61059
61074
  switch (credentials.provider) {
61060
61075
  case "github":
@@ -61065,6 +61080,11 @@ var Repo = class {
61065
61080
  /https:\/\/.*@github\.com\//,
61066
61081
  `https://${credentials.auth_data.token}@github.com/`
61067
61082
  );
61083
+ if (authenticatedUrl.startsWith("git@github.com:")) {
61084
+ const repoPath = authenticatedUrl.replace("git@github.com:", "").replace(/\.git$/, "");
61085
+ authenticatedUrl = `https://${credentials.auth_data.token}@github.com/${repoPath}.git`;
61086
+ log(`=> Converted SSH URL to HTTPS`);
61087
+ }
61068
61088
  break;
61069
61089
  case "gitlab":
61070
61090
  authenticatedUrl = this.originalRemoteUrl.replace(
@@ -61074,6 +61094,11 @@ var Repo = class {
61074
61094
  /https:\/\/.*@gitlab\.com\//,
61075
61095
  `https://oauth2:${credentials.auth_data.token}@gitlab.com/`
61076
61096
  );
61097
+ if (authenticatedUrl.startsWith("git@gitlab.com:")) {
61098
+ const repoPath = authenticatedUrl.replace("git@gitlab.com:", "").replace(/\.git$/, "");
61099
+ authenticatedUrl = `https://oauth2:${credentials.auth_data.token}@gitlab.com/${repoPath}.git`;
61100
+ log(`=> Converted SSH URL to HTTPS`);
61101
+ }
61077
61102
  break;
61078
61103
  case "bitbucket":
61079
61104
  authenticatedUrl = this.originalRemoteUrl.replace(
@@ -61083,10 +61108,17 @@ var Repo = class {
61083
61108
  /https:\/\/.*@bitbucket\.org\//,
61084
61109
  `https://${credentials.auth_data.username}:${credentials.auth_data.token}@bitbucket.org/`
61085
61110
  );
61111
+ if (authenticatedUrl.startsWith("git@bitbucket.org:")) {
61112
+ const repoPath = authenticatedUrl.replace("git@bitbucket.org:", "").replace(/\.git$/, "");
61113
+ authenticatedUrl = `https://${credentials.auth_data.username}:${credentials.auth_data.token}@bitbucket.org/${repoPath}.git`;
61114
+ log(`=> Converted SSH URL to HTTPS`);
61115
+ }
61086
61116
  break;
61087
61117
  default:
61088
61118
  throw new Error(`Unsupported provider: ${credentials.provider}`);
61089
61119
  }
61120
+ const maskedUrl = authenticatedUrl.replace(/\/\/[^@]+@/, "//***@");
61121
+ log(`=> setUserCredentials: setting remote URL to ${maskedUrl}`);
61090
61122
  await this.setRemoteUrl(authenticatedUrl);
61091
61123
  await this.setUserConfig(credentials);
61092
61124
  }
@@ -61102,14 +61134,18 @@ var Repo = class {
61102
61134
  // by pulling with rebase and pushing again
61103
61135
  async pushCurrentBranchWithCredentials(credentials) {
61104
61136
  const currentBranch = (await this.printCurrentBranch()).trim();
61137
+ log(`=> pushCurrentBranchWithCredentials: branch=${currentBranch}, hasCredentials=${!!credentials}`);
61105
61138
  try {
61106
61139
  if (credentials) {
61107
61140
  await this.setUserCredentials(credentials);
61141
+ log(`=> Credentials set for push`);
61108
61142
  }
61109
61143
  try {
61110
61144
  const result = await this.push(currentBranch);
61145
+ log(`=> pushCurrentBranchWithCredentials succeeded`);
61111
61146
  return result;
61112
61147
  } catch (pushError) {
61148
+ error(`=> pushCurrentBranchWithCredentials caught error:`, pushError);
61113
61149
  const errorMessage = pushError instanceof Error ? pushError.message : String(pushError);
61114
61150
  const isRejectedDueToRemoteChanges = errorMessage.includes("[rejected]") || errorMessage.includes("non-fast-forward") || errorMessage.includes("Updates were rejected");
61115
61151
  if (isRejectedDueToRemoteChanges) {
@@ -61213,7 +61249,7 @@ var SSEManager = class {
61213
61249
  var sseManager = new SSEManager();
61214
61250
 
61215
61251
  // src/proxy/version.ts
61216
- var VERSION = "0.3.87";
61252
+ var VERSION = "0.3.88";
61217
61253
 
61218
61254
  // node_modules/uuid/dist/esm/stringify.js
61219
61255
  var byteToHex = [];
@@ -10967,7 +10967,7 @@ var glob = Object.assign(glob_, {
10967
10967
  glob.glob = glob;
10968
10968
 
10969
10969
  // src/proxy/version.ts
10970
- var VERSION = "0.3.87";
10970
+ var VERSION = "0.3.88";
10971
10971
 
10972
10972
  // src/goose.ts
10973
10973
  var import_child_process = require("child_process");
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "staklink",
3
3
  "displayName": "staklink",
4
4
  "description": "staklink process manager",
5
- "version": "0.3.87",
5
+ "version": "0.3.88",
6
6
  "type": "module",
7
7
  "publisher": "stakwork",
8
8
  "engines": {