@clawchatsai/connector 0.0.8 → 0.0.9

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.
Files changed (2) hide show
  1. package/dist/index.js +15 -36
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -521,7 +521,7 @@ async function handleReset() {
521
521
  console.error(`Reset failed: ${e.message}`);
522
522
  }
523
523
  }
524
- async function handleImport(sourcePath, opts) {
524
+ async function handleImport(sourcePath) {
525
525
  const resolvedSource = path.resolve(sourcePath);
526
526
  if (!fs.existsSync(resolvedSource)) {
527
527
  console.error(`Source path not found: ${resolvedSource}`);
@@ -547,54 +547,33 @@ async function handleImport(sourcePath, opts) {
547
547
  for (const file of dbFiles) {
548
548
  const src = path.join(resolvedSource, file);
549
549
  const dst = path.join(destDataDir, file);
550
- if (fs.existsSync(dst) && !opts.force) {
551
- console.log(` Skipping ${file} (already exists — use --force to overwrite)`);
552
- skipped++;
553
- }
554
- else {
555
- fs.copyFileSync(src, dst);
556
- console.log(` ✓ ${file}`);
557
- imported++;
558
- }
550
+ fs.copyFileSync(src, dst);
551
+ console.log(` ${file}`);
552
+ imported++;
559
553
  }
560
- console.log(`Databases: ${imported} imported, ${skipped} skipped.`);
554
+ console.log(`Databases: ${imported} imported.`);
561
555
  }
562
556
  // Import .json config files (workspaces.json, settings.json, etc.)
563
557
  const jsonFiles = fs.readdirSync(resolvedSource).filter(f => f.endsWith('.json'));
564
558
  if (jsonFiles.length > 0) {
565
- let jsonImported = 0;
566
- let jsonSkipped = 0;
567
559
  for (const file of jsonFiles) {
568
560
  const src = path.join(resolvedSource, file);
569
561
  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
- }
562
+ fs.copyFileSync(src, dst);
563
+ console.log(` ${file}`);
579
564
  }
580
- console.log(`Config files: ${jsonImported} imported, ${jsonSkipped} skipped.`);
581
565
  }
582
566
  // Also try to migrate config.json from the parent directory
583
567
  // e.g. if source is ~/.openclaw/shellchat/data/, config is at ~/.openclaw/shellchat/config.json
584
568
  const parentConfigPath = path.join(path.dirname(resolvedSource), 'config.json');
585
569
  if (fs.existsSync(parentConfigPath)) {
586
- if (fs.existsSync(CONFIG_FILE) && !opts.force) {
587
- console.log(' Skipping config.json (already exists — use --force to overwrite)');
570
+ try {
571
+ fs.mkdirSync(CONFIG_DIR, { recursive: true });
572
+ fs.copyFileSync(parentConfigPath, CONFIG_FILE);
573
+ console.log(' ✓ config.json (plugin credentials migrated)');
588
574
  }
589
- else {
590
- try {
591
- fs.mkdirSync(CONFIG_DIR, { recursive: true });
592
- fs.copyFileSync(parentConfigPath, CONFIG_FILE);
593
- console.log(' ✓ config.json (plugin credentials migrated)');
594
- }
595
- catch (e) {
596
- console.error(` Failed to migrate config.json: ${e.message}`);
597
- }
575
+ catch (e) {
576
+ console.error(` Failed to migrate config.json: ${e.message}`);
598
577
  }
599
578
  }
600
579
  console.log('Done.');
@@ -626,8 +605,8 @@ const plugin = {
626
605
  .description('Disconnect and remove all ShellChats data')
627
606
  .action(() => handleReset());
628
607
  cmd.command('import <path>')
629
- .description('Import databases from a folder (e.g. migrate from old data directory). Use --force to overwrite existing files.')
630
- .action((srcPath) => handleImport(String(srcPath), { force: process.argv.includes('--force') }));
608
+ .description('Import databases and config from a folder (e.g. migrate from old data directory)')
609
+ .action((srcPath) => handleImport(String(srcPath)));
631
610
  });
632
611
  // Slash command for status from any channel
633
612
  api.registerCommand({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawchatsai/connector",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "type": "module",
5
5
  "description": "ShellChat OpenClaw plugin — P2P tunnel + local API bridge",
6
6
  "main": "dist/index.js",