staklink 0.3.75 → 0.3.76

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.
@@ -53094,9 +53094,7 @@ async function startup() {
53094
53094
  try {
53095
53095
  await runner.runRebuildCommands(config4);
53096
53096
  await runner.runInstallCommands(config4);
53097
- log(
53098
- `\u2705 Install commands executed successfully in ${workspaceRoot2}`
53099
- );
53097
+ log(`\u2705 Install commands executed successfully in ${workspaceRoot2}`);
53100
53098
  } catch (error87) {
53101
53099
  log(`\u274C Failed to run install/rebuild commands: ${error87}`);
53102
53100
  }
@@ -61116,9 +61114,7 @@ var Repo = class {
61116
61114
  const isRejectedDueToRemoteChanges = errorMessage.includes("[rejected]") || errorMessage.includes("non-fast-forward") || errorMessage.includes("Updates were rejected");
61117
61115
  if (isRejectedDueToRemoteChanges) {
61118
61116
  try {
61119
- await this.execCommand(
61120
- `git pull --rebase origin ${currentBranch}`
61121
- );
61117
+ await this.execCommand(`git pull --rebase origin ${currentBranch}`);
61122
61118
  } catch (pullError) {
61123
61119
  const status = await this.execCommand("git status");
61124
61120
  if (status.includes("rebase in progress") || status.includes("Unmerged") || status.includes("both modified")) {
@@ -61217,7 +61213,7 @@ var SSEManager = class {
61217
61213
  var sseManager = new SSEManager();
61218
61214
 
61219
61215
  // src/proxy/version.ts
61220
- var VERSION = "0.3.75";
61216
+ var VERSION = "0.3.76";
61221
61217
 
61222
61218
  // node_modules/uuid/dist/esm/stringify.js
61223
61219
  var byteToHex = [];
@@ -121564,7 +121560,14 @@ function goose_env(apiKey) {
121564
121560
  PATH: `${path7.join(os.homedir(), ".local", "bin")}:${process.env.PATH}`
121565
121561
  };
121566
121562
  }
121567
- async function runAgent({ prompt, apiKey, cwd, system_prompt, session, summarize }) {
121563
+ async function runAgent({
121564
+ prompt,
121565
+ apiKey,
121566
+ cwd,
121567
+ system_prompt,
121568
+ session,
121569
+ summarize
121570
+ }) {
121568
121571
  createGooseConfig();
121569
121572
  const env = goose_env(apiKey);
121570
121573
  console.log("RUN goose with env", env);
@@ -121641,7 +121644,11 @@ async function runGooseWeb(apiKey, cwd, port) {
121641
121644
 
121642
121645
  // src/agent/claude_code.ts
121643
121646
  var import_child_process3 = require("child_process");
121644
- async function runAgent2({ prompt, apiKey, cwd }) {
121647
+ async function runAgent2({
121648
+ prompt,
121649
+ apiKey,
121650
+ cwd
121651
+ }) {
121645
121652
  if (!apiKey) {
121646
121653
  throw new Error("Missing ANTHROPIC_API_KEY");
121647
121654
  }
@@ -132909,7 +132916,9 @@ async function streamGooseToSSE(sessionId, prompt, apiKey, res, options) {
132909
132916
  id: completed.id,
132910
132917
  text: completed.text,
132911
132918
  timestamp: Date.now()
132912
- }).catch((error87) => error("Error posting to webhook", error87));
132919
+ }).catch(
132920
+ (error87) => error("Error posting to webhook", error87)
132921
+ );
132913
132922
  textAccumulators.delete(p.id);
132914
132923
  }
132915
132924
  break;
@@ -132921,7 +132930,9 @@ async function streamGooseToSSE(sessionId, prompt, apiKey, res, options) {
132921
132930
  toolName: p.toolName,
132922
132931
  input: p.input,
132923
132932
  timestamp: Date.now()
132924
- }).catch((error87) => error("Error posting to webhook", error87));
132933
+ }).catch(
132934
+ (error87) => error("Error posting to webhook", error87)
132935
+ );
132925
132936
  break;
132926
132937
  case "tool-result":
132927
132938
  postToWebhook(options.webhookUrl, {
@@ -132931,7 +132942,9 @@ async function streamGooseToSSE(sessionId, prompt, apiKey, res, options) {
132931
132942
  toolName: p.toolName,
132932
132943
  output: truncateOutput(p.output),
132933
132944
  timestamp: Date.now()
132934
- }).catch((error87) => error("Error posting to webhook", error87));
132945
+ }).catch(
132946
+ (error87) => error("Error posting to webhook", error87)
132947
+ );
132935
132948
  break;
132936
132949
  }
132937
132950
  }
