@workit-dev/opencode 2.25.6 → 2.26.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.
Files changed (2) hide show
  1. package/dist/plugin.js +147 -142
  2. package/package.json +2 -2
package/dist/plugin.js CHANGED
@@ -32107,7 +32107,7 @@ var PROCESS_START = performance.timeOrigin;
32107
32107
  // packages/workit-core/src/hooks/run.ts
32108
32108
  if (false) {}
32109
32109
  // packages/workit-opencode/src/shared/init-apply.ts
32110
- import path53 from "node:path";
32110
+ import path54 from "node:path";
32111
32111
 
32112
32112
  // packages/workit-core/src/core/gitignore.ts
32113
32113
  import { existsSync as existsSync18, readFileSync as readFileSync13, writeFileSync as writeFileSync6 } from "node:fs";
@@ -32158,26 +32158,134 @@ var ensureProjectGitignore = (workspaceRoot, confirmed) => {
32158
32158
  };
32159
32159
 
32160
32160
  // packages/workit-core/src/core/hygiene.ts
32161
- import { existsSync as existsSync19, readFileSync as readFileSync14, readdirSync as readdirSync6, writeFileSync as writeFileSync7 } from "node:fs";
32161
+ import { existsSync as existsSync20, readFileSync as readFileSync15, readdirSync as readdirSync7, writeFileSync as writeFileSync8 } from "node:fs";
32162
+ import path51 from "node:path";
32163
+
32164
+ // packages/workit-core/src/git/ops.ts
32165
+ import { spawnSync as spawnSync25 } from "node:child_process";
32166
+ import {
32167
+ copyFileSync as copyFileSync3,
32168
+ existsSync as existsSync19,
32169
+ mkdirSync as mkdirSync6,
32170
+ readdirSync as readdirSync6,
32171
+ readFileSync as readFileSync14,
32172
+ rmSync as rmSync3,
32173
+ writeFileSync as writeFileSync7
32174
+ } from "node:fs";
32162
32175
  import path50 from "node:path";
