Skip to content

Mobayilo CLI - Implementation Plan

Last Updated: 2026-02-19
Program Status: Phase 5A complete, Phase 5B next

Deliver a production-grade Mobayilo CLI (moby) with:

  • secure persistent authentication
  • caller-ID-gated outbound calling
  • balance/rates visibility
  • Stripe top-up flow
  • support-ready documentation and predictable UX
  • Production-first defaults for end users.
  • Backward-compatible command evolution where possible.
  • JSON output for scripting, human output for interactive use.
  • Strong auth and rate-limiting on all CLI backend endpoints.
  • Small coherent commits and test-backed phase exits.
PhaseStatusFocus
Phase 0✅ CompleteDiscovery, PRD, architecture, phased plan
Phase 1✅ CompleteRails auth/token foundation + CLI API base
Phase 2✅ CompleteGo CLI scaffold and shared packages
Phase 3✅ CompleteCore commands (login/status/balance/rates/call)
Phase 4✅ CompleteBilling (topup, --open)
Phase 5A✅ CompleteAuth UX simplification + support docs + top-up min UX guard
Phase 5B⏳ Planned (next)Browser/device login + web token management
Phase 5C⏳ PlannedFriendly number input and confirm-by-code flow

4.1 Phase 1: Backend Auth Foundation (Rails First)

Section titled “4.1 Phase 1: Backend Auth Foundation (Rails First)”

Delivered:

  • PersonalAccessToken model and secure token format.
  • token issuer/verifier services.
  • Api::Cli::BaseController (Bearer auth + CLI error contract).
  • Rack::Attack throttles for CLI endpoints.

Validated by:

  • model + service tests.
  • request tests for missing/invalid/revoked/expired tokens.

Delivered:

  • Go module in cli/.
  • package structure:
    • internal/cmd
    • internal/api
    • internal/auth
    • internal/secrets
    • internal/outfmt
  • global flags: --json, --host, --token, --verbose.

Validated by:

  • go test ./... with parser/output/storage coverage.

Delivered:

  • moby login
  • moby status
  • moby balance
  • moby rates <iso>
  • moby call <destination>
  • backend call endpoint and auth integration.

Validated by:

  • command unit tests (mock API).
  • backend request tests.
  • local smoke pass.

Delivered:

  • moby topup <amount>
  • --open browser behavior with print fallback.

Validated by:

  • amount and response handling tests.
  • local smoke pass.

4.5 Phase 5A: UX Simplification and Support Readiness

Section titled “4.5 Phase 5A: UX Simplification and Support Readiness”

Delivered:

  • moby auth command group:
    • moby auth login
    • moby auth status
    • moby auth logout
  • backward compatibility for legacy moby login and moby status.
  • production docs simplified to omit mandatory --host usage.
  • support runbook added for helpdesk workflows.
  • CLI top-up guard: minimum amount enforced at $5.00 in command validation.

Validated by:

  • go test ./...
  • moby auth --help manual check.
  • moby topup 4 minimum validation manual check.
  • docs build (pnpm --dir docs build).
  • moby auth login --api-token <TOKEN>
  • moby auth status
  • moby auth logout
  • moby balance
  • moby rates <ISO>
  • moby caller-id request <NATIONAL_NUMBER> --country <ISO>
  • moby caller-id confirm <NATIONAL_NUMBER> <SMS_CODE> --country <ISO>
  • moby call <E164_DESTINATION>
  • moby topup <AMOUNT> [--open] with minimum $5.00 at CLI layer

6.1 Phase 5B (Next): Frictionless Login + Token Management

Section titled “6.1 Phase 5B (Next): Frictionless Login + Token Management”

Objective:

  • remove raw token copy/paste for most users.

Planned deliverables:

  • browser/device login flow for moby auth login.
  • web settings page for CLI token lifecycle (create/revoke/list).
  • token expiry options (default 30d, configurable policy).

Planned backend:

  • device auth start/poll/approve endpoints.
  • short-lived device auth record and state machine.
  • throttling and expiry windows.

Planned CLI:

  • browser-open login flow.
  • polling and secure token persistence.

Exit criteria:

  • new user can authenticate without manually pasting token.
  • support can revoke/manage tokens in UI.

Objective:

  • reduce number-format friction for caller ID and calling.

Planned deliverables:

  • moby caller-id request accepts flexible number input and guides user.
  • moby call accepts flexible number input with normalization help.
  • confirm flow target: moby caller-id confirm <code> backed by stored verification reference.

Exit criteria:

  • common national-format inputs succeed without user knowing E.164 rules.
  • confirm step can run with code-only UX.
  • Risk: long-lived token abuse.
    • Mitigation: configurable TTL, revoke support, last-used tracking, scopes.
  • Risk: support confusion during command migration.
    • Mitigation: keep aliases, update helpdesk templates, clear docs first.
  • Risk: verification UX breaks by Twilio config variance.
    • Mitigation: explicit env checks + actionable CLI error messages.
  • Rails: targeted request/model/service tests for backend changes.
  • CLI: go test ./... plus manual smoke for changed command paths.
  • Docs: pnpm --dir docs build.
  • Delivery: coherent commits, status doc updates after each phase.
  1. Phase 5B backend device auth foundations.
  2. Phase 5B web CLI token management page.
  3. Phase 5B CLI browser-login implementation.
  4. Phase 5C caller-id request/confirm UX simplification.
  5. Phase 5C call input normalization UX.