mvframe 1.0.95 → 1.0.96

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.cn.md CHANGED
@@ -293,16 +293,41 @@ Codex 不会自动读取 Cursor 的 `.cursor/rules/*.mdc`。宿主项目需要
293
293
 
294
294
  ```bash
295
295
  cd /path/to/your-app
296
+ yarn exec mvframe-init-rules
297
+ # 或:npx mvframe-init-rules
298
+
299
+ # 仅初始化 Codex 规则
296
300
  yarn exec mvframe-install-codex-rules
297
301
  # 或:npx mvframe-install-codex-rules
298
302
 
299
303
  # 克隆 / monorepo 中指向 mvframe 源码时
304
+ node /path/to/mvframe/scripts/init-rules.js
305
+ node /path/to/mvframe/scripts/init-rules.js /path/to/your-app
306
+
307
+ # 仅初始化 Codex 规则
300
308
  node /path/to/mvframe/scripts/install-codex-agents.js
301
309
  node /path/to/mvframe/scripts/install-codex-agents.js /path/to/your-app
302
310
  ```
303
311
 
304
312
  脚手架命令已自动执行这一步。生成区块带有 `MVFRAME-CODEX-RULES` 标记,重复执行只更新这段内容,不覆盖你在 `AGENTS.md` 中的其它规则。
305
313
 
314
+ ## Cursor 规则(`.cursor/rules`)
315
+
316
+ 统一命令 `mvframe-init-rules` 会同时把 **mvframe 包内**与仓库一致的 **`*.mdc`** 补充到目标项目 **`/.cursor/rules/`**(`component-hierarchy`、`script-setup`、`style-system`、`views`、`router`、`global-components`、`data`、`util`)。
317
+ 若宿主项目已存在同名规则文件,则保留宿主文件,仅补缺失项。
318
+
319
+ 仅安装 Cursor 规则时:
320
+
321
+ ```bash
322
+ cd /path/to/your-app
323
+ yarn exec mvframe-install-cursor-rules
324
+ # 或:npx mvframe-install-cursor-rules
325
+
326
+ # 克隆 / monorepo 中指向 mvframe 源码时
327
+ node /path/to/mvframe/scripts/install-cursor-rules.js
328
+ node /path/to/mvframe/scripts/install-cursor-rules.js /path/to/your-app
329
+ ```
330
+
306
331
  ## Cursor Skill(应用初始化)
307
332
 
308
333
  本仓库自带 **`.cursor/skills/mvframe-app-init`**,消费方项目可复制到自身 `.cursor/skills` 以便 Cursor 识别 MVFrame 接入规范。
package/README.md CHANGED
@@ -278,16 +278,41 @@ Codex does **not** automatically read Cursor `.cursor/rules/*.mdc`. For host pro
278
278
 
279
279
  ```bash
280
280
  cd /path/to/your-app
281
+ yarn exec mvframe-init-rules
282
+ # or: npx mvframe-init-rules
283
+
284
+ # Codex rules only
281
285
  yarn exec mvframe-install-codex-rules
282
286
  # or: npx mvframe-install-codex-rules
283
287
 
284
288
  # Full checkout / monorepo path to mvframe
289
+ node /path/to/mvframe/scripts/init-rules.js
290
+ node /path/to/mvframe/scripts/init-rules.js /path/to/your-app
291
+
292
+ # Codex rules only
285
293
  node /path/to/mvframe/scripts/install-codex-agents.js
286
294
  node /path/to/mvframe/scripts/install-codex-agents.js /path/to/your-app
287
295
  ```
288
296
 
289
297
  The scaffold command already runs this step. The generated block is bounded by `MVFRAME-CODEX-RULES` markers, so rerunning the command updates only that block and preserves other `AGENTS.md` content.
290
298
 
