staklink 0.3.20 → 0.3.22

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.
package/README.md CHANGED
@@ -8,6 +8,16 @@ VSCode extension for automating development and debugging in Codespaces.
8
8
 
9
9
  npx -y staklink@latest start
10
10
 
11
+ ### local cli testing
12
+
13
+ pm2 stop all
14
+ pm2 delete all
15
+
16
+ yarn build:cli
17
+ yarn build:proxy
18
+
19
+ node bin/staklink.cjs start
20
+
11
21
  ## processes
12
22
 
13
23
  There are 2 ways to configure your dev processes (like your backend, frontend, db, etc)
@@ -26614,8 +26614,25 @@ async function dirExists(dirPath) {
26614
26614
  }
26615
26615
  async function getReposMaybe() {
26616
26616
  const root = await workspaceRoot();
26617
+ const rootGitPath = path3.join(root, ".git");
26618
+ const isRootGitRepo = await dirExists(rootGitPath);
26619
+ if (isRootGitRepo) {
26620
+ return [root];
26621
+ }
26617
26622
  const children = await getChildDirectories(root);
26618
- return children.filter((dir) => !dir.startsWith("."));
26623
+ const gitRepos = [];
26624
+ for (const child of children) {
26625
+ if (child.startsWith(".")) {
26626
+ continue;
26627
+ }
26628
+ const childPath = path3.join(root, child);
26629
+ const childGitPath = path3.join(childPath, ".git");
26630
+ const isGitRepo = await dirExists(childGitPath);
26631
+ if (isGitRepo) {
26632
+ gitRepos.push(child);
26633
+ }
26634
+ }
26635
+ return gitRepos;
26619
26636
  }
