@brainervirus/workit-opencode 8.29.0 → 8.29.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 +11 -6
  2. package/package.json +2 -2
package/dist/plugin.js CHANGED
@@ -17271,17 +17271,22 @@ function workitCheckTail(words) {
17271
17271
  return null;
17272
17272
  return args.slice(0, split).includes("--shell") ? { script: tail.join(" "), cwd } : { argv: tail, cwd };
17273
17273
  }
17274
- function simpleCommand(command, dialect = "posix", depth = 0) {
17274
+ var OUTPUT_FILTERS = new Set(["tail", "head", "grep"]);
17275
+ function simpleCommand(command, dialect = "posix", depth = 0, shaped = false) {
17275
17276
  let segments;
17276
17277
  try {
17277
17278
  segments = segmentsOf(command, dialect);
17278
17279
  } catch {
17279
17280
  return null;
17280
17281
  }
17281
- if (segments.length !== 1)
17282
+ const filter = shaped && segments.length === 2 ? segments[1] : null;
17283
+ if (filter) {
17284
+ if (!segments[0].pipe || !OUTPUT_FILTERS.has(commandName(filter.words[0])) || filter.group || filter.pipe || filter.unanalyzable || filter.subs?.length || filter.stdin?.length)
17285
+ return null;
17286
+ } else if (segments.length !== 1)
17282
17287
  return null;
17283
17288
  const [segment] = segments;
17284
- if (segment.group || segment.pipe || segment.unanalyzable || segment.redirects.length || segment.subs?.length || segment.stdin?.length)
17289
+ if (segment.group || segment.pipe && !filter || segment.unanalyzable || segment.redirects.length && !shaped || segment.subs?.length || segment.stdin?.length)
17285
17290
  return null;
17286
17291
  const { words } = stripPrefixes(segment.words);
17287
17292
  const name = commandName(words[0]);
@@ -22392,7 +22397,7 @@ function heavyPlan(command, options) {
22392
22397
  const heavy = heavyLines(lines, options);
22393
22398
  if (!heavy.length)
22394
22399
  return { kind: "none" };
22395
- const simple = simpleCommand(command, dialect);
22400
+ const simple = simpleCommand(command, dialect, 0, true);
22396
22401
  const single = simple && !WORKIT.test(baseName2(simple[0])) && heavyLines([simple], options)[0];
22397
22402
  const judged = single ? [{ words: lines.flat(), text: command }] : heavy.map((match) => ({
22398
22403
  words: match.line,
@@ -22404,7 +22409,7 @@ function heavyPlan(command, options) {
22404
22409
  if (!verdict.ok)
22405
22410
  return {
22406
22411
  kind: "passthrough",
22407
- note: `workit: \`${command.trim()}\` is heavy but runs outside the heavy-check lease because a host permission rule names it (or \`workit\` is allowlisted); the host decides.`
22412
+ note: ""
22408
22413
  };
22409
22414
  }
22410
22415
  if (single) {
@@ -22414,7 +22419,7 @@ function heavyPlan(command, options) {
22414
22419
  const parts = heavy.map((match) => leaseCommand(match.line));
22415
22420
  return {
22416
22421
  kind: "split",
22417
- reason: `heavy_command: \`${command.trim()}\` chains heavy work (${heavy.map((match) => match.reason).join("; ")}) with other commands, and a chain cannot run under the machine-wide heavy-check lease. Run each heavy part alone as \`workit check --heavy -- <segment>\` (here: ${parts.map((part) => `\`${part}\``).join("; ")}); run the other parts as their own commands.`,
22422
+ reason: `heavy_command: \`${command.trim()}\` chains heavy work (${heavy.map((match) => match.reason).join("; ")}) with other commands, and a chain cannot run under the machine-wide heavy-check lease. Run the heavy part alone, now: \`${parts[0]}\`; then run the other parts as their own commands${parts.length > 1 ? ", each heavy one the same way" : ""}.`,
22418
22423
  unblock: parts[0] ?? null
22419
22424
  };
22420
22425
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainervirus/workit-opencode",
3
- "version": "8.29.0",
3
+ "version": "8.29.1",
4
4
  "private": false,
5
5
  "description": "Workit OpenCode plugin — native tools, adaptive policy, and sixteen method skills",
6
6
  "keywords": [
@@ -39,7 +39,7 @@
39
39
  "typecheck": "tsc --noEmit"
40
40
  },
41
41
  "devDependencies": {
42
- "@brainervirus/workit-core": "^8.29.0",
42
+ "@brainervirus/workit-core": "^8.29.1",
43
43
  "@opencode/plugin": "2.0.18"
44
44
  },
45
45
  "engines": {