@workit-dev/opencode 1.1.7 → 1.2.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.
@@ -16,21 +16,20 @@ description: Build a requested change in small verified steps - follow local pat
16
16
  judged? Cite the plan with `--ref <path>` or record the decision; don't re-judge.
17
17
  3. Small steps that each leave the tree green. Behavior change: write the
18
18
  acceptance as Given/When/Then and see a test fail first (call the skill tool with `workit-bdd`).
19
- Mechanical change: the existing checks are enough. No tautological tests:
20
- a test must fail if the behavior breaks, never restate the implementation.
19
+ Mechanical change: the existing checks are enough. A codemod or schematic
20
+ goes one area at a time: run it on one directory, `workit check`, commit
21
+ that directory, then the next; never loop it over all areas. No tautological tests: a test must fail if the behavior breaks, never restate the implementation.
21
22
  4. Run the real checks, local-first: the targeted test or check for the file
22
23
  you touched while you work, then the full configured set once at the end
23
- (`workit check test`, plus `lint` and `typecheck` when the repo has them),
24
- not after every edit. Heavy work runs under one machine-wide lease: an ad-hoc
25
- suite is `workit check --heavy -- <cmd>`, never a hand-made flock; a busy
26
- lease waits and names its holder (`workit lock status`). A tool warning is a finding: fix it in this PR in the right layer, or record the false positive with evidence; pre-existing ones get their own PR.
24
+ (`workit check test`, plus `lint` and `typecheck` when the repo has them).
25
+ Heavy work runs under one machine-wide lease: an ad-hoc suite is `workit check --heavy -- <cmd>`, never a hand-made flock; a busy
26
+ lease waits and names its holder (`workit lock status`). A tool warning is a finding: fix it in this PR, or record the false positive with evidence; pre-existing ones get their own PR.
27
27
  5. Prove the feature on its real surface with the project's `verify-<app>`
28
- skill; none yet? Write one (call the skill tool with `workit-verify-app`). Tests show branch behavior,
29
- not that the feature works. The report carries what you observed: a UI
28
+ skill; none yet? Write one (call the skill tool with `workit-verify-app`). The report carries what you observed: a UI
30
29
  change a screenshot or console/network check (chrome devtools or
31
30
  agent-browser), an API a quoted real response. App not runnable? Say so
32
31
  plainly, never claim success.
33
- 6. Commit: `workit git commit -m "<type>: <what>" -- <paths>` (or `--all`); Co-Authored-By goes in with `--trailer "Co-Authored-By: <name> <email>"`. Host note: a Workit worktree (`workit fanout worktree create`) takes `workit git --cwd <worktree> …`; a Claude Code host-isolated one (`.claude/worktrees/agent-<id>`) takes plain git (its SubagentStart text: isolation refuses a git wrapper). One file holding two changes: stage one change's hunks with `workit git stage --patch <file>` (a `git diff -- <file>` cut to them), then `workit git commit -m "<msg>" --staged` (exactly the index); a path staged in part commits only its staged hunks (`--whole` takes the file).
32
+ 6. Commit: `workit git commit -m "<type>: <what>" -- <paths>`; Co-Authored-By goes in with `--trailer "Co-Authored-By: <name> <email>"`. Host note: a Workit worktree (`workit fanout worktree create`) takes `workit git --cwd <worktree> …`; a Claude Code host-isolated one (`.claude/worktrees/agent-<id>`) takes plain git. One file holding two changes: stage one change's hunks with `workit git stage --patch <file>` (a `git diff -- <file>` cut to them), then `workit git commit -m "<msg>" --staged` (exactly the index); a path staged in part commits only its staged hunks (`--whole` takes the file).
34
33
  No endpoint named? Stop here and state the next command. Hand delivery to
35
34
  ship, which pushes and opens the PR with its body shape (call the skill tool with `workit-ship`), only
36
35
  when that was requested, or the request implies delivery and the effective
