draftgo-cli 2.0.0 → 2.0.2
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 +24 -1
- package/package.json +1 -1
- package/src/commands/update.js +13 -5
- package/src/detect.js +4 -10
- package/src/platforms.js +9 -0
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ draftgo init all # 所有支持的工具
|
|
|
35
35
|
| 命令 | 说明 |
|
|
36
36
|
|---|---|
|
|
37
37
|
| `draftgo init [target]...` | 安装 skill。不传 target 时自动识别;`all` 表示全部。 |
|
|
38
|
-
| `draftgo update [target]...` | 把 CLI 内置 skill
|
|
38
|
+
| `draftgo update [target]...` | 把 CLI 内置 skill 覆盖写到每个已安装或项目中检测到的 AI 工具自己的 skill 目录;保留本地 `config / changelog / lessons / Task` 等运行时数据。**若 npm 上存在更新的 CLI 版本,会先自动升级 CLI 再重跑自己**。 |
|
|
39
39
|
| `draftgo uninstall [target]...` | 移除指定 AI 工具的 skill 目录(含入口文件 + 子技能 + scripts)。加 `--purge` 会连 `.draftgo/` 一起删。 |
|
|
40
40
|
| `draftgo status` | 查看当前项目装了哪些 AI 工具入口、skill 版本。 |
|
|
41
41
|
| `draftgo doctor` | 诊断:Python 是否可用、检测到哪些 AI 工具、各入口状态。 |
|
|
@@ -147,6 +147,29 @@ CLI v1.2.0 在 skill 包里追加了一套**分级开发流程规范**(`rules/
|
|
|
147
147
|
|
|
148
148
|
---
|
|
149
149
|
|
|
150
|
+
## v2.0.2 升级要点(统一目标识别信号)
|
|
151
|
+
|
|
152
|
+
CLI v2.0.2 进一步完善 `draftgo update` 的目标识别逻辑,避免只修到单个工具而遗漏其他 AI 工具。
|
|
153
|
+
|
|
154
|
+
**核心变化:**
|
|
155
|
+
|
|
156
|
+
- **平台定义成为单一信号源**:每个 AI 工具的入口文件、skill 目录和项目级探测信号统一维护在 `platforms.js`,`init / update / doctor` 共用同一份识别依据。
|
|
157
|
+
- **update 覆盖所有检测到的工具**:不传 target 时,`draftgo update` 会合并“已安装 skill 的目标”和“项目中检测到的 AI 工具信号”,并刷新全部命中的工具。
|
|
158
|
+
- **全平台测试覆盖**:单测现在会同时模拟 Claude Code、Cursor、Windsurf、Antigravity、Kiro、GitHub Copilot、Codex、Gemini 的项目级信号,防止后续再出现只命中部分工具的问题。
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## v2.0.1 升级要点(update 目标识别修复)
|
|
163
|
+
|
|
164
|
+
CLI v2.0.1 修复 `draftgo update` 空参数时只刷新部分工具的问题。
|
|
165
|
+
|
|
166
|
+
**核心变化:**
|
|
167
|
+
|
|
168
|
+
- **update 合并识别目标**:不传 target 时,`draftgo update` 会同时刷新“已安装 skill 的目标”和项目中可检测到的 AI 工具信号(如 `.claude`、`.codex`、`AGENTS.md`)。
|
|
169
|
+
- **Codex 项目级目录不再漏刷**:项目里已有 `.codex` 但 Codex skill 尚未落地时,update 也会主动写入 `.codex/skills/draftgo/`。
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
150
173
|
## v2.0.0 升级要点(精简 skill 包体)
|
|
151
174
|
|
|
152
175
|
CLI v2.0.0 删除了内置 `resources/skill/reference/` 基座参考副本,进一步精简安装到各 AI 工具中的 DraftGo skill 包体。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "draftgo-cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Install and manage the DraftGo skill across AI coding agents (Claude Code, Codex, Cursor, Windsurf, Antigravity, Copilot, Gemini, Kiro).",
|
|
5
5
|
"bin": {
|
|
6
6
|
"draftgo": "bin/draftgo.js"
|
package/src/commands/update.js
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
const { spawnSync } = require('child_process');
|
|
4
4
|
const log = require('../logger');
|
|
5
|
-
const { all, resolveTargets } = require('../installers');
|
|
5
|
+
const { all, byName, resolveTargets } = require('../installers');
|
|
6
6
|
const { ensureRuntime, writeInstalledVersion, readInstalledVersion, getPackageVersion } = require('../skill');
|
|
7
7
|
const { fetchLatestVersion, cmpSemver } = require('../updateCheck');
|
|
8
|
+
const { detectTargets } = require('../detect');
|
|
8
9
|
|
|
9
10
|
// Env flag we set before re-exec to avoid infinite upgrade loops.
|
|
10
11
|
const REENTRY_FLAG = 'DRAFTGO_UPDATE_REENTERED';
|
|
@@ -78,20 +79,27 @@ async function update(projectDir, positional, flags) {
|
|
|
78
79
|
if (upgraded) return exitCode;
|
|
79
80
|
|
|
80
81
|
// Determine which entry files to refresh:
|
|
81
|
-
// - no positional → refresh
|
|
82
|
+
// - no positional → refresh installed targets plus project-level tool signals
|
|
82
83
|
// - "all" → refresh every known target
|
|
83
84
|
// - names → refresh the specified targets
|
|
84
85
|
let resolved = [];
|
|
85
86
|
let unknown = [];
|
|
86
87
|
|
|
87
88
|
if (positional.length === 0) {
|
|
88
|
-
|
|
89
|
+
const byTarget = new Map();
|
|
90
|
+
for (const t of all) {
|
|
91
|
+
if (t.status(projectDir).installed) byTarget.set(t.name, t);
|
|
92
|
+
}
|
|
93
|
+
for (const name of detectTargets(projectDir)) {
|
|
94
|
+
if (byName[name]) byTarget.set(name, byName[name]);
|
|
95
|
+
}
|
|
96
|
+
resolved = Array.from(byTarget.values());
|
|
89
97
|
if (resolved.length === 0) {
|
|
90
|
-
log.warn('
|
|
98
|
+
log.warn('未检测到任何已安装或可识别的 AI 工具目标,无可刷新内容。');
|
|
91
99
|
log.dim(' 使用 `draftgo update all` 或 `draftgo update <target>` 强制刷新。');
|
|
92
100
|
return 0;
|
|
93
101
|
} else {
|
|
94
|
-
log.info(
|
|
102
|
+
log.info(`刷新目标:${resolved.map((r) => r.displayName).join(', ')}`);
|
|
95
103
|
}
|
|
96
104
|
} else {
|
|
97
105
|
({ resolved, unknown } = resolveTargets(positional));
|
package/src/detect.js
CHANGED
|
@@ -2,19 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
const path = require('path');
|
|
4
4
|
const { exists } = require('./fsx');
|
|
5
|
+
const { platforms } = require('./platforms');
|
|
5
6
|
|
|
6
7
|
// Each target declares one or more signals (files/dirs). If ANY signal matches,
|
|
7
8
|
// the target is considered "in use" in the current project.
|
|
8
|
-
const SIGNALS =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
cursor: ['.cursor'],
|
|
12
|
-
windsurf: ['.windsurf'],
|
|
13
|
-
antigravity:['.agent'],
|
|
14
|
-
copilot: ['.github/prompts', '.github/copilot-instructions.md'],
|
|
15
|
-
codex: ['.codex', 'AGENTS.md'],
|
|
16
|
-
gemini: ['.gemini', 'GEMINI.md'],
|
|
17
|
-
};
|
|
9
|
+
const SIGNALS = Object.fromEntries(
|
|
10
|
+
platforms.map((p) => [p.name, p.signals || []])
|
|
11
|
+
);
|
|
18
12
|
|
|
19
13
|
function detectTargets(projectDir) {
|
|
20
14
|
const hits = [];
|
package/src/platforms.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
// skillDir : project-relative path used to substitute {{SKILL_DIR}} in
|
|
11
11
|
// template files (typically === assetDir written with forward
|
|
12
12
|
// slashes so it works in markdown)
|
|
13
|
+
// signals : project-level files/dirs that indicate the tool is in use
|
|
13
14
|
// frontmatter: object → prepended as YAML frontmatter to mainFile; null →
|
|
14
15
|
// no frontmatter
|
|
15
16
|
//
|
|
@@ -28,6 +29,7 @@ const platforms = [
|
|
|
28
29
|
mainFile: '.claude/skills/draftgo/SKILL.md',
|
|
29
30
|
assetDir: '.claude/skills/draftgo',
|
|
30
31
|
skillDir: '.claude/skills/draftgo',
|
|
32
|
+
signals: ['.claude', 'CLAUDE.md'],
|
|
31
33
|
frontmatter: { name: SKILL_NAME, description: DESCRIPTION },
|
|
32
34
|
},
|
|
33
35
|
{
|
|
@@ -36,6 +38,7 @@ const platforms = [
|
|
|
36
38
|
mainFile: '.cursor/commands/draftgo.md',
|
|
37
39
|
assetDir: '.cursor/commands/draftgo',
|
|
38
40
|
skillDir: '.cursor/commands/draftgo',
|
|
41
|
+
signals: ['.cursor'],
|
|
39
42
|
frontmatter: { name: SKILL_NAME, description: DESCRIPTION },
|
|
40
43
|
},
|
|
41
44
|
{
|
|
@@ -44,6 +47,7 @@ const platforms = [
|
|
|
44
47
|
mainFile: '.windsurf/workflows/draftgo.md',
|
|
45
48
|
assetDir: '.windsurf/workflows/draftgo',
|
|
46
49
|
skillDir: '.windsurf/workflows/draftgo',
|
|
50
|
+
signals: ['.windsurf'],
|
|
47
51
|
frontmatter: { name: SKILL_NAME, description: DESCRIPTION },
|
|
48
52
|
},
|
|
49
53
|
{
|
|
@@ -52,6 +56,7 @@ const platforms = [
|
|
|
52
56
|
mainFile: '.agent/workflows/draftgo.md',
|
|
53
57
|
assetDir: '.agent/workflows/draftgo',
|
|
54
58
|
skillDir: '.agent/workflows/draftgo',
|
|
59
|
+
signals: ['.agent'],
|
|
55
60
|
frontmatter: { name: SKILL_NAME, description: DESCRIPTION },
|
|
56
61
|
},
|
|
57
62
|
{
|
|
@@ -60,6 +65,7 @@ const platforms = [
|
|
|
60
65
|
mainFile: '.kiro/steering/draftgo.md',
|
|
61
66
|
assetDir: '.kiro/steering/draftgo',
|
|
62
67
|
skillDir: '.kiro/steering/draftgo',
|
|
68
|
+
signals: ['.kiro'],
|
|
63
69
|
frontmatter: { inclusion: 'manual', name: SKILL_NAME, description: DESCRIPTION },
|
|
64
70
|
},
|
|
65
71
|
{
|
|
@@ -68,6 +74,7 @@ const platforms = [
|
|
|
68
74
|
mainFile: '.github/prompts/draftgo.prompt.md',
|
|
69
75
|
assetDir: '.github/prompts/draftgo',
|
|
70
76
|
skillDir: '.github/prompts/draftgo',
|
|
77
|
+
signals: ['.github/prompts', '.github/copilot-instructions.md'],
|
|
71
78
|
frontmatter: { mode: 'agent', description: DESCRIPTION },
|
|
72
79
|
},
|
|
73
80
|
{
|
|
@@ -76,6 +83,7 @@ const platforms = [
|
|
|
76
83
|
mainFile: '.codex/skills/draftgo/SKILL.md',
|
|
77
84
|
assetDir: '.codex/skills/draftgo',
|
|
78
85
|
skillDir: '.codex/skills/draftgo',
|
|
86
|
+
signals: ['.codex', 'AGENTS.md'],
|
|
79
87
|
frontmatter: { name: SKILL_NAME, description: DESCRIPTION },
|
|
80
88
|
},
|
|
81
89
|
{
|
|
@@ -84,6 +92,7 @@ const platforms = [
|
|
|
84
92
|
mainFile: '.gemini/skills/draftgo/SKILL.md',
|
|
85
93
|
assetDir: '.gemini/skills/draftgo',
|
|
86
94
|
skillDir: '.gemini/skills/draftgo',
|
|
95
|
+
signals: ['.gemini', 'GEMINI.md'],
|
|
87
96
|
frontmatter: { name: SKILL_NAME, description: DESCRIPTION },
|
|
88
97
|
},
|
|
89
98
|
];
|