Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9fc55c9
initial commit
vivian12300 Aug 8, 2025
9b70483
time
vivian12300 Aug 11, 2025
643dfcb
batching flags
vivian12300 Aug 12, 2025
7de599d
Merge branch 'main' of https://github.com/vivian12300/aws-cdk-cli int…
vivian12300 Aug 12, 2025
ecac271
add parallelism and tests
vivian12300 Aug 14, 2025
4c15669
remove time markers
vivian12300 Aug 14, 2025
01ba37e
Merge branch 'main' into safe
vivian12300 Aug 14, 2025
9efedee
Merge remote-tracking branch 'upstream/main' into safe
vivian12300 Aug 14, 2025
50eacb8
Merge branch 'safe' of https://github.com/vivian12300/aws-cdk-cli int…
vivian12300 Aug 14, 2025
fa69665
initial commit
vivian12300 Aug 8, 2025
326b6cb
time
vivian12300 Aug 11, 2025
1a11119
batching flags
vivian12300 Aug 12, 2025
dd5d21e
add parallelism and tests
vivian12300 Aug 14, 2025
d5e1268
remove time markers
vivian12300 Aug 14, 2025
700706a
Merge branch 'safe' of https://github.com/vivian12300/aws-cdk-cli int…
vivian12300 Aug 14, 2025
41c80dd
Merge branch 'aws:main' into safe
vivian12300 Aug 14, 2025
5896ee2
self-mutation
vivian12300 Aug 15, 2025
f8d75c0
self mutation
vivian12300 Aug 15, 2025
90e1f1f
address PR comments
vivian12300 Aug 18, 2025
80f3b94
refactor code
vivian12300 Aug 19, 2025
da911ff
address PR comments
vivian12300 Aug 26, 2025
d08e6b4
Merge branch 'main' into safe
vivian12300 Aug 26, 2025
e43201a
clean up merge
vivian12300 Aug 26, 2025
0e78609
refactor code
vivian12300 Aug 29, 2025
ed90a47
Merge remote-tracking branch 'origin/main' into pr/vivian12300/798
rix0rrr Sep 9, 2025
21c7b53
Merge remote-tracking branch 'origin/main' into pr/vivian12300/798
rix0rrr Sep 18, 2025
4913f0b
Fix imports
rix0rrr Sep 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .projenrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,7 @@ const cli = configureProject(
'glob',
'minimatch',
'p-limit@^3',
'p-queue@^6',
'promptly',
'proxy-agent',
'semver',
Expand Down
80 changes: 80 additions & 0 deletions packages/@aws-cdk/cli-lib-alpha/THIRD_PARTY_LICENSES
Original file line number Diff line number Diff line change
Expand Up @@ -22090,6 +22090,32 @@ SOFTWARE.



----------------

** [email protected] - https://www.npmjs.com/package/eventemitter3/v/4.0.7 | MIT
The MIT License (MIT)

Copyright (c) 2014 Arnout Kazemier

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


----------------

** [email protected] - https://www.npmjs.com/package/fast-deep-equal/v/3.1.3 | MIT
Expand Down Expand Up @@ -22846,6 +22872,32 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


----------------

** [email protected] - https://www.npmjs.com/package/p-finally/v/1.0.0 | MIT
The MIT License (MIT)

Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


----------------

** [email protected] - https://www.npmjs.com/package/p-limit/v/2.3.0 | MIT
Expand Down Expand Up @@ -22888,6 +22940,34 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


----------------

** [email protected] - https://www.npmjs.com/package/p-queue/v/6.6.2 | MIT
MIT License

Copyright (c) Sindre Sorhus <[email protected]> (https://sindresorhus.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


----------------

** [email protected] - https://www.npmjs.com/package/p-timeout/v/3.2.0 | MIT
MIT License

Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


----------------

** [email protected] - https://www.npmjs.com/package/p-try/v/2.2.0 | MIT
Expand Down
1 change: 1 addition & 0 deletions packages/@aws-cdk/toolkit-lib/lib/toolkit/toolkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1393,3 +1393,4 @@ export class Toolkit extends CloudAssemblySourceBuilder {
}
}
}

