janito 3.1.0__py3-none-any.whl → 3.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. janito/cli/chat_mode/bindings.py +0 -26
  2. janito/cli/chat_mode/session.py +1 -7
  3. janito/cli/cli_commands/list_plugins.py +8 -13
  4. janito/cli/prompt_core.py +9 -19
  5. janito/llm/agent.py +17 -30
  6. janito/llm/driver.py +0 -7
  7. janito/plugins/__init__.py +21 -29
  8. janito/plugins/__main__.py +85 -0
  9. janito/plugins/base.py +57 -0
  10. janito/plugins/builtin.py +1 -1
  11. janito/plugins/core/filemanager/tools/copy_file.py +25 -1
  12. janito/plugins/core/filemanager/tools/create_directory.py +28 -1
  13. janito/plugins/core/filemanager/tools/create_file.py +25 -1
  14. janito/plugins/core/filemanager/tools/delete_text_in_file.py +1 -0
  15. janito/plugins/core/imagedisplay/plugin.py +1 -1
  16. janito/plugins/core_loader.py +144 -0
  17. janito/plugins/discovery.py +3 -3
  18. janito/plugins/example_plugin.py +1 -1
  19. janito/plugins/manager.py +1 -1
  20. janito/plugins_backup_20250825_070018/__init__.py +36 -0
  21. janito/plugins_backup_20250825_070018/builtin.py +102 -0
  22. janito/plugins_backup_20250825_070018/config.py +84 -0
  23. janito/plugins_backup_20250825_070018/core/__init__.py +7 -0
  24. janito/plugins_backup_20250825_070018/core/codeanalyzer/__init__.py +43 -0
  25. janito/plugins_backup_20250825_070018/core/codeanalyzer/tools/get_file_outline/__init__.py +1 -0
  26. janito/plugins_backup_20250825_070018/core/codeanalyzer/tools/get_file_outline/core.py +122 -0
  27. janito/plugins_backup_20250825_070018/core/codeanalyzer/tools/search_text/__init__.py +1 -0
  28. janito/plugins_backup_20250825_070018/core/codeanalyzer/tools/search_text/core.py +205 -0
  29. janito/plugins_backup_20250825_070018/core/filemanager/__init__.py +124 -0
  30. janito/plugins_backup_20250825_070018/core/filemanager/tools/copy_file.py +87 -0
  31. janito/plugins_backup_20250825_070018/core/filemanager/tools/create_directory.py +70 -0
  32. janito/plugins_backup_20250825_070018/core/filemanager/tools/create_file.py +87 -0
  33. janito/plugins_backup_20250825_070018/core/filemanager/tools/delete_text_in_file.py +135 -0
  34. janito/plugins_backup_20250825_070018/core/filemanager/tools/find_files.py +143 -0
  35. janito/plugins_backup_20250825_070018/core/filemanager/tools/move_file.py +131 -0
  36. janito/plugins_backup_20250825_070018/core/filemanager/tools/read_files.py +58 -0
  37. janito/plugins_backup_20250825_070018/core/filemanager/tools/remove_directory.py +55 -0
  38. janito/plugins_backup_20250825_070018/core/filemanager/tools/remove_file.py +58 -0
  39. janito/plugins_backup_20250825_070018/core/filemanager/tools/replace_text_in_file.py +270 -0
  40. janito/plugins_backup_20250825_070018/core/filemanager/tools/validate_file_syntax/__init__.py +1 -0
  41. janito/plugins_backup_20250825_070018/core/filemanager/tools/validate_file_syntax/core.py +114 -0
  42. janito/plugins_backup_20250825_070018/core/filemanager/tools/view_file.py +172 -0
  43. janito/plugins_backup_20250825_070018/core/imagedisplay/__init__.py +14 -0
  44. janito/plugins_backup_20250825_070018/core/imagedisplay/plugin.py +51 -0
  45. janito/plugins_backup_20250825_070018/core/imagedisplay/tools/__init__.py +1 -0
  46. janito/plugins_backup_20250825_070018/core/imagedisplay/tools/show_image.py +83 -0
  47. janito/plugins_backup_20250825_070018/core/imagedisplay/tools/show_image_grid.py +84 -0
  48. janito/plugins_backup_20250825_070018/core/system/__init__.py +23 -0
  49. janito/plugins_backup_20250825_070018/core/system/tools/run_bash_command.py +183 -0
  50. janito/plugins_backup_20250825_070018/core/system/tools/run_powershell_command.py +218 -0
  51. janito/plugins_backup_20250825_070018/dev/__init__.py +7 -0
  52. janito/plugins_backup_20250825_070018/dev/pythondev/__init__.py +37 -0
  53. janito/plugins_backup_20250825_070018/dev/pythondev/tools/python_code_run.py +172 -0
  54. janito/plugins_backup_20250825_070018/dev/pythondev/tools/python_command_run.py +171 -0
  55. janito/plugins_backup_20250825_070018/dev/pythondev/tools/python_file_run.py +172 -0
  56. janito/plugins_backup_20250825_070018/dev/visualization/__init__.py +23 -0
  57. janito/plugins_backup_20250825_070018/dev/visualization/tools/read_chart.py +259 -0
  58. janito/plugins_backup_20250825_070018/discovery.py +289 -0
  59. janito/plugins_backup_20250825_070018/example_plugin.py +108 -0
  60. janito/plugins_backup_20250825_070018/manager.py +243 -0
  61. janito/{plugins → plugins_backup_20250825_070018}/tools/delete_text_in_file.py +1 -0
  62. janito/plugins_backup_20250825_070018/tools/get_file_outline/java_outline.py +47 -0
  63. janito/plugins_backup_20250825_070018/tools/get_file_outline/markdown_outline.py +14 -0
  64. janito/plugins_backup_20250825_070018/tools/get_file_outline/python_outline.py +303 -0
  65. janito/plugins_backup_20250825_070018/tools/get_file_outline/search_outline.py +36 -0
  66. janito/plugins_backup_20250825_070018/tools/search_text/match_lines.py +67 -0
  67. janito/plugins_backup_20250825_070018/tools/search_text/pattern_utils.py +73 -0
  68. janito/plugins_backup_20250825_070018/tools/search_text/traverse_directory.py +145 -0
  69. janito/plugins_backup_20250825_070018/tools/validate_file_syntax/css_validator.py +35 -0
  70. janito/plugins_backup_20250825_070018/tools/validate_file_syntax/html_validator.py +100 -0
  71. janito/plugins_backup_20250825_070018/tools/validate_file_syntax/jinja2_validator.py +50 -0
  72. janito/plugins_backup_20250825_070018/tools/validate_file_syntax/js_validator.py +27 -0
  73. janito/plugins_backup_20250825_070018/tools/validate_file_syntax/json_validator.py +6 -0
  74. janito/plugins_backup_20250825_070018/tools/validate_file_syntax/markdown_validator.py +109 -0
  75. janito/plugins_backup_20250825_070018/tools/validate_file_syntax/ps1_validator.py +32 -0
  76. janito/plugins_backup_20250825_070018/tools/validate_file_syntax/python_validator.py +5 -0
  77. janito/plugins_backup_20250825_070018/tools/validate_file_syntax/xml_validator.py +11 -0
  78. janito/plugins_backup_20250825_070018/tools/validate_file_syntax/yaml_validator.py +6 -0
  79. janito/plugins_backup_20250825_070018/ui/__init__.py +7 -0
  80. janito/plugins_backup_20250825_070018/ui/userinterface/__init__.py +16 -0
  81. janito/plugins_backup_20250825_070018/ui/userinterface/tools/ask_user.py +110 -0
  82. janito/plugins_backup_20250825_070018/web/__init__.py +7 -0
  83. janito/plugins_backup_20250825_070018/web/webtools/__init__.py +33 -0
  84. janito/plugins_backup_20250825_070018/web/webtools/tools/fetch_url.py +458 -0
  85. janito/plugins_backup_20250825_070018/web/webtools/tools/open_html_in_browser.py +51 -0
  86. janito/plugins_backup_20250825_070018/web/webtools/tools/open_url.py +37 -0
  87. janito/tools/base.py +31 -1
  88. janito/tools/cli_initializer.py +1 -1
  89. janito/tools/function_adapter.py +35 -1
  90. janito/tools/initialize.py +1 -1
  91. janito/tools/tool_base.py +142 -114
  92. janito/tools/tools_schema.py +12 -6
  93. {janito-3.1.0.dist-info → janito-3.3.0.dist-info}/METADATA +1 -1
  94. {janito-3.1.0.dist-info → janito-3.3.0.dist-info}/RECORD +154 -87
  95. janito/llm/cancellation_manager.py +0 -62
  96. janito/llm/enter_cancellation.py +0 -93
  97. /janito/{plugin_system → plugin_system_backup_20250825_070018}/__init__.py +0 -0
  98. /janito/{plugin_system → plugin_system_backup_20250825_070018}/base.py +0 -0
  99. /janito/{plugin_system → plugin_system_backup_20250825_070018}/core_loader.py +0 -0
  100. /janito/{plugin_system → plugin_system_backup_20250825_070018}/core_loader_fixed.py +0 -0
  101. /janito/{plugins → plugins_backup_20250825_070018}/auto_loader.py +0 -0
  102. /janito/{plugins → plugins_backup_20250825_070018}/auto_loader_fixed.py +0 -0
  103. /janito/{plugins → plugins_backup_20250825_070018/core/codeanalyzer}/tools/get_file_outline/java_outline.py +0 -0
  104. /janito/{plugins → plugins_backup_20250825_070018/core/codeanalyzer}/tools/get_file_outline/markdown_outline.py +0 -0
  105. /janito/{plugins → plugins_backup_20250825_070018/core/codeanalyzer}/tools/get_file_outline/python_outline.py +0 -0
  106. /janito/{plugins → plugins_backup_20250825_070018/core/codeanalyzer}/tools/get_file_outline/search_outline.py +0 -0
  107. /janito/{plugins → plugins_backup_20250825_070018/core/codeanalyzer}/tools/search_text/match_lines.py +0 -0
  108. /janito/{plugins → plugins_backup_20250825_070018/core/codeanalyzer}/tools/search_text/pattern_utils.py +0 -0
  109. /janito/{plugins → plugins_backup_20250825_070018/core/codeanalyzer}/tools/search_text/traverse_directory.py +0 -0
  110. /janito/{plugins → plugins_backup_20250825_070018/core/filemanager}/tools/validate_file_syntax/css_validator.py +0 -0
  111. /janito/{plugins → plugins_backup_20250825_070018/core/filemanager}/tools/validate_file_syntax/html_validator.py +0 -0
  112. /janito/{plugins → plugins_backup_20250825_070018/core/filemanager}/tools/validate_file_syntax/jinja2_validator.py +0 -0
  113. /janito/{plugins → plugins_backup_20250825_070018/core/filemanager}/tools/validate_file_syntax/js_validator.py +0 -0
  114. /janito/{plugins → plugins_backup_20250825_070018/core/filemanager}/tools/validate_file_syntax/json_validator.py +0 -0
  115. /janito/{plugins → plugins_backup_20250825_070018/core/filemanager}/tools/validate_file_syntax/markdown_validator.py +0 -0
  116. /janito/{plugins → plugins_backup_20250825_070018/core/filemanager}/tools/validate_file_syntax/ps1_validator.py +0 -0
  117. /janito/{plugins → plugins_backup_20250825_070018/core/filemanager}/tools/validate_file_syntax/python_validator.py +0 -0
  118. /janito/{plugins → plugins_backup_20250825_070018/core/filemanager}/tools/validate_file_syntax/xml_validator.py +0 -0
  119. /janito/{plugins → plugins_backup_20250825_070018/core/filemanager}/tools/validate_file_syntax/yaml_validator.py +0 -0
  120. /janito/{plugins → plugins_backup_20250825_070018}/core_adapter.py +0 -0
  121. /janito/{plugins → plugins_backup_20250825_070018}/discovery_core.py +0 -0
  122. /janito/{plugins → plugins_backup_20250825_070018}/tools/__init__.py +0 -0
  123. /janito/{plugins → plugins_backup_20250825_070018}/tools/ask_user.py +0 -0
  124. /janito/{plugins → plugins_backup_20250825_070018}/tools/copy_file.py +0 -0
  125. /janito/{plugins → plugins_backup_20250825_070018}/tools/core_tools_plugin.py +0 -0
  126. /janito/{plugins → plugins_backup_20250825_070018}/tools/create_directory.py +0 -0
  127. /janito/{plugins → plugins_backup_20250825_070018}/tools/create_file.py +0 -0
  128. /janito/{plugins → plugins_backup_20250825_070018}/tools/decorators.py +0 -0
  129. /janito/{plugins → plugins_backup_20250825_070018}/tools/fetch_url.py +0 -0
  130. /janito/{plugins → plugins_backup_20250825_070018}/tools/find_files.py +0 -0
  131. /janito/{plugins → plugins_backup_20250825_070018}/tools/get_file_outline/__init__.py +0 -0
  132. /janito/{plugins → plugins_backup_20250825_070018}/tools/get_file_outline/core.py +0 -0
  133. /janito/{plugins → plugins_backup_20250825_070018}/tools/move_file.py +0 -0
  134. /janito/{plugins → plugins_backup_20250825_070018}/tools/open_html_in_browser.py +0 -0
  135. /janito/{plugins → plugins_backup_20250825_070018}/tools/open_url.py +0 -0
  136. /janito/{plugins → plugins_backup_20250825_070018}/tools/python_code_run.py +0 -0
  137. /janito/{plugins → plugins_backup_20250825_070018}/tools/python_command_run.py +0 -0
  138. /janito/{plugins → plugins_backup_20250825_070018}/tools/python_file_run.py +0 -0
  139. /janito/{plugins → plugins_backup_20250825_070018}/tools/read_chart.py +0 -0
  140. /janito/{plugins → plugins_backup_20250825_070018}/tools/read_files.py +0 -0
  141. /janito/{plugins → plugins_backup_20250825_070018}/tools/remove_directory.py +0 -0
  142. /janito/{plugins → plugins_backup_20250825_070018}/tools/remove_file.py +0 -0
  143. /janito/{plugins → plugins_backup_20250825_070018}/tools/replace_text_in_file.py +0 -0
  144. /janito/{plugins → plugins_backup_20250825_070018}/tools/run_bash_command.py +0 -0
  145. /janito/{plugins → plugins_backup_20250825_070018}/tools/run_powershell_command.py +0 -0
  146. /janito/{plugins → plugins_backup_20250825_070018}/tools/search_text/__init__.py +0 -0
  147. /janito/{plugins → plugins_backup_20250825_070018}/tools/search_text/core.py +0 -0
  148. /janito/{plugins → plugins_backup_20250825_070018}/tools/show_image.py +0 -0
  149. /janito/{plugins → plugins_backup_20250825_070018}/tools/show_image_grid.py +0 -0
  150. /janito/{plugins → plugins_backup_20250825_070018}/tools/validate_file_syntax/__init__.py +0 -0
  151. /janito/{plugins → plugins_backup_20250825_070018}/tools/validate_file_syntax/core.py +0 -0
  152. /janito/{plugins → plugins_backup_20250825_070018}/tools/view_file.py +0 -0
  153. {janito-3.1.0.dist-info → janito-3.3.0.dist-info}/WHEEL +0 -0
  154. {janito-3.1.0.dist-info → janito-3.3.0.dist-info}/entry_points.txt +0 -0
  155. {janito-3.1.0.dist-info → janito-3.3.0.dist-info}/licenses/LICENSE +0 -0
  156. {janito-3.1.0.dist-info → janito-3.3.0.dist-info}/top_level.txt +0 -0
