janito 2.32.0__py3-none-any.whl → 3.0.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 (145) hide show
  1. janito/agent/setup_agent.py +26 -0
  2. janito/agent/templates/profiles/system_prompt_template_Developer_with_Python_Tools.txt.j2 +2 -0
  3. janito/agent/templates/profiles/system_prompt_template_developer.txt.j2 +2 -0
  4. janito/agent/templates/profiles/system_prompt_template_market_analyst.txt.j2 +2 -0
  5. janito/agent/templates/profiles/system_prompt_template_model_conversation_without_tools_or_context.txt.j2 +2 -0
  6. janito/cli/cli_commands/check_tools.py +212 -0
  7. janito/cli/cli_commands/list_plugins.py +52 -43
  8. janito/cli/core/getters.py +3 -0
  9. janito/cli/main_cli.py +9 -12
  10. janito/drivers/openai/driver.py +1 -0
  11. janito/drivers/zai/driver.py +1 -0
  12. janito/llm/auth_utils.py +14 -5
  13. janito/plugin_system/__init__.py +10 -0
  14. janito/{plugins → plugin_system}/base.py +5 -2
  15. janito/{plugins/core_loader_fixed.py → plugin_system/core_loader.py} +45 -26
  16. janito/plugin_system/core_loader_fixed.py +149 -0
  17. janito/plugins/__init__.py +31 -12
  18. janito/plugins/auto_loader_fixed.py +12 -11
  19. janito/plugins/builtin.py +15 -1
  20. janito/plugins/core/__init__.py +7 -0
  21. janito/plugins/core/codeanalyzer/__init__.py +43 -0
  22. janito/plugins/core/filemanager/__init__.py +124 -0
  23. janito/plugins/core/filemanager/tools/create_file.py +87 -0
  24. janito/plugins/core/filemanager/tools/replace_text_in_file.py +270 -0
  25. janito/plugins/core/imagedisplay/__init__.py +14 -0
  26. janito/plugins/core/imagedisplay/plugin.py +51 -0
  27. janito/plugins/core/imagedisplay/tools/__init__.py +1 -0
  28. janito/plugins/core/imagedisplay/tools/show_image.py +83 -0
  29. janito/{tools/adapters/local → plugins/core/imagedisplay/tools}/show_image_grid.py +13 -5
  30. janito/plugins/core/system/__init__.py +23 -0
  31. janito/plugins/core_adapter.py +11 -9
  32. janito/plugins/dev/__init__.py +7 -0
  33. janito/plugins/dev/pythondev/__init__.py +37 -0
  34. janito/plugins/dev/visualization/__init__.py +23 -0
  35. janito/plugins/discovery.py +5 -5
  36. janito/plugins/example_plugin.py +108 -0
  37. janito/plugins/manager.py +1 -1
  38. janito/plugins/tools/__init__.py +10 -0
  39. janito/{tools/adapters/local → plugins/tools}/ask_user.py +3 -3
  40. janito/plugins/tools/copy_file.py +87 -0
  41. janito/plugins/tools/core_tools_plugin.py +88 -0
  42. janito/plugins/tools/create_directory.py +70 -0
  43. janito/{tools/adapters/local → plugins/tools}/create_file.py +4 -4
  44. janito/plugins/tools/decorators.py +19 -0
  45. janito/plugins/tools/delete_text_in_file.py +134 -0
  46. janito/plugins/tools/fetch_url.py +466 -0
  47. janito/plugins/tools/find_files.py +143 -0
  48. janito/plugins/tools/get_file_outline/__init__.py +7 -0
  49. janito/plugins/tools/get_file_outline/core.py +122 -0
  50. janito/plugins/tools/get_file_outline/java_outline.py +47 -0
  51. janito/plugins/tools/get_file_outline/markdown_outline.py +14 -0
  52. janito/plugins/tools/get_file_outline/python_outline.py +303 -0
  53. janito/plugins/tools/get_file_outline/search_outline.py +36 -0
  54. janito/plugins/tools/move_file.py +131 -0
  55. janito/plugins/tools/open_html_in_browser.py +51 -0
  56. janito/plugins/tools/open_url.py +37 -0
  57. janito/plugins/tools/python_code_run.py +172 -0
  58. janito/plugins/tools/python_command_run.py +171 -0
  59. janito/plugins/tools/python_file_run.py +172 -0
  60. janito/plugins/tools/read_chart.py +259 -0
  61. janito/plugins/tools/read_files.py +58 -0
  62. janito/plugins/tools/remove_directory.py +55 -0
  63. janito/plugins/tools/remove_file.py +58 -0
  64. janito/{tools/adapters/local → plugins/tools}/replace_text_in_file.py +4 -4
  65. janito/plugins/tools/run_bash_command.py +183 -0
  66. janito/plugins/tools/run_powershell_command.py +218 -0
  67. janito/plugins/tools/search_text/__init__.py +7 -0
  68. janito/plugins/tools/search_text/core.py +205 -0
  69. janito/plugins/tools/search_text/match_lines.py +67 -0
  70. janito/plugins/tools/search_text/pattern_utils.py +73 -0
  71. janito/plugins/tools/search_text/traverse_directory.py +145 -0
  72. janito/{tools/adapters/local → plugins/tools}/show_image.py +15 -6
  73. janito/plugins/tools/show_image_grid.py +85 -0
  74. janito/plugins/tools/validate_file_syntax/__init__.py +7 -0
  75. janito/plugins/tools/validate_file_syntax/core.py +114 -0
  76. janito/plugins/tools/validate_file_syntax/css_validator.py +35 -0
  77. janito/plugins/tools/validate_file_syntax/html_validator.py +100 -0
  78. janito/plugins/tools/validate_file_syntax/jinja2_validator.py +50 -0
  79. janito/plugins/tools/validate_file_syntax/js_validator.py +27 -0
  80. janito/plugins/tools/validate_file_syntax/json_validator.py +6 -0
  81. janito/plugins/tools/validate_file_syntax/markdown_validator.py +109 -0
  82. janito/plugins/tools/validate_file_syntax/ps1_validator.py +32 -0
  83. janito/plugins/tools/validate_file_syntax/python_validator.py +5 -0
  84. janito/plugins/tools/validate_file_syntax/xml_validator.py +11 -0
  85. janito/plugins/tools/validate_file_syntax/yaml_validator.py +6 -0
  86. janito/plugins/tools/view_file.py +172 -0
  87. janito/plugins/ui/__init__.py +7 -0
  88. janito/plugins/ui/userinterface/__init__.py +16 -0
  89. janito/plugins/ui/userinterface/tools/ask_user.py +110 -0
  90. janito/plugins/web/__init__.py +7 -0
  91. janito/plugins/web/webtools/__init__.py +33 -0
  92. janito/{tools/adapters/local → plugins/web/webtools/tools}/fetch_url.py +37 -27
  93. janito/tools/__init__.py +31 -7
  94. janito/tools/adapters/__init__.py +6 -1
  95. janito/tools/adapters/local/__init__.py +7 -70
  96. janito/tools/cli_initializer.py +88 -0
  97. janito/tools/function_adapter.py +93 -16
  98. janito/tools/initialize.py +70 -0
  99. {janito-2.32.0.dist-info → janito-3.0.0.dist-info}/METADATA +1 -2
  100. {janito-2.32.0.dist-info → janito-3.0.0.dist-info}/RECORD +144 -76
  101. janito/plugins/core_loader.py +0 -120
  102. /janito/{tools/adapters/local → plugins/core/codeanalyzer/tools}/get_file_outline/__init__.py +0 -0
  103. /janito/{tools/adapters/local → plugins/core/codeanalyzer/tools}/get_file_outline/core.py +0 -0
  104. /janito/{tools/adapters/local → plugins/core/codeanalyzer/tools}/get_file_outline/java_outline.py +0 -0
  105. /janito/{tools/adapters/local → plugins/core/codeanalyzer/tools}/get_file_outline/markdown_outline.py +0 -0
  106. /janito/{tools/adapters/local → plugins/core/codeanalyzer/tools}/get_file_outline/python_outline.py +0 -0
  107. /janito/{tools/adapters/local → plugins/core/codeanalyzer/tools}/get_file_outline/search_outline.py +0 -0
  108. /janito/{tools/adapters/local → plugins/core/codeanalyzer/tools}/search_text/__init__.py +0 -0
  109. /janito/{tools/adapters/local → plugins/core/codeanalyzer/tools}/search_text/core.py +0 -0
  110. /janito/{tools/adapters/local → plugins/core/codeanalyzer/tools}/search_text/match_lines.py +0 -0
  111. /janito/{tools/adapters/local → plugins/core/codeanalyzer/tools}/search_text/pattern_utils.py +0 -0
  112. /janito/{tools/adapters/local → plugins/core/codeanalyzer/tools}/search_text/traverse_directory.py +0 -0
  113. /janito/{tools/adapters/local → plugins/core/filemanager/tools}/copy_file.py +0 -0
  114. /janito/{tools/adapters/local → plugins/core/filemanager/tools}/create_directory.py +0 -0
  115. /janito/{tools/adapters/local → plugins/core/filemanager/tools}/delete_text_in_file.py +0 -0
  116. /janito/{tools/adapters/local → plugins/core/filemanager/tools}/find_files.py +0 -0
  117. /janito/{tools/adapters/local → plugins/core/filemanager/tools}/move_file.py +0 -0
  118. /janito/{tools/adapters/local → plugins/core/filemanager/tools}/read_files.py +0 -0
  119. /janito/{tools/adapters/local → plugins/core/filemanager/tools}/remove_directory.py +0 -0
  120. /janito/{tools/adapters/local → plugins/core/filemanager/tools}/remove_file.py +0 -0
  121. /janito/{tools/adapters/local → plugins/core/filemanager/tools}/validate_file_syntax/__init__.py +0 -0
  122. /janito/{tools/adapters/local → plugins/core/filemanager/tools}/validate_file_syntax/core.py +0 -0
  123. /janito/{tools/adapters/local → plugins/core/filemanager/tools}/validate_file_syntax/css_validator.py +0 -0
  124. /janito/{tools/adapters/local → plugins/core/filemanager/tools}/validate_file_syntax/html_validator.py +0 -0
  125. /janito/{tools/adapters/local → plugins/core/filemanager/tools}/validate_file_syntax/jinja2_validator.py +0 -0
  126. /janito/{tools/adapters/local → plugins/core/filemanager/tools}/validate_file_syntax/js_validator.py +0 -0
  127. /janito/{tools/adapters/local → plugins/core/filemanager/tools}/validate_file_syntax/json_validator.py +0 -0
  128. /janito/{tools/adapters/local → plugins/core/filemanager/tools}/validate_file_syntax/markdown_validator.py +0 -0
  129. /janito/{tools/adapters/local → plugins/core/filemanager/tools}/validate_file_syntax/ps1_validator.py +0 -0
  130. /janito/{tools/adapters/local → plugins/core/filemanager/tools}/validate_file_syntax/python_validator.py +0 -0
  131. /janito/{tools/adapters/local → plugins/core/filemanager/tools}/validate_file_syntax/xml_validator.py +0 -0
  132. /janito/{tools/adapters/local → plugins/core/filemanager/tools}/validate_file_syntax/yaml_validator.py +0 -0
  133. /janito/{tools/adapters/local → plugins/core/filemanager/tools}/view_file.py +0 -0
  134. /janito/{tools/adapters/local → plugins/core/system/tools}/run_bash_command.py +0 -0
  135. /janito/{tools/adapters/local → plugins/core/system/tools}/run_powershell_command.py +0 -0
  136. /janito/{tools/adapters/local → plugins/dev/pythondev/tools}/python_code_run.py +0 -0
  137. /janito/{tools/adapters/local → plugins/dev/pythondev/tools}/python_command_run.py +0 -0
  138. /janito/{tools/adapters/local → plugins/dev/pythondev/tools}/python_file_run.py +0 -0
  139. /janito/{tools/adapters/local → plugins/dev/visualization/tools}/read_chart.py +0 -0
  140. /janito/{tools/adapters/local → plugins/web/webtools/tools}/open_html_in_browser.py +0 -0
  141. /janito/{tools/adapters/local → plugins/web/webtools/tools}/open_url.py +0 -0
  142. {janito-2.32.0.dist-info → janito-3.0.0.dist-info}/WHEEL +0 -0
  143. {janito-2.32.0.dist-info → janito-3.0.0.dist-info}/entry_points.txt +0 -0
  144. {janito-2.32.0.dist-info → janito-3.0.0.dist-info}/licenses/LICENSE +0 -0
  145. {janito-2.32.0.dist-info → janito-3.0.0.dist-info}/top_level.txt +0 -0
@@ -1 +1,6 @@
1
- # Tools providers package: for plug-and-play tool collections, integrations, and adapters.
1
+ """
2
+ Tools providers package: for plug-and-play tool collections, integrations, and adapters.
3
+
4
+ This package contains the core adapter infrastructure for managing tools,
5
+ while the actual tool implementations have been moved to the plugins system.
6
+ """
@@ -1,73 +1,10 @@
1
- from .adapter import LocalToolsAdapter
2
-
3
- from .ask_user import AskUserTool
4
- from .copy_file import CopyFileTool
5
- from .create_directory import CreateDirectoryTool
6
- from .create_file import CreateFileTool
7
- from .fetch_url import FetchUrlTool
8
- from .find_files import FindFilesTool
9
- from .view_file import ViewFileTool
10
- from .read_files import ReadFilesTool
11
- from .move_file import MoveFileTool
12
- from .open_url import OpenUrlTool
13
- from .open_html_in_browser import OpenHtmlInBrowserTool
14
- from .python_code_run import PythonCodeRunTool
15
- from .python_command_run import PythonCommandRunTool
16
- from .python_file_run import PythonFileRunTool
17
- from .remove_directory import RemoveDirectoryTool
18
- from .remove_file import RemoveFileTool
19
- from .replace_text_in_file import ReplaceTextInFileTool
20
- from .run_bash_command import RunBashCommandTool
21
- from .run_powershell_command import RunPowershellCommandTool
22
- from .get_file_outline.core import GetFileOutlineTool
23
- from .get_file_outline.search_outline import SearchOutlineTool
24
- from .search_text.core import SearchTextTool
25
- from .validate_file_syntax.core import ValidateFileSyntaxTool
26
- from .read_chart import ReadChartTool
27
- from .show_image import ShowImageTool
28
- from .show_image_grid import ShowImageGridTool
29
-
30
- from janito.tools.tool_base import ToolPermissions
31
- import os
32
- from janito.tools.permissions import get_global_allowed_permissions
33
-
34
- # Singleton tools adapter with all standard tools registered
35
- local_tools_adapter = LocalToolsAdapter(workdir=os.getcwd())
1
+ """
2
+ Local tools adapter for janito.
36
3
 
4
+ This package provides the LocalToolsAdapter class which manages tool registration
5
+ and execution for local, in-process tools.
6
+ """
37
7
 
