@lark-apaas/miaoda-cli 0.1.19-alpha.7f0b693 → 0.1.19-alpha.834fd32

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
@@ -11,12 +11,17 @@ pnpm add -g @lark-apaas/miaoda-cli
11
11
  ## 使用
12
12
 
13
13
  ```bash
14
- # 设置默认应用(需要应用上下文的命令可用 --app-id 覆盖)
14
+ # 设置默认应用(需要应用上下文的命令从 MIAODA_APP_ID 读取)
15
15
  export MIAODA_APP_ID=app_demo_xxx
16
16
 
17
17
  # 文件操作
18
18
  miaoda file ls
19
19
  miaoda file upload ./local/path
20
+
21
+ # 评论操作
22
+ miaoda comment list --json
23
+ miaoda comment list --only-unresolved --json
24
+ miaoda comment resolve 1703677660120110076 --json
20
25
  ```
21
26
 
22
27
  JSON 结构化输出(Agent 推荐):
@@ -41,6 +46,7 @@ miaoda file ls --output json
41
46
  | `miaoda file ...` | 文件操作:上传、下载、元数据、签名下载、批量删除 |
42
47
  | `miaoda db ...` | 数据操作:SQL 执行、表结构查询、数据导入导出 |
43
48
  | `miaoda observability ...` | 线上日志、链路、前端源码堆栈反查、监控指标、运营指标 |
49
+ | `miaoda comment ...` | 应用评论:查看评论列表、解决评论 |
44
50
  | `miaoda registry ...` | 组件 registry:列出 / copy-in design-html SDK 文件(本地执行) |
45
51
 
