@maind-dev/mcp-bridge 0.12.0 → 0.13.0
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/build/index.js +581 -57
- package/build/meta.json +1 -1
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -10,37 +10,37 @@ var __export = (target, all) => {
|
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
// src/device-id.ts
|
|
13
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync, chmodSync } from "node:fs";
|
|
13
|
+
import { existsSync, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, chmodSync } from "node:fs";
|
|
14
14
|
import { homedir, hostname, platform, release } from "node:os";
|
|
15
15
|
import { randomUUID } from "node:crypto";
|
|
16
|
-
import { join } from "node:path";
|
|
16
|
+
import { join as join2 } from "node:path";
|
|
17
17
|
function configDir() {
|
|
18
18
|
const home = homedir();
|
|
19
19
|
const env = process.env;
|
|
20
20
|
if (platform() === "darwin") {
|
|
21
|
-
return
|
|
21
|
+
return join2(home, "Library", "Application Support", "maind");
|
|
22
22
|
}
|
|
23
23
|
if (platform() === "win32") {
|
|
24
|
-
const appdata = env.APPDATA && env.APPDATA.length > 0 ? env.APPDATA :
|
|
25
|
-
return
|
|
24
|
+
const appdata = env.APPDATA && env.APPDATA.length > 0 ? env.APPDATA : join2(home, "AppData", "Roaming");
|
|
25
|
+
return join2(appdata, "maind");
|
|
26
26
|
}
|
|
27
|
-
const xdg = env.XDG_CONFIG_HOME && env.XDG_CONFIG_HOME.length > 0 ? env.XDG_CONFIG_HOME :
|
|
28
|
-
return
|
|
27
|
+
const xdg = env.XDG_CONFIG_HOME && env.XDG_CONFIG_HOME.length > 0 ? env.XDG_CONFIG_HOME : join2(home, ".config");
|
|
28
|
+
return join2(xdg, "maind");
|
|
29
29
|
}
|
|
30
30
|
function ensureDir(path6) {
|
|
31
31
|
if (existsSync(path6)) return;
|
|
32
|
-
|
|
32
|
+
mkdirSync2(path6, { recursive: true, mode: 448 });
|
|
33
33
|
}
|
|
34
34
|
function ensureDeviceId() {
|
|
35
35
|
const dir = configDir();
|
|
36
36
|
ensureDir(dir);
|
|
37
|
-
const file =
|
|
37
|
+
const file = join2(dir, DEVICE_ID_FILE);
|
|
38
38
|
if (existsSync(file)) {
|
|
39
|
-
const stored =
|
|
39
|
+
const stored = readFileSync2(file, "utf8").trim();
|
|
40
40
|
if (isUuid(stored)) return stored;
|
|
41
41
|
}
|
|
42
42
|
const id = randomUUID();
|
|
43
|
-
|
|
43
|
+
writeFileSync2(file, id + "\n", { encoding: "utf8", mode: 384 });
|
|
44
44
|
try {
|
|
45
45
|
chmodSync(file, 384);
|
|
46
46
|
} catch {
|
|
@@ -51,13 +51,13 @@ function isUuid(s) {
|
|
|
51
51
|
return UUID_RE.test(s);
|
|
52
52
|
}
|
|
53
53
|
function apiKeyPath() {
|
|
54
|
-
return
|
|
54
|
+
return join2(configDir(), API_KEY_FILE);
|
|
55
55
|
}
|
|
56
56
|
function writeApiKey(key) {
|
|
57
57
|
const dir = configDir();
|
|
58
58
|
ensureDir(dir);
|
|
59
59
|
const file = apiKeyPath();
|
|
60
|
-
|
|
60
|
+
writeFileSync2(file, key + "\n", { encoding: "utf8", mode: 384 });
|
|
61
61
|
try {
|
|
62
62
|
chmodSync(file, 384);
|
|
63
63
|
} catch {
|
|
@@ -66,13 +66,13 @@ function writeApiKey(key) {
|
|
|
66
66
|
function readApiKey() {
|
|
67
67
|
const file = apiKeyPath();
|
|
68
68
|
if (!existsSync(file)) return null;
|
|
69
|
-
const raw =
|
|
69
|
+
const raw = readFileSync2(file, "utf8").trim();
|
|
70
70
|
return raw.length > 0 ? raw : null;
|
|
71
71
|
}
|
|
72
72
|
function clearApiKey() {
|
|
73
73
|
const file = apiKeyPath();
|
|
74
74
|
if (!existsSync(file)) return;
|
|
75
|
-
|
|
75
|
+
writeFileSync2(file, "", { encoding: "utf8", mode: 384 });
|
|
76
76
|
}
|
|
77
77
|
function clientMeta(version) {
|
|
78
78
|
return {
|
|
@@ -97,7 +97,7 @@ var BRIDGE_VERSION;
|
|
|
97
97
|
var init_version = __esm({
|
|
98
98
|
"src/version.ts"() {
|
|
99
99
|
"use strict";
|
|
100
|
-
BRIDGE_VERSION = "0.
|
|
100
|
+
BRIDGE_VERSION = "0.13.0";
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
103
|
|
|
@@ -150,7 +150,7 @@ var init_effort = __esm({
|
|
|
150
150
|
});
|
|
151
151
|
|
|
152
152
|
// ../../packages/claude-code-telemetry/dist/session-analysis.js
|
|
153
|
-
import { createReadStream, existsSync as
|
|
153
|
+
import { createReadStream, existsSync as existsSync3 } from "node:fs";
|
|
154
154
|
import { createInterface as createInterface4 } from "node:readline";
|
|
155
155
|
function num2(v) {
|
|
156
156
|
return typeof v === "number" && Number.isFinite(v) ? v : 0;
|
|
@@ -228,7 +228,7 @@ function emptyAnalysis(sessionId) {
|
|
|
228
228
|
}
|
|
229
229
|
async function analyzeSession(path6) {
|
|
230
230
|
const a = emptyAnalysis("");
|
|
231
|
-
if (!path6 || !
|
|
231
|
+
if (!path6 || !existsSync3(path6))
|
|
232
232
|
return a;
|
|
233
233
|
const reactions = [];
|
|
234
234
|
let effort = null;
|
|
@@ -400,13 +400,13 @@ var init_windows = __esm({
|
|
|
400
400
|
|
|
401
401
|
// ../../packages/claude-code-telemetry/dist/projects.js
|
|
402
402
|
import { homedir as homedir3 } from "node:os";
|
|
403
|
-
import { join as
|
|
403
|
+
import { join as join11 } from "node:path";
|
|
404
404
|
var HOME, DEFAULT_PROJECTS_DIR;
|
|
405
405
|
var init_projects = __esm({
|
|
406
406
|
"../../packages/claude-code-telemetry/dist/projects.js"() {
|
|
407
407
|
"use strict";
|
|
408
408
|
HOME = homedir3();
|
|
409
|
-
DEFAULT_PROJECTS_DIR =
|
|
409
|
+
DEFAULT_PROJECTS_DIR = join11(HOME, ".claude", "projects");
|
|
410
410
|
}
|
|
411
411
|
});
|
|
412
412
|
|
|
@@ -577,6 +577,98 @@ function isRecord(v) {
|
|
|
577
577
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
578
578
|
}
|
|
579
579
|
|
|
580
|
+
// src/conventions-cache.ts
|
|
581
|
+
import { execFileSync } from "node:child_process";
|
|
582
|
+
import { createHash } from "node:crypto";
|
|
583
|
+
import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
584
|
+
import { dirname, join } from "node:path";
|
|
585
|
+
var CACHE_VERSION = 1;
|
|
586
|
+
var CACHE_RELPATH = join(".maind", "conventions-cache.json");
|
|
587
|
+
function resolveRepoRoot(cwd = process.cwd()) {
|
|
588
|
+
try {
|
|
589
|
+
const top = execFileSync("git", ["rev-parse", "--show-toplevel"], {
|
|
590
|
+
cwd,
|
|
591
|
+
encoding: "utf8",
|
|
592
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
593
|
+
timeout: 5e3
|
|
594
|
+
}).trim();
|
|
595
|
+
return top.length > 0 ? top : cwd;
|
|
596
|
+
} catch {
|
|
597
|
+
return cwd;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
function keyFingerprint(apiKey) {
|
|
601
|
+
return createHash("sha256").update(apiKey).digest("hex").slice(0, 16);
|
|
602
|
+
}
|
|
603
|
+
function cachePath(root) {
|
|
604
|
+
return join(root, CACHE_RELPATH);
|
|
605
|
+
}
|
|
606
|
+
function hasInstructions(result) {
|
|
607
|
+
return !!result && typeof result.instructions === "string" && result.instructions.trim().length > 0;
|
|
608
|
+
}
|
|
609
|
+
function writeConventionsCache(root, identity, result, nowIso = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
610
|
+
try {
|
|
611
|
+
if (!hasInstructions(result)) return;
|
|
612
|
+
const payload = {
|
|
613
|
+
version: CACHE_VERSION,
|
|
614
|
+
cached_at: nowIso,
|
|
615
|
+
mcp_url: identity.mcpUrl,
|
|
616
|
+
key_fp: identity.keyFp,
|
|
617
|
+
result
|
|
618
|
+
};
|
|
619
|
+
const target = cachePath(root);
|
|
620
|
+
mkdirSync(dirname(target), { recursive: true });
|
|
621
|
+
const tmp = `${target}.${process.pid}.tmp`;
|
|
622
|
+
writeFileSync(tmp, JSON.stringify(payload, null, 2), "utf8");
|
|
623
|
+
renameSync(tmp, target);
|
|
624
|
+
} catch {
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
function readConventionsCache(root, identity) {
|
|
628
|
+
try {
|
|
629
|
+
const raw = readFileSync(cachePath(root), "utf8");
|
|
630
|
+
const parsed = JSON.parse(raw);
|
|
631
|
+
if (parsed.version !== CACHE_VERSION || parsed.mcp_url !== identity.mcpUrl || parsed.key_fp !== identity.keyFp || typeof parsed.cached_at !== "string" || !hasInstructions(parsed.result)) {
|
|
632
|
+
return null;
|
|
633
|
+
}
|
|
634
|
+
return {
|
|
635
|
+
version: CACHE_VERSION,
|
|
636
|
+
cached_at: parsed.cached_at,
|
|
637
|
+
mcp_url: parsed.mcp_url,
|
|
638
|
+
key_fp: parsed.key_fp,
|
|
639
|
+
result: parsed.result
|
|
640
|
+
};
|
|
641
|
+
} catch {
|
|
642
|
+
return null;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
function buildCachedInitializeResponse(id, cache, now = /* @__PURE__ */ new Date()) {
|
|
646
|
+
const marker = fallbackMarker(cache.cached_at, now);
|
|
647
|
+
const original = cache.result.instructions ?? "";
|
|
648
|
+
const result = {
|
|
649
|
+
...cache.result,
|
|
650
|
+
instructions: `${marker}
|
|
651
|
+
|
|
652
|
+
${original}`
|
|
653
|
+
};
|
|
654
|
+
return JSON.stringify({ jsonrpc: "2.0", id, result });
|
|
655
|
+
}
|
|
656
|
+
function fallbackMarker(cachedAt, now) {
|
|
657
|
+
return `NOTE (maind cache fallback): the maind MCP server was unreachable, so these project conventions were served from a local snapshot taken ${relativeAge(cachedAt, now)}. They may be stale, and maind tools are unavailable until the server is reachable again.`;
|
|
658
|
+
}
|
|
659
|
+
function relativeAge(cachedAt, now) {
|
|
660
|
+
const then = Date.parse(cachedAt);
|
|
661
|
+
if (Number.isNaN(then)) return "at an unknown time";
|
|
662
|
+
const ms = now.getTime() - then;
|
|
663
|
+
const mins = Math.floor(ms / 6e4);
|
|
664
|
+
if (mins < 1) return "just now";
|
|
665
|
+
if (mins < 60) return `${mins} minute${mins === 1 ? "" : "s"} ago`;
|
|
666
|
+
const hours = Math.floor(mins / 60);
|
|
667
|
+
if (hours < 24) return `${hours} hour${hours === 1 ? "" : "s"} ago`;
|
|
668
|
+
const days = Math.floor(hours / 24);
|
|
669
|
+
return `${days} day${days === 1 ? "" : "s"} ago`;
|
|
670
|
+
}
|
|
671
|
+
|
|
580
672
|
// src/forward.ts
|
|
581
673
|
var DEFAULT_MCP_URL = "https://mcp.maind.dev/mcp";
|
|
582
674
|
var BridgeReauthNeeded = class extends Error {
|
|
@@ -620,8 +712,20 @@ var Forwarder = class {
|
|
|
620
712
|
initFrame = null;
|
|
621
713
|
/** Set true once an unrecoverable auth condition is detected. */
|
|
622
714
|
terminated = false;
|
|
715
|
+
/**
|
|
716
|
+
* sha256 fingerprint of the api-key. Binds the conventions cache to this
|
|
717
|
+
* identity so a snapshot taken under a different key is never served (A5).
|
|
718
|
+
*/
|
|
719
|
+
keyFp;
|
|
720
|
+
/**
|
|
721
|
+
* Memoized repo root for `<root>/.maind/conventions-cache.json`. Resolved
|
|
722
|
+
* lazily on the first cache read/write (i.e. on initialize) so a plain
|
|
723
|
+
* session that never reaches that path pays no git subprocess at startup.
|
|
724
|
+
*/
|
|
725
|
+
repoRoot = null;
|
|
623
726
|
constructor(cfg) {
|
|
624
727
|
this.apiKey = cfg.apiKey;
|
|
728
|
+
this.keyFp = keyFingerprint(cfg.apiKey);
|
|
625
729
|
this.deviceId = cfg.deviceId;
|
|
626
730
|
this.bridgeVersion = cfg.bridgeVersion;
|
|
627
731
|
const rawFamily = cfg.clientFamily ?? process.env.MAIND_CLIENT_FAMILY ?? null;
|
|
@@ -683,6 +787,7 @@ var Forwarder = class {
|
|
|
683
787
|
});
|
|
684
788
|
} catch (err) {
|
|
685
789
|
const id = tryExtractId(frame);
|
|
790
|
+
if (this.serveInitializeFromCache(frame, id)) return;
|
|
686
791
|
emitJsonRpcError(id, -32603, `bridge network error: ${stringifyErr(err)}`);
|
|
687
792
|
return;
|
|
688
793
|
}
|
|
@@ -711,6 +816,7 @@ var Forwarder = class {
|
|
|
711
816
|
if (!response.ok) {
|
|
712
817
|
const id = tryExtractId(frame);
|
|
713
818
|
const body = await response.text().catch(() => "");
|
|
819
|
+
if (this.serveInitializeFromCache(frame, id)) return;
|
|
714
820
|
emitJsonRpcError(
|
|
715
821
|
id,
|
|
716
822
|
-32603,
|
|
@@ -727,6 +833,14 @@ var Forwarder = class {
|
|
|
727
833
|
}
|
|
728
834
|
return;
|
|
729
835
|
}
|
|
836
|
+
if (isInitializeRequest(frame)) {
|
|
837
|
+
const body = contentType.startsWith("text/event-stream") ? await collectSseText(response) : await response.text();
|
|
838
|
+
this.cacheInitializeResult(body);
|
|
839
|
+
if (body.trim().length > 0) {
|
|
840
|
+
process.stdout.write(body + "\n");
|
|
841
|
+
}
|
|
842
|
+
return;
|
|
843
|
+
}
|
|
730
844
|
if (contentType.startsWith("text/event-stream")) {
|
|
731
845
|
await pipeSseToStdout(response);
|
|
732
846
|
} else if (response.status === 202) {
|
|
@@ -823,6 +937,53 @@ var Forwarder = class {
|
|
|
823
937
|
}
|
|
824
938
|
return true;
|
|
825
939
|
}
|
|
940
|
+
/**
|
|
941
|
+
* Repo root for the conventions cache, memoized. The first call resolves it
|
|
942
|
+
* via `git rev-parse` (once per session, on initialize) — plain sessions that
|
|
943
|
+
* never hit the cache path pay nothing at startup.
|
|
944
|
+
*/
|
|
945
|
+
getRepoRoot() {
|
|
946
|
+
if (this.repoRoot === null) this.repoRoot = resolveRepoRoot();
|
|
947
|
+
return this.repoRoot;
|
|
948
|
+
}
|
|
949
|
+
/**
|
|
950
|
+
* Snapshot a successful initialize response's conventions block to the local
|
|
951
|
+
* cache. Fully isolated and best-effort — any parse/IO failure is swallowed
|
|
952
|
+
* so caching never disturbs a live session (mirrors augmentToolsList).
|
|
953
|
+
*/
|
|
954
|
+
cacheInitializeResult(body) {
|
|
955
|
+
try {
|
|
956
|
+
const msg = JSON.parse(body);
|
|
957
|
+
if (msg && msg.result) {
|
|
958
|
+
writeConventionsCache(
|
|
959
|
+
this.getRepoRoot(),
|
|
960
|
+
{ mcpUrl: this.mcpUrl, keyFp: this.keyFp },
|
|
961
|
+
msg.result
|
|
962
|
+
);
|
|
963
|
+
}
|
|
964
|
+
} catch {
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
/**
|
|
968
|
+
* On an initialize that couldn't reach the server, serve the last-good
|
|
969
|
+
* conventions block from the local cache instead of a hard error, so the
|
|
970
|
+
* enforcement surface survives an outage (A5). Returns true iff it emitted a
|
|
971
|
+
* cached response. Non-initialize frames and a missing/mismatched cache
|
|
972
|
+
* return false — the caller then emits its normal JSON-RPC error.
|
|
973
|
+
*/
|
|
974
|
+
serveInitializeFromCache(frame, id) {
|
|
975
|
+
if (!isInitializeRequest(frame)) return false;
|
|
976
|
+
const cache = readConventionsCache(this.getRepoRoot(), {
|
|
977
|
+
mcpUrl: this.mcpUrl,
|
|
978
|
+
keyFp: this.keyFp
|
|
979
|
+
});
|
|
980
|
+
if (cache === null) return false;
|
|
981
|
+
process.stdout.write(buildCachedInitializeResponse(id, cache) + "\n");
|
|
982
|
+
console.error(
|
|
983
|
+
`[maind-bridge] MCP server unreachable \u2014 served cached conventions from ${cachePath(this.getRepoRoot())} (snapshot ${cache.cached_at})`
|
|
984
|
+
);
|
|
985
|
+
return true;
|
|
986
|
+
}
|
|
826
987
|
};
|
|
827
988
|
function normalizeClientFamily(raw) {
|
|
828
989
|
if (raw === null) return null;
|
|
@@ -1107,10 +1268,10 @@ async function openExternalBrowser(url) {
|
|
|
1107
1268
|
init_version();
|
|
1108
1269
|
|
|
1109
1270
|
// src/project-key.ts
|
|
1110
|
-
import { execFileSync } from "node:child_process";
|
|
1111
|
-
import { createHash } from "node:crypto";
|
|
1271
|
+
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
1272
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
1112
1273
|
function sha256Hex(input) {
|
|
1113
|
-
return
|
|
1274
|
+
return createHash2("sha256").update(input).digest("hex");
|
|
1114
1275
|
}
|
|
1115
1276
|
function normalizeRemoteUrl(raw) {
|
|
1116
1277
|
let s = raw.trim();
|
|
@@ -1138,7 +1299,7 @@ function computeProjectKey() {
|
|
|
1138
1299
|
if (override && PROJECT_KEY_RE.test(override)) return override;
|
|
1139
1300
|
let remote;
|
|
1140
1301
|
try {
|
|
1141
|
-
remote =
|
|
1302
|
+
remote = execFileSync2("git", ["config", "--get", "remote.origin.url"], {
|
|
1142
1303
|
encoding: "utf8",
|
|
1143
1304
|
stdio: ["ignore", "pipe", "ignore"],
|
|
1144
1305
|
timeout: 5e3
|
|
@@ -3163,14 +3324,14 @@ Finished in ${wallClockSec}s. Restart your MCP client so it picks up the new ser
|
|
|
3163
3324
|
}
|
|
3164
3325
|
|
|
3165
3326
|
// src/local-tools/engine.ts
|
|
3166
|
-
import { execFileSync as
|
|
3327
|
+
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
3167
3328
|
|
|
3168
3329
|
// ../../packages/code-index/build/node.js
|
|
3169
|
-
import { mkdirSync as
|
|
3170
|
-
import { posix as
|
|
3330
|
+
import { mkdirSync as mkdirSync3 } from "node:fs";
|
|
3331
|
+
import { posix as posix5 } from "node:path";
|
|
3171
3332
|
|
|
3172
3333
|
// ../../packages/code-index/build/parse/tree-sitter/parser.js
|
|
3173
|
-
import { join as
|
|
3334
|
+
import { join as join9 } from "node:path";
|
|
3174
3335
|
import Parser from "web-tree-sitter";
|
|
3175
3336
|
|
|
3176
3337
|
// ../../packages/code-index/build/parse/keys.js
|
|
@@ -3492,7 +3653,7 @@ function stripQuotes(s) {
|
|
|
3492
3653
|
|
|
3493
3654
|
// ../../packages/code-index/build/parse/tree-sitter/grammars.js
|
|
3494
3655
|
import { createRequire } from "node:module";
|
|
3495
|
-
import { join as
|
|
3656
|
+
import { join as join8 } from "node:path";
|
|
3496
3657
|
var GRAMMAR_FILE = {
|
|
3497
3658
|
typescript: "tree-sitter-typescript.wasm",
|
|
3498
3659
|
tsx: "tree-sitter-tsx.wasm",
|
|
@@ -3502,7 +3663,7 @@ var GRAMMAR_FILE = {
|
|
|
3502
3663
|
var CORE_WASM_FILE = "tree-sitter.wasm";
|
|
3503
3664
|
function grammarPath(language, assetDir) {
|
|
3504
3665
|
if (assetDir)
|
|
3505
|
-
return
|
|
3666
|
+
return join8(assetDir, GRAMMAR_FILE[language]);
|
|
3506
3667
|
return createRequire(import.meta.url).resolve(`tree-sitter-wasms/out/${GRAMMAR_FILE[language]}`);
|
|
3507
3668
|
}
|
|
3508
3669
|
|
|
@@ -3519,7 +3680,7 @@ var TreeSitterParser = class {
|
|
|
3519
3680
|
async init() {
|
|
3520
3681
|
if (this.initialized)
|
|
3521
3682
|
return;
|
|
3522
|
-
await Parser.init(this.assetDir ? { locateFile: (file) =>
|
|
3683
|
+
await Parser.init(this.assetDir ? { locateFile: (file) => join9(this.assetDir, file || CORE_WASM_FILE) } : void 0);
|
|
3523
3684
|
this.parser = new Parser();
|
|
3524
3685
|
this.initialized = true;
|
|
3525
3686
|
}
|
|
@@ -3574,8 +3735,8 @@ var TreeSitterParser = class {
|
|
|
3574
3735
|
};
|
|
3575
3736
|
|
|
3576
3737
|
// ../../packages/code-index/build/query/engine.js
|
|
3577
|
-
import { readFileSync as
|
|
3578
|
-
import { posix as
|
|
3738
|
+
import { readFileSync as readFileSync4 } from "node:fs";
|
|
3739
|
+
import { posix as posix4 } from "node:path";
|
|
3579
3740
|
|
|
3580
3741
|
// ../../packages/code-index/build/embed/recipe.js
|
|
3581
3742
|
var MAX_CHARS = 1e3;
|
|
@@ -3696,8 +3857,8 @@ function resolveImportTarget(fromFile, specifier, files) {
|
|
|
3696
3857
|
}
|
|
3697
3858
|
|
|
3698
3859
|
// ../../packages/code-index/build/incremental/discover.js
|
|
3699
|
-
import { execFileSync as
|
|
3700
|
-
import { createHash as
|
|
3860
|
+
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
3861
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
3701
3862
|
import { readdirSync, statSync } from "node:fs";
|
|
3702
3863
|
import { posix as posix2, sep } from "node:path";
|
|
3703
3864
|
var IGNORE_DIRS = /* @__PURE__ */ new Set([
|
|
@@ -3717,7 +3878,7 @@ var IGNORE_DIRS = /* @__PURE__ */ new Set([
|
|
|
3717
3878
|
var GIT_CONFIG_PIN = ["-c", "diff.renames=true", "-c", "core.quotePath=false"];
|
|
3718
3879
|
function runGit(repoRoot, args) {
|
|
3719
3880
|
try {
|
|
3720
|
-
return
|
|
3881
|
+
return execFileSync3("git", [...GIT_CONFIG_PIN, ...args], {
|
|
3721
3882
|
cwd: repoRoot,
|
|
3722
3883
|
encoding: "utf8",
|
|
3723
3884
|
stdio: ["ignore", "pipe", "ignore"],
|
|
@@ -3855,7 +4016,7 @@ function statFile(repoRoot, relPath) {
|
|
|
3855
4016
|
}
|
|
3856
4017
|
}
|
|
3857
4018
|
function hashContent(content) {
|
|
3858
|
-
return
|
|
4019
|
+
return createHash3("sha256").update(content).digest("hex");
|
|
3859
4020
|
}
|
|
3860
4021
|
function headCommit(repoRoot) {
|
|
3861
4022
|
return git(repoRoot, ["rev-parse", "HEAD"])?.trim() ?? null;
|
|
@@ -4124,6 +4285,332 @@ function readFileHistory(repoRoot, paths, opts = {}) {
|
|
|
4124
4285
|
};
|
|
4125
4286
|
}
|
|
4126
4287
|
|
|
4288
|
+
// ../../packages/code-index/build/repo-health/divergence.js
|
|
4289
|
+
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
4290
|
+
import { existsSync as existsSync2, readFileSync as readFileSync3 } from "node:fs";
|
|
4291
|
+
import { posix as posix3 } from "node:path";
|
|
4292
|
+
var DEFAULT_WORKTREE_PROBE_PATHS = [
|
|
4293
|
+
"supabase/config.toml",
|
|
4294
|
+
"supabase/.temp",
|
|
4295
|
+
".env"
|
|
4296
|
+
];
|
|
4297
|
+
var WORKTREE_REQUIREMENTS_RELPATH = ".maind/worktree-requirements";
|
|
4298
|
+
function computeDivergence(facts) {
|
|
4299
|
+
const out = [];
|
|
4300
|
+
if (!facts.isRepo)
|
|
4301
|
+
return out;
|
|
4302
|
+
const onFeatureBranch = facts.branch != null && facts.defaultBranch != null && facts.branch !== facts.defaultBranch && !facts.detachedHead;
|
|
4303
|
+
if (facts.detachedHead) {
|
|
4304
|
+
out.push({
|
|
4305
|
+
id: "worktree.detached-head",
|
|
4306
|
+
status: "warn",
|
|
4307
|
+
scope: "worktree",
|
|
4308
|
+
title: "Detached HEAD",
|
|
4309
|
+
detail: "HEAD points at a commit, not a branch \u2014 commits here are easily lost.",
|
|
4310
|
+
hint: "git switch -c <branch> to keep this work, or checkout an existing branch."
|
|
4311
|
+
});
|
|
4312
|
+
}
|
|
4313
|
+
if (onFeatureBranch) {
|
|
4314
|
+
if (facts.upstream == null) {
|
|
4315
|
+
out.push({
|
|
4316
|
+
id: "branch.no-upstream",
|
|
4317
|
+
status: "open",
|
|
4318
|
+
scope: "branch",
|
|
4319
|
+
title: "No upstream set",
|
|
4320
|
+
detail: `'${facts.branch}' tracks nothing \u2014 a plain 'git push' goes nowhere or to the wrong ref, with no error.`,
|
|
4321
|
+
hint: `git push -u origin ${facts.branch}`
|
|
4322
|
+
});
|
|
4323
|
+
} else {
|
|
4324
|
+
const upstreamBranch = facts.upstream.split("/").slice(1).join("/");
|
|
4325
|
+
if (upstreamBranch && upstreamBranch !== facts.branch) {
|
|
4326
|
+
out.push({
|
|
4327
|
+
id: "branch.upstream-mismatch",
|
|
4328
|
+
status: "open",
|
|
4329
|
+
scope: "branch",
|
|
4330
|
+
title: "Upstream points at a different branch",
|
|
4331
|
+
detail: `'${facts.branch}' tracks '${facts.upstream}' \u2014 pushes land on the wrong remote branch silently.`,
|
|
4332
|
+
hint: `git branch --set-upstream-to=origin/${facts.branch} (then push -u)`
|
|
4333
|
+
});
|
|
4334
|
+
}
|
|
4335
|
+
if (facts.remoteTrackingExists === false) {
|
|
4336
|
+
out.push({
|
|
4337
|
+
id: "branch.unpushed-missing-remote",
|
|
4338
|
+
status: "open",
|
|
4339
|
+
scope: "branch",
|
|
4340
|
+
title: "Branch not on remote",
|
|
4341
|
+
detail: `'${facts.branch}' has an upstream configured but no matching remote-tracking ref \u2014 the branch was never pushed.`,
|
|
4342
|
+
hint: `git push -u origin ${facts.branch}`
|
|
4343
|
+
});
|
|
4344
|
+
}
|
|
4345
|
+
}
|
|
4346
|
+
}
|
|
4347
|
+
const behind = facts.behind ?? 0;
|
|
4348
|
+
const ahead = facts.ahead ?? 0;
|
|
4349
|
+
if (behind > 0) {
|
|
4350
|
+
out.push({
|
|
4351
|
+
id: "branch.behind",
|
|
4352
|
+
status: "info",
|
|
4353
|
+
scope: "branch",
|
|
4354
|
+
title: "Behind base",
|
|
4355
|
+
detail: `${behind} commit(s) behind origin/${facts.defaultBranch}${ahead > 0 ? ` (and ${ahead} ahead)` : ""} \u2014 rebase/merge base before merging to avoid a stale PR.`,
|
|
4356
|
+
hint: `git fetch && git rebase origin/${facts.defaultBranch}`
|
|
4357
|
+
});
|
|
4358
|
+
}
|
|
4359
|
+
if (facts.upstream != null && facts.headMatchesUpstream === false) {
|
|
4360
|
+
out.push({
|
|
4361
|
+
id: "branch.unpushed-commits",
|
|
4362
|
+
status: "warn",
|
|
4363
|
+
scope: "branch",
|
|
4364
|
+
title: "Unpushed commits",
|
|
4365
|
+
detail: `Local HEAD is ahead of ${facts.upstream} \u2014 commits exist only on this machine.`,
|
|
4366
|
+
hint: "git push"
|
|
4367
|
+
});
|
|
4368
|
+
}
|
|
4369
|
+
if (facts.isSharedMainTree && facts.otherWorktrees > 0 && facts.uncommitted > 0 && !onFeatureBranch) {
|
|
4370
|
+
out.push({
|
|
4371
|
+
id: "worktree.direct-on-shared-base",
|
|
4372
|
+
status: "warn",
|
|
4373
|
+
scope: "worktree",
|
|
4374
|
+
title: "Uncommitted work on the shared base tree",
|
|
4375
|
+
detail: `You are editing the shared '${facts.defaultBranch}' checkout while ${facts.otherWorktrees} feature worktree(s) exist \u2014 the workflow reaches base only via PR merge.`,
|
|
4376
|
+
hint: "Move the work into a feature worktree (scripts/feature.sh start <name>)."
|
|
4377
|
+
});
|
|
4378
|
+
}
|
|
4379
|
+
if (facts.inProgressOp) {
|
|
4380
|
+
out.push({
|
|
4381
|
+
id: "worktree.in-progress-op",
|
|
4382
|
+
status: "warn",
|
|
4383
|
+
scope: "worktree",
|
|
4384
|
+
title: `${facts.inProgressOp} in progress`,
|
|
4385
|
+
detail: `A ${facts.inProgressOp} is mid-flight \u2014 git operations behave unexpectedly until it is finished or aborted.`,
|
|
4386
|
+
hint: `git ${facts.inProgressOp} --continue | --abort`
|
|
4387
|
+
});
|
|
4388
|
+
}
|
|
4389
|
+
if (facts.worktreeParity && facts.worktreeParity.missing.length > 0) {
|
|
4390
|
+
const miss = facts.worktreeParity.missing;
|
|
4391
|
+
out.push({
|
|
4392
|
+
id: "worktree.parity-missing",
|
|
4393
|
+
status: "open",
|
|
4394
|
+
scope: "worktree",
|
|
4395
|
+
title: "Tooling files missing vs main checkout",
|
|
4396
|
+
detail: `${miss.join(", ")} exist in the main checkout but not here \u2014 tools (e.g. supabase) may silently target the wrong/no project and report success.`,
|
|
4397
|
+
hint: `Copy the missing file(s) from ${facts.worktreeParity.mainWorktreePath}, or declare them in ${WORKTREE_REQUIREMENTS_RELPATH}.`
|
|
4398
|
+
});
|
|
4399
|
+
}
|
|
4400
|
+
if (facts.release?.allRed) {
|
|
4401
|
+
out.push({
|
|
4402
|
+
id: "release.all-checks-red",
|
|
4403
|
+
status: "warn",
|
|
4404
|
+
scope: "release",
|
|
4405
|
+
title: "All checks failing \u2014 suspect account/billing/quota",
|
|
4406
|
+
detail: `All ${facts.release.totalChecks} check(s) on the current PR failed. When every check goes red at once, the hypothesis is account/billing/quota, not your code (e.g. Actions spending-limit blocks the whole repo, including publisher jobs).`,
|
|
4407
|
+
hint: "Check the CI provider's billing/spending status before debugging code."
|
|
4408
|
+
});
|
|
4409
|
+
}
|
|
4410
|
+
return sortFindings(out);
|
|
4411
|
+
}
|
|
4412
|
+
var STATUS_ORDER = { open: 0, warn: 1, info: 2, passed: 3 };
|
|
4413
|
+
function sortFindings(f) {
|
|
4414
|
+
return [...f].sort((a, b) => STATUS_ORDER[a.status] - STATUS_ORDER[b.status] || a.id.localeCompare(b.id));
|
|
4415
|
+
}
|
|
4416
|
+
function isHealthy(findings) {
|
|
4417
|
+
return !findings.some((x) => x.status === "open" || x.status === "warn");
|
|
4418
|
+
}
|
|
4419
|
+
function trimOrNull(s) {
|
|
4420
|
+
const t = s?.trim();
|
|
4421
|
+
return t ? t : null;
|
|
4422
|
+
}
|
|
4423
|
+
function resolveDefaultBranch(repoRoot) {
|
|
4424
|
+
const sym = trimOrNull(runGit(repoRoot, ["symbolic-ref", "--quiet", "refs/remotes/origin/HEAD"]));
|
|
4425
|
+
if (sym) {
|
|
4426
|
+
const m = /refs\/remotes\/origin\/(.+)$/.exec(sym);
|
|
4427
|
+
if (m)
|
|
4428
|
+
return m[1];
|
|
4429
|
+
}
|
|
4430
|
+
for (const cand of ["main", "master"]) {
|
|
4431
|
+
if (runGit(repoRoot, ["rev-parse", "--verify", "--quiet", `origin/${cand}`]) !== null)
|
|
4432
|
+
return cand;
|
|
4433
|
+
}
|
|
4434
|
+
return null;
|
|
4435
|
+
}
|
|
4436
|
+
function detectInProgressOp(repoRoot) {
|
|
4437
|
+
const gitDir = trimOrNull(runGit(repoRoot, ["rev-parse", "--git-dir"]));
|
|
4438
|
+
if (!gitDir)
|
|
4439
|
+
return null;
|
|
4440
|
+
const base = posix3.isAbsolute(gitDir) ? gitDir : posix3.join(repoRoot, gitDir);
|
|
4441
|
+
if (existsSync2(posix3.join(base, "rebase-merge")) || existsSync2(posix3.join(base, "rebase-apply"))) {
|
|
4442
|
+
return "rebase";
|
|
4443
|
+
}
|
|
4444
|
+
if (existsSync2(posix3.join(base, "MERGE_HEAD")))
|
|
4445
|
+
return "merge";
|
|
4446
|
+
if (existsSync2(posix3.join(base, "CHERRY_PICK_HEAD")))
|
|
4447
|
+
return "cherry-pick";
|
|
4448
|
+
return null;
|
|
4449
|
+
}
|
|
4450
|
+
function parseWorktrees(raw) {
|
|
4451
|
+
const out = [];
|
|
4452
|
+
let cur = null;
|
|
4453
|
+
const flush = () => {
|
|
4454
|
+
if (cur?.path)
|
|
4455
|
+
out.push({ path: cur.path, branch: cur.branch, detached: cur.detached ?? false });
|
|
4456
|
+
};
|
|
4457
|
+
for (const line of raw.split("\n")) {
|
|
4458
|
+
if (line.startsWith("worktree ")) {
|
|
4459
|
+
flush();
|
|
4460
|
+
cur = { path: line.slice("worktree ".length).trim(), detached: false };
|
|
4461
|
+
} else if (!cur) {
|
|
4462
|
+
continue;
|
|
4463
|
+
} else if (line.startsWith("branch ")) {
|
|
4464
|
+
cur.branch = line.slice("branch ".length).trim().replace(/^refs\/heads\//, "");
|
|
4465
|
+
} else if (line.trim() === "detached") {
|
|
4466
|
+
cur.detached = true;
|
|
4467
|
+
}
|
|
4468
|
+
}
|
|
4469
|
+
flush();
|
|
4470
|
+
return out;
|
|
4471
|
+
}
|
|
4472
|
+
function readWorktreeRequirements(repoRoot) {
|
|
4473
|
+
const p = posix3.join(repoRoot, WORKTREE_REQUIREMENTS_RELPATH);
|
|
4474
|
+
if (!existsSync2(p))
|
|
4475
|
+
return [];
|
|
4476
|
+
try {
|
|
4477
|
+
return readFileSync3(p, "utf8").split("\n").map((l) => l.trim()).filter((l) => l.length > 0 && !l.startsWith("#"));
|
|
4478
|
+
} catch {
|
|
4479
|
+
return [];
|
|
4480
|
+
}
|
|
4481
|
+
}
|
|
4482
|
+
async function gatherRepoHealthFacts(repoRoot, opts = {}) {
|
|
4483
|
+
const inside = trimOrNull(runGit(repoRoot, ["rev-parse", "--is-inside-work-tree"]));
|
|
4484
|
+
if (inside !== "true") {
|
|
4485
|
+
return {
|
|
4486
|
+
isRepo: false,
|
|
4487
|
+
branch: null,
|
|
4488
|
+
defaultBranch: null,
|
|
4489
|
+
upstream: null,
|
|
4490
|
+
headMatchesUpstream: null,
|
|
4491
|
+
remoteTrackingExists: null,
|
|
4492
|
+
ahead: null,
|
|
4493
|
+
behind: null,
|
|
4494
|
+
uncommitted: 0,
|
|
4495
|
+
detachedHead: false,
|
|
4496
|
+
inProgressOp: null,
|
|
4497
|
+
isSharedMainTree: false,
|
|
4498
|
+
otherWorktrees: 0,
|
|
4499
|
+
worktreeParity: null,
|
|
4500
|
+
release: null
|
|
4501
|
+
};
|
|
4502
|
+
}
|
|
4503
|
+
const branchRaw = trimOrNull(runGit(repoRoot, ["rev-parse", "--abbrev-ref", "HEAD"]));
|
|
4504
|
+
const detachedHead = branchRaw === "HEAD";
|
|
4505
|
+
const branch = detachedHead ? null : branchRaw;
|
|
4506
|
+
const defaultBranch = resolveDefaultBranch(repoRoot);
|
|
4507
|
+
const upstream = trimOrNull(runGit(repoRoot, ["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"]));
|
|
4508
|
+
let headMatchesUpstream = null;
|
|
4509
|
+
let remoteTrackingExists = null;
|
|
4510
|
+
if (upstream) {
|
|
4511
|
+
const head = trimOrNull(runGit(repoRoot, ["rev-parse", "HEAD"]));
|
|
4512
|
+
const up = trimOrNull(runGit(repoRoot, ["rev-parse", "@{u}"]));
|
|
4513
|
+
headMatchesUpstream = head != null && up != null ? head === up : null;
|
|
4514
|
+
remoteTrackingExists = runGit(repoRoot, ["rev-parse", "--verify", "--quiet", `refs/remotes/${upstream}`]) !== null;
|
|
4515
|
+
}
|
|
4516
|
+
let ahead = null;
|
|
4517
|
+
let behind = null;
|
|
4518
|
+
if (defaultBranch) {
|
|
4519
|
+
const counts = trimOrNull(runGit(repoRoot, ["rev-list", "--left-right", "--count", `origin/${defaultBranch}...HEAD`]));
|
|
4520
|
+
if (counts) {
|
|
4521
|
+
const [b, a] = counts.split(/\s+/).map((n) => Number.parseInt(n, 10));
|
|
4522
|
+
if (Number.isFinite(b))
|
|
4523
|
+
behind = b;
|
|
4524
|
+
if (Number.isFinite(a))
|
|
4525
|
+
ahead = a;
|
|
4526
|
+
}
|
|
4527
|
+
}
|
|
4528
|
+
const porcelain = runGit(repoRoot, ["status", "--porcelain"]) ?? "";
|
|
4529
|
+
const uncommitted = porcelain.split("\n").filter((l) => l.trim().length > 0).length;
|
|
4530
|
+
const inProgressOp = detectInProgressOp(repoRoot);
|
|
4531
|
+
const toplevel = trimOrNull(runGit(repoRoot, ["rev-parse", "--show-toplevel"])) ?? repoRoot;
|
|
4532
|
+
const worktrees = parseWorktrees(runGit(repoRoot, ["worktree", "list", "--porcelain"]) ?? "");
|
|
4533
|
+
const mainWorktree = worktrees[0]?.path ?? null;
|
|
4534
|
+
const isSharedMainTree = mainWorktree != null && samePath(mainWorktree, toplevel);
|
|
4535
|
+
const otherWorktrees = Math.max(0, worktrees.length - 1);
|
|
4536
|
+
let worktreeParity = null;
|
|
4537
|
+
if (mainWorktree && !samePath(mainWorktree, toplevel)) {
|
|
4538
|
+
const probes = [
|
|
4539
|
+
...DEFAULT_WORKTREE_PROBE_PATHS,
|
|
4540
|
+
...readWorktreeRequirements(toplevel),
|
|
4541
|
+
...opts.probePaths ?? []
|
|
4542
|
+
];
|
|
4543
|
+
const missing = probes.filter((rel) => existsSync2(posix3.join(mainWorktree, rel)) && !existsSync2(posix3.join(toplevel, rel)));
|
|
4544
|
+
worktreeParity = {
|
|
4545
|
+
mainWorktreePath: mainWorktree,
|
|
4546
|
+
currentWorktreePath: toplevel,
|
|
4547
|
+
missing: [...new Set(missing)]
|
|
4548
|
+
};
|
|
4549
|
+
}
|
|
4550
|
+
const release2 = opts.includeRelease === false ? null : gatherReleaseFact(repoRoot, branch);
|
|
4551
|
+
return {
|
|
4552
|
+
isRepo: true,
|
|
4553
|
+
branch,
|
|
4554
|
+
defaultBranch,
|
|
4555
|
+
upstream,
|
|
4556
|
+
headMatchesUpstream,
|
|
4557
|
+
remoteTrackingExists,
|
|
4558
|
+
ahead,
|
|
4559
|
+
behind,
|
|
4560
|
+
uncommitted,
|
|
4561
|
+
detachedHead,
|
|
4562
|
+
inProgressOp,
|
|
4563
|
+
isSharedMainTree,
|
|
4564
|
+
otherWorktrees,
|
|
4565
|
+
worktreeParity,
|
|
4566
|
+
release: release2
|
|
4567
|
+
};
|
|
4568
|
+
}
|
|
4569
|
+
function samePath(a, b) {
|
|
4570
|
+
const norm = (p) => p.replace(/\/+$/, "");
|
|
4571
|
+
return norm(a) === norm(b);
|
|
4572
|
+
}
|
|
4573
|
+
function gatherReleaseFact(repoRoot, branch) {
|
|
4574
|
+
if (!branch)
|
|
4575
|
+
return null;
|
|
4576
|
+
const raw = runGh(repoRoot, ["pr", "checks", branch, "--json", "bucket"]);
|
|
4577
|
+
if (raw == null)
|
|
4578
|
+
return null;
|
|
4579
|
+
let rows;
|
|
4580
|
+
try {
|
|
4581
|
+
rows = JSON.parse(raw);
|
|
4582
|
+
} catch {
|
|
4583
|
+
return null;
|
|
4584
|
+
}
|
|
4585
|
+
if (rows.length === 0)
|
|
4586
|
+
return { prNumber: null, totalChecks: 0, failedChecks: 0, allRed: false };
|
|
4587
|
+
const failed3 = rows.filter((r) => r.bucket === "fail").length;
|
|
4588
|
+
return {
|
|
4589
|
+
prNumber: null,
|
|
4590
|
+
totalChecks: rows.length,
|
|
4591
|
+
failedChecks: failed3,
|
|
4592
|
+
allRed: failed3 === rows.length && rows.length > 0
|
|
4593
|
+
};
|
|
4594
|
+
}
|
|
4595
|
+
function runGh(repoRoot, args) {
|
|
4596
|
+
try {
|
|
4597
|
+
return execFileSync4("gh", args, {
|
|
4598
|
+
cwd: repoRoot,
|
|
4599
|
+
encoding: "utf8",
|
|
4600
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
4601
|
+
timeout: 1e4,
|
|
4602
|
+
maxBuffer: 8 * 1024 * 1024
|
|
4603
|
+
});
|
|
4604
|
+
} catch {
|
|
4605
|
+
return null;
|
|
4606
|
+
}
|
|
4607
|
+
}
|
|
4608
|
+
async function checkDivergence(repoRoot, opts = {}) {
|
|
4609
|
+
const facts = await gatherRepoHealthFacts(repoRoot, opts);
|
|
4610
|
+
const findings = computeDivergence(facts);
|
|
4611
|
+
return { ok: isHealthy(findings), findings, facts };
|
|
4612
|
+
}
|
|
4613
|
+
|
|
4127
4614
|
// ../../packages/code-index/build/review/risk-rules.js
|
|
4128
4615
|
var RISK_RULES = [
|
|
4129
4616
|
{
|
|
@@ -4510,7 +4997,7 @@ var CodeIndexEngine = class {
|
|
|
4510
4997
|
return null;
|
|
4511
4998
|
let source = "";
|
|
4512
4999
|
try {
|
|
4513
|
-
const full =
|
|
5000
|
+
const full = readFileSync4(posix4.join(this.repoRoot, n.filePath), "utf8");
|
|
4514
5001
|
source = full.slice(n.startByte, n.endByte);
|
|
4515
5002
|
} catch {
|
|
4516
5003
|
return null;
|
|
@@ -4568,7 +5055,7 @@ var CodeIndexEngine = class {
|
|
|
4568
5055
|
async fileHistory(opts = {}) {
|
|
4569
5056
|
let paths = opts.paths ?? [];
|
|
4570
5057
|
if (paths.length === 0) {
|
|
4571
|
-
const changed = enumerateChangedPaths(this.repoRoot, {});
|
|
5058
|
+
const changed = enumerateChangedPaths(this.repoRoot, { since: opts.since });
|
|
4572
5059
|
if (changed === null) {
|
|
4573
5060
|
throw new Error("fileHistory requires a git repository (history is git-based)");
|
|
4574
5061
|
}
|
|
@@ -4578,6 +5065,9 @@ var CodeIndexEngine = class {
|
|
|
4578
5065
|
}
|
|
4579
5066
|
return readFileHistory(this.repoRoot, paths, opts);
|
|
4580
5067
|
}
|
|
5068
|
+
async checkDivergence(opts = {}) {
|
|
5069
|
+
return checkDivergence(this.repoRoot, opts);
|
|
5070
|
+
}
|
|
4581
5071
|
async reviewChanges(opts = {}) {
|
|
4582
5072
|
await this.store.init();
|
|
4583
5073
|
const rawPaths = enumerateChangedPaths(this.repoRoot, opts);
|
|
@@ -4641,7 +5131,7 @@ var CodeIndexEngine = class {
|
|
|
4641
5131
|
}
|
|
4642
5132
|
readRepoFile(relPath) {
|
|
4643
5133
|
try {
|
|
4644
|
-
return
|
|
5134
|
+
return readFileSync4(posix4.join(this.repoRoot, relPath), "utf8");
|
|
4645
5135
|
} catch {
|
|
4646
5136
|
return null;
|
|
4647
5137
|
}
|
|
@@ -4975,8 +5465,8 @@ var NodeSqliteStore = class {
|
|
|
4975
5465
|
// ../../packages/code-index/build/node.js
|
|
4976
5466
|
var DEFAULT_DB_RELPATH = ".maind/code-index.sqlite";
|
|
4977
5467
|
function createNodeCodeIndex(opts) {
|
|
4978
|
-
const dbPath = opts.dbPath ??
|
|
4979
|
-
|
|
5468
|
+
const dbPath = opts.dbPath ?? posix5.join(opts.repoRoot, DEFAULT_DB_RELPATH);
|
|
5469
|
+
mkdirSync3(posix5.dirname(dbPath), { recursive: true });
|
|
4980
5470
|
const store = new NodeSqliteStore(dbPath);
|
|
4981
5471
|
const parser = new TreeSitterParser();
|
|
4982
5472
|
return new CodeIndexEngine({
|
|
@@ -4988,9 +5478,9 @@ function createNodeCodeIndex(opts) {
|
|
|
4988
5478
|
}
|
|
4989
5479
|
|
|
4990
5480
|
// src/local-tools/engine.ts
|
|
4991
|
-
function
|
|
5481
|
+
function resolveRepoRoot2(cwd = process.cwd()) {
|
|
4992
5482
|
try {
|
|
4993
|
-
const top =
|
|
5483
|
+
const top = execFileSync5("git", ["rev-parse", "--show-toplevel"], {
|
|
4994
5484
|
cwd,
|
|
4995
5485
|
encoding: "utf8",
|
|
4996
5486
|
stdio: ["ignore", "pipe", "ignore"],
|
|
@@ -5002,12 +5492,12 @@ function resolveRepoRoot(cwd = process.cwd()) {
|
|
|
5002
5492
|
}
|
|
5003
5493
|
}
|
|
5004
5494
|
function defaultEngineFactory() {
|
|
5005
|
-
return createNodeCodeIndex({ repoRoot:
|
|
5495
|
+
return createNodeCodeIndex({ repoRoot: resolveRepoRoot2() });
|
|
5006
5496
|
}
|
|
5007
5497
|
|
|
5008
5498
|
// src/local-tools/savings.ts
|
|
5009
|
-
import { readFileSync as
|
|
5010
|
-
import { join as
|
|
5499
|
+
import { readFileSync as readFileSync5 } from "node:fs";
|
|
5500
|
+
import { join as join10 } from "node:path";
|
|
5011
5501
|
|
|
5012
5502
|
// src/local-tools/token-estimate.ts
|
|
5013
5503
|
var CHARS_PER_TOKEN = 4;
|
|
@@ -5039,7 +5529,7 @@ var SavingsAggregator = class {
|
|
|
5039
5529
|
};
|
|
5040
5530
|
function readFileCapped(absPath) {
|
|
5041
5531
|
try {
|
|
5042
|
-
const content =
|
|
5532
|
+
const content = readFileSync5(absPath, "utf8");
|
|
5043
5533
|
return content.length > MAX_FILE_BYTES ? content.slice(0, MAX_FILE_BYTES) : content;
|
|
5044
5534
|
} catch {
|
|
5045
5535
|
return "";
|
|
@@ -5062,14 +5552,14 @@ function measureLocalToolSaved(name, result, serialized, repoRoot) {
|
|
|
5062
5552
|
if (files.length === 0) return 0;
|
|
5063
5553
|
let wholeTokens = 0;
|
|
5064
5554
|
for (const fp of files) {
|
|
5065
|
-
wholeTokens += estimateTokens(readFileCapped(
|
|
5555
|
+
wholeTokens += estimateTokens(readFileCapped(join10(repoRoot, fp)));
|
|
5066
5556
|
}
|
|
5067
5557
|
return Math.max(0, wholeTokens - resultTokens);
|
|
5068
5558
|
}
|
|
5069
5559
|
if (name === "codebase_snippet") {
|
|
5070
5560
|
const fp = result?.filePath;
|
|
5071
5561
|
if (typeof fp !== "string" || fp.length === 0) return 0;
|
|
5072
|
-
const wholeTokens = estimateTokens(readFileCapped(
|
|
5562
|
+
const wholeTokens = estimateTokens(readFileCapped(join10(repoRoot, fp)));
|
|
5073
5563
|
return Math.max(0, wholeTokens - resultTokens);
|
|
5074
5564
|
}
|
|
5075
5565
|
return 0;
|
|
@@ -5079,14 +5569,14 @@ function measureLocalToolSaved(name, result, serialized, repoRoot) {
|
|
|
5079
5569
|
}
|
|
5080
5570
|
|
|
5081
5571
|
// src/local-tools/tools.ts
|
|
5082
|
-
import { createHash as
|
|
5572
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
5083
5573
|
|
|
5084
5574
|
// ../../packages/code-index/build/index.js
|
|
5085
5575
|
var CODE_INDEX_VERSION = "0.1.0";
|
|
5086
5576
|
|
|
5087
5577
|
// src/local-tools/tools.ts
|
|
5088
5578
|
function nodeKeyHash(nodeKey) {
|
|
5089
|
-
return
|
|
5579
|
+
return createHash4("sha256").update(nodeKey, "utf8").digest("hex");
|
|
5090
5580
|
}
|
|
5091
5581
|
var NODE_KINDS = [
|
|
5092
5582
|
"module",
|
|
@@ -5227,14 +5717,32 @@ var LOCAL_TOOLS = [
|
|
|
5227
5717
|
}
|
|
5228
5718
|
}
|
|
5229
5719
|
}
|
|
5720
|
+
},
|
|
5721
|
+
{
|
|
5722
|
+
name: "check_divergence",
|
|
5723
|
+
description: "Local silent-divergence detector (ADR-238): check whether the repo/worktree state has quietly diverged from what git/CLI success messages imply \u2014 the recurring AI-coding failure where a command reports 'ok / up to date / done' while upstream, worktree, or release state is actually wrong. Runs entirely on this machine (git + fs), nothing is uploaded. Returns findings in the open|warn|info vocabulary with fix hints, covering: branch/remote (no upstream, upstream tracking the WRONG branch, never-pushed, ahead/behind/diverged), worktree (detached HEAD, in-progress rebase/merge, uncommitted work on the shared base tree, tooling files missing vs the main checkout so tools silently target the wrong project), and release (all CI checks red \u2192 suspect account/billing/quota, not your code). Call this WHEN: (a) you are about to recommend or run git push / a deploy / a release; (b) a git/supabase/CLI command reported success but the result looks wrong; (c) at the start of work in a fresh worktree. An 'open' finding means proceed only after it is resolved or the user explicitly acknowledges it.",
|
|
5724
|
+
inputSchema: {
|
|
5725
|
+
type: "object",
|
|
5726
|
+
properties: {
|
|
5727
|
+
include_release: {
|
|
5728
|
+
type: "boolean",
|
|
5729
|
+
description: "Query gh for the all-checks-red signal (default true). Set false for a fully offline check."
|
|
5730
|
+
},
|
|
5731
|
+
probe_paths: {
|
|
5732
|
+
type: "array",
|
|
5733
|
+
items: { type: "string" },
|
|
5734
|
+
description: "Extra repo-relative worktree-parity probe paths, beyond the defaults + a committed .maind/worktree-requirements manifest."
|
|
5735
|
+
}
|
|
5736
|
+
}
|
|
5737
|
+
}
|
|
5230
5738
|
}
|
|
5231
5739
|
];
|
|
5232
5740
|
var LOCAL_TOOL_NAMES = new Set(LOCAL_TOOLS.map((t) => t.name));
|
|
5233
5741
|
function str(v) {
|
|
5234
5742
|
return typeof v === "string" && v.length > 0 ? v : void 0;
|
|
5235
5743
|
}
|
|
5236
|
-
var
|
|
5237
|
-
function
|
|
5744
|
+
var HOT_FILE_RECENT_COMMITS2 = 10;
|
|
5745
|
+
function aggregateHistoryContext2(res, now = Date.now()) {
|
|
5238
5746
|
if (res.history.length === 0) return void 0;
|
|
5239
5747
|
const authorEmails = /* @__PURE__ */ new Set();
|
|
5240
5748
|
let hotFiles = 0;
|
|
@@ -5242,7 +5750,7 @@ function aggregateHistoryContext(res, now = Date.now()) {
|
|
|
5242
5750
|
let newestMs = 0;
|
|
5243
5751
|
for (const entry of res.history) {
|
|
5244
5752
|
const inWindow = entry.ownership?.commitsInWindow ?? entry.lastCommits.length;
|
|
5245
|
-
if (inWindow >=
|
|
5753
|
+
if (inWindow >= HOT_FILE_RECENT_COMMITS2) hotFiles++;
|
|
5246
5754
|
if (inWindow > maxRecent) maxRecent = inWindow;
|
|
5247
5755
|
for (const a of entry.ownership?.topAuthors ?? []) {
|
|
5248
5756
|
authorEmails.add(a.email.toLowerCase() || a.name);
|
|
@@ -5271,6 +5779,22 @@ async function dispatchLocalTool(engine, name, args) {
|
|
|
5271
5779
|
return engine.indexRepository({ full: args.full === true });
|
|
5272
5780
|
case "codebase_status":
|
|
5273
5781
|
return engine.status();
|
|
5782
|
+
case "check_divergence": {
|
|
5783
|
+
const report = await engine.checkDivergence({
|
|
5784
|
+
includeRelease: args.include_release !== false,
|
|
5785
|
+
probePaths: Array.isArray(args.probe_paths) ? args.probe_paths.filter((p) => typeof p === "string") : void 0
|
|
5786
|
+
});
|
|
5787
|
+
const openCount = report.findings.filter((f) => f.status === "open").length;
|
|
5788
|
+
const warnCount = report.findings.filter((f) => f.status === "warn").length;
|
|
5789
|
+
return {
|
|
5790
|
+
ok: report.ok,
|
|
5791
|
+
open_count: openCount,
|
|
5792
|
+
warn_count: warnCount,
|
|
5793
|
+
findings: report.findings,
|
|
5794
|
+
facts: report.facts,
|
|
5795
|
+
hint: report.ok ? "No silent divergence detected \u2014 safe to proceed." : `${openCount} blocking (open) + ${warnCount} warning finding(s). Resolve the 'open' findings \u2014 or get the user's explicit acknowledgement \u2014 BEFORE recommending push/deploy/release.`
|
|
5796
|
+
};
|
|
5797
|
+
}
|
|
5274
5798
|
case "codebase_search": {
|
|
5275
5799
|
const query = str(args.query);
|
|
5276
5800
|
if (!query) throw new Error("codebase_search requires a 'query' string");
|
|
@@ -5339,7 +5863,7 @@ async function dispatchLocalTool(engine, name, args) {
|
|
|
5339
5863
|
let history;
|
|
5340
5864
|
if (args.include_history !== false) {
|
|
5341
5865
|
try {
|
|
5342
|
-
history =
|
|
5866
|
+
history = aggregateHistoryContext2(
|
|
5343
5867
|
await engine.fileHistory({ since: str(args.since), limit: 1 })
|
|
5344
5868
|
);
|
|
5345
5869
|
} catch {
|
|
@@ -5456,7 +5980,7 @@ var LocalToolRouter = class {
|
|
|
5456
5980
|
* @param resolveRoot repo-root resolver for the whole-file counterfactual
|
|
5457
5981
|
* (injectable in tests; defaults to the git top-level of cwd).
|
|
5458
5982
|
*/
|
|
5459
|
-
constructor(makeEngine = defaultEngineFactory, aggregator = null, resolveRoot =
|
|
5983
|
+
constructor(makeEngine = defaultEngineFactory, aggregator = null, resolveRoot = resolveRepoRoot2) {
|
|
5460
5984
|
this.makeEngine = makeEngine;
|
|
5461
5985
|
this.aggregator = aggregator;
|
|
5462
5986
|
this.resolveRoot = resolveRoot;
|
package/build/meta.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/client-detect.ts":{"bytes":3979,"imports":[],"format":"esm"},"src/forward.ts":{"bytes":20978,"imports":[{"path":"node:readline","kind":"import-statement","external":true},{"path":"node:timers/promises","kind":"import-statement","external":true},{"path":"src/client-detect.ts","kind":"import-statement","original":"./client-detect.js"}],"format":"esm"},"src/device-id.ts":{"bytes":5476,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/auth.ts":{"bytes":8214,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"src/device-id.ts","kind":"import-statement","original":"./device-id.js"}],"format":"esm"},"src/version.ts":{"bytes":306,"imports":[],"format":"esm"},"src/project-key.ts":{"bytes":2719,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"src/install/flags.ts":{"bytes":5802,"imports":[],"format":"esm"},"src/install/report.ts":{"bytes":4292,"imports":[],"format":"esm"},"src/install/project-root.ts":{"bytes":4032,"imports":[{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:readline","kind":"import-statement","external":true}],"format":"esm"},"src/install/client-targets.ts":{"bytes":5727,"imports":[{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/install/atomic-write.ts":{"bytes":4154,"imports":[{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/install/json-merge.ts":{"bytes":5180,"imports":[{"path":"src/install/atomic-write.ts","kind":"import-statement","original":"./atomic-write.js"}],"format":"esm"},"src/install/toml-merge.ts":{"bytes":4819,"imports":[{"path":"smol-toml","kind":"import-statement","external":true},{"path":"src/install/atomic-write.ts","kind":"import-statement","original":"./atomic-write.js"}],"format":"esm"},"../../packages/integration-snippets/build/index.js":{"bytes":35437,"imports":[],"format":"esm"},"src/install/preamble.ts":{"bytes":4556,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"../../packages/integration-snippets/build/index.js","kind":"import-statement","original":"@maind-dev/integration-snippets"},{"path":"src/install/atomic-write.ts","kind":"import-statement","original":"./atomic-write.js"}],"format":"esm"},"src/install/hook-merge.ts":{"bytes":8176,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"node:readline","kind":"import-statement","external":true},{"path":"src/install/atomic-write.ts","kind":"import-statement","original":"./atomic-write.js"}],"format":"esm"},"src/install/browser-pair.ts":{"bytes":4543,"imports":[{"path":"src/auth.ts","kind":"import-statement","original":"../auth.js"},{"path":"src/device-id.ts","kind":"import-statement","original":"../device-id.js"}],"format":"esm"},"src/install/telemetry.ts":{"bytes":3027,"imports":[],"format":"esm"},"src/install/index.ts":{"bytes":7285,"imports":[{"path":"node:os","kind":"import-statement","external":true},{"path":"src/version.ts","kind":"import-statement","original":"../version.js"},{"path":"src/install/flags.ts","kind":"import-statement","original":"./flags.js"},{"path":"src/install/report.ts","kind":"import-statement","original":"./report.js"},{"path":"src/install/project-root.ts","kind":"import-statement","original":"./project-root.js"},{"path":"src/install/client-targets.ts","kind":"import-statement","original":"./client-targets.js"},{"path":"src/install/json-merge.ts","kind":"import-statement","original":"./json-merge.js"},{"path":"src/install/toml-merge.ts","kind":"import-statement","original":"./toml-merge.js"},{"path":"src/install/preamble.ts","kind":"import-statement","original":"./preamble.js"},{"path":"src/install/hook-merge.ts","kind":"import-statement","original":"./hook-merge.js"},{"path":"src/install/browser-pair.ts","kind":"import-statement","original":"./browser-pair.js"},{"path":"src/install/telemetry.ts","kind":"import-statement","original":"./telemetry.js"}],"format":"esm"},"../../packages/project-key/build/index.js":{"bytes":3446,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"../../packages/code-index/build/parse/keys.js":{"bytes":448,"imports":[],"format":"esm"},"../../packages/code-index/build/parse/types.js":{"bytes":768,"imports":[],"format":"esm"},"../../packages/code-index/build/parse/lang/shared.js":{"bytes":2278,"imports":[],"format":"esm"},"../../packages/code-index/build/parse/lang/python.js":{"bytes":4535,"imports":[{"path":"../../packages/code-index/build/parse/keys.js","kind":"import-statement","original":"../keys.js"},{"path":"../../packages/code-index/build/parse/lang/shared.js","kind":"import-statement","original":"./shared.js"}],"format":"esm"},"../../packages/code-index/build/parse/lang/typescript.js":{"bytes":5949,"imports":[{"path":"../../packages/code-index/build/parse/keys.js","kind":"import-statement","original":"../keys.js"},{"path":"../../packages/code-index/build/parse/lang/shared.js","kind":"import-statement","original":"./shared.js"}],"format":"esm"},"../../packages/code-index/build/parse/tree-sitter/grammars.js":{"bytes":1941,"imports":[{"path":"node:module","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"../../packages/code-index/build/parse/tree-sitter/parser.js":{"bytes":3231,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"web-tree-sitter","kind":"import-statement","external":true},{"path":"../../packages/code-index/build/parse/keys.js","kind":"import-statement","original":"../keys.js"},{"path":"../../packages/code-index/build/parse/types.js","kind":"import-statement","original":"../types.js"},{"path":"../../packages/code-index/build/parse/lang/python.js","kind":"import-statement","original":"../lang/python.js"},{"path":"../../packages/code-index/build/parse/lang/typescript.js","kind":"import-statement","original":"../lang/typescript.js"},{"path":"../../packages/code-index/build/parse/lang/shared.js","kind":"import-statement","original":"../lang/shared.js"},{"path":"../../packages/code-index/build/parse/tree-sitter/grammars.js","kind":"import-statement","original":"./grammars.js"}],"format":"esm"},"../../packages/code-index/build/embed/recipe.js":{"bytes":594,"imports":[],"format":"esm"},"../../packages/code-index/build/embed/types.js":{"bytes":505,"imports":[],"format":"esm"},"../../packages/code-index/build/util/vector.js":{"bytes":707,"imports":[],"format":"esm"},"../../packages/code-index/build/graph/resolve.js":{"bytes":3928,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"../../packages/code-index/build/parse/keys.js","kind":"import-statement","original":"../parse/keys.js"}],"format":"esm"},"../../packages/code-index/build/incremental/discover.js":{"bytes":8578,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"../../packages/code-index/build/parse/types.js","kind":"import-statement","original":"../parse/types.js"}],"format":"esm"},"../../packages/code-index/build/incremental/hunks.js":{"bytes":6171,"imports":[{"path":"../../packages/code-index/build/incremental/discover.js","kind":"import-statement","original":"./discover.js"}],"format":"esm"},"../../packages/code-index/build/incremental/history.js":{"bytes":5604,"imports":[{"path":"../../packages/code-index/build/incremental/discover.js","kind":"import-statement","original":"./discover.js"}],"format":"esm"},"../../packages/code-index/build/review/risk-rules.js":{"bytes":1958,"imports":[],"format":"esm"},"../../packages/code-index/build/review/risk-scan.js":{"bytes":1451,"imports":[{"path":"../../packages/code-index/build/review/risk-rules.js","kind":"import-statement","original":"./risk-rules.js"}],"format":"esm"},"../../packages/code-index/build/store/schema.js":{"bytes":3047,"imports":[],"format":"esm"},"../../packages/code-index/build/util/identifiers.js":{"bytes":2180,"imports":[],"format":"esm"},"../../packages/code-index/build/query/engine.js":{"bytes":19798,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"../../packages/code-index/build/embed/recipe.js","kind":"import-statement","original":"../embed/recipe.js"},{"path":"../../packages/code-index/build/embed/types.js","kind":"import-statement","original":"../embed/types.js"},{"path":"../../packages/code-index/build/util/vector.js","kind":"import-statement","original":"../util/vector.js"},{"path":"../../packages/code-index/build/graph/resolve.js","kind":"import-statement","original":"../graph/resolve.js"},{"path":"../../packages/code-index/build/incremental/discover.js","kind":"import-statement","original":"../incremental/discover.js"},{"path":"../../packages/code-index/build/incremental/hunks.js","kind":"import-statement","original":"../incremental/hunks.js"},{"path":"../../packages/code-index/build/incremental/history.js","kind":"import-statement","original":"../incremental/history.js"},{"path":"../../packages/code-index/build/review/risk-scan.js","kind":"import-statement","original":"../review/risk-scan.js"},{"path":"../../packages/code-index/build/store/schema.js","kind":"import-statement","original":"../store/schema.js"},{"path":"../../packages/code-index/build/util/identifiers.js","kind":"import-statement","original":"../util/identifiers.js"}],"format":"esm"},"../../packages/code-index/build/store/node-sqlite.js":{"bytes":11850,"imports":[{"path":"better-sqlite3","kind":"import-statement","external":true},{"path":"../../packages/code-index/build/store/schema.js","kind":"import-statement","original":"./schema.js"},{"path":"../../packages/code-index/build/util/identifiers.js","kind":"import-statement","original":"../util/identifiers.js"}],"format":"esm"},"../../packages/code-index/build/sync/types.js":{"bytes":1779,"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"../../packages/code-index/build/sync/client.js":{"bytes":10021,"imports":[{"path":"../../packages/code-index/build/store/schema.js","kind":"import-statement","original":"../store/schema.js"},{"path":"../../packages/code-index/build/sync/types.js","kind":"import-statement","original":"./types.js"}],"format":"esm"},"../../packages/code-index/build/node.js":{"bytes":2578,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"../../packages/project-key/build/index.js","kind":"import-statement","original":"@maind/project-key"},{"path":"../../packages/code-index/build/parse/tree-sitter/parser.js","kind":"import-statement","original":"./parse/tree-sitter/parser.js"},{"path":"../../packages/code-index/build/query/engine.js","kind":"import-statement","original":"./query/engine.js"},{"path":"../../packages/code-index/build/store/node-sqlite.js","kind":"import-statement","original":"./store/node-sqlite.js"},{"path":"../../packages/code-index/build/sync/client.js","kind":"import-statement","original":"./sync/client.js"},{"path":"../../packages/code-index/build/sync/client.js","kind":"import-statement","original":"./sync/client.js"}],"format":"esm"},"src/local-tools/engine.ts":{"bytes":1138,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"../../packages/code-index/build/node.js","kind":"import-statement","original":"@maind/code-index/node"}],"format":"esm"},"src/local-tools/token-estimate.ts":{"bytes":898,"imports":[],"format":"esm"},"src/local-tools/savings.ts":{"bytes":3781,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/local-tools/token-estimate.ts","kind":"import-statement","original":"./token-estimate.js"}],"format":"esm"},"../../packages/code-index/build/model/types.js":{"bytes":471,"imports":[],"format":"esm"},"../../packages/code-index/build/index.js":{"bytes":1309,"imports":[{"path":"../../packages/code-index/build/model/types.js","kind":"import-statement","original":"./model/types.js"},{"path":"../../packages/code-index/build/query/engine.js","kind":"import-statement","original":"./query/engine.js"},{"path":"../../packages/code-index/build/incremental/history.js","kind":"import-statement","original":"./incremental/history.js"},{"path":"../../packages/code-index/build/review/risk-rules.js","kind":"import-statement","original":"./review/risk-rules.js"},{"path":"../../packages/code-index/build/parse/types.js","kind":"import-statement","original":"./parse/types.js"},{"path":"../../packages/code-index/build/embed/types.js","kind":"import-statement","original":"./embed/types.js"},{"path":"../../packages/code-index/build/store/schema.js","kind":"import-statement","original":"./store/schema.js"}],"format":"esm"},"src/local-tools/tools.ts":{"bytes":19259,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"../../packages/code-index/build/index.js","kind":"import-statement","original":"@maind/code-index"}],"format":"esm"},"src/local-tools/router.ts":{"bytes":5550,"imports":[{"path":"src/local-tools/engine.ts","kind":"import-statement","original":"./engine.js"},{"path":"src/local-tools/savings.ts","kind":"import-statement","original":"./savings.js"},{"path":"src/local-tools/tools.ts","kind":"import-statement","original":"./tools.js"}],"format":"esm"},"src/functions-origin.ts":{"bytes":714,"imports":[],"format":"esm"},"src/metrics-post.ts":{"bytes":2619,"imports":[{"path":"src/functions-origin.ts","kind":"import-statement","original":"./functions-origin.js"}],"format":"esm"},"../../packages/claude-code-telemetry/dist/types.js":{"bytes":338,"imports":[],"format":"esm"},"../../packages/claude-code-telemetry/dist/transcript.js":{"bytes":2017,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:readline","kind":"import-statement","external":true}],"format":"esm"},"../../packages/claude-code-telemetry/dist/decisions.js":{"bytes":6845,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:readline","kind":"import-statement","external":true}],"format":"esm"},"../../packages/claude-code-telemetry/dist/effort.js":{"bytes":1858,"imports":[],"format":"esm"},"../../packages/claude-code-telemetry/dist/session-analysis.js":{"bytes":12237,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:readline","kind":"import-statement","external":true},{"path":"../../packages/claude-code-telemetry/dist/effort.js","kind":"import-statement","original":"./effort.js"}],"format":"esm"},"../../packages/claude-code-telemetry/dist/parse.js":{"bytes":7254,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:readline","kind":"import-statement","external":true},{"path":"../../packages/claude-code-telemetry/dist/effort.js","kind":"import-statement","original":"./effort.js"},{"path":"../../packages/claude-code-telemetry/dist/types.js","kind":"import-statement","original":"./types.js"}],"format":"esm"},"../../packages/claude-code-telemetry/dist/windows.js":{"bytes":3963,"imports":[],"format":"esm"},"../../packages/claude-code-telemetry/dist/projects.js":{"bytes":3166,"imports":[{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"../../packages/claude-code-telemetry/dist/index.js":{"bytes":685,"imports":[{"path":"../../packages/claude-code-telemetry/dist/types.js","kind":"import-statement","original":"./types.js"},{"path":"../../packages/claude-code-telemetry/dist/transcript.js","kind":"import-statement","original":"./transcript.js"},{"path":"../../packages/claude-code-telemetry/dist/decisions.js","kind":"import-statement","original":"./decisions.js"},{"path":"../../packages/claude-code-telemetry/dist/session-analysis.js","kind":"import-statement","original":"./session-analysis.js"},{"path":"../../packages/claude-code-telemetry/dist/parse.js","kind":"import-statement","original":"./parse.js"},{"path":"../../packages/claude-code-telemetry/dist/effort.js","kind":"import-statement","original":"./effort.js"},{"path":"../../packages/claude-code-telemetry/dist/windows.js","kind":"import-statement","original":"./windows.js"},{"path":"../../packages/claude-code-telemetry/dist/projects.js","kind":"import-statement","original":"./projects.js"}],"format":"esm"},"src/session-end/index.ts":{"bytes":3483,"imports":[{"path":"../../packages/claude-code-telemetry/dist/index.js","kind":"import-statement","original":"@maind/claude-code-telemetry"},{"path":"src/device-id.ts","kind":"import-statement","original":"../device-id.js"},{"path":"src/version.ts","kind":"import-statement","original":"../version.js"}],"format":"esm"},"src/index.ts":{"bytes":9764,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"src/forward.ts","kind":"import-statement","original":"./forward.js"},{"path":"src/device-id.ts","kind":"import-statement","original":"./device-id.js"},{"path":"src/auth.ts","kind":"import-statement","original":"./auth.js"},{"path":"src/version.ts","kind":"import-statement","original":"./version.js"},{"path":"src/project-key.ts","kind":"import-statement","original":"./project-key.js"},{"path":"src/install/index.ts","kind":"import-statement","original":"./install/index.js"},{"path":"src/local-tools/router.ts","kind":"import-statement","original":"./local-tools/router.js"},{"path":"src/local-tools/savings.ts","kind":"import-statement","original":"./local-tools/savings.js"},{"path":"src/metrics-post.ts","kind":"import-statement","original":"./metrics-post.js"},{"path":"src/session-end/index.ts","kind":"dynamic-import","original":"./session-end/index.js"}],"format":"esm"}},"outputs":{"build/index.js":{"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:readline","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:readline","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:readline","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"smol-toml","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:readline","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"web-tree-sitter","kind":"import-statement","external":true},{"path":"node:module","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"better-sqlite3","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true}],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/device-id.ts":{"bytesInOutput":2356},"src/version.ts":{"bytesInOutput":127},"../../packages/claude-code-telemetry/dist/types.js":{"bytesInOutput":110},"../../packages/claude-code-telemetry/dist/transcript.js":{"bytesInOutput":120},"../../packages/claude-code-telemetry/dist/decisions.js":{"bytesInOutput":118},"../../packages/claude-code-telemetry/dist/effort.js":{"bytesInOutput":596},"../../packages/claude-code-telemetry/dist/session-analysis.js":{"bytesInOutput":7774},"../../packages/claude-code-telemetry/dist/parse.js":{"bytesInOutput":147},"../../packages/claude-code-telemetry/dist/windows.js":{"bytesInOutput":219},"../../packages/claude-code-telemetry/dist/projects.js":{"bytesInOutput":326},"../../packages/claude-code-telemetry/dist/index.js":{"bytesInOutput":279},"src/session-end/index.ts":{"bytesInOutput":2476},"src/index.ts":{"bytesInOutput":5306},"src/forward.ts":{"bytesInOutput":13217},"src/client-detect.ts":{"bytesInOutput":2068},"src/auth.ts":{"bytesInOutput":5107},"src/project-key.ts":{"bytesInOutput":1318},"src/install/index.ts":{"bytesInOutput":5049},"src/install/flags.ts":{"bytesInOutput":4255},"src/install/report.ts":{"bytesInOutput":3091},"src/install/project-root.ts":{"bytesInOutput":2188},"src/install/client-targets.ts":{"bytesInOutput":2805},"src/install/atomic-write.ts":{"bytesInOutput":1758},"src/install/json-merge.ts":{"bytesInOutput":3341},"src/install/toml-merge.ts":{"bytesInOutput":3262},"src/install/preamble.ts":{"bytesInOutput":2812},"../../packages/integration-snippets/build/index.js":{"bytesInOutput":27539},"src/install/hook-merge.ts":{"bytesInOutput":5372},"src/install/browser-pair.ts":{"bytesInOutput":2701},"src/install/telemetry.ts":{"bytesInOutput":1798},"src/local-tools/engine.ts":{"bytesInOutput":481},"../../packages/code-index/build/node.js":{"bytesInOutput":530},"../../packages/code-index/build/parse/tree-sitter/parser.js":{"bytesInOutput":2043},"../../packages/code-index/build/parse/keys.js":{"bytesInOutput":169},"../../packages/code-index/build/parse/types.js":{"bytesInOutput":546},"../../packages/code-index/build/parse/lang/shared.js":{"bytesInOutput":1131},"../../packages/code-index/build/parse/lang/python.js":{"bytesInOutput":3747},"../../packages/code-index/build/parse/lang/typescript.js":{"bytesInOutput":4716},"../../packages/code-index/build/parse/tree-sitter/grammars.js":{"bytesInOutput":523},"../../packages/code-index/build/query/engine.js":{"bytesInOutput":14406},"../../packages/code-index/build/embed/recipe.js":{"bytesInOutput":197},"../../packages/code-index/build/embed/types.js":{"bytesInOutput":105},"../../packages/code-index/build/util/vector.js":{"bytesInOutput":339},"../../packages/code-index/build/graph/resolve.js":{"bytesInOutput":2482},"../../packages/code-index/build/incremental/discover.js":{"bytesInOutput":4835},"../../packages/code-index/build/incremental/hunks.js":{"bytesInOutput":3945},"../../packages/code-index/build/incremental/history.js":{"bytesInOutput":3432},"../../packages/code-index/build/review/risk-rules.js":{"bytesInOutput":876},"../../packages/code-index/build/review/risk-scan.js":{"bytesInOutput":802},"../../packages/code-index/build/store/schema.js":{"bytesInOutput":2170},"../../packages/code-index/build/util/identifiers.js":{"bytesInOutput":1094},"../../packages/code-index/build/store/node-sqlite.js":{"bytesInOutput":9759},"src/local-tools/savings.ts":{"bytesInOutput":1923},"src/local-tools/token-estimate.ts":{"bytesInOutput":133},"src/local-tools/tools.ts":{"bytesInOutput":16134},"../../packages/code-index/build/index.js":{"bytesInOutput":34},"src/local-tools/router.ts":{"bytesInOutput":3827},"src/functions-origin.ts":{"bytesInOutput":259},"src/metrics-post.ts":{"bytesInOutput":1285}},"bytes":192805}}}
|
|
1
|
+
{"inputs":{"src/client-detect.ts":{"bytes":3979,"imports":[],"format":"esm"},"src/conventions-cache.ts":{"bytes":6619,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/forward.ts":{"bytes":24594,"imports":[{"path":"node:readline","kind":"import-statement","external":true},{"path":"node:timers/promises","kind":"import-statement","external":true},{"path":"src/client-detect.ts","kind":"import-statement","original":"./client-detect.js"},{"path":"src/conventions-cache.ts","kind":"import-statement","original":"./conventions-cache.js"}],"format":"esm"},"src/device-id.ts":{"bytes":5476,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/auth.ts":{"bytes":8214,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"src/device-id.ts","kind":"import-statement","original":"./device-id.js"}],"format":"esm"},"src/version.ts":{"bytes":306,"imports":[],"format":"esm"},"src/project-key.ts":{"bytes":2719,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"src/install/flags.ts":{"bytes":5802,"imports":[],"format":"esm"},"src/install/report.ts":{"bytes":4292,"imports":[],"format":"esm"},"src/install/project-root.ts":{"bytes":4032,"imports":[{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:readline","kind":"import-statement","external":true}],"format":"esm"},"src/install/client-targets.ts":{"bytes":5727,"imports":[{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/install/atomic-write.ts":{"bytes":4154,"imports":[{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/install/json-merge.ts":{"bytes":5180,"imports":[{"path":"src/install/atomic-write.ts","kind":"import-statement","original":"./atomic-write.js"}],"format":"esm"},"src/install/toml-merge.ts":{"bytes":4819,"imports":[{"path":"smol-toml","kind":"import-statement","external":true},{"path":"src/install/atomic-write.ts","kind":"import-statement","original":"./atomic-write.js"}],"format":"esm"},"../../packages/integration-snippets/build/index.js":{"bytes":35437,"imports":[],"format":"esm"},"src/install/preamble.ts":{"bytes":4556,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"../../packages/integration-snippets/build/index.js","kind":"import-statement","original":"@maind-dev/integration-snippets"},{"path":"src/install/atomic-write.ts","kind":"import-statement","original":"./atomic-write.js"}],"format":"esm"},"src/install/hook-merge.ts":{"bytes":8176,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"node:readline","kind":"import-statement","external":true},{"path":"src/install/atomic-write.ts","kind":"import-statement","original":"./atomic-write.js"}],"format":"esm"},"src/install/browser-pair.ts":{"bytes":4543,"imports":[{"path":"src/auth.ts","kind":"import-statement","original":"../auth.js"},{"path":"src/device-id.ts","kind":"import-statement","original":"../device-id.js"}],"format":"esm"},"src/install/telemetry.ts":{"bytes":3027,"imports":[],"format":"esm"},"src/install/index.ts":{"bytes":7285,"imports":[{"path":"node:os","kind":"import-statement","external":true},{"path":"src/version.ts","kind":"import-statement","original":"../version.js"},{"path":"src/install/flags.ts","kind":"import-statement","original":"./flags.js"},{"path":"src/install/report.ts","kind":"import-statement","original":"./report.js"},{"path":"src/install/project-root.ts","kind":"import-statement","original":"./project-root.js"},{"path":"src/install/client-targets.ts","kind":"import-statement","original":"./client-targets.js"},{"path":"src/install/json-merge.ts","kind":"import-statement","original":"./json-merge.js"},{"path":"src/install/toml-merge.ts","kind":"import-statement","original":"./toml-merge.js"},{"path":"src/install/preamble.ts","kind":"import-statement","original":"./preamble.js"},{"path":"src/install/hook-merge.ts","kind":"import-statement","original":"./hook-merge.js"},{"path":"src/install/browser-pair.ts","kind":"import-statement","original":"./browser-pair.js"},{"path":"src/install/telemetry.ts","kind":"import-statement","original":"./telemetry.js"}],"format":"esm"},"../../packages/project-key/build/index.js":{"bytes":3446,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"../../packages/code-index/build/parse/keys.js":{"bytes":448,"imports":[],"format":"esm"},"../../packages/code-index/build/parse/types.js":{"bytes":768,"imports":[],"format":"esm"},"../../packages/code-index/build/parse/lang/shared.js":{"bytes":2278,"imports":[],"format":"esm"},"../../packages/code-index/build/parse/lang/python.js":{"bytes":4535,"imports":[{"path":"../../packages/code-index/build/parse/keys.js","kind":"import-statement","original":"../keys.js"},{"path":"../../packages/code-index/build/parse/lang/shared.js","kind":"import-statement","original":"./shared.js"}],"format":"esm"},"../../packages/code-index/build/parse/lang/typescript.js":{"bytes":5949,"imports":[{"path":"../../packages/code-index/build/parse/keys.js","kind":"import-statement","original":"../keys.js"},{"path":"../../packages/code-index/build/parse/lang/shared.js","kind":"import-statement","original":"./shared.js"}],"format":"esm"},"../../packages/code-index/build/parse/tree-sitter/grammars.js":{"bytes":1941,"imports":[{"path":"node:module","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"../../packages/code-index/build/parse/tree-sitter/parser.js":{"bytes":3231,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"web-tree-sitter","kind":"import-statement","external":true},{"path":"../../packages/code-index/build/parse/keys.js","kind":"import-statement","original":"../keys.js"},{"path":"../../packages/code-index/build/parse/types.js","kind":"import-statement","original":"../types.js"},{"path":"../../packages/code-index/build/parse/lang/python.js","kind":"import-statement","original":"../lang/python.js"},{"path":"../../packages/code-index/build/parse/lang/typescript.js","kind":"import-statement","original":"../lang/typescript.js"},{"path":"../../packages/code-index/build/parse/lang/shared.js","kind":"import-statement","original":"../lang/shared.js"},{"path":"../../packages/code-index/build/parse/tree-sitter/grammars.js","kind":"import-statement","original":"./grammars.js"}],"format":"esm"},"../../packages/code-index/build/embed/recipe.js":{"bytes":594,"imports":[],"format":"esm"},"../../packages/code-index/build/embed/types.js":{"bytes":505,"imports":[],"format":"esm"},"../../packages/code-index/build/util/vector.js":{"bytes":707,"imports":[],"format":"esm"},"../../packages/code-index/build/graph/resolve.js":{"bytes":3928,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"../../packages/code-index/build/parse/keys.js","kind":"import-statement","original":"../parse/keys.js"}],"format":"esm"},"../../packages/code-index/build/incremental/discover.js":{"bytes":8578,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"../../packages/code-index/build/parse/types.js","kind":"import-statement","original":"../parse/types.js"}],"format":"esm"},"../../packages/code-index/build/incremental/hunks.js":{"bytes":6171,"imports":[{"path":"../../packages/code-index/build/incremental/discover.js","kind":"import-statement","original":"./discover.js"}],"format":"esm"},"../../packages/code-index/build/incremental/history.js":{"bytes":7302,"imports":[{"path":"../../packages/code-index/build/incremental/discover.js","kind":"import-statement","original":"./discover.js"}],"format":"esm"},"../../packages/code-index/build/repo-health/divergence.js":{"bytes":17150,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"../../packages/code-index/build/incremental/discover.js","kind":"import-statement","original":"../incremental/discover.js"}],"format":"esm"},"../../packages/code-index/build/review/risk-rules.js":{"bytes":1958,"imports":[],"format":"esm"},"../../packages/code-index/build/review/risk-scan.js":{"bytes":1451,"imports":[{"path":"../../packages/code-index/build/review/risk-rules.js","kind":"import-statement","original":"./risk-rules.js"}],"format":"esm"},"../../packages/code-index/build/store/schema.js":{"bytes":3047,"imports":[],"format":"esm"},"../../packages/code-index/build/util/identifiers.js":{"bytes":2180,"imports":[],"format":"esm"},"../../packages/code-index/build/query/engine.js":{"bytes":20406,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"../../packages/code-index/build/embed/recipe.js","kind":"import-statement","original":"../embed/recipe.js"},{"path":"../../packages/code-index/build/embed/types.js","kind":"import-statement","original":"../embed/types.js"},{"path":"../../packages/code-index/build/util/vector.js","kind":"import-statement","original":"../util/vector.js"},{"path":"../../packages/code-index/build/graph/resolve.js","kind":"import-statement","original":"../graph/resolve.js"},{"path":"../../packages/code-index/build/incremental/discover.js","kind":"import-statement","original":"../incremental/discover.js"},{"path":"../../packages/code-index/build/incremental/hunks.js","kind":"import-statement","original":"../incremental/hunks.js"},{"path":"../../packages/code-index/build/incremental/history.js","kind":"import-statement","original":"../incremental/history.js"},{"path":"../../packages/code-index/build/repo-health/divergence.js","kind":"import-statement","original":"../repo-health/divergence.js"},{"path":"../../packages/code-index/build/review/risk-scan.js","kind":"import-statement","original":"../review/risk-scan.js"},{"path":"../../packages/code-index/build/store/schema.js","kind":"import-statement","original":"../store/schema.js"},{"path":"../../packages/code-index/build/util/identifiers.js","kind":"import-statement","original":"../util/identifiers.js"}],"format":"esm"},"../../packages/code-index/build/store/node-sqlite.js":{"bytes":11850,"imports":[{"path":"better-sqlite3","kind":"import-statement","external":true},{"path":"../../packages/code-index/build/store/schema.js","kind":"import-statement","original":"./schema.js"},{"path":"../../packages/code-index/build/util/identifiers.js","kind":"import-statement","original":"../util/identifiers.js"}],"format":"esm"},"../../packages/code-index/build/sync/types.js":{"bytes":1779,"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"../../packages/code-index/build/sync/client.js":{"bytes":10021,"imports":[{"path":"../../packages/code-index/build/store/schema.js","kind":"import-statement","original":"../store/schema.js"},{"path":"../../packages/code-index/build/sync/types.js","kind":"import-statement","original":"./types.js"}],"format":"esm"},"../../packages/code-index/build/node.js":{"bytes":2578,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"../../packages/project-key/build/index.js","kind":"import-statement","original":"@maind/project-key"},{"path":"../../packages/code-index/build/parse/tree-sitter/parser.js","kind":"import-statement","original":"./parse/tree-sitter/parser.js"},{"path":"../../packages/code-index/build/query/engine.js","kind":"import-statement","original":"./query/engine.js"},{"path":"../../packages/code-index/build/store/node-sqlite.js","kind":"import-statement","original":"./store/node-sqlite.js"},{"path":"../../packages/code-index/build/sync/client.js","kind":"import-statement","original":"./sync/client.js"},{"path":"../../packages/code-index/build/sync/client.js","kind":"import-statement","original":"./sync/client.js"}],"format":"esm"},"src/local-tools/engine.ts":{"bytes":1138,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"../../packages/code-index/build/node.js","kind":"import-statement","original":"@maind/code-index/node"}],"format":"esm"},"src/local-tools/token-estimate.ts":{"bytes":898,"imports":[],"format":"esm"},"src/local-tools/savings.ts":{"bytes":3781,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/local-tools/token-estimate.ts","kind":"import-statement","original":"./token-estimate.js"}],"format":"esm"},"../../packages/code-index/build/model/types.js":{"bytes":471,"imports":[],"format":"esm"},"../../packages/code-index/build/index.js":{"bytes":1537,"imports":[{"path":"../../packages/code-index/build/model/types.js","kind":"import-statement","original":"./model/types.js"},{"path":"../../packages/code-index/build/query/engine.js","kind":"import-statement","original":"./query/engine.js"},{"path":"../../packages/code-index/build/incremental/history.js","kind":"import-statement","original":"./incremental/history.js"},{"path":"../../packages/code-index/build/review/risk-rules.js","kind":"import-statement","original":"./review/risk-rules.js"},{"path":"../../packages/code-index/build/repo-health/divergence.js","kind":"import-statement","original":"./repo-health/divergence.js"},{"path":"../../packages/code-index/build/parse/types.js","kind":"import-statement","original":"./parse/types.js"},{"path":"../../packages/code-index/build/embed/types.js","kind":"import-statement","original":"./embed/types.js"},{"path":"../../packages/code-index/build/store/schema.js","kind":"import-statement","original":"./store/schema.js"}],"format":"esm"},"src/local-tools/tools.ts":{"bytes":21891,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"../../packages/code-index/build/index.js","kind":"import-statement","original":"@maind/code-index"}],"format":"esm"},"src/local-tools/router.ts":{"bytes":5550,"imports":[{"path":"src/local-tools/engine.ts","kind":"import-statement","original":"./engine.js"},{"path":"src/local-tools/savings.ts","kind":"import-statement","original":"./savings.js"},{"path":"src/local-tools/tools.ts","kind":"import-statement","original":"./tools.js"}],"format":"esm"},"src/functions-origin.ts":{"bytes":714,"imports":[],"format":"esm"},"src/metrics-post.ts":{"bytes":2619,"imports":[{"path":"src/functions-origin.ts","kind":"import-statement","original":"./functions-origin.js"}],"format":"esm"},"../../packages/claude-code-telemetry/dist/types.js":{"bytes":338,"imports":[],"format":"esm"},"../../packages/claude-code-telemetry/dist/transcript.js":{"bytes":2017,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:readline","kind":"import-statement","external":true}],"format":"esm"},"../../packages/claude-code-telemetry/dist/decisions.js":{"bytes":6845,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:readline","kind":"import-statement","external":true}],"format":"esm"},"../../packages/claude-code-telemetry/dist/effort.js":{"bytes":1858,"imports":[],"format":"esm"},"../../packages/claude-code-telemetry/dist/session-analysis.js":{"bytes":12237,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:readline","kind":"import-statement","external":true},{"path":"../../packages/claude-code-telemetry/dist/effort.js","kind":"import-statement","original":"./effort.js"}],"format":"esm"},"../../packages/claude-code-telemetry/dist/parse.js":{"bytes":7254,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:readline","kind":"import-statement","external":true},{"path":"../../packages/claude-code-telemetry/dist/effort.js","kind":"import-statement","original":"./effort.js"},{"path":"../../packages/claude-code-telemetry/dist/types.js","kind":"import-statement","original":"./types.js"}],"format":"esm"},"../../packages/claude-code-telemetry/dist/windows.js":{"bytes":3963,"imports":[],"format":"esm"},"../../packages/claude-code-telemetry/dist/projects.js":{"bytes":3166,"imports":[{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"../../packages/claude-code-telemetry/dist/index.js":{"bytes":685,"imports":[{"path":"../../packages/claude-code-telemetry/dist/types.js","kind":"import-statement","original":"./types.js"},{"path":"../../packages/claude-code-telemetry/dist/transcript.js","kind":"import-statement","original":"./transcript.js"},{"path":"../../packages/claude-code-telemetry/dist/decisions.js","kind":"import-statement","original":"./decisions.js"},{"path":"../../packages/claude-code-telemetry/dist/session-analysis.js","kind":"import-statement","original":"./session-analysis.js"},{"path":"../../packages/claude-code-telemetry/dist/parse.js","kind":"import-statement","original":"./parse.js"},{"path":"../../packages/claude-code-telemetry/dist/effort.js","kind":"import-statement","original":"./effort.js"},{"path":"../../packages/claude-code-telemetry/dist/windows.js","kind":"import-statement","original":"./windows.js"},{"path":"../../packages/claude-code-telemetry/dist/projects.js","kind":"import-statement","original":"./projects.js"}],"format":"esm"},"src/session-end/index.ts":{"bytes":3483,"imports":[{"path":"../../packages/claude-code-telemetry/dist/index.js","kind":"import-statement","original":"@maind/claude-code-telemetry"},{"path":"src/device-id.ts","kind":"import-statement","original":"../device-id.js"},{"path":"src/version.ts","kind":"import-statement","original":"../version.js"}],"format":"esm"},"src/index.ts":{"bytes":9764,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"src/forward.ts","kind":"import-statement","original":"./forward.js"},{"path":"src/device-id.ts","kind":"import-statement","original":"./device-id.js"},{"path":"src/auth.ts","kind":"import-statement","original":"./auth.js"},{"path":"src/version.ts","kind":"import-statement","original":"./version.js"},{"path":"src/project-key.ts","kind":"import-statement","original":"./project-key.js"},{"path":"src/install/index.ts","kind":"import-statement","original":"./install/index.js"},{"path":"src/local-tools/router.ts","kind":"import-statement","original":"./local-tools/router.js"},{"path":"src/local-tools/savings.ts","kind":"import-statement","original":"./local-tools/savings.js"},{"path":"src/metrics-post.ts","kind":"import-statement","original":"./metrics-post.js"},{"path":"src/session-end/index.ts","kind":"dynamic-import","original":"./session-end/index.js"}],"format":"esm"}},"outputs":{"build/index.js":{"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:readline","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:readline","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:readline","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"smol-toml","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:readline","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"web-tree-sitter","kind":"import-statement","external":true},{"path":"node:module","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"better-sqlite3","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true}],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/device-id.ts":{"bytesInOutput":2427},"src/version.ts":{"bytesInOutput":127},"../../packages/claude-code-telemetry/dist/types.js":{"bytesInOutput":110},"../../packages/claude-code-telemetry/dist/transcript.js":{"bytesInOutput":120},"../../packages/claude-code-telemetry/dist/decisions.js":{"bytesInOutput":118},"../../packages/claude-code-telemetry/dist/effort.js":{"bytesInOutput":596},"../../packages/claude-code-telemetry/dist/session-analysis.js":{"bytesInOutput":7774},"../../packages/claude-code-telemetry/dist/parse.js":{"bytesInOutput":147},"../../packages/claude-code-telemetry/dist/windows.js":{"bytesInOutput":219},"../../packages/claude-code-telemetry/dist/projects.js":{"bytesInOutput":326},"../../packages/claude-code-telemetry/dist/index.js":{"bytesInOutput":279},"src/session-end/index.ts":{"bytesInOutput":2476},"src/index.ts":{"bytesInOutput":5306},"src/forward.ts":{"bytesInOutput":15906},"src/client-detect.ts":{"bytesInOutput":2068},"src/conventions-cache.ts":{"bytesInOutput":3228},"src/auth.ts":{"bytesInOutput":5107},"src/project-key.ts":{"bytesInOutput":1352},"src/install/index.ts":{"bytesInOutput":5049},"src/install/flags.ts":{"bytesInOutput":4255},"src/install/report.ts":{"bytesInOutput":3091},"src/install/project-root.ts":{"bytesInOutput":2188},"src/install/client-targets.ts":{"bytesInOutput":2805},"src/install/atomic-write.ts":{"bytesInOutput":1758},"src/install/json-merge.ts":{"bytesInOutput":3341},"src/install/toml-merge.ts":{"bytesInOutput":3262},"src/install/preamble.ts":{"bytesInOutput":2812},"../../packages/integration-snippets/build/index.js":{"bytesInOutput":27539},"src/install/hook-merge.ts":{"bytesInOutput":5372},"src/install/browser-pair.ts":{"bytesInOutput":2701},"src/install/telemetry.ts":{"bytesInOutput":1798},"src/local-tools/engine.ts":{"bytesInOutput":483},"../../packages/code-index/build/node.js":{"bytesInOutput":530},"../../packages/code-index/build/parse/tree-sitter/parser.js":{"bytesInOutput":2043},"../../packages/code-index/build/parse/keys.js":{"bytesInOutput":169},"../../packages/code-index/build/parse/types.js":{"bytesInOutput":546},"../../packages/code-index/build/parse/lang/shared.js":{"bytesInOutput":1131},"../../packages/code-index/build/parse/lang/python.js":{"bytesInOutput":3747},"../../packages/code-index/build/parse/lang/typescript.js":{"bytesInOutput":4716},"../../packages/code-index/build/parse/tree-sitter/grammars.js":{"bytesInOutput":523},"../../packages/code-index/build/query/engine.js":{"bytesInOutput":14515},"../../packages/code-index/build/embed/recipe.js":{"bytesInOutput":197},"../../packages/code-index/build/embed/types.js":{"bytesInOutput":105},"../../packages/code-index/build/util/vector.js":{"bytesInOutput":339},"../../packages/code-index/build/graph/resolve.js":{"bytesInOutput":2482},"../../packages/code-index/build/incremental/discover.js":{"bytesInOutput":4835},"../../packages/code-index/build/incremental/hunks.js":{"bytesInOutput":3945},"../../packages/code-index/build/incremental/history.js":{"bytesInOutput":3432},"../../packages/code-index/build/repo-health/divergence.js":{"bytesInOutput":11928},"../../packages/code-index/build/review/risk-rules.js":{"bytesInOutput":876},"../../packages/code-index/build/review/risk-scan.js":{"bytesInOutput":802},"../../packages/code-index/build/store/schema.js":{"bytesInOutput":2170},"../../packages/code-index/build/util/identifiers.js":{"bytesInOutput":1094},"../../packages/code-index/build/store/node-sqlite.js":{"bytesInOutput":9759},"src/local-tools/savings.ts":{"bytesInOutput":1926},"src/local-tools/token-estimate.ts":{"bytesInOutput":133},"src/local-tools/tools.ts":{"bytesInOutput":18691},"../../packages/code-index/build/index.js":{"bytesInOutput":34},"src/local-tools/router.ts":{"bytesInOutput":3828},"src/functions-origin.ts":{"bytesInOutput":259},"src/metrics-post.ts":{"bytesInOutput":1285}},"bytes":213518}}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maind-dev/mcp-bridge",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Local MCP bridge for maind.dev \u2014 wraps any MCP-compatible client (Claude Code, Cursor, Windsurf) and pins your API key to a single device via the maind device authorization flow.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./build/index.js",
|