@analyticscli/growth-engineer 0.1.0-preview.9 → 0.1.1-preview.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.
Files changed (40) hide show
  1. package/dist/config.d.ts +925 -45
  2. package/dist/config.js +58 -6
  3. package/dist/config.js.map +1 -1
  4. package/dist/index.js +134 -21
  5. package/dist/index.js.map +1 -1
  6. package/dist/runtime/export-asc-summary.mjs +295 -4
  7. package/dist/runtime/export-asc-summary.mjs.map +1 -1
  8. package/dist/runtime/export-coolify-summary.d.mts +2 -0
  9. package/dist/runtime/export-coolify-summary.mjs +230 -0
  10. package/dist/runtime/export-coolify-summary.mjs.map +1 -0
  11. package/dist/runtime/export-paddle-summary.d.mts +2 -0
  12. package/dist/runtime/export-paddle-summary.mjs +170 -0
  13. package/dist/runtime/export-paddle-summary.mjs.map +1 -0
  14. package/dist/runtime/export-sentry-summary.mjs +265 -38
  15. package/dist/runtime/export-sentry-summary.mjs.map +1 -1
  16. package/dist/runtime/export-seo-summary.d.mts +2 -0
  17. package/dist/runtime/export-seo-summary.mjs +503 -0
  18. package/dist/runtime/export-seo-summary.mjs.map +1 -0
  19. package/dist/runtime/openclaw-exporters-lib.d.mts +51 -0
  20. package/dist/runtime/openclaw-exporters-lib.mjs +769 -63
  21. package/dist/runtime/openclaw-exporters-lib.mjs.map +1 -1
  22. package/dist/runtime/openclaw-growth-engineer.mjs +163 -4
  23. package/dist/runtime/openclaw-growth-engineer.mjs.map +1 -1
  24. package/dist/runtime/openclaw-growth-env.mjs +5 -0
  25. package/dist/runtime/openclaw-growth-env.mjs.map +1 -1
  26. package/dist/runtime/openclaw-growth-preflight.mjs +446 -30
  27. package/dist/runtime/openclaw-growth-preflight.mjs.map +1 -1
  28. package/dist/runtime/openclaw-growth-runner.mjs +831 -146
  29. package/dist/runtime/openclaw-growth-runner.mjs.map +1 -1
  30. package/dist/runtime/openclaw-growth-shared.d.mts +158 -3
  31. package/dist/runtime/openclaw-growth-shared.mjs +574 -8
  32. package/dist/runtime/openclaw-growth-shared.mjs.map +1 -1
  33. package/dist/runtime/openclaw-growth-start.mjs +802 -39
  34. package/dist/runtime/openclaw-growth-start.mjs.map +1 -1
  35. package/dist/runtime/openclaw-growth-status.mjs +85 -31
  36. package/dist/runtime/openclaw-growth-status.mjs.map +1 -1
  37. package/dist/runtime/openclaw-growth-wizard.mjs +1952 -217
  38. package/dist/runtime/openclaw-growth-wizard.mjs.map +1 -1
  39. package/package.json +3 -1
  40. package/templates/config.example.json +128 -65
@@ -7,16 +7,51 @@ import { createInterface } from 'node:readline/promises';
7
7
  import { emitKeypressEvents } from 'node:readline';
8
8
  import { createPrivateKey } from 'node:crypto';
9
9
  import { fileURLToPath } from 'node:url';
10
- import { buildExtraSourceConfig, getDefaultSourceCommand, } from './openclaw-growth-shared.mjs';
10
+ import { buildOpenClawCronAddCommand, buildHermesCronCreateCommand, buildGrowthRunnerCommand, deriveSchedulerProofPathFromStatePath, deriveStatePathFromConfigPath, buildExtraSourceConfig, getAutomationConfig, getDefaultSourceCommand, getDefaultSourcePath, inspectHermesCronInstall, inspectOpenClawCronInstall, } from './openclaw-growth-shared.mjs';
11
11
  import { loadOpenClawGrowthSecrets } from './openclaw-growth-env.mjs';
12
12
  const DEFAULT_CONFIG_PATH = 'data/openclaw-growth-engineer/config.json';
13
13
  const SELF_UPDATE_INTERVAL_MS = 24 * 60 * 60 * 1000;
14
14
  const ENABLE_ISOLATED_SECRET_RUNNER_WIZARD = false;
15
- const DEFAULT_GROWTH_INTERVAL_MINUTES = 1440;
15
+ const DEFAULT_GROWTH_INTERVAL_MINUTES = 90;
16
16
  const DEFAULT_CONNECTOR_HEALTH_INTERVAL_MINUTES = 360;
17
+ const DEFAULT_SCHEDULER_PROOF_PATH = 'data/openclaw-growth-engineer/runtime/scheduler-proof.jsonl';
17
18
  const GROWTH_ENGINEER_PACKAGE_SPEC = process.env.OPENCLAW_GROWTH_ENGINEER_PACKAGE || '@analyticscli/growth-engineer@preview';
18
19
  const RUNTIME_DIR = path.dirname(fileURLToPath(import.meta.url));
