@w-xuefeng/cfib 0.0.1 → 0.0.2

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.
package/README.md CHANGED
@@ -93,10 +93,13 @@ cfib random output.jpg --type img --origin "https://example.com"
93
93
 
94
94
  ## 🤖 关于 AI Agent Skills
95
95
 
96
- 在项目的 `skills/` 文件夹下包含了可以直接被 AI Agent(例如 Claude, AutoGPT 工具链)解析吸收的能力配置清单(`SKILL.md`)。
96
+ 在项目的 `skills/` 文件夹下包含了可以直接被 AI Agent(例如 Cline, OpenClaw 等工具链)解析吸收的能力配置清单(`SKILL.md`)。
97
97
 
98
- 这些说明文档内置了完整的调用说明,AI 助手在读取这些配置后便能安全、无障碍地为你执行上述所列的图床业务。
98
+ 该说明文档(`skills/cfib-cli/SKILL.md`)内置了完整的指令和规则说明。AI 助手在读取这些配置后便能安全、无障碍地为你执行上述所列的所有图床业务(文件上传、移除和随机获取)。
99
99
 
100
- - `skills/upload/SKILL.md`
101
- - `skills/remove/SKILL.md`
102
- - `skills/random/SKILL.md`
100
+ 除此之外对于 AI 智能体系的自身优化,还加入了:
101
+ - **动态帮助查询**:要求 Agent 主动执行 `cfib --help` 获取最即时的各类参数说明与最新用法规范。
102
+ - **凭据集成提取**:内置提取启发,引导 AI 在缺失必须参数时,可以主动调用同生态的 `local-diamond` 配置中心(例如 `bunx lod get cfib/origin`)一键提取对应环境变量组,从而达成更高程度的自治运行。
103
+
104
+ 只需让你的 Agent 引入或者加载以下核心 Skill 解析说明,即可解锁 CFIB 图床管理的全部功能:
105
+ - `skills/cfib-cli/SKILL.md`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@w-xuefeng/cfib",
3
3
  "description": "cloudflare-image-bed CLI tools and Agent Skills",
4
- "version": "0.0.1",
4
+ "version": "0.0.2",
5
5
  "module": "src/index.ts",
6
6
  "type": "module",