@@ -35,30 +35,4 @@ class KeyBindingsFactory:
35
35
  buf.text = "Do It"
36
36
  buf.validate_and_handle()
37
37
 
38
- @bindings.add("enter", eager=True)
39
- def _(event):
40
- """Handle Enter key to interrupt current request."""
41
- import threading
42
-
43
- # Get the current session context
44
- from prompt_toolkit.application import get_app
45
- app = get_app()
46
-
47
- # Use global cancellation manager for robust cancellation
48
- from janito.llm.cancellation_manager import get_cancellation_manager
49
- cancel_manager = get_cancellation_manager()
50
-
51
- cancelled = cancel_manager.cancel_current_request()
52
- if cancelled:
53
- # Provide user feedback
54
- from rich.console import Console
55
- console = Console()
56
- console.print("[red]Request cancelled by Enter key[/red]")
57
-
58
- # Prevent the Enter key from being processed as input
59
- event.app.output.flush()
60
- return
61
-
62
- # If no active request to cancel, let normal Enter behavior proceed
63
-
64
38
  return bindings
@@ -283,13 +283,7 @@ class ChatSession:
283
283
  )
284
284
  )
285
285
 
286
- try:
287
- self._prompt_handler.run_prompt(cmd_input)
288
- finally:
289
- # Ensure cancellation manager is cleared
290
- cancel_manager = get_cancellation_manager()
291
- cancel_manager.clear_current_request()
292
-
286
+ self._prompt_handler.run_prompt(cmd_input)
293
287
  end_time = time.time()
294
288
  elapsed = end_time - start_time
295
289
  self.msg_count += 1
@@ -8,11 +8,8 @@ from janito.plugins.discovery import list_available_plugins
8
8
  import os
9
9
  from janito.plugins.manager import PluginManager
10
10
  from janito.plugins.builtin import BuiltinPluginRegistry
11
- from janito.plugins.auto_loader_fixed import (
12
- load_core_plugins,
13
- get_loaded_core_plugins,
14
- is_core_plugin,
15
- )
11
+ from janito.plugins.manager import PluginManager
12
+ from janito.plugins.core_loader import get_core_plugins
16
13
  from rich.console import Console
17
14
  from rich.table import Table
18
15
  from rich.panel import Panel
@@ -55,7 +52,7 @@ def _list_available_plugins():
55
52
  console.print(table)
56
53
 
57
54
  # Show core plugins
58
- from janito.plugin_system.core_loader_fixed import get_core_plugins
55
+ from janito.plugins.core_loader import get_core_plugins
59
56
 
60
57
  core_plugins = get_core_plugins()
61
58
  core_table = Table(title="Core Plugins (Enabled by Default)")
@@ -98,10 +95,8 @@ def _print_external_plugins(available, builtin_plugins):
98
95
 
99
96
  def _list_plugin_resources():
