@brainervirus/workit-cursor 8.0.0 → 8.1.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.
@@ -6620,11 +6620,11 @@ var require_dist = __commonJS(function(exports, module) {
6620
6620
  exports.default = formatsPlugin;
6621
6621
  });
6622
6622
 
6623
- // packages/workit-cursor/node_modules/@brainervirus/workit-mcp/src/index.ts
6623
+ // packages/workit-mcp/src/index.ts
6624
6624
  import { fileURLToPath as fileURLToPath3 } from "node:url";
6625
6625
  import path21 from "node:path";
6626
6626
 
6627
- // packages/workit-cursor/node_modules/@brainervirus/workit-mcp/src/server.ts
6627
+ // packages/workit-mcp/src/server.ts
6628
6628
  import { existsSync as existsSync8, readFileSync as readFileSync6, realpathSync as realpathSync6 } from "node:fs";
6629
6629
  import path20 from "node:path";
6630
6630
 
@@ -16572,15 +16572,15 @@ class StdioServerTransport {
16572
16572
  }
16573
16573
  }
16574
16574
 
16575
- // packages/workit-cursor/node_modules/@brainervirus/workit-mcp/src/server.ts
16575
+ // packages/workit-mcp/src/server.ts
16576
16576
  import { fileURLToPath as fileURLToPath2 } from "node:url";
16577
16577
 
16578
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core.ts
16579
- import { spawnSync as spawnSync12 } from "node:child_process";
16578
+ // packages/workit-core/src/core.ts
16579
+ import { spawnSync as spawnSync13 } from "node:child_process";
16580
16580
  import { existsSync as existsSync7, realpathSync as realpathSync5 } from "node:fs";
16581
16581
  import path19 from "node:path";
16582
16582
 
16583
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/task-contract.ts
16583
+ // packages/workit-core/src/core/task-contract.ts
16584
16584
  import { createHash, randomUUID } from "node:crypto";
16585
16585
  var SCHEMA_VERSION = 1;
16586
16586
  var POLICY_VERSION = "1.0.0";
@@ -17436,7 +17436,7 @@ function requirementId(input) {
17436
17436
  }
17437
17437
  });
17438
17438
  }
17439
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/operation-input.ts
17439
+ // packages/workit-core/src/core/operation-input.ts
17440
17440
  var str = (d, values) => ({
17441
17441
  type: "string",
17442
17442
  ...values ? { enum: values } : {},
@@ -17832,7 +17832,7 @@ function parseAdvertisedOperation(family, input, host) {
17832
17832
  }))
17833
17833
  });
17834
17834
  }
17835
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/task-store.ts
17835
+ // packages/workit-core/src/core/task-store.ts
17836
17836
  import { createHash as createHash4, randomUUID as randomUUID3 } from "node:crypto";
17837
17837
  import * as fs7 from "node:fs";
17838
17838
  import path6 from "node:path";
@@ -18438,7 +18438,7 @@ function acquireFileLockSync(targetPath, options) {
18438
18438
  }
18439
18439
  }
18440
18440
  }
18441
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/package-root.ts
18441
+ // packages/workit-core/src/core/package-root.ts
18442
18442
  import { existsSync } from "node:fs";
18443
18443
  import path3 from "node:path";
18444
18444
  import { fileURLToPath } from "node:url";
@@ -18457,12 +18457,12 @@ var assetRoot = () => {
18457
18457
  return existsSync(assets) ? assets : root;
18458
18458
  };
18459
18459
 
18460
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/store-lock.ts
18460
+ // packages/workit-core/src/core/store-lock.ts
18461
18461
  import { spawnSync as spawnSync2 } from "node:child_process";
18462
18462
  import fs5 from "node:fs";
18463
18463
  import { hostname } from "node:os";
18464
18464
 
18465
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/store/paths.ts
18465
+ // packages/workit-core/src/store/paths.ts
18466
18466
  import { spawnSync } from "node:child_process";
18467
18467
  import { createHash as createHash2 } from "node:crypto";
18468
18468
  import fs4 from "node:fs";
@@ -18742,7 +18742,7 @@ var checkoutSlug = (root) => {
18742
18742
  return `${base}-${shortHash(canonical)}`;
18743
18743
  };
18744
18744
 
