@cnbcool/cnb-api-generate 2.11.4 → 2.11.5

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.
@@ -133,6 +133,9 @@ interface IssueUploadData {
133
133
 
134
134
  /** Pull 上传成功时的 data */
135
135
  interface PullUploadData {
136
+ /** asset_link 的别名,语义更直观,方便 AI 理解这是一个可直接插入评论的 markdown 链接 */
137
+ asset_link?: string;
138
+ markdown?: string;
136
139
  name: string;
137
140
  path?: string;
138
141
  size: number;
@@ -360,9 +363,19 @@ export async function handleUpload(
360
363
  const data = apiResponse?.data as PullUploadResponseData | undefined;
361
364
  uploadUrl = data?.upload_url;
362
365
  if (!uploadUrl) return apiResponse as unknown as UploadResult;
366
+ // markdown 作为 asset_link 的别名,方便 AI 理解使用
367
+ // Pull 上传不返回 asset_link,由 assets.path + name 构造 markdown 链接
368
+ const assetPath = data?.assets?.path;
369
+ const assetName = data?.assets?.name || fileName;
370
+ const isImage = shortcut.kind === 'image';
371
+ const assetLink = assetPath
372
+ ? `${isImage ? '!' : ''}[${assetName}](${assetPath})`
373
+ : undefined;
363
374
  successData = {
364
- name: data?.assets?.name || fileName,
365
- path: data?.assets?.path,
375
+ asset_link: assetLink,
376
+ markdown: assetLink,
377
+ name: assetName,
378
+ path: assetPath,
366
379
  size: fileSize,
367
380
  token: data?.token,
368
381
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cnbcool/cnb-api-generate",
3
- "version": "2.11.4",
3
+ "version": "2.11.5",
4
4
  "main": "./built/index.js",
5
5
  "module": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -27,8 +27,8 @@
27
27
  { "shortName": "check-status", "realTool": "list-pull-commit-statuses", "description": "查看 CI 状态" },
28
28
  { "shortName": "list-reviews", "realTool": "list-pull-reviews", "description": "查看评审列表" },
29
29
  { "shortName": "list-assignees", "realTool": "list-pull-assignees", "description": "查看处理人" },
30
- { "shortName": "upload-file", "realTool": "upload-files", "description": "上传文件", "repoOnly": true, "upload": true, "dataTip": "--file 文件路径" },
31
- { "shortName": "upload-image", "realTool": "upload-imgs", "description": "上传图片", "repoOnly": true, "upload": true, "dataTip": "--file 图片路径" },
30
+ { "shortName": "upload-file", "realTool": "upload-files", "description": "上传文件", "repoOnly": true, "upload": true, "kind": "file", "dataTip": "--file 文件路径" },
31
+ { "shortName": "upload-image", "realTool": "upload-imgs", "description": "上传图片", "repoOnly": true, "upload": true, "kind": "image", "dataTip": "--file 图片路径" },
32
32
  { "shortName": "get-ci-logs", "realTool": "__get-ci-logs__", "description": "获取 CI 失败日志", "repoOnly": true, "custom": true, "dataTip": "--sn 构建号(可选)" },
33
33
  { "shortName": "get-ci-timing", "realTool": "__get-ci-timing__", "description": "分析 CI 耗时瓶颈", "repoOnly": true, "custom": true, "dataTip": "--sn 构建号(可选)" },
34
34
  { "shortName": "get-imgs", "realTool": "get-pr-imgs", "description": "获取 PR 图片", "repoOnly": true, "dataTip": "--img-path 图片路径" },