@monotykamary/localterm-server 2.79.9 → 2.79.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/agent-git-status.d.ts.map +1 -1
- package/dist/agent-git-status.js +2 -1
- package/dist/agent-git-status.js.map +1 -1
- package/dist/utils/resolve-git-binary.d.ts +2 -0
- package/dist/utils/resolve-git-binary.d.ts.map +1 -1
- package/dist/utils/resolve-git-binary.js +57 -10
- package/dist/utils/resolve-git-binary.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-git-status.d.ts","sourceRoot":"","sources":["../src/agent-git-status.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agent-git-status.d.ts","sourceRoot":"","sources":["../src/agent-git-status.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,YAAY,QAAS,MAAM,KAAG,GAAG,CAAC,MAAM,CAWpD,CAAC;AAEF,eAAO,MAAM,mBAAmB,WAAY,GAAG,CAAC,MAAM,CAAC,OAAO,MAAM,KAAG,MAAM,EAO5E,CAAC"}
|
package/dist/agent-git-status.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { spawnSync } from "node:child_process";
|
|
2
2
|
import { MAX_AUTOMATION_CHANGED_FILES } from "./constants.js";
|
|
3
|
+
import { resolveGitBinary } from "./utils/resolve-git-binary.js";
|
|
3
4
|
const parseGitStatus = (output) => {
|
|
4
5
|
const set = new Set();
|
|
5
6
|
for (const line of output.split("\n")) {
|
|
@@ -19,7 +20,7 @@ const parseGitStatus = (output) => {
|
|
|
19
20
|
};
|
|
20
21
|
export const gitStatusSet = (cwd) => {
|
|
21
22
|
try {
|
|
22
|
-
const result = spawnSync(
|
|
23
|
+
const result = spawnSync(resolveGitBinary(), ["-C", cwd, "status", "--porcelain"], {
|
|
23
24
|
encoding: "utf8",
|
|
24
25
|
timeout: 5000,
|
|
25
26
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-git-status.js","sourceRoot":"","sources":["../src/agent-git-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"agent-git-status.js","sourceRoot":"","sources":["../src/agent-git-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,MAAM,cAAc,GAAG,CAAC,MAAc,EAAe,EAAE;IACrD,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAC;IAC9B,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACtC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;YAAE,SAAS;QAC9B,IAAI,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC7B,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,KAAK,KAAK,CAAC,CAAC;YAAE,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QACvD,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACvD,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACnC,CAAC;QACD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;YAAE,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAW,EAAe,EAAE;IACvD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,SAAS,CAAC,gBAAgB,EAAE,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,aAAa,CAAC,EAAE;YACjF,QAAQ,EAAE,MAAM;YAChB,OAAO,EAAE,IAAI;SACd,CAAC,CAAC;QACH,IAAI,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,GAAG,EAAE,CAAC;QAC1D,OAAO,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,GAAG,EAAE,CAAC;IACnB,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAAmB,EAAE,GAAW,EAAY,EAAE;IAChF,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IAChC,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,KAAK,MAAM,QAAQ,IAAI,KAAK;QAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;YAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAChF,KAAK,MAAM,QAAQ,IAAI,MAAM;QAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC;YAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAChF,OAAO,CAAC,IAAI,EAAE,CAAC;IACf,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,4BAA4B,CAAC,CAAC;AACxD,CAAC,CAAC"}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
export declare const gitBinaryCandidates: (developerDir: string | null) => string[];
|
|
2
|
+
export declare const selectUsableGitBinary: (candidates: readonly string[], isUsable: (binary: string) => boolean) => string | null;
|
|
1
3
|
export declare const resolveGitBinary: () => string;
|
|
2
4
|
//# sourceMappingURL=resolve-git-binary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-git-binary.d.ts","sourceRoot":"","sources":["../../src/utils/resolve-git-binary.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolve-git-binary.d.ts","sourceRoot":"","sources":["../../src/utils/resolve-git-binary.ts"],"names":[],"mappings":"AAgCA,eAAO,MAAM,mBAAmB,iBAAkB,MAAM,GAAG,IAAI,KAAG,MAAM,EAKvE,CAAC;AAEF,eAAO,MAAM,qBAAqB,eACpB,SAAS,MAAM,EAAE,YACnB,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,KACpC,MAAM,GAAG,IAKX,CAAC;AAsBF,eAAO,MAAM,gBAAgB,QAAO,MAKnC,CAAC"}
|
|
@@ -1,24 +1,71 @@
|
|
|
1
1
|
import { execFileSync } from "node:child_process";
|
|
2
|
+
import path from "node:path";
|
|
2
3
|
let resolved;
|
|
4
|
+
const GIT_VERSION_OUTPUT = /^git version\b/;
|
|
5
|
+
const execVersion = (binary, args) => {
|
|
6
|
+
return execFileSync(binary, args, {
|
|
7
|
+
timeout: 5_000,
|
|
8
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
9
|
+
})
|
|
10
|
+
.toString("utf8")
|
|
11
|
+
.trim();
|
|
12
|
+
};
|
|
3
13
|
// The daemon is a launchd agent with no GUI provenance, so syspolicyd re-assesses
|
|
4
14
|
// ad-hoc/Developer-ID binaries on every spawn — homebrew `git` is ad-hoc, and the
|
|
5
15
|
// daemon runs `git` (diff summaries, repo detection) on every PTY open, which is
|
|
6
16
|
// the syspolicyd spike. `/usr/bin/git` is Apple-signed (cached regardless of
|
|
7
17
|
// provenance) and, with Xcode CLI tools installed, a real git — so prefer it.
|
|
8
|
-
//
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
18
|
+
//
|
|
19
|
+
// It is not always usable, though: when it is only the Xcode shim, it refuses to
|
|
20
|
+
// run until the Xcode license is accepted (exit 69), and the daemon cannot fall
|
|
21
|
+
// back to PATH — its baked PATH is /usr/bin:/bin:/usr/sbin:/sbin, so a PATH
|
|
22
|
+
// lookup lands back on that same shim. That silently disabled every git-backed
|
|
23
|
+
// surface (diff summary, branch/PR metadata, worktrees) while the user's own
|
|
24
|
+
// shell — whose rc files put homebrew first — still worked. Probe the developer
|
|
25
|
+
// dir's own git binary next: the license gate lives in the /usr/bin and xcrun
|
|
26
|
+
// entry points, so the binary behind them reports a version regardless. Homebrew
|
|
27
|
+
// prefixes follow for machines without Xcode, and the bare name stays last so a
|
|
28
|
+
// PATH-only install still works.
|
|
29
|
+
export const gitBinaryCandidates = (developerDir) => {
|
|
30
|
+
const candidates = ["/usr/bin/git"];
|
|
31
|
+
if (developerDir !== null)
|
|
32
|
+
candidates.push(path.join(developerDir, "usr", "bin", "git"));
|
|
33
|
+
candidates.push("/opt/homebrew/bin/git", "/usr/local/bin/git", "git");
|
|
34
|
+
return candidates;
|
|
35
|
+
};
|
|
36
|
+
export const selectUsableGitBinary = (candidates, isUsable) => {
|
|
37
|
+
for (const candidate of candidates) {
|
|
38
|
+
if (isUsable(candidate))
|
|
39
|
+
return candidate;
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
};
|
|
43
|
+
const readXcodeDeveloperDir = () => {
|
|
44
|
+
if (process.platform !== "darwin")
|
|
45
|
+
return null;
|
|
46
|
+
try {
|
|
47
|
+
const developerDir = execVersion("/usr/bin/xcode-select", ["-p"]);
|
|
48
|
+
return path.isAbsolute(developerDir) ? developerDir : null;
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
/* no active developer dir — Xcode and the CLI tools are both absent */
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const isUsableGit = (binary) => {
|
|
12
56
|
try {
|
|
13
|
-
|
|
14
|
-
timeout: 5_000,
|
|
15
|
-
stdio: ["ignore", "pipe", "ignore"],
|
|
16
|
-
}).toString("utf8");
|
|
17
|
-
resolved = /^git version\b/.test(out.trim()) ? "/usr/bin/git" : "git";
|
|
57
|
+
return GIT_VERSION_OUTPUT.test(execVersion(binary, ["--version"]));
|
|
18
58
|
}
|
|
19
59
|
catch {
|
|
20
|
-
|
|
60
|
+
/* missing, unreadable, license-gated, or not actually git */
|
|
61
|
+
return false;
|
|
21
62
|
}
|
|
63
|
+
};
|
|
64
|
+
export const resolveGitBinary = () => {
|
|
65
|
+
if (resolved !== undefined)
|
|
66
|
+
return resolved;
|
|
67
|
+
resolved =
|
|
68
|
+
selectUsableGitBinary(gitBinaryCandidates(readXcodeDeveloperDir()), isUsableGit) ?? "git";
|
|
22
69
|
return resolved;
|
|
23
70
|
};
|
|
24
71
|
//# sourceMappingURL=resolve-git-binary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-git-binary.js","sourceRoot":"","sources":["../../src/utils/resolve-git-binary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"resolve-git-binary.js","sourceRoot":"","sources":["../../src/utils/resolve-git-binary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,IAAI,QAA4B,CAAC;AAEjC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AAE5C,MAAM,WAAW,GAAG,CAAC,MAAc,EAAE,IAAc,EAAU,EAAE;IAC7D,OAAO,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE;QAChC,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;KACpC,CAAC;SACC,QAAQ,CAAC,MAAM,CAAC;SAChB,IAAI,EAAE,CAAC;AACZ,CAAC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