gnosys 5.3.0 → 5.3.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/dist/cli.js CHANGED
@@ -2692,9 +2692,9 @@ remoteCmd
2692
2692
  });
2693
2693
  remoteCmd
2694
2694
  .command("configure")
2695
- .description("Configure or change the remote sync location (interactive)")
2696
- .option("--path <path>", "Set remote path non-interactively")
2697
- .option("--migrate", "Copy current local DB to remote on first setup")
2695
+ .description("Configure or change the remote sync location (interactive wizard)")
2696
+ .option("--path <path>", "Set remote path non-interactively (skips wizard)")
2697
+ .option("--migrate", "Copy current local DB to remote on first setup (with --path)")
2698
2698
  .action(async (opts) => {
2699
2699
  let centralDb = null;
2700
2700
  try {
@@ -2703,65 +2703,16 @@ remoteCmd
2703
2703
  console.error("Central DB not available.");
2704
2704
  process.exit(1);
2705
2705
  }
2706
- const { validateLocation, RemoteSync } = await import("./lib/remote.js");
2707
- let remotePath = opts.path;
2708
- if (!remotePath) {
2709
- const { createInterface } = await import("readline/promises");
2710
- const rl = createInterface({ input: process.stdin, output: process.stdout });
2711
- try {
2712
- const current = centralDb.getMeta("remote_path");
2713
- if (current)
2714
- console.log(`Current remote: ${current}`);
2715
- remotePath = (await rl.question("Remote path (e.g. /Volumes/synology/gnosys): ")).trim();
2716
- }
2717
- finally {
2718
- rl.close();
2719
- }
2720
- }
2721
- if (!remotePath) {
2722
- console.error("No path provided.");
2723
- process.exit(1);
2706
+ const { runConfigureWizard, configureFromPath } = await import("./lib/remoteWizard.js");
2707
+ if (opts.path) {
2708
+ // Non-interactive mode
2709
+ const ok = await configureFromPath(centralDb, opts.path, { migrate: opts.migrate });
2710
+ process.exit(ok ? 0 : 1);
2724
2711
  }
2725
- console.log(`\nValidating ${remotePath}...`);
2726
- const validation = await validateLocation(remotePath);
2727
- console.log(` Path exists: ${validation.checks.pathExists ? "✓" : "✗"}`);
2728
- console.log(` Writable: ${validation.checks.writable ? "✓" : "✗"}`);
2729
- console.log(` SQLite compatible: ${validation.checks.sqliteCompatible ? "✓" : "✗"}`);
2730
- if (validation.checks.latencyMs !== null) {
2731
- console.log(` Latency: ${validation.checks.latencyMs}ms`);
2732
- }
2733
- if (validation.checks.existingDb.found) {
2734
- const c = validation.checks.existingDb;
2735
- console.log(` Existing DB found: ${c.memoryCount ?? "unknown"} memories (last modified ${c.lastModified ?? "unknown"})`);
2736
- }
2737
- for (const w of validation.warnings)
2738
- console.log(` ⚠ ${w}`);
2739
- for (const e of validation.errors)
2740
- console.log(` ✗ ${e}`);
2741
- if (!validation.ok) {
2742
- console.error("\nValidation failed. Remote not configured.");
2743
- process.exit(1);
2744
- }
2745
- // Save config
2746
- centralDb.setMeta("remote_path", remotePath);
2747
- console.log(`\nRemote configured: ${remotePath}`);
2748
- // Optional initial migration
2749
- if (opts.migrate && !validation.checks.existingDb.found) {
2750
- console.log("\nMigrating local DB to remote...");
2751
- const sync = new RemoteSync(centralDb, remotePath);
2752
- const result = await sync.migrate();
2753
- sync.closeRemote();
2754
- if (result.ok) {
2755
- console.log(` ✓ Copied ${result.copied} memories to remote.`);
2756
- }
2757
- else {
2758
- console.error(` ✗ Migration had errors:`);
2759
- for (const e of result.errors)
2760
- console.error(` ${e}`);
2761
- }
2762
- }
2763
- else if (validation.checks.existingDb.found) {
2764
- console.log("\nExisting DB found at remote. Run 'gnosys remote sync' to merge.");
2712
+ else {
2713
+ // Interactive wizard
2714
+ const ok = await runConfigureWizard(centralDb);
2715
+ process.exit(ok ? 0 : 1);
2765
2716
  }
2766
2717
  }
2767
2718
  catch (err) {