Skip to content

feat: add 'deals create' command - #11

Merged
jschfflr merged 2 commits into
mainfrom
feat/deals-create
Jul 9, 2026
Merged

feat: add 'deals create' command#11
jschfflr merged 2 commits into
mainfrom
feat/deals-create

Conversation

@jschfflr

@jschfflr jschfflr commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What

Adds the deals create CLI command:

qodev-apollo-cli deals create --name "Acme expansion" \
  [--owner-id …] [--account-id …] [--amount 5000] \
  [--stage-id … | --stage-name "Negotiation"] [--closed-date 2026-09-01]
  • --name is the only required field.
  • --stage-name resolves to an ID via list_all_stages (same helper as deals search).
  • Passing both --stage-id and --stage-name is a validation error (no API call made).

⚠️ Blocked on apollo-api#13 — kept as draft

This wraps ApolloClient.create_deal, added in apollo-api#13. CI runs with UV_NO_SOURCES=1 (pulls apollo-api from PyPI), so CI will fail (create_deal not found) until:

  1. apollo-api#13 is merged and released to PyPI, then
  2. this PR bumps the qodev-apollo-api>= floor to that release.

Local checks pass against the path-source api build.

Testing

  • +3 unit tests (forwards name + only-provided fields / resolves --stage-name / rejects both stage args).
  • Command itself live-verified end-to-end against the real API (created a throwaway deal).
  • ruff ✅ · mypy ✅ (local) · 81 tests ✅

🤖 Generated with Claude Code

jschfflr and others added 2 commits July 9, 2026 19:01
Adds 'deals create --name … [--owner-id] [--account-id] [--amount]
[--stage-id | --stage-name] [--closed-date]', wrapping the new
ApolloClient.create_deal. --name is the only required field; --stage-name
resolves to an ID via list_all_stages (same helper as 'deals search'),
and passing both --stage-id and --stage-name is a validation error.

Depends on qodev-apollo-api create_deal (apollo-api#13). CI stays red
until that is released to PyPI and the version floor is bumped here.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
create_deal landed in apollo-api 0.4.0 (now on PyPI). Bumping the floor
unblocks CI (UV_NO_SOURCES pulls from PyPI, which now has the method).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jschfflr
jschfflr marked this pull request as ready for review July 9, 2026 20:45

@peqy peqy Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Improvement] deals create: consider calling create_deal with name= keyword (and adjust the test) to be resilient if the API method uses a keyword-only signature.

[Question] Given CI runs with UV_NO_SOURCES=1, can you confirm uv sync will resolve qodev-apollo-api from PyPI (0.4.0) despite the repo using a path source override/lock entry locally? If not, CI may still be flaky until the lock/source setup is aligned.

stage_id = resolve_stage_id(stage_name, all_stages.items, kind="deal stage")
if stage_id:
fields["opportunity_stage_id"] = stage_id
deal = await client.create_deal(name, **fields)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Improvement] Call create_deal with name= keyword to be robust to a keyword-only signature in qodev-apollo-api (and to make the callsite self-documenting).

Fix: deal = await client.create_deal(name=name, **fields) (and adjust the test to assert call_args.kwargs["name"]).

@jschfflr
jschfflr merged commit 9f74990 into main Jul 9, 2026
4 checks passed
@jschfflr jschfflr mentioned this pull request Jul 9, 2026
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