@codedir/mimir-code 0.1.4 → 0.1.5

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.mjs CHANGED
@@ -3907,15 +3907,24 @@ import { readFileSync, existsSync } from "fs";
3907
3907
  function locateWasmFile() {
3908
3908
  const wasmFileName = "sql-wasm.wasm";
3909
3909
  const currentDir = dirname(fileURLToPath(import.meta.url));
3910
+ console.log("WASM file search - debugging:", {
3911
+ "import.meta.url": import.meta.url,
3912
+ currentDir,
3913
+ "process.cwd()": process.cwd()
3914
+ });
3910
3915
  const nodeModulesPaths = [
3911
- // Relative to the built module (dist/storage/Database.js)
3916
+ // Relative to the built module (bundled dist/cli.mjs)
3917
+ join(currentDir, "..", "node_modules", "sql.js", "dist", wasmFileName),
3918
+ // Relative to the built module (unbundled dist/storage/Database.js)
3912
3919
  join(currentDir, "..", "..", "node_modules", "sql.js", "dist", wasmFileName),
3913
3920
  // Relative to current working directory (for local development)
3914
3921
  join(process.cwd(), "node_modules", "sql.js", "dist", wasmFileName)
3915
3922
  ];
3916
3923
  for (const modulePath of nodeModulesPaths) {
3924
+ console.log(` Checking: ${modulePath} - ${existsSync(modulePath) ? "FOUND" : "not found"}`);
3917
3925
  if (existsSync(modulePath)) {
3918
3926
  const buffer = readFileSync(modulePath);
3927
+ console.log(" \u2705 Loaded WASM from node_modules");
3919
3928
  return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
3920
3929
  }
3921
3930
  }
@@ -3930,8 +3939,12 @@ function locateWasmFile() {
3930
3939
  join(binaryDir, "..", "resources", wasmFileName)
3931
3940
  ];
3932
3941
  for (const resourcePath of resourcesPaths) {
3942
+ console.log(
3943
+ ` Checking: ${resourcePath} - ${existsSync(resourcePath) ? "FOUND" : "not found"}`
3944
+ );
3933
3945
  if (existsSync(resourcePath)) {
3934
3946
  const buffer = readFileSync(resourcePath);
3947
+ console.log(" \u2705 Loaded WASM from resources/");
3935
3948
  return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
3936
3949
  }
3937
3950
  }
@@ -4541,8 +4554,18 @@ checkpoints/
4541
4554
  const currentDir = dirname2(fileURLToPath2(import.meta.url));
4542
4555
  const executablePath = process.argv[0] || process.execPath;
4543
4556
  const binaryDir = dirname2(executablePath);
4557
+ logger.info("Theme copy - path debugging", {
4558
+ "import.meta.url": import.meta.url,
4559
+ currentDir,
4560
+ executablePath,
4561
+ binaryDir,
4562
+ "process.cwd()": process.cwd()
4563
+ });
4544
4564
  const possibleSourceDirs = [
4545
- // npm package: <package-root>/src/cli/themes/
4565
+ // npm package (bundled CLI): <package-root>/src/cli/themes/
4566
+ path6.join(currentDir, "../src/cli/themes"),
4567
+ // From dist/ -> src/cli/themes (bundled)
4568
+ // npm package (unbundled): <package-root>/src/cli/themes/
4546
4569
  path6.join(currentDir, "../../src/cli/themes"),
4547
4570
  // From dist/core/ -> src/cli/themes
4548
4571
  // Development: dist/core/../cli/themes
@@ -4592,8 +4615,18 @@ checkpoints/
4592
4615
  const currentDir = dirname2(fileURLToPath2(import.meta.url));
4593
4616
  const executablePath = process.argv[0] || process.execPath;
4594
4617
  const binaryDir = dirname2(executablePath);
4618
+ logger.info("Command copy - path debugging", {
4619
+ "import.meta.url": import.meta.url,
4620
+ currentDir,
4621
+ executablePath,
4622
+ binaryDir,
4623
+ "process.cwd()": process.cwd()
4624
+ });
4595
4625
  const possibleSourceDirs = [
4596
- // npm package: <package-root>/scripts/templates/commands/
4626
+ // npm package (bundled CLI): <package-root>/scripts/templates/commands/
4627
+ path6.join(currentDir, "../scripts/templates/commands"),
4628
+ // From dist/ -> scripts/templates/commands (bundled)
4629
+ // npm package (unbundled): <package-root>/scripts/templates/commands/
4597
4630
  path6.join(currentDir, "../../scripts/templates/commands"),
4598
4631
  // From dist/core/ -> scripts/templates/commands
4599
4632
  // Development: dist/core/../../scripts/templates/commands
@@ -4658,10 +4691,14 @@ checkpoints/
4658
4691
  result.errors.push("Database file was not created on disk");
4659
4692
  }
4660
4693
  } catch (error) {
4661
- result.errors.push(
4662
- `Database initialization failed: ${error instanceof Error ? error.message : String(error)}`
4663
- );
4664
- logger.error("Failed to initialize database", { error });
4694
+ const errorMessage = error instanceof Error ? error.message : String(error);
4695
+ const errorStack = error instanceof Error ? error.stack : void 0;
4696
+ result.errors.push(`Database initialization failed: ${errorMessage}`);
4697
+ logger.error("Failed to initialize database", {
4698
+ errorMessage,
4699
+ errorStack,
4700
+ errorType: error instanceof Error ? error.constructor.name : typeof error
4701
+ });
4665
4702
  }
4666
4703
  }
4667
4704
  /**