38
- def get_local_tools_adapter(workdir=None):
39
- return LocalToolsAdapter(workdir=workdir or os.getcwd())
40
-
41
-
42
- # Register tools
43
- for tool_class in [
44
- AskUserTool,
45
- CopyFileTool,
46
- CreateDirectoryTool,
47
- CreateFileTool,
48
- FetchUrlTool,
49
- FindFilesTool,
50
- ViewFileTool,
51
- ReadFilesTool,
52
- MoveFileTool,
53
- OpenUrlTool,
54
- OpenHtmlInBrowserTool,
55
- PythonCodeRunTool,
56
- PythonCommandRunTool,
57
- PythonFileRunTool,
58
- RemoveDirectoryTool,
59
- RemoveFileTool,
60
- ReplaceTextInFileTool,
61
- RunBashCommandTool,
62
- RunPowershellCommandTool,
63
- GetFileOutlineTool,
64
- SearchOutlineTool,
65
- SearchTextTool,
66
- ValidateFileSyntaxTool,
67
- ReadChartTool,
68
- ShowImageTool,
69
- ShowImageGridTool,
70
- ]:
71
- local_tools_adapter.register_tool(tool_class)
8
+ from .adapter import LocalToolsAdapter
72
9
 
73
- # DEBUG: Print registered tools at startup
10
+ __all__ = ["LocalToolsAdapter"]
@@ -0,0 +1,88 @@
1
+ """
2
+ CLI-specific tool initialization for janito.
3
+
4
+ This module provides functions to initialize tools specifically for CLI usage,
5
+ handling circular imports and ensuring proper registration.
6
+ """
7
+
8
+ import sys
9
+ from pathlib import Path
10
+ from typing import List, Optional
11
+
12
+ # Ensure current directory is in path
13
+ sys.path.insert(0, str(Path.cwd()))
14
+
15
+
16
+ def initialize_cli_tools():
17
+ """Initialize tools for CLI usage, avoiding circular imports."""
18
+ try:
19
+ from janito.tools.adapters.local.adapter import LocalToolsAdapter
20
+ from janito.plugin_system.core_loader_fixed import load_core_plugin
21
+ from janito.tools.permissions import set_global_allowed_permissions
22
+ from janito.tools.tool_base import ToolPermissions
23
+
24
+ # Create adapter
25
+ adapter = LocalToolsAdapter()
26
+
27
+ # Set permissions for CLI
28
+ set_global_allowed_permissions(
29
+ ToolPermissions(read=True, write=True, execute=True)
30
+ )
31
+
32
+ # Core plugins to load
33
+ core_plugins = [
34
+ "core.filemanager",
35
+ "core.codeanalyzer",
36
+ "core.system",
37
+ "core.imagedisplay",
38
+ "dev.pythondev",
39
+ "dev.visualization",
40
+ ]
41
+
42
+ loaded_count = 0
43
+ for plugin_name in core_plugins:
44
+ plugin = load_core_plugin(plugin_name)
45
+ if plugin:
46
+ tools = plugin.get_tools()
47
+ for tool_class in tools:
48
+ try:
49
+ adapter.register_tool(tool_class)
50
+ loaded_count += 1
51
+ except ValueError:
52
+ # Tool already registered, skip
53
+ pass
54
+
55
+ return adapter, loaded_count
56
+
57
+ except Exception as e:
58
+ print(f"Error initializing CLI tools: {e}", file=sys.stderr)
59
+ return None, 0
60
+
61
+
62
+ def get_cli_tools_adapter():
63
+ """Get a CLI-initialized tools adapter."""
64
+ adapter, count = initialize_cli_tools()
65
+ if adapter and count > 0:
66
+ return adapter
67
+ return None
68
+
69
+
70
+ def list_cli_tools():
71
+ """List all available CLI tools."""
72
+ adapter = get_cli_tools_adapter()
73
+ if not adapter:
74
+ return []
75
+
76
+ return adapter.list_tools()
77
+
78
+
79
+ if __name__ == "__main__":
80
+ adapter, count = initialize_cli_tools()
81
+ if adapter:
82
+ tools = adapter.list_tools()
83
+ print(f"CLI initialized {count} tools")
84
+ print(f"Available tools: {len(tools)}")
85
+ for tool in sorted(tools):
86
+ print(f" - {tool}")
87
+ else:
88
+ print("Failed to initialize CLI tools")
@@ -11,55 +11,132 @@ from janito.tools.tool_base import ToolBase, ToolPermissions
11
11
 
12
12
  class FunctionToolAdapter(ToolBase):
13
13
  """Adapter that wraps a function into a ToolBase class."""
14
-
14
+
15
15
  def __init__(self, func, tool_name: str = None, description: str = None):
16
16
  super().__init__()
17
17
  self._func = func
18
- self.tool_name = tool_name or func.__name__
18
+ self.tool_name = tool_name or getattr(func, "tool_name", func.__name__)
19
19
  self._description = description or func.__doc__ or f"Tool: {self.tool_name}"
20
20
  self.permissions = ToolPermissions(read=True, write=True, execute=True)
21
-
22
- def run(self, **kwargs) -> Any:
21
+
22
+ def run(
23
+ self,
24
+ path: str = None,
25
+ content: str = None,
26
+ overwrite: bool = None,
27
+ sources: str = None,
28
+ target: str = None,
29
+ recursive: bool = None,
30
+ from_line: int = None,
31
+ to_line: int = None,
32
+ search_text: str = None,
33
+ replacement_text: str = None,
34
+ use_regex: bool = None,
35
+ case_sensitive: bool = None,
36
+ max_depth: int = None,
37
+ include_gitignored: bool = None,
38
+ timeout: int = None,
39
+ require_confirmation: bool = None,
40
+ data: dict = None,
41
+ title: str = None,
42
+ width: int = None,
43
+ height: int = None,
44
+ query: str = None,
45
+ paths: str = None,
46
+ src_path: str = None,
47
+ dest_path: str = None,
48
+ code: str = None,
49
+ pattern: str = None,
50
+ ) -> str:
23
51
  """Execute the wrapped function."""
