agent-coderag 1.2.0__tar.gz → 1.2.1__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 (41) hide show
  1. {agent_coderag-1.2.0/agent_coderag.egg-info → agent_coderag-1.2.1}/PKG-INFO +2 -1
  2. {agent_coderag-1.2.0 → agent_coderag-1.2.1/agent_coderag.egg-info}/PKG-INFO +2 -1
  3. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/agent_coderag.egg-info/requires.txt +1 -0
  4. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/code_rag/entry/cli.py +24 -27
  5. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/pyproject.toml +2 -1
  6. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/tests/test_cli.py +7 -5
  7. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/LICENSE +0 -0
  8. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/NOTICE +0 -0
  9. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/README.md +0 -0
  10. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/agent_coderag.egg-info/SOURCES.txt +0 -0
  11. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/agent_coderag.egg-info/dependency_links.txt +0 -0
  12. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/agent_coderag.egg-info/entry_points.txt +0 -0
  13. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/agent_coderag.egg-info/top_level.txt +0 -0
  14. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/code_rag/__init__.py +0 -0
  15. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/code_rag/core/__init__.py +0 -0
  16. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/code_rag/core/interfaces.py +0 -0
  17. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/code_rag/core/manager.py +0 -0
  18. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/code_rag/core/models.py +0 -0
  19. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/code_rag/discovery/__init__.py +0 -0
  20. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/code_rag/discovery/dependency.py +0 -0
  21. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/code_rag/discovery/java_discovery.py +0 -0
  22. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/code_rag/entry/__init__.py +0 -0
  23. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/code_rag/intelligence/__init__.py +0 -0
  24. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/code_rag/intelligence/distiller.py +0 -0
  25. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/code_rag/intelligence/embedder.py +0 -0
  26. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/code_rag/parsers/__init__.py +0 -0
  27. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/code_rag/parsers/ast_index.py +0 -0
  28. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/code_rag/parsers/java_parser.py +0 -0
  29. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/code_rag/parsers/multi_parser.py +0 -0
  30. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/code_rag/storage/__init__.py +0 -0
  31. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/code_rag/storage/duckdb_impl.py +0 -0
  32. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/setup.cfg +0 -0
  33. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/tests/test_ast_parser.py +0 -0
  34. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/tests/test_code_rag_simple.py +0 -0
  35. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/tests/test_dependency_discovery.py +0 -0
  36. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/tests/test_distiller.py +0 -0
  37. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/tests/test_embedder.py +0 -0
  38. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/tests/test_interfaces.py +0 -0
  39. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/tests/test_java_parser.py +0 -0
  40. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/tests/test_multi_parser.py +0 -0
  41. {agent_coderag-1.2.0 → agent_coderag-1.2.1}/tests/test_parsers.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agent-coderag
3
- Version: 1.2.0
3
+ Version: 1.2.1
4
4
  Summary: Lightweight semantic code search and distillation utility for AI coding agents. It solves the API knowledge gap via real-time local signature extraction and intent analysis without PyTorch. Optimized for token efficiency, it compresses codebase context into compact semantic summaries stored in a local DuckDB vector similarity index.
5
5
  Author-email: Igor Boloban <naranor@gmail.com>
6
6
  License: MIT
@@ -31,6 +31,7 @@ Requires-Dist: pydantic
31
31
  Requires-Dist: httpx
32
32
  Requires-Dist: aiofiles
33
33
  Requires-Dist: javalang
34
+ Requires-Dist: pathspec
34
35
  Dynamic: license-file
35
36
 
36
37
  # Agent-CodeRAG
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agent-coderag
3
- Version: 1.2.0
3
+ Version: 1.2.1
4
4
  Summary: Lightweight semantic code search and distillation utility for AI coding agents. It solves the API knowledge gap via real-time local signature extraction and intent analysis without PyTorch. Optimized for token efficiency, it compresses codebase context into compact semantic summaries stored in a local DuckDB vector similarity index.
5
5
  Author-email: Igor Boloban <naranor@gmail.com>
6
6
  License: MIT
@@ -31,6 +31,7 @@ Requires-Dist: pydantic
31
31
  Requires-Dist: httpx
32
32
  Requires-Dist: aiofiles
33
33
  Requires-Dist: javalang
34
+ Requires-Dist: pathspec
34
35
  Dynamic: license-file
35
36
 
36
37
  # Agent-CodeRAG
@@ -7,3 +7,4 @@ pydantic
7
7
  httpx
8
8
  aiofiles
9
9
  javalang
10
+ pathspec
@@ -4,10 +4,10 @@ import os
4
4
  import sys
5
5
  import logging
6
6
  import json
7
- import fnmatch
8
7
  from pathlib import Path
9
- from typing import Optional, List
8
+ from typing import Optional
10
9
  import httpx
10
+ import pathspec
11
11
 
12
12
  # Suppress external library noise before they are imported by other modules
13
13
  os.environ["LITELLM_VERBOSE"] = "FALSE"
