xists 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 (63) hide show
  1. xists-0.7.0/.env.example +54 -0
  2. xists-0.7.0/.gitignore +24 -0
  3. xists-0.7.0/LICENSE +21 -0
  4. xists-0.7.0/PKG-INFO +263 -0
  5. xists-0.7.0/README.md +238 -0
  6. xists-0.7.0/README.zh-CN.md +218 -0
  7. xists-0.7.0/docs/demo.md +160 -0
  8. xists-0.7.0/docs/performance.md +76 -0
  9. xists-0.7.0/docs/record-schema.md +430 -0
  10. xists-0.7.0/docs/release.md +127 -0
  11. xists-0.7.0/docs/scale-2k-diagnosis.md +82 -0
  12. xists-0.7.0/docs/scaling-experiment.md +156 -0
  13. xists-0.7.0/docs/usage.md +663 -0
  14. xists-0.7.0/docs/v0.6.0-completion.md +32 -0
  15. xists-0.7.0/examples/ci-smoke/eval-cases.json +19 -0
  16. xists-0.7.0/examples/ci-smoke/repos.txt +2 -0
  17. xists-0.7.0/examples/eval-cases-extended.json +1532 -0
  18. xists-0.7.0/examples/eval-cases-smoke.json +182 -0
  19. xists-0.7.0/examples/eval-cases.json +1377 -0
  20. xists-0.7.0/pyproject.toml +56 -0
  21. xists-0.7.0/repos.txt +200 -0
  22. xists-0.7.0/scripts/bench_search.py +85 -0
  23. xists-0.7.0/scripts/check_eval_report.py +173 -0
  24. xists-0.7.0/scripts/diagnose_retrieval_candidates.py +142 -0
  25. xists-0.7.0/scripts/generate_stratified_eval.py +423 -0
  26. xists-0.7.0/scripts/generate_synthetic_index.py +143 -0
  27. xists-0.7.0/scripts/smoke_check.py +115 -0
  28. xists-0.7.0/src/xists/__init__.py +3 -0
  29. xists-0.7.0/src/xists/api.py +70 -0
  30. xists-0.7.0/src/xists/cli.py +2438 -0
  31. xists-0.7.0/src/xists/eval/__init__.py +1 -0
  32. xists-0.7.0/src/xists/eval/inspect.py +239 -0
  33. xists-0.7.0/src/xists/eval/judge.py +187 -0
  34. xists-0.7.0/src/xists/eval/run.py +355 -0
  35. xists-0.7.0/src/xists/eval/schema.py +131 -0
  36. xists-0.7.0/src/xists/ingest/__init__.py +1 -0
  37. xists-0.7.0/src/xists/ingest/github.py +690 -0
  38. xists-0.7.0/src/xists/profile/__init__.py +1 -0
  39. xists-0.7.0/src/xists/profile/llm.py +289 -0
  40. xists-0.7.0/src/xists/records.py +229 -0
  41. xists-0.7.0/src/xists/search/__init__.py +1 -0
  42. xists-0.7.0/src/xists/search/confidence.py +99 -0
  43. xists-0.7.0/src/xists/search/embed.py +322 -0
  44. xists-0.7.0/src/xists/search/index.py +167 -0
  45. xists-0.7.0/src/xists/search/query.py +865 -0
  46. xists-0.7.0/src/xists/search/rerank.py +176 -0
  47. xists-0.7.0/src/xists/search/transform.py +126 -0
  48. xists-0.7.0/tests/test_api.py +120 -0
  49. xists-0.7.0/tests/test_check_eval_report.py +153 -0
  50. xists-0.7.0/tests/test_cli.py +2970 -0
  51. xists-0.7.0/tests/test_diagnose_retrieval_candidates.py +46 -0
  52. xists-0.7.0/tests/test_eval.py +821 -0
  53. xists-0.7.0/tests/test_examples.py +75 -0
  54. xists-0.7.0/tests/test_generate_stratified_eval.py +101 -0
  55. xists-0.7.0/tests/test_generate_synthetic_index.py +64 -0
  56. xists-0.7.0/tests/test_github_ingest.py +536 -0
  57. xists-0.7.0/tests/test_llm_profile.py +281 -0
  58. xists-0.7.0/tests/test_package.py +12 -0
  59. xists-0.7.0/tests/test_packaging.py +38 -0
  60. xists-0.7.0/tests/test_performance_smoke.py +44 -0
  61. xists-0.7.0/tests/test_query_transform.py +97 -0
  62. xists-0.7.0/tests/test_rerank.py +128 -0
  63. xists-0.7.0/tests/test_search.py +961 -0
