Skip to content

th-44fc11c7: th api crm pipeline/stages/tasks/conversations/forecast/timeline#165

Merged
brentrager merged 1 commit into
mainfrom
crm-revenue-cli
Jul 4, 2026
Merged

th-44fc11c7: th api crm pipeline/stages/tasks/conversations/forecast/timeline#165
brentrager merged 1 commit into
mainfrom
crm-revenue-cli

Conversation

@brentrager

Copy link
Copy Markdown
Contributor

Problem

The CRM CLI (th api crm) covered contacts, companies, and deals but not the rest of the revenue engine — no forecast view, no stage catalog, no tasks, conversations, timeline, or invoices.

Solution

Stacked on crm-deals-companies (PR #148). Adds six new command groups, matching the existing Companies/Deals style exactly (per-command --org-id/--org, --json where a table is the default, id-or-name resolution reusing resolve_company_id/resolve_contact_id):

  • pipeline — the money view: weighted forecast board from GET /crm/deals/forecast. Per-stage open count / open value / weighted value / probability bar, a totals line (open · forecast · won), and a by-source mini-table. --json dumps raw.
  • stageslist/show/create/update/delete/reorder/init for the pipeline stage catalog (/crm/stages, /crm/stages/reorder, /crm/stages/ensure-defaults).
  • taskslist (deal/contact/assignee/overdue/all filters) /show/add/update/done/rm, with a red OVERDUE marker.
  • conversationscreate/add-email/show/list email threads; show renders the thread as a readable in/out timeline.
  • timeline <deal_id> — unified, date-sorted deal history (activities, notes, conversations, invoices). Also appended beneath deals show.
  • invoices — read-only list/show of revenue actuals (integer-cents amounts, colored status). No create (Stripe-backed).

New helpers: fmt_cents, prob_bar, yes_no, is_overdue, invoice_status_cell, timeline_glyph, preview_body, resolve_deal_id.

Verification

  • cargo build -p smooai-smooth-cli — clean.
  • cargo clippy -p smooai-smooth-cli --all-targets — clean (no crm.rs findings).
  • cargo fmt --check — clean.
  • cargo test -p smooai-smooth-cli crm10 passed (4 new: cents rendering, timeline glyph mapping, overdue detection, body-preview trimming).
  • All subcommands render --help correctly.

Backend for these endpoints is being built in parallel and is not deployed yet, so this is built to the agreed contract and not live-tested against api.smoo.ai.

Notes / interpretations where the contract was thin

  • Stage list reads stage then falls back to name for the label; forecast/stages probability treated as 0–100.
  • render_timeline/render_thread/render_invoices accept either a bare array or an {events|messages|invoices:[...]} envelope, so they survive minor response-shape choices.
  • is_overdue parses RFC-3339 and compares to now; non-parseable/missing → not overdue.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UNMKCiHJc6PEfoE5WHCogs

@changeset-bot

changeset-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 8d06176

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

…timeline/invoices

Extend the CRM CLI into a full revenue-engine surface on top of
contacts/companies/deals:

- pipeline: weighted forecast board (GET /crm/deals/forecast) with
  per-stage open/weighted values, a totals line, and a by-source table.
- stages: list/show/create/update/delete/reorder/init the pipeline
  stage catalog.
- tasks: list (deal/contact/assignee/overdue/all filters)/show/add/
  update/done/rm next-actions, with OVERDUE marker.
- conversations: create/add-email/show (thread timeline)/list email threads.
- timeline: unified date-sorted deal history (also appended to deals show).
- invoices: read-only revenue actuals (integer-cents amounts).

New helpers: fmt_cents, prob_bar, yes_no, is_overdue, invoice_status_cell,
timeline_glyph, preview_body, resolve_deal_id. Tests cover the pure ones.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UNMKCiHJc6PEfoE5WHCogs
@brentrager brentrager changed the base branch from crm-deals-companies to main July 4, 2026 03:30
@brentrager brentrager enabled auto-merge (squash) July 4, 2026 03:30
@brentrager brentrager merged commit fe853d8 into main Jul 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant