paper-manager 0.11.1 → 0.11.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/README.md +14 -0
- package/dist/config/index.js +36 -3
- package/dist/config/init.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,6 +5,20 @@
|
|
|
5
5
|
|
|
6
6
|
A CLI tool for managing academic papers with knowledge base and vector search support.
|
|
7
7
|
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- **Semantic search** — FAISS vector indexing with configurable embedding models, query your papers by meaning rather than keywords
|
|
11
|
+
- **PDF metadata extraction** — automatically extracts title, author, keywords, DOI, and more from PDF files
|
|
12
|
+
- **DOI deduplication** — detects duplicate papers by DOI before adding, with `--force` override
|
|
13
|
+
- **Multi-format support** — import from PDF, TXT, MD, TEX, and other text-based formats
|
|
14
|
+
- **PDF-to-Markdown conversion** — optional high-quality conversion via [opendataloader-pdf](https://github.com/nicobailon/opendataloader-pdf) with image extraction
|
|
15
|
+
- **Dual-scope data model** — user-level (`~/.paper-manager/`) for global collections and project-level (`./.paper-manager/`) for project-specific papers, with automatic scope resolution
|
|
16
|
+
- **DOI-to-BibTeX** — convert DOI to BibTeX citation in one command
|
|
17
|
+
- **Machine-readable output** — `--json` and `--jq` flags on all read commands for scripting and automation
|
|
18
|
+
- **Literature notes** — attach key-value annotations to any paper
|
|
19
|
+
- **Local-first** — SQLite + FAISS + filesystem, no cloud dependencies
|
|
20
|
+
- **Agent skill** — installable as a [coding agent skill](https://github.com/vercel-labs/skills) for agent-driven paper management
|
|
21
|
+
|
|
8
22
|
## Installation
|
|
9
23
|
|
|
10
24
|
```bash
|
package/dist/config/index.js
CHANGED
|
@@ -5,12 +5,45 @@ import * as z from "zod";
|
|
|
5
5
|
import { EmbeddingModelConfigSchema } from "../types/index.js";
|
|
6
6
|
// ─── Path Utilities ─────────────────────────────────────────
|
|
7
7
|
const USER_DATA_DIR = path.join(os.homedir(), ".paper-manager");
|
|
8
|
-
const
|
|
8
|
+
const DIR_NAME = ".paper-manager";
|
|
9
|
+
function findProjectDataDir() {
|
|
10
|
+
let dir = process.cwd();
|
|
11
|
+
while (true) {
|
|
12
|
+
const candidate = path.join(dir, DIR_NAME);
|
|
13
|
+
if (fs.existsSync(candidate))
|
|
14
|
+
return candidate;
|
|
15
|
+
const parent = path.dirname(dir);
|
|
16
|
+
if (parent === dir)
|
|
17
|
+
break;
|
|
18
|
+
dir = parent;
|
|
19
|
+
}
|
|
20
|
+
// Fallback: CWD (no .paper-manager/ found up the tree)
|
|
21
|
+
return path.resolve(DIR_NAME);
|
|
22
|
+
}
|
|
23
|
+
let cachedProjectDataDir;
|
|
9
24
|
export function getUserDataDir() {
|
|
10
25
|
return USER_DATA_DIR;
|
|
11
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Returns the project-level `.paper-manager/` directory path, traversing
|
|
29
|
+
* up from CWD. Falls back to CWD if not found. Result is cached per process.
|
|
30
|
+
*/
|
|
12
31
|
export function getProjectDataDir() {
|
|
13
|
-
|
|
32
|
+
if (cachedProjectDataDir === undefined) {
|
|
33
|
+
cachedProjectDataDir = findProjectDataDir();
|
|
34
|
+
}
|
|
35
|
+
return cachedProjectDataDir;
|
|
36
|
+
}
|
|
37
|
+
/** @internal Reset cached project data dir. For testing only. */
|
|
38
|
+
export function resetProjectDataDirCache() {
|
|
39
|
+
cachedProjectDataDir = undefined;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Returns CWD-based `.paper-manager/` path without traversal.
|
|
43
|
+
* Used by `config init` to always create in the current directory.
|
|
44
|
+
*/
|
|
45
|
+
export function getProjectInitDir() {
|
|
46
|
+
return path.resolve(DIR_NAME);
|
|
14
47
|
}
|
|
15
48
|
export function getFilesDir(base) {
|
|
16
49
|
return path.join(base, "files");
|
|
@@ -22,7 +55,7 @@ function getUserConfigPath() {
|
|
|
22
55
|
return path.join(USER_DATA_DIR, "config.json");
|
|
23
56
|
}
|
|
24
57
|
function getProjectConfigPath() {
|
|
25
|
-
return path.join(
|
|
58
|
+
return path.join(getProjectDataDir(), "config.json");
|
|
26
59
|
}
|
|
27
60
|
// ─── Config Schema Map ─────────────────────────────────────
|
|
28
61
|
const configSchemas = {
|
package/dist/config/init.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
2
|
import * as path from "node:path";
|
|
3
3
|
import { initializeDatabase, openDatabase } from "../db/index.js";
|
|
4
|
-
import { getFilesDir,
|
|
4
|
+
import { getFilesDir, getProjectInitDir, getUserDataDir, getVectorStoreDir, writeConfigFile, } from "./index.js";
|
|
5
5
|
export function initScope(options) {
|
|
6
|
-
const baseDir = options?.user ? getUserDataDir() :
|
|
6
|
+
const baseDir = options?.user ? getUserDataDir() : getProjectInitDir();
|
|
7
7
|
const items = [];
|
|
8
8
|
// 1. Base directory
|
|
9
9
|
if (fs.existsSync(baseDir)) {
|