staklink 0.3.7 → 0.3.9
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 +33 -5
- 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.9";
|
|
33905
33905
|
|
|
33906
33906
|
// node_modules/uuid/dist/esm/stringify.js
|
|
33907
33907
|
var byteToHex = [];
|
|
@@ -79588,9 +79588,11 @@ var GitHubCLI = class {
|
|
|
79588
79588
|
branch;
|
|
79589
79589
|
owner;
|
|
79590
79590
|
repo;
|
|
79591
|
-
|
|
79591
|
+
cwd;
|
|
79592
|
+
constructor(token, branch, cwd) {
|
|
79592
79593
|
this.token = token;
|
|
79593
79594
|
this.branch = branch;
|
|
79595
|
+
this.cwd = cwd;
|
|
79594
79596
|
}
|
|
79595
79597
|
/**
|
|
79596
79598
|
* Initialize and get repo info from git
|
|
@@ -79612,6 +79614,7 @@ var GitHubCLI = class {
|
|
|
79612
79614
|
const fullCommand = `gh ${command}`;
|
|
79613
79615
|
try {
|
|
79614
79616
|
return await execAsync(fullCommand, {
|
|
79617
|
+
cwd: this.cwd,
|
|
79615
79618
|
env: {
|
|
79616
79619
|
...process.env,
|
|
79617
79620
|
GH_TOKEN: this.token,
|
|
@@ -79632,6 +79635,7 @@ Stderr: ${error82.stderr}`
|
|
|
79632
79635
|
const fullCommand = `gh ${command}`;
|
|
79633
79636
|
try {
|
|
79634
79637
|
return (0, import_child_process4.execSync)(fullCommand, {
|
|
79638
|
+
cwd: this.cwd,
|
|
79635
79639
|
encoding: "utf-8",
|
|
79636
79640
|
env: {
|
|
79637
79641
|
...process.env,
|
|
@@ -80289,6 +80293,7 @@ async function startProxyServer() {
|
|
|
80289
80293
|
for (const r of repos) {
|
|
80290
80294
|
console.log(`=> PUSH to ${r.url}`);
|
|
80291
80295
|
const repo = await NewRepo(r.url);
|
|
80296
|
+
const repoName = getRepoNameFromUrl(r.url);
|
|
80292
80297
|
const stashCreated = await repo.stashDevcontainer();
|
|
80293
80298
|
await repo.pushCurrentBranchWithCredentials(code.git_credentials);
|
|
80294
80299
|
if (stashCreated) {
|
|
@@ -80297,7 +80302,6 @@ async function startProxyServer() {
|
|
|
80297
80302
|
const link = await repo.getLatestCommitLink();
|
|
80298
80303
|
commits.push(link);
|
|
80299
80304
|
if (createPR) {
|
|
80300
|
-
const repoName = getRepoNameFromUrl(r.url);
|
|
80301
80305
|
if (!code.git_credentials?.auth_data?.token) {
|
|
80302
80306
|
console.error(`=> No GitHub token available for PR creation`);
|
|
80303
80307
|
prs[repoName] = "Error: GitHub token required for PR creation";
|
|
@@ -80307,9 +80311,33 @@ async function startProxyServer() {
|
|
|
80307
80311
|
console.log(`=> Creating PR for ${r.url}`);
|
|
80308
80312
|
console.log(`=> Branch: ${r.branch_name}`);
|
|
80309
80313
|
console.log(`=> Base: ${r.base_branch || "main"}`);
|
|
80314
|
+
const repoLocation = repo.printcwd();
|
|
80315
|
+
console.log(`=> Repo location: ${repoLocation}`);
|
|
80316
|
+
const currentBranch = await repo.execCommand(
|
|
80317
|
+
"git rev-parse --abbrev-ref HEAD"
|
|
80318
|
+
);
|
|
80319
|
+
console.log(`=> Current branch: ${currentBranch.trim()}`);
|
|
80320
|
+
const baseBranch = r.base_branch || "main";
|
|
80321
|
+
try {
|
|
80322
|
+
const diff = await repo.execCommand(
|
|
80323
|
+
`git log origin/${baseBranch}..HEAD --oneline`
|
|
80324
|
+
);
|
|
80325
|
+
if (!diff.trim()) {
|
|
80326
|
+
console.log(
|
|
80327
|
+
`=> No commits between ${baseBranch} and current branch`
|
|
80328
|
+
);
|
|
80329
|
+
prs[repoName] = "Error: No commits to create PR - branch is up to date with base";
|
|
80330
|
+
continue;
|
|
80331
|
+
}
|
|
80332
|
+
console.log(`=> Commits to include in PR:
|
|
80333
|
+
${diff.trim()}`);
|
|
80334
|
+
} catch (diffError) {
|
|
80335
|
+
console.warn(`=> Could not check commit diff: ${diffError}`);
|
|
80336
|
+
}
|
|
80310
80337
|
const gh = new GitHubCLI(
|
|
80311
80338
|
code.git_credentials.auth_data.token,
|
|
80312
|
-
r.branch_name
|
|
80339
|
+
r.branch_name,
|
|
80340
|
+
repoLocation
|
|
80313
80341
|
);
|
|
80314
80342
|
await gh.init();
|
|
80315
80343
|
const existingPR = await gh.findPRByBranch();
|
|
@@ -80320,7 +80348,7 @@ async function startProxyServer() {
|
|
|
80320
80348
|
const pr = await gh.createPR({
|
|
80321
80349
|
title: r.commit_name || `Changes from ${r.branch_name}`,
|
|
80322
80350
|
body: `Automated PR from branch ${r.branch_name}`,
|
|
80323
|
-
base:
|
|
80351
|
+
base: baseBranch,
|
|
80324
80352
|
draft: false
|
|
80325
80353
|
});
|
|
80326
80354
|
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.9";
|
|
10909
10909
|
|
|
10910
10910
|
// src/cli.ts
|
|
10911
10911
|
var STAKLINK_PROXY = "staklink-proxy";
|