staklink 0.3.16 → 0.3.17
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/dist/proxy-server.cjs +43 -17
- package/dist/staklink-cli.cjs +1 -1
- package/package.json +1 -1
package/dist/proxy-server.cjs
CHANGED
|
@@ -33610,11 +33610,15 @@ var Repo = class {
|
|
|
33610
33610
|
}
|
|
33611
33611
|
async branchExists(branch) {
|
|
33612
33612
|
try {
|
|
33613
|
-
const localCheck = await this.execCommand(
|
|
33613
|
+
const localCheck = await this.execCommand(
|
|
33614
|
+
`git show-ref --verify --quiet refs/heads/${branch}`
|
|
33615
|
+
).catch(() => null);
|
|
33614
33616
|
if (localCheck !== null) {
|
|
33615
33617
|
return true;
|
|
33616
33618
|
}
|
|
33617
|
-
const remoteCheck = await this.execCommand(
|
|
33619
|
+
const remoteCheck = await this.execCommand(
|
|
33620
|
+
`git ls-remote --heads origin ${branch}`
|
|
33621
|
+
).catch(() => "");
|
|
33618
33622
|
return remoteCheck.trim().length > 0;
|
|
33619
33623
|
} catch (e) {
|
|
33620
33624
|
return false;
|
|
@@ -33635,6 +33639,9 @@ var Repo = class {
|
|
|
33635
33639
|
}
|
|
33636
33640
|
return branchName;
|
|
33637
33641
|
}
|
|
33642
|
+
async checkout(branch) {
|
|
33643
|
+
return this.execCommand(`git checkout ${branch}`);
|
|
33644
|
+
}
|
|
33638
33645
|
async checkoutNew(branch) {
|
|
33639
33646
|
return this.execCommand(`git checkout -b ${branch}`);
|
|
33640
33647
|
}
|
|
@@ -33928,7 +33935,7 @@ var SSEManager = class {
|
|
|
33928
33935
|
var sseManager = new SSEManager();
|
|
33929
33936
|
|
|
33930
33937
|
// src/proxy/version.ts
|
|
33931
|
-
var VERSION = "0.3.
|
|
33938
|
+
var VERSION = "0.3.17";
|
|
33932
33939
|
|
|
33933
33940
|
// node_modules/uuid/dist/esm/stringify.js
|
|
33934
33941
|
var byteToHex = [];
|
|
@@ -80333,29 +80340,48 @@ async function startProxyServer() {
|
|
|
80333
80340
|
const repo = await NewRepo(r.url);
|
|
80334
80341
|
const repoName = getRepoNameFromUrl(r.url);
|
|
80335
80342
|
const stashCreated = await repo.stashDevcontainer();
|
|
80343
|
+
const requestedBranch = await repo.generateUniqueBranchName(r.branch_name);
|
|
80344
|
+
let currentBranch = (await repo.printCurrentBranch()).trim();
|
|
80345
|
+
console.log(`=> Current branch: ${currentBranch}`);
|
|
80346
|
+
console.log(`=> Requested branch: ${requestedBranch}`);
|
|
80347
|
+
if (currentBranch !== requestedBranch) {
|
|
80348
|
+
const branchExists = await repo.branchExists(requestedBranch);
|
|
80349
|
+
if (branchExists) {
|
|
80350
|
+
console.log(`=> Switching to existing branch: ${requestedBranch}`);
|
|
80351
|
+
await repo.checkout(requestedBranch);
|
|
80352
|
+
} else {
|
|
80353
|
+
console.log(`=> Creating new branch from current position: ${requestedBranch}`);
|
|
80354
|
+
await repo.checkoutNew(requestedBranch);
|
|
80355
|
+
}
|
|
80356
|
+
} else {
|
|
80357
|
+
console.log(`=> Already on correct branch: ${requestedBranch}`);
|
|
80358
|
+
}
|
|
80336
80359
|
if (shouldCommit) {
|
|
80337
80360
|
console.log(`=> COMMIT to ${r.url}`);
|
|
80338
80361
|
console.log(`=> COMMIT in ${repo.printcwd()}`);
|
|
80339
|
-
const
|
|
80340
|
-
|
|
80341
|
-
|
|
80342
|
-
|
|
80343
|
-
|
|
80344
|
-
|
|
80345
|
-
|
|
80346
|
-
|
|
80347
|
-
|
|
80362
|
+
const status = await repo.execCommand("git status --porcelain");
|
|
80363
|
+
if (status.trim()) {
|
|
80364
|
+
console.log(`=> Found uncommitted changes, committing...`);
|
|
80365
|
+
await repo.addAll();
|
|
80366
|
+
currentBranch = (await repo.printCurrentBranch()).trim();
|
|
80367
|
+
console.log(`=> COMMIT to ${r.url} on branch: ${currentBranch}`);
|
|
80368
|
+
await repo.commitWithCredentials(
|
|
80369
|
+
r.commit_name,
|
|
80370
|
+
code.git_credentials
|
|
80371
|
+
);
|
|
80372
|
+
console.log(`=> Commit successful`);
|
|
80373
|
+
} else {
|
|
80374
|
+
console.log(
|
|
80375
|
+
`=> No uncommitted changes, skipping commit (may have been committed by agent)`
|
|
80376
|
+
);
|
|
80348
80377
|
}
|
|
80349
|
-
await repo.addAll();
|
|
80350
|
-
const currentBranch2 = (await repo.printCurrentBranch()).trim();
|
|
80351
|
-
console.log(`=> COMMIT to ${r.url} on branch: ${currentBranch2}`);
|
|
80352
|
-
await repo.commitWithCredentials(r.commit_name, code.git_credentials);
|
|
80353
80378
|
}
|
|
80354
80379
|
console.log(`=> PUSH to ${r.url}`);
|
|
80355
80380
|
await repo.pushCurrentBranchWithCredentials(code.git_credentials);
|
|
80381
|
+
console.log(`=> Push successful`);
|
|
80356
80382
|
const link = await repo.getLatestCommitLink();
|
|
80357
80383
|
commits.push(link);
|
|
80358
|
-
|
|
80384
|
+
currentBranch = (await repo.printCurrentBranch()).trim();
|
|
80359
80385
|
branches[repoName] = currentBranch;
|
|
80360
80386
|
console.log(`=> Branch for ${repoName}: ${currentBranch}`);
|
|
80361
80387
|
if (stashCreated) {
|
package/dist/staklink-cli.cjs
CHANGED
|
@@ -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.
|
|
10908
|
+
var VERSION = "0.3.17";
|
|
10909
10909
|
|
|
10910
10910
|
// src/cli.ts
|
|
10911
10911
|
var STAKLINK_PROXY = "staklink-proxy";
|