@staff0rd/assist 0.225.0 → 0.226.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/index.js +27 -1
- 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.
|
|
9
|
+
version: "0.226.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -6366,6 +6366,30 @@ function matchesConfigDeny(command) {
|
|
|
6366
6366
|
}
|
|
6367
6367
|
|
|
6368
6368
|
// src/commands/cliHook/resolvePermission.ts
|
|
6369
|
+
var SUBCOMMAND_READS = [
|
|
6370
|
+
{
|
|
6371
|
+
prefix: "assist complexity",
|
|
6372
|
+
subcommands: ["maintainability", "cyclomatic", "halstead"]
|
|
6373
|
+
}
|
|
6374
|
+
];
|
|
6375
|
+
function matchesSubcommandRead(part) {
|
|
6376
|
+
return SUBCOMMAND_READS.find(
|
|
6377
|
+
(rule) => part === rule.prefix || part.startsWith(`${rule.prefix} `)
|
|
6378
|
+
);
|
|
6379
|
+
}
|
|
6380
|
+
function findSubcommandAdvice(parts) {
|
|
6381
|
+
if (parts.length <= 1) return void 0;
|
|
6382
|
+
for (const part of parts) {
|
|
6383
|
+
const rule = matchesSubcommandRead(part);
|
|
6384
|
+
if (rule) {
|
|
6385
|
+
return {
|
|
6386
|
+
permissionDecision: "deny",
|
|
6387
|
+
permissionDecisionReason: `Do not pipe or chain '${rule.prefix}'. Run a focused sub-command directly for targeted output: ${rule.subcommands.map((s) => `${rule.prefix} ${s} <file>`).join(", ")}.`
|
|
6388
|
+
};
|
|
6389
|
+
}
|
|
6390
|
+
}
|
|
6391
|
+
return void 0;
|
|
6392
|
+
}
|
|
6369
6393
|
function findDeny(toolName, parts) {
|
|
6370
6394
|
for (const part of parts) {
|
|
6371
6395
|
const configDeny = matchesConfigDeny(part);
|
|
@@ -6376,6 +6400,8 @@ function findDeny(toolName, parts) {
|
|
|
6376
6400
|
};
|
|
6377
6401
|
}
|
|
6378
6402
|
}
|
|
6403
|
+
const subcommandAdvice = findSubcommandAdvice(parts);
|
|
6404
|
+
if (subcommandAdvice) return subcommandAdvice;
|
|
6379
6405
|
for (const part of parts) {
|
|
6380
6406
|
const denied = matchesDeny(toolName, part);
|
|
6381
6407
|
if (denied) {
|