@ncukondo/reference-manager 0.30.1 → 0.31.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 (39) hide show
  1. package/dist/chunks/{SearchableMultiSelect-SOvTpKAU.js → SearchableMultiSelect-BFgiGVkF.js} +2 -2
  2. package/dist/chunks/{SearchableMultiSelect-SOvTpKAU.js.map → SearchableMultiSelect-BFgiGVkF.js.map} +1 -1
  3. package/dist/chunks/{action-menu-DCZcb0HB.js → action-menu-D5s90TfM.js} +3 -3
  4. package/dist/chunks/{action-menu-DCZcb0HB.js.map → action-menu-D5s90TfM.js.map} +1 -1
  5. package/dist/chunks/{checker-CxSG7cdw.js → checker-DMyZFCaP.js} +4 -4
  6. package/dist/chunks/{checker-CxSG7cdw.js.map → checker-DMyZFCaP.js.map} +1 -1
  7. package/dist/chunks/{crossref-client-CN2pRi3R.js → crossref-client-CaFCAASM.js} +2 -2
  8. package/dist/chunks/{crossref-client-CN2pRi3R.js.map → crossref-client-CaFCAASM.js.map} +1 -1
  9. package/dist/chunks/{fix-interaction-C3OrF3yU.js → fix-interaction-h15RI_Ae.js} +5 -5
  10. package/dist/chunks/{fix-interaction-C3OrF3yU.js.map → fix-interaction-h15RI_Ae.js.map} +1 -1
  11. package/dist/chunks/{index-CA9y5wSm.js → index-BG3Ef4Pd.js} +4 -4
  12. package/dist/chunks/{index-CA9y5wSm.js.map → index-BG3Ef4Pd.js.map} +1 -1
  13. package/dist/chunks/{index-C_mW5LMY.js → index-CS8S6gE4.js} +3 -3
  14. package/dist/chunks/{index-C_mW5LMY.js.map → index-CS8S6gE4.js.map} +1 -1
  15. package/dist/chunks/{index-BZMfDG4M.js → index-Cqss7VR_.js} +3 -3
  16. package/dist/chunks/index-Cqss7VR_.js.map +1 -0
  17. package/dist/chunks/{index-4w0pu_0o.js → index-DCBYzNj-.js} +317 -58
  18. package/dist/chunks/index-DCBYzNj-.js.map +1 -0
  19. package/dist/chunks/{pubmed-client-MF5gA6Os.js → pubmed-client-vbreWUxK.js} +2 -2
  20. package/dist/chunks/{pubmed-client-MF5gA6Os.js.map → pubmed-client-vbreWUxK.js.map} +1 -1
  21. package/dist/chunks/{reference-select-Bm-05R0u.js → reference-select-CNWexQGu.js} +3 -3
  22. package/dist/chunks/{reference-select-Bm-05R0u.js.map → reference-select-CNWexQGu.js.map} +1 -1
  23. package/dist/chunks/{style-select-kfWjEg1X.js → style-select-D8beMum_.js} +3 -3
  24. package/dist/chunks/{style-select-kfWjEg1X.js.map → style-select-D8beMum_.js.map} +1 -1
  25. package/dist/cli/commands/show.d.ts +16 -0
  26. package/dist/cli/commands/show.d.ts.map +1 -0
  27. package/dist/cli/index.d.ts.map +1 -1
  28. package/dist/cli.js +2 -2
  29. package/dist/features/format/show-normalizer.d.ts +43 -0
  30. package/dist/features/format/show-normalizer.d.ts.map +1 -0
  31. package/dist/features/format/show-pretty.d.ts +8 -0
  32. package/dist/features/format/show-pretty.d.ts.map +1 -0
  33. package/dist/mcp/tools/index.d.ts.map +1 -1
  34. package/dist/mcp/tools/show.d.ts +23 -0
  35. package/dist/mcp/tools/show.d.ts.map +1 -0
  36. package/dist/server.js +1 -1
  37. package/package.json +1 -1
  38. package/dist/chunks/index-4w0pu_0o.js.map +0 -1
  39. package/dist/chunks/index-BZMfDG4M.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { Command, Option } from "commander";
2
- import { n as normalizePathForOutput, d as deleteDirectoryIfEmpty, p as parseFilename, i as isReservedRole, e as ensureDirectory, a as addAttachment, R as RESERVED_ROLES, b as generateFilename, c as findFulltextFiles, h as findFulltextFile, j as extensionToFormat, k as fulltextAttach, l as fulltextDiscover, m as fulltextFetch, o as fulltextConvert, q as fulltextGet, r as getExtension, s as getDefaultExportFromCjs, B as BUILTIN_STYLES, t as packageJson, u as getFulltextAttachmentTypes, v as startServerWithFileWatcher, w as BUILTIN_CONVERTER_NAMES, x as BUILTIN_CONVERTER_INFO } from "./index-C_mW5LMY.js";
2
+ import { n as normalizePathForOutput, d as deleteDirectoryIfEmpty, p as parseFilename, i as isReservedRole, e as ensureDirectory, a as addAttachment, R as RESERVED_ROLES, b as generateFilename, c as findFulltextFiles, h as findFulltextFile, j as extensionToFormat, k as fulltextAttach, l as fulltextDiscover, m as fulltextFetch, o as fulltextConvert, q as fulltextGet, r as getExtension, s as getDefaultExportFromCjs, B as BUILTIN_STYLES, t as packageJson, u as getFulltextAttachmentTypes, v as startServerWithFileWatcher, w as BUILTIN_CONVERTER_NAMES, x as BUILTIN_CONVERTER_INFO } from "./index-CS8S6gE4.js";
3
3
  import { i as isEqual, M as MANAGED_CUSTOM_FIELDS, w as writeFileAtomic, L as Library, h as CslItemSchema, p as pickDefined, a as sortOrderSchema, z as paginationOptionsSchema, F as FileWatcher, b as sortFieldSchema, y as searchSortFieldSchema } from "./file-watcher-CWHg1yol.js";