@@ -0,0 +1,54 @@
1
+ # GitHub ingestion
2
+ # Single token:
3
+ GITHUB_TOKEN=your_github_token_here
4
+ # Multiple tokens (comma-separated, for higher rate limits):
5
+ # GITHUB_TOKENS=tok1,tok2,tok3
6
+
7
+ # LLM profile generation (OpenAI-compatible chat completions endpoint)
8
+ # Used only during ingest to turn collected repo evidence into a structured profile.
9
+ # Works with OpenAI, vLLM, Ollama, Together, DeepSeek, Moonshot, etc.
10
+ LLM_API_KEY=your_llm_api_key_here
11
+ LLM_BASE_URL=https://api.deepseek.com
12
+ LLM_MODEL=deepseek-v4-pro
13
+
14
+ # Optional query canonicalization (OpenAI-compatible chat completions endpoint)
15
+ # Used only with `xists search` or `xists eval run` plus --query-transform-mode.
16
+ # It can convert queries into an English retrieval expression for an
17
+ # English-dominant corpus while xists keeps the local index and ranking.
18
+ QUERY_TRANSFORM_API_KEY=your_query_transform_api_key_here
19
+ QUERY_TRANSFORM_BASE_URL=https://api.example.com/v1
20
+ QUERY_TRANSFORM_MODEL=your_chat_model
21
+
22
+ # Embedding vector calculation (OpenAI-compatible embeddings endpoint)
23
+ # Used to compute vectors for:
24
+ # 1. records during `xists index build`
25
+ # 2. the query text during `xists search` / `xists eval run`
26
+ # The endpoint does NOT store your index and does NOT perform vector search.
27
+ # xists keeps vectors in local index.json and does ranking/query locally.
28
+ #
29
+ # IMPORTANT:
30
+ # This single embedding config is shared by:
31
+ # - `xists index build` to embed repository records
32
+ # - `xists search` / `xists eval run` to embed query text
33
+ # The query embedding model must match the model used to build index.json.
34
+ # Do not change EMBEDDING_MODEL after building an index unless you rebuild it:
35
+ # xists index build --force
36
+ #
37
+ # Recommended local CUDA example: BAAI/bge-m3 via TEI on localhost:6597
38
+ # docker-served endpoint: http://localhost:6597/v1 or http://localhost:6597
39
+ # EMBEDDING_API_KEY can be any non-empty placeholder if the local server has no auth.
40
+ EMBEDDING_API_KEY=local
41
+ EMBEDDING_BASE_URL=http://localhost:6597/v1
42
+ EMBEDDING_MODEL=BAAI/bge-m3
43
+
44
+ # Remote embedding APIs can also be used as calculate-only endpoints.
45
+ # They compute vectors, while xists still searches the local index.
46
+ # Example:
47
+ # EMBEDDING_API_KEY=your_remote_embedding_api_key_here
48
+ # EMBEDDING_BASE_URL=https://api.openai.com/v1
49
+ # EMBEDDING_MODEL=text-embedding-3-small
50
+ #
51
+ # For a dual-encoder retrieval service that requires a request role field,
52
+ # enable it explicitly. xists then sends `passage` for index builds and
53
+ # `query` for search/evaluation. Leave unset for ordinary embedding APIs.
54
+ # EMBEDDING_INPUT_TYPE_FIELD=input_type
xists-0.7.0/.gitignore ADDED
@@ -0,0 +1,24 @@
1
+ .env
2
+ .secrets/
3
+ records.json
4
+ report.json
5
+ index.json
6
+
7
+ __pycache__/
8
+ *.py[cod]
9
+ build/
10
+ dist/
11
+ *.egg-info/
12
+ .wheel-venv/
13
+ demo-records.json
14
+ demo-index.json
15
+ demo-report.json
16
+ demo-eval-report.json
17
+ demo-eval-report-*.json
18
+ eval-report.json
19
+ repos-top10k.txt
20
+ data/scale-*-records*.json
21
+ data/scale-*-profiled-records*.json
22
+ data/scale-*-index.json
23
+ data/scale-*-report.json
24
+ data/scale-*-result.json
xists-0.7.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 UsonTong
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
xists-0.7.0/PKG-INFO ADDED
@@ -0,0 +1,263 @@
1
+ Metadata-Version: 2.4
2
+ Name: xists
3
+ Version: 0.7.0
4
+ Summary: Find what already exists before building from scratch.
5
+ Project-URL: Homepage, https://github.com/UsonTong/xists
6
+ Project-URL: Repository, https://github.com/UsonTong/xists
7
+ Project-URL: Issues, https://github.com/UsonTong/xists/issues
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Software Development :: Libraries
19
+ Requires-Python: >=3.11
20
+ Requires-Dist: numpy
21
+ Provides-Extra: dev
22
+ Requires-Dist: build; extra == 'dev'
23
+ Requires-Dist: pytest; extra == 'dev'
24
+ Description-Content-Type: text/markdown
25
+
26
+ <div align="center"><a name="readme-top"></a>
27
+
28
+ # xists
29
+
30
+ Find first. Build later.
31
+
32
+ `xists` is a local semantic search engine for selected lists of GitHub repositories. Check if a similar project already exists before you build it.
33
+
34
+ **English** · [简体中文](./README.zh-CN.md)
35
+
36
+ </div>
37
+
38
+ ---
39
+
40
+ ## Why xists?
41
+
42
+ Global GitHub search is often noisy, and traditional keyword matching lacks semantic understanding. `xists` solves this by narrowing the search space: you provide a curated repository list, and `xists` builds a local index for semantic search.
43
+
44
+ - **Before you build**: check if a similar project or existing solution already exists.
45
+ - **Tech decisions**: compare candidates from a curated set using semantic search.
46
+ - **Fast lookups**: quickly find what you need without manually opening dozens of READMEs.
47
+
48
+ ## How it works
49
+
50
+ ```mermaid
51
+ flowchart LR
52
+ A[Repo List] --> B[Ingest Metadata]
53
+ B --> C[Generate LLM Summaries]
54
+ C --> D[Build Local Index]
55
+ D --> E[Search]
56
+ D -. optional .-> F[Evaluate Ranking]
57
+ F -.-> G[Inspect Misses]
58
+ ```
59
+
60
+ 1. **Ingest**: Provide a list of GitHub repos. `xists` fetches their metadata and READMEs.
61
+ 2. **Profile**: It uses an LLM to generate compact, search-optimized summaries for better matching.
62
+ 3. **Index**: It builds a local JSON embedding index.
63
+ 4. **Search**: You query the index using semantic search.
64
+
65
+ ## Local-first index, explicit model endpoints
66
+
67
+ `xists` keeps everything transparent and local:
68
+ - `records.json`: Raw metadata, structure signals, and LLM-generated profiles.
69
+ - `index.json`: The embedding index.
70
+ - `eval-report.json`: Search quality test results.
71
+
72
+ You need a GitHub token for the initial data fetch, plus model endpoints for summaries and embeddings. The records, index, ranking, and evaluation report stay on your machine. An embedding endpoint calculates vectors; xists stores them in local JSON and compares them locally.
73
+
74
+ ## Install and first search
75
+
76
+ Requires Python 3.11+. PyPI publication is prepared for v0.7.0 but has not
77
+ yet been authorized; until then, install directly from a checked-out source
78
+ tree:
79
+
80
+ ```bash
81
+ python -m pip install -e ".[dev]"
82
+ ```
83
+
84
+ After v0.7.0 is published, the equivalent package installation will be:
85
+
86
+ ```bash
87
+ python -m pip install xists
88
+ ```
89
+
90
+ Then create a local configuration file and build an index from repositories
91
+ you control:
92
+
93
+ ```bash
94
+ cp .env.example .env
95
+ # Set the required GitHub, LLM, and embedding variables in .env.
96
+
97
+ xists ingest github --repos repos.txt --output records.json --report report.json
98
+ xists index build --records records.json --output index.json
99
+ xists search "open source firebase alternative" --index index.json
100
+ ```
101
+
102
+ See [the demo walkthrough](docs/demo.md) for endpoint checks, concurrency,
103
+ evaluation, and troubleshooting. No current-schema demo records/index download
104
+ is published yet; the first Release asset will be created only after it passes
105
+ `records validate` and `index verify`.
106
+
107
+ ---
108
+
109
+ ## Quickstart
110
+
111
+ Requires Python 3.11+.
112
+
113
+ ```bash
114
+ # Install
115
+ python -m pip install -e ".[dev]"
116
+
117
+ # Set up config
118
+ cp .env.example .env
119
+ # Edit .env with your GitHub token, LLM model, and embedding model
120
+ ```
121
+
122
+ **Run the pipeline:**
123
+
124
+ ```bash
125
+ # 1. Fetch data & generate summaries
126
+ xists ingest github \
127
+ --repos repos.txt \
128
+ --output demo-records.json \
129
+ --report demo-report.json \
130
+ --github-api graphql
131
+
132
+ # 2. Build the local index
133
+ xists index build \
134
+ --records demo-records.json \
135
+ --output demo-index.json
136
+
137
+ # 3. Search!
138
+ xists search "open source firebase alternative" --index demo-index.json
139
+ xists search "open source firebase alternative" --index demo-index.json --format json
140
+ ```
141
+
142
+ The commands above generate local files and may call the endpoints configured
143
+ in `.env`; use `records.json` / `index.json` instead if you do not want files
144
+ named as demo artifacts.
145
+
146
+ ---
147
+
148
+ ## Python API
149
+
150
+ Use the stable API when another Python program needs the same search behavior
151
+ as the CLI. Configuration is always explicit; importing `xists.api` does not
152
+ read `.env` or send network requests.
153
+
154
+ ```python
155
+ from xists.api import load_index, search
156
+ from xists.search.embed import EmbeddingConfig
157
+
158
+ index = load_index("index.json")
159
+ config = EmbeddingConfig(
160
+ api_key="your-key",
161
+ base_url="https://your-embedding-endpoint/v1",
162
+ model="your-embedding-model",
163
+ )
164
+ result = search("open source firebase alternative", index, embedding_config=config, top_k=5)
165
+ ```
166
+
167
+ `search()` may call the endpoint in `config` to embed the query. It raises
168
+ actionable Python exceptions for invalid indexes, incompatible embedding models,
169
+ and endpoint failures instead of printing or terminating the process.
170
+
171
+ ---
172
+
173
+ ## Data, security, and privacy
174
+
175
+ - `.env` and token files are read only from your local machine; xists does not
176
+ commit, print, telemetry-report, or upload their secret values.
177
+ - `ingest github` sends your GitHub token only to GitHub. `profile refresh` and
178
+ ingest-time profile generation send repository text to the configured LLM
179
+ endpoint. `index build` sends embeddable repository text to the configured
180
+ embedding endpoint; `search` and `eval run` send query text to that endpoint.
181
+ - A local endpoint keeps those requests on your machine or network. A remote
182
+ endpoint receives the corresponding text under that provider's terms; choose
183
+ it only when you are permitted to send the material. xists does not host the
184
+ endpoint, upload your index, or perform vector search remotely.
185
+ - If you share records or indexes, you are responsible for checking repository
186
+ licenses, source content, generated profiles, and any personal or sensitive
187
+ information before distribution.
188
+
189
+ ---
190
+
191
+ ## Search Result Example
192
+
193
+ When you run a search, `xists` returns a compact text view by default for terminal review. Add `--format json` for scripts and agent integrations. v0.2.0 keeps ranking simple: exact repo/name/alias matches are pinned first, then semantic similarity is adjusted by a few explainable metadata signals.
194
+
195
+ Default text output looks like this:
196
+
197
+ ```text
198
+ query: hermes ai agent
199
+ intent: functional
200
+ abstained: False
201
+ results: 1
202
+ 1. repo: NousResearch/hermes-agent
203
+ url: https://github.com/NousResearch/hermes-agent
204
+ confidence: high_confidence
205
+ score: 0.680000
206
+ summary: An agent-oriented project for Hermes models.
207
+ why: matched metadata terms: agent
208
+ ```
209
+
210
+ The JSON output keeps the same ranking evidence in a machine-readable shape:
211
+
212
+ ```json
213
+ {
214
+ "query": "hermes ai agent",
215
+ "results": [
216
+ {
217
+ "repo_id": "NousResearch/hermes-agent",
218
+ "url": "https://github.com/NousResearch/hermes-agent",
219
+ "score": 0.68,
220
+ "semantic_score": 0.63,
221
+ "metadata_score": 0.05,
222
+ "confidence": "high_confidence",
223
+ "why": ["matched metadata terms: agent"]
224
+ }
225
+ ]
226
+ }
227
+ ```
228
+
229
+ `score` is the final ranking score; higher means a stronger match. Use `--format json` when another program or agent needs the structured payload.
230
+
231
+ ---
232
+
233
+ ## Optional Evaluation
234
+
235
+ If you update the repository list, regenerate summaries, or change the search setup, `xists` lets you run fixed test cases to sanity-check whether results changed in a meaningful way.
236
+
237
+ ```bash
238
+ pytest
239
+ xists eval run \
240
+ --cases examples/eval-cases.json \
241
+ --index demo-index.json \
242
+ --output demo-eval-report.json
243
+
244
+ xists eval inspect --report demo-eval-report.json --status serious_mismatch
245
+ ```
246
+
247
+ The report groups results into pragmatic categories:
248
+ - **Exact match**: The specific target repo was #1.
249
+ - **Acceptable alternative**: Not the exact target, but a valid substitute (e.g., returning Vue when you asked for a React-like framework).
250
+ - **Serious mismatch**: The top result missed the core intent.
251
+ - **Insufficient evidence**: The indexed data was too thin to judge.
252
+
253
+ ---
254
+
255
+ ## Commands
256
+
257
+ - `xists doctor`: Check config and file status; add `--check-endpoints` or `--strict` to probe the embedding service.
258
+ - `xists ingest github`: Fetch repo metadata and generate summaries.
259
+ - `xists index build`: Build or incrementally update the local index.
260
+ - `xists search "query"`: Query the local index with readable terminal output by default; add `--format json` for scripts and agents.
261
+ - `xists eval cases` / `xists eval run` / `xists eval inspect`: Validate the dataset and run/review ranking tests.
262
+ - `xists records validate` / `xists records stats` / `xists records inspect`: Check record quality without printing huge payloads to your terminal.
263
+ - `xists index stats` / `xists index verify`: Summarize an index and confirm it is in sync with records.
xists-0.7.0/README.md ADDED
@@ -0,0 +1,238 @@
1
+ <div align="center"><a name="readme-top"></a>
2
+
3
+ # xists
4
+
5
+ Find first. Build later.
6
+
7
+ `xists` is a local semantic search engine for selected lists of GitHub repositories. Check if a similar project already exists before you build it.
8
+
9
+ **English** · [简体中文](./README.zh-CN.md)
10
+
11
+ </div>
12
+
13
+ ---
14
+
15
+ ## Why xists?
16
+
17
+ Global GitHub search is often noisy, and traditional keyword matching lacks semantic understanding. `xists` solves this by narrowing the search space: you provide a curated repository list, and `xists` builds a local index for semantic search.
18
+
19
+ - **Before you build**: check if a similar project or existing solution already exists.
20
+ - **Tech decisions**: compare candidates from a curated set using semantic search.
21
+ - **Fast lookups**: quickly find what you need without manually opening dozens of READMEs.
22
+
23
+ ## How it works
24
+
25
+ ```mermaid
26
+ flowchart LR
27
+ A[Repo List] --> B[Ingest Metadata]
28
+ B --> C[Generate LLM Summaries]
29
+ C --> D[Build Local Index]
30
+ D --> E[Search]
31
+ D -. optional .-> F[Evaluate Ranking]
32
+ F -.-> G[Inspect Misses]
33
+ ```
34
+
35
+ 1. **Ingest**: Provide a list of GitHub repos. `xists` fetches their metadata and READMEs.
36
+ 2. **Profile**: It uses an LLM to generate compact, search-optimized summaries for better matching.
37
+ 3. **Index**: It builds a local JSON embedding index.
38
+ 4. **Search**: You query the index using semantic search.
39
+
40
+ ## Local-first index, explicit model endpoints
41
+
42
+ `xists` keeps everything transparent and local:
43
+ - `records.json`: Raw metadata, structure signals, and LLM-generated profiles.
44
+ - `index.json`: The embedding index.
45
+ - `eval-report.json`: Search quality test results.
46
+
47
+ You need a GitHub token for the initial data fetch, plus model endpoints for summaries and embeddings. The records, index, ranking, and evaluation report stay on your machine. An embedding endpoint calculates vectors; xists stores them in local JSON and compares them locally.
48
+
49
+ ## Install and first search
50
+
51
+ Requires Python 3.11+. PyPI publication is prepared for v0.7.0 but has not
52
+ yet been authorized; until then, install directly from a checked-out source
53
+ tree:
54
+
55
+ ```bash
56
+ python -m pip install -e ".[dev]"
57
+ ```
58
+
59
+ After v0.7.0 is published, the equivalent package installation will be:
60
+
61
+ ```bash
62
+ python -m pip install xists
63
+ ```
64
+
65
+ Then create a local configuration file and build an index from repositories
66
+ you control:
67
+
68
+ ```bash
69
+ cp .env.example .env
70
+ # Set the required GitHub, LLM, and embedding variables in .env.
71
+
72
+ xists ingest github --repos repos.txt --output records.json --report report.json
73
+ xists index build --records records.json --output index.json
74
+ xists search "open source firebase alternative" --index index.json
75
+ ```
76
+
77
+ See [the demo walkthrough](docs/demo.md) for endpoint checks, concurrency,
78
+ evaluation, and troubleshooting. No current-schema demo records/index download
79
+ is published yet; the first Release asset will be created only after it passes
80
+ `records validate` and `index verify`.
81
+
82
+ ---
83
+
84
+ ## Quickstart
85
+
86
+ Requires Python 3.11+.
87
+
88
+ ```bash
89
+ # Install
90
+ python -m pip install -e ".[dev]"
91
+
92
+ # Set up config
93
+ cp .env.example .env
94
+ # Edit .env with your GitHub token, LLM model, and embedding model
95
+ ```
96
+
97
+ **Run the pipeline:**
98
+
99
+ ```bash
100
+ # 1. Fetch data & generate summaries
101
+ xists ingest github \
102
+ --repos repos.txt \
103
+ --output demo-records.json \
104
+ --report demo-report.json \
105
+ --github-api graphql
106
+
107
+ # 2. Build the local index
108
+ xists index build \
109
+ --records demo-records.json \
110
+ --output demo-index.json
111
+
112
+ # 3. Search!
113
+ xists search "open source firebase alternative" --index demo-index.json
114
+ xists search "open source firebase alternative" --index demo-index.json --format json
115
+ ```
116
+
117
+ The commands above generate local files and may call the endpoints configured
118
+ in `.env`; use `records.json` / `index.json` instead if you do not want files
119
+ named as demo artifacts.
120
+
121
+ ---
122
+
123
+ ## Python API
124
+
125
+ Use the stable API when another Python program needs the same search behavior
126
+ as the CLI. Configuration is always explicit; importing `xists.api` does not
127
+ read `.env` or send network requests.
128
+
129
+ ```python
130
+ from xists.api import load_index, search
131
+ from xists.search.embed import EmbeddingConfig
132
+
133
+ index = load_index("index.json")
134
+ config = EmbeddingConfig(
135
+ api_key="your-key",
136
+ base_url="https://your-embedding-endpoint/v1",
137
+ model="your-embedding-model",
138
+ )
139
+ result = search("open source firebase alternative", index, embedding_config=config, top_k=5)
140
+ ```
141
+
142
+ `search()` may call the endpoint in `config` to embed the query. It raises
143
+ actionable Python exceptions for invalid indexes, incompatible embedding models,
144
+ and endpoint failures instead of printing or terminating the process.
145
+
146
+ ---
147
+
148
+ ## Data, security, and privacy
149
+
150
+ - `.env` and token files are read only from your local machine; xists does not
151
+ commit, print, telemetry-report, or upload their secret values.
152
+ - `ingest github` sends your GitHub token only to GitHub. `profile refresh` and
153
+ ingest-time profile generation send repository text to the configured LLM
154
+ endpoint. `index build` sends embeddable repository text to the configured
155
+ embedding endpoint; `search` and `eval run` send query text to that endpoint.
156
+ - A local endpoint keeps those requests on your machine or network. A remote
157
+ endpoint receives the corresponding text under that provider's terms; choose
158
+ it only when you are permitted to send the material. xists does not host the
159
+ endpoint, upload your index, or perform vector search remotely.
160
+ - If you share records or indexes, you are responsible for checking repository
161
+ licenses, source content, generated profiles, and any personal or sensitive
162
+ information before distribution.
163
+
164
+ ---
165
+
166
+ ## Search Result Example
167
+
168
+ When you run a search, `xists` returns a compact text view by default for terminal review. Add `--format json` for scripts and agent integrations. v0.2.0 keeps ranking simple: exact repo/name/alias matches are pinned first, then semantic similarity is adjusted by a few explainable metadata signals.
169
+
170
+ Default text output looks like this:
171
+
172
+ ```text
173
+ query: hermes ai agent
174
+ intent: functional
175
+ abstained: False
176
+ results: 1
177
+ 1. repo: NousResearch/hermes-agent
178
+ url: https://github.com/NousResearch/hermes-agent
179
+ confidence: high_confidence
180
+ score: 0.680000
181
+ summary: An agent-oriented project for Hermes models.
182
+ why: matched metadata terms: agent
183
+ ```
184
+
185
+ The JSON output keeps the same ranking evidence in a machine-readable shape:
186
+
187
+ ```json
188
+ {
189
+ "query": "hermes ai agent",
190
+ "results": [
191
+ {
192
+ "repo_id": "NousResearch/hermes-agent",
193
+ "url": "https://github.com/NousResearch/hermes-agent",
194
+ "score": 0.68,
195
+ "semantic_score": 0.63,
196
+ "metadata_score": 0.05,
197
+ "confidence": "high_confidence",
198
+ "why": ["matched metadata terms: agent"]
199
+ }
200
+ ]
201
+ }
202
+ ```
203
+
204
+ `score` is the final ranking score; higher means a stronger match. Use `--format json` when another program or agent needs the structured payload.
205
+
206
+ ---
207
+
208
+ ## Optional Evaluation
209
+
210
+ If you update the repository list, regenerate summaries, or change the search setup, `xists` lets you run fixed test cases to sanity-check whether results changed in a meaningful way.
211
+
212
+ ```bash
213
+ pytest
214
+ xists eval run \
215
+ --cases examples/eval-cases.json \
216
+ --index demo-index.json \
217
+ --output demo-eval-report.json
218
+
219
+ xists eval inspect --report demo-eval-report.json --status serious_mismatch
220
+ ```
221
+
222
+ The report groups results into pragmatic categories:
223
+ - **Exact match**: The specific target repo was #1.
224
+ - **Acceptable alternative**: Not the exact target, but a valid substitute (e.g., returning Vue when you asked for a React-like framework).
225
+ - **Serious mismatch**: The top result missed the core intent.
226
+ - **Insufficient evidence**: The indexed data was too thin to judge.
227
+
228
+ ---
229
+
230
+ ## Commands
231
+
232
+ - `xists doctor`: Check config and file status; add `--check-endpoints` or `--strict` to probe the embedding service.
233
+ - `xists ingest github`: Fetch repo metadata and generate summaries.
234
+ - `xists index build`: Build or incrementally update the local index.
235
+ - `xists search "query"`: Query the local index with readable terminal output by default; add `--format json` for scripts and agents.
236
+ - `xists eval cases` / `xists eval run` / `xists eval inspect`: Validate the dataset and run/review ranking tests.
237
+ - `xists records validate` / `xists records stats` / `xists records inspect`: Check record quality without printing huge payloads to your terminal.
238
+ - `xists index stats` / `xists index verify`: Summarize an index and confirm it is in sync with records.