@dugleelabs/copair 1.4.3 → 1.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/api.js CHANGED
@@ -1571,7 +1571,8 @@ ${summary}`
1571
1571
  // src/core/session.ts
1572
1572
  import { writeFile, rename, appendFile, readFile, readdir, rm, mkdir, stat } from "fs/promises";
1573
1573
  import { existsSync, mkdirSync } from "fs";
1574
- import { join, resolve } from "path";
1574
+ import { join } from "path";
1575
+ import { homedir } from "os";
1575
1576
  import { execSync } from "child_process";
1576
1577
  import { randomUUID } from "crypto";
1577
1578
  import { createInterface } from "readline";
@@ -1602,8 +1603,7 @@ function resolveSessionsDir(cwd) {
1602
1603
  mkdirSync(dir2, { recursive: true });
1603
1604
  return dir2;
1604
1605
  }
1605
- const home = process.env["HOME"] ?? "~";
1606
- const dir = join(resolve(home), ".copair", "sessions");
1606
+ const dir = join(homedir(), ".copair", "sessions");
1607
1607
  mkdirSync(dir, { recursive: true });
1608
1608
  return dir;
1609
1609
  }
@@ -1659,18 +1659,18 @@ async function presentSessionPicker(sessions) {
1659
1659
  console.log(` ${sessions.length + 1}. Start fresh`);
1660
1660
  process.stdout.write(`