@@ -48,7 +47,7 @@ description: Build a requested change in small verified steps - follow local pat
48
47
 
49
48
  Independent slices that could run in parallel: fan them out (call the skill tool with `workit-fanout`).
50
49
  One `implementer` slice: `workit fanout worktree create <slice>` before spawning,
51
- then `workit fanout brief <slice>`; no host isolation (Workit's hooks confine it).
50
+ then `workit fanout brief <slice>`; no host isolation.
52
51
 
53
52
  Stay inline by default (workspace `delegation: inline-first`). Hand work off
54
53
  only past the thresholds: an explorer after about 3 tool calls or 10k tokens
package/dist/plugin.js CHANGED
@@ -25259,7 +25259,7 @@ function heavyGate(cwd, command, options) {
25259
25259
  }
25260
25260
  }
25261
25261
  // packages/workit-core/src/hooks/write-gate.ts
25262
- import { existsSync as existsSync11, realpathSync as realpathSync8 } from "node:fs";
25262
+ import { existsSync as existsSync11, realpathSync as realpathSync8, statSync as statSync4 } from "node:fs";
25263
25263
  import os9 from "node:os";
25264
25264
  import path38 from "node:path";
25265
25265
 
@@ -25663,12 +25663,81 @@ var opaqueWrites = (input, scriptOf = (index) => input[index]) => {
25663
25663
  })
25664
25664
  ];
25665
25665
  };
25666
+ if (name === "curl")
25667
+ return curlOutputs(args);
25666
25668
  if (name === "perl")
25667
25669
  return inline(/^-[a-zA-Z]*[eE]$/);
25668
25670
  if (/^(?:python[\d.]*|node|bun|deno|ruby|php)$/.test(name))
25669
25671
  return inline(/^-[a-zA-Z]*[ce]$|^--eval$|^-p$/);
25670
25672
  return shellScript2(words) === null ? null : ["."];
25671
25673
  };
