devsmind-mcp 2.3.0 → 3.0.0

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 (130) hide show
  1. package/README.md +326 -234
  2. package/dist/cli/activity.d.ts +9 -0
  3. package/dist/cli/activity.js +69 -0
  4. package/dist/cli/activity.js.map +1 -0
  5. package/dist/cli/describe.d.ts +31 -0
  6. package/dist/cli/describe.js +201 -0
  7. package/dist/cli/describe.js.map +1 -0
  8. package/dist/cli/diff.d.ts +14 -0
  9. package/dist/cli/diff.js +161 -0
  10. package/dist/cli/diff.js.map +1 -0
  11. package/dist/cli/embed.d.ts +6 -0
  12. package/dist/cli/embed.js +109 -0
  13. package/dist/cli/embed.js.map +1 -0
  14. package/dist/cli/extract-agent.d.ts +66 -0
  15. package/dist/cli/extract-agent.js +192 -0
  16. package/dist/cli/extract-agent.js.map +1 -0
  17. package/dist/cli/feedback.d.ts +11 -0
  18. package/dist/cli/feedback.js +90 -0
  19. package/dist/cli/feedback.js.map +1 -0
  20. package/dist/cli/index.js +128 -5
  21. package/dist/cli/index.js.map +1 -1
  22. package/dist/cli/init.d.ts +30 -0
  23. package/dist/cli/init.js +98 -18
  24. package/dist/cli/init.js.map +1 -1
  25. package/dist/cli/integrations/memory-topics.d.ts +44 -0
  26. package/dist/cli/integrations/memory-topics.js +295 -0
  27. package/dist/cli/integrations/memory-topics.js.map +1 -0
  28. package/dist/cli/integrations/memory.d.ts +11 -5
  29. package/dist/cli/integrations/memory.js +132 -36
  30. package/dist/cli/integrations/memory.js.map +1 -1
  31. package/dist/cli/integrations/prompt.d.ts +8 -0
  32. package/dist/cli/integrations/prompt.js +24 -3
  33. package/dist/cli/integrations/prompt.js.map +1 -1
  34. package/dist/cli/integrations/registry.d.ts +19 -5
  35. package/dist/cli/integrations/registry.js +23 -13
  36. package/dist/cli/integrations/registry.js.map +1 -1
  37. package/dist/cli/llm-client.d.ts +116 -0
  38. package/dist/cli/llm-client.js +322 -0
  39. package/dist/cli/llm-client.js.map +1 -0
  40. package/dist/cli/prune.js +4 -3
  41. package/dist/cli/prune.js.map +1 -1
  42. package/dist/cli/rule.d.ts +22 -2
  43. package/dist/cli/rule.js +116 -56
  44. package/dist/cli/rule.js.map +1 -1
  45. package/dist/cli/runner.d.ts +21 -0
  46. package/dist/cli/runner.js +94 -276
  47. package/dist/cli/runner.js.map +1 -1
  48. package/dist/cli/sync-progress.d.ts +9 -0
  49. package/dist/cli/sync-progress.js +41 -0
  50. package/dist/cli/sync-progress.js.map +1 -0
  51. package/dist/cli/sync.js +5 -2
  52. package/dist/cli/sync.js.map +1 -1
  53. package/dist/cli/view.js +3 -2
  54. package/dist/cli/view.js.map +1 -1
  55. package/dist/cli/workflow.js +26 -20
  56. package/dist/cli/workflow.js.map +1 -1
  57. package/dist/db/activity.d.ts +200 -0
  58. package/dist/db/activity.js +347 -0
  59. package/dist/db/activity.js.map +1 -0
  60. package/dist/db/analyze.js +25 -9
  61. package/dist/db/analyze.js.map +1 -1
  62. package/dist/db/database.d.ts +607 -79
  63. package/dist/db/database.js +1936 -488
  64. package/dist/db/database.js.map +1 -1
  65. package/dist/db/edges.d.ts +24 -0
  66. package/dist/db/edges.js +84 -0
  67. package/dist/db/edges.js.map +1 -1
  68. package/dist/db/embedder.d.ts +39 -0
  69. package/dist/db/embedder.js +0 -0
  70. package/dist/db/embedder.js.map +1 -0
  71. package/dist/db/feedback.d.ts +128 -0
  72. package/dist/db/feedback.js +182 -0
  73. package/dist/db/feedback.js.map +1 -0
  74. package/dist/db/file-diff.d.ts +32 -0
  75. package/dist/db/file-diff.js +110 -0
  76. package/dist/db/file-diff.js.map +1 -0
  77. package/dist/db/grep.d.ts +78 -0
  78. package/dist/db/grep.js +475 -0
  79. package/dist/db/grep.js.map +1 -0
  80. package/dist/db/message-revert.d.ts +63 -0
  81. package/dist/db/message-revert.js +258 -0
  82. package/dist/db/message-revert.js.map +1 -0
  83. package/dist/db/revert.d.ts +31 -0
  84. package/dist/db/revert.js +108 -0
  85. package/dist/db/revert.js.map +1 -0
  86. package/dist/db/schema.d.ts +49 -4
  87. package/dist/db/schema.js +125 -73
  88. package/dist/db/schema.js.map +1 -1
  89. package/dist/db/search-index.d.ts +65 -0
  90. package/dist/db/search-index.js +74 -0
  91. package/dist/db/search-index.js.map +1 -0
  92. package/dist/db/staging.d.ts +90 -5
  93. package/dist/db/staging.js +148 -22
  94. package/dist/db/staging.js.map +1 -1
  95. package/dist/mcp/server.d.ts +29 -7
  96. package/dist/mcp/server.js +2755 -745
  97. package/dist/mcp/server.js.map +1 -1
  98. package/dist/mcp/vendor/3d-force-graph.min.js +5 -0
  99. package/dist/mcp/vendor/force-graph.min.js +5 -0
  100. package/dist/mcp/vendor/model/model_int8.onnx +0 -0
  101. package/dist/mcp/vendor/model/vocab.txt +30522 -0
  102. package/dist/mcp/vendor/three.min.js +7 -0
  103. package/dist/mcp/view.css +419 -0
  104. package/dist/mcp/view.html +161 -0
  105. package/dist/mcp/view.js +245 -0
  106. package/dist/mcp/view_chat.js +382 -0
  107. package/dist/mcp/view_graph.js +576 -0
  108. package/dist/mcp/visualizer.d.ts +25 -2
  109. package/dist/mcp/visualizer.js +31 -4
  110. package/dist/mcp/visualizer.js.map +1 -1
  111. package/dist/utils/ast.d.ts +187 -0
  112. package/dist/utils/ast.js +640 -20
  113. package/dist/utils/ast.js.map +1 -1
  114. package/dist/utils/diff.d.ts +44 -0
  115. package/dist/utils/diff.js +78 -0
  116. package/dist/utils/diff.js.map +1 -0
  117. package/dist/utils/edit.d.ts +47 -0
  118. package/dist/utils/edit.js +196 -0
  119. package/dist/utils/edit.js.map +1 -0
  120. package/dist/utils/scanner.js +12 -4
  121. package/dist/utils/scanner.js.map +1 -1
  122. package/dist/utils/tokenize.d.ts +45 -0
  123. package/dist/utils/tokenize.js +129 -0
  124. package/dist/utils/tokenize.js.map +1 -0
  125. package/dist/utils/version.d.ts +14 -0
  126. package/dist/utils/version.js +61 -0
  127. package/dist/utils/version.js.map +1 -0
  128. package/package.json +18 -5
  129. package/dist/mcp/visualizer_2d.html +0 -635
  130. package/dist/mcp/visualizer_3d.html +0 -613
