@ncukondo/reference-manager 0.22.0 → 0.22.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.
Files changed (39) hide show
  1. package/dist/chunks/{action-menu-B1DCdkkp.js → action-menu-R-QKMCZJ.js} +3 -3
  2. package/dist/chunks/{action-menu-B1DCdkkp.js.map → action-menu-R-QKMCZJ.js.map} +1 -1
  3. package/dist/chunks/{file-watcher-CrsNHUpz.js → file-watcher-Dyns9dxx.js} +30 -22
  4. package/dist/chunks/file-watcher-Dyns9dxx.js.map +1 -0
  5. package/dist/chunks/{format-CfTZqhUx.js → format-uBMjeVAZ.js} +23 -8
  6. package/dist/chunks/format-uBMjeVAZ.js.map +1 -0
  7. package/dist/chunks/{index-BvIfOciH.js → index-B7NyGOm6.js} +13 -6
  8. package/dist/chunks/index-B7NyGOm6.js.map +1 -0
  9. package/dist/chunks/{index-D7eiOplw.js → index-CXZ_Trjb.js} +3 -3
  10. package/dist/chunks/index-CXZ_Trjb.js.map +1 -0
  11. package/dist/chunks/{index-BK3hTiKR.js → index-DFhoO9RA.js} +2 -2
  12. package/dist/chunks/{index-BK3hTiKR.js.map → index-DFhoO9RA.js.map} +1 -1
  13. package/dist/chunks/{index-DOvEusHb.js → index-DxjW_BKA.js} +37 -41
  14. package/dist/chunks/index-DxjW_BKA.js.map +1 -0
  15. package/dist/chunks/{loader-BHvcats5.js → loader-BZgpKsTG.js} +2 -2
  16. package/dist/chunks/{loader-BHvcats5.js.map → loader-BZgpKsTG.js.map} +1 -1
  17. package/dist/chunks/{reference-select-DTqhevya.js → reference-select-Cpq_Q4f6.js} +4 -4
  18. package/dist/chunks/{reference-select-DTqhevya.js.map → reference-select-Cpq_Q4f6.js.map} +1 -1
  19. package/dist/chunks/{style-select-CXclvgJO.js → style-select-CQIqnmWS.js} +3 -3
  20. package/dist/chunks/{style-select-CXclvgJO.js.map → style-select-CQIqnmWS.js.map} +1 -1
  21. package/dist/cli.js +2 -2
  22. package/dist/config/toml-writer.d.ts.map +1 -1
  23. package/dist/core/csl-json/serializer.d.ts.map +1 -1
  24. package/dist/features/interactive/apps/SearchFlowApp.d.ts +3 -1
  25. package/dist/features/interactive/apps/SearchFlowApp.d.ts.map +1 -1
  26. package/dist/features/interactive/apps/runSearchFlow.d.ts +1 -1
  27. package/dist/features/interactive/apps/runSearchFlow.d.ts.map +1 -1
  28. package/dist/features/interactive/components/SearchableMultiSelect.d.ts +3 -1
  29. package/dist/features/interactive/components/SearchableMultiSelect.d.ts.map +1 -1
  30. package/dist/index.js +16 -24
  31. package/dist/index.js.map +1 -1
  32. package/dist/server/portfile.d.ts.map +1 -1
  33. package/dist/server.js +2 -2
  34. package/package.json +1 -1
  35. package/dist/chunks/file-watcher-CrsNHUpz.js.map +0 -1
  36. package/dist/chunks/format-CfTZqhUx.js.map +0 -1
  37. package/dist/chunks/index-BvIfOciH.js.map +0 -1
  38. package/dist/chunks/index-D7eiOplw.js.map +0 -1
  39. package/dist/chunks/index-DOvEusHb.js.map +0 -1
@@ -1,13 +1,13 @@
1
1
  import { Command } from "commander";
2
- import { i as isEqual, M as MANAGED_CUSTOM_FIELDS, L as Library, g as CslItemSchema, p as pickDefined, a as sortOrderSchema, x as paginationOptionsSchema, F as FileWatcher, b as sortFieldSchema, v as searchSortFieldSchema } from "./file-watcher-CrsNHUpz.js";
2
+ 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-Dyns9dxx.js";
3
3
  import * as fs from "node:fs";
