Module: Teems::Commands

Defined in:
lib/teems.rb,
lib/teems/commands/cal.rb,
lib/teems/commands/ooo.rb,
lib/teems/commands/org.rb,
lib/teems/commands/who.rb,
lib/teems/commands/auth.rb,
lib/teems/commands/base.rb,
lib/teems/commands/help.rb,
lib/teems/commands/sync.rb,
lib/teems/commands/chats.rb,
lib/teems/commands/status.rb,
lib/teems/commands/meeting.rb,
lib/teems/commands/activity.rb,
lib/teems/commands/channels.rb,
lib/teems/commands/messages.rb,
lib/teems/commands/meeting_recording.rb,
lib/teems/commands/meeting_transcript.rb

Overview

CLI commands implementing user-facing functionality

Defined Under Namespace

Modules: ActivityFormatting, AttachmentDownload, AuthStatus, AuthTokenInput, CalCreateActions, CalCreateValidation, CalDateRange, CalEventActions, CalEventFields, CalEventResolver, CalInteractiveMode, CalOptionDefs, CalSubcommandParser, ChatsDisplay, ChatsParsing, CommandOutput, CommandValidation, EmbedPageParser, MeetingCallFilter, MeetingChatDisplay, MeetingDisplay, MeetingFilename, MeetingMessageParser, MeetingOptionDefs, MeetingRecording, MeetingTargetResolver, MeetingTranscript, MessagesDisplay, OooActions, OooBuildHelpers, OooDisplay, OooSchedule, OrgRenderer, OrgTreeWalker, RecordingOutputWriter, RecordingResolver, SegmentDownloader, StatusActions, StatusDisplay, SyncAuth, SyncChatHandler, SyncDisplay, WhoDisplay, WhoPresence, WhoSchedule Classes: Activity, Auth, Base, Cal, Channels, Chats, DashManifestParser, Help, Meeting, Messages, Ooo, OooScheduleEntry, Org, Status, Sync, TranscriptFormatter, Who

Constant Summary collapse

CAL_HELP =
<<~HELP
  teems cal - List calendar events and view details

  USAGE:
    teems cal [options]              List today's events (interactive when TTY)
    teems cal today                  List today's events (alias)
    teems cal tomorrow               List tomorrow's events
    teems cal show <N|hash>          Show details for event by # or hash
    teems cal accept <N|hash>        Accept event by # or hash
    teems cal decline <N|hash>       Decline event by # or hash
    teems cal tentative <N|hash>     Tentatively accept event by # or hash
    teems cal create "Title" [opts]  Create a new event
    teems cal delete <N|hash>        Delete event by # or hash

  OPTIONS:
    --days N             Show events for the next N days (default: 1)
    --week               Show events for the current week (Mon-Fri)
    --date YYYY-MM-DD    Show events for a specific date
    --no-interactive     Disable interactive mode (list and exit)
    --comment TEXT        Add a comment to RSVP response
    --no-send            Don't send response to organizer
    -n, --limit N        Maximum number of events to show
    -v, --verbose        Show attendee summaries
    -q, --quiet          Suppress output
    --json               Output as JSON
    -h, --help           Show this help

  CREATE OPTIONS:
    --start TIME         Start time: "YYYY-MM-DD HH:MM", "today HH:MM",
                         "tomorrow HH:MM", or "HH:MM" (assumes today)
    --end TIME           End time (default: start + 30 minutes)
    --duration MIN       Duration in minutes (alternative to --end)
    --all-day            Create an all-day event (use with --date)
    --location TEXT      Event location
    --body TEXT          Event description (plain text)
    --html TEXT          Event description (HTML)
    --attendees EMAILS   Comma-separated required attendee emails
    --optional EMAILS    Comma-separated optional attendee emails
    --room EMAILS        Comma-separated room/resource emails
    --teams              Add a Teams online meeting link
    --no-teams           Explicitly disable Teams meeting
    --show-as STATUS     free, tentative, busy, oof, workingElsewhere
    --importance LEVEL   low, normal, high
    --sensitivity LEVEL  normal, personal, private, confidential
    --reminder MIN       Reminder minutes before start
    --no-reminder        Disable reminder
    --no-rsvp            Don't request responses from attendees
    --no-time-proposals  Don't allow new time proposals
    --hide-attendees     Hide attendee list from other attendees

  EXAMPLES:
    teems cal                        # Interactive agenda (TTY)
    teems cal --no-interactive       # List and exit
    teems cal today                  # Same as above
    teems cal tomorrow               # Tomorrow's events
    teems cal --days 3               # Next 3 days
    teems cal --week                 # This work week
    teems cal --date 2026-01-20      # Specific date
    teems cal show 3                 # Details for event #3
    teems cal show a3f2b1            # Details by short hash
    teems cal accept 3               # Accept event #3
    teems cal accept a3f2            # Accept by hash prefix
    teems cal decline 3 --comment "Out of office"
    teems cal create "Standup" --start "tomorrow 09:00" --duration 15
    teems cal create "Review" --start "2026-03-20 14:00" --teams \
      --attendees alice@example.com,bob@example.com
    teems cal delete 3               # Delete event #3
    teems cal --json | jq ...        # JSON output, no prompt
