@proagentstore/cli 0.4.20 → 0.4.21
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.
|
@@ -97,6 +97,24 @@ export function runRepoGit(workDir, cmd, opts = {}) {
|
|
|
97
97
|
const truncated = out.length > cap;
|
|
98
98
|
return { cmd, output: truncated ? out.slice(0, cap) : out, truncated };
|
|
99
99
|
}
|
|
100
|
+
/** Read the repo's `origin` remote URL — used to auto-associate a local checkout with its
|
|
101
|
+
* GitHub repo (so build status can query Actions). Fixed argv, no shell, no user input;
|
|
102
|
+
* returns null when it's not a git repo or has no `origin` remote. */
|
|
103
|
+
export function readGitRemoteOrigin(workDir) {
|
|
104
|
+
if (!existsSync(resolve(workDir, ".git")))
|
|
105
|
+
return null;
|
|
106
|
+
try {
|
|
107
|
+
const out = execFileSync("git", ["config", "--get", "remote.origin.url"], {
|
|
108
|
+
cwd: workDir,
|
|
109
|
+
encoding: "utf-8",
|
|
110
|
+
timeout: 10_000,
|
|
111
|
+
});
|
|
112
|
+
return out.trim() || null;
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
100
118
|
const IGNORE_DIRS = new Set(["node_modules", ".git", "dist", "build", ".next", ".turbo", "coverage", ".wrangler"]);
|
|
101
119
|
/** Bounded recursive file tree (names/type/size only — no contents). */
|
|
102
120
|
export function repoTree(workDir, relPath = ".", maxDepth = 3, maxEntries = 500) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { homedir } from "node:os";
|
|
2
2
|
import { join, resolve } from "node:path";
|
|
3
3
|
import { defaultStatePath, HeadlessSession } from "./headless.js";
|
|
4
|
-
import { InspectError, readRepoFile, repoTree, runRepoGit } from "./inspect.js";
|
|
4
|
+
import { InspectError, readGitRemoteOrigin, readRepoFile, repoTree, runRepoGit } from "./inspect.js";
|
|
5
5
|
import { ensureRepo, sanitizeSessionName } from "./tmux.js";
|
|
6
6
|
/** Hard cap on a pane returned to the brain/console (matches the worker MAX_PANE_CHARS). */
|
|
7
7
|
const MAX_PANE = 64 * 1024;
|
|
@@ -53,6 +53,11 @@ export class CodingRuntime {
|
|
|
53
53
|
tree(input) {
|
|
54
54
|
return repoTree(this.resolveWorkDir(input), input.path, input.maxDepth, input.maxEntries);
|
|
55
55
|
}
|
|
56
|
+
/** Read the local checkout's `origin` remote URL — lets PAGS auto-associate a
|
|
57
|
+
* local-path repo with its GitHub owner/repo (so build status can query Actions). */
|
|
58
|
+
gitRemote(input) {
|
|
59
|
+
return { remote: readGitRemoteOrigin(this.resolveWorkDir(input)) };
|
|
60
|
+
}
|
|
56
61
|
static taskTypes() {
|
|
57
62
|
return ["coding.session"];
|
|
58
63
|
}
|
|
@@ -242,6 +242,15 @@ async function route(runner, req, res) {
|
|
|
242
242
|
return json(res, 400, { error: e instanceof Error ? e.message : String(e) });
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
|
+
if (req.method === "POST" && path === "/coding/git-remote") {
|
|
246
|
+
const b = await readJson(req);
|
|
247
|
+
try {
|
|
248
|
+
return json(res, 200, runner.coding.gitRemote(b));
|
|
249
|
+
}
|
|
250
|
+
catch (e) {
|
|
251
|
+
return json(res, 400, { error: e instanceof Error ? e.message : String(e) });
|
|
252
|
+
}
|
|
253
|
+
}
|
|
245
254
|
if (req.method === "POST" && path === "/coding/tree") {
|
|
246
255
|
const b = await readJson(req);
|
|
247
256
|
try {
|