@remnic/coding-graph 9.3.759

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 (86) hide show
  1. package/README.md +130 -0
  2. package/dist/chunk-5I2DBHOQ.js +1042 -0
  3. package/dist/chunk-5I2DBHOQ.js.map +1 -0
  4. package/dist/chunk-CPYJACC5.js +1838 -0
  5. package/dist/chunk-CPYJACC5.js.map +1 -0
  6. package/dist/chunk-ZVCMIM4T.js +216 -0
  7. package/dist/chunk-ZVCMIM4T.js.map +1 -0
  8. package/dist/cypher/query-parser.d.ts +253 -0
  9. package/dist/cypher/query-parser.js +17 -0
  10. package/dist/cypher/query-parser.js.map +1 -0
  11. package/dist/graph-schema.d.ts +84 -0
  12. package/dist/graph-schema.js +17 -0
  13. package/dist/graph-schema.js.map +1 -0
  14. package/dist/graph-store.d.ts +938 -0
  15. package/dist/graph-store.js +16 -0
  16. package/dist/graph-store.js.map +1 -0
  17. package/dist/index.d.ts +1953 -0
  18. package/dist/index.js +3509 -0
  19. package/dist/index.js.map +1 -0
  20. package/grammars/tree-sitter-bash.wasm +0 -0
  21. package/grammars/tree-sitter-c.wasm +0 -0
  22. package/grammars/tree-sitter-c_sharp.wasm +0 -0
  23. package/grammars/tree-sitter-cpp.wasm +0 -0
  24. package/grammars/tree-sitter-go.wasm +0 -0
  25. package/grammars/tree-sitter-java.wasm +0 -0
  26. package/grammars/tree-sitter-javascript.wasm +0 -0
  27. package/grammars/tree-sitter-kotlin.wasm +0 -0
  28. package/grammars/tree-sitter-php.wasm +0 -0
  29. package/grammars/tree-sitter-python.wasm +0 -0
  30. package/grammars/tree-sitter-ruby.wasm +0 -0
  31. package/grammars/tree-sitter-rust.wasm +0 -0
  32. package/grammars/tree-sitter-swift.wasm +0 -0
  33. package/grammars/tree-sitter-tsx.wasm +0 -0
  34. package/grammars/tree-sitter-typescript.wasm +0 -0
  35. package/package.json +79 -0
  36. package/src/co-change.test.ts +175 -0
  37. package/src/co-change.ts +167 -0
  38. package/src/cypher/query-parser.test.ts +1107 -0
  39. package/src/cypher/query-parser.ts +1692 -0
  40. package/src/detect-changes.test.ts +533 -0
  41. package/src/detect-changes.ts +367 -0
  42. package/src/engine/emit.ts +556 -0
  43. package/src/engine/engine.test.ts +1417 -0
  44. package/src/engine/engine.ts +182 -0
  45. package/src/engine/extractors.ts +486 -0
  46. package/src/engine/fixtures.ts +364 -0
  47. package/src/engine/language-sniff.ts +56 -0
  48. package/src/engine/parser-backend.ts +206 -0
  49. package/src/engine/utf16-offsets.ts +68 -0
  50. package/src/git-invoker.test.ts +116 -0
  51. package/src/git-invoker.ts +426 -0
  52. package/src/graph-schema.test.ts +541 -0
  53. package/src/graph-schema.ts +383 -0
  54. package/src/graph-store-pr2.test.ts +1879 -0
  55. package/src/graph-store.test.ts +1420 -0
  56. package/src/graph-store.ts +3489 -0
  57. package/src/index-status.test.ts +303 -0
  58. package/src/index-status.ts +135 -0
  59. package/src/index.ts +384 -0
  60. package/src/lsp/byte-position.ts +173 -0
  61. package/src/lsp/characterization.test.ts +174 -0
  62. package/src/lsp/client.test.ts +275 -0
  63. package/src/lsp/client.ts +484 -0
  64. package/src/lsp/config.ts +219 -0
  65. package/src/lsp/degradation.ts +86 -0
  66. package/src/lsp/fixtures/fake-server.mjs +198 -0
  67. package/src/lsp/framing.test.ts +180 -0
  68. package/src/lsp/framing.ts +177 -0
  69. package/src/lsp/resolution.test.ts +497 -0
  70. package/src/lsp/resolution.ts +483 -0
  71. package/src/lsp/status.ts +140 -0
  72. package/src/lsp/types.ts +167 -0
  73. package/src/reindex.test.ts +1038 -0
  74. package/src/reindex.ts +908 -0
  75. package/src/row-types.ts +45 -0
  76. package/src/semantic/canonical-text.test.ts +150 -0
  77. package/src/semantic/canonical-text.ts +219 -0
  78. package/src/semantic/config.ts +235 -0
  79. package/src/semantic/index.ts +78 -0
  80. package/src/semantic/minhash.test.ts +197 -0
  81. package/src/semantic/minhash.ts +261 -0
  82. package/src/semantic/semantic-query.ts +173 -0
  83. package/src/semantic/semantic.test.ts +1315 -0
  84. package/src/semantic/similarity.ts +268 -0
  85. package/src/semantic/types.ts +145 -0
  86. package/src/semantic/vectors.ts +235 -0
