@workit-dev/codex 2.28.0 → 2.29.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
|
@@ -14733,6 +14733,101 @@ var checkoutRemotes = (cwd) => {
|
|
|
14733
14733
|
}
|
|
14734
14734
|
return out;
|
|
14735
14735
|
};
|
|
14736
|
+
var TRANSPORT_ENV = ["GIT_SSH", "GIT_SSH_COMMAND", "GIT_PROXY_COMMAND"];
|
|
14737
|
+
var userGitSeam = { home: accountHome };
|
|
14738
|
+
var realOrSelf = (file) => {
|
|
14739
|
+
try {
|
|
14740
|
+
return realpathSync3.native(file);
|
|
14741
|
+
} catch {
|
|
14742
|
+
return path6.resolve(file);
|
|
14743
|
+
}
|
|
14744
|
+
};
|
|
14745
|
+
var userLevel = (scope, origin) => {
|
|
14746
|
+
if (scope === "system")
|
|
14747
|
+
return process.env.GIT_CONFIG_SYSTEM === undefined;
|
|
14748
|
+
if (scope !== "global" || !origin.startsWith("file:"))
|
|
14749
|
+
return false;
|
|
14750
|
+
const file = realOrSelf(origin.slice("file:".length));
|
|
14751
|
+
const home = userGitSeam.home();
|
|
14752
|
+
if (home === null)
|
|
14753
|
+
return false;
|
|
14754
|
+
return [path6.join(home, ".gitconfig"), path6.join(home, ".config", "git", "config")].map(realOrSelf).includes(file);
|
|
14755
|
+
};
|
|
14756
|
+
var escapeRegex2 = (value) => value.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
|
|
14757
|
+
var transportOverride = (git, remote, vars) => {
|
|
14758
|
+
const env = TRANSPORT_ENV.find((name) => vars[name]);
|
|
14759
|
+
if (env)
|
|
14760
|
+
return env;
|
|
14761
|
+
const execPath = vars.GIT_EXEC_PATH;
|
|
14762
|
+
if (execPath) {
|
|
14763
|
+
const { GIT_EXEC_PATH: _set, ...rest } = vars;
|
|
14764
|
+
const own = spawnSync5("git", ["--exec-path"], {
|
|
14765
|
+
env: rest,
|
|
14766
|
+
encoding: "utf8"
|
|
14767
|
+
});
|
|
14768
|
+
if (own.status !== 0 || realOrSelf(own.stdout.trim()) !== realOrSelf(execPath))
|
|
14769
|
+
return "GIT_EXEC_PATH";
|
|
14770
|
+
}
|
|
14771
|
+
const name = escapeRegex2(remote);
|
|
14772
|
+
const run = git([
|
|
14773
|
+
"config",
|
|
14774
|
+
"--show-scope",
|
|
14775
|
+
"--show-origin",
|
|
14776
|
+
"--get-regexp",
|
|
14777
|
+
`^(remote\\.${name}\\.(receivepack|vcs)|core\\.(sshcommand|gitproxy))$`
|
|
14778
|
+
]);
|
|
14779
|
+
if (run.status === 1)
|
|
14780
|
+
return null;
|
|
14781
|
+
if (run.status !== 0)
|
|
14782
|
+
return "a git config that cannot be read";
|
|
14783
|
+
for (const line of String(run.stdout).split(/\r?\n/u)) {
|
|
14784
|
+
const match = /^(\S+)\t(.*?)\t(\S+)(?: |$)/u.exec(line);
|
|
14785
|
+
if (!match)
|
|
14786
|
+
continue;
|
|
14787
|
+
const [, scope, origin, key] = match;
|
|
14788
|
+
if (key === "core.sshcommand" && userLevel(scope, origin))
|
|
14789
|
+
continue;
|
|
14790
|
+
return `${key} (${scope} ${origin})`;
|
|
14791
|
+
}
|
|
14792
|
+
return null;
|
|
14793
|
+
};
|
|
14794
|
+
var pushTarget = (cwd, remote, replay = {}) => {
|
|
14795
|
+
const env = { ...process.env, ...replay.env };
|
|
14796
|
+
for (const name of ["GIT_DIR", "GIT_WORK_TREE", "GIT_COMMON_DIR", "GIT_INDEX_FILE"])
|
|
14797
|
+
delete env[name];
|
|
14798
|
+
if (!remote || remote.startsWith("-"))
|
|
14799
|
+
return Error(`push remote ${JSON.stringify(remote)} cannot be resolved`);
|
|
14800
|
+
const git = (args) => spawnSync5("git", [...replay.config ?? [], ...args], {
|
|
14801
|
+
cwd,
|
|
14802
|
+
env,
|
|
14803
|
+
encoding: "utf8",
|
|
14804
|
+
timeout: 5000,
|
|
14805
|
+
windowsHide: true
|
|
14806
|
+
});
|
|
14807
|
+
const override = transportOverride(git, remote, env);
|
|
14808
|
+
if (override)
|
|
14809
|
+
return Error(`${override} decides what the push to ${remote} reaches, not its URL, so its target is unknown`);
|
|
14810
|
+
const run = git(["remote", "get-url", "--push", "--all", remote]);
|
|
14811
|
+
const urls = run.status === 0 ? run.stdout.split(/\r?\n/u).map((url) => url.trim()) : run.status === 2 ? [remote] : [];
|
|
14812
|
+
if (!urls.some(Boolean))
|
|
14813
|
+
return Error(`git could not resolve the push URLs of remote ${remote} in ${cwd}`);
|
|
14814
|
+
let top;
|
|
14815
|
+
const base = () => {
|
|
14816
|
+
if (top === undefined) {
|
|
14817
|
+
const at = git(["rev-parse", "--show-toplevel"]);
|
|
14818
|
+
top = at.status === 0 && at.stdout.trim() ? at.stdout.trim() : cwd;
|
|
14819
|
+
}
|
|
14820
|
+
return top;
|
|
14821
|
+
};
|
|
14822
|
+
const remotes = [];
|
|
14823
|
+
for (const url of urls.filter(Boolean)) {
|
|
14824
|
+
const key = remoteKey(url, base);
|
|
14825
|
+
if (key === null)
|
|
14826
|
+
return Error(`remote ${remote} has a push URL that names no repository workit can read: ${url}`);
|
|
14827
|
+
remotes.push({ name: remote, url, key });
|
|
14828
|
+
}
|
|
14829
|
+
return { remotes };
|
|
14830
|
+
};
|
|
14736
14831
|
|
|
14737
14832
|
// packages/workit-core/src/core/workspaces.ts
|
|
14738
14833
|
var nonBlank = string2().check(refine((value) => value.trim().length > 0, "must not be blank"));
|
|
@@ -14840,7 +14935,7 @@ var workspaceConfigSchema = looseObject({
|
|
|
14840
14935
|
})),
|
|
14841
14936
|
models: optional(looseObject({ roles: modelRoles })),
|
|
14842
14937
|
resources: optional(unknown()),
|
|
14843
|
-
remotes: optional(array(nonBlank.check(refine((pattern) =>
|
|
14938
|
+
remotes: optional(array(nonBlank.check(refine((pattern) => isRemotePattern(pattern), "is not a remote URL (https://host/owner/repo, git@host:owner/repo, a path, or owner/*)")))),
|
|
14844
14939
|
externalRepos: optional(array(nonBlank.check(_regex(/^[\w-]+(?:\/\w[\w.-]*)*\/(?:\w[\w.-]*|\*)$/u, "is owner/name, group/project or owner/* on the checkout's forge host, without the host")))),
|
|
14845
14940
|
additiveRiskPaths: optional(array(nonBlank)),
|
|
14846
14941
|
autonomy: optional(looseObject(Object.fromEntries(["push", "pr", "merge", "release", "rerun"].map((kind) => [
|
|
@@ -15209,6 +15304,7 @@ var canonicalGlob = (glob) => {
|
|
|
15209
15304
|
return real + (prefix.endsWith("/") ? "/" : "") + rest;
|
|
15210
15305
|
};
|
|
15211
15306
|
var globSpecificity = (glob) => glob.replaceAll("\\", "/").split("/").filter((segment) => segment.length > 0 && !/[*?[\]{]/.test(segment)).length;
|
|
15307
|
+
var workspaceMatches = (cwd, entries) => matchingEntries(cwd, entries);
|
|
15212
15308
|
var selectWorkspaceMatch = (matches, cwd, workspaceName) => {
|
|
15213
15309
|
if (workspaceName !== undefined) {
|
|
15214
15310
|
const named = matches.filter((entry) => entry.name === workspaceName);
|
|
@@ -15230,15 +15326,32 @@ var selectWorkspaceMatch = (matches, cwd, workspaceName) => {
|
|
|
15230
15326
|
}
|
|
15231
15327
|
return mostSpecific[0];
|
|
15232
15328
|
};
|
|
15233
|
-
var
|
|
15234
|
-
|
|
15235
|
-
|
|
15329
|
+
var HOSTLESS_REMOTE = /^[\w-]+\/\*$/u;
|
|
15330
|
+
var expandRemotePattern = (entry, pattern) => {
|
|
15331
|
+
if (!HOSTLESS_REMOTE.test(pattern.trim()))
|
|
15332
|
+
return pattern;
|
|
15333
|
+
const vcs = entry.vcs ?? {};
|
|
15334
|
+
const host = typeof vcs.host === "string" && vcs.host.trim().replace(/^https?:\/\/|\/.*$/giu, "") || `${vcs.provider === "gitlab" ? "gitlab" : "github"}.com`;
|
|
15335
|
+
return `https://${host}/${pattern.trim()}`;
|
|
15336
|
+
};
|
|
15337
|
+
var isRemotePattern = (pattern) => !!remotePattern(expandRemotePattern({}, pattern));
|
|
15338
|
+
var remoteClaimOf = (entry, key, exact = false) => (Array.isArray(entry.remotes) ? entry.remotes : []).find((pattern) => typeof pattern === "string" && !(exact && pattern.trim().endsWith("/*")) && remoteMatches(expandRemotePattern(entry, pattern), key));
|
|
15339
|
+
var resolveWorkspaceFromEntries = (cwd, entries, workspaceName, remotes) => {
|
|
15340
|
+
const globbed = matchingEntries(cwd, entries);
|
|
15341
|
+
const listed = !remotes || globbed.length || !entries.some((entry) => entry.remotes) ? [] : checkoutRemotes(cwd);
|
|
15342
|
+
const origin = listed instanceof Error ? [] : listed.filter((item) => item.name === "origin");
|
|
15343
|
+
const hits = entries.filter((entry) => origin.length && origin.every((item) => remoteClaimOf(entry, item.key)));
|
|
15344
|
+
const exact = hits.filter((entry) => origin.every((item) => remoteClaimOf(entry, item.key, true)));
|
|
15345
|
+
const ranked = exact.length ? exact : hits;
|
|
15346
|
+
if (workspaceName === undefined && ranked.length > 1)
|
|
15347
|
+
return null;
|
|
15348
|
+
return selectWorkspaceMatch(hits.length ? workspaceName ? hits : ranked : globbed, cwd, workspaceName) ?? null;
|
|
15236
15349
|
};
|
|
15237
|
-
var resolveWorkspaceFrom = (cwd, dir, workspaceName) => {
|
|
15350
|
+
var resolveWorkspaceFrom = (cwd, dir, workspaceName, remotes) => {
|
|
15238
15351
|
const result = readWorkspacesResult(dir);
|
|
15239
15352
|
if (result.status === "malformed" || result.status === "invalid")
|
|
15240
15353
|
throw new WorkspaceConfigError(result.error);
|
|
15241
|
-
return resolveWorkspaceFromEntries(cwd, result.entries, workspaceName);
|
|
15354
|
+
return resolveWorkspaceFromEntries(cwd, result.entries, workspaceName, remotes);
|
|
15242
15355
|
};
|
|
15243
15356
|
var runtimeWorkspacePolicySchema = (kind) => {
|
|
15244
15357
|
const key = kind === "branch" ? "branchPolicy" : kind === "commit" ? "commitPolicy" : "vcs";
|
|
@@ -15288,10 +15401,12 @@ var matchRuntimeWorkspace = (cwd, dir = configDir2()) => {
|
|
|
15288
15401
|
if (!glob.ok)
|
|
15289
15402
|
throw new WorkspaceConfigError(`${file} workspace ${entry.name}: ${glob.error}`);
|
|
15290
15403
|
}
|
|
15291
|
-
const matches = matchingEntries(cwd, entries ?? []);
|
|
15292
15404
|
const workspaceName = process.env.WORKIT_WORKSPACE_NAME?.trim() || undefined;
|
|
15293
|
-
const selected =
|
|
15294
|
-
|
|
15405
|
+
const selected = resolveWorkspaceFromEntries(cwd, entries ?? [], workspaceName, true);
|
|
15406
|
+
if (!selected)
|
|
15407
|
+
return null;
|
|
15408
|
+
const matches = matchingEntries(cwd, entries ?? []);
|
|
15409
|
+
return { file, selected, matches: matches.length ? matches : [selected] };
|
|
15295
15410
|
};
|
|
15296
15411
|
var resolveRuntimeReleaseTracks = (cwd) => {
|
|
15297
15412
|
const matched = matchRuntimeWorkspace(cwd);
|
|
@@ -24643,6 +24758,7 @@ var ytrackDetail = (out) => out.stderr.trim().split(`
|
|
|
24643
24758
|
var YTRACK_MISSING = "ytrack is not on PATH: Workit reaches YouTrack only through ytrack";
|
|
24644
24759
|
|
|
24645
24760
|
// packages/workit-core/src/autonomy.ts
|
|
24761
|
+
var resolveWorkspaceFrom2 = (cwd, dir, name) => resolveWorkspaceFrom(cwd, dir, name, true);
|
|
24646
24762
|
var accountHomeDir = () => {
|
|
24647
24763
|
const home = grantsHome.resolve();
|
|
24648
24764
|
return home === null ? null : configDir({ HOME: home });
|
|
@@ -24675,11 +24791,11 @@ var accountUnread = () => {
|
|
|
24675
24791
|
};
|
|
24676
24792
|
var entriesIn = (dir) => dir === null ? [] : loadWorkspacesFrom(dir);
|
|
24677
24793
|
var fileSource = (dir = accountDir()) => ({
|
|
24678
|
-
resolve: (cwd, name) => dir === null ? null :
|
|
24794
|
+
resolve: (cwd, name) => dir === null ? null : resolveWorkspaceFrom2(cwd, dir, name),
|
|
24679
24795
|
entries: () => entriesIn(dir)
|
|
24680
24796
|
});
|
|
24681
24797
|
var sealedSource = (entries) => ({
|
|
24682
|
-
resolve: (cwd, name) => resolveWorkspaceFromEntries(cwd, entries, name),
|
|
24798
|
+
resolve: (cwd, name) => resolveWorkspaceFromEntries(cwd, entries, name, true),
|
|
24683
24799
|
entries: () => entries
|
|
24684
24800
|
});
|
|
24685
24801
|
var sealOf = () => {
|
|
@@ -24930,7 +25046,8 @@ function resolveWith(source, cwd, world, target) {
|
|
|
24930
25046
|
const above = checkoutsAbove(cwd);
|
|
24931
25047
|
for (const where of above instanceof Error ? [above] : above)
|
|
24932
25048
|
autonomy = capAt(source, autonomy, where, where instanceof Error ? "git" : `checkout ${where}`, "a worktree or submodule never exceeds it", true);
|
|
24933
|
-
|
|
25049
|
+
const own = real && workspaceMatches(cwd, source.entries()).length === 0 ? real : undefined;
|
|
25050
|
+
return capAtRemotes(source, autonomy, cwd, target, own);
|
|
24934
25051
|
}
|
|
24935
25052
|
var needsAccount = (autonomy) => autonomy.configured.length > 0 && !autonomy.accountConfigured;
|
|
24936
25053
|
function stricter(current, sealed, note, unblock) {
|
|
@@ -24969,17 +25086,31 @@ function stricter(current, sealed, note, unblock) {
|
|
|
24969
25086
|
note: current.note ? `${current.note}; ${note}` : note
|
|
24970
25087
|
};
|
|
24971
25088
|
}
|
|
24972
|
-
function capAtRemotes(source, autonomy, cwd, target) {
|
|
25089
|
+
function capAtRemotes(source, autonomy, cwd, target, own) {
|
|
24973
25090
|
const claiming = source.entries().filter((entry) => entry.remotes?.length);
|
|
24974
25091
|
if (claiming.length === 0)
|
|
24975
25092
|
return autonomy;
|
|
24976
25093
|
const remotes = target === undefined ? checkoutRemotes(cwd) : typeof target === "function" ? target() : target;
|
|
24977
25094
|
if (remotes instanceof Error)
|
|
24978
25095
|
return capAt(source, autonomy, remotes, target === undefined ? "git" : "target", "a target that cannot be resolved never raises grants");
|
|
25096
|
+
const listed = Array.isArray(remotes) ? remotes : remotes.remotes;
|
|
25097
|
+
const capped = own ? capAtOwnClaim(source, autonomy, cwd, own, target && listed) : autonomy;
|
|
25098
|
+
return capAtClaims(source, capped, listed, claiming);
|
|
25099
|
+
}
|
|
25100
|
+
function capAtOwnClaim(source, autonomy, cwd, own, judged) {
|
|
25101
|
+
const push = judged ? { remotes: judged } : pushTarget(cwd, pushRemoteName(cwd) ?? "");
|
|
25102
|
+
if (push instanceof Error)
|
|
25103
|
+
return capAt(source, autonomy, push, "push target", "a target that cannot be resolved never raises grants");
|
|
25104
|
+
const unclaimed = push.remotes.filter((remote) => !remoteClaimOf(own, remote.key));
|
|
25105
|
+
if (unclaimed.length === 0 && push.remotes.length > 0)
|
|
25106
|
+
return autonomy;
|
|
25107
|
+
return stricter(autonomy, autonomyOf(null), `${unclaimed.map((remote) => `remote ${remote.name} ${remote.url}`).join(", ") || "no target"}: not in workspace ${own.name}'s remotes, which matched this checkout by its origin; grants capped at the defaults`, `ask the user to add that repository to workspace ${own.name}'s remotes, in their own terminal: workit workspace set ${own.name} remotes=<patterns>`);
|
|
25108
|
+
}
|
|
25109
|
+
function capAtClaims(source, autonomy, listed, claiming) {
|
|
24979
25110
|
let capped = autonomy;
|
|
24980
|
-
for (const remote of
|
|
25111
|
+
for (const remote of listed)
|
|
24981
25112
|
for (const entry of claiming) {
|
|
24982
|
-
const pattern = entry
|
|
25113
|
+
const pattern = remoteClaimOf(entry, remote.key);
|
|
24983
25114
|
if (pattern)
|
|
24984
25115
|
capped = capAt(source, capped, { entry }, `remote ${remote.name} ${remote.url} (workspace ${entry.name} claims ${pattern})`, "a checkout never exceeds the workspace that owns its remote");
|
|
24985
25116
|
}
|
|
@@ -4147,7 +4147,7 @@ var workspaceConfigSchema = looseObject({
|
|
|
4147
4147
|
})),
|
|
4148
4148
|
models: optional(looseObject({ roles: modelRoles })),
|
|
4149
4149
|
resources: optional(unknown()),
|
|
4150
|
-
remotes: optional(array(nonBlank.check(refine((pattern) =>
|
|
4150
|
+
remotes: optional(array(nonBlank.check(refine((pattern) => isRemotePattern(pattern), "is not a remote URL (https://host/owner/repo, git@host:owner/repo, a path, or owner/*)")))),
|
|
4151
4151
|
externalRepos: optional(array(nonBlank.check(_regex(/^[\w-]+(?:\/\w[\w.-]*)*\/(?:\w[\w.-]*|\*)$/u, "is owner/name, group/project or owner/* on the checkout's forge host, without the host")))),
|
|
4152
4152
|
additiveRiskPaths: optional(array(nonBlank)),
|
|
4153
4153
|
autonomy: optional(looseObject(Object.fromEntries(["push", "pr", "merge", "release", "rerun"].map((kind) => [
|
|
@@ -4516,6 +4516,7 @@ var canonicalGlob = (glob) => {
|
|
|
4516
4516
|
return real + (prefix.endsWith("/") ? "/" : "") + rest;
|
|
4517
4517
|
};
|
|
4518
4518
|
var globSpecificity = (glob) => glob.replaceAll("\\", "/").split("/").filter((segment) => segment.length > 0 && !/[*?[\]{]/.test(segment)).length;
|
|
4519
|
+
var workspaceMatches = (cwd, entries) => matchingEntries(cwd, entries);
|
|
4519
4520
|
var selectWorkspaceMatch = (matches, cwd, workspaceName) => {
|
|
4520
4521
|
if (workspaceName !== undefined) {
|
|
4521
4522
|
const named = matches.filter((entry) => entry.name === workspaceName);
|
|
@@ -4537,15 +4538,32 @@ var selectWorkspaceMatch = (matches, cwd, workspaceName) => {
|
|
|
4537
4538
|
}
|
|
4538
4539
|
return mostSpecific[0];
|
|
4539
4540
|
};
|
|
4540
|
-
var
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4541
|
+
var HOSTLESS_REMOTE = /^[\w-]+\/\*$/u;
|
|
4542
|
+
var expandRemotePattern = (entry, pattern) => {
|
|
4543
|
+
if (!HOSTLESS_REMOTE.test(pattern.trim()))
|
|
4544
|
+
return pattern;
|
|
4545
|
+
const vcs = entry.vcs ?? {};
|
|
4546
|
+
const host = typeof vcs.host === "string" && vcs.host.trim().replace(/^https?:\/\/|\/.*$/giu, "") || `${vcs.provider === "gitlab" ? "gitlab" : "github"}.com`;
|
|
4547
|
+
return `https://${host}/${pattern.trim()}`;
|
|
4548
|
+
};
|
|
4549
|
+
var isRemotePattern = (pattern) => !!remotePattern(expandRemotePattern({}, pattern));
|
|
4550
|
+
var remoteClaimOf = (entry, key, exact = false) => (Array.isArray(entry.remotes) ? entry.remotes : []).find((pattern) => typeof pattern === "string" && !(exact && pattern.trim().endsWith("/*")) && remoteMatches(expandRemotePattern(entry, pattern), key));
|
|
4551
|
+
var resolveWorkspaceFromEntries = (cwd, entries, workspaceName, remotes) => {
|
|
4552
|
+
const globbed = matchingEntries(cwd, entries);
|
|
4553
|
+
const listed = !remotes || globbed.length || !entries.some((entry) => entry.remotes) ? [] : checkoutRemotes(cwd);
|
|
4554
|
+
const origin = listed instanceof Error ? [] : listed.filter((item) => item.name === "origin");
|
|
4555
|
+
const hits = entries.filter((entry) => origin.length && origin.every((item) => remoteClaimOf(entry, item.key)));
|
|
4556
|
+
const exact = hits.filter((entry) => origin.every((item) => remoteClaimOf(entry, item.key, true)));
|
|
4557
|
+
const ranked = exact.length ? exact : hits;
|
|
4558
|
+
if (workspaceName === undefined && ranked.length > 1)
|
|
4559
|
+
return null;
|
|
4560
|
+
return selectWorkspaceMatch(hits.length ? workspaceName ? hits : ranked : globbed, cwd, workspaceName) ?? null;
|
|
4561
|
+
};
|
|
4562
|
+
var resolveWorkspaceFrom = (cwd, dir, workspaceName, remotes) => {
|
|
4545
4563
|
const result = readWorkspacesResult(dir);
|
|
4546
4564
|
if (result.status === "malformed" || result.status === "invalid")
|
|
4547
4565
|
throw new WorkspaceConfigError(result.error);
|
|
4548
|
-
return resolveWorkspaceFromEntries(cwd, result.entries, workspaceName);
|
|
4566
|
+
return resolveWorkspaceFromEntries(cwd, result.entries, workspaceName, remotes);
|
|
4549
4567
|
};
|
|
4550
4568
|
var runtimeWorkspacePolicySchema = (kind) => {
|
|
4551
4569
|
const key = kind === "branch" ? "branchPolicy" : kind === "commit" ? "commitPolicy" : "vcs";
|
|
@@ -4595,10 +4613,12 @@ var matchRuntimeWorkspace = (cwd, dir = configDir()) => {
|
|
|
4595
4613
|
if (!glob.ok)
|
|
4596
4614
|
throw new WorkspaceConfigError(`${file} workspace ${entry.name}: ${glob.error}`);
|
|
4597
4615
|
}
|
|
4598
|
-
const matches = matchingEntries(cwd, entries ?? []);
|
|
4599
4616
|
const workspaceName = process.env.WORKIT_WORKSPACE_NAME?.trim() || undefined;
|
|
4600
|
-
const selected =
|
|
4601
|
-
|
|
4617
|
+
const selected = resolveWorkspaceFromEntries(cwd, entries ?? [], workspaceName, true);
|
|
4618
|
+
if (!selected)
|
|
4619
|
+
return null;
|
|
4620
|
+
const matches = matchingEntries(cwd, entries ?? []);
|
|
4621
|
+
return { file, selected, matches: matches.length ? matches : [selected] };
|
|
4602
4622
|
};
|
|
4603
4623
|
var resolveRuntimeReleaseTracks = (cwd) => {
|
|
4604
4624
|
const matched = matchRuntimeWorkspace(cwd);
|
|
@@ -13388,6 +13408,7 @@ var youTrackHostAllowed = (allowed, host) => {
|
|
|
13388
13408
|
};
|
|
13389
13409
|
|
|
13390
13410
|
// packages/workit-core/src/autonomy.ts
|
|
13411
|
+
var resolveWorkspaceFrom2 = (cwd, dir, name) => resolveWorkspaceFrom(cwd, dir, name, true);
|
|
13391
13412
|
var accountHomeDir = () => {
|
|
13392
13413
|
const home = grantsHome.resolve();
|
|
13393
13414
|
return home === null ? null : configDir2({ HOME: home });
|
|
@@ -13420,11 +13441,11 @@ var accountUnread = () => {
|
|
|
13420
13441
|
};
|
|
13421
13442
|
var entriesIn = (dir) => dir === null ? [] : loadWorkspacesFrom(dir);
|
|
13422
13443
|
var fileSource = (dir = accountDir()) => ({
|
|
13423
|
-
resolve: (cwd, name) => dir === null ? null :
|
|
13444
|
+
resolve: (cwd, name) => dir === null ? null : resolveWorkspaceFrom2(cwd, dir, name),
|
|
13424
13445
|
entries: () => entriesIn(dir)
|
|
13425
13446
|
});
|
|
13426
13447
|
var sealedSource = (entries) => ({
|
|
13427
|
-
resolve: (cwd, name) => resolveWorkspaceFromEntries(cwd, entries, name),
|
|
13448
|
+
resolve: (cwd, name) => resolveWorkspaceFromEntries(cwd, entries, name, true),
|
|
13428
13449
|
entries: () => entries
|
|
13429
13450
|
});
|
|
13430
13451
|
var sealOf = () => {
|
|
@@ -13450,8 +13471,8 @@ var youTrackWritesPolicy = (cwd) => {
|
|
|
13450
13471
|
return ASK;
|
|
13451
13472
|
const auto = (entry) => youtrackOf(entry)?.writes === "auto";
|
|
13452
13473
|
const name = process.env.WORKIT_WORKSPACE_NAME?.trim() || undefined;
|
|
13453
|
-
const named =
|
|
13454
|
-
const folder = name ?
|
|
13474
|
+
const named = resolveWorkspaceFrom2(cwd, dir, name);
|
|
13475
|
+
const folder = name ? resolveWorkspaceFrom2(cwd, dir) : named;
|
|
13455
13476
|
if (!auto(named) || !auto(folder))
|
|
13456
13477
|
return ASK;
|
|
13457
13478
|
const [a, b] = [autoHostsOf(named), autoHostsOf(folder)];
|
|
@@ -13706,7 +13727,8 @@ function resolveWith(source, cwd, world, target) {
|
|
|
13706
13727
|
const above = checkoutsAbove(cwd);
|
|
13707
13728
|
for (const where of above instanceof Error ? [above] : above)
|
|
13708
13729
|
autonomy = capAt(source, autonomy, where, where instanceof Error ? "git" : `checkout ${where}`, "a worktree or submodule never exceeds it", true);
|
|
13709
|
-
|
|
13730
|
+
const own = real && workspaceMatches(cwd, source.entries()).length === 0 ? real : undefined;
|
|
13731
|
+
return capAtRemotes(source, autonomy, cwd, target, own);
|
|
13710
13732
|
}
|
|
13711
13733
|
var needsAccount = (autonomy) => autonomy.configured.length > 0 && !autonomy.accountConfigured;
|
|
13712
13734
|
function stricter(current, sealed, note, unblock) {
|
|
@@ -13745,17 +13767,31 @@ function stricter(current, sealed, note, unblock) {
|
|
|
13745
13767
|
note: current.note ? `${current.note}; ${note}` : note
|
|
13746
13768
|
};
|
|
13747
13769
|
}
|
|
13748
|
-
function capAtRemotes(source, autonomy, cwd, target) {
|
|
13770
|
+
function capAtRemotes(source, autonomy, cwd, target, own) {
|
|
13749
13771
|
const claiming = source.entries().filter((entry) => entry.remotes?.length);
|
|
13750
13772
|
if (claiming.length === 0)
|
|
13751
13773
|
return autonomy;
|
|
13752
13774
|
const remotes = target === undefined ? checkoutRemotes(cwd) : typeof target === "function" ? target() : target;
|
|
13753
13775
|
if (remotes instanceof Error)
|
|
13754
13776
|
return capAt(source, autonomy, remotes, target === undefined ? "git" : "target", "a target that cannot be resolved never raises grants");
|
|
13777
|
+
const listed = Array.isArray(remotes) ? remotes : remotes.remotes;
|
|
13778
|
+
const capped = own ? capAtOwnClaim(source, autonomy, cwd, own, target && listed) : autonomy;
|
|
13779
|
+
return capAtClaims(source, capped, listed, claiming);
|
|
13780
|
+
}
|
|
13781
|
+
function capAtOwnClaim(source, autonomy, cwd, own, judged) {
|
|
13782
|
+
const push = judged ? { remotes: judged } : pushTarget(cwd, pushRemoteName(cwd) ?? "");
|
|
13783
|
+
if (push instanceof Error)
|
|
13784
|
+
return capAt(source, autonomy, push, "push target", "a target that cannot be resolved never raises grants");
|
|
13785
|
+
const unclaimed = push.remotes.filter((remote) => !remoteClaimOf(own, remote.key));
|
|
13786
|
+
if (unclaimed.length === 0 && push.remotes.length > 0)
|
|
13787
|
+
return autonomy;
|
|
13788
|
+
return stricter(autonomy, autonomyOf(null), `${unclaimed.map((remote) => `remote ${remote.name} ${remote.url}`).join(", ") || "no target"}: not in workspace ${own.name}'s remotes, which matched this checkout by its origin; grants capped at the defaults`, `ask the user to add that repository to workspace ${own.name}'s remotes, in their own terminal: workit workspace set ${own.name} remotes=<patterns>`);
|
|
13789
|
+
}
|
|
13790
|
+
function capAtClaims(source, autonomy, listed, claiming) {
|
|
13755
13791
|
let capped = autonomy;
|
|
13756
|
-
for (const remote of
|
|
13792
|
+
for (const remote of listed)
|
|
13757
13793
|
for (const entry of claiming) {
|
|
13758
|
-
const pattern = entry
|
|
13794
|
+
const pattern = remoteClaimOf(entry, remote.key);
|
|
13759
13795
|
if (pattern)
|
|
13760
13796
|
capped = capAt(source, capped, { entry }, `remote ${remote.name} ${remote.url} (workspace ${entry.name} claims ${pattern})`, "a checkout never exceeds the workspace that owns its remote");
|
|
13761
13797
|
}
|
|
@@ -13783,7 +13819,7 @@ function claimsIn(target, entries) {
|
|
|
13783
13819
|
return target;
|
|
13784
13820
|
const claiming = entries.filter((entry) => entry.remotes?.length);
|
|
13785
13821
|
return target.remotes.flatMap((remote) => claiming.flatMap((entry) => {
|
|
13786
|
-
const pattern = entry
|
|
13822
|
+
const pattern = remoteClaimOf(entry, remote.key);
|
|
13787
13823
|
return pattern ? [{ url: remote.url, workspace: entry.name, pattern }] : [];
|
|
13788
13824
|
}));
|
|
13789
13825
|
}
|
package/dist/workit-hook.js
CHANGED
|
@@ -106,7 +106,7 @@ if (quiet) {
|
|
|
106
106
|
`);
|
|
107
107
|
} else {
|
|
108
108
|
try {
|
|
109
|
-
const { runCodexHook } = await import("./workit-hook-
|
|
109
|
+
const { runCodexHook } = await import("./workit-hook-zw7g7g4e.js");
|
|
110
110
|
await runCodexHook([payload]);
|
|
111
111
|
} catch (error) {
|
|
112
112
|
const { answerRuntimeFailure } = await import("./workit-hook-8kebgc9b.js");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workit-dev/codex",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.29.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.29.0",
|
|
45
|
+
"@workit-dev/mcp": "^2.29.0"
|
|
46
46
|
},
|
|
47
47
|
"engines": {
|
|
48
48
|
"node": ">=24"
|