@@ -133560,9 +133573,7 @@ async function cleanupConfig(configState) {
133560
133573
  try {
133561
133574
  if (configState.wasCreated) {
133562
133575
  await fs11.unlink(configState.configPath);
133563
- log(
133564
- `Cleaned up created config file: ${configState.configPath}`
133565
- );
133576
+ log(`Cleaned up created config file: ${configState.configPath}`);
133566
133577
  } else if (configState.wasModified && configState.originalContent) {
133567
133578
  await fs11.writeFile(configState.configPath, configState.originalContent);
133568
133579
  log(`Restored original config: ${configState.configPath}`);
@@ -134077,16 +134088,81 @@ Stderr: ${error87.stderr}`
134077
134088
  };
134078
134089
 
134079
134090
  // src/proxy/git_actions.ts
134080
- async function handleDiff(_req, res) {
134091
+ async function handleBranchDiff(req, res) {
134081
134092
  try {
134082
134093
  const results = [];
134083
134094
  const repos = await getReposMaybe();
134095
+ const baseBranch = req.query.base || "main";
134084
134096
  for (const r of repos) {
134085
134097
  const repo = await NewRepo(r);
134086
134098
  const repoName = getRepoNameFromUrl(r);
134099
+ const currentBranch = (await repo.printCurrentBranch()).trim();
134100
+ if (currentBranch === baseBranch) {
134101
+ continue;
134102
+ }
134103
+ let mergeBase;
134104
+ try {
134105
+ mergeBase = (await repo.execCommand(`git merge-base ${baseBranch} HEAD`)).trim();
134106
+ } catch {
134107
+ try {
134108
+ mergeBase = (await repo.execCommand(`git merge-base origin/${baseBranch} HEAD`)).trim();
134109
+ } catch {
134110
+ warn(
134111
+ `Could not find merge base for ${repoName}, skipping...`
134112
+ );
134113
+ continue;
134114
+ }
134115
+ }
134087
134116
  const diffOutput = await repo.execCommand(
134088
- "git diff --name-status HEAD"
134117
+ `git diff --name-status ${mergeBase}`
134089
134118
  );
134119
+ const lines = diffOutput.trim().split("\n").filter((line) => line);
134120
+ for (const line of lines) {
134121
+ const parts = line.split(" ");
134122
+ if (parts.length < 2) {
134123
+ continue;
134124
+ }
134125
+ const status = parts[0];
134126
+ const filePath = parts[1];
134127
+ let action;
134128
+ if (status.startsWith("A")) {
134129
+ action = "create";
134130
+ } else if (status.startsWith("D")) {
134131
+ action = "delete";
134132
+ } else {
134133
+ action = "modify";
134134
+ }
134135
+ let content = "";
134136
+ try {
134137
+ content = await repo.execCommand(
134138
+ `git diff ${mergeBase} -- "${filePath}"`
134139
+ );
134140
+ } catch (error87) {
134141
+ warn(`Error getting branch diff for ${filePath}:`, error87);
134142
+ }
134143
+ results.push({
134144
+ file: `${repoName}/${filePath}`,
134145
+ action,
134146
+ content,
134147
+ repoName,
134148
+ errors: []
134149
+ });
134150
+ }
134151
+ }
134152
+ res.status(200).json(results);
134153
+ } catch (error87) {
134154
+ error("Error fetching branch diff:", error87);
134155
+ fail(res, error87);
134156
+ }
134157
+ }
134158
+ async function handleDiff(_req, res) {
134159
+ try {
134160
+ const results = [];
134161
+ const repos = await getReposMaybe();
134162
+ for (const r of repos) {
134163
+ const repo = await NewRepo(r);
134164
+ const repoName = getRepoNameFromUrl(r);
134165
+ const diffOutput = await repo.execCommand("git diff --name-status HEAD");
134090
134166
  const untrackedOutput = await repo.execCommand(
134091
134167
  "git ls-files --others --exclude-standard"
134092
134168
  );
@@ -134109,14 +134185,10 @@ async function handleDiff(_req, res) {
134109
134185
  let content = "";
134110
134186
  try {
134111
134187
  if (action === "delete") {
134112
- content = await repo.execCommand(
134113
- `git diff HEAD -- "${filePath}"`
134114
- );
134188
+ content = await repo.execCommand(`git diff HEAD -- "${filePath}"`);
134115
134189
  } else {
134116
134190
  log("Getting diff for", filePath);
134117
- content = await repo.execCommand(
134118
- `git diff HEAD -- "${filePath}"`
134119
- );
134191
+ content = await repo.execCommand(`git diff HEAD -- "${filePath}"`);
134120
134192
  }
134121
134193
  } catch (error87) {
134122
134194
  warn(`Error getting diff for ${filePath}:`, error87);
@@ -134340,10 +134412,7 @@ ${diff.trim()}`);
134340
134412
  log(
134341
134413
  `=> Waiting for CI checks to appear for PR #${prNumber}...`
134342
134414
  );
134343
- const hasChecks = await gh.waitForChecksToExist(
134344
- prNumber,
134345
- 3e4
134346
- );
134415
+ const hasChecks = await gh.waitForChecksToExist(prNumber, 3e4);
134347
134416
  if (hasChecks) {
134348
134417
  log(`=> Enabling auto-merge for PR #${prNumber}...`);
134349
134418
  await gh.mergePR(prNumber, {
@@ -134664,41 +134733,65 @@ async function startProxyServer() {
134664
134733
  app.use(updateLastHit);
134665
134734
  app.post("/code", async (req, res) => {
134666
134735
  log("===> POST code");
134667
- await handleRequest(req, res, "code", async (req2, res2) => {
134668
- let restartAfter = req2.query.restart === "false" ? false : true;
134669
- const code = req2.body;
134670
- const result = await processCode(code);
134671
- if (restartAfter) {
134672
- await restartConfiguredProcesses();
134673
- }
134674
- res2.json({ success: true, result });
134675
- }, VSCODE_EXTENSION_URL);
134736
+ await handleRequest(
134737
+ req,
134738
+ res,
134739
+ "code",
134740
+ async (req2, res2) => {
134741
+ let restartAfter = req2.query.restart === "false" ? false : true;
134742
+ const code = req2.body;
134743
+ const result = await processCode(code);
134744
+ if (restartAfter) {
134745
+ await restartConfiguredProcesses();
134746
+ }
134747
+ res2.json({ success: true, result });
134748
+ },
134749
+ VSCODE_EXTENSION_URL
134750
+ );
134676
134751
  });
134677
134752
  app.post("/actions", async (req, res) => {
134678
134753
  log("===> POST actions");
134679
- await handleRequest(req, res, "actions", async (req2, res2) => {
134680
- let restartAfter = req2.query.restart === "false" ? false : true;
134681
- const code = req2.body;
134682
- const result = await processCode(code);
134683
- if (restartAfter) {
134684
- await restartConfiguredProcesses();
134685
- }
134686
- res2.json({ success: true, result });
134687
- }, VSCODE_EXTENSION_URL);
134754
+ await handleRequest(
134755
+ req,
134756
+ res,
134757
+ "actions",
134758
+ async (req2, res2) => {
134759
+ let restartAfter = req2.query.restart === "false" ? false : true;
134760
+ const code = req2.body;
134761
+ const result = await processCode(code);
134762
+ if (restartAfter) {
134763
+ await restartConfiguredProcesses();
134764
+ }
134765
+ res2.json({ success: true, result });
134766
+ },
134767
+ VSCODE_EXTENSION_URL
134768
+ );
134688
134769
  });
134689
134770
  app.get("/rules", async (req, res) => {
134690
134771
  log("===> GET rules");
134691
- await handleRequest(req, res, "rules", async (req2, res2) => {
134692
- const root = await workspaceRoot();
134693
- const rules = await gatherRulesFiles(root);
134694
- res2.json(rules);
134695
- }, VSCODE_EXTENSION_URL);
134772
+ await handleRequest(
134773
+ req,
134774
+ res,
134775
+ "rules",
134776
+ async (req2, res2) => {
134777
+ const root = await workspaceRoot();
134778
+ const rules = await gatherRulesFiles(root);
134779
+ res2.json(rules);
134780
+ },
134781
+ VSCODE_EXTENSION_URL
134782
+ );
134696
134783
  });
134697
134784
  app.get("/errors", async (req, res) => {
134698
134785
  log("===> GET errors");
134699
- await handleRequest(req, res, "errors", async (req2, res2) => {
134700
- res2.json({});
134701
- }, VSCODE_EXTENSION_URL);
134786
+ await handleRequest(
134787
+ req,
134788
+ res,
134789
+ "errors",
134790
+ async (req2, res2) => {
134791
+ res2.json({});
134792
+ },
134793
+ VSCODE_EXTENSION_URL
134794
+ );
134702
134795
  });
134703
134796
  app.get("/logs", async (req, res) => {
134704
134797
  log("===> GET logs");
@@ -134749,6 +134842,10 @@ async function startProxyServer() {
134749
134842
  log("===> GET diff");
134750
134843
  await handleDiff(req, res);
134751
134844
  });
134845
+ app.get("/branch-diff", async (req, res) => {
134846
+ log("===> GET branch-diff");
134847
+ await handleBranchDiff(req, res);
134848
+ });
134752
134849
  app.post("/commit", async (req, res) => {
134753
134850
  log(`===> POST /commit`);
134754
134851
  await handleCommit(req, res);
@@ -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.75";
10970
+ var VERSION = "0.3.76";
10971
10971
 
10972
10972
  // src/cli.ts
10973
10973
  var STAKLINK_PROXY = "staklink-proxy";
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.75",
5
+ "version": "0.3.76",
6
6
  "type": "module",
7
7
  "publisher": "stakwork",
8
8
  "engines": {