@workit-dev/codex 2.21.9 → 2.22.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workit",
3
- "version": "2.21.9",
3
+ "version": "2.22.0",
4
4
  "description": "Adaptive engineering workflow rails for Codex",
5
5
  "author": {
6
6
  "name": "BrainerVirus"
@@ -19136,25 +19136,58 @@ function rawGitPre(input, command, options = {}) {
19136
19136
  return error instanceof ShellAnalysisError ? analysisDenial(error) : NONE2;
19137
19137
  }
19138
19138
  }
19139
- var forgeRepo = (gh, named, env, config) => {
19139
+ var forgeRepo = (gh, named, env, config, branch, dir) => {
19140
19140
  const repo = explicitRepo(gh, named, env);
19141
19141
  const host = (gh ? env.GH_HOST ?? process.env.GH_HOST ?? "github.com" : env.GITLAB_HOST ?? env.GL_HOST ?? process.env.GITLAB_HOST ?? process.env.GL_HOST ?? "gitlab.com").replace(/^\w+:\/\/|\/+$/g, "");
19142
19142
  const parts = repo.split("/");
19143
19143
  const hosted = gh ? parts.length > 2 : parts.length > 2 && parts[0].includes(".");
19144
19144
  let url = /:\/\/|@/.test(repo) ? repo : parts.length > 1 ? `https://${hosted ? "" : `${host}/`}${repo}` : "";
19145
19145
  if (!repo) {
19146
- const resolved = gh ? [...config.keys()].find((key) => /^remote\..+\.gh-resolved$/.test(key))?.slice(7, -12) : undefined;
19147
- const remote = resolved ?? ["upstream", "origin"].find((name) => config.has(`remote.${name}.url`));
19146
+ const remote = (gh ? ghDefaultOf(config, branch, dir, env) : null) ?? ["upstream", "origin"].find((name) => config.has(`remote.${name}.url`));
19148
19147
  url = rewrittenUrl(configValue(config, `remote.${remote}.url`) ?? "", config);
19149
19148
  }
19150
19149
  const key = remoteKey(url);
19151
19150
  return key ? { remotes: [{ name: "forge", url, key }] } : Error("its repository is unknown");
19152
19151
  };
19152
+ var pushHostOf = (config, remote) => {
19153
+ const urls = config.get(`remote.${remote}.pushurl`) ?? config.get(`remote.${remote}.url`) ?? [];
19154
+ if (urls.length !== 1)
19155
+ return null;
19156
+ return remoteKey(rewrittenUrl(urls[0], config))?.split("/")[0] ?? null;
19157
+ };
19158
+ var ghDefaultOf = (config, branch, dir, env) => {
19159
+ const pushHost = pushHostOf(config, pushRemoteOf(config, branch) ?? "origin");
19160
+ for (const [key, value] of localGhResolved(dir, env)) {
19161
+ const name = key.slice(7, -12);
19162
+ if (!name || value !== "base")
19163
+ continue;
19164
+ const host = pushHostOf(config, name);
19165
+ return host !== null && host === pushHost ? name : null;
19166
+ }
19167
+ return null;
19168
+ };
19169
+ var localGhResolved = (dir, env) => {
19170
+ const values = new Map;
19171
+ const listed = spawnSync13("git", ["config", "--local", "-z", "--get-regexp", "^remote\\..+\\.gh-resolved$"], {
19172
+ cwd: dir,
19173
+ encoding: "utf8",
19174
+ timeout: 3000,
19175
+ windowsHide: true,
19176
+ env: { ...process.env, ...env }
19177
+ });
19178
+ for (const entry of (listed.stdout ?? "").split("\x00")) {
19179
+ const split = entry.indexOf(`
19180
+ `);
19181
+ if (split > 0)
19182
+ values.set(entry.slice(0, split), entry.slice(split + 1));
19183
+ }
19184
+ return values;
19185
+ };
19153
19186
  var explicitRepo = (gh, named, env) => named || (gh ? env.GH_REPO ?? process.env.GH_REPO ?? "" : "");
19154
19187
  var grantRefusal = (action, repo, invocation, cache) => {
19155
19188
  const env = invocation.env ?? {};
19156
19189
  const kinds = [];
19157
- let target = () => forgeRepo(action.kind !== "commit" && "forge" in action && action.forge === "gh", "repo" in action && action.repo || "", env, gitConfig(repo.dir, invocation, cache));
19190
+ let target = () => forgeRepo(action.kind !== "commit" && "forge" in action && action.forge === "gh", "repo" in action && action.repo || "", env, gitConfig(repo.dir, invocation, cache), repo.branch, repo.dir);
19158
19191
  if (action.kind === "push") {
19159
19192
  target = () => {
19160
19193
  const config = gitConfig(repo.dir, invocation, cache);
@@ -101,7 +101,7 @@ if (quiet) {
101
101
  `);
102
102
  } else {
103
103
  try {
104
- const { runCodexHook } = await import("./workit-hook-qjyjr3wn.js");
104
+ const { runCodexHook } = await import("./workit-hook-8nhm9sqf.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.21.9",
3
+ "version": "2.22.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.21.9",
45
- "@workit-dev/mcp": "^2.21.9"
44
+ "@workit-dev/core": "^2.22.0",
45
+ "@workit-dev/mcp": "^2.22.0"
46
46
  },
47
47
  "engines": {
48
48
  "node": ">=24"