100
97
  """List all resources from loaded plugins using rich formatting."""
101
- from janito.plugins.auto_loader_fixed import get_plugin_manager
102
-
103
98
  console = Console()
104
- manager = get_plugin_manager()
99
+ manager = PluginManager()
105
100
  all_resources = manager.list_all_resources()
106
101
 
107
102
  if all_resources:
@@ -174,10 +169,8 @@ def _print_resources_by_type(resources):
174
169
 
175
170
  def _list_loaded_plugins():
176
171
  """List loaded plugins using rich formatting."""
177
- from janito.plugins.auto_loader_fixed import get_plugin_manager
178
-
179
172
  console = Console()
180
- manager = get_plugin_manager()
173
+ manager = PluginManager()
181
174
  loaded = manager.list_plugins()
182
175
 
183
176
  if loaded:
@@ -192,7 +185,9 @@ def _list_loaded_plugins():
192
185
  other_plugins = []
193
186
 
194
187
  for plugin_name in loaded:
195
- if is_core_plugin(plugin_name):
188
+ from janito.plugins.core_loader import get_core_plugins
189
+ core_plugin_list = get_core_plugins()
190
+ if plugin_name in core_plugin_list:
196
191
  core_plugins.append(plugin_name)
197
192
  else:
198
193
  other_plugins.append(plugin_name)
