titan-cli 0.1.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 (146) hide show
  1. titan_cli/__init__.py +3 -0
  2. titan_cli/__main__.py +4 -0
  3. titan_cli/ai/__init__.py +0 -0
  4. titan_cli/ai/agents/__init__.py +15 -0
  5. titan_cli/ai/agents/base.py +152 -0
  6. titan_cli/ai/client.py +170 -0
  7. titan_cli/ai/constants.py +56 -0
  8. titan_cli/ai/exceptions.py +48 -0
  9. titan_cli/ai/models.py +34 -0
  10. titan_cli/ai/oauth_helper.py +120 -0
  11. titan_cli/ai/providers/__init__.py +9 -0
  12. titan_cli/ai/providers/anthropic.py +117 -0
  13. titan_cli/ai/providers/base.py +75 -0
  14. titan_cli/ai/providers/gemini.py +278 -0
  15. titan_cli/cli.py +59 -0
  16. titan_cli/clients/__init__.py +1 -0
  17. titan_cli/clients/gcloud_client.py +52 -0
  18. titan_cli/core/__init__.py +3 -0
  19. titan_cli/core/config.py +274 -0
  20. titan_cli/core/discovery.py +51 -0
  21. titan_cli/core/errors.py +81 -0
  22. titan_cli/core/models.py +52 -0
  23. titan_cli/core/plugins/available.py +36 -0
  24. titan_cli/core/plugins/models.py +67 -0
  25. titan_cli/core/plugins/plugin_base.py +108 -0
  26. titan_cli/core/plugins/plugin_registry.py +163 -0
  27. titan_cli/core/secrets.py +141 -0
  28. titan_cli/core/workflows/__init__.py +22 -0
  29. titan_cli/core/workflows/models.py +88 -0
  30. titan_cli/core/workflows/project_step_source.py +86 -0
  31. titan_cli/core/workflows/workflow_exceptions.py +17 -0
  32. titan_cli/core/workflows/workflow_filter_service.py +137 -0
  33. titan_cli/core/workflows/workflow_registry.py +419 -0
  34. titan_cli/core/workflows/workflow_sources.py +307 -0
  35. titan_cli/engine/__init__.py +39 -0
  36. titan_cli/engine/builder.py +159 -0
  37. titan_cli/engine/context.py +82 -0
  38. titan_cli/engine/mock_context.py +176 -0
  39. titan_cli/engine/results.py +91 -0
  40. titan_cli/engine/steps/ai_assistant_step.py +185 -0
  41. titan_cli/engine/steps/command_step.py +93 -0
  42. titan_cli/engine/utils/__init__.py +3 -0
  43. titan_cli/engine/utils/venv.py +31 -0
  44. titan_cli/engine/workflow_executor.py +187 -0
  45. titan_cli/external_cli/__init__.py +0 -0
  46. titan_cli/external_cli/configs.py +17 -0
  47. titan_cli/external_cli/launcher.py +65 -0
  48. titan_cli/messages.py +121 -0
  49. titan_cli/ui/tui/__init__.py +205 -0
  50. titan_cli/ui/tui/__previews__/statusbar_preview.py +88 -0
  51. titan_cli/ui/tui/app.py +113 -0
  52. titan_cli/ui/tui/icons.py +70 -0
  53. titan_cli/ui/tui/screens/__init__.py +24 -0
  54. titan_cli/ui/tui/screens/ai_config.py +498 -0
  55. titan_cli/ui/tui/screens/ai_config_wizard.py +882 -0
  56. titan_cli/ui/tui/screens/base.py +110 -0
  57. titan_cli/ui/tui/screens/cli_launcher.py +151 -0
  58. titan_cli/ui/tui/screens/global_setup_wizard.py +363 -0
  59. titan_cli/ui/tui/screens/main_menu.py +162 -0
  60. titan_cli/ui/tui/screens/plugin_config_wizard.py +550 -0
  61. titan_cli/ui/tui/screens/plugin_management.py +377 -0
  62. titan_cli/ui/tui/screens/project_setup_wizard.py +686 -0
  63. titan_cli/ui/tui/screens/workflow_execution.py +592 -0
  64. titan_cli/ui/tui/screens/workflows.py +249 -0
  65. titan_cli/ui/tui/textual_components.py +537 -0
  66. titan_cli/ui/tui/textual_workflow_executor.py +405 -0
  67. titan_cli/ui/tui/theme.py +102 -0
  68. titan_cli/ui/tui/widgets/__init__.py +40 -0
  69. titan_cli/ui/tui/widgets/button.py +108 -0
  70. titan_cli/ui/tui/widgets/header.py +116 -0
  71. titan_cli/ui/tui/widgets/panel.py +81 -0
  72. titan_cli/ui/tui/widgets/status_bar.py +115 -0
  73. titan_cli/ui/tui/widgets/table.py +77 -0
  74. titan_cli/ui/tui/widgets/text.py +177 -0
  75. titan_cli/utils/__init__.py +0 -0
  76. titan_cli/utils/autoupdate.py +155 -0
  77. titan_cli-0.1.0.dist-info/METADATA +149 -0
  78. titan_cli-0.1.0.dist-info/RECORD +146 -0
  79. titan_cli-0.1.0.dist-info/WHEEL +4 -0
  80. titan_cli-0.1.0.dist-info/entry_points.txt +9 -0
  81. titan_cli-0.1.0.dist-info/licenses/LICENSE +201 -0
  82. titan_plugin_git/__init__.py +1 -0
  83. titan_plugin_git/clients/__init__.py +8 -0
  84. titan_plugin_git/clients/git_client.py +772 -0
  85. titan_plugin_git/exceptions.py +40 -0
  86. titan_plugin_git/messages.py +112 -0
  87. titan_plugin_git/models.py +39 -0
  88. titan_plugin_git/plugin.py +118 -0
  89. titan_plugin_git/steps/__init__.py +1 -0
  90. titan_plugin_git/steps/ai_commit_message_step.py +171 -0
  91. titan_plugin_git/steps/branch_steps.py +104 -0
  92. titan_plugin_git/steps/commit_step.py +80 -0
  93. titan_plugin_git/steps/push_step.py +63 -0
  94. titan_plugin_git/steps/status_step.py +59 -0
  95. titan_plugin_git/workflows/__previews__/__init__.py +1 -0
  96. titan_plugin_git/workflows/__previews__/commit_ai_preview.py +124 -0
  97. titan_plugin_git/workflows/commit-ai.yaml +28 -0
  98. titan_plugin_github/__init__.py +11 -0
  99. titan_plugin_github/agents/__init__.py +6 -0
  100. titan_plugin_github/agents/config_loader.py +130 -0
  101. titan_plugin_github/agents/issue_generator.py +353 -0
  102. titan_plugin_github/agents/pr_agent.py +528 -0
  103. titan_plugin_github/clients/__init__.py +8 -0
  104. titan_plugin_github/clients/github_client.py +1105 -0
  105. titan_plugin_github/config/__init__.py +0 -0
  106. titan_plugin_github/config/pr_agent.toml +85 -0
  107. titan_plugin_github/exceptions.py +28 -0
  108. titan_plugin_github/messages.py +88 -0
  109. titan_plugin_github/models.py +330 -0
  110. titan_plugin_github/plugin.py +131 -0
  111. titan_plugin_github/steps/__init__.py +12 -0
  112. titan_plugin_github/steps/ai_pr_step.py +172 -0
  113. titan_plugin_github/steps/create_pr_step.py +86 -0
  114. titan_plugin_github/steps/github_prompt_steps.py +171 -0
  115. titan_plugin_github/steps/issue_steps.py +143 -0
  116. titan_plugin_github/steps/preview_step.py +40 -0
  117. titan_plugin_github/utils.py +82 -0
  118. titan_plugin_github/workflows/__previews__/__init__.py +1 -0
  119. titan_plugin_github/workflows/__previews__/create_pr_ai_preview.py +140 -0
  120. titan_plugin_github/workflows/create-issue-ai.yaml +32 -0
  121. titan_plugin_github/workflows/create-pr-ai.yaml +49 -0
  122. titan_plugin_jira/__init__.py +8 -0
  123. titan_plugin_jira/agents/__init__.py +6 -0
  124. titan_plugin_jira/agents/config_loader.py +154 -0
  125. titan_plugin_jira/agents/jira_agent.py +553 -0
  126. titan_plugin_jira/agents/prompts.py +364 -0
  127. titan_plugin_jira/agents/response_parser.py +435 -0
  128. titan_plugin_jira/agents/token_tracker.py +223 -0
  129. titan_plugin_jira/agents/validators.py +246 -0
  130. titan_plugin_jira/clients/jira_client.py +745 -0
  131. titan_plugin_jira/config/jira_agent.toml +92 -0
  132. titan_plugin_jira/config/templates/issue_analysis.md.j2 +78 -0
  133. titan_plugin_jira/exceptions.py +37 -0
  134. titan_plugin_jira/formatters/__init__.py +6 -0
  135. titan_plugin_jira/formatters/markdown_formatter.py +245 -0
  136. titan_plugin_jira/messages.py +115 -0
  137. titan_plugin_jira/models.py +89 -0
  138. titan_plugin_jira/plugin.py +264 -0
  139. titan_plugin_jira/steps/ai_analyze_issue_step.py +105 -0
  140. titan_plugin_jira/steps/get_issue_step.py +82 -0
  141. titan_plugin_jira/steps/prompt_select_issue_step.py +80 -0
  142. titan_plugin_jira/steps/search_saved_query_step.py +238 -0
  143. titan_plugin_jira/utils/__init__.py +13 -0
  144. titan_plugin_jira/utils/issue_sorter.py +140 -0
  145. titan_plugin_jira/utils/saved_queries.py +150 -0
  146. titan_plugin_jira/workflows/analyze-jira-issues.yaml +34 -0
