@brainervirus/workit-claude-code 8.40.3 → 8.40.5

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/workit.js CHANGED
@@ -6389,7 +6389,7 @@ var init_zod = __esm(() => {
6389
6389
  // packages/workit-core/src/core/workspaces.ts
6390
6390
  import { spawnSync as spawnSync2 } from "node:child_process";
6391
6391
  import { createHash } from "node:crypto";
6392
- import { readFileSync as readFileSync2, realpathSync } from "node:fs";
6392
+ import { existsSync as existsSync2, readFileSync as readFileSync2, realpathSync } from "node:fs";
6393
6393
  import path2 from "node:path";
6394
6394
  function workspaceDefaultTarget(cwd, globalDefault) {
6395
6395
  const ws = resolveRuntimeWorkspaceVcs(cwd);
@@ -6531,10 +6531,17 @@ var nonBlank, branchPreset, commitPreset, workspaceBranchPolicySchema, workspace
6531
6531
  };
6532
6532
  }
6533
6533
  return { ok: true };
6534
- }, WorkspaceConfigError, mainCheckouts, mainCheckoutOf = (cwd) => {
6535
- const cached = mainCheckouts.get(cwd);
6534
+ }, WorkspaceConfigError, probes, probeCheckout = (cwd) => {
6535
+ const cached = probes.get(cwd);
6536
6536
  if (cached !== undefined)
6537
6537
  return cached;
6538
+ let dir = path2.resolve(cwd);
6539
+ while (!existsSync2(path2.join(dir, ".git"))) {
6540
+ const up = path2.dirname(dir);
6541
+ if (up === dir)
6542
+ return null;
6543
+ dir = up;
6544
+ }
6538
6545
  const env = { ...process.env };
6539
6546
  for (const name of ["GIT_DIR", "GIT_WORK_TREE", "GIT_COMMON_DIR", "GIT_INDEX_FILE"])
6540
6547
  delete env[name];
@@ -6548,15 +6555,43 @@ var nonBlank, branchPreset, commitPreset, workspaceBranchPolicySchema, workspace
6548
6555
  });
6549
6556
  return run.status === 0 ? run.stdout : null;
6550
6557
  };
6558
+ const failed = Error(`git could not tell what checkout ${cwd} is`);
6559
+ const [gitDir, common, superproject] = (git([
6560
+ "rev-parse",
6561
+ "--path-format=absolute",
6562
+ "--git-dir",
6563
+ "--git-common-dir",
6564
+ "--show-superproject-working-tree"
6565
+ ]) ?? "").trim().split(/\r?\n/u);
6566
+ if (!gitDir || !common)
6567
+ return failed;
6551
6568
  let main = null;
