neuro-vault-mcp 8.1.0 → 8.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -15233,6 +15233,24 @@ function matchesAnyPrefix(p, prefixes) {
15233
15233
  }
15234
15234
  return false;
15235
15235
  }
15236
+ function rethrowPathNotFoundWithIndex(err, prefix, index, total) {
15237
+ const isRaw = err instanceof ScanPathNotFoundError;
15238
+ const isWrapped = err instanceof ToolHandlerError && err.code === "PATH_NOT_FOUND";
15239
+ if (!isRaw && !isWrapped) {
15240
+ throw err;
15241
+ }
15242
+ if (total <= 1) {
15243
+ if (isRaw) {
15244
+ throw new ToolHandlerError("PATH_NOT_FOUND", err.message);
15245
+ }
15246
+ throw err;
15247
+ }
15248
+ throw new ToolHandlerError(
15249
+ "PATH_NOT_FOUND",
15250
+ `path_prefix[${index}] not found: ${JSON.stringify(prefix)}`,
15251
+ { details: { path_prefix: prefix, index } }
15252
+ );
15253
+ }
15236
15254
 
15237
15255
  // src/lib/obsidian/query/whitelist.ts
15238
15256
  var ALLOWED_OPERATORS = /* @__PURE__ */ new Set([
@@ -15351,9 +15369,10 @@ async function runQueryNotes(input, reader, graph) {
15351
15369
  const includes = validated.includePrefixes ?? [void 0];
15352
15370
  const multiPrefix = includes.length > 1;
15353
15371
  const earlyExitAfter = sortOrderMatchesScan && !multiPrefix ? validated.limit : void 0;
15372
+ const totalIncludes = includes.length;
15354
15373
  const batches = await Promise.all(
15355
- includes.map(
15356
- (prefix) => collectMatchingPaths(
15374
+ includes.map((prefix, i) => {
15375
+ const promise2 = collectMatchingPaths(
15357
15376
  {
15358
15377
  filter: effectiveFilter,
15359
15378
  pathPrefix: prefix,
@@ -15362,8 +15381,11 @@ async function runQueryNotes(input, reader, graph) {
15362
15381
  excludePathPrefixes: validated.excludePrefixes
15363
15382
  },
15364
15383
  { reader, graph }
15365
- )
15366
- )
15384
+ );
15385
+ return prefix === void 0 ? promise2 : promise2.catch(
15386
+ (err) => rethrowPathNotFoundWithIndex(err, prefix, i, totalIncludes)
15387
+ );
15388
+ })
15367
15389
  );
15368
15390
  const seen = /* @__PURE__ */ new Set();
15369
15391
  const matched = [];
@@ -15516,20 +15538,16 @@ function createListMatchingPaths(deps) {
15516
15538
  }
15517
15539
  if (!hasTags && !hasFrontmatter) {
15518
15540
  const collected = /* @__PURE__ */ new Set();
15519
- try {
15520
- if (hasInclude) {
15521
- const scans = await Promise.all(
15522
- includePrefixes.map((p) => deps.reader.scan({ pathPrefix: p }))
15523
- );
15524
- for (const list of scans) for (const p of list) collected.add(p);
15525
- } else {
15526
- for (const p of await deps.reader.scan({ pathPrefix: void 0 })) collected.add(p);
15527
- }
15528
- } catch (err) {
15529
- if (err instanceof ScanPathNotFoundError) {
15530
- throw new ToolHandlerError("PATH_NOT_FOUND", err.message);
15531
- }
15532
- throw err;
15541
+ if (hasInclude) {
15542
+ const total = includePrefixes.length;
15543
+ const scans = await Promise.all(
15544
+ includePrefixes.map(
15545
+ (p, i) => deps.reader.scan({ pathPrefix: p }).catch((err) => rethrowPathNotFoundWithIndex(err, p, i, total))
15546
+ )
15547
+ );
15548
+ for (const list of scans) for (const p of list) collected.add(p);
15549
+ } else {
15550
+ for (const p of await deps.reader.scan({ pathPrefix: void 0 })) collected.add(p);
15533
15551
  }
15534
15552
  if (hasExclude) {
15535
15553
  for (const p of [...collected]) {
@@ -15544,9 +15562,10 @@ function createListMatchingPaths(deps) {
15544
15562
  const internalFilter = compileFilter({ tags, frontmatter });
15545
15563
  const effectiveFilter = applyDefaultRegexOptions(internalFilter);
15546
15564
  const scanPrefixes = hasInclude ? [...includePrefixes] : [void 0];
15565
+ const totalIncludes = scanPrefixes.length;
15547
15566
  const batched = await Promise.all(
15548
- scanPrefixes.map(
15549
- (prefix) => collectMatchingPaths(
15567
+ scanPrefixes.map((prefix, i) => {
15568
+ const promise2 = collectMatchingPaths(
15550
15569
  {
15551
15570
  filter: effectiveFilter,
15552
15571
  pathPrefix: prefix,
@@ -15554,8 +15573,11 @@ function createListMatchingPaths(deps) {
15554
15573
  excludePathPrefixes: hasExclude ? excludePrefixes : void 0
15555
15574
  },
15556
15575
  deps
15557
- )
15558
- )
15576
+ );
15577
+ return prefix === void 0 ? promise2 : promise2.catch(
15578
+ (err) => rethrowPathNotFoundWithIndex(err, prefix, i, totalIncludes)
15579
+ );
15580
+ })
15559
15581
  );
15560
15582
  const out = /* @__PURE__ */ new Set();
15561
15583
  for (const rows of batched) {