tunacode-cli 0.0.11__py3-none-any.whl → 0.0.12__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.

Potentially problematic release.


This version of tunacode-cli might be problematic. Click here for more details.

Files changed (43) hide show
  1. tunacode/cli/commands.py +3 -4
  2. tunacode/cli/main.py +5 -4
  3. tunacode/cli/repl.py +2 -13
  4. tunacode/cli/textual_app.py +423 -0
  5. tunacode/cli/textual_bridge.py +158 -0
  6. tunacode/configuration/defaults.py +3 -4
  7. tunacode/configuration/models.py +3 -3
  8. tunacode/configuration/settings.py +2 -2
  9. tunacode/constants.py +2 -10
  10. tunacode/core/agents/main.py +3 -3
  11. tunacode/core/setup/__init__.py +0 -2
  12. tunacode/core/setup/agent_setup.py +3 -3
  13. tunacode/core/setup/base.py +3 -3
  14. tunacode/core/setup/coordinator.py +2 -2
  15. tunacode/core/setup/environment_setup.py +2 -2
  16. tunacode/core/setup/git_safety_setup.py +1 -2
  17. tunacode/core/state.py +3 -3
  18. tunacode/setup.py +2 -3
  19. tunacode/tools/base.py +4 -43
  20. tunacode/tools/read_file.py +2 -2
  21. tunacode/tools/run_command.py +2 -2
  22. tunacode/tools/update_file.py +3 -3
  23. tunacode/tools/write_file.py +3 -3
  24. tunacode/ui/completers.py +1 -1
  25. tunacode/ui/console.py +2 -3
  26. tunacode/ui/constants.py +1 -1
  27. tunacode/ui/decorators.py +2 -2
  28. tunacode/ui/input.py +1 -1
  29. tunacode/ui/keybindings.py +1 -1
  30. tunacode/ui/output.py +11 -4
  31. tunacode/ui/panels.py +3 -4
  32. tunacode/ui/prompt_manager.py +1 -1
  33. tunacode/ui/validators.py +1 -1
  34. tunacode/utils/diff_utils.py +3 -3
  35. {tunacode_cli-0.0.11.dist-info → tunacode_cli-0.0.12.dist-info}/METADATA +94 -40
  36. tunacode_cli-0.0.12.dist-info/RECORD +65 -0
  37. tunacode/core/setup/undo_setup.py +0 -33
  38. tunacode/services/undo_service.py +0 -244
  39. tunacode_cli-0.0.11.dist-info/RECORD +0 -65
  40. {tunacode_cli-0.0.11.dist-info → tunacode_cli-0.0.12.dist-info}/WHEEL +0 -0
  41. {tunacode_cli-0.0.11.dist-info → tunacode_cli-0.0.12.dist-info}/entry_points.txt +0 -0
  42. {tunacode_cli-0.0.11.dist-info → tunacode_cli-0.0.12.dist-info}/licenses/LICENSE +0 -0
  43. {tunacode_cli-0.0.11.dist-info → tunacode_cli-0.0.12.dist-info}/top_level.txt +0 -0
@@ -1,8 +1,8 @@
1
1
  """
2
2
  Module: tunacode.configuration.settings
3
3
 
4
- Application settings management for the Sidekick CLI.
5
- Manages application paths, tool configurations, and runtime settings.
4
+ Application settings management for the TunaCode CLI.
5
+ Handles configuration paths, model registries, and application metadata.
6
6
  """
7
7
 
8
8
  from pathlib import Path
tunacode/constants.py CHANGED
@@ -7,7 +7,7 @@ Centralizes all magic strings, UI text, error messages, and application constant
7
7
 
8
8
  # Application info
9
9
  APP_NAME = "TunaCode"
10
- APP_VERSION = "0.0.11"
10
+ APP_VERSION = "0.0.12"
11
11
 
12
12
  # File patterns
13
13
  GUIDE_FILE_PATTERN = "{name}.md"
