@@ -15,7 +15,7 @@ import (
1515 "time"
1616)
1717
18- const version = "0.3.1 "
18+ const version = "0.4.0 "
1919
2020// Message represents a conversation message
2121type Message struct {
@@ -270,15 +270,18 @@ func buildSearchLines(conversations []Conversation) ([]string, map[string]Conver
270270 }
271271
272272 displayText := truncate (firstUserMsg .Text , 100 )
273- searchText := strings .Join (strings .Fields (strings .Join (allUserText , " " )), " " )
274- ts := formatTimestamp (conv .LastTimestamp )
273+ firstTs := formatTimestamp (conv .FirstTimestamp )
274+ lastTs := formatTimestamp (conv .LastTimestamp )
275+ // Include session ID, timestamps, project/cwd, and all user messages in search text
276+ allSearchText := append ([]string {conv .SessionID , firstTs , lastTs , conv .Cwd , project }, allUserText ... )
277+ searchText := strings .Join (strings .Fields (strings .Join (allSearchText , " " )), " " )
275278 projectPad := padOrTruncate (project , 25 )
276279
277280 // Format: id \t date \t project \t display_message \t search_text
281+ // search_text hidden with zero-width or minimal display
278282 // Colors: date=dim, project=yellow/bold, message=white
279- // search_text is hidden (column 5) but used for matching
280283 line := fmt .Sprintf ("%s\t \033 [90m%s\033 [0m\t \033 [1;33m%s\033 [0m\t %s\t %s" ,
281- conv .SessionID , ts , projectPad , displayText , searchText )
284+ conv .SessionID , lastTs , projectPad , displayText , searchText )
282285 lines = append (lines , line )
283286 }
284287
@@ -368,8 +371,10 @@ func showPreview(line, query string) {
368371 return
369372 }
370373
371- fmt .Printf ("\033 [1;33mProject:\033 [0m %s\n " , conv .Cwd )
372- fmt .Printf ("\033 [1;33mSession:\033 [0m %s\n " , sessionID )
374+ fmt .Printf ("\033 [1;33mProject:\033 [0m %s\n " , highlight (conv .Cwd , query ))
375+ fmt .Printf ("\033 [1;33mSession:\033 [0m %s\n " , highlight (sessionID , query ))
376+ fmt .Printf ("\033 [1;33mFirst activity:\033 [0m %s\n " , highlight (formatTimestamp (conv .FirstTimestamp ), query ))
377+ fmt .Printf ("\033 [1;33mLast activity:\033 [0m %s\n " , highlight (formatTimestamp (conv .LastTimestamp ), query ))
373378 fmt .Printf ("\033 [1;33mTotal messages:\033 [0m %d\n \n " , len (conv .Messages ))
374379
375380 // Find all messages containing the query
@@ -507,10 +512,36 @@ func main() {
507512 return
508513 }
509514
515+ // Debug mode - dump search lines with optional filter highlight
516+ for i , arg := range args {
517+ if arg == "--dump" {
518+ filter := ""
519+ if i + 1 < len (args ) && ! strings .HasPrefix (args [i + 1 ], "-" ) {
520+ filter = args [i + 1 ]
521+ }
522+ conversations , _ := getConversations ()
523+ lines , _ := buildSearchLines (conversations )
524+ for _ , line := range lines {
525+ if filter != "" {
526+ line = highlight (line , filter )
527+ }
528+ fmt .Println (line )
529+ }
530+ return
531+ }
532+ }
533+
534+ // Parse ccs args: positional arg is filter, args after -- go to claude
535+ // Usage: ccs [filter] [-- claude-args...]
510536 var claudeFlags []string
511- for _ , arg := range args {
512- if strings .HasPrefix (arg , "-" ) {
513- claudeFlags = append (claudeFlags , arg )
537+ var filterQuery string
538+ for i , arg := range args {
539+ if arg == "--" {
540+ claudeFlags = args [i + 1 :]
541+ break
542+ }
543+ if ! strings .HasPrefix (arg , "-" ) && filterQuery == "" {
544+ filterQuery = arg
514545 }
515546 }
516547
@@ -552,11 +583,10 @@ func main() {
552583
553584 self , _ := os .Executable ()
554585
555- cmd := exec . Command ( "fzf" ,
586+ fzfArgs := [] string {
556587 "--ansi" ,
557588 "--delimiter=\t " ,
558- "--with-nth=2,3,4" ,
559- "--nth=2.." ,
589+ "--exact" ,
560590 "--no-sort" ,
561591 "--tabstop=4" ,
562592 "--preview" , fmt .Sprintf ("%s --preview {} {q}" , self ),
@@ -567,8 +597,12 @@ func main() {
567597 "--layout=reverse" ,
568598 "--border=rounded" ,
569599 "--info=inline" ,
570- )
600+ }
601+ if filterQuery != "" {
602+ fzfArgs = append (fzfArgs , "--query" , filterQuery )
603+ }
571604
605+ cmd := exec .Command ("fzf" , fzfArgs ... )
572606 cmd .Stdin = strings .NewReader (strings .Join (lines , "\n " ))
573607 cmd .Stderr = os .Stderr
574608
0 commit comments