299
+ ## Cursor Rules (`.cursor/rules`)
300
+
301
+ The unified `mvframe-init-rules` command also adds the package’s **`*.mdc`** files into the target project’s **`/.cursor/rules/`** (`component-hierarchy`, `script-setup`, `style-system`, `views`, `router`, `global-components`, `data`, `util`).
302
+ If the host project already has a same-named rule file, the host file is kept and only missing rules are added.
303
+
304
+ Install Cursor rules only:
305
+
306
+ ```bash
307
+ cd /path/to/your-app
308
+ yarn exec mvframe-install-cursor-rules
309
+ # or: npx mvframe-install-cursor-rules
310
+
311
+ # Full checkout / monorepo path to mvframe
312
+ node /path/to/mvframe/scripts/install-cursor-rules.js
313
+ node /path/to/mvframe/scripts/install-cursor-rules.js /path/to/your-app
314
+ ```
315
+
291
316
  ## Cursor Skill (app scaffold)
292
317
 
293
318
  This repo ships **`.cursor/skills/mvframe-app-init`**. Copy it into your app’s **`.cursor/skills`** so Cursor can pick up MVFrame integration conventions.
package/dist/vendor.js CHANGED
@@ -13477,7 +13477,7 @@ const xr = (e, o = {}) => {
13477
13477
  }, Nr = {
13478
13478
  name: "Matt Avias Frame",
13479
13479
  copyright: "©2026",
13480
- version: "1.0.95",
13480
+ version: "1.0.96",
13481
13481
  author: "Matt Avias",
13482
13482
  date: "2026-02-26",
13483
13483
  /** 默认语言 key,与 `$getLang`、localStorage `lang` 一致;业务在 app.use(mvframe, { config }) 里覆盖 */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mvframe",
3
3
  "packageManager": "yarn@4.4.1",
4
- "version": "1.0.95",
4
+ "version": "1.0.96",
5
5
  "author": "matt avis",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
@@ -44,6 +44,8 @@
44
44
  "d": "node scripts/dev-with-notify.js",
45
45
  "notify": "node scripts/notify-server.js",
46
46
  "build": "node scripts/prebuild.js",
47
+ "init-rules": "node scripts/init-rules.js",
48
+ "install-cursor-rules": "node scripts/install-cursor-rules.js",
47
49
  "install-cursor-skill": "node scripts/install-cursor-skill.js",
48
50
  "install-codex-rules": "node scripts/install-codex-agents.js",
49
51
  "scaffold-app": "node scripts/scaffold-app.js",
@@ -54,7 +56,9 @@
54
56
  "mvframe-b": "scripts/build-host.js",
55
57
  "mvframe-d": "scripts/dev-with-notify.js",
56
58
  "mvframe-init-app": "scripts/scaffold-app.js",
59
+ "mvframe-init-rules": "scripts/init-rules.js",
57
60
  "mvframe-install-codex-rules": "scripts/install-codex-agents.js",
61
+ "mvframe-install-cursor-rules": "scripts/install-cursor-rules.js",
58
62
  "mvframe-install-cursor-skill": "scripts/install-cursor-skill.js",
59
63
  "mvframe-notify": "scripts/notify-server.js"
60
64
  },
@@ -63,7 +67,9 @@
63
67
  "src/style/chip/mixin.scss",
64
68
  "scripts/build-host.js",
65
69
  "scripts/dev-with-notify.js",
70
+ "scripts/init-rules.js",
66
71
  "scripts/install-codex-agents.js",
72
+ "scripts/install-cursor-rules.js",
67
73
  "scripts/install-cursor-skill.js",
68
74
  "scripts/notify-server.js",
