@tekmidian/pai 0.33.2 → 0.33.3

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.
@@ -7,13 +7,13 @@ import "../helpers-crDEr6S2.mjs";
7
7
  import "../sync--BoxBBok.mjs";
8
8
  import "../embeddings-Bn86ssxR.mjs";
9
9
  import "../search-C32zQ0V0.mjs";
10
- import "../pick-Ccysp-Sb.mjs";
10
+ import "../pick-bRiW6Dkp.mjs";
11
11
  import "../checkpoint-block-D3rm4dAJ.mjs";
12
12
  import "../indexer-AEcT8wHf.mjs";
13
13
  import "../ipc-client-aVKVERjJ.mjs";
14
14
  import "../config-CcdkNSWa.mjs";
15
15
  import "../factory-Cd94gzNz.mjs";
16
- import "../main-resolver-Cc2ohdT4.mjs";
16
+ import "../main-resolver-CNSqU8wo.mjs";
17
17
  import { buildProgram } from "./program.mjs";
18
18
 
19
19
  //#region src/cli/index.ts
@@ -6,13 +6,13 @@ import "../helpers-crDEr6S2.mjs";
6
6
  import "../sync--BoxBBok.mjs";
7
7
  import "../embeddings-Bn86ssxR.mjs";
8
8
  import "../search-C32zQ0V0.mjs";
9
- import { A as registerProjectsCommands, C as registerRestoreCommands, D as registerIdentityCommands, E as registerMcpCommands, M as resolveIdentifier, O as registerMemoryCommands, S as registerSetupCommand, T as registerDaemonCommands, _ as registerUpdateCommand, a as cmdEnd, b as registerZettelCommands, c as cmdGoto, d as registerHelpCommand, f as registerDbCommands, g as registerNotifyCommands, h as registerTaskCommands, i as cmdPauseAll, j as findMovedPath, k as registerRegistryCommands, l as cmdPause, m as registerTopicCommands, n as cmdFind, o as registerSessionCleanupCommand, p as registerKgCommands, r as cmdClearNames, s as registerSessionCommands, t as cmdPick, u as cmdList, v as registerSkillCommands, w as registerBackupCommands, x as registerObsidianCommands, y as registerObservationCommands } from "../pick-Ccysp-Sb.mjs";
9
+ import { A as registerProjectsCommands, C as registerRestoreCommands, D as registerIdentityCommands, E as registerMcpCommands, M as resolveIdentifier, O as registerMemoryCommands, S as registerSetupCommand, T as registerDaemonCommands, _ as registerUpdateCommand, a as cmdEnd, b as registerZettelCommands, c as cmdGoto, d as registerHelpCommand, f as registerDbCommands, g as registerNotifyCommands, h as registerTaskCommands, i as cmdPauseAll, j as findMovedPath, k as registerRegistryCommands, l as cmdPause, m as registerTopicCommands, n as cmdFind, o as registerSessionCleanupCommand, p as registerKgCommands, r as cmdClearNames, s as registerSessionCommands, t as cmdPick, u as cmdList, v as registerSkillCommands, w as registerBackupCommands, x as registerObsidianCommands, y as registerObservationCommands } from "../pick-bRiW6Dkp.mjs";
10
10
  import "../checkpoint-block-D3rm4dAJ.mjs";
11
11
  import "../indexer-AEcT8wHf.mjs";
12
12
  import "../ipc-client-aVKVERjJ.mjs";
13
13
  import "../config-CcdkNSWa.mjs";
14
14
  import "../factory-Cd94gzNz.mjs";
15
- import { t as cmdMain } from "../main-resolver-Cc2ohdT4.mjs";
15
+ import { t as cmdMain } from "../main-resolver-CNSqU8wo.mjs";
16
16
  import { existsSync, readFileSync } from "node:fs";
17
17
  import { basename, dirname, join } from "node:path";
18
18
  import { Command } from "commander";
@@ -1424,12 +1424,8 @@ function launchSession(session, allSessions, dryRun) {
1424
1424
  sameProject.sort((a, b) => b.mtime - a.mtime);
1425
1425
  if (sameProject.length > 0) resumableUuid = sameProject[0].uuid;
1426
1426
  }