4
- import { promises, readFileSync, existsSync, writeFileSync, mkdirSync } from "node:fs";
4
+ import { promises, readFileSync, existsSync, mkdirSync, writeFileSync } from "node:fs";
5
5
  import * as os from "node:os";
6
6
  import * as path from "node:path";
7
7
  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, g as generateFilename, b as findFulltextFiles, c as findFulltextFile, h as extensionToFormat, j as fulltextAttach, k as fulltextGet, l as fulltextDiscover, m as fulltextFetch, o as fulltextConvert, q as getExtension, B as BUILTIN_STYLES, r as getFulltextAttachmentTypes, s as startServerWithFileWatcher } from "./index-BK3hTiKR.js";
9
- import { readFile, unlink, stat, readdir, rename, mkdir } from "node:fs/promises";
10
- import { o as openWithSystemApp, l as loadConfig, e as getDefaultCurrentDirConfigFilename, h as getDefaultUserConfigPath } from "./loader-BHvcats5.js";
8
+ import { n as normalizePathForOutput, d as deleteDirectoryIfEmpty, p as parseFilename, i as isReservedRole, e as ensureDirectory, a as addAttachment, R as RESERVED_ROLES, g as generateFilename, b as findFulltextFiles, c as findFulltextFile, h as extensionToFormat, j as fulltextAttach, k as fulltextGet, l as fulltextDiscover, m as fulltextFetch, o as fulltextConvert, q as getExtension, B as BUILTIN_STYLES, r as getFulltextAttachmentTypes, s as startServerWithFileWatcher } from "./index-DFhoO9RA.js";
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-BZgpKsTG.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";
@@ -19,7 +19,7 @@ import "@citation-js/plugin-csl";
19
19
  import { ZodOptional as ZodOptional$2, z } from "zod";
20
20
  import { serve } from "@hono/node-server";
21
21
  const name = "@ncukondo/reference-manager";
22
- const version$1 = "0.22.0";
22
+ const version$1 = "0.22.2";
23
23
  const description$1 = "A local reference management tool using CSL-JSON as the single source of truth";
