kollabor 0.4.9__tar.gz

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 (243) hide show
  1. kollabor-0.4.9/CLAUDE.md +369 -0
  2. kollabor-0.4.9/LICENSE +21 -0
  3. kollabor-0.4.9/MANIFEST.in +31 -0
  4. kollabor-0.4.9/PKG-INFO +298 -0
  5. kollabor-0.4.9/README.md +261 -0
  6. kollabor-0.4.9/core/__init__.py +18 -0
  7. kollabor-0.4.9/core/application.py +578 -0
  8. kollabor-0.4.9/core/cli.py +193 -0
  9. kollabor-0.4.9/core/commands/__init__.py +43 -0
  10. kollabor-0.4.9/core/commands/executor.py +277 -0
  11. kollabor-0.4.9/core/commands/menu_renderer.py +319 -0
  12. kollabor-0.4.9/core/commands/parser.py +186 -0
  13. kollabor-0.4.9/core/commands/registry.py +331 -0
  14. kollabor-0.4.9/core/commands/system_commands.py +479 -0
  15. kollabor-0.4.9/core/config/__init__.py +7 -0
  16. kollabor-0.4.9/core/config/llm_task_config.py +110 -0
  17. kollabor-0.4.9/core/config/loader.py +501 -0
  18. kollabor-0.4.9/core/config/manager.py +112 -0
  19. kollabor-0.4.9/core/config/plugin_config_manager.py +346 -0
  20. kollabor-0.4.9/core/config/plugin_schema.py +424 -0
  21. kollabor-0.4.9/core/config/service.py +399 -0
  22. kollabor-0.4.9/core/effects/__init__.py +1 -0
  23. kollabor-0.4.9/core/events/__init__.py +12 -0
  24. kollabor-0.4.9/core/events/bus.py +129 -0
  25. kollabor-0.4.9/core/events/executor.py +154 -0
  26. kollabor-0.4.9/core/events/models.py +258 -0
  27. kollabor-0.4.9/core/events/processor.py +176 -0
  28. kollabor-0.4.9/core/events/registry.py +289 -0
  29. kollabor-0.4.9/core/fullscreen/__init__.py +19 -0
  30. kollabor-0.4.9/core/fullscreen/command_integration.py +290 -0
  31. kollabor-0.4.9/core/fullscreen/components/__init__.py +12 -0
  32. kollabor-0.4.9/core/fullscreen/components/animation.py +258 -0
  33. kollabor-0.4.9/core/fullscreen/components/drawing.py +160 -0
  34. kollabor-0.4.9/core/fullscreen/components/matrix_components.py +177 -0
  35. kollabor-0.4.9/core/fullscreen/manager.py +302 -0
  36. kollabor-0.4.9/core/fullscreen/plugin.py +204 -0
  37. kollabor-0.4.9/core/fullscreen/renderer.py +282 -0
  38. kollabor-0.4.9/core/fullscreen/session.py +324 -0
  39. kollabor-0.4.9/core/io/__init__.py +52 -0
  40. kollabor-0.4.9/core/io/buffer_manager.py +362 -0
  41. kollabor-0.4.9/core/io/config_status_view.py +272 -0
  42. kollabor-0.4.9/core/io/core_status_views.py +410 -0
  43. kollabor-0.4.9/core/io/input_errors.py +313 -0
  44. kollabor-0.4.9/core/io/input_handler.py +2655 -0
  45. kollabor-0.4.9/core/io/input_mode_manager.py +402 -0
  46. kollabor-0.4.9/core/io/key_parser.py +344 -0
  47. kollabor-0.4.9/core/io/layout.py +587 -0
  48. kollabor-0.4.9/core/io/message_coordinator.py +204 -0
  49. kollabor-0.4.9/core/io/message_renderer.py +601 -0
  50. kollabor-0.4.9/core/io/modal_interaction_handler.py +315 -0
  51. kollabor-0.4.9/core/io/raw_input_processor.py +946 -0
  52. kollabor-0.4.9/core/io/status_renderer.py +845 -0
  53. kollabor-0.4.9/core/io/terminal_renderer.py +586 -0
  54. kollabor-0.4.9/core/io/terminal_state.py +551 -0
  55. kollabor-0.4.9/core/io/visual_effects.py +734 -0
  56. kollabor-0.4.9/core/llm/__init__.py +26 -0
  57. kollabor-0.4.9/core/llm/api_communication_service.py +863 -0
  58. kollabor-0.4.9/core/llm/conversation_logger.py +473 -0
  59. kollabor-0.4.9/core/llm/conversation_manager.py +414 -0
  60. kollabor-0.4.9/core/llm/file_operations_executor.py +1401 -0
  61. kollabor-0.4.9/core/llm/hook_system.py +402 -0
  62. kollabor-0.4.9/core/llm/llm_service.py +1629 -0
  63. kollabor-0.4.9/core/llm/mcp_integration.py +386 -0
  64. kollabor-0.4.9/core/llm/message_display_service.py +450 -0
  65. kollabor-0.4.9/core/llm/model_router.py +214 -0
  66. kollabor-0.4.9/core/llm/plugin_sdk.py +396 -0
  67. kollabor-0.4.9/core/llm/response_parser.py +848 -0
  68. kollabor-0.4.9/core/llm/response_processor.py +364 -0
  69. kollabor-0.4.9/core/llm/tool_executor.py +520 -0
  70. kollabor-0.4.9/core/logging/__init__.py +19 -0
  71. kollabor-0.4.9/core/logging/setup.py +208 -0
  72. kollabor-0.4.9/core/models/__init__.py +5 -0
  73. kollabor-0.4.9/core/models/base.py +23 -0
  74. kollabor-0.4.9/core/plugins/__init__.py +13 -0
  75. kollabor-0.4.9/core/plugins/collector.py +212 -0
  76. kollabor-0.4.9/core/plugins/discovery.py +386 -0
  77. kollabor-0.4.9/core/plugins/factory.py +263 -0
  78. kollabor-0.4.9/core/plugins/registry.py +152 -0
  79. kollabor-0.4.9/core/storage/__init__.py +5 -0
  80. kollabor-0.4.9/core/storage/state_manager.py +84 -0
  81. kollabor-0.4.9/core/ui/__init__.py +6 -0
  82. kollabor-0.4.9/core/ui/config_merger.py +176 -0
  83. kollabor-0.4.9/core/ui/config_widgets.py +369 -0
  84. kollabor-0.4.9/core/ui/live_modal_renderer.py +276 -0
  85. kollabor-0.4.9/core/ui/modal_actions.py +162 -0
  86. kollabor-0.4.9/core/ui/modal_overlay_renderer.py +373 -0
  87. kollabor-0.4.9/core/ui/modal_renderer.py +591 -0
  88. kollabor-0.4.9/core/ui/modal_state_manager.py +443 -0
  89. kollabor-0.4.9/core/ui/widget_integration.py +222 -0
  90. kollabor-0.4.9/core/ui/widgets/__init__.py +27 -0
  91. kollabor-0.4.9/core/ui/widgets/base_widget.py +136 -0
  92. kollabor-0.4.9/core/ui/widgets/checkbox.py +85 -0
  93. kollabor-0.4.9/core/ui/widgets/dropdown.py +140 -0
  94. kollabor-0.4.9/core/ui/widgets/label.py +78 -0
  95. kollabor-0.4.9/core/ui/widgets/slider.py +185 -0
  96. kollabor-0.4.9/core/ui/widgets/text_input.py +224 -0
  97. kollabor-0.4.9/core/utils/__init__.py +11 -0
  98. kollabor-0.4.9/core/utils/config_utils.py +656 -0
  99. kollabor-0.4.9/core/utils/dict_utils.py +212 -0
  100. kollabor-0.4.9/core/utils/error_utils.py +275 -0
  101. kollabor-0.4.9/core/utils/key_reader.py +171 -0
  102. kollabor-0.4.9/core/utils/plugin_utils.py +267 -0
  103. kollabor-0.4.9/core/utils/prompt_renderer.py +151 -0
  104. kollabor-0.4.9/docs/CONFIG_COMMAND_ENHANCEMENT_SPEC.md +1224 -0
  105. kollabor-0.4.9/docs/EDIT_TOOL_SPEC.md +2578 -0
  106. kollabor-0.4.9/docs/LLM_CORE_MIGRATION_PLAN.md +480 -0
  107. kollabor-0.4.9/docs/README.md +269 -0
  108. kollabor-0.4.9/docs/STARTUP_TO_FIRST_MESSAGE_FLOW.md +560 -0
  109. kollabor-0.4.9/docs/archive/PROJECT_OVERVIEW.md +836 -0
  110. kollabor-0.4.9/docs/archive/agent.md +1463 -0
  111. kollabor-0.4.9/docs/archive/application-dataflow.md +402 -0
  112. kollabor-0.4.9/docs/archive/config-command-dataflow.md +437 -0
  113. kollabor-0.4.9/docs/archive/config_audit_report.md +382 -0
  114. kollabor-0.4.9/docs/archive/core_refactoring_analysis.md +826 -0
  115. kollabor-0.4.9/docs/archive/dead_code_analysis_report.md +337 -0
  116. kollabor-0.4.9/docs/archive/kollabor.md +1208 -0
  117. kollabor-0.4.9/docs/archive/matrix-command-dataflow.md +348 -0
  118. kollabor-0.4.9/docs/archive/mcp_status_spec.md +641 -0
  119. kollabor-0.4.9/docs/archive/multi-agent-tmux-coordination.md +127 -0
  120. kollabor-0.4.9/docs/archive/plugins_found.md +222 -0
  121. kollabor-0.4.9/docs/archive/terminal-llm-chat-dataflow.md +342 -0
  122. kollabor-0.4.9/docs/assets/asset-management-framework.md +123 -0
  123. kollabor-0.4.9/docs/assets/brand-guidelines.md +270 -0
  124. kollabor-0.4.9/docs/assets/diagram-standards.md +317 -0
  125. kollabor-0.4.9/docs/assets/template-library.md +374 -0
  126. kollabor-0.4.9/docs/assets/visual-design-standards.md +186 -0
  127. kollabor-0.4.9/docs/bug_fixes/01_startup_race_condition.md +180 -0
  128. kollabor-0.4.9/docs/bug_fixes/02_memory_leak_queue_processing.md +186 -0
  129. kollabor-0.4.9/docs/bug_fixes/03_resource_leak_http_sessions.md +356 -0
  130. kollabor-0.4.9/docs/bug_fixes/04_async_task_not_awaited.md +335 -0
  131. kollabor-0.4.9/docs/bug_fixes/05_infinite_loop_input_processing.md +374 -0
  132. kollabor-0.4.9/docs/bug_fixes/06_unsafe_module_import.md +399 -0
  133. kollabor-0.4.9/docs/bug_fixes/07_conversation_manager_memory_leak.md +425 -0
  134. kollabor-0.4.9/docs/bug_fixes/08_race_condition_event_processing.md +459 -0
  135. kollabor-0.4.9/docs/bug_fixes/09_missing_error_handling_status_rendering.md +459 -0
  136. kollabor-0.4.9/docs/bug_fixes/10_inefficient_string_operations.md +517 -0
  137. kollabor-0.4.9/docs/bug_fixes/BUG-011_VALIDATION_REPORT.md +395 -0
  138. kollabor-0.4.9/docs/bug_fixes/README.md +269 -0
  139. kollabor-0.4.9/docs/bug_fixes/enhanced_input_fix.md +180 -0
  140. kollabor-0.4.9/docs/bug_fixes/orphaned_think_tags_display.md +669 -0
  141. kollabor-0.4.9/docs/claude-code-enhancements.md +1208 -0
  142. kollabor-0.4.9/docs/features/dynamic-system-prompts.md +320 -0
  143. kollabor-0.4.9/docs/modal-gap-filling-implementation copy.md +340 -0
  144. kollabor-0.4.9/docs/modal-implementation-roadmap copy.md +364 -0
  145. kollabor-0.4.9/docs/modal-system-implementation-guide.md +1113 -0
  146. kollabor-0.4.9/docs/modal-ui-framework copy.md +692 -0
  147. kollabor-0.4.9/docs/project-management/README.md +153 -0
  148. kollabor-0.4.9/docs/project-management/agile-ai-methodology.md +276 -0
  149. kollabor-0.4.9/docs/project-management/deliverables/chat-app-project-charter.md +1118 -0
  150. kollabor-0.4.9/docs/project-management/deliverables/chat-app-technical-specs.md +1385 -0
  151. kollabor-0.4.9/docs/project-management/deliverables/chat-app-user-stories.md +2675 -0
  152. kollabor-0.4.9/docs/project-management/issue-tracking/issue-tracking-guide.md +462 -0
  153. kollabor-0.4.9/docs/project-management/performance-metrics.md +320 -0
  154. kollabor-0.4.9/docs/project-management/processes/change-management-process.md +718 -0
  155. kollabor-0.4.9/docs/project-management/processes/documentation-adherence-coordinator.md +529 -0
  156. kollabor-0.4.9/docs/project-management/processes/release-management-process.md +768 -0
  157. kollabor-0.4.9/docs/project-management/resource-planning.md +265 -0
  158. kollabor-0.4.9/docs/project-management/risk-management.md +282 -0
  159. kollabor-0.4.9/docs/project-management/stakeholder-communication.md +310 -0
  160. kollabor-0.4.9/docs/project-management/templates/project-charter-template.md +1087 -0
  161. kollabor-0.4.9/docs/project-management/templates/technical-specification-template.md +1009 -0
  162. kollabor-0.4.9/docs/project-management/templates/user-story-template.md +615 -0
  163. kollabor-0.4.9/docs/reference/api-documentation.md +493 -0
  164. kollabor-0.4.9/docs/reference/architecture-overview.md +576 -0
  165. kollabor-0.4.9/docs/reference/fullscreen-plugin-system.md +439 -0
  166. kollabor-0.4.9/docs/reference/glossary.md +312 -0
  167. kollabor-0.4.9/docs/reference/hook-system-sdk.md +983 -0
  168. kollabor-0.4.9/docs/reference/slash-commands-guide.md +420 -0
  169. kollabor-0.4.9/docs/reference/technology-stack.md +519 -0
  170. kollabor-0.4.9/docs/reference/troubleshooting-guide.md +576 -0
  171. kollabor-0.4.9/docs/sdlc/ai-enhanced-requirements.md +504 -0
  172. kollabor-0.4.9/docs/sdlc/deployment/automated-deployment-pipeline.md +942 -0
  173. kollabor-0.4.9/docs/sdlc/design/design-document-template.md +195 -0
  174. kollabor-0.4.9/docs/sdlc/design-methodology.md +719 -0
  175. kollabor-0.4.9/docs/sdlc/development/ai-assisted-coding-practices.md +994 -0
  176. kollabor-0.4.9/docs/sdlc/maintenance/ai-powered-maintenance.md +1228 -0
  177. kollabor-0.4.9/docs/sdlc/requirements/requirements-template.md +107 -0
  178. kollabor-0.4.9/docs/sdlc/testing/ai-enhanced-testing-strategy.md +1150 -0
  179. kollabor-0.4.9/docs/sdlc/testing/test-plan-template.md +223 -0
  180. kollabor-0.4.9/docs/sop/compliance/security-compliance-procedures.md +562 -0
  181. kollabor-0.4.9/docs/sop/development/ai-assisted-development-workflow.md +529 -0
  182. kollabor-0.4.9/docs/sop/development/code-review-process.md +425 -0
  183. kollabor-0.4.9/docs/sop/development/deployment-process.md +505 -0
  184. kollabor-0.4.9/docs/sop/operations/incident-response-procedures.md +678 -0
  185. kollabor-0.4.9/docs/sop/support/customer-support-procedures.md +729 -0
  186. kollabor-0.4.9/docs/standards/architecture/system-architecture-standards.md +1303 -0
  187. kollabor-0.4.9/docs/standards/coding/javascript-typescript-standards.md +1183 -0
  188. kollabor-0.4.9/docs/standards/coding/python-coding-standards.md +437 -0
  189. kollabor-0.4.9/docs/standards/quality/quality-assurance-standards.md +1829 -0
  190. kollabor-0.4.9/docs/standards/security/security-standards.md +552 -0
  191. kollabor-0.4.9/kollabor.egg-info/PKG-INFO +298 -0
  192. kollabor-0.4.9/kollabor.egg-info/SOURCES.txt +241 -0
  193. kollabor-0.4.9/kollabor.egg-info/dependency_links.txt +1 -0
  194. kollabor-0.4.9/kollabor.egg-info/entry_points.txt +2 -0
  195. kollabor-0.4.9/kollabor.egg-info/requires.txt +9 -0
  196. kollabor-0.4.9/kollabor.egg-info/top_level.txt +4 -0
  197. kollabor-0.4.9/kollabor_cli_main.py +20 -0
  198. kollabor-0.4.9/plugins/__init__.py +1 -0
  199. kollabor-0.4.9/plugins/enhanced_input/__init__.py +18 -0
  200. kollabor-0.4.9/plugins/enhanced_input/box_renderer.py +103 -0
  201. kollabor-0.4.9/plugins/enhanced_input/box_styles.py +142 -0
  202. kollabor-0.4.9/plugins/enhanced_input/color_engine.py +165 -0
  203. kollabor-0.4.9/plugins/enhanced_input/config.py +150 -0
  204. kollabor-0.4.9/plugins/enhanced_input/cursor_manager.py +72 -0
  205. kollabor-0.4.9/plugins/enhanced_input/geometry.py +81 -0
  206. kollabor-0.4.9/plugins/enhanced_input/state.py +130 -0
  207. kollabor-0.4.9/plugins/enhanced_input/text_processor.py +115 -0
  208. kollabor-0.4.9/plugins/enhanced_input_plugin.py +385 -0
  209. kollabor-0.4.9/plugins/fullscreen/__init__.py +9 -0
  210. kollabor-0.4.9/plugins/fullscreen/example_plugin.py +327 -0
  211. kollabor-0.4.9/plugins/fullscreen/matrix_plugin.py +132 -0
  212. kollabor-0.4.9/plugins/hook_monitoring_plugin.py +1299 -0
  213. kollabor-0.4.9/plugins/query_enhancer_plugin.py +350 -0
  214. kollabor-0.4.9/plugins/save_conversation_plugin.py +502 -0
  215. kollabor-0.4.9/plugins/system_commands_plugin.py +93 -0
  216. kollabor-0.4.9/plugins/tmux_plugin.py +795 -0
  217. kollabor-0.4.9/plugins/workflow_enforcement_plugin.py +629 -0
  218. kollabor-0.4.9/pyproject.toml +85 -0
  219. kollabor-0.4.9/requirements.txt +13 -0
  220. kollabor-0.4.9/setup.cfg +4 -0
  221. kollabor-0.4.9/setup.py +12 -0
  222. kollabor-0.4.9/system_prompt/default.md +1286 -0
  223. kollabor-0.4.9/system_prompt/default_win.md +265 -0
  224. kollabor-0.4.9/system_prompt/example_with_trender.md +47 -0
  225. kollabor-0.4.9/tests/test_api_communication_service.py +330 -0
  226. kollabor-0.4.9/tests/test_complete_integration.py +65 -0
  227. kollabor-0.4.9/tests/test_config_manager.py +89 -0
  228. kollabor-0.4.9/tests/test_conversation_manager.py +39 -0
  229. kollabor-0.4.9/tests/test_final_integration.py +65 -0
  230. kollabor-0.4.9/tests/test_full_integration.py +39 -0
  231. kollabor-0.4.9/tests/test_input_handler_infinite_loop_fix.py +282 -0
  232. kollabor-0.4.9/tests/test_integration.py +38 -0
  233. kollabor-0.4.9/tests/test_llm_plugin.py +123 -0
  234. kollabor-0.4.9/tests/test_llm_service.py +443 -0
  235. kollabor-0.4.9/tests/test_message_display_service.py +358 -0
  236. kollabor-0.4.9/tests/test_minimal.py +29 -0
  237. kollabor-0.4.9/tests/test_orphaned_tags_fix.py +234 -0
  238. kollabor-0.4.9/tests/test_plugin_registry.py +86 -0
  239. kollabor-0.4.9/tests/test_prompt_renderer.py +183 -0
  240. kollabor-0.4.9/tests/test_prompt_renderer_integration.py +70 -0
  241. kollabor-0.4.9/tests/test_task_management.py +411 -0
  242. kollabor-0.4.9/tests/test_tool_executor.py +339 -0
  243. kollabor-0.4.9/tests/test_wrapper_method.py +33 -0
