This project extracts code artifacts from a source tree, builds a call graph, creates text embeddings for each node, and provides tools to query or inspect those embeddings. The main scripts are located in the repository root.
| File | Description |
|---|---|
main.py |
Unified CLI with extract, embed, query, and interactive modes. |
graph.py |
Extraction utilities and call graph helpers. |
embedding.py |
Generates embeddings and FAISS indices. |
query.py |
Searches embeddings and builds prompts for the LLM. |
prompt_builder.py |
Formats search results and function summaries. |
llm.py |
Helper routines for calling the Gemini API. |
interactive_cli.py |
PromptToolkit dialogs for the interactive workflow. |
config.py |
Loads and stores project settings. |
- Extraction –
graph.extract_from_python,extract_from_html,extract_from_markdown,extract_from_javascript, andextract_from_typescriptparse files and return a list of entries.build_call_graphadds every entry to anetworkxgraph (not just functions) andsave_graph_jsonwrites it to disk. - Context Gathering –
graph.gather_contextcollects code from related nodes usingexpand_graph. Direction can be controlled with thebidirectionalsetting. - Embedding Generation –
embedding.generate_embeddingsloads the call graph, gathers context for each node, encodes the text with aSentenceTransformer, and saves a FAISS index. - Querying –
query.mainsearches the embeddings, builds prompts viaprompt_builder.format_summaryand optionally calls an LLM. - Inspection –
graph.analyze_graphprints basic statistics on the generated call graph.
The main.py script orchestrates these utilities via command line or interactive mode.
Run python main.py <command> where <command> is one of:
extract– build a call graph for a projectembed– generate embeddings from a call graphquery– search the embeddings interactivelyinspect– print basic graph statistics
Running main.py without a command launches the interactive workflow. Command
history is stored in the ~/.full_context_history/ directory via
prompt_toolkit.
The interactive search can optionally correct queries using SymSpell when
use_spellcheck is set to true in settings.json.
Scripts print detailed progress information when run with PYTHONLOGLEVEL=DEBUG.
Extraction and embedding generation also show tqdm progress bars for visual
feedback.
Unit tests live in the tests/ directory. Run them with:
pytest -qThe main test file is tests/test_extractors.py which verifies the extractors and call graph generation.
Always run pytest -q before committing changes.