@polka-codes/cli 0.6.4 → 0.6.6

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.
Files changed (3) hide show
  1. package/README.md +143 -49
  2. package/dist/index.js +88 -58
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -7,97 +7,191 @@
7
7
  [![Bun Version](https://img.shields.io/badge/Bun-v1.0.0+-brightgreen)](https://bun.sh)
8
8
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue)](https://www.typescriptlang.org)
9
9
 
10
- The Polka Codes CLI provides a powerful command-line interface for interacting with the Polka Codes AI coding assistant framework.
10
+ The Polka Codes CLI provides a powerful command-line interface for interacting with AI-powered coding assistants. It offers features like interactive chat, task execution, commit message generation, and pull request creation.
11
11
 
12
12
  ## Installation
13
13
 
14
- ### Global Installation
15
-
16
14
  ```bash
15
+ # Install globally with npm
17
16
  npm install -g @polka-codes/cli
18
- ```
19
17
 
20
- ### Run Directly
18
+ # Install globally with yarn
19
+ yarn global add @polka-codes/cli
21
20
 
22
- ```bash
21
+ # Install globally with bun
22
+ bun add -g @polka-codes/cli
23
+
24
+ # Or run directly with npx
23
25
  npx @polka-codes/cli
24
26
  ```
25
27
 
26
- ## Usage
28
+ ## Commands
29
+
30
+ ### Interactive Chat
27
31
 
28
- ### Basic Commands
32
+ Start an interactive chat session with the AI assistant:
29
33
 
30
34
  ```bash
31
- # Run interactive session
32
- polka-codes
35
+ polka chat
36
+ # or simply
37
+ polka
38
+ ```
33
39
 
34
- # Run specific task
35
- pokla task "improve readme"
40
+ ### Task Execution
36
41
 
37
- # Create config file
38
- pokla config
42
+ Execute a specific task:
39
43
 
40
- # Generate commit message
41
- pokla commit
44
+ ```bash
45
+ polka task "improve error handling in auth module"
46
+ # or pipe input
47
+ echo "optimize database queries" | polka task
42
48
  ```
43
49
 
44
- ### Commit Command
50
+ ### Project Creation
45
51
 
46
- The `commit` subcommand helps generate meaningful commit messages based on your staged changes:
52
+ Create a new project with AI assistance:
47
53
 
48
54
  ```bash
49
- # Generate commit message for staged changes
50
- pokla commit
55
+ polka create my-project
56
+ ```
51
57
 
52
- # Generate commit message with specific context
53
- pokla commit "closes issue #123"
58
+ The command will:
59
+ 1. Prompt for project location confirmation
60
+ 2. Set up initial project structure
61
+ 3. Configure basic dependencies
62
+ 4. Generate starter code
63
+
64
+ ### Configuration
54
65
 
66
+ Initialize Polka Codes configuration:
67
+
68
+ ```bash
69
+ # Create local config
70
+ polka init
71
+
72
+ # Create global config
73
+ polka init --global
55
74
  ```
56
75
 
57
- ### PR Command
76
+ ### Git Integration
58
77
 
59
- Create a GitHub pull request with AI-generated details:
78
+ Generate commit messages based on staged changes:
60
79
 
61
80
  ```bash
62
- pokla pr "optional message. e.g. closes #123"
81
+ # Generate commit message for staged changes
82
+ polka commit
83
+
84
+ # Generate commit message with context
85
+ polka commit "closes #123"
86
+
87
+ # Stage all changes and commit
88
+ polka commit -a
63
89
  ```
64
90
 
65
- ### Configuration
91
+ Create pull requests with AI-generated details:
66
92
 
67
- Create a `.polkacodes.yml` file in your project root:
93
+ ```bash
94
+ # Create PR with current branch changes
95
+ polka pr
68
96
 
69
- ```yaml
70
- # Example configuration
71
- provider: deepseek
72
- modelId: deepseek-chat
73
- commands: # a set of available commands for the AI assistant
74
- check: bun check # command
75
- test: # command name
76
- command: bun test # command to execute
77
- description: Run tests. Pass file path to run a specific test file. # description of the command
78
- rules: |
79
- Additional rules for the AI assistant.
97
+ # Create PR with additional context
98
+ polka pr "implements feature #456"
80
99
  ```
81
100
 
82
- ### AI Configuration
101
+ ## Configuration
83
102
 
84
- Supported providers
85
- 1. DeepSeek / `deepseek` (recommended)
86
- 2. Anthropic / `anthropic` (Sonnet 3.5 recommended)
87
- 3. OpenRouter / `openrouter`
88
- 4. Ollama / `ollama`
103
+ ### Provider Setup
89
104
 
90
- Configure the AI service by creating a `.env` file in your project root:
105
+ Polka Codes supports multiple AI providers:
106
+
107
+ 1. DeepSeek (Recommended)
108
+ 2. Anthropic (Claude 3 Sonnet recommended)
109
+ 3. OpenRouter
110
+ 4. Ollama
111
+
112
+ Configure your provider in `.env`:
91
113
 
92
114
  ```bash
115
+ # Required
93
116
  POLKA_API_KEY=your_api_key_here
94
117
 
95
- # Optional - override default model
96
- POLKA_API_PROVIDER=deepseek # or anthropic, ollama
118
+ # Optional - override defaults
119
+ POLKA_API_PROVIDER=deepseek # or anthropic, openrouter, ollama
97
120
  POLKA_AI_MODEL_ID=deepseek-chat # or claude-3-sonnet-20240229
98
121
  ```
99
122
 
100
- ---
123
+ ### Project Configuration
124
+
125
+ Create `.polkacodes.yml` in your project root:
126
+
127
+ ```yaml
128
+ # AI provider settings
129
+ provider: deepseek # default provider
130
+ modelId: deepseek-chat # default model
131
+
132
+ # Custom commands available to AI
133
+ commands:
134
+ test:
135
+ command: bun test
136
+ description: Run tests. Pass file path to run specific tests.
137
+ check:
138
+ command: bun typecheck
139
+ description: Run type checker
140
+ format:
141
+ command: bun fix
142
+ description: Format code
143
+
144
+ # Additional rules/guidelines for AI
145
+ rules: |
146
+ - Use TypeScript for all new files
147
+ - Follow project's existing code style
148
+ - Add tests for new features
149
+ ```
150
+
151
+ ### Global vs Local Configuration
152
+
153
+ - Global config (`~/.config/polkacodes/config.yml`): Store API keys and default settings
154
+ - Local config (`.polkacodes.yml`): Project-specific settings and commands
101
155
 
156
+ ## Features
157
+
158
+ - 🤖 Multiple AI provider support
159
+ - 💬 Interactive chat mode
160
+ - 🎯 Task-focused commands
161
+ - 🔄 Git workflow integration
162
+ - 📊 Project analysis and configuration
163
+ - 🛠️ Custom command integration
164
+ - 🔑 Secure API key management
165
+ - 📝 Detailed logging with `--verbose`
166
+
167
+ ## Usage Tips
168
+
169
+ 1. Use interactive mode for complex tasks:
170
+ ```bash
171
+ polka chat
172
+ ```
173
+
174
+ 2. Pipe tasks for automation:
175
+ ```bash
176
+ echo "update dependencies" | polka task
177
+ ```
178
+
179
+ 3. Combine with git workflow:
180
+ ```bash
181
+ git add . && polka commit && polka pr
182
+ ```
183
+
184
+ 4. Monitor AI usage:
185
+ ```bash
186
+ polka task "refactor auth" --verbose
187
+ ```
188
+
189
+ ## Requirements
190
+
191
+ - Node.js 18+
192
+ - Git (for commit/PR features)
193
+ - GitHub CLI (for PR creation)
194
+
195
+ ---
102
196
 
103
- *This README was generated by polka.codes*
197
+ *This README was generated by polka.codes*
package/dist/index.js CHANGED
@@ -24629,7 +24629,7 @@ var {
24629
24629
  Help
24630
24630
  } = import__.default;
24631
24631
  // package.json
24632
- var version = "0.6.4";
24632
+ var version = "0.6.6";
24633
24633
 
24634
24634
  // ../../node_modules/@anthropic-ai/sdk/version.mjs
24635
24635
  var VERSION = "0.36.2";
@@ -33291,7 +33291,8 @@ var toolInfo = {
33291
33291
  }
33292
33292
  ]
33293
33293
  }
33294
- ]
33294
+ ],
33295
+ permissionLevel: 0 /* None */
33295
33296
  };
33296
33297
  var handler = async (provider, args2) => {
33297
33298
  if (!provider.askFollowupQuestion) {
@@ -33339,7 +33340,8 @@ var toolInfo2 = {
33339
33340
  }
33340
33341
  ]
33341
33342
  }
33342
- ]
33343
+ ],
33344
+ permissionLevel: 0 /* None */
33343
33345
  };
33344
33346
  var handler2 = async (provider, args2) => {
33345
33347
  const result = getString(args2, "result");
@@ -33415,7 +33417,8 @@ var toolInfo3 = {
33415
33417
  }
33416
33418
  ]
33417
33419
  }
33418
- ]
33420
+ ],
33421
+ permissionLevel: 0 /* None */
33419
33422
  };
33420
33423
  var handler3 = async (_provider, args2) => {
33421
33424
  const agentName = getString(args2, "agent_name");
@@ -33470,7 +33473,8 @@ var toolInfo4 = {
33470
33473
  }
33471
33474
  ]
33472
33475
  }
33473
- ]
33476
+ ],
33477
+ permissionLevel: 3 /* Arbitrary */
33474
33478
  };
33475
33479
  var handler4 = async (provider, args2) => {
33476
33480
  if (!provider.executeCommand) {
@@ -33512,7 +33516,7 @@ var executeCommand_default = {
33512
33516
  // ../core/src/tools/listCodeDefinitionNames.ts
33513
33517
  var toolInfo5 = {
33514
33518
  name: "list_code_definition_names",
33515
- description: "Request to list definition names (classes, functions, methods, etc.) used in a file. This tool provides insights into the codebase structure and important constructs, encapsulating high-level concepts and relationships that are crucial for understanding the overall architecture.",
33519
+ description: "Request to list definition names (classes, functions, methods, etc.) used for all files in a directory. This tool provides insights into the codebase structure and important constructs, encapsulating high-level concepts and relationships that are crucial for understanding the overall architecture.",
33516
33520
  parameters: [
33517
33521
  {
33518
33522
  name: "path",
@@ -33520,7 +33524,19 @@ var toolInfo5 = {
33520
33524
  required: true,
33521
33525
  usageValue: "Directory path here"
33522
33526
  }
33523
- ]
33527
+ ],
33528
+ examples: [
33529
+ {
33530
+ description: "Request to list code definition names in a directory",
33531
+ parameters: [
33532
+ {
33533
+ name: "path",
33534
+ value: "src/utils"
33535
+ }
33536
+ ]
33537
+ }
33538
+ ],
33539
+ permissionLevel: 1 /* Read */
33524
33540
  };
33525
33541
  var handler5 = async (provider, args2) => {
33526
33542
  if (!provider.listCodeDefinitionNames) {
@@ -33585,7 +33601,8 @@ var toolInfo6 = {
33585
33601
  }
33586
33602
  ]
33587
33603
  }
33588
- ]
33604
+ ],
33605
+ permissionLevel: 1 /* Read */
33589
33606
  };
33590
33607
  var handler6 = async (provider, args2) => {
33591
33608
  if (!provider.listFiles) {
@@ -33647,7 +33664,8 @@ var toolInfo7 = {
33647
33664
  }
33648
33665
  ]
33649
33666
  }
33650
- ]
33667
+ ],
33668
+ permissionLevel: 1 /* Read */
33651
33669
  };
33652
33670
  var handler7 = async (provider, args2) => {
33653
33671
  if (!provider.readFile) {
@@ -33764,7 +33782,8 @@ return (
33764
33782
  }
33765
33783
  ]
33766
33784
  }
33767
- ]
33785
+ ],
33786
+ permissionLevel: 2 /* Write */
33768
33787
  };
33769
33788
  var handler8 = async (provider, args2) => {
33770
33789
  if (!provider.readFile || !provider.writeFile) {
@@ -33833,7 +33852,8 @@ var toolInfo9 = {
33833
33852
  }
33834
33853
  ]
33835
33854
  }
33836
- ]
33855
+ ],
33856
+ permissionLevel: 1 /* Read */
33837
33857
  };
33838
33858
  var handler9 = async (provider, args2) => {
33839
33859
  if (!provider.searchFiles) {
@@ -33909,7 +33929,8 @@ export default App;
33909
33929
  }
33910
33930
  ]
33911
33931
  }
33912
- ]
33932
+ ],
33933
+ permissionLevel: 2 /* Write */
33913
33934
  };
33914
33935
  var handler10 = async (provider, args2) => {
33915
33936
  if (!provider.writeFile) {
@@ -33986,7 +34007,8 @@ var toolInfo11 = {
33986
34007
  }
33987
34008
  ]
33988
34009
  }
33989
- ]
34010
+ ],
34011
+ permissionLevel: 0 /* None */
33990
34012
  };
33991
34013
  var handler11 = async (_provider, args2) => {
33992
34014
  const agentName = getString(args2, "agent_name");
@@ -34031,7 +34053,8 @@ var toolInfo12 = {
34031
34053
  }
34032
34054
  ]
34033
34055
  }
34034
- ]
34056
+ ],
34057
+ permissionLevel: 2 /* Write */
34035
34058
  };
34036
34059
  var handler12 = async (provider, args2) => {
34037
34060
  if (!provider.removeFile) {
@@ -34087,7 +34110,8 @@ var toolInfo13 = {
34087
34110
  }
34088
34111
  ]
34089
34112
  }
34090
- ]
34113
+ ],
34114
+ permissionLevel: 2 /* Write */
34091
34115
  };
34092
34116
  var handler13 = async (provider, args2) => {
34093
34117
  if (!provider.renameFile) {
@@ -34112,8 +34136,8 @@ var renameFile_default = {
34112
34136
  handler: handler13,
34113
34137
  isAvailable: isAvailable13
34114
34138
  };
34115
- // ../core/src/tool.ts
34116
- var getAvailableTools = (provider2, allTools2, hasAgent) => {
34139
+ // ../core/src/getAvailableTools.ts
34140
+ var getAvailableTools = (provider2, allTools2, hasAgent, permissionLevel) => {
34117
34141
  const tools = [];
34118
34142
  for (const tool of allTools2) {
34119
34143
  if (!hasAgent) {
@@ -34123,7 +34147,7 @@ var getAvailableTools = (provider2, allTools2, hasAgent) => {
34123
34147
  continue;
34124
34148
  }
34125
34149
  }
34126
- if (tool.isAvailable(provider2)) {
34150
+ if (tool.isAvailable(provider2) && tool.permissionLevel <= permissionLevel) {
34127
34151
  tools.push(tool);
34128
34152
  }
34129
34153
  }
@@ -34438,6 +34462,9 @@ ${agents}`;
34438
34462
  return await this.#processLoop(userMessage);
34439
34463
  }
