@yalehwang/archguard 0.1.7 → 0.1.8

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.
Files changed (143) hide show
  1. package/README.md +33 -23
  2. package/dist/cli/analyze/normalize-to-diagrams.d.ts.map +1 -1
  3. package/dist/cli/analyze/normalize-to-diagrams.js +34 -4
  4. package/dist/cli/analyze/normalize-to-diagrams.js.map +1 -1
  5. package/dist/cli/analyze/run-analysis.d.ts.map +1 -1
  6. package/dist/cli/analyze/run-analysis.js +4 -1
  7. package/dist/cli/analyze/run-analysis.js.map +1 -1
  8. package/dist/cli/commands/mcp.d.ts.map +1 -1
  9. package/dist/cli/commands/mcp.js +2 -6
  10. package/dist/cli/commands/mcp.js.map +1 -1
  11. package/dist/cli/index.js +0 -0
  12. package/dist/cli/mcp/analyze-tool.d.ts +1 -5
  13. package/dist/cli/mcp/analyze-tool.d.ts.map +1 -1
  14. package/dist/cli/mcp/analyze-tool.js +48 -52
  15. package/dist/cli/mcp/analyze-tool.js.map +1 -1
  16. package/dist/cli/mcp/mcp-server.d.ts +4 -4
  17. package/dist/cli/mcp/mcp-server.d.ts.map +1 -1
  18. package/dist/cli/mcp/mcp-server.js +108 -57
  19. package/dist/cli/mcp/mcp-server.js.map +1 -1
  20. package/dist/cli/processors/arch-json-provider.d.ts.map +1 -1
  21. package/dist/cli/processors/arch-json-provider.js +8 -2
  22. package/dist/cli/processors/arch-json-provider.js.map +1 -1
  23. package/dist/cli/processors/diagram-output-router.d.ts.map +1 -1
  24. package/dist/cli/processors/diagram-output-router.js +1 -0
  25. package/dist/cli/processors/diagram-output-router.js.map +1 -1
  26. package/dist/cli/query/engine-loader.js +2 -2
  27. package/dist/cli/query/engine-loader.js.map +1 -1
  28. package/dist/plugins/golang/atlas/index.d.ts.map +1 -1
  29. package/dist/plugins/golang/atlas/index.js +3 -1
  30. package/dist/plugins/golang/atlas/index.js.map +1 -1
  31. package/dist/plugins/golang/atlas/types.d.ts +1 -0
  32. package/dist/plugins/golang/atlas/types.d.ts.map +1 -1
  33. package/dist/plugins/golang/index.d.ts.map +1 -1
  34. package/dist/plugins/golang/index.js +15 -6
  35. package/dist/plugins/golang/index.js.map +1 -1
  36. package/dist/plugins/golang/source-scope.d.ts +7 -0
  37. package/dist/plugins/golang/source-scope.d.ts.map +1 -0
  38. package/dist/plugins/golang/source-scope.js +83 -0
  39. package/dist/plugins/golang/source-scope.js.map +1 -0
  40. package/node_modules/node-addon-api/LICENSE.md +9 -0
  41. package/node_modules/node-addon-api/README.md +95 -0
  42. package/node_modules/node-addon-api/common.gypi +21 -0
  43. package/node_modules/node-addon-api/except.gypi +25 -0
  44. package/node_modules/node-addon-api/index.js +14 -0
  45. package/node_modules/node-addon-api/napi-inl.deprecated.h +186 -0
  46. package/node_modules/node-addon-api/napi-inl.h +7033 -0
  47. package/node_modules/node-addon-api/napi.h +3309 -0
  48. package/node_modules/node-addon-api/node_addon_api.gyp +42 -0
  49. package/node_modules/node-addon-api/node_api.gyp +9 -0
  50. package/node_modules/node-addon-api/noexcept.gypi +26 -0
  51. package/node_modules/node-addon-api/nothing.c +0 -0
  52. package/node_modules/node-addon-api/package-support.json +21 -0
  53. package/node_modules/node-addon-api/package.json +480 -0
  54. package/node_modules/node-addon-api/tools/README.md +73 -0
  55. package/node_modules/node-addon-api/tools/check-napi.js +99 -0
  56. package/node_modules/node-addon-api/tools/clang-format.js +71 -0
  57. package/node_modules/node-addon-api/tools/conversion.js +301 -0
  58. package/node_modules/node-gyp-build/LICENSE +21 -0
  59. package/node_modules/node-gyp-build/README.md +58 -0
  60. package/node_modules/node-gyp-build/SECURITY.md +5 -0
  61. package/node_modules/node-gyp-build/bin.js +84 -0
  62. package/node_modules/node-gyp-build/build-test.js +19 -0
  63. package/node_modules/node-gyp-build/index.js +6 -0
  64. package/node_modules/node-gyp-build/node-gyp-build.js +207 -0
  65. package/node_modules/node-gyp-build/optional.js +7 -0
  66. package/node_modules/node-gyp-build/package.json +43 -0
  67. package/node_modules/tree-sitter/LICENSE +21 -0
  68. package/node_modules/tree-sitter/README.md +128 -0
  69. package/node_modules/tree-sitter/binding.gyp +80 -0
  70. package/node_modules/tree-sitter/index.js +916 -0
  71. package/node_modules/tree-sitter/package.json +76 -0
  72. package/node_modules/tree-sitter/prebuilds/linux-x64/node.napi.glibc.node +0 -0
  73. package/node_modules/tree-sitter/src/addon_data.h +47 -0
  74. package/node_modules/tree-sitter/src/binding.cc +35 -0
  75. package/node_modules/tree-sitter/src/conversions.cc +140 -0
  76. package/node_modules/tree-sitter/src/conversions.h +22 -0
  77. package/node_modules/tree-sitter/src/language.cc +106 -0
  78. package/node_modules/tree-sitter/src/language.h +17 -0
  79. package/node_modules/tree-sitter/src/logger.cc +70 -0
  80. package/node_modules/tree-sitter/src/logger.h +19 -0
  81. package/node_modules/tree-sitter/src/lookaheaditerator.cc +122 -0
  82. package/node_modules/tree-sitter/src/lookaheaditerator.h +33 -0
  83. package/node_modules/tree-sitter/src/node.cc +1088 -0
  84. package/node_modules/tree-sitter/src/node.h +30 -0
  85. package/node_modules/tree-sitter/src/parser.cc +306 -0
  86. package/node_modules/tree-sitter/src/parser.h +35 -0
  87. package/node_modules/tree-sitter/src/query.cc +397 -0
  88. package/node_modules/tree-sitter/src/query.h +40 -0
  89. package/node_modules/tree-sitter/src/tree.cc +316 -0
  90. package/node_modules/tree-sitter/src/tree.h +45 -0
  91. package/node_modules/tree-sitter/src/tree_cursor.cc +213 -0
  92. package/node_modules/tree-sitter/src/tree_cursor.h +52 -0
  93. package/node_modules/tree-sitter/tree-sitter.d.ts +1042 -0
  94. package/node_modules/tree-sitter/vendor/tree-sitter/lib/include/tree_sitter/api.h +1478 -0
  95. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/alloc.c +48 -0
  96. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/alloc.h +41 -0
  97. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/array.h +291 -0
  98. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/atomic.h +68 -0
  99. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/clock.h +146 -0
  100. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/error_costs.h +11 -0
  101. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/get_changed_ranges.c +523 -0
  102. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/get_changed_ranges.h +36 -0
  103. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/host.h +21 -0
  104. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/language.c +293 -0
  105. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/language.h +293 -0
  106. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/length.h +52 -0
  107. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lexer.c +483 -0
  108. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lexer.h +54 -0
  109. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lib.c +12 -0
  110. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/node.c +875 -0
  111. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/parser.c +2293 -0
  112. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/parser.h +286 -0
  113. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/point.h +48 -0
  114. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/portable/endian.h +239 -0
  115. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/query.c +4350 -0
  116. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/reduce_action.h +34 -0
  117. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/reusable_node.h +95 -0
  118. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/stack.c +911 -0
  119. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/stack.h +133 -0
  120. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/subtree.c +1034 -0
  121. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/subtree.h +399 -0
  122. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree.c +170 -0
  123. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree.h +31 -0
  124. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree_cursor.c +717 -0
  125. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree_cursor.h +48 -0
  126. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/ts_assert.h +11 -0
  127. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/ICU_SHA +1 -0
  128. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/LICENSE +414 -0
  129. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/README.md +29 -0
  130. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/ptypes.h +1 -0
  131. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/umachine.h +448 -0
  132. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/urename.h +1 -0
  133. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf.h +1 -0
  134. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf16.h +733 -0
  135. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf8.h +881 -0
  136. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode.h +75 -0
  137. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/stdlib-symbols.txt +24 -0
  138. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/stdlib.c +113 -0
  139. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/wasm-stdlib.h +1314 -0
  140. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm_store.c +1935 -0
  141. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm_store.h +31 -0
  142. package/package.json +8 -2
  143. package/scripts/postinstall-tree-sitter.mjs +28 -0