@@ -0,0 +1,167 @@
1
+ /**
2
+ * Minimal LSP protocol types — only the subset the resolution pass needs.
3
+ *
4
+ * These are NOT a full LSP type system. They mirror the wire shapes from
5
+ * the LSP specification (v3.17 — https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/)
6
+ * for the methods we implement: initialize, initialized, shutdown, exit,
7
+ * textDocument/didOpen, textDocument/definition.
8
+ *
9
+ * Keeping a local subset avoids pulling in `vscode-languageserver-protocol`
10
+ * (a dependency the issue explicitly rejects — "No npm LSP framework").
11
+ */
12
+
13
+ // ──────────────────────────────────────────────────────────────────────────
14
+ // Position / Range / Location (LSP 3.17 §3.17–3.18)
15
+ // ──────────────────────────────────────────────────────────────────────────
16
+
17
+ /**
18
+ * LSP Position — zero-based line and character offsets (LSP 3.17 §3.17).
19
+ * `character` is a UTF-16 code-unit offset, matching what tree-sitter
20
+ * byte offsets are converted FROM during the location→node mapping.
21
+ */
22
+ export interface LspPosition {
23
+ readonly line: number;
24
+ readonly character: number;
25
+ }
26
+
27
+ /**
28
+ * LSP Range — half-open `[start, end)` (LSP 3.17 §3.18).
29
+ * Matches the coding-graph's half-open byte-span convention (rule 35).
30
+ */
31
+ export interface LspRange {
32
+ readonly start: LspPosition;
33
+ readonly end: LspPosition;
34
+ }
35
+
36
+ /**
37
+ * LSP Location — a URI + Range (LSP 3.17 §3.19).
38
+ * The resolution pass maps these back to graph nodes by file + span
39
+ * containment.
40
+ */
41
+ export interface LspLocation {
42
+ readonly uri: string;
43
+ readonly range: LspRange;
44
+ }
45
+
46
+ // ──────────────────────────────────────────────────────────────────────────
47
+ // textDocument identifiers (LSP 3.17 §3.16, §3.17)
48
+ // ──────────────────────────────────────────────────────────────────────────
49
+
50
+ /**
51
+ * LSP TextDocumentIdentifier — a URI identifying a document (LSP 3.17 §3.16).
52
+ */
53
+ export interface LspTextDocumentIdentifier {
54
+ readonly uri: string;
55
+ }
56
+
57
+ /**
58
+ * LSP TextDocumentItem — the full open-document payload for didOpen
59
+ * (LSP 3.17 §3.17). Carries the file content so the server can analyze
60
+ * without reading from disk.
61
+ */
62
+ export interface LspTextDocumentItem {
63
+ readonly uri: string;
64
+ readonly languageId: string;
65
+ /** Schema version — we always send 1. */
66
+ readonly version: number;
67
+ readonly text: string;
68
+ }
69
+
70
+ /**
71
+ * LSP TextDocumentPositionParams — the request payload for definition
72
+ * (LSP 3.17 §3.18).
73
+ */
74
+ export interface LspTextDocumentPositionParams {
75
+ readonly textDocument: LspTextDocumentIdentifier;
76
+ readonly position: LspPosition;
77
+ }
78
+
79
+ // ──────────────────────────────────────────────────────────────────────────
80
+ // Initialize (LSP 3.17 §3.16 — Initialize Request)
81
+ // ──────────────────────────────────────────────────────────────────────────
82
+
83
+ /**
84
+ * Client capabilities — we send an empty object because the resolution
85
+ * pass uses no client-side features. The server still needs the field
86
+ * present per the spec.
87
+ */
88
+ export interface LspClientCapabilities {
89
+ // Intentionally empty — minimal client.
90
+ }
91
+
92
+ /**
93
+ * Initialize params sent by the client (LSP 3.17 §3.17).
94
+ * `processId` is our PID so a server can track us; `rootUri` is the
95
+ * workspace root for multi-file definition resolution.
96
+ */
97
+ export interface LspInitializeParams {
98
+ readonly processId: number | null;
99
+ readonly rootUri: string | null;
100
+ readonly capabilities: LspClientCapabilities;
101
+ }
102
+
103
+ /**
104
+ * Server capabilities — the subset we inspect. `definitionProvider`
105
+ * must be truthy for the resolution pass to work.
106
+ */
107
+ export interface LspServerCapabilities {
108
+ readonly definitionProvider?: boolean | object;
109
+ readonly referencesProvider?: boolean | object;
110
+ }
111
+
112
+ /**
113
+ * Initialize result returned by the server (LSP 3.17 §3.17).
114
+ */
115
+ export interface LspInitializeResult {
116
+ readonly capabilities: LspServerCapabilities;
117
+ readonly serverInfo?: { readonly name?: string; readonly version?: string };
118
+ }
119
+
120
+ // ──────────────────────────────────────────────────────────────────────────
121
+ // JSON-RPC envelope (JSON-RPC 2.0 — LSP transport layer)
122
+ // ──────────────────────────────────────────────────────────────────────────
123
+
124
+ /**
125
+ * JSON-RPC 2.0 request/notification envelope.
126
+ * `id` is present for requests (expects a response), absent for
127
+ * notifications (fire-and-forget).
128
+ */
129
+ export interface JsonRpcRequest {
130
+ readonly jsonrpc: "2.0";
131
+ readonly id?: number | string;
132
+ readonly method: string;
133
+ readonly params?: unknown;
134
+ }
135
+
136
+ /**
137
+ * JSON-RPC 2.0 success response.
138
+ */
139
+ export interface JsonRpcResponseSuccess {
140
+ readonly jsonrpc: "2.0";
141
+ readonly id: number | string;
142
+ readonly result: unknown;
143
+ }
144
+
145
+ /**
146
+ * JSON-RPC 2.0 error response.
147
+ */
148
+ export interface JsonRpcResponseError {
149
+ readonly jsonrpc: "2.0";
150
+ readonly id: number | string;
151
+ readonly error: {
152
+ readonly code: number;
153
+ readonly message: string;
154
+ readonly data?: unknown;
155
+ };
156
+ }
157
+
158
+ export type JsonRpcResponse = JsonRpcResponseSuccess | JsonRpcResponseError;
159
+
160
+ /**
161
+ * Type guard — distinguish a success response from an error response.
162
+ */
163
+ export function isResponseError(
164
+ msg: JsonRpcResponse,
165
+ ): msg is JsonRpcResponseError {
166
+ return "error" in msg && msg.error !== undefined;
167
+ }