@workit-dev/opencode 2.23.2 → 2.25.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.
Files changed (2) hide show
  1. package/dist/plugin.js +33 -10
  2. package/package.json +2 -2
package/dist/plugin.js CHANGED
@@ -8799,6 +8799,7 @@ var workspaceConfigSchema = looseObject({
8799
8799
  cleanup: described(optional(unknown()), "What happens when work finishes: `auto` (default) removes the delivered branch's clean Workit worktree and local branch, switches a clean checkout on it back to the trunk, and stops the processes registered inside them; `keep` removes and stops nothing. A value Workit does not know reads as `keep`."),
8800
8800
  feedback: described(optional(unknown()), '`workit feedback` for this workspace: `off` hides its contract line and makes the verb refuse; `{ "account": "<login>" }` names the GitHub login it posts with; workspaces inside this one inherit it.'),
8801
8801
  liveSessionGuard: described(optional(boolean2()), "Whether the live-session guard denies edits in a checkout another live agent session owns (default true)."),
8802
+ shared: described(optional(boolean2()), "Whether this workspace's repos are shared with a team that must not see Workit named (default false): `workit pr create` and `workit pr edit` then warn, never block, when the PR title, body or a new doc names it."),
8802
8803
  fanout: described(optional(looseObject({
8803
8804
  tierModels: described(optional(unknown()), "The model per slice TIER (mundane, standard, hard), as one name or per host."),
8804
8805
  deps: described(optional(unknown()), "How `workit fanout worktree create` gives a slice worktree node_modules: `install` (default: its own frozen install of its lockfile) or `link` (links into the main checkout's installed packages, for a repo too slow to install per slice). `--deps` overrides it."),
@@ -8808,6 +8809,7 @@ var workspaceConfigSchema = looseObject({
8808
8809
  resources: described(optional(unknown()), "Heavy-check limits on this machine: slots, scope, heavy, light, memoryMax, cpuQuota, wait."),
8809
8810
  remotes: described(optional(array(nonBlank.check(refine((pattern) => remotePattern(pattern) !== null, "is not a remote URL (https://host/owner/repo, git@host:owner/repo, a path, or owner/*)")))), "Remote URLs this entry owns: a checkout pushing to or opening PRs on one never exceeds this entry's grants, wherever the folder is (`owner/*` claims a whole owner). Only the user changes it, in their own terminal."),
8810
8811
  externalRepos: described(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")))), "Repositories outside this workspace's own forge owners that `workit issue create|comment|close --repo` may write to: `owner/name`, or `owner/*` for a whole owner. Only the user changes it, in their own terminal."),
8812
+ additiveRiskPaths: described(optional(array(nonBlank)), "Risk-path globs whose purely additive edits follow the review lane of the rest of the diff. Only the user sets it; it counts only while sealed."),
8811
8813
  autonomy: described(optional(looseObject(Object.fromEntries(["push", "pr", "merge", "release", "rerun"].map((kind) => [
8812
8814
  kind,
8813
8815
  described(optional(union([boolean2(), literal("verified")])), `The ${kind} grant: true, false, or "verified" (only after a verdict).`)
@@ -15723,6 +15725,7 @@ var WORD2 = /[\w./:@=+,-]+/uy;
15723
15725
  var QUOTED = /"[^"$`\\]*"/uy;
15724
15726
  var COMMAND = /^[\w.+][\w./+-]*$/u;
15725
15727
  var SHELL_STATE = new Set(". alias bg bind break builtin call caller case cd command compgen complete compopt continue coproc declare dirs disown do done elif else enable esac eval exec exit export fc fg fi for function getopts goto hash help history if in jobs kill let local logout mapfile popd pushd read readarray readonly return select set shift shopt source suspend then time times trap type typeset ulimit umask unalias unset until wait while".split(" "));
15728
+ var EFFECTFUL = /^(?:curl|wget|npx|bunx|gh|dlx|push|publish|deploy)$/iu;
15726
15729
  var FALLBACK = new Set(["echo", "true"]);
15727
15730
  var FORM = 'more than && <command> or && (<command> || echo "<text>")';
15728
15731
  var OUTSIDE = '(outside plain words and "double-quoted text")';
@@ -15783,9 +15786,11 @@ function masking(before, appended) {
15783
15786
  return FORM;
15784
15787
  if (names ? !names.has(name.word) : SHELL_STATE.has(name.word.toLowerCase()))
15785
15788
  return names ? FORM : `the shell command ${name.word}`;
15786
- index += 1;
15787
- for (let token = list[index];token && !("op" in token); token = list[index])
15789
+ for (let token = list[index];token && !("op" in token); token = list[index]) {
15790
+ if ("word" in token && EFFECTFUL.test(token.word))
15791
+ return `the effectful command ${token.word}`;
15788
15792
  index += 1;
15793
+ }
15789
15794
  return null;
15790
15795
  };
15791
15796
  while (index < list.length) {
@@ -19035,6 +19040,7 @@ var ENTRY_KEYS = [
19035
19040
  "glob",
19036
19041
  "remotes",
19037
19042
  "externalRepos",
19043
+ "additiveRiskPaths",
19038
19044
  "vcs",
19039
19045
  "autonomy",
19040
19046
  "autoApprove",
@@ -27704,7 +27710,7 @@ var WRAPPERS3 = {
27704
27710
  };
27705
27711
  var INTERPRETERS = /^(?:python[\d.]*|node|bun|deno|ruby|perl|php|tsx|ts-node)$/;
27706
27712
  var isConfigDir = (file) => configDirs().some((dir) => canonical5(dir) === canonical5(file));
27707
- var isRoot = (file) => isConfigDir(file) || /^(?:issued[^\\/]*|approvals)$/.test(path42.relative(canonical5(resolveStateDir()), canonical5(file)));
27713
+ var isRoot = (file) => isConfigDir(file) || /^(?:issued[^\\/]*|approvals|verdicts)$/.test(path42.relative(canonical5(resolveStateDir()), canonical5(file)));
27708
27714
  var READ_CALLS = /^(?:print|log|info|warn|error|debug|puts|readdir(?:Sync)?|listdir|scandir|iterdir|glob|l?stat(?:Sync)?|exists(?:Sync)?|isdir|isfile|is_dir|is_file|access(?:Sync)?|realpath(?:Sync)?|dirname|basename|relative|str|repr|len)$/;
27709
27715
  var MUTATING_CALLS = /^(?:renames?(?:Sync)?|move|copy(?:2|file|tree|File)?(?:Sync)?|cp(?:Sync)?|rm(?:tree|dir|Sync|dirSync)?|unlink(?:Sync)?|remove(?:dirs)?|mkdirs?(?:Sync)?|makedirs|mkdtemp(?:Sync)?|(?:sym|hard)?link(?:Sync|_to)?|write\w*|append\w*|truncate(?:Sync)?|ch(?:mod|own)(?:Sync)?|touch|open(?:Sync)?|dump|save|extractall|unpack_archive|put_contents|mv|FileUtils)$/;
27710
27716
  var SPAWNS = /subprocess|child_process|WriteStream|tempfile|sqlite|inplace|getattr|spawn|\bvm\b|Function\s*\(|FileIO|ZipFile|tarfile|shelve|FileHandler|filename\s*=|savefig|utime|ch(?:mod|own)|mkfifo|mknod|\.(?:delete|to_\w+)\s*\(|Path\b.*\.replace\(|Bun\.\$|O_(?:WR|RDW|CR|AP|TR)|(?:PYTHON|NODE_)\w*=|-r\b|--(?:require|import|[\w-]*loader)|\bos\.replace|\b(?:system|popen|exec\w*|fork|eval|shutil|(?:unlink|rename|remove)\w*)\b|\]\s*\(|\brequire\s*\(\s*(?!(['"])(?:(?![a-zA-Z]:)[\w@][^'"]*|[^'"]*\.json)\1)/;
@@ -28790,7 +28796,7 @@ var globbed = (cwd, target, state, configs) => {
28790
28796
  };
28791
28797
  let roots = [];
28792
28798
  try {
28793
- roots = readdirSync5(state).filter((name) => /^(?:issued|approvals$)/.test(name));
28799
+ roots = readdirSync5(state).filter((name) => /^(?:issued|approvals$|verdicts$)/.test(name));
28794
28800
  } catch {}
28795
28801
  return [
28796
28802
  ...roots.map((name) => path42.join(state, name)).filter((root) => hit(root, true)),
@@ -28815,8 +28821,10 @@ var guardedInodes = (state, configs) => {
28815
28821
  for (const name of CONFIG_FILES)
28816
28822
  add(path42.join(dir, name), "grants");
28817
28823
  for (const name of readdirSync5(state))
28818
- if (/^(?:issued|approvals$)/.test(name))
28819
- add(path42.join(state, name), name === "approvals" ? "approvals" : "issued");
28824
+ if (/^(?:issued|approvals$|verdicts$)/.test(name))
28825
+ add(path42.join(state, name), name === "approvals" ? "approvals" : name === "verdicts" ? "ledger" : "issued");
28826
+ for (const slug of readdirSync5(path42.join(state, "folders")))
28827
+ add(path42.join(state, "folders", slug, "ledger"), "ledger");
28820
28828
  } catch {}
28821
28829
  return seen;
28822
28830
  };
@@ -28843,7 +28851,7 @@ var registryTarget = (cwd, targets) => {
28843
28851
  const viaGlob = glob === undefined ? null : registryTarget(cwd, [glob]);
28844
28852
  if (viaGlob)
28845
28853
  return { file: target, registry: viaGlob.registry };
28846
- const registry = hardLinked(path42.resolve(cwd, file), state, configs, inodes) ?? underRegistry(state, cwd, file, process.platform, canonical5) ?? (configs.some((dir) => underConfig(dir, cwd, file, process.platform, canonical5)) ? "grants" : null);
28854
+ const registry = hardLinked(path42.resolve(cwd, file), state, configs, inodes) ?? underRegistry(state, cwd, file, process.platform, canonical5) ?? (/[\\/]\.git[\\/]workit[\\/]ledger(?:[\\/]|$)/.test(canonical5(path42.resolve(cwd, file))) ? "ledger" : null) ?? (configs.some((dir) => underConfig(dir, cwd, file, process.platform, canonical5)) ? "grants" : null);
28847
28855
  if (registry)
28848
28856
  return { file: target, registry };
28849
28857
  }
@@ -28858,9 +28866,12 @@ var partsUnder = (dir, cwd, target, platform, real) => {
28858
28866
  return relative.startsWith("..") || p.isAbsolute(relative) ? null : relative.split(p.sep);
28859
28867
  };
28860
28868
  var underRegistry = (state, cwd, target, platform = process.platform, real = (file) => file) => {
28861
- const first = partsUnder(state, cwd, target, platform, real)?.[0];
28869
+ const parts = partsUnder(state, cwd, target, platform, real) ?? [];
28870
+ const first = parts[0];
28862
28871
  if (first?.startsWith("issued"))
28863
28872
  return "issued";
28873
+ if (first === "verdicts" || first === "folders" && parts[2] === "ledger")
28874
+ return "ledger";
28864
28875
  return first === "approvals" ? "approvals" : null;
28865
28876
  };
28866
28877
  var underConfig = (dir, cwd, target, platform = process.platform, real = (file) => file) => {
@@ -28874,7 +28885,9 @@ var unquotedWindowsRegistry = (command, platform = process.platform) => {
28874
28885
  const text = flat(command);
28875
28886
  const state = flat(resolveStateDir());
28876
28887
  const configs = configDirs().map(flat);
28877
- const registry = text.includes(`${state}/issued`) ? "issued" : text.includes(`${state}/approvals`) ? "approvals" : configs.some((dir) => text.includes(dir)) ? "grants" : null;
28888
+ const folders = `${state}/folders/`;
28889
+ const ledger = (at) => at.includes(`${state}/verdicts`) || /\/\.git\/workit\/ledger(?:[/\s'"]|$)/.test(at) || at.split(folders).slice(1).some((rest) => /^[^/\s]+\/ledger(?:[/\s'"]|$)/.test(rest));
28890
+ const registry = text.includes(`${state}/issued`) ? "issued" : text.includes(`${state}/approvals`) ? "approvals" : ledger(text) ? "ledger" : configs.some((dir) => text.includes(dir)) ? "grants" : null;
28878
28891
  if (!registry)
28879
28892
  return null;
28880
28893
  const spans = command.replace(/[^\s'"|;&<>()]*\\[^\s'"|;&<>()]*/g, (word) => word.replaceAll("\\", "/"));
@@ -28885,7 +28898,7 @@ var unquotedWindowsRegistry = (command, platform = process.platform) => {
28885
28898
  ];
28886
28899
  const named = (target) => moved.some((dir) => {
28887
28900
  const at = flat(/^(?:[a-z]:)?\//i.test(target) ? target : dir + target).replace(/\/\.?\//g, "/");
28888
- return registry === "grants" ? configs.some((cfg) => [cfg, `${cfg}/`, ...CONFIG_FILES.map((name) => `${cfg}/${name}`)].includes(at)) : at.includes(`${state}/${registry}`);
28901
+ return registry === "grants" ? configs.some((cfg) => [cfg, `${cfg}/`, ...CONFIG_FILES.map((name) => `${cfg}/${name}`)].includes(at)) : registry === "ledger" ? ledger(at) : at.includes(`${state}/${registry}`);
28889
28902
  });
28890
28903
  return writes.writes && (writes.targets === null || writes.targets.some(named)) ? registry : null;
28891
28904
  };
@@ -28905,6 +28918,11 @@ var REGISTRY_DENY = {
28905
28918
  what: "Workit's host-approval state",
28906
28919
  unblock: "Approval requests and the user's yes are written only by Workit: run `workit approve <id>` as its own call so the host asks the user, or ask the user to run it in their own terminal; never edit the approvals registry by hand."
28907
28920
  },
28921
+ ledger: {
28922
+ label: "ledger guard",
28923
+ what: "a Workit ledger",
28924
+ unblock: "Only the workit CLI writes it (`workit ledger …`); never edit it by hand."
28925
+ },
28908
28926
  grants: {
28909
28927
  label: "config guard",
28910
28928
  what: "the user's Workit config (grants, roles, youtrack.writes)",
@@ -29196,6 +29214,8 @@ var unverified = (cwd, branch, all, descriptor, verification, head) => {
29196
29214
  const check = checkVerdicts(cwd, branch, all);
29197
29215
  if (check.accepted.accepted || check.accepted.reasons.includes("failing_verdict"))
29198
29216
  return null;
29217
+ if (all.some((row) => row.type === "pr.gate" && row.branch === branch && row.head === check.head))
29218
+ return null;
29199
29219
  const judgment = currentJudgment(cwd);
29200
29220
  const high = judgment?.riskTier === "high";
29201
29221
  let independent;
@@ -32266,6 +32286,9 @@ function pushPreflight(cwd, options = {}) {
32266
32286
  });
32267
32287
  }
32268
32288
 
32289
+ // packages/workit-core/src/core/verdict-set.ts
32290
+ var SET_TTL_MS = 7 * 86400000;
32291
+
32269
32292
  // packages/workit-core/src/forge/report.ts
32270
32293
  var GITLAB_MERGEABLE = new Set(["mergeable"]);
32271
32294
  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.23.2",
3
+ "version": "2.25.0",
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.23.2"
44
+ "@workit-dev/core": "^2.25.0"
45
45
  },
46
46
  "engines": {
47
47
  "node": ">=24"