18745
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/store-lock.ts
18745
+ // packages/workit-core/src/core/store-lock.ts
18746
18746
  var metadataLockSchema = object2({
18747
18747
  pid: number2().int().nonnegative().safe(),
18748
18748
  processStart: string2().nullable(),
@@ -18873,7 +18873,7 @@ var clearAbandonedReclaimGuard = (lockPath, nowMs = Date.now()) => {
18873
18873
  }
18874
18874
  };
18875
18875
 
18876
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/store/event-log.ts
18876
+ // packages/workit-core/src/store/event-log.ts
18877
18877
  import { randomUUID as randomUUID2 } from "node:crypto";
18878
18878
  import fs6 from "node:fs";
18879
18879
  import path5 from "node:path";
@@ -19033,7 +19033,7 @@ var retryTransient = (run) => {
19033
19033
  };
19034
19034
  var renameWithRetry = (from, to) => retryTransient(() => fs6.renameSync(from, to));
19035
19035
 
19036
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/store/patch.ts
19036
+ // packages/workit-core/src/store/patch.ts
19037
19037
  var isPlainObject3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
19038
19038
  var equal = (left, right) => {
19039
19039
  if (left === right)
@@ -19143,7 +19143,7 @@ var isPatch = (value) => Array.isArray(value) && value.every((op) => {
19143
19143
  return false;
19144
19144
  });
19145
19145
 
19146
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/store/reduce.ts
19146
+ // packages/workit-core/src/store/reduce.ts
19147
19147
  import { createHash as createHash3 } from "node:crypto";
19148
19148
  var OPENING_TYPES = new Set([
19149
19149
  "task.opened",
@@ -19274,7 +19274,7 @@ function eventType(before, after) {
19274
19274
  return "task.updated";
19275
19275
  }
19276
19276
 
19277
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/store/notes.ts
19277
+ // packages/workit-core/src/store/notes.ts
19278
19278
  var SLOT = Symbol.for("workit.migrationReporter");
19279
19279
  var reportMigration = (report) => {
19280
19280
  try {
@@ -19285,7 +19285,7 @@ var reportMigration = (report) => {
19285
19285
  };
19286
19286
  var migrationReporterInstalled = () => typeof globalThis[SLOT] === "function";
19287
19287
 
19288
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/task-store.ts
19288
+ // packages/workit-core/src/core/task-store.ts
19289
19289
  var MIGRATION_PENDING = "workit migration pending";
19290
19290
  var STORE_FORMAT = 3;
19291
19291
  var STORE_MIN_RUNTIME = "3.0.0";
@@ -20921,18 +20921,18 @@ class TaskStore {
20921
20921
  return failure2(recovery ? "recovery_required" : "storage_error", `lock operation failed: ${String(error)}`, { path: lockPath });
20922
20922
  }
20923
20923
  }
20924
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/workers.ts
20924
+ // packages/workit-core/src/core/workers.ts
20925
20925
  var UNCERTAIN_WORKER_STATES = ["dispatching", "running", "cancelling", "unknown"];
20926
20926
  var isUncertainWorker = (state) => UNCERTAIN_WORKER_STATES.includes(state);
20927
20927
  var workerBlocksTransition = (transition, state) => transition === "pause" ? false : isUncertainWorker(state);
20928
20928
 
20929
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/task-evaluation.ts
20929
+ // packages/workit-core/src/core/task-evaluation.ts
20930
20930
  import { createHash as createHash7 } from "node:crypto";
20931
20931
  import * as fs11 from "node:fs";
20932
20932
  import { spawnSync as spawnSync6 } from "node:child_process";
20933
20933
  import path11 from "node:path";
20934
20934
 
20935
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/check-config.ts
20935
+ // packages/workit-core/src/check-config.ts
20936
20936
  import { spawnSync as spawnSync3 } from "node:child_process";
20937
20937
  import fs8 from "node:fs";
20938
20938
  import path7 from "node:path";
@@ -21137,7 +21137,7 @@ function checkCommand(args, version, onPath = workitAvailable()) {
21137
21137
  return onPath ? `workit check ${args}` : `npx -y @brainervirus/workit-cli@${version} check ${args}`;
21138
21138
  }
21139
21139
 
21140
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/git/rev.ts
21140
+ // packages/workit-core/src/git/rev.ts
21141
21141
  import { spawnSync as spawnSync4 } from "node:child_process";
21142
21142
  import { createHash as createHash5 } from "node:crypto";
21143
21143
  import fs9 from "node:fs";
@@ -21318,11 +21318,11 @@ function pushRemoteName(cwd, branch) {
21318
21318
  return remotes.length === 1 ? remotes[0] : null;
21319
21319
  }
21320
21320
 
21321
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/policy/derive.ts
21321
+ // packages/workit-core/src/core/policy/derive.ts
21322
21322
  import { existsSync as existsSync3 } from "node:fs";
21323
21323
  import path10 from "node:path";
21324
21324
 
21325
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/ledger.ts
21325
+ // packages/workit-core/src/ledger.ts
21326
21326
  import { spawnSync as spawnSync5 } from "node:child_process";
21327
21327
  import { createHash as createHash6, randomBytes as randomBytes2 } from "node:crypto";
21328
21328
  import fs10 from "node:fs";
@@ -21564,7 +21564,7 @@ var independenceReasons = (row, authors) => {
21564
21564
  reasons.push("self");
21565
21565
  return reasons;
21566
21566
  };
21567
- function effectiveOf(rows, authors) {
21567
+ function effectiveOf(rows, authors, sameCode) {
21568
21568
  let effective = null;
21569
21569
  for (const row of rows) {
21570
21570
  if (!effective) {
@@ -21575,7 +21575,7 @@ function effectiveOf(rows, authors) {
21575
21575
  const effIndependent = independenceReasons(effective, authors).length === 0;
21576
21576
  if (effIndependent && !rowIndependent)
21577
21577
  continue;
21578
- if (effIndependent && FAILING.has(String(effective.result)) && row.actor.session === effective.actor.session)
21578
+ if (effIndependent && FAILING.has(String(effective.result)) && row.actor.session === effective.actor.session && sameCode(effective, row))
21579
21579
  continue;
21580
21580
  effective = row;
21581
21581
  }
@@ -21606,16 +21606,22 @@ function checkVerdicts(cwd, branch, rows) {
21606
21606
  const head = branchHead(cwd, branch);
21607
21607
  const fallbackBase = defaultBase(cwd);
21608
21608
  const keyCache = new Map;
21609
- const keyFor = (base) => {
21610
- if (!base || !head)
21609
+ const keysAt = (base, at) => {
21610
+ if (!base || !at)
21611
21611
  return { patchId: null, diffHash: null };
21612
- let key = keyCache.get(base);
21612
+ const cacheKey = `${base}\x00${at}`;
21613
+ let key = keyCache.get(cacheKey);
21613
21614
  if (!key) {
21614
- key = { patchId: patchId(cwd, base, head), diffHash: diffHash(cwd, base, head) };
21615
- keyCache.set(base, key);
21615
+ key = { patchId: patchId(cwd, base, at), diffHash: diffHash(cwd, base, at) };
21616
+ keyCache.set(cacheKey, key);
21616
21617
  }
21617
21618
  return key;
21618
21619
  };
21620
+ const keyFor = (base) => keysAt(base, head);
21621
+ const sameCode = (failed, row) => verdictBasis(failed, {
21622
+ head: row.head,
21623
+ ...keysAt(failed.base ?? fallbackBase, row.head)
21624
+ }) !== "stale" || restackCarries(rows, branch, failed.head, row.head);
21619
21625
  const authors = authorSessions(cwd, rows, branch, { base: fallbackBase, head });
21620
21626
  const byKind = new Map;
21621
21627
  for (const row of rows)
@@ -21625,7 +21631,7 @@ function checkVerdicts(cwd, branch, rows) {
21625
21631
  }
21626
21632
  const verdicts = [];
21627
21633
  for (const [kind, list] of byKind) {
21628
- const row = effectiveOf(list, authors);
21634
+ const row = effectiveOf(list, authors, sameCode);
21629
21635
  if (!row)
21630
21636
  continue;
21631
21637
  let basis = verdictBasis(row, { head, ...keyFor(row.base ?? fallbackBase) });
@@ -21651,11 +21657,11 @@ function checkVerdicts(cwd, branch, rows) {
21651
21657
  verdicts.sort((a, b) => a.verdict.seq - b.verdict.seq);
21652
21658
  const newestCurrent = verdicts.findLast((entry) => entry.current) ?? verdicts.at(-1) ?? null;
21653
21659
  const failing = verdicts.find((entry) => entry.current && entry.independent && FAILING.has(String(entry.verdict.result)));
21654
- const newestAccepted = verdicts.findLast((entry) => entry.accepted) ?? null;
21660
+ const newestAccepted = verdicts.findLast((entry) => entry.accepted && STRONG_RESULTS.has(String(entry.verdict.result))) ?? null;
21655
21661
  const accepted = newestAccepted && !failing ? { accepted: true, verdict: newestAccepted.verdict, reasons: [] } : {
21656
21662
  accepted: false,
21657
21663
  verdict: failing?.verdict ?? null,
21658
- reasons: failing ? ["failing_verdict"] : newestCurrent?.reasons ?? ["no_verdict"]
21664
+ reasons: failing ? ["failing_verdict"] : !newestCurrent ? ["no_verdict"] : newestCurrent.reasons.length ? newestCurrent.reasons : ["type_check_only"]
21659
21665
  };
21660
21666
  const selfEntry = failing ? undefined : verdicts.findLast((entry) => entry.current && !entry.independent && STRONG_RESULTS.has(String(entry.verdict.result)));
21661
21667
  return {
@@ -21671,9 +21677,9 @@ function checkVerdicts(cwd, branch, rows) {
21671
21677
  authors: [...authors].toSorted()
21672
21678
  };
21673
21679
  }
21674
- var OBSERVED_ONLY = new Set(["check", ...PR_ROW_TYPES]);
21680
+ var OBSERVED_ONLY = new Set(["check", "merge.unverified", ...PR_ROW_TYPES]);
21675
21681
 
21676
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/policy/derive.ts
21682
+ // packages/workit-core/src/core/policy/derive.ts
21677
21683
  var RULES = {
21678
21684
  test: "check:test",
21679
21685
  self: "verdict:self",
@@ -21861,7 +21867,7 @@ function derivedRuleStatus(task, requirement, root, ledger) {
21861
21867
  }
21862
21868
  }
21863
21869
 
21864
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/task-evaluation.ts
21870
+ // packages/workit-core/src/core/task-evaluation.ts
21865
21871
  var digestBytes = (value) => createHash7("sha256").update(value).digest("hex");
21866
21872
  var inside = (root, candidate) => candidate === root || candidate.startsWith(`${root}${path11.sep}`);
21867
21873
  var relative = (root, candidate) => path11.relative(root, candidate).split(path11.sep).join("/") || ".";
@@ -22527,7 +22533,7 @@ function evaluateClosure(requestedOutcome, view) {
22527
22533
  });
22528
22534
  }
22529
22535
 
22530
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/methods.ts
22536
+ // packages/workit-core/src/core/methods.ts
22531
22537
  var METHODS = {
22532
22538
  "workit-shape": { dimensions: ["challenge", "decisions", "artifacts", "continuity"] },
22533
22539
  "workit-bdd": { dimensions: ["testing"] },
@@ -22573,7 +22579,7 @@ function selectMethods(policy, capabilities) {
22573
22579
  });
22574
22580
  }
22575
22581
 
22576
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/task-context.ts
22582
+ // packages/workit-core/src/core/task-context.ts
22577
22583
  function reconcileResume(view, observations = []) {
22578
22584
  if (observations.length > 0)
22579
22585
  return failure2("permission_denied", "worker observations require native host verification");
@@ -22687,75 +22693,10 @@ var exportDigest = (bundle) => sha256({
22687
22693
  sourceWorkspaceId: bundle.sourceWorkspaceId,
22688
22694
  task: bundle.task
22689
22695
  });
22690
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/git.ts
22691
- import { execFileSync } from "node:child_process";
22692
- var run = (cwd, args) => {
22693
- try {
22694
- const stdout = execFileSync("git", args, {
22695
- cwd,
22696
- encoding: "utf8",
22697
- stdio: ["pipe", "pipe", "pipe"]
22698
- });
22699
- return { stdout: stdout.trimEnd(), stderr: "", exitCode: 0 };
22700
- } catch (error) {
22701
- const e = error;
22702
- return {
22703
- stdout: (e.stdout ?? "").trimEnd(),
22704
- stderr: (e.stderr ?? "").trimEnd(),
22705
- exitCode: e.status ?? 1
22706
- };
22707
- }
22708
- };
22709
- var gitContext = (workspaceRoot, paths = []) => {
22710
- const cwd = workspaceRoot;
22711
- let failure;
22712
- const runHere = (args) => {
22713
- const result = run(cwd, args);
22714
- if (!failure && result.exitCode !== 0) {
22715
- failure = { stderr: result.stderr, exitCode: result.exitCode };
22716
- }
22717
- return result.stdout;
22718
- };
22719
- const branch = runHere(["rev-parse", "--abbrev-ref", "HEAD"]) || "unknown";
22720
- const status_short = runHere(["status", "--porcelain"]);
22721
- const staged = [];
22722
- const unstaged = [];
22723
- const untracked = [];
22724
- for (const line of status_short.split(`
22725
- `).filter(Boolean)) {
22726
- const code = line.slice(0, 2);
22727
- const file = line.slice(3);
22728
- if (code === "??") {
22729
- untracked.push(file);
22730
- } else {
22731
- if (code[0] !== " " && code[0] !== "?")
22732
- staged.push(file);
22733
- if (code[1] !== " " && code[1] !== "?")
22734
- unstaged.push(file);
22735
- }
22736
- }
22737
- const pathArgs = paths.length ? ["--", ...paths] : [];
22738
- const diff_stat = runHere(["diff", "--stat", ...pathArgs]);
22739
- const cached_stat = runHere(["diff", "--cached", "--stat", ...pathArgs]);
22740
- const stagedSet = new Set(staged);
22741
- const unstagedSet = new Set(unstaged);
22742
- const partial_staged = [...stagedSet].filter((f) => unstagedSet.has(f));
22743
- return {
22744
- workspace_root: cwd,
22745
- branch,
22746
- status_short,
22747
- staged,
22748
- unstaged,
22749
- untracked,
22750
- diff_stat: [diff_stat, cached_stat].filter(Boolean).join(`
22751
- `),
22752
- partial_staged: partial_staged.length > 0,
22753
- partial_staged_files: partial_staged,
22754
- ...failure ? { stderr: failure.stderr, exitCode: failure.exitCode } : {}
22755
- };
22756
- };
22696
+ // packages/workit-core/src/core/branch-policy.ts
22697
+ import { spawnSync as spawnSync7 } from "node:child_process";
22757
22698
 
22758
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/config.ts
22699
+ // packages/workit-core/src/core/config.ts
22759
22700
  import {
22760
22701
  copyFileSync as copyFileSync2,
22761
22702
  cpSync as cpSync2,
@@ -22768,7 +22709,7 @@ import {
22768
22709
  import os2 from "node:os";
22769
22710
  import path12 from "node:path";
22770
22711
 
22771
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/boundary.ts
22712
+ // packages/workit-core/src/core/boundary.ts
22772
22713
  import { statSync as statSync2 } from "node:fs";
22773
22714
  var EVENT = {
22774
22715
  initialization: "initialization",
@@ -22804,7 +22745,7 @@ var changedSourcesSinceLoad = (marker) => {
22804
22745
  return changed;
22805
22746
  };
22806
22747
 
22807
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/config.ts
22748
+ // packages/workit-core/src/core/config.ts
22808
22749
  var diagnosticLogger;
22809
22750
  var PRESETS = {
22810
22751
  gitflow: {
@@ -22879,6 +22820,7 @@ var DEFAULTS = {
22879
22820
  },
22880
22821
  commitPolicy: { preset: "conventional" }
22881
22822
  };
22823
+ var unchosenBranchPolicy = new WeakSet([DEFAULTS]);
22882
22824
  var readSafe = (p) => {
22883
22825
  try {
22884
22826
  return readFileSync3(p, "utf8");
@@ -22903,22 +22845,21 @@ var parseConfigResult = (raw, file) => {
22903
22845
  const locale = LOCALE_RE.test(String(input.locale ?? "")) ? input.locale : DEFAULTS.locale;
22904
22846
  const preset = Object.hasOwn(PRESETS, input.branchPolicy?.preset) ? input.branchPolicy?.preset : "gitflow";
22905
22847
  const commitPreset = COMMIT_PRESETS.includes(String(input.commitPolicy?.preset ?? "")) ? input.commitPolicy?.preset : "conventional";
22906
- return {
22907
- status: "valid",
22908
- path: file,
22909
- config: {
22910
- locale,
22911
- localeOptions: Array.isArray(input.localeOptions) ? input.localeOptions : DEFAULTS.localeOptions,
22912
- branchPolicy: mergePreset(preset, {
22913
- allowed: Array.isArray(input.branchPolicy?.allowed) ? input.branchPolicy.allowed : undefined,
22914
- protectedNames: Array.isArray(input.branchPolicy?.protected) ? input.branchPolicy.protected : undefined
22915
- }, DEFAULTS),
22916
- commitPolicy: {
22917
- preset: commitPreset,
22918
- ...typeof input.commitPolicy?.pattern === "string" ? { pattern: input.commitPolicy.pattern } : {}
22919
- }
22848
+ const config = {
22849
+ locale,
22850
+ localeOptions: Array.isArray(input.localeOptions) ? input.localeOptions : DEFAULTS.localeOptions,
22851
+ branchPolicy: mergePreset(preset, {
22852
+ allowed: Array.isArray(input.branchPolicy?.allowed) ? input.branchPolicy.allowed : undefined,
22853
+ protectedNames: Array.isArray(input.branchPolicy?.protected) ? input.branchPolicy.protected : undefined
22854
+ }, DEFAULTS),
22855
+ commitPolicy: {
22856
+ preset: commitPreset,
22857
+ ...typeof input.commitPolicy?.pattern === "string" ? { pattern: input.commitPolicy.pattern } : {}
22920
22858
  }
22921
22859
  };
22860
+ if (!Object.hasOwn(PRESETS, input.branchPolicy?.preset))
22861
+ unchosenBranchPolicy.add(config);
22862
+ return { status: "valid", path: file, config };
22922
22863
  };
22923
22864
  var readConfigTyped = (dir) => {
22924
22865
  const file = path12.join(dir ?? configDir(), "config.json");
@@ -22932,9 +22873,11 @@ var readConfig = () => {
22932
22873
  };
22933
22874
  var vcsConfigPath = () => process.env.WORKFLOW_VCS_CONFIG ?? path12.join(configDir(), "vcs.json");
22934
22875
  var branchGlobPattern = (glob) => new RegExp(`^${glob.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*")}$`, "i");
22935
- var resolveBranchPolicy = (config, workspace) => {
22876
+ var resolveBranchPolicy = (config, workspace, repoPreset) => {
22936
22877
  const wp = workspace?.branchPolicy ?? {};
22937
- const preset = Object.hasOwn(PRESETS, wp.preset) ? wp.preset : config.branchPolicy?.preset ?? "gitflow";
22878
+ const workspacePreset = Object.hasOwn(PRESETS, wp.preset);
22879
+ const detected = !workspacePreset && unchosenBranchPolicy.has(config) ? repoPreset?.() ?? null : null;
22880
+ const preset = workspacePreset ? wp.preset : detected ?? config.branchPolicy?.preset ?? "gitflow";
22938
22881
  const merged = mergePreset(preset, {
22939
22882
  allowed: wp.allowed,
22940
22883
  protectedNames: wp.protected
@@ -22943,9 +22886,10 @@ var resolveBranchPolicy = (config, workspace) => {
22943
22886
  return {
22944
22887
  preset,
22945
22888
  allowed,
22946
- protected: new Set(merged.protected.map((p) => p.toLowerCase())),
22889
+ protected: new Set([...merged.protected, ...detected ? PRESETS.gitflow.protected : []].map((p) => p.toLowerCase())),
22947
22890
  integration: wp.integration === "merge" ? "merge" : "pr",
22948
- defaultTargetBranch: preset === "github-flow" ? "main" : preset === "trunk-based" ? "master" : "develop"
22891
+ defaultTargetBranch: preset === "github-flow" ? "main" : preset === "trunk-based" ? "master" : "develop",
22892
+ detected: detected !== null
22949
22893
  };
22950
22894
  };
22951
22895
  var COMMIT_PRESETS = [
@@ -22957,7 +22901,139 @@ var COMMIT_PRESETS = [
22957
22901
  "auto"
22958
22902
  ];
22959
22903
 
22960
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/workspaces.ts
22904
+ // packages/workit-core/src/core/branch-policy.ts
22905
+ var PREFIXES = {
22906
+ feature: "feature/*",
22907
+ bugfix: "bugfix/*",
22908
+ release: "release/*",
22909
+ hotfix: "hotfix/*"
22910
+ };
22911
+ var branchNames = (workspaceRoot) => {
22912
+ const r = spawnSync7("git", ["for-each-ref", "--format=%(refname)", "refs/heads", "refs/remotes/origin"], { cwd: workspaceRoot, encoding: "utf8" });
22913
+ if (r.status !== 0)
22914
+ return new Set;
22915
+ return new Set((r.stdout ?? "").split(`
22916
+ `).filter(Boolean).map((ref) => ref.startsWith("refs/heads/") ? ref.slice("refs/heads/".length) : ref.slice("refs/remotes/origin/".length)));
22917
+ };
22918
+ var detectBranchPolicy = (workspaceRoot) => {
22919
+ const names = branchNames(workspaceRoot);
22920
+ const develop = names.has("develop");
22921
+ const main = names.has("main");
22922
+ const master = names.has("master");
22923
+ const root = main ? "main" : master ? "master" : null;
22924
+ if (develop) {
22925
+ return {
22926
+ preset: "gitflow",
22927
+ developBranch: "develop",
22928
+ integration: "merge",
22929
+ protected: root ? [root, "develop"] : ["develop"],
22930
+ allowed: [...PRESETS.gitflow.allowed],
22931
+ prefixes: PREFIXES
22932
+ };
22933
+ }
22934
+ if (root === "main") {
22935
+ return {
22936
+ preset: "github-flow",
22937
+ developBranch: null,
22938
+ integration: "pr",
22939
+ protected: [root],
22940
+ allowed: ["*"],
22941
+ prefixes: PREFIXES
22942
+ };
22943
+ }
22944
+ if (root === "master") {
22945
+ return {
22946
+ preset: "trunk-based",
22947
+ developBranch: null,
22948
+ integration: "pr",
22949
+ protected: [root],
22950
+ allowed: ["*"],
22951
+ prefixes: PREFIXES
22952
+ };
22953
+ }
22954
+ return {
22955
+ preset: "gitflow",
22956
+ developBranch: null,
22957
+ integration: "merge",
22958
+ protected: [],
22959
+ allowed: [],
22960
+ prefixes: PREFIXES
22961
+ };
22962
+ };
22963
+ var repoBranchPreset = (workspaceRoot) => {
22964
+ const detected = detectBranchPolicy(workspaceRoot);
22965
+ return detected.developBranch || detected.allowed.length ? detected.preset : null;
22966
+ };
22967
+
22968
+ // packages/workit-core/src/core/git.ts
22969
+ import { execFileSync } from "node:child_process";
22970
+ var run = (cwd, args) => {
22971
+ try {
22972
+ const stdout = execFileSync("git", args, {
22973
+ cwd,
22974
+ encoding: "utf8",
22975
+ stdio: ["pipe", "pipe", "pipe"]
22976
+ });
22977
+ return { stdout: stdout.trimEnd(), stderr: "", exitCode: 0 };
22978
+ } catch (error) {
22979
+ const e = error;
22980
+ return {
22981
+ stdout: (e.stdout ?? "").trimEnd(),
22982
+ stderr: (e.stderr ?? "").trimEnd(),
22983
+ exitCode: e.status ?? 1
22984
+ };
22985
+ }
22986
+ };
22987
+ var gitContext = (workspaceRoot, paths = []) => {
22988
+ const cwd = workspaceRoot;
22989
+ let failure;
22990
+ const runHere = (args) => {
22991
+ const result = run(cwd, args);
22992
+ if (!failure && result.exitCode !== 0) {
22993
+ failure = { stderr: result.stderr, exitCode: result.exitCode };
22994
+ }
22995
+ return result.stdout;
22996
+ };
22997
+ const branch = runHere(["rev-parse", "--abbrev-ref", "HEAD"]) || "unknown";
22998
+ const status_short = runHere(["status", "--porcelain"]);
22999
+ const staged = [];
23000
+ const unstaged = [];
23001
+ const untracked = [];
23002
+ for (const line of status_short.split(`
23003
+ `).filter(Boolean)) {
23004
+ const code = line.slice(0, 2);
23005
+ const file = line.slice(3);
23006
+ if (code === "??") {
23007
+ untracked.push(file);
23008
+ } else {
23009
+ if (code[0] !== " " && code[0] !== "?")
23010
+ staged.push(file);
23011
+ if (code[1] !== " " && code[1] !== "?")
23012
+ unstaged.push(file);
23013
+ }
23014
+ }
23015
+ const pathArgs = paths.length ? ["--", ...paths] : [];
23016
+ const diff_stat = runHere(["diff", "--stat", ...pathArgs]);
23017
+ const cached_stat = runHere(["diff", "--cached", "--stat", ...pathArgs]);
23018
+ const stagedSet = new Set(staged);
23019
+ const unstagedSet = new Set(unstaged);
23020
+ const partial_staged = [...stagedSet].filter((f) => unstagedSet.has(f));
23021
+ return {
23022
+ workspace_root: cwd,
23023
+ branch,
23024
+ status_short,
23025
+ staged,
23026
+ unstaged,
23027
+ untracked,
23028
+ diff_stat: [diff_stat, cached_stat].filter(Boolean).join(`
23029
+ `),
23030
+ partial_staged: partial_staged.length > 0,
23031
+ partial_staged_files: partial_staged,
23032
+ ...failure ? { stderr: failure.stderr, exitCode: failure.exitCode } : {}
23033
+ };
23034
+ };
23035
+
23036
+ // packages/workit-core/src/core/workspaces.ts
22961
23037
  import { createHash as createHash8 } from "node:crypto";
22962
23038
  import { readFileSync as readFileSync4, realpathSync as realpathSync3 } from "node:fs";
22963
23039
  import path13 from "node:path";
@@ -23362,18 +23438,18 @@ function workspaceDefaultTarget(cwd, globalDefault) {
23362
23438
  const wp = ws?.branchPolicy ?? {};
23363
23439
  const hasWorkspacePolicy = typeof wp.preset === "string" && Object.hasOwn(PRESETS, wp.preset);
23364
23440
  const selected = resolveRuntimeWorkspacePolicy(cwd, "branch", process.env.WORKFLOW_PROFILE?.trim() || undefined);
23365
- const policyDefault = resolveBranchPolicy(readConfig(), selected.policy ? { branchPolicy: selected.policy } : null).defaultTargetBranch;
23441
+ const policyDefault = resolveBranchPolicy(readConfig(), selected.policy ? { branchPolicy: selected.policy } : null, () => repoBranchPreset(cwd)).defaultTargetBranch;
23366
23442
  return String(ws?.vcs?.defaultTargetBranch ?? (hasWorkspacePolicy ? policyDefault : globalDefault ?? policyDefault) ?? "develop");
23367
23443
  }
23368
23444
 
23369
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/vcs-config.ts
23445
+ // packages/workit-core/src/core/vcs-config.ts
23370
23446
  import fs12 from "node:fs";
23371
23447
  import path14 from "node:path";
23372
- import { spawnSync as spawnSync8 } from "node:child_process";
23448
+ import { spawnSync as spawnSync9 } from "node:child_process";
23373
23449
 
23374
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/release-tracks.ts
23450
+ // packages/workit-core/src/core/release-tracks.ts
23375
23451
  import { createHash as createHash9 } from "node:crypto";
23376
- import { spawnSync as spawnSync7 } from "node:child_process";
23452
+ import { spawnSync as spawnSync8 } from "node:child_process";
23377
23453
  var KNOWN_FIELDS = new Set([
23378
23454
  "strategy",
23379
23455
  "productionBranch",
@@ -23645,7 +23721,7 @@ function resolveReleaseTrack(input) {
23645
23721
  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 ")}`);
23646
23722
  }
23647
23723
  var git4 = (cwd, args) => {
23648
- const run = spawnSync7("git", args, {
23724
+ const run = spawnSync8("git", args, {
23649
23725
  cwd,
23650
23726
  encoding: "utf8",
23651
23727
  timeout: 20000,
@@ -23756,11 +23832,11 @@ function resolveTrackFor(cwd, options) {
23756
23832
  return resolution;
23757
23833
  }
23758
23834
 
23759
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/vcs-config.ts
23835
+ // packages/workit-core/src/core/vcs-config.ts
23760
23836
  var workspacesPath = () => path14.join(configDir(), "workspaces.json");
23761
23837
  var vcsCwd = (cwd) => cwd ?? process.env.WORKFLOW_WORKSPACE_ROOT ?? process.cwd();
23762
23838
  var remoteProvider = (cwd) => {
23763
- const r = spawnSync8("git", ["remote", "get-url", "origin"], { cwd, encoding: "utf8" });
23839
+ const r = spawnSync9("git", ["remote", "get-url", "origin"], { cwd, encoding: "utf8" });
23764
23840
  if (r.status !== 0)
23765
23841
  return null;
23766
23842
  const url = (r.stdout ?? "").trim();
@@ -23797,7 +23873,7 @@ var remoteEndpoint = (remote) => {
23797
23873
  var configuredSshEndpoint = (host) => {
23798
23874
  if (host.startsWith("-"))
23799
23875
  return null;
23800
- const resolved = spawnSync8("ssh", ["-G", host], {
23876
+ const resolved = spawnSync9("ssh", ["-G", host], {
23801
23877
  encoding: "utf8",
23802
23878
  timeout: 5000,
23803
23879
  maxBuffer: 1024 * 1024,
@@ -23970,7 +24046,7 @@ function mergedPrStyle(limit = 6, cwd) {
23970
24046
  `).filter((l) => l.startsWith("## ")).map((l) => l.trim()),
23971
24047
  descriptionPreview: desc.slice(0, 600)
23972
24048
  });
23973
- const remoteResult = spawnSync8("git", ["remote", "get-url", "--push", "--all", "origin"], {
24049
+ const remoteResult = spawnSync9("git", ["remote", "get-url", "--push", "--all", "origin"], {
23974
24050
  cwd,
23975
24051
  encoding: "utf8"
23976
24052
  });
@@ -23986,7 +24062,7 @@ function mergedPrStyle(limit = 6, cwd) {
23986
24062
  if (!hostingApiHostMatches(remote, host))
23987
24063
  return { ok: false, error: "PR style target does not match the provider host" };
23988
24064
  if (provider === "gitlab") {
23989
- const run = (args) => spawnSync8("glab", ["api", ...args], {
24065
+ const run = (args) => spawnSync9("glab", ["api", ...args], {
23990
24066
  cwd,
23991
24067
  encoding: "utf8",
23992
24068
  env
@@ -24006,7 +24082,7 @@ function mergedPrStyle(limit = 6, cwd) {
24006
24082
  });
24007
24083
  }
24008
24084
  } else if (provider === "github") {
24009
- const r = spawnSync8("gh", [
24085
+ const r = spawnSync9("gh", [
24010
24086
  "pr",
24011
24087
  "list",
24012
24088
  "--repo",
@@ -24037,10 +24113,10 @@ function mergedPrStyle(limit = 6, cwd) {
24037
24113
  examples
24038
24114
  };
24039
24115
  }
24040
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/task-engine.ts
24116
+ // packages/workit-core/src/core/task-engine.ts
24041
24117
  import { realpathSync as realpathSync4 } from "node:fs";
24042
24118
 
24043
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/policy-resolver.ts
24119
+ // packages/workit-core/src/core/policy-resolver.ts
24044
24120
  function resolvePolicy(input) {
24045
24121
  const ids = input.constraints.map((constraint) => constraint.id);
24046
24122
  if (new Set(ids).size !== ids.length)
@@ -24096,7 +24172,7 @@ function diffPolicy(previous, next, reason, now) {
24096
24172
  return parsed.data;
24097
24173
  }
24098
24174
 
24099
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/policy/judgment.ts
24175
+ // packages/workit-core/src/core/policy/judgment.ts
24100
24176
  var isObject6 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
24101
24177
  var squash = (key) => key.toLowerCase().replace(/[_-]/g, "");
24102
24178
  var ALIASES = {
@@ -24220,7 +24296,7 @@ function normalizeJudgment(raw, previous) {
24220
24296
  return success(null, null, { judgment: parsed.data, ignored, legacy });
24221
24297
  }
24222
24298
 
24223
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/autonomy.ts
24299
+ // packages/workit-core/src/autonomy.ts
24224
24300
  import os3 from "node:os";
24225
24301
  import path15 from "node:path";
24226
24302
  var accountHome = () => {
@@ -24357,7 +24433,7 @@ function resolveAutonomy(cwd) {
24357
24433
  var suggested = (kind) => kind === "merge" ? "verified" : "true";
24358
24434
  var grantHint = (workspace, kind) => `ask the user to run, in their own terminal: workit grant set ${workspace ?? "<workspace>"} ${kind}=${suggested(kind)}`;
24359
24435
 
24360
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/task-engine.ts
24436
+ // packages/workit-core/src/core/task-engine.ts
24361
24437
  var workspaceVerification = (root) => {
24362
24438
  try {
24363
24439
  return resolveAutonomy(root).verification;
@@ -25942,8 +26018,8 @@ class WorkitCore {
25942
26018
  return this.summary(changed.data.task);
25943
26019
  }
25944
26020
  }
25945
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/repo-context.ts
25946
- import { spawnSync as spawnSync9 } from "node:child_process";
26021
+ // packages/workit-core/src/core/repo-context.ts
26022
+ import { spawnSync as spawnSync10 } from "node:child_process";
25947
26023
  import { existsSync as existsSync6, readFileSync as readFileSync5, readdirSync as readdirSync4 } from "node:fs";
25948
26024
  import path16 from "node:path";
25949
26025
  var isSafeContextRange = (value) => value.length <= 4096 && (() => {
@@ -25972,7 +26048,7 @@ var invalidRange = (cwd) => ({
25972
26048
  cwd
25973
26049
  });
25974
26050
  var runGit = (cwd, args) => {
25975
- const result = spawnSync9("git", args, { cwd, encoding: "utf8" });
26051
+ const result = spawnSync10("git", args, { cwd, encoding: "utf8" });
25976
26052
  return {
25977
26053
  stdout: (result.stdout ?? "").trimEnd(),
25978
26054
  stderr: (result.stderr ?? "").trimEnd(),
@@ -26412,20 +26488,20 @@ function releaseNotesContext(root, rangeOrTag) {
26412
26488
  return { stdout, stderr: "", exitCode: 0, cwd };
26413
26489
  }
26414
26490
 
26415
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/tracker-issues.ts
26416
- import { spawnSync as spawnSync11 } from "node:child_process";
26491
+ // packages/workit-core/src/core/tracker-issues.ts
26492
+ import { spawnSync as spawnSync12 } from "node:child_process";
26417
26493
 
26418
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/pr-create.ts
26494
+ // packages/workit-core/src/core/pr-create.ts
26419
26495
  import fs13 from "node:fs";
26420
26496
  import path17 from "node:path";
26421
- import { spawnSync as spawnSync10 } from "node:child_process";
26422
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/forge/pr-body.ts
26497
+ import { spawnSync as spawnSync11 } from "node:child_process";
26498
+ // packages/workit-core/src/forge/pr-body.ts
26423
26499
  function parseGhIssue(value) {
26424
26500
  const m = /issues\/(\d+)/.exec(value);
26425
26501
  return m ? m[1] : String(value).trim().replace(/^#/, "");
26426
26502
  }
26427
26503
 
26428
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/pr-create.ts
26504
+ // packages/workit-core/src/core/pr-create.ts
26429
26505
  function whichOnPath(tool) {
26430
26506
  const names = process.platform === "win32" ? [tool, `${tool}.exe`, `${tool}.cmd`] : [tool];
26431
26507
  for (const dir of (process.env.PATH ?? "").split(path17.delimiter)) {
@@ -26443,7 +26519,7 @@ function whichOnPath(tool) {
26443
26519
  }
26444
26520
  var hostingCliAvailable = (provider) => whichOnPath(provider === "gitlab" ? "glab" : "gh") !== null;
26445
26521
  var pushRemote = (cwd) => {
26446
- const result = spawnSync10("git", ["remote", "get-url", "--push", "--all", "origin"], {
26522
+ const result = spawnSync11("git", ["remote", "get-url", "--push", "--all", "origin"], {
26447
26523
  cwd,
26448
26524
  encoding: "utf8"
26449
26525
  });
@@ -26453,7 +26529,7 @@ var pushRemote = (cwd) => {
26453
26529
  return urls.length === 1 ? urls[0] : null;
26454
26530
  };
26455
26531
 
26456
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/tracker-issues.ts
26532
+ // packages/workit-core/src/core/tracker-issues.ts
26457
26533
  var repoPathFromRemote = (remote) => {
26458
26534
  let rest = (remote || "").trim().replace(/\/+$/, "");
26459
26535
  if (!rest)
@@ -26474,7 +26550,7 @@ var defaultCli = (bin, available) => {
26474
26550
  if (!available)
26475
26551
  return null;
26476
26552
  return (args, root) => {
26477
- const out = spawnSync11(bin, args, {
26553
+ const out = spawnSync12(bin, args, {
26478
26554
  cwd: root,
26479
26555
  encoding: "utf8",
26480
26556
  env: { ...process.env, PATH: process.env.PATH ?? "" }
@@ -26551,19 +26627,19 @@ var fetchGitLabIssueBody = async (ref, root, deps = {}) => {
26551
26627
  return tryCliTriple(deps.cli ?? defaultCli("glab", hostingCliAvailable("gitlab")), "glab", ["issue", "view", id, "-R", repoArg, "-F", "json"], root, id, ["iid"], ["description"]);
26552
26628
  };
26553
26629
 
26554
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/youtrack.ts
26630
+ // packages/workit-core/src/core/youtrack.ts
26555
26631
  import fs14 from "node:fs";
26556
26632
  import path18 from "node:path";
26557
26633
 
26558
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/templates.ts
26634
+ // packages/workit-core/src/core/templates.ts
26559
26635
  var repoRoot2 = assetRoot();
26560
26636
 
26561
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/scripts.ts
26637
+ // packages/workit-core/src/core/scripts.ts
26562
26638
  var PLUGIN_ROOT = packageRoot();
26563
26639
  var ASSET_ROOT = assetRoot();
26564
26640
  var resolveWorkspaceRoot = (explicit) => explicit || process.cwd();
26565
26641
 
26566
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/youtrack.ts
26642
+ // packages/workit-core/src/core/youtrack.ts
26567
26643
  var ISSUE_RE = /^[A-Z]+-\d+$/;
26568
26644
  var TOKEN_PLACEHOLDER = "YOUR_TOKEN_HERE";
26569
26645
  var youTrackConfigPath = () => process.env.WORKFLOW_YOUTRACK_CONFIG ?? path18.join(configDir(), "youtrack.json");
@@ -26854,7 +26930,7 @@ var fetchYouTrackIssueBody = async (issue, creds = youTrackToken, request = youT
26854
26930
  }
26855
26931
  };
26856
26932
 
26857
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/context-read.ts
26933
+ // packages/workit-core/src/core/context-read.ts
26858
26934
  var contextReadSchema = object2({
26859
26935
  kind: _enum([
26860
26936
  "git",
@@ -26949,7 +27025,7 @@ var readExternalContext = async (root, payload) => {
26949
27025
  }
26950
27026
  }
26951
27027
  };
26952
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core.ts
27028
+ // packages/workit-core/src/core.ts
26953
27029
  var revision2 = /^[A-Za-z0-9@][A-Za-z0-9@._/~^{}-]*$/;
26954
27030
  function gitRevisionParts(value) {
26955
27031
  if (!value || value.startsWith("-") || /[\s\\'"`$;|&<>]/.test(value)) {
@@ -26992,7 +27068,7 @@ function resolveInside(root, candidate) {
26992
27068
  }
26993
27069
  function run2(root, executable, args, env = {}) {
26994
27070
  const cwd = realpathSync5(root);
26995
- const result = spawnSync12(executable, args, {
27071
+ const result = spawnSync13(executable, args, {
26996
27072
  cwd,
26997
27073
  encoding: "utf8",
26998
27074
  env: { ...process.env, ...env }
@@ -27005,7 +27081,7 @@ function run2(root, executable, args, env = {}) {
27005
27081
  };
27006
27082
  }
27007
27083
 
27008
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/core/logger.ts
27084
+ // packages/workit-core/src/core/logger.ts
27009
27085
  import os4 from "node:os";
27010
27086
  var REDACTED = "[REDACTED]";
27011
27087
  var SECRET_VALUE = /\b(?:Bearer|Basic|Digest|Token)\s+\S+/gi;
@@ -27062,7 +27138,7 @@ var applyPatterns = (value) => {
27062
27138
  };
27063
27139
  var redactSecrets = (value) => applyPatterns(value);
27064
27140
 
27065
- // packages/workit-cursor/node_modules/@brainervirus/workit-mcp/src/server.ts
27141
+ // packages/workit-mcp/src/server.ts
27066
27142
  class McpCapabilityUnavailableError extends Error {
27067
27143
  capability;
27068
27144
  constructor(capability) {
@@ -27358,7 +27434,7 @@ async function runStdioServer(host, contextProvider = defaultContextProvider(hos
27358
27434
  return server;
27359
27435
  }
27360
27436
 
27361
- // packages/workit-cursor/node_modules/@brainervirus/workit-mcp/src/index.ts
27437
+ // packages/workit-mcp/src/index.ts
27362
27438
  var main = async () => {
27363
27439
  const args = process.argv.slice(2);
27364
27440
  const hostIndex = args.indexOf("--host");
@@ -27375,7 +27451,7 @@ var main = async () => {
27375
27451
  var entryPath = process.argv[1] ? path21.resolve(process.argv[1]) : "";
27376
27452
  if (entryPath === path21.resolve(fileURLToPath3(import.meta.url)))
27377
27453
  await main();
27378
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/hooks/descriptor.ts
27454
+ // packages/workit-core/src/hooks/descriptor.ts
27379
27455
  var support = (descriptor, axis) => {
27380
27456
  if (axis.startsWith("event:"))
27381
27457
  return descriptor.events[axis.slice("event:".length)].support;
@@ -27399,14 +27475,14 @@ var capabilitiesFor = (descriptor, observed = {}) => descriptor.capabilities.map
27399
27475
  refs: rule.refs.map((handle) => ({ kind: "host", host: descriptor.host, handle }))
27400
27476
  };
27401
27477
  });
27402
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/hooks/context.ts
27478
+ // packages/workit-core/src/hooks/context.ts
27403
27479
  var signals = new Map;
27404
27480
  var cache = new Map;
27405
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/hooks/write-gate.ts
27481
+ // packages/workit-core/src/hooks/write-gate.ts
27406
27482
  var CASE_INSENSITIVE = process.platform === "darwin" || process.platform === "win32";
27407
- var PREFIXES = new Set(["sudo", "command", "env", "nohup", "time", "exec", "xargs"]);
27483
+ var PREFIXES2 = new Set(["sudo", "command", "env", "nohup", "time", "exec", "xargs"]);
27408
27484
  var cache2 = new Map;
27409
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/hooks/hosts/fields.ts
27485
+ // packages/workit-core/src/hooks/hosts/fields.ts
27410
27486
  var SHELLS = new Set(["sh", "bash", "zsh", "dash", "pwsh", "powershell", "cmd"]);
27411
27487
  var WRITE_TOOLS = new Set([
27412
27488
  "write",
@@ -27427,19 +27503,19 @@ var WRITE_TOOLS = new Set([
27427
27503
  "editfile",
27428
27504
  "writefile"
27429
27505
  ]);
27430
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/hooks/handle.ts
27506
+ // packages/workit-core/src/hooks/handle.ts
27431
27507
  var offered = new Set;
27432
27508
  var CLAUDE_JUDGES = new Set(["workit:verifier", "workit:reviewer"]);
27433
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/hooks/hosts/claude-code.ts
27509
+ // packages/workit-core/src/hooks/hosts/claude-code.ts
27434
27510
  var SOURCES = new Set(["startup", "resume", "clear", "compact", "fork"]);
27435
27511
  var SHELL_TOOLS = new Set(["Bash", "PowerShell"]);
27436
27512
  var CONTEXT_EVENTS = new Set(["SessionStart", "UserPromptSubmit", "SubagentStart"]);
27437
27513
 
27438
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/hooks/hosts/codex.ts
27514
+ // packages/workit-core/src/hooks/hosts/codex.ts
27439
27515
  var SHELL_TOOLS2 = new Set(["bash", "unified-exec"]);
27440
27516
  var SOURCES2 = new Set(["startup", "resume", "clear", "compact"]);
27441
27517
 
27442
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/hooks/hosts/cursor.ts
27518
+ // packages/workit-core/src/hooks/hosts/cursor.ts
27443
27519
  var undocumented = { support: "undocumented", native: null };
27444
27520
  var none = { support: "none", native: null };
27445
27521
  var CURSOR_DESCRIPTOR = {
@@ -27544,7 +27620,7 @@ var CURSOR_DESCRIPTOR = {
27544
27620
  };
27545
27621
  var BLOCKING = new Set(["preToolUse", "beforeShellExecution", "subagentStart"]);
27546
27622
 
27547
- // packages/workit-cursor/node_modules/@brainervirus/workit-core/src/hooks/run.ts
27623
+ // packages/workit-core/src/hooks/run.ts
27548
27624
  if (false) {}
27549
27625
  // packages/workit-cursor/hooks/workit-hook.ts
27550
27626
  var cursorCapabilities = (availability = {}) => capabilitiesFor(CURSOR_DESCRIPTOR, {