@clawchatsai/connector 0.0.7 → 0.0.8
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/index.js +20 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -559,6 +559,26 @@ async function handleImport(sourcePath, opts) {
|
|
|
559
559
|
}
|
|
560
560
|
console.log(`Databases: ${imported} imported, ${skipped} skipped.`);
|
|
561
561
|
}
|
|
562
|
+
// Import .json config files (workspaces.json, settings.json, etc.)
|
|
563
|
+
const jsonFiles = fs.readdirSync(resolvedSource).filter(f => f.endsWith('.json'));
|
|
564
|
+
if (jsonFiles.length > 0) {
|
|
565
|
+
let jsonImported = 0;
|
|
566
|
+
let jsonSkipped = 0;
|
|
567
|
+
for (const file of jsonFiles) {
|
|
568
|
+
const src = path.join(resolvedSource, file);
|
|
569
|
+
const dst = path.join(destDataDir, file);
|
|
570
|
+
if (fs.existsSync(dst) && !opts.force) {
|
|
571
|
+
console.log(` Skipping ${file} (already exists — use --force to overwrite)`);
|
|
572
|
+
jsonSkipped++;
|
|
573
|
+
}
|
|
574
|
+
else {
|
|
575
|
+
fs.copyFileSync(src, dst);
|
|
576
|
+
console.log(` ✓ ${file}`);
|
|
577
|
+
jsonImported++;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
console.log(`Config files: ${jsonImported} imported, ${jsonSkipped} skipped.`);
|
|
581
|
+
}
|
|
562
582
|
// Also try to migrate config.json from the parent directory
|
|
563
583
|
// e.g. if source is ~/.openclaw/shellchat/data/, config is at ~/.openclaw/shellchat/config.json
|
|
564
584
|
const parentConfigPath = path.join(path.dirname(resolvedSource), 'config.json');
|