@dosu/cli 0.63.0 → 0.64.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.
Files changed (3) hide show
  1. package/README.md +5 -3
  2. package/bin/dosu.js +552 -332
  3. package/package.json +1 -1
package/bin/dosu.js CHANGED
@@ -1083,7 +1083,7 @@ function isNpxInvocation(channel = INSTALL_CHANNEL, env = process.env) {
1083
1083
  function getVersionString() {
1084
1084
  return `v${VERSION}`;
1085
1085
  }
1086
- var VERSION = "0.63.0", INSTALL_CHANNEL = "npm";
1086
+ var VERSION = "0.64.0", INSTALL_CHANNEL = "npm";
1087
1087
 
1088
1088
  // src/debug/logger.ts
1089
1089
  import {
@@ -1501,22 +1501,33 @@ function normalizeRepoRemote(remote) {
1501
1501
  const lowerHost = host.toLowerCase();
1502
1502
  return `${lowerHost}/${lowerHost === "github.com" ? path.toLowerCase() : path}`;
1503
1503
  }
1504
- function originRepoOfDir(dir) {
1504
+ function gitOutput(dir, args, timeout) {
1505
1505
  const env = { ...process.env };
1506
1506
  for (const name of GIT_LOCATION_ENV)
1507
1507
  delete env[name];
1508
1508
  try {
1509
- const out = execFileSync("git", ["-C", dir, "remote", "get-url", "origin"], {
1509
+ return execFileSync("git", ["-C", dir, ...args], {
1510
1510
  encoding: "utf-8",
1511
1511
  env,
1512
1512
  stdio: ["ignore", "pipe", "ignore"],
1513
- timeout: 1000
1513
+ timeout,
1514
+ maxBuffer: 16 * 1024 * 1024
1514
1515
  });
1515
- return normalizeRepoRemote(out);
1516
1516
  } catch {
1517
1517
  return null;
1518
1518
  }
1519
1519
  }
1520
+ function originRepoOfDir(dir) {
1521
+ const out = gitOutput(dir, ["remote", "get-url", "origin"], 1000);
1522
+ return out === null ? null : normalizeRepoRemote(out);
1523
+ }
1524
+ function currentBranchOfDir(dir) {
1525
+ const out = gitOutput(dir, ["symbolic-ref", "--short", "-q", "HEAD"], 1000)?.trim();
1526
+ return out ? out : null;
1527
+ }
1528
+ function headReflogOfDir(dir) {
1529
+ return gitOutput(dir, ["reflog", "show", "--date=unix", "--format=%gd%x09%gs", "HEAD"], 5000);
1530
+ }
1520
1531
  function displayRepo(repo) {
1521
1532
  return repo.split("/").slice(1).join("/") || repo;
1522
1533
  }
@@ -2079,8 +2090,11 @@ function filterSessionsByRepo(sessions, filter, resolveRepo) {
2079
2090
  const kept = [];
2080
2091
  for (const session of sessions) {
2081
2092
  const repo = resolveRepo(session);
2082
- if (repo !== null && (filter === null || filter.includes(repo)))
2093
+ if (repo !== null && (filter === null || filter.includes(repo))) {
2083
2094
  kept.push({ ...session, repo });
2095
+ } else if (filter === null) {
2096
+ kept.push(session);
2097
+ }
2084
2098
  }
2085
2099
  return kept;
2086
2100
  }
@@ -2138,15 +2152,12 @@ function defaultHookEnabled(agentId) {
2138
2152
  }
2139
2153
  }
2140
2154
  function cwdIsStudied(cwd, state, repoOfDir) {
2141
- if (!cwd)
2142
- return false;
2143
- const repo = repoOfDir(cwd);
2144
- if (!repo)
2145
- return false;
2146
- if (state.repo_filter)
2147
- return state.repo_filter.includes(repo);
2155
+ if (state.repo_filter) {
2156
+ const repo = cwd ? repoOfDir(cwd) : null;
2157
+ return repo !== null && state.repo_filter.includes(repo);
2158
+ }
2148
2159
  if (state.project_filter?.length) {
2149
- return state.project_filter.some((base) => isUnderDir(cwd, base));
2160
+ return cwd !== undefined && state.project_filter.some((base) => isUnderDir(cwd, base));
2150
2161
  }
2151
2162
  return true;
2152
2163
  }
@@ -11958,25 +11969,218 @@ var init_integrations = __esm(() => {
11958
11969
  };
11959
11970
  });
11960
11971
 
11972
+ // src/sessions/branch.ts
11973
+ function recordedBranch(value) {
11974
+ if (typeof value !== "string")
11975
+ return null;
11976
+ const branch = value.trim();
11977
+ return branch && branch !== "HEAD" ? branch : null;
11978
+ }
11979
+ function branchFromClaudeTranscript(text) {
11980
+ let last = null;
11981
+ for (const match of text.matchAll(/"gitBranch":\s*("(?:[^"\\]|\\.)*")/g)) {
11982
+ try {
11983
+ last = recordedBranch(JSON.parse(match[1])) ?? last;
11984
+ } catch {}
11985
+ }
11986
+ return last;
11987
+ }
11988
+ function branchFromCodexTranscript(text) {
11989
+ for (const line of text.split(`
11990
+ `, CODEX_META_LINES)) {
11991
+ if (!line.includes('"session_meta"'))
11992
+ continue;
11993
+ try {
11994
+ const record = JSON.parse(line);
11995
+ if (record.type === "session_meta")
11996
+ return recordedBranch(record.payload?.git?.branch);
11997
+ } catch {}
11998
+ }
11999
+ return null;
12000
+ }
12001
+ function parseReflog(out) {
12002
+ const entries = [];
12003
+ for (const line of out.split(`
12004
+ `)) {
12005
+ const match = /^HEAD@\{(\d+)\}\t(.*)$/.exec(line);
12006
+ if (match)
12007
+ entries.push({ at: Number(match[1]), subject: match[2] });
12008
+ }
12009
+ return entries;
12010
+ }
12011
+ function checkoutBranch(name) {
12012
+ return /^[0-9a-f]{7,40}$/.test(name) ? null : recordedBranch(name);
12013
+ }
12014
+ function branchFromReflog(entries, endSec, currentBranch) {
12015
+ if (entries.length === 0)
12016
+ return null;
12017
+ let oldest = Number.POSITIVE_INFINITY;
12018
+ let before = null;
12019
+ let after = null;
12020
+ for (const entry of entries) {
12021
+ oldest = Math.min(oldest, entry.at);
12022
+ const match = CHECKOUT.exec(entry.subject);
12023
+ if (!match)
12024
+ continue;
12025
+ if (entry.at <= endSec) {
12026
+ if (!before || entry.at > before.at)
12027
+ before = { at: entry.at, to: match[2] };
12028
+ } else if (!after || entry.at <= after.at) {
12029
+ after = { at: entry.at, from: match[1] };
12030
+ }
12031
+ }
12032
+ if (endSec < oldest)
12033
+ return null;
12034
+ if (before)
12035
+ return checkoutBranch(before.to);
12036
+ if (after)
12037
+ return checkoutBranch(after.from);
12038
+ return currentBranch();
12039
+ }
12040
+ var CODEX_META_LINES = 50, CHECKOUT;
12041
+ var init_branch = __esm(() => {
12042
+ CHECKOUT = /^checkout: moving from (\S+) to (\S+)$/;
12043
+ });
12044
+
12045
+ // src/sessions/capture.ts
12046
+ import { existsSync as existsSync11, mkdirSync as mkdirSync7, readFileSync as readFileSync11, renameSync as renameSync3, writeFileSync as writeFileSync7 } from "node:fs";
12047
+ import { basename as basename2, join as join10 } from "node:path";
12048
+ function capturePath(configDir, key) {
12049
+ const [harness, id, ...rest] = key.split("/");
12050
+ if (rest.length > 0 || !SAFE_SEGMENT.test(harness ?? "") || !SAFE_SEGMENT.test(id ?? "")) {
12051
+ return null;
12052
+ }
12053
+ return join10(configDir, CAPTURE_DIRNAME, harness, `${id}.json`);
12054
+ }
12055
+ function readCapturedSession(key, configDir = getConfigDir()) {
12056
+ const path = capturePath(configDir, key);
12057
+ if (!path)
12058
+ return null;
12059
+ try {
12060
+ const raw = JSON.parse(readFileSync11(path, "utf-8"));
12061
+ return {
12062
+ ...typeof raw.dir === "string" ? { dir: raw.dir } : {},
12063
+ ...typeof raw.branch === "string" ? { branch: raw.branch } : {},
12064
+ at: typeof raw.at === "string" ? raw.at : ""
12065
+ };
12066
+ } catch {
12067
+ return null;
12068
+ }
12069
+ }
12070
+ function recordCapturedSession(key, update, configDir = getConfigDir(), now = new Date) {
12071
+ const path = capturePath(configDir, key);
12072
+ if (!path)
12073
+ return false;
12074
+ const previous = readCapturedSession(key, configDir);
12075
+ const dir = update.dir ?? previous?.dir;
12076
+ const branch = update.branch ?? previous?.branch;
12077
+ const record = {
12078
+ ...dir ? { dir } : {},
12079
+ ...branch ? { branch } : {},
12080
+ at: now.toISOString()
12081
+ };
12082
+ try {
12083
+ const parent = join10(path, "..");
12084
+ if (!existsSync11(parent))
12085
+ mkdirSync7(parent, { recursive: true, mode: 448 });
12086
+ const tmp = `${path}.${process.pid}.tmp`;
12087
+ writeFileSync7(tmp, JSON.stringify(record), { mode: 384 });
12088
+ renameSync3(tmp, path);
12089
+ return true;
12090
+ } catch (err) {
12091
+ logger.debug("sync", `could not record ${key}: ${err.message}`);
12092
+ return false;
12093
+ }
12094
+ }
12095
+ function captureCursorStop(payload, deps = {}) {
12096
+ if (typeof payload !== "object" || payload === null)
12097
+ return false;
12098
+ const hook = payload;
12099
+ if (hook.cursor_version === undefined)
12100
+ return false;
12101
+ const id = typeof hook.transcript_path === "string" && hook.transcript_path.endsWith(".jsonl") ? basename2(hook.transcript_path, ".jsonl") : hook.conversation_id;
12102
+ if (typeof id !== "string")
12103
+ return false;
12104
+ const roots = hook.workspace_roots;
12105
+ const dir = Array.isArray(roots) && typeof roots[0] === "string" ? roots[0] : undefined;
12106
+ if (!dir?.startsWith("/"))
12107
+ return false;
12108
+ const branch = (deps.currentBranch ?? currentBranchOfDir)(dir);
12109
+ return recordCapturedSession(`cursor/${id}`, { dir, branch }, deps.configDir, deps.now);
12110
+ }
12111
+ function readHookStdin(stream = process.stdin, timeoutMs = HOOK_STDIN_TIMEOUT_MS, maxBytes = HOOK_STDIN_MAX_BYTES) {
12112
+ if (stream.isTTY)
12113
+ return Promise.resolve(null);
12114
+ return new Promise((resolve) => {
12115
+ const chunks = [];
12116
+ let size = 0;
12117
+ let done = false;
12118
+ let timer;
12119
+ const finish = (value) => {
12120
+ if (done)
12121
+ return;
12122
+ done = true;
12123
+ clearTimeout(timer);
12124
+ stream.removeAllListeners("data");
12125
+ stream.pause();
12126
+ stream.destroy?.();
12127
+ resolve(value);
12128
+ };
12129
+ stream.on("data", (chunk) => {
12130
+ const buf = typeof chunk === "string" ? Buffer.from(chunk) : chunk;
12131
+ size += buf.length;
12132
+ if (size > maxBytes)
12133
+ return finish(null);
12134
+ chunks.push(buf);
12135
+ });
12136
+ stream.on("end", () => {
12137
+ try {
12138
+ finish(JSON.parse(Buffer.concat(chunks).toString("utf-8")));
12139
+ } catch {
12140
+ finish(null);
12141
+ }
12142
+ });
12143
+ stream.on("error", () => finish(null));
12144
+ timer = setTimeout(() => finish(null), timeoutMs);
12145
+ });
12146
+ }
12147
+ async function captureHookSession(stream) {
12148
+ try {
12149
+ const payload = await readHookStdin(stream);
12150
+ if (payload !== null)
12151
+ captureCursorStop(payload);
12152
+ } catch (err) {
12153
+ logger.debug("sync", `hook capture failed: ${err instanceof Error ? err.message : err}`);
12154
+ }
12155
+ }
12156
+ var CAPTURE_DIRNAME = "session-captures", HOOK_STDIN_TIMEOUT_MS = 500, HOOK_STDIN_MAX_BYTES, SAFE_SEGMENT;
12157
+ var init_capture = __esm(() => {
12158
+ init_config();
12159
+ init_logger();
12160
+ init_repo();
12161
+ HOOK_STDIN_MAX_BYTES = 1024 * 1024;
12162
+ SAFE_SEGMENT = /^[A-Za-z0-9_-]+$/;
12163
+ });
12164
+
11961
12165
  // src/sessions/project-dir.ts
11962
12166
  import {
11963
12167
  closeSync as closeSync4,
11964
- existsSync as existsSync11,
11965
- mkdirSync as mkdirSync7,
12168
+ existsSync as existsSync12,
12169
+ mkdirSync as mkdirSync8,
11966
12170
  openSync as openSync4,
11967
- readFileSync as readFileSync11,
12171
+ readFileSync as readFileSync12,
11968
12172
  readSync as readSync3,
11969
- renameSync as renameSync3,
12173
+ renameSync as renameSync4,
11970
12174
  statSync as statSync4,
11971
- writeFileSync as writeFileSync7
12175
+ writeFileSync as writeFileSync8
11972
12176
  } from "node:fs";
11973
- import { join as join10 } from "node:path";
12177
+ import { join as join11 } from "node:path";
11974
12178
  function cachePath(configDir) {
11975
- return join10(configDir, CACHE_FILENAME2);
12179
+ return join11(configDir, CACHE_FILENAME2);
11976
12180
  }
11977
12181
  function loadCacheFile(configDir) {
11978
12182
  try {
11979
- const raw = JSON.parse(readFileSync11(cachePath(configDir), "utf-8"));
12183
+ const raw = JSON.parse(readFileSync12(cachePath(configDir), "utf-8"));
11980
12184
  if (raw.schema_version !== CACHE_SCHEMA_VERSION || typeof raw.entries !== "object")
11981
12185
  return {};
11982
12186
  return raw.entries;
@@ -11986,13 +12190,13 @@ function loadCacheFile(configDir) {
11986
12190
  }
11987
12191
  function saveCacheFile(configDir, entries) {
11988
12192
  try {
11989
- if (!existsSync11(configDir))
11990
- mkdirSync7(configDir, { recursive: true, mode: 448 });
12193
+ if (!existsSync12(configDir))
12194
+ mkdirSync8(configDir, { recursive: true, mode: 448 });
11991
12195
  const path = cachePath(configDir);
11992
12196
  const tmp = `${path}.${process.pid}.tmp`;
11993
12197
  const file = { schema_version: CACHE_SCHEMA_VERSION, entries };
11994
- writeFileSync7(tmp, JSON.stringify(file), { mode: 384 });
11995
- renameSync3(tmp, path);
12198
+ writeFileSync8(tmp, JSON.stringify(file), { mode: 384 });
12199
+ renameSync4(tmp, path);
11996
12200
  } catch {}
11997
12201
  }
11998
12202
  function readHead(path, bytes = HEAD_BYTES) {
@@ -12026,7 +12230,7 @@ function cwdFromJsonlHead(text) {
12026
12230
  }
12027
12231
  return null;
12028
12232
  }
12029
- function unmungeSlug(slug, exists = existsSync11) {
12233
+ function unmungeSlug(slug, exists = existsSync12) {
12030
12234
  const tokens = slug.replace(/^-/, "").split("-");
12031
12235
  if (tokens.length === 0 || tokens[0] === "")
12032
12236
  return null;
@@ -12043,6 +12247,13 @@ function unmungeSlug(slug, exists = existsSync11) {
12043
12247
  };
12044
12248
  return walk("", 0);
12045
12249
  }
12250
+ function readWholeFile(path) {
12251
+ try {
12252
+ return readFileSync12(path, "utf-8");
12253
+ } catch {
12254
+ return null;
12255
+ }
12256
+ }
12046
12257
  function fileMtime(path) {
12047
12258
  try {
12048
12259
  return statSync4(path).mtime.toISOString();
@@ -12051,9 +12262,10 @@ function fileMtime(path) {
12051
12262
  }
12052
12263
  }
12053
12264
  function createProjectDirResolver(configDir = getConfigDir(), deps = {}) {
12054
- const exists = deps.exists ?? existsSync11;
12265
+ const exists = deps.exists ?? existsSync12;
12055
12266
  const head = deps.readHead ?? readHead;
12056
12267
  const mtime = deps.mtime ?? fileMtime;
12268
+ const captured = deps.captured ?? ((key) => readCapturedSession(key, configDir));
12057
12269
  const entries = loadCacheFile(configDir);
12058
12270
  let dirty = false;
12059
12271
  const compute = (session) => {
@@ -12071,14 +12283,47 @@ function createProjectDirResolver(configDir = getConfigDir(), deps = {}) {
12071
12283
  const text = head(session.path);
12072
12284
  return text ? cwdFromJsonlHead(text) : null;
12073
12285
  }
12074
- case "cursor":
12286
+ case "cursor": {
12287
+ const hookDir = captured(`cursor/${session.id}`)?.dir;
12288
+ if (hookDir)
12289
+ return hookDir;
12075
12290
  return session.project ? unmungeSlug(session.project, exists) : null;
12291
+ }
12076
12292
  default:
12077
12293
  return null;
12078
12294
  }
12079
12295
  };
12080
12296
  const repoOfDir = deps.repoOfDir ?? originRepoOfDir;
12081
12297
  const repoByDir = new Map;
12298
+ const readTranscript = deps.readTranscript ?? readWholeFile;
12299
+ const reflogOfDir = deps.reflogOfDir ?? headReflogOfDir;
12300
+ const currentBranch = deps.currentBranch ?? currentBranchOfDir;
12301
+ const reflogByDir = new Map;
12302
+ const currentByDir = new Map;
12303
+ const transcriptBranch = (session) => {
12304
+ if (session.harness !== "claude" && session.harness !== "codex")
12305
+ return null;
12306
+ const text = readTranscript(session.path);
12307
+ if (text === null)
12308
+ return null;
12309
+ return session.harness === "claude" ? branchFromClaudeTranscript(text) : branchFromCodexTranscript(text);
12310
+ };
12311
+ const reflogBranch = (session) => {
12312
+ const dir = resolve(session);
12313
+ const end = Date.parse(session.updated);
12314
+ if (dir === null || Number.isNaN(end))
12315
+ return null;
12316
+ let entries = reflogByDir.get(dir);
12317
+ if (!entries) {
12318
+ entries = parseReflog(reflogOfDir(dir) ?? "");
12319
+ reflogByDir.set(dir, entries);
12320
+ }
12321
+ return branchFromReflog(entries, Math.floor(end / 1000), () => {
12322
+ if (!currentByDir.has(dir))
12323
+ currentByDir.set(dir, currentBranch(dir));
12324
+ return currentByDir.get(dir) ?? null;
12325
+ });
12326
+ };
12082
12327
  const resolve = (session) => {
12083
12328
  const key = `${session.harness}/${session.id}`;
12084
12329
  const cached = entries[key];
@@ -12111,6 +12356,9 @@ function createProjectDirResolver(configDir = getConfigDir(), deps = {}) {
12111
12356
  dirty = true;
12112
12357
  return repo;
12113
12358
  },
12359
+ resolveBranch(session) {
12360
+ return transcriptBranch(session) ?? captured(`${session.harness}/${session.id}`)?.branch ?? reflogBranch(session);
12361
+ },
12114
12362
  flush() {
12115
12363
  if (!dirty)
12116
12364
  return;
@@ -12122,6 +12370,8 @@ function createProjectDirResolver(configDir = getConfigDir(), deps = {}) {
12122
12370
  var CACHE_FILENAME2 = "project-dirs.json", CACHE_SCHEMA_VERSION = 1, HEAD_BYTES, HEAD_LINES = 50;
12123
12371
  var init_project_dir = __esm(() => {
12124
12372
  init_config();
12373
+ init_branch();
12374
+ init_capture();
12125
12375
  init_repo();
12126
12376
  HEAD_BYTES = 128 * 1024;
12127
12377
  });
@@ -12863,7 +13113,7 @@ var init_queries = __esm(() => {
12863
13113
  });
12864
13114
 
12865
13115
  // src/report/digest.ts
12866
- import { readFileSync as readFileSync12 } from "node:fs";
13116
+ import { readFileSync as readFileSync13 } from "node:fs";
12867
13117
  function asRecord2(value) {
12868
13118
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
12869
13119
  }
@@ -13094,11 +13344,11 @@ function sessionToDigest(session) {
13094
13344
  try {
13095
13345
  switch (session.harness) {
13096
13346
  case "claude":
13097
- return { turns: digestClaude(readFileSync12(session.path, "utf8")) };
13347
+ return { turns: digestClaude(readFileSync13(session.path, "utf8")) };
13098
13348
  case "cursor":
13099
- return { turns: digestCursor(readFileSync12(session.path, "utf8")) };
13349
+ return { turns: digestCursor(readFileSync13(session.path, "utf8")) };
13100
13350
  case "codex":
13101
- return { turns: digestCodex(readFileSync12(session.path, "utf8")) };
13351
+ return { turns: digestCodex(readFileSync13(session.path, "utf8")) };
13102
13352
  case "opencode": {
13103
13353
  const turns = readSessionTurns(session).map((turn, index) => ({
13104
13354
  role: turn.role,
@@ -13319,17 +13569,17 @@ var init_notes = __esm(() => {
13319
13569
  });
13320
13570
 
13321
13571
  // src/report/write.ts
13322
- import { mkdirSync as mkdirSync8, writeFileSync as writeFileSync8 } from "node:fs";
13572
+ import { mkdirSync as mkdirSync9, writeFileSync as writeFileSync9 } from "node:fs";
13323
13573
  import { tmpdir } from "node:os";
13324
- import { dirname as dirname4, join as join11, resolve } from "node:path";
13574
+ import { dirname as dirname4, join as join12, resolve } from "node:path";
13325
13575
  import { pathToFileURL } from "node:url";
13326
13576
  function defaultReportPath() {
13327
- return join11(tmpdir(), "dosu-knowledge-report.html");
13577
+ return join12(tmpdir(), "dosu-knowledge-report.html");
13328
13578
  }
13329
13579
  async function writeAndOpenReport(options) {
13330
13580
  const out = resolve(options.out ?? defaultReportPath());
13331
- mkdirSync8(dirname4(out), { recursive: true });
13332
- writeFileSync8(out, options.html, "utf8");
13581
+ mkdirSync9(dirname4(out), { recursive: true });
13582
+ writeFileSync9(out, options.html, "utf8");
13333
13583
  if (options.open !== false) {
13334
13584
  const url = pathToFileURL(out).href;
13335
13585
  if (options.openUrl) {
@@ -13344,7 +13594,7 @@ async function writeAndOpenReport(options) {
13344
13594
  var init_write = () => {};
13345
13595
 
13346
13596
  // src/report/generate.ts
13347
- import { basename as basename2 } from "node:path";
13597
+ import { basename as basename3 } from "node:path";
13348
13598
  function sessionsForNotes(notes, sessions) {
13349
13599
  const ids = new Set(notes.map((n) => n.transcript_id).filter((id) => Boolean(id)));
13350
13600
  return sessions.filter((s) => ids.has(s.id));
@@ -13353,7 +13603,7 @@ function defaultProjectName() {
13353
13603
  const resolver = createProjectDirResolver();
13354
13604
  return (session) => {
13355
13605
  const dir = resolver.resolve(session);
13356
- return dir ? basename2(dir) : null;
13606
+ return dir ? basename3(dir) : null;
13357
13607
  };
13358
13608
  }
13359
13609
  function noteTime(note) {
@@ -13426,8 +13676,8 @@ var init_backlog = __esm(() => {
13426
13676
  });
13427
13677
 
13428
13678
  // src/sync/lock.ts
13429
- import { existsSync as existsSync12, readFileSync as readFileSync13, rmSync as rmSync2, statSync as statSync5, writeFileSync as writeFileSync9 } from "node:fs";
13430
- import { join as join12 } from "node:path";
13679
+ import { existsSync as existsSync13, readFileSync as readFileSync14, rmSync as rmSync2, statSync as statSync5, writeFileSync as writeFileSync10 } from "node:fs";
13680
+ import { join as join13 } from "node:path";
13431
13681
  function processAlive(pid) {
13432
13682
  try {
13433
13683
  process.kill(pid, 0);
@@ -13437,7 +13687,7 @@ function processAlive(pid) {
13437
13687
  }
13438
13688
  }
13439
13689
  function lockPath(configDir = getConfigDir()) {
13440
- return join12(configDir, LOCK_FILENAME);
13690
+ return join13(configDir, LOCK_FILENAME);
13441
13691
  }
13442
13692
  function stopSyncRun(pid, configDir = getConfigDir(), kill = process.kill.bind(process)) {
13443
13693
  if (!Number.isInteger(pid) || pid <= 0)
@@ -13454,7 +13704,7 @@ function stopSyncRun(pid, configDir = getConfigDir(), kill = process.kill.bind(p
13454
13704
  }
13455
13705
  try {
13456
13706
  const path = lockPath(configDir);
13457
- if (existsSync12(path) && readFileSync13(path, "utf8") === String(pid)) {
13707
+ if (existsSync13(path) && readFileSync14(path, "utf8") === String(pid)) {
13458
13708
  rmSync2(path, { force: true });
13459
13709
  }
13460
13710
  } catch {}
@@ -13465,7 +13715,7 @@ function fileLock(configDir = getConfigDir(), now = () => new Date) {
13465
13715
  let held = false;
13466
13716
  const tryCreate = () => {
13467
13717
  try {
13468
- writeFileSync9(path, String(process.pid), { flag: "wx" });
13718
+ writeFileSync10(path, String(process.pid), { flag: "wx" });
13469
13719
  return true;
13470
13720
  } catch {
13471
13721
  return false;
@@ -13479,7 +13729,7 @@ function fileLock(configDir = getConfigDir(), now = () => new Date) {
13479
13729
  }
13480
13730
  try {
13481
13731
  const age = now().getTime() - statSync5(path).mtimeMs;
13482
- const holder = Number.parseInt(readFileSync13(path, "utf8"), 10);
13732
+ const holder = Number.parseInt(readFileSync14(path, "utf8"), 10);
13483
13733
  const holderDead = Number.isInteger(holder) && holder > 0 && !processAlive(holder);
13484
13734
  if (age > STALE_LOCK_MS || holderDead) {
13485
13735
  rmSync2(path, { force: true });
@@ -13494,7 +13744,7 @@ function fileLock(configDir = getConfigDir(), now = () => new Date) {
13494
13744
  return;
13495
13745
  held = false;
13496
13746
  try {
13497
- if (existsSync12(path) && readFileSync13(path, "utf8") === String(process.pid)) {
13747
+ if (existsSync13(path) && readFileSync14(path, "utf8") === String(process.pid)) {
13498
13748
  rmSync2(path, { force: true });
13499
13749
  }
13500
13750
  } catch {}
@@ -13508,7 +13758,7 @@ var init_lock = __esm(() => {
13508
13758
  });
13509
13759
 
13510
13760
  // src/sync/status.ts
13511
- import { readFileSync as readFileSync14, statSync as statSync6 } from "node:fs";
13761
+ import { readFileSync as readFileSync15, statSync as statSync6 } from "node:fs";
13512
13762
  function formatTokenCount(tokens) {
13513
13763
  if (tokens < 1000)
13514
13764
  return String(tokens);
@@ -13531,7 +13781,7 @@ function defaultIsProcessAlive2(pid) {
13531
13781
  }
13532
13782
  function defaultReadLog() {
13533
13783
  try {
13534
- return readFileSync14(logger.getLogPath(), "utf-8");
13784
+ return readFileSync15(logger.getLogPath(), "utf-8");
13535
13785
  } catch {
13536
13786
  return "";
13537
13787
  }
@@ -13539,7 +13789,7 @@ function defaultReadLog() {
13539
13789
  function readLockFile(configDir) {
13540
13790
  const path = lockPath(configDir);
13541
13791
  try {
13542
- const pid = Number.parseInt(readFileSync14(path, "utf-8"), 10);
13792
+ const pid = Number.parseInt(readFileSync15(path, "utf-8"), 10);
13543
13793
  return { pid: Number.isNaN(pid) ? -1 : pid, mtime: statSync6(path).mtime };
13544
13794
  } catch {
13545
13795
  return null;
@@ -13631,6 +13881,7 @@ async function runKnowledgeSync(options = {}) {
13631
13881
  }
13632
13882
  let ready;
13633
13883
  let open;
13884
+ let branchOf;
13634
13885
  try {
13635
13886
  const listSessions = deps.listSessions ?? (() => options.bootstrap ? scanAgentSessions({}) : scanAgentSessions({
13636
13887
  since: new Date(now().getTime() - GATE_WINDOW_DAYS * 24 * 60 * 60 * 1000),
@@ -13639,11 +13890,14 @@ async function runKnowledgeSync(options = {}) {
13639
13890
  const scanned = await listSessions();
13640
13891
  let flush;
13641
13892
  let locator = deps.locator;
13642
- if (!locator) {
13893
+ let resolveBranch = deps.resolveBranch;
13894
+ if (!locator || !resolveBranch) {
13643
13895
  const resolver = createProjectDirResolver();
13644
- locator = resolver;
13896
+ locator ??= resolver;
13897
+ resolveBranch ??= resolver.resolveBranch;
13645
13898
  flush = resolver.flush;
13646
13899
  }
13900
+ branchOf = resolveBranch;
13647
13901
  const repoFilter = studyRepoFilter(state, () => scanAgentSessions({}), locator);
13648
13902
  if (state.project_filter) {
13649
13903
  delete state.project_filter;
@@ -13712,10 +13966,11 @@ async function runKnowledgeSync(options = {}) {
13712
13966
  } else if (isIncognito(candidate)) {
13713
13967
  incognito += 1;
13714
13968
  logger.debug("sync", `skipping incognito session ${candidate.harness}/${candidate.id}`);
13715
- } else if (worthStudying(candidate)) {
13716
- batch.push(candidate);
13717
- } else {
13969
+ } else if (!worthStudying(candidate)) {
13718
13970
  trivial += 1;
13971
+ } else {
13972
+ const branch = candidate.repo ? branchOf(candidate) : null;
13973
+ batch.push(branch ? { ...candidate, branch } : candidate);
13719
13974
  }
13720
13975
  }
13721
13976
  const skippedNote = `${trivial} trivial, ${incognito} incognito${alreadyStudied > 0 ? `, ${alreadyStudied} already studied` : ""} skipped`;
@@ -13843,7 +14098,7 @@ var init_sync = __esm(() => {
13843
14098
  });
13844
14099
 
13845
14100
  // src/learner/conflicts.ts
13846
- import { existsSync as existsSync13, readFileSync as readFileSync15 } from "node:fs";
14101
+ import { existsSync as existsSync14, readFileSync as readFileSync16 } from "node:fs";
13847
14102
  function managedSettingsPaths(platform = process.platform) {
13848
14103
  switch (platform) {
13849
14104
  case "darwin":
@@ -13872,11 +14127,11 @@ function conflictingKeysIn(settings) {
13872
14127
  function detectSettingsConflicts(paths = managedSettingsPaths()) {
13873
14128
  const conflicts = [];
13874
14129
  for (const file of paths) {
13875
- if (!existsSync13(file))
14130
+ if (!existsSync14(file))
13876
14131
  continue;
13877
14132
  let settings;
13878
14133
  try {
13879
- settings = JSON.parse(readFileSync15(file, "utf8"));
14134
+ settings = JSON.parse(readFileSync16(file, "utf8"));
13880
14135
  } catch {
13881
14136
  conflicts.push({ file, keys: [UNREADABLE_SETTINGS_KEY] });
13882
14137
  continue;
@@ -13901,11 +14156,11 @@ var init_conflicts = __esm(() => {
13901
14156
  });
13902
14157
 
13903
14158
  // src/telemetry/debug-id.ts
13904
- var BUNDLE_DEBUG_ID_PLACEHOLDER = "01f74cf6-cdbb-b296-6475-6e2164756e21";
14159
+ var BUNDLE_DEBUG_ID_PLACEHOLDER = "3b9a1619-fdbd-ebdd-6475-6e2164756e21";
13905
14160
 
13906
14161
  // src/telemetry/telemetry.ts
13907
14162
  import { randomUUID as randomUUID2 } from "node:crypto";
13908
- import { existsSync as existsSync14 } from "node:fs";
14163
+ import { existsSync as existsSync15 } from "node:fs";
13909
14164
  import { request as httpRequest2 } from "node:http";
13910
14165
  import { request as httpsRequest } from "node:https";
13911
14166
  import { isAbsolute, relative, resolve as resolve2, sep } from "node:path";
@@ -14043,7 +14298,7 @@ function parseOwnedStackLine(originalLine, packageRoot) {
14043
14298
  return;
14044
14299
  }
14045
14300
  try {
14046
- if (!existsSync14(resolvedPath))
14301
+ if (!existsSync15(resolvedPath))
14047
14302
  return;
14048
14303
  } catch {
14049
14304
  return;
@@ -14926,9 +15181,9 @@ var init_agent_select = __esm(() => {
14926
15181
  });
14927
15182
 
14928
15183
  // src/incognito/agents.ts
14929
- import { existsSync as existsSync15, mkdirSync as mkdirSync9, readFileSync as readFileSync16, unlinkSync as unlinkSync2, writeFileSync as writeFileSync10 } from "node:fs";
15184
+ import { existsSync as existsSync16, mkdirSync as mkdirSync10, readFileSync as readFileSync17, unlinkSync as unlinkSync2, writeFileSync as writeFileSync11 } from "node:fs";
14930
15185
  import { homedir as homedir4 } from "node:os";
14931
- import { dirname as dirname5, join as join13 } from "node:path";
15186
+ import { dirname as dirname5, join as join14 } from "node:path";
14932
15187
  function withFrontmatter(body) {
14933
15188
  return `---
14934
15189
  description: ${DESCRIPTION}
@@ -14937,10 +15192,10 @@ description: ${DESCRIPTION}
14937
15192
  ${body}`;
14938
15193
  }
14939
15194
  function claudeConfigDir2() {
14940
- return process.env.CLAUDE_CONFIG_DIR || join13(homedir4(), ".claude");
15195
+ return process.env.CLAUDE_CONFIG_DIR || join14(homedir4(), ".claude");
14941
15196
  }
14942
15197
  function codexHome2() {
14943
- return process.env.CODEX_HOME || join13(homedir4(), ".codex");
15198
+ return process.env.CODEX_HOME || join14(homedir4(), ".codex");
14944
15199
  }
14945
15200
  function fileAgent(options) {
14946
15201
  const { commandPath, content } = options;
@@ -14951,29 +15206,29 @@ function fileAgent(options) {
14951
15206
  commandPath,
14952
15207
  isEnabled: () => {
14953
15208
  const path = commandPath();
14954
- if (!existsSync15(path))
15209
+ if (!existsSync16(path))
14955
15210
  return false;
14956
15211
  try {
14957
- return readFileSync16(path, "utf-8").includes(INCOGNITO_MARKER);
15212
+ return readFileSync17(path, "utf-8").includes(INCOGNITO_MARKER);
14958
15213
  } catch {
14959
15214
  return false;
14960
15215
  }
14961
15216
  },
14962
15217
  enable: () => {
14963
15218
  const path = commandPath();
14964
- if (existsSync15(path)) {
14965
- if (readFileSync16(path, "utf-8") === content)
15219
+ if (existsSync16(path)) {
15220
+ if (readFileSync17(path, "utf-8") === content)
14966
15221
  return "unchanged";
14967
- writeFileSync10(path, content, "utf-8");
15222
+ writeFileSync11(path, content, "utf-8");
14968
15223
  return "updated";
14969
15224
  }
14970
- mkdirSync9(dirname5(path), { recursive: true });
14971
- writeFileSync10(path, content, "utf-8");
15225
+ mkdirSync10(dirname5(path), { recursive: true });
15226
+ writeFileSync11(path, content, "utf-8");
14972
15227
  return "created";
14973
15228
  },
14974
15229
  disable: () => {
14975
15230
  const path = commandPath();
14976
- if (!existsSync15(path))
15231
+ if (!existsSync16(path))
14977
15232
  return "not_found";
14978
15233
  unlinkSync2(path);
14979
15234
  return "removed";
@@ -14986,21 +15241,21 @@ function allIncognitoAgents() {
14986
15241
  id: "claude",
14987
15242
  name: "Claude Code",
14988
15243
  detectPath: claudeConfigDir2,
14989
- commandPath: () => join13(claudeConfigDir2(), "commands", FILE_NAME),
15244
+ commandPath: () => join14(claudeConfigDir2(), "commands", FILE_NAME),
14990
15245
  content: withFrontmatter(INCOGNITO_COMMAND_BODY)
14991
15246
  }),
14992
15247
  fileAgent({
14993
15248
  id: "cursor",
14994
15249
  name: "Cursor",
14995
- detectPath: () => join13(homedir4(), ".cursor"),
14996
- commandPath: () => join13(homedir4(), ".cursor", "commands", FILE_NAME),
15250
+ detectPath: () => join14(homedir4(), ".cursor"),
15251
+ commandPath: () => join14(homedir4(), ".cursor", "commands", FILE_NAME),
14997
15252
  content: INCOGNITO_COMMAND_BODY
14998
15253
  }),
14999
15254
  fileAgent({
15000
15255
  id: "codex",
15001
15256
  name: "Codex",
15002
15257
  detectPath: codexHome2,
15003
- commandPath: () => join13(codexHome2(), "prompts", FILE_NAME),
15258
+ commandPath: () => join14(codexHome2(), "prompts", FILE_NAME),
15004
15259
  content: withFrontmatter(INCOGNITO_COMMAND_BODY)
15005
15260
  })
15006
15261
  ];
@@ -15084,7 +15339,7 @@ var init_knowledge_incognito = __esm(() => {
15084
15339
 
15085
15340
  // src/statusline/agents.ts
15086
15341
  import { homedir as homedir5 } from "node:os";
15087
- import { join as join14 } from "node:path";
15342
+ import { join as join15 } from "node:path";
15088
15343
  function statuslineCommand(agentId) {
15089
15344
  if (process.env.DOSU_DEV !== "true")
15090
15345
  return `dosu ${RENDER_ARGS} ${agentId}`;
@@ -15094,7 +15349,7 @@ function isDosuStatuslineCommand(command) {
15094
15349
  return typeof command === "string" && command.includes(RENDER_ARGS);
15095
15350
  }
15096
15351
  function claudeConfigDir3() {
15097
- return process.env.CLAUDE_CONFIG_DIR || join14(homedir5(), ".claude");
15352
+ return process.env.CLAUDE_CONFIG_DIR || join15(homedir5(), ".claude");
15098
15353
  }
15099
15354
  function statuslineOf(config) {
15100
15355
  const value = config.statusLine;
@@ -15135,7 +15390,7 @@ function allStatuslineAgents() {
15135
15390
  id: "claude",
15136
15391
  name: "Claude Code",
15137
15392
  detectPath: claudeConfigDir3,
15138
- configPath: () => join14(claudeConfigDir3(), "settings.json")
15393
+ configPath: () => join15(claudeConfigDir3(), "settings.json")
15139
15394
  }),
15140
15395
  configAgent({
15141
15396
  id: "cursor",
@@ -15400,12 +15655,12 @@ var init_backfill_run = __esm(() => {
15400
15655
  });
15401
15656
 
15402
15657
  // src/learner/config-dir.ts
15403
- import { mkdtempSync, rmSync as rmSync3, writeFileSync as writeFileSync11 } from "node:fs";
15658
+ import { mkdtempSync, rmSync as rmSync3, writeFileSync as writeFileSync12 } from "node:fs";
15404
15659
  import { tmpdir as tmpdir2 } from "node:os";
15405
- import { join as join15 } from "node:path";
15660
+ import { join as join16 } from "node:path";
15406
15661
  function createRunConfigDir() {
15407
- const path = mkdtempSync(join15(tmpdir2(), "dosu-learner-"));
15408
- writeFileSync11(join15(path, ".claude.json"), JSON.stringify({ hasCompletedOnboarding: true }));
15662
+ const path = mkdtempSync(join16(tmpdir2(), "dosu-learner-"));
15663
+ writeFileSync12(join16(path, ".claude.json"), JSON.stringify({ hasCompletedOnboarding: true }));
15409
15664
  return {
15410
15665
  path,
15411
15666
  cleanup() {
@@ -15453,10 +15708,10 @@ var init_env = __esm(() => {
15453
15708
  });
15454
15709
 
15455
15710
  // src/learner/executable.ts
15456
- import { accessSync, constants as constants2, existsSync as existsSync16 } from "node:fs";
15711
+ import { accessSync, constants as constants2, existsSync as existsSync17 } from "node:fs";
15457
15712
  import { createRequire as createRequire3 } from "node:module";
15458
15713
  import { homedir as homedir6 } from "node:os";
15459
- import { delimiter as delimiter2, dirname as dirname6, join as join16 } from "node:path";
15714
+ import { delimiter as delimiter2, dirname as dirname6, join as join17 } from "node:path";
15460
15715
  function binaryNames(platform = process.platform) {
15461
15716
  return platform === "win32" ? ["claude.exe", "claude.cmd"] : ["claude"];
15462
15717
  }
@@ -15465,7 +15720,7 @@ function sdkNativeBinaryExists() {
15465
15720
  const requireRuntime = createRequire3(import.meta.url);
15466
15721
  const pkg = `@anthropic-ai/claude-agent-sdk-${process.platform}-${process.arch}`;
15467
15722
  const pkgDir = dirname6(requireRuntime.resolve(`${pkg}/package.json`));
15468
- return binaryNames().some((name) => existsSync16(join16(pkgDir, name)));
15723
+ return binaryNames().some((name) => existsSync17(join17(pkgDir, name)));
15469
15724
  } catch {
15470
15725
  return false;
15471
15726
  }
@@ -15481,10 +15736,10 @@ function isExecutable(path) {
15481
15736
  function findSystemClaude(env = process.env, homeDir = homedir6()) {
15482
15737
  const names = binaryNames();
15483
15738
  const dirs = (env.PATH ?? "").split(delimiter2).filter(Boolean);
15484
- dirs.push(join16(homeDir, ".local", "bin"), join16(homeDir, ".claude", "local"));
15739
+ dirs.push(join17(homeDir, ".local", "bin"), join17(homeDir, ".claude", "local"));
15485
15740
  for (const dir of dirs) {
15486
15741
  for (const name of names) {
15487
- const candidate = join16(dir, name);
15742
+ const candidate = join17(dir, name);
15488
15743
  if (isExecutable(candidate))
15489
15744
  return candidate;
15490
15745
  }
@@ -58595,6 +58850,7 @@ async function runLearner(options) {
58595
58850
  const readsSinceWrite = new Set;
58596
58851
  const sessionKeys = new Map(options.sessions.map((s) => [s.id, `${s.harness}/${s.id}`]));
58597
58852
  const sessionRepos = new Map(options.sessions.map((s) => [s.id, s.repo]));
58853
+ const sessionBranches = new Map(options.sessions.map((s) => [s.id, s.branch]));
58598
58854
  const notedSessions = new Set;
58599
58855
  const pendingNotes = new Map;
58600
58856
  let turns = 0;
@@ -58673,24 +58929,31 @@ async function runLearner(options) {
58673
58929
  message: "Write each session's notes right after reading THAT session, before reading the next. You have read multiple sessions without writing, so a note cannot be attributed to one. Re-read only the session this note is about, then write it."
58674
58930
  };
58675
58931
  }
58932
+ const noted = currentSession && sessionKeys.get(currentSession);
58933
+ if (!currentSession || !noted) {
58934
+ return {
58935
+ behavior: "deny",
58936
+ message: "Read the session this note is about with read_session first, then write it."
58937
+ };
58938
+ }
58676
58939
  notesWritten += 1;
58677
58940
  readsSinceWrite.clear();
58678
- const noted = currentSession && sessionKeys.get(currentSession);
58679
- if (noted)
58680
- pendingNotes.set(toolUseID, noted);
58941
+ pendingNotes.set(toolUseID, noted);
58681
58942
  const {
58682
58943
  transcript_id: _transcriptByModel,
58683
58944
  repo: _repoByModel,
58684
58945
  branch: _branchByModel,
58685
58946
  ...clean
58686
58947
  } = input;
58687
- const repo = currentSession && sessionRepos.get(currentSession);
58948
+ const repo = sessionRepos.get(currentSession);
58949
+ const branch = repo && sessionBranches.get(currentSession);
58688
58950
  return {
58689
58951
  behavior: "allow",
58690
58952
  updatedInput: {
58691
58953
  ...clean,
58692
- ...currentSession ? { transcript_id: currentSession } : {},
58693
- ...repo ? { repo } : {}
58954
+ transcript_id: currentSession,
58955
+ ...repo ? { repo } : {},
58956
+ ...branch ? { branch } : {}
58694
58957
  }
58695
58958
  };
58696
58959
  }
@@ -58780,8 +59043,8 @@ var init_runner = __esm(() => {
58780
59043
  });
58781
59044
 
58782
59045
  // src/commands/knowledge.ts
58783
- import { existsSync as existsSync18 } from "node:fs";
58784
- import { delimiter as delimiter4, join as join21 } from "node:path";
59046
+ import { existsSync as existsSync19 } from "node:fs";
59047
+ import { delimiter as delimiter4, join as join22 } from "node:path";
58785
59048
  function requireConfig7() {
58786
59049
  const cfg = requireLoginConfig();
58787
59050
  if (!cfg.active_account?.target?.org_id || !cfg.active_account?.target?.space_id) {
@@ -58901,6 +59164,7 @@ ${results.length - opts.limit} more results not shown.`));
58901
59164
  return;
58902
59165
  }
58903
59166
  if (opts.detach) {
59167
+ await captureHookSession();
58904
59168
  const spawned = spawnDetachedSelf([
58905
59169
  "knowledge",
58906
59170
  "sync",
@@ -59205,7 +59469,7 @@ function reportHookFailure(agent, err) {
59205
59469
  }
59206
59470
  function dosuOnPath() {
59207
59471
  const bin = process.platform === "win32" ? "dosu.cmd" : "dosu";
59208
- return (process.env.PATH ?? "").split(delimiter4).some((dir) => dir !== "" && existsSync18(join21(dir, bin)));
59472
+ return (process.env.PATH ?? "").split(delimiter4).some((dir) => dir !== "" && existsSync19(join22(dir, bin)));
59209
59473
  }
59210
59474
  var import_picocolors21;
59211
59475
  var init_knowledge = __esm(() => {
@@ -59215,6 +59479,7 @@ var init_knowledge = __esm(() => {
59215
59479
  init_agents();
59216
59480
  init_formats();
59217
59481
  init_generate();
59482
+ init_capture();
59218
59483
  init_repo();
59219
59484
  init_backlog();
59220
59485
  init_detach();
@@ -59670,7 +59935,7 @@ var init_time_range = __esm(() => {
59670
59935
  });
59671
59936
 
59672
59937
  // src/commands/review.ts
59673
- import { readFileSync as readFileSync18 } from "node:fs";
59938
+ import { readFileSync as readFileSync19 } from "node:fs";
59674
59939
  function requireConfig10() {
59675
59940
  return requireLoginConfig();
59676
59941
  }
@@ -59858,7 +60123,7 @@ function reviewCommand() {
59858
60123
  let body = opts.body;
59859
60124
  if (opts.bodyFile) {
59860
60125
  try {
59861
- body = readFileSync18(opts.bodyFile, "utf-8");
60126
+ body = readFileSync19(opts.bodyFile, "utf-8");
59862
60127
  } catch (err) {
59863
60128
  console.error(import_picocolors25.default.red(`Failed to read --body-file: ${err.message}`));
59864
60129
  process.exit(1);
@@ -60778,16 +61043,16 @@ The coding agent performs triage; Dosu cloud generates docs and opens the PR.
60778
61043
  // src/commands/skill.ts
60779
61044
  import {
60780
61045
  cpSync,
60781
- existsSync as existsSync19,
61046
+ existsSync as existsSync20,
60782
61047
  lstatSync as lstatSync2,
60783
- mkdirSync as mkdirSync11,
60784
- readFileSync as readFileSync19,
61048
+ mkdirSync as mkdirSync12,
61049
+ readFileSync as readFileSync20,
60785
61050
  rmSync as rmSync5,
60786
61051
  symlinkSync,
60787
- writeFileSync as writeFileSync12
61052
+ writeFileSync as writeFileSync13
60788
61053
  } from "node:fs";
60789
61054
  import { homedir as homedir7 } from "node:os";
60790
- import { dirname as dirname10, join as join22, relative as relative3 } from "node:path";
61055
+ import { dirname as dirname10, join as join23, relative as relative3 } from "node:path";
60791
61056
  function skillAgentIDsForProviders(providerIDs) {
60792
61057
  return [
60793
61058
  ...new Set(providerIDs.map((providerID) => SKILL_AGENT_BY_PROVIDER[providerID]).filter((agent) => Boolean(agent)))
@@ -60797,15 +61062,15 @@ function isSkillAgentID(agent) {
60797
61062
  return SUPPORTED_SKILL_AGENTS.includes(agent);
60798
61063
  }
60799
61064
  function universalSkillsDir() {
60800
- return join22(homedir7(), ".agents", "skills");
61065
+ return join23(homedir7(), ".agents", "skills");
60801
61066
  }
60802
61067
  function linkedSkillsDir(agent) {
60803
61068
  if (agent === "claude-code") {
60804
- const claudeConfigDir = process.env.CLAUDE_CONFIG_DIR?.trim() || join22(homedir7(), ".claude");
60805
- return join22(claudeConfigDir, "skills");
61069
+ const claudeConfigDir = process.env.CLAUDE_CONFIG_DIR?.trim() || join23(homedir7(), ".claude");
61070
+ return join23(claudeConfigDir, "skills");
60806
61071
  }
60807
61072
  if (agent === "windsurf")
60808
- return join22(homedir7(), ".codeium", "windsurf", "skills");
61073
+ return join23(homedir7(), ".codeium", "windsurf", "skills");
60809
61074
  return null;
60810
61075
  }
60811
61076
  function skillInstallTargetForProvider(providerID) {
@@ -60814,18 +61079,18 @@ function skillInstallTargetForProvider(providerID) {
60814
61079
  return null;
60815
61080
  const linked = linkedSkillsDir(agentID);
60816
61081
  if (linked)
60817
- return { path: join22(linked, SKILL_NAME), symlink: true };
60818
- return { path: join22(universalSkillsDir(), SKILL_NAME), symlink: false };
61082
+ return { path: join23(linked, SKILL_NAME), symlink: true };
61083
+ return { path: join23(universalSkillsDir(), SKILL_NAME), symlink: false };
60819
61084
  }
60820
61085
  function installStatePath() {
60821
- return join22(getConfigDir(), INSTALL_STATE_FILENAME);
61086
+ return join23(getConfigDir(), INSTALL_STATE_FILENAME);
60822
61087
  }
60823
61088
  function readSkillInstallState() {
60824
61089
  try {
60825
61090
  const path = installStatePath();
60826
- if (!existsSync19(path))
61091
+ if (!existsSync20(path))
60827
61092
  return null;
60828
- const data = JSON.parse(readFileSync19(path, "utf-8"));
61093
+ const data = JSON.parse(readFileSync20(path, "utf-8"));
60829
61094
  if (typeof data?.version === "string" && Array.isArray(data.agents) && data.agents.every((agent) => typeof agent === "string") && typeof data.installedAt === "number") {
60830
61095
  return { version: data.version, agents: data.agents, installedAt: data.installedAt };
60831
61096
  }
@@ -60837,9 +61102,9 @@ function readSkillInstallState() {
60837
61102
  function writeSkillInstallState(state) {
60838
61103
  try {
60839
61104
  const dir = getConfigDir();
60840
- if (!existsSync19(dir))
60841
- mkdirSync11(dir, { recursive: true, mode: 448 });
60842
- writeFileSync12(installStatePath(), JSON.stringify(state), { mode: 384 });
61105
+ if (!existsSync20(dir))
61106
+ mkdirSync12(dir, { recursive: true, mode: 448 });
61107
+ writeFileSync13(installStatePath(), JSON.stringify(state), { mode: 384 });
60843
61108
  } catch (err) {
60844
61109
  logger.debug("skill", `Could not record skill install state: ${err}`);
60845
61110
  }
@@ -60848,11 +61113,11 @@ function clearSkillInstallState() {
60848
61113
  rmSync5(installStatePath(), { force: true });
60849
61114
  }
60850
61115
  function pruneLegacySkillLock() {
60851
- const lockPath = join22(homedir7(), ".agents", ".skill-lock.json");
61116
+ const lockPath = join23(homedir7(), ".agents", ".skill-lock.json");
60852
61117
  try {
60853
- if (!existsSync19(lockPath))
61118
+ if (!existsSync20(lockPath))
60854
61119
  return [];
60855
- const lock = JSON.parse(readFileSync19(lockPath, "utf-8"));
61120
+ const lock = JSON.parse(readFileSync20(lockPath, "utf-8"));
60856
61121
  const skills = lock?.skills;
60857
61122
  if (!skills || typeof skills !== "object")
60858
61123
  return [];
@@ -60861,7 +61126,7 @@ function pruneLegacySkillLock() {
60861
61126
  return [];
60862
61127
  for (const name of legacy)
60863
61128
  delete skills[name];
60864
- writeFileSync12(lockPath, `${JSON.stringify(lock, null, 2)}
61129
+ writeFileSync13(lockPath, `${JSON.stringify(lock, null, 2)}
60865
61130
  `);
60866
61131
  logger.debug("skill", `Removed legacy lock entries: ${legacy.join(", ")}`);
60867
61132
  return legacy;
@@ -60881,13 +61146,13 @@ function pathExists(path) {
60881
61146
  function writeSkillDir(skill, dir) {
60882
61147
  rmSync5(dir, { recursive: true, force: true });
60883
61148
  for (const file of skill.files) {
60884
- const target = join22(dir, ...file.path.split("/"));
60885
- mkdirSync11(dirname10(target), { recursive: true });
60886
- writeFileSync12(target, file.content, { mode: file.executable ? 493 : 420 });
61149
+ const target = join23(dir, ...file.path.split("/"));
61150
+ mkdirSync12(dirname10(target), { recursive: true });
61151
+ writeFileSync13(target, file.content, { mode: file.executable ? 493 : 420 });
60887
61152
  }
60888
61153
  }
60889
61154
  function linkSkillDir(linkPath, targetDir) {
60890
- mkdirSync11(dirname10(linkPath), { recursive: true });
61155
+ mkdirSync12(dirname10(linkPath), { recursive: true });
60891
61156
  rmSync5(linkPath, { recursive: true, force: true });
60892
61157
  try {
60893
61158
  symlinkSync(relative3(dirname10(linkPath), targetDir), linkPath, "dir");
@@ -60920,15 +61185,15 @@ function installBundledSkills(agentIDs) {
60920
61185
  if (bundledNames.has(name))
60921
61186
  continue;
60922
61187
  for (const dir of [universalSkillsDir(), ...linkDirs])
60923
- removeSkillDir(join22(dir, name));
61188
+ removeSkillDir(join23(dir, name));
60924
61189
  }
60925
61190
  const paths = [];
60926
61191
  for (const skill of BUNDLED_SKILLS) {
60927
- const universal = join22(universalSkillsDir(), skill.name);
61192
+ const universal = join23(universalSkillsDir(), skill.name);
60928
61193
  writeSkillDir(skill, universal);
60929
61194
  paths.push(universal);
60930
61195
  for (const dir of linkDirs) {
60931
- const linkPath = join22(dir, skill.name);
61196
+ const linkPath = join23(dir, skill.name);
60932
61197
  linkSkillDir(linkPath, universal);
60933
61198
  paths.push(linkPath);
60934
61199
  }
@@ -60939,7 +61204,7 @@ function installBundledSkills(agentIDs) {
60939
61204
  agents: [...new Set([...previous?.agents ?? [], ...agents])],
60940
61205
  installedAt: Date.now()
60941
61206
  });
60942
- rmSync5(join22(getConfigDir(), LEGACY_CACHE_FILENAME), { force: true });
61207
+ rmSync5(join23(getConfigDir(), LEGACY_CACHE_FILENAME), { force: true });
60943
61208
  logger.info("skill", `Installed bundled skills v${VERSION} for ${agents.join(", ")}`);
60944
61209
  return { success: true, version: VERSION, paths };
60945
61210
  } catch (err) {
@@ -60961,13 +61226,13 @@ function removeSkills() {
60961
61226
  const removed = [];
60962
61227
  for (const dir of dirs) {
60963
61228
  for (const name of names) {
60964
- const path = join22(dir, name);
61229
+ const path = join23(dir, name);
60965
61230
  if (removeSkillDir(path))
60966
61231
  removed.push(path);
60967
61232
  }
60968
61233
  }
60969
61234
  clearSkillInstallState();
60970
- rmSync5(join22(getConfigDir(), LEGACY_CACHE_FILENAME), { force: true });
61235
+ rmSync5(join23(getConfigDir(), LEGACY_CACHE_FILENAME), { force: true });
60971
61236
  return removed;
60972
61237
  }
60973
61238
  function printPaths(paths) {
@@ -61322,17 +61587,17 @@ var init_sources = __esm(() => {
61322
61587
  // src/telemetry/settings.ts
61323
61588
  import { randomUUID as randomUUID4 } from "node:crypto";
61324
61589
  import {
61325
- existsSync as existsSync20,
61590
+ existsSync as existsSync21,
61326
61591
  lstatSync as lstatSync3,
61327
- mkdirSync as mkdirSync12,
61328
- readFileSync as readFileSync20,
61329
- renameSync as renameSync5,
61592
+ mkdirSync as mkdirSync13,
61593
+ readFileSync as readFileSync21,
61594
+ renameSync as renameSync6,
61330
61595
  unlinkSync as unlinkSync4,
61331
- writeFileSync as writeFileSync13
61596
+ writeFileSync as writeFileSync14
61332
61597
  } from "node:fs";
61333
- import { join as join23 } from "node:path";
61598
+ import { join as join24 } from "node:path";
61334
61599
  function getTelemetrySettingsPath() {
61335
- return join23(getConfigDir(), TELEMETRY_SETTINGS_FILENAME);
61600
+ return join24(getConfigDir(), TELEMETRY_SETTINGS_FILENAME);
61336
61601
  }
61337
61602
  function loadTelemetrySettings() {
61338
61603
  return readTelemetrySettings().settings;
@@ -61400,7 +61665,7 @@ function readTelemetrySettings() {
61400
61665
  }
61401
61666
  let content;
61402
61667
  try {
61403
- content = readFileSync20(path, "utf-8");
61668
+ content = readFileSync21(path, "utf-8");
61404
61669
  } catch {
61405
61670
  return { status: "error", settings: disabledTelemetrySettings() };
61406
61671
  }
@@ -61432,14 +61697,14 @@ function writeTelemetrySettings(settings) {
61432
61697
  const dir = getConfigDir();
61433
61698
  const temporaryPath = `${path}.${process.pid}.${randomUUID4()}.tmp`;
61434
61699
  try {
61435
- if (!existsSync20(dir))
61436
- mkdirSync12(dir, { recursive: true, mode: 448 });
61437
- writeFileSync13(temporaryPath, `${JSON.stringify(settings, null, 2)}
61700
+ if (!existsSync21(dir))
61701
+ mkdirSync13(dir, { recursive: true, mode: 448 });
61702
+ writeFileSync14(temporaryPath, `${JSON.stringify(settings, null, 2)}
61438
61703
  `, {
61439
61704
  flag: "wx",
61440
61705
  mode: 384
61441
61706
  });
61442
- renameSync5(temporaryPath, path);
61707
+ renameSync6(temporaryPath, path);
61443
61708
  return true;
61444
61709
  } catch {
61445
61710
  try {
@@ -61820,7 +62085,7 @@ var init_antigravity = __esm(() => {
61820
62085
  });
61821
62086
 
61822
62087
  // src/mcp/providers/claude.ts
61823
- import { join as join24 } from "node:path";
62088
+ import { join as join25 } from "node:path";
61824
62089
  var ClaudeProvider = () => createJSONProvider({
61825
62090
  providerName: "Claude Code",
61826
62091
  providerID: "claude",
@@ -61830,24 +62095,24 @@ var ClaudeProvider = () => createJSONProvider({
61830
62095
  globalPath: "~/.claude.json",
61831
62096
  topKey: "mcpServers",
61832
62097
  buildServer: ({ url, headers }) => ({ type: "http", url, headers, alwaysLoad: true }),
61833
- localConfigPath: (cwd) => join24(cwd, ".mcp.json")
62098
+ localConfigPath: (cwd) => join25(cwd, ".mcp.json")
61834
62099
  });
61835
62100
  var init_claude = __esm(() => {
61836
62101
  init_base();
61837
62102
  });
61838
62103
 
61839
62104
  // src/mcp/providers/claude-desktop.ts
61840
- import { join as join25 } from "node:path";
62105
+ import { join as join26 } from "node:path";
61841
62106
  function configPath() {
61842
- return join25(appSupportDir(), "Claude", "claude_desktop_config.json");
62107
+ return join26(appSupportDir(), "Claude", "claude_desktop_config.json");
61843
62108
  }
61844
62109
  var ClaudeDesktopProvider = () => ({
61845
62110
  name: () => "Claude Desktop",
61846
62111
  id: () => "claude-desktop",
61847
62112
  supportsLocal: () => false,
61848
62113
  priority: () => 2,
61849
- detectPaths: () => [join25(appSupportDir(), "Claude")],
61850
- isInstalled: () => isInstalled([join25(appSupportDir(), "Claude")]),
62114
+ detectPaths: () => [join26(appSupportDir(), "Claude")],
62115
+ isInstalled: () => isInstalled([join26(appSupportDir(), "Claude")]),
61851
62116
  globalConfigPath: () => configPath(),
61852
62117
  isConfigured: () => isJSONKeyConfigured(configPath(), "mcpServers"),
61853
62118
  install(cfg, global2) {
@@ -61874,14 +62139,14 @@ var init_claude_desktop = __esm(() => {
61874
62139
  });
61875
62140
 
61876
62141
  // src/mcp/providers/cline.ts
61877
- import { join as join26 } from "node:path";
61878
- var extensionDir = () => join26(appSupportDir(), "Code", "User", "globalStorage", "saoudrizwan.claude-dev"), ClineProvider = () => createJSONProvider({
62142
+ import { join as join27 } from "node:path";
62143
+ var extensionDir = () => join27(appSupportDir(), "Code", "User", "globalStorage", "saoudrizwan.claude-dev"), ClineProvider = () => createJSONProvider({
61879
62144
  providerName: "Cline",
61880
62145
  providerID: "cline",
61881
62146
  local: false,
61882
62147
  priorityValue: 11,
61883
62148
  paths: [extensionDir()],
61884
- globalPath: join26(extensionDir(), "settings", "cline_mcp_settings.json"),
62149
+ globalPath: join27(extensionDir(), "settings", "cline_mcp_settings.json"),
61885
62150
  topKey: "mcpServers",
61886
62151
  buildServer: ({ url, headers }) => ({
61887
62152
  url,
@@ -61896,7 +62161,7 @@ var init_cline = __esm(() => {
61896
62161
  });
61897
62162
 
61898
62163
  // src/mcp/providers/cline-cli.ts
61899
- import { join as join27 } from "node:path";
62164
+ import { join as join28 } from "node:path";
61900
62165
  function clineDir() {
61901
62166
  return process.env.CLINE_DIR ?? expandHome("~/.cline");
61902
62167
  }
@@ -61906,7 +62171,7 @@ var ClineCliProvider = () => createJSONProvider({
61906
62171
  local: false,
61907
62172
  priorityValue: 12,
61908
62173
  paths: [clineDir()],
61909
- globalPath: join27(clineDir(), "data", "settings", "cline_mcp_settings.json"),
62174
+ globalPath: join28(clineDir(), "data", "settings", "cline_mcp_settings.json"),
61910
62175
  topKey: "mcpServers",
61911
62176
  buildServer: ({ url, headers }) => ({
61912
62177
  url,
@@ -61921,20 +62186,20 @@ var init_cline_cli = __esm(() => {
61921
62186
  });
61922
62187
 
61923
62188
  // src/mcp/providers/codex.ts
61924
- import { existsSync as existsSync21, readFileSync as readFileSync21 } from "node:fs";
61925
- import { dirname as dirname11, join as join28 } from "node:path";
62189
+ import { existsSync as existsSync22, readFileSync as readFileSync22 } from "node:fs";
62190
+ import { dirname as dirname11, join as join29 } from "node:path";
61926
62191
  function codexHome3() {
61927
62192
  return process.env.CODEX_HOME ?? expandHome("~/.codex");
61928
62193
  }
61929
62194
  function getConfigPath2(global2) {
61930
62195
  if (global2)
61931
- return join28(codexHome3(), "config.toml");
61932
- return join28(process.cwd(), ".codex", "config.toml");
62196
+ return join29(codexHome3(), "config.toml");
62197
+ return join29(process.cwd(), ".codex", "config.toml");
61933
62198
  }
61934
62199
  function readTOML(path) {
61935
- if (!existsSync21(path))
62200
+ if (!existsSync22(path))
61936
62201
  return "";
61937
- return readFileSync21(path, "utf-8");
62202
+ return readFileSync22(path, "utf-8");
61938
62203
  }
61939
62204
  function writeTOML(path, content) {
61940
62205
  writeSecureFile(path, content);
@@ -62009,17 +62274,17 @@ function projectConfigPaths() {
62009
62274
  const chain = [];
62010
62275
  for (let dir = cwd;; ) {
62011
62276
  chain.push(dir);
62012
- if (existsSync21(join28(dir, ".git")))
62277
+ if (existsSync22(join29(dir, ".git")))
62013
62278
  break;
62014
62279
  const parent = dirname11(dir);
62015
62280
  if (parent === dir)
62016
- return [join28(cwd, ".codex", "config.toml")];
62281
+ return [join29(cwd, ".codex", "config.toml")];
62017
62282
  dir = parent;
62018
62283
  }
62019
- return chain.reverse().map((dir) => join28(dir, ".codex", "config.toml"));
62284
+ return chain.reverse().map((dir) => join29(dir, ".codex", "config.toml"));
62020
62285
  }
62021
62286
  function pruneLegacyRemoteEntry(path) {
62022
- if (!existsSync21(path))
62287
+ if (!existsSync22(path))
62023
62288
  return;
62024
62289
  const content = readTOML(path);
62025
62290
  if (!hasRemoteHTTPForm(content))
@@ -62033,9 +62298,9 @@ var REMOTE_HTTP_KEY, CodexProvider = () => ({
62033
62298
  priority: () => 8,
62034
62299
  detectPaths: () => ["~/.codex"],
62035
62300
  isInstalled: () => isInstalled(["~/.codex"]),
62036
- globalConfigPath: () => join28(codexHome3(), "config.toml"),
62301
+ globalConfigPath: () => join29(codexHome3(), "config.toml"),
62037
62302
  isConfigured: () => {
62038
- const content = readTOML(join28(codexHome3(), "config.toml"));
62303
+ const content = readTOML(join29(codexHome3(), "config.toml"));
62039
62304
  return content.includes("[mcp_servers.dosu]");
62040
62305
  },
62041
62306
  install(cfg, global2) {
@@ -62066,10 +62331,10 @@ var init_codex = __esm(() => {
62066
62331
  });
62067
62332
 
62068
62333
  // src/mcp/providers/copilot.ts
62069
- import { join as join29 } from "node:path";
62334
+ import { join as join30 } from "node:path";
62070
62335
  function globalPath() {
62071
62336
  if (process.env.XDG_CONFIG_HOME) {
62072
- return join29(process.env.XDG_CONFIG_HOME, "mcp-config.json");
62337
+ return join30(process.env.XDG_CONFIG_HOME, "mcp-config.json");
62073
62338
  }
62074
62339
  return expandHome("~/.copilot/mcp-config.json");
62075
62340
  }
@@ -62093,7 +62358,7 @@ var CopilotProvider = () => ({
62093
62358
  };
62094
62359
  installJSONServer(globalPath(), "mcpServers", server);
62095
62360
  } else {
62096
- const configPath = join29(process.cwd(), ".vscode", "mcp.json");
62361
+ const configPath = join30(process.cwd(), ".vscode", "mcp.json");
62097
62362
  const server = {
62098
62363
  type: "http",
62099
62364
  url,
@@ -62106,7 +62371,7 @@ var CopilotProvider = () => ({
62106
62371
  if (global2) {
62107
62372
  removeJSONServer(globalPath(), "mcpServers");
62108
62373
  } else {
62109
- const configPath = join29(process.cwd(), ".vscode", "mcp.json");
62374
+ const configPath = join30(process.cwd(), ".vscode", "mcp.json");
62110
62375
  removeJSONServer(configPath, "servers");
62111
62376
  }
62112
62377
  }
@@ -62117,7 +62382,7 @@ var init_copilot = __esm(() => {
62117
62382
  });
62118
62383
 
62119
62384
  // src/mcp/providers/cursor.ts
62120
- import { join as join30 } from "node:path";
62385
+ import { join as join31 } from "node:path";
62121
62386
  var CursorProvider = () => createJSONProvider({
62122
62387
  providerName: "Cursor",
62123
62388
  providerID: "cursor",
@@ -62130,14 +62395,14 @@ var CursorProvider = () => createJSONProvider({
62130
62395
  url,
62131
62396
  headers
62132
62397
  }),
62133
- localConfigPath: (cwd) => join30(cwd, ".cursor", "mcp.json")
62398
+ localConfigPath: (cwd) => join31(cwd, ".cursor", "mcp.json")
62134
62399
  });
62135
62400
  var init_cursor = __esm(() => {
62136
62401
  init_base();
62137
62402
  });
62138
62403
 
62139
62404
  // src/mcp/providers/factory.ts
62140
- import { join as join31 } from "node:path";
62405
+ import { join as join32 } from "node:path";
62141
62406
  var FactoryProvider = () => createJSONProvider({
62142
62407
  providerName: "Factory",
62143
62408
  providerID: "factory",
@@ -62146,14 +62411,14 @@ var FactoryProvider = () => createJSONProvider({
62146
62411
  paths: ["~/.factory"],
62147
62412
  globalPath: "~/.factory/mcp.json",
62148
62413
  topKey: "mcpServers",
62149
- localConfigPath: (cwd) => join31(cwd, ".factory", "mcp.json")
62414
+ localConfigPath: (cwd) => join32(cwd, ".factory", "mcp.json")
62150
62415
  });
62151
62416
  var init_factory = __esm(() => {
62152
62417
  init_base();
62153
62418
  });
62154
62419
 
62155
62420
  // src/mcp/providers/gemini.ts
62156
- import { join as join32 } from "node:path";
62421
+ import { join as join33 } from "node:path";
62157
62422
  var GeminiProvider = () => createJSONProvider({
62158
62423
  providerName: "Gemini CLI",
62159
62424
  providerID: "gemini",
@@ -62162,7 +62427,7 @@ var GeminiProvider = () => createJSONProvider({
62162
62427
  paths: ["~/.gemini"],
62163
62428
  globalPath: "~/.gemini/settings.json",
62164
62429
  topKey: "mcpServers",
62165
- localConfigPath: (cwd) => join32(cwd, ".gemini", "settings.json")
62430
+ localConfigPath: (cwd) => join33(cwd, ".gemini", "settings.json")
62166
62431
  });
62167
62432
  var init_gemini = __esm(() => {
62168
62433
  init_base();
@@ -62204,14 +62469,14 @@ var init_manual = __esm(() => {
62204
62469
  });
62205
62470
 
62206
62471
  // src/mcp/providers/mcporter.ts
62207
- import { existsSync as existsSync22 } from "node:fs";
62208
- import { join as join33 } from "node:path";
62472
+ import { existsSync as existsSync23 } from "node:fs";
62473
+ import { join as join34 } from "node:path";
62209
62474
  function resolveGlobalConfigPath() {
62210
62475
  const jsonPath = expandHome("~/.mcporter/mcporter.json");
62211
- if (existsSync22(jsonPath))
62476
+ if (existsSync23(jsonPath))
62212
62477
  return jsonPath;
62213
62478
  const jsoncPath = expandHome("~/.mcporter/mcporter.jsonc");
62214
- if (existsSync22(jsoncPath))
62479
+ if (existsSync23(jsoncPath))
62215
62480
  return jsoncPath;
62216
62481
  return jsonPath;
62217
62482
  }
@@ -62225,7 +62490,7 @@ var MCPorterProvider = () => ({
62225
62490
  globalConfigPath: () => resolveGlobalConfigPath(),
62226
62491
  isConfigured: () => isJSONKeyConfigured(resolveGlobalConfigPath(), "mcpServers"),
62227
62492
  install(cfg, global2) {
62228
- const configPath = global2 ? resolveGlobalConfigPath() : join33(process.cwd(), "config", "mcporter.json");
62493
+ const configPath = global2 ? resolveGlobalConfigPath() : join34(process.cwd(), "config", "mcporter.json");
62229
62494
  const server = {
62230
62495
  type: "http",
62231
62496
  url: mcpEndpoint(cfg),
@@ -62234,7 +62499,7 @@ var MCPorterProvider = () => ({
62234
62499
  installJSONServer(configPath, "mcpServers", server);
62235
62500
  },
62236
62501
  remove(global2) {
62237
- const configPath = global2 ? resolveGlobalConfigPath() : join33(process.cwd(), "config", "mcporter.json");
62502
+ const configPath = global2 ? resolveGlobalConfigPath() : join34(process.cwd(), "config", "mcporter.json");
62238
62503
  removeJSONServer(configPath, "mcpServers");
62239
62504
  }
62240
62505
  });
@@ -62244,7 +62509,7 @@ var init_mcporter = __esm(() => {
62244
62509
  });
62245
62510
 
62246
62511
  // src/mcp/providers/opencode.ts
62247
- import { join as join34 } from "node:path";
62512
+ import { join as join35 } from "node:path";
62248
62513
  var OpenCodeProvider = () => createJSONProvider({
62249
62514
  providerName: "OpenCode",
62250
62515
  providerID: "opencode",
@@ -62259,23 +62524,23 @@ var OpenCodeProvider = () => createJSONProvider({
62259
62524
  enabled: true,
62260
62525
  headers
62261
62526
  }),
62262
- localConfigPath: (cwd) => join34(cwd, "opencode.json")
62527
+ localConfigPath: (cwd) => join35(cwd, "opencode.json")
62263
62528
  });
62264
62529
  var init_opencode = __esm(() => {
62265
62530
  init_base();
62266
62531
  });
62267
62532
 
62268
62533
  // src/mcp/providers/vscode.ts
62269
- import { join as join35 } from "node:path";
62534
+ import { join as join36 } from "node:path";
62270
62535
  var VSCodeProvider = () => createJSONProvider({
62271
62536
  providerName: "VS Code",
62272
62537
  providerID: "vscode",
62273
62538
  local: true,
62274
62539
  priorityValue: 6,
62275
- paths: [join35(appSupportDir(), "Code")],
62276
- globalPath: join35(appSupportDir(), "Code", "User", "mcp.json"),
62540
+ paths: [join36(appSupportDir(), "Code")],
62541
+ globalPath: join36(appSupportDir(), "Code", "User", "mcp.json"),
62277
62542
  topKey: "servers",
62278
- localConfigPath: (cwd) => join35(cwd, ".vscode", "mcp.json")
62543
+ localConfigPath: (cwd) => join36(cwd, ".vscode", "mcp.json")
62279
62544
  });
62280
62545
  var init_vscode = __esm(() => {
62281
62546
  init_detect();
@@ -62284,14 +62549,14 @@ var init_vscode = __esm(() => {
62284
62549
 
62285
62550
  // src/mcp/providers/windsurf.ts
62286
62551
  import { homedir as homedir8 } from "node:os";
62287
- import { join as join36 } from "node:path";
62552
+ import { join as join37 } from "node:path";
62288
62553
  var WindsurfProvider = () => createJSONProvider({
62289
62554
  providerName: "Windsurf",
62290
62555
  providerID: "windsurf",
62291
62556
  local: false,
62292
62557
  priorityValue: 9,
62293
- paths: [join36(homedir8(), ".codeium", "windsurf")],
62294
- globalPath: join36(homedir8(), ".codeium", "windsurf", "mcp_config.json"),
62558
+ paths: [join37(homedir8(), ".codeium", "windsurf")],
62559
+ globalPath: join37(homedir8(), ".codeium", "windsurf", "mcp_config.json"),
62295
62560
  topKey: "mcpServers"
62296
62561
  });
62297
62562
  var init_windsurf = __esm(() => {
@@ -62301,25 +62566,25 @@ var init_windsurf = __esm(() => {
62301
62566
  // src/mcp/providers/zed.ts
62302
62567
  import { rmSync as rmSync6 } from "node:fs";
62303
62568
  import { homedir as homedir9, platform as platform3 } from "node:os";
62304
- import { join as join37 } from "node:path";
62569
+ import { join as join38 } from "node:path";
62305
62570
  function zedConfigDir() {
62306
62571
  const os = platform3();
62307
62572
  if (os === "win32")
62308
- return join37(appSupportDir(), "Zed");
62573
+ return join38(appSupportDir(), "Zed");
62309
62574
  if (os === "darwin")
62310
- return join37(homedir9(), ".config", "zed");
62311
- return join37(appSupportDir(), "zed");
62575
+ return join38(homedir9(), ".config", "zed");
62576
+ return join38(appSupportDir(), "zed");
62312
62577
  }
62313
62578
  function zedDataDir() {
62314
62579
  const os = platform3();
62315
62580
  if (os === "darwin")
62316
- return join37(appSupportDir(), "Zed");
62581
+ return join38(appSupportDir(), "Zed");
62317
62582
  if (os === "win32")
62318
- return join37(process.env.LOCALAPPDATA ?? "", "Zed");
62319
- return join37(process.env.XDG_DATA_HOME ?? join37(homedir9(), ".local", "share"), "zed");
62583
+ return join38(process.env.LOCALAPPDATA ?? "", "Zed");
62584
+ return join38(process.env.XDG_DATA_HOME ?? join38(homedir9(), ".local", "share"), "zed");
62320
62585
  }
62321
62586
  function legacyDarwinSettingsPath() {
62322
- return platform3() === "darwin" ? join37(appSupportDir(), "Zed", "settings.json") : null;
62587
+ return platform3() === "darwin" ? join38(appSupportDir(), "Zed", "settings.json") : null;
62323
62588
  }
62324
62589
  function removeLegacyDosuEntry(path) {
62325
62590
  let cfg;
@@ -62345,10 +62610,10 @@ var ZedProvider = (legacyPath = legacyDarwinSettingsPath()) => {
62345
62610
  local: true,
62346
62611
  priorityValue: 10,
62347
62612
  paths: [zedConfigDir(), zedDataDir()],
62348
- globalPath: join37(zedConfigDir(), "settings.json"),
62613
+ globalPath: join38(zedConfigDir(), "settings.json"),
62349
62614
  topKey: "context_servers",
62350
62615
  buildServer: ({ url, headers }) => ({ url, headers }),
62351
- localConfigPath: (cwd) => join37(cwd, ".zed", "settings.json")
62616
+ localConfigPath: (cwd) => join38(cwd, ".zed", "settings.json")
62352
62617
  });
62353
62618
  if (!legacyPath)
62354
62619
  return provider;
@@ -62456,29 +62721,29 @@ var init_refresh = __esm(() => {
62456
62721
  import { spawn as spawn3 } from "node:child_process";
62457
62722
  import {
62458
62723
  closeSync as closeSync6,
62459
- existsSync as existsSync23,
62460
- mkdirSync as mkdirSync13,
62724
+ existsSync as existsSync24,
62725
+ mkdirSync as mkdirSync14,
62461
62726
  openSync as openSync6,
62462
- readFileSync as readFileSync22,
62727
+ readFileSync as readFileSync23,
62463
62728
  rmSync as rmSync7,
62464
62729
  statSync as statSync8,
62465
- writeFileSync as writeFileSync14,
62730
+ writeFileSync as writeFileSync15,
62466
62731
  writeSync
62467
62732
  } from "node:fs";
62468
62733
  import { homedir as homedir10 } from "node:os";
62469
- import { join as join38 } from "node:path";
62734
+ import { join as join39 } from "node:path";
62470
62735
  function statePath() {
62471
- return join38(getConfigDir(), STATE_FILENAME2);
62736
+ return join39(getConfigDir(), STATE_FILENAME2);
62472
62737
  }
62473
62738
  function lockPath2() {
62474
- return join38(getConfigDir(), LOCK_FILENAME2);
62739
+ return join39(getConfigDir(), LOCK_FILENAME2);
62475
62740
  }
62476
62741
  function isValidVersion(value) {
62477
62742
  return typeof value === "string" && VERSION_PATTERN.test(value);
62478
62743
  }
62479
62744
  function readState() {
62480
62745
  try {
62481
- const raw = JSON.parse(readFileSync22(statePath(), "utf-8"));
62746
+ const raw = JSON.parse(readFileSync23(statePath(), "utf-8"));
62482
62747
  if (typeof raw !== "object" || raw === null || Array.isArray(raw))
62483
62748
  return {};
62484
62749
  const data = raw;
@@ -62497,9 +62762,9 @@ function readState() {
62497
62762
  function writeState(state) {
62498
62763
  try {
62499
62764
  const dir = getConfigDir();
62500
- if (!existsSync23(dir))
62501
- mkdirSync13(dir, { recursive: true, mode: 448 });
62502
- writeFileSync14(statePath(), `${JSON.stringify(state, null, 2)}
62765
+ if (!existsSync24(dir))
62766
+ mkdirSync14(dir, { recursive: true, mode: 448 });
62767
+ writeFileSync15(statePath(), `${JSON.stringify(state, null, 2)}
62503
62768
  `, { mode: 384 });
62504
62769
  return true;
62505
62770
  } catch {
@@ -62552,7 +62817,7 @@ function lockIsFresh(now) {
62552
62817
  }
62553
62818
  function claimLock(version, now) {
62554
62819
  try {
62555
- mkdirSync13(getConfigDir(), { recursive: true, mode: 448 });
62820
+ mkdirSync14(getConfigDir(), { recursive: true, mode: 448 });
62556
62821
  if (!lockIsFresh(now))
62557
62822
  rmSync7(lockPath2(), { force: true });
62558
62823
  const fd = openSync6(lockPath2(), "wx", 384);
@@ -62573,7 +62838,7 @@ function releaseLock() {
62573
62838
  }
62574
62839
  function readLockVersion() {
62575
62840
  try {
62576
- const version = readFileSync22(lockPath2(), "utf-8").trim();
62841
+ const version = readFileSync23(lockPath2(), "utf-8").trim();
62577
62842
  return isValidVersion(version) ? version : undefined;
62578
62843
  } catch {
62579
62844
  return;
@@ -62647,8 +62912,8 @@ var init_auto_update = __esm(() => {
62647
62912
  });
62648
62913
 
62649
62914
  // src/version/update-check.ts
62650
- import { existsSync as existsSync24, mkdirSync as mkdirSync14, readFileSync as readFileSync23, writeFileSync as writeFileSync15 } from "node:fs";
62651
- import { join as join39 } from "node:path";
62915
+ import { existsSync as existsSync25, mkdirSync as mkdirSync15, readFileSync as readFileSync24, writeFileSync as writeFileSync16 } from "node:fs";
62916
+ import { join as join40 } from "node:path";
62652
62917
  function isValidVersion2(value) {
62653
62918
  return typeof value === "string" && SEMVER_PATTERN.test(value);
62654
62919
  }
@@ -62670,14 +62935,14 @@ function isNewerVersion(latest, current) {
62670
62935
  return false;
62671
62936
  }
62672
62937
  function getCachePath2() {
62673
- return join39(getConfigDir(), CACHE_FILENAME3);
62938
+ return join40(getConfigDir(), CACHE_FILENAME3);
62674
62939
  }
62675
62940
  function readCache() {
62676
62941
  try {
62677
62942
  const path = getCachePath2();
62678
- if (!existsSync24(path))
62943
+ if (!existsSync25(path))
62679
62944
  return null;
62680
- const data = JSON.parse(readFileSync23(path, "utf-8"));
62945
+ const data = JSON.parse(readFileSync24(path, "utf-8"));
62681
62946
  if (typeof data.lastCheck === "number" && isValidVersion2(data.latestVersion)) {
62682
62947
  return data;
62683
62948
  }
@@ -62689,10 +62954,10 @@ function readCache() {
62689
62954
  function writeCache(cache) {
62690
62955
  try {
62691
62956
  const dir = getConfigDir();
62692
- if (!existsSync24(dir)) {
62693
- mkdirSync14(dir, { recursive: true, mode: 448 });
62957
+ if (!existsSync25(dir)) {
62958
+ mkdirSync15(dir, { recursive: true, mode: 448 });
62694
62959
  }
62695
- writeFileSync15(getCachePath2(), JSON.stringify(cache), { mode: 384 });
62960
+ writeFileSync16(getCachePath2(), JSON.stringify(cache), { mode: 384 });
62696
62961
  } catch {}
62697
62962
  }
62698
62963
  async function fetchLatestVersion() {
@@ -62820,8 +63085,8 @@ var init_update_check = __esm(() => {
62820
63085
  });
62821
63086
 
62822
63087
  // src/version/mcp-refresh-check.ts
62823
- import { existsSync as existsSync25, mkdirSync as mkdirSync15, readFileSync as readFileSync24, writeFileSync as writeFileSync16 } from "node:fs";
62824
- import { join as join40 } from "node:path";
63088
+ import { existsSync as existsSync26, mkdirSync as mkdirSync16, readFileSync as readFileSync25, writeFileSync as writeFileSync17 } from "node:fs";
63089
+ import { join as join41 } from "node:path";
62825
63090
  function needsMcpRefresh(previous, current) {
62826
63091
  if (previous === null)
62827
63092
  return true;
@@ -62831,14 +63096,14 @@ function needsMcpRefresh(previous, current) {
62831
63096
  return MCP_FORMAT_CHANGES.some((change) => isNewerVersion(change, older) && !isNewerVersion(change, newer));
62832
63097
  }
62833
63098
  function getCachePath3() {
62834
- return join40(getConfigDir(), CACHE_FILENAME4);
63099
+ return join41(getConfigDir(), CACHE_FILENAME4);
62835
63100
  }
62836
63101
  function readMcpRefreshCache() {
62837
63102
  try {
62838
63103
  const path = getCachePath3();
62839
- if (!existsSync25(path))
63104
+ if (!existsSync26(path))
62840
63105
  return null;
62841
- const data = JSON.parse(readFileSync24(path, "utf-8"));
63106
+ const data = JSON.parse(readFileSync25(path, "utf-8"));
62842
63107
  if (typeof data?.version === "string")
62843
63108
  return { version: data.version };
62844
63109
  return null;
@@ -62849,10 +63114,10 @@ function readMcpRefreshCache() {
62849
63114
  function writeMcpRefreshCache(cache) {
62850
63115
  try {
62851
63116
  const dir = getConfigDir();
62852
- if (!existsSync25(dir)) {
62853
- mkdirSync15(dir, { recursive: true, mode: 448 });
63117
+ if (!existsSync26(dir)) {
63118
+ mkdirSync16(dir, { recursive: true, mode: 448 });
62854
63119
  }
62855
- writeFileSync16(getCachePath3(), JSON.stringify(cache), { mode: 384 });
63120
+ writeFileSync17(getCachePath3(), JSON.stringify(cache), { mode: 384 });
62856
63121
  } catch {}
62857
63122
  }
62858
63123
  function canRefreshMcp(cfg) {
@@ -63000,15 +63265,15 @@ function createLogFollower(path, emit) {
63000
63265
  var init_follow = () => {};
63001
63266
 
63002
63267
  // src/sessions/session-title.ts
63003
- import { existsSync as existsSync26, mkdirSync as mkdirSync16, readFileSync as readFileSync25, renameSync as renameSync6, statSync as statSync10, writeFileSync as writeFileSync17 } from "node:fs";
63268
+ import { existsSync as existsSync27, mkdirSync as mkdirSync17, readFileSync as readFileSync26, renameSync as renameSync7, statSync as statSync10, writeFileSync as writeFileSync18 } from "node:fs";
63004
63269
  import { homedir as homedir11 } from "node:os";
63005
- import { join as join41 } from "node:path";
63270
+ import { join as join42 } from "node:path";
63006
63271
  function cachePath2(configDir) {
63007
- return join41(configDir, CACHE_FILENAME5);
63272
+ return join42(configDir, CACHE_FILENAME5);
63008
63273
  }
63009
63274
  function loadCacheFile2(configDir) {
63010
63275
  try {
63011
- const raw = JSON.parse(readFileSync25(cachePath2(configDir), "utf-8"));
63276
+ const raw = JSON.parse(readFileSync26(cachePath2(configDir), "utf-8"));
63012
63277
  if (raw.schema_version !== CACHE_SCHEMA_VERSION2 || typeof raw.entries !== "object")
63013
63278
  return {};
63014
63279
  return raw.entries;
@@ -63018,13 +63283,13 @@ function loadCacheFile2(configDir) {
63018
63283
  }
63019
63284
  function saveCacheFile2(configDir, entries) {
63020
63285
  try {
63021
- if (!existsSync26(configDir))
63022
- mkdirSync16(configDir, { recursive: true, mode: 448 });
63286
+ if (!existsSync27(configDir))
63287
+ mkdirSync17(configDir, { recursive: true, mode: 448 });
63023
63288
  const path = cachePath2(configDir);
63024
63289
  const tmp = `${path}.${process.pid}.tmp`;
63025
63290
  const file = { schema_version: CACHE_SCHEMA_VERSION2, entries };
63026
- writeFileSync17(tmp, JSON.stringify(file), { mode: 384 });
63027
- renameSync6(tmp, path);
63291
+ writeFileSync18(tmp, JSON.stringify(file), { mode: 384 });
63292
+ renameSync7(tmp, path);
63028
63293
  } catch {}
63029
63294
  }
63030
63295
  function extractUserQuery(text) {
@@ -63056,15 +63321,15 @@ function claudeSummaryFromHead(text) {
63056
63321
  }
63057
63322
  return null;
63058
63323
  }
63059
- function reconstructSession(harness, id, slug, home = homedir11(), exists = existsSync26) {
63324
+ function reconstructSession(harness, id, slug, home = homedir11(), exists = existsSync27) {
63060
63325
  if (!slug)
63061
63326
  return null;
63062
63327
  const candidates = [];
63063
63328
  if (harness === "claude") {
63064
- candidates.push(join41(home, ".claude", "projects", slug, `${id}.jsonl`));
63329
+ candidates.push(join42(home, ".claude", "projects", slug, `${id}.jsonl`));
63065
63330
  } else if (harness === "cursor") {
63066
- const project = join41(home, ".cursor", "projects", slug);
63067
- candidates.push(join41(project, "agent-transcripts", id, `${id}.jsonl`), join41(project, "agent-transcripts", `${id}.jsonl`));
63331
+ const project = join42(home, ".cursor", "projects", slug);
63332
+ candidates.push(join42(project, "agent-transcripts", id, `${id}.jsonl`), join42(project, "agent-transcripts", `${id}.jsonl`));
63068
63333
  } else {
63069
63334
  return null;
63070
63335
  }
@@ -63076,7 +63341,7 @@ function reconstructSession(harness, id, slug, home = homedir11(), exists = exis
63076
63341
  }
63077
63342
  function readHead2(path) {
63078
63343
  try {
63079
- return readFileSync25(path, "utf-8").slice(0, 128 * 1024);
63344
+ return readFileSync26(path, "utf-8").slice(0, 128 * 1024);
63080
63345
  } catch {
63081
63346
  return null;
63082
63347
  }
@@ -63156,8 +63421,8 @@ var init_alt_screen = __esm(() => {
63156
63421
  });
63157
63422
 
63158
63423
  // src/tui/activity-view.ts
63159
- import { existsSync as existsSync27, readFileSync as readFileSync26 } from "node:fs";
63160
- import { basename as basename5 } from "node:path";
63424
+ import { existsSync as existsSync28, readFileSync as readFileSync27 } from "node:fs";
63425
+ import { basename as basename6 } from "node:path";
63161
63426
  function reduceActivityViewKey(key) {
63162
63427
  if (key === "q" || key === ESC7 || key === CTRL_C4)
63163
63428
  return "back";
@@ -63477,12 +63742,12 @@ function createRowNamer() {
63477
63742
  names.titles[key] = t;
63478
63743
  };
63479
63744
  for (const s of [...backlog.queued, ...backlog.open]) {
63480
- if (!existsSync27(s.path))
63745
+ if (!existsSync28(s.path))
63481
63746
  continue;
63482
63747
  const key = `${s.harness}/${s.id}`;
63483
63748
  const dir = dirs.resolve(s);
63484
63749
  if (dir)
63485
- names.projects[key] = basename5(dir);
63750
+ names.projects[key] = basename6(dir);
63486
63751
  title(key, s);
63487
63752
  resolved = true;
63488
63753
  }
@@ -63491,7 +63756,7 @@ function createRowNamer() {
63491
63756
  if (!names.projects[key]) {
63492
63757
  const dir = dirs.cached(key) ?? (r.project ? fromSlug(r.project) : null);
63493
63758
  if (dir)
63494
- names.projects[key] = basename5(dir);
63759
+ names.projects[key] = basename6(dir);
63495
63760
  }
63496
63761
  if (!names.titles[key]) {
63497
63762
  const hit = titles.cached(key);
@@ -63514,7 +63779,7 @@ function createRowNamer() {
63514
63779
  }
63515
63780
  function defaultReadLog2() {
63516
63781
  try {
63517
- return readFileSync26(logger.getLogPath(), "utf-8");
63782
+ return readFileSync27(logger.getLogPath(), "utf-8");
63518
63783
  } catch {
63519
63784
  return "";
63520
63785
  }
@@ -63731,14 +63996,14 @@ var init_activity_view = __esm(() => {
63731
63996
  });
63732
63997
 
63733
63998
  // src/rules/installer.ts
63734
- import { existsSync as existsSync28, mkdirSync as mkdirSync17, readFileSync as readFileSync27, unlinkSync as unlinkSync5, writeFileSync as writeFileSync18 } from "node:fs";
63999
+ import { existsSync as existsSync29, mkdirSync as mkdirSync18, readFileSync as readFileSync28, unlinkSync as unlinkSync5, writeFileSync as writeFileSync19 } from "node:fs";
63735
64000
  import { homedir as homedir12 } from "node:os";
63736
- import { dirname as dirname12, join as join42 } from "node:path";
64001
+ import { dirname as dirname12, join as join43 } from "node:path";
63737
64002
  function claudeConfigDir4() {
63738
- return process.env.CLAUDE_CONFIG_DIR || join42(homedir12(), ".claude");
64003
+ return process.env.CLAUDE_CONFIG_DIR || join43(homedir12(), ".claude");
63739
64004
  }
63740
64005
  function codexHome4() {
63741
- return process.env.CODEX_HOME || join42(homedir12(), ".codex");
64006
+ return process.env.CODEX_HOME || join43(homedir12(), ".codex");
63742
64007
  }
63743
64008
  function isRuleAgent(agent) {
63744
64009
  return Object.hasOwn(RULE_TARGETS, agent);
@@ -63764,17 +64029,17 @@ async function fetchDosuRule(fetchImpl = globalThis.fetch) {
63764
64029
  return normalizeRule(FALLBACK_DOSU_RULE);
63765
64030
  }
63766
64031
  function ensureParent(path) {
63767
- mkdirSync17(dirname12(path), { recursive: true });
64032
+ mkdirSync18(dirname12(path), { recursive: true });
63768
64033
  }
63769
64034
  function writeIfChanged(path, content) {
63770
- if (!existsSync28(path)) {
64035
+ if (!existsSync29(path)) {
63771
64036
  ensureParent(path);
63772
- writeFileSync18(path, content, "utf-8");
64037
+ writeFileSync19(path, content, "utf-8");
63773
64038
  return "created";
63774
64039
  }
63775
- if (readFileSync27(path, "utf-8") === content)
64040
+ if (readFileSync28(path, "utf-8") === content)
63776
64041
  return "unchanged";
63777
- writeFileSync18(path, content, "utf-8");
64042
+ writeFileSync19(path, content, "utf-8");
63778
64043
  return "updated";
63779
64044
  }
63780
64045
  function findSection(content) {
@@ -63800,14 +64065,14 @@ function buildSection(content, lineEnding = `
63800
64065
  return `${DOSU_RULE_SECTION_START}${lineEnding}${body}${lineEnding}${DOSU_RULE_SECTION_END}`;
63801
64066
  }
63802
64067
  function upsertSection(path, content) {
63803
- if (!existsSync28(path)) {
64068
+ if (!existsSync29(path)) {
63804
64069
  const section = buildSection(content);
63805
64070
  ensureParent(path);
63806
- writeFileSync18(path, `${section}
64071
+ writeFileSync19(path, `${section}
63807
64072
  `, "utf-8");
63808
64073
  return "created";
63809
64074
  }
63810
- const existing = readFileSync27(path, "utf-8");
64075
+ const existing = readFileSync28(path, "utf-8");
63811
64076
  const lineEnding = lineEndingFor(existing);
63812
64077
  const section = buildSection(content, lineEnding);
63813
64078
  const location = findSection(existing);
@@ -63820,7 +64085,7 @@ function upsertSection(path, content) {
63820
64085
  }
63821
64086
  if (next === existing)
63822
64087
  return "unchanged";
63823
- writeFileSync18(path, next, "utf-8");
64088
+ writeFileSync19(path, next, "utf-8");
63824
64089
  return "updated";
63825
64090
  }
63826
64091
  function installRuleForAgent(agent, content) {
@@ -63837,13 +64102,13 @@ function removeRuleForAgent(agent) {
63837
64102
  return null;
63838
64103
  const target = RULE_TARGETS[agent];
63839
64104
  const path = target.path();
63840
- if (!existsSync28(path))
64105
+ if (!existsSync29(path))
63841
64106
  return { agent, path, action: "not_found" };
63842
64107
  if (target.kind === "file") {
63843
64108
  unlinkSync5(path);
63844
64109
  return { agent, path, action: "removed" };
63845
64110
  }
63846
- const existing = readFileSync27(path, "utf-8");
64111
+ const existing = readFileSync28(path, "utf-8");
63847
64112
  const lineEnding = lineEndingFor(existing);
63848
64113
  const location = findSection(existing);
63849
64114
  if (!location)
@@ -63852,7 +64117,7 @@ function removeRuleForAgent(agent) {
63852
64117
  if (!next) {
63853
64118
  unlinkSync5(path);
63854
64119
  } else {
63855
- writeFileSync18(path, `${next}${lineEnding}`, "utf-8");
64120
+ writeFileSync19(path, `${next}${lineEnding}`, "utf-8");
63856
64121
  }
63857
64122
  return { agent, path, action: "removed" };
63858
64123
  }
@@ -63880,36 +64145,36 @@ var init_installer = __esm(() => {
63880
64145
  RULE_TARGETS = {
63881
64146
  claude: {
63882
64147
  kind: "file",
63883
- path: () => join42(claudeConfigDir4(), "rules", "dosu.md")
64148
+ path: () => join43(claudeConfigDir4(), "rules", "dosu.md")
63884
64149
  },
63885
64150
  cursor: {
63886
64151
  kind: "file",
63887
- path: () => join42(homedir12(), ".cursor", "rules", "dosu.mdc"),
64152
+ path: () => join43(homedir12(), ".cursor", "rules", "dosu.mdc"),
63888
64153
  cursorFrontmatter: true
63889
64154
  },
63890
64155
  codex: {
63891
64156
  kind: "section",
63892
- path: () => join42(codexHome4(), "AGENTS.md")
64157
+ path: () => join43(codexHome4(), "AGENTS.md")
63893
64158
  },
63894
64159
  opencode: {
63895
64160
  kind: "section",
63896
- path: () => join42(homedir12(), ".config", "opencode", "AGENTS.md")
64161
+ path: () => join43(homedir12(), ".config", "opencode", "AGENTS.md")
63897
64162
  },
63898
64163
  gemini: {
63899
64164
  kind: "section",
63900
- path: () => join42(homedir12(), ".gemini", "GEMINI.md")
64165
+ path: () => join43(homedir12(), ".gemini", "GEMINI.md")
63901
64166
  },
63902
64167
  antigravity: {
63903
64168
  kind: "section",
63904
- path: () => join42(homedir12(), ".gemini", "GEMINI.md")
64169
+ path: () => join43(homedir12(), ".gemini", "GEMINI.md")
63905
64170
  }
63906
64171
  };
63907
64172
  });
63908
64173
 
63909
64174
  // src/setup/agents-md-step.ts
63910
64175
  import { execSync as execSync2 } from "node:child_process";
63911
- import { existsSync as existsSync29, readFileSync as readFileSync28, writeFileSync as writeFileSync19 } from "node:fs";
63912
- import { join as join43 } from "node:path";
64176
+ import { existsSync as existsSync30, readFileSync as readFileSync29, writeFileSync as writeFileSync20 } from "node:fs";
64177
+ import { join as join44 } from "node:path";
63913
64178
  function inGitWorkTree(cwd = process.cwd()) {
63914
64179
  try {
63915
64180
  const stdout = execSync2("git rev-parse --is-inside-work-tree", {
@@ -63923,10 +64188,10 @@ function inGitWorkTree(cwd = process.cwd()) {
63923
64188
  }
63924
64189
  function dosuAgentsSectionState(cwd = process.cwd()) {
63925
64190
  try {
63926
- const path = join43(cwd, "AGENTS.md");
63927
- if (!existsSync29(path))
64191
+ const path = join44(cwd, "AGENTS.md");
64192
+ if (!existsSync30(path))
63928
64193
  return "missing";
63929
- const content = readFileSync28(path, "utf-8");
64194
+ const content = readFileSync29(path, "utf-8");
63930
64195
  const startMatch = content.match(SECTION_START_RE);
63931
64196
  if (!startMatch || !content.includes(DOSU_SECTION_END))
63932
64197
  return "missing";
@@ -63961,14 +64226,14 @@ function findSection2(content) {
63961
64226
  return { start, end };
63962
64227
  }
63963
64228
  function upsertDosuAgentsSection(cwd = process.cwd(), content = FALLBACK_DOSU_RULE) {
63964
- const path = join43(cwd, "AGENTS.md");
63965
- if (!existsSync29(path)) {
64229
+ const path = join44(cwd, "AGENTS.md");
64230
+ if (!existsSync30(path)) {
63966
64231
  const section = buildDosuAgentsSection(content);
63967
- writeFileSync19(path, `${section}
64232
+ writeFileSync20(path, `${section}
63968
64233
  `);
63969
64234
  return { path, action: "created" };
63970
64235
  }
63971
- const existing = readFileSync28(path, "utf-8");
64236
+ const existing = readFileSync29(path, "utf-8");
63972
64237
  const lineEnding = lineEndingFor2(existing);
63973
64238
  const section = renderDosuAgentsSection(content, lineEnding);
63974
64239
  const location = findSection2(existing);
@@ -63980,7 +64245,7 @@ function upsertDosuAgentsSection(cwd = process.cwd(), content = FALLBACK_DOSU_RU
63980
64245
  }
63981
64246
  if (next === existing)
63982
64247
  return { path, action: "unchanged" };
63983
- writeFileSync19(path, next);
64248
+ writeFileSync20(path, next);
63984
64249
  return { path, action: "updated" };
63985
64250
  }
63986
64251
  async function stepUpdateAgentsMd(cwd = process.cwd(), content) {
@@ -64754,9 +65019,6 @@ async function runSetupFlow(opts = {}) {
64754
65019
  if (cfg.mode !== MODE_OSS) {
64755
65020
  await stepShowLibrary(cfg);
64756
65021
  }
64757
- if (cfg.mode !== MODE_OSS) {
64758
- await stepOfferGithubConnect(cfg);
64759
- }
64760
65022
  const apiKey = await stepMintAPIKey(apiClient, cfg);
64761
65023
  if (!apiKey) {
64762
65024
  trackInBackground(trackCliOnboardingEvent(cfg, onboardingRunID, "cli_onboarding_failed", {
@@ -65080,46 +65342,6 @@ async function stepSetupHandshake(cfg, onboardingRunID) {
65080
65342
  return false;
65081
65343
  }
65082
65344
  }
65083
- async function stepOfferGithubConnect(cfg) {
65084
- const target = cfg.active_account?.target;
65085
- if (!target?.org_id || !target?.space_id)
65086
- return;
65087
- try {
65088
- await Promise.resolve().then(() => init_trpc());
65089
- const trpc = createTypedClient(cfg);
65090
- if (await spaceHasGithubSource(trpc, target.space_id))
65091
- return;
65092
- } catch (err) {
65093
- const msg = err instanceof Error ? err.message : String(err);
65094
- logger.warn("setup", `GitHub source check failed, skipping offer: ${msg}`);
65095
- return;
65096
- }
65097
- logger.info("setup", "Step: offer GitHub connect (no GitHub source in the MCP's Library)");
65098
- log2.warn("No GitHub repos are connected to this MCP yet, so it can't answer from your code.");
65099
- const connectNow = await confirm2({
65100
- message: "Connect a GitHub repo now?",
65101
- active: "Connect now",
65102
- inactive: "Skip for now",
65103
- initialValue: true
65104
- });
65105
- if (isCancel2(connectNow) || !connectNow) {
65106
- log2.info(`Skipped. Connect later at ${info(`${getWebAppURL()}/libraries`)} or re-run ${info("dosu setup")}.`);
65107
- return;
65108
- }
65109
- await stepConnectGitHubRepo(cfg);
65110
- }
65111
- async function spaceHasGithubSource(trpc, spaceID) {
65112
- try {
65113
- const sources = await trpc.libraries.sourcesList.query(spaceID);
65114
- return (sources ?? []).some((source) => source.provider_slug === "github");
65115
- } catch (err) {
65116
- const missingProcedure = isTRPCClientError(err) && err.data?.code === "NOT_FOUND";
65117
- if (!missingProcedure)
65118
- throw err;
65119
- const spaceDeployments = await trpc.workspaces.listForSpace.query(spaceID);
65120
- return (spaceDeployments ?? []).some((d) => d.provider_slug === "github");
65121
- }
65122
- }
65123
65345
  async function resolveCloudSetupContext(cfg) {
65124
65346
  try {
65125
65347
  await Promise.resolve().then(() => init_trpc());
@@ -65652,7 +65874,6 @@ ${dim(wrapLog("Run it inside a session to keep that session out of studying. Rem
65652
65874
  }
65653
65875
  var import_picocolors34, OAUTH_ANALYTICS_REASONS, SETUP_HANDSHAKE_TIMEOUT_MS = 1800000, LIBRARY_SELECT_CANCELLED;
65654
65876
  var init_flow2 = __esm(() => {
65655
- init_dist();
65656
65877
  init_errors3();
65657
65878
  init_client();
65658
65879
  init_skill();
@@ -65672,7 +65893,6 @@ var init_flow2 = __esm(() => {
65672
65893
  init_mcp_refresh_check();
65673
65894
  init_agents_md_step();
65674
65895
  init_analytics2();
65675
- init_github_step();
65676
65896
  init_rules_step();
65677
65897
  init_styles();
65678
65898
  import_picocolors34 = __toESM(require_picocolors(), 1);
@@ -66664,7 +66884,7 @@ var init_pages_view = __esm(() => {
66664
66884
  });
66665
66885
 
66666
66886
  // src/tui/tui.ts
66667
- import { basename as basename6 } from "node:path";
66887
+ import { basename as basename7 } from "node:path";
66668
66888
  async function probeSession(cfg) {
66669
66889
  if (!isAuthenticated(cfg) || !isTokenExpired(cfg))
66670
66890
  return { expired: false };
@@ -66691,7 +66911,7 @@ function bannerContext(cfg, session) {
66691
66911
  return {
66692
66912
  version: getVersionString(),
66693
66913
  webAppHost,
66694
- directory: basename6(process.cwd()),
66914
+ directory: basename7(process.cwd()),
66695
66915
  signedIn: isAuthenticated(cfg),
66696
66916
  sessionExpired: session.expired,
66697
66917
  deploymentName: cfg.active_account?.target?.deployment_name,
@@ -67638,7 +67858,7 @@ var init_flow3 = __esm(() => {
67638
67858
  });
67639
67859
 
67640
67860
  // src/cli/cli.ts
67641
- import { readFileSync as readFileSync29, unlinkSync as unlinkSync6 } from "node:fs";
67861
+ import { readFileSync as readFileSync30, unlinkSync as unlinkSync6 } from "node:fs";
67642
67862
  function shouldRunBackgroundChecks(actionName) {
67643
67863
  return actionName !== "upgrade";
67644
67864
  }
@@ -68084,7 +68304,7 @@ Use 'dosu mcp add <agent>' to add Dosu MCP to a tool.`);
68084
68304
  }
68085
68305
  if (opts.follow) {
68086
68306
  try {
68087
- const lines = readFileSync29(logPath, "utf-8").split(`
68307
+ const lines = readFileSync30(logPath, "utf-8").split(`
68088
68308
  `);
68089
68309
  if (lines.at(-1) === "")
68090
68310
  lines.pop();
@@ -68100,7 +68320,7 @@ Use 'dosu mcp add <agent>' to add Dosu MCP to a tool.`);
68100
68320
  if (opts.tail !== undefined) {
68101
68321
  const n = typeof opts.tail === "string" ? parseInt(opts.tail, 10) || 50 : 50;
68102
68322
  try {
68103
- const content = readFileSync29(logPath, "utf-8");
68323
+ const content = readFileSync30(logPath, "utf-8");
68104
68324
  const lines = content.split(`
68105
68325
  `);
68106
68326
  console.log(lines.slice(-n).join(`
@@ -68226,4 +68446,4 @@ main().catch((err) => {
68226
68446
  process.exit(1);
68227
68447
  });
68228
68448
 
68229
- //# debugId=01f74cf6-cdbb-b296-6475-6e2164756e21
68449
+ //# debugId=3b9a1619-fdbd-ebdd-6475-6e2164756e21