@workit-dev/mcp 1.14.3 → 2.0.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.
Files changed (2) hide show
  1. package/dist/index.js +40 -13
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -17579,6 +17579,7 @@ var accountHome = (platform = process.platform, io = hostIo) => {
17579
17579
  return null;
17580
17580
  }
17581
17581
  };
17582
+ var grantsHome = { resolve: () => accountHome() };
17582
17583
 
17583
17584
  // packages/workit-core/src/core/remotes.ts
17584
17585
  var FORGE_SCHEMES = new Set(["ssh", "git", "http", "https", "git+ssh", "ssh+git"]);
@@ -26265,11 +26266,12 @@ var ENTRY_KEYS = [
26265
26266
  "verification",
26266
26267
  "youtrack"
26267
26268
  ];
26269
+ var IDENTITY_KEYS = ["provider", "account", "tokenFile", "host"];
26268
26270
  var sealProjection = (entries) => entries.map((entry) => {
26269
26271
  const all = pick2(entry, ENTRY_KEYS) ?? {};
26270
26272
  return pick2({
26271
26273
  ...all,
26272
- vcs: pick2(all.vcs, ["provider", "account"]),
26274
+ vcs: pick2(all.vcs, IDENTITY_KEYS),
26273
26275
  youtrack: pick2(all.youtrack, ["writes"])
26274
26276
  }, ENTRY_KEYS);
26275
26277
  });
@@ -26301,7 +26303,6 @@ function checkSeal(dir) {
26301
26303
  }
26302
26304
 
26303
26305
  // packages/workit-core/src/autonomy.ts