34440
34464
  async#request(userMessage) {
34465
+ if (!userMessage) {
34466
+ throw new Error("userMessage is missing");
34467
+ }
34441
34468
  await this.#callback({ kind: "StartRequest" /* StartRequest */, agent: this, userMessage });
34442
34469
  this.messages.push({
34443
34470
  role: "user",
@@ -34486,6 +34513,12 @@ ${agents}`;
34486
34513
  case "text":
34487
34514
  break;
34488
34515
  case "tool_use": {
34516
+ if (toolReponses.length > 0) {
34517
+ const toolLevel = this.handlers[content.name].permissionLevel;
34518
+ if (toolLevel > 1 /* Read */) {
34519
+ break outer;
34520
+ }
34521
+ }
34489
34522
  await this.#callback({ kind: "ToolUse" /* ToolUse */, agent: this, tool: content.name });
34490
34523
  const toolResp = await this.#invokeTool(content.name, content.params);
34491
34524
  switch (toolResp.type) {
@@ -34508,7 +34541,7 @@ ${agents}`;
34508
34541
  return { exit: toolResp };
34509
34542
  case "HandOver" /* HandOver */:
34510
34543
  if (toolReponses.length > 0) {
34511
- continue;
34544
+ break outer;
34512
34545
  }
34513
34546
  await this.#callback({
34514
34547
  kind: "ToolHandOver" /* ToolHandOver */,
@@ -34539,7 +34572,7 @@ ${agents}`;
34539
34572
  }
34540
34573
  }
34541
34574
  }
34542
- if (toolReponses.length === 0 && !this.config.interactive) {
34575
+ if (toolReponses.length === 0) {
34543
34576
  return { replay: responsePrompts.requireUseTool };
34544
34577
  }
34545
34578
  const finalResp = toolReponses.map(({ tool, response: response2 }) => responsePrompts.toolResults(tool, response2)).join(`
@@ -34611,18 +34644,8 @@ ${interactiveMode(interactive)}
34611
34644
  // ../core/src/Agent/AnalyzerAgent/index.ts
34612
34645
  class AnalyzerAgent extends AgentBase {
34613
34646
  constructor(options) {
34614
- const agentTools = [
34615
- ...options.additionalTools ?? [],
34616
- askFollowupQuestion_default,
34617
- attemptCompletion_default,
34618
- handOver_default,
34619
- delegate_default,
34620
- listCodeDefinitionNames_default,
34621
- listFiles_default,
34622
- readFile_default,
34623
- searchFiles_default
34624
- ];
34625
- const tools = getAvailableTools(options.provider, agentTools, (options.agents?.length ?? 0) > 0);
34647
+ const combinedTools = [...options.additionalTools ?? [], ...Object.values(exports_allTools)];
34648
+ const tools = getAvailableTools(options.provider, combinedTools, (options.agents?.length ?? 0) > 0, 1 /* Read */);
34626
34649
  const toolNamePrefix = "tool_";
34627
34650
  const systemPrompt = fullSystemPrompt({
34628
34651
  os: options.os
@@ -34711,18 +34734,8 @@ ${interactiveMode(interactive)}
34711
34734
  // ../core/src/Agent/ArchitectAgent/index.ts
34712
34735
  class ArchitectAgent extends AgentBase {
34713
34736
  constructor(options) {
34714
- const agentTools = [
34715
- ...options.additionalTools ?? [],
34716
- askFollowupQuestion_default,
34717
- attemptCompletion_default,
34718
- handOver_default,
34719
- delegate_default,
34720
- listCodeDefinitionNames_default,
34721
- listFiles_default,
34722
- readFile_default,
34723
- searchFiles_default
34724
- ];
34725
- const tools = getAvailableTools(options.provider, agentTools, (options.agents?.length ?? 0) > 0);
34737
+ const combinedTools = [...options.additionalTools ?? [], ...Object.values(exports_allTools)];
34738
+ const tools = getAvailableTools(options.provider, combinedTools, (options.agents?.length ?? 0) > 0, 1 /* Read */);
34726
34739
  const toolNamePrefix = "tool_";
34727
34740
  const systemPrompt = fullSystemPrompt2({
34728
34741
  os: options.os
@@ -34835,7 +34848,7 @@ class CodeFixerAgent extends AgentBase {
34835
34848
  #retryCount = 0;
34836
34849
  constructor(options) {
34837
34850
  const combinedTools = [...options.additionalTools ?? [], ...Object.values(exports_allTools)];
34838
- const tools = getAvailableTools(options.provider, combinedTools, (options.agents?.length ?? 0) > 0);
34851
+ const tools = getAvailableTools(options.provider, combinedTools, (options.agents?.length ?? 0) > 0, 3 /* Arbitrary */);
34839
34852
  const toolNamePrefix = "tool_";
34840
34853
  const systemPrompt = fullSystemPrompt3({
34841
34854
  os: options.os
@@ -35023,7 +35036,7 @@ ${interactiveMode(interactive)}
35023
35036
  class CoderAgent extends AgentBase {
35024
35037
  constructor(options) {
35025
35038
  const combinedTools = [...options.additionalTools ?? [], ...Object.values(exports_allTools)];
35026
- const tools = getAvailableTools(options.provider, combinedTools, (options.agents?.length ?? 0) > 0);
35039
+ const tools = getAvailableTools(options.provider, combinedTools, (options.agents?.length ?? 0) > 0, 3 /* Arbitrary */);
35027
35040
  const toolNamePrefix = "tool_";
35028
35041
  const systemPrompt = fullSystemPrompt4({
35029
35042
  os: options.os
@@ -45429,7 +45442,7 @@ function loadConfig(paths, cwd = process.cwd(), home = homedir()) {
45429
45442
  ${error}`);
45430
45443
  }
45431
45444
  }
45432
- if (paths) {
45445
+ if (paths && paths.length > 0) {
45433
45446
  const configPaths = Array.isArray(paths) ? paths : [paths];
45434
45447
  for (const path4 of configPaths) {
45435
45448
  try {
@@ -45462,11 +45475,25 @@ var readConfig = (path4) => {
45462
45475
  return configSchema.parse(config);
45463
45476
  };
45464
45477
 
45478
+ // src/env.ts
45479
+ function getEnv(override) {
45480
+ return {
45481
+ POLKA_API_PROVIDER: process.env.POLKA_API_PROVIDER,
45482
+ POLKA_MODEL: process.env.POLKA_MODEL,
45483
+ POLKA_API_KEY: process.env.POLKA_API_KEY,
45484
+ POLKA_BUDGET: process.env.POLKA_BUDGET,
45485
+ ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY,
45486
+ DEEPSEEK_API_KEY: process.env.DEEPSEEK_API_KEY,
45487
+ OPENROUTER_API_KEY: process.env.OPENROUTER_API_KEY,
45488
+ ...override
45489
+ };
45490
+ }
45491
+
45465
45492
  // src/options.ts
45466
45493
  function addSharedOptions(command) {
45467
- return command.option("-c --config <paths>", "Path to config file(s)", (value, prev) => prev.concat(value), []).option("--api-provider <provider>", "API provider").option("--model <model>", "Model ID").option("--api-key <key>", "API key").option("--max-messages <iterations>", "Maximum number of messages to send. Default to 50", Number.parseInt, 50).option("--budget <budget>", "Budget for the AI service. Default to $1000", Number.parseFloat, 1000).option("-v --verbose", "Enable verbose output. Use -v for level 1, -vv for level 2", (value, prev) => prev + 1, 0).option("-d --base-dir <path>", "Base directory to run commands in");
45494
+ return command.option("-c --config <paths>", "Path to config file(s)", (value, prev) => prev.concat(value), []).option("--api-provider <provider>", "API provider").option("--model <model>", "Model ID").option("--api-key <key>", "API key").option("--max-messages <iterations>", "Maximum number of messages to send. Default to 50", Number.parseInt, 50).option("--budget <budget>", "Budget for the AI service. Default to $10", Number.parseFloat).option("-v --verbose", "Enable verbose output. Use -v for level 1, -vv for level 2", (value, prev) => prev + 1, 0).option("-d --base-dir <path>", "Base directory to run commands in");
45468
45495
  }
45469
- function parseOptions(options, cwdArg, home = os2.homedir()) {
45496
+ function parseOptions(options, cwdArg, home = os2.homedir(), env = getEnv()) {
45470
45497
  let cwd = cwdArg;
45471
45498
  if (options.baseDir) {
45472
45499
  process.chdir(options.baseDir);
@@ -45476,23 +45503,26 @@ function parseOptions(options, cwdArg, home = os2.homedir()) {
45476
45503
  cwd = process.cwd();
45477
45504
  }
45478
45505
  const config = loadConfig(options.config, cwd, home) ?? {};
45479
- const defaultProvider = options.apiProvider || process.env.POLKA_API_PROVIDER || config.defaultProvider;
45480
- const defaultModel = options.model || process.env.POLKA_MODEL || config.defaultModel;
45506
+ const defaultProvider = options.apiProvider || env.POLKA_API_PROVIDER || config.defaultProvider;
45507
+ const defaultModel = options.model || env.POLKA_MODEL || config.defaultModel;
45481
45508
  if (defaultProvider && defaultModel) {
45482
45509
  import_lodash2.set(config, ["providers", defaultProvider, "defaultModel"], defaultModel);
45483
45510
  }
45484
- const apiKey = options.apiKey || process.env.POLKA_API_KEY;
45511
+ const apiKey = options.apiKey || env.POLKA_API_KEY;
45485
45512
  if (apiKey) {
45486
45513
  if (!defaultProvider) {
45487
45514
  throw new Error("Must specify a provider if providing an API key");
45488
45515
  }
45489
45516
  import_lodash2.set(config, ["providers", defaultProvider, "apiKey"], apiKey);
45490
45517
  }
45491
- for (const provider2 of Object.values(AiServiceProvider)) {
45492
- const providerApiKey = process.env[`${provider2.toUpperCase()}_API_KEY`];
45493
- if (providerApiKey) {
45494
- import_lodash2.set(config, ["providers", provider2, "apiKey"], providerApiKey);
45495
- }
45518
+ if (env.ANTHROPIC_API_KEY) {
45519
+ import_lodash2.set(config, ["providers", "anthropic" /* Anthropic */, "apiKey"], env.ANTHROPIC_API_KEY);
45520
+ }
45521
+ if (env.DEEPSEEK_API_KEY) {
45522
+ import_lodash2.set(config, ["providers", "deepseek" /* DeepSeek */, "apiKey"], env.DEEPSEEK_API_KEY);
45523
+ }
45524
+ if (env.OPENROUTER_API_KEY) {
45525
+ import_lodash2.set(config, ["providers", "openrouter" /* OpenRouter */, "apiKey"], env.OPENROUTER_API_KEY);
45496
45526
  }
45497
45527
  const providerConfig = new ApiProviderConfig({
45498
45528
  defaultProvider,
@@ -45500,7 +45530,7 @@ function parseOptions(options, cwdArg, home = os2.homedir()) {
45500
45530
  });
45501
45531
  return {
45502
45532
  maxMessageCount: options.maxMessageCount ?? config.maxMessageCount ?? 30,
45503
- budget: options.budget ?? Number(process.env.POLKA_BUDGET) ?? config.budget ?? 1000,
45533
+ budget: options.budget ?? (env.POLKA_BUDGET ? Number.parseFloat(env.POLKA_BUDGET) : undefined) ?? config.budget ?? 10,
45504
45534
  verbose: options.verbose ?? 0,
45505
45535
  config,
45506
45536
  providerConfig
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polka-codes/cli",
3
- "version": "0.6.4",
3
+ "version": "0.6.6",
4
4
  "license": "AGPL-3.0",
5
5
  "author": "github@polka.codes",
6
6
  "type": "module",