24
- return self._func(**kwargs)
25
-
52
+ # Build kwargs from non-None parameters
53
+ import inspect
54
+
55
+ sig = inspect.signature(self._func)
56
+ filtered_kwargs = {}
57
+
58
+ # Map parameter names to their actual values
59
+ param_map = {
60
+ "path": path,
61
+ "content": content,
62
+ "overwrite": overwrite,
63
+ "sources": sources,
64
+ "target": target,
65
+ "recursive": recursive,
66
+ "from_line": from_line,
67
+ "to_line": to_line,
68
+ "search_text": search_text,
69
+ "replacement_text": replacement_text,
70
+ "use_regex": use_regex,
71
+ "case_sensitive": case_sensitive,
72
+ "max_depth": max_depth,
73
+ "include_gitignored": include_gitignored,
74
+ "timeout": timeout,
75
+ "require_confirmation": require_confirmation,
76
+ "data": data,
77
+ "title": title,
78
+ "width": width,
79
+ "height": height,
80
+ "query": query,
81
+ "paths": paths,
82
+ "src_path": src_path,
83
+ "dest_path": dest_path,
84
+ "code": code,
85
+ "pattern": pattern,
86
+ }
87
+
88
+ # Only include parameters that exist in the function signature
89
+ for name, param in sig.parameters.items():
90
+ if name in param_map and param_map[name] is not None:
91
+ filtered_kwargs[name] = param_map[name]
92
+
93
+ result = self._func(**filtered_kwargs)
94
+ return str(result) if result is not None else ""
95
+
26
96
  def get_signature(self) -> Dict[str, Any]:
