@ms-cloudpack/cli 0.79.1 → 0.80.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,12 +1,52 @@
1
1
  # Change Log - @ms-cloudpack/cli
2
2
 
3
- <!-- This log was last generated on Tue, 31 Mar 2026 22:10:39 GMT and should not be manually modified. -->
3
+ <!-- This log was last generated on Wed, 06 May 2026 05:47:28 GMT and should not be manually modified. -->
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 0.80.0
8
+
9
+ Wed, 06 May 2026 05:47:28 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - `@ms-cloudpack/cli`
14
+ - Update telemetry API usage (elcraig@microsoft.com)
15
+ - `@ms-cloudpack/telemetry`
16
+ - Update to latest major version of opentelemetry dependencies. This required a breaking API change: `startTelemetry` is now async and creates all clients upfront. (elcraig@microsoft.com)
17
+
18
+ ### Patches
19
+
20
+ - `@ms-cloudpack/eslint-plugin-deprecated`
21
+ - Initial release (elcraig@microsoft.com)
22
+ - `@ms-cloudpack/bundler-rollup`
23
+ - Bump lodash from 4.17.23 to 4.18.1 (elcraig@microsoft.com)
24
+ - `@ms-cloudpack/api-server`
25
+ - Fix self-referencing subpath imports in staticAnalysisInit: resolve through exports map and record as consumed to prevent removeUnusedExports from dropping entries (stchur@microsoft.com)
26
+
27
+ ## 0.79.2
28
+
29
+ Wed, 08 Apr 2026 19:26:53 GMT
30
+
31
+ ### Minor changes
32
+
33
+ - `@ms-cloudpack/task-reporter`
34
+ - Restore original console methods on `TaskReporter#dispose()`. `TaskReporterTask#complete()` is now a no-op if called multiple times. Remove unused `TaskReporterTask#addMessage()`. (elcraig@microsoft.com)
35
+
36
+ ### Patches
37
+
38
+ - `@ms-cloudpack/cli`
39
+ - Update workspace-tools to 0.41.3 (elcraig@microsoft.com)
40
+ - `@ms-cloudpack/package-utilities`
41
+ - Update workspace-tools to 0.41.3 (elcraig@microsoft.com)
42
+ - `@ms-cloudpack/path-utilities`
43
+ - Update workspace-tools to 0.41.3 (elcraig@microsoft.com)
44
+ - `@ms-cloudpack/remote-cache`
45
+ - Update backfill dependencies and simplify internals of AzureRemoteCacheClient (elcraig@microsoft.com)
46
+
7
47
  ## 0.79.1
8
48
 
9
- Tue, 31 Mar 2026 22:10:39 GMT
49
+ Tue, 31 Mar 2026 22:12:37 GMT
10
50
 
11
51
  ### Patches
12
52
 
@@ -1 +1 @@
1
- {"version":3,"file":"CommandExecutor.d.ts","sourceRoot":"","sources":["../../src/utilities/CommandExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAe9D,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAqB,MAAM,2BAA2B,CAAC;AACrG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAI/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAQ7E,MAAM,WAAW,qBAAqB,CAAC,QAAQ,SAAS,aAAa;IACnE,iCAAiC;IACjC,IAAI,EAAE,MAAM,EAAE,CAAC;IAEf,2CAA2C;IAC3C,OAAO,EAAE,QAAQ,CAAC;IAElB,uCAAuC;IACvC,OAAO,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAEjC,0CAA0C;IAC1C,cAAc,EAAE,cAAc,CAAC;IAE/B,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;IAEb;;;;;;;;OAQG;IACH,gBAAgB,EAAE,oBAAoB,GAAG,SAAS,CAAC;IAEnD;;;;;OAKG;IACH,mBAAmB,EAAE,OAAO,GAAG,SAAS,CAAC;IAEzC;;;OAGG;IACH,oBAAoB,EAChB,CAAC,CACC,OAAO,E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E;IACrE,OAAO,CAAC,+BAA+B;YAgBzB,cAAc;IAgE5B,OAAO,CAAC,cAAc,CAgBpB;IAEF,OAAO,CAAC,yBAAyB,CAO/B;IAEF,OAAO,CAAC,uBAAuB,CAI7B;IAEF;;;;;;OAMG;YACW,KAAK;IA6BnB,wDAAwD;IACxD,OAAO,CAAC,gBAAgB;CAGzB"}
@@ -277,33 +277,26 @@ export class CommandExecutor {
277
277
  ? noLoggingConfig
278
278
  : defaultLoggingConfig),
279
279
  });
280
- const logLevel = this._options.verbose ? 'VERBOSE' : this._options.debug ? 'DEBUG' : undefined;
281
280
  if (!this._options.debug) {
282
281
  this._reporter.ignoreLogMessage('ApplicationInsights:');
283
282
  }
284
- const telemetryApi = startTelemetry({
285
- productVersion: getVersion(import.meta.url),
286
- logLevel,
287
- serviceName: 'cli',
288
- });
289
- this._autoDisposableList.add({ dispose: () => telemetryApi.shutdown() });
290
- const contexts = [];
283
+ // Due to opentelemetry API changes (inability to add span processors after the tracer provider is set),
284
+ // it's necessary to create all telemetry clients upfront. To do that, we need to get other app context first.
285
+ const initialContexts = {};
291
286
  for (const appPath of Object.keys(configs)) {
292
287
  const config = configs[appPath];
293
288
  const definition = await readJson(path.join(appPath, 'package.json'));
294
289
  const { name = path.basename(appPath) } = definition || {};
295
- const telemetryClient = await this._initTelemetry(name, config, telemetryApi);
296
- contexts.push({
290
+ initialContexts[appPath] = {
297
291
  appPath,
298
292
  appName: name,
299
293
  cachePath: this._options.cachePath,
300
294
  config,
301
295
  reporter: this._reporter,
302
- telemetryClient,
303
296
  taskRunner,
304
- });
297
+ };
305
298
  }
306
- return contexts;
299
+ return this._initTelemetry(initialContexts);
307
300
  }
308
301
  /** Translate certain CLI options into options for `readConfig()`. */
309
302
  _getConfigOptionsFromCliOptions() {
@@ -321,40 +314,55 @@ export class CommandExecutor {
321
314
  ...(this._applyOptionsToConfig?.(this._options) || {}),
322
315
  };
323
316
  }