69
75
  "scripts/scaffold-app.js",
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * 一次初始化宿主项目的 MVFrame Codex + Cursor 规则。
4
+ *
5
+ * 用法:
6
+ * node path/to/mvframe/scripts/init-rules.js
7
+ * node path/to/mvframe/scripts/init-rules.js /abs/path/to/your-project
8
+ * yarn exec mvframe-init-rules
9
+ *
10
+ * 环境变量(可选):
11
+ * MVFRAME_INIT_RULES_OUT=/path/to/project 等价于第一个参数
12
+ */
13
+
14
+ const fs = require("fs");
15
+ const path = require("path");
16
+ const { upsertCodexAgents } = require("./install-codex-agents.js");
17
+ const { installCursorRules } = require("./install-cursor-rules.js");
18
+
19
+ function main() {
20
+ const argPath = process.argv.find((a, i) => i >= 2 && !a.startsWith("--"));
21
+ const projectRoot = path.resolve(
22
+ process.env.MVFRAME_INIT_RULES_OUT || argPath || process.cwd(),
23
+ );
24
+
25
+ if (!fs.existsSync(projectRoot)) {
26
+ console.error("[mvframe] 目录不存在:", projectRoot);
27
+ process.exit(1);
28
+ }
29
+
30
+ installCursorRules(projectRoot);
31
+ upsertCodexAgents(projectRoot);
32
+
33
+ console.log("[mvframe] 已完成 MVFrame 规则初始化:");
34
+ console.log(" - Cursor: .cursor/rules/*.mdc");
35
+ console.log(" - Codex: AGENTS.md");
36
+ console.log("[mvframe] 请重开 Cursor / 开启新 Codex 会话,确保新规则被重新读取。");
37
+ }
38
+
39
+ if (require.main === module) {
40
+ main();
41
+ }
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * 将 MVFrame 包内 `.cursor/rules/*.mdc` 补充到目标工程的 `.cursor/rules/`。
4
+ * 若宿主项目已存在同名规则文件,则保留宿主文件,不覆盖。
5
+ *
6
+ * 用法:
7
+ * node path/to/mvframe/scripts/install-cursor-rules.js
8
+ * node path/to/mvframe/scripts/install-cursor-rules.js /abs/path/to/your-project
9
+ *
10
+ * 环境变量(可选):
11
+ * MVFRAME_CURSOR_RULES_OUT=/path/to/project 等价于第一个参数
12
+ */
13
+
14
+ const fs = require("fs");
15
+ const path = require("path");
16
+
17
+ function installCursorRules(projectRoot) {
18
+ const targetRoot = path.resolve(projectRoot);
19
+ const rulesSrc = path.join(__dirname, "..", ".cursor", "rules");
20
+
21
+ if (!fs.existsSync(rulesSrc)) {
22
+ console.warn(
23
+ "[mvframe] 未找到包内 .cursor/rules(请使用含该目录的 mvframe 版本),跳过 Cursor 规则复制",
24
+ );
25
+ return;
26
+ }
27
+
28
+ const entries = fs.readdirSync(rulesSrc, { withFileTypes: true });
29
+ for (const ent of entries) {
30
+ if (!ent.isFile() || !ent.name.endsWith(".mdc")) continue;
31
+ const src = path.join(rulesSrc, ent.name);
32
+ const dest = path.join(targetRoot, ".cursor", "rules", ent.name);
33
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
34
+ if (fs.existsSync(dest)) {
35
+ console.log("[mvframe] 已存在 Cursor 规则,跳过:");
36
+ console.log(" ", dest);
37
+ continue;
38
+ }
39
+ fs.copyFileSync(src, dest);
40
+ console.log("[mvframe] 已写入 Cursor 规则:");
41
+ console.log(" ", dest);
42
+ }
43
+
44
+ console.log("[mvframe] Cursor 打开该项目后会读取 .cursor/rules/*.mdc。");
45
+ }
46
+
47
+ function main() {
48
+ const argPath = process.argv.find((a, i) => i >= 2 && !a.startsWith("--"));
49
+ const projectRoot = path.resolve(
50
+ process.env.MVFRAME_CURSOR_RULES_OUT || argPath || process.cwd(),
51
+ );
52
+
53
+ if (!fs.existsSync(projectRoot)) {
54
+ console.error("[mvframe] 目录不存在:", projectRoot);
55
+ process.exit(1);
56
+ }
57
+
58
+ installCursorRules(projectRoot);
59
+ }
60
+
61
+ if (require.main === module) {
62
+ main();
63
+ }
64
+
65
+ module.exports = {
66
+ installCursorRules,
67
+ };
@@ -17,6 +17,7 @@ const fs = require("fs");
17
17
  const path = require("path");
18
18
  const { execFileSync } = require("child_process");
19
19
  const { upsertCodexAgents } = require("./install-codex-agents.js");
20
+ const { installCursorRules } = require("./install-cursor-rules.js");
20
21
 
21
22
  const FORCE = process.argv.includes("--force") || process.argv.includes("-f");
22
23
  const NO_PKG = process.argv.includes("--no-package-json") || process.argv.includes("-n");
@@ -54,27 +55,6 @@ function appendGitignoreLines(lines) {
54
55
  console.log("[mvframe-init] 已更新 .gitignore");
55
56
  }
