mdify-cli 3.0.1__tar.gz → 3.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.
- {mdify_cli-3.0.1 → mdify_cli-3.0.3}/PKG-INFO +1 -1
- {mdify_cli-3.0.1 → mdify_cli-3.0.3}/mdify/__init__.py +1 -1
- {mdify_cli-3.0.1 → mdify_cli-3.0.3}/mdify/cli.py +15 -5
- mdify_cli-3.0.3/mdify/formatting.py +29 -0
- {mdify_cli-3.0.1 → mdify_cli-3.0.3}/mdify/ssh/transfer.py +8 -3
- {mdify_cli-3.0.1 → mdify_cli-3.0.3}/mdify_cli.egg-info/PKG-INFO +1 -1
- {mdify_cli-3.0.1 → mdify_cli-3.0.3}/mdify_cli.egg-info/SOURCES.txt +1 -0
- {mdify_cli-3.0.1 → mdify_cli-3.0.3}/pyproject.toml +1 -1
- {mdify_cli-3.0.1 → mdify_cli-3.0.3}/LICENSE +0 -0
- {mdify_cli-3.0.1 → mdify_cli-3.0.3}/README.md +0 -0
- {mdify_cli-3.0.1 → mdify_cli-3.0.3}/assets/mdify.png +0 -0
- {mdify_cli-3.0.1 → mdify_cli-3.0.3}/mdify/__main__.py +0 -0
- {mdify_cli-3.0.1 → mdify_cli-3.0.3}/mdify/container.py +0 -0
- {mdify_cli-3.0.1 → mdify_cli-3.0.3}/mdify/docling_client.py +0 -0
- {mdify_cli-3.0.1 → mdify_cli-3.0.3}/mdify/ssh/__init__.py +0 -0
- {mdify_cli-3.0.1 → mdify_cli-3.0.3}/mdify/ssh/client.py +0 -0
- {mdify_cli-3.0.1 → mdify_cli-3.0.3}/mdify/ssh/models.py +0 -0
- {mdify_cli-3.0.1 → mdify_cli-3.0.3}/mdify/ssh/remote_container.py +0 -0
- {mdify_cli-3.0.1 → mdify_cli-3.0.3}/mdify_cli.egg-info/dependency_links.txt +0 -0
- {mdify_cli-3.0.1 → mdify_cli-3.0.3}/mdify_cli.egg-info/entry_points.txt +0 -0
- {mdify_cli-3.0.1 → mdify_cli-3.0.3}/mdify_cli.egg-info/requires.txt +0 -0
- {mdify_cli-3.0.1 → mdify_cli-3.0.3}/mdify_cli.egg-info/top_level.txt +0 -0
- {mdify_cli-3.0.1 → mdify_cli-3.0.3}/setup.cfg +0 -0
- {mdify_cli-3.0.1 → mdify_cli-3.0.3}/tests/test_cli.py +0 -0
- {mdify_cli-3.0.1 → mdify_cli-3.0.3}/tests/test_container.py +0 -0
- {mdify_cli-3.0.1 → mdify_cli-3.0.3}/tests/test_docling_client.py +0 -0
- {mdify_cli-3.0.1 → mdify_cli-3.0.3}/tests/test_ssh_client.py +0 -0
|
@@ -1050,6 +1050,9 @@ def main_async_remote(args) -> int:
|
|
|
1050
1050
|
|
|
1051
1051
|
async def async_main() -> int:
|
|
1052
1052
|
"""Async implementation of remote conversion."""
|
|
1053
|
+
from mdify.formatting import Colorizer
|
|
1054
|
+
|
|
1055
|
+
color = Colorizer(sys.stderr)
|
|
1053
1056
|
|
|
1054
1057
|
# Resolve timeout value: CLI > env > default 1200
|
|
1055
1058
|
timeout = args.timeout or int(os.environ.get("MDIFY_TIMEOUT", 1200))
|
|
@@ -1238,27 +1241,31 @@ def main_async_remote(args) -> int:
|
|
|
1238
1241
|
try:
|
|
1239
1242
|
for idx, input_file in enumerate(files_to_convert, 1):
|
|
1240
1243
|
if not args.quiet:
|
|
1241
|
-
print(
|
|
1244
|
+
print(
|
|
1245
|
+
f"\n{color.cyan(f'[{idx}/{len(files_to_convert)}] Processing:')} {input_file.name}",
|
|
1246
|
+
file=sys.stderr,
|
|
1247
|
+
)
|
|
1242
1248
|
|
|
1243
1249
|
try:
|
|
1244
1250
|
# Upload file
|
|
1245
1251
|
remote_file_path = f"{work_dir}/{input_file.name}"
|
|
1246
1252
|
|
|
1247
1253
|
if not args.quiet:
|
|
1248
|
-
print(f" Uploading to {remote_file_path}...", file=sys.stderr)
|
|
1254
|
+
print(f" {color.cyan('Uploading to')} {remote_file_path}...", file=sys.stderr)
|
|
1249
1255
|
|
|
1250
1256
|
await transfer_manager.upload_file(
|
|
1251
1257
|
local_path=str(input_file),
|
|
1252
1258
|
remote_path=remote_file_path,
|
|
1253
1259
|
overwrite=True,
|
|
1260
|
+
compress=False,
|
|
1254
1261
|
)
|
|
1255
1262
|
|
|
1256
1263
|
if not args.quiet:
|
|
1257
|
-
print(f" ✓ Upload complete", file=sys.stderr)
|
|
1264
|
+
print(f" {color.green('✓ Upload complete')}", file=sys.stderr)
|
|
1258
1265
|
|
|
1259
1266
|
# Convert via remote container
|
|
1260
1267
|
if not args.quiet:
|
|
1261
|
-
print(f" Converting via remote container...", file=sys.stderr)
|
|
1268
|
+
print(f" {color.cyan('Converting via remote container')}...", file=sys.stderr)
|
|
1262
1269
|
|
|
1263
1270
|
# Determine output path
|
|
1264
1271
|
output_dir = Path(args.out_dir)
|
|
@@ -1279,7 +1286,10 @@ def main_async_remote(args) -> int:
|
|
|
1279
1286
|
# Check if output exists and skip if not overwrite
|
|
1280
1287
|
if output_file.exists() and not args.overwrite:
|
|
1281
1288
|
if not args.quiet:
|
|
1282
|
-
print(
|
|
1289
|
+
print(
|
|
1290
|
+
f" {color.yellow('⊘ Skipped:')} {output_file} already exists (use --overwrite to replace)",
|
|
1291
|
+
file=sys.stderr,
|
|
1292
|
+
)
|
|
1283
1293
|
continue
|
|
1284
1294
|
|
|
1285
1295
|
# Convert using remote container's HTTP API
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""Formatting helpers for CLI output."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
from typing import TextIO
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Colorizer:
|
|
10
|
+
"""ANSI color helper for terminal output."""
|
|
11
|
+
|
|
12
|
+
def __init__(self, stream: TextIO) -> None:
|
|
13
|
+
force_color = os.environ.get("FORCE_COLOR")
|
|
14
|
+
no_color = os.environ.get("NO_COLOR")
|
|
15
|
+
self.enabled = bool(force_color) or (stream.isatty() and not no_color)
|
|
16
|
+
|
|
17
|
+
def color(self, text: str, code: str) -> str:
|
|
18
|
+
if not self.enabled:
|
|
19
|
+
return text
|
|
20
|
+
return f"\033[{code}m{text}\033[0m"
|
|
21
|
+
|
|
22
|
+
def green(self, text: str) -> str:
|
|
23
|
+
return self.color(text, "32")
|
|
24
|
+
|
|
25
|
+
def yellow(self, text: str) -> str:
|
|
26
|
+
return self.color(text, "33")
|
|
27
|
+
|
|
28
|
+
def cyan(self, text: str) -> str:
|
|
29
|
+
return self.color(text, "36")
|
|
@@ -231,13 +231,18 @@ class FileTransferManager:
|
|
|
231
231
|
local_sha256.update(chunk)
|
|
232
232
|
local_checksum = local_sha256.hexdigest()
|
|
233
233
|
|
|
234
|
-
# Calculate remote checksum
|
|
235
|
-
|
|
236
|
-
f"sha256sum {remote_path} | awk '{{print $1}}'"
|
|
234
|
+
# Calculate remote checksum (sha256sum or shasum fallback)
|
|
235
|
+
checksum_cmd = (
|
|
236
|
+
f"(command -v sha256sum >/dev/null 2>&1 && sha256sum {remote_path} | awk '{{print $1}}') "
|
|
237
|
+
f"|| (command -v shasum >/dev/null 2>&1 && shasum -a 256 {remote_path} | awk '{{print $1}}')"
|
|
237
238
|
)
|
|
239
|
+
stdout, stderr, code = await self.ssh_client.run_command(checksum_cmd)
|
|
238
240
|
|
|
239
241
|
if code == 0:
|
|
240
242
|
remote_checksum = stdout.strip()
|
|
243
|
+
if not remote_checksum:
|
|
244
|
+
logger.warning("Could not verify checksum: remote checksum unavailable")
|
|
245
|
+
return
|
|
241
246
|
|
|
242
247
|
if local_checksum != remote_checksum:
|
|
243
248
|
raise ValueError(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|