burnwatch 0.8.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -10
- package/dist/cli.js +190 -15
- package/dist/cli.js.map +1 -1
- package/dist/hooks/on-prompt.js.map +1 -1
- package/dist/hooks/on-session-start.js +141 -5
- package/dist/hooks/on-session-start.js.map +1 -1
- package/dist/hooks/on-stop.js +139 -3
- package/dist/hooks/on-stop.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/mcp-server.js +141 -5
- package/dist/mcp-server.js.map +1 -1
- package/package.json +1 -1
- package/skills/burnwatch-interview/SKILL.md +76 -51
|
@@ -30,19 +30,33 @@ cd $PROJECT_ROOT && burnwatch interview --json
|
|
|
30
30
|
|
|
31
31
|
Parse the JSON output. Do NOT show the raw JSON to the user.
|
|
32
32
|
|
|
33
|
-
## Step 2:
|
|
33
|
+
## Step 2: BEFORE the interview — Auto-discover API keys
|
|
34
|
+
|
|
35
|
+
**This is the most important step.** Before asking the user anything, try to find API keys automatically:
|
|
36
|
+
|
|
37
|
+
1. **Check .env files** — Read `.env`, `.env.local`, `.env.development` for known key patterns
|
|
38
|
+
2. **Check the interview JSON** — the `keySource` field shows if a key was already found in env or global config
|
|
39
|
+
3. **Check probeResult** — if the JSON includes probe results, use them
|
|
40
|
+
|
|
41
|
+
For each service where you found a key or probe data:
|
|
42
|
+
- If `probeResult` has `confidence: "high"` — the plan is detected. Just confirm it.
|
|
43
|
+
- If `probeResult` exists — mention what was found.
|
|
44
|
+
- If a key exists but no probe — still good, tell the user you'll use it for live tracking.
|
|
45
|
+
|
|
46
|
+
**The utopia is: you found the service, you found the key, you probed the API, and you just confirm.** Only ask questions when you genuinely don't know.
|
|
47
|
+
|
|
48
|
+
## Step 3: Present a brief overview, then start the interview
|
|
34
49
|
|
|
35
50
|
Open with a short summary (2-3 lines max), then immediately start with the first service:
|
|
36
51
|
|
|
37
|
-
> I found **N services** in your project.
|
|
52
|
+
> I found **N services** in your project. I've already detected API keys for X of them and probed their billing APIs.
|
|
38
53
|
>
|
|
39
|
-
> First up — **Anthropic**.
|
|
40
|
-
>
|
|
41
|
-
> Does $100/mo feel right, or want to adjust?
|
|
54
|
+
> First up — **Anthropic**. I found your API key in `.env` and checked your billing — you've spent $47.23 this month.
|
|
55
|
+
> Want me to track your actual spend and alert you if it crosses a threshold? What monthly amount should trigger a warning?
|
|
42
56
|
|
|
43
57
|
Then STOP. Wait for the user.
|
|
44
58
|
|
|
45
|
-
## Step
|
|
59
|
+
## Step 4: Walk through services ONE AT A TIME
|
|
46
60
|
|
|
47
61
|
### Order: highest risk first
|
|
48
62
|
|
|
@@ -51,42 +65,39 @@ Then STOP. Wait for the user.
|
|
|
51
65
|
3. **Infrastructure** — one at a time (Vercel, Supabase, AWS)
|
|
52
66
|
4. **Free-tier / flat-rate** — batch these: "PostHog, Inngest, and Resend are all on free tiers at $0. Any of those need updating? If not, moving on."
|
|
53
67
|
|
|
54
|
-
### For each
|
|
68
|
+
### For each service, the approach depends on what you already know:
|
|
55
69
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
70
|
+
#### If you have a key AND probe data (best case):
|
|
71
|
+
> **Scrapfly** — I found your API key and probed the billing API.
|
|
72
|
+
> You're on the **Pro plan** ($100/mo, 1M credits). 250K credits used this month.
|
|
73
|
+
> Want me to track credit consumption and alert at a threshold? [default: alert at 80% of 1M]
|
|
59
74
|
|
|
60
|
-
|
|
75
|
+
#### If you have a key but NO probe data:
|
|
76
|
+
> **Vercel** — I found a token in your env. I'll use it for live billing tracking.
|
|
77
|
+
> What plan are you on? (Hobby is free, Pro is $20/mo)
|
|
61
78
|
|
|
62
|
-
|
|
63
|
-
>
|
|
64
|
-
>
|
|
79
|
+
#### If you have NO key but a billing API exists:
|
|
80
|
+
> **Anthropic** — this service has a billing API but I need an admin key to access it.
|
|
81
|
+
> You can create one at console.anthropic.com → Settings → Admin API Keys (sk-ant-admin-*).
|
|
82
|
+
> Want to provide one now, or should I just set a budget alert?
|
|
65
83
|
|
|
66
|
-
|
|
84
|
+
#### If there's NO billing API (Gemini, Inngest, etc.):
|
|
85
|
+
> **Gemini** — no billing API available for this service.
|
|
86
|
+
> What plan are you on? I'll track your fixed cost and flag any activity that might cause overages.
|
|
67
87
|
|
|
68
|
-
###
|
|
88
|
+
### Smart inference:
|
|
69
89
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
90
|
+
- If you see `gpt-4o-mini` or other lightweight models in the codebase, infer low/free tier usage — don't suggest $100 budgets
|
|
91
|
+
- If a service is on a paid plan (e.g., GPT Plus at $20/mo), ask if they want to track API overages beyond their subscription
|
|
92
|
+
- For flat-rate plans, the "budget" IS the plan cost — don't ask for a separate budget number
|
|
73
93
|
|
|
74
|
-
|
|
94
|
+
### Budget philosophy:
|
|
75
95
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
> I checked your balance: $1,247.83 available.
|
|
80
|
-
> $50/mo budget for Stripe's processing fees — sound right?
|
|
96
|
+
- **LIVE services with billing API access**: Default to "track actual spend, alert at threshold" — NOT an arbitrary budget. Ask: "At what spend level should I flag a warning?"
|
|
97
|
+
- **CALC services (flat-rate)**: Budget = plan cost. Only ask about overages if the service has overage pricing.
|
|
98
|
+
- **BLIND services**: Ask for a budget cap as a safety net since we can't see actual spend.
|
|
81
99
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
### For free-tier services, batch them:
|
|
85
|
-
|
|
86
|
-
> **PostHog**, **Inngest**, and **Resend** are all set to free tiers at $0/mo.
|
|
87
|
-
> Any of those need updating, or should I lock them in and move on?
|
|
88
|
-
|
|
89
|
-
## Step 4: Configure each service
|
|
100
|
+
## Step 5: Configure each service
|
|
90
101
|
|
|
91
102
|
After the user confirms or corrects, write it back immediately:
|
|
92
103
|
|
|
@@ -104,37 +115,51 @@ To exclude a service:
|
|
|
104
115
|
burnwatch configure --service <id> --exclude
|
|
105
116
|
```
|
|
106
117
|
|
|
118
|
+
**Check the JSON output for `tierNote`** — if the configure command returns a `tierNote`, relay it to the user. This happens when a key is saved but the service doesn't have a billing connector yet (key works for probes but not live polling).
|
|
119
|
+
|
|
107
120
|
Always check the JSON output for `"success": true`.
|
|
108
121
|
|
|
109
|
-
## Step
|
|
122
|
+
## Step 6: Wrap up
|
|
110
123
|
|
|
111
124
|
After all services are configured, run `burnwatch status` and present the brief:
|
|
112
125
|
|
|
113
126
|
> All done! Here's your updated spend brief:
|
|
114
127
|
> [burnwatch status output]
|
|
115
128
|
>
|
|
116
|
-
> N services
|
|
129
|
+
> N services with live billing, M estimated, K need API keys.
|
|
130
|
+
> The brief appears automatically at the start of every Claude Code session.
|
|
117
131
|
|
|
118
132
|
## Key Behaviors
|
|
119
133
|
|
|
120
134
|
- **Lead with what you know.** If the probe detected their plan, state it confidently and ask for confirmation — don't make them pick from a list.
|
|
135
|
+
- **Discovery first, questions second.** Search .env files, check for existing keys, try probes. Only ask the user when you genuinely can't figure it out.
|
|
121
136
|
- **One question at a time.** Never ask about budget AND plan AND API key in the same message. If the plan is confirmed, ask about budget. If budget is confirmed, offer the API key option.
|
|
122
137
|
- **Be brief.** Each message should be 2-4 lines, not paragraphs.
|
|
123
138
|
- **Respect shortcuts.** If the user says "defaults are fine for everything" — configure them all and show the summary. Don't force 14 rounds.
|
|
124
|
-
- **If they offer a key unprompted**, use it immediately and
|
|
139
|
+
- **If they offer a key unprompted**, use it immediately — run `burnwatch configure --service <id> --key <KEY>` and tell them what the probe found.
|
|
125
140
|
- **Surface concerns.** If Anthropic spend is $87 of $100 budget, say so. If Scrapfly credits are 85% consumed, flag it.
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
|
133
|
-
|
|
|
134
|
-
|
|
|
135
|
-
|
|
|
136
|
-
|
|
|
137
|
-
| Browserbase |
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
+
- **For services that offer to create a token** (Vercel, Supabase), give the user the direct URL to create one and offer to wait while they do it.
|
|
142
|
+
|
|
143
|
+
## Services with Billing Connectors (can do LIVE tracking)
|
|
144
|
+
|
|
145
|
+
| Service | Key Type | Where to Get It |
|
|
146
|
+
|---------|----------|-----------------|
|
|
147
|
+
| Anthropic | Admin key (sk-ant-admin-*) | console.anthropic.com → Settings → Admin API Keys |
|
|
148
|
+
| OpenAI | Admin key (sk-admin-*) | platform.openai.com → Settings → API Keys |
|
|
149
|
+
| Vercel | Personal access token | vercel.com/account/tokens |
|
|
150
|
+
| Scrapfly | API key | scrapfly.io/dashboard |
|
|
151
|
+
| Supabase | Personal access token (PAT) | supabase.com/dashboard → Account → Access Tokens |
|
|
152
|
+
| Browserbase | API key | browserbase.com → Settings → API Keys |
|
|
153
|
+
|
|
154
|
+
## Services WITHOUT Billing Connectors (CALC/BLIND only)
|
|
155
|
+
|
|
156
|
+
| Service | Why | Workaround |
|
|
157
|
+
|---------|-----|-----------|
|
|
158
|
+
| Stripe | Complex — tracks customer payments, not Stripe's fees to you | Set budget based on expected processing volume |
|
|
159
|
+
| Upstash | Stats API exists but no cost data | Set budget based on plan tier |
|
|
160
|
+
| PostHog | Free tier common, org API limited | Set plan cost, track overages manually |
|
|
161
|
+
| Gemini | No billing API | Set plan cost |
|
|
162
|
+
| Resend | No billing API | Set plan cost |
|
|
163
|
+
| Inngest | No billing API | Set plan cost (Free: $0, Pro: varies) |
|
|
164
|
+
| Voyage AI | No billing API | Set budget based on expected token usage |
|
|
165
|
+
| AWS | Complex IAM requirements | Set budget, recommend checking AWS console |
|