@workit-dev/codex 1.8.0 → 1.8.2
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
|
@@ -6626,7 +6626,7 @@ import path37 from "node:path";
|
|
|
6626
6626
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
6627
6627
|
|
|
6628
6628
|
// packages/workit-core/src/core.ts
|
|
6629
|
-
import { spawnSync as
|
|
6629
|
+
import { spawnSync as spawnSync20 } from "node:child_process";
|
|
6630
6630
|
import { existsSync as existsSync11, realpathSync as realpathSync8 } from "node:fs";
|
|
6631
6631
|
import path30 from "node:path";
|
|
6632
6632
|
|
|
@@ -14325,15 +14325,14 @@ var gitContext = (workspaceRoot, paths = []) => {
|
|
|
14325
14325
|
};
|
|
14326
14326
|
|
|
14327
14327
|
// packages/workit-core/src/core/workspaces.ts
|
|
14328
|
-
import { spawnSync as
|
|
14328
|
+
import { spawnSync as spawnSync6 } from "node:child_process";
|
|
14329
14329
|
import { createHash as createHash3 } from "node:crypto";
|
|
14330
|
-
import { existsSync as existsSync2, lstatSync as lstatSync2, readFileSync as
|
|
14330
|
+
import { existsSync as existsSync2, lstatSync as lstatSync2, readFileSync as readFileSync4, realpathSync as realpathSync2 } from "node:fs";
|
|
14331
14331
|
import path7 from "node:path";
|
|
14332
14332
|
|
|
14333
14333
|
// packages/workit-core/src/core/remotes.ts
|
|
14334
|
-
import { lstatSync, readFileSync as
|
|
14335
|
-
import { spawnSync as
|
|
14336
|
-
import os3 from "node:os";
|
|
14334
|
+
import { lstatSync, readFileSync as readFileSync3, realpathSync, statSync } from "node:fs";
|
|
14335
|
+
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
14337
14336
|
import path6 from "node:path";
|
|
14338
14337
|
|
|
14339
14338
|
// packages/workit-core/src/git/rev.ts
|
|
@@ -15156,6 +15155,56 @@ function resolveSshHost(alias, sshConfig) {
|
|
|
15156
15155
|
return { hostname: (hostname ?? alias).replace(/\.$/u, ""), port };
|
|
15157
15156
|
}
|
|
15158
15157
|
|
|
15158
|
+
// packages/workit-core/src/core/account-home.ts
|
|
15159
|
+
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
15160
|
+
import { readFileSync as readFileSync2 } from "node:fs";
|
|
15161
|
+
import os3 from "node:os";
|
|
15162
|
+
var WINDOWS = "C:\\Windows";
|
|
15163
|
+
var SYSTEM32 = `${WINDOWS}\\System32\\`;
|
|
15164
|
+
var PROFILES = "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\";
|
|
15165
|
+
var childEnv = (platform) => platform === "win32" ? { SystemRoot: WINDOWS } : {};
|
|
15166
|
+
var hostIo = {
|
|
15167
|
+
bun: Boolean(process.versions.bun),
|
|
15168
|
+
uid: process.getuid?.() ?? -1,
|
|
15169
|
+
userInfo: () => os3.userInfo().homedir,
|
|
15170
|
+
passwd: () => readFileSync2("/etc/passwd", "utf8"),
|
|
15171
|
+
run: (file, args) => {
|
|
15172
|
+
const done = spawnSync4(file, args, {
|
|
15173
|
+
encoding: "utf8",
|
|
15174
|
+
env: childEnv(process.platform),
|
|
15175
|
+
timeout: 3000,
|
|
15176
|
+
windowsHide: true
|
|
15177
|
+
});
|
|
15178
|
+
return done.status === 0 ? done.stdout : "";
|
|
15179
|
+
}
|
|
15180
|
+
};
|
|
15181
|
+
var field = (text, uid, at) => text.split(`
|
|
15182
|
+
`).filter((line) => !line.startsWith("#")).map((line) => line.split(":")).find((fields) => fields[2] === uid)?.[at];
|
|
15183
|
+
var profilePath = (raw) => {
|
|
15184
|
+
const value = raw.replaceAll(/%SystemDrive%/giu, WINDOWS.slice(0, 2)).replaceAll(/%SystemRoot%/giu, WINDOWS);
|
|
15185
|
+
return /^[A-Za-z]:\\/u.test(value) && !value.includes("%") ? value : null;
|
|
15186
|
+
};
|
|
15187
|
+
var accountHome = (platform = process.platform, io = hostIo) => {
|
|
15188
|
+
try {
|
|
15189
|
+
if (!io.bun)
|
|
15190
|
+
return io.userInfo() || null;
|
|
15191
|
+
if (platform === "win32") {
|
|
15192
|
+
const sid = /S-1-[\d-]+/u.exec(io.run(`${SYSTEM32}whoami.exe`, ["/user", "/fo", "csv"]));
|
|
15193
|
+
const key = sid && io.run(`${SYSTEM32}reg.exe`, ["query", PROFILES + sid[0], "/v", "ProfileImagePath"]);
|
|
15194
|
+
const raw = /ProfileImagePath\s+REG_\w+\s+(.+)/u.exec(key || "")?.[1]?.trim();
|
|
15195
|
+
return raw ? profilePath(raw) : null;
|
|
15196
|
+
}
|
|
15197
|
+
const uid = String(io.uid);
|
|
15198
|
+
let passwd = "";
|
|
15199
|
+
try {
|
|
15200
|
+
passwd = io.passwd();
|
|
15201
|
+
} catch {}
|
|
15202
|
+
return field(passwd, uid, 5) || (platform === "darwin" ? field(io.run("/usr/bin/id", ["-P"]), uid, 8) : field(io.run("/usr/bin/getent", ["passwd", uid]), uid, 5)) || null;
|
|
15203
|
+
} catch {
|
|
15204
|
+
return null;
|
|
15205
|
+
}
|
|
15206
|
+
};
|
|
15207
|
+
|
|
15159
15208
|
// packages/workit-core/src/core/remotes.ts
|
|
15160
15209
|
var FORGE_SCHEMES = new Set(["ssh", "git", "http", "https", "git+ssh", "ssh+git"]);
|
|
15161
15210
|
var SSH_SCHEMES = new Set(["ssh", "git+ssh", "ssh+git"]);
|
|
@@ -15165,15 +15214,11 @@ var SSH_443 = {
|
|
|
15165
15214
|
};
|
|
15166
15215
|
var WINDOWS_DRIVE = /^[A-Za-z]:[\\/]/u;
|
|
15167
15216
|
var SCP_LIKE = /^(?:[^@/\\]+@)?([^/\\:]+):(.+)$/u;
|
|
15168
|
-
var accountHome = () => {
|
|
15169
|
-
try {
|
|
15170
|
-
return os3.userInfo().homedir;
|
|
15171
|
-
} catch {
|
|
15172
|
-
return os3.homedir();
|
|
15173
|
-
}
|
|
15174
|
-
};
|
|
15175
15217
|
var sshSeam = {
|
|
15176
|
-
read: () =>
|
|
15218
|
+
read: () => {
|
|
15219
|
+
const home = accountHome();
|
|
15220
|
+
return home === null ? { text: "", home: "" } : readSshConfig(home);
|
|
15221
|
+
}
|
|
15177
15222
|
};
|
|
15178
15223
|
var forgeKey = (rawHost, repo, ssh) => {
|
|
15179
15224
|
let host = rawHost.toLowerCase().replace(/\.$/u, "");
|
|
@@ -15220,7 +15265,7 @@ var gitDirAt = (at, depth = 0) => {
|
|
|
15220
15265
|
return null;
|
|
15221
15266
|
try {
|
|
15222
15267
|
if (statSync(real).isFile()) {
|
|
15223
|
-
const pointer = /^gitdir:\s*(.+?)\s*$/mu.exec(
|
|
15268
|
+
const pointer = /^gitdir:\s*(.+?)\s*$/mu.exec(readFileSync3(real, "utf8"))?.[1];
|
|
15224
15269
|
if (!pointer)
|
|
15225
15270
|
return null;
|
|
15226
15271
|
const target = path6.isAbsolute(pointer) ? pointer : `${path6.dirname(real)}/${pointer}`;
|
|
@@ -15228,7 +15273,7 @@ var gitDirAt = (at, depth = 0) => {
|
|
|
15228
15273
|
}
|
|
15229
15274
|
let common;
|
|
15230
15275
|
try {
|
|
15231
|
-
common =
|
|
15276
|
+
common = readFileSync3(`${real}/commondir`, "utf8").trim();
|
|
15232
15277
|
} catch {}
|
|
15233
15278
|
if (common !== undefined) {
|
|
15234
15279
|
lstatSync(`${real}/HEAD`);
|
|
@@ -15332,7 +15377,7 @@ var checkoutRemotes = (cwd) => {
|
|
|
15332
15377
|
const env = { ...process.env };
|
|
15333
15378
|
for (const name of ["GIT_DIR", "GIT_WORK_TREE", "GIT_COMMON_DIR", "GIT_INDEX_FILE"])
|
|
15334
15379
|
delete env[name];
|
|
15335
|
-
const git = (args) =>
|
|
15380
|
+
const git = (args) => spawnSync5("git", args, {
|
|
15336
15381
|
cwd,
|
|
15337
15382
|
env,
|
|
15338
15383
|
encoding: "utf8",
|
|
@@ -15568,7 +15613,7 @@ var readWorkspacesResult = (dir = configDir2()) => {
|
|
|
15568
15613
|
const file = path7.join(dir, "workspaces.json");
|
|
15569
15614
|
let raw;
|
|
15570
15615
|
try {
|
|
15571
|
-
raw =
|
|
15616
|
+
raw = readFileSync4(file, "utf8");
|
|
15572
15617
|
} catch (error) {
|
|
15573
15618
|
if (error.code === "ENOENT")
|
|
15574
15619
|
return {
|
|
@@ -15689,7 +15734,7 @@ var probeCheckout = (cwd) => {
|
|
|
15689
15734
|
for (const name of ["GIT_DIR", "GIT_WORK_TREE", "GIT_COMMON_DIR", "GIT_INDEX_FILE"])
|
|
15690
15735
|
delete env[name];
|
|
15691
15736
|
const git = (args) => {
|
|
15692
|
-
const run =
|
|
15737
|
+
const run = spawnSync6("git", args, {
|
|
15693
15738
|
cwd,
|
|
15694
15739
|
env,
|
|
15695
15740
|
encoding: "utf8",
|
|
@@ -15886,7 +15931,7 @@ var matchRuntimeWorkspace = (cwd, dir = configDir2()) => {
|
|
|
15886
15931
|
const file = path7.join(dir, "workspaces.json");
|
|
15887
15932
|
let raw;
|
|
15888
15933
|
try {
|
|
15889
|
-
raw =
|
|
15934
|
+
raw = readFileSync4(file, "utf8");
|
|
15890
15935
|
} catch (error) {
|
|
15891
15936
|
if (error.code === "ENOENT")
|
|
15892
15937
|
return null;
|
|
@@ -15937,7 +15982,7 @@ var modelSources = (cwd, dir) => {
|
|
|
15937
15982
|
}
|
|
15938
15983
|
} catch {}
|
|
15939
15984
|
try {
|
|
15940
|
-
const document = JSON.parse(
|
|
15985
|
+
const document = JSON.parse(readFileSync4(path7.join(dir ?? configDir2(), "workspaces.json"), "utf8"));
|
|
15941
15986
|
if (document && typeof document === "object" && !Array.isArray(document))
|
|
15942
15987
|
out.push({
|
|
15943
15988
|
name: "global",
|
|
@@ -16003,11 +16048,11 @@ function workspaceDefaultTarget(cwd, globalDefault) {
|
|
|
16003
16048
|
// packages/workit-core/src/core/vcs-config.ts
|
|
16004
16049
|
import fs4 from "node:fs";
|
|
16005
16050
|
import path8 from "node:path";
|
|
16006
|
-
import { spawnSync as
|
|
16051
|
+
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
16007
16052
|
|
|
16008
16053
|
// packages/workit-core/src/core/release-tracks.ts
|
|
16009
16054
|
import { createHash as createHash4 } from "node:crypto";
|
|
16010
|
-
import { spawnSync as
|
|
16055
|
+
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
16011
16056
|
var KNOWN_FIELDS = new Set([
|
|
16012
16057
|
"strategy",
|
|
16013
16058
|
"productionBranch",
|
|
@@ -16279,7 +16324,7 @@ function resolveReleaseTrack(input) {
|
|
|
16279
16324
|
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 ")}`);
|
|
16280
16325
|
}
|
|
16281
16326
|
var git2 = (cwd, args) => {
|
|
16282
|
-
const run =
|
|
16327
|
+
const run = spawnSync7("git", args, {
|
|
16283
16328
|
cwd,
|
|
16284
16329
|
encoding: "utf8",
|
|
16285
16330
|
timeout: 20000,
|
|
@@ -16428,7 +16473,7 @@ var remoteEndpoint = (remote) => {
|
|
|
16428
16473
|
var configuredSshEndpoint = (host) => {
|
|
16429
16474
|
if (host.startsWith("-"))
|
|
16430
16475
|
return null;
|
|
16431
|
-
const resolved =
|
|
16476
|
+
const resolved = spawnSync8("ssh", ["-G", host], {
|
|
16432
16477
|
encoding: "utf8",
|
|
16433
16478
|
timeout: 5000,
|
|
16434
16479
|
maxBuffer: 1024 * 1024,
|
|
@@ -16642,7 +16687,7 @@ function mergedPrStyle(limit = 6, cwd) {
|
|
|
16642
16687
|
`).filter((l) => l.startsWith("## ")).map((l) => l.trim()),
|
|
16643
16688
|
descriptionPreview: desc.slice(0, 600)
|
|
16644
16689
|
});
|
|
16645
|
-
const remoteResult =
|
|
16690
|
+
const remoteResult = spawnSync8("git", ["remote", "get-url", "--push", "--all", "origin"], {
|
|
16646
16691
|
cwd,
|
|
16647
16692
|
encoding: "utf8"
|
|
16648
16693
|
});
|
|
@@ -16658,7 +16703,7 @@ function mergedPrStyle(limit = 6, cwd) {
|
|
|
16658
16703
|
if (!hostingApiHostMatches(remote, host))
|
|
16659
16704
|
return { ok: false, error: "PR style target does not match the provider host" };
|
|
16660
16705
|
if (provider === "gitlab") {
|
|
16661
|
-
const run = (args) =>
|
|
16706
|
+
const run = (args) => spawnSync8("glab", ["api", ...args], {
|
|
16662
16707
|
cwd,
|
|
16663
16708
|
encoding: "utf8",
|
|
16664
16709
|
env
|
|
@@ -16678,7 +16723,7 @@ function mergedPrStyle(limit = 6, cwd) {
|
|
|
16678
16723
|
});
|
|
16679
16724
|
}
|
|
16680
16725
|
} else if (provider === "github") {
|
|
16681
|
-
const r =
|
|
16726
|
+
const r = spawnSync8("gh", [
|
|
16682
16727
|
"pr",
|
|
16683
16728
|
"list",
|
|
16684
16729
|
"--repo",
|
|
@@ -16769,13 +16814,13 @@ var applyPatterns = (value) => {
|
|
|
16769
16814
|
var redactSecrets = (value) => applyPatterns(value);
|
|
16770
16815
|
|
|
16771
16816
|
// packages/workit-core/src/store/paths.ts
|
|
16772
|
-
import { spawnSync as
|
|
16817
|
+
import { spawnSync as spawnSync9 } from "node:child_process";
|
|
16773
16818
|
import { createHash as createHash5 } from "node:crypto";
|
|
16774
16819
|
import fs5 from "node:fs";
|
|
16775
16820
|
import path9 from "node:path";
|
|
16776
16821
|
var NOT_A_REPO = /not a git repository \(or any (of the parent directories|parent up to)/u;
|
|
16777
16822
|
var gitRun = (cwd, args) => {
|
|
16778
|
-
const run =
|
|
16823
|
+
const run = spawnSync9("git", args, {
|
|
16779
16824
|
cwd,
|
|
16780
16825
|
encoding: "utf8",
|
|
16781
16826
|
timeout: 20000,
|
|
@@ -18199,7 +18244,7 @@ var assetRoot = () => {
|
|
|
18199
18244
|
};
|
|
18200
18245
|
|
|
18201
18246
|
// packages/workit-core/src/core/store-lock.ts
|
|
18202
|
-
import { spawnSync as
|
|
18247
|
+
import { spawnSync as spawnSync10 } from "node:child_process";
|
|
18203
18248
|
import fs11 from "node:fs";
|
|
18204
18249
|
import { hostname } from "node:os";
|
|
18205
18250
|
var metadataLockSchema = object({
|
|
@@ -18250,7 +18295,7 @@ var readProcStat = (pid) => {
|
|
|
18250
18295
|
};
|
|
18251
18296
|
var psStart = (pid) => {
|
|
18252
18297
|
try {
|
|
18253
|
-
const run =
|
|
18298
|
+
const run = spawnSync10("ps", ["-o", "lstart=", "-p", String(pid)], {
|
|
18254
18299
|
encoding: "utf8",
|
|
18255
18300
|
timeout: 1000,
|
|
18256
18301
|
env: { ...process.env, LC_ALL: "C" }
|
|
@@ -20258,11 +20303,11 @@ var workerBlocksTransition = (transition, state) => transition === "pause" ? fal
|
|
|
20258
20303
|
// packages/workit-core/src/core/task-evaluation.ts
|
|
20259
20304
|
import { createHash as createHash10 } from "node:crypto";
|
|
20260
20305
|
import * as fs17 from "node:fs";
|
|
20261
|
-
import { spawnSync as
|
|
20306
|
+
import { spawnSync as spawnSync15 } from "node:child_process";
|
|
20262
20307
|
import path22 from "node:path";
|
|
20263
20308
|
|
|
20264
20309
|
// packages/workit-core/src/check-config.ts
|
|
20265
|
-
import { spawnSync as
|
|
20310
|
+
import { spawnSync as spawnSync11 } from "node:child_process";
|
|
20266
20311
|
import fs14 from "node:fs";
|
|
20267
20312
|
import path17 from "node:path";
|
|
20268
20313
|
var SCRIPT_CHECKS = ["test", "lint", "typecheck", "check"];
|
|
@@ -20317,7 +20362,7 @@ function splitCommand(command) {
|
|
|
20317
20362
|
return argv.length ? argv : new Error("empty command");
|
|
20318
20363
|
}
|
|
20319
20364
|
var git3 = (cwd, args) => {
|
|
20320
|
-
const run =
|
|
20365
|
+
const run = spawnSync11("git", args, {
|
|
20321
20366
|
cwd,
|
|
20322
20367
|
encoding: "utf8",
|
|
20323
20368
|
timeout: 20000,
|
|
@@ -20610,19 +20655,19 @@ import { existsSync as existsSync7 } from "node:fs";
|
|
|
20610
20655
|
import path21 from "node:path";
|
|
20611
20656
|
|
|
20612
20657
|
// packages/workit-core/src/ledger.ts
|
|
20613
|
-
import { spawnSync as
|
|
20658
|
+
import { spawnSync as spawnSync14 } from "node:child_process";
|
|
20614
20659
|
import { createHash as createHash9, randomBytes as randomBytes3 } from "node:crypto";
|
|
20615
20660
|
import fs16 from "node:fs";
|
|
20616
20661
|
import path20 from "node:path";
|
|
20617
20662
|
|
|
20618
20663
|
// packages/workit-core/src/core/policy/bookkeeping.ts
|
|
20619
|
-
import { spawnSync as
|
|
20664
|
+
import { spawnSync as spawnSync12 } from "node:child_process";
|
|
20620
20665
|
var OID = /^[0-9a-f]{40,64}$/u;
|
|
20621
20666
|
var safe = (value) => value.length > 0 && !value.startsWith("-");
|
|
20622
20667
|
function replayTree(cwd, from, fromFork, toFork) {
|
|
20623
20668
|
if (![from, fromFork, toFork].every(safe))
|
|
20624
20669
|
return null;
|
|
20625
|
-
const run =
|
|
20670
|
+
const run = spawnSync12("git", ["merge-tree", "--write-tree", "--no-messages", `--merge-base=${fromFork}`, toFork, from], {
|
|
20626
20671
|
cwd,
|
|
20627
20672
|
encoding: "utf8",
|
|
20628
20673
|
timeout: GIT_TIMEOUTS.worktree,
|
|
@@ -20693,11 +20738,11 @@ function bookkeepingPaths(cwd, input) {
|
|
|
20693
20738
|
}
|
|
20694
20739
|
|
|
20695
20740
|
// packages/workit-core/src/core/policy/lane.ts
|
|
20696
|
-
import { existsSync as existsSync6, readFileSync as
|
|
20741
|
+
import { existsSync as existsSync6, readFileSync as readFileSync7 } from "node:fs";
|
|
20697
20742
|
import path18 from "node:path";
|
|
20698
20743
|
|
|
20699
20744
|
// packages/workit-core/src/git/default-base.ts
|
|
20700
|
-
import { spawnSync as
|
|
20745
|
+
import { spawnSync as spawnSync13 } from "node:child_process";
|
|
20701
20746
|
var safeRef = (value) => value.length > 0 && !value.startsWith("-");
|
|
20702
20747
|
var trackTrunk = (cwd) => {
|
|
20703
20748
|
try {
|
|
@@ -20747,7 +20792,7 @@ var shorten = (table, full) => {
|
|
|
20747
20792
|
return full;
|
|
20748
20793
|
};
|
|
20749
20794
|
function refTable(cwd) {
|
|
20750
|
-
const run =
|
|
20795
|
+
const run = spawnSync13("git", ["for-each-ref", "--format=%(refname)%00%(objecttype)%00%(*objecttype)%00%(symref)"], { cwd, encoding: "utf8", timeout: 20000, killSignal: "SIGKILL", windowsHide: true });
|
|
20751
20796
|
if (run.status !== 0)
|
|
20752
20797
|
return null;
|
|
20753
20798
|
const refs = new Map;
|
|
@@ -21348,7 +21393,7 @@ function computeLane(input) {
|
|
|
21348
21393
|
}
|
|
21349
21394
|
function untrackedStat(cwd, file) {
|
|
21350
21395
|
try {
|
|
21351
|
-
const bytes =
|
|
21396
|
+
const bytes = readFileSync7(path18.join(cwd, file));
|
|
21352
21397
|
if (bytes.includes(0))
|
|
21353
21398
|
return { path: file, added: 0, deleted: 0, binary: true };
|
|
21354
21399
|
const text = bytes.toString("utf8");
|
|
@@ -21379,7 +21424,7 @@ function cosmeticFiles(cwd, fork, head) {
|
|
|
21379
21424
|
let after = blobs.get(entry.newBlob);
|
|
21380
21425
|
if (!after && head === null && ABSENT.test(entry.newBlob))
|
|
21381
21426
|
try {
|
|
21382
|
-
after =
|
|
21427
|
+
after = readFileSync7(path18.join(cwd, entry.path));
|
|
21383
21428
|
} catch {
|
|
21384
21429
|
after = undefined;
|
|
21385
21430
|
}
|
|
@@ -21572,7 +21617,7 @@ var err = (code, error, unblock) => ({
|
|
|
21572
21617
|
...unblock ? { unblock } : {}
|
|
21573
21618
|
});
|
|
21574
21619
|
var gitRun2 = (cwd, args, timeoutMs = GIT_TIMEOUTS.local) => {
|
|
21575
|
-
const run =
|
|
21620
|
+
const run = spawnSync14("git", args, {
|
|
21576
21621
|
cwd,
|
|
21577
21622
|
encoding: "utf8",
|
|
21578
21623
|
timeout: timeoutMs,
|
|
@@ -22873,7 +22918,7 @@ var compareCodeUnits2 = (left, right) => {
|
|
|
22873
22918
|
return left.length - right.length;
|
|
22874
22919
|
};
|
|
22875
22920
|
var gitPaths = (root) => {
|
|
22876
|
-
const result =
|
|
22921
|
+
const result = spawnSync15("git", ["ls-files", "-z", "--cached", "--others", "--exclude-standard"], {
|
|
22877
22922
|
cwd: root,
|
|
22878
22923
|
encoding: "buffer"
|
|
22879
22924
|
});
|
|
@@ -22886,7 +22931,7 @@ var gitPaths = (root) => {
|
|
|
22886
22931
|
};
|
|
22887
22932
|
}
|
|
22888
22933
|
const paths = result.stdout ? result.stdout.toString("utf8").split("\x00").filter(Boolean).map((item) => item.split(path22.sep).join("/")) : [];
|
|
22889
|
-
const stagedDeleted =
|
|
22934
|
+
const stagedDeleted = spawnSync15("git", ["diff", "--cached", "--name-only", "--diff-filter=D", "-z"], { cwd: root, encoding: "buffer" });
|
|
22890
22935
|
if (stagedDeleted.status !== 0) {
|
|
22891
22936
|
const stderr = stagedDeleted.stderr?.toString("utf8") ?? "";
|
|
22892
22937
|
if (!/not a git repository/i.test(stderr))
|
|
@@ -23017,7 +23062,7 @@ function captureCandidate(root, scope, environment = []) {
|
|
|
23017
23062
|
const values = supplied.toSorted((left, right) => compareCodeUnits2(left.name, right.name)).map(({ name, value }) => ({ name, value, refs: [] }));
|
|
23018
23063
|
if (values.some(({ value }) => value === null))
|
|
23019
23064
|
completeness = "uncertain";
|
|
23020
|
-
const headResult =
|
|
23065
|
+
const headResult = spawnSync15("git", ["rev-parse", "HEAD"], { cwd: checkout, encoding: "utf8" });
|
|
23021
23066
|
if (headResult.status !== 0 && !/not a git repository/i.test(headResult.stderr ?? ""))
|
|
23022
23067
|
completeness = "uncertain";
|
|
23023
23068
|
const head = headResult.status === 0 ? headResult.stdout.trim() : null;
|
|
@@ -23547,7 +23592,7 @@ function briefInspectResult(request, result) {
|
|
|
23547
23592
|
}
|
|
23548
23593
|
|
|
23549
23594
|
// packages/workit-core/src/core/model-fallback.ts
|
|
23550
|
-
import { mkdirSync as mkdirSync4, readFileSync as
|
|
23595
|
+
import { mkdirSync as mkdirSync4, readFileSync as readFileSync9, renameSync as renameSync3, writeFileSync as writeFileSync4 } from "node:fs";
|
|
23551
23596
|
import path23 from "node:path";
|
|
23552
23597
|
var LIMITS_FILE = "model-limits.json";
|
|
23553
23598
|
var DEFAULT_LIMIT_WINDOW_MS = 5 * 3600000;
|
|
@@ -23574,7 +23619,7 @@ var empty = () => ({ exhausted: {}, seen: {}, redispatched: {} });
|
|
|
23574
23619
|
var storePath = (stateDir) => path23.join(stateDir ?? resolveStateDir(), LIMITS_FILE);
|
|
23575
23620
|
var readStore = (stateDir) => {
|
|
23576
23621
|
try {
|
|
23577
|
-
const parsed = JSON.parse(
|
|
23622
|
+
const parsed = JSON.parse(readFileSync9(storePath(stateDir), "utf8"));
|
|
23578
23623
|
const store = empty();
|
|
23579
23624
|
for (const key of ["exhausted", "seen", "redispatched"])
|
|
23580
23625
|
if (parsed[key] && typeof parsed[key] === "object")
|
|
@@ -23980,7 +24025,6 @@ var exportDigest = (bundle) => sha256({
|
|
|
23980
24025
|
task: bundle.task
|
|
23981
24026
|
});
|
|
23982
24027
|
// packages/workit-core/src/autonomy.ts
|
|
23983
|
-
import os6 from "node:os";
|
|
23984
24028
|
import path25 from "node:path";
|
|
23985
24029
|
|
|
23986
24030
|
// packages/workit-core/src/core/eval-world.ts
|
|
@@ -23993,30 +24037,43 @@ var inside2 = (dir, file) => {
|
|
|
23993
24037
|
const rel = path24.relative(dir, file);
|
|
23994
24038
|
return !rel.startsWith("..") && !path24.isAbsolute(rel);
|
|
23995
24039
|
};
|
|
23996
|
-
var
|
|
24040
|
+
var evalWorld = (cwd) => {
|
|
23997
24041
|
const raw = process.env[EVAL_WORLD_ENV];
|
|
23998
24042
|
if (!raw || !path24.isAbsolute(raw))
|
|
23999
24043
|
return null;
|
|
24000
24044
|
try {
|
|
24001
24045
|
const world = realpathSync5(raw);
|
|
24002
|
-
|
|
24003
|
-
return null;
|
|
24004
|
-
return loadWorkspacesFrom(path24.join(world, "config"))[0] ?? null;
|
|
24046
|
+
return inside2(realpathSync5(os5.tmpdir()), world) && inside2(world, realpathSync5(cwd)) && existsSync9(path24.join(world, EVAL_WORLD_MARKER)) ? world : null;
|
|
24005
24047
|
} catch {
|
|
24006
24048
|
return null;
|
|
24007
24049
|
}
|
|
24008
24050
|
};
|
|
24009
|
-
|
|
24010
|
-
|
|
24011
|
-
var accountHome2 = () => {
|
|
24051
|
+
var evalWorldEntry = (cwd) => {
|
|
24052
|
+
const world = evalWorld(cwd);
|
|
24012
24053
|
try {
|
|
24013
|
-
return
|
|
24054
|
+
return world ? loadWorkspacesFrom(path24.join(world, "config"))[0] ?? null : null;
|
|
24014
24055
|
} catch {
|
|
24015
|
-
return
|
|
24056
|
+
return null;
|
|
24016
24057
|
}
|
|
24017
24058
|
};
|
|
24018
|
-
|
|
24019
|
-
|
|
24059
|
+
|
|
24060
|
+
// packages/workit-core/src/autonomy.ts
|
|
24061
|
+
var grantsHome = { resolve: accountHome };
|
|
24062
|
+
var accountDir = () => {
|
|
24063
|
+
const home = grantsHome.resolve();
|
|
24064
|
+
return home === null ? null : configDir({ HOME: home });
|
|
24065
|
+
};
|
|
24066
|
+
var grantsDir = () => accountDir() ?? resolveConfigDir();
|
|
24067
|
+
var NO_ACCOUNT = "no OS account record answered (core/account-home.ts), so no grants are read: the D4 defaults apply";
|
|
24068
|
+
var entriesIn = (dir) => dir === null ? [] : loadWorkspacesFrom(dir);
|
|
24069
|
+
var resolveFrom = (cwd, name) => {
|
|
24070
|
+
const dir = accountDir();
|
|
24071
|
+
return dir === null ? null : resolveWorkspaceFrom(cwd, dir, name);
|
|
24072
|
+
};
|
|
24073
|
+
var shownGrantsDir = () => {
|
|
24074
|
+
const world = evalWorld(process.cwd());
|
|
24075
|
+
return world ? path25.join(world, "config") : accountDir();
|
|
24076
|
+
};
|
|
24020
24077
|
var benchWorld = (cwd) => {
|
|
24021
24078
|
const entry = evalWorldEntry(cwd);
|
|
24022
24079
|
if (!entry)
|
|
@@ -24036,8 +24093,11 @@ var benchWorld = (cwd) => {
|
|
|
24036
24093
|
};
|
|
24037
24094
|
};
|
|
24038
24095
|
var grantsOverride = () => {
|
|
24096
|
+
const shown = shownGrantsDir();
|
|
24097
|
+
if (shown === null)
|
|
24098
|
+
return NO_ACCOUNT;
|
|
24039
24099
|
const configured = path25.resolve(resolveConfigDir());
|
|
24040
|
-
return configured === path25.resolve(
|
|
24100
|
+
return configured === path25.resolve(shown) ? 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 ${path25.join(grantsDir(), "workspaces.json")}, so the D4 defaults apply until grants are set there`;
|
|
24041
24101
|
};
|
|
24042
24102
|
var GRANT_KINDS = ["push", "pr", "merge", "release", "rerun"];
|
|
24043
24103
|
var DEFAULT_GRANTS = Object.freeze({
|
|
@@ -24163,7 +24223,7 @@ function capAt(named, where, by, why, main = false) {
|
|
|
24163
24223
|
try {
|
|
24164
24224
|
if (where instanceof Error)
|
|
24165
24225
|
throw where;
|
|
24166
|
-
folder = autonomyOf(typeof where === "string" ?
|
|
24226
|
+
folder = autonomyOf(typeof where === "string" ? resolveFrom(where) : where.entry);
|
|
24167
24227
|
} catch (error) {
|
|
24168
24228
|
none = error.message;
|
|
24169
24229
|
}
|
|
@@ -24207,7 +24267,10 @@ function resolveAutonomy(cwd, target) {
|
|
|
24207
24267
|
if (override)
|
|
24208
24268
|
return { ...autonomyOf(null), note: override };
|
|
24209
24269
|
const name = process.env.WORKIT_WORKSPACE_NAME?.trim() || undefined;
|
|
24210
|
-
|
|
24270
|
+
const real = resolveFrom(cwd, name);
|
|
24271
|
+
let autonomy = autonomyOf(real ?? world);
|
|
24272
|
+
if (!real && world)
|
|
24273
|
+
autonomy.world = evalWorld(cwd) ?? undefined;
|
|
24211
24274
|
if (name)
|
|
24212
24275
|
autonomy = capAt(autonomy, cwd, `WORKIT_WORKSPACE_NAME=${name}`, "a name never raises grants");
|
|
24213
24276
|
const above = checkoutsAbove(cwd);
|
|
@@ -24216,7 +24279,7 @@ function resolveAutonomy(cwd, target) {
|
|
|
24216
24279
|
return capAtRemotes(autonomy, cwd, target);
|
|
24217
24280
|
}
|
|
24218
24281
|
function capAtRemotes(autonomy, cwd, target) {
|
|
24219
|
-
const claiming =
|
|
24282
|
+
const claiming = entriesIn(accountDir()).filter((entry) => entry.remotes?.length);
|
|
24220
24283
|
if (claiming.length === 0)
|
|
24221
24284
|
return autonomy;
|
|
24222
24285
|
const remotes = target === undefined ? checkoutRemotes(cwd) : typeof target === "function" ? target() : target;
|
|
@@ -26330,8 +26393,8 @@ class WorkitCore {
|
|
|
26330
26393
|
}
|
|
26331
26394
|
}
|
|
26332
26395
|
// packages/workit-core/src/core/repo-context.ts
|
|
26333
|
-
import { spawnSync as
|
|
26334
|
-
import { existsSync as existsSync10, readFileSync as
|
|
26396
|
+
import { spawnSync as spawnSync16 } from "node:child_process";
|
|
26397
|
+
import { existsSync as existsSync10, readFileSync as readFileSync10, readdirSync as readdirSync4 } from "node:fs";
|
|
26335
26398
|
import path26 from "node:path";
|
|
26336
26399
|
var isSafeContextRange = (value) => value.length <= 4096 && (() => {
|
|
26337
26400
|
try {
|
|
@@ -26359,7 +26422,7 @@ var invalidRange = (cwd) => ({
|
|
|
26359
26422
|
cwd
|
|
26360
26423
|
});
|
|
26361
26424
|
var runGit = (cwd, args) => {
|
|
26362
|
-
const result =
|
|
26425
|
+
const result = spawnSync16("git", args, { cwd, encoding: "utf8" });
|
|
26363
26426
|
return {
|
|
26364
26427
|
stdout: (result.stdout ?? "").trimEnd(),
|
|
26365
26428
|
stderr: (result.stderr ?? "").trimEnd(),
|
|
@@ -26516,7 +26579,7 @@ var packageScripts = (cwd, keys) => {
|
|
|
26516
26579
|
if (!existsSync10(pkgPath))
|
|
26517
26580
|
return [];
|
|
26518
26581
|
try {
|
|
26519
|
-
const pkg = JSON.parse(
|
|
26582
|
+
const pkg = JSON.parse(readFileSync10(pkgPath, "utf8"));
|
|
26520
26583
|
return keys.filter((k) => pkg.scripts && typeof pkg.scripts[k] === "string").map((k) => `${k}: ${pkg.scripts?.[k]}`);
|
|
26521
26584
|
} catch {
|
|
26522
26585
|
return [];
|
|
@@ -26550,7 +26613,7 @@ var documentationFiles = (cwd) => {
|
|
|
26550
26613
|
var readTrimmed2 = (file, maxLines) => {
|
|
26551
26614
|
if (!existsSync10(file))
|
|
26552
26615
|
return "";
|
|
26553
|
-
const lines =
|
|
26616
|
+
const lines = readFileSync10(file, "utf8").split(`
|
|
26554
26617
|
`);
|
|
26555
26618
|
return lines.slice(0, maxLines).join(`
|
|
26556
26619
|
`);
|
|
@@ -26738,7 +26801,7 @@ function docsRefreshContext(root, range) {
|
|
|
26738
26801
|
const pkgPath = path26.join(cwd, "package.json");
|
|
26739
26802
|
if (existsSync10(pkgPath)) {
|
|
26740
26803
|
try {
|
|
26741
|
-
const pkg = JSON.parse(
|
|
26804
|
+
const pkg = JSON.parse(readFileSync10(pkgPath, "utf8"));
|
|
26742
26805
|
stdout += JSON.stringify({ name: pkg.name, version: pkg.version, scripts: pkg.scripts }, null, 2) + `
|
|
26743
26806
|
`;
|
|
26744
26807
|
} catch {}
|
|
@@ -26820,12 +26883,12 @@ function releaseNotesContext(root, rangeOrTag) {
|
|
|
26820
26883
|
}
|
|
26821
26884
|
|
|
26822
26885
|
// packages/workit-core/src/core/tracker-issues.ts
|
|
26823
|
-
import { spawnSync as
|
|
26886
|
+
import { spawnSync as spawnSync18 } from "node:child_process";
|
|
26824
26887
|
|
|
26825
26888
|
// packages/workit-core/src/core/pr-create.ts
|
|
26826
26889
|
import fs18 from "node:fs";
|
|
26827
26890
|
import path27 from "node:path";
|
|
26828
|
-
import { spawnSync as
|
|
26891
|
+
import { spawnSync as spawnSync17 } from "node:child_process";
|
|
26829
26892
|
// packages/workit-core/src/forge/pr-body.ts
|
|
26830
26893
|
function parseGhIssue(value) {
|
|
26831
26894
|
const m = /issues\/(\d+)/.exec(value);
|
|
@@ -26859,7 +26922,7 @@ function whichOnPath(tool) {
|
|
|
26859
26922
|
}
|
|
26860
26923
|
var hostingCliAvailable = (provider) => whichOnPath(provider === "gitlab" ? "glab" : "gh") !== null;
|
|
26861
26924
|
var pushRemote = (cwd) => {
|
|
26862
|
-
const result =
|
|
26925
|
+
const result = spawnSync17("git", ["remote", "get-url", "--push", "--all", "origin"], {
|
|
26863
26926
|
cwd,
|
|
26864
26927
|
...LOCAL
|
|
26865
26928
|
});
|
|
@@ -26890,7 +26953,7 @@ var defaultCli = (bin, available) => {
|
|
|
26890
26953
|
if (!available)
|
|
26891
26954
|
return null;
|
|
26892
26955
|
return (args, root) => {
|
|
26893
|
-
const out =
|
|
26956
|
+
const out = spawnSync18(bin, args, {
|
|
26894
26957
|
cwd: root,
|
|
26895
26958
|
encoding: "utf8",
|
|
26896
26959
|
env: { ...process.env, PATH: process.env.PATH ?? "" }
|
|
@@ -26980,7 +27043,7 @@ var ASSET_ROOT = assetRoot();
|
|
|
26980
27043
|
var resolveWorkspaceRoot = (explicit) => explicit || process.cwd();
|
|
26981
27044
|
|
|
26982
27045
|
// packages/workit-core/src/core/youtrack-ytrack.ts
|
|
26983
|
-
import { spawnSync as
|
|
27046
|
+
import { spawnSync as spawnSync19 } from "node:child_process";
|
|
26984
27047
|
|
|
26985
27048
|
// packages/workit-core/src/forge/exec.ts
|
|
26986
27049
|
import fs19 from "node:fs";
|
|
@@ -27018,7 +27081,7 @@ function ytrackRunner(env, host, timeoutMs = TIMEOUT_MS) {
|
|
|
27018
27081
|
const exe = findYtrack(env);
|
|
27019
27082
|
if (!exe)
|
|
27020
27083
|
return { status: null, stdout: "", stderr: "", missing: true };
|
|
27021
|
-
const result =
|
|
27084
|
+
const result = spawnSync19(exe, args, {
|
|
27022
27085
|
encoding: "utf8",
|
|
27023
27086
|
env: { ...env, NO_COLOR: "1", ...host ? { YTRACK_HOST: host } : {} },
|
|
27024
27087
|
timeout: timeoutMs,
|
|
@@ -27410,7 +27473,7 @@ function resolveInside(root, candidate) {
|
|
|
27410
27473
|
}
|
|
27411
27474
|
function run2(root, executable, args, env = {}) {
|
|
27412
27475
|
const cwd = realpathSync8(root);
|
|
27413
|
-
const result =
|
|
27476
|
+
const result = spawnSync20(executable, args, {
|
|
27414
27477
|
cwd,
|
|
27415
27478
|
encoding: "utf8",
|
|
27416
27479
|
env: { ...process.env, ...env }
|
|
@@ -27515,7 +27578,7 @@ var SUPPORT_MATRIX = {
|
|
|
27515
27578
|
};
|
|
27516
27579
|
|
|
27517
27580
|
// packages/workit-mcp/src/server.ts
|
|
27518
|
-
import { existsSync as existsSync13, readFileSync as
|
|
27581
|
+
import { existsSync as existsSync13, readFileSync as readFileSync11, realpathSync as realpathSync9 } from "node:fs";
|
|
27519
27582
|
import path32 from "node:path";
|
|
27520
27583
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
|
|
27521
27584
|
function isZ4Schema(s) {
|
|
@@ -29971,7 +30034,7 @@ var safeCapability = (value, allowed) => allowed.includes(value) ? value : "cont
|
|
|
29971
30034
|
var TOOL_CAPABILITIES = [...CONTEXT_KINDS, "workspace", "native_caller_identity"];
|
|
29972
30035
|
var VERSION = (() => {
|
|
29973
30036
|
try {
|
|
29974
|
-
const packageJson = JSON.parse(
|
|
30037
|
+
const packageJson = JSON.parse(readFileSync11(new URL("../package.json", import.meta.url), "utf8"));
|
|
29975
30038
|
return typeof packageJson.version === "string" ? packageJson.version : "0.0.0";
|
|
29976
30039
|
} catch {
|
|
29977
30040
|
return "0.0.0";
|
|
@@ -30415,11 +30478,11 @@ var HEAVY_WORDS = new Set(("npm npx pnpm pnpx yarn bun bunx deno corepack make g
|
|
|
30415
30478
|
import path33 from "node:path";
|
|
30416
30479
|
|
|
30417
30480
|
// packages/workit-core/src/core/live-session.ts
|
|
30418
|
-
import { spawnSync as
|
|
30481
|
+
import { spawnSync as spawnSync21 } from "node:child_process";
|
|
30419
30482
|
var LIVE_SESSION_TTL_MS = 15 * 60000;
|
|
30420
30483
|
var liveProbe = {
|
|
30421
30484
|
platform: process.platform,
|
|
30422
|
-
run: (args) =>
|
|
30485
|
+
run: (args) => spawnSync21("ps", args, { encoding: "utf8", timeout: 2000 }).stdout ?? "",
|
|
30423
30486
|
start: (pid) => processStartOf(pid)
|
|
30424
30487
|
};
|
|
30425
30488
|
var PIDS = new Map;
|
|
@@ -31453,12 +31516,12 @@ import {
|
|
|
31453
31516
|
lstatSync as lstatSync6,
|
|
31454
31517
|
mkdirSync as mkdirSync5,
|
|
31455
31518
|
readdirSync as readdirSync5,
|
|
31456
|
-
readFileSync as
|
|
31519
|
+
readFileSync as readFileSync12,
|
|
31457
31520
|
renameSync as renameSync4,
|
|
31458
31521
|
rmSync as rmSync3,
|
|
31459
31522
|
writeFileSync as writeFileSync5
|
|
31460
31523
|
} from "node:fs";
|
|
31461
|
-
import
|
|
31524
|
+
import os6 from "node:os";
|
|
31462
31525
|
import path36 from "node:path";
|
|
31463
31526
|
var CODEX_AGENT_ROLES = ["verifier", "reviewer", "implementer"];
|
|
31464
31527
|
var CODEX_AGENT_MARKER = "# Generated by Workit";
|
|
@@ -31470,7 +31533,7 @@ var codexHomeOfInstall = (pluginRoot) => {
|
|
|
31470
31533
|
const cache = parts.length - 4;
|
|
31471
31534
|
return cache >= 2 && parts[cache] === "cache" && parts[cache - 1] === "plugins" ? parts.slice(0, cache - 1).join(path36.sep) || path36.sep : null;
|
|
31472
31535
|
};
|
|
31473
|
-
var codexHomeFor = (pluginRoot, env) => codexHomeOfInstall(pluginRoot) ?? (env.CODEX_HOME || path36.join(env.HOME ||
|
|
31536
|
+
var codexHomeFor = (pluginRoot, env) => codexHomeOfInstall(pluginRoot) ?? (env.CODEX_HOME || path36.join(env.HOME || os6.homedir(), ".codex"));
|
|
31474
31537
|
var withRoleModel = (content, file, models) => {
|
|
31475
31538
|
const role = CODEX_AGENT_ROLES.find((candidate) => codexAgentFile(candidate) === file);
|
|
31476
31539
|
const chosen = role ? models[role] : undefined;
|
|
@@ -31493,7 +31556,7 @@ var versionAtLeast = (version, min) => {
|
|
|
31493
31556
|
};
|
|
31494
31557
|
var pluginVersion = (pluginRoot) => {
|
|
31495
31558
|
try {
|
|
31496
|
-
const version = JSON.parse(
|
|
31559
|
+
const version = JSON.parse(readFileSync12(path36.join(pluginRoot, "package.json"), "utf8")).version;
|
|
31497
31560
|
return typeof version === "string" && /^\d+\.\d+\.\d+/.test(version) ? version.match(/^\d+\.\d+\.\d+/)[0] : null;
|
|
31498
31561
|
} catch {
|
|
31499
31562
|
return null;
|
|
@@ -31514,7 +31577,7 @@ var installCodexAgents = (pluginRoot, codexHome, models = {}) => {
|
|
|
31514
31577
|
const target = path36.join(codexHome, "agents");
|
|
31515
31578
|
const results = [];
|
|
31516
31579
|
for (const file of readdirSync5(source).filter((name) => name.endsWith(".toml")).toSorted()) {
|
|
31517
|
-
const content = withRoleModel(stampCodexAgent(
|
|
31580
|
+
const content = withRoleModel(stampCodexAgent(readFileSync12(path36.join(source, file), "utf8"), version), file, models);
|
|
31518
31581
|
const dest = path36.join(target, file);
|
|
31519
31582
|
const stat = lstatOrNull(dest);
|
|
31520
31583
|
if (stat?.isSymbolicLink()) {
|
|
@@ -31537,7 +31600,7 @@ var installCodexAgents = (pluginRoot, codexHome, models = {}) => {
|
|
|
31537
31600
|
results.push({ file: dest, action: "kept-user-file" });
|
|
31538
31601
|
continue;
|
|
31539
31602
|
}
|
|
31540
|
-
const current =
|
|
31603
|
+
const current = readFileSync12(dest, "utf8");
|
|
31541
31604
|
if (current === content) {
|
|
31542
31605
|
results.push({ file: dest, action: "current" });
|
|
31543
31606
|
continue;
|