1661
1661
  Select [1-${sessions.length + 1}]: `);
1662
- return new Promise((resolve11) => {
1662
+ return new Promise((resolve10) => {
1663
1663
  const rl = createInterface({ input: process.stdin, terminal: false });
1664
1664
  rl.once("line", (line) => {
1665
1665
  rl.close();
1666
1666
  const choice = parseInt(line.trim(), 10);
1667
1667
  if (choice >= 1 && choice <= sessions.length) {
1668
- resolve11(sessions[choice - 1].id);
1668
+ resolve10(sessions[choice - 1].id);
1669
1669
  } else {
1670
- resolve11(null);
1670
+ resolve10(null);
1671
1671
  }
1672
1672
  });
1673
- rl.once("close", () => resolve11(null));
1673
+ rl.once("close", () => resolve10(null));
1674
1674
  });
1675
1675
  }
1676
1676
  var SessionManager = class _SessionManager {
@@ -1842,8 +1842,7 @@ var SessionManager = class _SessionManager {
1842
1842
  }
1843
1843
  // -- Migration ------------------------------------------------------------
1844
1844
  static async migrateGlobalRecovery(sessionsDir, projectRoot) {
1845
- const home = process.env["HOME"] ?? "~";
1846
- const recoveryFile = join(resolve(home), ".copair", "sessions", "recovery.json");
1845
+ const recoveryFile = join(homedir(), ".copair", "sessions", "recovery.json");
1847
1846
  if (!existsSync(recoveryFile)) return null;
1848
1847
  try {
1849
1848
  const raw = await readFile(recoveryFile, "utf8");
@@ -1889,8 +1888,8 @@ var SessionManager = class _SessionManager {
1889
1888
 
1890
1889
  // src/core/path-guard.ts
1891
1890
  import { realpathSync, existsSync as existsSync2 } from "fs";
1892
- import { resolve as resolve2, dirname } from "path";
1893
- import { homedir } from "os";
1891
+ import { resolve, dirname, basename, sep } from "path";
1892
+ import { homedir as homedir2 } from "os";
1894
1893
  import { execSync as execSync2 } from "child_process";
1895
1894
  import { minimatch } from "minimatch";
1896
1895
  var BUILTIN_DENY = [
@@ -1908,8 +1907,8 @@ var BUILTIN_DENY = [
1908
1907
  "**/.env.local"
1909
1908
  ];
1910
1909
  function expandHome(pattern) {
1911
- if (pattern === "~") return homedir();
1912
- if (pattern.startsWith("~/")) return homedir() + pattern.slice(1);
1910
+ if (pattern === "~") return homedir2();
1911
+ if (pattern.startsWith("~/")) return resolve(homedir2(), pattern.slice(2));
1913
1912
  return pattern;
1914
1913
  }
1915
1914
  var PathGuard = class _PathGuard {
@@ -1939,15 +1938,14 @@ var PathGuard = class _PathGuard {
1939
1938
  }
1940
1939
  resolved = realpathSync(rawPath);
1941
1940
  } else {
1942
- const parentRaw = dirname(resolve2(rawPath));
1941
+ const parentRaw = dirname(resolve(rawPath));
1943
1942
  if (!existsSync2(parentRaw)) {
1944
1943
  return { allowed: false, reason: "parent-missing" };
1945
1944
  }
1946
1945
  const resolvedParent = realpathSync(parentRaw);
1947
- const filename = rawPath.split("/").at(-1);
1948
- resolved = resolve2(resolvedParent, filename);
1946
+ resolved = resolve(resolvedParent, basename(rawPath));
1949
1947
  }
1950
- const inside = resolved.startsWith(this.projectRoot + "/") || resolved === this.projectRoot;
1948
+ const inside = resolved.startsWith(this.projectRoot + sep) || resolved === this.projectRoot;
1951
1949
  if (inside) {
1952
1950
  return { allowed: true, resolvedPath: resolved };
1953
1951
  }
@@ -1964,12 +1962,12 @@ var PathGuard = class _PathGuard {
1964
1962
  }
1965
1963
  isDenied(resolved) {
1966
1964
  return this.expandedDenyPatterns.some(
1967
- (pattern) => minimatch(resolved, pattern, { dot: true })
1965
+ (pattern) => minimatch(resolved, pattern, { dot: true, windowsPathsNoEscape: true })
1968
1966
  );
1969
1967
  }
1970
1968
  isAllowed(resolved) {
1971
1969
  return this.expandedAllowPatterns.some(
1972
- (pattern) => minimatch(resolved, pattern, { dot: true })
1970
+ (pattern) => minimatch(resolved, pattern, { dot: true, windowsPathsNoEscape: true })
1973
1971
  );
1974
1972
  }
1975
1973
  /**
@@ -1980,7 +1978,7 @@ var PathGuard = class _PathGuard {
1980
1978
  */
1981
1979
  static findProjectRoot(cwd) {
1982
1980
  try {
1983
- return execSync2("git rev-parse --show-toplevel", { cwd, encoding: "utf8" }).trim();
1981
+ return resolve(execSync2("git rev-parse --show-toplevel", { cwd, encoding: "utf8" }).trim());
1984
1982
  } catch {
1985
1983
  return cwd;
1986
1984
  }
@@ -2189,7 +2187,7 @@ var bashTool = {
2189
2187
  encoding: "utf-8",
2190
2188
  maxBuffer: 5 * 1024 * 1024,
2191
2189
  timeout,
2192
- shell: "/bin/bash"
2190
+ shell: process.platform === "win32" ? "cmd.exe" : "/bin/bash"
2193
2191
  });
2194
2192
  return { content: result };
2195
2193
  } catch (err) {
@@ -2322,7 +2320,7 @@ var ToolExecutor = class {
2322
2320
  };
2323
2321
 
2324
2322
  // src/core/approval-gate.ts
2325
- import { resolve as resolvePath } from "path";
2323
+ import { resolve as resolvePath, sep as sep2 } from "path";
2326
2324
  import chalk4 from "chalk";
2327
2325
 
2328
2326
  // src/cli/tty-prompt.ts
@@ -2430,8 +2428,8 @@ var ApprovalGate = class {
2430
2428
  if (typeof filePath !== "string") return false;
2431
2429
  const abs = resolvePath(filePath);
2432
2430
  for (const trusted of this.trustedPaths) {
2433
- if (abs === trusted || abs.startsWith(trusted + "/")) {
2434
- if (PERMISSION_SENSITIVE_FILES.some((name) => abs.endsWith("/" + name))) {
2431
+ if (abs === trusted || abs.startsWith(trusted + sep2)) {
2432
+ if (PERMISSION_SENSITIVE_FILES.some((name) => abs.endsWith(sep2 + name))) {
2435
2433
  return false;
2436
2434
  }
2437
2435
  return true;
@@ -2483,7 +2481,7 @@ var ApprovalGate = class {
2483
2481
  }
2484
2482
  /** Bridge-based approval: emit event and await response from ink UI. */
2485
2483
  bridgePrompt(toolName, input, key) {
2486
- return new Promise((resolve11) => {
2484
+ return new Promise((resolve10) => {
2487
2485
  const summary = formatSummary(toolName, input);
2488
2486
  const warning = typeof input._sensitivePathWarning === "string" ? input._sensitivePathWarning : void 0;
2489
2487
  this.bridge.emit("approval-request", {
@@ -2497,29 +2495,29 @@ var ApprovalGate = class {
2497
2495
  switch (answer) {
2498
2496
  case "allow":
2499
2497
  void this.auditLog?.append({ event: "approval", tool: toolName, approved_by: "user", outcome: "allowed" });
2500
- resolve11(true);
2498
+ resolve10(true);
2501
2499
  break;
2502
2500
  case "always":
2503
2501
  this.alwaysAllow.add(key);
2504
2502
  void this.auditLog?.append({ event: "approval", tool: toolName, approved_by: "user", outcome: "allowed", detail: "always" });
2505
- resolve11(true);
2503
+ resolve10(true);
2506
2504
  break;
2507
2505
  case "all":
2508
2506
  this.bridge.approveAllForTurn = true;
2509
2507
  void this.auditLog?.append({ event: "approval", tool: toolName, approved_by: "user", outcome: "allowed", detail: "approve-all" });
2510
- resolve11(true);
2508
+ resolve10(true);
2511
2509
  break;
2512
2510
  case "similar": {
2513
2511
  const similarKey = similarSessionKey(toolName, input);
2514
2512
  this.alwaysAllow.add(similarKey);
2515
2513
  void this.auditLog?.append({ event: "approval", tool: toolName, approved_by: "user", outcome: "allowed", detail: "similar" });
2516
- resolve11(true);
2514
+ resolve10(true);
2517
2515
  break;
2518
2516
  }
2519
2517
  case "deny":
2520
2518
  default:
2521
2519
  void this.auditLog?.append({ event: "denial", tool: toolName, outcome: "denied", detail: "user denied" });
2522
- resolve11(false);
2520
+ resolve10(false);
2523
2521
  break;
2524
2522
  }
2525
2523
  });
@@ -2593,7 +2591,7 @@ function sessionKey(toolName, input) {
2593
2591
  function similarSessionKey(toolName, input) {
2594
2592
  const filePath = input.file_path ?? input.path;
2595
2593
  if (typeof filePath === "string") {
2596
- const dir = filePath.replace(/\/[^/]*$/, "/");
2594
+ const dir = filePath.replace(/[/\\][^/\\]*$/, sep2);
2597
2595
  return `${toolName}:${dir}`;
2598
2596
  }
2599
2597
  return sessionKey(toolName, input);
@@ -2688,20 +2686,20 @@ var ToolRegistry = class {
2688
2686
  import { join as join15 } from "path";
2689
2687
  import { existsSync as existsSync18, readFileSync as readFileSync10 } from "fs";
2690
2688
  import { createRequire as createRequire3 } from "module";
2691
- import { resolve as resolve10, dirname as dirname7 } from "path";
2689
+ import { resolve as resolve9, dirname as dirname7 } from "path";
2692
2690
  import { fileURLToPath as fileURLToPath3 } from "url";
2693
2691
 
2694
2692
  // src/cli/args.ts
2695
2693
  import { Command } from "commander";
2696
2694
  import { createRequire } from "module";
2697
- import { resolve as resolve3, dirname as dirname2 } from "path";
2695
+ import { resolve as resolve2, dirname as dirname2 } from "path";
2698
2696
  import { fileURLToPath } from "url";
2699
2697
  var _dir = dirname2(fileURLToPath(import.meta.url));
2700
2698
  var require2 = createRequire(import.meta.url);
2701
2699
  var pkg = (() => {
2702
2700
  for (const rel of ["../package.json", "../../package.json"]) {
2703
2701
  try {
2704
- return require2(resolve3(_dir, rel));
2702
+ return require2(resolve2(_dir, rel));
2705
2703
  } catch {
2706
2704
  }
2707
2705
  }
@@ -2722,8 +2720,8 @@ function parseArgs(argv = process.argv) {
2722
2720
 
2723
2721
  // src/config/loader.ts
2724
2722
  import { readFileSync, existsSync as existsSync4 } from "fs";
2725
- import { resolve as resolve4 } from "path";
2726
- import { homedir as homedir2 } from "os";
2723
+ import { resolve as resolve3 } from "path";
2724
+ import { homedir as homedir3 } from "os";
2727
2725
  import { parse as parseYaml } from "yaml";
2728
2726
 
2729
2727
  // src/config/schema.ts
@@ -2883,8 +2881,8 @@ function loadYamlFile(filePath) {
2883
2881
  return parseYaml(content);
2884
2882
  }
2885
2883
  function loadConfig(projectDir) {
2886
- const globalPath = resolve4(homedir2(), ".copair", "config.yaml");
2887
- const projectPath = projectDir ? resolve4(projectDir, ".copair", "config.yaml") : resolve4(process.cwd(), ".copair", "config.yaml");
2884
+ const globalPath = resolve3(homedir3(), ".copair", "config.yaml");
2885
+ const projectPath = projectDir ? resolve3(projectDir, ".copair", "config.yaml") : resolve3(process.cwd(), ".copair", "config.yaml");
2888
2886
  const globalConfig = loadYamlFile(globalPath);
2889
2887
  const projectConfig = loadYamlFile(projectPath);
2890
2888
  if (!globalConfig && !projectConfig) {
@@ -3689,7 +3687,7 @@ var grepTool = {
3689
3687
 
3690
3688
  // src/tools/glob.ts
3691
3689
  import { globSync } from "glob";
3692
- import { resolve as resolve5 } from "path";
3690
+ import { resolve as resolve4 } from "path";
3693
3691
  import { z as z7 } from "zod";
3694
3692
  var GlobInputSchema = z7.object({
3695
3693
  pattern: z7.string().min(1),
@@ -3718,7 +3716,7 @@ var globTool = {
3718
3716
  if (matches.length === 0) {
3719
3717
  return { content: `No files found matching "${pattern}" in ${cwd}` };
3720
3718
  }
3721
- const absolute = matches.map((m) => resolve5(cwd, m)).sort();
3719
+ const absolute = matches.map((m) => resolve4(cwd, m)).sort();
3722
3720
  return { content: absolute.join("\n") };
3723
3721
  } catch (err) {
3724
3722
  return { content: `Error: ${err.message}`, isError: true };
@@ -4218,13 +4216,13 @@ Session: ${meta.identifier}`);
4218
4216
 
