@brainervirus/workit-cursor 8.9.1 → 8.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18442,64 +18442,11 @@ function acquireFileLockSync(targetPath, options) {
18442
18442
  }
18443
18443
  }
18444
18444
  }
18445
- // packages/workit-core/src/host-session.ts
18446
- var HOST_SESSION_VARS = [
18447
- ["OPENCODE_SESSION_ID", () => "opencode"],
18448
- ["PI_SESSION_ID", () => "pi"],
18449
- [
18450
- "CODEX_THREAD_ID",
18451
- (env) => env.CODEX_INTERNAL_ORIGINATOR_OVERRIDE === "Codex Desktop" || env.CODEX_ELECTRON_RESOURCES_PATH ? "codex_desktop" : "codex_cli"
18452
- ]
18453
- ];
18454
- var family = (host) => host?.replace(/_(?:cli|desktop)$/, "") ?? null;
18455
- function hostSessionFromEnv(env) {
18456
- const value = (key) => env[key]?.trim() || null;
18457
- let inner = null;
18458
- for (const [key, host] of HOST_SESSION_VARS) {
18459
- const session = value(key);
18460
- if (session) {
18461
- inner = { host: host(env), session };
18462
- break;
18463
- }
18464
- }
18465
- const declared = value("WORKIT_HOST");
18466
- if (env.WORKIT_SESSION_ID !== undefined) {
18467
- const inherited = inner !== null && declared !== null && family(declared) !== family(inner.host);
18468
- if (!inherited)
18469
- return { host: declared, session: value("WORKIT_SESSION_ID") };
18470
- }
18471
- return inner ? { host: inner.host, session: inner.session } : { host: declared, session: null };
18472
- }
18473
-
18474
- // packages/workit-core/src/core/package-root.ts
18475
- import { existsSync } from "node:fs";
18476
- import path3 from "node:path";
18477
- import { fileURLToPath } from "node:url";
18478
- var packageRoot = () => {
18479
- let dir = path3.dirname(fileURLToPath(import.meta.url));
18480
- while (true) {
18481
- const parent = path3.dirname(dir);
18482
- if (existsSync(path3.join(dir, "package.json")) || parent === dir)
18483
- return dir;
18484
- dir = parent;
18485
- }
18486
- };
18487
- var assetRoot = () => {
18488
- const root = packageRoot();
18489
- const assets = path3.join(root, "assets");
18490
- return existsSync(assets) ? assets : root;
18491
- };
18492
-
18493
- // packages/workit-core/src/core/store-lock.ts
18494
- import { spawnSync as spawnSync2 } from "node:child_process";
18495
- import fs5 from "node:fs";
18496
- import { hostname } from "node:os";
18497
-
18498
18445
  // packages/workit-core/src/store/paths.ts
18499
18446
  import { spawnSync } from "node:child_process";
18500
18447
  import { createHash as createHash2 } from "node:crypto";
18501
18448
  import fs4 from "node:fs";
