@workit-dev/pi 1.7.5 → 1.8.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/worker.js +72 -27
- package/dist/workit.js +186 -121
- package/package.json +1 -1
package/dist/worker.js
CHANGED
|
@@ -6755,13 +6755,12 @@ var COMMIT_PRESETS = [
|
|
|
6755
6755
|
];
|
|
6756
6756
|
|
|
6757
6757
|
// packages/workit-core/src/core/workspaces.ts
|
|
6758
|
-
import { spawnSync as
|
|
6759
|
-
import { existsSync, lstatSync as lstatSync2, readFileSync as
|
|
6758
|
+
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
6759
|
+
import { existsSync, lstatSync as lstatSync2, readFileSync as readFileSync3, realpathSync as realpathSync2 } from "node:fs";
|
|
6760
6760
|
import path6 from "node:path";
|
|
6761
6761
|
|
|
6762
6762
|
// packages/workit-core/src/core/remotes.ts
|
|
6763
|
-
import { lstatSync, readFileSync, realpathSync, statSync } from "node:fs";
|
|
6764
|
-
import os3 from "node:os";
|
|
6763
|
+
import { lstatSync, readFileSync as readFileSync2, realpathSync, statSync } from "node:fs";
|
|
6765
6764
|
import path5 from "node:path";
|
|
6766
6765
|
|
|
6767
6766
|
// packages/workit-core/src/git/rev.ts
|
|
@@ -7097,6 +7096,56 @@ function resolveSshHost(alias, sshConfig) {
|
|
|
7097
7096
|
return { hostname: (hostname ?? alias).replace(/\.$/u, ""), port };
|
|
7098
7097
|
}
|
|
7099
7098
|
|
|
7099
|
+
// packages/workit-core/src/core/account-home.ts
|
|
7100
|
+
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
7101
|
+
import { readFileSync } from "node:fs";
|
|
7102
|
+
import os3 from "node:os";
|
|
7103
|
+
var WINDOWS = "C:\\Windows";
|
|
7104
|
+
var SYSTEM32 = `${WINDOWS}\\System32\\`;
|
|
7105
|
+
var PROFILES = "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\";
|
|
7106
|
+
var childEnv = (platform) => platform === "win32" ? { SystemRoot: WINDOWS } : {};
|
|
7107
|
+
var hostIo = {
|
|
7108
|
+
bun: Boolean(process.versions.bun),
|
|
7109
|
+
uid: process.getuid?.() ?? -1,
|
|
7110
|
+
userInfo: () => os3.userInfo().homedir,
|
|
7111
|
+
passwd: () => readFileSync("/etc/passwd", "utf8"),
|
|
7112
|
+
run: (file, args) => {
|
|
7113
|
+
const done = spawnSync3(file, args, {
|
|
7114
|
+
encoding: "utf8",
|
|
7115
|
+
env: childEnv(process.platform),
|
|
7116
|
+
timeout: 3000,
|
|
7117
|
+
windowsHide: true
|
|
7118
|
+
});
|
|
7119
|
+
return done.status === 0 ? done.stdout : "";
|
|
7120
|
+
}
|
|
7121
|
+
};
|
|
7122
|
+
var field = (text, uid, at) => text.split(`
|
|
7123
|
+
`).filter((line) => !line.startsWith("#")).map((line) => line.split(":")).find((fields) => fields[2] === uid)?.[at];
|
|
7124
|
+
var profilePath = (raw) => {
|
|
7125
|
+
const value = raw.replaceAll(/%SystemDrive%/giu, WINDOWS.slice(0, 2)).replaceAll(/%SystemRoot%/giu, WINDOWS);
|
|
7126
|
+
return /^[A-Za-z]:\\/u.test(value) && !value.includes("%") ? value : null;
|
|
7127
|
+
};
|
|
7128
|
+
var accountHome = (platform = process.platform, io = hostIo) => {
|
|
7129
|
+
try {
|
|
7130
|
+
if (!io.bun)
|
|
7131
|
+
return io.userInfo() || null;
|
|
7132
|
+
if (platform === "win32") {
|
|
7133
|
+
const sid = /S-1-[\d-]+/u.exec(io.run(`${SYSTEM32}whoami.exe`, ["/user", "/fo", "csv"]));
|
|
7134
|
+
const key = sid && io.run(`${SYSTEM32}reg.exe`, ["query", PROFILES + sid[0], "/v", "ProfileImagePath"]);
|
|
7135
|
+
const raw = /ProfileImagePath\s+REG_\w+\s+(.+)/u.exec(key || "")?.[1]?.trim();
|
|
7136
|
+
return raw ? profilePath(raw) : null;
|
|
7137
|
+
}
|
|
7138
|
+
const uid = String(io.uid);
|
|
7139
|
+
let passwd = "";
|
|
7140
|
+
try {
|
|
7141
|
+
passwd = io.passwd();
|
|
7142
|
+
} catch {}
|
|
7143
|
+
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;
|
|
7144
|
+
} catch {
|
|
7145
|
+
return null;
|
|
7146
|
+
}
|
|
7147
|
+
};
|
|
7148
|
+
|
|
7100
7149
|
// packages/workit-core/src/core/remotes.ts
|
|
7101
7150
|
var FORGE_SCHEMES = new Set(["ssh", "git", "http", "https", "git+ssh", "ssh+git"]);
|
|
7102
7151
|
var SSH_SCHEMES = new Set(["ssh", "git+ssh", "ssh+git"]);
|
|
@@ -7106,15 +7155,11 @@ var SSH_443 = {
|
|
|
7106
7155
|
};
|
|
7107
7156
|
var WINDOWS_DRIVE = /^[A-Za-z]:[\\/]/u;
|
|
7108
7157
|
var SCP_LIKE = /^(?:[^@/\\]+@)?([^/\\:]+):(.+)$/u;
|
|
7109
|
-
var accountHome = () => {
|
|
7110
|
-
try {
|
|
7111
|
-
return os3.userInfo().homedir;
|
|
7112
|
-
} catch {
|
|
7113
|
-
return os3.homedir();
|
|
7114
|
-
}
|
|
7115
|
-
};
|
|
7116
7158
|
var sshSeam = {
|
|
7117
|
-
read: () =>
|
|
7159
|
+
read: () => {
|
|
7160
|
+
const home = accountHome();
|
|
7161
|
+
return home === null ? { text: "", home: "" } : readSshConfig(home);
|
|
7162
|
+
}
|
|
7118
7163
|
};
|
|
7119
7164
|
var forgeKey = (rawHost, repo, ssh) => {
|
|
7120
7165
|
let host = rawHost.toLowerCase().replace(/\.$/u, "");
|
|
@@ -7161,7 +7206,7 @@ var gitDirAt = (at, depth = 0) => {
|
|
|
7161
7206
|
return null;
|
|
7162
7207
|
try {
|
|
7163
7208
|
if (statSync(real).isFile()) {
|
|
7164
|
-
const pointer = /^gitdir:\s*(.+?)\s*$/mu.exec(
|
|
7209
|
+
const pointer = /^gitdir:\s*(.+?)\s*$/mu.exec(readFileSync2(real, "utf8"))?.[1];
|
|
7165
7210
|
if (!pointer)
|
|
7166
7211
|
return null;
|
|
7167
7212
|
const target = path5.isAbsolute(pointer) ? pointer : `${path5.dirname(real)}/${pointer}`;
|
|
@@ -7169,7 +7214,7 @@ var gitDirAt = (at, depth = 0) => {
|
|
|
7169
7214
|
}
|
|
7170
7215
|
let common;
|
|
7171
7216
|
try {
|
|
7172
|
-
common =
|
|
7217
|
+
common = readFileSync2(`${real}/commondir`, "utf8").trim();
|
|
7173
7218
|
} catch {}
|
|
7174
7219
|
if (common !== undefined) {
|
|
7175
7220
|
lstatSync(`${real}/HEAD`);
|
|
@@ -7502,7 +7547,7 @@ var probeCheckout = (cwd) => {
|
|
|
7502
7547
|
for (const name of ["GIT_DIR", "GIT_WORK_TREE", "GIT_COMMON_DIR", "GIT_INDEX_FILE"])
|
|
7503
7548
|
delete env[name];
|
|
7504
7549
|
const git = (args) => {
|
|
7505
|
-
const run =
|
|
7550
|
+
const run = spawnSync4("git", args, {
|
|
7506
7551
|
cwd,
|
|
7507
7552
|
env,
|
|
7508
7553
|
encoding: "utf8",
|
|
@@ -7656,7 +7701,7 @@ var matchRuntimeWorkspace = (cwd, dir = configDir2()) => {
|
|
|
7656
7701
|
const file = path6.join(dir, "workspaces.json");
|
|
7657
7702
|
let raw;
|
|
7658
7703
|
try {
|
|
7659
|
-
raw =
|
|
7704
|
+
raw = readFileSync3(file, "utf8");
|
|
7660
7705
|
} catch (error) {
|
|
7661
7706
|
if (error.code === "ENOENT")
|
|
7662
7707
|
return null;
|
|
@@ -7700,7 +7745,7 @@ var modelSources = (cwd, dir) => {
|
|
|
7700
7745
|
}
|
|
7701
7746
|
} catch {}
|
|
7702
7747
|
try {
|
|
7703
|
-
const document = JSON.parse(
|
|
7748
|
+
const document = JSON.parse(readFileSync3(path6.join(dir ?? configDir2(), "workspaces.json"), "utf8"));
|
|
7704
7749
|
if (document && typeof document === "object" && !Array.isArray(document))
|
|
7705
7750
|
out.push({
|
|
7706
7751
|
name: "global",
|
|
@@ -7788,12 +7833,12 @@ var resolveStateDir = () => stateDir(process.env);
|
|
|
7788
7833
|
var homePattern = new RegExp(`${escapeRegExp(os4.homedir())}(?=[/\\\\]|$)|\\$HOME(?=[/\\\\]|$)`, "g");
|
|
7789
7834
|
|
|
7790
7835
|
// packages/workit-core/src/store/paths.ts
|
|
7791
|
-
import { spawnSync as
|
|
7836
|
+
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
7792
7837
|
import fs4 from "node:fs";
|
|
7793
7838
|
import path7 from "node:path";
|
|
7794
7839
|
var NOT_A_REPO = /not a git repository \(or any (of the parent directories|parent up to)/u;
|
|
7795
7840
|
var gitRun = (cwd, args) => {
|
|
7796
|
-
const run =
|
|
7841
|
+
const run = spawnSync5("git", args, {
|
|
7797
7842
|
cwd,
|
|
7798
7843
|
encoding: "utf8",
|
|
7799
7844
|
timeout: 20000,
|
|
@@ -8002,7 +8047,7 @@ var assetRoot = () => {
|
|
|
8002
8047
|
};
|
|
8003
8048
|
|
|
8004
8049
|
// packages/workit-core/src/core/store-lock.ts
|
|
8005
|
-
import { spawnSync as
|
|
8050
|
+
import { spawnSync as spawnSync6 } from "node:child_process";
|
|
8006
8051
|
import fs5 from "node:fs";
|
|
8007
8052
|
var metadataLockSchema = object({
|
|
8008
8053
|
pid: number2().int().nonnegative().safe(),
|
|
@@ -8027,7 +8072,7 @@ var readProcStat = (pid) => {
|
|
|
8027
8072
|
};
|
|
8028
8073
|
var psStart = (pid) => {
|
|
8029
8074
|
try {
|
|
8030
|
-
const run =
|
|
8075
|
+
const run = spawnSync6("ps", ["-o", "lstart=", "-p", String(pid)], {
|
|
8031
8076
|
encoding: "utf8",
|
|
8032
8077
|
timeout: 1000,
|
|
8033
8078
|
env: { ...process.env, LC_ALL: "C" }
|
|
@@ -8114,7 +8159,7 @@ var PM_RUN = new Set(["run", "run-script"]);
|
|
|
8114
8159
|
var PYTHON_RUNNERS = new Set(["uv", "poetry", "pipenv", "pdm", "hatch", "rye"]);
|
|
8115
8160
|
|
|
8116
8161
|
// packages/workit-core/src/ledger.ts
|
|
8117
|
-
import { spawnSync as
|
|
8162
|
+
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
8118
8163
|
import { createHash as createHash3, randomBytes } from "node:crypto";
|
|
8119
8164
|
import fs7 from "node:fs";
|
|
8120
8165
|
import path10 from "node:path";
|
|
@@ -8280,7 +8325,7 @@ var err = (code, error, unblock) => ({
|
|
|
8280
8325
|
...unblock ? { unblock } : {}
|
|
8281
8326
|
});
|
|
8282
8327
|
var gitRun2 = (cwd, args, timeoutMs = GIT_TIMEOUTS.local) => {
|
|
8283
|
-
const run =
|
|
8328
|
+
const run = spawnSync7("git", args, {
|
|
8284
8329
|
cwd,
|
|
8285
8330
|
encoding: "utf8",
|
|
8286
8331
|
timeout: timeoutMs,
|
|
@@ -8598,7 +8643,7 @@ var OBSERVED_ONLY = new Set([
|
|
|
8598
8643
|
]);
|
|
8599
8644
|
|
|
8600
8645
|
// packages/workit-core/src/core/model-fallback.ts
|
|
8601
|
-
import { mkdirSync, readFileSync as
|
|
8646
|
+
import { mkdirSync, readFileSync as readFileSync4, renameSync, writeFileSync } from "node:fs";
|
|
8602
8647
|
import path11 from "node:path";
|
|
8603
8648
|
var LIMITS_FILE = "model-limits.json";
|
|
8604
8649
|
var DEFAULT_LIMIT_WINDOW_MS = 5 * 3600000;
|
|
@@ -8625,7 +8670,7 @@ var empty = () => ({ exhausted: {}, seen: {}, redispatched: {} });
|
|
|
8625
8670
|
var storePath = (stateDir) => path11.join(stateDir ?? resolveStateDir(), LIMITS_FILE);
|
|
8626
8671
|
var readStore = (stateDir) => {
|
|
8627
8672
|
try {
|
|
8628
|
-
const parsed = JSON.parse(
|
|
8673
|
+
const parsed = JSON.parse(readFileSync4(storePath(stateDir), "utf8"));
|
|
8629
8674
|
const store = empty();
|
|
8630
8675
|
for (const key of ["exhausted", "seen", "redispatched"])
|
|
8631
8676
|
if (parsed[key] && typeof parsed[key] === "object")
|
|
@@ -9598,11 +9643,11 @@ var PI_DESCRIPTOR = {
|
|
|
9598
9643
|
import path13 from "node:path";
|
|
9599
9644
|
|
|
9600
9645
|
// packages/workit-core/src/core/live-session.ts
|
|
9601
|
-
import { spawnSync as
|
|
9646
|
+
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
9602
9647
|
var LIVE_SESSION_TTL_MS = 15 * 60000;
|
|
9603
9648
|
var liveProbe = {
|
|
9604
9649
|
platform: process.platform,
|
|
9605
|
-
run: (args) =>
|
|
9650
|
+
run: (args) => spawnSync8("ps", args, { encoding: "utf8", timeout: 2000 }).stdout ?? "",
|
|
9606
9651
|
start: (pid) => processStartOf(pid)
|
|
9607
9652
|
};
|
|
9608
9653
|
var PIDS = new Map;
|
package/dist/workit.js
CHANGED
|
@@ -3,7 +3,7 @@ import { randomUUID as randomUUID6 } from "node:crypto";
|
|
|
3
3
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
4
4
|
|
|
5
5
|
// packages/workit-core/src/core.ts
|
|
6
|
-
import { spawnSync as
|
|
6
|
+
import { spawnSync as spawnSync22 } from "node:child_process";
|
|
7
7
|
import { existsSync as existsSync12, realpathSync as realpathSync8 } from "node:fs";
|
|
8
8
|
import path34 from "node:path";
|
|
9
9
|
|
|
@@ -7883,15 +7883,14 @@ var gitContext = (workspaceRoot, paths = []) => {
|
|
|
7883
7883
|
};
|
|
7884
7884
|
|
|
7885
7885
|
// packages/workit-core/src/core/workspaces.ts
|
|
7886
|
-
import { spawnSync as
|
|
7886
|
+
import { spawnSync as spawnSync6 } from "node:child_process";
|
|
7887
7887
|
import { createHash as createHash3 } from "node:crypto";
|
|
7888
|
-
import { existsSync as existsSync2, lstatSync as lstatSync2, readFileSync as
|
|
7888
|
+
import { existsSync as existsSync2, lstatSync as lstatSync2, readFileSync as readFileSync4, realpathSync as realpathSync2 } from "node:fs";
|
|
7889
7889
|
import path7 from "node:path";
|
|
7890
7890
|
|
|
7891
7891
|
// packages/workit-core/src/core/remotes.ts
|
|
7892
|
-
import { lstatSync, readFileSync as
|
|
7893
|
-
import { spawnSync as
|
|
7894
|
-
import os3 from "node:os";
|
|
7892
|
+
import { lstatSync, readFileSync as readFileSync3, realpathSync, statSync } from "node:fs";
|
|
7893
|
+
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
7895
7894
|
import path6 from "node:path";
|
|
7896
7895
|
|
|
7897
7896
|
// packages/workit-core/src/git/rev.ts
|
|
@@ -8717,6 +8716,56 @@ function resolveSshHost(alias, sshConfig) {
|
|
|
8717
8716
|
return { hostname: (hostname ?? alias).replace(/\.$/u, ""), port };
|
|
8718
8717
|
}
|
|
8719
8718
|
|
|
8719
|
+
// packages/workit-core/src/core/account-home.ts
|
|
8720
|
+
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
8721
|
+
import { readFileSync as readFileSync2 } from "node:fs";
|
|
8722
|
+
import os3 from "node:os";
|
|
8723
|
+
var WINDOWS = "C:\\Windows";
|
|
8724
|
+
var SYSTEM32 = `${WINDOWS}\\System32\\`;
|
|
8725
|
+
var PROFILES = "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\";
|
|
8726
|
+
var childEnv = (platform) => platform === "win32" ? { SystemRoot: WINDOWS } : {};
|
|
8727
|
+
var hostIo = {
|
|
8728
|
+
bun: Boolean(process.versions.bun),
|
|
8729
|
+
uid: process.getuid?.() ?? -1,
|
|
8730
|
+
userInfo: () => os3.userInfo().homedir,
|
|
8731
|
+
passwd: () => readFileSync2("/etc/passwd", "utf8"),
|
|
8732
|
+
run: (file, args) => {
|
|
8733
|
+
const done = spawnSync4(file, args, {
|
|
8734
|
+
encoding: "utf8",
|
|
8735
|
+
env: childEnv(process.platform),
|
|
8736
|
+
timeout: 3000,
|
|
8737
|
+
windowsHide: true
|
|
8738
|
+
});
|
|
8739
|
+
return done.status === 0 ? done.stdout : "";
|
|
8740
|
+
}
|
|
8741
|
+
};
|
|
8742
|
+
var field = (text, uid, at) => text.split(`
|
|
8743
|
+
`).filter((line) => !line.startsWith("#")).map((line) => line.split(":")).find((fields) => fields[2] === uid)?.[at];
|
|
8744
|
+
var profilePath = (raw) => {
|
|
8745
|
+
const value = raw.replaceAll(/%SystemDrive%/giu, WINDOWS.slice(0, 2)).replaceAll(/%SystemRoot%/giu, WINDOWS);
|
|
8746
|
+
return /^[A-Za-z]:\\/u.test(value) && !value.includes("%") ? value : null;
|
|
8747
|
+
};
|
|
8748
|
+
var accountHome = (platform = process.platform, io = hostIo) => {
|
|
8749
|
+
try {
|
|
8750
|
+
if (!io.bun)
|
|
8751
|
+
return io.userInfo() || null;
|
|
8752
|
+
if (platform === "win32") {
|
|
8753
|
+
const sid = /S-1-[\d-]+/u.exec(io.run(`${SYSTEM32}whoami.exe`, ["/user", "/fo", "csv"]));
|
|
8754
|
+
const key = sid && io.run(`${SYSTEM32}reg.exe`, ["query", PROFILES + sid[0], "/v", "ProfileImagePath"]);
|
|
8755
|
+
const raw = /ProfileImagePath\s+REG_\w+\s+(.+)/u.exec(key || "")?.[1]?.trim();
|
|
8756
|
+
return raw ? profilePath(raw) : null;
|
|
8757
|
+
}
|
|
8758
|
+
const uid = String(io.uid);
|
|
8759
|
+
let passwd = "";
|
|
8760
|
+
try {
|
|
8761
|
+
passwd = io.passwd();
|
|
8762
|
+
} catch {}
|
|
8763
|
+
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;
|
|
8764
|
+
} catch {
|
|
8765
|
+
return null;
|
|
8766
|
+
}
|
|
8767
|
+
};
|
|
8768
|
+
|
|
8720
8769
|
// packages/workit-core/src/core/remotes.ts
|
|
8721
8770
|
var FORGE_SCHEMES = new Set(["ssh", "git", "http", "https", "git+ssh", "ssh+git"]);
|
|
8722
8771
|
var SSH_SCHEMES = new Set(["ssh", "git+ssh", "ssh+git"]);
|
|
@@ -8726,15 +8775,11 @@ var SSH_443 = {
|
|
|
8726
8775
|
};
|
|
8727
8776
|
var WINDOWS_DRIVE = /^[A-Za-z]:[\\/]/u;
|
|
8728
8777
|
var SCP_LIKE = /^(?:[^@/\\]+@)?([^/\\:]+):(.+)$/u;
|
|
8729
|
-
var accountHome = () => {
|
|
8730
|
-
try {
|
|
8731
|
-
return os3.userInfo().homedir;
|
|
8732
|
-
} catch {
|
|
8733
|
-
return os3.homedir();
|
|
8734
|
-
}
|
|
8735
|
-
};
|
|
8736
8778
|
var sshSeam = {
|
|
8737
|
-
read: () =>
|
|
8779
|
+
read: () => {
|
|
8780
|
+
const home = accountHome();
|
|
8781
|
+
return home === null ? { text: "", home: "" } : readSshConfig(home);
|
|
8782
|
+
}
|
|
8738
8783
|
};
|
|
8739
8784
|
var forgeKey = (rawHost, repo, ssh) => {
|
|
8740
8785
|
let host = rawHost.toLowerCase().replace(/\.$/u, "");
|
|
@@ -8781,7 +8826,7 @@ var gitDirAt = (at, depth = 0) => {
|
|
|
8781
8826
|
return null;
|
|
8782
8827
|
try {
|
|
8783
8828
|
if (statSync(real).isFile()) {
|
|
8784
|
-
const pointer = /^gitdir:\s*(.+?)\s*$/mu.exec(
|
|
8829
|
+
const pointer = /^gitdir:\s*(.+?)\s*$/mu.exec(readFileSync3(real, "utf8"))?.[1];
|
|
8785
8830
|
if (!pointer)
|
|
8786
8831
|
return null;
|
|
8787
8832
|
const target = path6.isAbsolute(pointer) ? pointer : `${path6.dirname(real)}/${pointer}`;
|
|
@@ -8789,7 +8834,7 @@ var gitDirAt = (at, depth = 0) => {
|
|
|
8789
8834
|
}
|
|
8790
8835
|
let common;
|
|
8791
8836
|
try {
|
|
8792
|
-
common =
|
|
8837
|
+
common = readFileSync3(`${real}/commondir`, "utf8").trim();
|
|
8793
8838
|
} catch {}
|
|
8794
8839
|
if (common !== undefined) {
|
|
8795
8840
|
lstatSync(`${real}/HEAD`);
|
|
@@ -8893,7 +8938,7 @@ var checkoutRemotes = (cwd) => {
|
|
|
8893
8938
|
const env = { ...process.env };
|
|
8894
8939
|
for (const name of ["GIT_DIR", "GIT_WORK_TREE", "GIT_COMMON_DIR", "GIT_INDEX_FILE"])
|
|
8895
8940
|
delete env[name];
|
|
8896
|
-
const git = (args) =>
|
|
8941
|
+
const git = (args) => spawnSync5("git", args, {
|
|
8897
8942
|
cwd,
|
|
8898
8943
|
env,
|
|
8899
8944
|
encoding: "utf8",
|
|
@@ -8944,6 +8989,8 @@ var userLevel = (scope, origin) => {
|
|
|
8944
8989
|
return false;
|
|
8945
8990
|
const file = realOrSelf(origin.slice("file:".length));
|
|
8946
8991
|
const home = userGitSeam.home();
|
|
8992
|
+
if (home === null)
|
|
8993
|
+
return false;
|
|
8947
8994
|
return [path6.join(home, ".gitconfig"), path6.join(home, ".config", "git", "config")].map(realOrSelf).includes(file);
|
|
8948
8995
|
};
|
|
8949
8996
|
var escapeRegex2 = (value) => value.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
|
|
@@ -8954,7 +9001,7 @@ var transportOverride = (git, remote, vars) => {
|
|
|
8954
9001
|
const execPath = vars.GIT_EXEC_PATH;
|
|
8955
9002
|
if (execPath) {
|
|
8956
9003
|
const { GIT_EXEC_PATH: _set, ...rest } = vars;
|
|
8957
|
-
const own =
|
|
9004
|
+
const own = spawnSync5("git", ["--exec-path"], {
|
|
8958
9005
|
env: rest,
|
|
8959
9006
|
encoding: "utf8"
|
|
8960
9007
|
});
|
|
@@ -8990,7 +9037,7 @@ var pushTarget = (cwd, remote, replay = {}) => {
|
|
|
8990
9037
|
delete env[name];
|
|
8991
9038
|
if (!remote || remote.startsWith("-"))
|
|
8992
9039
|
return Error(`push remote ${JSON.stringify(remote)} cannot be resolved`);
|
|
8993
|
-
const git = (args) =>
|
|
9040
|
+
const git = (args) => spawnSync5("git", [...replay.config ?? [], ...args], {
|
|
8994
9041
|
cwd,
|
|
8995
9042
|
env,
|
|
8996
9043
|
encoding: "utf8",
|
|
@@ -9222,7 +9269,7 @@ var readWorkspacesResult = (dir = configDir2()) => {
|
|
|
9222
9269
|
const file = path7.join(dir, "workspaces.json");
|
|
9223
9270
|
let raw;
|
|
9224
9271
|
try {
|
|
9225
|
-
raw =
|
|
9272
|
+
raw = readFileSync4(file, "utf8");
|
|
9226
9273
|
} catch (error) {
|
|
9227
9274
|
if (error.code === "ENOENT")
|
|
9228
9275
|
return {
|
|
@@ -9343,7 +9390,7 @@ var probeCheckout = (cwd) => {
|
|
|
9343
9390
|
for (const name of ["GIT_DIR", "GIT_WORK_TREE", "GIT_COMMON_DIR", "GIT_INDEX_FILE"])
|
|
9344
9391
|
delete env[name];
|
|
9345
9392
|
const git = (args) => {
|
|
9346
|
-
const run =
|
|
9393
|
+
const run = spawnSync6("git", args, {
|
|
9347
9394
|
cwd,
|
|
9348
9395
|
env,
|
|
9349
9396
|
encoding: "utf8",
|
|
@@ -9540,7 +9587,7 @@ var matchRuntimeWorkspace = (cwd, dir = configDir2()) => {
|
|
|
9540
9587
|
const file = path7.join(dir, "workspaces.json");
|
|
9541
9588
|
let raw;
|
|
9542
9589
|
try {
|
|
9543
|
-
raw =
|
|
9590
|
+
raw = readFileSync4(file, "utf8");
|
|
9544
9591
|
} catch (error) {
|
|
9545
9592
|
if (error.code === "ENOENT")
|
|
9546
9593
|
return null;
|
|
@@ -9616,7 +9663,7 @@ var modelSources = (cwd, dir) => {
|
|
|
9616
9663
|
}
|
|
9617
9664
|
} catch {}
|
|
9618
9665
|
try {
|
|
9619
|
-
const document = JSON.parse(
|
|
9666
|
+
const document = JSON.parse(readFileSync4(path7.join(dir ?? configDir2(), "workspaces.json"), "utf8"));
|
|
9620
9667
|
if (document && typeof document === "object" && !Array.isArray(document))
|
|
9621
9668
|
out.push({
|
|
9622
9669
|
name: "global",
|
|
@@ -9682,11 +9729,11 @@ function workspaceDefaultTarget(cwd, globalDefault) {
|
|
|
9682
9729
|
// packages/workit-core/src/core/vcs-config.ts
|
|
9683
9730
|
import fs4 from "node:fs";
|
|
9684
9731
|
import path8 from "node:path";
|
|
9685
|
-
import { spawnSync as
|
|
9732
|
+
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
9686
9733
|
|
|
9687
9734
|
// packages/workit-core/src/core/release-tracks.ts
|
|
9688
9735
|
import { createHash as createHash4 } from "node:crypto";
|
|
9689
|
-
import { spawnSync as
|
|
9736
|
+
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
9690
9737
|
class ReleaseTrackError extends Error {
|
|
9691
9738
|
}
|
|
9692
9739
|
var KNOWN_FIELDS = new Set([
|
|
@@ -9971,7 +10018,7 @@ function resolveReleaseTrack(input) {
|
|
|
9971
10018
|
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 ")}`);
|
|
9972
10019
|
}
|
|
9973
10020
|
var git2 = (cwd, args) => {
|
|
9974
|
-
const run =
|
|
10021
|
+
const run = spawnSync7("git", args, {
|
|
9975
10022
|
cwd,
|
|
9976
10023
|
encoding: "utf8",
|
|
9977
10024
|
timeout: 20000,
|
|
@@ -10120,7 +10167,7 @@ var remoteEndpoint = (remote) => {
|
|
|
10120
10167
|
var configuredSshEndpoint = (host) => {
|
|
10121
10168
|
if (host.startsWith("-"))
|
|
10122
10169
|
return null;
|
|
10123
|
-
const resolved =
|
|
10170
|
+
const resolved = spawnSync8("ssh", ["-G", host], {
|
|
10124
10171
|
encoding: "utf8",
|
|
10125
10172
|
timeout: 5000,
|
|
10126
10173
|
maxBuffer: 1024 * 1024,
|
|
@@ -10334,7 +10381,7 @@ function mergedPrStyle(limit = 6, cwd) {
|
|
|
10334
10381
|
`).filter((l) => l.startsWith("## ")).map((l) => l.trim()),
|
|
10335
10382
|
descriptionPreview: desc.slice(0, 600)
|
|
10336
10383
|
});
|
|
10337
|
-
const remoteResult =
|
|
10384
|
+
const remoteResult = spawnSync8("git", ["remote", "get-url", "--push", "--all", "origin"], {
|
|
10338
10385
|
cwd,
|
|
10339
10386
|
encoding: "utf8"
|
|
10340
10387
|
});
|
|
@@ -10350,7 +10397,7 @@ function mergedPrStyle(limit = 6, cwd) {
|
|
|
10350
10397
|
if (!hostingApiHostMatches(remote, host))
|
|
10351
10398
|
return { ok: false, error: "PR style target does not match the provider host" };
|
|
10352
10399
|
if (provider === "gitlab") {
|
|
10353
|
-
const run = (args) =>
|
|
10400
|
+
const run = (args) => spawnSync8("glab", ["api", ...args], {
|
|
10354
10401
|
cwd,
|
|
10355
10402
|
encoding: "utf8",
|
|
10356
10403
|
env
|
|
@@ -10370,7 +10417,7 @@ function mergedPrStyle(limit = 6, cwd) {
|
|
|
10370
10417
|
});
|
|
10371
10418
|
}
|
|
10372
10419
|
} else if (provider === "github") {
|
|
10373
|
-
const r =
|
|
10420
|
+
const r = spawnSync8("gh", [
|
|
10374
10421
|
"pr",
|
|
10375
10422
|
"list",
|
|
10376
10423
|
"--repo",
|
|
@@ -10667,13 +10714,13 @@ var resolveStateDir = () => stateDir(process.env);
|
|
|
10667
10714
|
var homePattern = new RegExp(`${escapeRegExp2(os4.homedir())}(?=[/\\\\]|$)|\\$HOME(?=[/\\\\]|$)`, "g");
|
|
10668
10715
|
|
|
10669
10716
|
// packages/workit-core/src/store/paths.ts
|
|
10670
|
-
import { spawnSync as
|
|
10717
|
+
import { spawnSync as spawnSync9 } from "node:child_process";
|
|
10671
10718
|
import { createHash as createHash6 } from "node:crypto";
|
|
10672
10719
|
import fs5 from "node:fs";
|
|
10673
10720
|
import path9 from "node:path";
|
|
10674
10721
|
var NOT_A_REPO = /not a git repository \(or any (of the parent directories|parent up to)/u;
|
|
10675
10722
|
var gitRun = (cwd, args) => {
|
|
10676
|
-
const run =
|
|
10723
|
+
const run = spawnSync9("git", args, {
|
|
10677
10724
|
cwd,
|
|
10678
10725
|
encoding: "utf8",
|
|
10679
10726
|
timeout: 20000,
|
|
@@ -12152,7 +12199,7 @@ var assetRoot = () => {
|
|
|
12152
12199
|
};
|
|
12153
12200
|
|
|
12154
12201
|
// packages/workit-core/src/core/store-lock.ts
|
|
12155
|
-
import { spawnSync as
|
|
12202
|
+
import { spawnSync as spawnSync10 } from "node:child_process";
|
|
12156
12203
|
import fs11 from "node:fs";
|
|
12157
12204
|
import { hostname } from "node:os";
|
|
12158
12205
|
var metadataLockSchema = object({
|
|
@@ -12203,7 +12250,7 @@ var readProcStat = (pid) => {
|
|
|
12203
12250
|
};
|
|
12204
12251
|
var psStart = (pid) => {
|
|
12205
12252
|
try {
|
|
12206
|
-
const run =
|
|
12253
|
+
const run = spawnSync10("ps", ["-o", "lstart=", "-p", String(pid)], {
|
|
12207
12254
|
encoding: "utf8",
|
|
12208
12255
|
timeout: 1000,
|
|
12209
12256
|
env: { ...process.env, LC_ALL: "C" }
|
|
@@ -14211,11 +14258,11 @@ var workerBlocksTransition = (transition, state) => transition === "pause" ? fal
|
|
|
14211
14258
|
// packages/workit-core/src/core/task-evaluation.ts
|
|
14212
14259
|
import { createHash as createHash12 } from "node:crypto";
|
|
14213
14260
|
import * as fs17 from "node:fs";
|
|
14214
|
-
import { spawnSync as
|
|
14261
|
+
import { spawnSync as spawnSync15 } from "node:child_process";
|
|
14215
14262
|
import path22 from "node:path";
|
|
14216
14263
|
|
|
14217
14264
|
// packages/workit-core/src/check-config.ts
|
|
14218
|
-
import { spawnSync as
|
|
14265
|
+
import { spawnSync as spawnSync11 } from "node:child_process";
|
|
14219
14266
|
import fs14 from "node:fs";
|
|
14220
14267
|
import path17 from "node:path";
|
|
14221
14268
|
var SCRIPT_CHECKS = ["test", "lint", "typecheck", "check"];
|
|
@@ -14280,7 +14327,7 @@ function splitCommand(command) {
|
|
|
14280
14327
|
return argv.length ? argv : new Error("empty command");
|
|
14281
14328
|
}
|
|
14282
14329
|
var git3 = (cwd, args) => {
|
|
14283
|
-
const run =
|
|
14330
|
+
const run = spawnSync11("git", args, {
|
|
14284
14331
|
cwd,
|
|
14285
14332
|
encoding: "utf8",
|
|
14286
14333
|
timeout: 20000,
|
|
@@ -14657,19 +14704,19 @@ import { existsSync as existsSync7 } from "node:fs";
|
|
|
14657
14704
|
import path21 from "node:path";
|
|
14658
14705
|
|
|
14659
14706
|
// packages/workit-core/src/ledger.ts
|
|
14660
|
-
import { spawnSync as
|
|
14707
|
+
import { spawnSync as spawnSync14 } from "node:child_process";
|
|
14661
14708
|
import { createHash as createHash11, randomBytes as randomBytes3 } from "node:crypto";
|
|
14662
14709
|
import fs16 from "node:fs";
|
|
14663
14710
|
import path20 from "node:path";
|
|
14664
14711
|
|
|
14665
14712
|
// packages/workit-core/src/core/policy/bookkeeping.ts
|
|
14666
|
-
import { spawnSync as
|
|
14713
|
+
import { spawnSync as spawnSync12 } from "node:child_process";
|
|
14667
14714
|
var OID = /^[0-9a-f]{40,64}$/u;
|
|
14668
14715
|
var safe = (value) => value.length > 0 && !value.startsWith("-");
|
|
14669
14716
|
function replayTree(cwd, from, fromFork, toFork) {
|
|
14670
14717
|
if (![from, fromFork, toFork].every(safe))
|
|
14671
14718
|
return null;
|
|
14672
|
-
const run =
|
|
14719
|
+
const run = spawnSync12("git", ["merge-tree", "--write-tree", "--no-messages", `--merge-base=${fromFork}`, toFork, from], {
|
|
14673
14720
|
cwd,
|
|
14674
14721
|
encoding: "utf8",
|
|
14675
14722
|
timeout: GIT_TIMEOUTS.worktree,
|
|
@@ -14740,11 +14787,11 @@ function bookkeepingPaths(cwd, input) {
|
|
|
14740
14787
|
}
|
|
14741
14788
|
|
|
14742
14789
|
// packages/workit-core/src/core/policy/lane.ts
|
|
14743
|
-
import { existsSync as existsSync6, readFileSync as
|
|
14790
|
+
import { existsSync as existsSync6, readFileSync as readFileSync7 } from "node:fs";
|
|
14744
14791
|
import path18 from "node:path";
|
|
14745
14792
|
|
|
14746
14793
|
// packages/workit-core/src/git/default-base.ts
|
|
14747
|
-
import { spawnSync as
|
|
14794
|
+
import { spawnSync as spawnSync13 } from "node:child_process";
|
|
14748
14795
|
var safeRef = (value) => value.length > 0 && !value.startsWith("-");
|
|
14749
14796
|
var trackTrunk = (cwd) => {
|
|
14750
14797
|
try {
|
|
@@ -14794,7 +14841,7 @@ var shorten = (table, full) => {
|
|
|
14794
14841
|
return full;
|
|
14795
14842
|
};
|
|
14796
14843
|
function refTable(cwd) {
|
|
14797
|
-
const run =
|
|
14844
|
+
const run = spawnSync13("git", ["for-each-ref", "--format=%(refname)%00%(objecttype)%00%(*objecttype)%00%(symref)"], { cwd, encoding: "utf8", timeout: 20000, killSignal: "SIGKILL", windowsHide: true });
|
|
14798
14845
|
if (run.status !== 0)
|
|
14799
14846
|
return null;
|
|
14800
14847
|
const refs = new Map;
|
|
@@ -15395,7 +15442,7 @@ function computeLane(input) {
|
|
|
15395
15442
|
}
|
|
15396
15443
|
function untrackedStat(cwd, file) {
|
|
15397
15444
|
try {
|
|
15398
|
-
const bytes =
|
|
15445
|
+
const bytes = readFileSync7(path18.join(cwd, file));
|
|
15399
15446
|
if (bytes.includes(0))
|
|
15400
15447
|
return { path: file, added: 0, deleted: 0, binary: true };
|
|
15401
15448
|
const text = bytes.toString("utf8");
|
|
@@ -15426,7 +15473,7 @@ function cosmeticFiles(cwd, fork, head) {
|
|
|
15426
15473
|
let after = blobs.get(entry.newBlob);
|
|
15427
15474
|
if (!after && head === null && ABSENT.test(entry.newBlob))
|
|
15428
15475
|
try {
|
|
15429
|
-
after =
|
|
15476
|
+
after = readFileSync7(path18.join(cwd, entry.path));
|
|
15430
15477
|
} catch {
|
|
15431
15478
|
after = undefined;
|
|
15432
15479
|
}
|
|
@@ -15658,7 +15705,7 @@ var err = (code, error, unblock) => ({
|
|
|
15658
15705
|
...unblock ? { unblock } : {}
|
|
15659
15706
|
});
|
|
15660
15707
|
var gitRun2 = (cwd, args, timeoutMs = GIT_TIMEOUTS.local) => {
|
|
15661
|
-
const run =
|
|
15708
|
+
const run = spawnSync14("git", args, {
|
|
15662
15709
|
cwd,
|
|
15663
15710
|
encoding: "utf8",
|
|
15664
15711
|
timeout: timeoutMs,
|
|
@@ -16995,7 +17042,7 @@ var compareCodeUnits2 = (left, right) => {
|
|
|
16995
17042
|
return left.length - right.length;
|
|
16996
17043
|
};
|
|
16997
17044
|
var gitPaths = (root) => {
|
|
16998
|
-
const result =
|
|
17045
|
+
const result = spawnSync15("git", ["ls-files", "-z", "--cached", "--others", "--exclude-standard"], {
|
|
16999
17046
|
cwd: root,
|
|
17000
17047
|
encoding: "buffer"
|
|
17001
17048
|
});
|
|
@@ -17008,7 +17055,7 @@ var gitPaths = (root) => {
|
|
|
17008
17055
|
};
|
|
17009
17056
|
}
|
|
17010
17057
|
const paths = result.stdout ? result.stdout.toString("utf8").split("\x00").filter(Boolean).map((item) => item.split(path22.sep).join("/")) : [];
|
|
17011
|
-
const stagedDeleted =
|
|
17058
|
+
const stagedDeleted = spawnSync15("git", ["diff", "--cached", "--name-only", "--diff-filter=D", "-z"], { cwd: root, encoding: "buffer" });
|
|
17012
17059
|
if (stagedDeleted.status !== 0) {
|
|
17013
17060
|
const stderr = stagedDeleted.stderr?.toString("utf8") ?? "";
|
|
17014
17061
|
if (!/not a git repository/i.test(stderr))
|
|
@@ -17139,7 +17186,7 @@ function captureCandidate(root, scope, environment = []) {
|
|
|
17139
17186
|
const values = supplied.toSorted((left, right) => compareCodeUnits2(left.name, right.name)).map(({ name, value }) => ({ name, value, refs: [] }));
|
|
17140
17187
|
if (values.some(({ value }) => value === null))
|
|
17141
17188
|
completeness = "uncertain";
|
|
17142
|
-
const headResult =
|
|
17189
|
+
const headResult = spawnSync15("git", ["rev-parse", "HEAD"], { cwd: checkout, encoding: "utf8" });
|
|
17143
17190
|
if (headResult.status !== 0 && !/not a git repository/i.test(headResult.stderr ?? ""))
|
|
17144
17191
|
completeness = "uncertain";
|
|
17145
17192
|
const head = headResult.status === 0 ? headResult.stdout.trim() : null;
|
|
@@ -17670,7 +17717,7 @@ function briefInspectResult(request, result) {
|
|
|
17670
17717
|
|
|
17671
17718
|
// packages/workit-core/src/core/model-fallback.ts
|
|
17672
17719
|
import { createHash as createHash13 } from "node:crypto";
|
|
17673
|
-
import { mkdirSync as mkdirSync4, readFileSync as
|
|
17720
|
+
import { mkdirSync as mkdirSync4, readFileSync as readFileSync9, renameSync as renameSync3, writeFileSync as writeFileSync4 } from "node:fs";
|
|
17674
17721
|
import path23 from "node:path";
|
|
17675
17722
|
var LIMITS_FILE = "model-limits.json";
|
|
17676
17723
|
var DEFAULT_LIMIT_WINDOW_MS = 5 * 3600000;
|
|
@@ -17697,7 +17744,7 @@ var empty = () => ({ exhausted: {}, seen: {}, redispatched: {} });
|
|
|
17697
17744
|
var storePath = (stateDir) => path23.join(stateDir ?? resolveStateDir(), LIMITS_FILE);
|
|
17698
17745
|
var readStore = (stateDir) => {
|
|
17699
17746
|
try {
|
|
17700
|
-
const parsed = JSON.parse(
|
|
17747
|
+
const parsed = JSON.parse(readFileSync9(storePath(stateDir), "utf8"));
|
|
17701
17748
|
const store = empty();
|
|
17702
17749
|
for (const key of ["exhausted", "seen", "redispatched"])
|
|
17703
17750
|
if (parsed[key] && typeof parsed[key] === "object")
|
|
@@ -18289,19 +18336,18 @@ var exportDigest = (bundle) => sha256({
|
|
|
18289
18336
|
task: bundle.task
|
|
18290
18337
|
});
|
|
18291
18338
|
// packages/workit-core/src/core/route-intent.ts
|
|
18292
|
-
import { spawnSync as
|
|
18339
|
+
import { spawnSync as spawnSync17 } from "node:child_process";
|
|
18293
18340
|
import { existsSync as existsSync10 } from "node:fs";
|
|
18294
18341
|
import path29 from "node:path";
|
|
18295
18342
|
|
|
18296
18343
|
// packages/workit-core/src/hooks/raw-git.ts
|
|
18297
|
-
import { spawnSync as
|
|
18344
|
+
import { spawnSync as spawnSync16 } from "node:child_process";
|
|
18298
18345
|
import { createHash as createHash15 } from "node:crypto";
|
|
18299
18346
|
import fs19 from "node:fs";
|
|
18300
|
-
import
|
|
18347
|
+
import os6 from "node:os";
|
|
18301
18348
|
import path28 from "node:path";
|
|
18302
18349
|
|
|
18303
18350
|
// packages/workit-core/src/autonomy.ts
|
|
18304
|
-
import os6 from "node:os";
|
|
18305
18351
|
import path26 from "node:path";
|
|
18306
18352
|
|
|
18307
18353
|
// packages/workit-core/src/core/eval-world.ts
|
|
@@ -18314,15 +18360,21 @@ var inside2 = (dir, file) => {
|
|
|
18314
18360
|
const rel = path24.relative(dir, file);
|
|
18315
18361
|
return !rel.startsWith("..") && !path24.isAbsolute(rel);
|
|
18316
18362
|
};
|
|
18317
|
-
var
|
|
18363
|
+
var evalWorld = (cwd) => {
|
|
18318
18364
|
const raw = process.env[EVAL_WORLD_ENV];
|
|
18319
18365
|
if (!raw || !path24.isAbsolute(raw))
|
|
18320
18366
|
return null;
|
|
18321
18367
|
try {
|
|
18322
18368
|
const world = realpathSync5(raw);
|
|
18323
|
-
|
|
18324
|
-
|
|
18325
|
-
return
|
|
18369
|
+
return inside2(realpathSync5(os5.tmpdir()), world) && inside2(world, realpathSync5(cwd)) && existsSync9(path24.join(world, EVAL_WORLD_MARKER)) ? world : null;
|
|
18370
|
+
} catch {
|
|
18371
|
+
return null;
|
|
18372
|
+
}
|
|
18373
|
+
};
|
|
18374
|
+
var evalWorldEntry = (cwd) => {
|
|
18375
|
+
const world = evalWorld(cwd);
|
|
18376
|
+
try {
|
|
18377
|
+
return world ? loadWorkspacesFrom(path24.join(world, "config"))[0] ?? null : null;
|
|
18326
18378
|
} catch {
|
|
18327
18379
|
return null;
|
|
18328
18380
|
}
|
|
@@ -18396,15 +18448,22 @@ function writeFileAtomic(file, content, mode) {
|
|
|
18396
18448
|
}
|
|
18397
18449
|
|
|
18398
18450
|
// packages/workit-core/src/autonomy.ts
|
|
18399
|
-
var
|
|
18400
|
-
|
|
18401
|
-
|
|
18402
|
-
|
|
18403
|
-
|
|
18404
|
-
|
|
18451
|
+
var grantsHome = { resolve: accountHome };
|
|
18452
|
+
var accountDir = () => {
|
|
18453
|
+
const home = grantsHome.resolve();
|
|
18454
|
+
return home === null ? null : configDir({ HOME: home });
|
|
18455
|
+
};
|
|
18456
|
+
var grantsDir = () => accountDir() ?? resolveConfigDir();
|
|
18457
|
+
var NO_ACCOUNT = "no OS account record answered (core/account-home.ts), so no grants are read: the D4 defaults apply";
|
|
18458
|
+
var entriesIn = (dir) => dir === null ? [] : loadWorkspacesFrom(dir);
|
|
18459
|
+
var resolveFrom = (cwd, name) => {
|
|
18460
|
+
const dir = accountDir();
|
|
18461
|
+
return dir === null ? null : resolveWorkspaceFrom(cwd, dir, name);
|
|
18462
|
+
};
|
|
18463
|
+
var shownGrantsDir = () => {
|
|
18464
|
+
const world = evalWorld(process.cwd());
|
|
18465
|
+
return world ? path26.join(world, "config") : accountDir();
|
|
18405
18466
|
};
|
|
18406
|
-
var grantsHome = { resolve: accountHome2 };
|
|
18407
|
-
var grantsDir = () => configDir({ HOME: grantsHome.resolve() });
|
|
18408
18467
|
var benchWorld = (cwd) => {
|
|
18409
18468
|
const entry = evalWorldEntry(cwd);
|
|
18410
18469
|
if (!entry)
|
|
@@ -18424,8 +18483,11 @@ var benchWorld = (cwd) => {
|
|
|
18424
18483
|
};
|
|
18425
18484
|
};
|
|
18426
18485
|
var grantsOverride = () => {
|
|
18486
|
+
const shown = shownGrantsDir();
|
|
18487
|
+
if (shown === null)
|
|
18488
|
+
return NO_ACCOUNT;
|
|
18427
18489
|
const configured = path26.resolve(resolveConfigDir());
|
|
18428
|
-
return configured === path26.resolve(
|
|
18490
|
+
return configured === path26.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 ${path26.join(grantsDir(), "workspaces.json")}, so the D4 defaults apply until grants are set there`;
|
|
18429
18491
|
};
|
|
18430
18492
|
var GRANT_KINDS = ["push", "pr", "merge", "release", "rerun"];
|
|
18431
18493
|
var DEFAULT_GRANTS = Object.freeze({
|
|
@@ -18551,7 +18613,7 @@ function capAt(named, where, by, why, main = false) {
|
|
|
18551
18613
|
try {
|
|
18552
18614
|
if (where instanceof Error)
|
|
18553
18615
|
throw where;
|
|
18554
|
-
folder = autonomyOf(typeof where === "string" ?
|
|
18616
|
+
folder = autonomyOf(typeof where === "string" ? resolveFrom(where) : where.entry);
|
|
18555
18617
|
} catch (error) {
|
|
18556
18618
|
none = error.message;
|
|
18557
18619
|
}
|
|
@@ -18595,7 +18657,10 @@ function resolveAutonomy(cwd, target) {
|
|
|
18595
18657
|
if (override)
|
|
18596
18658
|
return { ...autonomyOf(null), note: override };
|
|
18597
18659
|
const name = process.env.WORKIT_WORKSPACE_NAME?.trim() || undefined;
|
|
18598
|
-
|
|
18660
|
+
const real = resolveFrom(cwd, name);
|
|
18661
|
+
let autonomy = autonomyOf(real ?? world);
|
|
18662
|
+
if (!real && world)
|
|
18663
|
+
autonomy.world = evalWorld(cwd) ?? undefined;
|
|
18599
18664
|
if (name)
|
|
18600
18665
|
autonomy = capAt(autonomy, cwd, `WORKIT_WORKSPACE_NAME=${name}`, "a name never raises grants");
|
|
18601
18666
|
const above = checkoutsAbove(cwd);
|
|
@@ -18604,7 +18669,7 @@ function resolveAutonomy(cwd, target) {
|
|
|
18604
18669
|
return capAtRemotes(autonomy, cwd, target);
|
|
18605
18670
|
}
|
|
18606
18671
|
function capAtRemotes(autonomy, cwd, target) {
|
|
18607
|
-
const claiming =
|
|
18672
|
+
const claiming = entriesIn(accountDir()).filter((entry) => entry.remotes?.length);
|
|
18608
18673
|
if (claiming.length === 0)
|
|
18609
18674
|
return autonomy;
|
|
18610
18675
|
const remotes = target === undefined ? checkoutRemotes(cwd) : typeof target === "function" ? target() : target;
|
|
@@ -18619,15 +18684,15 @@ function capAtRemotes(autonomy, cwd, target) {
|
|
|
18619
18684
|
}
|
|
18620
18685
|
return capped;
|
|
18621
18686
|
}
|
|
18622
|
-
var grantsMatter = (kind) => !grantsOverride() &&
|
|
18687
|
+
var grantsMatter = (kind) => !grantsOverride() && entriesIn(accountDir()).some((entry) => {
|
|
18623
18688
|
const autonomy = autonomyOf(entry);
|
|
18624
18689
|
return entry.remotes?.length || autonomy.grants[kind] === false || autonomy.configured.length > 0 && !autonomy.accountConfigured;
|
|
18625
18690
|
});
|
|
18626
|
-
var remotesClaimed = (dir =
|
|
18627
|
-
function targetClaims(target, dir =
|
|
18691
|
+
var remotesClaimed = (dir = accountDir()) => entriesIn(dir).some((entry) => entry.remotes?.length);
|
|
18692
|
+
function targetClaims(target, dir = accountDir()) {
|
|
18628
18693
|
if (target instanceof Error)
|
|
18629
18694
|
return target;
|
|
18630
|
-
const claiming =
|
|
18695
|
+
const claiming = entriesIn(dir).filter((entry) => entry.remotes?.length);
|
|
18631
18696
|
return target.remotes.flatMap((remote) => claiming.flatMap((entry) => {
|
|
18632
18697
|
const pattern = entry.remotes.find((item) => remoteMatches(item, remote.key));
|
|
18633
18698
|
return pattern ? [{ url: remote.url, workspace: entry.name, pattern }] : [];
|
|
@@ -18665,7 +18730,7 @@ function rawGrantDenial(cwd, kind, target) {
|
|
|
18665
18730
|
const claims = targetClaims(lazy());
|
|
18666
18731
|
if (claims instanceof Error)
|
|
18667
18732
|
return { error: `${kind}: ${claims.message}`, unblock: "name a target workit can resolve" };
|
|
18668
|
-
const entries =
|
|
18733
|
+
const entries = entriesIn(accountDir());
|
|
18669
18734
|
const strict = claims.find(({ workspace: name }) => {
|
|
18670
18735
|
const entry = entries.find((item) => item.name === name);
|
|
18671
18736
|
return entry && autonomyOf(entry).grants[kind] === false;
|
|
@@ -19319,7 +19384,7 @@ var joinDir = (base, raw) => {
|
|
|
19319
19384
|
const next = raw.replace(HERE, ".");
|
|
19320
19385
|
if (base === undefined || /[$`*?]/.test(next) || next === "-")
|
|
19321
19386
|
return;
|
|
19322
|
-
const expanded = next === "~" || next.startsWith("~/") ? path28.join(
|
|
19387
|
+
const expanded = next === "~" || next.startsWith("~/") ? path28.join(os6.homedir(), next.slice(1)) : next;
|
|
19323
19388
|
return base === null || isAbsolute(expanded) ? expanded : path28.join(base, expanded);
|
|
19324
19389
|
};
|
|
19325
19390
|
var rebase = (base, inner) => inner === null ? base : inner === undefined ? undefined : joinDir(base, inner);
|
|
@@ -19721,7 +19786,7 @@ function walk2(command, dialect, depth, seen, inherited = {}) {
|
|
|
19721
19786
|
}
|
|
19722
19787
|
if (CD.has(name)) {
|
|
19723
19788
|
const target = cdTarget(words);
|
|
19724
|
-
dir = target === null ?
|
|
19789
|
+
dir = target === null ? os6.homedir() : joinDir(dir, target);
|
|
19725
19790
|
} else if (PUSHD.has(name)) {
|
|
19726
19791
|
const target = cdTarget(words);
|
|
19727
19792
|
stack.push(dir);
|
|
@@ -20264,7 +20329,7 @@ var gitConfig = (dir, invocation, cache) => {
|
|
|
20264
20329
|
if (cached)
|
|
20265
20330
|
return cached;
|
|
20266
20331
|
const config = new Map;
|
|
20267
|
-
const listed =
|
|
20332
|
+
const listed = spawnSync16("git", [...invocation.config ?? [], "config", "-z", "--list"], {
|
|
20268
20333
|
cwd: dir,
|
|
20269
20334
|
encoding: "utf8",
|
|
20270
20335
|
timeout: 3000,
|
|
@@ -20437,7 +20502,7 @@ var refFacts = (repo, remote) => {
|
|
|
20437
20502
|
tags: new Set,
|
|
20438
20503
|
remoteHeads: new Set
|
|
20439
20504
|
};
|
|
20440
|
-
const listed =
|
|
20505
|
+
const listed = spawnSync16("git", ["for-each-ref", "--format=%(refname)", "refs/heads", "refs/tags", `refs/remotes/${remote}`], { cwd: repo.dir, encoding: "utf8", timeout: 5000 });
|
|
20441
20506
|
const remotePrefix = `refs/remotes/${remote}/`;
|
|
20442
20507
|
for (const ref of (listed.stdout ?? "").split(`
|
|
20443
20508
|
`)) {
|
|
@@ -20454,7 +20519,7 @@ var globBranches = (repo, glob) => {
|
|
|
20454
20519
|
const source = glob.source.startsWith("refs/") ? glob.source : `refs/heads/${glob.source}`;
|
|
20455
20520
|
const [sourcePrefix, sourceSuffix = ""] = source.split("*");
|
|
20456
20521
|
const [destinationPrefix, destinationSuffix = ""] = glob.destination.split("*");
|
|
20457
|
-
const listed =
|
|
20522
|
+
const listed = spawnSync16("git", [
|
|
20458
20523
|
"for-each-ref",
|
|
20459
20524
|
"--format=%(refname)",
|
|
20460
20525
|
sourcePrefix.slice(0, sourcePrefix.lastIndexOf("/") + 1)
|
|
@@ -20531,7 +20596,7 @@ var tagRefusal = (action, facts, dir) => {
|
|
|
20531
20596
|
return `workit: raw ${quote(`git push${action.allTags ? " --tags" : ""}`)} of ${tags.length ? `tag ${tags.join(", ")}` : "tags"} bypasses the release grant. Push a release tag with ${quote(`workit git push --release ${named}`)} (${shape} tags whose commit the production branch already has; a tag never moves), under the ${quote("release")} grant (if refused, ask the user to run ${quote("workit grant set <workspace> release=true")}).`;
|
|
20532
20597
|
};
|
|
20533
20598
|
var remoteHeads = (repo, remote) => {
|
|
20534
|
-
const listed =
|
|
20599
|
+
const listed = spawnSync16("git", ["ls-remote", "--heads", remote], {
|
|
20535
20600
|
cwd: repo.dir,
|
|
20536
20601
|
encoding: "utf8",
|
|
20537
20602
|
timeout: 3000,
|
|
@@ -20752,7 +20817,7 @@ var cdCommitCall = (input, command, target, repo) => {
|
|
|
20752
20817
|
if (!messages.length)
|
|
20753
20818
|
return null;
|
|
20754
20819
|
if (!all) {
|
|
20755
|
-
const staged =
|
|
20820
|
+
const staged = spawnSync16("git", ["diff", "--cached", "--quiet"], {
|
|
20756
20821
|
cwd: target,
|
|
20757
20822
|
timeout: 5000
|
|
20758
20823
|
});
|
|
@@ -20914,7 +20979,7 @@ function noteRawCommit(input, command, key) {
|
|
|
20914
20979
|
} catch {}
|
|
20915
20980
|
}
|
|
20916
20981
|
var headCommit = (dir) => {
|
|
20917
|
-
const run =
|
|
20982
|
+
const run = spawnSync16("git", [
|
|
20918
20983
|
"log",
|
|
20919
20984
|
"-1",
|
|
20920
20985
|
"--format=%H%x1f%ct%x1f%s%x1f%(trailers:key=Workit-Session,valueonly,separator=%x2c)"
|
|
@@ -21138,7 +21203,7 @@ var targetsOf = (invocations) => invocations.flatMap((invocation) => invocation.
|
|
|
21138
21203
|
branch,
|
|
21139
21204
|
dir: invocation.dir
|
|
21140
21205
|
})) : []);
|
|
21141
|
-
var localBranchExists = (dir, branch) =>
|
|
21206
|
+
var localBranchExists = (dir, branch) => spawnSync17("git", ["show-ref", "--verify", "--quiet", `refs/heads/${branch}`], {
|
|
21142
21207
|
cwd: dir,
|
|
21143
21208
|
stdio: "ignore",
|
|
21144
21209
|
timeout: 5000
|
|
@@ -23144,8 +23209,8 @@ class WorkitCore {
|
|
|
23144
23209
|
}
|
|
23145
23210
|
}
|
|
23146
23211
|
// packages/workit-core/src/core/repo-context.ts
|
|
23147
|
-
import { spawnSync as
|
|
23148
|
-
import { existsSync as existsSync11, readFileSync as
|
|
23212
|
+
import { spawnSync as spawnSync18 } from "node:child_process";
|
|
23213
|
+
import { existsSync as existsSync11, readFileSync as readFileSync10, readdirSync as readdirSync4 } from "node:fs";
|
|
23149
23214
|
import path30 from "node:path";
|
|
23150
23215
|
var isSafeContextRange = (value) => value.length <= 4096 && (() => {
|
|
23151
23216
|
try {
|
|
@@ -23173,7 +23238,7 @@ var invalidRange = (cwd) => ({
|
|
|
23173
23238
|
cwd
|
|
23174
23239
|
});
|
|
23175
23240
|
var runGit = (cwd, args) => {
|
|
23176
|
-
const result =
|
|
23241
|
+
const result = spawnSync18("git", args, { cwd, encoding: "utf8" });
|
|
23177
23242
|
return {
|
|
23178
23243
|
stdout: (result.stdout ?? "").trimEnd(),
|
|
23179
23244
|
stderr: (result.stderr ?? "").trimEnd(),
|
|
@@ -23330,7 +23395,7 @@ var packageScripts = (cwd, keys) => {
|
|
|
23330
23395
|
if (!existsSync11(pkgPath))
|
|
23331
23396
|
return [];
|
|
23332
23397
|
try {
|
|
23333
|
-
const pkg = JSON.parse(
|
|
23398
|
+
const pkg = JSON.parse(readFileSync10(pkgPath, "utf8"));
|
|
23334
23399
|
return keys.filter((k) => pkg.scripts && typeof pkg.scripts[k] === "string").map((k) => `${k}: ${pkg.scripts?.[k]}`);
|
|
23335
23400
|
} catch {
|
|
23336
23401
|
return [];
|
|
@@ -23364,7 +23429,7 @@ var documentationFiles = (cwd) => {
|
|
|
23364
23429
|
var readTrimmed2 = (file, maxLines) => {
|
|
23365
23430
|
if (!existsSync11(file))
|
|
23366
23431
|
return "";
|
|
23367
|
-
const lines =
|
|
23432
|
+
const lines = readFileSync10(file, "utf8").split(`
|
|
23368
23433
|
`);
|
|
23369
23434
|
return lines.slice(0, maxLines).join(`
|
|
23370
23435
|
`);
|
|
@@ -23552,7 +23617,7 @@ function docsRefreshContext(root, range) {
|
|
|
23552
23617
|
const pkgPath = path30.join(cwd, "package.json");
|
|
23553
23618
|
if (existsSync11(pkgPath)) {
|
|
23554
23619
|
try {
|
|
23555
|
-
const pkg = JSON.parse(
|
|
23620
|
+
const pkg = JSON.parse(readFileSync10(pkgPath, "utf8"));
|
|
23556
23621
|
stdout += JSON.stringify({ name: pkg.name, version: pkg.version, scripts: pkg.scripts }, null, 2) + `
|
|
23557
23622
|
`;
|
|
23558
23623
|
} catch {}
|
|
@@ -23634,12 +23699,12 @@ function releaseNotesContext(root, rangeOrTag) {
|
|
|
23634
23699
|
}
|
|
23635
23700
|
|
|
23636
23701
|
// packages/workit-core/src/core/tracker-issues.ts
|
|
23637
|
-
import { spawnSync as
|
|
23702
|
+
import { spawnSync as spawnSync20 } from "node:child_process";
|
|
23638
23703
|
|
|
23639
23704
|
// packages/workit-core/src/core/pr-create.ts
|
|
23640
23705
|
import fs20 from "node:fs";
|
|
23641
23706
|
import path31 from "node:path";
|
|
23642
|
-
import { spawnSync as
|
|
23707
|
+
import { spawnSync as spawnSync19 } from "node:child_process";
|
|
23643
23708
|
// packages/workit-core/src/forge/pr-body.ts
|
|
23644
23709
|
function parseGhIssue(value) {
|
|
23645
23710
|
const m = /issues\/(\d+)/.exec(value);
|
|
@@ -23673,7 +23738,7 @@ function whichOnPath(tool) {
|
|
|
23673
23738
|
}
|
|
23674
23739
|
var hostingCliAvailable = (provider) => whichOnPath(provider === "gitlab" ? "glab" : "gh") !== null;
|
|
23675
23740
|
var pushRemote = (cwd) => {
|
|
23676
|
-
const result =
|
|
23741
|
+
const result = spawnSync19("git", ["remote", "get-url", "--push", "--all", "origin"], {
|
|
23677
23742
|
cwd,
|
|
23678
23743
|
...LOCAL
|
|
23679
23744
|
});
|
|
@@ -23704,7 +23769,7 @@ var defaultCli = (bin, available) => {
|
|
|
23704
23769
|
if (!available)
|
|
23705
23770
|
return null;
|
|
23706
23771
|
return (args, root) => {
|
|
23707
|
-
const out =
|
|
23772
|
+
const out = spawnSync20(bin, args, {
|
|
23708
23773
|
cwd: root,
|
|
23709
23774
|
encoding: "utf8",
|
|
23710
23775
|
env: { ...process.env, PATH: process.env.PATH ?? "" }
|
|
@@ -23794,7 +23859,7 @@ var ASSET_ROOT = assetRoot();
|
|
|
23794
23859
|
var resolveWorkspaceRoot = (explicit) => explicit || process.cwd();
|
|
23795
23860
|
|
|
23796
23861
|
// packages/workit-core/src/core/youtrack-ytrack.ts
|
|
23797
|
-
import { spawnSync as
|
|
23862
|
+
import { spawnSync as spawnSync21 } from "node:child_process";
|
|
23798
23863
|
|
|
23799
23864
|
// packages/workit-core/src/forge/exec.ts
|
|
23800
23865
|
import fs21 from "node:fs";
|
|
@@ -23832,7 +23897,7 @@ function ytrackRunner(env, host, timeoutMs = TIMEOUT_MS) {
|
|
|
23832
23897
|
const exe = findYtrack(env);
|
|
23833
23898
|
if (!exe)
|
|
23834
23899
|
return { status: null, stdout: "", stderr: "", missing: true };
|
|
23835
|
-
const result =
|
|
23900
|
+
const result = spawnSync21(exe, args, {
|
|
23836
23901
|
encoding: "utf8",
|
|
23837
23902
|
env: { ...env, NO_COLOR: "1", ...host ? { YTRACK_HOST: host } : {} },
|
|
23838
23903
|
timeout: timeoutMs,
|
|
@@ -24239,7 +24304,7 @@ function resolveInside(root, candidate) {
|
|
|
24239
24304
|
}
|
|
24240
24305
|
function run2(root, executable, args, env = {}) {
|
|
24241
24306
|
const cwd = realpathSync8(root);
|
|
24242
|
-
const result =
|
|
24307
|
+
const result = spawnSync22(executable, args, {
|
|
24243
24308
|
cwd,
|
|
24244
24309
|
encoding: "utf8",
|
|
24245
24310
|
env: { ...process.env, ...env }
|
|
@@ -24631,7 +24696,7 @@ var userOnlyWorkitCall = (command, dialect = "posix") => {
|
|
|
24631
24696
|
};
|
|
24632
24697
|
// packages/workit-core/src/core/heavy-rules.ts
|
|
24633
24698
|
import fs24 from "node:fs";
|
|
24634
|
-
import
|
|
24699
|
+
import os7 from "node:os";
|
|
24635
24700
|
import path36 from "node:path";
|
|
24636
24701
|
var EMPTY2 = () => ({ deny: [], allow: [] });
|
|
24637
24702
|
var readText3 = (file) => {
|
|
@@ -24689,7 +24754,7 @@ var projectDirs = (cwd) => {
|
|
|
24689
24754
|
return dirs;
|
|
24690
24755
|
}
|
|
24691
24756
|
};
|
|
24692
|
-
var homeOf = (env) => env.HOME ||
|
|
24757
|
+
var homeOf = (env) => env.HOME || os7.homedir();
|
|
24693
24758
|
var CLAUDE_MANAGED = {
|
|
24694
24759
|
linux: "/etc/claude-code/managed-settings.json",
|
|
24695
24760
|
darwin: "/Library/Application Support/ClaudeCode/managed-settings.json",
|
|
@@ -25421,20 +25486,20 @@ var splitDenial = (plan) => ({
|
|
|
25421
25486
|
});
|
|
25422
25487
|
// packages/workit-core/src/hooks/write-gate.ts
|
|
25423
25488
|
import { existsSync as existsSync13, realpathSync as realpathSync9, statSync as statSync4 } from "node:fs";
|
|
25424
|
-
import
|
|
25489
|
+
import os9 from "node:os";
|
|
25425
25490
|
import path40 from "node:path";
|
|
25426
25491
|
|
|
25427
25492
|
// packages/workit-core/src/core/live-session.ts
|
|
25428
|
-
import { spawnSync as
|
|
25493
|
+
import { spawnSync as spawnSync23 } from "node:child_process";
|
|
25429
25494
|
import { createHash as createHash17 } from "node:crypto";
|
|
25430
25495
|
import fs27 from "node:fs";
|
|
25431
|
-
import
|
|
25496
|
+
import os8 from "node:os";
|
|
25432
25497
|
import path39 from "node:path";
|
|
25433
25498
|
var LIVE_SESSION_TTL_MS = 15 * 60000;
|
|
25434
25499
|
var HEARTBEAT_EVERY_MS = 30000;
|
|
25435
25500
|
var liveProbe = {
|
|
25436
25501
|
platform: process.platform,
|
|
25437
|
-
run: (args) =>
|
|
25502
|
+
run: (args) => spawnSync23("ps", args, { encoding: "utf8", timeout: 2000 }).stdout ?? "",
|
|
25438
25503
|
start: (pid) => processStartOf(pid)
|
|
25439
25504
|
};
|
|
25440
25505
|
var leadOf = (session) => session.split(":")[0].replace(/-w-.*$/su, "") || session;
|
|
@@ -25554,7 +25619,7 @@ var isLive = (marker, deps) => {
|
|
|
25554
25619
|
const age = ageOf2(marker, deps.now ?? new Date);
|
|
25555
25620
|
if (age > (deps.ttlMs ?? LIVE_SESSION_TTL_MS))
|
|
25556
25621
|
return false;
|
|
25557
|
-
if (marker.machine !== (deps.machine ??
|
|
25622
|
+
if (marker.machine !== (deps.machine ?? os8.hostname()) || marker.pid === null)
|
|
25558
25623
|
return true;
|
|
25559
25624
|
if (!(deps.alive ?? processAlive)(marker.pid))
|
|
25560
25625
|
return false;
|
|
@@ -25583,7 +25648,7 @@ var liveConflict = (target, owner, deps = {}) => {
|
|
|
25583
25648
|
const marker = readMarker(file);
|
|
25584
25649
|
if (!marker || sameLead(marker, owner) || !isLive(marker, deps))
|
|
25585
25650
|
return null;
|
|
25586
|
-
if (sameOwner(marker, owner, deps.machine ??
|
|
25651
|
+
if (sameOwner(marker, owner, deps.machine ?? os8.hostname()))
|
|
25587
25652
|
return null;
|
|
25588
25653
|
return { marker, file, ageMs: ageOf2(marker, deps.now ?? new Date), checkout };
|
|
25589
25654
|
} catch {
|
|
@@ -25597,7 +25662,7 @@ var claimLiveSession = (target, owner, deps = {}) => {
|
|
|
25597
25662
|
return;
|
|
25598
25663
|
const file = markerFile2(checkout);
|
|
25599
25664
|
const now = deps.now ?? new Date;
|
|
25600
|
-
const machine = deps.machine ??
|
|
25665
|
+
const machine = deps.machine ?? os8.hostname();
|
|
25601
25666
|
const current = readMarker(file);
|
|
25602
25667
|
if (current) {
|
|
25603
25668
|
const age = ageOf2(current, now);
|
|
@@ -26124,7 +26189,7 @@ var cdInto = (dir, words, strict = false, vars = new Map) => {
|
|
|
26124
26189
|
return lost;
|
|
26125
26190
|
if (dir === undefined)
|
|
26126
26191
|
return lost;
|
|
26127
|
-
return target === undefined ?
|
|
26192
|
+
return target === undefined ? os9.homedir() : path40.resolve(dir, target);
|
|
26128
26193
|
};
|
|
26129
26194
|
var quoteWord2 = (word) => /^[\w@%+=:,./-]+$/.test(word) ? word : `'${word.replaceAll("'", "'\\''")}'`;
|
|
26130
26195
|
var expandVars = (text, vars) => vars.size === 0 || !text.includes("$") ? text : text.replace(/\$(?:(\w+)|\{(\w+)\})/g, (whole, bare, braced) => {
|
|
@@ -26326,7 +26391,7 @@ var mktempPath = (value, dir) => {
|
|
|
26326
26391
|
template = arg;
|
|
26327
26392
|
}
|
|
26328
26393
|
if (base === null && (temp || template === undefined))
|
|
26329
|
-
base =
|
|
26394
|
+
base = os9.tmpdir();
|
|
26330
26395
|
const name = homeExpanded(template ?? "tmp.XXXXXXXXXX");
|
|
26331
26396
|
if (path40.isAbsolute(name))
|
|
26332
26397
|
return name;
|
|
@@ -26337,7 +26402,7 @@ var mktempPath = (value, dir) => {
|
|
|
26337
26402
|
};
|
|
26338
26403
|
var homeExpanded = (file) => {
|
|
26339
26404
|
const match = /^(?:~|\$HOME|\$\{HOME\})(?=\/|$)/.exec(file);
|
|
26340
|
-
return match ? (process.env.HOME ||
|
|
26405
|
+
return match ? (process.env.HOME || os9.homedir()) + file.slice(match[0].length) : file;
|
|
26341
26406
|
};
|
|
26342
26407
|
var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherited = new Map) => {
|
|
26343
26408
|
const targets = [];
|
|
@@ -26734,7 +26799,7 @@ function beforeWriteGate(cwd, paths) {
|
|
|
26734
26799
|
}
|
|
26735
26800
|
}
|
|
26736
26801
|
// packages/workit-core/src/hooks/stop.ts
|
|
26737
|
-
import { spawnSync as
|
|
26802
|
+
import { spawnSync as spawnSync24 } from "node:child_process";
|
|
26738
26803
|
|
|
26739
26804
|
// packages/workit-core/src/ci-waiter.ts
|
|
26740
26805
|
import fs28 from "node:fs";
|
|
@@ -26833,7 +26898,7 @@ var asksUser = (message) => {
|
|
|
26833
26898
|
};
|
|
26834
26899
|
var short = (sha) => (sha ?? "?").slice(0, 12);
|
|
26835
26900
|
var gitList = (cwd, args) => {
|
|
26836
|
-
const run =
|
|
26901
|
+
const run = spawnSync24("git", args, {
|
|
26837
26902
|
cwd,
|
|
26838
26903
|
encoding: "utf8",
|
|
26839
26904
|
timeout: 3000,
|
|
@@ -27284,7 +27349,7 @@ import path44 from "node:path";
|
|
|
27284
27349
|
|
|
27285
27350
|
// packages/workit-core/src/approvals/store.ts
|
|
27286
27351
|
import { createHash as createHash18, randomBytes as randomBytes4 } from "node:crypto";
|
|
27287
|
-
import { mkdirSync as mkdirSync6, readdirSync as readdirSync5, readFileSync as
|
|
27352
|
+
import { mkdirSync as mkdirSync6, readdirSync as readdirSync5, readFileSync as readFileSync11 } from "node:fs";
|
|
27288
27353
|
import path42 from "node:path";
|
|
27289
27354
|
var REQUEST_TTL_MS = 30 * 60000;
|
|
27290
27355
|
var GRANT_TTL_MS = 15 * 60000;
|
|
@@ -27303,7 +27368,7 @@ var fileOf = (part, id) => path42.join(dirOf(part), `${id}.json`);
|
|
|
27303
27368
|
var askedFile = (session, toolUseId) => path42.join(dirOf("asked"), `${createHash18("sha256").update(`${session}\x00${toolUseId}`).digest("hex").slice(0, 32)}.json`);
|
|
27304
27369
|
var readJson3 = (file) => {
|
|
27305
27370
|
try {
|
|
27306
|
-
const value = JSON.parse(
|
|
27371
|
+
const value = JSON.parse(readFileSync11(file, "utf8"));
|
|
27307
27372
|
return value !== null && typeof value === "object" ? value : null;
|
|
27308
27373
|
} catch {
|
|
27309
27374
|
return null;
|
|
@@ -28688,7 +28753,7 @@ var cdWorkitSplit = (command) => {
|
|
|
28688
28753
|
|
|
28689
28754
|
// packages/workit-core/src/hooks/model-limit.ts
|
|
28690
28755
|
import { closeSync as closeSync3, openSync as openSync3, readdirSync as readdirSync6, readSync, statSync as statSync5 } from "node:fs";
|
|
28691
|
-
import
|
|
28756
|
+
import os10 from "node:os";
|
|
28692
28757
|
import path45 from "node:path";
|
|
28693
28758
|
var MONTHS = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"];
|
|
28694
28759
|
var WEEKDAYS = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
|
|
@@ -28894,7 +28959,7 @@ var listDir = (dir) => {
|
|
|
28894
28959
|
};
|
|
28895
28960
|
var SCAN_MS = 30 * 60000;
|
|
28896
28961
|
var scanClaudeTranscripts = (cwd, env, now = new Date) => {
|
|
28897
|
-
const projects = path45.join(env.CLAUDE_CONFIG_DIR || path45.join(env.HOME ||
|
|
28962
|
+
const projects = path45.join(env.CLAUDE_CONFIG_DIR || path45.join(env.HOME || os10.homedir(), ".claude"), "projects");
|
|
28898
28963
|
const project = path45.join(projects, claudeProjectSlug(cwd));
|
|
28899
28964
|
const notes = [];
|
|
28900
28965
|
const files = listDir(project).flatMap((entry) => entry.endsWith(".jsonl") ? [{ file: entry, worker: false }] : listDir(path45.join(entry, "subagents")).filter((file) => file.endsWith(".jsonl")).map((file) => ({ file, worker: true })));
|
|
@@ -29760,8 +29825,8 @@ var observeToolResult = (event, ctx) => {
|
|
|
29760
29825
|
var skillPromptNudge = (prompt, ctx) => process.env.WORKIT_PI_WORKER_SESSION ? null : promptNudge(hookInput(ctx, { kind: "context.turn", prompt }), prompt);
|
|
29761
29826
|
|
|
29762
29827
|
// packages/workit-pi/src/launches.ts
|
|
29763
|
-
import { mkdirSync as mkdirSync7, readFileSync as
|
|
29764
|
-
import
|
|
29828
|
+
import { mkdirSync as mkdirSync7, readFileSync as readFileSync12, readdirSync as readdirSync7, rmSync as rmSync3, writeFileSync as writeFileSync6 } from "node:fs";
|
|
29829
|
+
import os11 from "node:os";
|
|
29765
29830
|
import path47 from "node:path";
|
|
29766
29831
|
var launchDir = (root) => {
|
|
29767
29832
|
const location = resolveStore(root);
|
|
@@ -29777,7 +29842,7 @@ var recordLaunch = (root, attempt) => {
|
|
|
29777
29842
|
writeFileSync6(fileFor(dir, attempt.workerId), JSON.stringify({
|
|
29778
29843
|
...attempt,
|
|
29779
29844
|
pid: process.pid,
|
|
29780
|
-
host:
|
|
29845
|
+
host: os11.hostname(),
|
|
29781
29846
|
at: new Date().toISOString()
|
|
29782
29847
|
}), { flag: "wx" });
|
|
29783
29848
|
return true;
|
|
@@ -29791,7 +29856,7 @@ var clearLaunch = (root, workerId) => {
|
|
|
29791
29856
|
rmSync3(fileFor(dir, workerId), { force: true });
|
|
29792
29857
|
};
|
|
29793
29858
|
var alive = (attempt) => {
|
|
29794
|
-
if (attempt.host !==
|
|
29859
|
+
if (attempt.host !== os11.hostname())
|
|
29795
29860
|
return true;
|
|
29796
29861
|
try {
|
|
29797
29862
|
process.kill(attempt.pid, 0);
|
|
@@ -29813,7 +29878,7 @@ var abandonedLaunches = (root) => {
|
|
|
29813
29878
|
const found = [];
|
|
29814
29879
|
for (const name of names) {
|
|
29815
29880
|
try {
|
|
29816
|
-
const attempt = JSON.parse(
|
|
29881
|
+
const attempt = JSON.parse(readFileSync12(path47.join(dir, name), "utf8"));
|
|
29817
29882
|
if (typeof attempt.workerId === "string" && typeof attempt.session === "string") {
|
|
29818
29883
|
if (!alive(attempt))
|
|
29819
29884
|
found.push(attempt);
|