@analyticscli/growth-engineer 0.1.0 → 0.1.1-preview.10

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.
@@ -290,6 +290,7 @@ function resolveRuntimeScriptPath(scriptName) {
290
290
  const candidates = [
291
291
  path.join(RUNTIME_DIR, scriptName),
292
292
  path.resolve('scripts', scriptName),
293
+ path.resolve('skills/growth-engineer/scripts', scriptName),
293
294
  path.resolve('skills/openclaw-growth-engineer/scripts', scriptName),
294
295
  ];
295
296
  return candidates.find((candidate) => existsSync(candidate)) || path.join(RUNTIME_DIR, scriptName);
@@ -2148,98 +2149,120 @@ async function main() {
2148
2149
  : 'analytics scope check failed',
2149
2150
  status: analyticsProjectSetup.ok ? 'pass' : 'fail',
2150
2151
  });
2151
- emitProgress(args.progressJson, {
2152
- phase: 'start',
2153
- key: 'ascApp',
2154
- label: 'ASC app scope',
2155
- detail: 'resolving App Store Connect app scope',
2156
- });
2157
- const ascAppSetup = await ensureAscAppConfigured(configPath, args.ascApp);
2158
- emitProgress(args.progressJson, {
2159
- phase: 'finish',
2160
- key: 'ascApp',
2161
- label: 'ASC app scope',
2162
- detail: ascAppSetup.ok
2163
- ? ascAppSetup.appId
2164
- ? `using app ${ascAppSetup.appId}`
2165
- : ascAppSetup.appScope === 'all_accessible_apps'
2166
- ? `using all accessible apps (${ascAppSetup.appCount || 0} found)`
2167
- : 'not enabled'
2168
- : describeAscAppSetupFailure(ascAppSetup.error),
2169
- status: ascAppSetup.ok ? 'pass' : 'fail',
2170
- });
2171
- if (!ascAppSetup.ok) {
2172
- process.stdout.write(`${JSON.stringify({
2173
- ok: false,
2174
- phase: 'asc_app_setup',
2175
- configCreated: configResult.created,
2176
- configPath,
2177
- heartbeat,
2178
- openclawCron,
2179
- hermesCron,
2180
- projectConfigured: projectConfigured || analyticsProjectSetup.configured,
2181
- analyticsProjectId: analyticsProjectSetup.projectId || null,
2182
- ascAppConfigured: false,
2183
- connectorSetup,
2184
- needsUserInput: false,
2185
- question: null,
2186
- apps: [],
2187
- nextCommand: null,
2188
- blockers: [
2189
- {
2190
- check: 'connection:asc_app',
2191
- detail: describeAscAppSetupFailure(ascAppSetup.error),
2192
- remediation: remediateAscAppSetupFailure(ascAppSetup.error),
2193
- },
2194
- ],
2195
- }, null, 2)}\n`);
2196
- process.exitCode = 1;
2197
- return;
2198
- }
2199
- emitProgress(args.progressJson, {
2200
- phase: 'start',
2201
- key: 'ascAnalyticsRequest',
2202
- label: 'ASC analytics reports',
2203
- detail: 'checking ongoing Analytics Report Request',
2204
- });
2205
- const ascAnalyticsRequestSetup = await ensureAscAnalyticsRequestsForAppScope(ascAppSetup);
2206
- emitProgress(args.progressJson, {
2207
- phase: 'finish',
2208
- key: 'ascAnalyticsRequest',
2209
- label: 'ASC analytics reports',
2210
- detail: ascAnalyticsRequestSetup.ok
2211
- ? ascAnalyticsRequestSetup.detail
2212
- : `could not ensure Analytics Report Request (${truncate(ascAnalyticsRequestSetup.error, 240)})`,
2213
- status: ascAnalyticsRequestSetup.ok ? 'pass' : 'fail',
2214
- });
2215
- if (!ascAnalyticsRequestSetup.ok) {
2216
- process.stdout.write(`${JSON.stringify({
2217
- ok: false,
2218
- phase: 'asc_analytics_request_setup',
2219
- configCreated: configResult.created,
2220
- configPath,
2221
- heartbeat,
2222
- openclawCron,
2223
- hermesCron,
2224
- projectConfigured: projectConfigured || analyticsProjectSetup.configured,
2225
- analyticsProjectId: analyticsProjectSetup.projectId || null,
2226
- ascAppConfigured: ascAppSetup.configured,
2227
- ascAppId: ascAppSetup.appId || null,
2228
- ascAppScope: ascAppSetup.appScope || null,
2229
- ascAnalyticsRequestResults: ascAnalyticsRequestSetup.results || [],
2230
- connectorSetup,
2231
- needsUserInput: false,
2232
- question: null,
2233
- blockers: [
2234
- {
2235
- check: 'connection:asc_analytics_request',
2236
- detail: `Could not ensure App Store Connect Analytics Report Request: ${truncate(ascAnalyticsRequestSetup.error, 800)}`,
2237
- remediation: 'Use an ASC API key with Admin for first setup so Growth Engineer can create the ongoing Analytics Report Request. After the request exists, rotate to Sales and Reports for steady-state downloads.',
2238
- },
2239
- ],
2240
- }, null, 2)}\n`);
2241
- process.exitCode = 1;
2242
- return;
2152
+ const shouldRunAscSetup = args.onlyConnectors.length === 0 ||
2153
+ args.onlyConnectors.includes('asc') ||
2154
+ Boolean(normalizeString(args.ascApp)) ||
2155
+ configHasEnabledAscSource(initialConfig);
2156
+ let ascAppSetup = {
2157
+ ok: true,
2158
+ configured: false,
2159
+ changed: false,
2160
+ appId: null,
2161
+ appScope: 'skipped_by_connector_filter',
2162
+ needsUserInput: false,
2163
+ };
2164
+ let ascAnalyticsRequestSetup = {
2165
+ ok: true,
2166
+ status: 'skipped',
2167
+ requestId: null,
2168
+ requestIds: [],
2169
+ detail: 'ASC connector was not selected',
2170
+ results: [],
2171
+ };
2172
+ if (shouldRunAscSetup) {
2173
+ emitProgress(args.progressJson, {
2174
+ phase: 'start',
2175
+ key: 'ascApp',
2176
+ label: 'ASC app scope',
2177
+ detail: 'resolving App Store Connect app scope',
2178
+ });
2179
+ ascAppSetup = await ensureAscAppConfigured(configPath, args.ascApp);
2180
+ emitProgress(args.progressJson, {
2181
+ phase: 'finish',
2182
+ key: 'ascApp',
2183
+ label: 'ASC app scope',
2184
+ detail: ascAppSetup.ok
2185
+ ? ascAppSetup.appId
2186
+ ? `using app ${ascAppSetup.appId}`
2187
+ : ascAppSetup.appScope === 'all_accessible_apps'
2188
+ ? `using all accessible apps (${ascAppSetup.appCount || 0} found)`
2189
+ : 'not enabled'
2190
+ : describeAscAppSetupFailure(ascAppSetup.error),
2191
+ status: ascAppSetup.ok ? 'pass' : 'fail',
2192
+ });
2193
+ if (!ascAppSetup.ok) {
2194
+ process.stdout.write(`${JSON.stringify({
2195
+ ok: false,
2196
+ phase: 'asc_app_setup',
2197
+ configCreated: configResult.created,
2198
+ configPath,
2199
+ heartbeat,
2200
+ openclawCron,
2201
+ hermesCron,
2202
+ projectConfigured: projectConfigured || analyticsProjectSetup.configured,
2203
+ analyticsProjectId: analyticsProjectSetup.projectId || null,
2204
+ ascAppConfigured: false,
2205
+ connectorSetup,
2206
+ needsUserInput: false,
2207
+ question: null,
2208
+ apps: [],
2209
+ nextCommand: null,
2210
+ blockers: [
2211
+ {
2212
+ check: 'connection:asc_app',
2213
+ detail: describeAscAppSetupFailure(ascAppSetup.error),
2214
+ remediation: remediateAscAppSetupFailure(ascAppSetup.error),
2215
+ },
2216
+ ],
2217
+ }, null, 2)}\n`);
2218
+ process.exitCode = 1;
2219
+ return;
2220
+ }
2221
+ emitProgress(args.progressJson, {
2222
+ phase: 'start',
2223
+ key: 'ascAnalyticsRequest',
2224
+ label: 'ASC analytics reports',
2225
+ detail: 'checking ongoing Analytics Report Request',
2226
+ });
2227
+ ascAnalyticsRequestSetup = await ensureAscAnalyticsRequestsForAppScope(ascAppSetup);
2228
+ emitProgress(args.progressJson, {
2229
+ phase: 'finish',
2230
+ key: 'ascAnalyticsRequest',
2231
+ label: 'ASC analytics reports',
2232
+ detail: ascAnalyticsRequestSetup.ok
2233
+ ? ascAnalyticsRequestSetup.detail
2234
+ : `could not ensure Analytics Report Request (${truncate(ascAnalyticsRequestSetup.error, 240)})`,
2235
+ status: ascAnalyticsRequestSetup.ok ? 'pass' : 'fail',
2236
+ });
2237
+ if (!ascAnalyticsRequestSetup.ok) {
2238
+ process.stdout.write(`${JSON.stringify({
2239
+ ok: false,
2240
+ phase: 'asc_analytics_request_setup',
2241
+ configCreated: configResult.created,
2242
+ configPath,
2243
+ heartbeat,
2244
+ openclawCron,
2245
+ hermesCron,
2246
+ projectConfigured: projectConfigured || analyticsProjectSetup.configured,
2247
+ analyticsProjectId: analyticsProjectSetup.projectId || null,
2248
+ ascAppConfigured: ascAppSetup.configured,
2249
+ ascAppId: ascAppSetup.appId || null,
2250
+ ascAppScope: ascAppSetup.appScope || null,
2251
+ ascAnalyticsRequestResults: ascAnalyticsRequestSetup.results || [],
2252
+ connectorSetup,
2253
+ needsUserInput: false,
2254
+ question: null,
2255
+ blockers: [
2256
+ {
2257
+ check: 'connection:asc_analytics_request',
2258
+ detail: `Could not ensure App Store Connect Analytics Report Request: ${truncate(ascAnalyticsRequestSetup.error, 800)}`,
2259
+ remediation: 'Use an ASC API key with Admin for first setup so Growth Engineer can create the ongoing Analytics Report Request. After the request exists, rotate to Sales and Reports for steady-state downloads.',
2260
+ },
2261
+ ],
2262
+ }, null, 2)}\n`);
2263
+ process.exitCode = 1;
2264
+ return;
2265
+ }
2243
2266
  }
2244
2267
  const preflightResult = await runPreflight(configPath, args.testConnections, args.progressJson, args.onlyConnectors);
2245
2268
  const preflightPayload = preflightResult.payload;