25674
+ var CURL_LONG = [
25675
+ "output",
25676
+ "output-dir",
25677
+ "cookie-jar",
25678
+ "dump-header",
25679
+ "trace",
25680
+ "trace-ascii",
25681
+ "stderr",
25682
+ "libcurl",
25683
+ "hsts",
25684
+ "alt-svc",
25685
+ "etag-save",
25686
+ "config",
25687
+ "write-out",
25688
+ "remote-name",
25689
+ "remote-name-all"
25690
+ ];
25691
+ var CURL_SHORT_LONG = {
25692
+ o: "output",
25693
+ c: "cookie-jar",
25694
+ D: "dump-header",
25695
+ K: "config",
25696
+ w: "write-out"
25697
+ };
25698
+ var CURL_SHORT = /^-([^-AbcCdDeEFHKmoPQrtTuUwxXyYz]*)(?:([AbcCdDeEFHKmoPQrtTuUwxXyYz])(.*))?$/s;
25699
+ var curlOutputs = (args) => {
25700
+ const files = [];
25701
+ const named = [];
25702
+ const dirs = [];
25703
+ let remote = false;
25704
+ for (let index = 0;index < args.length; index++) {
25705
+ const long = /^--([\w.-]+)(?:=(.*))?$/s.exec(args[index]);
25706
+ const short = long ? null : CURL_SHORT.exec(args[index]);
25707
+ if (short?.[1].includes("O"))
25708
+ remote = true;
25709
+ const option = long ? long[1] === "cookie" ? undefined : CURL_LONG.find((name) => name === long[1]) ?? CURL_LONG.find((name) => name.startsWith(long[1])) : CURL_SHORT_LONG[short?.[2] ?? ""];
25710
+ if (option?.startsWith("remote-name"))
25711
+ remote = true;
25712
+ if (option === undefined || option.startsWith("remote-name")) {
25713
+ if (short?.[2] && !short[3])
25714
+ index++;
25715
+ continue;
25716
+ }
25717
+ const value = (long ? long[2] : short?.[3]) || args[++index];
25718
+ if (option === "config" || option === "write-out" && value?.startsWith("@"))
25719
+ files.push(unknownVarTarget(`curl ${option === "config" ? "-K <config>" : "-w @<format>"}`));
25720
+ else if (value === undefined || value === "-")
25721
+ continue;
25722
+ else if (option === "output")
25723
+ named.push(value);
25724
+ else if (option === "output-dir")
25725
+ dirs.push(value);
25726
+ else if (option === "write-out")
25727
+ for (const match of value.matchAll(/%output\{(?:>>)?([^}]*)\}/g))
25728
+ files.push(match[1]);
25729
+ else
25730
+ files.push(value);
25731
+ }
25732
+ for (const name of named) {
25733
+ if (dirs.length === 0 || /^[/~$]|^[A-Za-z]:[\\/]/.test(name))
25734
+ files.push(name);
25735
+ files.push(...dirs.map((dir) => `${dir}/${name}`));
25736
+ }
25737
+ if (remote)
25738
+ files.push(...dirs.length ? dirs : ["."]);
25739
+ return files.length > 0 ? files : null;
25740
+ };
25672
25741
  var pathsIn = (text) => [
25673
25742
  ...text.matchAll(/(?<![\w.~:/$-])(?:~\/|\/|[A-Za-z]:\/|\.\.(?:\/|$))[^\s'"`$),;:*?<>|\\[\]{}]*/g)
25674
25743
  ].map((match) => match[0]);
@@ -25771,6 +25840,7 @@ var MUTATING_GIT = new Set([
25771
25840
  var DRY_N = new Set(["add", "clean", "rm", "mv"]);
25772
25841
  var MUTATING_WORKIT_GIT = new Set(["commit", "branch", "stage", "unstage"]);
25773
25842
  var DIR_TARGET = ".workit-live-target";
25843
+ var OPAQUE_TARGET = ".workit-runs-";
25774
25844
  var OVERRIDE = "WORKIT_LIVE_SESSION=override";
25775
25845
  var inert = (args, sub) => args.some((arg) => arg === "--help" || arg === "-h" || arg === "--dry-run" || DRY_N.has(sub) && /^-[a-zA-Z]*n[a-zA-Z]*$/.test(arg) && !arg.startsWith("--"));
25776
25846
  var gitMutationDirs = (cwd, command, dialect) => {
@@ -25900,6 +25970,10 @@ var untrustedVars = (segments) => {
25900
25970
  depth = Math.max(0, depth - 1);
25901
25971
  }
25902
25972
  const words = segment.words.slice(start);
25973
+ const at = words.findIndex((word) => !/^\w+=/.test(word));
25974
+ const ifs = (word) => /\bIFS\b/.test(word);
25975
+ if (segment.subs?.some(ifs) || words.some((w, i) => ifs(w) && !(i < at && words[at] === "read")))
25976
+ all = true;
25903
25977
  if (depth > 0)
25904
25978
  for (const [key] of assignmentsOf(words))
25905
25979
  names.add(key);
@@ -25944,7 +26018,10 @@ var unresolvedRefs = (text) => [
25944
26018
  return name === undefined ? match[0] : `$${name}`;
25945
26019
  }))
25946
26020
  ];
25947
- var unknownVarTarget = (text) => path38.join(UNKNOWN_VAR, encodeURIComponent(unresolvedRefs(text).join(" ") || text));
26021
+ var unknownVarTarget = (text) => {
26022
+ const refs = unresolvedRefs(text);
26023
+ return path38.join(UNKNOWN_VAR, (refs.length > 0 ? refs : [text]).map(encodeURIComponent).join("+"));
26024
+ };
25948
26025
  var applyOperator = (value, operator) => {
25949
26026
  if (operator === "")
25950
26027
  return value;
@@ -26040,6 +26117,20 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
26040
26117
  const name = /^\$(\w+)$/.exec(ref)?.[1];
26041
26118
  return name === undefined || new RegExp(`(?<!\\\\)\\$(?:${name}(?!\\w)|\\{${name}\\b)`).test(command);
26042
26119
  };
26120
+ const listWord = (word) => unresolvedRefs(word).length > 0 || /[\s*?[]/.test(word) ? null : word;
26121
+ const listWords = (item) => expansions(item, vars, loops).map((text) => listWord(homeExpanded(text)));
26122
+ const redefined = untrusted.all || Boolean(process.env.CDPATH) || /\bCDPATH\b/.test(command) || segments.some((s, i) => s.words.length > 0 && segments[i + 1]?.group === "open" && segments[i + 2]?.group === "close");
26123
+ const moved = (plain) => {
26124
+ if (plain && !redefined && !untrusted.names.has("PWD") && dir !== undefined && dir !== UNKNOWN_DIR && statSync4(dir, { throwIfNoEntry: false })?.isDirectory())
26125
+ vars.set("PWD", dir);
26126
+ else
26127
+ vars.delete("PWD");
26128
+ };
26129
+ const lost = () => {
26130
+ dir = strict ? UNKNOWN_DIR : undefined;
26131
+ stack = [];
26132
+ moved(false);
26133
+ };
26043
26134
  const assigned = (value) => {
26044
26135
  const made = mktempPath(value, dir);
26045
26136
  if (made !== null)
@@ -26069,10 +26160,10 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
26069
26160
  if (loop >= 0) {
26070
26161
  const [name = "", keyword, ...items] = segment.words.slice(loop + 1);
26071
26162
  const expanding = new Set(segment.expands ?? []);
26072
- const literal = keyword === "in" && items.every((_, index) => !expanding.has(loop + 3 + index));
26163
+ const list = items.flatMap((item, index) => expanding.has(loop + 3 + index) ? listWords(item) : [listWord(homeExpanded(item))]);
26073
26164
  vars.delete(name);
26074
- if (literal && !untrusted.all && !untrusted.names.has(name))
26075
- loops.set(name, items.map(homeExpanded));
26165
+ if (keyword === "in" && list.length <= MAX_EXPANSIONS2 && !list.includes(null) && !untrusted.all && !untrusted.names.has(name))
26166
+ loops.set(name, list);
26076
26167
  else
26077
26168
  loops.delete(name);
26078
26169
  continue;
@@ -26090,31 +26181,53 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
26090
26181
  vars.set(key, resolved);
26091
26182
  }
26092
26183
  }
26184
+ const moving = (word = "") => {
26185
+ const verb = (word.split(/[\\/]/).at(-1) ?? "").toLowerCase();
26186
+ return CD2.has(verb) || PUSHD2.has(verb) || POPD2.has(verb);
26187
+ };
26093
26188
  const name = (words[0]?.split(/[\\/]/).at(-1) ?? "").toLowerCase();
26094
- const moves = CD2.has(name) || PUSHD2.has(name) || POPD2.has(name);
26189
+ const moves = moving(name);
26095
26190
  if (moves && strict && nesting > 0) {
26096
26191
  dir = UNKNOWN_DIR;
26192
+ moved(false);
26097
26193
  continue;
26098
26194
  }
26099
- if (moves && keywords > 0)
26195
+ if (moves && keywords > 0) {
26196
+ moved(false);
26100
26197
  continue;
26198
+ }
26199
+ const wrapper = words.findIndex((word) => !TRANSPARENT.has(word) && !PREFIXES2.has(word));
26200
+ if (wrapper > 0 && moving(words[wrapper])) {
26201
+ lost();
26202
+ continue;
26203
+ }
26204
+ const plain = !segment.conditional;
26101
26205
  if (CD2.has(name)) {
26102
26206
  dir = cdInto(dir, words, strict, vars);
26207
+ moved(plain);
26208
+ continue;
26209
+ }
26210
+ const rotates = words.length < 2 || words.slice(1).some((word) => /^[-+]/.test(word));
26211
+ if (dialect === "posix" && (PUSHD2.has(name) ? rotates : POPD2.has(name) && words.length > 1)) {
26212
+ lost();
26103
26213
  continue;
26104
26214
  }
26105
26215
  if (PUSHD2.has(name)) {
26106
26216
  stack.push(dir);
26107
26217
  dir = cdInto(dir, words, strict, vars);
26218
+ moved(plain);
26108
26219
  continue;
26109
26220
  }
26110
26221
  if (POPD2.has(name)) {
26111
26222
  dir = stack.length ? stack.pop() : strict ? UNKNOWN_DIR : undefined;
26223
+ moved(plain);
26112
26224
  continue;
26113
26225
  }
26114
26226
  const inner = depth < 4 ? wrappedScript(words) ?? (strict ? shellScript2(words) : null) : null;
26227
+ const unPwd = () => new Map([...vars].filter(([key]) => key !== "PWD"));
26115
26228
  if (inner !== null && dir !== undefined)
26116
26229
  for (const runIn of workitRunDir(dir, words, atAll))
26117
- targets.push(...segmentTargets(runIn, inner, "posix", depth + 1, strict, vars));
26230
+ targets.push(...segmentTargets(runIn, inner, "posix", depth + 1, strict, runIn === dir ? vars : unPwd()));
26118
26231
  if (strict && dir !== undefined) {
26119
26232
  const runIn = dir;
26120
26233
  for (const sub of depth < 4 ? segment.subs ?? [] : [])
@@ -26125,13 +26238,18 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
26125
26238
  if (word === undefined || !expanding.has(keywords + index))
26126
26239
  return word;
26127
26240
  const all = expansions(word, vars, loops);
26128
- const open = all.length === 1 ? unresolvedRefs(all[0]).filter(unescaped) : [];
26129
- return all.length === 1 && open.length === 0 ? all[0] : undefined;
26241
+ return all.some((text) => unresolvedRefs(text).some(unescaped)) ? undefined : all.join(`
26242
+ `);
26130
26243
  };
26131
26244
  const opaque = segment.unanalyzable ? ["."] : inner === null ? opaqueWrites(body, scriptOf) : null;
26245
+ const ran = words.findIndex((word) => word === "xargs" || !PREFIXES2.has(word));
26246
+ const runner = words[ran];
26247
+ if (runner !== undefined && expanding.has(keywords + lead + ran) && unresolvedRefs(homeExpanded(runner)).length > 0)
26248
+ targets.push(unknownVarTarget(runner));
26249
+ const here = segment.unanalyzable ? DIR_TARGET : `${OPAQUE_TARGET}${encodeURIComponent(runner?.split(/[\\/]/).at(-1) ?? "a command")}`;
26132
26250
  for (const file of opaque ?? [])
26133
26251
  for (const resolved of atAll(file))
26134
- targets.push(file === "." ? path38.join(resolved, DIR_TARGET) : resolved);
26252
+ targets.push(file === "." ? path38.join(resolved, here) : resolved);
26135
26253
  const ln = words.findIndex((word) => /^ln$/i.test(word.split(/[\\/]/).at(-1) ?? ""));
26136
26254
  if (ln >= 0 && words.slice(0, ln).every((word) => PREFIXES2.has(word)))
26137
26255
  targets.push(...linkSources(words.slice(ln + 1), at));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workit-dev/opencode",
3
- "version": "1.1.7",
3
+ "version": "1.2.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.0.18",
44
- "@workit-dev/core": "^1.1.7"
44
+ "@workit-dev/core": "^1.2.0"
45
45
  },
46
46
  "engines": {
47
47
  "node": ">=24"