@workit-dev/mcp 2.27.8 → 2.27.9

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 +45 -14
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -19485,12 +19485,6 @@ var applyPatterns = (value) => {
19485
19485
  };
19486
19486
  var redactSecrets = (value) => applyPatterns(value);
19487
19487
 
19488
- // packages/workit-core/src/store/paths.ts
19489
- import { spawnSync as spawnSync9 } from "node:child_process";
19490
- import { createHash as createHash6 } from "node:crypto";
19491
- import fs6 from "node:fs";
19492
- import path10 from "node:path";
19493
-
19494
19488
  // packages/workit-core/src/store/folder-store.ts
19495
19489
  import fs5 from "node:fs";
19496
19490
  import os5 from "node:os";
@@ -19707,13 +19701,14 @@ var below = (parent, child) => {
19707
19701
  const rel = path9.relative(parent, child);
19708
19702
  return rel !== "" && !rel.startsWith("..") && !path9.isAbsolute(rel);
19709
19703
  };
19704
+ var insideTempDir = (dir, tempDir = os5.tmpdir()) => below(canonical3(tempDir), canonical3(dir));
19710
19705
  var TEST_RUN_REFUSALS = "folder-store-refusals.log";
19711
19706
  var testRunFolderRefusal = (folder, hasStray, env = process.env, tempDir = os5.tmpdir()) => {
19712
19707
  if (env.WORKIT_TEST_RUN === undefined || !hasStray)
19713
19708
  return null;
19714
19709
  const real = canonical3(folder);
19715
19710
  const tmp = canonical3(tempDir);
19716
- if (below(tmp, real))
19711
+ if (insideTempDir(folder, tempDir))
19717
19712
  return null;
19718
19713
  return `workit test run (WORKIT_TEST_RUN): refusing to move ${path9.join(real, ".workit")} into the run's throwaway state dir; a test must work in a fresh dir inside ${tmp}, never the temp dir itself, a parent of it or a folder outside it (#892)`;
19719
19714
  };
@@ -19799,6 +19794,10 @@ Merge them by hand (cp -Rn ${workit}/. ${target}/), then delete them here.
19799
19794
  }
19800
19795
 
19801
19796
  // packages/workit-core/src/store/paths.ts
19797
+ import { spawnSync as spawnSync9 } from "node:child_process";
19798
+ import { createHash as createHash6 } from "node:crypto";
19799
+ import fs6 from "node:fs";
19800
+ import path10 from "node:path";
19802
19801
  var NOT_A_REPO = /not a git repository \(or any (of the parent directories|parent up to)/u;
19803
19802
  var gitRun = (cwd, args) => {
19804
19803
  const run = spawnSync9("git", args, {
@@ -20109,8 +20108,40 @@ function hostSessionFromEnv(env) {
20109
20108
  return inner ? { host: inner.host, session: inner.session } : { host: declared, session: null };
20110
20109
  }
20111
20110
  var hash = (value) => createHash7("sha256").update(value).digest("hex").slice(0, 32);
20112
- var userIssuedRoot = () => path11.join(resolveStateDir(), "issued");
20113
- var userTokenRoot = () => path11.join(resolveStateDir(), "issued-tokens");
20111
+ var PIN_FILE = "issued-registry";
20112
+ var pinFiles = new Map;
20113
+ var pinFile = (cwd) => {
20114
+ if (cwd === undefined)
20115
+ return null;
20116
+ const key = path11.resolve(cwd);
20117
+ const known = pinFiles.get(key);
20118
+ if (known !== undefined)
20119
+ return known;
20120
+ try {
20121
+ const location = resolveStore(key);
20122
+ if (location instanceof Error)
20123
+ return null;
20124
+ const file = location.shared ? path11.join(location.dir, "ledger", PIN_FILE) : null;
20125
+ pinFiles.set(key, file);
20126
+ return file;
20127
+ } catch {
20128
+ return null;
20129
+ }
20130
+ };
20131
+ var pinnedStateDir = (cwd) => {
20132
+ const file = pinFile(cwd);
20133
+ if (file === null)
20134
+ return null;
20135
+ try {
20136
+ const pinned = fs7.readFileSync(file, "utf8").trim();
20137
+ return path11.isAbsolute(pinned) ? pinned : null;
20138
+ } catch {
20139
+ return null;
20140
+ }
20141
+ };
20142
+ var registryDir = (cwd) => pinnedStateDir(cwd) ?? resolveStateDir();
20143
+ var userIssuedRoot = (cwd) => path11.join(registryDir(cwd), "issued");
20144
+ var userTokenRoot = (cwd) => path11.join(registryDir(cwd), "issued-tokens");
20114
20145
  function migrateRepoIssued(cwd) {
20115
20146
  if (cwd === undefined)
20116
20147
  return;
@@ -20130,7 +20161,7 @@ function migrateRepoIssued(cwd) {
20130
20161
  const from = path11.join(old, lead);
20131
20162
  if (!fs7.statSync(from).isDirectory())
20132
20163
  continue;
20133
- const to = path11.join(userIssuedRoot(), lead);
20164
+ const to = path11.join(userIssuedRoot(cwd), lead);
20134
20165
  fs7.mkdirSync(to, { recursive: true, mode: 448 });
20135
20166
  for (const id of fs7.readdirSync(from)) {
20136
20167
  try {
@@ -20164,17 +20195,17 @@ var issuedRecord = (cwd, claimed) => {
20164
20195
  return null;
20165
20196
  migrateRepoIssued(cwd);
20166
20197
  try {
20167
- return fs7.readFileSync(path11.join(userIssuedRoot(), hash(claimed.slice(0, cut)), hash(claimed)), "utf8");
20198
+ return fs7.readFileSync(path11.join(userIssuedRoot(cwd), hash(claimed.slice(0, cut)), hash(claimed)), "utf8");
20168
20199
  } catch {
20169
20200
  return null;
20170
20201
  }
20171
20202
  };
20172
20203
  var TOKEN_HASH = /^([0-9a-f]{64})$/mu;
20173
- var issuedToken = (claimed) => {
20204
+ var issuedToken = (cwd, claimed) => {
20174
20205
  const cut = claimed.lastIndexOf(":");
20175
20206
  if (cut <= 0)
20176
20207
  return { stored: null, leadBound: false };
20177
- const dir = path11.join(userTokenRoot(), hash(claimed.slice(0, cut)));
20208
+ const dir = path11.join(userTokenRoot(cwd), hash(claimed.slice(0, cut)));
20178
20209
  try {
20179
20210
  const text = fs7.readFileSync(path11.join(dir, hash(claimed)), "utf8");
20180
20211
  return { stored: TOKEN_HASH.exec(text)?.[1] ?? null, leadBound: true };
@@ -20184,7 +20215,7 @@ var issuedToken = (claimed) => {
20184
20215
  };
20185
20216
  function issuedBinding(cwd, claimed) {
20186
20217
  const record = issuedRecord(cwd, claimed);
20187
- const { stored, leadBound } = issuedToken(claimed);
20218
+ const { stored, leadBound } = issuedToken(cwd, claimed);
20188
20219
  if (stored)
20189
20220
  return "token";
20190
20221
  if (record === null)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workit-dev/mcp",
3
- "version": "2.27.8",
3
+ "version": "2.27.9",
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.2",
47
- "@workit-dev/core": "^2.27.8",
47
+ "@workit-dev/core": "^2.27.9",
48
48
  "zod": "4.6.7"
49
49
  },
50
50
  "engines": {