@workit-dev/codex 2.20.6 → 2.21.0
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
|
@@ -15526,7 +15526,8 @@ var workspaceConfigSchema = object({
|
|
|
15526
15526
|
youtrack: object({
|
|
15527
15527
|
baseUrl: nonBlank.optional().describe("This workspace's YouTrack URL."),
|
|
15528
15528
|
link_issues: boolean2().optional().describe("Legacy alias of `issues: { provider: youtrack, link: true }`."),
|
|
15529
|
-
writes: _enum(["ask", "auto"]).optional().describe("ask (default): each workit youtrack write waits for the user's yes. auto: posts without asking, behind WORKIT_YT_WRITE=1.")
|
|
15529
|
+
writes: _enum(["ask", "auto"]).optional().describe("ask (default): each workit youtrack write waits for the user's yes. auto: posts without asking, behind WORKIT_YT_WRITE=1."),
|
|
15530
|
+
autoHosts: array(nonBlank).optional().describe("With writes auto: the only YouTrack hosts (`acme.youtrack.cloud`) a write may reach without asking. A raw ytrack write must name one with --host; a write elsewhere asks. Only the user widens it, in their own terminal (`workit workspace seal`).")
|
|
15530
15531
|
}).passthrough().optional().describe("YouTrack settings for this workspace."),
|
|
15531
15532
|
issues: object({
|
|
15532
15533
|
provider: _enum(["github", "gitlab", "youtrack"]).optional().describe("The issue tracker PRs link to."),
|
|
@@ -24817,7 +24818,7 @@ var exportDigest = (bundle) => sha256({
|
|
|
24817
24818
|
});
|
|
24818
24819
|
// packages/workit-core/src/autonomy.ts
|
|
24819
24820
|
import { closeSync as closeSync2, copyFileSync as copyFileSync2, existsSync as existsSync11, openSync as openSync2 } from "node:fs";
|
|
24820
|
-
import
|
|
24821
|
+
import path27 from "node:path";
|
|
24821
24822
|
|
|
24822
24823
|
// packages/workit-core/src/core/eval-world.ts
|
|
24823
24824
|
import { existsSync as existsSync10, realpathSync as realpathSync6 } from "node:fs";
|
|
@@ -24882,7 +24883,7 @@ var sealProjection = (entries) => entries.map((entry) => {
|
|
|
24882
24883
|
return pick2({
|
|
24883
24884
|
...all,
|
|
24884
24885
|
vcs: pick2(all.vcs, IDENTITY_KEYS),
|
|
24885
|
-
youtrack: pick2(all.youtrack, ["writes"])
|
|
24886
|
+
youtrack: pick2(all.youtrack, ["writes", "autoHosts"])
|
|
24886
24887
|
}, ENTRY_KEYS);
|
|
24887
24888
|
});
|
|
24888
24889
|
var canonical3 = (value) => JSON.stringify(value, (_key, item) => item && typeof item === "object" && !Array.isArray(item) ? Object.fromEntries(Object.entries(item).toSorted(([a], [b]) => a < b ? -1 : a > b ? 1 : 0)) : item);
|
|
@@ -24912,6 +24913,76 @@ function checkSeal(dir) {
|
|
|
24912
24913
|
return ok && sealDigest(sealProjection(current.entries)) === seal.sha256 ? { state: "valid" } : broken("workspaces.json changed since it was sealed", sealed.entries);
|
|
24913
24914
|
}
|
|
24914
24915
|
|
|
24916
|
+
// packages/workit-core/src/core/youtrack-ytrack.ts
|
|
24917
|
+
import { spawnSync as spawnSync16 } from "node:child_process";
|
|
24918
|
+
|
|
24919
|
+
// packages/workit-core/src/forge/exec.ts
|
|
24920
|
+
import fs18 from "node:fs";
|
|
24921
|
+
import path26 from "node:path";
|
|
24922
|
+
|
|
24923
|
+
// packages/workit-core/src/forge/redact.ts
|
|
24924
|
+
var KEY = String.raw`[A-Za-z0-9_.-]*?(?:token|secret|password|passwd|pwd|api[_-]?key|access[_-]?key|account[_-]?key|private[_-]?key|client[_-]?secret|credentials?|authorization|cookie|signature)[A-Za-z0-9_.-]*`;
|
|
24925
|
+
var ASSIGNMENT = new RegExp(String.raw`(?<![A-Za-z0-9])(["']?${KEY}["']?\s*[:=]\s*["']?)((?:bearer|basic|token|digest)\s+)?([^\s"',;&]+)`, "giu");
|
|
24926
|
+
var QUOTED_ASSIGNMENT = new RegExp(String.raw`(?<![A-Za-z0-9])(["']?${KEY}["']?\s*[:=]\s*)(["'])([^"'\n]*[^\s"'][^"'\n]*)\2`, "giu");
|
|
24927
|
+
var ANSI = new RegExp(String.raw`\u001b\[[0-9;?]*[ -/]*[@-~]|\u001b\][^\u0007]*\u0007`, "gu");
|
|
24928
|
+
|
|
24929
|
+
// packages/workit-core/src/forge/exec.ts
|
|
24930
|
+
var MAX_BUFFER2 = 64 * 1024 * 1024;
|
|
24931
|
+
function findExecutable(bin, env) {
|
|
24932
|
+
const dirs = (env.PATH ?? env.Path ?? "").split(path26.delimiter).filter(Boolean);
|
|
24933
|
+
const exts = process.platform === "win32" ? [".exe"] : [""];
|
|
24934
|
+
for (const dir of dirs)
|
|
24935
|
+
for (const ext of exts) {
|
|
24936
|
+
const candidate = path26.join(dir, `${bin}${ext}`);
|
|
24937
|
+
try {
|
|
24938
|
+
const stat = fs18.statSync(candidate);
|
|
24939
|
+
if (stat.isFile())
|
|
24940
|
+
return candidate;
|
|
24941
|
+
} catch {}
|
|
24942
|
+
}
|
|
24943
|
+
return null;
|
|
24944
|
+
}
|
|
24945
|
+
|
|
24946
|
+
// packages/workit-core/src/core/youtrack-ytrack.ts
|
|
24947
|
+
var TIMEOUT_MS = 60000;
|
|
24948
|
+
var YTRACK_EXIT = { ok: 0, failed: 1, cancelled: 2, auth: 4 };
|
|
24949
|
+
var findYtrack = (env) => env.WORKIT_NO_YTRACK === "1" ? null : findExecutable("ytrack", env);
|
|
24950
|
+
var YTRACK_QUIET_ENV = {
|
|
24951
|
+
YTRACK_NO_UPDATE_NOTIFIER: "1",
|
|
24952
|
+
YTRACK_NO_AUTO_UPGRADE: "1"
|
|
24953
|
+
};
|
|
24954
|
+
function ytrackRunner(env, host, timeoutMs = TIMEOUT_MS) {
|
|
24955
|
+
return (args, input) => {
|
|
24956
|
+
const exe = findYtrack(env);
|
|
24957
|
+
if (!exe)
|
|
24958
|
+
return { status: null, stdout: "", stderr: "", missing: true };
|
|
24959
|
+
const result = spawnSync16(exe, args, {
|
|
24960
|
+
encoding: "utf8",
|
|
24961
|
+
env: {
|
|
24962
|
+
...env,
|
|
24963
|
+
NO_COLOR: "1",
|
|
24964
|
+
...YTRACK_QUIET_ENV,
|
|
24965
|
+
...host ? { YTRACK_HOST: host } : {}
|
|
24966
|
+
},
|
|
24967
|
+
timeout: timeoutMs,
|
|
24968
|
+
killSignal: "SIGKILL",
|
|
24969
|
+
windowsHide: true,
|
|
24970
|
+
...input === undefined ? { stdio: ["ignore", "pipe", "pipe"] } : { input, stdio: ["pipe", "pipe", "pipe"] }
|
|
24971
|
+
});
|
|
24972
|
+
const error = result.error;
|
|
24973
|
+
if (error?.code === "ENOENT")
|
|
24974
|
+
return { status: null, stdout: "", stderr: "", missing: true };
|
|
24975
|
+
return {
|
|
24976
|
+
status: result.status,
|
|
24977
|
+
stdout: result.stdout ?? "",
|
|
24978
|
+
stderr: result.stderr || (error ? error.message : "")
|
|
24979
|
+
};
|
|
24980
|
+
};
|
|
24981
|
+
}
|
|
24982
|
+
var ytrackDetail = (out) => out.stderr.trim().split(`
|
|
24983
|
+
`).slice(-3).join(" ").slice(0, 300);
|
|
24984
|
+
var YTRACK_MISSING = "ytrack is not on PATH: Workit reaches YouTrack only through ytrack";
|
|
24985
|
+
|
|
24915
24986
|
// packages/workit-core/src/autonomy.ts
|
|
24916
24987
|
var accountHomeDir = () => {
|
|
24917
24988
|
const home = grantsHome.resolve();
|
|
@@ -24919,7 +24990,7 @@ var accountHomeDir = () => {
|
|
|
24919
24990
|
};
|
|
24920
24991
|
var deniedFile = (dir) => {
|
|
24921
24992
|
for (const name of ["workspaces.json", SEAL_FILE]) {
|
|
24922
|
-
const file =
|
|
24993
|
+
const file = path27.join(dir, name);
|
|
24923
24994
|
try {
|
|
24924
24995
|
closeSync2(openSync2(file, "r"));
|
|
24925
24996
|
} catch (error) {
|
|
@@ -24941,7 +25012,7 @@ var accountUnread = () => {
|
|
|
24941
25012
|
if (dir === null)
|
|
24942
25013
|
return NO_ACCOUNT;
|
|
24943
25014
|
const file = deniedFile(dir);
|
|
24944
|
-
return file === null ? null : `the account's ${
|
|
25015
|
+
return file === null ? null : `the account's ${path27.basename(file)} cannot be read (permission denied), so it reads as no workspace entries: no grants, no models, the D4 defaults apply`;
|
|
24945
25016
|
};
|
|
24946
25017
|
var entriesIn = (dir) => dir === null ? [] : loadWorkspacesFrom(dir);
|
|
24947
25018
|
var fileSource = (dir = accountDir()) => ({
|
|
@@ -24962,7 +25033,7 @@ var NO_SEAL_NOTE = `workspaces.json has no seal yet (${SEAL_COMMAND} has never r
|
|
|
24962
25033
|
var sealNote = (seal = sealOf()) => seal.state === "broken" ? `workspaces.json does not match its seal (${seal.reason}), so grants, endpoint, verification and youtrack.writes are the stricter of their current and last sealed values; ${SEAL_UNBLOCK}` : null;
|
|
24963
25034
|
var shownGrantsDir = () => {
|
|
24964
25035
|
const world = evalWorld(process.cwd());
|
|
24965
|
-
return world ?
|
|
25036
|
+
return world ? path27.join(world, "config") : accountDir();
|
|
24966
25037
|
};
|
|
24967
25038
|
var benchWorld = (cwd) => {
|
|
24968
25039
|
const entry = evalWorldEntry(cwd);
|
|
@@ -24986,10 +25057,10 @@ var grantsOverride = () => {
|
|
|
24986
25057
|
const shown = shownGrantsDir();
|
|
24987
25058
|
if (shown === null)
|
|
24988
25059
|
return accountUnread() ?? NO_ACCOUNT;
|
|
24989
|
-
const configured =
|
|
24990
|
-
return configured ===
|
|
25060
|
+
const configured = path27.resolve(resolveConfigDir());
|
|
25061
|
+
return configured === path27.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 ${path27.join(grantsDir(), "workspaces.json")}, and under a redirect they never exceed the D4 defaults`;
|
|
24991
25062
|
};
|
|
24992
|
-
var redirectUnblock = () => `ask the user: grants above the D4 defaults apply only without a config redirect (WORKIT_CONFIG, WORKIT_CONFIG_DIR or XDG_CONFIG_HOME), and are read from ${
|
|
25063
|
+
var redirectUnblock = () => `ask the user: grants above the D4 defaults apply only without a config redirect (WORKIT_CONFIG, WORKIT_CONFIG_DIR or XDG_CONFIG_HOME), and are read from ${path27.join(grantsDir(), "workspaces.json")}`;
|
|
24993
25064
|
var GRANT_KINDS = ["push", "pr", "merge", "release", "rerun"];
|
|
24994
25065
|
var DEFAULT_GRANTS = Object.freeze({
|
|
24995
25066
|
push: true,
|
|
@@ -27364,9 +27435,9 @@ class WorkitCore {
|
|
|
27364
27435
|
}
|
|
27365
27436
|
}
|
|
27366
27437
|
// packages/workit-core/src/core/repo-context.ts
|
|
27367
|
-
import { spawnSync as
|
|
27438
|
+
import { spawnSync as spawnSync17 } from "node:child_process";
|
|
27368
27439
|
import { existsSync as existsSync12, readFileSync as readFileSync11, readdirSync as readdirSync4 } from "node:fs";
|
|
27369
|
-
import
|
|
27440
|
+
import path28 from "node:path";
|
|
27370
27441
|
var isSafeContextRange = (value) => value.length <= 4096 && (() => {
|
|
27371
27442
|
try {
|
|
27372
27443
|
gitRevisionParts(value);
|
|
@@ -27393,7 +27464,7 @@ var invalidRange = (cwd) => ({
|
|
|
27393
27464
|
cwd
|
|
27394
27465
|
});
|
|
27395
27466
|
var runGit = (cwd, args) => {
|
|
27396
|
-
const result =
|
|
27467
|
+
const result = spawnSync17("git", args, { cwd, encoding: "utf8" });
|
|
27397
27468
|
return {
|
|
27398
27469
|
stdout: (result.stdout ?? "").trimEnd(),
|
|
27399
27470
|
stderr: (result.stderr ?? "").trimEnd(),
|
|
@@ -27510,13 +27581,13 @@ var findPrTemplate = (cwd) => {
|
|
|
27510
27581
|
for (const rel of PR_TEMPLATE_FILES) {
|
|
27511
27582
|
const parts = rel.split("/");
|
|
27512
27583
|
const base = parts[parts.length - 1];
|
|
27513
|
-
const dir = parts.length > 1 ?
|
|
27584
|
+
const dir = parts.length > 1 ? path28.join(cwd, ...parts.slice(0, -1)) : cwd;
|
|
27514
27585
|
const actual = probeCaseInsensitive(dir, base);
|
|
27515
27586
|
if (actual)
|
|
27516
27587
|
return [...parts.slice(0, -1), actual].join("/");
|
|
27517
27588
|
}
|
|
27518
27589
|
for (const rel of PR_TEMPLATE_DIRS) {
|
|
27519
|
-
const only = singleMarkdown(
|
|
27590
|
+
const only = singleMarkdown(path28.join(cwd, ...rel.split("/")));
|
|
27520
27591
|
if (only)
|
|
27521
27592
|
return `${rel}/${only}`;
|
|
27522
27593
|
}
|
|
@@ -27546,7 +27617,7 @@ var diffStatForRange = (cwd, range) => {
|
|
|
27546
27617
|
return runGit(cwd, ["diff", "--stat", "--"]).stdout;
|
|
27547
27618
|
};
|
|
27548
27619
|
var packageScripts = (cwd, keys) => {
|
|
27549
|
-
const pkgPath =
|
|
27620
|
+
const pkgPath = path28.join(cwd, "package.json");
|
|
27550
27621
|
if (!existsSync12(pkgPath))
|
|
27551
27622
|
return [];
|
|
27552
27623
|
try {
|
|
@@ -27572,9 +27643,9 @@ var documentationFiles = (cwd) => {
|
|
|
27572
27643
|
if (entry.isDirectory()) {
|
|
27573
27644
|
if (excluded.has(entry.name))
|
|
27574
27645
|
continue;
|
|
27575
|
-
walk(
|
|
27646
|
+
walk(path28.join(dir, entry.name), depth + 1);
|
|
27576
27647
|
} else if (entry.isFile() && (entry.name === "README.md" || entry.name.endsWith(".md"))) {
|
|
27577
|
-
matches.push("./" +
|
|
27648
|
+
matches.push("./" + path28.relative(cwd, path28.join(dir, entry.name)).replaceAll("\\", "/"));
|
|
27578
27649
|
}
|
|
27579
27650
|
}
|
|
27580
27651
|
};
|
|
@@ -27590,7 +27661,7 @@ var readTrimmed2 = (file, maxLines) => {
|
|
|
27590
27661
|
`);
|
|
27591
27662
|
};
|
|
27592
27663
|
function prReadyContext(root, range) {
|
|
27593
|
-
const cwd =
|
|
27664
|
+
const cwd = path28.resolve(repoRoot(root));
|
|
27594
27665
|
if (range !== undefined && !isResolvableContextRange(cwd, range))
|
|
27595
27666
|
return invalidRange(cwd);
|
|
27596
27667
|
let stdout = "";
|
|
@@ -27648,7 +27719,7 @@ ${status.stderr}` : "");
|
|
|
27648
27719
|
stdout += `template_path: ${template}
|
|
27649
27720
|
|
|
27650
27721
|
`;
|
|
27651
|
-
stdout += readTrimmed2(
|
|
27722
|
+
stdout += readTrimmed2(path28.join(cwd, template), 220);
|
|
27652
27723
|
} else {
|
|
27653
27724
|
stdout += `template_path: none
|
|
27654
27725
|
|
|
@@ -27658,7 +27729,7 @@ ${status.stderr}` : "");
|
|
|
27658
27729
|
stdout += `
|
|
27659
27730
|
`;
|
|
27660
27731
|
stdout += printSection("Recent Validation Signals");
|
|
27661
|
-
if (existsSync12(
|
|
27732
|
+
if (existsSync12(path28.join(cwd, "package.json"))) {
|
|
27662
27733
|
stdout += `package.json detected. Common scripts:
|
|
27663
27734
|
`;
|
|
27664
27735
|
const found = packageScripts(cwd, ["lint", "format:check", "test", "build"]);
|
|
@@ -27667,7 +27738,7 @@ ${status.stderr}` : "");
|
|
|
27667
27738
|
`) + `
|
|
27668
27739
|
`;
|
|
27669
27740
|
}
|
|
27670
|
-
if (existsSync12(
|
|
27741
|
+
if (existsSync12(path28.join(cwd, "Cargo.toml")) || existsSync12(path28.join(cwd, "src-tauri/Cargo.toml"))) {
|
|
27671
27742
|
stdout += `Rust project detected.
|
|
27672
27743
|
`;
|
|
27673
27744
|
}
|
|
@@ -27700,7 +27771,7 @@ var CHANGELOG_RULES = `- Use an [Unreleased] section.
|
|
|
27700
27771
|
- Apply with the host-native editor, preserving the repository changelog conventions.
|
|
27701
27772
|
- If Unreleased already has duplicate category headings, normalize_only first.`;
|
|
27702
27773
|
function changelogContext(root, range) {
|
|
27703
|
-
const cwd =
|
|
27774
|
+
const cwd = path28.resolve(repoRoot(root));
|
|
27704
27775
|
if (range !== undefined && !isResolvableContextRange(cwd, range))
|
|
27705
27776
|
return invalidRange(cwd);
|
|
27706
27777
|
const resolvedRange = rangeArgOrDefault(range, cwd);
|
|
@@ -27718,7 +27789,7 @@ function changelogContext(root, range) {
|
|
|
27718
27789
|
stdout += CHANGELOG_RULES + `
|
|
27719
27790
|
`;
|
|
27720
27791
|
stdout += printSection("Existing CHANGELOG.md");
|
|
27721
|
-
const changelogPath =
|
|
27792
|
+
const changelogPath = path28.join(cwd, "CHANGELOG.md");
|
|
27722
27793
|
if (existsSync12(changelogPath)) {
|
|
27723
27794
|
stdout += readTrimmed2(changelogPath, 260) + `
|
|
27724
27795
|
`;
|
|
@@ -27738,7 +27809,7 @@ function changelogContext(root, range) {
|
|
|
27738
27809
|
return { stdout, stderr: "", exitCode: 0, cwd };
|
|
27739
27810
|
}
|
|
27740
27811
|
function docsRefreshContext(root, range) {
|
|
27741
|
-
const cwd =
|
|
27812
|
+
const cwd = path28.resolve(repoRoot(root));
|
|
27742
27813
|
if (range !== undefined && !isResolvableContextRange(cwd, range))
|
|
27743
27814
|
return invalidRange(cwd);
|
|
27744
27815
|
const resolvedRange = rangeArgOrDefault(range, cwd);
|
|
@@ -27760,7 +27831,7 @@ function docsRefreshContext(root, range) {
|
|
|
27760
27831
|
`) + `
|
|
27761
27832
|
`;
|
|
27762
27833
|
stdout += printSection("README Preview");
|
|
27763
|
-
const readme =
|
|
27834
|
+
const readme = path28.join(cwd, "README.md");
|
|
27764
27835
|
if (existsSync12(readme)) {
|
|
27765
27836
|
stdout += readTrimmed2(readme, 220) + `
|
|
27766
27837
|
`;
|
|
@@ -27769,7 +27840,7 @@ function docsRefreshContext(root, range) {
|
|
|
27769
27840
|
`;
|
|
27770
27841
|
}
|
|
27771
27842
|
stdout += printSection("Package Scripts");
|
|
27772
|
-
const pkgPath =
|
|
27843
|
+
const pkgPath = path28.join(cwd, "package.json");
|
|
27773
27844
|
if (existsSync12(pkgPath)) {
|
|
27774
27845
|
try {
|
|
27775
27846
|
const pkg = JSON.parse(readFileSync11(pkgPath, "utf8"));
|
|
@@ -27783,7 +27854,7 @@ function docsRefreshContext(root, range) {
|
|
|
27783
27854
|
return { stdout, stderr: "", exitCode: 0, cwd };
|
|
27784
27855
|
}
|
|
27785
27856
|
function releaseNotesContext(root, rangeOrTag) {
|
|
27786
|
-
const cwd =
|
|
27857
|
+
const cwd = path28.resolve(repoRoot(root));
|
|
27787
27858
|
if (!rangeOrTag) {
|
|
27788
27859
|
return {
|
|
27789
27860
|
stdout: "",
|
|
@@ -27826,7 +27897,7 @@ function releaseNotesContext(root, rangeOrTag) {
|
|
|
27826
27897
|
`;
|
|
27827
27898
|
stdout += printSection("Existing Release Files");
|
|
27828
27899
|
for (const rel of ["CHANGELOG.md", "RELEASE_NOTES.md", ".github/releases.md"]) {
|
|
27829
|
-
if (existsSync12(
|
|
27900
|
+
if (existsSync12(path28.join(cwd, rel)))
|
|
27830
27901
|
stdout += rel + `
|
|
27831
27902
|
`;
|
|
27832
27903
|
}
|
|
@@ -27854,12 +27925,12 @@ function releaseNotesContext(root, rangeOrTag) {
|
|
|
27854
27925
|
}
|
|
27855
27926
|
|
|
27856
27927
|
// packages/workit-core/src/core/tracker-issues.ts
|
|
27857
|
-
import { spawnSync as
|
|
27928
|
+
import { spawnSync as spawnSync19 } from "node:child_process";
|
|
27858
27929
|
|
|
27859
27930
|
// packages/workit-core/src/core/pr-create.ts
|
|
27860
|
-
import
|
|
27861
|
-
import
|
|
27862
|
-
import { spawnSync as
|
|
27931
|
+
import fs19 from "node:fs";
|
|
27932
|
+
import path29 from "node:path";
|
|
27933
|
+
import { spawnSync as spawnSync18 } from "node:child_process";
|
|
27863
27934
|
// packages/workit-core/src/forge/pr-body.ts
|
|
27864
27935
|
function parseGhIssue(value) {
|
|
27865
27936
|
const m = /issues\/(\d+)/.exec(value);
|
|
@@ -27878,13 +27949,13 @@ var LOCAL = bounded(20000);
|
|
|
27878
27949
|
var NETWORK = bounded(60000);
|
|
27879
27950
|
function whichOnPath(tool) {
|
|
27880
27951
|
const names = process.platform === "win32" ? [tool, `${tool}.exe`, `${tool}.cmd`] : [tool];
|
|
27881
|
-
for (const dir of (process.env.PATH ?? "").split(
|
|
27952
|
+
for (const dir of (process.env.PATH ?? "").split(path29.delimiter)) {
|
|
27882
27953
|
if (!dir)
|
|
27883
27954
|
continue;
|
|
27884
27955
|
for (const name of names) {
|
|
27885
|
-
const candidate =
|
|
27956
|
+
const candidate = path29.join(dir, name);
|
|
27886
27957
|
try {
|
|
27887
|
-
|
|
27958
|
+
fs19.accessSync(candidate, fs19.constants.X_OK);
|
|
27888
27959
|
return candidate;
|
|
27889
27960
|
} catch {}
|
|
27890
27961
|
}
|
|
@@ -27893,7 +27964,7 @@ function whichOnPath(tool) {
|
|
|
27893
27964
|
}
|
|
27894
27965
|
var hostingCliAvailable = (provider) => whichOnPath(provider === "gitlab" ? "glab" : "gh") !== null;
|
|
27895
27966
|
var pushRemote = (cwd) => {
|
|
27896
|
-
const result =
|
|
27967
|
+
const result = spawnSync18("git", ["remote", "get-url", "--push", "--all", "origin"], {
|
|
27897
27968
|
cwd,
|
|
27898
27969
|
...LOCAL
|
|
27899
27970
|
});
|
|
@@ -27924,7 +27995,7 @@ var defaultCli = (bin, available) => {
|
|
|
27924
27995
|
if (!available)
|
|
27925
27996
|
return null;
|
|
27926
27997
|
return (args, root) => {
|
|
27927
|
-
const out =
|
|
27998
|
+
const out = spawnSync19(bin, args, {
|
|
27928
27999
|
cwd: root,
|
|
27929
28000
|
encoding: "utf8",
|
|
27930
28001
|
env: { ...process.env, PATH: process.env.PATH ?? "" }
|
|
@@ -28013,76 +28084,6 @@ var PLUGIN_ROOT = packageRoot();
|
|
|
28013
28084
|
var ASSET_ROOT = assetRoot();
|
|
28014
28085
|
var resolveWorkspaceRoot = (explicit) => explicit || process.cwd();
|
|
28015
28086
|
|
|
28016
|
-
// packages/workit-core/src/core/youtrack-ytrack.ts
|
|
28017
|
-
import { spawnSync as spawnSync19 } from "node:child_process";
|
|
28018
|
-
|
|
28019
|
-
// packages/workit-core/src/forge/exec.ts
|
|
28020
|
-
import fs19 from "node:fs";
|
|
28021
|
-
import path29 from "node:path";
|
|
28022
|
-
|
|
28023
|
-
// packages/workit-core/src/forge/redact.ts
|
|
28024
|
-
var KEY = String.raw`[A-Za-z0-9_.-]*?(?:token|secret|password|passwd|pwd|api[_-]?key|access[_-]?key|account[_-]?key|private[_-]?key|client[_-]?secret|credentials?|authorization|cookie|signature)[A-Za-z0-9_.-]*`;
|
|
28025
|
-
var ASSIGNMENT = new RegExp(String.raw`(?<![A-Za-z0-9])(["']?${KEY}["']?\s*[:=]\s*["']?)((?:bearer|basic|token|digest)\s+)?([^\s"',;&]+)`, "giu");
|
|
28026
|
-
var QUOTED_ASSIGNMENT = new RegExp(String.raw`(?<![A-Za-z0-9])(["']?${KEY}["']?\s*[:=]\s*)(["'])([^"'\n]*[^\s"'][^"'\n]*)\2`, "giu");
|
|
28027
|
-
var ANSI = new RegExp(String.raw`\u001b\[[0-9;?]*[ -/]*[@-~]|\u001b\][^\u0007]*\u0007`, "gu");
|
|
28028
|
-
|
|
28029
|
-
// packages/workit-core/src/forge/exec.ts
|
|
28030
|
-
var MAX_BUFFER2 = 64 * 1024 * 1024;
|
|
28031
|
-
function findExecutable(bin, env) {
|
|
28032
|
-
const dirs = (env.PATH ?? env.Path ?? "").split(path29.delimiter).filter(Boolean);
|
|
28033
|
-
const exts = process.platform === "win32" ? [".exe"] : [""];
|
|
28034
|
-
for (const dir of dirs)
|
|
28035
|
-
for (const ext of exts) {
|
|
28036
|
-
const candidate = path29.join(dir, `${bin}${ext}`);
|
|
28037
|
-
try {
|
|
28038
|
-
const stat = fs19.statSync(candidate);
|
|
28039
|
-
if (stat.isFile())
|
|
28040
|
-
return candidate;
|
|
28041
|
-
} catch {}
|
|
28042
|
-
}
|
|
28043
|
-
return null;
|
|
28044
|
-
}
|
|
28045
|
-
|
|
28046
|
-
// packages/workit-core/src/core/youtrack-ytrack.ts
|
|
28047
|
-
var TIMEOUT_MS = 60000;
|
|
28048
|
-
var YTRACK_EXIT = { ok: 0, failed: 1, cancelled: 2, auth: 4 };
|
|
28049
|
-
var findYtrack = (env) => env.WORKIT_NO_YTRACK === "1" ? null : findExecutable("ytrack", env);
|
|
28050
|
-
var YTRACK_QUIET_ENV = {
|
|
28051
|
-
YTRACK_NO_UPDATE_NOTIFIER: "1",
|
|
28052
|
-
YTRACK_NO_AUTO_UPGRADE: "1"
|
|
28053
|
-
};
|
|
28054
|
-
function ytrackRunner(env, host, timeoutMs = TIMEOUT_MS) {
|
|
28055
|
-
return (args, input) => {
|
|
28056
|
-
const exe = findYtrack(env);
|
|
28057
|
-
if (!exe)
|
|
28058
|
-
return { status: null, stdout: "", stderr: "", missing: true };
|
|
28059
|
-
const result = spawnSync19(exe, args, {
|
|
28060
|
-
encoding: "utf8",
|
|
28061
|
-
env: {
|
|
28062
|
-
...env,
|
|
28063
|
-
NO_COLOR: "1",
|
|
28064
|
-
...YTRACK_QUIET_ENV,
|
|
28065
|
-
...host ? { YTRACK_HOST: host } : {}
|
|
28066
|
-
},
|
|
28067
|
-
timeout: timeoutMs,
|
|
28068
|
-
killSignal: "SIGKILL",
|
|
28069
|
-
windowsHide: true,
|
|
28070
|
-
...input === undefined ? { stdio: ["ignore", "pipe", "pipe"] } : { input, stdio: ["pipe", "pipe", "pipe"] }
|
|
28071
|
-
});
|
|
28072
|
-
const error = result.error;
|
|
28073
|
-
if (error?.code === "ENOENT")
|
|
28074
|
-
return { status: null, stdout: "", stderr: "", missing: true };
|
|
28075
|
-
return {
|
|
28076
|
-
status: result.status,
|
|
28077
|
-
stdout: result.stdout ?? "",
|
|
28078
|
-
stderr: result.stderr || (error ? error.message : "")
|
|
28079
|
-
};
|
|
28080
|
-
};
|
|
28081
|
-
}
|
|
28082
|
-
var ytrackDetail = (out) => out.stderr.trim().split(`
|
|
28083
|
-
`).slice(-3).join(" ").slice(0, 300);
|
|
28084
|
-
var YTRACK_MISSING = "ytrack is not on PATH: Workit reaches YouTrack only through ytrack";
|
|
28085
|
-
|
|
28086
28087
|
// packages/workit-core/src/core/youtrack.ts
|
|
28087
28088
|
var ISSUE_RE = /^[A-Z][A-Z0-9_]*-\d+$/;
|
|
28088
28089
|
var youTrackReadOnlyConfigPath = () => process.env.WORKIT_YOUTRACK_CONFIG ?? path30.join(resolveConfigDir(), "youtrack.json");
|
|
@@ -7373,7 +7373,8 @@ var workspaceConfigSchema = object({
|
|
|
7373
7373
|
youtrack: object({
|
|
7374
7374
|
baseUrl: nonBlank.optional().describe("This workspace's YouTrack URL."),
|
|
7375
7375
|
link_issues: boolean2().optional().describe("Legacy alias of `issues: { provider: youtrack, link: true }`."),
|
|
7376
|
-
writes: _enum(["ask", "auto"]).optional().describe("ask (default): each workit youtrack write waits for the user's yes. auto: posts without asking, behind WORKIT_YT_WRITE=1.")
|
|
7376
|
+
writes: _enum(["ask", "auto"]).optional().describe("ask (default): each workit youtrack write waits for the user's yes. auto: posts without asking, behind WORKIT_YT_WRITE=1."),
|
|
7377
|
+
autoHosts: array(nonBlank).optional().describe("With writes auto: the only YouTrack hosts (`acme.youtrack.cloud`) a write may reach without asking. A raw ytrack write must name one with --host; a write elsewhere asks. Only the user widens it, in their own terminal (`workit workspace seal`).")
|
|
7377
7378
|
}).passthrough().optional().describe("YouTrack settings for this workspace."),
|
|
7378
7379
|
issues: object({
|
|
7379
7380
|
provider: _enum(["github", "gitlab", "youtrack"]).optional().describe("The issue tracker PRs link to."),
|
|
@@ -16363,7 +16364,7 @@ var sealProjection = (entries) => entries.map((entry) => {
|
|
|
16363
16364
|
return pick2({
|
|
16364
16365
|
...all,
|
|
16365
16366
|
vcs: pick2(all.vcs, IDENTITY_KEYS),
|
|
16366
|
-
youtrack: pick2(all.youtrack, ["writes"])
|
|
16367
|
+
youtrack: pick2(all.youtrack, ["writes", "autoHosts"])
|
|
16367
16368
|
}, ENTRY_KEYS);
|
|
16368
16369
|
});
|
|
16369
16370
|
var canonical3 = (value) => JSON.stringify(value, (_key, item) => item && typeof item === "object" && !Array.isArray(item) ? Object.fromEntries(Object.entries(item).toSorted(([a], [b]) => a < b ? -1 : a > b ? 1 : 0)) : item);
|
|
@@ -16393,6 +16394,36 @@ function checkSeal(dir) {
|
|
|
16393
16394
|
return ok && sealDigest(sealProjection(current.entries)) === seal.sha256 ? { state: "valid" } : broken("workspaces.json changed since it was sealed", sealed.entries);
|
|
16394
16395
|
}
|
|
16395
16396
|
|
|
16397
|
+
// packages/workit-core/src/forge/redact.ts
|
|
16398
|
+
var KEY = String.raw`[A-Za-z0-9_.-]*?(?:token|secret|password|passwd|pwd|api[_-]?key|access[_-]?key|account[_-]?key|private[_-]?key|client[_-]?secret|credentials?|authorization|cookie|signature)[A-Za-z0-9_.-]*`;
|
|
16399
|
+
var ASSIGNMENT = new RegExp(String.raw`(?<![A-Za-z0-9])(["']?${KEY}["']?\s*[:=]\s*["']?)((?:bearer|basic|token|digest)\s+)?([^\s"',;&]+)`, "giu");
|
|
16400
|
+
var QUOTED_ASSIGNMENT = new RegExp(String.raw`(?<![A-Za-z0-9])(["']?${KEY}["']?\s*[:=]\s*)(["'])([^"'\n]*[^\s"'][^"'\n]*)\2`, "giu");
|
|
16401
|
+
var ANSI = new RegExp(String.raw`\u001b\[[0-9;?]*[ -/]*[@-~]|\u001b\][^\u0007]*\u0007`, "gu");
|
|
16402
|
+
|
|
16403
|
+
// packages/workit-core/src/forge/exec.ts
|
|
16404
|
+
var MAX_BUFFER2 = 64 * 1024 * 1024;
|
|
16405
|
+
|
|
16406
|
+
// packages/workit-core/src/core/youtrack-ytrack.ts
|
|
16407
|
+
var youTrackHostKey = (input) => {
|
|
16408
|
+
const text = input.trim();
|
|
16409
|
+
if (!text || /\s/u.test(text))
|
|
16410
|
+
return null;
|
|
16411
|
+
let url;
|
|
16412
|
+
try {
|
|
16413
|
+
url = new URL(text.includes("://") ? text : `https://${text}`);
|
|
16414
|
+
} catch {
|
|
16415
|
+
return null;
|
|
16416
|
+
}
|
|
16417
|
+
if (!/^https?:$/u.test(url.protocol) || !url.hostname || url.username || url.password)
|
|
16418
|
+
return null;
|
|
16419
|
+
const service = url.pathname.replace(/\/+$/u, "").replace(/\/api$/u, "").replace(/\/+$/u, "");
|
|
16420
|
+
return `${url.host.toLowerCase()}${service}`;
|
|
16421
|
+
};
|
|
16422
|
+
var youTrackHostAllowed = (allowed, host) => {
|
|
16423
|
+
const key = host ? youTrackHostKey(host) : null;
|
|
16424
|
+
return key !== null && allowed.some((entry) => youTrackHostKey(entry) === key);
|
|
16425
|
+
};
|
|
16426
|
+
|
|
16396
16427
|
// packages/workit-core/src/autonomy.ts
|
|
16397
16428
|
var accountHomeDir = () => {
|
|
16398
16429
|
const home = grantsHome.resolve();
|
|
@@ -16441,20 +16472,34 @@ var SEAL_UNBLOCK = `if the user made this change, ask them to run, in their own
|
|
|
16441
16472
|
var NO_SEAL_UNBLOCK = `ask the user to review and seal the grants, in their own terminal: ${SEAL_COMMAND}`;
|
|
16442
16473
|
var NO_SEAL_NOTE = `workspaces.json has no seal yet (${SEAL_COMMAND} has never run), so grants, endpoint, verification and youtrack.writes stay at or below the D4 defaults; ${NO_SEAL_UNBLOCK}`;
|
|
16443
16474
|
var sealNote = (seal = sealOf()) => seal.state === "broken" ? `workspaces.json does not match its seal (${seal.reason}), so grants, endpoint, verification and youtrack.writes are the stricter of their current and last sealed values; ${SEAL_UNBLOCK}` : null;
|
|
16444
|
-
var
|
|
16475
|
+
var ASK = { mode: "ask" };
|
|
16476
|
+
var youtrackOf = (entry) => entry?.youtrack;
|
|
16477
|
+
var autoHostsOf = (entry) => {
|
|
16478
|
+
const hosts = youtrackOf(entry)?.autoHosts;
|
|
16479
|
+
return Array.isArray(hosts) ? hosts.filter((host) => typeof host === "string") : null;
|
|
16480
|
+
};
|
|
16481
|
+
var youTrackWritesPolicy = (cwd) => {
|
|
16445
16482
|
try {
|
|
16446
16483
|
const dir = accountDir();
|
|
16447
16484
|
if (dir === null || redirected(dir) || evalWorld(cwd))
|
|
16448
|
-
return
|
|
16485
|
+
return ASK;
|
|
16449
16486
|
if (checkSeal(dir).state !== "valid")
|
|
16450
|
-
return
|
|
16451
|
-
const auto = (entry) => entry?.
|
|
16487
|
+
return ASK;
|
|
16488
|
+
const auto = (entry) => youtrackOf(entry)?.writes === "auto";
|
|
16452
16489
|
const name = process.env.WORKIT_WORKSPACE_NAME?.trim() || undefined;
|
|
16453
|
-
|
|
16454
|
-
|
|
16455
|
-
|
|
16490
|
+
const named = resolveWorkspaceFrom(cwd, dir, name);
|
|
16491
|
+
const folder = name ? resolveWorkspaceFrom(cwd, dir) : named;
|
|
16492
|
+
if (!auto(named) || !auto(folder))
|
|
16493
|
+
return ASK;
|
|
16494
|
+
const [a, b] = [autoHostsOf(named), autoHostsOf(folder)];
|
|
16495
|
+
const base = youtrackOf(named)?.baseUrl;
|
|
16496
|
+
return {
|
|
16497
|
+
mode: "auto",
|
|
16498
|
+
hosts: a === null ? b : b === null ? a : a.filter((host) => youTrackHostAllowed(b, host)),
|
|
16499
|
+
baseUrl: typeof base === "string" && base.trim() ? base.trim() : null
|
|
16500
|
+
};
|
|
16456
16501
|
} catch {
|
|
16457
|
-
return
|
|
16502
|
+
return ASK;
|
|
16458
16503
|
}
|
|
16459
16504
|
};
|
|
16460
16505
|
var redirected = (dir) => path22.resolve(resolveConfigDir()) !== path22.resolve(dir);
|
|
@@ -17526,7 +17571,7 @@ var GIT_VALUE_OPTIONS = new Set([
|
|
|
17526
17571
|
]);
|
|
17527
17572
|
var GIT_CONFIG_OPTIONS = new Set(["-c", "--config-env", "--git-dir"]);
|
|
17528
17573
|
var GIT_CONFIG_ENV = /^(?:GIT_(?:CONFIG\w*|DIR|COMMON_DIR|WORK_TREE|SSH|SSH_COMMAND|PROXY_COMMAND|EXEC_PATH)|GH_HOST|GH_REPO|GITLAB_HOST|GL_HOST)$/;
|
|
17529
|
-
var
|
|
17574
|
+
var ASSIGNMENT2 = /^([A-Za-z_]\w*)=([\s\S]*)$/;
|
|
17530
17575
|
var MAX_DEPTH = 4;
|
|
17531
17576
|
var MAX_EXPANSIONS = 16;
|
|
17532
17577
|
var isAbsolute = (value) => path24.isAbsolute(value) || /^[A-Za-z]:[\\/]/.test(value) || value.startsWith("\\\\");
|
|
@@ -17553,7 +17598,7 @@ var stripPrefixes = (input) => {
|
|
|
17553
17598
|
const first = words[0];
|
|
17554
17599
|
if (first === undefined)
|
|
17555
17600
|
return { words, env };
|
|
17556
|
-
const assignment =
|
|
17601
|
+
const assignment = ASSIGNMENT2.exec(first);
|
|
17557
17602
|
if (assignment) {
|
|
17558
17603
|
if (GIT_CONFIG_ENV.test(assignment[1]))
|
|
17559
17604
|
env[assignment[1]] = assignment[2];
|
|
@@ -17612,10 +17657,10 @@ var assignments = (words, vars) => {
|
|
|
17612
17657
|
while (rest[0]?.startsWith("-"))
|
|
17613
17658
|
rest = rest.slice(1);
|
|
17614
17659
|
}
|
|
17615
|
-
if (rest.length === 0 || !rest.every((word) =>
|
|
17660
|
+
if (rest.length === 0 || !rest.every((word) => ASSIGNMENT2.test(word)))
|
|
17616
17661
|
return null;
|
|
17617
17662
|
return rest.map((word) => {
|
|
17618
|
-
const [, name, value] =
|
|
17663
|
+
const [, name, value] = ASSIGNMENT2.exec(word);
|
|
17619
17664
|
return [name, expandWord(value, vars)];
|
|
17620
17665
|
});
|
|
17621
17666
|
};
|
|
@@ -17803,7 +17848,7 @@ var splitString = (line) => {
|
|
|
17803
17848
|
return line.slice(index).join(" ").slice(15);
|
|
17804
17849
|
if (/^-S./.test(word))
|
|
17805
17850
|
return [word.slice(2), ...line.slice(index + 1)].join(" ");
|
|
17806
|
-
if (!word.startsWith("-") && !
|
|
17851
|
+
if (!word.startsWith("-") && !ASSIGNMENT2.test(word))
|
|
17807
17852
|
return null;
|
|
17808
17853
|
}
|
|
17809
17854
|
return null;
|
|
@@ -25337,6 +25382,29 @@ var judge = (args, words) => {
|
|
|
25337
25382
|
return mapIssueWrite("attach", args);
|
|
25338
25383
|
return /^(?:edit|update|delete|rm)$/.test(verb) ? UNCOVERED : null;
|
|
25339
25384
|
};
|
|
25385
|
+
var hostsOf = (args) => {
|
|
25386
|
+
const end = args.indexOf("--");
|
|
25387
|
+
const hosts = [];
|
|
25388
|
+
const bare = [];
|
|
25389
|
+
let literal = true;
|
|
25390
|
+
let named = false;
|
|
25391
|
+
for (let at = 0;at < args.length; at++) {
|
|
25392
|
+
const arg = args[at];
|
|
25393
|
+
if (end >= 0 && at >= end || !/^--host(?:=|$)/.test(arg)) {
|
|
25394
|
+
bare.push(arg);
|
|
25395
|
+
continue;
|
|
25396
|
+
}
|
|
25397
|
+
named ||= standsAlone(args, at);
|
|
25398
|
+
const value = arg === "--host" ? args[++at] : arg.slice("--host=".length);
|
|
25399
|
+
if (value === undefined || !value.trim() || EXPANDS.test(value))
|
|
25400
|
+
literal = false;
|
|
25401
|
+
else
|
|
25402
|
+
hosts.push(value);
|
|
25403
|
+
}
|
|
25404
|
+
if (!literal)
|
|
25405
|
+
return { hosts: null, bare };
|
|
25406
|
+
return named ? { hosts, bare } : { hosts: [], bare: [...args] };
|
|
25407
|
+
};
|
|
25340
25408
|
var SHELLS3 = /^(?:sh|bash|zsh|dash|ksh|ash|mksh|yash|fish)$/;
|
|
25341
25409
|
var MAX_DEPTH2 = 4;
|
|
25342
25410
|
var READ = new Map;
|
|
@@ -25344,10 +25412,19 @@ var NOT_PLAIN = gap("a ytrack call that is not a plain command of its own (a wra
|
|
|
25344
25412
|
var timeOnly = (effect) => effect?.minutes !== undefined && Object.keys(effect).every((key) => /^(?:issue|minutes|text|date)$/u.test(key));
|
|
25345
25413
|
var ungrant = (write) => write.workit ? {
|
|
25346
25414
|
command: write.command,
|
|
25415
|
+
hosts: write.hosts,
|
|
25416
|
+
bare: write.bare,
|
|
25417
|
+
plain: write.plain,
|
|
25347
25418
|
...NOT_PLAIN,
|
|
25348
25419
|
...timeOnly(write.effect) ? { hint: write.workit } : {}
|
|
25349
25420
|
} : write;
|
|
25350
|
-
var hinted = (write) => write.hint ? {
|
|
25421
|
+
var hinted = (write) => write.hint ? {
|
|
25422
|
+
command: write.command,
|
|
25423
|
+
hosts: write.hosts,
|
|
25424
|
+
bare: write.bare,
|
|
25425
|
+
plain: false,
|
|
25426
|
+
workit: write.hint
|
|
25427
|
+
} : write;
|
|
25351
25428
|
var ytrackArgs = (line, found, depth, names, plain) => {
|
|
25352
25429
|
const inner = (script) => void found.push(...ytrackWrites(script, "posix", depth + 1, plain));
|
|
25353
25430
|
const tail = workitCheckTail(line);
|
|
@@ -25382,7 +25459,12 @@ var ytrackArgs = (line, found, depth, names, plain) => {
|
|
|
25382
25459
|
const argv = [...alias ?? [], ...line.slice(at + 1)];
|
|
25383
25460
|
const write = classify(argv);
|
|
25384
25461
|
if (write) {
|
|
25385
|
-
const one = {
|
|
25462
|
+
const one = {
|
|
25463
|
+
command: ["ytrack", ...argv].map(quote2).join(" "),
|
|
25464
|
+
...write,
|
|
25465
|
+
...hostsOf(argv),
|
|
25466
|
+
plain
|
|
25467
|
+
};
|
|
25386
25468
|
found.push(plain ? one : ungrant(one));
|
|
25387
25469
|
}
|
|
25388
25470
|
return true;
|
|
@@ -25459,7 +25541,15 @@ var chained = (first, chain, depth) => {
|
|
|
25459
25541
|
const effect = combine(effects);
|
|
25460
25542
|
if (!effect)
|
|
25461
25543
|
return null;
|
|
25462
|
-
|
|
25544
|
+
const hosts = found.map((write) => write.hosts);
|
|
25545
|
+
return [
|
|
25546
|
+
{
|
|
25547
|
+
command: found.map((write) => write.command).join(" && "),
|
|
25548
|
+
...mapped(effect),
|
|
25549
|
+
hosts: hosts.includes(null) ? null : hosts.some((list) => !list?.length) ? [] : hosts.flatMap((list) => list ?? []),
|
|
25550
|
+
plain: true
|
|
25551
|
+
}
|
|
25552
|
+
];
|
|
25463
25553
|
};
|
|
25464
25554
|
var ytrackWrites = (command, dialect = "posix", depth = 0, plain = true) => {
|
|
25465
25555
|
if (!namesYtrack(command))
|
|
@@ -25488,6 +25578,32 @@ var ytrackWrites = (command, dialect = "posix", depth = 0, plain = true) => {
|
|
|
25488
25578
|
READ.delete(READ.keys().next().value);
|
|
25489
25579
|
return found;
|
|
25490
25580
|
};
|
|
25581
|
+
var RELOCATES = /(?<![$\w])YTRACK_CONFIG_DIR\b/;
|
|
25582
|
+
var reachesOnly = (allowed, write) => write.plain && !!write.hosts?.length && write.hosts.every((host) => youTrackHostAllowed(allowed, host));
|
|
25583
|
+
var scopedGate = (allowed, command, writes) => {
|
|
25584
|
+
const scope = `youtrack.autoHosts (${allowed.join(", ")})`;
|
|
25585
|
+
if (RELOCATES.test(command))
|
|
25586
|
+
return {
|
|
25587
|
+
kind: "deny",
|
|
25588
|
+
reason: `This command sets YTRACK_CONFIG_DIR, where ytrack reads its hosts, so a --host may reach another instance: ${scope} lets a YouTrack write through only with ytrack's own config. Run the ytrack call without it.`,
|
|
25589
|
+
unblock: null
|
|
25590
|
+
};
|
|
25591
|
+
const first = allowed.map(youTrackHostKey).find(Boolean);
|
|
25592
|
+
if (!first)
|
|
25593
|
+
return null;
|
|
25594
|
+
const unnamed = writes.filter((write) => !reachesOnly(allowed, write) && (!write.hosts?.length || write.hosts.every((host) => youTrackHostAllowed(allowed, host))));
|
|
25595
|
+
if (!unnamed.length)
|
|
25596
|
+
return null;
|
|
25597
|
+
const why = (write) => write.hosts === null ? "its --host is no literal host" : !write.hosts.length ? "it names no --host" : "it is not a plain command of its own";
|
|
25598
|
+
const bare = unnamed.find((write) => write.bare)?.bare;
|
|
25599
|
+
const retry = bare ? ["ytrack", "--host", first, ...bare].map(quote2).join(" ") : null;
|
|
25600
|
+
return {
|
|
25601
|
+
kind: "deny",
|
|
25602
|
+
reason: `${scope} posts to YouTrack unasked only from a plain ytrack call that names an allowed host with --host: ${unnamed.map((write) => `\`${write.command}\` (${why(write)})`).join(", ")}. Name the host, as its own plain call.${retry ? `
|
|
25603
|
+
Retry as: ${retry}` : ""}`,
|
|
25604
|
+
unblock: retry
|
|
25605
|
+
};
|
|
25606
|
+
};
|
|
25491
25607
|
var ytrackGate = (cwd, command, dialect, ask) => {
|
|
25492
25608
|
if (namesTicket(command))
|
|
25493
25609
|
return { kind: "deny", reason: TICKET_DENY, unblock: null };
|
|
@@ -25500,7 +25616,8 @@ var ytrackGate = (cwd, command, dialect, ask) => {
|
|
|
25500
25616
|
}
|
|
25501
25617
|
writes = [...merged.values()];
|
|
25502
25618
|
} catch {
|
|
25503
|
-
|
|
25619
|
+
const policy = youTrackWritesPolicy(cwd);
|
|
25620
|
+
if (policy.mode === "auto" && policy.hosts === null)
|
|
25504
25621
|
return null;
|
|
25505
25622
|
return {
|
|
25506
25623
|
kind: "deny",
|
|
@@ -25508,7 +25625,19 @@ var ytrackGate = (cwd, command, dialect, ask) => {
|
|
|
25508
25625
|
unblock: null
|
|
25509
25626
|
};
|
|
25510
25627
|
}
|
|
25511
|
-
if (!writes.length
|
|
25628
|
+
if (!writes.length && !RELOCATES.test(command))
|
|
25629
|
+
return null;
|
|
25630
|
+
const policy = youTrackWritesPolicy(cwd);
|
|
25631
|
+
if (policy.mode === "auto") {
|
|
25632
|
+
const hosts = policy.hosts;
|
|
25633
|
+
if (hosts === null)
|
|
25634
|
+
return null;
|
|
25635
|
+
const scoped = scopedGate(hosts, command, writes);
|
|
25636
|
+
if (scoped)
|
|
25637
|
+
return scoped;
|
|
25638
|
+
writes = writes.filter((write) => !reachesOnly(hosts, write));
|
|
25639
|
+
}
|
|
25640
|
+
if (!writes.length)
|
|
25512
25641
|
return null;
|
|
25513
25642
|
const calls = writes.flatMap((write) => write.workit ? [`\`${write.workit}\``] : []);
|
|
25514
25643
|
const bare = writes.filter((write) => !write.workit).map((write) => `\`${write.command}\` (${write.gap ? `Workit cannot carry ${write.gap} into a workit youtrack call` : "no workit youtrack verb covers it"})`);
|
package/dist/workit-hook.js
CHANGED
|
@@ -101,7 +101,7 @@ if (quiet) {
|
|
|
101
101
|
`);
|
|
102
102
|
} else {
|
|
103
103
|
try {
|
|
104
|
-
const { runCodexHook } = await import("./workit-hook-
|
|
104
|
+
const { runCodexHook } = await import("./workit-hook-vbw28h3h.js");
|
|
105
105
|
await runCodexHook([payload]);
|
|
106
106
|
} catch (error) {
|
|
107
107
|
const { answerRuntimeFailure } = await import("./workit-hook-52cm7mqd.js");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workit-dev/codex",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.21.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Workit Codex CLI/desktop plugin — shared MCP transport, hooks, method skills, and verifier/reviewer/implementer agents",
|
|
6
6
|
"keywords": [
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"build": "bun scripts/build.ts"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@workit-dev/core": "^2.
|
|
45
|
-
"@workit-dev/mcp": "^2.
|
|
44
|
+
"@workit-dev/core": "^2.21.0",
|
|
45
|
+
"@workit-dev/mcp": "^2.21.0"
|
|
46
46
|
},
|
|
47
47
|
"engines": {
|
|
48
48
|
"node": ">=24"
|