@@ -0,0 +1,75 @@
1
+ #ifndef TREE_SITTER_UNICODE_H_
2
+ #define TREE_SITTER_UNICODE_H_
3
+
4
+ #ifdef __cplusplus
5
+ extern "C" {
6
+ #endif
7
+
8
+ #include <limits.h>
9
+ #include <stdint.h>
10
+
11
+ #define U_EXPORT
12
+ #define U_EXPORT2
13
+ #include "unicode/utf8.h"
14
+ #include "unicode/utf16.h"
15
+ #include "portable/endian.h"
16
+
17
+ #define U16_NEXT_LE(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
18
+ (c)=le16toh((s)[(i)++]); \
19
+ if(U16_IS_LEAD(c)) { \
20
+ uint16_t __c2; \
21
+ if((i)!=(length) && U16_IS_TRAIL(__c2=(s)[(i)])) { \
22
+ ++(i); \
23
+ (c)=U16_GET_SUPPLEMENTARY((c), __c2); \
24
+ } \
25
+ } \
26
+ } UPRV_BLOCK_MACRO_END
27
+
28
+ #define U16_NEXT_BE(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
29
+ (c)=be16toh((s)[(i)++]); \
30
+ if(U16_IS_LEAD(c)) { \
31
+ uint16_t __c2; \
32
+ if((i)!=(length) && U16_IS_TRAIL(__c2=(s)[(i)])) { \
33
+ ++(i); \
34
+ (c)=U16_GET_SUPPLEMENTARY((c), __c2); \
35
+ } \
36
+ } \
37
+ } UPRV_BLOCK_MACRO_END
38
+
39
+ static const int32_t TS_DECODE_ERROR = U_SENTINEL;
40
+
41
+ static inline uint32_t ts_decode_utf8(
42
+ const uint8_t *string,
43
+ uint32_t length,
44
+ int32_t *code_point
45
+ ) {
46
+ uint32_t i = 0;
47
+ U8_NEXT(string, i, length, *code_point);
48
+ return i;
49
+ }
50
+
51
+ static inline uint32_t ts_decode_utf16_le(
52
+ const uint8_t *string,
53
+ uint32_t length,
54
+ int32_t *code_point
55
+ ) {
56
+ uint32_t i = 0;
57
+ U16_NEXT_LE(((uint16_t *)string), i, length, *code_point);
58
+ return i * 2;
59
+ }
60
+
61
+ static inline uint32_t ts_decode_utf16_be(
62
+ const uint8_t *string,
63
+ uint32_t length,
64
+ int32_t *code_point
65
+ ) {
66
+ uint32_t i = 0;
67
+ U16_NEXT_BE(((uint16_t *)string), i, length, *code_point);
68
+ return i * 2;
69
+ }
70
+
71
+ #ifdef __cplusplus
72
+ }
73
+ #endif
74
+
75
+ #endif // TREE_SITTER_UNICODE_H_
@@ -0,0 +1,24 @@
1
+ "calloc",
2
+ "free",
3
+ "iswalnum",
4
+ "iswalpha",
5
+ "iswblank",
6
+ "iswdigit",
7
+ "iswlower",
8
+ "iswspace",
9
+ "iswupper",
10
+ "iswxdigit",
11
+ "malloc",
12
+ "memchr",
13
+ "memcmp",
14
+ "memcpy",
15
+ "memmove",
16
+ "memset",
17
+ "realloc",
18
+ "strcmp",
19
+ "strlen",
20
+ "strncat",
21
+ "strncmp",
22
+ "strncpy",
23
+ "towlower",
24
+ "towupper",
@@ -0,0 +1,113 @@
1
+ // This file implements a very simple allocator for external scanners running
2
+ // in WASM. Allocation is just bumping a static pointer and growing the heap
3
+ // as needed, and freeing is mostly a noop. But in the special case of freeing
4
+ // the last-allocated pointer, we'll reuse that pointer again.
5
+
6
+ #ifdef TREE_SITTER_FEATURE_WASM
7
+
8
+ #include <stdio.h>
9
+ #include <unistd.h>
10
+ #include <stdlib.h>
11
+ #include <string.h>
12
+
13
+ extern void tree_sitter_debug_message(const char *, size_t);
14
+
15
+ #define PAGESIZE 0x10000
16
+ #define MAX_HEAP_SIZE (4 * 1024 * 1024)
17
+
18
+ typedef struct {
19
+ size_t size;
20
+ char data[0];
21
+ } Region;
22
+
23
+ static Region *heap_end = NULL;
24
+ static Region *heap_start = NULL;
25
+ static Region *next = NULL;
26
+
27
+ // Get the region metadata for the given heap pointer.
28
+ static inline Region *region_for_ptr(void *ptr) {
29
+ return ((Region *)ptr) - 1;
30
+ }
31
+
32
+ // Get the location of the next region after the given region,
33
+ // if the given region had the given size.
34
+ static inline Region *region_after(Region *self, size_t len) {
35
+ char *address = self->data + len;
36
+ char *aligned = (char *)((uintptr_t)(address + 3) & ~0x3);
37
+ return (Region *)aligned;
38
+ }
39
+
40
+ static void *get_heap_end() {
41
+ return (void *)(__builtin_wasm_memory_size(0) * PAGESIZE);
42
+ }
43
+
44
+ static int grow_heap(size_t size) {
45
+ size_t new_page_count = ((size - 1) / PAGESIZE) + 1;
46
+ return __builtin_wasm_memory_grow(0, new_page_count) != SIZE_MAX;
47
+ }
48
+
49
+ // Clear out the heap, and move it to the given address.
50
+ void reset_heap(void *new_heap_start) {
51
+ heap_start = new_heap_start;
52
+ next = new_heap_start;
53
+ heap_end = get_heap_end();
54
+ }
55
+
56
+ void *malloc(size_t size) {
57
+ Region *region_end = region_after(next, size);
58
+
59
+ if (region_end > heap_end) {
60
+ if ((char *)region_end - (char *)heap_start > MAX_HEAP_SIZE) {
61
+ return NULL;
62
+ }
63
+ if (!grow_heap(size)) return NULL;
64
+ heap_end = get_heap_end();
65
+ }
66
+
67
+ void *result = &next->data;
68
+ next->size = size;
69
+ next = region_end;
70
+
71
+ return result;
72
+ }
73
+
74
+ void free(void *ptr) {
75
+ if (ptr == NULL) return;
76
+
77
+ Region *region = region_for_ptr(ptr);
78
+ Region *region_end = region_after(region, region->size);
79
+
80
+ // When freeing the last allocated pointer, re-use that
81
+ // pointer for the next allocation.
82
+ if (region_end == next) {
83
+ next = region;
84
+ }
85
+ }
86
+
87
+ void *calloc(size_t count, size_t size) {
88
+ void *result = malloc(count * size);
89
+ memset(result, 0, count * size);
90
+ return result;
91
+ }
92
+
93
+ void *realloc(void *ptr, size_t new_size) {
94
+ if (ptr == NULL) {
95
+ return malloc(new_size);
96
+ }
97
+
98
+ Region *region = region_for_ptr(ptr);
99
+ Region *region_end = region_after(region, region->size);
100
+
101
+ // When reallocating the last allocated region, return
102
+ // the same pointer, and skip copying the data.
103
+ if (region_end == next) {
104
+ next = region;
105
+ return malloc(new_size);
106
+ }
107
+
108
+ void *result = malloc(new_size);
109
+ memcpy(result, &region->data, region->size);
110
+ return result;
111
+ }
112
+
113
+ #endif