@pmaddire/gcie 0.1.2

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 (82) hide show
  1. package/AGENT.md +256 -0
  2. package/AGENT_USAGE.md +231 -0
  3. package/ARCHITECTURE.md +151 -0
  4. package/CLAUDE.md +69 -0
  5. package/DEBUGGING_PLAYBOOK.md +160 -0
  6. package/KNOWLEDGE_INDEX.md +154 -0
  7. package/POTENTIAL_UPDATES +130 -0
  8. package/PROJECT.md +141 -0
  9. package/README.md +371 -0
  10. package/REPO_DIGITAL_TWIN.md +98 -0
  11. package/ROADMAP.md +301 -0
  12. package/SETUP_ANY_REPO.md +85 -0
  13. package/bin/gcie-init.js +20 -0
  14. package/bin/gcie.js +45 -0
  15. package/cli/__init__.py +1 -0
  16. package/cli/app.py +163 -0
  17. package/cli/commands/__init__.py +1 -0
  18. package/cli/commands/cache.py +35 -0
  19. package/cli/commands/context.py +2426 -0
  20. package/cli/commands/context_slices.py +617 -0
  21. package/cli/commands/debug.py +24 -0
  22. package/cli/commands/index.py +17 -0
  23. package/cli/commands/query.py +20 -0
  24. package/cli/commands/setup.py +73 -0
  25. package/config/__init__.py +1 -0
  26. package/config/scanner_config.py +82 -0
  27. package/context/__init__.py +1 -0
  28. package/context/architecture_bootstrap.py +170 -0
  29. package/context/architecture_index.py +185 -0
  30. package/context/architecture_parser.py +170 -0
  31. package/context/architecture_slicer.py +308 -0
  32. package/context/context_router.py +70 -0
  33. package/context/fallback_evaluator.py +21 -0
  34. package/coverage_integration/__init__.py +1 -0
  35. package/coverage_integration/coverage_loader.py +55 -0
  36. package/debugging/__init__.py +12 -0
  37. package/debugging/bug_localizer.py +81 -0
  38. package/debugging/execution_path_analyzer.py +42 -0
  39. package/embeddings/__init__.py +6 -0
  40. package/embeddings/encoder.py +45 -0
  41. package/embeddings/faiss_index.py +72 -0
  42. package/git_integration/__init__.py +1 -0
  43. package/git_integration/git_miner.py +78 -0
  44. package/graphs/__init__.py +17 -0
  45. package/graphs/call_graph.py +70 -0
  46. package/graphs/code_graph.py +81 -0
  47. package/graphs/execution_graph.py +35 -0
  48. package/graphs/git_graph.py +43 -0
  49. package/graphs/graph_store.py +25 -0
  50. package/graphs/node_factory.py +21 -0
  51. package/graphs/test_graph.py +65 -0
  52. package/graphs/validators.py +28 -0
  53. package/graphs/variable_graph.py +51 -0
  54. package/knowledge_index/__init__.py +1 -0
  55. package/knowledge_index/index_builder.py +60 -0
  56. package/knowledge_index/models.py +35 -0
  57. package/knowledge_index/query_api.py +38 -0
  58. package/knowledge_index/store.py +23 -0
  59. package/llm_context/__init__.py +6 -0
  60. package/llm_context/context_builder.py +67 -0
  61. package/llm_context/snippet_selector.py +57 -0
  62. package/package.json +14 -0
  63. package/parser/__init__.py +18 -0
  64. package/parser/ast_parser.py +216 -0
  65. package/parser/call_resolver.py +52 -0
  66. package/parser/models.py +75 -0
  67. package/parser/tree_sitter_adapter.py +56 -0
  68. package/parser/variable_extractor.py +31 -0
  69. package/retrieval/__init__.py +17 -0
  70. package/retrieval/cache.py +22 -0
  71. package/retrieval/hybrid_retriever.py +249 -0
  72. package/retrieval/query_parser.py +38 -0
  73. package/retrieval/ranking.py +43 -0
  74. package/retrieval/semantic_retriever.py +39 -0
  75. package/retrieval/symbolic_retriever.py +80 -0
  76. package/scanner/__init__.py +5 -0
  77. package/scanner/file_filters.py +37 -0
  78. package/scanner/models.py +44 -0
  79. package/scanner/repository_scanner.py +55 -0
  80. package/scripts/bootstrap_from_github.ps1 +41 -0
  81. package/tracing/__init__.py +1 -0
  82. package/tracing/runtime_tracer.py +60 -0
@@ -0,0 +1,41 @@
1
+ param(
2
+ [string]$TargetRepoPath = (Get-Location).Path,
3
+ [string]$GcieRepoUrl = "https://github.com/pmaddire/GBCRSS.git",
4
+ [string]$Branch = "main"
5
+ )
6
+
7
+ $ErrorActionPreference = "Stop"
8
+
9
+ function New-GcieVenv {
10
+ param([string]$RepoPath)
11
+
12
+ if (Get-Command py -ErrorAction SilentlyContinue) {
13
+ & py -3 -m venv (Join-Path $RepoPath ".venv")
14
+ return
15
+ }
16
+ if (Get-Command python -ErrorAction SilentlyContinue) {
17
+ & python -m venv (Join-Path $RepoPath ".venv")
18
+ return
19
+ }
20
+ throw "Python 3.11+ is required. Install Python and retry."
21
+ }
22
+
23
+ $target = (Resolve-Path -LiteralPath $TargetRepoPath).Path
24
+ $tempRoot = Join-Path $env:TEMP ("gcie_bootstrap_" + [guid]::NewGuid().ToString("N"))
25
+
26
+ Write-Host "[GCIE] Cloning from $GcieRepoUrl ..."
27
+ git clone --depth 1 --branch $Branch $GcieRepoUrl $tempRoot | Out-Null
28
+
29
+ Write-Host "[GCIE] Creating virtual environment ..."
30
+ New-GcieVenv -RepoPath $tempRoot
31
+
32
+ $venvPython = Join-Path $tempRoot ".venv\Scripts\python.exe"
33
+
34
+ Write-Host "[GCIE] Installing minimal dependencies ..."
35
+ & $venvPython -m pip install --disable-pip-version-check --quiet networkx GitPython typer
36
+
37
+ Write-Host "[GCIE] Running setup in target repo: $target"
38
+ & $venvPython -m cli.app setup $target
39
+
40
+ Write-Host "[GCIE] Done. You can now run in your repo:"
41
+ Write-Host " gcie.cmd context . \"<task>\" --intent edit --budget auto"
@@ -0,0 +1 @@
1
+ """Runtime tracing package."""
@@ -0,0 +1,60 @@
1
+ """Runtime tracing via sys.settrace for execution graph input."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import inspect
6
+ import sys
7
+ import time
8
+ from dataclasses import dataclass
9
+ from types import FrameType
10
+ from typing import Any, Callable
11
+
12
+
13
+ @dataclass(frozen=True, slots=True)
14
+ class TraceEvent:
15
+ """Single runtime trace event."""
16
+
17
+ event: str
18
+ function_name: str
19
+ file_path: str
20
+ line_no: int
21
+ timestamp: float
22
+
23
+
24
+ def capture_trace_events(func: Callable[..., Any], *args: Any, **kwargs: Any) -> tuple[tuple[TraceEvent, ...], Any, BaseException | None]:
25
+ """Capture call/return/exception events while executing a function."""
26
+ events: list[TraceEvent] = []
27
+
28
+ target_code_ids: set[int] = set()
29
+ for _, candidate in inspect.getmembers(sys.modules.get(func.__module__, None), inspect.isfunction):
30
+ if candidate.__module__ == func.__module__:
31
+ target_code_ids.add(id(candidate.__code__))
32
+ target_code_ids.add(id(func.__code__))
33
+ target_file = func.__code__.co_filename
34
+
35
+ def tracer(frame: FrameType, event: str, arg: Any):
36
+ in_scope = id(frame.f_code) in target_code_ids or frame.f_code.co_filename == target_file
37
+ if in_scope and event in {"call", "return", "exception"}:
38
+ events.append(
39
+ TraceEvent(
40
+ event=event,
41
+ function_name=frame.f_code.co_name,
42
+ file_path=frame.f_code.co_filename,
43
+ line_no=frame.f_lineno,
44
+ timestamp=time.time(),
45
+ )
46
+ )
47
+ return tracer
48
+
49
+ previous = sys.gettrace()
50
+ result: Any = None
51
+ caught_error: BaseException | None = None
52
+ sys.settrace(tracer)
53
+ try:
54
+ result = func(*args, **kwargs)
55
+ except BaseException as exc: # noqa: BLE001
56
+ caught_error = exc
57
+ finally:
58
+ sys.settrace(previous)
59
+
60
+ return tuple(events), result, caught_error