From 55d21af48ebc612b53dc61e10b5d05671c4061f8 Mon Sep 17 00:00:00 2001 From: tobjend Date: Fri, 3 Jul 2026 22:59:51 +0200 Subject: [PATCH] docs: pipeline overview ASCII diagram --- docs/pipeline-overview.txt | 100 +++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 docs/pipeline-overview.txt diff --git a/docs/pipeline-overview.txt b/docs/pipeline-overview.txt new file mode 100644 index 0000000..ef95190 --- /dev/null +++ b/docs/pipeline-overview.txt @@ -0,0 +1,100 @@ +``` + ┌───────────────────────────────┐ + │ Source Code Directory │ + │ (.py .js .ts .kt .rb .go │ + │ .rs .java .c .cpp .h) │ + └──────────┬────────────────────┘ + │ scan_directory() + .gitignore + ▼ + ┌───────────────────────────────┐ + │ Files grouped by extension │ + │ .kt → [a.kt, b.kt, ...] │ + │ .py → [x.py, y.py, ...] │ + └──────────┬────────────────────┘ + │ for each extension + ▼ + ┌───────────────────────────────────────────┐ + │ preprocess_by_method(file_path, code) │ + │ │ + │ tree-sitter parser ◄── _load_grammar() │ + │ + │ + │ highlights.scm query ◄── _load_query() │ + │ │ │ + │ ▼ │ + │ BEHAVIORAL_PREFIXES filter │ + │ (definition./reference./keyword./ │ + │ function/attribute/constructor/ │ + │ label/type.definition/module) │ + │ │ │ + │ ▼ │ + │ _find_method_bodies() │ + │ grouped by body boundaries │ + │ │ │ + │ ▼ │ + │ [(cap, text, line), ...] per method │ + └──────────┬────────────────────────────────┘ + │ list of sequences + ▼ + ┌───────────────────────────────────────────┐ + │ frequency_filter(sequences, 0.2) │ + │ removes symbols in <20% of files │ + └──────────┬────────────────────────────────┘ + │ filtered sequences + ▼ + ┌───────────────────────────────────────────┐ + │ cluster_methods_adaptive() │ + │ │ + │ Try ngram=3 │ + │ ├── _extract_call_tokens() → call seqs │ + │ ├── build ngram→indices index │ + │ ├── top 20 by freq → clusters │ + │ └── if (other) > 60% → ngram=2 → ... │ + │ │ + │ Multi-assignment: no used set │ + │ Methods can be in N clusters │ + └──────────┬────────────────────────────────┘ + │ clusters: [(label, [seqs]), ...] + ▼ + ┌────────────────────────────────────────────────────────┐ + │ For each cluster: │ + │ │ + │ ┌─────────────────────┐ ┌────────────────────────┐ │ + │ │ _extract_imports() │ │ _build_arg_patterns() │ │ + │ │ scan 200 lines │ │ extract_arg_info() │ │ + │ │ for import/from/ │ │ + _classify_arg_node │ │ + │ │ require/#include/ │ │ + _find_arglist_node │ │ + │ │ use/include │ │ + _iterate_arg_nodes │ │ + │ └─────────┬──────────┘ │ + _summarize_arg_info│ │ + │ │ └───────────┬────────────┘ │ + │ ▼ ▼ │ + │ ┌──────────────────────────────────────────────────┐ │ + │ │ infer_ensemble(symbol_seqs) │ │ + │ │ ├── CRX (fast, unordered) │ │ + │ │ ├── iDRegEx (ordered regex) │ │ + │ │ └── kOREInference (noisy, probabilistic) │ │ + │ │ └── pick best by MDL score │ │ + │ └──────────────────────┬───────────────────────────┘ │ + │ ▼ │ + │ (label, result, count, meta) │ + │ meta = {files, imports, arg_patterns, │ + │ packages: _file_to_package(relpath)} │ + └─────────────────────────┬──────────────────────────────┘ + ▼ + ┌─────────────────────────────────────────────────────┐ + │ Output │ + │ │ + │ --format text (default) --format json │ + │ ┌──────────────────┐ ┌──────────────────┐ │ + │ │ .kt: │ │ [{ │ │ + │ │ ├─ assertEquals │ │ "language": │ │ + │ │ │ (327 meth.) │ │ ".kt", │ │ + │ │ │ Grammar: │ │ "conventions": │ │ + │ │ │ assertEquals+│ │ [{...}, ...] │ │ + │ │ │ Imports: ... │ │ }] │ │ + │ │ │ Args(assertEquals): │ │ │ + │ │ │ n=2 [lit,var]│ │ → inject into │ │ + │ │ ├─ (other) │ │ LLM prompt │ │ + │ │ │ (1254 meth.) │ └──────────────────┘ │ + │ └──────────────────┘ │ + └─────────────────────────────────────────────────────┘ +```