janito/cli/prompt_core.py CHANGED
@@ -207,25 +207,15 @@ class PromptHandler:
207
207
  """
208
208
  try:
209
209
  self._print_verbose_debug("Calling agent.chat()...")
210
-
211
- # Use global cancellation manager
212
- from janito.llm.cancellation_manager import get_cancellation_manager
213
- cancel_manager = get_cancellation_manager()
214
- driver_cancel_event = cancel_manager.start_new_request()
215
-
216
- try:
217
- final_event = self.agent.chat(prompt=user_prompt)
218
- if hasattr(self.agent, "set_latest_event"):
219
- self.agent.set_latest_event(final_event)
220
- self.agent.last_event = final_event
221
- self._print_verbose_debug(f"agent.chat() returned: {final_event}")
222
- self._print_verbose_final_event(final_event)
223
- if on_event and final_event is not None:
224
- on_event(final_event)
225
- global_event_bus.publish(final_event)
226
- finally:
227
- cancel_manager.clear_current_request()
228
-
210
+ final_event = self.agent.chat(prompt=user_prompt)
211
+ if hasattr(self.agent, "set_latest_event"):
212
+ self.agent.set_latest_event(final_event)
213
+ self.agent.last_event = final_event
214
+ self._print_verbose_debug(f"agent.chat() returned: {final_event}")
215
+ self._print_verbose_final_event(final_event)
216
+ if on_event and final_event is not None:
217
+ on_event(final_event)
218
+ global_event_bus.publish(final_event)
229
219
  except KeyboardInterrupt:
230
220
  # Capture user interrupt / cancellation
231
221
  self.console.print("[red]Interrupted by the user.[/red]")
janito/llm/agent.py CHANGED
@@ -318,36 +318,23 @@ class LLMAgent:
318
318
  loop_count = 1
319
319
  import threading
320
320
 
321
- # Use global cancellation manager
322
- from janito.llm.cancellation_manager import get_cancellation_manager
323
- cancel_manager = get_cancellation_manager()
324
- driver_cancel_event = cancel_manager.start_new_request()
325
-
326
- # Store cancellation event on agent for external access
327
- self.cancel_event = driver_cancel_event
328
-
329
- try:
330
- while True:
331
- self._print_verbose_chat_loop(loop_count)
332
- driver_input = self._prepare_driver_input(config, cancel_event=driver_cancel_event)
333
- self.input_queue.put(driver_input)
334
- try:
335
- result, added_tool_results = self._process_next_response()
336
- except KeyboardInterrupt:
337
- cancel_manager.cancel_current_request()
338
- raise
339
- if getattr(self, "verbose_agent", False):
340
- print(
341
- f"[agent] [DEBUG] Returned from _process_next_response: result={result}, added_tool_results={added_tool_results}"
342
- )
343
- if self._should_exit_chat_loop(result, added_tool_results):
344
- return result
345
- loop_count += 1
346
- finally:
347
- cancel_manager.clear_current_request()
348
- # Clean up cancellation event
349
- if hasattr(self, 'cancel_event'):
350
- delattr(self, 'cancel_event')
321
+ cancel_event = threading.Event()
322
+ while True:
323
+ self._print_verbose_chat_loop(loop_count)
324
+ driver_input = self._prepare_driver_input(config, cancel_event=cancel_event)
325
+ self.input_queue.put(driver_input)
326
+ try:
327
+ result, added_tool_results = self._process_next_response()
328
+ except KeyboardInterrupt:
329
+ cancel_event.set()
330
+ raise
331
+ if getattr(self, "verbose_agent", False):
332
+ print(
333
+ f"[agent] [DEBUG] Returned from _process_next_response: result={result}, added_tool_results={added_tool_results}"
334
+ )
335
+ if self._should_exit_chat_loop(result, added_tool_results):
336
+ return result
337
+ loop_count += 1
351
338
 
352
339
  def _clear_driver_queues(self):
353
340
  if hasattr(self, "driver") and self.driver:
janito/llm/driver.py CHANGED
@@ -252,10 +252,3 @@ class LLMDriver(ABC):
252
252
  def _get_message_from_result(self, result):
253
253
  """Extract the message object from the provider result. Subclasses must implement this."""
254
254
  raise NotImplementedError("Subclasses must implement _get_message_from_result.")
255
-
256
- def cancel_current_request(self):
257
- """Cancel the current request being processed."""
258
- # Use global cancellation manager to cancel the current request
259
- from janito.llm.cancellation_manager import get_cancellation_manager
260
- cancel_manager = get_cancellation_manager()
261
- cancel_manager.cancel_current_request()
@@ -1,36 +1,28 @@
1
1
  """
