@xuxiao-dev/ai-dev-kit 0.1.4 → 0.2.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.
Files changed (29) hide show
  1. package/README.md +51 -13
  2. package/bin/ai-dev-kit.js +102 -56
  3. package/codex/index.html +208 -0
  4. package/codex/packs/multi-agent-investment/manifest.json +56 -0
  5. package/codex/packs/multi-agent-investment/skills/project-ui-style/SKILL.md +32 -0
  6. package/codex/packs/multi-agent-investment/skills/project-ui-style/agents/openai.yaml +4 -0
  7. package/codex/packs/multi-agent-investment/skills/project-ui-style/references/component-guide.md +44 -0
  8. package/codex/packs/multi-agent-investment/skills/project-ui-style/references/page-patterns.md +90 -0
  9. package/codex/packs/multi-agent-investment/skills/project-ui-style/references/visual-guidelines.md +99 -0
  10. package/codex/packs/multi-agent-investment/skills/project-verification/SKILL.md +32 -0
  11. package/codex/packs/multi-agent-investment/skills/project-verification/agents/openai.yaml +4 -0
  12. package/codex/packs/multi-agent-investment/skills/project-verification/references/local-environments.md +52 -0
  13. package/codex/packs/multi-agent-investment/skills/project-verification/references/optional-mock.md +23 -0
  14. package/codex/packs/multi-agent-investment/skills/project-verification/references/verification-guide.md +63 -0
  15. package/codex/packs/multi-agent-investment/skills/staged-change-report/SKILL.md +101 -0
  16. package/codex/packs/multi-agent-investment/skills/staged-change-report/agents/openai.yaml +4 -0
  17. package/codex/skills/{optimize-blog → content-blog-optimize}/SKILL.md +1 -1
  18. package/codex/skills/{optimize-blog → content-blog-optimize}/agents/openai.yaml +1 -1
  19. package/codex/skills/{project-documentation → document-project-docs}/SKILL.md +1 -1
  20. package/codex/skills/{project-documentation → document-project-docs}/agents/openai.yaml +1 -1
  21. package/codex/skills/{generate-project-readme → document-project-readme}/SKILL.md +1 -1
  22. package/codex/skills/{generate-project-readme → document-project-readme}/agents/openai.yaml +1 -1
  23. package/codex/skills/{bug-review → engineering-bug-review}/SKILL.md +1 -1
  24. package/codex/skills/{bug-review → engineering-bug-review}/agents/openai.yaml +1 -1
  25. package/codex/skills/{commit-staged-changes → git-commit-staged}/SKILL.md +1 -1
  26. package/codex/skills/{commit-staged-changes → git-commit-staged}/agents/openai.yaml +1 -1
  27. package/codex/{rules/vue-component-config-rule.md → skills/vue-component-config/SKILL.md} +6 -1
  28. package/codex/skills/vue-component-config/agents/openai.yaml +4 -0
  29. package/package.json +1 -1
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  ## 项目简介
10
10
 
11
- `@xuxiao-dev/ai-dev-kit` 是一个 npm CLI 包,用于将包内维护的 Cursor rules / commands,以及 Codex skills / rules 复制或合并到当前工作目录的项目中。
11
+ `@xuxiao-dev/ai-dev-kit` 是一个 npm CLI 包,用于将包内维护的 Cursor rules / commands 和 Codex skills 安装到当前工作目录的项目中。
12
12
 
13
13
  CLI 命令为 `ai-dev-kit`,运行环境要求 Node.js `>=18`。
14
14
 
@@ -17,8 +17,8 @@ CLI 命令为 `ai-dev-kit`,运行环境要求 Node.js `>=18`。
17
17
  - 列出包内可用的 Cursor 和 Codex 资源。
18
18
  - 安装单个或全部 Cursor rule 与 command 到 `.cursor/`。
19
19
  - 安装单个或全部 Codex skill 到 `.agents/skills/`。
20
- - 将 Codex rule 作为受管理区块写入 `AGENTS.md`。
21
- - 默认跳过目标中已存在的资源;使用 `--force` 可覆盖文件或替换受管理的 rule 区块。
20
+ - 在目标项目的 `AGENTS.md` 中维护由 ai-dev-kit 管理的简短 Skill 索引。
21
+ - 默认跳过目标中已存在的资源;使用 `--force` 可覆盖已安装的 Skill 文件;无论是否覆盖,都会更新受管理的 `AGENTS.md` 索引区块。
22
22
 
23
23
  ## 技术栈
24
24
 
@@ -36,8 +36,7 @@ CLI 命令为 `ai-dev-kit`,运行环境要求 Node.js `>=18`。
36
36
  ai-dev-kit/
37
37
  ├── bin/ # 构建后的 CLI
38
38
  ├── codex/
39
- │ ├── rules/
40
- │ └── skills/
39
+ │ └── skills/ # Codex 内置 Skill
41
40
  ├── cursor/
42
41
  │ ├── commands/
43
42
  │ └── rules/
@@ -105,18 +104,17 @@ npx @xuxiao-dev/ai-dev-kit cursor add command readme-command
105
104
  npx @xuxiao-dev/ai-dev-kit codex add --all