27
97
  """Get function signature for documentation."""
28
98
  sig = inspect.signature(self._func)
29
99
  type_hints = get_type_hints(self._func)
30
-
100
+
31
101
  params = {}
32
102
  for name, param in sig.parameters.items():
33
103
  param_info = {
34
104
  "type": str(type_hints.get(name, Any)),
35
- "default": param.default if param.default != inspect.Parameter.empty else None,
105
+ "default": (
106
+ param.default if param.default != inspect.Parameter.empty else None
107
+ ),
36
108
  "required": param.default == inspect.Parameter.empty,
37
109
  }
38
110
  params[name] = param_info
39
-
111
+
40
112
  return {
41
113
  "name": self.tool_name,
42
114
  "description": self._description,
43
115
  "parameters": params,
44
- "return_type": str(type_hints.get("return", Any))
116
+ "return_type": str(type_hints.get("return", Any)),
45
117
  }
46
118
 
47
119
 
48
120
  def create_function_tool(func, tool_name: str = None, description: str = None) -> type:
49
121
  """
50
122
  Create a ToolBase class from a function.
51
-
123
+
52
124
  Args:
53
125
  func: The function to wrap
54
126
  tool_name: Optional custom tool name
55
127
  description: Optional custom description
56
-
128
+
57
129
  Returns:
58
130
  A ToolBase subclass that wraps the function
59
131
  """
