feat: add Stripe connector - #35
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR introduces a new Stripe connector that integrates with Cabinet's agent framework to fetch daily revenue, subscription, and payment operation metrics from Stripe and generate markdown reports. It includes the connector script, configuration variables, agent scheduling, persona definition, comprehensive documentation, and example output. ChangesStripe Connector Integration
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
server/connectors/stripe.ts (1)
477-494: Document the approximation constants.The weekly (4.33) and daily (30) multipliers are reasonable approximations but could benefit from a brief inline comment explaining the rationale for future maintainers.
📝 Suggested comment
function normalizeToMonthly( unitAmount: number, quantity: number, interval: "day" | "week" | "month" | "year", intervalCount: number ): number { const gross = unitAmount * quantity; switch (interval) { case "month": return gross / intervalCount; case "year": return gross / (12 * intervalCount); case "week": + // ~4.33 weeks per month (52 weeks / 12 months) return (gross * 4.33) / intervalCount; case "day": + // ~30 days per month (simplified) return (gross * 30) / intervalCount; } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@server/connectors/stripe.ts` around lines 477 - 494, Update the normalizeToMonthly function to document the approximation constants used for weekly and daily conversions: add concise inline comments by the cases for "week" and "day" explaining that 4.33 represents average weeks per month (52 weeks / 12 months) and 30 represents an average days-per-month approximation, so future maintainers understand the basis and limitations of these multipliers in normalizeToMonthly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@server/connectors/README.md`:
- Around line 99-101: The MD028 warning is caused by the blank line between the
two blockquote paragraphs; edit the README content where the blockquotes start
with "**Test mode is strongly recommended**" and "**Never commit
`.env.local`.**" and remove the empty line so they are merged into a single
continuous blockquote (or alternatively convert each to a regular paragraph) to
satisfy markdownlint.
In `@server/connectors/stripe.ts`:
- Around line 717-724: The current computation of needsResponse and
disputesNeedingAttention only filters openDisputes for status ===
"needs_response", but Stripe also uses "warning_needs_response"; update the
filter in the needsResponse variable to include both statuses (e.g., check
d.status === "needs_response" || d.status === "warning_needs_response") so
disputesNeedingAttention correctly counts and sums amounts for both cases; refer
to openDisputes, needsResponse, and disputesNeedingAttention when making this
change (fetchAllOpenDisputes already returns both statuses).
---
Nitpick comments:
In `@server/connectors/stripe.ts`:
- Around line 477-494: Update the normalizeToMonthly function to document the
approximation constants used for weekly and daily conversions: add concise
inline comments by the cases for "week" and "day" explaining that 4.33
represents average weeks per month (52 weeks / 12 months) and 30 represents an
average days-per-month approximation, so future maintainers understand the basis
and limitations of these multipliers in normalizeToMonthly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 264e9f1f-acea-433b-8e24-968542c3d29e
📒 Files selected for processing (8)
.env.example.gitignorePROGRESS.mddata/.agents/stripe/jobs/daily-report.yamldata/.agents/stripe/persona.mdserver/connectors/README.mdserver/connectors/stripe-sample-output.mdserver/connectors/stripe.ts
| > **Test mode is strongly recommended** for development. Stripe's test mode is a parallel-universe view of your account with fake money and test customers — completely isolated from live data. You can build and validate the connector without risk, then swap to a `rk_live_` key once ready for production. | ||
|
|
||
| > **Never commit `.env.local`.** It's gitignored by default, but always double-check before pushing — `git status` should never show it. |
There was a problem hiding this comment.
Minor: Remove blank line inside blockquote to fix markdownlint warning.
The blank line between blockquotes (lines 99-101) triggers MD028. Merge them into a single blockquote or use regular paragraphs.
📝 Proposed fix
-> **Test mode is strongly recommended** for development. Stripe's test mode is a parallel-universe view of your account with fake money and test customers — completely isolated from live data. You can build and validate the connector without risk, then swap to a `rk_live_` key once ready for production.
-
-> **Never commit `.env.local`.** It's gitignored by default, but always double-check before pushing — `git status` should never show it.
+> **Test mode is strongly recommended** for development. Stripe's test mode is a parallel-universe view of your account with fake money and test customers — completely isolated from live data. You can build and validate the connector without risk, then swap to a `rk_live_` key once ready for production.
+>
+> **Never commit `.env.local`.** It's gitignored by default, but always double-check before pushing — `git status` should never show it.🧰 Tools
🪛 markdownlint-cli2 (0.22.0)
[warning] 100-100: Blank line inside blockquote
(MD028, no-blanks-blockquote)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@server/connectors/README.md` around lines 99 - 101, The MD028 warning is
caused by the blank line between the two blockquote paragraphs; edit the README
content where the blockquotes start with "**Test mode is strongly recommended**"
and "**Never commit `.env.local`.**" and remove the empty line so they are
merged into a single continuous blockquote (or alternatively convert each to a
regular paragraph) to satisfy markdownlint.
Adds a Stripe connector that pulls revenue, subscription health, and payment operations metrics from the Stripe REST API and writes a daily markdown report to data/reports/. - server/connectors/stripe.ts — fetches charges, refunds, balance transactions, subscriptions, products, disputes, and payouts across a rolling 14-day window; renders a three-section report (Revenue Snapshot, Subscription Health, Payment Operations) with auto-generated insights including failure-spike detection - server/connectors/README.md — adds the general connector pattern documentation and full Stripe setup, env vars, and troubleshooting reference - server/connectors/stripe-sample-output.md — example output with sanitized data - data/.agents/stripe/ — Stripe Reporter agent with a daily 07:00 cron job - .env.example — STRIPE_SECRET_KEY and optional window override vars - .gitignore — whitelist data/.agents/stripe/ for tracking Tested end-to-end with a synthetic data fixture covering revenue aggregation, MRR normalization, operations rollups, and insights generation. All edge case validation paths exercised locally (missing creds, invalid date format, mismatched date range, lookback out of range).
531fbb7 to
59f68bb
Compare
|
Thanks for the review @coderabbitai! Pushed
Not addressing the docstring coverage warning (32.26% vs 80% threshold): the existing connector pattern in this repo (see |
|
Tip For best results, initiate chat on the files or code changes.
On docstring coverage: your rationale is sound. If ✏️ Learnings added
|
There was a problem hiding this comment.
♻️ Duplicate comments (1)
server/connectors/README.md (1)
99-101:⚠️ Potential issue | 🟡 MinorDuplicate: MD028 markdownlint warning still present.
The blank line inside the blockquote (line 100) triggers the MD028 warning. This was previously flagged but not yet fixed.
📝 Proposed fix (same as previous review)
-> **Test mode is strongly recommended** for development. Stripe's test mode is a parallel-universe view of your account with fake money and test customers — completely isolated from live data. You can build and validate the connector without risk, then swap to a `rk_live_` key once ready for production. - -> **Never commit `.env.local`.** It's gitignored by default, but always double-check before pushing — `git status` should never show it. +> **Test mode is strongly recommended** for development. Stripe's test mode is a parallel-universe view of your account with fake money and test customers — completely isolated from live data. You can build and validate the connector without risk, then swap to a `rk_live_` key once ready for production. +> +> **Never commit `.env.local`.** It's gitignored by default, but always double-check before pushing — `git status` should never show it.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@server/connectors/README.md` around lines 99 - 101, Remove the stray blank line inside the blockquote in server/connectors/README.md that causes the MD028 warning by merging the two paragraph lines into a single continuous blockquote; specifically, edit the blockquote containing "Test mode is strongly recommended" and "Never commit `.env.local`." so there is no empty line between them (preserve wording and Markdown blockquote characters).
🧹 Nitpick comments (1)
server/connectors/README.md (1)
126-126: Consider clarifying the timezone for the scheduled report."07:00 server time" is ambiguous for distributed teams. Consider specifying the timezone (e.g., UTC, local system time) or referencing the system's default timezone behavior.
🕐 Suggested clarification
-The `data/.agents/stripe/jobs/daily-report.yaml` job runs the connector every day at **07:00 server time** via the Cabinet job scheduler. The schedule lands the report in your knowledge base before the start of the workday. +The `data/.agents/stripe/jobs/daily-report.yaml` job runs the connector every day at **07:00** (in the server's local timezone) via the Cabinet job scheduler. The schedule lands the report in your knowledge base before the start of the workday.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@server/connectors/README.md` at line 126, Update the README sentence about the scheduled job to remove ambiguity by explicitly stating the timezone used for "07:00 server time" (for example: "07:00 UTC" or "07:00 system local time (see system timezone)"). Reference the specific job file name data/.agents/stripe/jobs/daily-report.yaml and either state that the schedule uses the system's default timezone or show how to override it (e.g., mention changing the server timezone or the job scheduler configuration). Ensure the sentence now clearly tells readers which timezone is intended and where to change it if they need a different one.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@server/connectors/README.md`:
- Around line 99-101: Remove the stray blank line inside the blockquote in
server/connectors/README.md that causes the MD028 warning by merging the two
paragraph lines into a single continuous blockquote; specifically, edit the
blockquote containing "Test mode is strongly recommended" and "Never commit
`.env.local`." so there is no empty line between them (preserve wording and
Markdown blockquote characters).
---
Nitpick comments:
In `@server/connectors/README.md`:
- Line 126: Update the README sentence about the scheduled job to remove
ambiguity by explicitly stating the timezone used for "07:00 server time" (for
example: "07:00 UTC" or "07:00 system local time (see system timezone)").
Reference the specific job file name data/.agents/stripe/jobs/daily-report.yaml
and either state that the schedule uses the system's default timezone or show
how to override it (e.g., mention changing the server timezone or the job
scheduler configuration). Ensure the sentence now clearly tells readers which
timezone is intended and where to change it if they need a different one.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 147de362-9733-4c42-acb2-1cca672ca7c7
📒 Files selected for processing (8)
.env.example.gitignorePROGRESS.mddata/.agents/stripe/jobs/daily-report.yamldata/.agents/stripe/persona.mdserver/connectors/README.mdserver/connectors/stripe-sample-output.mdserver/connectors/stripe.ts
✅ Files skipped from review due to trivial changes (4)
- .gitignore
- data/.agents/stripe/persona.md
- server/connectors/stripe-sample-output.md
- .env.example
🚧 Files skipped from review as they are similar to previous changes (3)
- data/.agents/stripe/jobs/daily-report.yaml
- PROGRESS.md
- server/connectors/stripe.ts
cabinetai#35 — archive lane was collapsed by default, hiding overnight runs behind a vertical rail. Defaulted the persisted collapsed-lanes set to empty so archive expands on first load. Lane caps to ARCHIVE_PEEK (8) items with a "Show N more →" affordance — header still shows the full count. cabinetai#36 — agent filter row sat below the header as a 12-pill scroller, adding a second filter row before the kanban. Replaced with an AgentFilterDropdown that lives inline in the header beside the trigger chips. Single-select preserved; FilterBar kept as a deprecated alias for the rename.
# Conflicts: # .env.example # .gitignore # PROGRESS.md
|
Thanks for this, @sdhilip200 — and sorry it sat unreviewed for so long. I'm going to close it, but the reason is on us, not on the code: Cabinet already ships a Stripe integration, and it's wired to Stripe's official MCP server. It's just invisible, so there was no way for you to know. The entry has been in the MCP catalog the whole time: cabinet/src/lib/agents/mcp-catalog.ts Lines 509 to 536 in 15b4213 That points at The reason you couldn't see it in the UI is a hand-maintained launch gate: cabinet/src/lib/integrations/preview-catalog.ts Lines 713 to 731 in 15b4213
There's a deeper architectural mismatch worth naming, because it explains why this wasn't a near-miss. Cabinet has no in-process tool loop. Agents are spawned as external CLIs (Claude Code, Codex, Gemini, Cursor), and the CLI is the MCP client — so an integration isn't a module we call, it's a server entry we write into the CLI's own config. This PR introduces a Genuinely sorry for the wasted effort. If you're still up for contributing, two things here are real and unclaimed:
|
|
Thanks for the guidance. I opened #230 for the issue #198 path instead of continuing the Stripe-specific approach. This PR keeps unwired integrations in the request-only flow, but shows MCP catalog-wired integrations as connectable beta entries and adds a basic connection status signal in the hub. Validation:
|
Adds a Stripe connector that pulls revenue, subscription health, and payment operations metrics from the Stripe REST API and writes a daily markdown report to data/reports/.
Tested end-to-end with a synthetic data fixture covering revenue aggregation, MRR normalization, operations rollups, and insights generation. All edge case validation paths exercised locally (missing creds, invalid date format, mismatched date range, lookback out of range).
Summary by CodeRabbit
New Features
Documentation