@torka/claude-qol 0.2.0 → 0.2.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/install.js +32 -3
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -34,6 +34,23 @@ function logError(message) {
|
|
|
34
34
|
log(` ✗ ${message}`, 'red');
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
function logUpdated(message) {
|
|
38
|
+
log(` ↻ ${message}`, 'blue');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Check if two files have identical content
|
|
43
|
+
*/
|
|
44
|
+
function filesAreIdentical(file1, file2) {
|
|
45
|
+
try {
|
|
46
|
+
const content1 = fs.readFileSync(file1);
|
|
47
|
+
const content2 = fs.readFileSync(file2);
|
|
48
|
+
return content1.equals(content2);
|
|
49
|
+
} catch {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
37
54
|
/**
|
|
38
55
|
* Determine the target .claude directory based on installation context
|
|
39
56
|
*/
|
|
@@ -93,8 +110,18 @@ function copyDirRecursive(src, dest, stats) {
|
|
|
93
110
|
copyDirRecursive(srcPath, destPath, stats);
|
|
94
111
|
} else {
|
|
95
112
|
if (fs.existsSync(destPath)) {
|
|
96
|
-
|
|
97
|
-
|
|
113
|
+
// Check if files are identical
|
|
114
|
+
if (filesAreIdentical(srcPath, destPath)) {
|
|
115
|
+
stats.skipped.push(destPath);
|
|
116
|
+
logSkip(`Unchanged: ${path.relative(stats.targetBase, destPath)}`);
|
|
117
|
+
} else {
|
|
118
|
+
// Backup existing file, then replace
|
|
119
|
+
const backupPath = destPath + '.bak';
|
|
120
|
+
fs.copyFileSync(destPath, backupPath);
|
|
121
|
+
fs.copyFileSync(srcPath, destPath);
|
|
122
|
+
stats.updated.push(destPath);
|
|
123
|
+
logUpdated(`Updated (backup: .bak): ${path.relative(stats.targetBase, destPath)}`);
|
|
124
|
+
}
|
|
98
125
|
} else {
|
|
99
126
|
fs.copyFileSync(srcPath, destPath);
|
|
100
127
|
stats.copied.push(destPath);
|
|
@@ -123,6 +150,7 @@ function install() {
|
|
|
123
150
|
|
|
124
151
|
const stats = {
|
|
125
152
|
copied: [],
|
|
153
|
+
updated: [],
|
|
126
154
|
skipped: [],
|
|
127
155
|
targetBase,
|
|
128
156
|
};
|
|
@@ -148,7 +176,8 @@ function install() {
|
|
|
148
176
|
// Summary
|
|
149
177
|
log('\n' + colors.bold + '📊 Installation Summary' + colors.reset);
|
|
150
178
|
log(` Files copied: ${stats.copied.length}`, 'green');
|
|
151
|
-
log(` Files
|
|
179
|
+
log(` Files updated (backups created): ${stats.updated.length}`, 'blue');
|
|
180
|
+
log(` Files unchanged: ${stats.skipped.length}`, 'yellow');
|
|
152
181
|
|
|
153
182
|
// Post-install instructions
|
|
154
183
|
log('\n' + colors.bold + '📝 Configuration Required' + colors.reset);
|
package/package.json
CHANGED