repowisestage 0.0.41 → 0.0.42
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/bin/repowise.js +50 -31
- package/package.json +1 -1
package/dist/bin/repowise.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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,9 +3083,28 @@ async function ensureNpmLspInstalled(config2) {
|
|
|
3083
3083
|
};
|
|
3084
3084
|
}
|
|
3085
3085
|
}
|
|
3086
|
-
function
|
|
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();
|
|
3087
3106
|
return new Promise((resolve4, reject) => {
|
|
3088
|
-
const child = spawn3(
|
|
3107
|
+
const child = spawn3(npmCmd, ["install", "--no-audit", "--no-fund", "--silent", pkg2], {
|
|
3089
3108
|
cwd,
|
|
3090
3109
|
stdio: ["ignore", "pipe", "pipe"],
|
|
3091
3110
|
env: { ...process.env }
|
|
@@ -3668,7 +3687,7 @@ function defaultRepoWiseHome() {
|
|
|
3668
3687
|
|
|
3669
3688
|
// ../listener/dist/mcp/graph-downloader.js
|
|
3670
3689
|
import { mkdir as mkdir9, rename as rename3, writeFile as writeFile9 } from "fs/promises";
|
|
3671
|
-
import { dirname as
|
|
3690
|
+
import { dirname as dirname7 } from "path";
|
|
3672
3691
|
function createGraphDownloader(options) {
|
|
3673
3692
|
const fetchFn = options.fetchImpl ?? fetch;
|
|
3674
3693
|
let lastSha = null;
|
|
@@ -3719,7 +3738,7 @@ function createGraphDownloader(options) {
|
|
|
3719
3738
|
message: `graph parse: ${err instanceof Error ? err.message : String(err)}`
|
|
3720
3739
|
};
|
|
3721
3740
|
}
|
|
3722
|
-
await mkdir9(
|
|
3741
|
+
await mkdir9(dirname7(options.targetPath), { recursive: true });
|
|
3723
3742
|
const tmpPath = `${options.targetPath}.${Date.now()}.tmp`;
|
|
3724
3743
|
await writeFile9(tmpPath, body, { encoding: "utf-8", mode: 384 });
|
|
3725
3744
|
await rename3(tmpPath, options.targetPath);
|
|
@@ -3745,7 +3764,7 @@ function createGraphDownloader(options) {
|
|
|
3745
3764
|
// ../listener/dist/mcp/log-encryption.js
|
|
3746
3765
|
import { createCipheriv, createDecipheriv, randomBytes } from "crypto";
|
|
3747
3766
|
import { mkdir as mkdir10, readFile as readFile9, stat as stat4, writeFile as writeFile10 } from "fs/promises";
|
|
3748
|
-
import { dirname as
|
|
3767
|
+
import { dirname as dirname8 } from "path";
|
|
3749
3768
|
var KEY_BYTES = 32;
|
|
3750
3769
|
var IV_BYTES = 12;
|
|
3751
3770
|
var TAG_BYTES = 16;
|
|
@@ -3792,7 +3811,7 @@ function createFileKeyStore(keyPath) {
|
|
|
3792
3811
|
return parsed;
|
|
3793
3812
|
}
|
|
3794
3813
|
const fresh = randomBytes(KEY_BYTES);
|
|
3795
|
-
await mkdir10(
|
|
3814
|
+
await mkdir10(dirname8(keyPath), { recursive: true });
|
|
3796
3815
|
const tmp = `${keyPath}.tmp`;
|
|
3797
3816
|
await writeFile10(tmp, fresh.toString("base64") + "\n", {
|
|
3798
3817
|
encoding: "utf-8",
|
|
@@ -3834,7 +3853,7 @@ function decryptLine(encoded, key) {
|
|
|
3834
3853
|
|
|
3835
3854
|
// ../listener/dist/mcp/mcp-logger.js
|
|
3836
3855
|
import { appendFile, mkdir as mkdir11, stat as stat5, unlink as unlink8, writeFile as writeFile11, readFile as readFile10 } from "fs/promises";
|
|
3837
|
-
import { dirname as
|
|
3856
|
+
import { dirname as dirname9 } from "path";
|
|
3838
3857
|
var DEFAULT_MAX_BYTES = 100 * 1024 * 1024;
|
|
3839
3858
|
function createMcpLogger(options) {
|
|
3840
3859
|
const maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;
|
|
@@ -3857,7 +3876,7 @@ function createMcpLogger(options) {
|
|
|
3857
3876
|
await migrateLegacyPlaintext();
|
|
3858
3877
|
const key = await options.keyStore.getKey();
|
|
3859
3878
|
const encoded = encryptLine(JSON.stringify(entry), key) + "\n";
|
|
3860
|
-
await mkdir11(
|
|
3879
|
+
await mkdir11(dirname9(options.filePath), { recursive: true });
|
|
3861
3880
|
await appendFile(options.filePath, encoded, { encoding: "utf-8", mode: 384 });
|
|
3862
3881
|
try {
|
|
3863
3882
|
const s = await stat5(options.filePath);
|
|
@@ -3891,7 +3910,7 @@ async function rotate(path, size) {
|
|
|
3891
3910
|
// ../listener/dist/mcp/mcp-log-uploader.js
|
|
3892
3911
|
import { randomUUID } from "crypto";
|
|
3893
3912
|
import { readFile as readFile11, writeFile as writeFile12, mkdir as mkdir12 } from "fs/promises";
|
|
3894
|
-
import { dirname as
|
|
3913
|
+
import { dirname as dirname10 } from "path";
|
|
3895
3914
|
var DEFAULT_MAX_ENTRIES = 5e3;
|
|
3896
3915
|
var DEFAULT_MAX_BYTES2 = 1 * 1024 * 1024;
|
|
3897
3916
|
function createMcpLogUploader(options) {
|
|
@@ -4041,7 +4060,7 @@ async function readPendingBatch(watermarkPath) {
|
|
|
4041
4060
|
}
|
|
4042
4061
|
}
|
|
4043
4062
|
async function writePendingBatch(watermarkPath, batchId) {
|
|
4044
|
-
await mkdir12(
|
|
4063
|
+
await mkdir12(dirname10(watermarkPath), { recursive: true });
|
|
4045
4064
|
await writeFile12(pendingPath(watermarkPath), batchId, { encoding: "utf-8", mode: 384 });
|
|
4046
4065
|
}
|
|
4047
4066
|
async function clearPendingBatch(watermarkPath) {
|
|
@@ -4063,7 +4082,7 @@ async function readWatermark(path) {
|
|
|
4063
4082
|
}
|
|
4064
4083
|
}
|
|
4065
4084
|
async function writeWatermark(path, offset) {
|
|
4066
|
-
await mkdir12(
|
|
4085
|
+
await mkdir12(dirname10(path), { recursive: true });
|
|
4067
4086
|
const tmp = `${path}.tmp`;
|
|
4068
4087
|
await writeFile12(tmp, offset.toString() + "\n", { encoding: "utf-8", mode: 384 });
|
|
4069
4088
|
const { rename: rename5 } = await import("fs/promises");
|
|
@@ -4083,7 +4102,7 @@ async function isLocallyConsented(flagPath2) {
|
|
|
4083
4102
|
init_config_dir();
|
|
4084
4103
|
import { createServer } from "http";
|
|
4085
4104
|
import { mkdir as mkdir13, writeFile as writeFile13 } from "fs/promises";
|
|
4086
|
-
import { dirname as
|
|
4105
|
+
import { dirname as dirname11, join as join17 } from "path";
|
|
4087
4106
|
import { createHash as createHash2, randomUUID as randomUUID2 } from "crypto";
|
|
4088
4107
|
|
|
4089
4108
|
// ../listener/dist/mcp/sanitize.js
|
|
@@ -5422,7 +5441,7 @@ async function readJson(req) {
|
|
|
5422
5441
|
}
|
|
5423
5442
|
}
|
|
5424
5443
|
async function writeEndpointFile(path, endpoint, secret) {
|
|
5425
|
-
await mkdir13(
|
|
5444
|
+
await mkdir13(dirname11(path), { recursive: true });
|
|
5426
5445
|
await writeFile13(path, formatEndpointFile({ endpoint, secret }), {
|
|
5427
5446
|
encoding: "utf-8",
|
|
5428
5447
|
mode: 384
|
|
@@ -5627,7 +5646,7 @@ import { join as join19 } from "path";
|
|
|
5627
5646
|
|
|
5628
5647
|
// ../listener/dist/mcp/auto-config/markers.js
|
|
5629
5648
|
import { promises as fs2 } from "fs";
|
|
5630
|
-
import { dirname as
|
|
5649
|
+
import { dirname as dirname12 } from "path";
|
|
5631
5650
|
async function writeMergedConfig(params) {
|
|
5632
5651
|
const current = await readConfig(params.path);
|
|
5633
5652
|
const servers = { ...current.mcpServers ?? {} };
|
|
@@ -5637,7 +5656,7 @@ async function writeMergedConfig(params) {
|
|
|
5637
5656
|
const existing = safeExistingContent(params.path, current);
|
|
5638
5657
|
if (existing === canonical)
|
|
5639
5658
|
return "unchanged";
|
|
5640
|
-
await fs2.mkdir(
|
|
5659
|
+
await fs2.mkdir(dirname12(params.path), { recursive: true });
|
|
5641
5660
|
await fs2.writeFile(params.path, canonical, "utf-8");
|
|
5642
5661
|
return "written";
|
|
5643
5662
|
}
|
|
@@ -6260,11 +6279,11 @@ function resolveAuditRoots() {
|
|
|
6260
6279
|
return override.split(":").map((s) => s.trim()).filter(Boolean);
|
|
6261
6280
|
}
|
|
6262
6281
|
const out = /* @__PURE__ */ new Set();
|
|
6263
|
-
let dir =
|
|
6282
|
+
let dir = dirname13(process.execPath);
|
|
6264
6283
|
for (let i = 0; i < 8; i += 1) {
|
|
6265
6284
|
out.add(join27(dir, "node_modules"));
|
|
6266
6285
|
out.add(join27(dir, "lib", "node_modules"));
|
|
6267
|
-
const parent =
|
|
6286
|
+
const parent = dirname13(dir);
|
|
6268
6287
|
if (parent === dir)
|
|
6269
6288
|
break;
|
|
6270
6289
|
dir = parent;
|
|
@@ -6713,7 +6732,7 @@ async function startListener() {
|
|
|
6713
6732
|
const packageName = true ? "repowisestage" : "repowise";
|
|
6714
6733
|
let currentVersion = "";
|
|
6715
6734
|
try {
|
|
6716
|
-
const selfDir =
|
|
6735
|
+
const selfDir = dirname13(fileURLToPath3(import.meta.url));
|
|
6717
6736
|
const pkgJsonPath = join27(selfDir, "..", "..", "package.json");
|
|
6718
6737
|
const pkgJson = JSON.parse(await readFile12(pkgJsonPath, "utf-8"));
|
|
6719
6738
|
currentVersion = pkgJson.version;
|
|
@@ -7234,7 +7253,7 @@ async function showWelcome(currentVersion) {
|
|
|
7234
7253
|
|
|
7235
7254
|
// src/commands/create.ts
|
|
7236
7255
|
import { mkdirSync, writeFileSync as writeFileSync2 } from "fs";
|
|
7237
|
-
import { dirname as
|
|
7256
|
+
import { dirname as dirname14, join as join33 } from "path";
|
|
7238
7257
|
init_src();
|
|
7239
7258
|
import chalk5 from "chalk";
|
|
7240
7259
|
import ora from "ora";
|
|
@@ -8486,7 +8505,7 @@ async function create() {
|
|
|
8486
8505
|
if (response.ok) {
|
|
8487
8506
|
const content = await response.text();
|
|
8488
8507
|
const filePath = join33(contextDir, file.fileName);
|
|
8489
|
-
mkdirSync(
|
|
8508
|
+
mkdirSync(dirname14(filePath), { recursive: true });
|
|
8490
8509
|
writeFileSync2(filePath, content, "utf-8");
|
|
8491
8510
|
downloadedCount++;
|
|
8492
8511
|
} else {
|
|
@@ -8627,7 +8646,7 @@ Files are stored on our servers (not in git). Retry when online.`
|
|
|
8627
8646
|
|
|
8628
8647
|
// src/commands/member.ts
|
|
8629
8648
|
import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
8630
|
-
import { dirname as
|
|
8649
|
+
import { dirname as dirname15, join as join34, resolve, sep } from "path";
|
|
8631
8650
|
import chalk6 from "chalk";
|
|
8632
8651
|
import ora2 from "ora";
|
|
8633
8652
|
var DEFAULT_CONTEXT_FOLDER2 = "repowise-context";
|
|
@@ -8772,7 +8791,7 @@ async function member() {
|
|
|
8772
8791
|
const response = await fetch(presignedUrl);
|
|
8773
8792
|
if (response.ok) {
|
|
8774
8793
|
const content = await response.text();
|
|
8775
|
-
mkdirSync2(
|
|
8794
|
+
mkdirSync2(dirname15(safePath), { recursive: true });
|
|
8776
8795
|
writeFileSync3(safePath, content, "utf-8");
|
|
8777
8796
|
downloadedCount++;
|
|
8778
8797
|
} else {
|
|
@@ -9063,7 +9082,7 @@ async function status() {
|
|
|
9063
9082
|
|
|
9064
9083
|
// src/commands/sync.ts
|
|
9065
9084
|
import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync4 } from "fs";
|
|
9066
|
-
import { dirname as
|
|
9085
|
+
import { dirname as dirname16, join as join37 } from "path";
|
|
9067
9086
|
import chalk9 from "chalk";
|
|
9068
9087
|
import ora4 from "ora";
|
|
9069
9088
|
var POLL_INTERVAL_MS2 = 3e3;
|
|
@@ -9227,7 +9246,7 @@ async function sync() {
|
|
|
9227
9246
|
if (response.ok) {
|
|
9228
9247
|
const content = await response.text();
|
|
9229
9248
|
const filePath = join37(contextDir, file.fileName);
|
|
9230
|
-
mkdirSync3(
|
|
9249
|
+
mkdirSync3(dirname16(filePath), { recursive: true });
|
|
9231
9250
|
writeFileSync4(filePath, content, "utf-8");
|
|
9232
9251
|
downloadedCount++;
|
|
9233
9252
|
} else {
|
|
@@ -9479,7 +9498,7 @@ async function config() {
|
|
|
9479
9498
|
// src/commands/mcp-log.ts
|
|
9480
9499
|
import { createDecipheriv as createDecipheriv2 } from "crypto";
|
|
9481
9500
|
import { mkdir as mkdir18, readFile as readFile17, stat as stat6, writeFile as writeFile18 } from "fs/promises";
|
|
9482
|
-
import { dirname as
|
|
9501
|
+
import { dirname as dirname17, join as join38 } from "path";
|
|
9483
9502
|
var FLAG_FILE = "mcp-log.flag";
|
|
9484
9503
|
var LOG_FILE = "mcp-log.jsonl.enc";
|
|
9485
9504
|
var KEY_FILE = "mcp-log.key";
|
|
@@ -9506,7 +9525,7 @@ async function readFlag() {
|
|
|
9506
9525
|
}
|
|
9507
9526
|
async function writeFlag(flag) {
|
|
9508
9527
|
const path = flagPath();
|
|
9509
|
-
await mkdir18(
|
|
9528
|
+
await mkdir18(dirname17(path), { recursive: true });
|
|
9510
9529
|
await writeFile18(path, JSON.stringify(flag, null, 2), { encoding: "utf-8", mode: 384 });
|
|
9511
9530
|
}
|
|
9512
9531
|
async function showConsentPrompt() {
|
|
@@ -10819,7 +10838,7 @@ async function lspDoctor() {
|
|
|
10819
10838
|
|
|
10820
10839
|
// bin/repowise.ts
|
|
10821
10840
|
var __filename = fileURLToPath4(import.meta.url);
|
|
10822
|
-
var __dirname =
|
|
10841
|
+
var __dirname = dirname18(__filename);
|
|
10823
10842
|
var pkg = JSON.parse(readFileSync3(join45(__dirname, "..", "..", "package.json"), "utf-8"));
|
|
10824
10843
|
var program = new Command();
|
|
10825
10844
|
program.name(getPackageName()).description("AI-optimized codebase context generator").version(pkg.version).hook("preAction", async () => {
|