trelix 0.7.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. trelix-0.7.0/.env.example +106 -0
  2. trelix-0.7.0/.github/ISSUE_TEMPLATE/bug_report.md +27 -0
  3. trelix-0.7.0/.github/ISSUE_TEMPLATE/feature_request.md +17 -0
  4. trelix-0.7.0/.github/PULL_REQUEST_TEMPLATE.md +15 -0
  5. trelix-0.7.0/.github/workflows/build-binaries.yml +53 -0
  6. trelix-0.7.0/.github/workflows/ci.yml +47 -0
  7. trelix-0.7.0/.github/workflows/release.yml +125 -0
  8. trelix-0.7.0/.gitignore +60 -0
  9. trelix-0.7.0/.pre-commit-config.yaml +14 -0
  10. trelix-0.7.0/CHANGELOG.md +215 -0
  11. trelix-0.7.0/CONTRIBUTING.md +92 -0
  12. trelix-0.7.0/LICENSE +21 -0
  13. trelix-0.7.0/Makefile +78 -0
  14. trelix-0.7.0/PKG-INFO +487 -0
  15. trelix-0.7.0/README.md +379 -0
  16. trelix-0.7.0/docs/architecture.md +230 -0
  17. trelix-0.7.0/docs/discoverability/AWESOME-LIST-SUBMISSIONS.md +132 -0
  18. trelix-0.7.0/docs/discoverability/ECOSYSTEM-ROADMAP.md +435 -0
  19. trelix-0.7.0/docs/integrations/vscode-plugin.md +98 -0
  20. trelix-0.7.0/docs/superpowers/plans/2026-06-27-llm-client-factory.md +2220 -0
  21. trelix-0.7.0/docs/superpowers/specs/2026-06-27-llm-client-factory-design.md +450 -0
  22. trelix-0.7.0/e2e_test.sh +199 -0
  23. trelix-0.7.0/glama.json +4 -0
  24. trelix-0.7.0/packages/trelix-langchain/LICENSE +21 -0
  25. trelix-0.7.0/packages/trelix-langchain/pyproject.toml +16 -0
  26. trelix-0.7.0/packages/trelix-langchain/src/trelix_langchain/__init__.py +4 -0
  27. trelix-0.7.0/packages/trelix-langchain/src/trelix_langchain/retriever.py +49 -0
  28. trelix-0.7.0/packages/trelix-langchain/tests/__init__.py +0 -0
  29. trelix-0.7.0/packages/trelix-langchain/tests/test_retriever.py +218 -0
  30. trelix-0.7.0/packages/trelix-llama-index/LICENSE +21 -0
  31. trelix-0.7.0/packages/trelix-llama-index/pyproject.toml +16 -0
  32. trelix-0.7.0/packages/trelix-llama-index/src/trelix_llama_index/__init__.py +4 -0
  33. trelix-0.7.0/packages/trelix-llama-index/src/trelix_llama_index/retriever.py +43 -0
  34. trelix-0.7.0/packages/trelix-llama-index/tests/__init__.py +0 -0
  35. trelix-0.7.0/packages/trelix-llama-index/tests/test_retriever.py +181 -0
  36. trelix-0.7.0/packages/trelix-mcp/LICENSE +21 -0
  37. trelix-0.7.0/packages/trelix-mcp/README.md +55 -0
  38. trelix-0.7.0/packages/trelix-mcp/glama.json +4 -0
  39. trelix-0.7.0/packages/trelix-mcp/pyproject.toml +34 -0
  40. trelix-0.7.0/packages/trelix-mcp/server.json +38 -0
  41. trelix-0.7.0/packages/trelix-mcp/src/trelix_mcp/__init__.py +4 -0
  42. trelix-0.7.0/packages/trelix-mcp/src/trelix_mcp/server.py +175 -0
  43. trelix-0.7.0/packages/trelix-mcp/tests/__init__.py +0 -0
  44. trelix-0.7.0/packages/trelix-mcp/tests/test_server.py +215 -0
  45. trelix-0.7.0/pyproject.toml +145 -0
  46. trelix-0.7.0/scripts/build-binary.sh +61 -0
  47. trelix-0.7.0/src/trelix/__init__.py +20 -0
  48. trelix-0.7.0/src/trelix/cli/__init__.py +1 -0
  49. trelix-0.7.0/src/trelix/cli/main.py +560 -0
  50. trelix-0.7.0/src/trelix/core/__init__.py +0 -0
  51. trelix-0.7.0/src/trelix/core/config.py +417 -0
  52. trelix-0.7.0/src/trelix/core/models.py +252 -0
  53. trelix-0.7.0/src/trelix/embedder/__init__.py +21 -0
  54. trelix-0.7.0/src/trelix/embedder/base.py +543 -0
  55. trelix-0.7.0/src/trelix/indexing/__init__.py +0 -0
  56. trelix-0.7.0/src/trelix/indexing/chunker.py +282 -0
  57. trelix-0.7.0/src/trelix/indexing/indexer.py +834 -0
  58. trelix-0.7.0/src/trelix/indexing/parser/__init__.py +0 -0
  59. trelix-0.7.0/src/trelix/indexing/parser/base.py +53 -0
  60. trelix-0.7.0/src/trelix/indexing/parser/extractors/__init__.py +0 -0
  61. trelix-0.7.0/src/trelix/indexing/parser/extractors/c.py +858 -0
  62. trelix-0.7.0/src/trelix/indexing/parser/extractors/cpp.py +800 -0
  63. trelix-0.7.0/src/trelix/indexing/parser/extractors/csharp.py +1174 -0
  64. trelix-0.7.0/src/trelix/indexing/parser/extractors/cshtml.py +238 -0
  65. trelix-0.7.0/src/trelix/indexing/parser/extractors/csproj.py +203 -0
  66. trelix-0.7.0/src/trelix/indexing/parser/extractors/css.py +511 -0
  67. trelix-0.7.0/src/trelix/indexing/parser/extractors/go.py +714 -0
  68. trelix-0.7.0/src/trelix/indexing/parser/extractors/html.py +661 -0
  69. trelix-0.7.0/src/trelix/indexing/parser/extractors/java.py +847 -0
  70. trelix-0.7.0/src/trelix/indexing/parser/extractors/javascript.py +783 -0
  71. trelix-0.7.0/src/trelix/indexing/parser/extractors/json_config.py +373 -0
  72. trelix-0.7.0/src/trelix/indexing/parser/extractors/kotlin.py +812 -0
  73. trelix-0.7.0/src/trelix/indexing/parser/extractors/markdown.py +276 -0
  74. trelix-0.7.0/src/trelix/indexing/parser/extractors/python.py +1084 -0
  75. trelix-0.7.0/src/trelix/indexing/parser/extractors/razor.py +502 -0
  76. trelix-0.7.0/src/trelix/indexing/parser/extractors/ruby.py +764 -0
  77. trelix-0.7.0/src/trelix/indexing/parser/extractors/rust.py +1037 -0
  78. trelix-0.7.0/src/trelix/indexing/parser/extractors/toml_config.py +384 -0
  79. trelix-0.7.0/src/trelix/indexing/parser/extractors/typescript.py +1279 -0
  80. trelix-0.7.0/src/trelix/indexing/parser/extractors/yaml_config.py +252 -0
  81. trelix-0.7.0/src/trelix/indexing/parser/registry.py +189 -0
  82. trelix-0.7.0/src/trelix/indexing/walker.py +171 -0
  83. trelix-0.7.0/src/trelix/indexing/watcher.py +302 -0
  84. trelix-0.7.0/src/trelix/llm/__init__.py +12 -0
  85. trelix-0.7.0/src/trelix/llm/client.py +85 -0
  86. trelix-0.7.0/src/trelix/llm/factory.py +39 -0
  87. trelix-0.7.0/src/trelix/llm/providers/__init__.py +0 -0
  88. trelix-0.7.0/src/trelix/llm/providers/anthropic_backend.py +160 -0
  89. trelix-0.7.0/src/trelix/llm/providers/bedrock_backend.py +240 -0
  90. trelix-0.7.0/src/trelix/llm/providers/litellm_backend.py +121 -0
  91. trelix-0.7.0/src/trelix/llm/providers/openai_backend.py +174 -0
  92. trelix-0.7.0/src/trelix/llm/providers/vertex_backend.py +167 -0
  93. trelix-0.7.0/src/trelix/retrieval/__init__.py +0 -0
  94. trelix-0.7.0/src/trelix/retrieval/assembler.py +207 -0
  95. trelix-0.7.0/src/trelix/retrieval/bm25.py +193 -0
  96. trelix-0.7.0/src/trelix/retrieval/fusion.py +61 -0
  97. trelix-0.7.0/src/trelix/retrieval/graph.py +364 -0
  98. trelix-0.7.0/src/trelix/retrieval/graph_rag.py +272 -0
  99. trelix-0.7.0/src/trelix/retrieval/grep_search.py +170 -0
  100. trelix-0.7.0/src/trelix/retrieval/planner/__init__.py +0 -0
  101. trelix-0.7.0/src/trelix/retrieval/planner/agent.py +502 -0
  102. trelix-0.7.0/src/trelix/retrieval/planner/models.py +226 -0
  103. trelix-0.7.0/src/trelix/retrieval/planner/prompts.py +193 -0
  104. trelix-0.7.0/src/trelix/retrieval/reranker.py +218 -0
  105. trelix-0.7.0/src/trelix/retrieval/retriever.py +633 -0
  106. trelix-0.7.0/src/trelix/retrieval/synthesizer.py +276 -0
  107. trelix-0.7.0/src/trelix/store/__init__.py +0 -0
  108. trelix-0.7.0/src/trelix/store/db.py +1220 -0
  109. trelix-0.7.0/src/trelix/store/vector.py +316 -0
  110. trelix-0.7.0/src/trelix/store/vector_qdrant.py +147 -0
  111. trelix-0.7.0/tests/__init__.py +0 -0
  112. trelix-0.7.0/tests/eval/__init__.py +1 -0
  113. trelix-0.7.0/tests/eval/datasets/__init__.py +1 -0
  114. trelix-0.7.0/tests/eval/datasets/trelix_self.py +127 -0
  115. trelix-0.7.0/tests/eval/harness.py +306 -0
  116. trelix-0.7.0/tests/eval/metrics.py +83 -0
  117. trelix-0.7.0/tests/fixtures/mini_repo/api.py +154 -0
  118. trelix-0.7.0/tests/fixtures/mini_repo/auth.py +77 -0
  119. trelix-0.7.0/tests/fixtures/mini_repo/main.py +81 -0
  120. trelix-0.7.0/tests/fixtures/mini_repo/package.json +12 -0
  121. trelix-0.7.0/tests/fixtures/mini_repo/tsconfig.json +13 -0
  122. trelix-0.7.0/tests/fixtures/mini_repo/user.py +100 -0
  123. trelix-0.7.0/tests/fixtures/mini_repo/utils.py +80 -0
  124. trelix-0.7.0/tests/integration/__init__.py +0 -0
  125. trelix-0.7.0/tests/integration/test_cli.py +242 -0
  126. trelix-0.7.0/tests/integration/test_eval.py +110 -0
  127. trelix-0.7.0/tests/integration/test_indexer.py +205 -0
  128. trelix-0.7.0/tests/integration/test_llm_e2e.py +371 -0
  129. trelix-0.7.0/tests/integration/test_recall.py +203 -0
  130. trelix-0.7.0/tests/integration/test_retriever.py +214 -0
  131. trelix-0.7.0/tests/unit/__init__.py +0 -0
  132. trelix-0.7.0/tests/unit/test_assembler.py +382 -0
  133. trelix-0.7.0/tests/unit/test_bm25.py +234 -0
  134. trelix-0.7.0/tests/unit/test_chunker.py +460 -0
  135. trelix-0.7.0/tests/unit/test_config.py +208 -0
  136. trelix-0.7.0/tests/unit/test_embedder.py +677 -0
  137. trelix-0.7.0/tests/unit/test_fusion.py +205 -0
  138. trelix-0.7.0/tests/unit/test_graph.py +571 -0
  139. trelix-0.7.0/tests/unit/test_graph_rag.py +463 -0
  140. trelix-0.7.0/tests/unit/test_grep.py +258 -0
  141. trelix-0.7.0/tests/unit/test_indexer_async.py +385 -0
  142. trelix-0.7.0/tests/unit/test_llm_anthropic_backend.py +131 -0
  143. trelix-0.7.0/tests/unit/test_llm_bedrock_backend.py +284 -0
  144. trelix-0.7.0/tests/unit/test_llm_client.py +88 -0
  145. trelix-0.7.0/tests/unit/test_llm_litellm_backend.py +76 -0
  146. trelix-0.7.0/tests/unit/test_llm_openai_backend.py +149 -0
  147. trelix-0.7.0/tests/unit/test_llm_vertex_backend.py +90 -0
  148. trelix-0.7.0/tests/unit/test_parser_c.py +322 -0
  149. trelix-0.7.0/tests/unit/test_parser_config.py +741 -0
  150. trelix-0.7.0/tests/unit/test_parser_csharp.py +467 -0
  151. trelix-0.7.0/tests/unit/test_parser_go.py +354 -0
  152. trelix-0.7.0/tests/unit/test_parser_java.py +338 -0
  153. trelix-0.7.0/tests/unit/test_parser_js.py +522 -0
  154. trelix-0.7.0/tests/unit/test_parser_kotlin.py +429 -0
  155. trelix-0.7.0/tests/unit/test_parser_python.py +517 -0
  156. trelix-0.7.0/tests/unit/test_parser_ruby.py +498 -0
  157. trelix-0.7.0/tests/unit/test_parser_rust.py +369 -0
  158. trelix-0.7.0/tests/unit/test_parser_ts.py +611 -0
  159. trelix-0.7.0/tests/unit/test_planner.py +266 -0
  160. trelix-0.7.0/tests/unit/test_planner_adaptive.py +456 -0
  161. trelix-0.7.0/tests/unit/test_store.py +839 -0
  162. trelix-0.7.0/tests/unit/test_store_qdrant.py +325 -0
  163. trelix-0.7.0/tests/unit/test_walker.py +393 -0
  164. trelix-0.7.0/tests/unit/test_watcher.py +457 -0
  165. trelix-0.7.0/trelix.spec +94 -0
