@brainervirus/workit-claude-code 8.45.1 → 8.45.2

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
@@ -7145,30 +7145,58 @@ var FORGE_SCHEMES, SSH_SCHEMES, SSH_443, WINDOWS_DRIVE, SCP_LIKE, accountHome =
7145
7145
  }, caseless, canonical = (real) => {
7146
7146
  const slashed = real.replaceAll("\\", "/").replace(/\/+$/u, "").replace(/\/\.git$/u, "");
7147
7147
  return `file:${caseless ? slashed.toLowerCase() : slashed}`;
7148
- }, gitDirAt = (at) => {
7148
+ }, isRepoDir = (dir) => ["HEAD", "objects", "refs"].every((name) => {
7149
+ try {
7150
+ lstatSync(`${dir}/${name}`);
7151
+ return true;
7152
+ } catch {
7153
+ return false;
7154
+ }
7155
+ }), gitDirAt = (at, depth = 0) => {
7149
7156
  let real;
7150
7157
  try {
7151
7158
  real = realpathSync.native(at);
7152
7159
  } catch {
7153
7160
  return null;
7154
7161
  }
7162
+ if (depth > 8)
7163
+ return null;
7155
7164
  try {
7156
7165
  if (statSync(real).isFile()) {
7157
7166
  const pointer = /^gitdir:\s*(.+?)\s*$/mu.exec(readFileSync2(real, "utf8"))?.[1];
7158
7167
  if (!pointer)
7159
7168
  return null;
7160
7169
  const target = path3.isAbsolute(pointer) ? pointer : `${path3.dirname(real)}/${pointer}`;
7161
- return gitDirAt(target);
7170
+ return gitDirAt(target, depth + 1);
7162
7171
  }
7163
- const isRepo = ["HEAD", "objects", "refs"].every((name) => {
7172
+ let common;
7173
+ try {
7174
+ common = readFileSync2(`${real}/commondir`, "utf8").trim();
7175
+ } catch {}
7176
+ if (common !== undefined) {
7177
+ lstatSync(`${real}/HEAD`);
7178
+ return gitDirAt(path3.isAbsolute(common) ? common : `${real}/${common}`, depth + 1);
7179
+ }
7180
+ if (!isRepoDir(real))
7181
+ return null;
7182
+ let lender = null;
7183
+ for (const name of ["refs", "objects", "config", "packed-refs"]) {
7184
+ const item = `${real}/${name}`;
7164
7185
  try {
7165
- lstatSync(`${real}/${name}`);
7166
- return true;
7186
+ lstatSync(item);
7167
7187
  } catch {
7168
- return false;
7188
+ continue;
7169
7189
  }
7170
- });
7171
- return isRepo ? real : null;
7190
+ const resolved = realpathSync.native(item);
7191
+ const rel = path3.relative(real, resolved);
7192
+ if (rel && !rel.startsWith("..") && !path3.isAbsolute(rel))
7193
+ continue;
7194
+ const owner = path3.basename(resolved) === name ? gitDirAt(path3.dirname(resolved), depth + 1) : null;
7195
+ if (owner === null || lender !== null && lender !== owner)
7196
+ return null;
7197
+ lender = owner;
7198
+ }
7199
+ return lender ?? real;
7172
7200
  } catch {
7173
7201
  return null;
7174
7202
  }
@@ -7218,7 +7246,7 @@ var FORGE_SCHEMES, SSH_SCHEMES, SSH_443, WINDOWS_DRIVE, SCP_LIKE, accountHome =
7218
7246
  return null;
7219
7247
  }
7220
7248
  }
7221
- if (path3.isAbsolute(value) || WINDOWS_DRIVE.test(value))
7249
+ if (path3.isAbsolute(value) || WINDOWS_DRIVE.test(value) || process.platform === "win32" && /^[A-Za-z]:/u.test(value))
7222
7250
  return fileKey(value, strict);
7223
7251
  const scp = SCP_LIKE.exec(value);
7224
7252
  if (scp)
@@ -7289,14 +7317,17 @@ var FORGE_SCHEMES, SSH_SCHEMES, SSH_443, WINDOWS_DRIVE, SCP_LIKE, accountHome =
7289
7317
  const file = realOrSelf(origin.slice("file:".length));
