@wrongstack/tools 0.5.3 → 0.5.5

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
@@ -849,12 +849,13 @@ var editTool = {
849
849
  if (!ctx.hasRead(absPath)) {
850
850
  throw new Error(`edit: file "${input.path}" was not read in this session. Read it first.`);
851
851
  }
852
- const lastReadMtime = ctx.lastReadMtime(absPath);
852
+ const original = await fs9.readFile(absPath, "utf8");
853
+ const updated = await fs9.stat(absPath);
853
854
  const mtimeTolerance = process.platform === "win32" ? 2e3 : 1;
854
- if (lastReadMtime !== void 0 && stat9.mtimeMs > lastReadMtime + mtimeTolerance) {
855
+ const lastReadMtime = ctx.lastReadMtime(absPath);
856
+ if (lastReadMtime !== void 0 && updated.mtimeMs > lastReadMtime + mtimeTolerance) {
855
857
  throw new Error(`edit: file "${input.path}" was modified externally. Re-read it first.`);
856
858
  }
857
- const original = await fs9.readFile(absPath, "utf8");
858
859
  const style = detectNewlineStyle(original);
859
860
  const fileLf = normalizeToLf(original);
860
861
  const oldLf = normalizeToLf(input.old_string);
@@ -888,8 +889,7 @@ var editTool = {
888
889
  }
889
890
  const newFileLf = input.replace_all ? fileLf.split(oldLf).join(newLf) : fileLf.replace(oldLf, newLf);
890
891
  const newFile = toStyle(newFileLf, style);
891
- await atomicWrite(absPath, newFile, { mode: stat9.mode & 511 });
892
- const updated = await fs9.stat(absPath);
892
+ await atomicWrite(absPath, newFile, { mode: updated.mode & 511 });
893
893
  ctx.recordRead(absPath, updated.mtimeMs);
894
894
  ctx.session.recordFileChange({
895
895
  path: absPath,
@@ -934,8 +934,8 @@ function findSimilarity(haystack, needle) {
934
934
  }
935
935
  var ALLOWED_COMMANDS = {
936
936
  node: ["--version", "-r", "--input-type=module"],
937
- npm: ["--version", "init", "install", "test", "list", "pkg", "doctor"],
938
- pnpm: ["--version", "init", "install", "add", "remove", "list"],
937
+ npm: ["--version", "list", "pkg", "doctor", "view", "outdated", "audit"],
938
+ pnpm: ["--version", "remove", "list", "view", "outdated", "audit"],
939
939
  npx: ["--version"],
940
940
  git: [
941
941
  "--version",
@@ -963,7 +963,7 @@ var ALLOWED_COMMANDS = {
963
963
  mv: [],
964
964
  rm: ["-rf"],
965
965
  touch: [],
966
- bun: ["--version", "add", "init"],
966
+ bun: ["--version"],
967
967
  tsc: ["--version", "--noEmit", "--project"],
968
968
  vitest: ["--version", "run", "--coverage"],
969
969
  biome: ["--version", "lint", "format", "check"],
@@ -971,7 +971,7 @@ var ALLOWED_COMMANDS = {
971
971
  rustc: ["--version"],
972
972
  go: ["version", "run", "build", "test"],
973
973
  python: ["--version"],
974
- pip: ["--version", "install", "list"],
974
+ pip: ["--version", "list"],
975
975
  docker: ["--version", "ps", "images"],
976
976
  kubectl: ["version", "get", "describe", "logs"]
977
977
  };
@@ -3127,7 +3127,12 @@ async function globNative(pattern, base, extraGlob) {
3127
3127
  for (const e of entries) {
3128
3128
  if (DEFAULT_IGNORE3.includes(e.name)) continue;
3129
3129
  const full = path.join(dir, e.name);
3130
- if (e.isSymbolicLink()) continue;
3130
+ try {
3131
+ const stat9 = await fs9.lstat(full);
3132
+ if (stat9.isSymbolicLink()) continue;
3133
+ } catch {
3134
+ continue;
3135
+ }
3131
3136
  if (e.isDirectory()) {
3132
3137
  await walk(full);
3133
3138
  } else if (e.isFile()) {
@@ -4003,7 +4008,11 @@ var DEFAULT_IGNORE4 = [
4003
4008
  "build",
4004
4009
  ".next",
4005
4010
  "coverage",
4006
- "__pycache__"
4011
+ "__pycache__",
4012
+ ".wrongstack",
4013
+ ".ssh",
4014
+ ".gnupg",
4015
+ ".aws"
4007
4016
  ];
4008
4017
  var treeTool = {
4009
4018
  name: "tree",