careervivid 1.12.48 → 2.0.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.
- package/README.md +85 -19
- package/dist/agent/instructions.d.ts.map +1 -1
- package/dist/agent/instructions.js +10 -0
- package/dist/agent/tools/interview.d.ts +13 -0
- package/dist/agent/tools/interview.d.ts.map +1 -0
- package/dist/agent/tools/interview.js +106 -0
- package/dist/commands/admin.d.ts +18 -0
- package/dist/commands/admin.d.ts.map +1 -0
- package/dist/commands/admin.js +187 -0
- package/dist/commands/agent/toolRegistry.d.ts.map +1 -1
- package/dist/commands/agent/toolRegistry.js +6 -1
- package/dist/commands/interview.d.ts +21 -0
- package/dist/commands/interview.d.ts.map +1 -0
- package/dist/commands/interview.js +738 -0
- package/dist/index.js +4 -0
- package/dist/lib/logger.d.ts +108 -0
- package/dist/lib/logger.d.ts.map +1 -0
- package/dist/lib/logger.js +198 -0
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
# careervivid · CLI
|
|
2
2
|
|
|
3
|
-
> **Your AI-powered career terminal — autonomous job applications, resume editing, job pipeline tracking, and portfolio publishing from the command line.**
|
|
3
|
+
> **Your AI-powered career terminal — voice mock interviews, autonomous job applications, resume editing, job pipeline tracking, and portfolio publishing from the command line.**
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/careervivid)
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
[](https://nodejs.org)
|
|
8
|
+
[](https://www.npmjs.com/package/careervivid)
|
|
8
9
|
|
|
9
10
|
---
|
|
10
11
|
|
|
@@ -12,6 +13,7 @@
|
|
|
12
13
|
|
|
13
14
|
- [Quick Start](#quick-start)
|
|
14
15
|
- [Commands](#commands)
|
|
16
|
+
- [cv interview](#cv-interview) 🎙 **AI Voice Interview**
|
|
15
17
|
- [cv agent](#cv-agent) ⭐ **AI Agent**
|
|
16
18
|
- [cv agent --jobs](#cv-agent---jobs) 🤖 **Autonomous Job Applications**
|
|
17
19
|
- [cv agent --resume](#cv-agent---resume) 📄 **Resume CRUD**
|
|
@@ -40,18 +42,20 @@ npm install -g careervivid
|
|
|
40
42
|
|
|
41
43
|
# 2. Log in and get your free API key
|
|
42
44
|
cv login
|
|
43
|
-
# → opens careervivid.app
|
|
44
|
-
# →
|
|
45
|
-
|
|
45
|
+
# → opens careervivid.app in your browser
|
|
46
|
+
# → authenticate once, API key is saved automatically
|
|
47
|
+
|
|
48
|
+
# 3. Practice an interview with voice AI
|
|
49
|
+
cv interview
|
|
46
50
|
|
|
47
|
-
#
|
|
51
|
+
# 4. Start the AI agent
|
|
48
52
|
cv agent
|
|
49
53
|
|
|
50
|
-
#
|
|
54
|
+
# 5. Or jump straight into job-hunting mode
|
|
51
55
|
cv agent --jobs
|
|
52
56
|
```
|
|
53
57
|
|
|
54
|
-
> **Free tier includes
|
|
58
|
+
> **Free tier includes 10 AI credits/month** — no credit card required.
|
|
55
59
|
|
|
56
60
|
---
|
|
57
61
|
|
|
@@ -59,6 +63,50 @@ cv agent --jobs
|
|
|
59
63
|
|
|
60
64
|
---
|
|
61
65
|
|
|
66
|
+
### `cv interview`
|
|
67
|
+
|
|
68
|
+
**AI-powered voice mock interview** using the Gemini Live API. Vivid, your AI interviewer, conducts a real-time spoken interview tailored to the role you specify. After the session, you receive an auto-generated feedback report with scores and actionable improvement tips.
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
cv interview # interactive role prompt, voice mode
|
|
72
|
+
cv interview --role "Senior Software Engineer"
|
|
73
|
+
cv interview --role "Product Manager" --text # text-only fallback (no mic needed)
|
|
74
|
+
cv interview --role "SDE" --resume <id> # load your resume for context
|
|
75
|
+
cv interview --questions 7 # custom question count (default 5)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Requirements (voice mode):**
|
|
79
|
+
- `sox` for audio I/O — install once:
|
|
80
|
+
```bash
|
|
81
|
+
# macOS
|
|
82
|
+
brew install sox
|
|
83
|
+
# Ubuntu / Debian
|
|
84
|
+
sudo apt install sox
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**How it works:**
|
|
88
|
+
|
|
89
|
+
1. Vivid generates tailored interview questions using your role (and resume, if provided)
|
|
90
|
+
2. A real-time voice session opens — speak your answers naturally
|
|
91
|
+
3. Vivid asks follow-up questions and adapts to your responses
|
|
92
|
+
4. Press **Ctrl+C** at any time to end
|
|
93
|
+
5. A structured feedback report is generated covering:
|
|
94
|
+
- Overall, communication, confidence, and relevance scores (0–100)
|
|
95
|
+
- Specific strengths and areas for improvement
|
|
96
|
+
|
|
97
|
+
**Credit cost:** **2 credits/minute** (minimum 2, maximum 60 per session)
|
|
98
|
+
|
|
99
|
+
| Session length | Credits |
|
|
100
|
+
|---|---|
|
|
101
|
+
| < 1 min | 2 |
|
|
102
|
+
| 5 min | 10 |
|
|
103
|
+
| 10 min | 20 |
|
|
104
|
+
| 30 min+ | 60 (cap) |
|
|
105
|
+
|
|
106
|
+
> Credits are only charged after the session ends — never upfront.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
62
110
|
### `cv agent`
|
|
63
111
|
|
|
64
112
|
An **autonomous AI agent** that runs interactively in your terminal. Choose from CareerVivid Cloud (credits deducted from your account) or Bring Your Own API Key.
|
|
@@ -294,7 +342,7 @@ CV_API_KEY=cv_live_YOUR_KEY_HERE cv publish article.md
|
|
|
294
342
|
|
|
295
343
|
### `cv login`
|
|
296
344
|
|
|
297
|
-
Open the CareerVivid sign-in page and
|
|
345
|
+
Open the CareerVivid sign-in page and automatically save your API key.
|
|
298
346
|
|
|
299
347
|
```bash
|
|
300
348
|
cv login
|
|
@@ -336,17 +384,20 @@ cv config set llmModel gpt-4o
|
|
|
336
384
|
|
|
337
385
|
| Plan | Credits / Month | Price |
|
|
338
386
|
|---|---|---|
|
|
339
|
-
| **Free** |
|
|
387
|
+
| **Free** | 10 credits | $0 |
|
|
340
388
|
| **Pro** | 1,000 credits | Paid |
|
|
341
389
|
| **Max** | 10,000 credits | Paid |
|
|
342
390
|
|
|
343
|
-
**Credit costs
|
|
391
|
+
**Credit costs by feature:**
|
|
344
392
|
|
|
345
|
-
|
|
|
393
|
+
| Feature | Credits |
|
|
346
394
|
|---|---|
|
|
347
|
-
| `
|
|
348
|
-
| `gemini-
|
|
395
|
+
| `cv interview` (voice) | 2 credits/min (min 2, max 60) |
|
|
396
|
+
| `gemini-3.1-flash-lite-preview` agent turn | 0.5 cr |
|
|
397
|
+
| `gemini-2.5-flash` agent turn | 1 cr |
|
|
349
398
|
| `gemini-3.1-pro-preview` (`--pro`) | 2 cr |
|
|
399
|
+
| Resume tailor | 2 cr |
|
|
400
|
+
| Job evaluation | 3 cr |
|
|
350
401
|
|
|
351
402
|
> **Bring Your Own Key:** Using `--provider openai` (or any non-CareerVivid provider) deducts **zero credits** — you pay your provider directly.
|
|
352
403
|
|
|
@@ -462,12 +513,13 @@ echo "# My Architecture\n\nExplains the new service..." \
|
|
|
462
513
|
You have access to the `cv` CLI tool.
|
|
463
514
|
|
|
464
515
|
Available commands:
|
|
465
|
-
- cv
|
|
466
|
-
- cv
|
|
467
|
-
- cv agent --
|
|
468
|
-
- cv jobs
|
|
469
|
-
- cv jobs
|
|
470
|
-
- cv jobs
|
|
516
|
+
- cv interview AI voice interview (requires sox)
|
|
517
|
+
- cv publish <file> Publish an article (private by default, use --public to share)
|
|
518
|
+
- cv agent --resume Resume CRUD: read, update fields, tailor
|
|
519
|
+
- cv agent --jobs Job hunting + autonomous apply
|
|
520
|
+
- cv jobs hunt --role "..." AI job search
|
|
521
|
+
- cv jobs apply <url> Autonomous form filling (stops before submit)
|
|
522
|
+
- cv jobs list View job tracker
|
|
471
523
|
|
|
472
524
|
Rules:
|
|
473
525
|
1. Never include real API keys in published content.
|
|
@@ -500,6 +552,20 @@ cv auth check
|
|
|
500
552
|
CV_API_KEY=cv_live_YOUR_KEY cv publish article.md
|
|
501
553
|
```
|
|
502
554
|
|
|
555
|
+
**`cv interview` — no audio / can't hear Vivid**
|
|
556
|
+
```bash
|
|
557
|
+
# Install sox first:
|
|
558
|
+
brew install sox # macOS
|
|
559
|
+
sudo apt install sox # Ubuntu/Debian
|
|
560
|
+
|
|
561
|
+
# Then retry:
|
|
562
|
+
cv interview
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
**`cv interview` — hearing echo / Vivid repeating itself**
|
|
566
|
+
|
|
567
|
+
This can occur if your microphone picks up the speaker output. The CLI uses half-duplex mute suppression (mic is muted while Vivid is speaking). Use headphones for the best experience.
|
|
568
|
+
|
|
503
569
|
**`browser_sidecar.py not found`**
|
|
504
570
|
```bash
|
|
505
571
|
# browser-use is not set up. Follow the browser-use Setup section above.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../../src/agent/instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,eAAO,MAAM,aAAa,QAalB,CAAC;AAMT,eAAO,MAAM,cAAc,QAcnB,CAAC;AAMT,eAAO,MAAM,cAAc,QAqCnB,CAAC;AAMT,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../../src/agent/instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,eAAO,MAAM,aAAa,QAalB,CAAC;AAMT,eAAO,MAAM,cAAc,QAcnB,CAAC;AAMT,eAAO,MAAM,cAAc,QAqCnB,CAAC;AAMT,eAAO,MAAM,kBAAkB,QAgDvB,CAAC;AAMT,eAAO,MAAM,YAAY,QA4CjB,CAAC;AAMT,eAAO,MAAM,iBAAiB,QAkBtB,CAAC;AAOT;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE;IACzC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,GAAG,MAAM,CAkCT"}
|
|
@@ -127,6 +127,14 @@ These tools read/write the Firebase Kanban board at careervivid.app/job-tracker.
|
|
|
127
127
|
- **verify_url** — Verify a single link is alive before sharing it.
|
|
128
128
|
- **verify_job_urls** — Verify all URLs from a search_jobs result batch.
|
|
129
129
|
NEVER share a link without verifying it first.
|
|
130
|
+
|
|
131
|
+
### 🎙 AI Voice Interview
|
|
132
|
+
- **start_interview** ⭐ — Launch a live AI mock interview session directly in the terminal.
|
|
133
|
+
- Vivid (the AI interviewer) asks tailored questions based on the role and user's resume.
|
|
134
|
+
- User speaks answers (voice mode, requires sox) or types them (text mode).
|
|
135
|
+
- Feedback report auto-generated at the end with scores and improvement tips.
|
|
136
|
+
- **Credit cost:** 2 credits/minute (min 2, max 60). Text mode ~1 credit flat.
|
|
137
|
+
- Use when user says: "practice interview", "mock interview", "interview me for [role]", "I have an interview at [company]", etc.
|
|
130
138
|
`.trim();
|
|
131
139
|
// ---------------------------------------------------------------------------
|
|
132
140
|
// §5 — Autonomous execution harness (appended in --jobs mode)
|
|
@@ -174,6 +182,7 @@ If it does, call tracker_update_job instead — never create a duplicate row.
|
|
|
174
182
|
| view saved openings | openings_list |
|
|
175
183
|
| applied to a specific opening | openings_apply |
|
|
176
184
|
| find NEW companies/roles not yet in tracker | get_resume → search_jobs |
|
|
185
|
+
| practice interview, mock interview, interview me | start_interview |
|
|
177
186
|
`.trim();
|
|
178
187
|
// ---------------------------------------------------------------------------
|
|
179
188
|
// §6 — Greeting protocol (shared across modes)
|
|
@@ -189,6 +198,7 @@ When the user sends a generic greeting ("hey", "hi", "hello", "start"), respond
|
|
|
189
198
|
• 🔍 Search for job opportunities
|
|
190
199
|
• 📊 Check my job pipeline / tracker
|
|
191
200
|
• ✉️ Draft a cover letter or tailor my resume
|
|
201
|
+
• 🎙 Start an AI mock interview (voice or text)
|
|
192
202
|
• 📈 Get an overview of my job search progress
|
|
193
203
|
• 🗓️ Pick up where we left off
|
|
194
204
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* start_interview tool — launches a live `cv interview` session
|
|
3
|
+
* from within the agent REPL.
|
|
4
|
+
*
|
|
5
|
+
* The tool spawns the interview subprocess with the terminal attached
|
|
6
|
+
* (stdio: "inherit") so the user gets the full interactive voice/text
|
|
7
|
+
* experience without leaving the agent session. When the interview ends
|
|
8
|
+
* the agent picks up again and can discuss results, next steps, etc.
|
|
9
|
+
*/
|
|
10
|
+
import { Tool } from "../Tool.js";
|
|
11
|
+
export declare const StartInterviewTool: Tool;
|
|
12
|
+
export declare const ALL_INTERVIEW_TOOLS: Tool[];
|
|
13
|
+
//# sourceMappingURL=interview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interview.d.ts","sourceRoot":"","sources":["../../../src/agent/tools/interview.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AA4DlC,eAAO,MAAM,kBAAkB,EAAE,IAwDhC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,IAAI,EAAyB,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* start_interview tool — launches a live `cv interview` session
|
|
3
|
+
* from within the agent REPL.
|
|
4
|
+
*
|
|
5
|
+
* The tool spawns the interview subprocess with the terminal attached
|
|
6
|
+
* (stdio: "inherit") so the user gets the full interactive voice/text
|
|
7
|
+
* experience without leaving the agent session. When the interview ends
|
|
8
|
+
* the agent picks up again and can discuss results, next steps, etc.
|
|
9
|
+
*/
|
|
10
|
+
import { spawn } from "child_process";
|
|
11
|
+
import { Type } from "@google/genai";
|
|
12
|
+
/** Resolve the `cv` binary that is currently running this process. */
|
|
13
|
+
function getCvBin() {
|
|
14
|
+
// process.argv[1] is the entry-point JS file.
|
|
15
|
+
// When installed globally via npm, `cv` is a shell wrapper that calls
|
|
16
|
+
// the same binary — we can just re-use process.argv[0] (node) + argv[1].
|
|
17
|
+
// But the cleanest approach is to call the same node + script directly.
|
|
18
|
+
return process.argv[1]; // absolute path to dist/index.js
|
|
19
|
+
}
|
|
20
|
+
async function runInterview(args) {
|
|
21
|
+
return new Promise((resolve) => {
|
|
22
|
+
const argv = [
|
|
23
|
+
getCvBin(),
|
|
24
|
+
"interview",
|
|
25
|
+
"--role", args.role,
|
|
26
|
+
];
|
|
27
|
+
if (args.mode === "text")
|
|
28
|
+
argv.push("--text");
|
|
29
|
+
if (args.questions && args.questions > 0) {
|
|
30
|
+
argv.push("--questions", String(args.questions));
|
|
31
|
+
}
|
|
32
|
+
if (args.resume_id)
|
|
33
|
+
argv.push("--resume", args.resume_id);
|
|
34
|
+
// Inherit the terminal so the full interactive TUI works.
|
|
35
|
+
const child = spawn(process.execPath, argv, {
|
|
36
|
+
stdio: "inherit",
|
|
37
|
+
env: process.env,
|
|
38
|
+
});
|
|
39
|
+
child.on("close", (code) => {
|
|
40
|
+
if (code === 0) {
|
|
41
|
+
resolve(`✅ Interview session for "${args.role}" completed.\n` +
|
|
42
|
+
`The user has received their feedback report above.\n` +
|
|
43
|
+
`You may now discuss their performance, suggest areas for improvement, ` +
|
|
44
|
+
`help them prep specific STAR stories, or start another session.`);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
resolve(`⚠️ Interview session ended with exit code ${code ?? "unknown"}.\n` +
|
|
48
|
+
`This is normal if the user pressed Ctrl+C to end early. ` +
|
|
49
|
+
`Ask if they'd like to start another session or discuss their responses.`);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
child.on("error", (err) => {
|
|
53
|
+
resolve(`❌ Failed to launch interview session: ${err.message}`);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
export const StartInterviewTool = {
|
|
58
|
+
name: "start_interview",
|
|
59
|
+
description: `Launch a live AI mock interview session for the user.
|
|
60
|
+
|
|
61
|
+
Use this tool when the user says ANYTHING like:
|
|
62
|
+
- "Start an interview", "practice interview", "mock interview"
|
|
63
|
+
- "Interview me for [role]", "prep me for [company] interview"
|
|
64
|
+
- "I have an interview at [company], let's practice"
|
|
65
|
+
- "Start a voice interview", "text interview"
|
|
66
|
+
|
|
67
|
+
HOW IT WORKS:
|
|
68
|
+
- Launches the full interactive \`cv interview\` session directly in the terminal.
|
|
69
|
+
- The user speaks (voice mode) or types (text mode) their answers to Vivid, the AI interviewer.
|
|
70
|
+
- At the end, a feedback report with scores and improvement tips is displayed automatically.
|
|
71
|
+
- You (the agent) can then discuss results, coach on weak areas, help build STAR stories, etc.
|
|
72
|
+
|
|
73
|
+
CREDIT COST: 2 credits/minute (minimum 2, capped at 60). Text mode uses ~1 credit flat.
|
|
74
|
+
|
|
75
|
+
DEFAULTS:
|
|
76
|
+
- mode defaults to "voice" (requires sox). Suggest "text" if user is on a server / no mic.
|
|
77
|
+
- questions defaults to 5.`,
|
|
78
|
+
parameters: {
|
|
79
|
+
type: Type.OBJECT,
|
|
80
|
+
properties: {
|
|
81
|
+
role: {
|
|
82
|
+
type: Type.STRING,
|
|
83
|
+
description: "The job role to interview for, e.g. 'Senior Software Engineer', 'Product Manager', 'Data Scientist'.",
|
|
84
|
+
},
|
|
85
|
+
mode: {
|
|
86
|
+
type: Type.STRING,
|
|
87
|
+
enum: ["voice", "text"],
|
|
88
|
+
description: "Interview mode. 'voice' = real-time speech (default, requires sox). 'text' = text-only fallback.",
|
|
89
|
+
},
|
|
90
|
+
questions: {
|
|
91
|
+
type: Type.INTEGER,
|
|
92
|
+
description: "Number of interview questions to generate (1–10). Default: 5.",
|
|
93
|
+
},
|
|
94
|
+
resume_id: {
|
|
95
|
+
type: Type.STRING,
|
|
96
|
+
description: "Optional. CareerVivid resume ID to load as context. The AI will tailor questions to the user's actual background.",
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
required: ["role"],
|
|
100
|
+
},
|
|
101
|
+
requiresConfirmation: false,
|
|
102
|
+
execute: async (args) => {
|
|
103
|
+
return runInterview(args);
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
export const ALL_INTERVIEW_TOOLS = [StartInterviewTool];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cv admin — Admin-only commands: log inspection, audit, diagnostics.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* cv admin logs Last 100 events across all features
|
|
6
|
+
* cv admin logs --feature interview Interview events only
|
|
7
|
+
* cv admin logs --feature interview --level error Errors only
|
|
8
|
+
* cv admin logs --uid <userId> Events for a specific user
|
|
9
|
+
* cv admin logs --since 2025-01-01 Events since a date
|
|
10
|
+
* cv admin logs --limit 50 Custom limit (max 500)
|
|
11
|
+
* cv admin logs --json Raw JSON output (pipe-friendly)
|
|
12
|
+
*
|
|
13
|
+
* Access: requires `role: "admin"` on the caller's Firestore user document.
|
|
14
|
+
* Feature logs are written by cli/src/lib/logger.ts and stored in Firestore cliLogs.
|
|
15
|
+
*/
|
|
16
|
+
import { Command } from "commander";
|
|
17
|
+
export declare function registerAdminCommand(program: Command): void;
|
|
18
|
+
//# sourceMappingURL=admin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../src/commands/admin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA6FpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAoH3D"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cv admin — Admin-only commands: log inspection, audit, diagnostics.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* cv admin logs Last 100 events across all features
|
|
6
|
+
* cv admin logs --feature interview Interview events only
|
|
7
|
+
* cv admin logs --feature interview --level error Errors only
|
|
8
|
+
* cv admin logs --uid <userId> Events for a specific user
|
|
9
|
+
* cv admin logs --since 2025-01-01 Events since a date
|
|
10
|
+
* cv admin logs --limit 50 Custom limit (max 500)
|
|
11
|
+
* cv admin logs --json Raw JSON output (pipe-friendly)
|
|
12
|
+
*
|
|
13
|
+
* Access: requires `role: "admin"` on the caller's Firestore user document.
|
|
14
|
+
* Feature logs are written by cli/src/lib/logger.ts and stored in Firestore cliLogs.
|
|
15
|
+
*/
|
|
16
|
+
import chalk from "chalk";
|
|
17
|
+
import { getApiKey } from "../config.js";
|
|
18
|
+
// ─── Constants ────────────────────────────────────────────────────────────────
|
|
19
|
+
const CLI_GET_LOGS_URL = process.env.CV_FUNCTIONS_URL
|
|
20
|
+
? `${process.env.CV_FUNCTIONS_URL}/cliGetLogs`
|
|
21
|
+
: "https://us-west1-jastalk-firebase.cloudfunctions.net/cliGetLogs";
|
|
22
|
+
// ─── Level styling ────────────────────────────────────────────────────────────
|
|
23
|
+
function levelBadge(level) {
|
|
24
|
+
switch (level) {
|
|
25
|
+
case "error": return chalk.bgRed.white.bold(" ERR ");
|
|
26
|
+
case "warn": return chalk.bgYellow.black.bold(" WRN ");
|
|
27
|
+
case "info": return chalk.bgBlue.white.bold(" INF ");
|
|
28
|
+
case "debug": return chalk.bgGray.white.bold(" DBG ");
|
|
29
|
+
default: return chalk.bgGray.white.bold(` ${level.toUpperCase().slice(0, 3)} `);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function featureBadge(feature) {
|
|
33
|
+
const colors = {
|
|
34
|
+
interview: (s) => chalk.hex("#4f46e5").bold(s),
|
|
35
|
+
agent: (s) => chalk.hex("#059669").bold(s),
|
|
36
|
+
resume: (s) => chalk.hex("#d97706").bold(s),
|
|
37
|
+
jobs: (s) => chalk.hex("#dc2626").bold(s),
|
|
38
|
+
};
|
|
39
|
+
const fn = colors[feature] ?? ((s) => chalk.gray.bold(s));
|
|
40
|
+
return fn(`[${feature}]`);
|
|
41
|
+
}
|
|
42
|
+
function dim(s) { return chalk.dim(s); }
|
|
43
|
+
// ─── Display helpers ──────────────────────────────────────────────────────────
|
|
44
|
+
function formatEvent(e, verbose) {
|
|
45
|
+
const ts = dim(new Date(e.clientTime ?? e.serverTime ?? 0).toISOString().replace("T", " ").slice(0, 19));
|
|
46
|
+
const badge = levelBadge(e.level ?? "info");
|
|
47
|
+
const feat = featureBadge(e.feature ?? "?");
|
|
48
|
+
const evt = chalk.white(e.event ?? "unknown");
|
|
49
|
+
const sid = e.sessionId ? dim(` sid:${String(e.sessionId).slice(0, 8)}…`) : "";
|
|
50
|
+
const ver = dim(` v${e.cliVersion ?? "?"}`);
|
|
51
|
+
console.log(` ${ts} ${badge} ${feat} ${evt}${sid}${ver}`);
|
|
52
|
+
if (e.errorMessage) {
|
|
53
|
+
console.log(` ${chalk.red("↳ " + e.errorMessage)}`);
|
|
54
|
+
if (verbose && e.errorStack) {
|
|
55
|
+
const stack = e.errorStack.split("\n").slice(1, 4).join("\n ");
|
|
56
|
+
console.log(chalk.red(` ${stack}`));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (verbose && e.metadata && Object.keys(e.metadata).length > 0) {
|
|
60
|
+
const json = JSON.stringify(e.metadata, null, 2)
|
|
61
|
+
.split("\n").map(l => ` ${chalk.dim(l)}`).join("\n");
|
|
62
|
+
console.log(json);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function printHeader(filters) {
|
|
66
|
+
console.log("\n" + chalk.bgHex("#4f46e5").white.bold(" CareerVivid — CLI Logs "));
|
|
67
|
+
const parts = [
|
|
68
|
+
filters.feature ? chalk.cyan(`feature=${filters.feature}`) : chalk.dim("feature=*"),
|
|
69
|
+
filters.level ? chalk.yellow(`level=${filters.level}`) : chalk.dim("level=*"),
|
|
70
|
+
filters.uid ? chalk.magenta(`uid=${filters.uid.slice(0, 8)}…`) : chalk.dim("uid=*"),
|
|
71
|
+
filters.since ? chalk.green(`since=${filters.since}`) : chalk.dim("since=all"),
|
|
72
|
+
chalk.dim(`limit=${filters.limit}`),
|
|
73
|
+
];
|
|
74
|
+
console.log(" " + parts.join(chalk.dim(" · ")));
|
|
75
|
+
console.log(chalk.dim(" " + "─".repeat(78)));
|
|
76
|
+
}
|
|
77
|
+
function printSummary(events) {
|
|
78
|
+
const counts = {};
|
|
79
|
+
for (const e of events)
|
|
80
|
+
counts[e.level ?? "info"] = (counts[e.level ?? "info"] || 0) + 1;
|
|
81
|
+
const parts = Object.entries(counts).map(([l, n]) => `${levelBadge(l)} ${n}`);
|
|
82
|
+
console.log(chalk.dim("\n " + "─".repeat(78)));
|
|
83
|
+
console.log(` ${chalk.bold("Total:")} ${events.length} events ${parts.join(" ")}`);
|
|
84
|
+
const errorCount = counts["error"] ?? 0;
|
|
85
|
+
if (errorCount > 0) {
|
|
86
|
+
console.log(chalk.red.bold(`\n ⚠ ${errorCount} error${errorCount > 1 ? "s" : ""} found. Run with --level error to filter.`));
|
|
87
|
+
}
|
|
88
|
+
console.log("");
|
|
89
|
+
}
|
|
90
|
+
// ─── Command registration ──────────────────────────────────────────────────────
|
|
91
|
+
export function registerAdminCommand(program) {
|
|
92
|
+
const admin = program
|
|
93
|
+
.command("admin", { hidden: true }) // hidden from public --help
|
|
94
|
+
.description("Admin-only commands — requires admin role");
|
|
95
|
+
admin
|
|
96
|
+
.command("logs")
|
|
97
|
+
.description("Fetch and inspect CLI event logs")
|
|
98
|
+
.option("-f, --feature <name>", "Filter by feature (interview, agent, resume, jobs, …)")
|
|
99
|
+
.option("-l, --level <level>", "Filter by level (error, warn, info)")
|
|
100
|
+
.option("--uid <userId>", "Filter by specific user UID")
|
|
101
|
+
.option("--since <date>", "Only show logs after this date (ISO format: 2025-01-01)")
|
|
102
|
+
.option("-n, --limit <n>", "Number of log batches to fetch (default 100, max 500)", "100")
|
|
103
|
+
.option("--verbose", "Show full metadata and stack traces")
|
|
104
|
+
.option("--json", "Output raw JSON (pipe-friendly)")
|
|
105
|
+
.addHelpText("after", `
|
|
106
|
+
Examples:
|
|
107
|
+
cv admin logs
|
|
108
|
+
cv admin logs --feature interview
|
|
109
|
+
cv admin logs --feature interview --level error
|
|
110
|
+
cv admin logs --level error --limit 50
|
|
111
|
+
cv admin logs --uid abc123def456
|
|
112
|
+
cv admin logs --since 2025-01-01
|
|
113
|
+
cv admin logs --feature interview --json | jq '.[] | select(.level=="error")'
|
|
114
|
+
`)
|
|
115
|
+
.action(async (opts) => {
|
|
116
|
+
const apiKey = getApiKey();
|
|
117
|
+
if (!apiKey) {
|
|
118
|
+
console.error(chalk.red("\n Not logged in. Run: cv login\n"));
|
|
119
|
+
process.exit(1);
|
|
120
|
+
}
|
|
121
|
+
const limit = Math.min(Math.max(parseInt(opts.limit, 10) || 100, 1), 500);
|
|
122
|
+
// ── Fetch logs ──────────────────────────────────────────────────
|
|
123
|
+
if (!opts.json) {
|
|
124
|
+
printHeader({ feature: opts.feature, level: opts.level, uid: opts.uid, since: opts.since, limit });
|
|
125
|
+
process.stdout.write(chalk.dim(" Fetching logs…\r"));
|
|
126
|
+
}
|
|
127
|
+
let result;
|
|
128
|
+
try {
|
|
129
|
+
const res = await fetch(CLI_GET_LOGS_URL, {
|
|
130
|
+
method: "POST",
|
|
131
|
+
headers: { "Content-Type": "application/json" },
|
|
132
|
+
body: JSON.stringify({
|
|
133
|
+
apiKey,
|
|
134
|
+
feature: opts.feature,
|
|
135
|
+
level: opts.level,
|
|
136
|
+
uid: opts.uid,
|
|
137
|
+
since: opts.since,
|
|
138
|
+
limit,
|
|
139
|
+
}),
|
|
140
|
+
});
|
|
141
|
+
result = await res.json();
|
|
142
|
+
if (res.status === 403) {
|
|
143
|
+
console.error(chalk.red("\n ✖ Admin access required.\n"));
|
|
144
|
+
process.exit(1);
|
|
145
|
+
}
|
|
146
|
+
if (!res.ok) {
|
|
147
|
+
throw new Error(result?.error ?? `HTTP ${res.status}`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
catch (err) {
|
|
151
|
+
console.error(chalk.red(`\n Failed to fetch logs: ${err.message}\n`));
|
|
152
|
+
process.exit(1);
|
|
153
|
+
}
|
|
154
|
+
// ── Flatten all events from all batches ─────────────────────────
|
|
155
|
+
const allEvents = [];
|
|
156
|
+
for (const batch of result.logs ?? []) {
|
|
157
|
+
for (const e of batch.events ?? []) {
|
|
158
|
+
allEvents.push({ ...e, _batchId: batch.batchId, _receivedAt: batch.receivedAt });
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
// ── Output ──────────────────────────────────────────────────────
|
|
162
|
+
if (opts.json) {
|
|
163
|
+
console.log(JSON.stringify(allEvents, null, 2));
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (allEvents.length === 0) {
|
|
167
|
+
process.stdout.write(" \r");
|
|
168
|
+
console.log(chalk.dim(" No log events found with the current filters.\n"));
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
process.stdout.write(" \r");
|
|
172
|
+
// Sort by clientTime ascending (oldest first for readability)
|
|
173
|
+
allEvents.sort((a, b) => {
|
|
174
|
+
const ta = new Date(a.clientTime || a._receivedAt || 0).getTime();
|
|
175
|
+
const tb = new Date(b.clientTime || b._receivedAt || 0).getTime();
|
|
176
|
+
return ta - tb;
|
|
177
|
+
});
|
|
178
|
+
for (const e of allEvents) {
|
|
179
|
+
formatEvent(e, !!opts.verbose);
|
|
180
|
+
}
|
|
181
|
+
printSummary(allEvents);
|
|
182
|
+
});
|
|
183
|
+
// Future subcommands can be added here:
|
|
184
|
+
// admin.command("sessions") — list interviewSessions
|
|
185
|
+
// admin.command("users") — user credit audit
|
|
186
|
+
// admin.command("billing") — billing reconciliation
|
|
187
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolRegistry.d.ts","sourceRoot":"","sources":["../../../src/commands/agent/toolRegistry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"toolRegistry.d.ts","sourceRoot":"","sources":["../../../src/commands/agent/toolRegistry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAyO3C,wBAAgB,QAAQ,CAAC,OAAO,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,EAAE,CAiDhG"}
|
|
@@ -7,6 +7,7 @@ import { ALL_URL_VERIFIER_TOOLS } from "../../agent/tools/urlVerifier.js";
|
|
|
7
7
|
import { ALL_PORTFOLIO_TOOLS } from "../../agent/tools/portfolio.js";
|
|
8
8
|
import { ALL_COVERLETTER_TOOLS } from "../../agent/tools/coverLetter.js";
|
|
9
9
|
import { ALL_JOB_OPENINGS_TOOLS } from "../../agent/tools/jobOpenings.js";
|
|
10
|
+
import { ALL_INTERVIEW_TOOLS } from "../../agent/tools/interview.js";
|
|
10
11
|
import { publishSingleFile } from "../publish.js";
|
|
11
12
|
// ── Publish tools ─────────────────────────────────────────────────────────────
|
|
12
13
|
const PublishArticleTool = {
|
|
@@ -242,6 +243,10 @@ export function getTools(options) {
|
|
|
242
243
|
if (!tools.find((x) => x.name === t.name))
|
|
243
244
|
tools.push(t);
|
|
244
245
|
}
|
|
246
|
+
for (const t of ALL_INTERVIEW_TOOLS) {
|
|
247
|
+
if (!tools.find((x) => x.name === t.name))
|
|
248
|
+
tools.push(t);
|
|
249
|
+
}
|
|
245
250
|
return tools;
|
|
246
251
|
}
|
|
247
252
|
if (options.resume) {
|
|
@@ -266,5 +271,5 @@ export function getTools(options) {
|
|
|
266
271
|
return tools;
|
|
267
272
|
}
|
|
268
273
|
// Default coding mode: file system + publish tools
|
|
269
|
-
return [...ALL_CODING_TOOLS, PublishArticleTool, GenerateDiagramTool, ...ALL_COVERLETTER_TOOLS];
|
|
274
|
+
return [...ALL_CODING_TOOLS, PublishArticleTool, GenerateDiagramTool, ...ALL_COVERLETTER_TOOLS, ...ALL_INTERVIEW_TOOLS];
|
|
270
275
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cv interview — interactive AI mock interview with real-time voice audio.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* cv interview Prompt for role interactively (voice mode)
|
|
6
|
+
* cv interview --role "Sr SWE" Specify role directly (voice mode)
|
|
7
|
+
* cv interview --role "PM" --text Text-only fallback (no audio required)
|
|
8
|
+
* cv interview --role "SDE" --resume <id> Load resume for context
|
|
9
|
+
*
|
|
10
|
+
* Voice mode requires sox (handles both mic input and speaker output):
|
|
11
|
+
* macOS: brew install sox
|
|
12
|
+
* Linux: sudo apt install sox
|
|
13
|
+
*
|
|
14
|
+
* AI calls:
|
|
15
|
+
* - Token vend: cliGetInterviewToken Cloud Function (validates cv_live_ key, deducts credits)
|
|
16
|
+
* - Voice session: gemini-3.1-flash-live-preview via @google/genai Live API (direct WebSocket)
|
|
17
|
+
* - Feedback: agentProxy Cloud Function (standard HTTP, existing pattern)
|
|
18
|
+
*/
|
|
19
|
+
import { Command } from "commander";
|
|
20
|
+
export declare function registerInterviewCommand(program: Command): void;
|
|
21
|
+
//# sourceMappingURL=interview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interview.d.ts","sourceRoot":"","sources":["../../src/commands/interview.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA4rBpC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAmG/D"}
|