106
105
  ```
107
106
 
108
- 也可以只安装某一类 Codex 资源:
107
+ 安装全部 Codex skills,也可以显式指定 Skill 类型:
109
108
 
110
109
  ```bash
111
110
  npx @xuxiao-dev/ai-dev-kit codex add skill --all
112
- npx @xuxiao-dev/ai-dev-kit codex add rule --all
113
111
  ```
114
112
 
115
- 安装单个 Codex skill 或 rule:
113
+ 安装单个 Codex skill:
116
114
 
117
115
  ```bash
118
- npx @xuxiao-dev/ai-dev-kit codex add skill generate-project-readme
119
- npx @xuxiao-dev/ai-dev-kit codex add rule ai-task-workflow-rule
116
+ npx @xuxiao-dev/ai-dev-kit codex add skill document-project-readme
117
+ npx @xuxiao-dev/ai-dev-kit codex add skill vue-component-config
120
118
  ```
121
119
 
122
120
  默认不会覆盖目标项目内已有资源。如需覆盖,请增加 `--force`:
@@ -134,10 +132,22 @@ npx @xuxiao-dev/ai-dev-kit codex add --all --force
134
132
  | --- | --- |
135
133
  | Cursor Rule | `ai-task-workflow-rule` |
136
134
  | Cursor Command | `commit`、`create-plan-from-brief`、`readme-command` |
137
- | Codex Skill | `bug-review`、`commit-staged-changes`、`generate-project-readme`、`optimize-blog`、`project-documentation` |
138
- | Codex Rule | `ai-task-workflow-rule` |
135
+ | Codex Skill | `content-blog-optimize`、`document-project-docs`、`document-project-readme`、`engineering-bug-review`、`git-commit-staged`、`vue-component-config` |
139
136
 
140
- 安装后,Cursor 资源会写入 `.cursor/rules/` 或 `.cursor/commands/`;Codex skills 会写入 `.agents/skills/`;Codex rules 会合并到目标项目的 `AGENTS.md`。
137
+ 安装后,Cursor 资源会写入 `.cursor/rules/` 或 `.cursor/commands/`;Codex skills 会写入 `.agents/skills/`,并在目标项目的 `AGENTS.md` 中追加由 ai-dev-kit 管理的 Skill 索引区块。完整 Skill 内容不会写入 `AGENTS.md`。
138
+
139
+ 目标项目中的 Codex 资源结构示例:
140
+
141
+ ```text
142
+ project/
143
+ ├── AGENTS.md
144
+ └── .agents/
145
+ └── skills/
146
+ └── vue-component-config/
147
+ └── SKILL.md
148
+ ```
149
+
150
+ `AGENTS.md` 只记录 Skill 的用途和路径;具体任务规范保存在对应的 `SKILL.md` 中。
141
151
 
142
152
  ## 环境变量
143
153
 
@@ -160,3 +170,31 @@ npm publish
160
170
 
161
171
  - 根据实际使用反馈补充或调整内置资源。
162
172
  - 为 CLI 行为补充自动化测试与使用示例。
173
+
174
+ ## 投资平台 Skill 套装
175
+
176
+ 面向 `multi-agent-investment` 的开发协作流程,显式安装五个独立 Skill:
177
+
178
+ ```bash
179
+ npx @xuxiao-dev/ai-dev-kit@latest codex add --multi-agent-investment
180
+ # 覆盖同名文件
181
+ npx @xuxiao-dev/ai-dev-kit@latest codex add --multi-agent-investment --force
182
+ ```
183
+
184
+ | 成员 | 用途 | 包内来源 |
185
+ | --- | --- | --- |
186
+ | `git-commit-staged` | Git 暂存区提交 | `codex/skills/git-commit-staged/` |
187
+ | `document-project-docs` | 项目文档组织与维护 | `codex/skills/document-project-docs/` |
188
+ | `staged-change-report` | 暂存区修改报告 | `codex/packs/multi-agent-investment/skills/staged-change-report/` |
189
+ | `project-ui-style` | 投资平台 UI 风格 | `codex/packs/multi-agent-investment/skills/project-ui-style/` |
190
+ | `project-verification` | 投资平台验证与本地验收 | `codex/packs/multi-agent-investment/skills/project-verification/` |
191
+
192
+ 前两份复用通用资源,后三份独立保存在 `codex/packs/multi-agent-investment/skills/`;套装清单为 `codex/packs/multi-agent-investment/manifest.json`。
193
+
194
+ `codex list` 单独列出此套装及其五个成员。`codex add --all`(以及 `codex add skill --all`)仍只安装原有六个通用 Skill,不包含此套装的三份新增资源。套装选项不能与 `--all` 或任何位置参数混用,仅允许搭配 `--force`。
195
+
196
+ 安装后,五个成员分别位于 `.agents/skills/<成员名>/`,完整保留 `SKILL.md`、`agents/openai.yaml` 及适用的 `references/`。安装前检查清单所列文件及 `AGENTS.md` 受管索引标记;安装沿用现有机制维护索引并保留用户其他内容。默认跳过已有同名目录,`--force` 合并覆盖同名文件,不删除目标目录额外文件。
197
+
198
+ 安装只复制资源并更新索引,不自动执行 Skill 中的测试、报告、暂存或提交操作;生成文件是否提交由使用者决定。UI 与验证规范仅适用于投资平台,使用时仍需核对目标仓库当前实现。
199
+
200
+ 投资平台套装从 `0.2.1` 版本提供,远程用户需在该版本正式发布后使用新选项;包名保持不变。
package/bin/ai-dev-kit.js CHANGED
@@ -172,17 +172,43 @@ import path3 from "path";
172
172
  import fs2 from "fs-extra";
173
173
  import { Command as Command2 } from "commander";
174
174
  import pc2 from "picocolors";
175
- var RULE_START = "<!-- ai-dev-kit:codex-rule:";
175
+ var SKILL_INDEX_START = "<!-- ai-dev-kit:codex-skills:start -->";
176
+ var SKILL_INDEX_END = "<!-- ai-dev-kit:codex-skills:end -->";
177
+ async function getInvestmentPack(packageRoot2) {
178
+ const manifestPath = path3.join(packageRoot2, "codex", "packs", "multi-agent-investment", "manifest.json");
179
+ const manifest = await fs2.readJson(manifestPath);
180
+ if (!Array.isArray(manifest.skills) || manifest.skills.length !== 5) throw new Error("Invalid multi-agent-investment pack manifest.");
181
+ const expected = ["git-commit-staged", "document-project-docs", "staged-change-report", "project-ui-style", "project-verification"];
182
+ for (const [index, skill] of manifest.skills.entries()) {
183
+ const source = index < 2 ? `codex/skills/${expected[index]}` : `codex/packs/multi-agent-investment/skills/${expected[index]}`;
184
+ if (skill.name !== expected[index] || skill.source !== source || typeof skill.description !== "string" || !skill.description.trim() || !Array.isArray(skill.files) || !skill.files.includes("SKILL.md") || !skill.files.includes("agents/openai.yaml") || skill.files.some((file) => typeof file !== "string" || !file || file.includes("\\") || path3.posix.isAbsolute(file) || file.split("/").includes(".."))) {
185
+ throw new Error("Invalid multi-agent-investment pack manifest.");
186
+ }
187
+ }
188
+ return manifest.skills;
189
+ }
190
+ var SKILL_DESCRIPTIONS = {
191
+ "content-blog-optimize": "\u4E2D\u6587\u6280\u672F\u535A\u5BA2\u4F18\u5316",
192
+ "document-project-docs": "\u9879\u76EE\u6587\u6863\u7EC4\u7EC7\u4E0E\u7EF4\u62A4",
193
+ "document-project-readme": "\u9879\u76EE README \u751F\u6210\u4E0E\u7EF4\u62A4",
194
+ "engineering-bug-review": "\u5DE5\u7A0B\u95EE\u9898\u590D\u76D8",
195
+ "git-commit-staged": "Git \u6682\u5B58\u533A\u63D0\u4EA4",
196
+ "staged-change-report": "\u6682\u5B58\u533A\u4FEE\u6539\u62A5\u544A",
197
+ "project-ui-style": "\u6295\u8D44\u5E73\u53F0 UI \u98CE\u683C",
198
+ "project-verification": "\u6295\u8D44\u5E73\u53F0\u9A8C\u8BC1\u4E0E\u672C\u5730\u9A8C\u6536",
199
+ "vue-component-config": "Vue \u7EC4\u4EF6\u914D\u7F6E\u89C4\u8303"
200
+ };
176
201
  function createCodexCommand(context) {
177
- const codex = new Command2("codex").description("Manage Codex skills and project rules.");
178
- codex.command("list").description("List built-in Codex resources.").action(async () => {
179
- const resources = await getCodexResources(context.packageRoot);
202
+ const codex = new Command2("codex").description("Manage Codex skills for the current project.");
203
+ codex.command("list").description("List built-in Codex skills.").action(async () => {
204
+ const skills = await getCodexSkills(context.packageRoot);
180
205
  console.log(pc2.bold("Codex Skills:"));
181
- printResourceList2(resources.skill);
182
- console.log(pc2.bold("Codex Rules:"));
183
- printResourceList2(resources.rule);
206
+ printResourceList2(skills);
207
+ console.log(pc2.bold("\nOptional skill pack: multi-agent-investment"));
208
+ const pack = await getInvestmentPack(context.packageRoot);
209
+ pack.forEach(({ name, description }) => console.log(`- ${name}: ${description}`));
184
210
  });
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) => {
211
+ codex.command("add").description("Install Codex skills into the current project.").argument("[type]", "Resource type: skill").argument("[name]", "Skill name to install").option("--all", "Install all Codex skills").option("--multi-agent-investment", "Install the multi-agent-investment skill pack").option("--force", "Overwrite existing skill files (the managed AGENTS.md index is always updated)").action(async (type, name, options) => {
186
212
  await handleAdd2(context.packageRoot, type, name, options);
187
213
  });
188
214
  return codex;
@@ -190,59 +216,66 @@ function createCodexCommand(context) {
190
216
  async function handleAdd2(packageRoot2, rawType, name, options) {
191
217
  const mode = options.force ? "overwrite" : "skip";
192
218
  const projectRoot = process.cwd();
219
+ if (options.multiAgentInvestment) {
220
+ if (options.all || rawType || name) throw new Error("Use --multi-agent-investment by itself, with optional --force.");
221
+ await validateSkillPack(packageRoot2, projectRoot);
222
+ const pack = await getInvestmentPack(packageRoot2);
223
+ for (const skill of pack) SKILL_DESCRIPTIONS[skill.name] = skill.description;
224
+ for (const skill of pack) await installSkill(packageRoot2, projectRoot, skill.name, mode, skill.source);
225
+ return;
226
+ }
193
227
  if (options.all) {
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);
196
- const resources2 = await getCodexResources(packageRoot2);
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
- }
228
+ if (name) throw new Error('Do not provide a skill name with --all. Use "codex add --all" or "codex add skill --all".');
229
+ normalizeResourceType2(rawType);
230
+ const skills2 = await getCodexSkills(packageRoot2);
231
+ for (const skill of skills2) await installSkill(packageRoot2, projectRoot, skill, mode);
203
232
  return;
204
233
  }
205
234
  const type = normalizeResourceType2(rawType);
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");
207
- const resources = await getCodexResources(packageRoot2);
208
- if (!resources[type].includes(name)) {
209
- throw new Error(`Unknown Codex ${type}: ${name}
210
- Available ${type}s: ${formatAvailable2(resources[type])}`);
235
+ if (!type || !name) throw new Error("Missing arguments. Usage: ai-dev-kit codex add skill <name>, ai-dev-kit codex add skill --all, or ai-dev-kit codex add --all");
236
+ const skills = await getCodexSkills(packageRoot2);
237
+ if (!skills.includes(name)) {
238
+ throw new Error(`Unknown Codex skill: ${name}
239
+ Available skills: ${formatAvailable2(skills)}`);
211
240
  }
212
- if (type === "skill") await installSkill(packageRoot2, projectRoot, name, mode);
213
- else await installRule(packageRoot2, projectRoot, name, mode);
241
+ await installSkill(packageRoot2, projectRoot, name, mode);
214
242
  }
215
- async function installSkill(packageRoot2, projectRoot, name, mode) {
243
+ async function installSkill(packageRoot2, projectRoot, name, mode, sourcePath) {
216
244
  const targetPath = path3.join(".agents", "skills", name);
217
245
  const result = await copyPathWithMode(
218
- path3.join(packageRoot2, "codex", "skills", name),
246
+ path3.join(packageRoot2, sourcePath ?? path3.join("codex", "skills", name)),
219
247
  path3.join(projectRoot, targetPath),
220
248
  mode
221
249
  );
222
250
  printCopyResult(targetPath, result);
251
+ await updateSkillIndex(projectRoot, name);
223
252
  }
224
- async function installRule(packageRoot2, projectRoot, name, mode) {
225
- const source = path3.join(packageRoot2, "codex", "rules", `${name}.md`);
226
- const rule = await fs2.readFile(source, "utf8");
253
+ async function updateSkillIndex(projectRoot, name) {
227
254
  const target = path3.join(projectRoot, "AGENTS.md");
228
- const start = `${RULE_START}${name}:start -->`;
229
- const end = `<!-- ai-dev-kit:codex-rule:${name}:end -->`;
230
- const block = `${start}
231
-
232
- ${rule.trim()}
233
-
234
- ${end}`;
235
255
  const existing = await fs2.pathExists(target) ? await fs2.readFile(target, "utf8") : "";
236
- const startIndex = existing.indexOf(start);
256
+ const startIndex = existing.indexOf(SKILL_INDEX_START);
257
+ const names = /* @__PURE__ */ new Set();
237
258
  if (startIndex >= 0) {
238
- if (mode === "skip") {
239
- console.log(pc2.yellow(`Skipped existing rule: AGENTS.md (${name})`));
240
- return;
241
- }
242
- const endIndex = existing.indexOf(end, startIndex);
243
- if (endIndex < 0) throw new Error(`Cannot replace ${name}: its managed block in AGENTS.md is incomplete.`);
244
- await fs2.writeFile(target, `${existing.slice(0, startIndex)}${block}${existing.slice(endIndex + end.length)}`);
245
- console.log(pc2.green(`Overwritten rule: AGENTS.md (${name})`));
259
+ const endIndex = existing.indexOf(SKILL_INDEX_END, startIndex);
260
+ if (endIndex < 0) throw new Error("Cannot update AGENTS.md: its managed Codex skill index is incomplete.");
261
+ const managedBlock = existing.slice(startIndex, endIndex);
262
+ for (const match of managedBlock.matchAll(/\.agents\/skills\/([a-z0-9-]+)\/SKILL\.md/g)) names.add(match[1]);
263
+ }
264
+ names.add(name);
265
+ const block = [
266
+ SKILL_INDEX_START,
267
+ "",
268
+ "## \u53EF\u7528\u9879\u76EE Skills",
269
+ "",
270
+ "\u6D89\u53CA\u5BF9\u5E94\u4EFB\u52A1\u65F6\uFF0C\u5148\u9605\u8BFB\u76F8\u5173 Skill\uFF1A",
271
+ "",
272
+ ...[...names].sort((a, b) => a.localeCompare(b)).map((skill) => `- ${SKILL_DESCRIPTIONS[skill] ?? skill}\uFF1A.agents/skills/${skill}/SKILL.md`),
273
+ "",
274
+ SKILL_INDEX_END
275
+ ].join("\n");
276
+ if (startIndex >= 0) {
277
+ const endIndex = existing.indexOf(SKILL_INDEX_END, startIndex);
278
+ await fs2.writeFile(target, `${existing.slice(0, startIndex)}${block}${existing.slice(endIndex + SKILL_INDEX_END.length)}`);
246
279
  return;
247
280
  }
248
281
  await fs2.writeFile(target, existing.trimEnd() ? `${existing.trimEnd()}
