@brainervirus/workit-codex 8.1.0 → 8.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workit",
3
- "version": "8.1.0",
3
+ "version": "8.1.1",
4
4
  "description": "Adaptive engineering workflow rails for Codex",
5
5
  "author": {
6
6
  "name": "BrainerVirus"
@@ -6625,7 +6625,7 @@ import { existsSync as existsSync9, realpathSync as realpathSync7, statSync as s
6625
6625
  import path21 from "node:path";
6626
6626
 
6627
6627
  // packages/workit-core/src/core.ts
6628
- import { spawnSync as spawnSync13 } from "node:child_process";
6628
+ import { spawnSync as spawnSync14 } from "node:child_process";
6629
6629
  import { existsSync as existsSync7, realpathSync as realpathSync5 } from "node:fs";
6630
6630
  import path19 from "node:path";
6631
6631
 
@@ -20656,6 +20656,7 @@ var gitContext = (workspaceRoot, paths = []) => {
20656
20656
  };
20657
20657
 
20658
20658
  // packages/workit-core/src/core/workspaces.ts
20659
+ import { spawnSync as spawnSync8 } from "node:child_process";
20659
20660
  import { createHash as createHash8 } from "node:crypto";
20660
20661
  import { readFileSync as readFileSync4, realpathSync as realpathSync3 } from "node:fs";
20661
20662
  import path13 from "node:path";
@@ -20900,6 +20901,53 @@ var validateWorkspaceGlob = (glob) => {
20900
20901
  }
20901
20902
  return { ok: true };
20902
20903
  };
20904
+
20905
+ class WorkspaceConfigError extends Error {
20906
+ name = "WorkspaceConfigError";
20907
+ }
20908
+ var mainCheckouts = new Map;
20909
+ var mainCheckoutOf = (cwd) => {
20910
+ const cached = mainCheckouts.get(cwd);
20911
+ if (cached !== undefined)
20912
+ return cached;
20913
+ const env = { ...process.env };
20914
+ for (const name of ["GIT_DIR", "GIT_WORK_TREE", "GIT_COMMON_DIR", "GIT_INDEX_FILE"])
20915
+ delete env[name];
20916
+ const git = (args) => {
20917
+ const run = spawnSync8("git", args, {
20918
+ cwd,
20919
+ env,
20920
+ encoding: "utf8",
20921
+ timeout: 5000,
20922
+ windowsHide: true
20923
+ });
20924
+ return run.status === 0 ? run.stdout : null;
20925
+ };
20926
+ let main = null;
20927
+ const dirs = git(["rev-parse", "--path-format=absolute", "--git-dir", "--git-common-dir"]);
20928
+ const [gitDir, common] = (dirs ?? "").trim().split(/\r?\n/u);
20929
+ if (gitDir && common && path13.resolve(gitDir) !== path13.resolve(common)) {
20930
+ const listed = /^worktree (.+)$/mu.exec(git(["worktree", "list", "--porcelain"]) ?? "")?.[1];
20931
+ main = listed?.trim() || (path13.basename(common) === ".git" ? path13.dirname(common) : common);
20932
+ }
20933
+ mainCheckouts.set(cwd, main);
20934
+ return main;
20935
+ };
20936
+ var matchingEntries = (cwd, entries) => {
20937
+ const match = (where) => {
20938
+ const targets = [where, realpathOf(where)].map((value) => value.replaceAll("\\", "/"));
20939
+ return entries.filter((entry) => {
20940
+ const glob = entry.glob.replaceAll("\\", "/");
20941
+ const canonical = canonicalGlob(glob);
20942
+ return targets.some((target) => matchWorkspace(glob, target) || canonical !== glob && matchWorkspace(canonical, target));
20943
+ });
20944
+ };
20945
+ const direct = match(cwd);
20946
+ if (direct.length)
20947
+ return direct;
20948
+ const main = mainCheckoutOf(cwd);
20949
+ return main ? match(main) : direct;
20950
+ };
20903
20951
  var realpathOf = (p) => {
20904
20952
  const real = realpathSync3.native ?? realpathSync3;
20905
20953
  try {
@@ -20924,43 +20972,29 @@ var selectWorkspaceMatch = (matches, cwd, workspaceName) => {
20924
20972
  if (named.length === 1)
20925
20973
  return named[0];
20926
20974
  if (named.length > 1)
20927
- throw new Error(`ambiguous workspace ${JSON.stringify(workspaceName)} for ${cwd}`);
20975
+ throw new WorkspaceConfigError(`ambiguous workspace ${JSON.stringify(workspaceName)} for ${cwd}`);
20928
20976
  if (matches.length > 0) {
20929
- throw new Error(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}; matching choices: ${matches.map((entry) => entry.name).join(", ")}`);
20977
+ throw new WorkspaceConfigError(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}; matching choices: ${matches.map((entry) => entry.name).join(", ")}`);
20930
20978
  }
20931
- throw new Error(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}`);
20979
+ throw new WorkspaceConfigError(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}`);
20932
20980
  }
20933
20981
  if (matches.length < 2)
20934
20982
  return matches[0];
20935
20983
  const highestSpecificity = Math.max(...matches.map((entry) => globSpecificity(entry.glob)));
20936
20984
  const mostSpecific = matches.filter((entry) => globSpecificity(entry.glob) === highestSpecificity);
20937
20985
  if (mostSpecific.length > 1) {
20938
- throw new Error(`ambiguous workspace for ${cwd}; choose one of: ${mostSpecific.map((entry) => entry.name).join(", ")}`);
20986
+ throw new WorkspaceConfigError(`ambiguous workspace for ${cwd}; choose one of: ${mostSpecific.map((entry) => entry.name).join(", ")}`);
20939
20987
  }
20940
20988
  return mostSpecific[0];
20941
20989
  };