2
- Plugin System for Development Tools
2
+ Unified Plugin System for Janito
3
3
 
4
- This package organizes all available tools into logical plugin groups
5
- for easier discovery and usage.
4
+ This package provides a clean, unified plugin architecture for janito.
6
5
  """
7
6
 
8
7
  __version__ = "1.0.0"
9
8
  __author__ = "Development Assistant"
10
9
 
11
- from .core import filemanager, codeanalyzer, system, imagedisplay
12
- from .web import webtools
13
- from .dev import pythondev, visualization
14
- from .ui import userinterface
15
-
16
- # Plugin registry
17
- PLUGINS = {
18
- "core.filemanager": filemanager,
19
- "core.codeanalyzer": codeanalyzer,
20
- "core.system": system,
21
- "core.imagedisplay": imagedisplay,
22
- "web.webtools": webtools,
23
- "dev.pythondev": pythondev,
24
- "dev.visualization": visualization,
25
- "ui.userinterface": userinterface,
26
- }
27
-
28
-
29
- def list_plugins():
30
- """Return all available plugins"""
31
- return list(PLUGINS.keys())
32
-
33
-
34
- def get_plugin(name):
35
- """Get a specific plugin by name"""
36
- return PLUGINS.get(name)
10
+ # Import core components
11
+ from .base import Plugin, PluginMetadata, PluginResource
12
+ from .manager import PluginManager
13
+ from .discovery import discover_plugins, list_available_plugins
14
+ from .config import load_plugins_config, save_plugins_config
15
+ from .builtin import BuiltinPluginRegistry, load_builtin_plugin
16
+
17
+ __all__ = [
18
+ "Plugin",
19
+ "PluginMetadata",
20
+ "PluginResource",
21
+ "PluginManager",
22
+ "discover_plugins",
23
+ "list_available_plugins",
24
+ "load_plugins_config",
25
+ "save_plugins_config",
26
+ "BuiltinPluginRegistry",
27
+ "load_builtin_plugin",
28
+ ]
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Plugin system CLI entry point.
4
+ """
5
+
6
+ import argparse
7
+ import sys
8
+ from pathlib import Path
9
+
10
+ from .manager import PluginManager
11
+ from .discovery import list_available_plugins
12
+ from .core_loader import get_core_plugins
13
+
14
+
15
+ def list_plugins():
16
+ """List all available plugins."""
17
+ print("📋 Available Plugins:")
18
+ print("=" * 50)
19
+
20
+ # Get available plugins
21
+ available = list_available_plugins()
22
+
23
+ # Get core plugins
24
+ core_plugins = get_core_plugins()
25
+
26
+ if available:
27
+ print("\n🔌 Available Plugins:")
28
+ for plugin in sorted(available):
29
+ if plugin in core_plugins:
30
+ print(f" ✅ {plugin} (core)")
31
+ else:
32
+ print(f" 🔌 {plugin}")
33
+ else:
34
+ print(" No plugins found in search paths")
35
+
36
+ print(f"\n📊 Total: {len(available)} plugins")
37
+
38
+
39
+ def list_loaded():
40
+ """List currently loaded plugins."""
41
+ print("🔧 Currently Loaded Plugins:")
42
+ print("=" * 50)
43
+
44
+ pm = PluginManager()
45
+
46
+ # Load core plugins
47
+ core_plugins = get_core_plugins()
48
+ for plugin in core_plugins:
49
+ pm.load_plugin(plugin)
50
+
51
+ loaded = pm.list_plugins()
52
+
53
+ if loaded:
54
+ for plugin in sorted(loaded):
55
+ metadata = pm.get_plugin_metadata(plugin)
56
+ if metadata:
57
+ print(f" 📦 {plugin} v{metadata.version}")
58
+ print(f" {metadata.description}")
59
+ else:
60
+ print(f" 📦 {plugin}")
61
+ else:
62
+ print(" No plugins currently loaded")
63
+
64
+ print(f"\n📊 Total: {len(loaded)} plugins loaded")
65
+
66
+
67
+ def main():
68
+ """Main CLI entry point."""
69
+ parser = argparse.ArgumentParser(description="Janito Plugin System CLI")
70
+ parser.add_argument(
71
+ "--list-plugins",
72
+ action="store_true",
73
+ help="List all loaded plugins"
74
+ )
75
+
76
+ args = parser.parse_args()
77
+
78
+ if args.list_plugins:
79
+ list_loaded()
80
+ else:
81
+ list_loaded()
82
+
83
+
84
+ if __name__ == "__main__":
85
+ main()
janito/plugins/base.py ADDED
@@ -0,0 +1,57 @@
1
+ """
2
+ Base classes for janito plugins.
3
+ """
4
+
5
+ from abc import ABC, abstractmethod
6
+ from dataclasses import dataclass
7
+ from typing import Dict, Any, List, Optional, Type
8
+
9
+ @dataclass
10
+ class PluginMetadata:
11
+ name: str
12
+ version: str
13
+ description: str
14
+ author: str
15
+ license: str = "MIT"
16
+ homepage: Optional[str] = None
17
+ dependencies: List[str] = None
18
+
19
+ def __post_init__(self):
20
+ if self.dependencies is None:
21
+ self.dependencies = []
22
+
23
+ @dataclass
24
+ class PluginResource:
25
+ name: str
26
+ type: str
27
+ description: str
28
+ schema: Optional[Dict[str, Any]] = None
29
+
30
+ class Plugin(ABC):
31
+ def __init__(self):
32
+ self.metadata: PluginMetadata = self.get_metadata()
33
+
34
+ @abstractmethod
35
+ def get_metadata(self) -> PluginMetadata:
36
+ pass
37
+
38
+ def get_tools(self):
39
+ return []
40
+
41
+ def get_commands(self):
42
+ return {}
43
+
44
+ def initialize(self):
45
+ pass
46
+
47
+ def cleanup(self):
48
+ pass
49
+
50
+ def get_config_schema(self):
51
+ return {}
52
+
53
+ def validate_config(self, config):
54
+ return True
55
+
56
+ def get_resources(self):
57
+ return []
janito/plugins/builtin.py CHANGED
@@ -7,7 +7,7 @@ with janito and available by default without requiring external installation.
7
7
 
