repowisestage 0.0.41 → 0.0.43

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.
@@ -874,7 +874,7 @@ __export(sidecar_cache_exports, {
874
874
  sidecarCachePaths: () => sidecarCachePaths
875
875
  });
876
876
  import { mkdir as mkdir8, readFile as readFile7, readdir as readdir3, stat as stat2, unlink as unlink7, writeFile as writeFile8 } from "fs/promises";
877
- import { dirname as dirname5, join as join15 } from "path";
877
+ import { dirname as dirname6, join as join15 } from "path";
878
878
  function repoIdSafe(repoId) {
879
879
  return /^[A-Za-z0-9_.-]{1,128}$/.test(repoId) && !repoId.startsWith(".");
880
880
  }
@@ -1472,13 +1472,13 @@ var init_lsp_tools = __esm({
1472
1472
  // bin/repowise.ts
1473
1473
  import { readFileSync as readFileSync3 } from "fs";
1474
1474
  import { fileURLToPath as fileURLToPath4 } from "url";
1475
- import { dirname as dirname17, join as join45 } from "path";
1475
+ import { dirname as dirname18, join as join45 } from "path";
1476
1476
  import { Command } from "commander";
1477
1477
 
1478
1478
  // ../listener/dist/main.js
1479
1479
  init_config_dir();
1480
1480
  import { readFile as readFile12, writeFile as writeFile14, mkdir as mkdir14, stat as fsStat } from "fs/promises";
1481
- import { join as join27, dirname as dirname12 } from "path";
1481
+ import { join as join27, dirname as dirname13 } from "path";
1482
1482
  import { fileURLToPath as fileURLToPath3 } from "url";
1483
1483
  import lockfile3 from "proper-lockfile";
1484
1484
 
@@ -3046,7 +3046,7 @@ var LspClient = class extends EventEmitter {
3046
3046
  init_config_dir();
3047
3047
  init_registry();
3048
3048
  import { promises as fs } from "fs";
3049
- import { join as join14 } from "path";
3049
+ import { join as join14, dirname as dirname5 } from "path";
3050
3050
  import { spawn as spawn3 } from "child_process";
3051
3051
  function getLspInstallDir() {
3052
3052
  return join14(getConfigDir(), "lsp-servers");
@@ -3083,12 +3083,33 @@ async function ensureNpmLspInstalled(config2) {
3083
3083
  };
3084
3084
  }
3085
3085
  }
3086
- function runNpmInstall(cwd, pkg2) {
3086
+ async function resolveNpmCommand() {
3087
+ const nodeDir = dirname5(process.execPath);
3088
+ for (const candidate of [join14(nodeDir, "npm"), join14(nodeDir, "npm.cmd")]) {
3089
+ try {
3090
+ await fs.access(candidate);
3091
+ return candidate;
3092
+ } catch {
3093
+ }
3094
+ }
3095
+ for (const candidate of ["/opt/homebrew/bin/npm", "/usr/local/bin/npm", "/usr/bin/npm"]) {
3096
+ try {
3097
+ await fs.access(candidate);
3098
+ return candidate;
3099
+ } catch {
3100
+ }
3101
+ }
3102
+ return "npm";
3103
+ }
3104
+ async function runNpmInstall(cwd, pkg2) {
3105
+ const npmCmd = await resolveNpmCommand();
3106
+ const nodeDir = dirname5(process.execPath);
3107
+ const augmentedPath = process.env.PATH ? `${nodeDir}:${process.env.PATH}` : nodeDir;
3087
3108
  return new Promise((resolve4, reject) => {
3088
- const child = spawn3("npm", ["install", "--no-audit", "--no-fund", "--silent", pkg2], {
3109
+ const child = spawn3(npmCmd, ["install", "--no-audit", "--no-fund", "--silent", pkg2], {
3089
3110
  cwd,
3090
3111
  stdio: ["ignore", "pipe", "pipe"],
3091
- env: { ...process.env }
3112
+ env: { ...process.env, PATH: augmentedPath }
3092
3113
  });
3093
3114
  let stderr = "";
3094
3115
  child.stderr.on("data", (chunk) => {
@@ -3668,7 +3689,7 @@ function defaultRepoWiseHome() {
3668
3689
 
3669
3690
  // ../listener/dist/mcp/graph-downloader.js
3670
3691
  import { mkdir as mkdir9, rename as rename3, writeFile as writeFile9 } from "fs/promises";
3671
- import { dirname as dirname6 } from "path";
3692
+ import { dirname as dirname7 } from "path";
3672
3693
  function createGraphDownloader(options) {
3673
3694
  const fetchFn = options.fetchImpl ?? fetch;
3674
3695
  let lastSha = null;
@@ -3719,7 +3740,7 @@ function createGraphDownloader(options) {
3719
3740
  message: `graph parse: ${err instanceof Error ? err.message : String(err)}`
3720
3741
  };
3721
3742
  }
3722
- await mkdir9(dirname6(options.targetPath), { recursive: true });
3743
+ await mkdir9(dirname7(options.targetPath), { recursive: true });
3723
3744
  const tmpPath = `${options.targetPath}.${Date.now()}.tmp`;
3724
3745
  await writeFile9(tmpPath, body, { encoding: "utf-8", mode: 384 });
3725
3746
  await rename3(tmpPath, options.targetPath);
@@ -3745,7 +3766,7 @@ function createGraphDownloader(options) {
3745
3766
  // ../listener/dist/mcp/log-encryption.js
3746
3767
  import { createCipheriv, createDecipheriv, randomBytes } from "crypto";
3747
3768
  import { mkdir as mkdir10, readFile as readFile9, stat as stat4, writeFile as writeFile10 } from "fs/promises";
3748
- import { dirname as dirname7 } from "path";
3769
+ import { dirname as dirname8 } from "path";
3749
3770
  var KEY_BYTES = 32;
3750
3771
  var IV_BYTES = 12;
3751
3772
  var TAG_BYTES = 16;
@@ -3792,7 +3813,7 @@ function createFileKeyStore(keyPath) {
3792
3813
  return parsed;
3793
3814
  }
3794
3815
  const fresh = randomBytes(KEY_BYTES);
3795
- await mkdir10(dirname7(keyPath), { recursive: true });
3816
+ await mkdir10(dirname8(keyPath), { recursive: true });
3796
3817
  const tmp = `${keyPath}.tmp`;
3797
3818
  await writeFile10(tmp, fresh.toString("base64") + "\n", {
3798
3819
  encoding: "utf-8",
@@ -3834,7 +3855,7 @@ function decryptLine(encoded, key) {
3834
3855
 
3835
3856
  // ../listener/dist/mcp/mcp-logger.js
3836
3857
  import { appendFile, mkdir as mkdir11, stat as stat5, unlink as unlink8, writeFile as writeFile11, readFile as readFile10 } from "fs/promises";
3837
- import { dirname as dirname8 } from "path";
3858
+ import { dirname as dirname9 } from "path";
3838
3859
  var DEFAULT_MAX_BYTES = 100 * 1024 * 1024;
3839
3860
  function createMcpLogger(options) {
3840
3861
  const maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;
@@ -3857,7 +3878,7 @@ function createMcpLogger(options) {
3857
3878
  await migrateLegacyPlaintext();
3858
3879
  const key = await options.keyStore.getKey();
3859
3880
  const encoded = encryptLine(JSON.stringify(entry), key) + "\n";
3860
- await mkdir11(dirname8(options.filePath), { recursive: true });
3881
+ await mkdir11(dirname9(options.filePath), { recursive: true });
3861
3882
  await appendFile(options.filePath, encoded, { encoding: "utf-8", mode: 384 });
3862
3883
  try {
3863
3884
  const s = await stat5(options.filePath);
@@ -3891,7 +3912,7 @@ async function rotate(path, size) {
3891
3912
  // ../listener/dist/mcp/mcp-log-uploader.js
3892
3913
  import { randomUUID } from "crypto";
3893
3914
  import { readFile as readFile11, writeFile as writeFile12, mkdir as mkdir12 } from "fs/promises";
3894
- import { dirname as dirname9 } from "path";
3915
+ import { dirname as dirname10 } from "path";
3895
3916
  var DEFAULT_MAX_ENTRIES = 5e3;
3896
3917
  var DEFAULT_MAX_BYTES2 = 1 * 1024 * 1024;
3897
3918
  function createMcpLogUploader(options) {
@@ -4041,7 +4062,7 @@ async function readPendingBatch(watermarkPath) {
4041
4062
  }
4042
4063
  }
4043
4064
  async function writePendingBatch(watermarkPath, batchId) {
4044
- await mkdir12(dirname9(watermarkPath), { recursive: true });
4065
+ await mkdir12(dirname10(watermarkPath), { recursive: true });
4045
4066
  await writeFile12(pendingPath(watermarkPath), batchId, { encoding: "utf-8", mode: 384 });
4046
4067
  }
4047
4068
  async function clearPendingBatch(watermarkPath) {
@@ -4063,7 +4084,7 @@ async function readWatermark(path) {
4063
4084
  }
4064
4085
  }
4065
4086
  async function writeWatermark(path, offset) {
4066
- await mkdir12(dirname9(path), { recursive: true });
4087
+ await mkdir12(dirname10(path), { recursive: true });
4067
4088
  const tmp = `${path}.tmp`;
4068
4089
  await writeFile12(tmp, offset.toString() + "\n", { encoding: "utf-8", mode: 384 });
4069
4090
  const { rename: rename5 } = await import("fs/promises");
@@ -4083,7 +4104,7 @@ async function isLocallyConsented(flagPath2) {
4083
4104
  init_config_dir();
4084
4105
  import { createServer } from "http";
4085
4106
  import { mkdir as mkdir13, writeFile as writeFile13 } from "fs/promises";
4086
- import { dirname as dirname10, join as join17 } from "path";
4107
+ import { dirname as dirname11, join as join17 } from "path";
4087
4108
  import { createHash as createHash2, randomUUID as randomUUID2 } from "crypto";
4088
4109
 
4089
4110
  // ../listener/dist/mcp/sanitize.js
@@ -5422,7 +5443,7 @@ async function readJson(req) {
5422
5443
  }
5423
5444
  }
5424
5445
  async function writeEndpointFile(path, endpoint, secret) {
5425
- await mkdir13(dirname10(path), { recursive: true });
5446
+ await mkdir13(dirname11(path), { recursive: true });
5426
5447
  await writeFile13(path, formatEndpointFile({ endpoint, secret }), {
5427
5448
  encoding: "utf-8",
5428
5449
  mode: 384
@@ -5627,7 +5648,7 @@ import { join as join19 } from "path";
5627
5648
 
5628
5649
  // ../listener/dist/mcp/auto-config/markers.js
5629
5650
  import { promises as fs2 } from "fs";
5630
- import { dirname as dirname11 } from "path";
5651
+ import { dirname as dirname12 } from "path";
5631
5652
  async function writeMergedConfig(params) {
5632
5653
  const current = await readConfig(params.path);
5633
5654
  const servers = { ...current.mcpServers ?? {} };
@@ -5637,7 +5658,7 @@ async function writeMergedConfig(params) {
5637
5658
  const existing = safeExistingContent(params.path, current);
5638
5659
  if (existing === canonical)
5639
5660
  return "unchanged";
5640
- await fs2.mkdir(dirname11(params.path), { recursive: true });
5661
+ await fs2.mkdir(dirname12(params.path), { recursive: true });
5641
5662
  await fs2.writeFile(params.path, canonical, "utf-8");
5642
5663
  return "written";
5643
5664
  }
@@ -6260,11 +6281,11 @@ function resolveAuditRoots() {
6260
6281
  return override.split(":").map((s) => s.trim()).filter(Boolean);
6261
6282
  }
6262
6283
  const out = /* @__PURE__ */ new Set();
6263
- let dir = dirname12(process.execPath);
6284
+ let dir = dirname13(process.execPath);
6264
6285
  for (let i = 0; i < 8; i += 1) {
6265
6286
  out.add(join27(dir, "node_modules"));
6266
6287
  out.add(join27(dir, "lib", "node_modules"));
6267
- const parent = dirname12(dir);
6288
+ const parent = dirname13(dir);
6268
6289
  if (parent === dir)
6269
6290
  break;
6270
6291
  dir = parent;
@@ -6713,7 +6734,7 @@ async function startListener() {
6713
6734
  const packageName = true ? "repowisestage" : "repowise";
6714
6735
  let currentVersion = "";
6715
6736
  try {
6716
- const selfDir = dirname12(fileURLToPath3(import.meta.url));
6737
+ const selfDir = dirname13(fileURLToPath3(import.meta.url));
6717
6738
  const pkgJsonPath = join27(selfDir, "..", "..", "package.json");
6718
6739
  const pkgJson = JSON.parse(await readFile12(pkgJsonPath, "utf-8"));
6719
6740
  currentVersion = pkgJson.version;
@@ -7234,7 +7255,7 @@ async function showWelcome(currentVersion) {
7234
7255
 
7235
7256
  // src/commands/create.ts
7236
7257
  import { mkdirSync, writeFileSync as writeFileSync2 } from "fs";
7237
- import { dirname as dirname13, join as join33 } from "path";
7258
+ import { dirname as dirname14, join as join33 } from "path";
7238
7259
  init_src();
7239
7260
  import chalk5 from "chalk";
7240
7261
  import ora from "ora";
@@ -8486,7 +8507,7 @@ async function create() {
8486
8507
  if (response.ok) {
8487
8508
  const content = await response.text();
8488
8509
  const filePath = join33(contextDir, file.fileName);
8489
- mkdirSync(dirname13(filePath), { recursive: true });
8510
+ mkdirSync(dirname14(filePath), { recursive: true });
8490
8511
  writeFileSync2(filePath, content, "utf-8");
8491
8512
  downloadedCount++;
8492
8513
  } else {
@@ -8627,7 +8648,7 @@ Files are stored on our servers (not in git). Retry when online.`
8627
8648
 
8628
8649
  // src/commands/member.ts
8629
8650
  import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync3 } from "fs";
8630
- import { dirname as dirname14, join as join34, resolve, sep } from "path";
8651
+ import { dirname as dirname15, join as join34, resolve, sep } from "path";
8631
8652
  import chalk6 from "chalk";
8632
8653
  import ora2 from "ora";
8633
8654
  var DEFAULT_CONTEXT_FOLDER2 = "repowise-context";
@@ -8772,7 +8793,7 @@ async function member() {
8772
8793
  const response = await fetch(presignedUrl);
8773
8794
  if (response.ok) {
8774
8795
  const content = await response.text();
8775
- mkdirSync2(dirname14(safePath), { recursive: true });
8796
+ mkdirSync2(dirname15(safePath), { recursive: true });
8776
8797
  writeFileSync3(safePath, content, "utf-8");
8777
8798
  downloadedCount++;
8778
8799
  } else {
@@ -9063,7 +9084,7 @@ async function status() {
9063
9084
 
9064
9085
  // src/commands/sync.ts
9065
9086
  import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync4 } from "fs";
9066
- import { dirname as dirname15, join as join37 } from "path";
9087
+ import { dirname as dirname16, join as join37 } from "path";
9067
9088
  import chalk9 from "chalk";
9068
9089
  import ora4 from "ora";
9069
9090
  var POLL_INTERVAL_MS2 = 3e3;
@@ -9227,7 +9248,7 @@ async function sync() {
9227
9248
  if (response.ok) {
9228
9249
  const content = await response.text();
9229
9250
  const filePath = join37(contextDir, file.fileName);
9230
- mkdirSync3(dirname15(filePath), { recursive: true });
9251
+ mkdirSync3(dirname16(filePath), { recursive: true });
9231
9252
  writeFileSync4(filePath, content, "utf-8");
9232
9253
  downloadedCount++;
9233
9254
  } else {
@@ -9479,7 +9500,7 @@ async function config() {
9479
9500
  // src/commands/mcp-log.ts
9480
9501
  import { createDecipheriv as createDecipheriv2 } from "crypto";
9481
9502
  import { mkdir as mkdir18, readFile as readFile17, stat as stat6, writeFile as writeFile18 } from "fs/promises";
9482
- import { dirname as dirname16, join as join38 } from "path";
9503
+ import { dirname as dirname17, join as join38 } from "path";
9483
9504
  var FLAG_FILE = "mcp-log.flag";
9484
9505
  var LOG_FILE = "mcp-log.jsonl.enc";
9485
9506
  var KEY_FILE = "mcp-log.key";
@@ -9506,7 +9527,7 @@ async function readFlag() {
9506
9527
  }
9507
9528
  async function writeFlag(flag) {
9508
9529
  const path = flagPath();
9509
- await mkdir18(dirname16(path), { recursive: true });
9530
+ await mkdir18(dirname17(path), { recursive: true });
9510
9531
  await writeFile18(path, JSON.stringify(flag, null, 2), { encoding: "utf-8", mode: 384 });
9511
9532
  }
9512
9533
  async function showConsentPrompt() {
@@ -10819,7 +10840,7 @@ async function lspDoctor() {
10819
10840
 
10820
10841
  // bin/repowise.ts
10821
10842
  var __filename = fileURLToPath4(import.meta.url);
10822
- var __dirname = dirname17(__filename);
10843
+ var __dirname = dirname18(__filename);
10823
10844
  var pkg = JSON.parse(readFileSync3(join45(__dirname, "..", "..", "package.json"), "utf-8"));
10824
10845
  var program = new Command();
10825
10846
  program.name(getPackageName()).description("AI-optimized codebase context generator").version(pkg.version).hook("preAction", async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repowisestage",
3
- "version": "0.0.41",
3
+ "version": "0.0.43",
4
4
  "type": "module",
5
5
  "description": "AI-optimized codebase context generator",
6
6
  "bin": {