staklink 0.3.9 → 0.3.11
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 +44 -12
- 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.11";
|
|
33905
33905
|
|
|
33906
33906
|
// node_modules/uuid/dist/esm/stringify.js
|
|
33907
33907
|
var byteToHex = [];
|
|
@@ -34044,6 +34044,15 @@ function sanitizeShellArg(arg) {
|
|
|
34044
34044
|
var net = __toESM(require("net"), 1);
|
|
34045
34045
|
var fs9 = __toESM(require("fs"), 1);
|
|
34046
34046
|
var path8 = __toESM(require("path"), 1);
|
|
34047
|
+
|
|
34048
|
+
// src/agent/system_suffix.ts
|
|
34049
|
+
var SYSTEM_SUFFIX = `
|
|
34050
|
+
You can ignore the .pod-config directory if you see it, its just config stuff
|
|
34051
|
+
|
|
34052
|
+
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.
|
|
34053
|
+
`;
|
|
34054
|
+
|
|
34055
|
+
// src/agent/goose.ts
|
|
34047
34056
|
function goose_env(apiKey) {
|
|
34048
34057
|
return {
|
|
34049
34058
|
GOOSE_CONTEXT_STRATEGY: "summarize",
|
|
@@ -34062,7 +34071,7 @@ async function runAgent(prompt, apiKey, cwd, session, system_prompt) {
|
|
|
34062
34071
|
console.log("RUN goose with env", env);
|
|
34063
34072
|
const cleanPrompt = sanitizeShellArg(prompt);
|
|
34064
34073
|
let system = system_prompt ? sanitizeShellArg(system_prompt) + "\n\n" : "";
|
|
34065
|
-
system +=
|
|
34074
|
+
system += SYSTEM_SUFFIX;
|
|
34066
34075
|
system = sanitizeShellArg(system);
|
|
34067
34076
|
console.log("Using Goose CLI", cleanPrompt, system);
|
|
34068
34077
|
let cmd = `goose run --with-builtin developer -t "${cleanPrompt}" --system "${system}"`;
|
|
@@ -80284,23 +80293,38 @@ async function startProxyServer() {
|
|
|
80284
80293
|
const code = req.body;
|
|
80285
80294
|
const repos = getReposWithChangedFiles(code);
|
|
80286
80295
|
const createPR = req.query.pr === "true";
|
|
80296
|
+
const shouldCommit = req.query.commit === "true";
|
|
80287
80297
|
const commits = [];
|
|
80288
80298
|
const prs = {};
|
|
80299
|
+
console.log(`=> Commit requested: ${shouldCommit}`);
|
|
80289
80300
|
console.log(`=> PR creation requested: ${createPR}`);
|
|
80290
80301
|
console.log(
|
|
80291
80302
|
`=> Git credentials available: ${!!code.git_credentials?.auth_data?.token}`
|
|
80292
80303
|
);
|
|
80293
80304
|
for (const r of repos) {
|
|
80294
|
-
console.log(`=> PUSH to ${r.url}`);
|
|
80295
80305
|
const repo = await NewRepo(r.url);
|
|
80296
80306
|
const repoName = getRepoNameFromUrl(r.url);
|
|
80297
80307
|
const stashCreated = await repo.stashDevcontainer();
|
|
80308
|
+
if (shouldCommit) {
|
|
80309
|
+
console.log(`=> COMMIT to ${r.url}`);
|
|
80310
|
+
console.log(`=> COMMIT in ${repo.printcwd()}`);
|
|
80311
|
+
const isOnMain = await repo.isOnMainBranch();
|
|
80312
|
+
const isOnBaseBranch = await repo.isOnBranch(r.base_branch);
|
|
80313
|
+
if (isOnMain || isOnBaseBranch) {
|
|
80314
|
+
console.log(`=> CHECKOUT to new branch: ${r.branch_name}`);
|
|
80315
|
+
await repo.checkoutNew(r.branch_name);
|
|
80316
|
+
}
|
|
80317
|
+
await repo.addAll();
|
|
80318
|
+
console.log(`=> COMMIT to ${r.url} on branch: ${r.branch_name}`);
|
|
80319
|
+
await repo.commitWithCredentials(r.commit_name, code.git_credentials);
|
|
80320
|
+
}
|
|
80321
|
+
console.log(`=> PUSH to ${r.url}`);
|
|
80298
80322
|
await repo.pushCurrentBranchWithCredentials(code.git_credentials);
|
|
80323
|
+
const link = await repo.getLatestCommitLink();
|
|
80324
|
+
commits.push(link);
|
|
80299
80325
|
if (stashCreated) {
|
|
80300
80326
|
await repo.popDevcontainerStash();
|
|
80301
80327
|
}
|
|
80302
|
-
const link = await repo.getLatestCommitLink();
|
|
80303
|
-
commits.push(link);
|
|
80304
80328
|
if (createPR) {
|
|
80305
80329
|
if (!code.git_credentials?.auth_data?.token) {
|
|
80306
80330
|
console.error(`=> No GitHub token available for PR creation`);
|
|
@@ -80313,20 +80337,28 @@ async function startProxyServer() {
|
|
|
80313
80337
|
console.log(`=> Base: ${r.base_branch || "main"}`);
|
|
80314
80338
|
const repoLocation = repo.printcwd();
|
|
80315
80339
|
console.log(`=> Repo location: ${repoLocation}`);
|
|
80316
|
-
const
|
|
80340
|
+
const currentBranchRaw = await repo.execCommand(
|
|
80317
80341
|
"git rev-parse --abbrev-ref HEAD"
|
|
80318
80342
|
);
|
|
80319
|
-
|
|
80343
|
+
const currentBranch = currentBranchRaw.trim();
|
|
80344
|
+
console.log(`=> Current branch: ${currentBranch}`);
|
|
80320
80345
|
const baseBranch = r.base_branch || "main";
|
|
80346
|
+
if (currentBranch === baseBranch) {
|
|
80347
|
+
console.log(
|
|
80348
|
+
`=> Cannot create PR: currently on base branch (${baseBranch})`
|
|
80349
|
+
);
|
|
80350
|
+
prs[repoName] = `Error: Cannot create PR - currently on base branch (${baseBranch}). Commit changes to a feature branch first.`;
|
|
80351
|
+
continue;
|
|
80352
|
+
}
|
|
80321
80353
|
try {
|
|
80322
80354
|
const diff = await repo.execCommand(
|
|
80323
80355
|
`git log origin/${baseBranch}..HEAD --oneline`
|
|
80324
80356
|
);
|
|
80325
80357
|
if (!diff.trim()) {
|
|
80326
80358
|
console.log(
|
|
80327
|
-
`=> No commits between ${baseBranch} and
|
|
80359
|
+
`=> No commits between ${baseBranch} and ${currentBranch}`
|
|
80328
80360
|
);
|
|
80329
|
-
prs[repoName] =
|
|
80361
|
+
prs[repoName] = `Error: No commits to create PR - ${currentBranch} is up to date with ${baseBranch}`;
|
|
80330
80362
|
continue;
|
|
80331
80363
|
}
|
|
80332
80364
|
console.log(`=> Commits to include in PR:
|
|
@@ -80336,7 +80368,7 @@ ${diff.trim()}`);
|
|
|
80336
80368
|
}
|
|
80337
80369
|
const gh = new GitHubCLI(
|
|
80338
80370
|
code.git_credentials.auth_data.token,
|
|
80339
|
-
|
|
80371
|
+
currentBranch,
|
|
80340
80372
|
repoLocation
|
|
80341
80373
|
);
|
|
80342
80374
|
await gh.init();
|
|
@@ -80346,8 +80378,8 @@ ${diff.trim()}`);
|
|
|
80346
80378
|
prs[repoName] = existingPR.url;
|
|
80347
80379
|
} else {
|
|
80348
80380
|
const pr = await gh.createPR({
|
|
80349
|
-
title: r.commit_name || `Changes from ${
|
|
80350
|
-
body: `Automated PR from branch ${
|
|
80381
|
+
title: r.commit_name || `Changes from ${currentBranch}`,
|
|
80382
|
+
body: `Automated PR from branch ${currentBranch}`,
|
|
80351
80383
|
base: baseBranch,
|
|
80352
80384
|
draft: false
|
|
80353
80385
|
});
|
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.11";
|
|
10909
10909
|
|
|
10910
10910
|
// src/cli.ts
|
|
10911
10911
|
var STAKLINK_PROXY = "staklink-proxy";
|