@workit-dev/mcp 1.9.3 → 1.12.0
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 +193 -68
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -6620,11 +6620,11 @@ var require_dist = __commonJS(function(exports, module) {
|
|
|
6620
6620
|
|
|
6621
6621
|
// packages/workit-mcp/src/index.ts
|
|
6622
6622
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
6623
|
-
import
|
|
6623
|
+
import path31 from "node:path";
|
|
6624
6624
|
|
|
6625
6625
|
// packages/workit-mcp/src/server.ts
|
|
6626
|
-
import { existsSync as existsSync12, readFileSync as
|
|
6627
|
-
import
|
|
6626
|
+
import { existsSync as existsSync12, readFileSync as readFileSync11, realpathSync as realpathSync9 } from "node:fs";
|
|
6627
|
+
import path30 from "node:path";
|
|
6628
6628
|
|
|
6629
6629
|
// node_modules/zod/v4/core/util.js
|
|
6630
6630
|
function getEnumValues(entries) {
|
|
@@ -14938,7 +14938,7 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
|
14938
14938
|
// packages/workit-core/src/core.ts
|
|
14939
14939
|
import { spawnSync as spawnSync20 } from "node:child_process";
|
|
14940
14940
|
import { existsSync as existsSync11, realpathSync as realpathSync8 } from "node:fs";
|
|
14941
|
-
import
|
|
14941
|
+
import path29 from "node:path";
|
|
14942
14942
|
|
|
14943
14943
|
// packages/workit-core/src/core/task-contract.ts
|
|
14944
14944
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -26202,7 +26202,7 @@ var exportDigest = (bundle) => sha256({
|
|
|
26202
26202
|
task: bundle.task
|
|
26203
26203
|
});
|
|
26204
26204
|
// packages/workit-core/src/autonomy.ts
|
|
26205
|
-
import
|
|
26205
|
+
import path24 from "node:path";
|
|
26206
26206
|
|
|
26207
26207
|
// packages/workit-core/src/core/eval-world.ts
|
|
26208
26208
|
import { existsSync as existsSync9, realpathSync as realpathSync5 } from "node:fs";
|
|
@@ -26234,6 +26234,68 @@ var evalWorldEntry = (cwd) => {
|
|
|
26234
26234
|
}
|
|
26235
26235
|
};
|
|
26236
26236
|
|
|
26237
|
+
// packages/workit-core/src/core/grant-seal.ts
|
|
26238
|
+
import { createHash as createHash11 } from "node:crypto";
|
|
26239
|
+
import { readFileSync as readFileSync9 } from "node:fs";
|
|
26240
|
+
import path23 from "node:path";
|
|
26241
|
+
var SEAL_FILE = "workspaces.json.seal";
|
|
26242
|
+
var SEAL_VERSION = 1;
|
|
26243
|
+
var SEAL_COMMAND = "workit workspace seal";
|
|
26244
|
+
var pick2 = (value, keys) => {
|
|
26245
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
26246
|
+
return;
|
|
26247
|
+
const out = Object.fromEntries(keys.flatMap((key) => {
|
|
26248
|
+
const item = value[key];
|
|
26249
|
+
return item === undefined ? [] : [[key, item]];
|
|
26250
|
+
}));
|
|
26251
|
+
return Object.keys(out).length > 0 ? out : undefined;
|
|
26252
|
+
};
|
|
26253
|
+
var ENTRY_KEYS = [
|
|
26254
|
+
"name",
|
|
26255
|
+
"glob",
|
|
26256
|
+
"remotes",
|
|
26257
|
+
"vcs",
|
|
26258
|
+
"autonomy",
|
|
26259
|
+
"autoApprove",
|
|
26260
|
+
"defaultEndpoint",
|
|
26261
|
+
"verification",
|
|
26262
|
+
"youtrack"
|
|
26263
|
+
];
|
|
26264
|
+
var sealProjection = (entries) => entries.map((entry) => {
|
|
26265
|
+
const all = pick2(entry, ENTRY_KEYS) ?? {};
|
|
26266
|
+
return pick2({
|
|
26267
|
+
...all,
|
|
26268
|
+
vcs: pick2(all.vcs, ["provider", "account"]),
|
|
26269
|
+
youtrack: pick2(all.youtrack, ["writes"])
|
|
26270
|
+
}, ENTRY_KEYS);
|
|
26271
|
+
});
|
|
26272
|
+
var canonical3 = (value) => JSON.stringify(value, (_key, item) => item && typeof item === "object" && !Array.isArray(item) ? Object.fromEntries(Object.entries(item).toSorted(([a], [b]) => a < b ? -1 : a > b ? 1 : 0)) : item);
|
|
26273
|
+
var sealDigest = (projection) => createHash11("sha256").update(canonical3(projection)).digest("hex");
|
|
26274
|
+
var broken = (reason, sealed = null) => ({
|
|
26275
|
+
state: "broken",
|
|
26276
|
+
reason,
|
|
26277
|
+
sealed
|
|
26278
|
+
});
|
|
26279
|
+
function checkSeal(dir) {
|
|
26280
|
+
const file = path23.join(dir, SEAL_FILE);
|
|
26281
|
+
let seal;
|
|
26282
|
+
try {
|
|
26283
|
+
seal = JSON.parse(readFileSync9(file, "utf8"));
|
|
26284
|
+
} catch (error) {
|
|
26285
|
+
if (error.code === "ENOENT")
|
|
26286
|
+
return { state: "none" };
|
|
26287
|
+
return broken(`${SEAL_FILE} cannot be read`);
|
|
26288
|
+
}
|
|
26289
|
+
if (seal?.version !== SEAL_VERSION || !Array.isArray(seal.projection) || seal.sha256 !== sealDigest(seal.projection))
|
|
26290
|
+
return broken(`${SEAL_FILE} is malformed`);
|
|
26291
|
+
const sealed = validateWorkspacesDocument({ workspaces: seal.projection }, file);
|
|
26292
|
+
if (sealed.status !== "valid")
|
|
26293
|
+
return broken(`${SEAL_FILE} is malformed`);
|
|
26294
|
+
const current = readWorkspacesResult(dir);
|
|
26295
|
+
const ok = current.status === "valid" || current.status === "missing";
|
|
26296
|
+
return ok && sealDigest(sealProjection(current.entries)) === seal.sha256 ? { state: "valid" } : broken("workspaces.json changed since it was sealed", sealed.entries);
|
|
26297
|
+
}
|
|
26298
|
+
|
|
26237
26299
|
// packages/workit-core/src/autonomy.ts
|
|
26238
26300
|
var grantsHome = { resolve: accountHome };
|
|
26239
26301
|
var accountDir = () => {
|
|
@@ -26243,13 +26305,23 @@ var accountDir = () => {
|
|
|
26243
26305
|
var grantsDir = () => accountDir() ?? resolveConfigDir();
|
|
26244
26306
|
var NO_ACCOUNT = "no OS account record answered (core/account-home.ts), so no grants are read: the D4 defaults apply";
|
|
26245
26307
|
var entriesIn = (dir) => dir === null ? [] : loadWorkspacesFrom(dir);
|
|
26246
|
-
var
|
|
26308
|
+
var fileSource = (dir = accountDir()) => ({
|
|
26309
|
+
resolve: (cwd, name) => dir === null ? null : resolveWorkspaceFrom(cwd, dir, name),
|
|
26310
|
+
entries: () => entriesIn(dir)
|
|
26311
|
+
});
|
|
26312
|
+
var sealedSource = (entries) => ({
|
|
26313
|
+
resolve: (cwd, name) => resolveWorkspaceFromEntries(cwd, entries, name),
|
|
26314
|
+
entries: () => entries
|
|
26315
|
+
});
|
|
26316
|
+
var sealOf = () => {
|
|
26247
26317
|
const dir = accountDir();
|
|
26248
|
-
return dir === null ?
|
|
26318
|
+
return dir === null ? { state: "none" } : checkSeal(dir);
|
|
26249
26319
|
};
|
|
26320
|
+
var SEAL_UNBLOCK = `if the user made this change, ask them to run, in their own terminal: ${SEAL_COMMAND}`;
|
|
26321
|
+
var sealNote = (seal = sealOf()) => seal.state === "broken" ? `workspaces.json does not match its seal (${seal.reason}), so grants, endpoint, verification and youtrack.writes are the stricter of their current and last sealed values; ${SEAL_UNBLOCK}` : null;
|
|
26250
26322
|
var shownGrantsDir = () => {
|
|
26251
26323
|
const world = evalWorld(process.cwd());
|
|
26252
|
-
return world ?
|
|
26324
|
+
return world ? path24.join(world, "config") : accountDir();
|
|
26253
26325
|
};
|
|
26254
26326
|
var benchWorld = (cwd) => {
|
|
26255
26327
|
const entry = evalWorldEntry(cwd);
|
|
@@ -26273,8 +26345,8 @@ var grantsOverride = () => {
|
|
|
26273
26345
|
const shown = shownGrantsDir();
|
|
26274
26346
|
if (shown === null)
|
|
26275
26347
|
return NO_ACCOUNT;
|
|
26276
|
-
const configured =
|
|
26277
|
-
return configured ===
|
|
26348
|
+
const configured = path24.resolve(resolveConfigDir());
|
|
26349
|
+
return configured === path24.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 ${path24.join(grantsDir(), "workspaces.json")}, so the D4 defaults apply until grants are set there`;
|
|
26278
26350
|
};
|
|
26279
26351
|
var GRANT_KINDS = ["push", "pr", "merge", "release", "rerun"];
|
|
26280
26352
|
var DEFAULT_GRANTS = Object.freeze({
|
|
@@ -26394,13 +26466,13 @@ function autonomyOf(workspace) {
|
|
|
26394
26466
|
verification: verificationOf(workspace)
|
|
26395
26467
|
};
|
|
26396
26468
|
}
|
|
26397
|
-
function capAt(named, where, by, why, main = false) {
|
|
26469
|
+
function capAt(source, named, where, by, why, main = false) {
|
|
26398
26470
|
let folder = null;
|
|
26399
26471
|
let none = "";
|
|
26400
26472
|
try {
|
|
26401
26473
|
if (where instanceof Error)
|
|
26402
26474
|
throw where;
|
|
26403
|
-
folder = autonomyOf(typeof where === "string" ?
|
|
26475
|
+
folder = autonomyOf(typeof where === "string" ? source.resolve(where) : where.entry);
|
|
26404
26476
|
} catch (error) {
|
|
26405
26477
|
none = error.message;
|
|
26406
26478
|
}
|
|
@@ -26443,31 +26515,84 @@ function resolveAutonomy(cwd, target) {
|
|
|
26443
26515
|
const override = world ? null : grantsOverride();
|
|
26444
26516
|
if (override)
|
|
26445
26517
|
return { ...autonomyOf(null), note: override };
|
|
26518
|
+
let resolved;
|
|
26519
|
+
const once = typeof target === "function" ? () => resolved ??= target() : target;
|
|
26520
|
+
const current = resolveWith(fileSource(), cwd, world, once);
|
|
26521
|
+
const seal = sealOf();
|
|
26522
|
+
if (seal.state !== "broken")
|
|
26523
|
+
return current;
|
|
26524
|
+
let sealed = autonomyOf(null);
|
|
26525
|
+
try {
|
|
26526
|
+
if (seal.sealed)
|
|
26527
|
+
sealed = resolveWith(sealedSource(seal.sealed), cwd, world, once);
|
|
26528
|
+
} catch {
|
|
26529
|
+
sealed = null;
|
|
26530
|
+
}
|
|
26531
|
+
return stricter(current, sealed, sealNote(seal));
|
|
26532
|
+
}
|
|
26533
|
+
function resolveWith(source, cwd, world, target) {
|
|
26446
26534
|
const name = process.env.WORKIT_WORKSPACE_NAME?.trim() || undefined;
|
|
26447
|
-
const real =
|
|
26535
|
+
const real = source.resolve(cwd, name);
|
|
26448
26536
|
let autonomy = autonomyOf(real ?? world);
|
|
26449
26537
|
if (!real && world)
|
|
26450
26538
|
autonomy.world = evalWorld(cwd) ?? undefined;
|
|
26451
26539
|
if (name)
|
|
26452
|
-
autonomy = capAt(autonomy, cwd, `WORKIT_WORKSPACE_NAME=${name}`, "a name never raises grants");
|
|
26540
|
+
autonomy = capAt(source, autonomy, cwd, `WORKIT_WORKSPACE_NAME=${name}`, "a name never raises grants");
|
|
26453
26541
|
const above = checkoutsAbove(cwd);
|
|
26454
26542
|
for (const where of above instanceof Error ? [above] : above)
|
|
26455
|
-
autonomy = capAt(autonomy, where, where instanceof Error ? "git" : `checkout ${where}`, "a worktree or submodule never exceeds it", true);
|
|
26456
|
-
return capAtRemotes(autonomy, cwd, target);
|
|
26543
|
+
autonomy = capAt(source, autonomy, where, where instanceof Error ? "git" : `checkout ${where}`, "a worktree or submodule never exceeds it", true);
|
|
26544
|
+
return capAtRemotes(source, autonomy, cwd, target);
|
|
26545
|
+
}
|
|
26546
|
+
var needsAccount = (autonomy) => autonomy.configured.length > 0 && !autonomy.accountConfigured;
|
|
26547
|
+
function stricter(current, sealed, note) {
|
|
26548
|
+
const grants = { ...current.grants };
|
|
26549
|
+
const unblocks = { ...current.unblocks };
|
|
26550
|
+
for (const kind of GRANT_KINDS) {
|
|
26551
|
+
const floor = sealed ? sealed.grants[kind] : false;
|
|
26552
|
+
if (!raises(kind, floor, grants[kind]))
|
|
26553
|
+
continue;
|
|
26554
|
+
grants[kind] = floor;
|
|
26555
|
+
unblocks[kind] = SEAL_UNBLOCK;
|
|
26556
|
+
}
|
|
26557
|
+
const configured = GRANT_KINDS.filter((kind) => current.configured.includes(kind) || sealed?.configured.includes(kind));
|
|
26558
|
+
const accountConfigured = !needsAccount(current) && !(sealed && needsAccount(sealed)) && (current.accountConfigured || Boolean(sealed?.accountConfigured));
|
|
26559
|
+
const lower = (a, b) => raisesEndpoint(a, b) ? a : b;
|
|
26560
|
+
const defaultEndpoint = lower(current.defaultEndpoint, sealed?.defaultEndpoint ?? DEFAULT_ENDPOINT);
|
|
26561
|
+
const effective = effectiveEndpoint(defaultEndpoint, {
|
|
26562
|
+
workspace: current.workspace,
|
|
26563
|
+
grants,
|
|
26564
|
+
configured,
|
|
26565
|
+
accountConfigured
|
|
26566
|
+
});
|
|
26567
|
+
const endpoint = lower(lower(effective.endpoint, current.effectiveEndpoint), sealed?.effectiveEndpoint ?? DEFAULT_ENDPOINT);
|
|
26568
|
+
const strict = sealed?.verification ?? "independent";
|
|
26569
|
+
const looser = VERIFICATION_STRICTNESS.indexOf(current.verification) > VERIFICATION_STRICTNESS.indexOf(strict);
|
|
26570
|
+
return {
|
|
26571
|
+
...current,
|
|
26572
|
+
grants,
|
|
26573
|
+
configured,
|
|
26574
|
+
accountConfigured,
|
|
26575
|
+
defaultEndpoint,
|
|
26576
|
+
effectiveEndpoint: endpoint,
|
|
26577
|
+
endpointReason: endpoint === current.effectiveEndpoint ? current.endpointReason : SEAL_UNBLOCK,
|
|
26578
|
+
verification: looser ? strict : current.verification,
|
|
26579
|
+
unblocks,
|
|
26580
|
+
note: current.note ? `${current.note}; ${note}` : note
|
|
26581
|
+
};
|
|
26457
26582
|
}
|
|
26458
|
-
function capAtRemotes(autonomy, cwd, target) {
|
|
26459
|
-
const claiming =
|
|
26583
|
+
function capAtRemotes(source, autonomy, cwd, target) {
|
|
26584
|
+
const claiming = source.entries().filter((entry) => entry.remotes?.length);
|
|
26460
26585
|
if (claiming.length === 0)
|
|
26461
26586
|
return autonomy;
|
|
26462
26587
|
const remotes = target === undefined ? checkoutRemotes(cwd) : typeof target === "function" ? target() : target;
|
|
26463
26588
|
if (remotes instanceof Error)
|
|
26464
|
-
return capAt(autonomy, remotes, target === undefined ? "git" : "target", "a target that cannot be resolved never raises grants");
|
|
26589
|
+
return capAt(source, autonomy, remotes, target === undefined ? "git" : "target", "a target that cannot be resolved never raises grants");
|
|
26465
26590
|
let capped = autonomy;
|
|
26466
26591
|
for (const remote of Array.isArray(remotes) ? remotes : remotes.remotes)
|
|
26467
26592
|
for (const entry of claiming) {
|
|
26468
26593
|
const pattern = entry.remotes.find((item) => remoteMatches(item, remote.key));
|
|
26469
26594
|
if (pattern)
|
|
26470
|
-
capped = capAt(capped, { entry }, `remote ${remote.name} ${remote.url} (workspace ${entry.name} claims ${pattern})`, "a checkout never exceeds the workspace that owns its remote");
|
|
26595
|
+
capped = capAt(source, capped, { entry }, `remote ${remote.name} ${remote.url} (workspace ${entry.name} claims ${pattern})`, "a checkout never exceeds the workspace that owns its remote");
|
|
26471
26596
|
}
|
|
26472
26597
|
return capped;
|
|
26473
26598
|
}
|
|
@@ -28571,8 +28696,8 @@ class WorkitCore {
|
|
|
28571
28696
|
}
|
|
28572
28697
|
// packages/workit-core/src/core/repo-context.ts
|
|
28573
28698
|
import { spawnSync as spawnSync16 } from "node:child_process";
|
|
28574
|
-
import { existsSync as existsSync10, readFileSync as
|
|
28575
|
-
import
|
|
28699
|
+
import { existsSync as existsSync10, readFileSync as readFileSync10, readdirSync as readdirSync4 } from "node:fs";
|
|
28700
|
+
import path25 from "node:path";
|
|
28576
28701
|
var isSafeContextRange = (value) => value.length <= 4096 && (() => {
|
|
28577
28702
|
try {
|
|
28578
28703
|
gitRevisionParts(value);
|
|
@@ -28716,13 +28841,13 @@ var findPrTemplate = (cwd) => {
|
|
|
28716
28841
|
for (const rel of PR_TEMPLATE_FILES) {
|
|
28717
28842
|
const parts = rel.split("/");
|
|
28718
28843
|
const base = parts[parts.length - 1];
|
|
28719
|
-
const dir = parts.length > 1 ?
|
|
28844
|
+
const dir = parts.length > 1 ? path25.join(cwd, ...parts.slice(0, -1)) : cwd;
|
|
28720
28845
|
const actual = probeCaseInsensitive(dir, base);
|
|
28721
28846
|
if (actual)
|
|
28722
28847
|
return [...parts.slice(0, -1), actual].join("/");
|
|
28723
28848
|
}
|
|
28724
28849
|
for (const rel of PR_TEMPLATE_DIRS) {
|
|
28725
|
-
const only = singleMarkdown(
|
|
28850
|
+
const only = singleMarkdown(path25.join(cwd, ...rel.split("/")));
|
|
28726
28851
|
if (only)
|
|
28727
28852
|
return `${rel}/${only}`;
|
|
28728
28853
|
}
|
|
@@ -28752,11 +28877,11 @@ var diffStatForRange = (cwd, range) => {
|
|
|
28752
28877
|
return runGit(cwd, ["diff", "--stat", "--"]).stdout;
|
|
28753
28878
|
};
|
|
28754
28879
|
var packageScripts = (cwd, keys) => {
|
|
28755
|
-
const pkgPath =
|
|
28880
|
+
const pkgPath = path25.join(cwd, "package.json");
|
|
28756
28881
|
if (!existsSync10(pkgPath))
|
|
28757
28882
|
return [];
|
|
28758
28883
|
try {
|
|
28759
|
-
const pkg = JSON.parse(
|
|
28884
|
+
const pkg = JSON.parse(readFileSync10(pkgPath, "utf8"));
|
|
28760
28885
|
return keys.filter((k) => pkg.scripts && typeof pkg.scripts[k] === "string").map((k) => `${k}: ${pkg.scripts?.[k]}`);
|
|
28761
28886
|
} catch {
|
|
28762
28887
|
return [];
|
|
@@ -28778,9 +28903,9 @@ var documentationFiles = (cwd) => {
|
|
|
28778
28903
|
if (entry.isDirectory()) {
|
|
28779
28904
|
if (excluded.has(entry.name))
|
|
28780
28905
|
continue;
|
|
28781
|
-
walk(
|
|
28906
|
+
walk(path25.join(dir, entry.name), depth + 1);
|
|
28782
28907
|
} else if (entry.isFile() && (entry.name === "README.md" || entry.name.endsWith(".md"))) {
|
|
28783
|
-
matches.push("./" +
|
|
28908
|
+
matches.push("./" + path25.relative(cwd, path25.join(dir, entry.name)).replaceAll("\\", "/"));
|
|
28784
28909
|
}
|
|
28785
28910
|
}
|
|
28786
28911
|
};
|
|
@@ -28790,13 +28915,13 @@ var documentationFiles = (cwd) => {
|
|
|
28790
28915
|
var readTrimmed2 = (file, maxLines) => {
|
|
28791
28916
|
if (!existsSync10(file))
|
|
28792
28917
|
return "";
|
|
28793
|
-
const lines =
|
|
28918
|
+
const lines = readFileSync10(file, "utf8").split(`
|
|
28794
28919
|
`);
|
|
28795
28920
|
return lines.slice(0, maxLines).join(`
|
|
28796
28921
|
`);
|
|
28797
28922
|
};
|
|
28798
28923
|
function prReadyContext(root, range) {
|
|
28799
|
-
const cwd =
|
|
28924
|
+
const cwd = path25.resolve(repoRoot(root));
|
|
28800
28925
|
if (range !== undefined && !isResolvableContextRange(cwd, range))
|
|
28801
28926
|
return invalidRange(cwd);
|
|
28802
28927
|
let stdout = "";
|
|
@@ -28854,7 +28979,7 @@ ${status.stderr}` : "");
|
|
|
28854
28979
|
stdout += `template_path: ${template}
|
|
28855
28980
|
|
|
28856
28981
|
`;
|
|
28857
|
-
stdout += readTrimmed2(
|
|
28982
|
+
stdout += readTrimmed2(path25.join(cwd, template), 220);
|
|
28858
28983
|
} else {
|
|
28859
28984
|
stdout += `template_path: none
|
|
28860
28985
|
|
|
@@ -28864,7 +28989,7 @@ ${status.stderr}` : "");
|
|
|
28864
28989
|
stdout += `
|
|
28865
28990
|
`;
|
|
28866
28991
|
stdout += printSection("Recent Validation Signals");
|
|
28867
|
-
if (existsSync10(
|
|
28992
|
+
if (existsSync10(path25.join(cwd, "package.json"))) {
|
|
28868
28993
|
stdout += `package.json detected. Common scripts:
|
|
28869
28994
|
`;
|
|
28870
28995
|
const found = packageScripts(cwd, ["lint", "format:check", "test", "build"]);
|
|
@@ -28873,7 +28998,7 @@ ${status.stderr}` : "");
|
|
|
28873
28998
|
`) + `
|
|
28874
28999
|
`;
|
|
28875
29000
|
}
|
|
28876
|
-
if (existsSync10(
|
|
29001
|
+
if (existsSync10(path25.join(cwd, "Cargo.toml")) || existsSync10(path25.join(cwd, "src-tauri/Cargo.toml"))) {
|
|
28877
29002
|
stdout += `Rust project detected.
|
|
28878
29003
|
`;
|
|
28879
29004
|
}
|
|
@@ -28906,7 +29031,7 @@ var CHANGELOG_RULES = `- Use an [Unreleased] section.
|
|
|
28906
29031
|
- Apply with the host-native editor, preserving the repository changelog conventions.
|
|
28907
29032
|
- If Unreleased already has duplicate category headings, normalize_only first.`;
|
|
28908
29033
|
function changelogContext(root, range) {
|
|
28909
|
-
const cwd =
|
|
29034
|
+
const cwd = path25.resolve(repoRoot(root));
|
|
28910
29035
|
if (range !== undefined && !isResolvableContextRange(cwd, range))
|
|
28911
29036
|
return invalidRange(cwd);
|
|
28912
29037
|
const resolvedRange = rangeArgOrDefault(range, cwd);
|
|
@@ -28924,7 +29049,7 @@ function changelogContext(root, range) {
|
|
|
28924
29049
|
stdout += CHANGELOG_RULES + `
|
|
28925
29050
|
`;
|
|
28926
29051
|
stdout += printSection("Existing CHANGELOG.md");
|
|
28927
|
-
const changelogPath =
|
|
29052
|
+
const changelogPath = path25.join(cwd, "CHANGELOG.md");
|
|
28928
29053
|
if (existsSync10(changelogPath)) {
|
|
28929
29054
|
stdout += readTrimmed2(changelogPath, 260) + `
|
|
28930
29055
|
`;
|
|
@@ -28944,7 +29069,7 @@ function changelogContext(root, range) {
|
|
|
28944
29069
|
return { stdout, stderr: "", exitCode: 0, cwd };
|
|
28945
29070
|
}
|
|
28946
29071
|
function docsRefreshContext(root, range) {
|
|
28947
|
-
const cwd =
|
|
29072
|
+
const cwd = path25.resolve(repoRoot(root));
|
|
28948
29073
|
if (range !== undefined && !isResolvableContextRange(cwd, range))
|
|
28949
29074
|
return invalidRange(cwd);
|
|
28950
29075
|
const resolvedRange = rangeArgOrDefault(range, cwd);
|
|
@@ -28966,7 +29091,7 @@ function docsRefreshContext(root, range) {
|
|
|
28966
29091
|
`) + `
|
|
28967
29092
|
`;
|
|
28968
29093
|
stdout += printSection("README Preview");
|
|
28969
|
-
const readme =
|
|
29094
|
+
const readme = path25.join(cwd, "README.md");
|
|
28970
29095
|
if (existsSync10(readme)) {
|
|
28971
29096
|
stdout += readTrimmed2(readme, 220) + `
|
|
28972
29097
|
`;
|
|
@@ -28975,10 +29100,10 @@ function docsRefreshContext(root, range) {
|
|
|
28975
29100
|
`;
|
|
28976
29101
|
}
|
|
28977
29102
|
stdout += printSection("Package Scripts");
|
|
28978
|
-
const pkgPath =
|
|
29103
|
+
const pkgPath = path25.join(cwd, "package.json");
|
|
28979
29104
|
if (existsSync10(pkgPath)) {
|
|
28980
29105
|
try {
|
|
28981
|
-
const pkg = JSON.parse(
|
|
29106
|
+
const pkg = JSON.parse(readFileSync10(pkgPath, "utf8"));
|
|
28982
29107
|
stdout += JSON.stringify({ name: pkg.name, version: pkg.version, scripts: pkg.scripts }, null, 2) + `
|
|
28983
29108
|
`;
|
|
28984
29109
|
} catch {}
|
|
@@ -28989,7 +29114,7 @@ function docsRefreshContext(root, range) {
|
|
|
28989
29114
|
return { stdout, stderr: "", exitCode: 0, cwd };
|
|
28990
29115
|
}
|
|
28991
29116
|
function releaseNotesContext(root, rangeOrTag) {
|
|
28992
|
-
const cwd =
|
|
29117
|
+
const cwd = path25.resolve(repoRoot(root));
|
|
28993
29118
|
if (!rangeOrTag) {
|
|
28994
29119
|
return {
|
|
28995
29120
|
stdout: "",
|
|
@@ -29032,7 +29157,7 @@ function releaseNotesContext(root, rangeOrTag) {
|
|
|
29032
29157
|
`;
|
|
29033
29158
|
stdout += printSection("Existing Release Files");
|
|
29034
29159
|
for (const rel of ["CHANGELOG.md", "RELEASE_NOTES.md", ".github/releases.md"]) {
|
|
29035
|
-
if (existsSync10(
|
|
29160
|
+
if (existsSync10(path25.join(cwd, rel)))
|
|
29036
29161
|
stdout += rel + `
|
|
29037
29162
|
`;
|
|
29038
29163
|
}
|
|
@@ -29064,7 +29189,7 @@ import { spawnSync as spawnSync18 } from "node:child_process";
|
|
|
29064
29189
|
|
|
29065
29190
|
// packages/workit-core/src/core/pr-create.ts
|
|
29066
29191
|
import fs17 from "node:fs";
|
|
29067
|
-
import
|
|
29192
|
+
import path26 from "node:path";
|
|
29068
29193
|
import { spawnSync as spawnSync17 } from "node:child_process";
|
|
29069
29194
|
// packages/workit-core/src/forge/pr-body.ts
|
|
29070
29195
|
function parseGhIssue(value) {
|
|
@@ -29084,11 +29209,11 @@ var LOCAL = bounded(20000);
|
|
|
29084
29209
|
var NETWORK = bounded(60000);
|
|
29085
29210
|
function whichOnPath(tool) {
|
|
29086
29211
|
const names = process.platform === "win32" ? [tool, `${tool}.exe`, `${tool}.cmd`] : [tool];
|
|
29087
|
-
for (const dir of (process.env.PATH ?? "").split(
|
|
29212
|
+
for (const dir of (process.env.PATH ?? "").split(path26.delimiter)) {
|
|
29088
29213
|
if (!dir)
|
|
29089
29214
|
continue;
|
|
29090
29215
|
for (const name of names) {
|
|
29091
|
-
const candidate =
|
|
29216
|
+
const candidate = path26.join(dir, name);
|
|
29092
29217
|
try {
|
|
29093
29218
|
fs17.accessSync(candidate, fs17.constants.X_OK);
|
|
29094
29219
|
return candidate;
|
|
@@ -29209,7 +29334,7 @@ var fetchGitLabIssueBody = async (ref, root, deps = {}) => {
|
|
|
29209
29334
|
|
|
29210
29335
|
// packages/workit-core/src/core/youtrack.ts
|
|
29211
29336
|
import fs19 from "node:fs";
|
|
29212
|
-
import
|
|
29337
|
+
import path28 from "node:path";
|
|
29213
29338
|
|
|
29214
29339
|
// packages/workit-core/src/core/templates.ts
|
|
29215
29340
|
var repoRoot2 = assetRoot();
|
|
@@ -29224,7 +29349,7 @@ import { spawnSync as spawnSync19 } from "node:child_process";
|
|
|
29224
29349
|
|
|
29225
29350
|
// packages/workit-core/src/forge/exec.ts
|
|
29226
29351
|
import fs18 from "node:fs";
|
|
29227
|
-
import
|
|
29352
|
+
import path27 from "node:path";
|
|
29228
29353
|
|
|
29229
29354
|
// packages/workit-core/src/forge/redact.ts
|
|
29230
29355
|
var KEY = String.raw`[A-Za-z0-9_.-]*?(?:token|secret|password|passwd|pwd|api[_-]?key|access[_-]?key|account[_-]?key|private[_-]?key|client[_-]?secret|credentials?|authorization|cookie|signature)[A-Za-z0-9_.-]*`;
|
|
@@ -29235,11 +29360,11 @@ var ANSI = new RegExp(String.raw`\u001b\[[0-9;?]*[ -/]*[@-~]|\u001b\][^\u0007]*\
|
|
|
29235
29360
|
// packages/workit-core/src/forge/exec.ts
|
|
29236
29361
|
var MAX_BUFFER2 = 64 * 1024 * 1024;
|
|
29237
29362
|
function findExecutable(bin, env) {
|
|
29238
|
-
const dirs = (env.PATH ?? env.Path ?? "").split(
|
|
29363
|
+
const dirs = (env.PATH ?? env.Path ?? "").split(path27.delimiter).filter(Boolean);
|
|
29239
29364
|
const exts = process.platform === "win32" ? [".exe"] : [""];
|
|
29240
29365
|
for (const dir of dirs)
|
|
29241
29366
|
for (const ext of exts) {
|
|
29242
|
-
const candidate =
|
|
29367
|
+
const candidate = path27.join(dir, `${bin}${ext}`);
|
|
29243
29368
|
try {
|
|
29244
29369
|
const stat = fs18.statSync(candidate);
|
|
29245
29370
|
if (stat.isFile())
|
|
@@ -29281,8 +29406,8 @@ var ytrackDetail = (out) => out.stderr.trim().split(`
|
|
|
29281
29406
|
var YTRACK_MISSING = "ytrack is not on PATH: Workit reaches YouTrack only through ytrack";
|
|
29282
29407
|
|
|
29283
29408
|
// packages/workit-core/src/core/youtrack.ts
|
|
29284
|
-
var ISSUE_RE = /^[A-Z]
|
|
29285
|
-
var youTrackReadOnlyConfigPath = () => process.env.WORKIT_YOUTRACK_CONFIG ??
|
|
29409
|
+
var ISSUE_RE = /^[A-Z][A-Z0-9_]*-\d+$/;
|
|
29410
|
+
var youTrackReadOnlyConfigPath = () => process.env.WORKIT_YOUTRACK_CONFIG ?? path28.join(resolveConfigDir(), "youtrack.json");
|
|
29286
29411
|
var readYouTrackContextConfig = () => {
|
|
29287
29412
|
const cfgPath = youTrackReadOnlyConfigPath();
|
|
29288
29413
|
if (!fs19.existsSync(cfgPath))
|
|
@@ -29337,11 +29462,11 @@ function parseIssueRef(input) {
|
|
|
29337
29462
|
if (ISSUE_RE.test(trimmed)) {
|
|
29338
29463
|
return { issueId: trimmed, source: "id" };
|
|
29339
29464
|
}
|
|
29340
|
-
const fromPath = trimmed.match(/\/(?:issue|issues)\/([A-Z]
|
|
29465
|
+
const fromPath = trimmed.match(/\/(?:issue|issues)\/([A-Z][A-Z0-9_]*-\d+)/i);
|
|
29341
29466
|
if (fromPath && ISSUE_RE.test(fromPath[1])) {
|
|
29342
29467
|
return { issueId: fromPath[1], source: "url" };
|
|
29343
29468
|
}
|
|
29344
|
-
const anywhere = trimmed.match(/([A-Z]
|
|
29469
|
+
const anywhere = trimmed.match(/([A-Z][A-Z0-9_]*-\d+)/);
|
|
29345
29470
|
if (anywhere && ISSUE_RE.test(anywhere[1])) {
|
|
29346
29471
|
return { issueId: anywhere[1], source: "url" };
|
|
29347
29472
|
}
|
|
@@ -29635,15 +29760,15 @@ function resolveGitRevision(root, value) {
|
|
|
29635
29760
|
}
|
|
29636
29761
|
function resolveInside(root, candidate) {
|
|
29637
29762
|
const base = realpathSync8(root);
|
|
29638
|
-
const target =
|
|
29639
|
-
if (target !== base && !target.startsWith(base +
|
|
29763
|
+
const target = path29.resolve(base, candidate);
|
|
29764
|
+
if (target !== base && !target.startsWith(base + path29.sep)) {
|
|
29640
29765
|
throw new Error("path must stay inside repository root");
|
|
29641
29766
|
}
|
|
29642
29767
|
let ancestor = target;
|
|
29643
29768
|
while (!existsSync11(ancestor))
|
|
29644
|
-
ancestor =
|
|
29769
|
+
ancestor = path29.dirname(ancestor);
|
|
29645
29770
|
const canonicalAncestor = realpathSync8(ancestor);
|
|
29646
|
-
if (canonicalAncestor !== base && !canonicalAncestor.startsWith(base +
|
|
29771
|
+
if (canonicalAncestor !== base && !canonicalAncestor.startsWith(base + path29.sep)) {
|
|
29647
29772
|
throw new Error("path must stay inside repository root");
|
|
29648
29773
|
}
|
|
29649
29774
|
return target;
|
|
@@ -29681,11 +29806,11 @@ var changedSourcesSinceLoad = (marker) => {
|
|
|
29681
29806
|
};
|
|
29682
29807
|
|
|
29683
29808
|
// packages/workit-core/src/hooks/repeat-failure.ts
|
|
29684
|
-
import { createHash as
|
|
29809
|
+
import { createHash as createHash12 } from "node:crypto";
|
|
29685
29810
|
var SAME_CALL_FAILED = "Same call failed twice:";
|
|
29686
29811
|
var MAX_SESSIONS = 256;
|
|
29687
29812
|
var stable = (value) => JSON.stringify(value, (_key, entry) => entry && typeof entry === "object" && !Array.isArray(entry) ? Object.fromEntries(Object.entries(entry).toSorted(([a], [b]) => a.localeCompare(b))) : entry) ?? "null";
|
|
29688
|
-
var hashOf = (call) =>
|
|
29813
|
+
var hashOf = (call) => createHash12("sha256").update(call).digest("hex").slice(0, 32);
|
|
29689
29814
|
var record3 = (memo, sessionId, call, failed, next) => {
|
|
29690
29815
|
const previous = memo.get(sessionId);
|
|
29691
29816
|
memo.delete(sessionId);
|
|
@@ -29740,7 +29865,7 @@ var safeCapability = (value, allowed) => allowed.includes(value) ? value : "cont
|
|
|
29740
29865
|
var TOOL_CAPABILITIES = [...CONTEXT_KINDS, "workspace", "native_caller_identity"];
|
|
29741
29866
|
var VERSION = (() => {
|
|
29742
29867
|
try {
|
|
29743
|
-
const packageJson = JSON.parse(
|
|
29868
|
+
const packageJson = JSON.parse(readFileSync11(new URL("../package.json", import.meta.url), "utf8"));
|
|
29744
29869
|
return typeof packageJson.version === "string" ? packageJson.version : "0.0.0";
|
|
29745
29870
|
} catch {
|
|
29746
29871
|
return "0.0.0";
|
|
@@ -29750,13 +29875,13 @@ var rootVariants = (workspaceRoot) => {
|
|
|
29750
29875
|
if (!workspaceRoot)
|
|
29751
29876
|
return [];
|
|
29752
29877
|
const roots = new Set;
|
|
29753
|
-
for (const candidate of [workspaceRoot,
|
|
29754
|
-
if (
|
|
29878
|
+
for (const candidate of [workspaceRoot, path30.resolve(workspaceRoot)]) {
|
|
29879
|
+
if (path30.isAbsolute(candidate) && candidate !== path30.parse(candidate).root)
|
|
29755
29880
|
roots.add(candidate);
|
|
29756
29881
|
}
|
|
29757
29882
|
try {
|
|
29758
29883
|
const canonical = realpathSync9(workspaceRoot);
|
|
29759
|
-
if (canonical !==
|
|
29884
|
+
if (canonical !== path30.parse(canonical).root)
|
|
29760
29885
|
roots.add(canonical);
|
|
29761
29886
|
} catch {}
|
|
29762
29887
|
return [...roots].toSorted((left, right) => right.length - left.length);
|
|
@@ -29838,11 +29963,11 @@ var thrownResult = (tool, error, workspaceRoot) => {
|
|
|
29838
29963
|
};
|
|
29839
29964
|
function createMcpServer(host, contextProvider) {
|
|
29840
29965
|
assertMcpHost(host);
|
|
29841
|
-
const here =
|
|
29966
|
+
const here = path30.dirname(fileURLToPath2(import.meta.url));
|
|
29842
29967
|
const sourceMarker = markSourcesLoaded([
|
|
29843
|
-
|
|
29844
|
-
|
|
29845
|
-
|
|
29968
|
+
path30.join(here, "server.ts"),
|
|
29969
|
+
path30.join(here, "..", "..", "workit-core", "src", "core", "task-contract.ts"),
|
|
29970
|
+
path30.join(here, "..", "..", "workit-core", "src", "core", "task-engine.ts")
|
|
29846
29971
|
].filter((file) => existsSync12(file)));
|
|
29847
29972
|
let staleWarned = false;
|
|
29848
29973
|
const failures = new Map;
|
|
@@ -30025,8 +30150,8 @@ var main = async () => {
|
|
|
30025
30150
|
process.exitCode = 2;
|
|
30026
30151
|
}
|
|
30027
30152
|
};
|
|
30028
|
-
var entryPath = process.argv[1] ?
|
|
30029
|
-
if (entryPath ===
|
|
30153
|
+
var entryPath = process.argv[1] ? path31.resolve(process.argv[1]) : "";
|
|
30154
|
+
if (entryPath === path31.resolve(fileURLToPath3(import.meta.url)))
|
|
30030
30155
|
await main();
|
|
30031
30156
|
export {
|
|
30032
30157
|
McpCapabilityUnavailableError,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workit-dev/mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
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.12.0",
|
|
48
48
|
"zod": "4.6.5"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|