@ncukondo/reference-manager 0.30.0 → 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.
- package/dist/chunks/{SearchableMultiSelect-CpCrb-G1.js → SearchableMultiSelect-BFgiGVkF.js} +2 -2
- package/dist/chunks/{SearchableMultiSelect-CpCrb-G1.js.map → SearchableMultiSelect-BFgiGVkF.js.map} +1 -1
- package/dist/chunks/{action-menu-DwHspdjM.js → action-menu-D5s90TfM.js} +3 -3
- package/dist/chunks/{action-menu-DwHspdjM.js.map → action-menu-D5s90TfM.js.map} +1 -1
- package/dist/chunks/{checker-DhHnmgq0.js → checker-DMyZFCaP.js} +4 -4
- package/dist/chunks/{checker-DhHnmgq0.js.map → checker-DMyZFCaP.js.map} +1 -1
- package/dist/chunks/{crossref-client-DG4AA_Ax.js → crossref-client-CaFCAASM.js} +2 -2
- package/dist/chunks/{crossref-client-DG4AA_Ax.js.map → crossref-client-CaFCAASM.js.map} +1 -1
- package/dist/chunks/{fix-interaction-CIstlQZN.js → fix-interaction-h15RI_Ae.js} +5 -5
- package/dist/chunks/{fix-interaction-CIstlQZN.js.map → fix-interaction-h15RI_Ae.js.map} +1 -1
- package/dist/chunks/{index-AvQ2XqcY.js → index-BG3Ef4Pd.js} +4 -4
- package/dist/chunks/{index-AvQ2XqcY.js.map → index-BG3Ef4Pd.js.map} +1 -1
- package/dist/chunks/{index-DoOmAYKd.js → index-CS8S6gE4.js} +459 -363
- package/dist/chunks/{index-DoOmAYKd.js.map → index-CS8S6gE4.js.map} +1 -1
- package/dist/chunks/{index-4KRTx7Fg.js → index-Cqss7VR_.js} +3 -3
- package/dist/chunks/index-Cqss7VR_.js.map +1 -0
- package/dist/chunks/{index-C7BVI2qL.js → index-DCBYzNj-.js} +644 -263
- package/dist/chunks/index-DCBYzNj-.js.map +1 -0
- package/dist/chunks/{loader-6TuXzBbw.js → loader-BG2eomDC.js} +52 -3
- package/dist/chunks/loader-BG2eomDC.js.map +1 -0
- package/dist/chunks/{pubmed-client-CyaNS4Y1.js → pubmed-client-vbreWUxK.js} +2 -2
- package/dist/chunks/{pubmed-client-CyaNS4Y1.js.map → pubmed-client-vbreWUxK.js.map} +1 -1
- package/dist/chunks/{reference-select-CES2SpzK.js → reference-select-CNWexQGu.js} +3 -3
- package/dist/chunks/{reference-select-CES2SpzK.js.map → reference-select-CNWexQGu.js.map} +1 -1
- package/dist/chunks/{style-select-DrECo2bW.js → style-select-D8beMum_.js} +3 -3
- package/dist/chunks/{style-select-DrECo2bW.js.map → style-select-D8beMum_.js.map} +1 -1
- package/dist/cli/commands/show.d.ts +16 -0
- package/dist/cli/commands/show.d.ts.map +1 -0
- package/dist/cli/help/convert-help.d.ts +6 -0
- package/dist/cli/help/convert-help.d.ts.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli.js +2 -1
- package/dist/cli.js.map +1 -1
- package/dist/config/key-parser.d.ts +2 -0
- package/dist/config/key-parser.d.ts.map +1 -1
- package/dist/config/schema.d.ts +10 -3
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/features/format/show-normalizer.d.ts +43 -0
- package/dist/features/format/show-normalizer.d.ts.map +1 -0
- package/dist/features/format/show-pretty.d.ts +8 -0
- package/dist/features/format/show-pretty.d.ts.map +1 -0
- package/dist/features/import/fetcher.d.ts +2 -1
- package/dist/features/import/fetcher.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/tools/index.d.ts.map +1 -1
- package/dist/mcp/tools/show.d.ts +23 -0
- package/dist/mcp/tools/show.d.ts.map +1 -0
- package/dist/server.js +3 -3
- package/package.json +1 -1
- package/dist/chunks/index-4KRTx7Fg.js.map +0 -1
- package/dist/chunks/index-C7BVI2qL.js.map +0 -1
- package/dist/chunks/loader-6TuXzBbw.js.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
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-CS8S6gE4.js";
|
|
2
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";
|
|
3
4
|
import * as fs from "node:fs";
|
|
4
5
|
import { promises, readFileSync, existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
5
6
|
import * as os from "node:os";
|
|
6
7
|
import * as path from "node:path";
|
|
7
8
|
import path__default, { join, basename, dirname } from "node:path";
|
|
8
|
-
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 getFulltextAttachmentTypes, u as startServerWithFileWatcher } from "./index-DoOmAYKd.js";
|
|
9
9
|
import { readFile, unlink, stat, readdir, rename } from "node:fs/promises";
|
|
10
|
-
import { o as openWithSystemApp, l as loadConfig, e as getDefaultCurrentDirConfigFilename, h as getDefaultUserConfigPath } from "./loader-
|
|
10
|
+
import { o as openWithSystemApp, l as loadConfig, e as getDefaultCurrentDirConfigFilename, h as getDefaultUserConfigPath } from "./loader-BG2eomDC.js";
|
|
11
11
|
import { spawn, spawnSync } from "node:child_process";
|
|
12
12
|
import process$1, { stdin, stdout } from "node:process";
|
|
13
13
|
import * as readline from "node:readline";
|
|
@@ -18,14 +18,6 @@ import "@citation-js/core";
|
|
|
18
18
|
import "@citation-js/plugin-csl";
|
|
19
19
|
import { ZodOptional as ZodOptional$2, z } from "zod";
|
|
20
20
|
import { serve } from "@hono/node-server";
|
|
21
|
-
const name = "@ncukondo/reference-manager";
|
|
22
|
-
const version$1 = "0.30.0";
|
|
23
|
-
const description$1 = "A local reference management tool using CSL-JSON as the single source of truth";
|
|
24
|
-
const packageJson = {
|
|
25
|
-
name,
|
|
26
|
-
version: version$1,
|
|
27
|
-
description: description$1
|
|
28
|
-
};
|
|
29
21
|
const ISO_DATE_REGEX$1 = /^\d{4}(-\d{2})?(-\d{2})?$/;
|
|
30
22
|
function datePartsToIso(dateParts) {
|
|
31
23
|
if (!dateParts || dateParts.length === 0 || !dateParts[0]) {
|
|
@@ -621,11 +613,11 @@ function inferFromFilename(filename) {
|
|
|
621
613
|
if (!parsed) {
|
|
622
614
|
return { filename, role: "other", label: filename };
|
|
623
615
|
}
|
|
624
|
-
const { role, label } = parsed;
|
|
616
|
+
const { role, label: label2 } = parsed;
|
|
625
617
|
if (isReservedRole(role)) {
|
|
626
|
-
return
|
|
618
|
+
return label2 ? { filename, role, label: label2 } : { filename, role };
|
|
627
619
|
}
|
|
628
|
-
const basename2 =
|
|
620
|
+
const basename2 = label2 ? `${role}-${label2}` : role;
|
|
629
621
|
return { filename, role: "other", label: basename2 };
|
|
630
622
|
}
|
|
631
623
|
async function getFilesOnDisk(dirPath) {
|
|
@@ -664,11 +656,11 @@ function buildUpdatedFiles(metadataFiles, newFiles, missingFiles, shouldApplyNew
|
|
|
664
656
|
for (const newFile of newFiles) {
|
|
665
657
|
const override = roleOverrides?.[newFile.filename];
|
|
666
658
|
const role = override?.role ?? newFile.role;
|
|
667
|
-
const
|
|
659
|
+
const label2 = override ? override.label : newFile.label;
|
|
668
660
|
const attachmentFile = {
|
|
669
661
|
filename: newFile.filename,
|
|
670
662
|
role,
|
|
671
|
-
...
|
|
663
|
+
...label2 && { label: label2 }
|
|
672
664
|
};
|
|
673
665
|
updatedFiles.push(attachmentFile);
|
|
674
666
|
}
|
|
@@ -901,15 +893,15 @@ class OperationsLibrary {
|
|
|
901
893
|
}
|
|
902
894
|
// High-level operations
|
|
903
895
|
async search(options) {
|
|
904
|
-
const { searchReferences } = await import("./index-
|
|
896
|
+
const { searchReferences } = await import("./index-CS8S6gE4.js").then((n) => n.H);
|
|
905
897
|
return searchReferences(this.library, options);
|
|
906
898
|
}
|
|
907
899
|
async list(options) {
|
|
908
|
-
const { listReferences } = await import("./index-
|
|
900
|
+
const { listReferences } = await import("./index-CS8S6gE4.js").then((n) => n.G);
|
|
909
901
|
return listReferences(this.library, options ?? {});
|
|
910
902
|
}
|
|
911
903
|
async cite(options) {
|
|
912
|
-
const { citeReferences } = await import("./index-
|
|
904
|
+
const { citeReferences } = await import("./index-CS8S6gE4.js").then((n) => n.F);
|
|
913
905
|
const defaultStyle = options.defaultStyle ?? this.citationConfig?.defaultStyle;
|
|
914
906
|
const cslDirectory = options.cslDirectory ?? this.citationConfig?.cslDirectory;
|
|
915
907
|
const mergedOptions = {
|
|
@@ -920,36 +912,36 @@ class OperationsLibrary {
|
|
|
920
912
|
return citeReferences(this.library, mergedOptions);
|
|
921
913
|
}
|
|
922
914
|
async import(inputs, options) {
|
|
923
|
-
const { addReferences } = await import("./index-
|
|
915
|
+
const { addReferences } = await import("./index-CS8S6gE4.js").then((n) => n.D);
|
|
924
916
|
return addReferences(inputs, this.library, options ?? {});
|
|
925
917
|
}
|
|
926
918
|
async check(options) {
|
|
927
|
-
const { checkReferences } = await import("./index-
|
|
919
|
+
const { checkReferences } = await import("./index-CS8S6gE4.js").then((n) => n.E);
|
|
928
920
|
return checkReferences(this.library, options);
|
|
929
921
|
}
|
|
930
922
|
// Attachment operations
|
|
931
923
|
async attachAdd(options) {
|
|
932
|
-
const { addAttachment: addAttachment2 } = await import("./index-
|
|
924
|
+
const { addAttachment: addAttachment2 } = await import("./index-Cqss7VR_.js");
|
|
933
925
|
return addAttachment2(this.library, options);
|
|
934
926
|
}
|
|
935
927
|
async attachList(options) {
|
|
936
|
-
const { listAttachments: listAttachments2 } = await import("./index-
|
|
928
|
+
const { listAttachments: listAttachments2 } = await import("./index-Cqss7VR_.js");
|
|
937
929
|
return listAttachments2(this.library, options);
|
|
938
930
|
}
|
|
939
931
|
async attachGet(options) {
|
|
940
|
-
const { getAttachment: getAttachment2 } = await import("./index-
|
|
932
|
+
const { getAttachment: getAttachment2 } = await import("./index-Cqss7VR_.js");
|
|
941
933
|
return getAttachment2(this.library, options);
|
|
942
934
|
}
|
|
943
935
|
async attachDetach(options) {
|
|
944
|
-
const { detachAttachment: detachAttachment2 } = await import("./index-
|
|
936
|
+
const { detachAttachment: detachAttachment2 } = await import("./index-Cqss7VR_.js");
|
|
945
937
|
return detachAttachment2(this.library, options);
|
|
946
938
|
}
|
|
947
939
|
async attachSync(options) {
|
|
948
|
-
const { syncAttachments: syncAttachments2 } = await import("./index-
|
|
940
|
+
const { syncAttachments: syncAttachments2 } = await import("./index-Cqss7VR_.js");
|
|
949
941
|
return syncAttachments2(this.library, options);
|
|
950
942
|
}
|
|
951
943
|
async attachOpen(options) {
|
|
952
|
-
const { openAttachment: openAttachment2 } = await import("./index-
|
|
944
|
+
const { openAttachment: openAttachment2 } = await import("./index-Cqss7VR_.js");
|
|
953
945
|
return openAttachment2(this.library, options);
|
|
954
946
|
}
|
|
955
947
|
}
|
|
@@ -1812,9 +1804,9 @@ function formatSyncPreview(result) {
|
|
|
1812
1804
|
function getAttachExitCode(result) {
|
|
1813
1805
|
return result.success ? 0 : 1;
|
|
1814
1806
|
}
|
|
1815
|
-
async function executeInteractiveSelect$
|
|
1807
|
+
async function executeInteractiveSelect$3(context, config2) {
|
|
1816
1808
|
const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
|
|
1817
|
-
const { selectReferencesOrExit } = await import("./reference-select-
|
|
1809
|
+
const { selectReferencesOrExit } = await import("./reference-select-CNWexQGu.js");
|
|
1818
1810
|
const allReferences = await context.library.getAll();
|
|
1819
1811
|
const identifiers = await withAlternateScreen2(
|
|
1820
1812
|
() => selectReferencesOrExit(allReferences, { multiSelect: false }, config2.cli.tui)
|
|
@@ -1826,7 +1818,7 @@ async function resolveIdentifier(identifierArg, context, config2) {
|
|
|
1826
1818
|
return identifierArg;
|
|
1827
1819
|
}
|
|
1828
1820
|
if (isTTY()) {
|
|
1829
|
-
return executeInteractiveSelect$
|
|
1821
|
+
return executeInteractiveSelect$3(context, config2);
|
|
1830
1822
|
}
|
|
1831
1823
|
const stdinId = await readIdentifierFromStdin();
|
|
1832
1824
|
if (!stdinId) {
|
|
@@ -2421,8 +2413,8 @@ function countFindingTypes(result) {
|
|
|
2421
2413
|
function formatCheckTextOutput(result) {
|
|
2422
2414
|
const lines = [];
|
|
2423
2415
|
for (const r of result.results) {
|
|
2424
|
-
const
|
|
2425
|
-
lines.push(`${
|
|
2416
|
+
const label2 = getStatusLabel(r);
|
|
2417
|
+
lines.push(`${label2} ${r.id}`);
|
|
2426
2418
|
for (const finding of r.findings) {
|
|
2427
2419
|
lines.push(...formatFindingDetails(finding, r.id));
|
|
2428
2420
|
}
|
|
@@ -2439,9 +2431,9 @@ function formatCheckTextOutput(result) {
|
|
|
2439
2431
|
["versionChanged", "version changed"]
|
|
2440
2432
|
];
|
|
2441
2433
|
const knownKeys = new Set(summaryItems.map(([key]) => key));
|
|
2442
|
-
for (const [key,
|
|
2434
|
+
for (const [key, label2] of summaryItems) {
|
|
2443
2435
|
const count = fc[key] ?? 0;
|
|
2444
|
-
if (count > 0) parts.push(`${count} ${
|
|
2436
|
+
if (count > 0) parts.push(`${count} ${label2}`);
|
|
2445
2437
|
}
|
|
2446
2438
|
for (const [key, count] of Object.entries(fc)) {
|
|
2447
2439
|
if (!knownKeys.has(key) && count > 0) parts.push(`${count} ${key}`);
|
|
@@ -2479,7 +2471,7 @@ async function handleCheckAction(identifiers, options, globalOpts) {
|
|
|
2479
2471
|
const jsonOptions = buildJsonOptionsFromRefs(options, outputFormat, result, allRefs);
|
|
2480
2472
|
outputCheckResult(result, outputFormat, jsonOptions);
|
|
2481
2473
|
if (options.fix && result.summary.warnings > 0 && allRefs) {
|
|
2482
|
-
const { runFixInteraction } = await import("./fix-interaction-
|
|
2474
|
+
const { runFixInteraction } = await import("./fix-interaction-h15RI_Ae.js");
|
|
2483
2475
|
const findItem = (id2) => allRefs.find((item) => item.id === id2);
|
|
2484
2476
|
const fixResult = await runFixInteraction(result.results, context.library, findItem);
|
|
2485
2477
|
const removedSuffix = fixResult.removed.length > 0 ? `, ${fixResult.removed.length} removed` : "";
|
|
@@ -2547,7 +2539,7 @@ function outputCheckError(error, format2) {
|
|
|
2547
2539
|
}
|
|
2548
2540
|
async function selectReferencesInteractively(context, config2) {
|
|
2549
2541
|
const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
|
|
2550
|
-
const { selectReferenceItemsOrExit } = await import("./reference-select-
|
|
2542
|
+
const { selectReferenceItemsOrExit } = await import("./reference-select-CNWexQGu.js");
|
|
2551
2543
|
const allReferences = await context.library.getAll();
|
|
2552
2544
|
if (allReferences.length === 0) {
|
|
2553
2545
|
process.stderr.write("No references in library.\n");
|
|
@@ -2615,8 +2607,8 @@ function getCiteExitCode(result) {
|
|
|
2615
2607
|
}
|
|
2616
2608
|
async function executeInteractiveCite(options, context, config2) {
|
|
2617
2609
|
const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
|
|
2618
|
-
const { runCiteFlow } = await import("./index-
|
|
2619
|
-
const { buildStyleChoices, listCustomStyles } = await import("./style-select-
|
|
2610
|
+
const { runCiteFlow } = await import("./index-BG3Ef4Pd.js");
|
|
2611
|
+
const { buildStyleChoices, listCustomStyles } = await import("./style-select-D8beMum_.js");
|
|
2620
2612
|
const { search } = await import("./file-watcher-CWHg1yol.js").then((n) => n.B);
|
|
2621
2613
|
const { tokenize } = await import("./file-watcher-CWHg1yol.js").then((n) => n.A);
|
|
2622
2614
|
const { checkTTY } = await import("./tty-BMyaEOhX.js");
|
|
@@ -2790,6 +2782,21 @@ const CONFIG_KEY_REGISTRY = [
|
|
|
2790
2782
|
type: "boolean",
|
|
2791
2783
|
description: "Auto-fetch fulltext when adding references"
|
|
2792
2784
|
},
|
|
2785
|
+
{
|
|
2786
|
+
key: "fulltext.pdf_converter",
|
|
2787
|
+
type: "string",
|
|
2788
|
+
description: "PDF converter: auto, marker, docling, mineru, pymupdf, or custom name"
|
|
2789
|
+
},
|
|
2790
|
+
{
|
|
2791
|
+
key: "fulltext.pdf_converter_priority",
|
|
2792
|
+
type: "string[]",
|
|
2793
|
+
description: "PDF converter auto-detection priority order"
|
|
2794
|
+
},
|
|
2795
|
+
{
|
|
2796
|
+
key: "fulltext.pdf_converter_timeout",
|
|
2797
|
+
type: "integer",
|
|
2798
|
+
description: "PDF converter timeout in seconds"
|
|
2799
|
+
},
|
|
2793
2800
|
{
|
|
2794
2801
|
key: "fulltext.sources.unpaywall_email",
|
|
2795
2802
|
type: "string",
|
|
@@ -2860,19 +2867,86 @@ const CONFIG_KEY_REGISTRY = [
|
|
|
2860
2867
|
// mcp section
|
|
2861
2868
|
{ key: "mcp.default_limit", type: "integer", description: "Default result limit for MCP" }
|
|
2862
2869
|
];
|
|
2870
|
+
const DYNAMIC_KEY_PATTERNS = [
|
|
2871
|
+
{
|
|
2872
|
+
key: "fulltext.converters.*.command",
|
|
2873
|
+
type: "string",
|
|
2874
|
+
description: "Shell command template for the converter"
|
|
2875
|
+
},
|
|
2876
|
+
{
|
|
2877
|
+
key: "fulltext.converters.*.output_mode",
|
|
2878
|
+
type: "enum",
|
|
2879
|
+
description: "Output mode",
|
|
2880
|
+
enumValues: ["file", "stdout"],
|
|
2881
|
+
optional: true
|
|
2882
|
+
},
|
|
2883
|
+
{
|
|
2884
|
+
key: "fulltext.converters.*.check_command",
|
|
2885
|
+
type: "string",
|
|
2886
|
+
description: "Command to check converter availability",
|
|
2887
|
+
optional: true
|
|
2888
|
+
},
|
|
2889
|
+
{
|
|
2890
|
+
key: "fulltext.converters.*.timeout",
|
|
2891
|
+
type: "integer",
|
|
2892
|
+
description: "Converter timeout in seconds",
|
|
2893
|
+
optional: true
|
|
2894
|
+
},
|
|
2895
|
+
{
|
|
2896
|
+
key: "fulltext.converters.*.progress",
|
|
2897
|
+
type: "enum",
|
|
2898
|
+
description: "Progress display mode",
|
|
2899
|
+
enumValues: ["inherit", "quiet"],
|
|
2900
|
+
optional: true
|
|
2901
|
+
},
|
|
2902
|
+
{
|
|
2903
|
+
key: "fulltext.converters.*.command_windows",
|
|
2904
|
+
type: "string",
|
|
2905
|
+
description: "Windows-specific command template",
|
|
2906
|
+
optional: true
|
|
2907
|
+
},
|
|
2908
|
+
{
|
|
2909
|
+
key: "fulltext.converters.*.check_command_windows",
|
|
2910
|
+
type: "string",
|
|
2911
|
+
description: "Windows-specific availability check command",
|
|
2912
|
+
optional: true
|
|
2913
|
+
}
|
|
2914
|
+
];
|
|
2915
|
+
const DYNAMIC_PATTERN_MAP = new Map(
|
|
2916
|
+
DYNAMIC_KEY_PATTERNS.map((info) => [info.key, info])
|
|
2917
|
+
);
|
|
2863
2918
|
const KEY_MAP = new Map(CONFIG_KEY_REGISTRY.map((info) => [info.key, info]));
|
|
2864
2919
|
let allKeysCache = null;
|
|
2865
2920
|
function parseConfigKey(key) {
|
|
2866
2921
|
return key.split(".");
|
|
2867
2922
|
}
|
|
2923
|
+
function toDynamicPattern(key) {
|
|
2924
|
+
const segments = key.split(".");
|
|
2925
|
+
if (segments.length >= 4 && segments[0] === "fulltext" && segments[1] === "converters") {
|
|
2926
|
+
return `${segments[0]}.${segments[1]}.*.${segments.slice(3).join(".")}`;
|
|
2927
|
+
}
|
|
2928
|
+
return null;
|
|
2929
|
+
}
|
|
2868
2930
|
function isValidConfigKey(key) {
|
|
2869
2931
|
if (!key) {
|
|
2870
2932
|
return false;
|
|
2871
2933
|
}
|
|
2872
|
-
|
|
2934
|
+
if (KEY_MAP.has(key)) {
|
|
2935
|
+
return true;
|
|
2936
|
+
}
|
|
2937
|
+
const pattern2 = toDynamicPattern(key);
|
|
2938
|
+
return pattern2 !== null && DYNAMIC_PATTERN_MAP.has(pattern2);
|
|
2873
2939
|
}
|
|
2874
2940
|
function getConfigKeyInfo(key) {
|
|
2875
|
-
|
|
2941
|
+
const info = KEY_MAP.get(key);
|
|
2942
|
+
if (info) {
|
|
2943
|
+
return info;
|
|
2944
|
+
}
|
|
2945
|
+
const pattern2 = toDynamicPattern(key);
|
|
2946
|
+
if (pattern2) {
|
|
2947
|
+
return DYNAMIC_PATTERN_MAP.get(pattern2) ?? null;
|
|
2948
|
+
}
|
|
2949
|
+
return null;
|
|
2876
2950
|
}
|
|
2877
2951
|
function getAllConfigKeys(section) {
|
|
2878
2952
|
if (!allKeysCache) {
|
|
@@ -3896,8 +3970,8 @@ function requireReactJsxRuntime_development() {
|
|
|
3896
3970
|
if ("object" === typeof type2 && null !== type2 && type2.$$typeof === REACT_LAZY_TYPE)
|
|
3897
3971
|
return "<...>";
|
|
3898
3972
|
try {
|
|
3899
|
-
var
|
|
3900
|
-
return
|
|
3973
|
+
var name = getComponentNameFromType(type2);
|
|
3974
|
+
return name ? "<" + name + ">" : "<...>";
|
|
3901
3975
|
} catch (x) {
|
|
3902
3976
|
return "<...>";
|
|
3903
3977
|
}
|
|
@@ -4391,9 +4465,9 @@ function compileStyleAliases(map2) {
|
|
|
4391
4465
|
}
|
|
4392
4466
|
function Type$1(tag, options) {
|
|
4393
4467
|
options = options || {};
|
|
4394
|
-
Object.keys(options).forEach(function(
|
|
4395
|
-
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(
|
|
4396
|
-
throw new exception('Unknown option "' +
|
|
4468
|
+
Object.keys(options).forEach(function(name) {
|
|
4469
|
+
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
|
|
4470
|
+
throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
|
4397
4471
|
}
|
|
4398
4472
|
});
|
|
4399
4473
|
this.options = options;
|
|
@@ -4417,9 +4491,9 @@ function Type$1(tag, options) {
|
|
|
4417
4491
|
}
|
|
4418
4492
|
}
|
|
4419
4493
|
var type$2 = Type$1;
|
|
4420
|
-
function compileList(schema2,
|
|
4494
|
+
function compileList(schema2, name) {
|
|
4421
4495
|
var result = [];
|
|
4422
|
-
schema2[
|
|
4496
|
+
schema2[name].forEach(function(currentType) {
|
|
4423
4497
|
var newIndex = result.length;
|
|
4424
4498
|
result.forEach(function(previousType, previousIndex) {
|
|
4425
4499
|
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
|
|
@@ -5133,7 +5207,7 @@ function throwWarning(state, message) {
|
|
|
5133
5207
|
}
|
|
5134
5208
|
}
|
|
5135
5209
|
var directiveHandlers = {
|
|
5136
|
-
YAML: function handleYamlDirective(state,
|
|
5210
|
+
YAML: function handleYamlDirective(state, name, args) {
|
|
5137
5211
|
var match, major, minor;
|
|
5138
5212
|
if (state.version !== null) {
|
|
5139
5213
|
throwError(state, "duplication of %YAML directive");
|
|
@@ -5156,7 +5230,7 @@ var directiveHandlers = {
|
|
|
5156
5230
|
throwWarning(state, "unsupported YAML version of the document");
|
|
5157
5231
|
}
|
|
5158
5232
|
},
|
|
5159
|
-
TAG: function handleTagDirective(state,
|
|
5233
|
+
TAG: function handleTagDirective(state, name, args) {
|
|
5160
5234
|
var handle, prefix;
|
|
5161
5235
|
if (args.length !== 2) {
|
|
5162
5236
|
throwError(state, "TAG directive accepts exactly two arguments");
|
|
@@ -7217,7 +7291,7 @@ function formatEditOutput(result) {
|
|
|
7217
7291
|
}
|
|
7218
7292
|
async function executeInteractiveEdit(options, context, config2) {
|
|
7219
7293
|
const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
|
|
7220
|
-
const { selectReferencesOrExit } = await import("./reference-select-
|
|
7294
|
+
const { selectReferencesOrExit } = await import("./reference-select-CNWexQGu.js");
|
|
7221
7295
|
const allReferences = await context.library.getAll();
|
|
7222
7296
|
const identifiers = await withAlternateScreen2(
|
|
7223
7297
|
() => selectReferencesOrExit(allReferences, { multiSelect: true }, config2.cli.tui)
|
|
@@ -7476,8 +7550,8 @@ class Directives {
|
|
|
7476
7550
|
this.atNextDocument = false;
|
|
7477
7551
|
}
|
|
7478
7552
|
const parts = line.trim().split(/[ \t]+/);
|
|
7479
|
-
const
|
|
7480
|
-
switch (
|
|
7553
|
+
const name = parts.shift();
|
|
7554
|
+
switch (name) {
|
|
7481
7555
|
case "%TAG": {
|
|
7482
7556
|
if (parts.length !== 2) {
|
|
7483
7557
|
onError(0, "%TAG directive should contain exactly two parts");
|
|
@@ -7505,7 +7579,7 @@ class Directives {
|
|
|
7505
7579
|
}
|
|
7506
7580
|
}
|
|
7507
7581
|
default:
|
|
7508
|
-
onError(0, `Unknown directive ${
|
|
7582
|
+
onError(0, `Unknown directive ${name}`, true);
|
|
7509
7583
|
return false;
|
|
7510
7584
|
}
|
|
7511
7585
|
}
|
|
@@ -7604,9 +7678,9 @@ function anchorNames(root) {
|
|
|
7604
7678
|
}
|
|
7605
7679
|
function findNewAnchor(prefix, exclude) {
|
|
7606
7680
|
for (let i = 1; true; ++i) {
|
|
7607
|
-
const
|
|
7608
|
-
if (!exclude.has(
|
|
7609
|
-
return
|
|
7681
|
+
const name = `${prefix}${i}`;
|
|
7682
|
+
if (!exclude.has(name))
|
|
7683
|
+
return name;
|
|
7610
7684
|
}
|
|
7611
7685
|
}
|
|
7612
7686
|
function createNodeAnchors(doc, prefix) {
|
|
@@ -8515,8 +8589,8 @@ function getTagObject(tags, item) {
|
|
|
8515
8589
|
tagObj = tags.find((t) => t.nodeClass && obj instanceof t.nodeClass);
|
|
8516
8590
|
}
|
|
8517
8591
|
if (!tagObj) {
|
|
8518
|
-
const
|
|
8519
|
-
throw new Error(`Tag not resolved for ${
|
|
8592
|
+
const name = obj?.constructor?.name ?? (obj === null ? "null" : typeof obj);
|
|
8593
|
+
throw new Error(`Tag not resolved for ${name} value`);
|
|
8520
8594
|
}
|
|
8521
8595
|
return tagObj;
|
|
8522
8596
|
}
|
|
@@ -10104,11 +10178,11 @@ class Document {
|
|
|
10104
10178
|
* `name` will be used as a prefix for a new unique anchor.
|
|
10105
10179
|
* If `name` is undefined, the generated anchor will use 'a' as a prefix.
|
|
10106
10180
|
*/
|
|
10107
|
-
createAlias(node,
|
|
10181
|
+
createAlias(node, name) {
|
|
10108
10182
|
if (!node.anchor) {
|
|
10109
10183
|
const prev = anchorNames(this);
|
|
10110
10184
|
node.anchor = // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
10111
|
-
!
|
|
10185
|
+
!name || prev.has(name) ? findNewAnchor(name || "a", prev) : name;
|
|
10112
10186
|
}
|
|
10113
10187
|
return new Alias(node.anchor);
|
|
10114
10188
|
}
|
|
@@ -10362,8 +10436,8 @@ function formatBibtexAuthor(author) {
|
|
|
10362
10436
|
function formatBibtexAuthors(authors) {
|
|
10363
10437
|
return authors.map(formatBibtexAuthor).join(" and ");
|
|
10364
10438
|
}
|
|
10365
|
-
function formatField(
|
|
10366
|
-
return ` ${
|
|
10439
|
+
function formatField(name, value) {
|
|
10440
|
+
return ` ${name} = {${value}},`;
|
|
10367
10441
|
}
|
|
10368
10442
|
function addBasicFields(lines, item) {
|
|
10369
10443
|
if (item.title) {
|
|
@@ -10791,9 +10865,9 @@ function formatFulltextConvertOutput(result) {
|
|
|
10791
10865
|
function getFulltextExitCode(result) {
|
|
10792
10866
|
return result.success ? 0 : 1;
|
|
10793
10867
|
}
|
|
10794
|
-
async function executeInteractiveSelect$
|
|
10868
|
+
async function executeInteractiveSelect$2(context, config2, multiSelect = false) {
|
|
10795
10869
|
const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
|
|
10796
|
-
const { selectReferencesOrExit } = await import("./reference-select-
|
|
10870
|
+
const { selectReferencesOrExit } = await import("./reference-select-CNWexQGu.js");
|
|
10797
10871
|
const allReferences = await context.library.getAll();
|
|
10798
10872
|
const identifiers = await withAlternateScreen2(
|
|
10799
10873
|
() => selectReferencesOrExit(allReferences, { multiSelect }, config2.cli.tui)
|
|
@@ -10830,7 +10904,7 @@ async function handleFulltextAttachAction(identifierArg, filePathArg, options, g
|
|
|
10830
10904
|
setExitCode(ExitCode.ERROR);
|
|
10831
10905
|
return;
|
|
10832
10906
|
}
|
|
10833
|
-
identifier = (await executeInteractiveSelect$
|
|
10907
|
+
identifier = (await executeInteractiveSelect$2(context, config2))[0];
|
|
10834
10908
|
}
|
|
10835
10909
|
const { type: type2, filePath } = parseFulltextAttachTypeAndPath(filePathArg, options);
|
|
10836
10910
|
const stdinContent = !filePath && type2 ? await readStdinBuffer() : void 0;
|
|
@@ -10916,7 +10990,7 @@ async function resolveGetIdentifiers(identifierArgs, context, config2) {
|
|
|
10916
10990
|
return identifierArgs;
|
|
10917
10991
|
}
|
|
10918
10992
|
if (isTTY()) {
|
|
10919
|
-
return executeInteractiveSelect$
|
|
10993
|
+
return executeInteractiveSelect$2(context, config2, true);
|
|
10920
10994
|
}
|
|
10921
10995
|
const stdinIds = await readIdentifiersFromStdin();
|
|
10922
10996
|
if (stdinIds.length === 0) {
|
|
@@ -10997,7 +11071,7 @@ async function handleFulltextDetachAction(identifierArg, options, globalOpts) {
|
|
|
10997
11071
|
if (identifierArg) {
|
|
10998
11072
|
identifier = identifierArg;
|
|
10999
11073
|
} else if (isTTY()) {
|
|
11000
|
-
identifier = (await executeInteractiveSelect$
|
|
11074
|
+
identifier = (await executeInteractiveSelect$2(context, config2))[0];
|
|
11001
11075
|
} else {
|
|
11002
11076
|
const stdinId = await readIdentifierFromStdin();
|
|
11003
11077
|
if (!stdinId) {
|
|
@@ -11037,7 +11111,7 @@ async function handleFulltextOpenAction(identifierArg, options, globalOpts) {
|
|
|
11037
11111
|
if (identifierArg) {
|
|
11038
11112
|
identifier = identifierArg;
|
|
11039
11113
|
} else if (isTTY()) {
|
|
11040
|
-
identifier = (await executeInteractiveSelect$
|
|
11114
|
+
identifier = (await executeInteractiveSelect$2(context, config2))[0];
|
|
11041
11115
|
} else {
|
|
11042
11116
|
const stdinId = await readIdentifierFromStdin();
|
|
11043
11117
|
if (!stdinId) {
|
|
@@ -11077,7 +11151,7 @@ async function handleFulltextDiscoverAction(identifierArg, options, globalOpts)
|
|
|
11077
11151
|
if (identifierArg) {
|
|
11078
11152
|
identifier = identifierArg;
|
|
11079
11153
|
} else if (isTTY()) {
|
|
11080
|
-
identifier = (await executeInteractiveSelect$
|
|
11154
|
+
identifier = (await executeInteractiveSelect$2(context, config2))[0];
|
|
11081
11155
|
} else {
|
|
11082
11156
|
const stdinId = await readIdentifierFromStdin();
|
|
11083
11157
|
if (!stdinId) {
|
|
@@ -11117,7 +11191,7 @@ async function handleFulltextFetchAction(identifierArg, options, globalOpts) {
|
|
|
11117
11191
|
if (identifierArg) {
|
|
11118
11192
|
identifier = identifierArg;
|
|
11119
11193
|
} else if (isTTY()) {
|
|
11120
|
-
identifier = (await executeInteractiveSelect$
|
|
11194
|
+
identifier = (await executeInteractiveSelect$2(context, config2))[0];
|
|
11121
11195
|
} else {
|
|
11122
11196
|
const stdinId = await readIdentifierFromStdin();
|
|
11123
11197
|
if (!stdinId) {
|
|
@@ -11157,7 +11231,7 @@ async function handleFulltextConvertAction(identifierArg, options, globalOpts) {
|
|
|
11157
11231
|
if (identifierArg) {
|
|
11158
11232
|
identifier = identifierArg;
|
|
11159
11233
|
} else if (isTTY()) {
|
|
11160
|
-
identifier = (await executeInteractiveSelect$
|
|
11234
|
+
identifier = (await executeInteractiveSelect$2(context, config2))[0];
|
|
11161
11235
|
} else {
|
|
11162
11236
|
const stdinId = await readIdentifierFromStdin();
|
|
11163
11237
|
if (!stdinId) {
|
|
@@ -11236,14 +11310,14 @@ function buildResourceIndicators(item) {
|
|
|
11236
11310
|
if (Array.isArray(tags) && tags.length > 0) labels.push("tag");
|
|
11237
11311
|
return labels.join(" ");
|
|
11238
11312
|
}
|
|
11239
|
-
function formatAuthor(author) {
|
|
11313
|
+
function formatAuthor$1(author) {
|
|
11240
11314
|
if (author.literal) return author.literal;
|
|
11241
11315
|
const family = author.family || "";
|
|
11242
11316
|
const givenInitial = author.given ? `${author.given.charAt(0)}.` : "";
|
|
11243
11317
|
return givenInitial ? `${family}, ${givenInitial}` : family;
|
|
11244
11318
|
}
|
|
11245
11319
|
function formatAuthors(authors) {
|
|
11246
|
-
return authors.map(formatAuthor).join("; ");
|
|
11320
|
+
return authors.map(formatAuthor$1).join("; ");
|
|
11247
11321
|
}
|
|
11248
11322
|
function formatSingleReference(item) {
|
|
11249
11323
|
const lines = [];
|
|
@@ -14989,7 +15063,7 @@ ZodEnum$1.create;
|
|
|
14989
15063
|
ZodPromise.create;
|
|
14990
15064
|
ZodOptional$1.create;
|
|
14991
15065
|
ZodNullable$1.create;
|
|
14992
|
-
function $constructor(
|
|
15066
|
+
function $constructor(name, initializer2, params) {
|
|
14993
15067
|
function init(inst, def) {
|
|
14994
15068
|
if (!inst._zod) {
|
|
14995
15069
|
Object.defineProperty(inst, "_zod", {
|
|
@@ -15001,10 +15075,10 @@ function $constructor(name2, initializer2, params) {
|
|
|
15001
15075
|
enumerable: false
|
|
15002
15076
|
});
|
|
15003
15077
|
}
|
|
15004
|
-
if (inst._zod.traits.has(
|
|
15078
|
+
if (inst._zod.traits.has(name)) {
|
|
15005
15079
|
return;
|
|
15006
15080
|
}
|
|
15007
|
-
inst._zod.traits.add(
|
|
15081
|
+
inst._zod.traits.add(name);
|
|
15008
15082
|
initializer2(inst, def);
|
|
15009
15083
|
const proto = _.prototype;
|
|
15010
15084
|
const keys = Object.keys(proto);
|
|
@@ -15018,7 +15092,7 @@ function $constructor(name2, initializer2, params) {
|
|
|
15018
15092
|
const Parent = params?.Parent ?? Object;
|
|
15019
15093
|
class Definition extends Parent {
|
|
15020
15094
|
}
|
|
15021
|
-
Object.defineProperty(Definition, "name", { value:
|
|
15095
|
+
Object.defineProperty(Definition, "name", { value: name });
|
|
15022
15096
|
function _(def) {
|
|
15023
15097
|
var _a2;
|
|
15024
15098
|
const inst = params?.Parent ? new Definition() : this;
|
|
@@ -15034,10 +15108,10 @@ function $constructor(name2, initializer2, params) {
|
|
|
15034
15108
|
value: (inst) => {
|
|
15035
15109
|
if (params?.Parent && inst instanceof params.Parent)
|
|
15036
15110
|
return true;
|
|
15037
|
-
return inst?._zod?.traits?.has(
|
|
15111
|
+
return inst?._zod?.traits?.has(name);
|
|
15038
15112
|
}
|
|
15039
15113
|
});
|
|
15040
|
-
Object.defineProperty(_, "name", { value:
|
|
15114
|
+
Object.defineProperty(_, "name", { value: name });
|
|
15041
15115
|
return _;
|
|
15042
15116
|
}
|
|
15043
15117
|
class $ZodAsyncError extends Error {
|
|
@@ -15046,8 +15120,8 @@ class $ZodAsyncError extends Error {
|
|
|
15046
15120
|
}
|
|
15047
15121
|
}
|
|
15048
15122
|
class $ZodEncodeError extends Error {
|
|
15049
|
-
constructor(
|
|
15050
|
-
super(`Encountered unidirectional transform during encode: ${
|
|
15123
|
+
constructor(name) {
|
|
15124
|
+
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
15051
15125
|
this.name = "ZodEncodeError";
|
|
15052
15126
|
}
|
|
15053
15127
|
}
|
|
@@ -21060,11 +21134,11 @@ const getRefs = (options) => {
|
|
|
21060
21134
|
flags: { hasReferencedOpenAiAnyType: false },
|
|
21061
21135
|
currentPath,
|
|
21062
21136
|
propertyPath: void 0,
|
|
21063
|
-
seen: new Map(Object.entries(_options.definitions).map(([
|
|
21137
|
+
seen: new Map(Object.entries(_options.definitions).map(([name, def]) => [
|
|
21064
21138
|
def._def,
|
|
21065
21139
|
{
|
|
21066
21140
|
def: def._def,
|
|
21067
|
-
path: [..._options.basePath, _options.definitionPath,
|
|
21141
|
+
path: [..._options.basePath, _options.definitionPath, name],
|
|
21068
21142
|
// Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
|
|
21069
21143
|
jsonSchema: void 0
|
|
21070
21144
|
}
|
|
@@ -22165,17 +22239,17 @@ const addMeta = (def, refs, jsonSchema) => {
|
|
|
22165
22239
|
};
|
|
22166
22240
|
const zodToJsonSchema = (schema2, options) => {
|
|
22167
22241
|
const refs = getRefs(options);
|
|
22168
|
-
let definitions2 = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [
|
|
22242
|
+
let definitions2 = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name2, schema3]) => ({
|
|
22169
22243
|
...acc,
|
|
22170
|
-
[
|
|
22244
|
+
[name2]: parseDef(schema3._def, {
|
|
22171
22245
|
...refs,
|
|
22172
|
-
currentPath: [...refs.basePath, refs.definitionPath,
|
|
22246
|
+
currentPath: [...refs.basePath, refs.definitionPath, name2]
|
|
22173
22247
|
}, true) ?? parseAnyDef(refs)
|
|
22174
22248
|
}), {}) : void 0;
|
|
22175
|
-
const
|
|
22176
|
-
const main2 = parseDef(schema2._def,
|
|
22249
|
+
const name = typeof options === "string" ? options : options?.nameStrategy === "title" ? void 0 : options?.name;
|
|
22250
|
+
const main2 = parseDef(schema2._def, name === void 0 ? refs : {
|
|
22177
22251
|
...refs,
|
|
22178
|
-
currentPath: [...refs.basePath, refs.definitionPath,
|
|
22252
|
+
currentPath: [...refs.basePath, refs.definitionPath, name]
|
|
22179
22253
|
}, false) ?? parseAnyDef(refs);
|
|
22180
22254
|
const title2 = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
|
|
22181
22255
|
if (title2 !== void 0) {
|
|
@@ -22199,18 +22273,18 @@ const zodToJsonSchema = (schema2, options) => {
|
|
|
22199
22273
|
};
|
|
22200
22274
|
}
|
|
22201
22275
|
}
|
|
22202
|
-
const combined =
|
|
22276
|
+
const combined = name === void 0 ? definitions2 ? {
|
|
22203
22277
|
...main2,
|
|
22204
22278
|
[refs.definitionPath]: definitions2
|
|
22205
22279
|
} : main2 : {
|
|
22206
22280
|
$ref: [
|
|
22207
22281
|
...refs.$refStrategy === "relative" ? [] : refs.basePath,
|
|
22208
22282
|
refs.definitionPath,
|
|
22209
|
-
|
|
22283
|
+
name
|
|
22210
22284
|
].join("/"),
|
|
22211
22285
|
[refs.definitionPath]: {
|
|
22212
22286
|
...definitions2,
|
|
22213
|
-
[
|
|
22287
|
+
[name]: main2
|
|
22214
22288
|
}
|
|
22215
22289
|
};
|
|
22216
22290
|
if (refs.target === "jsonSchema7") {
|
|
@@ -23369,9 +23443,9 @@ function requireScope() {
|
|
|
23369
23443
|
exports$1.ValueScope = exports$1.ValueScopeName = exports$1.Scope = exports$1.varKinds = exports$1.UsedValueState = void 0;
|
|
23370
23444
|
const code_1 = requireCode$1();
|
|
23371
23445
|
class ValueError extends Error {
|
|
23372
|
-
constructor(
|
|
23373
|
-
super(`CodeGen: "code" for ${
|
|
23374
|
-
this.value =
|
|
23446
|
+
constructor(name) {
|
|
23447
|
+
super(`CodeGen: "code" for ${name} not defined`);
|
|
23448
|
+
this.value = name.value;
|
|
23375
23449
|
}
|
|
23376
23450
|
}
|
|
23377
23451
|
var UsedValueState;
|
|
@@ -23438,8 +23512,8 @@ function requireScope() {
|
|
|
23438
23512
|
var _a2;
|
|
23439
23513
|
if (value.ref === void 0)
|
|
23440
23514
|
throw new Error("CodeGen: ref must be passed in value");
|
|
23441
|
-
const
|
|
23442
|
-
const { prefix } =
|
|
23515
|
+
const name = this.toName(nameOrPrefix);
|
|
23516
|
+
const { prefix } = name;
|
|
23443
23517
|
const valueKey = (_a2 = value.key) !== null && _a2 !== void 0 ? _a2 : value.ref;
|
|
23444
23518
|
let vs = this._values[prefix];
|
|
23445
23519
|
if (vs) {
|
|
@@ -23449,12 +23523,12 @@ function requireScope() {
|
|
|
23449
23523
|
} else {
|
|
23450
23524
|
vs = this._values[prefix] = /* @__PURE__ */ new Map();
|
|
23451
23525
|
}
|
|
23452
|
-
vs.set(valueKey,
|
|
23526
|
+
vs.set(valueKey, name);
|
|
23453
23527
|
const s = this._scope[prefix] || (this._scope[prefix] = []);
|
|
23454
23528
|
const itemIndex = s.length;
|
|
23455
23529
|
s[itemIndex] = value.ref;
|
|
23456
|
-
|
|
23457
|
-
return
|
|
23530
|
+
name.setValue(value, { property: prefix, itemIndex });
|
|
23531
|
+
return name;
|
|
23458
23532
|
}
|
|
23459
23533
|
getValue(prefix, keyOrRef) {
|
|
23460
23534
|
const vs = this._values[prefix];
|
|
@@ -23463,17 +23537,17 @@ function requireScope() {
|
|
|
23463
23537
|
return vs.get(keyOrRef);
|
|
23464
23538
|
}
|
|
23465
23539
|
scopeRefs(scopeName, values = this._values) {
|
|
23466
|
-
return this._reduceValues(values, (
|
|
23467
|
-
if (
|
|
23468
|
-
throw new Error(`CodeGen: name "${
|
|
23469
|
-
return (0, code_1._)`${scopeName}${
|
|
23540
|
+
return this._reduceValues(values, (name) => {
|
|
23541
|
+
if (name.scopePath === void 0)
|
|
23542
|
+
throw new Error(`CodeGen: name "${name}" has no value`);
|
|
23543
|
+
return (0, code_1._)`${scopeName}${name.scopePath}`;
|
|
23470
23544
|
});
|
|
23471
23545
|
}
|
|
23472
23546
|
scopeCode(values = this._values, usedValues, getCode) {
|
|
23473
|
-
return this._reduceValues(values, (
|
|
23474
|
-
if (
|
|
23475
|
-
throw new Error(`CodeGen: name "${
|
|
23476
|
-
return
|
|
23547
|
+
return this._reduceValues(values, (name) => {
|
|
23548
|
+
if (name.value === void 0)
|
|
23549
|
+
throw new Error(`CodeGen: name "${name}" has no value`);
|
|
23550
|
+
return name.value.code;
|
|
23477
23551
|
}, usedValues, getCode);
|
|
23478
23552
|
}
|
|
23479
23553
|
_reduceValues(values, valueCode, usedValues = {}, getCode) {
|
|
@@ -23483,20 +23557,20 @@ function requireScope() {
|
|
|
23483
23557
|
if (!vs)
|
|
23484
23558
|
continue;
|
|
23485
23559
|
const nameSet = usedValues[prefix] = usedValues[prefix] || /* @__PURE__ */ new Map();
|
|
23486
|
-
vs.forEach((
|
|
23487
|
-
if (nameSet.has(
|
|
23560
|
+
vs.forEach((name) => {
|
|
23561
|
+
if (nameSet.has(name))
|
|
23488
23562
|
return;
|
|
23489
|
-
nameSet.set(
|
|
23490
|
-
let c = valueCode(
|
|
23563
|
+
nameSet.set(name, UsedValueState.Started);
|
|
23564
|
+
let c = valueCode(name);
|
|
23491
23565
|
if (c) {
|
|
23492
23566
|
const def = this.opts.es5 ? exports$1.varKinds.var : exports$1.varKinds.const;
|
|
23493
|
-
code2 = (0, code_1._)`${code2}${def} ${
|
|
23494
|
-
} else if (c = getCode === null || getCode === void 0 ? void 0 : getCode(
|
|
23567
|
+
code2 = (0, code_1._)`${code2}${def} ${name} = ${c};${this.opts._n}`;
|
|
23568
|
+
} else if (c = getCode === null || getCode === void 0 ? void 0 : getCode(name)) {
|
|
23495
23569
|
code2 = (0, code_1._)`${code2}${c}${this.opts._n}`;
|
|
23496
23570
|
} else {
|
|
23497
|
-
throw new ValueError(
|
|
23571
|
+
throw new ValueError(name);
|
|
23498
23572
|
}
|
|
23499
|
-
nameSet.set(
|
|
23573
|
+
nameSet.set(name, UsedValueState.Completed);
|
|
23500
23574
|
});
|
|
23501
23575
|
}
|
|
23502
23576
|
return code2;
|
|
@@ -23574,10 +23648,10 @@ function requireCodegen() {
|
|
|
23574
23648
|
}
|
|
23575
23649
|
}
|
|
23576
23650
|
class Def extends Node {
|
|
23577
|
-
constructor(varKind,
|
|
23651
|
+
constructor(varKind, name, rhs) {
|
|
23578
23652
|
super();
|
|
23579
23653
|
this.varKind = varKind;
|
|
23580
|
-
this.name =
|
|
23654
|
+
this.name = name;
|
|
23581
23655
|
this.rhs = rhs;
|
|
23582
23656
|
}
|
|
23583
23657
|
render({ es5, _n }) {
|
|
@@ -23627,9 +23701,9 @@ function requireCodegen() {
|
|
|
23627
23701
|
}
|
|
23628
23702
|
}
|
|
23629
23703
|
class Label extends Node {
|
|
23630
|
-
constructor(
|
|
23704
|
+
constructor(label2) {
|
|
23631
23705
|
super();
|
|
23632
|
-
this.label =
|
|
23706
|
+
this.label = label2;
|
|
23633
23707
|
this.names = {};
|
|
23634
23708
|
}
|
|
23635
23709
|
render({ _n }) {
|
|
@@ -23637,14 +23711,14 @@ function requireCodegen() {
|
|
|
23637
23711
|
}
|
|
23638
23712
|
}
|
|
23639
23713
|
class Break extends Node {
|
|
23640
|
-
constructor(
|
|
23714
|
+
constructor(label2) {
|
|
23641
23715
|
super();
|
|
23642
|
-
this.label =
|
|
23716
|
+
this.label = label2;
|
|
23643
23717
|
this.names = {};
|
|
23644
23718
|
}
|
|
23645
23719
|
render({ _n }) {
|
|
23646
|
-
const
|
|
23647
|
-
return `break${
|
|
23720
|
+
const label2 = this.label ? ` ${this.label}` : "";
|
|
23721
|
+
return `break${label2};` + _n;
|
|
23648
23722
|
}
|
|
23649
23723
|
}
|
|
23650
23724
|
class Throw extends Node {
|
|
@@ -23797,17 +23871,17 @@ function requireCodegen() {
|
|
|
23797
23871
|
}
|
|
23798
23872
|
}
|
|
23799
23873
|
class ForRange extends For {
|
|
23800
|
-
constructor(varKind,
|
|
23874
|
+
constructor(varKind, name, from, to) {
|
|
23801
23875
|
super();
|
|
23802
23876
|
this.varKind = varKind;
|
|
23803
|
-
this.name =
|
|
23877
|
+
this.name = name;
|
|
23804
23878
|
this.from = from;
|
|
23805
23879
|
this.to = to;
|
|
23806
23880
|
}
|
|
23807
23881
|
render(opts) {
|
|
23808
23882
|
const varKind = opts.es5 ? scope_1.varKinds.var : this.varKind;
|
|
23809
|
-
const { name
|
|
23810
|
-
return `for(${varKind} ${
|
|
23883
|
+
const { name, from, to } = this;
|
|
23884
|
+
return `for(${varKind} ${name}=${from}; ${name}<${to}; ${name}++)` + super.render(opts);
|
|
23811
23885
|
}
|
|
23812
23886
|
get names() {
|
|
23813
23887
|
const names2 = addExprNames(super.names, this.from);
|
|
@@ -23815,11 +23889,11 @@ function requireCodegen() {
|
|
|
23815
23889
|
}
|
|
23816
23890
|
}
|
|
23817
23891
|
class ForIter extends For {
|
|
23818
|
-
constructor(loop, varKind,
|
|
23892
|
+
constructor(loop, varKind, name, iterable) {
|
|
23819
23893
|
super();
|
|
23820
23894
|
this.loop = loop;
|
|
23821
23895
|
this.varKind = varKind;
|
|
23822
|
-
this.name =
|
|
23896
|
+
this.name = name;
|
|
23823
23897
|
this.iterable = iterable;
|
|
23824
23898
|
}
|
|
23825
23899
|
render(opts) {
|
|
@@ -23836,9 +23910,9 @@ function requireCodegen() {
|
|
|
23836
23910
|
}
|
|
23837
23911
|
}
|
|
23838
23912
|
class Func extends BlockNode {
|
|
23839
|
-
constructor(
|
|
23913
|
+
constructor(name, args, async) {
|
|
23840
23914
|
super();
|
|
23841
|
-
this.name =
|
|
23915
|
+
this.name = name;
|
|
23842
23916
|
this.args = args;
|
|
23843
23917
|
this.async = async;
|
|
23844
23918
|
}
|
|
@@ -23925,10 +23999,10 @@ function requireCodegen() {
|
|
|
23925
23999
|
}
|
|
23926
24000
|
// reserves unique name in the external scope and assigns value to it
|
|
23927
24001
|
scopeValue(prefixOrName, value) {
|
|
23928
|
-
const
|
|
23929
|
-
const vs = this._values[
|
|
23930
|
-
vs.add(
|
|
23931
|
-
return
|
|
24002
|
+
const name = this._extScope.value(prefixOrName, value);
|
|
24003
|
+
const vs = this._values[name.prefix] || (this._values[name.prefix] = /* @__PURE__ */ new Set());
|
|
24004
|
+
vs.add(name);
|
|
24005
|
+
return name;
|
|
23932
24006
|
}
|
|
23933
24007
|
getScopeValue(prefix, keyOrRef) {
|
|
23934
24008
|
return this._extScope.getValue(prefix, keyOrRef);
|
|
@@ -23942,11 +24016,11 @@ function requireCodegen() {
|
|
|
23942
24016
|
return this._extScope.scopeCode(this._values);
|
|
23943
24017
|
}
|
|
23944
24018
|
_def(varKind, nameOrPrefix, rhs, constant) {
|
|
23945
|
-
const
|
|
24019
|
+
const name = this._scope.toName(nameOrPrefix);
|
|
23946
24020
|
if (rhs !== void 0 && constant)
|
|
23947
|
-
this._constants[
|
|
23948
|
-
this._leafNode(new Def(varKind,
|
|
23949
|
-
return
|
|
24021
|
+
this._constants[name.str] = rhs;
|
|
24022
|
+
this._leafNode(new Def(varKind, name, rhs));
|
|
24023
|
+
return name;
|
|
23950
24024
|
}
|
|
23951
24025
|
// `const` declaration (`var` in es5 mode)
|
|
23952
24026
|
const(nameOrPrefix, rhs, _constant) {
|
|
@@ -24027,20 +24101,20 @@ function requireCodegen() {
|
|
|
24027
24101
|
}
|
|
24028
24102
|
// `for` statement for a range of values
|
|
24029
24103
|
forRange(nameOrPrefix, from, to, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.let) {
|
|
24030
|
-
const
|
|
24031
|
-
return this._for(new ForRange(varKind,
|
|
24104
|
+
const name = this._scope.toName(nameOrPrefix);
|
|
24105
|
+
return this._for(new ForRange(varKind, name, from, to), () => forBody(name));
|
|
24032
24106
|
}
|
|
24033
24107
|
// `for-of` statement (in es5 mode replace with a normal for loop)
|
|
24034
24108
|
forOf(nameOrPrefix, iterable, forBody, varKind = scope_1.varKinds.const) {
|
|
24035
|
-
const
|
|
24109
|
+
const name = this._scope.toName(nameOrPrefix);
|
|
24036
24110
|
if (this.opts.es5) {
|
|
24037
24111
|
const arr = iterable instanceof code_1.Name ? iterable : this.var("_arr", iterable);
|
|
24038
24112
|
return this.forRange("_i", 0, (0, code_1._)`${arr}.length`, (i) => {
|
|
24039
|
-
this.var(
|
|
24040
|
-
forBody(
|
|
24113
|
+
this.var(name, (0, code_1._)`${arr}[${i}]`);
|
|
24114
|
+
forBody(name);
|
|
24041
24115
|
});
|
|
24042
24116
|
}
|
|
24043
|
-
return this._for(new ForIter("of", varKind,
|
|
24117
|
+
return this._for(new ForIter("of", varKind, name, iterable), () => forBody(name));
|
|
24044
24118
|
}
|
|
24045
24119
|
// `for-in` statement.
|
|
24046
24120
|
// With option `ownProperties` replaced with a `for-of` loop for object keys
|
|
@@ -24048,20 +24122,20 @@ function requireCodegen() {
|
|
|
24048
24122
|
if (this.opts.ownProperties) {
|
|
24049
24123
|
return this.forOf(nameOrPrefix, (0, code_1._)`Object.keys(${obj})`, forBody);
|
|
24050
24124
|
}
|
|
24051
|
-
const
|
|
24052
|
-
return this._for(new ForIter("in", varKind,
|
|
24125
|
+
const name = this._scope.toName(nameOrPrefix);
|
|
24126
|
+
return this._for(new ForIter("in", varKind, name, obj), () => forBody(name));
|
|
24053
24127
|
}
|
|
24054
24128
|
// end `for` loop
|
|
24055
24129
|
endFor() {
|
|
24056
24130
|
return this._endBlockNode(For);
|
|
24057
24131
|
}
|
|
24058
24132
|
// `label` statement
|
|
24059
|
-
label(
|
|
24060
|
-
return this._leafNode(new Label(
|
|
24133
|
+
label(label2) {
|
|
24134
|
+
return this._leafNode(new Label(label2));
|
|
24061
24135
|
}
|
|
24062
24136
|
// `break` statement
|
|
24063
|
-
break(
|
|
24064
|
-
return this._leafNode(new Break(
|
|
24137
|
+
break(label2) {
|
|
24138
|
+
return this._leafNode(new Break(label2));
|
|
24065
24139
|
}
|
|
24066
24140
|
// `return` statement
|
|
24067
24141
|
return(value) {
|
|
@@ -24114,8 +24188,8 @@ function requireCodegen() {
|
|
|
24114
24188
|
return this;
|
|
24115
24189
|
}
|
|
24116
24190
|
// `function` heading (or definition if funcBody is passed)
|
|
24117
|
-
func(
|
|
24118
|
-
this._blockNode(new Func(
|
|
24191
|
+
func(name, args = code_1.nil, async, funcBody) {
|
|
24192
|
+
this._blockNode(new Func(name, args, async));
|
|
24119
24193
|
if (funcBody)
|
|
24120
24194
|
this.code(funcBody).endFunc();
|
|
24121
24195
|
return this;
|
|
@@ -26548,10 +26622,10 @@ function requireSchemes() {
|
|
|
26548
26622
|
"urn:uuid"
|
|
26549
26623
|
]
|
|
26550
26624
|
);
|
|
26551
|
-
function isValidSchemeName(
|
|
26625
|
+
function isValidSchemeName(name) {
|
|
26552
26626
|
return supportedSchemeNames.indexOf(
|
|
26553
26627
|
/** @type {*} */
|
|
26554
|
-
|
|
26628
|
+
name
|
|
26555
26629
|
) !== -1;
|
|
26556
26630
|
}
|
|
26557
26631
|
function wsIsSecure(wsComponent) {
|
|
@@ -27388,10 +27462,10 @@ function requireCore$1() {
|
|
|
27388
27462
|
return this;
|
|
27389
27463
|
}
|
|
27390
27464
|
// Add format
|
|
27391
|
-
addFormat(
|
|
27465
|
+
addFormat(name, format2) {
|
|
27392
27466
|
if (typeof format2 == "string")
|
|
27393
27467
|
format2 = new RegExp(format2);
|
|
27394
|
-
this.formats[
|
|
27468
|
+
this.formats[name] = format2;
|
|
27395
27469
|
return this;
|
|
27396
27470
|
}
|
|
27397
27471
|
errorsText(errors2 = this.errors, { separator = ", ", dataVar = "data" } = {}) {
|
|
@@ -27508,10 +27582,10 @@ function requireCore$1() {
|
|
|
27508
27582
|
this.addSchema(optsSchemas[key], key);
|
|
27509
27583
|
}
|
|
27510
27584
|
function addInitialFormats() {
|
|
27511
|
-
for (const
|
|
27512
|
-
const format2 = this.opts.formats[
|
|
27585
|
+
for (const name in this.opts.formats) {
|
|
27586
|
+
const format2 = this.opts.formats[name];
|
|
27513
27587
|
if (format2)
|
|
27514
|
-
this.addFormat(
|
|
27588
|
+
this.addFormat(name, format2);
|
|
27515
27589
|
}
|
|
27516
27590
|
}
|
|
27517
27591
|
function addInitialKeywords(defs) {
|
|
@@ -29811,11 +29885,11 @@ function requireDist() {
|
|
|
29811
29885
|
(0, limit_1.default)(ajv2);
|
|
29812
29886
|
return ajv2;
|
|
29813
29887
|
};
|
|
29814
|
-
formatsPlugin.get = (
|
|
29888
|
+
formatsPlugin.get = (name, mode = "full") => {
|
|
29815
29889
|
const formats2 = mode === "fast" ? formats_1.fastFormats : formats_1.fullFormats;
|
|
29816
|
-
const f = formats2[
|
|
29890
|
+
const f = formats2[name];
|
|
29817
29891
|
if (!f)
|
|
29818
|
-
throw new Error(`Unknown format "${
|
|
29892
|
+
throw new Error(`Unknown format "${name}"`);
|
|
29819
29893
|
return f;
|
|
29820
29894
|
};
|
|
29821
29895
|
function addFormats(ajv2, list, fs2, exportName) {
|
|
@@ -30428,11 +30502,11 @@ class UriTemplate {
|
|
|
30428
30502
|
const operator = this.getOperator(expr);
|
|
30429
30503
|
const exploded = expr.includes("*");
|
|
30430
30504
|
const names2 = this.getNames(expr);
|
|
30431
|
-
const
|
|
30432
|
-
for (const
|
|
30433
|
-
UriTemplate.validateLength(
|
|
30505
|
+
const name = names2[0];
|
|
30506
|
+
for (const name2 of names2) {
|
|
30507
|
+
UriTemplate.validateLength(name2, MAX_VARIABLE_LENGTH, "Variable name");
|
|
30434
30508
|
}
|
|
30435
|
-
parts.push({ name
|
|
30509
|
+
parts.push({ name, operator, names: names2, exploded });
|
|
30436
30510
|
i = end + 1;
|
|
30437
30511
|
} else {
|
|
30438
30512
|
currentText += template[i];
|
|
@@ -30450,7 +30524,7 @@ class UriTemplate {
|
|
|
30450
30524
|
}
|
|
30451
30525
|
getNames(expr) {
|
|
30452
30526
|
const operator = this.getOperator(expr);
|
|
30453
|
-
return expr.slice(operator.length).split(",").map((
|
|
30527
|
+
return expr.slice(operator.length).split(",").map((name) => name.replace("*", "").trim()).filter((name) => name.length > 0);
|
|
30454
30528
|
}
|
|
30455
30529
|
encodeValue(value, operator) {
|
|
30456
30530
|
UriTemplate.validateLength(value, MAX_VARIABLE_LENGTH, "Variable value");
|
|
@@ -30461,12 +30535,12 @@ class UriTemplate {
|
|
|
30461
30535
|
}
|
|
30462
30536
|
expandPart(part, variables) {
|
|
30463
30537
|
if (part.operator === "?" || part.operator === "&") {
|
|
30464
|
-
const pairs2 = part.names.map((
|
|
30465
|
-
const value2 = variables[
|
|
30538
|
+
const pairs2 = part.names.map((name) => {
|
|
30539
|
+
const value2 = variables[name];
|
|
30466
30540
|
if (value2 === void 0)
|
|
30467
30541
|
return "";
|
|
30468
30542
|
const encoded2 = Array.isArray(value2) ? value2.map((v) => this.encodeValue(v, part.operator)).join(",") : this.encodeValue(value2.toString(), part.operator);
|
|
30469
|
-
return `${
|
|
30543
|
+
return `${name}=${encoded2}`;
|
|
30470
30544
|
}).filter((pair) => pair.length > 0);
|
|
30471
30545
|
if (pairs2.length === 0)
|
|
30472
30546
|
return "";
|
|
@@ -30474,7 +30548,7 @@ class UriTemplate {
|
|
|
30474
30548
|
return separator + pairs2.join("&");
|
|
30475
30549
|
}
|
|
30476
30550
|
if (part.names.length > 1) {
|
|
30477
|
-
const values2 = part.names.map((
|
|
30551
|
+
const values2 = part.names.map((name) => variables[name]).filter((v) => v !== void 0);
|
|
30478
30552
|
if (values2.length === 0)
|
|
30479
30553
|
return "";
|
|
30480
30554
|
return values2.map((v) => Array.isArray(v) ? v[0] : v).join(",");
|
|
@@ -30526,22 +30600,22 @@ class UriTemplate {
|
|
|
30526
30600
|
}
|
|
30527
30601
|
partToRegExp(part) {
|
|
30528
30602
|
const patterns = [];
|
|
30529
|
-
for (const
|
|
30530
|
-
UriTemplate.validateLength(
|
|
30603
|
+
for (const name2 of part.names) {
|
|
30604
|
+
UriTemplate.validateLength(name2, MAX_VARIABLE_LENGTH, "Variable name");
|
|
30531
30605
|
}
|
|
30532
30606
|
if (part.operator === "?" || part.operator === "&") {
|
|
30533
30607
|
for (let i = 0; i < part.names.length; i++) {
|
|
30534
|
-
const
|
|
30608
|
+
const name2 = part.names[i];
|
|
30535
30609
|
const prefix = i === 0 ? "\\" + part.operator : "&";
|
|
30536
30610
|
patterns.push({
|
|
30537
|
-
pattern: prefix + this.escapeRegExp(
|
|
30538
|
-
name:
|
|
30611
|
+
pattern: prefix + this.escapeRegExp(name2) + "=([^&]+)",
|
|
30612
|
+
name: name2
|
|
30539
30613
|
});
|
|
30540
30614
|
}
|
|
30541
30615
|
return patterns;
|
|
30542
30616
|
}
|
|
30543
30617
|
let pattern2;
|
|
30544
|
-
const
|
|
30618
|
+
const name = part.name;
|
|
30545
30619
|
switch (part.operator) {
|
|
30546
30620
|
case "":
|
|
30547
30621
|
pattern2 = part.exploded ? "([^/]+(?:,[^/]+)*)" : "([^/,]+)";
|
|
@@ -30559,7 +30633,7 @@ class UriTemplate {
|
|
|
30559
30633
|
default:
|
|
30560
30634
|
pattern2 = "([^/]+)";
|
|
30561
30635
|
}
|
|
30562
|
-
patterns.push({ pattern: pattern2, name
|
|
30636
|
+
patterns.push({ pattern: pattern2, name });
|
|
30563
30637
|
return patterns;
|
|
30564
30638
|
}
|
|
30565
30639
|
match(uri2) {
|
|
@@ -30571,9 +30645,9 @@ class UriTemplate {
|
|
|
30571
30645
|
pattern2 += this.escapeRegExp(part);
|
|
30572
30646
|
} else {
|
|
30573
30647
|
const patterns = this.partToRegExp(part);
|
|
30574
|
-
for (const { pattern: partPattern, name
|
|
30648
|
+
for (const { pattern: partPattern, name } of patterns) {
|
|
30575
30649
|
pattern2 += partPattern;
|
|
30576
|
-
names2.push({ name
|
|
30650
|
+
names2.push({ name, exploded: part.exploded });
|
|
30577
30651
|
}
|
|
30578
30652
|
}
|
|
30579
30653
|
}
|
|
@@ -30585,9 +30659,9 @@ class UriTemplate {
|
|
|
30585
30659
|
return null;
|
|
30586
30660
|
const result = {};
|
|
30587
30661
|
for (let i = 0; i < names2.length; i++) {
|
|
30588
|
-
const { name
|
|
30662
|
+
const { name, exploded } = names2[i];
|
|
30589
30663
|
const value = match[i + 1];
|
|
30590
|
-
const cleanName =
|
|
30664
|
+
const cleanName = name.replace("*", "");
|
|
30591
30665
|
if (exploded && value.includes(",")) {
|
|
30592
30666
|
result[cleanName] = value.split(",");
|
|
30593
30667
|
} else {
|
|
@@ -30598,34 +30672,34 @@ class UriTemplate {
|
|
|
30598
30672
|
}
|
|
30599
30673
|
}
|
|
30600
30674
|
const TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/;
|
|
30601
|
-
function validateToolName(
|
|
30675
|
+
function validateToolName(name) {
|
|
30602
30676
|
const warnings = [];
|
|
30603
|
-
if (
|
|
30677
|
+
if (name.length === 0) {
|
|
30604
30678
|
return {
|
|
30605
30679
|
isValid: false,
|
|
30606
30680
|
warnings: ["Tool name cannot be empty"]
|
|
30607
30681
|
};
|
|
30608
30682
|
}
|
|
30609
|
-
if (
|
|
30683
|
+
if (name.length > 128) {
|
|
30610
30684
|
return {
|
|
30611
30685
|
isValid: false,
|
|
30612
|
-
warnings: [`Tool name exceeds maximum length of 128 characters (current: ${
|
|
30686
|
+
warnings: [`Tool name exceeds maximum length of 128 characters (current: ${name.length})`]
|
|
30613
30687
|
};
|
|
30614
30688
|
}
|
|
30615
|
-
if (
|
|
30689
|
+
if (name.includes(" ")) {
|
|
30616
30690
|
warnings.push("Tool name contains spaces, which may cause parsing issues");
|
|
30617
30691
|
}
|
|
30618
|
-
if (
|
|
30692
|
+
if (name.includes(",")) {
|
|
30619
30693
|
warnings.push("Tool name contains commas, which may cause parsing issues");
|
|
30620
30694
|
}
|
|
30621
|
-
if (
|
|
30695
|
+
if (name.startsWith("-") || name.endsWith("-")) {
|
|
30622
30696
|
warnings.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");
|
|
30623
30697
|
}
|
|
30624
|
-
if (
|
|
30698
|
+
if (name.startsWith(".") || name.endsWith(".")) {
|
|
30625
30699
|
warnings.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");
|
|
30626
30700
|
}
|
|
30627
|
-
if (!TOOL_NAME_REGEX.test(
|
|
30628
|
-
const invalidChars =
|
|
30701
|
+
if (!TOOL_NAME_REGEX.test(name)) {
|
|
30702
|
+
const invalidChars = name.split("").filter((char) => !/[A-Za-z0-9._-]/.test(char)).filter((char, index, arr) => arr.indexOf(char) === index);
|
|
30629
30703
|
warnings.push(`Tool name contains invalid characters: ${invalidChars.map((c) => `"${c}"`).join(", ")}`, "Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)");
|
|
30630
30704
|
return {
|
|
30631
30705
|
isValid: false,
|
|
@@ -30637,9 +30711,9 @@ function validateToolName(name2) {
|
|
|
30637
30711
|
warnings
|
|
30638
30712
|
};
|
|
30639
30713
|
}
|
|
30640
|
-
function issueToolNameWarning(
|
|
30714
|
+
function issueToolNameWarning(name, warnings) {
|
|
30641
30715
|
if (warnings.length > 0) {
|
|
30642
|
-
console.warn(`Tool name validation warning for "${
|
|
30716
|
+
console.warn(`Tool name validation warning for "${name}":`);
|
|
30643
30717
|
for (const warning of warnings) {
|
|
30644
30718
|
console.warn(` - ${warning}`);
|
|
30645
30719
|
}
|
|
@@ -30648,22 +30722,22 @@ function issueToolNameWarning(name2, warnings) {
|
|
|
30648
30722
|
console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.");
|
|
30649
30723
|
}
|
|
30650
30724
|
}
|
|
30651
|
-
function validateAndWarnToolName(
|
|
30652
|
-
const result = validateToolName(
|
|
30653
|
-
issueToolNameWarning(
|
|
30725
|
+
function validateAndWarnToolName(name) {
|
|
30726
|
+
const result = validateToolName(name);
|
|
30727
|
+
issueToolNameWarning(name, result.warnings);
|
|
30654
30728
|
return result.isValid;
|
|
30655
30729
|
}
|
|
30656
30730
|
class ExperimentalMcpServerTasks {
|
|
30657
30731
|
constructor(_mcpServer) {
|
|
30658
30732
|
this._mcpServer = _mcpServer;
|
|
30659
30733
|
}
|
|
30660
|
-
registerToolTask(
|
|
30734
|
+
registerToolTask(name, config2, handler) {
|
|
30661
30735
|
const execution = { taskSupport: "required", ...config2.execution };
|
|
30662
30736
|
if (execution.taskSupport === "forbidden") {
|
|
30663
|
-
throw new Error(`Cannot register task-based tool '${
|
|
30737
|
+
throw new Error(`Cannot register task-based tool '${name}' with taskSupport 'forbidden'. Use registerTool() instead.`);
|
|
30664
30738
|
}
|
|
30665
30739
|
const mcpServerInternal = this._mcpServer;
|
|
30666
|
-
return mcpServerInternal._createRegisteredTool(
|
|
30740
|
+
return mcpServerInternal._createRegisteredTool(name, config2.title, config2.description, config2.inputSchema, config2.outputSchema, config2.annotations, execution, config2._meta, handler);
|
|
30667
30741
|
}
|
|
30668
30742
|
}
|
|
30669
30743
|
class McpServer {
|
|
@@ -30719,9 +30793,9 @@ class McpServer {
|
|
|
30719
30793
|
}
|
|
30720
30794
|
});
|
|
30721
30795
|
this.server.setRequestHandler(ListToolsRequestSchema, () => ({
|
|
30722
|
-
tools: Object.entries(this._registeredTools).filter(([, tool]) => tool.enabled).map(([
|
|
30796
|
+
tools: Object.entries(this._registeredTools).filter(([, tool]) => tool.enabled).map(([name, tool]) => {
|
|
30723
30797
|
const toolDefinition = {
|
|
30724
|
-
name
|
|
30798
|
+
name,
|
|
30725
30799
|
title: tool.title,
|
|
30726
30800
|
description: tool.description,
|
|
30727
30801
|
inputSchema: (() => {
|
|
@@ -30993,8 +31067,8 @@ class McpServer {
|
|
|
30993
31067
|
return { resources: [...resources, ...templateResources] };
|
|
30994
31068
|
});
|
|
30995
31069
|
this.server.setRequestHandler(ListResourceTemplatesRequestSchema, async () => {
|
|
30996
|
-
const resourceTemplates = Object.entries(this._registeredResourceTemplates).map(([
|
|
30997
|
-
name
|
|
31070
|
+
const resourceTemplates = Object.entries(this._registeredResourceTemplates).map(([name, template]) => ({
|
|
31071
|
+
name,
|
|
30998
31072
|
uriTemplate: template.resourceTemplate.uriTemplate.toString(),
|
|
30999
31073
|
...template.metadata
|
|
31000
31074
|
}));
|
|
@@ -31031,9 +31105,9 @@ class McpServer {
|
|
|
31031
31105
|
}
|
|
31032
31106
|
});
|
|
31033
31107
|
this.server.setRequestHandler(ListPromptsRequestSchema, () => ({
|
|
31034
|
-
prompts: Object.entries(this._registeredPrompts).filter(([, prompt]) => prompt.enabled).map(([
|
|
31108
|
+
prompts: Object.entries(this._registeredPrompts).filter(([, prompt]) => prompt.enabled).map(([name, prompt]) => {
|
|
31035
31109
|
return {
|
|
31036
|
-
name
|
|
31110
|
+
name,
|
|
31037
31111
|
title: prompt.title,
|
|
31038
31112
|
description: prompt.description,
|
|
31039
31113
|
arguments: prompt.argsSchema ? promptArgumentsFromSchema(prompt.argsSchema) : void 0
|
|
@@ -31066,7 +31140,7 @@ class McpServer {
|
|
|
31066
31140
|
});
|
|
31067
31141
|
this._promptHandlersInitialized = true;
|
|
31068
31142
|
}
|
|
31069
|
-
resource(
|
|
31143
|
+
resource(name, uriOrTemplate, ...rest) {
|
|
31070
31144
|
let metadata2;
|
|
31071
31145
|
if (typeof rest[0] === "object") {
|
|
31072
31146
|
metadata2 = rest.shift();
|
|
@@ -31076,42 +31150,42 @@ class McpServer {
|
|
|
31076
31150
|
if (this._registeredResources[uriOrTemplate]) {
|
|
31077
31151
|
throw new Error(`Resource ${uriOrTemplate} is already registered`);
|
|
31078
31152
|
}
|
|
31079
|
-
const registeredResource = this._createRegisteredResource(
|
|
31153
|
+
const registeredResource = this._createRegisteredResource(name, void 0, uriOrTemplate, metadata2, readCallback);
|
|
31080
31154
|
this.setResourceRequestHandlers();
|
|
31081
31155
|
this.sendResourceListChanged();
|
|
31082
31156
|
return registeredResource;
|
|
31083
31157
|
} else {
|
|
31084
|
-
if (this._registeredResourceTemplates[
|
|
31085
|
-
throw new Error(`Resource template ${
|
|
31158
|
+
if (this._registeredResourceTemplates[name]) {
|
|
31159
|
+
throw new Error(`Resource template ${name} is already registered`);
|
|
31086
31160
|
}
|
|
31087
|
-
const registeredResourceTemplate = this._createRegisteredResourceTemplate(
|
|
31161
|
+
const registeredResourceTemplate = this._createRegisteredResourceTemplate(name, void 0, uriOrTemplate, metadata2, readCallback);
|
|
31088
31162
|
this.setResourceRequestHandlers();
|
|
31089
31163
|
this.sendResourceListChanged();
|
|
31090
31164
|
return registeredResourceTemplate;
|
|
31091
31165
|
}
|
|
31092
31166
|
}
|
|
31093
|
-
registerResource(
|
|
31167
|
+
registerResource(name, uriOrTemplate, config2, readCallback) {
|
|
31094
31168
|
if (typeof uriOrTemplate === "string") {
|
|
31095
31169
|
if (this._registeredResources[uriOrTemplate]) {
|
|
31096
31170
|
throw new Error(`Resource ${uriOrTemplate} is already registered`);
|
|
31097
31171
|
}
|
|
31098
|
-
const registeredResource = this._createRegisteredResource(
|
|
31172
|
+
const registeredResource = this._createRegisteredResource(name, config2.title, uriOrTemplate, config2, readCallback);
|
|
31099
31173
|
this.setResourceRequestHandlers();
|
|
31100
31174
|
this.sendResourceListChanged();
|
|
31101
31175
|
return registeredResource;
|
|
31102
31176
|
} else {
|
|
31103
|
-
if (this._registeredResourceTemplates[
|
|
31104
|
-
throw new Error(`Resource template ${
|
|
31177
|
+
if (this._registeredResourceTemplates[name]) {
|
|
31178
|
+
throw new Error(`Resource template ${name} is already registered`);
|
|
31105
31179
|
}
|
|
31106
|
-
const registeredResourceTemplate = this._createRegisteredResourceTemplate(
|
|
31180
|
+
const registeredResourceTemplate = this._createRegisteredResourceTemplate(name, config2.title, uriOrTemplate, config2, readCallback);
|
|
31107
31181
|
this.setResourceRequestHandlers();
|
|
31108
31182
|
this.sendResourceListChanged();
|
|
31109
31183
|
return registeredResourceTemplate;
|
|
31110
31184
|
}
|
|
31111
31185
|
}
|
|
31112
|
-
_createRegisteredResource(
|
|
31186
|
+
_createRegisteredResource(name, title2, uri2, metadata2, readCallback) {
|
|
31113
31187
|
const registeredResource = {
|
|
31114
|
-
name
|
|
31188
|
+
name,
|
|
31115
31189
|
title: title2,
|
|
31116
31190
|
metadata: metadata2,
|
|
31117
31191
|
readCallback,
|
|
@@ -31141,7 +31215,7 @@ class McpServer {
|
|
|
31141
31215
|
this._registeredResources[uri2] = registeredResource;
|
|
31142
31216
|
return registeredResource;
|
|
31143
31217
|
}
|
|
31144
|
-
_createRegisteredResourceTemplate(
|
|
31218
|
+
_createRegisteredResourceTemplate(name, title2, template, metadata2, readCallback) {
|
|
31145
31219
|
const registeredResourceTemplate = {
|
|
31146
31220
|
resourceTemplate: template,
|
|
31147
31221
|
title: title2,
|
|
@@ -31152,8 +31226,8 @@ class McpServer {
|
|
|
31152
31226
|
enable: () => registeredResourceTemplate.update({ enabled: true }),
|
|
31153
31227
|
remove: () => registeredResourceTemplate.update({ name: null }),
|
|
31154
31228
|
update: (updates) => {
|
|
31155
|
-
if (typeof updates.name !== "undefined" && updates.name !==
|
|
31156
|
-
delete this._registeredResourceTemplates[
|
|
31229
|
+
if (typeof updates.name !== "undefined" && updates.name !== name) {
|
|
31230
|
+
delete this._registeredResourceTemplates[name];
|
|
31157
31231
|
if (updates.name)
|
|
31158
31232
|
this._registeredResourceTemplates[updates.name] = registeredResourceTemplate;
|
|
31159
31233
|
}
|
|
@@ -31170,7 +31244,7 @@ class McpServer {
|
|
|
31170
31244
|
this.sendResourceListChanged();
|
|
31171
31245
|
}
|
|
31172
31246
|
};
|
|
31173
|
-
this._registeredResourceTemplates[
|
|
31247
|
+
this._registeredResourceTemplates[name] = registeredResourceTemplate;
|
|
31174
31248
|
const variableNames = template.uriTemplate.variableNames;
|
|
31175
31249
|
const hasCompleter = Array.isArray(variableNames) && variableNames.some((v) => !!template.completeCallback(v));
|
|
31176
31250
|
if (hasCompleter) {
|
|
@@ -31178,7 +31252,7 @@ class McpServer {
|
|
|
31178
31252
|
}
|
|
31179
31253
|
return registeredResourceTemplate;
|
|
31180
31254
|
}
|
|
31181
|
-
_createRegisteredPrompt(
|
|
31255
|
+
_createRegisteredPrompt(name, title2, description2, argsSchema, callback) {
|
|
31182
31256
|
const registeredPrompt = {
|
|
31183
31257
|
title: title2,
|
|
31184
31258
|
description: description2,
|
|
@@ -31189,8 +31263,8 @@ class McpServer {
|
|
|
31189
31263
|
enable: () => registeredPrompt.update({ enabled: true }),
|
|
31190
31264
|
remove: () => registeredPrompt.update({ name: null }),
|
|
31191
31265
|
update: (updates) => {
|
|
31192
|
-
if (typeof updates.name !== "undefined" && updates.name !==
|
|
31193
|
-
delete this._registeredPrompts[
|
|
31266
|
+
if (typeof updates.name !== "undefined" && updates.name !== name) {
|
|
31267
|
+
delete this._registeredPrompts[name];
|
|
31194
31268
|
if (updates.name)
|
|
31195
31269
|
this._registeredPrompts[updates.name] = registeredPrompt;
|
|
31196
31270
|
}
|
|
@@ -31207,7 +31281,7 @@ class McpServer {
|
|
|
31207
31281
|
this.sendPromptListChanged();
|
|
31208
31282
|
}
|
|
31209
31283
|
};
|
|
31210
|
-
this._registeredPrompts[
|
|
31284
|
+
this._registeredPrompts[name] = registeredPrompt;
|
|
31211
31285
|
if (argsSchema) {
|
|
31212
31286
|
const hasCompletable = Object.values(argsSchema).some((field) => {
|
|
31213
31287
|
const inner = field instanceof ZodOptional$2 ? field._def?.innerType : field;
|
|
@@ -31219,8 +31293,8 @@ class McpServer {
|
|
|
31219
31293
|
}
|
|
31220
31294
|
return registeredPrompt;
|
|
31221
31295
|
}
|
|
31222
|
-
_createRegisteredTool(
|
|
31223
|
-
validateAndWarnToolName(
|
|
31296
|
+
_createRegisteredTool(name, title2, description2, inputSchema, outputSchema, annotations, execution, _meta, handler) {
|
|
31297
|
+
validateAndWarnToolName(name);
|
|
31224
31298
|
const registeredTool = {
|
|
31225
31299
|
title: title2,
|
|
31226
31300
|
description: description2,
|
|
@@ -31235,11 +31309,11 @@ class McpServer {
|
|
|
31235
31309
|
enable: () => registeredTool.update({ enabled: true }),
|
|
31236
31310
|
remove: () => registeredTool.update({ name: null }),
|
|
31237
31311
|
update: (updates) => {
|
|
31238
|
-
if (typeof updates.name !== "undefined" && updates.name !==
|
|
31312
|
+
if (typeof updates.name !== "undefined" && updates.name !== name) {
|
|
31239
31313
|
if (typeof updates.name === "string") {
|
|
31240
31314
|
validateAndWarnToolName(updates.name);
|
|
31241
31315
|
}
|
|
31242
|
-
delete this._registeredTools[
|
|
31316
|
+
delete this._registeredTools[name];
|
|
31243
31317
|
if (updates.name)
|
|
31244
31318
|
this._registeredTools[updates.name] = registeredTool;
|
|
31245
31319
|
}
|
|
@@ -31262,7 +31336,7 @@ class McpServer {
|
|
|
31262
31336
|
this.sendToolListChanged();
|
|
31263
31337
|
}
|
|
31264
31338
|
};
|
|
31265
|
-
this._registeredTools[
|
|
31339
|
+
this._registeredTools[name] = registeredTool;
|
|
31266
31340
|
this.setToolRequestHandlers();
|
|
31267
31341
|
this.sendToolListChanged();
|
|
31268
31342
|
return registeredTool;
|
|
@@ -31270,9 +31344,9 @@ class McpServer {
|
|
|
31270
31344
|
/**
|
|
31271
31345
|
* tool() implementation. Parses arguments passed to overrides defined above.
|
|
31272
31346
|
*/
|
|
31273
|
-
tool(
|
|
31274
|
-
if (this._registeredTools[
|
|
31275
|
-
throw new Error(`Tool ${
|
|
31347
|
+
tool(name, ...rest) {
|
|
31348
|
+
if (this._registeredTools[name]) {
|
|
31349
|
+
throw new Error(`Tool ${name} is already registered`);
|
|
31276
31350
|
}
|
|
31277
31351
|
let description2;
|
|
31278
31352
|
let inputSchema;
|
|
@@ -31293,21 +31367,21 @@ class McpServer {
|
|
|
31293
31367
|
}
|
|
31294
31368
|
}
|
|
31295
31369
|
const callback = rest[0];
|
|
31296
|
-
return this._createRegisteredTool(
|
|
31370
|
+
return this._createRegisteredTool(name, void 0, description2, inputSchema, outputSchema, annotations, { taskSupport: "forbidden" }, void 0, callback);
|
|
31297
31371
|
}
|
|
31298
31372
|
/**
|
|
31299
31373
|
* Registers a tool with a config object and callback.
|
|
31300
31374
|
*/
|
|
31301
|
-
registerTool(
|
|
31302
|
-
if (this._registeredTools[
|
|
31303
|
-
throw new Error(`Tool ${
|
|
31375
|
+
registerTool(name, config2, cb) {
|
|
31376
|
+
if (this._registeredTools[name]) {
|
|
31377
|
+
throw new Error(`Tool ${name} is already registered`);
|
|
31304
31378
|
}
|
|
31305
31379
|
const { title: title2, description: description2, inputSchema, outputSchema, annotations, _meta } = config2;
|
|
31306
|
-
return this._createRegisteredTool(
|
|
31380
|
+
return this._createRegisteredTool(name, title2, description2, inputSchema, outputSchema, annotations, { taskSupport: "forbidden" }, _meta, cb);
|
|
31307
31381
|
}
|
|
31308
|
-
prompt(
|
|
31309
|
-
if (this._registeredPrompts[
|
|
31310
|
-
throw new Error(`Prompt ${
|
|
31382
|
+
prompt(name, ...rest) {
|
|
31383
|
+
if (this._registeredPrompts[name]) {
|
|
31384
|
+
throw new Error(`Prompt ${name} is already registered`);
|
|
31311
31385
|
}
|
|
31312
31386
|
let description2;
|
|
31313
31387
|
if (typeof rest[0] === "string") {
|
|
@@ -31318,7 +31392,7 @@ class McpServer {
|
|
|
31318
31392
|
argsSchema = rest.shift();
|
|
31319
31393
|
}
|
|
31320
31394
|
const cb = rest[0];
|
|
31321
|
-
const registeredPrompt = this._createRegisteredPrompt(
|
|
31395
|
+
const registeredPrompt = this._createRegisteredPrompt(name, void 0, description2, argsSchema, cb);
|
|
31322
31396
|
this.setPromptRequestHandlers();
|
|
31323
31397
|
this.sendPromptListChanged();
|
|
31324
31398
|
return registeredPrompt;
|
|
@@ -31326,12 +31400,12 @@ class McpServer {
|
|
|
31326
31400
|
/**
|
|
31327
31401
|
* Registers a prompt with a config object and callback.
|
|
31328
31402
|
*/
|
|
31329
|
-
registerPrompt(
|
|
31330
|
-
if (this._registeredPrompts[
|
|
31331
|
-
throw new Error(`Prompt ${
|
|
31403
|
+
registerPrompt(name, config2, cb) {
|
|
31404
|
+
if (this._registeredPrompts[name]) {
|
|
31405
|
+
throw new Error(`Prompt ${name} is already registered`);
|
|
31332
31406
|
}
|
|
31333
31407
|
const { title: title2, description: description2, argsSchema } = config2;
|
|
31334
|
-
const registeredPrompt = this._createRegisteredPrompt(
|
|
31408
|
+
const registeredPrompt = this._createRegisteredPrompt(name, title2, description2, argsSchema, cb);
|
|
31335
31409
|
this.setPromptRequestHandlers();
|
|
31336
31410
|
this.sendPromptListChanged();
|
|
31337
31411
|
return registeredPrompt;
|
|
@@ -31437,11 +31511,11 @@ function promptArgumentsFromSchema(schema2) {
|
|
|
31437
31511
|
const shape = getObjectShape(schema2);
|
|
31438
31512
|
if (!shape)
|
|
31439
31513
|
return [];
|
|
31440
|
-
return Object.entries(shape).map(([
|
|
31514
|
+
return Object.entries(shape).map(([name, field]) => {
|
|
31441
31515
|
const description2 = getSchemaDescription(field);
|
|
31442
31516
|
const isOptional = isSchemaOptional(field);
|
|
31443
31517
|
return {
|
|
31444
|
-
name
|
|
31518
|
+
name,
|
|
31445
31519
|
description: description2,
|
|
31446
31520
|
required: !isOptional
|
|
31447
31521
|
};
|
|
@@ -32195,6 +32269,121 @@ function registerSearchTool(server, getLibraryOperations, getConfig) {
|
|
|
32195
32269
|
}
|
|
32196
32270
|
);
|
|
32197
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
|
+
}
|
|
32198
32387
|
function registerAllTools(server, getLibraryOperations, getConfig) {
|
|
32199
32388
|
registerSearchTool(server, getLibraryOperations, getConfig);
|
|
32200
32389
|
registerListTool(server, getLibraryOperations, getConfig);
|
|
@@ -32202,6 +32391,7 @@ function registerAllTools(server, getLibraryOperations, getConfig) {
|
|
|
32202
32391
|
registerCheckTool(server, getLibraryOperations);
|
|
32203
32392
|
registerAddTool(server, getLibraryOperations);
|
|
32204
32393
|
registerRemoveTool(server, getLibraryOperations);
|
|
32394
|
+
registerShowTool(server, getLibraryOperations, getConfig);
|
|
32205
32395
|
registerFulltextAttachTool(server, getLibraryOperations, getConfig);
|
|
32206
32396
|
registerFulltextGetTool(server, getLibraryOperations, getConfig);
|
|
32207
32397
|
registerFulltextDetachTool(server, getLibraryOperations, getConfig);
|
|
@@ -32261,7 +32451,7 @@ async function mcpStart(options) {
|
|
|
32261
32451
|
async function executeRemove(options, context) {
|
|
32262
32452
|
const { identifier, idType = "id", fulltextDirectory, deleteFulltext = false } = options;
|
|
32263
32453
|
if (context.mode === "local" && deleteFulltext && fulltextDirectory) {
|
|
32264
|
-
const { removeReference } = await import("./index-
|
|
32454
|
+
const { removeReference } = await import("./index-CS8S6gE4.js").then((n) => n.A);
|
|
32265
32455
|
return removeReference(context.library, {
|
|
32266
32456
|
identifier,
|
|
32267
32457
|
idType,
|
|
@@ -32316,7 +32506,7 @@ Continue?`;
|
|
|
32316
32506
|
}
|
|
32317
32507
|
async function executeInteractiveRemove(context, config2) {
|
|
32318
32508
|
const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
|
|
32319
|
-
const { selectReferenceItemsOrExit } = await import("./reference-select-
|
|
32509
|
+
const { selectReferenceItemsOrExit } = await import("./reference-select-CNWexQGu.js");
|
|
32320
32510
|
const allReferences = await context.library.getAll();
|
|
32321
32511
|
const selectedItems = await withAlternateScreen2(
|
|
32322
32512
|
() => selectReferenceItemsOrExit(allReferences, { multiSelect: false }, config2.cli.tui)
|
|
@@ -32541,7 +32731,7 @@ async function executeInteractiveSearch(options, context, config2) {
|
|
|
32541
32731
|
validateInteractiveOptions(options);
|
|
32542
32732
|
const { checkTTY } = await import("./tty-BMyaEOhX.js");
|
|
32543
32733
|
const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
|
|
32544
|
-
const { runSearchFlow } = await import("./index-
|
|
32734
|
+
const { runSearchFlow } = await import("./index-BG3Ef4Pd.js");
|
|
32545
32735
|
const { search } = await import("./file-watcher-CWHg1yol.js").then((n) => n.B);
|
|
32546
32736
|
const { tokenize } = await import("./file-watcher-CWHg1yol.js").then((n) => n.A);
|
|
32547
32737
|
checkTTY();
|
|
@@ -32560,7 +32750,7 @@ async function executeInteractiveSearch(options, context, config2) {
|
|
|
32560
32750
|
})
|
|
32561
32751
|
);
|
|
32562
32752
|
if (result.selectedItems && !result.cancelled) {
|
|
32563
|
-
const { isSideEffectAction } = await import("./action-menu-
|
|
32753
|
+
const { isSideEffectAction } = await import("./action-menu-D5s90TfM.js");
|
|
32564
32754
|
if (isSideEffectAction(result.action)) {
|
|
32565
32755
|
await executeSideEffectAction(result.action, result.selectedItems, context, config2);
|
|
32566
32756
|
return { output: "", cancelled: false, action: result.action };
|
|
@@ -32576,7 +32766,7 @@ async function executeSideEffectAction(action, items2, context, config2) {
|
|
|
32576
32766
|
switch (action) {
|
|
32577
32767
|
case "open-url": {
|
|
32578
32768
|
const { resolveDefaultUrl: resolveDefaultUrl2 } = await Promise.resolve().then(() => url);
|
|
32579
|
-
const { openWithSystemApp: openWithSystemApp2 } = await import("./loader-
|
|
32769
|
+
const { openWithSystemApp: openWithSystemApp2 } = await import("./loader-BG2eomDC.js").then((n) => n.j);
|
|
32580
32770
|
const item = items2[0];
|
|
32581
32771
|
if (!item) return;
|
|
32582
32772
|
const url$1 = resolveDefaultUrl2(item);
|
|
@@ -32762,6 +32952,142 @@ async function serverStatus(portfilePath) {
|
|
|
32762
32952
|
}
|
|
32763
32953
|
return result;
|
|
32764
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
|
+
}
|
|
32765
33091
|
function parseSetOption(input) {
|
|
32766
33092
|
const match = input.match(/^([a-zA-Z][a-zA-Z0-9_.]*)([\+\-]?=)(.*)$/);
|
|
32767
33093
|
if (!match) {
|
|
@@ -32971,7 +33297,7 @@ function formatUpdateOutput(result, identifier) {
|
|
|
32971
33297
|
}
|
|
32972
33298
|
async function executeInteractiveUpdate(context, config2) {
|
|
32973
33299
|
const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
|
|
32974
|
-
const { selectReferencesOrExit } = await import("./reference-select-
|
|
33300
|
+
const { selectReferencesOrExit } = await import("./reference-select-CNWexQGu.js");
|
|
32975
33301
|
const allReferences = await context.library.getAll();
|
|
32976
33302
|
const identifiers = await withAlternateScreen2(
|
|
32977
33303
|
() => selectReferencesOrExit(allReferences, { multiSelect: false }, config2.cli.tui)
|
|
@@ -33266,7 +33592,7 @@ function getUrlExitCode(result) {
|
|
|
33266
33592
|
}
|
|
33267
33593
|
async function executeInteractiveSelect(context, config2) {
|
|
33268
33594
|
const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
|
|
33269
|
-
const { selectReferencesOrExit } = await import("./reference-select-
|
|
33595
|
+
const { selectReferencesOrExit } = await import("./reference-select-CNWexQGu.js");
|
|
33270
33596
|
const allReferences = await context.library.getAll();
|
|
33271
33597
|
const identifiers = await withAlternateScreen2(
|
|
33272
33598
|
() => selectReferencesOrExit(allReferences, { multiSelect: false }, config2.cli.tui)
|
|
@@ -33378,7 +33704,7 @@ const ID_COMPLETION_COMMANDS = /* @__PURE__ */ new Set(["cite", "remove", "updat
|
|
|
33378
33704
|
const ID_COMPLETION_FULLTEXT_SUBCOMMANDS = /* @__PURE__ */ new Set(["attach", "get", "detach", "open"]);
|
|
33379
33705
|
const ID_COMPLETION_ATTACH_SUBCOMMANDS = /* @__PURE__ */ new Set(["open", "add", "list", "get", "detach", "sync"]);
|
|
33380
33706
|
function toCompletionItems(values) {
|
|
33381
|
-
return values.map((
|
|
33707
|
+
return values.map((name) => ({ name }));
|
|
33382
33708
|
}
|
|
33383
33709
|
function extractSubcommands(program) {
|
|
33384
33710
|
return program.commands.map((cmd) => ({
|
|
@@ -33407,8 +33733,8 @@ function extractGlobalOptions(program) {
|
|
|
33407
33733
|
options.push({ name: "--version", description: "output the version number" });
|
|
33408
33734
|
return options;
|
|
33409
33735
|
}
|
|
33410
|
-
function findSubcommand(program,
|
|
33411
|
-
return program.commands.find((cmd) => cmd.name() ===
|
|
33736
|
+
function findSubcommand(program, name) {
|
|
33737
|
+
return program.commands.find((cmd) => cmd.name() === name);
|
|
33412
33738
|
}
|
|
33413
33739
|
function parseCommandContext(env) {
|
|
33414
33740
|
const words = env.line.trim().split(/\s+/);
|
|
@@ -33601,6 +33927,54 @@ function registerCompletionCommand(program) {
|
|
|
33601
33927
|
}
|
|
33602
33928
|
});
|
|
33603
33929
|
}
|
|
33930
|
+
function buildConvertHelpText() {
|
|
33931
|
+
const rows = BUILTIN_CONVERTER_NAMES.map((name) => {
|
|
33932
|
+
const info = BUILTIN_CONVERTER_INFO[name];
|
|
33933
|
+
return ` ${name.padEnd(10)}${info.install.padEnd(28)}${info.description}`;
|
|
33934
|
+
});
|
|
33935
|
+
const priority = BUILTIN_CONVERTER_NAMES.join(" > ");
|
|
33936
|
+
return `
|
|
33937
|
+
BUILT-IN CONVERTERS
|
|
33938
|
+
Name Install Notes
|
|
33939
|
+
${rows.join("\n")}
|
|
33940
|
+
|
|
33941
|
+
In auto mode (default), the first available converter is used.
|
|
33942
|
+
Priority: ${priority}
|
|
33943
|
+
|
|
33944
|
+
CUSTOM CONVERTERS
|
|
33945
|
+
Add via config set:
|
|
33946
|
+
ref config set fulltext.converters.my-tool.command "my-tool {input} -o {output}"
|
|
33947
|
+
ref config set fulltext.converters.my-tool.check_command "my-tool --version"
|
|
33948
|
+
|
|
33949
|
+
Or edit config.toml directly (ref config edit):
|
|
33950
|
+
[fulltext.converters.my-tool]
|
|
33951
|
+
command = "my-tool convert {input} -o {output}"
|
|
33952
|
+
check_command = "my-tool --version"
|
|
33953
|
+
|
|
33954
|
+
Template placeholders:
|
|
33955
|
+
{input} Input PDF path
|
|
33956
|
+
{output} Output Markdown path
|
|
33957
|
+
{input_dir} Directory of input file
|
|
33958
|
+
{input_name} Basename of input file
|
|
33959
|
+
{output_name} Basename of output file
|
|
33960
|
+
|
|
33961
|
+
Additional options:
|
|
33962
|
+
output_mode "file" (default) or "stdout"
|
|
33963
|
+
timeout Seconds (default: 300)
|
|
33964
|
+
progress "inherit" (default) or "quiet"
|
|
33965
|
+
|
|
33966
|
+
Use with: ref fulltext convert <ref> --converter my-tool
|
|
33967
|
+
|
|
33968
|
+
CONFIGURATION
|
|
33969
|
+
ref config set fulltext.pdf_converter marker
|
|
33970
|
+
ref config set fulltext.pdf_converter_timeout 600
|
|
33971
|
+
ref config edit # Edit config.toml directly
|
|
33972
|
+
|
|
33973
|
+
EXAMPLES
|
|
33974
|
+
$ ref fulltext convert smith2023
|
|
33975
|
+
$ ref fulltext convert smith2023 --converter marker
|
|
33976
|
+
$ ref fulltext convert smith2023 --from pdf --force`;
|
|
33977
|
+
}
|
|
33604
33978
|
function buildSearchHelpText() {
|
|
33605
33979
|
return `
|
|
33606
33980
|
QUERY SYNTAX
|
|
@@ -33652,6 +34026,7 @@ function createProgram() {
|
|
|
33652
34026
|
}
|
|
33653
34027
|
});
|
|
33654
34028
|
registerListCommand(program);
|
|
34029
|
+
registerShowCommand(program);
|
|
33655
34030
|
registerSearchCommand(program);
|
|
33656
34031
|
registerExportCommand(program);
|
|
33657
34032
|
registerAddCommand(program);
|
|
@@ -33693,6 +34068,12 @@ function registerListCommand(program) {
|
|
|
33693
34068
|
await handleListAction(options, program);
|
|
33694
34069
|
});
|
|
33695
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
|
+
}
|
|
33696
34077
|
async function handleExportAction(ids, options, program) {
|
|
33697
34078
|
try {
|
|
33698
34079
|
const globalOpts = program.opts();
|
|
@@ -33823,7 +34204,7 @@ function shouldAutoFetch(cliFlag, configEnabled) {
|
|
|
33823
34204
|
return configEnabled;
|
|
33824
34205
|
}
|
|
33825
34206
|
async function performAutoFetch(addedItems, context, config2) {
|
|
33826
|
-
const { fulltextFetch: fulltextFetch2 } = await import("./index-
|
|
34207
|
+
const { fulltextFetch: fulltextFetch2 } = await import("./index-CS8S6gE4.js").then((n) => n.z);
|
|
33827
34208
|
const fetchResults = await autoFetchFulltext(addedItems, context, {
|
|
33828
34209
|
fulltextConfig: config2.fulltext,
|
|
33829
34210
|
fulltextDirectory: config2.attachments.directory,
|
|
@@ -34079,7 +34460,7 @@ function registerFulltextCommand(program) {
|
|
|
34079
34460
|
fulltextCmd.command("convert").description("Convert attached fulltext (XML or PDF) to Markdown").argument("[identifier]", "Citation key or UUID (interactive selection if omitted)").option("--uuid", "Interpret identifier as UUID").option("--from <format>", "Input format: xml, pdf (default: auto-detect)").option(
|
|
34080
34461
|
"--converter <name>",
|
|
34081
34462
|
"PDF converter: auto, marker, docling, mineru, pymupdf, or custom name"
|
|
34082
|
-
).option("--force", "Overwrite existing markdown attachment").action(async (identifier, options) => {
|
|
34463
|
+
).option("--force", "Overwrite existing markdown attachment").addHelpText("after", buildConvertHelpText()).action(async (identifier, options) => {
|
|
34083
34464
|
await handleFulltextConvertAction(identifier, options, program.opts());
|
|
34084
34465
|
});
|
|
34085
34466
|
}
|
|
@@ -34118,4 +34499,4 @@ export {
|
|
|
34118
34499
|
restoreStdinAfterInk as r,
|
|
34119
34500
|
syncAttachments as s
|
|
34120
34501
|
};
|
|
34121
|
-
//# sourceMappingURL=index-
|
|
34502
|
+
//# sourceMappingURL=index-DCBYzNj-.js.map
|