HELP
OOO_HELP =
<<~HELP
  teems ooo - Manage out-of-office status

  USAGE:
    teems ooo                Show current OOO status
    teems ooo on [options]   Enable out-of-office
    teems ooo off            Disable out-of-office
    teems ooo config         Show OOO configuration

  ON OPTIONS:
    --message TEXT       Auto-reply and status message
    --start TIME         Schedule start; enables scheduled mode. Formats:
                           YYYY-MM-DD              (all-day)
                           YYYY-MM-DD HH:MM        (timed)
                           "today HH:MM", "tomorrow HH:MM", HH:MM
    --end TIME           Schedule end, required with --start.
                         Must match --start style (date or timed).
    --event              Create an OOO calendar event for notify list
    --invite EMAILS      Comma-separated invitees; overrides config notify list
    --no-status          Skip setting Teams status/presence

  CONFIGURATION:
    Edit ~/.config/teems/config.json to set defaults:

    {
      "ooo": {
        "internal_message": "I'm currently out of office.",
        "external_message": "Thank you for your message. I'm out of office.",
        "external_audience": "all",
        "status_message": "Out of Office",
        "notify": ["manager@example.com", "team@example.com"]
      }
    }

  EXAMPLES:
    teems ooo                          # Check OOO status
    teems ooo on                       # Enable OOO (always on)
    teems ooo on --message "Vacation"  # Custom message
    teems ooo on --start 2026-04-14 --end 2026-04-18
    teems ooo on --start "today 14:00" --end "today 17:00" \\
      --message "Dr appt"
    teems ooo off                      # Disable OOO
    teems ooo config                   # Show config
HELP
UNSCHEDULED_OOO_SCHEDULE =
OooScheduleEntry.new(kind: :unscheduled, value: nil)
AUTH_HELP =
<<~HELP
  teems auth - Manage Teams authentication

  USAGE:
    teems auth [action]

  ACTIONS:
    login       Authenticate via Safari (opens browser)
    logout      Remove stored tokens
    status      Show current authentication status
    manual      Show manual token extraction instructions
    set-tokens  Manually enter tokens from browser

  OPTIONS:
    --certauth  Use certificate authentication (requires VPN)

  EXAMPLES:
    teems auth login              # Authenticate (headless or Safari OAuth)
    teems auth login --certauth   # Use cert auth (on VPN)
    teems auth status             # Check if authenticated
    teems auth logout             # Clear stored tokens
