@lark-apaas/miaoda-cli 0.1.3-alpha.67da0bb → 0.1.3-alpha.6e2a705

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.
Files changed (71) hide show
  1. package/README.md +5 -4
  2. package/dist/api/app/api.js +3 -3
  3. package/dist/api/app/schemas.js +43 -43
  4. package/dist/api/db/api.js +54 -361
  5. package/dist/api/db/client.js +24 -60
  6. package/dist/api/db/index.js +1 -11
  7. package/dist/api/db/parsers.js +20 -20
  8. package/dist/api/db/sql-keywords.js +87 -87
  9. package/dist/api/deploy/api.js +5 -5
  10. package/dist/api/deploy/schemas.js +32 -32
  11. package/dist/api/file/api.js +87 -89
  12. package/dist/api/file/client.js +22 -22
  13. package/dist/api/file/detect.js +3 -3
  14. package/dist/api/file/index.js +1 -2
  15. package/dist/api/file/parsers.js +7 -18
  16. package/dist/api/observability/api.js +16 -6
  17. package/dist/api/observability/index.js +2 -1
  18. package/dist/api/observability/schemas.js +14 -14
  19. package/dist/api/plugin/api.js +31 -31
  20. package/dist/cli/commands/app/index.js +12 -12
  21. package/dist/cli/commands/db/index.js +54 -593
  22. package/dist/cli/commands/deploy/index.js +28 -28
  23. package/dist/cli/commands/file/index.js +57 -84
  24. package/dist/cli/commands/observability/index.js +128 -72
  25. package/dist/cli/commands/plugin/index.js +27 -27
  26. package/dist/cli/commands/shared.js +15 -10
  27. package/dist/cli/handlers/app/update.js +2 -2
  28. package/dist/cli/handlers/db/data.js +31 -32
  29. package/dist/cli/handlers/db/index.js +1 -17
  30. package/dist/cli/handlers/db/schema.js +33 -33
  31. package/dist/cli/handlers/db/sql.js +69 -69
  32. package/dist/cli/handlers/deploy/deploy.js +4 -4
  33. package/dist/cli/handlers/deploy/error-log.js +1 -1
  34. package/dist/cli/handlers/deploy/get.js +3 -3
  35. package/dist/cli/handlers/deploy/polling.js +11 -11
  36. package/dist/cli/handlers/file/cp.js +30 -30
  37. package/dist/cli/handlers/file/index.js +1 -3
  38. package/dist/cli/handlers/file/ls.js +5 -5
  39. package/dist/cli/handlers/file/rm.js +24 -24
  40. package/dist/cli/handlers/file/sign.js +3 -3
  41. package/dist/cli/handlers/file/stat.js +9 -10
  42. package/dist/cli/handlers/observability/analytics.js +47 -47
  43. package/dist/cli/handlers/observability/helpers.js +6 -2
  44. package/dist/cli/handlers/observability/index.js +3 -1
  45. package/dist/cli/handlers/observability/log.js +15 -9
  46. package/dist/cli/handlers/observability/metric.js +26 -26
  47. package/dist/cli/handlers/observability/source-stack.js +353 -0
  48. package/dist/cli/handlers/observability/trace.js +11 -5
  49. package/dist/cli/handlers/plugin/plugin-local.js +53 -53
  50. package/dist/cli/handlers/plugin/plugin.js +15 -15
  51. package/dist/cli/help.js +16 -16
  52. package/dist/main.js +12 -12
  53. package/dist/utils/args.js +1 -1
  54. package/dist/utils/colors.js +2 -2
  55. package/dist/utils/config.js +2 -2
  56. package/dist/utils/devops-error.js +9 -9
  57. package/dist/utils/error.js +2 -2
  58. package/dist/utils/git.js +4 -4
  59. package/dist/utils/http.js +19 -19
  60. package/dist/utils/index.js +1 -3
  61. package/dist/utils/output.js +45 -67
  62. package/dist/utils/render.js +27 -27
  63. package/dist/utils/time.js +42 -47
  64. package/package.json +1 -1
  65. package/dist/cli/handlers/db/audit.js +0 -294
  66. package/dist/cli/handlers/db/changelog.js +0 -130
  67. package/dist/cli/handlers/db/migration.js +0 -235
  68. package/dist/cli/handlers/db/quota.js +0 -68
  69. package/dist/cli/handlers/db/recovery.js +0 -357
  70. package/dist/cli/handlers/file/quota.js +0 -66
  71. package/dist/utils/poll.js +0 -27
package/README.md CHANGED
@@ -36,10 +36,11 @@ miaoda file ls --output json
36
36
 
37
37
  命令以"域"作为第一级命名空间:
38
38
 
