get_file_context_paths

Returns file paths that the specified file depends on.

Arguments

NameTypeDescriptionRequired

path_to_file

string

The path to the file to get the context paths for.

depth

number

The depth of the context to get for the file. Defaults to 3.

preferred_extensions

array

The allowed extensions to match in the returned context

rules

array

The rules to use to extract dependencies and build relationships between files.

rules.type

string

The type of connection. Must be one of the following: `resolve_path`, `string_match`

rules.source_patterns

array

The patterns to match in the file content. The matched content will be used to search the codebase for dependencies.

rules.target_patterns

array

Patterns to find relevant files in the codebase. These use placeholders like {1}, {2} which are replaced by matches from the source pattern after applying transformations (if any).

rules.match_transformations

array

The transformations to apply to the matches found by the source pattern. These must be one of the following: `upper_case`, `lower_case`, `camel_case`, `snake_case`, `kebab_case`

are_global

boolean

Whether the files found should be registered as global files that should be included in the context for the entire codebase.

Returns

TypeDescription

array

A list of file paths that the specified file depends on up to the specified depth.

Example

- name: get_file_context_paths
  arguments:
    path_to_file: <file-path>
    depth: 3
    preferred_extensions: ['tsx', 'ts']
    rules:
      - type: string_match
        source_patterns:
          - import (.*) from "(.*)"
        match_transformations:
          - camel_case
        target_patterns:
          - 'export {1}'
          - 'export default {1}'
          - 'templateUrl: {2}'
  returns: <file-paths>

Last updated