@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.js CHANGED
@@ -2987,7 +2987,10 @@ var WRAPPER_FAMILY = {
2987
2987
  // The multi-call binary ships its own `rm`, `mv` and `sh`, so the refused
2988
2988
  // name arrives as its first argument.
2989
2989
  busybox: { booleanFlags: ["--list", "--install", ...HELP_FLAGS] },
2990
- command: { booleanFlags: ["-p"], noExecFlags: ["-v", "-V"] }
2990
+ command: { booleanFlags: ["-p"], noExecFlags: ["-v", "-V"] },
2991
+ // Runs the named shell builtin, so `builtin eval …` is an `eval`. Classified
2992
+ // on its own name it only asked, and a grant for `builtin echo` covered it.
2993
+ builtin: {}
2991
2994
  };
2992
2995
  var XARGS_SPEC = {
2993
2996
  valueFlags: [
@@ -3717,6 +3720,9 @@ function refusalFor(seg) {
3717
3720
  if (seg.binary === "source" || seg.binary === ".") {
3718
3721
  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.`;
3719
3722
  }
3723
+ if (seg.binary === "enable" && seg.args.some((a) => /^-[a-zA-Z]*f/.test(a))) {
3724
+ 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.`;
3725
+ }
3720
3726
  if (SHELL_KEYWORDS.includes(seg.binary)) {
3721
3727
  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.`;
3722
3728
  }
@@ -3827,6 +3833,9 @@ function classifyCommand(command, opts = {}) {
3827
3833
  }
3828
3834
  const nonAuto = unwrapped.filter((u) => u.runner !== void 0 || !isAuto(u.seg, opts));
3829
3835
  if (nonAuto.length === 0) return { tier: "auto", scope: "" };
3836
+ if (nonAuto.some((u) => u.seg.binary === "cd" || u.seg.binary !== "command" && SHELL_STATE_COMMANDS.has(u.seg.binary))) {
3837
+ return { tier: "ask", scope: trimmed };
3838
+ }
3830
3839
  const scope = [...new Set(nonAuto.map((u) => u.runner ? `${u.runner} ${scopeFor(u.seg)}` : scopeFor(u.seg)))].sort().join(" + ");
3831
3840
  return { tier: "ask", scope };
3832
3841
  }