Windows / PowerShell: Examples use bash syntax. To run on Windows PowerShell:
- Flatten
\ line continuations to a single line, or end lines with a backtick.
- Set env vars with
$env:NAME="value" instead of export NAME="value".
- Single-quoted JSON
'{"a":"b"}' works as-is.
Overview 概述
The cloudrobo-asset skill manages the full lifecycle of CloudRobo platform assets. It
covers repository and catalog queries, asset CRUD (create/list/show/update/delete/batch-delete),
version CRUD, tag management, Action CRUD, permission checks, marketplace search,
official/community asset listing, asset lineage, and local-to-OBS import/export.
Applicable scenarios:
- Asset lifecycle — Create, list, show, update, delete, batch-delete assets and versions
- Import/Export — Import local folders to OBS as assets; export asset versions to local paths
- Marketplace discovery — Search marketplace assets; list official/community publication assets
- Tag management — Add/delete tags; query platform predefined tag lists
- Action management — Create/list/show/update/delete Actions on asset versions
- Permission check — Verify user permissions on asset versions
- Lineage — Query parent-child relationships between asset versions
Architecture:
Agent / LLM
│
├── CLI → cloudrobo asset <command>
├── SDK → AssetClient (Python)
│
▼
cloudrobo-asset-manager (REST API)
/v1/repositories
/v1/catalogs
/v1/assets/*
/v1/asset-service/search
/v1/asset-service/publication-assets
/v1/asset-tags
│
├── OBS (import/export file transfer)
└── cloudrobo-obs endpoint (configured separately)
All operations target the cloudrobo-asset-manager backend. Import/export additionally
requires a cloudrobo-obs endpoint for OBS file transfer.
Prerequisites 前置条件
See references/cli-installation-guide.md for CLI installation, AK/SK authentication, and
configuration. Import/export operations require the cloudrobo-obs endpoint to be configured in
~/.cloudrobo/config.yaml or via the CLOUDROBO_ENDPOINT_cloudrobo-obs environment variable.
Workflow 工作流
Prerequisite: Get catalog_id 前置步骤
Multiple scenarios require a catalog_id. Only execute when the user has not provided it:
- Get from current workspace (preferred):
cloudrobo workspace current → read
asset_catalog_id field (the catalog bound to the current workspace)
- Fallback — list repositories and catalogs: If no workspace is configured or
asset_catalog_id is empty:
cloudrobo asset list-repositories → get repository_id
cloudrobo asset list-catalogs --repository-id <repo-id> → get catalog_id
Scenario 1: Import Local Asset 导入资产
Import local files (models, datasets, etc.) into the CloudRobo asset repository.
Fast path: If local-path/README.md exists with valid frontmatter (e.g., from a previous
export-asset), only --catalog-id (for new asset) or --asset-id (for new version) is needed
— all other metadata is read from frontmatter. Without frontmatter, catalog_id, name, type
(and sub_type for simulation) must be provided via CLI.
- (Only when creating new asset and catalog_id is missing) Execute "Prerequisite: Get catalog_id"
- Import:
# With frontmatter (recommended — after export)
cloudrobo asset import-asset --catalog-id <id> --local-path <path>
# Without frontmatter
cloudrobo asset import-asset --catalog-id <id> --name <name> --type <type> --local-path <path> [--sub-type <sub-type>] [--ext-metadata '{"key":"value"}']
- Auto-reads
local-path/README.md frontmatter for metadata (name, type, sub_type, description,
status, tags, version, ext_metadata, parent_asset_version_id, generation_method)
- Frontmatter values override CLI parameters (except catalog_id, CLI only); fields missing from both trigger errors
--ext-metadata CLI param also supported (frontmatter overrides it)
- ext_metadata pre-validated by type before API call (model→model_type, dataset→annotation_status,
algorithm→engine+command, image→arch+device_type, simulation (sub_type=robot)→robot_type+robot_manufacturer)
- Auto-creates asset + version + uploads to OBS
- Existing asset new version: add
--asset-id <existing-asset-id>
- Reuse existing version for upload retry: add
--asset-id <id> --version-id <vid> (default: incremental upload — skips existing OBS objects; use --overwrite to force re-upload all files)
- Verify:
cloudrobo asset show-asset --asset-id <asset-id>
Error recovery: If import fails at OBS upload (asset and version created but files not
uploaded, version stays in CREATING status), do NOT create a new version. Two recovery strategies:
- Reuse version (recommended):
list-versions --asset-id <id> to find the failed version,
re-run import-asset --asset-id <id> --version-id <vid> to upload directly (incremental by
default — only uploads missing files; the version transitions to DRAFT once upload succeeds)
- Delete and retry:
delete-version --asset-id <id> --version-id <vid> then re-run
import-asset --asset-id <id>
Scenario 2: Search Marketplace 搜索广场资产
- Search:
cloudrobo asset search-assets --keyword <keyword>
- Show detail:
cloudrobo asset show-asset --asset-id <asset-id>
Browse official/community: cloudrobo asset list-publication-assets --type <type>
Export after search: Only when the user requests export. If the marketplace asset permission
does not include data_read, export is not allowed. cloudrobo asset export-asset --asset-id <id> --local-path <path> (default latest version; add --version-id for specific version). Export
automatically generates README.md with YAML frontmatter containing asset metadata, enabling
seamless re-import with minimal CLI parameters.
Scenario 3: List Workspace Assets 列举空间资产
- (Only when catalog_id is missing) Execute "Prerequisite: Get catalog_id"
- List:
cloudrobo asset list-assets --catalog-id <catalog-id>
- Filter by
--type, --sub-type, --status
- Or use
--repository-id instead of --catalog-id for repository-level queries
Scenario 4: List Asset Versions 列举资产版本
- If asset_id is known, skip to step 3
- (Only when asset_id is missing) Execute "Prerequisite: Get catalog_id", then
list-assets --catalog-id <id> to locate asset_id
- List versions:
cloudrobo asset list-versions --asset-id <asset-id>
Scenario 5: Create Asset with ext_metadata 创建含扩展元数据的资产
model, dataset, simulation, algorithm, image types require ext_metadata at creation. Consult
references/validation-rules.md for required fields by type.
- (Only when catalog_id is missing) Execute "Prerequisite: Get catalog_id"
- Create:
cloudrobo asset create-asset --catalog-id <id> --name <name> --type model --ext-metadata '{"model_type":"planning"}'
- Create version:
cloudrobo asset create-version --asset-id <id> --version 1.0.0 --ext-metadata '{"model_type":"planning"}'
Scenario 6: Tag Management 标签管理
- Add:
cloudrobo asset add-tags --asset-id <id> --tags "tag1,tag2"
- Delete:
cloudrobo asset delete-tag --asset-id <id> --tag <tag>
- Query predefined:
cloudrobo asset list-tags --language zh (optional --type/--sub-type filter)
CLI Command Format Standard CLI命令格式标准
cloudrobo asset <command> [OPTIONS]
| Feature |
Description |
Example |
| Command group |
cloudrobo asset |
cloudrobo asset list-assets |
| Subcommand |
kebab-case |
list-repositories, create-asset, import-asset |
| JSON parameter |
--ext-metadata '{"key":"value"}' |
--ext-metadata '{"model_type":"planning"}' |
| Comma list |
--tags tag1,tag2 |
--tags robot,arm |
| Dry-run |
--dry-run (where supported) |
Preview without executing |
| Output format |
JSON to stdout |
out(result) |
| UUID identifiers |
--asset-id, --version-id, --catalog-id |
UUID format required |
Core Commands 核心命令
Repository & Catalog 仓库与目录
| Command |
Key Params |
SDK Method |
API |
| list-repositories |
[--name] [--sort-dir] [--offset] [--limit] |
client.list_repositories(**params) |
GET /v1/repositories |
| list-catalogs |
--repository-id <id> [--name] [--sort-dir] [--offset] [--limit] |
client.list_catalogs(repository_id, **params) |
GET /v1/catalogs |
| show-catalog |
--catalog-id <id> |
client.show_catalog(catalog_id) |
GET /v1/catalogs/{catalog_id} |
Asset Management 资产管理
Create asset
cloudrobo asset create-asset --catalog-id <catalog-id> --type <type> [--name <name>] [--sub-type <sub-type>] [--description <desc>] [--status <status>] [--tags "tag1,tag2"] [--url <obs-or-swr-path>] [--ext-metadata '{"key":"value"}'] [--parent-asset-version-id <uuid>] [--generation-method <method>] [--dry-run]
- SDK:
client.create_asset(req: dict)
- API:
POST /v1/assets
List assets
cloudrobo asset list-assets [--repository-id <id>] [--catalog-id <id>] [--type <type>] [--sub-type <sub-type>] [--status <status>] [--name <name>] [--tags "tag1,tag2"] [--mine] [--offset <n>] [--limit <n>]
# Either --repository-id OR --catalog-id filters the list. Full parameter list: see references/api-paths.md → List Assets
- SDK:
client.list_assets(**params)
- API:
GET /v1/assets
Note: repository-id and catalog-id — at least one must be provided; both provided =
AND filter.
Update asset
cloudrobo asset update-asset --asset-id <asset-id> [--name <name>] [--description <desc>] [--status <status>] [--tags "tag1,tag2"] [--ext-metadata '{"key":"value"}'] [--dry-run]
- SDK:
client.update_asset(asset_id, req: dict)
- API:
PUT /v1/assets/{asset_id}
Note: update-asset only supports modifying name/description/status/tags/
ext-metadata — the CLI exposes no parameters for catalog_id, type, sub_type,
url, parent_asset_version_id, or generation_method, so these fields are immutable.
| Command |
Key Params |
SDK Method |
API |
| show-asset |
--asset-id <id> |
client.show_asset(asset_id) |
GET /v1/assets/{asset_id} |
| delete-asset |
--asset-id <id> [--dry-run] |
client.delete_asset(asset_id) |
DELETE /v1/assets/{asset_id} |
| batch-delete-assets |
--asset-ids "id1,id2" [--dry-run] |
client.batch_delete_assets({"asset_ids": [...]}) |
POST /v1/assets/batch-delete |
Version Management 版本管理
Create version
cloudrobo asset create-version --asset-id <asset-id> [--version <version>] [--description <desc>] [--status <status>] [--url <obs-or-swr-path>] [--ext-metadata '{"key":"value"}'] [--parent-asset-version-id <uuid>] [--generation-method <method>] [--dry-run]
- SDK:
client.create_asset_version(asset_id, req: dict)
- API:
POST /v1/assets/{asset_id}/versions
List versions
cloudrobo asset list-versions --asset-id <asset-id> [--version <version>] [--exact-version <version>] [--sort-key <field>] [--sort-dir <asc|desc>] [--offset <n>] [--limit <n>] [--actions "FFT,LORA"] [--actions-operator <and|or>] [--ext-metadata <key=value>] [--action-status "ENABLE,DISABLE"]
- SDK:
client.list_asset_versions(asset_id, **params)
- API:
GET /v1/assets/{asset_id}/versions
Update version
cloudrobo asset update-version --asset-id <asset-id> --version-id <version-id> [--version <version>] [--description <desc>] [--status <status>] [--ext-metadata '{"key":"value"}'] [--dry-run]
- SDK:
client.update_asset_version(asset_id, version_id, req: dict)
- API:
PUT /v1/assets/{asset_id}/versions/{version_id}
Note: update-version only supports modifying version/description/status/
ext-metadata — the CLI exposes no parameters for url, parent_asset_version_id, or
generation_method, so these fields are immutable.
| Command |
Key Params |
SDK Method |
API |
| show-version |
--asset-id <id> --version-id <vid> |
client.show_asset_version(asset_id, version_id) |
GET /v1/assets/{asset_id}/versions/{version_id} |
| delete-version |
--asset-id <id> --version-id <vid> [--dry-run] |
client.delete_asset_version(asset_id, version_id) |
DELETE /v1/assets/{asset_id}/versions/{version_id} |
| batch-delete-versions |
--asset-id <id> --version-ids "v1,v2" [--dry-run] |
client.batch_delete_asset_versions(asset_id, {"version_ids": [...]}) |
POST /v1/assets/{asset_id}/versions/batch-delete |
Tag Management 标签管理
| Command |
Key Params |
SDK Method |
API |
| add-tags |
--asset-id <id> --tags "t1,t2" [--dry-run] |
client.add_tags(asset_id, tags) |
POST /v1/assets/{asset_id}/tags |
| delete-tag |
--asset-id <id> --tag <tag> [--dry-run] |
client.delete_tag(asset_id, tag) |
DELETE /v1/assets/{asset_id}/tags/{tag} |
| list-tags |
--language <zh|en> [--type] [--sub-type] |
client.list_all_tags(language, type, sub_type) |
GET /v1/asset-tags |
Action Management Action管理
| Command |
Key Params |
SDK Method |
API |
| list-actions |
--asset-id <id> --version-id <vid> |
client.list_asset_actions(asset_id, version_id) |
GET /v1/assets/{asset_id}/versions/{version_id}/actions |
| show-action |
--asset-id <id> --version-id <vid> --action <name> |
client.show_asset_action(asset_id, version_id, action) |
GET .../actions/{action} |
| delete-action |
--asset-id <id> --version-id <vid> --action <name> [--dry-run] |
client.delete_asset_action(asset_id, version_id, action) |
DELETE .../actions/{action} |
Create/Update action (detailed):
cloudrobo asset create-action --asset-id <id> --version-id <vid> --action-info '{"action":"FFT","algorithm":{"asset_id":"...","version_id":"..."},"status":"ENABLE"}' [--dry-run]
# SDK: client.create_asset_action(asset_id, version_id, req)
# API: POST /v1/assets/{asset_id}/versions/{version_id}/actions
cloudrobo asset update-action --asset-id <id> --version-id <vid> --action <name> --action-info '{"status":"DISABLE"}' [--dry-run]
# SDK: client.update_asset_action(asset_id, version_id, action, req)
# API: PUT /v1/assets/{asset_id}/versions/{version_id}/actions/{action}
Permission & Lineage 权限与血缘
| Command |
Key Params |
SDK Method |
API |
| check-permission |
--asset-id <id> --version-id <vid> --permissions "meta_read,data_read" |
client.check_asset_permission(asset_id, version_id, req) |
POST .../check-permission |
| show-lineage |
--asset-id <id> --version-id <vid> --type <children|parent> |
client.show_asset_tree(asset_id, version_id, type) |
GET .../tree?type=<children|parent> |
Valid permissions: meta_read, meta_write, data_read, data_write, data_usable
Lineage: children = parent-to-child; parent = child-to-parent.
Marketplace 广场
| Command |
Key Params |
SDK Method |
API |
| search-assets |
--keyword <kw> [--type] [--limit] [--offset] |
client.search_assets(req) |
POST /v1/asset-service/search |
| list-publication-assets |
[--type] [--sub-type] [--name] [--tags] [--status] [--capabilities] [--offset] [--limit] |
client.list_publication_assets(**params) |
GET /v1/asset-service/publication-assets |
Full parameter list: see references/api-paths.md → List Publication Assets
Import & Export 导入导出
Import asset
cloudrobo asset import-asset --local-path <local-folder> [--catalog-id <id>] [--name <name>] [--type <type>] [--sub-type <sub-type>] [--ext-metadata '{"key":"value"}'] [--asset-id <id>] [--version-id <vid>] [--overwrite] [--dry-run]
Frontmatter support:
- Auto-reads
local-path/README.md YAML frontmatter
- Fields:
name, type, sub_type, description, status, tags, version, ext_metadata,
parent_asset_version_id, generation_method
- Priority: frontmatter overrides CLI parameters (except catalog_id, CLI only); fields missing from both trigger errors
- Required fields for new asset:
catalog_id (CLI only), name (frontmatter or CLI), type (frontmatter or CLI)
- ext_metadata pre-validation: model/dataset/algorithm/image/simulation types validated before API call (robot is a sub_type of simulation)
Modes:
- No
--asset-id: Create new asset + version + upload to OBS; after upload, if version status is CREATING, auto-update to DRAFT
--asset-id only: Create new version for existing asset + upload to OBS; after upload, if version status is CREATING, auto-update to DRAFT
--asset-id + --version-id: Reuse existing version, incremental upload to OBS only (skips existing OBS objects by default; use --overwrite to force re-upload all files); after upload, if version status is CREATING, auto-update to DRAFT
Status flow: When no --status is specified, the backend creates the version with status CREATING. After a successful OBS upload, if the version status is still CREATING, the SDK automatically calls update-version to set it to DRAFT. If the user explicitly specifies a status (e.g., RELEASE via frontmatter), the upload succeeds but the status is not auto-modified.
Export asset
cloudrobo asset export-asset --asset-id <id> --local-path <local-folder> [--version-id <version-id>] [--dry-run]
README.md generation:
- Creates
<local-path>/<asset-id>/README.md with YAML frontmatter
- Frontmatter fields:
name, type, sub_type, description, status, tags, version,
ext_metadata, parent_asset_version_id, generation_method
- If README.md already exists, preserves body content and replaces frontmatter only
- Enables seamless re-import with minimal CLI parameters
Parameter Confirmation 参数确认
| Parameter |
Required |
Description |
Example |
--catalog-id |
Conditional (new asset import, most commands) |
Catalog UUID |
b2c3d4e5-f6a7-... |
--asset-id |
Yes (asset/version ops) |
Asset UUID |
a1b2c3d4-... |
--version-id |
Yes (version ops) |
Version UUID |
d4e5f6a7-b8c9-... |
--type |
Conditional (import without frontmatter) |
Asset type |
model, dataset, algorithm, image, simulation |
--name |
Conditional (import without frontmatter) |
Asset name |
my-model |
--sub-type |
Conditional (algorithm/image/simulation) |
Asset sub_type |
algorithm: inference,data_processing,training,data_evaluating,rl; image: inference,data_processing,training,notebook,rl; simulation: robot,environment,object,scene |
--local-path |
Yes (import/export) |
Local folder path |
./my-model |
--ext-metadata |
Conditional (model/dataset/algorithm/image/simulation) |
Extended metadata JSON |
{"model_type":"planning"} |
--language |
Yes (list-tags) |
Tag language |
zh, en |
--permissions |
Yes (check-permission) |
Permission list |
meta_read,data_read |
--dry-run |
No |
Preview without executing |
flag |
--description |
No |
Asset/version description |
My model description |
--status |
No |
Asset/version status |
CREATING, DRAFT, RELEASE, etc. |
--tags |
No |
Tag list (comma-separated, full replacement on update) |
production,stable |
--url |
No |
OBS or SWR path (create-asset/create-version only) |
obs://bucket/path |
--generation-method |
No |
Asset generation method (create-asset/create-version only) |
manual |
--parent-asset-version-id |
No |
Parent version UUID (create-asset/create-version only) |
d4e5f6a7-... |
Mutating operations (create/update/delete/import/export/batch-delete) should be confirmed
by the user before execution. --dry-run can be used to preview the operation safely.
Reference Documents 参考文档
- CLI Installation Guide — cloudrobo CLI installation and configuration
- IAM Policies — Least-privilege credential model
- Verification Method — Verification method details
- Dataflow Diagram — Mermaid data flow diagram
- Acceptance Criteria — Acceptance criteria
- API Paths — REST API paths discovered via SDK source
- Validation Rules — Field validation, ext_metadata rules, parameter interactions
- Edge Cases — Edge cases and error handling
Edge Cases 边界情况
Key edge cases include: missing catalog_id, import OBS upload failure recovery, export
permission checks, immutable field validation, built-in vs workspace asset distinction,
and capabilities filter mapping. See Edge Cases for the
full table.
Verification Method 验证方法
# Specification compliance + functional testing
bash scripts/test-cli-commands.sh . --executor {cli|sdk|api}
Test cases: see templates/test-vars.json for the full list covering all asset operations.
Verification Checklist 验证清单
- After create/update/import: verify via
show-asset/show-version/list-actions that changes took effect
- After list/search/check-permission: verify results match filter criteria and
verdict contains allow/deny
- Before delete: confirm with user — deletion is irreversible
- After export: check local directory file structure matches OBS source
Best Practices 最佳实践
- Use
--dry-run with create/update/delete/import/export to validate parameters before execution
- Before creating assets with ext_metadata, consult
references/validation-rules.md for required fields by type
- Use
import-asset (not create-asset) for most scenarios — it handles the full flow (asset + version + OBS upload)
- For failed imports, reuse the existing version with
--asset-id --version-id to avoid accumulating empty versions
- Query predefined tags via
list-tags before adding tags to ensure they are valid
- Use
export-asset followed by import-asset for seamless asset migration — export generates
README.md with frontmatter, import auto-reads it to fill metadata
- For import without frontmatter, provide
--ext-metadata for model/dataset/simulation types to
pass pre-validation
1---
2name: huawei-cloud-cloudrobo-asset
3description: >
4 Manage the full lifecycle of CloudRobo assets — query repositories and catalogs,
5 create/list/show/update/delete assets and versions, batch-delete, tag management,
6 predefined tag discovery, Action CRUD, permission checks, marketplace search,
7 official/community asset listing, asset lineage, and local-to-OBS import/export.
8 Triggers include: asset import, asset export, asset version management, tag management,
9 Action configuration, permission check, marketplace search, lineage query, repository
10 listing, catalog listing, publication asset discovery, 资产管理, 资产导入导出, 版本管理,
11 标签管理, Action配置, 权限校验, 广场搜索, 血缘关系, 资产仓库, 目录查询.
12tags:
13 - huawei-cloud-cloudrobo
14 - asset-management
15 - version-management
16 - import-export
17 - marketplace-search
18---
19
20> **Windows / PowerShell:** Examples use bash syntax. To run on Windows PowerShell:
21> - Flatten `\` line continuations to a single line, or end lines with a backtick.
22> - Set env vars with `$env:NAME="value"` instead of `export NAME="value"`.
23> - Single-quoted JSON `'{"a":"b"}'` works as-is.
24
25## Overview 概述
26
27The `cloudrobo-asset` skill manages the full lifecycle of CloudRobo platform assets. It
28covers repository and catalog queries, asset CRUD (create/list/show/update/delete/batch-delete),
29version CRUD, tag management, Action CRUD, permission checks, marketplace search,
30official/community asset listing, asset lineage, and local-to-OBS import/export.
31
32**Applicable scenarios:**
33
34- **Asset lifecycle** — Create, list, show, update, delete, batch-delete assets and versions
35- **Import/Export** — Import local folders to OBS as assets; export asset versions to local paths
36- **Marketplace discovery** — Search marketplace assets; list official/community publication assets
37- **Tag management** — Add/delete tags; query platform predefined tag lists
38- **Action management** — Create/list/show/update/delete Actions on asset versions
39- **Permission check** — Verify user permissions on asset versions
40- **Lineage** — Query parent-child relationships between asset versions
41
42**Architecture:**
43
44```
45Agent / LLM
46 │
47 ├── CLI → cloudrobo asset <command>
48 ├── SDK → AssetClient (Python)
49 │
50 ▼
51 cloudrobo-asset-manager (REST API)
52 /v1/repositories
53 /v1/catalogs
54 /v1/assets/*
55 /v1/asset-service/search
56 /v1/asset-service/publication-assets
57 /v1/asset-tags
58 │
59 ├── OBS (import/export file transfer)
60 └── cloudrobo-obs endpoint (configured separately)
61```
62
63All operations target the `cloudrobo-asset-manager` backend. Import/export additionally
64requires a `cloudrobo-obs` endpoint for OBS file transfer.
65
66## Prerequisites 前置条件
67
68See `references/cli-installation-guide.md` for CLI installation, AK/SK authentication, and
69configuration. Import/export operations require the `cloudrobo-obs` endpoint to be configured in
70`~/.cloudrobo/config.yaml` or via the `CLOUDROBO_ENDPOINT_cloudrobo-obs` environment variable.
71
72## Workflow 工作流
73
74### Prerequisite: Get catalog_id 前置步骤
75
76Multiple scenarios require a `catalog_id`. Only execute when the user has not provided it:
77
781. **Get from current workspace (preferred):** `cloudrobo workspace current` → read
79 `asset_catalog_id` field (the catalog bound to the current workspace)
802. **Fallback — list repositories and catalogs:** If no workspace is configured or
81 `asset_catalog_id` is empty:
82 1. `cloudrobo asset list-repositories` → get `repository_id`
83 2. `cloudrobo asset list-catalogs --repository-id <repo-id>` → get `catalog_id`
84
85### Scenario 1: Import Local Asset 导入资产
86
87Import local files (models, datasets, etc.) into the CloudRobo asset repository.
88
89**Fast path:** If `local-path/README.md` exists with valid frontmatter (e.g., from a previous
90`export-asset`), only `--catalog-id` (for new asset) or `--asset-id` (for new version) is needed
91— all other metadata is read from frontmatter. Without frontmatter, `catalog_id`, `name`, `type`
92(and `sub_type` for simulation) must be provided via CLI.
93
941. (Only when creating new asset and catalog_id is missing) Execute "Prerequisite: Get catalog_id"
952. Import:
96 ```bash
97 # With frontmatter (recommended — after export)
98 cloudrobo asset import-asset --catalog-id <id> --local-path <path>
99 # Without frontmatter
100 cloudrobo asset import-asset --catalog-id <id> --name <name> --type <type> --local-path <path> [--sub-type <sub-type>] [--ext-metadata '{"key":"value"}']
101 ```
102 - Auto-reads `local-path/README.md` frontmatter for metadata (name, type, sub_type, description,
103 status, tags, version, ext_metadata, parent_asset_version_id, generation_method)
104 - Frontmatter values override CLI parameters (except catalog_id, CLI only); fields missing from both trigger errors
105 - `--ext-metadata` CLI param also supported (frontmatter overrides it)
106 - ext_metadata pre-validated by type before API call (model→model_type, dataset→annotation_status,
107 algorithm→engine+command, image→arch+device_type, simulation (sub_type=robot)→robot_type+robot_manufacturer)
108 - Auto-creates asset + version + uploads to OBS
109 - Existing asset new version: add `--asset-id <existing-asset-id>`
110 - Reuse existing version for upload retry: add `--asset-id <id> --version-id <vid>` (default: incremental upload — skips existing OBS objects; use `--overwrite` to force re-upload all files)
1113. Verify: `cloudrobo asset show-asset --asset-id <asset-id>`
112
113**Error recovery:** If import fails at OBS upload (asset and version created but files not
114uploaded, version stays in `CREATING` status), do NOT create a new version. Two recovery strategies:
115- **Reuse version (recommended):** `list-versions --asset-id <id>` to find the failed version,
116 re-run `import-asset --asset-id <id> --version-id <vid>` to upload directly (incremental by
117 default — only uploads missing files; the version transitions to `DRAFT` once upload succeeds)
118- **Delete and retry:** `delete-version --asset-id <id> --version-id <vid>` then re-run
119 `import-asset --asset-id <id>`
120
121### Scenario 2: Search Marketplace 搜索广场资产
122
1231. Search: `cloudrobo asset search-assets --keyword <keyword>`
1242. Show detail: `cloudrobo asset show-asset --asset-id <asset-id>`
125
126**Browse official/community:** `cloudrobo asset list-publication-assets --type <type>`
127
128**Export after search:** Only when the user requests export. If the marketplace asset permission
129does not include `data_read`, export is not allowed. `cloudrobo asset export-asset --asset-id <id>
130--local-path <path>` (default latest version; add `--version-id` for specific version). Export
131automatically generates `README.md` with YAML frontmatter containing asset metadata, enabling
132seamless re-import with minimal CLI parameters.
133
134### Scenario 3: List Workspace Assets 列举空间资产
135
1361. (Only when catalog_id is missing) Execute "Prerequisite: Get catalog_id"
1372. List: `cloudrobo asset list-assets --catalog-id <catalog-id>`
138 - Filter by `--type`, `--sub-type`, `--status`
139 - Or use `--repository-id` instead of `--catalog-id` for repository-level queries
140
141### Scenario 4: List Asset Versions 列举资产版本
142
1431. If asset_id is known, skip to step 3
1442. (Only when asset_id is missing) Execute "Prerequisite: Get catalog_id", then
145 `list-assets --catalog-id <id>` to locate `asset_id`
1463. List versions: `cloudrobo asset list-versions --asset-id <asset-id>`
147
148### Scenario 5: Create Asset with ext_metadata 创建含扩展元数据的资产
149
150model, dataset, simulation, algorithm, image types require ext_metadata at creation. Consult
151`references/validation-rules.md` for required fields by type.
152
1531. (Only when catalog_id is missing) Execute "Prerequisite: Get catalog_id"
1542. Create: `cloudrobo asset create-asset --catalog-id <id> --name <name> --type model --ext-metadata '{"model_type":"planning"}'`
1553. Create version: `cloudrobo asset create-version --asset-id <id> --version 1.0.0 --ext-metadata '{"model_type":"planning"}'`
156
157### Scenario 6: Tag Management 标签管理
158
1591. Add: `cloudrobo asset add-tags --asset-id <id> --tags "tag1,tag2"`
1602. Delete: `cloudrobo asset delete-tag --asset-id <id> --tag <tag>`
1613. Query predefined: `cloudrobo asset list-tags --language zh` (optional `--type`/`--sub-type` filter)
162
163## CLI Command Format Standard CLI命令格式标准
164
165```bash
166cloudrobo asset <command> [OPTIONS]
167```
168
169| Feature | Description | Example |
170|---------|-------------|---------|
171| Command group | `cloudrobo asset` | `cloudrobo asset list-assets` |
172| Subcommand | kebab-case | `list-repositories`, `create-asset`, `import-asset` |
173| JSON parameter | `--ext-metadata '{"key":"value"}'` | `--ext-metadata '{"model_type":"planning"}'` |
174| Comma list | `--tags tag1,tag2` | `--tags robot,arm` |
175| Dry-run | `--dry-run` (where supported) | Preview without executing |
176| Output format | JSON to stdout | `out(result)` |
177| UUID identifiers | `--asset-id`, `--version-id`, `--catalog-id` | UUID format required |
178
179## Core Commands 核心命令
180
181### Repository & Catalog 仓库与目录
182
183| Command | Key Params | SDK Method | API |
184|---------|-----------|------------|-----|
185| list-repositories | `[--name] [--sort-dir] [--offset] [--limit]` | `client.list_repositories(**params)` | `GET /v1/repositories` |
186| list-catalogs | `--repository-id <id> [--name] [--sort-dir] [--offset] [--limit]` | `client.list_catalogs(repository_id, **params)` | `GET /v1/catalogs` |
187| show-catalog | `--catalog-id <id>` | `client.show_catalog(catalog_id)` | `GET /v1/catalogs/{catalog_id}` |
188
189### Asset Management 资产管理
190
191#### Create asset
192```bash
193cloudrobo asset create-asset --catalog-id <catalog-id> --type <type> [--name <name>] [--sub-type <sub-type>] [--description <desc>] [--status <status>] [--tags "tag1,tag2"] [--url <obs-or-swr-path>] [--ext-metadata '{"key":"value"}'] [--parent-asset-version-id <uuid>] [--generation-method <method>] [--dry-run]
194```
195- **SDK:** `client.create_asset(req: dict)`
196- **API:** `POST /v1/assets`
197
198#### List assets
199```bash
200cloudrobo asset list-assets [--repository-id <id>] [--catalog-id <id>] [--type <type>] [--sub-type <sub-type>] [--status <status>] [--name <name>] [--tags "tag1,tag2"] [--mine] [--offset <n>] [--limit <n>]
201# Either --repository-id OR --catalog-id filters the list. Full parameter list: see references/api-paths.md → List Assets
202```
203- **SDK:** `client.list_assets(**params)`
204- **API:** `GET /v1/assets`
205
206**Note:** `repository-id` and `catalog-id` — at least one must be provided; both provided =
207AND filter.
208
209#### Update asset
210```bash
211cloudrobo asset update-asset --asset-id <asset-id> [--name <name>] [--description <desc>] [--status <status>] [--tags "tag1,tag2"] [--ext-metadata '{"key":"value"}'] [--dry-run]
212```
213- **SDK:** `client.update_asset(asset_id, req: dict)`
214- **API:** `PUT /v1/assets/{asset_id}`
215
216**Note:** `update-asset` only supports modifying `name`/`description`/`status`/`tags`/
217`ext-metadata` — the CLI exposes no parameters for `catalog_id`, `type`, `sub_type`,
218`url`, `parent_asset_version_id`, or `generation_method`, so these fields are immutable.
219
220| Command | Key Params | SDK Method | API |
221|---------|-----------|------------|-----|
222| show-asset | `--asset-id <id>` | `client.show_asset(asset_id)` | `GET /v1/assets/{asset_id}` |
223| delete-asset | `--asset-id <id> [--dry-run]` | `client.delete_asset(asset_id)` | `DELETE /v1/assets/{asset_id}` |
224| batch-delete-assets | `--asset-ids "id1,id2" [--dry-run]` | `client.batch_delete_assets({"asset_ids": [...]})` | `POST /v1/assets/batch-delete` |
225
226### Version Management 版本管理
227
228#### Create version
229```bash
230cloudrobo asset create-version --asset-id <asset-id> [--version <version>] [--description <desc>] [--status <status>] [--url <obs-or-swr-path>] [--ext-metadata '{"key":"value"}'] [--parent-asset-version-id <uuid>] [--generation-method <method>] [--dry-run]
231```
232- **SDK:** `client.create_asset_version(asset_id, req: dict)`
233- **API:** `POST /v1/assets/{asset_id}/versions`
234
235#### List versions
236```bash
237cloudrobo asset list-versions --asset-id <asset-id> [--version <version>] [--exact-version <version>] [--sort-key <field>] [--sort-dir <asc|desc>] [--offset <n>] [--limit <n>] [--actions "FFT,LORA"] [--actions-operator <and|or>] [--ext-metadata <key=value>] [--action-status "ENABLE,DISABLE"]
238```
239- **SDK:** `client.list_asset_versions(asset_id, **params)`
240- **API:** `GET /v1/assets/{asset_id}/versions`
241
242#### Update version
243```bash
244cloudrobo asset update-version --asset-id <asset-id> --version-id <version-id> [--version <version>] [--description <desc>] [--status <status>] [--ext-metadata '{"key":"value"}'] [--dry-run]
245```
246- **SDK:** `client.update_asset_version(asset_id, version_id, req: dict)`
247- **API:** `PUT /v1/assets/{asset_id}/versions/{version_id}`
248
249**Note:** `update-version` only supports modifying `version`/`description`/`status`/
250`ext-metadata` — the CLI exposes no parameters for `url`, `parent_asset_version_id`, or
251`generation_method`, so these fields are immutable.
252
253| Command | Key Params | SDK Method | API |
254|---------|-----------|------------|-----|
255| show-version | `--asset-id <id> --version-id <vid>` | `client.show_asset_version(asset_id, version_id)` | `GET /v1/assets/{asset_id}/versions/{version_id}` |
256| delete-version | `--asset-id <id> --version-id <vid> [--dry-run]` | `client.delete_asset_version(asset_id, version_id)` | `DELETE /v1/assets/{asset_id}/versions/{version_id}` |
257| batch-delete-versions | `--asset-id <id> --version-ids "v1,v2" [--dry-run]` | `client.batch_delete_asset_versions(asset_id, {"version_ids": [...]})` | `POST /v1/assets/{asset_id}/versions/batch-delete` |
258
259### Tag Management 标签管理
260
261| Command | Key Params | SDK Method | API |
262|---------|-----------|------------|-----|
263| add-tags | `--asset-id <id> --tags "t1,t2" [--dry-run]` | `client.add_tags(asset_id, tags)` | `POST /v1/assets/{asset_id}/tags` |
264| delete-tag | `--asset-id <id> --tag <tag> [--dry-run]` | `client.delete_tag(asset_id, tag)` | `DELETE /v1/assets/{asset_id}/tags/{tag}` |
265| list-tags | `--language <zh\|en> [--type] [--sub-type]` | `client.list_all_tags(language, type, sub_type)` | `GET /v1/asset-tags` |
266
267### Action Management Action管理
268
269| Command | Key Params | SDK Method | API |
270|---------|-----------|------------|-----|
271| list-actions | `--asset-id <id> --version-id <vid>` | `client.list_asset_actions(asset_id, version_id)` | `GET /v1/assets/{asset_id}/versions/{version_id}/actions` |
272| show-action | `--asset-id <id> --version-id <vid> --action <name>` | `client.show_asset_action(asset_id, version_id, action)` | `GET .../actions/{action}` |
273| delete-action | `--asset-id <id> --version-id <vid> --action <name> [--dry-run]` | `client.delete_asset_action(asset_id, version_id, action)` | `DELETE .../actions/{action}` |
274
275**Create/Update action** (detailed):
276```bash
277cloudrobo asset create-action --asset-id <id> --version-id <vid> --action-info '{"action":"FFT","algorithm":{"asset_id":"...","version_id":"..."},"status":"ENABLE"}' [--dry-run]
278# SDK: client.create_asset_action(asset_id, version_id, req)
279# API: POST /v1/assets/{asset_id}/versions/{version_id}/actions
280
281cloudrobo asset update-action --asset-id <id> --version-id <vid> --action <name> --action-info '{"status":"DISABLE"}' [--dry-run]
282# SDK: client.update_asset_action(asset_id, version_id, action, req)
283# API: PUT /v1/assets/{asset_id}/versions/{version_id}/actions/{action}
284```
285
286### Permission & Lineage 权限与血缘
287
288| Command | Key Params | SDK Method | API |
289|---------|-----------|------------|-----|
290| check-permission | `--asset-id <id> --version-id <vid> --permissions "meta_read,data_read"` | `client.check_asset_permission(asset_id, version_id, req)` | `POST .../check-permission` |
291| show-lineage | `--asset-id <id> --version-id <vid> --type <children\|parent>` | `client.show_asset_tree(asset_id, version_id, type)` | `GET .../tree?type=<children\|parent>` |
292
293Valid permissions: `meta_read`, `meta_write`, `data_read`, `data_write`, `data_usable`
294Lineage: `children` = parent-to-child; `parent` = child-to-parent.
295
296### Marketplace 广场
297
298| Command | Key Params | SDK Method | API |
299|---------|-----------|------------|-----|
300| search-assets | `--keyword <kw> [--type] [--limit] [--offset]` | `client.search_assets(req)` | `POST /v1/asset-service/search` |
301| list-publication-assets | `[--type] [--sub-type] [--name] [--tags] [--status] [--capabilities] [--offset] [--limit]` | `client.list_publication_assets(**params)` | `GET /v1/asset-service/publication-assets` |
302
303Full parameter list: see references/api-paths.md → List Publication Assets
304
305### Import & Export 导入导出
306
307#### Import asset
308```bash
309cloudrobo asset import-asset --local-path <local-folder> [--catalog-id <id>] [--name <name>] [--type <type>] [--sub-type <sub-type>] [--ext-metadata '{"key":"value"}'] [--asset-id <id>] [--version-id <vid>] [--overwrite] [--dry-run]
310```
311
312**Frontmatter support:**
313- Auto-reads `local-path/README.md` YAML frontmatter
314- Fields: `name`, `type`, `sub_type`, `description`, `status`, `tags`, `version`, `ext_metadata`,
315 `parent_asset_version_id`, `generation_method`
316- Priority: frontmatter overrides CLI parameters (except catalog_id, CLI only); fields missing from both trigger errors
317- Required fields for new asset: `catalog_id` (CLI only), `name` (frontmatter or CLI), `type` (frontmatter or CLI)
318- ext_metadata pre-validation: model/dataset/algorithm/image/simulation types validated before API call (robot is a sub_type of simulation)
319
320**Modes:**
321- No `--asset-id`: Create new asset + version + upload to OBS; after upload, if version status is `CREATING`, auto-update to `DRAFT`
322- `--asset-id` only: Create new version for existing asset + upload to OBS; after upload, if version status is `CREATING`, auto-update to `DRAFT`
323- `--asset-id` + `--version-id`: Reuse existing version, incremental upload to OBS only (skips existing OBS objects by default; use `--overwrite` to force re-upload all files); after upload, if version status is `CREATING`, auto-update to `DRAFT`
324
325**Status flow:** When no `--status` is specified, the backend creates the version with status `CREATING`. After a successful OBS upload, if the version status is still `CREATING`, the SDK automatically calls `update-version` to set it to `DRAFT`. If the user explicitly specifies a status (e.g., `RELEASE` via frontmatter), the upload succeeds but the status is not auto-modified.
326
327#### Export asset
328```bash
329cloudrobo asset export-asset --asset-id <id> --local-path <local-folder> [--version-id <version-id>] [--dry-run]
330```
331
332**README.md generation:**
333- Creates `<local-path>/<asset-id>/README.md` with YAML frontmatter
334- Frontmatter fields: `name`, `type`, `sub_type`, `description`, `status`, `tags`, `version`,
335 `ext_metadata`, `parent_asset_version_id`, `generation_method`
336- If README.md already exists, preserves body content and replaces frontmatter only
337- Enables seamless re-import with minimal CLI parameters
338
339## Parameter Confirmation 参数确认
340
341| Parameter | Required | Description | Example |
342|-----------|----------|-------------|---------|
343| `--catalog-id` | Conditional (new asset import, most commands) | Catalog UUID | `b2c3d4e5-f6a7-...` |
344| `--asset-id` | Yes (asset/version ops) | Asset UUID | `a1b2c3d4-...` |
345| `--version-id` | Yes (version ops) | Version UUID | `d4e5f6a7-b8c9-...` |
346| `--type` | Conditional (import without frontmatter) | Asset type | `model`, `dataset`, `algorithm`, `image`, `simulation` |
347| `--name` | Conditional (import without frontmatter) | Asset name | `my-model` |
348| `--sub-type` | Conditional (algorithm/image/simulation) | Asset sub_type | algorithm: `inference`,`data_processing`,`training`,`data_evaluating`,`rl`; image: `inference`,`data_processing`,`training`,`notebook`,`rl`; simulation: `robot`,`environment`,`object`,`scene` |
349| `--local-path` | Yes (import/export) | Local folder path | `./my-model` |
350| `--ext-metadata` | Conditional (model/dataset/algorithm/image/simulation) | Extended metadata JSON | `{"model_type":"planning"}` |
351| `--language` | Yes (list-tags) | Tag language | `zh`, `en` |
352| `--permissions` | Yes (check-permission) | Permission list | `meta_read,data_read` |
353| `--dry-run` | No | Preview without executing | flag |
354| `--description` | No | Asset/version description | `My model description` |
355| `--status` | No | Asset/version status | `CREATING`, `DRAFT`, `RELEASE`, etc. |
356| `--tags` | No | Tag list (comma-separated, full replacement on update) | `production,stable` |
357| `--url` | No | OBS or SWR path (create-asset/create-version only) | `obs://bucket/path` |
358| `--generation-method` | No | Asset generation method (create-asset/create-version only) | `manual` |
359| `--parent-asset-version-id` | No | Parent version UUID (create-asset/create-version only) | `d4e5f6a7-...` |
360
361**Mutating operations** (create/update/delete/import/export/batch-delete) should be confirmed
362by the user before execution. `--dry-run` can be used to preview the operation safely.
363
364## Reference Documents 参考文档
365
366- [CLI Installation Guide](references/cli-installation-guide.md) — cloudrobo CLI installation and configuration
367- [IAM Policies](references/iam-policies.md) — Least-privilege credential model
368- [Verification Method](references/verification-method.md) — Verification method details
369- [Dataflow Diagram](references/dataflow-diagram.md) — Mermaid data flow diagram
370- [Acceptance Criteria](references/acceptance-criteria.md) — Acceptance criteria
371- [API Paths](references/api-paths.md) — REST API paths discovered via SDK source
372- [Validation Rules](references/validation-rules.md) — Field validation, ext_metadata rules, parameter interactions
373- [Edge Cases](references/edge-cases.md) — Edge cases and error handling
374
375## Edge Cases 边界情况
376
377Key edge cases include: missing catalog_id, import OBS upload failure recovery, export
378permission checks, immutable field validation, built-in vs workspace asset distinction,
379and `capabilities` filter mapping. See [Edge Cases](references/edge-cases.md) for the
380full table.
381
382## Verification Method 验证方法
383
384```bash
385# Specification compliance + functional testing
386bash scripts/test-cli-commands.sh . --executor {cli|sdk|api}
387```
388
389Test cases: see `templates/test-vars.json` for the full list covering all asset operations.
390
391### Verification Checklist 验证清单
392- After create/update/import: verify via `show-asset`/`show-version`/`list-actions` that changes took effect
393- After list/search/check-permission: verify results match filter criteria and `verdict` contains `allow`/`deny`
394- Before delete: confirm with user — deletion is irreversible
395- After export: check local directory file structure matches OBS source
396
397## Best Practices 最佳实践
398
399- Use `--dry-run` with create/update/delete/import/export to validate parameters before execution
400- Before creating assets with ext_metadata, consult `references/validation-rules.md` for required fields by type
401- Use `import-asset` (not `create-asset`) for most scenarios — it handles the full flow (asset + version + OBS upload)
402- For failed imports, reuse the existing version with `--asset-id --version-id` to avoid accumulating empty versions
403- Query predefined tags via `list-tags` before adding tags to ensure they are valid
404- Use `export-asset` followed by `import-asset` for seamless asset migration — export generates
405 README.md with frontmatter, import auto-reads it to fill metadata
406- For import without frontmatter, provide `--ext-metadata` for model/dataset/simulation types to
407 pass pre-validation