20942
20990
  var resolveWorkspaceFromEntries = (cwd, entries, workspaceName) => {
20943
- const targets = [cwd, realpathOf(cwd)].map((p) => p.replaceAll("\\", "/"));
20944
- const matches = [];
20945
- for (const ws of entries) {
20946
- const glob = ws.glob.replaceAll("\\", "/");
20947
- const canonical = canonicalGlob(glob);
20948
- let matched = false;
20949
- for (const target of targets) {
20950
- if (matchWorkspace(glob, target) || canonical !== glob && matchWorkspace(canonical, target)) {
20951
- matched = true;
20952
- break;
20953
- }
20954
- }
20955
- if (matched)
20956
- matches.push(ws);
20957
- }
20991
+ const matches = matchingEntries(cwd, entries);
20958
20992
  return selectWorkspaceMatch(matches, cwd, workspaceName) ?? null;
20959
20993
  };
20960
20994
  var resolveWorkspaceFrom = (cwd, dir, workspaceName) => {
20961
20995
  const result = readWorkspacesResult(dir);
20962
20996
  if (result.status === "malformed" || result.status === "invalid")
20963
- throw new Error(result.error);
20997
+ throw new WorkspaceConfigError(result.error);
20964
20998
  return resolveWorkspaceFromEntries(cwd, result.entries, workspaceName);
20965
20999
  };