46
52
  完整命令通过 `miaoda --help` 或 `miaoda <domain> --help` 查看。
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getComments = getComments;
4
+ exports.resolveComment = resolveComment;
5
+ const http_1 = require("../../utils/http");
6
+ /**
7
+ * 评论接口走管理端 inner-api(getHttpClient + 小写 status_code 信封),与 app / deploy /
8
+ * observability 等域一致:统一的 verbose 请求/响应日志、错误映射、信封解析,不再域内自实现。
9
+ */
10
+ /** GET /api/v1/studio/innerapi/apps/:appID/comments — 获取应用评论列表 */
11
+ async function getComments(appID, onlyUnresolved = false) {
12
+ let url = `/api/v1/studio/innerapi/apps/${encodeURIComponent(appID)}/comments`;
13
+ if (onlyUnresolved)
14
+ url += '?onlyUnresolved=true';
15
+ const body = await (0, http_1.getInnerApi)(url, {
16
+ errPrefix: 'Failed to list comments',
17
+ });
18
+ return body.comments ?? [];
19
+ }
20
+ /** POST /api/v1/studio/innerapi/apps/:appID/comments/:commentID/resolve — 解决评论 */
21
+ async function resolveComment(appID, commentID) {
22
+ const url = `/api/v1/studio/innerapi/apps/${encodeURIComponent(appID)}/comments/${encodeURIComponent(commentID)}/resolve`;
23
+ await (0, http_1.postInnerApi)(url, undefined, { errPrefix: 'Failed to resolve comment' });
24
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveComment = exports.getComments = void 0;
4
+ var api_1 = require("./api");
5
+ Object.defineProperty(exports, "getComments", { enumerable: true, get: function () { return api_1.getComments; } });
6
+ Object.defineProperty(exports, "resolveComment", { enumerable: true, get: function () { return api_1.resolveComment; } });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/api/index.js CHANGED
@@ -33,16 +33,18 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.deploy = exports.app = exports.observability = exports.db = exports.file = exports.plugin = void 0;
36
+ exports.comment = exports.deploy = exports.app = exports.observability = exports.db = exports.file = exports.plugin = void 0;
37
37
  const _plugin = __importStar(require("../api/plugin/index"));
38
38
  const _file = __importStar(require("../api/file/index"));
39
39
  const _db = __importStar(require("../api/db/index"));
40
40
  const _observability = __importStar(require("../api/observability/index"));
41
41
  const _app = __importStar(require("../api/app/index"));
42
42
  const _deploy = __importStar(require("../api/deploy/index"));
43
+ const _comment = __importStar(require("../api/comment/index"));
43
44
  exports.plugin = { ..._plugin };
44
45
  exports.file = { ..._file };
45
46
  exports.db = { ..._db };
46
47
  exports.observability = { ..._observability };
47
48
  exports.app = { ..._app };
48
49
  exports.deploy = { ..._deploy };
50
+ exports.comment = { ..._comment };
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerCommentCommands = registerCommentCommands;
4
+ const shared_1 = require("../../../cli/commands/shared");
5
+ const index_1 = require("../../../cli/handlers/comment/index");
6
+ function registerCommentCommands(program) {
7
+ const commentCmd = program
8
+ .command('comment')
9
+ .description('应用评论:查看评论列表、解决评论')
10
+ .usage('<command> [flags]');
11
+ commentCmd.action(() => {
12
+ commentCmd.outputHelp();
13
+ });
14
+ commentCmd.addHelpText('after', `
15
+ 作用范围
16
+ 操作当前应用的评论。应用上下文:--app-id <id> 或环境变量 MIAODA_APP_ID。
17
+ `);
18
+ const listCmd = commentCmd
19
+ .command('list')
20
+ .description('查看应用评论列表')
21
+ .addOption((0, shared_1.appIdOption)().hideHelp())
22
+ .option('--only-unresolved', '仅返回未解决的评论', false)
23
+ .addHelpText('after', `
24
+ JSON 输出
25
+ {"data": [{"comment_id": "...", "content": "...", "user_id": "...",
26
+ "finish": 0, "resolved": false, "create_time": 1700000000}]}
27
+
28
+ 示例
29
+ $ miaoda comment list --json
30
+ $ miaoda comment list --only-unresolved --json
31
+ `);
32
+ listCmd.action((0, shared_1.withHelp)(listCmd, async (rawOpts) => {
33
+ (0, shared_1.rejectCliOverride)(listCmd, 'appId');
34
+ await (0, index_1.handleCommentList)({
35
+ appId: rawOpts.appId,
36
+ onlyUnresolved: rawOpts.onlyUnresolved,
37
+ });
38
+ }));
39
+ const resolveCmd = commentCmd
40
+ .command('resolve')
41
+ .description('把一条评论标记为已解决')
42
+ .argument('<commentID>', '待解决的评论 ID')
43
+ .addOption((0, shared_1.appIdOption)().hideHelp())
44
+ .addHelpText('after', `
45
+ JSON 输出
46
+ {"data": {"comment_id": "...", "resolved": true}}
47
+
48
+ 示例
49
+ $ miaoda comment resolve 1703677660120110076 --json
50
+ `);
51
+ resolveCmd.action((0, shared_1.withHelp)(resolveCmd, async (commentId, rawOpts) => {
52
+ (0, shared_1.rejectCliOverride)(resolveCmd, 'appId');
53
+ await (0, index_1.handleCommentResolve)(commentId, { appId: rawOpts.appId });
54
+ }));
55
+ }
@@ -9,7 +9,8 @@ const index_4 = require("../../cli/commands/app/index");
9
9
  const index_5 = require("../../cli/commands/deploy/index");
10
10
  const modern_1 = require("../../cli/commands/deploy/modern");
11
11
  const index_6 = require("../../cli/commands/skills/index");
12
- const index_7 = require("../../cli/commands/registry/index");
12
+ const index_7 = require("../../cli/commands/comment/index");
13
+ const index_8 = require("../../cli/commands/registry/index");
13
14
  // scene 跟 dispatcher(MIAODA_APP_TYPE)同语义层级 —— app 业务类型维度,
14
15
  // 对齐后端 devops app_common.AppType 枚举:
15
16
  // 3 = AppType_APPLICATION(全栈应用,当前仅 nestjs-react-fullstack 一个 stack)
@@ -41,11 +42,13 @@ const SCENE_REGISTRARS = {
41
42
  (0, index_1.registerFileCommands)(p);
42
43
  (0, index_3.registerObservabilityCommands)(p);
43
44
  (0, index_6.registerSkillsCommands)(p);
45
+ (0, index_7.registerCommentCommands)(p);
44
46
  },
45
47
  modern: (p) => {
46
48
  (0, index_4.registerAppCommands)(p, { includeInit: true });
47
49
  (0, modern_1.registerDeployCommandsModern)(p);
48
50
  (0, index_6.registerSkillsCommands)(p);
51
+ (0, index_7.registerCommentCommands)(p);
49
52
  },
50
53
  // application scene(AppType_APPLICATION=3):
51
54
  // 在 default 命令集基础上加 skills(按 meta.json.stack 拉对应 stack 技能)
@@ -57,6 +60,7 @@ const SCENE_REGISTRARS = {
57
60
  (0, index_1.registerFileCommands)(p);
58
61
  (0, index_3.registerObservabilityCommands)(p);
59
62
  (0, index_6.registerSkillsCommands)(p);
63
+ (0, index_7.registerCommentCommands)(p);
60
64
  },
61
65
  // design scene(AppType_DESIGN=4):design-stack 仅 SSR 渲染、无后端业务逻辑、
62
66
  // 无数据库、无 UGC 文件。命令集裁掉 db / file,保留 deploy / observability / app(init) / skills。
@@ -65,6 +69,7 @@ const SCENE_REGISTRARS = {
65
69
  (0, index_5.registerDeployCommands)(p);
66
70
  (0, index_3.registerObservabilityCommands)(p);
67
71
  (0, index_6.registerSkillsCommands)(p);
72
+ (0, index_7.registerCommentCommands)(p);
68
73
  },
69
74
  // design-html scene(AppType_DESIGN_HTML=8):buildless 静态 HTML,
70
75
  // 命令集与 modern 一致(app init/sync + modern 拆分版 deploy + skills),不挂 db/file/observability。
@@ -73,7 +78,8 @@ const SCENE_REGISTRARS = {
73
78
  (0, index_4.registerAppCommands)(p, { includeInit: true });
74
79
  (0, modern_1.registerDeployCommandsModern)(p);
75
80
  (0, index_6.registerSkillsCommands)(p);
76
- (0, index_7.registerRegistryCommands)(p);
81
+ (0, index_8.registerRegistryCommands)(p);
82
+ (0, index_7.registerCommentCommands)(p);
77
83
  },
78
84
  };