7290
7318
  const home = userGitSeam.home();
7291
7319
  return [path3.join(home, ".gitconfig"), path3.join(home, ".config", "git", "config")].map(realOrSelf).includes(file);
7292
- }, escapeRegex2 = (value) => value.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&"), transportOverride = (git, remote) => {
7293
- const env = TRANSPORT_ENV.find((name) => process.env[name]);
7320
+ }, escapeRegex2 = (value) => value.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&"), transportOverride = (git, remote, vars) => {
7321
+ const env = TRANSPORT_ENV.find((name) => vars[name]);
7294
7322
  if (env)
7295
7323
  return env;
7296
- const execPath = process.env.GIT_EXEC_PATH;
7324
+ const execPath = vars.GIT_EXEC_PATH;
7297
7325
  if (execPath) {
7298
- const { GIT_EXEC_PATH: _set, ...rest } = process.env;
7299
- const own = spawnSync3("git", ["--exec-path"], { env: rest, encoding: "utf8" });
7326
+ const { GIT_EXEC_PATH: _set, ...rest } = vars;
7327
+ const own = spawnSync3("git", ["--exec-path"], {
7328
+ env: rest,
7329
+ encoding: "utf8"
7330
+ });
7300
7331
  if (own.status !== 0 || realOrSelf(own.stdout.trim()) !== realOrSelf(execPath))
7301
7332
  return "GIT_EXEC_PATH";
7302
7333
  }
@@ -7322,18 +7353,24 @@ var FORGE_SCHEMES, SSH_SCHEMES, SSH_443, WINDOWS_DRIVE, SCP_LIKE, accountHome =
7322
7353
  return `${key} (${scope} ${origin})`;
7323
7354
  }
7324
7355
  return null;
7325
- }, pushTarget = (cwd, remote) => {
7326
- const env = { ...process.env };
7356
+ }, pushTarget = (cwd, remote, replay = {}) => {
7357
+ const env = { ...process.env, ...replay.env };
7327
7358
  for (const name of ["GIT_DIR", "GIT_WORK_TREE", "GIT_COMMON_DIR", "GIT_INDEX_FILE"])
7328
7359
  delete env[name];
7329
7360
  if (!remote || remote.startsWith("-"))
7330
7361
  return Error(`push remote ${JSON.stringify(remote)} cannot be resolved`);
7331
- const git = (args) => spawnSync3("git", args, { cwd, env, encoding: "utf8", timeout: 5000, windowsHide: true });
7332
- const override = transportOverride(git, remote);
7362
+ const git = (args) => spawnSync3("git", [...replay.config ?? [], ...args], {
7363
+ cwd,
7364
+ env,
7365
+ encoding: "utf8",
7366
+ timeout: 5000,
7367
+ windowsHide: true
7368
+ });
7369
+ const override = transportOverride(git, remote, env);
7333
7370
  if (override)
7334
7371
  return Error(`${override} decides what the push to ${remote} reaches, not its URL, so its target is unknown`);
7335
7372
  const run = git(["remote", "get-url", "--push", "--all", remote]);
7336
- const urls = run.status === 0 ? run.stdout.split(/\r?\n/u).map((url) => url.trim()) : [];
7373
+ const urls = run.status === 0 ? run.stdout.split(/\r?\n/u).map((url) => url.trim()) : run.status === 2 ? [remote] : [];
7337
7374
  if (!urls.some(Boolean))
7338
7375
  return Error(`git could not resolve the push URLs of remote ${remote} in ${cwd}`);
7339
7376
  let top;
@@ -7367,7 +7404,9 @@ var init_remotes = __esm(() => {
7367
7404
  };
7368
7405
  WINDOWS_DRIVE = /^[A-Za-z]:[\\/]/u;
7369
7406
  SCP_LIKE = /^(?:[^@/\\]+@)?([^/\\:]+):(.+)$/u;
7370
- sshSeam = { read: () => readSshConfig(accountHome()) };
7407
+ sshSeam = {
7408
+ read: () => readSshConfig(accountHome())
7409
+ };
7371
7410
  caseless = process.platform === "win32" || process.platform === "darwin";
7372
7411
  TRANSPORT_ENV = ["GIT_SSH", "GIT_SSH_COMMAND", "GIT_PROXY_COMMAND"];
7373
7412
  userGitSeam = { home: accountHome };
@@ -9695,7 +9734,7 @@ var package_default;
9695
9734
  var init_package = __esm(() => {
9696
9735
  package_default = {
9697
9736
  name: "@brainervirus/workit-cli",
9698
- version: "8.45.1",
9737
+ version: "8.45.2",
9699
9738
  private: false,
9700
9739
  description: "Workit CLI — setup wizard, doctor, and task control for agentic coding workflows",
9701
9740
  keywords: [
@@ -9733,13 +9772,13 @@ var init_package = __esm(() => {
9733
9772
  },
9734
9773
  dependencies: {
9735
9774
  "@babel/parser": "7.29.9",
9736
- "@brainervirus/workit-cursor": "^8.45.1",
9775
+ "@brainervirus/workit-cursor": "^8.45.2",
9737
9776
  "@inkjs/ui": "2.0.0",
9738
9777
  ink: "7.1.1",
9739
9778
  react: "19.2.8"
9740
9779
  },
9741
9780
  devDependencies: {
9742
- "@brainervirus/workit-core": "^8.45.1"
9781
+ "@brainervirus/workit-core": "^8.45.2"
9743
9782
  },
9744
9783
  engines: {
9745
9784
  node: ">=24"
@@ -10260,18 +10299,6 @@ function targetClaims(target, dir = grantsDir()) {
10260
10299
  return pattern ? [{ url: remote.url, workspace: entry.name, pattern }] : [];
10261
10300
  }));
10262
10301
  }
10263
- function remoteClaims(cwd, dir = grantsDir()) {
10264
- const claiming = loadWorkspacesFrom(dir).filter((entry) => entry.remotes?.length);
10265
- if (claiming.length === 0)
10266
- return [];
10267
- const remotes = checkoutRemotes(cwd);
10268
- if (remotes instanceof Error)
10269
- return remotes;
10270
- return remotes.flatMap((remote) => claiming.flatMap((entry) => {
10271
- const pattern = entry.remotes.find((item) => remoteMatches(item, remote.key));
10272
- return pattern ? [{ remote: remote.name, url: remote.url, workspace: entry.name, pattern }] : [];
10273
- }));
10274
- }
10275
10302
  function remoteFindings(cwd, dir = grantsDir()) {
10276
10303
  let own = null;
10277
10304
  try {
@@ -10279,15 +10306,20 @@ function remoteFindings(cwd, dir = grantsDir()) {
10279
10306
  } catch {
10280
10307
  return { warnings: [], notes: [] };
10281
10308
  }
10282
- const claims = remoteClaims(cwd, dir);
10283
- if (claims instanceof Error)
10284
- return { warnings: [`${claims.message}: grants here are capped at nothing`], notes: [] };
10285
- const warnings = claims.filter((claim) => claim.workspace !== own?.name).map((claim) => `remote ${claim.remote} ${claim.url} is claimed by workspace ${claim.workspace} (${claim.pattern}): an action that targets it never exceeds ${claim.workspace}'s grants`);
10309
+ const unclaimed = own !== null && !own.remotes?.length;
10310
+ if (!unclaimed && !remotesClaimed(dir))
10311
+ return { warnings: [], notes: [] };
10312
+ const remotes = checkoutRemotes(cwd);
10313
+ if (remotes instanceof Error && remotesClaimed(dir))
10314
+ return { warnings: [`${remotes.message}: grants here are capped at nothing`], notes: [] };
10315
+ const listed = remotes instanceof Error ? [] : remotes;
10316
+ const others = claimsOf(listed, dir).filter((claim) => claim.workspace !== own?.name);
10317
+ const warnings = others.map((claim) => `remote ${claim.remote} ${claim.url} is claimed by workspace ${claim.workspace} (${claim.pattern}): an action that targets it never exceeds ${claim.workspace}'s grants`);
10286
10318
  const notes = [];
10287
- if (own && !own.remotes?.length) {
10288
- const remotes = checkoutRemotes(cwd);
10289
- const origin = remotes instanceof Error ? undefined : remotes.find((r) => r.name === "origin");
10290
- notes.push(`workspace ${own.name} claims no remotes, so a folder outside it whose origin is ${origin ? origin.url : "one of its remotes"} keeps that folder's grants; to claim it, the user runs in their own terminal: workit workspace set ${own.name} remotes=${origin ? origin.url : "<url>"}`);
10319
+ if (own && unclaimed) {
10320
+ const free = listed.filter((remote) => !others.some((claim) => claim.url === remote.url));
10321
+ const suggest = free.find((remote) => remote.name === "origin") ?? free[0];
10322
+ notes.push(`workspace ${own.name} claims no remotes, so a folder outside it whose origin is ${suggest ? suggest.url : "one of its remotes"} keeps that folder's grants; to claim it, the user runs in their own terminal: workit workspace set ${own.name} remotes=${suggest ? suggest.url : "<url>"}`);
10291
10323
  }
10292
10324
  return { warnings, notes };
10293
10325
  }
@@ -10477,7 +10509,13 @@ var accountHome2 = () => {
10477
10509
  else if (item === "merge")
10478
10510
  grants.merge = "verified";
10479
10511
  return Object.keys(grants).length > 0 ? grants : null;
10480
- }, remotesClaimed = (dir = grantsDir()) => loadWorkspacesFrom(dir).some((entry) => entry.remotes?.length), 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) => {
10512
+ }, remotesClaimed = (dir = grantsDir()) => loadWorkspacesFrom(dir).some((entry) => entry.remotes?.length), claimsOf = (remotes, dir) => {
10513
+ const claiming = loadWorkspacesFrom(dir).filter((entry) => entry.remotes?.length);
10514
+ return remotes.flatMap((remote) => claiming.flatMap((entry) => {
10515
+ const pattern = entry.remotes.find((item) => remoteMatches(item, remote.key));
10516
+ return pattern ? [{ remote: remote.name, url: remote.url, workspace: entry.name, pattern }] : [];
10517
+ }));
10518
+ }, 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) => {
10481
10519
  const rank = (value) => value === true ? 2 : value === "verified" ? 1 : 0;
10482
10520
  return rank(normalized(kind, next)) > rank(normalized(kind, current));
10483
10521
  };
@@ -18728,9 +18766,9 @@ var init_shell_words = __esm(() => {
18728
18766
  // packages/workit-core/src/hooks/raw-git.ts
18729
18767
  import os6 from "node:os";
18730
18768
  import path24 from "node:path";
18731
- function rawInvocations(command, dialect = "posix", depth = 0) {
18769
+ function rawInvocations(command, dialect = "posix", depth = 0, inherited = {}) {
18732
18770
  if (depth > 0)
18733
- return walk2(command, dialect, depth);
18771
+ return walk2(command, dialect, depth, undefined, inherited);
18734
18772
  const key = `${dialect}\x00${command}`;
18735
18773
  const cached = RECENT.get(key);
18736
18774
  if (cached)
@@ -18755,18 +18793,20 @@ function commandLines(command, dialect = "posix") {
18755
18793
  }
18756
18794
  return lines;
18757
18795
  }
18758
- function walk2(command, dialect, depth, seen) {
18796
+ function walk2(command, dialect, depth, seen, inherited = {}) {
18759
18797
  const found = [];
18760
18798
  let dir = null;
18761
18799
  const groups = [];
18762
18800
  let stack = [];
18763
18801
  const vars = new Map;
18764
- const exported = {};
18802
+ const exported = { ...inherited };
18803
+ let prefix = {};
18765
18804
  const sessionConfig = [];
18766
18805
  const nested = (script, inner) => {
18767
18806
  if (!script || depth >= MAX_DEPTH)
18768
18807
  return;
18769
- const inside = seen ? walk2(script, inner, depth + 1, seen) : rawInvocations(script, inner, depth + 1);
18808
+ const env = { ...exported, ...prefix };
18809
+ const inside = seen ? walk2(script, inner, depth + 1, seen, env) : rawInvocations(script, inner, depth + 1, env);
18770
18810
  for (const invocation of inside)
18771
18811
  found.push({ ...invocation, dir: rebase(dir, invocation.dir) });
18772
18812
  };
@@ -18776,6 +18816,7 @@ function walk2(command, dialect, depth, seen) {
18776
18816
  if (split !== null)
18777
18817
  return nested(split, "posix");
18778
18818
  const { words, env } = stripPrefixes(line);
18819
+ prefix = env;
18779
18820
  const name = commandName(words[0]);
18780
18821
  if (!name)
18781
18822
  return;
@@ -18836,6 +18877,7 @@ function walk2(command, dialect, depth, seen) {
18836
18877
  tool: name,
18837
18878
  dir,
18838
18879
  args: words.slice(1),
18880
+ ...Object.keys({ ...exported, ...env }).length ? { env: { ...exported, ...env } } : {},
18839
18881
  ...stdin === undefined ? {} : { stdin }
18840
18882
  });
18841
18883
  else if (name === "git") {
@@ -19250,7 +19292,9 @@ var SHELLS, POWERSHELLS, EVALS, WRAPPERS, WRAPPER_VALUES, KEYWORDS, DECLARATIONS
19250
19292
  }, RECENT, LAUNCHERS, WORKIT_PACKAGE, PACKAGE_RUNNERS, OUTPUT_FILTERS, WORKIT_GLOBAL, PUSH_VALUE_OPTIONS, VALUE_OPTIONS, API_VALUES, API_FIELDS, GIT_COMMANDS;
19251
19293
  var init_raw_git = __esm(() => {
19252
19294
  init_branch();
19295
+ init_autonomy();
19253
19296
  init_branch_policy();
19297
+ init_remotes();
19254
19298
  init_workspaces();
19255
19299
  init_ledger();
19256
19300
  init_paths();
@@ -19260,7 +19304,9 @@ var init_raw_git = __esm(() => {
19260
19304
  POWERSHELLS = new Set(["pwsh", "powershell"]);
19261
19305
  EVALS = new Set(["eval", "iex", "invoke-expression"]);
19262
19306
  WRAPPERS = {
19263
- sudo: { values: "-u -g -h -p -C -D -R -T -r -t -U --user --group --host --prompt --chdir" },
19307
+ sudo: {
19308
+ values: "-u -g -h -p -C -D -R -T -r -t -U --user --group --host --prompt --chdir"
19309
+ },
19264
19310
  doas: { values: "-u -C" },
19265
19311
  command: { values: "" },
19266
19312
  builtin: { values: "" },
@@ -19299,7 +19345,7 @@ var init_raw_git = __esm(() => {
19299
19345
  "--super-prefix"
19300
19346
  ]);
19301
19347
  GIT_CONFIG_OPTIONS = new Set(["-c", "--config-env", "--git-dir"]);
19302
- GIT_CONFIG_ENV = /^GIT_(?:CONFIG\w*|DIR|COMMON_DIR|WORK_TREE)$/;
19348
+ GIT_CONFIG_ENV = /^(?:GIT_(?:CONFIG\w*|DIR|COMMON_DIR|WORK_TREE|SSH|SSH_COMMAND|PROXY_COMMAND|EXEC_PATH)|GH_HOST|GH_REPO|GITLAB_HOST|GL_HOST)$/;
19303
19349
  ASSIGNMENT = /^([A-Za-z_]\w*)=([\s\S]*)$/;
19304
19350
  HERE = /^(?:\$PWD|\$\{PWD\}|\$\(\s*pwd\s*\)|`pwd`|\$\(\s*git\s+rev-parse\s+--show-toplevel\s*\))(?=$|[\\/])/;
19305
19351
  VARIABLE = /\$(?:\{(\w+)\}|(\w+))/g;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainervirus/workit-claude-code",
3
- "version": "8.45.1",
3
+ "version": "8.45.2",
4
4
  "private": false,
5
5
  "description": "Workit Claude Code plugin — session and per-turn task context, branch policy on git shell commands, workit method skills, and verifier/reviewer/implementer agents",
6
6
  "keywords": [
@@ -39,8 +39,8 @@
39
39
  "build": "bun scripts/build.ts"
40
40
  },
41
41
  "devDependencies": {
42
- "@brainervirus/workit-cli": "^8.45.1",
43
- "@brainervirus/workit-core": "^8.45.1"
42
+ "@brainervirus/workit-cli": "^8.45.2",
43
+ "@brainervirus/workit-core": "^8.45.2"
44
44
  },
45
45
  "engines": {
46
46
  "node": ">=24"