@@ -292,6 +292,98 @@ func runMailArchive(cmd *cobra.Command, args []string) error {
292292 return nil
293293}
294294
295+ func runMailMarkRead (cmd * cobra.Command , args []string ) error {
296+ // Determine which inbox
297+ address := detectSender ()
298+
299+ // All mail uses town beads (two-level architecture)
300+ workDir , err := findMailWorkDir ()
301+ if err != nil {
302+ return fmt .Errorf ("not in a Gas Town workspace: %w" , err )
303+ }
304+
305+ // Get mailbox
306+ router := mail .NewRouter (workDir )
307+ mailbox , err := router .GetMailbox (address )
308+ if err != nil {
309+ return fmt .Errorf ("getting mailbox: %w" , err )
310+ }
311+
312+ // Mark all specified messages as read
313+ marked := 0
314+ var errors []string
315+ for _ , msgID := range args {
316+ if err := mailbox .MarkReadOnly (msgID ); err != nil {
317+ errors = append (errors , fmt .Sprintf ("%s: %v" , msgID , err ))
318+ } else {
319+ marked ++
320+ }
321+ }
322+
323+ // Report results
324+ if len (errors ) > 0 {
325+ fmt .Printf ("%s Marked %d/%d messages as read\n " ,
326+ style .Bold .Render ("⚠" ), marked , len (args ))
327+ for _ , e := range errors {
328+ fmt .Printf (" Error: %s\n " , e )
329+ }
330+ return fmt .Errorf ("failed to mark %d messages" , len (errors ))
331+ }
332+
333+ if len (args ) == 1 {
334+ fmt .Printf ("%s Message marked as read\n " , style .Bold .Render ("✓" ))
335+ } else {
336+ fmt .Printf ("%s Marked %d messages as read\n " , style .Bold .Render ("✓" ), marked )
337+ }
338+ return nil
339+ }
340+
341+ func runMailMarkUnread (cmd * cobra.Command , args []string ) error {
342+ // Determine which inbox
343+ address := detectSender ()
344+
345+ // All mail uses town beads (two-level architecture)
346+ workDir , err := findMailWorkDir ()
347+ if err != nil {
348+ return fmt .Errorf ("not in a Gas Town workspace: %w" , err )
349+ }
350+
351+ // Get mailbox
352+ router := mail .NewRouter (workDir )
353+ mailbox , err := router .GetMailbox (address )
354+ if err != nil {
355+ return fmt .Errorf ("getting mailbox: %w" , err )
356+ }
357+
358+ // Mark all specified messages as unread
359+ marked := 0
360+ var errors []string
361+ for _ , msgID := range args {
362+ if err := mailbox .MarkUnreadOnly (msgID ); err != nil {
363+ errors = append (errors , fmt .Sprintf ("%s: %v" , msgID , err ))
364+ } else {
365+ marked ++
366+ }
367+ }
368+
369+ // Report results
370+ if len (errors ) > 0 {
371+ fmt .Printf ("%s Marked %d/%d messages as unread\n " ,
372+ style .Bold .Render ("⚠" ), marked , len (args ))
373+ for _ , e := range errors {
374+ fmt .Printf (" Error: %s\n " , e )
375+ }
376+ return fmt .Errorf ("failed to mark %d messages" , len (errors ))
377+ }
378+
379+ if len (args ) == 1 {
380+ fmt .Printf ("%s Message marked as unread\n " , style .Bold .Render ("✓" ))
381+ } else {
382+ fmt .Printf ("%s Marked %d messages as unread\n " , style .Bold .Render ("✓" ), marked )
383+ }
384+ return nil
385+ }
386+
295387func runMailClear (cmd * cobra.Command , args []string ) error {
296388 // Determine which inbox to clear (target arg or auto-detect)
297389 address := ""
0 commit comments