19
- const CONNECTOR_KEYS = ['analytics', 'github', 'revenuecat', 'sentry', 'asc'];
20
+ const ACCOUNT_SIGNAL_CONNECTOR_KEYS = [
21
+ 'stripe',
22
+ 'lemonsqueezy',
23
+ 'adapty',
24
+ 'superwall',
25
+ 'google-play',
26
+ 'datadog',
27
+ 'bugsnag',
28
+ 'intercom',
29
+ 'zendesk',
30
+ 'apple-search-ads',
31
+ 'google-ads',
32
+ 'meta-ads',
33
+ 'tiktok-ads',
34
+ 'vercel',
35
+ 'cloudflare',
36
+ 'resend',
37
+ 'customerio',
38
+ 'mailchimp',
39
+ 'appfollow',
40
+ 'apptweak',
41
+ 'linear',
42
+ 'postiz',
43
+ ];
44
+ const CONNECTOR_KEYS = [
45
+ 'analytics',
46
+ 'github',
47
+ 'revenuecat',
48
+ 'paddle',
49
+ 'seo',
50
+ 'sentry',
51
+ 'coolify',
52
+ 'asc',
53
+ ...ACCOUNT_SIGNAL_CONNECTOR_KEYS,
54
+ ];
20
55
  class WizardAbortError extends Error {
21
56
  exitCode;
22
57
  constructor(message, exitCode = 130) {
@@ -44,69 +79,640 @@ const CONNECTOR_DEFINITIONS = [
44
79
  summary: 'Read subscription, product, entitlement, and revenue context.',
45
80
  needs: 'A RevenueCat v2 secret API key with read-only project permissions.',
46
81
  },
82
+ {
83
+ key: 'paddle',
84
+ label: 'Paddle Billing metrics',
85
+ summary: 'Read web checkout, revenue, MRR, refunds, chargebacks, and active subscriber metrics.',
86
+ needs: 'A Paddle API key with metrics.read permission for the live account.',
87
+ },
88
+ {
89
+ key: 'seo',
90
+ label: 'SEO / GSC / DataForSEO',
91
+ summary: 'Read organic search demand, GSC clicks/impressions/CTR/position, and optional capped DataForSEO keyword ideas.',
92
+ needs: 'A GSC property plus an access token/service-account credential. DataForSEO credentials are optional and paid.',
93
+ },
47
94
  {
48
95
  key: 'sentry',
49
96
  label: 'Sentry-compatible crash monitoring',
50
97
  summary: 'Read unresolved crashes, regressions, affected users, releases, and production stability signals.',
51
98
  needs: 'A Sentry or GlitchTip-compatible auth token plus the org slug. Project scope is inferred later from app context or config.',
52
99
  },
100
+ {
101
+ key: 'coolify',
102
+ label: 'Coolify deployment monitoring',
103
+ summary: 'Read applications, deployments, servers, resources, and production health-check gaps.',
104
+ needs: 'A Coolify API token with read-only permissions from Keys & Tokens / API tokens.',
105
+ },
53
106
  {
54
107
  key: 'asc',
55
108
  label: 'ASC / App Store Connect CLI',
56
109
  summary: 'Read App Store analytics, reviews/ratings, builds/TestFlight/release context, subscriptions, purchases, and crash totals.',
57
110
  needs: 'ASC_KEY_ID, ASC_ISSUER_ID, and the AuthKey_XXXX.p8 content or path.',
58
111
  },
112
+ {
113
+ key: 'stripe',
114
+ label: 'Stripe billing and checkout',
115
+ summary: 'Read web payments, subscriptions, trials, invoices, refunds, disputes, coupons, and checkout conversion context.',
116
+ needs: 'An account-level Stripe restricted key or secret key with read access to customers, subscriptions, invoices, balance, charges, disputes, prices, products, coupons, and checkout sessions.',
117
+ },
118
+ {
119
+ key: 'lemonsqueezy',
120
+ label: 'Lemon Squeezy sales and licensing',
121
+ summary: 'Read stores, products, variants, orders, subscriptions, discounts, license keys, and churn/revenue context.',
122
+ needs: 'A live-mode Lemon Squeezy API key from account settings.',
123
+ },
124
+ {
125
+ key: 'adapty',
126
+ label: 'Adapty subscriptions and paywalls',
127
+ summary: 'Read mobile subscription, paywall, product, profile, attribution, and revenue signals across Adapty apps.',
128
+ needs: 'An Adapty server-side API key from dashboard app settings. App/project scope is left unpinned.',
129
+ },
130
+ {
131
+ key: 'superwall',
132
+ label: 'Superwall paywall experiments',
133
+ summary: 'Read paywalls, products, placements/campaigns, experiments, subscription outcomes, and conversion evidence.',
134
+ needs: 'A Superwall organization API key with read scopes.',
135
+ },
136
+ {
137
+ key: 'google-play',
138
+ label: 'Google Play Console',
139
+ summary: 'Read Android store, release, review, subscription, in-app purchase, and order signals across accessible apps.',
140
+ needs: 'A Play Console service account JSON credential with account-level read/reporting access.',
141
+ },
142
+ {
143
+ key: 'datadog',
144
+ label: 'Datadog observability',
145
+ summary: 'Read RUM, logs, errors, APM, monitors, incidents, deployment, and reliability signals.',
146
+ needs: 'Datadog API and application keys plus the Datadog site.',
147
+ },
148
+ {
149
+ key: 'bugsnag',
150
+ label: 'Bugsnag crash monitoring',
151
+ summary: 'Read error, release, session, stability, and affected-user signals across visible projects.',
152
+ needs: 'A Bugsnag data-access auth token with read access.',
153
+ },
154
+ {
155
+ key: 'intercom',
156
+ label: 'Intercom support and feedback',
157
+ summary: 'Read conversations, tickets, contacts, companies, support themes, and onboarding friction signals.',
158
+ needs: 'An Intercom private app access token for the workspace.',
159
+ },
160
+ {
161
+ key: 'zendesk',
162
+ label: 'Zendesk support and feedback',
163
+ summary: 'Read support tickets, tags, CSAT, customer friction, cancellation themes, and help-center signals.',
164
+ needs: 'Zendesk subdomain, agent/admin email, and API token or OAuth token.',
165
+ },
166
+ {
167
+ key: 'apple-search-ads',
168
+ label: 'Apple Search Ads (experimental)',
169
+ summary: 'Read iOS paid search campaigns, spend, installs, taps, CPT/CPA, keywords, and campaign quality signals.',
170
+ needs: 'Apple Ads OAuth client credentials or a current access/refresh token with account-level reporting access.',
171
+ experimental: true,
172
+ },
173
+ {
174
+ key: 'google-ads',
175
+ label: 'Google Ads (experimental)',
176
+ summary: 'Read paid search/app campaign spend, clicks, conversions, CAC, ROAS, and landing-page/ad-group signals.',
177
+ needs: 'Google Ads developer token plus OAuth client/refresh token credentials with account-wide read access.',
178
+ experimental: true,
179
+ },
180
+ {
181
+ key: 'meta-ads',
182
+ label: 'Meta Ads (experimental)',
183
+ summary: 'Read Facebook/Instagram campaign, ad set, creative, spend, conversion, CAC, and ROAS signals.',
184
+ needs: 'A Meta access token with Marketing API read permissions for the ad accounts you want analyzed.',
185
+ experimental: true,
186
+ },
187
+ {
188
+ key: 'tiktok-ads',
189
+ label: 'TikTok Ads (experimental)',
190
+ summary: 'Read TikTok campaign, ad group, creative, spend, conversion, CAC, and ROAS signals.',
191
+ needs: 'TikTok Business API app credentials and access token with advertiser reporting access.',
192
+ experimental: true,
193
+ },
194
+ {
195
+ key: 'vercel',
196
+ label: 'Vercel deployments (experimental)',
197
+ summary: 'Read projects, deployments, build failures, domains, environment health, and frontend reliability signals.',
198
+ needs: 'A Vercel access token with read access across the team/account.',
199
+ experimental: true,
200
+ },
201
+ {
202
+ key: 'cloudflare',
203
+ label: 'Cloudflare traffic and edge (experimental)',
204
+ summary: 'Read zones/accounts, traffic, cache, Workers/Pages, WAF/security, DNS, and edge reliability signals.',
205
+ needs: 'A Cloudflare API token with account/zone read scopes for analytics, Workers/Pages, DNS, and security events as needed.',
206
+ experimental: true,
207
+ },
208
+ {
209
+ key: 'resend',
210
+ label: 'Resend lifecycle email (experimental)',
211
+ summary: 'Read domains, broadcasts, transactional email volume, bounces, complaints, and deliverability signals.',
212
+ needs: 'A Resend API key with account-wide read access where available.',
213
+ experimental: true,
214
+ },
215
+ {
216
+ key: 'customerio',
217
+ label: 'Customer.io lifecycle messaging (experimental)',
218
+ summary: 'Read campaigns, broadcasts, journeys, segments, deliveries, conversions, and lifecycle engagement signals.',
219
+ needs: 'Customer.io App API credentials for the workspace.',
220
+ experimental: true,
221
+ },
222
+ {
223
+ key: 'mailchimp',
224
+ label: 'Mailchimp lifecycle email (experimental)',
225
+ summary: 'Read audiences, campaigns, automations, ecommerce, unsubscribes, bounces, and lifecycle performance signals.',
226
+ needs: 'A Mailchimp Marketing API key for the account.',
227
+ experimental: true,
228
+ },
229
+ {
230
+ key: 'appfollow',
231
+ label: 'AppFollow reviews and ASO (experimental)',
232
+ summary: 'Read app reviews, ratings, semantic review themes, ASO positions, and competitor/app collection signals.',
233
+ needs: 'An AppFollow API token from the API Dashboard with account/app collection read access.',
234
+ experimental: true,
235
+ },
236
+ {
237
+ key: 'apptweak',
238
+ label: 'AppTweak ASO intelligence (experimental)',
239
+ summary: 'Read keyword rankings, ASO metadata, competitor movement, category ranks, and store visibility signals.',
240
+ needs: 'An AppTweak API token from an account with API access.',
241
+ experimental: true,
242
+ },
243
+ {
244
+ key: 'linear',
245
+ label: 'Linear planning context (experimental)',
246
+ summary: 'Read teams, projects, issues, cycles, labels, roadmap context, and delivery bottleneck signals.',
247
+ needs: 'A Linear personal API key or OAuth access token with read access across the workspace.',
248
+ experimental: true,
249
+ },
250
+ {
251
+ key: 'postiz',
252
+ label: 'Postiz social publishing (experimental)',
253
+ summary: 'Read social integrations, scheduled/published posts, platform analytics, posting cadence, and content distribution signals.',
254
+ needs: 'A Postiz Public API key from Settings -> Developers -> Public API. Self-hosted installs can also set a custom API base URL.',
255
+ experimental: true,
256
+ },
257
+ ];
258
+ const ACCOUNT_SIGNAL_CONNECTOR_DEFINITIONS = [
259
+ {
260
+ ...CONNECTOR_DEFINITIONS.find((connector) => connector.key === 'stripe'),
261
+ key: 'stripe',
262
+ service: 'stripe',
263
+ docsUrl: 'https://docs.stripe.com/keys',
264
+ sourceKind: 'revenue',
265
+ signalHint: 'Stripe account summary with payments, subscriptions, trials, invoices, refunds, disputes, coupons, checkout sessions, product/price changes, and churn/revenue deltas. Do not pin a single product or price unless the agent explicitly narrows a later run.',
266
+ steps: [
267
+ 'Open Stripe Dashboard -> Developers -> API keys.',
268
+ 'Create a restricted key for OpenClaw/Growth Engineer, or use a standard secret key only when restricted keys are not practical.',
269
+ 'Prefer live-mode read permissions for Customers, Subscriptions, Invoices, Charges, Balance, Disputes, Prices, Products, Coupons, Promotion Codes, and Checkout Sessions.',
270
+ 'Do not select a single product, price, or connected account in the wizard. Account-wide access lets the agent discover the relevant products later.',
271
+ 'Copy the key once and paste it into this local terminal.',
272
+ ],
273
+ credentials: [{ env: 'STRIPE_API_KEY', prompt: 'Paste STRIPE_API_KEY into this local terminal' }],
274
+ },
275
+ {
276
+ ...CONNECTOR_DEFINITIONS.find((connector) => connector.key === 'lemonsqueezy'),
277
+ key: 'lemonsqueezy',
278
+ service: 'lemonsqueezy',
279
+ docsUrl: 'https://docs.lemonsqueezy.com/guides/developer-guide/getting-started',
280
+ sourceKind: 'revenue',
281
+ signalHint: 'Lemon Squeezy account summary with stores, products, variants, orders, subscriptions, discounts, license keys, refunds, and revenue/churn movement. Keep store/product filtering out of setup so the agent can inspect all accessible stores.',
282
+ steps: [
283
+ 'Open Lemon Squeezy Dashboard -> Settings -> API.',
284
+ 'Create a new API key in live mode for production revenue evidence.',
285
+ 'Keep the key private and store it only in this local wizard.',
286
+ 'Do not enter a store ID or product ID here; the agent should discover accessible stores from the account.',
287
+ 'Copy the key and paste it below.',
288
+ ],
289
+ credentials: [{ env: 'LEMON_SQUEEZY_API_KEY', prompt: 'Paste LEMON_SQUEEZY_API_KEY into this local terminal' }],
290
+ },
291
+ {
292
+ ...CONNECTOR_DEFINITIONS.find((connector) => connector.key === 'adapty'),
293
+ key: 'adapty',
294
+ service: 'adapty',
295
+ docsUrl: 'https://adapty.io/docs/api-adapty',
296
+ sourceKind: 'revenue',
297
+ signalHint: 'Adapty summary with apps, paywalls, placements, products, profiles, access levels, subscriptions, attribution, conversion, renewals, cancellations, and revenue signals. Leave app scope unpinned.',
298
+ steps: [
299
+ 'Open Adapty Dashboard.',
300
+ 'Go to App Settings -> General -> API keys.',
301
+ 'Copy the server-side API key for read access.',
302
+ 'Do not paste an app ID, product ID, or paywall ID here; the agent can discover visible apps/paywalls later.',
303
+ 'Paste the API key into this local terminal.',
304
+ ],
305
+ credentials: [{ env: 'ADAPTY_API_KEY', prompt: 'Paste ADAPTY_API_KEY into this local terminal' }],
306
+ },
307
+ {
308
+ ...CONNECTOR_DEFINITIONS.find((connector) => connector.key === 'superwall'),
309
+ key: 'superwall',
310
+ service: 'superwall',
311
+ docsUrl: 'https://api.superwall.com/docs',
312
+ sourceKind: 'revenue',
313
+ signalHint: 'Superwall organization summary with paywalls, placements, campaigns, products, experiments, subscription outcomes, conversion movement, and pricing/package signals. Keep project/paywall scope discoverable.',
314
+ steps: [
315
+ 'Open Superwall dashboard.',
316
+ 'Create or copy an organization API key with read scopes.',
317
+ 'Use organization-wide access so OpenClaw/Hermes can inspect all relevant paywalls and experiments.',
318
+ 'Do not enter a paywall, campaign, placement, or product ID in setup.',
319
+ 'Paste the organization API key below.',
320
+ ],
321
+ credentials: [{ env: 'SUPERWALL_API_KEY', prompt: 'Paste SUPERWALL_API_KEY into this local terminal' }],
322
+ },
323
+ {
324
+ ...CONNECTOR_DEFINITIONS.find((connector) => connector.key === 'google-play'),
325
+ key: 'google-play',
326
+ service: 'google-play',
327
+ docsUrl: 'https://developer.android.com/google/play/developer-api',
328
+ sourceKind: 'store',
329
+ signalHint: 'Google Play account summary with accessible apps, releases, reviews, ratings, Android vitals, subscriptions, in-app products, orders, cancellation reasons, and store/acquisition signals. Do not pin package names during setup.',
330
+ steps: [
331
+ 'Open Play Console -> Setup -> API access.',
332
+ 'Link or create a Google Cloud project and service account if needed.',
333
+ 'Grant read/reporting permissions that cover the apps you want analyzed, including financial/order data only when revenue analysis is desired.',
334
+ 'Save the service-account JSON on this host or paste the JSON into a secret env outside chat.',
335
+ 'Do not enter a package name in this wizard; accessible apps are discovered from the account.',
336
+ ],
337
+ credentials: [
338
+ {
339
+ env: 'GOOGLE_PLAY_SERVICE_ACCOUNT_JSON',
340
+ prompt: 'Paste GOOGLE_PLAY_SERVICE_ACCOUNT_JSON path or JSON content into this local terminal',
341
+ },
342
+ ],
343
+ },
344
+ {
345
+ ...CONNECTOR_DEFINITIONS.find((connector) => connector.key === 'datadog'),
346
+ key: 'datadog',
347
+ service: 'datadog',
348
+ docsUrl: 'https://docs.datadoghq.com/account_management/api-app-keys/',
349
+ sourceKind: 'crash',
350
+ signalHint: 'Datadog account summary with RUM, logs, errors, APM, monitors, incidents, deploy markers, performance regressions, and affected-user reliability signals. Do not pin services during setup.',
351
+ steps: [
352
+ 'Open Datadog -> Organization Settings -> API Keys and Application Keys.',
353
+ 'Create an API key and an application key with read scopes for RUM/logs/APM/monitors/incidents as needed.',
354
+ 'Choose the Datadog site for your account, for example datadoghq.com or datadoghq.eu.',
355
+ 'Do not enter service names, env names, or monitor IDs here; the agent can discover them later.',
356
+ 'Paste the keys below.',
357
+ ],
358
+ credentials: [
359
+ { env: 'DATADOG_API_KEY', prompt: 'Paste DATADOG_API_KEY into this local terminal' },
360
+ { env: 'DATADOG_APP_KEY', prompt: 'Paste DATADOG_APP_KEY into this local terminal' },
361
+ { env: 'DATADOG_SITE', prompt: 'Datadog site', optional: true, defaultValue: process.env.DATADOG_SITE || 'datadoghq.com' },
362
+ ],
363
+ },
364
+ {
365
+ ...CONNECTOR_DEFINITIONS.find((connector) => connector.key === 'bugsnag'),
366
+ key: 'bugsnag',
367
+ service: 'bugsnag',
368
+ docsUrl: 'https://docs.bugsnag.com/api/',
369
+ sourceKind: 'crash',
370
+ signalHint: 'Bugsnag account summary with organizations, projects, errors, releases, stability score, sessions, affected users, and crash/regression signals. Project scope stays discoverable.',
371
+ steps: [
372
+ 'Open Bugsnag settings and create or copy a data-access auth token.',
373
+ 'Grant read access for organizations/projects you want analyzed.',
374
+ 'Do not enter a project ID in this wizard.',
375
+ 'Paste the token below.',
376
+ ],
377
+ credentials: [{ env: 'BUGSNAG_AUTH_TOKEN', prompt: 'Paste BUGSNAG_AUTH_TOKEN into this local terminal' }],
378
+ },
379
+ {
380
+ ...CONNECTOR_DEFINITIONS.find((connector) => connector.key === 'intercom'),
381
+ key: 'intercom',
382
+ service: 'intercom',
383
+ docsUrl: 'https://developers.intercom.com/building-apps/docs/authentication',
384
+ sourceKind: 'feedback',
385
+ signalHint: 'Intercom workspace summary with conversations, tickets, contacts, companies, tags, support themes, onboarding friction, cancellation language, and customer feedback loops.',
386
+ steps: [
387
+ 'Open Intercom Developer Hub and create or open a private app for your own workspace.',
388
+ 'Go to Configure -> Authentication.',
389
+ 'Copy the access token for that workspace.',
390
+ 'Do not enter workspace-specific filters, tags, or inbox IDs here; the agent can discover relevant support surfaces later.',
391
+ 'Paste the token below.',
392
+ ],
393
+ credentials: [{ env: 'INTERCOM_ACCESS_TOKEN', prompt: 'Paste INTERCOM_ACCESS_TOKEN into this local terminal' }],
394
+ },
395
+ {
396
+ ...CONNECTOR_DEFINITIONS.find((connector) => connector.key === 'zendesk'),
397
+ key: 'zendesk',
398
+ service: 'zendesk',
399
+ docsUrl: 'https://developer.zendesk.com/api-reference/introduction/security-and-auth/',
400
+ sourceKind: 'feedback',
401
+ signalHint: 'Zendesk account summary with tickets, tags, views, CSAT, help-center signals, support themes, cancellation/friction language, and customer feedback loops.',
402
+ steps: [
403
+ 'Open Zendesk Admin Center -> Apps and integrations -> APIs -> Zendesk API.',
404
+ 'Create or copy an API token, or use an OAuth token if that is your workspace standard.',
405
+ 'Use the account subdomain and an agent/admin email that can read support data.',
406
+ 'Do not enter view IDs, brand IDs, product IDs, or ticket tags in setup.',
407
+ 'Paste the account credentials below.',
408
+ ],
409
+ credentials: [
410
+ { env: 'ZENDESK_SUBDOMAIN', prompt: 'Zendesk subdomain, for example mycompany', defaultValue: process.env.ZENDESK_SUBDOMAIN || '' },
411
+ { env: 'ZENDESK_EMAIL', prompt: 'Zendesk agent/admin email', defaultValue: process.env.ZENDESK_EMAIL || '' },
412
+ { env: 'ZENDESK_API_TOKEN', prompt: 'Paste ZENDESK_API_TOKEN into this local terminal' },
413
+ ],
414
+ },
415
+ {
416
+ ...CONNECTOR_DEFINITIONS.find((connector) => connector.key === 'apple-search-ads'),
417
+ key: 'apple-search-ads',
418
+ service: 'apple-search-ads',
419
+ docsUrl: 'https://developer.apple.com/documentation/apple_ads/implementing-oauth-for-the-apple-search-ads-api',
420
+ sourceKind: 'acquisition',
421
+ signalHint: 'Experimental Apple Search Ads account summary with organizations, campaigns, ad groups, keywords, spend, taps, installs, CPT/CPA, ROAS, and iOS paid-search acquisition quality. Keep campaign/app IDs out of setup so the agent can discover accessible accounts later.',
422
+ steps: [
423
+ 'Open Apple Search Ads / Apple Ads API access for the account.',
424
+ 'Create OAuth credentials or copy an existing refresh/access token from your server-side integration.',
425
+ 'Use account-level reporting access for every organization you want analyzed.',
426
+ 'Do not enter campaign IDs, ad group IDs, keyword IDs, or app IDs here.',
427
+ 'Paste the account credentials below.',
428
+ ],
429
+ credentials: [
430
+ { env: 'APPLE_SEARCH_ADS_CLIENT_ID', prompt: 'Paste APPLE_SEARCH_ADS_CLIENT_ID, or leave empty if using a token only', optional: true },
431
+ { env: 'APPLE_SEARCH_ADS_CLIENT_SECRET', prompt: 'Paste APPLE_SEARCH_ADS_CLIENT_SECRET, or leave empty if using a token only', optional: true },
432
+ { env: 'APPLE_SEARCH_ADS_REFRESH_TOKEN', prompt: 'Paste APPLE_SEARCH_ADS_REFRESH_TOKEN or current access token into this local terminal' },
433
+ ],
434
+ },
435
+ {
436
+ ...CONNECTOR_DEFINITIONS.find((connector) => connector.key === 'google-ads'),
437
+ key: 'google-ads',
438
+ service: 'google-ads',
439
+ docsUrl: 'https://developers.google.com/google-ads/api/docs/oauth/overview',
440
+ sourceKind: 'acquisition',
441
+ signalHint: 'Experimental Google Ads account summary with accessible customer accounts, campaigns, ad groups, keywords, spend, clicks, conversions, ROAS, CAC, search terms, and app/web acquisition quality. Keep customer IDs and campaign IDs discoverable.',
442
+ steps: [
443
+ 'Open Google Ads API Center and Google Cloud OAuth credentials for the account.',
444
+ 'Create or copy a developer token plus OAuth client credentials and refresh token.',
445
+ 'Use a manager/account credential that can read every customer account you want analyzed.',
446
+ 'Do not enter customer IDs, campaign IDs, ad group IDs, or conversion action IDs in setup.',
447
+ 'Paste the account-wide credentials below.',
448
+ ],
449
+ credentials: [
450
+ { env: 'GOOGLE_ADS_DEVELOPER_TOKEN', prompt: 'Paste GOOGLE_ADS_DEVELOPER_TOKEN into this local terminal' },
451
+ { env: 'GOOGLE_ADS_CLIENT_ID', prompt: 'Paste GOOGLE_ADS_CLIENT_ID into this local terminal' },
452
+ { env: 'GOOGLE_ADS_CLIENT_SECRET', prompt: 'Paste GOOGLE_ADS_CLIENT_SECRET into this local terminal' },
453
+ { env: 'GOOGLE_ADS_REFRESH_TOKEN', prompt: 'Paste GOOGLE_ADS_REFRESH_TOKEN into this local terminal' },
454
+ { env: 'GOOGLE_ADS_LOGIN_CUSTOMER_ID', prompt: 'Optional manager login customer ID (empty = discover accessible accounts)', optional: true },
455
+ ],
456
+ },
457
+ {
458
+ ...CONNECTOR_DEFINITIONS.find((connector) => connector.key === 'meta-ads'),
459
+ key: 'meta-ads',
460
+ service: 'meta-ads',
461
+ docsUrl: 'https://developers.facebook.com/docs/marketing-apis/',
462
+ sourceKind: 'acquisition',
463
+ signalHint: 'Experimental Meta Ads account summary with accessible ad accounts, campaigns, ad sets, creatives, spend, impressions, clicks, conversion values, CAC, ROAS, and paid social acquisition quality. Keep ad account IDs and campaign IDs discoverable.',
464
+ steps: [
465
+ 'Open Meta for Developers / Business Manager for the app or system user that owns Marketing API access.',
466
+ 'Create or copy a long-lived access token with ads_read and related read permissions approved for your business.',
467
+ 'Use business/account-level access for all ad accounts you want analyzed.',
468
+ 'Do not enter ad account IDs, campaign IDs, pixel IDs, or page IDs here.',
469
+ 'Paste the access token below.',
470
+ ],
471
+ credentials: [{ env: 'META_ADS_ACCESS_TOKEN', prompt: 'Paste META_ADS_ACCESS_TOKEN into this local terminal' }],
472
+ },
473
+ {
474
+ ...CONNECTOR_DEFINITIONS.find((connector) => connector.key === 'tiktok-ads'),
475
+ key: 'tiktok-ads',
476
+ service: 'tiktok-ads',
477
+ docsUrl: 'https://business-api.tiktok.com/portal/docs',
478
+ sourceKind: 'acquisition',
479
+ signalHint: 'Experimental TikTok Ads account summary with advertisers, campaigns, ad groups, creatives, spend, impressions, clicks, conversions, CAC, ROAS, and paid social acquisition quality. Keep advertiser/campaign IDs out of setup.',
480
+ steps: [
481
+ 'Open TikTok Business API / Marketing API portal.',
482
+ 'Create or copy app credentials and an access token with advertiser reporting permissions.',
483
+ 'Use a credential that can list the advertisers you want analyzed.',
484
+ 'Do not enter advertiser IDs, campaign IDs, ad group IDs, or creative IDs in setup.',
485
+ 'Paste the credentials below.',
486
+ ],
487
+ credentials: [
488
+ { env: 'TIKTOK_ADS_ACCESS_TOKEN', prompt: 'Paste TIKTOK_ADS_ACCESS_TOKEN into this local terminal' },
489
+ { env: 'TIKTOK_ADS_APP_ID', prompt: 'Paste TIKTOK_ADS_APP_ID, or leave empty if token-only', optional: true },
490
+ { env: 'TIKTOK_ADS_SECRET', prompt: 'Paste TIKTOK_ADS_SECRET, or leave empty if token-only', optional: true },
491
+ ],
492
+ },
493
+ {
494
+ ...CONNECTOR_DEFINITIONS.find((connector) => connector.key === 'vercel'),
495
+ key: 'vercel',
496
+ service: 'vercel',
497
+ docsUrl: 'https://vercel.com/docs/rest-api/reference/welcome',
498
+ sourceKind: 'infrastructure',
499
+ signalHint: 'Experimental Vercel account summary with projects, deployments, failed builds, domains, edge/runtime errors, environment health, web vitals where available, and release reliability. Keep project IDs/team IDs discoverable.',
500
+ steps: [
501
+ 'Open Vercel Account Settings -> Tokens.',
502
+ 'Create an access token with read access for the team/account you want analyzed.',
503
+ 'Use team/account-level access so the agent can discover projects and deployments.',
504
+ 'Do not enter project IDs, deployment IDs, domain names, or team IDs in setup.',
505
+ 'Paste the token below.',
506
+ ],
507
+ credentials: [{ env: 'VERCEL_ACCESS_TOKEN', prompt: 'Paste VERCEL_ACCESS_TOKEN into this local terminal' }],
508
+ },
509
+ {
510
+ ...CONNECTOR_DEFINITIONS.find((connector) => connector.key === 'cloudflare'),
511
+ key: 'cloudflare',
512
+ service: 'cloudflare',
513
+ docsUrl: 'https://developers.cloudflare.com/fundamentals/api/get-started/create-token/',
514
+ sourceKind: 'infrastructure',
515
+ signalHint: 'Experimental Cloudflare account summary with accounts, zones, Workers, Pages, DNS, traffic, cache, WAF/security events, outages, and edge reliability. Keep account/zone IDs discoverable.',
516
+ steps: [
517
+ 'Open Cloudflare dashboard -> My Profile -> API Tokens.',
518
+ 'Create a custom token with read scopes for accounts/zones, analytics, Workers/Pages, DNS, and security events as needed.',
519
+ 'Prefer account-level read access for every zone/app the agent may analyze.',
520
+ 'Do not enter account IDs, zone IDs, Worker names, or domain names here.',
521
+ 'Paste the API token below.',
522
+ ],
523
+ credentials: [{ env: 'CLOUDFLARE_API_TOKEN', prompt: 'Paste CLOUDFLARE_API_TOKEN into this local terminal' }],
524
+ },
525
+ {
526
+ ...CONNECTOR_DEFINITIONS.find((connector) => connector.key === 'resend'),
527
+ key: 'resend',
528
+ service: 'resend',
529
+ docsUrl: 'https://resend.com/docs/dashboard/api-keys/introduction',
530
+ sourceKind: 'lifecycle',
531
+ signalHint: 'Experimental Resend account summary with domains, broadcasts, transactional volume, bounces, complaints, delivery health, and lifecycle/email deliverability signals. Keep domain filters discoverable.',
532
+ steps: [
533
+ 'Open Resend Dashboard -> API Keys.',
534
+ 'Create an API key with the narrowest account-wide access available for reporting.',
535
+ 'Use account-level access so the agent can inspect all relevant domains and sending streams.',
536
+ 'Do not enter domain IDs, broadcast IDs, or audience/list IDs in setup.',
537
+ 'Paste the key below.',
538
+ ],
539
+ credentials: [{ env: 'RESEND_API_KEY', prompt: 'Paste RESEND_API_KEY into this local terminal' }],
540
+ },
541
+ {
542
+ ...CONNECTOR_DEFINITIONS.find((connector) => connector.key === 'customerio'),
543
+ key: 'customerio',
544
+ service: 'customerio',
545
+ docsUrl: 'https://docs.customer.io/accounts-and-workspaces/managing-credentials/',
546
+ sourceKind: 'lifecycle',
547
+ signalHint: 'Experimental Customer.io account summary with campaigns, broadcasts, journeys, segments, deliveries, conversions, unsubscribes, and lifecycle engagement quality. Keep workspace object IDs discoverable.',
548
+ steps: [
549
+ 'Open Customer.io -> Settings -> Workspace Settings -> API and Webhook Credentials.',
550
+ 'Create or copy App API credentials for the workspace.',
551
+ 'Use workspace-level credentials so the agent can inspect campaigns, broadcasts, journeys, and segments.',
552
+ 'Do not enter campaign IDs, segment IDs, newsletter IDs, or workspace-specific filters here.',
553
+ 'Paste the credentials below.',
554
+ ],
555
+ credentials: [
556
+ { env: 'CUSTOMERIO_APP_API_KEY', prompt: 'Paste CUSTOMERIO_APP_API_KEY into this local terminal' },
557
+ { env: 'CUSTOMERIO_SITE_ID', prompt: 'Paste CUSTOMERIO_SITE_ID, or leave empty when App API key is enough', optional: true },
558
+ ],
559
+ },
560
+ {
561
+ ...CONNECTOR_DEFINITIONS.find((connector) => connector.key === 'mailchimp'),
562
+ key: 'mailchimp',
563
+ service: 'mailchimp',
564
+ docsUrl: 'https://mailchimp.com/developer/marketing/guides/quick-start/',
565
+ sourceKind: 'lifecycle',
566
+ signalHint: 'Experimental Mailchimp account summary with audiences, campaigns, automations, ecommerce, unsubscribes, bounces, clicks, opens, and lifecycle/email performance. Keep audience and campaign IDs discoverable.',
567
+ steps: [
568
+ 'Open Mailchimp -> Account & billing -> Extras -> API keys.',
569
+ 'Create or copy a Marketing API key for the account.',
570
+ 'Use account-level access so the agent can inspect all relevant audiences and campaigns.',
571
+ 'Do not enter audience IDs, campaign IDs, list IDs, or store IDs in setup.',
572
+ 'Paste the API key below.',
573
+ ],
574
+ credentials: [{ env: 'MAILCHIMP_API_KEY', prompt: 'Paste MAILCHIMP_API_KEY into this local terminal' }],
575
+ },
576
+ {
577
+ ...CONNECTOR_DEFINITIONS.find((connector) => connector.key === 'appfollow'),
578
+ key: 'appfollow',
579
+ service: 'appfollow',
580
+ docsUrl: 'https://support.appfollow.io/hc/en-us/articles/4403679243409-API-Access-Methods',
581
+ sourceKind: 'aso',
582
+ signalHint: 'Experimental AppFollow account summary with app collections, reviews, ratings, semantic themes, ASO/rank signals, competitor context, and store feedback quality. Keep collection/app IDs discoverable.',
583
+ steps: [
584
+ 'Open AppFollow -> Integrations -> API Dashboard.',
585
+ 'Create or copy the API token from an Owner/Admin account.',
586
+ 'Use account-level access for every app collection you want analyzed.',
587
+ 'Do not enter app IDs, collection IDs, country codes, or store IDs in setup.',
588
+ 'Paste the API token below.',
589
+ ],
590
+ credentials: [{ env: 'APPFOLLOW_API_TOKEN', prompt: 'Paste APPFOLLOW_API_TOKEN into this local terminal' }],
591
+ },
592
+ {
593
+ ...CONNECTOR_DEFINITIONS.find((connector) => connector.key === 'apptweak'),
594
+ key: 'apptweak',
595
+ service: 'apptweak',
596
+ docsUrl: 'https://help.apptweak.com/en/articles/4901806-learn-more-about-apptweak-takeout-api',
597
+ sourceKind: 'aso',
598
+ signalHint: 'Experimental AppTweak account summary with keyword rankings, category ranks, metadata, ASO visibility, competitors, and store-market opportunity signals. Keep app IDs and markets discoverable.',
599
+ steps: [
600
+ 'Open AppTweak account/API settings or API documentation area.',
601
+ 'Create or copy an API token from an account with API access.',
602
+ 'Use account-level API access for every app/market you want analyzed.',
603
+ 'Do not enter app IDs, competitor IDs, country codes, keyword IDs, or store IDs here.',
604
+ 'Paste the API token below.',
605
+ ],
606
+ credentials: [{ env: 'APPTWEAK_API_TOKEN', prompt: 'Paste APPTWEAK_API_TOKEN into this local terminal' }],
607
+ },
608
+ {
609
+ ...CONNECTOR_DEFINITIONS.find((connector) => connector.key === 'linear'),
610
+ key: 'linear',
611
+ service: 'linear',
612
+ docsUrl: 'https://linear.app/developers',
613
+ sourceKind: 'planning',
614
+ signalHint: 'Experimental Linear workspace summary with teams, projects, cycles, issues, labels, stale work, roadmap commitments, delivery bottlenecks, and product execution context. Keep team/project IDs discoverable.',
615
+ steps: [
616
+ 'Open Linear -> Settings -> API.',
617
+ 'Create a personal API key or use an OAuth token with read access.',
618
+ 'Use workspace-level read access so the agent can inspect all relevant teams/projects.',
619
+ 'Do not enter team IDs, project IDs, issue IDs, labels, or cycle IDs in setup.',
620
+ 'Paste the token below.',
621
+ ],
622
+ credentials: [{ env: 'LINEAR_API_KEY', prompt: 'Paste LINEAR_API_KEY or LINEAR_ACCESS_TOKEN into this local terminal' }],
623
+ },
624
+ {
625
+ ...CONNECTOR_DEFINITIONS.find((connector) => connector.key === 'postiz'),
626
+ key: 'postiz',
627
+ service: 'postiz',
628
+ docsUrl: 'https://docs.postiz.com/public-api',
629
+ sourceKind: 'acquisition',
630
+ signalHint: 'Experimental Postiz account summary with connected social integrations, scheduled/published posts, platform analytics, content cadence, failed/pending posts, and organic distribution signals. Keep integration IDs and channel filters discoverable.',
631
+ steps: [
632
+ 'Open Postiz -> Settings -> Developers -> Public API.',
633
+ 'Create or copy a Public API key. OAuth2 tokens are also usable for app-user flows.',
634
+ 'For Postiz Cloud, keep the default API base URL. For self-hosted Postiz, use your backend public URL ending in /public/v1.',
635
+ 'Do not enter integration IDs, channel IDs, platform names, post IDs, or tag filters in setup.',
636
+ 'Paste the API credentials below.',
637
+ ],
638
+ credentials: [
639
+ { env: 'POSTIZ_API_KEY', prompt: 'Paste POSTIZ_API_KEY into this local terminal' },
640
+ {
641
+ env: 'POSTIZ_API_BASE_URL',
642
+ prompt: 'Postiz API base URL',
643
+ optional: true,
644
+ defaultValue: process.env.POSTIZ_API_BASE_URL || 'https://api.postiz.com/public/v1',
645
+ },
646
+ ],
647
+ },
59
648
  ];
649
+ const ACCOUNT_SIGNAL_CONNECTORS = new Map(ACCOUNT_SIGNAL_CONNECTOR_DEFINITIONS.map((definition) => [definition.key, definition]));
650
+ function getAccountSignalConnectorDefinition(key) {
651
+ return ACCOUNT_SIGNAL_CONNECTORS.get(key) || null;
652
+ }
653
+ function isAccountSignalConnector(key) {
654
+ return ACCOUNT_SIGNAL_CONNECTORS.has(key);
655
+ }
60
656
  const DEFAULT_CADENCE_PLAN = [
657
+ {
658
+ key: 'healthcheck',
659
+ title: '90-minute production error healthcheck',
660
+ intervalMinutes: 90,
661
+ criticalOnly: true,
662
+ focusAreas: ['crash', 'deployment', 'availability'],
663
+ sourcePriorities: ['sentry', 'glitchtip', 'coolify', 'asc_cli'],
664
+ objective: 'Check Sentry/GlitchTip and Coolify for production errors, failed deploys, unhealthy resources, and availability blockers across every configured app.',
665
+ instructions: 'For Sentry/GlitchTip app errors, compare the issue release or app version with ASC production versions first. Ignore errors that only affect TestFlight, debug, staging, unreleased, or non-production app versions. Keep the social output short and action-oriented.',
666
+ },
61
667
  {
62
668
  key: 'daily',
63
- title: 'Daily Sentry and production guardrail',
669
+ title: 'Daily behavioral anomaly guardrail',
64
670
  intervalDays: 1,
65
671
  criticalOnly: true,
66
- focusAreas: ['sentry_errors', 'crash', 'onboarding', 'conversion', 'paywall', 'purchase'],
67
- sourcePriorities: ['sentry', 'glitchtip', 'analytics', 'revenuecat', 'asc_cli', 'feedback', 'github'],
68
- objective: 'Analyze every configured project for critical production blockers: Sentry/GlitchTip errors, crashes, onboarding or purchase drop-offs, zero-conversion days, missing buyers, very low users, and other silent business anomalies.',
69
- instructions: 'Compare against recent baselines across connected sources and code changes. If the finding is critical, produce the exact fix or next debugging step and prefer a GitHub issue or draft PR when GitHub write access is configured; otherwise hand off via OpenClaw chat. Avoid generic growth ideas.',
672
+ focusAreas: ['analytics_anomaly', 'onboarding', 'conversion', 'paywall', 'purchase', 'retention', 'revenue'],
673
+ sourcePriorities: ['analytics', 'revenuecat', 'paddle', 'asc_cli', 'feedback', 'github', 'sentry', 'glitchtip', 'coolify'],
674
+ objective: 'Detect non-Sentry product and payment anomalies that affect real users: broken login or account flows inferred from behavior, onboarding or purchase drop-offs, zero-conversion days, missing buyers, very low active users, retention cliffs, and revenue anomalies.',
675
+ instructions: 'Compare AnalyticsCLI, RevenueCat, Paddle, ASC, feedback, memory/state, and recent code changes against recent baselines. Use Sentry/GlitchTip/Coolify only as corroborating context; do not repeat pure crash or deployment alerts that belong to the 90-minute healthcheck.',
70
676
  },
71
677
  {
72
678
  key: 'weekly',
73
679
  title: 'Weekly executive product and growth summary',
74
680
  intervalDays: 7,
75
681
  criticalOnly: false,
76
- focusAreas: ['conversion', 'paywall', 'onboarding', 'marketing', 'retention', 'stability'],
77
- sourcePriorities: ['analytics', 'revenuecat', 'asc_cli', 'feedback', 'sentry', 'github'],
78
- objective: 'Create an executive summary across all configured projects, connectors, recent releases, code changes, revenue, activation, retention, reviews, and production stability.',
79
- instructions: 'Pick one to three high-confidence improvements with evidence, expected KPI movement, likely code/store surfaces, owner-ready next steps, and a verification plan. Create GitHub issues or draft PR proposals only when the evidence is specific enough.',
682
+ focusAreas: ['conversion', 'paywall', 'onboarding', 'marketing', 'retention', 'stability', 'seo'],
683
+ sourcePriorities: ['analytics', 'revenuecat', 'paddle', 'seo', 'asc_cli', 'feedback', 'sentry', 'coolify', 'github'],
684
+ objective: 'Create a deep app-by-app executive summary across all configured projects, connectors, recent releases, code changes, traffic, SEO/acquisition, revenue, activation, conversion, retention, reviews, and production stability.',
685
+ instructions: 'Be detailed. Group findings per app, explain why each recommendation should improve app usage, revenue, conversion, retention, or traffic, include expected KPI movement, likely code/store surfaces, owner-ready next steps, and verification plans. Generate charts when they clarify the evidence.',
80
686
  },
81
687
  {
82
688
  key: 'monthly',
83
689
  title: 'Monthly deep product, business, and code review',
84
690
  intervalDays: 30,
85
691
  criticalOnly: false,
86
- focusAreas: ['conversion', 'paywall', 'retention', 'marketing', 'onboarding', 'codebase'],
87
- sourcePriorities: ['analytics', 'revenuecat', 'asc_cli', 'feedback', 'sentry', 'github'],
88
- objective: 'Compare all configured projects month-over-month: MRR, trial conversion, churn, acquisition quality, store conversion, retention, review themes, feature usage, crash totals, and codebase changes.',
89
- instructions: 'Decide what should be built, changed, deleted, or instrumented next. Tie conclusions to connector data plus codebase evidence and explain why each recommendation should move revenue, activation, retention, stability, or acquisition quality.',
692
+ focusAreas: ['conversion', 'paywall', 'retention', 'marketing', 'onboarding', 'codebase', 'seo'],
693
+ sourcePriorities: ['analytics', 'revenuecat', 'paddle', 'seo', 'asc_cli', 'feedback', 'sentry', 'coolify', 'github'],
694
+ objective: 'Compare all configured projects month-over-month: MRR, trial conversion, churn, Paddle revenue/subscriber movement, SEO demand/clicks, acquisition quality, store conversion, retention, review themes, feature usage, crash totals, and codebase changes.',
695
+ instructions: 'Be very detailed and app-grouped. Decide what should be built, changed, deleted, priced differently, marketed differently, or instrumented next. Tie conclusions to connector data plus codebase evidence and explain why each recommendation should move revenue, conversion, retention, traffic, or acquisition quality. Generate charts when useful.',
90
696
  },
91
697
  {
92
698
  key: 'quarterly',
93
- title: 'Quarterly positioning, pricing, and roadmap review',
699
+ title: '3-month positioning, pricing, and roadmap review',
94
700
  intervalDays: 91,
95
701
  criticalOnly: false,
96
702
  focusAreas: ['marketing', 'paywall', 'retention', 'conversion', 'onboarding'],
97
- sourcePriorities: ['analytics', 'revenuecat', 'asc_cli', 'feedback', 'github', 'sentry'],
98
- objective: 'Revisit positioning, pricing/packaging, onboarding architecture, roadmap assumptions, tracking quality, codebase constraints, and major funnel bets across every configured project.',
99
- instructions: 'Find structural constraints and durable opportunities. Tie recommendations to cohort behavior, monetization, reviews, channel quality, and shipped changes.',
703
+ sourcePriorities: ['analytics', 'revenuecat', 'paddle', 'seo', 'asc_cli', 'feedback', 'github', 'sentry'],
704
+ objective: 'Revisit positioning, pricing/packaging, onboarding architecture, roadmap assumptions, tracking quality, codebase constraints, and major funnel bets across every configured app.',
705
+ instructions: 'Find structural constraints and durable opportunities, not small UI tweaks. Group the analysis by app and tie recommendations to cohort behavior, monetization, SEO demand, reviews, channel quality, and shipped changes. Include concrete roadmap, pricing, conversion, and traffic recommendations.',
100
706
  },
101
707
  {
102
708
  key: 'six_months',
103
709
  title: 'Six-month instrumentation and growth-system audit',
104
710
  intervalDays: 182,
105
711
  criticalOnly: false,
106
- focusAreas: ['retention', 'conversion', 'paywall', 'marketing', 'general'],
107
- sourcePriorities: ['analytics', 'revenuecat', 'asc_cli', 'feedback', 'sentry'],
108
- objective: 'Audit connector coverage, SDK instrumentation, event taxonomy, data reliability, memory, growth loops, and whether product/code strategy still matches the best users across configured projects.',
109
- instructions: 'Prioritize measurement fixes and system changes that make future analysis more trustworthy. Identify stale events, missing attribution, weak identity, and misleading dashboards.',
712
+ focusAreas: ['retention', 'conversion', 'paywall', 'marketing', 'general', 'seo'],
713
+ sourcePriorities: ['analytics', 'revenuecat', 'paddle', 'seo', 'asc_cli', 'feedback', 'sentry'],
714
+ objective: 'Audit connector coverage, SDK instrumentation, event taxonomy, data reliability, memory, growth loops, and whether product/code strategy still matches the best users across configured apps.',
715
+ instructions: 'Group by app. Prioritize measurement fixes and system changes that make future analysis more trustworthy, then identify the highest-leverage app/revenue/conversion/SEO/traffic improvements. Identify stale events, missing attribution, weak identity, broken feedback loops, and misleading dashboards.',
110
716
  },
111
717
  {
112
718
  key: 'yearly',
@@ -114,7 +720,7 @@ const DEFAULT_CADENCE_PLAN = [
114
720
  intervalDays: 365,
115
721
  criticalOnly: false,
116
722
  focusAreas: ['marketing', 'retention', 'paywall', 'conversion', 'general'],
117
- sourcePriorities: ['analytics', 'revenuecat', 'asc_cli', 'feedback', 'sentry'],
723
+ sourcePriorities: ['analytics', 'revenuecat', 'paddle', 'seo', 'asc_cli', 'feedback', 'sentry'],
118
724
  objective: 'Reset strategy from evidence across every configured project: market/channel fit, monetization model, retention ceiling, product scope, and whether to double down, reposition, rebuild, or sunset major surfaces/features.',
119
725
  instructions: 'Use the full year of memory, releases, revenue, acquisition, reviews, code changes, and cohort behavior. Produce strategic experiments and stop-doing decisions.',
120
726
  },
@@ -158,13 +764,27 @@ function isTruthyEnv(value) {
158
764
  function isFalseyEnv(value) {
159
765
  return ['0', 'false', 'no', 'n', 'off'].includes(String(value || '').trim().toLowerCase());
160
766
  }
767
+ function resolveDefaultConfigPath() {
768
+ const explicit = String(process.env.OPENCLAW_GROWTH_CONFIG_PATH || '').trim();
769
+ if (explicit)
770
+ return explicit;
771
+ const homeConfigPath = process.env.HOME ? path.join(process.env.HOME, 'data/openclaw-growth-engineer/config.json') : '';
772
+ const homeStatePath = process.env.HOME ? path.join(process.env.HOME, 'data/openclaw-growth-engineer/state.json') : '';
773
+ if (homeConfigPath && existsSync(homeConfigPath) && existsSync(homeStatePath))
774
+ return homeConfigPath;
775
+ if (!existsSync(DEFAULT_CONFIG_PATH) && homeConfigPath && existsSync(homeConfigPath))
776
+ return homeConfigPath;
777
+ return DEFAULT_CONFIG_PATH;
778
+ }
161
779
  function parseArgs(argv) {
780
+ const defaultConfigPath = resolveDefaultConfigPath();
162
781
  const args = {
163
- config: DEFAULT_CONFIG_PATH,
782
+ config: defaultConfigPath,
164
783
  connectorWizard: false,
165
784
  connectors: '',
166
785
  noSelfUpdate: false,
167
- out: DEFAULT_CONFIG_PATH,
786
+ out: defaultConfigPath,
787
+ sandboxSmoke: false,
168
788
  };
169
789
  for (let i = 0; i < argv.length; i += 1) {
170
790
  const token = argv[i];
@@ -192,6 +812,10 @@ function parseArgs(argv) {
192
812
  else if (token === '--no-self-update') {
193
813
  args.noSelfUpdate = true;
194
814
  }
815
+ else if (token === '--sandbox-smoke') {
816
+ args.sandboxSmoke = true;
817
+ args.noSelfUpdate = true;
818
+ }
195
819
  else if (token === '--help' || token === '-h') {
196
820
  printHelpAndExit(0);
197
821
  }
@@ -209,10 +833,14 @@ function printHelpAndExit(exitCode, reason = null) {
209
833
  OpenClaw Growth Setup Wizard
210
834
 
211
835
  Usage:
212
- node scripts/openclaw-growth-wizard.mjs [--out <config-path>]
213
- node scripts/openclaw-growth-wizard.mjs --connectors [analytics,github,revenuecat,sentry,asc] [--config <config-path>]
836
+ npx -y @analyticscli/growth-engineer@preview wizard [--out <config-path>]
837
+ npx -y @analyticscli/growth-engineer@preview wizard --connectors [${CONNECTOR_KEYS.join(',')}]
838
+
839
+ Compatibility note:
840
+ Existing cron/heartbeat runners may still execute generated runtime scripts, but user-facing setup and connector repair should use the npx command above.
214
841
 
215
842
  Options:
843
+ --config <file> Override auto-discovered config path
216
844
  --no-self-update Skip the ClawHub skill update check for this run
217
845
  `);
218
846
  process.exit(exitCode);
@@ -245,9 +873,18 @@ function getWizardDefaultSourceCommand(sourceName) {
245
873
  if (normalized === 'revenuecat' || normalized === 'revenue-cat') {
246
874
  return nodeRuntimeScriptCommand('export-revenuecat-summary.mjs');
247
875
  }
876
+ if (normalized === 'paddle') {
877
+ return nodeRuntimeScriptCommand('export-paddle-summary.mjs');
878
+ }
879
+ if (['seo', 'gsc', 'google-search-console', 'search-console', 'dataforseo'].includes(normalized)) {
880
+ return nodeRuntimeScriptCommand('export-seo-summary.mjs');
881
+ }
248
882
  if (normalized === 'sentry' || normalized === 'glitchtip') {
249
883
  return nodeRuntimeScriptCommand('export-sentry-summary.mjs');
250
884
  }
885
+ if (normalized === 'coolify') {
886
+ return growthEngineerPackageCommand('exporters coolify-summary');
887
+ }
251
888
  if (normalized === 'feedback') {
252
889
  return getDefaultSourceCommand('feedback');
253
890
  }
@@ -256,6 +893,79 @@ function getWizardDefaultSourceCommand(sourceName) {
256
893
  }
257
894
  return getDefaultSourceCommand(sourceName);
258
895
  }
896
+ function replaceLegacyRuntimeScriptCommand(command) {
897
+ const trimmed = String(command || '').trim();
898
+ if (!trimmed)
899
+ return trimmed;
900
+ return trimmed.replace(/^node\s+scripts\/(export-analytics-summary\.mjs|export-revenuecat-summary\.mjs|export-paddle-summary\.mjs|export-seo-summary\.mjs|export-sentry-summary\.mjs|export-coolify-summary\.mjs|export-asc-summary\.mjs|openclaw-growth-start\.mjs|openclaw-growth-status\.mjs|openclaw-growth-runner\.mjs|openclaw-growth-preflight\.mjs)(?=\s|$)/, (_match, scriptName) => nodeRuntimeScriptCommand(scriptName));
901
+ }
902
+ function sourceCommandNeedsActiveConfig(sourceName, command) {
903
+ const normalized = String(sourceName || '').trim().toLowerCase();
904
+ const value = String(command || '').toLowerCase();
905
+ return (normalized === 'sentry' ||
906
+ normalized === 'glitchtip' ||
907
+ normalized === 'coolify' ||
908
+ value.includes('export-sentry-summary') ||
909
+ value.includes('export-coolify-summary') ||
910
+ value.includes('exporters coolify-summary'));
911
+ }
912
+ function withWizardConfigArg(sourceName, command, configPath) {
913
+ const trimmed = String(command || '').trim();
914
+ if (!trimmed || !configPath || !sourceCommandNeedsActiveConfig(sourceName, trimmed))
915
+ return trimmed;
916
+ return trimmed
917
+ .replace(/(^|\s)--config=(?:"[^"]*"|'[^']*'|\S+)/, `$1--config ${quote(configPath)}`)
918
+ .replace(/(^|\s)--config\s+(?:"[^"]*"|'[^']*'|\S+)/, `$1--config ${quote(configPath)}`)
919
+ .replace(new RegExp(`^(?!.*(?:^|\\s)--config(?:=|\\s|$))(.+)$`), `$1 --config ${quote(configPath)}`)
920
+ .trim();
921
+ }
922
+ function normalizeWizardSourceCommand(sourceName, source, configPath = null) {
923
+ const current = replaceLegacyRuntimeScriptCommand(source?.command || '');
924
+ const command = current || getWizardDefaultSourceCommand(sourceName);
925
+ return withWizardConfigArg(sourceName, command, configPath);
926
+ }
927
+ function migrateRuntimeSourceCommands(config, configPath = null) {
928
+ if (!config || typeof config !== 'object')
929
+ return config;
930
+ const sources = config.sources && typeof config.sources === 'object' ? config.sources : {};
931
+ const nextSources = { ...sources };
932
+ for (const sourceName of ['analytics', 'revenuecat', 'paddle', 'seo', 'sentry', 'coolify']) {
933
+ if (nextSources[sourceName]?.mode === 'command') {
934
+ nextSources[sourceName] = {
935
+ ...nextSources[sourceName],
936
+ command: normalizeWizardSourceCommand(sourceName, nextSources[sourceName], configPath),
937
+ };
938
+ }
939
+ }
940
+ if (Array.isArray(nextSources.extra)) {
941
+ nextSources.extra = nextSources.extra.map((source) => {
942
+ if (!source || source.mode !== 'command')
943
+ return source;
944
+ const service = String(source.service || source.key || '').toLowerCase();
945
+ const sourceName = ['asc', 'asc-cli', 'app-store-connect', 'app_store_connect'].includes(service)
946
+ ? 'asc'
947
+ : service;
948
+ return {
949
+ ...source,
950
+ command: normalizeWizardSourceCommand(sourceName, source, configPath),
951
+ };
952
+ });
953
+ }
954
+ return {
955
+ ...config,
956
+ sources: nextSources,
957
+ };
958
+ }
959
+ async function migrateRuntimeSourceCommandsFile(configPath) {
960
+ const existing = await readJsonIfPresent(configPath).catch(() => null);
961
+ if (!existing || typeof existing !== 'object')
962
+ return null;
963
+ const migrated = migrateRuntimeSourceCommands(existing, configPath);
964
+ if (JSON.stringify(existing.sources || {}) !== JSON.stringify(migrated.sources || {})) {
965
+ await writeJsonFile(configPath, migrated);
966
+ }
967
+ return migrated;
968
+ }
259
969
  function normalizeConnectorKey(value) {
260
970
  const normalized = String(value || '').trim().toLowerCase().replace(/[_\s]+/g, '-');
261
971
  if (!normalized)
@@ -268,10 +978,60 @@ function normalizeConnectorKey(value) {
268
978
  return 'github';
269
979
  if (['revenuecat', 'revenue-cat', 'rc', 'revenuecat-mcp'].includes(normalized))
270
980
  return 'revenuecat';
981
+ if (['paddle', 'paddle-billing', 'billing-metrics', 'web-revenue'].includes(normalized))
982
+ return 'paddle';
983
+ if (['seo', 'gsc', 'google-search-console', 'search-console', 'dataforseo', 'organic-search'].includes(normalized))
984
+ return 'seo';
271
985
  if (['sentry', 'sentry-api', 'sentry-mcp', 'crashes', 'errors', 'crash-reporting'].includes(normalized))
272
986
  return 'sentry';
987
+ if (['coolify', 'coolify-api', 'deployment', 'deployments', 'hosting', 'infra', 'infrastructure'].includes(normalized))
988
+ return 'coolify';
273
989
  if (['asc', 'asc-cli', 'app-store-connect', 'appstoreconnect', 'app-store'].includes(normalized))
274
990
  return 'asc';
991
+ if (['stripe', 'stripe-billing', 'stripe-payments'].includes(normalized))
992
+ return 'stripe';
993
+ if (['lemonsqueezy', 'lemon-squeezy', 'lemon', 'ls'].includes(normalized))
994
+ return 'lemonsqueezy';
995
+ if (['adapty', 'adapty-paywalls', 'adapty-subscriptions'].includes(normalized))
996
+ return 'adapty';
997
+ if (['superwall', 'superwall-paywalls'].includes(normalized))
998
+ return 'superwall';
999
+ if (['google-play', 'google-play-console', 'play-console', 'play-store', 'android-store'].includes(normalized))
1000
+ return 'google-play';
1001
+ if (['datadog', 'datadog-rum', 'datadog-apm', 'datadog-logs'].includes(normalized))
1002
+ return 'datadog';
1003
+ if (['bugsnag', 'bugsnag-crashes'].includes(normalized))
1004
+ return 'bugsnag';
1005
+ if (['intercom', 'intercom-support'].includes(normalized))
1006
+ return 'intercom';
1007
+ if (['zendesk', 'zendesk-support'].includes(normalized))
1008
+ return 'zendesk';
1009
+ if (['apple-search-ads', 'apple-ads', 'asa', 'search-ads'].includes(normalized))
1010
+ return 'apple-search-ads';
1011
+ if (['google-ads', 'adwords'].includes(normalized))
1012
+ return 'google-ads';
1013
+ if (['meta-ads', 'facebook-ads', 'instagram-ads', 'fb-ads'].includes(normalized))
1014
+ return 'meta-ads';
1015
+ if (['tiktok-ads', 'tiktok-business', 'tiktok-business-api'].includes(normalized))
1016
+ return 'tiktok-ads';
1017
+ if (['vercel', 'vercel-deployments', 'vercel-hosting'].includes(normalized))
1018
+ return 'vercel';
1019
+ if (['cloudflare', 'cf', 'cloudflare-workers', 'cloudflare-pages'].includes(normalized))
1020
+ return 'cloudflare';
1021
+ if (['resend', 'resend-email'].includes(normalized))
1022
+ return 'resend';
1023
+ if (['customerio', 'customer-io', 'customer.io', 'cio'].includes(normalized))
1024
+ return 'customerio';
1025
+ if (['mailchimp', 'mailchimp-marketing'].includes(normalized))
1026
+ return 'mailchimp';
1027
+ if (['appfollow', 'app-follow'].includes(normalized))
1028
+ return 'appfollow';
1029
+ if (['apptweak', 'app-tweak'].includes(normalized))
1030
+ return 'apptweak';
1031
+ if (['linear', 'linear-issues', 'linear-planning'].includes(normalized))
1032
+ return 'linear';
1033
+ if (['postiz', 'postiz-api', 'social-publishing', 'social-scheduler'].includes(normalized))
1034
+ return 'postiz';
275
1035
  return null;
276
1036
  }
277
1037
  function parseConnectorList(value) {
@@ -297,13 +1057,27 @@ function isConnectorLocallyConfigured(key) {
297
1057
  return Boolean(process.env.GITHUB_TOKEN?.trim());
298
1058
  if (key === 'revenuecat')
299
1059
  return Boolean(process.env.REVENUECAT_API_KEY?.trim());
1060
+ if (key === 'paddle')
1061
+ return Boolean(process.env.PADDLE_API_KEY?.trim());
1062
+ if (key === 'seo') {
1063
+ return Boolean(process.env.GOOGLE_SEARCH_CONSOLE_ACCESS_TOKEN?.trim() ||
1064
+ process.env.GSC_ACCESS_TOKEN?.trim() ||
1065
+ process.env.GOOGLE_APPLICATION_CREDENTIALS?.trim() ||
1066
+ process.env.GSC_SERVICE_ACCOUNT_JSON?.trim());
1067
+ }
300
1068
  if (key === 'sentry')
301
1069
  return Boolean(process.env.SENTRY_AUTH_TOKEN?.trim());
1070
+ if (key === 'coolify')
1071
+ return Boolean(process.env.COOLIFY_API_TOKEN?.trim() && process.env.COOLIFY_BASE_URL?.trim());
302
1072
  if (key === 'asc') {
303
1073
  return Boolean(process.env.ASC_KEY_ID?.trim() &&
304
1074
  process.env.ASC_ISSUER_ID?.trim() &&
305
1075
  (process.env.ASC_PRIVATE_KEY_PATH?.trim() || process.env.ASC_PRIVATE_KEY?.trim()));
306
1076
  }
1077
+ const accountConnector = getAccountSignalConnectorDefinition(key);
1078
+ if (accountConnector) {
1079
+ return accountConnector.credentials.some((credential) => Boolean(process.env[credential.env]?.trim()));
1080
+ }
307
1081
  return false;
308
1082
  }
309
1083
  function getRequiredConnectorKeys() {
@@ -410,6 +1184,170 @@ async function askMenuChoice(rl, { title, subtitle = 'Use Up/Down to move, Enter
410
1184
  }
411
1185
  }
412
1186
  }
1187
+ async function askMultiChoice(rl, { title, subtitle = 'Use Up/Down to move, Space to toggle, Enter to continue.', options, defaultValues, requiredValues = [], minSelections = 1, renderHeader, }) {
1188
+ const required = new Set(requiredValues);
1189
+ const normalizeSelection = (values) => {
1190
+ const selected = new Set(values);
1191
+ requiredValues.forEach((value) => selected.add(value));
1192
+ return options.map((option) => option.value).filter((value) => selected.has(value));
1193
+ };
1194
+ if (!process.stdin.isTTY || !process.stdout.isTTY || !process.stdin.setRawMode) {
1195
+ process.stdout.write(`\n${title}\n`);
1196
+ options.forEach((option, index) => {
1197
+ const checked = defaultValues.includes(option.value) || required.has(option.value) ? 'x' : ' ';
1198
+ const requiredLabel = required.has(option.value) ? ' required' : '';
1199
+ process.stdout.write(` ${index + 1}) [${checked}] ${option.label}${requiredLabel}: ${option.detail}\n`);
1200
+ });
1201
+ const answer = await ask(rl, `Select one or more (comma-separated 1-${options.length})`, normalizeSelection(defaultValues).map((value) => String(options.findIndex((option) => option.value === value) + 1)).join(','));
1202
+ const selected = answer
1203
+ .split(',')
1204
+ .map((value) => Number.parseInt(value.trim(), 10) - 1)
1205
+ .filter((index) => options[index])
1206
+ .map((index) => options[index].value);
1207
+ const normalized = normalizeSelection(selected);
1208
+ return normalized.length >= minSelections ? normalized : normalizeSelection(defaultValues);
1209
+ }
1210
+ rl.pause();
1211
+ let completed = false;
1212
+ try {
1213
+ const selected = await askMultiChoiceByKeys({
1214
+ title,
1215
+ subtitle,
1216
+ options,
1217
+ defaultValues: normalizeSelection(defaultValues),
1218
+ requiredValues,
1219
+ minSelections,
1220
+ renderHeader,
1221
+ });
1222
+ completed = true;
1223
+ return selected;
1224
+ }
1225
+ finally {
1226
+ if (completed) {
1227
+ rl.resume();
1228
+ }
1229
+ else {
1230
+ process.stdin.pause();
1231
+ }
1232
+ }
1233
+ }
1234
+ async function askMultiChoiceByKeys({ title, subtitle, options, defaultValues, requiredValues, minSelections, renderHeader, }) {
1235
+ emitKeypressEvents(process.stdin);
1236
+ const wasRaw = process.stdin.isRaw;
1237
+ const wasPaused = process.stdin.isPaused();
1238
+ process.stdin.setRawMode(true);
1239
+ process.stdin.resume();
1240
+ const required = new Set(requiredValues);
1241
+ const selected = new Set(defaultValues);
1242
+ requiredValues.forEach((value) => selected.add(value));
1243
+ let cursorIndex = 0;
1244
+ let warning = '';
1245
+ return await new Promise((resolve, reject) => {
1246
+ const cleanup = () => {
1247
+ process.stdin.off('keypress', onKeypress);
1248
+ process.stdin.setRawMode(Boolean(wasRaw));
1249
+ if (wasPaused) {
1250
+ process.stdin.pause();
1251
+ }
1252
+ process.stdout.write(ANSI.showCursor);
1253
+ };
1254
+ const selectedValues = () => options.map((option) => option.value).filter((value) => selected.has(value));
1255
+ const render = () => {
1256
+ process.stdout.write('\x1b[2J\x1b[H');
1257
+ renderHeader?.();
1258
+ process.stdout.write(`\n${ANSI.bold}${title}${ANSI.reset}\n`);
1259
+ process.stdout.write(`${ANSI.dim}${subtitle}${ANSI.reset}\n\n`);
1260
+ if (warning) {
1261
+ process.stdout.write(`${ANSI.cyan}${warning}${ANSI.reset}\n\n`);
1262
+ }
1263
+ for (let index = 0; index < options.length; index += 1) {
1264
+ const option = options[index];
1265
+ const pointer = index === cursorIndex ? `${ANSI.cyan}>${ANSI.reset}` : ' ';
1266
+ const checkbox = selected.has(option.value) ? '[x]' : '[ ]';
1267
+ const requiredLabel = required.has(option.value) ? ` ${ANSI.dim}(required)${ANSI.reset}` : '';
1268
+ process.stdout.write(`${pointer} ${checkbox} ${index + 1}) ${ANSI.bold}${option.label}${ANSI.reset}${requiredLabel}\n`);
1269
+ writeWrapped(option.detail, ' ', ANSI.dim);
1270
+ }
1271
+ process.stdout.write(`\n${ANSI.dim}Esc/Q cancels. Space toggles, A toggles all optional items, Enter continues. Number keys 1-${options.length} toggle items.${ANSI.reset}\n`);
1272
+ };
1273
+ const cancel = () => {
1274
+ cleanup();
1275
+ process.stdout.write('\n');
1276
+ reject(new WizardAbortError('Setup cancelled.'));
1277
+ };
1278
+ const finish = () => {
1279
+ const values = selectedValues();
1280
+ if (values.length < minSelections) {
1281
+ warning = `Select at least ${minSelections} item${minSelections === 1 ? '' : 's'} to continue.`;
1282
+ render();
1283
+ return;
1284
+ }
1285
+ cleanup();
1286
+ process.stdout.write('\x1b[2J\x1b[H');
1287
+ resolve(values);
1288
+ };
1289
+ const toggleIndex = (index) => {
1290
+ const option = options[index];
1291
+ if (!option)
1292
+ return;
1293
+ warning = '';
1294
+ if (required.has(option.value)) {
1295
+ selected.add(option.value);
1296
+ warning = `${option.label} is required.`;
1297
+ return;
1298
+ }
1299
+ if (selected.has(option.value))
1300
+ selected.delete(option.value);
1301
+ else
1302
+ selected.add(option.value);
1303
+ requiredValues.forEach((value) => selected.add(value));
1304
+ };
1305
+ const onKeypress = (_text, key) => {
1306
+ if (key?.ctrl && key?.name === 'c') {
1307
+ cancel();
1308
+ return;
1309
+ }
1310
+ if (key?.name === 'escape' || key?.name === 'q') {
1311
+ cancel();
1312
+ return;
1313
+ }
1314
+ if (key?.name === 'up' || key?.name === 'k') {
1315
+ cursorIndex = (cursorIndex - 1 + options.length) % options.length;
1316
+ warning = '';
1317
+ }
1318
+ else if (key?.name === 'down' || key?.name === 'j') {
1319
+ cursorIndex = (cursorIndex + 1) % options.length;
1320
+ warning = '';
1321
+ }
1322
+ else if (key?.name === 'space') {
1323
+ toggleIndex(cursorIndex);
1324
+ }
1325
+ else if (String(_text || '').toLowerCase() === 'a') {
1326
+ const optional = options.filter((option) => !required.has(option.value));
1327
+ const allSelected = optional.every((option) => selected.has(option.value));
1328
+ optional.forEach((option) => {
1329
+ if (allSelected)
1330
+ selected.delete(option.value);
1331
+ else
1332
+ selected.add(option.value);
1333
+ });
1334
+ requiredValues.forEach((value) => selected.add(value));
1335
+ warning = '';
1336
+ }
1337
+ else if (key?.name === 'return' || key?.name === 'enter') {
1338
+ finish();
1339
+ return;
1340
+ }
1341
+ else if (/^[1-9]$/.test(String(_text || ''))) {
1342
+ toggleIndex(Number(_text) - 1);
1343
+ }
1344
+ render();
1345
+ };
1346
+ process.stdin.on('keypress', onKeypress);
1347
+ process.stdout.write(ANSI.hideCursor);
1348
+ render();
1349
+ });
1350
+ }
413
1351
  async function askMenuChoiceByKeys({ title, subtitle, options, defaultValue, renderHeader, }) {
414
1352
  emitKeypressEvents(process.stdin);
415
1353
  const wasRaw = process.stdin.isRaw;
@@ -492,10 +1430,19 @@ function normalizeConnectorProgressKey(key) {
492
1430
  return 'github';
493
1431
  if (normalized === 'revenuecat')
494
1432
  return 'revenuecat';
1433
+ if (normalized === 'paddle')
1434
+ return 'paddle';
1435
+ if (normalized === 'seo' || normalized === 'gsc' || normalized === 'google-search-console')
1436
+ return 'seo';
495
1437
  if (normalized === 'sentry')
496
1438
  return 'sentry';
1439
+ if (normalized === 'coolify')
1440
+ return 'coolify';
497
1441
  if (normalized === 'asc' || normalized === 'appstoreconnect' || normalized === 'app-store-connect')
498
1442
  return 'asc';
1443
+ const accountConnector = normalizeConnectorKey(normalized);
1444
+ if (accountConnector && accountConnector !== 'all')
1445
+ return accountConnector;
499
1446
  return null;
500
1447
  }
501
1448
  async function withConnectorHealthLoading(taskFactory) {
@@ -663,7 +1610,10 @@ async function getConnectorPickerHealth(configPath, onProgress = () => { }) {
663
1610
  analytics: connectors.analyticscli,
664
1611
  github: connectors.github,
665
1612
  revenuecat: connectors.revenuecat,
1613
+ paddle: connectors.paddle,
1614
+ seo: connectors.seo,
666
1615
  sentry: connectors.sentry,
1616
+ coolify: connectors.coolify,
667
1617
  asc: connectors.appStoreConnect,
668
1618
  };
669
1619
  return Object.fromEntries(CONNECTOR_KEYS.map((key) => [key, getConnectorHealth(key, healthByConnector)]));
@@ -1069,9 +2019,22 @@ function summarizeFailureFix(connector, blockers) {
1069
2019
  if (connector === 'revenuecat') {
1070
2020
  return 'Paste a RevenueCat v2 secret API key with read-only project permissions, then rerun setup.';
1071
2021
  }
2022
+ if (connector === 'paddle') {
2023
+ return 'Paste a Paddle API key with metrics.read permission for the live account, then rerun setup.';
2024
+ }
2025
+ if (connector === 'seo') {
2026
+ return 'Configure Search Console read access. Leave GSC_SITE_URL empty to scan all verified properties in the account, or set it only when you intentionally want one property.';
2027
+ }
2028
+ if (connector === 'coolify') {
2029
+ return 'Paste a Coolify base URL and read-only API token from Keys & Tokens / API tokens, then rerun setup.';
2030
+ }
1072
2031
  if (connector === 'asc') {
1073
2032
  return 'Rerun ASC setup and verify ASC credentials, key role access, and `asc apps list --output json`.';
1074
2033
  }
2034
+ if (isAccountSignalConnector(connector)) {
2035
+ const definition = getAccountSignalConnectorDefinition(connector);
2036
+ return `Paste ${definition?.credentials.map((credential) => credential.env).join(' / ') || connector} in the connector wizard. Keep setup account-wide; do not add project, app, product, paywall, or service IDs unless a later run explicitly narrows scope.`;
2037
+ }
1075
2038
  return blockers.find((blocker) => blocker.remediation)?.remediation || 'Fix the failing configuration and rerun setup.';
1076
2039
  }
1077
2040
  function connectorForBlocker(blocker) {
@@ -1197,10 +2160,22 @@ function connectorFromCheckName(name) {
1197
2160
  return 'github';
1198
2161
  if (value.includes('revenuecat') || value.includes('REVENUECAT'))
1199
2162
  return 'revenuecat';
2163
+ if (value.includes('paddle') || value.includes('PADDLE'))
2164
+ return 'paddle';
2165
+ if (value.includes('seo') || value.includes('GSC') || value.includes('GOOGLE_SEARCH_CONSOLE'))
2166
+ return 'seo';
1200
2167
  if (value.includes('sentry') || value.includes('SENTRY') || value.includes('GLITCHTIP'))
1201
2168
  return 'sentry';
2169
+ if (value.includes('coolify') || value.includes('COOLIFY'))
2170
+ return 'coolify';
1202
2171
  if (value.includes('asc') || value.includes('ASC_'))
1203
2172
  return 'asc';
2173
+ for (const key of ACCOUNT_SIGNAL_CONNECTOR_KEYS) {
2174
+ const definition = getAccountSignalConnectorDefinition(key);
2175
+ const envMatch = definition?.credentials.some((credential) => value.includes(credential.env));
2176
+ if (value.includes(key) || value.includes(key.toUpperCase()) || envMatch)
2177
+ return key;
2178
+ }
1204
2179
  return null;
1205
2180
  }
1206
2181
  function connectorTitle(key) {
@@ -1340,9 +2315,29 @@ function buildSetupTestProgressPlan(selected) {
1340
2315
  if (selectedSet.has('revenuecat')) {
1341
2316
  items.push({ key: 'revenuecat', label: 'RevenueCat', detail: 'waiting for API key auth + project read', status: 'pending' });
1342
2317
  }
2318
+ if (selectedSet.has('paddle')) {
2319
+ items.push({ key: 'paddle', label: 'Paddle', detail: 'waiting for metrics API auth + revenue read', status: 'pending' });
2320
+ }
2321
+ if (selectedSet.has('seo')) {
2322
+ items.push({ key: 'seo', label: 'SEO / GSC', detail: 'waiting for Search Console auth or CSV/DataForSEO config', status: 'pending' });
2323
+ }
2324
+ if (selectedSet.has('coolify')) {
2325
+ items.push({ key: 'coolify', label: 'Coolify', detail: 'waiting for API key auth + deployment/resource read', status: 'pending' });
2326
+ }
1343
2327
  if (selectedSet.has('github')) {
1344
2328
  items.push({ key: 'github', label: 'GitHub', detail: 'waiting for repo/token access check', status: 'pending' });
1345
2329
  }
2330
+ for (const key of ACCOUNT_SIGNAL_CONNECTOR_KEYS) {
2331
+ if (!selectedSet.has(key))
2332
+ continue;
2333
+ const definition = getAccountSignalConnectorDefinition(key);
2334
+ items.push({
2335
+ key,
2336
+ label: definition?.label || key,
2337
+ detail: 'waiting for account-wide credential presence and source wiring',
2338
+ status: 'pending',
2339
+ });
2340
+ }
1346
2341
  items.push({
1347
2342
  key: 'finalize',
1348
2343
  label: 'Finalizing result',
@@ -1405,18 +2400,6 @@ async function runImmediateConnectorHealthCheck({ rl, configPath, connector, sec
1405
2400
  const command = `${nodeRuntimeScriptCommand('openclaw-growth-start.mjs')} --config ${quote(configPath)} --setup-only --connectors ${quote(connector)} --only-connectors ${quote(connector)}`;
1406
2401
  let result = await runSetupCommandWithProgress(command, env, [connector], `Checking ${connectorLabel(connector)} immediately after setup...`);
1407
2402
  let payload = parseJsonFromStdout(result.stdout);
1408
- if (connector === 'asc') {
1409
- try {
1410
- const ascWebAuthChanged = await ensureAscWebAnalyticsAuth(rl, secrets);
1411
- if (ascWebAuthChanged) {
1412
- result = await runSetupCommandWithProgress(command, env, [connector], 'Retesting ASC after web analytics login...');
1413
- payload = parseJsonFromStdout(result.stdout);
1414
- }
1415
- }
1416
- catch (error) {
1417
- process.stdout.write(`ASC web analytics still needs attention: ${error instanceof Error ? error.message : String(error)}\n`);
1418
- }
1419
- }
1420
2403
  if (payloadHasConnectorFailures(payload, connector)) {
1421
2404
  process.stdout.write(`\n${connectorLabel(connector)} needs attention before continuing.\n`);
1422
2405
  printConciseSetupBlockers(payload, command, {
@@ -1784,13 +2767,13 @@ function getGrowthRunCommand(config, displayConfigPath) {
1784
2767
  if (config?.security?.connectorSecrets?.mode === 'isolated-runner' && config.security.connectorSecrets.runCommand) {
1785
2768
  return config.security.connectorSecrets.runCommand;
1786
2769
  }
1787
- return growthEngineerPackageCommand(`run --config ${quote(displayConfigPath)}`);
2770
+ return buildGrowthRunnerCommand(displayConfigPath, deriveStatePathFromConfigPath(displayConfigPath));
1788
2771
  }
1789
2772
  function getConnectorHealthCommand(config, displayConfigPath) {
1790
2773
  if (config?.security?.connectorSecrets?.mode === 'isolated-runner' && config.security.connectorSecrets.healthCommand) {
1791
2774
  return config.security.connectorSecrets.healthCommand;
1792
2775
  }
1793
- return growthEngineerPackageCommand(`run --config ${quote(displayConfigPath)}`);
2776
+ return buildGrowthRunnerCommand(displayConfigPath, deriveStatePathFromConfigPath(displayConfigPath));
1794
2777
  }
1795
2778
  async function maybePromptSecret(rl, label, envName) {
1796
2779
  const existing = process.env[envName]?.trim();
@@ -2013,6 +2996,8 @@ async function upsertSentryAccountsConfig(configPath, accounts) {
2013
2996
  : [];
2014
2997
  const merged = new Map();
2015
2998
  for (const account of existingAccounts) {
2999
+ if (isPlaceholderSentryAccount(account))
3000
+ continue;
2016
3001
  const id = String(account?.id || account?.key || account?.label || '').trim();
2017
3002
  if (id)
2018
3003
  merged.set(id, account);
@@ -2025,14 +3010,76 @@ async function upsertSentryAccountsConfig(configPath, accounts) {
2025
3010
  }
2026
3011
  config.sources = {
2027
3012
  ...(config.sources || {}),
2028
- sentry: {
2029
- ...(config.sources?.sentry || {}),
3013
+ sentry: {
3014
+ ...(config.sources?.sentry || {}),
3015
+ enabled: true,
3016
+ mode: 'command',
3017
+ command: normalizeWizardSourceCommand('sentry', config.sources?.sentry || {}, configPath),
3018
+ accounts: [...merged.values()],
3019
+ },
3020
+ };
3021
+ await writeJsonFile(configPath, config);
3022
+ return true;
3023
+ }
3024
+ function isPlaceholderSentryAccount(account) {
3025
+ const baseUrl = String(account?.baseUrl || account?.base_url || account?.url || '').trim().toLowerCase();
3026
+ const org = String(account?.org || account?.organization || '').trim().toLowerCase();
3027
+ const projects = Array.isArray(account?.projects)
3028
+ ? account.projects.map((project) => String(project || '').trim().toLowerCase())
3029
+ : [];
3030
+ return (org === 'owner-org' ||
3031
+ baseUrl.includes('example.com') ||
3032
+ projects.includes('ios-app') ||
3033
+ projects.includes('backend-api') ||
3034
+ projects.includes('web-app'));
3035
+ }
3036
+ async function verifySentryAccountsConfig(configPath, expectedAccounts) {
3037
+ if (!(await fileExists(configPath))) {
3038
+ return { ok: false, detail: `${configPath} does not exist` };
3039
+ }
3040
+ const config = await readJsonFile(configPath);
3041
+ const source = config?.sources?.sentry;
3042
+ if (!source || source.enabled !== true) {
3043
+ return { ok: false, detail: 'sources.sentry.enabled is not true' };
3044
+ }
3045
+ if (source.mode !== 'command') {
3046
+ return { ok: false, detail: 'sources.sentry.mode is not command' };
3047
+ }
3048
+ const configuredAccounts = Array.isArray(source.accounts) ? source.accounts : [];
3049
+ const realAccounts = configuredAccounts.filter((account) => !isPlaceholderSentryAccount(account));
3050
+ if (realAccounts.length === 0) {
3051
+ return { ok: false, detail: 'sources.sentry.accounts contains no non-placeholder account' };
3052
+ }
3053
+ const configuredIds = new Set(realAccounts.map((account) => String(account?.id || account?.key || '').trim()).filter(Boolean));
3054
+ const missingIds = expectedAccounts
3055
+ .map((account) => String(account?.id || '').trim())
3056
+ .filter((id) => id && !configuredIds.has(id));
3057
+ if (missingIds.length > 0) {
3058
+ return { ok: false, detail: `sources.sentry.accounts is missing configured account id(s): ${missingIds.join(', ')}` };
3059
+ }
3060
+ return { ok: true, detail: `${realAccounts.length} active Sentry-compatible account(s) configured` };
3061
+ }
3062
+ async function upsertCoolifyConfig(configPath, { baseUrl, tokenEnv = 'COOLIFY_API_TOKEN' }) {
3063
+ if (!(await fileExists(configPath)))
3064
+ return false;
3065
+ const coolifyCommand = `${getWizardDefaultSourceCommand('coolify')} --config ${quote(configPath)}`;
3066
+ const config = await readJsonFile(configPath);
3067
+ config.sources = {
3068
+ ...(config.sources || {}),
3069
+ coolify: {
3070
+ ...(config.sources?.coolify || {}),
2030
3071
  enabled: true,
2031
3072
  mode: 'command',
2032
- command: getDefaultSourceCommand('sentry'),
2033
- accounts: [...merged.values()],
3073
+ command: coolifyCommand,
3074
+ baseUrl,
3075
+ tokenEnv,
2034
3076
  },
2035
3077
  };
3078
+ config.secrets = {
3079
+ ...(config.secrets || {}),
3080
+ coolifyTokenEnv: tokenEnv,
3081
+ coolifyTokenRef: { source: 'env', provider: 'default', id: tokenEnv },
3082
+ };
2036
3083
  await writeJsonFile(configPath, config);
2037
3084
  return true;
2038
3085
  }
@@ -2212,90 +3259,6 @@ async function askAscPrivateKeyPath(rl) {
2212
3259
  process.stdout.write('The ASC private key path was not saved. Paste a valid path, or leave empty to skip.\n');
2213
3260
  }
2214
3261
  }
2215
- function isAscWebAuthAuthenticated(stdout) {
2216
- try {
2217
- const payload = JSON.parse(String(stdout || '{}'));
2218
- return payload?.authenticated === true;
2219
- }
2220
- catch {
2221
- return false;
2222
- }
2223
- }
2224
- function resolveAscWebAppleId() {
2225
- return (process.env.ASC_WEB_APPLE_ID?.trim() ||
2226
- process.env.ASC_APPLE_ID?.trim() ||
2227
- process.env.APPLE_ID?.trim() ||
2228
- '');
2229
- }
2230
- function ascWebAuthEnv() {
2231
- return {
2232
- ...process.env,
2233
- ASC_TIMEOUT: process.env.ASC_TIMEOUT || '90s',
2234
- ASC_TIMEOUT_SECONDS: process.env.ASC_TIMEOUT_SECONDS || '90',
2235
- };
2236
- }
2237
- async function ensureAscWebAnalyticsAuth(rl = null, secrets = {}) {
2238
- process.stdout.write('\nChecking ASC web analytics authentication...\n');
2239
- process.stdout.write('Still working: verifying whether the ASC web session is active.\n');
2240
- if (!(await commandExists('asc'))) {
2241
- throw new Error('The asc CLI is not installed yet. Install it with `openclaw start --connectors asc`, then rerun the connector wizard so it can run `asc web auth login`.');
2242
- }
2243
- const ascEnv = ascWebAuthEnv();
2244
- if (!process.env.ASC_TIMEOUT && !process.env.ASC_TIMEOUT_SECONDS) {
2245
- process.stdout.write('Using ASC_TIMEOUT=90s for ASC web auth because Apple web endpoints can be slow.\n');
2246
- }
2247
- const status = await runCommandCapture('asc web auth status --output json', { env: ascEnv });
2248
- if (status.ok && isAscWebAuthAuthenticated(status.stdout)) {
2249
- process.stdout.write('ASC web analytics authentication is active.\n');
2250
- return false;
2251
- }
2252
- let appleId = resolveAscWebAppleId();
2253
- if (!appleId && rl) {
2254
- appleId = (await ask(rl, 'Apple Account email for ASC web analytics login (ASC_WEB_APPLE_ID)', '')).trim();
2255
- if (appleId) {
2256
- secrets.ASC_WEB_APPLE_ID = appleId;
2257
- await saveSecretsImmediately({ ASC_WEB_APPLE_ID: appleId });
2258
- }
2259
- }
2260
- if (!appleId) {
2261
- throw new Error('ASC web analytics login needs an Apple Account email. Rerun the connector wizard and enter ASC_WEB_APPLE_ID.');
2262
- }
2263
- let attempts = 0;
2264
- while (true) {
2265
- attempts += 1;
2266
- process.stdout.write(`\nASC web login: ${appleId}\n`);
2267
- process.stdout.write('The next prompts are from asc. Enter the Apple Account password/2FA there.\n\n');
2268
- const loginCode = await runInteractiveProcess('asc', ['web', 'auth', 'login', '--apple-id', appleId], {
2269
- env: ascEnv,
2270
- rl,
2271
- });
2272
- if (loginCode === 0) {
2273
- break;
2274
- }
2275
- process.stdout.write('\nASC web login failed.\n');
2276
- process.stdout.write('Reason: asc/Apple rejected the Apple Account login. The .p8 API key is not used here.\n\n');
2277
- if (!rl || attempts >= 3) {
2278
- throw new Error('ASC web analytics login failed. Check the Apple Account email/password/2FA, then rerun the connector wizard.');
2279
- }
2280
- const retry = await askYesNo(rl, 'Retry ASC web analytics login now?', true);
2281
- if (!retry) {
2282
- throw new Error('ASC web analytics login was not completed. Rerun the connector wizard when the Apple Account login is ready.');
2283
- }
2284
- const nextAppleId = (await ask(rl, 'Apple Account email for ASC web analytics login (press Enter to keep)', appleId)).trim();
2285
- if (nextAppleId && nextAppleId !== appleId) {
2286
- appleId = nextAppleId;
2287
- secrets.ASC_WEB_APPLE_ID = appleId;
2288
- await saveSecretsImmediately({ ASC_WEB_APPLE_ID: appleId });
2289
- }
2290
- }
2291
- process.stdout.write('\nStill working: verifying the ASC web analytics session after login...\n');
2292
- const verify = await runCommandCapture('asc web auth status --output json', { env: ascEnv });
2293
- if (!verify.ok || !isAscWebAuthAuthenticated(verify.stdout)) {
2294
- throw new Error('ASC web analytics login did not verify. Run `asc web auth status --output json --pretty` to inspect the session, then rerun the connector wizard.');
2295
- }
2296
- process.stdout.write('ASC web analytics authentication verified.\n');
2297
- return true;
2298
- }
2299
3262
  function printSection(title, lines = []) {
2300
3263
  process.stdout.write(`\n${ANSI.bold}${title}${ANSI.reset}\n`);
2301
3264
  process.stdout.write(`${'-'.repeat(title.length)}\n`);
@@ -2393,6 +3356,121 @@ async function guideRevenueCatConnector(rl, secrets) {
2393
3356
  if (apiKey)
2394
3357
  secrets.REVENUECAT_API_KEY = apiKey;
2395
3358
  }
3359
+ async function guidePaddleConnector(rl, secrets) {
3360
+ printSection('Paddle Billing metrics', [
3361
+ 'Use this when OpenClaw should read web checkout, revenue, MRR, refunds, chargebacks, and active subscriber metrics.',
3362
+ ]);
3363
+ process.stdout.write('\nCreate or update a Paddle API key here:\n https://vendors.paddle.com/authentication\n\n');
3364
+ printBullets([
3365
+ 'Open Paddle > Developer Tools > Authentication.',
3366
+ 'Create a new API key for the live account when you want production revenue evidence.',
3367
+ 'Grant `metrics.read`. Keep write permissions off unless another workflow explicitly needs them.',
3368
+ 'Do not select or hard-code a single product in the wizard; the Growth Engineer should keep account-level metrics context.',
3369
+ 'Paste the key here so it is stored only in the local chmod 600 secrets file.',
3370
+ ]);
3371
+ const apiKey = await maybePromptSecret(rl, 'Paste PADDLE_API_KEY into this local terminal', 'PADDLE_API_KEY');
3372
+ if (apiKey)
3373
+ secrets.PADDLE_API_KEY = apiKey;
3374
+ }
3375
+ async function guideSeoConnector(rl, secrets) {
3376
+ printSection('SEO / Google Search Console / DataForSEO', [
3377
+ 'Use this when OpenClaw should read organic search demand, GSC clicks/impressions/CTR/position, and optional paid keyword ideas.',
3378
+ ]);
3379
+ process.stdout.write('\nGoogle Search Console:\n https://search.google.com/search-console\nGoogle Cloud service accounts:\n https://console.cloud.google.com/iam-admin/serviceaccounts\nDataForSEO API dashboard:\n https://app.dataforseo.com/api-dashboard\n\n');
3380
+ printBullets([
3381
+ 'Preferred: give the token/service account access to all Search Console properties you want analyzed.',
3382
+ 'Leave the property URL empty to let the exporter list and query all verified GSC properties in the account.',
3383
+ 'Enter a property URL only when you intentionally want to restrict analysis to one site.',
3384
+ 'For OAuth token mode, paste a read-only Search Console token with `webmasters.readonly` scope.',
3385
+ 'For service-account mode, add the service account email as a restricted/full user in Search Console, then set GOOGLE_APPLICATION_CREDENTIALS or GSC_SERVICE_ACCOUNT_JSON outside this wizard.',
3386
+ 'DataForSEO is optional and paid. The exporter refuses paid calls unless the source command includes --confirm-paid and a small --max-paid-requests cap.',
3387
+ 'CSV-only mode is also supported with --gsc-csv or --csv in sources.seo.command.',
3388
+ ]);
3389
+ const siteUrl = await ask(rl, 'Optional GSC property URL (empty = all verified properties)', process.env.GSC_SITE_URL || '');
3390
+ if (siteUrl.trim())
3391
+ secrets.GSC_SITE_URL = siteUrl.trim();
3392
+ const gscToken = await maybePromptSecret(rl, 'Paste GOOGLE_SEARCH_CONSOLE_ACCESS_TOKEN, or leave empty for service-account/all-sites/CSV mode', 'GOOGLE_SEARCH_CONSOLE_ACCESS_TOKEN');
3393
+ if (gscToken)
3394
+ secrets.GOOGLE_SEARCH_CONSOLE_ACCESS_TOKEN = gscToken;
3395
+ const useDataForSeo = await askYesNo(rl, 'Also store DataForSEO credentials for optional paid keyword research?', false);
3396
+ if (useDataForSeo) {
3397
+ const login = await maybePromptSecret(rl, 'Paste DATAFORSEO_LOGIN into this local terminal', 'DATAFORSEO_LOGIN');
3398
+ const password = await maybePromptSecret(rl, 'Paste DATAFORSEO_PASSWORD into this local terminal', 'DATAFORSEO_PASSWORD');
3399
+ if (login)
3400
+ secrets.DATAFORSEO_LOGIN = login;
3401
+ if (password)
3402
+ secrets.DATAFORSEO_PASSWORD = password;
3403
+ }
3404
+ }
3405
+ function buildAccountSignalExtraSourceConfig(key, existing = {}) {
3406
+ const definition = getAccountSignalConnectorDefinition(key);
3407
+ if (!definition)
3408
+ return existing;
3409
+ return {
3410
+ ...buildExtraSourceConfig(definition.service, {
3411
+ key: definition.key,
3412
+ label: definition.label,
3413
+ enabled: true,
3414
+ mode: 'file',
3415
+ secretEnv: definition.credentials[0]?.env || null,
3416
+ hint: definition.signalHint,
3417
+ }),
3418
+ ...existing,
3419
+ key: definition.key,
3420
+ label: definition.label,
3421
+ service: definition.service,
3422
+ enabled: true,
3423
+ mode: existing.mode || 'file',
3424
+ path: existing.path || getDefaultSourcePath(definition.key),
3425
+ secretEnv: existing.secretEnv || definition.credentials[0]?.env || null,
3426
+ accountWide: true,
3427
+ projectScope: 'discover_from_account',
3428
+ docsUrl: definition.docsUrl,
3429
+ signalKind: definition.sourceKind,
3430
+ experimental: Boolean(definition.experimental),
3431
+ hint: existing.hint || definition.signalHint,
3432
+ };
3433
+ }
3434
+ async function upsertAccountSignalConnectorConfig(configPath, key) {
3435
+ const definition = getAccountSignalConnectorDefinition(key);
3436
+ if (!definition)
3437
+ return false;
3438
+ const config = await loadEditableConfig(configPath);
3439
+ const sources = config.sources && typeof config.sources === 'object' ? config.sources : {};
3440
+ const extra = Array.isArray(sources.extra) ? sources.extra : [];
3441
+ const nextExtra = extra.filter((source) => String(source?.key || source?.service || '') !== definition.key);
3442
+ const existing = extra.find((source) => String(source?.key || source?.service || '') === definition.key) || {};
3443
+ nextExtra.push(buildAccountSignalExtraSourceConfig(key, existing));
3444
+ config.sources = {
3445
+ ...sources,
3446
+ extra: nextExtra,
3447
+ };
3448
+ await writeJsonFile(configPath, config);
3449
+ return true;
3450
+ }
3451
+ async function guideAccountSignalConnector(rl, secrets, key) {
3452
+ const definition = getAccountSignalConnectorDefinition(key);
3453
+ if (!definition)
3454
+ return;
3455
+ printSection(definition.label, [
3456
+ definition.summary,
3457
+ 'Setup is account-wide. Do not paste project IDs, app IDs, product IDs, package names, paywall IDs, service names, or tags here.',
3458
+ ]);
3459
+ process.stdout.write(`Docs: ${definition.docsUrl}\n\n`);
3460
+ printBullets(definition.steps);
3461
+ for (const credential of definition.credentials) {
3462
+ const defaultValue = credential.defaultValue ?? process.env[credential.env] ?? '';
3463
+ const value = credential.optional
3464
+ ? await maybePromptSecret(rl, credential.prompt, credential.env)
3465
+ : await maybePromptSecret(rl, credential.prompt, credential.env);
3466
+ const finalValue = value || defaultValue;
3467
+ if (finalValue)
3468
+ secrets[credential.env] = finalValue;
3469
+ else if (!credential.optional) {
3470
+ process.stdout.write(`${credential.env} was not saved. ${definition.label} setup remains pending; rerun this wizard when ready.\n`);
3471
+ }
3472
+ }
3473
+ }
2396
3474
  async function guideSentryConnector(rl, secrets) {
2397
3475
  printSection('Sentry / GlitchTip', [
2398
3476
  'Paste token, org, and base URL. Projects are discovered automatically.',
@@ -2497,19 +3575,54 @@ async function guideSentryConnector(rl, secrets) {
2497
3575
  }
2498
3576
  return accounts;
2499
3577
  }
3578
+ function normalizeCoolifyBaseUrl(value) {
3579
+ const raw = String(value || '').trim().replace(/\/+$/, '');
3580
+ if (!raw)
3581
+ return '';
3582
+ return /^https?:\/\//i.test(raw) ? raw : `https://${raw}`;
3583
+ }
3584
+ async function guideCoolifyConnector(rl, secrets) {
3585
+ printSection('Coolify deployment monitoring', [
3586
+ 'Use this when OpenClaw should read deployment, resource, server, and health-check signals from Coolify.',
3587
+ 'The token should be read-only. Do not use "*" or sensitive-token permissions for normal monitoring.',
3588
+ ]);
3589
+ const baseUrl = normalizeCoolifyBaseUrl(await ask(rl, 'Coolify base URL', process.env.COOLIFY_BASE_URL || 'https://coolify.wotaso.com'));
3590
+ const tokenUrl = baseUrl ? `${baseUrl}/security/api-tokens` : 'https://<your-coolify-host>/security/api-tokens';
3591
+ process.stdout.write(`\nToken page: ${tokenUrl}\n\n`);
3592
+ printBullets([
3593
+ 'Open the Coolify dashboard.',
3594
+ 'In the sidebar, go to "Keys & Tokens".',
3595
+ 'Open "API tokens".',
3596
+ 'Create a new API key/token with read-only permissions.',
3597
+ 'Copy the token once and paste it into this local terminal.',
3598
+ ]);
3599
+ const token = await maybePromptSecret(rl, 'Paste COOLIFY_API_TOKEN into this local terminal', 'COOLIFY_API_TOKEN');
3600
+ if (baseUrl)
3601
+ secrets.COOLIFY_BASE_URL = baseUrl;
3602
+ if (token)
3603
+ secrets.COOLIFY_API_TOKEN = token;
3604
+ return { baseUrl, tokenEnv: 'COOLIFY_API_TOKEN' };
3605
+ }
2500
3606
  async function guideAscConnector(rl, secrets) {
2501
3607
  printSection('App Store Connect CLI', [
2502
- 'Use this mainly for App Store analytics, plus builds, TestFlight, reviews, ratings, and store context.',
2503
- 'ASC web analytics also needs a website login; this wizard verifies it after helper setup.',
3608
+ 'Use this mainly for App Store analytics batch reports, plus builds, TestFlight, reviews, ratings, and store context.',
3609
+ 'The normal Growth Engineer path uses App Store Connect API-key reports. Experimental ASC web analytics is not part of setup.',
2504
3610
  ]);
2505
3611
  process.stdout.write('Create an App Store Connect API key here:\n https://appstoreconnect.apple.com/access/integrations/api\n\n');
2506
3612
  process.stdout.write('Roles to choose for this key:\n');
2507
3613
  printBullets([
2508
- 'Required: Sales, for App Analytics, Sales and Trends, downloads, revenue, and conversion context.',
3614
+ 'Required for first setup: Admin, because Apple only allows Admin keys to create the initial Analytics Report Request.',
3615
+ 'Required for steady-state report downloads after the request exists: Sales and Reports, Finance, or Admin.',
2509
3616
  'Recommended: Customer Support, for App Store ratings and review text.',
2510
3617
  'Recommended: Developer, for builds, TestFlight, and delivery status.',
2511
3618
  'Optional: App Manager, only if OpenClaw should also read or manage app metadata, pricing, or release settings.',
2512
- 'Avoid: Admin unless a one-off App Store Connect permission requires it.',
3619
+ 'Least privilege option: run setup once with Admin, then rotate Growth Engineer to a Sales and Reports key for ongoing analytics downloads.',
3620
+ ]);
3621
+ process.stdout.write('\nWhy Admin is requested during setup:\n');
3622
+ printBullets([
3623
+ 'Growth Engineer automatically creates an ongoing App Analytics report request when none exists.',
3624
+ 'Without that request, Apple will not generate Impressions, Product Page Views, App Units, Conversion Rate, and related report instances.',
3625
+ 'A non-Admin key can read existing reports, but creation fails with a forbidden response.',
2513
3626
  ]);
2514
3627
  process.stdout.write('\nAfter creating the key, copy these values into this wizard:\n');
2515
3628
  printBullets([
@@ -2517,6 +3630,7 @@ async function guideAscConnector(rl, secrets) {
2517
3630
  'Key ID from the API key row or from the downloaded file name: AuthKey_<KEY_ID>.p8.',
2518
3631
  'Download the .p8 file, open it, then paste the full file content into this terminal.',
2519
3632
  'If the .p8 is already on this host, leave the content prompt empty and paste the file path instead.',
3633
+ 'Vendor Number from App Store Connect Sales and Trends > Reports, needed for Sales and Trends/App Units reports.',
2520
3634
  ]);
2521
3635
  const keyId = await ask(rl, 'ASC_KEY_ID (leave empty to skip)', process.env.ASC_KEY_ID || '');
2522
3636
  const issuerId = await ask(rl, 'ASC_ISSUER_ID (leave empty to skip)', process.env.ASC_ISSUER_ID || '');
@@ -2524,10 +3638,6 @@ async function guideAscConnector(rl, secrets) {
2524
3638
  secrets.ASC_KEY_ID = keyId.trim();
2525
3639
  if (issuerId.trim())
2526
3640
  secrets.ASC_ISSUER_ID = issuerId.trim();
2527
- const appleId = await ask(rl, 'Apple Account email for ASC web analytics login (ASC_WEB_APPLE_ID, leave empty to skip)', resolveAscWebAppleId());
2528
- if (appleId.trim())
2529
- secrets.ASC_WEB_APPLE_ID = appleId.trim();
2530
- process.stdout.write('ASC web password and 2FA are not stored by this wizard; asc asks for them interactively during web login.\n');
2531
3641
  const privateKeyContent = await askAscPrivateKeyContent(rl);
2532
3642
  if (privateKeyContent) {
2533
3643
  const privateKeyPath = resolveAscPrivateKeyPath(keyId);
@@ -2542,6 +3652,9 @@ async function guideAscConnector(rl, secrets) {
2542
3652
  if (privateKeyPath.trim())
2543
3653
  secrets.ASC_PRIVATE_KEY_PATH = privateKeyPath.trim();
2544
3654
  }
3655
+ const vendorNumber = await ask(rl, 'ASC_VENDOR_NUMBER for Sales and Trends/App Units (leave empty to skip)', process.env.ASC_VENDOR_NUMBER || process.env.ASC_ANALYTICS_VENDOR_NUMBER || '');
3656
+ if (vendorNumber.trim())
3657
+ secrets.ASC_VENDOR_NUMBER = vendorNumber.trim();
2545
3658
  }
2546
3659
  async function shouldRunSelfUpdate(workspaceRoot, force) {
2547
3660
  if (force)
@@ -2647,6 +3760,7 @@ async function runConnectorSetupSteps({ rl, args, selected, healthByConnector, a
2647
3760
  process.stdout.write('\n');
2648
3761
  const secrets = {};
2649
3762
  let sentryAccounts = [];
3763
+ let coolifyConfig = null;
2650
3764
  if (selected.includes('analytics')) {
2651
3765
  let forceFreshAnalyticsToken = shouldForceFreshAnalyticsToken(healthByConnector);
2652
3766
  while (true) {
@@ -2691,6 +3805,34 @@ async function runConnectorSetupSteps({ rl, args, selected, healthByConnector, a
2691
3805
  break;
2692
3806
  }
2693
3807
  }
3808
+ if (selected.includes('paddle')) {
3809
+ while (true) {
3810
+ clearTerminal();
3811
+ await guidePaddleConnector(rl, secrets);
3812
+ const check = await runImmediateConnectorHealthCheck({
3813
+ rl,
3814
+ configPath: args.config,
3815
+ connector: 'paddle',
3816
+ secrets,
3817
+ });
3818
+ if (!check.retry)
3819
+ break;
3820
+ }
3821
+ }
3822
+ if (selected.includes('seo')) {
3823
+ while (true) {
3824
+ clearTerminal();
3825
+ await guideSeoConnector(rl, secrets);
3826
+ const check = await runImmediateConnectorHealthCheck({
3827
+ rl,
3828
+ configPath: args.config,
3829
+ connector: 'seo',
3830
+ secrets,
3831
+ });
3832
+ if (!check.retry)
3833
+ break;
3834
+ }
3835
+ }
2694
3836
  if (selected.includes('sentry')) {
2695
3837
  while (true) {
2696
3838
  clearTerminal();
@@ -2706,6 +3848,23 @@ async function runConnectorSetupSteps({ rl, args, selected, healthByConnector, a
2706
3848
  break;
2707
3849
  }
2708
3850
  }
3851
+ if (selected.includes('coolify')) {
3852
+ while (true) {
3853
+ clearTerminal();
3854
+ coolifyConfig = await guideCoolifyConnector(rl, secrets);
3855
+ if (coolifyConfig?.baseUrl) {
3856
+ await upsertCoolifyConfig(args.config, coolifyConfig);
3857
+ }
3858
+ const check = await runImmediateConnectorHealthCheck({
3859
+ rl,
3860
+ configPath: args.config,
3861
+ connector: 'coolify',
3862
+ secrets,
3863
+ });
3864
+ if (!check.retry)
3865
+ break;
3866
+ }
3867
+ }
2709
3868
  if (selected.includes('asc')) {
2710
3869
  while (true) {
2711
3870
  clearTerminal();
@@ -2720,6 +3879,21 @@ async function runConnectorSetupSteps({ rl, args, selected, healthByConnector, a
2720
3879
  break;
2721
3880
  }
2722
3881
  }
3882
+ for (const connector of selected.filter(isAccountSignalConnector)) {
3883
+ while (true) {
3884
+ clearTerminal();
3885
+ await guideAccountSignalConnector(rl, secrets, connector);
3886
+ await upsertAccountSignalConnectorConfig(args.config, connector);
3887
+ const check = await runImmediateConnectorHealthCheck({
3888
+ rl,
3889
+ configPath: args.config,
3890
+ connector,
3891
+ secrets,
3892
+ });
3893
+ if (!check.retry)
3894
+ break;
3895
+ }
3896
+ }
2723
3897
  const secretsFile = resolveSecretsFile();
2724
3898
  const wroteSecrets = Object.keys(secrets).length > 0;
2725
3899
  clearTerminal();
@@ -2731,30 +3905,48 @@ async function runConnectorSetupSteps({ rl, args, selected, healthByConnector, a
2731
3905
  process.stdout.write('\nNo new secrets were written.\n');
2732
3906
  }
2733
3907
  if (sentryAccounts.length > 0 && await upsertSentryAccountsConfig(args.config, sentryAccounts)) {
2734
- process.stdout.write(`Configured ${sentryAccounts.length} Sentry-compatible account(s) in ${args.config}.\n`);
3908
+ const readiness = await verifySentryAccountsConfig(args.config, sentryAccounts);
3909
+ if (readiness.ok) {
3910
+ process.stdout.write(`Configured ${sentryAccounts.length} Sentry-compatible account(s) in ${args.config}.\n`);
3911
+ }
3912
+ }
3913
+ if (coolifyConfig?.baseUrl && await upsertCoolifyConfig(args.config, coolifyConfig)) {
3914
+ process.stdout.write(`Configured Coolify monitoring for ${coolifyConfig.baseUrl} in ${args.config}.\n`);
2735
3915
  }
2736
3916
  const env = {
2737
3917
  ...process.env,
2738
3918
  ...secrets,
2739
3919
  };
2740
- const command = `${nodeRuntimeScriptCommand('openclaw-growth-start.mjs')} --config ${quote(args.config)} --setup-only --connectors ${quote(selected.join(','))}`;
3920
+ const command = `${nodeRuntimeScriptCommand('openclaw-growth-start.mjs')} --config ${quote(args.config)} --setup-only --connectors ${quote(selected.join(','))} --only-connectors ${quote(selected.join(','))}`;
2741
3921
  let setupResult = await runSetupCommandWithProgress(command, env, selected, 'Testing connector setup...');
2742
3922
  let setupPayload = parseJsonFromStdout(setupResult.stdout);
3923
+ const postSetupBlockers = [];
2743
3924
  if (sentryAccounts.length > 0 && await upsertSentryAccountsConfig(args.config, sentryAccounts)) {
2744
- process.stdout.write(`Sentry-compatible account config is up to date in ${args.config}.\n`);
2745
- }
2746
- if (selected.includes('asc')) {
2747
- try {
2748
- const ascWebAuthChanged = await ensureAscWebAnalyticsAuth(rl, secrets);
2749
- if (ascWebAuthChanged) {
2750
- setupResult = await runSetupCommandWithProgress(command, env, selected, 'Retesting connector setup after ASC web analytics login...');
2751
- setupPayload = parseJsonFromStdout(setupResult.stdout);
2752
- }
3925
+ const readiness = await verifySentryAccountsConfig(args.config, sentryAccounts);
3926
+ if (readiness.ok) {
3927
+ process.stdout.write(`Sentry-compatible account config is up to date in ${args.config}.\n`);
2753
3928
  }
2754
- catch (error) {
2755
- process.stdout.write(`ASC web analytics still needs attention: ${error instanceof Error ? error.message : String(error)}\n`);
3929
+ else {
3930
+ postSetupBlockers.push({
3931
+ check: 'connection:sentry',
3932
+ detail: readiness.detail,
3933
+ remediation: 'Rerun Sentry/GlitchTip setup so the active config persists sources.sentry.enabled=true and sources.sentry.accounts[].',
3934
+ });
2756
3935
  }
2757
3936
  }
3937
+ if (coolifyConfig?.baseUrl && await upsertCoolifyConfig(args.config, coolifyConfig)) {
3938
+ process.stdout.write(`Coolify config is up to date in ${args.config}.\n`);
3939
+ }
3940
+ if (postSetupBlockers.length > 0) {
3941
+ setupPayload = {
3942
+ ...(setupPayload || {}),
3943
+ ok: false,
3944
+ blockers: [...(Array.isArray(setupPayload?.blockers) ? setupPayload.blockers : []), ...postSetupBlockers],
3945
+ };
3946
+ printSetupFailure({ result: { ...setupResult, ok: false, code: setupResult.code ?? 1 }, payload: setupPayload, command });
3947
+ process.exitCode = 1;
3948
+ return false;
3949
+ }
2758
3950
  if (setupResult.ok && setupPayload?.ok !== false) {
2759
3951
  printSetupSuccess(setupPayload);
2760
3952
  if (wroteSecrets) {
@@ -2783,15 +3975,18 @@ async function runConnectorSetupWizard(args) {
2783
3975
  try {
2784
3976
  clearTerminal();
2785
3977
  printConnectorIntro();
3978
+ await migrateRuntimeSourceCommandsFile(args.config);
2786
3979
  const healthByConnector = await withConnectorHealthLoading((onProgress) => getConnectorPickerHealth(args.config, onProgress));
2787
3980
  const existingFixes = connectorKeysNeedingAttention(healthByConnector);
2788
3981
  const requestedConnectors = args.connectors ? parseConnectorList(args.connectors) : [];
2789
3982
  const chosenConnectors = requestedConnectors.length > 0
2790
- ? orderConnectors([...new Set([...requestedConnectors, ...existingFixes])])
3983
+ ? orderConnectors(requestedConnectors)
2791
3984
  : await askConnectorSelectionWithHealth(rl, healthByConnector, existingFixes);
2792
- const selected = withMissingRequiredAnalyticsConnector(chosenConnectors);
3985
+ const selected = requestedConnectors.length > 0
3986
+ ? orderConnectors(chosenConnectors)
3987
+ : withMissingRequiredAnalyticsConnector(chosenConnectors);
2793
3988
  if (selected.length === 0) {
2794
- throw new Error('No supported connectors selected. Use analytics, github, revenuecat, sentry, asc, or all.');
3989
+ throw new Error(`No supported connectors selected. Use ${CONNECTOR_KEYS.join(', ')}, or all.`);
2795
3990
  }
2796
3991
  await runConnectorSetupSteps({ rl, args, selected, healthByConnector });
2797
3992
  }
@@ -2832,12 +4027,32 @@ async function askYesNo(rl, label, defaultYes = true) {
2832
4027
  }
2833
4028
  }
2834
4029
  }
4030
+ function truncateTableCell(value, width) {
4031
+ const text = String(value || '').replace(/\s+/g, ' ').trim();
4032
+ if (text.length <= width)
4033
+ return text.padEnd(width, ' ');
4034
+ return `${text.slice(0, Math.max(0, width - 3))}...`.padEnd(width, ' ');
4035
+ }
4036
+ function printAsciiTable(headers, rows, widths) {
4037
+ const border = `+${widths.map((width) => '-'.repeat(width + 2)).join('+')}+`;
4038
+ const renderRow = (cells) => `| ${cells.map((cell, index) => truncateTableCell(cell, widths[index])).join(' | ')} |`;
4039
+ process.stdout.write(`${border}\n`);
4040
+ process.stdout.write(`${renderRow(headers)}\n`);
4041
+ process.stdout.write(`${border}\n`);
4042
+ for (const row of rows) {
4043
+ process.stdout.write(`${renderRow(row)}\n`);
4044
+ }
4045
+ process.stdout.write(`${border}\n`);
4046
+ }
2835
4047
  function printCadencePlan(cadences) {
2836
4048
  process.stdout.write('\nDefault growth cadence:\n');
2837
- for (const cadence of cadences) {
2838
- const critical = cadence.criticalOnly ? 'critical only' : 'full review';
2839
- process.stdout.write(`- ${cadence.title} (${critical}): ${cadence.objective}\n`);
2840
- }
4049
+ printAsciiTable(['Cadence', 'Every', 'Mode', 'Primary focus', 'What it decides'], cadences.map((cadence) => [
4050
+ cadence.key,
4051
+ cadence.intervalMinutes ? `${cadence.intervalMinutes}m` : `${cadence.intervalDays}d`,
4052
+ cadence.criticalOnly ? 'critical only' : 'full review',
4053
+ Array.isArray(cadence.focusAreas) ? cadence.focusAreas.slice(0, 4).join(', ') : '',
4054
+ cadence.objective,
4055
+ ]), [12, 7, 13, 30, 42]);
2841
4056
  process.stdout.write('\n');
2842
4057
  }
2843
4058
  async function askToolUsage(rl) {
@@ -2864,18 +4079,72 @@ async function askToolUsage(rl) {
2864
4079
  ],
2865
4080
  });
2866
4081
  }
2867
- async function askCadencePlan(rl) {
2868
- const cadences = DEFAULT_CADENCE_PLAN.map((cadence) => ({ ...cadence }));
4082
+ async function askSchedulePreset(rl) {
4083
+ return await askMenuChoice(rl, {
4084
+ title: 'Schedule preset',
4085
+ subtitle: 'Use Up/Down to move, Enter to continue, or press 1-3.',
4086
+ defaultValue: 'recommended',
4087
+ options: [
4088
+ {
4089
+ value: 'recommended',
4090
+ label: 'Recommended',
4091
+ detail: 'OpenClaw/Hermes wake every 30m; Sentry/GlitchTip/Coolify healthcheck runs every 90m; daily and larger reviews stay on cadence.',
4092
+ },
4093
+ {
4094
+ value: 'quiet',
4095
+ label: 'Quiet',
4096
+ detail: 'OpenClaw/Hermes wake hourly; healthcheck runs every 6h; deep reviews unchanged.',
4097
+ },
4098
+ {
4099
+ value: 'manual',
4100
+ label: 'Manual',
4101
+ detail: 'Enter runner, connector-health, cron, and cadence intervals yourself.',
4102
+ },
4103
+ ],
4104
+ });
4105
+ }
4106
+ async function askCadencePlan(rl, existingCadences = []) {
4107
+ const existingByKey = new Map((Array.isArray(existingCadences) ? existingCadences : [])
4108
+ .filter((cadence) => cadence?.key)
4109
+ .map((cadence) => [String(cadence.key), cadence]));
4110
+ const cadences = DEFAULT_CADENCE_PLAN.map((cadence) => ({
4111
+ ...cadence,
4112
+ ...(existingByKey.get(cadence.key) || {}),
4113
+ }));
2869
4114
  printCadencePlan(cadences);
2870
- const customize = await askYesNo(rl, 'Use this default cadence plan? Answer no to edit daily/weekly/monthly/3-month/6-month/1-year instructions.', true);
2871
- if (customize)
4115
+ const selectedCadences = await askMultiChoice(rl, {
4116
+ title: 'Scheduled review cadences',
4117
+ subtitle: 'Use Up/Down to move, Space to toggle cadences, A to toggle all, Enter to continue.',
4118
+ defaultValues: cadences.filter((cadence) => cadence.enabled !== false).map((cadence) => cadence.key),
4119
+ minSelections: 1,
4120
+ options: cadences.map((cadence) => ({
4121
+ value: cadence.key,
4122
+ label: cadence.title,
4123
+ detail: `${cadence.intervalMinutes ? `${cadence.intervalMinutes}m` : `${cadence.intervalDays}d`}, ${cadence.criticalOnly ? 'critical only' : 'full review'} - ${cadence.objective}`,
4124
+ })),
4125
+ });
4126
+ const selected = new Set(selectedCadences);
4127
+ cadences.forEach((cadence) => {
4128
+ cadence.enabled = selected.has(cadence.key);
4129
+ });
4130
+ const customize = await askYesNo(rl, 'Customize objectives, instructions, focus areas, or source priorities for enabled cadences?', false);
4131
+ if (!customize)
2872
4132
  return cadences;
2873
4133
  for (const cadence of cadences) {
2874
- process.stdout.write(`\n${cadence.title}\n`);
2875
- const enabled = await askYesNo(rl, `Enable ${cadence.key}?`, true);
2876
- cadence.enabled = enabled;
2877
- if (!enabled)
4134
+ if (cadence.enabled === false)
2878
4135
  continue;
4136
+ process.stdout.write(`\n${cadence.title}\n`);
4137
+ const intervalDefault = cadence.intervalMinutes ? `${cadence.intervalMinutes}m` : `${cadence.intervalDays || 1}d`;
4138
+ const intervalRaw = await ask(rl, `${cadence.key} interval (for example 90m, 1d, 7d)`, intervalDefault);
4139
+ const intervalMatch = String(intervalRaw || intervalDefault).trim().match(/^(\d+)\s*([md])$/i);
4140
+ if (intervalMatch?.[2]?.toLowerCase() === 'm') {
4141
+ cadence.intervalMinutes = Number.parseInt(intervalMatch[1], 10) || cadence.intervalMinutes || 90;
4142
+ delete cadence.intervalDays;
4143
+ }
4144
+ else if (intervalMatch?.[2]?.toLowerCase() === 'd') {
4145
+ cadence.intervalDays = Number.parseInt(intervalMatch[1], 10) || cadence.intervalDays || 1;
4146
+ delete cadence.intervalMinutes;
4147
+ }
2879
4148
  cadence.objective = await ask(rl, `${cadence.key} objective`, cadence.objective);
2880
4149
  cadence.instructions = await ask(rl, `${cadence.key} instructions`, cadence.instructions);
2881
4150
  const focusAreas = await ask(rl, `${cadence.key} focus areas (comma-separated)`, cadence.focusAreas.join(','));
@@ -2920,7 +4189,7 @@ function printWizardHeader() {
2920
4189
  process.stdout.write('OpenClaw Growth Engineer - Setup Wizard\n');
2921
4190
  process.stdout.write('This wizard can configure connector secrets. Normal config is written to config JSON; API keys stay in the local chmod 600 secrets file.\n\n');
2922
4191
  }
2923
- async function buildDefaultWizardConfig() {
4192
+ async function buildDefaultWizardConfig(configPath = null) {
2924
4193
  return {
2925
4194
  version: 7,
2926
4195
  generatedAt: new Date().toISOString(),
@@ -2939,14 +4208,40 @@ async function buildDefaultWizardConfig() {
2939
4208
  command: getWizardDefaultSourceCommand('analytics'),
2940
4209
  },
2941
4210
  revenuecat: {
2942
- enabled: false,
4211
+ enabled: true,
2943
4212
  mode: 'command',
2944
4213
  command: getWizardDefaultSourceCommand('revenuecat'),
2945
4214
  },
4215
+ paddle: {
4216
+ enabled: true,
4217
+ mode: 'command',
4218
+ command: getWizardDefaultSourceCommand('paddle'),
4219
+ environment: 'live',
4220
+ },
4221
+ seo: {
4222
+ enabled: true,
4223
+ mode: 'command',
4224
+ command: getWizardDefaultSourceCommand('seo'),
4225
+ siteUrl: process.env.GSC_SITE_URL || '',
4226
+ paidProvider: {
4227
+ dataforseo: {
4228
+ enabled: false,
4229
+ confirmPaid: false,
4230
+ maxPaidRequests: 1,
4231
+ },
4232
+ },
4233
+ },
2946
4234
  sentry: {
2947
4235
  enabled: true,
2948
4236
  mode: 'command',
2949
- command: getWizardDefaultSourceCommand('sentry'),
4237
+ command: normalizeWizardSourceCommand('sentry', {}, configPath),
4238
+ },
4239
+ coolify: {
4240
+ enabled: true,
4241
+ mode: 'command',
4242
+ command: normalizeWizardSourceCommand('coolify', {}, configPath),
4243
+ baseUrl: process.env.COOLIFY_BASE_URL || 'https://coolify.wotaso.com',
4244
+ tokenEnv: 'COOLIFY_API_TOKEN',
2950
4245
  },
2951
4246
  feedback: {
2952
4247
  enabled: true,
@@ -2956,7 +4251,7 @@ async function buildDefaultWizardConfig() {
2956
4251
  initialLookback: '30d',
2957
4252
  },
2958
4253
  extra: [
2959
- buildExtraSourceConfig('asc-cli', { enabled: false, mode: 'command', command: getWizardDefaultSourceCommand('asc') }),
4254
+ buildExtraSourceConfig('asc-cli', { enabled: true, mode: 'command', command: getWizardDefaultSourceCommand('asc') }),
2960
4255
  ],
2961
4256
  },
2962
4257
  schedule: {
@@ -2967,11 +4262,13 @@ async function buildDefaultWizardConfig() {
2967
4262
  cadences: DEFAULT_CADENCE_PLAN.map((cadence) => ({ ...cadence })),
2968
4263
  },
2969
4264
  actions: {
2970
- autoCreateIssues: false,
4265
+ autoCreateIssues: true,
2971
4266
  autoCreatePullRequests: false,
2972
4267
  autoCreateWhenGitHubWriteAccess: true,
2973
4268
  disableAutoCreateGitHubArtifacts: false,
2974
4269
  mode: 'issue',
4270
+ outputDestinations: ['openclaw_chat', 'github_issue'],
4271
+ productionErrorMode: 'issue',
2975
4272
  usageMode: 'production_autopilot',
2976
4273
  draftPullRequests: true,
2977
4274
  proposalBranchPrefix: 'openclaw/proposals',
@@ -2983,9 +4280,9 @@ async function buildDefaultWizardConfig() {
2983
4280
  jsonPath: '.openclaw/chat/latest.json',
2984
4281
  },
2985
4282
  github: {
2986
- enabled: false,
4283
+ enabled: true,
2987
4284
  mode: 'issue',
2988
- autoCreate: false,
4285
+ autoCreate: true,
2989
4286
  draftPullRequests: true,
2990
4287
  proposalBranchPrefix: 'openclaw/proposals',
2991
4288
  },
@@ -2999,13 +4296,19 @@ async function buildDefaultWizardConfig() {
2999
4296
  method: 'POST',
3000
4297
  headers: {},
3001
4298
  },
4299
+ command: {
4300
+ enabled: false,
4301
+ label: 'command',
4302
+ command: '',
4303
+ },
3002
4304
  discord: {
3003
4305
  enabled: false,
3004
- command: 'node scripts/discord-openclaw-bridge.mjs send --stdin',
4306
+ label: 'discord',
4307
+ command: '',
3005
4308
  },
3006
4309
  },
3007
4310
  charting: {
3008
- enabled: false,
4311
+ enabled: true,
3009
4312
  command: null,
3010
4313
  },
3011
4314
  notifications: {
@@ -3032,6 +4335,21 @@ async function buildDefaultWizardConfig() {
3032
4335
  ],
3033
4336
  },
3034
4337
  },
4338
+ automation: {
4339
+ openclawCron: {
4340
+ enabled: true,
4341
+ mode: 'main',
4342
+ schedule: '*/30 * * * *',
4343
+ timezone: process.env.TZ || 'UTC',
4344
+ name: 'OpenClaw Growth Engineer scheduler',
4345
+ delivery: {
4346
+ enabled: true,
4347
+ mode: 'announce',
4348
+ channel: 'last',
4349
+ to: '',
4350
+ },
4351
+ },
4352
+ },
3035
4353
  secrets: {
3036
4354
  githubTokenEnv: 'GITHUB_TOKEN',
3037
4355
  githubTokenRef: { source: 'env', provider: 'default', id: 'GITHUB_TOKEN' },
@@ -3039,12 +4357,22 @@ async function buildDefaultWizardConfig() {
3039
4357
  analyticsTokenRef: { source: 'env', provider: 'default', id: 'ANALYTICSCLI_ACCESS_TOKEN' },
3040
4358
  revenuecatTokenEnv: 'REVENUECAT_API_KEY',
3041
4359
  revenuecatTokenRef: { source: 'env', provider: 'default', id: 'REVENUECAT_API_KEY' },
4360
+ paddleTokenEnv: 'PADDLE_API_KEY',
4361
+ paddleTokenRef: { source: 'env', provider: 'default', id: 'PADDLE_API_KEY' },
4362
+ gscTokenEnv: 'GOOGLE_SEARCH_CONSOLE_ACCESS_TOKEN',
4363
+ gscTokenRef: { source: 'env', provider: 'default', id: 'GOOGLE_SEARCH_CONSOLE_ACCESS_TOKEN' },
4364
+ dataforseoLoginEnv: 'DATAFORSEO_LOGIN',
4365
+ dataforseoLoginRef: { source: 'env', provider: 'default', id: 'DATAFORSEO_LOGIN' },
4366
+ dataforseoPasswordEnv: 'DATAFORSEO_PASSWORD',
4367
+ dataforseoPasswordRef: { source: 'env', provider: 'default', id: 'DATAFORSEO_PASSWORD' },
3042
4368
  sentryTokenEnv: 'SENTRY_AUTH_TOKEN',
3043
4369
  sentryTokenRef: { source: 'env', provider: 'default', id: 'SENTRY_AUTH_TOKEN' },
4370
+ coolifyTokenEnv: 'COOLIFY_API_TOKEN',
4371
+ coolifyTokenRef: { source: 'env', provider: 'default', id: 'COOLIFY_API_TOKEN' },
3044
4372
  },
3045
4373
  };
3046
4374
  }
3047
- function buildRecommendedSourceConfig() {
4375
+ function buildRecommendedSourceConfig(configPath = null) {
3048
4376
  return {
3049
4377
  analytics: {
3050
4378
  enabled: true,
@@ -3052,14 +4380,40 @@ function buildRecommendedSourceConfig() {
3052
4380
  command: getWizardDefaultSourceCommand('analytics'),
3053
4381
  },
3054
4382
  revenuecat: {
3055
- enabled: false,
4383
+ enabled: true,
3056
4384
  mode: 'command',
3057
4385
  command: getWizardDefaultSourceCommand('revenuecat'),
3058
4386
  },
4387
+ paddle: {
4388
+ enabled: true,
4389
+ mode: 'command',
4390
+ command: getWizardDefaultSourceCommand('paddle'),
4391
+ environment: 'live',
4392
+ },
4393
+ seo: {
4394
+ enabled: true,
4395
+ mode: 'command',
4396
+ command: getWizardDefaultSourceCommand('seo'),
4397
+ siteUrl: process.env.GSC_SITE_URL || '',
4398
+ paidProvider: {
4399
+ dataforseo: {
4400
+ enabled: false,
4401
+ confirmPaid: false,
4402
+ maxPaidRequests: 1,
4403
+ },
4404
+ },
4405
+ },
3059
4406
  sentry: {
3060
4407
  enabled: true,
3061
4408
  mode: 'command',
3062
- command: getWizardDefaultSourceCommand('sentry'),
4409
+ command: normalizeWizardSourceCommand('sentry', {}, configPath),
4410
+ },
4411
+ coolify: {
4412
+ enabled: true,
4413
+ mode: 'command',
4414
+ command: normalizeWizardSourceCommand('coolify', {}, configPath),
4415
+ baseUrl: process.env.COOLIFY_BASE_URL || 'https://coolify.wotaso.com',
4416
+ tokenEnv: 'COOLIFY_API_TOKEN',
3063
4417
  },
3064
4418
  feedback: {
3065
4419
  enabled: true,
@@ -3069,7 +4423,7 @@ function buildRecommendedSourceConfig() {
3069
4423
  initialLookback: '30d',
3070
4424
  },
3071
4425
  extra: [
3072
- buildExtraSourceConfig('asc-cli', { enabled: false, mode: 'command', command: getWizardDefaultSourceCommand('asc') }),
4426
+ buildExtraSourceConfig('asc-cli', { enabled: true, mode: 'command', command: getWizardDefaultSourceCommand('asc') }),
3073
4427
  ],
3074
4428
  };
3075
4429
  }
@@ -3078,56 +4432,117 @@ function getInputChannelInitialSelection(config) {
3078
4432
  const extraSources = Array.isArray(sources.extra) ? sources.extra : [];
3079
4433
  const selected = new Set();
3080
4434
  const hasExplicitSources = Boolean(config?.sources);
4435
+ if (!hasExplicitSources)
4436
+ return orderConnectors([...CONNECTOR_KEYS]);
3081
4437
  if (!hasExplicitSources || sources.analytics?.enabled !== false)
3082
4438
  selected.add('analytics');
3083
4439
  if (sources.revenuecat?.enabled === true || isConnectorLocallyConfigured('revenuecat'))
3084
4440
  selected.add('revenuecat');
4441
+ if (sources.paddle?.enabled === true || isConnectorLocallyConfigured('paddle'))
4442
+ selected.add('paddle');
4443
+ if (sources.seo?.enabled === true || isConnectorLocallyConfigured('seo'))
4444
+ selected.add('seo');
3085
4445
  if (!hasExplicitSources || sources.sentry?.enabled !== false)
3086
4446
  selected.add('sentry');
4447
+ if (sources.coolify?.enabled === true || isConnectorLocallyConfigured('coolify'))
4448
+ selected.add('coolify');
3087
4449
  if (extraSources.some((source) => ['asc', 'asc-cli', 'app-store-connect', 'app_store_connect'].includes(String(source?.service || source?.key || '').toLowerCase()) &&
3088
4450
  source?.enabled !== false) ||
3089
4451
  isConnectorLocallyConfigured('asc')) {
3090
4452
  selected.add('asc');
3091
4453
  }
3092
- if (config?.deliveries?.github?.enabled ||
3093
- config?.actions?.autoCreateIssues ||
3094
- config?.actions?.autoCreatePullRequests ||
3095
- isConnectorLocallyConfigured('github')) {
3096
- selected.add('github');
4454
+ for (const key of ACCOUNT_SIGNAL_CONNECTOR_KEYS) {
4455
+ if (extraSources.some((source) => String(source?.key || source?.service || '').toLowerCase() === key && source?.enabled !== false) ||
4456
+ isConnectorLocallyConfigured(key)) {
4457
+ selected.add(key);
4458
+ }
3097
4459
  }
4460
+ selected.add('github');
4461
+ if (selected.size === 0)
4462
+ return orderConnectors([...CONNECTOR_KEYS]);
3098
4463
  return orderConnectors([...selected]);
3099
4464
  }
3100
- function buildSourceConfigFromInputChannels(selectedConnectors, existingSources = {}) {
4465
+ function buildSourceConfigFromInputChannels(selectedConnectors, existingSources = {}, configPath = null) {
3101
4466
  const selected = new Set(selectedConnectors);
3102
- const recommended = buildRecommendedSourceConfig();
3103
- const existingExtra = Array.isArray(existingSources.extra) ? existingSources.extra : [];
4467
+ const recommended = buildRecommendedSourceConfig(configPath);
4468
+ const migratedSources = migrateRuntimeSourceCommands({ sources: existingSources }, configPath).sources || {};
4469
+ const existingExtra = Array.isArray(migratedSources.extra) ? migratedSources.extra : [];
3104
4470
  const ascSource = existingExtra.find((source) => ['asc', 'asc-cli', 'app-store-connect', 'app_store_connect'].includes(String(source?.service || source?.key || '').toLowerCase()));
3105
- const nonAscExtra = existingExtra.filter((source) => source !== ascSource);
4471
+ const managedAccountKeys = new Set(ACCOUNT_SIGNAL_CONNECTOR_KEYS);
4472
+ const accountSourceByKey = new Map(existingExtra
4473
+ .filter((source) => managedAccountKeys.has(String(source?.key || source?.service || '').toLowerCase()))
4474
+ .map((source) => [String(source?.key || source?.service || '').toLowerCase(), source]));
4475
+ const nonAscExtra = existingExtra.filter((source) => {
4476
+ if (source === ascSource)
4477
+ return false;
4478
+ return !managedAccountKeys.has(String(source?.key || source?.service || '').toLowerCase());
4479
+ });
4480
+ const accountExtra = ACCOUNT_SIGNAL_CONNECTOR_KEYS.map((key) => buildAccountSignalExtraSourceConfig(key, accountSourceByKey.get(key) || { enabled: selected.has(key) })).map((source) => ({ ...source, enabled: selected.has(source.key) }));
3106
4481
  return {
3107
4482
  ...recommended,
3108
- ...existingSources,
4483
+ ...migratedSources,
3109
4484
  analytics: {
3110
4485
  ...recommended.analytics,
3111
- ...(existingSources.analytics || {}),
4486
+ ...(migratedSources.analytics || {}),
4487
+ command: normalizeWizardSourceCommand('analytics', {
4488
+ ...recommended.analytics,
4489
+ ...(migratedSources.analytics || {}),
4490
+ }, configPath),
3112
4491
  enabled: selected.has('analytics'),
3113
4492
  },
3114
4493
  revenuecat: {
3115
4494
  ...recommended.revenuecat,
3116
- ...(existingSources.revenuecat || {}),
4495
+ ...(migratedSources.revenuecat || {}),
4496
+ command: normalizeWizardSourceCommand('revenuecat', {
4497
+ ...recommended.revenuecat,
4498
+ ...(migratedSources.revenuecat || {}),
4499
+ }, configPath),
3117
4500
  enabled: selected.has('revenuecat'),
3118
4501
  },
4502
+ paddle: {
4503
+ ...recommended.paddle,
4504
+ ...(migratedSources.paddle || {}),
4505
+ command: normalizeWizardSourceCommand('paddle', {
4506
+ ...recommended.paddle,
4507
+ ...(migratedSources.paddle || {}),
4508
+ }, configPath),
4509
+ enabled: selected.has('paddle'),
4510
+ },
4511
+ seo: {
4512
+ ...recommended.seo,
4513
+ ...(migratedSources.seo || {}),
4514
+ command: normalizeWizardSourceCommand('seo', {
4515
+ ...recommended.seo,
4516
+ ...(migratedSources.seo || {}),
4517
+ }, configPath),
4518
+ enabled: selected.has('seo'),
4519
+ },
3119
4520
  sentry: {
3120
4521
  ...recommended.sentry,
3121
- ...(existingSources.sentry || {}),
4522
+ ...(migratedSources.sentry || {}),
4523
+ command: normalizeWizardSourceCommand('sentry', {
4524
+ ...recommended.sentry,
4525
+ ...(migratedSources.sentry || {}),
4526
+ }, configPath),
3122
4527
  enabled: selected.has('sentry'),
3123
4528
  },
4529
+ coolify: {
4530
+ ...recommended.coolify,
4531
+ ...(migratedSources.coolify || {}),
4532
+ command: normalizeWizardSourceCommand('coolify', {
4533
+ ...recommended.coolify,
4534
+ ...(migratedSources.coolify || {}),
4535
+ }, configPath),
4536
+ enabled: selected.has('coolify'),
4537
+ },
3124
4538
  feedback: {
3125
4539
  ...recommended.feedback,
3126
- ...(existingSources.feedback || {}),
4540
+ ...(migratedSources.feedback || {}),
3127
4541
  enabled: selected.has('analytics'),
3128
4542
  },
3129
4543
  extra: [
3130
4544
  ...nonAscExtra,
4545
+ ...accountExtra,
3131
4546
  {
3132
4547
  ...buildExtraSourceConfig('asc-cli', {
3133
4548
  enabled: selected.has('asc'),
@@ -3135,6 +4550,14 @@ function buildSourceConfigFromInputChannels(selectedConnectors, existingSources
3135
4550
  command: getWizardDefaultSourceCommand('asc'),
3136
4551
  }),
3137
4552
  ...(ascSource || {}),
4553
+ command: normalizeWizardSourceCommand('asc', {
4554
+ ...buildExtraSourceConfig('asc-cli', {
4555
+ enabled: selected.has('asc'),
4556
+ mode: 'command',
4557
+ command: getWizardDefaultSourceCommand('asc'),
4558
+ }),
4559
+ ...(ascSource || {}),
4560
+ }, configPath),
3138
4561
  enabled: selected.has('asc'),
3139
4562
  },
3140
4563
  ],
@@ -3143,8 +4566,8 @@ function buildSourceConfigFromInputChannels(selectedConnectors, existingSources
3143
4566
  async function loadEditableConfig(configPath) {
3144
4567
  const existing = await readJsonIfPresent(configPath).catch(() => null);
3145
4568
  if (existing && typeof existing === 'object')
3146
- return existing;
3147
- return await buildDefaultWizardConfig();
4569
+ return migrateRuntimeSourceCommands(existing, configPath);
4570
+ return await buildDefaultWizardConfig(configPath);
3148
4571
  }
3149
4572
  function mergeNotificationChannels(baseChannels, extraChannels) {
3150
4573
  const channels = [];
@@ -3179,9 +4602,9 @@ async function askNotificationChannels(rl, config) {
3179
4602
  const urlEnv = await ask(rl, 'Webhook URL env var', config?.deliveries?.webhook?.urlEnv || 'OPENCLAW_WEBHOOK_URL');
3180
4603
  channels.push({ type: 'webhook', enabled: true, urlEnv, method: 'POST', headers: {} });
3181
4604
  }
3182
- const commandDefault = Boolean(config?.deliveries?.discord?.enabled);
4605
+ const commandDefault = Boolean(config?.deliveries?.command?.enabled || config?.deliveries?.discord?.enabled);
3183
4606
  if (await askYesNo(rl, 'Send summaries and connector-health alerts through a local command channel?', commandDefault)) {
3184
- const command = await ask(rl, 'Command that receives the message on stdin', config?.deliveries?.discord?.command || 'node scripts/discord-openclaw-bridge.mjs send --stdin');
4607
+ const command = await ask(rl, 'Command that receives the message on stdin', config?.deliveries?.command?.command || config?.deliveries?.discord?.command || '');
3185
4608
  channels.push({ type: 'command', enabled: true, label: 'command', command });
3186
4609
  }
3187
4610
  return channels;
@@ -3192,11 +4615,25 @@ async function askOutputConfig(rl, config) {
3192
4615
  'GitHub issues or draft PRs are optional and only run when a token plus an inferred repo are available.',
3193
4616
  ]);
3194
4617
  const currentMode = config?.actions?.mode || config?.deliveries?.github?.mode || 'issue';
3195
- const currentAutoCreate = Boolean(config?.actions?.autoCreateIssues || config?.actions?.autoCreatePullRequests || config?.deliveries?.github?.autoCreate);
3196
- const outputChoice = await askMenuChoice(rl, {
3197
- title: 'Output mode',
3198
- subtitle: 'Use Up/Down to move, Enter to continue, or press 1-3.',
3199
- defaultValue: currentAutoCreate ? (currentMode === 'pull_request' ? 'pull_request' : 'issue') : 'chat',
4618
+ const configuredDestinations = Array.isArray(config?.actions?.outputDestinations)
4619
+ ? config.actions.outputDestinations
4620
+ : [];
4621
+ const currentAutoCreateIssue = Boolean(config?.actions?.autoCreateIssues ||
4622
+ configuredDestinations.includes('github_issue') ||
4623
+ (config?.deliveries?.github?.autoCreate && currentMode !== 'pull_request'));
4624
+ const currentAutoCreatePullRequest = Boolean(config?.actions?.autoCreatePullRequests ||
4625
+ configuredDestinations.includes('github_pull_request') ||
4626
+ (config?.deliveries?.github?.autoCreate && currentMode === 'pull_request'));
4627
+ const outputChoices = await askMultiChoice(rl, {
4628
+ title: 'Output destinations',
4629
+ subtitle: 'Use Up/Down to move, Space to toggle outputs, A to toggle all optional outputs, Enter to continue.',
4630
+ defaultValues: [
4631
+ 'chat',
4632
+ ...(currentAutoCreateIssue ? ['issue'] : []),
4633
+ ...(currentAutoCreatePullRequest ? ['pull_request'] : []),
4634
+ ],
4635
+ requiredValues: ['chat'],
4636
+ minSelections: 1,
3200
4637
  options: [
3201
4638
  {
3202
4639
  value: 'chat',
@@ -3215,9 +4652,35 @@ async function askOutputConfig(rl, config) {
3215
4652
  },
3216
4653
  ],
3217
4654
  });
3218
- const summaryOnly = outputChoice === 'chat';
3219
- const mode = outputChoice === 'pull_request' ? 'pull_request' : 'issue';
3220
- const autoCreate = !summaryOnly;
4655
+ const wantsIssue = outputChoices.includes('issue');
4656
+ const wantsPullRequest = outputChoices.includes('pull_request');
4657
+ const productionErrorMode = await askMenuChoice(rl, {
4658
+ title: 'Production error handling',
4659
+ subtitle: 'What should happen when the 90-minute healthcheck confirms a production Sentry/GlitchTip/Coolify issue?',
4660
+ defaultValue: config?.actions?.productionErrorMode || (wantsPullRequest ? 'pull_request' : wantsIssue ? 'issue' : 'alert'),
4661
+ options: [
4662
+ {
4663
+ value: 'alert',
4664
+ label: 'Alert only',
4665
+ detail: 'Send the short alert/handoff; do not auto-create GitHub artifacts for production errors.',
4666
+ },
4667
+ {
4668
+ value: 'issue',
4669
+ label: 'GitHub issue',
4670
+ detail: 'Create a GitHub issue with the production evidence and suggested investigation when access allows it.',
4671
+ },
4672
+ {
4673
+ value: 'pull_request',
4674
+ label: 'Draft PR',
4675
+ detail: 'Create a draft PR proposal for implementation-ready production fixes when access allows it.',
4676
+ },
4677
+ ],
4678
+ });
4679
+ const effectiveWantsIssue = wantsIssue || productionErrorMode === 'issue';
4680
+ const effectiveWantsPullRequest = wantsPullRequest || productionErrorMode === 'pull_request';
4681
+ const summaryOnly = !effectiveWantsIssue && !effectiveWantsPullRequest;
4682
+ const mode = effectiveWantsPullRequest ? 'pull_request' : 'issue';
4683
+ const autoCreate = effectiveWantsIssue || effectiveWantsPullRequest;
3221
4684
  if (!summaryOnly) {
3222
4685
  process.stdout.write('GitHub repo scope is not pinned by the wizard; OpenClaw/Hermes will infer it from OPENCLAW_GITHUB_REPO, the local git remote, or runtime context when creating issues/PRs.\n');
3223
4686
  }
@@ -3234,8 +4697,14 @@ async function askOutputConfig(rl, config) {
3234
4697
  config.actions = {
3235
4698
  ...(config.actions || {}),
3236
4699
  mode,
3237
- autoCreateIssues: mode === 'issue' && autoCreate,
3238
- autoCreatePullRequests: mode === 'pull_request' && autoCreate,
4700
+ outputDestinations: [
4701
+ 'openclaw_chat',
4702
+ ...(effectiveWantsIssue ? ['github_issue'] : []),
4703
+ ...(effectiveWantsPullRequest ? ['github_pull_request'] : []),
4704
+ ],
4705
+ productionErrorMode,
4706
+ autoCreateIssues: effectiveWantsIssue,
4707
+ autoCreatePullRequests: effectiveWantsPullRequest,
3239
4708
  autoCreateWhenGitHubWriteAccess: config.actions?.autoCreateWhenGitHubWriteAccess !== false,
3240
4709
  disableAutoCreateGitHubArtifacts: config.actions?.disableAutoCreateGitHubArtifacts === true,
3241
4710
  draftPullRequests: true,
@@ -3253,6 +4722,10 @@ async function askOutputConfig(rl, config) {
3253
4722
  ...(config.deliveries?.github || {}),
3254
4723
  enabled: !summaryOnly,
3255
4724
  mode,
4725
+ modes: [
4726
+ ...(effectiveWantsIssue ? ['issue'] : []),
4727
+ ...(effectiveWantsPullRequest ? ['pull_request'] : []),
4728
+ ],
3256
4729
  autoCreate,
3257
4730
  draftPullRequests: true,
3258
4731
  proposalBranchPrefix: config?.actions?.proposalBranchPrefix || 'openclaw/proposals',
@@ -3269,10 +4742,17 @@ async function askOutputConfig(rl, config) {
3269
4742
  method: 'POST',
3270
4743
  headers: config.deliveries?.webhook?.headers || {},
3271
4744
  },
4745
+ command: {
4746
+ ...(config.deliveries?.command || {}),
4747
+ enabled: channels.some((channel) => channel.type === 'command'),
4748
+ label: channels.find((channel) => channel.type === 'command')?.label || config.deliveries?.command?.label || 'command',
4749
+ command: channels.find((channel) => channel.type === 'command')?.command || config.deliveries?.command?.command || '',
4750
+ },
3272
4751
  discord: {
3273
4752
  ...(config.deliveries?.discord || {}),
3274
- enabled: channels.some((channel) => channel.type === 'command'),
3275
- command: channels.find((channel) => channel.type === 'command')?.command || config.deliveries?.discord?.command || 'node scripts/discord-openclaw-bridge.mjs send --stdin',
4753
+ enabled: Boolean(config.deliveries?.discord?.enabled),
4754
+ label: config.deliveries?.discord?.label || 'discord',
4755
+ command: config.deliveries?.discord?.command || '',
3276
4756
  },
3277
4757
  };
3278
4758
  config.notifications = {
@@ -3314,7 +4794,7 @@ async function askGitHubArtifactDetails(rl, config) {
3314
4794
  if (!customize) {
3315
4795
  config.charting = {
3316
4796
  ...(config.charting || {}),
3317
- enabled: config.charting?.enabled === true,
4797
+ enabled: config.charting?.enabled !== false,
3318
4798
  command: config.charting?.command || null,
3319
4799
  };
3320
4800
  return config;
@@ -3340,12 +4820,37 @@ async function askIntervalConfig(rl, config) {
3340
4820
  printSection('Schedule and analysis depth', [
3341
4821
  'The runner wakes up often, but larger reviews only run on their daily/weekly/monthly cadence.',
3342
4822
  'Connector health checks are separate and default to every 6 hours.',
4823
+ 'On OpenClaw or Hermes VPS installs, the agent scheduler should wake Growth Engineer; heartbeat stays as a fallback checklist.',
3343
4824
  ]);
3344
4825
  const currentSchedule = config?.schedule || {};
4826
+ const currentAutomation = getAutomationConfig(config);
3345
4827
  const usageMode = await askToolUsage(rl);
3346
- const intervalMinutes = Number.parseInt(await ask(rl, 'Growth runner wake-up interval in minutes', String(currentSchedule.intervalMinutes || DEFAULT_GROWTH_INTERVAL_MINUTES)), 10) || DEFAULT_GROWTH_INTERVAL_MINUTES;
3347
- const connectorHealthCheckIntervalMinutes = Number.parseInt(await ask(rl, 'Connector health check interval in minutes', String(currentSchedule.connectorHealthCheckIntervalMinutes || DEFAULT_CONNECTOR_HEALTH_INTERVAL_MINUTES)), 10) || DEFAULT_CONNECTOR_HEALTH_INTERVAL_MINUTES;
3348
- const cadences = await askCadencePlan(rl);
4828
+ const schedulePreset = await askSchedulePreset(rl);
4829
+ const recommendedRunnerInterval = schedulePreset === 'quiet' ? 360 : 90;
4830
+ const recommendedConnectorHealthInterval = schedulePreset === 'quiet' ? 360 : DEFAULT_CONNECTOR_HEALTH_INTERVAL_MINUTES;
4831
+ const recommendedOpenClawCronSchedule = schedulePreset === 'quiet' ? '0 * * * *' : '*/30 * * * *';
4832
+ const intervalMinutes = schedulePreset === 'manual'
4833
+ ? Number.parseInt(await ask(rl, 'Growth runner fallback loop interval in minutes', String(currentSchedule.intervalMinutes || recommendedRunnerInterval)), 10) || recommendedRunnerInterval
4834
+ : recommendedRunnerInterval;
4835
+ const connectorHealthCheckIntervalMinutes = schedulePreset === 'manual'
4836
+ ? Number.parseInt(await ask(rl, 'Connector credentials health check interval in minutes', String(currentSchedule.connectorHealthCheckIntervalMinutes || recommendedConnectorHealthInterval)), 10) || recommendedConnectorHealthInterval
4837
+ : recommendedConnectorHealthInterval;
4838
+ const cadences = await askCadencePlan(rl, currentSchedule.cadences);
4839
+ const enableOpenClawCron = await askYesNo(rl, 'Install an OpenClaw Gateway cron job to wake Growth Engineer on this VPS?', currentAutomation.openclawCron.enabled !== false);
4840
+ const openclawCronSchedule = enableOpenClawCron
4841
+ ? schedulePreset === 'manual'
4842
+ ? await ask(rl, 'OpenClaw cron expression for scheduler wakeups', currentAutomation.openclawCron.schedule || recommendedOpenClawCronSchedule)
4843
+ : recommendedOpenClawCronSchedule
4844
+ : currentAutomation.openclawCron.schedule;
4845
+ const openclawCronTimezone = enableOpenClawCron
4846
+ ? await ask(rl, 'OpenClaw cron timezone', currentAutomation.openclawCron.timezone || process.env.TZ || 'UTC')
4847
+ : currentAutomation.openclawCron.timezone;
4848
+ const enableHermesCron = await askYesNo(rl, 'Install a Hermes cron job when Hermes is available on this host?', currentAutomation.hermesCron.enabled !== false);
4849
+ const hermesCronSchedule = enableHermesCron
4850
+ ? schedulePreset === 'manual'
4851
+ ? await ask(rl, 'Hermes cron expression for scheduler wakeups', currentAutomation.hermesCron.schedule || openclawCronSchedule || recommendedOpenClawCronSchedule)
4852
+ : openclawCronSchedule || recommendedOpenClawCronSchedule
4853
+ : currentAutomation.hermesCron.schedule;
3349
4854
  config.schedule = {
3350
4855
  ...currentSchedule,
3351
4856
  intervalMinutes,
@@ -3358,6 +4863,32 @@ async function askIntervalConfig(rl, config) {
3358
4863
  ...(config.actions || {}),
3359
4864
  usageMode,
3360
4865
  };
4866
+ config.automation = {
4867
+ ...(config.automation || {}),
4868
+ openclawCron: {
4869
+ ...(currentAutomation.openclawCron || {}),
4870
+ enabled: enableOpenClawCron,
4871
+ mode: 'main',
4872
+ schedule: openclawCronSchedule || '*/30 * * * *',
4873
+ timezone: openclawCronTimezone || 'UTC',
4874
+ name: currentAutomation.openclawCron.name || 'OpenClaw Growth Engineer scheduler',
4875
+ delivery: {
4876
+ ...(currentAutomation.openclawCron.delivery || {}),
4877
+ enabled: currentAutomation.openclawCron.delivery?.enabled !== false,
4878
+ mode: currentAutomation.openclawCron.delivery?.mode || 'announce',
4879
+ channel: currentAutomation.openclawCron.delivery?.channel || 'last',
4880
+ to: currentAutomation.openclawCron.delivery?.to || '',
4881
+ },
4882
+ },
4883
+ hermesCron: {
4884
+ ...(currentAutomation.hermesCron || {}),
4885
+ enabled: enableHermesCron,
4886
+ schedule: hermesCronSchedule || '*/30 * * * *',
4887
+ name: currentAutomation.hermesCron.name || 'Hermes Growth Engineer scheduler',
4888
+ skill: currentAutomation.hermesCron.skill || 'growth-engineer',
4889
+ deliver: currentAutomation.hermesCron.deliver || 'local',
4890
+ },
4891
+ };
3361
4892
  return config;
3362
4893
  }
3363
4894
  async function askOutputsAndIntervalsConfig(rl, config) {
@@ -3366,6 +4897,9 @@ async function askOutputsAndIntervalsConfig(rl, config) {
3366
4897
  return await askGitHubArtifactDetails(rl, withOutput);
3367
4898
  }
3368
4899
  async function askInputSourceConfig(rl, config, configPath) {
4900
+ config = migrateRuntimeSourceCommands(config, configPath);
4901
+ await ensureDirForFile(configPath);
4902
+ await writeJsonFile(configPath, config);
3369
4903
  const healthByConnector = await withConnectorHealthLoading((onProgress) => getConnectorPickerHealth(configPath, onProgress));
3370
4904
  const selected = await askConnectorSelectionWithHealth(rl, healthByConnector, getInputChannelInitialSelection(config), {
3371
4905
  introTitle: 'Input channels',
@@ -3374,17 +4908,20 @@ async function askInputSourceConfig(rl, config, configPath) {
3374
4908
  helpText: 'Use Up/Down to move, Space to toggle channels, A to toggle all channels, Enter to continue.',
3375
4909
  mode: 'input',
3376
4910
  });
3377
- config.sources = buildSourceConfigFromInputChannels(selected, config.sources || {});
4911
+ config.sources = buildSourceConfigFromInputChannels(selected, config.sources || {}, configPath);
3378
4912
  return { config, selected, healthByConnector };
3379
4913
  }
3380
4914
  async function writeOpenClawJobManifest(configPath, config) {
3381
4915
  const manifestPath = path.resolve('.openclaw/jobs/openclaw-growth-engineer.json');
3382
4916
  const displayConfigPath = path.relative(process.cwd(), configPath) || configPath;
4917
+ const statePath = deriveStatePathFromConfigPath(displayConfigPath);
4918
+ const proofPath = deriveSchedulerProofPathFromStatePath(statePath);
3383
4919
  const intervalMinutes = Math.max(1, Number(config?.schedule?.intervalMinutes || DEFAULT_GROWTH_INTERVAL_MINUTES));
3384
4920
  const connectorHealthCheckIntervalMinutes = Math.max(1, Number(config?.schedule?.connectorHealthCheckIntervalMinutes || DEFAULT_CONNECTOR_HEALTH_INTERVAL_MINUTES));
3385
4921
  const actionMode = config?.actions?.mode || config?.deliveries?.github?.mode || 'issue';
3386
4922
  const growthRunCommand = getGrowthRunCommand(config, displayConfigPath);
3387
4923
  const connectorHealthCommand = getConnectorHealthCommand(config, displayConfigPath);
4924
+ const automation = getAutomationConfig(config);
3388
4925
  const manifest = {
3389
4926
  version: 1,
3390
4927
  generatedAt: new Date().toISOString(),
@@ -3395,12 +4932,27 @@ async function writeOpenClawJobManifest(configPath, config) {
3395
4932
  openClawCanEditOutputDelivery: true,
3396
4933
  openClawCanEditConnectors: true,
3397
4934
  openClawCanEditConnectorSecrets: false,
3398
- connectorChanges: 'OpenClaw may read and modify non-secret connector config such as enabled flags, source commands, project/app mappings, and source priorities. Use `node scripts/openclaw-growth-wizard.mjs --connectors` for API keys or other connector secrets; never write secret values into config files, manifests, issues, PRs, or chat output.',
4935
+ connectorChanges: 'OpenClaw may read and modify non-secret connector config such as enabled flags, source commands, project/app mappings, and source priorities. Use `npx -y @analyticscli/growth-engineer@preview wizard --connectors` for API keys or other connector secrets; never write secret values into config files, manifests, issues, PRs, or chat output.',
3399
4936
  secretAccessMode: config?.security?.connectorSecrets?.mode || 'local-user-file',
3400
4937
  secretPolicy: config?.security?.connectorSecrets?.mode === 'isolated-runner'
3401
4938
  ? 'OpenClaw must use the allowlisted sudo wrapper commands and must not read the persisted secret file.'
3402
4939
  : 'Secrets are persisted in a local chmod 600 file. This protects against other OS users, not against the same OS user.',
3403
4940
  },
4941
+ scheduler: {
4942
+ recommended: 'openclaw-cron',
4943
+ openclawCron: automation.openclawCron,
4944
+ hermesCron: automation.hermesCron,
4945
+ statePath,
4946
+ proofPath,
4947
+ verifyCommands: [
4948
+ 'openclaw cron list',
4949
+ 'openclaw tasks list',
4950
+ 'openclaw tasks audit',
4951
+ 'hermes cron list',
4952
+ `tail -n 20 ${proofPath}`,
4953
+ `jq '.connectorHealth, .cadences, .lastRunAt, .skippedReason' ${statePath}`,
4954
+ ],
4955
+ },
3404
4956
  jobs: [
3405
4957
  {
3406
4958
  key: 'connector-health',
@@ -3422,10 +4974,181 @@ async function writeOpenClawJobManifest(configPath, config) {
3422
4974
  await writeJsonFile(manifestPath, manifest);
3423
4975
  return manifestPath;
3424
4976
  }
4977
+ async function ensureOpenClawCronFromWizard(configPath, config) {
4978
+ const automation = getAutomationConfig(config).openclawCron;
4979
+ const displayConfigPath = path.relative(process.cwd(), configPath) || configPath;
4980
+ const statePath = deriveStatePathFromConfigPath(displayConfigPath);
4981
+ const proofPath = path.resolve(deriveSchedulerProofPathFromStatePath(statePath));
4982
+ if (automation.enabled === false) {
4983
+ return {
4984
+ ok: true,
4985
+ installed: false,
4986
+ status: 'disabled',
4987
+ detail: 'OpenClaw Gateway cron disabled by user choice.',
4988
+ statePath,
4989
+ proofPath,
4990
+ };
4991
+ }
4992
+ const addCommand = buildOpenClawCronAddCommand(displayConfigPath, config);
4993
+ if (!(await commandExists('openclaw'))) {
4994
+ return {
4995
+ ok: true,
4996
+ installed: false,
4997
+ status: 'openclaw_cli_missing',
4998
+ detail: 'openclaw CLI was not found on PATH. Run the shown command on the VPS shell where OpenClaw Gateway is installed.',
4999
+ command: addCommand,
5000
+ statePath,
5001
+ proofPath,
5002
+ };
5003
+ }
5004
+ const inspection = await inspectOpenClawCronInstall({
5005
+ configPath: displayConfigPath,
5006
+ config,
5007
+ runCommand: runCommandCapture,
5008
+ readFile: fs.readFile,
5009
+ });
5010
+ if (inspection.exists && inspection.verified) {
5011
+ return {
5012
+ ok: true,
5013
+ installed: true,
5014
+ status: 'already_configured_verified',
5015
+ detail: `OpenClaw cron job already exists and matches the Growth Engineer runner contract: ${automation.name}`,
5016
+ source: inspection.source,
5017
+ statePath,
5018
+ proofPath,
5019
+ };
5020
+ }
5021
+ const add = await runCommandCapture(addCommand);
5022
+ const existingDetail = inspection.exists
5023
+ ? `Existing OpenClaw cron job "${automation.name}" was not verifiably wired to the current runner contract (${inspection.reason} via ${inspection.source}). `
5024
+ : '';
5025
+ return {
5026
+ ok: add.ok,
5027
+ installed: add.ok,
5028
+ status: add.ok ? (inspection.exists ? 'reconfigured' : 'configured') : inspection.exists ? 'needs_repair' : 'failed',
5029
+ detail: add.ok
5030
+ ? `${existingDetail}Configured OpenClaw cron job: ${automation.name}`
5031
+ : `${existingDetail}${add.stderr || add.stdout || `exit ${add.code}`}`,
5032
+ command: addCommand,
5033
+ remediation: inspection.exists && !add.ok
5034
+ ? `Remove the stale OpenClaw cron job named "${automation.name}" with your installed OpenClaw CLI, then rerun: ${addCommand}`
5035
+ : undefined,
5036
+ statePath,
5037
+ proofPath,
5038
+ };
5039
+ }
5040
+ async function ensureHermesCronFromWizard(configPath, config) {
5041
+ const automation = getAutomationConfig(config).hermesCron;
5042
+ const displayConfigPath = path.relative(process.cwd(), configPath) || configPath;
5043
+ const statePath = deriveStatePathFromConfigPath(displayConfigPath);
5044
+ const proofPath = path.resolve(deriveSchedulerProofPathFromStatePath(statePath));
5045
+ const workdir = path.resolve(automation.workdir || process.cwd());
5046
+ if (automation.enabled === false) {
5047
+ return {
5048
+ ok: true,
5049
+ installed: false,
5050
+ status: 'disabled',
5051
+ detail: 'Hermes cron disabled by user choice.',
5052
+ statePath,
5053
+ proofPath,
5054
+ };
5055
+ }
5056
+ const createCommand = buildHermesCronCreateCommand(displayConfigPath, config, { workdir });
5057
+ if (!(await commandExists('hermes'))) {
5058
+ return {
5059
+ ok: true,
5060
+ installed: false,
5061
+ status: 'hermes_cli_missing',
5062
+ detail: 'hermes CLI was not found on PATH. Run the shown command on the host where Hermes Gateway is installed.',
5063
+ command: createCommand,
5064
+ statePath,
5065
+ proofPath,
5066
+ workdir,
5067
+ };
5068
+ }
5069
+ const inspection = await inspectHermesCronInstall({
5070
+ configPath: displayConfigPath,
5071
+ config,
5072
+ runCommand: runCommandCapture,
5073
+ readFile: fs.readFile,
5074
+ workdir,
5075
+ });
5076
+ if (inspection.exists && inspection.verified) {
5077
+ return {
5078
+ ok: true,
5079
+ installed: true,
5080
+ status: 'already_configured_verified',
5081
+ detail: `Hermes cron job already exists and matches the Growth Engineer runner contract: ${automation.name}`,
5082
+ source: inspection.source,
5083
+ statePath,
5084
+ proofPath,
5085
+ workdir,
5086
+ };
5087
+ }
5088
+ const create = await runCommandCapture(createCommand);
5089
+ const existingDetail = inspection.exists
5090
+ ? `Existing Hermes cron job "${automation.name}" was not verifiably wired to the current runner contract (${inspection.reason} via ${inspection.source}). `
5091
+ : '';
5092
+ return {
5093
+ ok: create.ok,
5094
+ installed: create.ok,
5095
+ status: create.ok ? (inspection.exists ? 'reconfigured' : 'configured') : inspection.exists ? 'needs_repair' : 'failed',
5096
+ detail: create.ok
5097
+ ? `${existingDetail}Configured Hermes cron job: ${automation.name}`
5098
+ : `${existingDetail}${create.stderr || create.stdout || `exit ${create.code}`}`,
5099
+ command: createCommand,
5100
+ remediation: inspection.exists && !create.ok
5101
+ ? `Remove the stale Hermes cron job named "${automation.name}" with your installed Hermes CLI, then rerun: ${createCommand}`
5102
+ : undefined,
5103
+ statePath,
5104
+ proofPath,
5105
+ workdir,
5106
+ };
5107
+ }
5108
+ function printOpenClawCronResult(result) {
5109
+ process.stdout.write(`OpenClaw cron: ${result.status} - ${result.detail}\n`);
5110
+ if (result.command && result.status === 'openclaw_cli_missing') {
5111
+ process.stdout.write('\nRun this on the VPS where OpenClaw Gateway is installed:\n');
5112
+ process.stdout.write(`${result.command}\n`);
5113
+ }
5114
+ if (result.remediation) {
5115
+ process.stdout.write('\nOpenClaw cron repair:\n');
5116
+ process.stdout.write(`${result.remediation}\n`);
5117
+ }
5118
+ process.stdout.write('\nVPS verification commands:\n');
5119
+ process.stdout.write(' openclaw cron list\n');
5120
+ process.stdout.write(' openclaw tasks list\n');
5121
+ process.stdout.write(' openclaw tasks audit\n');
5122
+ process.stdout.write(` tail -n 20 ${result.proofPath || path.resolve(DEFAULT_SCHEDULER_PROOF_PATH)}\n`);
5123
+ process.stdout.write(` jq '.connectorHealth, .cadences, .lastRunAt, .skippedReason' ${result.statePath || 'data/openclaw-growth-engineer/state.json'}\n`);
5124
+ }
5125
+ function printHermesCronResult(result) {
5126
+ process.stdout.write(`Hermes cron: ${result.status} - ${result.detail}\n`);
5127
+ if (result.command && result.status === 'hermes_cli_missing') {
5128
+ process.stdout.write('\nRun this on the host where Hermes Gateway is installed:\n');
5129
+ process.stdout.write(`${result.command}\n`);
5130
+ }
5131
+ if (result.remediation) {
5132
+ process.stdout.write('\nHermes cron repair:\n');
5133
+ process.stdout.write(`${result.remediation}\n`);
5134
+ }
5135
+ process.stdout.write('\nHermes verification commands:\n');
5136
+ process.stdout.write(' hermes cron list\n');
5137
+ process.stdout.write(' hermes gateway status\n');
5138
+ process.stdout.write(` tail -n 20 ${result.proofPath || path.resolve(DEFAULT_SCHEDULER_PROOF_PATH)}\n`);
5139
+ process.stdout.write(` jq '.connectorHealth, .cadences, .lastRunAt, .skippedReason' ${result.statePath || 'data/openclaw-growth-engineer/state.json'}\n`);
5140
+ }
3425
5141
  async function main() {
3426
5142
  await loadOpenClawGrowthSecrets();
3427
5143
  const args = parseArgs(process.argv.slice(2));
3428
5144
  await maybeSelfUpdateFromClawHub(args);
5145
+ if (args.sandboxSmoke) {
5146
+ const configPath = path.resolve(args.out);
5147
+ const config = await loadEditableConfig(configPath);
5148
+ await writeJsonFile(configPath, config);
5149
+ process.stdout.write(`${JSON.stringify({ ok: true, configPath, sources: config.sources || {} })}\n`);
5150
+ return;
5151
+ }
3429
5152
  if (args.connectorWizard) {
3430
5153
  await runConnectorSetupWizard(args);
3431
5154
  return;
@@ -3448,8 +5171,12 @@ async function main() {
3448
5171
  const secretAccess = await askSecretAccessModel(rl, configPath, config);
3449
5172
  await writeJsonFile(configPath, config);
3450
5173
  const manifestPath = await writeOpenClawJobManifest(configPath, config);
5174
+ const cronResult = await ensureOpenClawCronFromWizard(configPath, config);
5175
+ const hermesCronResult = await ensureHermesCronFromWizard(configPath, config);
3451
5176
  process.stdout.write(`\nSaved schedule config: ${configPath}\n`);
3452
5177
  process.stdout.write(`Saved OpenClaw job manifest: ${manifestPath}\n`);
5178
+ printOpenClawCronResult(cronResult);
5179
+ printHermesCronResult(hermesCronResult);
3453
5180
  printSecretRunnerKitInstructions(secretAccess.kit);
3454
5181
  process.stdout.write('OpenClaw can run and update growth jobs plus non-secret connector config from the manifest; connector API keys stay behind the connector wizard.\n');
3455
5182
  return;
@@ -3459,8 +5186,12 @@ async function main() {
3459
5186
  const secretAccess = await askSecretAccessModel(rl, configPath, config);
3460
5187
  await writeJsonFile(configPath, config);
3461
5188
  const manifestPath = await writeOpenClawJobManifest(configPath, config);
5189
+ const cronResult = await ensureOpenClawCronFromWizard(configPath, config);
5190
+ const hermesCronResult = await ensureHermesCronFromWizard(configPath, config);
3462
5191
  process.stdout.write(`\nSaved output and interval config: ${configPath}\n`);
3463
5192
  process.stdout.write(`Saved OpenClaw job manifest: ${manifestPath}\n`);
5193
+ printOpenClawCronResult(cronResult);
5194
+ printHermesCronResult(hermesCronResult);
3464
5195
  printSecretRunnerKitInstructions(secretAccess.kit);
3465
5196
  process.stdout.write('Daily checks prioritize Sentry and production anomalies; larger cadences analyze all configured projects and connectors.\n');
3466
5197
  return;
@@ -3492,13 +5223,17 @@ async function main() {
3492
5223
  await ensureDirForFile(configPath);
3493
5224
  await fs.writeFile(configPath, JSON.stringify(config, null, 2), 'utf8');
3494
5225
  const manifestPath = await writeOpenClawJobManifest(configPath, config);
5226
+ const cronResult = await ensureOpenClawCronFromWizard(configPath, config);
5227
+ const hermesCronResult = await ensureHermesCronFromWizard(configPath, config);
3495
5228
  process.stdout.write(`\nSaved config: ${configPath}\n`);
3496
5229
  process.stdout.write(`Saved OpenClaw job manifest: ${manifestPath}\n`);
5230
+ printOpenClawCronResult(cronResult);
5231
+ printHermesCronResult(hermesCronResult);
3497
5232
  printSecretRunnerKitInstructions(secretAccess.kit);
3498
5233
  process.stdout.write('\nNext steps:\n');
3499
5234
  process.stdout.write(`1) Set secrets in OpenClaw secret store (env var names in config.secrets)\n`);
3500
5235
  process.stdout.write(`2) Run once: ${growthEngineerPackageCommand(`run --config ${quote(configPath)}`)}\n`);
3501
- process.stdout.write(`3) Run interval loop: ${growthEngineerPackageCommand(`run --config ${quote(configPath)} --loop`)}\n`);
5236
+ process.stdout.write('3) Prefer OpenClaw Gateway cron for recurring VPS runs; use the interval loop only as a manual fallback.\n');
3502
5237
  }
3503
5238
  finally {
3504
5239
  rl.close();