@@ -0,0 +1,369 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ This is a **Kollabor CLI Interface** - an advanced, highly customizable terminal-based chat application for interacting with LLMs. The core principle is that **everything has hooks** - every action triggers customizable hooks that plugins can attach to for complete customization.
8
+
9
+ ## Architecture
10
+
11
+ The application follows a modular, event-driven architecture:
12
+
13
+ - **Core Application** (`core/application.py`): Main orchestrator that initializes all components
14
+ - **Event System** (`core/events/`): Central event bus with hook system for plugins
15
+ - **LLM Core** (`core/llm/`): Essential LLM services including API communication, conversation management, and tool execution
16
+ - **I/O System** (`core/io/`): Terminal rendering, input handling, visual effects, and layout management
17
+ - **Plugin System** (`core/plugins/`, `plugins/`): Dynamic plugin discovery and loading
18
+ - **Storage** (`core/storage/`): State management and persistence
19
+ - **Configuration** (`core/config/`): Flexible configuration management
20
+
21
+ ## Key Components
22
+
23
+ ### LLM Core Services (`core/llm/`)
24
+ - `llm_service.py`: Main LLM orchestration service
25
+ - `api_communication_service.py`: API communication with rate limiting
26
+ - `conversation_logger.py`: Conversation persistence and logging (KollaborConversationLogger)
27
+ - `conversation_manager.py`: Conversation state and history management
28
+ - `tool_executor.py`: Tool/function calling execution
29
+ - `hook_system.py`: LLM-specific hook management
30
+ - `message_display_service.py`: Response formatting and display
31
+ - `mcp_integration.py`: Model Context Protocol integration
32
+ - `plugin_sdk.py`: Plugin development interface (KollaborPluginSDK)
33
+ - `model_router.py`: Model selection and routing
34
+ - `response_processor.py`: Response processing and formatting
35
+ - `response_parser.py`: Response parsing utilities
36
+
37
+ ### Terminal I/O System (`core/io/`)
38
+ - `terminal_renderer.py`: Main terminal rendering with status areas
39
+ - `input_handler.py`: Raw mode input handling with key parsing
40
+ - `layout.py`: Terminal layout management and thinking animations
41
+ - `visual_effects.py`: Color palettes and visual effects
42
+ - `status_renderer.py`: Multi-area status display system
43
+ - `message_coordinator.py`: Message flow coordination
44
+ - `message_renderer.py`: Message display rendering
45
+ - `buffer_manager.py`: Terminal buffer management
46
+ - `key_parser.py`: Keyboard input parsing
47
+ - `terminal_state.py`: Terminal state management
48
+ - `core_status_views.py`: Core status view implementations
49
+ - `config_status_view.py`: Configuration status display
50
+
51
+ ### Plugin Architecture
52
+ - Plugin discovery from `plugins/` directory
53
+ - Dynamic instantiation with dependency injection
54
+ - Hook registration for event interception
55
+ - Configuration merging from plugin configs
56
+
57
+ ## Development Commands
58
+
59
+ ### Installation & Setup
60
+ ```bash
61
+ # Install from source (development mode)
62
+ pip install -e .
63
+
64
+ # Install with development dependencies
65
+ pip install -e ".[dev]"
66
+
67
+ # Install from PyPI (for users)
68
+ pip install kollabor
69
+ ```
70
+
71
+ ### Running the Application
72
+ ```bash
73
+ # Using installed CLI command (after pip install)
74
+ kollab
75
+
76
+ # Using main.py directly (development)
77
+ python main.py
78
+
79
+ # Pipe mode examples
80
+ kollab "What is Python?"
81
+ echo "Explain async/await" | kollab -p
82
+ cat document.txt | kollab -p --timeout 5min
83
+ ```
84
+
85
+ ### Testing
86
+ ```bash
87
+ # Run all tests
88
+ python tests/run_tests.py
89
+
90
+ # Run specific test file
91
+ python -m unittest tests.test_llm_plugin
92
+ python -m unittest tests.test_config_manager
93
+ python -m unittest tests.test_plugin_registry
94
+
95
+ # Run individual test case
96
+ python -m unittest tests.test_llm_plugin.TestLLMPlugin.test_thinking_tags_removal
97
+ ```
98
+
99
+ ### Code Quality
100
+ ```bash
101
+ # Install dependencies
102
+ pip install -r requirements.txt
103
+
104
+ # Format code (Black is configured for 88-character line length)
105
+ python -m black core/ plugins/ tests/ main.py
106
+
107
+ # Type checking (if mypy is available)
108
+ python -m mypy core/ plugins/
109
+
110
+ # Run linting (if flake8 is available)
111
+ python -m flake8 core/ plugins/ tests/ main.py --max-line-length=88
112
+
113
+ # Clean up cache files and build artifacts
114
+ python scripts/clean.py
115
+ ```
116
+
117
+ ### Building & Publishing
118
+ ```bash
119
+ # Clean previous builds
120
+ python scripts/clean.py
121
+
122
+ # Build distribution packages
123
+ python -m build
124
+
125
+ # Upload to TestPyPI (for testing)
126
+ python -m twine upload --repository testpypi dist/*
127
+
128
+ # Upload to PyPI (production)
129
+ python -m twine upload dist/*
130
+ ```
131
+
132
+ ### Debugging
133
+ - Application logs to `.kollabor-cli/logs/kollabor.log` with daily rotation
134
+ - Configuration stored in `.kollabor-cli/config.json`
135
+ - State persistence in `.kollabor-cli/state.db`
136
+ - Use `logging.getLogger(__name__)` in modules for consistent logging
137
+
138
+ ## Entry Points
139
+
140
+ The application has two entry points:
141
+
142
+ 1. **`kollab` command** (after `pip install kollabor`):
143
+ - Entry point defined in `pyproject.toml` as `kollab = "kollabor_cli_main:cli_main"`
144
+ - Uses `kollabor_cli_main.py` → `core/cli.py` → `core/application.py`
145
+ - Preferred for end users and production use
146
+
147
+ 2. **`python main.py`** (development mode):
148
+ - Direct execution for development
149
+ - Imports from local `core/` directory
150
+ - Used during active development
151
+
152
+ Both entry points initialize the `TerminalLLMChat` application orchestrator in `core/application.py`.
153
+
154
+ ## Configuration System
155
+
156
+ Configuration uses dot notation (e.g., `config.get("core.llm.max_history", 90)`):
157
+ - Core LLM settings: `core.llm.*`
158
+ - Terminal rendering: `terminal.*`
159
+ - Application metadata: `application.*`
160
+
161
+ ### Configuration Directories
162
+
163
+ The application uses a **priority-based configuration directory system** (see `core/utils/config_utils.py`):
164
+
165
+ **Resolution order:**
166
+ 1. **Local** `.kollabor-cli/` in current directory (project-specific override)
167
+ 2. **Global** `~/.kollabor-cli/` in home directory (default for most users)
168
+
169
+ If local `.kollabor-cli/` exists, it takes precedence over global.
170
+
171
+ **Directory contents:**
172
+ - `config.json` - User configuration with plugin settings
173
+ - `logs/` - Application logs with daily rotation
174
+ - `state.db` - Persistent state and conversation history
175
+ - `conversations/` - Conversation logs
176
+ - `system_prompt/` - System prompt files (default.md, etc.)
177
+
178
+ ### System Prompt Initialization
179
+
180
+ On first run (`initialize_system_prompt()` in `config_utils.py`):
181
+
182
+ 1. If **local** `.kollabor-cli/system_prompt/` exists with `.md` files → use local (project-specific)
183
+ 2. If global `~/.kollabor-cli/system_prompt/` doesn't exist → create from bundled `system_prompt/default.md`
184
+ 3. Copy all prompts from global to local for project-specific customization
185
+
186
+ This ensures each project can have its own customized system prompts while maintaining a global default.
187
+
188
+ ## Core Architecture Patterns
189
+
190
+ ### Event-Driven Design
191
+ The application uses an event bus (`core/events/bus.py`) that coordinates between:
192
+ - **HookRegistry** (`core/events/registry.py`): Manages hook registration and lookup by event type
193
+ - **HookExecutor** (`core/events/executor.py`): Handles hook execution with error handling and priority ordering
194
+ - **EventProcessor** (`core/events/processor.py`): Processes events through registered hooks in sequence
195
+ - **EventBus** (`core/events/bus.py`): Central coordinator that combines the above components
196
+
197
+ ### Plugin Lifecycle
198
+ 1. **Discovery**: `PluginDiscovery` scans `plugins/` directory for plugin modules
199
+ 2. **Registry**: `PluginRegistry` maintains loaded plugin metadata and configurations
200
+ 3. **Factory**: `PluginFactory` instantiates plugins with dependency injection (event_bus, config, renderer, state_manager)
201
+ 4. **Initialization**: Plugins call `initialize()` and `register_hooks()` during application startup
202
+ 5. **Execution**: Events trigger registered hooks through the event bus with priority ordering
203
+ 6. **Cleanup**: Plugins call `shutdown()` during application teardown
204
+
205
+ ### LLM Service Architecture
206
+ The `LLMService` (`core/llm/llm_service.py`) orchestrates multiple specialized services:
207
+ - **APICommunicationService**: HTTP client with rate limiting and retry logic
208
+ - **KollaborConversationLogger**: Persistent conversation history to `.kollabor-cli/conversations/`
209
+ - **MessageDisplayService**: Response formatting, streaming, and display coordination
210
+ - **ToolExecutor**: Function calling execution and tool result processing
211
+ - **MCPIntegration**: Model Context Protocol server discovery and integration
212
+ - **KollaborPluginSDK**: Plugin development interface with helper methods
213
+ - **LLMHookSystem**: LLM-specific hook management for request/response interception
214
+
215
+ ### Plugin System Details
216
+ Plugins are discovered from two possible locations (in order):
217
+ 1. Package installation directory: `<package_root>/plugins/` (for pip install)
218
+ 2. Current working directory: `./plugins/` (for development mode)
219
+
220
+ Each plugin can:
221
+ - Register hooks at any priority level (CRITICAL, HIGH, NORMAL, LOW)
222
+ - Access shared services via dependency injection
223
+ - Contribute status line items to areas A, B, or C
224
+ - Merge custom configuration into the global config
225
+ - Register slash commands via the CommandRegistry
226
+
227
+ ## Hook System
228
+
229
+ The application's hook system allows plugins to:
230
+ - Intercept user input before processing (`pre_user_input`)
231
+ - Transform LLM requests before API calls (`pre_api_request`)
232
+ - Process responses before display (`post_api_response`)
233
+ - Add custom status indicators via `get_status_line()`
234
+ - Create new terminal UI elements
235
+
236
+ ## Plugin Development
237
+
238
+ Plugins should:
239
+ 1. Inherit from base plugin classes in `core/plugins/`
240
+ 2. Register hooks in `register_hooks()` method using `EventType` enum
241
+ 3. Provide status line information via `get_status_line()`
242
+ 4. Implement `initialize()` and `shutdown()` lifecycle methods
243
+ 5. Follow the async/await pattern for all hook handlers
244
+
245
+ ## Project Structure
246
+
247
+ ```
248
+ .
249
+ ├── core/ # Core application modules
250
+ │ ├── application.py # Main orchestrator
251
+ │ ├── config/ # Configuration management
252
+ │ ├── events/ # Event bus and hook system
253
+ │ ├── io/ # Terminal I/O, rendering, input handling
254
+ │ ├── llm/ # LLM services (API, conversation, tools)
255
+ │ ├── models/ # Data models
256
+ │ ├── plugins/ # Plugin system (discovery, registry)
257
+ │ ├── storage/ # State management
258
+ │ ├── utils/ # Utility functions
259
+ │ ├── commands/ # Command system (parser, registry, executor)
260
+ │ ├── ui/ # UI system (modals, widgets, rendering)
261
+ │ ├── effects/ # Visual effects (matrix rain, etc.)
262
+ │ └── logging/ # Logging configuration
263
+ ├── plugins/ # Plugin implementations
264
+ │ ├── enhanced_input/ # Enhanced input plugin modules
265
+ │ ├── enhanced_input_plugin.py # Main enhanced input plugin
266
+ │ ├── hook_monitoring_plugin.py # Hook system monitoring
267
+ │ └── [other plugins]
268
+ ├── tests/ # Test suite
269
+ │ ├── run_tests.py # Test runner
270
+ │ ├── unit/ # Unit tests
271
+ │ ├── integration/ # Integration tests
272
+ │ ├── visual/ # Visual effect tests
273
+ │ ├── test_*.py # Component tests
274
+ │ └── README.md # Test documentation
275
+ ├── docs/ # Comprehensive documentation
276
+ │ ├── project-management/ # Project processes and templates
277
+ │ ├── reference/ # API docs and architecture
278
+ │ ├── sdlc/ # Software development lifecycle
279
+ │ ├── sop/ # Standard operating procedures
280
+ │ └── standards/ # Coding and quality standards
281
+ ├── main.py # Application entry point
282
+ ├── .kollabor-cli/ # Runtime data (created at startup)
283
+ │ ├── config.json # User configuration
284
+ │ ├── logs/ # Application logs
285
+ │ └── state.db # Persistent state
286
+ └── .github/scripts/ # Repository automation
287
+ ```
288
+
289
+ Key directories:
290
+ - **`core/`**: Modular core functionality with clear separation of concerns
291
+ - **`plugins/`**: Dynamic plugin system with auto-discovery
292
+ - **`tests/`**: Comprehensive test coverage with multiple test types
293
+ - **`docs/`**: Extensive documentation following enterprise standards
294
+ - **`.kollabor-cli/`**: Runtime configuration, logs, and state (created automatically)
295
+
296
+ ## Development Guidelines
297
+
298
+ ### Code Standards
299
+ - Follow PEP 8 with 88-character line length (Black formatter)
300
+ - Use double quotes for strings, single quotes for character literals
301
+ - All async functions should use proper `async`/`await` patterns
302
+ - Type hints required for all public functions and methods
303
+ - Comprehensive docstrings for classes and public methods
304
+ - Use `logging.getLogger(__name__)` for consistent logging across modules
305
+
306
+ ### Async/Await Patterns
307
+ The application uses async/await throughout for responsive performance:
308
+ - **Main event loop**: `asyncio.run()` in `cli_main()` starts the application
309
+ - **Concurrent tasks**: Render loop and input handler run concurrently using `asyncio.gather()`
310
+ - **Background tasks**: Use `app.create_background_task()` for proper task tracking and cleanup
311
+ - **Cleanup**: All tasks cancelled in `app.cleanup()` with guaranteed execution via `finally` block
312
+ - **Plugin hooks**: Must be async (`async def`) even if not using await internally
313
+
314
+ ### Testing Strategy
315
+ - Unit tests in `tests/unit/` for individual components
316
+ - Integration tests in `tests/integration/` for cross-component functionality
317
+ - Visual tests in `tests/visual/` for terminal rendering
318
+ - Component tests (`test_*.py`) for specific modules
319
+ - Use unittest framework with descriptive test method names
320
+ - Test coverage includes LLM plugins, configuration, and plugin registry
321
+
322
+ ### Hook Development
323
+ When creating hooks, consider:
324
+ - Hook priority using `HookPriority` enum (CRITICAL, HIGH, NORMAL, LOW)
325
+ - Error handling - hooks should not crash the application (errors are caught by HookExecutor)
326
+ - Performance - hooks are in the hot path for user interaction
327
+ - State management - avoid shared mutable state between hooks
328
+ - Return modified context from hooks (context is passed through hook chain)
329
+ - All hook handlers must be async functions
330
+
331
+ ## Key Features
332
+
333
+ ### Interactive Mode
334
+ Standard terminal-based chat interface with:
335
+ - Real-time status updates across three status areas (A, B, C)
336
+ - Thinking animations during LLM processing
337
+ - Multi-line input with visual input box
338
+ - Conversation history with scrollback
339
+ - Plugin-driven extensibility
340
+
341
+ ### Pipe Mode
342
+ Non-interactive mode for scripting and automation:
343
+ - Process single query and exit: `kollab "query here"`
344
+ - Read from stdin: `echo "query" | kollab -p`
345
+ - Configurable timeout: `kollab --timeout 5min "complex task"`
346
+ - Suppresses interactive UI elements (status bar, cursor, exit messages)
347
+ - Full plugin support (plugins can check `app.pipe_mode` flag)
348
+ - Automatically waits for LLM processing and tool calls to complete
349
+
350
+ ### Other Features
351
+ - **Modal System**: Full-screen modal overlays with widget support (dropdowns, checkboxes, sliders, text inputs)
352
+ - **Command System**: Extensible slash command parser and executor with menu rendering
353
+ - **Plugin System**: Dynamic plugin discovery with comprehensive SDK
354
+ - **Visual Effects**: Matrix rain effect and customizable color palettes
355
+ - **Status Display**: Multi-area status rendering with flexible view registry
356
+ - **Configuration**: Dot notation config system with plugin integration
357
+ - **Message Processing**: Advanced response parsing with thinking tag removal
358
+
359
+ ## Current State
360
+
361
+ Recent development focused on:
362
+ - Enhanced input plugin architecture with modular design
363
+ - LLM service output formatting consistency
364
+ - Message display and error handling improvements
365
+ - Event bus system with specialized components
366
+ - Modal system with overlay rendering and widget integration
367
+ - Command system with menu and executor components
368
+
369
+ The codebase uses Python 3.12+ and follows async/await patterns throughout.
kollabor-0.4.9/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Kollabor Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,31 @@
1
+ # Include documentation
2
+ include README.md
3
+ include LICENSE
4
+ include CLAUDE.md
5
+ include requirements.txt
6
+
7
+ # Include all markdown files in docs
8
+ recursive-include docs *.md
9
+ recursive-include docs *.rst
10
+
11
+ # Include plugin configuration files
12
+ recursive-include plugins *.json
13
+ recursive-include plugins *.yaml
14
+ recursive-include plugins *.yml
15
+
16
+ # Include type stubs
17
+ recursive-include core *.pyi
18
+ recursive-include plugins *.pyi
19
+
20
+ # Exclude common unwanted files
21
+ global-exclude __pycache__
22
+ global-exclude *.py[cod]
23
+ global-exclude *$py.class
24
+ global-exclude *.so
25
+ global-exclude .DS_Store
26
+ global-exclude *.egg-info
27
+ global-exclude .git*
28
+ global-exclude .pytest_cache
29
+ global-exclude .mypy_cache
30
+ global-exclude .coverage
31
+ global-exclude htmlcov