324
- async _initTelemetry(appName, config, telemetryApi) {
325
- // Mark the start time for telemetry.
326
- const startTime = performance.now();
327
- const programOptions = this._programOptions;
328
- const connectionString = this._programOptions.disableTelemetry || environmentInfo.isJest
329
- ? undefined
330
- : config.telemetry?.connectionString || environmentInfo.cloudpack.telemetryConnectionString;
331
- const telemetryClient = await telemetryApi.createClient(connectionString);
332
- telemetryClient.tracer.startSpan('CLI_ENTRY', { startTime: getCliStartTime() }).end();
333
- await telemetryClient.tracer.startActiveSpan('INIT_TELEMETRY', { startTime }, (span) => {
334
- const enabledFeatureNames = Object.entries(config.features || {})
335
- .filter(([, value]) => value)
336
- .map(([key]) => key);
337
- if (enabledFeatureNames.length) {
338
- console.log(`Enabled features for ${appName}: ${enabledFeatureNames.map((f) => yellow(f)).join(', ')}`);
339
- }
340
- const telemetryAttributes = {
341
- verb: this._verb,
342
- arguments: programOptions.argv.slice(3).join(' '),
343
- environment: environmentInfo.isCI ? 'ci' : environmentInfo.isCodespaces ? 'codespaces' : 'local',
344
- appName: appName || '<unknown>',
345
- mode: config.mode,
346
- features: enabledFeatureNames,
347
- externalCorrelationId: environmentInfo.cloudpack.telemetryExternalCorrelationId,
348
- // Azure DevOps build attributes
349
- ...environmentInfo.ado,
350
- };
351
- for (const [key, value] of Object.entries(telemetryAttributes)) {
352
- if (value) {
353
- span.setAttribute(key, value);
354
- }
355
- }
317
+ async _initTelemetry(appContexts) {
318
+ const telemetryApi = await startTelemetry({
319
+ productVersion: getVersion(import.meta.url),
320
+ logLevel: this._options.verbose ? 'VERBOSE' : this._options.debug ? 'DEBUG' : undefined,
321
+ serviceName: 'cli',
322
+ connectionStrings: Object.fromEntries(Object.values(appContexts).map(({ appPath, config }) => [
323
+ appPath,
324
+ this._programOptions.disableTelemetry || environmentInfo.isJest
325
+ ? undefined
326
+ : config.telemetry?.connectionString || environmentInfo.cloudpack.telemetryConnectionString,
327
+ ])),
356
328
  });
357
- return telemetryClient;
329
+ this._autoDisposableList.add({ dispose: () => telemetryApi.shutdown() });
330
+ const contexts = [];
331
+ for (const [appPath, telemetryClient] of Object.entries(telemetryApi.clients)) {
332
+ // Mark the start time for telemetry.
333
+ const startTime = performance.now();
334
+ const { config, appName } = appContexts[appPath];
335
+ contexts.push({
336
+ ...appContexts[appPath],
337
+ telemetryClient,
338
+ });
339
+ telemetryClient.tracer.startSpan('CLI_ENTRY', { startTime: getCliStartTime() }).end();
340
+ await telemetryClient.tracer.startActiveSpan('INIT_TELEMETRY', { startTime }, (span) => {
341
+ const enabledFeatureNames = Object.entries(config.features || {})
342
+ .filter(([, value]) => value)
343
+ .map(([key]) => key);
344
+ if (enabledFeatureNames.length) {
345
+ console.log(`Enabled features for ${appName}: ${enabledFeatureNames.map((f) => yellow(f)).join(', ')}`);
346
+ }
347
+ const telemetryAttributes = {
348
+ verb: this._verb,
349
+ arguments: this._programOptions.argv.slice(3).join(' '),
350
+ environment: environmentInfo.isCI ? 'ci' : environmentInfo.isCodespaces ? 'codespaces' : 'local',
351
+ appName: appName || '<unknown>',
352
+ mode: config.mode,
353
+ features: enabledFeatureNames,
354
+ externalCorrelationId: environmentInfo.cloudpack.telemetryExternalCorrelationId,
355
+ // Azure DevOps build attributes
356
+ ...environmentInfo.ado,
357
+ };
358
+ for (const [key, value] of Object.entries(telemetryAttributes)) {
359
+ if (value) {
360
+ span.setAttribute(key, value);
361
+ }
362
+ }
363
+ });
364
+ }
365
+ return contexts;
358
366
  }
359
367
  _sigintHandler = () => {
360
368
  this._sigintCount++;
@@ -1 +1 @@
1
- {"version":3,"file":"CommandExecutor.js","sourceRoot":"","sources":["../../src/utilities/CommandExecutor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EACL,YAAY,EACZ,IAAI,EACJ,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,GAAG,EACH,oBAAoB,EACpB,MAAM,GACP,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,cAAc,EAA2C,MAAM,yBAAyB,CAAC;AAClG,OAAO,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M,CAAC;YACN,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;YAE3B,8DAA8D;YAC9D,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;gBACtB,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO;gBAC3C,QAAQ,EAAE,QAAQ,KAAK,CAAC;aACzB,CAAC,CAAC;YAEH,wBAAwB;YACxB,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,CAAC;QAC5C,CAAC;QAED,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;IAED,wDAAwD;IAChD,gBAAgB,CAAC,QAAgB;QACvC,CAAC,eAAe,CAAC,gBAAgB,IAAI,eAAe,CAAC,CAAC,QAAQ,CAAC,CAAC;IAClE,CAAC","sourcesContent":["import type { ReadConfigOptions } from '@ms-cloudpack/config';\nimport type { CloudpackConfig, PackageJson } from '@ms-cloudpack/common-types';\nimport { readJson } from '@ms-cloudpack/json-utilities';\nimport {\n TaskReporter,\n bold,\n debugLoggingConfig,\n defaultLoggingConfig,\n noLoggingConfig,\n red,\n verboseLoggingConfig,\n yellow,\n} from '@ms-cloudpack/task-reporter';\nimport { startTelemetry, type TelemetryApi, type TelemetryClient } from '@ms-cloudpack/telemetry';\nimport path from 'path';\nimport type { CommandAction, CommandExitParams, AppCommandContext } from '../types/CommandAction.js';\nimport type { ProgramOptions } from '../types/ProgramOptions.js';\nimport type { SharedOptions } from '../types/SharedOptions.js';\nimport { AutoDisposableList } from './AutoDisposableList.js';\nimport { getVersion } from '@ms-cloudpack/package-utilities';\nimport { environmentInfo } from '@ms-cloudpack/environment';\nimport type { ReusedOptions } from '../types/ReusedOptions.js';\nimport type { AppPathDiscoveryMode } from '../types/AppPathDiscoveryMode.js';\nimport { discoverRemoteAppPaths } from './discoverRemoteAppPaths.js';\nimport { discoverLocalAppPaths } from './discoverLocalAppPaths.js';\nimport { TaskRunner } from '@ms-cloudpack/api-server';\nimport { readLocalConfigs, type InvalidCloudpackConfigError } from './readLocalConfigs.js';\nimport { readRemoteConfigs } from './readRemoteConfigs.js';\nimport { getCliStartTime } from './getCliStartTime.js';\n\nexport interface CommandExecutorParams<TOptions extends SharedOptions> {\n /** Command-specific arguments */\n args: string[];\n\n /** Command-specific and shared options. */\n options: TOptions;\n\n /** Function to execute the command. */\n execute: CommandAction<TOptions>;\n\n /** Shared program-level configuration. */\n programOptions: ProgramOptions;\n\n /** Verb being run, e.g. `bundle` or `cache clean`. */\n verb: string;\n\n /**\n * By default, the command will run against `cwd` (usually `process.cwd()`).\n * If this option is set, attempt to discover app path(s) instead.\n * (`cwd` will still be preferred if it has a `cloudpack.config.json`.)\n * See {@link AppPathDiscoveryMode} for details.\n *\n * Note that `isMultiApp` elsewhere will only be true if this is set to `'multi'` and\n * multiple apps are found.\n */\n discoverAppPaths: AppPathDiscoveryMode | undefined;\n\n /**\n * Whether to set `TaskReporter`'s `enableReset` option, which enables resetting console output.\n * This should only be true for commands like start which use watch mode, and needs to be set at\n * the beginning instead of being toggled by the command to ensure everything is captured.\n * (If true, the screen will also be cleared on startup.)\n */\n enableReporterReset: boolean | undefined;\n\n /**\n * Apply any command-specific CLI options that need to be passed through to `readConfig`.\n * (Shared and reused options are applied automatically.)\n */\n applyOptionsToConfig:\n | ((\n options: Omit<TOptions, keyof (SharedOptions & ReusedOptions)>,\n ) => Pick<ReadConfigOptions, 'extraServerConfig'> | undefined)\n | undefined;\n}\n\ninterface ExtendedAppCommandContext extends AppCommandContext {\n /** Name of the app package */\n appName: string;\n}\n\n// eslint-disable-next-line no-restricted-properties -- this is the central handler\nconst realProcessExit = process.exit.bind(process);\n\n/**\n * This class manages orchestration and shared state while executing a command.\n */\nexport class CommandExecutor<TOptions extends SharedOptions> {\n private _options: TOptions;\n private _execute: CommandAction<TOptions>;\n private _programOptions: ProgramOptions;\n private _verb: string;\n private _discoverAppPaths: AppPathDiscoveryMode | undefined;\n private _enableReporterReset: boolean;\n private _applyOptionsToConfig: CommandExecutorParams<TOptions>['applyOptionsToConfig'];\n private _reporter: TaskReporter;\n /** Items which should be disposed before a restart, as well as at process exit */\n private _autoDisposableList: AutoDisposableList;\n /** Items which should be disposed before exit only */\n private _finalDisposableList: AutoDisposableList;\n private _hasCalledExit = false;\n private _args: string[];\n private _sigintCount = 0;\n private _onInterrupt?: () => void;\n private _getMessageOnInterrupt?: () => string;\n\n /** Active `CommandExecutor` instances. In tests, there may be more than one. */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- options type isn't used\n private static _activeInstances = new Set<CommandExecutor<any>>();\n /** Mock implementation of `process.exit` for testing purposes. */\n private static _mockProcessExit: typeof process.exit | undefined;\n\n /**\n * Set a mock `process.exit()` implementation for tests, to handle cases where the command would\n * call `process.exit()`.\n */\n public static mockProcessExitForTests(mockImpl: typeof process.exit | undefined): void {\n CommandExecutor._mockProcessExit = mockImpl;\n }\n\n /**\n * For testing use only: end all active CommandExecutor instances and call `process.exit()`\n * (which should be mocked by the test).\n */\n public static async exitAllForTests(params: CommandExitParams): Promise<void> {\n for (const instance of CommandExecutor._activeInstances) {\n await instance._exit(params);\n }\n CommandExecutor._activeInstances = new Set();\n }\n\n /**\n * Get a list of the commands that are running, including their arguments.\n */\n public static getRunningCommands(): string[] {\n return Array.from(CommandExecutor._activeInstances).map((instance) =>\n [instance._verb, ...instance._args].join(' '),\n );\n }\n\n constructor(params: CommandExecutorParams<TOptions>) {\n this._args = params.args;\n this._options = params.options;\n this._execute = params.execute;\n this._programOptions = params.programOptions;\n this._verb = params.verb;\n this._discoverAppPaths = params.discoverAppPaths;\n this._enableReporterReset = !!params.enableReporterReset;\n this._applyOptionsToConfig = params.applyOptionsToConfig;\n\n this._autoDisposableList = new AutoDisposableList();\n this._finalDisposableList = new AutoDisposableList();\n this._finalDisposableList.add(this._autoDisposableList);\n\n if (this._enableReporterReset) {\n // If running an interactive command, start by clearing the screen\n this._reporter = new TaskReporter({ enableReset: true });\n this._reporter.reset();\n } else {\n this._reporter = new TaskReporter();\n }\n this._finalDisposableList.add(this._reporter);\n\n CommandExecutor._activeInstances.add(this);\n this._finalDisposableList.add({\n dispose: () => {\n CommandExecutor._activeInstances.delete(this);\n\n // Command event listeners are currently only removed on final disposal since the start tests rely on\n // a 'ready' event listener carrying over across restarts.\n this._programOptions.commandEvents.removeAllListeners();\n },\n });\n\n // Handle SIGINT (Ctrl+C) and unhandled errors. These must be removed in _exit.\n // (Skip in tests to avoid interfering with test framework handling.)\n if (!environmentInfo.isJest) {\n process.on('SIGINT', this._sigintHandler);\n // This should also catch unhandled promise rejections\n process.on('uncaughtException', this._uncaughtExceptionHandler);\n process.on('error', this._unexpectedErrorHandler);\n // Also override process.exit in case some code calls it directly.\n // eslint-disable-next-line no-restricted-properties -- central handling code\n process.exit = ((code) => {\n // Get the call stack to display\n const error = new Error(`Unexpected process.exit(${code ?? ''}) call`);\n void this._exit({\n message: error.stack || '',\n hasErrors: true,\n exitCode: 1,\n });\n }) as typeof process.exit;\n\n this._finalDisposableList.add({\n dispose: () => {\n process.off('SIGINT', this._sigintHandler);\n process.off('uncaughtException', this._uncaughtExceptionHandler);\n process.off('error', this._unexpectedErrorHandler);\n // eslint-disable-next-line no-restricted-properties\n process.exit = realProcessExit;\n },\n });\n }\n }\n\n /**\n * Run the command, including handling for restarts. This should only be called once per instance,\n * immediately after the constructor (since constructors can't be async).\n */\n public async execute(): Promise<void> {\n try {\n let shouldRestart = false;\n do {\n shouldRestart = await this._executeOnce(shouldRestart);\n } while (shouldRestart);\n } catch (error) {\n // If an error occurs, exit the process with a non-zero exit code.\n const err = error as InvalidCloudpackConfigError;\n const message = err.isExpected\n ? err.message // Only show message for expected errors\n : err.stack || err.message || String(error); // Show full stack for unexpected errors\n\n await this._exit({\n hasErrors: true,\n message,\n });\n }\n }\n\n /**\n * Execute a single iteration of the command.\n * @returns true if a restart is needed\n */\n private async _executeOnce(isRestart: boolean): Promise<boolean> {\n const contexts = await this._initializeContexts();\n\n if (!Array.isArray(contexts)) {\n await this._exit(contexts);\n return false;\n }\n\n const spanName = `${this._verb.toUpperCase().replace(/ /g, '_')}_EXECUTE`;\n const results: CommandExitParams[] = [];\n\n for (const context of contexts) {\n // Call the execute function which is the real command logic\n // (ie: real init command logic, real start command logic, etc.)\n const result = await context.telemetryClient.tracer.startActiveSpan(spanName, async (span) => {\n this._onInterrupt = () => {\n span.setAttribute('isInterrupted', true);\n span.end();\n };\n\n const isMultiApp = contexts.length > 1;\n if (isMultiApp) {\n console.log();\n console.log(`==== Starting ${this._verb} for ${context.appName} ====`);\n }\n\n return this._execute({\n ...context,\n span,\n isMultiApp,\n args: this._args,\n options: this._options,\n commandEvents: this._programOptions.commandEvents,\n isRestart,\n autoDispose: (disposable) => this._autoDisposableList.add(disposable),\n setInterruptMessageHandler: (getMessage) => {\n this._getMessageOnInterrupt = getMessage;\n },\n });\n });\n if (result?.isInterrupted) {\n await this._exit(result);\n return false;\n }\n if (result) {\n results.push(result);\n } else {\n // If the command returned null, this means it should keep running (e.g. start).\n // We disallow returning undefined to avoid accidents.\n throw new Error('Command executor must return exit options or null');\n }\n this._onInterrupt = undefined;\n }\n\n // Determine whether a command requested a restart in this iteration.\n const shouldRestart = results.some((r) => r.restart);\n\n if (shouldRestart) {\n // Dispose all registered disposables.\n await this._autoDisposableList.dispose();\n this._reporter.reset(true /* clearOutputs */);\n\n console.warn(results.map((r) => r.message).join('\\n'));\n } else if (results.length) {\n // If one or more apps returned a result, exit.\n await this._exit({\n message: results.map((r) => r.message).join('\\n'),\n hasErrors: results.some((r) => r.hasErrors),\n // If any app returned a non-zero exit code, use that.\n exitCode: results.find(({ exitCode }) => !!exitCode)?.exitCode,\n });\n }\n\n return shouldRestart;\n }\n\n /**\n * Determine the app paths and initialize the context for each app.\n * @returns Context(s), or an exit options object if there was an error. (might also throw on error)\n */\n private async _initializeContexts(): Promise<ExtendedAppCommandContext[] | CommandExitParams> {\n let appPaths: string[];\n\n if (this._discoverAppPaths) {\n // Search for cloudpack configs to determine the app path(s)\n const { app, login } = this._options as unknown as Pick<ReusedOptions, 'app' | 'login'>;\n const appPathsResult =\n this._discoverAppPaths === 'remote'\n ? await discoverRemoteAppPaths({\n options: {\n login,\n cachePath: this._options.cachePath,\n desiredApp: app,\n },\n context: { reporter: this._reporter },\n })\n : await discoverLocalAppPaths({\n cwd: this._programOptions.cwd,\n discover: this._discoverAppPaths,\n desiredApp: app,\n });\n if (!Array.isArray(appPathsResult)) {\n // This means there was an error (or the user cancelled) while getting app paths.\n return appPathsResult;\n }\n appPaths = appPathsResult;\n } else {\n // Just use the cwd\n appPaths = [this._programOptions.cwd];\n }\n\n // The task runner is shared between all apps so that task results can potentially be reused.\n const taskRunner = new TaskRunner();\n\n const readConfig = this._discoverAppPaths === 'remote' ? readRemoteConfigs : readLocalConfigs;\n const configs = await readConfig(appPaths, {\n ...this._getConfigOptionsFromCliOptions(),\n enableDefaultFeatures: true,\n });\n\n const helpMessages = new Set<string>(\n Object.values(configs)\n .filter((c) => c.helpMessage)\n .map((c) => c.helpMessage) as string[],\n );\n\n // Set reporter options and print the product info header\n this._reporter.setOptions({\n productName: 'Cloudpack',\n version: this._programOptions.version,\n description: () => `Running \"${bold(this._programOptions.argv.slice(2).join(' '))}\"`,\n helpMessage: [...helpMessages].join('\\n'),\n plainTextMode: !this._options.color,\n logFile: !!this._options.logFile,\n cwd: this._programOptions.cwd,\n enableReset: this._enableReporterReset,\n ...(this._options.debug\n ? debugLoggingConfig\n : this._options.verbose\n ? verboseLoggingConfig\n : this._options.quiet\n ? noLoggingConfig\n : defaultLoggingConfig),\n });\n\n const logLevel = this._options.verbose ? 'VERBOSE' : this._options.debug ? 'DEBUG' : undefined;\n if (!this._options.debug) {\n this._reporter.ignoreLogMessage('ApplicationInsights:');\n }\n\n const telemetryApi = startTelemetry({\n productVersion: getVersion(import.meta.url),\n logLevel,\n serviceName: 'cli',\n });\n\n this._autoDisposableList.add({ dispose: () => telemetryApi.shutdown() });\n\n const contexts: ExtendedAppCommandContext[] = [];\n\n for (const appPath of Object.keys(configs)) {\n const config = configs[appPath];\n const definition = await readJson<PackageJson>(path.join(appPath, 'package.json'));\n const { name = path.basename(appPath) } = definition || {};\n\n const telemetryClient = await this._initTelemetry(name, config, telemetryApi);\n\n contexts.push({\n appPath,\n appName: name,\n cachePath: this._options.cachePath,\n config,\n reporter: this._reporter,\n telemetryClient,\n taskRunner,\n });\n }\n\n return contexts;\n }\n\n /** Translate certain CLI options into options for `readConfig()`. */\n private _getConfigOptionsFromCliOptions(): ReadConfigOptions {\n // These options don't exist for all commands, but that's fine.\n const options = this._options as Partial<ReusedOptions & SharedOptions>;\n return {\n mode: options.mode,\n logBundleInfo: options.logBundleInfo,\n configFileName: options.config,\n // Handle --bundler by passing it as a universal package override, which will be appended\n // to any user-provided packageSettings so that it takes precedence.\n extraPackageSettings: options.bundler ? [{ match: '*', bundler: options.bundler }] : undefined,\n extraFeatures: options.features,\n extraDefineFlags: options.define,\n ...(this._applyOptionsToConfig?.(this._options) || {}),\n };\n }\n\n private async _initTelemetry(\n appName: string | undefined,\n config: CloudpackConfig,\n telemetryApi: TelemetryApi,\n ): Promise<TelemetryClient> {\n // Mark the start time for telemetry.\n const startTime = performance.now();\n\n const programOptions = this._programOptions;\n\n const connectionString =\n this._programOptions.disableTelemetry || environmentInfo.isJest\n ? undefined\n : config.telemetry?.connectionString || environmentInfo.cloudpack.telemetryConnectionString;\n\n const telemetryClient = await telemetryApi.createClient(connectionString);\n\n telemetryClient.tracer.startSpan('CLI_ENTRY', { startTime: getCliStartTime() }).end();\n\n await telemetryClient.tracer.startActiveSpan('INIT_TELEMETRY', { startTime }, (span) => {\n const enabledFeatureNames = Object.entries(config.features || {})\n .filter(([, value]) => value)\n .map(([key]) => key);\n\n if (enabledFeatureNames.length) {\n console.log(`Enabled features for ${appName}: ${enabledFeatureNames.map((f) => yellow(f)).join(', ')}`);\n }\n\n const telemetryAttributes = {\n verb: this._verb,\n arguments: programOptions.argv.slice(3).join(' '),\n environment: environmentInfo.isCI ? 'ci' : environmentInfo.isCodespaces ? 'codespaces' : 'local',\n appName: appName || '<unknown>',\n mode: config.mode,\n features: enabledFeatureNames,\n externalCorrelationId: environmentInfo.cloudpack.telemetryExternalCorrelationId,\n // Azure DevOps build attributes\n ...environmentInfo.ado,\n };\n\n for (const [key, value] of Object.entries(telemetryAttributes)) {\n if (value) {\n span.setAttribute(key, value);\n }\n }\n });\n\n return telemetryClient;\n }\n\n private _sigintHandler = (): void => {\n this._sigintCount++;\n\n if (this._sigintCount > 1) {\n console.debug('Forcing exit');\n\n // We are forcing the process to exit.\n // No clean-up is needed because user pressed Ctrl+C twice.\n this._callProcessExit(1);\n return;\n }\n\n this._onInterrupt?.();\n\n // We are trying to exit gracefully.\n void this._exit({ isInterrupted: true, message: '' });\n };\n\n private _uncaughtExceptionHandler: NodeJS.UncaughtExceptionListener = (error, reason) => {\n const errorType = reason === 'uncaughtException' ? 'Uncaught exception' : 'Unhandled promise rejection';\n const message = `${errorType}: ${error.stack || error.message || String(error)}`;\n // Go ahead and log the message in case the process exits before cleanup is complete\n console.error(message);\n\n void this._exit({ message, hasErrors: true, exitCode: 1 });\n };\n\n private _unexpectedErrorHandler = (...args: unknown[]): void => {\n const err = new Error('Unexpected process error');\n console.error(err.stack);\n console.error('Error details:', ...args);\n };\n\n /**\n * Exit function called with the result returned by the command's execute function,\n * or manually via `CommandExecutor.exitAll()` in tests.\n *\n * Except in tests, execution can be assumed to have stopped after this is called.\n * (In tests, `process.exit` is probably mocked to throw.)\n */\n private async _exit(params: CommandExitParams): Promise<void> {\n const { hasErrors = this._reporter.hasErrors(), exitCode = hasErrors ? 1 : 0 } = params;\n const message = params.isInterrupted ? this._getMessageOnInterrupt?.() || 'Interrupted by user' : params.message;\n\n if (this._hasCalledExit) {\n // Skip most of the operations if exit() was called multiple times.\n // But only use the error message if not in a test, due to the way we're mocking process.exit.\n if (!environmentInfo.isJest) {\n const prettyParams = Object.entries(params)\n .map(([key, value]) => `${key}=\"${value}\"`)\n .join(', ');\n console.warn(`exit() was called multiple times. This call's options: ${prettyParams}.`);\n }\n } else {\n this._hasCalledExit = true;\n\n // Show the summary message (this will throw if called twice).\n this._reporter.complete({\n summary: hasErrors ? red(message) : message,\n showHelp: exitCode !== 0,\n });\n\n // Dispose all resources\n await this._finalDisposableList.dispose();\n }\n\n this._callProcessExit(exitCode);\n }\n\n /** Call the mocked or real `process.exit()` function */\n private _callProcessExit(exitCode: number): void {\n (CommandExecutor._mockProcessExit || realProcessExit)(exitCode);\n }\n}\n"]}
1
+ {"version":3,"file":"CommandExecutor.js","sourceRoot":"","sources":["../../src/utilities/CommandExecutor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EACL,YAAY,EACZ,IAAI,EACJ,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,GAAG,EACH,oBAAoB,EACpB,MAAM,GACP,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,IAAI,MAAM,MAAM,CAAC;AAIxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAG5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAoC,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAqDvD,mFAAmF;AACnF,MAAM,eAAe,GA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AC;aACzB,CAAC,CAAC;YAEH,wBAAwB;YACxB,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,CAAC;QAC5C,CAAC;QAED,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;IAED,wDAAwD;IAChD,gBAAgB,CAAC,QAAgB;QACvC,CAAC,eAAe,CAAC,gBAAgB,IAAI,eAAe,CAAC,CAAC,QAAQ,CAAC,CAAC;IAClE,CAAC","sourcesContent":["import type { ReadConfigOptions } from '@ms-cloudpack/config';\nimport type { PackageJson } from '@ms-cloudpack/common-types';\nimport { readJson } from '@ms-cloudpack/json-utilities';\nimport {\n TaskReporter,\n bold,\n debugLoggingConfig,\n defaultLoggingConfig,\n noLoggingConfig,\n red,\n verboseLoggingConfig,\n yellow,\n} from '@ms-cloudpack/task-reporter';\nimport { startTelemetry } from '@ms-cloudpack/telemetry';\nimport path from 'path';\nimport type { CommandAction, CommandExitParams, AppCommandContext } from '../types/CommandAction.js';\nimport type { ProgramOptions } from '../types/ProgramOptions.js';\nimport type { SharedOptions } from '../types/SharedOptions.js';\nimport { AutoDisposableList } from './AutoDisposableList.js';\nimport { getVersion } from '@ms-cloudpack/package-utilities';\nimport { environmentInfo } from '@ms-cloudpack/environment';\nimport type { ReusedOptions } from '../types/ReusedOptions.js';\nimport type { AppPathDiscoveryMode } from '../types/AppPathDiscoveryMode.js';\nimport { discoverRemoteAppPaths } from './discoverRemoteAppPaths.js';\nimport { discoverLocalAppPaths } from './discoverLocalAppPaths.js';\nimport { TaskRunner } from '@ms-cloudpack/api-server';\nimport { readLocalConfigs, type InvalidCloudpackConfigError } from './readLocalConfigs.js';\nimport { readRemoteConfigs } from './readRemoteConfigs.js';\nimport { getCliStartTime } from './getCliStartTime.js';\n\nexport interface CommandExecutorParams<TOptions extends SharedOptions> {\n /** Command-specific arguments */\n args: string[];\n\n /** Command-specific and shared options. */\n options: TOptions;\n\n /** Function to execute the command. */\n execute: CommandAction<TOptions>;\n\n /** Shared program-level configuration. */\n programOptions: ProgramOptions;\n\n /** Verb being run, e.g. `bundle` or `cache clean`. */\n verb: string;\n\n /**\n * By default, the command will run against `cwd` (usually `process.cwd()`).\n * If this option is set, attempt to discover app path(s) instead.\n * (`cwd` will still be preferred if it has a `cloudpack.config.json`.)\n * See {@link AppPathDiscoveryMode} for details.\n *\n * Note that `isMultiApp` elsewhere will only be true if this is set to `'multi'` and\n * multiple apps are found.\n */\n discoverAppPaths: AppPathDiscoveryMode | undefined;\n\n /**\n * Whether to set `TaskReporter`'s `enableReset` option, which enables resetting console output.\n * This should only be true for commands like start which use watch mode, and needs to be set at\n * the beginning instead of being toggled by the command to ensure everything is captured.\n * (If true, the screen will also be cleared on startup.)\n */\n enableReporterReset: boolean | undefined;\n\n /**\n * Apply any command-specific CLI options that need to be passed through to `readConfig`.\n * (Shared and reused options are applied automatically.)\n */\n applyOptionsToConfig:\n | ((\n options: Omit<TOptions, keyof (SharedOptions & ReusedOptions)>,\n ) => Pick<ReadConfigOptions, 'extraServerConfig'> | undefined)\n | undefined;\n}\n\ninterface ExtendedAppCommandContext extends AppCommandContext {\n /** Name of the app package */\n appName: string;\n}\n\n// eslint-disable-next-line no-restricted-properties -- this is the central handler\nconst realProcessExit = process.exit.bind(process);\n\n/**\n * This class manages orchestration and shared state while executing a command.\n */\nexport class CommandExecutor<TOptions extends SharedOptions> {\n private _options: TOptions;\n private _execute: CommandAction<TOptions>;\n private _programOptions: ProgramOptions;\n private _verb: string;\n private _discoverAppPaths: AppPathDiscoveryMode | undefined;\n private _enableReporterReset: boolean;\n private _applyOptionsToConfig: CommandExecutorParams<TOptions>['applyOptionsToConfig'];\n private _reporter: TaskReporter;\n /** Items which should be disposed before a restart, as well as at process exit */\n private _autoDisposableList: AutoDisposableList;\n /** Items which should be disposed before exit only */\n private _finalDisposableList: AutoDisposableList;\n private _hasCalledExit = false;\n private _args: string[];\n private _sigintCount = 0;\n private _onInterrupt?: () => void;\n private _getMessageOnInterrupt?: () => string;\n\n /** Active `CommandExecutor` instances. In tests, there may be more than one. */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- options type isn't used\n private static _activeInstances = new Set<CommandExecutor<any>>();\n /** Mock implementation of `process.exit` for testing purposes. */\n private static _mockProcessExit: typeof process.exit | undefined;\n\n /**\n * Set a mock `process.exit()` implementation for tests, to handle cases where the command would\n * call `process.exit()`.\n */\n public static mockProcessExitForTests(mockImpl: typeof process.exit | undefined): void {\n CommandExecutor._mockProcessExit = mockImpl;\n }\n\n /**\n * For testing use only: end all active CommandExecutor instances and call `process.exit()`\n * (which should be mocked by the test).\n */\n public static async exitAllForTests(params: CommandExitParams): Promise<void> {\n for (const instance of CommandExecutor._activeInstances) {\n await instance._exit(params);\n }\n CommandExecutor._activeInstances = new Set();\n }\n\n /**\n * Get a list of the commands that are running, including their arguments.\n */\n public static getRunningCommands(): string[] {\n return Array.from(CommandExecutor._activeInstances).map((instance) =>\n [instance._verb, ...instance._args].join(' '),\n );\n }\n\n constructor(params: CommandExecutorParams<TOptions>) {\n this._args = params.args;\n this._options = params.options;\n this._execute = params.execute;\n this._programOptions = params.programOptions;\n this._verb = params.verb;\n this._discoverAppPaths = params.discoverAppPaths;\n this._enableReporterReset = !!params.enableReporterReset;\n this._applyOptionsToConfig = params.applyOptionsToConfig;\n\n this._autoDisposableList = new AutoDisposableList();\n this._finalDisposableList = new AutoDisposableList();\n this._finalDisposableList.add(this._autoDisposableList);\n\n if (this._enableReporterReset) {\n // If running an interactive command, start by clearing the screen\n this._reporter = new TaskReporter({ enableReset: true });\n this._reporter.reset();\n } else {\n this._reporter = new TaskReporter();\n }\n this._finalDisposableList.add(this._reporter);\n\n CommandExecutor._activeInstances.add(this);\n this._finalDisposableList.add({\n dispose: () => {\n CommandExecutor._activeInstances.delete(this);\n\n // Command event listeners are currently only removed on final disposal since the start tests rely on\n // a 'ready' event listener carrying over across restarts.\n this._programOptions.commandEvents.removeAllListeners();\n },\n });\n\n // Handle SIGINT (Ctrl+C) and unhandled errors. These must be removed in _exit.\n // (Skip in tests to avoid interfering with test framework handling.)\n if (!environmentInfo.isJest) {\n process.on('SIGINT', this._sigintHandler);\n // This should also catch unhandled promise rejections\n process.on('uncaughtException', this._uncaughtExceptionHandler);\n process.on('error', this._unexpectedErrorHandler);\n // Also override process.exit in case some code calls it directly.\n // eslint-disable-next-line no-restricted-properties -- central handling code\n process.exit = ((code) => {\n // Get the call stack to display\n const error = new Error(`Unexpected process.exit(${code ?? ''}) call`);\n void this._exit({\n message: error.stack || '',\n hasErrors: true,\n exitCode: 1,\n });\n }) as typeof process.exit;\n\n this._finalDisposableList.add({\n dispose: () => {\n process.off('SIGINT', this._sigintHandler);\n process.off('uncaughtException', this._uncaughtExceptionHandler);\n process.off('error', this._unexpectedErrorHandler);\n // eslint-disable-next-line no-restricted-properties\n process.exit = realProcessExit;\n },\n });\n }\n }\n\n /**\n * Run the command, including handling for restarts. This should only be called once per instance,\n * immediately after the constructor (since constructors can't be async).\n */\n public async execute(): Promise<void> {\n try {\n let shouldRestart = false;\n do {\n shouldRestart = await this._executeOnce(shouldRestart);\n } while (shouldRestart);\n } catch (error) {\n // If an error occurs, exit the process with a non-zero exit code.\n const err = error as InvalidCloudpackConfigError;\n const message = err.isExpected\n ? err.message // Only show message for expected errors\n : err.stack || err.message || String(error); // Show full stack for unexpected errors\n\n await this._exit({\n hasErrors: true,\n message,\n });\n }\n }\n\n /**\n * Execute a single iteration of the command.\n * @returns true if a restart is needed\n */\n private async _executeOnce(isRestart: boolean): Promise<boolean> {\n const contexts = await this._initializeContexts();\n\n if (!Array.isArray(contexts)) {\n await this._exit(contexts);\n return false;\n }\n\n const spanName = `${this._verb.toUpperCase().replace(/ /g, '_')}_EXECUTE`;\n const results: CommandExitParams[] = [];\n\n for (const context of contexts) {\n // Call the execute function which is the real command logic\n // (ie: real init command logic, real start command logic, etc.)\n const result = await context.telemetryClient.tracer.startActiveSpan(spanName, async (span) => {\n this._onInterrupt = () => {\n span.setAttribute('isInterrupted', true);\n span.end();\n };\n\n const isMultiApp = contexts.length > 1;\n if (isMultiApp) {\n console.log();\n console.log(`==== Starting ${this._verb} for ${context.appName} ====`);\n }\n\n return this._execute({\n ...context,\n span,\n isMultiApp,\n args: this._args,\n options: this._options,\n commandEvents: this._programOptions.commandEvents,\n isRestart,\n autoDispose: (disposable) => this._autoDisposableList.add(disposable),\n setInterruptMessageHandler: (getMessage) => {\n this._getMessageOnInterrupt = getMessage;\n },\n });\n });\n if (result?.isInterrupted) {\n await this._exit(result);\n return false;\n }\n if (result) {\n results.push(result);\n } else {\n // If the command returned null, this means it should keep running (e.g. start).\n // We disallow returning undefined to avoid accidents.\n throw new Error('Command executor must return exit options or null');\n }\n this._onInterrupt = undefined;\n }\n\n // Determine whether a command requested a restart in this iteration.\n const shouldRestart = results.some((r) => r.restart);\n\n if (shouldRestart) {\n // Dispose all registered disposables.\n await this._autoDisposableList.dispose();\n this._reporter.reset(true /* clearOutputs */);\n\n console.warn(results.map((r) => r.message).join('\\n'));\n } else if (results.length) {\n // If one or more apps returned a result, exit.\n await this._exit({\n message: results.map((r) => r.message).join('\\n'),\n hasErrors: results.some((r) => r.hasErrors),\n // If any app returned a non-zero exit code, use that.\n exitCode: results.find(({ exitCode }) => !!exitCode)?.exitCode,\n });\n }\n\n return shouldRestart;\n }\n\n /**\n * Determine the app paths and initialize the context for each app.\n * @returns Context(s), or an exit options object if there was an error. (might also throw on error)\n */\n private async _initializeContexts(): Promise<ExtendedAppCommandContext[] | CommandExitParams> {\n let appPaths: string[];\n\n if (this._discoverAppPaths) {\n // Search for cloudpack configs to determine the app path(s)\n const { app, login } = this._options as unknown as Pick<ReusedOptions, 'app' | 'login'>;\n const appPathsResult =\n this._discoverAppPaths === 'remote'\n ? await discoverRemoteAppPaths({\n options: {\n login,\n cachePath: this._options.cachePath,\n desiredApp: app,\n },\n context: { reporter: this._reporter },\n })\n : await discoverLocalAppPaths({\n cwd: this._programOptions.cwd,\n discover: this._discoverAppPaths,\n desiredApp: app,\n });\n if (!Array.isArray(appPathsResult)) {\n // This means there was an error (or the user cancelled) while getting app paths.\n return appPathsResult;\n }\n appPaths = appPathsResult;\n } else {\n // Just use the cwd\n appPaths = [this._programOptions.cwd];\n }\n\n // The task runner is shared between all apps so that task results can potentially be reused.\n const taskRunner = new TaskRunner();\n\n const readConfig = this._discoverAppPaths === 'remote' ? readRemoteConfigs : readLocalConfigs;\n const configs = await readConfig(appPaths, {\n ...this._getConfigOptionsFromCliOptions(),\n enableDefaultFeatures: true,\n });\n\n const helpMessages = new Set<string>(\n Object.values(configs)\n .filter((c) => c.helpMessage)\n .map((c) => c.helpMessage) as string[],\n );\n\n // Set reporter options and print the product info header\n this._reporter.setOptions({\n productName: 'Cloudpack',\n version: this._programOptions.version,\n description: () => `Running \"${bold(this._programOptions.argv.slice(2).join(' '))}\"`,\n helpMessage: [...helpMessages].join('\\n'),\n plainTextMode: !this._options.color,\n logFile: !!this._options.logFile,\n cwd: this._programOptions.cwd,\n enableReset: this._enableReporterReset,\n ...(this._options.debug\n ? debugLoggingConfig\n : this._options.verbose\n ? verboseLoggingConfig\n : this._options.quiet\n ? noLoggingConfig\n : defaultLoggingConfig),\n });\n\n if (!this._options.debug) {\n this._reporter.ignoreLogMessage('ApplicationInsights:');\n }\n\n // Due to opentelemetry API changes (inability to add span processors after the tracer provider is set),\n // it's necessary to create all telemetry clients upfront. To do that, we need to get other app context first.\n const initialContexts: Record<string, Omit<ExtendedAppCommandContext, 'telemetryClient'>> = {};\n\n for (const appPath of Object.keys(configs)) {\n const config = configs[appPath];\n const definition = await readJson<PackageJson>(path.join(appPath, 'package.json'));\n const { name = path.basename(appPath) } = definition || {};\n\n initialContexts[appPath] = {\n appPath,\n appName: name,\n cachePath: this._options.cachePath,\n config,\n reporter: this._reporter,\n taskRunner,\n };\n }\n\n return this._initTelemetry(initialContexts);\n }\n\n /** Translate certain CLI options into options for `readConfig()`. */\n private _getConfigOptionsFromCliOptions(): ReadConfigOptions {\n // These options don't exist for all commands, but that's fine.\n const options = this._options as Partial<ReusedOptions & SharedOptions>;\n return {\n mode: options.mode,\n logBundleInfo: options.logBundleInfo,\n configFileName: options.config,\n // Handle --bundler by passing it as a universal package override, which will be appended\n // to any user-provided packageSettings so that it takes precedence.\n extraPackageSettings: options.bundler ? [{ match: '*', bundler: options.bundler }] : undefined,\n extraFeatures: options.features,\n extraDefineFlags: options.define,\n ...(this._applyOptionsToConfig?.(this._options) || {}),\n };\n }\n\n private async _initTelemetry(\n appContexts: Record<string, Omit<ExtendedAppCommandContext, 'telemetryClient'>>,\n ): Promise<ExtendedAppCommandContext[]> {\n const telemetryApi = await startTelemetry({\n productVersion: getVersion(import.meta.url),\n logLevel: this._options.verbose ? 'VERBOSE' : this._options.debug ? 'DEBUG' : undefined,\n serviceName: 'cli',\n connectionStrings: Object.fromEntries(\n Object.values(appContexts).map(({ appPath, config }) => [\n appPath,\n this._programOptions.disableTelemetry || environmentInfo.isJest\n ? undefined\n : config.telemetry?.connectionString || environmentInfo.cloudpack.telemetryConnectionString,\n ]),\n ),\n });\n this._autoDisposableList.add({ dispose: () => telemetryApi.shutdown() });\n\n const contexts: ExtendedAppCommandContext[] = [];\n\n for (const [appPath, telemetryClient] of Object.entries(telemetryApi.clients)) {\n // Mark the start time for telemetry.\n const startTime = performance.now();\n\n const { config, appName } = appContexts[appPath];\n contexts.push({\n ...appContexts[appPath],\n telemetryClient,\n });\n\n telemetryClient.tracer.startSpan('CLI_ENTRY', { startTime: getCliStartTime() }).end();\n\n await telemetryClient.tracer.startActiveSpan('INIT_TELEMETRY', { startTime }, (span) => {\n const enabledFeatureNames = Object.entries(config.features || {})\n .filter(([, value]) => value)\n .map(([key]) => key);\n\n if (enabledFeatureNames.length) {\n console.log(`Enabled features for ${appName}: ${enabledFeatureNames.map((f) => yellow(f)).join(', ')}`);\n }\n\n const telemetryAttributes = {\n verb: this._verb,\n arguments: this._programOptions.argv.slice(3).join(' '),\n environment: environmentInfo.isCI ? 'ci' : environmentInfo.isCodespaces ? 'codespaces' : 'local',\n appName: appName || '<unknown>',\n mode: config.mode,\n features: enabledFeatureNames,\n externalCorrelationId: environmentInfo.cloudpack.telemetryExternalCorrelationId,\n // Azure DevOps build attributes\n ...environmentInfo.ado,\n };\n\n for (const [key, value] of Object.entries(telemetryAttributes)) {\n if (value) {\n span.setAttribute(key, value);\n }\n }\n });\n }\n\n return contexts;\n }\n\n private _sigintHandler = (): void => {\n this._sigintCount++;\n\n if (this._sigintCount > 1) {\n console.debug('Forcing exit');\n\n // We are forcing the process to exit.\n // No clean-up is needed because user pressed Ctrl+C twice.\n this._callProcessExit(1);\n return;\n }\n\n this._onInterrupt?.();\n\n // We are trying to exit gracefully.\n void this._exit({ isInterrupted: true, message: '' });\n };\n\n private _uncaughtExceptionHandler: NodeJS.UncaughtExceptionListener = (error, reason) => {\n const errorType = reason === 'uncaughtException' ? 'Uncaught exception' : 'Unhandled promise rejection';\n const message = `${errorType}: ${error.stack || error.message || String(error)}`;\n // Go ahead and log the message in case the process exits before cleanup is complete\n console.error(message);\n\n void this._exit({ message, hasErrors: true, exitCode: 1 });\n };\n\n private _unexpectedErrorHandler = (...args: unknown[]): void => {\n const err = new Error('Unexpected process error');\n console.error(err.stack);\n console.error('Error details:', ...args);\n };\n\n /**\n * Exit function called with the result returned by the command's execute function,\n * or manually via `CommandExecutor.exitAll()` in tests.\n *\n * Except in tests, execution can be assumed to have stopped after this is called.\n * (In tests, `process.exit` is probably mocked to throw.)\n */\n private async _exit(params: CommandExitParams): Promise<void> {\n const { hasErrors = this._reporter.hasErrors(), exitCode = hasErrors ? 1 : 0 } = params;\n const message = params.isInterrupted ? this._getMessageOnInterrupt?.() || 'Interrupted by user' : params.message;\n\n if (this._hasCalledExit) {\n // Skip most of the operations if exit() was called multiple times.\n // But only use the error message if not in a test, due to the way we're mocking process.exit.\n if (!environmentInfo.isJest) {\n const prettyParams = Object.entries(params)\n .map(([key, value]) => `${key}=\"${value}\"`)\n .join(', ');\n console.warn(`exit() was called multiple times. This call's options: ${prettyParams}.`);\n }\n } else {\n this._hasCalledExit = true;\n\n // Show the summary message (this will throw if called twice).\n this._reporter.complete({\n summary: hasErrors ? red(message) : message,\n showHelp: exitCode !== 0,\n });\n\n // Dispose all resources\n await this._finalDisposableList.dispose();\n }\n\n this._callProcessExit(exitCode);\n }\n\n /** Call the mocked or real `process.exit()` function */\n private _callProcessExit(exitCode: number): void {\n (CommandExecutor._mockProcessExit || realProcessExit)(exitCode);\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/cli",
3
- "version": "0.79.1",
3
+ "version": "0.80.0",
4
4
  "description": "The Cloudpack command line interface - a tool for managing fast inner and outer looping in web apps.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -30,25 +30,25 @@
30
30
  "test": "cloudpack-scripts test"
31
31
  },
32
32
  "dependencies": {
33
- "@ms-cloudpack/api-server": "^0.67.1",
34
- "@ms-cloudpack/app-server": "^0.20.65",
35
- "@ms-cloudpack/bundler": "^0.27.27",
36
- "@ms-cloudpack/bundler-capabilities": "^0.5.3",
37
- "@ms-cloudpack/common-types": "^0.34.0",
38
- "@ms-cloudpack/config": "^0.38.39",
39
- "@ms-cloudpack/create-express-app": "^1.10.74",
40
- "@ms-cloudpack/environment": "^0.1.1",
41
- "@ms-cloudpack/file-watcher": "^0.4.33",
42
- "@ms-cloudpack/json-utilities": "^0.1.11",
43
- "@ms-cloudpack/link-proxy": "^0.2.87",
44
- "@ms-cloudpack/overlay": "^0.19.83",
45
- "@ms-cloudpack/package-utilities": "^13.8.1",
46
- "@ms-cloudpack/path-string-parsing": "^1.3.0",
47
- "@ms-cloudpack/path-utilities": "^3.2.10",
48
- "@ms-cloudpack/remote-cache": "^0.11.74",
49
- "@ms-cloudpack/setup-utilities": "^0.5.58",
50
- "@ms-cloudpack/task-reporter": "^0.20.1",
51
- "@ms-cloudpack/telemetry": "^0.11.74",
33
+ "@ms-cloudpack/api-server": "^0.67.3",
34
+ "@ms-cloudpack/app-server": "^0.20.67",
35
+ "@ms-cloudpack/bundler": "^0.27.29",
36
+ "@ms-cloudpack/bundler-capabilities": "^0.5.4",
37
+ "@ms-cloudpack/common-types": "^0.34.1",
38
+ "@ms-cloudpack/config": "^0.38.41",
39
+ "@ms-cloudpack/create-express-app": "^1.10.76",
40
+ "@ms-cloudpack/environment": "^0.1.3",
41
+ "@ms-cloudpack/file-watcher": "^0.4.35",
42
+ "@ms-cloudpack/json-utilities": "^0.1.12",
43
+ "@ms-cloudpack/link-proxy": "^0.2.89",
44
+ "@ms-cloudpack/overlay": "^0.19.85",
45
+ "@ms-cloudpack/package-utilities": "^13.8.3",
46
+ "@ms-cloudpack/path-string-parsing": "^1.3.1",
47
+ "@ms-cloudpack/path-utilities": "^3.2.12",
48
+ "@ms-cloudpack/remote-cache": "^0.11.76",
49
+ "@ms-cloudpack/setup-utilities": "^0.5.59",
50
+ "@ms-cloudpack/task-reporter": "^0.21.1",
51
+ "@ms-cloudpack/telemetry": "^0.12.0",
52
52
  "@yarnpkg/lockfile": "^1.1.0",
53
53
  "commander": "^14.0.0",
54
54
  "cross-spawn": "^7.0.3",
@@ -58,11 +58,11 @@
58
58
  "prompts": "^2.4.2",
59
59
  "semver": "^7.6.0",
60
60
  "tinyglobby": "^0.2.13",
61
- "workspace-tools": "^0.41.0"
61
+ "workspace-tools": "^0.41.3"
62
62
  },
63
63
  "devDependencies": {
64
- "@ms-cloudpack/common-types": "^0.34.0",
65
- "@ms-cloudpack/common-types-browser": "^0.6.5",
64
+ "@ms-cloudpack/common-types": "^0.34.1",
65
+ "@ms-cloudpack/common-types-browser": "^0.6.7",
66
66
  "@ms-cloudpack/eslint-plugin-internal": "^0.0.1",
67
67
  "@ms-cloudpack/scripts": "^0.0.1",
68
68
  "@ms-cloudpack/test-utilities": "^0.5.0",