@lark-apaas/miaoda-cli 0.1.22-alpha.2ecdffe → 0.1.22
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 +2 -36
- package/dist/api/deploy/index.js +1 -3
- package/dist/api/deploy/modern-types.js +1 -4
- package/dist/api/deploy/modern.js +0 -8
- package/dist/api/index.js +1 -3
- package/dist/cli/commands/app/index.js +2 -4
- package/dist/cli/commands/deploy/modern.js +0 -34
- package/dist/cli/commands/index.js +0 -19
- package/dist/cli/handlers/app/init.js +2 -6
- package/dist/cli/handlers/deploy/index.js +1 -3
- package/dist/cli/handlers/skills/sync.js +4 -12
- package/dist/services/app/init/template.js +0 -1
- package/dist/services/deploy/modern/atoms/index.js +1 -6
- package/dist/services/deploy/modern/atoms/upload.js +127 -4
- package/dist/services/deploy/modern/check.js +16 -28
- package/dist/services/deploy/modern/pipelines/index.js +1 -3
- package/dist/services/deploy/modern/protocol.js +0 -7
- package/dist/services/deploy/modern/run.js +4 -10
- package/dist/services/deploy/modern/template-key-map.js +0 -4
- package/dist/utils/http.js +1 -1
- package/package.json +1 -1
- package/dist/api/comment/api.js +0 -24
- package/dist/api/comment/index.js +0 -6
- package/dist/api/comment/types.js +0 -6
- package/dist/cli/commands/comment/index.js +0 -55
- package/dist/cli/commands/registry/index.js +0 -114
- package/dist/cli/handlers/comment/index.js +0 -7
- package/dist/cli/handlers/comment/list.js +0 -132
- package/dist/cli/handlers/comment/resolve.js +0 -44
- package/dist/cli/handlers/deploy/patch.js +0 -17
- package/dist/cli/handlers/registry/add.js +0 -97
- package/dist/cli/handlers/registry/index.js +0 -7
- package/dist/cli/handlers/registry/list.js +0 -48
- package/dist/cli/handlers/registry/shared.js +0 -25
- package/dist/services/deploy/modern/atoms/design-build.js +0 -49
- package/dist/services/deploy/modern/atoms/design-upload.js +0 -74
- package/dist/services/deploy/modern/atoms/tosutil.js +0 -246
- package/dist/services/deploy/modern/patch/actions.js +0 -61
- package/dist/services/deploy/modern/patch/content.js +0 -18
- package/dist/services/deploy/modern/patch/index.js +0 -46
- package/dist/services/deploy/modern/patch/routes.js +0 -37
- package/dist/services/deploy/modern/patch/source-scan.js +0 -58
- package/dist/services/deploy/modern/pipelines/design-local.js +0 -56
- package/dist/services/registry/index.js +0 -293
|
@@ -33,13 +33,6 @@ exports.DataKey = {
|
|
|
33
33
|
// downloadURLPrefix 替代原 static_cdn_prefix 注入 build env。
|
|
34
34
|
/** dist/output_static 上传凭证(仅当目录存在时使用) */
|
|
35
35
|
OUTPUT_STATIC_PAAS_STORAGE_CREDENTIAL: 'output_static_paas_storage_credential',
|
|
36
|
-
// ── design 部署专用(design_local_deploy) ──
|
|
37
|
-
/** 覆盖整个 {app_id} 文件夹的上传凭证(形态同 TosUploadCredential) */
|
|
38
|
-
OUTPUT_ALL_TOS_UPLOAD_CREDENTIAL: 'output_all_tos_upload_credential',
|
|
39
|
-
/** version/备份份真实路径(后端已替换 {app_id}/{version}) */
|
|
40
|
-
OUTPUT_BACKUP_PATH: 'output_backup_path',
|
|
41
|
-
/** latest 份真实路径(后端已替换 {app_id}/latest) */
|
|
42
|
-
OUTPUT_LATEST_PATH: 'output_latest_path',
|
|
43
36
|
};
|
|
44
37
|
/** 取必传 key,缺失抛 AppError(带 key 名,便于后端 tcc 配置排查) */
|
|
45
38
|
function requireDataKey(data, key) {
|
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// modern deploy 主入口(dispatch 层)。
|
|
3
3
|
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
// pipeline 之间彼此独立、不共享中间状态。
|
|
4
|
+
// 当前阶段(Scope A)只接入"本地构建 + 本地部署"一条 pipeline;
|
|
5
|
+
// 后续接入"本地构建 + 远端部署 / 远端构建 + 远端部署"时,在此处按 template_key
|
|
6
|
+
// 或显式 flag 选不同 pipeline。pipeline 之间彼此独立、不共享中间状态。
|
|
8
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
8
|
exports.runModernDeploy = runModernDeploy;
|
|
10
|
-
const spark_meta_1 = require("../../../utils/spark-meta");
|
|
11
|
-
const template_key_map_1 = require("./template-key-map");
|
|
12
9
|
const index_1 = require("./pipelines/index");
|
|
13
10
|
async function runModernDeploy(opts) {
|
|
14
|
-
|
|
15
|
-
if ((0, template_key_map_1.resolveTemplateKey)(stack) === template_key_map_1.DESIGN_LOCAL_DEPLOY) {
|
|
16
|
-
return (0, index_1.designLocalPublishPipeline)(opts);
|
|
17
|
-
}
|
|
11
|
+
// 暂只支持本地构建 + 本地部署
|
|
18
12
|
return (0, index_1.localBuildLocalPublishPipeline)(opts);
|
|
19
13
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DESIGN_LOCAL_DEPLOY = void 0;
|
|
4
3
|
exports.resolveTemplateKey = resolveTemplateKey;
|
|
5
4
|
/**
|
|
6
5
|
* 本地 stack 短名 → 后端发布模板 key 的映射。
|
|
@@ -11,12 +10,9 @@ exports.resolveTemplateKey = resolveTemplateKey;
|
|
|
11
10
|
* 未来出现需要走别的 templateKey 的 stack,再在表里加一行覆盖默认。
|
|
12
11
|
*/
|
|
13
12
|
const DEFAULT_TEMPLATE_KEY = 'client_local_deploy';
|
|
14
|
-
/** design 部署 templateKey(run.ts 据此分流到 design pipeline) */
|
|
15
|
-
exports.DESIGN_LOCAL_DEPLOY = 'design_local_deploy';
|
|
16
13
|
const TEMPLATE_KEY_MAP = {
|
|
17
14
|
'vite-react': DEFAULT_TEMPLATE_KEY,
|
|
18
15
|
html: DEFAULT_TEMPLATE_KEY,
|
|
19
|
-
'design-html': exports.DESIGN_LOCAL_DEPLOY,
|
|
20
16
|
};
|
|
21
17
|
/**
|
|
22
18
|
* 把本地 stack 短名映射到后端 templateKey;未配置的 stack 走默认 client_local_deploy。
|
package/dist/utils/http.js
CHANGED
|
@@ -64,7 +64,7 @@ function createClient(opts) {
|
|
|
64
64
|
* 默认灰度泳道。当前 miaoda CLI 接入的新接口(modern deploy 等)只在该泳道生效,
|
|
65
65
|
* 缺省走这个。MIAODA_CANARY_HEADER 可显式覆盖;设为空字符串则去掉头。
|
|
66
66
|
*/
|
|
67
|
-
const DEFAULT_CANARY_HEADER = '
|
|
67
|
+
const DEFAULT_CANARY_HEADER = 'boe_miaoda_doubao';
|
|
68
68
|
/**
|
|
69
69
|
* 注入 x-tt-env 小流量头:env 显式设值 > DEFAULT_CANARY_HEADER。
|
|
70
70
|
*
|
package/package.json
CHANGED
package/dist/api/comment/api.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
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.items ?? [];
|
|
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
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
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; } });
|
|
@@ -1,55 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.registerRegistryCommands = registerRegistryCommands;
|
|
4
|
-
const shared_1 = require("../../../cli/commands/shared");
|
|
5
|
-
const index_1 = require("../../../cli/handlers/registry/index");
|
|
6
|
-
/**
|
|
7
|
-
* miaoda registry:design-html 技术栈的「组件 registry」(shadcn 式 copy-in)。
|
|
8
|
-
*
|
|
9
|
-
* registry 是独立 npm 包,按 runtime 命名分发(buildless runtime → @lark-apaas/coding-registry-buildless)。
|
|
10
|
-
* SDK 文件放在包根的 components/ · scripts/ · stylesheets/ 三个目录下(这三个顶层目录里的代码文件
|
|
11
|
-
* 才算条目);文件可带 USAGE 注释块(可选,声明描述 / 用法 / Depends)。CLI 抓 tarball、按
|
|
12
|
-
* .spark/meta.json.stack → runtime → 包名 选包,把 SDK 文件**拍平**copy-in 到用户项目根。
|
|
13
|
-
* 不写安装记账文件——项目文件树即状态(skip-by-disk)。
|
|
14
|
-
*/
|
|
15
|
-
function registerRegistryCommands(program) {
|
|
16
|
-
const registryCmd = program
|
|
17
|
-
.command('registry')
|
|
18
|
-
.description('组件 registry:列出 / copy-in design-html SDK 文件')
|
|
19
|
-
.usage('<command> [flags]');
|
|
20
|
-
registryCmd.action(() => {
|
|
21
|
-
registryCmd.outputHelp();
|
|
22
|
-
});
|
|
23
|
-
registryCmd.addHelpText('after', `
|
|
24
|
-
概念
|
|
25
|
-
- registry 包:独立 npm 包(按 runtime 命名)
|
|
26
|
-
- 条目 (entry):包根 components/ · scripts/ · stylesheets/ 顶层目录(任意深度)下的代码文件;
|
|
27
|
-
name = 文件名去扩展名(不要求唯一)。包根直放文件、其它目录、非代码文件都不算条目
|
|
28
|
-
- 寻址:add / Depends 的 token 可写三种形式——name(foo)/ 完整文件名(foo.css)/ relPath(stylesheets/foo.css)
|
|
29
|
-
- 多匹配全拉:token 命中多个同名条目时全部 copy-in(不报歧义);想只要其一就写完整文件名 / relPath
|
|
30
|
-
- USAGE 块:可选元数据,声明描述 / Exports / Usage / Depends;无 USAGE 也是条目(空描述、无依赖)
|
|
31
|
-
- Depends:从 USAGE 块解析的跨条目依赖,add 时传递解析、一并 copy-in
|
|
32
|
-
- add 落地:拍平到项目根(包根 scripts/x.js → 项目 x.js);同名 basename 撞车时后者覆盖前者
|
|
33
|
-
|
|
34
|
-
前置
|
|
35
|
-
当前目录(或 --dir)已走过 'miaoda app init'(.spark/meta.json 含 stack=design-html)
|
|
36
|
-
`);
|
|
37
|
-
registerRegistryList(registryCmd);
|
|
38
|
-
registerRegistryAdd(registryCmd);
|
|
39
|
-
}
|
|
40
|
-
function registerRegistryList(parent) {
|
|
41
|
-
const cmd = parent
|
|
42
|
-
.command('list')
|
|
43
|
-
.description('列出 registry 可用 SDK 条目,输出各文件的 USAGE 块原文')
|
|
44
|
-
.option('--dir <path>', '项目目录,默认当前目录', '.')
|
|
45
|
-
.option('--version <ver>', 'registry 包版本或 dist-tag,缺省 latest')
|
|
46
|
-
.addHelpText('after', `
|
|
47
|
-
输出
|
|
48
|
-
默认(pretty):各条目 USAGE 块原文拼接,带文件名分隔,给 Agent 直接读注释
|
|
49
|
-
|
|
50
|
-
JSON 输出
|
|
51
|
-
{"data": [{"name": "...", "file": "...", "usage": "<原文>", "dependsOn": [...]}, ...]}
|
|
52
|
-
(usage 保持 USAGE 块原文,不解析成结构化字段)
|
|
53
|
-
|
|
54
|
-
示例
|
|
55
|
-
$ miaoda registry list
|
|
56
|
-
$ miaoda registry list --json
|
|
57
|
-
`);
|
|
58
|
-
cmd.action((0, shared_1.withHelp)(cmd, async (rawOpts) => {
|
|
59
|
-
await (0, index_1.handleRegistryList)({
|
|
60
|
-
dir: rawOpts.dir,
|
|
61
|
-
version: rawOpts.version,
|
|
62
|
-
});
|
|
63
|
-
}));
|
|
64
|
-
}
|
|
65
|
-
function registerRegistryAdd(parent) {
|
|
66
|
-
const cmd = parent
|
|
67
|
-
.command('add')
|
|
68
|
-
.description('把一个或多个 SDK 文件 copy-in 到当前项目(拍平到项目根,含 Depends 闭包)')
|
|
69
|
-
.argument('<token...>', 'name / 完整文件名 / relPath,可传多个;同名多匹配全拉,Depends 自动传递解析')
|
|
70
|
-
.option('--dir <path>', '项目目录,默认当前目录', '.')
|
|
71
|
-
.option('--version <ver>', 'registry 包版本或 dist-tag,缺省 latest')
|
|
72
|
-
.option('--overwrite', '目标文件已存在时覆盖(默认跳过以保护用户改动)', false)
|
|
73
|
-
.option('--dry-run', '只报告将写 / 将跳哪些文件,不落盘', false)
|
|
74
|
-
.addHelpText('after', `
|
|
75
|
-
行为
|
|
76
|
-
- token 寻址:name(foo)/ 完整文件名(foo.css)/ relPath(stylesheets/foo.css)任一形式
|
|
77
|
-
- 多匹配全拉:token 命中多个同名条目时全部 copy-in;想只要其一就写完整文件名 / relPath
|
|
78
|
-
- 解析 USAGE 块 Depends 传递闭包,把 SDK 文件**拍平**拷到项目根
|
|
79
|
-
(包根 scripts/deck-stage.js → 项目 deck-stage.js;同名 basename 撞车时后者覆盖前者)
|
|
80
|
-
- skip-by-disk:目标文件已存在默认跳过;--overwrite 才覆盖
|
|
81
|
-
- 不写任何安装记账文件(项目文件树即状态)
|
|
82
|
-
|
|
83
|
-
输出(pretty,默认)
|
|
84
|
-
registry@<ver>
|
|
85
|
-
added: <落地 basename 逗号列表> # 含 Depends 闭包全部落地文件
|
|
86
|
-
skipped: <逗号列表> # 仅有跳过时出现
|
|
87
|
-
dry-run: true (no files written) # 仅 --dry-run 时出现
|
|
88
|
-
|
|
89
|
-
# <请求条目落地 basename>
|
|
90
|
-
<该条目 USAGE 块原文> # 只列你请求的条目,依赖不占 usage 位
|
|
91
|
-
|
|
92
|
-
JSON 输出(--json)
|
|
93
|
-
{"data": {"registryVersion": "...", "added": [...], "skipped": [...], "dryRun": false,
|
|
94
|
-
"entries": [{"name": "...", "file": "<来源 relPath>", "dest": "<落地 basename>",
|
|
95
|
-
"status": "added|skipped", "usage": "<USAGE 块原文>", "dependsOn": [...]}, ...]}}
|
|
96
|
-
(added / skipped 覆盖依赖闭包全部落地文件;entries 只列**你请求的条目**
|
|
97
|
-
(不含被 Depends 传递拉入的依赖),逐条给 usage / dependsOn,add 完直接读用法。
|
|
98
|
-
请求的条目即使已存在被 skip 也回带 usage,status 标 added / skipped)
|
|
99
|
-
|
|
100
|
-
示例
|
|
101
|
-
$ miaoda registry add deck-slide
|
|
102
|
-
$ miaoda registry add deck-slide theme --dry-run
|
|
103
|
-
$ miaoda registry add deck-slide --overwrite --json
|
|
104
|
-
`);
|
|
105
|
-
cmd.action((0, shared_1.withHelp)(cmd, async (names, rawOpts) => {
|
|
106
|
-
await (0, index_1.handleRegistryAdd)({
|
|
107
|
-
names,
|
|
108
|
-
dir: rawOpts.dir,
|
|
109
|
-
version: rawOpts.version,
|
|
110
|
-
overwrite: rawOpts.overwrite,
|
|
111
|
-
dryRun: rawOpts.dryRun,
|
|
112
|
-
});
|
|
113
|
-
}));
|
|
114
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
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; } });
|
|
@@ -1,132 +0,0 @@
|
|
|
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 fmtTime = output_1.fmt.sec();
|
|
41
|
-
/** 去掉飞书内联 `<at ...>@某人</at>` 标签,保留内部 @文本。 */
|
|
42
|
-
function stripAtTags(s) {
|
|
43
|
-
return s.replace(/<at\b[^>]*>/g, '').replace(/<\/at>/g, '');
|
|
44
|
-
}
|
|
45
|
-
/** 单个内联元素渲染成文本:text_run 出文本、docs_link 出链接、person 出 @user。 */
|
|
46
|
-
function renderElement(el) {
|
|
47
|
-
if (el.text_run?.text)
|
|
48
|
-
return stripAtTags(el.text_run.text);
|
|
49
|
-
if (el.docs_link?.url)
|
|
50
|
-
return el.docs_link.url;
|
|
51
|
-
if (el.person?.user_id)
|
|
52
|
-
return `@${el.person.user_id}`;
|
|
53
|
-
return '';
|
|
54
|
-
}
|
|
55
|
-
/** 一条 reply 的正文文本(各 element 拼接、去 at 标签)。 */
|
|
56
|
-
function replyText(r) {
|
|
57
|
-
return (r.content?.elements ?? []).map(renderElement).join('').trim();
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* 评论级 extra 里的 content_anchor_id(评论锚定的页面元素定位)。
|
|
61
|
-
* extra 后端返回 JSON 字符串(也兼容已是对象的情况),解析失败返回 undefined。
|
|
62
|
-
*/
|
|
63
|
-
function commentAnchor(c) {
|
|
64
|
-
const { extra } = c;
|
|
65
|
-
let obj = extra;
|
|
66
|
-
if (typeof extra === 'string') {
|
|
67
|
-
try {
|
|
68
|
-
obj = JSON.parse(extra);
|
|
69
|
-
}
|
|
70
|
-
catch {
|
|
71
|
-
return undefined;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (typeof obj === 'object' && obj !== null) {
|
|
75
|
-
const anchor = obj.content_anchor_id;
|
|
76
|
-
if (typeof anchor === 'string' && anchor.length > 0)
|
|
77
|
-
return anchor;
|
|
78
|
-
}
|
|
79
|
-
return undefined;
|
|
80
|
-
}
|
|
81
|
-
/** 一条 reply 的附加标注:图片数量、reaction。 */
|
|
82
|
-
function replyAnnotations(r) {
|
|
83
|
-
const ann = [];
|
|
84
|
-
const images = r.extra?.image_list;
|
|
85
|
-
if (Array.isArray(images) && images.length > 0)
|
|
86
|
-
ann.push(`[图片×${String(images.length)}]`);
|
|
87
|
-
for (const rc of r.reactions ?? []) {
|
|
88
|
-
if (rc.reaction_key)
|
|
89
|
-
ann.push(`[${rc.reaction_key}×${String(rc.count ?? 0)}]`);
|
|
90
|
-
}
|
|
91
|
-
return ann;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* 渲染一条评论为多行块(信息全保留,靠结构化标签 + 列对齐提升可读性):
|
|
95
|
-
* ● [未解决] <comment_id> · N 条回复
|
|
96
|
-
* 引用 <quote>
|
|
97
|
-
* 锚点 <content_anchor_id 全量>
|
|
98
|
-
* <user 对齐> <time> <正文 + 标注>
|
|
99
|
-
* userWidth 为所有回复 user_id 的最大宽度,用于跨评论列对齐。
|
|
100
|
-
*/
|
|
101
|
-
function renderComment(c, userWidth) {
|
|
102
|
-
const replies = c.reply_list?.replies ?? [];
|
|
103
|
-
const lines = [
|
|
104
|
-
`● ${c.is_solved ? '[已解决]' : '[未解决]'} ${c.comment_id} · ${String(replies.length)} 条回复`,
|
|
105
|
-
];
|
|
106
|
-
if (typeof c.quote === 'string' && c.quote.length > 0)
|
|
107
|
-
lines.push(` 引用 ${c.quote}`);
|
|
108
|
-
const anchor = commentAnchor(c);
|
|
109
|
-
if (anchor !== undefined)
|
|
110
|
-
lines.push(` 锚点 ${anchor}`);
|
|
111
|
-
for (const r of replies) {
|
|
112
|
-
const body = [replyText(r), ...replyAnnotations(r)].filter((p) => p.length > 0).join(' ');
|
|
113
|
-
lines.push(` ${(r.user_id ?? '-').padEnd(userWidth)} ${fmtTime(r.create_time)} ${body}`);
|
|
114
|
-
}
|
|
115
|
-
return lines.join('\n');
|
|
116
|
-
}
|
|
117
|
-
async function handleCommentList(opts) {
|
|
118
|
-
const appId = (0, shared_1.resolveAppId)({ appId: opts.appId });
|
|
119
|
-
const comments = await api.comment.getComments(appId, opts.onlyUnresolved ?? false);
|
|
120
|
-
// JSON 模式:原样透传完整评论结构(含 reply_list / replies / reactions …),与 openapi 一致。
|
|
121
|
-
if ((0, output_1.isJsonMode)()) {
|
|
122
|
-
(0, output_1.emit)({ data: comments });
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
// pretty 模式:信息密集的分块形态,一条评论一块、每条回复一行(含人 / 时间 / 正文 / 标注)。
|
|
126
|
-
// 跨评论对齐 user 列:取所有回复 user_id 的最大宽度。
|
|
127
|
-
const userWidth = Math.max(0, ...comments.flatMap((c) => c.reply_list?.replies ?? []).map((r) => (r.user_id ?? '-').length));
|
|
128
|
-
const body = comments.length === 0
|
|
129
|
-
? '(无评论)'
|
|
130
|
-
: comments.map((c) => renderComment(c, userWidth)).join('\n\n');
|
|
131
|
-
process.stdout.write(body + '\n');
|
|
132
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handleDeployPatch = handleDeployPatch;
|
|
4
|
-
const index_1 = require("../../../services/deploy/modern/patch/index");
|
|
5
|
-
const output_1 = require("../../../utils/output");
|
|
6
|
-
/** miaoda deploy patch —— design-html 文件级增量发布 */
|
|
7
|
-
async function handleDeployPatch(opts) {
|
|
8
|
-
const result = await (0, index_1.patchDesignDeploy)({
|
|
9
|
-
appId: opts.appId,
|
|
10
|
-
projectDir: opts.dir ?? process.cwd(),
|
|
11
|
-
creates: opts.creates,
|
|
12
|
-
updates: opts.updates,
|
|
13
|
-
deletes: opts.deletes,
|
|
14
|
-
sessionId: opts.sessionId,
|
|
15
|
-
});
|
|
16
|
-
(0, output_1.emit)({ data: result });
|
|
17
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.handleRegistryAdd = handleRegistryAdd;
|
|
7
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
-
const index_1 = require("../../../services/registry/index");
|
|
9
|
-
const shared_1 = require("./shared");
|
|
10
|
-
const error_1 = require("../../../utils/error");
|
|
11
|
-
const output_1 = require("../../../utils/output");
|
|
12
|
-
/**
|
|
13
|
-
* miaoda registry add <name...> [--overwrite] [--dry-run] [--dir <path>] [--version <ver>]
|
|
14
|
-
*
|
|
15
|
-
* 解析 USAGE 块 Depends 传递闭包,把每个条目对应的 SDK 文件从 registry 包根的 <relPath>
|
|
16
|
-
* **保留相对路径**拷到项目根(--dir 指定目录的根)。
|
|
17
|
-
* skip-by-disk:目标已存在默认跳过,--overwrite 才覆盖。不写任何安装记账文件。
|
|
18
|
-
*/
|
|
19
|
-
async function handleRegistryAdd(opts) {
|
|
20
|
-
await Promise.resolve();
|
|
21
|
-
if (opts.names.length === 0) {
|
|
22
|
-
throw new error_1.AppError('ARGS_INVALID', 'registry add 至少需要一个条目名');
|
|
23
|
-
}
|
|
24
|
-
const targetDir = node_path_1.default.resolve(opts.dir ?? process.cwd());
|
|
25
|
-
const stack = (0, shared_1.resolveRegistryStack)(targetDir);
|
|
26
|
-
const reg = (0, index_1.loadRegistry)({ stack, version: opts.version });
|
|
27
|
-
try {
|
|
28
|
-
const plan = (0, index_1.planAdd)({
|
|
29
|
-
entries: reg.entries,
|
|
30
|
-
targetDir,
|
|
31
|
-
names: opts.names,
|
|
32
|
-
});
|
|
33
|
-
const result = (0, index_1.applyAdd)(plan.files, {
|
|
34
|
-
overwrite: opts.overwrite === true,
|
|
35
|
-
dryRun: opts.dryRun === true,
|
|
36
|
-
});
|
|
37
|
-
// entries:**只列用户请求的条目**(opts.names 命中的),给它们的 usage / dependsOn,
|
|
38
|
-
// 让 Agent add 完直接拿到用法、无需再 `registry list`。被 Depends 传递拉进来的依赖是
|
|
39
|
-
// "管道"(照常在 added/skipped 里落地),不占 usage 位。请求的条目即使已存在被 skip
|
|
40
|
-
// 也回带 usage(status=skipped,Agent 借此判断磁盘上是 registry 版还是自己改过的旧版)。
|
|
41
|
-
const requestedRelPaths = new Set();
|
|
42
|
-
for (const token of opts.names) {
|
|
43
|
-
for (const e of plan.entries) {
|
|
44
|
-
if ((0, index_1.tokenMatches)(e, token))
|
|
45
|
-
requestedRelPaths.add(e.relPath);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
// relPath → 落地的 PlannedFile(拿 dest / 落地状态)
|
|
49
|
-
const fileByRelPath = new Map(plan.files.map((f) => [f.srcRelPath, f]));
|
|
50
|
-
const addedSet = new Set(result.added);
|
|
51
|
-
const skippedSet = new Set(result.skipped);
|
|
52
|
-
const entries = plan.entries
|
|
53
|
-
.filter((e) => requestedRelPaths.has(e.relPath))
|
|
54
|
-
.map((e) => {
|
|
55
|
-
const f = fileByRelPath.get(e.relPath);
|
|
56
|
-
const dest = f?.dest ?? e.relPath.split('/').pop() ?? e.relPath;
|
|
57
|
-
const status = skippedSet.has(dest) && !addedSet.has(dest) ? 'skipped' : 'added';
|
|
58
|
-
return {
|
|
59
|
-
name: e.name,
|
|
60
|
-
file: e.relPath,
|
|
61
|
-
dest,
|
|
62
|
-
status,
|
|
63
|
-
usage: e.usage,
|
|
64
|
-
dependsOn: e.dependsOn,
|
|
65
|
-
};
|
|
66
|
-
});
|
|
67
|
-
// 只透出对 add 完的 Agent 可操作的字段:项目里实际多了什么(added)、什么没动(skipped)、
|
|
68
|
-
// 请求条目怎么用(entries)。requested(纯回显)、resolved(包内诊断路径)不透出。
|
|
69
|
-
const data = {
|
|
70
|
-
registryVersion: reg.version,
|
|
71
|
-
added: result.added,
|
|
72
|
-
skipped: result.skipped,
|
|
73
|
-
dryRun: opts.dryRun === true,
|
|
74
|
-
entries,
|
|
75
|
-
};
|
|
76
|
-
if ((0, output_1.isJsonMode)()) {
|
|
77
|
-
(0, output_1.emit)({ data });
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
// pretty 是 Agent 不加 --json 时的默认载荷,也要对 AI 友好:信息量与 JSON 对齐,
|
|
81
|
-
// 但换成稳定 label + 逗号列表(无 JSON 数组、无 TTY 截断、空/默认值不打印),
|
|
82
|
-
// summary 在前、各请求条目的 USAGE 块原文在后。整体走一次纯字符串 emit(不进 key-value 渲染)。
|
|
83
|
-
const summaryLines = [`registry@${reg.version}`];
|
|
84
|
-
if (opts.dryRun === true)
|
|
85
|
-
summaryLines.push('dry-run: true (no files written)');
|
|
86
|
-
if (result.added.length > 0)
|
|
87
|
-
summaryLines.push(`added: ${result.added.join(', ')}`);
|
|
88
|
-
if (result.skipped.length > 0)
|
|
89
|
-
summaryLines.push(`skipped: ${result.skipped.join(', ')}`);
|
|
90
|
-
const blocks = entries.filter((e) => e.usage !== '').map((e) => `# ${e.dest}\n${e.usage}`);
|
|
91
|
-
const parts = [summaryLines.join('\n'), ...blocks];
|
|
92
|
-
(0, output_1.emit)(parts.join('\n\n'));
|
|
93
|
-
}
|
|
94
|
-
finally {
|
|
95
|
-
reg.cleanup();
|
|
96
|
-
}
|
|
97
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handleRegistryAdd = exports.handleRegistryList = void 0;
|
|
4
|
-
var list_1 = require("./list");
|
|
5
|
-
Object.defineProperty(exports, "handleRegistryList", { enumerable: true, get: function () { return list_1.handleRegistryList; } });
|
|
6
|
-
var add_1 = require("./add");
|
|
7
|
-
Object.defineProperty(exports, "handleRegistryAdd", { enumerable: true, get: function () { return add_1.handleRegistryAdd; } });
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.handleRegistryList = handleRegistryList;
|
|
7
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
-
const index_1 = require("../../../services/registry/index");
|
|
9
|
-
const shared_1 = require("./shared");
|
|
10
|
-
const output_1 = require("../../../utils/output");
|
|
11
|
-
/**
|
|
12
|
-
* miaoda registry list [--dir <path>] [--version <ver>]
|
|
13
|
-
*
|
|
14
|
-
* 从 .spark/meta.json 读 stack → runtime → 包名,拉对应 registry 包,从包根递归扫含 USAGE 块的 SDK 文件。
|
|
15
|
-
*
|
|
16
|
-
* - 默认(pretty):输出各条目 USAGE 块原文,带文件名分隔,给 Agent 直接读注释。
|
|
17
|
-
* - --json:输出 [{name, file, usage(原文字符串), dependsOn[]}],usage 保持原文不解析成字段。
|
|
18
|
-
* file 是相对包根的路径(如 scripts/deck-stage.js),即 add 后的落地相对路径。
|
|
19
|
-
*/
|
|
20
|
-
async function handleRegistryList(opts) {
|
|
21
|
-
await Promise.resolve();
|
|
22
|
-
const targetDir = node_path_1.default.resolve(opts.dir ?? process.cwd());
|
|
23
|
-
const stack = (0, shared_1.resolveRegistryStack)(targetDir);
|
|
24
|
-
const reg = (0, index_1.loadRegistry)({ stack, version: opts.version });
|
|
25
|
-
try {
|
|
26
|
-
if ((0, output_1.isJsonMode)()) {
|
|
27
|
-
(0, output_1.emit)({
|
|
28
|
-
data: reg.entries.map((e) => ({
|
|
29
|
-
name: e.name,
|
|
30
|
-
file: e.relPath,
|
|
31
|
-
usage: e.usage,
|
|
32
|
-
dependsOn: e.dependsOn,
|
|
33
|
-
})),
|
|
34
|
-
});
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
// pretty:各条目 USAGE 块原文拼接,带文件路径分隔(让 Agent 直接读注释)
|
|
38
|
-
if (reg.entries.length === 0) {
|
|
39
|
-
(0, output_1.emit)('(no registry entries)');
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const blocks = reg.entries.map((e) => `# ${e.relPath}\n${e.usage}`);
|
|
43
|
-
(0, output_1.emit)(blocks.join('\n\n'));
|
|
44
|
-
}
|
|
45
|
-
finally {
|
|
46
|
-
reg.cleanup();
|
|
47
|
-
}
|
|
48
|
-
}
|