Skip to content

Add Telegram text/status CLI command #518

Closed

Description

@mblua

Summary

Add telegram-send-message --text <TEXT> so any room or coordination session can send a text-only Telegram message through a configured bot, without attaching a file or binding a bot to a room/session. The user authorized implementation on 2026-10-18 UTC after a completed investigation.

The existing telegram-send-image command requires a file. The internal telegram::api::send_message already sends plain text directly and does not require a bridge. Evidence base: 970c907972be62dd642c0d3d8219a70b206da4ff.

Specification

  • Add telegram-send-message --text <TEXT> [--bot-id <ID> | --bot-label <LABEL>].
  • Use the bots and stored chat destination from the executable's effective instance configuration. No room/session/bridge or running GUI is required. No arbitrary token/chat override.
  • Preserve the original text, spaces and line breaks. Reject empty/whitespace-only input and more than 4096 UTF-16 code units locally; this is an explicit conservative local bound, not a claim that Telegram documents that unit. Do not truncate or split.
  • Reuse the existing bot-selection rules, automatic only when one bot is configured; ambiguous/unknown/missing bots fail clearly. Selectors are mutually exclusive.
  • Reuse the existing text-send API. Print success only after API acceptance, returning 0; operational failures return 1. Do not expose the message or token through application logs/diagnostics; use controlled failure messages rather than interpolating a remote error body. Do not add retries or claim exactly-once delivery or recipient read confirmation.
  • Preserve the image/file command's existing path/caption behavior and configuration format.
  • Register root/subcommand help and document the new command in docs/reference/cli.md.
  • Verify parsing, selection, empty/length/Unicode boundaries, preservation of text, safe success/failure output and compatibility using synthetic/isolated inputs. Do not access real credentials or send live Telegram messages for tests.

Existing components and evidence

  • src-tauri/src/cli/telegram_send_image.rs:57-108: existing bot selector and diagnostics; currently private.
  • src-tauri/src/cli/telegram_send_image.rs:110-175: one-shot settings/runtime/network pattern.
  • src-tauri/src/telegram/api.rs:94-124: existing direct send; remote description is currently propagated and must not be formatted in this new CLI path.
  • src-tauri/src/cli/mod.rs:26,185,455: command registration/dispatch pattern.
  • src-tauri/tests/cli_behavior_contract.rs:226,357,844,873: existing help and image compatibility contracts.

Scope and acceptance

A text-only command is exposed and documented, respects the contract above, and required focused checks/review/CI pass. No frontend, dependencies, persistence, new bridge behavior or API-wide refactor. No file/stdin input, formatting mode, scheduling, history or context-template changes. No final packaged build, installation, release or version bump requested.

The original tentative --message spelling is refined to the reviewed --text contract. Optional file input remains deferred. Design investigation and exact review records are in project-shared/telegram-text-proposal, especially architect-proposal-v2.md; implementation will use the separately reviewed canonical plan.

Activity

  1. mblua commented on Oct 18, 2026

    @mblua
    OwnerAuthor

    Technical scoring and delivery path

    Scoring applies to the confirmed text-only CLI addition; existing design and source evidence are reused.

    Category Score /20 Evidence / anchor
    Scope footprint 5 A new CLI module plus registration, selector visibility, focused contract tests and reference text; below coherent-module anchor 10.
    Diagnosis difficulty 1 Mandatory file path and missing text command are already located; explicit-cause anchor 1.
    Domain knowledge required 5 Clap, Telegram text limits and Unicode require bounded subsystem knowledge; below protocol anchor 10.
    Solution-space ambiguity 2 Exact additive command and local diagnostics were selected and independently reviewed; near one-sensible-change anchor 1.
    Blast radius and reversibility 4 Additive CLI; shared selector behavior and existing image contract preserved, normal rollback; below shared-path anchor 10.
    Dependency and integration load 4 Existing Telegram transport and selection reused, no dependency changes; below external-service integration anchor 10.
    Verification difficulty 6 Parsing/selection/output/Unicode fixtures and CLI contract harness exist; new isolated tests needed, below harness-supported-new-test anchor 10.
    State, data and compatibility 2 Read-only existing settings, no schema/migration; additive compatibility near stateless anchor 1.
    Concurrency and timing 3 Existing one-shot async runtime; no new shared state or scheduling, below clear-owned-async anchor 10.
    Environment and tooling 3 Existing Windows Rust/CLI harness; no platform-specific product change, near ordinary-build anchor 1.

    Raw sum: 35. Final: round((35-10)/190*99)+1 = 14/100.

    Excluded ceremony: issue/branch/PR work, messages/delegation, plan/review rounds, CI waiting, merge and cleanup; no release/version work.

    Plan Contract: low band by score, but Full contract applies because this adds a public CLI command/API. Single localized CLI contract; architect decides partition rule against the evidence inventory. Author ac-architect-v5; required reviewers ac-dev-rust-v5, ac-dev-rust-grinch-v5 and ac-architect-grinch-v5; four matching Plan-SHA256 reports. No category veto applies. No final packaged build requested. Owning dev may dispute one category against evidence before implementation.

  2. added a commit that references this issue on Oct 18, 2026
  3. mblua commented on Oct 18, 2026

    @mblua
    OwnerAuthor

    Delivered in PR #3104: #3104

    telegram-send-message --text <TEXT> [--bot-id ID | --bot-label LABEL] sends text through a configured instance bot without an attachment, room assignment, active bridge, or GUI. The existing attachment command remains compatible. The original text is preserved, with empty/oversized input rejected and controlled diagnostics that do not print the message or bot credentials.

    Merged to main as ee7ff1706f941cf3a5c2041340ad5dae9ab00fbe; tested PR head 2168d1526d40491d137e429ac170f3f1b9fab748, integrated base 01456f151b3b61cfc55709b30c49984146966f0e.

    Validation: both independent reviews passed; module pairs and SCC memberships are unchanged. Locked Rust 1.98.1 compilation passed. All 30 focused Windows debug tests passed on the final verified application/harness identities, including the unchanged isolation source guard and Telegram text/image/help contracts. Configuration and temporary files were isolated; no live Telegram delivery was tested.

    Full CI run https://github.com/mblua/AgentsCommander/actions/runs/39098896226 completed successfully on the exact PR head, including Windows/Linux/macOS regression and all required checks. One frontend context-menu assertion failed on its first attempt and did not reproduce in the single unchanged-head rerun; no frontend fix or additional scope was added. The earlier CLI isolation failure was corrected by reusing the existing isolated test runner, preserving every test case and the guard.

    Issue acceptance is complete. No final distribution build or installation was requested or performed; the command will be available in builds that include the merged commit. Local checkout is clean on main, synchronized with origin/main; the feature branch and its remote reference are removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions