@lark-apaas/miaoda-cli 0.1.32 → 0.1.33-alpha.0e32e59

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.
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EXCLUDES = void 0;
4
+ /**
5
+ * 与模板 `scripts/build.sh` 的 rsync EXCLUDES 对齐:这些名字(任意层级 basename)不进产物/不计入路由。
6
+ *
7
+ * 放在 `utils/` 而非某个 domain 的 service 下,是因为它被 `deploy`(`source-scan.ts` 的
8
+ * `listSourceFiles`)与 `app`(`export-standalone` 的 `copyTree`)两个 domain 共用 ——
9
+ * service 层跨域互调被 `boundaries/dependencies` 禁止(见 docs/dependency-rules.md F4),
10
+ * 共享的纯数据/纯逻辑必须下沉到 `utils/`。
11
+ */
12
+ exports.EXCLUDES = new Set([
13
+ '.git',
14
+ 'node_modules',
15
+ 'dist',
16
+ 'scripts',
17
+ 'package.json',
18
+ 'package-lock.json',
19
+ 'pnpm-lock.yaml',
20
+ 'yarn.lock',
21
+ '.gitignore',
22
+ '.npmrc',
23
+ // agent / 编辑器配置目录与指令文件:只服务本地开发,不属于应用资产。
24
+ // 注意 .claude/skills 在 flat layout 下是指向 ../.agents/skills 的软链,而 listSourceFiles
25
+ // 会 follow 软链,所以必须按 basename 把 .claude 整个排掉,否则 skills 会从软链侧被带进产物。
26
+ '.agent',
27
+ '.agents',
28
+ '.claude',
29
+ '.codex',
30
+ '.cursor',
31
+ '.gemini',
32
+ '.trae',
33
+ '.windsurf',
34
+ '.vscode',
35
+ '.idea',
36
+ 'AGENTS.md',
37
+ 'CLAUDE.md',
38
+ 'GEMINI.md',
39
+ 'skills',
40
+ '.env',
41
+ '.env.local',
42
+ 'README.md',
43
+ '.DS_Store',
44
+ '.spark',
45
+ // 本地开发的临时/运行时目录:tmp 里的 .html 是草稿或中间产物,logs 是本地日志,
46
+ // 两者既不进产物也不该出现在 routes.json。
47
+ 'tmp',
48
+ 'logs',
49
+ ]);
@@ -128,7 +128,16 @@ function syncSandboxSkills(opts) {
128
128
  (0, logger_1.debug)(`sandbox-skills: no npm version matched -alpha.${lane}, fallback to @latest ` +
129
129
  `(TCC 里的 X 可能是老 lane dist-tag 命名 / 已 unpublish / npm view 挂 / 网络断)`);
130
130
  }
131
- const primaryVersion = laneVersion ?? 'latest';
131
+ // 版本优先级:lane(TCC 显式定向)> BOE 默认 @dev > @latest
132
+ //
133
+ // `dev` 通道由 miaoda-coding 的 publish-sandbox-skills-dev.sh 在 develop 分支自动发布
134
+ // (`<base>-dev.<sha>` + dist-tag `dev`),口径与 coding-steering 完全一致 ——
135
+ // 后者在本仓 coding-steering 侧也是 `FORCE_FRAMEWORK_ENVIRONMENT=boe` 时默认取 `dev`。
136
+ //
137
+ // lane 必须压过 dev:TCC 里配了 tgz-key 就说明是定向灰度(钉某个 feat 分支的快照),
138
+ // 不能被"BOE 就跟 develop"这条默认规则覆盖掉。
139
+ const isBoe = process.env.FORCE_FRAMEWORK_ENVIRONMENT === 'boe';
140
+ const primaryVersion = laneVersion ?? (isBoe ? 'dev' : 'latest');
132
141
  try {
133
142
  (0, logger_1.debug)(`sandbox-skills: fetching ${packageName}@${primaryVersion}`);
134
143
  fetched = (0, npm_pack_1.fetchNpmPackage)({
@@ -138,6 +147,9 @@ function syncSandboxSkills(opts) {
138
147
  });
139
148
  }
140
149
  catch (err) {
150
+ // @latest 是最后一档,它再挂就没得降了,直接抛。
151
+ // lane / dev 拉失败都降到 @latest:dev 通道可能因为 develop 还没发过包而不存在
152
+ // (dist-tag 缺失 → npm pack 404),这时候不该让整条 sync 挂掉。
141
153
  if (primaryVersion === 'latest') {
142
154
  throw err;
143
155
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/miaoda-cli",
3
- "version": "0.1.32",
3
+ "version": "0.1.33-alpha.0e32e59",
4
4
  "description": "Miaoda 平台命令行工具,面向 Agent 调用",
5
5
  "type": "commonjs",
6
6
  "bin": {
@@ -63,13 +63,47 @@ function isStylelintTarget(filePath) {
63
63
  return filePath.endsWith('.css');
64
64
  }
65
65
 
66
+ const STYLELINT_CONFIG_FILES = [
67
+ '.stylelintrc',
68
+ '.stylelintrc.js',
69
+ '.stylelintrc.cjs',
70
+ '.stylelintrc.json',
71
+ 'stylelint.config.js',
72
+ ];
73
+
74
+ /**
75
+ * 老模板(fullstack-nestjs-template 1.x 时代)的应用跑不了 stylelint,跑了就挂、把 pre-commit
76
+ * 卡死。两种形态都实测过:
77
+ *
78
+ * - 缺 scripts.stylelint → `npm error Missing script: "stylelint"`
79
+ * - 缺 .stylelintrc.* → `ConfigurationError: No configuration provided`
80
+ *
81
+ * 注意光判断 stylelint 装没装拦不住:@lark-apaas/fullstack-presets 的 dependencies 里有
82
+ * stylelint,只要 dep 了 presets 二进制就在。缺任一件就跳过这一步。
83
+ */
84
+ function canRunStylelint() {
85
+ let pkg;
86
+ try {
87
+ pkg = JSON.parse(fs.readFileSync(path.join(cwd, 'package.json'), 'utf8'));
88
+ } catch {
89
+ return false;
90
+ }
91
+
92
+ if (!pkg.scripts || !pkg.scripts.stylelint) return false;
93
+
94
+ return STYLELINT_CONFIG_FILES.some(file => fs.existsSync(path.join(cwd, file)));
95
+ }
96
+
66
97
  async function runDefaultLint() {
67
- const code = await runCommand(getBinName('npx'), [
68
- 'concurrently',
69
- 'npm run eslint',
70
- 'npm run type:check',
71
- 'npm run stylelint',
72
- ]);
98
+ const commands = ['npm run eslint', 'npm run type:check'];
99
+
100
+ if (canRunStylelint()) {
101
+ commands.push('npm run stylelint');
102
+ } else {
103
+ console.warn('[lint] Skip stylelint: missing scripts.stylelint or stylelint config');
104
+ }
105
+
106
+ const code = await runCommand(getBinName('npx'), ['concurrently', ...commands]);
73
107
  process.exit(code);
74
108
  }
75
109
 
@@ -107,7 +141,9 @@ async function runSelectiveLint(inputFiles) {
107
141
  tasks.push(runCommand(getBinName('npx'), ['eslint', '--quiet', ...eslintFiles]));
108
142
  }
109
143
 
110
- if (stylelintFiles.length > 0) {
144
+ if (stylelintFiles.length > 0 && !canRunStylelint()) {
145
+ console.warn('[lint] Skip stylelint: missing scripts.stylelint or stylelint config');
146
+ } else if (stylelintFiles.length > 0) {
111
147
  tasks.push(runCommand(getBinName('npx'), ['stylelint', '--quiet', ...stylelintFiles]));
112
148
  }
113
149