24
24
  const packageJson = {
25
25
  name,
@@ -289,14 +289,12 @@ function getPortfilePath() {
289
289
  return path.join(tmpDir, "reference-manager", "server.port");
290
290
  }
291
291
  async function writePortfile(portfilePath, port, pid, library, started_at) {
292
- const dir = path.dirname(portfilePath);
293
- await promises.mkdir(dir, { recursive: true });
294
292
  const data = { port, pid, library };
295
293
  if (started_at !== void 0) {
296
294
  data.started_at = started_at;
297
295
  }
298
296
  const content = JSON.stringify(data, null, 2);
299
- await promises.writeFile(portfilePath, content, "utf-8");
297
+ await writeFileAtomic(portfilePath, content);
300
298
  }
301
299
  async function readPortfile(portfilePath) {
302
300
  try {
@@ -904,15 +902,15 @@ class OperationsLibrary {
904
902
  }
905
903
  // High-level operations
906
904
  async search(options) {
907
- const { searchReferences } = await import("./index-BK3hTiKR.js").then((n) => n.z);
905
+ const { searchReferences } = await import("./index-DFhoO9RA.js").then((n) => n.z);
908
906
  return searchReferences(this.library, options);
909
907
  }
910
908
  async list(options) {
911
- const { listReferences } = await import("./index-BK3hTiKR.js").then((n) => n.y);
909
+ const { listReferences } = await import("./index-DFhoO9RA.js").then((n) => n.y);
912
910
  return listReferences(this.library, options ?? {});
913
911
  }
914
912
  async cite(options) {
915
- const { citeReferences } = await import("./index-BK3hTiKR.js").then((n) => n.x);
913
+ const { citeReferences } = await import("./index-DFhoO9RA.js").then((n) => n.x);
916
914
  const defaultStyle = options.defaultStyle ?? this.citationConfig?.defaultStyle;
917
915
  const cslDirectory = options.cslDirectory ?? this.citationConfig?.cslDirectory;
918
916
  const mergedOptions = {
@@ -923,32 +921,32 @@ class OperationsLibrary {
923
921
  return citeReferences(this.library, mergedOptions);
924
922
  }
925
923
  async import(inputs, options) {
926
- const { addReferences } = await import("./index-BK3hTiKR.js").then((n) => n.w);
924
+ const { addReferences } = await import("./index-DFhoO9RA.js").then((n) => n.w);
927
925
  return addReferences(inputs, this.library, options ?? {});
928
926
  }
929
927
  // Attachment operations
930
928
  async attachAdd(options) {
931
- const { addAttachment: addAttachment2 } = await import("./index-D7eiOplw.js");
929
+ const { addAttachment: addAttachment2 } = await import("./index-CXZ_Trjb.js");
932
930
  return addAttachment2(this.library, options);
933
931
  }
934
932
  async attachList(options) {
935
- const { listAttachments: listAttachments2 } = await import("./index-D7eiOplw.js");
933
+ const { listAttachments: listAttachments2 } = await import("./index-CXZ_Trjb.js");
936
934
  return listAttachments2(this.library, options);
937
935
  }
938
936
  async attachGet(options) {
939
- const { getAttachment: getAttachment2 } = await import("./index-D7eiOplw.js");
937
+ const { getAttachment: getAttachment2 } = await import("./index-CXZ_Trjb.js");
940
938
  return getAttachment2(this.library, options);
941
939
  }
942
940
  async attachDetach(options) {
943
- const { detachAttachment: detachAttachment2 } = await import("./index-D7eiOplw.js");
941
+ const { detachAttachment: detachAttachment2 } = await import("./index-CXZ_Trjb.js");
944
942
  return detachAttachment2(this.library, options);
945
943
  }
946
944
  async attachSync(options) {
947
- const { syncAttachments: syncAttachments2 } = await import("./index-D7eiOplw.js");
945
+ const { syncAttachments: syncAttachments2 } = await import("./index-CXZ_Trjb.js");
948
946
  return syncAttachments2(this.library, options);
949
947
  }
950
948
  async attachOpen(options) {
951
- const { openAttachment: openAttachment2 } = await import("./index-D7eiOplw.js");
949
+ const { openAttachment: openAttachment2 } = await import("./index-CXZ_Trjb.js");
952
950
  return openAttachment2(this.library, options);
953
951
  }
954
952
  }
@@ -1792,7 +1790,7 @@ function getAttachExitCode(result) {
1792
1790
  }
1793
1791
  async function executeInteractiveSelect$2(context, config2) {
1794
1792
  const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
1795
- const { selectReferencesOrExit } = await import("./reference-select-DTqhevya.js");
1793
+ const { selectReferencesOrExit } = await import("./reference-select-Cpq_Q4f6.js");
1796
1794
  const allReferences = await context.library.getAll();
1797
1795
  const identifiers = await withAlternateScreen2(
1798
1796
  () => selectReferencesOrExit(allReferences, { multiSelect: false }, config2.cli.tui)
@@ -2340,10 +2338,10 @@ function getCiteExitCode(result) {
2340
2338
  }
2341
2339
  async function executeInteractiveCite(options, context, config2) {
2342
2340
  const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
2343
- const { runCiteFlow } = await import("./index-BvIfOciH.js");
2344
- const { buildStyleChoices, listCustomStyles } = await import("./style-select-CXclvgJO.js");
2345
- const { search } = await import("./file-watcher-CrsNHUpz.js").then((n) => n.z);
2346
- const { tokenize } = await import("./file-watcher-CrsNHUpz.js").then((n) => n.y);
2341
+ const { runCiteFlow } = await import("./index-B7NyGOm6.js");
2342
+ const { buildStyleChoices, listCustomStyles } = await import("./style-select-CQIqnmWS.js");
2343
+ const { search } = await import("./file-watcher-Dyns9dxx.js").then((n) => n.B);
2344
+ const { tokenize } = await import("./file-watcher-Dyns9dxx.js").then((n) => n.A);
2347
2345
  const { checkTTY } = await import("./tty-BMyaEOhX.js");
2348
2346
  checkTTY();
2349
2347
  const allReferences = await context.library.getAll();
@@ -2912,13 +2910,11 @@ function loadExistingTOML(filePath) {
2912
2910
  }
2913
2911
  }
2914
2912
  async function writeTOMLValue(filePath, key, value) {
2915
- const dir = dirname(filePath);
2916
- await mkdir(dir, { recursive: true });
2917
2913
  const obj = loadExistingTOML(filePath);
2918
2914
  const keyPath = parseKeyPath(key);
2919
2915
  setNestedValue(obj, keyPath, value);
2920
2916
  const content = serializeToTOML$1(obj);
2921
- writeFileSync(filePath, content, "utf-8");
2917
+ await writeFileAtomic(filePath, content);
2922
2918
  }
2923
2919
  async function removeTOMLKey(filePath, key) {
2924
2920
  if (!existsSync(filePath)) {
@@ -2929,7 +2925,7 @@ async function removeTOMLKey(filePath, key) {
2929
2925
  const removed = removeNestedValue(obj, keyPath);
2930
2926
  if (removed) {
2931
2927
  const content = serializeToTOML$1(obj);
2932
- writeFileSync(filePath, content, "utf-8");
2928
+ await writeFileAtomic(filePath, content);
2933
2929
  }
2934
2930
  }
2935
2931
  async function setConfigValue(configPath, key, value, options = {}) {
@@ -6923,7 +6919,7 @@ function formatEditOutput(result) {
6923
6919
  }
6924
6920
  async function executeInteractiveEdit(options, context, config2) {
6925
6921
  const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
6926
- const { selectReferencesOrExit } = await import("./reference-select-DTqhevya.js");
6922
+ const { selectReferencesOrExit } = await import("./reference-select-Cpq_Q4f6.js");
6927
6923
  const allReferences = await context.library.getAll();
6928
6924
  const identifiers = await withAlternateScreen2(
6929
6925
  () => selectReferencesOrExit(allReferences, { multiSelect: true }, config2.cli.tui)
@@ -10460,7 +10456,7 @@ function getFulltextExitCode(result) {
10460
10456
  }
10461
10457
  async function executeInteractiveSelect$1(context, config2) {
10462
10458
  const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
10463
- const { selectReferencesOrExit } = await import("./reference-select-DTqhevya.js");
10459
+ const { selectReferencesOrExit } = await import("./reference-select-Cpq_Q4f6.js");
10464
10460
  const allReferences = await context.library.getAll();
10465
10461
  const identifiers = await withAlternateScreen2(
10466
10462
  () => selectReferencesOrExit(allReferences, { multiSelect: false }, config2.cli.tui)
@@ -31754,7 +31750,7 @@ async function mcpStart(options) {
31754
31750
  async function executeRemove(options, context) {
31755
31751
  const { identifier, idType = "id", fulltextDirectory, deleteFulltext = false } = options;
31756
31752
  if (context.mode === "local" && deleteFulltext && fulltextDirectory) {
31757
- const { removeReference } = await import("./index-BK3hTiKR.js").then((n) => n.v);
31753
+ const { removeReference } = await import("./index-DFhoO9RA.js").then((n) => n.v);
31758
31754
  return removeReference(context.library, {
31759
31755
  identifier,
31760
31756
  idType,
@@ -31809,7 +31805,7 @@ Continue?`;
31809
31805
  }
31810
31806
  async function executeInteractiveRemove(context, config2) {
31811
31807
  const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
31812
- const { selectReferenceItemsOrExit } = await import("./reference-select-DTqhevya.js");
31808
+ const { selectReferenceItemsOrExit } = await import("./reference-select-Cpq_Q4f6.js");
31813
31809
  const allReferences = await context.library.getAll();
31814
31810
  const selectedItems = await withAlternateScreen2(
31815
31811
  () => selectReferenceItemsOrExit(allReferences, { multiSelect: false }, config2.cli.tui)
@@ -32034,9 +32030,9 @@ async function executeInteractiveSearch(options, context, config2) {
32034
32030
  validateInteractiveOptions(options);
32035
32031
  const { checkTTY } = await import("./tty-BMyaEOhX.js");
32036
32032
  const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
32037
- const { runSearchFlow } = await import("./index-BvIfOciH.js");
32038
- const { search } = await import("./file-watcher-CrsNHUpz.js").then((n) => n.z);
32039
- const { tokenize } = await import("./file-watcher-CrsNHUpz.js").then((n) => n.y);
32033
+ const { runSearchFlow } = await import("./index-B7NyGOm6.js");
32034
+ const { search } = await import("./file-watcher-Dyns9dxx.js").then((n) => n.B);
32035
+ const { tokenize } = await import("./file-watcher-Dyns9dxx.js").then((n) => n.A);
32040
32036
  checkTTY();
32041
32037
  const allReferences = await context.library.getAll();
32042
32038
  const searchFn = (query) => {
@@ -32053,7 +32049,7 @@ async function executeInteractiveSearch(options, context, config2) {
32053
32049
  })
32054
32050
  );
32055
32051
  if (result.selectedItems && !result.cancelled) {
32056
- const { isSideEffectAction } = await import("./action-menu-B1DCdkkp.js");
32052
+ const { isSideEffectAction } = await import("./action-menu-R-QKMCZJ.js");
32057
32053
  if (isSideEffectAction(result.action)) {
32058
32054
  await executeSideEffectAction(result.action, result.selectedItems, context, config2);
32059
32055
  return { output: "", cancelled: false, action: result.action };
@@ -32069,7 +32065,7 @@ async function executeSideEffectAction(action, items2, context, config2) {
32069
32065
  switch (action) {
32070
32066
  case "open-url": {
32071
32067
  const { resolveDefaultUrl: resolveDefaultUrl2 } = await Promise.resolve().then(() => url);
32072
- const { openWithSystemApp: openWithSystemApp2 } = await import("./loader-BHvcats5.js").then((n) => n.j);
32068
+ const { openWithSystemApp: openWithSystemApp2 } = await import("./loader-BZgpKsTG.js").then((n) => n.j);
32073
32069
  const item = items2[0];
32074
32070
  if (!item) return;
32075
32071
  const url$1 = resolveDefaultUrl2(item);
@@ -32456,7 +32452,7 @@ function formatUpdateOutput(result, identifier) {
32456
32452
  }
32457
32453
  async function executeInteractiveUpdate(context, config2) {
32458
32454
  const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
32459
- const { selectReferencesOrExit } = await import("./reference-select-DTqhevya.js");
32455
+ const { selectReferencesOrExit } = await import("./reference-select-Cpq_Q4f6.js");
32460
32456
  const allReferences = await context.library.getAll();
32461
32457
  const identifiers = await withAlternateScreen2(
32462
32458
  () => selectReferencesOrExit(allReferences, { multiSelect: false }, config2.cli.tui)
@@ -32751,7 +32747,7 @@ function getUrlExitCode(result) {
32751
32747
  }
32752
32748
  async function executeInteractiveSelect(context, config2) {
32753
32749
  const { withAlternateScreen: withAlternateScreen2 } = await Promise.resolve().then(() => alternateScreen);
32754
- const { selectReferencesOrExit } = await import("./reference-select-DTqhevya.js");
32750
+ const { selectReferencesOrExit } = await import("./reference-select-Cpq_Q4f6.js");
32755
32751
  const allReferences = await context.library.getAll();
32756
32752
  const identifiers = await withAlternateScreen2(
32757
32753
  () => selectReferencesOrExit(allReferences, { multiSelect: false }, config2.cli.tui)
@@ -33254,7 +33250,7 @@ function shouldAutoFetch(cliFlag, configEnabled) {
33254
33250
  return configEnabled;
33255
33251
  }
33256
33252
  async function performAutoFetch(addedItems, context, config2) {
33257
- const { fulltextFetch: fulltextFetch2 } = await import("./index-BK3hTiKR.js").then((n) => n.u);
33253
+ const { fulltextFetch: fulltextFetch2 } = await import("./index-DFhoO9RA.js").then((n) => n.u);
33258
33254
  const fetchResults = await autoFetchFulltext(addedItems, context, {
33259
33255
  fulltextConfig: config2.fulltext,
33260
33256
  fulltextDirectory: config2.attachments.directory,
@@ -33529,4 +33525,4 @@ export {
33529
33525
  restoreStdinAfterInk as r,
33530
33526
  syncAttachments as s
33531
33527
  };
33532
- //# sourceMappingURL=index-DOvEusHb.js.map
33528
+ //# sourceMappingURL=index-DxjW_BKA.js.map