@workit-dev/codex 1.4.2 → 1.5.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/dist/launch-mcp.js
CHANGED
|
@@ -6621,14 +6621,14 @@ var require_dist = __commonJS(function(exports, module) {
|
|
|
6621
6621
|
});
|
|
6622
6622
|
|
|
6623
6623
|
// packages/workit-codex/scripts/launch-mcp.ts
|
|
6624
|
-
import { existsSync as
|
|
6625
|
-
import
|
|
6624
|
+
import { existsSync as existsSync15, realpathSync as realpathSync11, statSync as statSync5 } from "node:fs";
|
|
6625
|
+
import path36 from "node:path";
|
|
6626
6626
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
6627
6627
|
|
|
6628
6628
|
// packages/workit-core/src/core.ts
|
|
6629
6629
|
import { spawnSync as spawnSync19 } from "node:child_process";
|
|
6630
|
-
import { existsSync as
|
|
6631
|
-
import
|
|
6630
|
+
import { existsSync as existsSync10, realpathSync as realpathSync8 } from "node:fs";
|
|
6631
|
+
import path29 from "node:path";
|
|
6632
6632
|
|
|
6633
6633
|
// packages/workit-core/src/core/task-contract.ts
|
|
6634
6634
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -22385,12 +22385,11 @@ function checkVerdictsOnce(cwd, branch, ledgerRows) {
|
|
|
22385
22385
|
}
|
|
22386
22386
|
return reasons;
|
|
22387
22387
|
};
|
|
22388
|
-
const
|
|
22388
|
+
const voided = verdictVoids(rows, { chained: true });
|
|
22389
|
+
const retired = new Set(voided.keys());
|
|
22389
22390
|
for (const row of rows)
|
|
22390
|
-
if (row.type === "verdict" && row.supersedes && !row.supersedeIgnored && trustReasons(cwd, row).length === 0)
|
|
22391
|
+
if (row.type === "verdict" && row.supersedes && !row.supersedeIgnored && !voided.has(row.id) && trustReasons(cwd, row).length === 0)
|
|
22391
22392
|
retired.add(row.supersedes);
|
|
22392
|
-
for (const id of verdictVoids(rows, { chained: true }).keys())
|
|
22393
|
-
retired.add(id);
|
|
22394
22393
|
const byKind = new Map;
|
|
22395
22394
|
for (const row of rows.toSorted(byRank))
|
|
22396
22395
|
if (isLiveVerdict(row, retired) && scope(row)) {
|
|
@@ -23947,20 +23946,64 @@ var exportDigest = (bundle) => sha256({
|
|
|
23947
23946
|
task: bundle.task
|
|
23948
23947
|
});
|
|
23949
23948
|
// packages/workit-core/src/autonomy.ts
|
|
23949
|
+
import os6 from "node:os";
|
|
23950
|
+
import path24 from "node:path";
|
|
23951
|
+
|
|
23952
|
+
// packages/workit-core/src/core/eval-world.ts
|
|
23953
|
+
import { existsSync as existsSync8, realpathSync as realpathSync5 } from "node:fs";
|
|
23950
23954
|
import os5 from "node:os";
|
|
23951
23955
|
import path23 from "node:path";
|
|
23956
|
+
var EVAL_WORLD_ENV = "WORKIT_EVAL_WORLD";
|
|
23957
|
+
var EVAL_WORLD_MARKER = ".workit-eval-world";
|
|
23958
|
+
var inside2 = (dir, file) => {
|
|
23959
|
+
const rel = path23.relative(dir, file);
|
|
23960
|
+
return !rel.startsWith("..") && !path23.isAbsolute(rel);
|
|
23961
|
+
};
|
|
23962
|
+
var evalWorldEntry = (cwd) => {
|
|
23963
|
+
const raw = process.env[EVAL_WORLD_ENV];
|
|
23964
|
+
if (!raw || !path23.isAbsolute(raw))
|
|
23965
|
+
return null;
|
|
23966
|
+
try {
|
|
23967
|
+
const world = realpathSync5(raw);
|
|
23968
|
+
if (!inside2(realpathSync5(os5.tmpdir()), world) || !inside2(world, realpathSync5(cwd)) || !existsSync8(path23.join(world, EVAL_WORLD_MARKER)))
|
|
23969
|
+
return null;
|
|
23970
|
+
return loadWorkspacesFrom(path23.join(world, "config"))[0] ?? null;
|
|
23971
|
+
} catch {
|
|
23972
|
+
return null;
|
|
23973
|
+
}
|
|
23974
|
+
};
|
|
23975
|
+
|
|
23976
|
+
// packages/workit-core/src/autonomy.ts
|
|
23952
23977
|
var accountHome2 = () => {
|
|
23953
23978
|
try {
|
|
23954
|
-
return
|
|
23979
|
+
return os6.userInfo().homedir;
|
|
23955
23980
|
} catch {
|
|
23956
|
-
return
|
|
23981
|
+
return os6.homedir();
|
|
23957
23982
|
}
|
|
23958
23983
|
};
|
|
23959
23984
|
var grantsHome = { resolve: accountHome2 };
|
|
23960
23985
|
var grantsDir = () => configDir({ HOME: grantsHome.resolve() });
|
|
23986
|
+
var benchWorld = (cwd) => {
|
|
23987
|
+
const entry = evalWorldEntry(cwd);
|
|
23988
|
+
if (!entry)
|
|
23989
|
+
return null;
|
|
23990
|
+
const { grants } = configuredGrants(entry);
|
|
23991
|
+
const lowered = {};
|
|
23992
|
+
for (const kind of GRANT_KINDS) {
|
|
23993
|
+
const value = grants[kind];
|
|
23994
|
+
if (value !== undefined && raises(kind, value, DEFAULT_GRANTS[kind]))
|
|
23995
|
+
lowered[kind] = value;
|
|
23996
|
+
}
|
|
23997
|
+
return {
|
|
23998
|
+
name: entry.name,
|
|
23999
|
+
glob: entry.glob,
|
|
24000
|
+
...entry.defaultEndpoint ? { defaultEndpoint: entry.defaultEndpoint } : {},
|
|
24001
|
+
autonomy: lowered
|
|
24002
|
+
};
|
|
24003
|
+
};
|
|
23961
24004
|
var grantsOverride = () => {
|
|
23962
|
-
const configured =
|
|
23963
|
-
return configured ===
|
|
24005
|
+
const configured = path24.resolve(resolveConfigDir());
|
|
24006
|
+
return configured === path24.resolve(grantsDir()) ? null : `the config directory is redirected to ${configured} (WORKIT_CONFIG, WORKIT_CONFIG_DIR or XDG_CONFIG_HOME), but that override does not apply to grants: grants are read only from ${path24.join(grantsDir(), "workspaces.json")}, so the D4 defaults apply until grants are set there`;
|
|
23964
24007
|
};
|
|
23965
24008
|
var GRANT_KINDS = ["push", "pr", "merge", "release", "rerun"];
|
|
23966
24009
|
var DEFAULT_GRANTS = Object.freeze({
|
|
@@ -24125,11 +24168,12 @@ function capAt(named, where, by, why, main = false) {
|
|
|
24125
24168
|
};
|
|
24126
24169
|
}
|
|
24127
24170
|
function resolveAutonomy(cwd, target) {
|
|
24128
|
-
const
|
|
24171
|
+
const world = benchWorld(cwd);
|
|
24172
|
+
const override = world ? null : grantsOverride();
|
|
24129
24173
|
if (override)
|
|
24130
24174
|
return { ...autonomyOf(null), note: override };
|
|
24131
24175
|
const name = process.env.WORKIT_WORKSPACE_NAME?.trim() || undefined;
|
|
24132
|
-
let autonomy = autonomyOf(resolveWorkspaceFrom(cwd, grantsDir(), name));
|
|
24176
|
+
let autonomy = autonomyOf(resolveWorkspaceFrom(cwd, grantsDir(), name) ?? world);
|
|
24133
24177
|
if (name)
|
|
24134
24178
|
autonomy = capAt(autonomy, cwd, `WORKIT_WORKSPACE_NAME=${name}`, "a name never raises grants");
|
|
24135
24179
|
const above = checkoutsAbove(cwd);
|
|
@@ -24278,7 +24322,7 @@ var BRANCH_RENAME = new Set(["-m", "-M", "--move", "-c", "-C", "--copy"]);
|
|
|
24278
24322
|
var WORKTREE_VALUES = new Set(["--reason"]);
|
|
24279
24323
|
var FETCH_VALUES = new Set(["--depth", "--deepen", "--shallow-since", "--shallow-exclude", "--refmap", "-j", "--jobs"].concat(["--upload-pack", "-o", "--server-option", "--negotiation-tip", "--filter"]).concat(["--recurse-submodules-default", "--submodule-prefix", "-s", "--strategy", "-X"]).concat(["--strategy-option"]));
|
|
24280
24324
|
// packages/workit-core/src/core/task-engine.ts
|
|
24281
|
-
import { realpathSync as
|
|
24325
|
+
import { realpathSync as realpathSync7 } from "node:fs";
|
|
24282
24326
|
|
|
24283
24327
|
// packages/workit-core/src/core/policy-resolver.ts
|
|
24284
24328
|
function resolvePolicy(input) {
|
|
@@ -24527,12 +24571,12 @@ var judgeInputSummary = (raw) => {
|
|
|
24527
24571
|
};
|
|
24528
24572
|
|
|
24529
24573
|
// packages/workit-core/src/core/task-view.ts
|
|
24530
|
-
import { realpathSync as
|
|
24574
|
+
import { realpathSync as realpathSync6 } from "node:fs";
|
|
24531
24575
|
var environment = () => [];
|
|
24532
24576
|
var sameSession2 = (value, context) => typeof value === "object" && value !== null && value.kind === "host" && value.host === context.caller.host && value.handle === context.caller.actor;
|
|
24533
24577
|
function contextRootError(store, context) {
|
|
24534
24578
|
try {
|
|
24535
|
-
|
|
24579
|
+
realpathSync6(context.root);
|
|
24536
24580
|
const root = checkoutRootOf(context.root);
|
|
24537
24581
|
if (root !== store.root && !sameDirectoryIdentity(root, store.root))
|
|
24538
24582
|
return failure2("invalid_input", "operation context root does not match the task store root");
|
|
@@ -26002,7 +26046,7 @@ class WorkitCore {
|
|
|
26002
26046
|
if (view.task.workspaceId !== view.workspace.id)
|
|
26003
26047
|
return failure2("invalid_input", "task and workspace bindings are invalid");
|
|
26004
26048
|
try {
|
|
26005
|
-
if (
|
|
26049
|
+
if (realpathSync7(view.workspace.root) !== this.store.root)
|
|
26006
26050
|
return failure2("invalid_input", "task view root does not match the task store");
|
|
26007
26051
|
} catch {
|
|
26008
26052
|
return failure2("invalid_input", "task view root cannot be resolved");
|
|
@@ -26253,8 +26297,8 @@ class WorkitCore {
|
|
|
26253
26297
|
}
|
|
26254
26298
|
// packages/workit-core/src/core/repo-context.ts
|
|
26255
26299
|
import { spawnSync as spawnSync15 } from "node:child_process";
|
|
26256
|
-
import { existsSync as
|
|
26257
|
-
import
|
|
26300
|
+
import { existsSync as existsSync9, readFileSync as readFileSync8, readdirSync as readdirSync3 } from "node:fs";
|
|
26301
|
+
import path25 from "node:path";
|
|
26258
26302
|
var isSafeContextRange = (value) => value.length <= 4096 && (() => {
|
|
26259
26303
|
try {
|
|
26260
26304
|
gitRevisionParts(value);
|
|
@@ -26398,13 +26442,13 @@ var findPrTemplate = (cwd) => {
|
|
|
26398
26442
|
for (const rel of PR_TEMPLATE_FILES) {
|
|
26399
26443
|
const parts = rel.split("/");
|
|
26400
26444
|
const base = parts[parts.length - 1];
|
|
26401
|
-
const dir = parts.length > 1 ?
|
|
26445
|
+
const dir = parts.length > 1 ? path25.join(cwd, ...parts.slice(0, -1)) : cwd;
|
|
26402
26446
|
const actual = probeCaseInsensitive(dir, base);
|
|
26403
26447
|
if (actual)
|
|
26404
26448
|
return [...parts.slice(0, -1), actual].join("/");
|
|
26405
26449
|
}
|
|
26406
26450
|
for (const rel of PR_TEMPLATE_DIRS) {
|
|
26407
|
-
const only = singleMarkdown(
|
|
26451
|
+
const only = singleMarkdown(path25.join(cwd, ...rel.split("/")));
|
|
26408
26452
|
if (only)
|
|
26409
26453
|
return `${rel}/${only}`;
|
|
26410
26454
|
}
|
|
@@ -26434,8 +26478,8 @@ var diffStatForRange = (cwd, range) => {
|
|
|
26434
26478
|
return runGit(cwd, ["diff", "--stat", "--"]).stdout;
|
|
26435
26479
|
};
|
|
26436
26480
|
var packageScripts = (cwd, keys) => {
|
|
26437
|
-
const pkgPath =
|
|
26438
|
-
if (!
|
|
26481
|
+
const pkgPath = path25.join(cwd, "package.json");
|
|
26482
|
+
if (!existsSync9(pkgPath))
|
|
26439
26483
|
return [];
|
|
26440
26484
|
try {
|
|
26441
26485
|
const pkg = JSON.parse(readFileSync8(pkgPath, "utf8"));
|
|
@@ -26460,9 +26504,9 @@ var documentationFiles = (cwd) => {
|
|
|
26460
26504
|
if (entry.isDirectory()) {
|
|
26461
26505
|
if (excluded.has(entry.name))
|
|
26462
26506
|
continue;
|
|
26463
|
-
walk(
|
|
26507
|
+
walk(path25.join(dir, entry.name), depth + 1);
|
|
26464
26508
|
} else if (entry.isFile() && (entry.name === "README.md" || entry.name.endsWith(".md"))) {
|
|
26465
|
-
matches.push("./" +
|
|
26509
|
+
matches.push("./" + path25.relative(cwd, path25.join(dir, entry.name)).replaceAll("\\", "/"));
|
|
26466
26510
|
}
|
|
26467
26511
|
}
|
|
26468
26512
|
};
|
|
@@ -26470,7 +26514,7 @@ var documentationFiles = (cwd) => {
|
|
|
26470
26514
|
return matches.toSorted().slice(0, 200);
|
|
26471
26515
|
};
|
|
26472
26516
|
var readTrimmed2 = (file, maxLines) => {
|
|
26473
|
-
if (!
|
|
26517
|
+
if (!existsSync9(file))
|
|
26474
26518
|
return "";
|
|
26475
26519
|
const lines = readFileSync8(file, "utf8").split(`
|
|
26476
26520
|
`);
|
|
@@ -26478,7 +26522,7 @@ var readTrimmed2 = (file, maxLines) => {
|
|
|
26478
26522
|
`);
|
|
26479
26523
|
};
|
|
26480
26524
|
function prReadyContext(root, range) {
|
|
26481
|
-
const cwd =
|
|
26525
|
+
const cwd = path25.resolve(repoRoot(root));
|
|
26482
26526
|
if (range !== undefined && !isResolvableContextRange(cwd, range))
|
|
26483
26527
|
return invalidRange(cwd);
|
|
26484
26528
|
let stdout = "";
|
|
@@ -26536,7 +26580,7 @@ ${status.stderr}` : "");
|
|
|
26536
26580
|
stdout += `template_path: ${template}
|
|
26537
26581
|
|
|
26538
26582
|
`;
|
|
26539
|
-
stdout += readTrimmed2(
|
|
26583
|
+
stdout += readTrimmed2(path25.join(cwd, template), 220);
|
|
26540
26584
|
} else {
|
|
26541
26585
|
stdout += `template_path: none
|
|
26542
26586
|
|
|
@@ -26546,7 +26590,7 @@ ${status.stderr}` : "");
|
|
|
26546
26590
|
stdout += `
|
|
26547
26591
|
`;
|
|
26548
26592
|
stdout += printSection("Recent Validation Signals");
|
|
26549
|
-
if (
|
|
26593
|
+
if (existsSync9(path25.join(cwd, "package.json"))) {
|
|
26550
26594
|
stdout += `package.json detected. Common scripts:
|
|
26551
26595
|
`;
|
|
26552
26596
|
const found = packageScripts(cwd, ["lint", "format:check", "test", "build"]);
|
|
@@ -26555,7 +26599,7 @@ ${status.stderr}` : "");
|
|
|
26555
26599
|
`) + `
|
|
26556
26600
|
`;
|
|
26557
26601
|
}
|
|
26558
|
-
if (
|
|
26602
|
+
if (existsSync9(path25.join(cwd, "Cargo.toml")) || existsSync9(path25.join(cwd, "src-tauri/Cargo.toml"))) {
|
|
26559
26603
|
stdout += `Rust project detected.
|
|
26560
26604
|
`;
|
|
26561
26605
|
}
|
|
@@ -26588,7 +26632,7 @@ var CHANGELOG_RULES = `- Use an [Unreleased] section.
|
|
|
26588
26632
|
- Apply with the host-native editor, preserving the repository changelog conventions.
|
|
26589
26633
|
- If Unreleased already has duplicate category headings, normalize_only first.`;
|
|
26590
26634
|
function changelogContext(root, range) {
|
|
26591
|
-
const cwd =
|
|
26635
|
+
const cwd = path25.resolve(repoRoot(root));
|
|
26592
26636
|
if (range !== undefined && !isResolvableContextRange(cwd, range))
|
|
26593
26637
|
return invalidRange(cwd);
|
|
26594
26638
|
const resolvedRange = rangeArgOrDefault(range, cwd);
|
|
@@ -26606,8 +26650,8 @@ function changelogContext(root, range) {
|
|
|
26606
26650
|
stdout += CHANGELOG_RULES + `
|
|
26607
26651
|
`;
|
|
26608
26652
|
stdout += printSection("Existing CHANGELOG.md");
|
|
26609
|
-
const changelogPath =
|
|
26610
|
-
if (
|
|
26653
|
+
const changelogPath = path25.join(cwd, "CHANGELOG.md");
|
|
26654
|
+
if (existsSync9(changelogPath)) {
|
|
26611
26655
|
stdout += readTrimmed2(changelogPath, 260) + `
|
|
26612
26656
|
`;
|
|
26613
26657
|
} else {
|
|
@@ -26626,7 +26670,7 @@ function changelogContext(root, range) {
|
|
|
26626
26670
|
return { stdout, stderr: "", exitCode: 0, cwd };
|
|
26627
26671
|
}
|
|
26628
26672
|
function docsRefreshContext(root, range) {
|
|
26629
|
-
const cwd =
|
|
26673
|
+
const cwd = path25.resolve(repoRoot(root));
|
|
26630
26674
|
if (range !== undefined && !isResolvableContextRange(cwd, range))
|
|
26631
26675
|
return invalidRange(cwd);
|
|
26632
26676
|
const resolvedRange = rangeArgOrDefault(range, cwd);
|
|
@@ -26648,8 +26692,8 @@ function docsRefreshContext(root, range) {
|
|
|
26648
26692
|
`) + `
|
|
26649
26693
|
`;
|
|
26650
26694
|
stdout += printSection("README Preview");
|
|
26651
|
-
const readme =
|
|
26652
|
-
if (
|
|
26695
|
+
const readme = path25.join(cwd, "README.md");
|
|
26696
|
+
if (existsSync9(readme)) {
|
|
26653
26697
|
stdout += readTrimmed2(readme, 220) + `
|
|
26654
26698
|
`;
|
|
26655
26699
|
} else {
|
|
@@ -26657,8 +26701,8 @@ function docsRefreshContext(root, range) {
|
|
|
26657
26701
|
`;
|
|
26658
26702
|
}
|
|
26659
26703
|
stdout += printSection("Package Scripts");
|
|
26660
|
-
const pkgPath =
|
|
26661
|
-
if (
|
|
26704
|
+
const pkgPath = path25.join(cwd, "package.json");
|
|
26705
|
+
if (existsSync9(pkgPath)) {
|
|
26662
26706
|
try {
|
|
26663
26707
|
const pkg = JSON.parse(readFileSync8(pkgPath, "utf8"));
|
|
26664
26708
|
stdout += JSON.stringify({ name: pkg.name, version: pkg.version, scripts: pkg.scripts }, null, 2) + `
|
|
@@ -26671,7 +26715,7 @@ function docsRefreshContext(root, range) {
|
|
|
26671
26715
|
return { stdout, stderr: "", exitCode: 0, cwd };
|
|
26672
26716
|
}
|
|
26673
26717
|
function releaseNotesContext(root, rangeOrTag) {
|
|
26674
|
-
const cwd =
|
|
26718
|
+
const cwd = path25.resolve(repoRoot(root));
|
|
26675
26719
|
if (!rangeOrTag) {
|
|
26676
26720
|
return {
|
|
26677
26721
|
stdout: "",
|
|
@@ -26714,7 +26758,7 @@ function releaseNotesContext(root, rangeOrTag) {
|
|
|
26714
26758
|
`;
|
|
26715
26759
|
stdout += printSection("Existing Release Files");
|
|
26716
26760
|
for (const rel of ["CHANGELOG.md", "RELEASE_NOTES.md", ".github/releases.md"]) {
|
|
26717
|
-
if (
|
|
26761
|
+
if (existsSync9(path25.join(cwd, rel)))
|
|
26718
26762
|
stdout += rel + `
|
|
26719
26763
|
`;
|
|
26720
26764
|
}
|
|
@@ -26746,7 +26790,7 @@ import { spawnSync as spawnSync17 } from "node:child_process";
|
|
|
26746
26790
|
|
|
26747
26791
|
// packages/workit-core/src/core/pr-create.ts
|
|
26748
26792
|
import fs17 from "node:fs";
|
|
26749
|
-
import
|
|
26793
|
+
import path26 from "node:path";
|
|
26750
26794
|
import { spawnSync as spawnSync16 } from "node:child_process";
|
|
26751
26795
|
// packages/workit-core/src/forge/pr-body.ts
|
|
26752
26796
|
function parseGhIssue(value) {
|
|
@@ -26766,11 +26810,11 @@ var LOCAL = bounded(20000);
|
|
|
26766
26810
|
var NETWORK = bounded(60000);
|
|
26767
26811
|
function whichOnPath(tool) {
|
|
26768
26812
|
const names = process.platform === "win32" ? [tool, `${tool}.exe`, `${tool}.cmd`] : [tool];
|
|
26769
|
-
for (const dir of (process.env.PATH ?? "").split(
|
|
26813
|
+
for (const dir of (process.env.PATH ?? "").split(path26.delimiter)) {
|
|
26770
26814
|
if (!dir)
|
|
26771
26815
|
continue;
|
|
26772
26816
|
for (const name of names) {
|
|
26773
|
-
const candidate =
|
|
26817
|
+
const candidate = path26.join(dir, name);
|
|
26774
26818
|
try {
|
|
26775
26819
|
fs17.accessSync(candidate, fs17.constants.X_OK);
|
|
26776
26820
|
return candidate;
|
|
@@ -26891,7 +26935,7 @@ var fetchGitLabIssueBody = async (ref, root, deps = {}) => {
|
|
|
26891
26935
|
|
|
26892
26936
|
// packages/workit-core/src/core/youtrack.ts
|
|
26893
26937
|
import fs19 from "node:fs";
|
|
26894
|
-
import
|
|
26938
|
+
import path28 from "node:path";
|
|
26895
26939
|
|
|
26896
26940
|
// packages/workit-core/src/core/templates.ts
|
|
26897
26941
|
var repoRoot2 = assetRoot();
|
|
@@ -26906,7 +26950,7 @@ import { spawnSync as spawnSync18 } from "node:child_process";
|
|
|
26906
26950
|
|
|
26907
26951
|
// packages/workit-core/src/forge/exec.ts
|
|
26908
26952
|
import fs18 from "node:fs";
|
|
26909
|
-
import
|
|
26953
|
+
import path27 from "node:path";
|
|
26910
26954
|
|
|
26911
26955
|
// packages/workit-core/src/forge/redact.ts
|
|
26912
26956
|
var KEY = String.raw`[A-Za-z0-9_.-]*?(?:token|secret|password|passwd|pwd|api[_-]?key|access[_-]?key|account[_-]?key|private[_-]?key|client[_-]?secret|credentials?|authorization|cookie|signature)[A-Za-z0-9_.-]*`;
|
|
@@ -26917,11 +26961,11 @@ var ANSI = new RegExp(String.raw`\u001b\[[0-9;?]*[ -/]*[@-~]|\u001b\][^\u0007]*\
|
|
|
26917
26961
|
// packages/workit-core/src/forge/exec.ts
|
|
26918
26962
|
var MAX_BUFFER2 = 64 * 1024 * 1024;
|
|
26919
26963
|
function findExecutable(bin, env) {
|
|
26920
|
-
const dirs = (env.PATH ?? env.Path ?? "").split(
|
|
26964
|
+
const dirs = (env.PATH ?? env.Path ?? "").split(path27.delimiter).filter(Boolean);
|
|
26921
26965
|
const exts = process.platform === "win32" ? [".exe"] : [""];
|
|
26922
26966
|
for (const dir of dirs)
|
|
26923
26967
|
for (const ext of exts) {
|
|
26924
|
-
const candidate =
|
|
26968
|
+
const candidate = path27.join(dir, `${bin}${ext}`);
|
|
26925
26969
|
try {
|
|
26926
26970
|
const stat = fs18.statSync(candidate);
|
|
26927
26971
|
if (stat.isFile())
|
|
@@ -26964,7 +27008,7 @@ var YTRACK_MISSING = "ytrack is not on PATH: Workit reaches YouTrack only throug
|
|
|
26964
27008
|
|
|
26965
27009
|
// packages/workit-core/src/core/youtrack.ts
|
|
26966
27010
|
var ISSUE_RE = /^[A-Z]+-\d+$/;
|
|
26967
|
-
var youTrackReadOnlyConfigPath = () => process.env.WORKIT_YOUTRACK_CONFIG ??
|
|
27011
|
+
var youTrackReadOnlyConfigPath = () => process.env.WORKIT_YOUTRACK_CONFIG ?? path28.join(resolveConfigDir(), "youtrack.json");
|
|
26968
27012
|
var readYouTrackContextConfig = () => {
|
|
26969
27013
|
const cfgPath = youTrackReadOnlyConfigPath();
|
|
26970
27014
|
if (!fs19.existsSync(cfgPath))
|
|
@@ -27316,22 +27360,22 @@ function resolveGitRevision(root, value) {
|
|
|
27316
27360
|
}
|
|
27317
27361
|
}
|
|
27318
27362
|
function resolveInside(root, candidate) {
|
|
27319
|
-
const base =
|
|
27320
|
-
const target =
|
|
27321
|
-
if (target !== base && !target.startsWith(base +
|
|
27363
|
+
const base = realpathSync8(root);
|
|
27364
|
+
const target = path29.resolve(base, candidate);
|
|
27365
|
+
if (target !== base && !target.startsWith(base + path29.sep)) {
|
|
27322
27366
|
throw new Error("path must stay inside repository root");
|
|
27323
27367
|
}
|
|
27324
27368
|
let ancestor = target;
|
|
27325
|
-
while (!
|
|
27326
|
-
ancestor =
|
|
27327
|
-
const canonicalAncestor =
|
|
27328
|
-
if (canonicalAncestor !== base && !canonicalAncestor.startsWith(base +
|
|
27369
|
+
while (!existsSync10(ancestor))
|
|
27370
|
+
ancestor = path29.dirname(ancestor);
|
|
27371
|
+
const canonicalAncestor = realpathSync8(ancestor);
|
|
27372
|
+
if (canonicalAncestor !== base && !canonicalAncestor.startsWith(base + path29.sep)) {
|
|
27329
27373
|
throw new Error("path must stay inside repository root");
|
|
27330
27374
|
}
|
|
27331
27375
|
return target;
|
|
27332
27376
|
}
|
|
27333
27377
|
function run2(root, executable, args, env = {}) {
|
|
27334
|
-
const cwd =
|
|
27378
|
+
const cwd = realpathSync8(root);
|
|
27335
27379
|
const result = spawnSync19(executable, args, {
|
|
27336
27380
|
cwd,
|
|
27337
27381
|
encoding: "utf8",
|
|
@@ -27346,18 +27390,18 @@ function run2(root, executable, args, env = {}) {
|
|
|
27346
27390
|
}
|
|
27347
27391
|
|
|
27348
27392
|
// packages/workit-core/src/core/cli-locate.ts
|
|
27349
|
-
import { closeSync as closeSync2, existsSync as
|
|
27350
|
-
import
|
|
27393
|
+
import { closeSync as closeSync2, existsSync as existsSync11, openSync as openSync2, readSync } from "node:fs";
|
|
27394
|
+
import path30 from "node:path";
|
|
27351
27395
|
var LAUNCHER_MARKER = "workit-owned-launcher";
|
|
27352
27396
|
var CLI_PACKAGE_PATH = ["node_modules", "@workit-dev", "cli"];
|
|
27353
27397
|
var installRoot = (env, platform = process.platform) => {
|
|
27354
27398
|
if (env.WORKIT_INSTALL_ROOT)
|
|
27355
27399
|
return env.WORKIT_INSTALL_ROOT;
|
|
27356
27400
|
const data = dataDir(env, platform);
|
|
27357
|
-
return platform === "win32" ?
|
|
27401
|
+
return platform === "win32" ? path30.join(data, "install") : data;
|
|
27358
27402
|
};
|
|
27359
|
-
var ownedLauncherPath = (env, platform = process.platform) =>
|
|
27360
|
-
var ownedCurrentEntry = (env, platform = process.platform) =>
|
|
27403
|
+
var ownedLauncherPath = (env, platform = process.platform) => path30.join(installRoot(env, platform), "bin", platform === "win32" ? "workit.cmd" : "workit");
|
|
27404
|
+
var ownedCurrentEntry = (env, platform = process.platform) => path30.join(installRoot(env, platform), "current", ...CLI_PACKAGE_PATH, "dist", "index.js");
|
|
27361
27405
|
var head = (file) => {
|
|
27362
27406
|
let fd;
|
|
27363
27407
|
try {
|
|
@@ -27375,7 +27419,7 @@ var head = (file) => {
|
|
|
27375
27419
|
var locateWorkitCli = (options = {}) => {
|
|
27376
27420
|
const env = options.env ?? process.env;
|
|
27377
27421
|
const platform = options.platform ?? process.platform;
|
|
27378
|
-
const exists = options.exists ??
|
|
27422
|
+
const exists = options.exists ?? existsSync11;
|
|
27379
27423
|
const read = options.read ?? head;
|
|
27380
27424
|
const node = options.node ?? process.execPath;
|
|
27381
27425
|
const launcher = ownedLauncherPath(env, platform);
|
|
@@ -27384,7 +27428,7 @@ var locateWorkitCli = (options = {}) => {
|
|
|
27384
27428
|
source: "owned-launcher",
|
|
27385
27429
|
command: launcher,
|
|
27386
27430
|
args: [],
|
|
27387
|
-
binDir:
|
|
27431
|
+
binDir: path30.dirname(launcher)
|
|
27388
27432
|
};
|
|
27389
27433
|
const current = ownedCurrentEntry(env, platform);
|
|
27390
27434
|
if (exists(current))
|
|
@@ -27413,7 +27457,7 @@ var workitCliEnv = (located, env = process.env, platform = process.platform) =>
|
|
|
27413
27457
|
if (located.binDir) {
|
|
27414
27458
|
const key = pathKey(env);
|
|
27415
27459
|
const delimiter = platform === "win32" ? ";" : ":";
|
|
27416
|
-
const same = (dir) => platform === "win32" ?
|
|
27460
|
+
const same = (dir) => platform === "win32" ? path30.win32.normalize(dir).toLowerCase() === path30.win32.normalize(located.binDir).toLowerCase() : path30.posix.normalize(dir) === path30.posix.normalize(located.binDir);
|
|
27417
27461
|
const rest = (env[key] ?? "").split(delimiter).filter((dir) => dir && !same(dir));
|
|
27418
27462
|
patch[key] = [located.binDir, ...rest].join(delimiter);
|
|
27419
27463
|
}
|
|
@@ -27437,8 +27481,8 @@ var SUPPORT_MATRIX = {
|
|
|
27437
27481
|
};
|
|
27438
27482
|
|
|
27439
27483
|
// packages/workit-mcp/src/server.ts
|
|
27440
|
-
import { existsSync as
|
|
27441
|
-
import
|
|
27484
|
+
import { existsSync as existsSync12, readFileSync as readFileSync9, realpathSync as realpathSync9 } from "node:fs";
|
|
27485
|
+
import path31 from "node:path";
|
|
27442
27486
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
|
|
27443
27487
|
function isZ4Schema(s) {
|
|
27444
27488
|
const schema = s;
|
|
@@ -29903,13 +29947,13 @@ var rootVariants = (workspaceRoot) => {
|
|
|
29903
29947
|
if (!workspaceRoot)
|
|
29904
29948
|
return [];
|
|
29905
29949
|
const roots = new Set;
|
|
29906
|
-
for (const candidate of [workspaceRoot,
|
|
29907
|
-
if (
|
|
29950
|
+
for (const candidate of [workspaceRoot, path31.resolve(workspaceRoot)]) {
|
|
29951
|
+
if (path31.isAbsolute(candidate) && candidate !== path31.parse(candidate).root)
|
|
29908
29952
|
roots.add(candidate);
|
|
29909
29953
|
}
|
|
29910
29954
|
try {
|
|
29911
|
-
const canonical =
|
|
29912
|
-
if (canonical !==
|
|
29955
|
+
const canonical = realpathSync9(workspaceRoot);
|
|
29956
|
+
if (canonical !== path31.parse(canonical).root)
|
|
29913
29957
|
roots.add(canonical);
|
|
29914
29958
|
} catch {}
|
|
29915
29959
|
return [...roots].toSorted((left, right) => right.length - left.length);
|
|
@@ -29991,12 +30035,12 @@ var thrownResult = (tool, error, workspaceRoot) => {
|
|
|
29991
30035
|
};
|
|
29992
30036
|
function createMcpServer(host, contextProvider) {
|
|
29993
30037
|
assertMcpHost(host);
|
|
29994
|
-
const here =
|
|
30038
|
+
const here = path31.dirname(fileURLToPath2(import.meta.url));
|
|
29995
30039
|
const sourceMarker = markSourcesLoaded([
|
|
29996
|
-
|
|
29997
|
-
|
|
29998
|
-
|
|
29999
|
-
].filter((file) =>
|
|
30040
|
+
path31.join(here, "server.ts"),
|
|
30041
|
+
path31.join(here, "..", "..", "workit-core", "src", "core", "task-contract.ts"),
|
|
30042
|
+
path31.join(here, "..", "..", "workit-core", "src", "core", "task-engine.ts")
|
|
30043
|
+
].filter((file) => existsSync12(file)));
|
|
30000
30044
|
let staleWarned = false;
|
|
30001
30045
|
const failures = new Map;
|
|
30002
30046
|
const server = new Server({ name: "workit", version: VERSION }, { capabilities: { tools: {}, resources: {} } });
|
|
@@ -30334,7 +30378,7 @@ var EXEC = new Set(["exec", "x", "dlx"]);
|
|
|
30334
30378
|
// packages/workit-core/src/core/heavy-words.ts
|
|
30335
30379
|
var HEAVY_WORDS = new Set(("npm npx pnpm pnpx yarn bun bunx deno corepack make gmake docker podman nerdctl " + "python python3 py uv poetry pdm pipenv hatch rye bundle rake nx " + "jest vitest mocha ava tap karma jasmine nyc c8 tsc vue-tsc svelte-check eslint stylelint " + "tslint webpack webpack-cli rollup parcel tsup vite next nuxt nuxi astro ng react-scripts " + "playwright cypress wdio testcafe turbo lerna sonar-scanner sonarless sonarless-mcp go " + "golangci-lint gotestsum staticcheck cargo mvn mvnw gradle gradlew ant sbt bazel bazelisk " + "buck2 dotnet msbuild pytest py.test tox nox mypy pyright pylint coverage maturin pip pip3 " + "rspec rails phpunit pest phpstan psalm composer mix swift xcodebuild flutter dart pod cmake " + "ninja meson ctest scons docker-compose buildah earthly").split(" "));
|
|
30336
30380
|
// packages/workit-core/src/hooks/write-gate.ts
|
|
30337
|
-
import
|
|
30381
|
+
import path32 from "node:path";
|
|
30338
30382
|
|
|
30339
30383
|
// packages/workit-core/src/core/live-session.ts
|
|
30340
30384
|
import { spawnSync as spawnSync20 } from "node:child_process";
|
|
@@ -30375,7 +30419,7 @@ var MUTATING_WORKIT_GIT = new Set(["commit", "branch", "stage", "unstage"]);
|
|
|
30375
30419
|
var CD2 = new Set(["cd", "chdir", "set-location", "sl"]);
|
|
30376
30420
|
var PUSHD2 = new Set(["pushd", "push-location"]);
|
|
30377
30421
|
var POPD2 = new Set(["popd", "pop-location"]);
|
|
30378
|
-
var UNKNOWN_DIR =
|
|
30422
|
+
var UNKNOWN_DIR = path32.resolve(path32.parse(process.cwd()).root, ".workit-unknown-dir");
|
|
30379
30423
|
var DECLARERS = new Set(["export", "declare", "typeset", "local", "readonly"]);
|
|
30380
30424
|
var REBINDS_ANY = new Set([
|
|
30381
30425
|
"source",
|
|
@@ -30429,36 +30473,57 @@ var OPENS = new Set(["if", "for", "while", "until", "{"]);
|
|
|
30429
30473
|
var CLOSES = new Set(["fi", "done", "}"]);
|
|
30430
30474
|
var UNFOLLOWED = new Set(["case", "esac", "select", "function"]);
|
|
30431
30475
|
var TRANSPARENT = new Set(["builtin", "command", "time", "!"]);
|
|
30432
|
-
var UNKNOWN_VAR =
|
|
30476
|
+
var UNKNOWN_VAR = path32.resolve(path32.parse(process.cwd()).root, ".workit-unknown-var");
|
|
30433
30477
|
// packages/workit-core/src/core/skill-manifests.ts
|
|
30434
30478
|
if (false) {}
|
|
30435
30479
|
|
|
30436
30480
|
// packages/workit-core/src/hooks/skill-nudge.ts
|
|
30437
30481
|
var USER_INVOKED = new Set(["workit-retro", "workit-architecture"]);
|
|
30438
|
-
var
|
|
30439
|
-
|
|
30440
|
-
|
|
30441
|
-
|
|
30442
|
-
|
|
30443
|
-
|
|
30444
|
-
|
|
30445
|
-
|
|
30446
|
-
|
|
30447
|
-
|
|
30448
|
-
|
|
30449
|
-
|
|
30450
|
-
]
|
|
30482
|
+
var PROMPT_INTENTS = [
|
|
30483
|
+
[
|
|
30484
|
+
"debug",
|
|
30485
|
+
/\b(flaky|regressed|(is|introduced) a regression|regression (in|after|since|from)|(is|are|got|looks) broken|debug (this|it|the|why)|fix (the|this|a) bug)\b/i
|
|
30486
|
+
],
|
|
30487
|
+
[
|
|
30488
|
+
"continue",
|
|
30489
|
+
/\b(pick up where|where (were|did) we|resume (the|this|my|our|work|where)|hand ?off)\b/i
|
|
30490
|
+
],
|
|
30491
|
+
[
|
|
30492
|
+
"review",
|
|
30493
|
+
/\b(blast radius|code review|review (the|this|my|PR|pr|#\d+|branch|diff|changes))\b/i
|
|
30494
|
+
],
|
|
30495
|
+
[
|
|
30496
|
+
"ship",
|
|
30497
|
+
/\b(ship (it|this|the)|babysit|open (a|the) (PR|pr|MR|mr)(?=\s*$|\s+(for|to|on|with|and|against|into|from|after|once)\b|[.!,;])|merge (the|this|my) (PR|pr|MR|mr|branch)|(get|until|make) CI (is )?green)\b/i
|
|
30498
|
+
],
|
|
30499
|
+
["bdd", /\b(BDD|TDD|acceptance criteria|Given\/When\/Then)(?![\w/])/],
|
|
30500
|
+
["test-audit", /\b(test audit|audit the tests|tautolog\w*|weak tests)\b/i],
|
|
30501
|
+
["deslop", /\b(deslop|slop|dead code)\b/i],
|
|
30502
|
+
["fanout", /\b(fan( |-)?out|parallelize|parallel agents|agent swarm|swarm of agents)\b/i],
|
|
30503
|
+
["verify-app", /\b(verify the app|smoke test|prove it works)\b/i],
|
|
30504
|
+
["retro", /\b((a|the) retro(?![-\w]|\.\w)|retrospective)/i],
|
|
30505
|
+
["architecture", /\b(deepen (the )?modules|architecture (review|pass|audit))\b/i],
|
|
30506
|
+
[
|
|
30507
|
+
"shape",
|
|
30508
|
+
/\b(brainstorm\w*|grill me|should we|let'?s plan|plan (out|how|the|a|for)|(write|draft) (a|the) spec)\b/i
|
|
30509
|
+
],
|
|
30510
|
+
[
|
|
30511
|
+
"implement",
|
|
30512
|
+
/\b(implement (the|this|a|it)|add (a|the) feature|build (a|an|the) (new )?(feature|command|verb|page|endpoint|component|cli|tool))\b/i
|
|
30513
|
+
]
|
|
30514
|
+
].map(([name, pattern]) => [`workit-${name}`, pattern]);
|
|
30515
|
+
var READERS = new Set("cat sed head tail less more bat nl get-content gc type".split(" "));
|
|
30451
30516
|
// packages/workit-core/src/hooks/hosts/fields.ts
|
|
30452
|
-
import { existsSync as
|
|
30453
|
-
import
|
|
30517
|
+
import { existsSync as existsSync13, realpathSync as realpathSync10, statSync as statSync4 } from "node:fs";
|
|
30518
|
+
import path33 from "node:path";
|
|
30454
30519
|
var isRecord4 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
30455
30520
|
var nonEmpty2 = (value) => typeof value === "string" && value.trim() !== "";
|
|
30456
30521
|
var optionalText = (value) => typeof value === "string" ? value : null;
|
|
30457
30522
|
var existingDirectory = (value) => {
|
|
30458
|
-
if (!nonEmpty2(value) || !
|
|
30523
|
+
if (!nonEmpty2(value) || !path33.isAbsolute(value) || !existsSync13(value))
|
|
30459
30524
|
return null;
|
|
30460
30525
|
try {
|
|
30461
|
-
return statSync4(value).isDirectory() ?
|
|
30526
|
+
return statSync4(value).isDirectory() ? realpathSync10(value) : null;
|
|
30462
30527
|
} catch {
|
|
30463
30528
|
return null;
|
|
30464
30529
|
}
|
|
@@ -31223,11 +31288,11 @@ if (false) {}
|
|
|
31223
31288
|
// packages/workit-core/src/hooks/budget-signal.ts
|
|
31224
31289
|
import { createHash as createHash12 } from "node:crypto";
|
|
31225
31290
|
import fs20 from "node:fs";
|
|
31226
|
-
import
|
|
31291
|
+
import path34 from "node:path";
|
|
31227
31292
|
var hash2 = (text) => createHash12("sha256").update(text).digest("hex").slice(0, 32);
|
|
31228
|
-
var budgetDir = (store) =>
|
|
31229
|
-
var agentBase = (store, session, agentId) =>
|
|
31230
|
-
var spawnsFile = (store, session) =>
|
|
31293
|
+
var budgetDir = (store) => path34.join(store, "budget");
|
|
31294
|
+
var agentBase = (store, session, agentId) => path34.join(budgetDir(store), hash2(`${session}\x00${agentId ?? ""}`));
|
|
31295
|
+
var spawnsFile = (store, session) => path34.join(budgetDir(store), `spawns-${hash2(session)}.jsonl`);
|
|
31231
31296
|
var spawnBudget = (prompt) => {
|
|
31232
31297
|
const found = /^TIMEBOX:[^\n]*?\b(\d+)\s+tool calls\b/mu.exec(prompt);
|
|
31233
31298
|
const n = found ? Number(found[1]) : NaN;
|
|
@@ -31279,8 +31344,8 @@ var startBudget = (store, session, agentId, n) => {
|
|
|
31279
31344
|
const cutoff = Date.now() - 604800000;
|
|
31280
31345
|
for (const name of fs20.readdirSync(dir))
|
|
31281
31346
|
try {
|
|
31282
|
-
if (fs20.statSync(
|
|
31283
|
-
fs20.rmSync(
|
|
31347
|
+
if (fs20.statSync(path34.join(dir, name)).mtimeMs < cutoff)
|
|
31348
|
+
fs20.rmSync(path34.join(dir, name));
|
|
31284
31349
|
} catch {}
|
|
31285
31350
|
const base = agentBase(store, session, agentId);
|
|
31286
31351
|
fs20.writeFileSync(`${base}.json`, JSON.stringify({ limit: n, told: 0 }));
|
|
@@ -31339,7 +31404,7 @@ if (false)
|
|
|
31339
31404
|
|
|
31340
31405
|
// packages/workit-codex/scripts/agents.ts
|
|
31341
31406
|
import {
|
|
31342
|
-
existsSync as
|
|
31407
|
+
existsSync as existsSync14,
|
|
31343
31408
|
lstatSync as lstatSync5,
|
|
31344
31409
|
mkdirSync as mkdirSync4,
|
|
31345
31410
|
readdirSync as readdirSync4,
|
|
@@ -31348,19 +31413,19 @@ import {
|
|
|
31348
31413
|
rmSync as rmSync2,
|
|
31349
31414
|
writeFileSync as writeFileSync4
|
|
31350
31415
|
} from "node:fs";
|
|
31351
|
-
import
|
|
31352
|
-
import
|
|
31416
|
+
import os7 from "node:os";
|
|
31417
|
+
import path35 from "node:path";
|
|
31353
31418
|
var CODEX_AGENT_ROLES = ["verifier", "reviewer", "implementer"];
|
|
31354
31419
|
var CODEX_AGENT_MARKER = "# Generated by Workit";
|
|
31355
31420
|
var codexAgentName = (role) => `workit-${role}`;
|
|
31356
31421
|
var codexAgentFile = (role) => `${codexAgentName(role)}.toml`;
|
|
31357
31422
|
var tomlString = (value) => JSON.stringify(value);
|
|
31358
31423
|
var codexHomeOfInstall = (pluginRoot) => {
|
|
31359
|
-
const parts =
|
|
31424
|
+
const parts = path35.resolve(pluginRoot).split(path35.sep);
|
|
31360
31425
|
const cache = parts.length - 4;
|
|
31361
|
-
return cache >= 2 && parts[cache] === "cache" && parts[cache - 1] === "plugins" ? parts.slice(0, cache - 1).join(
|
|
31426
|
+
return cache >= 2 && parts[cache] === "cache" && parts[cache - 1] === "plugins" ? parts.slice(0, cache - 1).join(path35.sep) || path35.sep : null;
|
|
31362
31427
|
};
|
|
31363
|
-
var codexHomeFor = (pluginRoot, env) => codexHomeOfInstall(pluginRoot) ?? (env.CODEX_HOME ||
|
|
31428
|
+
var codexHomeFor = (pluginRoot, env) => codexHomeOfInstall(pluginRoot) ?? (env.CODEX_HOME || path35.join(env.HOME || os7.homedir(), ".codex"));
|
|
31364
31429
|
var withRoleModel = (content, file, models) => {
|
|
31365
31430
|
const role = CODEX_AGENT_ROLES.find((candidate) => codexAgentFile(candidate) === file);
|
|
31366
31431
|
const chosen = role ? models[role] : undefined;
|
|
@@ -31383,7 +31448,7 @@ var versionAtLeast = (version, min) => {
|
|
|
31383
31448
|
};
|
|
31384
31449
|
var pluginVersion = (pluginRoot) => {
|
|
31385
31450
|
try {
|
|
31386
|
-
const version = JSON.parse(readFileSync10(
|
|
31451
|
+
const version = JSON.parse(readFileSync10(path35.join(pluginRoot, "package.json"), "utf8")).version;
|
|
31387
31452
|
return typeof version === "string" && /^\d+\.\d+\.\d+/.test(version) ? version.match(/^\d+\.\d+\.\d+/)[0] : null;
|
|
31388
31453
|
} catch {
|
|
31389
31454
|
return null;
|
|
@@ -31397,15 +31462,15 @@ var lstatOrNull = (file) => {
|
|
|
31397
31462
|
}
|
|
31398
31463
|
};
|
|
31399
31464
|
var installCodexAgents = (pluginRoot, codexHome, models = {}) => {
|
|
31400
|
-
const source =
|
|
31401
|
-
if (!
|
|
31465
|
+
const source = path35.join(pluginRoot, "agents");
|
|
31466
|
+
if (!existsSync14(source))
|
|
31402
31467
|
return [];
|
|
31403
31468
|
const version = pluginVersion(pluginRoot);
|
|
31404
|
-
const target =
|
|
31469
|
+
const target = path35.join(codexHome, "agents");
|
|
31405
31470
|
const results = [];
|
|
31406
31471
|
for (const file of readdirSync4(source).filter((name) => name.endsWith(".toml")).toSorted()) {
|
|
31407
|
-
const content = withRoleModel(stampCodexAgent(readFileSync10(
|
|
31408
|
-
const dest =
|
|
31472
|
+
const content = withRoleModel(stampCodexAgent(readFileSync10(path35.join(source, file), "utf8"), version), file, models);
|
|
31473
|
+
const dest = path35.join(target, file);
|
|
31409
31474
|
const stat = lstatOrNull(dest);
|
|
31410
31475
|
if (stat?.isSymbolicLink()) {
|
|
31411
31476
|
results.push({ file: dest, action: "skipped-symlink" });
|
|
@@ -31441,7 +31506,7 @@ var installCodexAgents = (pluginRoot, codexHome, models = {}) => {
|
|
|
31441
31506
|
results.push({ file: dest, action: "kept-newer-version" });
|
|
31442
31507
|
continue;
|
|
31443
31508
|
}
|
|
31444
|
-
const temp =
|
|
31509
|
+
const temp = path35.join(target, `.${file}.${process.pid}.${Date.now()}.tmp`);
|
|
31445
31510
|
writeFileSync4(temp, content, { flag: "wx" });
|
|
31446
31511
|
try {
|
|
31447
31512
|
renameSync3(temp, dest);
|
|
@@ -31463,14 +31528,14 @@ var codexQualification = (host) => host === "codex_cli" ? { surface: host, cli:
|
|
|
31463
31528
|
var resolveCodexWorkspaceRoot = (pluginRoot, env) => {
|
|
31464
31529
|
const explicit = env.WORKIT_WORKSPACE_ROOT;
|
|
31465
31530
|
const inherited = env.PWD;
|
|
31466
|
-
const candidate = explicit ?? (inherited &&
|
|
31467
|
-
if (!candidate || !
|
|
31531
|
+
const candidate = explicit ?? (inherited && path36.resolve(inherited) !== path36.resolve(pluginRoot) ? inherited : undefined);
|
|
31532
|
+
if (!candidate || !path36.isAbsolute(candidate) || !existsSync15(candidate))
|
|
31468
31533
|
return null;
|
|
31469
31534
|
try {
|
|
31470
31535
|
if (!statSync5(candidate).isDirectory())
|
|
31471
31536
|
return null;
|
|
31472
|
-
const canonical =
|
|
31473
|
-
if (canonical ===
|
|
31537
|
+
const canonical = realpathSync11(candidate);
|
|
31538
|
+
if (canonical === realpathSync11(pluginRoot)) {
|
|
31474
31539
|
if (!explicit)
|
|
31475
31540
|
return null;
|
|
31476
31541
|
const workspace = new TaskStore(canonical).readWorkspace();
|
|
@@ -31503,7 +31568,7 @@ var codexContextProvider = (host = detectCodexSurface(process.env), root) => ({
|
|
|
31503
31568
|
};
|
|
31504
31569
|
}
|
|
31505
31570
|
});
|
|
31506
|
-
var pluginRoot = () =>
|
|
31571
|
+
var pluginRoot = () => path36.resolve(path36.dirname(fileURLToPath3(import.meta.url)), "..");
|
|
31507
31572
|
var codexRoleModels = (cwd) => {
|
|
31508
31573
|
const out = {};
|
|
31509
31574
|
for (const role of ["verifier", "reviewer"]) {
|