coderag-ai 0.3.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.
- coderag_ai-0.3.0/.env.example +55 -0
- coderag_ai-0.3.0/.gitignore +31 -0
- coderag_ai-0.3.0/CODE_OF_CONDUCT.md +31 -0
- coderag_ai-0.3.0/CONTRIBUTING.md +41 -0
- coderag_ai-0.3.0/Dockerfile +27 -0
- coderag_ai-0.3.0/LICENSE +202 -0
- coderag_ai-0.3.0/Makefile +55 -0
- coderag_ai-0.3.0/NOTICE +5 -0
- coderag_ai-0.3.0/PKG-INFO +364 -0
- coderag_ai-0.3.0/README.md +303 -0
- coderag_ai-0.3.0/SECURITY.md +46 -0
- coderag_ai-0.3.0/alembic.ini +41 -0
- coderag_ai-0.3.0/docker/entrypoint.sh +16 -0
- coderag_ai-0.3.0/docker-compose.yml +54 -0
- coderag_ai-0.3.0/docs/adding-language.md +33 -0
- coderag_ai-0.3.0/docs/adr/001-postgres-pgvector.md +18 -0
- coderag_ai-0.3.0/docs/adr/002-structural-chunks.md +17 -0
- coderag_ai-0.3.0/docs/adr/003-hybrid-search.md +18 -0
- coderag_ai-0.3.0/docs/adr/004-tree-sitter.md +16 -0
- coderag_ai-0.3.0/docs/adr/005-llm-provider-independence.md +17 -0
- coderag_ai-0.3.0/docs/adr/006-repository-authorization.md +18 -0
- coderag_ai-0.3.0/docs/adr/007-token-budgeting.md +24 -0
- coderag_ai-0.3.0/docs/architecture.md +70 -0
- coderag_ai-0.3.0/docs/claude-code.md +185 -0
- coderag_ai-0.3.0/docs/evaluation.md +83 -0
- coderag_ai-0.3.0/docs/install-macos.md +126 -0
- coderag_ai-0.3.0/docs/licenses.md +56 -0
- coderag_ai-0.3.0/docs/llm-providers.md +40 -0
- coderag_ai-0.3.0/docs/retrieval.md +39 -0
- coderag_ai-0.3.0/docs/security.md +44 -0
- coderag_ai-0.3.0/docs/vscode-extension.md +188 -0
- coderag_ai-0.3.0/examples/demo-repository/payments/__init__.py +1 -0
- coderag_ai-0.3.0/examples/demo-repository/payments/api.py +25 -0
- coderag_ai-0.3.0/examples/demo-repository/payments/auth.py +20 -0
- coderag_ai-0.3.0/examples/demo-repository/payments/checkout_service.py +19 -0
- coderag_ai-0.3.0/examples/demo-repository/payments/models.py +50 -0
- coderag_ai-0.3.0/examples/demo-repository/payments/payment_repository.py +35 -0
- coderag_ai-0.3.0/examples/demo-repository/payments/payment_service.py +54 -0
- coderag_ai-0.3.0/examples/demo-repository/payments/retry_policy.py +24 -0
- coderag_ai-0.3.0/examples/demo-repository/payments/users.py +24 -0
- coderag_ai-0.3.0/examples/demo-repository/tests/test_payment_service.py +40 -0
- coderag_ai-0.3.0/examples/demo-repository/tests/test_retry_policy.py +23 -0
- coderag_ai-0.3.0/examples/eval/eval_dataset.json +37 -0
- coderag_ai-0.3.0/pyproject.toml +144 -0
- coderag_ai-0.3.0/scripts/gen_initial_migration.py +72 -0
- coderag_ai-0.3.0/src/coderag/__init__.py +12 -0
- coderag_ai-0.3.0/src/coderag/analyzers/__init__.py +0 -0
- coderag_ai-0.3.0/src/coderag/analyzers/base.py +36 -0
- coderag_ai-0.3.0/src/coderag/analyzers/flake8_adapter.py +43 -0
- coderag_ai-0.3.0/src/coderag/analyzers/pylint_adapter.py +50 -0
- coderag_ai-0.3.0/src/coderag/analyzers/workflow.py +107 -0
- coderag_ai-0.3.0/src/coderag/api/__init__.py +0 -0
- coderag_ai-0.3.0/src/coderag/api/app.py +351 -0
- coderag_ai-0.3.0/src/coderag/api/dashboard.py +237 -0
- coderag_ai-0.3.0/src/coderag/api/schemas.py +181 -0
- coderag_ai-0.3.0/src/coderag/cli/__init__.py +0 -0
- coderag_ai-0.3.0/src/coderag/cli/main.py +359 -0
- coderag_ai-0.3.0/src/coderag/context/__init__.py +0 -0
- coderag_ai-0.3.0/src/coderag/context/builder.py +206 -0
- coderag_ai-0.3.0/src/coderag/context/package.py +100 -0
- coderag_ai-0.3.0/src/coderag/core/__init__.py +0 -0
- coderag_ai-0.3.0/src/coderag/core/config.py +100 -0
- coderag_ai-0.3.0/src/coderag/core/logging.py +58 -0
- coderag_ai-0.3.0/src/coderag/core/text.py +80 -0
- coderag_ai-0.3.0/src/coderag/core/tokens.py +66 -0
- coderag_ai-0.3.0/src/coderag/db/__init__.py +0 -0
- coderag_ai-0.3.0/src/coderag/db/base.py +58 -0
- coderag_ai-0.3.0/src/coderag/db/migrations/env.py +77 -0
- coderag_ai-0.3.0/src/coderag/db/migrations/script.py.mako +26 -0
- coderag_ai-0.3.0/src/coderag/db/migrations/versions/.gitkeep +0 -0
- coderag_ai-0.3.0/src/coderag/db/migrations/versions/9a973932b94d_measure_baseline_tokens.py +41 -0
- coderag_ai-0.3.0/src/coderag/db/migrations/versions/c8a40feeda41_initial_schema.py +227 -0
- coderag_ai-0.3.0/src/coderag/db/models.py +275 -0
- coderag_ai-0.3.0/src/coderag/embeddings/__init__.py +0 -0
- coderag_ai-0.3.0/src/coderag/embeddings/base.py +53 -0
- coderag_ai-0.3.0/src/coderag/embeddings/hashing.py +43 -0
- coderag_ai-0.3.0/src/coderag/embeddings/pipeline.py +87 -0
- coderag_ai-0.3.0/src/coderag/embeddings/registry.py +38 -0
- coderag_ai-0.3.0/src/coderag/embeddings/sentence_transformer.py +47 -0
- coderag_ai-0.3.0/src/coderag/evaluation/__init__.py +0 -0
- coderag_ai-0.3.0/src/coderag/evaluation/datasets.py +36 -0
- coderag_ai-0.3.0/src/coderag/evaluation/harness.py +246 -0
- coderag_ai-0.3.0/src/coderag/git/__init__.py +0 -0
- coderag_ai-0.3.0/src/coderag/git/repo.py +139 -0
- coderag_ai-0.3.0/src/coderag/indexing/__init__.py +0 -0
- coderag_ai-0.3.0/src/coderag/indexing/ignore.py +101 -0
- coderag_ai-0.3.0/src/coderag/indexing/indexer.py +445 -0
- coderag_ai-0.3.0/src/coderag/llm/__init__.py +0 -0
- coderag_ai-0.3.0/src/coderag/llm/anthropic.py +117 -0
- coderag_ai-0.3.0/src/coderag/llm/base.py +60 -0
- coderag_ai-0.3.0/src/coderag/llm/null.py +16 -0
- coderag_ai-0.3.0/src/coderag/llm/registry.py +17 -0
- coderag_ai-0.3.0/src/coderag/localdb.py +100 -0
- coderag_ai-0.3.0/src/coderag/mcp_server.py +209 -0
- coderag_ai-0.3.0/src/coderag/parsing/__init__.py +0 -0
- coderag_ai-0.3.0/src/coderag/parsing/base.py +76 -0
- coderag_ai-0.3.0/src/coderag/parsing/python.py +294 -0
- coderag_ai-0.3.0/src/coderag/parsing/registry.py +40 -0
- coderag_ai-0.3.0/src/coderag/retrieval/__init__.py +0 -0
- coderag_ai-0.3.0/src/coderag/retrieval/base.py +60 -0
- coderag_ai-0.3.0/src/coderag/retrieval/engine.py +176 -0
- coderag_ai-0.3.0/src/coderag/retrieval/fusion.py +41 -0
- coderag_ai-0.3.0/src/coderag/retrieval/graph.py +139 -0
- coderag_ai-0.3.0/src/coderag/retrieval/lexical.py +57 -0
- coderag_ai-0.3.0/src/coderag/retrieval/reranking.py +99 -0
- coderag_ai-0.3.0/src/coderag/retrieval/semantic.py +53 -0
- coderag_ai-0.3.0/src/coderag/retrieval/symbol.py +91 -0
- coderag_ai-0.3.0/src/coderag/security/__init__.py +0 -0
- coderag_ai-0.3.0/src/coderag/security/authz.py +35 -0
- coderag_ai-0.3.0/src/coderag/security/secrets.py +110 -0
- coderag_ai-0.3.0/src/coderag/service.py +160 -0
- coderag_ai-0.3.0/src/coderag/telemetry.py +72 -0
- coderag_ai-0.3.0/tests/__init__.py +0 -0
- coderag_ai-0.3.0/tests/conftest.py +88 -0
- coderag_ai-0.3.0/tests/test_phase0_db.py +136 -0
- coderag_ai-0.3.0/tests/test_phase0_migrations.py +47 -0
- coderag_ai-0.3.0/tests/test_phase10_analyzers.py +87 -0
- coderag_ai-0.3.0/tests/test_phase11_dashboard.py +52 -0
- coderag_ai-0.3.0/tests/test_phase12_mcp.py +95 -0
- coderag_ai-0.3.0/tests/test_phase13_measure.py +79 -0
- coderag_ai-0.3.0/tests/test_phase14_localdb.py +35 -0
- coderag_ai-0.3.0/tests/test_phase1_indexer.py +131 -0
- coderag_ai-0.3.0/tests/test_phase1_parser.py +106 -0
- coderag_ai-0.3.0/tests/test_phase2_cli.py +28 -0
- coderag_ai-0.3.0/tests/test_phase2_retrieval.py +83 -0
- coderag_ai-0.3.0/tests/test_phase3_embeddings.py +51 -0
- coderag_ai-0.3.0/tests/test_phase3_semantic.py +88 -0
- coderag_ai-0.3.0/tests/test_phase3_sentence_transformer.py +34 -0
- coderag_ai-0.3.0/tests/test_phase4_graph.py +101 -0
- coderag_ai-0.3.0/tests/test_phase5_context_db.py +76 -0
- coderag_ai-0.3.0/tests/test_phase5_context_unit.py +87 -0
- coderag_ai-0.3.0/tests/test_phase6_api.py +83 -0
- coderag_ai-0.3.0/tests/test_phase6_ask.py +69 -0
- coderag_ai-0.3.0/tests/test_phase6_llm.py +83 -0
- coderag_ai-0.3.0/tests/test_phase7_eval.py +75 -0
- coderag_ai-0.3.0/tests/test_phase8_incremental.py +128 -0
- coderag_ai-0.3.0/tests/test_phase9_rerank.py +42 -0
- coderag_ai-0.3.0/tests/test_security_secrets.py +45 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Copy to .env and adjust. All variables are prefixed CODERAG_.
|
|
2
|
+
# Retrieval (index/search/context) works with ONLY the database configured.
|
|
3
|
+
# Only `coderag ask` needs an LLM provider.
|
|
4
|
+
|
|
5
|
+
# ---- Database -------------------------------------------------------------
|
|
6
|
+
CODERAG_DATABASE_URL=postgresql+psycopg://coderag:coderag@localhost:5432/coderag
|
|
7
|
+
CODERAG_DB_ECHO=false
|
|
8
|
+
|
|
9
|
+
# ---- Embeddings (run locally; source code never leaves your infra) --------
|
|
10
|
+
# hashing = deterministic/offline default; sentence_transformer = local ST model.
|
|
11
|
+
CODERAG_EMBEDDING_PROVIDER=hashing
|
|
12
|
+
CODERAG_EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2
|
|
13
|
+
CODERAG_EMBEDDING_DEVICE=cpu
|
|
14
|
+
CODERAG_EMBEDDING_BATCH_SIZE=32
|
|
15
|
+
CODERAG_EMBEDDING_DIMENSION=384
|
|
16
|
+
|
|
17
|
+
# ---- Token counting -------------------------------------------------------
|
|
18
|
+
CODERAG_TOKEN_COUNTER=heuristic # or: tiktoken (needs the `tokens` extra)
|
|
19
|
+
|
|
20
|
+
# ---- Retrieval / fusion (ranking config lives here, not in code) ----------
|
|
21
|
+
CODERAG_RRF_K=60
|
|
22
|
+
CODERAG_WEIGHT_SYMBOL=2.0
|
|
23
|
+
CODERAG_WEIGHT_LEXICAL=1.0
|
|
24
|
+
CODERAG_WEIGHT_SEMANTIC=1.0
|
|
25
|
+
CODERAG_WEIGHT_GRAPH=0.7
|
|
26
|
+
CODERAG_MAX_CANDIDATES=60
|
|
27
|
+
|
|
28
|
+
# ---- Graph expansion (bounded) --------------------------------------------
|
|
29
|
+
CODERAG_GRAPH_ENABLED=true
|
|
30
|
+
CODERAG_GRAPH_MAX_DEPTH=1
|
|
31
|
+
CODERAG_GRAPH_MAX_CANDIDATES=20
|
|
32
|
+
CODERAG_GRAPH_MAX_TOKENS=6000
|
|
33
|
+
|
|
34
|
+
# ---- Reranking (optional; adds latency) -----------------------------------
|
|
35
|
+
CODERAG_RERANKER_ENABLED=false
|
|
36
|
+
CODERAG_RERANKER_MODEL=cross-encoder/ms-marco-MiniLM-L-6-v2
|
|
37
|
+
|
|
38
|
+
# ---- Context builder ------------------------------------------------------
|
|
39
|
+
CODERAG_MAX_CONTEXT_TOKENS=12000
|
|
40
|
+
CODERAG_CONTEXT_OVERHEAD_TOKENS=600
|
|
41
|
+
|
|
42
|
+
# ---- LLM provider (only needed for `ask`) ---------------------------------
|
|
43
|
+
CODERAG_LLM_PROVIDER=anthropic # or: null
|
|
44
|
+
CODERAG_ANTHROPIC_API_KEY=
|
|
45
|
+
CODERAG_ANTHROPIC_BASE_URL=https://api.anthropic.com
|
|
46
|
+
CODERAG_ANTHROPIC_MODEL=claude-sonnet-5
|
|
47
|
+
CODERAG_LLM_MAX_OUTPUT_TOKENS=1024
|
|
48
|
+
|
|
49
|
+
# ---- Analyzers (Phase 10) -------------------------------------------------
|
|
50
|
+
CODERAG_MAX_FIX_ATTEMPTS=2
|
|
51
|
+
|
|
52
|
+
# ---- Security -------------------------------------------------------------
|
|
53
|
+
# Comma-separated extra path fragments to ignore during indexing.
|
|
54
|
+
CODERAG_EXTRA_IGNORE=
|
|
55
|
+
CODERAG_LOG_CODE_SNIPPETS=false
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
.eggs/
|
|
6
|
+
build/
|
|
7
|
+
dist/
|
|
8
|
+
.venv/
|
|
9
|
+
.venv-*/
|
|
10
|
+
venv/
|
|
11
|
+
|
|
12
|
+
# Tooling
|
|
13
|
+
.pytest_cache/
|
|
14
|
+
.ruff_cache/
|
|
15
|
+
.mypy_cache/
|
|
16
|
+
.coverage
|
|
17
|
+
htmlcov/
|
|
18
|
+
|
|
19
|
+
# Env / secrets — never commit real credentials
|
|
20
|
+
.env
|
|
21
|
+
*.local
|
|
22
|
+
|
|
23
|
+
# OS
|
|
24
|
+
.DS_Store
|
|
25
|
+
|
|
26
|
+
# Model / data caches
|
|
27
|
+
.cache/
|
|
28
|
+
*.log
|
|
29
|
+
|
|
30
|
+
# Scratch
|
|
31
|
+
scratchpad/
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a
|
|
6
|
+
harassment-free experience for everyone, regardless of age, body size, visible or invisible
|
|
7
|
+
disability, ethnicity, sex characteristics, gender identity and expression, level of
|
|
8
|
+
experience, education, socio-economic status, nationality, personal appearance, race,
|
|
9
|
+
religion, or sexual identity and orientation.
|
|
10
|
+
|
|
11
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse,
|
|
12
|
+
inclusive, and healthy community.
|
|
13
|
+
|
|
14
|
+
## Our Standards
|
|
15
|
+
|
|
16
|
+
Examples of behavior that contributes to a positive environment include demonstrating
|
|
17
|
+
empathy and kindness, being respectful of differing opinions, giving and gracefully
|
|
18
|
+
accepting constructive feedback, and focusing on what is best for the community.
|
|
19
|
+
|
|
20
|
+
Unacceptable behavior includes harassment, trolling, insulting or derogatory comments,
|
|
21
|
+
publishing others' private information without permission, and other conduct which could
|
|
22
|
+
reasonably be considered inappropriate in a professional setting.
|
|
23
|
+
|
|
24
|
+
## Enforcement
|
|
25
|
+
|
|
26
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the
|
|
27
|
+
project maintainers. All complaints will be reviewed and investigated promptly and fairly.
|
|
28
|
+
|
|
29
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1.
|
|
30
|
+
|
|
31
|
+
[homepage]: https://www.contributor-covenant.org
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Contributing to CodeRAG
|
|
2
|
+
|
|
3
|
+
Thanks for your interest! CodeRAG is Apache-2.0 licensed and built to be extended.
|
|
4
|
+
|
|
5
|
+
## Development setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
make install # venv + dev deps (includes pgserver, so no Docker needed for tests)
|
|
9
|
+
make migrate # apply migrations (needs a running Postgres; see docker-compose.yml)
|
|
10
|
+
make test # full suite (spins up a rootless pgserver automatically)
|
|
11
|
+
make lint typecheck
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Tests use [`pgserver`](https://pypi.org/project/pgserver/), which bundles a PostgreSQL
|
|
15
|
+
build with pgvector and runs without root or Docker. `@pytest.mark.db` marks tests that
|
|
16
|
+
need it; `make test-fast` skips them.
|
|
17
|
+
|
|
18
|
+
## Ground rules
|
|
19
|
+
|
|
20
|
+
- **Every change ships with tests.** No `pass`/`TODO`/`return []` stubs except declared,
|
|
21
|
+
interface-only extension points.
|
|
22
|
+
- **Run `make lint typecheck test` before opening a PR.**
|
|
23
|
+
- **Security:** never log full source code, prompts, secrets, or credentials. Keep all
|
|
24
|
+
retrieval queries scoped by `repository_id`. See [`SECURITY.md`](SECURITY.md).
|
|
25
|
+
- **No proprietary code.** Do not copy from Sourcegraph, Cursor, Cody, or similar. Build on
|
|
26
|
+
public/OSS libraries only.
|
|
27
|
+
- **Configuration over constants.** Ranking weights and budgets live in
|
|
28
|
+
`coderag.core.config.Settings`, not scattered literals.
|
|
29
|
+
|
|
30
|
+
## Extending
|
|
31
|
+
|
|
32
|
+
- New language parser → implement `coderag.parsing.base.LanguageParser`; see
|
|
33
|
+
[`docs/adding-language.md`](docs/adding-language.md).
|
|
34
|
+
- New LLM transport → implement `coderag.llm.base.LLMProvider`; see
|
|
35
|
+
[`docs/llm-providers.md`](docs/llm-providers.md).
|
|
36
|
+
- New embedding model → implement `coderag.embeddings.base.EmbeddingProvider`.
|
|
37
|
+
|
|
38
|
+
## Commit / PR conventions
|
|
39
|
+
|
|
40
|
+
Small, focused commits. Reference the phase or ADR where relevant. Describe *why*, not just
|
|
41
|
+
*what*.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# CodeRAG API + CLI image.
|
|
2
|
+
# Base install only (no torch); enable local embeddings with the `embeddings` extra
|
|
3
|
+
# by changing the pip line to `pip install -e ".[embeddings]"` if you want on-box
|
|
4
|
+
# SentenceTransformers.
|
|
5
|
+
FROM python:3.12-slim AS base
|
|
6
|
+
|
|
7
|
+
ENV PYTHONUNBUFFERED=1 \
|
|
8
|
+
PIP_NO_CACHE_DIR=1 \
|
|
9
|
+
PYTHONDONTWRITEBYTECODE=1
|
|
10
|
+
|
|
11
|
+
# git is needed for repository ingestion (enumeration + diff).
|
|
12
|
+
RUN apt-get update \
|
|
13
|
+
&& apt-get install -y --no-install-recommends git \
|
|
14
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
15
|
+
|
|
16
|
+
WORKDIR /app
|
|
17
|
+
COPY pyproject.toml README.md LICENSE alembic.ini ./
|
|
18
|
+
COPY src ./src
|
|
19
|
+
RUN pip install --upgrade pip && pip install -e .
|
|
20
|
+
|
|
21
|
+
# bundled demo repo (for the optional one-shot demo index) + startup script
|
|
22
|
+
COPY examples ./examples
|
|
23
|
+
COPY docker/entrypoint.sh ./docker/entrypoint.sh
|
|
24
|
+
RUN chmod +x ./docker/entrypoint.sh
|
|
25
|
+
|
|
26
|
+
EXPOSE 8000
|
|
27
|
+
ENTRYPOINT ["./docker/entrypoint.sh"]
|
coderag_ai-0.3.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
.PHONY: help install migrate revision test test-fast lint fmt typecheck run demo clean
|
|
2
|
+
|
|
3
|
+
VENV ?= .venv
|
|
4
|
+
PY := $(VENV)/bin/python
|
|
5
|
+
PIP := $(VENV)/bin/pip
|
|
6
|
+
|
|
7
|
+
help:
|
|
8
|
+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
|
|
9
|
+
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-14s\033[0m %s\n", $$1, $$2}'
|
|
10
|
+
|
|
11
|
+
install: ## Create venv and install the package with dev extras
|
|
12
|
+
uv venv --python 3.12 $(VENV) || python3 -m venv $(VENV)
|
|
13
|
+
. $(VENV)/bin/activate && (uv pip install -e ".[dev]" || pip install -e ".[dev]")
|
|
14
|
+
|
|
15
|
+
migrate: ## Apply database migrations
|
|
16
|
+
. $(VENV)/bin/activate && alembic upgrade head
|
|
17
|
+
|
|
18
|
+
revision: ## Autogenerate a new migration: make revision m="message"
|
|
19
|
+
. $(VENV)/bin/activate && alembic revision --autogenerate -m "$(m)"
|
|
20
|
+
|
|
21
|
+
test: ## Run the full test suite
|
|
22
|
+
. $(VENV)/bin/activate && pytest
|
|
23
|
+
|
|
24
|
+
test-fast: ## Run only tests that don't need the database
|
|
25
|
+
. $(VENV)/bin/activate && pytest -m "not db and not slow"
|
|
26
|
+
|
|
27
|
+
lint: ## Ruff lint
|
|
28
|
+
. $(VENV)/bin/activate && ruff check src tests scripts
|
|
29
|
+
|
|
30
|
+
fmt: ## Ruff autofix + format
|
|
31
|
+
. $(VENV)/bin/activate && ruff check --fix src tests scripts && ruff format src tests scripts
|
|
32
|
+
|
|
33
|
+
typecheck: ## mypy
|
|
34
|
+
. $(VENV)/bin/activate && mypy src/coderag
|
|
35
|
+
|
|
36
|
+
run: ## Run the API locally
|
|
37
|
+
. $(VENV)/bin/activate && uvicorn coderag.api.app:app --reload
|
|
38
|
+
|
|
39
|
+
up: ## One-shot: build + start Postgres and the API (auto-migrate + demo index)
|
|
40
|
+
docker compose up -d --build
|
|
41
|
+
@echo "API: http://localhost:8000"
|
|
42
|
+
@echo "Dashboard: http://localhost:8000/dashboard"
|
|
43
|
+
|
|
44
|
+
down: ## Stop the stack (keeps the pgdata volume)
|
|
45
|
+
docker compose down
|
|
46
|
+
|
|
47
|
+
logs: ## Follow the API logs
|
|
48
|
+
docker compose logs -f api
|
|
49
|
+
|
|
50
|
+
demo: ## Index the bundled demo repo and run a sample search (no LLM needed)
|
|
51
|
+
. $(VENV)/bin/activate && coderag index ./examples/demo-repository \
|
|
52
|
+
&& coderag search "where are failed payments retried?"
|
|
53
|
+
|
|
54
|
+
clean:
|
|
55
|
+
rm -rf $(VENV) .pytest_cache .ruff_cache .mypy_cache build dist *.egg-info
|