@brainervirus/workit-cursor 8.1.0 → 8.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cursor-plugin/plugin.json +1 -1
- package/dist/cursor-session-start.js +67 -41
- package/dist/mcp-server.js +78 -49
- package/dist/workit-hook.js +70 -41
- package/package.json +3 -3
|
@@ -10217,6 +10217,7 @@ var init_branch_policy = __esm(() => {
|
|
|
10217
10217
|
});
|
|
10218
10218
|
|
|
10219
10219
|
// packages/workit-core/src/core/workspaces.ts
|
|
10220
|
+
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
10220
10221
|
import { createHash as createHash5 } from "node:crypto";
|
|
10221
10222
|
import { readFileSync as readFileSync2, realpathSync } from "node:fs";
|
|
10222
10223
|
import path6 from "node:path";
|
|
@@ -10336,6 +10337,46 @@ var nonBlank, branchPreset, commitPreset, workspaceBranchPolicySchema, workspace
|
|
|
10336
10337
|
};
|
|
10337
10338
|
}
|
|
10338
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;
|
|
10339
10380
|
}, realpathOf = (p) => {
|
|
10340
10381
|
const real = realpathSync.native ?? realpathSync;
|
|
10341
10382
|
try {
|
|
@@ -10357,41 +10398,27 @@ var nonBlank, branchPreset, commitPreset, workspaceBranchPolicySchema, workspace
|
|
|
10357
10398
|
if (named.length === 1)
|
|
10358
10399
|
return named[0];
|
|
10359
10400
|
if (named.length > 1)
|
|
10360
|
-
throw new
|
|
10401
|
+
throw new WorkspaceConfigError(`ambiguous workspace ${JSON.stringify(workspaceName)} for ${cwd}`);
|
|
10361
10402
|
if (matches.length > 0) {
|
|
10362
|
-
throw new
|
|
10403
|
+
throw new WorkspaceConfigError(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}; matching choices: ${matches.map((entry) => entry.name).join(", ")}`);
|
|
10363
10404
|
}
|
|
10364
|
-
throw new
|
|
10405
|
+
throw new WorkspaceConfigError(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}`);
|
|
10365
10406
|
}
|
|
10366
10407
|
if (matches.length < 2)
|
|
10367
10408
|
return matches[0];
|
|
10368
10409
|
const highestSpecificity = Math.max(...matches.map((entry) => globSpecificity(entry.glob)));
|
|
10369
10410
|
const mostSpecific = matches.filter((entry) => globSpecificity(entry.glob) === highestSpecificity);
|
|
10370
10411
|
if (mostSpecific.length > 1) {
|
|
10371
|
-
throw new
|
|
10412
|
+
throw new WorkspaceConfigError(`ambiguous workspace for ${cwd}; choose one of: ${mostSpecific.map((entry) => entry.name).join(", ")}`);
|
|
10372
10413
|
}
|
|
10373
10414
|
return mostSpecific[0];
|
|
10374
10415
|
}, resolveWorkspaceFromEntries = (cwd, entries, workspaceName) => {
|
|
10375
|
-
const
|
|
10376
|
-
const matches = [];
|
|
10377
|
-
for (const ws of entries) {
|
|
10378
|
-
const glob = ws.glob.replaceAll("\\", "/");
|
|
10379
|
-
const canonical = canonicalGlob(glob);
|
|
10380
|
-
let matched = false;
|
|
10381
|
-
for (const target of targets) {
|
|
10382
|
-
if (matchWorkspace(glob, target) || canonical !== glob && matchWorkspace(canonical, target)) {
|
|
10383
|
-
matched = true;
|
|
10384
|
-
break;
|
|
10385
|
-
}
|
|
10386
|
-
}
|
|
10387
|
-
if (matched)
|
|
10388
|
-
matches.push(ws);
|
|
10389
|
-
}
|
|
10416
|
+
const matches = matchingEntries(cwd, entries);
|
|
10390
10417
|
return selectWorkspaceMatch(matches, cwd, workspaceName) ?? null;
|
|
10391
10418
|
}, resolveWorkspaceFrom = (cwd, dir, workspaceName) => {
|
|
10392
10419
|
const result = readWorkspacesResult(dir);
|
|
10393
10420
|
if (result.status === "malformed" || result.status === "invalid")
|
|
10394
|
-
throw new
|
|
10421
|
+
throw new WorkspaceConfigError(result.error);
|
|
10395
10422
|
return resolveWorkspaceFromEntries(cwd, result.entries, workspaceName);
|
|
10396
10423
|
}, runtimeWorkspacePolicySchema = (kind) => {
|
|
10397
10424
|
const key = kind === "branch" ? "branchPolicy" : kind === "commit" ? "commitPolicy" : "vcs";
|
|
@@ -10417,31 +10444,26 @@ var nonBlank, branchPreset, commitPreset, workspaceBranchPolicySchema, workspace
|
|
|
10417
10444
|
} catch (error) {
|
|
10418
10445
|
if (error.code === "ENOENT")
|
|
10419
10446
|
return null;
|
|
10420
|
-
throw new
|
|
10447
|
+
throw new WorkspaceConfigError(`${file} could not be read: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
10421
10448
|
}
|
|
10422
10449
|
let parsed;
|
|
10423
10450
|
try {
|
|
10424
10451
|
parsed = JSON.parse(raw);
|
|
10425
10452
|
} catch {
|
|
10426
|
-
throw new
|
|
10453
|
+
throw new WorkspaceConfigError(`${file} is not valid JSON`);
|
|
10427
10454
|
}
|
|
10428
10455
|
const validated = runtimeWorkspaceIndexSchema.safeParse(parsed);
|
|
10429
10456
|
if (!validated.success) {
|
|
10430
10457
|
const detail = validated.error.issues.map((issue) => `${issue.path.map(String).join(".") || "workspaces"}: ${issue.message}`).join("; ");
|
|
10431
|
-
throw new
|
|
10458
|
+
throw new WorkspaceConfigError(`${file} has invalid workspace matching data: ${detail}`);
|
|
10432
10459
|
}
|
|
10433
10460
|
const entries = validated.data.workspaces;
|
|
10434
10461
|
for (const entry of entries ?? []) {
|
|
10435
10462
|
const glob = validateWorkspaceGlob(entry.glob);
|
|
10436
10463
|
if (!glob.ok)
|
|
10437
|
-
throw new
|
|
10464
|
+
throw new WorkspaceConfigError(`${file} workspace ${entry.name}: ${glob.error}`);
|
|
10438
10465
|
}
|
|
10439
|
-
const
|
|
10440
|
-
const matches = (entries ?? []).filter((entry) => {
|
|
10441
|
-
const glob = entry.glob.replaceAll("\\", "/");
|
|
10442
|
-
const canonical = canonicalGlob(glob);
|
|
10443
|
-
return targets.some((target) => matchWorkspace(glob, target) || canonical !== glob && matchWorkspace(canonical, target));
|
|
10444
|
-
});
|
|
10466
|
+
const matches = matchingEntries(cwd, entries ?? []);
|
|
10445
10467
|
const workspaceName = process.env.WORKFLOW_WORKSPACE_NAME?.trim() || undefined;
|
|
10446
10468
|
const selected = selectWorkspaceMatch(matches, cwd, workspaceName);
|
|
10447
10469
|
return selected ? { file, selected } : null;
|
|
@@ -10456,7 +10478,7 @@ var nonBlank, branchPreset, commitPreset, workspaceBranchPolicySchema, workspace
|
|
|
10456
10478
|
const policy = runtimeWorkspacePolicySchema(kind).safeParse(selected);
|
|
10457
10479
|
if (!policy.success) {
|
|
10458
10480
|
const detail = policy.error.issues.map((issue) => `${issue.path.map(String).join(".") || "workspace"}: ${issue.message}`).join("; ");
|
|
10459
|
-
throw new
|
|
10481
|
+
throw new WorkspaceConfigError(`${file} has invalid ${kind} policy configuration: ${detail}`);
|
|
10460
10482
|
}
|
|
10461
10483
|
return policy.data;
|
|
10462
10484
|
}, resolveRuntimeWorkspacePolicy = (cwd, kind, requestedProfile) => {
|
|
@@ -10466,10 +10488,10 @@ var nonBlank, branchPreset, commitPreset, workspaceBranchPolicySchema, workspace
|
|
|
10466
10488
|
const key = kind === "branch" ? "branchPolicy" : "commitPolicy";
|
|
10467
10489
|
const profileName = requestedProfile?.trim() || candidate.defaultProfile;
|
|
10468
10490
|
if (candidate.defaultProfile && !Object.hasOwn(candidate.profiles ?? {}, candidate.defaultProfile))
|
|
10469
|
-
throw new
|
|
10491
|
+
throw new WorkspaceConfigError(`workspace ${JSON.stringify(candidate.name)} has no profile ${JSON.stringify(candidate.defaultProfile)}`);
|
|
10470
10492
|
const profile = profileName ? candidate.profiles?.[profileName] : undefined;
|
|
10471
10493
|
if (profileName && !profile)
|
|
10472
|
-
throw new
|
|
10494
|
+
throw new WorkspaceConfigError(`workspace ${JSON.stringify(candidate.name)} has no profile ${JSON.stringify(profileName)}`);
|
|
10473
10495
|
const profilePolicy = profile?.[key];
|
|
10474
10496
|
const workspacePolicy = candidate[key];
|
|
10475
10497
|
return {
|
|
@@ -10600,6 +10622,10 @@ var init_workspaces = __esm(() => {
|
|
|
10600
10622
|
});
|
|
10601
10623
|
UNSUPPORTED_GLOB = /[?[\]{}]/;
|
|
10602
10624
|
UNSUPPORTED_EXTGLOB = /[@+*]\(|!/;
|
|
10625
|
+
WorkspaceConfigError = class WorkspaceConfigError extends Error {
|
|
10626
|
+
name = "WorkspaceConfigError";
|
|
10627
|
+
};
|
|
10628
|
+
mainCheckouts = new Map;
|
|
10603
10629
|
runtimeWorkspaceIndexSchema = object({
|
|
10604
10630
|
workspaces: array(object({ name: nonBlank, glob: nonBlank }).passthrough()).optional()
|
|
10605
10631
|
}).passthrough();
|
|
@@ -11378,7 +11404,7 @@ var packageRoot = () => {
|
|
|
11378
11404
|
var init_package_root = () => {};
|
|
11379
11405
|
|
|
11380
11406
|
// packages/workit-core/src/core/store-lock.ts
|
|
11381
|
-
import { spawnSync as
|
|
11407
|
+
import { spawnSync as spawnSync6 } from "node:child_process";
|
|
11382
11408
|
import fs7 from "node:fs";
|
|
11383
11409
|
import { hostname } from "node:os";
|
|
11384
11410
|
var metadataLockSchema, FOREIGN_LOCK_TTL_MS, UNREADABLE_LOCK_TTL_MS = 30000, RECLAIM_GUARD_TTL_MS = 30000, defaultLockTimeoutMs = 250, defaultLockTimeout = () => defaultLockTimeoutMs, parseMetadataLock = (raw) => {
|
|
@@ -11413,7 +11439,7 @@ var metadataLockSchema, FOREIGN_LOCK_TTL_MS, UNREADABLE_LOCK_TTL_MS = 30000, REC
|
|
|
11413
11439
|
}
|
|
11414
11440
|
if (process.platform === "darwin" || process.platform === "freebsd") {
|
|
11415
11441
|
try {
|
|
11416
|
-
const run =
|
|
11442
|
+
const run = spawnSync6("ps", ["-o", "lstart=", "-p", String(pid)], {
|
|
11417
11443
|
encoding: "utf8",
|
|
11418
11444
|
timeout: 1000
|
|
11419
11445
|
});
|
|
@@ -13535,7 +13561,7 @@ var init_workers = __esm(() => {
|
|
|
13535
13561
|
});
|
|
13536
13562
|
|
|
13537
13563
|
// packages/workit-core/src/check-config.ts
|
|
13538
|
-
import { spawnSync as
|
|
13564
|
+
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
13539
13565
|
import fs10 from "node:fs";
|
|
13540
13566
|
import path13 from "node:path";
|
|
13541
13567
|
function splitCommand(command) {
|
|
@@ -13703,7 +13729,7 @@ function checkCommand(args, version, onPath = workitAvailable()) {
|
|
|
13703
13729
|
return onPath ? `workit check ${args}` : `npx -y @brainervirus/workit-cli@${version} check ${args}`;
|
|
13704
13730
|
}
|
|
13705
13731
|
var SCRIPT_CHECKS, CHECKS_FILE = "workit.checks.json", isRecord2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), SHELL_META, git3 = (cwd, args) => {
|
|
13706
|
-
const run =
|
|
13732
|
+
const run = spawnSync7("git", args, {
|
|
13707
13733
|
cwd,
|
|
13708
13734
|
encoding: "utf8",
|
|
13709
13735
|
timeout: 20000,
|
|
@@ -13738,7 +13764,7 @@ var init_check_config = __esm(() => {
|
|
|
13738
13764
|
// packages/workit-core/src/core/task-evaluation.ts
|
|
13739
13765
|
import { createHash as createHash8 } from "node:crypto";
|
|
13740
13766
|
import * as fs11 from "node:fs";
|
|
13741
|
-
import { spawnSync as
|
|
13767
|
+
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
13742
13768
|
import path14 from "node:path";
|
|
13743
13769
|
function captureCandidate(root, scope, environment = []) {
|
|
13744
13770
|
let checkout;
|
|
@@ -13816,7 +13842,7 @@ function captureCandidate(root, scope, environment = []) {
|
|
|
13816
13842
|
const values = supplied.toSorted((left, right) => compareCodeUnits3(left.name, right.name)).map(({ name, value }) => ({ name, value, refs: [] }));
|
|
13817
13843
|
if (values.some(({ value }) => value === null))
|
|
13818
13844
|
completeness = "uncertain";
|
|
13819
|
-
const headResult =
|
|
13845
|
+
const headResult = spawnSync8("git", ["rev-parse", "HEAD"], { cwd: checkout, encoding: "utf8" });
|
|
13820
13846
|
if (headResult.status !== 0 && !/not a git repository/i.test(headResult.stderr ?? ""))
|
|
13821
13847
|
completeness = "uncertain";
|
|
13822
13848
|
const head = headResult.status === 0 ? headResult.stdout.trim() : null;
|
|
@@ -14189,7 +14215,7 @@ var digestBytes = (value) => createHash8("sha256").update(value).digest("hex"),
|
|
|
14189
14215
|
}
|
|
14190
14216
|
return left.length - right.length;
|
|
14191
14217
|
}, gitPaths = (root) => {
|
|
14192
|
-
const result =
|
|
14218
|
+
const result = spawnSync8("git", ["ls-files", "-z", "--cached", "--others", "--exclude-standard"], {
|
|
14193
14219
|
cwd: root,
|
|
14194
14220
|
encoding: "buffer"
|
|
14195
14221
|
});
|
|
@@ -14202,7 +14228,7 @@ var digestBytes = (value) => createHash8("sha256").update(value).digest("hex"),
|
|
|
14202
14228
|
};
|
|
14203
14229
|
}
|
|
14204
14230
|
const paths = result.stdout ? result.stdout.toString("utf8").split("\x00").filter(Boolean).map((item) => item.split(path14.sep).join("/")) : [];
|
|
14205
|
-
const stagedDeleted =
|
|
14231
|
+
const stagedDeleted = spawnSync8("git", ["diff", "--cached", "--name-only", "--diff-filter=D", "-z"], { cwd: root, encoding: "buffer" });
|
|
14206
14232
|
if (stagedDeleted.status !== 0) {
|
|
14207
14233
|
const stderr = stagedDeleted.stderr?.toString("utf8") ?? "";
|
|
14208
14234
|
if (!/not a git repository/i.test(stderr))
|
package/dist/mcp-server.js
CHANGED
|
@@ -16576,7 +16576,7 @@ class StdioServerTransport {
|
|
|
16576
16576
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
16577
16577
|
|
|
16578
16578
|
// packages/workit-core/src/core.ts
|
|
16579
|
-
import { spawnSync as
|
|
16579
|
+
import { spawnSync as spawnSync14 } 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
|
|
|
@@ -23034,6 +23034,7 @@ var gitContext = (workspaceRoot, paths = []) => {
|
|
|
23034
23034
|
};
|
|
23035
23035
|
|
|
23036
23036
|
// packages/workit-core/src/core/workspaces.ts
|
|
23037
|
+
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
23037
23038
|
import { createHash as createHash8 } from "node:crypto";
|
|
23038
23039
|
import { readFileSync as readFileSync4, realpathSync as realpathSync3 } from "node:fs";
|
|
23039
23040
|
import path13 from "node:path";
|
|
@@ -23278,6 +23279,53 @@ var validateWorkspaceGlob = (glob) => {
|
|
|
23278
23279
|
}
|
|
23279
23280
|
return { ok: true };
|
|
23280
23281
|
};
|
|
23282
|
+
|
|
23283
|
+
class WorkspaceConfigError extends Error {
|
|
23284
|
+
name = "WorkspaceConfigError";
|
|
23285
|
+
}
|
|
23286
|
+
var mainCheckouts = new Map;
|
|
23287
|
+
var mainCheckoutOf = (cwd) => {
|
|
23288
|
+
const cached = mainCheckouts.get(cwd);
|
|
23289
|
+
if (cached !== undefined)
|
|
23290
|
+
return cached;
|
|
23291
|
+
const env = { ...process.env };
|
|
23292
|
+
for (const name of ["GIT_DIR", "GIT_WORK_TREE", "GIT_COMMON_DIR", "GIT_INDEX_FILE"])
|
|
23293
|
+
delete env[name];
|
|
23294
|
+
const git = (args) => {
|
|
23295
|
+
const run = spawnSync8("git", args, {
|
|
23296
|
+
cwd,
|
|
23297
|
+
env,
|
|
23298
|
+
encoding: "utf8",
|
|
23299
|
+
timeout: 5000,
|
|
23300
|
+
windowsHide: true
|
|
23301
|
+
});
|
|
23302
|
+
return run.status === 0 ? run.stdout : null;
|
|
23303
|
+
};
|
|
23304
|
+
let main = null;
|
|
23305
|
+
const dirs = git(["rev-parse", "--path-format=absolute", "--git-dir", "--git-common-dir"]);
|
|
23306
|
+
const [gitDir, common] = (dirs ?? "").trim().split(/\r?\n/u);
|
|
23307
|
+
if (gitDir && common && path13.resolve(gitDir) !== path13.resolve(common)) {
|
|
23308
|
+
const listed = /^worktree (.+)$/mu.exec(git(["worktree", "list", "--porcelain"]) ?? "")?.[1];
|
|
23309
|
+
main = listed?.trim() || (path13.basename(common) === ".git" ? path13.dirname(common) : common);
|
|
23310
|
+
}
|
|
23311
|
+
mainCheckouts.set(cwd, main);
|
|
23312
|
+
return main;
|
|
23313
|
+
};
|
|
23314
|
+
var matchingEntries = (cwd, entries) => {
|
|
23315
|
+
const match = (where) => {
|
|
23316
|
+
const targets = [where, realpathOf(where)].map((value) => value.replaceAll("\\", "/"));
|
|
23317
|
+
return entries.filter((entry) => {
|
|
23318
|
+
const glob = entry.glob.replaceAll("\\", "/");
|
|
23319
|
+
const canonical = canonicalGlob(glob);
|
|
23320
|
+
return targets.some((target) => matchWorkspace(glob, target) || canonical !== glob && matchWorkspace(canonical, target));
|
|
23321
|
+
});
|
|
23322
|
+
};
|
|
23323
|
+
const direct = match(cwd);
|
|
23324
|
+
if (direct.length)
|
|
23325
|
+
return direct;
|
|
23326
|
+
const main = mainCheckoutOf(cwd);
|
|
23327
|
+
return main ? match(main) : direct;
|
|
23328
|
+
};
|
|
23281
23329
|
var realpathOf = (p) => {
|
|
23282
23330
|
const real = realpathSync3.native ?? realpathSync3;
|
|
23283
23331
|
try {
|
|
@@ -23302,43 +23350,29 @@ var selectWorkspaceMatch = (matches, cwd, workspaceName) => {
|
|
|
23302
23350
|
if (named.length === 1)
|
|
23303
23351
|
return named[0];
|
|
23304
23352
|
if (named.length > 1)
|
|
23305
|
-
throw new
|
|
23353
|
+
throw new WorkspaceConfigError(`ambiguous workspace ${JSON.stringify(workspaceName)} for ${cwd}`);
|
|
23306
23354
|
if (matches.length > 0) {
|
|
23307
|
-
throw new
|
|
23355
|
+
throw new WorkspaceConfigError(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}; matching choices: ${matches.map((entry) => entry.name).join(", ")}`);
|
|
23308
23356
|
}
|
|
23309
|
-
throw new
|
|
23357
|
+
throw new WorkspaceConfigError(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}`);
|
|
23310
23358
|
}
|
|
23311
23359
|
if (matches.length < 2)
|
|
23312
23360
|
return matches[0];
|
|
23313
23361
|
const highestSpecificity = Math.max(...matches.map((entry) => globSpecificity(entry.glob)));
|
|
23314
23362
|
const mostSpecific = matches.filter((entry) => globSpecificity(entry.glob) === highestSpecificity);
|
|
23315
23363
|
if (mostSpecific.length > 1) {
|
|
23316
|
-
throw new
|
|
23364
|
+
throw new WorkspaceConfigError(`ambiguous workspace for ${cwd}; choose one of: ${mostSpecific.map((entry) => entry.name).join(", ")}`);
|
|
23317
23365
|
}
|
|
23318
23366
|
return mostSpecific[0];
|
|
23319
23367
|
};
|
|
23320
23368
|
var resolveWorkspaceFromEntries = (cwd, entries, workspaceName) => {
|
|
23321
|
-
const
|
|
23322
|
-
const matches = [];
|
|
23323
|
-
for (const ws of entries) {
|
|
23324
|
-
const glob = ws.glob.replaceAll("\\", "/");
|
|
23325
|
-
const canonical = canonicalGlob(glob);
|
|
23326
|
-
let matched = false;
|
|
23327
|
-
for (const target of targets) {
|
|
23328
|
-
if (matchWorkspace(glob, target) || canonical !== glob && matchWorkspace(canonical, target)) {
|
|
23329
|
-
matched = true;
|
|
23330
|
-
break;
|
|
23331
|
-
}
|
|
23332
|
-
}
|
|
23333
|
-
if (matched)
|
|
23334
|
-
matches.push(ws);
|
|
23335
|
-
}
|
|
23369
|
+
const matches = matchingEntries(cwd, entries);
|
|
23336
23370
|
return selectWorkspaceMatch(matches, cwd, workspaceName) ?? null;
|
|
23337
23371
|
};
|
|
23338
23372
|
var resolveWorkspaceFrom = (cwd, dir, workspaceName) => {
|
|
23339
23373
|
const result = readWorkspacesResult(dir);
|
|
23340
23374
|
if (result.status === "malformed" || result.status === "invalid")
|
|
23341
|
-
throw new
|
|
23375
|
+
throw new WorkspaceConfigError(result.error);
|
|
23342
23376
|
return resolveWorkspaceFromEntries(cwd, result.entries, workspaceName);
|
|
23343
23377
|
};
|
|
23344
23378
|
var runtimeWorkspacePolicySchema = (kind) => {
|
|
@@ -23370,31 +23404,26 @@ var matchRuntimeWorkspace = (cwd) => {
|
|
|
23370
23404
|
} catch (error) {
|
|
23371
23405
|
if (error.code === "ENOENT")
|
|
23372
23406
|
return null;
|
|
23373
|
-
throw new
|
|
23407
|
+
throw new WorkspaceConfigError(`${file} could not be read: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
23374
23408
|
}
|
|
23375
23409
|
let parsed;
|
|
23376
23410
|
try {
|
|
23377
23411
|
parsed = JSON.parse(raw);
|
|
23378
23412
|
} catch {
|
|
23379
|
-
throw new
|
|
23413
|
+
throw new WorkspaceConfigError(`${file} is not valid JSON`);
|
|
23380
23414
|
}
|
|
23381
23415
|
const validated = runtimeWorkspaceIndexSchema.safeParse(parsed);
|
|
23382
23416
|
if (!validated.success) {
|
|
23383
23417
|
const detail = validated.error.issues.map((issue) => `${issue.path.map(String).join(".") || "workspaces"}: ${issue.message}`).join("; ");
|
|
23384
|
-
throw new
|
|
23418
|
+
throw new WorkspaceConfigError(`${file} has invalid workspace matching data: ${detail}`);
|
|
23385
23419
|
}
|
|
23386
23420
|
const entries = validated.data.workspaces;
|
|
23387
23421
|
for (const entry of entries ?? []) {
|
|
23388
23422
|
const glob = validateWorkspaceGlob(entry.glob);
|
|
23389
23423
|
if (!glob.ok)
|
|
23390
|
-
throw new
|
|
23424
|
+
throw new WorkspaceConfigError(`${file} workspace ${entry.name}: ${glob.error}`);
|
|
23391
23425
|
}
|
|
23392
|
-
const
|
|
23393
|
-
const matches = (entries ?? []).filter((entry) => {
|
|
23394
|
-
const glob = entry.glob.replaceAll("\\", "/");
|
|
23395
|
-
const canonical = canonicalGlob(glob);
|
|
23396
|
-
return targets.some((target) => matchWorkspace(glob, target) || canonical !== glob && matchWorkspace(canonical, target));
|
|
23397
|
-
});
|
|
23426
|
+
const matches = matchingEntries(cwd, entries ?? []);
|
|
23398
23427
|
const workspaceName = process.env.WORKFLOW_WORKSPACE_NAME?.trim() || undefined;
|
|
23399
23428
|
const selected = selectWorkspaceMatch(matches, cwd, workspaceName);
|
|
23400
23429
|
return selected ? { file, selected } : null;
|
|
@@ -23411,7 +23440,7 @@ var resolveRuntimeWorkspaceCandidate = (cwd, kind) => {
|
|
|
23411
23440
|
const policy = runtimeWorkspacePolicySchema(kind).safeParse(selected);
|
|
23412
23441
|
if (!policy.success) {
|
|
23413
23442
|
const detail = policy.error.issues.map((issue) => `${issue.path.map(String).join(".") || "workspace"}: ${issue.message}`).join("; ");
|
|
23414
|
-
throw new
|
|
23443
|
+
throw new WorkspaceConfigError(`${file} has invalid ${kind} policy configuration: ${detail}`);
|
|
23415
23444
|
}
|
|
23416
23445
|
return policy.data;
|
|
23417
23446
|
};
|
|
@@ -23422,10 +23451,10 @@ var resolveRuntimeWorkspacePolicy = (cwd, kind, requestedProfile) => {
|
|
|
23422
23451
|
const key = kind === "branch" ? "branchPolicy" : "commitPolicy";
|
|
23423
23452
|
const profileName = requestedProfile?.trim() || candidate.defaultProfile;
|
|
23424
23453
|
if (candidate.defaultProfile && !Object.hasOwn(candidate.profiles ?? {}, candidate.defaultProfile))
|
|
23425
|
-
throw new
|
|
23454
|
+
throw new WorkspaceConfigError(`workspace ${JSON.stringify(candidate.name)} has no profile ${JSON.stringify(candidate.defaultProfile)}`);
|
|
23426
23455
|
const profile = profileName ? candidate.profiles?.[profileName] : undefined;
|
|
23427
23456
|
if (profileName && !profile)
|
|
23428
|
-
throw new
|
|
23457
|
+
throw new WorkspaceConfigError(`workspace ${JSON.stringify(candidate.name)} has no profile ${JSON.stringify(profileName)}`);
|
|
23429
23458
|
const profilePolicy = profile?.[key];
|
|
23430
23459
|
const workspacePolicy = candidate[key];
|
|
23431
23460
|
return {
|
|
@@ -23445,11 +23474,11 @@ function workspaceDefaultTarget(cwd, globalDefault) {
|
|
|
23445
23474
|
// packages/workit-core/src/core/vcs-config.ts
|
|
23446
23475
|
import fs12 from "node:fs";
|
|
23447
23476
|
import path14 from "node:path";
|
|
23448
|
-
import { spawnSync as
|
|
23477
|
+
import { spawnSync as spawnSync10 } from "node:child_process";
|
|
23449
23478
|
|
|
23450
23479
|
// packages/workit-core/src/core/release-tracks.ts
|
|
23451
23480
|
import { createHash as createHash9 } from "node:crypto";
|
|
23452
|
-
import { spawnSync as
|
|
23481
|
+
import { spawnSync as spawnSync9 } from "node:child_process";
|
|
23453
23482
|
var KNOWN_FIELDS = new Set([
|
|
23454
23483
|
"strategy",
|
|
23455
23484
|
"productionBranch",
|
|
@@ -23721,7 +23750,7 @@ function resolveReleaseTrack(input) {
|
|
|
23721
23750
|
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 ")}`);
|
|
23722
23751
|
}
|
|
23723
23752
|
var git4 = (cwd, args) => {
|
|
23724
|
-
const run =
|
|
23753
|
+
const run = spawnSync9("git", args, {
|
|
23725
23754
|
cwd,
|
|
23726
23755
|
encoding: "utf8",
|
|
23727
23756
|
timeout: 20000,
|
|
@@ -23836,7 +23865,7 @@ function resolveTrackFor(cwd, options) {
|
|
|
23836
23865
|
var workspacesPath = () => path14.join(configDir(), "workspaces.json");
|
|
23837
23866
|
var vcsCwd = (cwd) => cwd ?? process.env.WORKFLOW_WORKSPACE_ROOT ?? process.cwd();
|
|
23838
23867
|
var remoteProvider = (cwd) => {
|
|
23839
|
-
const r =
|
|
23868
|
+
const r = spawnSync10("git", ["remote", "get-url", "origin"], { cwd, encoding: "utf8" });
|
|
23840
23869
|
if (r.status !== 0)
|
|
23841
23870
|
return null;
|
|
23842
23871
|
const url = (r.stdout ?? "").trim();
|
|
@@ -23873,7 +23902,7 @@ var remoteEndpoint = (remote) => {
|
|
|
23873
23902
|
var configuredSshEndpoint = (host) => {
|
|
23874
23903
|
if (host.startsWith("-"))
|
|
23875
23904
|
return null;
|
|
23876
|
-
const resolved =
|
|
23905
|
+
const resolved = spawnSync10("ssh", ["-G", host], {
|
|
23877
23906
|
encoding: "utf8",
|
|
23878
23907
|
timeout: 5000,
|
|
23879
23908
|
maxBuffer: 1024 * 1024,
|
|
@@ -24046,7 +24075,7 @@ function mergedPrStyle(limit = 6, cwd) {
|
|
|
24046
24075
|
`).filter((l) => l.startsWith("## ")).map((l) => l.trim()),
|
|
24047
24076
|
descriptionPreview: desc.slice(0, 600)
|
|
24048
24077
|
});
|
|
24049
|
-
const remoteResult =
|
|
24078
|
+
const remoteResult = spawnSync10("git", ["remote", "get-url", "--push", "--all", "origin"], {
|
|
24050
24079
|
cwd,
|
|
24051
24080
|
encoding: "utf8"
|
|
24052
24081
|
});
|
|
@@ -24062,7 +24091,7 @@ function mergedPrStyle(limit = 6, cwd) {
|
|
|
24062
24091
|
if (!hostingApiHostMatches(remote, host))
|
|
24063
24092
|
return { ok: false, error: "PR style target does not match the provider host" };
|
|
24064
24093
|
if (provider === "gitlab") {
|
|
24065
|
-
const run = (args) =>
|
|
24094
|
+
const run = (args) => spawnSync10("glab", ["api", ...args], {
|
|
24066
24095
|
cwd,
|
|
24067
24096
|
encoding: "utf8",
|
|
24068
24097
|
env
|
|
@@ -24082,7 +24111,7 @@ function mergedPrStyle(limit = 6, cwd) {
|
|
|
24082
24111
|
});
|
|
24083
24112
|
}
|
|
24084
24113
|
} else if (provider === "github") {
|
|
24085
|
-
const r =
|
|
24114
|
+
const r = spawnSync10("gh", [
|
|
24086
24115
|
"pr",
|
|
24087
24116
|
"list",
|
|
24088
24117
|
"--repo",
|
|
@@ -26019,7 +26048,7 @@ class WorkitCore {
|
|
|
26019
26048
|
}
|
|
26020
26049
|
}
|
|
26021
26050
|
// packages/workit-core/src/core/repo-context.ts
|
|
26022
|
-
import { spawnSync as
|
|
26051
|
+
import { spawnSync as spawnSync11 } from "node:child_process";
|
|
26023
26052
|
import { existsSync as existsSync6, readFileSync as readFileSync5, readdirSync as readdirSync4 } from "node:fs";
|
|
26024
26053
|
import path16 from "node:path";
|
|
26025
26054
|
var isSafeContextRange = (value) => value.length <= 4096 && (() => {
|
|
@@ -26048,7 +26077,7 @@ var invalidRange = (cwd) => ({
|
|
|
26048
26077
|
cwd
|
|
26049
26078
|
});
|
|
26050
26079
|
var runGit = (cwd, args) => {
|
|
26051
|
-
const result =
|
|
26080
|
+
const result = spawnSync11("git", args, { cwd, encoding: "utf8" });
|
|
26052
26081
|
return {
|
|
26053
26082
|
stdout: (result.stdout ?? "").trimEnd(),
|
|
26054
26083
|
stderr: (result.stderr ?? "").trimEnd(),
|
|
@@ -26489,12 +26518,12 @@ function releaseNotesContext(root, rangeOrTag) {
|
|
|
26489
26518
|
}
|
|
26490
26519
|
|
|
26491
26520
|
// packages/workit-core/src/core/tracker-issues.ts
|
|
26492
|
-
import { spawnSync as
|
|
26521
|
+
import { spawnSync as spawnSync13 } from "node:child_process";
|
|
26493
26522
|
|
|
26494
26523
|
// packages/workit-core/src/core/pr-create.ts
|
|
26495
26524
|
import fs13 from "node:fs";
|
|
26496
26525
|
import path17 from "node:path";
|
|
26497
|
-
import { spawnSync as
|
|
26526
|
+
import { spawnSync as spawnSync12 } from "node:child_process";
|
|
26498
26527
|
// packages/workit-core/src/forge/pr-body.ts
|
|
26499
26528
|
function parseGhIssue(value) {
|
|
26500
26529
|
const m = /issues\/(\d+)/.exec(value);
|
|
@@ -26519,7 +26548,7 @@ function whichOnPath(tool) {
|
|
|
26519
26548
|
}
|
|
26520
26549
|
var hostingCliAvailable = (provider) => whichOnPath(provider === "gitlab" ? "glab" : "gh") !== null;
|
|
26521
26550
|
var pushRemote = (cwd) => {
|
|
26522
|
-
const result =
|
|
26551
|
+
const result = spawnSync12("git", ["remote", "get-url", "--push", "--all", "origin"], {
|
|
26523
26552
|
cwd,
|
|
26524
26553
|
encoding: "utf8"
|
|
26525
26554
|
});
|
|
@@ -26550,7 +26579,7 @@ var defaultCli = (bin, available) => {
|
|
|
26550
26579
|
if (!available)
|
|
26551
26580
|
return null;
|
|
26552
26581
|
return (args, root) => {
|
|
26553
|
-
const out =
|
|
26582
|
+
const out = spawnSync13(bin, args, {
|
|
26554
26583
|
cwd: root,
|
|
26555
26584
|
encoding: "utf8",
|
|
26556
26585
|
env: { ...process.env, PATH: process.env.PATH ?? "" }
|
|
@@ -27068,7 +27097,7 @@ function resolveInside(root, candidate) {
|
|
|
27068
27097
|
}
|
|
27069
27098
|
function run2(root, executable, args, env = {}) {
|
|
27070
27099
|
const cwd = realpathSync5(root);
|
|
27071
|
-
const result =
|
|
27100
|
+
const result = spawnSync14(executable, args, {
|
|
27072
27101
|
cwd,
|
|
27073
27102
|
encoding: "utf8",
|
|
27074
27103
|
env: { ...process.env, ...env }
|
package/dist/workit-hook.js
CHANGED
|
@@ -10099,6 +10099,7 @@ var resolveCommitPolicy = (config, workspace) => {
|
|
|
10099
10099
|
};
|
|
10100
10100
|
|
|
10101
10101
|
// packages/workit-core/src/core/workspaces.ts
|
|
10102
|
+
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
10102
10103
|
import { createHash as createHash5 } from "node:crypto";
|
|
10103
10104
|
import { readFileSync as readFileSync2, realpathSync } from "node:fs";
|
|
10104
10105
|
import path6 from "node:path";
|
|
@@ -10410,6 +10411,53 @@ var validateWorkspaceGlob = (glob) => {
|
|
|
10410
10411
|
}
|
|
10411
10412
|
return { ok: true };
|
|
10412
10413
|
};
|
|
10414
|
+
|
|
10415
|
+
class WorkspaceConfigError extends Error {
|
|
10416
|
+
name = "WorkspaceConfigError";
|
|
10417
|
+
}
|
|
10418
|
+
var mainCheckouts = new Map;
|
|
10419
|
+
var mainCheckoutOf = (cwd) => {
|
|
10420
|
+
const cached = mainCheckouts.get(cwd);
|
|
10421
|
+
if (cached !== undefined)
|
|
10422
|
+
return cached;
|
|
10423
|
+
const env = { ...process.env };
|
|
10424
|
+
for (const name of ["GIT_DIR", "GIT_WORK_TREE", "GIT_COMMON_DIR", "GIT_INDEX_FILE"])
|
|
10425
|
+
delete env[name];
|
|
10426
|
+
const git = (args) => {
|
|
10427
|
+
const run = spawnSync5("git", args, {
|
|
10428
|
+
cwd,
|
|
10429
|
+
env,
|
|
10430
|
+
encoding: "utf8",
|
|
10431
|
+
timeout: 5000,
|
|
10432
|
+
windowsHide: true
|
|
10433
|
+
});
|
|
10434
|
+
return run.status === 0 ? run.stdout : null;
|
|
10435
|
+
};
|
|
10436
|
+
let main = null;
|
|
10437
|
+
const dirs = git(["rev-parse", "--path-format=absolute", "--git-dir", "--git-common-dir"]);
|
|
10438
|
+
const [gitDir, common] = (dirs ?? "").trim().split(/\r?\n/u);
|
|
10439
|
+
if (gitDir && common && path6.resolve(gitDir) !== path6.resolve(common)) {
|
|
10440
|
+
const listed = /^worktree (.+)$/mu.exec(git(["worktree", "list", "--porcelain"]) ?? "")?.[1];
|
|
10441
|
+
main = listed?.trim() || (path6.basename(common) === ".git" ? path6.dirname(common) : common);
|
|
10442
|
+
}
|
|
10443
|
+
mainCheckouts.set(cwd, main);
|
|
10444
|
+
return main;
|
|
10445
|
+
};
|
|
10446
|
+
var matchingEntries = (cwd, entries) => {
|
|
10447
|
+
const match = (where) => {
|
|
10448
|
+
const targets = [where, realpathOf(where)].map((value) => value.replaceAll("\\", "/"));
|
|
10449
|
+
return entries.filter((entry) => {
|
|
10450
|
+
const glob = entry.glob.replaceAll("\\", "/");
|
|
10451
|
+
const canonical = canonicalGlob(glob);
|
|
10452
|
+
return targets.some((target) => matchWorkspace(glob, target) || canonical !== glob && matchWorkspace(canonical, target));
|
|
10453
|
+
});
|
|
10454
|
+
};
|
|
10455
|
+
const direct = match(cwd);
|
|
10456
|
+
if (direct.length)
|
|
10457
|
+
return direct;
|
|
10458
|
+
const main = mainCheckoutOf(cwd);
|
|
10459
|
+
return main ? match(main) : direct;
|
|
10460
|
+
};
|
|
10413
10461
|
var realpathOf = (p) => {
|
|
10414
10462
|
const real = realpathSync.native ?? realpathSync;
|
|
10415
10463
|
try {
|
|
@@ -10434,43 +10482,29 @@ var selectWorkspaceMatch = (matches, cwd, workspaceName) => {
|
|
|
10434
10482
|
if (named.length === 1)
|
|
10435
10483
|
return named[0];
|
|
10436
10484
|
if (named.length > 1)
|
|
10437
|
-
throw new
|
|
10485
|
+
throw new WorkspaceConfigError(`ambiguous workspace ${JSON.stringify(workspaceName)} for ${cwd}`);
|
|
10438
10486
|
if (matches.length > 0) {
|
|
10439
|
-
throw new
|
|
10487
|
+
throw new WorkspaceConfigError(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}; matching choices: ${matches.map((entry) => entry.name).join(", ")}`);
|
|
10440
10488
|
}
|
|
10441
|
-
throw new
|
|
10489
|
+
throw new WorkspaceConfigError(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}`);
|
|
10442
10490
|
}
|
|
10443
10491
|
if (matches.length < 2)
|
|
10444
10492
|
return matches[0];
|
|
10445
10493
|
const highestSpecificity = Math.max(...matches.map((entry) => globSpecificity(entry.glob)));
|
|
10446
10494
|
const mostSpecific = matches.filter((entry) => globSpecificity(entry.glob) === highestSpecificity);
|
|
10447
10495
|
if (mostSpecific.length > 1) {
|
|
10448
|
-
throw new
|
|
10496
|
+
throw new WorkspaceConfigError(`ambiguous workspace for ${cwd}; choose one of: ${mostSpecific.map((entry) => entry.name).join(", ")}`);
|
|
10449
10497
|
}
|
|
10450
10498
|
return mostSpecific[0];
|
|
10451
10499
|
};
|
|
10452
10500
|
var resolveWorkspaceFromEntries = (cwd, entries, workspaceName) => {
|
|
10453
|
-
const
|
|
10454
|
-
const matches = [];
|
|
10455
|
-
for (const ws of entries) {
|
|
10456
|
-
const glob = ws.glob.replaceAll("\\", "/");
|
|
10457
|
-
const canonical = canonicalGlob(glob);
|
|
10458
|
-
let matched = false;
|
|
10459
|
-
for (const target of targets) {
|
|
10460
|
-
if (matchWorkspace(glob, target) || canonical !== glob && matchWorkspace(canonical, target)) {
|
|
10461
|
-
matched = true;
|
|
10462
|
-
break;
|
|
10463
|
-
}
|
|
10464
|
-
}
|
|
10465
|
-
if (matched)
|
|
10466
|
-
matches.push(ws);
|
|
10467
|
-
}
|
|
10501
|
+
const matches = matchingEntries(cwd, entries);
|
|
10468
10502
|
return selectWorkspaceMatch(matches, cwd, workspaceName) ?? null;
|
|
10469
10503
|
};
|
|
10470
10504
|
var resolveWorkspaceFrom = (cwd, dir, workspaceName) => {
|
|
10471
10505
|
const result = readWorkspacesResult(dir);
|
|
10472
10506
|
if (result.status === "malformed" || result.status === "invalid")
|
|
10473
|
-
throw new
|
|
10507
|
+
throw new WorkspaceConfigError(result.error);
|
|
10474
10508
|
return resolveWorkspaceFromEntries(cwd, result.entries, workspaceName);
|
|
10475
10509
|
};
|
|
10476
10510
|
var runtimeWorkspacePolicySchema = (kind) => {
|
|
@@ -10501,31 +10535,26 @@ var matchRuntimeWorkspace = (cwd) => {
|
|
|
10501
10535
|
} catch (error) {
|
|
10502
10536
|
if (error.code === "ENOENT")
|
|
10503
10537
|
return null;
|
|
10504
|
-
throw new
|
|
10538
|
+
throw new WorkspaceConfigError(`${file} could not be read: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
10505
10539
|
}
|
|
10506
10540
|
let parsed;
|
|
10507
10541
|
try {
|
|
10508
10542
|
parsed = JSON.parse(raw);
|
|
10509
10543
|
} catch {
|
|
10510
|
-
throw new
|
|
10544
|
+
throw new WorkspaceConfigError(`${file} is not valid JSON`);
|
|
10511
10545
|
}
|
|
10512
10546
|
const validated = runtimeWorkspaceIndexSchema.safeParse(parsed);
|
|
10513
10547
|
if (!validated.success) {
|
|
10514
10548
|
const detail = validated.error.issues.map((issue) => `${issue.path.map(String).join(".") || "workspaces"}: ${issue.message}`).join("; ");
|
|
10515
|
-
throw new
|
|
10549
|
+
throw new WorkspaceConfigError(`${file} has invalid workspace matching data: ${detail}`);
|
|
10516
10550
|
}
|
|
10517
10551
|
const entries = validated.data.workspaces;
|
|
10518
10552
|
for (const entry of entries ?? []) {
|
|
10519
10553
|
const glob = validateWorkspaceGlob(entry.glob);
|
|
10520
10554
|
if (!glob.ok)
|
|
10521
|
-
throw new
|
|
10555
|
+
throw new WorkspaceConfigError(`${file} workspace ${entry.name}: ${glob.error}`);
|
|
10522
10556
|
}
|
|
10523
|
-
const
|
|
10524
|
-
const matches = (entries ?? []).filter((entry) => {
|
|
10525
|
-
const glob = entry.glob.replaceAll("\\", "/");
|
|
10526
|
-
const canonical = canonicalGlob(glob);
|
|
10527
|
-
return targets.some((target) => matchWorkspace(glob, target) || canonical !== glob && matchWorkspace(canonical, target));
|
|
10528
|
-
});
|
|
10557
|
+
const matches = matchingEntries(cwd, entries ?? []);
|
|
10529
10558
|
const workspaceName = process.env.WORKFLOW_WORKSPACE_NAME?.trim() || undefined;
|
|
10530
10559
|
const selected = selectWorkspaceMatch(matches, cwd, workspaceName);
|
|
10531
10560
|
return selected ? { file, selected } : null;
|
|
@@ -10542,7 +10571,7 @@ var resolveRuntimeWorkspaceCandidate = (cwd, kind) => {
|
|
|
10542
10571
|
const policy = runtimeWorkspacePolicySchema(kind).safeParse(selected);
|
|
10543
10572
|
if (!policy.success) {
|
|
10544
10573
|
const detail = policy.error.issues.map((issue) => `${issue.path.map(String).join(".") || "workspace"}: ${issue.message}`).join("; ");
|
|
10545
|
-
throw new
|
|
10574
|
+
throw new WorkspaceConfigError(`${file} has invalid ${kind} policy configuration: ${detail}`);
|
|
10546
10575
|
}
|
|
10547
10576
|
return policy.data;
|
|
10548
10577
|
};
|
|
@@ -10553,10 +10582,10 @@ var resolveRuntimeWorkspacePolicy = (cwd, kind, requestedProfile) => {
|
|
|
10553
10582
|
const key = kind === "branch" ? "branchPolicy" : "commitPolicy";
|
|
10554
10583
|
const profileName = requestedProfile?.trim() || candidate.defaultProfile;
|
|
10555
10584
|
if (candidate.defaultProfile && !Object.hasOwn(candidate.profiles ?? {}, candidate.defaultProfile))
|
|
10556
|
-
throw new
|
|
10585
|
+
throw new WorkspaceConfigError(`workspace ${JSON.stringify(candidate.name)} has no profile ${JSON.stringify(candidate.defaultProfile)}`);
|
|
10557
10586
|
const profile = profileName ? candidate.profiles?.[profileName] : undefined;
|
|
10558
10587
|
if (profileName && !profile)
|
|
10559
|
-
throw new
|
|
10588
|
+
throw new WorkspaceConfigError(`workspace ${JSON.stringify(candidate.name)} has no profile ${JSON.stringify(profileName)}`);
|
|
10560
10589
|
const profilePolicy = profile?.[key];
|
|
10561
10590
|
const workspacePolicy = candidate[key];
|
|
10562
10591
|
return {
|
|
@@ -11321,7 +11350,7 @@ var packageRoot = () => {
|
|
|
11321
11350
|
};
|
|
11322
11351
|
|
|
11323
11352
|
// packages/workit-core/src/core/store-lock.ts
|
|
11324
|
-
import { spawnSync as
|
|
11353
|
+
import { spawnSync as spawnSync6 } from "node:child_process";
|
|
11325
11354
|
import fs7 from "node:fs";
|
|
11326
11355
|
import { hostname } from "node:os";
|
|
11327
11356
|
var metadataLockSchema = object({
|
|
@@ -11371,7 +11400,7 @@ var processStartOf = (pid) => {
|
|
|
11371
11400
|
}
|
|
11372
11401
|
if (process.platform === "darwin" || process.platform === "freebsd") {
|
|
11373
11402
|
try {
|
|
11374
|
-
const run =
|
|
11403
|
+
const run = spawnSync6("ps", ["-o", "lstart=", "-p", String(pid)], {
|
|
11375
11404
|
encoding: "utf8",
|
|
11376
11405
|
timeout: 1000
|
|
11377
11406
|
});
|
|
@@ -13511,11 +13540,11 @@ var workerBlocksTransition = (transition, state) => transition === "pause" ? fal
|
|
|
13511
13540
|
// packages/workit-core/src/core/task-evaluation.ts
|
|
13512
13541
|
import { createHash as createHash8 } from "node:crypto";
|
|
13513
13542
|
import * as fs11 from "node:fs";
|
|
13514
|
-
import { spawnSync as
|
|
13543
|
+
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
13515
13544
|
import path14 from "node:path";
|
|
13516
13545
|
|
|
13517
13546
|
// packages/workit-core/src/check-config.ts
|
|
13518
|
-
import { spawnSync as
|
|
13547
|
+
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
13519
13548
|
import fs10 from "node:fs";
|
|
13520
13549
|
import path13 from "node:path";
|
|
13521
13550
|
var SCRIPT_CHECKS = ["test", "lint", "typecheck", "check"];
|
|
@@ -13559,7 +13588,7 @@ function splitCommand(command) {
|
|
|
13559
13588
|
return argv.length ? argv : new Error("empty command");
|
|
13560
13589
|
}
|
|
13561
13590
|
var git3 = (cwd, args) => {
|
|
13562
|
-
const run =
|
|
13591
|
+
const run = spawnSync7("git", args, {
|
|
13563
13592
|
cwd,
|
|
13564
13593
|
encoding: "utf8",
|
|
13565
13594
|
timeout: 20000,
|
|
@@ -13764,7 +13793,7 @@ var compareCodeUnits3 = (left, right) => {
|
|
|
13764
13793
|
return left.length - right.length;
|
|
13765
13794
|
};
|
|
13766
13795
|
var gitPaths = (root) => {
|
|
13767
|
-
const result =
|
|
13796
|
+
const result = spawnSync8("git", ["ls-files", "-z", "--cached", "--others", "--exclude-standard"], {
|
|
13768
13797
|
cwd: root,
|
|
13769
13798
|
encoding: "buffer"
|
|
13770
13799
|
});
|
|
@@ -13777,7 +13806,7 @@ var gitPaths = (root) => {
|
|
|
13777
13806
|
};
|
|
13778
13807
|
}
|
|
13779
13808
|
const paths = result.stdout ? result.stdout.toString("utf8").split("\x00").filter(Boolean).map((item) => item.split(path14.sep).join("/")) : [];
|
|
13780
|
-
const stagedDeleted =
|
|
13809
|
+
const stagedDeleted = spawnSync8("git", ["diff", "--cached", "--name-only", "--diff-filter=D", "-z"], { cwd: root, encoding: "buffer" });
|
|
13781
13810
|
if (stagedDeleted.status !== 0) {
|
|
13782
13811
|
const stderr = stagedDeleted.stderr?.toString("utf8") ?? "";
|
|
13783
13812
|
if (!/not a git repository/i.test(stderr))
|
|
@@ -13908,7 +13937,7 @@ function captureCandidate(root, scope, environment = []) {
|
|
|
13908
13937
|
const values = supplied.toSorted((left, right) => compareCodeUnits3(left.name, right.name)).map(({ name, value }) => ({ name, value, refs: [] }));
|
|
13909
13938
|
if (values.some(({ value }) => value === null))
|
|
13910
13939
|
completeness = "uncertain";
|
|
13911
|
-
const headResult =
|
|
13940
|
+
const headResult = spawnSync8("git", ["rev-parse", "HEAD"], { cwd: checkout, encoding: "utf8" });
|
|
13912
13941
|
if (headResult.status !== 0 && !/not a git repository/i.test(headResult.stderr ?? ""))
|
|
13913
13942
|
completeness = "uncertain";
|
|
13914
13943
|
const head = headResult.status === 0 ? headResult.stdout.trim() : null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brainervirus/workit-cursor",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Workit Cursor plugin — shared MCP transport, native hooks, and sixteen method skills",
|
|
6
6
|
"keywords": [
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"build": "bun scripts/build.ts"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@brainervirus/workit-core": "^8.1.
|
|
48
|
-
"@brainervirus/workit-mcp": "^8.1.
|
|
47
|
+
"@brainervirus/workit-core": "^8.1.1",
|
|
48
|
+
"@brainervirus/workit-mcp": "^8.1.1"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|
|
51
51
|
"node": ">=24"
|