@workit-dev/pi 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.
package/dist/worker.js CHANGED
@@ -6525,6 +6525,7 @@ var workspaceConfigSchema = looseObject({
6525
6525
  resources: described(optional(unknown()), "Heavy-check limits on this machine: slots, scope, heavy, light, memoryMax, cpuQuota, wait."),
6526
6526
  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."),
6527
6527
  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."),
6528
+ 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."),
6528
6529
  autonomy: described(optional(looseObject(Object.fromEntries(["push", "pr", "merge", "release", "rerun"].map((kind) => [
6529
6530
  kind,
6530
6531
  described(optional(union([boolean2(), literal("verified")])), `The ${kind} grant: true, false, or "verified" (only after a verdict).`)
package/dist/workit.js CHANGED
@@ -8479,6 +8479,7 @@ var workspaceConfigSchema = looseObject({
8479
8479
  resources: described(optional(unknown()), "Heavy-check limits on this machine: slots, scope, heavy, light, memoryMax, cpuQuota, wait."),
8480
8480
  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."),
8481
8481
  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."),
8482
+ 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."),
8482
8483
  autonomy: described(optional(looseObject(Object.fromEntries(["push", "pr", "merge", "release", "rerun"].map((kind) => [
8483
8484
  kind,
8484
8485
  described(optional(union([boolean2(), literal("verified")])), `The ${kind} grant: true, false, or "verified" (only after a verdict).`)
@@ -15464,6 +15465,7 @@ var WORD2 = /[\w./:@=+,-]+/uy;
15464
15465
  var QUOTED = /"[^"$`\\]*"/uy;
15465
15466
  var COMMAND = /^[\w.+][\w./+-]*$/u;
15466
15467
  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(" "));
15468
+ var EFFECTFUL = /^(?:curl|wget|npx|bunx|gh|dlx|push|publish|deploy)$/iu;
15467
15469
  var FALLBACK = new Set(["echo", "true"]);
15468
15470
  var FORM = 'more than && <command> or && (<command> || echo "<text>")';
15469
15471
  var OUTSIDE = '(outside plain words and "double-quoted text")';
@@ -15524,9 +15526,11 @@ function masking(before, appended) {
15524
15526
  return FORM;
15525
15527
  if (names ? !names.has(name.word) : SHELL_STATE.has(name.word.toLowerCase()))
15526
15528
  return names ? FORM : `the shell command ${name.word}`;
15527
- index += 1;
15528
- for (let token = list[index];token && !("op" in token); token = list[index])
15529
+ for (let token = list[index];token && !("op" in token); token = list[index]) {
15530
+ if ("word" in token && EFFECTFUL.test(token.word))
15531
+ return `the effectful command ${token.word}`;
15529
15532
  index += 1;
15533
+ }
15530
15534
  return null;
15531
15535
  };
15532
15536
  while (index < list.length) {
@@ -18879,6 +18883,7 @@ var ENTRY_KEYS = [
18879
18883
  "glob",
18880
18884
  "remotes",
18881
18885
  "externalRepos",
18886
+ "additiveRiskPaths",
18882
18887
  "vcs",
18883
18888
  "autonomy",
18884
18889
  "autoApprove",
@@ -27671,7 +27676,7 @@ var WRAPPERS3 = {
27671
27676
  };
27672
27677
  var INTERPRETERS = /^(?:python[\d.]*|node|bun|deno|ruby|perl|php|tsx|ts-node)$/;
27673
27678
  var isConfigDir = (file) => configDirs().some((dir) => canonical5(dir) === canonical5(file));
27674
- var isRoot = (file) => isConfigDir(file) || /^(?:issued[^\\/]*|approvals)$/.test(path42.relative(canonical5(resolveStateDir()), canonical5(file)));
27679
+ var isRoot = (file) => isConfigDir(file) || /^(?:issued[^\\/]*|approvals|verdicts)$/.test(path42.relative(canonical5(resolveStateDir()), canonical5(file)));
27675
27680
  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)$/;
27676
27681
  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)$/;
27677
27682
  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)/;
@@ -28758,7 +28763,7 @@ var globbed = (cwd, target, state, configs) => {
28758
28763
  };
28759
28764
  let roots = [];
28760
28765
  try {
28761
- roots = readdirSync5(state).filter((name) => /^(?:issued|approvals$)/.test(name));
28766
+ roots = readdirSync5(state).filter((name) => /^(?:issued|approvals$|verdicts$)/.test(name));
28762
28767
  } catch {}
28763
28768
  return [
28764
28769
  ...roots.map((name) => path42.join(state, name)).filter((root) => hit(root, true)),
@@ -28783,8 +28788,10 @@ var guardedInodes = (state, configs) => {
28783
28788
  for (const name of CONFIG_FILES)
28784
28789
  add(path42.join(dir, name), "grants");
28785
28790
  for (const name of readdirSync5(state))
28786
- if (/^(?:issued|approvals$)/.test(name))
28787
- add(path42.join(state, name), name === "approvals" ? "approvals" : "issued");
28791
+ if (/^(?:issued|approvals$|verdicts$)/.test(name))
28792
+ add(path42.join(state, name), name === "approvals" ? "approvals" : name === "verdicts" ? "ledger" : "issued");
28793
+ for (const slug of readdirSync5(path42.join(state, "folders")))
28794
+ add(path42.join(state, "folders", slug, "ledger"), "ledger");
28788
28795
  } catch {}
28789
28796
  return seen;
28790
28797
  };
@@ -28811,7 +28818,7 @@ var registryTarget = (cwd, targets) => {
28811
28818
  const viaGlob = glob === undefined ? null : registryTarget(cwd, [glob]);
28812
28819
  if (viaGlob)
28813
28820
  return { file: target, registry: viaGlob.registry };
28814
- 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);
28821
+ 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);
28815
28822
  if (registry)
28816
28823
  return { file: target, registry };
28817
28824
  }
@@ -28826,9 +28833,12 @@ var partsUnder = (dir, cwd, target, platform, real) => {
28826
28833
  return relative.startsWith("..") || p.isAbsolute(relative) ? null : relative.split(p.sep);
28827
28834
  };
28828
28835
  var underRegistry = (state, cwd, target, platform = process.platform, real = (file) => file) => {
28829
- const first = partsUnder(state, cwd, target, platform, real)?.[0];
28836
+ const parts = partsUnder(state, cwd, target, platform, real) ?? [];
28837
+ const first = parts[0];
28830
28838
  if (first?.startsWith("issued"))
28831
28839
  return "issued";
28840
+ if (first === "verdicts" || first === "folders" && parts[2] === "ledger")
28841
+ return "ledger";
28832
28842
  return first === "approvals" ? "approvals" : null;
28833
28843
  };
28834
28844
  var underConfig = (dir, cwd, target, platform = process.platform, real = (file) => file) => {
@@ -28842,7 +28852,9 @@ var unquotedWindowsRegistry = (command, platform = process.platform) => {
28842
28852
  const text = flat(command);
28843
28853
  const state = flat(resolveStateDir());
28844
28854
  const configs = configDirs().map(flat);
28845
- const registry = text.includes(`${state}/issued`) ? "issued" : text.includes(`${state}/approvals`) ? "approvals" : configs.some((dir) => text.includes(dir)) ? "grants" : null;
28855
+ const folders = `${state}/folders/`;
28856
+ 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));
28857
+ const registry = text.includes(`${state}/issued`) ? "issued" : text.includes(`${state}/approvals`) ? "approvals" : ledger(text) ? "ledger" : configs.some((dir) => text.includes(dir)) ? "grants" : null;
28846
28858
  if (!registry)
28847
28859
  return null;
28848
28860
  const spans = command.replace(/[^\s'"|;&<>()]*\\[^\s'"|;&<>()]*/g, (word) => word.replaceAll("\\", "/"));
@@ -28853,7 +28865,7 @@ var unquotedWindowsRegistry = (command, platform = process.platform) => {
28853
28865
  ];
28854
28866
  const named = (target) => moved.some((dir) => {
28855
28867
  const at = flat(/^(?:[a-z]:)?\//i.test(target) ? target : dir + target).replace(/\/\.?\//g, "/");
28856
- return registry === "grants" ? configs.some((cfg) => [cfg, `${cfg}/`, ...CONFIG_FILES.map((name) => `${cfg}/${name}`)].includes(at)) : at.includes(`${state}/${registry}`);
28868
+ return registry === "grants" ? configs.some((cfg) => [cfg, `${cfg}/`, ...CONFIG_FILES.map((name) => `${cfg}/${name}`)].includes(at)) : registry === "ledger" ? ledger(at) : at.includes(`${state}/${registry}`);
28857
28869
  });
28858
28870
  return writes.writes && (writes.targets === null || writes.targets.some(named)) ? registry : null;
28859
28871
  };
@@ -28873,6 +28885,11 @@ var REGISTRY_DENY = {
28873
28885
  what: "Workit's host-approval state",
28874
28886
  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."
28875
28887
  },
28888
+ ledger: {
28889
+ label: "ledger guard",
28890
+ what: "a Workit ledger",
28891
+ unblock: "Only the workit CLI writes it (`workit ledger …`); never edit it by hand."
28892
+ },
28876
28893
  grants: {
28877
28894
  label: "config guard",
28878
28895
  what: "the user's Workit config (grants, roles, youtrack.writes)",
@@ -29164,6 +29181,8 @@ var unverified = (cwd, branch, all, descriptor, verification, head) => {
29164
29181
  const check = checkVerdicts(cwd, branch, all);
29165
29182
  if (check.accepted.accepted || check.accepted.reasons.includes("failing_verdict"))
29166
29183
  return null;
29184
+ if (all.some((row) => row.type === "pr.gate" && row.branch === branch && row.head === check.head))
29185
+ return null;
29167
29186
  const judgment = currentJudgment(cwd);
29168
29187
  const high = judgment?.riskTier === "high";
29169
29188
  let independent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workit-dev/pi",
3
- "version": "2.23.2",
3
+ "version": "2.24.0",
4
4
  "description": "Workit native extension for Pi — tools, method skills, and session continuity",
5
5
  "keywords": [
6
6
  "agentic-coding",