aws / aws/aws-cdk-cli

(cli): git-like subcommand extension system

Open
#781 12 comments 2 reactions 0 assignees View on GitHub
effort/medium feature-request p2
Dominant language
TypeScript
Stars
105
Forks
122
Avg merge
1d 17h
Merged PRs (30d)
71

Description

### Description

I'd like the CDK CLI to support a git-like subcommand system wherein users can type `cdk ` and have the CDK CLI lookup and run a standalone executable (potentially named `cdk-`).

### Use Case

In https://github.com/aws/aws-cdk/issues/18949, we attempted to introduce a `cdk exec` command to tighten up local development for lambdas and step functions. While the use case identified a legitimate pain point, and the concept of the command was well-received, AWS members expressed concerns both in terms of ownership of the feature and in adding more surface area to the CDK CLI.

Alternatively, we considered whether other AWS teams and the community could create stand-alone tools to interact with the cloud assembly to provide the desired functionality. While possible, these tools would have poor discoverability and could contribute to ecosystem fragmentation.

### Proposed Solution

When the user types `cdk `, and if CDK doesn't know the subcommand, the CDK CLI should search the path for a command called `cdk-`. If found, the CDK CLI should run it, passing all arguments.

Meanwhile, if NPM packages implement this pattern, adding a keyword like `cdk-extension` should allow Construct Hub users to discover this extension.

### Other information

First suggested by @rix0rrr in aws/aws-cdk#18949

**Possible extensions:**
- [`cdk-exec`](https://github.com/wheatstalk/aws-cdk-exec) - Executes a Lambda or State Machine when given a cloud assembly and a path to the construct
- `cdk-describe` - Lists the physical id and physical resource attributes of any resources backing a construct
- `cdk-pipeline` - Pretty-print the CDK Pipeline's current status
- `cdk-integ` - Provides an `IntegrationTest` construct and a subcommand extension to run one, some, or all of them, and report on the results.

**Links:**
["How to integrate new subcommands"](https://gitirc.eu/howto/new-command.html) - Git IRC guide for how to add git subcommands. This might help to get a flavor for how Git accomplishes this.

### Acknowledge

- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.