repowisestage 0.0.76 → 0.0.77
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 +282 -147
- package/package.json +1 -1
package/dist/bin/repowise.js
CHANGED
|
@@ -3133,13 +3133,13 @@ var init_telemetry = __esm({
|
|
|
3133
3133
|
// bin/repowise.ts
|
|
3134
3134
|
import { readFileSync as readFileSync3 } from "fs";
|
|
3135
3135
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
3136
|
-
import { dirname as
|
|
3136
|
+
import { dirname as dirname24, join as join63 } from "path";
|
|
3137
3137
|
import { Command } from "commander";
|
|
3138
3138
|
|
|
3139
3139
|
// ../listener/dist/main.js
|
|
3140
3140
|
init_config_dir();
|
|
3141
3141
|
import { readFile as readFile14, writeFile as writeFile16, mkdir as mkdir16, stat as fsStat } from "fs/promises";
|
|
3142
|
-
import { join as join42, dirname as
|
|
3142
|
+
import { join as join42, dirname as dirname18 } from "path";
|
|
3143
3143
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
3144
3144
|
import lockfile5 from "proper-lockfile";
|
|
3145
3145
|
|
|
@@ -6157,6 +6157,93 @@ function createGraphDownloader(options) {
|
|
|
6157
6157
|
|
|
6158
6158
|
// ../listener/dist/mcp/heartbeat.js
|
|
6159
6159
|
import { setTimeout as delay2 } from "timers/promises";
|
|
6160
|
+
|
|
6161
|
+
// ../listener/dist/mcp/heartbeat-queue.js
|
|
6162
|
+
import { promises as fs5 } from "fs";
|
|
6163
|
+
import { randomUUID } from "crypto";
|
|
6164
|
+
import { dirname as dirname11 } from "path";
|
|
6165
|
+
var DEFAULT_MAX_ENTRIES = 336;
|
|
6166
|
+
function createFileHeartbeatQueue(opts) {
|
|
6167
|
+
const maxEntries = opts.maxEntries ?? DEFAULT_MAX_ENTRIES;
|
|
6168
|
+
const warn = opts.warn ?? ((m) => console.warn(m));
|
|
6169
|
+
let chain = Promise.resolve();
|
|
6170
|
+
async function read() {
|
|
6171
|
+
let raw;
|
|
6172
|
+
try {
|
|
6173
|
+
raw = await fs5.readFile(opts.path, "utf-8");
|
|
6174
|
+
} catch (err) {
|
|
6175
|
+
if (err.code === "ENOENT")
|
|
6176
|
+
return [];
|
|
6177
|
+
throw err;
|
|
6178
|
+
}
|
|
6179
|
+
const entries = [];
|
|
6180
|
+
for (const line of raw.split("\n")) {
|
|
6181
|
+
const trimmed = line.trim();
|
|
6182
|
+
if (!trimmed)
|
|
6183
|
+
continue;
|
|
6184
|
+
try {
|
|
6185
|
+
const e = JSON.parse(trimmed);
|
|
6186
|
+
if (e && typeof e.id === "string" && e.payload)
|
|
6187
|
+
entries.push(e);
|
|
6188
|
+
} catch {
|
|
6189
|
+
}
|
|
6190
|
+
}
|
|
6191
|
+
return entries;
|
|
6192
|
+
}
|
|
6193
|
+
async function write(entries) {
|
|
6194
|
+
await fs5.mkdir(dirname11(opts.path), { recursive: true });
|
|
6195
|
+
const tmp = `${opts.path}.tmp`;
|
|
6196
|
+
const body = entries.map((e) => JSON.stringify(e)).join("\n") + (entries.length ? "\n" : "");
|
|
6197
|
+
await fs5.writeFile(tmp, body, { mode: 384 });
|
|
6198
|
+
await fs5.rename(tmp, opts.path);
|
|
6199
|
+
}
|
|
6200
|
+
function mutate(fn) {
|
|
6201
|
+
const run = chain.then(async () => {
|
|
6202
|
+
const entries = await read();
|
|
6203
|
+
const { next, result } = fn(entries);
|
|
6204
|
+
await write(next);
|
|
6205
|
+
return result;
|
|
6206
|
+
});
|
|
6207
|
+
chain = run.then(() => void 0, () => void 0);
|
|
6208
|
+
return run;
|
|
6209
|
+
}
|
|
6210
|
+
return {
|
|
6211
|
+
enqueue(payload) {
|
|
6212
|
+
return mutate((entries) => {
|
|
6213
|
+
const next = [...entries, { id: randomUUID(), payload }];
|
|
6214
|
+
while (next.length > maxEntries) {
|
|
6215
|
+
next.shift();
|
|
6216
|
+
warn(`[heartbeat] queue full (${maxEntries.toString()}) \u2014 dropped the oldest un-sent bucket`);
|
|
6217
|
+
}
|
|
6218
|
+
return { next, result: void 0 };
|
|
6219
|
+
});
|
|
6220
|
+
},
|
|
6221
|
+
list() {
|
|
6222
|
+
return chain.then(() => read());
|
|
6223
|
+
},
|
|
6224
|
+
remove(id) {
|
|
6225
|
+
return mutate((entries) => ({ next: entries.filter((e) => e.id !== id), result: void 0 }));
|
|
6226
|
+
}
|
|
6227
|
+
};
|
|
6228
|
+
}
|
|
6229
|
+
function createInMemoryHeartbeatQueue() {
|
|
6230
|
+
let entries = [];
|
|
6231
|
+
return {
|
|
6232
|
+
enqueue(payload) {
|
|
6233
|
+
entries.push({ id: randomUUID(), payload });
|
|
6234
|
+
return Promise.resolve();
|
|
6235
|
+
},
|
|
6236
|
+
list() {
|
|
6237
|
+
return Promise.resolve([...entries]);
|
|
6238
|
+
},
|
|
6239
|
+
remove(id) {
|
|
6240
|
+
entries = entries.filter((e) => e.id !== id);
|
|
6241
|
+
return Promise.resolve();
|
|
6242
|
+
}
|
|
6243
|
+
};
|
|
6244
|
+
}
|
|
6245
|
+
|
|
6246
|
+
// ../listener/dist/mcp/heartbeat.js
|
|
6160
6247
|
var DEFAULT_WINDOW = 60 * 60 * 1e3;
|
|
6161
6248
|
function emptyStatusCounts() {
|
|
6162
6249
|
return { ok: 0, error: 0, timeout: 0, rejected: 0 };
|
|
@@ -6174,6 +6261,7 @@ function emptyHealthCounters() {
|
|
|
6174
6261
|
function createHeartbeatEmitter(opts) {
|
|
6175
6262
|
const windowMs = opts.windowMs ?? DEFAULT_WINDOW;
|
|
6176
6263
|
const now = opts.now ?? (() => Date.now());
|
|
6264
|
+
const queue = opts.queue ?? createInMemoryHeartbeatQueue();
|
|
6177
6265
|
let bucketStart = Math.floor(now() / windowMs) * windowMs;
|
|
6178
6266
|
let toolCounts = /* @__PURE__ */ new Map();
|
|
6179
6267
|
let missCounts = /* @__PURE__ */ new Map();
|
|
@@ -6208,16 +6296,60 @@ function createHeartbeatEmitter(opts) {
|
|
|
6208
6296
|
statusCounts = emptyStatusCounts();
|
|
6209
6297
|
healthCounters = emptyHealthCounters();
|
|
6210
6298
|
}
|
|
6299
|
+
const maxUnpersisted = opts.maxUnpersisted ?? 336;
|
|
6300
|
+
const unpersisted = [];
|
|
6301
|
+
let drainChain = Promise.resolve();
|
|
6302
|
+
function rollBucket(nextBucket) {
|
|
6303
|
+
const payload = buildPayload();
|
|
6304
|
+
bucketStart = nextBucket;
|
|
6305
|
+
clearCounters();
|
|
6306
|
+
return payload;
|
|
6307
|
+
}
|
|
6308
|
+
async function persist(payload) {
|
|
6309
|
+
try {
|
|
6310
|
+
await queue.enqueue(payload);
|
|
6311
|
+
} catch {
|
|
6312
|
+
unpersisted.push(payload);
|
|
6313
|
+
while (unpersisted.length > maxUnpersisted) {
|
|
6314
|
+
unpersisted.shift();
|
|
6315
|
+
console.warn("[heartbeat] in-memory hold full \u2014 dropped the oldest un-persisted bucket");
|
|
6316
|
+
}
|
|
6317
|
+
}
|
|
6318
|
+
}
|
|
6211
6319
|
async function flushIfDue(currentBucket) {
|
|
6212
6320
|
if (currentBucket === bucketStart)
|
|
6213
6321
|
return;
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6322
|
+
await persist(rollBucket(currentBucket));
|
|
6323
|
+
}
|
|
6324
|
+
async function drainOnce() {
|
|
6325
|
+
while (unpersisted.length > 0) {
|
|
6326
|
+
try {
|
|
6327
|
+
await queue.enqueue(unpersisted[0]);
|
|
6328
|
+
unpersisted.shift();
|
|
6329
|
+
} catch {
|
|
6330
|
+
break;
|
|
6331
|
+
}
|
|
6332
|
+
}
|
|
6333
|
+
let pending;
|
|
6217
6334
|
try {
|
|
6218
|
-
await
|
|
6335
|
+
pending = await queue.list();
|
|
6219
6336
|
} catch {
|
|
6337
|
+
return;
|
|
6220
6338
|
}
|
|
6339
|
+
pending.sort((a, b) => a.payload.windowStartsAt < b.payload.windowStartsAt ? -1 : a.payload.windowStartsAt > b.payload.windowStartsAt ? 1 : 0);
|
|
6340
|
+
for (const entry of pending) {
|
|
6341
|
+
try {
|
|
6342
|
+
await opts.sink.post(entry.payload);
|
|
6343
|
+
} catch {
|
|
6344
|
+
return;
|
|
6345
|
+
}
|
|
6346
|
+
await queue.remove(entry.id).catch(() => void 0);
|
|
6347
|
+
}
|
|
6348
|
+
}
|
|
6349
|
+
function drain() {
|
|
6350
|
+
const run = drainChain.then(() => drainOnce());
|
|
6351
|
+
drainChain = run.then(() => void 0, () => void 0);
|
|
6352
|
+
return run;
|
|
6221
6353
|
}
|
|
6222
6354
|
return {
|
|
6223
6355
|
record(tool, outcome) {
|
|
@@ -6236,16 +6368,15 @@ function createHeartbeatEmitter(opts) {
|
|
|
6236
6368
|
async tick(nowOverride) {
|
|
6237
6369
|
const current = Math.floor((nowOverride ?? now()) / windowMs) * windowMs;
|
|
6238
6370
|
await flushIfDue(current);
|
|
6371
|
+
await drain();
|
|
6239
6372
|
},
|
|
6240
6373
|
async flush() {
|
|
6241
|
-
if (
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
try {
|
|
6246
|
-
await opts.sink.post(payload);
|
|
6247
|
-
} catch {
|
|
6374
|
+
if (hasData()) {
|
|
6375
|
+
const payload = buildPayload();
|
|
6376
|
+
clearCounters();
|
|
6377
|
+
await persist(payload);
|
|
6248
6378
|
}
|
|
6379
|
+
await drain();
|
|
6249
6380
|
}
|
|
6250
6381
|
};
|
|
6251
6382
|
}
|
|
@@ -6261,7 +6392,7 @@ async function runHeartbeatLoop(emitter, opts = {}) {
|
|
|
6261
6392
|
// ../listener/dist/mcp/log-encryption.js
|
|
6262
6393
|
import { createCipheriv, createDecipheriv, randomBytes } from "crypto";
|
|
6263
6394
|
import { mkdir as mkdir11, readFile as readFile11, stat as stat4, writeFile as writeFile12 } from "fs/promises";
|
|
6264
|
-
import { dirname as
|
|
6395
|
+
import { dirname as dirname12 } from "path";
|
|
6265
6396
|
var KEY_BYTES = 32;
|
|
6266
6397
|
var IV_BYTES = 12;
|
|
6267
6398
|
var TAG_BYTES = 16;
|
|
@@ -6308,7 +6439,7 @@ function createFileKeyStore(keyPath) {
|
|
|
6308
6439
|
return parsed;
|
|
6309
6440
|
}
|
|
6310
6441
|
const fresh = randomBytes(KEY_BYTES);
|
|
6311
|
-
await mkdir11(
|
|
6442
|
+
await mkdir11(dirname12(keyPath), { recursive: true });
|
|
6312
6443
|
const tmp = `${keyPath}.tmp`;
|
|
6313
6444
|
await writeFile12(tmp, fresh.toString("base64") + "\n", {
|
|
6314
6445
|
encoding: "utf-8",
|
|
@@ -6350,7 +6481,7 @@ function decryptLine(encoded, key) {
|
|
|
6350
6481
|
|
|
6351
6482
|
// ../listener/dist/mcp/mcp-logger.js
|
|
6352
6483
|
import { appendFile, mkdir as mkdir12, stat as stat5, unlink as unlink10, writeFile as writeFile13, readFile as readFile12 } from "fs/promises";
|
|
6353
|
-
import { dirname as
|
|
6484
|
+
import { dirname as dirname13 } from "path";
|
|
6354
6485
|
var DEFAULT_MAX_BYTES = 100 * 1024 * 1024;
|
|
6355
6486
|
function createMcpLogger(options) {
|
|
6356
6487
|
const maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;
|
|
@@ -6373,7 +6504,7 @@ function createMcpLogger(options) {
|
|
|
6373
6504
|
await migrateLegacyPlaintext();
|
|
6374
6505
|
const key = await options.keyStore.getKey();
|
|
6375
6506
|
const encoded = encryptLine(JSON.stringify(entry), key) + "\n";
|
|
6376
|
-
await mkdir12(
|
|
6507
|
+
await mkdir12(dirname13(options.filePath), { recursive: true });
|
|
6377
6508
|
await appendFile(options.filePath, encoded, { encoding: "utf-8", mode: 384 });
|
|
6378
6509
|
try {
|
|
6379
6510
|
const s = await stat5(options.filePath);
|
|
@@ -6405,15 +6536,15 @@ async function rotate(path, size) {
|
|
|
6405
6536
|
}
|
|
6406
6537
|
|
|
6407
6538
|
// ../listener/dist/mcp/mcp-log-uploader.js
|
|
6408
|
-
import { randomUUID } from "crypto";
|
|
6539
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
6409
6540
|
import { readFile as readFile13, writeFile as writeFile14, mkdir as mkdir13 } from "fs/promises";
|
|
6410
|
-
import { dirname as
|
|
6541
|
+
import { dirname as dirname14 } from "path";
|
|
6411
6542
|
var MCP_LOG_UPLOAD_TIMEOUT_MS = 3e4;
|
|
6412
|
-
var
|
|
6543
|
+
var DEFAULT_MAX_ENTRIES2 = 5e3;
|
|
6413
6544
|
var DEFAULT_MAX_BYTES2 = 1 * 1024 * 1024;
|
|
6414
6545
|
function createMcpLogUploader(options) {
|
|
6415
6546
|
const fetchImpl = options.fetchImpl ?? fetch;
|
|
6416
|
-
const maxEntries = options.maxEntriesPerBatch ??
|
|
6547
|
+
const maxEntries = options.maxEntriesPerBatch ?? DEFAULT_MAX_ENTRIES2;
|
|
6417
6548
|
const maxBytes = options.maxBytesPerBatch ?? DEFAULT_MAX_BYTES2;
|
|
6418
6549
|
let consentRevoked = false;
|
|
6419
6550
|
return {
|
|
@@ -6491,7 +6622,7 @@ function createMcpLogUploader(options) {
|
|
|
6491
6622
|
const token = await options.getAuthToken();
|
|
6492
6623
|
let batchId = await readPendingBatch(options.watermarkFilePath);
|
|
6493
6624
|
if (!batchId) {
|
|
6494
|
-
batchId =
|
|
6625
|
+
batchId = randomUUID2();
|
|
6495
6626
|
await writePendingBatch(options.watermarkFilePath, batchId);
|
|
6496
6627
|
}
|
|
6497
6628
|
const uploadBody = JSON.stringify({
|
|
@@ -6560,7 +6691,7 @@ async function readPendingBatch(watermarkPath) {
|
|
|
6560
6691
|
}
|
|
6561
6692
|
}
|
|
6562
6693
|
async function writePendingBatch(watermarkPath, batchId) {
|
|
6563
|
-
await mkdir13(
|
|
6694
|
+
await mkdir13(dirname14(watermarkPath), { recursive: true });
|
|
6564
6695
|
await writeFile14(pendingPath(watermarkPath), batchId, { encoding: "utf-8", mode: 384 });
|
|
6565
6696
|
}
|
|
6566
6697
|
async function clearPendingBatch(watermarkPath) {
|
|
@@ -6582,7 +6713,7 @@ async function readWatermark(path) {
|
|
|
6582
6713
|
}
|
|
6583
6714
|
}
|
|
6584
6715
|
async function writeWatermark(path, offset) {
|
|
6585
|
-
await mkdir13(
|
|
6716
|
+
await mkdir13(dirname14(path), { recursive: true });
|
|
6586
6717
|
const tmp = `${path}.tmp`;
|
|
6587
6718
|
await writeFile14(tmp, offset.toString() + "\n", { encoding: "utf-8", mode: 384 });
|
|
6588
6719
|
const { rename: rename8 } = await import("fs/promises");
|
|
@@ -6602,8 +6733,8 @@ async function isLocallyConsented(flagPath2) {
|
|
|
6602
6733
|
init_config_dir();
|
|
6603
6734
|
import { createServer } from "http";
|
|
6604
6735
|
import { mkdir as mkdir14, writeFile as writeFile15, unlink as unlink11 } from "fs/promises";
|
|
6605
|
-
import { dirname as
|
|
6606
|
-
import { createHash as createHash4, randomUUID as
|
|
6736
|
+
import { dirname as dirname15, join as join23 } from "path";
|
|
6737
|
+
import { createHash as createHash4, randomUUID as randomUUID3 } from "crypto";
|
|
6607
6738
|
|
|
6608
6739
|
// ../listener/dist/mcp/sanitize.js
|
|
6609
6740
|
var MCP_RESPONSE_BYTE_CAP = 200 * 1024;
|
|
@@ -7728,7 +7859,7 @@ function handleRequest(req, res, options, sessions, secretCtx) {
|
|
|
7728
7859
|
if (!body?.repoId)
|
|
7729
7860
|
return sendJson(res, 400, { error: "missing_repoId" });
|
|
7730
7861
|
return options.graphCache.acquire(body.repoId).then(() => {
|
|
7731
|
-
const sessionId =
|
|
7862
|
+
const sessionId = randomUUID3();
|
|
7732
7863
|
sessions.set(sessionId, { repoId: body.repoId });
|
|
7733
7864
|
return sendJson(res, 200, { sessionId });
|
|
7734
7865
|
});
|
|
@@ -8221,7 +8352,7 @@ async function readJson(req) {
|
|
|
8221
8352
|
}
|
|
8222
8353
|
}
|
|
8223
8354
|
async function writeEndpointFile(path, endpoint, secret) {
|
|
8224
|
-
await mkdir14(
|
|
8355
|
+
await mkdir14(dirname15(path), { recursive: true });
|
|
8225
8356
|
await writeFile15(path, formatEndpointFile({ endpoint, secret }), {
|
|
8226
8357
|
encoding: "utf-8",
|
|
8227
8358
|
mode: 384
|
|
@@ -8303,7 +8434,11 @@ async function startMcp(options) {
|
|
|
8303
8434
|
getAuthToken: options.getAuthToken,
|
|
8304
8435
|
flagFilePath,
|
|
8305
8436
|
...options.fetchImpl ? { fetchImpl: options.fetchImpl } : {}
|
|
8306
|
-
})
|
|
8437
|
+
}),
|
|
8438
|
+
// Durable delivery: a rolled bucket is persisted before the POST, so a
|
|
8439
|
+
// transient failure (network / auth gap / 5xx) is retried next tick and
|
|
8440
|
+
// survives a restart instead of dropping the hour's counts.
|
|
8441
|
+
queue: createFileHeartbeatQueue({ path: join24(mcpHome, "heartbeat-queue.jsonl") })
|
|
8307
8442
|
}) : null;
|
|
8308
8443
|
const heartbeatAbort = heartbeatEmitter ? new AbortController() : null;
|
|
8309
8444
|
const server = await startMcpServer({
|
|
@@ -8523,10 +8658,10 @@ async function ensureServerConsent(opts) {
|
|
|
8523
8658
|
});
|
|
8524
8659
|
if (!res.ok)
|
|
8525
8660
|
return;
|
|
8526
|
-
const
|
|
8661
|
+
const fs32 = await import("fs/promises");
|
|
8527
8662
|
const path = await import("path");
|
|
8528
|
-
await
|
|
8529
|
-
await
|
|
8663
|
+
await fs32.mkdir(path.dirname(opts.markerPath), { recursive: true });
|
|
8664
|
+
await fs32.writeFile(opts.markerPath, (/* @__PURE__ */ new Date()).toISOString() + "\n", {
|
|
8530
8665
|
encoding: "utf-8",
|
|
8531
8666
|
mode: 384
|
|
8532
8667
|
});
|
|
@@ -8539,12 +8674,12 @@ import { homedir as homedir6 } from "os";
|
|
|
8539
8674
|
import { basename as basename3 } from "path";
|
|
8540
8675
|
|
|
8541
8676
|
// ../listener/dist/mcp/auto-config/writers/claude-code.js
|
|
8542
|
-
import { promises as
|
|
8677
|
+
import { promises as fs7 } from "fs";
|
|
8543
8678
|
import { join as join25 } from "path";
|
|
8544
8679
|
|
|
8545
8680
|
// ../listener/dist/mcp/auto-config/markers.js
|
|
8546
|
-
import { promises as
|
|
8547
|
-
import { dirname as
|
|
8681
|
+
import { promises as fs6 } from "fs";
|
|
8682
|
+
import { dirname as dirname16 } from "path";
|
|
8548
8683
|
function repoWiseServerName(ctx) {
|
|
8549
8684
|
return `RepoWise MCP for ${ctx.repoName}${ctx.envSuffix ?? ""}`;
|
|
8550
8685
|
}
|
|
@@ -8557,8 +8692,8 @@ async function writeMergedConfig(params) {
|
|
|
8557
8692
|
const existing = safeExistingContent(params.path, current);
|
|
8558
8693
|
if (existing === canonical)
|
|
8559
8694
|
return "unchanged";
|
|
8560
|
-
await
|
|
8561
|
-
await
|
|
8695
|
+
await fs6.mkdir(dirname16(params.path), { recursive: true });
|
|
8696
|
+
await fs6.writeFile(params.path, canonical, "utf-8");
|
|
8562
8697
|
return "written";
|
|
8563
8698
|
}
|
|
8564
8699
|
async function removeFromConfig(path, serverName) {
|
|
@@ -8571,11 +8706,11 @@ async function removeFromConfig(path, serverName) {
|
|
|
8571
8706
|
if (Object.keys(servers).length === 0) {
|
|
8572
8707
|
delete next.mcpServers;
|
|
8573
8708
|
}
|
|
8574
|
-
await
|
|
8709
|
+
await fs6.writeFile(path, canonicalize(next), "utf-8");
|
|
8575
8710
|
}
|
|
8576
8711
|
async function readConfig(path) {
|
|
8577
8712
|
try {
|
|
8578
|
-
const raw = await
|
|
8713
|
+
const raw = await fs6.readFile(path, "utf-8");
|
|
8579
8714
|
return JSON.parse(raw);
|
|
8580
8715
|
} catch (err) {
|
|
8581
8716
|
if (err.code === "ENOENT")
|
|
@@ -8643,7 +8778,7 @@ var claudeCodeWriter = {
|
|
|
8643
8778
|
};
|
|
8644
8779
|
async function fileExists2(path) {
|
|
8645
8780
|
try {
|
|
8646
|
-
await
|
|
8781
|
+
await fs7.access(path);
|
|
8647
8782
|
return true;
|
|
8648
8783
|
} catch {
|
|
8649
8784
|
return false;
|
|
@@ -8654,7 +8789,7 @@ async function hasClaudeBinary(home) {
|
|
|
8654
8789
|
}
|
|
8655
8790
|
|
|
8656
8791
|
// ../listener/dist/mcp/auto-config/writers/claude-code-hooks.js
|
|
8657
|
-
import { promises as
|
|
8792
|
+
import { promises as fs8 } from "fs";
|
|
8658
8793
|
import { join as join26 } from "path";
|
|
8659
8794
|
var claudeCodeHooksWriter = {
|
|
8660
8795
|
tool: "claude-code-hooks",
|
|
@@ -8671,7 +8806,7 @@ var claudeCodeHooksWriter = {
|
|
|
8671
8806
|
};
|
|
8672
8807
|
async function fileExists3(path) {
|
|
8673
8808
|
try {
|
|
8674
|
-
await
|
|
8809
|
+
await fs8.access(path);
|
|
8675
8810
|
return true;
|
|
8676
8811
|
} catch {
|
|
8677
8812
|
return false;
|
|
@@ -8679,7 +8814,7 @@ async function fileExists3(path) {
|
|
|
8679
8814
|
}
|
|
8680
8815
|
|
|
8681
8816
|
// ../listener/dist/mcp/auto-config/writers/cline.js
|
|
8682
|
-
import { promises as
|
|
8817
|
+
import { promises as fs9 } from "fs";
|
|
8683
8818
|
import { join as join27 } from "path";
|
|
8684
8819
|
var clineWriter = {
|
|
8685
8820
|
tool: "cline",
|
|
@@ -8704,7 +8839,7 @@ var clineWriter = {
|
|
|
8704
8839
|
};
|
|
8705
8840
|
async function fileExists4(path) {
|
|
8706
8841
|
try {
|
|
8707
|
-
await
|
|
8842
|
+
await fs9.access(path);
|
|
8708
8843
|
return true;
|
|
8709
8844
|
} catch {
|
|
8710
8845
|
return false;
|
|
@@ -8712,7 +8847,7 @@ async function fileExists4(path) {
|
|
|
8712
8847
|
}
|
|
8713
8848
|
|
|
8714
8849
|
// ../listener/dist/mcp/auto-config/writers/cline-hooks.js
|
|
8715
|
-
import { promises as
|
|
8850
|
+
import { promises as fs10 } from "fs";
|
|
8716
8851
|
import { join as join28 } from "path";
|
|
8717
8852
|
var SCRIPT_REL = ".clinerules/hooks/UserPromptSubmit";
|
|
8718
8853
|
var OWNERSHIP_MARKER = "managed by RepoWise";
|
|
@@ -8746,8 +8881,8 @@ var clineHooksWriter = {
|
|
|
8746
8881
|
await ensureExecutable(path);
|
|
8747
8882
|
return { status: "unchanged", path };
|
|
8748
8883
|
}
|
|
8749
|
-
await
|
|
8750
|
-
await
|
|
8884
|
+
await fs10.mkdir(join28(ctx.repoRoot, ".clinerules", "hooks"), { recursive: true });
|
|
8885
|
+
await fs10.writeFile(path, next, { encoding: "utf-8", mode: 493 });
|
|
8751
8886
|
await ensureExecutable(path);
|
|
8752
8887
|
await applyGitignoreChanges(ctx.repoRoot, { add: [SCRIPT_REL] });
|
|
8753
8888
|
return { status: "written", path };
|
|
@@ -8756,23 +8891,23 @@ var clineHooksWriter = {
|
|
|
8756
8891
|
const path = join28(ctx.repoRoot, SCRIPT_REL);
|
|
8757
8892
|
const existing = await readOrNull(path);
|
|
8758
8893
|
if (existing !== null && existing.includes(OWNERSHIP_MARKER)) {
|
|
8759
|
-
await
|
|
8894
|
+
await fs10.unlink(path);
|
|
8760
8895
|
}
|
|
8761
8896
|
await applyGitignoreChanges(ctx.repoRoot, { remove: [SCRIPT_REL] });
|
|
8762
8897
|
}
|
|
8763
8898
|
};
|
|
8764
8899
|
async function ensureExecutable(path) {
|
|
8765
8900
|
try {
|
|
8766
|
-
const stat8 = await
|
|
8901
|
+
const stat8 = await fs10.stat(path);
|
|
8767
8902
|
if ((stat8.mode & 73) === 0) {
|
|
8768
|
-
await
|
|
8903
|
+
await fs10.chmod(path, 493);
|
|
8769
8904
|
}
|
|
8770
8905
|
} catch {
|
|
8771
8906
|
}
|
|
8772
8907
|
}
|
|
8773
8908
|
async function fileExists5(path) {
|
|
8774
8909
|
try {
|
|
8775
|
-
await
|
|
8910
|
+
await fs10.access(path);
|
|
8776
8911
|
return true;
|
|
8777
8912
|
} catch {
|
|
8778
8913
|
return false;
|
|
@@ -8780,14 +8915,14 @@ async function fileExists5(path) {
|
|
|
8780
8915
|
}
|
|
8781
8916
|
async function readOrNull(path) {
|
|
8782
8917
|
try {
|
|
8783
|
-
return await
|
|
8918
|
+
return await fs10.readFile(path, "utf-8");
|
|
8784
8919
|
} catch {
|
|
8785
8920
|
return null;
|
|
8786
8921
|
}
|
|
8787
8922
|
}
|
|
8788
8923
|
|
|
8789
8924
|
// ../listener/dist/mcp/auto-config/writers/codex.js
|
|
8790
|
-
import { promises as
|
|
8925
|
+
import { promises as fs11 } from "fs";
|
|
8791
8926
|
import { join as join29 } from "path";
|
|
8792
8927
|
var codexWriter = {
|
|
8793
8928
|
tool: "codex",
|
|
@@ -8812,7 +8947,7 @@ var codexWriter = {
|
|
|
8812
8947
|
};
|
|
8813
8948
|
async function fileExists6(path) {
|
|
8814
8949
|
try {
|
|
8815
|
-
await
|
|
8950
|
+
await fs11.access(path);
|
|
8816
8951
|
return true;
|
|
8817
8952
|
} catch {
|
|
8818
8953
|
return false;
|
|
@@ -8820,7 +8955,7 @@ async function fileExists6(path) {
|
|
|
8820
8955
|
}
|
|
8821
8956
|
|
|
8822
8957
|
// ../listener/dist/mcp/auto-config/writers/codex-hooks.js
|
|
8823
|
-
import { promises as
|
|
8958
|
+
import { promises as fs12 } from "fs";
|
|
8824
8959
|
import { join as join30 } from "path";
|
|
8825
8960
|
var HOOKS_REL = ".codex/hooks.json";
|
|
8826
8961
|
var codexHooksWriter = {
|
|
@@ -8851,8 +8986,8 @@ var codexHooksWriter = {
|
|
|
8851
8986
|
if (merged === existing) {
|
|
8852
8987
|
return { status: "unchanged", path };
|
|
8853
8988
|
}
|
|
8854
|
-
await
|
|
8855
|
-
await
|
|
8989
|
+
await fs12.mkdir(join30(ctx.repoRoot, ".codex"), { recursive: true });
|
|
8990
|
+
await fs12.writeFile(path, merged, "utf-8");
|
|
8856
8991
|
await applyGitignoreChanges(ctx.repoRoot, { add: [HOOKS_REL] });
|
|
8857
8992
|
return { status: "written", path };
|
|
8858
8993
|
},
|
|
@@ -8862,9 +8997,9 @@ var codexHooksWriter = {
|
|
|
8862
8997
|
if (existing !== null) {
|
|
8863
8998
|
const next = removeCodexHookSettings(existing);
|
|
8864
8999
|
if (next === null) {
|
|
8865
|
-
await
|
|
9000
|
+
await fs12.unlink(path);
|
|
8866
9001
|
} else if (next !== existing) {
|
|
8867
|
-
await
|
|
9002
|
+
await fs12.writeFile(path, next, "utf-8");
|
|
8868
9003
|
}
|
|
8869
9004
|
}
|
|
8870
9005
|
await applyGitignoreChanges(ctx.repoRoot, { remove: [HOOKS_REL] });
|
|
@@ -8872,7 +9007,7 @@ var codexHooksWriter = {
|
|
|
8872
9007
|
};
|
|
8873
9008
|
async function fileExists7(path) {
|
|
8874
9009
|
try {
|
|
8875
|
-
await
|
|
9010
|
+
await fs12.access(path);
|
|
8876
9011
|
return true;
|
|
8877
9012
|
} catch {
|
|
8878
9013
|
return false;
|
|
@@ -8880,14 +9015,14 @@ async function fileExists7(path) {
|
|
|
8880
9015
|
}
|
|
8881
9016
|
async function readOrNull2(path) {
|
|
8882
9017
|
try {
|
|
8883
|
-
return await
|
|
9018
|
+
return await fs12.readFile(path, "utf-8");
|
|
8884
9019
|
} catch {
|
|
8885
9020
|
return null;
|
|
8886
9021
|
}
|
|
8887
9022
|
}
|
|
8888
9023
|
|
|
8889
9024
|
// ../listener/dist/mcp/auto-config/writers/copilot.js
|
|
8890
|
-
import { promises as
|
|
9025
|
+
import { promises as fs13 } from "fs";
|
|
8891
9026
|
import { join as join31 } from "path";
|
|
8892
9027
|
var copilotWriter = {
|
|
8893
9028
|
tool: "copilot",
|
|
@@ -8912,7 +9047,7 @@ var copilotWriter = {
|
|
|
8912
9047
|
};
|
|
8913
9048
|
async function fileExists8(path) {
|
|
8914
9049
|
try {
|
|
8915
|
-
await
|
|
9050
|
+
await fs13.access(path);
|
|
8916
9051
|
return true;
|
|
8917
9052
|
} catch {
|
|
8918
9053
|
return false;
|
|
@@ -8920,7 +9055,7 @@ async function fileExists8(path) {
|
|
|
8920
9055
|
}
|
|
8921
9056
|
|
|
8922
9057
|
// ../listener/dist/mcp/auto-config/writers/copilot-hooks.js
|
|
8923
|
-
import { promises as
|
|
9058
|
+
import { promises as fs14 } from "fs";
|
|
8924
9059
|
import { join as join32 } from "path";
|
|
8925
9060
|
var HOOKS_REL2 = ".github/hooks/repowise.json";
|
|
8926
9061
|
var copilotHooksWriter = {
|
|
@@ -8949,8 +9084,8 @@ var copilotHooksWriter = {
|
|
|
8949
9084
|
if (existing === next) {
|
|
8950
9085
|
return { status: "unchanged", path };
|
|
8951
9086
|
}
|
|
8952
|
-
await
|
|
8953
|
-
await
|
|
9087
|
+
await fs14.mkdir(join32(ctx.repoRoot, ".github", "hooks"), { recursive: true });
|
|
9088
|
+
await fs14.writeFile(path, next, "utf-8");
|
|
8954
9089
|
const userSelected = ctx.selectedTools?.includes("copilot") ?? false;
|
|
8955
9090
|
await applyGitignoreChanges(ctx.repoRoot, userSelected ? { remove: [HOOKS_REL2] } : { add: [HOOKS_REL2] });
|
|
8956
9091
|
return { status: "written", path };
|
|
@@ -8958,7 +9093,7 @@ var copilotHooksWriter = {
|
|
|
8958
9093
|
async remove(ctx) {
|
|
8959
9094
|
const path = join32(ctx.repoRoot, HOOKS_REL2);
|
|
8960
9095
|
if (!await isGitTracked(ctx.repoRoot, HOOKS_REL2)) {
|
|
8961
|
-
await
|
|
9096
|
+
await fs14.unlink(path).catch(() => {
|
|
8962
9097
|
});
|
|
8963
9098
|
}
|
|
8964
9099
|
await applyGitignoreChanges(ctx.repoRoot, { remove: [HOOKS_REL2] });
|
|
@@ -8966,7 +9101,7 @@ var copilotHooksWriter = {
|
|
|
8966
9101
|
};
|
|
8967
9102
|
async function fileExists9(path) {
|
|
8968
9103
|
try {
|
|
8969
|
-
await
|
|
9104
|
+
await fs14.access(path);
|
|
8970
9105
|
return true;
|
|
8971
9106
|
} catch {
|
|
8972
9107
|
return false;
|
|
@@ -8974,14 +9109,14 @@ async function fileExists9(path) {
|
|
|
8974
9109
|
}
|
|
8975
9110
|
async function readOrNull3(path) {
|
|
8976
9111
|
try {
|
|
8977
|
-
return await
|
|
9112
|
+
return await fs14.readFile(path, "utf-8");
|
|
8978
9113
|
} catch {
|
|
8979
9114
|
return null;
|
|
8980
9115
|
}
|
|
8981
9116
|
}
|
|
8982
9117
|
|
|
8983
9118
|
// ../listener/dist/mcp/auto-config/writers/cursor.js
|
|
8984
|
-
import { promises as
|
|
9119
|
+
import { promises as fs15 } from "fs";
|
|
8985
9120
|
import { join as join33 } from "path";
|
|
8986
9121
|
var cursorWriter = {
|
|
8987
9122
|
tool: "cursor",
|
|
@@ -9006,7 +9141,7 @@ var cursorWriter = {
|
|
|
9006
9141
|
};
|
|
9007
9142
|
async function fileExists10(path) {
|
|
9008
9143
|
try {
|
|
9009
|
-
await
|
|
9144
|
+
await fs15.access(path);
|
|
9010
9145
|
return true;
|
|
9011
9146
|
} catch {
|
|
9012
9147
|
return false;
|
|
@@ -9014,7 +9149,7 @@ async function fileExists10(path) {
|
|
|
9014
9149
|
}
|
|
9015
9150
|
|
|
9016
9151
|
// ../listener/dist/mcp/auto-config/writers/gemini-cli.js
|
|
9017
|
-
import { promises as
|
|
9152
|
+
import { promises as fs16 } from "fs";
|
|
9018
9153
|
import { join as join34 } from "path";
|
|
9019
9154
|
var geminiCliWriter = {
|
|
9020
9155
|
tool: "gemini-cli",
|
|
@@ -9039,7 +9174,7 @@ var geminiCliWriter = {
|
|
|
9039
9174
|
};
|
|
9040
9175
|
async function fileExists11(path) {
|
|
9041
9176
|
try {
|
|
9042
|
-
await
|
|
9177
|
+
await fs16.access(path);
|
|
9043
9178
|
return true;
|
|
9044
9179
|
} catch {
|
|
9045
9180
|
return false;
|
|
@@ -9047,7 +9182,7 @@ async function fileExists11(path) {
|
|
|
9047
9182
|
}
|
|
9048
9183
|
|
|
9049
9184
|
// ../listener/dist/mcp/auto-config/writers/gemini-hooks.js
|
|
9050
|
-
import { promises as
|
|
9185
|
+
import { promises as fs17 } from "fs";
|
|
9051
9186
|
import { join as join35 } from "path";
|
|
9052
9187
|
var SETTINGS_REL = ".gemini/settings.json";
|
|
9053
9188
|
var geminiHooksWriter = {
|
|
@@ -9078,8 +9213,8 @@ var geminiHooksWriter = {
|
|
|
9078
9213
|
if (merged === existing) {
|
|
9079
9214
|
return { status: "unchanged", path };
|
|
9080
9215
|
}
|
|
9081
|
-
await
|
|
9082
|
-
await
|
|
9216
|
+
await fs17.mkdir(join35(ctx.repoRoot, ".gemini"), { recursive: true });
|
|
9217
|
+
await fs17.writeFile(path, merged, "utf-8");
|
|
9083
9218
|
await applyGitignoreChanges(ctx.repoRoot, { add: [SETTINGS_REL] });
|
|
9084
9219
|
return { status: "written", path };
|
|
9085
9220
|
},
|
|
@@ -9089,9 +9224,9 @@ var geminiHooksWriter = {
|
|
|
9089
9224
|
if (existing !== null) {
|
|
9090
9225
|
const next = removeGeminiHookSettings(existing);
|
|
9091
9226
|
if (next === null) {
|
|
9092
|
-
await
|
|
9227
|
+
await fs17.unlink(path);
|
|
9093
9228
|
} else if (next !== existing) {
|
|
9094
|
-
await
|
|
9229
|
+
await fs17.writeFile(path, next, "utf-8");
|
|
9095
9230
|
}
|
|
9096
9231
|
}
|
|
9097
9232
|
await applyGitignoreChanges(ctx.repoRoot, { remove: [SETTINGS_REL] });
|
|
@@ -9099,7 +9234,7 @@ var geminiHooksWriter = {
|
|
|
9099
9234
|
};
|
|
9100
9235
|
async function fileExists12(path) {
|
|
9101
9236
|
try {
|
|
9102
|
-
await
|
|
9237
|
+
await fs17.access(path);
|
|
9103
9238
|
return true;
|
|
9104
9239
|
} catch {
|
|
9105
9240
|
return false;
|
|
@@ -9107,14 +9242,14 @@ async function fileExists12(path) {
|
|
|
9107
9242
|
}
|
|
9108
9243
|
async function readOrNull4(path) {
|
|
9109
9244
|
try {
|
|
9110
|
-
return await
|
|
9245
|
+
return await fs17.readFile(path, "utf-8");
|
|
9111
9246
|
} catch {
|
|
9112
9247
|
return null;
|
|
9113
9248
|
}
|
|
9114
9249
|
}
|
|
9115
9250
|
|
|
9116
9251
|
// ../listener/dist/mcp/auto-config/writers/roo.js
|
|
9117
|
-
import { promises as
|
|
9252
|
+
import { promises as fs18 } from "fs";
|
|
9118
9253
|
import { join as join36 } from "path";
|
|
9119
9254
|
var rooWriter = {
|
|
9120
9255
|
tool: "roo",
|
|
@@ -9145,7 +9280,7 @@ var rooWriter = {
|
|
|
9145
9280
|
};
|
|
9146
9281
|
async function fileExists13(path) {
|
|
9147
9282
|
try {
|
|
9148
|
-
await
|
|
9283
|
+
await fs18.access(path);
|
|
9149
9284
|
return true;
|
|
9150
9285
|
} catch {
|
|
9151
9286
|
return false;
|
|
@@ -9153,14 +9288,14 @@ async function fileExists13(path) {
|
|
|
9153
9288
|
}
|
|
9154
9289
|
async function readOrNull5(path) {
|
|
9155
9290
|
try {
|
|
9156
|
-
return await
|
|
9291
|
+
return await fs18.readFile(path, "utf-8");
|
|
9157
9292
|
} catch {
|
|
9158
9293
|
return null;
|
|
9159
9294
|
}
|
|
9160
9295
|
}
|
|
9161
9296
|
|
|
9162
9297
|
// ../listener/dist/mcp/auto-config/writers/windsurf.js
|
|
9163
|
-
import { promises as
|
|
9298
|
+
import { promises as fs19 } from "fs";
|
|
9164
9299
|
import { join as join37 } from "path";
|
|
9165
9300
|
var windsurfWriter = {
|
|
9166
9301
|
tool: "windsurf",
|
|
@@ -9185,7 +9320,7 @@ var windsurfWriter = {
|
|
|
9185
9320
|
};
|
|
9186
9321
|
async function fileExists14(path) {
|
|
9187
9322
|
try {
|
|
9188
|
-
await
|
|
9323
|
+
await fs19.access(path);
|
|
9189
9324
|
return true;
|
|
9190
9325
|
} catch {
|
|
9191
9326
|
return false;
|
|
@@ -9260,7 +9395,7 @@ init_installer();
|
|
|
9260
9395
|
// ../listener/dist/lsp/warm.js
|
|
9261
9396
|
init_registry();
|
|
9262
9397
|
init_lsp_tools();
|
|
9263
|
-
import { promises as
|
|
9398
|
+
import { promises as fs20 } from "fs";
|
|
9264
9399
|
import { join as join38 } from "path";
|
|
9265
9400
|
async function collectRepresentativeFiles(repoRoot) {
|
|
9266
9401
|
const reps = /* @__PURE__ */ new Map();
|
|
@@ -9271,7 +9406,7 @@ async function collectRepresentativeFiles(repoRoot) {
|
|
|
9271
9406
|
return;
|
|
9272
9407
|
let entries;
|
|
9273
9408
|
try {
|
|
9274
|
-
entries = await
|
|
9409
|
+
entries = await fs20.readdir(dir);
|
|
9275
9410
|
} catch {
|
|
9276
9411
|
return;
|
|
9277
9412
|
}
|
|
@@ -9293,7 +9428,7 @@ async function collectRepresentativeFiles(repoRoot) {
|
|
|
9293
9428
|
await inspect(repoRoot, "");
|
|
9294
9429
|
let topEntries = [];
|
|
9295
9430
|
try {
|
|
9296
|
-
topEntries = await
|
|
9431
|
+
topEntries = await fs20.readdir(repoRoot);
|
|
9297
9432
|
} catch {
|
|
9298
9433
|
return reps;
|
|
9299
9434
|
}
|
|
@@ -9304,7 +9439,7 @@ async function collectRepresentativeFiles(repoRoot) {
|
|
|
9304
9439
|
continue;
|
|
9305
9440
|
const sub = join38(repoRoot, name);
|
|
9306
9441
|
try {
|
|
9307
|
-
const stat8 = await
|
|
9442
|
+
const stat8 = await fs20.stat(sub);
|
|
9308
9443
|
if (stat8.isDirectory())
|
|
9309
9444
|
await inspect(sub, name);
|
|
9310
9445
|
} catch {
|
|
@@ -9318,7 +9453,7 @@ async function warmReposLsp(repos, workspaces, lspOverrides, isAvailable) {
|
|
|
9318
9453
|
if (!repoRoot)
|
|
9319
9454
|
continue;
|
|
9320
9455
|
try {
|
|
9321
|
-
const stat8 = await
|
|
9456
|
+
const stat8 = await fs20.stat(repoRoot);
|
|
9322
9457
|
if (!stat8.isDirectory())
|
|
9323
9458
|
continue;
|
|
9324
9459
|
} catch {
|
|
@@ -9347,7 +9482,7 @@ async function warmReposLsp(repos, workspaces, lspOverrides, isAvailable) {
|
|
|
9347
9482
|
|
|
9348
9483
|
// ../listener/dist/lib/workspace-prep.js
|
|
9349
9484
|
init_config_dir();
|
|
9350
|
-
import { promises as
|
|
9485
|
+
import { promises as fs21 } from "fs";
|
|
9351
9486
|
import { spawn as spawn9, execFile as execFile5 } from "child_process";
|
|
9352
9487
|
import { createWriteStream as createWriteStream2 } from "fs";
|
|
9353
9488
|
import { join as join39 } from "path";
|
|
@@ -9404,7 +9539,7 @@ async function maybeWriteClangdStub(repoRoot, repoId) {
|
|
|
9404
9539
|
return;
|
|
9405
9540
|
let ents;
|
|
9406
9541
|
try {
|
|
9407
|
-
ents = await
|
|
9542
|
+
ents = await fs21.readdir(dir, { withFileTypes: true });
|
|
9408
9543
|
} catch {
|
|
9409
9544
|
return;
|
|
9410
9545
|
}
|
|
@@ -9440,9 +9575,9 @@ async function maybeWriteClangdStub(repoRoot, repoId) {
|
|
|
9440
9575
|
};
|
|
9441
9576
|
});
|
|
9442
9577
|
const outDir = join39(repoRoot, ".repowise");
|
|
9443
|
-
await
|
|
9578
|
+
await fs21.mkdir(outDir, { recursive: true });
|
|
9444
9579
|
const outPath = join39(outDir, "compile_commands.json");
|
|
9445
|
-
await
|
|
9580
|
+
await fs21.writeFile(outPath, JSON.stringify(entries, null, 2));
|
|
9446
9581
|
const capHit = sources.length >= MAX_STUB_SOURCES;
|
|
9447
9582
|
console.log(`[workspace-prep] ${repoId}: wrote ${entries.length.toString()}-entry compile_commands stub to .repowise/${capHit ? " (cap reached \u2014 additional sources truncated)" : ""}`);
|
|
9448
9583
|
return true;
|
|
@@ -9450,7 +9585,7 @@ async function maybeWriteClangdStub(repoRoot, repoId) {
|
|
|
9450
9585
|
var DEFAULT_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
9451
9586
|
async function fileExists15(repoRoot, name) {
|
|
9452
9587
|
try {
|
|
9453
|
-
await
|
|
9588
|
+
await fs21.access(join39(repoRoot, name));
|
|
9454
9589
|
return true;
|
|
9455
9590
|
} catch {
|
|
9456
9591
|
return false;
|
|
@@ -9461,7 +9596,7 @@ async function detectWorkspaceDeps(repoRoot) {
|
|
|
9461
9596
|
if (await fileExists15(repoRoot, "package.json")) {
|
|
9462
9597
|
let pkgRaw = "";
|
|
9463
9598
|
try {
|
|
9464
|
-
pkgRaw = await
|
|
9599
|
+
pkgRaw = await fs21.readFile(join39(repoRoot, "package.json"), "utf8");
|
|
9465
9600
|
} catch {
|
|
9466
9601
|
}
|
|
9467
9602
|
if (pkgRaw) {
|
|
@@ -9565,7 +9700,7 @@ async function runWorkspacePreps(opts) {
|
|
|
9565
9700
|
return [];
|
|
9566
9701
|
const safeRepoId = opts.repoId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
9567
9702
|
const logPath2 = join39(getConfigDir(), `install-log.${safeRepoId}.txt`);
|
|
9568
|
-
await
|
|
9703
|
+
await fs21.mkdir(getConfigDir(), { recursive: true });
|
|
9569
9704
|
const stream = opts.logStream ?? createWriteStream2(logPath2, { flags: "a" });
|
|
9570
9705
|
stream.on("error", () => {
|
|
9571
9706
|
});
|
|
@@ -9808,7 +9943,7 @@ async function ensureIndexable(indexRoot, language, options = {}) {
|
|
|
9808
9943
|
init_src();
|
|
9809
9944
|
init_registry();
|
|
9810
9945
|
import { execFile as execFileCb2 } from "child_process";
|
|
9811
|
-
import { dirname as
|
|
9946
|
+
import { dirname as dirname17 } from "path";
|
|
9812
9947
|
import { promisify as promisify5 } from "util";
|
|
9813
9948
|
init_daemon_path();
|
|
9814
9949
|
|
|
@@ -10296,7 +10431,7 @@ async function isCommandOnPath4(command) {
|
|
|
10296
10431
|
timeout: 5e3,
|
|
10297
10432
|
env: {
|
|
10298
10433
|
...process.env,
|
|
10299
|
-
PATH: buildLspSpawnPath(process.env.PATH,
|
|
10434
|
+
PATH: buildLspSpawnPath(process.env.PATH, dirname17(process.execPath), managedBinDirs())
|
|
10300
10435
|
}
|
|
10301
10436
|
});
|
|
10302
10437
|
return true;
|
|
@@ -10968,11 +11103,11 @@ function resolveAuditRoots() {
|
|
|
10968
11103
|
return override.split(":").map((s) => s.trim()).filter(Boolean);
|
|
10969
11104
|
}
|
|
10970
11105
|
const out = /* @__PURE__ */ new Set();
|
|
10971
|
-
let dir =
|
|
11106
|
+
let dir = dirname18(process.execPath);
|
|
10972
11107
|
for (let i = 0; i < 8; i += 1) {
|
|
10973
11108
|
out.add(join42(dir, "node_modules"));
|
|
10974
11109
|
out.add(join42(dir, "lib", "node_modules"));
|
|
10975
|
-
const parent =
|
|
11110
|
+
const parent = dirname18(dir);
|
|
10976
11111
|
if (parent === dir)
|
|
10977
11112
|
break;
|
|
10978
11113
|
dir = parent;
|
|
@@ -11038,8 +11173,8 @@ async function waitForCredentials(isRunning2) {
|
|
|
11038
11173
|
let changed = false;
|
|
11039
11174
|
let watcher = null;
|
|
11040
11175
|
try {
|
|
11041
|
-
const
|
|
11042
|
-
watcher =
|
|
11176
|
+
const fs32 = await import("fs");
|
|
11177
|
+
watcher = fs32.watch(getConfigDir(), (_event, filename) => {
|
|
11043
11178
|
if (!filename || filename === "credentials.json")
|
|
11044
11179
|
changed = true;
|
|
11045
11180
|
});
|
|
@@ -11065,8 +11200,8 @@ async function waitForCredentialsOrTerminal(isRunning2) {
|
|
|
11065
11200
|
let changed = false;
|
|
11066
11201
|
let watcher = null;
|
|
11067
11202
|
try {
|
|
11068
|
-
const
|
|
11069
|
-
watcher =
|
|
11203
|
+
const fs32 = await import("fs");
|
|
11204
|
+
watcher = fs32.watch(getConfigDir(), (_event, filename) => {
|
|
11070
11205
|
if (!filename || filename === "credentials.json")
|
|
11071
11206
|
changed = true;
|
|
11072
11207
|
});
|
|
@@ -11571,7 +11706,7 @@ async function startListener() {
|
|
|
11571
11706
|
const packageName = true ? "repowisestage" : "repowise";
|
|
11572
11707
|
let currentVersion = "";
|
|
11573
11708
|
try {
|
|
11574
|
-
const selfDir =
|
|
11709
|
+
const selfDir = dirname18(fileURLToPath3(import.meta.url));
|
|
11575
11710
|
const pkgJsonPath = join42(selfDir, "..", "..", "package.json");
|
|
11576
11711
|
const pkgJson = JSON.parse(await readFile14(pkgJsonPath, "utf-8"));
|
|
11577
11712
|
currentVersion = pkgJson.version;
|
|
@@ -12307,7 +12442,7 @@ async function showWelcome(currentVersion) {
|
|
|
12307
12442
|
|
|
12308
12443
|
// src/commands/create.ts
|
|
12309
12444
|
import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
12310
|
-
import { dirname as
|
|
12445
|
+
import { dirname as dirname20, join as join51 } from "path";
|
|
12311
12446
|
init_src();
|
|
12312
12447
|
import chalk8 from "chalk";
|
|
12313
12448
|
import ora from "ora";
|
|
@@ -12839,7 +12974,7 @@ async function writeToolConfigsForRepo(opts) {
|
|
|
12839
12974
|
|
|
12840
12975
|
// src/lib/mcp-resolver.ts
|
|
12841
12976
|
import { basename as basename4, join as join46 } from "path";
|
|
12842
|
-
import { promises as
|
|
12977
|
+
import { promises as fs22 } from "fs";
|
|
12843
12978
|
var MCP_WRITER_TOOLS = /* @__PURE__ */ new Set([
|
|
12844
12979
|
"claude-code",
|
|
12845
12980
|
"cursor",
|
|
@@ -12880,7 +13015,7 @@ function mcpConfigTargetForTool(tool, opts) {
|
|
|
12880
13015
|
async function mcpConfigState(target) {
|
|
12881
13016
|
let raw;
|
|
12882
13017
|
try {
|
|
12883
|
-
raw = await
|
|
13018
|
+
raw = await fs22.readFile(target.path, "utf-8");
|
|
12884
13019
|
} catch {
|
|
12885
13020
|
return "absent";
|
|
12886
13021
|
}
|
|
@@ -12933,7 +13068,7 @@ function ensureGitignore(repoRoot, entry) {
|
|
|
12933
13068
|
// src/lib/graph-cache.ts
|
|
12934
13069
|
init_config_dir();
|
|
12935
13070
|
import { mkdirSync, writeFileSync as writeFileSync2, renameSync, unlinkSync } from "fs";
|
|
12936
|
-
import { dirname as
|
|
13071
|
+
import { dirname as dirname19, join as join48 } from "path";
|
|
12937
13072
|
var SAFE_REPO_ID = /^[A-Za-z0-9_.-]{1,128}$/;
|
|
12938
13073
|
function assertSafeRepoId2(repoId) {
|
|
12939
13074
|
if (!repoId || typeof repoId !== "string" || !SAFE_REPO_ID.test(repoId) || repoId === "." || repoId === ".." || repoId.startsWith(".")) {
|
|
@@ -13061,7 +13196,7 @@ async function ensureGraphDownloaded(opts) {
|
|
|
13061
13196
|
return { status: "not_found", message: "EMPTY_GRAPH" };
|
|
13062
13197
|
}
|
|
13063
13198
|
try {
|
|
13064
|
-
mkdirSync(
|
|
13199
|
+
mkdirSync(dirname19(targetPath), { recursive: true });
|
|
13065
13200
|
const tmp = `${targetPath}.${String(process.pid)}.${Math.random().toString(36).slice(2)}.tmp`;
|
|
13066
13201
|
try {
|
|
13067
13202
|
writeFileSync2(tmp, body, { encoding: "utf-8", mode: 384 });
|
|
@@ -13679,7 +13814,7 @@ async function promptDepInstallConsent(missing, opts) {
|
|
|
13679
13814
|
import chalk6 from "chalk";
|
|
13680
13815
|
|
|
13681
13816
|
// src/lib/dep-installer.ts
|
|
13682
|
-
import { promises as
|
|
13817
|
+
import { promises as fs23 } from "fs";
|
|
13683
13818
|
import { join as join49 } from "path";
|
|
13684
13819
|
var SUPPORTED_DEP_LANGUAGES = /* @__PURE__ */ new Set([
|
|
13685
13820
|
"typescript",
|
|
@@ -13690,7 +13825,7 @@ var SUPPORTED_DEP_LANGUAGES = /* @__PURE__ */ new Set([
|
|
|
13690
13825
|
]);
|
|
13691
13826
|
var exists = async (p) => {
|
|
13692
13827
|
try {
|
|
13693
|
-
await
|
|
13828
|
+
await fs23.access(p);
|
|
13694
13829
|
return true;
|
|
13695
13830
|
} catch {
|
|
13696
13831
|
return false;
|
|
@@ -13774,13 +13909,13 @@ async function detectMissingDeps(repoRoot, scopedLanguages) {
|
|
|
13774
13909
|
// src/lib/dep-installer-runner.ts
|
|
13775
13910
|
import { spawn as spawn11 } from "child_process";
|
|
13776
13911
|
import { createWriteStream as createWriteStream3 } from "fs";
|
|
13777
|
-
import { promises as
|
|
13912
|
+
import { promises as fs24 } from "fs";
|
|
13778
13913
|
import { join as join50 } from "path";
|
|
13779
13914
|
var DEFAULT_INSTALL_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
13780
13915
|
async function runMissingDepInstalls(opts) {
|
|
13781
13916
|
const safeRepoId = opts.repoId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
13782
13917
|
const logPath2 = join50(getConfigDir2(), `install-log.${safeRepoId}.txt`);
|
|
13783
|
-
await
|
|
13918
|
+
await fs24.mkdir(getConfigDir2(), { recursive: true });
|
|
13784
13919
|
const stream = opts.logStream ?? createWriteStream3(logPath2, { flags: "a" });
|
|
13785
13920
|
stream.on("error", () => {
|
|
13786
13921
|
});
|
|
@@ -14464,7 +14599,7 @@ async function create() {
|
|
|
14464
14599
|
if (response.ok) {
|
|
14465
14600
|
const content = await response.text();
|
|
14466
14601
|
const filePath = join51(contextDir, file.fileName);
|
|
14467
|
-
mkdirSync2(
|
|
14602
|
+
mkdirSync2(dirname20(filePath), { recursive: true });
|
|
14468
14603
|
writeFileSync3(filePath, content, "utf-8");
|
|
14469
14604
|
downloadedCount++;
|
|
14470
14605
|
} else {
|
|
@@ -14692,7 +14827,7 @@ Files are stored on our servers (not in git). Retry when online.`
|
|
|
14692
14827
|
|
|
14693
14828
|
// src/commands/member.ts
|
|
14694
14829
|
import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync4 } from "fs";
|
|
14695
|
-
import { dirname as
|
|
14830
|
+
import { dirname as dirname21, join as join52, resolve, sep } from "path";
|
|
14696
14831
|
import chalk9 from "chalk";
|
|
14697
14832
|
import ora2 from "ora";
|
|
14698
14833
|
var DEFAULT_CONTEXT_FOLDER2 = "repowise-context";
|
|
@@ -14867,7 +15002,7 @@ async function member() {
|
|
|
14867
15002
|
const response = await fetch(presignedUrl);
|
|
14868
15003
|
if (response.ok) {
|
|
14869
15004
|
const content = await response.text();
|
|
14870
|
-
mkdirSync3(
|
|
15005
|
+
mkdirSync3(dirname21(safePath), { recursive: true });
|
|
14871
15006
|
writeFileSync4(safePath, content, "utf-8");
|
|
14872
15007
|
downloadedCount++;
|
|
14873
15008
|
} else {
|
|
@@ -15024,7 +15159,7 @@ import chalk10 from "chalk";
|
|
|
15024
15159
|
import ora3 from "ora";
|
|
15025
15160
|
|
|
15026
15161
|
// src/lib/tenant-graph-purge.ts
|
|
15027
|
-
import { promises as
|
|
15162
|
+
import { promises as fs25 } from "fs";
|
|
15028
15163
|
import { homedir as homedir8 } from "os";
|
|
15029
15164
|
import { join as join53 } from "path";
|
|
15030
15165
|
async function purgeForeignGraphs(validRepoIds, home = homedir8()) {
|
|
@@ -15032,7 +15167,7 @@ async function purgeForeignGraphs(validRepoIds, home = homedir8()) {
|
|
|
15032
15167
|
const result = { kept: [], removed: [] };
|
|
15033
15168
|
let entries;
|
|
15034
15169
|
try {
|
|
15035
|
-
entries = await
|
|
15170
|
+
entries = await fs25.readdir(graphsDir);
|
|
15036
15171
|
} catch (err) {
|
|
15037
15172
|
if (err.code === "ENOENT") return result;
|
|
15038
15173
|
throw err;
|
|
@@ -15048,13 +15183,13 @@ async function purgeForeignGraphs(validRepoIds, home = homedir8()) {
|
|
|
15048
15183
|
}
|
|
15049
15184
|
const path = join53(graphsDir, entry);
|
|
15050
15185
|
try {
|
|
15051
|
-
const stat8 = await
|
|
15186
|
+
const stat8 = await fs25.lstat(path);
|
|
15052
15187
|
if (stat8.isSymbolicLink()) {
|
|
15053
|
-
await
|
|
15188
|
+
await fs25.unlink(path);
|
|
15054
15189
|
result.removed.push(entry);
|
|
15055
15190
|
continue;
|
|
15056
15191
|
}
|
|
15057
|
-
await
|
|
15192
|
+
await fs25.rm(path, { recursive: true, force: true });
|
|
15058
15193
|
result.removed.push(entry);
|
|
15059
15194
|
} catch {
|
|
15060
15195
|
}
|
|
@@ -15254,7 +15389,7 @@ async function status() {
|
|
|
15254
15389
|
|
|
15255
15390
|
// src/commands/sync.ts
|
|
15256
15391
|
import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync5 } from "fs";
|
|
15257
|
-
import { dirname as
|
|
15392
|
+
import { dirname as dirname22, join as join55 } from "path";
|
|
15258
15393
|
import chalk12 from "chalk";
|
|
15259
15394
|
import ora4 from "ora";
|
|
15260
15395
|
var POLL_INTERVAL_MS2 = 3e3;
|
|
@@ -15420,7 +15555,7 @@ async function sync() {
|
|
|
15420
15555
|
if (response.ok) {
|
|
15421
15556
|
const content = await response.text();
|
|
15422
15557
|
const filePath = join55(contextDir, file.fileName);
|
|
15423
|
-
mkdirSync4(
|
|
15558
|
+
mkdirSync4(dirname22(filePath), { recursive: true });
|
|
15424
15559
|
writeFileSync5(filePath, content, "utf-8");
|
|
15425
15560
|
downloadedCount++;
|
|
15426
15561
|
} else {
|
|
@@ -15823,7 +15958,7 @@ async function toolsList() {
|
|
|
15823
15958
|
// src/commands/mcp-log.ts
|
|
15824
15959
|
import { createDecipheriv as createDecipheriv2 } from "crypto";
|
|
15825
15960
|
import { mkdir as mkdir19, readFile as readFile18, stat as stat7, writeFile as writeFile19 } from "fs/promises";
|
|
15826
|
-
import { dirname as
|
|
15961
|
+
import { dirname as dirname23, join as join56 } from "path";
|
|
15827
15962
|
var FLAG_FILE = "mcp-log.flag";
|
|
15828
15963
|
var LOG_FILE = "mcp-log.jsonl.enc";
|
|
15829
15964
|
var KEY_FILE = "mcp-log.key";
|
|
@@ -15838,7 +15973,7 @@ function logPath() {
|
|
|
15838
15973
|
}
|
|
15839
15974
|
async function writeFlag(flag) {
|
|
15840
15975
|
const path = flagPath();
|
|
15841
|
-
await mkdir19(
|
|
15976
|
+
await mkdir19(dirname23(path), { recursive: true });
|
|
15842
15977
|
await writeFile19(path, JSON.stringify(flag, null, 2), { encoding: "utf-8", mode: 384 });
|
|
15843
15978
|
}
|
|
15844
15979
|
async function mcpLogOn() {
|
|
@@ -16103,7 +16238,7 @@ async function mcpLog(subcommand, flags = {}) {
|
|
|
16103
16238
|
import chalk15 from "chalk";
|
|
16104
16239
|
|
|
16105
16240
|
// src/lib/graph-loader.ts
|
|
16106
|
-
import { promises as
|
|
16241
|
+
import { promises as fs26 } from "fs";
|
|
16107
16242
|
import { join as join57, resolve as resolve2 } from "path";
|
|
16108
16243
|
import { gunzipSync } from "zlib";
|
|
16109
16244
|
var RELATIVE_GRAPH_PATH = "repowise-context/.meta/dependency-graph.json";
|
|
@@ -16130,14 +16265,14 @@ async function loadGraph(repoRoot = process.cwd()) {
|
|
|
16130
16265
|
let graphPath = null;
|
|
16131
16266
|
let raw = null;
|
|
16132
16267
|
try {
|
|
16133
|
-
raw = await
|
|
16268
|
+
raw = await fs26.readFile(gzPath);
|
|
16134
16269
|
graphPath = gzPath;
|
|
16135
16270
|
} catch (err) {
|
|
16136
16271
|
if (err.code !== "ENOENT") throw err;
|
|
16137
16272
|
}
|
|
16138
16273
|
if (!raw) {
|
|
16139
16274
|
try {
|
|
16140
|
-
raw = await
|
|
16275
|
+
raw = await fs26.readFile(plainPath);
|
|
16141
16276
|
graphPath = plainPath;
|
|
16142
16277
|
} catch (err) {
|
|
16143
16278
|
if (err.code === "ENOENT") {
|
|
@@ -16536,13 +16671,13 @@ function registerQueryCommand(program2) {
|
|
|
16536
16671
|
}
|
|
16537
16672
|
|
|
16538
16673
|
// src/commands/uninstall.ts
|
|
16539
|
-
import { promises as
|
|
16674
|
+
import { promises as fs30 } from "fs";
|
|
16540
16675
|
import { homedir as homedir12 } from "os";
|
|
16541
16676
|
import { join as join61 } from "path";
|
|
16542
16677
|
import chalk16 from "chalk";
|
|
16543
16678
|
|
|
16544
16679
|
// src/lib/cleanup/marker-blocks.ts
|
|
16545
|
-
import { promises as
|
|
16680
|
+
import { promises as fs27 } from "fs";
|
|
16546
16681
|
import { join as join58 } from "path";
|
|
16547
16682
|
var MARKER_START = "<!-- repowise-start -->";
|
|
16548
16683
|
var MARKER_END = "<!-- repowise-end -->";
|
|
@@ -16559,7 +16694,7 @@ var CONTEXT_FILES = [
|
|
|
16559
16694
|
async function stripMarkerBlock(filePath) {
|
|
16560
16695
|
let raw;
|
|
16561
16696
|
try {
|
|
16562
|
-
raw = await
|
|
16697
|
+
raw = await fs27.readFile(filePath, "utf-8");
|
|
16563
16698
|
} catch (err) {
|
|
16564
16699
|
if (err.code === "ENOENT")
|
|
16565
16700
|
return { path: filePath, status: "missing" };
|
|
@@ -16574,10 +16709,10 @@ async function stripMarkerBlock(filePath) {
|
|
|
16574
16709
|
const after = raw.slice(endIdx + MARKER_END.length).replace(/^\n+/, "");
|
|
16575
16710
|
const stripped = (before + (before && after ? "\n\n" : "") + after).trim();
|
|
16576
16711
|
if (stripped.length === 0) {
|
|
16577
|
-
await
|
|
16712
|
+
await fs27.unlink(filePath);
|
|
16578
16713
|
return { path: filePath, status: "deleted" };
|
|
16579
16714
|
}
|
|
16580
|
-
await
|
|
16715
|
+
await fs27.writeFile(filePath, stripped + "\n", "utf-8");
|
|
16581
16716
|
return { path: filePath, status: "stripped" };
|
|
16582
16717
|
}
|
|
16583
16718
|
async function stripAllMarkerBlocks(repoRoot) {
|
|
@@ -16595,7 +16730,7 @@ async function stripAllMarkerBlocks(repoRoot) {
|
|
|
16595
16730
|
}
|
|
16596
16731
|
|
|
16597
16732
|
// src/lib/cleanup/mcp-configs.ts
|
|
16598
|
-
import { promises as
|
|
16733
|
+
import { promises as fs28 } from "fs";
|
|
16599
16734
|
import { join as join59 } from "path";
|
|
16600
16735
|
function mcpConfigPaths(repoRoot, home) {
|
|
16601
16736
|
return [
|
|
@@ -16613,7 +16748,7 @@ function mcpConfigPaths(repoRoot, home) {
|
|
|
16613
16748
|
async function removeRepowiseFromConfig(path, serverName) {
|
|
16614
16749
|
let raw;
|
|
16615
16750
|
try {
|
|
16616
|
-
raw = await
|
|
16751
|
+
raw = await fs28.readFile(path, "utf-8");
|
|
16617
16752
|
} catch (err) {
|
|
16618
16753
|
if (err.code === "ENOENT") return { path, status: "not-found" };
|
|
16619
16754
|
return { path, status: "error", error: err.message };
|
|
@@ -16633,7 +16768,7 @@ async function removeRepowiseFromConfig(path, serverName) {
|
|
|
16633
16768
|
} else {
|
|
16634
16769
|
next.mcpServers = servers;
|
|
16635
16770
|
}
|
|
16636
|
-
await
|
|
16771
|
+
await fs28.writeFile(path, JSON.stringify(next, null, 2) + "\n", "utf-8");
|
|
16637
16772
|
return { path, status: "removed" };
|
|
16638
16773
|
}
|
|
16639
16774
|
async function removeAllMcpEntries(repoRoot, home, repoId) {
|
|
@@ -16646,7 +16781,7 @@ async function removeAllMcpEntries(repoRoot, home, repoId) {
|
|
|
16646
16781
|
}
|
|
16647
16782
|
|
|
16648
16783
|
// src/lib/cleanup/local-state.ts
|
|
16649
|
-
import { promises as
|
|
16784
|
+
import { promises as fs29 } from "fs";
|
|
16650
16785
|
import { homedir as homedir11 } from "os";
|
|
16651
16786
|
import { join as join60, resolve as resolve3 } from "path";
|
|
16652
16787
|
async function clearLocalState(homeOverride) {
|
|
@@ -16656,7 +16791,7 @@ async function clearLocalState(homeOverride) {
|
|
|
16656
16791
|
return { path: target, status: "error", error: "refused: not under home" };
|
|
16657
16792
|
}
|
|
16658
16793
|
try {
|
|
16659
|
-
await
|
|
16794
|
+
await fs29.rm(target, { recursive: true, force: false });
|
|
16660
16795
|
return { path: target, status: "removed" };
|
|
16661
16796
|
} catch (err) {
|
|
16662
16797
|
if (err.code === "ENOENT")
|
|
@@ -16695,7 +16830,7 @@ async function uninstall2(opts = {}) {
|
|
|
16695
16830
|
else if (svc.error) report.skipped.push({ path: "listener service", reason: svc.error });
|
|
16696
16831
|
if (tier === "stop") return report;
|
|
16697
16832
|
try {
|
|
16698
|
-
await
|
|
16833
|
+
await fs30.unlink(join61(home, ".repowise", "credentials.json"));
|
|
16699
16834
|
report.removed.push("credentials");
|
|
16700
16835
|
} catch (err) {
|
|
16701
16836
|
if (err.code !== "ENOENT") {
|
|
@@ -16722,7 +16857,7 @@ async function uninstall2(opts = {}) {
|
|
|
16722
16857
|
const allPaths = mcpConfigPaths(repoRoot, home);
|
|
16723
16858
|
for (const p of allPaths) {
|
|
16724
16859
|
try {
|
|
16725
|
-
await
|
|
16860
|
+
await fs30.access(p);
|
|
16726
16861
|
} catch {
|
|
16727
16862
|
}
|
|
16728
16863
|
}
|
|
@@ -16734,7 +16869,7 @@ async function uninstall2(opts = {}) {
|
|
|
16734
16869
|
}
|
|
16735
16870
|
async function defaultLoadRepoIds(home) {
|
|
16736
16871
|
try {
|
|
16737
|
-
const raw = await
|
|
16872
|
+
const raw = await fs30.readFile(join61(home, ".repowise", "config.json"), "utf-8");
|
|
16738
16873
|
const parsed = JSON.parse(raw);
|
|
16739
16874
|
return (parsed.repos ?? []).map((r) => r.repoId);
|
|
16740
16875
|
} catch {
|
|
@@ -16781,7 +16916,7 @@ Done \u2014 ${report.removed.length} removed, ${report.skipped.length} skipped.
|
|
|
16781
16916
|
|
|
16782
16917
|
// src/commands/mcp-shim.ts
|
|
16783
16918
|
init_config_dir();
|
|
16784
|
-
import { promises as
|
|
16919
|
+
import { promises as fs31 } from "fs";
|
|
16785
16920
|
import { createInterface as createInterface2 } from "readline";
|
|
16786
16921
|
import { join as join62 } from "path";
|
|
16787
16922
|
var DEFAULT_MAX = 200 * 1024;
|
|
@@ -16896,7 +17031,7 @@ function isConnectionError(err) {
|
|
|
16896
17031
|
}
|
|
16897
17032
|
async function readEndpoint(path) {
|
|
16898
17033
|
try {
|
|
16899
|
-
const raw = (await
|
|
17034
|
+
const raw = (await fs31.readFile(path, "utf-8")).trim();
|
|
16900
17035
|
if (!raw) return null;
|
|
16901
17036
|
if (raw.startsWith("http://") || raw.startsWith("https://")) {
|
|
16902
17037
|
return { endpoint: raw.split("\n")[0].trim(), secret: null };
|
|
@@ -16917,7 +17052,7 @@ async function readEndpoint(path) {
|
|
|
16917
17052
|
async function readAuthState(credsPath) {
|
|
16918
17053
|
let raw;
|
|
16919
17054
|
try {
|
|
16920
|
-
raw = await
|
|
17055
|
+
raw = await fs31.readFile(credsPath, "utf-8");
|
|
16921
17056
|
} catch (err) {
|
|
16922
17057
|
if (err.code === "ENOENT") return "logged-out";
|
|
16923
17058
|
return "unknown";
|
|
@@ -17592,7 +17727,7 @@ async function lspOn() {
|
|
|
17592
17727
|
|
|
17593
17728
|
// bin/repowise.ts
|
|
17594
17729
|
var __filename = fileURLToPath4(import.meta.url);
|
|
17595
|
-
var __dirname =
|
|
17730
|
+
var __dirname = dirname24(__filename);
|
|
17596
17731
|
var pkg = JSON.parse(readFileSync3(join63(__dirname, "..", "..", "package.json"), "utf-8"));
|
|
17597
17732
|
var program = new Command();
|
|
17598
17733
|
program.name(getPackageName()).description("AI-optimized codebase context generator").version(pkg.version).hook("preAction", async () => {
|