[cli] Add strongly typed subcommands for Telemetry methods based on command specification#12446
Conversation
… command specification
🦋 Changeset detectedLatest commit: aca6b91 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
|
||
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| trackCliArgumentCommand(value: string | undefined) { | ||
| // no-op? |
There was a problem hiding this comment.
What's the context here?
There was a problem hiding this comment.
In integration/command.ts, it defines a single argument "command" which presumably is referring to the subcommand - thus, the generic type generates this method name. Question is - do we want to track that "argument:command" separately from the individual "subcommand" methods?
If yes, then we can implement this function. However, it seems redundant to me to track { key: "argument:command", value: "ls" } as well as { key: "subcommand:list", value: "ls" }.
If not, then I could get behind the idea of removing the explicit "command" argument (in command.ts), and then we make the presence of the subcommands array imply that there is a "command" argument (specifically for the help output), but it wouldn't be included in the telemetry generic and therefore we could remove this function (this would all be a follow-up PR if we want to go this route).
There was a problem hiding this comment.
No, tracking the argument and the subcommand feels redundant, I would be interested to see what a removal of the command argument PR would look like.
…is defined (#12456) Follow-up for this comment: #12446 (comment) The `{ name: 'command', required: boolean }` argument no longer needs to be defined - it gets generated in the `--help` output implicitly when there's > 1 `subcommand` entry. * If a subcommand has `default: true` defined, then the help generator will output `[command]` instead of `command` * Helps with data consistency: * There was at least one case where the "command" arg was missing - but subcommands existed (`vc teams`) * A handful of commands had `required: true` when the opposite was correct (and vice versa) - see the updated snapshot file
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## [email protected] ### Major Changes - Migrate `vercel certs` subcommands to their own command specifications ([#12463](#12463)) - Migrate `vercel dns` subcommands to their own command specifications ([#12464](#12464)) - Migrate `vercel alias` subcommands to their own command specifications ([#12458](#12458)) - Migrate `vercel projects` subcommands to their own command specifications ([#12518](#12518)) - Migrate `vercel env` subcommands to their own command specifications ([#12476](#12476)) - Migrate `vercel domains` subcommands to their own command specifications ([#12526](#12526)) - Migrate `vercel git` subcommands to their own command specifications ([#12524](#12524)) - Migrate `vercel teams` subcommands to their own command specifications ([#12496](#12496)) ### Minor Changes - Migrate `vercel promote` subcommands to their own command specifications ([#12480](#12480)) - [cli] add telemetry for `vercel teams switch` ([#12493](#12493)) - Support `multiple: true` for variadic arguments in Command spec ([#12515](#12515)) - Migrate `vercel rollback` subcommands to their own command specifications ([#12519](#12519)) - [cli] add telemetry for --help flag ([#12430](#12430)) - Adds "--target" as a new option for the "redeploy" command. ([#12523](#12523)) - Add strongly typed `subcommands` for Telemetry methods based on command specification ([#12446](#12446)) - Migrate `vercel telemetry` subcommands to their own command specifications ([#12460](#12460)) - Migrate `vercel target` subcommands to their own command specifications ([#12477](#12477)) - [cli] standardize `vercel teams` subcommand routing ([#12473](#12473)) ### Patch Changes - Don't print empty "Options" section in `--help` output (after filtering) ([#12479](#12479)) - [cli] integration resource was always redacted simplify method ([#12547](#12547)) - [cli] minor fixes in vercel target ([#12510](#12510)) - Show `vercel telemetry` subcommand help output ([#12487](#12487)) - [cli] tidy up command config structure `vercel alias` ([#12438](#12438)) - [cli] Use `getAliases` helper in `vercel certs` ([#12489](#12489)) - [cli] separately track integration-resource command ([#12543](#12543)) - [cli] use getAliases helper in vercel env ([#12491](#12491)) - Don't print empty "Examples" section in `--help` output ([#12475](#12475)) - [cli] create standard method for redacted targets ([#12544](#12544)) - [cli] redacting regions until we determine method to get list ([#12553](#12553)) - [cli] use getAliases helper in vercel integration-resource ([#12505](#12505)) - [cli] redact dns records outside allowed types ([#12548](#12548)) - [cli] remove trackCommandError method - unused ([#12546](#12546)) - [cli] derive `vercel alias` subcommand config from subcommand structs ([#12474](#12474)) - [cli] use getAliases in vercel telemetry ([#12509](#12509)) - [cli] use getAliases helper in vercel integration ([#12504](#12504)) - [cli] fix minor issues vercel pull ([#12512](#12512)) - [cli] use getAliases in vercel target ([#12508](#12508)) - Stabilize Chained Prerenders ([#12507](#12507)) - [cli] use subcommandOriginal in telemetry ([#12549](#12549)) - [cli] fix minor issues vercel project ([#12528](#12528)) - Add telemetry to teams list options ([#12440](#12440)) - Misc adjustments for `vercel bisect --help` ([#12478](#12478)) - [cli] redact Extensions ([#12542](#12542)) - fix small issues in telemetry and whoami ([#12468](#12468)) - Make `command` be an implied argument when `subcommands` array is defined ([#12456](#12456)) - [cli] derive Map of aliases from Command structs ([#12472](#12472)) - [cli] Add aliases field to Command ([#12462](#12462)) - Include "integration" command name in synopsis line in `vercel integration <subcommand> --help` output ([#12470](#12470)) - Consistent help output for `--next` option ([#12481](#12481)) - Fix `vercel integration-resource` subcommand help ([#12531](#12531)) - Consistent help output for `--limit` option ([#12482](#12482)) - [cli] rename getAliases helper to nonconflicting name ([#12516](#12516)) - [cli] redact unknown archive formats ([#12550](#12550)) - [cli] use getAliases helper in vercel dns ([#12490](#12490)) - [cli] move scope fetching closer to where its used in `vc bisect` ([#12439](#12439)) - [cli] redact output mode in telemetry method ([#12545](#12545)) - [cli] use subcommandOriginal for help telemetry ([#12552](#12552)) - [cli] fix minor issues vercel alias ([#12539](#12539)) - Fix certs issue to allow domain without subdomain ([#12532](#12532)) - Updated dependencies \[[`03f02e4ae9d3e9c198584acba4231e763d9eb353`](03f02e4), [`736f322093ebbb31d576609467d80d89ba9dc250`](736f322), [`80c8ec3634170c1566a5ce62acf560a9d1926d60`](80c8ec3)]: - @vercel/[email protected] - @vercel/[email protected] ## @vercel/[email protected] ### Minor Changes - Add support for HTTP streaming ([#12557](#12557)) ## @vercel/[email protected] ### Patch Changes - Fix basePath root matching for error pages ([#12559](#12559)) - Stabilize Chained Prerenders ([#12507](#12507)) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…is defined (#12456) Follow-up for this comment: vercel/vercel#12446 (comment) The `{ name: 'command', required: boolean }` argument no longer needs to be defined - it gets generated in the `--help` output implicitly when there's > 1 `subcommand` entry. * If a subcommand has `default: true` defined, then the help generator will output `[command]` instead of `command` * Helps with data consistency: * There was at least one case where the "command" arg was missing - but subcommands existed (`vc teams`) * A handful of commands had `required: true` when the opposite was correct (and vice versa) - see the updated snapshot file
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## [email protected] ### Major Changes - Migrate `vercel certs` subcommands to their own command specifications ([#12463](vercel/vercel#12463)) - Migrate `vercel dns` subcommands to their own command specifications ([#12464](vercel/vercel#12464)) - Migrate `vercel alias` subcommands to their own command specifications ([#12458](vercel/vercel#12458)) - Migrate `vercel projects` subcommands to their own command specifications ([#12518](vercel/vercel#12518)) - Migrate `vercel env` subcommands to their own command specifications ([#12476](vercel/vercel#12476)) - Migrate `vercel domains` subcommands to their own command specifications ([#12526](vercel/vercel#12526)) - Migrate `vercel git` subcommands to their own command specifications ([#12524](vercel/vercel#12524)) - Migrate `vercel teams` subcommands to their own command specifications ([#12496](vercel/vercel#12496)) ### Minor Changes - Migrate `vercel promote` subcommands to their own command specifications ([#12480](vercel/vercel#12480)) - [cli] add telemetry for `vercel teams switch` ([#12493](vercel/vercel#12493)) - Support `multiple: true` for variadic arguments in Command spec ([#12515](vercel/vercel#12515)) - Migrate `vercel rollback` subcommands to their own command specifications ([#12519](vercel/vercel#12519)) - [cli] add telemetry for --help flag ([#12430](vercel/vercel#12430)) - Adds "--target" as a new option for the "redeploy" command. ([#12523](vercel/vercel#12523)) - Add strongly typed `subcommands` for Telemetry methods based on command specification ([#12446](vercel/vercel#12446)) - Migrate `vercel telemetry` subcommands to their own command specifications ([#12460](vercel/vercel#12460)) - Migrate `vercel target` subcommands to their own command specifications ([#12477](vercel/vercel#12477)) - [cli] standardize `vercel teams` subcommand routing ([#12473](vercel/vercel#12473)) ### Patch Changes - Don't print empty "Options" section in `--help` output (after filtering) ([#12479](vercel/vercel#12479)) - [cli] integration resource was always redacted simplify method ([#12547](vercel/vercel#12547)) - [cli] minor fixes in vercel target ([#12510](vercel/vercel#12510)) - Show `vercel telemetry` subcommand help output ([#12487](vercel/vercel#12487)) - [cli] tidy up command config structure `vercel alias` ([#12438](vercel/vercel#12438)) - [cli] Use `getAliases` helper in `vercel certs` ([#12489](vercel/vercel#12489)) - [cli] separately track integration-resource command ([#12543](vercel/vercel#12543)) - [cli] use getAliases helper in vercel env ([#12491](vercel/vercel#12491)) - Don't print empty "Examples" section in `--help` output ([#12475](vercel/vercel#12475)) - [cli] create standard method for redacted targets ([#12544](vercel/vercel#12544)) - [cli] redacting regions until we determine method to get list ([#12553](vercel/vercel#12553)) - [cli] use getAliases helper in vercel integration-resource ([#12505](vercel/vercel#12505)) - [cli] redact dns records outside allowed types ([#12548](vercel/vercel#12548)) - [cli] remove trackCommandError method - unused ([#12546](vercel/vercel#12546)) - [cli] derive `vercel alias` subcommand config from subcommand structs ([#12474](vercel/vercel#12474)) - [cli] use getAliases in vercel telemetry ([#12509](vercel/vercel#12509)) - [cli] use getAliases helper in vercel integration ([#12504](vercel/vercel#12504)) - [cli] fix minor issues vercel pull ([#12512](vercel/vercel#12512)) - [cli] use getAliases in vercel target ([#12508](vercel/vercel#12508)) - Stabilize Chained Prerenders ([#12507](vercel/vercel#12507)) - [cli] use subcommandOriginal in telemetry ([#12549](vercel/vercel#12549)) - [cli] fix minor issues vercel project ([#12528](vercel/vercel#12528)) - Add telemetry to teams list options ([#12440](vercel/vercel#12440)) - Misc adjustments for `vercel bisect --help` ([#12478](vercel/vercel#12478)) - [cli] redact Extensions ([#12542](vercel/vercel#12542)) - fix small issues in telemetry and whoami ([#12468](vercel/vercel#12468)) - Make `command` be an implied argument when `subcommands` array is defined ([#12456](vercel/vercel#12456)) - [cli] derive Map of aliases from Command structs ([#12472](vercel/vercel#12472)) - [cli] Add aliases field to Command ([#12462](vercel/vercel#12462)) - Include "integration" command name in synopsis line in `vercel integration <subcommand> --help` output ([#12470](vercel/vercel#12470)) - Consistent help output for `--next` option ([#12481](vercel/vercel#12481)) - Fix `vercel integration-resource` subcommand help ([#12531](vercel/vercel#12531)) - Consistent help output for `--limit` option ([#12482](vercel/vercel#12482)) - [cli] rename getAliases helper to nonconflicting name ([#12516](vercel/vercel#12516)) - [cli] redact unknown archive formats ([#12550](vercel/vercel#12550)) - [cli] use getAliases helper in vercel dns ([#12490](vercel/vercel#12490)) - [cli] move scope fetching closer to where its used in `vc bisect` ([#12439](vercel/vercel#12439)) - [cli] redact output mode in telemetry method ([#12545](vercel/vercel#12545)) - [cli] use subcommandOriginal for help telemetry ([#12552](vercel/vercel#12552)) - [cli] fix minor issues vercel alias ([#12539](vercel/vercel#12539)) - Fix certs issue to allow domain without subdomain ([#12532](vercel/vercel#12532)) - Updated dependencies \[[`f581d69becc9d431ba65b952fbaa888809f03e97`](vercel/vercel@f581d69), [`32b19e6b90cb14a9911557f075dddd27725291bf`](vercel/vercel@32b19e6), [`6b100c84cb8d02b31f9aee98e3ac689963c24ff6`](vercel/vercel@6b100c8)]: - @vercel/[email protected] - @vercel/[email protected] ## @vercel/[email protected] ### Minor Changes - Add support for HTTP streaming ([#12557](vercel/vercel#12557)) ## @vercel/[email protected] ### Patch Changes - Fix basePath root matching for error pages ([#12559](vercel/vercel#12559)) - Stabilize Chained Prerenders ([#12507](vercel/vercel#12507)) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
subcommadsTelemetry methods (i.e.trackCliSubcommandOpen()) to the strong typing generic type.vercel integrationfamily of (sub)commands, since their commands specification data is already in the correct format.For the rest of the (sub)commands, we still need to wait for #12103, but at least the generic type is now prepared for
subcommandsto be properly defined in the commands' spec.