codealmanac 0.1.3 → 0.1.4

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.
@@ -1061,11 +1061,12 @@ function closeStream2(stream) {
1061
1061
  }
1062
1062
 
1063
1063
  // src/commands/doctor.ts
1064
- import { existsSync as existsSync12, readdirSync, statSync as statSync3 } from "fs";
1064
+ import { existsSync as existsSync12, readFileSync, readdirSync, statSync as statSync3 } from "fs";
1065
1065
  import { readFile as readFile10 } from "fs/promises";
1066
1066
  import { createRequire as createRequire3 } from "module";
1067
1067
  import { homedir as homedir5 } from "os";
1068
1068
  import path4 from "path";
1069
+ import { fileURLToPath as fileURLToPath4 } from "url";
1069
1070
 
1070
1071
  // src/indexer/schema.ts
1071
1072
  import Database from "better-sqlite3";
@@ -2936,8 +2937,23 @@ function countHealthProblems(jsonStdout) {
2936
2937
  }
2937
2938
  function detectInstallPath() {
2938
2939
  try {
2939
- const entry = req.resolve("codealmanac");
2940
- return path4.dirname(path4.dirname(entry));
2940
+ const here = fileURLToPath4(import.meta.url);
2941
+ let dir = path4.dirname(here);
2942
+ for (let i = 0; i < 5; i++) {
2943
+ const pkgPath = path4.join(dir, "package.json");
2944
+ if (existsSync12(pkgPath)) {
2945
+ try {
2946
+ const raw = readFileSync(pkgPath, "utf-8");
2947
+ const pkg = JSON.parse(raw);
2948
+ if (pkg.name === "codealmanac") return dir;
2949
+ } catch {
2950
+ }
2951
+ }
2952
+ const parent = path4.dirname(dir);
2953
+ if (parent === dir) break;
2954
+ dir = parent;
2955
+ }
2956
+ return null;
2941
2957
  } catch {
2942
2958
  return null;
2943
2959
  }