@czxingyu/xycomponents 0.1.3 → 0.1.5
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.js +177 -3
- package/dist/index.esm.js +3 -3
- package/dist/index.lite.esm.js +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/package.js +1 -1
- package/dist/table/table.js +1 -1
- package/dist/table/table.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/xycomponents.css +1 -1
- package/package.json +4 -2
- package/scripts/postinstall-skills.mjs +30 -0
- package/skills/README.md +51 -17
- package/skills/xycomponents-shared/SKILL.md +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@czxingyu/xycomponents",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"bin": {
|
|
5
5
|
"xycomponents": "dist/cli.js"
|
|
6
6
|
},
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"components/style/*.css",
|
|
10
10
|
"docs/maintenance/migrations/*.md",
|
|
11
11
|
"global.d.ts",
|
|
12
|
-
"skills"
|
|
12
|
+
"skills",
|
|
13
|
+
"scripts/postinstall-skills.mjs"
|
|
13
14
|
],
|
|
14
15
|
"type": "module",
|
|
15
16
|
"sideEffects": [
|
|
@@ -161,6 +162,7 @@
|
|
|
161
162
|
"fmt:check": "oxfmt --check",
|
|
162
163
|
"generate:component": "node scripts/generate-component.mjs",
|
|
163
164
|
"lint": "oxlint .",
|
|
165
|
+
"postinstall": "node scripts/postinstall-skills.mjs",
|
|
164
166
|
"check": "pnpm run fmt:check && pnpm run lint && pnpm run type-check",
|
|
165
167
|
"ci": "pnpm run check && pnpm test && pnpm run audit:components && pnpm run test:e2e && pnpm run build && pnpm run check:esm-import && pnpm run check:umd-contract && pnpm run check:bundle && pnpm run check:package && pnpm run check:packed-consumer",
|
|
166
168
|
"release": "pnpm run ci && changeset publish",
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
|
|
6
|
+
const packageRoot = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
7
|
+
const cliEntry = join(packageRoot, "dist", "cli.js");
|
|
8
|
+
const projectRoot = process.env.INIT_CWD || process.cwd();
|
|
9
|
+
|
|
10
|
+
if (process.env.XYCOMPONENTS_SKIP_SKILLS_INSTALL === "1") {
|
|
11
|
+
process.exit(0);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (!existsSync(cliEntry)) {
|
|
15
|
+
process.exit(0);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const result = spawnSync(
|
|
19
|
+
process.execPath,
|
|
20
|
+
[cliEntry, "skills", "install", "--consumer", "--json"],
|
|
21
|
+
{
|
|
22
|
+
cwd: projectRoot,
|
|
23
|
+
encoding: "utf8",
|
|
24
|
+
env: process.env,
|
|
25
|
+
},
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
if (result.status !== 0) {
|
|
29
|
+
process.exit(0);
|
|
30
|
+
}
|
package/skills/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# xycomponents AI Skills
|
|
2
2
|
|
|
3
|
-
面向 Cursor
|
|
3
|
+
面向 Cursor、Claude Code、Codex 与其他读取 `AGENTS.md` 的 Agent。配合项目内安装的 `@czxingyu/xycomponents` 使用。
|
|
4
4
|
|
|
5
5
|
## 原则
|
|
6
6
|
|
|
@@ -8,12 +8,58 @@
|
|
|
8
8
|
- **不要全局安装** CLI,避免 AI 查到与项目不一致的 API。
|
|
9
9
|
- **Bug / 新组件**:业务项目 AI 用 `xycomponents-contribute` 提交 GitHub Issue;组件库维护者用 `xycomponents-maintainer` 集中分诊与修复。
|
|
10
10
|
|
|
11
|
+
## 自动安装(推荐)
|
|
12
|
+
|
|
13
|
+
安装组件库后,Skill 会**自动**写入当前项目(可用环境变量跳过):
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add @czxingyu/xycomponents
|
|
17
|
+
# postinstall 会自动执行:pnpm exec xycomponents skills install --consumer --json
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
跳过自动安装:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
XYCOMPONENTS_SKIP_SKILLS_INSTALL=1 pnpm add @czxingyu/xycomponents
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
手动重装 / 升级后同步 Skill:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pnpm exec xycomponents skills install --consumer --json
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
维护者额外安装 maintainer skill:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pnpm exec xycomponents skills install --maintainer --json
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## 支持的 Agent 目录
|
|
39
|
+
|
|
40
|
+
| 目标 | 目录 | 典型工具 |
|
|
41
|
+
| ----------- | ----------------- | ----------------------------------- |
|
|
42
|
+
| `cursor` | `.cursor/skills/` | Cursor |
|
|
43
|
+
| `claude` | `.claude/skills/` | Claude Code |
|
|
44
|
+
| `codex` | `.codex/skills/` | Codex |
|
|
45
|
+
| `agents` | `.agents/skills/` | 通用 Agent 技能目录 |
|
|
46
|
+
| `AGENTS.md` | 项目根目录 | ChatGPT / 其他读取 AGENTS.md 的工具 |
|
|
47
|
+
|
|
48
|
+
默认 `--target all` 会写入以上全部目录,并更新 `AGENTS.md` 引导块。
|
|
49
|
+
|
|
50
|
+
只装 Cursor:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pnpm exec xycomponents skills install --consumer --target cursor
|
|
54
|
+
```
|
|
55
|
+
|
|
11
56
|
## 完整闭环
|
|
12
57
|
|
|
13
58
|
```text
|
|
14
59
|
业务项目 组件库仓库 (vue3components)
|
|
15
60
|
──────── ──────────────────────────
|
|
16
61
|
pnpm add @czxingyu/xycomponents
|
|
62
|
+
└─ postinstall / skills install
|
|
17
63
|
pnpm exec xycomponents ... ──► 查用法 / API
|
|
18
64
|
│
|
|
19
65
|
▼ Bug 或 Feature
|
|
@@ -24,21 +70,6 @@ gh issue create (contribute) ──► needs-triage 队列
|
|
|
24
70
|
pnpm add @新版本 ◄─────────────── 关闭 Issue,注明版本
|
|
25
71
|
```
|
|
26
72
|
|
|
27
|
-
## 安装 Skill 到业务项目
|
|
28
|
-
|
|
29
|
-
复制 **`xycomponents-shared`**、**`xycomponents-cli`**、**`xycomponents-contribute`** 到 `.cursor/skills/`。
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
pnpm add @czxingyu/xycomponents
|
|
33
|
-
cp -r node_modules/@czxingyu/xycomponents/skills/xycomponents-shared .cursor/skills/
|
|
34
|
-
cp -r node_modules/@czxingyu/xycomponents/skills/xycomponents-cli .cursor/skills/
|
|
35
|
-
cp -r node_modules/@czxingyu/xycomponents/skills/xycomponents-contribute .cursor/skills/
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
本仓库维护者额外启用 **`xycomponents-maintainer`**(已在 `.cursor/skills/`)。
|
|
39
|
-
|
|
40
|
-
提交 Issue 需本机安装 [GitHub CLI](https://cli.github.com/) 并 `gh auth login`。
|
|
41
|
-
|
|
42
73
|
## Skill 列表
|
|
43
74
|
|
|
44
75
|
| Skill | 谁用 | 用途 |
|
|
@@ -48,6 +79,8 @@ cp -r node_modules/@czxingyu/xycomponents/skills/xycomponents-contribute .cursor
|
|
|
48
79
|
| [xycomponents-contribute](./xycomponents-contribute/SKILL.md) | 业务项目 | 提交 Bug / Feature Issue |
|
|
49
80
|
| [xycomponents-maintainer](./xycomponents-maintainer/SKILL.md) | 组件库维护者 | 拉取 Issue、分诊、修复、发版 |
|
|
50
81
|
|
|
82
|
+
提交 Issue 需本机安装 [GitHub CLI](https://cli.github.com/) 并 `gh auth login`。
|
|
83
|
+
|
|
51
84
|
## GitHub Issue 模板
|
|
52
85
|
|
|
53
86
|
| 模板 | 标签 | 场景 |
|
|
@@ -57,8 +90,9 @@ cp -r node_modules/@czxingyu/xycomponents/skills/xycomponents-contribute .cursor
|
|
|
57
90
|
|
|
58
91
|
用法问题优先 [Discussions](https://github.com/czhang31795/vue3components/discussions)。
|
|
59
92
|
|
|
60
|
-
## 验证
|
|
93
|
+
## 验证
|
|
61
94
|
|
|
62
95
|
```bash
|
|
63
96
|
pnpm exec xycomponents doctor --json
|
|
97
|
+
pnpm exec xycomponents skills install --consumer --dry-run --json
|
|
64
98
|
```
|
|
@@ -15,6 +15,8 @@ metadata:
|
|
|
15
15
|
## 版本与 CLI 策略(必须遵守)
|
|
16
16
|
|
|
17
17
|
- **只在当前项目内**安装 `@czxingyu/xycomponents`;**不要**全局安装 CLI,也不要用与项目 `package.json` 版本不一致的全局命令。
|
|
18
|
+
- 安装组件库时会**自动**写入 Agent Skill(Cursor / Claude Code / Codex / `.agents/skills/` + `AGENTS.md`)。跳过:`XYCOMPONENTS_SKIP_SKILLS_INSTALL=1 pnpm add ...`
|
|
19
|
+
- 手动重装或升级后同步:`pnpm exec xycomponents skills install --consumer --json`
|
|
18
20
|
- CLI 元数据随 npm 包一起发布;**CLI 版本 = 已安装的包版本**。
|
|
19
21
|
- 升级组件库时重新安装,CLI 会同步更新:
|
|
20
22
|
|