7
7
  "bin": {
@@ -20,4 +20,4 @@
20
20
  "dependencies": {
21
21
  "@w-xuefeng/bkit": "^0.0.5"
22
22
  }
23
- }
23
+ }
@@ -0,0 +1,96 @@
1
+ ---
2
+ name: cfib-cli
3
+ description: Use the cfib CLI to interact with a Cloudflare Image Bed. Use when the user wants to upload a local file, remove a remote file or folder, or fetch a random image/path from the image bed via cfib.
4
+ metadata: {"openclaw":{"requires":{"bins":["cfib"]}}}
5
+ ---
6
+
7
+ # CFIB CLI
8
+
9
+ This skill allows you to interact with a Cloudflare Image Bed instance via the `cfib` CLI.
10
+
11
+ ## Working rules
12
+
13
+ - Prefer the native `cfib` binary when it exists on PATH. Otherwise, use `bunx @w-xuefeng/cfib` or `npx @w-xuefeng/cfib`.
14
+ - Use the `exec` tool to execute the cfib script.
15
+ - Treat `--origin`, tokens, auth codes, and similar credentials as secrets; do not echo them back unnecessarily.
16
+ - **Credential retrieval**: If you lack required parameters (like `--origin`, `--upload-auth-code`, or tokens), try fetching them using `local-diamond` (`lod`). Extract them by executing `bunx lod get cfib/origin`, `bunx lod get cfib/upload-auth-code`, `bunx lod get cfib/upload-token`, or `bunx lod get cfib/delete-token`.
17
+ - For destructive actions like `cfib remove`, confirm with the user unless they already clearly asked for deletion.
18
+ - When downloading with `random --type img`, save into a user-specified path when possible and report where the file was written.
19
+ - Return the important parts of the command result in plain language, and include paths/URLs when the command succeeds.
20
+ - To discover more options or verify usage at runtime, execute `cfib --help`.
21
+
22
+ ## Commands
23
+
24
+ ### 1. Upload a local file (`cfib upload`)
25
+
26
+ Upload a local generic file or image to a Cloudflare Image Bed instance.
27
+
28
+ ```bash
29
+ cfib upload <local_filepath> [options]
30
+ ```
31
+
32
+ **Required Arguments:**
33
+ - `<local_filepath>`: The absolute or relative path to the local file you wish to upload.
34
+
35
+ **Global Required Options:**
36
+ - `--origin <url>`: The origin URL of the image bed server.
37
+ - `--upload-auth-code <code>`: The auth code cookie value to bypass authentication.
38
+
39
+ **Global Optional Environment & Tracing Options:**
40
+ - `--upload-token <token>`: The authorization token for uploading.
41
+ - `--trace <id>`, `--lang <language>`, `--log <true|false>`
42
+
43
+ **Upload Specific Options (Optional):**
44
+ - `--server-compress <true|false>`: Whether the server should compress the image.
45
+ - `--upload-channel <channel>`: The channel to use (telegram, cfr2, s3, discord, huggingface).
46
+ - `--upload-folder <folder>`: A specific folder on the server to upload the file to.
47
+ - `--auth-code <code>`: Specific authCode for upload.
48
+
49
+ **Success Criteria:** Outputs a JSON response. A successful upload contains `success: true` and the `data.src` / `data.url`.
50
+
51
+ ---
52
+
53
+ ### 2. Remove an image or folder (`cfib remove`)
54
+
55
+ Delete an existing file or directory from the Cloudflare Image Bed server.
56
+
57
+ ```bash
58
+ cfib remove <remote_path> [options]
59
+ ```
60
+
61
+ **Required Arguments:**
62
+ - `<remote_path>`: The path on the server referencing the file or folder.
63
+
64
+ **Global Required Options:**
65
+ - `--origin <url>`: The origin URL of the image bed server.
66
+ - `--upload-auth-code <code>`: The auth code cookie value.
67
+
68
+ **Optional Options:**
69
+ - `--delete-token <token>`: The authorization token required for deletion.
70
+ - `--folder`: Pass this flag if `<remote_path>` is a folder and you want to delete the whole folder.
71
+ - `--trace <id>`, `--lang <language>`, `--log <true|false>`
72
+
73
+ **Success Criteria:** Outputs a JSON response with `success: true`.
74
+
75
+ ---
76
+
77
+ ### 3. Fetch a random image (`cfib random`)
78
+
79
+ Fetch a random file or image from the Cloudflare Image Bed server. It can either return the JSON metadata or download the actual file.
80
+
81
+ ```bash
82
+ cfib random [options] [local_save_path]
83
+ ```
84
+
85
+ **Options (All Optional):**
86
+ - `[local_save_path]`: If you specify `--type img`, provide a local filepath to save the binary data (defaults to `random-image.jpg`).
87
+ - `--type <path|img>`: (default: path) If `img`, returns and saves the file directly. If `path`, returns JSON info.
88
+ - `--content <image|video>`, `--form <json|text>`, `--dir <path>`, `--orientation <landscape|portrait|square|auto>`
89
+
90
+ **Global Required Options:**
91
+ - `--origin <url>`: The origin URL of the image bed server.
92
+
93
+ **Global Optional Options:**
94
+ - `--trace <id>`, `--lang <language>`, `--log <true|false>`
95
+
96
+ **Success Criteria:** Outputs JSON metadata of the file. If `--type img` is used, the image is saved to the given path.
@@ -1,48 +0,0 @@
1
- ---
2
- description: Get a random image from the Cloudflare Image Bed
3
- ---
4
-
5
- # Random Image Skill
6
-
7
- This tool fetches a random file or image from the Cloudflare Image Bed server. It can either return the JSON metadata or download the actual file.
8
-
9
- ## Usage
10
-
11
- Use the `run_command` tool to execute the cfib script. If the package is installed globally, you can use `cfib`. Otherwise, use `bunx cfib` or `npx cfib`:
12
-
13
- ```bash
14
- cfib random [options] [local_save_path]
15
- # OR
16
- bunx @w-xuefeng/cfib random [options] [local_save_path]
17
- ```
18
-
19
- ### Options (All Optional):
20
- - `[local_save_path]`: If you specify `--type img`, you must provide a local filepath to save the binary image data (defaults to `random-image.jpg`).
21
- - `--type <path|img>`: (default: path) If set to `img`, returns and saves the file directly. If set to `path`, returns JSON info.
22
- - `--content <image|video>`: (default: image) The type of content to filter.
23
- - `--form <json|text>`: (default: json) The response data format.
24
- - `--dir <path>`: Filter random files only within a specific server directory.
25
- - `--orientation <landscape|portrait|square|auto>`: Filter by image orientation.
26
-
27
- ### Global Required Options:
28
- - `--origin <url>`: The origin URL of the image bed server.
29
-
30
- ### Global Optional Options:
31
- - `--trace <id>`: Set an explicit Trace-Id.
32
- - `--lang <language>`: Set an explicit Accept-Language.
33
- - `--log <true|false>`: Enable or disable logging.
34
-
35
- ## Examples
36
-
37
- Get JSON metadata of a random image:
38
- ```bash
39
- cfib random --origin "https://my-image-bed.com"
40
- ```
41
-
42
- Download a random image directly to `test.jpg`:
43
- ```bash
44
- cfib random test.jpg --type img --origin "https://my-image-bed.com"
45
- ```
46
-
47
- ## Success Criteria
48
- Normally outputs JSON metadata of the file. If `--type img` is used, the image is saved to the provided local path and outputs `Image saved to <path>`.
@@ -1,48 +0,0 @@
1
- ---
2
- description: Remove an image or folder from the Cloudflare Image Bed
3
- ---
4
-
5
- # Remove Image or Folder Skill
6
-
7
- This tool allows you to delete an existing file or directory from the Cloudflare Image Bed server.
8
-
9
- ## Usage
10
-
11
- Use the `run_command` tool to execute the cfib script. If the package is installed globally, you can use `cfib`. Otherwise, use `bunx cfib` or `npx cfib`:
12
-
13
- ```bash
14
- cfib remove <remote_path> [options]
15
- # OR
16
- bunx @w-xuefeng/cfib remove <remote_path> [options]
17
- ```
18
-
19
- ### Required Arguments:
20
- - `<remote_path>`: The path on the server referencing the file or folder.
21
-
22
- ### Global Required Options:
23
- - `--origin <url>`: The origin URL of the image bed server.
24
- - `--upload-auth-code <code>`: The auth code cookie value.
25
-
26
- ### Global Optional Options:
27
- - `--delete-token <token>`: The authorization token required for deletion.
28
- - `--trace <id>`: Set an explicit Trace-Id.
29
- - `--lang <language>`: Set an explicit Accept-Language.
30
- - `--log <true|false>`: Enable or disable logging.
31
-
32
- ### Options (All Optional):
33
- - `--folder`: Pass this flag if the `<remote_path>` is a folder and you want to delete the whole folder instead of a target file.
34
-
35
- ## Example
36
-
37
- Delete a single file:
38
- ```bash
39
- cfib remove "12345.png" --origin "https://my-image-bed.com" --upload-auth-code "my-auth-code" --delete-token "my-secret-token"
40
- ```
41
-
42
- Delete a full folder:
43
- ```bash
44
- cfib remove "my_folder_name" --folder --origin "https://my-image-bed.com" --upload-auth-code "my-auth-code"
45
- ```
46
-
47
- ## Success Criteria
48
- The command outputs a JSON response with `success: true` when the file or folder is successfully deleted.
@@ -1,45 +0,0 @@
1
- ---
2
- description: Upload a local image to the Cloudflare Image Bed
3
- ---
4
-
5
- # Upload Image Skill
6
-
7
- This tool allows you to upload a local generic file or image to a Cloudflare Image Bed instance.
8
-
9
- ## Usage
10
-
11
- Use the `run_command` tool to execute the cfib script. If the package is installed globally, you can use `cfib`. Otherwise, use `bunx cfib` or `npx cfib`:
12
-
13
- ```bash
14
- cfib upload <local_filepath> [options]
15
- # OR
16
- bunx @w-xuefeng/cfib upload <local_filepath> [options]
17
- ```
18
-
19
- ### Required Arguments:
20
- - `<local_filepath>`: The absolute or relative path to the local file you wish to upload.
21
-
22
- ### Global Required Options:
23
- - `--origin <url>`: The origin URL of the image bed server.
24
- - `--upload-auth-code <code>`: The auth code cookie value to bypass authentication.
25
-
26
- ### Global Optional Environment & Tracing Options:
27
- - `--upload-token <token>`: The authorization token for uploading.
28
- - `--trace <id>`: Set an explicit Trace-Id.
29
- - `--lang <language>`: Set an explicit Accept-Language.
30
- - `--log <true|false>`: Enable or disable logging.
31
-
32
- ### Upload Specific Options (All Optional):
33
- - `--server-compress <true|false>`: Whether the server should compress the image.
34
- - `--upload-channel <channel>`: The channel to use (telegram, cfr2, s3, discord, huggingface).
35
- - `--upload-folder <folder>`: A specific folder on the server to upload the file to.
36
- - `--auth-code <code>`: Specific authCode for upload.
37
-
38
- ## Example
39
-
40
- ```bash
41
- cfib upload /path/to/my/image.png --origin "https://my-image-bed.com" --upload-auth-code "my-auth-code" --upload-token "my-token"
42
- ```
43
-
44
- ## Success Criteria
45
- The command outputs a JSON response. A successful upload will contain a `success: true` and the `data.src` / `data.url` pointing to the uploaded file.