Overview
This Skill provides complete interaction capabilities with CNB's OpenAPI. Users can use this skill to operate on resources on CNB.
Applicable Scenarios
When the user describes performing operations on resources on CNB, this skill should be used for the operation. For example:
- Query the Issue list of a repository on CNB
- Comment on an Issue or PR of a repository on CNB.
- ...
Core Principles
Accuracy Principle
- CRITICAL: Must first execute
cnb --helpto obtain the latest usage method - CRITICAL: Must use the
cnbcommand-line tool and perform operations according to the help information - CRITICAL: It is forbidden to speculate or assume the usage method; strictly perform operations based on the help information returned by the script
- CRITICAL: Do not ask the user "Do you need me to execute this?"; directly execute the script according to the help information and return the result
Script Usage Guide
Step 1: Obtain Help Information
Before executing any task, you must first run the following command to obtain the latest usage method:
cnb --help
This will display all available modules and their tool lists.
Step 2: View Help for a Specific Module
Use the --module parameter to view detailed help for a specific module:
cnb --module <模块名> -help
Step 3: View Detailed Tool Usage
Use the --module and --tool parameters to view the detailed parameter description of the tool:
cnb --module <模块名> --tool <工具名> --help
Step 4: Execute the Tool
Based on the parameter description obtained in Step 3, execute the tool:
cnb --module <模块名> --tool <工具名> --path '{"参数": "值"}' --query '{"参数": "值"}' --data '{"参数": "值"}'
Parameter Description:
--module: Required parameter, module name--tool: Required parameter, tool name--path: Optional parameter, path parameter, in JSON string format--query: Optional parameter, query parameter, in JSON string format--data: Optional parameter, data parameter, in JSON string format--help: Optional parameter, display help documentation
Step 5: Process the Result
Each tool call returns a standard JSON structure:
- status: an HTTP status code
- trace: the traceID of this call
- header: the header of this call
- data: the entity content returned by the OpenAPI of this call
Header Description
When requesting a list, the header will include the following fields describing the list:
x-cnb-page: Current page numberx-cnb-page-size: Number of items per pagex-cnb-total: Total number of items
From this, you can obtain the total number of items in the list, as well as the current page number and the number of items per page, to avoid repeated requests.
Status Description
The API returns a standard JSON format response. Please determine whether the request is successful based on the HTTP status code:
- 200: Request successful
- 400: Request parameter error
- 401: Unauthorized
- 403: Forbidden
- 404: Resource does not exist
- 500: Internal server error
When the status returned by the local call is between 200 and 299, only the data content needs to be returned to the user. Only when status >= 300 , return the status and trace to the user.
Resource Handling
When attempting to download an image for image analysis and encountering an image download exception, please use the following tool to download the image!
node scripts/core/index.js assets get-imgs --help