32176
+ var COMMIT_TIMEOUT_MS = 10 * 60000;
32177
+ var git5 = (cwd, args, options = {}) => {
32178
+ const result = spawnSync25("git", args, {
32179
+ cwd,
32180
+ encoding: "utf8",
32181
+ env: { ...options.env ?? process.env, GIT_TERMINAL_PROMPT: "0" },
32182
+ maxBuffer: 64 * 1024 * 1024,
32183
+ timeout: options.timeoutMs ?? GIT_TIMEOUTS.local,
32184
+ killSignal: "SIGKILL",
32185
+ windowsHide: true,
32186
+ ...options.input === undefined ? { stdio: ["ignore", "pipe", "pipe"] } : { input: options.input, stdio: ["pipe", "pipe", "pipe"] }
32187
+ });
32188
+ return {
32189
+ ok: result.status === 0,
32190
+ status: result.status,
32191
+ stdout: result.stdout ?? "",
32192
+ stderr: result.stderr ?? "",
32193
+ signal: result.signal
32194
+ };
32195
+ };
32196
+ function operationInProgress(cwd) {
32197
+ const markers = [
32198
+ ["rebase-merge", "rebase"],
32199
+ ["rebase-apply", "rebase"],
32200
+ ["MERGE_HEAD", "merge"],
32201
+ ["CHERRY_PICK_HEAD", "cherry-pick"],
32202
+ ["REVERT_HEAD", "revert"]
32203
+ ];
32204
+ const run = git5(cwd, ["rev-parse", ...markers.flatMap(([name]) => ["--git-path", name])]);
32205
+ if (!run.ok)
32206
+ return null;
32207
+ const found = run.stdout.split(`
32208
+ `).map((line) => path50.resolve(cwd, line.trim()));
32209
+ const conflicted = () => git5(cwd, ["ls-files", "-u"]).stdout.trim() !== "";
32210
+ for (const [index, [, operation]] of markers.entries()) {
32211
+ const marker = found[index];
32212
+ if (!marker || !existsSync19(marker))
32213
+ continue;
32214
+ if (index === 1 && existsSync19(path50.join(marker, "applying")))
32215
+ return { operation: "am", commitAllowed: false, branch: null };
32216
+ if (index === 0 && existsSync19(path50.join(marker, "amend")) && !conflicted()) {
32217
+ let headName = "";
32218
+ try {
32219
+ headName = readFileSync14(path50.join(marker, "head-name"), "utf8").trim();
32220
+ } catch {}
32221
+ const branch = headName.startsWith("refs/heads/") ? headName.slice("refs/heads/".length) : null;
32222
+ return { operation, commitAllowed: branch !== null, branch };
32223
+ }
32224
+ if ((operation === "revert" || operation === "merge") && !conflicted())
32225
+ return { operation, commitAllowed: true, branch: null };
32226
+ return { operation, commitAllowed: false, branch: null };
32227
+ }
32228
+ return null;
32229
+ }
32230
+ function inProgressFailure(operation, verb) {
32231
+ const command = operation === "am" ? "git am" : `git ${operation}`;
32232
+ return failure3("blocked", `${operation.replace("-", "_")}_in_progress: a ${operation === "am" ? "git am" : operation} is in progress; finish or abort it before workit can ${verb}`, `resolve the conflicts, git add <files>, then ${command} --continue # or ${command} --abort to return to where you started`);
32233
+ }
32234
+ var PRIVATE_INDEX_TTL_MS = 60 * 60000;
32235
+ function pushPreflight(cwd, options = {}) {
32236
+ const progress = operationInProgress(cwd);
32237
+ if (progress)
32238
+ return inProgressFailure(progress.operation, "push");
32239
+ const branch = options.branch ?? currentBranch(cwd);
32240
+ if (!branch)
32241
+ return failure3("invalid_input", "HEAD is detached; push a branch");
32242
+ if (isProtectedTarget(cwd, branch))
32243
+ return failure3("blocked", `protected_branch: ${branch} is protected by the workspace branch policy; workit git push never pushes to it`, releaseBranch(cwd, branch) ? `workit git push --release ${branch} # finishing a release or hotfix; needs the release grant` : "workit git branch <feature/name> # push a feature branch and open a PR");
32244
+ const sha = resolveRef(cwd, `refs/heads/${branch}`);
32245
+ if (!sha)
32246
+ return failure3("not_found", `branch ${branch} has no commit to push`);
32247
+ const remote = pushRemoteName(cwd, branch);
32248
+ if (!remote)
32249
+ return failure3("not_found", "no push remote is configured for this branch", "git remote add origin <url>");
32250
+ const raw = pushUrl(cwd, remote);
32251
+ if (!raw)
32252
+ return failure3("blocked", `remote "${remote}" has no single push URL`, `git remote get-url --push --all ${remote} # keep exactly one push URL`);
32253
+ const parsed = parseRemoteUrl(raw);
32254
+ const local = parsed?.protocol === "file";
32255
+ if (!local && !pushTargetIsStable(cwd, raw))
32256
+ return failure3("blocked", `push_target_rewritten: the push URL of "${remote}" is rewritten by a url.*.insteadOf rule, so the destination is not the one checked`, "git config --get-regexp '^url\\.' # remove the rewrite for this remote");
32257
+ return success2({
32258
+ branch,
32259
+ sha,
32260
+ remote,
32261
+ url: redactRemote(raw),
32262
+ rawUrl: raw,
32263
+ local
32264
+ });
32265
+ }
32266
+
32267
+ // packages/workit-core/src/core/changelog-roll.ts
32268
+ var BATCH_BYTES = 16 * 1024 * 1024;
32269
+
32270
+ // packages/workit-core/src/core/hygiene.ts
32163
32271
  var repoRoot3 = assetRoot();
32164
- var templatesDir = () => path50.join(repoRoot3, "templates", "hygiene");
32272
+ var templatesDir = () => path51.join(repoRoot3, "templates", "hygiene");
32165
32273
  var packageJson2 = (root) => {
32166
- if (!existsSync19(path50.join(root, "package.json")))
32274
+ if (!existsSync20(path51.join(root, "package.json")))
32167
32275
  return null;
32168
32276
  try {
32169
- return JSON.parse(readFileSync14(path50.join(root, "package.json"), "utf8"));
32277
+ return JSON.parse(readFileSync15(path51.join(root, "package.json"), "utf8"));
32170
32278
  } catch {
32171
32279
  return null;
32172
32280
  }
32173
32281
  };