5 changes: 5 additions & 0 deletions packages/aws-cdk/.projen/deps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 80 additions & 0 deletions packages/aws-cdk/THIRD_PARTY_LICENSES
Original file line number Diff line number Diff line change
Expand Up @@ -21883,6 +21883,32 @@ SOFTWARE.



----------------

** [email protected] - https://www.npmjs.com/package/eventemitter3/v/4.0.7 | MIT
The MIT License (MIT)

Copyright (c) 2014 Arnout Kazemier

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


----------------

** [email protected] - https://www.npmjs.com/package/fast-deep-equal/v/3.1.3 | MIT
Expand Down Expand Up @@ -22639,6 +22665,32 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


----------------

** [email protected] - https://www.npmjs.com/package/p-finally/v/1.0.0 | MIT
The MIT License (MIT)

Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


----------------

** [email protected] - https://www.npmjs.com/package/p-limit/v/2.3.0 | MIT
Expand Down Expand Up @@ -22681,6 +22733,34 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


----------------

** [email protected] - https://www.npmjs.com/package/p-queue/v/6.6.2 | MIT
MIT License

Copyright (c) Sindre Sorhus <[email protected]> (https://sindresorhus.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


----------------

** [email protected] - https://www.npmjs.com/package/p-timeout/v/3.2.0 | MIT
MIT License

Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


----------------

** [email protected] - https://www.npmjs.com/package/p-try/v/2.2.0 | MIT
Expand Down
4 changes: 3 additions & 1 deletion packages/aws-cdk/lib/cli/cli-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ export async function makeConfig(): Promise<CliConfig> {
unconfigured: { type: 'boolean', desc: 'Modify unconfigured feature flags', requiresArg: false },
recommended: { type: 'boolean', desc: 'Change flags to recommended states', requiresArg: false },
default: { type: 'boolean', desc: 'Change flags to default state', requiresArg: false },
interactive: { type: 'boolean', alias: ['i'], desc: 'Interactive option for the flags command', requiresArg: false },
interactive: { type: 'boolean', alias: ['i'], desc: 'Interactive option for the flags command' },
safe: { type: 'boolean', desc: 'Enable all feature flags that do not impact the user\'s application', requiresArg: false },
concurrency: { type: 'number', alias: ['n'], desc: 'Maximum number of simultaneous synths to execute.', default: 4, requiresArg: true },
},
},
'deploy': {
Expand Down
15 changes: 14 additions & 1 deletion packages/aws-cdk/lib/cli/cli-type-registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,21 @@
"alias": [
"i"
],
"desc": "Interactive option for the flags command",
"desc": "Interactive option for the flags command"
},
"safe": {
"type": "boolean",
"desc": "Enable all feature flags that do not impact the user's application",
"requiresArg": false
},
"concurrency": {
"type": "number",
"alias": [
"n"
],
"desc": "Maximum number of simultaneous synths to execute.",
"default": 4,
"requiresArg": true
}
}
},
Expand Down
5 changes: 3 additions & 2 deletions packages/aws-cdk/lib/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import type { Settings } from '../api/settings';
import { contextHandler as context } from '../commands/context';
import { docs } from '../commands/docs';
import { doctor } from '../commands/doctor';
import { handleFlags } from '../commands/flag-operations';
import { FlagCommandHandler } from '../commands/flags/flags';
import { cliInit, printAvailableTemplates } from '../commands/init';
import { getMigrateScanType } from '../commands/migrate';
import { execProgram, CloudExecutable } from '../cxapp';
Expand Down Expand Up @@ -501,7 +501,8 @@ export async function exec(args: string[], synthesizer?: Synthesizer): Promise<n
unstableFeatures: configuration.settings.get(['unstable']),
});
const flagsData = await toolkit.flags(cloudExecutable);
return handleFlags(flagsData, ioHelper, args, toolkit);
const handler = new FlagCommandHandler(flagsData, ioHelper, args, toolkit);
return handler.processFlagsCommand();

