feat(cli): CLI-to-Web upgrade flow with entitlement storage (#405)#444
feat(cli): CLI-to-Web upgrade flow with entitlement storage (#405)#444Prateeks16 wants to merge 6 commits into
Conversation
…forcement (sreerevanth#406) Add the client-side verification primitive for premium entitlements: a JWT signed by the backend with an RS256 private key, verified by the CLI against the matching public key. Asymmetric signing means the client holds only the public key and cannot mint its own tokens, so premium gating becomes a signature check rather than a patchable boolean. - verify_entitlement(): RS256-only decode, required claims, expiry, and optional machine binding; fails closed if PyJWT is unavailable. - current_machine_id(): stable, hashed device fingerprint for binding. - require_feature(): entitlement-gated feature check (no bare boolean). - pyjwt added to the optional `crypto` extra. Scope: client verification + device binding only. Server-side enforcement and token issuance are tracked in sreerevanth#405. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 32 minutes and 6 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🧪 PR Test Results
Python 3.12 · commit 1721805 |
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
f411898 to
ccead56
Compare
…lement (sreerevanth#406) Guard the 'sub'/'tier'/'features' claims so a malformed token raises LicenseInvalidError at the boundary instead of an uncaught TypeError, preserving the typed error contract. (exp is already validated as numeric by PyJWT during decode.) Adds regression tests for non-numeric exp, non-string tier, and non-iterable features. Addresses CodeRabbit review feedback on sreerevanth#443. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…nth#405) Add the client side of the premium monetization flow, paired with the RS256 entitlement verification from sreerevanth#406. - agentwatch upgrade: generates a short-lived, single-use checkout session token, opens the browser to the hosted checkout, then stores the entitlement token returned via --activate (verified before save). --status shows the current tier; --no-browser/--dry-run for headless. - checkout.py: session-token handoff + checkout URL builder. - entitlement_store.py: persists/loads the entitlement in ~/.agentwatch/config.toml; every load is cryptographically verified, so a tampered store falls back to free tier. - _ensure_premium(): feature gate that prompts upgrade on free tier. Scope: CLI client only. Payment-gateway processing and webhook provisioning are backend concerns (out of scope here). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…erevanth#405) Pre-existing bug surfaced by CI: `agentwatch/cli/main.py` reassigned `session_app` to a fresh `typer.Typer(name="session")` near the rollback/ prune definitions and re-registered it, so the "session" group resolved to that partial group and `session export` / `session list` failed with "No such command 'export'" (10 failing tests). Remove the stray reassignment and an earlier empty duplicate so all session subcommands share one group. Also fix test_export_invalid_format, which read result.stderr (not separately captured by this Click version) — use result.output. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ccead56 to
1721805
Compare
Closes part of #405 (CLI client slice).
What
Adds the client side of the premium monetization flow: a CLI command that hands off to web checkout and stores the resulting entitlement.
Changes
agentwatch upgrade— generates a short-lived, single-use checkout session token and opens the browser to the hosted checkout portal, passing the token so the web flow can bind the entitlement back to this CLI run. After paying, the user runsagentwatch upgrade --activate <token>to verify (RS256) and store the entitlement.--statusshows the current tier;--no-browser/--dry-runfor headless use.checkout.py—new_session()(randomsecretstoken + 10-min expiry) andcheckout_url().entitlement_store.py— persists/loads the entitlement token in~/.agentwatch/config.toml. Every load re-verifies cryptographically, so a hand-edited or tampered store simply falls back to free tier — storage is not the security boundary._ensure_premium(feature)— feature gate that promptsagentwatch upgradeon free tier.Acceptance criteria mapping (#405)
_ensure_premium).agentwatch upgradeopens the browser to the payment portal.--activate→ verified →config.toml).Test
Note for maintainers (pre-existing, not introduced here)
Cold
import agentwatch.cli.mainfails with a circular import (governance↔tracing.collector), andagentwatch/cli/main.pyregisters two Typer groups namedsession. Both reproduce onmainindependent of this PR; flagging for a separate fix. Existingtest_cli_api_key/test_cli_exportfailures on Windows are also pre-existing.🤖 Generated with Claude Code