@lark-apaas/miaoda-cli 0.1.14 → 0.1.15

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.
@@ -10,7 +10,6 @@ const index_1 = require("../../../services/app/init/index");
10
10
  const coding_steering_1 = require("../../../utils/coding-steering");
11
11
  const logger_1 = require("../../../utils/logger");
12
12
  const githooks_1 = require("../../../utils/githooks");
13
- const sync_1 = require("../../../cli/handlers/app/sync");
14
13
  const error_1 = require("../../../utils/error");
15
14
  const output_1 = require("../../../utils/output");
16
15
  /**
@@ -20,14 +19,15 @@ const output_1 = require("../../../utils/output");
20
19
  * {stack, version, archType, app_id?} 写入 .spark/meta.json。--app-id(或 MIAODA_APP_ID)提供时
21
20
  * 持久化 app_id;运行端命令仍优先读 env,未设置时回退到 meta.json。
22
21
  *
23
- * init 不跑 `miaoda app sync`(SyncRule 应用 / 平台脚本覆盖 / patches)。原因:
22
+ * init 不跑 `miaoda app sync` 的任何子动作(SyncRule 应用 / 平台脚本覆盖 / patches /
23
+ * 升管控包到 latest)。原因:
24
24
  * - 本地 `npm run dev` 入口 dev.sh 已经会先跑 `miaoda app sync` 再起服务(看 templates
25
25
  * /scripts/dev.sh),sync 在用户真正用 app 之前必然跑过一次
26
26
  * - 沙箱 pod 启动阶段平台侧也会做同步(dev.sh 注释明文:"脚本同步由平台 pod 启动阶段做过")
27
27
  * - 两条路径都不依赖 init 时的 sync,init 重跑一遍是冗余
28
28
  * 副作用:init 完到首次 dev/sync 之间,user app 的 scripts/ 模板文件是 template 包发版时
29
- * 的版本(没经 sync 覆盖);首次 install 装的也是 template 钉的版本(没升 latest)。dev.sh
30
- * 入口的 sync 会修正这些 drift。
29
+ * 的版本(没经 sync 覆盖);首次 install 装的也是 template 钉的版本(没升 latest),
30
+ * package.json 跟 template 完全一致。dev.sh 入口的 sync 会修正这些 drift。
31
31
  *
32
32
  * 幂等:.spark/meta.json 存在即表示已完整成功一次,直接退出,不重跑任何子步骤。
33
33
  * 半渲染状态(package.json 在但 meta.json 不在)会重新跑完整流程。
@@ -63,10 +63,6 @@ async function handleAppInit(opts) {
63
63
  const version = opts.conf?.version;
64
64
  const projectName = node_path_1.default.basename(targetDir);
65
65
  const tplResult = (0, index_1.renderTemplate)({ stack, version, targetDir, projectName });
66
- // 把 install 前装着的管控包 spec snapshot 一份,等 installDependencies 跑完
67
- // (npm install <pkg>@latest 会自动改写 package.json + 刷 lockfile) 再 snapshot 一次
68
- // diff 出 npm 实际改了哪些 spec → emit data.upgradedPackages 给用户/CI 可观测。
69
- const beforeManagedSpecs = (0, sync_1.snapshotManagedDepSpecs)(targetDir);
70
66
  // skills 同步软失败:拉不到 coding-steering 包不该阻断 writeSparkMeta /
71
67
  // activateGitHooks(之前会让 .spark/meta.json 没写,下次 init 半渲染状态又得重跑全套)。
72
68
  // 按运行环境(SANDBOX_ID)分流 outputLayout,不绑 stack:
@@ -90,18 +86,13 @@ async function handleAppInit(opts) {
90
86
  (0, logger_1.log)('init', `⚠ skills sync failed (continuing init): ${steeringError}`);
91
87
  steeringResult = { version: 'unknown', syncedSkills: [], techSynced: false };
92
88
  }
93
- // template 渲染下来的 @lark-apaas/* 版本可能落后 latest dist-tag,把管控包@latest 作为
94
- // 位置参数显式传给 npm install,让 npm 自动改写 package.json spec ^具体最新版 +
95
- // 写入 lockfile,而不需要 init 主动改 package.json。
89
+ // 装模板钉死的依赖。不带 <pkg>@latest 位置参数,因此 npm 不会改写 package.json/lockfile
90
+ // —— "升管控包到 latest" sync 的职责,在 dev.sh 入口跑 `miaoda app sync` 时触发。
96
91
  const installResult = (0, index_1.installDependencies)({
97
92
  targetDir,
98
93
  skip: opts.skipInstall,
99
94
  quietStdout: (0, output_1.isJsonMode)(),
100
- extraPackages: Object.keys(beforeManagedSpecs).map((name) => `${name}@latest`),
101
95
  });
102
- // install 之后 diff 管控包 spec,得到 upgradedPackages 报告
103
- const afterManagedSpecs = (0, sync_1.snapshotManagedDepSpecs)(targetDir);
104
- const upgradedPackages = (0, sync_1.diffManagedSpecs)(beforeManagedSpecs, afterManagedSpecs, 'init');
105
96
  // template 自带 .githooks/pre-commit;如果用户项目已 git init,顺便设上 core.hooksPath。
106
97
  const hookActivation = (0, githooks_1.activateGitHooks)(targetDir);
107
98
  (0, index_1.writeSparkMeta)(targetDir, {
@@ -125,7 +116,6 @@ async function handleAppInit(opts) {
125
116
  syncedSkills: steeringResult.syncedSkills,
126
117
  techSynced: steeringResult.techSynced,
127
118
  steeringError,
128
- upgradedPackages,
129
119
  gitHooks: hookActivation.action,
130
120
  installed: installResult.installed,
131
121
  installSource: installResult.source,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/miaoda-cli",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "Miaoda 平台命令行工具,面向 Agent 调用",
5
5
  "type": "commonjs",
6
6
  "bin": {