@@ -250,19 +283,32 @@ ${end}`;
250
283
  ${block}
251
284
  ` : `${block}
252
285
  `);
253
- console.log(pc2.green(`Installed rule: AGENTS.md (${name})`));
254
286
  }
255
- async function getCodexResources(packageRoot2) {
256
- const [skills, rules] = await Promise.all([
257
- listDirectoryNames(path3.join(packageRoot2, "codex", "skills"), "SKILL.md"),
258
- listResourceNames(path3.join(packageRoot2, "codex", "rules"), ".md")
259
- ]);
260
- return { skill: skills, rule: rules };
287
+ async function getCodexSkills(packageRoot2) {
288
+ return listDirectoryNames(path3.join(packageRoot2, "codex", "skills"), "SKILL.md");
289
+ }
290
+ async function validateSkillPack(packageRoot2, projectRoot) {
291
+ const pack = await getInvestmentPack(packageRoot2);
292
+ const missing = [];
293
+ for (const skill of pack) {
294
+ const source = path3.join(packageRoot2, skill.source);
295
+ for (const file of skill.files) {
296
+ const stat = await fs2.stat(path3.join(source, file)).catch(() => void 0);
297
+ if (!stat?.isFile()) missing.push(`${skill.name}/${file}`);
298
+ }
299
+ }
300
+ const agentsPath = path3.join(projectRoot, "AGENTS.md");
301
+ if (await fs2.pathExists(agentsPath)) {
302
+ const existing = await fs2.readFile(agentsPath, "utf8");
303
+ const start = existing.indexOf(SKILL_INDEX_START);
304
+ const end = existing.indexOf(SKILL_INDEX_END);
305
+ if (start >= 0 !== end >= 0 || start >= 0 && (end < start || existing.indexOf(SKILL_INDEX_START, start + SKILL_INDEX_START.length) >= 0 || existing.indexOf(SKILL_INDEX_END, end + SKILL_INDEX_END.length) >= 0)) missing.push("AGENTS.md managed index");
306
+ }
307
+ if (missing.length) throw new Error(`Cannot install multi-agent-investment pack; incomplete resources: ${missing.join(", ")}`);
261
308
  }
262
309
  function normalizeResourceType2(type) {
263
- if (type === "skill" || type === "rule") return type;
264
- if (type) throw new Error('Invalid resource type. Use "skill" or "rule".');
265
- return void 0;
310
+ if (type === void 0 || type === "skill") return "skill";
311
+ throw new Error('Invalid resource type. Use "skill".');
266
312
  }
267
313
  function printCopyResult(targetPath, result) {
268
314
  const label = result === "installed" ? "Installed" : result === "overwritten" ? "Overwritten" : "Skipped existing file";
@@ -288,7 +334,7 @@ function getPackageRoot(cliImportMetaUrl) {
288
334
  // src/cli.ts
289
335
  var program = new Command3();
290
336
  var packageRoot = getPackageRoot(import.meta.url);
291
- program.name("ai-dev-kit").description("Install AI development helper resources into your project.").version("0.1.1").showHelpAfterError().showSuggestionAfterError();
337
+ program.name("ai-dev-kit").description("Install AI development helper resources into your project.").version("0.2.1").showHelpAfterError().showSuggestionAfterError();
292
338
  program.addCommand(createCursorCommand({ packageRoot }));
293
339
  program.addCommand(createCodexCommand({ packageRoot }));
294
340
  program.exitOverride();
@@ -0,0 +1,208 @@
1
+ <!doctype html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>Codex 资源观察台</title>
7
+ <style>
8
+ :root {
9
+ color-scheme: light;
10
+ --ink: #162033;
11
+ --muted: #667085;
12
+ --line: #e4e7ec;
13
+ --paper: #ffffff;
14
+ --canvas: #f6f8fb;
15
+ --blue: #2563eb;
16
+ --blue-soft: #eff6ff;
17
+ --green: #15803d;
18
+ --green-soft: #f0fdf4;
19
+ }
20
+
21
+ * { box-sizing: border-box; }
22
+ body {
23
+ margin: 0;
24
+ min-width: 320px;
25
+ color: var(--ink);
26
+ background: var(--canvas);
27
+ font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
28
+ }
29
+
30
+ header {
31
+ padding: 28px clamp(20px, 5vw, 72px);
32
+ color: #fff;
33
+ background: linear-gradient(120deg, #172554, #1d4ed8);
34
+ }
35
+ h1 { margin: 0; font-size: clamp(24px, 4vw, 36px); letter-spacing: -.03em; }
36
+ header p { max-width: 680px; margin: 8px 0 0; color: #dbeafe; }
37
+
38
+ main { max-width: 1280px; margin: 0 auto; padding: 24px clamp(16px, 3vw, 36px) 48px; }
39
+ .summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
40
+ .counts { display: flex; gap: 10px; flex-wrap: wrap; }
41
+ .pill { padding: 5px 10px; border-radius: 999px; color: var(--blue); background: var(--blue-soft); font-size: 13px; font-weight: 650; }
42
+ .pill.rule { color: var(--green); background: var(--green-soft); }
43
+ .search {
44
+ width: min(320px, 100%); padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
45
+ outline: none; background: var(--paper); font: inherit;
46
+ }
47
+ .search:focus { border-color: var(--blue); box-shadow: 0 0 0 3px #dbeafe; }
48
+
49
+ .layout { display: grid; grid-template-columns: minmax(260px, .86fr) minmax(0, 1.5fr); gap: 20px; }
50
+ .panel { min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: 0 1px 2px #1018280d; }
51
+ .panel-title { display: flex; justify-content: space-between; align-items: center; margin: 0; padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
52
+ .resource-list { padding: 8px; }
53
+ .resource {
54
+ display: block; width: 100%; margin: 0; padding: 11px 10px; border: 0; border-radius: 8px; color: inherit;
55
+ background: transparent; text-align: left; cursor: pointer; font: inherit;
56
+ }
57
+ .resource:hover, .resource.active { background: var(--blue-soft); }
58
+ .resource-name { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; }
59
+ .resource-path { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
60
+ .tag { flex: none; padding: 1px 6px; border-radius: 4px; color: var(--green); background: var(--green-soft); font-size: 11px; font-weight: 700; }
61
+ .tag.skill { color: var(--blue); background: var(--blue-soft); }
62
+ .empty { padding: 28px 16px; color: var(--muted); text-align: center; }
63
+
64
+ .detail { padding: 20px; }
65
+ .detail-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
66
+ h2 { margin: 0; font-size: 22px; }
67
+ .description { margin: 8px 0 18px; color: var(--muted); }
68
+ .meta { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 8px 12px; margin: 0 0 18px; font-size: 13px; }
69
+ dt { color: var(--muted); } dd { margin: 0; overflow-wrap: anywhere; }
70
+ .source {
71
+ min-height: 260px; max-height: 58vh; margin: 0; padding: 16px; overflow: auto; border-radius: 8px;
72
+ color: #d0d5dd; background: #101828; font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; white-space: pre-wrap;
73
+ }
74
+ .source.loading { color: #98a2b3; }
75
+ .open { padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--blue); text-decoration: none; font-size: 13px; white-space: nowrap; }
76
+ .open:hover { border-color: var(--blue); background: var(--blue-soft); }
77
+ .hint { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
78
+
79
+ @media (max-width: 760px) {
80
+ .summary { align-items: stretch; flex-direction: column; }
81
+ .search { width: 100%; }
82
+ .layout { grid-template-columns: 1fr; }
83
+ .source { max-height: 42vh; }
84
+ }
85
+ </style>
86
+ </head>
87
+ <body>
88
+ <header>
89
+ <h1>Codex 资源观察台</h1>
90
+ <p>浏览通用 Skills 与可选投资平台套装;选择资源即可阅读当前 Markdown 源文件。</p>
91
+ </header>
92
+
93
+ <main>
94
+ <div class="summary">
95
+ <div class="counts" id="counts"></div>
96
+ <input class="search" id="search" type="search" placeholder="搜索名称、说明或路径…" aria-label="搜索 Codex 资源" />
97
+ </div>
98
+
99
+ <p>通用资源使用 <code>codex add --all</code>;投资平台套装显式使用 <code>codex add --multi-agent-investment</code>,包含 git-commit-staged、document-project-docs、staged-change-report、project-ui-style、project-verification,前两份复用通用资源。</p>
100
+ <section class="layout" aria-label="Codex 资源列表与详情">
101
+ <aside class="panel">
102
+ <h2 class="panel-title">资源列表 <span id="result-count"></span></h2>
103
+ <div class="resource-list" id="resource-list"></div>
104
+ </aside>
105
+ <article class="panel">
106
+ <div class="detail" id="detail"></div>
107
+ </article>
108
+ </section>
109
+ </main>
110
+
111
+ <script>
112
+ const resources = [
113
+ {
114
+ type: 'skill', name: 'vue-component-config', path: 'skills/vue-component-config/SKILL.md',
115
+ description: 'Vue 组件参数、配置对象与 CSS 变量的组织约定。'
116
+ },
117
+ {
118
+ type: 'skill', name: 'engineering-bug-review', path: 'skills/engineering-bug-review/SKILL.md',
119
+ description: '基于对话、代码和错误证据生成工程问题复盘。'
120
+ },
121
+ {
122
+ type: 'skill', name: 'git-commit-staged', path: 'skills/git-commit-staged/SKILL.md',
123
+ description: '分析暂存区并创建一条安全的中文 Conventional Commit。'
124
+ },
125
+ {
126
+ type: 'skill', name: 'document-project-readme', path: 'skills/document-project-readme/SKILL.md',
127
+ description: '基于真实项目结构和配置生成或更新 README。'
128
+ },
129
+ {
130
+ type: 'skill', name: 'content-blog-optimize', path: 'skills/content-blog-optimize/SKILL.md',
131
+ description: '优化中文技术博客的结构、表达与发布排版。'
132
+ },
133
+ {
134
+ type: 'skill', name: 'document-project-docs', path: 'skills/document-project-docs/SKILL.md',
135
+ description: '创建、归档与维护项目文档及其索引和敏感边界。'
136
+ }
137
+ ];
138
+
139
+ resources.push(...[{"type": "skill", "name": "staged-change-report", "path": "packs/multi-agent-investment/skills/staged-change-report/SKILL.md", "description": "投资平台可选套装:暂存区修改报告"}, {"type": "skill", "name": "project-ui-style", "path": "packs/multi-agent-investment/skills/project-ui-style/SKILL.md", "description": "投资平台可选套装:投资平台 UI 风格"}, {"type": "skill", "name": "project-verification", "path": "packs/multi-agent-investment/skills/project-verification/SKILL.md", "description": "投资平台可选套装:投资平台验证与本地验收"}]);
140
+
141
+ const list = document.querySelector('#resource-list');
142
+ const detail = document.querySelector('#detail');
143
+ const search = document.querySelector('#search');
144
+ const resultCount = document.querySelector('#result-count');
145
+ const counts = document.querySelector('#counts');
146
+ let selected = resources[0];
147
+
148
+ function escapeHtml(value) {
149
+ return value.replace(/[&<>'"]/g, (character) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', "'": '&#039;', '"': '&quot;' })[character]);
150
+ }
151
+
152
+ function renderCounts() {
153
+ const skillCount = resources.filter((resource) => resource.type === 'skill').length;
154
+ const ruleCount = resources.length - skillCount;
155
+ counts.innerHTML = `<span class="pill">6 通用 skills · 1 可选套装(5 成员)</span><span class="pill rule">${ruleCount} rule${ruleCount === 1 ? '' : 's'}</span>`;
156
+ }
157
+
158
+ function filteredResources() {
159
+ const query = search.value.trim().toLowerCase();
160
+ return resources.filter((resource) => !query || `${resource.name} ${resource.path} ${resource.description}`.toLowerCase().includes(query));
161
+ }
162
+
163
+ function renderList() {
164
+ const visible = filteredResources();
165
+ resultCount.textContent = `${visible.length} 项`;
166
+ if (!visible.length) {
167
+ list.innerHTML = '<p class="empty">没有匹配的资源</p>';
168
+ return;
169
+ }
170
+ list.innerHTML = visible.map((resource) => `
171
+ <button class="resource ${resource === selected ? 'active' : ''}" data-name="${resource.name}">
172
+ <span class="resource-name"><span>${resource.name}</span><span class="tag ${resource.type}">${resource.type}</span></span>
173
+ <span class="resource-path">${resource.path}</span>
174
+ </button>
175
+ `).join('');
176
+ list.querySelectorAll('.resource').forEach((button) => button.addEventListener('click', () => {
177
+ selected = resources.find((resource) => resource.name === button.dataset.name);
178
+ renderList();
179
+ renderDetail();
180
+ }));
181
+ }
182
+
183
+ async function renderDetail() {
184
+ detail.innerHTML = `
185
+ <div class="detail-top"><div><h2>${selected.name}</h2><p class="description">${selected.description}</p></div><a class="open" href="${selected.path}" target="_blank" rel="noopener">打开文件 ↗</a></div>
186
+ <dl class="meta"><dt>类型</dt><dd>${selected.type}</dd><dt>相对路径</dt><dd>${selected.path}</dd></dl>
187
+ <pre class="source loading">正在读取源文件…</pre>
188
+ <p class="hint">提示:请从仓库根目录运行 <code>python3 -m http.server 8000</code>,再打开 <code>http://localhost:8000/codex/</code>。</p>
189
+ `;
190
+ const source = detail.querySelector('.source');
191
+ try {
192
+ const response = await fetch(selected.path, { cache: 'no-store' });
193
+ if (!response.ok) throw new Error(`HTTP ${response.status}`);
194
+ source.classList.remove('loading');
195
+ source.innerHTML = escapeHtml(await response.text());
196
+ } catch (error) {
197
+ source.classList.remove('loading');
198
+ source.textContent = `无法读取 ${selected.path}\n\n请使用本地 HTTP 服务打开本页面,或点击“打开文件”。\n${error.message}`;
199
+ }
200
+ }
201
+
202
+ search.addEventListener('input', renderList);
203
+ renderCounts();
204
+ renderList();
205
+ renderDetail();
206
+ </script>
207
+ </body>
208
+ </html>
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "multi-agent-investment",
3
+ "skills": [
4
+ {
5
+ "name": "git-commit-staged",
6
+ "description": "Git 暂存区提交",
7
+ "source": "codex/skills/git-commit-staged",
8
+ "files": [
9
+ "SKILL.md",
10
+ "agents/openai.yaml"
11
+ ]
12
+ },
13
+ {
14
+ "name": "document-project-docs",
15
+ "description": "项目文档组织与维护",
16
+ "source": "codex/skills/document-project-docs",
17
+ "files": [
18
+ "SKILL.md",
19
+ "agents/openai.yaml"
20
+ ]
21
+ },
22
+ {
23
+ "name": "staged-change-report",
24
+ "description": "暂存区修改报告",
25
+ "source": "codex/packs/multi-agent-investment/skills/staged-change-report",
26
+ "files": [
27
+ "SKILL.md",
28
+ "agents/openai.yaml"
29
+ ]
30
+ },
31
+ {
32
+ "name": "project-ui-style",
33
+ "description": "投资平台 UI 风格",
34
+ "source": "codex/packs/multi-agent-investment/skills/project-ui-style",
35
+ "files": [
36
+ "SKILL.md",
37
+ "agents/openai.yaml",
38
+ "references/component-guide.md",
39
+ "references/page-patterns.md",
40
+ "references/visual-guidelines.md"
41
+ ]
42
+ },
43
+ {
44
+ "name": "project-verification",
45
+ "description": "投资平台验证与本地验收",
46
+ "source": "codex/packs/multi-agent-investment/skills/project-verification",
47
+ "files": [
48
+ "SKILL.md",
49
+ "agents/openai.yaml",
50
+ "references/local-environments.md",
51
+ "references/optional-mock.md",
52
+ "references/verification-guide.md"
53
+ ]
54
+ }
55
+ ]
56
+ }
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: project-ui-style
3
+ description: 为 multi-agent-investment 项目设计、改造或审查 Web 页面 UI、交互布局及组件样式,延续已确认的新版视觉并复用现有组件。不用于后端邮件 HTML、权限体系设计或纯业务逻辑修改。
4
+ ---
5
+
6
+ # 项目 UI 风格
7
+
8
+ 将本项目已确认的新版界面作为设计基线,不重新创造一套视觉系统。用户明确提出的设计要求优先;本 Skill 不授权扩展功能或改造无关页面。
9
+
10
+ ## 按任务阅读
11
+
12
+ - 先按用户任务判断页面模式。设计新页面或重排布局时,阅读 [页面模式](references/page-patterns.md),选择对象列表、信息详情、设置表单或数据总览;混合页面按主要任务组织,不强行套单一模板。
13
+ - 做视觉、布局或响应式设计前,阅读 [视觉与交互规范](references/visual-guidelines.md)。
14
+ - 修改实现或选择复用组件前,阅读 [组件与代码定位](references/component-guide.md),再查看目标组件及调用方的当前代码。
15
+ - 只讨论方案时不修改代码;仅要求效果图时,不把示例数据或新增功能写进正式代码。
16
+
17
+ ## 核心约束
18
+
19
+ - 延续浅色背景、单层白色卡片、轻边框、青绿色主操作和清晰信息层级。避免重复标题、厚重嵌套、渐变和无业务意义的装饰。
20
+ - 优先复用共享组件、语义字号和颜色 Token。Skill 只记录规则与定位,不复制 CSS 或维护第二套数值表。
21
+ - 以职责一致为复用前提。确有稳定布局差异时使用语义明确的 `variant`,不传页面名或任意样式对象集中所有差异,不为假想场景过度抽象。
22
+ - 局部改造默认放入 CSS Module;不顺带修改全局样式、导航、业务语义或权限。确需修改共享组件时,检查全部调用方并验证兼容性。
23
+ - 保留加载、失败、空数据、未登录和权限不足的区别。未知金额不显示为零,旧数据不表现为最新数据,权限不足不表现为未登录。
24
+ - 新增界面文案进入中英文词典,动态业务原文不强行翻译。错误不泄露凭证或内部响应;权限控制的诊断沿用现有后端鉴权。
25
+
26
+ ## 工作与交付
27
+
28
+ 1. 确认目标页面、用户任务及修改范围,检查账户状态、数据来源和组件调用关系。
29
+ 2. 选择页面模式和最接近的新版参考,简要说明主要操作、信息层级及偏离推荐基线的必要理由;允许有理由的例外,不因统一风格改造所有页面。
30
+ 3. 实施时保留接口、金额计算、业务操作、路由和刷新行为;未包含的业务变更单独提出。
31
+ 4. 按风险验证中英文、长内容、移动端、键盘和数据状态。UI 代码变更使用项目现有验证流程;只整理文档或 Skill 时不运行应用测试。
32
+ 5. 交付时说明范围、复用选择、已完成与未完成的验证,不把效果图当作真实接口或全部客户端验收。
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "项目 UI 风格"
3
+ short_description: "延续本项目新版界面风格,规范页面布局、共享组件复用与交互状态"
4
+ default_prompt: "使用 $project-ui-style,按本项目已确认的新版 UI 风格设计或改造目标页面,优先复用现有组件并保留业务行为。"