@torka/claude-workflows 0.7.1 → 0.8.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/install.js +33 -5
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @torka/claude-workflows - Post-install script
|
|
4
4
|
* Copies workflow files to the appropriate .claude directory
|
|
5
|
+
*
|
|
6
|
+
* Behavior: Always syncs files from the package (overwrites if different)
|
|
7
|
+
* - New files are copied
|
|
8
|
+
* - Existing files are updated if content differs
|
|
9
|
+
* - Identical files are skipped (no-op)
|
|
5
10
|
*/
|
|
6
11
|
|
|
7
12
|
const fs = require('fs');
|
|
@@ -14,6 +19,7 @@ const colors = {
|
|
|
14
19
|
yellow: '\x1b[33m',
|
|
15
20
|
blue: '\x1b[34m',
|
|
16
21
|
red: '\x1b[31m',
|
|
22
|
+
cyan: '\x1b[36m',
|
|
17
23
|
reset: '\x1b[0m',
|
|
18
24
|
bold: '\x1b[1m',
|
|
19
25
|
};
|
|
@@ -26,6 +32,10 @@ function logSuccess(message) {
|
|
|
26
32
|
log(` ✓ ${message}`, 'green');
|
|
27
33
|
}
|
|
28
34
|
|
|
35
|
+
function logUpdate(message) {
|
|
36
|
+
log(` ↻ ${message}`, 'cyan');
|
|
37
|
+
}
|
|
38
|
+
|
|
29
39
|
function logSkip(message) {
|
|
30
40
|
log(` ○ ${message}`, 'yellow');
|
|
31
41
|
}
|
|
@@ -73,6 +83,9 @@ function getTargetBase() {
|
|
|
73
83
|
|
|
74
84
|
/**
|
|
75
85
|
* Recursively copy directory contents
|
|
86
|
+
* - New files: copied
|
|
87
|
+
* - Changed files: updated (overwritten)
|
|
88
|
+
* - Identical files: skipped
|
|
76
89
|
*/
|
|
77
90
|
function copyDirRecursive(src, dest, stats) {
|
|
78
91
|
if (!fs.existsSync(src)) {
|
|
@@ -94,9 +107,22 @@ function copyDirRecursive(src, dest, stats) {
|
|
|
94
107
|
copyDirRecursive(srcPath, destPath, stats);
|
|
95
108
|
} else {
|
|
96
109
|
if (fs.existsSync(destPath)) {
|
|
97
|
-
|
|
98
|
-
|
|
110
|
+
// File exists - check if content differs
|
|
111
|
+
const srcContent = fs.readFileSync(srcPath);
|
|
112
|
+
const destContent = fs.readFileSync(destPath);
|
|
113
|
+
|
|
114
|
+
if (srcContent.equals(destContent)) {
|
|
115
|
+
// Identical - skip
|
|
116
|
+
stats.unchanged.push(destPath);
|
|
117
|
+
logSkip(`Unchanged: ${path.relative(stats.targetBase, destPath)}`);
|
|
118
|
+
} else {
|
|
119
|
+
// Different - update
|
|
120
|
+
fs.copyFileSync(srcPath, destPath);
|
|
121
|
+
stats.updated.push(destPath);
|
|
122
|
+
logUpdate(`Updated: ${path.relative(stats.targetBase, destPath)}`);
|
|
123
|
+
}
|
|
99
124
|
} else {
|
|
125
|
+
// New file - copy
|
|
100
126
|
fs.copyFileSync(srcPath, destPath);
|
|
101
127
|
stats.copied.push(destPath);
|
|
102
128
|
logSuccess(`Copied: ${path.relative(stats.targetBase, destPath)}`);
|
|
@@ -124,7 +150,8 @@ function install() {
|
|
|
124
150
|
|
|
125
151
|
const stats = {
|
|
126
152
|
copied: [],
|
|
127
|
-
|
|
153
|
+
updated: [],
|
|
154
|
+
unchanged: [],
|
|
128
155
|
targetBase,
|
|
129
156
|
};
|
|
130
157
|
|
|
@@ -154,8 +181,9 @@ function install() {
|
|
|
154
181
|
|
|
155
182
|
// Summary
|
|
156
183
|
log('\n' + colors.bold + '📊 Installation Summary' + colors.reset);
|
|
157
|
-
log(` Files copied: ${stats.copied.length}`, 'green');
|
|
158
|
-
log(` Files
|
|
184
|
+
log(` Files copied (new): ${stats.copied.length}`, 'green');
|
|
185
|
+
log(` Files updated: ${stats.updated.length}`, 'cyan');
|
|
186
|
+
log(` Files unchanged: ${stats.unchanged.length}`, 'yellow');
|
|
159
187
|
|
|
160
188
|
// Post-install instructions
|
|
161
189
|
log('\n' + colors.bold + '📝 Next Steps' + colors.reset);
|