@maind-dev/cli 0.8.1 → 0.9.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 CHANGED
@@ -1016,15 +1016,15 @@ function warn4(line) {
1016
1016
  }
1017
1017
 
1018
1018
  // src/index-cmd.ts
1019
- import { execFileSync as execFileSync4, spawnSync } from "node:child_process";
1020
- import { existsSync as existsSync2, mkdtempSync, rmSync, writeFileSync as writeFileSync3 } from "node:fs";
1019
+ import { execFileSync as execFileSync5, spawnSync } from "node:child_process";
1020
+ import { existsSync as existsSync3, mkdtempSync, rmSync, writeFileSync as writeFileSync3 } from "node:fs";
1021
1021
  import { tmpdir } from "node:os";
1022
1022
  import { dirname as dirname3, join as join4 } from "node:path";
1023
1023
  import { fileURLToPath } from "node:url";
1024
1024
 
1025
1025
  // ../../packages/code-index/build/node.js
1026
1026
  import { mkdirSync as mkdirSync3 } from "node:fs";
1027
- import { posix as posix4 } from "node:path";
1027
+ import { posix as posix5 } from "node:path";
1028
1028
 
1029
1029
  // ../../packages/code-index/build/parse/tree-sitter/parser.js
1030
1030
  import { join as join3 } from "node:path";
@@ -1431,8 +1431,8 @@ var TreeSitterParser = class {
1431
1431
  };
1432
1432
 
1433
1433
  // ../../packages/code-index/build/query/engine.js
1434
- import { readFileSync as readFileSync4 } from "node:fs";
1435
- import { posix as posix3 } from "node:path";
1434
+ import { readFileSync as readFileSync5 } from "node:fs";
1435
+ import { posix as posix4 } from "node:path";
1436
1436
 
1437
1437
  // ../../packages/code-index/build/embed/recipe.js
1438
1438
  var EMBED_RECIPE_VERSION = "1";
@@ -2015,6 +2015,357 @@ function readFileHistory(repoRoot2, paths, opts = {}) {
2015
2015
  };
2016
2016
  }
2017
2017
 
