staklink 0.3.8 → 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 +53 -9
- 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,24 +80284,39 @@ 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);
|
|
80297
|
+
const repoName = getRepoNameFromUrl(r.url);
|
|
80296
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}`);
|
|
80297
80313
|
await repo.pushCurrentBranchWithCredentials(code.git_credentials);
|
|
80314
|
+
const link = await repo.getLatestCommitLink();
|
|
80315
|
+
commits.push(link);
|
|
80298
80316
|
if (stashCreated) {
|
|
80299
80317
|
await repo.popDevcontainerStash();
|
|
80300
80318
|
}
|
|
80301
|
-
const link = await repo.getLatestCommitLink();
|
|
80302
|
-
commits.push(link);
|
|
80303
80319
|
if (createPR) {
|
|
80304
|
-
const repoName = getRepoNameFromUrl(r.url);
|
|
80305
80320
|
if (!code.git_credentials?.auth_data?.token) {
|
|
80306
80321
|
console.error(`=> No GitHub token available for PR creation`);
|
|
80307
80322
|
prs[repoName] = "Error: GitHub token required for PR creation";
|
|
@@ -80313,9 +80328,38 @@ 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}`);
|
|
80331
|
+
const currentBranchRaw = await repo.execCommand(
|
|
80332
|
+
"git rev-parse --abbrev-ref HEAD"
|
|
80333
|
+
);
|
|
80334
|
+
const currentBranch = currentBranchRaw.trim();
|
|
80335
|
+
console.log(`=> Current branch: ${currentBranch}`);
|
|
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
|
+
}
|
|
80344
|
+
try {
|
|
80345
|
+
const diff = await repo.execCommand(
|
|
80346
|
+
`git log origin/${baseBranch}..HEAD --oneline`
|
|
80347
|
+
);
|
|
80348
|
+
if (!diff.trim()) {
|
|
80349
|
+
console.log(
|
|
80350
|
+
`=> No commits between ${baseBranch} and ${currentBranch}`
|
|
80351
|
+
);
|
|
80352
|
+
prs[repoName] = `Error: No commits to create PR - ${currentBranch} is up to date with ${baseBranch}`;
|
|
80353
|
+
continue;
|
|
80354
|
+
}
|
|
80355
|
+
console.log(`=> Commits to include in PR:
|
|
80356
|
+
${diff.trim()}`);
|
|
80357
|
+
} catch (diffError) {
|
|
80358
|
+
console.warn(`=> Could not check commit diff: ${diffError}`);
|
|
80359
|
+
}
|
|
80316
80360
|
const gh = new GitHubCLI(
|
|
80317
80361
|
code.git_credentials.auth_data.token,
|
|
80318
|
-
|
|
80362
|
+
currentBranch,
|
|
80319
80363
|
repoLocation
|
|
80320
80364
|
);
|
|
80321
80365
|
await gh.init();
|
|
@@ -80325,9 +80369,9 @@ async function startProxyServer() {
|
|
|
80325
80369
|
prs[repoName] = existingPR.url;
|
|
80326
80370
|
} else {
|
|
80327
80371
|
const pr = await gh.createPR({
|
|
80328
|
-
title: r.commit_name || `Changes from ${
|
|
80329
|
-
body: `Automated PR from branch ${
|
|
80330
|
-
base:
|
|
80372
|
+
title: r.commit_name || `Changes from ${currentBranch}`,
|
|
80373
|
+
body: `Automated PR from branch ${currentBranch}`,
|
|
80374
|
+
base: baseBranch,
|
|
80331
80375
|
draft: false
|
|
80332
80376
|
});
|
|
80333
80377
|
console.log(`=> PR created: ${pr.url}`);
|
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";
|