@polka-codes/cli 0.9.20 → 0.9.21

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 +33 -17
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -49181,7 +49181,7 @@ var {
49181
49181
  Help
49182
49182
  } = import__.default;
49183
49183
  // package.json
49184
- var version = "0.9.20";
49184
+ var version = "0.9.21";
49185
49185
 
49186
49186
  // ../../node_modules/@inquirer/core/dist/esm/lib/key.js
49187
49187
  var isUpKey = (key) => key.name === "up" || key.name === "k" || key.ctrl && key.name === "p";
@@ -105138,7 +105138,7 @@ Tool error:`, event.tool));
105138
105138
  // src/options.ts
105139
105139
  var import_lodash3 = __toESM(require_lodash(), 1);
105140
105140
  function addSharedOptions(command) {
105141
- 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.", Number.parseInt).option("--budget <budget>", "Budget for the AI service.", Number.parseFloat).option("--retry-count <count>", "Number of retries for failed requests.", Number.parseInt).option("--request-timeout-seconds <seconds>", "Request timeout in seconds.", Number.parseInt).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").option("--agent <agent>", "Initial agent to use (default: architect)");
105141
+ 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.", Number.parseInt).option("--budget <budget>", "Budget for the AI service.", Number.parseFloat).option("--retry-count <count>", "Number of retries for failed requests.", Number.parseInt).option("--request-timeout-seconds <seconds>", "Request timeout in seconds.", Number.parseInt).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").option("--agent <agent>", "Initial agent to use (default: architect)").option("--silent", "Enable silent mode");
105142
105142
  }
105143
105143
  function parseOptions(options, cwdArg, home = os2.homedir(), env2 = getEnv()) {
105144
105144
  let cwd = cwdArg;
@@ -105188,7 +105188,8 @@ function parseOptions(options, cwdArg, home = os2.homedir(), env2 = getEnv()) {
105188
105188
  verbose: options.verbose ?? 0,
105189
105189
  config: config5,
105190
105190
  providerConfig,
105191
- agent: options.agent ?? config5.agent ?? "architect"
105191
+ agent: options.agent ?? config5.agent ?? "architect",
105192
+ silent: options.silent ?? false
105192
105193
  };
105193
105194
  }
105194
105195
 
@@ -105259,7 +105260,7 @@ class Runner {
105259
105260
  rules2 = [rules2];
105260
105261
  }
105261
105262
  const toolProviderOptions = {
105262
- command: {
105263
+ command: this.#options.silent ? undefined : {
105263
105264
  onStarted(command) {
105264
105265
  console.log(`$ >>>> $ ${command}`);
105265
105266
  },
@@ -105298,18 +105299,22 @@ class Runner {
105298
105299
  }
105299
105300
  return service;
105300
105301
  };
105301
- const callback = printEvent(options.verbose, this.usageMeter);
105302
+ const callback = options.silent ? undefined : printEvent(options.verbose, this.usageMeter);
105302
105303
  const policies2 = [EnableCachePolicy];
105303
105304
  for (const policy of options.config.policies ?? []) {
105304
105305
  switch (policy.trim().toLowerCase()) {
105305
105306
  case "truncatecontext" /* TruncateContext */:
105306
105307
  policies2.push(TruncateContextPolicy);
105307
- console.log("TruncateContextPolicy enabled");
105308
+ if (!options.silent) {
105309
+ console.log("TruncateContextPolicy enabled");
105310
+ }
105308
105311
  break;
105309
105312
  case "enablecache" /* EnableCache */:
105310
105313
  break;
105311
105314
  default:
105312
- console.log("Unknown policy:", policy);
105315
+ if (!options.silent) {
105316
+ console.log("Unknown policy:", policy);
105317
+ }
105313
105318
  break;
105314
105319
  }
105315
105320
  }
@@ -107070,16 +107075,18 @@ async function runTask(taskArg, _options, command) {
107070
107075
  process.exit(1);
107071
107076
  }
107072
107077
  }
107073
- const { config: config5, providerConfig, verbose, maxMessageCount, budget, agent } = parseOptions(command.opts());
107078
+ const { config: config5, providerConfig, verbose, maxMessageCount, budget, agent, silent } = parseOptions(command.opts());
107074
107079
  const { provider: provider3, model, parameters } = providerConfig.getConfigForAgent(agent) ?? {};
107075
107080
  if (!provider3 || !model) {
107076
107081
  console.error("Provider and model must be configured");
107077
107082
  process.exit(1);
107078
107083
  }
107079
- console.log("Provider:", provider3);
107080
- console.log("Model:", model);
107081
- for (const [key2, value] of Object.entries(parameters ?? {})) {
107082
- console.log(`${key2}:`, value);
107084
+ if (!silent) {
107085
+ console.log("Provider:", provider3);
107086
+ console.log("Model:", model);
107087
+ for (const [key2, value] of Object.entries(parameters ?? {})) {
107088
+ console.log(`${key2}:`, value);
107089
+ }
107083
107090
  }
107084
107091
  const runner = new Runner({
107085
107092
  providerConfig,
@@ -107087,18 +107094,27 @@ async function runTask(taskArg, _options, command) {
107087
107094
  maxMessageCount,
107088
107095
  budget,
107089
107096
  interactive: process.stdin.isTTY,
107090
- verbose
107097
+ verbose,
107098
+ silent
107091
107099
  });
107092
107100
  const sigintHandler = () => {
107093
107101
  runner.abort();
107094
- console.log();
107095
- runner.printUsage();
107102
+ if (!silent) {
107103
+ console.log();
107104
+ runner.printUsage();
107105
+ }
107096
107106
  process.exit(0);
107097
107107
  };
107098
107108
  process.on("SIGINT", sigintHandler);
107099
- await runner.startTask(task, agent);
107109
+ const exitReason = await runner.startTask(task, agent);
107100
107110
  process.off("SIGINT", sigintHandler);
107101
- runner.printUsage();
107111
+ if (silent) {
107112
+ if (exitReason.type === "Exit" /* Exit */) {
107113
+ console.log(exitReason.message);
107114
+ }
107115
+ } else {
107116
+ runner.printUsage();
107117
+ }
107102
107118
  }
107103
107119
 
107104
107120
  // src/commands/review.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polka-codes/cli",
3
- "version": "0.9.20",
3
+ "version": "0.9.21",
4
4
  "license": "AGPL-3.0",
5
5
  "author": "github@polka.codes",
6
6
  "type": "module",