@workit-dev/opencode 2.23.2 → 2.24.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 +32 -10
  2. package/package.json +2 -2
package/dist/plugin.js CHANGED
@@ -8808,6 +8808,7 @@ var workspaceConfigSchema = looseObject({
8808
8808
  resources: described(optional(unknown()), "Heavy-check limits on this machine: slots, scope, heavy, light, memoryMax, cpuQuota, wait."),
8809
8809
  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
8810
  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."),
8811
+ 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
8812
  autonomy: described(optional(looseObject(Object.fromEntries(["push", "pr", "merge", "release", "rerun"].map((kind) => [
8812
8813
  kind,
8813
8814
  described(optional(union([boolean2(), literal("verified")])), `The ${kind} grant: true, false, or "verified" (only after a verdict).`)
@@ -15723,6 +15724,7 @@ var WORD2 = /[\w./:@=+,-]+/uy;
15723
15724
  var QUOTED = /"[^"$`\\]*"/uy;
15724
15725
  var COMMAND = /^[\w.+][\w./+-]*$/u;
15725
15726
  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(" "));
15727
+ var EFFECTFUL = /^(?:curl|wget|npx|bunx|gh|dlx|push|publish|deploy)$/iu;
15726
15728
  var FALLBACK = new Set(["echo", "true"]);
15727
15729
  var FORM = 'more than && <command> or && (<command> || echo "<text>")';
15728
15730
  var OUTSIDE = '(outside plain words and "double-quoted text")';
@@ -15783,9 +15785,11 @@ function masking(before, appended) {
15783
15785
  return FORM;
15784
15786
  if (names ? !names.has(name.word) : SHELL_STATE.has(name.word.toLowerCase()))
15785
15787
  return names ? FORM : `the shell command ${name.word}`;
15786
- index += 1;
15787
- for (let token = list[index];token && !("op" in token); token = list[index])
15788
+ for (let token = list[index];token && !("op" in token); token = list[index]) {
15789
+ if ("word" in token && EFFECTFUL.test(token.word))
15790
+ return `the effectful command ${token.word}`;
15788
15791
  index += 1;
15792
+ }
15789
15793
  return null;
15790
15794
  };
15791
15795
  while (index < list.length) {
@@ -19035,6 +19039,7 @@ var ENTRY_KEYS = [
19035
19039
  "glob",
19036
19040
  "remotes",
19037
19041
  "externalRepos",
19042
+ "additiveRiskPaths",
19038
19043
  "vcs",
19039
19044
  "autonomy",
19040
19045
  "autoApprove",
@@ -27704,7 +27709,7 @@ var WRAPPERS3 = {
27704
27709
  };
27705
27710
  var INTERPRETERS = /^(?:python[\d.]*|node|bun|deno|ruby|perl|php|tsx|ts-node)$/;
27706
27711
  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)));
27712
+ var isRoot = (file) => isConfigDir(file) || /^(?:issued[^\\/]*|approvals|verdicts)$/.test(path42.relative(canonical5(resolveStateDir()), canonical5(file)));
27708
27713
  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
27714
  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
27715
  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 +28795,7 @@ var globbed = (cwd, target, state, configs) => {
28790
28795
  };
28791
28796
  let roots = [];
28792
28797
  try {
28793
- roots = readdirSync5(state).filter((name) => /^(?:issued|approvals$)/.test(name));
28798
+ roots = readdirSync5(state).filter((name) => /^(?:issued|approvals$|verdicts$)/.test(name));
28794
28799
  } catch {}
28795
28800
  return [
28796
28801
  ...roots.map((name) => path42.join(state, name)).filter((root) => hit(root, true)),
@@ -28815,8 +28820,10 @@ var guardedInodes = (state, configs) => {
28815
28820
  for (const name of CONFIG_FILES)
28816
28821
  add(path42.join(dir, name), "grants");
28817
28822
  for (const name of readdirSync5(state))
28818
- if (/^(?:issued|approvals$)/.test(name))
28819
- add(path42.join(state, name), name === "approvals" ? "approvals" : "issued");
28823
+ if (/^(?:issued|approvals$|verdicts$)/.test(name))
28824
+ add(path42.join(state, name), name === "approvals" ? "approvals" : name === "verdicts" ? "ledger" : "issued");
28825
+ for (const slug of readdirSync5(path42.join(state, "folders")))
28826
+ add(path42.join(state, "folders", slug, "ledger"), "ledger");
28820
28827
  } catch {}
28821
28828
  return seen;
28822
28829
  };
@@ -28843,7 +28850,7 @@ var registryTarget = (cwd, targets) => {
28843
28850
  const viaGlob = glob === undefined ? null : registryTarget(cwd, [glob]);
28844
28851
  if (viaGlob)
28845
28852
  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);
28853
+ 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
28854
  if (registry)
28848
28855
  return { file: target, registry };
28849
28856
  }
@@ -28858,9 +28865,12 @@ var partsUnder = (dir, cwd, target, platform, real) => {
28858
28865
  return relative.startsWith("..") || p.isAbsolute(relative) ? null : relative.split(p.sep);
28859
28866
  };
28860
28867
  var underRegistry = (state, cwd, target, platform = process.platform, real = (file) => file) => {
28861
- const first = partsUnder(state, cwd, target, platform, real)?.[0];
28868
+ const parts = partsUnder(state, cwd, target, platform, real) ?? [];
28869
+ const first = parts[0];
28862
28870
  if (first?.startsWith("issued"))
28863
28871
  return "issued";
28872
+ if (first === "verdicts" || first === "folders" && parts[2] === "ledger")
28873
+ return "ledger";
28864
28874
  return first === "approvals" ? "approvals" : null;
28865
28875
  };
28866
28876
  var underConfig = (dir, cwd, target, platform = process.platform, real = (file) => file) => {
@@ -28874,7 +28884,9 @@ var unquotedWindowsRegistry = (command, platform = process.platform) => {
28874
28884
  const text = flat(command);
28875
28885
  const state = flat(resolveStateDir());
28876
28886
  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;
28887
+ const folders = `${state}/folders/`;
28888
+ 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));
28889
+ const registry = text.includes(`${state}/issued`) ? "issued" : text.includes(`${state}/approvals`) ? "approvals" : ledger(text) ? "ledger" : configs.some((dir) => text.includes(dir)) ? "grants" : null;
28878
28890
  if (!registry)
28879
28891
  return null;
28880
28892
  const spans = command.replace(/[^\s'"|;&<>()]*\\[^\s'"|;&<>()]*/g, (word) => word.replaceAll("\\", "/"));
@@ -28885,7 +28897,7 @@ var unquotedWindowsRegistry = (command, platform = process.platform) => {
28885
28897
  ];
28886
28898
  const named = (target) => moved.some((dir) => {
28887
28899
  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}`);
28900
+ 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
28901
  });
28890
28902
  return writes.writes && (writes.targets === null || writes.targets.some(named)) ? registry : null;
28891
28903
  };
@@ -28905,6 +28917,11 @@ var REGISTRY_DENY = {
28905
28917
  what: "Workit's host-approval state",
28906
28918
  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
28919
  },
28920
+ ledger: {
28921
+ label: "ledger guard",
28922
+ what: "a Workit ledger",
28923
+ unblock: "Only the workit CLI writes it (`workit ledger …`); never edit it by hand."
28924
+ },
28908
28925
  grants: {
28909
28926
  label: "config guard",
28910
28927
  what: "the user's Workit config (grants, roles, youtrack.writes)",
@@ -29196,6 +29213,8 @@ var unverified = (cwd, branch, all, descriptor, verification, head) => {
29196
29213
  const check = checkVerdicts(cwd, branch, all);
29197
29214
  if (check.accepted.accepted || check.accepted.reasons.includes("failing_verdict"))
29198
29215
  return null;
29216
+ if (all.some((row) => row.type === "pr.gate" && row.branch === branch && row.head === check.head))
29217
+ return null;
29199
29218
  const judgment = currentJudgment(cwd);
29200
29219
  const high = judgment?.riskTier === "high";
29201
29220
  let independent;
@@ -32266,6 +32285,9 @@ function pushPreflight(cwd, options = {}) {
32266
32285
  });
32267
32286
  }
32268
32287
 
32288
+ // packages/workit-core/src/core/verdict-set.ts
32289
+ var SET_TTL_MS = 7 * 86400000;
32290
+
32269
32291
  // packages/workit-core/src/forge/report.ts
32270
32292
  var GITLAB_MERGEABLE = new Set(["mergeable"]);
32271
32293
  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.24.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.24.0"
45
45
  },
46
46
  "engines": {
47
47
  "node": ">=24"