18502
- import path4 from "node:path";
18449
+ import path3 from "node:path";
18503
18450
  var NOT_A_REPO = /not a git repository \(or any (of the parent directories|parent up to)/u;
18504
18451
  var gitRun = (cwd, args) => {
18505
18452
  const run = spawnSync("git", args, {
@@ -18541,14 +18488,14 @@ var DISCOVERY_ENV = [
18541
18488
  ];
18542
18489
  var isGitDir = (dir) => {
18543
18490
  try {
18544
- return fs4.statSync(path4.join(dir, "HEAD")).isFile() && fs4.statSync(path4.join(dir, "objects")).isDirectory() && fs4.statSync(path4.join(dir, "refs")).isDirectory();
18491
+ return fs4.statSync(path3.join(dir, "HEAD")).isFile() && fs4.statSync(path3.join(dir, "objects")).isDirectory() && fs4.statSync(path3.join(dir, "refs")).isDirectory();
18545
18492
  } catch {
18546
18493
  return false;
18547
18494
  }
18548
18495
  };
18549
18496
  var reftableRefs = (common) => {
18550
18497
  try {
18551
- return /^\s*refstorage\s*=\s*reftable\s*$/imu.test(fs4.readFileSync(path4.join(common, "config"), "utf8"));
18498
+ return /^\s*refstorage\s*=\s*reftable\s*$/imu.test(fs4.readFileSync(path3.join(common, "config"), "utf8"));
18552
18499
  } catch {
18553
18500
  return false;
18554
18501
  }
@@ -18568,7 +18515,7 @@ function fastGit(root) {
18568
18515
  if (device !== null && stat.dev !== device)
18569
18516
  return { kind: "none" };
18570
18517
  device = stat.dev;
18571
- const dotGit = path4.join(dir, ".git");
18518
+ const dotGit = path3.join(dir, ".git");
18572
18519
  let entry = null;
18573
18520
  try {
18574
18521
  entry = fs4.statSync(dotGit);
@@ -18589,19 +18536,19 @@ function fastGit(root) {
18589
18536
  const match = /^gitdir: (.+)$/mu.exec(text);
18590
18537
  if (!match)
18591
18538
  return null;
18592
- gitDir = path4.resolve(dir, match[1].trim());
18539
+ gitDir = path3.resolve(dir, match[1].trim());
18593
18540
  } else
18594
18541
  return null;
18595
- if (!fs4.existsSync(path4.join(gitDir, "HEAD")))
18542
+ if (!fs4.existsSync(path3.join(gitDir, "HEAD")))
18596
18543
  return null;
18597
18544
  } else if (isGitDir(dir))
18598
18545
  gitDir = dir;
18599
18546
  if (gitDir) {
18600
18547
  let common = gitDir;
18601
18548
  try {
18602
- common = path4.resolve(gitDir, fs4.readFileSync(path4.join(gitDir, "commondir"), "utf8").trim());
18549
+ common = path3.resolve(gitDir, fs4.readFileSync(path3.join(gitDir, "commondir"), "utf8").trim());
18603
18550
  } catch {}
18604
- if (!fs4.existsSync(path4.join(common, "objects")))
18551
+ if (!fs4.existsSync(path3.join(common, "objects")))
18605
18552
  return null;
18606
18553
  return {
18607
18554
  kind: "repo",
@@ -18611,26 +18558,26 @@ function fastGit(root) {
18611
18558
  reftable: reftableRefs(common)
18612
18559
  };
18613
18560
  }
18614
- const parent = path4.dirname(dir);
18561
+ const parent = path3.dirname(dir);
18615
18562
  if (parent === dir)
18616
18563
  return { kind: "none" };
18617
18564
  dir = parent;
18618
18565
  }
18619
18566
  }
18620
18567
  function resolveStore(root) {
18621
- root = path4.resolve(root);
18568
+ root = path3.resolve(root);
18622
18569
  let directory = false;
18623
18570
  try {
18624
18571
  directory = fs4.statSync(root).isDirectory();
18625
18572
  } catch {}
18626
18573
  if (!directory)
18627
- return { dir: path4.join(root, ".workit"), shared: false, top: null };
18574
+ return { dir: path3.join(root, ".workit"), shared: false, top: null };
18628
18575
  const fast = fastGit(root);
18629
18576
  if (fast?.kind === "none")
18630
- return { dir: path4.join(root, ".workit"), shared: false, top: null };
18577
+ return { dir: path3.join(root, ".workit"), shared: false, top: null };
18631
18578
  if (fast?.kind === "repo")
18632
18579
  return {
18633
- dir: path4.join(fast.common, "workit"),
18580
+ dir: path3.join(fast.common, "workit"),
18634
18581
  shared: true,
18635
18582
  top: fast.top,
18636
18583
  git: { gitDir: fast.gitDir, top: fast.top, reftable: fast.reftable }
@@ -18640,20 +18587,20 @@ function resolveStore(root) {
18640
18587
  if (run.ok && common) {
18641
18588
  const top = gitRun(root, ["rev-parse", "--path-format=absolute", "--show-toplevel"]);
18642
18589
  return {
18643
- dir: path4.join(real(path4.resolve(root, common)), "workit"),
18590
+ dir: path3.join(real(path3.resolve(root, common)), "workit"),
18644
18591
  shared: true,
18645
18592
  top: top.ok && top.stdout.trim() ? real(top.stdout.trim()) : null
18646
18593
  };
18647
18594
  }
18648
18595
  if (run.missing || !run.ok && NOT_A_REPO.test(run.stderr))
18649
- return { dir: path4.join(root, ".workit"), shared: false, top: null };
18596
+ return { dir: path3.join(root, ".workit"), shared: false, top: null };
18650
18597
  return new Error(`cannot locate the workit store: git rev-parse failed (${run.stderr.trim().split(`
18651
18598
  `)[0] || "no output"}); fix the repository (git status should work here)`);
18652
18599
  }
18653
18600
  var rebasingBranch = (gitDir) => {
18654
18601
  for (const state of ["rebase-merge", "rebase-apply"]) {
18655
18602
  try {
18656
- const ref = fs4.readFileSync(path4.join(gitDir, state, "head-name"), "utf8").trim();
18603
+ const ref = fs4.readFileSync(path3.join(gitDir, state, "head-name"), "utf8").trim();
18657
18604
  const match = /^refs\/heads\/(.+)$/u.exec(ref);
18658
18605
  if (match)
18659
18606
  return match[1];
@@ -18668,7 +18615,7 @@ function resolveTaskKey(root, location) {
18668
18615
  if (location.git && !location.git.reftable) {
18669
18616
  let head = "";
18670
18617
  try {
18671
- head = fs4.readFileSync(path4.join(location.git.gitDir, "HEAD"), "utf8").trim();
18618
+ head = fs4.readFileSync(path3.join(location.git.gitDir, "HEAD"), "utf8").trim();
18672
18619
  } catch {}
18673
18620
  const ref = /^ref: refs\/heads\/(.+)$/u.exec(head);
18674
18621
  if (ref && ref[1] !== ".invalid")
@@ -18699,7 +18646,7 @@ function resolveTaskKey(root, location) {
18699
18646
  return { key: `detached-${shortHash(real(worktree))}`, kind: "detached", branch: null };
18700
18647
  }
18701
18648
  function checkoutRootOf(root, location) {
18702
- const resolved = path4.resolve(root);
18649
+ const resolved = path3.resolve(root);
18703
18650
  let canonical = resolved;
18704
18651
  try {
18705
18652
  canonical = fs4.realpathSync(resolved);
@@ -18730,13 +18677,13 @@ function branchRenames(location) {
18730
18677
  }
18731
18678
  for (const entry of entries)
18732
18679
  if (entry.isDirectory())
18733
- walk(path4.join(dir, entry.name));
18680
+ walk(path3.join(dir, entry.name));
18734
18681
  else
18735
- files.push(path4.join(dir, entry.name));
18682
+ files.push(path3.join(dir, entry.name));
18736
18683
  };
18737
- walk(path4.join(path4.dirname(location.dir), "logs", "refs", "heads"));
18684
+ walk(path3.join(path3.dirname(location.dir), "logs", "refs", "heads"));
18738
18685
  if (location.git)
18739
- files.push(path4.join(location.git.gitDir, "logs", "HEAD"));
18686
+ files.push(path3.join(location.git.gitDir, "logs", "HEAD"));
18740
18687
  const seen = new Set;
18741
18688
  const renames = [];
18742
18689
  for (const file of files) {
@@ -18771,11 +18718,63 @@ var checkoutSlug = (root) => {
18771
18718
  let canonical = real(root);
18772
18719
  if (process.platform === "win32")
18773
18720
  canonical = canonical.toLowerCase();
18774
- const base = path4.basename(canonical).replace(/[^A-Za-z0-9._-]/g, "_").slice(0, 40) || "root";
18721
+ const base = path3.basename(canonical).replace(/[^A-Za-z0-9._-]/g, "_").slice(0, 40) || "root";
18775
18722
  return `${base}-${shortHash(canonical)}`;
18776
18723
  };
18777
18724
 
18725
+ // packages/workit-core/src/host-session.ts
18726
+ var HOST_SESSION_VARS = [
18727
+ ["OPENCODE_SESSION_ID", () => "opencode"],
18728
+ ["PI_SESSION_ID", () => "pi"],
18729
+ [
18730
+ "CODEX_THREAD_ID",
18731
+ (env) => env.CODEX_INTERNAL_ORIGINATOR_OVERRIDE === "Codex Desktop" || env.CODEX_ELECTRON_RESOURCES_PATH ? "codex_desktop" : "codex_cli"
18732
+ ]
18733
+ ];
18734
+ var family = (host) => host?.replace(/_(?:cli|desktop)$/, "") ?? null;
18735
+ function hostSessionFromEnv(env) {
18736
+ const value = (key) => env[key]?.trim() || null;
18737
+ let inner = null;
18738
+ for (const [key, host] of HOST_SESSION_VARS) {
18739
+ const session = value(key);
18740
+ if (session) {
18741
+ inner = { host: host(env), session };
18742
+ break;
18743
+ }
18744
+ }
18745
+ const declared = value("WORKIT_HOST");
18746
+ if (env.WORKIT_SESSION_ID !== undefined) {
18747
+ const inherited = inner !== null && declared !== null && family(declared) !== family(inner.host);
18748
+ if (!inherited)
18749
+ return { host: declared, session: value("WORKIT_SESSION_ID") };
18750
+ }
18751
+ return inner ? { host: inner.host, session: inner.session } : { host: declared, session: null };
18752
+ }
18753
+ var OWN_CHILD_SHELL = new Set(["opencode", "pi"]);
18754
+
18755
+ // packages/workit-core/src/core/package-root.ts
18756
+ import { existsSync } from "node:fs";
18757
+ import path4 from "node:path";
18758
+ import { fileURLToPath } from "node:url";
18759
+ var packageRoot = () => {
18760
+ let dir = path4.dirname(fileURLToPath(import.meta.url));
18761
+ while (true) {
18762
+ const parent = path4.dirname(dir);
18763
+ if (existsSync(path4.join(dir, "package.json")) || parent === dir)
18764
+ return dir;
18765
+ dir = parent;
18766
+ }
18767
+ };
18768
+ var assetRoot = () => {
18769
+ const root = packageRoot();
18770
+ const assets = path4.join(root, "assets");
18771
+ return existsSync(assets) ? assets : root;
18772
+ };
18773
+
18778
18774
  // packages/workit-core/src/core/store-lock.ts
18775
+ import { spawnSync as spawnSync2 } from "node:child_process";
18776
+ import fs5 from "node:fs";
18777
+ import { hostname } from "node:os";
18779
18778
  var metadataLockSchema = object2({
18780
18779
  pid: number2().int().nonnegative().safe(),
18781
18780
  processStart: string2().nullable(),
@@ -23408,11 +23407,20 @@ function authorSessions(cwd, rows, branch, range = { base: null, head: null }, s
23408
23407
  sessions.add(session);
23409
23408
  return sessions;
23410
23409
  }
23410
+ var derivesFrom = (derived, bare) => !bare.includes(":") && derived.endsWith(`:${bare}`);
23411
+ var authoredBy = (authors, session) => {
23412
+ if (authors.has(session))
23413
+ return true;
23414
+ for (const author of authors)
23415
+ if (derivesFrom(author, session) || derivesFrom(session, author))
23416
+ return true;
23417
+ return false;
23418
+ };
23411
23419
  var independenceReasons = (row, authors) => {
23412
23420
  const reasons = [];
23413
23421
  if (!row.actor.session)
23414
23422
  reasons.push("no_session");
23415
- else if (authors.has(row.actor.session))
23423
+ else if (authoredBy(authors, row.actor.session))
23416
23424
  reasons.push("author_session");
23417
23425
  if (row.self === true && !reasons.includes("no_session"))
23418
23426
  reasons.push("self");
@@ -24643,6 +24651,71 @@ var gitContext = (workspaceRoot, paths = []) => {
24643
24651
  ...failure ? { stderr: failure.stderr, exitCode: failure.exitCode } : {}
24644
24652
  };
24645
24653
  };
24654
+
24655
+ // packages/workit-core/src/hooks/raw-git.ts
24656
+ var SHELLS = new Set(["sh", "bash", "zsh", "dash", "ksh"]);
24657
+ var PREFIXES2 = new Set(["sudo", "command", "env", "nohup", "time", "exec", "nice", "&"]);
24658
+ var CD = new Set(["cd", "chdir", "set-location", "sl"]);
24659
+ var PUSHD = new Set(["pushd", "push-location"]);
24660
+ var POPD = new Set(["popd", "pop-location"]);
24661
+ var GIT_VALUE_OPTIONS = new Set([
24662
+ "-c",
24663
+ "--git-dir",
24664
+ "--work-tree",
24665
+ "--namespace",
24666
+ "--exec-path",
24667
+ "--config-env",
24668
+ "--super-prefix"
24669
+ ]);
24670
+ var LAUNCHERS = new Set([
24671
+ "npx",
24672
+ "bunx",
24673
+ "pnpx",
24674
+ "-y",
24675
+ "--yes",
24676
+ "pnpm",
24677
+ "dlx",
24678
+ "exec",
24679
+ "env",
24680
+ "sudo",
24681
+ "command"
24682
+ ]);
24683
+ var PUSH_VALUE_OPTIONS = new Set(["-o", "--push-option", "--receive-pack", "--exec", "--repo"]);
24684
+ var VALUE_OPTIONS = {
24685
+ git: new Set([
24686
+ "-m",
24687
+ "--message",
24688
+ "-F",
24689
+ "--file",
24690
+ "-C",
24691
+ "-c",
24692
+ "--reuse-message",
24693
+ "--reedit-message",
24694
+ "--author",
24695
+ "--date",
24696
+ "--trailer",
24697
+ "-t",
24698
+ "--template",
24699
+ "--cleanup",
24700
+ "--fixup",
24701
+ "--squash",
24702
+ "-o",
24703
+ "--push-option",
24704
+ "--repo",
24705
+ "--receive-pack",
24706
+ "--exec"
24707
+ ]),
24708
+ gh: new Set(["-b", "--body", "-F", "--body-file", "-t", "--title", "--subject", "-A", "--author-email"].concat(["-B", "--base", "-H", "--head", "-l", "--label", "-a", "--assignee"]).concat(["-r", "--reviewer", "-m", "--milestone", "-p", "--project", "-T", "--template"]).concat(["--match-head-commit", "-R", "--repo"])),
24709
+ glab: new Set(["-m", "--message", "--squash-message", "--sha", "-t", "--title", "-d", "--description"].concat(["-b", "--target-branch", "-s", "--source-branch", "-l", "--label"]).concat(["-a", "--assignee", "--reviewer", "-R", "--repo"]))
24710
+ };
24711
+
24712
+ // packages/workit-core/src/core/route-intent.ts
24713
+ var SWITCH_CREATE = new Set(["-c", "--create", "-C", "--force-create", "--orphan"]);
24714
+ var CHECKOUT_CREATE = new Set(["-b", "-B", "--orphan"]);
24715
+ var WORKTREE_CREATE = new Set(["-b", "-B"]);
24716
+ var BRANCH_NO_CREATE = new Set(["-d", "-D", "--delete", "-l", "--list", "-a", "--all", "-r", "--remotes", "--show-current"].concat(["-v", "-vv", "--verbose", "--contains", "--no-contains", "--merged", "--no-merged"]).concat(["--points-at", "--sort", "--format", "--column", "--no-column", "-u"]).concat(["--set-upstream-to", "--unset-upstream", "--edit-description", "-i", "--ignore-case"]));
24717
+ var BRANCH_RENAME = new Set(["-m", "-M", "--move", "-c", "-C", "--copy"]);
24718
+ var WORKTREE_VALUES = new Set(["--reason"]);
24646
24719
  // packages/workit-core/src/core/task-engine.ts
24647
24720
  import { realpathSync as realpathSync4 } from "node:fs";
24648
24721
 
@@ -28119,64 +28192,8 @@ var cache = new Map;
28119
28192
  var TURN_TTL_MS = 7 * 24 * 60 * 60 * 1000;
28120
28193
  // packages/workit-core/src/hooks/write-gate.ts
28121
28194
  var CASE_INSENSITIVE = process.platform === "darwin" || process.platform === "win32";
28122
- var PREFIXES2 = new Set(["sudo", "command", "env", "nohup", "time", "exec", "xargs"]);
28195
+ var PREFIXES3 = new Set(["sudo", "command", "env", "nohup", "time", "exec", "xargs"]);
28123
28196
  var cache2 = new Map;
28124
- // packages/workit-core/src/hooks/raw-git.ts
28125
- var SHELLS = new Set(["sh", "bash", "zsh", "dash", "ksh"]);
28126
- var PREFIXES3 = new Set(["sudo", "command", "env", "nohup", "time", "exec", "nice", "&"]);
28127
- var CD = new Set(["cd", "chdir", "set-location", "sl"]);
28128
- var PUSHD = new Set(["pushd", "push-location"]);
28129
- var POPD = new Set(["popd", "pop-location"]);
28130
- var GIT_VALUE_OPTIONS = new Set([
28131
- "-c",
28132
- "--git-dir",
28133
- "--work-tree",
28134
- "--namespace",
28135
- "--exec-path",
28136
- "--config-env",
28137
- "--super-prefix"
28138
- ]);
28139
- var LAUNCHERS = new Set([
28140
- "npx",
28141
- "bunx",
28142
- "pnpx",
28143
- "-y",
28144
- "--yes",
28145
- "pnpm",
28146
- "dlx",
28147
- "exec",
28148
- "env",
28149
- "sudo",
28150
- "command"
28151
- ]);
28152
- var PUSH_VALUE_OPTIONS = new Set(["-o", "--push-option", "--receive-pack", "--exec", "--repo"]);
28153
- var VALUE_OPTIONS = {
28154
- git: new Set([
28155
- "-m",
28156
- "--message",
28157
- "-F",
28158
- "--file",
28159
- "-C",
28160
- "-c",
28161
- "--reuse-message",
28162
- "--reedit-message",
28163
- "--author",
28164
- "--date",
28165
- "--trailer",
28166
- "-t",
28167
- "--template",
28168
- "--cleanup",
28169
- "--fixup",
28170
- "--squash",
28171
- "-o",
28172
- "--push-option",
28173
- "--repo",
28174
- "--receive-pack",
28175
- "--exec"
28176
- ]),
28177
- gh: new Set(["-b", "--body", "-F", "--body-file", "-t", "--title", "--subject", "-A", "--author-email"].concat(["-B", "--base", "-H", "--head", "-l", "--label", "-a", "--assignee"]).concat(["-r", "--reviewer", "-m", "--milestone", "-p", "--project", "-T", "--template"]).concat(["--match-head-commit", "-R", "--repo"])),
28178
- glab: new Set(["-m", "--message", "--squash-message", "--sha", "-t", "--title", "-d", "--description"].concat(["-b", "--target-branch", "-s", "--source-branch", "-l", "--label"]).concat(["-a", "--assignee", "--reviewer", "-R", "--repo"]))
28179
- };
28180
28197
  // packages/workit-core/src/core/skill-manifests.ts
28181
28198
  if (false) {}
28182
28199