@xuxiao-dev/ai-dev-kit 0.1.0 → 0.1.1
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.md +139 -53
- package/cursor/commands/readme-command.md +20 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,107 +1,193 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://typorabucket0308.oss-cn-beijing.aliyuncs.com/images/20260603103934962.jpg" alt="项目预览图" width="800" />
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<h1 align="center">ai-dev-kit</h1>
|
|
6
|
+
<p align="center">
|
|
7
|
+
用于把 AI 开发辅助资源安装到项目中的 TypeScript CLI 工具。
|
|
8
|
+
</p>
|
|
4
9
|
|
|
5
|
-
|
|
10
|
+
## 项目简介
|
|
6
11
|
|
|
7
|
-
-
|
|
8
|
-
- Cursor commands: installed to `.cursor/commands`
|
|
12
|
+
`@xuxiao-dev/ai-dev-kit` 是一个面向项目开发流程的 npm CLI 工具包,当前主要用于管理和安装 Cursor 相关资源。
|
|
9
13
|
|
|
10
|
-
|
|
14
|
+
它可以将包内置的 Cursor Rules 和 Cursor Commands 复制到当前项目的 `.cursor/` 目录,适合在多个项目中复用统一的 AI 协作规范、README 生成命令、任务计划命令和提交命令。
|
|
11
15
|
|
|
12
|
-
|
|
16
|
+
当前项目类型为工具库 / npm 包,入口命令为 `ai-dev-kit`,运行环境要求 Node.js `>=18`。
|
|
17
|
+
|
|
18
|
+
## 功能特性
|
|
19
|
+
|
|
20
|
+
- 查看包内置的 Cursor Rules 和 Cursor Commands
|
|
21
|
+
- 按名称安装单个 Cursor Rule 到 `.cursor/rules`
|
|
22
|
+
- 按名称安装单个 Cursor Command 到 `.cursor/commands`
|
|
23
|
+
- 支持一次性安装全部内置 Cursor 资源
|
|
24
|
+
- 默认跳过已存在文件,避免覆盖当前项目已有配置
|
|
25
|
+
- 支持通过 `--force` 覆盖已存在文件
|
|
26
|
+
|
|
27
|
+
## 技术栈
|
|
28
|
+
|
|
29
|
+
- Node.js `>=18`
|
|
30
|
+
- TypeScript
|
|
31
|
+
- Commander
|
|
32
|
+
- fs-extra
|
|
33
|
+
- picocolors
|
|
34
|
+
- tsup
|
|
35
|
+
- tsx
|
|
36
|
+
- pnpm
|
|
37
|
+
|
|
38
|
+
## 目录结构
|
|
39
|
+
|
|
40
|
+
```text
|
|
41
|
+
ai-dev-kit/
|
|
42
|
+
├── cursor/
|
|
43
|
+
│ ├── commands/
|
|
44
|
+
│ └── rules/
|
|
45
|
+
├── src/
|
|
46
|
+
│ ├── commands/
|
|
47
|
+
│ ├── utils/
|
|
48
|
+
│ └── cli.ts
|
|
49
|
+
├── package.json
|
|
50
|
+
├── pnpm-lock.yaml
|
|
51
|
+
├── tsconfig.json
|
|
52
|
+
├── tsup.config.ts
|
|
53
|
+
└── README.md
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## 内置资源
|
|
57
|
+
|
|
58
|
+
Cursor Rules:
|
|
59
|
+
|
|
60
|
+
- `ai-task-workflow-rule`
|
|
61
|
+
|
|
62
|
+
Cursor Commands:
|
|
63
|
+
|
|
64
|
+
- `readme-command`
|
|
65
|
+
- `create-plan-from-brief`
|
|
66
|
+
- `commit`
|
|
67
|
+
|
|
68
|
+
安装到业务项目后,资源会写入:
|
|
69
|
+
|
|
70
|
+
```text
|
|
71
|
+
.cursor/
|
|
72
|
+
├── commands/
|
|
73
|
+
│ └── xxx.md
|
|
74
|
+
└── rules/
|
|
75
|
+
└── xxx.mdc
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## 本地运行
|
|
79
|
+
|
|
80
|
+
安装依赖:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
pnpm install
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
开发环境运行:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
pnpm dev
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
构建 CLI:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
pnpm build
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
构建后可直接执行:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
node bin/ai-dev-kit.js cursor list
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## 使用方式
|
|
105
|
+
|
|
106
|
+
直接通过 npm 包运行:
|
|
13
107
|
|
|
14
108
|
```bash
|
|
15
109
|
npx @xuxiao-dev/ai-dev-kit cursor list
|
|
16
110
|
```
|
|
17
111
|
|
|
18
|
-
|
|
112
|
+
或安装到项目中使用:
|
|
19
113
|
|
|
20
114
|
```bash
|
|
21
115
|
pnpm add -D @xuxiao-dev/ai-dev-kit
|
|
22
116
|
pnpm ai-dev-kit cursor list
|
|
23
117
|
```
|
|
24
118
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
List built-in Cursor resources:
|
|
119
|
+
查看内置资源:
|
|
28
120
|
|
|
29
121
|
```bash
|
|
30
122
|
ai-dev-kit cursor list
|
|
31
123
|
```
|
|
32
124
|
|
|
33
|
-
|
|
125
|
+
安装单个 Cursor Rule:
|
|
34
126
|
|
|
35
127
|
```bash
|
|
36
|
-
ai-dev-kit cursor add rule
|
|
128
|
+
ai-dev-kit cursor add rule ai-task-workflow-rule
|
|
37
129
|
```
|
|
38
130
|
|
|
39
|
-
|
|
131
|
+
安装单个 Cursor Command:
|
|
40
132
|
|
|
41
133
|
```bash
|
|
42
|
-
ai-dev-kit cursor add command
|
|
134
|
+
ai-dev-kit cursor add command readme-command
|
|
43
135
|
```
|
|
44
136
|
|
|
45
|
-
|
|
137
|
+
安装全部 Cursor 资源:
|
|
46
138
|
|
|
47
139
|
```bash
|
|
48
140
|
ai-dev-kit cursor add --all
|
|
49
141
|
```
|
|
50
142
|
|
|
51
|
-
|
|
143
|
+
覆盖已存在文件:
|
|
52
144
|
|
|
53
145
|
```bash
|
|
54
|
-
ai-dev-kit cursor add rule
|
|
146
|
+
ai-dev-kit cursor add rule ai-task-workflow-rule --force
|
|
55
147
|
ai-dev-kit cursor add --all --force
|
|
56
148
|
```
|
|
57
149
|
|
|
58
|
-
|
|
150
|
+
## 环境变量
|
|
59
151
|
|
|
60
|
-
|
|
152
|
+
当前项目未发现 `.env.example`,也没有从代码中识别到运行时必须配置的环境变量。
|
|
61
153
|
|
|
62
|
-
|
|
154
|
+
## 构建与发布
|
|
63
155
|
|
|
64
|
-
|
|
65
|
-
- `h5-mobile-layout`
|
|
66
|
-
- `ui-review`
|
|
156
|
+
项目使用 `tsup` 构建,构建入口为 `src/cli.ts`,产物输出到 `bin/` 目录,并带有 Node.js CLI 所需的 shebang。
|
|
67
157
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
- `review-ui`
|
|
72
|
-
- `create-mini-game-doc`
|
|
73
|
-
|
|
74
|
-
## Directory Structure
|
|
158
|
+
```bash
|
|
159
|
+
pnpm build
|
|
160
|
+
```
|
|
75
161
|
|
|
76
|
-
|
|
162
|
+
发布前会执行:
|
|
77
163
|
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
├── rules/
|
|
81
|
-
│ ├── vue3-typescript.mdc
|
|
82
|
-
│ ├── h5-mobile-layout.mdc
|
|
83
|
-
│ └── ui-review.mdc
|
|
84
|
-
└── commands/
|
|
85
|
-
├── generate-readme.md
|
|
86
|
-
├── review-ui.md
|
|
87
|
-
└── create-mini-game-doc.md
|
|
164
|
+
```bash
|
|
165
|
+
pnpm prepublishOnly
|
|
88
166
|
```
|
|
89
167
|
|
|
90
|
-
|
|
168
|
+
实际发布流程和 npm 权限配置待补充。
|
|
91
169
|
|
|
92
|
-
|
|
93
|
-
.cursor/
|
|
94
|
-
├── rules/
|
|
95
|
-
│ └── xxx.mdc
|
|
96
|
-
└── commands/
|
|
97
|
-
└── xxx.md
|
|
98
|
-
```
|
|
170
|
+
## 部署说明
|
|
99
171
|
|
|
100
|
-
|
|
172
|
+
这是一个 npm CLI 工具,不需要像 Web 项目一样部署到服务器。常见交付方式是构建后发布到 npm,再通过 `npx` 或项目内 devDependencies 使用。
|
|
173
|
+
|
|
174
|
+
如果需要发布到 npm,可参考以下流程:
|
|
101
175
|
|
|
102
176
|
```bash
|
|
103
177
|
pnpm install
|
|
104
178
|
pnpm build
|
|
105
|
-
|
|
106
|
-
node bin/ai-dev-kit.js cursor add --all
|
|
179
|
+
npm publish
|
|
107
180
|
```
|
|
181
|
+
|
|
182
|
+
npm 包名、发布账号、版本策略和访问权限请根据实际情况确认。
|
|
183
|
+
|
|
184
|
+
## 后续计划
|
|
185
|
+
|
|
186
|
+
- 补充测试用例,覆盖资源列表、复制、跳过和覆盖逻辑
|
|
187
|
+
- 补充 npm 发布说明和版本管理规范
|
|
188
|
+
- 根据实际使用情况扩展更多 Cursor Rules 和 Commands
|
|
189
|
+
- 增加资源名称与 README 内置资源列表的同步检查
|
|
190
|
+
|
|
191
|
+
## License
|
|
192
|
+
|
|
193
|
+
待补充
|
|
@@ -17,17 +17,20 @@
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
封面图默认使用用户提供的占位图地址。
|
|
20
|
-
|
|
20
|
+
如果用户没有在本次对话中额外提供具体图片地址,则使用以下 command 内置的默认 OSS 占位图地址。注意:这个 OSS 地址本身就是一个明确的图片地址,不要把它理解成“用户没有提供图片”。
|
|
21
21
|
|
|
22
22
|

|
|
23
23
|
|
|
24
24
|
封面图生成规则:
|
|
25
25
|
|
|
26
26
|
- 默认放在 README 最顶部,位于项目标题之前
|
|
27
|
-
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
- 封面图地址优先级必须严格按以下顺序执行:
|
|
28
|
+
1. 如果用户在本次请求中明确提供了 OSS 图片地址 / GIF 地址,优先使用用户提供的地址
|
|
29
|
+
2. 如果项目中存在 `docs/images/readme-cover.gif`,使用该 GIF
|
|
30
|
+
3. 如果项目中存在 `docs/images/readme-cover.png`,使用该 PNG
|
|
31
|
+
4. 如果项目中不存在本地封面图,使用上方 command 内置的默认 OSS 占位图地址
|
|
32
|
+
5. 只有当 command 中也没有默认 OSS 图片地址时,才保留 `./docs/images/readme-cover.png` 作为本地占位路径
|
|
33
|
+
- 当前 command 已经提供默认 OSS 占位图地址,因此在没有本地封面图时,应该使用 `https://typorabucket0308.oss-cn-beijing.aliyuncs.com/images/20260603103934962.jpg`
|
|
31
34
|
- 不要凭空编造不存在的线上图片地址
|
|
32
35
|
- 不要添加带有版权风险、敏感信息、账号信息、接口地址的图片说明
|
|
33
36
|
- 封面图推荐使用横图,适合 README 顶部展示
|
|
@@ -36,9 +39,11 @@
|
|
|
36
39
|
|
|
37
40
|
推荐输出格式:
|
|
38
41
|
|
|
42
|
+
如果没有检测到项目本地封面图,且用户没有额外提供图片地址,则使用 command 内置的默认 OSS 图片:
|
|
43
|
+
|
|
39
44
|
```html
|
|
40
45
|
<p align="center">
|
|
41
|
-
<img src="
|
|
46
|
+
<img src="https://typorabucket0308.oss-cn-beijing.aliyuncs.com/images/20260603103934962.jpg" alt="项目预览图" width="800" />
|
|
42
47
|
</p>
|
|
43
48
|
|
|
44
49
|
<h1 align="center">项目名称</h1>
|
|
@@ -47,7 +52,15 @@
|
|
|
47
52
|
</p>
|
|
48
53
|
```
|
|
49
54
|
|
|
50
|
-
|
|
55
|
+
如果检测到项目本地封面图,则改成对应本地路径:
|
|
56
|
+
|
|
57
|
+
```html
|
|
58
|
+
<p align="center">
|
|
59
|
+
<img src="./docs/images/readme-cover.png" alt="项目预览图" width="800" />
|
|
60
|
+
</p>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
如果用户在本次请求中提供了 OSS 图片地址,则改成:
|
|
51
64
|
|
|
52
65
|
```html
|
|
53
66
|
<p align="center">
|