papiers 0.0.1 → 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 +38 -0
- package/bin/papiers.mjs +36 -0
- package/dist/index.js +6206 -0
- package/package.json +45 -7
- package/index.js +0 -3
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Papiers CLI
|
|
2
|
+
|
|
3
|
+
Search and read your Papiers library from the terminal.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g papiers
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Requires Node.js 22 or newer.
|
|
12
|
+
|
|
13
|
+
## Sign in
|
|
14
|
+
|
|
15
|
+
In Papiers, open Settings -> API tokens, create a token, then sign in:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
papiers auth login --token-stdin
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Paste the token when prompted. The CLI saves it locally so you do not need to
|
|
22
|
+
paste it again.
|
|
23
|
+
|
|
24
|
+
## Common Commands
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
papiers capabilities
|
|
28
|
+
papiers list --kind document --limit 5
|
|
29
|
+
papiers search "retrieval augmented generation" --limit 10
|
|
30
|
+
papiers read doc_... --format markdown
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Use `--json` for stable machine-readable output. Use `--ids`, `--ids0`, and
|
|
34
|
+
`--doc-ids` to pipe results between commands.
|
|
35
|
+
|
|
36
|
+
## Automation
|
|
37
|
+
|
|
38
|
+
For CI or scripts, set `PAPIERS_TOKEN` and pass `--json` for stable machine-readable output.
|
package/bin/papiers.mjs
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
|
|
7
|
+
const entrypointPath = join(
|
|
8
|
+
dirname(fileURLToPath(import.meta.url)),
|
|
9
|
+
"../dist/index.js",
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
if (!existsSync(entrypointPath)) {
|
|
13
|
+
process.stderr.write(
|
|
14
|
+
"Papiers CLI could not start because its entrypoint is missing. Reinstall the papiers package and try again.\n",
|
|
15
|
+
);
|
|
16
|
+
process.exitCode = 1;
|
|
17
|
+
} else {
|
|
18
|
+
const result = spawnSync(
|
|
19
|
+
process.execPath,
|
|
20
|
+
[entrypointPath, ...process.argv.slice(2)],
|
|
21
|
+
{
|
|
22
|
+
stdio: "inherit",
|
|
23
|
+
env: process.env,
|
|
24
|
+
},
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
if (result.error) {
|
|
28
|
+
process.stderr.write(`${result.error.message}\n`);
|
|
29
|
+
process.exitCode = 1;
|
|
30
|
+
} else if (result.signal) {
|
|
31
|
+
process.stderr.write(`papiers exited after signal ${result.signal}\n`);
|
|
32
|
+
process.exitCode = 1;
|
|
33
|
+
} else {
|
|
34
|
+
process.exitCode = result.status ?? 0;
|
|
35
|
+
}
|
|
36
|
+
}
|