@workit-dev/mcp 1.7.5 → 1.8.1
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/index.js +140 -77
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -6623,7 +6623,7 @@ import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
|
6623
6623
|
import path30 from "node:path";
|
|
6624
6624
|
|
|
6625
6625
|
// packages/workit-mcp/src/server.ts
|
|
6626
|
-
import { existsSync as existsSync12, readFileSync as
|
|
6626
|
+
import { existsSync as existsSync12, readFileSync as readFileSync10, realpathSync as realpathSync9 } from "node:fs";
|
|
6627
6627
|
import path29 from "node:path";
|
|
6628
6628
|
|
|
6629
6629
|
// node_modules/zod/v4/core/util.js
|
|
@@ -14936,7 +14936,7 @@ class StdioServerTransport {
|
|
|
14936
14936
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
14937
14937
|
|
|
14938
14938
|
// packages/workit-core/src/core.ts
|
|
14939
|
-
import { spawnSync as
|
|
14939
|
+
import { spawnSync as spawnSync20 } from "node:child_process";
|
|
14940
14940
|
import { existsSync as existsSync11, realpathSync as realpathSync8 } from "node:fs";
|
|
14941
14941
|
import path28 from "node:path";
|
|
14942
14942
|
|
|
@@ -16700,15 +16700,14 @@ var gitContext = (workspaceRoot, paths = []) => {
|
|
|
16700
16700
|
};
|
|
16701
16701
|
|
|
16702
16702
|
// packages/workit-core/src/core/workspaces.ts
|
|
16703
|
-
import { spawnSync as
|
|
16703
|
+
import { spawnSync as spawnSync6 } from "node:child_process";
|
|
16704
16704
|
import { createHash as createHash3 } from "node:crypto";
|
|
16705
|
-
import { existsSync as existsSync2, lstatSync as lstatSync2, readFileSync as
|
|
16705
|
+
import { existsSync as existsSync2, lstatSync as lstatSync2, readFileSync as readFileSync4, realpathSync as realpathSync2 } from "node:fs";
|
|
16706
16706
|
import path7 from "node:path";
|
|
16707
16707
|
|
|
16708
16708
|
// packages/workit-core/src/core/remotes.ts
|
|
16709
|
-
import { lstatSync, readFileSync as
|
|
16710
|
-
import { spawnSync as
|
|
16711
|
-
import os3 from "node:os";
|
|
16709
|
+
import { lstatSync, readFileSync as readFileSync3, realpathSync, statSync } from "node:fs";
|
|
16710
|
+
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
16712
16711
|
import path6 from "node:path";
|
|
16713
16712
|
|
|
16714
16713
|
// packages/workit-core/src/git/rev.ts
|
|
@@ -17531,6 +17530,56 @@ function resolveSshHost(alias, sshConfig) {
|
|
|
17531
17530
|
return { hostname: (hostname ?? alias).replace(/\.$/u, ""), port };
|
|
17532
17531
|
}
|
|
17533
17532
|
|
|
17533
|
+
// packages/workit-core/src/core/account-home.ts
|
|
17534
|
+
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
17535
|
+
import { readFileSync as readFileSync2 } from "node:fs";
|
|
17536
|
+
import os3 from "node:os";
|
|
17537
|
+
var WINDOWS = "C:\\Windows";
|
|
17538
|
+
var SYSTEM32 = `${WINDOWS}\\System32\\`;
|
|
17539
|
+
var PROFILES = "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\";
|
|
17540
|
+
var childEnv = (platform) => platform === "win32" ? { SystemRoot: WINDOWS } : {};
|
|
17541
|
+
var hostIo = {
|
|
17542
|
+
bun: Boolean(process.versions.bun),
|
|
17543
|
+
uid: process.getuid?.() ?? -1,
|
|
17544
|
+
userInfo: () => os3.userInfo().homedir,
|
|
17545
|
+
passwd: () => readFileSync2("/etc/passwd", "utf8"),
|
|
17546
|
+
run: (file, args) => {
|
|
17547
|
+
const done = spawnSync4(file, args, {
|
|
17548
|
+
encoding: "utf8",
|
|
17549
|
+
env: childEnv(process.platform),
|
|
17550
|
+
timeout: 3000,
|
|
17551
|
+
windowsHide: true
|
|
17552
|
+
});
|
|
17553
|
+
return done.status === 0 ? done.stdout : "";
|
|
17554
|
+
}
|
|
17555
|
+
};
|
|
17556
|
+
var field = (text, uid, at) => text.split(`
|
|
17557
|
+
`).filter((line) => !line.startsWith("#")).map((line) => line.split(":")).find((fields) => fields[2] === uid)?.[at];
|
|
17558
|
+
var profilePath = (raw) => {
|
|
17559
|
+
const value = raw.replaceAll(/%SystemDrive%/giu, WINDOWS.slice(0, 2)).replaceAll(/%SystemRoot%/giu, WINDOWS);
|
|
17560
|
+
return /^[A-Za-z]:\\/u.test(value) && !value.includes("%") ? value : null;
|
|
17561
|
+
};
|
|
17562
|
+
var accountHome = (platform = process.platform, io = hostIo) => {
|
|
17563
|
+
try {
|
|
17564
|
+
if (!io.bun)
|
|
17565
|
+
return io.userInfo() || null;
|
|
17566
|
+
if (platform === "win32") {
|
|
17567
|
+
const sid = /S-1-[\d-]+/u.exec(io.run(`${SYSTEM32}whoami.exe`, ["/user", "/fo", "csv"]));
|
|
17568
|
+
const key = sid && io.run(`${SYSTEM32}reg.exe`, ["query", PROFILES + sid[0], "/v", "ProfileImagePath"]);
|
|
17569
|
+
const raw = /ProfileImagePath\s+REG_\w+\s+(.+)/u.exec(key || "")?.[1]?.trim();
|
|
17570
|
+
return raw ? profilePath(raw) : null;
|
|
17571
|
+
}
|
|
17572
|
+
const uid = String(io.uid);
|
|
17573
|
+
let passwd = "";
|
|
17574
|
+
try {
|
|
17575
|
+
passwd = io.passwd();
|
|
17576
|
+
} catch {}
|
|
17577
|
+
return field(passwd, uid, 5) || (platform === "darwin" ? field(io.run("/usr/bin/id", ["-P"]), uid, 8) : field(io.run("/usr/bin/getent", ["passwd", uid]), uid, 5)) || null;
|
|
17578
|
+
} catch {
|
|
17579
|
+
return null;
|
|
17580
|
+
}
|
|
17581
|
+
};
|
|
17582
|
+
|
|
17534
17583
|
// packages/workit-core/src/core/remotes.ts
|
|
17535
17584
|
var FORGE_SCHEMES = new Set(["ssh", "git", "http", "https", "git+ssh", "ssh+git"]);
|
|
17536
17585
|
var SSH_SCHEMES = new Set(["ssh", "git+ssh", "ssh+git"]);
|
|
@@ -17540,15 +17589,11 @@ var SSH_443 = {
|
|
|
17540
17589
|
};
|
|
17541
17590
|
var WINDOWS_DRIVE = /^[A-Za-z]:[\\/]/u;
|
|
17542
17591
|
var SCP_LIKE = /^(?:[^@/\\]+@)?([^/\\:]+):(.+)$/u;
|
|
17543
|
-
var accountHome = () => {
|
|
17544
|
-
try {
|
|
17545
|
-
return os3.userInfo().homedir;
|
|
17546
|
-
} catch {
|
|
17547
|
-
return os3.homedir();
|
|
17548
|
-
}
|
|
17549
|
-
};
|
|
17550
17592
|
var sshSeam = {
|
|
17551
|
-
read: () =>
|
|
17593
|
+
read: () => {
|
|
17594
|
+
const home = accountHome();
|
|
17595
|
+
return home === null ? { text: "", home: "" } : readSshConfig(home);
|
|
17596
|
+
}
|
|
17552
17597
|
};
|
|
17553
17598
|
var forgeKey = (rawHost, repo, ssh) => {
|
|
17554
17599
|
let host = rawHost.toLowerCase().replace(/\.$/u, "");
|
|
@@ -17595,7 +17640,7 @@ var gitDirAt = (at, depth = 0) => {
|
|
|
17595
17640
|
return null;
|
|
17596
17641
|
try {
|
|
17597
17642
|
if (statSync(real).isFile()) {
|
|
17598
|
-
const pointer = /^gitdir:\s*(.+?)\s*$/mu.exec(
|
|
17643
|
+
const pointer = /^gitdir:\s*(.+?)\s*$/mu.exec(readFileSync3(real, "utf8"))?.[1];
|
|
17599
17644
|
if (!pointer)
|
|
17600
17645
|
return null;
|
|
17601
17646
|
const target = path6.isAbsolute(pointer) ? pointer : `${path6.dirname(real)}/${pointer}`;
|
|
@@ -17603,7 +17648,7 @@ var gitDirAt = (at, depth = 0) => {
|
|
|
17603
17648
|
}
|
|
17604
17649
|
let common;
|
|
17605
17650
|
try {
|
|
17606
|
-
common =
|
|
17651
|
+
common = readFileSync3(`${real}/commondir`, "utf8").trim();
|
|
17607
17652
|
} catch {}
|
|
17608
17653
|
if (common !== undefined) {
|
|
17609
17654
|
lstatSync(`${real}/HEAD`);
|
|
@@ -17707,7 +17752,7 @@ var checkoutRemotes = (cwd) => {
|
|
|
17707
17752
|
const env = { ...process.env };
|
|
17708
17753
|
for (const name of ["GIT_DIR", "GIT_WORK_TREE", "GIT_COMMON_DIR", "GIT_INDEX_FILE"])
|
|
17709
17754
|
delete env[name];
|
|
17710
|
-
const git = (args) =>
|
|
17755
|
+
const git = (args) => spawnSync5("git", args, {
|
|
17711
17756
|
cwd,
|
|
17712
17757
|
env,
|
|
17713
17758
|
encoding: "utf8",
|
|
@@ -17943,7 +17988,7 @@ var readWorkspacesResult = (dir = configDir2()) => {
|
|
|
17943
17988
|
const file = path7.join(dir, "workspaces.json");
|
|
17944
17989
|
let raw;
|
|
17945
17990
|
try {
|
|
17946
|
-
raw =
|
|
17991
|
+
raw = readFileSync4(file, "utf8");
|
|
17947
17992
|
} catch (error) {
|
|
17948
17993
|
if (error.code === "ENOENT")
|
|
17949
17994
|
return {
|
|
@@ -18064,7 +18109,7 @@ var probeCheckout = (cwd) => {
|
|
|
18064
18109
|
for (const name of ["GIT_DIR", "GIT_WORK_TREE", "GIT_COMMON_DIR", "GIT_INDEX_FILE"])
|
|
18065
18110
|
delete env[name];
|
|
18066
18111
|
const git = (args) => {
|
|
18067
|
-
const run =
|
|
18112
|
+
const run = spawnSync6("git", args, {
|
|
18068
18113
|
cwd,
|
|
18069
18114
|
env,
|
|
18070
18115
|
encoding: "utf8",
|
|
@@ -18261,7 +18306,7 @@ var matchRuntimeWorkspace = (cwd, dir = configDir2()) => {
|
|
|
18261
18306
|
const file = path7.join(dir, "workspaces.json");
|
|
18262
18307
|
let raw;
|
|
18263
18308
|
try {
|
|
18264
|
-
raw =
|
|
18309
|
+
raw = readFileSync4(file, "utf8");
|
|
18265
18310
|
} catch (error) {
|
|
18266
18311
|
if (error.code === "ENOENT")
|
|
18267
18312
|
return null;
|
|
@@ -18350,11 +18395,11 @@ function workspaceDefaultTarget(cwd, globalDefault) {
|
|
|
18350
18395
|
// packages/workit-core/src/core/vcs-config.ts
|
|
18351
18396
|
import fs4 from "node:fs";
|
|
18352
18397
|
import path8 from "node:path";
|
|
18353
|
-
import { spawnSync as
|
|
18398
|
+
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
18354
18399
|
|
|
18355
18400
|
// packages/workit-core/src/core/release-tracks.ts
|
|
18356
18401
|
import { createHash as createHash4 } from "node:crypto";
|
|
18357
|
-
import { spawnSync as
|
|
18402
|
+
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
18358
18403
|
var KNOWN_FIELDS = new Set([
|
|
18359
18404
|
"strategy",
|
|
18360
18405
|
"productionBranch",
|
|
@@ -18626,7 +18671,7 @@ function resolveReleaseTrack(input) {
|
|
|
18626
18671
|
return fallback(`${branch} has the same or unrelated fork points with ${[...new Set(newest.map((fork) => `${fork.ref} (${fork.track.name === IMPLICIT ? "workspace default" : fork.track.name})`))].join(" and ")}`);
|
|
18627
18672
|
}
|
|
18628
18673
|
var git2 = (cwd, args) => {
|
|
18629
|
-
const run =
|
|
18674
|
+
const run = spawnSync7("git", args, {
|
|
18630
18675
|
cwd,
|
|
18631
18676
|
encoding: "utf8",
|
|
18632
18677
|
timeout: 20000,
|
|
@@ -18775,7 +18820,7 @@ var remoteEndpoint = (remote) => {
|
|
|
18775
18820
|
var configuredSshEndpoint = (host) => {
|
|
18776
18821
|
if (host.startsWith("-"))
|
|
18777
18822
|
return null;
|
|
18778
|
-
const resolved =
|
|
18823
|
+
const resolved = spawnSync8("ssh", ["-G", host], {
|
|
18779
18824
|
encoding: "utf8",
|
|
18780
18825
|
timeout: 5000,
|
|
18781
18826
|
maxBuffer: 1024 * 1024,
|
|
@@ -18989,7 +19034,7 @@ function mergedPrStyle(limit = 6, cwd) {
|
|
|
18989
19034
|
`).filter((l) => l.startsWith("## ")).map((l) => l.trim()),
|
|
18990
19035
|
descriptionPreview: desc.slice(0, 600)
|
|
18991
19036
|
});
|
|
18992
|
-
const remoteResult =
|
|
19037
|
+
const remoteResult = spawnSync8("git", ["remote", "get-url", "--push", "--all", "origin"], {
|
|
18993
19038
|
cwd,
|
|
18994
19039
|
encoding: "utf8"
|
|
18995
19040
|
});
|
|
@@ -19005,7 +19050,7 @@ function mergedPrStyle(limit = 6, cwd) {
|
|
|
19005
19050
|
if (!hostingApiHostMatches(remote, host))
|
|
19006
19051
|
return { ok: false, error: "PR style target does not match the provider host" };
|
|
19007
19052
|
if (provider === "gitlab") {
|
|
19008
|
-
const run = (args) =>
|
|
19053
|
+
const run = (args) => spawnSync8("glab", ["api", ...args], {
|
|
19009
19054
|
cwd,
|
|
19010
19055
|
encoding: "utf8",
|
|
19011
19056
|
env
|
|
@@ -19025,7 +19070,7 @@ function mergedPrStyle(limit = 6, cwd) {
|
|
|
19025
19070
|
});
|
|
19026
19071
|
}
|
|
19027
19072
|
} else if (provider === "github") {
|
|
19028
|
-
const r =
|
|
19073
|
+
const r = spawnSync8("gh", [
|
|
19029
19074
|
"pr",
|
|
19030
19075
|
"list",
|
|
19031
19076
|
"--repo",
|
|
@@ -19116,13 +19161,13 @@ var applyPatterns = (value) => {
|
|
|
19116
19161
|
var redactSecrets = (value) => applyPatterns(value);
|
|
19117
19162
|
|
|
19118
19163
|
// packages/workit-core/src/store/paths.ts
|
|
19119
|
-
import { spawnSync as
|
|
19164
|
+
import { spawnSync as spawnSync9 } from "node:child_process";
|
|
19120
19165
|
import { createHash as createHash5 } from "node:crypto";
|
|
19121
19166
|
import fs5 from "node:fs";
|
|
19122
19167
|
import path9 from "node:path";
|
|
19123
19168
|
var NOT_A_REPO = /not a git repository \(or any (of the parent directories|parent up to)/u;
|
|
19124
19169
|
var gitRun = (cwd, args) => {
|
|
19125
|
-
const run =
|
|
19170
|
+
const run = spawnSync9("git", args, {
|
|
19126
19171
|
cwd,
|
|
19127
19172
|
encoding: "utf8",
|
|
19128
19173
|
timeout: 20000,
|
|
@@ -20546,7 +20591,7 @@ var assetRoot = () => {
|
|
|
20546
20591
|
};
|
|
20547
20592
|
|
|
20548
20593
|
// packages/workit-core/src/core/store-lock.ts
|
|
20549
|
-
import { spawnSync as
|
|
20594
|
+
import { spawnSync as spawnSync10 } from "node:child_process";
|
|
20550
20595
|
import fs11 from "node:fs";
|
|
20551
20596
|
import { hostname } from "node:os";
|
|
20552
20597
|
var metadataLockSchema = object({
|
|
@@ -20597,7 +20642,7 @@ var readProcStat = (pid) => {
|
|
|
20597
20642
|
};
|
|
20598
20643
|
var psStart = (pid) => {
|
|
20599
20644
|
try {
|
|
20600
|
-
const run =
|
|
20645
|
+
const run = spawnSync10("ps", ["-o", "lstart=", "-p", String(pid)], {
|
|
20601
20646
|
encoding: "utf8",
|
|
20602
20647
|
timeout: 1000,
|
|
20603
20648
|
env: { ...process.env, LC_ALL: "C" }
|
|
@@ -22605,11 +22650,11 @@ var workerBlocksTransition = (transition, state) => transition === "pause" ? fal
|
|
|
22605
22650
|
// packages/workit-core/src/core/task-evaluation.ts
|
|
22606
22651
|
import { createHash as createHash10 } from "node:crypto";
|
|
22607
22652
|
import * as fs16 from "node:fs";
|
|
22608
|
-
import { spawnSync as
|
|
22653
|
+
import { spawnSync as spawnSync15 } from "node:child_process";
|
|
22609
22654
|
import path21 from "node:path";
|
|
22610
22655
|
|
|
22611
22656
|
// packages/workit-core/src/check-config.ts
|
|
22612
|
-
import { spawnSync as
|
|
22657
|
+
import { spawnSync as spawnSync11 } from "node:child_process";
|
|
22613
22658
|
import fs14 from "node:fs";
|
|
22614
22659
|
import path17 from "node:path";
|
|
22615
22660
|
var SCRIPT_CHECKS = ["test", "lint", "typecheck", "check"];
|
|
@@ -22664,7 +22709,7 @@ function splitCommand(command) {
|
|
|
22664
22709
|
return argv.length ? argv : new Error("empty command");
|
|
22665
22710
|
}
|
|
22666
22711
|
var git3 = (cwd, args) => {
|
|
22667
|
-
const run =
|
|
22712
|
+
const run = spawnSync11("git", args, {
|
|
22668
22713
|
cwd,
|
|
22669
22714
|
encoding: "utf8",
|
|
22670
22715
|
timeout: 20000,
|
|
@@ -22957,19 +23002,19 @@ import { existsSync as existsSync7 } from "node:fs";
|
|
|
22957
23002
|
import path20 from "node:path";
|
|
22958
23003
|
|
|
22959
23004
|
// packages/workit-core/src/ledger.ts
|
|
22960
|
-
import { spawnSync as
|
|
23005
|
+
import { spawnSync as spawnSync14 } from "node:child_process";
|
|
22961
23006
|
import { createHash as createHash9, randomBytes as randomBytes3 } from "node:crypto";
|
|
22962
23007
|
import fs15 from "node:fs";
|
|
22963
23008
|
import path19 from "node:path";
|
|
22964
23009
|
|
|
22965
23010
|
// packages/workit-core/src/core/policy/bookkeeping.ts
|
|
22966
|
-
import { spawnSync as
|
|
23011
|
+
import { spawnSync as spawnSync12 } from "node:child_process";
|
|
22967
23012
|
var OID = /^[0-9a-f]{40,64}$/u;
|
|
22968
23013
|
var safe = (value) => value.length > 0 && !value.startsWith("-");
|
|
22969
23014
|
function replayTree(cwd, from, fromFork, toFork) {
|
|
22970
23015
|
if (![from, fromFork, toFork].every(safe))
|
|
22971
23016
|
return null;
|
|
22972
|
-
const run =
|
|
23017
|
+
const run = spawnSync12("git", ["merge-tree", "--write-tree", "--no-messages", `--merge-base=${fromFork}`, toFork, from], {
|
|
22973
23018
|
cwd,
|
|
22974
23019
|
encoding: "utf8",
|
|
22975
23020
|
timeout: GIT_TIMEOUTS.worktree,
|
|
@@ -23040,11 +23085,11 @@ function bookkeepingPaths(cwd, input) {
|
|
|
23040
23085
|
}
|
|
23041
23086
|
|
|
23042
23087
|
// packages/workit-core/src/core/policy/lane.ts
|
|
23043
|
-
import { existsSync as existsSync6, readFileSync as
|
|
23088
|
+
import { existsSync as existsSync6, readFileSync as readFileSync7 } from "node:fs";
|
|
23044
23089
|
import path18 from "node:path";
|
|
23045
23090
|
|
|
23046
23091
|
// packages/workit-core/src/git/default-base.ts
|
|
23047
|
-
import { spawnSync as
|
|
23092
|
+
import { spawnSync as spawnSync13 } from "node:child_process";
|
|
23048
23093
|
var safeRef = (value) => value.length > 0 && !value.startsWith("-");
|
|
23049
23094
|
var trackTrunk = (cwd) => {
|
|
23050
23095
|
try {
|
|
@@ -23094,7 +23139,7 @@ var shorten = (table, full) => {
|
|
|
23094
23139
|
return full;
|
|
23095
23140
|
};
|
|
23096
23141
|
function refTable(cwd) {
|
|
23097
|
-
const run =
|
|
23142
|
+
const run = spawnSync13("git", ["for-each-ref", "--format=%(refname)%00%(objecttype)%00%(*objecttype)%00%(symref)"], { cwd, encoding: "utf8", timeout: 20000, killSignal: "SIGKILL", windowsHide: true });
|
|
23098
23143
|
if (run.status !== 0)
|
|
23099
23144
|
return null;
|
|
23100
23145
|
const refs = new Map;
|
|
@@ -23695,7 +23740,7 @@ function computeLane(input) {
|
|
|
23695
23740
|
}
|
|
23696
23741
|
function untrackedStat(cwd, file) {
|
|
23697
23742
|
try {
|
|
23698
|
-
const bytes =
|
|
23743
|
+
const bytes = readFileSync7(path18.join(cwd, file));
|
|
23699
23744
|
if (bytes.includes(0))
|
|
23700
23745
|
return { path: file, added: 0, deleted: 0, binary: true };
|
|
23701
23746
|
const text = bytes.toString("utf8");
|
|
@@ -23726,7 +23771,7 @@ function cosmeticFiles(cwd, fork, head) {
|
|
|
23726
23771
|
let after = blobs.get(entry.newBlob);
|
|
23727
23772
|
if (!after && head === null && ABSENT.test(entry.newBlob))
|
|
23728
23773
|
try {
|
|
23729
|
-
after =
|
|
23774
|
+
after = readFileSync7(path18.join(cwd, entry.path));
|
|
23730
23775
|
} catch {
|
|
23731
23776
|
after = undefined;
|
|
23732
23777
|
}
|
|
@@ -23891,7 +23936,7 @@ var err = (code, error, unblock) => ({
|
|
|
23891
23936
|
...unblock ? { unblock } : {}
|
|
23892
23937
|
});
|
|
23893
23938
|
var gitRun2 = (cwd, args, timeoutMs = GIT_TIMEOUTS.local) => {
|
|
23894
|
-
const run =
|
|
23939
|
+
const run = spawnSync14("git", args, {
|
|
23895
23940
|
cwd,
|
|
23896
23941
|
encoding: "utf8",
|
|
23897
23942
|
timeout: timeoutMs,
|
|
@@ -25192,7 +25237,7 @@ var compareCodeUnits2 = (left, right) => {
|
|
|
25192
25237
|
return left.length - right.length;
|
|
25193
25238
|
};
|
|
25194
25239
|
var gitPaths = (root) => {
|
|
25195
|
-
const result =
|
|
25240
|
+
const result = spawnSync15("git", ["ls-files", "-z", "--cached", "--others", "--exclude-standard"], {
|
|
25196
25241
|
cwd: root,
|
|
25197
25242
|
encoding: "buffer"
|
|
25198
25243
|
});
|
|
@@ -25205,7 +25250,7 @@ var gitPaths = (root) => {
|
|
|
25205
25250
|
};
|
|
25206
25251
|
}
|
|
25207
25252
|
const paths = result.stdout ? result.stdout.toString("utf8").split("\x00").filter(Boolean).map((item) => item.split(path21.sep).join("/")) : [];
|
|
25208
|
-
const stagedDeleted =
|
|
25253
|
+
const stagedDeleted = spawnSync15("git", ["diff", "--cached", "--name-only", "--diff-filter=D", "-z"], { cwd: root, encoding: "buffer" });
|
|
25209
25254
|
if (stagedDeleted.status !== 0) {
|
|
25210
25255
|
const stderr = stagedDeleted.stderr?.toString("utf8") ?? "";
|
|
25211
25256
|
if (!/not a git repository/i.test(stderr))
|
|
@@ -25336,7 +25381,7 @@ function captureCandidate(root, scope, environment = []) {
|
|
|
25336
25381
|
const values = supplied.toSorted((left, right) => compareCodeUnits2(left.name, right.name)).map(({ name, value }) => ({ name, value, refs: [] }));
|
|
25337
25382
|
if (values.some(({ value }) => value === null))
|
|
25338
25383
|
completeness = "uncertain";
|
|
25339
|
-
const headResult =
|
|
25384
|
+
const headResult = spawnSync15("git", ["rev-parse", "HEAD"], { cwd: checkout, encoding: "utf8" });
|
|
25340
25385
|
if (headResult.status !== 0 && !/not a git repository/i.test(headResult.stderr ?? ""))
|
|
25341
25386
|
completeness = "uncertain";
|
|
25342
25387
|
const head = headResult.status === 0 ? headResult.stdout.trim() : null;
|
|
@@ -26157,7 +26202,6 @@ var exportDigest = (bundle) => sha256({
|
|
|
26157
26202
|
task: bundle.task
|
|
26158
26203
|
});
|
|
26159
26204
|
// packages/workit-core/src/autonomy.ts
|
|
26160
|
-
import os6 from "node:os";
|
|
26161
26205
|
import path23 from "node:path";
|
|
26162
26206
|
|
|
26163
26207
|
// packages/workit-core/src/core/eval-world.ts
|
|
@@ -26170,30 +26214,43 @@ var inside2 = (dir, file) => {
|
|
|
26170
26214
|
const rel = path22.relative(dir, file);
|
|
26171
26215
|
return !rel.startsWith("..") && !path22.isAbsolute(rel);
|
|
26172
26216
|
};
|
|
26173
|
-
var
|
|
26217
|
+
var evalWorld = (cwd) => {
|
|
26174
26218
|
const raw = process.env[EVAL_WORLD_ENV];
|
|
26175
26219
|
if (!raw || !path22.isAbsolute(raw))
|
|
26176
26220
|
return null;
|
|
26177
26221
|
try {
|
|
26178
26222
|
const world = realpathSync5(raw);
|
|
26179
|
-
|
|
26180
|
-
return null;
|
|
26181
|
-
return loadWorkspacesFrom(path22.join(world, "config"))[0] ?? null;
|
|
26223
|
+
return inside2(realpathSync5(os5.tmpdir()), world) && inside2(world, realpathSync5(cwd)) && existsSync9(path22.join(world, EVAL_WORLD_MARKER)) ? world : null;
|
|
26182
26224
|
} catch {
|
|
26183
26225
|
return null;
|
|
26184
26226
|
}
|
|
26185
26227
|
};
|
|
26186
|
-
|
|
26187
|
-
|
|
26188
|
-
var accountHome2 = () => {
|
|
26228
|
+
var evalWorldEntry = (cwd) => {
|
|
26229
|
+
const world = evalWorld(cwd);
|
|
26189
26230
|
try {
|
|
26190
|
-
return
|
|
26231
|
+
return world ? loadWorkspacesFrom(path22.join(world, "config"))[0] ?? null : null;
|
|
26191
26232
|
} catch {
|
|
26192
|
-
return
|
|
26233
|
+
return null;
|
|
26193
26234
|
}
|
|
26194
26235
|
};
|
|
26195
|
-
|
|
26196
|
-
|
|
26236
|
+
|
|
26237
|
+
// packages/workit-core/src/autonomy.ts
|
|
26238
|
+
var grantsHome = { resolve: accountHome };
|
|
26239
|
+
var accountDir = () => {
|
|
26240
|
+
const home = grantsHome.resolve();
|
|
26241
|
+
return home === null ? null : configDir({ HOME: home });
|
|
26242
|
+
};
|
|
26243
|
+
var grantsDir = () => accountDir() ?? resolveConfigDir();
|
|
26244
|
+
var NO_ACCOUNT = "no OS account record answered (core/account-home.ts), so no grants are read: the D4 defaults apply";
|
|
26245
|
+
var entriesIn = (dir) => dir === null ? [] : loadWorkspacesFrom(dir);
|
|
26246
|
+
var resolveFrom = (cwd, name) => {
|
|
26247
|
+
const dir = accountDir();
|
|
26248
|
+
return dir === null ? null : resolveWorkspaceFrom(cwd, dir, name);
|
|
26249
|
+
};
|
|
26250
|
+
var shownGrantsDir = () => {
|
|
26251
|
+
const world = evalWorld(process.cwd());
|
|
26252
|
+
return world ? path23.join(world, "config") : accountDir();
|
|
26253
|
+
};
|
|
26197
26254
|
var benchWorld = (cwd) => {
|
|
26198
26255
|
const entry = evalWorldEntry(cwd);
|
|
26199
26256
|
if (!entry)
|
|
@@ -26213,8 +26270,11 @@ var benchWorld = (cwd) => {
|
|
|
26213
26270
|
};
|
|
26214
26271
|
};
|
|
26215
26272
|
var grantsOverride = () => {
|
|
26273
|
+
const shown = shownGrantsDir();
|
|
26274
|
+
if (shown === null)
|
|
26275
|
+
return NO_ACCOUNT;
|
|
26216
26276
|
const configured = path23.resolve(resolveConfigDir());
|
|
26217
|
-
return configured === path23.resolve(
|
|
26277
|
+
return configured === path23.resolve(shown) ? null : `the config directory is redirected to ${configured} (WORKIT_CONFIG, WORKIT_CONFIG_DIR or XDG_CONFIG_HOME), but that override does not apply to grants: grants are read only from ${path23.join(grantsDir(), "workspaces.json")}, so the D4 defaults apply until grants are set there`;
|
|
26218
26278
|
};
|
|
26219
26279
|
var GRANT_KINDS = ["push", "pr", "merge", "release", "rerun"];
|
|
26220
26280
|
var DEFAULT_GRANTS = Object.freeze({
|
|
@@ -26340,7 +26400,7 @@ function capAt(named, where, by, why, main = false) {
|
|
|
26340
26400
|
try {
|
|
26341
26401
|
if (where instanceof Error)
|
|
26342
26402
|
throw where;
|
|
26343
|
-
folder = autonomyOf(typeof where === "string" ?
|
|
26403
|
+
folder = autonomyOf(typeof where === "string" ? resolveFrom(where) : where.entry);
|
|
26344
26404
|
} catch (error) {
|
|
26345
26405
|
none = error.message;
|
|
26346
26406
|
}
|
|
@@ -26384,7 +26444,10 @@ function resolveAutonomy(cwd, target) {
|
|
|
26384
26444
|
if (override)
|
|
26385
26445
|
return { ...autonomyOf(null), note: override };
|
|
26386
26446
|
const name = process.env.WORKIT_WORKSPACE_NAME?.trim() || undefined;
|
|
26387
|
-
|
|
26447
|
+
const real = resolveFrom(cwd, name);
|
|
26448
|
+
let autonomy = autonomyOf(real ?? world);
|
|
26449
|
+
if (!real && world)
|
|
26450
|
+
autonomy.world = evalWorld(cwd) ?? undefined;
|
|
26388
26451
|
if (name)
|
|
26389
26452
|
autonomy = capAt(autonomy, cwd, `WORKIT_WORKSPACE_NAME=${name}`, "a name never raises grants");
|
|
26390
26453
|
const above = checkoutsAbove(cwd);
|
|
@@ -26393,7 +26456,7 @@ function resolveAutonomy(cwd, target) {
|
|
|
26393
26456
|
return capAtRemotes(autonomy, cwd, target);
|
|
26394
26457
|
}
|
|
26395
26458
|
function capAtRemotes(autonomy, cwd, target) {
|
|
26396
|
-
const claiming =
|
|
26459
|
+
const claiming = entriesIn(accountDir()).filter((entry) => entry.remotes?.length);
|
|
26397
26460
|
if (claiming.length === 0)
|
|
26398
26461
|
return autonomy;
|
|
26399
26462
|
const remotes = target === undefined ? checkoutRemotes(cwd) : typeof target === "function" ? target() : target;
|
|
@@ -28507,8 +28570,8 @@ class WorkitCore {
|
|
|
28507
28570
|
}
|
|
28508
28571
|
}
|
|
28509
28572
|
// packages/workit-core/src/core/repo-context.ts
|
|
28510
|
-
import { spawnSync as
|
|
28511
|
-
import { existsSync as existsSync10, readFileSync as
|
|
28573
|
+
import { spawnSync as spawnSync16 } from "node:child_process";
|
|
28574
|
+
import { existsSync as existsSync10, readFileSync as readFileSync9, readdirSync as readdirSync4 } from "node:fs";
|
|
28512
28575
|
import path24 from "node:path";
|
|
28513
28576
|
var isSafeContextRange = (value) => value.length <= 4096 && (() => {
|
|
28514
28577
|
try {
|
|
@@ -28536,7 +28599,7 @@ var invalidRange = (cwd) => ({
|
|
|
28536
28599
|
cwd
|
|
28537
28600
|
});
|
|
28538
28601
|
var runGit = (cwd, args) => {
|
|
28539
|
-
const result =
|
|
28602
|
+
const result = spawnSync16("git", args, { cwd, encoding: "utf8" });
|
|
28540
28603
|
return {
|
|
28541
28604
|
stdout: (result.stdout ?? "").trimEnd(),
|
|
28542
28605
|
stderr: (result.stderr ?? "").trimEnd(),
|
|
@@ -28693,7 +28756,7 @@ var packageScripts = (cwd, keys) => {
|
|
|
28693
28756
|
if (!existsSync10(pkgPath))
|
|
28694
28757
|
return [];
|
|
28695
28758
|
try {
|
|
28696
|
-
const pkg = JSON.parse(
|
|
28759
|
+
const pkg = JSON.parse(readFileSync9(pkgPath, "utf8"));
|
|
28697
28760
|
return keys.filter((k) => pkg.scripts && typeof pkg.scripts[k] === "string").map((k) => `${k}: ${pkg.scripts?.[k]}`);
|
|
28698
28761
|
} catch {
|
|
28699
28762
|
return [];
|
|
@@ -28727,7 +28790,7 @@ var documentationFiles = (cwd) => {
|
|
|
28727
28790
|
var readTrimmed2 = (file, maxLines) => {
|
|
28728
28791
|
if (!existsSync10(file))
|
|
28729
28792
|
return "";
|
|
28730
|
-
const lines =
|
|
28793
|
+
const lines = readFileSync9(file, "utf8").split(`
|
|
28731
28794
|
`);
|
|
28732
28795
|
return lines.slice(0, maxLines).join(`
|
|
28733
28796
|
`);
|
|
@@ -28915,7 +28978,7 @@ function docsRefreshContext(root, range) {
|
|
|
28915
28978
|
const pkgPath = path24.join(cwd, "package.json");
|
|
28916
28979
|
if (existsSync10(pkgPath)) {
|
|
28917
28980
|
try {
|
|
28918
|
-
const pkg = JSON.parse(
|
|
28981
|
+
const pkg = JSON.parse(readFileSync9(pkgPath, "utf8"));
|
|
28919
28982
|
stdout += JSON.stringify({ name: pkg.name, version: pkg.version, scripts: pkg.scripts }, null, 2) + `
|
|
28920
28983
|
`;
|
|
28921
28984
|
} catch {}
|
|
@@ -28997,12 +29060,12 @@ function releaseNotesContext(root, rangeOrTag) {
|
|
|
28997
29060
|
}
|
|
28998
29061
|
|
|
28999
29062
|
// packages/workit-core/src/core/tracker-issues.ts
|
|
29000
|
-
import { spawnSync as
|
|
29063
|
+
import { spawnSync as spawnSync18 } from "node:child_process";
|
|
29001
29064
|
|
|
29002
29065
|
// packages/workit-core/src/core/pr-create.ts
|
|
29003
29066
|
import fs17 from "node:fs";
|
|
29004
29067
|
import path25 from "node:path";
|
|
29005
|
-
import { spawnSync as
|
|
29068
|
+
import { spawnSync as spawnSync17 } from "node:child_process";
|
|
29006
29069
|
// packages/workit-core/src/forge/pr-body.ts
|
|
29007
29070
|
function parseGhIssue(value) {
|
|
29008
29071
|
const m = /issues\/(\d+)/.exec(value);
|
|
@@ -29036,7 +29099,7 @@ function whichOnPath(tool) {
|
|
|
29036
29099
|
}
|
|
29037
29100
|
var hostingCliAvailable = (provider) => whichOnPath(provider === "gitlab" ? "glab" : "gh") !== null;
|
|
29038
29101
|
var pushRemote = (cwd) => {
|
|
29039
|
-
const result =
|
|
29102
|
+
const result = spawnSync17("git", ["remote", "get-url", "--push", "--all", "origin"], {
|
|
29040
29103
|
cwd,
|
|
29041
29104
|
...LOCAL
|
|
29042
29105
|
});
|
|
@@ -29067,7 +29130,7 @@ var defaultCli = (bin, available) => {
|
|
|
29067
29130
|
if (!available)
|
|
29068
29131
|
return null;
|
|
29069
29132
|
return (args, root) => {
|
|
29070
|
-
const out =
|
|
29133
|
+
const out = spawnSync18(bin, args, {
|
|
29071
29134
|
cwd: root,
|
|
29072
29135
|
encoding: "utf8",
|
|
29073
29136
|
env: { ...process.env, PATH: process.env.PATH ?? "" }
|
|
@@ -29157,7 +29220,7 @@ var ASSET_ROOT = assetRoot();
|
|
|
29157
29220
|
var resolveWorkspaceRoot = (explicit) => explicit || process.cwd();
|
|
29158
29221
|
|
|
29159
29222
|
// packages/workit-core/src/core/youtrack-ytrack.ts
|
|
29160
|
-
import { spawnSync as
|
|
29223
|
+
import { spawnSync as spawnSync19 } from "node:child_process";
|
|
29161
29224
|
|
|
29162
29225
|
// packages/workit-core/src/forge/exec.ts
|
|
29163
29226
|
import fs18 from "node:fs";
|
|
@@ -29195,7 +29258,7 @@ function ytrackRunner(env, host, timeoutMs = TIMEOUT_MS) {
|
|
|
29195
29258
|
const exe = findYtrack(env);
|
|
29196
29259
|
if (!exe)
|
|
29197
29260
|
return { status: null, stdout: "", stderr: "", missing: true };
|
|
29198
|
-
const result =
|
|
29261
|
+
const result = spawnSync19(exe, args, {
|
|
29199
29262
|
encoding: "utf8",
|
|
29200
29263
|
env: { ...env, NO_COLOR: "1", ...host ? { YTRACK_HOST: host } : {} },
|
|
29201
29264
|
timeout: timeoutMs,
|
|
@@ -29587,7 +29650,7 @@ function resolveInside(root, candidate) {
|
|
|
29587
29650
|
}
|
|
29588
29651
|
function run2(root, executable, args, env = {}) {
|
|
29589
29652
|
const cwd = realpathSync8(root);
|
|
29590
|
-
const result =
|
|
29653
|
+
const result = spawnSync20(executable, args, {
|
|
29591
29654
|
cwd,
|
|
29592
29655
|
encoding: "utf8",
|
|
29593
29656
|
env: { ...process.env, ...env }
|
|
@@ -29677,7 +29740,7 @@ var safeCapability = (value, allowed) => allowed.includes(value) ? value : "cont
|
|
|
29677
29740
|
var TOOL_CAPABILITIES = [...CONTEXT_KINDS, "workspace", "native_caller_identity"];
|
|
29678
29741
|
var VERSION = (() => {
|
|
29679
29742
|
try {
|
|
29680
|
-
const packageJson = JSON.parse(
|
|
29743
|
+
const packageJson = JSON.parse(readFileSync10(new URL("../package.json", import.meta.url), "utf8"));
|
|
29681
29744
|
return typeof packageJson.version === "string" ? packageJson.version : "0.0.0";
|
|
29682
29745
|
} catch {
|
|
29683
29746
|
return "0.0.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workit-dev/mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Workit shared MCP transport for the eight task and policy operation families",
|
|
6
6
|
"keywords": [
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@modelcontextprotocol/sdk": "1.32.0",
|
|
47
|
-
"@workit-dev/core": "^1.
|
|
47
|
+
"@workit-dev/core": "^1.8.1",
|
|
48
48
|
"zod": "4.6.5"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|