60
-
132
+ # Resolve tool_name in outer scope
133
+ resolved_tool_name = tool_name or getattr(func, "tool_name", func.__name__)
134
+
61
135
  class DynamicFunctionTool(FunctionToolAdapter):
136
+ permissions = ToolPermissions(read=True, write=True, execute=True)
137
+ tool_name = resolved_tool_name
138
+
62
139
  def __init__(self):
63
- super().__init__(func, tool_name, description)
64
-
65
- return DynamicFunctionTool
140
+ super().__init__(func, DynamicFunctionTool.tool_name, description)
141
+
142
+ return DynamicFunctionTool
@@ -0,0 +1,70 @@
1
+ """
2
+ Initialize janito tools for CLI and programmatic usage.
3
+
4
+ This module provides functions to load core plugins and register their tools
5
+ with the local tools adapter.
6
+ """
7
+
8
+ import sys
9
+ from pathlib import Path
10
+ from typing import List, Optional
11
+
12
+ from janito.plugin_system.core_loader_fixed import load_core_plugin
13
+ from janito.tools.adapters.local.adapter import LocalToolsAdapter
14
+
15
+
16
+ def initialize_tools(adapter: Optional[LocalToolsAdapter] = None) -> LocalToolsAdapter:
17
+ """
18
+ Initialize all janito tools by loading core plugins and registering tools.
19
+
20
+ Args:
21
+ adapter: LocalToolsAdapter instance to register tools with.
22
+ If None, creates a new instance.
23
+
24
+ Returns:
25
+ LocalToolsAdapter with all tools registered.
26
+ """
27
+ if adapter is None:
28
+ adapter = LocalToolsAdapter()
29
+
30
+ # Core plugins to load
31
+ core_plugins = [
32
+ "core.filemanager",
33
+ "core.codeanalyzer",
34
+ "core.system",
35
+ "core.imagedisplay",
36
+ "dev.pythondev",
37
+ "dev.visualization",
38
+ ]
39
+
40
+ loaded_count = 0
41
+ for plugin_name in core_plugins:
42
+ plugin = load_core_plugin(plugin_name)
43
+ if plugin:
44
+ tools = plugin.get_tools()
45
+ for tool_class in tools:
46
+ adapter.register_tool(tool_class)
47
+ loaded_count += 1
48
+
49
+ return adapter
50
+
51
+
52
+ def get_initialized_adapter() -> LocalToolsAdapter:
53
+ """Get a pre-initialized LocalToolsAdapter with all tools registered."""
54
+ return initialize_tools()
55
+
56
+
57
+ def list_available_tools() -> List[str]:
58
+ """Get a list of all available tool names."""
59
+ adapter = get_initialized_adapter()
60
+ return sorted(list(adapter._tools.keys()))
61
+
62
+
63
+ if __name__ == "__main__":
64
+ adapter = initialize_tools()
65
+ tools = sorted(list(adapter._tools.keys()))
66
+
67
+ print(f"Initialized {len(tools)} tools")
68
+ print("Available tools:")
69
+ for tool_name in tools:
70
+ print(f" - {tool_name}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: janito
3
- Version: 2.32.0
3
+ Version: 3.0.0
4
4
  Summary: A new Python package called janito.
5
5
  Author-email: João Pinto <janito@ikignosis.org>
6
6
  Project-URL: Homepage, https://github.com/ikignosis/janito
@@ -30,7 +30,6 @@ Requires-Dist: black; extra == "dev"
30
30
  Requires-Dist: questionary>=2.0.1; extra == "dev"
31
31
  Requires-Dist: setuptools_scm>=8.0; extra == "dev"
32
32
  Provides-Extra: coder
33
- Requires-Dist: janito-coder; extra == "coder"
34
33
  Dynamic: license-file
35
34
 
36
35
  # nctl