cicada-mcp 0.2.0__py3-none-any.whl → 0.3.0__py3-none-any.whl

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 (62) hide show
  1. cicada/_version_hash.py +4 -0
  2. cicada/cli.py +6 -748
  3. cicada/commands.py +1255 -0
  4. cicada/dead_code/__init__.py +1 -0
  5. cicada/{find_dead_code.py → dead_code/finder.py} +2 -1
  6. cicada/dependency_analyzer.py +147 -0
  7. cicada/entry_utils.py +92 -0
  8. cicada/extractors/base.py +9 -9
  9. cicada/extractors/call.py +17 -20
  10. cicada/extractors/common.py +64 -0
  11. cicada/extractors/dependency.py +117 -235
  12. cicada/extractors/doc.py +2 -49
  13. cicada/extractors/function.py +10 -14
  14. cicada/extractors/keybert.py +228 -0
  15. cicada/extractors/keyword.py +191 -0
  16. cicada/extractors/module.py +6 -10
  17. cicada/extractors/spec.py +8 -56
  18. cicada/format/__init__.py +20 -0
  19. cicada/{ascii_art.py → format/ascii_art.py} +1 -1
  20. cicada/format/formatter.py +1145 -0
  21. cicada/git_helper.py +134 -7
  22. cicada/indexer.py +322 -89
  23. cicada/interactive_setup.py +251 -323
  24. cicada/interactive_setup_helpers.py +302 -0
  25. cicada/keyword_expander.py +437 -0
  26. cicada/keyword_search.py +208 -422
  27. cicada/keyword_test.py +383 -16
  28. cicada/mcp/__init__.py +10 -0
  29. cicada/mcp/entry.py +17 -0
  30. cicada/mcp/filter_utils.py +107 -0
  31. cicada/mcp/pattern_utils.py +118 -0
  32. cicada/{mcp_server.py → mcp/server.py} +819 -73
  33. cicada/mcp/tools.py +473 -0
  34. cicada/pr_finder.py +2 -3
  35. cicada/pr_indexer/indexer.py +3 -2
  36. cicada/setup.py +167 -35
  37. cicada/tier.py +225 -0
  38. cicada/utils/__init__.py +9 -2
  39. cicada/utils/fuzzy_match.py +54 -0
  40. cicada/utils/index_utils.py +9 -0
  41. cicada/utils/path_utils.py +18 -0
  42. cicada/utils/text_utils.py +52 -1
  43. cicada/utils/tree_utils.py +47 -0
  44. cicada/version_check.py +99 -0
  45. cicada/watch_manager.py +320 -0
  46. cicada/watcher.py +431 -0
  47. cicada_mcp-0.3.0.dist-info/METADATA +541 -0
  48. cicada_mcp-0.3.0.dist-info/RECORD +70 -0
  49. cicada_mcp-0.3.0.dist-info/entry_points.txt +4 -0
  50. cicada/formatter.py +0 -864
  51. cicada/keybert_extractor.py +0 -286
  52. cicada/lightweight_keyword_extractor.py +0 -290
  53. cicada/mcp_entry.py +0 -683
  54. cicada/mcp_tools.py +0 -291
  55. cicada_mcp-0.2.0.dist-info/METADATA +0 -735
  56. cicada_mcp-0.2.0.dist-info/RECORD +0 -53
  57. cicada_mcp-0.2.0.dist-info/entry_points.txt +0 -4
  58. /cicada/{dead_code_analyzer.py → dead_code/analyzer.py} +0 -0
  59. /cicada/{colors.py → format/colors.py} +0 -0
  60. {cicada_mcp-0.2.0.dist-info → cicada_mcp-0.3.0.dist-info}/WHEEL +0 -0
  61. {cicada_mcp-0.2.0.dist-info → cicada_mcp-0.3.0.dist-info}/licenses/LICENSE +0 -0
  62. {cicada_mcp-0.2.0.dist-info → cicada_mcp-0.3.0.dist-info}/top_level.txt +0 -0