HELP
AUTH_ACTIONS =
{
  'login' => :login, 'logout' => :logout, 'clear' => :logout,
  'status' => :status, 'manual' => :show_manual_instructions,
  'set-tokens' => :set_tokens, 'set' => :set_tokens
}.freeze
COMMAND_DESCRIPTIONS =
[
  ['activity', 'Show activity feed (mentions, reactions, calendar)'],
  ['auth', 'Authenticate with Teams'],
  ['cal', 'List calendar events and view details'],
  ['channels', 'List joined teams and channels'],
  ['chats', 'List recent chats'],
  ['meeting', 'View meeting details, chat, transcripts, and recordings'],
  ['messages', 'Read messages from a channel or chat'],
  ['sync', 'Sync chat history locally'],
  ['who', "Look up a user's profile"],
  ['org', 'Show org chart for a user'],
  ['ooo', 'Manage out-of-office status'],
  ['status', 'View and manage your presence status']
].freeze
SYNC_HELP =
<<~HELP
  teems sync - Sync chat history locally

  USAGE:
    teems sync [options]

  OPTIONS:
    --since DAYS     Number of days of history to sync (default: 180)
    --chat CHAT_ID   Sync only this chat
    --auth           Authenticate via Safari before syncing
    --dry-run        Show what would be synced without writing files
    -v, --verbose    Show debug output
    -q, --quiet      Suppress output

  EXAMPLES:
    teems sync                         # Sync 6 months of all chats
    teems sync --since 30              # Sync last 30 days
    teems sync --chat 19:abc@thread.v2 # Sync a single chat
    teems sync --dry-run               # Preview what would be synced

  OUTPUT:
    Files are stored in ~/.local/share/teems/sync/chats/
    Each chat gets: messages.md, messages.json, chat_metadata.json
HELP
MEETING_HELP =
<<~HELP
  teems meeting - View meeting details, chat, transcripts, and recordings

  USAGE:
    teems meeting <target> [options]

  ARGUMENTS:
    target           Thread ID (19:meeting_...@thread.v2), calendar event ID,
                     or Teams meeting URL

  OPTIONS:
    --transcript     Download meeting transcript (WebVTT)
    --recording      Download meeting recording (MP4, requires ffmpeg)
                     Combine with --transcript to embed subtitles
    --audio          Also save a separate audio file (M4A) — ideal for transcription
    --no-video       Skip the video file; with --audio produces audio-only output
    --chat           Show meeting chat messages
    -o, --output-dir Directory for downloads (default: current directory)
    -v, --verbose    Show debug output
    -q, --quiet      Suppress output
    --json           Output as JSON
    -h, --help       Show this help

  EXAMPLES:
    teems meeting 19:meeting_abc123@thread.v2
    teems meeting 19:meeting_abc123@thread.v2 --chat
    teems meeting 19:meeting_abc123@thread.v2 --transcript
    teems meeting 19:meeting_abc123@thread.v2 --audio -o ~/Downloads          # video + audio
    teems meeting 19:meeting_abc123@thread.v2 --audio --no-video -o ~/Downloads  # audio only
    teems meeting 19:meeting_abc123@thread.v2 --recording -o ~/Downloads
    teems meeting 19:meeting_abc123@thread.v2 --recording --transcript -o ~/Downloads
    teems meeting AAMkAGVmMDEz...        # By calendar event ID
HELP
MESSAGES_HELP =
<<~HELP
  teems messages - Read messages from a channel or chat

  USAGE:
    teems messages <target> [options]

  ARGUMENTS:
    target           Chat ID, channel ID, or Teams message URL

  OPTIONS:
    -t, --team ID    Team ID (required for channel messages)
    -n, --limit N    Number of messages (default: 20)
    --download       Download file attachments
    -o, --output-dir Directory for downloads (default: ~/.local/share/teems/downloads)
    -v, --verbose    Show debug output
    -q, --quiet      Suppress output
    --json           Output as JSON

  EXAMPLES:
    teems messages 19:abc123@thread.v2         # Read chat messages
    teems messages 19:abc123@thread.v2 -n 50   # Show 50 messages
    teems messages "https://teams.microsoft.com/l/message/19:abc@thread.v2/123?context=..."
HELP