feat(jsii-reflect): add a jsii-query tool#4952
Merged
Conversation
`jsii-query` can be used for fine-grained queries on a JSII assembly.
```
jsii-query <FILE> [QUERY...]
Queries a jsii file for its entries.
Positionals:
FILE path to a .jsii file or directory to load [string]
QUERY a query or filter expression to include or exclude items [string]
Options:
--help Show help [boolean]
--version Show version number [boolean]
-t, --types after selecting API elements, show all selected types, as well
as types containing selected members [boolean] [default: false]
-m, --members after selecting API elements, show all selected members, as
well as members of selected types [boolean] [default: false]
-c, --closure Load dependencies of package without assuming its a JSII
package itself [boolean] [default: false]
REMARKS
-------
There can be more than one QUERY part, which progressively filters from or adds
to the list of selected elements.
QUERY is of the format:
<op><kind>[:<expression>]
Where:
<op> The type of operation to apply
+ Adds new API elements matching the selector to the selection.
If this selects types, it also includes all type's members.
- Removes API elements from the current selection that match
the selector.
. Removes API elements from the current selection that do NOT
match the selector (i.e., retain only those that DO match
the selector).
<kind> Type of API element to select. One of 'type' or 'member',
or any of its more specific sub-types such as 'class',
'interface', 'struct', 'enum', 'property', 'method', etc.
Also supports aliases like 'c', 'm', 'mem', 's', 'p', etc.
<expression> A JavaScript expression that will be evaluated against
the member. Has access to a number of attributes like
kind, ancestors, abstract, base, datatype, docs, interfaces,
name, initializer, optional, overrides, protected, returns,
parameters, static, variadic, type. The types are the
same types as offered by the jsii-reflect class model.
This file evaluates the expressions as JavaScript, so this tool is not safe
against untrusted input!
EXAMPLES
-------
Select all methods with "grant" in their name:
$ jsii-query node_modules/aws-cdk-lib --members '.method:name.includes("grant")'
```
mrgrain
approved these changes
Oct 28, 2025
Contributor
|
Thank you for contributing! ❤️ I will now look into making sure the PR is up-to-date, then proceed to try and merge it! |
Contributor
|
Merging (with squash)... |
Contributor
|
This pull request has been removed from the queue for the following reason: The merge conditions cannot be satisfied due to failing checks:You may have to fix your CI before adding the pull request to the queue again. |
This was referenced Nov 19, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
jsii-querycan be used for fine-grained queries on a JSII assembly.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.