code-graph-rag 0.2.0__py3-none-any.whl → 0.2.10__py3-none-any.whl
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.
- {code_graph_rag-0.2.0.dist-info → code_graph_rag-0.2.10.dist-info}/METADATA +32 -15
- {code_graph_rag-0.2.0.dist-info → code_graph_rag-0.2.10.dist-info}/RECORD +15 -14
- codebase_rag/cli.py +51 -2
- codebase_rag/config.py +4 -0
- codebase_rag/constants/ast_python.py +7 -0
- codebase_rag/constants/cli.py +12 -0
- codebase_rag/cypher_queries.py +224 -52
- codebase_rag/editing/signature_bind.py +608 -0
- codebase_rag/editing/signature_spec.py +2 -1
- codebase_rag/services/graph_service.py +24 -7
- codebase_rag/utils/path_utils.py +19 -0
- {code_graph_rag-0.2.0.dist-info → code_graph_rag-0.2.10.dist-info}/WHEEL +0 -0
- {code_graph_rag-0.2.0.dist-info → code_graph_rag-0.2.10.dist-info}/entry_points.txt +0 -0
- {code_graph_rag-0.2.0.dist-info → code_graph_rag-0.2.10.dist-info}/licenses/LICENSE +0 -0
- {code_graph_rag-0.2.0.dist-info → code_graph_rag-0.2.10.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: code-graph-rag
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.10
|
|
4
4
|
Summary: The ultimate RAG for your monorepo. Query, understand, and edit multi-language codebases with the power of AI and knowledge graphs
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Keywords: rag,retrieval-augmented-generation,knowledge-graph,code-analysis,tree-sitter,mcp,mcp-server,llm,graph-database,semantic-search,codebase,memgraph,developer-tools,monorepo
|
|
@@ -19,7 +19,7 @@ Requires-Python: >=3.12
|
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: LICENSE
|
|
21
21
|
Requires-Dist: loguru>=0.7.3
|
|
22
|
-
Requires-Dist: mcp<2,>=1.
|
|
22
|
+
Requires-Dist: mcp<2,>=1.30.0
|
|
23
23
|
Requires-Dist: pydantic-ai-slim[anthropic,google,openai]>=2.0.0
|
|
24
24
|
Requires-Dist: pydantic-settings>=2.12.0
|
|
25
25
|
Requires-Dist: python-dotenv>=1.2.1
|
|
@@ -93,7 +93,7 @@ Dynamic: license-file
|
|
|
93
93
|
|
|
94
94
|
# Code-Graph-RAG
|
|
95
95
|
|
|
96
|
-
Code-Graph-RAG parses a multi-language codebase with Tree-sitter, sharpened by compiler-grade frontends and runtime traces where available, builds a knowledge graph of its structure in
|
|
96
|
+
Code-Graph-RAG parses a multi-language codebase with Tree-sitter, sharpened by compiler-grade frontends and runtime traces where available, builds a knowledge graph of its structure in an embedded graph database that needs no server, and lets you query, edit, and optimise that code in plain English. It works across a monorepo of mixed languages under one unified graph schema.
|
|
97
97
|
|
|
98
98
|
## What It Does
|
|
99
99
|
|
|
@@ -175,14 +175,22 @@ for git installs and the other methods.
|
|
|
175
175
|
### Prerequisites
|
|
176
176
|
|
|
177
177
|
- Python 3.12+
|
|
178
|
-
- Docker (for Memgraph)
|
|
179
|
-
- `cmake` (for building pymgclient)
|
|
180
178
|
- `ripgrep` (`rg`) (for shell command text searching)
|
|
179
|
+
- Only for the optional Memgraph backend: Docker, and `cmake` where no
|
|
180
|
+
`pymgclient` wheel fits your platform
|
|
181
|
+
|
|
182
|
+
The knowledge graph is an embedded SQLite file (`~/.cgr/graph.sqlite`), so there
|
|
183
|
+
is no database server to run. Memgraph and Neo4j remain available as opt-in
|
|
184
|
+
backends; see [Graph Backends](https://docs.code-graph-rag.com/architecture/embedded-graph/).
|
|
181
185
|
|
|
182
186
|
The wheel is pure Python (`py3-none-any`), so it installs on any platform with
|
|
183
|
-
Python 3.12 or newer.
|
|
184
|
-
|
|
185
|
-
|
|
187
|
+
Python 3.12 or newer. On Linux (x86_64, aarch64), macOS and Windows x64 it also
|
|
188
|
+
pulls in `cgr-graph-rs`, a native extension that speeds up the embedded graph;
|
|
189
|
+
elsewhere the same engine runs in pure Python.
|
|
190
|
+
|
|
191
|
+
Some distributions ship an older interpreter (Debian Bookworm, and so Raspberry
|
|
192
|
+
Pi OS Bookworm, ships 3.11), which also explains the failed piwheels Bookworm
|
|
193
|
+
build. On those systems, see the [installation
|
|
186
194
|
guide](https://github.com/vitali87/code-graph-rag/blob/main/docs/getting-started/installation.md#older-system-interpreters)
|
|
187
195
|
for the available interpreter-pinning alternatives.
|
|
188
196
|
|
|
@@ -190,14 +198,17 @@ for the available interpreter-pinning alternatives.
|
|
|
190
198
|
|
|
191
199
|
The package installs a `cgr` command.
|
|
192
200
|
|
|
193
|
-
**
|
|
201
|
+
**Parse a repo, then query it:**
|
|
194
202
|
|
|
195
203
|
```bash
|
|
196
|
-
cgr
|
|
197
|
-
cgr start --repo-path ./my-project
|
|
198
|
-
--update-graph --clean # parse & launch interactive chat
|
|
204
|
+
cgr start --repo-path ./my-project --update-graph # parse into the graph
|
|
205
|
+
cgr start --repo-path ./my-project # launch the interactive chat
|
|
199
206
|
```
|
|
200
207
|
|
|
208
|
+
The graph is written to `~/.cgr/graph.sqlite`. To use Memgraph instead, install
|
|
209
|
+
`code-graph-rag[memgraph]`, set `GRAPH_BACKEND=memgraph`, and start the packaged
|
|
210
|
+
Memgraph + Qdrant stack with `cgr daemon up`.
|
|
211
|
+
|
|
201
212
|
**Index to protobuf for offline use:**
|
|
202
213
|
|
|
203
214
|
```bash
|
|
@@ -304,7 +315,11 @@ for fn in functions[:5]:
|
|
|
304
315
|
print(f"{fn.properties['name']}: {len(rels)} relationships")
|
|
305
316
|
```
|
|
306
317
|
|
|
307
|
-
### Query
|
|
318
|
+
### Query the graph with Cypher
|
|
319
|
+
|
|
320
|
+
`MemgraphIngestor` keeps its original name but works with whichever backend
|
|
321
|
+
`GRAPH_BACKEND` selects. On the default embedded graph, `host` and `port` are
|
|
322
|
+
not used.
|
|
308
323
|
|
|
309
324
|
```python
|
|
310
325
|
from cgr import MemgraphIngestor
|
|
@@ -357,8 +372,10 @@ Configure via `.env` or environment variables:
|
|
|
357
372
|
|
|
358
373
|
| Variable | Default | Description |
|
|
359
374
|
|----------|---------|-------------|
|
|
360
|
-
| `
|
|
361
|
-
| `
|
|
375
|
+
| `GRAPH_BACKEND` | `sqlite` | Graph engine: `sqlite` (embedded), `memgraph`, or `neo4j` |
|
|
376
|
+
| `SQLITE_GRAPH_PATH` | `~/.cgr/graph.sqlite` | Embedded graph file |
|
|
377
|
+
| `MEMGRAPH_HOST` | `localhost` | Memgraph hostname (with `GRAPH_BACKEND=memgraph`) |
|
|
378
|
+
| `MEMGRAPH_PORT` | `7687` | Memgraph port (with `GRAPH_BACKEND=memgraph`) |
|
|
362
379
|
| `ORCHESTRATOR_PROVIDER` | | Provider: `google`, `openai`, `anthropic`, `azure`, `ollama`, `minimax`, `litellm_proxy` |
|
|
363
380
|
| `ORCHESTRATOR_MODEL` | | Model ID (e.g. `gpt-5.6-terra`, `gemini-3.6-flash`, `claude-sonnet-5`, `qwen2.5-coder`) |
|
|
364
381
|
| `ORCHESTRATOR_API_KEY` | | API key for the provider (not needed for `ollama`) |
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
cgr/__init__.py,sha256=S-bP03ZhxMITllHtkg4jA9l28BedNKrM7h8-g_ZrbxE,400
|
|
2
|
-
code_graph_rag-0.2.
|
|
2
|
+
code_graph_rag-0.2.10.dist-info/licenses/LICENSE,sha256=sMS8isnfZtnQqdIEr0i1y6Ln1GnC_2q1FRLeXjExmWM,1071
|
|
3
3
|
codebase_rag/__init__.py,sha256=c5XIoY8eYnFz7hYTojW_-8ZxVQp2Krrfl3ouYKvmfc0,149
|
|
4
4
|
codebase_rag/_cli_env.py,sha256=_S-3rpEHu7NgjdEmeDVq_dtyDt3lvA_hhrzf1J_CHCg,1007
|
|
5
5
|
codebase_rag/ast_cache.py,sha256=8q7S8DP1CRd5nzh65StbMPmUGG1mEx-tvKXXSYO4Avg,4204
|
|
6
6
|
codebase_rag/capture.py,sha256=zRqeLyYAvTd6daDhGlxLJHzJmKjhRyPHPih-9vkDC4g,7494
|
|
7
7
|
codebase_rag/check_isolation.py,sha256=-WlwMnobSyj84WQ2kKvIEkmspR-2IRtdB62V7Tgt48M,18440
|
|
8
8
|
codebase_rag/checkout_state.py,sha256=U0dPH6T_TNDOvcFNv7zqfc5CNCwSpM9_Jvjg3S1xnd8,26329
|
|
9
|
-
codebase_rag/cli.py,sha256=
|
|
9
|
+
codebase_rag/cli.py,sha256=94b-U60JQ0Mz9R7y3ph-EYBCfZBHUF4AqAnYbyv02_4,124085
|
|
10
10
|
codebase_rag/cli_help.py,sha256=lBvEiJ_rz461e4yji-lDwgjXPD_1NJXuuR-sNqU-gdo,31526
|
|
11
11
|
codebase_rag/cli_runtime.py,sha256=xNmo8dIaBRozoIwp5gB0b48RmLt5k_s-Qr_OW5H-Fds,1200
|
|
12
|
-
codebase_rag/config.py,sha256=
|
|
12
|
+
codebase_rag/config.py,sha256=1b4uphx511kHNG9sASMXAXW_reli7vgV7Mz7RRsVGRM,39068
|
|
13
13
|
codebase_rag/console_marks.py,sha256=Ksd0tJqr5XTYWaKElG-yFnnjNtmqZwJOcNp3S65fups,2479
|
|
14
14
|
codebase_rag/context_pruning.py,sha256=alIRZx11rVYrhVkwa29ezVjiYaR8t4_rat4I_N5DOIM,11688
|
|
15
15
|
codebase_rag/context_slice.py,sha256=pN3beOw4JnA9qlvUWU2ar6eHSduGsfdzxZD7_MbtDTc,16982
|
|
16
16
|
codebase_rag/crash_correlation.py,sha256=V87GwjFazVlvd1tbEFBkwvOZF2E8CdurEOVsH4onBqA,31665
|
|
17
|
-
codebase_rag/cypher_queries.py,sha256=
|
|
17
|
+
codebase_rag/cypher_queries.py,sha256=_DlL-IWw0j0CEoSEiIJlhVe_D9B9oVXUbPW2kr95jFs,95201
|
|
18
18
|
codebase_rag/dead_code.py,sha256=prfQXCUgykCNfyiP_NtopaoN9i8yWg-rO1jgExU86l4,62202
|
|
19
19
|
codebase_rag/decorators.py,sha256=2Nn9khxHriidfuti8zv2o2FdMae5hUALvZS3dZ0dayA,6421
|
|
20
20
|
codebase_rag/docker-compose.yaml,sha256=8Rn5noD5OJm4pUluOUTTqmqVfsoreYYEeX1iChrymUA,3285
|
|
@@ -120,12 +120,12 @@ codebase_rag/constants/ast_julia.py,sha256=iANRd4Eq6YMflqPrErAPscJvGIfsuYolKFcdV
|
|
|
120
120
|
codebase_rag/constants/ast_lua.py,sha256=o3QvV40pmlEIVPfUxbWKXNDaxRBDsDxT4YXL81dL4B4,3143
|
|
121
121
|
codebase_rag/constants/ast_nodes.py,sha256=29eVsZcfNSaBOhgMuKL0KaduODK5Fj0oBQ0ZAo8WG0E,19884
|
|
122
122
|
codebase_rag/constants/ast_php.py,sha256=1l3xvpdtBGXtelG2OpdASVKv6ek3EdmYPPuTPT6w2x8,5920
|
|
123
|
-
codebase_rag/constants/ast_python.py,sha256=
|
|
123
|
+
codebase_rag/constants/ast_python.py,sha256=Pipn6F6J_Y6Q_KiER9YLQjbiTK5z_GlYj2xnWMaVMGs,18485
|
|
124
124
|
codebase_rag/constants/ast_rust.py,sha256=aG0RUolf71gdh9wpOEIfBESiCjvKVptFCucUme77DxA,18326
|
|
125
125
|
codebase_rag/constants/ast_scala.py,sha256=UH_J3jMhdLYnrU5cUULQzgE00oF0AiEr7FzIYm49IM4,5360
|
|
126
126
|
codebase_rag/constants/ast_sql.py,sha256=83z3itc0dnJRi-uF07fmD6J7LZNRFlQO1DCYelp3x50,956
|
|
127
127
|
codebase_rag/constants/build.py,sha256=2CEok0bhBdXD8nf0qJHi8nTYLol5q8It9sz6dJnGNC0,3658
|
|
128
|
-
codebase_rag/constants/cli.py,sha256=
|
|
128
|
+
codebase_rag/constants/cli.py,sha256=6axGiBqab3mCggLhlrHGmanpOl1OMi1SF9_ATRI8920,54772
|
|
129
129
|
codebase_rag/constants/core.py,sha256=8pXDB0Xa4fhTymaaS68WYuAPLyO6PO5WUG8A8XtTBpk,21070
|
|
130
130
|
codebase_rag/constants/deadcode_roots.py,sha256=4k8MGPMSdNiCI2JsH_P6R3ITiDDY0zlCntBIppnxyIo,17913
|
|
131
131
|
codebase_rag/constants/deps.py,sha256=a1zHXifSCc3DqJeeuM1ZOuVAlMRsw94alJ3I1XgY0jw,2129
|
|
@@ -153,8 +153,9 @@ codebase_rag/editing/imports.py,sha256=hIlFDXUvVFNQphbJ7p5yEGtaOgJLtAIaq2D0FueVG
|
|
|
153
153
|
codebase_rag/editing/occurrences.py,sha256=q26BLQRi9OCleye5g-pBzRRPitn7IZF3VW_ho7rgT34,57551
|
|
154
154
|
codebase_rag/editing/patcher.py,sha256=S3BQ1_wf-BInYL0ZtrwD4lVyTq80uJ7jo4wQcJW3wFY,18701
|
|
155
155
|
codebase_rag/editing/rename.py,sha256=uk0WJ9ydcqzdRTp-O5f2iLwlAnlKj7ZycJ5If2q4jnM,98058
|
|
156
|
+
codebase_rag/editing/signature_bind.py,sha256=cCEnW5OkYkSceMMYUbd3sJXrKETyCFzryraIMcId7Ek,22070
|
|
156
157
|
codebase_rag/editing/signature_contract.py,sha256=bZDoTGZWB8q7zoUga3VGSEt13XFI1aqO6gWFWGn9Wh8,4385
|
|
157
|
-
codebase_rag/editing/signature_spec.py,sha256=
|
|
158
|
+
codebase_rag/editing/signature_spec.py,sha256=X5Exea4MP_JH3Q3VOpey9qDdhpCIPDZebCK_Gh3xJhU,11518
|
|
158
159
|
codebase_rag/editing/sites.py,sha256=DjuwM8Zp5hjM4q2TaOodyrxE-B4CYQ2uuSjv7lZDZKI,4849
|
|
159
160
|
codebase_rag/editing/transaction.py,sha256=2IvbDjXlCnIBnbhBbTAH02E-0PQODbjCs0aTiUvUcok,23413
|
|
160
161
|
codebase_rag/embedded_graph/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -370,7 +371,7 @@ codebase_rag/services/cypher_guard.py,sha256=SdgyXl6MR8a0HzV_Nb7g-zbCtn5GP3wnhu-
|
|
|
370
371
|
codebase_rag/services/filtering.py,sha256=AjzXfTX_iL2ypPILkVJeTac8UOCcwrMNsk_fYbL1iiY,2137
|
|
371
372
|
codebase_rag/services/gloss_cleanup.py,sha256=hgjZ1L57deeZO2009_znyIV0mvDtL078aGpN99BsCt8,4317
|
|
372
373
|
codebase_rag/services/graph_diff.py,sha256=TUn_rin1XXYUs-VNoksGI7nZSa7mWnLaL8pLW9zezm0,9819
|
|
373
|
-
codebase_rag/services/graph_service.py,sha256=
|
|
374
|
+
codebase_rag/services/graph_service.py,sha256=n3kmA3mSan2h23NcYRoQAtoMRFe02-gqyugX-jSMwv8,48483
|
|
374
375
|
codebase_rag/services/llm.py,sha256=rxsYXQPjh2f67daUz0d9aUD5h75scRLMD2kSPu-aBqY,12859
|
|
375
376
|
codebase_rag/services/neo4j_driver.py,sha256=RtEQ4t8QhmeCxPBJ8wwUDn014SA2Tye2hgtpp1mFRUI,10305
|
|
376
377
|
codebase_rag/services/protobuf_service.py,sha256=ixuex9BDN8-1e8jfIUgNKL3tfkqAZk-oYuBjrQws_gY,13150
|
|
@@ -427,7 +428,7 @@ codebase_rag/utils/endpoints.py,sha256=Rhy7FOyIGWu9r7pIk2sGVeqyrBv6D7GCeoKUgn5OL
|
|
|
427
428
|
codebase_rag/utils/fqn_resolver.py,sha256=k7NmP4Rq6T5QqelpGXF_AnscinD12tmQL6oV3uVHt94,3729
|
|
428
429
|
codebase_rag/utils/interruptible_thread.py,sha256=IeJfK1x12KHeAormuJG6GJtyWx8UDiyz_jmhSyBOhSc,3309
|
|
429
430
|
codebase_rag/utils/json_io.py,sha256=pQTSmGgBfNUMP8-a8faEfbrw-WPkvmqx4BLjOk6KusA,1017
|
|
430
|
-
codebase_rag/utils/path_utils.py,sha256=
|
|
431
|
+
codebase_rag/utils/path_utils.py,sha256=Qf1zU7xhzauTpD7mPXen30SMpwNGjX2kB0n2exfn1m8,37007
|
|
431
432
|
codebase_rag/utils/process_owner.py,sha256=9QmgPZU_PnthG93-nsMbeR7zaBGeQJTMdSP1YGBQOe4,4653
|
|
432
433
|
codebase_rag/utils/qn_markers.py,sha256=EZsMLmgTe7pbuFM1OyPtFhHy8E00bU_rZx3Zjgg2Nog,4686
|
|
433
434
|
codebase_rag/utils/rich_markdown.py,sha256=JU72ioKuZA0WMbvfJYtRm4NnaQXr-_YFfzBZgeniEeo,845
|
|
@@ -444,8 +445,8 @@ codec/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
444
445
|
codec/schema.proto,sha256=FhobUEQnBLFEZQ8jmtBWGd2TKI5IOsbRoBKqKahNgTY,18069
|
|
445
446
|
codec/schema_pb2.py,sha256=kVvFiQ0rpjBOaJEZuTO9sfmR8UdDkxEkCTeY7r-DpIg,15035
|
|
446
447
|
codec/schema_pb2.pyi,sha256=-1fXY9k7N8ggiPxLutGM8F2LzlPoUZBZvP_0YCQfwB4,30683
|
|
447
|
-
code_graph_rag-0.2.
|
|
448
|
-
code_graph_rag-0.2.
|
|
449
|
-
code_graph_rag-0.2.
|
|
450
|
-
code_graph_rag-0.2.
|
|
451
|
-
code_graph_rag-0.2.
|
|
448
|
+
code_graph_rag-0.2.10.dist-info/METADATA,sha256=lK_gTgznZF7i0Xx5jd8cm2HAPlZyZPu2P9nPPSL3uUw,17584
|
|
449
|
+
code_graph_rag-0.2.10.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
450
|
+
code_graph_rag-0.2.10.dist-info/entry_points.txt,sha256=o_VMDZJNNcBebcFuItBluVpmChH-wikLj5NcvlsI3k8,140
|
|
451
|
+
code_graph_rag-0.2.10.dist-info/top_level.txt,sha256=exG1ozDEpugwIqwzcE97Nko_Cat7cd5eAo99lARpulA,23
|
|
452
|
+
code_graph_rag-0.2.10.dist-info/RECORD,,
|
codebase_rag/cli.py
CHANGED
|
@@ -44,7 +44,7 @@ from .capture import (
|
|
|
44
44
|
unknown_tokens,
|
|
45
45
|
)
|
|
46
46
|
from .checkout_state import prepare_state_dir
|
|
47
|
-
from .cli_runtime import app_context, connect_memgraph, style
|
|
47
|
+
from .cli_runtime import app_context, connect_memgraph, dim, style
|
|
48
48
|
from .config import load_ignore_patterns, settings, settings_errors
|
|
49
49
|
from .console_marks import status_mark
|
|
50
50
|
from .editing.cli import cli as edits_cli
|
|
@@ -102,6 +102,7 @@ from .utils.path_utils import (
|
|
|
102
102
|
normalize_project_name,
|
|
103
103
|
project_name_error,
|
|
104
104
|
project_roots_from_rows,
|
|
105
|
+
projects_sharing_root,
|
|
105
106
|
resolve_repo_path,
|
|
106
107
|
unwritable_output_reason,
|
|
107
108
|
)
|
|
@@ -199,10 +200,40 @@ class _CgrGroup(TyperGroup):
|
|
|
199
200
|
# this at connect time with the fix in its message; printing it here
|
|
200
201
|
# covers them all, the delegated groups and the chat included (#2443).
|
|
201
202
|
try:
|
|
202
|
-
|
|
203
|
+
result = super().invoke(ctx)
|
|
203
204
|
except GraphUnavailableError as e:
|
|
204
205
|
app_context.console.print(style(str(e), cs.Color.RED))
|
|
205
206
|
raise typer.Exit(1) from e
|
|
207
|
+
# Only a command that finished gets here: a failure exits by raising.
|
|
208
|
+
pledge = sponsor_pledge(ctx.invoked_subcommand, sys.stderr.isatty())
|
|
209
|
+
if pledge:
|
|
210
|
+
# Soft-wrapped so the terminal, not Rich, breaks the line, and
|
|
211
|
+
# the URL stays one clickable link.
|
|
212
|
+
terminal_aware_console(stderr=True).print(
|
|
213
|
+
dim(pledge), highlight=False, soft_wrap=True
|
|
214
|
+
)
|
|
215
|
+
return result
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
# Help pages, and the MCP server, which speaks its protocol until the client
|
|
219
|
+
# hangs up, are not runs that finished.
|
|
220
|
+
_NO_SPONSOR_PLEDGE = frozenset({ch.CLICommandName.HELP, ch.CLICommandName.MCP_SERVER})
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
def sponsor_pledge(command: str | None, terminal: bool) -> str | None:
|
|
224
|
+
"""The GitHub Sponsors line a finished command ends on, or None where it
|
|
225
|
+
would be in the way: off a terminal (a script or a log reading stderr),
|
|
226
|
+
under `--quiet` or CGR_SPONSOR_PLEDGE=false, and after the commands in
|
|
227
|
+
`_NO_SPONSOR_PLEDGE`. On stderr, so it never mixes into a command's
|
|
228
|
+
output on stdout."""
|
|
229
|
+
if (
|
|
230
|
+
not terminal
|
|
231
|
+
or settings.QUIET
|
|
232
|
+
or not settings.SPONSOR_PLEDGE
|
|
233
|
+
or command in _NO_SPONSOR_PLEDGE
|
|
234
|
+
):
|
|
235
|
+
return None
|
|
236
|
+
return cs.CLI_MSG_SPONSOR_PLEDGE.format(url=cs.SPONSOR_URL)
|
|
206
237
|
|
|
207
238
|
|
|
208
239
|
app = typer.Typer(
|
|
@@ -225,6 +256,9 @@ def _version_callback(value: bool) -> None:
|
|
|
225
256
|
)
|
|
226
257
|
for line in credits_lines():
|
|
227
258
|
app_context.console.print(line, highlight=False)
|
|
259
|
+
app_context.console.print(
|
|
260
|
+
cs.CLI_MSG_SPONSOR.format(url=cs.SPONSOR_URL), highlight=False
|
|
261
|
+
)
|
|
228
262
|
raise typer.Exit()
|
|
229
263
|
|
|
230
264
|
|
|
@@ -3463,6 +3497,21 @@ def delete_project(
|
|
|
3463
3497
|
app_context.console.print(style(choice.refusal, cs.Color.RED))
|
|
3464
3498
|
raise typer.Exit(1)
|
|
3465
3499
|
|
|
3500
|
+
# A directory indexed under two names used to lose both on delete
|
|
3501
|
+
# (#2665). The delete is ownership-scoped now; say so before it runs.
|
|
3502
|
+
roots = ingestor.list_project_roots()
|
|
3503
|
+
if sharing := projects_sharing_root(project_name, roots):
|
|
3504
|
+
app_context.console.print(
|
|
3505
|
+
style(
|
|
3506
|
+
cs.CLI_WARN_DELETE_PROJECT_SHARED_ROOT.format(
|
|
3507
|
+
projects=", ".join(sharing),
|
|
3508
|
+
project_name=project_name,
|
|
3509
|
+
root_path=roots[project_name],
|
|
3510
|
+
),
|
|
3511
|
+
cs.Color.YELLOW,
|
|
3512
|
+
)
|
|
3513
|
+
)
|
|
3514
|
+
|
|
3466
3515
|
_info(
|
|
3467
3516
|
style(
|
|
3468
3517
|
cs.CLI_MSG_DELETING_PROJECT.format(project_name=project_name),
|
codebase_rag/config.py
CHANGED
|
@@ -584,6 +584,10 @@ class AppConfig(BaseSettings):
|
|
|
584
584
|
|
|
585
585
|
QUIET: bool = Field(False, validation_alias="CGR_QUIET")
|
|
586
586
|
|
|
587
|
+
# The GitHub Sponsors line a finished command ends on in a terminal; set
|
|
588
|
+
# false to drop it without the rest of the output `--quiet` drops.
|
|
589
|
+
SPONSOR_PLEDGE: bool = Field(True, validation_alias="CGR_SPONSOR_PLEDGE")
|
|
590
|
+
|
|
587
591
|
# Compaction discards old tool output to bound the context (#1500). It is
|
|
588
592
|
# on by default because an unbounded history eventually fails the request
|
|
589
593
|
# outright, but a mechanism that drops data must be declinable: set this
|
|
@@ -160,6 +160,13 @@ TS_FIELD_CONSEQUENCE = "consequence"
|
|
|
160
160
|
TS_FIELD_ARGUMENT = "argument"
|
|
161
161
|
TS_PY_UNARY_OPERATOR = "unary_operator"
|
|
162
162
|
TS_PY_CONCATENATED_STRING = "concatenated_string"
|
|
163
|
+
# Argument values that run no code when evaluated, so `change_signature` may
|
|
164
|
+
# reorder a call site made only of them (issue #1533).
|
|
165
|
+
TS_PY_INTEGER = "integer"
|
|
166
|
+
TS_PY_FLOAT = "float"
|
|
167
|
+
TS_PY_TRUE = "true"
|
|
168
|
+
TS_PY_FALSE = "false"
|
|
169
|
+
TS_PY_NONE = "none"
|
|
163
170
|
# Read positions the binding scan of `python_name_binding_sites` recognises.
|
|
164
171
|
TS_PY_SLICE = "slice"
|
|
165
172
|
TS_PY_ASSERT_STATEMENT = "assert_statement"
|
codebase_rag/constants/cli.py
CHANGED
|
@@ -249,6 +249,11 @@ CLI_ERR_CLEAN_UNKNOWN_PROJECTS = (
|
|
|
249
249
|
CLI_MSG_CLEAN_ABORTED = "Aborted: the graph was left untouched."
|
|
250
250
|
CLI_MSG_DELETING_PROJECT = "Deleting project '{project_name}' from the graph..."
|
|
251
251
|
CLI_MSG_PROJECT_DELETED = "Project '{project_name}' deleted successfully."
|
|
252
|
+
CLI_WARN_DELETE_PROJECT_SHARED_ROOT = (
|
|
253
|
+
"Warning: project(s) {projects} were indexed from the same directory as "
|
|
254
|
+
"'{project_name}' ({root_path}). Only what '{project_name}' owns is "
|
|
255
|
+
"deleted; the Folder and File nodes they also hold are kept."
|
|
256
|
+
)
|
|
252
257
|
# Deleting never defaults to the current directory (issue #2415).
|
|
253
258
|
CLI_ERR_PROJECT_NAME_REQUIRED = (
|
|
254
259
|
"Error: name the project with --project, or pass --repo-path."
|
|
@@ -287,6 +292,13 @@ CREDITS_URL = "https://docs.code-graph-rag.com/credits/"
|
|
|
287
292
|
CLI_MSG_CREDITS = "Third-party credits: {url}"
|
|
288
293
|
CLI_MSG_CREDITS_NOTICES = "Third-party notices: {name}, beside this binary"
|
|
289
294
|
THIRD_PARTY_NOTICES_SUFFIX = ".THIRD_PARTY_NOTICES.txt"
|
|
295
|
+
# The project's GitHub Sponsors page, named beside the credits by `--version`
|
|
296
|
+
# and, on a terminal, after most commands finish.
|
|
297
|
+
SPONSOR_URL = "https://github.com/sponsors/vitali87"
|
|
298
|
+
CLI_MSG_SPONSOR = "Sponsor development: {url}"
|
|
299
|
+
CLI_MSG_SPONSOR_PLEDGE = (
|
|
300
|
+
"Find cgr useful? Pledge your support: {url} (CGR_SPONSOR_PLEDGE=false hides this)"
|
|
301
|
+
)
|
|
290
302
|
CLI_MSG_HINT_TARGET_REPO = (
|
|
291
303
|
"\nHint: Make sure TARGET_REPO_PATH environment variable is set."
|
|
292
304
|
)
|