@@ -45,53 +45,50 @@ def get_manager(db_path: str, onnx_path: Optional[str] = None, verbose: bool = F
45
45
 
46
46
  return CodeRAGManager(storage, parser, distiller)
47
47
 
48
- def load_ignore_patterns() -> List[str]:
48
+ def load_ignore_patterns() -> pathspec.PathSpec:
49
49
  """Loads patterns from .gitignore if it exists."""
50
- patterns = []
50
+ lines = []
51
51
  ignore_file = Path(".gitignore")
52
52
  if ignore_file.exists():
53
53
  try:
54
54
  with open(ignore_file, "r", encoding="utf-8") as f:
55
- for line in f:
56
- line = line.strip()
57
- if line and not line.startswith("#"):
58
- patterns.append(line)
55
+ lines = f.readlines()
59
56
  except Exception as e:
60
57
  logger.warning("Failed to load .gitignore: %s", e)
61
- return patterns
62
-
63
- def should_index(path: Path, ignore_patterns: Optional[List[str]] = None) -> bool:
58
+
59
+ # Always exclude common noisy directories as a safety measure
60
+ common_excludes = [
61
+ 'venv/', '.venv/', '__pycache__/', '.git/', '.pytest_cache/',
62
+ 'dist/', 'build/', 'node_modules/', '.idea/', '.vscode/', '.agents/', '.ai/'
63
+ ]
64
+ return pathspec.PathSpec.from_lines('gitignore', lines + common_excludes)
65
+
66
+ def should_index(path: Path, ignore_spec: Optional[pathspec.PathSpec] = None) -> bool:
64
67
  """Filters files that should NOT be indexed."""
65
- # 1. Default hardcoded exclusions
66
- parts = set(path.parts)
67
- exclude_dirs = {'tests', 'venv', '__pycache__', '.git', '.pytest_cache', 'dist', 'build', 'node_modules'}
68
- if any(ex in parts for ex in exclude_dirs):
69
- return False
68
+ # Convert backslashes to forward slashes for cross-platform matching
69
+ path_str = str(path).replace(os.sep, '/')
70
70
 
71
- # 2. Check .gitignore patterns
72
- if ignore_patterns:
73
- p_str = str(path).replace(os.sep, '/')
74
- for pattern in ignore_patterns:
75
- # Simple fnmatch support for gitignore-like patterns
76
- if fnmatch.fnmatch(p_str, pattern) or fnmatch.fnmatch(p_str, f"*/{pattern}"):
77
- return False
71
+ # 1. Check against ignore spec (including .gitignore and common excludes)
72
+ if ignore_spec and ignore_spec.match_file(path_str):
73
+ return False
78
74
 
79
75
  return path.suffix in {'.py', '.java'}
80
76
 
81
77
  async def sync_cmd(args):
82
78
  manager = get_manager(args.db, args.onnx, args.verbose)
83
- ignore_patterns = load_ignore_patterns()
79
+ ignore_spec = load_ignore_patterns()
84
80
 
85
81
  extensions = ("*.py", "*.java")
86
82
 
87
83
  if args.path:
88
84
  target_path = Path(args.path)
89
85
  if target_path.is_file():
90
- await manager.sync_file(str(target_path), force_distill=args.force)
86
+ if should_index(target_path, ignore_spec):
87
+ await manager.sync_file(str(target_path), force_distill=args.force)
91
88
  else:
92
89
  paths = []
93
90
  for ext in extensions:
94
- paths.extend([str(p) for p in target_path.rglob(ext) if should_index(p, ignore_patterns)])
91
+ paths.extend([str(p) for p in target_path.rglob(ext) if should_index(p, ignore_spec)])
95
92
 
96
93
  if args.verbose:
97
94
  logger.info("Indexing %d files...", len(paths))
@@ -99,7 +96,7 @@ async def sync_cmd(args):
99
96
  elif args.all:
100
97
  paths = []
101
98
  for ext in extensions:
102
- paths.extend([str(p) for p in Path(".").rglob(ext) if should_index(p, ignore_patterns)])
99
+ paths.extend([str(p) for p in Path(".").rglob(ext) if should_index(p, ignore_spec)])
103
100
 
104
101
  if args.verbose:
105
102
  logger.info("Indexing %d files...", len(paths))
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "agent-coderag"
7
- version = "1.2.0"
7
+ version = "1.2.1"
8
8
  description = "Lightweight semantic code search and distillation utility for AI coding agents. It solves the API knowledge gap via real-time local signature extraction and intent analysis without PyTorch. Optimized for token efficiency, it compresses codebase context into compact semantic summaries stored in a local DuckDB vector similarity index."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -34,6 +34,7 @@ dependencies = [
34
34
  "httpx",
35
35
  "aiofiles",
36
36
  "javalang",
37
+ "pathspec",
37
38
  ]
38
39
 
39
40
  [project.urls]
@@ -23,12 +23,14 @@ class TestCLIHelpers:
23
23
  assert cli.should_index(path) is False
24
24
 
25
25
  def test_should_index_excluded_paths(self):
26
- """Test should_index excludes certain paths."""
26
+ """Test should_index excludes certain paths using spec."""
27
27
  from pathlib import Path
28
- assert cli.should_index(Path("tests/test.py")) is False
29
- assert cli.should_index(Path("venv/lib.py")) is False
30
- assert cli.should_index(Path("__pycache__/test.py")) is False
31
- assert cli.should_index(Path(".git/config.py")) is False
28
+ spec = cli.load_ignore_patterns()
29
+ assert cli.should_index(Path("venv/lib.py"), spec) is False
30
+ assert cli.should_index(Path("sub/venv/lib.py"), spec) is False
31
+ assert cli.should_index(Path("__pycache__/test.py"), spec) is False
32
+ assert cli.should_index(Path(".git/config"), spec) is False
33
+ assert cli.should_index(Path("node_modules/pkg/index.js"), spec) is False
32
34
 
33
35
  @patch('code_rag.entry.cli.DistillerConfig')
34
36
  @patch('code_rag.entry.cli.Embedder')
File without changes
File without changes
File without changes
File without changes