@wrongstack/tools 0.3.1 → 0.3.3

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/builtin.js CHANGED
@@ -897,9 +897,9 @@ function findSimilarity(haystack, needle) {
897
897
  return line;
898
898
  }
899
899
  var ALLOWED_COMMANDS = {
900
- node: ["--version", "-e", "-p", "-r", "--input-type=module"],
901
- npm: ["--version", "init", "install", "test", "run", "list", "pkg", "doctor"],
902
- pnpm: ["--version", "init", "install", "add", "remove", "exec", "list", "run", "dlx"],
900
+ node: ["--version", "-r", "--input-type=module"],
901
+ npm: ["--version", "init", "install", "test", "list", "pkg", "doctor"],
902
+ pnpm: ["--version", "init", "install", "add", "remove", "list"],
903
903
  npx: ["--version"],
904
904
  git: [
905
905
  "--version",
@@ -927,7 +927,7 @@ var ALLOWED_COMMANDS = {
927
927
  mv: [],
928
928
  rm: ["-rf"],
929
929
  touch: [],
930
- bun: ["--version", "run", "add", "init"],
930
+ bun: ["--version", "add", "init"],
931
931
  tsc: ["--version", "--noEmit", "--project"],
932
932
  vitest: ["--version", "run", "--coverage"],
933
933
  biome: ["--version", "lint", "format", "check"],
@@ -1322,7 +1322,10 @@ function htmlToMarkdown(html) {
1322
1322
  });
1323
1323
  s = s.replace(/<(strong|b)[^>]*>([\s\S]*?)<\/\1>/gi, "**$2**");
1324
1324
  s = s.replace(/<(em|i)[^>]*>([\s\S]*?)<\/\1>/gi, "*$2*");
1325
- s = s.replace(/<a [^>]*href="([^"]+)"[^>]*>([\s\S]*?)<\/a>/gi, "[$2]($1)");
1325
+ s = s.replace(/<a [^>]*href="([^"]+)"[^>]*>([\s\S]*?)<\/a>/gi, (_m, href, text) => {
1326
+ const safe = /^(https?|ftps?):\/\//i.test(href);
1327
+ return safe ? `[${text}](${href})` : text;
1328
+ });
1326
1329
  s = s.replace(/<pre[^>]*>([\s\S]*?)<\/pre>/gi, (_m, c) => "\n```\n" + stripTags(c) + "\n```\n");
1327
1330
  s = s.replace(/<code[^>]*>([\s\S]*?)<\/code>/gi, "`$1`");
1328
1331
  s = s.replace(/<li[^>]*>([\s\S]*?)<\/li>/gi, "- $1\n");
@@ -1540,11 +1543,11 @@ function buildArgs(input) {
1540
1543
  ...files.length ? ["--", ...files] : []
1541
1544
  ];
1542
1545
  case "branch":
1543
- return input.branch ? ["branch", input.branch] : ["branch"];
1546
+ return input.branch ? ["branch", ...input.branch.startsWith("-") ? [] : [input.branch]] : ["branch"];
1544
1547
  case "checkout":
1545
1548
  return [
1546
1549
  "checkout",
1547
- ...input.branch ? [input.branch] : [],
1550
+ ...input.branch ? ["--", input.branch] : [],
1548
1551
  ...files.length ? ["--", ...files] : []
1549
1552
  ];
1550
1553
  case "stash":