gitgalaxy 2.0.2__tar.gz → 2.0.3__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.
- {gitgalaxy-2.0.2/gitgalaxy.egg-info → gitgalaxy-2.0.3}/PKG-INFO +8 -8
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/README.md +7 -7
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/core/detector.py +86 -57
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/core/network_risk_sensor.py +29 -14
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/core/prism.py +2 -2
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/galaxyscope.py +107 -53
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/physics/signal_processor.py +133 -137
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/physics/spectral_auditor.py +23 -23
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/recorders/audit_recorder.py +94 -97
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/recorders/gpu_recorder.py +67 -64
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/recorders/llm_recorder.py +116 -80
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/recorders/record_keeper.py +85 -77
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/standards/language_standards.py +167 -178
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/tools/ai_guardrails/ai_appsec_sensor.py +8 -8
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/tools/ai_guardrails/dev_agent_firewall.py +19 -19
- gitgalaxy-2.0.3/gitgalaxy/tools/network_auditing/full_api_network_map.py +279 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/tools/supply_chain_security/binary_anomaly_detector.py +40 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/tools/supply_chain_security/supply_chain_firewall.py +23 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3/gitgalaxy.egg-info}/PKG-INFO +8 -8
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/pyproject.toml +1 -1
- gitgalaxy-2.0.2/gitgalaxy/tools/network_auditing/full_api_network_map.py +0 -132
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/LICENSE +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/MANIFEST.in +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/__init__.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/cobol_refractor_controller.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/cobol_to_java_controller.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/core/__init__.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/core/aperture.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/core/guidestar_lens.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/core/state_rehydrator.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/physics/__init__.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/physics/chronometer.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/physics/neural_auditor.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/recorders/__init__.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/security/__init__.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/security/security_auditor.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/security/security_lens.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/standards/__init__.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/standards/analysis_lens.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/standards/gitgalaxy_config.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/standards/language_lens.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/tools/__init__.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/tools/cobol_to_cobol/cobol_agent_task_forge.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/tools/cobol_to_cobol/cobol_compiler_forge.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/tools/cobol_to_cobol/cobol_dag_architect.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/tools/cobol_to_cobol/cobol_etl_unpacker.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/tools/cobol_to_cobol/cobol_graveyard_finder.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/tools/cobol_to_cobol/cobol_jcl_auditor.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/tools/cobol_to_cobol/cobol_jcl_forge.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/tools/cobol_to_cobol/cobol_lexical_patcher.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/tools/cobol_to_cobol/cobol_microservice_slicer.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/tools/cobol_to_cobol/cobol_schema_forge.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/tools/cobol_to_cobol/cobol_system_limits_reporter.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/tools/cobol_to_java/batch_test_harness.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/tools/cobol_to_java/cobol_to_java_agent_forge.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/tools/cobol_to_java/cobol_to_java_api_contract_forge.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/tools/cobol_to_java/cobol_to_java_build_forge.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/tools/cobol_to_java/cobol_to_java_decoder_forge.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/tools/cobol_to_java/cobol_to_java_service_forge.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/tools/cobol_to_java/cobol_to_java_spring_forge.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/tools/compliance/sbom_generator.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/tools/supply_chain_security/vault_sentinel.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/tools/terabyte_log_scanning/pii_leak_hunter.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy/tools/terabyte_log_scanning/terabyte_log_scanner.py +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy.egg-info/SOURCES.txt +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy.egg-info/dependency_links.txt +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy.egg-info/entry_points.txt +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/gitgalaxy.egg-info/top_level.txt +0 -0
- {gitgalaxy-2.0.2 → gitgalaxy-2.0.3}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gitgalaxy
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.3
|
|
4
4
|
Summary: An AST-free, zero-trust static analysis engine for mapping architectural risk, securing CI/CD pipelines, and modernizing legacy monoliths.
|
|
5
5
|
Author: Joseph Michael Esquibel
|
|
6
6
|
Project-URL: Homepage, https://gitgalaxy.io
|
|
@@ -116,25 +116,25 @@ The central blAST engine. It bypasses rigid ASTs using mathematical heuristics t
|
|
|
116
116
|
|
|
117
117
|
GitGalaxy operates on a modular Hub-and-Spoke architecture. While the core engine provides the overarching physics and cartography, our specialized toolsets leverage that deterministic graph to execute enterprise-grade operations. The following toolsets provide novel heuristic solutions to several open problems in computing.
|
|
118
118
|
|
|
119
|
-
### [Legacy Modernization: Converting Raw Cobol Repos to Java Spring Boots](gitgalaxy/tools/cobol_to_java/
|
|
119
|
+
### [Legacy Modernization: Converting Raw Cobol Repos to Java Spring Boots](gitgalaxy/tools/cobol_to_java/)
|
|
120
120
|
A deterministic, high-fidelity translation pipeline. It converts legacy COBOL into fully compiling, modern Spring Boot architectures, mapping memory exactly and scaffolding JPA entities, REST controllers, and Maven builds before utilizing AI to translate isolated business logic.
|
|
121
121
|
|
|
122
|
-
### [Legacy Modernization: Converting Raw Cobol Repos to cleaner Cobol Repos](gitgalaxy/tools/cobol_to_cobol/
|
|
122
|
+
### [Legacy Modernization: Converting Raw Cobol Repos to cleaner Cobol Repos](gitgalaxy/tools/cobol_to_cobol/)
|
|
123
123
|
A mathematical x-ray suite for sanitizing mainframe monoliths. It safely neutralizes legacy lexical traps, extracts dead "Graveyard" memory, maps topological DAG execution orders, and generates Zero-Trust JCL configurations for modern cloud deployments.
|
|
124
124
|
|
|
125
|
-
### [Supply Chain Security](gitgalaxy/tools/supply_chain_security/
|
|
125
|
+
### [Supply Chain Security](gitgalaxy/tools/supply_chain_security/)
|
|
126
126
|
Extreme-velocity pre-commit firewalls. Instead of trusting manifest files, it scans physical internals to block steganography, sub-atomic XOR decryption loops, homoglyph typosquatting, and exposed cryptographic vaults before they ever enter your CI/CD pipeline.
|
|
127
127
|
|
|
128
|
-
### [Network Auditing](gitgalaxy/tools/network_auditing/
|
|
128
|
+
### [Network Auditing](gitgalaxy/tools/network_auditing/)
|
|
129
129
|
A deterministic mapping tool that hunts undocumented vulnerabilities. It uses structural regex to find active physical routing logic (Express, Spring Boot, FastAPI) and applies set theory against official OpenAPI/Swagger documentation to isolate critical Shadow APIs and outdated Ghost APIs.
|
|
130
130
|
|
|
131
|
-
### [Terabyte Log Scanning](gitgalaxy/tools/terabyte_log_scanning/
|
|
131
|
+
### [Terabyte Log Scanning](gitgalaxy/tools/terabyte_log_scanning/)
|
|
132
132
|
Unindexed, tactical log analysis operating at 0.07 GB/sec. It streams massive database dumps to deterministically hunt and mask PII (Credit Cards, SSNs, AWS Keys) and uses static architecture maps to prove exact runtime execution frequencies with ASCII time-series histograms.
|
|
133
133
|
|
|
134
|
-
### [Compliance Operations - SBOM Generators](gitgalaxy/tools/compliance/
|
|
134
|
+
### [Compliance Operations - SBOM Generators](gitgalaxy/tools/compliance/)
|
|
135
135
|
A Zero-Trust Software Bill of Materials (SBOM) generator. It refuses to blindly trust `package.json` or `requirements.txt` files, instead locating the physical dependencies on disk, mathematically verifying their entropy and linguistic identity, and generating strict CycloneDX 1.4 JSON reports.
|
|
136
136
|
|
|
137
|
-
### [AI Guardrails](gitgalaxy/tools/ai_guardrails/
|
|
137
|
+
### [AI Guardrails](gitgalaxy/tools/ai_guardrails/)
|
|
138
138
|
Specialized keyword sensors protecting both your application and your codebase. The AppSec Sensor detects weaponized LLM features (RCE funnels, exfiltration risks), while the Dev Agent Firewall evaluates token mass and blast radius to restrict autonomous coding agents from modifying dangerous over context token-draining files. Helps identify which files need to be chunked to reduce context overload.
|
|
139
139
|
|
|
140
140
|
## The Web Viewer (Frictionless Dashboards)
|
|
@@ -93,25 +93,25 @@ The central blAST engine. It bypasses rigid ASTs using mathematical heuristics t
|
|
|
93
93
|
|
|
94
94
|
GitGalaxy operates on a modular Hub-and-Spoke architecture. While the core engine provides the overarching physics and cartography, our specialized toolsets leverage that deterministic graph to execute enterprise-grade operations. The following toolsets provide novel heuristic solutions to several open problems in computing.
|
|
95
95
|
|
|
96
|
-
### [Legacy Modernization: Converting Raw Cobol Repos to Java Spring Boots](gitgalaxy/tools/cobol_to_java/
|
|
96
|
+
### [Legacy Modernization: Converting Raw Cobol Repos to Java Spring Boots](gitgalaxy/tools/cobol_to_java/)
|
|
97
97
|
A deterministic, high-fidelity translation pipeline. It converts legacy COBOL into fully compiling, modern Spring Boot architectures, mapping memory exactly and scaffolding JPA entities, REST controllers, and Maven builds before utilizing AI to translate isolated business logic.
|
|
98
98
|
|
|
99
|
-
### [Legacy Modernization: Converting Raw Cobol Repos to cleaner Cobol Repos](gitgalaxy/tools/cobol_to_cobol/
|
|
99
|
+
### [Legacy Modernization: Converting Raw Cobol Repos to cleaner Cobol Repos](gitgalaxy/tools/cobol_to_cobol/)
|
|
100
100
|
A mathematical x-ray suite for sanitizing mainframe monoliths. It safely neutralizes legacy lexical traps, extracts dead "Graveyard" memory, maps topological DAG execution orders, and generates Zero-Trust JCL configurations for modern cloud deployments.
|
|
101
101
|
|
|
102
|
-
### [Supply Chain Security](gitgalaxy/tools/supply_chain_security/
|
|
102
|
+
### [Supply Chain Security](gitgalaxy/tools/supply_chain_security/)
|
|
103
103
|
Extreme-velocity pre-commit firewalls. Instead of trusting manifest files, it scans physical internals to block steganography, sub-atomic XOR decryption loops, homoglyph typosquatting, and exposed cryptographic vaults before they ever enter your CI/CD pipeline.
|
|
104
104
|
|
|
105
|
-
### [Network Auditing](gitgalaxy/tools/network_auditing/
|
|
105
|
+
### [Network Auditing](gitgalaxy/tools/network_auditing/)
|
|
106
106
|
A deterministic mapping tool that hunts undocumented vulnerabilities. It uses structural regex to find active physical routing logic (Express, Spring Boot, FastAPI) and applies set theory against official OpenAPI/Swagger documentation to isolate critical Shadow APIs and outdated Ghost APIs.
|
|
107
107
|
|
|
108
|
-
### [Terabyte Log Scanning](gitgalaxy/tools/terabyte_log_scanning/
|
|
108
|
+
### [Terabyte Log Scanning](gitgalaxy/tools/terabyte_log_scanning/)
|
|
109
109
|
Unindexed, tactical log analysis operating at 0.07 GB/sec. It streams massive database dumps to deterministically hunt and mask PII (Credit Cards, SSNs, AWS Keys) and uses static architecture maps to prove exact runtime execution frequencies with ASCII time-series histograms.
|
|
110
110
|
|
|
111
|
-
### [Compliance Operations - SBOM Generators](gitgalaxy/tools/compliance/
|
|
111
|
+
### [Compliance Operations - SBOM Generators](gitgalaxy/tools/compliance/)
|
|
112
112
|
A Zero-Trust Software Bill of Materials (SBOM) generator. It refuses to blindly trust `package.json` or `requirements.txt` files, instead locating the physical dependencies on disk, mathematically verifying their entropy and linguistic identity, and generating strict CycloneDX 1.4 JSON reports.
|
|
113
113
|
|
|
114
|
-
### [AI Guardrails](gitgalaxy/tools/ai_guardrails/
|
|
114
|
+
### [AI Guardrails](gitgalaxy/tools/ai_guardrails/)
|
|
115
115
|
Specialized keyword sensors protecting both your application and your codebase. The AppSec Sensor detects weaponized LLM features (RCE funnels, exfiltration risks), while the Dev Agent Firewall evaluates token mass and blast radius to restrict autonomous coding agents from modifying dangerous over context token-draining files. Helps identify which files need to be chunked to reduce context overload.
|
|
116
116
|
|
|
117
117
|
## The Web Viewer (Frictionless Dashboards)
|
|
@@ -15,7 +15,7 @@ import time
|
|
|
15
15
|
import bisect
|
|
16
16
|
from typing import Dict, List, Any, TypedDict, Optional, Tuple
|
|
17
17
|
from gitgalaxy.standards.analysis_lens import RECORDING_SCHEMAS
|
|
18
|
-
from gitgalaxy.standards.language_standards import
|
|
18
|
+
from gitgalaxy.standards.language_standards import LANGUAGE_DEFINITIONS
|
|
19
19
|
HAS_TIKTOKEN = False
|
|
20
20
|
try:
|
|
21
21
|
import tiktoken
|
|
@@ -25,21 +25,21 @@ try:
|
|
|
25
25
|
except ImportError:
|
|
26
26
|
pass
|
|
27
27
|
|
|
28
|
-
def get_token_mass(text: str, deep_scan: bool = False) -> int:
|
|
29
|
-
"""Calculates context window footprint.
|
|
28
|
+
def get_token_mass(text: str, deep_scan: bool = False) -> Optional[int]:
|
|
29
|
+
"""Calculates context window footprint. Returns None if tiktoken is missing to prevent dataset poisoning."""
|
|
30
30
|
if not text:
|
|
31
31
|
return 0
|
|
32
|
-
if
|
|
32
|
+
if HAS_TIKTOKEN:
|
|
33
33
|
return len(ENCODER.encode(text, disallowed_special=()))
|
|
34
|
-
return
|
|
34
|
+
return None
|
|
35
35
|
|
|
36
36
|
# ==============================================================================
|
|
37
37
|
# GitGalaxy Phase 2.5 & 7.5: Logic Splicer & Cartographer
|
|
38
38
|
# Strategy v6.3.0 Protocol: Fluid-State Counters, Language Sliding & Semantic Modes
|
|
39
39
|
# ==============================================================================
|
|
40
40
|
|
|
41
|
-
class
|
|
42
|
-
"""Metadata for a surgically extracted logic block."""
|
|
41
|
+
class FunctionNode(TypedDict, total=False):
|
|
42
|
+
"""Metadata for a surgically extracted function or logic block."""
|
|
43
43
|
name: str
|
|
44
44
|
|
|
45
45
|
# Dual-Key mapping to ensure compatibility with all pipeline versions
|
|
@@ -81,7 +81,7 @@ class Satellite(TypedDict, total=False):
|
|
|
81
81
|
class LogicData(TypedDict, total=False):
|
|
82
82
|
"""The standardized output schema for Strategy v6.2.0+ compliance."""
|
|
83
83
|
equations: Dict[str, int]
|
|
84
|
-
|
|
84
|
+
functions: List[FunctionNode]
|
|
85
85
|
logic_density: float
|
|
86
86
|
sum_fxn_impact: float
|
|
87
87
|
total_control_flow_ratio: float
|
|
@@ -370,20 +370,60 @@ class LogicSplicer:
|
|
|
370
370
|
equations = self.comment_analysis(comment_stream, self.primary_lang_id, equations)
|
|
371
371
|
|
|
372
372
|
t_slice = time.time()
|
|
373
|
-
|
|
373
|
+
functions, sum_fxn_impact = self._function_slice(segments, segment_spatial_maps, regex_telemetry if profile_regex else None)
|
|
374
374
|
|
|
375
|
-
# ---> NEW: FAST CLASS
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
375
|
+
# ---> NEW: FAST CLASS EXTRACTOR & FUNCTION LINKAGE <---
|
|
376
|
+
classes = []
|
|
377
|
+
# Upgraded regex to catch standard OOP entities across polyglot languages
|
|
378
|
+
class_pattern = re.compile(r'^\s*(?:export\s+|public\s+|abstract\s+)?(?:class|struct|interface|trait|enum)\s+([a-zA-Z0-9_]+)(?:\s*(?:\(|extends\s+|implements\s+|:\s*)([a-zA-Z0-9_]+))?', re.MULTILINE)
|
|
379
|
+
|
|
380
|
+
class_matches = list(class_pattern.finditer(code_stream))
|
|
381
|
+
for i, match in enumerate(class_matches):
|
|
382
|
+
start_idx = match.start()
|
|
383
|
+
# Scope ends at the next class declaration, or the end of the file
|
|
384
|
+
end_idx = class_matches[i+1].start() if i + 1 < len(class_matches) else len(code_stream)
|
|
385
|
+
|
|
386
|
+
# Convert raw string indices to line numbers for spatial bounding
|
|
387
|
+
start_line = code_stream.count('\n', 0, start_idx) + 1
|
|
388
|
+
end_line = code_stream.count('\n', 0, end_idx) + 1
|
|
389
|
+
|
|
390
|
+
classes.append({
|
|
380
391
|
"name": match.group(1),
|
|
381
392
|
"inheritance": [match.group(2)] if match.group(2) else [],
|
|
393
|
+
"_start_line": start_line,
|
|
394
|
+
"_end_line": end_line,
|
|
382
395
|
"method_count": 0,
|
|
383
396
|
"state_entanglement": 0.0,
|
|
384
397
|
"lcom_score": 0.0
|
|
385
398
|
})
|
|
386
399
|
|
|
400
|
+
# ---> LINK FUNCTIONS TO CLASSES & CALCULATE CLASS PHYSICS <---
|
|
401
|
+
for cls in classes:
|
|
402
|
+
class_methods = []
|
|
403
|
+
for func in functions:
|
|
404
|
+
# If the function falls within the spatial bounds of the class
|
|
405
|
+
if cls["_start_line"] <= func.get("start_line", 0) <= cls["_end_line"]:
|
|
406
|
+
func["parent_class_name"] = cls["name"]
|
|
407
|
+
class_methods.append(func)
|
|
408
|
+
|
|
409
|
+
cls["method_count"] = len(class_methods)
|
|
410
|
+
|
|
411
|
+
# State Entanglement: Density of state mutations (flux) inside the class methods
|
|
412
|
+
total_flux = sum(m.get("hit_vector", {}).get("flux", 0) for m in class_methods)
|
|
413
|
+
cls["state_entanglement"] = round((total_flux / max(cls["method_count"], 1)) * 5.0, 2)
|
|
414
|
+
|
|
415
|
+
# LCOM (Lack of Cohesion of Methods): Approximation using arguments vs mutations
|
|
416
|
+
total_args = sum(m.get("args", 0) for m in class_methods)
|
|
417
|
+
if cls["method_count"] > 1:
|
|
418
|
+
cohesion_ratio = total_flux / max(total_args, 1)
|
|
419
|
+
cls["lcom_score"] = round(max(0.0, min(100.0, 100.0 - (cohesion_ratio * 25.0))), 2)
|
|
420
|
+
else:
|
|
421
|
+
cls["lcom_score"] = 0.0
|
|
422
|
+
|
|
423
|
+
# Erase the temporary spatial boundaries
|
|
424
|
+
del cls["_start_line"]
|
|
425
|
+
del cls["_end_line"]
|
|
426
|
+
|
|
387
427
|
branch_hits = equations.get("branch", 0)
|
|
388
428
|
linear_hits = equations.get("linear", 0)
|
|
389
429
|
total_control_flow_ratio = round(branch_hits / max(branch_hits + linear_hits, 1), 3)
|
|
@@ -398,23 +438,23 @@ class LogicSplicer:
|
|
|
398
438
|
token_counts = collections.Counter(re.findall(r'\b\w+\b', code_stream))
|
|
399
439
|
|
|
400
440
|
orphan_count = 0
|
|
401
|
-
|
|
402
|
-
|
|
441
|
+
func_names = [f.get("name", "") for f in functions]
|
|
442
|
+
func_name_counts = collections.Counter(func_names)
|
|
403
443
|
|
|
404
|
-
for
|
|
405
|
-
|
|
444
|
+
for func in functions:
|
|
445
|
+
func_name = func.get("name", "")
|
|
406
446
|
usage_status = 0 # 0 = Normal
|
|
407
447
|
|
|
408
448
|
# Check for Duplicates (Defined multiple times in the same file)
|
|
409
|
-
if
|
|
449
|
+
if func_name and func_name_counts[func_name] > 1:
|
|
410
450
|
usage_status = 2 # 2 = Duplicate
|
|
411
|
-
elif len(
|
|
451
|
+
elif len(func_name) > 3 and func_name not in {"Unknown_Sat", "Anonymous_Block", "Main", "Declarative_Block"}:
|
|
412
452
|
# If the function name only exists where it was defined, it's an orphan
|
|
413
|
-
if token_counts[
|
|
453
|
+
if token_counts[func_name] <= 1:
|
|
414
454
|
orphan_count += 1
|
|
415
455
|
usage_status = 1 # 1 = Orphan / Unused
|
|
416
456
|
|
|
417
|
-
|
|
457
|
+
func["usage_status"] = usage_status
|
|
418
458
|
|
|
419
459
|
if orphan_count > 0:
|
|
420
460
|
equations["design_slop_orphans"] = orphan_count
|
|
@@ -424,15 +464,15 @@ class LogicSplicer:
|
|
|
424
464
|
|
|
425
465
|
result_payload = {
|
|
426
466
|
"equations": equations,
|
|
427
|
-
"
|
|
428
|
-
"
|
|
467
|
+
"classes": classes,
|
|
468
|
+
"functions": functions,
|
|
429
469
|
"logic_density": logic_density,
|
|
430
470
|
"sum_fxn_impact": sum_fxn_impact,
|
|
431
471
|
"total_control_flow_ratio": total_control_flow_ratio,
|
|
432
472
|
"metadata": ghost_meta,
|
|
433
473
|
"mitigation_telemetry": mitigation_telemetry,
|
|
434
474
|
"token_mass": file_token_mass,
|
|
435
|
-
"financial_read_cost": round((file_token_mass / 1000000) * 3.00, 5)
|
|
475
|
+
"financial_read_cost": round((file_token_mass / 1000000) * 3.00, 5) if file_token_mass is not None else None
|
|
436
476
|
}
|
|
437
477
|
if profile_regex:
|
|
438
478
|
result_payload["regex_telemetry"] = regex_telemetry
|
|
@@ -699,9 +739,6 @@ class LogicSplicer:
|
|
|
699
739
|
for seg_lang, seg_code, _ in segments:
|
|
700
740
|
# 1. Grab the language-specific rules
|
|
701
741
|
rules = self.languages.get(seg_lang, {}).get('rules', {}).copy()
|
|
702
|
-
|
|
703
|
-
# 2. Seamlessly merge in the Universal Rules!
|
|
704
|
-
rules.update(UNIVERSAL_RULES)
|
|
705
742
|
|
|
706
743
|
seg_len = len(seg_code)
|
|
707
744
|
|
|
@@ -978,7 +1015,7 @@ class LogicSplicer:
|
|
|
978
1015
|
# THE MASTER DISPATCHER
|
|
979
1016
|
# ==============================================================================
|
|
980
1017
|
|
|
981
|
-
def _function_slice(self, segments: List[Tuple[str, str, int]], segment_spatial_maps: List[Dict[str, List[int]]], regex_telemetry: dict = None) -> Tuple[List[
|
|
1018
|
+
def _function_slice(self, segments: List[Tuple[str, str, int]], segment_spatial_maps: List[Dict[str, List[int]]], regex_telemetry: dict = None) -> Tuple[List[FunctionNode], float]:
|
|
982
1019
|
"""The Master Routing Dispatcher: Directs the optical signal into the correct integration mode."""
|
|
983
1020
|
all_satellites = []
|
|
984
1021
|
global_impact = 0.0
|
|
@@ -1034,7 +1071,7 @@ class LogicSplicer:
|
|
|
1034
1071
|
# INTEGRATION MODES (Slicers)
|
|
1035
1072
|
# ==============================================================================
|
|
1036
1073
|
|
|
1037
|
-
def _slice_by_labels(self, code: str, rules: Dict[str, Any], offset: int, spatial_map: Dict[str, List[int]]) -> Tuple[List[
|
|
1074
|
+
def _slice_by_labels(self, code: str, rules: Dict[str, Any], offset: int, spatial_map: Dict[str, List[int]]) -> Tuple[List[FunctionNode], float]:
|
|
1038
1075
|
"""[INTEGRATION MODE A] - Greedy Label-Based Scan (Assembly, COBOL)."""
|
|
1039
1076
|
satellites = []
|
|
1040
1077
|
sum_fxn_impact = 0.0
|
|
@@ -1087,7 +1124,7 @@ class LogicSplicer:
|
|
|
1087
1124
|
|
|
1088
1125
|
return satellites, sum_fxn_impact
|
|
1089
1126
|
|
|
1090
|
-
def _slice_by_braces(self, code: str, lang_id: str, rules: Dict[str, Any], offset: int, spatial_map: Dict[str, List[int]], family: str = 'std_c') -> Tuple[List[
|
|
1127
|
+
def _slice_by_braces(self, code: str, lang_id: str, rules: Dict[str, Any], offset: int, spatial_map: Dict[str, List[int]], family: str = 'std_c') -> Tuple[List[FunctionNode], float]:
|
|
1091
1128
|
|
|
1092
1129
|
"""[INTEGRATION MODE B] - Global Recursive Scope Analysis (C-Family & Lisp)."""
|
|
1093
1130
|
satellites = []
|
|
@@ -1232,7 +1269,7 @@ class LogicSplicer:
|
|
|
1232
1269
|
|
|
1233
1270
|
return satellites, sum_fxn_impact
|
|
1234
1271
|
|
|
1235
|
-
def _slice_by_indentation(self, code: str, rules: Dict[str, Any], offset: int, spatial_map: Dict[str, List[int]]) -> Tuple[List[
|
|
1272
|
+
def _slice_by_indentation(self, code: str, rules: Dict[str, Any], offset: int, spatial_map: Dict[str, List[int]]) -> Tuple[List[FunctionNode], float]:
|
|
1236
1273
|
"""[INTEGRATION MODE C] - Density Stratification (Python, YAML)."""
|
|
1237
1274
|
satellites = []
|
|
1238
1275
|
sum_fxn_impact = 0.0
|
|
@@ -1331,7 +1368,7 @@ class LogicSplicer:
|
|
|
1331
1368
|
|
|
1332
1369
|
return satellites, sum_fxn_impact
|
|
1333
1370
|
|
|
1334
|
-
def _slice_by_keywords(self, code: str, lang_id: str, rules: Dict[str, Any], offset: int, spatial_map: Dict[str, List[int]]) -> Tuple[List[
|
|
1371
|
+
def _slice_by_keywords(self, code: str, lang_id: str, rules: Dict[str, Any], offset: int, spatial_map: Dict[str, List[int]]) -> Tuple[List[FunctionNode], float]:
|
|
1335
1372
|
"""[INTEGRATION MODE D] - Semantic Handshake Stack (Shell, Ruby, Lua)."""
|
|
1336
1373
|
self.logger.debug(f"[DIAGNOSTIC] Mode D: Initiating _slice_by_keywords for {lang_id}")
|
|
1337
1374
|
config = SemanticScopeRegistry.get_config(lang_id)
|
|
@@ -1451,7 +1488,7 @@ class LogicSplicer:
|
|
|
1451
1488
|
self.logger.debug(f"[DIAGNOSTIC] Mode D: Extracted {len(satellites)} satellites.")
|
|
1452
1489
|
return satellites, sum_fxn_impact
|
|
1453
1490
|
|
|
1454
|
-
def _slice_by_terminator(self, code: str, lang_id: str, rules: Dict[str, Any], offset: int, spatial_map: Dict[str, List[int]]) -> Tuple[List[
|
|
1491
|
+
def _slice_by_terminator(self, code: str, lang_id: str, rules: Dict[str, Any], offset: int, spatial_map: Dict[str, List[int]]) -> Tuple[List[FunctionNode], float]:
|
|
1455
1492
|
"""[INTEGRATION MODE E] - Terminator Cleaving (SQL, Erlang, Prolog)."""
|
|
1456
1493
|
config = SemanticScopeRegistry.get_config(lang_id)
|
|
1457
1494
|
if not config:
|
|
@@ -1546,7 +1583,7 @@ class LogicSplicer:
|
|
|
1546
1583
|
# SHARED SATELLITE PHYSICS ENGINE
|
|
1547
1584
|
# ==============================================================================
|
|
1548
1585
|
|
|
1549
|
-
def _process_satellite_physics(self, name: str, block: str, loc: int, start_line: int, end_line: int, rules: Dict[str, Any], start_idx: int = 0, end_idx: int = 0, spatial_map: Dict[str, List[int]] = None) -> Tuple[
|
|
1586
|
+
def _process_satellite_physics(self, name: str, block: str, loc: int, start_line: int, end_line: int, rules: Dict[str, Any], start_idx: int = 0, end_idx: int = 0, spatial_map: Dict[str, List[int]] = None) -> Tuple[FunctionNode, float]:
|
|
1550
1587
|
args_pattern = rules.get('args')
|
|
1551
1588
|
|
|
1552
1589
|
# --- THE FIX: O(log N) Binary Search for Structural DNA ---
|
|
@@ -1606,12 +1643,12 @@ class LogicSplicer:
|
|
|
1606
1643
|
is_recursive = True
|
|
1607
1644
|
|
|
1608
1645
|
# --- NEW: FUNCTION-LEVEL DATABASE COMPLEXITY (Data Gravity) ---
|
|
1609
|
-
#
|
|
1646
|
+
# Mapped to active v6 schemas: 'io' (DB connections/SQL), 'flux' (mutations), and 'serialization_parsing' (JSON/ORMs).
|
|
1610
1647
|
db_complexity = 0
|
|
1611
1648
|
if hit_vector:
|
|
1612
|
-
db_complexity = (hit_vector.get("
|
|
1613
|
-
(hit_vector.get("
|
|
1614
|
-
(hit_vector.get("
|
|
1649
|
+
db_complexity = (hit_vector.get("io", 0) * 3) + \
|
|
1650
|
+
(hit_vector.get("serialization_parsing", 0) * 2) + \
|
|
1651
|
+
(hit_vector.get("flux", 0) * 1)
|
|
1615
1652
|
|
|
1616
1653
|
# --- NEW: FUNCTION-LEVEL KEYWORD DENSITY (The Micro-Auditor) ---
|
|
1617
1654
|
# Total structural signals divided by the physical lines of the function.
|
|
@@ -1684,7 +1721,7 @@ class LogicSplicer:
|
|
|
1684
1721
|
# Deduplicate and filter (excluding the function calling itself recursively)
|
|
1685
1722
|
calls_out = list(set([c for c in raw_calls if c not in ignore_keywords and c != name]))[:20]
|
|
1686
1723
|
|
|
1687
|
-
sat:
|
|
1724
|
+
sat: FunctionNode = {
|
|
1688
1725
|
"name": name[:40],
|
|
1689
1726
|
"calls_out_to": calls_out,
|
|
1690
1727
|
"texture": texture_str,
|
|
@@ -1846,26 +1883,26 @@ class Cartographer:
|
|
|
1846
1883
|
|
|
1847
1884
|
|
|
1848
1885
|
|
|
1849
|
-
def
|
|
1886
|
+
def map_repository(self, parsed_files: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
|
|
1850
1887
|
"""
|
|
1851
1888
|
Injects 3D coordinates using a Ray-Casting Dynamic Mask.
|
|
1852
|
-
Ensures
|
|
1889
|
+
Ensures ecosystem graphs wrap around previous turns of the spiral by measuring
|
|
1853
1890
|
all previously placed obstruction circles.
|
|
1854
1891
|
"""
|
|
1855
|
-
if not
|
|
1892
|
+
if not parsed_files:
|
|
1856
1893
|
return []
|
|
1857
1894
|
|
|
1858
|
-
self.logger.info(f"Cartographer: Executing Ray-Casting Dynamic Mask packing for {len(
|
|
1895
|
+
self.logger.info(f"Cartographer: Executing Ray-Casting Dynamic Mask packing for {len(parsed_files)} bodies...")
|
|
1859
1896
|
|
|
1860
1897
|
# 1. Sectorization
|
|
1861
1898
|
sectors: Dict[str, List[Dict[str, Any]]] = {}
|
|
1862
|
-
for
|
|
1863
|
-
path_str =
|
|
1899
|
+
for file_node in parsed_files:
|
|
1900
|
+
path_str = file_node.get("path", file_node.get("filename", ""))
|
|
1864
1901
|
parts = [p for p in path_str.replace("\\", "/").split("/") if p]
|
|
1865
1902
|
sector_name = "/".join(parts[:-1]) if len(parts) > 1 else "__monolith__"
|
|
1866
|
-
|
|
1903
|
+
file_node["directory_group"] = sector_name # Saves to RAM for other reports
|
|
1867
1904
|
if sector_name not in sectors: sectors[sector_name] = []
|
|
1868
|
-
sectors[sector_name].append(
|
|
1905
|
+
sectors[sector_name].append(file_node)
|
|
1869
1906
|
|
|
1870
1907
|
# 2. Hull Calculation
|
|
1871
1908
|
sector_stats = []
|
|
@@ -1995,16 +2032,8 @@ class Cartographer:
|
|
|
1995
2032
|
star["pos_y"] = round(sec_y + ly + jit_y, 2)
|
|
1996
2033
|
star["pos_z"] = round(sec_z + lz + jit_z, 2)
|
|
1997
2034
|
|
|
1998
|
-
|
|
1999
|
-
star["layout"]["x"], star["layout"]["y"], star["layout"]["z"] = star["pos_x"], star["pos_y"], star["pos_z"]
|
|
2000
|
-
|
|
2001
|
-
prev_radius = sec_radius
|
|
2002
|
-
|
|
2003
|
-
return stars
|
|
2035
|
+
return parsed_files
|
|
2004
2036
|
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
2037
|
def _get_mass(self, star: Dict[str, Any]) -> float:
|
|
2009
2038
|
"""Safely extracts mass regardless of which JSON version the pipeline is using."""
|
|
2010
2039
|
if "forensics" in star:
|
|
@@ -96,7 +96,14 @@ class NetworkRiskSensor:
|
|
|
96
96
|
# Note: We limit betweenness to a sample (k=50) if the graph is massive (>5k nodes) to keep it O(N) fast.
|
|
97
97
|
k_val = min(len(G.nodes()), 50) if len(G.nodes()) > 5000 else None
|
|
98
98
|
betweenness = nx.betweenness_centrality(G, k=k_val, weight='weight')
|
|
99
|
-
|
|
99
|
+
|
|
100
|
+
# Put a hard ceiling on Closeness Centrality to prevent the O(N^2) trap
|
|
101
|
+
if len(G.nodes()) > 5000:
|
|
102
|
+
self.logger.warning("Graph too massive for Closeness Centrality. Bypassing.")
|
|
103
|
+
closeness = {n: 0.0 for n in G.nodes()}
|
|
104
|
+
else:
|
|
105
|
+
closeness = nx.closeness_centrality(G)
|
|
106
|
+
|
|
100
107
|
except Exception as e:
|
|
101
108
|
self.logger.warning(f"Network math failed to converge, defaulting to 0: {e}")
|
|
102
109
|
pagerank = {n: 0.0 for n in G.nodes()}
|
|
@@ -183,8 +190,12 @@ class NetworkRiskSensor:
|
|
|
183
190
|
|
|
184
191
|
# A. Modularity (Spaghetti vs Microservice)
|
|
185
192
|
try:
|
|
186
|
-
|
|
187
|
-
|
|
193
|
+
if len(U) > 5000:
|
|
194
|
+
self.logger.warning("Graph too massive for Modularity. Bypassing.")
|
|
195
|
+
macro_metrics["modularity"] = 0.0
|
|
196
|
+
else:
|
|
197
|
+
communities = community.greedy_modularity_communities(U)
|
|
198
|
+
macro_metrics["modularity"] = round(community.modularity(U, communities), 4)
|
|
188
199
|
except Exception: pass
|
|
189
200
|
|
|
190
201
|
# B. Assortativity (Resiliency)
|
|
@@ -202,9 +213,13 @@ class NetworkRiskSensor:
|
|
|
202
213
|
|
|
203
214
|
# D. Average Shortest Path (Coupling Distance)
|
|
204
215
|
try:
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
216
|
+
if len(U) > 5000:
|
|
217
|
+
self.logger.warning("Graph too massive for Avg Path Length. Bypassing.")
|
|
218
|
+
macro_metrics["avg_path_length"] = 0.0
|
|
219
|
+
else:
|
|
220
|
+
largest_cc = max(nx.connected_components(U), key=len)
|
|
221
|
+
subgraph = U.subgraph(largest_cc)
|
|
222
|
+
macro_metrics["avg_path_length"] = round(nx.average_shortest_path_length(subgraph), 4)
|
|
208
223
|
except Exception: pass
|
|
209
224
|
|
|
210
225
|
# E. Articulation Points (Shatter Risk)
|
|
@@ -260,21 +275,21 @@ class NetworkRiskSensor:
|
|
|
260
275
|
|
|
261
276
|
if "telemetry" not in s: s["telemetry"] = {}
|
|
262
277
|
s["telemetry"]["network_metrics"] = {
|
|
263
|
-
"pagerank_score":
|
|
264
|
-
"normalized_blast_radius":
|
|
265
|
-
"betweenness_score":
|
|
266
|
-
"closeness_score":
|
|
278
|
+
"pagerank_score": None,
|
|
279
|
+
"normalized_blast_radius": None,
|
|
280
|
+
"betweenness_score": None,
|
|
281
|
+
"closeness_score": None,
|
|
267
282
|
"in_degree": in_d,
|
|
268
283
|
"out_degree": out_d,
|
|
269
284
|
"producer_ratio": round(producer_ratio, 3),
|
|
270
285
|
"ecosystem_role": ecosystem_role,
|
|
271
|
-
"systemic_threat_vector":
|
|
272
|
-
"is_algorithmic_bottleneck":
|
|
286
|
+
"systemic_threat_vector": None,
|
|
287
|
+
"is_algorithmic_bottleneck": None
|
|
273
288
|
}
|
|
274
289
|
s["telemetry"]["popularity"] = in_d
|
|
275
290
|
|
|
276
291
|
macro_metrics = {
|
|
277
|
-
"modularity":
|
|
278
|
-
"avg_path_length":
|
|
292
|
+
"modularity": None, "assortativity": None, "cyclic_density": None,
|
|
293
|
+
"avg_path_length": None, "articulation_points": None
|
|
279
294
|
}
|
|
280
295
|
return stars, macro_metrics
|
|
@@ -106,9 +106,9 @@ class Prism:
|
|
|
106
106
|
self.logger.debug("Refraction skipped: Empty content buffer.")
|
|
107
107
|
return {"code_stream": "", "comment_stream": "", "coding_loc": 0, "doc_loc": 0}
|
|
108
108
|
|
|
109
|
-
# --- THE
|
|
109
|
+
# --- THE UNPARSABLE BYPASS (Spec 2.3.4.A.1) ---
|
|
110
110
|
if primary_lang in ("undeterminable", "unknown"):
|
|
111
|
-
self.logger.debug(f"
|
|
111
|
+
self.logger.debug(f"Unparsable Bypass: '{primary_lang}' signal routed to Active Matter intact.")
|
|
112
112
|
coding_loc = len([l for l in content.split('\n') if l.strip()])
|
|
113
113
|
return {
|
|
114
114
|
"code_stream": content,
|