26620
26637
  async function getAppsPortAndLabel() {
26621
26638
  const root = await workspaceRoot();
@@ -26648,6 +26665,9 @@ async function getChildDirectories(dirPath) {
26648
26665
  // src/proxy/utils.ts
26649
26666
  async function findRepoLocation(repoFullName) {
26650
26667
  try {
26668
+ if (repoFullName.startsWith("/") && await dirExists(repoFullName)) {
26669
+ return repoFullName;
26670
+ }
26651
26671
  const repoName = repoFullName.split("/").pop() || "";
26652
26672
  const repodir1 = `/workspaces/${repoName}`;
26653
26673
  if (await dirExists(repodir1)) {
@@ -33882,6 +33902,13 @@ var Repo = class {
33882
33902
  }
33883
33903
  };
33884
33904
  async function NewRepo(url3) {
33905
+ if (url3.startsWith("/")) {
33906
+ const repoLocation2 = await findRepoLocation(url3);
33907
+ if (!repoLocation2) {
33908
+ throw new Error(`Repository not found for ${url3}`);
33909
+ }
33910
+ return new Repo(repoLocation2);
33911
+ }
33885
33912
  const repoName = getRepoNameFromUrl(url3);
33886
33913
  const repoLocation = await findRepoLocation(repoName);
33887
33914
  if (!repoLocation) {
@@ -33935,7 +33962,7 @@ var SSEManager = class {
33935
33962
  var sseManager = new SSEManager();
33936
33963
 
33937
33964
  // src/proxy/version.ts
33938
- var VERSION = "0.3.20";
33965
+ var VERSION = "0.3.22";
33939
33966
 
33940
33967
  // node_modules/uuid/dist/esm/stringify.js
33941
33968
  var byteToHex = [];
@@ -34097,7 +34124,9 @@ var path8 = __toESM(require("path"), 1);
34097
34124
  var SYSTEM_SUFFIX = `
34098
34125
  You can ignore the .pod-config directory if you see it, its just config stuff
34099
34126
 
34100
- The actual dev server is being run with pm2... so you can use pm2 logs to see dev logs. Other processes (such as DB) are being run with docker.
34127
+ The actual dev server is being run with pm2... so you can use pm2 logs to see dev logs. Don't try to start the dev server again if its already running in pm2! Other processes (such as DB) are being run with docker.
34128
+
34129
+ Don't try to write summaries or docs in .md file unless specifically asked to! Default to output text response to the user.
34101
34130
  `;
34102
34131
 
34103
34132
  // src/agent/goose.ts
@@ -80247,6 +80276,7 @@ async function startProxyServer() {
80247
80276
  for (const r of repos) {
80248
80277
  const repo = await NewRepo(r);
80249
80278
  const repoName = getRepoNameFromUrl(r);
80279
+ const stashCreated = await repo.stashDevcontainer();
80250
80280
  const diffOutput = await repo.execCommand(
80251
80281
  "git diff --name-status HEAD"
80252
80282
  );
@@ -80313,6 +80343,9 @@ ${lines2.map((line) => "+" + line).join("\n")}`;
80313
80343
  errors: []
80314
80344
  });
80315
80345
  }
80346
+ if (stashCreated) {
80347
+ await repo.popDevcontainerStash();
80348
+ }
80316
80349
  }
80317
80350
  res.status(200).json(results);
80318
80351
  } catch (error82) {
@@ -80367,6 +80400,7 @@ ${lines2.map((line) => "+" + line).join("\n")}`;
80367
80400
  const createPR = req.query.pr === "true";
80368
80401
  const shouldCommit = req.query.commit === "true";
80369
80402
  const autoMerge = req.query.automerge === "true";
80403
+ const stayOnCurrentBranch = req.query.stayOnCurrentBranch === "true";
80370
80404
  const commits = [];
80371
80405
  const prs = {};
80372
80406
  const branches = {};
@@ -80380,17 +80414,22 @@ ${lines2.map((line) => "+" + line).join("\n")}`;
80380
80414
  const repo = await NewRepo(r.url);
80381
80415
  const repoName = getRepoNameFromUrl(r.url);
80382
80416
  const stashCreated = await repo.stashDevcontainer();
80383
- const requestedBranch = await repo.generateUniqueBranchName(r.branch_name);
80384
80417
  let currentBranch = (await repo.printCurrentBranch()).trim();
80418
+ const requestedBranch = stayOnCurrentBranch ? currentBranch : await repo.generateUniqueBranchName(r.branch_name);
80385
80419
  console.log(`=> Current branch: ${currentBranch}`);
80386
80420
  console.log(`=> Requested branch: ${requestedBranch}`);
80387
- if (currentBranch !== requestedBranch) {
80421
+ const protectedBranches = ["main", "master"];
80422
+ const isOnProtectedBranch = protectedBranches.includes(currentBranch);
80423
+ const shouldSwitchBranch = (!stayOnCurrentBranch || isOnProtectedBranch) && currentBranch !== requestedBranch;
80424
+ if (shouldSwitchBranch) {
80388
80425
  const branchExists = await repo.branchExists(requestedBranch);
80389
80426
  if (branchExists) {
80390
80427
  console.log(`=> Switching to existing branch: ${requestedBranch}`);
80391
80428
  await repo.checkout(requestedBranch);
80392
80429
  } else {
80393
- console.log(`=> Creating new branch from current position: ${requestedBranch}`);
80430
+ console.log(
80431
+ `=> Creating new branch from current position: ${requestedBranch}`
80432
+ );
80394
80433
  await repo.checkoutNew(requestedBranch);
80395
80434
  }
80396
80435
  } else {
@@ -10905,7 +10905,7 @@ var glob = Object.assign(glob_, {
10905
10905
  glob.glob = glob;
10906
10906
 
10907
10907
  // src/proxy/version.ts
10908
- var VERSION = "0.3.20";
10908
+ var VERSION = "0.3.22";
10909
10909
 
10910
10910
  // src/cli.ts
10911
10911
  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.20",
5
+ "version": "0.3.22",
6
6
  "type": "module",
7
7
  "publisher": "stakwork",
8
8
  "engines": {