26304
- var grantsHome = { resolve: accountHome };
26305
26306
  var accountDir = () => {
26306
26307
  const home = grantsHome.resolve();
26307
26308
  return home === null ? null : configDir({ HOME: home });
@@ -26322,6 +26323,8 @@ var sealOf = () => {
26322
26323
  return dir === null ? { state: "none" } : checkSeal(dir);
26323
26324
  };
26324
26325
  var SEAL_UNBLOCK = `if the user made this change, ask them to run, in their own terminal: ${SEAL_COMMAND}`;
26326
+ var NO_SEAL_UNBLOCK = `ask the user to review and seal the grants, in their own terminal: ${SEAL_COMMAND}`;
26327
+ var NO_SEAL_NOTE = `workspaces.json has no seal yet (${SEAL_COMMAND} has never run), so grants, endpoint, verification and youtrack.writes stay at or below the D4 defaults; ${NO_SEAL_UNBLOCK}`;
26325
26328
  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;
26326
26329
  var shownGrantsDir = () => {
26327
26330
  const world = evalWorld(process.cwd());
@@ -26350,8 +26353,9 @@ var grantsOverride = () => {
26350
26353
  if (shown === null)
26351
26354
  return NO_ACCOUNT;
26352
26355
  const configured = path24.resolve(resolveConfigDir());
26353
- 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`;
26356
+ 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")}, and under a redirect they never exceed the D4 defaults`;
26354
26357
  };
26358
+ var redirectUnblock = () => `ask the user: grants above the D4 defaults apply only without a config redirect (WORKIT_CONFIG, WORKIT_CONFIG_DIR or XDG_CONFIG_HOME), and are read from ${path24.join(grantsDir(), "workspaces.json")}`;
26355
26359
  var GRANT_KINDS = ["push", "pr", "merge", "release", "rerun"];
26356
26360
  var DEFAULT_GRANTS = Object.freeze({
26357
26361
  push: true,
@@ -26517,23 +26521,39 @@ function capAt(source, named, where, by, why, main = false) {
26517
26521
  function resolveAutonomy(cwd, target) {
26518
26522
  const world = benchWorld(cwd);
26519
26523
  const override = world ? null : grantsOverride();
26520
- if (override)
26524
+ if (override === NO_ACCOUNT)
26521
26525
  return { ...autonomyOf(null), note: override };
26522
26526
  let resolved;
26523
26527
  const once = typeof target === "function" ? () => resolved ??= target() : target;
26524
- const current = resolveWith(fileSource(), cwd, world, once);
26528
+ const account = accountAuthority(cwd, world, once);
26529
+ return override ? stricter(account, autonomyOf(null), override, redirectUnblock()) : account;
26530
+ }
26531
+ function accountAuthority(cwd, world, target) {
26532
+ const current = resolveWith(fileSource(), cwd, world, target);
26525
26533
  const seal = sealOf();
26526
- if (seal.state !== "broken")
26527
- return current;
26534
+ if (seal.state !== "broken") {
26535
+ if (seal.state === "valid" || current.world)
26536
+ return current;
26537
+ const capped = stricter(current, autonomyOf(null), NO_SEAL_NOTE, NO_SEAL_UNBLOCK);
26538
+ return authorityKey(capped) === authorityKey(current) ? current : capped;
26539
+ }
26528
26540
  let sealed = autonomyOf(null);
26529
26541
  try {
26530
26542
  if (seal.sealed)
26531
- sealed = resolveWith(sealedSource(seal.sealed), cwd, world, once);
26543
+ sealed = resolveWith(sealedSource(seal.sealed), cwd, world, target);
26532
26544
  } catch {
26533
26545
  sealed = null;
26534
26546
  }
26535
- return stricter(current, sealed, sealNote(seal));
26547
+ return stricter(current, sealed, sealNote(seal), SEAL_UNBLOCK);
26536
26548
  }
26549
+ var authorityKey = (autonomy) => JSON.stringify([
26550
+ autonomy.grants,
26551
+ autonomy.configured,
26552
+ autonomy.accountConfigured,
26553
+ autonomy.defaultEndpoint,
26554
+ autonomy.effectiveEndpoint,
26555
+ autonomy.verification
26556
+ ]);
26537
26557
  function resolveWith(source, cwd, world, target) {
26538
26558
  const name = process.env.WORKIT_WORKSPACE_NAME?.trim() || undefined;
26539
26559
  const real = source.resolve(cwd, name);
@@ -26548,7 +26568,7 @@ function resolveWith(source, cwd, world, target) {
26548
26568
  return capAtRemotes(source, autonomy, cwd, target);
26549
26569
  }
26550
26570
  var needsAccount = (autonomy) => autonomy.configured.length > 0 && !autonomy.accountConfigured;
26551
- function stricter(current, sealed, note) {
26571
+ function stricter(current, sealed, note, unblock) {
26552
26572
  const grants = { ...current.grants };
26553
26573
  const unblocks = { ...current.unblocks };
26554
26574
  for (const kind of GRANT_KINDS) {
@@ -26556,7 +26576,7 @@ function stricter(current, sealed, note) {
26556
26576
  if (!raises(kind, floor, grants[kind]))
26557
26577
  continue;
26558
26578
  grants[kind] = floor;
26559
- unblocks[kind] = SEAL_UNBLOCK;
26579
+ unblocks[kind] = unblock;
26560
26580
  }
26561
26581
  const configured = GRANT_KINDS.filter((kind) => current.configured.includes(kind) || sealed?.configured.includes(kind));
26562
26582
  const accountConfigured = !needsAccount(current) && !(sealed && needsAccount(sealed)) && (current.accountConfigured || Boolean(sealed?.accountConfigured));
@@ -26578,9 +26598,9 @@ function stricter(current, sealed, note) {
26578
26598
  accountConfigured,
26579
26599
  defaultEndpoint,
26580
26600
  effectiveEndpoint: endpoint,
26581
- endpointReason: endpoint === current.effectiveEndpoint ? current.endpointReason : SEAL_UNBLOCK,
26601
+ endpointReason: endpoint === current.effectiveEndpoint ? current.endpointReason : unblock,
26582
26602
  verification: looser ? strict : current.verification,
26583
- unblocks,
26603
+ unblocks: Object.keys(unblocks).length > 0 ? unblocks : current.unblocks,
26584
26604
  note: current.note ? `${current.note}; ${note}` : note
26585
26605
  };
26586
26606
  }
@@ -26607,6 +26627,13 @@ var raises = (kind, current, next) => {
26607
26627
  const rank = (value) => value === true ? 2 : value === "verified" ? 1 : 0;
26608
26628
  return rank(normalized(kind, next)) > rank(normalized(kind, current));
26609
26629
  };
26630
+ var SCOPE_FIELDS = new Set([
26631
+ "autonomy",
26632
+ "autoApprove",
26633
+ "defaultEndpoint",
26634
+ "verification",
26635
+ "youtrack"
26636
+ ]);
26610
26637
 
26611
26638
  // packages/workit-core/src/hooks/raw-git.ts
26612
26639
  var SHELLS = new Set(["sh", "bash", "zsh", "dash", "ksh", "ash", "mksh", "yash", "fish"]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workit-dev/mcp",
3
- "version": "1.14.3",
3
+ "version": "2.0.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.14.3",
47
+ "@workit-dev/core": "^2.0.0",
48
48
  "zod": "4.6.5"
49
49
  },
50
50
  "engines": {