8
8
  import importlib
9
9
  from typing import Dict, List, Optional, Type
10
- from janito.plugin_system.base import Plugin
10
+ from .base import Plugin
11
11
 
12
12
 
13
13
  class BuiltinPluginRegistry:
@@ -13,12 +13,36 @@ from janito.i18n import tr
13
13
  class CopyFileTool(ToolBase):
14
14
  """
15
15
  Copy one or more files to a target directory, or copy a single file to a new file.
16
- Args:
16
+
17
+ Parameters:
17
18
  sources (str): Space-separated path(s) to the file(s) to copy.
18
19
  For multiple sources, provide a single string with paths separated by spaces.
19
20
  target (str): Destination path. If copying multiple sources, this must be an existing directory.
20
21
  overwrite (bool, optional): Overwrite existing files. Default: False.
21
22
  Recommended only after reading the file to be overwritten.
23
+ content (str): File content to write or process
24
+ recursive (bool): Whether to process directories recursively
25
+ from_line (int): Starting line number for file reading
26
+ to_line (int): Ending line number for file reading
27
+ search_text (str): Text to search for in files
28
+ replacement_text (str): Text to replace search matches with
29
+ use_regex (bool): Whether to treat search as regex pattern
30
+ case_sensitive (bool): Whether search should be case sensitive
31
+ max_depth (int): Maximum directory depth to search
32
+ include_gitignored (bool): Whether to include .gitignored files
33
+ timeout (int): Timeout in seconds for operations
34
+ require_confirmation (bool): Whether to require user confirmation
35
+ data (dict): Chart data for visualization tools
36
+ title (str): Chart title
37
+ width (int): Chart width in pixels
38
+ height (int): Chart height in pixels
39
+ query (str): Search query for text search
40
+ paths (str): Directory or file paths to search in
41
+ src_path (str): Source path for move operations
42
+ dest_path (str): Destination path for move operations
43
+ code (str): Python code to execute
44
+ pattern (str): File pattern to match (e.g., '*.py')
45
+
22
46
  Returns:
23
47
  str: Status string for each copy operation.
24
48
  """
