feat(cli): add --debug-app and --debug-cli flags#1604
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
At the expense of losing the way to write |
Pull request was converted to draft
mrgrain
left a comment
There was a problem hiding this comment.
Almost there, but the whole--debug implies both targets things needs better modelling. we can change the configuration generator package.
|
Reworked the |
There was a problem hiding this comment.
this is always shown, removing the double up
When something goes wrong during a
cdkrun, the usual advice is "run again with--debug". Until now that single switch turned on both extra output from the CDK app during synthesis (viaCDK_DEBUG) and verbose AWS SDK tracing from the CLI at the same time, with no way to ask for just one. When you are troubleshooting it is often useful to know whether the problem lives in the CDK app or in the CLI itself, and the combined firehose of output makes that harder than it needs to be.This adds two more granular flags,
--debug-appand--debug-cli, while keeping--debugas the broad "turn everything on" switch that implies both.--debug-apponly enables app debugging (setsCDK_DEBUG, which logs additional information during synthesis such as creation stack traces of tokens, and slows synthesis down), and--debug-clionly enables verbose AWS SDK tracing in the CLI. The intent is to keep the simple "just add--debug" experience as the default while letting people who already know where to look cut down the noise.All three are plain boolean flags. An earlier iteration modelled this as a value-carrying
--debug=app|cli, but yargs cannot offer an optional flag value without greedily consuming the following token (socdk deploy --debug MyStackwould lose the stack selector), and working around that required rewriting the argument list before parsing. Three booleans avoid that problem entirely.App and CLI debugging are tracked as separate configuration settings (
debugApp/debugCli) so they can be reasoned about independently. App debugging continues to drive theCDK_DEBUGenvironment variable for the synthesized app; the previousdebugsetting is still honored as a fallback so existing configurations keep working.Finally,
cdk doctornow reports the resolved CLI configuration — whether app and CLI debugging are enabled, and the current verbosity level — so it is easy to confirm what the CLI thinks it was asked to do.Fixes #
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license