Skip to content

Commit

Permalink
Merge pull request #944 from zapier/poc_safely_capture_cli_args_in_an…
Browse files Browse the repository at this point in the history
…alytics

PDE-5641: feat(core) capture CLI arguments in analytics safely
  • Loading branch information
Natay authored Jan 9, 2025
2 parents 78bef2a + a01801e commit 9080e9e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/cli/src/utils/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const recordAnalytics = async (command, isValidCommand, args, flags) => {
return;
}
const argKeys = Object.keys(args);

const flagKeys = Object.keys(flags);
const shouldRecordAnonymously = analyticsMode === ANALYTICS_MODES.anonymous;

const integrationIDKey = argKeys.find(
Expand All @@ -50,10 +50,8 @@ const recordAnalytics = async (command, isValidCommand, args, flags) => {
isValidCommand,
numArgs: argKeys.length,
appId: linkedAppId,
flags: {
...flags,
...(command === 'help' ? { helpCommand: argKeys[0] } : {}), // include the beginning of args so we know what they want help on
},
argsKeys: argKeys,
flagKeys: flagKeys,
cliVersion: pkg.version,
os: shouldRecordAnonymously ? undefined : process.platform,
};
Expand Down

0 comments on commit 9080e9e

Please sign in to comment.