6552
- const dirs = git(["rev-parse", "--path-format=absolute", "--git-dir", "--git-common-dir"]);
6553
- const [gitDir, common] = (dirs ?? "").trim().split(/\r?\n/u);
6554
- if (gitDir && common && path2.resolve(gitDir) !== path2.resolve(common)) {
6555
- const listed = /^worktree (.+)$/mu.exec(git(["worktree", "list", "--porcelain"]) ?? "")?.[1];
6556
- main = listed?.trim() || (path2.basename(common) === ".git" ? path2.dirname(common) : common);
6557
- }
6558
- mainCheckouts.set(cwd, main);
6559
- return main;
6569
+ if (path2.resolve(gitDir) !== path2.resolve(common)) {
6570
+ const list = git(["worktree", "list", "--porcelain"]);
6571
+ if (list === null)
6572
+ return failed;
6573
+ main = /^worktree (.+)$/mu.exec(list)?.[1]?.trim() || (path2.basename(common) === ".git" ? path2.dirname(common) : common);
6574
+ }
6575
+ const probe = { main, superproject: superproject || null };
6576
+ probes.set(cwd, probe);
6577
+ return probe;
6578
+ }, mainCheckoutOf = (cwd) => {
6579
+ const probe = probeCheckout(cwd);
6580
+ return probe instanceof Error ? null : probe?.main ?? null;
6581
+ }, checkoutsAbove = (cwd, seen = new Set) => {
6582
+ const probe = probeCheckout(cwd);
6583
+ if (probe instanceof Error)
6584
+ return probe;
6585
+ const out = [];
6586
+ for (const above of [probe?.main, probe?.superproject])
6587
+ if (above && !seen.has(above)) {
6588
+ seen.add(above);
6589
+ const rest = checkoutsAbove(above, seen);
6590
+ if (rest instanceof Error)
6591
+ return rest;
6592
+ out.push(above, ...rest);
6593
+ }
6594
+ return out;
6560
6595
  }, matchingEntries = (cwd, entries) => {
6561
6596
  const match = (where) => {
6562
6597
  const targets = [where, realpathOf(where)].map((value) => value.replaceAll("\\", "/"));
@@ -6999,7 +7034,7 @@ var init_workspaces = __esm(() => {
6999
7034
  WorkspaceConfigError = class WorkspaceConfigError extends Error {
7000
7035
  name = "WorkspaceConfigError";
7001
7036
  };
7002
- mainCheckouts = new Map;
7037
+ probes = new Map;
7003
7038
  runtimeWorkspaceIndexSchema = object({
7004
7039
  workspaces: array(object({ name: nonBlank, glob: nonBlank }).passthrough()).optional()
7005
7040
  }).passthrough();
@@ -9317,7 +9352,7 @@ var package_default;
9317
9352
  var init_package = __esm(() => {
9318
9353
  package_default = {
9319
9354
  name: "@brainervirus/workit-cli",
9320
- version: "8.40.3",
9355
+ version: "8.40.5",
9321
9356
  private: false,
9322
9357
  description: "Workit CLI — setup wizard, doctor, and task control for agentic coding workflows",
9323
9358
  keywords: [
@@ -9355,13 +9390,13 @@ var init_package = __esm(() => {
9355
9390
  },
9356
9391
  dependencies: {
9357
9392
  "@babel/parser": "7.29.9",
9358
- "@brainervirus/workit-cursor": "^8.40.3",
9393
+ "@brainervirus/workit-cursor": "^8.40.5",
9359
9394
  "@inkjs/ui": "2.0.0",
9360
9395
  ink: "7.1.1",
9361
9396
  react: "19.2.8"
9362
9397
  },
9363
9398
  devDependencies: {
9364
- "@brainervirus/workit-core": "^8.40.3"
9399
+ "@brainervirus/workit-core": "^8.40.5"
9365
9400
  },
9366
9401
  engines: {
9367
9402
  node: ">=24"
@@ -9700,7 +9735,7 @@ function writeFileAtomic(file, content, mode) {
9700
9735
  var init_safe_write = () => {};
9701
9736
 
9702
9737
  // packages/workit-core/src/autonomy.ts
9703
- import { copyFileSync as copyFileSync2, existsSync as existsSync2 } from "node:fs";
9738
+ import { copyFileSync as copyFileSync2, existsSync as existsSync3 } from "node:fs";
9704
9739
  import os4 from "node:os";
9705
9740
  import path11 from "node:path";
9706
9741
  function endpointOf(entry) {
@@ -9726,7 +9761,7 @@ function effectiveEndpoint(endpoint, context) {
9726
9761
  if (context.configured.length > 0 && !context.accountConfigured)
9727
9762
  return {
9728
9763
  endpoint: "commit",
9729
- reason: `vcs.account missing; set vcs.account for workspace "${context.workspace ?? "?"}" in ~/.config/workit/workspaces.json`
9764
+ reason: `vcs.account missing; ${accountHint(context.workspace)}`
9730
9765
  };
9731
9766
  if (endpoint === "merged" && context.grants.merge === false)
9732
9767
  return { endpoint: "green", reason: missing("merge") };
@@ -9800,17 +9835,28 @@ function autonomyOf(workspace) {
9800
9835
  verification: verificationOf(workspace)
9801
9836
  };
9802
9837
  }
9803
- function capByFolder(named, folder, name) {
9804
- if (folder?.workspace === named.workspace)
9838
+ function capAt(named, where, by, why, main = false) {
9839
+ let folder = null;
9840
+ let none = "";
9841
+ try {
9842
+ if (where instanceof Error)
9843
+ throw where;
9844
+ folder = autonomyOf(resolveWorkspaceFrom(where, grantsDir()));
9845
+ } catch (error) {
9846
+ none = error.message;
9847
+ }
9848
+ if (!main && folder?.workspace === named.workspace)
9805
9849
  return named;
9806
9850
  const nothing = !folder || folder.configured.length > 0 && !folder.accountConfigured;
9807
9851
  const grants = { ...named.grants };
9852
+ const unblocks = { ...named.unblocks };
9808
9853
  const lowered = [];
9809
9854
  for (const kind of GRANT_KINDS) {
9810
9855
  const floor = !nothing && folder.grants[kind];
9811
9856
  if (!raises(kind, floor, grants[kind]))
9812
9857
  continue;
9813
9858
  grants[kind] = floor;
9859
+ unblocks[kind] = folder ? nothing ? accountHint(folder.workspace) : grantHint(folder.workspace, kind) : `ask the user to fix: ${none}`;
9814
9860
  lowered.push(kind);
9815
9861
  }
9816
9862
  const ceiling = !nothing && folder.effectiveEndpoint || DEFAULT_ENDPOINT;
@@ -9818,45 +9864,33 @@ function capByFolder(named, folder, name) {
9818
9864
  if (endpoint)
9819
9865
  lowered.push("defaultEndpoint");
9820
9866
  const strict = folder?.verification ?? "independent";
9821
- const looser = VERIFICATION_MODES.indexOf(named.verification) < VERIFICATION_MODES.indexOf(strict);
9867
+ const looser = VERIFICATION_STRICTNESS.indexOf(named.verification) > VERIFICATION_STRICTNESS.indexOf(strict);
9822
9868
  if (looser)
9823
9869
  lowered.push("verification");
9824
9870
  if (lowered.length === 0)
9825
9871
  return named;
9872
+ const note = `${by}: ${lowered.join(", ")} capped at ${folder ? `workspace ${folder.workspace}` : `nothing (${none})`}; ${why}`;
9826
9873
  return {
9827
9874
  ...named,
9828
9875
  grants,
9876
+ unblocks,
9829
9877
  ...endpoint ? { effectiveEndpoint: ceiling, endpointReason: undefined } : {},
9830
9878
  verification: looser ? strict : named.verification,
9831
- note: `WORKFLOW_WORKSPACE_NAME=${name}: ${lowered.join(", ")} capped at ${folder ? `workspace ${folder.workspace}` : "nothing (tied workspaces)"}; a name never raises grants`
9879
+ note: named.note ? `${named.note}; ${note}` : note
9832
9880
  };
9833
9881
  }
9834
9882
  function resolveAutonomy(cwd) {
9835
9883
  const override = grantsOverride();
9836
9884
  if (override)
9837
- return {
9838
- workspace: null,
9839
- grants: { ...DEFAULT_GRANTS },
9840
- configured: [],
9841
- source: "default",
9842
- accountConfigured: false,
9843
- defaultEndpoint: DEFAULT_ENDPOINT,
9844
- configuredEndpoint: null,
9845
- effectiveEndpoint: DEFAULT_ENDPOINT,
9846
- verification: DEFAULT_VERIFICATION,
9847
- note: override
9848
- };
9885
+ return { ...autonomyOf(null), note: override };
9849
9886
  const name = process.env.WORKFLOW_WORKSPACE_NAME?.trim() || undefined;
9850
- const named = autonomyOf(resolveWorkspaceFrom(cwd, grantsDir(), name));
9851
- if (name === undefined)
9852
- return named;
9853
- let folder;
9854
- try {
9855
- folder = autonomyOf(resolveWorkspaceFrom(cwd, grantsDir()));
9856
- } catch {
9857
- folder = null;
9858
- }
9859
- return capByFolder(named, folder, name);
9887
+ let autonomy = autonomyOf(resolveWorkspaceFrom(cwd, grantsDir(), name));
9888
+ if (name)
9889
+ autonomy = capAt(autonomy, cwd, `WORKFLOW_WORKSPACE_NAME=${name}`, "a name never raises grants");
9890
+ const above = checkoutsAbove(cwd);
9891
+ for (const where of above instanceof Error ? [above] : above)
9892
+ autonomy = capAt(autonomy, where, where instanceof Error ? "git" : `checkout ${where}`, "a worktree or submodule never exceeds it", true);
9893
+ return autonomy;
9860
9894
  }
9861
9895
  function requireGrant(cwd, kind, options = {}) {
9862
9896
  let autonomy;
@@ -9881,7 +9915,7 @@ function requireGrant(cwd, kind, options = {}) {
9881
9915
  kind,
9882
9916
  reason: "grant_required",
9883
9917
  error: `grant_required: ${kind} is not granted for ${workspace ? `workspace "${workspace}"` : "this checkout (no workspace matches it)"}${configured ? "" : " (the default ceiling stops at verified, ready)"}${autonomy.note ? `; ${autonomy.note}` : ""}`,
9884
- unblock: workspace ? grantHint(workspace, kind) : "ask the user to add a workspace for this checkout (workit init → Workspaces), then: workit grant set <workspace> " + `${kind}=${suggested(kind)}`,
9918
+ unblock: autonomy.unblocks?.[kind] ?? (workspace ? grantHint(workspace, kind) : "ask the user to add a workspace for this checkout (workit init → Workspaces), then: workit grant set <workspace> " + `${kind}=${suggested(kind)}`),
9885
9919
  workspace
9886
9920
  };
9887
9921
  if (autonomy.configured.length > 0 && !autonomy.accountConfigured && options.forge !== false && kind !== "release")
@@ -9890,7 +9924,7 @@ function requireGrant(cwd, kind, options = {}) {
9890
9924
  kind,
9891
9925
  reason: "account_required",
9892
9926
  error: `account_required: workspace "${workspace ?? "?"}" has autonomy grants but no vcs.account, so the credential cannot be checked`,
9893
- unblock: `set vcs.account for workspace "${workspace ?? "?"}" in ~/.config/workit/workspaces.json`,
9927
+ unblock: accountHint(workspace),
9894
9928
  workspace
9895
9929
  };
9896
9930
  return {
@@ -9947,7 +9981,7 @@ function writeGrants(workspaceName, changes, dir = grantsDir(), endpoint, verifi
9947
9981
  return { ok: false, code: "failed", error: `${current.path} changed; retry` };
9948
9982
  let backup = null;
9949
9983
  try {
9950
- if (existsSync2(current.path)) {
9984
+ if (existsSync3(current.path)) {
9951
9985
  backup = `${current.path}.bak`;
9952
9986
  copyFileSync2(current.path, backup);
9953
9987
  }
@@ -10013,7 +10047,7 @@ var accountHome = () => {
10013
10047
  }, grantsHome, grantsDir = () => path11.join(grantsHome.resolve(), ".config", "workit"), grantsOverride = () => {
10014
10048
  const configured = path11.resolve(resolveConfigDir());
10015
10049
  return configured === path11.resolve(grantsDir()) ? null : `the config directory is redirected to ${configured} (WORKFLOW_TOOLKIT_CONFIG, WORKFLOW_TOOLKIT_CONFIG_DIR or XDG_CONFIG_HOME); grants are read only from ${path11.join(grantsDir(), "workspaces.json")}, so the D4 defaults apply`;
10016
- }, GRANT_KINDS, DEFAULT_GRANTS, DEFAULT_ENDPOINTS, DEFAULT_ENDPOINT = "commit", isDefaultEndpoint = (value) => typeof value === "string" && DEFAULT_ENDPOINTS.includes(value), raisesEndpoint = (current, next) => DEFAULT_ENDPOINTS.indexOf(next) > DEFAULT_ENDPOINTS.indexOf(current), STOPS, VERIFICATION_MODES, DEFAULT_VERIFICATION = "proportional", verificationOf = (entry) => {
10050
+ }, GRANT_KINDS, DEFAULT_GRANTS, DEFAULT_ENDPOINTS, DEFAULT_ENDPOINT = "commit", isDefaultEndpoint = (value) => typeof value === "string" && DEFAULT_ENDPOINTS.includes(value), raisesEndpoint = (current, next) => DEFAULT_ENDPOINTS.indexOf(next) > DEFAULT_ENDPOINTS.indexOf(current), STOPS, VERIFICATION_MODES, VERIFICATION_STRICTNESS, DEFAULT_VERIFICATION = "proportional", verificationOf = (entry) => {
10017
10051
  const value = entry?.verification;
10018
10052
  return VERIFICATION_MODES.includes(value) ? value : DEFAULT_VERIFICATION;
10019
10053
  }, isGrantKind = (value) => typeof value === "string" && GRANT_KINDS.includes(value), isGrantValue = (value) => value === true || value === false || value === "verified", normalized = (kind, value) => value === "verified" && kind !== "merge" ? true : value, fromAutoApprove = (value) => {
@@ -10028,7 +10062,7 @@ var accountHome = () => {
10028
10062
  else if (item === "merge")
10029
10063
  grants.merge = "verified";
10030
10064
  return Object.keys(grants).length > 0 ? grants : null;
10031
- }, accountOf = (entry) => entry?.vcs?.account, suggested = (kind) => kind === "merge" ? "verified" : "true", grantHint = (workspace, kind) => `ask the user to run, in their own terminal: workit grant set ${workspace ?? "<workspace>"} ${kind}=${suggested(kind)}`, raises = (kind, current, next) => {
10065
+ }, accountOf = (entry) => entry?.vcs?.account, suggested = (kind) => kind === "merge" ? "verified" : "true", accountHint = (workspace) => `set vcs.account for workspace "${workspace ?? "?"}" in ~/.config/workit/workspaces.json`, grantHint = (workspace, kind) => `ask the user to run, in their own terminal: workit grant set ${workspace ?? "<workspace>"} ${kind}=${suggested(kind)}`, raises = (kind, current, next) => {
10032
10066
  const rank = (value) => value === true ? 2 : value === "verified" ? 1 : 0;
10033
10067
  return rank(normalized(kind, next)) > rank(normalized(kind, current));
10034
10068
  };
@@ -10057,6 +10091,11 @@ var init_autonomy = __esm(() => {
10057
10091
  "self",
10058
10092
  "independent"
10059
10093
  ];
10094
+ VERIFICATION_STRICTNESS = [
10095
+ "independent",
10096
+ "proportional",
10097
+ "self"
10098
+ ];
10060
10099
  });
10061
10100
 
10062
10101
  // node_modules/@openclaw/fs-safe/dist/errors.js
@@ -10686,21 +10725,21 @@ var init_file_lock = __esm(() => {
10686
10725
  });
10687
10726
 
10688
10727
  // packages/workit-core/src/core/package-root.ts
10689
- import { existsSync as existsSync3 } from "node:fs";
10728
+ import { existsSync as existsSync4 } from "node:fs";
10690
10729
  import path14 from "node:path";
10691
10730
  import { fileURLToPath } from "node:url";
10692
10731
  var packageRoot = () => {
10693
10732
  let dir = path14.dirname(fileURLToPath(import.meta.url));
10694
10733
  while (true) {
10695
10734
  const parent = path14.dirname(dir);
10696
- if (existsSync3(path14.join(dir, "package.json")) || parent === dir)
10735
+ if (existsSync4(path14.join(dir, "package.json")) || parent === dir)
10697
10736
  return dir;
10698
10737
  dir = parent;
10699
10738
  }
10700
10739
  }, assetRoot = () => {
10701
10740
  const root = packageRoot();
10702
10741
  const assets = path14.join(root, "assets");
10703
- return existsSync3(assets) ? assets : root;
10742
+ return existsSync4(assets) ? assets : root;
10704
10743
  };
10705
10744
  var init_package_root = () => {};
10706
10745
 
@@ -14307,7 +14346,7 @@ var init_substance = __esm(() => {
14307
14346
  });
14308
14347
 
14309
14348
  // packages/workit-core/src/core/policy/lane.ts
14310
- import { existsSync as existsSync5, readFileSync as readFileSync5 } from "node:fs";
14349
+ import { existsSync as existsSync6, readFileSync as readFileSync5 } from "node:fs";
14311
14350
  import path18 from "node:path";
14312
14351
  function kindOf(file) {
14313
14352
  if (file.binary)
@@ -14521,7 +14560,7 @@ function branchLane(cwd, options) {
14521
14560
  }
14522
14561
  function untrackedRiskPathsWarning(cwd) {
14523
14562
  const root = worktreeTop(cwd);
14524
- if (!root || !existsSync5(path18.join(root, RISK_PATHS_FILE)))
14563
+ if (!root || !existsSync6(path18.join(root, RISK_PATHS_FILE)))
14525
14564
  return null;
14526
14565
  return isTracked(root, RISK_PATHS_FILE) ? null : `${RISK_PATHS_FILE} is not committed: it does not apply until it is committed on the base branch`;
14527
14566
  }
@@ -16139,7 +16178,7 @@ var init_ledger = __esm(() => {
16139
16178
  });
16140
16179
 
16141
16180
  // packages/workit-core/src/core/policy/derive.ts
16142
- import { existsSync as existsSync6 } from "node:fs";
16181
+ import { existsSync as existsSync7 } from "node:fs";
16143
16182
  import path21 from "node:path";
16144
16183
  function deriveRequirements(judgment, scope, constraints, verification = "self") {
16145
16184
  const out = [];
@@ -16294,7 +16333,7 @@ var RULES, derived2 = (spec) => ({
16294
16333
  decisionIds: []
16295
16334
  };
16296
16335
  }, planRecorded = (task, root) => {
16297
- const cited = (latestJudgment(task)?.refs ?? []).find((ref) => ref.kind === "external" || ref.kind === "file" && existsSync6(path21.resolve(root, ref.path)));
16336
+ const cited = (latestJudgment(task)?.refs ?? []).find((ref) => ref.kind === "external" || ref.kind === "file" && existsSync7(path21.resolve(root, ref.path)));
16298
16337
  if (cited)
16299
16338
  return {
16300
16339
  met: true,
@@ -21311,7 +21350,7 @@ var init_context_read = __esm(() => {
21311
21350
  });
21312
21351
 
21313
21352
  // packages/workit-core/src/core.ts
21314
- import { existsSync as existsSync8, realpathSync as realpathSync6 } from "node:fs";
21353
+ import { existsSync as existsSync9, realpathSync as realpathSync6 } from "node:fs";
21315
21354
  import path26 from "node:path";
21316
21355
  function resolveInside(root, candidate) {
21317
21356
  const base = realpathSync6(root);
@@ -21320,7 +21359,7 @@ function resolveInside(root, candidate) {
21320
21359
  throw new Error("path must stay inside repository root");
21321
21360
  }
21322
21361
  let ancestor = target;
21323
- while (!existsSync8(ancestor))
21362
+ while (!existsSync9(ancestor))
21324
21363
  ancestor = path26.dirname(ancestor);
21325
21364
  const canonicalAncestor = realpathSync6(ancestor);
21326
21365
  if (canonicalAncestor !== base && !canonicalAncestor.startsWith(base + path26.sep)) {
@@ -65556,10 +65595,10 @@ var init_changelog = __esm(() => {
65556
65595
 
65557
65596
  // packages/workit-core/src/core/hygiene.ts
65558
65597
  import { spawnSync as spawnSync12 } from "node:child_process";
65559
- import { existsSync as existsSync10, readFileSync as readFileSync11, readdirSync as readdirSync5, writeFileSync as writeFileSync5 } from "node:fs";
65598
+ import { existsSync as existsSync11, readFileSync as readFileSync11, readdirSync as readdirSync5, writeFileSync as writeFileSync5 } from "node:fs";
65560
65599
  import path29 from "node:path";
65561
65600
  var repoRoot2, templatesDir = () => path29.join(repoRoot2, "templates", "hygiene"), packageJson = (root) => {
65562
- if (!existsSync10(path29.join(root, "package.json")))
65601
+ if (!existsSync11(path29.join(root, "package.json")))
65563
65602
  return null;
65564
65603
  try {
65565
65604
  return JSON.parse(readFileSync11(path29.join(root, "package.json"), "utf8"));
@@ -65567,7 +65606,7 @@ var repoRoot2, templatesDir = () => path29.join(repoRoot2, "templates", "hygiene
65567
65606
  return null;
65568
65607
  }
65569
65608
  }, isOpenSource = (root) => {
65570
- if (existsSync10(path29.join(root, "LICENSE")))
65609
+ if (existsSync11(path29.join(root, "LICENSE")))
65571
65610
  return true;
65572
65611
  const pkg = packageJson(root);
65573
65612
  if (pkg && !pkg.private)
@@ -65594,7 +65633,7 @@ var repoRoot2, templatesDir = () => path29.join(repoRoot2, "templates", "hygiene
65594
65633
  return { ok: true, root: path29.resolve(root) };
65595
65634
  let children = [];
65596
65635
  try {
65597
- children = readdirSync5(start, { withFileTypes: true }).filter((entry) => entry.isDirectory() && existsSync10(path29.join(start, entry.name, ".git"))).map((entry) => path29.join(start, entry.name)).toSorted();
65636
+ children = readdirSync5(start, { withFileTypes: true }).filter((entry) => entry.isDirectory() && existsSync11(path29.join(start, entry.name, ".git"))).map((entry) => path29.join(start, entry.name)).toSorted();
65598
65637
  } catch {
65599
65638
  children = [];
65600
65639
  }
@@ -65610,10 +65649,10 @@ var repoRoot2, templatesDir = () => path29.join(repoRoot2, "templates", "hygiene
65610
65649
  files.push("LICENSE", "CONTRIBUTING.md");
65611
65650
  const planned = [];
65612
65651
  for (const file of files) {
65613
- if (existsSync10(path29.join(root, file)))
65652
+ if (existsSync11(path29.join(root, file)))
65614
65653
  continue;
65615
65654
  const tpl = path29.join(templatesDir(), file);
65616
- if (!existsSync10(tpl))
65655
+ if (!existsSync11(tpl))
65617
65656
  continue;
65618
65657
  const content = readFileSync11(tpl, "utf8").replace(/<PROJECT>/g, path29.basename(root)).replace(/<YEAR>/g, String(new Date().getFullYear())).replace(/<HOLDER>\s*/g, licenseHolder(root));
65619
65658
  planned.push({ path: path29.join(root, file), content });
@@ -65627,7 +65666,7 @@ var init_hygiene = __esm(() => {
65627
65666
  });
65628
65667
 
65629
65668
  // packages/workit-cli/src/admin/setup-state.ts
65630
- import { existsSync as existsSync11, readFileSync as readFileSync12 } from "node:fs";
65669
+ import { existsSync as existsSync12, readFileSync as readFileSync12 } from "node:fs";
65631
65670
  import path30 from "node:path";
65632
65671
  var classifySetupFile = (dir, name) => {
65633
65672
  const file = path30.join(dir, name);
@@ -65635,7 +65674,7 @@ var classifySetupFile = (dir, name) => {
65635
65674
  try {
65636
65675
  raw = readFileSync12(file, "utf8");
65637
65676
  } catch {
65638
- if (existsSync11(file)) {
65677
+ if (existsSync12(file)) {
65639
65678
  return { file, status: "malformed", error: `${file} is not readable` };
65640
65679
  }
65641
65680
  return { file, status: "missing" };
@@ -66073,7 +66112,7 @@ import { spawnSync as spawnSync14 } from "node:child_process";
66073
66112
  import {
66074
66113
  accessSync,
66075
66114
  constants as constants2,
66076
- existsSync as existsSync12,
66115
+ existsSync as existsSync13,
66077
66116
  readFileSync as readFileSync13,
66078
66117
  readdirSync as readdirSync6,
66079
66118
  realpathSync as realpathSync7,
@@ -66096,7 +66135,7 @@ function hostCommand(name, args, options = {}) {
66096
66135
  }
66097
66136
  return { command: executable, args, cwd: options.cwd, purpose: `${name} CLI` };
66098
66137
  }
66099
- function resolveWindowsShimEntry(contents, shim, exists = existsSync12) {
66138
+ function resolveWindowsShimEntry(contents, shim, exists = existsSync13) {
66100
66139
  const root = path33.win32.dirname(shim);
66101
66140
  const matches = contents.matchAll(/(["']?)([^\r\n"']*node_modules[\\/][^\r\n"']+?\.js)\1/gi);
66102
66141
  for (const match of matches) {
@@ -66139,7 +66178,7 @@ function findHostExecutable(name, options = {}) {
66139
66178
  }
66140
66179
  return null;
66141
66180
  }
66142
- function installedHostApp(host, home, env = process.env, platform = process.platform, exists = existsSync12) {
66181
+ function installedHostApp(host, home, env = process.env, platform = process.platform, exists = existsSync13) {
66143
66182
  const candidates = [];
66144
66183
  const pathApi = platform === "win32" ? path33.win32 : path33;
66145
66184
  if (platform === "darwin") {
@@ -66296,7 +66335,7 @@ ${result.stdout}
66296
66335
  ${result.stderr}`;
66297
66336
  if (command.packageRoot && command.packageTarget) {
66298
66337
  try {
66299
- if (!existsSync12(command.packageRoot)) {
66338
+ if (!existsSync13(command.packageRoot)) {
66300
66339
  return {
66301
66340
  ok: false,
66302
66341
  results: [
@@ -66526,7 +66565,7 @@ var resolveWindowsShimScript = (shim) => {
66526
66565
  path33.join(dir, "..", "node_modules", "npm", "bin", "npm-cli.js"),
66527
66566
  path33.join(dir, "..", "lib", "node_modules", "npm", "bin", "npm-cli.js")
66528
66567
  ];
66529
- return candidates.find((candidate) => existsSync12(candidate)) ?? null;
66568
+ return candidates.find((candidate) => existsSync13(candidate)) ?? null;
66530
66569
  };
66531
66570
  var init_host_install = __esm(() => {
66532
66571
  CLAUDE_PLUGIN_ID = `workit@${CLAUDE_MARKETPLACE_NAME}`;
@@ -66534,9 +66573,9 @@ var init_host_install = __esm(() => {
66534
66573
  });
66535
66574
 
66536
66575
  // packages/workit-core/src/core/skill-manifests.ts
66537
- import { cpSync as cpSync3, existsSync as existsSync13, readFileSync as readFileSync14, readdirSync as readdirSync7, statSync as statSync3, writeFileSync as writeFileSync6 } from "node:fs";
66576
+ import { cpSync as cpSync3, existsSync as existsSync14, readFileSync as readFileSync14, readdirSync as readdirSync7, statSync as statSync3, writeFileSync as writeFileSync6 } from "node:fs";
66538
66577
  import path34 from "node:path";
66539
- var WORKIT_METHOD_SKILLS, skillManifestNames = (root) => existsSync13(root) ? readdirSync7(root).filter((name) => existsSync13(path34.join(root, name, "SKILL.md"))).toSorted() : [], validateSkillManifests = (root, expected, label) => {
66578
+ var WORKIT_METHOD_SKILLS, skillManifestNames = (root) => existsSync14(root) ? readdirSync7(root).filter((name) => existsSync14(path34.join(root, name, "SKILL.md"))).toSorted() : [], validateSkillManifests = (root, expected, label) => {
66540
66579
  const actual = skillManifestNames(root);
66541
66580
  const missing = expected.filter((name) => !actual.includes(name));
66542
66581
  const extra = actual.filter((name) => !expected.includes(name));
@@ -66582,7 +66621,7 @@ var init_skill_manifests = __esm(() => {
66582
66621
  import { spawnSync as spawnSync15 } from "node:child_process";
66583
66622
  import {
66584
66623
  chmodSync,
66585
- existsSync as existsSync14,
66624
+ existsSync as existsSync15,
66586
66625
  lstatSync as lstatSync4,
66587
66626
  mkdirSync as mkdirSync5,
66588
66627
  readFileSync as readFileSync15,
@@ -66594,7 +66633,7 @@ import {
66594
66633
  import path35 from "node:path";
66595
66634
  function inspectSessionHook(cwd, env = process.env) {
66596
66635
  const none = { hooksDir: null, hookPath: null, helperPath: null, helperCurrent: false };
66597
- if (!existsSync14(cwd))
66636
+ if (!existsSync15(cwd))
66598
66637
  return { state: "not_git", ...none };
66599
66638
  const top = run2(cwd, ["rev-parse", "--show-toplevel"], env);
66600
66639
  if (!top.ok || !top.out)
@@ -66799,7 +66838,7 @@ exit 0
66799
66838
  } catch {
66800
66839
  return false;
66801
66840
  }
66802
- }, LEFTHOOK_CONFIGS, lefthookConfig = (top) => LEFTHOOK_CONFIGS.map((name) => path35.join(top, name)).find((file) => existsSync14(file)) ?? null, isComment = (line) => /^\s*#/.test(line), COMMAND_SH, DIRECT_CALL, VAR_CALL, runsHelperText = (text) => {
66841
+ }, LEFTHOOK_CONFIGS, lefthookConfig = (top) => LEFTHOOK_CONFIGS.map((name) => path35.join(top, name)).find((file) => existsSync15(file)) ?? null, isComment = (line) => /^\s*#/.test(line), COMMAND_SH, DIRECT_CALL, VAR_CALL, runsHelperText = (text) => {
66803
66842
  const lines = text.split(/\r?\n/).filter((line) => !isComment(line));
66804
66843
  const assigned = lines.some((line) => /(?:^|[\s;])h=/.test(line) && line.includes(HELPER_REF));
66805
66844
  return lines.some((line) => DIRECT_CALL.test(line) || assigned && VAR_CALL.test(line));
@@ -66851,7 +66890,7 @@ exit 0
66851
66890
  if (text === null || !runsHelperText(text))
66852
66891
  return false;
66853
66892
  return input.owner === "husky" && target !== input.hookPath || isExecutable(target);
66854
- }, isHuskyV9 = (text, hooksDir) => /\$\(dirname (?:-- )?"\$0"\)\/h"/.test(text) && existsSync14(path35.join(hooksDir, "h")), ownerOf = (text, hooksDir, top) => {
66893
+ }, isHuskyV9 = (text, hooksDir) => /\$\(dirname (?:-- )?"\$0"\)\/h"/.test(text) && existsSync15(path35.join(hooksDir, "h")), ownerOf = (text, hooksDir, top) => {
66855
66894
  if (text.includes("husky.sh") || isHuskyV9(text, hooksDir))
66856
66895
  return "husky";
66857
66896
  if (/lefthook/i.test(text) || lefthookConfig(top))
@@ -67010,7 +67049,7 @@ var init_delivery_verbs = __esm(() => {
67010
67049
  // packages/workit-cli/src/admin/host-permissions.ts
67011
67050
  import {
67012
67051
  copyFileSync as copyFileSync4,
67013
- existsSync as existsSync15,
67052
+ existsSync as existsSync16,
67014
67053
  readdirSync as readdirSync9,
67015
67054
  mkdirSync as mkdirSync7,
67016
67055
  readFileSync as readFileSync17,
@@ -67114,7 +67153,7 @@ function planHostPermissions(options) {
67114
67153
  if (!PERMISSION_HOSTS.has(host))
67115
67154
  continue;
67116
67155
  const target = permissionTarget(host, paths);
67117
- if (!existsSync15(target.hostDir)) {
67156
+ if (!existsSync16(target.hostDir)) {
67118
67157
  plan.notes.push(`${host}: not installed (${target.hostDir} is missing); nothing written`);
67119
67158
  continue;
67120
67159
  }
@@ -67267,7 +67306,7 @@ function applyHostPermissions(plan, options = {}) {
67267
67306
  }
67268
67307
  function permissionHealth(host, options = {}) {
67269
67308
  const target = permissionTarget(host, options);
67270
- if (!existsSync15(target.hostDir))
67309
+ if (!existsSync16(target.hostDir))
67271
67310
  return { state: "no-host" };
67272
67311
  const text = readText4(target.file);
67273
67312
  if (host === "codex") {
@@ -67301,7 +67340,7 @@ function permissionHealth(host, options = {}) {
67301
67340
  }
67302
67341
  function permissionCoverage(host, commands, options = {}) {
67303
67342
  const target = permissionTarget(host, options);
67304
- if (!existsSync15(target.hostDir))
67343
+ if (!existsSync16(target.hostDir))
67305
67344
  return { state: "no-host" };
67306
67345
  const cwd = options.cwd ?? process.cwd();
67307
67346
  let missing;
@@ -67486,7 +67525,7 @@ ${[...rules, ...lease, grant].join(`
67486
67525
  return null;
67487
67526
  }, setupCommand = (hosts) => `workit setup --hosts=${hosts.join(",")}`, removeCodexRules = (file, options = {}) => {
67488
67527
  const expected = permissionTarget("codex", options).file;
67489
- if (path38.resolve(file) !== path38.resolve(expected) || !existsSync15(expected))
67528
+ if (path38.resolve(file) !== path38.resolve(expected) || !existsSync16(expected))
67490
67529
  return false;
67491
67530
  rmSync3(expected);
67492
67531
  return true;
@@ -67627,7 +67666,7 @@ var init_host_permissions = __esm(() => {
67627
67666
  import { spawnSync as spawnSync16 } from "node:child_process";
67628
67667
  import { createHash as createHash14 } from "node:crypto";
67629
67668
  import {
67630
- existsSync as existsSync16,
67669
+ existsSync as existsSync17,
67631
67670
  lstatSync as lstatSync5,
67632
67671
  mkdirSync as mkdirSync8,
67633
67672
  mkdtempSync,
@@ -67645,7 +67684,7 @@ import path39 from "node:path";
67645
67684
  var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
67646
67685
  let dir = path39.resolve(cwd);
67647
67686
  while (true) {
67648
- if (existsSync16(path39.join(dir, "packages", "workit-core", "package.json")))
67687
+ if (existsSync17(path39.join(dir, "packages", "workit-core", "package.json")))
67649
67688
  return dir;
67650
67689
  const parent = path39.dirname(dir);
67651
67690
  if (parent === dir)
@@ -67750,14 +67789,14 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
67750
67789
  }
67751
67790
  return true;
67752
67791
  }, resolveBun = (env) => {
67753
- if (env.BUN && existsSync16(env.BUN))
67792
+ if (env.BUN && existsSync17(env.BUN))
67754
67793
  return env.BUN;
67755
67794
  for (const candidate of [
67756
67795
  path39.join(env.HOME || os12.homedir(), ".bun/bin/bun"),
67757
67796
  "/usr/local/bin/bun",
67758
67797
  "/usr/bin/bun"
67759
67798
  ]) {
67760
- if (existsSync16(candidate))
67799
+ if (existsSync17(candidate))
67761
67800
  return candidate;
67762
67801
  }
67763
67802
  return commandOnPath("bun", env) ? "bun" : null;
@@ -67982,7 +68021,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
67982
68021
  const dir = path39.join(codexHome, "plugins", "cache", marketplace, "workit");
67983
68022
  let versions = [];
67984
68023
  try {
67985
- versions = readdirSync10(dir).filter((v) => existsSync16(path39.join(dir, v, ".codex-plugin")));
68024
+ versions = readdirSync10(dir).filter((v) => existsSync17(path39.join(dir, v, ".codex-plugin")));
67986
68025
  } catch {
67987
68026
  versions = [];
67988
68027
  }
@@ -68091,7 +68130,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
68091
68130
  const installed = [];
68092
68131
  for (const install of installs) {
68093
68132
  const source = install.root ? path39.join(install.root, "agents") : null;
68094
- const files = source && existsSync16(source) ? readdirSync10(source).filter((f) => f.endsWith(".toml")).toSorted() : [];
68133
+ const files = source && existsSync17(source) ? readdirSync10(source).filter((f) => f.endsWith(".toml")).toSorted() : [];
68095
68134
  if (files.length === 0) {
68096
68135
  problems.push(`${install.id} ${install.version ?? "?"} bundles no agents`);
68097
68136
  fixes.push(`codex plugin remove ${install.id} && codex plugin add ${install.id}`);
@@ -68227,7 +68266,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
68227
68266
  return kept;
68228
68267
  }, checkPiExtension = (res) => {
68229
68268
  const agentDir = piAgentDirOf(res);
68230
- if (!existsSync16(agentDir) && !commandOnPath("pi", res.env))
68269
+ if (!existsSync17(agentDir) && !commandOnPath("pi", res.env))
68231
68270
  return {
68232
68271
  id: "pi_extension",
68233
68272
  status: "pass",
@@ -68253,7 +68292,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
68253
68292
  fix: entry.npm ? installCmd(entry.scope, entry.source) : `restore ${entry.root}, then ${rebuild}`
68254
68293
  };
68255
68294
  const declared = Array.isArray(pkg.pi?.extensions) ? pkg.pi.extensions.some((e) => typeof e === "string" && e.replace(/^\.\//, "") === PI_EXTENSION) : false;
68256
- if (!declared || !existsSync16(path39.join(entry.root, PI_EXTENSION)))
68295
+ if (!declared || !existsSync17(path39.join(entry.root, PI_EXTENSION)))
68257
68296
  return {
68258
68297
  id: "pi_extension",
68259
68298
  status: "warn",
@@ -68310,7 +68349,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
68310
68349
  switch (host) {
68311
68350
  case "opencode": {
68312
68351
  const packaged = path39.join(pkg, "assets", "skills");
68313
- const root = existsSync16(packaged) ? packaged : path39.join(dev, "packages", "workit-core", "skills");
68352
+ const root = existsSync17(packaged) ? packaged : path39.join(dev, "packages", "workit-core", "skills");
68314
68353
  return WORKIT_METHOD_SKILLS.map((skill) => path39.join(root, skill, "SKILL.md"));
68315
68354
  }
68316
68355
  case "cursor":
@@ -68324,7 +68363,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
68324
68363
  }
68325
68364
  }, hostsFor = (host) => host === "cli" ? ["opencode", "cursor", "cli"] : [host], checkAssets = (res) => {
68326
68365
  const dev = res.dev;
68327
- const missing = dev ? hostsFor(res.host).flatMap((h) => assetPathsFor(h, dev).filter((p) => !existsSync16(p)).map((p) => `${h}: ${p}`)) : [];
68366
+ const missing = dev ? hostsFor(res.host).flatMap((h) => assetPathsFor(h, dev).filter((p) => !existsSync17(p)).map((p) => `${h}: ${p}`)) : [];
68328
68367
  if (res.host === "cursor" || res.host === "cli") {
68329
68368
  const cursorError = validateCursorSkills(res.cursorPluginDir, WORKIT_METHOD_SKILLS);
68330
68369
  if (cursorError)
@@ -68375,7 +68414,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
68375
68414
  return false;
68376
68415
  }
68377
68416
  }, registeredCursorLauncher = (res) => {
68378
- if (!existsSync16(res.cursorMcp))
68417
+ if (!existsSync17(res.cursorMcp))
68379
68418
  return "invalid";
68380
68419
  const config = readJson(res.cursorMcp);
68381
68420
  if (!config)
@@ -68404,7 +68443,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
68404
68443
  };
68405
68444
  }, canonicalCursorHook, isCanonicalCursorHook = (command, res) => command === canonicalCursorHook || command === cursorHooksEntry(res.cursorPluginDir).command, registeredCursorHook = (res) => {
68406
68445
  const hooksFile = path39.join(res.cursorPluginDir, "hooks", "hooks-cursor.json");
68407
- if (!existsSync16(hooksFile))
68446
+ if (!existsSync17(hooksFile))
68408
68447
  return "invalid";
68409
68448
  const config = readJson(hooksFile);
68410
68449
  if (!config)
@@ -68447,7 +68486,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
68447
68486
  }
68448
68487
  }
68449
68488
  if (dev) {
68450
- missing.push(...hosts.filter((h) => h !== "cursor").flatMap((h) => launcherSlotsFor(h, dev).filter((slot) => !slot.some((p) => existsSync16(p))).map((slot) => `${h}: ${slot.join(" or ")}`)));
68489
+ missing.push(...hosts.filter((h) => h !== "cursor").flatMap((h) => launcherSlotsFor(h, dev).filter((slot) => !slot.some((p) => existsSync17(p))).map((slot) => `${h}: ${slot.join(" or ")}`)));
68451
68490
  }
68452
68491
  if (missing.length > 0) {
68453
68492
  return {
@@ -68473,7 +68512,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
68473
68512
  const problems = [];
68474
68513
  const fixes = [];
68475
68514
  if (hostsFor(res.host).includes("cursor")) {
68476
- const settings = existsSync16(res.cursorSettings) ? readJson(res.cursorSettings) : null;
68515
+ const settings = existsSync17(res.cursorSettings) ? readJson(res.cursorSettings) : null;
68477
68516
  const dirs = Array.isArray(settings?.plugin_dirs) ? settings.plugin_dirs : [];
68478
68517
  for (const entry of dirs.map(String)) {
68479
68518
  const normal = entry.replaceAll("\\", "/").replace(/\/+$/, "");
@@ -68517,14 +68556,14 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
68517
68556
  status: "pass",
68518
68557
  detail: "cursor hook not inspected on this host"
68519
68558
  };
68520
- if (!existsSync16(res.cursorPluginDir))
68559
+ if (!existsSync17(res.cursorPluginDir))
68521
68560
  return {
68522
68561
  id: "cursor_hook",
68523
68562
  status: "pass",
68524
68563
  detail: "no Cursor plugin install — hook launcher not inspected"
68525
68564
  };
68526
68565
  const launcher = path39.join(res.cursorPluginDir, "hooks", "launch.mjs");
68527
- if (!existsSync16(launcher))
68566
+ if (!existsSync17(launcher))
68528
68567
  return {
68529
68568
  id: "cursor_hook",
68530
68569
  status: "warn",
@@ -68646,7 +68685,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
68646
68685
  return "fragile-cache";
68647
68686
  if (entry.startsWith("file:")) {
68648
68687
  const target = entry.replace(/^file:\/\//, "").replace(/^file:/, "");
68649
- return existsSync16(target) ? "ok" : "missing-file";
68688
+ return existsSync17(target) ? "ok" : "missing-file";
68650
68689
  }
68651
68690
  return "ok";
68652
68691
  }, checkStalePin = (res) => {
@@ -68657,7 +68696,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
68657
68696
  detail: "opencode pin not inspected on the cursor host"
68658
68697
  };
68659
68698
  }
68660
- if (!existsSync16(res.opencodeConfig)) {
68699
+ if (!existsSync17(res.opencodeConfig)) {
68661
68700
  return {
68662
68701
  id: "stale_pin",
68663
68702
  status: "pass",
@@ -68710,7 +68749,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
68710
68749
  return { id: "stale_pin", status: "pass", detail: "opencode pin resolves" };
68711
68750
  }, pluginMcpSelectors = (res) => {
68712
68751
  const p = path39.join(res.cursorPluginDir, "mcp.json");
68713
- if (!existsSync16(p))
68752
+ if (!existsSync17(p))
68714
68753
  return null;
68715
68754
  const cfg = readJson(p);
68716
68755
  const server = cfg?.mcpServers?.workit;
@@ -68758,7 +68797,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
68758
68797
  dir = path39.dirname(dir);
68759
68798
  return { version: found.version, dir };
68760
68799
  }, checkOpenCodePackageCache = (res) => {
68761
- if (!existsSync16(res.opencodeConfig)) {
68800
+ if (!existsSync17(res.opencodeConfig)) {
68762
68801
  return {
68763
68802
  id: "stale_install",
68764
68803
  status: "pass",
@@ -68833,7 +68872,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
68833
68872
  detail: "cursor plugin not inspected on this host"
68834
68873
  };
68835
68874
  }
68836
- if (existsSync16(res.cursorPluginDir) && lstatSync5(res.cursorPluginDir).isSymbolicLink()) {
68875
+ if (existsSync17(res.cursorPluginDir) && lstatSync5(res.cursorPluginDir).isSymbolicLink()) {
68837
68876
  let target = "";
68838
68877
  try {
68839
68878
  target = readlinkSync2(res.cursorPluginDir);
@@ -68871,7 +68910,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
68871
68910
  fix: "Re-run install-cursor-plugin.sh — it rewrites the sessionStart hook to the canonical pinned launcher"
68872
68911
  };
68873
68912
  }
68874
- const hookDrift = existsSync16(hooksFile) ? cursorHookDrift(readJson(hooksFile), res.cursorPluginDir) : [];
68913
+ const hookDrift = existsSync17(hooksFile) ? cursorHookDrift(readJson(hooksFile), res.cursorPluginDir) : [];
68875
68914
  if (hookDrift.length > 0) {
68876
68915
  return {
68877
68916
  id: "stale_install",
@@ -68955,13 +68994,13 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
68955
68994
  const problems = [];
68956
68995
  const opencodeHost = res.host !== "cursor";
68957
68996
  const cursorHost = res.host !== "opencode";
68958
- if (opencodeHost && existsSync16(res.opencodeConfig)) {
68997
+ if (opencodeHost && existsSync17(res.opencodeConfig)) {
68959
68998
  const cfg = readJson(res.opencodeConfig);
68960
68999
  const entries = pluginEntries(cfg);
68961
69000
  if (entries.length > 1)
68962
69001
  problems.push(`opencode registers ${entries.length} workit plugin entries`);
68963
69002
  }
68964
- if (cursorHost && existsSync16(res.cursorSettings)) {
69003
+ if (cursorHost && existsSync17(res.cursorSettings)) {
68965
69004
  const settings = readJson(res.cursorSettings);
68966
69005
  const enabled = settings?.enabled_plugins;
68967
69006
  if (enabled && typeof enabled === "object") {
@@ -68976,7 +69015,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
68976
69015
  if (dirs.length > 1)
68977
69016
  problems.push(`cursor plugin_dirs has ${dirs.length} workit entries`);
68978
69017
  }
68979
- if (cursorHost && existsSync16(res.cursorMcp)) {
69018
+ if (cursorHost && existsSync17(res.cursorMcp)) {
68980
69019
  const mcp = readJson(res.cursorMcp);
68981
69020
  const servers = mcp?.mcpServers ?? {};
68982
69021
  if (servers && typeof servers === "object") {
@@ -69002,16 +69041,16 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
69002
69041
  const files = [];
69003
69042
  for (const name of ["config.json", "youtrack.json", "vcs.json", "workspaces.json"]) {
69004
69043
  const p = path39.join(res.configDir, name);
69005
- if (existsSync16(p))
69044
+ if (existsSync17(p))
69006
69045
  files.push(p);
69007
69046
  }
69008
69047
  const opencodeHost = res.host !== "cursor";
69009
69048
  const cursorHost = res.host !== "opencode";
69010
- if (opencodeHost && existsSync16(res.opencodeConfig))
69049
+ if (opencodeHost && existsSync17(res.opencodeConfig))
69011
69050
  files.push(res.opencodeConfig);
69012
- if (cursorHost && existsSync16(res.cursorSettings))
69051
+ if (cursorHost && existsSync17(res.cursorSettings))
69013
69052
  files.push(res.cursorSettings);
69014
- if (cursorHost && existsSync16(res.cursorMcp))
69053
+ if (cursorHost && existsSync17(res.cursorMcp))
69015
69054
  files.push(res.cursorMcp);
69016
69055
  const bad = files.filter((p) => !parsesAsConfigObject(p));
69017
69056
  if (bad.length === 0)
@@ -69231,7 +69270,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
69231
69270
  const youtrackJson = readJson(path39.join(res.configDir, "youtrack.json"));
69232
69271
  if (youtrackJson) {
69233
69272
  tokenPaths.push(typeof youtrackJson.tokenFile === "string" ? youtrackJson.tokenFile : path39.join(res.configDir, "youtrack.token"));
69234
- } else if (existsSync16(path39.join(res.configDir, "youtrack.token"))) {
69273
+ } else if (existsSync17(path39.join(res.configDir, "youtrack.token"))) {
69235
69274
  tokenPaths.push(path39.join(res.configDir, "youtrack.token"));
69236
69275
  }
69237
69276
  if (tokenPaths.length === 0) {
@@ -69244,7 +69283,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
69244
69283
  const problems = [];
69245
69284
  for (const raw of tokenPaths) {
69246
69285
  const p = path39.isAbsolute(raw) ? raw : path39.resolve(res.configDir, raw);
69247
- if (!existsSync16(p)) {
69286
+ if (!existsSync17(p)) {
69248
69287
  problems.push(`${p} is missing`);
69249
69288
  continue;
69250
69289
  }
@@ -69571,8 +69610,8 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
69571
69610
  };
69572
69611
  }, checkChecksConfig = (res) => {
69573
69612
  const root = checkRoot(res.cwd);
69574
- const current = existsSync16(path39.join(root, CHECKS_FILE));
69575
- const legacy = existsSync16(path39.join(root, LEGACY_CHECKS_FILE));
69613
+ const current = existsSync17(path39.join(root, CHECKS_FILE));
69614
+ const legacy = existsSync17(path39.join(root, LEGACY_CHECKS_FILE));
69576
69615
  if (!legacy)
69577
69616
  return {
69578
69617
  id: "checks_config",
@@ -69589,9 +69628,9 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
69589
69628
  const root = checkRoot(resolve(options).cwd);
69590
69629
  const from = path39.join(root, LEGACY_CHECKS_FILE);
69591
69630
  const to = path39.join(root, CHECKS_FILE);
69592
- if (!existsSync16(from))
69631
+ if (!existsSync17(from))
69593
69632
  return { action: "none", detail: `no ${LEGACY_CHECKS_FILE} at ${root}` };
69594
- if (existsSync16(to))
69633
+ if (existsSync17(to))
69595
69634
  return {
69596
69635
  action: "skipped",
69597
69636
  detail: `${CHECKS_FILE} already exists; ${LEGACY_CHECKS_FILE} left in place`
@@ -69885,7 +69924,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
69885
69924
  return {
69886
69925
  id,
69887
69926
  status: "warn",
69888
- detail: `${host} rules in ${coverage.file} do not cover ${shown}${coverage.missing.length > 4 ? ", …" : ""}${existsSync16(coverage.file) ? "" : ` (${coverage.file} does not exist yet; \`workit setup\` writes it)`}: agents get a prompt (or an auto-mode denial) on verbs the workspace grants`,
69927
+ detail: `${host} rules in ${coverage.file} do not cover ${shown}${coverage.missing.length > 4 ? ", …" : ""}${existsSync17(coverage.file) ? "" : ` (${coverage.file} does not exist yet; \`workit setup\` writes it)`}: agents get a prompt (or an auto-mode denial) on verbs the workspace grants`,
69889
69928
  fix: `workit setup --hosts=${host}`
69890
69929
  };
69891
69930
  }, ago = (ms) => {
@@ -70046,7 +70085,7 @@ var init_doctor = __esm(() => {
70046
70085
  import {
70047
70086
  copyFileSync as copyFileSync5,
70048
70087
  cpSync as cpSync4,
70049
- existsSync as existsSync17,
70088
+ existsSync as existsSync18,
70050
70089
  lstatSync as lstatSync6,
70051
70090
  mkdirSync as mkdirSync9,
70052
70091
  mkdtempSync as mkdtempSync2,
@@ -70157,7 +70196,7 @@ function buildSetupPreview(values, opts = {}) {
70157
70196
  path: ytPath,
70158
70197
  value: draft
70159
70198
  });
70160
- if (existsSync17(tokenPath))
70199
+ if (existsSync18(tokenPath))
70161
70200
  preserved.push(tokenPath);
70162
70201
  else
70163
70202
  mutations.push({
@@ -70224,7 +70263,7 @@ function buildSetupPreview(values, opts = {}) {
70224
70263
  if (target?.ok) {
70225
70264
  const root = target.root;
70226
70265
  const gitignorePath = path40.join(root, ".gitignore");
70227
- const existing = existsSync17(gitignorePath) ? readFileSync19(gitignorePath, "utf8") : "";
70266
+ const existing = existsSync18(gitignorePath) ? readFileSync19(gitignorePath, "utf8") : "";
70228
70267
  const existingLines = new Set(existing.split(`
70229
70268
  `).map((l) => l.trim()).filter(Boolean));
70230
70269
  const entries = GITIGNORE_ENTRIES.filter((e) => e.trim() !== "" && !existingLines.has(e.trim()));
@@ -70500,11 +70539,11 @@ function applyOpenCode(root, res) {
70500
70539
  function copyPluginDir(src, dest) {
70501
70540
  const realSrc = realpathSync9(src);
70502
70541
  const marker = path40.join(dest, ".workit-root");
70503
- const destIsLink = existsSync17(dest) && lstatSync6(dest).isSymbolicLink();
70542
+ const destIsLink = existsSync18(dest) && lstatSync6(dest).isSymbolicLink();
70504
70543
  const synced = !destIsLink && readFileSafe(marker)?.trim() === realSrc && samePluginContent(realSrc, dest, dest);
70505
70544
  if (synced)
70506
70545
  return "Skipped";
70507
- const hadDir = existsSync17(dest);
70546
+ const hadDir = existsSync18(dest);
70508
70547
  const rules = preservedCursorRules(realSrc, dest);
70509
70548
  const parent = path40.dirname(dest);
70510
70549
  mkdirSync9(parent, { recursive: true });
@@ -70517,7 +70556,7 @@ function copyPluginDir(src, dest) {
70517
70556
  filter: (entry) => !path40.relative(realSrc, entry).split(path40.sep).includes("node_modules")
70518
70557
  });
70519
70558
  const stagedHooks = path40.join(stage, CURSOR_HOOKS_FILE);
70520
- if (existsSync17(stagedHooks))
70559
+ if (existsSync18(stagedHooks))
70521
70560
  writeFileSync10(stagedHooks, localizedCursorHooks(readFileSync19(stagedHooks), dest));
70522
70561
  for (const [name, content] of rules) {
70523
70562
  mkdirSync9(path40.join(stage, "rules"), { recursive: true });
@@ -70535,7 +70574,7 @@ function copyPluginDir(src, dest) {
70535
70574
  try {
70536
70575
  renameSync5(stage, dest);
70537
70576
  } catch (error) {
70538
- if (hadDir && !existsSync17(dest))
70577
+ if (hadDir && !existsSync18(dest))
70539
70578
  renameSync5(backup, dest);
70540
70579
  throw error;
70541
70580
  }
@@ -70613,9 +70652,9 @@ function applyCursorMcp(root, res) {
70613
70652
  };
70614
70653
  }
70615
70654
  function verifyPlatform(platform, res) {
70616
- if (platform === "opencode" && !existsSync17(res.opencodeConfig))
70655
+ if (platform === "opencode" && !existsSync18(res.opencodeConfig))
70617
70656
  return null;
70618
- if (platform === "cursor" && !existsSync17(res.cursorSettings) && !existsSync17(res.cursorMcp)) {
70657
+ if (platform === "cursor" && !existsSync18(res.cursorSettings) && !existsSync18(res.cursorMcp)) {
70619
70658
  return null;
70620
70659
  }
70621
70660
  return runDoctor({
@@ -70896,7 +70935,7 @@ var TOKEN_PLACEHOLDER3 = "YOUR_TOKEN_HERE", YT_OVERRIDES, VCS_OVERRIDES, SETUP_O
70896
70935
  try {
70897
70936
  raw = readFileSync19(p, "utf8");
70898
70937
  } catch {
70899
- if (existsSync17(p))
70938
+ if (existsSync18(p))
70900
70939
  return { kind: "malformed", error: `${p} is not readable` };
70901
70940
  return { kind: "missing" };
70902
70941
  }
@@ -70951,7 +70990,7 @@ var TOKEN_PLACEHOLDER3 = "YOUR_TOKEN_HERE", YT_OVERRIDES, VCS_OVERRIDES, SETUP_O
70951
70990
  return OPENCODE_NPM_PIN;
70952
70991
  for (const rel of ["src/plugin.ts", "dist/plugin.js"]) {
70953
70992
  const entry = path40.join(root, rel);
70954
- if (existsSync17(entry))
70993
+ if (existsSync18(entry))
70955
70994
  return `file://${entry}`;
70956
70995
  }
70957
70996
  return null;
@@ -70981,7 +71020,7 @@ var TOKEN_PLACEHOLDER3 = "YOUR_TOKEN_HERE", YT_OVERRIDES, VCS_OVERRIDES, SETUP_O
70981
71020
  }
70982
71021
  }
70983
71022
  for (const entry of readdirSync11(dest, { withFileTypes: true })) {
70984
- if (existsSync17(path40.join(src, entry.name)))
71023
+ if (existsSync18(path40.join(src, entry.name)))
70985
71024
  continue;
70986
71025
  const rel = path40.join(relative, entry.name);
70987
71026
  if (rel === ".workit-root")
@@ -71002,7 +71041,7 @@ var TOKEN_PLACEHOLDER3 = "YOUR_TOKEN_HERE", YT_OVERRIDES, VCS_OVERRIDES, SETUP_O
71002
71041
  for (const entry of readdirSync11(installedRules, { withFileTypes: true })) {
71003
71042
  if (!entry.isFile() || !entry.name.endsWith(".mdc"))
71004
71043
  continue;
71005
- if (existsSync17(path40.join(sourceRules, entry.name)))
71044
+ if (existsSync18(path40.join(sourceRules, entry.name)))
71006
71045
  continue;
71007
71046
  preserved.set(entry.name, readFileSync19(path40.join(installedRules, entry.name)));
71008
71047
  }
@@ -71010,17 +71049,17 @@ var TOKEN_PLACEHOLDER3 = "YOUR_TOKEN_HERE", YT_OVERRIDES, VCS_OVERRIDES, SETUP_O
71010
71049
  return preserved;
71011
71050
  }, removeLegacyCursorDir = (res) => {
71012
71051
  const legacy = path40.join(res.home, ".cursor", "plugins", "local", "workflow-toolkit");
71013
- if (legacy === res.cursorPluginDir || !existsSync17(legacy))
71052
+ if (legacy === res.cursorPluginDir || !existsSync18(legacy))
71014
71053
  return;
71015
71054
  const legacyRules = path40.join(legacy, "rules");
71016
- if (existsSync17(legacyRules)) {
71055
+ if (existsSync18(legacyRules)) {
71017
71056
  try {
71018
71057
  mkdirSync9(path40.join(res.cursorPluginDir, "rules"), { recursive: true });
71019
71058
  for (const entry of readdirSync11(legacyRules, { withFileTypes: true })) {
71020
71059
  if (!entry.isFile() || !entry.name.endsWith(".mdc"))
71021
71060
  continue;
71022
71061
  const target = path40.join(res.cursorPluginDir, "rules", entry.name);
71023
- if (!existsSync17(target))
71062
+ if (!existsSync18(target))
71024
71063
  copyFileSync5(path40.join(legacyRules, entry.name), target);
71025
71064
  }
71026
71065
  } catch {}
@@ -71409,7 +71448,7 @@ var init_logic = __esm(() => {
71409
71448
  });
71410
71449
 
71411
71450
  // packages/workit-cli/src/wizard-state.ts
71412
- import { existsSync as existsSync18, statSync as statSync8 } from "node:fs";
71451
+ import { existsSync as existsSync19, statSync as statSync8 } from "node:fs";
71413
71452
  import path42 from "node:path";
71414
71453
  import { isDeepStrictEqual as isDeepStrictEqual4 } from "node:util";
71415
71454
  function resolveBasePath(values, env = process.env) {
@@ -71938,7 +71977,7 @@ var NEXT, PREV, skipsCustomBranch = (screen, preset) => (screen === "branchAllow
71938
71977
  if (!p)
71939
71978
  return "workspace root path is required";
71940
71979
  return !path42.isAbsolute(p) || !isDirectory(p) ? `invalid workspace root "${p}" — enter an existing absolute directory` : null;
71941
- }, skipsBranchPolicy = (screen, basePath) => (screen === "branchPolicy" || screen === "branchPolicyDevelop") && !existsSync18(path42.join(basePath, ".git")), decodeBranchPreset = (value, fallback) => value === "gitflow" || value === "github-flow" || value === "trunk-based" || value === "custom" ? value : fallback, decodeVcsProvider = (value, fallback) => value === "gitlab" || value === "github" || value === "skip" ? value : fallback, decodeIssueTracker = (value, fallback) => value === "youtrack" || value === "github" || value === "gitlab" || value === "none" ? value : fallback, GITHUB_ISSUES, withGithubIssues = (draft, tracker) => tracker === "github" ? { ...draft, issues: { ...GITHUB_ISSUES } } : draft;
71980
+ }, skipsBranchPolicy = (screen, basePath) => (screen === "branchPolicy" || screen === "branchPolicyDevelop") && !existsSync19(path42.join(basePath, ".git")), decodeBranchPreset = (value, fallback) => value === "gitflow" || value === "github-flow" || value === "trunk-based" || value === "custom" ? value : fallback, decodeVcsProvider = (value, fallback) => value === "gitlab" || value === "github" || value === "skip" ? value : fallback, decodeIssueTracker = (value, fallback) => value === "youtrack" || value === "github" || value === "gitlab" || value === "none" ? value : fallback, GITHUB_ISSUES, withGithubIssues = (draft, tracker) => tracker === "github" ? { ...draft, issues: { ...GITHUB_ISSUES } } : draft;
71942
71981
  var init_wizard_state = __esm(() => {
71943
71982
  init_config();
71944
71983
  init_workspaces();
@@ -71997,7 +72036,7 @@ var init_wizard_state = __esm(() => {
71997
72036
  });
71998
72037
 
71999
72038
  // packages/workit-cli/src/admin/uninstall.ts
72000
- import { existsSync as existsSync19, readFileSync as readFileSync21, realpathSync as realpathSync10, rmSync as rmSync7, writeFileSync as writeFileSync12 } from "node:fs";
72039
+ import { existsSync as existsSync20, readFileSync as readFileSync21, realpathSync as realpathSync10, rmSync as rmSync7, writeFileSync as writeFileSync12 } from "node:fs";
72001
72040
  import os14 from "node:os";
72002
72041
  import path43 from "node:path";
72003
72042
  function cleanCursorSettings(settings, pluginDir) {
@@ -72099,7 +72138,7 @@ function planUninstall(paths = {}) {
72099
72138
  const mcpExisting = readJsonRecord(res.cursorMcp);
72100
72139
  const settingsDirty = settingsExisting.kind === "malformed" || settingsExisting.kind === "record" && cleanCursorSettings(settingsExisting.value, res.cursorPluginDir).changed;
72101
72140
  const mcpDirty = mcpExisting.kind === "malformed" || mcpExisting.kind === "record" && cleanCursorMcp(mcpExisting.value).changed;
72102
- const dirExists = existsSync19(res.cursorPluginDir);
72141
+ const dirExists = existsSync20(res.cursorPluginDir);
72103
72142
  const actions = [];
72104
72143
  if (settingsDirty) {
72105
72144
  actions.push({
@@ -72127,7 +72166,7 @@ function planUninstall(paths = {}) {
72127
72166
  installed: settingsDirty || mcpDirty || dirExists,
72128
72167
  actions
72129
72168
  };
72130
- const codexInstalled = existsSync19(res.codexPluginDir);
72169
+ const codexInstalled = existsSync20(res.codexPluginDir);
72131
72170
  const codex = {
72132
72171
  host: "codex",
72133
72172
  installed: codexInstalled,
@@ -72175,7 +72214,7 @@ function planUninstall(paths = {}) {
72175
72214
  detail: `remove Workit's permission block from ${path43.basename(file)}`
72176
72215
  });
72177
72216
  }
72178
- if (existsSync19(res.codexRules))
72217
+ if (existsSync20(res.codexRules))
72179
72218
  codex.actions.push({
72180
72219
  kind: "remove-file",
72181
72220
  path: res.codexRules,
@@ -72211,7 +72250,7 @@ function applyUninstall(plan, paths = {}) {
72211
72250
  if (!allowed) {
72212
72251
  status = "failed";
72213
72252
  detail = `refusing to remove non-canonical plugin directory: ${resolved}`;
72214
- } else if (!existsSync19(resolved)) {
72253
+ } else if (!existsSync20(resolved)) {
72215
72254
  status = "skipped";
72216
72255
  detail = "directory already absent";
72217
72256
  } else {
@@ -72261,7 +72300,7 @@ var resolveUninstallPaths = (options = {}) => {
72261
72300
  try {
72262
72301
  raw = readFileSync21(file, "utf8");
72263
72302
  } catch {
72264
- if (existsSync19(file))
72303
+ if (existsSync20(file))
72265
72304
  return { kind: "malformed", error: `${file} is not readable` };
72266
72305
  return { kind: "missing" };
72267
72306
  }
@@ -75110,7 +75149,7 @@ var init_setup2 = __esm(() => {
75110
75149
  });
75111
75150
 
75112
75151
  // packages/workit-cli/src/upgrade/shared.ts
75113
- import { existsSync as existsSync20, readFileSync as readFileSync22 } from "node:fs";
75152
+ import { existsSync as existsSync21, readFileSync as readFileSync22 } from "node:fs";
75114
75153
  import path44 from "node:path";
75115
75154
  import os16 from "node:os";
75116
75155
  import { createHash as createHash15 } from "node:crypto";
@@ -75143,7 +75182,7 @@ var LAUNCH_HOSTS, HOSTS2, LIVE_HOSTS, OPENCODE_PACKAGE = "@brainervirus/workit-o
75143
75182
  cursorRoot: path44.join(home, ".cursor/plugins/local/workit")
75144
75183
  };
75145
75184
  }, object2 = (file) => {
75146
- if (!existsSync20(file))
75185
+ if (!existsSync21(file))
75147
75186
  return null;
75148
75187
  let data;
75149
75188
  try {
@@ -75160,7 +75199,7 @@ var LAUNCH_HOSTS, HOSTS2, LIVE_HOSTS, OPENCODE_PACKAGE = "@brainervirus/workit-o
75160
75199
  } catch {
75161
75200
  return null;
75162
75201
  }
75163
- }, digest2 = (file) => existsSync20(file) ? createHash15("sha256").update(readFileSync22(file)).digest("hex") : "missing", runner = (deps) => deps.run ?? ((command, args) => {
75202
+ }, digest2 = (file) => existsSync21(file) ? createHash15("sha256").update(readFileSync22(file)).digest("hex") : "missing", runner = (deps) => deps.run ?? ((command, args) => {
75164
75203
  const { home, env } = upgradePaths(deps);
75165
75204
  let step;
75166
75205
  try {
@@ -75256,7 +75295,7 @@ var init_processes = __esm(() => {
75256
75295
  });
75257
75296
 
75258
75297
  // packages/workit-cli/src/upgrade/apply.ts
75259
- import { existsSync as existsSync21, readdirSync as readdirSync12, mkdirSync as mkdirSync11, copyFileSync as copyFileSync6, chmodSync as chmodSync2, cpSync as cpSync5 } from "node:fs";
75298
+ import { existsSync as existsSync22, readdirSync as readdirSync12, mkdirSync as mkdirSync11, copyFileSync as copyFileSync6, chmodSync as chmodSync2, cpSync as cpSync5 } from "node:fs";
75260
75299
  import path46 from "node:path";
75261
75300
  import { createHash as createHash16 } from "node:crypto";
75262
75301
  function applyUpgrade(plan, deps = {}) {
@@ -75295,7 +75334,7 @@ function applyUpgrade(plan, deps = {}) {
75295
75334
  const backup = path46.join(home, ".local/state/workit/upgrades", new Date().toISOString().replaceAll(":", "-"));
75296
75335
  mkdirSync11(backup, { recursive: true, mode: 448 });
75297
75336
  for (const file of Object.keys(plan.configDigests))
75298
- if (existsSync21(file)) {
75337
+ if (existsSync22(file)) {
75299
75338
  const target = path46.join(backup, createHash16("sha256").update(file).digest("hex").slice(0, 12) + "-" + path46.basename(file));
75300
75339
  copyFileSync6(file, target);
75301
75340
  chmodSync2(target, 384);
@@ -75315,7 +75354,7 @@ function applyUpgrade(plan, deps = {}) {
75315
75354
  }
75316
75355
  const run = runner(deps);
75317
75356
  let cursorBackupError = null;
75318
- if (plan.entries.some((entry) => entry.host === "cursor") && existsSync21(paths.cursorRoot))
75357
+ if (plan.entries.some((entry) => entry.host === "cursor") && existsSync22(paths.cursorRoot))
75319
75358
  try {
75320
75359
  cpSync5(paths.cursorRoot, path46.join(backup, "cursor-package"), {
75321
75360
  recursive: true
@@ -75582,7 +75621,7 @@ var codexPluginRoot = (codexHome) => {
75582
75621
  }, refreshCodexAgents = (run, codexHome) => {
75583
75622
  const root = codexPluginRoot(codexHome);
75584
75623
  const launcher = root && path46.join(root, "dist", "launch-mcp.js");
75585
- if (!launcher || !existsSync21(launcher))
75624
+ if (!launcher || !existsSync22(launcher))
75586
75625
  return { ok: true, note: "" };
75587
75626
  const fix = `node ${JSON.stringify(launcher)} --install-agents`;
75588
75627
  return run("node", [launcher, "--install-agents"]).status === 0 ? { ok: true, note: "agents refreshed" } : { ok: false, note: "agent refresh failed", fix };
@@ -75621,7 +75660,7 @@ var init_apply = __esm(() => {
75621
75660
  });
75622
75661
 
75623
75662
  // packages/workit-cli/src/upgrade/plan.ts
75624
- import { existsSync as existsSync22, mkdtempSync as mkdtempSync3, rmSync as rmSync8, lstatSync as lstatSync7, readFileSync as readFileSync23 } from "node:fs";
75663
+ import { existsSync as existsSync23, mkdtempSync as mkdtempSync3, rmSync as rmSync8, lstatSync as lstatSync7, readFileSync as readFileSync23 } from "node:fs";
75625
75664
  import path47 from "node:path";
75626
75665
  import os17 from "node:os";
75627
75666
  function previewUpgrade(hosts = HOSTS2, deps = {}) {
@@ -75808,7 +75847,7 @@ var codexRegistered = (configFile) => {
75808
75847
  }
75809
75848
  };
75810
75849
  guard("opencode", () => {
75811
- if (existsSync22(paths.opencodeConfig + "c"))
75850
+ if (existsSync23(paths.opencodeConfig + "c"))
75812
75851
  throw new Error("OpenCode JSONC config is present; inspect effective native configuration before updating");
75813
75852
  const oc = object2(paths.opencodeConfig);
75814
75853
  if (oc && [oc.plugins, oc.plugin].some((value) => value !== undefined && !Array.isArray(value)))
@@ -75865,7 +75904,7 @@ var codexRegistered = (configFile) => {
75865
75904
  hostCommand("codex", [], { home, env: paths.env });
75866
75905
  available = true;
75867
75906
  } catch {}
75868
- if (available || existsSync22(paths.codexConfig))
75907
+ if (available || existsSync23(paths.codexConfig))
75869
75908
  throw new Error("Codex plugin inventory failed; inspect the native host before upgrading");
75870
75909
  return;
75871
75910
  }
@@ -77276,7 +77315,7 @@ async function runGrant(argv, io, deps = defaultDeps) {
77276
77315
  return change(sub, rest, io, deps);
77277
77316
  return usage2(io, `unknown subcommand "${sub}"`);
77278
77317
  }
77279
- var USAGE4 = "workit grant show [<workspace>] [--all] | grant set <workspace> <kind>=<true|false|verified>… [defaultEndpoint=commit|pr|green|merged] [verification=proportional|self|independent] | grant unset <workspace> <kind>… (kinds: push, pr, merge, release, rerun, defaultEndpoint, verification)", AGENT_ENV, agentMarker = (env) => AGENT_ENV.find((name) => env[name]) ?? Object.keys(env).find((name) => name.startsWith("CODEX_") && env[name]), defaultDeps, parseValue = (raw) => raw === "true" || raw === "yes" || raw === "on" ? true : raw === "false" || raw === "no" || raw === "off" ? false : raw === "verified" ? "verified" : null, STOPS_AT, endpointLabel = (view) => view.effectiveEndpoint === view.defaultEndpoint ? view.defaultEndpoint : `${view.defaultEndpoint} (effective: ${view.effectiveEndpoint}${view.endpointReason ? `, ${view.endpointReason}` : ""})`, VERIFICATION_STRICTNESS, VERIFICATION_TEXT, describe3 = (grants, configured, endpoint, verification) => [
77318
+ var USAGE4 = "workit grant show [<workspace>] [--all] | grant set <workspace> <kind>=<true|false|verified>… [defaultEndpoint=commit|pr|green|merged] [verification=proportional|self|independent] | grant unset <workspace> <kind>… (kinds: push, pr, merge, release, rerun, defaultEndpoint, verification)", AGENT_ENV, agentMarker = (env) => AGENT_ENV.find((name) => env[name]) ?? Object.keys(env).find((name) => name.startsWith("CODEX_") && env[name]), defaultDeps, parseValue = (raw) => raw === "true" || raw === "yes" || raw === "on" ? true : raw === "false" || raw === "no" || raw === "off" ? false : raw === "verified" ? "verified" : null, STOPS_AT, endpointLabel = (view) => view.effectiveEndpoint === view.defaultEndpoint ? view.defaultEndpoint : `${view.defaultEndpoint} (effective: ${view.effectiveEndpoint}${view.endpointReason ? `, ${view.endpointReason}` : ""})`, VERIFICATION_TEXT, describe3 = (grants, configured, endpoint, verification) => [
77280
77319
  ...GRANT_KINDS.map((kind) => ` ${kind.padEnd(8)}${String(grants[kind]).padEnd(10)}${configured.includes(kind) ? "configured" : "default"}${kind === "release" ? " (workit git push --release: git-flow main and develop, landed release tags)" : ""}`),
77281
77320
  ` default endpoint: ${endpointLabel(endpoint)} (an unnamed request stops at ${STOPS_AT[endpoint.effectiveEndpoint]})`,
77282
77321
  ...endpoint.endpointIssue ? [` note: ${endpoint.endpointIssue}`] : [],
@@ -77308,11 +77347,6 @@ var init_grant = __esm(() => {
77308
77347
  green: "a merge-ready PR: CI green, threads resolved, verified; never merged",
77309
77348
  merged: "a merged PR (workit pr merge)"
77310
77349
  };
77311
- VERIFICATION_STRICTNESS = [
77312
- "independent",
77313
- "self",
77314
- "proportional"
77315
- ];
77316
77350
  VERIFICATION_TEXT = {
77317
77351
  proportional: "the review lane from the diff decides: none needs no verdict, self the author's --self verdict, focused and full a non-author verdict, also to merge",
77318
77352
  self: "a normal-risk behavior change needs a passing check and the author's --self verdict, shown as self-reviewed; merge needs a non-author verdict",
@@ -77327,7 +77361,7 @@ __export(exports_workspace, {
77327
77361
  run: () => run11,
77328
77362
  runWorkspace: () => runWorkspace
77329
77363
  });
77330
- import { copyFileSync as copyFileSync7, existsSync as existsSync23 } from "node:fs";
77364
+ import { copyFileSync as copyFileSync7, existsSync as existsSync24 } from "node:fs";
77331
77365
  function list2(argv, io) {
77332
77366
  if (argv.length)
77333
77367
  return usage3(io, `unexpected argument ${argv[0]}`);
@@ -77636,7 +77670,7 @@ usage: ${USAGE5}`)), load = (io) => {
77636
77670
  return { ok: false, error: `${current.path} changed; retry` };
77637
77671
  let backup = null;
77638
77672
  try {
77639
- if (existsSync23(current.path)) {
77673
+ if (existsSync24(current.path)) {
77640
77674
  backup = `${current.path}.bak`;
77641
77675
  copyFileSync7(current.path, backup);
77642
77676
  }
@@ -77701,7 +77735,7 @@ var init_workspace = __esm(() => {
77701
77735
  ]);
77702
77736
  SEGMENT = /^[A-Za-z0-9_-]+$/u;
77703
77737
  UNSAFE_SEGMENTS = new Set(["__proto__", "constructor", "prototype"]);
77704
- STRICTNESS = ["independent", "self", "proportional"];
77738
+ STRICTNESS = VERIFICATION_STRICTNESS;
77705
77739
  defaultDeps2 = {
77706
77740
  interactive: () => process.stdin.isTTY === true && process.stdout.isTTY === true,
77707
77741
  ask: (question) => askLine(question)
@@ -79472,7 +79506,7 @@ var exports_models = {};
79472
79506
  __export(exports_models, {
79473
79507
  run: () => run14
79474
79508
  });
79475
- import { existsSync as existsSync24, readdirSync as readdirSync13, readFileSync as readFileSync24, statSync as statSync9 } from "node:fs";
79509
+ import { existsSync as existsSync25, readdirSync as readdirSync13, readFileSync as readFileSync24, statSync as statSync9 } from "node:fs";
79476
79510
  import os22 from "node:os";
79477
79511
  import path55 from "node:path";
79478
79512
  async function run14(argv, io) {
@@ -79568,7 +79602,7 @@ var USAGE8 = "workit models show [--role <role>] [--tier <tier>] [--host <host>]
79568
79602
  continue;
79569
79603
  const agentType = JSON.parse(readFileSync24(meta, "utf8")).agentType;
79570
79604
  const transcript = meta.replace(/\.meta\.json$/, ".jsonl");
79571
- if (typeof agentType !== "string" || !existsSync24(transcript))
79605
+ if (typeof agentType !== "string" || !existsSync25(transcript))
79572
79606
  continue;
79573
79607
  const ran = modelsOf(transcript);
79574
79608
  if (!ran.size)
@@ -79707,7 +79741,7 @@ var success2 = (data) => ({ ok: true, data }), failure3 = (code, error, unblock)
79707
79741
 
79708
79742
  // packages/workit-core/src/git/ops.ts
79709
79743
  import { spawnSync as spawnSync20 } from "node:child_process";
79710
- import { existsSync as existsSync25, readFileSync as readFileSync25 } from "node:fs";
79744
+ import { existsSync as existsSync26, readFileSync as readFileSync25 } from "node:fs";
79711
79745
  import path56 from "node:path";
79712
79746
  function operationInProgress(cwd) {
79713
79747
  const markers = [
@@ -79725,11 +79759,11 @@ function operationInProgress(cwd) {
79725
79759
  const conflicted = () => git5(cwd, ["ls-files", "-u"]).stdout.trim() !== "";
79726
79760
  for (const [index, [, operation]] of markers.entries()) {
79727
79761
  const marker = found[index];
79728
- if (!marker || !existsSync25(marker))
79762
+ if (!marker || !existsSync26(marker))
79729
79763
  continue;
79730
- if (index === 1 && existsSync25(path56.join(marker, "applying")))
79764
+ if (index === 1 && existsSync26(path56.join(marker, "applying")))
79731
79765
  return { operation: "am", commitAllowed: false, branch: null };
79732
- if (index === 0 && existsSync25(path56.join(marker, "amend")) && !conflicted()) {
79766
+ if (index === 0 && existsSync26(path56.join(marker, "amend")) && !conflicted()) {
79733
79767
  let headName = "";
79734
79768
  try {
79735
79769
  headName = readFileSync25(path56.join(marker, "head-name"), "utf8").trim();
@@ -80060,7 +80094,7 @@ function gitCommit(cwd, input) {
80060
80094
  if (paths.some((value) => value.startsWith("-") || !value.trim()))
80061
80095
  return failure3("invalid_input", "paths must not be empty or start with -");
80062
80096
  const tracked = new Set(nulList(git5(cwd, ["ls-files", "-z", "--", ...paths]).stdout));
80063
- const addable = paths.filter((value) => existsSync25(path56.resolve(cwd, value)) || [...tracked].some((file) => file === value || file.startsWith(`${value}/`)));
80097
+ const addable = paths.filter((value) => existsSync26(path56.resolve(cwd, value)) || [...tracked].some((file) => file === value || file.startsWith(`${value}/`)));
80064
80098
  if (addable.length) {
80065
80099
  const added = git5(cwd, ["add", "-A", "--", ...addable]);
80066
80100
  if (!added.ok)
@@ -87041,7 +87075,7 @@ __export(exports_pr, {
87041
87075
  checkPrTitle: () => checkPrTitle,
87042
87076
  run: () => run15
87043
87077
  });
87044
- import { existsSync as existsSync26, readFileSync as readFileSync27 } from "node:fs";
87078
+ import { existsSync as existsSync27, readFileSync as readFileSync27 } from "node:fs";
87045
87079
  import path66 from "node:path";
87046
87080
  function titleRules(cwd) {
87047
87081
  let root;
@@ -87054,7 +87088,7 @@ function titleRules(cwd) {
87054
87088
  let name = "";
87055
87089
  for (const candidate of COMMITLINT_FILES) {
87056
87090
  const full = path66.join(root, candidate);
87057
- if (!existsSync26(full))
87091
+ if (!existsSync27(full))
87058
87092
  continue;
87059
87093
  text = readFileSync27(full, "utf8");
87060
87094
  name = candidate;
@@ -106749,7 +106783,7 @@ var init_rules = __esm(() => {
106749
106783
 
106750
106784
  // packages/workit-cli/src/test-audit/audit.ts
106751
106785
  import { spawnSync as spawnSync29 } from "node:child_process";
106752
- import { existsSync as existsSync27, readdirSync as readdirSync14, readFileSync as readFileSync29, statSync as statSync10 } from "node:fs";
106786
+ import { existsSync as existsSync28, readdirSync as readdirSync14, readFileSync as readFileSync29, statSync as statSync10 } from "node:fs";
106753
106787
  import path71 from "node:path";
106754
106788
  function git7(cwd, args) {
106755
106789
  const run = spawnSync29("git", ["-c", "core.quotepath=off", ...args], {
@@ -106776,7 +106810,7 @@ function expandPaths(cwd, inputs) {
106776
106810
  const missing = [];
106777
106811
  for (const input of inputs.length > 0 ? inputs : ["."]) {
106778
106812
  const full = path71.resolve(cwd, input);
106779
- if (!existsSync27(full))
106813
+ if (!existsSync28(full))
106780
106814
  missing.push(input);
106781
106815
  else if (statSync10(full).isDirectory())
106782
106816
  walkTests(full, files);
@@ -106892,7 +106926,7 @@ var init_audit = __esm(() => {
106892
106926
  // packages/workit-cli/src/test-audit/mutate.ts
106893
106927
  import { spawn as spawn2 } from "node:child_process";
106894
106928
  import {
106895
- existsSync as existsSync28,
106929
+ existsSync as existsSync29,
106896
106930
  lstatSync as lstatSync8,
106897
106931
  mkdirSync as mkdirSync12,
106898
106932
  mkdtempSync as mkdtempSync4,
@@ -107121,7 +107155,7 @@ function copyWorkingTree(repo) {
107121
107155
  }
107122
107156
  for (const parent of dirs) {
107123
107157
  const modules = path72.join(repo, parent, "node_modules");
107124
- if (existsSync28(modules) && !existsSync28(path72.join(tree, parent, "node_modules")))
107158
+ if (existsSync29(modules) && !existsSync29(path72.join(tree, parent, "node_modules")))
107125
107159
  linkNodeModules(modules, path72.join(tree, parent, "node_modules"), repo, tree);
107126
107160
  }
107127
107161
  return { dir, tree };
@@ -107171,7 +107205,7 @@ async function runMutation(options) {
107171
107205
  const relative = toPosix(path72.relative(repo, absolute));
107172
107206
  if (!CODE_FILE.test(relative) || TEST_FILE.test(relative) || relative.endsWith(".d.ts"))
107173
107207
  continue;
107174
- if (NOT_SOURCE.test(relative) || !existsSync28(absolute))
107208
+ if (NOT_SOURCE.test(relative) || !existsSync29(absolute))
107175
107209
  continue;
107176
107210
  try {
107177
107211
  candidates.push(...mutantsFor(readFileSync30(absolute, "utf8"), relative, lines));
@@ -107361,7 +107395,7 @@ var exports_test_audit = {};
107361
107395
  __export(exports_test_audit, {
107362
107396
  run: () => run23
107363
107397
  });
107364
- import { existsSync as existsSync29 } from "node:fs";
107398
+ import { existsSync as existsSync30 } from "node:fs";
107365
107399
  import path73 from "node:path";
107366
107400
  function parse8(argv) {
107367
107401
  const options = {
@@ -107485,7 +107519,7 @@ usage: ${USAGE16}`));
107485
107519
  }
107486
107520
  let files;
107487
107521
  if (options.diff && changed)
107488
- files = [...changed.keys()].filter((file) => TEST_FILE.test(toPosix(file)) && existsSync29(file)).toSorted();
107522
+ files = [...changed.keys()].filter((file) => TEST_FILE.test(toPosix(file)) && existsSync30(file)).toSorted();
107489
107523
  else {
107490
107524
  const expanded = expandPaths(io.cwd, options.paths);
107491
107525
  if (expanded.missing.length > 0)