@claude-flow/cli 3.29.0 → 3.30.1

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.
@@ -1 +1 @@
1
- 3.25.6
1
+ 3.30.0
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "manifest": {
3
- "version": "3.29.0",
3
+ "version": "3.30.1",
4
4
  "files": {
5
5
  "auto-memory-hook.mjs": "e3e1033b24704992ddef6b31c7fa9dd7fcd9e1af7935dd77ef73402b916b31e6",
6
- "hook-handler.cjs": "f51fb035d8a4110fdf763cee2913e285bcdbbaa618cbee980e032f89ffaf89d2",
6
+ "hook-handler.cjs": "dc926a1a585abac85941347894632a800a9c4394e99166726017643e5b3c5950",
7
7
  "intelligence.cjs": "5a55d979cb7ba5c8c4f27f3b2e6d686fbb1045d180023b803da672a37e05b915",
8
- "statusline.cjs": "8416172e504b03f9ec2266a47bba048578c3b1e30c5c7c97a0a8261460cd601d"
8
+ "statusline.cjs": "7d7bdee732e1c75b863e409afb86ce0d712f4919245e990d806da6752015bffa"
9
9
  }
10
10
  },
11
- "signature": "F0YZmNYCOnPOkf/kqbUoXtZ/jfYsX+Mn3QTGvtR6dafHx+oZ4uoobOKu/GYls+z+vHN2beL9c9GK53YKB1txBA==",
11
+ "signature": "6Dw13BYh3EAjBOefodVYha+5dpmcAxralqJIfT07xi9WUvhtDqwISpOVRWHMSdHM+XL1YGRh8I071X1XDB3zDw==",
12
12
  "algorithm": "ed25519"
13
13
  }
@@ -98,6 +98,105 @@ function spawnDetachedFunnelRefresh() {
98
98
  spawnDetachedHookRefresh('refresh-funnel');
99
99
  }
100
100
 