1427
- const { dir: projectDir, tried } = resolveSessionDir(session);
1428
- if (projectDir === void 0) {
1429
- console.error(err(`Session directory does not exist or cannot be resolved.\n` + tried.map((c) => ` tried: ${c}\n`).join("") + ` The directory may have moved or been deleted.`));
1430
- process.exit(1);
1431
- return;
1432
- }
1427
+ const { dir: projectDir } = resolveSessionDir(session);
1428
+ if (projectDir === void 0) return false;
1433
1429
  const name = session.friendlyName ?? (basename(projectDir) || session.shortId);
1434
1430
  const promptArg = `/Name ${name}\ngo`;
1435
1431
  if (dryRun) {
@@ -1445,7 +1441,7 @@ function launchSession(session, allSessions, dryRun) {
1445
1441
  console.log(` argv: claude --name "${name}" "/Name ${name}\\ngo"`);
1446
1442
  }
1447
1443
  console.log();
1448
- return;
1444
+ return true;
1449
1445
  }
1450
1446
  if (resumableUuid) {
1451
1447
  const probe = probeResume(resumableUuid, projectDir);
@@ -1586,10 +1582,7 @@ async function openMatch(entry, allSessions, dryRun) {
1586
1582
  if (entry.status === "live") {
1587
1583
  if (await doSwitch(entry, dryRun)) return true;
1588
1584
  }
1589
- if (entry.diskSession) {
1590
- launchSession(entry.diskSession, allSessions, dryRun);
1591
- return true;
1592
- }
1585
+ if (entry.diskSession && launchSession(entry.diskSession, allSessions, dryRun)) return true;
1593
1586
  if (entry.project && existsSync(entry.project)) {
1594
1587
  launchInDir(entry.project, entry.name, { dryRun });
1595
1588
  return true;
@@ -1654,9 +1647,7 @@ async function cmdMain(db, query, pickN, opts) {
1654
1647
  const nameIncludes = (e, q) => e.name.toLowerCase().includes(q) || e.slug !== void 0 && e.slug.toLowerCase().includes(qSlug);
1655
1648
  const newestFirst = (a, b) => b.lastActivity - a.lastActivity;
1656
1649
  const exactMatches = deduped.filter((e) => nameMatches(e, qNorm)).sort(newestFirst);
1657
- if (exactMatches.length > 0) {
1658
- if (await openMatch(exactMatches[0], allSessions, opts.dryRun ?? false)) return;
1659
- }
1650
+ for (const match of exactMatches) if (await openMatch(match, allSessions, opts.dryRun ?? false)) return;
1660
1651
  let partialMatches = deduped.filter((e) => nameIncludes(e, qNorm));
1661
1652
  if (partialMatches.length === 0) {
1662
1653
  const qWords = qNorm.split(/\s+/).filter(Boolean);
@@ -1715,6 +1706,18 @@ async function cmdMain(db, query, pickN, opts) {
1715
1706
  return;
1716
1707
  }
1717
1708
  }
1709
+ {
1710
+ const q = query.toLowerCase().replace(/[-_]+/g, " ").replace(/\s+/g, " ").trim();
1711
+ const byName = registeredProjects.filter((p) => {
1712
+ const name = (p.display_name ?? "").toLowerCase().replace(/[-_]+/g, " ").trim();
1713
+ const slug = (p.slug ?? "").toLowerCase().replace(/[-_]+/g, " ").trim();
1714
+ return name === q || slug === q;
1715
+ });
1716
+ for (const p of byName) if (p.root_path && existsSync(p.root_path)) {
1717
+ launchInDir(p.root_path, p.display_name ?? query, { dryRun: opts.dryRun ?? false });
1718
+ return;
1719
+ }
1720
+ }
1718
1721
  if (!existsSync(HISTORY_FILE)) {
1719
1722
  console.error(err("~/.claude/history.jsonl not found."));
1720
1723
  console.error(dim(" No prompt history available for search."));
@@ -1784,4 +1787,4 @@ async function cmdMain(db, query, pickN, opts) {
1784
1787
 
1785
1788
  //#endregion
1786
1789
  export { scanSessions as _, renderDedupedSessions as a, probeResume as c, callAiBroker as d, fetchLiveSessions as f, resolveSessionByNameOrId as g, fmtAge as h, normalizeName as i, restoreTopLevel as l, sendToSession as m, main_resolver_exports as n, hasConversation as o, revealItermSession as p, buildDeduped as r, launchInDir as s, cmdMain as t, printExitDir as u };
1787
- //# sourceMappingURL=main-resolver-Cc2ohdT4.mjs.map
1790
+ //# sourceMappingURL=main-resolver-CNSqU8wo.mjs.map