@@ -35,7 +35,6 @@ CMD_HELP = "/help"
35
35
  CMD_CLEAR = "/clear"
36
36
  CMD_DUMP = "/dump"
37
37
  CMD_YOLO = "/yolo"
38
- CMD_UNDO = "/undo"
39
38
  CMD_COMPACT = "/compact"
40
39
  CMD_MODEL = "/model"
41
40
  CMD_EXIT = "exit"
@@ -46,7 +45,6 @@ DESC_HELP = "Show this help message"
46
45
  DESC_CLEAR = "Clear the conversation history"
47
46
  DESC_DUMP = "Show the current conversation history"
48
47
  DESC_YOLO = "Toggle confirmation prompts on/off"
49
- DESC_UNDO = "Undo the last file change"
50
48
  DESC_COMPACT = "Summarize the conversation context"
51
49
  DESC_MODEL = "List available models"
52
50
  DESC_MODEL_SWITCH = "Switch to a specific model"
@@ -56,7 +54,7 @@ DESC_EXIT = "Exit the application"
56
54
  # Command Configuration
57
55
  COMMAND_PREFIX = "/"
58
56
  COMMAND_CATEGORIES = {
59
- "state": ["yolo", "undo"],
57
+ "state": ["yolo"],
60
58
  "debug": ["dump", "compact"],
61
59
  "ui": ["clear", "help"],
62
60
  "config": ["model"],
@@ -110,7 +108,6 @@ ERROR_COMMAND_NOT_FOUND = "Error: Command not found or failed to execute:"
110
108
  ERROR_COMMAND_EXECUTION = (
111
109
  "Error: Command not found or failed to execute: {command}. Details: {error}"
112
110
  )
113
- ERROR_UNDO_INIT = "Error initializing undo system: {e}"
114
111
 
115
112
  # Command output messages
116
113
  CMD_OUTPUT_NO_OUTPUT = "No output."
@@ -118,11 +115,6 @@ CMD_OUTPUT_NO_ERRORS = "No errors."
118
115
  CMD_OUTPUT_FORMAT = "STDOUT:\n{output}\n\nSTDERR:\n{error}"
119
116
  CMD_OUTPUT_TRUNCATED = "\n...\n[truncated]\n...\n"
120
117
 
121
- # Undo system messages
122
- UNDO_DISABLED_HOME = "Undo system disabled, running from home directory"
123
- UNDO_DISABLED_NO_GIT = "⚠️ Not in a git repository - undo functionality will be limited"
124
- UNDO_INITIAL_COMMIT = "Initial commit for tunacode undo history"
125
- UNDO_GIT_TIMEOUT = "Git initialization timed out"
126
118
 
127
119
  # Log/status messages
128
120
  MSG_UPDATE_AVAILABLE = "Update available: v{latest_version}"
@@ -1,7 +1,7 @@
1
- """Module: sidekick.core.agents.main
1
+ """Module: tunacode.core.agents.main
2
2
 
3
- Main agent functionality and coordination for the Sidekick CLI.
4
- Provides agent creation, message processing, and tool call management.
3
+ Main agent functionality and coordination for the TunaCode CLI.
4
+ Handles agent creation, configuration, and request processing.
5
5
  """
6
6
 
7
7
  from datetime import datetime, timezone
@@ -4,7 +4,6 @@ from .config_setup import ConfigSetup
4
4
  from .coordinator import SetupCoordinator
5
5
  from .environment_setup import EnvironmentSetup
6
6
  from .git_safety_setup import GitSafetySetup
7
- from .undo_setup import UndoSetup
8
7
 
9
8
  __all__ = [
10
9
  "BaseSetup",
@@ -12,6 +11,5 @@ __all__ = [
12
11
  "ConfigSetup",
13
12
  "EnvironmentSetup",
14
13
  "GitSafetySetup",
15
- "UndoSetup",
16
14
  "AgentSetup",
17
15
  ]
@@ -1,7 +1,7 @@
1
- """Module: tinyagent.core.setup.agent_setup
1
+ """Module: tunacode.core.setup.agent_setup
2
2
 
3
- Agent initialization and configuration for the Sidekick CLI.
4
- Handles the setup and validation of AI agents with the selected model.
3
+ Agent initialization and configuration for the TunaCode CLI.
4
+ Sets up AI agents with proper model configurations and tools.
5
5
  """
6
6
 
7
7
  from typing import Any, Optional
@@ -1,7 +1,7 @@
1
- """Module: sidekick.core.setup.base
1
+ """Module: tunacode.core.setup.base
2
2
 
3
- Base setup step abstraction for the Sidekick CLI initialization process.
4
- Defines the contract that all setup steps must implement.
3
+ Base setup step abstraction for the TunaCode CLI initialization process.
4
+ Provides common interface and functionality for all setup steps.
5
5
  """
6
6
 
7
7
  from abc import ABC, abstractmethod
@@ -1,6 +1,6 @@
1
- """Module: tinyagent.core.setup.coordinator
1
+ """Module: tunacode.core.setup.coordinator
2
2
 
3
- Setup orchestration and coordination for the Sidekick CLI.
3
+ Setup orchestration and coordination for the TunaCode CLI.
4
4
  Manages the execution order and validation of all registered setup steps.
5
5
  """
6
6
 
@@ -1,7 +1,7 @@
1
1
  """Module: tunacode.core.setup.environment_setup
2
2
 
3
- Environment detection and configuration for the Sidekick CLI.
4
- Handles setting up environment variables from user configuration.
3
+ Environment detection and configuration for the TunaCode CLI.
4
+ Validates system requirements and environment variables.
5
5
  """
6
6
 
7
7
  import os
@@ -133,8 +133,7 @@ class GitSafetySetup(BaseSetup):
133
133
  await panel(
134
134
  "⚠️ Working Without Safety Branch",
135
135
  "You've chosen to work directly on your current branch.\n"
136
- "TunaCode will modify files in place. Make sure you have backups!\n"
137
- "You can always use /undo to revert changes.",
136
+ "TunaCode will modify files in place. Make sure you have backups!",
138
137
  border_style="red"
139
138
  )
140
139
  # Save preference
tunacode/core/state.py CHANGED
@@ -1,7 +1,7 @@
1
- """Module: sidekick.core.state
1
+ """Module: tunacode.core.state
2
2
 
3
- State management system for session data in Sidekick CLI.
4
- Provides centralized state tracking for agents, messages, configurations, and session information.
3
+ State management system for session data in TunaCode CLI.
4
+ Handles user preferences, conversation history, and runtime state.
5
5
  """
6
6
 
7
7
  import uuid
tunacode/setup.py CHANGED
@@ -8,7 +8,7 @@ Provides high-level setup functions for initializing the application and its age
8
8
  from typing import Any, Optional
9
9
 
10
10
  from tunacode.core.setup import (AgentSetup, ConfigSetup, EnvironmentSetup, GitSafetySetup,
11
- SetupCoordinator, UndoSetup)
11
+ SetupCoordinator)
12
12
  from tunacode.core.state import StateManager
13
13
 
14
14
 
@@ -29,8 +29,7 @@ async def setup(run_setup: bool, state_manager: StateManager, cli_config: dict =
29
29
  config_setup.cli_config = cli_config
30
30
  coordinator.register_step(config_setup)
31
31
  coordinator.register_step(EnvironmentSetup(state_manager))
32
- coordinator.register_step(GitSafetySetup(state_manager)) # Run after config/env but before undo
33
- coordinator.register_step(UndoSetup(state_manager))
32
+ coordinator.register_step(GitSafetySetup(state_manager))
34
33
 
35
34
  # Run all setup steps
36
35
  await coordinator.run_setup(force_setup=run_setup)
tunacode/tools/base.py CHANGED
@@ -1,4 +1,4 @@
1
- """Base tool class for all Sidekick tools.
1
+ """Base tool class for all TunaCode tools.
2
2
 
3
3
  This module provides a base class that implements common patterns
4
4
  for all tools including error handling, UI logging, and ModelRetry support.
@@ -13,7 +13,7 @@ from tunacode.types import FilePath, ToolName, ToolResult, UILogger
13
13
 
14
14
 
15
15
  class BaseTool(ABC):
16
- """Base class for all Sidekick tools providing common functionality."""
16
+ """Base class for all TunaCode tools providing common functionality."""
17
17
 
18
18
  def __init__(self, ui_logger: UILogger | None = None):
19
19
  """Initialize the base tool.
@@ -42,11 +42,6 @@ class BaseTool(ABC):
42
42
  if self.ui:
43
43
  await self.ui.info(f"{self.tool_name}({self._format_args(*args, **kwargs)})")
44
44
  result = await self._execute(*args, **kwargs)
45
-
46
- # For file operations, try to create a git commit for undo tracking
47
- if isinstance(self, FileBasedTool):
48
- await self._commit_for_undo()
49
-
50
45
  return result
51
46
  except ModelRetry as e:
52
47
  # Log as warning and re-raise for pydantic-ai
@@ -142,46 +137,12 @@ class FileBasedTool(BaseTool):
142
137
  """Base class for tools that work with files.
143
138
 
144
139
  Provides common file-related functionality like:
145
- - Path validation
140
+ - Path validation
146
141
  - File existence checking
147
142
  - Directory creation
148
143
  - Encoding handling
149
- - Git commit for undo tracking
144
+ - Enhanced error handling for file operations
150
145
  """
151
-
152
- async def _commit_for_undo(self) -> None:
153
- """Create a git commit for undo tracking after file operations.
154
-
155
- This method gracefully handles cases where git is not available:
156
- - No git repository: Warns user about limited undo functionality
157
- - Git command fails: Warns but doesn't break the main operation
158
- - Any other error: Silently continues (file operation still succeeds)
159
- """
160
- try:
161
- # Import here to avoid circular imports
162
- from tunacode.services.undo_service import commit_for_undo, is_in_git_project
163
-
164
- # Check if we're in a git project first
165
- if not is_in_git_project():
166
- if self.ui:
167
- await self.ui.muted("⚠️ No git repository - undo functionality limited")
168
- return
169
-
170
- # Try to create commit with tool name as prefix
171
- success = commit_for_undo(message_prefix=f"tunacode {self.tool_name.lower()}")
172
- if success and self.ui:
173
- await self.ui.muted("• Git commit created for undo tracking")
174
- elif self.ui:
175
- await self.ui.muted("⚠️ Could not create git commit - undo may not work")
176
- except Exception:
177
- # Silently ignore commit errors - don't break the main file operation
178
- # The file operation itself succeeded, we just can't track it for undo
179
- if self.ui:
180
- try:
181
- await self.ui.muted("⚠️ Git commit failed - undo functionality limited")
182
- except:
183
- # Even the warning failed, just continue silently
184
- pass
185
146
 
186
147
  def _format_args(self, filepath: FilePath, *args, **kwargs) -> str:
187
148
  """Format arguments with filepath as first argument."""
@@ -1,7 +1,7 @@
1
1
  """
2
- Module: sidekick.tools.read_file
2
+ Module: tunacode.tools.read_file
3
3
 
4
- File reading tool for agent operations in the Sidekick application.
4
+ File reading tool for agent operations in the TunaCode application.
5
5
  Provides safe file reading with size limits and proper error handling.
6
6
  """
7
7
 
@@ -1,7 +1,7 @@
1
1
  """
2
- Module: sidekick.tools.run_command
2
+ Module: tunacode.tools.run_command
3
3
 
4
- Command execution tool for agent operations in the Sidekick application.
4
+ Command execution tool for agent operations in the TunaCode application.
5
5
  Provides controlled shell command execution with output capture and truncation.
6
6
  """
7
7
 
@@ -1,8 +1,8 @@
1
1
  """
2
- Module: sidekick.tools.update_file
2
+ Module: tunacode.tools.update_file
3
3
 
4
- File update tool for agent operations in the Sidekick application.
5
- Enables safe text replacement in existing files with target/patch semantics.
4
+ File update tool for agent operations in the TunaCode application.
5
+ Provides targeted file content modification with diff-based updates.
6
6
  """
7
7
 
8
8
  import os
@@ -1,8 +1,8 @@
1
1
  """
2
- Module: sidekick.tools.write_file
2
+ Module: tunacode.tools.write_file
3
3
 
4
- File writing tool for agent operations in the Sidekick application.
5
- Creates new files with automatic directory creation and overwrite protection.
4
+ File writing tool for agent operations in the TunaCode application.
5
+ Provides safe file creation with conflict detection and encoding handling.
6
6
  """
7
7
 
8
8
  import os
tunacode/ui/completers.py CHANGED
@@ -44,7 +44,7 @@ class CommandCompleter(Completer):
44
44
  command_names = self.command_registry.get_command_names()
45
45
  else:
46
46
  # Fallback list of commands
47
- command_names = ['/help', '/clear', '/dump', '/yolo', '/undo',
47
+ command_names = ['/help', '/clear', '/dump', '/yolo',
48
48
  '/branch', '/compact', '/model']
49
49
 
50
50
  # Get the partial command (without /)
tunacode/ui/console.py CHANGED
@@ -1,7 +1,6 @@
1
- """Main console coordination module for Sidekick UI.
1
+ """Main console coordination module for TunaCode UI.
2
2
 
3
- This module re-exports functions from specialized UI modules to maintain
4
- backward compatibility while organizing code into focused modules.
3
+ Provides high-level console functions and coordinates between different UI components.
5
4
  """
6
5
 
7
6
  from rich.console import Console as RichConsole
tunacode/ui/constants.py CHANGED
@@ -1,4 +1,4 @@
1
- """UI-specific constants for Sidekick."""
1
+ """UI-specific constants for TunaCode."""
2
2
 
3
3
  # UI Layout Constants
4
4
  DEFAULT_PANEL_PADDING = {"top": 1, "right": 0, "bottom": 1, "left": 0}
tunacode/ui/decorators.py CHANGED
@@ -1,7 +1,7 @@
1
1
  """
2
- Module: sidekick.ui.decorators
2
+ Module: tunacode.ui.decorators
3
3
 
4
- Provides decorators for UI functions including sync/async wrapper patterns.
4
+ Decorators for UI functions, particularly for creating sync wrappers of async functions.
5
5
  """
6
6
 
7
7
  import asyncio
tunacode/ui/input.py CHANGED
@@ -1,4 +1,4 @@
1
- """User input handling functions for Sidekick UI."""
1
+ """User input handling functions for TunaCode UI."""
2
2
 
3
3
  from typing import Optional
4
4
 
@@ -1,4 +1,4 @@
1
- """Key binding handlers for Sidekick UI."""
1
+ """Key binding handlers for TunaCode UI."""
2
2
 
3
3
  from prompt_toolkit.key_binding import KeyBindings
4
4
 
tunacode/ui/output.py CHANGED
@@ -1,4 +1,4 @@
1
- """Output and display functions for Sidekick UI."""
1
+ """Output and display functions for TunaCode UI."""
2
2
 
3
3
  from prompt_toolkit.application import run_in_terminal
4
4
  from rich.console import Console
@@ -16,9 +16,16 @@ from .decorators import create_sync_wrapper
16
16
  console = Console()
17
17
  colors = DotDict(UI_COLORS)
18
18
 
19
- BANNER = """[bold #00d7ff]╭─────────────────────────────────────────────────────────────────╮[/bold #00d7ff]
20
- [bold #00d7ff]│[/bold #00d7ff] [bold white]T U N A C O D E[/bold white] [dim #64748b]• Agentic AI Development Environment[/dim #64748b] [bold #00d7ff]│[/bold #00d7ff]
21
- [bold #00d7ff]╰─────────────────────────────────────────────────────────────────╯[/bold #00d7ff]"""
19
+ BANNER = """[bold cyan]
20
+ ████████╗██╗ ██╗███╗ ██╗ █████╗ ██████╗ ██████╗ ██████╗ ███████╗
21
+ ╚══██╔══╝██║ ██║████╗ ██║██╔══██╗██╔════╝██╔═══██╗██╔══██╗██╔════╝
22
+ ██║ ██║ ██║██╔██╗ ██║███████║██║ ██║ ██║██║ ██║█████╗
23
+ ██║ ██║ ██║██║╚██╗██║██╔══██║██║ ██║ ██║██║ ██║██╔══╝
24
+ ██║ ╚██████╔╝██║ ╚████║██║ ██║╚██████╗╚██████╔╝██████╔╝███████╗
25
+ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝
26
+ [/bold cyan]
27
+
28
+ ● Caution: This tool can modify your codebase - always use git branches"""
22
29
 
23
30
 
24
31
  @create_sync_wrapper
tunacode/ui/panels.py CHANGED
@@ -1,4 +1,4 @@
1
- """Panel display functions for Sidekick UI."""
1
+ """Panel display functions for TunaCode UI."""
2
2
 
3
3
  from typing import Any, Optional, Union
4
4
 
@@ -11,9 +11,9 @@ from rich.table import Table
11
11
 
12
12
  from tunacode.configuration.models import ModelRegistry
13
13
  from tunacode.constants import (APP_NAME, CMD_CLEAR, CMD_COMPACT, CMD_DUMP, CMD_EXIT, CMD_HELP,
14
- CMD_MODEL, CMD_UNDO, CMD_YOLO, DESC_CLEAR, DESC_COMPACT, DESC_DUMP,
14
+ CMD_MODEL, CMD_YOLO, DESC_CLEAR, DESC_COMPACT, DESC_DUMP,
15
15
  DESC_EXIT, DESC_HELP, DESC_MODEL, DESC_MODEL_DEFAULT,
16
- DESC_MODEL_SWITCH, DESC_UNDO, DESC_YOLO, PANEL_AVAILABLE_COMMANDS,
16
+ DESC_MODEL_SWITCH, DESC_YOLO, PANEL_AVAILABLE_COMMANDS,
17
17
  PANEL_ERROR, PANEL_MESSAGE_HISTORY, PANEL_MODELS, UI_COLORS)
18
18
  from tunacode.core.state import StateManager
19
19
  from tunacode.utils.file_utils import DotDict
@@ -130,7 +130,6 @@ async def help(command_registry=None) -> None:
130
130
  (CMD_CLEAR, DESC_CLEAR),
131
131
  (CMD_DUMP, DESC_DUMP),
132
132
  (CMD_YOLO, DESC_YOLO),
133
- (CMD_UNDO, DESC_UNDO),
134
133
  (CMD_COMPACT, DESC_COMPACT),
135
134
  (CMD_MODEL, DESC_MODEL),
136
135
  (f"{CMD_MODEL} <n>", DESC_MODEL_SWITCH),
@@ -1,4 +1,4 @@
1
- """Prompt configuration and management for Sidekick UI."""
1
+ """Prompt configuration and management for TunaCode UI."""
2
2
 
3
3
  from dataclasses import dataclass
4
4
  from typing import Optional
tunacode/ui/validators.py CHANGED
@@ -1,4 +1,4 @@
1
- """Input validators for Sidekick UI."""
1
+ """Input validators for TunaCode UI."""
2
2
 
3
3
  from prompt_toolkit.validation import ValidationError, Validator
4
4
 
@@ -1,8 +1,8 @@
1
1
  """
2
- Module: sidekick.utils.diff_utils
2
+ Module: tunacode.utils.diff_utils
3
3
 
4
- Provides diff visualization utilities for file changes.
5
- Generates styled text diffs between original and modified content using the difflib library.
4
+ Diff generation and formatting utilities for TunaCode.
5
+ Provides unified diff generation and colorized output for file changes.
6
6
  """
7
7
 
8
8
  import difflib
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tunacode-cli
3
- Version: 0.0.11
3
+ Version: 0.0.12
4
4
  Summary: Your agentic CLI developer.
5
5
  Author-email: larock22 <noreply@github.com>
6
6
  License-Expression: MIT
@@ -19,11 +19,11 @@ Classifier: Topic :: Utilities
19
19
  Requires-Python: >=3.10
20
20
  Description-Content-Type: text/markdown
21
21
  License-File: LICENSE
22
+ Requires-Dist: typer==0.15.3
22
23
  Requires-Dist: prompt_toolkit==3.0.51
23
24
  Requires-Dist: pydantic-ai[logfire]==0.2.6
24
25
  Requires-Dist: pygments==2.19.1
25
26
  Requires-Dist: rich==14.0.0
26
- Requires-Dist: typer==0.15.3
27
27
  Provides-Extra: dev
28
28
  Requires-Dist: build; extra == "dev"
29
29
  Requires-Dist: black; extra == "dev"
@@ -31,6 +31,7 @@ Requires-Dist: flake8; extra == "dev"
31
31
  Requires-Dist: isort; extra == "dev"
32
32
  Requires-Dist: pytest; extra == "dev"
33
33
  Requires-Dist: pytest-cov; extra == "dev"
34
+ Requires-Dist: textual-dev; extra == "dev"
34
35
  Dynamic: license-file
35
36
 
36
37
  # TunaCode
@@ -306,6 +307,97 @@ Create a `TUNACODE.md` file your project root to customize TunaCode's behavior:
306
307
 
307
308
  ---
308
309
 
310
+ ## Source Code Architecture
311
+
312
+ ### Directory Structure
313
+
314
+ ```
315
+ src/tunacode/
316
+ ├── cli/ # Command Line Interface
317
+ │ ├── commands.py # Command registry and implementations
318
+ │ ├── main.py # Entry point and CLI setup (Typer)
319
+ │ └── repl.py # Interactive REPL loop
320
+
321
+ ├── configuration/ # Configuration Management
322
+ │ ├── defaults.py # Default configuration values
323
+ │ ├── models.py # Configuration data models
324
+ │ └── settings.py # Settings loader and validator
325
+
326
+ ├── core/ # Core Application Logic
327
+ │ ├── agents/ # AI Agent System
328
+ │ │ └── main.py # Primary agent implementation (pydantic-ai)
329
+ │ ├── setup/ # Application Setup & Initialization
330
+ │ │ ├── agent_setup.py # Agent configuration
331
+ │ │ ├── base.py # Setup step base class
332
+ │ │ ├── config_setup.py # Configuration setup
333
+ │ │ ├── coordinator.py # Setup orchestration
334
+ │ │ ├── environment_setup.py # Environment validation
335
+ │ │ └── git_safety_setup.py # Git safety checks
336
+ │ ├── state.py # Application state management
337
+ │ └── tool_handler.py # Tool execution and validation
338
+
339
+ ├── services/ # External Services
340
+ │ ├── mcp.py # Model Context Protocol integration
341
+ │ └── undo_service.py # Undo operations (beta)
342
+
343
+ ├── tools/ # AI Agent Tools
344
+ │ ├── base.py # Tool base classes
345
+ │ ├── read_file.py # File reading tool
346
+ │ ├── run_command.py # Command execution tool
347
+ │ ├── update_file.py # File modification tool
348
+ │ └── write_file.py # File creation tool
349
+
350
+ ├── ui/ # User Interface Components
351
+ │ ├── completers.py # Tab completion
352
+ │ ├── console.py # Rich console setup
353
+ │ ├── input.py # Input handling
354
+ │ ├── keybindings.py # Keyboard shortcuts
355
+ │ ├── lexers.py # Syntax highlighting
356
+ │ ├── output.py # Output formatting and banner
357
+ │ ├── panels.py # UI panels and layouts
358
+ │ ├── prompt_manager.py # Prompt toolkit integration
359
+ │ ├── tool_ui.py # Tool confirmation dialogs
360
+ │ └── validators.py # Input validation
361
+
362
+ ├── utils/ # Utility Functions
363
+ │ ├── bm25.py # BM25 search algorithm(beta)
364
+ │ ├── diff_utils.py # Diff generation and formatting
365
+ │ ├── file_utils.py # File system operations
366
+ │ ├── ripgrep.py # Code search utilities
367
+ │ ├── system.py # System information
368
+ │ ├── text_utils.py # Text processing
369
+ │ └── user_configuration.py # User config management
370
+
371
+ ├── constants.py # Application constants
372
+ ├── context.py # Context management
373
+ ├── exceptions.py # Custom exceptions
374
+ ├── types.py # Type definitions
375
+ └── prompts/
376
+ └── system.txt # System prompts for AI agent
377
+ ```
378
+
379
+ ### Key Components
380
+
381
+ | Component | Purpose | Key Files |
382
+ | -------------------- | ------------------------ | ------------------------------- |
383
+ | **CLI Layer** | Command parsing and REPL | `cli/main.py`, `cli/repl.py` |
384
+ | **Agent System** | AI-powered assistance | `core/agents/main.py` |
385
+ | **Tool System** | File/command operations | `tools/*.py` |
386
+ | **State Management** | Session state tracking | `core/state.py` |
387
+ | **UI Framework** | Rich terminal interface | `ui/output.py`, `ui/console.py` |
388
+ | **Configuration** | User settings & models | `configuration/*.py` |
389
+ | **Setup System** | Initial configuration | `core/setup/*.py` |
390
+
391
+ ### Data Flow
392
+
393
+ ```
394
+ CLI Input → Command Registry → REPL → Agent → Tools → UI Output
395
+ ↓ ↓ ↓ ↓ ↓ ↑
396
+ State Manager ←────────────────────────────────────────┘
397
+ ```
398
+
399
+ ---
400
+
309
401
  ## Development
310
402
 
311
403
  ### Requirements
@@ -326,44 +418,6 @@ make lint
326
418
  make test
327
419
  ```
328
420
 
329
- ### Release Process
330
-
331
- <details>
332
- <summary><b>Click to expand release steps</b></summary>
333
-
334
- 1. **Update versions:**
335
-
336
- - `pyproject.toml`
337
- - `src/tunacode/constants.py` (APP_VERSION)
338
-
339
- 2. **Commit and tag:**
340
-
341
- ```bash
342
- git add pyproject.toml src/tunacode/constants.py
343
- git commit -m "chore: bump version to X.Y.Z"
344
- git tag vX.Y.Z
345
- git push origin vX.Y.Z
346
- ```
347
-
348
- 3. **Create release:**
349
- ```bash
350
- gh release create vX.Y.Z --title "vX.Y.Z" --notes "Release notes"
351
- ```
352
-
353
- </details>
354
-
355
- ### Commit Convention
356
-
357
- Following [Conventional Commits](https://www.conventionalcommits.org/):
358
-
359
- - `feat:` New features
360
- - `fix:` Bug fixes
361
- - `docs:` Documentation
362
- - `style:` Code formatting
363
- - `refactor:` Code refactoring
364
- - `test:` Tests
365
- - `chore:` Maintenance
366
-
367
421
  ---
368
422
 
369
423
  ## Links