2018
+ // ../../packages/code-index/build/repo-health/divergence.js
2019
+ import { execFileSync as execFileSync4 } from "node:child_process";
2020
+ import { existsSync as existsSync2, readFileSync as readFileSync4 } from "node:fs";
2021
+ import { posix as posix3 } from "node:path";
2022
+ var DEFAULT_WORKTREE_PROBE_PATHS = [
2023
+ "supabase/config.toml",
2024
+ "supabase/.temp",
2025
+ ".env"
2026
+ ];
2027
+ var WORKTREE_REQUIREMENTS_RELPATH = ".maind/worktree-requirements";
2028
+ function computeDivergence(facts) {
2029
+ const out = [];
2030
+ if (!facts.isRepo)
2031
+ return out;
2032
+ const onFeatureBranch = facts.branch != null && facts.defaultBranch != null && facts.branch !== facts.defaultBranch && !facts.detachedHead;
2033
+ if (facts.detachedHead) {
2034
+ out.push({
2035
+ id: "worktree.detached-head",
2036
+ status: "warn",
2037
+ scope: "worktree",
2038
+ title: "Detached HEAD",
2039
+ detail: "HEAD points at a commit, not a branch \u2014 commits here are easily lost.",
2040
+ hint: "git switch -c <branch> to keep this work, or checkout an existing branch."
2041
+ });
2042
+ }
2043
+ if (onFeatureBranch) {
2044
+ if (facts.upstream == null) {
2045
+ out.push({
2046
+ id: "branch.no-upstream",
2047
+ status: "open",
2048
+ scope: "branch",
2049
+ title: "No upstream set",
2050
+ detail: `'${facts.branch}' tracks nothing \u2014 a plain 'git push' goes nowhere or to the wrong ref, with no error.`,
2051
+ hint: `git push -u origin ${facts.branch}`
2052
+ });
2053
+ } else {
2054
+ const upstreamBranch = facts.upstream.split("/").slice(1).join("/");
2055
+ if (upstreamBranch && upstreamBranch !== facts.branch) {
2056
+ out.push({
2057
+ id: "branch.upstream-mismatch",
2058
+ status: "open",
2059
+ scope: "branch",
2060
+ title: "Upstream points at a different branch",
2061
+ detail: `'${facts.branch}' tracks '${facts.upstream}' \u2014 pushes land on the wrong remote branch silently.`,
2062
+ hint: `git branch --set-upstream-to=origin/${facts.branch} (then push -u)`
2063
+ });
2064
+ }
2065
+ if (facts.remoteTrackingExists === false) {
2066
+ out.push({
2067
+ id: "branch.unpushed-missing-remote",
2068
+ status: "open",
2069
+ scope: "branch",
2070
+ title: "Branch not on remote",
2071
+ detail: `'${facts.branch}' has an upstream configured but no matching remote-tracking ref \u2014 the branch was never pushed.`,
2072
+ hint: `git push -u origin ${facts.branch}`
2073
+ });
2074
+ }
2075
+ }
2076
+ }
2077
+ const behind = facts.behind ?? 0;
2078
+ const ahead = facts.ahead ?? 0;
2079
+ if (behind > 0) {
2080
+ out.push({
2081
+ id: "branch.behind",
2082
+ status: "info",
2083
+ scope: "branch",
2084
+ title: "Behind base",
2085
+ detail: `${behind} commit(s) behind origin/${facts.defaultBranch}${ahead > 0 ? ` (and ${ahead} ahead)` : ""} \u2014 rebase/merge base before merging to avoid a stale PR.`,
2086
+ hint: `git fetch && git rebase origin/${facts.defaultBranch}`
2087
+ });
2088
+ }
2089
+ if (facts.upstream != null && facts.headMatchesUpstream === false) {
2090
+ out.push({
2091
+ id: "branch.unpushed-commits",
2092
+ status: "warn",
2093
+ scope: "branch",
2094
+ title: "Unpushed commits",
2095
+ detail: `Local HEAD is ahead of ${facts.upstream} \u2014 commits exist only on this machine.`,
2096
+ hint: "git push"
2097
+ });
2098
+ }
2099
+ if (facts.unmergedMigrations.length > 0) {
2100
+ const n = facts.unmergedMigrations.length;
2101
+ out.push({
2102
+ id: "branch.unmerged-migrations",
2103
+ status: "info",
2104
+ scope: "branch",
2105
+ title: "Migrations not yet on the base branch",
2106
+ detail: `${n} migration file(s) added on '${facts.branch}' are not on origin/${facts.defaultBranch} yet \u2014 a cloud DB push run from ${facts.defaultBranch} will NOT include them until this branch is merged.`,
2107
+ hint: `Merge to ${facts.defaultBranch} first (promote), then run 'supabase db push --linked' from ${facts.defaultBranch}.`
2108
+ });
2109
+ }
2110
+ if (facts.isSharedMainTree && facts.otherWorktrees > 0 && facts.uncommitted > 0 && !onFeatureBranch) {
2111
+ out.push({
2112
+ id: "worktree.direct-on-shared-base",
2113
+ status: "warn",
2114
+ scope: "worktree",
2115
+ title: "Uncommitted work on the shared base tree",
2116
+ 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.`,
2117
+ hint: "Move the work into a feature worktree (scripts/feature.sh start <name>)."
2118
+ });
2119
+ }
2120
+ if (facts.inProgressOp) {
2121
+ out.push({
2122
+ id: "worktree.in-progress-op",
2123
+ status: "warn",
2124
+ scope: "worktree",
2125
+ title: `${facts.inProgressOp} in progress`,
2126
+ detail: `A ${facts.inProgressOp} is mid-flight \u2014 git operations behave unexpectedly until it is finished or aborted.`,
2127
+ hint: `git ${facts.inProgressOp} --continue | --abort`
2128
+ });
2129
+ }
2130
+ if (facts.worktreeParity && facts.worktreeParity.missing.length > 0) {
2131
+ const miss = facts.worktreeParity.missing;
2132
+ out.push({
2133
+ id: "worktree.parity-missing",
2134
+ status: "open",
2135
+ scope: "worktree",
2136
+ title: "Tooling files missing vs main checkout",
2137
+ 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.`,
2138
+ hint: `Copy the missing file(s) from ${facts.worktreeParity.mainWorktreePath}, or declare them in ${WORKTREE_REQUIREMENTS_RELPATH}.`
2139
+ });
2140
+ }
2141
+ if (facts.release?.allRed) {
2142
+ out.push({
2143
+ id: "release.all-checks-red",
2144
+ status: "warn",
2145
+ scope: "release",
2146
+ title: "All checks failing \u2014 suspect account/billing/quota",
2147
+ 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).`,
2148
+ hint: "Check the CI provider's billing/spending status before debugging code."
2149
+ });
2150
+ }
2151
+ return sortFindings(out);
2152
+ }
2153
+ var STATUS_ORDER = { open: 0, warn: 1, info: 2, passed: 3 };
2154
+ function sortFindings(f) {
2155
+ return [...f].sort((a, b) => STATUS_ORDER[a.status] - STATUS_ORDER[b.status] || a.id.localeCompare(b.id));
2156
+ }
2157
+ function isHealthy(findings) {
2158
+ return !findings.some((x) => x.status === "open" || x.status === "warn");
2159
+ }
2160
+ function trimOrNull(s) {
2161
+ const t = s?.trim();
2162
+ return t ? t : null;
2163
+ }
2164
+ function resolveDefaultBranch2(repoRoot2) {
2165
+ const sym = trimOrNull(runGit(repoRoot2, ["symbolic-ref", "--quiet", "refs/remotes/origin/HEAD"]));
2166
+ if (sym) {
2167
+ const m = /refs\/remotes\/origin\/(.+)$/.exec(sym);
2168
+ if (m)
2169
+ return m[1];
2170
+ }
2171
+ for (const cand of ["main", "master"]) {
2172
+ if (runGit(repoRoot2, ["rev-parse", "--verify", "--quiet", `origin/${cand}`]) !== null)
2173
+ return cand;
2174
+ }
2175
+ return null;
2176
+ }
2177
+ function detectInProgressOp(repoRoot2) {
2178
+ const gitDir = trimOrNull(runGit(repoRoot2, ["rev-parse", "--git-dir"]));
2179
+ if (!gitDir)
2180
+ return null;
2181
+ const base = posix3.isAbsolute(gitDir) ? gitDir : posix3.join(repoRoot2, gitDir);
2182
+ if (existsSync2(posix3.join(base, "rebase-merge")) || existsSync2(posix3.join(base, "rebase-apply"))) {
2183
+ return "rebase";
2184
+ }
2185
+ if (existsSync2(posix3.join(base, "MERGE_HEAD")))
2186
+ return "merge";
2187
+ if (existsSync2(posix3.join(base, "CHERRY_PICK_HEAD")))
2188
+ return "cherry-pick";
2189
+ return null;
2190
+ }
2191
+ function parseWorktrees(raw) {
2192
+ const out = [];
2193
+ let cur = null;
2194
+ const flush = () => {
2195
+ if (cur?.path)
2196
+ out.push({ path: cur.path, branch: cur.branch, detached: cur.detached ?? false });
2197
+ };
2198
+ for (const line of raw.split("\n")) {
2199
+ if (line.startsWith("worktree ")) {
2200
+ flush();
2201
+ cur = { path: line.slice("worktree ".length).trim(), detached: false };
2202
+ } else if (!cur) {
2203
+ continue;
2204
+ } else if (line.startsWith("branch ")) {
2205
+ cur.branch = line.slice("branch ".length).trim().replace(/^refs\/heads\//, "");
2206
+ } else if (line.trim() === "detached") {
2207
+ cur.detached = true;
2208
+ }
2209
+ }
2210
+ flush();
2211
+ return out;
2212
+ }
2213
+ function readWorktreeRequirements(repoRoot2) {
2214
+ const p = posix3.join(repoRoot2, WORKTREE_REQUIREMENTS_RELPATH);
2215
+ if (!existsSync2(p))
2216
+ return [];
2217
+ try {
2218
+ return readFileSync4(p, "utf8").split("\n").map((l) => l.trim()).filter((l) => l.length > 0 && !l.startsWith("#"));
2219
+ } catch {
2220
+ return [];
2221
+ }
2222
+ }
2223
+ async function gatherRepoHealthFacts(repoRoot2, opts = {}) {
2224
+ const inside = trimOrNull(runGit(repoRoot2, ["rev-parse", "--is-inside-work-tree"]));
2225
+ if (inside !== "true") {
2226
+ return {
2227
+ isRepo: false,
2228
+ branch: null,
2229
+ defaultBranch: null,
2230
+ upstream: null,
2231
+ headMatchesUpstream: null,
2232
+ remoteTrackingExists: null,
2233
+ ahead: null,
2234
+ behind: null,
2235
+ uncommitted: 0,
2236
+ detachedHead: false,
2237
+ inProgressOp: null,
2238
+ isSharedMainTree: false,
2239
+ otherWorktrees: 0,
2240
+ worktreeParity: null,
2241
+ release: null,
2242
+ unmergedMigrations: []
2243
+ };
2244
+ }
2245
+ const branchRaw = trimOrNull(runGit(repoRoot2, ["rev-parse", "--abbrev-ref", "HEAD"]));
2246
+ const detachedHead = branchRaw === "HEAD";
2247
+ const branch = detachedHead ? null : branchRaw;
2248
+ const defaultBranch = resolveDefaultBranch2(repoRoot2);
2249
+ const upstream = trimOrNull(runGit(repoRoot2, ["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"]));
2250
+ let headMatchesUpstream = null;
2251
+ let remoteTrackingExists = null;
2252
+ if (upstream) {
2253
+ const head = trimOrNull(runGit(repoRoot2, ["rev-parse", "HEAD"]));
2254
+ const up = trimOrNull(runGit(repoRoot2, ["rev-parse", "@{u}"]));
2255
+ headMatchesUpstream = head != null && up != null ? head === up : null;
2256
+ remoteTrackingExists = runGit(repoRoot2, ["rev-parse", "--verify", "--quiet", `refs/remotes/${upstream}`]) !== null;
2257
+ }
2258
+ let ahead = null;
2259
+ let behind = null;
2260
+ if (defaultBranch) {
2261
+ const counts = trimOrNull(runGit(repoRoot2, ["rev-list", "--left-right", "--count", `origin/${defaultBranch}...HEAD`]));
2262
+ if (counts) {
2263
+ const [b, a] = counts.split(/\s+/).map((n) => Number.parseInt(n, 10));
2264
+ if (Number.isFinite(b))
2265
+ behind = b;
2266
+ if (Number.isFinite(a))
2267
+ ahead = a;
2268
+ }
2269
+ }
2270
+ const porcelain = runGit(repoRoot2, ["status", "--porcelain"]) ?? "";
2271
+ const uncommitted = porcelain.split("\n").filter((l) => l.trim().length > 0).length;
2272
+ const inProgressOp = detectInProgressOp(repoRoot2);
2273
+ const toplevel = trimOrNull(runGit(repoRoot2, ["rev-parse", "--show-toplevel"])) ?? repoRoot2;
2274
+ const worktrees = parseWorktrees(runGit(repoRoot2, ["worktree", "list", "--porcelain"]) ?? "");
2275
+ const mainWorktree = worktrees[0]?.path ?? null;
2276
+ const isSharedMainTree = mainWorktree != null && samePath(mainWorktree, toplevel);
2277
+ const otherWorktrees = Math.max(0, worktrees.length - 1);
2278
+ let worktreeParity = null;
2279
+ if (mainWorktree && !samePath(mainWorktree, toplevel)) {
2280
+ const probes = [
2281
+ ...DEFAULT_WORKTREE_PROBE_PATHS,
2282
+ ...readWorktreeRequirements(toplevel),
2283
+ ...opts.probePaths ?? []
2284
+ ];
2285
+ const missing = probes.filter((rel) => existsSync2(posix3.join(mainWorktree, rel)) && !existsSync2(posix3.join(toplevel, rel)));
2286
+ worktreeParity = {
2287
+ mainWorktreePath: mainWorktree,
2288
+ currentWorktreePath: toplevel,
2289
+ missing: [...new Set(missing)]
2290
+ };
2291
+ }
2292
+ const release = opts.includeRelease === false ? null : gatherReleaseFact(repoRoot2, branch);
2293
+ let unmergedMigrations = [];
2294
+ if (defaultBranch) {
2295
+ const raw = runGit(repoRoot2, [
2296
+ "diff",
2297
+ "--name-only",
2298
+ "--diff-filter=A",
2299
+ `origin/${defaultBranch}...HEAD`,
2300
+ "--",
2301
+ "*supabase/migrations/*.sql"
2302
+ ]);
2303
+ unmergedMigrations = (raw ?? "").split("\n").map((l) => l.trim()).filter((l) => l.length > 0);
2304
+ }
2305
+ return {
2306
+ isRepo: true,
2307
+ branch,
2308
+ defaultBranch,
2309
+ upstream,
2310
+ headMatchesUpstream,
2311
+ remoteTrackingExists,
2312
+ ahead,
2313
+ behind,
2314
+ uncommitted,
2315
+ detachedHead,
2316
+ inProgressOp,
2317
+ isSharedMainTree,
2318
+ otherWorktrees,
2319
+ worktreeParity,
2320
+ release,
2321
+ unmergedMigrations
2322
+ };
2323
+ }
2324
+ function samePath(a, b) {
2325
+ const norm = (p) => p.replace(/\/+$/, "");
2326
+ return norm(a) === norm(b);
2327
+ }
2328
+ function gatherReleaseFact(repoRoot2, branch) {
2329
+ if (!branch)
2330
+ return null;
2331
+ const raw = runGh(repoRoot2, ["pr", "checks", branch, "--json", "bucket"]);
2332
+ if (raw == null)
2333
+ return null;
2334
+ let rows;
2335
+ try {
2336
+ rows = JSON.parse(raw);
2337
+ } catch {
2338
+ return null;
2339
+ }
2340
+ if (rows.length === 0)
2341
+ return { prNumber: null, totalChecks: 0, failedChecks: 0, allRed: false };
2342
+ const failed = rows.filter((r) => r.bucket === "fail").length;
2343
+ return {
2344
+ prNumber: null,
2345
+ totalChecks: rows.length,
2346
+ failedChecks: failed,
2347
+ allRed: failed === rows.length && rows.length > 0
2348
+ };
2349
+ }
2350
+ function runGh(repoRoot2, args) {
2351
+ try {
2352
+ return execFileSync4("gh", args, {
2353
+ cwd: repoRoot2,
2354
+ encoding: "utf8",
2355
+ stdio: ["ignore", "pipe", "ignore"],
2356
+ timeout: 1e4,
2357
+ maxBuffer: 8 * 1024 * 1024
2358
+ });
2359
+ } catch {
2360
+ return null;
2361
+ }
2362
+ }
2363
+ async function checkDivergence(repoRoot2, opts = {}) {
2364
+ const facts = await gatherRepoHealthFacts(repoRoot2, opts);
2365
+ const findings = computeDivergence(facts);
2366
+ return { ok: isHealthy(findings), findings, facts };
2367
+ }
2368
+
2018
2369
  // ../../packages/code-index/build/review/risk-rules.js
2019
2370
  var RISK_RULES = [
2020
2371
  {
@@ -2403,7 +2754,7 @@ var CodeIndexEngine = class {
2403
2754
  return null;
2404
2755
  let source = "";
2405
2756
  try {
2406
- const full = readFileSync4(posix3.join(this.repoRoot, n.filePath), "utf8");
2757
+ const full = readFileSync5(posix4.join(this.repoRoot, n.filePath), "utf8");
2407
2758
  source = full.slice(n.startByte, n.endByte);
2408
2759
  } catch {
2409
2760
  return null;
@@ -2471,6 +2822,9 @@ var CodeIndexEngine = class {
2471
2822
  }
2472
2823
  return readFileHistory(this.repoRoot, paths, opts);
2473
2824
  }
2825
+ async checkDivergence(opts = {}) {
2826
+ return checkDivergence(this.repoRoot, opts);
2827
+ }
2474
2828
  async reviewChanges(opts = {}) {
2475
2829
  await this.store.init();
2476
2830
  const rawPaths = enumerateChangedPaths(this.repoRoot, opts);
@@ -2534,7 +2888,7 @@ var CodeIndexEngine = class {
2534
2888
  }
2535
2889
  readRepoFile(relPath) {
2536
2890
  try {
2537
- return readFileSync4(posix3.join(this.repoRoot, relPath), "utf8");
2891
+ return readFileSync5(posix4.join(this.repoRoot, relPath), "utf8");
2538
2892
  } catch {
2539
2893
  return null;
2540
2894
  }
@@ -3108,8 +3462,8 @@ function numOr0(v) {
3108
3462
  // ../../packages/code-index/build/node.js
3109
3463
  var DEFAULT_DB_RELPATH = ".maind/code-index.sqlite";
3110
3464
  function createNodeCodeIndex(opts) {
3111
- const dbPath = opts.dbPath ?? posix4.join(opts.repoRoot, DEFAULT_DB_RELPATH);
3112
- mkdirSync3(posix4.dirname(dbPath), { recursive: true });
3465
+ const dbPath = opts.dbPath ?? posix5.join(opts.repoRoot, DEFAULT_DB_RELPATH);
3466
+ mkdirSync3(posix5.dirname(dbPath), { recursive: true });
3113
3467
  const store = new NodeSqliteStore(dbPath);
3114
3468
  const parser = new TreeSitterParser();
3115
3469
  return new CodeIndexEngine({
@@ -3120,7 +3474,7 @@ function createNodeCodeIndex(opts) {
3120
3474
  });
3121
3475
  }
3122
3476
  function createCodeIndexSync(opts) {
3123
- const dbPath = opts.dbPath ?? posix4.join(opts.repoRoot, DEFAULT_DB_RELPATH);
3477
+ const dbPath = opts.dbPath ?? posix5.join(opts.repoRoot, DEFAULT_DB_RELPATH);
3124
3478
  const projectKey = opts.projectKey ?? computeProjectKey(opts.repoRoot) ?? void 0;
3125
3479
  if (!projectKey) {
3126
3480
  throw new Error("No project_key \u2014 the repo has no git remote. Cloud sync scopes by sha256(remote); commit a remote or pass an explicit key.");
@@ -3209,7 +3563,7 @@ function runOrtIsolated(argv) {
3209
3563
  stdio: ["ignore", "inherit", "inherit"],
3210
3564
  env: { ...process.env, [OK_FILE_ENV]: okFile }
3211
3565
  });
3212
- const ok = existsSync2(okFile);
3566
+ const ok = existsSync3(okFile);
3213
3567
  try {
3214
3568
  rmSync(dirname3(okFile), { recursive: true, force: true });
3215
3569
  } catch {
@@ -3237,7 +3591,7 @@ function value(argv, name) {
3237
3591
  function resolveRoot(explicit) {
3238
3592
  if (explicit) return explicit;
3239
3593
  try {
3240
- return execFileSync4("git", ["rev-parse", "--show-toplevel"], {
3594
+ return execFileSync5("git", ["rev-parse", "--show-toplevel"], {
3241
3595
  encoding: "utf8",
3242
3596
  stdio: ["ignore", "pipe", "ignore"]
3243
3597
  }).trim();
@@ -3412,13 +3766,26 @@ async function runIndexArch(opts) {
3412
3766
  }
3413
3767
 
3414
3768
  // src/review.ts
3415
- import { execFileSync as execFileSync5 } from "node:child_process";
3769
+ import { execFileSync as execFileSync6 } from "node:child_process";
3416
3770
  import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync4 } from "node:fs";
3417
3771
  import { dirname as dirname4 } from "node:path";
3418
3772
 
3419
3773
  // ../../packages/code-index/build/index.js
3420
3774
  var CODE_INDEX_VERSION = "0.1.0";
3421
3775
 
3776
+ // src/version.ts
3777
+ import { createRequire as createRequire2 } from "node:module";
3778
+ function resolveVersion() {
3779
+ if (true) return "0.9.0";
3780
+ try {
3781
+ const require2 = createRequire2(import.meta.url);
3782
+ return require2("../package.json").version;
3783
+ } catch {
3784
+ return "0.0.0-unknown";
3785
+ }
3786
+ }
3787
+ var VERSION = resolveVersion();
3788
+
3422
3789
  // src/review-render.ts
3423
3790
  var COMMENT_MARKER = "<!-- maind-review -->";
3424
3791
  var COMMENT_FINDINGS_CAP = 30;
@@ -3655,7 +4022,7 @@ function renderFailOpenComment(meta, reason) {
3655
4022
 
3656
4023
  // src/review.ts
3657
4024
  var PROJECT_KEY_RE3 = /^[a-f0-9]{64}$/;
3658
- var CLI_CLIENT_VERSION = "0.7.0";
4025
+ var CLI_CLIENT_VERSION = VERSION;
3659
4026
  var DEFAULT_COMMENT_PATH = ".maind/review-comment.md";
3660
4027
  var SYMBOL_CAP = 64;
3661
4028
  function parseReviewArgs(argv) {
@@ -3721,7 +4088,7 @@ function buildDiffStats(result) {
3721
4088
  }
3722
4089
  function resolveRepoRoot() {
3723
4090
  try {
3724
- return execFileSync5("git", ["rev-parse", "--show-toplevel"], {
4091
+ return execFileSync6("git", ["rev-parse", "--show-toplevel"], {
3725
4092
  encoding: "utf8",
3726
4093
  stdio: ["ignore", "pipe", "ignore"]
3727
4094
  }).trim();
@@ -3744,12 +4111,14 @@ async function runReview(opts) {
3744
4111
  if (opts.failOn && !opts.gate) {
3745
4112
  warn5("--fail-on has no effect without --gate (advisory runs always exit 0).");
3746
4113
  }
3747
- const failOpen = (reason) => {
3748
- warn5(`review unavailable, ${opts.strict ? "failing (--strict)" : "continuing"}: ${reason}`);
4114
+ const failOpen = (reason, klass = "infra") => {
4115
+ const hard = opts.strict && klass === "infra";
4116
+ warn5(`review unavailable, ${hard ? "failing (--strict)" : "continuing"}: ${reason}`);
3749
4117
  try {
3750
4118
  writeArtifact3(opts.out, renderFailOpenReview(meta, reason));
3751
4119
  const manifest = buildReviewManifest({}, null, meta);
3752
4120
  manifest.error = reason;
4121
+ manifest.error_class = klass;
3753
4122
  writeArtifact3(manifestPathFor(opts.out), JSON.stringify(manifest, null, 2) + "\n");
3754
4123
  if (opts.comment) writeArtifact3(opts.comment, renderFailOpenComment(meta, reason));
3755
4124
  if (opts.json) process.stdout.write(JSON.stringify(manifest, null, 2) + "\n");
@@ -3757,12 +4126,12 @@ async function runReview(opts) {
3757
4126
  warn5(`could not write fail-open artifacts: ${msg5(writeErr)}`);
3758
4127
  return opts.strict ? 2 : 1;
3759
4128
  }
3760
- return opts.strict ? 2 : 0;
4129
+ return hard ? 2 : 0;
3761
4130
  };
3762
4131
  try {
3763
4132
  const root = resolveRepoRoot();
3764
4133
  if (!root) {
3765
- return failOpen("not a git repository \u2014 review is diff-based.");
4134
+ return failOpen("not a git repository \u2014 review is diff-based.", "expected");
3766
4135
  }
3767
4136
  const engine = createNodeCodeIndex({ repoRoot: root });
3768
4137
  let result;
@@ -3843,7 +4212,8 @@ async function runReview(opts) {
3843
4212
  const review = await client.callTool("review_changes", reviewArgs);
3844
4213
  if (review.ok !== true || !review.review) {
3845
4214
  return failOpen(
3846
- `review_changes rejected: ${review.error ?? "unknown_error"}${review.message ? ` \u2014 ${review.message}` : ""}`
4215
+ `review_changes rejected: ${review.error ?? "unknown_error"}${review.message ? ` \u2014 ${review.message}` : ""}`,
4216
+ classifyServerError(review.error)
3847
4217
  );
3848
4218
  }
3849
4219
  let verdict = null;
@@ -3875,9 +4245,11 @@ async function runReview(opts) {
3875
4245
  );
3876
4246
  verdict = null;
3877
4247
  } else {
3878
- if (opts.strict) {
4248
+ const klass = classifyServerError(verdict.error);
4249
+ if (opts.strict && klass === "infra") {
3879
4250
  return failOpen(
3880
- `review_verdict failed: ${verdict.error ?? "unknown_error"}${verdict.message ? ` \u2014 ${verdict.message}` : ""}`
4251
+ `review_verdict failed: ${verdict.error ?? "unknown_error"}${verdict.message ? ` \u2014 ${verdict.message}` : ""}`,
4252
+ klass
3881
4253
  );
3882
4254
  }
3883
4255
  warn5(
@@ -3887,7 +4259,7 @@ async function runReview(opts) {
3887
4259
  }
3888
4260
  }
3889
4261
  } catch (err2) {
3890
- if (opts.strict) return failOpen(`review_verdict failed: ${msg5(err2)}`);
4262
+ if (opts.strict) return failOpen(`review_verdict failed: ${msg5(err2)}`, "infra");
3891
4263
  warn5(`gate unavailable (continuing advisory): ${msg5(err2)}`);
3892
4264
  verdict = null;
3893
4265
  }
@@ -3910,10 +4282,21 @@ async function runReview(opts) {
3910
4282
  }
3911
4283
  return 0;
3912
4284
  } catch (err2) {
3913
- const reason = err2 instanceof MissingApiKeyError ? err2.message : msg5(err2);
3914
- return failOpen(reason);
4285
+ if (err2 instanceof MissingApiKeyError) return failOpen(err2.message, "expected");
4286
+ return failOpen(msg5(err2), "infra");
3915
4287
  }
3916
4288
  }
4289
+ var EXPECTED_SERVER_ERRORS = /* @__PURE__ */ new Set([
4290
+ "unauthorized",
4291
+ "invalid_api_key",
4292
+ "requires_team",
4293
+ "requires_enterprise",
4294
+ "scope_not_in_plan",
4295
+ "rate_limited"
4296
+ ]);
4297
+ function classifyServerError(code) {
4298
+ return code && EXPECTED_SERVER_ERRORS.has(code) ? "expected" : "infra";
4299
+ }
3917
4300
  function writeAll(review, verdict, meta, opts) {
3918
4301
  writeArtifact3(opts.out, renderReviewMarkdown(review, verdict, meta));
3919
4302
  const manifest = buildReviewManifest(review, verdict, meta);
@@ -3932,7 +4315,7 @@ function warn5(line) {
3932
4315
  }
3933
4316
 
3934
4317
  // src/sync-cmd.ts
3935
- import { execFileSync as execFileSync6 } from "node:child_process";
4318
+ import { execFileSync as execFileSync7 } from "node:child_process";
3936
4319
  var CONSENT_POLICY_VERSION = "2026-07-05";
3937
4320
  var DEFAULT_DASHBOARD_URL = "https://app.maind.dev";
3938
4321
  function err(line) {
@@ -3941,7 +4324,7 @@ function err(line) {
3941
4324
  }
3942
4325
  function repoRoot() {
3943
4326
  try {
3944
- return execFileSync6("git", ["rev-parse", "--show-toplevel"], { encoding: "utf8" }).trim();
4327
+ return execFileSync7("git", ["rev-parse", "--show-toplevel"], { encoding: "utf8" }).trim();
3945
4328
  } catch {
3946
4329
  return process.cwd();
3947
4330
  }
@@ -4054,7 +4437,6 @@ async function push(sync, json) {
4054
4437
  }
4055
4438
 
4056
4439
  // src/index.ts
4057
- var VERSION = "0.7.0";
4058
4440
  var HELP = `maind ${VERSION} \u2014 headless maind CLI for CI + git context
4059
4441
 
4060
4442
  Usage:
@@ -4086,7 +4468,10 @@ review options (advisory by default \u2014 exits 0 unless --gate + --fail-on):
4086
4468
  --json Print the review manifest JSON to stdout (pipeable)
4087
4469
  --gate Aggregate findings into a server-side pass|warn|block verdict (Team plan)
4088
4470
  --fail-on block|warn With --gate: exit 1 when the verdict crosses this threshold
4089
- --strict Infra errors exit 2 instead of failing open with exit 0
4471
+ --strict Infra errors (native module / transport / unexpected server
4472
+ error) exit 2 instead of failing open with exit 0. Expected
4473
+ unavailability \u2014 missing or unauthorized API key, rate limit,
4474
+ non-git dir \u2014 still exits 0 with a loud warning.
4090
4475
  --no-report With --gate: omit the commit anchors so the server does NOT
4091
4476
  persist a review_runs attestation record (ADR-230) \u2014 the
4092
4477
  verdict is then advisory-only, without a replayable proof
package/build/meta.json CHANGED
@@ -1 +1 @@
1
- {"inputs":{"src/auth.ts":{"bytes":3441,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/mcp-client.ts":{"bytes":8724,"imports":[],"format":"esm"},"src/render.ts":{"bytes":4525,"imports":[],"format":"esm"},"src/context.ts":{"bytes":6805,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/auth.ts","kind":"import-statement","original":"./auth.js"},{"path":"src/mcp-client.ts","kind":"import-statement","original":"./mcp-client.js"},{"path":"src/render.ts","kind":"import-statement","original":"./render.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"},"src/git.ts":{"bytes":5748,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"../../packages/project-key/build/index.js","kind":"import-statement","original":"@maind/project-key"},{"path":"../../packages/project-key/build/index.js","kind":"import-statement","original":"@maind/project-key"}],"format":"esm"},"src/ci-report.ts":{"bytes":6631,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"src/auth.ts","kind":"import-statement","original":"./auth.js"},{"path":"src/git.ts","kind":"import-statement","original":"./git.js"}],"format":"esm"},"src/ci-result.ts":{"bytes":5483,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"src/auth.ts","kind":"import-statement","original":"./auth.js"}],"format":"esm"},"src/git-context.ts":{"bytes":9481,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/auth.ts","kind":"import-statement","original":"./auth.js"},{"path":"src/mcp-client.ts","kind":"import-statement","original":"./mcp-client.js"},{"path":"src/git.ts","kind":"import-statement","original":"./git.js"}],"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/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":20068,"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"},"../../packages/embedding/build/index.js":{"bytes":6053,"imports":[{"path":"@huggingface/transformers","kind":"dynamic-import","external":true}],"format":"esm"},"../../packages/code-index/build/embed/node.js":{"bytes":661,"imports":[{"path":"../../packages/embedding/build/index.js","kind":"import-statement","original":"@maind/embedding"},{"path":"../../packages/code-index/build/embed/recipe.js","kind":"import-statement","original":"./recipe.js"}],"format":"esm"},"../../packages/code-index/build/node-embed.js":{"bytes":660,"imports":[{"path":"../../packages/code-index/build/embed/node.js","kind":"import-statement","original":"./embed/node.js"}],"format":"esm"},"src/index-cmd.ts":{"bytes":9353,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"../../packages/code-index/build/node.js","kind":"import-statement","original":"@maind/code-index/node"},{"path":"../../packages/code-index/build/node-embed.js","kind":"import-statement","original":"@maind/code-index/node-embed"}],"format":"esm"},"../../packages/code-index/build/model/types.js":{"bytes":471,"imports":[],"format":"esm"},"../../packages/code-index/build/index.js":{"bytes":1359,"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/review-render.ts":{"bytes":15157,"imports":[],"format":"esm"},"src/review.ts":{"bytes":16955,"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/node.js","kind":"import-statement","original":"@maind/code-index/node"},{"path":"../../packages/code-index/build/index.js","kind":"import-statement","original":"@maind/code-index"},{"path":"src/auth.ts","kind":"import-statement","original":"./auth.js"},{"path":"src/git.ts","kind":"import-statement","original":"./git.js"},{"path":"src/mcp-client.ts","kind":"import-statement","original":"./mcp-client.js"},{"path":"src/review-render.ts","kind":"import-statement","original":"./review-render.js"}],"format":"esm"},"src/sync-cmd.ts":{"bytes":5243,"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"},{"path":"src/auth.ts","kind":"import-statement","original":"./auth.js"}],"format":"esm"},"src/index.ts":{"bytes":9745,"imports":[{"path":"src/context.ts","kind":"import-statement","original":"./context.js"},{"path":"src/ci-report.ts","kind":"import-statement","original":"./ci-report.js"},{"path":"src/ci-result.ts","kind":"import-statement","original":"./ci-result.js"},{"path":"src/git-context.ts","kind":"import-statement","original":"./git-context.js"},{"path":"src/git.ts","kind":"import-statement","original":"./git.js"},{"path":"src/index-cmd.ts","kind":"import-statement","original":"./index-cmd.js"},{"path":"src/review.ts","kind":"import-statement","original":"./review.js"},{"path":"src/sync-cmd.ts","kind":"import-statement","original":"./sync-cmd.js"}],"format":"esm"}},"outputs":{"build/index.js":{"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:fs","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:fs","kind":"import-statement","external":true},{"path":"node:child_process","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: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:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:url","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:crypto","kind":"import-statement","external":true},{"path":"@huggingface/transformers","kind":"dynamic-import","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:child_process","kind":"import-statement","external":true}],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/context.ts":{"bytesInOutput":4644},"src/auth.ts":{"bytesInOutput":1609},"src/mcp-client.ts":{"bytesInOutput":5955},"src/render.ts":{"bytesInOutput":2406},"src/ci-report.ts":{"bytesInOutput":4467},"src/git.ts":{"bytesInOutput":3325},"../../packages/project-key/build/index.js":{"bytesInOutput":1449},"src/ci-result.ts":{"bytesInOutput":3848},"src/git-context.ts":{"bytesInOutput":6854},"src/index-cmd.ts":{"bytesInOutput":6717},"../../packages/code-index/build/node.js":{"bytesInOutput":1159},"../../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":4721},"../../packages/code-index/build/parse/tree-sitter/grammars.js":{"bytesInOutput":523},"../../packages/code-index/build/query/engine.js":{"bytesInOutput":14425},"../../packages/code-index/build/embed/recipe.js":{"bytesInOutput":229},"../../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":2486},"../../packages/code-index/build/incremental/discover.js":{"bytesInOutput":4855},"../../packages/code-index/build/incremental/hunks.js":{"bytesInOutput":3951},"../../packages/code-index/build/incremental/history.js":{"bytesInOutput":4531},"../../packages/code-index/build/review/risk-rules.js":{"bytesInOutput":876},"../../packages/code-index/build/review/risk-scan.js":{"bytesInOutput":798},"../../packages/code-index/build/store/schema.js":{"bytesInOutput":2266},"../../packages/code-index/build/util/identifiers.js":{"bytesInOutput":1094},"../../packages/code-index/build/store/node-sqlite.js":{"bytesInOutput":9751},"../../packages/code-index/build/sync/types.js":{"bytesInOutput":875},"../../packages/code-index/build/sync/client.js":{"bytesInOutput":7568},"../../packages/embedding/build/index.js":{"bytesInOutput":1293},"../../packages/code-index/build/embed/node.js":{"bytesInOutput":288},"../../packages/code-index/build/node-embed.js":{"bytesInOutput":63},"src/review.ts":{"bytesInOutput":11152},"../../packages/code-index/build/index.js":{"bytesInOutput":34},"src/review-render.ts":{"bytesInOutput":8227},"src/sync-cmd.ts":{"bytesInOutput":3860},"src/index.ts":{"bytesInOutput":7760}},"bytes":144168}}}
1
+ {"inputs":{"src/auth.ts":{"bytes":3441,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/mcp-client.ts":{"bytes":8724,"imports":[],"format":"esm"},"src/render.ts":{"bytes":4525,"imports":[],"format":"esm"},"src/context.ts":{"bytes":6805,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/auth.ts","kind":"import-statement","original":"./auth.js"},{"path":"src/mcp-client.ts","kind":"import-statement","original":"./mcp-client.js"},{"path":"src/render.ts","kind":"import-statement","original":"./render.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"},"src/git.ts":{"bytes":5748,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"../../packages/project-key/build/index.js","kind":"import-statement","original":"@maind/project-key"},{"path":"../../packages/project-key/build/index.js","kind":"import-statement","original":"@maind/project-key"}],"format":"esm"},"src/ci-report.ts":{"bytes":6631,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"src/auth.ts","kind":"import-statement","original":"./auth.js"},{"path":"src/git.ts","kind":"import-statement","original":"./git.js"}],"format":"esm"},"src/ci-result.ts":{"bytes":5483,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"src/auth.ts","kind":"import-statement","original":"./auth.js"}],"format":"esm"},"src/git-context.ts":{"bytes":9481,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/auth.ts","kind":"import-statement","original":"./auth.js"},{"path":"src/mcp-client.ts","kind":"import-statement","original":"./mcp-client.js"},{"path":"src/git.ts","kind":"import-statement","original":"./git.js"}],"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":18968,"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"},"../../packages/embedding/build/index.js":{"bytes":6053,"imports":[{"path":"@huggingface/transformers","kind":"dynamic-import","external":true}],"format":"esm"},"../../packages/code-index/build/embed/node.js":{"bytes":661,"imports":[{"path":"../../packages/embedding/build/index.js","kind":"import-statement","original":"@maind/embedding"},{"path":"../../packages/code-index/build/embed/recipe.js","kind":"import-statement","original":"./recipe.js"}],"format":"esm"},"../../packages/code-index/build/node-embed.js":{"bytes":660,"imports":[{"path":"../../packages/code-index/build/embed/node.js","kind":"import-statement","original":"./embed/node.js"}],"format":"esm"},"src/index-cmd.ts":{"bytes":9353,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"../../packages/code-index/build/node.js","kind":"import-statement","original":"@maind/code-index/node"},{"path":"../../packages/code-index/build/node-embed.js","kind":"import-statement","original":"@maind/code-index/node-embed"}],"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/version.ts":{"bytes":1857,"imports":[{"path":"node:module","kind":"import-statement","external":true}],"format":"esm"},"src/review-render.ts":{"bytes":15717,"imports":[],"format":"esm"},"src/review.ts":{"bytes":20018,"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/node.js","kind":"import-statement","original":"@maind/code-index/node"},{"path":"../../packages/code-index/build/index.js","kind":"import-statement","original":"@maind/code-index"},{"path":"src/auth.ts","kind":"import-statement","original":"./auth.js"},{"path":"src/version.ts","kind":"import-statement","original":"./version.js"},{"path":"src/git.ts","kind":"import-statement","original":"./git.js"},{"path":"src/mcp-client.ts","kind":"import-statement","original":"./mcp-client.js"},{"path":"src/review-render.ts","kind":"import-statement","original":"./review-render.js"}],"format":"esm"},"src/sync-cmd.ts":{"bytes":5243,"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"},{"path":"src/auth.ts","kind":"import-statement","original":"./auth.js"}],"format":"esm"},"src/index.ts":{"bytes":10073,"imports":[{"path":"src/context.ts","kind":"import-statement","original":"./context.js"},{"path":"src/ci-report.ts","kind":"import-statement","original":"./ci-report.js"},{"path":"src/ci-result.ts","kind":"import-statement","original":"./ci-result.js"},{"path":"src/git-context.ts","kind":"import-statement","original":"./git-context.js"},{"path":"src/git.ts","kind":"import-statement","original":"./git.js"},{"path":"src/index-cmd.ts","kind":"import-statement","original":"./index-cmd.js"},{"path":"src/review.ts","kind":"import-statement","original":"./review.js"},{"path":"src/sync-cmd.ts","kind":"import-statement","original":"./sync-cmd.js"},{"path":"src/version.ts","kind":"import-statement","original":"./version.js"}],"format":"esm"}},"outputs":{"build/index.js":{"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:fs","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:fs","kind":"import-statement","external":true},{"path":"node:child_process","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: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:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:url","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:crypto","kind":"import-statement","external":true},{"path":"@huggingface/transformers","kind":"dynamic-import","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:module","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true}],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/context.ts":{"bytesInOutput":4644},"src/auth.ts":{"bytesInOutput":1609},"src/mcp-client.ts":{"bytesInOutput":5955},"src/render.ts":{"bytesInOutput":2406},"src/ci-report.ts":{"bytesInOutput":4467},"src/git.ts":{"bytesInOutput":3325},"../../packages/project-key/build/index.js":{"bytesInOutput":1449},"src/ci-result.ts":{"bytesInOutput":3848},"src/git-context.ts":{"bytesInOutput":6854},"src/index-cmd.ts":{"bytesInOutput":6717},"../../packages/code-index/build/node.js":{"bytesInOutput":1159},"../../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":4721},"../../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":229},"../../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":2486},"../../packages/code-index/build/incremental/discover.js":{"bytesInOutput":4855},"../../packages/code-index/build/incremental/hunks.js":{"bytesInOutput":3951},"../../packages/code-index/build/incremental/history.js":{"bytesInOutput":4531},"../../packages/code-index/build/repo-health/divergence.js":{"bytesInOutput":12952},"../../packages/code-index/build/review/risk-rules.js":{"bytesInOutput":876},"../../packages/code-index/build/review/risk-scan.js":{"bytesInOutput":798},"../../packages/code-index/build/store/schema.js":{"bytesInOutput":2266},"../../packages/code-index/build/util/identifiers.js":{"bytesInOutput":1094},"../../packages/code-index/build/store/node-sqlite.js":{"bytesInOutput":9751},"../../packages/code-index/build/sync/types.js":{"bytesInOutput":875},"../../packages/code-index/build/sync/client.js":{"bytesInOutput":7568},"../../packages/embedding/build/index.js":{"bytesInOutput":1293},"../../packages/code-index/build/embed/node.js":{"bytesInOutput":288},"../../packages/code-index/build/node-embed.js":{"bytesInOutput":63},"src/review.ts":{"bytesInOutput":11724},"../../packages/code-index/build/index.js":{"bytesInOutput":34},"src/version.ts":{"bytesInOutput":307},"src/review-render.ts":{"bytesInOutput":8227},"src/sync-cmd.ts":{"bytesInOutput":3860},"src/index.ts":{"bytesInOutput":7997}},"bytes":158407}}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maind-dev/cli",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "description": "Headless maind CLI — pull stack-relevant lessons into CI runners, report CI outcomes, and brief agents on local git state (branch, PRs, peers). No device flow; authenticates from MAIND_API_KEY.",
5
5
  "type": "module",
6
6
  "main": "./build/index.js",