Skip to content

Bash extractor: record script invocations (python3 x.py, bash y.sh) as edges #3802

Description

@localseomax-ben

The bash extractor records functions, source imports and calls between functions, but not the
programs a script runs. In a pipeline driven by a shell script, that is most of what the script does:

python3 scripts/stage_one.py --client "$C"
bash scripts/other_step.sh "$C"
"$PYTHON" scripts/stage_two.py

None of these produce an edge today, so graphify path "runner.sh" "stage_one.py" finds nothing and the
orchestrator looks disconnected from every stage it runs.

Checked on 0.8.44 and 0.9.67 (graphify/extractors/bash.py): on a 2,000+ line orchestrator script the
extractor produced 20 nodes and 30 edges (defines 18, calls 11, contains 1) and zero edges to other files.

Suggestion: when a command's first word is an interpreter (python, python3, bash, sh, node, or a
variable like "$PYTHON") and an argument is a path to a file in the repo, add an invokes edge from
the script to that file. Plain ./path/to/tool could be treated the same way.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions