@lark-apaas/miaoda-cli 0.1.24-alpha.fb2cf0a → 0.1.24-beta.353f5fa
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/dist/cli/commands/app/index.js +9 -5
- package/dist/cli/handlers/app/init.js +29 -17
- package/dist/cli/handlers/app/sync.js +26 -8
- package/dist/config/migrate-configs/vite-react-to-nestjs-react-fullstack.js +4 -0
- package/dist/services/app/init/index.js +2 -1
- package/dist/services/app/init/template.js +8 -1
- package/dist/services/deploy/modern/pipelines/design-local.js +0 -4
- package/dist/services/deploy/modern/pipelines/local.js +0 -4
- package/package.json +1 -1
|
@@ -96,6 +96,9 @@ function registerAppSync(parent) {
|
|
|
96
96
|
action-plugin postinstall 在 npm install 时缺平台 env 的卡点(需要时再
|
|
97
97
|
FORCE_AUTHN_INNERAPI_DOMAIN=... npm install 手动跑一次)。
|
|
98
98
|
|
|
99
|
+
stack 未纳入 sync 范围(无 SyncConfig 且无 upgrade/templates/<stack>/,如 design-html
|
|
100
|
+
buildless 静态 HTML)→ 跳过同步(no-op, skipped=true),退出码 0,不阻断 dev/启动链路。
|
|
101
|
+
|
|
99
102
|
JSON 输出
|
|
100
103
|
{"data": {"stack": "...",
|
|
101
104
|
"appliedRules": [{"type": "...", "action": "...", "path": "...", "detail": "..."}],
|
|
@@ -103,6 +106,7 @@ JSON 输出
|
|
|
103
106
|
"mergedJsonFiles": [{"path": "...", "keys": [...]}],
|
|
104
107
|
"patchedScripts": [...],
|
|
105
108
|
"upgradedPackages": [{"name": "...", "from": "...", "to": "...", "section": "..."}]}}
|
|
109
|
+
跳过时:{"data": {"stack": "...", "skipped": true, "reason": "stack_not_in_sync_scope", ...空数组}}
|
|
106
110
|
|
|
107
111
|
示例
|
|
108
112
|
$ miaoda app sync
|
|
@@ -193,11 +197,11 @@ function registerAppInit(parent) {
|
|
|
193
197
|
source-path 不存在 → 报错;非 modern_html 传了 source-path → 警告并忽略,继续正常 init。
|
|
194
198
|
app_type 不写入 .spark/meta.json。
|
|
195
199
|
|
|
196
|
-
|
|
197
|
-
init
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
200
|
+
平台同步(不在 init 内做)
|
|
201
|
+
init 不跑 'miaoda app sync' 的任何子动作(SyncRule 应用 / 平台脚本覆盖 / patches /
|
|
202
|
+
升 @lark-apaas/* 到 latest)。渲染出的 scripts/ 等是 template 包发版时的版本,
|
|
203
|
+
package.json 与 template 完全一致。首次同步交给 'miaoda app sync':本地 dev.sh 入口
|
|
204
|
+
起服务前会先跑一次,沙箱 pod 启动阶段平台侧也会做,init 不重复。
|
|
201
205
|
|
|
202
206
|
依赖安装
|
|
203
207
|
默认:npm install --no-audit --no-fund
|
|
@@ -60,11 +60,16 @@ async function handleAppInit(opts) {
|
|
|
60
60
|
const tplResult = (0, index_1.renderTemplate)({ stack, version, targetDir, projectName });
|
|
61
61
|
// source_path 导入:当前仅 app_type=modern_html 生效。渲染完模板后、装依赖前叠加进 src/。
|
|
62
62
|
const sourceImport = applySourcePathImport(opts, targetDir);
|
|
63
|
+
// 本地脚手架门禁:沙箱内所有栈照旧同步(nested,产出 .agent/);本地只有 LOCAL_STEERING_STACKS
|
|
64
|
+
// 白名单栈(nestjs-react-fullstack / vite-react)才落地 steering(.claude/.agents)与 logs/。
|
|
65
|
+
// html / design-html 是纯静态 / 设计产物,本地不需要这套 agent skills 脚手架,整段跳过。
|
|
66
|
+
const sandbox = (0, env_1.isSandboxEnv)();
|
|
67
|
+
const scaffoldSteering = sandbox || index_1.LOCAL_STEERING_STACKS.has(stack);
|
|
63
68
|
// 先建 logs/,防止 user 跑 dev 之前 AI/工具 redirect 到 logs/*.log 因为父目录不存在直接挂
|
|
64
69
|
// (dev.js / dev-local.js 自己也建 logs/,但只在它启动后;启动前的 shell redirect 会先于此)。
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
if (!
|
|
70
|
+
// 仅本地白名单栈需要:沙箱环境由平台 supervisor 拉起 dev,无 init 前的 shell redirect 场景;
|
|
71
|
+
// 非白名单栈本地不落 steering 脚手架,也无需预建 logs/。
|
|
72
|
+
if (!sandbox && scaffoldSteering) {
|
|
68
73
|
(0, logs_dir_1.ensureLogsDir)(targetDir);
|
|
69
74
|
}
|
|
70
75
|
// skills 同步软失败:拉不到 coding-steering 包不该阻断 writeSparkMeta /
|
|
@@ -74,21 +79,28 @@ async function handleAppInit(opts) {
|
|
|
74
79
|
// 跟沙箱端 update-skills.sh 链路对齐
|
|
75
80
|
// - 本地 → flat (.agents/skills + .claude/skills 软链),
|
|
76
81
|
// Agent / Claude Code 用同一份;nrf 在本地是主战场,vite-react 等也一样适用
|
|
77
|
-
const outputLayout =
|
|
78
|
-
|
|
82
|
+
const outputLayout = sandbox ? 'nested' : 'flat';
|
|
83
|
+
// 默认空结果:非白名单栈跳过 steering 同步时(scaffoldSteering=false)直接沿用,
|
|
84
|
+
// 与"拉不到 coding-steering 包"软失败路径共用同一份占位,emit / meta 落盘不受影响。
|
|
85
|
+
let steeringResult = {
|
|
86
|
+
version: 'unknown',
|
|
87
|
+
syncedSkills: [],
|
|
88
|
+
techSynced: false,
|
|
89
|
+
};
|
|
79
90
|
let steeringError;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
if (scaffoldSteering) {
|
|
92
|
+
try {
|
|
93
|
+
steeringResult = (0, coding_steering_1.syncCodingSteering)({
|
|
94
|
+
stack,
|
|
95
|
+
targetDir,
|
|
96
|
+
logPrefix: 'init',
|
|
97
|
+
outputLayout,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
steeringError = err instanceof Error ? err.message : String(err);
|
|
102
|
+
(0, logger_1.log)('init', `⚠ skills sync failed (continuing init): ${steeringError}`);
|
|
103
|
+
}
|
|
92
104
|
}
|
|
93
105
|
// 依赖安装:async 模式留到 meta 落盘后派发后台进程(不等装完),同步模式当场装。
|
|
94
106
|
// 同步:装模板钉死的依赖。不带 <pkg>@latest 位置参数,因此 npm 不会改写 package.json/lockfile
|
|
@@ -54,7 +54,8 @@ const MANAGED_PLATFORM_PACKAGES = {
|
|
|
54
54
|
* 执行流:
|
|
55
55
|
* 1. SyncRule[] 全量 apply —— 来自 src/config/sync-configs/<stack>.ts。每个 stack
|
|
56
56
|
* 自带模板资源在 upgrade/templates/<stack>/templates/。表里没有该 stack 时回退到
|
|
57
|
-
* 旧 platform-sync 兜底(兼容尚未迁移的 stack
|
|
57
|
+
* 旧 platform-sync 兜底(兼容尚未迁移的 stack);两者都识别不了(无 SyncConfig 且无
|
|
58
|
+
* upgrade/templates/<stack>/)→ 跳过同步(no-op, skipped=true),不报错。
|
|
58
59
|
* 2. 平台 deps 指 latest —— user app 已装的 @lark-apaas/* 按 MANAGED_PLATFORM_PACKAGES
|
|
59
60
|
* 白名单改写为 "latest"(紧急止血时表里可填具体版本)。
|
|
60
61
|
* 3. activateGitHooks —— 设置 core.hooksPath(template 自带 .githooks/pre-commit)。
|
|
@@ -71,14 +72,31 @@ async function handleAppSync(opts) {
|
|
|
71
72
|
if (meta.stack === undefined || meta.stack === '') {
|
|
72
73
|
throw new error_1.AppError('SYNC_META_INCOMPLETE', '.spark/meta.json missing stack — run `miaoda app init` first');
|
|
73
74
|
}
|
|
74
|
-
// 1. apply SyncRule[],stack 没注册时回退到旧 platform-sync
|
|
75
|
+
// 1. apply SyncRule[],stack 没注册时回退到旧 platform-sync 兜底
|
|
75
76
|
const syncResults = runStackSync(meta.stack, targetDir, 'sync');
|
|
77
|
+
// stack 未纳入 sync 范围(既无 SyncConfig 也无 upgrade/templates/<stack>/):跳过同步(no-op),
|
|
78
|
+
// 不报错。sync 会在 dev.sh 本地入口 / 沙箱 pod 启动阶段被调用,对不需要 cli 侧 sync 的 stack
|
|
79
|
+
// (如 design-html buildless 静态 HTML)不该阻断启动链路。
|
|
76
80
|
if (!syncResults.stackFound) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
(0, logger_1.log)('sync', `stack '${meta.stack}' 未纳入 sync 范围,跳过同步 (no-op)`);
|
|
82
|
+
if (!(0, output_1.isJsonMode)()) {
|
|
83
|
+
process.stdout.write(`⚠ stack '${meta.stack}' 未纳入 sync 范围,已跳过同步\n`);
|
|
84
|
+
}
|
|
85
|
+
(0, output_1.emit)({
|
|
86
|
+
data: {
|
|
87
|
+
stack: meta.stack,
|
|
88
|
+
skipped: true,
|
|
89
|
+
reason: 'stack_not_in_sync_scope',
|
|
90
|
+
appliedRules: [],
|
|
91
|
+
syncedFiles: [],
|
|
92
|
+
mergedJsonFiles: [],
|
|
93
|
+
patchedScripts: [],
|
|
94
|
+
upgradedPackages: [],
|
|
95
|
+
gitHooks: 'skipped',
|
|
96
|
+
installError: undefined,
|
|
97
|
+
},
|
|
81
98
|
});
|
|
99
|
+
return;
|
|
82
100
|
}
|
|
83
101
|
// 2. activate git hooks(template 自带 .githooks/pre-commit,core.hooksPath 一次性设置)
|
|
84
102
|
const hookActivation = (0, githooks_1.activateGitHooks)(targetDir);
|
|
@@ -138,8 +156,8 @@ exports.handleAppUpgrade = handleAppSync;
|
|
|
138
156
|
* stack 在 STACK_REGISTRY 注册时走新 SyncRule 机制,否则回落到旧 platform-sync。
|
|
139
157
|
*
|
|
140
158
|
* stack 完全不识别(既不在 STACK_REGISTRY 也无 upgrade/templates/<stack>/ 目录)时返回
|
|
141
|
-
* `stackFound: false` 而非抛错 —— 让调用方按场景决定:sync handler
|
|
142
|
-
*
|
|
159
|
+
* `stackFound: false` 而非抛错 —— 让调用方按场景决定:sync handler 跳过同步(no-op),init handler
|
|
160
|
+
* 也允许(fresh init 时 stack 还在加注册的过渡期)。
|
|
143
161
|
*/
|
|
144
162
|
function runStackSync(stack, targetDir, logPrefix) {
|
|
145
163
|
const config = (0, sync_configs_1.getSyncConfig)(stack);
|
|
@@ -263,6 +263,10 @@ exports.MIGRATE_CONFIG = {
|
|
|
263
263
|
'dotenv',
|
|
264
264
|
// client-toolkit:替代 lite,业务代码 codemod 后走它
|
|
265
265
|
'@lark-apaas/client-toolkit',
|
|
266
|
+
// drizzle-orm —— `gen:db-schema` 生成的 server/database/schema.ts 从
|
|
267
|
+
// 'drizzle-orm/pg-core' / 'drizzle-orm' 导入 pgTable / sql 等 runtime API,
|
|
268
|
+
// 缺依赖时 nest build / dev 起来直接 ERR_MODULE_NOT_FOUND。
|
|
269
|
+
'drizzle-orm',
|
|
266
270
|
],
|
|
267
271
|
devDependencies: [
|
|
268
272
|
// nest start / nest build 必需
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ASYNC_INSTALL_LOG = exports.runAsyncInstallWorker = exports.dispatchAsyncInstall = exports.resolveNpmInstallRegistry = exports.installDependencies = exports.writeSparkMeta = exports.readSparkMeta = exports.IMPORT_SKIP_FILES = exports.IMPORT_SKIP_DIRS = exports.importSourceSrc = exports.TEMPLATE_PACKAGE_BY_STACK = exports.STACK_BY_APP_TYPE = exports.APP_TYPES = exports.SUPPORTED_STACKS = exports.resolveStack = exports.renderTemplate = void 0;
|
|
3
|
+
exports.ASYNC_INSTALL_LOG = exports.runAsyncInstallWorker = exports.dispatchAsyncInstall = exports.resolveNpmInstallRegistry = exports.installDependencies = exports.writeSparkMeta = exports.readSparkMeta = exports.IMPORT_SKIP_FILES = exports.IMPORT_SKIP_DIRS = exports.importSourceSrc = exports.TEMPLATE_PACKAGE_BY_STACK = exports.STACK_BY_APP_TYPE = exports.APP_TYPES = exports.LOCAL_STEERING_STACKS = exports.SUPPORTED_STACKS = exports.resolveStack = exports.renderTemplate = void 0;
|
|
4
4
|
var template_1 = require("./template");
|
|
5
5
|
Object.defineProperty(exports, "renderTemplate", { enumerable: true, get: function () { return template_1.renderTemplate; } });
|
|
6
6
|
Object.defineProperty(exports, "resolveStack", { enumerable: true, get: function () { return template_1.resolveStack; } });
|
|
7
7
|
Object.defineProperty(exports, "SUPPORTED_STACKS", { enumerable: true, get: function () { return template_1.SUPPORTED_STACKS; } });
|
|
8
|
+
Object.defineProperty(exports, "LOCAL_STEERING_STACKS", { enumerable: true, get: function () { return template_1.LOCAL_STEERING_STACKS; } });
|
|
8
9
|
Object.defineProperty(exports, "APP_TYPES", { enumerable: true, get: function () { return template_1.APP_TYPES; } });
|
|
9
10
|
Object.defineProperty(exports, "STACK_BY_APP_TYPE", { enumerable: true, get: function () { return template_1.STACK_BY_APP_TYPE; } });
|
|
10
11
|
Object.defineProperty(exports, "TEMPLATE_PACKAGE_BY_STACK", { enumerable: true, get: function () { return template_1.TEMPLATE_PACKAGE_BY_STACK; } });
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.APP_TYPES = exports.STACK_BY_APP_TYPE = exports.SUPPORTED_STACKS = exports.TEMPLATE_PINNED_VERSION_BY_STACK = exports.TEMPLATE_PACKAGE_BY_STACK = void 0;
|
|
6
|
+
exports.APP_TYPES = exports.STACK_BY_APP_TYPE = exports.LOCAL_STEERING_STACKS = exports.SUPPORTED_STACKS = exports.TEMPLATE_PINNED_VERSION_BY_STACK = exports.TEMPLATE_PACKAGE_BY_STACK = void 0;
|
|
7
7
|
exports.resolveStack = resolveStack;
|
|
8
8
|
exports.renderTemplate = renderTemplate;
|
|
9
9
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
@@ -27,6 +27,13 @@ exports.TEMPLATE_PACKAGE_BY_STACK = {
|
|
|
27
27
|
*/
|
|
28
28
|
exports.TEMPLATE_PINNED_VERSION_BY_STACK = {};
|
|
29
29
|
exports.SUPPORTED_STACKS = Object.keys(exports.TEMPLATE_PACKAGE_BY_STACK);
|
|
30
|
+
/**
|
|
31
|
+
* 本地开发(非沙箱)需要落地 agent skills 脚手架(.claude/.agents)与 logs/ 的 stack 白名单。
|
|
32
|
+
* 只有这些全栈 / 前端框架栈在本地才需要 coding-steering 的 skills;html / design-html 是纯
|
|
33
|
+
* 静态 / 设计产物,本地无需这套脚手架,init 直接跳过 syncCodingSteering 与 logs 创建。
|
|
34
|
+
* 沙箱环境不受此白名单约束(所有栈照旧走 nested 同步,产出 .agent/)。
|
|
35
|
+
*/
|
|
36
|
+
exports.LOCAL_STEERING_STACKS = new Set(['nestjs-react-fullstack', 'vite-react']);
|
|
30
37
|
/**
|
|
31
38
|
* app_type(业务类型)→ stack 短名映射。仅在调用方未显式传 --template 时用于解析 stack。
|
|
32
39
|
* 与 src/api/app/types.ts 的 AppType 枚举无关,是独立的业务类型概念。
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.designLocalPublishPipeline = designLocalPublishPipeline;
|
|
4
|
-
const spark_meta_1 = require("../../../../utils/spark-meta");
|
|
5
4
|
const error_1 = require("../../../../utils/error");
|
|
6
5
|
const logger_1 = require("../../../../utils/logger");
|
|
7
6
|
const index_1 = require("../atoms/index");
|
|
@@ -38,9 +37,6 @@ async function designLocalPublishPipeline(opts) {
|
|
|
38
37
|
await (0, index_1.finalizeLocalRelease)(ctx.appId, release.releaseID, index_1.LocalReleaseStatus.Failed);
|
|
39
38
|
throw err;
|
|
40
39
|
}
|
|
41
|
-
if (release.onlineUrl !== undefined && release.onlineUrl !== '') {
|
|
42
|
-
(0, spark_meta_1.writeSparkMeta)(ctx.projectDir, { appUrl: release.onlineUrl });
|
|
43
|
-
}
|
|
44
40
|
(0, logger_1.log)('deploy', 'Deployed successfully');
|
|
45
41
|
return {
|
|
46
42
|
appId: ctx.appId,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.localBuildLocalPublishPipeline = localBuildLocalPublishPipeline;
|
|
4
|
-
const spark_meta_1 = require("../../../../utils/spark-meta");
|
|
5
4
|
const error_1 = require("../../../../utils/error");
|
|
6
5
|
const logger_1 = require("../../../../utils/logger");
|
|
7
6
|
const index_1 = require("../atoms/index");
|
|
@@ -64,9 +63,6 @@ async function localBuildLocalPublishPipeline(opts) {
|
|
|
64
63
|
await (0, index_1.finalizeLocalRelease)(ctx.appId, release.releaseID, index_1.LocalReleaseStatus.Failed);
|
|
65
64
|
throw err;
|
|
66
65
|
}
|
|
67
|
-
if (release.onlineUrl !== undefined && release.onlineUrl !== '') {
|
|
68
|
-
(0, spark_meta_1.writeSparkMeta)(ctx.projectDir, { appUrl: release.onlineUrl });
|
|
69
|
-
}
|
|
70
66
|
(0, logger_1.log)('deploy', 'Deployed successfully');
|
|
71
67
|
return {
|
|
72
68
|
appId: ctx.appId,
|