Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Claudette.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
from .context.manage_files import ClaudetteContextManageFilesCommand
from .context.refresh_files import ClaudetteContextRefreshFilesCommand

from .repomix.run_repomix import ClaudetteRunRepomixCommand
from .repomix.clear_repomix import ClaudetteClearRepomixCommand
from .repomix.show_repomix import ClaudetteShowRepomixCommand

from .settings.select_model_panel import ClaudetteSelectModelPanelCommand
from .settings.select_api_key_panel import ClaudetteSelectApiKeyPanelCommand
from .settings.select_system_message_panel import ClaudetteSelectSystemMessagePanelCommand
Expand Down
3 changes: 3 additions & 0 deletions Claudette.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,8 @@
// If set_scratch is set to true, the chat view will be closed without
// prompting to save.
"set_scratch": true
},
"repomix": {
"executable": "repomix"
}
}
12 changes: 12 additions & 0 deletions Default.sublime-commands
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,17 @@
"base_file": "${packages}/Claudette/Claudette.sublime-settings",
"default": "{\n\t$0\n}\n"
}
},
{
"caption": "Claudette: Repomix Run",
"command": "claudette_run_repomix"
},
{
"caption": "Claudette: Repomix Show Content",
"command": "claudette_show_repomix"
},
{
"caption": "Claudette: Repomix Clear Content",
"command": "claudette_clear_repomix"
}
]
17 changes: 17 additions & 0 deletions Main.sublime-menu
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,23 @@
"caption": "Switch API Key",
"command": "claudette_select_api_key_panel"
},
{
"caption": "Repomix",
"children": [
{
"caption": "Run Repomix",
"command": "claudette_run_repomix"
},
{
"caption": "Show Content",
"command": "claudette_show_repomix"
},
{
"caption": "Clear Content",
"command": "claudette_clear_repomix"
}
]
},
{
"caption": "Chat History",
"children": [
Expand Down
11 changes: 10 additions & 1 deletion Side Bar.sublime-menu
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@
{
"caption": "Clear Included Files",
"command": "claudette_context_clear_files"
}
},
{
"caption": "Repomix Run",
"command": "claudette_run_repomix",
"args": {"paths": []},
},
{
"caption": "Repomix Clear",
"command": "claudette_clear_repomix",
}
]
}
]
13 changes: 13 additions & 0 deletions api/api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# api/api.py
import sublime
import json
import urllib.request
Expand Down Expand Up @@ -182,6 +183,18 @@ def handle_error(error_msg):

system_messages.append(system_message)

repomix_content = chat_view.settings().get('claudette_repomix')
if repomix_content:
system_message = {
"type": "text",
"text": repomix_content.strip()
}

if self.should_use_cache_control(self.model):
system_message["cache_control"] = {"type": "ephemeral"}

system_messages.append(system_message)

data = {
'messages': filtered_messages,
'max_tokens': max_tokens,
Expand Down
25 changes: 25 additions & 0 deletions chat/chat_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,3 +380,28 @@ def destroy(self):
del self._instances[window_id]

self.view = None

def status_message(self, message: str, prefix: str = "", scroll_to_end: bool = True) -> None:
"""
Display a status message in the chat view without adding it to the conversation history.

Args:
message (str): The status message to display
prefix (str, optional): Icon or text prefix for the message.
scroll_to_end (bool, optional): Whether to scroll to the end after displaying. Defaults to True
"""
if not self.view:
return

if self.get_size() > 0:
message = f"\n\n{prefix} {message}\n"
else:
message = f"{prefix} {message}\n"

self.view.set_read_only(False)
self.view.run_command('append', {
'characters': message,
'force': True,
'scroll_to_end': scroll_to_end
})
self.view.set_read_only(True)
6 changes: 3 additions & 3 deletions repomix.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"parsableStyle": false,
"fileSummary": true,
"directoryStructure": true,
"removeComments": false,
"removeEmptyLines": false,
"removeComments": true,
"removeEmptyLines": true,
"topFilesLength": 5,
"showLineNumbers": false,
"copyToClipboard": false
Expand All @@ -18,7 +18,7 @@
"customPatterns": []
},
"security": {
"enableSecurityCheck": true
"enableSecurityCheck": false
},
"tokenCount": {
"encoding": "o200k_base"
Expand Down
38 changes: 38 additions & 0 deletions repomix/clear_repomix.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import sublime
import sublime_plugin
from ..utils import claudette_chat_status_message

class ClaudetteClearRepomixCommand(sublime_plugin.WindowCommand):
"""Command to clear Repomix content from the active chat view."""

def get_active_chat_view(self):
"""Get the current active chat view."""
for view in self.window.views():
if (view.settings().get('claudette_is_chat_view', False) and
view.settings().get('claudette_is_current_chat', False)):
return view
return None

def is_visible(self):
"""Always show the command in menus."""
return True

def is_enabled(self):
"""Enable command only if there's Repomix content to clear."""
chat_view = self.get_active_chat_view()
if not chat_view:
return False
return chat_view.settings().get('claudette_repomix') is not None

def run(self):
"""Clear Repomix content from the active chat view."""
chat_view = self.get_active_chat_view()
if not chat_view:
sublime.status_message("No active chat view found")
return

chat_view.settings().erase('claudette_repomix')
chat_view.settings().erase('claudette_repomix_tokens')

claudette_chat_status_message(window, "Repomix content cleared", prefix="✅")
sublime.status_message("Repomix content cleared")
Loading