20966
21000
  var runtimeWorkspacePolicySchema = (kind) => {
@@ -20992,31 +21026,26 @@ var matchRuntimeWorkspace = (cwd) => {
20992
21026
  } catch (error) {
20993
21027
  if (error.code === "ENOENT")
20994
21028
  return null;
20995
- throw new Error(`${file} could not be read: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
21029
+ throw new WorkspaceConfigError(`${file} could not be read: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
20996
21030
  }
20997
21031
  let parsed;
20998
21032
  try {
20999
21033
  parsed = JSON.parse(raw);
21000
21034
  } catch {
21001
- throw new Error(`${file} is not valid JSON`);
21035
+ throw new WorkspaceConfigError(`${file} is not valid JSON`);
21002
21036
  }
21003
21037
  const validated = runtimeWorkspaceIndexSchema.safeParse(parsed);
21004
21038
  if (!validated.success) {
21005
21039
  const detail = validated.error.issues.map((issue) => `${issue.path.map(String).join(".") || "workspaces"}: ${issue.message}`).join("; ");
21006
- throw new Error(`${file} has invalid workspace matching data: ${detail}`);
21040
+ throw new WorkspaceConfigError(`${file} has invalid workspace matching data: ${detail}`);
21007
21041
  }
21008
21042
  const entries = validated.data.workspaces;
21009
21043
  for (const entry of entries ?? []) {
21010
21044
  const glob = validateWorkspaceGlob(entry.glob);
21011
21045
  if (!glob.ok)
21012
- throw new Error(`${file} workspace ${entry.name}: ${glob.error}`);
21046
+ throw new WorkspaceConfigError(`${file} workspace ${entry.name}: ${glob.error}`);
21013
21047
  }
21014
- const targets = [cwd, realpathOf(cwd)].map((value) => value.replaceAll("\\", "/"));
21015
- const matches = (entries ?? []).filter((entry) => {
21016
- const glob = entry.glob.replaceAll("\\", "/");
21017
- const canonical = canonicalGlob(glob);
21018
- return targets.some((target) => matchWorkspace(glob, target) || canonical !== glob && matchWorkspace(canonical, target));
21019
- });
21048
+ const matches = matchingEntries(cwd, entries ?? []);
21020
21049
  const workspaceName = process.env.WORKFLOW_WORKSPACE_NAME?.trim() || undefined;
21021
21050
  const selected = selectWorkspaceMatch(matches, cwd, workspaceName);
21022
21051
  return selected ? { file, selected } : null;
@@ -21033,7 +21062,7 @@ var resolveRuntimeWorkspaceCandidate = (cwd, kind) => {
21033
21062
  const policy = runtimeWorkspacePolicySchema(kind).safeParse(selected);
21034
21063
  if (!policy.success) {
21035
21064
  const detail = policy.error.issues.map((issue) => `${issue.path.map(String).join(".") || "workspace"}: ${issue.message}`).join("; ");
21036
- throw new Error(`${file} has invalid ${kind} policy configuration: ${detail}`);
21065
+ throw new WorkspaceConfigError(`${file} has invalid ${kind} policy configuration: ${detail}`);
21037
21066
  }
21038
21067
  return policy.data;
21039
21068
  };
@@ -21044,10 +21073,10 @@ var resolveRuntimeWorkspacePolicy = (cwd, kind, requestedProfile) => {
21044
21073
  const key = kind === "branch" ? "branchPolicy" : "commitPolicy";
21045
21074
  const profileName = requestedProfile?.trim() || candidate.defaultProfile;
21046
21075
  if (candidate.defaultProfile && !Object.hasOwn(candidate.profiles ?? {}, candidate.defaultProfile))
21047
- throw new Error(`workspace ${JSON.stringify(candidate.name)} has no profile ${JSON.stringify(candidate.defaultProfile)}`);
21076
+ throw new WorkspaceConfigError(`workspace ${JSON.stringify(candidate.name)} has no profile ${JSON.stringify(candidate.defaultProfile)}`);
21048
21077
  const profile = profileName ? candidate.profiles?.[profileName] : undefined;
21049
21078
  if (profileName && !profile)
21050
- throw new Error(`workspace ${JSON.stringify(candidate.name)} has no profile ${JSON.stringify(profileName)}`);
21079
+ throw new WorkspaceConfigError(`workspace ${JSON.stringify(candidate.name)} has no profile ${JSON.stringify(profileName)}`);
21051
21080
  const profilePolicy = profile?.[key];
21052
21081
  const workspacePolicy = candidate[key];
21053
21082
  return {
@@ -21067,11 +21096,11 @@ function workspaceDefaultTarget(cwd, globalDefault) {
21067
21096
  // packages/workit-core/src/core/vcs-config.ts
21068
21097
  import fs12 from "node:fs";
21069
21098
  import path14 from "node:path";
21070
- import { spawnSync as spawnSync9 } from "node:child_process";
21099
+ import { spawnSync as spawnSync10 } from "node:child_process";
21071
21100
 
21072
21101
  // packages/workit-core/src/core/release-tracks.ts
21073
21102
  import { createHash as createHash9 } from "node:crypto";
21074
- import { spawnSync as spawnSync8 } from "node:child_process";
21103
+ import { spawnSync as spawnSync9 } from "node:child_process";
21075
21104
  var KNOWN_FIELDS = new Set([
21076
21105
  "strategy",
21077
21106
  "productionBranch",
@@ -21343,7 +21372,7 @@ function resolveReleaseTrack(input) {
21343
21372
  return fallback(`${branch} has the same or unrelated fork points with ${[...new Set(newest.map((fork) => `${fork.ref} (${fork.track.name === IMPLICIT ? "workspace default" : fork.track.name})`))].join(" and ")}`);
21344
21373
  }
21345
21374
  var git4 = (cwd, args) => {
21346
- const run = spawnSync8("git", args, {
21375
+ const run = spawnSync9("git", args, {
21347
21376
  cwd,
21348
21377
  encoding: "utf8",
21349
21378
  timeout: 20000,
@@ -21458,7 +21487,7 @@ function resolveTrackFor(cwd, options) {
21458
21487
  var workspacesPath = () => path14.join(configDir(), "workspaces.json");
21459
21488
  var vcsCwd = (cwd) => cwd ?? process.env.WORKFLOW_WORKSPACE_ROOT ?? process.cwd();
21460
21489
  var remoteProvider = (cwd) => {
21461
- const r = spawnSync9("git", ["remote", "get-url", "origin"], { cwd, encoding: "utf8" });
21490
+ const r = spawnSync10("git", ["remote", "get-url", "origin"], { cwd, encoding: "utf8" });
21462
21491
  if (r.status !== 0)
21463
21492
  return null;
21464
21493
  const url = (r.stdout ?? "").trim();
@@ -21495,7 +21524,7 @@ var remoteEndpoint = (remote) => {
21495
21524
  var configuredSshEndpoint = (host) => {
21496
21525
  if (host.startsWith("-"))
21497
21526
  return null;
21498
- const resolved = spawnSync9("ssh", ["-G", host], {
21527
+ const resolved = spawnSync10("ssh", ["-G", host], {
21499
21528
  encoding: "utf8",
21500
21529
  timeout: 5000,
21501
21530
  maxBuffer: 1024 * 1024,
@@ -21668,7 +21697,7 @@ function mergedPrStyle(limit = 6, cwd) {
21668
21697
  `).filter((l) => l.startsWith("## ")).map((l) => l.trim()),
21669
21698
  descriptionPreview: desc.slice(0, 600)
21670
21699
  });
21671
- const remoteResult = spawnSync9("git", ["remote", "get-url", "--push", "--all", "origin"], {
21700
+ const remoteResult = spawnSync10("git", ["remote", "get-url", "--push", "--all", "origin"], {
21672
21701
  cwd,
21673
21702
  encoding: "utf8"
21674
21703
  });
@@ -21684,7 +21713,7 @@ function mergedPrStyle(limit = 6, cwd) {
21684
21713
  if (!hostingApiHostMatches(remote, host))
21685
21714
  return { ok: false, error: "PR style target does not match the provider host" };
21686
21715
  if (provider === "gitlab") {
21687
- const run = (args) => spawnSync9("glab", ["api", ...args], {
21716
+ const run = (args) => spawnSync10("glab", ["api", ...args], {
21688
21717
  cwd,
21689
21718
  encoding: "utf8",
21690
21719
  env
@@ -21704,7 +21733,7 @@ function mergedPrStyle(limit = 6, cwd) {
21704
21733
  });
21705
21734
  }
21706
21735
  } else if (provider === "github") {
21707
- const r = spawnSync9("gh", [
21736
+ const r = spawnSync10("gh", [
21708
21737
  "pr",
21709
21738
  "list",
21710
21739
  "--repo",
@@ -23641,7 +23670,7 @@ class WorkitCore {
23641
23670
  }
23642
23671
  }
23643
23672
  // packages/workit-core/src/core/repo-context.ts
23644
- import { spawnSync as spawnSync10 } from "node:child_process";
23673
+ import { spawnSync as spawnSync11 } from "node:child_process";
23645
23674
  import { existsSync as existsSync6, readFileSync as readFileSync5, readdirSync as readdirSync4 } from "node:fs";
23646
23675
  import path16 from "node:path";
23647
23676
  var isSafeContextRange = (value) => value.length <= 4096 && (() => {
@@ -23670,7 +23699,7 @@ var invalidRange = (cwd) => ({
23670
23699
  cwd
23671
23700
  });
23672
23701
  var runGit = (cwd, args) => {
23673
- const result = spawnSync10("git", args, { cwd, encoding: "utf8" });
23702
+ const result = spawnSync11("git", args, { cwd, encoding: "utf8" });
23674
23703
  return {
23675
23704
  stdout: (result.stdout ?? "").trimEnd(),
23676
23705
  stderr: (result.stderr ?? "").trimEnd(),
@@ -24111,12 +24140,12 @@ function releaseNotesContext(root, rangeOrTag) {
24111
24140
  }
24112
24141
 
24113
24142
  // packages/workit-core/src/core/tracker-issues.ts
24114
- import { spawnSync as spawnSync12 } from "node:child_process";
24143
+ import { spawnSync as spawnSync13 } from "node:child_process";
24115
24144
 
24116
24145
  // packages/workit-core/src/core/pr-create.ts
24117
24146
  import fs13 from "node:fs";
24118
24147
  import path17 from "node:path";
24119
- import { spawnSync as spawnSync11 } from "node:child_process";
24148
+ import { spawnSync as spawnSync12 } from "node:child_process";
24120
24149
  // packages/workit-core/src/forge/pr-body.ts
24121
24150
  function parseGhIssue(value) {
24122
24151
  const m = /issues\/(\d+)/.exec(value);
@@ -24141,7 +24170,7 @@ function whichOnPath(tool) {
24141
24170
  }
24142
24171
  var hostingCliAvailable = (provider) => whichOnPath(provider === "gitlab" ? "glab" : "gh") !== null;
24143
24172
  var pushRemote = (cwd) => {
24144
- const result = spawnSync11("git", ["remote", "get-url", "--push", "--all", "origin"], {
24173
+ const result = spawnSync12("git", ["remote", "get-url", "--push", "--all", "origin"], {
24145
24174
  cwd,
24146
24175
  encoding: "utf8"
24147
24176
  });
@@ -24172,7 +24201,7 @@ var defaultCli = (bin, available) => {
24172
24201
  if (!available)
24173
24202
  return null;
24174
24203
  return (args, root) => {
24175
- const out = spawnSync12(bin, args, {
24204
+ const out = spawnSync13(bin, args, {
24176
24205
  cwd: root,
24177
24206
  encoding: "utf8",
24178
24207
  env: { ...process.env, PATH: process.env.PATH ?? "" }
@@ -24690,7 +24719,7 @@ function resolveInside(root, candidate) {
24690
24719
  }
24691
24720
  function run2(root, executable, args, env = {}) {
24692
24721
  const cwd = realpathSync5(root);
24693
- const result = spawnSync13(executable, args, {
24722
+ const result = spawnSync14(executable, args, {
24694
24723
  cwd,
24695
24724
  encoding: "utf8",
24696
24725
  env: { ...process.env, ...env }
@@ -13913,6 +13913,7 @@ var resolveCommitPolicy = (config, workspace) => {
13913
13913
  };
13914
13914
 
13915
13915
  // packages/workit-core/src/core/workspaces.ts
13916
+ import { spawnSync as spawnSync8 } from "node:child_process";
13916
13917
  import { createHash as createHash8 } from "node:crypto";
13917
13918
  import { readFileSync as readFileSync4, realpathSync as realpathSync3 } from "node:fs";
13918
13919
  import path13 from "node:path";
@@ -14224,6 +14225,53 @@ var validateWorkspaceGlob = (glob) => {
14224
14225
  }
14225
14226
  return { ok: true };
14226
14227
  };
14228
+
14229
+ class WorkspaceConfigError extends Error {
14230
+ name = "WorkspaceConfigError";
14231
+ }
14232
+ var mainCheckouts = new Map;
14233
+ var mainCheckoutOf = (cwd) => {
14234
+ const cached = mainCheckouts.get(cwd);
14235
+ if (cached !== undefined)
14236
+ return cached;
14237
+ const env = { ...process.env };
14238
+ for (const name of ["GIT_DIR", "GIT_WORK_TREE", "GIT_COMMON_DIR", "GIT_INDEX_FILE"])
14239
+ delete env[name];
14240
+ const git = (args) => {
14241
+ const run = spawnSync8("git", args, {
14242
+ cwd,
14243
+ env,
14244
+ encoding: "utf8",
14245
+ timeout: 5000,
14246
+ windowsHide: true
14247
+ });
14248
+ return run.status === 0 ? run.stdout : null;
14249
+ };
14250
+ let main = null;
14251
+ const dirs = git(["rev-parse", "--path-format=absolute", "--git-dir", "--git-common-dir"]);
14252
+ const [gitDir, common] = (dirs ?? "").trim().split(/\r?\n/u);
14253
+ if (gitDir && common && path13.resolve(gitDir) !== path13.resolve(common)) {
14254
+ const listed = /^worktree (.+)$/mu.exec(git(["worktree", "list", "--porcelain"]) ?? "")?.[1];
14255
+ main = listed?.trim() || (path13.basename(common) === ".git" ? path13.dirname(common) : common);
14256
+ }
14257
+ mainCheckouts.set(cwd, main);
14258
+ return main;
14259
+ };
14260
+ var matchingEntries = (cwd, entries) => {
14261
+ const match = (where) => {
14262
+ const targets = [where, realpathOf(where)].map((value) => value.replaceAll("\\", "/"));
14263
+ return entries.filter((entry) => {
14264
+ const glob = entry.glob.replaceAll("\\", "/");
14265
+ const canonical = canonicalGlob(glob);
14266
+ return targets.some((target) => matchWorkspace(glob, target) || canonical !== glob && matchWorkspace(canonical, target));
14267
+ });
14268
+ };
14269
+ const direct = match(cwd);
14270
+ if (direct.length)
14271
+ return direct;
14272
+ const main = mainCheckoutOf(cwd);
14273
+ return main ? match(main) : direct;
14274
+ };
14227
14275
  var realpathOf = (p) => {
14228
14276
  const real = realpathSync3.native ?? realpathSync3;
14229
14277
  try {
@@ -14248,43 +14296,29 @@ var selectWorkspaceMatch = (matches, cwd, workspaceName) => {
14248
14296
  if (named.length === 1)
14249
14297
  return named[0];
14250
14298
  if (named.length > 1)
14251
- throw new Error(`ambiguous workspace ${JSON.stringify(workspaceName)} for ${cwd}`);
14299
+ throw new WorkspaceConfigError(`ambiguous workspace ${JSON.stringify(workspaceName)} for ${cwd}`);
14252
14300
  if (matches.length > 0) {
14253
- throw new Error(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}; matching choices: ${matches.map((entry) => entry.name).join(", ")}`);
14301
+ throw new WorkspaceConfigError(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}; matching choices: ${matches.map((entry) => entry.name).join(", ")}`);
14254
14302
  }
14255
- throw new Error(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}`);
14303
+ throw new WorkspaceConfigError(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}`);
14256
14304
  }
14257
14305
  if (matches.length < 2)
14258
14306
  return matches[0];
14259
14307
  const highestSpecificity = Math.max(...matches.map((entry) => globSpecificity(entry.glob)));
14260
14308
  const mostSpecific = matches.filter((entry) => globSpecificity(entry.glob) === highestSpecificity);
14261
14309
  if (mostSpecific.length > 1) {
14262
- throw new Error(`ambiguous workspace for ${cwd}; choose one of: ${mostSpecific.map((entry) => entry.name).join(", ")}`);
14310
+ throw new WorkspaceConfigError(`ambiguous workspace for ${cwd}; choose one of: ${mostSpecific.map((entry) => entry.name).join(", ")}`);
14263
14311
  }
14264
14312
  return mostSpecific[0];
14265
14313
  };
14266
14314
  var resolveWorkspaceFromEntries = (cwd, entries, workspaceName) => {
14267
- const targets = [cwd, realpathOf(cwd)].map((p) => p.replaceAll("\\", "/"));
14268
- const matches = [];
14269
- for (const ws of entries) {
14270
- const glob = ws.glob.replaceAll("\\", "/");
14271
- const canonical = canonicalGlob(glob);
14272
- let matched = false;
14273
- for (const target of targets) {
14274
- if (matchWorkspace(glob, target) || canonical !== glob && matchWorkspace(canonical, target)) {
14275
- matched = true;
14276
- break;
14277
- }
14278
- }
14279
- if (matched)
14280
- matches.push(ws);
14281
- }
14315
+ const matches = matchingEntries(cwd, entries);
14282
14316
  return selectWorkspaceMatch(matches, cwd, workspaceName) ?? null;
14283
14317
  };
14284
14318
  var resolveWorkspaceFrom = (cwd, dir, workspaceName) => {
14285
14319
  const result = readWorkspacesResult(dir);
14286
14320
  if (result.status === "malformed" || result.status === "invalid")
14287
- throw new Error(result.error);
14321
+ throw new WorkspaceConfigError(result.error);
14288
14322
  return resolveWorkspaceFromEntries(cwd, result.entries, workspaceName);
14289
14323
  };
14290
14324
  var runtimeWorkspacePolicySchema = (kind) => {
@@ -14315,31 +14349,26 @@ var matchRuntimeWorkspace = (cwd) => {
14315
14349
  } catch (error) {
14316
14350
  if (error.code === "ENOENT")
14317
14351
  return null;
14318
- throw new Error(`${file} could not be read: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
14352
+ throw new WorkspaceConfigError(`${file} could not be read: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
14319
14353
  }
14320
14354
  let parsed;
14321
14355
  try {
14322
14356
  parsed = JSON.parse(raw);
14323
14357
  } catch {
14324
- throw new Error(`${file} is not valid JSON`);
14358
+ throw new WorkspaceConfigError(`${file} is not valid JSON`);
14325
14359
  }
14326
14360
  const validated = runtimeWorkspaceIndexSchema.safeParse(parsed);
14327
14361
  if (!validated.success) {
14328
14362
  const detail = validated.error.issues.map((issue) => `${issue.path.map(String).join(".") || "workspaces"}: ${issue.message}`).join("; ");
14329
- throw new Error(`${file} has invalid workspace matching data: ${detail}`);
14363
+ throw new WorkspaceConfigError(`${file} has invalid workspace matching data: ${detail}`);
14330
14364
  }
14331
14365
  const entries = validated.data.workspaces;
14332
14366
  for (const entry of entries ?? []) {
14333
14367
  const glob = validateWorkspaceGlob(entry.glob);
14334
14368
  if (!glob.ok)
14335
- throw new Error(`${file} workspace ${entry.name}: ${glob.error}`);
14369
+ throw new WorkspaceConfigError(`${file} workspace ${entry.name}: ${glob.error}`);
14336
14370
  }
14337
- const targets = [cwd, realpathOf(cwd)].map((value) => value.replaceAll("\\", "/"));
14338
- const matches = (entries ?? []).filter((entry) => {
14339
- const glob = entry.glob.replaceAll("\\", "/");
14340
- const canonical = canonicalGlob(glob);
14341
- return targets.some((target) => matchWorkspace(glob, target) || canonical !== glob && matchWorkspace(canonical, target));
14342
- });
14371
+ const matches = matchingEntries(cwd, entries ?? []);
14343
14372
  const workspaceName = process.env.WORKFLOW_WORKSPACE_NAME?.trim() || undefined;
14344
14373
  const selected = selectWorkspaceMatch(matches, cwd, workspaceName);
14345
14374
  return selected ? { file, selected } : null;
@@ -14356,7 +14385,7 @@ var resolveRuntimeWorkspaceCandidate = (cwd, kind) => {
14356
14385
  const policy = runtimeWorkspacePolicySchema(kind).safeParse(selected);
14357
14386
  if (!policy.success) {
14358
14387
  const detail = policy.error.issues.map((issue) => `${issue.path.map(String).join(".") || "workspace"}: ${issue.message}`).join("; ");
14359
- throw new Error(`${file} has invalid ${kind} policy configuration: ${detail}`);
14388
+ throw new WorkspaceConfigError(`${file} has invalid ${kind} policy configuration: ${detail}`);
14360
14389
  }
14361
14390
  return policy.data;
14362
14391
  };
@@ -14367,10 +14396,10 @@ var resolveRuntimeWorkspacePolicy = (cwd, kind, requestedProfile) => {
14367
14396
  const key = kind === "branch" ? "branchPolicy" : "commitPolicy";
14368
14397
  const profileName = requestedProfile?.trim() || candidate.defaultProfile;
14369
14398
  if (candidate.defaultProfile && !Object.hasOwn(candidate.profiles ?? {}, candidate.defaultProfile))
14370
- throw new Error(`workspace ${JSON.stringify(candidate.name)} has no profile ${JSON.stringify(candidate.defaultProfile)}`);
14399
+ throw new WorkspaceConfigError(`workspace ${JSON.stringify(candidate.name)} has no profile ${JSON.stringify(candidate.defaultProfile)}`);
14371
14400
  const profile = profileName ? candidate.profiles?.[profileName] : undefined;
14372
14401
  if (profileName && !profile)
14373
- throw new Error(`workspace ${JSON.stringify(candidate.name)} has no profile ${JSON.stringify(profileName)}`);
14402
+ throw new WorkspaceConfigError(`workspace ${JSON.stringify(candidate.name)} has no profile ${JSON.stringify(profileName)}`);
14374
14403
  const profilePolicy = profile?.[key];
14375
14404
  const workspacePolicy = candidate[key];
14376
14405
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainervirus/workit-codex",
3
- "version": "8.1.0",
3
+ "version": "8.1.1",
4
4
  "private": false,
5
5
  "description": "Workit Codex CLI/desktop plugin — shared MCP transport, hooks, and sixteen method skills",
6
6
  "keywords": [
@@ -38,8 +38,8 @@
38
38
  "build": "bun scripts/build.ts"
39
39
  },
40
40
  "dependencies": {
41
- "@brainervirus/workit-core": "^8.1.0",
42
- "@brainervirus/workit-mcp": "^8.1.0"
41
+ "@brainervirus/workit-core": "^8.1.1",
42
+ "@brainervirus/workit-mcp": "^8.1.1"
43
43
  },
44
44
  "engines": {
45
45
  "node": ">=24"