th-44fc11c7: th api crm pipeline/stages/tasks/conversations/forecast/timeline#165
Merged
Conversation
|
…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
bccf7d9 to
8d06176
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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,--jsonwhere a table is the default, id-or-name resolution reusingresolve_company_id/resolve_contact_id):pipeline— the money view: weighted forecast board fromGET /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.--jsondumps raw.stages—list/show/create/update/delete/reorder/initfor the pipeline stage catalog (/crm/stages,/crm/stages/reorder,/crm/stages/ensure-defaults).tasks—list(deal/contact/assignee/overdue/all filters)/show/add/update/done/rm, with a red OVERDUE marker.conversations—create/add-email/show/listemail threads;showrenders the thread as a readable in/out timeline.timeline <deal_id>— unified, date-sorted deal history (activities, notes, conversations, invoices). Also appended beneathdeals show.invoices— read-onlylist/showof 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 crm— 10 passed (4 new: cents rendering, timeline glyph mapping, overdue detection, body-preview trimming).--helpcorrectly.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
stagethen falls back tonamefor the label; forecast/stagesprobabilitytreated as 0–100.render_timeline/render_thread/render_invoicesaccept either a bare array or an{events|messages|invoices:[...]}envelope, so they survive minor response-shape choices.is_overdueparses RFC-3339 and compares to now; non-parseable/missing → not overdue.🤖 Generated with Claude Code
https://claude.ai/code/session_01UNMKCiHJc6PEfoE5WHCogs