cc-devflow 2.4.1 → 2.4.3

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 CHANGED
@@ -7,19 +7,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ---
9
9
 
10
- ## [2.4.1] - 2026-01-08
10
+ ## [2.4.3] - 2026-01-09
11
11
 
12
- ### 🩹 CLI 增强:增量更新 (Incremental Update)
12
+ ### 🔄 CLI 变更:强力增量更新 (Aggressive Incremental Update)
13
13
 
14
- `cc-devflow init` 命令现在支持增量更新,不再强制覆盖用户已修改的文件。
14
+ `cc-devflow init` 命令现在采用强制同步策略。
15
+
16
+ #### Changed
17
+
18
+ - **增量同步机制**: 当目标目录已存在时:
19
+ - 若文件缺失:**复制**新增。
20
+ - 若文件存在但内容不一致:**直接覆盖**(以模板为准),确保项目配置与最新标准一致。
21
+ - 仅当文件内容完全一致时跳过。
22
+ - **注意**: 此策略会覆盖用户的本地修改,请确保在使用前 commit 本地变更。
23
+
24
+ ## [2.4.2] - 2026-01-09
25
+
26
+ ### 🩹 CLI 增强:保留增量更新 (Preserved Incremental Update)
27
+ > 改为 2.4.3 后已被弃用
28
+
29
+ `cc-devflow init` 命令支持增量更新,保留用户修改。
15
30
 
16
31
  #### Added
17
32
 
18
- - **增量更新机制**: 当目标目录已存在时,`init` 默认进入增量模式。
33
+ - **增量更新机制**:
19
34
  - 仅复制目标目录中**缺失**的文件。
20
- - **保留**所有已存在的文件(即使用户修改过)。
21
- - 输出 `[NEW] filename` 提示新增文件。
22
- - **强制模式重构**: `--force` 选项现在的行为更明确:彻底删除旧目录并重新安装。
35
+ - **保留**所有已存在的文件。
36
+ - 若目标文件存在但内容与新版模板不同,生成 `filename.new`。
23
37
 
24
38
  ---
25
39
 
@@ -99,11 +99,25 @@ function copyIncremental(src, dest) {
99
99
  }
100
100
  } else {
101
101
  if (!fs.existsSync(dest)) {
102
+ // Case 1: File missing - Copy it
102
103
  fs.copyFileSync(src, dest);
103
104
  console.log(`[NEW] ${path.relative(process.cwd(), dest)}`);
104
105
  } 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
106
+ // Case 2: File exists - Compare content
107
+ try {
108
+ const srcContent = fs.readFileSync(src);
109
+ const destContent = fs.readFileSync(dest);
110
+
111
+ if (!srcContent.equals(destContent)) {
112
+ // Content differs - Overwrite original
113
+ fs.unlinkSync(dest);
114
+ fs.copyFileSync(src, dest);
115
+ console.log(`[UPDATE] ${path.relative(process.cwd(), dest)}`);
116
+ }
117
+ // else: Content identical - Silent skip
118
+ } catch (err) {
119
+ console.warn(`[WARN] Could not compare ${path.relative(process.cwd(), dest)}: ${err.message}`);
120
+ }
107
121
  }
108
122
  }
109
123
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-devflow",
3
- "version": "2.4.1",
3
+ "version": "2.4.3",
4
4
  "description": "DevFlow CLI tool",
5
5
  "main": "bin/cc-devflow.js",
6
6
  "bin": {
@@ -47,4 +47,4 @@
47
47
  "engines": {
48
48
  "node": ">=18"
49
49
  }
50
- }
50
+ }