@xuxiao-dev/ai-dev-kit 0.1.2 → 0.1.3
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 +9 -3
- package/bin/ai-dev-kit.js +11 -6
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
`@xuxiao-dev/ai-dev-kit` 是一个面向项目开发流程的 npm CLI 工具包,用于管理和安装 Cursor 与 Codex 相关资源。
|
|
14
14
|
|
|
15
|
-
在任意项目根目录执行对应的 `add --all` 命令,即可安装内置资源:Cursor 资源会复制到 `.cursor/`,Codex skills 会复制到 `.
|
|
15
|
+
在任意项目根目录执行对应的 `add --all` 命令,即可安装内置资源:Cursor 资源会复制到 `.cursor/`,Codex skills 会复制到 `.agents/skills/`,Codex rules 会安全合并到 `AGENTS.md`。适合在多个项目中复用统一的 AI 协作规范、README 生成和提交工作流。
|
|
16
16
|
|
|
17
17
|
当前项目类型为工具库 / npm 包,入口命令为 `ai-dev-kit`,运行环境要求 Node.js `>=18`。
|
|
18
18
|
|
|
@@ -93,7 +93,7 @@ Codex Rules:
|
|
|
93
93
|
安装到业务项目后,资源会写入:
|
|
94
94
|
|
|
95
95
|
```text
|
|
96
|
-
.
|
|
96
|
+
.agents/
|
|
97
97
|
└── skills/
|
|
98
98
|
└── xxx/
|
|
99
99
|
└── SKILL.md
|
|
@@ -142,7 +142,7 @@ npx @xuxiao-dev/ai-dev-kit cursor add --all
|
|
|
142
142
|
npx @xuxiao-dev/ai-dev-kit codex add --all
|
|
143
143
|
```
|
|
144
144
|
|
|
145
|
-
Cursor 资源会复制到当前项目的 `.cursor/rules` 和 `.cursor/commands`。Codex skills 会复制到 `.
|
|
145
|
+
Cursor 资源会复制到当前项目的 `.cursor/rules` 和 `.cursor/commands`。Codex skills 会复制到 `.agents/skills`,rules 会追加到 `AGENTS.md` 的受管理区块。默认跳过已存在资源;如需覆盖,加 `--force`。
|
|
146
146
|
|
|
147
147
|
## 使用方式
|
|
148
148
|
|
|
@@ -182,6 +182,12 @@ npx @xuxiao-dev/ai-dev-kit cursor add command readme-command
|
|
|
182
182
|
npx @xuxiao-dev/ai-dev-kit codex add skill generate-project-readme
|
|
183
183
|
```
|
|
184
184
|
|
|
185
|
+
只安装全部 Codex Skills:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
npx @xuxiao-dev/ai-dev-kit codex add skill --all
|
|
189
|
+
```
|
|
190
|
+
|
|
185
191
|
安装单个 Codex Rule:
|
|
186
192
|
|
|
187
193
|
```bash
|
package/bin/ai-dev-kit.js
CHANGED
|
@@ -182,7 +182,7 @@ function createCodexCommand(context) {
|
|
|
182
182
|
console.log(pc2.bold("Codex Rules:"));
|
|
183
183
|
printResourceList2(resources.rule);
|
|
184
184
|
});
|
|
185
|
-
codex.command("add").description("Install Codex resources into the current project.").argument("[type]", "Resource type: skill or rule").argument("[name]", "Resource name to install").option("--all", "Install all Codex
|
|
185
|
+
codex.command("add").description("Install Codex resources into the current project.").argument("[type]", "Resource type: skill or rule").argument("[name]", "Resource name to install").option("--all", "Install all Codex resources, or every resource of the specified type").option("--force", "Overwrite an existing skill or replace an installed rule block").action(async (type, name, options) => {
|
|
186
186
|
await handleAdd2(context.packageRoot, type, name, options);
|
|
187
187
|
});
|
|
188
188
|
return codex;
|
|
@@ -191,14 +191,19 @@ async function handleAdd2(packageRoot2, rawType, name, options) {
|
|
|
191
191
|
const mode = options.force ? "overwrite" : "skip";
|
|
192
192
|
const projectRoot = process.cwd();
|
|
193
193
|
if (options.all) {
|
|
194
|
-
if (
|
|
194
|
+
if (name) throw new Error('Do not provide a resource name with --all. Use "codex add --all" or "codex add <skill|rule> --all".');
|
|
195
|
+
const type2 = normalizeResourceType2(rawType);
|
|
195
196
|
const resources2 = await getCodexResources(packageRoot2);
|
|
196
|
-
|
|
197
|
-
|
|
197
|
+
if (!type2 || type2 === "skill") {
|
|
198
|
+
for (const skill of resources2.skill) await installSkill(packageRoot2, projectRoot, skill, mode);
|
|
199
|
+
}
|
|
200
|
+
if (!type2 || type2 === "rule") {
|
|
201
|
+
for (const rule of resources2.rule) await installRule(packageRoot2, projectRoot, rule, mode);
|
|
202
|
+
}
|
|
198
203
|
return;
|
|
199
204
|
}
|
|
200
205
|
const type = normalizeResourceType2(rawType);
|
|
201
|
-
if (!type || !name) throw new Error("Missing arguments. Usage: ai-dev-kit codex add <skill|rule> <name> or ai-dev-kit codex add --all");
|
|
206
|
+
if (!type || !name) throw new Error("Missing arguments. Usage: ai-dev-kit codex add <skill|rule> <name>, ai-dev-kit codex add <skill|rule> --all, or ai-dev-kit codex add --all");
|
|
202
207
|
const resources = await getCodexResources(packageRoot2);
|
|
203
208
|
if (!resources[type].includes(name)) {
|
|
204
209
|
throw new Error(`Unknown Codex ${type}: ${name}
|
|
@@ -208,7 +213,7 @@ Available ${type}s: ${formatAvailable2(resources[type])}`);
|
|
|
208
213
|
else await installRule(packageRoot2, projectRoot, name, mode);
|
|
209
214
|
}
|
|
210
215
|
async function installSkill(packageRoot2, projectRoot, name, mode) {
|
|
211
|
-
const targetPath = path3.join(".
|
|
216
|
+
const targetPath = path3.join(".agents", "skills", name);
|
|
212
217
|
const result = await copyPathWithMode(
|
|
213
218
|
path3.join(packageRoot2, "codex", "skills", name),
|
|
214
219
|
path3.join(projectRoot, targetPath),
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xuxiao-dev/ai-dev-kit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "A CLI toolkit for installing AI development resources into projects.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"ai-dev-kit": "
|
|
7
|
+
"ai-dev-kit": "bin/ai-dev-kit.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"bin",
|