@mars167/git-ai 2.3.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 (122) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +364 -0
  3. package/README.zh-CN.md +361 -0
  4. package/assets/hooks/post-checkout +28 -0
  5. package/assets/hooks/post-merge +28 -0
  6. package/assets/hooks/pre-commit +17 -0
  7. package/assets/hooks/pre-push +29 -0
  8. package/dist/bin/git-ai.js +62 -0
  9. package/dist/src/commands/ai.js +30 -0
  10. package/dist/src/commands/checkIndex.js +19 -0
  11. package/dist/src/commands/dsr.js +156 -0
  12. package/dist/src/commands/graph.js +203 -0
  13. package/dist/src/commands/hooks.js +125 -0
  14. package/dist/src/commands/index.js +92 -0
  15. package/dist/src/commands/pack.js +31 -0
  16. package/dist/src/commands/query.js +139 -0
  17. package/dist/src/commands/semantic.js +134 -0
  18. package/dist/src/commands/serve.js +14 -0
  19. package/dist/src/commands/status.js +78 -0
  20. package/dist/src/commands/trae.js +75 -0
  21. package/dist/src/commands/unpack.js +28 -0
  22. package/dist/src/core/archive.js +91 -0
  23. package/dist/src/core/astGraph.js +127 -0
  24. package/dist/src/core/astGraphQuery.js +142 -0
  25. package/dist/src/core/cozo.js +266 -0
  26. package/dist/src/core/cpg/astLayer.js +56 -0
  27. package/dist/src/core/cpg/callGraph.js +483 -0
  28. package/dist/src/core/cpg/cfgLayer.js +490 -0
  29. package/dist/src/core/cpg/dfgLayer.js +237 -0
  30. package/dist/src/core/cpg/index.js +80 -0
  31. package/dist/src/core/cpg/types.js +108 -0
  32. package/dist/src/core/crypto.js +10 -0
  33. package/dist/src/core/dsr/generate.js +308 -0
  34. package/dist/src/core/dsr/gitContext.js +74 -0
  35. package/dist/src/core/dsr/indexMaterialize.js +106 -0
  36. package/dist/src/core/dsr/paths.js +26 -0
  37. package/dist/src/core/dsr/query.js +73 -0
  38. package/dist/src/core/dsr/snapshotParser.js +73 -0
  39. package/dist/src/core/dsr/state.js +27 -0
  40. package/dist/src/core/dsr/types.js +2 -0
  41. package/dist/src/core/embedding/fusion.js +52 -0
  42. package/dist/src/core/embedding/index.js +43 -0
  43. package/dist/src/core/embedding/parser.js +14 -0
  44. package/dist/src/core/embedding/semantic.js +254 -0
  45. package/dist/src/core/embedding/structural.js +97 -0
  46. package/dist/src/core/embedding/symbolic.js +117 -0
  47. package/dist/src/core/embedding/tokenizer.js +91 -0
  48. package/dist/src/core/embedding/types.js +2 -0
  49. package/dist/src/core/embedding.js +36 -0
  50. package/dist/src/core/git.js +49 -0
  51. package/dist/src/core/gitDiff.js +73 -0
  52. package/dist/src/core/indexCheck.js +131 -0
  53. package/dist/src/core/indexer.js +185 -0
  54. package/dist/src/core/indexerIncremental.js +303 -0
  55. package/dist/src/core/indexing/config.js +51 -0
  56. package/dist/src/core/indexing/hnsw.js +568 -0
  57. package/dist/src/core/indexing/index.js +17 -0
  58. package/dist/src/core/indexing/monitor.js +82 -0
  59. package/dist/src/core/indexing/parallel.js +252 -0
  60. package/dist/src/core/lancedb.js +111 -0
  61. package/dist/src/core/lfs.js +27 -0
  62. package/dist/src/core/log.js +62 -0
  63. package/dist/src/core/manifest.js +88 -0
  64. package/dist/src/core/parser/adapter.js +2 -0
  65. package/dist/src/core/parser/c.js +93 -0
  66. package/dist/src/core/parser/chunkRelations.js +178 -0
  67. package/dist/src/core/parser/chunker.js +274 -0
  68. package/dist/src/core/parser/go.js +98 -0
  69. package/dist/src/core/parser/java.js +80 -0
  70. package/dist/src/core/parser/markdown.js +76 -0
  71. package/dist/src/core/parser/python.js +81 -0
  72. package/dist/src/core/parser/rust.js +103 -0
  73. package/dist/src/core/parser/typescript.js +98 -0
  74. package/dist/src/core/parser/utils.js +62 -0
  75. package/dist/src/core/parser/yaml.js +53 -0
  76. package/dist/src/core/parser.js +75 -0
  77. package/dist/src/core/paths.js +10 -0
  78. package/dist/src/core/repoMap.js +164 -0
  79. package/dist/src/core/retrieval/cache.js +31 -0
  80. package/dist/src/core/retrieval/classifier.js +74 -0
  81. package/dist/src/core/retrieval/expander.js +80 -0
  82. package/dist/src/core/retrieval/fuser.js +40 -0
  83. package/dist/src/core/retrieval/index.js +32 -0
  84. package/dist/src/core/retrieval/reranker.js +304 -0
  85. package/dist/src/core/retrieval/types.js +2 -0
  86. package/dist/src/core/retrieval/weights.js +42 -0
  87. package/dist/src/core/search.js +41 -0
  88. package/dist/src/core/sq8.js +65 -0
  89. package/dist/src/core/symbolSearch.js +143 -0
  90. package/dist/src/core/types.js +2 -0
  91. package/dist/src/core/workspace.js +116 -0
  92. package/dist/src/mcp/server.js +794 -0
  93. package/docs/README.md +44 -0
  94. package/docs/cross-encoder.md +157 -0
  95. package/docs/embedding.md +158 -0
  96. package/docs/logo.png +0 -0
  97. package/docs/windows-setup.md +67 -0
  98. package/docs/zh-CN/DESIGN.md +102 -0
  99. package/docs/zh-CN/README.md +46 -0
  100. package/docs/zh-CN/advanced.md +26 -0
  101. package/docs/zh-CN/architecture_explained.md +116 -0
  102. package/docs/zh-CN/cli.md +109 -0
  103. package/docs/zh-CN/dsr.md +91 -0
  104. package/docs/zh-CN/graph_scenarios.md +173 -0
  105. package/docs/zh-CN/hooks.md +14 -0
  106. package/docs/zh-CN/manifests.md +136 -0
  107. package/docs/zh-CN/mcp.md +205 -0
  108. package/docs/zh-CN/quickstart.md +35 -0
  109. package/docs/zh-CN/rules.md +7 -0
  110. package/docs/zh-CN/technical-details.md +454 -0
  111. package/docs/zh-CN/troubleshooting.md +19 -0
  112. package/docs/zh-CN/windows-setup.md +67 -0
  113. package/install.sh +183 -0
  114. package/package.json +97 -0
  115. package/skills/git-ai-mcp/SKILL.md +86 -0
  116. package/skills/git-ai-mcp/references/constraints.md +143 -0
  117. package/skills/git-ai-mcp/references/tools.md +263 -0
  118. package/templates/agents/common/documents/Fix EISDIR error and enable multi-language indexing.md +14 -0
  119. package/templates/agents/common/documents/Fix git-ai index error in CodaGraph directory.md +13 -0
  120. package/templates/agents/common/skills/git-ai-mcp/SKILL.md +86 -0
  121. package/templates/agents/common/skills/git-ai-mcp/references/constraints.md +143 -0
  122. package/templates/agents/common/skills/git-ai-mcp/references/tools.md +263 -0
