@referalli/cli 0.4.9 → 0.4.11

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/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ All notable changes to `@referalli/cli` are recorded here. The format follows
5
5
  [Semantic Versioning](https://semver.org/spec/v2.0.0.html). Before 1.0, a minor
6
6
  bump may include breaking changes; they are called out under **Changed**.
7
7
 
8
+ ## 0.4.11 - 2026-11-11
9
+
10
+ ### Fixed
11
+ - `doctor --program`: integration-health findings about org-wide connections follow the billing section's scope, and go into the other-programs line once the program has a connection of its own. Findings with `severity: "info"` show as ℹ.
12
+
13
+ ## 0.4.10 - 2026-11-11
14
+
15
+ ### Fixed
16
+ - `doctor --program`: when several org-wide billing connections exist (one per product in a shared org), a broken one is ⚠ as long as another works, with the fix to limit it to its programs. It still fails when it's the only connection the program could use.
17
+
8
18
  ## 0.4.9 - 2026-11-11
9
19
 
10
20
  ### Changed
@@ -90,11 +90,16 @@ function billingChecks(scope, all, tally) {
90
90
  if (conns.length === 0) {
91
91
  return [{ id: 'billing', status: 'warn', message: "no billing connection: payments won't earn commission", fix: 'POST /v1/billing/connections' }];
92
92
  }
93
- // An org-wide connection matters to the scope only when one of its programs has no connection of its own.
94
- const usesOrgWide = !scope || scope.some((p) => !all.some((c) => c.programIds?.includes(p)));
93
+ // Scoped: a failing org-wide connection fails the run only when the program has nothing else that works
94
+ // (several products often share one org, each with its own org-wide connection).
95
+ const working = conns.filter((c) => billingCheck(c).status !== 'fail').length;
95
96
  return conns.map((c) => {
96
97
  const check = billingCheck(c);
97
- return usesOrgWide || c.programIds?.length ? check : unusedOrgWide(check, 'not used by this program: it has its own billing connection');
98
+ if (!scope || c.programIds?.length || working === 0 || check.status !== 'fail')
99
+ return check;
100
+ const own = all.some((o) => scope.some((p) => o.programIds?.includes(p)));
101
+ const why = own ? 'not used by this program: it has its own billing connection' : 'this program has another working connection';
102
+ return { ...unusedOrgWide(check, why), fix: `if it belongs to other programs, limit it: PATCH /v1/billing/connections/${c.id} {"programIds":["prg_…"]}` };
98
103
  });
99
104
  }
100
105
  function billingCheck(c) {
@@ -231,7 +236,9 @@ async function trackingCheck(client, env, programs, scope) {
231
236
  async function healthChecks(client, scope, billing, tally) {
232
237
  const res = await client.request('GET', '/v1/integration-health');
233
238
  // RF-1: a check about another program's billing connection (billing.<provider>.<id>) goes into the tally.
234
- const others = new Set(billing.filter((c) => outside(scope, c.programIds)).map((c) => c.id));
239
+ // Also org-wide connections, once the scoped programs have connections of their own (as in billingChecks).
240
+ const hasOwn = !!scope && billing.some((c) => scope.some((p) => c.programIds?.includes(p)));
241
+ const others = new Set(billing.filter((c) => outside(scope, c.programIds) || (hasOwn && !c.programIds?.length)).map((c) => c.id));
235
242
  const theirs = (h) => h.id.split('.').some((part) => others.has(part));
236
243
  tally.other += res.checks.filter((h) => !h.ok && theirs(h)).length;
237
244
  return res.checks.filter((h) => !theirs(h)).map((h) => {
@@ -240,7 +247,8 @@ async function healthChecks(client, scope, billing, tally) {
240
247
  return { id, status: 'ok', message: h.detail };
241
248
  const severe = !scope && (h.severity === 'error' || h.severity === 'critical');
242
249
  const fix = [h.fix, h.docs].filter(Boolean).join(' ');
243
- return { id, status: severe ? 'fail' : 'warn', message: h.detail, ...(fix ? { fix } : {}) };
250
+ const status = severe ? 'fail' : h.severity === 'info' ? 'info' : 'warn';
251
+ return { id, status, message: h.detail, ...(fix ? { fix } : {}) };
244
252
  });
245
253
  }
246
254
  /** A program settling by payout with no payout connection: partners can only be paid by hand. Test mode pays through the test rail. */
@@ -1,2 +1,2 @@
1
1
  /** Kept in step with package.json by test/version.test.ts. */
2
- export declare const VERSION = "0.4.9";
2
+ export declare const VERSION = "0.4.11";
@@ -1,2 +1,2 @@
1
1
  /** Kept in step with package.json by test/version.test.ts. */
2
- export const VERSION = '0.4.9';
2
+ export const VERSION = '0.4.11';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@referalli/cli",
3
- "version": "0.4.9",
3
+ "version": "0.4.11",
4
4
  "description": "The Referalli command line: sign in, forward webhooks to localhost, trigger test events, tail events and API logs.",
5
5
  "license": "MIT",
6
6
  "type": "module",