@@ -0,0 +1,88 @@
1
+ from textual.app import App, ComposeResult
2
+ from textual.widgets import Header, Footer, Static
3
+
4
+ from titan_cli.ui.tui.widgets.statusbar import StatusBarWidget
5
+
6
+ class StatusBarPreviewApp(App):
7
+ """
8
+ Una aplicaciΓ³n de Textual para previsualizar el StatusBarWidget.
9
+ """
10
+ CSS_PATH = "../../tui/widgets/statusbar.css" # Ruta relativa al CSS del widget
11
+ BINDINGS = [
12
+ ("q", "quit", "Quit"),
13
+ ("b", "cycle_branch", "Cycle Branch"),
14
+ ("a", "cycle_ai_status", "Cycle AI Status"),
15
+ ("p", "cycle_project", "Cycle Project")
16
+ ]
17
+
18
+ def on_mount(self) -> None:
19
+ self.set_interval(2, self.action_cycle_branch) # Cambiar la rama cada 2 segundos
20
+
21
+ def compose(self) -> ComposeResult:
22
+ yield Header()
23
+ yield Static("Pulsa 'q' para salir, 'b' para cambiar la branch, 'a' para AI Status, 'p' para Project.", classes="instructions")
24
+ yield StatusBarWidget()
25
+ yield Footer()
26
+
27
+ def action_cycle_branch(self) -> None:
28
+ """Cicla el nombre de la branch y actualiza el badge."""
29
+ branch_badge = self.query_one("#branch-info", StatusBarWidget.BadgeWidget) # Acceder a la clase interna
30
+ current_branch = branch_badge._value
31
+ if current_branch == "N/A":
32
+ new_branch = "main"
33
+ new_type = "success"
34
+ elif current_branch == "main":
35
+ new_branch = "develop"
36
+ new_type = "warning"
37
+ elif current_branch == "develop":
38
+ new_branch = "feature/new-feature"
39
+ new_type = "info"
40
+ elif current_branch.startswith("feature/"):
41
+ new_branch = "bugfix/critical-fix"
42
+ new_type = "error"
43
+ else:
44
+ new_branch = "N/A"
45
+ new_type = "info" # Volvemos al valor por defecto
46
+
47
+ # Eliminar las clases existentes y aΓ±adir la nueva
48
+ for cls in list(branch_badge.classes):
49
+ if cls.startswith("type--"):
50
+ branch_badge.remove_class(cls)
51
+ branch_badge.add_class(f"type--{new_type}")
52
+ branch_badge.update_value(new_branch)
53
+ branch_badge._badge_type = new_type # Actualizamos el tipo interno para futuras comparaciones
54
+
55
+ def action_cycle_ai_status(self) -> None:
56
+ """Cicla el estado de AI y actualiza el badge."""
57
+ ai_badge = self.query_one("#ai-info", StatusBarWidget.BadgeWidget)
58
+ current_status = ai_badge._value
59
+ if current_status == "Ready":
60
+ new_status = "Thinking..."
61
+ new_type = "info"
62
+ elif current_status == "Thinking...":
63
+ new_status = "Error!"
64
+ new_type = "error"
65
+ else:
66
+ new_status = "Ready"
67
+ new_type = "success"
68
+
69
+ for cls in list(ai_badge.classes):
70
+ if cls.startswith("type--"):
71
+ ai_badge.remove_class(cls)
72
+ ai_badge.add_class(f"type--{new_type}")
73
+ ai_badge.update_value(new_status)
74
+ ai_badge._badge_type = new_type
75
+
76
+ def action_cycle_project(self) -> None:
77
+ """Cicla el nombre del proyecto y actualiza el badge."""
78
+ project_badge = self.query_one("#project-info", StatusBarWidget.BadgeWidget)
79
+ current_project = project_badge._value
80
+ if current_project == "titan-cli":
81
+ new_project = "another-project"
82
+ else:
83
+ new_project = "titan-cli"
84
+
85
+ project_badge.update_value(new_project) # El tipo de proyecto no cambia el color aquΓ­
86
+
87
+ if __name__ == "__main__":
88
+ StatusBarPreviewApp().run()
@@ -0,0 +1,113 @@
1
+ """
2
+ Titan TUI Application
3
+
4
+ Main Textual application for Titan CLI with fixed status bar and theme support.
5
+ """
6
+ from textual.app import App
7
+ from textual.binding import Binding
8
+
9
+ from titan_cli.core.config import TitanConfig
10
+ from titan_cli.core.plugins.plugin_registry import PluginRegistry
11
+ from titan_cli.external_cli.launcher import CLILauncher
12
+ from .theme import TITAN_THEME_CSS
13
+ from .screens import MainMenuScreen
14
+
15
+
16
+ class TitanApp(App):
17
+ """
18
+ The main Titan TUI application.
19
+
20
+ This is a Textual-based TUI that provides a visual interface for Titan CLI,
21
+ with a fixed status bar at the bottom and interactive menus/workflows.
22
+
23
+ The layout is:
24
+ - Header (top): Title and clock
25
+ - Main content area (scrollable)
26
+ - Status bar (bottom, fixed): Git branch, AI info, Project
27
+ - Footer (bottom): Keybindings
28
+ """
29
+
30
+ # Combine theme CSS with app-specific CSS
31
+ CSS = TITAN_THEME_CSS
32
+
33
+ # Allow text selection in terminal (Shift+Mouse will work in most terminals)
34
+ ENABLE_COMMAND_PALETTE = False # Disable Ctrl+\ interference
35
+
36
+ BINDINGS = [
37
+ Binding("q", "quit", "Quit", priority=True),
38
+ Binding("ctrl+c", "quit", "Quit", show=False, priority=True),
39
+ Binding("ctrl+shift+c", "toggle_copy_mode", "Copy Mode"),
40
+ Binding("?", "help", "Help"),
41
+ ]
42
+
43
+ def __init__(self, config: TitanConfig = None, initial_screen=None, **kwargs):
44
+ """
45
+ Initialize the Titan TUI application.
46
+
47
+ Args:
48
+ config: TitanConfig instance. If None, creates a new one.
49
+ initial_screen: Initial screen to show. If None, shows MainMenuScreen.
50
+ Can be a screen instance or a callable that returns a screen.
51
+ """
52
+ super().__init__(**kwargs)
53
+
54
+ # Initialize config and plugin registry
55
+ if config is None:
56
+ plugin_registry = PluginRegistry()
57
+ config = TitanConfig(registry=plugin_registry)
58
+
59
+ self.config = config
60
+ self._initial_screen = initial_screen
61
+ self.title = "Titan CLI"
62
+ self.sub_title = "Development Tools Orchestrator"
63
+
64
+ def on_mount(self) -> None:
65
+ """Initialize app and show initial screen."""
66
+ if self._initial_screen is not None:
67
+ # Use custom initial screen
68
+ if callable(self._initial_screen):
69
+ screen = self._initial_screen()
70
+ else:
71
+ screen = self._initial_screen
72
+ self.push_screen(screen)
73
+ else:
74
+ # Default: show main menu
75
+ self.push_screen(MainMenuScreen(self.config))
76
+
77
+ async def launch_external_cli(self, cli_name: str, prompt: str = None) -> int:
78
+ """
79
+ Launch an external CLI tool (like Claude CLI or Gemini CLI).
80
+
81
+ Suspends the TUI, launches the external CLI, then restores the TUI.
82
+
83
+ Args:
84
+ cli_name: Name of the CLI to launch (e.g., "claude", "gemini")
85
+ prompt: Optional initial prompt to pass to the CLI
86
+
87
+ Returns:
88
+ Exit code from the CLI tool
89
+ """
90
+
91
+ # Suspend the TUI temporarily
92
+ with self.suspend():
93
+ launcher = CLILauncher(cli_name)
94
+ exit_code = launcher.launch(prompt=prompt)
95
+
96
+ # TUI is automatically restored here
97
+ return exit_code
98
+
99
+ def action_toggle_copy_mode(self) -> None:
100
+ """Toggle copy mode - disables mouse capture to allow text selection."""
101
+ # Toggle mouse capture
102
+ current = getattr(self, '_copy_mode', False)
103
+ self._copy_mode = not current
104
+
105
+ # Disable/enable mouse capture globally
106
+ if self._copy_mode:
107
+ # Disable mouse - allows terminal selection
108
+ self.mouse_capture = False
109
+ self.notify("πŸ“‹ Copy Mode ON - Use mouse to select text, press Ctrl+Shift+C to exit", timeout=3)
110
+ else:
111
+ # Re-enable mouse
112
+ self.mouse_capture = True
113
+ self.notify("πŸ–±οΈ Copy Mode OFF - Mouse interactions restored", timeout=3)
@@ -0,0 +1,70 @@
1
+ """
2
+ Icon Constants for TUI
3
+
4
+ Centralized icon definitions using Unicode emojis for maximum compatibility.
5
+ All TUI screens and widgets should import icons from here.
6
+ """
7
+
8
+
9
+ class Icons:
10
+ """
11
+ Icon constants for Textual TUI.
12
+
13
+ Uses Unicode emojis that work across all terminals without special fonts.
14
+ Organized by category for easy discovery.
15
+ """
16
+
17
+ # Status indicators
18
+ SUCCESS = "βœ…"
19
+ ERROR = "❌"
20
+ WARNING = "⚠️"
21
+ INFO = "ℹ️ "
22
+ QUESTION = "❓"
23
+
24
+ # Progress states
25
+ PENDING = "⏸️ "
26
+ RUNNING = "⏳"
27
+ COMPLETED = SUCCESS # Alias
28
+ FAILED = ERROR # Alias
29
+ SKIPPED = "⏭️ "
30
+
31
+ # Workflow & execution
32
+ WORKFLOW = "⚑"
33
+ STEP = "β†’"
34
+ NESTED_WORKFLOW = "πŸ”„"
35
+
36
+ # Navigation
37
+ BACK = "←"
38
+ FORWARD = "β†’"
39
+ UP = "↑"
40
+ DOWN = "↓"
41
+ LEFT = "←"
42
+ RIGHT = "β†’"
43
+
44
+ # Resources
45
+ FOLDER = "πŸ“"
46
+ FILE = "πŸ“„"
47
+ PLUGIN = "πŸ”Œ"
48
+ PACKAGE = "πŸ“¦"
49
+ PROJECT = "πŸ“‚"
50
+
51
+ # Git & VCS
52
+ GIT_BRANCH = "🌿"
53
+ GIT_COMMIT = "πŸ’Ύ"
54
+ GIT_PULL = "⬇️"
55
+ GIT_PUSH = "⬆️"
56
+
57
+ # AI & Automation
58
+ AI = "πŸ€–"
59
+ ROBOT = "πŸ€–"
60
+ SPARKLES = "✨"
61
+
62
+ # General UI
63
+ MENU = "☰"
64
+ SETTINGS = "βš™οΈ "
65
+ SEARCH = "πŸ”"
66
+ STAR = "⭐"
67
+ CHECK = "βœ“"
68
+ CROSS = "βœ—"
69
+ BULLET = "β€’"
70
+ ARROW = "β†’"
@@ -0,0 +1,24 @@
1
+ """
2
+ Titan TUI Screens
3
+
4
+ Screen components for different views in the Titan TUI.
5
+ """
6
+ from .base import BaseScreen
7
+ from .main_menu import MainMenuScreen
8
+ from .workflows import WorkflowsScreen
9
+ from .workflow_execution import WorkflowExecutionScreen
10
+ from .global_setup_wizard import GlobalSetupWizardScreen
11
+ from .project_setup_wizard import ProjectSetupWizardScreen
12
+ from .plugin_config_wizard import PluginConfigWizardScreen
13
+ from .plugin_management import PluginManagementScreen
14
+
15
+ __all__ = [
16
+ "BaseScreen",
17
+ "MainMenuScreen",
18
+ "WorkflowsScreen",
19
+ "WorkflowExecutionScreen",
20
+ "GlobalSetupWizardScreen",
21
+ "ProjectSetupWizardScreen",
22
+ "PluginConfigWizardScreen",
23
+ "PluginManagementScreen",
24
+ ]