@@ -0,0 +1,263 @@
1
+ # git-ai MCP Tools Reference
2
+
3
+ Complete documentation for all git-ai MCP tools.
4
+
5
+ ## Index Management
6
+
7
+ ### check_index
8
+
9
+ Check if repository index is ready and compatible.
10
+
11
+ ```js
12
+ check_index({ path: "/abs/path/to/repo" })
13
+ ```
14
+
15
+ **Returns:** Index status, compatibility info, and recommendations.
16
+
17
+ **When to use:** Before any search or graph operation.
18
+
19
+ ### rebuild_index
20
+
21
+ Rebuild the repository index from scratch.
22
+
23
+ ```js
24
+ rebuild_index({ path: "/abs/path/to/repo" })
25
+ ```
26
+
27
+ **Parameters:**
28
+ - `path` (required): Absolute path to repository root
29
+ - `overwrite` (optional): Whether to overwrite existing index (default: true)
30
+ - `dim` (optional): Vector dimension (default: 256)
31
+
32
+ **Note:** Can be slow for large repositories. Use when index is missing or incompatible.
33
+
34
+ ### pack_index / unpack_index
35
+
36
+ Package index for storage or distribution.
37
+
38
+ ```js
39
+ pack_index({ path: "/repo", lfs: true }) // Pack with LFS tracking
40
+ unpack_index({ path: "/repo" }) // Restore from archive
41
+ ```
42
+
43
+ ## Search Tools
44
+
45
+ ### repo_map
46
+
47
+ Get a high-level overview of repository structure.
48
+
49
+ ```js
50
+ repo_map({
51
+ path: "/abs/path/to/repo",
52
+ max_files: 20, // Top files by importance
53
+ max_symbols: 5 // Top symbols per file
54
+ })
55
+ ```
56
+
57
+ **When to use:** First contact with a repository, before large changes.
58
+
59
+ ### search_symbols
60
+
61
+ Search for symbols by name pattern.
62
+
63
+ ```js
64
+ search_symbols({
65
+ path: "/repo",
66
+ query: "handleRequest",
67
+ mode: "substring", // substring | prefix | wildcard | regex | fuzzy
68
+ limit: 50,
69
+ case_insensitive: false
70
+ })
71
+ ```
72
+
73
+ **Modes:**
74
+ - `substring`: Match anywhere in name (default)
75
+ - `prefix`: Match start of name
76
+ - `wildcard`: Use `*` and `?` wildcards
77
+ - `regex`: Full regex support
78
+ - `fuzzy`: Typo-tolerant matching
79
+
80
+ ### semantic_search
81
+
82
+ Search code by meaning using vector similarity.
83
+
84
+ ```js
85
+ semantic_search({
86
+ path: "/repo",
87
+ query: "user authentication and session management",
88
+ topk: 10,
89
+ lang: "auto" // auto | all | java | ts
90
+ })
91
+ ```
92
+
93
+ **When to use:** Understanding functional intent, finding conceptually related code.
94
+
95
+ ## AST Graph Tools
96
+
97
+ ### ast_graph_find
98
+
99
+ Find symbols by name prefix in the AST graph.
100
+
101
+ ```js
102
+ ast_graph_find({
103
+ path: "/repo",
104
+ prefix: "handle",
105
+ limit: 50
106
+ })
107
+ ```
108
+
109
+ ### ast_graph_callers
110
+
111
+ Find all functions that call a given function.
112
+
113
+ ```js
114
+ ast_graph_callers({
115
+ path: "/repo",
116
+ name: "authenticateUser",
117
+ limit: 200
118
+ })
119
+ ```
120
+
121
+ **When to use:** Impact analysis before refactoring, understanding usage patterns.
122
+
123
+ ### ast_graph_callees
124
+
125
+ Find all functions called by a given function.
126
+
127
+ ```js
128
+ ast_graph_callees({
129
+ path: "/repo",
130
+ name: "processOrder",
131
+ limit: 200
132
+ })
133
+ ```
134
+
135
+ **When to use:** Understanding implementation details, dependency analysis.
136
+
137
+ ### ast_graph_chain
138
+
139
+ Trace complete call chain in either direction.
140
+
141
+ ```js
142
+ ast_graph_chain({
143
+ path: "/repo",
144
+ name: "handlePayment",
145
+ direction: "downstream", // downstream | upstream
146
+ max_depth: 3,
147
+ limit: 500
148
+ })
149
+ ```
150
+
151
+ **Directions:**
152
+ - `downstream`: What does this function call? (implementation details)
153
+ - `upstream`: Who calls this function? (usage/impact)
154
+
155
+ **When to use:** Complex flow analysis, understanding system architecture.
156
+
157
+ ### ast_graph_children
158
+
159
+ List direct children in AST containment (file → symbols, class → methods).
160
+
161
+ ```js
162
+ ast_graph_children({
163
+ path: "/repo",
164
+ id: "src/auth/service.ts",
165
+ as_file: true // Treat id as file path
166
+ })
167
+ ```
168
+
169
+ ### ast_graph_refs
170
+
171
+ Find all references to a name (calls, new expressions, type references).
172
+
173
+ ```js
174
+ ast_graph_refs({
175
+ path: "/repo",
176
+ name: "UserService",
177
+ limit: 200
178
+ })
179
+ ```
180
+
181
+ ## DSR Tools (Deterministic Semantic Records)
182
+
183
+ ### dsr_context
184
+
185
+ Get repository Git context and DSR directory state.
186
+
187
+ ```js
188
+ dsr_context({ path: "/repo" })
189
+ ```
190
+
191
+ **Returns:** Branch info, commit status, DSR availability.
192
+
193
+ ### dsr_generate
194
+
195
+ Generate DSR for a specific commit.
196
+
197
+ ```js
198
+ dsr_generate({
199
+ path: "/repo",
200
+ commit: "HEAD" // or specific commit hash
201
+ })
202
+ ```
203
+
204
+ **When to use:** Before querying history for commits without DSR.
205
+
206
+ ### dsr_symbol_evolution
207
+
208
+ Track how a symbol changed over time.
209
+
210
+ ```js
211
+ dsr_symbol_evolution({
212
+ path: "/repo",
213
+ symbol: "authenticateUser",
214
+ limit: 50,
215
+ contains: false, // true for substring match
216
+ all: false // true to traverse all refs, not just HEAD
217
+ })
218
+ ```
219
+
220
+ **Returns:** List of changes with:
221
+ - `commit`: Commit hash
222
+ - `operation`: add | modify | delete | rename
223
+ - `risk_level`: low | medium | high
224
+ - `details`: Change description
225
+
226
+ **When to use:** Understanding design evolution, finding when/why something changed.
227
+
228
+ ### dsr_rebuild_index
229
+
230
+ Rebuild DSR index from DSR files.
231
+
232
+ ```js
233
+ dsr_rebuild_index({ path: "/repo" })
234
+ ```
235
+
236
+ ## File Operations
237
+
238
+ ### read_file
239
+
240
+ Read file content with optional line range.
241
+
242
+ ```js
243
+ read_file({
244
+ path: "/repo",
245
+ file: "src/auth/service.ts", // Relative to repo root
246
+ start_line: 1,
247
+ end_line: 200
248
+ })
249
+ ```
250
+
251
+ **Best practice:** Use with `start_line`/`end_line` for large files.
252
+
253
+ ### list_files
254
+
255
+ List repository files by glob pattern.
256
+
257
+ ```js
258
+ list_files({
259
+ path: "/repo",
260
+ pattern: "src/**/*.ts",
261
+ limit: 500
262
+ })
263
+ ```