4219
4217
  // src/commands/loader.ts
4220
4218
  import { readdir as readdir2, readFile as readFile2, stat as stat2 } from "fs/promises";
4221
- import { join as join2, resolve as resolve6, relative } from "path";
4219
+ import { join as join2, resolve as resolve5, relative } from "path";
4222
4220
  import { existsSync as existsSync7 } from "fs";
4223
4221
 
4224
4222
  // src/commands/interpolate.ts
4225
4223
  import { execSync as execSync7 } from "child_process";
4226
4224
  async function interpolate(template, args, context) {
4227
- const resolve11 = (key) => {
4225
+ const resolve10 = (key) => {
4228
4226
  if (key.startsWith("env.")) {
4229
4227
  return process.env[key.slice(4)] ?? "";
4230
4228
  }
@@ -4235,10 +4233,10 @@ async function interpolate(template, args, context) {
4235
4233
  return null;
4236
4234
  };
4237
4235
  let result = template.replace(/\{\{([^}]+)\}\}/g, (_match, key) => {
4238
- return resolve11(key.trim()) ?? _match;
4236
+ return resolve10(key.trim()) ?? _match;
4239
4237
  });
4240
4238
  result = result.replace(/\$([A-Z][A-Z0-9_]*)/g, (_match, key) => {
4241
- return resolve11(key) ?? _match;
4239
+ return resolve10(key) ?? _match;
4242
4240
  });
4243
4241
  return result;
4244
4242
  }
@@ -4337,8 +4335,8 @@ async function loadCommandsFromDir(dir, source) {
4337
4335
  return commands;
4338
4336
  }
4339
4337
  async function loadCustomCommands() {
4340
- const globalDir = resolve6(process.env["HOME"] ?? "~", ".copair", "commands");
4341
- const projectDir = resolve6(process.cwd(), ".copair", "commands");
4338
+ const globalDir = resolve5(process.env["HOME"] ?? "~", ".copair", "commands");
4339
+ const projectDir = resolve5(process.cwd(), ".copair", "commands");
4342
4340
  const globalCommands = await loadCommandsFromDir(globalDir, "global");
4343
4341
  const projectCommands = await loadCommandsFromDir(projectDir, "project");
4344
4342
  return [...globalCommands, ...projectCommands];
@@ -4448,7 +4446,7 @@ var CommandRegistry = class {
4448
4446
 
4449
4447
  // src/workflows/loader.ts
4450
4448
  import { readdir as readdir3, readFile as readFile3 } from "fs/promises";
4451
- import { join as join3, resolve as resolve7 } from "path";
4449
+ import { join as join3, resolve as resolve6 } from "path";
4452
4450
  import { existsSync as existsSync8 } from "fs";
4453
4451
  import { parse as parseYaml2 } from "yaml";
4454
4452
  import { z as z11 } from "zod";
@@ -4504,8 +4502,8 @@ async function loadWorkflowsFromDir(dir) {
4504
4502
  return workflows;
4505
4503
  }
4506
4504
  async function loadWorkflows() {
4507
- const globalDir = resolve7(process.env["HOME"] ?? "~", ".copair", "workflows");
4508
- const projectDir = resolve7(process.cwd(), ".copair", "workflows");
4505
+ const globalDir = resolve6(process.env["HOME"] ?? "~", ".copair", "workflows");
4506
+ const projectDir = resolve6(process.cwd(), ".copair", "workflows");
4509
4507
  const globalWorkflows = await loadWorkflowsFromDir(globalDir);
4510
4508
  const projectWorkflows = await loadWorkflowsFromDir(projectDir);
4511
4509
  const map = /* @__PURE__ */ new Map();
@@ -4848,10 +4846,10 @@ function extractFileWords(messages) {
4848
4846
  for (const key of ["file_path", "path", "filePath"]) {
4849
4847
  const val = input[key];
4850
4848
  if (typeof val === "string") {
4851
- const basename2 = val.split("/").pop()?.replace(/\.[^.]+$/, "") ?? "";
4852
- if (basename2) {
4849
+ const basename3 = val.split("/").pop()?.replace(/\.[^.]+$/, "") ?? "";
4850
+ if (basename3) {
4853
4851
  words.push(
4854
- ...basename2.split(/[^a-z0-9]+/i).map((w) => w.toLowerCase()).filter((w) => w.length > 2 && !STOP_WORDS.has(w))
4852
+ ...basename3.split(/[^a-z0-9]+/i).map((w) => w.toLowerCase()).filter((w) => w.length > 2 && !STOP_WORDS.has(w))
4855
4853
  );
4856
4854
  }
4857
4855
  }
@@ -5022,8 +5020,8 @@ var SessionSummarizer = class {
5022
5020
  return text.trim();
5023
5021
  }
5024
5022
  timeout() {
5025
- return new Promise((resolve11) => {
5026
- setTimeout(() => resolve11(null), this.timeoutMs);
5023
+ return new Promise((resolve10) => {
5024
+ setTimeout(() => resolve10(null), this.timeoutMs);
5027
5025
  });
5028
5026
  }
5029
5027
  };
@@ -5056,7 +5054,7 @@ async function resolveSummarizationModel(configModel, activeModel) {
5056
5054
  // src/core/version-check.ts
5057
5055
  import { readFile as readFile5, writeFile as writeFile3, mkdir as mkdir2 } from "fs/promises";
5058
5056
  import { existsSync as existsSync10 } from "fs";
5059
- import { join as join5, resolve as resolve8, dirname as dirname4 } from "path";
5057
+ import { join as join5, resolve as resolve7, dirname as dirname4 } from "path";
5060
5058
  import { createRequire as createRequire2 } from "module";
5061
5059
  import { fileURLToPath as fileURLToPath2 } from "url";
5062
5060
  var _dir2 = dirname4(fileURLToPath2(import.meta.url));
@@ -5064,13 +5062,13 @@ var _require = createRequire2(import.meta.url);
5064
5062
  var pkg2 = (() => {
5065
5063
  for (const rel of ["../package.json", "../../package.json"]) {
5066
5064
  try {
5067
- return _require(resolve8(_dir2, rel));
5065
+ return _require(resolve7(_dir2, rel));
5068
5066
  } catch {
5069
5067
  }
5070
5068
  }
5071
5069
  return { name: "copair", version: process.env["COPAIR_VERSION"] ?? "0.0.0-dev" };
5072
5070
  })();
5073
- var CACHE_DIR = resolve8(process.env["HOME"] ?? "~", ".copair");
5071
+ var CACHE_DIR = resolve7(process.env["HOME"] ?? "~", ".copair");
5074
5072
  var CACHE_FILE = join5(CACHE_DIR, "version-check.json");
5075
5073
  var CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
5076
5074
  async function fetchLatestVersion() {
@@ -6425,8 +6423,8 @@ function renderApp(bridge, model, options) {
6425
6423
 
6426
6424
  // src/core/allow-list.ts
6427
6425
  import { readFileSync as readFileSync5, existsSync as existsSync11 } from "fs";
6428
- import { resolve as resolve9 } from "path";
6429
- import { homedir as homedir3 } from "os";
6426
+ import { resolve as resolve8 } from "path";
6427
+ import { homedir as homedir4 } from "os";
6430
6428
  import { parse as parseYaml3 } from "yaml";
6431
6429
  var AllowList = class {
6432
6430
  rules;
@@ -6481,8 +6479,8 @@ var AllowList = class {
6481
6479
  };
6482
6480
  var ALLOW_FILE = "allow.yaml";
6483
6481
  function loadAllowList(projectDir) {
6484
- const globalPath = resolve9(homedir3(), ".copair", ALLOW_FILE);
6485
- const projectPath = resolve9(projectDir ?? process.cwd(), ".copair", ALLOW_FILE);
6482
+ const globalPath = resolve8(homedir4(), ".copair", ALLOW_FILE);
6483
+ const projectPath = resolve8(projectDir ?? process.cwd(), ".copair", ALLOW_FILE);
6486
6484
  const global = readAllowFile(globalPath);
6487
6485
  const project = readAllowFile(projectPath);
6488
6486
  return new AllowList({
@@ -6543,7 +6541,7 @@ import chalk6 from "chalk";
6543
6541
  // package.json
6544
6542
  var package_default = {
6545
6543
  name: "@dugleelabs/copair",
6546
- version: "1.4.3",
6544
+ version: "1.4.4",
6547
6545
  description: "Model-agnostic AI coding agent for the terminal",
6548
6546
  type: "module",
6549
6547
  main: "dist/api.js",
@@ -6716,14 +6714,14 @@ var DEFAULT_PRICING = /* @__PURE__ */ new Map([
6716
6714
  // src/cli/ui/input-history.ts
6717
6715
  import { readFileSync as readFileSync6, writeFileSync as writeFileSync3, mkdirSync as mkdirSync3, existsSync as existsSync12 } from "fs";
6718
6716
  import { join as join6, dirname as dirname5 } from "path";
6719
- import { homedir as homedir4 } from "os";
6717
+ import { homedir as homedir5 } from "os";
6720
6718
  var MAX_HISTORY = 500;
6721
6719
  function resolveHistoryPath(cwd) {
6722
6720
  const projectPath = join6(cwd, ".copair", "history");
6723
6721
  if (existsSync12(join6(cwd, ".copair"))) {
6724
6722
  return projectPath;
6725
6723
  }
6726
- return join6(homedir4(), ".copair", "history");
6724
+ return join6(homedir5(), ".copair", "history");
6727
6725
  }
6728
6726
  function loadHistory(historyPath) {
6729
6727
  try {
@@ -6751,7 +6749,7 @@ function appendHistory(historyPath, entry) {
6751
6749
 
6752
6750
  // src/cli/ui/completion-providers.ts
6753
6751
  import { readdirSync } from "fs";
6754
- import { join as join7, dirname as dirname6, basename } from "path";
6752
+ import { join as join7, dirname as dirname6, basename as basename2 } from "path";
6755
6753
  var SlashCommandProvider = class {
6756
6754
  id = "slash-commands";
6757
6755
  commands;
@@ -6790,7 +6788,7 @@ var FilePathProvider = class {
6790
6788
  const lastToken = input.split(/\s+/).pop() ?? "";
6791
6789
  try {
6792
6790
  const dir = lastToken.endsWith("/") ? join7(this.cwd, lastToken) : join7(this.cwd, dirname6(lastToken));
6793
- const prefix = lastToken.endsWith("/") ? "" : basename(lastToken);
6791
+ const prefix = lastToken.endsWith("/") ? "" : basename2(lastToken);
6794
6792
  const beforeToken = input.slice(0, input.length - lastToken.length);
6795
6793
  const entries = readdirSync(dir, { withFileTypes: true });
6796
6794
  const items = [];
@@ -6844,7 +6842,7 @@ var CompletionEngine = class {
6844
6842
  // src/init/GlobalInitManager.ts
6845
6843
  import { existsSync as existsSync13, mkdirSync as mkdirSync4, writeFileSync as writeFileSync4 } from "fs";
6846
6844
  import { join as join8 } from "path";
6847
- import { homedir as homedir5 } from "os";
6845
+ import { homedir as homedir6 } from "os";
6848
6846
  var GLOBAL_CONFIG_TEMPLATE = `# Copair global configuration
6849
6847
  # Generated by Copair on first run \u2014 edit as needed
6850
6848
 
@@ -6874,7 +6872,7 @@ var GLOBAL_CONFIG_TEMPLATE = `# Copair global configuration
6874
6872
  var GlobalInitManager = class {
6875
6873
  globalDir;
6876
6874
  constructor(homeDir) {
6877
- this.globalDir = join8(homeDir ?? homedir5(), ".copair");
6875
+ this.globalDir = join8(homeDir ?? homedir6(), ".copair");
6878
6876
  }
6879
6877
  async check(options = { ci: false }) {
6880
6878
  if (existsSync13(this.globalDir)) {
@@ -7399,7 +7397,7 @@ var _require2 = createRequire3(import.meta.url);
7399
7397
  var _pkg = (() => {
7400
7398
  for (const rel of ["../package.json", "../../package.json"]) {
7401
7399
  try {
7402
- return _require2(resolve10(_dir3, rel));
7400
+ return _require2(resolve9(_dir3, rel));
7403
7401
  } catch {
7404
7402
  }
7405
7403
  }