draftgo-cli 4.0.24 → 4.0.25

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 CHANGED
@@ -75,6 +75,8 @@ draftgo connect [target...]
75
75
 
76
76
  `draftgo status` 会通过只读 MCP/API 诊断显示服务连接健康状态、服务版本和当前用户 API Key 的 `platform`/`space` 上下文;`--output json` 适合读取 `connection.health`、`workspace_id` 与 `space_id`。
77
77
 
78
+ `draftgo update` 和 `draftgo update all` 只刷新项目中已经安装的 DraftGo Skill,不会因为检测到 `.cursor`、`AGENTS.md` 等工具痕迹而新增配置。显式指定 target 时(例如 `draftgo update cursor`),如果该 Skill 尚未安装,会按你的明确请求直接安装并更新它;首次接入也可以使用 `draftgo init <target>`。
79
+
78
80
  ### 发现与正文
79
81
 
80
82
  ```text
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "draftgo-cli",
3
- "version": "4.0.24",
3
+ "version": "4.0.25",
4
4
  "description": "Install and manage the DraftGo skill across AI coding agents (Claude Code, Codex, Cursor, Windsurf, Antigravity, Copilot, Gemini, Kiro, Pi).",
5
5
  "bin": {
6
6
  "draftgo": "bin/draftgo.js"
@@ -2,7 +2,7 @@
2
2
  "schema_version": "1.0",
3
3
  "id": "draftgo",
4
4
  "name": "DraftGo 开发助手",
5
- "version": "4.0.24",
5
+ "version": "4.0.25",
6
6
  "entry": "SKILL.md",
7
7
  "description": "以 Skill/reference 任务路由、MCP 实时发现、长正文 checkout/commit、统一验证和完成日志为边界的 DraftGo 工作流。",
8
8
  "license": "MIT",
@@ -22,8 +22,9 @@ The installed Skill routes agents to task-specific References and MCP tools.
22
22
  Usage:
23
23
  draftgo init [<target>...] Install the DraftGo Skill. No target = detect.
24
24
  Use "all" to install every Skill target.
25
- draftgo update [<target>...] Fully update the global CLI, then atomically
26
- refresh installed or detected Skills.
25
+ draftgo update [<target>...] Fully update the global CLI, then atomically
26
+ refresh installed Skills. An explicit target
27
+ may also install that target when missing.
27
28
  draftgo uninstall <target|all> Remove Skill files. --purge also removes
28
29
  the entire .draftgo/ runtime directory.
29
30
  draftgo status Show connection health, current scope, targets, and Skill version.
@@ -2,10 +2,9 @@
2
2
 
3
3
  const { spawnSync } = require('child_process');
4
4
  const log = require('../logger');
5
- const { all, byName, resolveTargets } = require('../targets');
5
+ const { all, resolveTargets } = require('../targets');
6
6
  const { ensureRuntime, writeInstalledVersion, readInstalledVersion, getPackageVersion } = require('../skill');
7
7
  const { fetchLatestVersion, cmpSemver } = require('../updateCheck');
8
- const { detectTargets } = require('../detect');
9
8
  const { readInstallMarker, installRelease } = require('../releaseInstall');
10
9
 
11
10
  const REENTRY_FLAG = 'DRAFTGO_UPDATE_REENTERED';
@@ -16,6 +15,10 @@ function installedTargetsNotRefreshed(projectDir, refreshedTargets) {
16
15
  !refreshed.has(target.name) && target.status(projectDir).installed);
17
16
  }
18
17
 
18
+ function targetInstalled(projectDir, target) {
19
+ return typeof target.status === 'function' && target.status(projectDir).installed === true;
20
+ }
21
+
19
22
  async function updateCliIfNeeded(projectDir, positional, flags) {
20
23
  if (process.env[REENTRY_FLAG] === '1' || flags['skip-update-check'] || process.env.DRAFTGO_NO_UPDATE_CHECK === '1') {
21
24
  return null;
@@ -76,36 +79,27 @@ async function update(projectDir, positional, flags) {
76
79
  const prev = readInstalledVersion(projectDir);
77
80
  log.info(`当前已装 skill:${prev || '未安装'},CLI 版本:${getPackageVersion()}`);
78
81
 
79
- // Determine which entry files to refresh:
80
- // - no positional refresh installed targets plus project-level tool signals
81
- // - "all" → refresh every known target
82
- // - names → refresh the specified targets
82
+ // Implicit update only refreshes existing Skills. An explicit target is a
83
+ // deliberate request and may install that target when it is missing.
83
84
  let resolved = [];
84
- let unknown = [];
85
-
86
- if (positional.length === 0) {
87
- const byTarget = new Map();
88
- for (const t of all) {
89
- if (t.status(projectDir).installed) byTarget.set(t.name, t);
90
- }
91
- for (const name of detectTargets(projectDir)) {
92
- if (byName[name]) byTarget.set(name, byName[name]);
93
- }
94
- resolved = Array.from(byTarget.values());
85
+ let unknown = [];
86
+
87
+ if (positional.length === 0 || positional.includes('all')) {
88
+ resolved = all.filter((target) => targetInstalled(projectDir, target));
95
89
  if (resolved.length === 0) {
96
- log.warn('未检测到任何已安装或可识别的 AI 工具目标,无可刷新内容。');
97
- log.dim(' 使用 `draftgo update all` 或 `draftgo update <target>` 强制刷新。');
90
+ log.warn('未检测到已安装的 DraftGo Skill,无可刷新内容。');
91
+ log.dim(' 需要新增 AI 工具时,请使用 `draftgo init <target>`。');
98
92
  return 0;
99
93
  } else {
100
94
  log.info(`刷新目标:${resolved.map((r) => r.displayName).join(', ')}`);
101
95
  }
102
96
  } else {
103
97
  ({ resolved, unknown } = resolveTargets(positional));
104
- if (unknown.length) {
105
- log.err(`未知 target:${unknown.join(', ')}`);
106
- return 1;
107
- }
108
- }
98
+ if (unknown.length) {
99
+ log.err(`未知 target:${unknown.join(', ')}`);
100
+ return 1;
101
+ }
102
+ }
109
103
 
110
104
  ensureRuntime(projectDir);
111
105
  log.step('用 CLI 内置版本覆盖各 AI 工具 skill 目录');