staklink 0.3.87 → 0.3.89

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.
@@ -60834,8 +60834,17 @@ var Repo = class {
60834
60834
  };
60835
60835
  try {
60836
60836
  const { stdout, stderr } = await exec4(command, execOpts);
60837
- return stdout || stderr;
60837
+ if (stdout && stdout.trim()) {
60838
+ return stdout;
60839
+ }
60840
+ return stderr || "";
60838
60841
  } catch (error87) {
60842
+ const execError = error87;
60843
+ if (execError.killed && execError.signal === "SIGTERM") {
60844
+ error(`=> Command timed out after ${execOpts.timeout}ms: ${command}`);
60845
+ } else {
60846
+ error(`=> Command failed: ${command}`, execError.stderr || error87);
60847
+ }
60839
60848
  throw error87;
60840
60849
  }
60841
60850
  });
@@ -60923,10 +60932,16 @@ var Repo = class {
60923
60932
  return branchName;
60924
60933
  }
60925
60934
  async checkout(branch) {
60926
- return this.execCommand(`git checkout ${branch}`);
60935
+ log(`=> git checkout ${branch}`);
60936
+ const result = await this.execCommand(`git checkout ${branch}`);
60937
+ log(`=> checkout result: ${result.trim()}`);
60938
+ return result;
60927
60939
  }
60928
60940
  async checkoutNew(branch) {
60929
- return this.execCommand(`git checkout -b ${branch}`);
60941
+ log(`=> git checkout -b ${branch}`);
60942
+ const result = await this.execCommand(`git checkout -b ${branch}`);
60943
+ log(`=> checkoutNew result: ${result.trim()}`);
60944
+ return result;
60930
60945
  }
