@codedir/mimir-code 0.1.3 → 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
  }
@@ -4418,6 +4431,7 @@ function closeDatabaseManager() {
4418
4431
 
4419
4432
  // src/core/MimirInitializer.ts
4420
4433
  import path6, { dirname as dirname2 } from "path";
4434
+ import { fileURLToPath as fileURLToPath2 } from "url";
4421
4435
  var MimirInitializer = class {
4422
4436
  constructor(fs4, configLoader2) {
4423
4437
  this.fs = fs4;
@@ -4537,15 +4551,27 @@ checkpoints/
4537
4551
  "light-colorblind.json"
4538
4552
  ];
4539
4553
  try {
4554
+ const currentDir = dirname2(fileURLToPath2(import.meta.url));
4540
4555
  const executablePath = process.argv[0] || process.execPath;
4541
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
+ });
4542
4564
  const possibleSourceDirs = [
4543
- path6.join(binaryDir, "resources", "themes"),
4544
- // Compiled binary: ~/.local/bin/resources/themes/
4545
- path6.join(binaryDir, "../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/
4569
+ path6.join(currentDir, "../../src/cli/themes"),
4570
+ // From dist/core/ -> src/cli/themes
4546
4571
  // Development: dist/core/../cli/themes
4547
- path6.join(binaryDir, "../../src/cli/themes")
4548
- // Development: dist/core/../../src/cli/themes
4572
+ path6.join(currentDir, "../cli/themes"),
4573
+ // Compiled binary: ~/.local/bin/resources/themes/
4574
+ path6.join(binaryDir, "resources", "themes")
4549
4575
  ];
4550
4576
  for (const themeFile of defaultThemes) {
4551
4577
  const destPath = path6.join(themesDir, themeFile);
@@ -4586,15 +4612,27 @@ checkpoints/
4586
4612
  const commandsDir = path6.join(mimirDir, "commands");
4587
4613
  const exampleCommands = ["update-docs.yml"];
4588
4614
  try {
4615
+ const currentDir = dirname2(fileURLToPath2(import.meta.url));
4589
4616
  const executablePath = process.argv[0] || process.execPath;
4590
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
+ });
4591
4625
  const possibleSourceDirs = [
4592
- path6.join(binaryDir, "resources", "commands"),
4593
- // Compiled binary: ~/.local/bin/resources/commands/
4594
- path6.join(binaryDir, "../../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/
4630
+ path6.join(currentDir, "../../scripts/templates/commands"),
4631
+ // From dist/core/ -> scripts/templates/commands
4595
4632
  // Development: dist/core/../../scripts/templates/commands
4596
- path6.join(binaryDir, "../../../scripts/templates/commands")
4597
- // Alternative dev path
4633
+ path6.join(currentDir, "../../../scripts/templates/commands"),
4634
+ // Compiled binary: ~/.local/bin/resources/commands/
4635
+ path6.join(binaryDir, "resources", "commands")
4598
4636
  ];
4599
4637
  for (const commandFile of exampleCommands) {
4600
4638
  const destPath = path6.join(commandsDir, commandFile);
@@ -4653,10 +4691,14 @@ checkpoints/
4653
4691
  result.errors.push("Database file was not created on disk");
4654
4692
  }
4655
4693
  } catch (error) {
4656
- result.errors.push(
4657
- `Database initialization failed: ${error instanceof Error ? error.message : String(error)}`
4658
- );
4659
- 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
+ });
4660
4702
  }
4661
4703
  }
4662
4704
  /**