staklink 0.3.9 → 0.3.10
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 +34 -11
- package/dist/staklink-cli.cjs +1 -1
- package/package.json +1 -1
package/dist/proxy-server.cjs
CHANGED
|
@@ -33901,7 +33901,7 @@ var SSEManager = class {
|
|
|
33901
33901
|
var sseManager = new SSEManager();
|
|
33902
33902
|
|
|
33903
33903
|
// src/proxy/version.ts
|
|
33904
|
-
var VERSION = "0.3.
|
|
33904
|
+
var VERSION = "0.3.10";
|
|
33905
33905
|
|
|
33906
33906
|
// node_modules/uuid/dist/esm/stringify.js
|
|
33907
33907
|
var byteToHex = [];
|
|
@@ -80284,23 +80284,38 @@ async function startProxyServer() {
|
|
|
80284
80284
|
const code = req.body;
|
|
80285
80285
|
const repos = getReposWithChangedFiles(code);
|
|
80286
80286
|
const createPR = req.query.pr === "true";
|
|
80287
|
+
const shouldCommit = req.query.commit === "true";
|
|
80287
80288
|
const commits = [];
|
|
80288
80289
|
const prs = {};
|
|
80290
|
+
console.log(`=> Commit requested: ${shouldCommit}`);
|
|
80289
80291
|
console.log(`=> PR creation requested: ${createPR}`);
|
|
80290
80292
|
console.log(
|
|
80291
80293
|
`=> Git credentials available: ${!!code.git_credentials?.auth_data?.token}`
|
|
80292
80294
|
);
|
|
80293
80295
|
for (const r of repos) {
|
|
80294
|
-
console.log(`=> PUSH to ${r.url}`);
|
|
80295
80296
|
const repo = await NewRepo(r.url);
|
|
80296
80297
|
const repoName = getRepoNameFromUrl(r.url);
|
|
80297
80298
|
const stashCreated = await repo.stashDevcontainer();
|
|
80299
|
+
if (shouldCommit) {
|
|
80300
|
+
console.log(`=> COMMIT to ${r.url}`);
|
|
80301
|
+
console.log(`=> COMMIT in ${repo.printcwd()}`);
|
|
80302
|
+
const isOnMain = await repo.isOnMainBranch();
|
|
80303
|
+
const isOnBaseBranch = await repo.isOnBranch(r.base_branch);
|
|
80304
|
+
if (isOnMain || isOnBaseBranch) {
|
|
80305
|
+
console.log(`=> CHECKOUT to new branch: ${r.branch_name}`);
|
|
80306
|
+
await repo.checkoutNew(r.branch_name);
|
|
80307
|
+
}
|
|
80308
|
+
await repo.addAll();
|
|
80309
|
+
console.log(`=> COMMIT to ${r.url} on branch: ${r.branch_name}`);
|
|
80310
|
+
await repo.commitWithCredentials(r.commit_name, code.git_credentials);
|
|
80311
|
+
}
|
|
80312
|
+
console.log(`=> PUSH to ${r.url}`);
|
|
80298
80313
|
await repo.pushCurrentBranchWithCredentials(code.git_credentials);
|
|
80314
|
+
const link = await repo.getLatestCommitLink();
|
|
80315
|
+
commits.push(link);
|
|
80299
80316
|
if (stashCreated) {
|
|
80300
80317
|
await repo.popDevcontainerStash();
|
|
80301
80318
|
}
|
|
80302
|
-
const link = await repo.getLatestCommitLink();
|
|
80303
|
-
commits.push(link);
|
|
80304
80319
|
if (createPR) {
|
|
80305
80320
|
if (!code.git_credentials?.auth_data?.token) {
|
|
80306
80321
|
console.error(`=> No GitHub token available for PR creation`);
|
|
@@ -80313,20 +80328,28 @@ async function startProxyServer() {
|
|
|
80313
80328
|
console.log(`=> Base: ${r.base_branch || "main"}`);
|
|
80314
80329
|
const repoLocation = repo.printcwd();
|
|
80315
80330
|
console.log(`=> Repo location: ${repoLocation}`);
|
|
80316
|
-
const
|
|
80331
|
+
const currentBranchRaw = await repo.execCommand(
|
|
80317
80332
|
"git rev-parse --abbrev-ref HEAD"
|
|
80318
80333
|
);
|
|
80319
|
-
|
|
80334
|
+
const currentBranch = currentBranchRaw.trim();
|
|
80335
|
+
console.log(`=> Current branch: ${currentBranch}`);
|
|
80320
80336
|
const baseBranch = r.base_branch || "main";
|
|
80337
|
+
if (currentBranch === baseBranch) {
|
|
80338
|
+
console.log(
|
|
80339
|
+
`=> Cannot create PR: currently on base branch (${baseBranch})`
|
|
80340
|
+
);
|
|
80341
|
+
prs[repoName] = `Error: Cannot create PR - currently on base branch (${baseBranch}). Commit changes to a feature branch first.`;
|
|
80342
|
+
continue;
|
|
80343
|
+
}
|
|
80321
80344
|
try {
|
|
80322
80345
|
const diff = await repo.execCommand(
|
|
80323
80346
|
`git log origin/${baseBranch}..HEAD --oneline`
|
|
80324
80347
|
);
|
|
80325
80348
|
if (!diff.trim()) {
|
|
80326
80349
|
console.log(
|
|
80327
|
-
`=> No commits between ${baseBranch} and
|
|
80350
|
+
`=> No commits between ${baseBranch} and ${currentBranch}`
|
|
80328
80351
|
);
|
|
80329
|
-
prs[repoName] =
|
|
80352
|
+
prs[repoName] = `Error: No commits to create PR - ${currentBranch} is up to date with ${baseBranch}`;
|
|
80330
80353
|
continue;
|
|
80331
80354
|
}
|
|
80332
80355
|
console.log(`=> Commits to include in PR:
|
|
@@ -80336,7 +80359,7 @@ ${diff.trim()}`);
|
|
|
80336
80359
|
}
|
|
80337
80360
|
const gh = new GitHubCLI(
|
|
80338
80361
|
code.git_credentials.auth_data.token,
|
|
80339
|
-
|
|
80362
|
+
currentBranch,
|
|
80340
80363
|
repoLocation
|
|
80341
80364
|
);
|
|
80342
80365
|
await gh.init();
|
|
@@ -80346,8 +80369,8 @@ ${diff.trim()}`);
|
|
|
80346
80369
|
prs[repoName] = existingPR.url;
|
|
80347
80370
|
} else {
|
|
80348
80371
|
const pr = await gh.createPR({
|
|
80349
|
-
title: r.commit_name || `Changes from ${
|
|
80350
|
-
body: `Automated PR from branch ${
|
|
80372
|
+
title: r.commit_name || `Changes from ${currentBranch}`,
|
|
80373
|
+
body: `Automated PR from branch ${currentBranch}`,
|
|
80351
80374
|
base: baseBranch,
|
|
80352
80375
|
draft: false
|
|
80353
80376
|
});
|
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.10";
|
|
10909
10909
|
|
|
10910
10910
|
// src/cli.ts
|
|
10911
10911
|
var STAKLINK_PROXY = "staklink-proxy";
|