@bigknoxy/hashpilot 4.6.3 → 4.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigknoxy/hashpilot",
3
- "version": "4.6.3",
3
+ "version": "4.6.5",
4
4
  "description": "HashPilot — Global Tool-Agnostic Structured Editing Core for Coding Agents",
5
5
  "type": "module",
6
6
  "engines": {
@@ -1,9 +1,13 @@
1
- import Parser from "tree-sitter";
2
- import TypeScript from "tree-sitter-typescript";
3
- import Python from "tree-sitter-python";
4
- import JavaScript from "tree-sitter-javascript";
5
- import Go from "tree-sitter-go";
6
- import Rust from "tree-sitter-rust";
1
+ // `tree-sitter` and its per-language grammars are native Node addons with no
2
+ // prebuilt binary for every platform (e.g. linux-arm64 — #145). A *static*
3
+ // top-level `import Parser from "tree-sitter"` runs at module-load time,
4
+ // before any try/catch in this file can run, so on such a platform it used
5
+ // to crash the whole process — even for commands like `--version` that never
6
+ // touch AST at all. `import type` is erased at compile time (no runtime
7
+ // import is emitted), and the actual native modules are `require()`d lazily
8
+ // inside `getParser()`'s try/catch below, so a broken/missing binding
9
+ // degrades to hash/diff routing with a recorded reason instead of a crash.
10
+ import type Parser from "tree-sitter";
7
11
  import { escapeRegex } from "./utils";
8
12
  import { detectModuleSystem } from "./module-system";
9
13
  import { ErrorCode } from "./telemetry";
@@ -45,25 +49,30 @@ const PARSER_ERRORS: Record<string, string> = {};
45
49
  function getParser(lang: string): Parser | null {
46
50
  if (SUPPORTED_LANGUAGES[lang]) return SUPPORTED_LANGUAGES[lang].parser;
47
51
  try {
48
- const p = new Parser();
52
+ // Lazy, synchronous `require()` — not a top-level `import` — so a
53
+ // missing/broken native binding throws here, inside this try/catch,
54
+ // instead of at module load (#145). `getParser` stays synchronous so
55
+ // every existing call site is unaffected.
56
+ const ParserCtor: typeof Parser = require("tree-sitter");
57
+ const p = new ParserCtor();
49
58
  switch (lang) {
50
59
  case "typescript":
51
- p.setLanguage(TypeScript.typescript);
60
+ p.setLanguage(require("tree-sitter-typescript").typescript);
52
61
  break;
53
62
  case "tsx":
54
- p.setLanguage(TypeScript.tsx);
63
+ p.setLanguage(require("tree-sitter-typescript").tsx);
55
64
  break;
56
65
  case "javascript":
57
- p.setLanguage(JavaScript);
66
+ p.setLanguage(require("tree-sitter-javascript"));
58
67
  break;
59
68
  case "python":
60
- p.setLanguage(Python);
69
+ p.setLanguage(require("tree-sitter-python"));
61
70
  break;
62
71
  case "go":
63
- p.setLanguage(Go);
72
+ p.setLanguage(require("tree-sitter-go"));
64
73
  break;
65
74
  case "rust":
66
- p.setLanguage(Rust);
75
+ p.setLanguage(require("tree-sitter-rust"));
67
76
  break;
68
77
  default:
69
78
  return null;
@@ -45,7 +45,8 @@ const RULES: Rule[] = [
45
45
  // that merely contain "key" followed by more name, e.g. `primaryKeyColumn`.
46
46
  {
47
47
  name: "cloud-credential-key",
48
- pattern: /\b([A-Za-z0-9_.-]*(?:account|primary|master|auth|private)[_-]?key["']?\s*[:=]\s*)(["']?)([^\s"',;)}]{20,})\2/gi,
48
+ pattern:
49
+ /\b([A-Za-z0-9_.-]*(?:account|primary|master|auth|private|subscription|storage|encryption|client)[_-]?key["']?\s*[:=]\s*)(["']?)([^\s"',;)}]{20,})\2/gi,
49
50
  replacement: `$1$2${REDACTED}$2`,
50
51
  },
51
52
  ];