@@ -1,3 +1,29 @@
1
+ /**
2
+ * Extensions the TypeScript parser can read, and therefore the only ones where a symbol's exact
3
+ * span is knowable — live code extraction, AST edge resolution, and in-place editing are all
4
+ * limited to these. Every other indexed language falls back to regex reference matching.
5
+ *
6
+ * `.mjs`/`.cjs` are plain JavaScript and parse fine (TS understands both script kinds); they are
7
+ * listed for the same reason `.js` is. Template-based formats (`.vue`, `.svelte`) are NOT here —
8
+ * their files aren't valid JS, so the parser would choke on the markup.
9
+ */
10
+ export declare const AST_PARSEABLE_EXTENSIONS: Set<string>;
11
+ /** True when `filePath` can be parsed for exact symbol spans. */
12
+ export declare function isAstParseable(filePath: string): boolean;
13
+ /**
14
+ * Canonical form for COMPARING two filesystem paths — absolute, forward slashes, lower case.
15
+ *
16
+ * Windows reaches the same file through several spellings (`c:\x` vs `C:/x`), so any exact
17
+ * match against a stored path silently misses unless both sides are folded first. Comparison
18
+ * only: never write this back to disk or store it as a node's file_path.
19
+ */
20
+ export declare function normalizeFsPath(p: string): string;
21
+ /**
22
+ * Drop a file's cached AST. The cache is mtime-keyed, but mtime resolution is coarse enough
23
+ * that a write followed immediately by a read can still be served the pre-write tree, so a
24
+ * writer must invalidate explicitly rather than trust the timestamp to have moved.
25
+ */
26
+ export declare function invalidateParsedFile(filePath: string): void;
1
27
  interface ParsedNodeId {
2
28
  repo: string;
3
29
  filePath: string;
@@ -5,6 +31,12 @@ interface ParsedNodeId {
5
31
  className?: string;
6
32
  memberName?: string;
7
33
  }
34
+ export interface ImportInfo {
35
+ importedName: string;
36
+ moduleSpecifier: string;
37
+ isDefault: boolean;
38
+ isNamespace?: boolean;
39
+ }
8
40
  /** A used reference that resolves to a real repo file but has no node — a Phase-1 gap. */
9
41
  export interface MissingRef {
10
42
  sourceNodeId: string;
@@ -15,6 +47,27 @@ export interface MissingRef {
15
47
  * Parses a DevsMind node ID into constituent parts
16
48
  */
17
49
  export declare function parseNodeId(id: string): ParsedNodeId | null;
50
+ /** One RTK Query endpoint found by {@link detectRtkEndpointAliases} — the endpoint's own declared
51
+ * key, plus the hook names RTK Query's codegen convention derives from it. */
52
+ export interface RtkEndpointAlias {
53
+ /** The endpoint key as written inside `endpoints: (builder) => ({ ... })` — expected to match
54
+ * an existing node's declared name (the extractor names the node after this same key). */
55
+ endpointName: string;
56
+ /** Generated hook names this endpoint is ALSO referenceable by — `useLazy...` only applies to
57
+ * `.query(...)` endpoints (RTK Query never generates a lazy variant for a mutation). */
58
+ aliases: string[];
59
+ }
60
+ export declare function detectRtkEndpointAliases(filePath: string): RtkEndpointAlias[];
61
+ /**
62
+ * The candidate-enumeration counterpart to {@link detectRtkEndpointAliases}: produces full
63
+ * {@link ExtractionCandidate}s for each RTK endpoint, so {@link enumerateFileCandidates} doesn't
64
+ * silently skip them (see {@link findRtkEndpointMatches} for why the general declaration walk
65
+ * can't see them). Always `isExported:true` — an endpoint reached only through its generated hook
66
+ * is, for every practical purpose, part of the file's export surface; nothing about whether it
67
+ * "counts" as a node is a judgment call, so this feeds the SAME auto-accept path as a normal
68
+ * exported declaration.
69
+ */
70
+ export declare function detectRtkEndpointNodes(filePath: string): ExtractionCandidate[];
18
71
  /**
19
72
  * Locally analyzes the source file and resolves references to candidate nodes
20
73
  */
@@ -23,16 +76,150 @@ export declare function resolveConnectionsLocally(sourceNodeId: string, sourceFi
23
76
  name: string;
24
77
  type: string;
25
78
  file_path: string;
79
+ aliases?: string[];
26
80
  }[], devmindPath: string, onMissing?: (rec: MissingRef) => void): string[];
27
81
  /**
28
82
  * Derive a node's identity/type/code directly from its declaration in a file — deterministic,
29
83
  * no LLM. Used by `--fill-missing` to create nodes that Phase-1 extraction skipped. Returns
30
84
  * null when the file isn't TS/JS or the symbol can't be located.
31
85
  */
86
+ /** A symbol's exact span in its file — everything needed to splice it in place. */
87
+ export interface NodeLocation {
88
+ name: string;
89
+ type: string;
90
+ signature: string | null;
91
+ codeSnapshot: string;
92
+ /** Offset of the symbol's first token. Excludes leading JSDoc/comments, so they survive a replace. */
93
+ start: number;
94
+ /** Offset just past the symbol's last token. */
95
+ end: number;
96
+ /** 1-based line of `start`. */
97
+ startLine: number;
98
+ /** 1-based line of `end`. */
99
+ endLine: number;
100
+ /** Whitespace `start` is indented by, or '' when the symbol doesn't begin its line. */
101
+ indent: string;
102
+ }
103
+ /**
104
+ * Locate a symbol's span in a file via the AST. This is the write-side counterpart to
105
+ * `extractNodeFromFile`: same lookup, but it also surfaces the offsets, so a caller can
106
+ * replace the symbol without the caller ever having to read the file or reproduce its
107
+ * text byte-exactly.
108
+ */
109
+ export declare function locateNodeInFile(filePath: string, symbolName: string): NodeLocation | null;
32
110
  export declare function extractNodeFromFile(filePath: string, symbolName: string): {
33
111
  name: string;
34
112
  type: string;
35
113
  signature: string | null;
36
114
  codeSnapshot: string;
37
115
  } | null;
116
+ /** A symbol an edit landed inside — what actually changed, derived from where the write went. */
117
+ export interface TouchedSymbol {
118
+ /** Set only when the edit fell inside a symbol the graph already knows. */
119
+ node_id?: string;
120
+ /** Qualified symbol name, e.g. "Cart.applyPromo" or "calculateTax". */
121
+ symbolName: string;
122
+ name: string;
123
+ type: string;
124
+ signature: string | null;
125
+ codeSnapshot: string;
126
+ /**
127
+ * The symbol's text before this edit, or null when there is nothing to compare against —
128
+ * a brand-new symbol, or a caller that passed no before-content. Feeds the diff/revert path.
129
+ */
130
+ codeBefore: string | null;
131
+ startLine: number;
132
+ endLine: number;
133
+ /** True when no existing node covered this edit — a symbol that did not exist before. */
134
+ isNew: boolean;
135
+ }
136
+ /** One deterministically-enumerated candidate entity from {@link enumerateFileCandidates}. */
137
+ export interface ExtractionCandidate {
138
+ /** Graph node-id name — `Class.method` for a member, a bare name at top level. */
139
+ qualified: string;
140
+ name: string;
141
+ type: string;
142
+ signature: string | null;
143
+ codeSnapshot: string;
144
+ startLine: number;
145
+ endLine: number;
146
+ /** See {@link isNodeExported} — the auto-accept signal. */
147
+ isExported: boolean;
148
+ }
149
+ /**
150
+ * Enumerates every graph-eligible declaration in a file, deterministically — no LLM, so nothing
151
+ * gets silently missed the way the old whole-file-to-an-LLM extraction could. A named, EXPORTED
152
+ * declaration (`isExported:true`) is unambiguous: whether it "counts" as a node requires no
153
+ * judgment, so the caller can auto-accept it with zero LLM turns. Everything else — unexported
154
+ * helpers, anonymous default exports, tiny inline callbacks, object-literal factory members whose
155
+ * significance is genuinely a judgment call — is still enumerated (nothing is dropped silently)
156
+ * but flagged `isExported:false`, so an agentic curation pass only has to spend turns on THOSE.
157
+ */
158
+ export declare function enumerateFileCandidates(filePath: string): ExtractionCandidate[];
159
+ /** One entry in {@link outlineFile}'s "what else is declared in this file" list. Deliberately
160
+ * lean — no `codeSnapshot` — see the function doc for why. */
161
+ export interface FileOutlineEntry {
162
+ qualified: string;
163
+ name: string;
164
+ type: string;
165
+ signature: string | null;
166
+ start_line: number;
167
+ end_line: number;
168
+ exported: boolean;
169
+ }
170
+ /**
171
+ * Every OTHER top-level declaration in a file — functions, classes, consts, types, interfaces —
172
+ * the "what else is here" a raw file read used to be the only way to answer. Reuses
173
+ * {@link enumerateFileCandidates}'s own declaration walk (`declarationsOverlapping` /
174
+ * `astBaseType` / `isNodeExported`), but deliberately does NOT call `node.getText()` per hit the
175
+ * way that function does: `enumerateFileCandidates` materializes each declaration's FULL source
176
+ * just to build a one-line signature and then discards it, which is an extra copy of potentially
177
+ * the whole file in string allocations — on every single `get_node_code` call, this is squarely
178
+ * the wrong trade. A short slice of the already-loaded full text plus a line split gets the same
179
+ * signature far cheaper. The parse itself is free either way: `getSourceFile` is mtime-cached
180
+ * ({@link getSourceFile}), and by the time `get_node_code` calls this the file has usually already
181
+ * been parsed once this same request via `getLiveCode`/`extractLiveCode`.
182
+ */
183
+ export declare function outlineFile(filePath: string): FileOutlineEntry[];
184
+ /**
185
+ * A file's own import list — file-path entry point for {@link getFileImports} (which needs an
186
+ * already-parsed `ts.SourceFile`). Used by the Phase D curation agent's `get_file_imports` tool:
187
+ * whether an ambiguous candidate is worth keeping is often decided by whether it's ever imported
188
+ * anywhere, and the file's OWN imports are the cheap first signal (e.g. a candidate that mirrors
189
+ * a re-exported name, or that only makes sense alongside a specific imported dependency).
190
+ */
191
+ export declare function listFileImports(filePath: string): ImportInfo[];
192
+ /**
193
+ * Work out which symbols an edit actually changed, from where the edit landed.
194
+ *
195
+ * Position beats name matching: a span is unambiguous where a name is not (fifty classes can
196
+ * each have a `run`), it survives the symbol being renamed by the very edit being traced, and
197
+ * it finds code that did not exist until this write.
198
+ *
199
+ * Three passes, each removing a specific kind of wrong answer:
200
+ * 1. OVERLAP — every declaration intersecting the written span. A point would not do: text
201
+ * appended after an anchor (`}` → `}\n\nfunction added() {}`) begins inside the PREVIOUS
202
+ * function, so a point attributes the new function to its neighbour.
203
+ * 2. INNERMOST — drop any declaration that contains another hit, so inserting a method
204
+ * reports the method and not its whole class.
205
+ * 3. CHANGED — compare each survivor against `beforeContent` and keep only what actually
206
+ * differs. Overlap alone over-reports: the anchor's own function is intersected by an
207
+ * append yet is untouched by it, and re-recording it would invent history for a change
208
+ * that never happened. A symbol absent from `beforeContent` is new.
209
+ *
210
+ * Symbols already in the graph are matched by span against their RECORDED ids, never by
211
+ * re-deriving a name — a container name may have been chosen at index time and be absent from
212
+ * the source (`Component({...})` recorded as `ProductImageGalleryComponent`).
213
+ *
214
+ * `knownSymbols` should be the graph's nodes for this file; empty is fine, everything is then
215
+ * reported as new. An edit touching no symbol at all (an import, markup, a config value) yields
216
+ * nothing — a normal outcome, not an error.
217
+ */
218
+ export declare function findTouchedSymbols(filePath: string, ranges: {
219
+ start: number;
220
+ end: number;
221
+ }[], knownSymbols?: {
222
+ id: string;
223
+ symbolName: string;
224
+ }[], beforeContent?: string): TouchedSymbol[];
38
225
  export {};