@lark-apaas/miaoda-cli 0.1.19-alpha.c3da59d → 0.1.19-alpha.e4d5797

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.
@@ -15,7 +15,7 @@ async function getComments(appID, onlyUnresolved = false) {
15
15
  const body = await (0, http_1.getInnerApi)(url, {
16
16
  errPrefix: 'Failed to list comments',
17
17
  });
18
- return body.items ?? [];
18
+ return body.comments ?? [];
19
19
  }
20
20
  /** POST /api/v1/studio/innerapi/apps/:appID/comments/:commentID/resolve — 解决评论 */
21
21
  async function resolveComment(appID, commentID) {
@@ -1,6 +1,2 @@
1
1
  "use strict";
2
- /**
3
- * 评论相关类型,镜像 inner-api 返回的 data 结构(snake_case 原样,与 lark docs 评论体一致)。
4
- * ID 为 int64 itoa 后的字符串;时间为秒级 epoch。
5
- */
6
2
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -37,56 +37,26 @@ exports.handleCommentList = handleCommentList;
37
37
  const api = __importStar(require("../../../api/index"));
38
38
  const shared_1 = require("../../../cli/commands/shared");
39
39
  const output_1 = require("../../../utils/output");
40
- /** 单个内联元素渲染成文本:text_run 出文本、docs_link 出链接、person 出 @user。 */
41
- function renderElement(el) {
42
- if (el.text_run?.text)
43
- return el.text_run.text;
44
- if (el.docs_link?.url)
45
- return el.docs_link.url;
46
- if (el.person?.user_id)
47
- return `@${el.person.user_id}`;
48
- return '';
49
- }
50
- /** 一条 reply:正文(各 element 拼接)+ extra 图片数量标注(extra.image_list)。 */
51
- function renderReply(r) {
52
- const body = (r.content?.elements ?? []).map(renderElement).join('').trim();
53
- const images = r.extra?.image_list;
54
- const imageCount = Array.isArray(images) ? images.length : 0;
55
- const parts = [body, imageCount > 0 ? `[图片×${String(imageCount)}]` : ''].filter((p) => p.length > 0);
56
- return parts.join(' ');
57
- }
58
- /**
59
- * pretty 的 content 列:把所有 reply 渲染后用 " | " 拼接。含 @人 / 云文档链接 / 图片标注等
60
- * extra 信息。仅用于 pretty 概览;JSON 模式原样透传完整 reply_list。
61
- */
62
- function commentText(c) {
63
- return (c.reply_list?.replies ?? [])
64
- .map(renderReply)
65
- .filter((t) => t.length > 0)
66
- .join(' | ');
67
- }
68
- /**
69
- * pretty 概览列;JSON 模式忽略 schema,原样输出完整评论结构(与 openapi file.comment 一致)。
70
- * strict:pretty 只渲染这些列,不把 reply_list / quote 等嵌套字段追加成额外列。
71
- */
72
40
  const listSchema = {
73
- strict: true,
74
41
  columns: [
75
42
  { key: 'comment_id', label: 'id' },
76
- { key: 'is_solved', label: 'solved' },
43
+ { key: 'finish' },
44
+ { key: 'resolved' },
77
45
  { key: 'user_id', label: 'user' },
78
46
  { key: 'create_time', label: 'time', format: output_1.fmt.sec() },
79
- {
80
- key: 'content',
81
- label: 'content',
82
- derive: (row) => commentText(row),
83
- format: output_1.fmt.truncate(80),
84
- },
47
+ { key: 'content', format: output_1.fmt.truncate(80) },
85
48
  ],
86
49
  };
87
50
  async function handleCommentList(opts) {
88
51
  const appId = (0, shared_1.resolveAppId)({ appId: opts.appId });
89
52
  const comments = await api.comment.getComments(appId, opts.onlyUnresolved ?? false);
90
- // data 原样透传完整评论结构(含 reply_list / replies / reactions …),与 openapi 保持一致。
91
- (0, output_1.emit)({ data: comments }, listSchema);
53
+ const rows = comments.map((c) => ({
54
+ comment_id: c.commentID,
55
+ content: c.content,
56
+ user_id: c.userID,
57
+ finish: c.finish,
58
+ resolved: c.finish === 1,
59
+ create_time: c.createTime,
60
+ }));
61
+ (0, output_1.emit)({ data: rows }, listSchema);
92
62
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/miaoda-cli",
3
- "version": "0.1.19-alpha.c3da59d",
3
+ "version": "0.1.19-alpha.e4d5797",
4
4
  "description": "Miaoda 平台命令行工具,面向 Agent 调用",
5
5
  "type": "commonjs",
6
6
  "bin": {