careervivid 1.11.0 → 1.11.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.
@@ -6,6 +6,10 @@ export interface QueryEngineOptions {
6
6
  systemInstruction?: string;
7
7
  tools?: Tool[];
8
8
  apiKey?: string;
9
+ /** GCP project ID for Vertex AI mode (uses gcloud ADC, no API key needed). */
10
+ project?: string;
11
+ /** GCP region for Vertex AI. Default: us-central1 */
12
+ location?: string;
9
13
  /** Max thinking tokens for Gemini 2.5+. Set to 0 to disable. Default: 8192 */
10
14
  thinkingBudget?: number;
11
15
  /** Show raw thinking text in onThinking hook. Default: false */
@@ -1 +1 @@
1
- {"version":3,"file":"QueryEngine.d.ts","sourceRoot":"","sources":["../../src/agent/QueryEngine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,uBAAuB,EAAE,OAAO,EAAQ,MAAM,eAAe,CAAC;AACpF,OAAO,EAAE,IAAI,EAAsB,MAAM,WAAW,CAAC;AAMrD,eAAO,MAAM,0BAA0B,QA8B/B,CAAC;AAMT,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gEAAgE;IAChE,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,wEAAwE;IACxE,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,uBAAuB,KAAK,IAAI,CAAC;IACzD,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,O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MAAM,IAAI,CAAC;CAC3B;AAyCD;;;;GAIG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,EAAE,CAAc;IACxB,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,eAAe,CAAU;IACjC,OAAO,CAAC,gBAAgB,CAAS;gBAErB,OAAO,GAAE,kBAAuB;IAyBrC,UAAU,IAAI,OAAO,EAAE;IAIvB,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE;IAIpC,8CAA8C;IACvC,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE;IAW7B,OAAO,CAAC,mBAAmB;YAcb,YAAY;YAOZ,gBAAgB;IA6DjB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;IA8E5E;;;;OAIG;IACU,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;CA2EtF"}
@@ -84,8 +84,21 @@ export class QueryEngine {
84
84
  includeThoughts;
85
85
  maxHistoryLength;
86
86
  constructor(options = {}) {
87
- this.ai = new GoogleGenAI({ apiKey: options.apiKey });
88
- this.model = options.model || 'gemini-2.5-flash';
87
+ const apiKey = options.apiKey;
88
+ const project = options.project ?? process.env.GOOGLE_CLOUD_PROJECT ?? process.env.GCLOUD_PROJECT;
89
+ const location = options.location ?? process.env.GOOGLE_CLOUD_LOCATION ?? 'us-central1';
90
+ const useVertexAI = !apiKey && !!project;
91
+ if (useVertexAI) {
92
+ // Vertex AI mode — uses gcloud Application Default Credentials
93
+ this.ai = new GoogleGenAI({ vertexai: true, project, location });
94
+ // Vertex AI uses a different model namespace
95
+ this.model = options.model || 'gemini-2.5-flash-preview-04-17';
96
+ }
97
+ else {
98
+ // Gemini API mode — requires an API key
99
+ this.ai = new GoogleGenAI({ apiKey: apiKey || '' });
100
+ this.model = options.model || 'gemini-2.5-flash';
101
+ }
89
102
  this.systemInstruction = options.systemInstruction || CODING_AGENT_SYSTEM_PROMPT;
90
103
  this.tools = options.tools || [];
91
104
  this.toolMap = new Map(this.tools.map(t => [t.name, t]));
@@ -1 +1 @@
1
- {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/commands/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAyFpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QAyJpD"}
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/commands/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAyFpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QA2KpD"}
@@ -1,6 +1,6 @@
1
1
  import chalk from "chalk";
2
2
  import pkg from "enquirer";
3
- import { getApiKey } from "../config.js";
3
+ import { getGeminiKey } from "../config.js";
4
4
  import { QueryEngine, CODING_AGENT_SYSTEM_PROMPT } from "../agent/QueryEngine.js";
5
5
  import { ALL_CODING_TOOLS, readFileTool, } from "../agent/tools/coding.js";
6
6
  import { publishSingleFile } from "./publish.js";
@@ -71,11 +71,24 @@ export function registerAgentCommand(program) {
71
71
  .option("--coding", "Enable full coding tool suite (file I/O, shell, search).")
72
72
  .option("--think <budget>", "Enable Gemini thinking mode with the given token budget (e.g. 8192).", parseInt)
73
73
  .option("--verbose", "Show thinking tokens in the output (requires --think).")
74
+ .option("--project <id>", "GCP project ID for Vertex AI mode (uses gcloud ADC, no API key needed).")
74
75
  .action(async (options) => {
75
- const apiKey = getApiKey();
76
- if (!apiKey) {
77
- console.log(chalk.red("❌ Missing API key."));
78
- console.log(`Run ${chalk.yellow("cv login")} or set the API key manually.`);
76
+ const apiKey = getGeminiKey();
77
+ const project = options.project ?? process.env.GOOGLE_CLOUD_PROJECT;
78
+ if (!apiKey && !project) {
79
+ console.log(chalk.red("\n❌ No Gemini credentials found."));
80
+ console.log("");
81
+ console.log(chalk.bold("Pick one of these options:"));
82
+ console.log();
83
+ console.log(chalk.cyan(" Option A — Gemini API Key (free tier, easiest):"));
84
+ console.log(chalk.yellow(" 1. Get a free key: https://aistudio.google.com/app/apikey"));
85
+ console.log(chalk.yellow(" 2. cv config set geminiKey YOUR_KEY"));
86
+ console.log(chalk.yellow(" 3. cv agent --coding"));
87
+ console.log();
88
+ console.log(chalk.cyan(" Option B — gcloud ADC (no key needed):"));
89
+ console.log(chalk.yellow(" 1. gcloud auth application-default login"));
90
+ console.log(chalk.yellow(" 2. cv agent --coding --project YOUR_GCP_PROJECT_ID"));
91
+ console.log();
79
92
  process.exit(1);
80
93
  }
81
94
  // ------------------------------------------------------------------
@@ -93,7 +106,8 @@ export function registerAgentCommand(program) {
93
106
  const thinkingBudget = options.think ?? 0;
94
107
  const includeThoughts = Boolean(options.verbose);
95
108
  const engine = new QueryEngine({
96
- apiKey,
109
+ apiKey: apiKey || undefined,
110
+ project: project || undefined,
97
111
  model: "gemini-2.5-flash",
98
112
  systemInstruction: CODING_AGENT_SYSTEM_PROMPT,
99
113
  tools,
@@ -101,6 +115,9 @@ export function registerAgentCommand(program) {
101
115
  includeThoughts,
102
116
  maxHistoryLength: 40,
103
117
  });
118
+ // Banner shows which auth mode is active
119
+ const authMode = apiKey ? `API key (${apiKey.slice(0, 8)}…)` : `Vertex AI / ADC (${project})`;
120
+ console.log(chalk.gray(` Auth: ${authMode}`));
104
121
  // ------------------------------------------------------------------
105
122
  // Banner
106
123
  // ------------------------------------------------------------------
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAoG5D"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAyG5D"}
@@ -9,7 +9,7 @@
9
9
  import chalk from "chalk";
10
10
  import { CONFIG_FILE, loadConfig, setConfigValue } from "../config.js";
11
11
  import { printError, printSuccess } from "../output.js";
12
- const VALID_KEYS = ["apiKey", "apiUrl"];
12
+ const VALID_KEYS = ["apiKey", "apiUrl", "geminiKey"];
13
13
  export function registerConfigCommand(program) {
14
14
  const config = program
15
15
  .command("config")
@@ -40,10 +40,15 @@ export function registerConfigCommand(program) {
40
40
  }
41
41
  if (cfg.apiKey) {
42
42
  const masked = `${cfg.apiKey.slice(0, 16)}${"•".repeat(cfg.apiKey.length - 16)}`;
43
- console.log(` ${chalk.dim("apiKey".padEnd(10))} ${masked}`);
43
+ console.log(` ${chalk.dim("apiKey".padEnd(12))} ${masked}`);
44
+ }
45
+ if (cfg.geminiKey) {
46
+ const gk = cfg.geminiKey;
47
+ const maskedGk = `${gk.slice(0, 8)}${"•".repeat(Math.max(0, gk.length - 8))}`;
48
+ console.log(` ${chalk.dim("geminiKey".padEnd(12))} ${maskedGk}`);
44
49
  }
45
50
  if (cfg.apiUrl) {
46
- console.log(` ${chalk.dim("apiUrl".padEnd(10))} ${cfg.apiUrl}`);
51
+ console.log(` ${chalk.dim("apiUrl".padEnd(12))} ${cfg.apiUrl}`);
47
52
  }
48
53
  console.log();
49
54
  });
@@ -69,9 +74,10 @@ export function registerConfigCommand(program) {
69
74
  }
70
75
  return;
71
76
  }
72
- // Mask apiKey
73
- const displayValue = key === "apiKey"
74
- ? `${value.slice(0, 16)}${"•".repeat(value.length - 16)}`
77
+ // Mask all sensitive keys — never print raw values to the terminal
78
+ const SENSITIVE_KEYS = new Set(["apiKey", "geminiKey"]);
79
+ const displayValue = SENSITIVE_KEYS.has(key)
80
+ ? `${value.slice(0, 8)}${"•".repeat(Math.max(0, value.length - 8))}`
75
81
  : value;
76
82
  if (jsonMode) {
77
83
  console.log(JSON.stringify({ key, value: displayValue }));
package/dist/config.d.ts CHANGED
@@ -10,10 +10,13 @@ export declare const DEFAULT_API_URL = "https://careervivid.app/api";
10
10
  export interface CareerVividConfig {
11
11
  apiKey?: string;
12
12
  apiUrl?: string;
13
+ geminiKey?: string;
13
14
  }
14
15
  export declare function loadConfig(): CareerVividConfig;
15
16
  export declare function saveConfig(config: CareerVividConfig): void;
16
17
  export declare function getApiKey(): string | undefined;
18
+ /** Gemini API key used by `cv agent`. Priority: GEMINI_API_KEY env var > geminiKey in config. */
19
+ export declare function getGeminiKey(): string | undefined;
17
20
  export declare function getApiUrl(): string;
18
21
  export declare function setConfigValue(key: keyof CareerVividConfig, value: string): void;
19
22
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,eAAO,MAAM,WAAW,QAAyC,CAAC;AAElE,eAAO,MAAM,eAAe,gCAAgC,CAAC;AAE7D,MAAM,WAAW,iBAAiB;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,UAAU,IAAI,iBAAiB,CAQ9C;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAE1D;AAED,wBAAgB,SAAS,IAAI,MAAM,GAAG,SAAS,CAG9C;AAED,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,iBAAiB,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAIhF"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,eAAO,MAAM,WAAW,QAAyC,CAAC;AAElE,eAAO,MAAM,eAAe,gCAAgC,CAAC;AAE7D,MAAM,WAAW,iBAAiB;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,UAAU,IAAI,iBAAiB,CAQ9C;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAE1D;AAED,wBAAgB,SAAS,IAAI,MAAM,GAAG,SAAS,CAG9C;AAED,iGAAiG;AACjG,wBAAgB,YAAY,IAAI,MAAM,GAAG,SAAS,CAEjD;AAED,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,iBAAiB,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAIhF"}
package/dist/config.js CHANGED
@@ -28,6 +28,10 @@ export function getApiKey() {
28
28
  // Priority: env var > config file
29
29
  return process.env.CV_API_KEY || loadConfig().apiKey;
30
30
  }
31
+ /** Gemini API key used by `cv agent`. Priority: GEMINI_API_KEY env var > geminiKey in config. */
32
+ export function getGeminiKey() {
33
+ return process.env.GEMINI_API_KEY || loadConfig().geminiKey;
34
+ }
31
35
  export function getApiUrl() {
32
36
  return process.env.CV_API_URL || loadConfig().apiUrl || DEFAULT_API_URL;
33
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "careervivid",
3
- "version": "1.11.0",
3
+ "version": "1.11.2",
4
4
  "description": "Official CLI for CareerVivid — publish articles, diagrams, and portfolio updates from your terminal or AI agent",
5
5
  "type": "module",
6
6
  "bin": {