@@ -0,0 +1,106 @@
1
+ # trelix environment configuration
2
+ # Copy to .env and fill in values. Never commit .env.
3
+
4
+ # ---------------------------------------------------------------------------
5
+ # Embedding provider (default: local — zero API key needed)
6
+ # ---------------------------------------------------------------------------
7
+ TRELIX_EMBEDDER_PROVIDER=local # local | openai | azure | voyage | local-code
8
+
9
+ # ---------------------------------------------------------------------------
10
+ # OpenAI (embeddings + LLM query planner + synthesis)
11
+ # ---------------------------------------------------------------------------
12
+ # OPENAI_API_KEY=sk-...
13
+ # OPENAI_MODEL=gpt-4o # chat model for planner + synthesizer
14
+ # TRELIX_EMBEDDER_OPENAI_MODEL=text-embedding-3-large
15
+
16
+ # ---------------------------------------------------------------------------
17
+ # Azure OpenAI (alternative to openai provider)
18
+ # ---------------------------------------------------------------------------
19
+ # AZURE_API_KEY=...
20
+ # AZURE_ENDPOINT=https://<resource>.openai.azure.com/
21
+ # AZURE_API_VERSION=2025-04-01-preview
22
+ # AZURE_EMBEDDINGS_MODEL=text-embedding-3-large
23
+ # AZURE_CHAT_MODEL=gpt-4o
24
+
25
+ # ---------------------------------------------------------------------------
26
+ # Voyage AI (best API-based code embeddings — pip install trelix[voyage])
27
+ # CoIR benchmark score: 56.26 avg — best API option for code retrieval
28
+ # ---------------------------------------------------------------------------
29
+ # VOYAGE_API_KEY=pa-...
30
+ # TRELIX_EMBEDDER_VOYAGE_MODEL=voyage-code-3 # 1024-dim, 16k context
31
+
32
+ # ---------------------------------------------------------------------------
33
+ # Cohere reranker (optional, best precision — pip install trelix[rerank])
34
+ # ---------------------------------------------------------------------------
35
+ # COHERE_API_KEY=...
36
+ # COHERE_ENDPOINT=https://... # Azure-deployed Cohere endpoint
37
+ # COHERE_MODEL_RERANK=Cohere-rerank-v4.0-pro
38
+
39
+ # ---------------------------------------------------------------------------
40
+ # Contextual chunking (v0.4.0 — LLM summaries per chunk, 67% better recall)
41
+ # Costs LLM tokens at index time; off by default
42
+ # ---------------------------------------------------------------------------
43
+ # TRELIX_CHUNKER_CONTEXTUAL=false
44
+ # TRELIX_CHUNKER_CONTEXTUAL_MODEL=gpt-4o-mini
45
+ # TRELIX_CHUNKER_CONTEXTUAL_MAX_TOKENS=100
46
+
47
+ # ---------------------------------------------------------------------------
48
+ # Vector store backend (v0.4.0)
49
+ # Default: sqlite (zero-infra). Use qdrant for >500k chunk scale.
50
+ # ---------------------------------------------------------------------------
51
+ # TRELIX_STORE_BACKEND=sqlite # sqlite | qdrant
52
+ # TRELIX_STORE_HNSW=true # enable HNSW O(log n) index
53
+ # TRELIX_STORE_HNSW_M=16
54
+ # TRELIX_STORE_HNSW_EF_SEARCH=50
55
+
56
+ # Qdrant (pip install trelix[qdrant])
57
+ # QDRANT_URL=http://localhost:6333
58
+ # QDRANT_API_KEY=...
59
+ # QDRANT_COLLECTION=trelix
60
+
61
+ # ---------------------------------------------------------------------------
62
+ # Retrieval tuning
63
+ # ---------------------------------------------------------------------------
64
+ # TRELIX_RETRIEVAL_RERANK_PROVIDER=cohere # cohere | cross_encoder
65
+ # TRELIX_RETRIEVAL_RERANK_TOP_N=15
66
+ # TRELIX_RETRIEVAL_CONTEXT_TOKEN_BUDGET=12000
67
+ # TRELIX_RETRIEVAL_SYNTHESIS_MAX_TOKENS=12000
68
+ # TRELIX_RETRIEVAL_GRAPH_IMPORT_MAX_EXTRA=3
69
+
70
+ # GraphRAG map-reduce synthesis (v0.4.0)
71
+ # Activates when results exceed either threshold
72
+ # TRELIX_RETRIEVAL_GRAPH_RAG=true
73
+ # TRELIX_RETRIEVAL_GRAPH_RAG_THRESHOLD_TOKENS=8000
74
+ # TRELIX_RETRIEVAL_GRAPH_RAG_THRESHOLD_RESULTS=20
75
+
76
+ # ---------------------------------------------------------------------------
77
+ # Indexing tuning
78
+ # ---------------------------------------------------------------------------
79
+ # TRELIX_PARSE_WORKERS=4 # parallel parse threads
80
+ # TRELIX_EMBEDDER_EMBED_MAX_TOKENS_PER_BATCH=100000
81
+ # TRELIX_EMBEDDER_TPM_LIMIT=0 # 0 = unlimited
82
+
83
+ # ---------------------------------------------------------------------------
84
+ # LLM provider for chat/synthesis (separate from embedder)
85
+ # Default: reads OPENAI_API_KEY / AZURE_API_KEY from above
86
+ # ---------------------------------------------------------------------------
87
+ # TRELIX_LLM_PROVIDER=openai # openai | azure | anthropic | bedrock | vertex | litellm
88
+ # TRELIX_LLM_MODEL=gpt-4o
89
+
90
+ # Anthropic (pip install trelix[anthropic])
91
+ # ANTHROPIC_API_KEY=sk-ant-...
92
+
93
+ # AWS Bedrock (pip install trelix[bedrock])
94
+ # AWS_REGION=us-east-1
95
+ # AWS_ACCESS_KEY_ID=...
96
+ # AWS_SECRET_ACCESS_KEY=...
97
+ # AWS_PROFILE=my-profile
98
+
99
+ # Vertex AI / Gemini (pip install trelix[vertex])
100
+ # GOOGLE_CLOUD_PROJECT=my-project
101
+ # GOOGLE_CLOUD_LOCATION=us-central1
102
+ # GOOGLE_API_KEY=... (for AI Studio)
103
+
104
+ # LiteLLM passthrough — 100+ providers (pip install trelix[litellm])
105
+ # TRELIX_LLM_PROVIDER=litellm
106
+ # TRELIX_LLM_LITELLM_MODEL=bedrock/claude-3-5-sonnet
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: Bug report
3
+ about: Something isn't working as expected
4
+ labels: bug
5
+ ---
6
+
7
+ ## Description
8
+ <!-- A clear description of the bug -->
9
+
10
+ ## Reproduction
11
+ ```bash
12
+ # Minimal steps to reproduce
13
+ trelix index ./my-repo
14
+ trelix ask ./my-repo "query that fails"
15
+ ```
16
+
17
+ ## Expected behavior
18
+ <!-- What should have happened -->
19
+
20
+ ## Actual behavior
21
+ <!-- What actually happened — include full error output -->
22
+
23
+ ## Environment
24
+ - trelix version: <!-- `pip show trelix` -->
25
+ - Python version: <!-- `python --version` -->
26
+ - OS: <!-- macOS 14, Ubuntu 22.04, etc. -->
27
+ - Provider: <!-- local | openai | azure -->
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an improvement or new capability
4
+ labels: enhancement
5
+ ---
6
+
7
+ ## Problem / motivation
8
+ <!-- What problem does this solve? What can't you do today? -->
9
+
10
+ ## Proposed solution
11
+ <!-- What would you like to see? -->
12
+
13
+ ## Alternatives considered
14
+ <!-- Other approaches you thought about -->
15
+
16
+ ## Additional context
17
+ <!-- Any other relevant details, links, or examples -->
@@ -0,0 +1,15 @@
1
+ ## Summary
2
+ <!-- What does this PR do? 1–3 bullet points. -->
3
+
4
+ ## Changes
5
+ <!-- List the key files changed and why -->
6
+
7
+ ## Test plan
8
+ - [ ] Unit tests pass: `make test-fast`
9
+ - [ ] Full suite passes: `make test`
10
+ - [ ] Lint clean: `make lint`
11
+ - [ ] Type check clean: `make typecheck`
12
+ - [ ] Manual smoke test (if applicable): describe what you ran
13
+
14
+ ## Phase / milestone
15
+ <!-- e.g. "Phase 3 — Embedder abstraction" -->
@@ -0,0 +1,53 @@
1
+ name: Build Binaries
2
+
3
+ on:
4
+ push:
5
+ branches: [develop, main]
6
+ pull_request:
7
+ branches: [main]
8
+ workflow_dispatch:
9
+
10
+ jobs:
11
+ build:
12
+ name: Build trelix (${{ matrix.os }})
13
+ runs-on: ${{ matrix.os }}
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ include:
18
+ - os: macos-latest
19
+ artifact-name: trelix-macos-arm64
20
+ binary-path: dist/trelix
21
+ - os: windows-latest
22
+ artifact-name: trelix-windows-x64
23
+ binary-path: dist/trelix.exe
24
+
25
+ steps:
26
+ - uses: actions/checkout@v4
27
+
28
+ - uses: actions/setup-python@v5
29
+ with:
30
+ python-version: "3.11"
31
+
32
+ - name: Install dependencies
33
+ run: pip install -e ".[local]" && pip install pyinstaller
34
+
35
+ - name: Build binary
36
+ run: pyinstaller trelix.spec --clean --noconfirm
37
+
38
+ - name: Verify binary (macOS)
39
+ if: runner.os == 'macOS'
40
+ run: |
41
+ file dist/trelix
42
+ ./dist/trelix --help
43
+
44
+ - name: Verify binary (Windows)
45
+ if: runner.os == 'Windows'
46
+ run: dist/trelix.exe --help
47
+
48
+ - name: Upload artifact
49
+ uses: actions/upload-artifact@v4
50
+ with:
51
+ name: ${{ matrix.artifact-name }}
52
+ path: ${{ matrix.binary-path }}
53
+ retention-days: 30
@@ -0,0 +1,47 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, develop]
6
+ pull_request:
7
+ branches: [main, develop]
8
+
9
+ jobs:
10
+ lint:
11
+ name: Lint & Type Check
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: actions/setup-python@v5
16
+ with:
17
+ python-version: "3.11"
18
+ - name: Install project + dev deps
19
+ run: pip install -e ".[local,dev]"
20
+ - name: Ruff check
21
+ run: ruff check src/ tests/
22
+ - name: Ruff format check
23
+ run: ruff format --check src/ tests/
24
+ - name: Mypy
25
+ run: mypy src/trelix/ --ignore-missing-imports
26
+
27
+ test:
28
+ name: Test (Python ${{ matrix.python-version }})
29
+ runs-on: ubuntu-latest
30
+ strategy:
31
+ matrix:
32
+ python-version: ["3.11", "3.12"]
33
+ steps:
34
+ - uses: actions/checkout@v4
35
+ - uses: actions/setup-python@v5
36
+ with:
37
+ python-version: ${{ matrix.python-version }}
38
+ - name: Install trelix + dev deps
39
+ run: pip install -e ".[local,dev]"
40
+ - name: Run unit tests
41
+ run: pytest tests/unit/ -v --tb=short
42
+ - name: Upload coverage
43
+ if: matrix.python-version == '3.11'
44
+ uses: actions/upload-artifact@v4
45
+ with:
46
+ name: coverage-report
47
+ path: htmlcov/
@@ -0,0 +1,125 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ jobs:
9
+ build-binaries:
10
+ name: Build trelix (${{ matrix.os }})
11
+ runs-on: ${{ matrix.os }}
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ include:
16
+ - os: macos-latest
17
+ artifact-name: trelix-macos-arm64
18
+ binary-path: dist/trelix
19
+ - os: windows-latest
20
+ artifact-name: trelix-windows-x64
21
+ binary-path: dist/trelix.exe
22
+
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+
26
+ - uses: actions/setup-python@v5
27
+ with:
28
+ python-version: "3.11"
29
+
30
+ - name: Install dependencies
31
+ run: pip install -e ".[local]" && pip install pyinstaller
32
+
33
+ - name: Build binary
34
+ run: pyinstaller trelix.spec --clean --noconfirm
35
+
36
+ - name: Verify binary (macOS)
37
+ if: runner.os == 'macOS'
38
+ run: |
39
+ file dist/trelix
40
+ ./dist/trelix --help
41
+
42
+ - name: Verify binary (Windows)
43
+ if: runner.os == 'Windows'
44
+ run: dist/trelix.exe --help
45
+
46
+ - name: Upload artifact
47
+ uses: actions/upload-artifact@v4
48
+ with:
49
+ name: ${{ matrix.artifact-name }}
50
+ path: ${{ matrix.binary-path }}
51
+ retention-days: 30
52
+
53
+ publish:
54
+ name: Publish to PyPI & GitHub Release
55
+ runs-on: ubuntu-latest
56
+ needs: build-binaries
57
+ environment: pypi
58
+ permissions:
59
+ id-token: write # OIDC trusted publisher (PyPI)
60
+ contents: write # create GitHub Release + upload assets
61
+
62
+ steps:
63
+ - uses: actions/checkout@v4
64
+
65
+ - uses: actions/setup-python@v5
66
+ with:
67
+ python-version: "3.11"
68
+
69
+ - name: Install build tools
70
+ run: pip install build twine
71
+
72
+ - name: Build distributions
73
+ run: python -m build
74
+
75
+ - name: Check distributions
76
+ run: twine check dist/*
77
+
78
+ - name: Publish to PyPI
79
+ uses: pypa/gh-action-pypi-publish@release/v1
80
+
81
+ - name: Build trelix-mcp
82
+ run: cd packages/trelix-mcp && python -m build
83
+
84
+ - name: Publish trelix-mcp to PyPI
85
+ uses: pypa/gh-action-pypi-publish@release/v1
86
+ with:
87
+ packages-dir: packages/trelix-mcp/dist/
88
+
89
+ - name: Build trelix-langchain
90
+ run: cd packages/trelix-langchain && python -m build
91
+
92
+ - name: Publish trelix-langchain to PyPI
93
+ uses: pypa/gh-action-pypi-publish@release/v1
94
+ with:
95
+ packages-dir: packages/trelix-langchain/dist/
96
+
97
+ - name: Build trelix-llama-index
98
+ run: cd packages/trelix-llama-index && python -m build
99
+
100
+ - name: Publish trelix-llama-index to PyPI
101
+ uses: pypa/gh-action-pypi-publish@release/v1
102
+ with:
103
+ packages-dir: packages/trelix-llama-index/dist/
104
+
105
+ - name: Download macOS binary
106
+ uses: actions/download-artifact@v4
107
+ with:
108
+ name: trelix-macos-arm64
109
+ path: release-assets/macos
110
+
111
+ - name: Download Windows binary
112
+ uses: actions/download-artifact@v4
113
+ with:
114
+ name: trelix-windows-x64
115
+ path: release-assets/windows
116
+
117
+ - name: Create GitHub Release with binaries
118
+ uses: softprops/action-gh-release@v2
119
+ with:
120
+ files: |
121
+ release-assets/macos/trelix
122
+ release-assets/windows/trelix.exe
123
+ generate_release_notes: true
124
+ env:
125
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,60 @@
1
+ # Python
2
+ __pycache__/
3
+ *.pyc
4
+ *.pyo
5
+ *.pyd
6
+ .Python
7
+ *.egg-info/
8
+ *.egg
9
+ build/
10
+ .eggs/
11
+ pip-wheel-metadata/
12
+
13
+ # dist/ — ignore generated packaging artefacts; binaries are attached via GitHub Releases.
14
+ dist/
15
+
16
+ # Virtual environments
17
+ .venv/
18
+ venv/
19
+ env/
20
+ ENV/
21
+
22
+ # Trelix index data — never commit these
23
+ .trelix/
24
+
25
+ # Test / coverage artefacts
26
+ .pytest_cache/
27
+ .coverage
28
+ htmlcov/
29
+ .tox/
30
+
31
+ # Ruff / Mypy caches
32
+ .ruff_cache/
33
+ .mypy_cache/
34
+
35
+ # Environment files — secrets must not be committed
36
+ .env
37
+ .env.local
38
+ .env.*.local
39
+
40
+ # Claude Code internal data
41
+ .claude/
42
+
43
+ # uv lockfile (not committed — project uses pip/hatchling)
44
+ uv.lock
45
+
46
+ # Editor / OS
47
+ .DS_Store
48
+ .idea/
49
+ .vscode/
50
+ *.swp
51
+ *.swo
52
+ Thumbs.db
53
+
54
+ # Distribution / packaging
55
+ *.tar.gz
56
+ *.whl
57
+ MANIFEST
58
+ .superpowers/
59
+ packages/trelix-mcp/mcp-publisher
60
+ scratch-pad/
@@ -0,0 +1,14 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.5.0
4
+ hooks:
5
+ - id: ruff
6
+ args: [--fix]
7
+ - id: ruff-format
8
+
9
+ - repo: https://github.com/pre-commit/mirrors-mypy
10
+ rev: v1.10.0
11
+ hooks:
12
+ - id: mypy
13
+ additional_dependencies: [pydantic, pydantic-settings]
14
+ args: [--ignore-missing-imports]
@@ -0,0 +1,215 @@
1
+ # Changelog
2
+
3
+ All notable changes to trelix are documented here.
4
+
5
+ Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) — [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [Unreleased]
8
+
9
+ ---
10
+
11
+ ## [0.7.0] — 2026-06-27
12
+
13
+ ### Overview
14
+ Universal LLM client factory — all 5 chat call sites migrated to a provider-agnostic
15
+ `TrelixChatClient` ABC. Adding any new provider requires zero changes to business logic.
16
+
17
+ ### Added
18
+ - **`src/trelix/llm/` package** — `TrelixChatClient` ABC, `ChatMessage`, `ChatResponse`,
19
+ `ToolCallResponse` dataclasses, `build_chat_client()` factory
20
+ - **`LLMConfig`** — new config class for chat providers (separate from `EmbedderConfig`).
21
+ Added as `IndexConfig.llm` field.
22
+ - **`OpenAIBackend`** — OpenAI + Azure. Auto-detects `max_completion_tokens` vs `max_tokens`
23
+ based on model family (gpt-4o→max_completion_tokens; gpt-4/gpt-3.5→max_tokens)
24
+ - **`AnthropicBackend`** — Anthropic Claude direct. `max_tokens=`, `system=` separate param,
25
+ `input_schema` tool format, `end_turn`→`stop` normalization. `pip install trelix[anthropic]`
26
+ - **`BedrockBackend`** — AWS Bedrock Converse API. `inferenceConfig.maxTokens` (nested camelCase),
27
+ `system=[{"text":...}]` top-level, content always list-of-dicts, `{"auto":{}}` tool choice.
28
+ `pip install trelix[bedrock]`
29
+ - **`VertexBackend`** — Google Vertex AI / Gemini via google-genai SDK. `max_output_tokens` in
30
+ `GenerateContentConfig`, `system_instruction=` param. `pip install trelix[vertex]`
31
+ - **`LiteLLMBackend`** — universal delegate for 100+ providers. `drop_params=True` suppresses
32
+ UnsupportedParamsError. Model strings: `"bedrock/claude-3-5-sonnet"`, `"gemini/gemini-2.0-flash"`.
33
+ `pip install trelix[litellm]`
34
+ - New optional dep groups: `[anthropic]`, `[bedrock]`, `[vertex]`, `[litellm]`, `[llm-all]`
35
+
36
+ ### Changed
37
+ - All 5 LLM call sites now use `TrelixChatClient` via factory — never import provider SDKs directly
38
+ - `ContextualChunker` accepts `TrelixChatClient` (new) or raw openai client (backward compat)
39
+
40
+ ### Fixed
41
+ - `_token_limit_param()` in OpenAIBackend correctly routes legacy models to `max_tokens=`
42
+ and modern models to `max_completion_tokens=` — eliminates the recurring parameter bug
43
+
44
+ ---
45
+
46
+ ## [0.6.0] — 2026-06-27
47
+
48
+ ### Overview
49
+ Contextual chunking is now production-ready — the feature works end-to-end with verified context summaries stored in the database and indexed in BM25. Two bugs fixed that prevented contextual summaries from actually persisting.
50
+
51
+ ### Fixed
52
+ - **Contextual chunking context_summary persistence:** `ContextualChunker.build_chunks()` sets `symbol.context_summary` but the DB insert in `Indexer._insert_one()` happened before chunking ran. Fixed by adding an `UPDATE symbols SET context_summary = ?` pass after `build_chunks()` for any symbols that received summaries. All 66 test symbols now have `context_summary IS NOT NULL`.
53
+ - **Contextual chunking LLM call:** `ContextualChunker._generate_summary()` used `max_tokens=` — unsupported by gpt-4o / newer Azure. Changed to `max_completion_tokens=` (consistent with synthesizer.py fix in v0.3.0).
54
+ - **Test updated:** `test_llm_called_with_correct_arguments` asserts `max_completion_tokens` instead of `max_tokens`.
55
+
56
+ ### Verified
57
+ - 66/66 symbols receive LLM context summaries stored in `symbols.context_summary`
58
+ - Summaries indexed in `symbols_fts` — BM25 searches now include them
59
+ - Recall@5: 10/10 = 100% on mini_repo (baseline maintained)
60
+
61
+ ### How to Enable Contextual Chunking
62
+
63
+ ```bash
64
+ TRELIX_CHUNKER_CONTEXTUAL=true
65
+ TRELIX_CHUNKER_CONTEXTUAL_MODEL=gpt-4o-mini
66
+ TRELIX_EMBEDDER_PROVIDER=openai # or azure
67
+ trelix index ./your-repo
68
+ ```
69
+
70
+ ---
71
+
72
+ ## [0.5.1] — 2026-06-27
73
+
74
+ ### Fixed
75
+ - `trelix-mcp` README: add `<!-- mcp-name: io.github.sairam0424/trelix -->` ownership verification tag required by the official MCP registry
76
+ - `trelix-mcp` server.json: shorten description to ≤100 chars to pass registry validation
77
+
78
+ ---
79
+
80
+ ## [0.5.0] — 2026-06-27
81
+
82
+ ### Overview
83
+ Ecosystem discoverability release — trelix is now reachable across every major surface in the AI developer ecosystem. Three new PyPI packages, MCP registry listing, GitHub Action marketplace, Homebrew tap, and awesome list submissions.
84
+
85
+ ### Added
86
+
87
+ #### New PyPI Packages
88
+ - **`trelix-mcp`** (`pip install trelix-mcp`) — MCP server exposing 4 tools via stdio transport. Works with Claude Code, Cursor, Windsurf, and Continue.dev. One-command setup: `claude mcp add trelix -- trelix-mcp`.
89
+ - `search_code(query, repo_path, k=10)` — hybrid semantic + BM25 code search
90
+ - `index_codebase(repo_path, provider="local")` — index a repository (run once)
91
+ - `get_symbol(qualified_name, repo_path)` — get full source of any symbol
92
+ - `blast_radius(symbol_name, repo_path)` — find everything that depends on a symbol
93
+ - **`trelix-langchain`** (`pip install trelix-langchain`) — `TrelixRetriever(BaseRetriever)` for LangChain RAG pipelines. Returns `list[Document]` with full metadata (file, symbol, language, score, lines).
94
+ - **`trelix-llama-index`** (`pip install trelix-llama-index`) — `TrelixIndexRetriever(BaseRetriever)` for LlamaIndex. Returns `list[NodeWithScore]` with file + symbol metadata.
95
+
96
+ #### Registry & Discovery
97
+ - **Official MCP Registry** — submitted via `mcp-publisher` CLI. Server ID: `io.github.sairam0424/trelix`. Pip ownership verified via `mcp-name` tag in README.
98
+ - **Glama.ai** — `glama.json` added to repo root for automatic Glama MCP directory indexing.
99
+ - **GitHub Actions Marketplace** — `trelix-index-action@v1` at `github.com/sairam0424/trelix-index-action`. Auto-indexes any repo on push with cached `.trelix/index.db`.
100
+ - **Homebrew tap** — `brew tap sairam0424/trelix && brew install trelix` via `github.com/sairam0424/homebrew-trelix`.
101
+ - **Awesome list submissions** — PRs submitted to awesome-mcp-servers (#8787), awesome-llm-apps (#903), awesome-langchain (#426).
102
+
103
+ #### PyPI Metadata
104
+ - 5 new Topic classifiers: `Scientific/Engineering :: Artificial Intelligence`, `Software Development :: Libraries :: Application Frameworks`, `Text Processing :: Indexing`, `Internet :: WWW/HTTP :: Indexing/Search`
105
+ - 21 keywords including `mcp`, `model-context-protocol`, `langchain`, `llama-index`, `code-assistant`, `static-analysis`
106
+ - 3 new README badges: MCP Compatible, LangChain retriever, Downloads
107
+
108
+ #### CI/CD
109
+ - `release.yml` now publishes all 4 packages (`trelix`, `trelix-mcp`, `trelix-langchain`, `trelix-llama-index`) to PyPI on `v*` tag
110
+ - PyPI OIDC trusted publisher configured for all 4 packages (no stored secrets for future releases)
111
+
112
+ #### Documentation
113
+ - `docs/discoverability/ECOSYSTEM-ROADMAP.md` — full ecosystem strategy with registry URLs, submission templates, priority stack
114
+ - `docs/discoverability/AWESOME-LIST-SUBMISSIONS.md` — ready-to-submit PR bodies for 3 awesome lists
115
+ - `packages/trelix-mcp/README.md` — install, Claude Code / Cursor / Windsurf / Continue.dev setup, tools table
116
+ - `packages/trelix-mcp/server.json` — official MCP registry schema for `mcp-publisher`
117
+
118
+ ### Changed
119
+ - `pyproject.toml` version `0.4.0` → `0.5.0`; all sub-packages at `0.5.0` (trelix-mcp at `0.5.1`)
120
+ - `src/trelix/__init__.py` `__version__` updated to `0.5.0`
121
+ - README: added Integrations table (MCP, LangChain, LlamaIndex, GitHub Action, Homebrew), MCP Quick Setup block, LangChain code example, Homebrew install option, GitHub Action quick-start
122
+
123
+ ### Fixed
124
+ - Package builds: `LICENSE` copied into each sub-package (hatchling resolves paths relative to package root, not repo root)
125
+ - `trelix-mcp/__init__.py`: added `__all__ = ["__version__"]` for parity with other packages
126
+ - `trelix-llama-index/retriever.py`: import ordering fix (ruff I001)
127
+ - Test files: removed unused `patch` imports from `trelix-langchain` and `trelix-llama-index` test suites
128
+
129
+ ---
130
+
131
+ ## [0.4.0] — 2026-06-26
132
+
133
+ ### Overview
134
+ Beast-mode upgrade across three axes simultaneously: **retrieval quality** (+49% embedding quality, 67% failure-rate reduction), **scale** (HNSW index, Qdrant backend), and **speed** (4x async pipeline, real-time file watcher). Grounded in 6 adversarially-verified research findings from the CoIR benchmark, Anthropic contextual retrieval research, and VLDB/ACL 2025 proceedings.
135
+
136
+ ### Added
137
+
138
+ #### Quality — Retrieval & Embeddings
139
+ - **Contextual Chunking (U1):** `ContextualChunker` prepends a 2-3 sentence LLM-generated summary to each chunk before embedding AND BM25 indexing. Reduces retrieval failure rate from 5.7% → 1.9% (67% reduction). Config-gated via `TRELIX_CHUNKER_CONTEXTUAL=false` — off by default.
140
+ - **Voyage Code Embedder (U2):** New `voyage` provider using `voyage-code-3` (1024-dim, 16k context). Scores 56.26 avg on CoIR benchmark vs Ada-002's 45.59 (+24%). `pip install trelix[voyage]`.
141
+ - **Local Code Embedder (U2):** New `local-code` provider using `Salesforce/SFR-Embedding-Code-2B_R` (4096-dim, 2B params). Scores 67.41 on CoIR — 49% quality gain over Ada-002. No API key required.
142
+
143
+ #### Scale — Vector Store
144
+ - **Filterable HNSW Index (U3):** O(log n) vector search via sqlite-vec HNSW. Falls back to flat scan on older versions.
145
+ - **Qdrant Optional Backend (U4):** `QdrantVectorStore` drop-in for >500k chunk deployments. `trelix migrate-vectors --to qdrant`. `pip install trelix[qdrant]`.
146
+
147
+ #### Speed — Indexing & Updates
148
+ - **Async Batch Embedding (U5):** Phase 3 runs up to 4 concurrent embed batches via `asyncio.gather`. ~3-4x speedup on large repos.
149
+ - **File Watcher (U6):** `trelix watch <repo>` — 500ms debounced auto-reindex on file save. `pip install trelix[watch]`.
150
+
151
+ #### Intelligence — Planning & Synthesis
152
+ - **Adaptive 3-Tier Query Router (U7):** Tier 1 (direct/skip retrieval) → Tier 2 (8-intent single-step) → Tier 3 (multi-step decomposition).
153
+ - **GraphRAG Map-Reduce Synthesis (U8):** For >20 results or >8k tokens, map-reduce synthesis handles arbitrarily large corpora.
154
+
155
+ #### Precision — Call Graph
156
+ - **Call Graph Precision (U9):** 3-priority callee resolution (qualified_name → type_hint+name → name-only). ~40% fewer false-positive cross-file edges.
157
+
158
+ #### Evaluation
159
+ - **Production Eval Harness (U10):** MRR, Recall@1/5/10, NDCG@10 on 50 trelix-self queries. `make eval-full`.
160
+
161
+ ### Changed
162
+ - New optional dep groups: `[voyage]`, `[qdrant]`, `[watch]`
163
+ - `BaseVectorStore` ABC introduced; `VectorStore` → `SQLiteVectorStore`
164
+ - `QueryPlanner` → `AdaptiveRouter` (backward-compatible)
165
+
166
+ ### Fixed
167
+ - `synthesizer.py`: `max_completion_tokens` for gpt-4o compatibility
168
+ - Test fixtures: removed synthetic passwords that triggered GitGuardian
169
+
170
+ ---
171
+
172
+ ## [0.3.0] — 2026-06-26
173
+
174
+ ### Added
175
+ - Removed all internal origin watermarks (`aava`, `AavaPlatformEmbedder`, `CODEINDEX_*`, `codeindex` binary)
176
+ - PyInstaller binary renamed `codeindex` → `trelix`
177
+ - Fixed `synthesizer.py` `max_completion_tokens` for gpt-4o
178
+ - Restored correct `tree_sitter_languages.get_language()` in 4 parsers
179
+ - Updated `.gitignore` to exclude `.claude/`, `uv.lock`, `dist/`
180
+
181
+ ---
182
+
183
+ ## [0.2.0] — 2026-06-25
184
+
185
+ ### Added
186
+ - Ruby parser — completes all 20 language extractors
187
+ - PyInstaller spec (`trelix.spec`) — `dist/trelix` single-file binary
188
+ - `scripts/build-binary.sh`, `make binary` / `make binary-clean` / `make binary-install`
189
+ - GitHub Actions `build-binaries.yml` — macOS arm64 + Windows x64 matrix
190
+ - Release workflow attaches binaries to GitHub Releases
191
+ - `docs/integrations/vscode-plugin.md`
192
+
193
+ ---
194
+
195
+ ## [0.1.0] — 2026-06-25
196
+
197
+ ### Added
198
+ - Initial release — Tree-sitter AST indexing for 20+ languages
199
+ - Hybrid search: vector (ANN, sqlite-vec) + BM25 (FTS5) + grep via RRF
200
+ - RRF fusion + call-graph / import / type-edge expansion with PageRank
201
+ - 8-intent LLM query planner
202
+ - Cohere + cross-encoder reranker
203
+ - Intent-aware context assembler (greedy / breadth_first)
204
+ - LLM synthesis via OpenAI or Azure (`trelix ask`)
205
+ - CLI: `index`, `search`, `ask`, `query`, `stats`, `update-index`
206
+ - Providers: `local` (no API key), `openai`, `azure`
207
+ - Zero-infra store: single SQLite file with sqlite-vec + FTS5 BM25
208
+
209
+ [Unreleased]: https://github.com/sairam0424/trelix/compare/v0.5.1...HEAD
210
+ [0.5.1]: https://github.com/sairam0424/trelix/releases/tag/v0.5.1
211
+ [0.5.0]: https://github.com/sairam0424/trelix/releases/tag/v0.5.0
212
+ [0.4.0]: https://github.com/sairam0424/trelix/releases/tag/v0.4.0
213
+ [0.3.0]: https://github.com/sairam0424/trelix/releases/tag/v0.3.0
214
+ [0.2.0]: https://github.com/sairam0424/trelix/releases/tag/v0.2.0
215
+ [0.1.0]: https://github.com/sairam0424/trelix/releases/tag/v0.1.0