Module: vvaharness/lang

docs / modules / lang

← all docs

Module: vvaharness/lang

Role. Language awareness: per-language researcher hints and specialist bodies, plus a tree-sitter call-graph backend.

Size. 3 files · ~1,884 LOC.


flowchart LR IN["Input\nRepo files"] --> ACT["Action\nSelect the right tree-sitter parser and per-language hints"] ACT --> VAL["Validation\n— (deterministic lookup; no validation step)"] VAL --> OUT["Output\nLanguage hints + tree-sitter call graph"]

VVAH analyses many languages, and each needs tailored guidance. This package detects which languages a repo uses and supplies the AI with language-specific hints and specialist "researcher" instructions (crypto, access-control, etc.). It also provides an alternative tree-sitter call-graph builder used when configured.

Explain-it-simply. A phrasebook and local guide for each programming language the tool encounters.

Data-flow (this module)

flowchart LR R[(repo files)] --> DET[hints.detect_languages] DET --> H[hints_for → prompt hints] R --> TS[ts_graph.build → call graph] H -.-> S4[s4_deepdive] TS -.-> S1[s1_preprocess]

Technical details

flowchart LR IN["Input\nRepo files"] --> ACT["Action\nSelect the right tree-sitter parser and per-language hints"] ACT --> VAL["Validation\n— (deterministic lookup; no validation step)"] VAL --> OUT["Output\nLanguage hints + tree-sitter call graph"]

hints.py (~1,390 LOC) holds EXT_TO_LANG/LANG_HINTS/SPECIALIST_HINTS, language sniffing (_sniff_lang, detect_languages), IaC detection (is_iac_file), framework blocks, and hints_for used by S4/S6/S8 prompts. ts_graph.py is the tree-sitter call-graph backend for step1.call_graph: tree_sitter (available, build).

File map (quick scan)

File LOC Purpose
lang/__init__.py 15 —
lang/hints.py 1392 Language-specific researcher hints + specialist researcher bodies.
lang/ts_graph.py 477 tree-sitter call-graph backend for step1.call_graph: tree_sitter.

Files & functions, explained

Every class and function below has a one-line plain-English note — readable whether you write code or not. _name marks an internal helper.

lang/__init__.py

15 LOC. Utility / support module.

No top-level classes or functions (package init / constants).

lang/hints.py

1392 LOC. Language-specific researcher hints + specialist researcher bodies.

Functions - is_iac_file() — Checks / decides the infrastructure config file step. - _read_head() — (internal helper) looks up / reads the head value. - _sniff_lang() — (internal helper) looks up / reads the lang value. - detect_languages() — Looks up / reads the languages value. - _framework_blocks() — (internal helper) Provides the “web framework blocks” logic. - hints_for() — Provides the “hints for” logic.

lang/ts_graph.py

477 LOC. tree-sitter call-graph backend for step1.call_graph: tree_sitter.

Functions - available() — Provides the “available” logic. - _normalize_lang_for_queries() — (internal helper) reads and cleans up the lang for queries step. - _captures() — (internal helper) checks / decides the captures value. - _compile() — (internal helper) Provides the “compile” logic. - _parse_file() — (internal helper) reads and cleans up the file value. - _enclosing() — (internal helper) Provides the “enclosing” logic. - build() — Builds / writes the build value.


See also: HLD · LLD · Data Flow · module index.