32174
32282
  var isOpenSource = (root) => {
32175
- if (existsSync19(path50.join(root, "LICENSE")))
32283
+ if (existsSync20(path51.join(root, "LICENSE")))
32176
32284
  return true;
32177
32285
  const pkg = packageJson2(root);
32178
32286
  if (pkg && !pkg.private)
32179
32287
  return true;
32180
- return path50.basename(root) === "workit";
32288
+ return path51.basename(root) === "workit";
32181
32289
  };
32182
32290
  var licenseHolder = (root) => {
32183
32291
  const pkg = packageJson2(root);
@@ -32200,13 +32308,13 @@ var planHygieneFiles = (root, opts = {}) => {
32200
32308
  files.push("LICENSE", "CONTRIBUTING.md");
32201
32309
  const planned = [];
32202
32310
  for (const file of files) {
32203
- if (existsSync19(path50.join(root, file)))
32311
+ if (existsSync20(path51.join(root, file)))
32204
32312
  continue;
32205
- const tpl = path50.join(templatesDir(), file);
32206
- if (!existsSync19(tpl))
32313
+ const tpl = path51.join(templatesDir(), file);
32314
+ if (!existsSync20(tpl))
32207
32315
  continue;
32208
- const content = readFileSync14(tpl, "utf8").replace(/<PROJECT>/g, path50.basename(root)).replace(/<YEAR>/g, String(new Date().getFullYear())).replace(/<HOLDER>\s*/g, licenseHolder(root));
32209
- planned.push({ path: path50.join(root, file), content });
32316
+ const content = readFileSync15(tpl, "utf8").replace(/<PROJECT>/g, path51.basename(root)).replace(/<YEAR>/g, String(new Date().getFullYear())).replace(/<HOLDER>\s*/g, licenseHolder(root));
32317
+ planned.push({ path: path51.join(root, file), content });
32210
32318
  }
32211
32319
  return planned;
32212
32320
  };
@@ -32215,31 +32323,31 @@ var ensureHygieneFiles = (root, opts) => {
32215
32323
  return { ok: false, error: "confirmed: true required" };
32216
32324
  const created = [];
32217
32325
  for (const planned of planHygieneFiles(root, opts)) {
32218
- writeFileSync7(planned.path, planned.content, "utf8");
32219
- created.push(path50.basename(planned.path));
32326
+ writeFileSync8(planned.path, planned.content, "utf8");
32327
+ created.push(path51.basename(planned.path));
32220
32328
  }
32221
32329
  return { ok: true, created };
32222
32330
  };
32223
32331
 
32224
32332
  // packages/workit-core/src/core/init.ts
32225
32333
  import fs33 from "node:fs";
32226
- import path52 from "node:path";
32227
- import { spawnSync as spawnSync25 } from "node:child_process";
32334
+ import path53 from "node:path";
32335
+ import { spawnSync as spawnSync26 } from "node:child_process";
32228
32336
 
32229
32337
  // packages/workit-core/src/core/workspace-branch-policy.ts
32230
- import { mkdirSync as mkdirSync6, readFileSync as readFileSync15, renameSync as renameSync5, rmSync as rmSync3, writeFileSync as writeFileSync8 } from "node:fs";
32231
- import path51 from "node:path";
32338
+ import { mkdirSync as mkdirSync7, readFileSync as readFileSync16, renameSync as renameSync5, rmSync as rmSync4, writeFileSync as writeFileSync9 } from "node:fs";
32339
+ import path52 from "node:path";
32232
32340
  import { isDeepStrictEqual } from "node:util";
32233
32341
  var readFileSafe = (p) => {
32234
32342
  try {
32235
- return readFileSync15(p, "utf8");
32343
+ return readFileSync16(p, "utf8");
32236
32344
  } catch {
32237
32345
  return null;
32238
32346
  }
32239
32347
  };
32240
32348
  function applyWorkspaceBranchPolicy(opts) {
32241
32349
  const { workspace_root, env = process.env } = opts;
32242
- const dir = path51.join(env.WORKIT_CONFIG ?? configDir2());
32350
+ const dir = path52.join(env.WORKIT_CONFIG ?? configDir2());
32243
32351
  const {
32244
32352
  status,
32245
32353
  path: wsPath,
@@ -32251,7 +32359,7 @@ function applyWorkspaceBranchPolicy(opts) {
32251
32359
  if (status === "malformed" || status === "invalid")
32252
32360
  return { ok: false, error: workspacesError ?? `invalid workspaces.json: ${wsPath}` };
32253
32361
  const detection = detectBranchPolicy(workspace_root);
32254
- const name = String(env.WORKIT_BP_NAME ?? path51.basename(workspace_root));
32362
+ const name = String(env.WORKIT_BP_NAME ?? path52.basename(workspace_root));
32255
32363
  const integration = env.WORKIT_BP_INTEGRATION ?? detection.integration;
32256
32364
  const policy = {
32257
32365
  preset: detection.preset,
@@ -32300,13 +32408,13 @@ function applyWorkspaceBranchPolicy(opts) {
32300
32408
  ok: false,
32301
32409
  error: `workspaces.json changed while applying the branch policy: ${wsPath}`
32302
32410
  };
32303
- mkdirSync6(path51.dirname(wsPath), { recursive: true });
32411
+ mkdirSync7(path52.dirname(wsPath), { recursive: true });
32304
32412
  const tmp = `${wsPath}.${process.pid}.tmp`;
32305
32413
  try {
32306
- writeFileSync8(tmp, JSON.stringify({ ...document, workspaces: next }, null, 2) + `
32414
+ writeFileSync9(tmp, JSON.stringify({ ...document, workspaces: next }, null, 2) + `
32307
32415
  `, "utf8");
32308
32416
  if (workspacesRevision(readFileSafe(wsPath)) !== revision) {
32309
- rmSync3(tmp, { force: true });
32417
+ rmSync4(tmp, { force: true });
32310
32418
  return {
32311
32419
  ok: false,
32312
32420
  error: `workspaces.json changed while applying the branch policy: ${wsPath}`
@@ -32315,7 +32423,7 @@ function applyWorkspaceBranchPolicy(opts) {
32315
32423
  renameSync5(tmp, wsPath);
32316
32424
  } catch (error) {
32317
32425
  try {
32318
- rmSync3(tmp, { force: true });
32426
+ rmSync4(tmp, { force: true });
32319
32427
  } catch {}
32320
32428
  return {
32321
32429
  ok: false,
@@ -32346,7 +32454,7 @@ var resolveInitProvider = (cwd) => {
32346
32454
  return env.toLowerCase();
32347
32455
  const root = cwd ?? process.env.WORKIT_WORKSPACE_ROOT ?? process.cwd();
32348
32456
  try {
32349
- const out = spawnSync25("git", ["remote", "get-url", "origin"], {
32457
+ const out = spawnSync26("git", ["remote", "get-url", "origin"], {
32350
32458
  cwd: root,
32351
32459
  encoding: "utf8"
32352
32460
  });
@@ -32400,7 +32508,7 @@ function initApplyData(action, env = process.env) {
32400
32508
  fs33.mkdirSync(dir, { recursive: true });
32401
32509
  switch (action) {
32402
32510
  case "youtrack_json": {
32403
- const out = path52.join(dir, "youtrack.json");
32511
+ const out = path53.join(dir, "youtrack.json");
32404
32512
  fs33.writeFileSync(out, JSON.stringify(youtrackJsonContent(), null, 2) + `
32405
32513
  `, "utf8");
32406
32514
  return { action, ok: true, path: out };
@@ -32414,10 +32522,10 @@ function initApplyData(action, env = process.env) {
32414
32522
  };
32415
32523
  }
32416
32524
  case "youtrack_scaffold": {
32417
- const jsonOut = path52.join(dir, "youtrack.json");
32525
+ const jsonOut = path53.join(dir, "youtrack.json");
32418
32526
  fs33.writeFileSync(jsonOut, JSON.stringify(youtrackJsonContent(), null, 2) + `
32419
32527
  `, "utf8");
32420
- const configPath = path52.resolve(jsonOut);
32528
+ const configPath = path53.resolve(jsonOut);
32421
32529
  const cfg = readJson3(configPath) ?? {};
32422
32530
  const base = String(cfg.baseUrl ?? "").replace(/\/+$/, "");
32423
32531
  const meeting = String(cfg.meetingIssue ?? "");
@@ -32453,10 +32561,10 @@ function initApplyData(action, env = process.env) {
32453
32561
  };
32454
32562
  }
32455
32563
  case "vcs_scaffold": {
32456
- const jsonOut = path52.join(dir, "vcs.json");
32564
+ const jsonOut = path53.join(dir, "vcs.json");
32457
32565
  fs33.writeFileSync(jsonOut, JSON.stringify(vcsJsonContent(), null, 2) + `
32458
32566
  `, "utf8");
32459
- const configPath = path52.resolve(jsonOut);
32567
+ const configPath = path53.resolve(jsonOut);
32460
32568
  const prev = process.env.WORKIT_VCS_CONFIG;
32461
32569
  process.env.WORKIT_VCS_CONFIG = configPath;
32462
32570
  try {
@@ -32575,7 +32683,7 @@ var executeInitApply = (args, directory, runtime) => {
32575
32683
  protectedNames: args.branch_policy_protected
32576
32684
  }, current);
32577
32685
  writeConfig(next);
32578
- return output(ok({ action: "config", path: path53.join(configDir2(), "config.json"), ...next }));
32686
+ return output(ok({ action: "config", path: path54.join(configDir2(), "config.json"), ...next }));
32579
32687
  }
32580
32688
  const env = Object.fromEntries(Object.entries({
32581
32689
  WORKIT_YT_BASE_URL: args.base_url,
@@ -32592,14 +32700,14 @@ var executeInitApply = (args, directory, runtime) => {
32592
32700
 
32593
32701
  // packages/workit-opencode/src/shared/session.ts
32594
32702
  import { realpathSync as realpathSync12 } from "node:fs";
32595
- import path54 from "node:path";
32703
+ import path55 from "node:path";
32596
32704
  var sameWorkspace = (expected, observed) => {
32597
32705
  if (typeof observed !== "string" || !observed)
32598
32706
  return false;
32599
32707
  try {
32600
32708
  return realpathSync12(expected) === realpathSync12(observed);
32601
32709
  } catch {
32602
- return path54.resolve(expected) === path54.resolve(observed);
32710
+ return path55.resolve(expected) === path55.resolve(observed);
32603
32711
  }
32604
32712
  };
32605
32713
 
@@ -32671,7 +32779,7 @@ var workitFamilyOf = (toolName) => {
32671
32779
 
32672
32780
  // packages/workit-opencode/src/tools/context.ts
32673
32781
  import { realpathSync as realpathSync13 } from "node:fs";
32674
- import path55 from "node:path";
32782
+ import path56 from "node:path";
32675
32783
  var createContextTool = () => ({
32676
32784
  description: "Read Git, pull request, YouTrack, issue, changelog, release, or affected-file context.",
32677
32785
  execute: async (args, context) => {
@@ -32681,7 +32789,7 @@ var createContextTool = () => ({
32681
32789
  let root;
32682
32790
  try {
32683
32791
  const cwd = parsed.data.cwd;
32684
- root = realpathSync13(cwd ? path55.resolve(context.directory, cwd) : context.directory);
32792
+ root = realpathSync13(cwd ? path56.resolve(context.directory, cwd) : context.directory);
32685
32793
  } catch {
32686
32794
  return JSON.stringify(failure2("invalid_input", "context target directory cannot be resolved"), null, 2);
32687
32795
  }
@@ -32717,7 +32825,7 @@ import fs35 from "node:fs";
32717
32825
  import path58 from "node:path";
32718
32826
 
32719
32827
  // packages/workit-core/src/fanout-landed.ts
32720
- import { spawnSync as spawnSync26 } from "node:child_process";
32828
+ import { spawnSync as spawnSync27 } from "node:child_process";
32721
32829
  function trunkRefresher(cwd, trunk) {
32722
32830
  const match = /^refs\/remotes\/([^/]+)\/(.+)$/u.exec(trunk);
32723
32831
  if (!match)
@@ -32806,7 +32914,7 @@ function trunkPatchIds(ctx, fork) {
32806
32914
  "--"
32807
32915
  ]);
32808
32916
  if (log.ok && log.stdout.trim()) {
32809
- const run = spawnSync26("git", ["patch-id", "--stable"], {
32917
+ const run = spawnSync27("git", ["patch-id", "--stable"], {
32810
32918
  cwd: ctx.cwd,
32811
32919
  input: log.stdout,
32812
32920
  encoding: "utf8",
@@ -32924,7 +33032,7 @@ function sliceStart(cwd, rows, fanout, slice) {
32924
33032
 
32925
33033
  // packages/workit-core/src/checks.ts
32926
33034
  var MAX_LOG_BYTES = 2 * 1024 * 1024;
32927
- var BATCH_BYTES = 64 * 1024;
33035
+ var BATCH_BYTES2 = 64 * 1024;
32928
33036
  var MAX_PENDING = 64 * 1024;
32929
33037
  var MAX_KEY_BYTES = 256 * 1024;
32930
33038
  var LOG_RETENTION = {
@@ -32950,109 +33058,6 @@ import { createHash as createHash20, randomBytes as randomBytes4 } from "node:cr
32950
33058
  import fs34 from "node:fs";
32951
33059
  import path57 from "node:path";
32952
33060
 
32953
- // packages/workit-core/src/git/ops.ts
32954
- import { spawnSync as spawnSync27 } from "node:child_process";
32955
- import {
32956
- copyFileSync as copyFileSync3,
32957
- existsSync as existsSync20,
32958
- mkdirSync as mkdirSync7,
32959
- readdirSync as readdirSync7,
32960
- readFileSync as readFileSync16,
32961
- rmSync as rmSync4,
32962
- writeFileSync as writeFileSync9
32963
- } from "node:fs";
32964
- import path56 from "node:path";
32965
- var COMMIT_TIMEOUT_MS = 10 * 60000;
32966
- var git5 = (cwd, args, options = {}) => {
32967
- const result = spawnSync27("git", args, {
32968
- cwd,
32969
- encoding: "utf8",
32970
- env: { ...options.env ?? process.env, GIT_TERMINAL_PROMPT: "0" },
32971
- maxBuffer: 64 * 1024 * 1024,
32972
- timeout: options.timeoutMs ?? GIT_TIMEOUTS.local,
32973
- killSignal: "SIGKILL",
32974
- windowsHide: true,
32975
- ...options.input === undefined ? { stdio: ["ignore", "pipe", "pipe"] } : { input: options.input, stdio: ["pipe", "pipe", "pipe"] }
32976
- });
32977
- return {
32978
- ok: result.status === 0,
32979
- status: result.status,
32980
- stdout: result.stdout ?? "",
32981
- stderr: result.stderr ?? "",
32982
- signal: result.signal
32983
- };
32984
- };
32985
- function operationInProgress(cwd) {
32986
- const markers = [
32987
- ["rebase-merge", "rebase"],
32988
- ["rebase-apply", "rebase"],
32989
- ["MERGE_HEAD", "merge"],
32990
- ["CHERRY_PICK_HEAD", "cherry-pick"],
32991
- ["REVERT_HEAD", "revert"]
32992
- ];
32993
- const run = git5(cwd, ["rev-parse", ...markers.flatMap(([name]) => ["--git-path", name])]);
32994
- if (!run.ok)
32995
- return null;
32996
- const found = run.stdout.split(`
32997
- `).map((line) => path56.resolve(cwd, line.trim()));
32998
- const conflicted = () => git5(cwd, ["ls-files", "-u"]).stdout.trim() !== "";
32999
- for (const [index, [, operation]] of markers.entries()) {
33000
- const marker = found[index];
33001
- if (!marker || !existsSync20(marker))
33002
- continue;
33003
- if (index === 1 && existsSync20(path56.join(marker, "applying")))
33004
- return { operation: "am", commitAllowed: false, branch: null };
33005
- if (index === 0 && existsSync20(path56.join(marker, "amend")) && !conflicted()) {
33006
- let headName = "";
33007
- try {
33008
- headName = readFileSync16(path56.join(marker, "head-name"), "utf8").trim();
33009
- } catch {}
33010
- const branch = headName.startsWith("refs/heads/") ? headName.slice("refs/heads/".length) : null;
33011
- return { operation, commitAllowed: branch !== null, branch };
33012
- }
33013
- if ((operation === "revert" || operation === "merge") && !conflicted())
33014
- return { operation, commitAllowed: true, branch: null };
33015
- return { operation, commitAllowed: false, branch: null };
33016
- }
33017
- return null;
33018
- }
33019
- function inProgressFailure(operation, verb) {
33020
- const command = operation === "am" ? "git am" : `git ${operation}`;
33021
- return failure3("blocked", `${operation.replace("-", "_")}_in_progress: a ${operation === "am" ? "git am" : operation} is in progress; finish or abort it before workit can ${verb}`, `resolve the conflicts, git add <files>, then ${command} --continue # or ${command} --abort to return to where you started`);
33022
- }
33023
- var PRIVATE_INDEX_TTL_MS = 60 * 60000;
33024
- function pushPreflight(cwd, options = {}) {
33025
- const progress = operationInProgress(cwd);
33026
- if (progress)
33027
- return inProgressFailure(progress.operation, "push");
33028
- const branch = options.branch ?? currentBranch(cwd);
33029
- if (!branch)
33030
- return failure3("invalid_input", "HEAD is detached; push a branch");
33031
- if (isProtectedTarget(cwd, branch))
33032
- return failure3("blocked", `protected_branch: ${branch} is protected by the workspace branch policy; workit git push never pushes to it`, releaseBranch(cwd, branch) ? `workit git push --release ${branch} # finishing a release or hotfix; needs the release grant` : "workit git branch <feature/name> # push a feature branch and open a PR");
33033
- const sha = resolveRef(cwd, `refs/heads/${branch}`);
33034
- if (!sha)
33035
- return failure3("not_found", `branch ${branch} has no commit to push`);
33036
- const remote = pushRemoteName(cwd, branch);
33037
- if (!remote)
33038
- return failure3("not_found", "no push remote is configured for this branch", "git remote add origin <url>");
33039
- const raw = pushUrl(cwd, remote);
33040
- if (!raw)
33041
- return failure3("blocked", `remote "${remote}" has no single push URL`, `git remote get-url --push --all ${remote} # keep exactly one push URL`);
33042
- const parsed = parseRemoteUrl(raw);
33043
- const local = parsed?.protocol === "file";
33044
- if (!local && !pushTargetIsStable(cwd, raw))
33045
- return failure3("blocked", `push_target_rewritten: the push URL of "${remote}" is rewritten by a url.*.insteadOf rule, so the destination is not the one checked`, "git config --get-regexp '^url\\.' # remove the rewrite for this remote");
33046
- return success2({
33047
- branch,
33048
- sha,
33049
- remote,
33050
- url: redactRemote(raw),
33051
- rawUrl: raw,
33052
- local
33053
- });
33054
- }
33055
-
33056
33061
  // packages/workit-core/src/forge/report.ts
33057
33062
  var GITLAB_MERGEABLE = new Set(["mergeable"]);
33058
33063
  var GITHUB_MERGEABLE = new Set(["clean", "unstable", "has_hooks"]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workit-dev/opencode",
3
- "version": "2.25.6",
3
+ "version": "2.26.1",
4
4
  "private": false,
5
5
  "description": "Workit OpenCode plugin — native tools, adaptive policy, and sixteen method skills",
6
6
  "keywords": [
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "@opencode/plugin": "2.3.2",
44
- "@workit-dev/core": "^2.25.6"
44
+ "@workit-dev/core": "^2.26.1"
45
45
  },
46
46
  "engines": {
47
47
  "node": ">=24"