4
4
  import * as fs from "node:fs";
5
5
  import { promises, readFileSync, existsSync, mkdirSync, writeFileSync } from "node:fs";
@@ -613,11 +613,11 @@ function inferFromFilename(filename) {
613
613
  if (!parsed) {
614
614
  return { filename, role: "other", label: filename };
615
615
  }
616
- const { role, label } = parsed;
616
+ const { role, label: label2 } = parsed;
617
617
  if (isReservedRole(role)) {
618
- return label ? { filename, role, label } : { filename, role };
618
+ return label2 ? { filename, role, label: label2 } : { filename, role };
619
619
  }
620
- const basename2 = label ? `${role}-${label}` : role;
620
+ const basename2 = label2 ? `${role}-${label2}` : role;
621
621
  return { filename, role: "other", label: basename2 };
622
622
  }
623
623
  async function getFilesOnDisk(dirPath) {
@@ -656,11 +656,11 @@ function buildUpdatedFiles(metadataFiles, newFiles, missingFiles, shouldApplyNew
656
656
  for (const newFile of newFiles) {
657
657
  const override = roleOverrides?.[newFile.filename];
658
658
  const role = override?.role ?? newFile.role;
659
- const label = override ? override.label : newFile.label;
659
+ const label2 = override ? override.label : newFile.label;
660
660
  const attachmentFile = {
661
661
  filename: newFile.filename,
662
662
  role,
663
- ...label && { label }
663
+ ...label2 && { label: label2 }
664
664
  };
665
665
  updatedFiles.push(attachmentFile);
666
666
  }
@@ -893,15 +893,15 @@ class OperationsLibrary {
893
893
  }
894
894
  // High-level operations
895
895
  async search(options) {
896
- const { searchReferences } = await import("./index-C_mW5LMY.js").then((n) => n.H);
896
+ const { searchReferences } = await import("./index-CS8S6gE4.js").then((n) => n.H);
897
897
  return searchReferences(this.library, options);
898
898
  }
899
899
  async list(options) {
900
- const { listReferences } = await import("./index-C_mW5LMY.js").then((n) => n.G);
900
+ const { listReferences } = await import("./index-CS8S6gE4.js").then((n) => n.G);
901
901
  return listReferences(this.library, options ?? {});
902
902
  }
903
903
  async cite(options) {
904
- const { citeReferences } = await import("./index-C_mW5LMY.js").then((n) => n.F);
904
+ const { citeReferences } = await import("./index-CS8S6gE4.js").then((n) => n.F);
905
905
  const defaultStyle = options.defaultStyle ?? this.citationConfig?.defaultStyle;
906
906
  const cslDirectory = options.cslDirectory ?? this.citationConfig?.cslDirectory;
907
907
  const mergedOptions = {
@@ -912,36 +912,36 @@ class OperationsLibrary {
912
912
  return citeReferences(this.library, mergedOptions);
913
913
  }
914
914
  async import(inputs, options) {
915
- const { addReferences } = await import("./index-C_mW5LMY.js").then((n) => n.D);
915
+ const { addReferences } = await import("./index-CS8S6gE4.js").then((n) => n.D);
916
916
  return addReferences(inputs, this.library, options ?? {});
917
917
  }
918
918
  async check(options) {
919
- const { checkReferences } = await import("./index-C_mW5LMY.js").then((n) => n.E);
919
+ const { checkReferences } = await import("./index-CS8S6gE4.js").then((n) => n.E);
920
920
  return checkReferences(this.library, options);
921
921
  }
922
922
  // Attachment operations
923
923
  async attachAdd(options) {
924
- const { addAttachment: addAttachment2 } = await import("./index-BZMfDG4M.js");
924
+ const { addAttachment: addAttachment2 } = await import("./index-Cqss7VR_.js");
925
925
  return addAttachment2(this.library, options);
926
926
  }
927
927
  async attachList(options) {
928
- const { listAttachments: listAttachments2 } = await import("./index-BZMfDG4M.js");
928
+ const { listAttachments: listAttachments2 } = await import("./index-Cqss7VR_.js");
929
929
  return listAttachments2(this.library, options);
930
930
  }
931
931
  async attachGet(options) {
932
- const { getAttachment: getAttachment2 } = await import("./index-BZMfDG4M.js");
932
+ const { getAttachment: getAttachment2 } = await import("./index-Cqss7VR_.js");
933
933
  return getAttachment2(this.library, options);
934
934
  }
935
935
  async attachDetach(options) {
936
- const { detachAttachment: detachAttachment2 } = await import("./index-BZMfDG4M.js");
936
+ const { detachAttachment: detachAttachment2 } = await import("./index-Cqss7VR_.js");
937
937
  return detachAttachment2(this.library, options);
938
938
  }
939
939
  async attachSync(options) {
940
- const { syncAttachments: syncAttachments2 } = await import("./index-BZMfDG4M.js");
940
+ const { syncAttachments: syncAttachments2 } = await import("./index-Cqss7VR_.js");
941
941
  return syncAttachments2(this.library, options);
942
942
  }
943
943
  async attachOpen(options) {
944
- const { openAttachment: openAttachment2 } = await import("./index-BZMfDG4M.js");
944
+ const { openAttachment: openAttachment2 } = await import("./index-Cqss7VR_.js");
945
945
  return openAttachment2(this.library, options);
946
946
  }
947
947
  }
@@ -1804,9 +1804,9 @@ function formatSyncPreview(result) {
1804
1804
  function getAttachExitCode(result) {
1805
1805
  return result.success ? 0 : 1;
1806
1806
  }
1807
- async function executeInteractiveSelect$2(context, config2) {
1807
+ async function executeInteractiveSelect$3(context, config2) {
1808
1808
  const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
1809
- const { selectReferencesOrExit } = await import("./reference-select-Bm-05R0u.js");
1809
+ const { selectReferencesOrExit } = await import("./reference-select-CNWexQGu.js");
1810
1810
  const allReferences = await context.library.getAll();
1811
1811
  const identifiers = await withAlternateScreen2(
1812
1812
  () => selectReferencesOrExit(allReferences, { multiSelect: false }, config2.cli.tui)
@@ -1818,7 +1818,7 @@ async function resolveIdentifier(identifierArg, context, config2) {
1818
1818
  return identifierArg;
1819
1819
  }
1820
1820
  if (isTTY()) {
1821
- return executeInteractiveSelect$2(context, config2);
1821
+ return executeInteractiveSelect$3(context, config2);
1822
1822
  }
1823
1823
  const stdinId = await readIdentifierFromStdin();
1824
1824
  if (!stdinId) {
@@ -2413,8 +2413,8 @@ function countFindingTypes(result) {
2413
2413
  function formatCheckTextOutput(result) {
2414
2414
  const lines = [];
2415
2415
  for (const r of result.results) {
2416
- const label = getStatusLabel(r);
2417
- lines.push(`${label} ${r.id}`);
2416
+ const label2 = getStatusLabel(r);
2417
+ lines.push(`${label2} ${r.id}`);
2418
2418
  for (const finding of r.findings) {
2419
2419
  lines.push(...formatFindingDetails(finding, r.id));
2420
2420
  }
@@ -2431,9 +2431,9 @@ function formatCheckTextOutput(result) {
2431
2431
  ["versionChanged", "version changed"]
2432
2432
  ];
2433
2433
  const knownKeys = new Set(summaryItems.map(([key]) => key));
2434
- for (const [key, label] of summaryItems) {
2434
+ for (const [key, label2] of summaryItems) {
2435
2435
  const count = fc[key] ?? 0;
2436
- if (count > 0) parts.push(`${count} ${label}`);
2436
+ if (count > 0) parts.push(`${count} ${label2}`);
2437
2437
  }
2438
2438
  for (const [key, count] of Object.entries(fc)) {
2439
2439
  if (!knownKeys.has(key) && count > 0) parts.push(`${count} ${key}`);
@@ -2471,7 +2471,7 @@ async function handleCheckAction(identifiers, options, globalOpts) {
2471
2471
  const jsonOptions = buildJsonOptionsFromRefs(options, outputFormat, result, allRefs);
2472
2472
  outputCheckResult(result, outputFormat, jsonOptions);
2473
2473
  if (options.fix && result.summary.warnings > 0 && allRefs) {
2474
- const { runFixInteraction } = await import("./fix-interaction-C3OrF3yU.js");
2474
+ const { runFixInteraction } = await import("./fix-interaction-h15RI_Ae.js");
2475
2475
  const findItem = (id2) => allRefs.find((item) => item.id === id2);
2476
2476
  const fixResult = await runFixInteraction(result.results, context.library, findItem);
2477
2477
  const removedSuffix = fixResult.removed.length > 0 ? `, ${fixResult.removed.length} removed` : "";
@@ -2539,7 +2539,7 @@ function outputCheckError(error, format2) {
2539
2539
  }
2540
2540
  async function selectReferencesInteractively(context, config2) {
2541
2541
  const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
2542
- const { selectReferenceItemsOrExit } = await import("./reference-select-Bm-05R0u.js");
2542
+ const { selectReferenceItemsOrExit } = await import("./reference-select-CNWexQGu.js");
2543
2543
  const allReferences = await context.library.getAll();
2544
2544
  if (allReferences.length === 0) {
2545
2545
  process.stderr.write("No references in library.\n");
@@ -2607,8 +2607,8 @@ function getCiteExitCode(result) {
2607
2607
  }
2608
2608
  async function executeInteractiveCite(options, context, config2) {
2609
2609
  const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
2610
- const { runCiteFlow } = await import("./index-CA9y5wSm.js");
2611
- const { buildStyleChoices, listCustomStyles } = await import("./style-select-kfWjEg1X.js");
2610
+ const { runCiteFlow } = await import("./index-BG3Ef4Pd.js");
2611
+ const { buildStyleChoices, listCustomStyles } = await import("./style-select-D8beMum_.js");
2612
2612
  const { search } = await import("./file-watcher-CWHg1yol.js").then((n) => n.B);
2613
2613
  const { tokenize } = await import("./file-watcher-CWHg1yol.js").then((n) => n.A);
2614
2614
  const { checkTTY } = await import("./tty-BMyaEOhX.js");
@@ -7291,7 +7291,7 @@ function formatEditOutput(result) {
7291
7291
  }
7292
7292
  async function executeInteractiveEdit(options, context, config2) {
7293
7293
  const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
7294
- const { selectReferencesOrExit } = await import("./reference-select-Bm-05R0u.js");
7294
+ const { selectReferencesOrExit } = await import("./reference-select-CNWexQGu.js");
7295
7295
  const allReferences = await context.library.getAll();
7296
7296
  const identifiers = await withAlternateScreen2(
7297
7297
  () => selectReferencesOrExit(allReferences, { multiSelect: true }, config2.cli.tui)
@@ -10865,9 +10865,9 @@ function formatFulltextConvertOutput(result) {
10865
10865
  function getFulltextExitCode(result) {
10866
10866
  return result.success ? 0 : 1;
10867
10867
  }
10868
- async function executeInteractiveSelect$1(context, config2, multiSelect = false) {
10868
+ async function executeInteractiveSelect$2(context, config2, multiSelect = false) {
10869
10869
  const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
10870
- const { selectReferencesOrExit } = await import("./reference-select-Bm-05R0u.js");
10870
+ const { selectReferencesOrExit } = await import("./reference-select-CNWexQGu.js");
10871
10871
  const allReferences = await context.library.getAll();
10872
10872
  const identifiers = await withAlternateScreen2(
10873
10873
  () => selectReferencesOrExit(allReferences, { multiSelect }, config2.cli.tui)
@@ -10904,7 +10904,7 @@ async function handleFulltextAttachAction(identifierArg, filePathArg, options, g
10904
10904
  setExitCode(ExitCode.ERROR);
10905
10905
  return;
10906
10906
  }
10907
- identifier = (await executeInteractiveSelect$1(context, config2))[0];
10907
+ identifier = (await executeInteractiveSelect$2(context, config2))[0];
10908
10908
  }
10909
10909
  const { type: type2, filePath } = parseFulltextAttachTypeAndPath(filePathArg, options);
10910
10910
  const stdinContent = !filePath && type2 ? await readStdinBuffer() : void 0;
@@ -10990,7 +10990,7 @@ async function resolveGetIdentifiers(identifierArgs, context, config2) {
10990
10990
  return identifierArgs;
10991
10991
  }
10992
10992
  if (isTTY()) {
10993
- return executeInteractiveSelect$1(context, config2, true);
10993
+ return executeInteractiveSelect$2(context, config2, true);
10994
10994
  }
10995
10995
  const stdinIds = await readIdentifiersFromStdin();
10996
10996
  if (stdinIds.length === 0) {
@@ -11071,7 +11071,7 @@ async function handleFulltextDetachAction(identifierArg, options, globalOpts) {
11071
11071
  if (identifierArg) {
11072
11072
  identifier = identifierArg;
11073
11073
  } else if (isTTY()) {
11074
- identifier = (await executeInteractiveSelect$1(context, config2))[0];
11074
+ identifier = (await executeInteractiveSelect$2(context, config2))[0];
11075
11075
  } else {
11076
11076
  const stdinId = await readIdentifierFromStdin();
11077
11077
  if (!stdinId) {
@@ -11111,7 +11111,7 @@ async function handleFulltextOpenAction(identifierArg, options, globalOpts) {
11111
11111
  if (identifierArg) {
11112
11112
  identifier = identifierArg;
11113
11113
  } else if (isTTY()) {
11114
- identifier = (await executeInteractiveSelect$1(context, config2))[0];
11114
+ identifier = (await executeInteractiveSelect$2(context, config2))[0];
11115
11115
  } else {
11116
11116
  const stdinId = await readIdentifierFromStdin();
11117
11117
  if (!stdinId) {
@@ -11151,7 +11151,7 @@ async function handleFulltextDiscoverAction(identifierArg, options, globalOpts)
11151
11151
  if (identifierArg) {
11152
11152
  identifier = identifierArg;
11153
11153
  } else if (isTTY()) {
11154
- identifier = (await executeInteractiveSelect$1(context, config2))[0];
11154
+ identifier = (await executeInteractiveSelect$2(context, config2))[0];
11155
11155
  } else {
11156
11156
  const stdinId = await readIdentifierFromStdin();
11157
11157
  if (!stdinId) {
@@ -11191,7 +11191,7 @@ async function handleFulltextFetchAction(identifierArg, options, globalOpts) {
11191
11191
  if (identifierArg) {
11192
11192
  identifier = identifierArg;
11193
11193
  } else if (isTTY()) {
11194
- identifier = (await executeInteractiveSelect$1(context, config2))[0];
11194
+ identifier = (await executeInteractiveSelect$2(context, config2))[0];
11195
11195
  } else {
11196
11196
  const stdinId = await readIdentifierFromStdin();
11197
11197
  if (!stdinId) {
@@ -11231,7 +11231,7 @@ async function handleFulltextConvertAction(identifierArg, options, globalOpts) {
11231
11231
  if (identifierArg) {
11232
11232
  identifier = identifierArg;
11233
11233
  } else if (isTTY()) {
11234
- identifier = (await executeInteractiveSelect$1(context, config2))[0];
11234
+ identifier = (await executeInteractiveSelect$2(context, config2))[0];
11235
11235
  } else {
11236
11236
  const stdinId = await readIdentifierFromStdin();
11237
11237
  if (!stdinId) {
@@ -11310,14 +11310,14 @@ function buildResourceIndicators(item) {
11310
11310
  if (Array.isArray(tags) && tags.length > 0) labels.push("tag");
11311
11311
  return labels.join(" ");
11312
11312
  }
11313
- function formatAuthor(author) {
11313
+ function formatAuthor$1(author) {
11314
11314
  if (author.literal) return author.literal;
11315
11315
  const family = author.family || "";
11316
11316
  const givenInitial = author.given ? `${author.given.charAt(0)}.` : "";
11317
11317
  return givenInitial ? `${family}, ${givenInitial}` : family;
11318
11318
  }
11319
11319
  function formatAuthors(authors) {
11320
- return authors.map(formatAuthor).join("; ");
11320
+ return authors.map(formatAuthor$1).join("; ");
11321
11321
  }
11322
11322
  function formatSingleReference(item) {
11323
11323
  const lines = [];
@@ -23701,9 +23701,9 @@ function requireCodegen() {
23701
23701
  }
23702
23702
  }
23703
23703
  class Label extends Node {
23704
- constructor(label) {
23704
+ constructor(label2) {
23705
23705
  super();
23706
- this.label = label;
23706
+ this.label = label2;
23707
23707
  this.names = {};
23708
23708
  }
23709
23709
  render({ _n }) {
@@ -23711,14 +23711,14 @@ function requireCodegen() {
23711
23711
  }
23712
23712
  }
23713
23713
  class Break extends Node {
23714
- constructor(label) {
23714
+ constructor(label2) {
23715
23715
  super();
23716
- this.label = label;
23716
+ this.label = label2;
23717
23717
  this.names = {};
23718
23718
  }
23719
23719
  render({ _n }) {
23720
- const label = this.label ? ` ${this.label}` : "";
23721
- return `break${label};` + _n;
23720
+ const label2 = this.label ? ` ${this.label}` : "";
23721
+ return `break${label2};` + _n;
23722
23722
  }
23723
23723
  }
23724
23724
  class Throw extends Node {
@@ -24130,12 +24130,12 @@ function requireCodegen() {
24130
24130
  return this._endBlockNode(For);
24131
24131
  }
24132
24132
  // `label` statement
24133
- label(label) {
24134
- return this._leafNode(new Label(label));
24133
+ label(label2) {
24134
+ return this._leafNode(new Label(label2));
24135
24135
  }
24136
24136
  // `break` statement
24137
- break(label) {
24138
- return this._leafNode(new Break(label));
24137
+ break(label2) {
24138
+ return this._leafNode(new Break(label2));
24139
24139
  }
24140
24140
  // `return` statement
24141
24141
  return(value) {
@@ -32269,6 +32269,121 @@ function registerSearchTool(server, getLibraryOperations, getConfig) {
32269
32269
  }
32270
32270
  );
32271
32271
  }
32272
+ function toPosixPath(p) {
32273
+ return p.split(path__default.sep).join("/");
32274
+ }
32275
+ function formatAuthor(author) {
32276
+ if (author.literal) return author.literal;
32277
+ const family = author.family || "";
32278
+ const givenInitial = author.given ? `${author.given.charAt(0)}.` : "";
32279
+ return givenInitial ? `${family}, ${givenInitial}` : family;
32280
+ }
32281
+ function resolveFulltextAndAttachments(item, attachmentsDirectory) {
32282
+ const attachments = item.custom?.attachments;
32283
+ if (!attachments) {
32284
+ return {
32285
+ fulltext: { pdf: null, markdown: null },
32286
+ attachments: []
32287
+ };
32288
+ }
32289
+ const dir = path__default.join(attachmentsDirectory, attachments.directory);
32290
+ const files = attachments.files ?? [];
32291
+ let pdfPath = null;
32292
+ let markdownPath = null;
32293
+ const nonFulltext = [];
32294
+ for (const file of files) {
32295
+ if (file.role === "fulltext") {
32296
+ if (file.filename.endsWith(".pdf")) {
32297
+ pdfPath = toPosixPath(path__default.join(dir, file.filename));
32298
+ } else if (file.filename.endsWith(".md")) {
32299
+ markdownPath = toPosixPath(path__default.join(dir, file.filename));
32300
+ }
32301
+ } else {
32302
+ nonFulltext.push({ filename: file.filename, role: file.role });
32303
+ }
32304
+ }
32305
+ return {
32306
+ fulltext: { pdf: pdfPath, markdown: markdownPath },
32307
+ attachments: nonFulltext
32308
+ };
32309
+ }
32310
+ function normalizeAuthors(item) {
32311
+ return item.author && item.author.length > 0 ? item.author.map(formatAuthor) : null;
32312
+ }
32313
+ function normalizeFileInfo(item, options) {
32314
+ if (!options?.attachmentsDirectory) {
32315
+ return { fulltext: null, attachments: null };
32316
+ }
32317
+ return resolveFulltextAndAttachments(item, options.attachmentsDirectory);
32318
+ }
32319
+ function normalizeReference(item, options) {
32320
+ const custom2 = item.custom;
32321
+ const { fulltext: fulltext2, attachments } = normalizeFileInfo(item, options);
32322
+ return {
32323
+ id: item.id,
32324
+ uuid: custom2?.uuid ?? null,
32325
+ type: item.type,
32326
+ title: item.title ?? null,
32327
+ authors: normalizeAuthors(item),
32328
+ year: item.issued?.["date-parts"]?.[0]?.[0] ?? null,
32329
+ journal: item["container-title"] ?? null,
32330
+ volume: item.volume ?? null,
32331
+ issue: item.issue ?? null,
32332
+ page: item.page ?? null,
32333
+ doi: item.DOI ?? null,
32334
+ pmid: item.PMID ?? null,
32335
+ pmcid: item.PMCID ?? null,
32336
+ url: item.URL ?? null,
32337
+ abstract: item.abstract ?? null,
32338
+ tags: custom2?.tags ?? null,
32339
+ created: custom2?.created_at ?? null,
32340
+ modified: custom2?.timestamp ?? null,
32341
+ fulltext: fulltext2,
32342
+ attachments,
32343
+ raw: item
32344
+ };
32345
+ }
32346
+ function createShowToolHandler(getLibraryOperations, getConfig) {
32347
+ return async (args) => {
32348
+ const libraryOps = getLibraryOperations();
32349
+ const config2 = getConfig();
32350
+ const id2 = args.uuid ?? args.identifier;
32351
+ const idType = args.uuid ? "uuid" : "id";
32352
+ if (!id2) {
32353
+ return {
32354
+ content: [{ type: "text", text: "Error: identifier or uuid is required" }],
32355
+ isError: true
32356
+ };
32357
+ }
32358
+ const item = await libraryOps.find(id2, { idType });
32359
+ if (!item) {
32360
+ return {
32361
+ content: [{ type: "text", text: `Reference not found: ${id2}` }],
32362
+ isError: true
32363
+ };
32364
+ }
32365
+ const attachmentsDir = config2.attachments?.directory;
32366
+ const normalizeOpts = attachmentsDir ? { attachmentsDirectory: attachmentsDir } : void 0;
32367
+ const normalized = normalizeReference(item, normalizeOpts);
32368
+ return {
32369
+ content: [{ type: "text", text: JSON.stringify(normalized, null, 2) }]
32370
+ };
32371
+ };
32372
+ }
32373
+ function registerShowTool(server, getLibraryOperations, getConfig) {
32374
+ const handler = createShowToolHandler(getLibraryOperations, getConfig);
32375
+ server.registerTool(
32376
+ "show",
32377
+ {
32378
+ description: "Show detailed information about a single reference. Returns normalized JSON with all metadata, fulltext paths, and attachments. Use identifier (citation key) or uuid to look up.",
32379
+ inputSchema: {
32380
+ identifier: z.string().optional().describe("Reference citation key (e.g., Smith2020)"),
32381
+ uuid: z.string().optional().describe("Reference UUID (alternative to identifier)")
32382
+ }
32383
+ },
32384
+ async (args) => handler(args)
32385
+ );
32386
+ }
32272
32387
  function registerAllTools(server, getLibraryOperations, getConfig) {
32273
32388
  registerSearchTool(server, getLibraryOperations, getConfig);
32274
32389
  registerListTool(server, getLibraryOperations, getConfig);
@@ -32276,6 +32391,7 @@ function registerAllTools(server, getLibraryOperations, getConfig) {
32276
32391
  registerCheckTool(server, getLibraryOperations);
32277
32392
  registerAddTool(server, getLibraryOperations);
32278
32393
  registerRemoveTool(server, getLibraryOperations);
32394
+ registerShowTool(server, getLibraryOperations, getConfig);
32279
32395
  registerFulltextAttachTool(server, getLibraryOperations, getConfig);
32280
32396
  registerFulltextGetTool(server, getLibraryOperations, getConfig);
32281
32397
  registerFulltextDetachTool(server, getLibraryOperations, getConfig);
@@ -32335,7 +32451,7 @@ async function mcpStart(options) {
32335
32451
  async function executeRemove(options, context) {
32336
32452
  const { identifier, idType = "id", fulltextDirectory, deleteFulltext = false } = options;
32337
32453
  if (context.mode === "local" && deleteFulltext && fulltextDirectory) {
32338
- const { removeReference } = await import("./index-C_mW5LMY.js").then((n) => n.A);
32454
+ const { removeReference } = await import("./index-CS8S6gE4.js").then((n) => n.A);
32339
32455
  return removeReference(context.library, {
32340
32456
  identifier,
32341
32457
  idType,
@@ -32390,7 +32506,7 @@ Continue?`;
32390
32506
  }
32391
32507
  async function executeInteractiveRemove(context, config2) {
32392
32508
  const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
32393
- const { selectReferenceItemsOrExit } = await import("./reference-select-Bm-05R0u.js");
32509
+ const { selectReferenceItemsOrExit } = await import("./reference-select-CNWexQGu.js");
32394
32510
  const allReferences = await context.library.getAll();
32395
32511
  const selectedItems = await withAlternateScreen2(
32396
32512
  () => selectReferenceItemsOrExit(allReferences, { multiSelect: false }, config2.cli.tui)
@@ -32615,7 +32731,7 @@ async function executeInteractiveSearch(options, context, config2) {
32615
32731
  validateInteractiveOptions(options);
32616
32732
  const { checkTTY } = await import("./tty-BMyaEOhX.js");
32617
32733
  const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
32618
- const { runSearchFlow } = await import("./index-CA9y5wSm.js");
32734
+ const { runSearchFlow } = await import("./index-BG3Ef4Pd.js");
32619
32735
  const { search } = await import("./file-watcher-CWHg1yol.js").then((n) => n.B);
32620
32736
  const { tokenize } = await import("./file-watcher-CWHg1yol.js").then((n) => n.A);
32621
32737
  checkTTY();
@@ -32634,7 +32750,7 @@ async function executeInteractiveSearch(options, context, config2) {
32634
32750
  })
32635
32751
  );
32636
32752
  if (result.selectedItems && !result.cancelled) {
32637
- const { isSideEffectAction } = await import("./action-menu-DCZcb0HB.js");
32753
+ const { isSideEffectAction } = await import("./action-menu-D5s90TfM.js");
32638
32754
  if (isSideEffectAction(result.action)) {
32639
32755
  await executeSideEffectAction(result.action, result.selectedItems, context, config2);
32640
32756
  return { output: "", cancelled: false, action: result.action };
@@ -32836,6 +32952,142 @@ async function serverStatus(portfilePath) {
32836
32952
  }
32837
32953
  return result;
32838
32954
  }
32955
+ const LABEL_WIDTH = 11;
32956
+ function label(name) {
32957
+ return ` ${name.padEnd(LABEL_WIDTH)}`;
32958
+ }
32959
+ function formatJournalLine(ref2) {
32960
+ let line = ref2.journal ?? "";
32961
+ if (ref2.volume) {
32962
+ line += ref2.issue ? `, ${ref2.volume}(${ref2.issue})` : `, ${ref2.volume}`;
32963
+ }
32964
+ if (ref2.page) {
32965
+ line += `, ${ref2.page}`;
32966
+ }
32967
+ return line;
32968
+ }
32969
+ function formatDate(iso) {
32970
+ return iso.slice(0, 10);
32971
+ }
32972
+ function formatFulltext(lines, ref2) {
32973
+ if (!ref2.fulltext) return;
32974
+ if (!ref2.fulltext.pdf && !ref2.fulltext.markdown) {
32975
+ lines.push(`${label("Fulltext:")}-`);
32976
+ return;
32977
+ }
32978
+ lines.push(`${label("Fulltext:")}`);
32979
+ lines.push(` pdf: ${ref2.fulltext.pdf ?? "-"}`);
32980
+ lines.push(` markdown: ${ref2.fulltext.markdown ?? "-"}`);
32981
+ }
32982
+ function formatAttachments(lines, ref2) {
32983
+ if (!ref2.attachments || ref2.attachments.length === 0) return;
32984
+ const roles = /* @__PURE__ */ new Map();
32985
+ for (const a of ref2.attachments) {
32986
+ roles.set(a.role, (roles.get(a.role) ?? 0) + 1);
32987
+ }
32988
+ const parts = [...roles.entries()].map(([role, count]) => `${role} (${count} files)`);
32989
+ lines.push(`${label("Files:")}${parts.join(", ")}`);
32990
+ }
32991
+ function formatAbstract(lines, ref2) {
32992
+ if (!ref2.abstract) return;
32993
+ lines.push("");
32994
+ lines.push(`${label("Abstract:")}`);
32995
+ for (const line of ref2.abstract.split("\n")) {
32996
+ lines.push(` ${line}`);
32997
+ }
32998
+ }
32999
+ function formatShowPretty(ref2) {
33000
+ const lines = [];
33001
+ const header = ref2.title ? `[${ref2.id}] ${ref2.title}` : `[${ref2.id}]`;
33002
+ lines.push(header);
33003
+ lines.push(`${label("Type:")}${ref2.type}`);
33004
+ if (ref2.authors) {
33005
+ lines.push(`${label("Authors:")}${ref2.authors.join("; ")}`);
33006
+ }
33007
+ if (ref2.year != null) {
33008
+ lines.push(`${label("Year:")}${ref2.year}`);
33009
+ }
33010
+ if (ref2.journal) {
33011
+ lines.push(`${label("Journal:")}${formatJournalLine(ref2)}`);
33012
+ }
33013
+ if (ref2.doi) lines.push(`${label("DOI:")}${ref2.doi}`);
33014
+ if (ref2.pmid) lines.push(`${label("PMID:")}${ref2.pmid}`);
33015
+ if (ref2.pmcid) lines.push(`${label("PMCID:")}${ref2.pmcid}`);
33016
+ if (ref2.url) lines.push(`${label("URL:")}${ref2.url}`);
33017
+ lines.push(`${label("UUID:")}${ref2.uuid ?? "(no uuid)"}`);
33018
+ if (ref2.tags && ref2.tags.length > 0) {
33019
+ lines.push(`${label("Tags:")}${ref2.tags.join(", ")}`);
33020
+ }
33021
+ if (ref2.created) lines.push(`${label("Added:")}${formatDate(ref2.created)}`);
33022
+ if (ref2.modified) lines.push(`${label("Modified:")}${formatDate(ref2.modified)}`);
33023
+ formatFulltext(lines, ref2);
33024
+ formatAttachments(lines, ref2);
33025
+ formatAbstract(lines, ref2);
33026
+ return lines.join("\n");
33027
+ }
33028
+ async function executeShow(identifier, options, context) {
33029
+ const idType = options.uuid ? "uuid" : "id";
33030
+ return context.library.find(identifier, { idType });
33031
+ }
33032
+ function formatShowOutput(item, options, attachmentsDirectory) {
33033
+ const format2 = options.json ? "json" : options.output ?? "pretty";
33034
+ const normalizeOpts = attachmentsDirectory ? { attachmentsDirectory } : void 0;
33035
+ if (format2 === "json") {
33036
+ const normalized2 = normalizeReference(item, normalizeOpts);
33037
+ return JSON.stringify(normalized2, null, 2);
33038
+ }
33039
+ if (format2 === "yaml") {
33040
+ const normalized2 = normalizeReference(item, normalizeOpts);
33041
+ return stringify(normalized2);
33042
+ }
33043
+ if (format2 === "bibtex") {
33044
+ return formatBibtex([item]);
33045
+ }
33046
+ const normalized = normalizeReference(item, normalizeOpts);
33047
+ return formatShowPretty(normalized);
33048
+ }
33049
+ async function executeInteractiveSelect$1(context, config2) {
33050
+ const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
33051
+ const { selectReferencesOrExit } = await import("./reference-select-CNWexQGu.js");
33052
+ const allReferences = await context.library.getAll();
33053
+ const identifiers = await withAlternateScreen2(
33054
+ () => selectReferencesOrExit(allReferences, { multiSelect: false }, config2.cli.tui)
33055
+ );
33056
+ return identifiers[0] ?? "";
33057
+ }
33058
+ async function handleShowAction(identifier, options, globalOpts) {
33059
+ try {
33060
+ const config2 = await loadConfigWithOverrides({ ...globalOpts, ...options });
33061
+ const context = await createExecutionContext(config2, Library.load);
33062
+ let resolvedIdentifier;
33063
+ if (identifier) {
33064
+ resolvedIdentifier = identifier;
33065
+ } else if (isTTY()) {
33066
+ resolvedIdentifier = await executeInteractiveSelect$1(context, config2);
33067
+ } else {
33068
+ const stdinId = await readIdentifierFromStdin();
33069
+ if (!stdinId) {
33070
+ exitWithError("Identifier required (non-interactive mode)");
33071
+ return;
33072
+ }
33073
+ resolvedIdentifier = stdinId;
33074
+ }
33075
+ const item = await executeShow(resolvedIdentifier, options, context);
33076
+ if (!item) {
33077
+ exitWithError(`Reference not found: ${resolvedIdentifier}`);
33078
+ return;
33079
+ }
33080
+ const output = formatShowOutput(item, options, config2.attachments.directory);
33081
+ if (output) {
33082
+ await writeOutputWithClipboard(output, false, config2.logLevel === "silent");
33083
+ }
33084
+ setExitCode(ExitCode.SUCCESS);
33085
+ } catch (error) {
33086
+ process.stderr.write(`Error: ${error instanceof Error ? error.message : String(error)}
33087
+ `);
33088
+ setExitCode(ExitCode.INTERNAL_ERROR);
33089
+ }
33090
+ }
32839
33091
  function parseSetOption(input) {
32840
33092
  const match = input.match(/^([a-zA-Z][a-zA-Z0-9_.]*)([\+\-]?=)(.*)$/);
32841
33093
  if (!match) {
@@ -33045,7 +33297,7 @@ function formatUpdateOutput(result, identifier) {
33045
33297
  }
33046
33298
  async function executeInteractiveUpdate(context, config2) {
33047
33299
  const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
33048
- const { selectReferencesOrExit } = await import("./reference-select-Bm-05R0u.js");
33300
+ const { selectReferencesOrExit } = await import("./reference-select-CNWexQGu.js");
33049
33301
  const allReferences = await context.library.getAll();
33050
33302
  const identifiers = await withAlternateScreen2(
33051
33303
  () => selectReferencesOrExit(allReferences, { multiSelect: false }, config2.cli.tui)
@@ -33340,7 +33592,7 @@ function getUrlExitCode(result) {
33340
33592
  }
33341
33593
  async function executeInteractiveSelect(context, config2) {
33342
33594
  const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
33343
- const { selectReferencesOrExit } = await import("./reference-select-Bm-05R0u.js");
33595
+ const { selectReferencesOrExit } = await import("./reference-select-CNWexQGu.js");
33344
33596
  const allReferences = await context.library.getAll();
33345
33597
  const identifiers = await withAlternateScreen2(
33346
33598
  () => selectReferencesOrExit(allReferences, { multiSelect: false }, config2.cli.tui)
@@ -33774,6 +34026,7 @@ function createProgram() {
33774
34026
  }
33775
34027
  });
33776
34028
  registerListCommand(program);
34029
+ registerShowCommand(program);
33777
34030
  registerSearchCommand(program);
33778
34031
  registerExportCommand(program);
33779
34032
  registerAddCommand(program);
@@ -33815,6 +34068,12 @@ function registerListCommand(program) {
33815
34068
  await handleListAction(options, program);
33816
34069
  });
33817
34070
  }
34071
+ function registerShowCommand(program) {
34072
+ program.command("show [identifier]").description("Show detailed information about a single reference").option("--uuid", "Interpret identifier as UUID").option("-o, --output <format>", "Output format: pretty (default), json, yaml, bibtex").option("--json", "Alias for --output json").action(async (identifier, options) => {
34073
+ const globalOpts = program.opts();
34074
+ await handleShowAction(identifier, options, globalOpts);
34075
+ });
34076
+ }
33818
34077
  async function handleExportAction(ids, options, program) {
33819
34078
  try {
33820
34079
  const globalOpts = program.opts();
@@ -33945,7 +34204,7 @@ function shouldAutoFetch(cliFlag, configEnabled) {
33945
34204
  return configEnabled;
33946
34205
  }
33947
34206
  async function performAutoFetch(addedItems, context, config2) {
33948
- const { fulltextFetch: fulltextFetch2 } = await import("./index-C_mW5LMY.js").then((n) => n.z);
34207
+ const { fulltextFetch: fulltextFetch2 } = await import("./index-CS8S6gE4.js").then((n) => n.z);
33949
34208
  const fetchResults = await autoFetchFulltext(addedItems, context, {
33950
34209
  fulltextConfig: config2.fulltext,
33951
34210
  fulltextDirectory: config2.attachments.directory,
@@ -34240,4 +34499,4 @@ export {
34240
34499
  restoreStdinAfterInk as r,
34241
34500
  syncAttachments as s
34242
34501
  };
34243
- //# sourceMappingURL=index-4w0pu_0o.js.map
34502
+ //# sourceMappingURL=index-DCBYzNj-.js.map