@workit-dev/opencode 2.25.3 → 2.25.5
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/plugin.js +49 -15
- package/package.json +2 -2
package/dist/plugin.js
CHANGED
|
@@ -20578,6 +20578,22 @@ var powershellScript = (words, stdin) => {
|
|
|
20578
20578
|
}
|
|
20579
20579
|
return null;
|
|
20580
20580
|
};
|
|
20581
|
+
var powershellOpaque = (words) => {
|
|
20582
|
+
for (let index = 1;index < words.length; index++) {
|
|
20583
|
+
const flag = /^[-/]+(.+)/.exec(words[index])?.[1].toLowerCase();
|
|
20584
|
+
if (flag === undefined)
|
|
20585
|
+
return !/powershell/i.test(words[0]);
|
|
20586
|
+
if (flag === "e" || flag === "ec" || flag.length >= 2 && "encodedcommand".startsWith(flag))
|
|
20587
|
+
return true;
|
|
20588
|
+
if ("command".startsWith(flag) || flag === "cwa" || flag.startsWith("commandwith"))
|
|
20589
|
+
return false;
|
|
20590
|
+
if (flag === "f" || flag === "file")
|
|
20591
|
+
return true;
|
|
20592
|
+
if (POWERSHELL_VALUES.test(`-${flag}`))
|
|
20593
|
+
index++;
|
|
20594
|
+
}
|
|
20595
|
+
return false;
|
|
20596
|
+
};
|
|
20581
20597
|
var cmdScript = (words) => {
|
|
20582
20598
|
const at = words.findIndex((word, index) => index > 0 && /^\/[ck]$/i.test(word));
|
|
20583
20599
|
if (at > 0)
|
|
@@ -27674,11 +27690,17 @@ var editsOf = (input) => {
|
|
|
27674
27690
|
case "cp":
|
|
27675
27691
|
case "ln":
|
|
27676
27692
|
case "install": {
|
|
27677
|
-
const into = valueOf(args, /^(?:-t|--target-directory=?)(.*)$/s);
|
|
27693
|
+
const into = valueOf(args, /^(?:-[a-zA-Z]*t|--target-directory=?)(.*)$/s);
|
|
27678
27694
|
if (into !== undefined)
|
|
27679
27695
|
return [into];
|
|
27680
|
-
const
|
|
27681
|
-
|
|
27696
|
+
const files = operands(args);
|
|
27697
|
+
if (name === "ln" && files.length === 1)
|
|
27698
|
+
return [path42.basename(files[0])];
|
|
27699
|
+
return files.length ? [files.at(-1)] : null;
|
|
27700
|
+
}
|
|
27701
|
+
case "mklink": {
|
|
27702
|
+
const link = args.find((arg) => !/^\/[dhj]$/i.test(arg));
|
|
27703
|
+
return link ? [link] : null;
|
|
27682
27704
|
}
|
|
27683
27705
|
case "dd":
|
|
27684
27706
|
return args.filter((item) => item.startsWith("of=")).map((item) => item.slice(3));
|
|
@@ -27707,10 +27729,15 @@ var editsOf = (input) => {
|
|
|
27707
27729
|
case "del":
|
|
27708
27730
|
case "copy-item":
|
|
27709
27731
|
case "move-item": {
|
|
27710
|
-
const
|
|
27711
|
-
if (
|
|
27712
|
-
return
|
|
27713
|
-
const files =
|
|
27732
|
+
const named = valueOf(args, /^-(?:path|filepath|literalpath|destination)(?::(.+))?$/is);
|
|
27733
|
+
if (named !== undefined || args.some((item) => /^-(?:path|filepath|literalpath|destination)$/i.test(item)))
|
|
27734
|
+
return named ? [named] : null;
|
|
27735
|
+
const files = args.filter((item, at) => !item.startsWith("-") && !/^-(?:itemtype|type|value|target|encoding|name)$/i.test(args[at - 1] ?? ""));
|
|
27736
|
+
if (files.length === 0 && (name === "new-item" || name === "ni")) {
|
|
27737
|
+
const leaf = valueOf(args, /^-name(?::(.+))?$/is);
|
|
27738
|
+
if (leaf)
|
|
27739
|
+
return [leaf];
|
|
27740
|
+
}
|
|
27714
27741
|
if (name === "move-item")
|
|
27715
27742
|
return files.length ? files : null;
|
|
27716
27743
|
const file = name === "copy-item" ? files.at(-1) : files[0];
|
|
@@ -27968,7 +27995,8 @@ var shellScript2 = (words) => {
|
|
|
27968
27995
|
}
|
|
27969
27996
|
return null;
|
|
27970
27997
|
};
|
|
27971
|
-
var
|
|
27998
|
+
var CMD_VAR = /%[^%\s]+%|![^!\s]+!/;
|
|
27999
|
+
var XARGS_VALUE = /^-[InLPdsEa]$/;
|
|
27972
28000
|
var runsWriter = (words) => {
|
|
27973
28001
|
const filled = [
|
|
27974
28002
|
...words.filter((word) => word !== ";" && word !== "+").map((word) => word.includes("{}") ? "eval" : word),
|
|
@@ -27981,13 +28009,17 @@ var opaqueWrites = (input, scriptOf = (index) => input[index], fed, loads = fals
|
|
|
27981
28009
|
const words = pastLead(input);
|
|
27982
28010
|
if (words[0] === "xargs") {
|
|
27983
28011
|
let at = 1;
|
|
27984
|
-
|
|
27985
|
-
|
|
27986
|
-
|
|
28012
|
+
let token = "{}";
|
|
28013
|
+
for (;words[at]?.startsWith("-"); at += XARGS_VALUE.test(words[at]) ? 2 : 1)
|
|
28014
|
+
token = words[at] === "-I" ? words[at + 1] ?? token : /^-[Ii](.+)|^--replace=(.+)/s.exec(words[at])?.slice(1).join("") ?? token;
|
|
28015
|
+
const named = pastLead(words.slice(at))[0] ?? "";
|
|
28016
|
+
return named.includes(token) || named.includes("{}") || runsWriter(words.slice(at)) ? ["."] : null;
|
|
27987
28017
|
}
|
|
27988
28018
|
const [verb, ...args] = words;
|
|
27989
|
-
const name = (verb?.split(/[\\/]/).at(-1) ?? "").toLowerCase();
|
|
27990
|
-
if (/^(?:flock|watch|ssh|parallel|script|su|runuser|strace)$/.test(name))
|
|
28019
|
+
const name = (verb?.split(/[\\/]/).at(-1) ?? "").toLowerCase().replace(/\.exe$/, "");
|
|
28020
|
+
if (/^(?:flock|watch|ssh|parallel|script|su|runuser|strace|iex|invoke-expression)$/.test(name) || (name === "pwsh" || name === "powershell") && powershellOpaque(words))
|
|
28021
|
+
return ["."];
|
|
28022
|
+
if (name === "mklink" && args.some((arg) => CMD_VAR.test(arg)))
|
|
27991
28023
|
return ["."];
|
|
27992
28024
|
const files = operands(args);
|
|
27993
28025
|
const has = (pattern) => args.some((arg) => pattern.test(arg));
|
|
@@ -28261,7 +28293,7 @@ var PATHS = /(?<![\w.~:/$-])(?:~\/|\/|[A-Za-z]:\/|\.\.(?:\/|$))[^\s'"`$),;:*?<>|
|
|
|
28261
28293
|
var pathsIn = (text) => [...text.matchAll(PATHS)].map((match) => match[0]);
|
|
28262
28294
|
var linkSources = (args, at) => {
|
|
28263
28295
|
const names = operands([...args]);
|
|
28264
|
-
const into = args.
|
|
28296
|
+
const into = args.findIndex((arg) => /^-[a-zA-Z]*t$/.test(arg));
|
|
28265
28297
|
const dest = into >= 0 ? args[into + 1] : names.length > 1 ? names.at(-1) : ".";
|
|
28266
28298
|
const sources = names.filter((name, index) => into >= 0 ? name !== dest : index < names.length - 1 || names.length === 1);
|
|
28267
28299
|
const target = dest === undefined ? null : at(dest);
|
|
@@ -28842,8 +28874,10 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
|
|
|
28842
28874
|
targets.push(...segmentTargets(runIn, inner, "posix", depth + 1, strict, runIn === dir ? vars : unPwd()));
|
|
28843
28875
|
const windows = strict && depth < 4 ? windowsScript(words, segment.stdin?.join(`
|
|
28844
28876
|
`)) : null;
|
|
28877
|
+
const cmd = /^cmd(?:\.exe)?$/.test(commandName2(pastLead(words)[0] ?? ""));
|
|
28845
28878
|
if (windows !== null && dir !== undefined)
|
|
28846
|
-
|
|
28879
|
+
for (const file of segmentTargets(dir, windows, "powershell", depth + 1, strict, vars))
|
|
28880
|
+
targets.push(cmd && CMD_VAR.test(file) ? placeholderIn(dir, `${OPAQUE_TARGET}cmd`) : file);
|
|
28847
28881
|
const bare = strict && depth < 4 ? unwrapped(words) : null;
|
|
28848
28882
|
if (bare?.length && dir !== undefined)
|
|
28849
28883
|
targets.push(...segmentTargets(dir, bare.flatMap((word) => expansions(word, vars, loops)).map(quoteWord2).join(" "), "posix", depth + 1, strict, vars));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workit-dev/opencode",
|
|
3
|
-
"version": "2.25.
|
|
3
|
+
"version": "2.25.5",
|
|
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.25.
|
|
44
|
+
"@workit-dev/core": "^2.25.5"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": ">=24"
|