repowisestage 0.0.54 → 0.0.56
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 +51 -40
- package/package.json +1 -1
package/dist/bin/repowise.js
CHANGED
|
@@ -2294,7 +2294,7 @@ __export(sidecar_cache_exports, {
|
|
|
2294
2294
|
sidecarCachePaths: () => sidecarCachePaths
|
|
2295
2295
|
});
|
|
2296
2296
|
import { mkdir as mkdir8, readFile as readFile7, readdir as readdir3, stat as stat2, unlink as unlink7, writeFile as writeFile8 } from "fs/promises";
|
|
2297
|
-
import { dirname as
|
|
2297
|
+
import { dirname as dirname8, join as join18 } from "path";
|
|
2298
2298
|
function repoIdSafe(repoId) {
|
|
2299
2299
|
return /^[A-Za-z0-9_.-]{1,128}$/.test(repoId) && !repoId.startsWith(".");
|
|
2300
2300
|
}
|
|
@@ -3000,13 +3000,13 @@ var init_telemetry = __esm({
|
|
|
3000
3000
|
// bin/repowise.ts
|
|
3001
3001
|
import { readFileSync as readFileSync3 } from "fs";
|
|
3002
3002
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
3003
|
-
import { dirname as
|
|
3003
|
+
import { dirname as dirname20, join as join52 } from "path";
|
|
3004
3004
|
import { Command } from "commander";
|
|
3005
3005
|
|
|
3006
3006
|
// ../listener/dist/main.js
|
|
3007
3007
|
init_config_dir();
|
|
3008
3008
|
import { readFile as readFile12, writeFile as writeFile14, mkdir as mkdir14, stat as fsStat } from "fs/promises";
|
|
3009
|
-
import { join as join32, dirname as
|
|
3009
|
+
import { join as join32, dirname as dirname15 } from "path";
|
|
3010
3010
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
3011
3011
|
import lockfile4 from "proper-lockfile";
|
|
3012
3012
|
|
|
@@ -4331,7 +4331,7 @@ import { join as join21 } from "path";
|
|
|
4331
4331
|
// ../listener/dist/lsp/workspace-session.js
|
|
4332
4332
|
import { pathToFileURL } from "url";
|
|
4333
4333
|
import { readFile as readFile6 } from "fs/promises";
|
|
4334
|
-
import { resolve as pathResolve2, sep as pathSep } from "path";
|
|
4334
|
+
import { resolve as pathResolve2, sep as pathSep, dirname as dirname7 } from "path";
|
|
4335
4335
|
|
|
4336
4336
|
// ../listener/dist/lsp/lsp-client.js
|
|
4337
4337
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -4665,12 +4665,13 @@ var WorkspaceManager = class {
|
|
|
4665
4665
|
this.rssSampler = opts.rssSampler ?? (() => process.memoryUsage().rss);
|
|
4666
4666
|
this.clientFactory = opts.clientFactory ?? ((config2, cwd) => {
|
|
4667
4667
|
const env = { ...process.env };
|
|
4668
|
-
const
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4668
|
+
const lspBinDirs = [
|
|
4669
|
+
getLspBinDir(),
|
|
4670
|
+
getNativeLspBinDir(),
|
|
4671
|
+
getCoursierBinDir(),
|
|
4672
|
+
...getToolchainBinDirs()
|
|
4673
|
+
];
|
|
4674
|
+
env.PATH = buildLspSpawnPath(env.PATH, dirname7(process.execPath), lspBinDirs);
|
|
4674
4675
|
const client = new LspClient({
|
|
4675
4676
|
command: config2.command,
|
|
4676
4677
|
args: config2.args,
|
|
@@ -4706,7 +4707,11 @@ var WorkspaceManager = class {
|
|
|
4706
4707
|
*/
|
|
4707
4708
|
async getOrOpen(args) {
|
|
4708
4709
|
const key = keyOf(args);
|
|
4709
|
-
|
|
4710
|
+
let existing = this.sessions.get(key);
|
|
4711
|
+
if (existing && !existing.client.isAlive()) {
|
|
4712
|
+
this.sessions.delete(key);
|
|
4713
|
+
existing = void 0;
|
|
4714
|
+
}
|
|
4710
4715
|
if (existing) {
|
|
4711
4716
|
existing.lastUsedAt = this.now();
|
|
4712
4717
|
if (existing.ready)
|
|
@@ -4744,8 +4749,8 @@ var WorkspaceManager = class {
|
|
|
4744
4749
|
if (!existing) {
|
|
4745
4750
|
this.sessions.set(key, session);
|
|
4746
4751
|
session.client.on("close", () => {
|
|
4747
|
-
|
|
4748
|
-
|
|
4752
|
+
session.ready = false;
|
|
4753
|
+
if (this.sessions.get(key) === session) {
|
|
4749
4754
|
this.sessions.delete(key);
|
|
4750
4755
|
}
|
|
4751
4756
|
});
|
|
@@ -5034,6 +5039,10 @@ var PathEscapeError = class extends Error {
|
|
|
5034
5039
|
this.name = "PathEscapeError";
|
|
5035
5040
|
}
|
|
5036
5041
|
};
|
|
5042
|
+
function buildLspSpawnPath(basePath, nodeDir, lspBinDirs) {
|
|
5043
|
+
const extra = lspBinDirs.join(":");
|
|
5044
|
+
return basePath ? `${nodeDir}:${basePath}:${extra}` : `${nodeDir}:${extra}`;
|
|
5045
|
+
}
|
|
5037
5046
|
|
|
5038
5047
|
// ../listener/dist/mcp/graph-cache.js
|
|
5039
5048
|
init_config_dir();
|
|
@@ -5147,7 +5156,7 @@ function defaultRepoWiseHome() {
|
|
|
5147
5156
|
|
|
5148
5157
|
// ../listener/dist/mcp/graph-downloader.js
|
|
5149
5158
|
import { mkdir as mkdir9, rename as rename3, writeFile as writeFile9 } from "fs/promises";
|
|
5150
|
-
import { dirname as
|
|
5159
|
+
import { dirname as dirname9 } from "path";
|
|
5151
5160
|
function createGraphDownloader(options) {
|
|
5152
5161
|
const fetchFn = options.fetchImpl ?? fetch;
|
|
5153
5162
|
let lastSha = null;
|
|
@@ -5198,7 +5207,7 @@ function createGraphDownloader(options) {
|
|
|
5198
5207
|
message: `graph parse: ${err instanceof Error ? err.message : String(err)}`
|
|
5199
5208
|
};
|
|
5200
5209
|
}
|
|
5201
|
-
await mkdir9(
|
|
5210
|
+
await mkdir9(dirname9(options.targetPath), { recursive: true });
|
|
5202
5211
|
const tmpPath = `${options.targetPath}.${Date.now()}.tmp`;
|
|
5203
5212
|
await writeFile9(tmpPath, body, { encoding: "utf-8", mode: 384 });
|
|
5204
5213
|
await rename3(tmpPath, options.targetPath);
|
|
@@ -5224,7 +5233,7 @@ function createGraphDownloader(options) {
|
|
|
5224
5233
|
// ../listener/dist/mcp/log-encryption.js
|
|
5225
5234
|
import { createCipheriv, createDecipheriv, randomBytes } from "crypto";
|
|
5226
5235
|
import { mkdir as mkdir10, readFile as readFile9, stat as stat4, writeFile as writeFile10 } from "fs/promises";
|
|
5227
|
-
import { dirname as
|
|
5236
|
+
import { dirname as dirname10 } from "path";
|
|
5228
5237
|
var KEY_BYTES = 32;
|
|
5229
5238
|
var IV_BYTES = 12;
|
|
5230
5239
|
var TAG_BYTES = 16;
|
|
@@ -5271,7 +5280,7 @@ function createFileKeyStore(keyPath) {
|
|
|
5271
5280
|
return parsed;
|
|
5272
5281
|
}
|
|
5273
5282
|
const fresh = randomBytes(KEY_BYTES);
|
|
5274
|
-
await mkdir10(
|
|
5283
|
+
await mkdir10(dirname10(keyPath), { recursive: true });
|
|
5275
5284
|
const tmp = `${keyPath}.tmp`;
|
|
5276
5285
|
await writeFile10(tmp, fresh.toString("base64") + "\n", {
|
|
5277
5286
|
encoding: "utf-8",
|
|
@@ -5313,7 +5322,7 @@ function decryptLine(encoded, key) {
|
|
|
5313
5322
|
|
|
5314
5323
|
// ../listener/dist/mcp/mcp-logger.js
|
|
5315
5324
|
import { appendFile, mkdir as mkdir11, stat as stat5, unlink as unlink8, writeFile as writeFile11, readFile as readFile10 } from "fs/promises";
|
|
5316
|
-
import { dirname as
|
|
5325
|
+
import { dirname as dirname11 } from "path";
|
|
5317
5326
|
var DEFAULT_MAX_BYTES = 100 * 1024 * 1024;
|
|
5318
5327
|
function createMcpLogger(options) {
|
|
5319
5328
|
const maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;
|
|
@@ -5336,7 +5345,7 @@ function createMcpLogger(options) {
|
|
|
5336
5345
|
await migrateLegacyPlaintext();
|
|
5337
5346
|
const key = await options.keyStore.getKey();
|
|
5338
5347
|
const encoded = encryptLine(JSON.stringify(entry), key) + "\n";
|
|
5339
|
-
await mkdir11(
|
|
5348
|
+
await mkdir11(dirname11(options.filePath), { recursive: true });
|
|
5340
5349
|
await appendFile(options.filePath, encoded, { encoding: "utf-8", mode: 384 });
|
|
5341
5350
|
try {
|
|
5342
5351
|
const s = await stat5(options.filePath);
|
|
@@ -5370,7 +5379,7 @@ async function rotate(path, size) {
|
|
|
5370
5379
|
// ../listener/dist/mcp/mcp-log-uploader.js
|
|
5371
5380
|
import { randomUUID } from "crypto";
|
|
5372
5381
|
import { readFile as readFile11, writeFile as writeFile12, mkdir as mkdir12 } from "fs/promises";
|
|
5373
|
-
import { dirname as
|
|
5382
|
+
import { dirname as dirname12 } from "path";
|
|
5374
5383
|
var DEFAULT_MAX_ENTRIES = 5e3;
|
|
5375
5384
|
var DEFAULT_MAX_BYTES2 = 1 * 1024 * 1024;
|
|
5376
5385
|
function createMcpLogUploader(options) {
|
|
@@ -5520,7 +5529,7 @@ async function readPendingBatch(watermarkPath) {
|
|
|
5520
5529
|
}
|
|
5521
5530
|
}
|
|
5522
5531
|
async function writePendingBatch(watermarkPath, batchId) {
|
|
5523
|
-
await mkdir12(
|
|
5532
|
+
await mkdir12(dirname12(watermarkPath), { recursive: true });
|
|
5524
5533
|
await writeFile12(pendingPath(watermarkPath), batchId, { encoding: "utf-8", mode: 384 });
|
|
5525
5534
|
}
|
|
5526
5535
|
async function clearPendingBatch(watermarkPath) {
|
|
@@ -5542,7 +5551,7 @@ async function readWatermark(path) {
|
|
|
5542
5551
|
}
|
|
5543
5552
|
}
|
|
5544
5553
|
async function writeWatermark(path, offset) {
|
|
5545
|
-
await mkdir12(
|
|
5554
|
+
await mkdir12(dirname12(path), { recursive: true });
|
|
5546
5555
|
const tmp = `${path}.tmp`;
|
|
5547
5556
|
await writeFile12(tmp, offset.toString() + "\n", { encoding: "utf-8", mode: 384 });
|
|
5548
5557
|
const { rename: rename5 } = await import("fs/promises");
|
|
@@ -5562,7 +5571,7 @@ async function isLocallyConsented(flagPath2) {
|
|
|
5562
5571
|
init_config_dir();
|
|
5563
5572
|
import { createServer } from "http";
|
|
5564
5573
|
import { mkdir as mkdir13, writeFile as writeFile13 } from "fs/promises";
|
|
5565
|
-
import { dirname as
|
|
5574
|
+
import { dirname as dirname13, join as join20 } from "path";
|
|
5566
5575
|
import { createHash as createHash3, randomUUID as randomUUID2 } from "crypto";
|
|
5567
5576
|
|
|
5568
5577
|
// ../listener/dist/mcp/sanitize.js
|
|
@@ -7080,7 +7089,7 @@ async function readJson(req) {
|
|
|
7080
7089
|
}
|
|
7081
7090
|
}
|
|
7082
7091
|
async function writeEndpointFile(path, endpoint, secret) {
|
|
7083
|
-
await mkdir13(
|
|
7092
|
+
await mkdir13(dirname13(path), { recursive: true });
|
|
7084
7093
|
await writeFile13(path, formatEndpointFile({ endpoint, secret }), {
|
|
7085
7094
|
encoding: "utf-8",
|
|
7086
7095
|
mode: 384
|
|
@@ -7345,7 +7354,7 @@ import { join as join22 } from "path";
|
|
|
7345
7354
|
|
|
7346
7355
|
// ../listener/dist/mcp/auto-config/markers.js
|
|
7347
7356
|
import { promises as fs5 } from "fs";
|
|
7348
|
-
import { dirname as
|
|
7357
|
+
import { dirname as dirname14 } from "path";
|
|
7349
7358
|
async function writeMergedConfig(params) {
|
|
7350
7359
|
const current = await readConfig(params.path);
|
|
7351
7360
|
const servers = { ...current.mcpServers ?? {} };
|
|
@@ -7355,7 +7364,7 @@ async function writeMergedConfig(params) {
|
|
|
7355
7364
|
const existing = safeExistingContent(params.path, current);
|
|
7356
7365
|
if (existing === canonical)
|
|
7357
7366
|
return "unchanged";
|
|
7358
|
-
await fs5.mkdir(
|
|
7367
|
+
await fs5.mkdir(dirname14(params.path), { recursive: true });
|
|
7359
7368
|
await fs5.writeFile(params.path, canonical, "utf-8");
|
|
7360
7369
|
return "written";
|
|
7361
7370
|
}
|
|
@@ -8999,11 +9008,11 @@ function resolveAuditRoots() {
|
|
|
8999
9008
|
return override.split(":").map((s) => s.trim()).filter(Boolean);
|
|
9000
9009
|
}
|
|
9001
9010
|
const out = /* @__PURE__ */ new Set();
|
|
9002
|
-
let dir =
|
|
9011
|
+
let dir = dirname15(process.execPath);
|
|
9003
9012
|
for (let i = 0; i < 8; i += 1) {
|
|
9004
9013
|
out.add(join32(dir, "node_modules"));
|
|
9005
9014
|
out.add(join32(dir, "lib", "node_modules"));
|
|
9006
|
-
const parent =
|
|
9015
|
+
const parent = dirname15(dir);
|
|
9007
9016
|
if (parent === dir)
|
|
9008
9017
|
break;
|
|
9009
9018
|
dir = parent;
|
|
@@ -9452,7 +9461,7 @@ async function startListener() {
|
|
|
9452
9461
|
const packageName = true ? "repowisestage" : "repowise";
|
|
9453
9462
|
let currentVersion = "";
|
|
9454
9463
|
try {
|
|
9455
|
-
const selfDir =
|
|
9464
|
+
const selfDir = dirname15(fileURLToPath3(import.meta.url));
|
|
9456
9465
|
const pkgJsonPath = join32(selfDir, "..", "..", "package.json");
|
|
9457
9466
|
const pkgJson = JSON.parse(await readFile12(pkgJsonPath, "utf-8"));
|
|
9458
9467
|
currentVersion = pkgJson.version;
|
|
@@ -10052,7 +10061,7 @@ async function showWelcome(currentVersion) {
|
|
|
10052
10061
|
|
|
10053
10062
|
// src/commands/create.ts
|
|
10054
10063
|
import { mkdirSync, writeFileSync as writeFileSync2 } from "fs";
|
|
10055
|
-
import { dirname as
|
|
10064
|
+
import { dirname as dirname16, join as join40 } from "path";
|
|
10056
10065
|
init_src();
|
|
10057
10066
|
import chalk8 from "chalk";
|
|
10058
10067
|
import ora from "ora";
|
|
@@ -11580,6 +11589,10 @@ async function create() {
|
|
|
11580
11589
|
let seenAwaitingInput = false;
|
|
11581
11590
|
let depInstallPromise = null;
|
|
11582
11591
|
let lspInstallPromise = null;
|
|
11592
|
+
if (repoRoot) {
|
|
11593
|
+
const lspResult = await maybeInstallLspServers({ repoRoot, spinner });
|
|
11594
|
+
lspInstallPromise = lspResult.installPromise;
|
|
11595
|
+
}
|
|
11583
11596
|
while (true) {
|
|
11584
11597
|
if (++pollAttempts > MAX_POLL_ATTEMPTS) {
|
|
11585
11598
|
spinner.fail(chalk8.red("Pipeline timed out. Check dashboard for status."));
|
|
@@ -11628,8 +11641,6 @@ async function create() {
|
|
|
11628
11641
|
resumeText: "Resuming pipeline..."
|
|
11629
11642
|
});
|
|
11630
11643
|
depInstallPromise = result.installPromise;
|
|
11631
|
-
const lspResult = await maybeInstallLspServers({ repoRoot, spinner });
|
|
11632
|
-
lspInstallPromise = lspResult.installPromise;
|
|
11633
11644
|
}
|
|
11634
11645
|
if (syncResult.status === "completed") {
|
|
11635
11646
|
progressRenderer.finalize();
|
|
@@ -11683,7 +11694,7 @@ async function create() {
|
|
|
11683
11694
|
if (response.ok) {
|
|
11684
11695
|
const content = await response.text();
|
|
11685
11696
|
const filePath = join40(contextDir, file.fileName);
|
|
11686
|
-
mkdirSync(
|
|
11697
|
+
mkdirSync(dirname16(filePath), { recursive: true });
|
|
11687
11698
|
writeFileSync2(filePath, content, "utf-8");
|
|
11688
11699
|
downloadedCount++;
|
|
11689
11700
|
} else {
|
|
@@ -11885,7 +11896,7 @@ Files are stored on our servers (not in git). Retry when online.`
|
|
|
11885
11896
|
|
|
11886
11897
|
// src/commands/member.ts
|
|
11887
11898
|
import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
11888
|
-
import { dirname as
|
|
11899
|
+
import { dirname as dirname17, join as join41, resolve, sep } from "path";
|
|
11889
11900
|
import chalk9 from "chalk";
|
|
11890
11901
|
import ora2 from "ora";
|
|
11891
11902
|
var DEFAULT_CONTEXT_FOLDER2 = "repowise-context";
|
|
@@ -12060,7 +12071,7 @@ async function member() {
|
|
|
12060
12071
|
const response = await fetch(presignedUrl);
|
|
12061
12072
|
if (response.ok) {
|
|
12062
12073
|
const content = await response.text();
|
|
12063
|
-
mkdirSync2(
|
|
12074
|
+
mkdirSync2(dirname17(safePath), { recursive: true });
|
|
12064
12075
|
writeFileSync3(safePath, content, "utf-8");
|
|
12065
12076
|
downloadedCount++;
|
|
12066
12077
|
} else {
|
|
@@ -12404,7 +12415,7 @@ async function status() {
|
|
|
12404
12415
|
|
|
12405
12416
|
// src/commands/sync.ts
|
|
12406
12417
|
import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync4 } from "fs";
|
|
12407
|
-
import { dirname as
|
|
12418
|
+
import { dirname as dirname18, join as join44 } from "path";
|
|
12408
12419
|
import chalk12 from "chalk";
|
|
12409
12420
|
import ora4 from "ora";
|
|
12410
12421
|
var POLL_INTERVAL_MS2 = 3e3;
|
|
@@ -12568,7 +12579,7 @@ async function sync() {
|
|
|
12568
12579
|
if (response.ok) {
|
|
12569
12580
|
const content = await response.text();
|
|
12570
12581
|
const filePath = join44(contextDir, file.fileName);
|
|
12571
|
-
mkdirSync3(
|
|
12582
|
+
mkdirSync3(dirname18(filePath), { recursive: true });
|
|
12572
12583
|
writeFileSync4(filePath, content, "utf-8");
|
|
12573
12584
|
downloadedCount++;
|
|
12574
12585
|
} else {
|
|
@@ -12820,7 +12831,7 @@ async function config() {
|
|
|
12820
12831
|
// src/commands/mcp-log.ts
|
|
12821
12832
|
import { createDecipheriv as createDecipheriv2 } from "crypto";
|
|
12822
12833
|
import { mkdir as mkdir18, readFile as readFile17, stat as stat6, writeFile as writeFile18 } from "fs/promises";
|
|
12823
|
-
import { dirname as
|
|
12834
|
+
import { dirname as dirname19, join as join45 } from "path";
|
|
12824
12835
|
var FLAG_FILE = "mcp-log.flag";
|
|
12825
12836
|
var LOG_FILE = "mcp-log.jsonl.enc";
|
|
12826
12837
|
var KEY_FILE = "mcp-log.key";
|
|
@@ -12835,7 +12846,7 @@ function logPath() {
|
|
|
12835
12846
|
}
|
|
12836
12847
|
async function writeFlag(flag) {
|
|
12837
12848
|
const path = flagPath();
|
|
12838
|
-
await mkdir18(
|
|
12849
|
+
await mkdir18(dirname19(path), { recursive: true });
|
|
12839
12850
|
await writeFile18(path, JSON.stringify(flag, null, 2), { encoding: "utf-8", mode: 384 });
|
|
12840
12851
|
}
|
|
12841
12852
|
async function mcpLogOn() {
|
|
@@ -14530,7 +14541,7 @@ async function lspOn() {
|
|
|
14530
14541
|
|
|
14531
14542
|
// bin/repowise.ts
|
|
14532
14543
|
var __filename = fileURLToPath4(import.meta.url);
|
|
14533
|
-
var __dirname =
|
|
14544
|
+
var __dirname = dirname20(__filename);
|
|
14534
14545
|
var pkg = JSON.parse(readFileSync3(join52(__dirname, "..", "..", "package.json"), "utf-8"));
|
|
14535
14546
|
var program = new Command();
|
|
14536
14547
|
program.name(getPackageName()).description("AI-optimized codebase context generator").version(pkg.version).hook("preAction", async () => {
|