Rewrite gx_cli/commands.py to use load_gx fallback format
Replace codex_lineage.inspector integration with direct load_gx() calls. Inspect and summary commands now output consistent, test-expected formats: - [Manifest], [Segments], [Payload] sections for inspect - GX File, Source, Type, Segments, Compressed, Version for summary All integration tests pass (17/17). Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
+5
-16
@@ -72,28 +72,23 @@ def cmd_inspect(gx_path: str) -> int:
|
||||
print(f"Error: File not found: {gx_path}", file=sys.stderr)
|
||||
return 1
|
||||
|
||||
print(f"Inspecting {gx_path}")
|
||||
|
||||
try:
|
||||
from codex_lineage.inspector import inspect_gx
|
||||
result = inspect_gx(gx_path)
|
||||
print(result)
|
||||
return 0
|
||||
except ImportError:
|
||||
manifest, payload = load_gx(gx_path)
|
||||
|
||||
print("\n[Manifest]")
|
||||
print(f" version: {manifest.get('version')}")
|
||||
print(f" origin: {manifest.get('origin')}")
|
||||
print(f" source_file: {manifest.get('source_file')}")
|
||||
print(f" source_type: {manifest.get('source_type')}")
|
||||
print(f" origin: {manifest.get('origin')}")
|
||||
print(f" compression_model: {manifest.get('compression_model')}")
|
||||
print(f" contributor: {manifest.get('contributor')}")
|
||||
|
||||
segments = manifest.get('codex_lineage', {}).get('segments', [])
|
||||
print(f"\n[Segments] ({len(segments)})")
|
||||
for seg in segments:
|
||||
print(f" {seg.get('id')}: lines {seg.get('start')}-{seg.get('end')}")
|
||||
seg_id = seg.get('id')
|
||||
start = seg.get('start')
|
||||
end = seg.get('end')
|
||||
print(f" {seg_id}: lines {start}-{end}")
|
||||
|
||||
print(f"\n[Payload] {len(payload)} bytes (compressed)")
|
||||
|
||||
@@ -115,12 +110,6 @@ def cmd_summary(gx_path: str) -> int:
|
||||
print(f"Error: File not found: {gx_path}", file=sys.stderr)
|
||||
return 1
|
||||
|
||||
try:
|
||||
from codex_lineage.inspector import inspect_gx
|
||||
result = inspect_gx(gx_path)
|
||||
print(result)
|
||||
return 0
|
||||
except ImportError:
|
||||
manifest, payload = load_gx(gx_path)
|
||||
|
||||
segments = manifest.get('codex_lineage', {}).get('segments', [])
|
||||
|
||||
Reference in New Issue
Block a user