skydeckai-code 0.1.29__py3-none-any.whl → 0.1.30__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.
- aidd/tools/__init__.py +3 -0
- aidd/tools/code_tools.py +1 -0
- aidd/tools/file_tools.py +12 -32
- aidd/tools/lint_tools.py +449 -0
- {skydeckai_code-0.1.29.dist-info → skydeckai_code-0.1.30.dist-info}/METADATA +61 -5
- {skydeckai_code-0.1.29.dist-info → skydeckai_code-0.1.30.dist-info}/RECORD +9 -8
- {skydeckai_code-0.1.29.dist-info → skydeckai_code-0.1.30.dist-info}/WHEEL +0 -0
- {skydeckai_code-0.1.29.dist-info → skydeckai_code-0.1.30.dist-info}/entry_points.txt +0 -0
- {skydeckai_code-0.1.29.dist-info → skydeckai_code-0.1.30.dist-info}/licenses/LICENSE +0 -0
aidd/tools/__init__.py
CHANGED
@@ -65,6 +65,7 @@ from .git_tools import (
|
|
65
65
|
handle_git_status,
|
66
66
|
)
|
67
67
|
from .image_tools import read_image_file_tool, handle_read_image_file
|
68
|
+
from .lint_tools import check_lint_tool, handle_check_lint
|
68
69
|
from .other_tools import batch_tools_tool, handle_batch_tools, think_tool, handle_think
|
69
70
|
from .path_tools import (
|
70
71
|
get_allowed_directory_tool,
|
@@ -99,6 +100,7 @@ TOOL_DEFINITIONS = [
|
|
99
100
|
execute_shell_script_tool(),
|
100
101
|
codebase_mapper_tool(),
|
101
102
|
search_code_tool(),
|
103
|
+
check_lint_tool(),
|
102
104
|
batch_tools_tool(),
|
103
105
|
think_tool(),
|
104
106
|
# Git tools
|
@@ -142,6 +144,7 @@ TOOL_HANDLERS = {
|
|
142
144
|
"copy_file": handle_copy_file,
|
143
145
|
"search_files": handle_search_files,
|
144
146
|
"search_code": handle_search_code,
|
147
|
+
"check_lint": handle_check_lint,
|
145
148
|
"delete_file": handle_delete_file,
|
146
149
|
"get_file_info": handle_get_file_info,
|
147
150
|
"directory_tree": handle_directory_tree,
|
aidd/tools/code_tools.py
CHANGED
aidd/tools/file_tools.py
CHANGED
@@ -283,16 +283,6 @@ def edit_file_tool():
|
|
283
283
|
"options": {
|
284
284
|
"type": "object",
|
285
285
|
"properties": {
|
286
|
-
"preserveIndentation": {
|
287
|
-
"type": "boolean",
|
288
|
-
"description": "Keep existing indentation when replacing text. When true, the indentation of the first line of oldText is preserved in newText.",
|
289
|
-
"default": True
|
290
|
-
},
|
291
|
-
"normalizeWhitespace": {
|
292
|
-
"type": "boolean",
|
293
|
-
"description": "Normalize spaces while preserving structure. When true, consecutive spaces are treated as a single space during matching, making the search more forgiving of whitespace differences.",
|
294
|
-
"default": True
|
295
|
-
},
|
296
286
|
"partialMatch": {
|
297
287
|
"type": "boolean",
|
298
288
|
"description": "Enable fuzzy matching for finding text. When true, the tool will try to find the best match even if it's not an exact match, using a confidence threshold of 80%.",
|
@@ -730,21 +720,17 @@ async def handle_delete_file(arguments: dict):
|
|
730
720
|
except Exception as e:
|
731
721
|
raise ValueError(f"Error deleting {path}: {str(e)}")
|
732
722
|
|
733
|
-
def normalize_whitespace(text: str
|
734
|
-
"""Normalize whitespace while
|
723
|
+
def normalize_whitespace(text: str) -> str:
|
724
|
+
"""Normalize whitespace while preserving indentation."""
|
735
725
|
lines = text.splitlines()
|
736
726
|
normalized_lines = []
|
737
727
|
|
738
728
|
for line in lines:
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
normalized_lines.append(f"{indent}{content}")
|
745
|
-
else:
|
746
|
-
# Normalize all whitespace
|
747
|
-
normalized_lines.append(re.sub(r'\s+', ' ', line.strip()))
|
729
|
+
# Preserve leading whitespace
|
730
|
+
indent = re.match(r'^\s*', line).group(0)
|
731
|
+
# Normalize other whitespace
|
732
|
+
content = re.sub(r'\s+', ' ', line.lstrip())
|
733
|
+
normalized_lines.append(f"{indent}{content}")
|
748
734
|
|
749
735
|
return '\n'.join(normalized_lines)
|
750
736
|
|
@@ -813,8 +799,6 @@ async def apply_file_edits(file_path: str, edits: List[dict], dry_run: bool = Fa
|
|
813
799
|
"""Apply edits to a file with optional formatting and return diff."""
|
814
800
|
# Set default options
|
815
801
|
options = options or {}
|
816
|
-
preserve_indentation = options.get('preserveIndentation', True)
|
817
|
-
normalize_ws = options.get('normalizeWhitespace', True)
|
818
802
|
partial_match = options.get('partialMatch', True)
|
819
803
|
|
820
804
|
# Read file content
|
@@ -830,20 +814,16 @@ async def apply_file_edits(file_path: str, edits: List[dict], dry_run: bool = Fa
|
|
830
814
|
old_text = edit['oldText']
|
831
815
|
new_text = edit['newText']
|
832
816
|
|
833
|
-
#
|
834
|
-
|
835
|
-
|
836
|
-
working_content = normalize_whitespace(modified_content, preserve_indentation)
|
837
|
-
else:
|
838
|
-
search_text = old_text
|
839
|
-
working_content = modified_content
|
817
|
+
# Use original text for matching
|
818
|
+
search_text = old_text
|
819
|
+
working_content = modified_content
|
840
820
|
|
841
821
|
# Find best match
|
842
822
|
start, end, confidence = find_best_match(working_content, search_text, partial_match)
|
843
823
|
|
844
824
|
if confidence >= 0.8:
|
845
|
-
#
|
846
|
-
if
|
825
|
+
# Always preserve indentation of first line
|
826
|
+
if start >= 0:
|
847
827
|
indent = re.match(r'^\s*', modified_content[start:].splitlines()[0]).group(0)
|
848
828
|
replacement = '\n'.join(indent + line.lstrip()
|
849
829
|
for line in new_text.splitlines())
|
aidd/tools/lint_tools.py
ADDED
@@ -0,0 +1,449 @@
|
|
1
|
+
import os
|
2
|
+
import re
|
3
|
+
import json
|
4
|
+
import subprocess
|
5
|
+
from typing import List, Dict, Any, Optional
|
6
|
+
|
7
|
+
from mcp.types import TextContent
|
8
|
+
from .state import state
|
9
|
+
|
10
|
+
|
11
|
+
def check_lint_tool():
|
12
|
+
return {
|
13
|
+
"name": "check_lint",
|
14
|
+
"description": "Check the codebase for linting issues using native linting tools. "
|
15
|
+
"WHEN TO USE: When you need to identify coding style issues, potential bugs, or code quality problems. "
|
16
|
+
"Similar to how VSCode reports lint issues in the Problems panel. "
|
17
|
+
"WHEN NOT TO USE: When you need to fix formatting (use appropriate formatters instead), "
|
18
|
+
"when you need detailed code analysis with custom rules, or for compiled languages where linting may not apply. "
|
19
|
+
"RETURNS: A detailed report of linting issues found in the codebase, including file paths, line numbers, "
|
20
|
+
"issue descriptions, and severity levels. Issues are grouped by file and sorted by severity. "
|
21
|
+
"Note: Respects config files like .pylintrc, .flake8, and .eslintrc if present.\n\n"
|
22
|
+
"EXAMPLES:\n"
|
23
|
+
"- Basic usage: {\"path\": \"src\"}\n"
|
24
|
+
"- Python with custom line length: {\"path\": \"src\", \"linters\": {\"flake8\": \"--max-line-length=120 --ignore=E501,E302\"}}\n"
|
25
|
+
"- Disable specific pylint checks: {\"linters\": {\"pylint\": \"--disable=missing-docstring,invalid-name\"}}\n"
|
26
|
+
"- TypeScript only: {\"path\": \"src\", \"languages\": [\"typescript\"], \"linters\": {\"eslint\": \"--no-eslintrc --config .eslintrc.custom.js\"}}\n"
|
27
|
+
"- Disable a linter: {\"linters\": {\"flake8\": false}, \"max_issues\": 50}\n"
|
28
|
+
"- Single file check: {\"path\": \"src/main.py\"}",
|
29
|
+
"inputSchema": {
|
30
|
+
"type": "object",
|
31
|
+
"properties": {
|
32
|
+
"path": {
|
33
|
+
"type": "string",
|
34
|
+
"description": "Directory or file to lint. Can be a specific file or directory to recursively check. "
|
35
|
+
"Examples: '.' for entire codebase, 'src' for just the src directory, 'src/main.py' for a specific file.",
|
36
|
+
"default": "."
|
37
|
+
},
|
38
|
+
"languages": {
|
39
|
+
"type": "array",
|
40
|
+
"items": {
|
41
|
+
"type": "string"
|
42
|
+
},
|
43
|
+
"description": "List of languages to lint. If empty, will auto-detect based on file extensions. "
|
44
|
+
"Supported languages include: 'python', 'javascript', 'typescript'.",
|
45
|
+
"default": []
|
46
|
+
},
|
47
|
+
"linters": {
|
48
|
+
"type": "object",
|
49
|
+
"description": "Configuration for specific linters. Each key is a linter name ('pylint', 'flake8', 'eslint') "
|
50
|
+
"and the value is either a boolean to enable/disable or a string with CLI arguments.",
|
51
|
+
"properties": {
|
52
|
+
"pylint": {
|
53
|
+
"type": ["boolean", "string"],
|
54
|
+
"description": "Whether to use pylint or custom pylint arguments."
|
55
|
+
},
|
56
|
+
"flake8": {
|
57
|
+
"type": ["boolean", "string"],
|
58
|
+
"description": "Whether to use flake8 or custom flake8 arguments."
|
59
|
+
},
|
60
|
+
"eslint": {
|
61
|
+
"type": ["boolean", "string"],
|
62
|
+
"description": "Whether to use eslint or custom eslint arguments."
|
63
|
+
}
|
64
|
+
},
|
65
|
+
"default": {}
|
66
|
+
},
|
67
|
+
"max_issues": {
|
68
|
+
"type": "integer",
|
69
|
+
"description": "Maximum number of linting issues to return. Set to 0 for unlimited.",
|
70
|
+
"default": 100
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
async def handle_check_lint(arguments: dict) -> List[TextContent]:
|
77
|
+
"""Handle linting the codebase and reporting issues using native linting tools."""
|
78
|
+
path = arguments.get("path", ".")
|
79
|
+
languages = arguments.get("languages", [])
|
80
|
+
linters_config = arguments.get("linters", {})
|
81
|
+
max_issues = arguments.get("max_issues", 100)
|
82
|
+
|
83
|
+
# Determine full path
|
84
|
+
if os.path.isabs(path):
|
85
|
+
full_path = os.path.abspath(path)
|
86
|
+
else:
|
87
|
+
full_path = os.path.abspath(os.path.join(state.allowed_directory, path))
|
88
|
+
|
89
|
+
# Security check
|
90
|
+
if not full_path.startswith(state.allowed_directory):
|
91
|
+
raise ValueError(f"Access denied: Path ({full_path}) must be within allowed directory")
|
92
|
+
|
93
|
+
if not os.path.exists(full_path):
|
94
|
+
raise ValueError(f"Path does not exist: {path}")
|
95
|
+
|
96
|
+
# Skip the entire operation if the path looks like a virtual environment or system directory
|
97
|
+
if _is_excluded_system_directory(full_path):
|
98
|
+
return [TextContent(
|
99
|
+
type="text",
|
100
|
+
text="The specified path appears to be a virtual environment, package directory, or system path.\n"
|
101
|
+
"To prevent excessive noise, linting has been skipped for this path.\n"
|
102
|
+
"Please specify a project source directory to lint instead."
|
103
|
+
)]
|
104
|
+
|
105
|
+
# Auto-detect languages if not specified
|
106
|
+
if not languages:
|
107
|
+
if os.path.isfile(full_path):
|
108
|
+
language = _detect_language_from_file(full_path)
|
109
|
+
if language:
|
110
|
+
languages = [language]
|
111
|
+
else:
|
112
|
+
languages = ["python", "javascript", "typescript"] # Default to common languages
|
113
|
+
|
114
|
+
# Prepare linter configurations with defaults
|
115
|
+
linter_defaults = {
|
116
|
+
"python": {
|
117
|
+
"pylint": True,
|
118
|
+
"flake8": True
|
119
|
+
},
|
120
|
+
"javascript": {
|
121
|
+
"eslint": True
|
122
|
+
},
|
123
|
+
"typescript": {
|
124
|
+
"eslint": True
|
125
|
+
}
|
126
|
+
}
|
127
|
+
|
128
|
+
# Process each language
|
129
|
+
all_issues = []
|
130
|
+
|
131
|
+
for language in languages:
|
132
|
+
if language in linter_defaults:
|
133
|
+
# Get default linters for this language
|
134
|
+
default_linters = linter_defaults[language]
|
135
|
+
|
136
|
+
# Override with user configuration
|
137
|
+
for linter_name, default_value in default_linters.items():
|
138
|
+
# Check if the linter is explicitly configured
|
139
|
+
if linter_name in linters_config:
|
140
|
+
linter_setting = linters_config[linter_name]
|
141
|
+
|
142
|
+
# Skip if explicitly disabled
|
143
|
+
if linter_setting is False:
|
144
|
+
continue
|
145
|
+
|
146
|
+
# Run the linter with custom args or defaults
|
147
|
+
issues = await _run_linter(
|
148
|
+
linter_name,
|
149
|
+
full_path,
|
150
|
+
custom_args=linter_setting if isinstance(linter_setting, str) else None
|
151
|
+
)
|
152
|
+
all_issues.extend(issues)
|
153
|
+
elif default_value:
|
154
|
+
# Use default if not explicitly configured
|
155
|
+
issues = await _run_linter(linter_name, full_path)
|
156
|
+
all_issues.extend(issues)
|
157
|
+
|
158
|
+
# Limit total issues if needed
|
159
|
+
if max_issues > 0 and len(all_issues) >= max_issues:
|
160
|
+
all_issues = all_issues[:max_issues]
|
161
|
+
break
|
162
|
+
|
163
|
+
# Format and return results
|
164
|
+
if not all_issues:
|
165
|
+
return [TextContent(
|
166
|
+
type="text",
|
167
|
+
text="No linting issues found."
|
168
|
+
)]
|
169
|
+
|
170
|
+
return [TextContent(
|
171
|
+
type="text",
|
172
|
+
text=_format_lint_results(all_issues)
|
173
|
+
)]
|
174
|
+
|
175
|
+
def _is_excluded_system_directory(path: str) -> bool:
|
176
|
+
"""Check if the path is a system directory or virtual environment that should be excluded from linting."""
|
177
|
+
# Common virtual environment directories
|
178
|
+
venv_indicators = [
|
179
|
+
'venv', '.venv', 'env', '.env', 'virtualenv',
|
180
|
+
'site-packages', 'dist-packages',
|
181
|
+
# Python version-specific directories often in venvs
|
182
|
+
'python3', 'python2', 'python3.', 'lib/python'
|
183
|
+
]
|
184
|
+
|
185
|
+
# System and dependency directories to exclude
|
186
|
+
system_dirs = [
|
187
|
+
'node_modules', 'bower_components',
|
188
|
+
'.git', '.svn',
|
189
|
+
'__pycache__', '.mypy_cache', '.pytest_cache', '.ruff_cache',
|
190
|
+
'.idea', '.vscode'
|
191
|
+
]
|
192
|
+
|
193
|
+
# Check if the path contains any of these indicators
|
194
|
+
path_parts = path.lower().split(os.sep)
|
195
|
+
|
196
|
+
# Check for virtual environment indicators
|
197
|
+
for indicator in venv_indicators:
|
198
|
+
if indicator in path_parts:
|
199
|
+
return True
|
200
|
+
|
201
|
+
# Check for system directories
|
202
|
+
for sys_dir in system_dirs:
|
203
|
+
if sys_dir in path_parts:
|
204
|
+
return True
|
205
|
+
|
206
|
+
return False
|
207
|
+
|
208
|
+
async def _run_linter(linter_name: str, path: str, custom_args: str = None) -> List[Dict[str, Any]]:
|
209
|
+
"""Run a specific linter as a command-line process and parse the results."""
|
210
|
+
issues = []
|
211
|
+
|
212
|
+
# Skip if the path is a system directory
|
213
|
+
if _is_excluded_system_directory(path):
|
214
|
+
return []
|
215
|
+
|
216
|
+
# Handle different linters
|
217
|
+
if linter_name == "pylint":
|
218
|
+
try:
|
219
|
+
# Build the command
|
220
|
+
cmd = ["pylint", "--output-format=json"]
|
221
|
+
|
222
|
+
if custom_args:
|
223
|
+
# Split and add custom arguments
|
224
|
+
cmd.extend(custom_args.split())
|
225
|
+
|
226
|
+
# Add the target path
|
227
|
+
if os.path.isdir(path):
|
228
|
+
# For directories, scan recursively but exclude common directories
|
229
|
+
cmd.extend([
|
230
|
+
"--recursive=y",
|
231
|
+
"--ignore=venv,.venv,env,.env,node_modules,__pycache__,.git,.svn,dist,build,target,.idea,.vscode",
|
232
|
+
])
|
233
|
+
|
234
|
+
cmd.append(path)
|
235
|
+
|
236
|
+
# Run pylint
|
237
|
+
result = subprocess.run(cmd, capture_output=True, text=True)
|
238
|
+
|
239
|
+
if result.stdout.strip():
|
240
|
+
# Parse pylint JSON output
|
241
|
+
try:
|
242
|
+
pylint_issues = json.loads(result.stdout)
|
243
|
+
for issue in pylint_issues:
|
244
|
+
# Extract the file path and ensure it's within the allowed directory
|
245
|
+
file_path = issue.get("path", "")
|
246
|
+
if not os.path.isabs(file_path):
|
247
|
+
file_path = os.path.abspath(os.path.join(os.path.dirname(path), file_path))
|
248
|
+
|
249
|
+
# Security check for file path and exclude system directories
|
250
|
+
if not file_path.startswith(state.allowed_directory) or _is_excluded_system_directory(file_path):
|
251
|
+
continue
|
252
|
+
|
253
|
+
issues.append({
|
254
|
+
"file": os.path.relpath(file_path, state.allowed_directory),
|
255
|
+
"line": issue.get("line", 0),
|
256
|
+
"column": issue.get("column", 0),
|
257
|
+
"message": issue.get("message", ""),
|
258
|
+
"severity": _map_pylint_severity(issue.get("type", "")),
|
259
|
+
"source": "pylint",
|
260
|
+
"code": issue.get("symbol", "")
|
261
|
+
})
|
262
|
+
except (json.JSONDecodeError, ValueError):
|
263
|
+
# If JSON parsing fails, it might be an error message
|
264
|
+
if result.stderr:
|
265
|
+
issues.append({
|
266
|
+
"file": path if os.path.isfile(path) else "",
|
267
|
+
"line": 1,
|
268
|
+
"column": 1,
|
269
|
+
"message": f"Error running pylint: {result.stderr}",
|
270
|
+
"severity": "error",
|
271
|
+
"source": "pylint",
|
272
|
+
"code": "tool-error"
|
273
|
+
})
|
274
|
+
except (subprocess.SubprocessError, FileNotFoundError):
|
275
|
+
# Silently fail if pylint is not installed
|
276
|
+
pass
|
277
|
+
|
278
|
+
elif linter_name == "flake8":
|
279
|
+
try:
|
280
|
+
# Build the command
|
281
|
+
cmd = ["flake8", "--format=default"]
|
282
|
+
|
283
|
+
if custom_args:
|
284
|
+
cmd.extend(custom_args.split())
|
285
|
+
else:
|
286
|
+
# Add default exclusions if no custom args provided
|
287
|
+
cmd.extend(["--exclude=.venv,venv,env,.env,node_modules,__pycache__,.git,.svn,dist,build,target,.idea,.vscode"])
|
288
|
+
|
289
|
+
# Add target path
|
290
|
+
cmd.append(path)
|
291
|
+
|
292
|
+
# Run flake8
|
293
|
+
result = subprocess.run(cmd, capture_output=True, text=True)
|
294
|
+
|
295
|
+
if result.stdout.strip():
|
296
|
+
# Parse flake8 output (file:line:col: code message)
|
297
|
+
flake8_pattern = r"(.+):(\d+):(\d+): ([A-Z]\d+) (.+)"
|
298
|
+
for line in result.stdout.splitlines():
|
299
|
+
match = re.match(flake8_pattern, line)
|
300
|
+
if match:
|
301
|
+
filepath, line_num, col, code, message = match.groups()
|
302
|
+
|
303
|
+
# Ensure path is absolute for security check
|
304
|
+
if not os.path.isabs(filepath):
|
305
|
+
filepath = os.path.abspath(os.path.join(os.path.dirname(path), filepath))
|
306
|
+
|
307
|
+
# Security check for file path and exclude system directories
|
308
|
+
if not filepath.startswith(state.allowed_directory) or _is_excluded_system_directory(filepath):
|
309
|
+
continue
|
310
|
+
|
311
|
+
issues.append({
|
312
|
+
"file": os.path.relpath(filepath, state.allowed_directory),
|
313
|
+
"line": int(line_num),
|
314
|
+
"column": int(col),
|
315
|
+
"message": message,
|
316
|
+
"severity": "warning", # flake8 doesn't provide severity
|
317
|
+
"source": "flake8",
|
318
|
+
"code": code
|
319
|
+
})
|
320
|
+
except (subprocess.SubprocessError, FileNotFoundError):
|
321
|
+
# Silently fail if flake8 is not installed
|
322
|
+
pass
|
323
|
+
|
324
|
+
elif linter_name == "eslint":
|
325
|
+
try:
|
326
|
+
# Build the command
|
327
|
+
cmd = ["npx", "eslint", "--format=json"]
|
328
|
+
|
329
|
+
if custom_args:
|
330
|
+
cmd.extend(custom_args.split())
|
331
|
+
else:
|
332
|
+
# Add default exclusions if no custom args provided
|
333
|
+
cmd.extend(["--ignore-pattern", "**/node_modules/**", "--ignore-pattern", "**/.git/**"])
|
334
|
+
|
335
|
+
# Add target path
|
336
|
+
cmd.append(path)
|
337
|
+
|
338
|
+
# Run ESLint
|
339
|
+
result = subprocess.run(cmd, capture_output=True, text=True)
|
340
|
+
|
341
|
+
if result.stdout.strip():
|
342
|
+
# Parse ESLint JSON output
|
343
|
+
try:
|
344
|
+
eslint_results = json.loads(result.stdout)
|
345
|
+
for file_result in eslint_results:
|
346
|
+
# Get file path and ensure it's absolute
|
347
|
+
file_path = file_result.get("filePath", "")
|
348
|
+
if not os.path.isabs(file_path):
|
349
|
+
file_path = os.path.abspath(os.path.join(os.path.dirname(path), file_path))
|
350
|
+
|
351
|
+
# Security check for file path and exclude system directories
|
352
|
+
if not file_path.startswith(state.allowed_directory) or _is_excluded_system_directory(file_path):
|
353
|
+
continue
|
354
|
+
|
355
|
+
for message in file_result.get("messages", []):
|
356
|
+
issues.append({
|
357
|
+
"file": os.path.relpath(file_path, state.allowed_directory),
|
358
|
+
"line": message.get("line", 0),
|
359
|
+
"column": message.get("column", 0),
|
360
|
+
"message": message.get("message", ""),
|
361
|
+
"severity": _map_eslint_severity(message.get("severity", 1)),
|
362
|
+
"source": "eslint",
|
363
|
+
"code": message.get("ruleId", "")
|
364
|
+
})
|
365
|
+
except json.JSONDecodeError:
|
366
|
+
# Handle parsing errors or ESLint errors
|
367
|
+
if result.stderr:
|
368
|
+
issues.append({
|
369
|
+
"file": path if os.path.isfile(path) else "",
|
370
|
+
"line": 1,
|
371
|
+
"column": 1,
|
372
|
+
"message": f"Error running eslint: {result.stderr}",
|
373
|
+
"severity": "error",
|
374
|
+
"source": "eslint",
|
375
|
+
"code": "tool-error"
|
376
|
+
})
|
377
|
+
except (subprocess.SubprocessError, FileNotFoundError):
|
378
|
+
# Silently fail if eslint is not installed
|
379
|
+
pass
|
380
|
+
|
381
|
+
return issues
|
382
|
+
|
383
|
+
def _detect_language_from_file(file_path: str) -> Optional[str]:
|
384
|
+
"""Detect programming language based on file extension."""
|
385
|
+
ext = os.path.splitext(file_path)[1].lower()
|
386
|
+
|
387
|
+
language_map = {
|
388
|
+
'.py': 'python',
|
389
|
+
'.js': 'javascript',
|
390
|
+
'.ts': 'typescript',
|
391
|
+
'.jsx': 'javascript',
|
392
|
+
'.tsx': 'typescript',
|
393
|
+
}
|
394
|
+
|
395
|
+
return language_map.get(ext)
|
396
|
+
|
397
|
+
def _map_pylint_severity(severity_type: str) -> str:
|
398
|
+
"""Map pylint message types to standard severity levels."""
|
399
|
+
severity_map = {
|
400
|
+
"convention": "hint",
|
401
|
+
"refactor": "info",
|
402
|
+
"warning": "warning",
|
403
|
+
"error": "error",
|
404
|
+
"fatal": "error"
|
405
|
+
}
|
406
|
+
return severity_map.get(severity_type.lower(), "info")
|
407
|
+
|
408
|
+
def _map_eslint_severity(severity: int) -> str:
|
409
|
+
"""Map ESLint severity levels to standard severity levels."""
|
410
|
+
if severity == 2:
|
411
|
+
return "error"
|
412
|
+
elif severity == 1:
|
413
|
+
return "warning"
|
414
|
+
else:
|
415
|
+
return "info"
|
416
|
+
|
417
|
+
def _format_lint_results(issues: List[Dict[str, Any]]) -> str:
|
418
|
+
"""Format linting issues into a readable text output."""
|
419
|
+
if not issues:
|
420
|
+
return "No linting issues found."
|
421
|
+
|
422
|
+
# Group issues by file
|
423
|
+
issues_by_file = {}
|
424
|
+
for issue in issues:
|
425
|
+
file_path = issue["file"]
|
426
|
+
if file_path not in issues_by_file:
|
427
|
+
issues_by_file[file_path] = []
|
428
|
+
issues_by_file[file_path].append(issue)
|
429
|
+
|
430
|
+
# Format the output
|
431
|
+
output_lines = ["Linting issues found:"]
|
432
|
+
|
433
|
+
for file_path, file_issues in issues_by_file.items():
|
434
|
+
# Sort issues by severity (error -> warning -> info -> hint)
|
435
|
+
severity_order = {"error": 0, "warning": 1, "info": 2, "hint": 3}
|
436
|
+
sorted_issues = sorted(file_issues, key=lambda x: (severity_order.get(x["severity"], 4), x["line"]))
|
437
|
+
|
438
|
+
output_lines.append(f"\n{file_path}:")
|
439
|
+
|
440
|
+
for issue in sorted_issues:
|
441
|
+
severity = issue["severity"].upper()
|
442
|
+
line = issue["line"]
|
443
|
+
column = issue["column"]
|
444
|
+
message = issue["message"]
|
445
|
+
code = f"[{issue['code']}]" if issue["code"] else ""
|
446
|
+
|
447
|
+
output_lines.append(f" {severity} Line {line}:{column} {message} {code}")
|
448
|
+
|
449
|
+
return "\n".join(output_lines)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: skydeckai-code
|
3
|
-
Version: 0.1.
|
4
|
-
Summary: This MCP server provides a comprehensive set of tools for AI-driven Development workflows including file operations, code analysis, multi-language execution, Git operations, web content fetching with HTML-to-markdown conversion, multi-engine web search, code content searching, and system information retrieval.
|
3
|
+
Version: 0.1.30
|
4
|
+
Summary: This MCP server provides a comprehensive set of tools for AI-driven Development workflows including file operations, code analysis, code linting, multi-language execution, Git operations, web content fetching with HTML-to-markdown conversion, multi-engine web search, code content searching, and system information retrieval.
|
5
5
|
Project-URL: Homepage, https://github.com/skydeckai/skydeckai-code
|
6
6
|
Project-URL: Repository, https://github.com/skydeckai/skydeckai-code
|
7
7
|
Project-URL: Documentation, https://github.com/skydeckai/skydeckai-code/blob/main/README.md
|
@@ -36,7 +36,7 @@ Description-Content-Type: text/markdown
|
|
36
36
|
|
37
37
|
# SkyDeckAI Code
|
38
38
|
|
39
|
-
An MCP server that provides a comprehensive set of tools for AI-driven development workflows. Features include file system operations, code analysis using tree-sitter for multiple programming languages, Git operations, code execution, web content fetching with HTML-to-markdown conversion, multi-engine web search, code content searching, and system information retrieval. Designed to enhance AI's capability to assist in software development tasks by providing direct access to both local and remote resources.
|
39
|
+
An MCP server that provides a comprehensive set of tools for AI-driven development workflows. Features include file system operations, code analysis using tree-sitter for multiple programming languages, Git operations, code execution, web content fetching with HTML-to-markdown conversion, multi-engine web search, code content searching, linting detection, and system information retrieval. Designed to enhance AI's capability to assist in software development tasks by providing direct access to both local and remote resources.
|
40
40
|
|
41
41
|
# Formerly Known As MCP-Server-AIDD
|
42
42
|
|
@@ -77,6 +77,7 @@ If you're using SkyDeck AI Helper app, you can search for "SkyDeckAI Code" and i
|
|
77
77
|
- File system operations (read, write, edit, move, copy, delete)
|
78
78
|
- Directory management and traversal
|
79
79
|
- Multi-language code analysis using tree-sitter
|
80
|
+
- Code linting and issue detection for Python and JavaScript/TypeScript
|
80
81
|
- Code content searching with regex pattern matching
|
81
82
|
- Multi-language code execution with safety measures
|
82
83
|
- Git operations (status, diff, commit, branch management, cloning)
|
@@ -140,8 +141,6 @@ Pattern-based file editing with preview support:
|
|
140
141
|
],
|
141
142
|
"dryRun": false,
|
142
143
|
"options": {
|
143
|
-
"preserveIndentation": true,
|
144
|
-
"normalizeWhitespace": true,
|
145
144
|
"partialMatch": true
|
146
145
|
}
|
147
146
|
}
|
@@ -281,6 +280,63 @@ Supported Languages:
|
|
281
280
|
- C# (.cs)
|
282
281
|
- Kotlin (.kt, .kts)
|
283
282
|
|
283
|
+
#### check_lint
|
284
|
+
|
285
|
+
Check for linting issues in your codebase using native linting tools:
|
286
|
+
|
287
|
+
```json
|
288
|
+
{
|
289
|
+
"path": "src",
|
290
|
+
"languages": ["python", "javascript"],
|
291
|
+
"linters": {
|
292
|
+
"pylint": "--disable=C0111",
|
293
|
+
"flake8": true,
|
294
|
+
"eslint": "--fix"
|
295
|
+
},
|
296
|
+
"max_issues": 100
|
297
|
+
}
|
298
|
+
```
|
299
|
+
|
300
|
+
**Parameters:**
|
301
|
+
| Parameter | Type | Required | Description |
|
302
|
+
|-----------|------|----------|-------------|
|
303
|
+
| path | string | No | Directory or file to lint (default: ".") |
|
304
|
+
| languages | array | No | List of languages to lint (auto-detects if empty) |
|
305
|
+
| linters | object | No | Configuration for specific linters - can use booleans or CLI arguments |
|
306
|
+
| max_issues | integer | No | Maximum number of issues to return (default: 100, 0 for unlimited) |
|
307
|
+
|
308
|
+
**Returns:**
|
309
|
+
A detailed report of linting issues found in the codebase, including file paths, line numbers, issue descriptions, and severity levels. Issues are grouped by file and sorted by severity.
|
310
|
+
|
311
|
+
**Supported Languages and Linters:**
|
312
|
+
|
313
|
+
- Python: pylint, flake8 (automatically uses what's available)
|
314
|
+
- JavaScript/TypeScript: ESLint
|
315
|
+
|
316
|
+
**Example Usage:**
|
317
|
+
|
318
|
+
```bash
|
319
|
+
# Check entire codebase with default settings
|
320
|
+
skydeckai-code-cli --tool check_lint
|
321
|
+
|
322
|
+
# Check specific directory with custom pylint flags
|
323
|
+
skydeckai-code-cli --tool check_lint --args '{
|
324
|
+
"path": "src",
|
325
|
+
"linters": {
|
326
|
+
"pylint": "--disable=missing-docstring,invalid-name"
|
327
|
+
}
|
328
|
+
}'
|
329
|
+
|
330
|
+
# Check only Python files and disable flake8
|
331
|
+
skydeckai-code-cli --tool check_lint --args '{
|
332
|
+
"path": "src",
|
333
|
+
"languages": ["python"],
|
334
|
+
"linters": {
|
335
|
+
"flake8": false
|
336
|
+
}
|
337
|
+
}'
|
338
|
+
```
|
339
|
+
|
284
340
|
#### search_code
|
285
341
|
|
286
342
|
Fast content search tool using regular expressions:
|
@@ -1,25 +1,26 @@
|
|
1
1
|
aidd/__init__.py,sha256=c9HBWxWruCxoAqLCJqltylAwz_7xmaK3g8DKViJZs0Q,222
|
2
2
|
aidd/cli.py,sha256=cLtaQJmMBfr7fHkd0dyJqpDrVTIwybL48PotniWGrFM,5031
|
3
3
|
aidd/server.py,sha256=kPRyWeWkMCZjabelC65XTmzZG7yw8htMJKSfnUcKnb0,1575
|
4
|
-
aidd/tools/__init__.py,sha256=
|
4
|
+
aidd/tools/__init__.py,sha256=abFameL2CdSZohi7Sa1tUEOzD2M6bcXSOkRpgxfZ1mo,5429
|
5
5
|
aidd/tools/base.py,sha256=wHSAaGGYWM8ECmoYd7KEcmjsZRWesNQFf3zMjCKGMcc,380
|
6
6
|
aidd/tools/code_analysis.py,sha256=fDpm2o_If5PsngXzHN2-ezSkPVT0ZxivLuzmHrOAmVU,33188
|
7
7
|
aidd/tools/code_execution.py,sha256=dIPxHBtclsetDZY4jGlSBrw_t-7VlIVrK8mflnZ6c4w,13176
|
8
|
-
aidd/tools/code_tools.py,sha256=
|
8
|
+
aidd/tools/code_tools.py,sha256=3CgkQ78iVKMd5j8aLmolLp4c59seD42Qw6VbdUcg2wA,12628
|
9
9
|
aidd/tools/directory_tools.py,sha256=Hxzge_ziYw_FsjYb5yF0R0dHEdvuWRsg7WsdYDG0AUg,12971
|
10
|
-
aidd/tools/file_tools.py,sha256=
|
10
|
+
aidd/tools/file_tools.py,sha256=jH1-c9sEqTPaUy1edvKIDVMfLs0osC7Xa8Mp94cICfo,42490
|
11
11
|
aidd/tools/get_active_apps_tool.py,sha256=BjLF7iXSDgyAmm_gfFgAul2Gn3iX-CNVYHM7Sh4jTAI,19427
|
12
12
|
aidd/tools/get_available_windows_tool.py,sha256=OVIYhItTn9u_DftOr3vPCT-R0DOFvMEEJXA6tD6gqWQ,15952
|
13
13
|
aidd/tools/git_tools.py,sha256=AgolgrZnpN2NALV7SfIwc6D7U7tdPrPTSFmU2WjPfVE,39846
|
14
14
|
aidd/tools/image_tools.py,sha256=wT3EcJAfZWcM0IsXdDfbTNjgFhKZM9nu2wHN6Mk_TTQ,5970
|
15
|
+
aidd/tools/lint_tools.py,sha256=ZV9zFb2ugFkO4PFWZk0q7GGVpRapETFBClJgUOiDkn8,18894
|
15
16
|
aidd/tools/other_tools.py,sha256=iG3Sd2FP0M0pRv5esPBAUMvlwxTyAMDUdS77IqA_f5s,10822
|
16
17
|
aidd/tools/path_tools.py,sha256=RGoOhqP69eHJzM8tEgn_5-GRaR0gp25fd0XZIJ_RnQE,4045
|
17
18
|
aidd/tools/screenshot_tool.py,sha256=NMO5B4UG8qfMEOMRd2YoOjtwz_oQ2y1UAGU22jV1yGU,46337
|
18
19
|
aidd/tools/state.py,sha256=RWSw0Jfsui8FqC0xsI7Ik07tAg35hRwLHa5xGBVbiI4,1493
|
19
20
|
aidd/tools/system_tools.py,sha256=H4_qveKC2HA7SIbi-j4vxA0W4jYh2wfu9A6ni5wkZyA,7249
|
20
21
|
aidd/tools/web_tools.py,sha256=gdsj2DEVYb_oYChItK5I1ugt2w25U7IAa5kEw9q6MVg,35534
|
21
|
-
skydeckai_code-0.1.
|
22
|
-
skydeckai_code-0.1.
|
23
|
-
skydeckai_code-0.1.
|
24
|
-
skydeckai_code-0.1.
|
25
|
-
skydeckai_code-0.1.
|
22
|
+
skydeckai_code-0.1.30.dist-info/METADATA,sha256=tR4BXAlWVy99YxudlZSogxl_SnfHKbzmcuCFgTNR780,32563
|
23
|
+
skydeckai_code-0.1.30.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
24
|
+
skydeckai_code-0.1.30.dist-info/entry_points.txt,sha256=cT-IHh3_ioGLk3kwIeqj1X6Li1dnJinX9qKWUl7nOLg,80
|
25
|
+
skydeckai_code-0.1.30.dist-info/licenses/LICENSE,sha256=uHse04vmI6ZjW7TblegFl30X-sDyyF0-QvH8ItPca3c,10865
|
26
|
+
skydeckai_code-0.1.30.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|