关于 publish
引导用户将 Harbor 任务和数据集发布到注册表,先检查身份验证和任务标识符,再介绍清单设置、同步、可见性及发布命令。
主要功能
- 01检查注册表身份验证
- 02准备任务标识符
- 03初始化并扩展数据集清单
- 04同步任务和指标摘要
- 05设置标签、可见性和上传选项
- 06运行已发布的数据集
适用场景
- 01发布一个或多个 Harbor 任务
- 02将本地任务与注册表任务组成数据集
- 03以指定标签或可见性发布数据集
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ harbor-framework/ harbor --skill publish安装后在 Claude Code 中输入/publish确认已加载。
详细介绍
帮助用户将 Harbor 任务或数据集发布到注册表。逐步引导用户完成操作,检查前置条件,并在运行发布命令前确认。
所有命令都使用 uvx harbor,因此用户无需全局安装 CLI。
前置条件
-
身份验证:运行
uvx harbor auth status,确保用户已登录。如果尚未登录,请提示其运行uvx harbor auth login。 -
任务标识符:所有任务的
task.toml中都必须有[task]部分,且名称格式如<org>/<name>。如果缺少,请运行:uvx harbor task update "<path/to/task>" --org "<org>"要更新目录中的所有任务:
uvx harbor task update "<path/to/tasks>" --org "<org>" --scan
发布任务
uvx harbor publish "<path/to/task>"
发布多个任务或目录中的所有任务:
uvx harbor publish "<path/to/task-a>" "<path/to/task-b>"
uvx harbor publish "<path/to/tasks>"
发布数据集
1. 初始化数据集清单(如果不存在 dataset.toml)
uvx harbor dataset init "<org>/<dataset>" \
--description "<description>" \
--author "Jane Doe <[email protected]>"
如果用户需要自定义指标脚本,请添加 --with-metric。如果省略,数据集将使用默认指标(所有任务的平均奖励,缺失值按 0 处理)。
**自动添加行为:**如果在已包含任务的目录中运行 dataset init,这些任务会自动添加到清单中。初始化后,询问用户是否要添加其他任务——可以从 Harbor 注册表添加,也可以从其他本地文件夹添加。
2. 添加其他任务和文件(可选)
cd "<path/to/dataset>"
uvx harbor dataset add "<path/to/task-a>" "<path/to/task-b>" # local tasks from elsewhere
uvx harbor dataset add "<path/to/folder>" --scan # all tasks in another folder
uvx harbor dataset add org/task-name # published tasks from registry
uvx harbor dataset add org/dataset-name # all tasks from a published dataset
uvx harbor dataset add metric.py # metric file (same dir as dataset.toml)
uvx harbor dataset remove "<org>/<task-name>" # remove a task
指定版本:org/task@tag、org/task@revision 或 org/task@sha256:<hash>。
3. 同步摘要(如果任务/指标自上次发布后发生更改)
uvx harbor sync
uvx harbor sync --upgrade # also upgrade remote tasks to latest
4. 发布数据集
uvx harbor publish "<path/to/dataset>"
uvx harbor publish 会自动刷新数据集目录中本地任务的摘要。
发布选项(任务和数据集)
-t / --tag:添加标签(可重复指定)。始终包含latest。-c / --concurrency:控制上传并发数。--public:设为公开(默认为私有)。--no-tasks(仅适用于数据集):跳过发布数据集目录中的任务。
示例:
uvx harbor publish "<path>" -t v1.0 --public
发布后
- 可以通过
uvx harbor task visibility/uvx harbor dataset visibility或访问 https://hub.harborframework.com/ 更改可见性。 - 使用以下命令运行已发布的数据集:
uvx harbor run -d "<org>/<dataset>@v1.0" -a "<agent>" -m "<model>"
评论
支持 Markdown