xevol 0.0.1
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/PLAN.md +310 -0
- package/README.md +23 -0
- package/dist/index.js +5 -0
- package/package.json +25 -0
- package/src/index.ts +2 -0
package/PLAN.md
ADDED
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
# xevol-cli — Plan
|
|
2
|
+
|
|
3
|
+
Minimal CLI for xevol-api. Auth + transcriptions only.
|
|
4
|
+
|
|
5
|
+
## Scope
|
|
6
|
+
|
|
7
|
+
4 features, nothing else:
|
|
8
|
+
|
|
9
|
+
1. **Auth** — login/logout + token-based auth
|
|
10
|
+
2. **List transcriptions** — paginated, filterable
|
|
11
|
+
3. **Add YouTube URL** — submit for processing, poll status
|
|
12
|
+
4. **View transcript** — raw content + formatted spikes
|
|
13
|
+
|
|
14
|
+
## Tech
|
|
15
|
+
|
|
16
|
+
- **Runtime:** Bun
|
|
17
|
+
- **Framework:** Commander.js
|
|
18
|
+
- **HTTP:** native fetch
|
|
19
|
+
- **Output:** `cli-table3` + `chalk`
|
|
20
|
+
- **Config:** `~/.xevol/config.json`
|
|
21
|
+
- **Lang:** TypeScript
|
|
22
|
+
|
|
23
|
+
## Auth — Device Authorization Flow (public-facing)
|
|
24
|
+
|
|
25
|
+
No passwords in the CLI. Browser handles all auth complexity (2FA, OAuth, SSO, password managers).
|
|
26
|
+
|
|
27
|
+
### Login flow
|
|
28
|
+
```
|
|
29
|
+
xevol login
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
1. CLI calls `POST /auth/cli/device-code` → gets `{ deviceCode, userCode, verificationUrl, expiresIn, interval }`
|
|
33
|
+
2. Opens browser to `https://xevol.com/cli-auth?code=ABCD-1234`
|
|
34
|
+
3. Prints fallback for headless environments:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
Open this URL to authenticate:
|
|
38
|
+
https://xevol.com/cli-auth?code=ABCD-1234
|
|
39
|
+
|
|
40
|
+
Waiting for approval... (expires in 5 min)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
4. CLI polls `POST /auth/cli/device-token` with `{ deviceCode }` every `interval` seconds
|
|
44
|
+
5. User logs in on browser (existing session or fresh), sees "Authorize XEVol CLI?" + the user code for verification
|
|
45
|
+
6. User clicks Approve
|
|
46
|
+
7. CLI receives long-lived token, stores in `~/.xevol/config.json`:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"apiUrl": "https://api.xevol.com",
|
|
51
|
+
"token": "xevol_cli_...",
|
|
52
|
+
"accountId": "...",
|
|
53
|
+
"email": "kuka@xevol.com",
|
|
54
|
+
"expiresAt": "2026-08-02T00:00:00Z"
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Token mode (CI/CD, servers)
|
|
59
|
+
```
|
|
60
|
+
xevol login --token <token>
|
|
61
|
+
```
|
|
62
|
+
Validates via `GET /auth/session`, stores if valid. For automation where browser isn't available.
|
|
63
|
+
|
|
64
|
+
### Logout
|
|
65
|
+
```
|
|
66
|
+
xevol logout
|
|
67
|
+
```
|
|
68
|
+
Revokes token server-side, clears local config.
|
|
69
|
+
|
|
70
|
+
### Who am I
|
|
71
|
+
```
|
|
72
|
+
xevol whoami
|
|
73
|
+
> kuka@xevol.com (Pro plan, 47 transcriptions this month)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Env override
|
|
77
|
+
```
|
|
78
|
+
XEVOL_API_URL=http://localhost:8081
|
|
79
|
+
XEVOL_TOKEN=<token>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Precedence
|
|
83
|
+
1. `--token` flag
|
|
84
|
+
2. `XEVOL_TOKEN` env var
|
|
85
|
+
3. `~/.xevol/config.json`
|
|
86
|
+
|
|
87
|
+
### New API endpoints needed (xevol-api)
|
|
88
|
+
|
|
89
|
+
| Endpoint | Method | Description |
|
|
90
|
+
|---|---|---|
|
|
91
|
+
| `/auth/cli/device-code` | POST | Generate device code + user code |
|
|
92
|
+
| `/auth/cli/device-token` | POST | Poll for token (pending/approved/expired) |
|
|
93
|
+
| `/auth/cli/revoke` | POST | Revoke CLI token |
|
|
94
|
+
| `/cli-auth` (frontend) | GET | Browser page showing user code + approve button |
|
|
95
|
+
|
|
96
|
+
Token format: `xevol_cli_<random>` — separate from session tokens, longer-lived (6 months), revocable from account settings.
|
|
97
|
+
|
|
98
|
+
## Commands
|
|
99
|
+
|
|
100
|
+
### `xevol list`
|
|
101
|
+
|
|
102
|
+
List transcriptions with pagination.
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
xevol list
|
|
106
|
+
xevol list --page 2 --limit 50
|
|
107
|
+
xevol list --json
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**API:** `GET /v1/transcription/transcriptions?page=N&limit=N`
|
|
111
|
+
**Auth:** session token in cookie header
|
|
112
|
+
|
|
113
|
+
**Default output:**
|
|
114
|
+
```
|
|
115
|
+
Transcriptions (page 1/3, 47 total)
|
|
116
|
+
|
|
117
|
+
ID Status Lang Duration Channel Title
|
|
118
|
+
─────────────────────────────────────────────────────────────────────────
|
|
119
|
+
abc123def45 completed en 12:34 Y Combinator How to Build a Startup
|
|
120
|
+
xyz789ghi01 completed de 45:12 Lex Fridman Interview with...
|
|
121
|
+
...
|
|
122
|
+
|
|
123
|
+
Page 1 of 3 — use --page 2 for next
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**JSON output:** raw API response.
|
|
127
|
+
|
|
128
|
+
### `xevol add <youtube-url>`
|
|
129
|
+
|
|
130
|
+
Submit a YouTube URL for transcription.
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
xevol add "https://youtube.com/watch?v=abc123"
|
|
134
|
+
xevol add "https://youtube.com/watch?v=abc123" --lang de
|
|
135
|
+
xevol add "https://youtube.com/watch?v=abc123" --wait
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**API:** `GET /v1/transcription/add?url=<url>&outputLang=<lang>`
|
|
139
|
+
**Auth:** session token in cookie header
|
|
140
|
+
|
|
141
|
+
**Default output:**
|
|
142
|
+
```
|
|
143
|
+
✓ Transcription created: abc123def45
|
|
144
|
+
Status: pending
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**With `--wait`:** polls `GET /v1/transcription/status/:id` every 5s until completed/error.
|
|
148
|
+
```
|
|
149
|
+
✓ Transcription created: abc123def45
|
|
150
|
+
⠋ Processing... (30s)
|
|
151
|
+
✓ Completed: "How to Build a Startup" (12:34)
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Options:**
|
|
155
|
+
- `--lang <code>` — output language (default: `en`)
|
|
156
|
+
- `--wait` — poll until complete
|
|
157
|
+
- `--json` — raw JSON response
|
|
158
|
+
|
|
159
|
+
### `xevol view <id>`
|
|
160
|
+
|
|
161
|
+
View a transcription's raw content.
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
xevol view abc123def45
|
|
165
|
+
xevol view abc123def45 --raw
|
|
166
|
+
xevol view abc123def45 --json
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
**API:** `GET /v1/transcription/analysis/:id`
|
|
170
|
+
|
|
171
|
+
**Default output:**
|
|
172
|
+
```
|
|
173
|
+
How to Build a Startup
|
|
174
|
+
Channel: Y Combinator (@ycombinator)
|
|
175
|
+
Duration: 12:34 | Lang: en | Status: completed
|
|
176
|
+
URL: https://youtube.com/watch?v=abc123
|
|
177
|
+
───────────────────────────────────────
|
|
178
|
+
|
|
179
|
+
[summary text]
|
|
180
|
+
|
|
181
|
+
───────────────────────────────────────
|
|
182
|
+
Full transcript: use --raw
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**With `--raw`:** prints full `content` or `cleanContent` field to stdout (pipeable).
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
xevol view abc123def45 --raw > transcript.txt
|
|
189
|
+
xevol view abc123def45 --raw --clean # cleanContent instead of content
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### `xevol spikes <id>`
|
|
193
|
+
|
|
194
|
+
View formatted AI-generated spikes for a transcription.
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
xevol spikes abc123def45
|
|
198
|
+
xevol spikes abc123def45 --json
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
**API:** Direct query — `GET /spikes` where `transcriptionId = :id`
|
|
202
|
+
|
|
203
|
+
Since spikes are generated on-demand via `POST /spikes/:transcriptionId` with a `promptId`, the CLI needs to:
|
|
204
|
+
|
|
205
|
+
1. Check if spikes exist for this transcription
|
|
206
|
+
2. If yes, display them
|
|
207
|
+
3. If no, offer to generate (requires `--prompt <id>`)
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
xevol spikes abc123def45
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
**Output (if spikes exist):**
|
|
214
|
+
```
|
|
215
|
+
Spikes for "How to Build a Startup"
|
|
216
|
+
───────────────────────────────────────
|
|
217
|
+
|
|
218
|
+
[formatted spike content — markdown rendered to terminal]
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**Output (no spikes):**
|
|
222
|
+
```
|
|
223
|
+
No spikes found for abc123def45.
|
|
224
|
+
Generate with: xevol spikes abc123def45 --generate --prompt <promptId>
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
**Generate:**
|
|
228
|
+
```
|
|
229
|
+
xevol spikes abc123def45 --generate --prompt default --lang en
|
|
230
|
+
```
|
|
231
|
+
Calls `POST /spikes/:id` with `{ promptId, outputLang }`, then polls stream until complete.
|
|
232
|
+
|
|
233
|
+
## Project Structure
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
xevol-cli/
|
|
237
|
+
├── src/
|
|
238
|
+
│ ├── index.ts # Entry: commander setup, register commands
|
|
239
|
+
│ ├── commands/
|
|
240
|
+
│ │ ├── login.ts # login + logout
|
|
241
|
+
│ │ ├── list.ts # list transcriptions
|
|
242
|
+
│ │ ├── add.ts # add youtube url
|
|
243
|
+
│ │ ├── view.ts # view transcript
|
|
244
|
+
│ │ └── spikes.ts # view/generate spikes
|
|
245
|
+
│ └── lib/
|
|
246
|
+
│ ├── api.ts # fetch wrapper (base URL, auth headers, error handling)
|
|
247
|
+
│ ├── config.ts # read/write ~/.xevol/config.json
|
|
248
|
+
│ └── output.ts # table formatting, spinners, colors
|
|
249
|
+
├── package.json
|
|
250
|
+
├── tsconfig.json
|
|
251
|
+
├── PLAN.md
|
|
252
|
+
└── README.md
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## package.json
|
|
256
|
+
|
|
257
|
+
```json
|
|
258
|
+
{
|
|
259
|
+
"name": "xevol-cli",
|
|
260
|
+
"version": "0.1.0",
|
|
261
|
+
"type": "module",
|
|
262
|
+
"bin": {
|
|
263
|
+
"xevol": "./src/index.ts"
|
|
264
|
+
},
|
|
265
|
+
"dependencies": {
|
|
266
|
+
"commander": "^13.0.0",
|
|
267
|
+
"chalk": "^5.4.0",
|
|
268
|
+
"cli-table3": "^0.6.5",
|
|
269
|
+
"ora": "^8.0.0",
|
|
270
|
+
"@inquirer/prompts": "^7.0.0"
|
|
271
|
+
},
|
|
272
|
+
"devDependencies": {
|
|
273
|
+
"@types/bun": "latest",
|
|
274
|
+
"typescript": "^5.7.0"
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
## Install & Link
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
cd ~/stack/xevol-cli
|
|
283
|
+
bun install
|
|
284
|
+
bun link # → `xevol` available globally
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## Implementation Order
|
|
288
|
+
|
|
289
|
+
### Phase 1: API-side (xevol-api)
|
|
290
|
+
1. `POST /auth/cli/device-code` — generate device + user codes, store in Redis with TTL
|
|
291
|
+
2. `POST /auth/cli/device-token` — poll endpoint, returns pending/approved/expired
|
|
292
|
+
3. `POST /auth/cli/revoke` — revoke CLI token
|
|
293
|
+
4. CLI token model — new table or extend existing API keys with `type: "cli"`
|
|
294
|
+
5. Frontend: `/cli-auth` page — show user code, approve button, calls device-token approve
|
|
295
|
+
|
|
296
|
+
### Phase 2: CLI
|
|
297
|
+
1. `lib/config.ts` + `lib/api.ts` — foundation
|
|
298
|
+
2. `commands/login.ts` — device auth flow + `--token` fallback
|
|
299
|
+
3. `commands/list.ts` — list transcriptions
|
|
300
|
+
4. `commands/add.ts` — add URL + polling
|
|
301
|
+
5. `commands/view.ts` — view transcript
|
|
302
|
+
6. `commands/spikes.ts` — view/generate spikes
|
|
303
|
+
7. `lib/output.ts` — polish formatting
|
|
304
|
+
|
|
305
|
+
### Phase 3: Distribution
|
|
306
|
+
1. npm publish as `xevol-cli` (or `@xevol/cli`)
|
|
307
|
+
2. README with install + auth flow
|
|
308
|
+
3. `xevol update` — self-update command
|
|
309
|
+
|
|
310
|
+
Estimate: Phase 1 ~3-4h, Phase 2 ~2-3h, Phase 3 ~1h.
|
package/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# xevol
|
|
2
|
+
|
|
3
|
+
CLI for [XEVol](https://xevol.com) — transcribe, analyze, and explore YouTube content from your terminal.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i -g xevol
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
xevol login # Authenticate via browser
|
|
15
|
+
xevol list # List your transcriptions
|
|
16
|
+
xevol add <url> # Transcribe a YouTube video
|
|
17
|
+
xevol view <id> # View transcript
|
|
18
|
+
xevol spikes <id> # View AI-generated insights
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## License
|
|
22
|
+
|
|
23
|
+
MIT
|
package/dist/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "xevol",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "CLI for XEVol — transcribe, analyze, and explore YouTube content",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"xevol": "./src/index.ts"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"dev": "bun run src/index.ts",
|
|
11
|
+
"build": "bun build src/index.ts --outdir dist --target node",
|
|
12
|
+
"prepublishOnly": "bun run build"
|
|
13
|
+
},
|
|
14
|
+
"keywords": ["xevol", "transcription", "youtube", "cli"],
|
|
15
|
+
"author": "Kuan <kuka@xevol.com>",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/xevol/xevol-cli"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://xevol.com",
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=18"
|
|
24
|
+
}
|
|
25
|
+
}
|
package/src/index.ts
ADDED