79
85
  function readEnv(name) {
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handleCommentResolve = exports.handleCommentList = void 0;
4
+ var list_1 = require("./list");
5
+ Object.defineProperty(exports, "handleCommentList", { enumerable: true, get: function () { return list_1.handleCommentList; } });
6
+ var resolve_1 = require("./resolve");
7
+ Object.defineProperty(exports, "handleCommentResolve", { enumerable: true, get: function () { return resolve_1.handleCommentResolve; } });
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.handleCommentList = handleCommentList;
37
+ const api = __importStar(require("../../../api/index"));
38
+ const shared_1 = require("../../../cli/commands/shared");
39
+ const output_1 = require("../../../utils/output");
40
+ const listSchema = {
41
+ columns: [
42
+ { key: 'comment_id', label: 'id' },
43
+ { key: 'finish' },
44
+ { key: 'resolved' },
45
+ { key: 'user_id', label: 'user' },
46
+ { key: 'create_time', label: 'time', format: output_1.fmt.sec() },
47
+ { key: 'content', format: output_1.fmt.truncate(80) },
48
+ ],
49
+ };
50
+ async function handleCommentList(opts) {
51
+ const appId = (0, shared_1.resolveAppId)({ appId: opts.appId });
52
+ const comments = await api.comment.getComments(appId, opts.onlyUnresolved ?? false);
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);
62
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.handleCommentResolve = handleCommentResolve;
37
+ const api = __importStar(require("../../../api/index"));
38
+ const shared_1 = require("../../../cli/commands/shared");
39
+ const output_1 = require("../../../utils/output");
40
+ async function handleCommentResolve(commentId, opts) {
41
+ const appId = (0, shared_1.resolveAppId)({ appId: opts.appId });
42
+ await api.comment.resolveComment(appId, commentId);
43
+ (0, output_1.emitOk)({ comment_id: commentId, resolved: true });
44
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/miaoda-cli",
3
- "version": "0.1.19-alpha.7f0b693",
3
+ "version": "0.1.19-alpha.834fd32",
4
4
  "description": "Miaoda 平台命令行工具,面向 Agent 调用",
5
5
  "type": "commonjs",
6
6
  "bin": {