@staff0rd/assist 0.166.0 → 0.166.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.
- package/dist/index.js +8 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.166.
|
|
9
|
+
version: "0.166.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -3788,6 +3788,7 @@ var allowCache;
|
|
|
3788
3788
|
var denyCache;
|
|
3789
3789
|
var TOOL_RE = /^(Bash|PowerShell)\((.+?)(:.*)?\)$/;
|
|
3790
3790
|
var SHELL_TOOLS = ["Bash", "PowerShell"];
|
|
3791
|
+
var DOTSLASH_RE = /^\.[\\/]/;
|
|
3791
3792
|
function loadPerms(key) {
|
|
3792
3793
|
return parsePerms(readSettingsPerms(key));
|
|
3793
3794
|
}
|
|
@@ -3797,9 +3798,13 @@ function shellEntries(map, toolName) {
|
|
|
3797
3798
|
}
|
|
3798
3799
|
return map.get(toolName) ?? [];
|
|
3799
3800
|
}
|
|
3801
|
+
function normCmd(cmd) {
|
|
3802
|
+
return cmd.replace(DOTSLASH_RE, "");
|
|
3803
|
+
}
|
|
3800
3804
|
function findMatch(entries, command) {
|
|
3805
|
+
const norm = normCmd(command);
|
|
3801
3806
|
return entries.find(
|
|
3802
|
-
(e) => e.wildcard ?
|
|
3807
|
+
(e) => e.wildcard ? norm === e.command || norm.startsWith(`${e.command} `) : norm === e.command
|
|
3803
3808
|
)?.command;
|
|
3804
3809
|
}
|
|
3805
3810
|
function matchesAllow(toolName, command) {
|
|
@@ -3816,7 +3821,7 @@ function parsePerms(entries) {
|
|
|
3816
3821
|
const m = entry.match(TOOL_RE);
|
|
3817
3822
|
if (m) {
|
|
3818
3823
|
const tool = m[1];
|
|
3819
|
-
const command = m[2];
|
|
3824
|
+
const command = normCmd(m[2]);
|
|
3820
3825
|
const wildcard = m[3] !== void 0;
|
|
3821
3826
|
const list4 = map.get(tool) ?? [];
|
|
3822
3827
|
list4.push({ command, wildcard });
|