janito 3.3.0__py3-none-any.whl → 3.4.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.
- janito/cli/cli_commands/list_plugins.py +48 -52
- janito/cli/core/getters.py +0 -3
- janito/cli/main_cli.py +12 -9
- janito/drivers/openai/driver.py +0 -1
- janito/drivers/zai/driver.py +0 -1
- janito/hello.txt +0 -0
- janito/llm/auth_utils.py +5 -14
- janito/plugins/__init__.py +7 -18
- janito/{plugins_backup_20250825_070018 → plugins}/auto_loader_fixed.py +11 -12
- janito/plugins/base.py +152 -57
- janito/plugins/builtin.py +1 -15
- janito/{plugins_backup_20250825_070018 → plugins}/core_adapter.py +9 -11
- janito/plugins/core_loader.py +34 -58
- janito/{plugin_system_backup_20250825_070018/core_loader.py → plugins/core_loader_fixed.py} +26 -45
- janito/plugins/discovery.py +3 -3
- janito/tools/__init__.py +7 -31
- janito/tools/adapters/__init__.py +1 -6
- janito/tools/adapters/local/__init__.py +70 -7
- janito/{plugins_backup_20250825_070018/tools → tools/adapters/local}/ask_user.py +3 -3
- janito/{plugins_backup_20250825_070018/tools → tools/adapters/local}/create_file.py +4 -4
- janito/{plugins/core/filemanager/tools → tools/adapters/local}/delete_text_in_file.py +0 -1
- janito/{plugins_backup_20250825_070018/tools → tools/adapters/local}/fetch_url.py +3 -3
- janito/{plugins_backup_20250825_070018/tools → tools/adapters/local}/replace_text_in_file.py +4 -4
- janito/{plugins_backup_20250825_070018/tools → tools/adapters/local}/show_image.py +6 -15
- janito/{plugins/core/imagedisplay/tools → tools/adapters/local}/show_image_grid.py +5 -13
- janito/tools/base.py +1 -31
- janito/tools/function_adapter.py +16 -127
- janito/tools/tool_base.py +114 -142
- janito/tools/tools_schema.py +6 -12
- {janito-3.3.0.dist-info → janito-3.4.0.dist-info}/METADATA +2 -1
- janito-3.4.0.dist-info/RECORD +264 -0
- janito/cli/cli_commands/check_tools.py +0 -212
- janito/plugin_system_backup_20250825_070018/__init__.py +0 -10
- janito/plugin_system_backup_20250825_070018/base.py +0 -155
- janito/plugin_system_backup_20250825_070018/core_loader_fixed.py +0 -149
- janito/plugins/__main__.py +0 -85
- janito/plugins/core/__init__.py +0 -7
- janito/plugins/core/codeanalyzer/__init__.py +0 -43
- janito/plugins/core/filemanager/__init__.py +0 -124
- janito/plugins/core/filemanager/tools/copy_file.py +0 -111
- janito/plugins/core/filemanager/tools/create_directory.py +0 -97
- janito/plugins/core/filemanager/tools/create_file.py +0 -111
- janito/plugins/core/filemanager/tools/replace_text_in_file.py +0 -270
- janito/plugins/core/imagedisplay/__init__.py +0 -14
- janito/plugins/core/imagedisplay/plugin.py +0 -51
- janito/plugins/core/imagedisplay/tools/__init__.py +0 -1
- janito/plugins/core/imagedisplay/tools/show_image.py +0 -83
- janito/plugins/core/system/__init__.py +0 -23
- janito/plugins/dev/__init__.py +0 -7
- janito/plugins/dev/pythondev/__init__.py +0 -37
- janito/plugins/dev/visualization/__init__.py +0 -23
- janito/plugins/example_plugin.py +0 -108
- janito/plugins/ui/__init__.py +0 -7
- janito/plugins/ui/userinterface/__init__.py +0 -16
- janito/plugins/ui/userinterface/tools/ask_user.py +0 -110
- janito/plugins/web/__init__.py +0 -7
- janito/plugins/web/webtools/__init__.py +0 -33
- janito/plugins/web/webtools/tools/fetch_url.py +0 -458
- janito/plugins_backup_20250825_070018/__init__.py +0 -36
- janito/plugins_backup_20250825_070018/builtin.py +0 -102
- janito/plugins_backup_20250825_070018/config.py +0 -84
- janito/plugins_backup_20250825_070018/core/__init__.py +0 -7
- janito/plugins_backup_20250825_070018/core/codeanalyzer/__init__.py +0 -43
- janito/plugins_backup_20250825_070018/core/codeanalyzer/tools/get_file_outline/__init__.py +0 -1
- janito/plugins_backup_20250825_070018/core/codeanalyzer/tools/get_file_outline/core.py +0 -122
- janito/plugins_backup_20250825_070018/core/codeanalyzer/tools/get_file_outline/java_outline.py +0 -47
- janito/plugins_backup_20250825_070018/core/codeanalyzer/tools/get_file_outline/markdown_outline.py +0 -14
- janito/plugins_backup_20250825_070018/core/codeanalyzer/tools/get_file_outline/python_outline.py +0 -303
- janito/plugins_backup_20250825_070018/core/codeanalyzer/tools/get_file_outline/search_outline.py +0 -36
- janito/plugins_backup_20250825_070018/core/codeanalyzer/tools/search_text/__init__.py +0 -1
- janito/plugins_backup_20250825_070018/core/codeanalyzer/tools/search_text/core.py +0 -205
- janito/plugins_backup_20250825_070018/core/codeanalyzer/tools/search_text/match_lines.py +0 -67
- janito/plugins_backup_20250825_070018/core/codeanalyzer/tools/search_text/pattern_utils.py +0 -73
- janito/plugins_backup_20250825_070018/core/codeanalyzer/tools/search_text/traverse_directory.py +0 -145
- janito/plugins_backup_20250825_070018/core/filemanager/__init__.py +0 -124
- janito/plugins_backup_20250825_070018/core/filemanager/tools/create_file.py +0 -87
- janito/plugins_backup_20250825_070018/core/filemanager/tools/delete_text_in_file.py +0 -135
- janito/plugins_backup_20250825_070018/core/filemanager/tools/find_files.py +0 -143
- janito/plugins_backup_20250825_070018/core/filemanager/tools/move_file.py +0 -131
- janito/plugins_backup_20250825_070018/core/filemanager/tools/read_files.py +0 -58
- janito/plugins_backup_20250825_070018/core/filemanager/tools/remove_directory.py +0 -55
- janito/plugins_backup_20250825_070018/core/filemanager/tools/remove_file.py +0 -58
- janito/plugins_backup_20250825_070018/core/filemanager/tools/replace_text_in_file.py +0 -270
- janito/plugins_backup_20250825_070018/core/filemanager/tools/validate_file_syntax/__init__.py +0 -1
- janito/plugins_backup_20250825_070018/core/filemanager/tools/validate_file_syntax/core.py +0 -114
- janito/plugins_backup_20250825_070018/core/filemanager/tools/validate_file_syntax/css_validator.py +0 -35
- janito/plugins_backup_20250825_070018/core/filemanager/tools/validate_file_syntax/html_validator.py +0 -100
- janito/plugins_backup_20250825_070018/core/filemanager/tools/validate_file_syntax/jinja2_validator.py +0 -50
- janito/plugins_backup_20250825_070018/core/filemanager/tools/validate_file_syntax/js_validator.py +0 -27
- janito/plugins_backup_20250825_070018/core/filemanager/tools/validate_file_syntax/json_validator.py +0 -6
- janito/plugins_backup_20250825_070018/core/filemanager/tools/validate_file_syntax/markdown_validator.py +0 -109
- janito/plugins_backup_20250825_070018/core/filemanager/tools/validate_file_syntax/ps1_validator.py +0 -32
- janito/plugins_backup_20250825_070018/core/filemanager/tools/validate_file_syntax/python_validator.py +0 -5
- janito/plugins_backup_20250825_070018/core/filemanager/tools/validate_file_syntax/xml_validator.py +0 -11
- janito/plugins_backup_20250825_070018/core/filemanager/tools/validate_file_syntax/yaml_validator.py +0 -6
- janito/plugins_backup_20250825_070018/core/filemanager/tools/view_file.py +0 -172
- janito/plugins_backup_20250825_070018/core/imagedisplay/__init__.py +0 -14
- janito/plugins_backup_20250825_070018/core/imagedisplay/plugin.py +0 -51
- janito/plugins_backup_20250825_070018/core/imagedisplay/tools/__init__.py +0 -1
- janito/plugins_backup_20250825_070018/core/imagedisplay/tools/show_image.py +0 -83
- janito/plugins_backup_20250825_070018/core/imagedisplay/tools/show_image_grid.py +0 -84
- janito/plugins_backup_20250825_070018/core/system/__init__.py +0 -23
- janito/plugins_backup_20250825_070018/core/system/tools/run_bash_command.py +0 -183
- janito/plugins_backup_20250825_070018/core/system/tools/run_powershell_command.py +0 -218
- janito/plugins_backup_20250825_070018/dev/__init__.py +0 -7
- janito/plugins_backup_20250825_070018/dev/pythondev/__init__.py +0 -37
- janito/plugins_backup_20250825_070018/dev/pythondev/tools/python_code_run.py +0 -172
- janito/plugins_backup_20250825_070018/dev/pythondev/tools/python_command_run.py +0 -171
- janito/plugins_backup_20250825_070018/dev/pythondev/tools/python_file_run.py +0 -172
- janito/plugins_backup_20250825_070018/dev/visualization/__init__.py +0 -23
- janito/plugins_backup_20250825_070018/dev/visualization/tools/read_chart.py +0 -259
- janito/plugins_backup_20250825_070018/discovery.py +0 -289
- janito/plugins_backup_20250825_070018/example_plugin.py +0 -108
- janito/plugins_backup_20250825_070018/manager.py +0 -243
- janito/plugins_backup_20250825_070018/tools/__init__.py +0 -10
- janito/plugins_backup_20250825_070018/tools/copy_file.py +0 -87
- janito/plugins_backup_20250825_070018/tools/core_tools_plugin.py +0 -88
- janito/plugins_backup_20250825_070018/tools/create_directory.py +0 -70
- janito/plugins_backup_20250825_070018/tools/decorators.py +0 -19
- janito/plugins_backup_20250825_070018/tools/delete_text_in_file.py +0 -135
- janito/plugins_backup_20250825_070018/tools/find_files.py +0 -143
- janito/plugins_backup_20250825_070018/tools/get_file_outline/__init__.py +0 -7
- janito/plugins_backup_20250825_070018/tools/get_file_outline/core.py +0 -122
- janito/plugins_backup_20250825_070018/tools/get_file_outline/java_outline.py +0 -47
- janito/plugins_backup_20250825_070018/tools/get_file_outline/markdown_outline.py +0 -14
- janito/plugins_backup_20250825_070018/tools/get_file_outline/python_outline.py +0 -303
- janito/plugins_backup_20250825_070018/tools/get_file_outline/search_outline.py +0 -36
- janito/plugins_backup_20250825_070018/tools/move_file.py +0 -131
- janito/plugins_backup_20250825_070018/tools/open_html_in_browser.py +0 -51
- janito/plugins_backup_20250825_070018/tools/open_url.py +0 -37
- janito/plugins_backup_20250825_070018/tools/python_code_run.py +0 -172
- janito/plugins_backup_20250825_070018/tools/python_command_run.py +0 -171
- janito/plugins_backup_20250825_070018/tools/python_file_run.py +0 -172
- janito/plugins_backup_20250825_070018/tools/read_chart.py +0 -259
- janito/plugins_backup_20250825_070018/tools/read_files.py +0 -58
- janito/plugins_backup_20250825_070018/tools/remove_directory.py +0 -55
- janito/plugins_backup_20250825_070018/tools/remove_file.py +0 -58
- janito/plugins_backup_20250825_070018/tools/run_bash_command.py +0 -183
- janito/plugins_backup_20250825_070018/tools/run_powershell_command.py +0 -218
- janito/plugins_backup_20250825_070018/tools/search_text/__init__.py +0 -7
- janito/plugins_backup_20250825_070018/tools/search_text/core.py +0 -205
- janito/plugins_backup_20250825_070018/tools/search_text/match_lines.py +0 -67
- janito/plugins_backup_20250825_070018/tools/search_text/pattern_utils.py +0 -73
- janito/plugins_backup_20250825_070018/tools/search_text/traverse_directory.py +0 -145
- janito/plugins_backup_20250825_070018/tools/show_image_grid.py +0 -85
- janito/plugins_backup_20250825_070018/tools/validate_file_syntax/__init__.py +0 -7
- janito/plugins_backup_20250825_070018/tools/validate_file_syntax/core.py +0 -114
- janito/plugins_backup_20250825_070018/tools/validate_file_syntax/css_validator.py +0 -35
- janito/plugins_backup_20250825_070018/tools/validate_file_syntax/html_validator.py +0 -100
- janito/plugins_backup_20250825_070018/tools/validate_file_syntax/jinja2_validator.py +0 -50
- janito/plugins_backup_20250825_070018/tools/validate_file_syntax/js_validator.py +0 -27
- janito/plugins_backup_20250825_070018/tools/validate_file_syntax/json_validator.py +0 -6
- janito/plugins_backup_20250825_070018/tools/validate_file_syntax/markdown_validator.py +0 -109
- janito/plugins_backup_20250825_070018/tools/validate_file_syntax/ps1_validator.py +0 -32
- janito/plugins_backup_20250825_070018/tools/validate_file_syntax/python_validator.py +0 -5
- janito/plugins_backup_20250825_070018/tools/validate_file_syntax/xml_validator.py +0 -11
- janito/plugins_backup_20250825_070018/tools/validate_file_syntax/yaml_validator.py +0 -6
- janito/plugins_backup_20250825_070018/tools/view_file.py +0 -172
- janito/plugins_backup_20250825_070018/ui/__init__.py +0 -7
- janito/plugins_backup_20250825_070018/ui/userinterface/__init__.py +0 -16
- janito/plugins_backup_20250825_070018/ui/userinterface/tools/ask_user.py +0 -110
- janito/plugins_backup_20250825_070018/web/__init__.py +0 -7
- janito/plugins_backup_20250825_070018/web/webtools/__init__.py +0 -33
- janito/plugins_backup_20250825_070018/web/webtools/tools/fetch_url.py +0 -458
- janito/plugins_backup_20250825_070018/web/webtools/tools/open_html_in_browser.py +0 -51
- janito/plugins_backup_20250825_070018/web/webtools/tools/open_url.py +0 -37
- janito/tools/cli_initializer.py +0 -88
- janito/tools/initialize.py +0 -70
- janito-3.3.0.dist-info/RECORD +0 -400
- /janito/{plugins_backup_20250825_070018 → plugins}/auto_loader.py +0 -0
- /janito/{plugins_backup_20250825_070018 → plugins}/discovery_core.py +0 -0
- /janito/{plugins_backup_20250825_070018/core/filemanager/tools → tools/adapters/local}/copy_file.py +0 -0
- /janito/{plugins_backup_20250825_070018/core/filemanager/tools → tools/adapters/local}/create_directory.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/find_files.py +0 -0
- /janito/{plugins/core/codeanalyzer/tools → tools/adapters/local}/get_file_outline/__init__.py +0 -0
- /janito/{plugins/core/codeanalyzer/tools → tools/adapters/local}/get_file_outline/core.py +0 -0
- /janito/{plugins/core/codeanalyzer/tools → tools/adapters/local}/get_file_outline/java_outline.py +0 -0
- /janito/{plugins/core/codeanalyzer/tools → tools/adapters/local}/get_file_outline/markdown_outline.py +0 -0
- /janito/{plugins/core/codeanalyzer/tools → tools/adapters/local}/get_file_outline/python_outline.py +0 -0
- /janito/{plugins/core/codeanalyzer/tools → tools/adapters/local}/get_file_outline/search_outline.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/move_file.py +0 -0
- /janito/{plugins/web/webtools/tools → tools/adapters/local}/open_html_in_browser.py +0 -0
- /janito/{plugins/web/webtools/tools → tools/adapters/local}/open_url.py +0 -0
- /janito/{plugins/dev/pythondev/tools → tools/adapters/local}/python_code_run.py +0 -0
- /janito/{plugins/dev/pythondev/tools → tools/adapters/local}/python_command_run.py +0 -0
- /janito/{plugins/dev/pythondev/tools → tools/adapters/local}/python_file_run.py +0 -0
- /janito/{plugins/dev/visualization/tools → tools/adapters/local}/read_chart.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/read_files.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/remove_directory.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/remove_file.py +0 -0
- /janito/{plugins/core/system/tools → tools/adapters/local}/run_bash_command.py +0 -0
- /janito/{plugins/core/system/tools → tools/adapters/local}/run_powershell_command.py +0 -0
- /janito/{plugins/core/codeanalyzer/tools → tools/adapters/local}/search_text/__init__.py +0 -0
- /janito/{plugins/core/codeanalyzer/tools → tools/adapters/local}/search_text/core.py +0 -0
- /janito/{plugins/core/codeanalyzer/tools → tools/adapters/local}/search_text/match_lines.py +0 -0
- /janito/{plugins/core/codeanalyzer/tools → tools/adapters/local}/search_text/pattern_utils.py +0 -0
- /janito/{plugins/core/codeanalyzer/tools → tools/adapters/local}/search_text/traverse_directory.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/validate_file_syntax/__init__.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/validate_file_syntax/core.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/validate_file_syntax/css_validator.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/validate_file_syntax/html_validator.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/validate_file_syntax/jinja2_validator.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/validate_file_syntax/js_validator.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/validate_file_syntax/json_validator.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/validate_file_syntax/markdown_validator.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/validate_file_syntax/ps1_validator.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/validate_file_syntax/python_validator.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/validate_file_syntax/xml_validator.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/validate_file_syntax/yaml_validator.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/view_file.py +0 -0
- {janito-3.3.0.dist-info → janito-3.4.0.dist-info}/WHEEL +0 -0
- {janito-3.3.0.dist-info → janito-3.4.0.dist-info}/entry_points.txt +0 -0
- {janito-3.3.0.dist-info → janito-3.4.0.dist-info}/licenses/LICENSE +0 -0
- {janito-3.3.0.dist-info → janito-3.4.0.dist-info}/top_level.txt +0 -0
@@ -1,145 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
from janito.gitignore_utils import GitignoreFilter
|
3
|
-
from .match_lines import match_line, should_limit, read_file_lines
|
4
|
-
|
5
|
-
|
6
|
-
def walk_directory(search_path, max_depth):
|
7
|
-
if max_depth == 1:
|
8
|
-
walk_result = next(os.walk(search_path), None)
|
9
|
-
if walk_result is None:
|
10
|
-
return [(search_path, [], [])]
|
11
|
-
else:
|
12
|
-
return [walk_result]
|
13
|
-
else:
|
14
|
-
return os.walk(search_path)
|
15
|
-
|
16
|
-
|
17
|
-
def filter_dirs(dirs, root, gitignore_filter):
|
18
|
-
# Always exclude directories named .git, regardless of gitignore
|
19
|
-
return [
|
20
|
-
d
|
21
|
-
for d in dirs
|
22
|
-
if d != ".git" and not gitignore_filter.is_ignored(os.path.join(root, d))
|
23
|
-
]
|
24
|
-
|
25
|
-
|
26
|
-
def process_file_count_only(
|
27
|
-
path,
|
28
|
-
per_file_counts,
|
29
|
-
query,
|
30
|
-
regex,
|
31
|
-
use_regex,
|
32
|
-
case_sensitive,
|
33
|
-
max_results,
|
34
|
-
total_results,
|
35
|
-
):
|
36
|
-
match_count, file_limit_reached, _ = read_file_lines(
|
37
|
-
path,
|
38
|
-
query,
|
39
|
-
regex,
|
40
|
-
use_regex,
|
41
|
-
case_sensitive,
|
42
|
-
True,
|
43
|
-
max_results,
|
44
|
-
total_results + sum(count for _, count in per_file_counts),
|
45
|
-
)
|
46
|
-
if match_count > 0:
|
47
|
-
per_file_counts.append((path, match_count))
|
48
|
-
return file_limit_reached
|
49
|
-
|
50
|
-
|
51
|
-
def process_file_collect(
|
52
|
-
path,
|
53
|
-
dir_output,
|
54
|
-
per_file_counts,
|
55
|
-
query,
|
56
|
-
regex,
|
57
|
-
use_regex,
|
58
|
-
case_sensitive,
|
59
|
-
max_results,
|
60
|
-
total_results,
|
61
|
-
):
|
62
|
-
actual_match_count, file_limit_reached, file_lines_output = read_file_lines(
|
63
|
-
path,
|
64
|
-
query,
|
65
|
-
regex,
|
66
|
-
use_regex,
|
67
|
-
case_sensitive,
|
68
|
-
False,
|
69
|
-
max_results,
|
70
|
-
total_results + len(dir_output),
|
71
|
-
)
|
72
|
-
dir_output.extend(file_lines_output)
|
73
|
-
if actual_match_count > 0:
|
74
|
-
per_file_counts.append((path, actual_match_count))
|
75
|
-
return file_limit_reached
|
76
|
-
|
77
|
-
|
78
|
-
def should_limit_depth(root, search_path, max_depth, dirs):
|
79
|
-
if max_depth > 0:
|
80
|
-
rel_root = os.path.relpath(root, search_path)
|
81
|
-
if rel_root != ".":
|
82
|
-
depth = rel_root.count(os.sep) + 1
|
83
|
-
if depth >= max_depth:
|
84
|
-
del dirs[:]
|
85
|
-
|
86
|
-
|
87
|
-
def traverse_directory(
|
88
|
-
search_path,
|
89
|
-
query,
|
90
|
-
regex,
|
91
|
-
use_regex,
|
92
|
-
case_sensitive,
|
93
|
-
max_depth,
|
94
|
-
max_results,
|
95
|
-
total_results,
|
96
|
-
count_only,
|
97
|
-
):
|
98
|
-
dir_output = []
|
99
|
-
dir_limit_reached = False
|
100
|
-
per_file_counts = []
|
101
|
-
walker = walk_directory(search_path, max_depth)
|
102
|
-
gitignore_filter = GitignoreFilter(search_path)
|
103
|
-
|
104
|
-
for root, dirs, files in walker:
|
105
|
-
dirs[:] = filter_dirs(dirs, root, gitignore_filter)
|
106
|
-
for file in files:
|
107
|
-
path = os.path.join(root, file)
|
108
|
-
if gitignore_filter.is_ignored(path):
|
109
|
-
continue
|
110
|
-
if count_only:
|
111
|
-
file_limit_reached = process_file_count_only(
|
112
|
-
path,
|
113
|
-
per_file_counts,
|
114
|
-
query,
|
115
|
-
regex,
|
116
|
-
use_regex,
|
117
|
-
case_sensitive,
|
118
|
-
max_results,
|
119
|
-
total_results,
|
120
|
-
)
|
121
|
-
if file_limit_reached:
|
122
|
-
dir_limit_reached = True
|
123
|
-
break
|
124
|
-
else:
|
125
|
-
file_limit_reached = process_file_collect(
|
126
|
-
path,
|
127
|
-
dir_output,
|
128
|
-
per_file_counts,
|
129
|
-
query,
|
130
|
-
regex,
|
131
|
-
use_regex,
|
132
|
-
case_sensitive,
|
133
|
-
max_results,
|
134
|
-
total_results,
|
135
|
-
)
|
136
|
-
if file_limit_reached:
|
137
|
-
dir_limit_reached = True
|
138
|
-
break
|
139
|
-
if dir_limit_reached:
|
140
|
-
break
|
141
|
-
should_limit_depth(root, search_path, max_depth, dirs)
|
142
|
-
if count_only:
|
143
|
-
return per_file_counts, dir_limit_reached, []
|
144
|
-
else:
|
145
|
-
return dir_output, dir_limit_reached, per_file_counts
|
@@ -1,85 +0,0 @@
|
|
1
|
-
from janito.tools.tool_base import ToolBase, ToolPermissions
|
2
|
-
from janito.report_events import ReportAction
|
3
|
-
from janito.plugins.tools.decorators import register_core_tool
|
4
|
-
from janito.i18n import tr
|
5
|
-
from janito.tools.loop_protection_decorator import protect_against_loops
|
6
|
-
from typing import Sequence
|
7
|
-
|
8
|
-
|
9
|
-
@register_core_tool
|
10
|
-
class ShowImageGrid(ToolBase):
|
11
|
-
"""Display multiple images in a grid inline in the terminal using rich.
|
12
|
-
|
13
|
-
Args:
|
14
|
-
paths (list[str]): List of image file paths.
|
15
|
-
columns (int, optional): Number of columns in the grid. Default: 2.
|
16
|
-
width (int, optional): Max width for each image cell. Default: None (auto).
|
17
|
-
height (int, optional): Max height for each image cell. Default: None (auto).
|
18
|
-
preserve_aspect (bool, optional): Preserve aspect ratio. Default: True.
|
19
|
-
|
20
|
-
Returns:
|
21
|
-
str: Status string summarizing the grid display.
|
22
|
-
"""
|
23
|
-
|
24
|
-
permissions = ToolPermissions(read=True)
|
25
|
-
tool_name = "show_image_grid"
|
26
|
-
|
27
|
-
@protect_against_loops(max_calls=5, time_window=10.0, key_field="paths")
|
28
|
-
def run(
|
29
|
-
self,
|
30
|
-
paths: Sequence[str],
|
31
|
-
columns: int = 2,
|
32
|
-
width: int | None = None,
|
33
|
-
height: int | None = None,
|
34
|
-
preserve_aspect: bool = True,
|
35
|
-
) -> str:
|
36
|
-
from janito.tools.path_utils import expand_path
|
37
|
-
from janito.tools.tool_utils import display_path
|
38
|
-
import os
|
39
|
-
|
40
|
-
try:
|
41
|
-
from rich.console import Console
|
42
|
-
from rich.columns import Columns
|
43
|
-
from PIL import Image as PILImage
|
44
|
-
from rich.panel import Panel
|
45
|
-
except Exception as e:
|
46
|
-
msg = tr("⚠️ Missing dependency: PIL/Pillow ({error})", error=e)
|
47
|
-
self.report_error(msg)
|
48
|
-
return msg
|
49
|
-
|
50
|
-
if not paths:
|
51
|
-
return tr("No images provided")
|
52
|
-
|
53
|
-
self.report_action(
|
54
|
-
tr("🖼️ Show image grid ({n} images)", n=len(paths)), ReportAction.READ
|
55
|
-
)
|
56
|
-
|
57
|
-
console = Console()
|
58
|
-
images = []
|
59
|
-
shown = 0
|
60
|
-
for p in paths:
|
61
|
-
fp = expand_path(p)
|
62
|
-
if not os.path.exists(fp):
|
63
|
-
self.report_warning(tr("❗ not found: {p}", p=display_path(fp)))
|
64
|
-
continue
|
65
|
-
try:
|
66
|
-
img = PILImage.open(fp)
|
67
|
-
title = f"{display_path(fp)} ({img.width}x{img.height})"
|
68
|
-
images.append(
|
69
|
-
Panel.fit(title, title=display_path(fp), border_style="dim")
|
70
|
-
)
|
71
|
-
shown += 1
|
72
|
-
except Exception as e:
|
73
|
-
self.report_warning(tr("⚠️ Skipped {p}: {e}", p=display_path(fp), e=e))
|
74
|
-
|
75
|
-
if not images:
|
76
|
-
return tr("No images could be displayed")
|
77
|
-
|
78
|
-
console.print(Columns(images, equal=True, expand=True, columns=columns))
|
79
|
-
self.report_success(tr("✅ Displayed {n} images", n=shown))
|
80
|
-
return tr(
|
81
|
-
"Displayed {shown}/{total} images in a {cols}x? grid",
|
82
|
-
shown=shown,
|
83
|
-
total=len(paths),
|
84
|
-
cols=columns,
|
85
|
-
)
|
@@ -1,114 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
from janito.tools.path_utils import expand_path
|
3
|
-
from janito.i18n import tr
|
4
|
-
from janito.tools.tool_base import ToolBase, ToolPermissions
|
5
|
-
from janito.report_events import ReportAction
|
6
|
-
from janito.tools.adapters.local.adapter import register_local_tool
|
7
|
-
from janito.tools.tool_utils import display_path
|
8
|
-
from janito.plugins.tools.decorators import register_core_tool as register_tool
|
9
|
-
|
10
|
-
from .python_validator import validate_python
|
11
|
-
from .json_validator import validate_json
|
12
|
-
from .yaml_validator import validate_yaml
|
13
|
-
from .ps1_validator import validate_ps1
|
14
|
-
from .xml_validator import validate_xml
|
15
|
-
from .html_validator import validate_html
|
16
|
-
from .markdown_validator import validate_markdown
|
17
|
-
from .js_validator import validate_js
|
18
|
-
from .css_validator import validate_css
|
19
|
-
from .jinja2_validator import validate_jinja2
|
20
|
-
from janito.tools.loop_protection_decorator import protect_against_loops
|
21
|
-
|
22
|
-
|
23
|
-
def _get_validator(ext):
|
24
|
-
"""Return the appropriate validator function for the file extension."""
|
25
|
-
mapping = {
|
26
|
-
".py": validate_python,
|
27
|
-
".pyw": validate_python,
|
28
|
-
".json": validate_json,
|
29
|
-
".yml": validate_yaml,
|
30
|
-
".yaml": validate_yaml,
|
31
|
-
".ps1": validate_ps1,
|
32
|
-
".xml": validate_xml,
|
33
|
-
".html": validate_html,
|
34
|
-
".htm": validate_html,
|
35
|
-
".md": validate_markdown,
|
36
|
-
".js": validate_js,
|
37
|
-
".css": validate_css,
|
38
|
-
".j2": validate_jinja2,
|
39
|
-
".jinja2": validate_jinja2,
|
40
|
-
}
|
41
|
-
return mapping.get(ext)
|
42
|
-
|
43
|
-
|
44
|
-
def _handle_validation_error(e, report_warning):
|
45
|
-
msg = tr("⚠️ Warning: Syntax error: {error}", error=e)
|
46
|
-
if report_warning:
|
47
|
-
report_warning(msg)
|
48
|
-
return msg
|
49
|
-
|
50
|
-
|
51
|
-
def validate_file_syntax(
|
52
|
-
path: str, report_info=None, report_warning=None, report_success=None
|
53
|
-
) -> str:
|
54
|
-
ext = os.path.splitext(path)[1].lower()
|
55
|
-
validator = _get_validator(ext)
|
56
|
-
try:
|
57
|
-
if validator:
|
58
|
-
return validator(path)
|
59
|
-
else:
|
60
|
-
msg = tr("⚠️ Warning: Unsupported file extension: {ext}", ext=ext)
|
61
|
-
if report_warning:
|
62
|
-
report_warning(msg)
|
63
|
-
return msg
|
64
|
-
except Exception as e:
|
65
|
-
return _handle_validation_error(e, report_warning)
|
66
|
-
|
67
|
-
|
68
|
-
class ValidateFileSyntax(ToolBase):
|
69
|
-
"""
|
70
|
-
Validate a file for syntax issues.
|
71
|
-
|
72
|
-
Supported types:
|
73
|
-
- Python (.py, .pyw)
|
74
|
-
- JSON (.json)
|
75
|
-
- YAML (.yml, .yaml)
|
76
|
-
- PowerShell (.ps1)
|
77
|
-
- XML (.xml)
|
78
|
-
- HTML (.html, .htm) [lxml]
|
79
|
-
- Markdown (.md)
|
80
|
-
- JavaScript (.js)
|
81
|
-
- Jinja2 templates (.j2, .jinja2)
|
82
|
-
|
83
|
-
Args:
|
84
|
-
path (str): Path to the file to validate.
|
85
|
-
Returns:
|
86
|
-
str: Validation status message. Example:
|
87
|
-
- "✅ Syntax OK"
|
88
|
-
- "⚠️ Warning: Syntax error: <error message>"
|
89
|
-
- "⚠️ Warning: Unsupported file extension: <ext>"
|
90
|
-
"""
|
91
|
-
|
92
|
-
permissions = ToolPermissions(read=True)
|
93
|
-
tool_name = "validate_file_syntax"
|
94
|
-
|
95
|
-
@protect_against_loops(max_calls=5, time_window=10.0, key_field="path")
|
96
|
-
def run(self, path: str) -> str:
|
97
|
-
path = expand_path(path)
|
98
|
-
disp_path = display_path(path)
|
99
|
-
self.report_action(
|
100
|
-
tr(
|
101
|
-
"🔎 Validate syntax for file '{disp_path}' ...",
|
102
|
-
disp_path=disp_path,
|
103
|
-
),
|
104
|
-
ReportAction.READ,
|
105
|
-
)
|
106
|
-
result = validate_file_syntax(
|
107
|
-
path,
|
108
|
-
report_warning=self.report_warning,
|
109
|
-
report_success=self.report_success,
|
110
|
-
)
|
111
|
-
if result.startswith("✅"):
|
112
|
-
self.report_success(result, ReportAction.READ)
|
113
|
-
|
114
|
-
return result
|
@@ -1,35 +0,0 @@
|
|
1
|
-
from janito.i18n import tr
|
2
|
-
import re
|
3
|
-
|
4
|
-
|
5
|
-
def validate_css(path: str) -> str:
|
6
|
-
with open(path, "r", encoding="utf-8") as f:
|
7
|
-
content = f.read()
|
8
|
-
errors = []
|
9
|
-
# Check for unmatched curly braces
|
10
|
-
if content.count("{") != content.count("}"):
|
11
|
-
errors.append("Unmatched curly braces { }")
|
12
|
-
# Check for unclosed comments
|
13
|
-
if content.count("/*") != content.count("*/"):
|
14
|
-
errors.append("Unclosed comment (/* ... */)")
|
15
|
-
# Check for invalid property declarations (very basic)
|
16
|
-
for i, line in enumerate(content.splitlines(), 1):
|
17
|
-
# Ignore empty lines and comments
|
18
|
-
if not line.strip() or line.strip().startswith("/*"):
|
19
|
-
continue
|
20
|
-
# Match property: value; (allow whitespace)
|
21
|
-
if ":" in line and not re.search(r":.*;", line):
|
22
|
-
errors.append(
|
23
|
-
f"Line {i}: Missing semicolon after property value | {line.strip()}"
|
24
|
-
)
|
25
|
-
# Match lines with property but missing colon
|
26
|
-
if ";" in line and ":" not in line:
|
27
|
-
errors.append(
|
28
|
-
f"Line {i}: Missing colon in property declaration | {line.strip()}"
|
29
|
-
)
|
30
|
-
if errors:
|
31
|
-
msg = tr(
|
32
|
-
"⚠️ Warning: CSS syntax issues found:\n{errors}", errors="\n".join(errors)
|
33
|
-
)
|
34
|
-
return msg
|
35
|
-
return "✅ OK"
|
@@ -1,100 +0,0 @@
|
|
1
|
-
from janito.i18n import tr
|
2
|
-
import re
|
3
|
-
|
4
|
-
try:
|
5
|
-
from lxml import etree
|
6
|
-
except ImportError:
|
7
|
-
etree = None
|
8
|
-
|
9
|
-
|
10
|
-
def validate_html(path: str) -> str:
|
11
|
-
html_content = _read_html_content(path)
|
12
|
-
warnings = _find_js_outside_script(html_content)
|
13
|
-
lxml_error = _parse_html_and_collect_errors(path)
|
14
|
-
msg = _build_result_message(warnings, lxml_error)
|
15
|
-
return msg
|
16
|
-
|
17
|
-
|
18
|
-
def _read_html_content(path):
|
19
|
-
with open(path, "r", encoding="utf-8") as f:
|
20
|
-
return f.read()
|
21
|
-
|
22
|
-
|
23
|
-
def _find_js_outside_script(html_content):
|
24
|
-
script_blocks = [
|
25
|
-
m.span()
|
26
|
-
for m in re.finditer(
|
27
|
-
r"<script[\s\S]*?>[\s\S]*?<\/script>", html_content, re.IGNORECASE
|
28
|
-
)
|
29
|
-
]
|
30
|
-
js_patterns = [
|
31
|
-
r"document\.addEventListener",
|
32
|
-
r"^\s*(var|let|const)\s+\w+\s*[=;]",
|
33
|
-
r"^\s*function\s+\w+\s*\(",
|
34
|
-
r"^\s*(const|let|var)\s+\w+\s*=\s*\(.*\)\s*=>",
|
35
|
-
r"^\s*window\.\w+\s*=",
|
36
|
-
r"^\s*\$\s*\(",
|
37
|
-
]
|
38
|
-
warnings = []
|
39
|
-
for pat in js_patterns:
|
40
|
-
for m in re.finditer(pat, html_content):
|
41
|
-
in_script = False
|
42
|
-
for s_start, s_end in script_blocks:
|
43
|
-
if s_start <= m.start() < s_end:
|
44
|
-
in_script = True
|
45
|
-
break
|
46
|
-
if not in_script:
|
47
|
-
warnings.append(
|
48
|
-
f"Line {html_content.count(chr(10), 0, m.start())+1}: JavaScript code ('{pat}') found outside <script> tag."
|
49
|
-
)
|
50
|
-
return warnings
|
51
|
-
|
52
|
-
|
53
|
-
def _parse_html_and_collect_errors(path):
|
54
|
-
lxml_error = None
|
55
|
-
if etree is None:
|
56
|
-
lxml_error = tr("⚠️ lxml not installed. Cannot validate HTML.")
|
57
|
-
return lxml_error
|
58
|
-
try:
|
59
|
-
parser = etree.HTMLParser(recover=False)
|
60
|
-
with open(path, "rb") as f:
|
61
|
-
etree.parse(f, parser=parser)
|
62
|
-
error_log = parser.error_log
|
63
|
-
syntax_errors = []
|
64
|
-
for e in error_log:
|
65
|
-
if (
|
66
|
-
"mismatch" in e.message.lower()
|
67
|
-
or "tag not closed" in e.message.lower()
|
68
|
-
or "unexpected end tag" in e.message.lower()
|
69
|
-
or "expected" in e.message.lower()
|
70
|
-
):
|
71
|
-
syntax_errors.append(str(e))
|
72
|
-
if syntax_errors:
|
73
|
-
lxml_error = tr("Syntax error: {error}", error="; ".join(syntax_errors))
|
74
|
-
elif error_log:
|
75
|
-
lxml_error = tr(
|
76
|
-
"HTML syntax errors found:\n{errors}",
|
77
|
-
errors="\n".join(str(e) for e in error_log),
|
78
|
-
)
|
79
|
-
except ImportError:
|
80
|
-
lxml_error = tr("⚠️ lxml not installed. Cannot validate HTML.")
|
81
|
-
except Exception as e:
|
82
|
-
lxml_error = tr("Syntax error: {error}", error=str(e))
|
83
|
-
return lxml_error
|
84
|
-
|
85
|
-
|
86
|
-
def _build_result_message(warnings, lxml_error):
|
87
|
-
msg = ""
|
88
|
-
if warnings:
|
89
|
-
msg += (
|
90
|
-
tr(
|
91
|
-
"⚠️ Warning: JavaScript code found outside <script> tags. This is invalid HTML and will not execute in browsers.\n"
|
92
|
-
+ "\n".join(warnings)
|
93
|
-
)
|
94
|
-
+ "\n"
|
95
|
-
)
|
96
|
-
if lxml_error:
|
97
|
-
msg += lxml_error
|
98
|
-
if msg:
|
99
|
-
return msg.strip()
|
100
|
-
return "✅ OK"
|
@@ -1,50 +0,0 @@
|
|
1
|
-
"""Jinja2 template syntax validator."""
|
2
|
-
|
3
|
-
import os
|
4
|
-
from janito.i18n import tr
|
5
|
-
|
6
|
-
|
7
|
-
def validate_jinja2(path: str) -> str:
|
8
|
-
"""Validate Jinja2 template syntax."""
|
9
|
-
try:
|
10
|
-
from jinja2 import Environment, TemplateSyntaxError
|
11
|
-
|
12
|
-
with open(path, "r", encoding="utf-8") as f:
|
13
|
-
content = f.read()
|
14
|
-
|
15
|
-
# Create a Jinja2 environment and try to parse the template
|
16
|
-
env = Environment()
|
17
|
-
try:
|
18
|
-
env.parse(content)
|
19
|
-
return tr("✅ Syntax OK")
|
20
|
-
except TemplateSyntaxError as e:
|
21
|
-
line_num = getattr(e, "lineno", 0)
|
22
|
-
return tr(
|
23
|
-
"⚠️ Warning: Syntax error: {error} at line {line}",
|
24
|
-
error=str(e),
|
25
|
-
line=line_num,
|
26
|
-
)
|
27
|
-
except Exception as e:
|
28
|
-
return tr("⚠️ Warning: Syntax error: {error}", error=str(e))
|
29
|
-
|
30
|
-
except ImportError:
|
31
|
-
# If jinja2 is not available, just check basic structure
|
32
|
-
try:
|
33
|
-
with open(path, "r", encoding="utf-8") as f:
|
34
|
-
content = f.read()
|
35
|
-
|
36
|
-
# Basic checks for common Jinja2 syntax issues
|
37
|
-
open_tags = content.count("{%")
|
38
|
-
close_tags = content.count("%}")
|
39
|
-
open_vars = content.count("{{")
|
40
|
-
close_vars = content.count("}}")
|
41
|
-
|
42
|
-
if open_tags != close_tags:
|
43
|
-
return tr("⚠️ Warning: Syntax error: Mismatched Jinja2 tags")
|
44
|
-
if open_vars != close_vars:
|
45
|
-
return tr("⚠️ Warning: Syntax error: Mismatched Jinja2 variables")
|
46
|
-
|
47
|
-
return tr("✅ Syntax OK (basic validation)")
|
48
|
-
|
49
|
-
except Exception as e:
|
50
|
-
return tr("⚠️ Warning: Syntax error: {error}", error=str(e))
|
@@ -1,27 +0,0 @@
|
|
1
|
-
from janito.i18n import tr
|
2
|
-
import re
|
3
|
-
|
4
|
-
|
5
|
-
def validate_js(path: str) -> str:
|
6
|
-
with open(path, "r", encoding="utf-8") as f:
|
7
|
-
content = f.read()
|
8
|
-
errors = []
|
9
|
-
if content.count("{") != content.count("}"):
|
10
|
-
errors.append("Unmatched curly braces { }")
|
11
|
-
if content.count("(") != content.count(")"):
|
12
|
-
errors.append("Unmatched parentheses ( )")
|
13
|
-
if content.count("[") != content.count("]"):
|
14
|
-
errors.append("Unmatched brackets [ ]")
|
15
|
-
for quote in ["'", '"', "`"]:
|
16
|
-
unescaped = re.findall(rf"(?<!\\){quote}", content)
|
17
|
-
if len(unescaped) % 2 != 0:
|
18
|
-
errors.append(f"Unclosed string literal ({quote}) detected")
|
19
|
-
if content.count("/*") != content.count("*/"):
|
20
|
-
errors.append("Unclosed block comment (/* ... */)")
|
21
|
-
if errors:
|
22
|
-
msg = tr(
|
23
|
-
"⚠️ Warning: JavaScript syntax issues found:\n{errors}",
|
24
|
-
errors="\n".join(errors),
|
25
|
-
)
|
26
|
-
return msg
|
27
|
-
return "✅ OK"
|
@@ -1,109 +0,0 @@
|
|
1
|
-
from janito.i18n import tr
|
2
|
-
import re
|
3
|
-
|
4
|
-
|
5
|
-
def validate_markdown(path: str) -> str:
|
6
|
-
with open(path, "r", encoding="utf-8") as f:
|
7
|
-
content = f.read()
|
8
|
-
lines = content.splitlines()
|
9
|
-
errors = []
|
10
|
-
errors.extend(_check_header_space(lines))
|
11
|
-
errors.extend(_check_unclosed_code_block(content))
|
12
|
-
errors.extend(_check_unclosed_links_images(lines))
|
13
|
-
errors.extend(_check_list_formatting(lines))
|
14
|
-
errors.extend(_check_unclosed_inline_code(content))
|
15
|
-
return _build_markdown_result(errors)
|
16
|
-
|
17
|
-
|
18
|
-
def _check_header_space(lines):
|
19
|
-
errors = []
|
20
|
-
for i, line in enumerate(lines, 1):
|
21
|
-
if re.match(r"^#+[^ #]", line):
|
22
|
-
errors.append(f"Line {i}: Header missing space after # | {line.strip()}")
|
23
|
-
return errors
|
24
|
-
|
25
|
-
|
26
|
-
def _check_unclosed_code_block(content):
|
27
|
-
errors = []
|
28
|
-
if content.count("```") % 2 != 0:
|
29
|
-
errors.append("Unclosed code block (```) detected")
|
30
|
-
return errors
|
31
|
-
|
32
|
-
|
33
|
-
def _check_unclosed_links_images(lines):
|
34
|
-
errors = []
|
35
|
-
for i, line in enumerate(lines, 1):
|
36
|
-
if re.search(r"\[[^\]]*\]\([^)]+$", line):
|
37
|
-
errors.append(
|
38
|
-
f"Line {i}: Unclosed link or image (missing closing parenthesis) | {line.strip()}"
|
39
|
-
)
|
40
|
-
return errors
|
41
|
-
|
42
|
-
|
43
|
-
def _is_table_line(line):
|
44
|
-
return line.lstrip().startswith("|")
|
45
|
-
|
46
|
-
|
47
|
-
def _list_item_missing_space(line):
|
48
|
-
return re.match(r"^[-*+][^ \n]", line)
|
49
|
-
|
50
|
-
|
51
|
-
def _should_skip_list_item(line):
|
52
|
-
stripped = line.strip()
|
53
|
-
return stripped.startswith("*") and stripped.endswith("*") and len(stripped) > 2
|
54
|
-
|
55
|
-
|
56
|
-
def _needs_blank_line_before_bullet(lines, i):
|
57
|
-
if i <= 1:
|
58
|
-
return False
|
59
|
-
prev_line = lines[i - 2]
|
60
|
-
prev_is_list = bool(re.match(r"^\s*[-*+] ", prev_line))
|
61
|
-
return not prev_is_list and prev_line.strip() != ""
|
62
|
-
|
63
|
-
|
64
|
-
def _needs_blank_line_before_numbered(lines, i):
|
65
|
-
if i <= 1:
|
66
|
-
return False
|
67
|
-
prev_line = lines[i - 2]
|
68
|
-
prev_is_numbered_list = bool(re.match(r"^\s*\d+\. ", prev_line))
|
69
|
-
return not prev_is_numbered_list and prev_line.strip() != ""
|
70
|
-
|
71
|
-
|
72
|
-
def _check_list_formatting(lines):
|
73
|
-
errors = []
|
74
|
-
for i, line in enumerate(lines, 1):
|
75
|
-
if _is_table_line(line):
|
76
|
-
continue
|
77
|
-
if _list_item_missing_space(line):
|
78
|
-
if not _should_skip_list_item(line):
|
79
|
-
errors.append(
|
80
|
-
f"Line {i}: List item missing space after bullet | {line.strip()}"
|
81
|
-
)
|
82
|
-
if re.match(r"^\s*[-*+] ", line):
|
83
|
-
if _needs_blank_line_before_bullet(lines, i):
|
84
|
-
errors.append(
|
85
|
-
f"Line {i}: List should be preceded by a blank line for compatibility with MkDocs and other Markdown parsers | {line.strip()}"
|
86
|
-
)
|
87
|
-
if re.match(r"^\s*\d+\. ", line):
|
88
|
-
if _needs_blank_line_before_numbered(lines, i):
|
89
|
-
errors.append(
|
90
|
-
f"Line {i}: Numbered list should be preceded by a blank line for compatibility with MkDocs and other Markdown parsers | {line.strip()}"
|
91
|
-
)
|
92
|
-
return errors
|
93
|
-
|
94
|
-
|
95
|
-
def _check_unclosed_inline_code(content):
|
96
|
-
errors = []
|
97
|
-
if content.count("`") % 2 != 0:
|
98
|
-
errors.append("Unclosed inline code (`) detected")
|
99
|
-
return errors
|
100
|
-
|
101
|
-
|
102
|
-
def _build_markdown_result(errors):
|
103
|
-
if errors:
|
104
|
-
msg = tr(
|
105
|
-
"⚠️ Warning: Markdown syntax issues found:\n{errors}",
|
106
|
-
errors="\n".join(errors),
|
107
|
-
)
|
108
|
-
return msg
|
109
|
-
return "✅ OK"
|