Metadata-Version: 2.4
Name: gofile-tool
Version: 0.2.2
Summary: CLI, Python SDK và MCP server cho Gofile với truyền file có kiểm chứng
License-Expression: Apache-2.0
Project-URL: Package index, https://pypi.org/project/gofile-tool/
Project-URL: Release history, https://pypi.org/project/gofile-tool/#history
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: NOTICE
License-File: LICENSES/MIT-original.txt
Requires-Dist: requests<3,>=2.31
Requires-Dist: PySocks<2,>=1.7.1
Requires-Dist: requests-toolbelt<2,>=1.0
Requires-Dist: rich<16,>=13.7
Provides-Extra: mcp
Requires-Dist: mcp<2.4,>=2.3; python_version >= "3.10" and extra == "mcp"
Provides-Extra: browser
Requires-Dist: playwright<2,>=1.45; extra == "browser"
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Requires-Dist: pytest-cov>=7; extra == "dev"
Requires-Dist: coverage>=7.10; extra == "dev"
Requires-Dist: hypothesis>=6; extra == "dev"
Requires-Dist: build>=1; extra == "dev"
Requires-Dist: ruff>=0.9; extra == "dev"
Requires-Dist: jsonschema>=4; extra == "dev"
Requires-Dist: mypy>=1.15; extra == "dev"
Requires-Dist: bandit>=1.8; extra == "dev"
Provides-Extra: release
Requires-Dist: build>=1; extra == "release"
Requires-Dist: twine>=6; extra == "release"
Dynamic: license-file

# gofile-tool

**Phiên bản tài liệu: `0.2.2` · Beta · Python ≥3.9 · Apache-2.0**

CLI, Python SDK và MCP stdio server không chính thức cho Gofile, dành cho nội dung
bạn sở hữu hoặc được phép truy cập. Không vượt quyền private, password, Premium
hoặc hạn mức dịch vụ.

## Cài đặt

```bash
python -m pip install --upgrade 'gofile-tool[browser]'
python -m playwright install chromium
gft --version
```

Pip cài bản có trên registry. Browser mode mặc định cần Chromium và OS libraries;
local/API-only có thể cài gofile-tool không extra browser. API mode vẫn phụ thuộc
quyền tài khoản. MCP cần Python ≥3.10 và extra mcp.

## Sử dụng nhanh

```bash
gft doctor --local --json
gft info CONTENT_ID --json
gft download CONTENT_ID -o ./downloads --workers 4 --json
gft upload ./photos --recursive --dry-run --json
gft help download
```

Thay CONTENT_ID bằng nội dung được phép. Output phải là thư mục riêng và an toàn;
POSIX yêu cầu thuộc UID hiện tại, không group/world-writable. doctor --local và
upload dry-run là offline; info/download gọi dịch vụ. gft, gofile-tool và gf là
các tên của cùng CLI.

## Chức năng

- Download streaming, kiểm size/MD5, 1–32 file song song, partial có identity manifest
  và atomic no-clobber publication; link refresh opt-in.
- Upload file và upload cây tuần tự với offline plan, journal, verified resume.
- Batch download và queue bền vững riêng, chạy/resume thủ công, không daemon.
- Account/content management theo quyền provider; mutation không tự replay.
- JSON schema v1, exit codes, EN/VI messages, shell completion và Python SDK.
- MCP local stdio với local plan/job status; info/download chỉ khi operator cấp quyền.

Không có global dedup, incremental sync, upload song song hoặc MCP mutation tools.
MD5 không chứng minh tính xác thực hay an toàn malware. Native platforms, Docker và
MCP hosts cần kiểm chứng trong môi trường triển khai thực tế.

## Xác thực và an toàn

Dùng private --token-file, GOFILE_TOKEN qua secret manager hoặc --token-stdin trên
installed CLI; không có raw --token argv. Guest upload yêu cầu --export-token;
giữ token ownership an toàn. Delete và expiry changes yêu cầu --yes.

Timeout không rollback mutation: kiểm tra remote bằng đúng tài khoản trước khi thử lại.
Không xóa inflight journal để ép replay, không chia sẻ raw journals/private URLs và
không tự tắt Chromium sandbox để xử lý lỗi quyền.

## CLI tùy biến và profiles

```bash
gft commands --group transfer
gft examples dl
gft profile init
gft profile path
gft profile resolve weekly
# Tạo links.txt, mỗi dòng một code/URL được phép tải, rồi xem trước:
gft ck links.txt
gft commands --format rich --theme violet --width 100 --rows 12 --compact
```

Profile JSON dùng chung cho CLI, CLI flags ghi đè options đã lưu. Cấu hình mặc định
ở ~/.config/gofile-tool/profiles.json; không truyền -p thì không tự nạp. Không lưu
execute/yes/force hoặc credential thô; dùng token-file reference hay password-env.
`gft ck -p weekly -x` thực thi khi có token/budget; thiếu -x luôn preview offline.
`profile path` không đọc config; `resolve` chỉ hiển thị cờ đã lưu, không nạp token.
Discovery không tạo client hoặc thực thi ví dụ. Không tự cấu hình SDK/MCP/queue.

Rich có theme cyan/violet/ocean/mono, width 40..240, rows 1..500 và compact header.
Mặc định 50 dòng bảng; JSON/plain vẫn giữ toàn bộ kết quả. --json ưu tiên hơn format,
NO_COLOR/--no-color vô hiệu màu. Check mặc định JSON, catalog/profile mặc định auto.
Hỗ trợ byte units 10GiB, rate 5MiB/s, deadline 2h. Check tải xong từng target rồi
xóa temp; có budget/unlimited, bounded jobs/workers, selection, fail-fast, reports
create-only và lock chống chạy chồng. Forced kill có thể để lại temp data. Budget
không phải on-wire cap chính xác. Download success không chứng minh reset retention;
custom expiry, cold storage và giới hạn provider vẫn có hiệu lực.

## Python và MCP

Python import: `from gofile_tool import Gofile, GofileError`. Exception dùng str(error)
và error.code; bản serialize as_dict có message được dịch. SDK cancellation/deadline
là cooperative, không phải process watchdog của installed CLI.

MCP cài bằng `python -m pip install 'gofile-tool[mcp]'`, chạy gft-mcp với --read-root
trỏ tới thư mục riêng đã tồn tại. Local-only không cần token/browser; network cần
--allow-network, token có sẵn và môi trường browser/API phù hợp.

## Tài liệu và phiên bản

Dùng `gft --help` và `gft help COMMAND` để tra cứu ngay sau khi cài. Gói source
distribution trên PyPI chứa README Việt/Anh, CLI reference, hướng dẫn SDK/MCP/queue,
xử lý lỗi, migration, chính sách bảo mật và changelog.

- [Trang package và file phát hành](https://pypi.org/project/gofile-tool/).
- [Lịch sử phiên bản](https://pypi.org/project/gofile-tool/#history).

Bản 0.2.2 chuyển MCP dependency từ SDK 1.30 sang 2.3; tích hợp Python dùng trực tiếp
SDK cần migration model/API. License Apache-2.0 kèm NOTICE và MIT notice gốc trong
distribution. Client không được Gofile bảo trợ.
