@lark-apaas/miaoda-cli 0.1.21 → 0.1.22-beta.ad5773e
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 +36 -2
- package/dist/api/comment/api.js +24 -0
- package/dist/api/comment/index.js +6 -0
- package/dist/api/comment/types.js +6 -0
- package/dist/api/deploy/index.js +3 -1
- package/dist/api/deploy/modern-types.js +4 -1
- package/dist/api/deploy/modern.js +8 -0
- package/dist/api/index.js +3 -1
- package/dist/cli/commands/app/index.js +23 -3
- package/dist/cli/commands/comment/index.js +55 -0
- package/dist/cli/commands/deploy/modern.js +34 -0
- package/dist/cli/commands/index.js +19 -0
- package/dist/cli/commands/registry/index.js +114 -0
- package/dist/cli/handlers/app/init.js +36 -13
- package/dist/cli/handlers/comment/index.js +7 -0
- package/dist/cli/handlers/comment/list.js +132 -0
- package/dist/cli/handlers/comment/resolve.js +44 -0
- package/dist/cli/handlers/deploy/index.js +3 -1
- package/dist/cli/handlers/deploy/patch.js +17 -0
- package/dist/cli/handlers/registry/add.js +97 -0
- package/dist/cli/handlers/registry/index.js +7 -0
- package/dist/cli/handlers/registry/list.js +48 -0
- package/dist/cli/handlers/registry/shared.js +25 -0
- package/dist/cli/handlers/skills/sync.js +12 -4
- package/dist/services/app/init/import-source.js +67 -0
- package/dist/services/app/init/index.js +8 -1
- package/dist/services/app/init/template.js +48 -1
- package/dist/services/deploy/modern/atoms/design-build.js +49 -0
- package/dist/services/deploy/modern/atoms/design-upload.js +74 -0
- package/dist/services/deploy/modern/atoms/index.js +6 -1
- package/dist/services/deploy/modern/atoms/tosutil.js +246 -0
- package/dist/services/deploy/modern/atoms/upload.js +4 -127
- package/dist/services/deploy/modern/check.js +28 -16
- package/dist/services/deploy/modern/patch/actions.js +61 -0
- package/dist/services/deploy/modern/patch/content.js +18 -0
- package/dist/services/deploy/modern/patch/index.js +46 -0
- package/dist/services/deploy/modern/patch/routes.js +37 -0
- package/dist/services/deploy/modern/patch/source-scan.js +58 -0
- package/dist/services/deploy/modern/pipelines/design-local.js +56 -0
- package/dist/services/deploy/modern/pipelines/index.js +3 -1
- package/dist/services/deploy/modern/protocol.js +7 -0
- package/dist/services/deploy/modern/run.js +10 -4
- package/dist/services/deploy/modern/template-key-map.js +4 -0
- package/dist/services/registry/index.js +293 -0
- package/dist/utils/http.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,12 +11,17 @@ pnpm add -g @lark-apaas/miaoda-cli
|
|
|
11
11
|
## 使用
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
#
|
|
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,9 +46,38 @@ miaoda file ls --output json
|
|
|
41
46
|
| `miaoda file ...` | 文件操作:上传、下载、元数据、签名下载、批量删除 |
|
|
42
47
|
| `miaoda db ...` | 数据操作:SQL 执行、表结构查询、数据导入导出 |
|
|
43
48
|
| `miaoda observability ...` | 线上日志、链路、前端源码堆栈反查、监控指标、运营指标 |
|
|
49
|
+
| `miaoda comment ...` | 应用评论:查看评论列表、解决评论 |
|
|
50
|
+
| `miaoda registry ...` | 组件 registry:列出 / copy-in design-html SDK 文件(本地执行) |
|
|
44
51
|
|
|
45
52
|
完整命令通过 `miaoda --help` 或 `miaoda <domain> --help` 查看。
|
|
46
53
|
|
|
54
|
+
## 组件 registry(design-html)
|
|
55
|
+
|
|
56
|
+
`miaoda registry` 为 design-html 技术栈提供 shadcn 式的「组件 registry」:把 SDK 文件**拷进**当前项目(copy-in),而非作为依赖安装。registry 是独立 npm 包,按运行时分发(design-html → buildless runtime → `@lark-apaas/coding-registry-buildless`)。
|
|
57
|
+
|
|
58
|
+
前置:当前目录(或 `--dir`)已走过 `miaoda app init`,`.spark/meta.json` 含 `stack=design-html`。
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# 列出可用 SDK 条目(输出各文件 USAGE 注释块原文,便于 Agent 直接读用法)
|
|
62
|
+
miaoda registry list
|
|
63
|
+
miaoda registry list --json
|
|
64
|
+
|
|
65
|
+
# 把条目 copy-in 到当前项目(自动按 USAGE 块的 Depends 解析依赖闭包一并拷入)
|
|
66
|
+
miaoda registry add deck-slide
|
|
67
|
+
miaoda registry add foo.css theme --dry-run # 只报告将写 / 将跳,不落盘
|
|
68
|
+
miaoda registry add deck-slide --overwrite # 目标已存在时覆盖(默认跳过以保护改动)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
要点:
|
|
72
|
+
|
|
73
|
+
- **条目**:registry 包根 `components/` · `scripts/` · `stylesheets/` 三个顶层目录(任意深度)下的代码文件即条目。USAGE 注释块**可选**(有则提供描述 + Depends,无则空描述、无依赖);包根直放文件、其它目录、非代码文件都不算条目。
|
|
74
|
+
- **寻址**:`add` / `Depends` 的 token 可写三种形式 —— `name`(去扩展名,如 `foo`)/ 完整文件名(如 `foo.css`)/ relPath(如 `stylesheets/foo.css`)。`name` **不要求唯一**,`list --json` 的 `file`(relPath)是永远无歧义的 canonical 地址。
|
|
75
|
+
- **多匹配全拉**:token 命中多个同名条目时全部 copy-in(如 `add foo` 把 `foo.jsx` + `foo.css` 一起拉),想只要其一就用完整文件名或 relPath。
|
|
76
|
+
- **拍平落地**:所有文件**拍平**到项目根(`scripts/deck-slide.js` → 项目 `deck-slide.js`,不保留子目录);闭包内同名 basename 撞车时后者覆盖前者。
|
|
77
|
+
- **skip-by-disk**:项目已有同名(拍平后的 basename)文件默认跳过,`--overwrite` 才覆盖;不写任何安装记账文件,项目文件树即状态。
|
|
78
|
+
- **add 回执带 usage**:`add` 结果的 `entries` 只列**你请求的条目**(不含被 `Depends` 传递拉进来的依赖——依赖照常落地在 `added`/`skipped`,但那是"管道"),逐条给出 `usage`(USAGE 块原文)与 `dependsOn`,Agent `add` 完即可直接读用法,无需再 `registry list`。请求的条目即使已存在被跳过也回带 usage(`status` 标 `added`/`skipped`,据此判断磁盘上是 registry 版还是你改过的旧版)。`--json` 结构为 `{registryVersion, added, skipped, dryRun, entries}`;pretty(默认)输出 `registry@<ver>` + `added:`/`skipped:` 逗号列表 + 各请求条目的 USAGE 块,稳定 label、无 JSON 数组、无截断,对 Agent 与人同样可读。
|
|
79
|
+
- `--version <ver>` 指定 registry 包版本或 dist-tag(缺省 `latest`),`--dir <path>` 指定项目目录(缺省当前目录)。
|
|
80
|
+
|
|
47
81
|
## 全局参数
|
|
48
82
|
|
|
49
83
|
- `--json [fields]`:输出结构化 JSON,可选字段级选择(如 `--json id,name`)。
|
|
@@ -55,7 +89,7 @@ miaoda file ls --output json
|
|
|
55
89
|
## 环境变量
|
|
56
90
|
|
|
57
91
|
- `MIAODA_APP_ID`:默认应用 ID,等价于 `--app-id`。
|
|
58
|
-
- `MIAODA_CANARY_HEADER`:HTTP 请求的 `x-tt-env` 小流量头取值。未设置时默认 `
|
|
92
|
+
- `MIAODA_CANARY_HEADER`:HTTP 请求的 `x-tt-env` 小流量头取值。未设置时默认 `boe_miaoda_ccm`;设为空字符串则不带该头(例:`export MIAODA_CANARY_HEADER=boe_xxx`)。值形如 `ppe_xxx` 时额外带上 `x-use-ppe: 1`。
|
|
59
93
|
|
|
60
94
|
## 输出契约
|
|
61
95
|
|
|
@@ -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.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
|
+
}
|
|
@@ -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; } });
|
package/dist/api/deploy/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NodeStatus = exports.nodeStatusFromText = exports.nodeStatusText = exports.errorJobSchema = exports.deployGetSchema = exports.deployHistorySchema = exports.batchSavePluginInstances = exports.LocalReleaseStatus = exports.getModernLastPublishedVersion = exports.getModernReleaseStatus = exports.createModernRelease = exports.callbackStatic = exports.updateLocalRelease = exports.createLocalRelease = exports.preRelease = exports.queryPipelineInstance = exports.getErrorLog = exports.listPipelineInstances = exports.createRelease = void 0;
|
|
3
|
+
exports.NodeStatus = exports.nodeStatusFromText = exports.nodeStatusText = exports.errorJobSchema = exports.deployGetSchema = exports.deployHistorySchema = exports.batchSavePluginInstances = exports.TosActionType = exports.LocalReleaseStatus = exports.applyTosDiff = exports.getModernLastPublishedVersion = exports.getModernReleaseStatus = exports.createModernRelease = exports.callbackStatic = exports.updateLocalRelease = exports.createLocalRelease = exports.preRelease = exports.queryPipelineInstance = exports.getErrorLog = exports.listPipelineInstances = exports.createRelease = void 0;
|
|
4
4
|
var api_1 = require("./api");
|
|
5
5
|
Object.defineProperty(exports, "createRelease", { enumerable: true, get: function () { return api_1.createRelease; } });
|
|
6
6
|
Object.defineProperty(exports, "listPipelineInstances", { enumerable: true, get: function () { return api_1.listPipelineInstances; } });
|
|
@@ -14,8 +14,10 @@ Object.defineProperty(exports, "callbackStatic", { enumerable: true, get: functi
|
|
|
14
14
|
Object.defineProperty(exports, "createModernRelease", { enumerable: true, get: function () { return modern_1.createRelease; } });
|
|
15
15
|
Object.defineProperty(exports, "getModernReleaseStatus", { enumerable: true, get: function () { return modern_1.getReleaseStatus; } });
|
|
16
16
|
Object.defineProperty(exports, "getModernLastPublishedVersion", { enumerable: true, get: function () { return modern_1.getLastPublishedVersion; } });
|
|
17
|
+
Object.defineProperty(exports, "applyTosDiff", { enumerable: true, get: function () { return modern_1.applyTosDiff; } });
|
|
17
18
|
var modern_types_1 = require("./modern-types");
|
|
18
19
|
Object.defineProperty(exports, "LocalReleaseStatus", { enumerable: true, get: function () { return modern_types_1.LocalReleaseStatus; } });
|
|
20
|
+
Object.defineProperty(exports, "TosActionType", { enumerable: true, get: function () { return modern_types_1.TosActionType; } });
|
|
19
21
|
var plugin_instances_1 = require("./plugin-instances");
|
|
20
22
|
Object.defineProperty(exports, "batchSavePluginInstances", { enumerable: true, get: function () { return plugin_instances_1.batchSavePluginInstances; } });
|
|
21
23
|
var schemas_1 = require("./schemas");
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
//
|
|
9
9
|
// 远端部署链路(B/C)所需的 release 接口先预留类型骨架,待 B/C 落地时启用。
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.LocalReleaseStatus = void 0;
|
|
11
|
+
exports.TosActionType = exports.LocalReleaseStatus = void 0;
|
|
12
12
|
/**
|
|
13
13
|
* localPublish 状态枚举(数值,与服务端 IDL 对齐)。
|
|
14
14
|
* CLI updateLocalRelease 只翻 Finished / Failed 两个终态;其它由后端流转。
|
|
@@ -21,3 +21,6 @@ exports.LocalReleaseStatus = {
|
|
|
21
21
|
Canceled: 4,
|
|
22
22
|
Rollback: 5,
|
|
23
23
|
};
|
|
24
|
+
// ── applyTosDiff(design-html 增量发布;后端应用 TOS diff) ──
|
|
25
|
+
/** 对齐 IDL publish.TosActionType(UNSPECIFIED=0 不用) */
|
|
26
|
+
exports.TosActionType = { CREATE: 1, UPDATE: 2, DELETE: 3 };
|
|
@@ -17,6 +17,7 @@ exports.callbackStatic = callbackStatic;
|
|
|
17
17
|
exports.createRelease = createRelease;
|
|
18
18
|
exports.getReleaseStatus = getReleaseStatus;
|
|
19
19
|
exports.getLastPublishedVersion = getLastPublishedVersion;
|
|
20
|
+
exports.applyTosDiff = applyTosDiff;
|
|
20
21
|
const http_1 = require("../../utils/http");
|
|
21
22
|
const devops_error_1 = require("../../utils/devops-error");
|
|
22
23
|
const DEFAULT_ERR_CODE = 'INTERNAL_DEVOPS_ERROR';
|
|
@@ -76,3 +77,10 @@ async function getLastPublishedVersion(req) {
|
|
|
76
77
|
const url = `/v1/devops/app/${encodeURIComponent(appID)}/last_published_version`;
|
|
77
78
|
return (0, http_1.postInnerApi)(url, {}, envelopeOpts('Failed to get last published version'));
|
|
78
79
|
}
|
|
80
|
+
// ── applyTosDiff ──
|
|
81
|
+
/** POST /v1/devops/app/:appID/apply_tos_diff —— 增量应用 TOS 文件 diff */
|
|
82
|
+
async function applyTosDiff(req) {
|
|
83
|
+
const { appID, ...body } = req;
|
|
84
|
+
const url = `/v1/devops/app/${encodeURIComponent(appID)}/apply_tos_diff`;
|
|
85
|
+
return (0, http_1.postInnerApi)(url, body, envelopeOpts('Failed to apply tos diff'));
|
|
86
|
+
}
|
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 };
|
|
@@ -164,7 +164,9 @@ function registerAppInit(parent) {
|
|
|
164
164
|
.command('init')
|
|
165
165
|
.description('初始化应用代码:抓 template 渲染、同步 upgrade/templates、装 .agent/steering/ skills、写 .spark/meta.json。.spark/meta.json 已存在则直接退出')
|
|
166
166
|
.option('--template <stack>', `技术栈短名(${index_1.SUPPORTED_STACKS.join(' / ')})`)
|
|
167
|
-
.option('--
|
|
167
|
+
.option('--app-type <type>', 'aPaaS 业务类型(html / modern_html / jspage / full_stack);未传 --template 时用于解析技术栈')
|
|
168
|
+
.option('--source-path <path>', '导入源目录:把该目录内容聚合进脚手架 src/(当前仅 --app-type modern_html 生效)')
|
|
169
|
+
.option('--conf [json]', 'init 配置 JSON。支持 {"version": "<template 版本>"},默认 latest')
|
|
168
170
|
.option('--skip-install', '跳过依赖安装', false)
|
|
169
171
|
.option('--async-install', '派发后台进程装依赖并立即返回(与 --skip-install 互斥)', false)
|
|
170
172
|
.addOption((0, shared_1.appIdOption)())
|
|
@@ -180,6 +182,17 @@ function registerAppInit(parent) {
|
|
|
180
182
|
未提供则不写。运行端命令(deploy / file / plugin 等)仍优先读 MIAODA_APP_ID env,
|
|
181
183
|
env 未设置时回退到 meta.json.app_id。
|
|
182
184
|
|
|
185
|
+
技术栈解析(--template / --app-type)
|
|
186
|
+
--template 传了 → 直接用(vite-react / html / nestjs-react-fullstack)
|
|
187
|
+
否则 --app-type 传了 → 查表:html→html, modern_html→html, jspage→vite-react, full_stack→nestjs-react-fullstack
|
|
188
|
+
两者都没传 → 报错 ARGS_INVALID
|
|
189
|
+
|
|
190
|
+
源码导入(--source-path)
|
|
191
|
+
仅 --app-type modern_html 生效:把 <source-path> 整个目录递归聚合进 src/(同名覆盖,叠加保留)。
|
|
192
|
+
过滤:跳过 node_modules/.git/dist/build 目录,跳过 .env/.env.*/.DS_Store/.npmrc/package.json/lockfiles。
|
|
193
|
+
source-path 不存在 → 报错;非 modern_html 传了 source-path → 警告并忽略,继续正常 init。
|
|
194
|
+
app_type 不写入 .spark/meta.json。
|
|
195
|
+
|
|
183
196
|
平台同步(upgrade/templates)
|
|
184
197
|
init 内嵌一次 upgrade/templates 同步(跟 app upgrade 共用同一份 util):
|
|
185
198
|
从 miaoda-cli 自带的 upgrade/templates/<stack>/ 同步 files/(覆盖)+ patches/
|
|
@@ -208,7 +221,8 @@ function registerAppInit(parent) {
|
|
|
208
221
|
JSON 输出
|
|
209
222
|
已初始化:{"data": {"initialized": false, "reason": "already_initialized", "targetDir": "..."}}
|
|
210
223
|
新初始化:{"data": {"initialized": true, "template": "...", "templateVersion": "...", "steeringVersion": "...",
|
|
211
|
-
"appId": "...", "
|
|
224
|
+
"appId": "...", "appType": "modern_html", "sourceImported": true, "importedFileCount": 7,
|
|
225
|
+
"platformStackFound": true, "platformSyncedFiles": [...],
|
|
212
226
|
"installed": true, "installSource": "cache|npm|skipped", "installHash": "...", ...}}
|
|
213
227
|
async 模式:{"data": {"initialized": true, "asyncInstall": true, "installed": false,
|
|
214
228
|
"installSource": "async", "installPid": 123, "installLogPath": "...",
|
|
@@ -220,12 +234,16 @@ JSON 输出
|
|
|
220
234
|
$ miaoda app init --template vite-react --conf '{"version": "0.1.0"}'
|
|
221
235
|
$ miaoda app init --template vite-react --skip-install
|
|
222
236
|
$ miaoda app init --template vite-react --async-install
|
|
237
|
+
$ miaoda app init --app-type full_stack --app-id app_demo_xxx
|
|
238
|
+
$ miaoda app init --app-type modern_html --source-path ./my-assets
|
|
223
239
|
$ MIAODA_DEP_CACHE_DIR=/tmp/dep-cache miaoda app init --template vite-react
|
|
224
240
|
`);
|
|
225
241
|
cmd.action((0, shared_1.withHelp)(cmd, async (rawOpts) => {
|
|
226
242
|
const conf = parseInitConf(rawOpts.conf);
|
|
227
243
|
await (0, index_1.handleAppInit)({
|
|
228
244
|
template: rawOpts.template,
|
|
245
|
+
appType: rawOpts.appType,
|
|
246
|
+
sourcePath: rawOpts.sourcePath,
|
|
229
247
|
conf,
|
|
230
248
|
skipInstall: rawOpts.skipInstall,
|
|
231
249
|
appId: rawOpts.appId,
|
|
@@ -234,7 +252,9 @@ JSON 输出
|
|
|
234
252
|
}));
|
|
235
253
|
}
|
|
236
254
|
function parseInitConf(raw) {
|
|
237
|
-
|
|
255
|
+
// --conf 为可选值:未传(undefined)、裸 --conf(Commander 给 true)、空/纯空白字符串
|
|
256
|
+
// 一律视为不配置,回退默认(latest)。
|
|
257
|
+
if (raw === undefined || typeof raw === 'boolean' || raw.trim() === '')
|
|
238
258
|
return undefined;
|
|
239
259
|
let parsed;
|
|
240
260
|
try {
|
|
@@ -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
|
+
}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.registerDeployCommandsModern = registerDeployCommandsModern;
|
|
4
4
|
const shared_1 = require("../../../cli/commands/shared");
|
|
5
5
|
const modern_1 = require("../../../cli/handlers/deploy/modern");
|
|
6
|
+
const index_1 = require("../../../cli/handlers/deploy/index");
|
|
6
7
|
/**
|
|
7
8
|
* modern scene (MIAODA_APP_TYPE=7) 专用 deploy 注册。
|
|
8
9
|
* 仅披露顶层 `miaoda deploy`,CLI 表面对齐 openclaw-cli:`--dir / --skip-build`。
|
|
@@ -56,4 +57,37 @@ JSON 输出(stdout)
|
|
|
56
57
|
conf: rawOpts.conf,
|
|
57
58
|
});
|
|
58
59
|
}));
|
|
60
|
+
const patchCmd = deployCmd
|
|
61
|
+
.command('patch')
|
|
62
|
+
.description('design-html 增量发布:按文件 create/update/delete,.html 增删时同步 routes.json')
|
|
63
|
+
.option('--create <relpath>', '新增文件(可重复)', shared_1.collectRepeatedOption, [])
|
|
64
|
+
.option('--update <relpath>', '覆盖已有文件(可重复)', shared_1.collectRepeatedOption, [])
|
|
65
|
+
.option('--delete <relpath>', '删除文件(可重复)', shared_1.collectRepeatedOption, [])
|
|
66
|
+
.option('--session-id <id>', '会话 ID,发布时透传给下游(可选)')
|
|
67
|
+
.addHelpText('after', `
|
|
68
|
+
--dir 为项目目录(与 deploy 同名参数,默认当前目录)。
|
|
69
|
+
仅支持 design-html(design_local_deploy)。路径为工程根相对路径(= 服务端 latest 下 key),
|
|
70
|
+
禁绝对路径与 ".."。--create/--update 的本地文件必须存在。.html 被新增/删除(路由集合变化)
|
|
71
|
+
时自动重算并随包更新 routes.json;纯 --update 现有 .html 只改内容,不动 routes.json。
|
|
72
|
+
routes.json 每项为 {path, file}:path 为相对路径(不含 base 前缀,由消费侧拼接),file 为
|
|
73
|
+
对应源文件(如 / → index.html)。
|
|
74
|
+
|
|
75
|
+
JSON 输出
|
|
76
|
+
{"data": {"upsertCount": <n>, "deleteCount": <n>, "actionsSent": <n>, "routesRegenerated": <bool>}}
|
|
77
|
+
|
|
78
|
+
示例
|
|
79
|
+
$ miaoda deploy patch --update index.html
|
|
80
|
+
$ miaoda deploy patch --create blog/post.html --delete blog/old.html
|
|
81
|
+
$ miaoda deploy patch --update assets/app.js --update assets/app.css
|
|
82
|
+
`);
|
|
83
|
+
patchCmd.action((0, shared_1.withHelp)(patchCmd, async (rawOpts) => {
|
|
84
|
+
await (0, index_1.handleDeployPatch)({
|
|
85
|
+
appId: (0, shared_1.resolveAppId)({}),
|
|
86
|
+
dir: deployCmd.opts().dir ?? '.',
|
|
87
|
+
creates: rawOpts.create,
|
|
88
|
+
updates: rawOpts.update,
|
|
89
|
+
deletes: rawOpts.delete,
|
|
90
|
+
sessionId: rawOpts.sessionId,
|
|
91
|
+
});
|
|
92
|
+
}));
|
|
59
93
|
}
|
|
@@ -9,11 +9,14 @@ 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/comment/index");
|
|
13
|
+
const index_8 = require("../../cli/commands/registry/index");
|
|
12
14
|
// scene 跟 dispatcher(MIAODA_APP_TYPE)同语义层级 —— app 业务类型维度,
|
|
13
15
|
// 对齐后端 devops app_common.AppType 枚举:
|
|
14
16
|
// 3 = AppType_APPLICATION(全栈应用,当前仅 nestjs-react-fullstack 一个 stack)
|
|
15
17
|
// 4 = AppType_DESIGN(design-stack,SSR 渲染、无业务逻辑、无数据库)
|
|
16
18
|
// 7 = miaoda-cli 自定义 modern 占位(后端枚举无 7,沙箱目前不传)
|
|
19
|
+
// 8 = AppType_DESIGN_HTML(design-html,buildless 静态 HTML,命令集同 modern)
|
|
17
20
|
// 其它(0/1/2/5/6 / 未设)→ default(命令全开,本地 dev / CI / 兼容回退)
|
|
18
21
|
// stack 维度(nestjs-react-fullstack / vite-react / ...)是正交的,
|
|
19
22
|
// skills sync 内部按 .spark/meta.json.stack 拉对应 coding-steering/steering/<stack>/ 子目录。
|
|
@@ -24,6 +27,8 @@ function resolveScene(appType, _archType) {
|
|
|
24
27
|
return 'application';
|
|
25
28
|
if (appType === '4')
|
|
26
29
|
return 'design';
|
|
30
|
+
if (appType === '8')
|
|
31
|
+
return 'design-html';
|
|
27
32
|
return 'default';
|
|
28
33
|
}
|
|
29
34
|
const SCENE_REGISTRARS = {
|
|
@@ -37,11 +42,13 @@ const SCENE_REGISTRARS = {
|
|
|
37
42
|
(0, index_1.registerFileCommands)(p);
|
|
38
43
|
(0, index_3.registerObservabilityCommands)(p);
|
|
39
44
|
(0, index_6.registerSkillsCommands)(p);
|
|
45
|
+
(0, index_7.registerCommentCommands)(p);
|
|
40
46
|
},
|
|
41
47
|
modern: (p) => {
|
|
42
48
|
(0, index_4.registerAppCommands)(p, { includeInit: true });
|
|
43
49
|
(0, modern_1.registerDeployCommandsModern)(p);
|
|
44
50
|
(0, index_6.registerSkillsCommands)(p);
|
|
51
|
+
(0, index_7.registerCommentCommands)(p);
|
|
45
52
|
},
|
|
46
53
|
// application scene(AppType_APPLICATION=3):
|
|
47
54
|
// 在 default 命令集基础上加 skills(按 meta.json.stack 拉对应 stack 技能)
|
|
@@ -53,6 +60,7 @@ const SCENE_REGISTRARS = {
|
|
|
53
60
|
(0, index_1.registerFileCommands)(p);
|
|
54
61
|
(0, index_3.registerObservabilityCommands)(p);
|
|
55
62
|
(0, index_6.registerSkillsCommands)(p);
|
|
63
|
+
(0, index_7.registerCommentCommands)(p);
|
|
56
64
|
},
|
|
57
65
|
// design scene(AppType_DESIGN=4):design-stack 仅 SSR 渲染、无后端业务逻辑、
|
|
58
66
|
// 无数据库、无 UGC 文件。命令集裁掉 db / file,保留 deploy / observability / app(init) / skills。
|
|
@@ -61,6 +69,17 @@ const SCENE_REGISTRARS = {
|
|
|
61
69
|
(0, index_5.registerDeployCommands)(p);
|
|
62
70
|
(0, index_3.registerObservabilityCommands)(p);
|
|
63
71
|
(0, index_6.registerSkillsCommands)(p);
|
|
72
|
+
(0, index_7.registerCommentCommands)(p);
|
|
73
|
+
},
|
|
74
|
+
// design-html scene(AppType_DESIGN_HTML=8):buildless 静态 HTML,
|
|
75
|
+
// 命令集与 modern 一致(app init/sync + modern 拆分版 deploy + skills),不挂 db/file/observability。
|
|
76
|
+
// 额外挂 registry(shadcn 式 copy-in SDK,design-html scene 专属)。
|
|
77
|
+
'design-html': (p) => {
|
|
78
|
+
(0, index_4.registerAppCommands)(p, { includeInit: true });
|
|
79
|
+
(0, modern_1.registerDeployCommandsModern)(p);
|
|
80
|
+
(0, index_6.registerSkillsCommands)(p);
|
|
81
|
+
(0, index_8.registerRegistryCommands)(p);
|
|
82
|
+
(0, index_7.registerCommentCommands)(p);
|
|
64
83
|
},
|
|
65
84
|
};
|
|
66
85
|
function readEnv(name) {
|
|
@@ -0,0 +1,114 @@
|
|
|
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
|
+
}
|
|
@@ -51,26 +51,22 @@ async function handleAppInit(opts) {
|
|
|
51
51
|
});
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
const stack = opts.template;
|
|
55
|
-
if (!stack) {
|
|
56
|
-
throw new error_1.AppError('ARGS_INVALID', '缺少 --template <stack>', {
|
|
57
|
-
next_actions: [`可用 stack:${index_1.SUPPORTED_STACKS.join(', ')}`],
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
if (!index_1.SUPPORTED_STACKS.includes(stack)) {
|
|
61
|
-
throw new error_1.AppError('ARGS_INVALID', `不支持的 template: ${stack}`, {
|
|
62
|
-
next_actions: [`可用 stack:${index_1.SUPPORTED_STACKS.join(', ')}`],
|
|
63
|
-
});
|
|
64
|
-
}
|
|
54
|
+
const stack = (0, index_1.resolveStack)({ template: opts.template, appType: opts.appType });
|
|
65
55
|
if (opts.asyncInstall && opts.skipInstall) {
|
|
66
56
|
throw new error_1.AppError('ARGS_INVALID', '--async-install 与 --skip-install 互斥');
|
|
67
57
|
}
|
|
68
58
|
const version = opts.conf?.version;
|
|
69
59
|
const projectName = node_path_1.default.basename(targetDir);
|
|
70
60
|
const tplResult = (0, index_1.renderTemplate)({ stack, version, targetDir, projectName });
|
|
61
|
+
// source_path 导入:当前仅 app_type=modern_html 生效。渲染完模板后、装依赖前叠加进 src/。
|
|
62
|
+
const sourceImport = applySourcePathImport(opts, targetDir);
|
|
71
63
|
// 先建 logs/,防止 user 跑 dev 之前 AI/工具 redirect 到 logs/*.log 因为父目录不存在直接挂
|
|
72
|
-
// (dev.js / dev-local.js 自己也建 logs/,但只在它启动后;启动前的 shell redirect 会先于此)
|
|
73
|
-
|
|
64
|
+
// (dev.js / dev-local.js 自己也建 logs/,但只在它启动后;启动前的 shell redirect 会先于此)。
|
|
65
|
+
// 仅本地开发需要:沙箱环境由平台 supervisor 拉起 dev,无 init 前的 shell redirect 场景,
|
|
66
|
+
// 不预建 logs/ 以免在沙箱工作区留空目录。
|
|
67
|
+
if (!(0, env_1.isSandboxEnv)()) {
|
|
68
|
+
(0, logs_dir_1.ensureLogsDir)(targetDir);
|
|
69
|
+
}
|
|
74
70
|
// skills 同步软失败:拉不到 coding-steering 包不该阻断 writeSparkMeta /
|
|
75
71
|
// activateGitHooks(之前会让 .spark/meta.json 没写,下次 init 半渲染状态又得重跑全套)。
|
|
76
72
|
// 按运行环境(isSandboxEnv:MIAODA_DEP_CACHE_DIR 非空)分流 outputLayout,不绑 stack:
|
|
@@ -135,6 +131,11 @@ async function handleAppInit(opts) {
|
|
|
135
131
|
steeringVersion: steeringResult.version,
|
|
136
132
|
archType: tplResult.archType,
|
|
137
133
|
appId: opts.appId,
|
|
134
|
+
appType: opts.appType,
|
|
135
|
+
sourcePath: opts.sourcePath,
|
|
136
|
+
sourceImported: sourceImport.sourceImported,
|
|
137
|
+
importedFileCount: sourceImport.importedFileCount,
|
|
138
|
+
sourceIgnoredReason: sourceImport.sourceIgnoredReason,
|
|
138
139
|
syncedSkills: steeringResult.syncedSkills,
|
|
139
140
|
techSynced: steeringResult.techSynced,
|
|
140
141
|
steeringError,
|
|
@@ -159,3 +160,25 @@ async function handleAppInit(opts) {
|
|
|
159
160
|
},
|
|
160
161
|
});
|
|
161
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* 处理 --source-path 导入:当前仅 app_type=modern_html 生效。
|
|
165
|
+
* - 未传 source_path → 什么都不做
|
|
166
|
+
* - modern_html → 调 importSourceSrc 把源目录聚合进 targetDir/src/
|
|
167
|
+
* - 传了 source_path 但非 modern_html → 警告并忽略,继续正常 init(退出码 0)
|
|
168
|
+
* 终端提示留在 handler 层(service 不做终端输出)。
|
|
169
|
+
*/
|
|
170
|
+
function applySourcePathImport(opts, targetDir) {
|
|
171
|
+
// 真值判断:未传或空串都视为"无 source_path"。
|
|
172
|
+
if (!opts.sourcePath) {
|
|
173
|
+
return { sourceImported: false };
|
|
174
|
+
}
|
|
175
|
+
if (opts.appType === 'modern_html') {
|
|
176
|
+
const { importedFileCount } = (0, index_1.importSourceSrc)({ sourcePath: opts.sourcePath, targetDir });
|
|
177
|
+
return { sourceImported: true, importedFileCount };
|
|
178
|
+
}
|
|
179
|
+
(0, logger_1.log)('init', '⚠ source-path ignored: 仅 app_type=modern_html 支持 source_path 导入');
|
|
180
|
+
if (!(0, output_1.isJsonMode)()) {
|
|
181
|
+
process.stdout.write('⚠ 不支持 source_path(仅 app_type=modern_html 生效),已忽略\n');
|
|
182
|
+
}
|
|
183
|
+
return { sourceImported: false, sourceIgnoredReason: 'not_modern_html' };
|
|
184
|
+
}
|
|
@@ -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; } });
|