@ncukondo/reference-manager 0.13.5 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/chunks/{action-menu-svBJmZdi.js → action-menu-DNlpGiwS.js} +2 -2
  2. package/dist/chunks/{action-menu-svBJmZdi.js.map → action-menu-DNlpGiwS.js.map} +1 -1
  3. package/dist/chunks/{index-CaAOawzv.js → index-UpzsmbyY.js} +27081 -26872
  4. package/dist/chunks/index-UpzsmbyY.js.map +1 -0
  5. package/dist/chunks/reference-select-DSVwE9iu.js +52 -0
  6. package/dist/chunks/reference-select-DSVwE9iu.js.map +1 -0
  7. package/dist/chunks/{search-prompt-Bg9usf8f.js → search-prompt-BrWpOcij.js} +34 -1
  8. package/dist/chunks/{search-prompt-Bg9usf8f.js.map → search-prompt-BrWpOcij.js.map} +1 -1
  9. package/dist/chunks/style-select-CHjDTyq2.js +86 -0
  10. package/dist/chunks/style-select-CHjDTyq2.js.map +1 -0
  11. package/dist/cli/commands/cite.d.ts +5 -1
  12. package/dist/cli/commands/cite.d.ts.map +1 -1
  13. package/dist/cli/commands/edit.d.ts +13 -1
  14. package/dist/cli/commands/edit.d.ts.map +1 -1
  15. package/dist/cli/commands/fulltext.d.ts +54 -1
  16. package/dist/cli/commands/fulltext.d.ts.map +1 -1
  17. package/dist/cli/commands/remove.d.ts +14 -1
  18. package/dist/cli/commands/remove.d.ts.map +1 -1
  19. package/dist/cli/commands/update.d.ts +18 -1
  20. package/dist/cli/commands/update.d.ts.map +1 -1
  21. package/dist/cli/helpers.d.ts +11 -0
  22. package/dist/cli/helpers.d.ts.map +1 -1
  23. package/dist/cli/index.d.ts.map +1 -1
  24. package/dist/cli.js +1 -3
  25. package/dist/cli.js.map +1 -1
  26. package/dist/features/interactive/reference-select.d.ts +79 -0
  27. package/dist/features/interactive/reference-select.d.ts.map +1 -0
  28. package/dist/features/interactive/search-prompt.d.ts.map +1 -1
  29. package/dist/features/interactive/style-select.d.ts +56 -0
  30. package/dist/features/interactive/style-select.d.ts.map +1 -0
  31. package/package.json +1 -1
  32. package/dist/chunks/index-CaAOawzv.js.map +0 -1
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Shared reference selection utility for interactive ID selection.
3
+ *
4
+ * This module provides a reusable function to select references interactively
5
+ * using the existing search prompt infrastructure.
6
+ */
7
+ import type { CslItem } from "../../core/csl-json/types.js";
8
+ import { type SearchPromptConfig } from "./search-prompt.js";
9
+ /**
10
+ * Options for reference selection
11
+ */
12
+ export interface ReferenceSelectOptions {
13
+ /** Whether to allow multiple selection (default: true) */
14
+ multiSelect: boolean;
15
+ /** Custom prompt message */
16
+ prompt?: string;
17
+ /** Initial search query */
18
+ initialQuery?: string;
19
+ }
20
+ /**
21
+ * Result from reference selection
22
+ */
23
+ export interface ReferenceSelectResult {
24
+ /** Selected references */
25
+ selected: CslItem[];
26
+ /** Whether the selection was cancelled */
27
+ cancelled: boolean;
28
+ }
29
+ /**
30
+ * Run interactive reference selection.
31
+ *
32
+ * Launches an interactive search prompt to select references from the library.
33
+ * Supports both single and multiple selection modes.
34
+ *
35
+ * @param allReferences - All references available for selection
36
+ * @param options - Selection options
37
+ * @param config - Interactive prompt configuration
38
+ * @returns Selection result with selected references
39
+ * @throws TTYError if not running in a TTY environment
40
+ */
41
+ export declare function runReferenceSelect(allReferences: CslItem[], options: ReferenceSelectOptions, config: SearchPromptConfig): Promise<ReferenceSelectResult>;
42
+ /**
43
+ * Options for selectReferencesOrExit helper
44
+ */
45
+ export interface SelectReferencesOrExitOptions {
46
+ /** Whether to allow multiple selection */
47
+ multiSelect: boolean;
48
+ /** Initial search query */
49
+ initialQuery?: string;
50
+ }
51
+ /**
52
+ * Select references interactively or exit if cancelled/empty.
53
+ *
54
+ * This is a convenience wrapper around runReferenceSelect that handles
55
+ * common patterns:
56
+ * - Exits with code 0 if library is empty
57
+ * - Exits with code 0 if selection is cancelled
58
+ * - Returns selected identifiers
59
+ *
60
+ * @param allReferences - All references available for selection
61
+ * @param options - Selection options
62
+ * @param config - Interactive prompt configuration
63
+ * @returns Array of selected reference IDs (never empty)
64
+ */
65
+ export declare function selectReferencesOrExit(allReferences: CslItem[], options: SelectReferencesOrExitOptions, config: SearchPromptConfig): Promise<string[]>;
66
+ /**
67
+ * Select reference items interactively or exit if cancelled/empty.
68
+ *
69
+ * Similar to selectReferencesOrExit but returns full CslItem objects
70
+ * instead of just identifiers. Useful when the caller needs access to
71
+ * the full reference data (e.g., for confirmation dialogs).
72
+ *
73
+ * @param allReferences - All references available for selection
74
+ * @param options - Selection options
75
+ * @param config - Interactive prompt configuration
76
+ * @returns Array of selected CslItem objects (never empty)
77
+ */
78
+ export declare function selectReferenceItemsOrExit(allReferences: CslItem[], options: SelectReferencesOrExitOptions, config: SearchPromptConfig): Promise<CslItem[]>;
79
+ //# sourceMappingURL=reference-select.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reference-select.d.ts","sourceRoot":"","sources":["../../../src/features/interactive/reference-select.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAG5D,OAAO,EAAE,KAAK,kBAAkB,EAAmB,MAAM,oBAAoB,CAAC;AAG9E;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,0DAA0D;IAC1D,WAAW,EAAE,OAAO,CAAC;IACrB,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2BAA2B;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,0BAA0B;IAC1B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,0CAA0C;IAC1C,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,kBAAkB,CACtC,aAAa,EAAE,OAAO,EAAE,EACxB,OAAO,EAAE,sBAAsB,EAC/B,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,qBAAqB,CAAC,CA6BhC;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,0CAA0C;IAC1C,WAAW,EAAE,OAAO,CAAC;IACrB,2BAA2B;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,sBAAsB,CAC1C,aAAa,EAAE,OAAO,EAAE,EACxB,OAAO,EAAE,6BAA6B,EACtC,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,MAAM,EAAE,CAAC,CAanB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,0BAA0B,CAC9C,aAAa,EAAE,OAAO,EAAE,EACxB,OAAO,EAAE,6BAA6B,EACtC,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,OAAO,EAAE,CAAC,CAapB"}
@@ -1 +1 @@
1
- {"version":3,"file":"search-prompt.d.ts","sourceRoot":"","sources":["../../../src/features/interactive/search-prompt.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGxD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,YAAY,EAAE,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,0BAA0B;IAC1B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,uCAAuC;IACvC,SAAS,EAAE,OAAO,CAAC;CACpB;AAUD;;GAEG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,YAAY,EAAE,EACvB,aAAa,EAAE,MAAM,GACpB,kBAAkB,EAAE,CAetB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,EAAE,CAiBxE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAOnE;AAoCD;;GAEG;AACH,wBAAsB,eAAe,CACnC,aAAa,EAAE,OAAO,EAAE,EACxB,QAAQ,EAAE,cAAc,EACxB,MAAM,EAAE,kBAAkB,EAC1B,YAAY,SAAK,GAChB,OAAO,CAAC,kBAAkB,CAAC,CAuI7B"}
1
+ {"version":3,"file":"search-prompt.d.ts","sourceRoot":"","sources":["../../../src/features/interactive/search-prompt.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGxD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,YAAY,EAAE,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,0BAA0B;IAC1B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,uCAAuC;IACvC,SAAS,EAAE,OAAO,CAAC;CACpB;AAUD;;GAEG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,YAAY,EAAE,EACvB,aAAa,EAAE,MAAM,GACpB,kBAAkB,EAAE,CAetB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,EAAE,CAiBxE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAOnE;AAoCD;;GAEG;AACH,wBAAsB,eAAe,CACnC,aAAa,EAAE,OAAO,EAAE,EACxB,QAAQ,EAAE,cAAc,EACxB,MAAM,EAAE,kBAAkB,EAC1B,YAAY,SAAK,GAChB,OAAO,CAAC,kBAAkB,CAAC,CAuN7B"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Style selection prompt for citation style selection.
3
+ *
4
+ * Lists built-in styles and custom styles from csl_directory,
5
+ * with the default style shown first.
6
+ */
7
+ /**
8
+ * Options for style selection
9
+ */
10
+ export interface StyleSelectOptions {
11
+ /** Directory or directories containing custom CSL files */
12
+ cslDirectory?: string | string[];
13
+ /** Default style to show first */
14
+ defaultStyle?: string;
15
+ }
16
+ /**
17
+ * Result from style selection
18
+ */
19
+ export interface StyleSelectResult {
20
+ /** Selected style name */
21
+ style?: string;
22
+ /** Whether the selection was cancelled */
23
+ cancelled: boolean;
24
+ }
25
+ /**
26
+ * Choice definition for Enquirer Select prompt
27
+ */
28
+ interface StyleChoice {
29
+ name: string;
30
+ message: string;
31
+ value: string;
32
+ }
33
+ /**
34
+ * List custom CSL style names from the specified directory/directories.
35
+ *
36
+ * @param cslDirectory - Directory or directories to search for CSL files
37
+ * @returns Array of style names (without .csl extension)
38
+ */
39
+ export declare function listCustomStyles(cslDirectory: string | string[] | undefined): string[];
40
+ /**
41
+ * Build style choices for the selection prompt.
42
+ *
43
+ * @param customStyles - Custom style names from csl_directory
44
+ * @param defaultStyle - Default style to show first
45
+ * @returns Array of choices for Enquirer Select prompt
46
+ */
47
+ export declare function buildStyleChoices(customStyles: string[], defaultStyle?: string): StyleChoice[];
48
+ /**
49
+ * Run the style selection prompt.
50
+ *
51
+ * @param options - Style selection options
52
+ * @returns Selection result with style name
53
+ */
54
+ export declare function runStyleSelect(options: StyleSelectOptions): Promise<StyleSelectResult>;
55
+ export {};
56
+ //# sourceMappingURL=style-select.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style-select.d.ts","sourceRoot":"","sources":["../../../src/features/interactive/style-select.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,2DAA2D;IAC3D,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACjC,kCAAkC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAaD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,GAAG,MAAM,EAAE,CA4BtF;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,YAAY,SAAQ,GAAG,WAAW,EAAE,CA8B7F;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAoC5F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ncukondo/reference-manager",
3
- "version": "0.13.5",
3
+ "version": "0.14.0",
4
4
  "description": "A local reference management tool using CSL-JSON as the single source of truth",
5
5
  "publishConfig": {
6
6
  "access": "public"