📦 deps(thirdparty): update snapshots
This commit is contained in:
@@ -16,6 +16,19 @@ import sys
|
||||
import json
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def safe_user_path(path_value, base_dir="."):
|
||||
"""Resolve a CLI path under the current workspace."""
|
||||
if base_dir != ".":
|
||||
raise ValueError("Custom base directories are not supported for CLI paths")
|
||||
base_path = Path.cwd().resolve()
|
||||
resolved_path = Path(path_value).expanduser().resolve()
|
||||
try:
|
||||
resolved_path.relative_to(base_path)
|
||||
except ValueError as exc:
|
||||
raise ValueError(f"Path escapes allowed directory: {path_value}") from exc
|
||||
return resolved_path
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Dict, List, Set, Optional, Tuple
|
||||
|
||||
@@ -518,14 +531,14 @@ def main():
|
||||
output = analyzer.to_dot()
|
||||
print(output)
|
||||
if args.output:
|
||||
Path(args.output).write_text(output)
|
||||
safe_user_path(args.output).write_text(output)
|
||||
print(f"\n✅ Arquivo DOT salvo: {args.output}")
|
||||
print(" Para visualizar: dot -Tpng deps.dot -o deps.png")
|
||||
else:
|
||||
analyzer.print_report(report)
|
||||
|
||||
if args.output and args.format != 'dot':
|
||||
Path(args.output).write_text(
|
||||
safe_user_path(args.output).write_text(
|
||||
json.dumps(report, indent=2, ensure_ascii=False),
|
||||
encoding='utf-8'
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user