plaud 0.1.0

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.
@@ -0,0 +1,218 @@
1
+ # Plaud CLI v1 contract (agent-first)
2
+
3
+ This document defines **stable**, machine-readable behavior for agents and scripts.
4
+
5
+ ## Output rules
6
+
7
+ - When you pass `--json`, the command prints **exactly one JSON object** to stdout.
8
+ - Progress/status logs go to **stderr**.
9
+ - For `plaud recordings download` and `plaud recordings export`, stdout is always JSON (even without `--json`).
10
+
11
+ ## JSON envelope
12
+
13
+ ### Success
14
+
15
+ ```json
16
+ {
17
+ "ok": true,
18
+ "data": {},
19
+ "meta": {}
20
+ }
21
+ ```
22
+
23
+ `meta` is optional.
24
+
25
+ ### Failure
26
+
27
+ ```json
28
+ {
29
+ "ok": false,
30
+ "error": {
31
+ "code": "AUTH_MISSING",
32
+ "message": "No auth token. Run `plaud auth login`.",
33
+ "retryable": false,
34
+ "http": { "status": 401 }
35
+ },
36
+ "meta": {}
37
+ }
38
+ ```
39
+
40
+ `error.http` and `meta` are optional.
41
+
42
+ ## Exit codes
43
+
44
+ - `0`: success
45
+ - `1`: failure (unexpected, transient, or upstream error)
46
+ - `2`: user action required (missing auth, invalid input, invalid HAR, etc.)
47
+
48
+ ## Error codes
49
+
50
+ These are best-effort and may expand in the future:
51
+
52
+ - `AUTH_MISSING` (exit `2`)
53
+ - `AUTH_INVALID` (usually exit `1`)
54
+ - `NOT_FOUND` (exit `1`)
55
+ - `RATE_LIMITED` (exit `1`, `retryable: true`)
56
+ - `UPSTREAM_5XX` (exit `1`, `retryable: true`)
57
+ - `TIMEOUT` (exit `1`, `retryable: true`)
58
+ - `VALIDATION` (exit `2`)
59
+ - `CHECK_FAILED` (exit `1`)
60
+ - `UNKNOWN` (exit `1`)
61
+
62
+ ## Commands (JSON schemas by example)
63
+
64
+ ### `plaud auth show --json`
65
+
66
+ Success:
67
+ ```json
68
+ {
69
+ "ok": true,
70
+ "data": { "hasToken": true, "source": "config", "tokenRedacted": "eyJhbG…abcd" }
71
+ }
72
+ ```
73
+
74
+ Failure (`exit 2`):
75
+ ```json
76
+ {
77
+ "ok": false,
78
+ "error": { "code": "AUTH_MISSING", "message": "No token set", "retryable": false },
79
+ "meta": { "hasToken": false }
80
+ }
81
+ ```
82
+
83
+ ### `plaud auth status --json`
84
+
85
+ Success:
86
+ ```json
87
+ {
88
+ "ok": true,
89
+ "data": {
90
+ "hasToken": true,
91
+ "source": "config",
92
+ "tokenRedacted": "eyJhbG…abcd",
93
+ "validation": { "ok": true, "me": { "status": 0, "user": { "email": "…" } } }
94
+ }
95
+ }
96
+ ```
97
+
98
+ ### `plaud auth login --json`
99
+
100
+ Success:
101
+ ```json
102
+ {
103
+ "ok": true,
104
+ "data": { "tokenRedacted": "eyJhbG…abcd", "validation": { "ok": true, "me": { "user": { "email": "…" } } } }
105
+ }
106
+ ```
107
+
108
+ Notes:
109
+ - This flow opens a browser and captures a Plaud bearer token from an authenticated request to `api.plaud.ai`.
110
+
111
+ ### `plaud auth set --json`
112
+
113
+ Success:
114
+ ```json
115
+ { "ok": true, "data": { "saved": true, "tokenRedacted": "eyJhbG…abcd" } }
116
+ ```
117
+
118
+ ### `plaud auth import-har /path/to.har --json`
119
+
120
+ Success:
121
+ ```json
122
+ { "ok": true, "data": { "imported": true, "tokenRedacted": "eyJhbG…abcd" } }
123
+ ```
124
+
125
+ ### `plaud auth clear --json`
126
+
127
+ Success:
128
+ ```json
129
+ { "ok": true, "data": { "cleared": true } }
130
+ ```
131
+
132
+ ### `plaud whoami --json`
133
+
134
+ Success:
135
+ ```json
136
+ { "ok": true, "data": { "me": { "user": { "email": "…" } }, "raw": false } }
137
+ ```
138
+
139
+ Notes:
140
+ - `--raw` returns the full `/user/me` response and may include signed URLs.
141
+
142
+ ### `plaud doctor --json`
143
+
144
+ Success:
145
+ ```json
146
+ { "ok": true, "data": { "checks": [{ "name": "token.present", "ok": true }] } }
147
+ ```
148
+
149
+ Failure:
150
+ ```json
151
+ {
152
+ "ok": false,
153
+ "error": { "code": "CHECK_FAILED", "message": "One or more checks failed", "retryable": false },
154
+ "meta": { "checks": [{ "name": "api.listRecordings", "ok": false, "detail": "…" }] }
155
+ }
156
+ ```
157
+
158
+ ### `plaud recordings list --json`
159
+
160
+ Success:
161
+ ```json
162
+ {
163
+ "ok": true,
164
+ "data": { "count": 2, "recordings": [{ "id": "…" }, { "id": "…" }] },
165
+ "meta": { "includeTrash": false, "max": 2 }
166
+ }
167
+ ```
168
+
169
+ ### `plaud recordings get <id> --json`
170
+
171
+ Success:
172
+ ```json
173
+ { "ok": true, "data": { "recording": { "id": "…", "trans_result": [] } } }
174
+ ```
175
+
176
+ Failure (not found):
177
+ ```json
178
+ { "ok": false, "error": { "code": "NOT_FOUND", "message": "Recording not found", "retryable": false } }
179
+ ```
180
+
181
+ ### `plaud recordings download <id>`
182
+
183
+ Success:
184
+ ```json
185
+ {
186
+ "ok": true,
187
+ "data": {
188
+ "id": "…",
189
+ "outDir": "/abs/path",
190
+ "written": [{ "kind": "audio", "path": "/abs/path/file.opus", "bytes": 123 }]
191
+ }
192
+ }
193
+ ```
194
+
195
+ Notes:
196
+ - `--what` supports: `transcript,summary,json,audio`
197
+ - `--audio-format` supports: `opus` (preferred) or `original`
198
+
199
+ ### `plaud recordings export`
200
+
201
+ Success:
202
+ ```json
203
+ {
204
+ "ok": true,
205
+ "data": {
206
+ "exportDate": "2026-02-28T00:00:00.000Z",
207
+ "totalFiles": 10,
208
+ "successful": 10,
209
+ "failed": [],
210
+ "includesTrash": false,
211
+ "since": null,
212
+ "until": null,
213
+ "outDir": null,
214
+ "zipPath": "/abs/path.zip"
215
+ }
216
+ }
217
+ ```
218
+
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "plaud",
3
+ "version": "0.1.0",
4
+ "description": "CLI to export Plaud recordings with speaker-labeled transcripts",
5
+ "license": "MIT",
6
+ "author": "Daniel G Wilson",
7
+ "type": "module",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/danielgwilson/plaud.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/danielgwilson/plaud/issues"
14
+ },
15
+ "homepage": "https://github.com/danielgwilson/plaud#readme",
16
+ "bin": {
17
+ "plaud": "dist/cli.js"
18
+ },
19
+ "scripts": {
20
+ "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
21
+ "build": "npm run clean && tsc -p tsconfig.build.json && node -e \"require('node:fs').chmodSync('dist/cli.js',0o755)\"",
22
+ "dev": "tsx src/cli.ts",
23
+ "typecheck": "tsc -p tsconfig.json --noEmit",
24
+ "lint": "npm run typecheck",
25
+ "pretest": "npm run build",
26
+ "test": "tsx --test",
27
+ "start": "node dist/cli.js",
28
+ "prepare": "npm run build"
29
+ },
30
+ "files": [
31
+ "dist/",
32
+ "skills/",
33
+ "docs/",
34
+ "README.md",
35
+ "CONTRIBUTING.md",
36
+ "SECURITY.md",
37
+ "LICENSE"
38
+ ],
39
+ "dependencies": {
40
+ "archiver": "^6.0.2",
41
+ "commander": "^12.1.0",
42
+ "playwright-core": "^1.51.1"
43
+ },
44
+ "devDependencies": {
45
+ "@types/archiver": "^7.0.0",
46
+ "@types/node": "^25.3.2",
47
+ "tsx": "^4.21.0",
48
+ "typescript": "^5.9.3"
49
+ },
50
+ "engines": {
51
+ "node": ">=22"
52
+ }
53
+ }
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: plaud
3
+ description: Export and download Plaud recordings (transcripts, summaries, audio) using the plaud CLI with safe auth handling.
4
+ ---
5
+
6
+ # Plaud CLI skill
7
+
8
+ Use this skill when you need to authenticate to Plaud and export/download recordings from `app.plaud.ai` / `api.plaud.ai`.
9
+
10
+ ## Hard constraints (security)
11
+
12
+ - Never print or paste a full Plaud auth token into chat/logs.
13
+ - Never pass tokens via CLI flags. Use `plaud auth login`, `plaud auth set --stdin`, or `PLAUD_AUTH_TOKEN`.
14
+ - Prefer `--json` outputs and keep stdout machine-readable where available.
15
+
16
+ ## JSON contract
17
+
18
+ - For stable machine-readable behavior, follow `docs/CONTRACT_V1.md` (in this repo).
19
+
20
+ ## Setup (once)
21
+
22
+ - If `plaud` isn’t installed globally, use `npx -y plaud ...` (slower but zero-setup).
23
+ - `plaud auth login`
24
+ - Verify: `plaud auth status --json` and `plaud doctor --json`
25
+
26
+ Fallbacks:
27
+ - `plaud auth import-har /path/to/web.plaud.ai.har`
28
+ - `plaud auth set --stdin`
29
+
30
+ ## Common workflows
31
+
32
+ - List: `plaud recordings list --json --max 50`
33
+ - Get one: `plaud recordings get <id> --json`
34
+ - Download one: `plaud recordings download <id> --out ./plaud-download --what transcript,summary,json`
35
+ - Download audio: `plaud recordings download <id> --out ./plaud-download --what audio --audio-format opus`
36
+ - Bulk export: `plaud recordings export --zip`
37
+
38
+ ## Notes
39
+
40
+ - `plaud recordings export` prints a JSON summary to stdout; progress goes to stderr.
41
+ - When in doubt: run `plaud doctor --json` to confirm auth + API access.