gossipcat 0.4.7 → 0.4.8
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-mcp/mcp-server.js +61 -26
- package/package.json +1 -1
package/dist-mcp/mcp-server.js
CHANGED
|
@@ -4116,13 +4116,31 @@ var init_git_tools = __esm({
|
|
|
4116
4116
|
constructor(cwd) {
|
|
4117
4117
|
this.cwd = cwd;
|
|
4118
4118
|
}
|
|
4119
|
+
async execGit(args) {
|
|
4120
|
+
const opts = { cwd: this.cwd, env: { ...process.env } };
|
|
4121
|
+
try {
|
|
4122
|
+
return await execFileAsync2("git", args, opts);
|
|
4123
|
+
} catch (err) {
|
|
4124
|
+
const code = err.code;
|
|
4125
|
+
if (code === "ENOENT") {
|
|
4126
|
+
await new Promise((r) => setTimeout(r, 100));
|
|
4127
|
+
return await execFileAsync2("git", args, opts);
|
|
4128
|
+
}
|
|
4129
|
+
throw err;
|
|
4130
|
+
}
|
|
4131
|
+
}
|
|
4119
4132
|
async git(...args) {
|
|
4120
4133
|
try {
|
|
4121
|
-
const { stdout } = await
|
|
4134
|
+
const { stdout } = await this.execGit(args);
|
|
4122
4135
|
return stdout.trim();
|
|
4123
4136
|
} catch (err) {
|
|
4124
4137
|
const error48 = err;
|
|
4125
|
-
|
|
4138
|
+
let msg = "Unknown error";
|
|
4139
|
+
if (error48 && typeof error48.stderr === "string") {
|
|
4140
|
+
msg = error48.stderr.trim();
|
|
4141
|
+
} else if (error48 && typeof error48.message === "string") {
|
|
4142
|
+
msg = error48.message;
|
|
4143
|
+
}
|
|
4126
4144
|
throw new Error(`git ${args[0]} failed: ${msg}`);
|
|
4127
4145
|
}
|
|
4128
4146
|
}
|
|
@@ -4144,13 +4162,11 @@ var init_git_tools = __esm({
|
|
|
4144
4162
|
}
|
|
4145
4163
|
for (const file2 of untrackedFiles) {
|
|
4146
4164
|
try {
|
|
4147
|
-
const { stdout } = await
|
|
4148
|
-
"
|
|
4149
|
-
["diff", "--no-index", "/dev/null", file2],
|
|
4150
|
-
{ cwd: this.cwd }
|
|
4165
|
+
const { stdout } = await this.execGit(
|
|
4166
|
+
["diff", "--no-index", "/dev/null", file2]
|
|
4151
4167
|
).catch((err) => {
|
|
4152
4168
|
const e = err;
|
|
4153
|
-
return { stdout: e.stdout || "" };
|
|
4169
|
+
return { stdout: e.stdout || "", stderr: e.stderr || "" };
|
|
4154
4170
|
});
|
|
4155
4171
|
if (stdout) diffs.push(stdout.trim());
|
|
4156
4172
|
} catch (err) {
|
|
@@ -4266,7 +4282,8 @@ var init_sandbox = __esm({
|
|
|
4266
4282
|
* callers are unchanged.
|
|
4267
4283
|
*/
|
|
4268
4284
|
validatePath(filePath, allowedRoots = []) {
|
|
4269
|
-
const
|
|
4285
|
+
const resolutionBase = allowedRoots[0] || this.root;
|
|
4286
|
+
const resolved = (0, import_path5.resolve)(resolutionBase, filePath);
|
|
4270
4287
|
let checkPath = resolved;
|
|
4271
4288
|
while (!(0, import_fs4.existsSync)(checkPath)) {
|
|
4272
4289
|
const parent = (0, import_path5.dirname)(checkPath);
|
|
@@ -11901,6 +11918,19 @@ var init_scope_tracker = __esm({
|
|
|
11901
11918
|
});
|
|
11902
11919
|
|
|
11903
11920
|
// packages/orchestrator/src/worktree-manager.ts
|
|
11921
|
+
async function execGit(args, cwd) {
|
|
11922
|
+
const opts = { cwd, env: { ...process.env } };
|
|
11923
|
+
try {
|
|
11924
|
+
return await execFileAsync3("git", args, opts);
|
|
11925
|
+
} catch (err) {
|
|
11926
|
+
const code = err.code;
|
|
11927
|
+
if (code === "ENOENT") {
|
|
11928
|
+
await new Promise((r) => setTimeout(r, 100));
|
|
11929
|
+
return await execFileAsync3("git", args, opts);
|
|
11930
|
+
}
|
|
11931
|
+
throw err;
|
|
11932
|
+
}
|
|
11933
|
+
}
|
|
11904
11934
|
var import_child_process3, import_util8, import_promises2, import_path19, import_os, execFileAsync3, WorktreeManager;
|
|
11905
11935
|
var init_worktree_manager = __esm({
|
|
11906
11936
|
"packages/orchestrator/src/worktree-manager.ts"() {
|
|
@@ -11918,12 +11948,12 @@ var init_worktree_manager = __esm({
|
|
|
11918
11948
|
async create(taskId) {
|
|
11919
11949
|
const branch = `gossip-${taskId}`;
|
|
11920
11950
|
const wtPath = await (0, import_promises2.mkdtemp)((0, import_path19.join)((0, import_os.tmpdir)(), "gossip-wt-"));
|
|
11921
|
-
await
|
|
11951
|
+
await execGit(["branch", branch, "HEAD"], this.projectRoot);
|
|
11922
11952
|
try {
|
|
11923
|
-
await
|
|
11953
|
+
await execGit(["worktree", "add", wtPath, branch], this.projectRoot);
|
|
11924
11954
|
} catch (err) {
|
|
11925
11955
|
try {
|
|
11926
|
-
await
|
|
11956
|
+
await execGit(["branch", "-D", branch], this.projectRoot);
|
|
11927
11957
|
} catch {
|
|
11928
11958
|
}
|
|
11929
11959
|
throw err;
|
|
@@ -11932,14 +11962,14 @@ var init_worktree_manager = __esm({
|
|
|
11932
11962
|
}
|
|
11933
11963
|
async merge(taskId) {
|
|
11934
11964
|
const branch = `gossip-${taskId}`;
|
|
11935
|
-
const log4 = await
|
|
11965
|
+
const log4 = await execGit(["log", `HEAD..${branch}`, "--oneline"], this.projectRoot);
|
|
11936
11966
|
if (!log4.stdout.trim()) return { merged: true };
|
|
11937
11967
|
try {
|
|
11938
|
-
await
|
|
11968
|
+
await execGit(["merge", branch, "--no-edit"], this.projectRoot);
|
|
11939
11969
|
return { merged: true };
|
|
11940
11970
|
} catch {
|
|
11941
|
-
await
|
|
11942
|
-
const diff = await
|
|
11971
|
+
await execGit(["merge", "--abort"], this.projectRoot);
|
|
11972
|
+
const diff = await execGit(["diff", "--name-only", `HEAD...${branch}`], this.projectRoot);
|
|
11943
11973
|
const files = diff.stdout.trim();
|
|
11944
11974
|
return { merged: false, conflicts: files ? files.split("\n") : [] };
|
|
11945
11975
|
}
|
|
@@ -11947,30 +11977,30 @@ var init_worktree_manager = __esm({
|
|
|
11947
11977
|
async cleanup(taskId, wtPath) {
|
|
11948
11978
|
const branch = `gossip-${taskId}`;
|
|
11949
11979
|
try {
|
|
11950
|
-
await
|
|
11980
|
+
await execGit(["worktree", "remove", wtPath, "--force"], this.projectRoot);
|
|
11951
11981
|
} catch {
|
|
11952
11982
|
}
|
|
11953
11983
|
try {
|
|
11954
|
-
await
|
|
11984
|
+
await execGit(["branch", "-D", branch], this.projectRoot);
|
|
11955
11985
|
} catch {
|
|
11956
11986
|
}
|
|
11957
11987
|
}
|
|
11958
11988
|
async pruneOrphans() {
|
|
11959
11989
|
try {
|
|
11960
|
-
const result = await
|
|
11990
|
+
const result = await execGit(["worktree", "list", "--porcelain"], this.projectRoot);
|
|
11961
11991
|
const orphans = result.stdout.split("\n\n").filter((block) => block.includes("gossip-wt-")).map((block) => block.match(/worktree (.+)/)?.[1]).filter(Boolean);
|
|
11962
11992
|
for (const wtPath of orphans) {
|
|
11963
11993
|
try {
|
|
11964
|
-
await
|
|
11994
|
+
await execGit(["worktree", "remove", wtPath, "--force"], this.projectRoot);
|
|
11965
11995
|
} catch {
|
|
11966
11996
|
}
|
|
11967
11997
|
}
|
|
11968
|
-
await
|
|
11969
|
-
const branchResult = await
|
|
11998
|
+
await execGit(["worktree", "prune"], this.projectRoot);
|
|
11999
|
+
const branchResult = await execGit(["branch", "--list", "gossip-*"], this.projectRoot);
|
|
11970
12000
|
const branches = branchResult.stdout.trim().split("\n").map((b) => b.trim().replace(/^\*\s*/, "")).filter(Boolean);
|
|
11971
12001
|
for (const b of branches) {
|
|
11972
12002
|
try {
|
|
11973
|
-
await
|
|
12003
|
+
await execGit(["branch", "-D", b], this.projectRoot);
|
|
11974
12004
|
} catch {
|
|
11975
12005
|
}
|
|
11976
12006
|
}
|
|
@@ -21620,7 +21650,7 @@ function expandTmpVariants(path2) {
|
|
|
21620
21650
|
}
|
|
21621
21651
|
return [p];
|
|
21622
21652
|
}
|
|
21623
|
-
function buildAuditExclusions(projectRoot, ownWorktree) {
|
|
21653
|
+
function buildAuditExclusions(projectRoot, ownWorktree, scope) {
|
|
21624
21654
|
const excl = /* @__PURE__ */ new Set();
|
|
21625
21655
|
const root = canonicalize(projectRoot);
|
|
21626
21656
|
for (const v of expandTmpVariants(`${root}/.gossip`)) excl.add(v);
|
|
@@ -21635,7 +21665,7 @@ function buildAuditExclusions(projectRoot, ownWorktree) {
|
|
|
21635
21665
|
}
|
|
21636
21666
|
try {
|
|
21637
21667
|
const tmp = canonicalize((0, import_os2.tmpdir)());
|
|
21638
|
-
for (const pat of ["com.apple.*", "itunescloudd", "TemporaryItems"]) {
|
|
21668
|
+
for (const pat of ["com.apple.*", "itunescloudd", "TemporaryItems", "node-compile-cache"]) {
|
|
21639
21669
|
for (const v of expandTmpVariants(`${tmp}/${pat}`)) excl.add(v);
|
|
21640
21670
|
}
|
|
21641
21671
|
} catch {
|
|
@@ -21644,6 +21674,10 @@ function buildAuditExclusions(projectRoot, ownWorktree) {
|
|
|
21644
21674
|
const wt = canonicalize(ownWorktree);
|
|
21645
21675
|
for (const v of expandTmpVariants(wt)) excl.add(v);
|
|
21646
21676
|
}
|
|
21677
|
+
if (scope) {
|
|
21678
|
+
const s = canonicalize((0, import_path38.join)(projectRoot, scope));
|
|
21679
|
+
for (const v of expandTmpVariants(s)) excl.add(v);
|
|
21680
|
+
}
|
|
21647
21681
|
return Array.from(excl);
|
|
21648
21682
|
}
|
|
21649
21683
|
function buildFindPruneArgs(scanRoot, exclusions, sentinel) {
|
|
@@ -21687,7 +21721,7 @@ function auditFilesystemSinceSentinel(projectRoot, meta3, options = {}) {
|
|
|
21687
21721
|
options.writeMode ?? meta3.writeMode,
|
|
21688
21722
|
projectRoot
|
|
21689
21723
|
);
|
|
21690
|
-
const exclusions = buildAuditExclusions(projectRoot, meta3.worktreePath);
|
|
21724
|
+
const exclusions = buildAuditExclusions(projectRoot, meta3.worktreePath, options.scope);
|
|
21691
21725
|
const findBin = options.findBinary ?? "find";
|
|
21692
21726
|
const violations = [];
|
|
21693
21727
|
for (const root of scanRoots) {
|
|
@@ -21768,7 +21802,8 @@ function runLayer3Audit(projectRoot, taskId) {
|
|
|
21768
21802
|
}
|
|
21769
21803
|
try {
|
|
21770
21804
|
const l3 = auditFilesystemSinceSentinel(projectRoot, meta3, {
|
|
21771
|
-
writeMode: meta3.writeMode
|
|
21805
|
+
writeMode: meta3.writeMode,
|
|
21806
|
+
scope: meta3.scope
|
|
21772
21807
|
});
|
|
21773
21808
|
if (l3.violations && l3.violations.length > 0) {
|
|
21774
21809
|
const list = l3.violations.slice(0, 20).join(", ");
|
package/package.json
CHANGED