aboutsummaryrefslogtreecommitdiff
path: root/internal/claude
diff options
context:
space:
mode:
Diffstat (limited to 'internal/claude')
-rw-r--r--internal/claude/preview.go5
-rw-r--r--internal/claude/search.go5
-rw-r--r--internal/claude/session.go13
3 files changed, 3 insertions, 20 deletions
diff --git a/internal/claude/preview.go b/internal/claude/preview.go
index 1ea08c1..01ab906 100644
--- a/internal/claude/preview.go
+++ b/internal/claude/preview.go
@@ -74,7 +74,6 @@ func LoadSessionPreview(session *Session, maxMessages int) PreviewContent {
}
parsedMessages := parseRawMessage(rawMessage)
-
messages = append(messages, parsedMessages...)
}
@@ -109,7 +108,6 @@ func parseRawMessage(rawMessage RawMessage) []PreviewMessage {
if content != "" {
result = append(result, PreviewMessage{Role: "user", Content: content})
}
-
case "assistant":
var assistantMessage AssistantMessage
@@ -129,7 +127,6 @@ func parseRawMessage(rawMessage RawMessage) []PreviewMessage {
if text != "" {
result = append(result, PreviewMessage{Role: "assistant", Content: text})
}
-
case "tool_use":
toolInfo := contentBlock.Name
@@ -150,7 +147,6 @@ func parseRawMessage(rawMessage RawMessage) []PreviewMessage {
} else if filePath, exists := inputMap["file_path"]; exists {
if filePathString, isString := filePath.(string); isString {
pathParts := strings.Split(filePathString, "/")
-
toolInfo += ": " + pathParts[len(pathParts)-1]
}
}
@@ -158,7 +154,6 @@ func parseRawMessage(rawMessage RawMessage) []PreviewMessage {
result = append(result, PreviewMessage{Role: "tool", Content: toolInfo})
}
-
case "thinking":
thinking := contentBlock.Thinking
diff --git a/internal/claude/search.go b/internal/claude/search.go
index c79f871..7959983 100644
--- a/internal/claude/search.go
+++ b/internal/claude/search.go
@@ -27,7 +27,6 @@ func SearchAllSessions(sessions []Session, query string) []SearchResult {
for sessionIndex := range sessions {
session := &sessions[sessionIndex]
matches := searchSession(session, query)
-
results = append(results, matches...)
}
@@ -66,7 +65,6 @@ func searchSession(session *Session, query string) []SearchResult {
}
matches := searchRawMessage(session, &rawMessage, query, messageIndex)
-
results = append(results, matches...)
if rawMessage.Type == "user" || rawMessage.Type == "assistant" {
@@ -92,7 +90,6 @@ func searchRawMessage(session *Session, rawMessage *RawMessage, query string, me
if matchPosition := strings.Index(contentLowercase, query); matchPosition != -1 {
content := matchContext(userMessage.Content, matchPosition, len(query))
-
results = append(results, SearchResult{
Session: session,
MessageIndex: messageIndex,
@@ -101,7 +98,6 @@ func searchRawMessage(session *Session, rawMessage *RawMessage, query string, me
MatchPosition: matchPosition,
})
}
-
case "assistant":
var assistantMessage AssistantMessage
@@ -115,7 +111,6 @@ func searchRawMessage(session *Session, rawMessage *RawMessage, query string, me
if matchPosition := strings.Index(textLowercase, query); matchPosition != -1 {
content := matchContext(contentBlock.Text, matchPosition, len(query))
-
results = append(results, SearchResult{
Session: session,
MessageIndex: messageIndex,
diff --git a/internal/claude/session.go b/internal/claude/session.go
index c2f191b..4f14cdd 100644
--- a/internal/claude/session.go
+++ b/internal/claude/session.go
@@ -21,9 +21,8 @@ type Session struct {
GitBranch string `json:"gitBranch"`
ProjectPath string `json:"projectPath"`
IsSidechain bool `json:"isSidechain"`
-
- ProjectName string `json:"-"`
- InTrash bool `json:"-"`
+ ProjectName string `json:"-"`
+ InTrash bool `json:"-"`
}
type SessionIndex struct {
@@ -333,7 +332,6 @@ func MoveToTrash(session *Session) error {
if _, statError := os.Stat(sourceAssociatedDirectory); statError == nil {
destinationAssociatedDirectory := filepath.Join(destinationProjectDirectory, session.SessionID)
-
_ = os.Rename(sourceAssociatedDirectory, destinationAssociatedDirectory)
}
@@ -371,7 +369,6 @@ func RestoreFromTrash(session *Session) error {
if _, statError := os.Stat(sourceAssociatedDirectory); statError == nil {
destinationAssociatedDirectory := filepath.Join(destinationProjectDirectory, session.SessionID)
-
_ = os.Rename(sourceAssociatedDirectory, destinationAssociatedDirectory)
}
@@ -393,7 +390,6 @@ func PermanentlyDelete(session *Session) error {
}
associatedDirectory := filepath.Join(projectDirectory, session.SessionID)
-
_ = os.RemoveAll(associatedDirectory)
return removeFromIndex(projectDirectory, session.SessionID)
@@ -555,14 +551,10 @@ func ReassignSessionPath(session *Session, newPath string) error {
}
oldIndexPath := filepath.Join(oldProjectDirectory, "sessions-index.json")
-
_ = removeFromIndex(oldProjectDirectory, session.SessionID)
-
newIndexPath := filepath.Join(newProjectDirectory, "sessions-index.json")
-
session.FullPath = newJsonlPath
session.ProjectPath = newPath
-
_ = addToIndexWithPath(newIndexPath, session, newPath)
if isEmpty, _ := isDirectoryEmpty(oldProjectDirectory); isEmpty {
@@ -769,6 +761,7 @@ func updateJsonlProjectPath(filePath, newPath string) error {
}
lines := strings.Split(string(fileData), "\n")
+
var updatedLines []string
for _, line := range lines {