crushdataai 1.2.12 → 1.2.13
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/dist/commands.js +20 -8
- package/package.json +1 -1
package/dist/commands.js
CHANGED
|
@@ -79,17 +79,25 @@ function getAssetsDir() {
|
|
|
79
79
|
function copySharedFiles(targetDir, force) {
|
|
80
80
|
const sharedSource = path.join(getAssetsDir(), '.shared', 'data-analyst');
|
|
81
81
|
const sharedTarget = path.join(targetDir, SHARED_DIR);
|
|
82
|
-
if (fs.existsSync(sharedTarget)
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
if (fs.existsSync(sharedTarget)) {
|
|
83
|
+
if (!force) {
|
|
84
|
+
console.log(` ⏭️ ${SHARED_DIR} already exists (use --force to overwrite)`);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
// Clean reinstall: remove existing folder first
|
|
88
|
+
fs.removeSync(sharedTarget);
|
|
85
89
|
}
|
|
86
|
-
fs.copySync(sharedSource, sharedTarget
|
|
90
|
+
fs.copySync(sharedSource, sharedTarget);
|
|
87
91
|
console.log(` ✅ Created ${SHARED_DIR}/`);
|
|
88
92
|
}
|
|
89
93
|
function copyAIFiles(aiType, targetDir, force) {
|
|
90
94
|
const config = AI_PATHS[aiType];
|
|
91
95
|
const sourceDir = path.join(getAssetsDir(), config.sourceDir);
|
|
92
96
|
const targetPath = path.join(targetDir, config.dir);
|
|
97
|
+
// Clean reinstall: remove entire folder first when force=true
|
|
98
|
+
if (fs.existsSync(targetPath) && force) {
|
|
99
|
+
fs.removeSync(targetPath);
|
|
100
|
+
}
|
|
93
101
|
// Ensure directory exists
|
|
94
102
|
fs.ensureDirSync(targetPath);
|
|
95
103
|
for (const file of config.files) {
|
|
@@ -104,14 +112,18 @@ function copyAIFiles(aiType, targetDir, force) {
|
|
|
104
112
|
console.log(` ✅ Created ${config.dir}/${file}`);
|
|
105
113
|
}
|
|
106
114
|
}
|
|
107
|
-
// For Claude, also
|
|
115
|
+
// For Claude, also copy shared scripts and data
|
|
108
116
|
if (aiType === 'claude') {
|
|
109
117
|
const scriptsLink = path.join(targetPath, 'scripts');
|
|
110
118
|
const dataLink = path.join(targetPath, 'data');
|
|
111
|
-
const sharedScripts = path.relative(targetPath, path.join(targetDir, SHARED_DIR, 'scripts'));
|
|
112
|
-
const sharedData = path.relative(targetPath, path.join(targetDir, SHARED_DIR, 'data'));
|
|
113
|
-
// Note: Symlinks may require admin on Windows. Copy as fallback.
|
|
114
119
|
try {
|
|
120
|
+
// Clean reinstall: remove existing folders first when force=true
|
|
121
|
+
if (force) {
|
|
122
|
+
if (fs.existsSync(scriptsLink))
|
|
123
|
+
fs.removeSync(scriptsLink);
|
|
124
|
+
if (fs.existsSync(dataLink))
|
|
125
|
+
fs.removeSync(dataLink);
|
|
126
|
+
}
|
|
115
127
|
if (!fs.existsSync(scriptsLink)) {
|
|
116
128
|
fs.copySync(path.join(targetDir, SHARED_DIR, 'scripts'), scriptsLink);
|
|
117
129
|
console.log(` ✅ Copied scripts to ${config.dir}/scripts/`);
|