39
- | 域 | 用途 |
40
- |---|---|
41
- | `miaoda file ...` | 文件操作:上传、下载、元数据、签名下载、批量删除 |
42
- | `miaoda db ...` | 数据操作:SQL 执行、表结构查询、数据导入导出 |
39
+ | 域 | 用途 |
40
+ | -------------------------- | ---------------------------------------------------- |
41
+ | `miaoda file ...` | 文件操作:上传、下载、元数据、签名下载、批量删除 |
42
+ | `miaoda db ...` | 数据操作:SQL 执行、表结构查询、数据导入导出 |
43
+ | `miaoda observability ...` | 线上日志、链路、前端源码堆栈反查、监控指标、运营指标 |
43
44
 
44
45
  完整命令通过 `miaoda --help` 或 `miaoda <domain> --help` 查看。
45
46
 
@@ -4,7 +4,7 @@ exports.getAppInfo = getAppInfo;
4
4
  exports.updateAppMeta = updateAppMeta;
5
5
  const http_1 = require("../../utils/http");
6
6
  const devops_error_1 = require("../../utils/devops-error");
7
- const DEFAULT_ERR_CODE = 'INTERNAL_DEVOPS_ERROR';
7
+ const DEFAULT_ERR_CODE = "INTERNAL_DEVOPS_ERROR";
8
8
  function envelopeOpts(errPrefix) {
9
9
  return {
10
10
  errPrefix,
@@ -15,11 +15,11 @@ function envelopeOpts(errPrefix) {
15
15
  /** GET /v1/devops/app/:appID — 获取应用详情 */
16
16
  async function getAppInfo(appID) {
17
17
  const url = `/v1/devops/app/${encodeURIComponent(appID)}`;
18
- return (0, http_1.getInnerApi)(url, envelopeOpts('Failed to get app info'));
18
+ return (0, http_1.getInnerApi)(url, envelopeOpts("Failed to get app info"));
19
19
  }
20
20
  /** POST /v1/devops/app/:appID/meta — 更新应用元数据 */
21
21
  async function updateAppMeta(req) {
22
22
  const url = `/v1/devops/app/${encodeURIComponent(req.appID)}/meta`;
23
23
  // 路径已带 appID,body 里也保留以匹配 BAM IDL 的 sensitive:"no" 透传约定
24
- return (0, http_1.postInnerApi)(url, req, envelopeOpts('Failed to update app'));
24
+ return (0, http_1.postInnerApi)(url, req, envelopeOpts("Failed to update app"));
25
25
  }
@@ -5,47 +5,47 @@ const output_1 = require("../../utils/output");
5
5
  const types_1 = require("./types");
6
6
  // Partial<Record<...>>:未来 BAM 加新枚举值时这里没声明也不报错,运行期 lookup 自然得 undefined
7
7
  const STATUS_TEXT = {
8
- [types_1.AppStatus.UNSPECIFIED]: 'unknown',
9
- [types_1.AppStatus.PREPARING]: 'preparing',
10
- [types_1.AppStatus.UNRELEASED]: 'unreleased',
11
- [types_1.AppStatus.RELEASED]: 'released',
12
- [types_1.AppStatus.DELETED]: 'deleted',
13
- [types_1.AppStatus.UPGRADING]: 'upgrading',
8
+ [types_1.AppStatus.UNSPECIFIED]: "unknown",
9
+ [types_1.AppStatus.PREPARING]: "preparing",
10
+ [types_1.AppStatus.UNRELEASED]: "unreleased",
11
+ [types_1.AppStatus.RELEASED]: "released",
12
+ [types_1.AppStatus.DELETED]: "deleted",
13
+ [types_1.AppStatus.UPGRADING]: "upgrading",
14
14
  };
15
15
  const MODE_TEXT = {
16
- [types_1.AppMode.UNSPECIFIED]: 'unknown',
17
- [types_1.AppMode.STANDARD]: 'standard',
18
- [types_1.AppMode.EXPERT]: 'expert',
16
+ [types_1.AppMode.UNSPECIFIED]: "unknown",
17
+ [types_1.AppMode.STANDARD]: "standard",
18
+ [types_1.AppMode.EXPERT]: "expert",
19
19
  };
20
20
  const TYPE_TEXT = {
21
- [types_1.AppType.UNSPECIFIED]: 'unknown',
22
- [types_1.AppType.STANDARD]: 'standard',
23
- [types_1.AppType.PROTOTYPE]: 'prototype',
24
- [types_1.AppType.APPLICATION]: 'application',
25
- [types_1.AppType.DESIGN]: 'design',
26
- [types_1.AppType.OPENCLAW]: 'openclaw',
27
- [types_1.AppType.CLAW_SUB]: 'claw_sub',
21
+ [types_1.AppType.UNSPECIFIED]: "unknown",
22
+ [types_1.AppType.STANDARD]: "standard",
23
+ [types_1.AppType.PROTOTYPE]: "prototype",
24
+ [types_1.AppType.APPLICATION]: "application",
25
+ [types_1.AppType.DESIGN]: "design",
26
+ [types_1.AppType.OPENCLAW]: "openclaw",
27
+ [types_1.AppType.CLAW_SUB]: "claw_sub",
28
28
  };
29
29
  const BIZ_TYPE_TEXT = {
30
- [types_1.BizType.UNSPECIFIED]: 'unknown',
31
- [types_1.BizType.MIAODA]: 'miaoda',
32
- [types_1.BizType.FORCE]: 'force',
30
+ [types_1.BizType.UNSPECIFIED]: "unknown",
31
+ [types_1.BizType.MIAODA]: "miaoda",
32
+ [types_1.BizType.FORCE]: "force",
33
33
  };
34
34
  const ARCH_TYPE_TEXT = {
35
- [types_1.ArchType.UNSPECIFIED]: 'unknown',
36
- [types_1.ArchType.FULL_STACK]: 'full_stack',
37
- [types_1.ArchType.NOT_FULL_STACK]: 'not_full_stack',
35
+ [types_1.ArchType.UNSPECIFIED]: "unknown",
36
+ [types_1.ArchType.FULL_STACK]: "full_stack",
37
+ [types_1.ArchType.NOT_FULL_STACK]: "not_full_stack",
38
38
  };
39
39
  const SOURCE_TEXT = {
40
- [types_1.Source.UNSPECIFIED]: 'unknown',
41
- [types_1.Source.CHAT]: 'chat',
42
- [types_1.Source.TEMPLATE]: 'template',
43
- [types_1.Source.IMPORT_ZIP]: 'import_zip',
44
- [types_1.Source.IMPORT_BASE]: 'import_base',
40
+ [types_1.Source.UNSPECIFIED]: "unknown",
41
+ [types_1.Source.CHAT]: "chat",
42
+ [types_1.Source.TEMPLATE]: "template",
43
+ [types_1.Source.IMPORT_ZIP]: "import_zip",
44
+ [types_1.Source.IMPORT_BASE]: "import_base",
45
45
  };
46
46
  function lookup(table) {
47
47
  return (v) => {
48
- if (typeof v !== 'number')
48
+ if (typeof v !== "number")
49
49
  return undefined;
50
50
  return table[v];
51
51
  };
@@ -59,21 +59,21 @@ function lookup(table) {
59
59
  */
60
60
  exports.appMetaSchema = {
61
61
  columns: [
62
- { key: 'appID', label: 'app-id' },
63
- { key: 'name' },
64
- { key: 'description' },
65
- { key: 'status_text', label: 'status', derive: (row) => lookup(STATUS_TEXT)(row.status) },
66
- { key: 'appType_text', label: 'type', derive: (row) => lookup(TYPE_TEXT)(row.appType) },
67
- { key: 'appMode_text', label: 'mode', derive: (row) => lookup(MODE_TEXT)(row.appMode) },
68
- { key: 'bizType_text', label: 'biz-type', derive: (row) => lookup(BIZ_TYPE_TEXT)(row.bizType) },
69
- { key: 'archType_text', label: 'arch', derive: (row) => lookup(ARCH_TYPE_TEXT)(row.archType) },
70
- { key: 'source_text', label: 'source', derive: (row) => lookup(SOURCE_TEXT)(row.source) },
71
- { key: 'ownedBy', label: 'owner' },
72
- { key: 'createdBy', label: 'creator' },
73
- { key: 'dataBranchID', label: 'branch' },
74
- { key: 'parentAppID', label: 'parent-app' },
75
- { key: 'createdAt', label: 'created-at', format: output_1.fmt.ms() },
76
- { key: 'updatedAt', label: 'updated-at', format: output_1.fmt.ms() },
62
+ { key: "appID", label: "app-id" },
63
+ { key: "name" },
64
+ { key: "description" },
65
+ { key: "status_text", label: "status", derive: (row) => lookup(STATUS_TEXT)(row.status) },
66
+ { key: "appType_text", label: "type", derive: (row) => lookup(TYPE_TEXT)(row.appType) },
67
+ { key: "appMode_text", label: "mode", derive: (row) => lookup(MODE_TEXT)(row.appMode) },
68
+ { key: "bizType_text", label: "biz-type", derive: (row) => lookup(BIZ_TYPE_TEXT)(row.bizType) },
69
+ { key: "archType_text", label: "arch", derive: (row) => lookup(ARCH_TYPE_TEXT)(row.archType) },
70
+ { key: "source_text", label: "source", derive: (row) => lookup(SOURCE_TEXT)(row.source) },
71
+ { key: "ownedBy", label: "owner" },
72
+ { key: "createdBy", label: "creator" },
73
+ { key: "dataBranchID", label: "branch" },
74
+ { key: "parentAppID", label: "parent-app" },
75
+ { key: "createdAt", label: "created-at", format: output_1.fmt.ms() },
76
+ { key: "updatedAt", label: "updated-at", format: output_1.fmt.ms() },
77
77
  ],
78
78
  strict: true,
79
79
  };