101
+ // ADR-318/319: first-run auto-enable of spinner verbs (default ON) +
102
+ // announcements (default OFF, explicit opt-in). Fires ONCE per install
103
+ // (marker at ~/.ruflo/first-run-enabled.json), then never again —
104
+ // subsequent sessions see the marker and skip.
105
+ //
106
+ // Split posture rationale:
107
+ // - Spinner verbs = low-intrusion (per-spin flash, append-mode mix
108
+ // with Claude Code defaults, moderate visibility over time). Default ON.
109
+ // Disclosure notification + one-command disable satisfies the ethical bar.
110
+ // - Announcements = higher-intrusion (prominent line at every Claude Code
111
+ // startup, more attention per view). Default OFF; opt-in via
112
+ // RUFLO_AUTO_ENABLE_ANNOUNCEMENTS=1 or explicit `ruflo announcements enable`.
113
+ //
114
+ // Gates (spinner is default-on unless any is TRUE):
115
+ // - RUFLO_NO_AUTO_ENABLE truthy (master opt-out — kills both)
116
+ // - RUFLO_NO_AUTO_ENABLE_SPINNER truthy (spinner-only opt-out)
117
+ // - CI / GITHUB_ACTIONS truthy
118
+ // - stdout is not a TTY (piped, non-interactive)
119
+ // - Marker file already exists
120
+ //
121
+ // Announcements needs the same gates PLUS RUFLO_AUTO_ENABLE_ANNOUNCEMENTS=1.
122
+ //
123
+ // Marker is written even if the spawns fail — auto-enable is a "we tried once"
124
+ // contract, not "keep trying until success." Users can run enable manually.
125
+ function firstRunAutoEnableIfEligible() {
126
+ try {
127
+ const path = require('path');
128
+ const fs = require('fs');
129
+ const os = require('os');
130
+ const truthy = (v) => v && !/^(0|false|off|no)$/i.test(String(v));
131
+ if (truthy(process.env.RUFLO_NO_AUTO_ENABLE)) return;
132
+ if (process.env.CI || process.env.GITHUB_ACTIONS) return;
133
+ if (process.stdout && process.stdout.isTTY === false) return;
134
+ const markerPath = path.join(os.homedir(), '.ruflo', 'first-run-enabled.json');
135
+ if (fs.existsSync(markerPath)) return;
136
+
137
+ const enableSpinner = !truthy(process.env.RUFLO_NO_AUTO_ENABLE_SPINNER);
138
+ const enableAnnouncements = truthy(process.env.RUFLO_AUTO_ENABLE_ANNOUNCEMENTS);
139
+
140
+ // Nothing to do — user opted out of both. Skip marker write so if they
141
+ // change their mind and re-enable env vars later, first-run still fires.
142
+ if (!enableSpinner && !enableAnnouncements) return;
143
+
144
+ // Spawn the enable commands detached + non-blocking. Any failure
145
+ // (missing CLI, refused state, etc.) is silent — auto-enable is
146
+ // best-effort and MUST NOT block session-restore. Uses execPath +
147
+ // resolved cli.js directly rather than spawnDetachedHookRefresh
148
+ // because that helper hardcodes 'hooks' as the top-level command.
149
+ const { spawn } = require('child_process');
150
+ const cliBin = resolveCliBinForHook();
151
+ const runDetached = (args) => {
152
+ try {
153
+ const spawnArgs = cliBin
154
+ ? [process.execPath, [cliBin, ...args]]
155
+ : [process.platform === 'win32' ? 'npx.cmd' : 'npx',
156
+ ['--prefer-offline', '@claude-flow/cli', ...args]];
157
+ const child = spawn(spawnArgs[0], spawnArgs[1], {
158
+ detached: true, stdio: 'ignore', env: process.env, windowsHide: true,
159
+ });
160
+ child.unref();
161
+ } catch { /* best-effort */ }
162
+ };
163
+ if (enableSpinner) runDetached(['spinner', 'enable', '--yes']);
164
+ if (enableAnnouncements) runDetached(['announcements', 'enable', '--yes']);
165
+
166
+ try {
167
+ fs.mkdirSync(path.dirname(markerPath), { recursive: true, mode: 0o700 });
168
+ fs.writeFileSync(
169
+ markerPath,
170
+ JSON.stringify({
171
+ _ts: Date.now(),
172
+ source: 'session-restore-hook',
173
+ enabled: { spinner: enableSpinner, announcements: enableAnnouncements },
174
+ }, null, 2),
175
+ { encoding: 'utf-8', mode: 0o600 }
176
+ );
177
+ } catch { /* ignore — best effort */ }
178
+
179
+ // Notification tells user exactly what happened. stderr so it doesn't
180
+ // corrupt any downstream JSON stdout consumer.
181
+ try {
182
+ const parts = [];
183
+ if (enableSpinner) parts.push('spinner verbs');
184
+ if (enableAnnouncements) parts.push('startup announcements');
185
+ const disableCmds = [];
186
+ if (enableSpinner) disableCmds.push('`ruflo spinner disable`');
187
+ if (enableAnnouncements) disableCmds.push('`ruflo announcements disable`');
188
+ process.stderr.write(
189
+ '[ruflo] First-run: enabled ' + parts.join(' + ') + '. ' +
190
+ 'Disable anytime with ' + disableCmds.join(' / ') + '. ' +
191
+ (enableSpinner && !enableAnnouncements
192
+ ? 'Announcements stay opt-in — set RUFLO_AUTO_ENABLE_ANNOUNCEMENTS=1 to enable those too. '
193
+ : '') +
194
+ 'Restart Claude Code once to see the changes take effect.\n'
195
+ );
196
+ } catch { /* ignore */ }
197
+ } catch { /* auto-enable must never break session-restore */ }
198
+ }
199
+
101
200
  // Same fallback-aware pattern as spawnDetachedFunnelRefresh() above, for
