ark-utils-cli 0.3.0__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.
@@ -0,0 +1,32 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+ environment: pypi
11
+ permissions:
12
+ id-token: write
13
+
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - name: Install uv
18
+ uses: astral-sh/setup-uv@v4
19
+ with:
20
+ version: "latest"
21
+
22
+ - name: Set up Python
23
+ run: uv python install 3.11
24
+
25
+ - name: Install dependencies
26
+ run: uv sync
27
+
28
+ - name: Build package
29
+ run: uv build
30
+
31
+ - name: Publish to PyPI
32
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,46 @@
1
+ name: Build and Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ permissions:
9
+ contents: write
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Install uv
19
+ uses: astral-sh/setup-uv@v4
20
+ with:
21
+ version: "latest"
22
+
23
+ - name: Set up Python
24
+ run: uv python install 3.11
25
+
26
+ - name: Install dependencies
27
+ run: uv sync
28
+
29
+ - name: Build package
30
+ run: uv build
31
+
32
+ - name: Upload to TOS
33
+ env:
34
+ TOS_ACCESS_KEY: ${{ secrets.TOS_ACCESS_KEY }}
35
+ TOS_SECRET_KEY: ${{ secrets.TOS_SECRET_KEY }}
36
+ run: |
37
+ VERSION=$(uv run python -c "from ark_cli import __version__; print(__version__)")
38
+ uv run ark-cli -p tos -a upload -bucket xmp -i dist/ark_utils_cli-${VERSION}-py3-none-any.whl -o ark-cli/ark_utils_cli-${VERSION}-py3-none-any.whl
39
+
40
+ - name: Create GitHub Release
41
+ uses: softprops/action-gh-release@v2
42
+ with:
43
+ files: |
44
+ dist/*.whl
45
+ dist/*.tar.gz
46
+ generate_release_notes: true
@@ -0,0 +1,207 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+ #poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ #pdm.lock
116
+ #pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ #pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .envrc
140
+ .venv
141
+ env/
142
+ venv/
143
+ ENV/
144
+ env.bak/
145
+ venv.bak/
146
+
147
+ # Spyder project settings
148
+ .spyderproject
149
+ .spyproject
150
+
151
+ # Rope project settings
152
+ .ropeproject
153
+
154
+ # mkdocs documentation
155
+ /site
156
+
157
+ # mypy
158
+ .mypy_cache/
159
+ .dmypy.json
160
+ dmypy.json
161
+
162
+ # Pyre type checker
163
+ .pyre/
164
+
165
+ # pytype static type analyzer
166
+ .pytype/
167
+
168
+ # Cython debug symbols
169
+ cython_debug/
170
+
171
+ # PyCharm
172
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
175
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
176
+ #.idea/
177
+
178
+ # Abstra
179
+ # Abstra is an AI-powered process automation framework.
180
+ # Ignore directories containing user credentials, local state, and settings.
181
+ # Learn more at https://abstra.io/docs
182
+ .abstra/
183
+
184
+ # Visual Studio Code
185
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
188
+ # you could uncomment the following to ignore the entire vscode folder
189
+ # .vscode/
190
+
191
+ # Ruff stuff:
192
+ .ruff_cache/
193
+
194
+ # PyPI configuration file
195
+ .pypirc
196
+
197
+ # Cursor
198
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
199
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
200
+ # refer to https://docs.cursor.com/context/ignore-files
201
+ .cursorignore
202
+ .cursorindexingignore
203
+
204
+ # Marimo
205
+ marimo/_static/
206
+ marimo/_lsp/
207
+ __marimo__/
@@ -0,0 +1 @@
1
+ 3.11
@@ -0,0 +1,45 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## 项目概述
6
+
7
+ ark-cli 是火山引擎命令行工具,让人类和 AI Agent 都能在终端中操作火山引擎。
8
+
9
+ ## 技术栈
10
+
11
+ - 语言: Python
12
+ - 包管理: uv
13
+ - 许可证: MIT
14
+
15
+ ## 开发命令
16
+
17
+ ```bash
18
+ # 初始化项目
19
+ uv init
20
+
21
+ # 安装依赖
22
+ uv sync
23
+
24
+ # 添加依赖
25
+ uv add <package>
26
+
27
+ # 添加开发依赖
28
+ uv add --dev <package>
29
+
30
+ # 运行脚本
31
+ uv run python <script.py>
32
+
33
+ # 运行测试
34
+ uv run pytest
35
+
36
+ # 代码检查
37
+ uv run ruff check .
38
+
39
+ # 代码格式化
40
+ uv run ruff format .
41
+ ```
42
+
43
+ ## 项目结构
44
+
45
+ 待项目初始化后补充
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 cnwarden
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,18 @@
1
+ .PHONY: build publish clean
2
+
3
+ VERSION := $(shell uv run python -c "from ark_cli import __version__; print(__version__)")
4
+ WHEEL := dist/ark_cli-$(VERSION)-py3-none-any.whl
5
+ BUCKET := xmp
6
+
7
+ build:
8
+ uv build
9
+
10
+ publish: build
11
+ @if [ ! -f "$(WHEEL)" ]; then \
12
+ echo "Error: $(WHEEL) not found"; \
13
+ exit 1; \
14
+ fi
15
+ uv run ark-cli -p tos -a upload -bucket $(BUCKET) -i $(WHEEL) -o ark-cli/ark_cli-$(VERSION)-py3-none-any.whl
16
+
17
+ clean:
18
+ rm -rf dist/
@@ -0,0 +1,277 @@
1
+ Metadata-Version: 2.4
2
+ Name: ark-utils-cli
3
+ Version: 0.3.0
4
+ Summary: 火山引擎命令行工具 - 让人类和 AI Agent 都能在终端中操作火山引擎
5
+ License-File: LICENSE
6
+ Requires-Python: >=3.9
7
+ Requires-Dist: tos>=2.9.0
8
+ Description-Content-Type: text/markdown
9
+
10
+ <p align="center">
11
+ <h1 align="center">ark-cli</h1>
12
+ </p>
13
+
14
+ <p align="center">
15
+ 火山引擎命令行工具 — 让人类和 AI Agent 都能在终端中操作火山引擎
16
+ </p>
17
+
18
+ <p align="center">
19
+ <a href="https://github.com/cnwarden/ark-cli/releases"><img src="https://img.shields.io/github/v/release/cnwarden/ark-cli?style=for-the-badge&color=FF6A00" alt="Release" /></a>
20
+ <a href="https://www.python.org/"><img src="https://img.shields.io/badge/Python-3.9+-3776AB?style=for-the-badge&logo=python&logoColor=white" alt="Python" /></a>
21
+ <a href="https://github.com/cnwarden/ark-cli/stargazers"><img src="https://img.shields.io/github/stars/cnwarden/ark-cli?style=for-the-badge&color=f5a623" alt="Stars" /></a>
22
+ <a href="https://github.com/cnwarden/ark-cli/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-teal.svg?style=for-the-badge" alt="License" /></a>
23
+ </p>
24
+
25
+ <p align="center">
26
+ <a href="#ark-cli-是什么">介绍</a> · <a href="#核心能力">核心能力</a> · <a href="#快速开始">快速开始</a> · <a href="#命令参考">命令参考</a> · <a href="#贡献">贡献</a>
27
+ </p>
28
+
29
+ ---
30
+
31
+ ## ark-cli 是什么
32
+
33
+ ark-cli 是火山引擎的命令行工具,将 TOS 对象存储、大模型服务、联网搜索等操作封装为简洁的命令行接口。
34
+
35
+ ### 为什么选择 ark-cli
36
+
37
+ - **开箱即用** — 默认配置北京区域,最少只需 2 个环境变量即可开始使用
38
+ - **AI Agent 友好** — 命令设计简洁,输出格式规范,便于 AI Agent 解析调用
39
+ - **临时链接** — 上传文件自动返回 24 小时有效的签名 URL
40
+ - **轻量依赖** — 基于 Python,使用 uv 包管理,安装简单
41
+
42
+ ## 核心能力
43
+
44
+ | 模块 | 能力 |
45
+ |------|------|
46
+ | **TOS 对象存储** | 文件上传、列表、删除、临时链接生成、Bucket 统计 |
47
+ | **大模型服务** | 单轮对话、Token 用量统计、耗时统计 |
48
+ | **联网搜索** | 网页搜索、结果摘要、时间范围过滤 |
49
+
50
+ ## 快速开始
51
+
52
+ ### 安装
53
+
54
+ **从源码安装**
55
+
56
+ ```bash
57
+ git clone https://github.com/cnwarden/ark-cli.git
58
+ cd ark-cli
59
+ uv sync
60
+ ```
61
+
62
+ **从 Release 下载**
63
+
64
+ 从 [Releases](https://github.com/cnwarden/ark-cli/releases/latest) 页面下载最新的 wheel 包:
65
+
66
+ ```bash
67
+ pip install ark_cli-*.whl
68
+ ```
69
+
70
+ ### 配置凭证
71
+
72
+ ```bash
73
+ # TOS 对象存储(必需)
74
+ export TOS_ACCESS_KEY="your-access-key"
75
+ export TOS_SECRET_KEY="your-secret-key"
76
+
77
+ # TOS 可选配置(默认北京区域)
78
+ export TOS_ENDPOINT="tos-cn-beijing.volces.com"
79
+ export TOS_REGION="cn-beijing"
80
+
81
+ # 大模型服务(使用 model 功能时必需)
82
+ export ARK_API_KEY="your-api-key"
83
+
84
+ # 联网搜索(使用 search 功能时必需)
85
+ export SEARCH_API_KEY="your-search-api-key"
86
+ ```
87
+
88
+ ### 验证安装
89
+
90
+ ```bash
91
+ ark-cli -v
92
+ ```
93
+
94
+ ## 命令参考
95
+
96
+ ```
97
+ ark-cli [-p PRODUCT] [-a ACTION] [OPTIONS]
98
+
99
+ Products:
100
+ tos TOS 对象存储操作
101
+ model 大模型对话
102
+ search 联网搜索
103
+
104
+ TOS Actions:
105
+ upload 上传文件
106
+ ls 列出文件
107
+ lsb 列出 Bucket
108
+ geturl 获取临时链接
109
+ rm 删除文件
110
+ stats Bucket 统计信息
111
+
112
+ Model Options:
113
+ -m 模型名称(例如: doubao-seed-2-0-mini-260215)
114
+ -c 对话内容
115
+
116
+ Search Options:
117
+ -q 搜索关键词
118
+ --count 返回条数(默认: 10, 最多: 50)
119
+ ```
120
+
121
+ <details>
122
+ <summary>TOS 对象存储</summary>
123
+
124
+ ```bash
125
+ # 上传文件(返回 24 小时有效的签名链接)
126
+ ark-cli -p tos -a upload -bucket my-bucket -i ./test.txt -o data/test.txt
127
+
128
+ # 列出 Bucket
129
+ ark-cli -p tos -a lsb
130
+
131
+ # 列出文件
132
+ ark-cli -p tos -a ls -bucket my-bucket
133
+ ark-cli -p tos -a ls -bucket my-bucket -i data/
134
+
135
+ # 获取临时链接
136
+ ark-cli -p tos -a geturl -bucket my-bucket -i data/test.txt
137
+
138
+ # 删除文件
139
+ ark-cli -p tos -a rm -bucket my-bucket -i data/test.txt
140
+
141
+ # Bucket 统计信息
142
+ ark-cli -p tos -a stats -bucket my-bucket
143
+ ```
144
+
145
+ **输出示例**
146
+
147
+ 列出文件:
148
+ ```
149
+ DIR - data/subdir/
150
+ 1.2KB 2024-03-30 10:00:00 data/test.txt
151
+ 256B 2024-03-30 09:30:00 data/config.json
152
+ ```
153
+
154
+ Bucket 统计:
155
+ ```
156
+ Bucket: my-bucket
157
+ Location: cn-beijing
158
+ Created: 2025-05-12 12:29:06
159
+ Storage: Storage_Class_Standard
160
+ Redundancy: Az_Redundancy_Single_Az
161
+ Versioning: Versioning_Unknown
162
+ Endpoint: tos-cn-beijing.volces.com
163
+ ```
164
+
165
+ </details>
166
+
167
+ <details>
168
+ <summary>大模型对话</summary>
169
+
170
+ ```bash
171
+ # 单轮对话
172
+ ark-cli -p model -m doubao-seed-2-0-mini-260215 -c "你好,请介绍一下你自己"
173
+ ```
174
+
175
+ **输出示例**
176
+ ```
177
+ 嗨!👋 你好呀~ 请问有什么我可以帮你的吗?
178
+
179
+ [耗时: 5991ms | tokens: 50 in / 371 out]
180
+ ```
181
+
182
+ </details>
183
+
184
+ <details>
185
+ <summary>联网搜索</summary>
186
+
187
+ ```bash
188
+ # 基础搜索
189
+ ark-cli -p search -q "火山引擎"
190
+
191
+ # 指定返回条数
192
+ ark-cli -p search -q "Python 教程" --count 5
193
+ ```
194
+
195
+ **输出示例**
196
+ ```
197
+ [1] 火山引擎官网 - 字节跳动旗下云服务平台
198
+ 火山引擎 | 2025-03-30
199
+ https://www.volcengine.com/
200
+ 火山引擎是字节跳动旗下的云服务平台,提供云计算、大数据、人工智能等服务...
201
+
202
+ [2] 火山引擎开放平台 - 开发者文档
203
+ 火山引擎 | 2025-03-28
204
+ https://www.volcengine.com/docs
205
+ 火山引擎开放平台提供丰富的 API 和 SDK,帮助开发者快速接入...
206
+
207
+ [共 10 条结果 | 耗时: 372ms]
208
+ ```
209
+
210
+ </details>
211
+
212
+ ## 技术栈
213
+
214
+ | 组件 | 选型 | 说明 |
215
+ |------|------|------|
216
+ | 语言 | [Python](https://www.python.org/) 3.9+ | |
217
+ | 包管理 | [uv](https://github.com/astral-sh/uv) | 快速的 Python 包管理器 |
218
+ | TOS SDK | [tos](https://github.com/volcengine/ve-tos-python-sdk) | 火山引擎 TOS 官方 SDK |
219
+ | 构建工具 | [hatchling](https://hatch.pypa.io/) | Python 构建后端 |
220
+
221
+ ## 项目结构
222
+
223
+ ```
224
+ ark-cli/
225
+ ├── ark_cli/
226
+ │ ├── __init__.py # 版本定义
227
+ │ ├── cli.py # CLI 入口
228
+ │ ├── tos_client.py # TOS 客户端封装
229
+ │ ├── model_client.py # 大模型客户端
230
+ │ └── search_client.py # 联网搜索客户端
231
+ ├── pyproject.toml # 项目配置
232
+ ├── Makefile # 构建脚本
233
+ └── README.md
234
+ ```
235
+
236
+ ## 开发
237
+
238
+ ```bash
239
+ # 克隆项目
240
+ git clone https://github.com/cnwarden/ark-cli.git
241
+ cd ark-cli
242
+
243
+ # 安装依赖
244
+ uv sync
245
+
246
+ # 运行
247
+ uv run ark-cli -v
248
+
249
+ # 构建
250
+ uv build
251
+
252
+ # 发布到 TOS
253
+ make publish
254
+ ```
255
+
256
+ ## 贡献
257
+
258
+ 欢迎提交 Issue 和 Pull Request!
259
+
260
+ 1. Fork 本仓库
261
+ 2. 创建特性分支:`git checkout -b feature/amazing-feature`
262
+ 3. 提交更改:`git commit -m 'feat: add amazing feature'`
263
+ 4. 推送分支:`git push origin feature/amazing-feature`
264
+ 5. 提交 Pull Request
265
+
266
+ 提交信息请遵循 [Conventional Commits](https://www.conventionalcommits.org/) 规范。
267
+
268
+ ## License
269
+
270
+ [MIT](LICENSE)
271
+
272
+ ## 相关链接
273
+
274
+ - [火山引擎控制台](https://console.volcengine.com/) — 获取 Access Key
275
+ - [TOS 文档](https://www.volcengine.com/docs/6349) — 对象存储文档
276
+ - [方舟大模型](https://www.volcengine.com/docs/82379) — 大模型服务文档
277
+ - [联网搜索 API](https://www.volcengine.com/docs/87772/2272953) — 联网搜索文档