@brainervirus/workit-cursor 8.0.1 → 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.
@@ -2,7 +2,7 @@
2
2
  "name": "workit",
3
3
  "displayName": "Workit",
4
4
  "description": "Adaptive Workit workflow with shared MCP tools and native Cursor hooks",
5
- "version": "8.0.1",
5
+ "version": "8.1.1",
6
6
  "author": {
7
7
  "name": "Cristhofer Pincetti"
8
8
  },
@@ -10041,7 +10041,7 @@ var diagnosticLogger, PRESETS, mergePreset = (preset, input = {}, current = {
10041
10041
  if (!migrationFailed)
10042
10042
  migratedDir = dir;
10043
10043
  return dir;
10044
- }, configDir = () => ensureConfigDir(), LOCALE_RE, DEFAULTS, readSafe = (p) => {
10044
+ }, configDir = () => ensureConfigDir(), LOCALE_RE, DEFAULTS, unchosenBranchPolicy, readSafe = (p) => {
10045
10045
  try {
10046
10046
  return readFileSync(p, "utf8");
10047
10047
  } catch {
@@ -10063,22 +10063,21 @@ var diagnosticLogger, PRESETS, mergePreset = (preset, input = {}, current = {
10063
10063
  const locale = LOCALE_RE.test(String(input.locale ?? "")) ? input.locale : DEFAULTS.locale;
10064
10064
  const preset = Object.hasOwn(PRESETS, input.branchPolicy?.preset) ? input.branchPolicy?.preset : "gitflow";
10065
10065
  const commitPreset = COMMIT_PRESETS.includes(String(input.commitPolicy?.preset ?? "")) ? input.commitPolicy?.preset : "conventional";
10066
- return {
10067
- status: "valid",
10068
- path: file,
10069
- config: {
10070
- locale,
10071
- localeOptions: Array.isArray(input.localeOptions) ? input.localeOptions : DEFAULTS.localeOptions,
10072
- branchPolicy: mergePreset(preset, {
10073
- allowed: Array.isArray(input.branchPolicy?.allowed) ? input.branchPolicy.allowed : undefined,
10074
- protectedNames: Array.isArray(input.branchPolicy?.protected) ? input.branchPolicy.protected : undefined
10075
- }, DEFAULTS),
10076
- commitPolicy: {
10077
- preset: commitPreset,
10078
- ...typeof input.commitPolicy?.pattern === "string" ? { pattern: input.commitPolicy.pattern } : {}
10079
- }
10066
+ const config = {
10067
+ locale,
10068
+ localeOptions: Array.isArray(input.localeOptions) ? input.localeOptions : DEFAULTS.localeOptions,
10069
+ branchPolicy: mergePreset(preset, {
10070
+ allowed: Array.isArray(input.branchPolicy?.allowed) ? input.branchPolicy.allowed : undefined,
10071
+ protectedNames: Array.isArray(input.branchPolicy?.protected) ? input.branchPolicy.protected : undefined
10072
+ }, DEFAULTS),
10073
+ commitPolicy: {
10074
+ preset: commitPreset,
10075
+ ...typeof input.commitPolicy?.pattern === "string" ? { pattern: input.commitPolicy.pattern } : {}
10080
10076
  }
10081
10077
  };
10078
+ if (!Object.hasOwn(PRESETS, input.branchPolicy?.preset))
10079
+ unchosenBranchPolicy.add(config);
10080
+ return { status: "valid", path: file, config };
10082
10081
  }, readConfigTyped = (dir) => {
10083
10082
  const file = path5.join(dir ?? configDir(), "config.json");
10084
10083
  return parseConfigResult(readSafe(file), file);
@@ -10087,9 +10086,11 @@ var diagnosticLogger, PRESETS, mergePreset = (preset, input = {}, current = {
10087
10086
  if (result.status === "malformed")
10088
10087
  throw new Error(result.error);
10089
10088
  return result.config ?? DEFAULTS;
10090
- }, branchGlobPattern = (glob) => new RegExp(`^${glob.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*")}$`, "i"), resolveBranchPolicy = (config, workspace) => {
10089
+ }, branchGlobPattern = (glob) => new RegExp(`^${glob.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*")}$`, "i"), resolveBranchPolicy = (config, workspace, repoPreset) => {
10091
10090
  const wp = workspace?.branchPolicy ?? {};
10092
- const preset = Object.hasOwn(PRESETS, wp.preset) ? wp.preset : config.branchPolicy?.preset ?? "gitflow";
10091
+ const workspacePreset = Object.hasOwn(PRESETS, wp.preset);
10092
+ const detected = !workspacePreset && unchosenBranchPolicy.has(config) ? repoPreset?.() ?? null : null;
10093
+ const preset = workspacePreset ? wp.preset : detected ?? config.branchPolicy?.preset ?? "gitflow";
10093
10094
  const merged = mergePreset(preset, {
10094
10095
  allowed: wp.allowed,
10095
10096
  protectedNames: wp.protected
@@ -10098,9 +10099,10 @@ var diagnosticLogger, PRESETS, mergePreset = (preset, input = {}, current = {
10098
10099
  return {
10099
10100
  preset,
10100
10101
  allowed,
10101
- protected: new Set(merged.protected.map((p) => p.toLowerCase())),
10102
+ protected: new Set([...merged.protected, ...detected ? PRESETS.gitflow.protected : []].map((p) => p.toLowerCase())),
10102
10103
  integration: wp.integration === "merge" ? "merge" : "pr",
10103
- defaultTargetBranch: preset === "github-flow" ? "main" : preset === "trunk-based" ? "master" : "develop"
10104
+ defaultTargetBranch: preset === "github-flow" ? "main" : preset === "trunk-based" ? "master" : "develop",
10105
+ detected: detected !== null
10104
10106
  };
10105
10107
  }, COMMIT_PRESETS, resolveCommitPolicy = (config, workspace) => {
10106
10108
  const wp = workspace?.commitPolicy ?? {};
@@ -10134,6 +10136,7 @@ var init_config = __esm(() => {
10134
10136
  },
10135
10137
  commitPolicy: { preset: "conventional" }
10136
10138
  };
10139
+ unchosenBranchPolicy = new WeakSet([DEFAULTS]);
10137
10140
  COMMIT_PRESETS = [
10138
10141
  "conventional",
10139
10142
  "gitmoji",
@@ -10147,7 +10150,74 @@ var init_config = __esm(() => {
10147
10150
  // packages/workit-core/src/core/safe-write.ts
10148
10151
  var init_safe_write = () => {};
10149
10152
 
10153
+ // packages/workit-core/src/core/branch-policy.ts
10154
+ import { spawnSync as spawnSync4 } from "node:child_process";
10155
+ var PREFIXES, branchNames = (workspaceRoot) => {
10156
+ const r = spawnSync4("git", ["for-each-ref", "--format=%(refname)", "refs/heads", "refs/remotes/origin"], { cwd: workspaceRoot, encoding: "utf8" });
10157
+ if (r.status !== 0)
10158
+ return new Set;
10159
+ return new Set((r.stdout ?? "").split(`
10160
+ `).filter(Boolean).map((ref) => ref.startsWith("refs/heads/") ? ref.slice("refs/heads/".length) : ref.slice("refs/remotes/origin/".length)));
10161
+ }, detectBranchPolicy = (workspaceRoot) => {
10162
+ const names = branchNames(workspaceRoot);
10163
+ const develop = names.has("develop");
10164
+ const main = names.has("main");
10165
+ const master = names.has("master");
10166
+ const root = main ? "main" : master ? "master" : null;
10167
+ if (develop) {
10168
+ return {
10169
+ preset: "gitflow",
10170
+ developBranch: "develop",
10171
+ integration: "merge",
10172
+ protected: root ? [root, "develop"] : ["develop"],
10173
+ allowed: [...PRESETS.gitflow.allowed],
10174
+ prefixes: PREFIXES
10175
+ };
10176
+ }
10177
+ if (root === "main") {
10178
+ return {
10179
+ preset: "github-flow",
10180
+ developBranch: null,
10181
+ integration: "pr",
10182
+ protected: [root],
10183
+ allowed: ["*"],
10184
+ prefixes: PREFIXES
10185
+ };
10186
+ }
10187
+ if (root === "master") {
10188
+ return {
10189
+ preset: "trunk-based",
10190
+ developBranch: null,
10191
+ integration: "pr",
10192
+ protected: [root],
10193
+ allowed: ["*"],
10194
+ prefixes: PREFIXES
10195
+ };
10196
+ }
10197
+ return {
10198
+ preset: "gitflow",
10199
+ developBranch: null,
10200
+ integration: "merge",
10201
+ protected: [],
10202
+ allowed: [],
10203
+ prefixes: PREFIXES
10204
+ };
10205
+ }, repoBranchPreset = (workspaceRoot) => {
10206
+ const detected = detectBranchPolicy(workspaceRoot);
10207
+ return detected.developBranch || detected.allowed.length ? detected.preset : null;
10208
+ };
10209
+ var init_branch_policy = __esm(() => {
10210
+ init_config();
10211
+ PREFIXES = {
10212
+ feature: "feature/*",
10213
+ bugfix: "bugfix/*",
10214
+ release: "release/*",
10215
+ hotfix: "hotfix/*"
10216
+ };
10217
+ });
10218
+
10150
10219
  // packages/workit-core/src/core/workspaces.ts
10220
+ import { spawnSync as spawnSync5 } from "node:child_process";
10151
10221
  import { createHash as createHash5 } from "node:crypto";
10152
10222
  import { readFileSync as readFileSync2, realpathSync } from "node:fs";
10153
10223
  import path6 from "node:path";
@@ -10267,6 +10337,46 @@ var nonBlank, branchPreset, commitPreset, workspaceBranchPolicySchema, workspace
10267
10337
  };
10268
10338
  }
10269
10339
  return { ok: true };
10340
+ }, WorkspaceConfigError, mainCheckouts, mainCheckoutOf = (cwd) => {
10341
+ const cached = mainCheckouts.get(cwd);
10342
+ if (cached !== undefined)
10343
+ return cached;
10344
+ const env = { ...process.env };
10345
+ for (const name of ["GIT_DIR", "GIT_WORK_TREE", "GIT_COMMON_DIR", "GIT_INDEX_FILE"])
10346
+ delete env[name];
10347
+ const git = (args) => {
10348
+ const run = spawnSync5("git", args, {
10349
+ cwd,
10350
+ env,
10351
+ encoding: "utf8",
10352
+ timeout: 5000,
10353
+ windowsHide: true
10354
+ });
10355
+ return run.status === 0 ? run.stdout : null;
10356
+ };
10357
+ let main = null;
10358
+ const dirs = git(["rev-parse", "--path-format=absolute", "--git-dir", "--git-common-dir"]);
10359
+ const [gitDir, common] = (dirs ?? "").trim().split(/\r?\n/u);
10360
+ if (gitDir && common && path6.resolve(gitDir) !== path6.resolve(common)) {
10361
+ const listed = /^worktree (.+)$/mu.exec(git(["worktree", "list", "--porcelain"]) ?? "")?.[1];
10362
+ main = listed?.trim() || (path6.basename(common) === ".git" ? path6.dirname(common) : common);
10363
+ }
10364
+ mainCheckouts.set(cwd, main);
10365
+ return main;
10366
+ }, matchingEntries = (cwd, entries) => {
10367
+ const match = (where) => {
10368
+ const targets = [where, realpathOf(where)].map((value) => value.replaceAll("\\", "/"));
10369
+ return entries.filter((entry) => {
10370
+ const glob = entry.glob.replaceAll("\\", "/");
10371
+ const canonical = canonicalGlob(glob);
10372
+ return targets.some((target) => matchWorkspace(glob, target) || canonical !== glob && matchWorkspace(canonical, target));
10373
+ });
10374
+ };
10375
+ const direct = match(cwd);
10376
+ if (direct.length)
10377
+ return direct;
10378
+ const main = mainCheckoutOf(cwd);
10379
+ return main ? match(main) : direct;
10270
10380
  }, realpathOf = (p) => {
10271
10381
  const real = realpathSync.native ?? realpathSync;
10272
10382
  try {
@@ -10288,41 +10398,27 @@ var nonBlank, branchPreset, commitPreset, workspaceBranchPolicySchema, workspace
10288
10398
  if (named.length === 1)
10289
10399
  return named[0];
10290
10400
  if (named.length > 1)
10291
- throw new Error(`ambiguous workspace ${JSON.stringify(workspaceName)} for ${cwd}`);
10401
+ throw new WorkspaceConfigError(`ambiguous workspace ${JSON.stringify(workspaceName)} for ${cwd}`);
10292
10402
  if (matches.length > 0) {
10293
- throw new Error(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}; matching choices: ${matches.map((entry) => entry.name).join(", ")}`);
10403
+ throw new WorkspaceConfigError(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}; matching choices: ${matches.map((entry) => entry.name).join(", ")}`);
10294
10404
  }
10295
- throw new Error(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}`);
10405
+ throw new WorkspaceConfigError(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}`);
10296
10406
  }
10297
10407
  if (matches.length < 2)
10298
10408
  return matches[0];
10299
10409
  const highestSpecificity = Math.max(...matches.map((entry) => globSpecificity(entry.glob)));
10300
10410
  const mostSpecific = matches.filter((entry) => globSpecificity(entry.glob) === highestSpecificity);
10301
10411
  if (mostSpecific.length > 1) {
10302
- throw new Error(`ambiguous workspace for ${cwd}; choose one of: ${mostSpecific.map((entry) => entry.name).join(", ")}`);
10412
+ throw new WorkspaceConfigError(`ambiguous workspace for ${cwd}; choose one of: ${mostSpecific.map((entry) => entry.name).join(", ")}`);
10303
10413
  }
10304
10414
  return mostSpecific[0];
10305
10415
  }, resolveWorkspaceFromEntries = (cwd, entries, workspaceName) => {
10306
- const targets = [cwd, realpathOf(cwd)].map((p) => p.replaceAll("\\", "/"));
10307
- const matches = [];
10308
- for (const ws of entries) {
10309
- const glob = ws.glob.replaceAll("\\", "/");
10310
- const canonical = canonicalGlob(glob);
10311
- let matched = false;
10312
- for (const target of targets) {
10313
- if (matchWorkspace(glob, target) || canonical !== glob && matchWorkspace(canonical, target)) {
10314
- matched = true;
10315
- break;
10316
- }
10317
- }
10318
- if (matched)
10319
- matches.push(ws);
10320
- }
10416
+ const matches = matchingEntries(cwd, entries);
10321
10417
  return selectWorkspaceMatch(matches, cwd, workspaceName) ?? null;
10322
10418
  }, resolveWorkspaceFrom = (cwd, dir, workspaceName) => {
10323
10419
  const result = readWorkspacesResult(dir);
10324
10420
  if (result.status === "malformed" || result.status === "invalid")
10325
- throw new Error(result.error);
10421
+ throw new WorkspaceConfigError(result.error);
10326
10422
  return resolveWorkspaceFromEntries(cwd, result.entries, workspaceName);
10327
10423
  }, runtimeWorkspacePolicySchema = (kind) => {
10328
10424
  const key = kind === "branch" ? "branchPolicy" : kind === "commit" ? "commitPolicy" : "vcs";
@@ -10348,31 +10444,26 @@ var nonBlank, branchPreset, commitPreset, workspaceBranchPolicySchema, workspace
10348
10444
  } catch (error) {
10349
10445
  if (error.code === "ENOENT")
10350
10446
  return null;
10351
- throw new Error(`${file} could not be read: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
10447
+ throw new WorkspaceConfigError(`${file} could not be read: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
10352
10448
  }
10353
10449
  let parsed;
10354
10450
  try {
10355
10451
  parsed = JSON.parse(raw);
10356
10452
  } catch {
10357
- throw new Error(`${file} is not valid JSON`);
10453
+ throw new WorkspaceConfigError(`${file} is not valid JSON`);
10358
10454
  }
10359
10455
  const validated = runtimeWorkspaceIndexSchema.safeParse(parsed);
10360
10456
  if (!validated.success) {
10361
10457
  const detail = validated.error.issues.map((issue) => `${issue.path.map(String).join(".") || "workspaces"}: ${issue.message}`).join("; ");
10362
- throw new Error(`${file} has invalid workspace matching data: ${detail}`);
10458
+ throw new WorkspaceConfigError(`${file} has invalid workspace matching data: ${detail}`);
10363
10459
  }
10364
10460
  const entries = validated.data.workspaces;
10365
10461
  for (const entry of entries ?? []) {
10366
10462
  const glob = validateWorkspaceGlob(entry.glob);
10367
10463
  if (!glob.ok)
10368
- throw new Error(`${file} workspace ${entry.name}: ${glob.error}`);
10464
+ throw new WorkspaceConfigError(`${file} workspace ${entry.name}: ${glob.error}`);
10369
10465
  }
10370
- const targets = [cwd, realpathOf(cwd)].map((value) => value.replaceAll("\\", "/"));
10371
- const matches = (entries ?? []).filter((entry) => {
10372
- const glob = entry.glob.replaceAll("\\", "/");
10373
- const canonical = canonicalGlob(glob);
10374
- return targets.some((target) => matchWorkspace(glob, target) || canonical !== glob && matchWorkspace(canonical, target));
10375
- });
10466
+ const matches = matchingEntries(cwd, entries ?? []);
10376
10467
  const workspaceName = process.env.WORKFLOW_WORKSPACE_NAME?.trim() || undefined;
10377
10468
  const selected = selectWorkspaceMatch(matches, cwd, workspaceName);
10378
10469
  return selected ? { file, selected } : null;
@@ -10387,7 +10478,7 @@ var nonBlank, branchPreset, commitPreset, workspaceBranchPolicySchema, workspace
10387
10478
  const policy = runtimeWorkspacePolicySchema(kind).safeParse(selected);
10388
10479
  if (!policy.success) {
10389
10480
  const detail = policy.error.issues.map((issue) => `${issue.path.map(String).join(".") || "workspace"}: ${issue.message}`).join("; ");
10390
- throw new Error(`${file} has invalid ${kind} policy configuration: ${detail}`);
10481
+ throw new WorkspaceConfigError(`${file} has invalid ${kind} policy configuration: ${detail}`);
10391
10482
  }
10392
10483
  return policy.data;
10393
10484
  }, resolveRuntimeWorkspacePolicy = (cwd, kind, requestedProfile) => {
@@ -10397,10 +10488,10 @@ var nonBlank, branchPreset, commitPreset, workspaceBranchPolicySchema, workspace
10397
10488
  const key = kind === "branch" ? "branchPolicy" : "commitPolicy";
10398
10489
  const profileName = requestedProfile?.trim() || candidate.defaultProfile;
10399
10490
  if (candidate.defaultProfile && !Object.hasOwn(candidate.profiles ?? {}, candidate.defaultProfile))
10400
- throw new Error(`workspace ${JSON.stringify(candidate.name)} has no profile ${JSON.stringify(candidate.defaultProfile)}`);
10491
+ throw new WorkspaceConfigError(`workspace ${JSON.stringify(candidate.name)} has no profile ${JSON.stringify(candidate.defaultProfile)}`);
10401
10492
  const profile = profileName ? candidate.profiles?.[profileName] : undefined;
10402
10493
  if (profileName && !profile)
10403
- throw new Error(`workspace ${JSON.stringify(candidate.name)} has no profile ${JSON.stringify(profileName)}`);
10494
+ throw new WorkspaceConfigError(`workspace ${JSON.stringify(candidate.name)} has no profile ${JSON.stringify(profileName)}`);
10404
10495
  const profilePolicy = profile?.[key];
10405
10496
  const workspacePolicy = candidate[key];
10406
10497
  return {
@@ -10411,6 +10502,7 @@ var nonBlank, branchPreset, commitPreset, workspaceBranchPolicySchema, workspace
10411
10502
  var init_workspaces = __esm(() => {
10412
10503
  init_zod();
10413
10504
  init_config();
10505
+ init_branch_policy();
10414
10506
  nonBlank = string2().refine((value) => value.trim().length > 0, "must not be blank");
10415
10507
  branchPreset = custom((value) => typeof value === "string" && Object.hasOwn(PRESETS, value), "unsupported branch preset");
10416
10508
  commitPreset = custom((value) => typeof value === "string" && COMMIT_PRESETS.includes(value), "unsupported commit preset");
@@ -10530,6 +10622,10 @@ var init_workspaces = __esm(() => {
10530
10622
  });
10531
10623
  UNSUPPORTED_GLOB = /[?[\]{}]/;
10532
10624
  UNSUPPORTED_EXTGLOB = /[@+*]\(|!/;
10625
+ WorkspaceConfigError = class WorkspaceConfigError extends Error {
10626
+ name = "WorkspaceConfigError";
10627
+ };
10628
+ mainCheckouts = new Map;
10533
10629
  runtimeWorkspaceIndexSchema = object({
10534
10630
  workspaces: array(object({ name: nonBlank, glob: nonBlank }).passthrough()).optional()
10535
10631
  }).passthrough();
@@ -11308,7 +11404,7 @@ var packageRoot = () => {
11308
11404
  var init_package_root = () => {};
11309
11405
 
11310
11406
  // packages/workit-core/src/core/store-lock.ts
11311
- import { spawnSync as spawnSync4 } from "node:child_process";
11407
+ import { spawnSync as spawnSync6 } from "node:child_process";
11312
11408
  import fs7 from "node:fs";
11313
11409
  import { hostname } from "node:os";
11314
11410
  var metadataLockSchema, FOREIGN_LOCK_TTL_MS, UNREADABLE_LOCK_TTL_MS = 30000, RECLAIM_GUARD_TTL_MS = 30000, defaultLockTimeoutMs = 250, defaultLockTimeout = () => defaultLockTimeoutMs, parseMetadataLock = (raw) => {
@@ -11343,7 +11439,7 @@ var metadataLockSchema, FOREIGN_LOCK_TTL_MS, UNREADABLE_LOCK_TTL_MS = 30000, REC
11343
11439
  }
11344
11440
  if (process.platform === "darwin" || process.platform === "freebsd") {
11345
11441
  try {
11346
- const run = spawnSync4("ps", ["-o", "lstart=", "-p", String(pid)], {
11442
+ const run = spawnSync6("ps", ["-o", "lstart=", "-p", String(pid)], {
11347
11443
  encoding: "utf8",
11348
11444
  timeout: 1000
11349
11445
  });
@@ -13465,7 +13561,7 @@ var init_workers = __esm(() => {
13465
13561
  });
13466
13562
 
13467
13563
  // packages/workit-core/src/check-config.ts
13468
- import { spawnSync as spawnSync5 } from "node:child_process";
13564
+ import { spawnSync as spawnSync7 } from "node:child_process";
13469
13565
  import fs10 from "node:fs";
13470
13566
  import path13 from "node:path";
13471
13567
  function splitCommand(command) {
@@ -13633,7 +13729,7 @@ function checkCommand(args, version, onPath = workitAvailable()) {
13633
13729
  return onPath ? `workit check ${args}` : `npx -y @brainervirus/workit-cli@${version} check ${args}`;
13634
13730
  }
13635
13731
  var SCRIPT_CHECKS, CHECKS_FILE = "workit.checks.json", isRecord2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), SHELL_META, git3 = (cwd, args) => {
13636
- const run = spawnSync5("git", args, {
13732
+ const run = spawnSync7("git", args, {
13637
13733
  cwd,
13638
13734
  encoding: "utf8",
13639
13735
  timeout: 20000,
@@ -13668,7 +13764,7 @@ var init_check_config = __esm(() => {
13668
13764
  // packages/workit-core/src/core/task-evaluation.ts
13669
13765
  import { createHash as createHash8 } from "node:crypto";
13670
13766
  import * as fs11 from "node:fs";
13671
- import { spawnSync as spawnSync6 } from "node:child_process";
13767
+ import { spawnSync as spawnSync8 } from "node:child_process";
13672
13768
  import path14 from "node:path";
13673
13769
  function captureCandidate(root, scope, environment = []) {
13674
13770
  let checkout;
@@ -13746,7 +13842,7 @@ function captureCandidate(root, scope, environment = []) {
13746
13842
  const values = supplied.toSorted((left, right) => compareCodeUnits3(left.name, right.name)).map(({ name, value }) => ({ name, value, refs: [] }));
13747
13843
  if (values.some(({ value }) => value === null))
13748
13844
  completeness = "uncertain";
13749
- const headResult = spawnSync6("git", ["rev-parse", "HEAD"], { cwd: checkout, encoding: "utf8" });
13845
+ const headResult = spawnSync8("git", ["rev-parse", "HEAD"], { cwd: checkout, encoding: "utf8" });
13750
13846
  if (headResult.status !== 0 && !/not a git repository/i.test(headResult.stderr ?? ""))
13751
13847
  completeness = "uncertain";
13752
13848
  const head = headResult.status === 0 ? headResult.stdout.trim() : null;
@@ -14119,7 +14215,7 @@ var digestBytes = (value) => createHash8("sha256").update(value).digest("hex"),
14119
14215
  }
14120
14216
  return left.length - right.length;
14121
14217
  }, gitPaths = (root) => {
14122
- const result = spawnSync6("git", ["ls-files", "-z", "--cached", "--others", "--exclude-standard"], {
14218
+ const result = spawnSync8("git", ["ls-files", "-z", "--cached", "--others", "--exclude-standard"], {
14123
14219
  cwd: root,
14124
14220
  encoding: "buffer"
14125
14221
  });
@@ -14132,7 +14228,7 @@ var digestBytes = (value) => createHash8("sha256").update(value).digest("hex"),
14132
14228
  };
14133
14229
  }
14134
14230
  const paths = result.stdout ? result.stdout.toString("utf8").split("\x00").filter(Boolean).map((item) => item.split(path14.sep).join("/")) : [];
14135
- const stagedDeleted = spawnSync6("git", ["diff", "--cached", "--name-only", "--diff-filter=D", "-z"], { cwd: root, encoding: "buffer" });
14231
+ const stagedDeleted = spawnSync8("git", ["diff", "--cached", "--name-only", "--diff-filter=D", "-z"], { cwd: root, encoding: "buffer" });
14136
14232
  if (stagedDeleted.status !== 0) {
14137
14233
  const stderr = stagedDeleted.stderr?.toString("utf8") ?? "";
14138
14234
  if (!/not a git repository/i.test(stderr))
@@ -16441,7 +16537,7 @@ function effectiveWorkspacePolicy(workspaceRoot, kind, profileName) {
16441
16537
  const selected = resolveRuntimeWorkspacePolicy(workspaceRoot, kind, profileName?.trim() || process.env.WORKFLOW_PROFILE?.trim() || undefined);
16442
16538
  const config = readConfig();
16443
16539
  return kind === "branch" ? {
16444
- branchPolicy: withReleaseTracks(workspaceRoot, resolveBranchPolicy(config, selected.policy ? { branchPolicy: selected.policy } : null)),
16540
+ branchPolicy: withReleaseTracks(workspaceRoot, resolveBranchPolicy(config, selected.policy ? { branchPolicy: selected.policy } : null, () => repoBranchPreset(workspaceRoot))),
16445
16541
  provenance: { branchPolicy: selected.source }
16446
16542
  } : {
16447
16543
  commitPolicy: resolveCommitPolicy(config, selected.policy ? { commitPolicy: selected.policy } : null),
@@ -16526,6 +16622,7 @@ var withReleaseTracks = (workspaceRoot, policy) => {
16526
16622
  }
16527
16623
  };
16528
16624
  var init_branch = __esm(() => {
16625
+ init_branch_policy();
16529
16626
  init_commit_flavors();
16530
16627
  init_git();
16531
16628
  init_config();
@@ -16685,9 +16782,9 @@ var NONE2, CASE_INSENSITIVE, canonical2 = (file) => {
16685
16782
  }
16686
16783
  flushSegment();
16687
16784
  return segments;
16688
- }, PREFIXES, operands = (words) => words.filter((item) => !item.startsWith("-")), editsOf = (input) => {
16785
+ }, PREFIXES2, operands = (words) => words.filter((item) => !item.startsWith("-")), editsOf = (input) => {
16689
16786
  let words = input;
16690
- while (words.length && (PREFIXES.has(words[0]) || /^\w+=/.test(words[0])))
16787
+ while (words.length && (PREFIXES2.has(words[0]) || /^\w+=/.test(words[0])))
16691
16788
  words = words.slice(1);
16692
16789
  const [verb, ...args] = words;
16693
16790
  const name = (verb?.split(/[\\/]/).at(-1) ?? "").toLowerCase();
@@ -16818,7 +16915,7 @@ var init_write_gate = __esm(() => {
16818
16915
  init_ledger();
16819
16916
  NONE2 = { kind: "none" };
16820
16917
  CASE_INSENSITIVE = process.platform === "darwin" || process.platform === "win32";
16821
- PREFIXES = new Set(["sudo", "command", "env", "nohup", "time", "exec", "xargs"]);
16918
+ PREFIXES2 = new Set(["sudo", "command", "env", "nohup", "time", "exec", "xargs"]);
16822
16919
  cache2 = new Map;
16823
16920
  });
16824
16921