@polka-codes/cli 0.7.12 → 0.7.13

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 (2) hide show
  1. package/dist/index.js +20 -4
  2. package/package.json +1 -1
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.7.12";
24632
+ var version = "0.7.13";
24633
24633
 
24634
24634
  // ../core/src/AiService/AiServiceBase.ts
24635
24635
  class AiServiceBase {
@@ -34674,9 +34674,10 @@ class AgentBase {
34674
34674
  ai;
34675
34675
  config;
34676
34676
  handlers;
34677
- messages = [];
34678
- constructor(name2, ai, config) {
34677
+ messages;
34678
+ constructor(name2, ai, config, messages = []) {
34679
34679
  this.ai = ai;
34680
+ this.messages = messages;
34680
34681
  if (config.agents && config.agents.length > 0) {
34681
34682
  const agents = agentsPrompt(config.agents, name2);
34682
34683
  config.systemPrompt += `
@@ -34696,6 +34697,19 @@ ${agents}`;
34696
34697
  this.#callback({ kind: "StartTask" /* StartTask */, agent: this, systemPrompt: this.config.systemPrompt });
34697
34698
  return await this.#processLoop(prompt);
34698
34699
  }
34700
+ async step(promp) {
34701
+ if (this.messages.length === 0) {
34702
+ this.#callback({ kind: "StartTask" /* StartTask */, agent: this, systemPrompt: this.config.systemPrompt });
34703
+ }
34704
+ if (this.ai.usageMeter.isLimitExceeded().result) {
34705
+ this.#callback({ kind: "UsageExceeded" /* UsageExceeded */, agent: this });
34706
+ return { type: "UsageExceeded" };
34707
+ }
34708
+ return await this.#request(promp);
34709
+ }
34710
+ async handleStepResponse(response) {
34711
+ return this.#handleResponse(response);
34712
+ }
34699
34713
  async#processLoop(userMessage) {
34700
34714
  let nextRequest = userMessage;
34701
34715
  while (true) {
@@ -47427,12 +47441,12 @@ ${newConfig.provider.toUpperCase()}_API_KEY=${newConfig.apiKey}`;
47427
47441
  // src/commands/pr.ts
47428
47442
  import { execSync as execSync2, spawnSync as spawnSync2 } from "node:child_process";
47429
47443
  var prCommand = new Command("pr").description("Create a GitHub pull request").argument("[message]", "Optional context for the commit message generation").action(async (message, _options, command) => {
47430
- const spinner = ora("Gathering information...").start();
47431
47444
  const options = command.parent?.opts() ?? {};
47432
47445
  const { providerConfig, config } = parseOptions(options);
47433
47446
  const { provider: provider2, model, apiKey, parameters } = providerConfig.getConfigForCommand("pr") ?? {};
47434
47447
  console.log("Provider:", provider2);
47435
47448
  console.log("Model:", model);
47449
+ const spinner = ora("Gathering information...").start();
47436
47450
  if (!provider2) {
47437
47451
  console.error('Error: No provider specified. Please run "pokla config" to configure your AI provider.');
47438
47452
  process.exit(1);
@@ -47482,6 +47496,8 @@ var prCommand = new Command("pr").description("Create a GitHub pull request").ar
47482
47496
  commitDiff: diff
47483
47497
  });
47484
47498
  spinner.succeed("Pull request details generated");
47499
+ console.log("Title:", prDetails.response.title);
47500
+ console.log(prDetails.response.description);
47485
47501
  await new Promise((resolve3) => setTimeout(resolve3, 10));
47486
47502
  spawnSync2("gh", ["pr", "create", "--title", prDetails.response.title.trim(), "--body", prDetails.response.description.trim()], {
47487
47503
  stdio: "inherit"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polka-codes/cli",
3
- "version": "0.7.12",
3
+ "version": "0.7.13",
4
4
  "license": "AGPL-3.0",
5
5
  "author": "github@polka.codes",
6
6
  "type": "module",