@ordewell/core 0.6.3 → 0.6.4

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.mjs CHANGED
@@ -2345,7 +2345,10 @@ var WRAPPER_FAMILY = {
2345
2345
  // The multi-call binary ships its own `rm`, `mv` and `sh`, so the refused
2346
2346
  // name arrives as its first argument.
2347
2347
  busybox: { booleanFlags: ["--list", "--install", ...HELP_FLAGS] },
2348
- command: { booleanFlags: ["-p"], noExecFlags: ["-v", "-V"] }
2348
+ command: { booleanFlags: ["-p"], noExecFlags: ["-v", "-V"] },
2349
+ // Runs the named shell builtin, so `builtin eval …` is an `eval`. Classified
2350
+ // on its own name it only asked, and a grant for `builtin echo` covered it.
2351
+ builtin: {}
2349
2352
  };
2350
2353
  var XARGS_SPEC = {
2351
2354
  valueFlags: [
@@ -3075,6 +3078,9 @@ function refusalFor(seg) {
3075
3078
  if (seg.binary === "source" || seg.binary === ".") {
3076
3079
  return `"${seg.binary}" runs a file's contents as commands, which this classifier cannot inspect. Use the read-only research tools, or describe it as a task.`;
3077
3080
  }
3081
+ if (seg.binary === "enable" && seg.args.some((a) => /^-[a-zA-Z]*f/.test(a))) {
3082
+ return `"enable -f" loads a shared library into the shell, which runs its code. Use the read-only research tools, or describe it as a task.`;
3083
+ }
3078
3084
  if (SHELL_KEYWORDS.includes(seg.binary)) {
3079
3085
  return `"${seg.binary}" is a shell keyword or compound-command opener. This classifier only inspects the command that runs first, and a keyword hides the real one from it. Run the inner command directly, or describe it as a task.`;
3080
3086
  }
@@ -3185,6 +3191,9 @@ function classifyCommand(command, opts = {}) {
3185
3191
  }
3186
3192
  const nonAuto = unwrapped.filter((u) => u.runner !== void 0 || !isAuto(u.seg, opts));
3187
3193
  if (nonAuto.length === 0) return { tier: "auto", scope: "" };
3194
+ if (nonAuto.some((u) => u.seg.binary === "cd" || u.seg.binary !== "command" && SHELL_STATE_COMMANDS.has(u.seg.binary))) {
3195
+ return { tier: "ask", scope: trimmed };
3196
+ }
3188
3197
  const scope = [...new Set(nonAuto.map((u) => u.runner ? `${u.runner} ${scopeFor(u.seg)}` : scopeFor(u.seg)))].sort().join(" + ");
3189
3198
  return { tier: "ask", scope };
3190
3199
  }