102
201
  // ADR-316's co-pilot advisor tip. Safe to call on EVERY session-restore:
103
202
  // refresh-advisor's own action checks consent + a 24h TTL BEFORE spending
@@ -345,6 +444,11 @@ const handlers = {
345
444
  },
346
445
 
347
446
  'session-restore': async () => {
447
+ // ADR-318/319 first-run auto-enable — fire once per install, never
448
+ // re-fires after user disables. Respects RUFLO_NO_AUTO_ENABLE + CI.
449
+ // Fully non-blocking (detached spawn) so session-restore latency
450
+ // is unchanged.
451
+ firstRunAutoEnableIfEligible();
348
452
  if (session) {
349
453
  // Try restore first, fall back to start
350
454
  const existing = session.restore && session.restore();
@@ -42,12 +42,18 @@ const CONFIG = {
42
42
  const CWD = process.cwd();
43
43
 
44
44
  // ─── Delegation cache ───────────────────────────────────────────
45
- // Cache the CLI JSON result for 60s so rapid prompt re-renders
46
- // (Claude Code refreshes the statusline several times a second while
47
- // streaming) don't re-invoke the CLI each time. #2337: bumped 10s→60s
48
- // because 10s was far too short for how often Claude Code re-renders.
45
+ // Cache the CLI JSON result so rapid prompt re-renders (Claude Code
46
+ // refreshes the statusline several times a second while streaming) don't
47
+ // re-invoke the CLI each time.
48
+ // #2337 bumped 10s 60s.
49
+ // Followup for anthropics/claude-code#70200 (Windows console-flash bug —
50
+ // claude.exe spawns hook/statusline subprocesses without CREATE_NO_WINDOW,
51
+ // producing a visible cmd flash on every render): bumped 60s → 300s to
52
+ // reduce the flash rate 5x on Windows until the upstream fix ships.
53
+ // Tradeoff: stat/git counters update every 5min instead of every 1min;
54
+ // promo/insight row still rotates on its own tighter 20s promoFresh clock.
49
55
  const CACHE_FILE = path.join(os.tmpdir(), 'ruflo-statusline-cache-' + require('crypto').createHash('md5').update(CWD).digest('hex').slice(0, 8) + '.json');
50
- const CACHE_TTL_MS = 60000;
56
+ const CACHE_TTL_MS = 300000;
51
57
 
52
58
  // The promo/insight row is designed to rotate on a 20s cadence (funnel/
53
59
  // rotation.ts's ROTATION_SLOT_MS / funnel/promo.ts's insight-slot check —
@@ -229,7 +235,7 @@ function getStatuslineData() {
229
235
  try {
230
236
  const raw = execSync(
231
237
  cmd,
232
- { encoding: 'utf-8', timeout: 8000, stdio: ['pipe', 'pipe', 'pipe'], cwd: CWD }
238
+ { encoding: 'utf-8', timeout: 8000, stdio: ['pipe', 'pipe', 'pipe'], cwd: CWD, windowsHide: true }
233
239
  ).trim();
234
240
  // The CLI may emit preamble lines before the JSON — find the first '{'.
235
241
  const jsonStart = raw.indexOf('{');
@@ -445,6 +451,11 @@ function safeExec(cmd, timeoutMs) {
445
451
  encoding: 'utf-8',
446
452
  timeout: timeoutMs || 2000,
447
453
  stdio: ['pipe', 'pipe', 'pipe'],
454
+ // Windows: without this, every execSync spawns cmd.exe /d /s /c which
455
+ // flashes a visible console window every render (~1/min via the 60s
456
+ // cache TTL). windowsHide runs the child in a hidden window instead.
457
+ // No-op on POSIX. Fix for #2XXX (user report: "cmd prompt keeps opening").
458
+ windowsHide: true,
448
459
  }).trim();
449
460
  } catch {
450
461
  return '';
@@ -868,12 +879,16 @@ function getPromoRow(d) {
868
879
  if (/^(0|false|off|no)$/i.test(String(process.env.RUFLO_FUNNEL || ''))) return null;
869
880
  const promo = d && d.promo;
870
881
  if (!promo || typeof promo.text !== 'string') return null;
871
- // Strip control chars / ANSI / bidi overrides and hard-cap length
872
- // promo copy is data and must never emit its own terminal sequences.
873
- const text = promo.text
882
+ // Strip control chars / ANSI / bidi overrides promo copy is data and
883
+ // must never emit its own terminal sequences. Hard-cap length AFTER the
884
+ // strip; append an ellipsis when the cap fires so the row visibly reads
885
+ // as truncated instead of chopping a word mid-character (was: silent
886
+ // slice(0,100) that could produce output that looked like corrupt data).
887
+ const MAX_LEN = 100;
888
+ const sanitized = promo.text
874
889
  .replace(/[\u0000-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/g, '')
875
- .slice(0, 100)
876
- .trim();
890
+ ;
891
+ const text = (sanitized.length > MAX_LEN ? sanitized.slice(0, MAX_LEN - 1).trimEnd() + '…' : sanitized).trim();
877
892
  if (text.length === 0) return null;
878
893
  // Split the label from the trailing "· manage: ruflo settings" instruction
879
894
  // so each part gets styling that matches what it actually IS:
@@ -896,9 +911,68 @@ function getPromoRow(d) {
896
911
  const DIM_OFF = '\u001b[22m';
897
912
  const BOLD_ON = '\u001b[1m';
898
913
  const BOLD_OFF = '\u001b[22m';
899
- const linked = promo.url ? UL_ON + safeTerminalLink(label, promo.url) + UL_OFF : label;
900
- if (!command) return linked;
901
- return linked + DIM_ON + manageWord + DIM_OFF + BOLD_ON + command + BOLD_OFF;
914
+ const FG_BRIGHT_WHITE = '';
915
+ // Reset FG to default so the caller's row-color code resumes coloring the
916
+ // rest of the row after the command portion. Without this the row-color
917
+ // escape wouldn't visibly re-apply because we already emitted an explicit FG.
918
+ const FG_DEFAULT = '';
919
+ // Some hosts (Claude Code's Windows UI, cmd.exe, older mintty) don't
920
+ // render OSC 8 hyperlinks as clickable — the label just underlines and
921
+ // clicks do nothing. Append a "(domain)" suffix so the destination is
922
+ // visible/copyable everywhere. Wrap the suffix in OSC 8 too so terminals
923
+ // that DO support hyperlinks give users TWO click targets (label AND
924
+ // domain hint) instead of one — some Windows hosts render one but not
925
+ // the other depending on how the statusline row is parsed.
926
+ // Only for URLs (not educational tips), and only when the label doesn't
927
+ // already end in the domain to avoid duplication.
928
+ let visibleUrlHint = '';
929
+ if (promo.url) {
930
+ try {
931
+ const host = new URL(promo.url).hostname.replace(/^www\./, '');
932
+ // Strip the click-redirect wrapper so users see the FINAL destination,
933
+ // not funnel.ruv.io. If the URL is /v1/click/<id>?to=<encoded>, pull the target.
934
+ let displayHost = host;
935
+ try {
936
+ const to = new URL(promo.url).searchParams.get('to');
937
+ if (to) displayHost = new URL(to).hostname.replace(/^www\./, '');
938
+ } catch { /* not a click-redirect, keep the raw host */ }
939
+ if (displayHost && !label.toLowerCase().endsWith(displayHost.toLowerCase())) {
940
+ // safeTerminalLink returns the plain string if URL isn't allowlisted
941
+ // or the terminal can't do OSC 8 — either way the domain stays visible.
942
+ const clickableDomain = safeTerminalLink(displayHost, promo.url);
943
+ visibleUrlHint = DIM_ON + ' (' + clickableDomain + ')' + DIM_OFF;
944
+ }
945
+ } catch { /* malformed URL — omit hint, never break the row */ }
946
+ }
947
+ // "Entire row clickable" (user request) — wrap the whole assembled
948
+ // string in ONE OSC 8 hyperlink instead of just the label. The command
949
+ // portion keeps its bold + bright-white treatment (no underline) so it
950
+ // still VISUALLY reads as a shell command the user should type, not a
951
+ // link — but if the user clicks anywhere on the row (label, domain
952
+ // hint, connector, even the command text), the terminal opens the URL.
953
+ // Clicking DOES NOT execute the command; it just opens the target URL,
954
+ // which is safe. Terminals that ignore OSC 8 render the whole row as
955
+ // styled text and no click behavior — the previous fallback (visible
956
+ // domain suffix) still keeps the destination readable.
957
+ const wrapWholeRowInHyperlink = (assembled) => {
958
+ if (!promo.url) return assembled;
959
+ if (!terminalSupportsHyperlinks()) return assembled;
960
+ let parsed;
961
+ try { parsed = new URL(promo.url); } catch { return assembled; }
962
+ if (parsed.protocol !== 'https:') return assembled;
963
+ if (!PROMO_LINK_HOSTS.has(parsed.hostname)) return assembled;
964
+ const ESC = '';
965
+ return ESC + ']8;;' + parsed.href + ESC + '\\' + assembled + ESC + ']8;;' + ESC + '\\';
966
+ };
967
+ // Visual styling stays per-part. We only add the OSC 8 wrap around the
968
+ // combined string, so the whole row is one click target.
969
+ const labelStyled = promo.url ? UL_ON + label + UL_OFF : label;
970
+ if (!command) return wrapWholeRowInHyperlink(labelStyled + visibleUrlHint);
971
+ return wrapWholeRowInHyperlink(
972
+ labelStyled + visibleUrlHint
973
+ + DIM_ON + manageWord + DIM_OFF
974
+ + BOLD_ON + FG_BRIGHT_WHITE + command + FG_DEFAULT + BOLD_OFF
975
+ );
902
976
  } catch (e) {
903
977
  return null; // the promo row must never break the statusline
904
978
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "generation": 1,
4
- "generatedAt": "2026-07-14T16:52:03.409Z",
5
- "gitSha": "0052b1b0",
4
+ "generatedAt": "2026-07-14T20:11:46.876Z",
5
+ "gitSha": "5fa2a3ce",
6
6
  "catalog": {
7
7
  "agents": 164,
8
8
  "tools": 387,
@@ -0,0 +1,17 @@
1
+ /**
2
+ * `ruflo announcements` — manage ruflo entries in Claude Code's
3
+ * companyAnnouncements settings (ADR-319).
4
+ *
5
+ * Claude Code exposes `companyAnnouncements: string[]` in
6
+ * ~/.claude/settings.json. The array is shown at Claude Code startup,
7
+ * cycled at random if multiple entries exist. Higher-attention than
8
+ * the spinner row (once per session, prominently rendered) and
9
+ * lower-frequency (once per Claude Code launch vs. every processing pause).
10
+ *
11
+ * Same architectural guarantees as ADR-318 (spinner): append-only,
12
+ * backup-first, ZWJ-marker-tagged for clean removal.
13
+ */
14
+ import type { Command } from '../types.js';
15
+ export declare const announcementsCommand: Command;
16
+ export default announcementsCommand;
17
+ //# sourceMappingURL=announcements.d.ts.map
@@ -1,13 +1,16 @@
1
1
  /**
2
2
  * `ruflo funnel` — user control surface for the Cognitum lifecycle funnel
3
- * (ADR-301/305/309).
3
+ * (ADR-301/305/309/317).
4
4
  *
5
- * funnel status effective state and which precedence source decided it
6
- * funnel disable user-level opt-out (all surfaces) + delete funnel data
7
- * funnel enable re-enable at the user tier (cannot override env/enterprise)
8
- * funnel accept acknowledge the disclosure so rotation starts immediately
9
- * funnel open open the currently-shown promo URL in the default browser
10
- * funnel id print the pseudonymous funnel ID, if one exists
5
+ * funnel status effective state and which precedence source decided it
6
+ * funnel disable user-level opt-out (all surfaces) + delete funnel data
7
+ * funnel enable re-enable at the user tier (cannot override env/enterprise)
8
+ * funnel accept acknowledge the disclosure so rotation starts immediately
9
+ * funnel open open the currently-shown promo URL in the default browser
10
+ * funnel enroll opt in to the 50/50 revenue share on Cognitum sponsor spend (ADR-317)
11
+ * funnel earnings show accrued and paid revenue-share balance
12
+ * funnel unenroll revoke local enrollment (funnel itself stays enabled)
13
+ * funnel id print the pseudonymous funnel ID, if one exists
11
14
  */
12
15
  import type { Command } from '../types.js';
13
16
  export declare const funnelCommand: Command;
@@ -1,20 +1,24 @@
1
1
  /**
2
2
  * `ruflo funnel` — user control surface for the Cognitum lifecycle funnel
3
- * (ADR-301/305/309).
3
+ * (ADR-301/305/309/317).
4
4
  *
5
- * funnel status effective state and which precedence source decided it
6
- * funnel disable user-level opt-out (all surfaces) + delete funnel data
7
- * funnel enable re-enable at the user tier (cannot override env/enterprise)
8
- * funnel accept acknowledge the disclosure so rotation starts immediately
9
- * funnel open open the currently-shown promo URL in the default browser
10
- * funnel id print the pseudonymous funnel ID, if one exists
5
+ * funnel status effective state and which precedence source decided it
6
+ * funnel disable user-level opt-out (all surfaces) + delete funnel data
7
+ * funnel enable re-enable at the user tier (cannot override env/enterprise)
8
+ * funnel accept acknowledge the disclosure so rotation starts immediately
9
+ * funnel open open the currently-shown promo URL in the default browser
10
+ * funnel enroll opt in to the 50/50 revenue share on Cognitum sponsor spend (ADR-317)
11
+ * funnel earnings show accrued and paid revenue-share balance
12
+ * funnel unenroll revoke local enrollment (funnel itself stays enabled)
13
+ * funnel id print the pseudonymous funnel ID, if one exists
11
14
  */
12
15
  import { execFile } from 'node:child_process';
13
16
  import * as fs from 'node:fs';
14
17
  import * as os from 'node:os';
15
18
  import * as path from 'node:path';
16
19
  import { output } from '../output.js';
17
- import { deleteFunnelData, funnelStateDir, getDisclosure, getFunnelId, promoEligible, readConsents, recordDisclosureAccepted, recordDisclosureDeclined, recordDisclosureReenabled, resolveFunnelEnabled, } from '../funnel/index.js';
20
+ import { deleteEnrollment, deleteFunnelData, funnelStateDir, getDisclosure, getEnrollment, getFunnelId, isEarningEligible, promoEligible, readConsents, recordDisclosureAccepted, recordDisclosureDeclined, recordDisclosureReenabled, resolveFunnelEnabled, } from '../funnel/index.js';
21
+ import { hasConsent, recordConsent } from '../funnel/consent.js';
18
22
  import { readStateJson, writeStateJson } from '../funnel/state.js';
19
23
  function setUserConfigEnabled(enabled) {
20
24
  const cfg = readStateJson('funnel.json') ?? {};
@@ -181,6 +185,91 @@ const openSub = {
181
185
  }
182
186
  },
183
187
  };
188
+ // ─── ADR-317: developer revenue-share subcommands ─────────────────────────
189
+ const ENROLL_URL = 'https://funnel.ruv.io/enroll';
190
+ const enrollSub = {
191
+ name: 'enroll',
192
+ description: 'Opt in to the 50/50 revenue share on Cognitum sponsor spend (ADR-317, Phase 0)',
193
+ action: async () => {
194
+ const decision = resolveFunnelEnabled();
195
+ if (!decision.enabled) {
196
+ output.printWarning(`Funnel is currently disabled by: ${decision.decidedBy}. Enable it (ruflo funnel enable) before enrolling — there's nothing to earn from until the funnel is on.`);
197
+ return { success: false, data: decision };
198
+ }
199
+ const disclosure = getDisclosure();
200
+ if (disclosure.state !== 'disclosed_enabled') {
201
+ output.printWarning("The Cognitum disclosure hasn't been shown/accepted yet. Run 'ruflo funnel accept' first, then re-run enroll.");
202
+ return { success: false, data: disclosure };
203
+ }
204
+ // Phase 0: record local consent so downstream attribution knows the user
205
+ // WANTS to enroll, but the backend endpoint that returns a real token is
206
+ // not live yet — this ADR ships in a version before the payout backend.
207
+ recordConsent('rev-share-payout', true, 'cli-funnel-enroll');
208
+ output.writeln('Consent recorded for rev-share-payout.');
209
+ output.writeln('');
210
+ output.writeln('The backend enrollment endpoint (Stripe Connect + KYC) is not yet live.');
211
+ output.writeln('When it ships, this command will open your browser to:');
212
+ output.writeln('');
213
+ output.writeln(` ${ENROLL_URL}`);
214
+ output.writeln('');
215
+ output.writeln("Meanwhile, your consent is on file. Track the rollout at ADR-317 (v3/docs/adr/).");
216
+ return { success: true, data: { consent: 'granted', enrollment: 'pending-backend' } };
217
+ },
218
+ };
219
+ const earningsSub = {
220
+ name: 'earnings',
221
+ description: 'Show accrued and paid revenue-share balance (ADR-317)',
222
+ options: [
223
+ { name: 'json', description: 'Output as JSON', type: 'boolean', default: false },
224
+ ],
225
+ action: async (ctx) => {
226
+ const consented = hasConsent('rev-share-payout');
227
+ const rec = getEnrollment();
228
+ const eligible = isEarningEligible();
229
+ const summary = {
230
+ consent: consented ? 'granted' : 'not-granted',
231
+ enrollment: rec ? { kyc_status: rec.kyc_status, enrolled_at: rec.enrolled_at, payout_account_last4: rec.payout_account_last4 } : null,
232
+ earning_eligible: eligible,
233
+ note: rec
234
+ ? 'Earnings endpoint (funnel.ruv.io/v1/earnings) is not yet live — see ADR-317 Phase 1.'
235
+ : 'Not enrolled. Run `ruflo funnel enroll` to opt in.',
236
+ };
237
+ if (ctx.flags.json) {
238
+ output.printJson(summary);
239
+ }
240
+ else {
241
+ output.writeln(`Consent: ${summary.consent}`);
242
+ output.writeln(`Enrolled: ${rec ? 'yes' : 'no'}`);
243
+ if (rec) {
244
+ output.writeln(` KYC: ${rec.kyc_status}`);
245
+ output.writeln(` Payout account: ****${rec.payout_account_last4}`);
246
+ output.writeln(` Since: ${rec.enrolled_at}`);
247
+ }
248
+ output.writeln(`Earning: ${eligible ? 'yes' : 'no'}`);
249
+ output.writeln('');
250
+ output.writeln(summary.note);
251
+ }
252
+ return { success: true, data: summary };
253
+ },
254
+ };
255
+ const unenrollSub = {
256
+ name: 'unenroll',
257
+ description: 'Revoke rev-share enrollment locally (funnel itself stays enabled)',
258
+ action: async () => {
259
+ const hadEnrollment = !!getEnrollment();
260
+ const hadConsent = hasConsent('rev-share-payout');
261
+ recordConsent('rev-share-payout', false, 'cli-funnel-unenroll');
262
+ deleteEnrollment();
263
+ if (hadEnrollment || hadConsent) {
264
+ output.printSuccess('Unenrolled locally. Funnel messages still render; your install just no longer earns.');
265
+ output.writeln('Note: server-side revocation happens on next contact with funnel.ruv.io — the backend endpoint is not yet live (ADR-317 Phase 1).');
266
+ }
267
+ else {
268
+ output.writeln('Nothing to unenroll — no local enrollment record and no rev-share consent was set.');
269
+ }
270
+ return { success: true, data: { previouslyEnrolled: hadEnrollment, previouslyConsented: hadConsent } };
271
+ },
272
+ };
184
273
  const idSub = {
185
274
  name: 'id',
186
275
  description: 'Print the pseudonymous funnel ID (exists only with telemetry consent)',
@@ -198,11 +287,13 @@ const idSub = {
198
287
  export const funnelCommand = {
199
288
  name: 'funnel',
200
289
  description: 'Control the Cognitum lifecycle funnel surfaces (tips, enrollment, notices)',
201
- subcommands: [statusSub, disableSub, enableSub, acceptSub, openSub, idSub],
290
+ subcommands: [statusSub, disableSub, enableSub, acceptSub, openSub, enrollSub, earningsSub, unenrollSub, idSub],
202
291
  examples: [
203
292
  { command: 'ruflo funnel status', description: 'Effective state + deciding source' },
204
293
  { command: 'ruflo funnel accept', description: 'Skip the 24h grace so rotation starts now' },
205
294
  { command: 'ruflo funnel open', description: 'Open the current promo URL in the browser' },
295
+ { command: 'ruflo funnel enroll', description: 'Opt in to 50/50 rev share (ADR-317)' },
296
+ { command: 'ruflo funnel earnings', description: 'Show accrued and paid balance' },
206
297
  { command: 'ruflo funnel disable', description: 'Turn off every funnel surface' },
207
298
  ],
208
299
  action: statusSub.action,
@@ -83,6 +83,10 @@ const commandLoaders = {
83
83
  proxy: () => import('./proxy.js'),
84
84
  // Fable co-pilot advisor tip in the statusline insight ticker (ADR-316)
85
85
  advisor: () => import('./advisor.js'),
86
+ // Ruflo verbs in Claude Code's spinnerVerbs rotation (ADR-318)
87
+ spinner: () => import('./spinner.js'),
88
+ // Ruflo entries in Claude Code's companyAnnouncements startup rotation (ADR-319)
89
+ announcements: () => import('./announcements.js'),
86
90
  };
87
91
  // Cache for loaded commands
88
92
  const loadedCommands = new Map();
@@ -0,0 +1,16 @@
1
+ /**
2
+ * `ruflo spinner` — manage ruflo verbs in Claude Code's spinnerVerbs
3
+ * settings (ADR-318).
4
+ *
5
+ * Claude Code exposes `spinnerVerbs.mode` + `spinnerVerbs.verbs[]` in
6
+ * ~/.claude/settings.json. This command appends a curated ruflo pool to
7
+ * that array, tagged with a zero-width joiner marker so `disable` can
8
+ * strip only ruflo verbs without touching user-authored ones.
9
+ *
10
+ * NEVER replaces — always appends (see ADR-318 §Guarantees). Always backs
11
+ * up ~/.claude/settings.json before write.
12
+ */
13
+ import type { Command } from '../types.js';
14
+ export declare const spinnerCommand: Command;
15
+ export default spinnerCommand;
16
+ //# sourceMappingURL=spinner.d.ts.map