Skip to content

Conversation

rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Oct 16, 2025

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")'

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

`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")'
```
@rix0rrr rix0rrr requested a review from a team October 16, 2025 12:43
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution/core This is a PR that came from AWS.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant