codegraph-engine 3.0.0__1-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.
- codegraph/__init__.py +37 -0
- codegraph/agent.py +26 -0
- codegraph/agent_brain.py +2212 -0
- codegraph/agent_capabilities.py +4058 -0
- codegraph/agent_rules.py +531 -0
- codegraph/api_drift.py +455 -0
- codegraph/architecture.py +371 -0
- codegraph/async_queue/__init__.py +50 -0
- codegraph/async_queue/detectors/__init__.py +48 -0
- codegraph/async_queue/detectors/celery.py +160 -0
- codegraph/async_queue/detectors/kafka.py +168 -0
- codegraph/async_queue/detectors/rabbitmq.py +116 -0
- codegraph/async_queue/detectors/redis.py +130 -0
- codegraph/async_queue/detectors/sqs.py +135 -0
- codegraph/async_queue/models.py +161 -0
- codegraph/async_queue/otel_models.py +74 -0
- codegraph/async_queue/otel_parser.py +337 -0
- codegraph/async_queue/reconciler.py +427 -0
- codegraph/async_queue/scanner.py +291 -0
- codegraph/async_queue/traversal.py +447 -0
- codegraph/audit.py +106 -0
- codegraph/binding_resolver.py +616 -0
- codegraph/branch_comparison.py +197 -0
- codegraph/cache.py +95 -0
- codegraph/change_impact.py +547 -0
- codegraph/cli.py +2436 -0
- codegraph/cli_output.py +205 -0
- codegraph/config.py +45 -0
- codegraph/constraints.py +238 -0
- codegraph/context.py +2182 -0
- codegraph/context_freshness.py +351 -0
- codegraph/database/__init__.py +72 -0
- codegraph/database/extractor.py +3651 -0
- codegraph/database/interrogation.py +1494 -0
- codegraph/database/models.py +310 -0
- codegraph/database/schema_drift.py +862 -0
- codegraph/epistemic.py +200 -0
- codegraph/errors.py +282 -0
- codegraph/evidence/__init__.py +15 -0
- codegraph/evidence/citations.py +418 -0
- codegraph/evidence_contract.py +486 -0
- codegraph/frameworks.py +960 -0
- codegraph/frameworks_nestjs.py +502 -0
- codegraph/frameworks_nextjs.py +337 -0
- codegraph/frameworks_react.py +457 -0
- codegraph/freshness.py +335 -0
- codegraph/frontend_html.py +109 -0
- codegraph/git.py +362 -0
- codegraph/git_state.py +545 -0
- codegraph/graph/__init__.py +46 -0
- codegraph/graph/models.py +56 -0
- codegraph/graph/traversal.py +1993 -0
- codegraph/indexing/__init__.py +24 -0
- codegraph/indexing/classifier.py +564 -0
- codegraph/indexing/indexer.py +2578 -0
- codegraph/indexing/models.py +427 -0
- codegraph/indexing/parser.py +3404 -0
- codegraph/indexing/pool.py +136 -0
- codegraph/indexing/scanner.py +211 -0
- codegraph/indexing/telemetry.py +326 -0
- codegraph/indexing/templates.py +418 -0
- codegraph/indexing/test_framework.py +116 -0
- codegraph/installer.py +1702 -0
- codegraph/interrogation.py +2355 -0
- codegraph/llm/__init__.py +3 -0
- codegraph/llm/base.py +15 -0
- codegraph/llm/context.py +20 -0
- codegraph/mcp/__init__.py +3 -0
- codegraph/mcp/server.py +1476 -0
- codegraph/mcp_diagnostics.py +882 -0
- codegraph/memory/__init__.py +3 -0
- codegraph/memory/store.py +46 -0
- codegraph/models.py +310 -0
- codegraph/monorepo.py +925 -0
- codegraph/observability.py +262 -0
- codegraph/optimizer.py +1014 -0
- codegraph/planner.py +417 -0
- codegraph/process_lifecycle.py +1153 -0
- codegraph/py.typed +1 -0
- codegraph/query_expansion.py +199 -0
- codegraph/ranking.py +408 -0
- codegraph/refactor/__init__.py +36 -0
- codegraph/refactor/models.py +114 -0
- codegraph/refactor/renamer.py +844 -0
- codegraph/refactor/transactions.py +414 -0
- codegraph/resolver.py +3968 -0
- codegraph/resources/__init__.py +46 -0
- codegraph/resources/cache.py +117 -0
- codegraph/resources/coalescer.py +83 -0
- codegraph/resources/debouncer.py +98 -0
- codegraph/resources/governor.py +219 -0
- codegraph/resources/monitor.py +102 -0
- codegraph/resources/policy.py +123 -0
- codegraph/retrieval_policy.py +320 -0
- codegraph/roblox.py +2174 -0
- codegraph/route_composer.py +363 -0
- codegraph/route_topology.py +172 -0
- codegraph/runtime/__init__.py +51 -0
- codegraph/runtime/collector.py +155 -0
- codegraph/runtime/db_watcher.py +191 -0
- codegraph/runtime/ingestor.py +692 -0
- codegraph/runtime/models.py +130 -0
- codegraph/runtime/port_inspector.py +304 -0
- codegraph/runtime/reconciliation.py +492 -0
- codegraph/runtime/runner.py +353 -0
- codegraph/runtime/trace_linker.py +175 -0
- codegraph/search/__init__.py +25 -0
- codegraph/search/hybrid.py +846 -0
- codegraph/search/semantic.py +28 -0
- codegraph/security/__init__.py +51 -0
- codegraph/security/paths.py +189 -0
- codegraph/security/redaction.py +633 -0
- codegraph/semantic_conflicts.py +270 -0
- codegraph/semantic_decorators.py +372 -0
- codegraph/structural_diff.py +542 -0
- codegraph/styles.py +144 -0
- codegraph/symbol_history.py +277 -0
- codegraph/target_resolver.py +348 -0
- codegraph/task.py +637 -0
- codegraph/tool_selection_eval.py +1158 -0
- codegraph/tsconfig.py +236 -0
- codegraph/ui/__init__.py +6 -0
- codegraph/ui/server.py +755 -0
- codegraph/watcher.py +323 -0
- codegraph_engine-3.0.0.dist-info/METADATA +859 -0
- codegraph_engine-3.0.0.dist-info/RECORD +130 -0
- codegraph_engine-3.0.0.dist-info/WHEEL +6 -0
- codegraph_engine-3.0.0.dist-info/entry_points.txt +2 -0
- codegraph_engine-3.0.0.dist-info/licenses/LICENSE +21 -0
- codegraph_engine-3.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"""Models and data structures for deterministic, syntax-validated, transaction-safe refactoring."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from dataclasses import asdict, dataclass, field
|
|
5
|
+
from enum import StrEnum
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class RefactorStatus(StrEnum):
|
|
10
|
+
"""Execution status of a refactoring plan or transaction."""
|
|
11
|
+
|
|
12
|
+
READY = "READY"
|
|
13
|
+
BLOCKED = "BLOCKED"
|
|
14
|
+
APPLIED = "APPLIED"
|
|
15
|
+
ROLLED_BACK = "ROLLED_BACK"
|
|
16
|
+
ERROR = "ERROR"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class RefactorRisk(StrEnum):
|
|
20
|
+
"""Assessed risk of an AST refactoring operation."""
|
|
21
|
+
|
|
22
|
+
LOW = "LOW" # All affected relationships are FACT / deterministically verified.
|
|
23
|
+
MEDIUM = "MEDIUM" # POSSIBLE relationships exist but scope is bounded.
|
|
24
|
+
HIGH = "HIGH" # UNKNOWN / AMBIGUOUS / CONFLICT relationships could make rename incomplete.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@dataclass(frozen=True)
|
|
28
|
+
class TokenReplacementSpan:
|
|
29
|
+
"""Exact byte/token coordinates for an AST-grounded replacement."""
|
|
30
|
+
|
|
31
|
+
path: str
|
|
32
|
+
start_line: int
|
|
33
|
+
start_col: int
|
|
34
|
+
end_line: int
|
|
35
|
+
end_col: int
|
|
36
|
+
old_token: str
|
|
37
|
+
new_token: str
|
|
38
|
+
evidence: str
|
|
39
|
+
symbol_id: str
|
|
40
|
+
|
|
41
|
+
def to_dict(self) -> dict[str, Any]:
|
|
42
|
+
return asdict(self)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@dataclass
|
|
46
|
+
class RefactorPlan:
|
|
47
|
+
"""Deterministic refactoring plan before in-memory preview or commit."""
|
|
48
|
+
|
|
49
|
+
transaction_id: str
|
|
50
|
+
target_symbol: str
|
|
51
|
+
new_name: str
|
|
52
|
+
files: list[str] = field(default_factory=list)
|
|
53
|
+
spans: list[TokenReplacementSpan] = field(default_factory=list)
|
|
54
|
+
risk: RefactorRisk = RefactorRisk.LOW
|
|
55
|
+
uncertainty_reasons: list[str] = field(default_factory=list)
|
|
56
|
+
affected_tests: list[str] = field(default_factory=list)
|
|
57
|
+
affected_routes: list[str] = field(default_factory=list)
|
|
58
|
+
affected_db_relationships: list[str] = field(default_factory=list)
|
|
59
|
+
original_file_hashes: dict[str, str] = field(default_factory=dict)
|
|
60
|
+
original_file_sizes: dict[str, int] = field(default_factory=dict)
|
|
61
|
+
original_file_mtimes: dict[str, float] = field(default_factory=dict)
|
|
62
|
+
|
|
63
|
+
def to_dict(self) -> dict[str, Any]:
|
|
64
|
+
return {
|
|
65
|
+
"transaction_id": self.transaction_id,
|
|
66
|
+
"target_symbol": self.target_symbol,
|
|
67
|
+
"new_name": self.new_name,
|
|
68
|
+
"files": sorted(self.files),
|
|
69
|
+
"spans": [s.to_dict() for s in sorted(self.spans, key=lambda x: (x.path, x.start_line, x.start_col))],
|
|
70
|
+
"risk": str(self.risk),
|
|
71
|
+
"uncertainty_reasons": sorted(self.uncertainty_reasons),
|
|
72
|
+
"affected_tests": sorted(self.affected_tests),
|
|
73
|
+
"affected_routes": sorted(self.affected_routes),
|
|
74
|
+
"affected_db_relationships": sorted(self.affected_db_relationships),
|
|
75
|
+
"original_file_hashes": dict(sorted(self.original_file_hashes.items())),
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
@dataclass
|
|
80
|
+
class RefactorResult:
|
|
81
|
+
"""Complete result of a refactor preview, apply, or rollback."""
|
|
82
|
+
|
|
83
|
+
status: RefactorStatus
|
|
84
|
+
target_symbol: str
|
|
85
|
+
new_name: str
|
|
86
|
+
risk: RefactorRisk
|
|
87
|
+
uncertainty_reasons: list[str] = field(default_factory=list)
|
|
88
|
+
files_changed: int = 0
|
|
89
|
+
symbols_changed: int = 0
|
|
90
|
+
spans_count: int = 0
|
|
91
|
+
tests_affected: list[str] = field(default_factory=list)
|
|
92
|
+
routes_affected: list[str] = field(default_factory=list)
|
|
93
|
+
db_affected: list[str] = field(default_factory=list)
|
|
94
|
+
rollback_id: str | None = None
|
|
95
|
+
diffs: dict[str, str] = field(default_factory=dict)
|
|
96
|
+
errors: list[str] = field(default_factory=list)
|
|
97
|
+
|
|
98
|
+
def to_dict(self) -> dict[str, Any]:
|
|
99
|
+
return {
|
|
100
|
+
"status": str(self.status),
|
|
101
|
+
"target_symbol": self.target_symbol,
|
|
102
|
+
"new_name": self.new_name,
|
|
103
|
+
"risk": str(self.risk),
|
|
104
|
+
"uncertainty_reasons": sorted(self.uncertainty_reasons),
|
|
105
|
+
"files_changed": self.files_changed,
|
|
106
|
+
"symbols_changed": self.symbols_changed,
|
|
107
|
+
"spans_count": self.spans_count,
|
|
108
|
+
"tests_affected": sorted(self.tests_affected),
|
|
109
|
+
"routes_affected": sorted(self.routes_affected),
|
|
110
|
+
"db_affected": sorted(self.db_affected),
|
|
111
|
+
"rollback_id": self.rollback_id,
|
|
112
|
+
"diffs": dict(sorted(self.diffs.items())),
|
|
113
|
+
"errors": sorted(self.errors),
|
|
114
|
+
}
|