60931
60946
  async addAll() {
60932
60947
  log("addAll in", this.cwd);
@@ -60938,13 +60953,21 @@ var Repo = class {
60938
60953
  return this.execCommand(`git commit -m "${sanitized}"`);
60939
60954
  }
60940
60955
  async push(branch = "master") {
60941
- return this.execCommand(`git push origin ${branch}`);
60956
+ log(`=> Executing: git push origin ${branch}`);
60957
+ try {
60958
+ const result = await this.execCommand(`git push origin ${branch}`, { timeout: 6e4 });
60959
+ log(`=> Push result: ${result}`);
60960
+ return result;
60961
+ } catch (error87) {
60962
+ error(`=> Push failed:`, error87);
60963
+ throw error87;
60964
+ }
60942
60965
  }
60943
60966
  async pull(branch = "master") {
60944
- return this.execCommand(`git pull origin ${branch}`);
60967
+ return this.execCommand(`git pull origin ${branch}`, { timeout: 6e4 });
60945
60968
  }
60946
60969
  async fetchLatest() {
60947
- return this.execCommand("git fetch origin");
60970
+ return this.execCommand("git fetch origin", { timeout: 6e4 });
60948
60971
  }
60949
60972
  // Enhanced fetch method that accepts user credentials
60950
60973
  async fetchLatestWithCredentials(credentials) {
@@ -61055,6 +61078,7 @@ var Repo = class {
61055
61078
  }
61056
61079
  async setUserCredentials(credentials) {
61057
61080
  this.originalRemoteUrl = await this.getRemoteUrl();
61081
+ log(`=> setUserCredentials: originalRemoteUrl=${this.originalRemoteUrl}`);
61058
61082
  let authenticatedUrl;
61059
61083
  switch (credentials.provider) {
61060
61084
  case "github":
@@ -61065,6 +61089,11 @@ var Repo = class {
61065
61089
  /https:\/\/.*@github\.com\//,
61066
61090
  `https://${credentials.auth_data.token}@github.com/`
61067
61091
  );
61092
+ if (authenticatedUrl.startsWith("git@github.com:")) {
61093
+ const repoPath = authenticatedUrl.replace("git@github.com:", "").replace(/\.git$/, "");
61094
+ authenticatedUrl = `https://${credentials.auth_data.token}@github.com/${repoPath}.git`;
61095
+ log(`=> Converted SSH URL to HTTPS`);
61096
+ }
61068
61097
  break;
61069
61098
  case "gitlab":
61070
61099
  authenticatedUrl = this.originalRemoteUrl.replace(
@@ -61074,6 +61103,11 @@ var Repo = class {
61074
61103
  /https:\/\/.*@gitlab\.com\//,
61075
61104
  `https://oauth2:${credentials.auth_data.token}@gitlab.com/`
61076
61105
  );
61106
+ if (authenticatedUrl.startsWith("git@gitlab.com:")) {
61107
+ const repoPath = authenticatedUrl.replace("git@gitlab.com:", "").replace(/\.git$/, "");
61108
+ authenticatedUrl = `https://oauth2:${credentials.auth_data.token}@gitlab.com/${repoPath}.git`;
61109
+ log(`=> Converted SSH URL to HTTPS`);
61110
+ }
61077
61111
  break;
61078
61112
  case "bitbucket":
61079
61113
  authenticatedUrl = this.originalRemoteUrl.replace(
@@ -61083,10 +61117,17 @@ var Repo = class {
61083
61117
  /https:\/\/.*@bitbucket\.org\//,
61084
61118
  `https://${credentials.auth_data.username}:${credentials.auth_data.token}@bitbucket.org/`
61085
61119
  );
61120
+ if (authenticatedUrl.startsWith("git@bitbucket.org:")) {
61121
+ const repoPath = authenticatedUrl.replace("git@bitbucket.org:", "").replace(/\.git$/, "");
61122
+ authenticatedUrl = `https://${credentials.auth_data.username}:${credentials.auth_data.token}@bitbucket.org/${repoPath}.git`;
61123
+ log(`=> Converted SSH URL to HTTPS`);
61124
+ }
61086
61125
  break;
61087
61126
  default:
61088
61127
  throw new Error(`Unsupported provider: ${credentials.provider}`);
61089
61128
  }
61129
+ const maskedUrl = authenticatedUrl.replace(/\/\/[^@]+@/, "//***@");
61130
+ log(`=> setUserCredentials: setting remote URL to ${maskedUrl}`);
61090
61131
  await this.setRemoteUrl(authenticatedUrl);
61091
61132
  await this.setUserConfig(credentials);
61092
61133
  }
@@ -61102,14 +61143,18 @@ var Repo = class {
61102
61143
  // by pulling with rebase and pushing again
61103
61144
  async pushCurrentBranchWithCredentials(credentials) {
61104
61145
  const currentBranch = (await this.printCurrentBranch()).trim();
61146
+ log(`=> pushCurrentBranchWithCredentials: branch=${currentBranch}, hasCredentials=${!!credentials}`);
61105
61147
  try {
61106
61148
  if (credentials) {
61107
61149
  await this.setUserCredentials(credentials);
61150
+ log(`=> Credentials set for push`);
61108
61151
  }
61109
61152
  try {
61110
61153
  const result = await this.push(currentBranch);
61154
+ log(`=> pushCurrentBranchWithCredentials succeeded`);
61111
61155
  return result;
61112
61156
  } catch (pushError) {
61157
+ error(`=> pushCurrentBranchWithCredentials caught error:`, pushError);
61113
61158
  const errorMessage = pushError instanceof Error ? pushError.message : String(pushError);
61114
61159
  const isRejectedDueToRemoteChanges = errorMessage.includes("[rejected]") || errorMessage.includes("non-fast-forward") || errorMessage.includes("Updates were rejected");
61115
61160
  if (isRejectedDueToRemoteChanges) {
@@ -61213,7 +61258,7 @@ var SSEManager = class {
61213
61258
  var sseManager = new SSEManager();
61214
61259
 
61215
61260
  // src/proxy/version.ts
61216
- var VERSION = "0.3.87";
61261
+ var VERSION = "0.3.89";
61217
61262
 
61218
61263
  // node_modules/uuid/dist/esm/stringify.js
61219
61264
  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.89";
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.89",
6
6
  "type": "module",
7
7
  "publisher": "stakwork",
8
8
  "engines": {