@ncukondo/reference-manager 0.12.3 → 0.13.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/README.md +20 -7
- package/dist/chunks/{action-menu-wjKl5_b6.js → action-menu-DD9kw_5I.js} +2 -2
- package/dist/chunks/{action-menu-wjKl5_b6.js.map → action-menu-DD9kw_5I.js.map} +1 -1
- package/dist/chunks/{index-uiCqx7-V.js → index-C05AB3Wl.js} +4 -4
- package/dist/chunks/{index-uiCqx7-V.js.map → index-C05AB3Wl.js.map} +1 -1
- package/dist/chunks/{loader-DVmjpU4U.js → loader-CNLxbxqt.js} +69 -9
- package/dist/chunks/loader-CNLxbxqt.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/config/defaults.d.ts +5 -5
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/paths.d.ts +19 -0
- package/dist/config/paths.d.ts.map +1 -0
- package/dist/index.js +1 -1
- package/package.json +2 -1
- package/dist/chunks/loader-DVmjpU4U.js.map +0 -1
package/README.md
CHANGED
|
@@ -149,11 +149,7 @@ Download the `.mcpb` file from the [latest release](https://github.com/ncukondo/
|
|
|
149
149
|
3. Click **Install from file** and select the downloaded `.mcpb` file
|
|
150
150
|
4. Configure the **Config File Path** when prompted (e.g., `~/.reference-manager/config.toml`)
|
|
151
151
|
|
|
152
|
-
The config file
|
|
153
|
-
|
|
154
|
-
```toml
|
|
155
|
-
library = "~/.reference-manager/csl.library.json"
|
|
156
|
-
```
|
|
152
|
+
The config file is located at the platform-specific configuration directory (e.g., `~/.config/reference-manager/config.toml` on Linux).
|
|
157
153
|
|
|
158
154
|
#### Option 2: Manual Configuration
|
|
159
155
|
|
|
@@ -452,10 +448,26 @@ Sort field aliases: `pub`→`published`, `mod`→`updated`, `add`→`created`, `
|
|
|
452
448
|
|
|
453
449
|
## Configuration
|
|
454
450
|
|
|
455
|
-
Configuration
|
|
451
|
+
Configuration files follow platform conventions:
|
|
452
|
+
|
|
453
|
+
| Platform | Location |
|
|
454
|
+
|----------|----------|
|
|
455
|
+
| Linux | `~/.config/reference-manager/config.toml` |
|
|
456
|
+
| macOS | `~/Library/Preferences/reference-manager/config.toml` |
|
|
457
|
+
| Windows | `%APPDATA%\reference-manager\Config\config.toml` |
|
|
458
|
+
|
|
459
|
+
Default paths for data (library, fulltext, CSL styles):
|
|
460
|
+
|
|
461
|
+
| Platform | Location |
|
|
462
|
+
|----------|----------|
|
|
463
|
+
| Linux | `~/.local/share/reference-manager/` |
|
|
464
|
+
| macOS | `~/Library/Application Support/reference-manager/` |
|
|
465
|
+
| Windows | `%LOCALAPPDATA%\reference-manager\Data\` |
|
|
466
|
+
|
|
467
|
+
You can also use project-local configuration by creating `.reference-manager.config.toml` in any directory.
|
|
456
468
|
|
|
457
469
|
```toml
|
|
458
|
-
#
|
|
470
|
+
# Override library path (defaults to {data}/library.json)
|
|
459
471
|
library = "~/references.json"
|
|
460
472
|
|
|
461
473
|
# Logging level: silent, info, debug
|
|
@@ -466,6 +478,7 @@ max_generations = 50
|
|
|
466
478
|
max_age_days = 365
|
|
467
479
|
|
|
468
480
|
[fulltext]
|
|
481
|
+
# Override fulltext directory (defaults to {data}/fulltext)
|
|
469
482
|
directory = "~/references/fulltext"
|
|
470
483
|
|
|
471
484
|
[server]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as formatBibtex } from "./index-
|
|
1
|
+
import { f as formatBibtex } from "./index-C05AB3Wl.js";
|
|
2
2
|
import { f as formatBibliographyCSL } from "./index-vL26PhAf.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-DD9kw_5I.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-menu-
|
|
1
|
+
{"version":3,"file":"action-menu-DD9kw_5I.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,CAA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AM,YAAY,IAAK;AACpE,aAAO;AAAA,QACL,WAAW;AAAA,MAAA;AAAA,IAEf;AACA,UAAM;AAAA,EACR;AACF;AAQA,eAAsB,cAAc,OAA6C;AAG/E,QAAM,WAAW,MAAM,OAAO,UAAU;AACxC,QAAM,SAAU,SAAS,QAA+C;AAIxE,QAAM,QAAQ,MAAM;AACpB,QAAM,UAAU,UAAU,IAAI,cAAc;AAC5C,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;"}
|
|
@@ -10,13 +10,13 @@ import { join, extname } from "node:path";
|
|
|
10
10
|
import { spawnSync, spawn } from "node:child_process";
|
|
11
11
|
import { mkdir, unlink, rename, copyFile, rm, readFile } from "node:fs/promises";
|
|
12
12
|
import { u as updateReference, B as BUILTIN_STYLES, s as startServerWithFileWatcher, g as getFulltextAttachmentTypes } from "./index-vL26PhAf.js";
|
|
13
|
-
import { o as openWithSystemApp, l as loadConfig } from "./loader-
|
|
13
|
+
import { o as openWithSystemApp, l as loadConfig } from "./loader-CNLxbxqt.js";
|
|
14
14
|
import "@citation-js/core";
|
|
15
15
|
import "@citation-js/plugin-csl";
|
|
16
16
|
import process$1, { stdin, stdout } from "node:process";
|
|
17
17
|
import { serve } from "@hono/node-server";
|
|
18
18
|
const name = "@ncukondo/reference-manager";
|
|
19
|
-
const version$1 = "0.
|
|
19
|
+
const version$1 = "0.13.0";
|
|
20
20
|
const description$1 = "A local reference management tool using CSL-JSON as the single source of truth";
|
|
21
21
|
const packageJson = {
|
|
22
22
|
name,
|
|
@@ -27996,7 +27996,7 @@ async function executeInteractiveSearch(options, context, config2) {
|
|
|
27996
27996
|
validateInteractiveOptions(options);
|
|
27997
27997
|
const { checkTTY } = await import("./tty-CDBIQraQ.js");
|
|
27998
27998
|
const { runSearchPrompt } = await import("./search-prompt-RtHDJFgL.js");
|
|
27999
|
-
const { runActionMenu } = await import("./action-menu-
|
|
27999
|
+
const { runActionMenu } = await import("./action-menu-DD9kw_5I.js");
|
|
28000
28000
|
const { search } = await import("./file-watcher-BhIAeC21.js").then((n) => n.y);
|
|
28001
28001
|
const { tokenize } = await import("./file-watcher-BhIAeC21.js").then((n) => n.x);
|
|
28002
28002
|
checkTTY();
|
|
@@ -29528,4 +29528,4 @@ export {
|
|
|
29528
29528
|
formatBibtex as f,
|
|
29529
29529
|
main as m
|
|
29530
29530
|
};
|
|
29531
|
-
//# sourceMappingURL=index-
|
|
29531
|
+
//# sourceMappingURL=index-C05AB3Wl.js.map
|