@workit-dev/opencode 1.2.0 → 1.2.2

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 +125 -5
  2. package/package.json +2 -2
package/dist/plugin.js CHANGED
@@ -16317,6 +16317,19 @@ function verdictBasis(verdict, current) {
16317
16317
  return "stale";
16318
16318
  }
16319
16319
  var isLiveVerdict = (row, retired) => row.type === "verdict" && typeof row.result === "string" && !retired.has(row.id);
16320
+ var VOID_TYPE = "verdict.voided";
16321
+ function verdictVoids(rows, options = {}) {
16322
+ const voids = new Map;
16323
+ for (const row of rows)
16324
+ if (row.type === VOID_TYPE && row.observer === "workit_cli" && typeof row.target === "string" && (options.chained ? row.integrity === "verified" : row.integrity !== "unverified") && !voids.has(row.target))
16325
+ voids.set(row.target, {
16326
+ id: row.id,
16327
+ at: row.at,
16328
+ reason: str2(row.reason) ?? "",
16329
+ by: row.actor.session
16330
+ });
16331
+ return voids;
16332
+ }
16320
16333
  function trailerSessions(cwd, base, head) {
16321
16334
  if (!base || !head || !safeRef2(base) || !safeRef2(head))
16322
16335
  return [];
@@ -16655,6 +16668,8 @@ function checkVerdictsOnce(cwd, branch, ledgerRows) {
16655
16668
  for (const row of rows)
16656
16669
  if (row.type === "verdict" && row.supersedes && !row.supersedeIgnored && trustReasons(cwd, row).length === 0)
16657
16670
  retired.add(row.supersedes);
16671
+ for (const id of verdictVoids(rows, { chained: true }).keys())
16672
+ retired.add(id);
16658
16673
  const byKind = new Map;
16659
16674
  for (const row of rows.toSorted(byRank))
16660
16675
  if (isLiveVerdict(row, retired) && scope(row)) {
@@ -16788,7 +16803,7 @@ function importMirroredVerdicts(cwd, branch) {
16788
16803
  const mirror = readLedgerAt(cwd, file, { integrity: true });
16789
16804
  if (!mirror.ok)
16790
16805
  return [];
16791
- const candidates = mirror.value.rows.filter((row) => row.type === "verdict" && row.branch === branch && row.integrity === "verified");
16806
+ const candidates = mirror.value.rows.filter((row) => (row.type === "verdict" || row.type === VOID_TYPE) && row.branch === branch && row.integrity === "verified");
16792
16807
  const added = new Set;
16793
16808
  try {
16794
16809
  fs16.mkdirSync(path20.dirname(local.value), { recursive: true });
@@ -16814,7 +16829,10 @@ function importMirroredVerdicts(cwd, branch) {
16814
16829
  integrityReason: _reason,
16815
16830
  ...fields
16816
16831
  } = row;
16817
- const written = appendLine(local.value, (previous) => ({ ok: true, value: sealed(fields, id, at, previous).line }), { heldLock: true });
16832
+ const written = appendLine(local.value, (previous) => ({
16833
+ ok: true,
16834
+ value: sealed(fields, id, at, previous).line
16835
+ }), { heldLock: true });
16818
16836
  if (!written.ok)
16819
16837
  return false;
16820
16838
  ids.add(id);
@@ -16855,6 +16873,7 @@ var OBSERVED_ONLY = new Set([
16855
16873
  "check",
16856
16874
  "merge.unverified",
16857
16875
  "policy.judged",
16876
+ "verdict.voided",
16858
16877
  ...PR_ROW_TYPES
16859
16878
  ]);
16860
16879
 
@@ -24435,7 +24454,8 @@ var WORKIT_BYPASS_FLAGS = ["--unverified", "--overwrite-unintegrated"];
24435
24454
  var WORKIT_USER_ONLY = [
24436
24455
  ["release", "notes", "approve"],
24437
24456
  ["grant", "set"],
24438
- ["grant", "raise"]
24457
+ ["grant", "raise"],
24458
+ ["ledger", "void"]
24439
24459
  ];
24440
24460
  var ALLOWED = new Set(WORKIT_ALLOWED_VERBS);
24441
24461
  var hasWordsInOrder = (words, needle) => {
@@ -25586,7 +25606,7 @@ var shellScript2 = (words) => {
25586
25606
  return null;
25587
25607
  for (let index = 1;index < words.length; index++) {
25588
25608
  const word = words[index];
25589
- if (/^-[a-z]*c$/.test(word))
25609
+ if (/^-[a-z]*c[a-z]*$/.test(word))
25590
25610
  return words[index + 1] ?? null;
25591
25611
  if (/^[-+][oO]$/.test(word))
25592
25612
  index++;
@@ -25617,8 +25637,16 @@ var opaqueWrites = (input, scriptOf = (index) => input[index]) => {
25617
25637
  const files = operands(args);
25618
25638
  const has = (pattern) => args.some((arg) => pattern.test(arg));
25619
25639
  const listed = (named) => named.length ? named : ["."];
25620
- if (name === "unlink" || name === "shred")
25640
+ if (name === "unlink" || name === "shred" || name === "mkfifo")
25621
25641
  return listed(files);
25642
+ if (name === "wget")
25643
+ return wgetOutputs(args);
25644
+ if (name === "tar")
25645
+ return tarOutputs(args);
25646
+ if (name === "unzip")
25647
+ return has(/^-[a-zA-Z]*[lptvzZ]/) ? null : listed(args.flatMap((arg, at) => arg.startsWith("-d") ? [arg.slice(2) || args[at + 1] || "."] : []));
25648
+ if (name === "git")
25649
+ return gitOutputs(args);
25622
25650
  if (/^(?:chmod|chown|chgrp|chattr)$/.test(name))
25623
25651
  return listed(has(/^--reference/) ? files : files.slice(1));
25624
25652
  if (name === "rsync") {
@@ -25738,6 +25766,85 @@ var curlOutputs = (args) => {
25738
25766
  files.push(...dirs.length ? dirs : ["."]);
25739
25767
  return files.length > 0 ? files : null;
25740
25768
  };
25769
+ var valueOf = (args, option) => {
25770
+ const at = args.findIndex((arg) => option.test(arg));
25771
+ return at < 0 ? undefined : option.exec(args[at])?.[1] || args[at + 1];
25772
+ };
25773
+ var wgetOutputs = (args) => {
25774
+ const named = valueOf(args, /^(?:-[a-zA-Z]*O|--output-document=?)(.*)$/s);
25775
+ const logs = [/^-[a-zA-Z]*[oa](.*)$/s, /^--(?:output-file|append-output)=?(.*)$/s].flatMap((option) => valueOf(args, option) ?? []);
25776
+ if (named === undefined)
25777
+ return [...logs, valueOf(args, /^(?:-[a-zA-Z]*P|--directory-prefix=?)(.*)$/s) ?? "."];
25778
+ return named === "-" ? logs : [...logs, named];
25779
+ };
25780
+ var tarOutputs = (args) => {
25781
+ const letters = args.filter((arg, at) => at === 0 && !arg.startsWith("-") || /^-[a-zA-Z]+$/.test(arg)).join("").replaceAll("C", "");
25782
+ const long = (pattern) => args.some((arg) => pattern.test(arg));
25783
+ const extract = /x/.test(letters) || long(/^--(?:extract|get)$/);
25784
+ const creates = /[cruA]/.test(letters) || long(/^--(?:create|append|update|concatenate|delete)$/);
25785
+ if (!extract && !creates)
25786
+ return null;
25787
+ const files = [];
25788
+ if (extract) {
25789
+ const dirs = args.flatMap((arg, at) => /^-C|^--directory(?:=|$)/.test(arg) ? [arg.replace(/^-C|^--directory=?/, "") || args[at + 1] || "."] : []);
25790
+ files.push(...dirs.length ? dirs : ["."]);
25791
+ }
25792
+ const old = args[0] !== undefined && !args[0].startsWith("-") && args[0].includes("f");
25793
+ const archive = old ? args[1] : valueOf(args, /^(?:-[a-zA-Z]*f|--file=?)(.*)$/s);
25794
+ if (creates && archive !== undefined && archive !== "-")
25795
+ files.push(archive);
25796
+ return files;
25797
+ };
25798
+ var CONFIG_READ = /^(?:--get(?:-all|-regexp|-urlmatch)?|--list|-l|get|list)$/;
25799
+ var CONFIG_WRITE = /^(?:--(?:unset(?:-all)?|add|replace-all|rename-section|remove-section|edit)|-e|set|unset|rename-section|remove-section|edit)$/;
25800
+ var CONFIG_VALUE = /^(?:--file|-f|--blob|--type|--default|--comment)$/;
25801
+ var configWrites = (rest) => {
25802
+ if (rest.some((arg) => CONFIG_READ.test(arg)))
25803
+ return false;
25804
+ if (rest.some((arg) => CONFIG_WRITE.test(arg)))
25805
+ return true;
25806
+ let named = 0;
25807
+ for (let index = 0;index < rest.length; index++)
25808
+ if (CONFIG_VALUE.test(rest[index]))
25809
+ index++;
25810
+ else if (!rest[index].startsWith("-"))
25811
+ named++;
25812
+ return named > 1;
25813
+ };
25814
+ var GIT_VALUE = /^(?:-[Ccbouj]|--(?:git-dir|work-tree|namespace|config-env|branch|origin|config|depth|reference(?:-if-able)?|template|separate-git-dir|upload-pack|jobs|filter|initial-branch|object-format))$/;
25815
+ var gitOutputs = (args) => {
25816
+ let at = 0;
25817
+ let base;
25818
+ for (;args[at]?.startsWith("-"); at += GIT_VALUE.test(args[at]) ? 2 : 1)
25819
+ if (args[at] === "-C")
25820
+ base = args[at + 1];
25821
+ const [sub = "", ...rest] = args.slice(at);
25822
+ if (rest.some((arg) => arg === "--help" || arg === "-h"))
25823
+ return null;
25824
+ const names = rest.filter((arg, index) => !arg.startsWith("-") && !GIT_VALUE.test(rest[index - 1] ?? ""));
25825
+ const has = (pattern) => rest.some((arg) => pattern.test(arg));
25826
+ const files = [];
25827
+ const output = valueOf(rest, sub === "archive" ? /^(?:-o|--output=?)(.*)$/s : /^--output=?(.*)$/s);
25828
+ if (output !== undefined)
25829
+ files.push(output);
25830
+ if (sub === "init")
25831
+ files.push(names[0] ?? ".");
25832
+ if (sub === "clone")
25833
+ files.push(names[1] ?? names[0]?.replace(/(?:\.git)?[\\/]*$/, "").split(/[\\/:]/).at(-1) ?? ".");
25834
+ if (sub === "format-patch" && !has(/^--stdout$/))
25835
+ files.push(valueOf(rest, /^(?:-o|--output-directory=?)(.*)$/s) ?? ".");
25836
+ if (sub === "bundle" && names[0] === "create" && names[1])
25837
+ files.push(names[1]);
25838
+ if (sub === "config" && configWrites(rest))
25839
+ files.push(has(/^--global$/) ? "~/.gitconfig" : has(/^--system$/) ? "/etc/gitconfig" : valueOf(rest, /^(?:-f|--file=?)(.*)$/s) ?? ".");
25840
+ const branchWrite = has(/^-[a-zA-Z]*[dDfmMcCu]|^--(?:delete|force|move|copy|set-upstream|unset-upstream|edit)/) || names.length > 0 && !has(/^-[a-zA-Z]*[lavr]|^--(?:list|all|remotes|verbose|show|contains|no-contains|merged|no-merged|points-at|format|sort)/);
25841
+ if (sub === "fetch" || sub === "gc" || sub === "branch" && branchWrite)
25842
+ files.push(".");
25843
+ if (base === undefined)
25844
+ return files.length ? files : null;
25845
+ const under = (file) => file === "." ? `${base}/${OPAQUE_TARGET}git` : /^[/~$]|^[A-Za-z]:[\\/]/.test(file) ? file : `${base}/${file}`;
25846
+ return files.length ? files.map(under) : null;
25847
+ };
25741
25848
  var pathsIn = (text) => [
25742
25849
  ...text.matchAll(/(?<![\w.~:/$-])(?:~\/|\/|[A-Za-z]:\/|\.\.(?:\/|$))[^\s'"`$),;:*?<>|\\[\]{}]*/g)
25743
25850
  ].map((match) => match[0]);
@@ -27447,6 +27554,19 @@ var MUTATING_REMOTE = new Set([
27447
27554
  "set-branches",
27448
27555
  "prune"
27449
27556
  ]);
27557
+ var JUDGE_VERBS = {
27558
+ check: true,
27559
+ dir: true,
27560
+ help: true,
27561
+ "test-audit": true,
27562
+ ledger: ["verdict", "finding", "list", "check", "ruling"],
27563
+ pr: ["status"],
27564
+ ci: ["wait", "logs"],
27565
+ fanout: ["status", "brief"],
27566
+ models: ["show"],
27567
+ lock: ["status"]
27568
+ };
27569
+ var JUDGE_JOB = Object.entries(JUDGE_VERBS).map(([verb, subs]) => `workit ${verb}${subs === true ? "" : ` ${subs.join("|")}`}`).join(", ");
27450
27570
 
27451
27571
  // packages/workit-core/src/hooks/steering.ts
27452
27572
  var ROLES = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workit-dev/opencode",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
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.0.18",
44
- "@workit-dev/core": "^1.2.0"
44
+ "@workit-dev/core": "^1.2.2"
45
45
  },
46
46
  "engines": {
47
47
  "node": ">=24"