case 'synthesize':
case 'synth':
Expand Down
4 changes: 4 additions & 0 deletions packages/aws-cdk/lib/cli/convert-to-user-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ export function convertYargsToUserInput(args: any): UserInput {
recommended: args.recommended,
default: args.default,
interactive: args.interactive,
safe: args.safe,
concurrency: args.concurrency,
FLAGNAME: args.FLAGNAME,
};
break;
Expand Down Expand Up @@ -391,6 +393,8 @@ export function convertConfigToUserInput(config: any): UserInput {
recommended: config.flags?.recommended,
default: config.flags?.default,
interactive: config.flags?.interactive,
safe: config.flags?.safe,
concurrency: config.flags?.concurrency,
};
const deployOptions = {
all: config.deploy?.all,
Expand Down
12 changes: 12 additions & 0 deletions packages/aws-cdk/lib/cli/parse-command-line-arguments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,19 @@ export function parseCommandLineArguments(args: Array<string>): any {
type: 'boolean',
alias: ['i'],
desc: 'Interactive option for the flags command',
})
.option('safe', {
default: undefined,
type: 'boolean',
desc: "Enable all feature flags that do not impact the user's application",
requiresArg: false,
})
.option('concurrency', {
default: 4,
type: 'number',
alias: ['n'],
desc: 'Maximum number of simultaneous synths to execute.',
requiresArg: true,
}),
)
.command('deploy [STACKS..]', 'Deploys the stack(s) named STACKS into your AWS account', (yargs: Argv) =>
Expand Down
16 changes: 16 additions & 0 deletions packages/aws-cdk/lib/cli/user-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,22 @@ export interface FlagsOptions {
*/
readonly interactive?: boolean;

/**
* Enable all feature flags that do not impact the user's application
*
* @default - undefined
*/
readonly safe?: boolean;

/**
* Maximum number of simultaneous synths to execute.
*
* aliases: n
*
* @default - 4
*/
readonly concurrency?: number;

/**
* Positional argument for flags
*/
Expand Down
38 changes: 38 additions & 0 deletions packages/aws-cdk/lib/commands/flags/flags.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import type { FeatureFlag, Toolkit } from '@aws-cdk/toolkit-lib';
import { InteractiveHandler } from './interactive-handler';
import { FlagOperations } from './operations';
import { FlagOperationRouter } from './router';
import type { FlagOperationsParams } from './types';
import { FlagValidator } from './validator';
import type { IoHelper } from '../../api-private';
import { OBSOLETE_FLAGS } from '../../obsolete-flags';

export class FlagCommandHandler {
private readonly flags: FeatureFlag[];
private readonly router: FlagOperationRouter;
private readonly options: FlagOperationsParams;
private readonly ioHelper: IoHelper;

/** Main component that sets up all flag operation components */
constructor(flagData: FeatureFlag[], ioHelper: IoHelper, options: FlagOperationsParams, toolkit: Toolkit) {
this.flags = flagData.filter(flag => !OBSOLETE_FLAGS.includes(flag.name));
this.options = { ...options, concurrency: options.concurrency ?? 4 };
this.ioHelper = ioHelper;

const validator = new FlagValidator(ioHelper);
const flagOperations = new FlagOperations(this.flags, toolkit, ioHelper);
const interactiveHandler = new InteractiveHandler(this.flags, flagOperations);

this.router = new FlagOperationRouter(validator, interactiveHandler, flagOperations);
}

/** Main entry point that processes the flags command */
async processFlagsCommand(): Promise<void> {
if (this.flags.length === 0) {
await this.ioHelper.defaults.error('The \'cdk flags\' command is not compatible with the AWS CDK library used by your application. Please upgrade to 2.212.0 or above.');
return;
}

await this.router.route(this.options);
}
}
Loading
Loading