@mantra-ai/cli 0.1.1 → 0.1.3

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 (2) hide show
  1. package/README.md +110 -0
  2. package/package.json +6 -6
package/README.md ADDED
@@ -0,0 +1,110 @@
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
+ ### Batch ingestion
26
+
27
+ Pass multiple identifiers in a single command to ingest papers in bulk:
28
+
29
+ ```bash
30
+ mantra add 10.1038/s41586-024-07487-w 10.1126/science.adg7879 PMC9876543 arXiv:2301.07041
31
+ ```
32
+
33
+ You can also read identifiers from a file (one per line):
34
+
35
+ ```bash
36
+ mantra add --file dois.txt --delay 500
37
+ ```
38
+
39
+ The `--delay` flag sets a pause between requests (in ms) to avoid rate limits.
40
+
41
+ ## Commands
42
+
43
+ | Command | Description |
44
+ |---|---|
45
+ | `add [inputs...]` | Add papers by DOI, PMID, PMCID, arXiv ID, or PDF path |
46
+ | `init [name]` | Initialize a project in the current directory |
47
+ | `papers` | List papers in the library or current project |
48
+ | `show <id>` | Show full details for a paper |
49
+ | `search <query>` | Full-text search with snippets |
50
+ | `export` | Export as BibTeX, JSON, or CSV |
51
+ | `update [id]` | Re-resolve metadata from upstream sources |
52
+ | `remove <id>` | Remove a paper from the library or unlink from a project |
53
+ | `library` | Show library stats |
54
+ | `config` | Manage settings and API keys |
55
+
56
+ Use `mantra <command> --help` for detailed options.
57
+
58
+ ## How it works
59
+
60
+ When you add a paper, Mantra:
61
+
62
+ 1. **Detects the identifier type** (DOI, PMID, PMCID, arXiv ID) and resolves all cross-references via Crossref, OpenAlex, EuropePMC, and source-specific APIs
63
+ 2. **Fetches the full text** using a prioritized chain of open-access sources, preferring structured JATS XML when available
64
+ 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
65
+ 4. **Stores everything locally** in a SQLite database with full-text search
66
+
67
+ ### Supported sources
68
+
69
+ Crossref, OpenAlex, EuropePMC, bioRxiv, medRxiv, arXiv, PLOS.
70
+
71
+ ## Projects
72
+
73
+ 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.
74
+
75
+ ```bash
76
+ mkdir my-review && cd my-review
77
+ mantra init
78
+ mantra add 10.1234/example
79
+ mantra papers --project # list only this project's papers
80
+ mantra search "method" -p # search within the project
81
+ ```
82
+
83
+ ## Configuration
84
+
85
+ ```bash
86
+ mantra config list # view all settings
87
+ mantra config set key val # set a config value
88
+ mantra config path # show config file location
89
+ ```
90
+
91
+ ### API keys
92
+
93
+ For PDF-to-structured-text conversion (when JATS XML is unavailable), set a Gemini API key:
94
+
95
+ ```bash
96
+ mantra config set geminiApiKey YOUR_KEY
97
+ ```
98
+
99
+ Or use the environment variable `GEMINI_API_KEY`.
100
+
101
+ ## Global options
102
+
103
+ | Flag | Description |
104
+ |---|---|
105
+ | `--json` | Output as JSON |
106
+ | `--no-interactive` | Suppress interactive prompts |
107
+
108
+ ## License
109
+
110
+ MIT
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mantra-ai/cli",
3
- "version": "0.1.1",
4
- "description": "CLI for mantra reverse-engineer research papers into structured data",
3
+ "version": "0.1.3",
4
+ "description": "CLI for mantra - reverse-engineer research papers into structured data",
5
5
  "license": "MIT",
6
6
  "bin": {
7
7
  "mantra": "bin/mantra"
@@ -10,9 +10,9 @@
10
10
  "bin/mantra"
11
11
  ],
12
12
  "optionalDependencies": {
13
- "@mantra-ai/cli-darwin-arm64": "0.1.0",
14
- "@mantra-ai/cli-darwin-x64": "0.1.0",
15
- "@mantra-ai/cli-linux-x64": "0.1.0",
16
- "@mantra-ai/cli-linux-arm64": "0.1.0"
13
+ "@mantra-ai/cli-darwin-arm64": "0.1.3",
14
+ "@mantra-ai/cli-darwin-x64": "0.1.3",
15
+ "@mantra-ai/cli-linux-x64": "0.1.3",
16
+ "@mantra-ai/cli-linux-arm64": "0.1.3"
17
17
  }
18
18
  }