@xuxiao-dev/ai-dev-kit 0.1.4 → 0.2.0
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 +7 -8
- package/bin/ai-dev-kit.js +54 -54
- package/codex/index.html +205 -0
- package/codex/skills/{optimize-blog → content-blog-optimize}/SKILL.md +1 -1
- package/codex/skills/{optimize-blog → content-blog-optimize}/agents/openai.yaml +1 -1
- package/codex/skills/{project-documentation → document-project-docs}/SKILL.md +1 -1
- package/codex/skills/{project-documentation → document-project-docs}/agents/openai.yaml +1 -1
- package/codex/skills/{generate-project-readme → document-project-readme}/SKILL.md +1 -1
- package/codex/skills/{generate-project-readme → document-project-readme}/agents/openai.yaml +1 -1
- package/codex/skills/{bug-review → engineering-bug-review}/SKILL.md +1 -1
- package/codex/skills/{bug-review → engineering-bug-review}/agents/openai.yaml +1 -1
- package/codex/skills/{commit-staged-changes → git-commit-staged}/SKILL.md +1 -1
- package/codex/skills/{commit-staged-changes → git-commit-staged}/agents/openai.yaml +1 -1
- package/codex/{rules/vue-component-config-rule.md → skills/vue-component-config/SKILL.md} +6 -1
- package/codex/skills/vue-component-config/agents/openai.yaml +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -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
|
|
21
|
-
- 默认跳过目标中已存在的资源;使用 `--force`
|
|
20
|
+
- 将 Codex skills 安装到 `.agents/skills/`,并在 `AGENTS.md` 中维护简短索引。
|
|
21
|
+
- 默认跳过目标中已存在的资源;使用 `--force` 可覆盖已安装的 Skill 或更新受管理的 `AGENTS.md` 索引区块。
|
|
22
22
|
|
|
23
23
|
## 技术栈
|
|
24
24
|
|
|
@@ -112,11 +112,11 @@ npx @xuxiao-dev/ai-dev-kit codex add skill --all
|
|
|
112
112
|
npx @xuxiao-dev/ai-dev-kit codex add rule --all
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
-
安装单个 Codex skill
|
|
115
|
+
安装单个 Codex skill:
|
|
116
116
|
|
|
117
117
|
```bash
|
|
118
|
-
npx @xuxiao-dev/ai-dev-kit codex add skill
|
|
119
|
-
npx @xuxiao-dev/ai-dev-kit codex add
|
|
118
|
+
npx @xuxiao-dev/ai-dev-kit codex add skill document-project-readme
|
|
119
|
+
npx @xuxiao-dev/ai-dev-kit codex add skill vue-component-config
|
|
120
120
|
```
|
|
121
121
|
|
|
122
122
|
默认不会覆盖目标项目内已有资源。如需覆盖,请增加 `--force`:
|
|
@@ -134,10 +134,9 @@ npx @xuxiao-dev/ai-dev-kit codex add --all --force
|
|
|
134
134
|
| --- | --- |
|
|
135
135
|
| Cursor Rule | `ai-task-workflow-rule` |
|
|
136
136
|
| Cursor Command | `commit`、`create-plan-from-brief`、`readme-command` |
|
|
137
|
-
| Codex Skill | `
|
|
138
|
-
| Codex Rule | `ai-task-workflow-rule` |
|
|
137
|
+
| Codex Skill | `content-blog-optimize`、`document-project-docs`、`document-project-readme`、`engineering-bug-review`、`git-commit-staged`、`vue-component-config` |
|
|
139
138
|
|
|
140
|
-
安装后,Cursor 资源会写入 `.cursor/rules/` 或 `.cursor/commands/`;Codex skills 会写入 `.agents/skills
|
|
139
|
+
安装后,Cursor 资源会写入 `.cursor/rules/` 或 `.cursor/commands/`;Codex skills 会写入 `.agents/skills/`,并在目标项目的 `AGENTS.md` 中追加由 ai-dev-kit 管理的 Skill 索引区块。完整 Skill 内容不会写入 `AGENTS.md`。
|
|
141
140
|
|
|
142
141
|
## 环境变量
|
|
143
142
|
|
package/bin/ai-dev-kit.js
CHANGED
|
@@ -172,17 +172,24 @@ 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
|
|
175
|
+
var SKILL_INDEX_START = "<!-- ai-dev-kit:codex-skills:start -->";
|
|
176
|
+
var SKILL_INDEX_END = "<!-- ai-dev-kit:codex-skills:end -->";
|
|
177
|
+
var SKILL_DESCRIPTIONS = {
|
|
178
|
+
"content-blog-optimize": "\u4E2D\u6587\u6280\u672F\u535A\u5BA2\u4F18\u5316",
|
|
179
|
+
"document-project-docs": "\u9879\u76EE\u6587\u6863\u7EC4\u7EC7\u4E0E\u7EF4\u62A4",
|
|
180
|
+
"document-project-readme": "\u9879\u76EE README \u751F\u6210\u4E0E\u7EF4\u62A4",
|
|
181
|
+
"engineering-bug-review": "\u5DE5\u7A0B\u95EE\u9898\u590D\u76D8",
|
|
182
|
+
"git-commit-staged": "Git \u6682\u5B58\u533A\u63D0\u4EA4",
|
|
183
|
+
"vue-component-config": "Vue \u7EC4\u4EF6\u914D\u7F6E\u89C4\u8303"
|
|
184
|
+
};
|
|
176
185
|
function createCodexCommand(context) {
|
|
177
|
-
const codex = new Command2("codex").description("Manage Codex skills
|
|
178
|
-
codex.command("list").description("List built-in Codex
|
|
179
|
-
const
|
|
186
|
+
const codex = new Command2("codex").description("Manage Codex skills for the current project.");
|
|
187
|
+
codex.command("list").description("List built-in Codex skills.").action(async () => {
|
|
188
|
+
const skills = await getCodexSkills(context.packageRoot);
|
|
180
189
|
console.log(pc2.bold("Codex Skills:"));
|
|
181
|
-
printResourceList2(
|
|
182
|
-
console.log(pc2.bold("Codex Rules:"));
|
|
183
|
-
printResourceList2(resources.rule);
|
|
190
|
+
printResourceList2(skills);
|
|
184
191
|
});
|
|
185
|
-
codex.command("add").description("Install Codex
|
|
192
|
+
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("--force", "Overwrite an existing skill or replace the managed AGENTS.md index").action(async (type, name, options) => {
|
|
186
193
|
await handleAdd2(context.packageRoot, type, name, options);
|
|
187
194
|
});
|
|
188
195
|
return codex;
|
|
@@ -191,26 +198,20 @@ async function handleAdd2(packageRoot2, rawType, name, options) {
|
|
|
191
198
|
const mode = options.force ? "overwrite" : "skip";
|
|
192
199
|
const projectRoot = process.cwd();
|
|
193
200
|
if (options.all) {
|
|
194
|
-
if (name) throw new Error('Do not provide a
|
|
195
|
-
|
|
196
|
-
const
|
|
197
|
-
|
|
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
|
-
}
|
|
201
|
+
if (name) throw new Error('Do not provide a skill name with --all. Use "codex add --all" or "codex add skill --all".');
|
|
202
|
+
normalizeResourceType2(rawType);
|
|
203
|
+
const skills2 = await getCodexSkills(packageRoot2);
|
|
204
|
+
for (const skill of skills2) await installSkill(packageRoot2, projectRoot, skill, mode);
|
|
203
205
|
return;
|
|
204
206
|
}
|
|
205
207
|
const type = normalizeResourceType2(rawType);
|
|
206
|
-
if (!type || !name) throw new Error("Missing arguments. Usage: ai-dev-kit codex add
|
|
207
|
-
const
|
|
208
|
-
if (!
|
|
209
|
-
throw new Error(`Unknown Codex
|
|
210
|
-
Available
|
|
208
|
+
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");
|
|
209
|
+
const skills = await getCodexSkills(packageRoot2);
|
|
210
|
+
if (!skills.includes(name)) {
|
|
211
|
+
throw new Error(`Unknown Codex skill: ${name}
|
|
212
|
+
Available skills: ${formatAvailable2(skills)}`);
|
|
211
213
|
}
|
|
212
|
-
|
|
213
|
-
else await installRule(packageRoot2, projectRoot, name, mode);
|
|
214
|
+
await installSkill(packageRoot2, projectRoot, name, mode);
|
|
214
215
|
}
|
|
215
216
|
async function installSkill(packageRoot2, projectRoot, name, mode) {
|
|
216
217
|
const targetPath = path3.join(".agents", "skills", name);
|
|
@@ -220,29 +221,34 @@ async function installSkill(packageRoot2, projectRoot, name, mode) {
|
|
|
220
221
|
mode
|
|
221
222
|
);
|
|
222
223
|
printCopyResult(targetPath, result);
|
|
224
|
+
await updateSkillIndex(projectRoot, name);
|
|
223
225
|
}
|
|
224
|
-
async function
|
|
225
|
-
const source = path3.join(packageRoot2, "codex", "rules", `${name}.md`);
|
|
226
|
-
const rule = await fs2.readFile(source, "utf8");
|
|
226
|
+
async function updateSkillIndex(projectRoot, name) {
|
|
227
227
|
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
228
|
const existing = await fs2.pathExists(target) ? await fs2.readFile(target, "utf8") : "";
|
|
236
|
-
const startIndex = existing.indexOf(
|
|
229
|
+
const startIndex = existing.indexOf(SKILL_INDEX_START);
|
|
230
|
+
const names = /* @__PURE__ */ new Set();
|
|
237
231
|
if (startIndex >= 0) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
232
|
+
const endIndex = existing.indexOf(SKILL_INDEX_END, startIndex);
|
|
233
|
+
if (endIndex < 0) throw new Error("Cannot update AGENTS.md: its managed Codex skill index is incomplete.");
|
|
234
|
+
const managedBlock = existing.slice(startIndex, endIndex);
|
|
235
|
+
for (const match of managedBlock.matchAll(/\.agents\/skills\/([a-z0-9-]+)\/SKILL\.md/g)) names.add(match[1]);
|
|
236
|
+
}
|
|
237
|
+
names.add(name);
|
|
238
|
+
const block = [
|
|
239
|
+
SKILL_INDEX_START,
|
|
240
|
+
"",
|
|
241
|
+
"## \u53EF\u7528\u9879\u76EE Skills",
|
|
242
|
+
"",
|
|
243
|
+
"\u6D89\u53CA\u5BF9\u5E94\u4EFB\u52A1\u65F6\uFF0C\u5148\u9605\u8BFB\u76F8\u5173 Skill\uFF1A",
|
|
244
|
+
"",
|
|
245
|
+
...[...names].sort((a, b) => a.localeCompare(b)).map((skill) => `- ${SKILL_DESCRIPTIONS[skill] ?? skill}\uFF1A.agents/skills/${skill}/SKILL.md`),
|
|
246
|
+
"",
|
|
247
|
+
SKILL_INDEX_END
|
|
248
|
+
].join("\n");
|
|
249
|
+
if (startIndex >= 0) {
|
|
250
|
+
const endIndex = existing.indexOf(SKILL_INDEX_END, startIndex);
|
|
251
|
+
await fs2.writeFile(target, `${existing.slice(0, startIndex)}${block}${existing.slice(endIndex + SKILL_INDEX_END.length)}`);
|
|
246
252
|
return;
|
|
247
253
|
}
|
|
248
254
|
await fs2.writeFile(target, existing.trimEnd() ? `${existing.trimEnd()}
|
|
@@ -250,19 +256,13 @@ ${end}`;
|
|
|
250
256
|
${block}
|
|
251
257
|
` : `${block}
|
|
252
258
|
`);
|
|
253
|
-
console.log(pc2.green(`Installed rule: AGENTS.md (${name})`));
|
|
254
259
|
}
|
|
255
|
-
async function
|
|
256
|
-
|
|
257
|
-
listDirectoryNames(path3.join(packageRoot2, "codex", "skills"), "SKILL.md"),
|
|
258
|
-
listResourceNames(path3.join(packageRoot2, "codex", "rules"), ".md")
|
|
259
|
-
]);
|
|
260
|
-
return { skill: skills, rule: rules };
|
|
260
|
+
async function getCodexSkills(packageRoot2) {
|
|
261
|
+
return listDirectoryNames(path3.join(packageRoot2, "codex", "skills"), "SKILL.md");
|
|
261
262
|
}
|
|
262
263
|
function normalizeResourceType2(type) {
|
|
263
|
-
if (type ===
|
|
264
|
-
|
|
265
|
-
return void 0;
|
|
264
|
+
if (type === void 0 || type === "skill") return "skill";
|
|
265
|
+
throw new Error('Invalid resource type. Use "skill".');
|
|
266
266
|
}
|
|
267
267
|
function printCopyResult(targetPath, result) {
|
|
268
268
|
const label = result === "installed" ? "Installed" : result === "overwritten" ? "Overwritten" : "Skipped existing file";
|
|
@@ -288,7 +288,7 @@ function getPackageRoot(cliImportMetaUrl) {
|
|
|
288
288
|
// src/cli.ts
|
|
289
289
|
var program = new Command3();
|
|
290
290
|
var packageRoot = getPackageRoot(import.meta.url);
|
|
291
|
-
program.name("ai-dev-kit").description("Install AI development helper resources into your project.").version("0.
|
|
291
|
+
program.name("ai-dev-kit").description("Install AI development helper resources into your project.").version("0.2.0").showHelpAfterError().showSuggestionAfterError();
|
|
292
292
|
program.addCommand(createCursorCommand({ packageRoot }));
|
|
293
293
|
program.addCommand(createCodexCommand({ packageRoot }));
|
|
294
294
|
program.exitOverride();
|
package/codex/index.html
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
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>浏览此包内可安装的 rules 与 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
|
+
<section class="layout" aria-label="Codex 资源列表与详情">
|
|
100
|
+
<aside class="panel">
|
|
101
|
+
<h2 class="panel-title">资源列表 <span id="result-count"></span></h2>
|
|
102
|
+
<div class="resource-list" id="resource-list"></div>
|
|
103
|
+
</aside>
|
|
104
|
+
<article class="panel">
|
|
105
|
+
<div class="detail" id="detail"></div>
|
|
106
|
+
</article>
|
|
107
|
+
</section>
|
|
108
|
+
</main>
|
|
109
|
+
|
|
110
|
+
<script>
|
|
111
|
+
const resources = [
|
|
112
|
+
{
|
|
113
|
+
type: 'skill', name: 'vue-component-config', path: 'skills/vue-component-config/SKILL.md',
|
|
114
|
+
description: 'Vue 组件参数、配置对象与 CSS 变量的组织约定。'
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
type: 'skill', name: 'engineering-bug-review', path: 'skills/engineering-bug-review/SKILL.md',
|
|
118
|
+
description: '基于对话、代码和错误证据生成工程问题复盘。'
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
type: 'skill', name: 'git-commit-staged', path: 'skills/git-commit-staged/SKILL.md',
|
|
122
|
+
description: '分析暂存区并创建一条安全的中文 Conventional Commit。'
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
type: 'skill', name: 'document-project-readme', path: 'skills/document-project-readme/SKILL.md',
|
|
126
|
+
description: '基于真实项目结构和配置生成或更新 README。'
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
type: 'skill', name: 'content-blog-optimize', path: 'skills/content-blog-optimize/SKILL.md',
|
|
130
|
+
description: '优化中文技术博客的结构、表达与发布排版。'
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
type: 'skill', name: 'document-project-docs', path: 'skills/document-project-docs/SKILL.md',
|
|
134
|
+
description: '创建、归档与维护项目文档及其索引和敏感边界。'
|
|
135
|
+
}
|
|
136
|
+
];
|
|
137
|
+
|
|
138
|
+
const list = document.querySelector('#resource-list');
|
|
139
|
+
const detail = document.querySelector('#detail');
|
|
140
|
+
const search = document.querySelector('#search');
|
|
141
|
+
const resultCount = document.querySelector('#result-count');
|
|
142
|
+
const counts = document.querySelector('#counts');
|
|
143
|
+
let selected = resources[0];
|
|
144
|
+
|
|
145
|
+
function escapeHtml(value) {
|
|
146
|
+
return value.replace(/[&<>'"]/g, (character) => ({ '&': '&', '<': '<', '>': '>', "'": ''', '"': '"' })[character]);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function renderCounts() {
|
|
150
|
+
const skillCount = resources.filter((resource) => resource.type === 'skill').length;
|
|
151
|
+
const ruleCount = resources.length - skillCount;
|
|
152
|
+
counts.innerHTML = `<span class="pill">${skillCount} skills</span><span class="pill rule">${ruleCount} rule${ruleCount === 1 ? '' : 's'}</span>`;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function filteredResources() {
|
|
156
|
+
const query = search.value.trim().toLowerCase();
|
|
157
|
+
return resources.filter((resource) => !query || `${resource.name} ${resource.path} ${resource.description}`.toLowerCase().includes(query));
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function renderList() {
|
|
161
|
+
const visible = filteredResources();
|
|
162
|
+
resultCount.textContent = `${visible.length} 项`;
|
|
163
|
+
if (!visible.length) {
|
|
164
|
+
list.innerHTML = '<p class="empty">没有匹配的资源</p>';
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
list.innerHTML = visible.map((resource) => `
|
|
168
|
+
<button class="resource ${resource === selected ? 'active' : ''}" data-name="${resource.name}">
|
|
169
|
+
<span class="resource-name"><span>${resource.name}</span><span class="tag ${resource.type}">${resource.type}</span></span>
|
|
170
|
+
<span class="resource-path">${resource.path}</span>
|
|
171
|
+
</button>
|
|
172
|
+
`).join('');
|
|
173
|
+
list.querySelectorAll('.resource').forEach((button) => button.addEventListener('click', () => {
|
|
174
|
+
selected = resources.find((resource) => resource.name === button.dataset.name);
|
|
175
|
+
renderList();
|
|
176
|
+
renderDetail();
|
|
177
|
+
}));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
async function renderDetail() {
|
|
181
|
+
detail.innerHTML = `
|
|
182
|
+
<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>
|
|
183
|
+
<dl class="meta"><dt>类型</dt><dd>${selected.type}</dd><dt>相对路径</dt><dd>${selected.path}</dd></dl>
|
|
184
|
+
<pre class="source loading">正在读取源文件…</pre>
|
|
185
|
+
<p class="hint">提示:请从仓库根目录运行 <code>python3 -m http.server 8000</code>,再打开 <code>http://localhost:8000/codex/</code>。</p>
|
|
186
|
+
`;
|
|
187
|
+
const source = detail.querySelector('.source');
|
|
188
|
+
try {
|
|
189
|
+
const response = await fetch(selected.path, { cache: 'no-store' });
|
|
190
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
191
|
+
source.classList.remove('loading');
|
|
192
|
+
source.innerHTML = escapeHtml(await response.text());
|
|
193
|
+
} catch (error) {
|
|
194
|
+
source.classList.remove('loading');
|
|
195
|
+
source.textContent = `无法读取 ${selected.path}\n\n请使用本地 HTTP 服务打开本页面,或点击“打开文件”。\n${error.message}`;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
search.addEventListener('input', renderList);
|
|
200
|
+
renderCounts();
|
|
201
|
+
renderList();
|
|
202
|
+
renderDetail();
|
|
203
|
+
</script>
|
|
204
|
+
</body>
|
|
205
|
+
</html>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: project-
|
|
2
|
+
name: document-project-docs
|
|
3
3
|
description: Organize, create, migrate, or review project documentation with clear placement, indexes, links, and sensitive-information boundaries. Use when a request involves design documents, technical references, API or integration notes, development guides, deployment runbooks, troubleshooting records, worklogs, or documentation indexes.
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
interface:
|
|
2
2
|
display_name: "项目文档管理"
|
|
3
3
|
short_description: "创建、归档与维护项目文档及其索引和敏感边界"
|
|
4
|
-
default_prompt: "Use $project-
|
|
4
|
+
default_prompt: "Use $document-project-docs to organize and document this project's deployment workflow."
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
2
|
+
name: document-project-readme
|
|
3
3
|
description: Create or update a GitHub-ready README.md by inspecting the real project structure, dependencies, scripts, and implemented features. Use when the user asks to generate, rewrite, improve, or document a project's README; never invent unverified features or configuration.
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: bug-review
|
|
2
|
+
name: engineering-bug-review
|
|
3
3
|
description: Create a Chinese engineering problem review from the current conversation, code changes, errors, and project evidence. Use when the user asks to review a bug, summarize an engineering pitfall, document debugging lessons, or create a postmortem after AI-assisted development.
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
interface:
|
|
2
2
|
display_name: "工程问题复盘"
|
|
3
3
|
short_description: "基于对话与证据生成可复用的工程问题复盘文档"
|
|
4
|
-
default_prompt: "Use $bug-review to create an engineering problem review from this conversation and project context."
|
|
4
|
+
default_prompt: "Use $engineering-bug-review to create an engineering problem review from this conversation and project context."
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: commit-staged
|
|
2
|
+
name: git-commit-staged
|
|
3
3
|
description: Generate a Chinese Conventional Commit message from Git staged changes and execute exactly one safe commit. Use when the user explicitly asks Codex to commit the current staged changes, says “提交暂存区”, “帮我 commit”, or invokes this skill; do not use for merely explaining Git or reviewing changes without authorization to commit.
|
|
4
4
|
---
|
|
5
5
|
|