@ncukondo/reference-manager 0.15.1 → 0.15.2
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/{action-menu-DwCcc6Gt.js → action-menu-CLBXtpmg.js} +2 -2
- package/dist/chunks/{action-menu-DwCcc6Gt.js.map → action-menu-CLBXtpmg.js.map} +1 -1
- package/dist/chunks/{index-B4RmLBI1.js → index-BIFsFHVj.js} +12 -9
- package/dist/chunks/index-BIFsFHVj.js.map +1 -0
- package/dist/chunks/{index-DEd6F5Rr.js → index-C30Ouuee.js} +2 -2
- package/dist/chunks/index-C30Ouuee.js.map +1 -0
- package/dist/cli/commands/attach.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/index-B4RmLBI1.js.map +0 -1
- package/dist/chunks/index-DEd6F5Rr.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as formatBibtex } from "./index-
|
|
1
|
+
import { f as formatBibtex } from "./index-BIFsFHVj.js";
|
|
2
2
|
import { f as formatBibliographyCSL } from "./index-DHgeuWGP.js";
|
|
3
3
|
const ACTION_CHOICES = [
|
|
4
4
|
{ name: "output-ids", message: "Output IDs (citation keys)", value: "output-ids" },
|
|
@@ -116,4 +116,4 @@ export {
|
|
|
116
116
|
runActionMenu,
|
|
117
117
|
runStyleSelectPrompt
|
|
118
118
|
};
|
|
119
|
-
//# sourceMappingURL=action-menu-
|
|
119
|
+
//# sourceMappingURL=action-menu-CLBXtpmg.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-menu-
|
|
1
|
+
{"version":3,"file":"action-menu-CLBXtpmg.js","sources":["../../src/features/interactive/action-menu.ts"],"sourcesContent":["/**\n * Action menu for interactive search mode.\n * Allows users to perform actions on selected references.\n */\n\nimport type { CslItem } from \"../../core/csl-json/types.js\";\nimport { formatBibliographyCSL, formatBibtex } from \"../format/index.js\";\n\n/**\n * Action types available in the action menu.\n */\nexport type ActionType =\n | \"output-ids\"\n | \"output-csl-json\"\n | \"output-bibtex\"\n | \"cite-apa\"\n | \"cite-choose\"\n | \"cancel\";\n\n/**\n * Result from action menu selection.\n */\nexport interface ActionMenuResult {\n /** Selected action type */\n action: ActionType;\n /** Generated output (empty for cancel) */\n output: string;\n /** Whether the prompt was cancelled */\n cancelled: boolean;\n}\n\n/**\n * Result from style selection prompt.\n */\nexport interface StyleSelectResult {\n /** Selected style (undefined if cancelled) */\n style?: string;\n /** Whether the prompt was cancelled */\n cancelled: boolean;\n}\n\n/**\n * Choice definition for Enquirer Select prompt.\n */\ninterface SelectChoice {\n name: string;\n message: string;\n value: ActionType | string;\n}\n\n/**\n * Available action choices for the action menu.\n */\nexport const ACTION_CHOICES: SelectChoice[] = [\n { name: \"output-ids\", message: \"Output IDs (citation keys)\", value: \"output-ids\" },\n { name: \"output-csl-json\", message: \"Output as CSL-JSON\", value: \"output-csl-json\" },\n { name: \"output-bibtex\", message: \"Output as BibTeX\", value: \"output-bibtex\" },\n { name: \"cite-apa\", message: \"Generate citation (APA)\", value: \"cite-apa\" },\n { name: \"cite-choose\", message: \"Generate citation (choose style)\", value: \"cite-choose\" },\n { name: \"cancel\", message: \"Cancel\", value: \"cancel\" },\n];\n\n/**\n * Available style choices for citation style selection.\n * Uses BUILTIN_STYLES from config/csl-styles.ts\n */\nexport const STYLE_CHOICES: SelectChoice[] = [\n { name: \"apa\", message: \"APA\", value: \"apa\" },\n { name: \"vancouver\", message: \"Vancouver\", value: \"vancouver\" },\n { name: \"harvard\", message: \"Harvard\", value: \"harvard\" },\n];\n\n/**\n * Run the style selection prompt.\n */\n\n/**\n * Generate output for the given action and items.\n */\nfunction generateOutput(action: ActionType, items: CslItem[], style = \"apa\"): string {\n switch (action) {\n case \"output-ids\":\n return items.map((item) => item.id).join(\"\\n\");\n\n case \"output-csl-json\":\n return JSON.stringify(items, null, 2);\n\n case \"output-bibtex\":\n return formatBibtex(items);\n\n case \"cite-apa\":\n return formatBibliographyCSL(items, { style: \"apa\" });\n\n case \"cite-choose\":\n return formatBibliographyCSL(items, { style });\n\n case \"cancel\":\n return \"\";\n\n default:\n return \"\";\n }\n}\n\n/**\n * Process the selected action and generate result.\n */\nasync function processAction(action: ActionType, items: CslItem[]): Promise<ActionMenuResult> {\n // Handle cite-choose: prompt for style first\n if (action === \"cite-choose\") {\n const styleResult = await runStyleSelectPrompt();\n if (styleResult.cancelled) {\n return {\n action: \"cancel\",\n output: \"\",\n cancelled: true,\n };\n }\n return {\n action,\n output: generateOutput(action, items, styleResult.style),\n cancelled: false,\n };\n }\n\n // Handle cancel\n if (action === \"cancel\") {\n return {\n action,\n output: \"\",\n cancelled: true,\n };\n }\n\n // Handle other actions\n return {\n action,\n output: generateOutput(action, items),\n cancelled: false,\n };\n}\n\nexport async function runStyleSelectPrompt(): Promise<StyleSelectResult> {\n // Dynamic import to allow mocking in tests\n // enquirer is a CommonJS module, so we must use default import\n const enquirer = await import(\"enquirer\");\n const Select = (enquirer.default as unknown as Record<string, unknown>).Select as new (\n options: Record<string, unknown>\n ) => { run(): Promise<string> };\n\n const promptOptions = {\n name: \"style\",\n message: \"Select citation style:\",\n choices: STYLE_CHOICES,\n };\n\n try {\n const prompt = new Select(promptOptions);\n const result = (await prompt.run()) as string;\n\n return {\n style: result,\n cancelled: false,\n };\n } catch (error) {\n // Enquirer throws an empty string when cancelled\n if (error === \"\" || (error instanceof Error && error.message === \"\")) {\n return {\n cancelled: true,\n };\n }\n throw error;\n }\n}\n\n/**\n * Run the action menu for selected references.\n *\n * @param items - Selected references\n * @returns Action result with output\n */\nexport async function runActionMenu(items: CslItem[]): Promise<ActionMenuResult> {\n // Dynamic import to allow mocking in tests\n // enquirer is a CommonJS module, so we must use default import\n const enquirer = await import(\"enquirer\");\n const Select = (enquirer.default as unknown as Record<string, unknown>).Select as new (\n options: Record<string, unknown>\n ) => { run(): Promise<string> };\n\n const count = items.length;\n const refWord = count === 1 ? \"reference\" : \"references\";\n const message = `Action for ${count} selected ${refWord}:`;\n\n const promptOptions = {\n name: \"action\",\n message,\n choices: ACTION_CHOICES,\n };\n\n try {\n const prompt = new Select(promptOptions);\n const action = (await prompt.run()) as ActionType;\n\n return processAction(action, items);\n } catch (error) {\n // Enquirer throws an empty string when cancelled\n if (error === \"\" || (error instanceof Error && error.message === \"\")) {\n return {\n action: \"cancel\",\n output: \"\",\n cancelled: true,\n };\n }\n throw error;\n }\n}\n"],"names":[],"mappings":";;AAqDO,MAAM,iBAAiC;AAAA,EAC5C,EAAE,MAAM,cAAc,SAAS,8BAA8B,OAAO,aAAA;AAAA,EACpE,EAAE,MAAM,mBAAmB,SAAS,sBAAsB,OAAO,kBAAA;AAAA,EACjE,EAAE,MAAM,iBAAiB,SAAS,oBAAoB,OAAO,gBAAA;AAAA,EAC7D,EAAE,MAAM,YAAY,SAAS,2BAA2B,OAAO,WAAA;AAAA,EAC/D,EAAE,MAAM,eAAe,SAAS,oCAAoC,OAAO,cAAA;AAAA,EAC3E,EAAE,MAAM,UAAU,SAAS,UAAU,OAAO,SAAA;AAC9C;AAMO,MAAM,gBAAgC;AAAA,EAC3C,EAAE,MAAM,OAAO,SAAS,OAAO,OAAO,MAAA;AAAA,EACtC,EAAE,MAAM,aAAa,SAAS,aAAa,OAAO,YAAA;AAAA,EAClD,EAAE,MAAM,WAAW,SAAS,WAAW,OAAO,UAAA;AAChD;AASA,SAAS,eAAe,QAAoB,OAAkB,QAAQ,OAAe;AACnF,UAAQ,QAAA;AAAA,IACN,KAAK;AACH,aAAO,MAAM,IAAI,CAAC,SAAS,KAAK,EAAE,EAAE,KAAK,IAAI;AAAA,IAE/C,KAAK;AACH,aAAO,KAAK,UAAU,OAAO,MAAM,CAAC;AAAA,IAEtC,KAAK;AACH,aAAO,aAAa,KAAK;AAAA,IAE3B,KAAK;AACH,aAAO,sBAAsB,OAAO,EAAE,OAAO,OAAO;AAAA,IAEtD,KAAK;AACH,aAAO,sBAAsB,OAAO,EAAE,OA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5C,QAAM,UAAU,cAAc,KAAK,aAAa,OAAO;AAEvD,QAAM,gBAAgB;AAAA,IACpB,MAAM;AAAA,IACN;AAAA,IACA,SAAS;AAAA,EAAA;AAGX,MAAI;AACF,UAAM,SAAS,IAAI,OAAO,aAAa;AACvC,UAAM,SAAU,MAAM,OAAO,IAAA;AAE7B,WAAO,cAAc,QAAQ,KAAK;AAAA,EACpC,SAAS,OAAO;AAEd,QAAI,UAAU,MAAO,iBAAiB,SAAS,MAAM,YAAY,IAAK;AACpE,aAAO;AAAA,QACL,QAAQ;AAAA,QACR,QAAQ;AAAA,QACR,WAAW;AAAA,MAAA;AAAA,IAEf;AACA,UAAM;AAAA,EACR;AACF;"}
|
|
@@ -17,7 +17,7 @@ import "@citation-js/plugin-csl";
|
|
|
17
17
|
import { ZodOptional as ZodOptional$2, z } from "zod";
|
|
18
18
|
import { serve } from "@hono/node-server";
|
|
19
19
|
const name = "@ncukondo/reference-manager";
|
|
20
|
-
const version$1 = "0.15.
|
|
20
|
+
const version$1 = "0.15.2";
|
|
21
21
|
const description$1 = "A local reference management tool using CSL-JSON as the single source of truth";
|
|
22
22
|
const packageJson = {
|
|
23
23
|
name,
|
|
@@ -903,27 +903,27 @@ class OperationsLibrary {
|
|
|
903
903
|
}
|
|
904
904
|
// Attachment operations
|
|
905
905
|
async attachAdd(options) {
|
|
906
|
-
const { addAttachment: addAttachment2 } = await import("./index-
|
|
906
|
+
const { addAttachment: addAttachment2 } = await import("./index-C30Ouuee.js");
|
|
907
907
|
return addAttachment2(this.library, options);
|
|
908
908
|
}
|
|
909
909
|
async attachList(options) {
|
|
910
|
-
const { listAttachments: listAttachments2 } = await import("./index-
|
|
910
|
+
const { listAttachments: listAttachments2 } = await import("./index-C30Ouuee.js");
|
|
911
911
|
return listAttachments2(this.library, options);
|
|
912
912
|
}
|
|
913
913
|
async attachGet(options) {
|
|
914
|
-
const { getAttachment: getAttachment2 } = await import("./index-
|
|
914
|
+
const { getAttachment: getAttachment2 } = await import("./index-C30Ouuee.js");
|
|
915
915
|
return getAttachment2(this.library, options);
|
|
916
916
|
}
|
|
917
917
|
async attachDetach(options) {
|
|
918
|
-
const { detachAttachment: detachAttachment2 } = await import("./index-
|
|
918
|
+
const { detachAttachment: detachAttachment2 } = await import("./index-C30Ouuee.js");
|
|
919
919
|
return detachAttachment2(this.library, options);
|
|
920
920
|
}
|
|
921
921
|
async attachSync(options) {
|
|
922
|
-
const { syncAttachments: syncAttachments2 } = await import("./index-
|
|
922
|
+
const { syncAttachments: syncAttachments2 } = await import("./index-C30Ouuee.js");
|
|
923
923
|
return syncAttachments2(this.library, options);
|
|
924
924
|
}
|
|
925
925
|
async attachOpen(options) {
|
|
926
|
-
const { openAttachment: openAttachment2 } = await import("./index-
|
|
926
|
+
const { openAttachment: openAttachment2 } = await import("./index-C30Ouuee.js");
|
|
927
927
|
return openAttachment2(this.library, options);
|
|
928
928
|
}
|
|
929
929
|
}
|
|
@@ -1627,6 +1627,9 @@ async function waitForEnter() {
|
|
|
1627
1627
|
process.stderr.write("Press Enter when done editing...");
|
|
1628
1628
|
process.stdin.setRawMode(true);
|
|
1629
1629
|
process.stdin.resume();
|
|
1630
|
+
if (typeof process.stdin.ref === "function") {
|
|
1631
|
+
process.stdin.ref();
|
|
1632
|
+
}
|
|
1630
1633
|
process.stdin.once("data", () => {
|
|
1631
1634
|
process.stdin.setRawMode(false);
|
|
1632
1635
|
process.stdin.pause();
|
|
@@ -30706,7 +30709,7 @@ async function executeInteractiveSearch(options, context, config2) {
|
|
|
30706
30709
|
validateInteractiveOptions(options);
|
|
30707
30710
|
const { checkTTY } = await import("./tty-BMyaEOhX.js");
|
|
30708
30711
|
const { runSearchPrompt } = await import("./search-prompt-BrWpOcij.js");
|
|
30709
|
-
const { runActionMenu } = await import("./action-menu-
|
|
30712
|
+
const { runActionMenu } = await import("./action-menu-CLBXtpmg.js");
|
|
30710
30713
|
const { search } = await import("./file-watcher-B_WpVHSV.js").then((n) => n.y);
|
|
30711
30714
|
const { tokenize } = await import("./file-watcher-B_WpVHSV.js").then((n) => n.x);
|
|
30712
30715
|
checkTTY();
|
|
@@ -31782,4 +31785,4 @@ export {
|
|
|
31782
31785
|
openAttachment as o,
|
|
31783
31786
|
syncAttachments as s
|
|
31784
31787
|
};
|
|
31785
|
-
//# sourceMappingURL=index-
|
|
31788
|
+
//# sourceMappingURL=index-BIFsFHVj.js.map
|