cc-devflow 2.4.0 → 2.4.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.
- package/CHANGELOG.md +17 -1
- package/bin/cc-devflow-cli.js +38 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,7 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
## [2.
|
|
10
|
+
## [2.4.1] - 2026-01-08
|
|
11
|
+
|
|
12
|
+
### 🩹 CLI 增强:增量更新 (Incremental Update)
|
|
13
|
+
|
|
14
|
+
`cc-devflow init` 命令现在支持增量更新,不再强制覆盖用户已修改的文件。
|
|
15
|
+
|
|
16
|
+
#### Added
|
|
17
|
+
|
|
18
|
+
- **增量更新机制**: 当目标目录已存在时,`init` 默认进入增量模式。
|
|
19
|
+
- 仅复制目标目录中**缺失**的文件。
|
|
20
|
+
- **保留**所有已存在的文件(即使用户修改过)。
|
|
21
|
+
- 输出 `[NEW] filename` 提示新增文件。
|
|
22
|
+
- **强制模式重构**: `--force` 选项现在的行为更明确:彻底删除旧目录并重新安装。
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## [2.4.0] - 2025-12-19
|
|
11
27
|
|
|
12
28
|
### 🎯 REQ-005 完成:Command Emitter (Multi-Platform Adapter Compiler)
|
|
13
29
|
|
package/bin/cc-devflow-cli.js
CHANGED
|
@@ -87,6 +87,27 @@ function parseCliArgs(args) {
|
|
|
87
87
|
return { options, rest };
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
function copyIncremental(src, dest) {
|
|
91
|
+
const stats = fs.statSync(src);
|
|
92
|
+
if (stats.isDirectory()) {
|
|
93
|
+
if (!fs.existsSync(dest)) {
|
|
94
|
+
fs.mkdirSync(dest);
|
|
95
|
+
}
|
|
96
|
+
const entries = fs.readdirSync(src);
|
|
97
|
+
for (const entry of entries) {
|
|
98
|
+
copyIncremental(path.join(src, entry), path.join(dest, entry));
|
|
99
|
+
}
|
|
100
|
+
} else {
|
|
101
|
+
if (!fs.existsSync(dest)) {
|
|
102
|
+
fs.copyFileSync(src, dest);
|
|
103
|
+
console.log(`[NEW] ${path.relative(process.cwd(), dest)}`);
|
|
104
|
+
} else {
|
|
105
|
+
// File exists - skip to preserve user changes
|
|
106
|
+
// TODO: In the future, we could implement a 3-way merge or check for unmodified defaults
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
90
111
|
function runInit(args) {
|
|
91
112
|
const { options } = parseCliArgs(args);
|
|
92
113
|
|
|
@@ -103,17 +124,26 @@ function runInit(args) {
|
|
|
103
124
|
return 1;
|
|
104
125
|
}
|
|
105
126
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
127
|
+
// Case 1: Directory does not exist - Clean Install
|
|
128
|
+
if (!fs.existsSync(targetDir)) {
|
|
129
|
+
fs.cpSync(TEMPLATE_DIR, targetDir, { recursive: true });
|
|
130
|
+
console.log(`Initialized .claude in ${targetRoot}`);
|
|
131
|
+
return 0;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Case 2: Directory exists + Force - Hard Reset
|
|
135
|
+
if (options.force) {
|
|
136
|
+
console.log('Force flag detected. Resetting .claude directory...');
|
|
112
137
|
fs.rmSync(targetDir, { recursive: true, force: true });
|
|
138
|
+
fs.cpSync(TEMPLATE_DIR, targetDir, { recursive: true });
|
|
139
|
+
console.log(`Re-initialized .claude in ${targetRoot}`);
|
|
140
|
+
return 0;
|
|
113
141
|
}
|
|
114
142
|
|
|
115
|
-
|
|
116
|
-
console.log(`
|
|
143
|
+
// Case 3: Directory exists - Incremental Update
|
|
144
|
+
console.log(`Target ${targetDir} already exists. Performing incremental update...`);
|
|
145
|
+
copyIncremental(TEMPLATE_DIR, targetDir);
|
|
146
|
+
console.log('Incremental update complete. Existing files were preserved.');
|
|
117
147
|
return 0;
|
|
118
148
|
}
|
|
119
149
|
|