@mantra-ai/cli 0.1.0 → 0.1.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 +94 -0
- package/bin/mantra +5 -5
- package/package.json +5 -5
package/README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# @mantra-ai/cli
|
|
2
|
+
|
|
3
|
+
Local-first research paper management from your terminal.
|
|
4
|
+
|
|
5
|
+
Add papers by DOI, PMID, arXiv ID, or PDF file. Mantra resolves metadata, fetches open-access full text, and normalizes everything into a structured local library backed by SQLite.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @mantra-ai/cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Supports macOS (Apple Silicon & Intel) and Linux (x64 & ARM64).
|
|
14
|
+
|
|
15
|
+
## Quick start
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
mantra add 10.1038/s41586-024-07487-w # add by DOI
|
|
19
|
+
mantra add paper.pdf # add from a local PDF
|
|
20
|
+
mantra init # start a project in the current directory
|
|
21
|
+
mantra papers # list papers
|
|
22
|
+
mantra search "CRISPR" # full-text search
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Commands
|
|
26
|
+
|
|
27
|
+
| Command | Description |
|
|
28
|
+
|---|---|
|
|
29
|
+
| `add [inputs...]` | Add papers by DOI, PMID, PMCID, arXiv ID, or PDF path |
|
|
30
|
+
| `init [name]` | Initialize a project in the current directory |
|
|
31
|
+
| `papers` | List papers in the library or current project |
|
|
32
|
+
| `show <id>` | Show full details for a paper |
|
|
33
|
+
| `search <query>` | Full-text search with snippets |
|
|
34
|
+
| `export` | Export as BibTeX, JSON, or CSV |
|
|
35
|
+
| `update [id]` | Re-resolve metadata from upstream sources |
|
|
36
|
+
| `remove <id>` | Remove a paper from the library or unlink from a project |
|
|
37
|
+
| `library` | Show library stats |
|
|
38
|
+
| `config` | Manage settings and API keys |
|
|
39
|
+
|
|
40
|
+
Use `mantra <command> --help` for detailed options.
|
|
41
|
+
|
|
42
|
+
## How it works
|
|
43
|
+
|
|
44
|
+
When you add a paper, Mantra:
|
|
45
|
+
|
|
46
|
+
1. **Detects the identifier type** (DOI, PMID, PMCID, arXiv ID) and resolves all cross-references via Crossref, OpenAlex, EuropePMC, and source-specific APIs
|
|
47
|
+
2. **Fetches the full text** using a prioritized chain of open-access sources, preferring structured JATS XML when available
|
|
48
|
+
3. **Normalizes the content** into a canonical structured format with sections, blocks, citations, and metadata. For PDFs without JATS XML, it uses Gemini to extract structure
|
|
49
|
+
4. **Stores everything locally** in a SQLite database with full-text search
|
|
50
|
+
|
|
51
|
+
### Supported sources
|
|
52
|
+
|
|
53
|
+
Crossref, OpenAlex, EuropePMC, bioRxiv, medRxiv, arXiv, PLOS.
|
|
54
|
+
|
|
55
|
+
## Projects
|
|
56
|
+
|
|
57
|
+
Mantra organizes papers into per-directory projects, similar to how git works with repositories. Run `mantra init` in any directory to create a project, then `mantra add` to link papers to it.
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
mkdir my-review && cd my-review
|
|
61
|
+
mantra init
|
|
62
|
+
mantra add 10.1234/example
|
|
63
|
+
mantra papers --project # list only this project's papers
|
|
64
|
+
mantra search "method" -p # search within the project
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Configuration
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
mantra config list # view all settings
|
|
71
|
+
mantra config set key val # set a config value
|
|
72
|
+
mantra config path # show config file location
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### API keys
|
|
76
|
+
|
|
77
|
+
For PDF-to-structured-text conversion (when JATS XML is unavailable), set a Gemini API key:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
mantra config set geminiApiKey YOUR_KEY
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Or use the environment variable `GEMINI_API_KEY`.
|
|
84
|
+
|
|
85
|
+
## Global options
|
|
86
|
+
|
|
87
|
+
| Flag | Description |
|
|
88
|
+
|---|---|
|
|
89
|
+
| `--json` | Output as JSON |
|
|
90
|
+
| `--no-interactive` | Suppress interactive prompts |
|
|
91
|
+
|
|
92
|
+
## License
|
|
93
|
+
|
|
94
|
+
MIT
|
package/bin/mantra
CHANGED
|
@@ -6,10 +6,10 @@ const { execFileSync } = require("child_process");
|
|
|
6
6
|
const path = require("path");
|
|
7
7
|
|
|
8
8
|
const PLATFORM_PACKAGES = {
|
|
9
|
-
"darwin-arm64": "@mantra/cli-darwin-arm64",
|
|
10
|
-
"darwin-x64": "@mantra/cli-darwin-x64",
|
|
11
|
-
"linux-x64": "@mantra/cli-linux-x64",
|
|
12
|
-
"linux-arm64": "@mantra/cli-linux-arm64",
|
|
9
|
+
"darwin-arm64": "@mantra-ai/cli-darwin-arm64",
|
|
10
|
+
"darwin-x64": "@mantra-ai/cli-darwin-x64",
|
|
11
|
+
"linux-x64": "@mantra-ai/cli-linux-x64",
|
|
12
|
+
"linux-arm64": "@mantra-ai/cli-linux-arm64",
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
function getBinaryPath() {
|
|
@@ -35,7 +35,7 @@ function getBinaryPath() {
|
|
|
35
35
|
console.error(
|
|
36
36
|
`Could not find the mantra binary for your platform (${key}).\n` +
|
|
37
37
|
`The package ${pkg} may not have been installed correctly.\n\n` +
|
|
38
|
-
`Try reinstalling: npm install -g mantra`
|
|
38
|
+
`Try reinstalling: npm install -g @mantra-ai/cli`
|
|
39
39
|
);
|
|
40
40
|
process.exit(1);
|
|
41
41
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mantra-ai/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "CLI for mantra — reverse-engineer research papers into structured data",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"bin/mantra"
|
|
11
11
|
],
|
|
12
12
|
"optionalDependencies": {
|
|
13
|
-
"@mantra-ai/cli-darwin-arm64": "0.1.
|
|
14
|
-
"@mantra-ai/cli-darwin-x64": "0.1.
|
|
15
|
-
"@mantra-ai/cli-linux-x64": "0.1.
|
|
16
|
-
"@mantra-ai/cli-linux-arm64": "0.1.
|
|
13
|
+
"@mantra-ai/cli-darwin-arm64": "0.1.2",
|
|
14
|
+
"@mantra-ai/cli-darwin-x64": "0.1.2",
|
|
15
|
+
"@mantra-ai/cli-linux-x64": "0.1.2",
|
|
16
|
+
"@mantra-ai/cli-linux-arm64": "0.1.2"
|
|
17
17
|
}
|
|
18
18
|
}
|