@@ -12,8 +12,35 @@ from janito.tools.path_utils import expand_path
12
12
  class CreateDirectoryTool(ToolBase):
13
13
  """
14
14
  Create a new directory at the specified path.
15
- Args:
15
+
16
+ Parameters:
16
17
  path (str): Path for the new directory.
18
+ content (str): File content to write or process
19
+ overwrite (bool): Whether to overwrite existing files (default: False)
20
+ sources (str): Source file(s) to copy from
21
+ target (str): Destination path for copy operations
22
+ recursive (bool): Whether to process directories recursively
23
+ from_line (int): Starting line number for file reading
24
+ to_line (int): Ending line number for file reading
25
+ search_text (str): Text to search for in files
26
+ replacement_text (str): Text to replace search matches with
27
+ use_regex (bool): Whether to treat search as regex pattern
28
+ case_sensitive (bool): Whether search should be case sensitive
29
+ max_depth (int): Maximum directory depth to search
30
+ include_gitignored (bool): Whether to include .gitignored files
31
+ timeout (int): Timeout in seconds for operations
32
+ require_confirmation (bool): Whether to require user confirmation
33
+ data (dict): Chart data for visualization tools
34
+ title (str): Chart title
35
+ width (int): Chart width in pixels
36
+ height (int): Chart height in pixels
37
+ query (str): Search query for text search
38
+ paths (str): Directory or file paths to search in
39
+ src_path (str): Source path for move operations
40
+ dest_path (str): Destination path for move operations
41
+ code (str): Python code to execute
42
+ pattern (str): File pattern to match (e.g., '*.py')
43
+
17
44
  Returns:
18
45
  str: Status message indicating the result. Example:
19
46
  - "5c5 Successfully created the directory at ..."
@@ -16,10 +16,34 @@ class CreateFileTool(ToolBase):
16
16
  """
17
17
  Create a new file with the given content.
18
18
 
19
- Args:
19
+ Parameters:
20
20
  path (str): Path to the file to create.
21
21
  content (str): Content to write to the file.
22
22
  overwrite (bool, optional): Overwrite existing file if True. Default: False. Recommended only after reading the file to be overwritten.
23
+ sources (str): Source file(s) to copy from
24
+ target (str): Destination path for copy operations
25
+ recursive (bool): Whether to process directories recursively
26
+ from_line (int): Starting line number for file reading
27
+ to_line (int): Ending line number for file reading
28
+ search_text (str): Text to search for in files
29
+ replacement_text (str): Text to replace search matches with
30
+ use_regex (bool): Whether to treat search as regex pattern
31
+ case_sensitive (bool): Whether search should be case sensitive
32
+ max_depth (int): Maximum directory depth to search
33
+ include_gitignored (bool): Whether to include .gitignored files
34
+ timeout (int): Timeout in seconds for operations
35
+ require_confirmation (bool): Whether to require user confirmation
36
+ data (dict): Chart data for visualization tools
37
+ title (str): Chart title
38
+ width (int): Chart width in pixels
39
+ height (int): Chart height in pixels
40
+ query (str): Search query for text search
41
+ paths (str): Directory or file paths to search in
42
+ src_path (str): Source path for move operations
43
+ dest_path (str): Destination path for move operations
44
+ code (str): Python code to execute
45
+ pattern (str): File pattern to match (e.g., '*.py')
46
+
23
47
  Returns:
24
48
  str: Status message indicating the result. Example:
25
49
  - "✅ Successfully created the file at ..."
@@ -15,6 +15,7 @@ class DeleteTextInFileTool(ToolBase):
15
15
  path (str): Path to the file to modify.
16
16
  start_marker (str): The starting delimiter string.
17
17
  end_marker (str): The ending delimiter string.
18
+ backup (bool, optional): Deprecated. No backups are created anymore and this flag is ignored. Defaults to False.
18
19
 
19
20
  Returns:
20
21
  str: Status message indicating the result.
@@ -4,7 +4,7 @@ Image Display Plugin implementation.
4
4
 
5
5
  from typing import Dict, Any, List, Type
6
6
 
7
- from janito.plugin_system.base import Plugin, PluginMetadata
7
+ from ...base import Plugin, PluginMetadata
8
8
  from janito.tools.tool_base import ToolBase
9
9
  from .tools.show_image import ShowImageTool
10
10
  from .tools.show_image_grid import ShowImageGridTool