cicada/mcp_tools.py DELETED
@@ -1,291 +0,0 @@
1
- """
2
- Tool definitions for Cicada MCP Server.
3
-
4
- This module contains all tool schemas that define the interface
5
- for the Cicada MCP server without any implementation logic.
6
- """
7
-
8
- from mcp.types import Tool
9
-
10
-
11
- def get_tool_definitions() -> list[Tool]:
12
- """Return all tool definitions for the Cicada MCP server."""
13
- return [
14
- Tool(
15
- name="search_module",
16
- description=(
17
- "PREFERRED for Elixir: View a module's complete API - functions with arity, signatures, docs, typespecs, and line numbers.\n\n"
18
- "Search by module_name='MyApp.User' or file_path='lib/my_app/user.ex'. "
19
- "Control visibility with private_functions: 'exclude' (default), 'include', or 'only'.\n\n"
20
- "Returns public functions in markdown format by default. Start here when exploring modules."
21
- ),
22
- inputSchema={
23
- "type": "object",
24
- "properties": {
25
- "module_name": {
26
- "type": "string",
27
- "description": "Full module name to search (e.g., 'MyApp.User'). Provide either this or file_path.",
28
- },
29
- "file_path": {
30
- "type": "string",
31
- "description": "Path to an Elixir file (e.g., 'lib/my_app/user.ex'). Provide either this or module_name.",
32
- },
33
- "format": {
34
- "type": "string",
35
- "description": "Output format: 'markdown' (default) or 'json'",
36
- "enum": ["markdown", "json"],
37
- "default": "markdown",
38
- },
39
- "private_functions": {
40
- "type": "string",
41
- "description": "How to handle private functions: 'exclude' (default, hide private functions), 'include' (show all functions), or 'only' (show only private functions)",
42
- "enum": ["exclude", "include", "only"],
43
- "default": "exclude",
44
- },
45
- },
46
- "required": [],
47
- },
48
- _meta={"anti_pattern": "Searching for module structure"},
49
- ),
50
- Tool(
51
- name="search_function",
52
- description=(
53
- "PREFERRED for Elixir: Find function definitions and call sites across the codebase.\n\n"
54
- "Search formats: 'create_user', 'create_user/2', or 'MyApp.User.create_user'. "
55
- "Returns definition with full signature, docs, typespecs, and call sites (module, function, line number). "
56
- "Set include_usage_examples=true and max_examples=N for code snippets, test_files_only=true for test usage only.\n\n"
57
- "Tip: Start without usage examples for quick overview, then enable for usage patterns."
58
- ),
59
- inputSchema={
60
- "type": "object",
61
- "properties": {
62
- "function_name": {
63
- "type": "string",
64
- "description": "Function name to search. Formats: 'create_user', 'create_user/2' (all modules), or 'MyApp.User.create_user', 'MyApp.User.create_user/2' (specific module)",
65
- },
66
- "format": {
67
- "type": "string",
68
- "description": "Output format: 'markdown' (default) or 'json'",
69
- "enum": ["markdown", "json"],
70
- "default": "markdown",
71
- },
72
- "include_usage_examples": {
73
- "type": "boolean",
74
- "description": "Include actual code lines showing how the function is called (default: false)",
75
- "default": False,
76
- },
77
- "max_examples": {
78
- "type": "integer",
79
- "description": "Maximum number of usage examples to show per function (default: 5)",
80
- "default": 5,
81
- "minimum": 1,
82
- "maximum": 20,
83
- },
84
- "test_files_only": {
85
- "type": "boolean",
86
- "description": "Only show calls from test files (files with 'test' in their path) (default: false)",
87
- "default": False,
88
- },
89
- },
90
- "required": ["function_name"],
91
- },
92
- _meta={"anti_pattern": "Searching for function definitions"},
93
- ),
94
- Tool(
95
- name="search_module_usage",
96
- description=(
97
- "PREFERRED for Elixir: Find all module usage and dependencies for impact analysis.\n\n"
98
- "Provide module_name='MyApp.User' to see aliases, imports, requires, uses, function calls, and line numbers. "
99
- "Essential for understanding scope before refactoring."
100
- ),
101
- inputSchema={
102
- "type": "object",
103
- "properties": {
104
- "module_name": {
105
- "type": "string",
106
- "description": "Full module name to search for usage (e.g., 'MyApp.User')",
107
- },
108
- "format": {
109
- "type": "string",
110
- "description": "Output format: 'markdown' (default) or 'json'",
111
- "enum": ["markdown", "json"],
112
- "default": "markdown",
113
- },
114
- },
115
- "required": ["module_name"],
116
- },
117
- _meta={"anti_pattern": "Searching for module imports/usage"},
118
- ),
119
- Tool(
120
- name="find_pr_for_line",
121
- description=(
122
- "PREFERRED for git history: Discover why code exists and who wrote it.\n\n"
123
- "Provide file_path and line_number to get PR number, title, author, commit SHA, message, date, and PR link. "
124
- "Better than git blame - shows full PR context. Cached for fast lookups."
125
- ),
126
- inputSchema={
127
- "type": "object",
128
- "properties": {
129
- "file_path": {
130
- "type": "string",
131
- "description": "Path to the file (relative to repo root or absolute)",
132
- },
133
- "line_number": {
134
- "type": "integer",
135
- "description": "Line number (1-indexed)",
136
- "minimum": 1,
137
- },
138
- "format": {
139
- "type": "string",
140
- "description": "Output format: 'text' (default), 'json', or 'markdown'",
141
- "enum": ["text", "json", "markdown"],
142
- "default": "text",
143
- },
144
- },
145
- "required": ["file_path", "line_number"],
146
- },
147
- ),
148
- Tool(
149
- name="get_commit_history",
150
- description=(
151
- "PREFERRED for git history: Get commit log for files or functions.\n\n"
152
- "Provide file_path for full history. Add function_name for heuristic search, or start_line/end_line with precise_tracking=True for git log -L. "
153
- "Returns commit SHA, author, date, message. Set show_evolution=True for creation/modification metadata.\n\n"
154
- "Complements find_pr_for_line with full commit history."
155
- ),
156
- inputSchema={
157
- "type": "object",
158
- "properties": {
159
- "file_path": {
160
- "type": "string",
161
- "description": "Path to the file (relative to repo root)",
162
- },
163
- "function_name": {
164
- "type": "string",
165
- "description": "Optional: function name for heuristic search (filters by function name in commits)",
166
- },
167
- "start_line": {
168
- "type": "integer",
169
- "description": "Optional: starting line number of function (for precise tracking)",
170
- "minimum": 1,
171
- },
172
- "end_line": {
173
- "type": "integer",
174
- "description": "Optional: ending line number of function (for precise tracking)",
175
- "minimum": 1,
176
- },
177
- "precise_tracking": {
178
- "type": "boolean",
179
- "description": "Use git log -L for exact line-range tracking (requires start_line and end_line). More accurate than heuristic search. (default: False)",
180
- "default": False,
181
- },
182
- "show_evolution": {
183
- "type": "boolean",
184
- "description": "Include function evolution metadata: creation date, last modified, total modifications (requires start_line and end_line). (default: False)",
185
- "default": False,
186
- },
187
- "max_commits": {
188
- "type": "integer",
189
- "description": "Maximum number of commits to return (default: 10)",
190
- "default": 10,
191
- "minimum": 1,
192
- "maximum": 50,
193
- },
194
- },
195
- "required": ["file_path"],
196
- },
197
- ),
198
- Tool(
199
- name="get_blame",
200
- description=(
201
- "PREFERRED for authorship: Git blame showing who wrote each line.\n\n"
202
- "Provide file_path, start_line, and end_line to see author, email, commit SHA, date, and code content grouped by author/commit."
203
- ),
204
- inputSchema={
205
- "type": "object",
206
- "properties": {
207
- "file_path": {
208
- "type": "string",
209
- "description": "Path to the file (relative to repo root)",
210
- },
211
- "start_line": {
212
- "type": "integer",
213
- "description": "Starting line number of the code section",
214
- "minimum": 1,
215
- },
216
- "end_line": {
217
- "type": "integer",
218
- "description": "Ending line number of the code section",
219
- "minimum": 1,
220
- },
221
- },
222
- "required": ["file_path", "start_line", "end_line"],
223
- },
224
- ),
225
- Tool(
226
- name="get_file_pr_history",
227
- description=(
228
- "Get all PRs that modified a file with descriptions and review comments.\n\n"
229
- "Provide file_path to see PR number, title, URL, body, author, merge status, and review comments (with line numbers). "
230
- "Sorted newest first."
231
- ),
232
- inputSchema={
233
- "type": "object",
234
- "properties": {
235
- "file_path": {
236
- "type": "string",
237
- "description": "Path to the file (relative to repo root or absolute)",
238
- },
239
- },
240
- "required": ["file_path"],
241
- },
242
- ),
243
- Tool(
244
- name="search_by_keywords",
245
- description=(
246
- "Semantic search for code by concept/topic when exact names are unknown.\n\n"
247
- "Supports wildcards: keywords=['create*', 'test_*'] or concepts: keywords=['authentication', 'user']. "
248
- "Returns top 5 results by confidence with matched keywords and location."
249
- ),
250
- inputSchema={
251
- "type": "object",
252
- "properties": {
253
- "keywords": {
254
- "type": "array",
255
- "items": {"type": "string"},
256
- "description": "List of keywords to search for (e.g., ['performance', 'benchmark', 'test'] or ['create*', 'test_*'] for wildcards)",
257
- },
258
- },
259
- "required": ["keywords"],
260
- },
261
- _meta={
262
- "anti_pattern": "Searching for module/function usecase by keyword",
263
- },
264
- ),
265
- Tool(
266
- name="find_dead_code",
267
- description=(
268
- "Find potentially unused public functions with confidence levels.\n\n"
269
- "Returns unused functions grouped by confidence: high (likely dead), medium (possible callbacks), low (possible dynamic calls). "
270
- "Filter with min_confidence='high' (default), 'medium', or 'low'."
271
- ),
272
- inputSchema={
273
- "type": "object",
274
- "properties": {
275
- "min_confidence": {
276
- "type": "string",
277
- "description": "Minimum confidence level: 'high' (default, zero usage + no indicators), 'medium' (zero usage + behaviors/uses), 'low' (all candidates)",
278
- "enum": ["high", "medium", "low"],
279
- "default": "high",
280
- },
281
- "format": {
282
- "type": "string",
283
- "description": "Output format: 'markdown' (default) or 'json'",
284
- "enum": ["markdown", "json"],
285
- "default": "markdown",
286
- },
287
- },
288
- "required": [],
289
- },
290
- ),
291
- ]