56
57
 
57
- /**
58
- * 将本包 `.cursor/rules/*.mdc` 复制到目标工程,与 mvframe 仓库内 Cursor 规则保持一致。
59
- * 发布包需在 `package.json` 的 `files` 中包含 `.cursor/rules`。
60
- */
61
- function copyCursorRulesFromPackage() {
62
- const rulesSrc = path.join(__dirname, "..", ".cursor", "rules");
63
- if (!fs.existsSync(rulesSrc)) {
64
- console.warn(
65
- "[mvframe-init] 未找到包内 .cursor/rules(请使用含该目录的 mvframe 版本),跳过 Cursor 规则复制",
66
- );
67
- return;
68
- }
69
- const entries = fs.readdirSync(rulesSrc, { withFileTypes: true });
70
- for (const ent of entries) {
71
- if (!ent.isFile() || !ent.name.endsWith(".mdc")) continue;
72
- const content = fs.readFileSync(path.join(rulesSrc, ent.name), "utf8");
73
- const rel = path.join(".cursor", "rules", ent.name);
74
- write(rel.replace(/\\/g, "/"), content);
75
- }
76
- }
77
-
78
58
  /** 与 main.js / vite.config 模板一致;版本号与 mvframe 本仓库对齐思路,可随发布调整 */
79
59
  // @vue/shared 为 Vue 3 内部包,传递依赖在部分包管理器下未提升时 Vite 解析失败,故写入直连依赖
80
60
  const SCAFFOLD_DEPENDENCIES = {
@@ -187,7 +167,7 @@ function main() {
187
167
  fs.mkdirSync(path.join(target, d), { recursive: true });
188
168
  }
189
169
 
190
- copyCursorRulesFromPackage();
170
+ installCursorRules(target);
191
171
  upsertCodexAgents(target);
192
172
  appendGitignoreLines([".env.local", ".env.mvframe-notify"]);
193
173
 
@@ -976,6 +956,12 @@ await notify("需要发送到钉钉的消息");
976
956
 
977
957
  初始化脚本会写入/更新项目根 **\`AGENTS.md\`** 的 MVFrame 区块,供 Codex 在宿主项目内优先使用 **MVFrame 全局组件、全局方法与全局样式工具类**,并要求 **每次 AI 完成开发后调用 \`yarn exec mvframe-notify --once --message "..."\` 发送完成通知**。该区块带有 \`MVFRAME-CODEX-RULES\` 标记,重复执行脚手架会更新这段内容,不会覆盖你在 \`AGENTS.md\` 中的其它规则。
978
958
 
959
+ 同时初始化 Codex + Cursor 两侧规则:
960
+
961
+ \`\`\`bash
962
+ yarn exec mvframe-init-rules
963
+ \`\`\`
964
+
979
965
  仅安装 Codex 规则:
980
966
 
981
967
  \`\`\`bash
@@ -984,7 +970,13 @@ yarn exec mvframe-install-codex-rules
984
970
 
985
971
  ## Cursor 规则(\`.cursor/rules\`)
986
972
 
987
- 初始化脚本会把 **mvframe 包内**与仓库一致的 **\`*.mdc\`** 写入目标项目 **\`/.cursor/rules/\`**(\`component-hierarchy\`、\`script-setup\`、\`style-system\`、\`views\`、\`router\`、\`global-components\`、\`data\`、\`util\`)。若目录或文件已存在且未加 \`--force\` / \`-f\`,则跳过对应文件。
973
+ 初始化脚本会把 **mvframe 包内**与仓库一致的 **\`*.mdc\`** 补充到目标项目 **\`/.cursor/rules/\`**(\`component-hierarchy\`、\`script-setup\`、\`style-system\`、\`views\`、\`router\`、\`global-components\`、\`data\`、\`util\`)。若宿主项目已存在同名规则文件,则保留宿主文件,仅补缺失项。
974
+
975
+ 仅安装 Cursor 规则:
976
+
977
+ \`\`\`bash
978
+ yarn exec mvframe-install-cursor-rules
979
+ \`\`\`
988
980
 
989
981
  npm 包需在 \`files\` 中包含 \`.cursor/rules\`;使用本地 \`file:\` / 源码链接时同样可用。
990
982