@polka-codes/cli 0.8.3 → 0.8.5

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 +229 -85
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -31550,7 +31550,7 @@ var {
31550
31550
  Help
31551
31551
  } = import__.default;
31552
31552
  // package.json
31553
- var version = "0.8.3";
31553
+ var version = "0.8.5";
31554
31554
 
31555
31555
  // ../core/src/AiService/AiServiceBase.ts
31556
31556
  class AiServiceBase {
@@ -40930,10 +40930,16 @@ ${search}`);
40930
40930
  };
40931
40931
  // ../core/src/tools/utils/getArg.ts
40932
40932
  var getString = (args2, name2, defaultValue) => {
40933
+ if (typeof args2 !== "object" || Array.isArray(args2)) {
40934
+ throw new Error(`Invalid argument type: ${name2} ${args2}`);
40935
+ }
40933
40936
  const ret = args2[name2] ?? defaultValue;
40934
40937
  if (ret === undefined) {
40935
40938
  throw new Error(`Missing required argument: ${name2}`);
40936
40939
  }
40940
+ if (typeof ret !== "string") {
40941
+ throw new Error(`Invalid argument type: ${name2} ${ret}`);
40942
+ }
40937
40943
  return ret;
40938
40944
  };
40939
40945
  var getStringArray = (args2, name2, defaultValue) => {
@@ -40947,6 +40953,9 @@ var getStringArray = (args2, name2, defaultValue) => {
40947
40953
  if (ret === "") {
40948
40954
  return [];
40949
40955
  }
40956
+ if (typeof ret !== "string") {
40957
+ throw new Error(`Invalid argument type: ${name2} ${ret}`);
40958
+ }
40950
40959
  return ret.split(",").map((s2) => s2.trim());
40951
40960
  };
40952
40961
  var getBoolean = (args2, name2, defaultValue) => {
@@ -40957,13 +40966,16 @@ var getBoolean = (args2, name2, defaultValue) => {
40957
40966
  }
40958
40967
  return defaultValue;
40959
40968
  }
40969
+ if (typeof ret !== "string") {
40970
+ throw new Error(`Invalid argument type: ${name2} ${ret}`);
40971
+ }
40960
40972
  switch (ret.toLowerCase()) {
40961
40973
  case "true":
40962
40974
  return true;
40963
40975
  case "false":
40964
40976
  return false;
40965
40977
  default:
40966
- throw new Error(`Invalid argument value: ${name2}`);
40978
+ throw new Error(`Invalid argument value: ${name2} ${ret}`);
40967
40979
  }
40968
40980
  };
40969
40981
  var getInt = (args2, name2, defaultValue) => {
@@ -40974,50 +40986,104 @@ var getInt = (args2, name2, defaultValue) => {
40974
40986
  }
40975
40987
  return defaultValue;
40976
40988
  }
40989
+ if (typeof ret !== "string") {
40990
+ throw new Error(`Invalid argument type: ${name2} ${ret}`);
40991
+ }
40977
40992
  const parsed = Number.parseInt(ret);
40978
40993
  if (Number.isNaN(parsed)) {
40979
- throw new Error(`Invalid argument value: ${name2}`);
40994
+ throw new Error(`Invalid argument value: ${name2} ${ret}`);
40980
40995
  }
40981
40996
  return parsed;
40982
40997
  };
40998
+ var getArray = (args2, name2, defaultValue) => {
40999
+ if (typeof args2 !== "object" || Array.isArray(args2)) {
41000
+ throw new Error(`Invalid argument type: ${name2} ${args2}`);
41001
+ }
41002
+ const ret = args2[name2];
41003
+ if (ret === undefined) {
41004
+ if (defaultValue === undefined) {
41005
+ throw new Error(`Missing required argument: ${name2}`);
41006
+ }
41007
+ return defaultValue;
41008
+ }
41009
+ if (Array.isArray(ret)) {
41010
+ return ret;
41011
+ }
41012
+ return [ret];
41013
+ };
40983
41014
  // ../core/src/tools/askFollowupQuestion.ts
40984
41015
  var toolInfo = {
40985
41016
  name: "ask_followup_question",
40986
- description: "Whenever you need extra details or clarification to complete the task, pose a direct question to the user. Use this tool sparingly to avoid excessive back-and-forth. If helpful, offer multiple-choice options or examples to guide the user’s response.",
41017
+ description: "Call this when vital details are missing. Pose each follow-up as one direct, unambiguous question. If it speeds the reply, add up to five short, mutually-exclusive answer options. Group any related questions in the same call to avoid a back-and-forth chain.",
40987
41018
  parameters: [
40988
41019
  {
40989
- name: "question",
40990
- description: "The question to ask the user. This should be a clear, specific question that addresses the information you need.",
41020
+ name: "questions",
41021
+ description: "One or more follow-up questions you need answered before you can continue.",
40991
41022
  required: true,
40992
- usageValue: "Your question here"
40993
- },
40994
- {
40995
- name: "options",
40996
- description: "A comma separated list of possible answers to the question. Ordered by preference. If not provided, the user will be prompted to provide an answer.",
40997
- required: false,
40998
- usageValue: "A comma separated list of possible answers (optional)"
41023
+ allowMultiple: true,
41024
+ children: [
41025
+ {
41026
+ name: "prompt",
41027
+ description: "The text of the question.",
41028
+ required: true,
41029
+ usageValue: "question text here"
41030
+ },
41031
+ {
41032
+ name: "options",
41033
+ description: "Ordered list of suggested answers (omit if none).",
41034
+ required: false,
41035
+ allowMultiple: true,
41036
+ usageValue: "suggested answer here"
41037
+ }
41038
+ ]
40999
41039
  }
41000
41040
  ],
41001
41041
  examples: [
41002
41042
  {
41003
- description: "Request to ask a question",
41043
+ description: "Single clarifying question (no options)",
41004
41044
  parameters: [
41005
41045
  {
41006
- name: "question",
41007
- value: "What is the name of the project?"
41046
+ name: "questions",
41047
+ value: { prompt: "What is the target deployment environment?" }
41008
41048
  }
41009
41049
  ]
41010
41050
  },
41011
41051
  {
41012
- description: "Request to ask a question with options",
41052
+ description: "Single question with multiple-choice options",
41013
41053
  parameters: [
41014
41054
  {
41015
- name: "question",
41016
- value: "What framework do you use?"
41017
- },
41055
+ name: "questions",
41056
+ value: {
41057
+ prompt: "Which frontend framework are you using?",
41058
+ options: ["React", "Angular", "Vue", "Svelte"]
41059
+ }
41060
+ }
41061
+ ]
41062
+ },
41063
+ {
41064
+ description: "Two related questions in one call",
41065
+ parameters: [
41018
41066
  {
41019
- name: "options",
41020
- value: "React,Angular,Vue,Svelte"
41067
+ name: "questions",
41068
+ value: [
41069
+ { prompt: "What type of application are you building?" },
41070
+ {
41071
+ prompt: "Preferred programming language?",
41072
+ options: ["JavaScript", "TypeScript", "Python", "Java"]
41073
+ }
41074
+ ]
41075
+ }
41076
+ ]
41077
+ },
41078
+ {
41079
+ description: "Binary (yes/no) confirmation",
41080
+ parameters: [
41081
+ {
41082
+ name: "questions",
41083
+ value: {
41084
+ prompt: "Is it acceptable to refactor existing tests to improve performance?",
41085
+ options: ["Yes", "No"]
41086
+ }
41021
41087
  }
41022
41088
  ]
41023
41089
  }
@@ -41031,13 +41097,26 @@ var handler = async (provider, args2) => {
41031
41097
  message: "Not possible to ask followup question. Abort."
41032
41098
  };
41033
41099
  }
41034
- const question = getString(args2, "question");
41035
- const options = getStringArray(args2, "options", []);
41036
- const answer = await provider.askFollowupQuestion(question, options);
41100
+ const questions = getArray(args2, "questions");
41101
+ if (!questions || questions.length === 0) {
41102
+ return {
41103
+ type: "Error" /* Error */,
41104
+ message: "No questions provided"
41105
+ };
41106
+ }
41107
+ const answers = [];
41108
+ for (const question of questions) {
41109
+ const prompt = getString(question, "prompt");
41110
+ const options = getArray(question, "options", []);
41111
+ const answer = await provider.askFollowupQuestion(prompt, options);
41112
+ answers.push(`<ask_followup_question_answer question="${prompt}">
41113
+ ${answer}
41114
+ </ask_followup_question_answer>`);
41115
+ }
41037
41116
  return {
41038
41117
  type: "Reply" /* Reply */,
41039
- message: `<ask_followup_question_question>${question}</ask_followup_question_question>
41040
- <ask_followup_question_answer>${answer}</ask_followup_question_answer>`
41118
+ message: answers.join(`
41119
+ `)
41041
41120
  };
41042
41121
  };
41043
41122
  var isAvailable = (provider) => {
@@ -41174,33 +41253,27 @@ var delegate_default = {
41174
41253
  // ../core/src/tools/executeCommand.ts
41175
41254
  var toolInfo4 = {
41176
41255
  name: "execute_command",
41177
- description: `Request to execute a CLI command on the system. Use this when you need to perform system operations or run specific commands to accomplish any step in the user's task. You must tailor your command to the user's system and provide a clear explanation of what the command does. Prefer to execute complex CLI commands over creating executable scripts, as they are more flexible and easier to run. Commands will also be executed in the project root directory regardless of executed commands in previous tool uses.`,
41256
+ description: "Run a single CLI command. The command is always executed in the project-root working directory (regardless of earlier commands). Prefer one-off shell commands over wrapper scripts for flexibility. After an `execute_command` call, no other tool calls are allowed in the same assistant response.",
41178
41257
  parameters: [
41179
41258
  {
41180
41259
  name: "command",
41181
- description: "The CLI command to execute. This should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions.",
41260
+ description: "The exact command to run (valid for the current OS). It must be correctly formatted and free of harmful instructions.",
41182
41261
  required: true,
41183
- usageValue: "Your command here"
41262
+ usageValue: "your-command-here"
41184
41263
  },
41185
41264
  {
41186
41265
  name: "requires_approval",
41187
- description: `A boolean indicating whether this command requires explicit user approval before execution in case the user has auto-approve mode enabled. Set to 'true' for potentially impactful operations like installing/uninstalling packages, deleting/overwriting files, system configuration changes, network operations, or any commands that could have unintended side effects. Set to 'false' for safe operations like reading files/directories, running development servers, building projects, and other non-destructive operations.`,
41266
+ description: "Set to `true` for commands that install/uninstall software, modify or delete files, change system settings, perform network operations, or have other side effects. Use `false` for safe, read-only, or purely local development actions (e.g., listing files, make a build, running tests).",
41188
41267
  required: false,
41189
- usageValue: "true or false"
41268
+ usageValue: "true | false"
41190
41269
  }
41191
41270
  ],
41192
41271
  examples: [
41193
41272
  {
41194
- description: "Request to execute a command",
41273
+ description: "Make a build",
41195
41274
  parameters: [
41196
- {
41197
- name: "command",
41198
- value: "npm run dev"
41199
- },
41200
- {
41201
- name: "requires_approval",
41202
- value: "false"
41203
- }
41275
+ { name: "command", value: "npm run build" },
41276
+ { name: "requires_approval", value: "false" }
41204
41277
  ]
41205
41278
  }
41206
41279
  ],
@@ -42162,6 +42235,23 @@ var getAvailableTools = ({
42162
42235
  };
42163
42236
 
42164
42237
  // ../core/src/Agent/parseAssistantMessage.ts
42238
+ function parseNestedParameters(content, parameterPrefix) {
42239
+ const result = {};
42240
+ const nestedParamRegex = new RegExp(`<${parameterPrefix}([^>]+)>([\\s\\S]*?)<\\/${parameterPrefix}\\1>`, "gs");
42241
+ while (true) {
42242
+ const match = nestedParamRegex.exec(content);
42243
+ if (match === null)
42244
+ break;
42245
+ const paramName = match[1];
42246
+ const paramContent = match[2].trim();
42247
+ if (paramContent.includes(`<${parameterPrefix}`)) {
42248
+ result[paramName] = parseNestedParameters(paramContent, parameterPrefix);
42249
+ } else {
42250
+ result[paramName] = paramContent;
42251
+ }
42252
+ }
42253
+ return result;
42254
+ }
42165
42255
  function parseAssistantMessage(assistantMessage, tools, toolNamePrefix) {
42166
42256
  const parameterPrefix = `${toolNamePrefix}parameter_`;
42167
42257
  const results = [];
@@ -42190,10 +42280,25 @@ function parseAssistantMessage(assistantMessage, tools, toolNamePrefix) {
42190
42280
  for (const param of tool.parameters) {
42191
42281
  const paramName = `${parameterPrefix}${param.name}`;
42192
42282
  const escapedParamName = paramName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
42193
- const paramPattern = `<${escapedParamName}>([\\s\\S]*?)<\\/${escapedParamName}>`;
42194
- const paramMatch = fullTagContent.match(new RegExp(paramPattern, "s"));
42195
- if (paramMatch) {
42196
- params[param.name] = paramMatch[1].trim();
42283
+ const paramRegex = new RegExp(`<${escapedParamName}>([\\s\\S]*?)<\\/${escapedParamName}>`, "gs");
42284
+ const paramMatches = [];
42285
+ while (true) {
42286
+ const paramMatch = paramRegex.exec(fullTagContent);
42287
+ if (paramMatch === null)
42288
+ break;
42289
+ paramMatches.push(paramMatch[1].trim());
42290
+ }
42291
+ if (paramMatches.length > 0) {
42292
+ if (paramMatches.length === 1) {
42293
+ const paramContent = paramMatches[0];
42294
+ if (paramContent.includes(`<${parameterPrefix}`)) {
42295
+ params[param.name] = parseNestedParameters(paramContent, parameterPrefix);
42296
+ } else {
42297
+ params[param.name] = paramContent;
42298
+ }
42299
+ } else {
42300
+ params[param.name] = paramMatches;
42301
+ }
42197
42302
  }
42198
42303
  }
42199
42304
  results.push({
@@ -42225,6 +42330,20 @@ function parseAssistantMessage(assistantMessage, tools, toolNamePrefix) {
42225
42330
  }
42226
42331
 
42227
42332
  // ../core/src/Agent/prompts.ts
42333
+ var renderParameterValue = (key, value, parameterPrefix) => {
42334
+ if (typeof value === "string") {
42335
+ return `<${parameterPrefix}${key}>${value}</${parameterPrefix}${key}>`;
42336
+ }
42337
+ if (Array.isArray(value)) {
42338
+ return value.map((v2) => renderParameterValue(key, v2, parameterPrefix)).join(`
42339
+ `);
42340
+ }
42341
+ const inner = Object.entries(value).map(([key2, v2]) => renderParameterValue(key2, v2, parameterPrefix)).join(`
42342
+ `);
42343
+ return `<${parameterPrefix}${key}>
42344
+ ${inner}
42345
+ </${parameterPrefix}${key}>`;
42346
+ };
42228
42347
  var toolInfoPrompt = (tool, toolNamePrefix, parameterPrefix) => `
42229
42348
  ## ${toolNamePrefix}${tool.name}
42230
42349
 
@@ -42239,11 +42358,11 @@ Usage:
42239
42358
  ${tool.parameters.map((param) => `<${parameterPrefix}${param.name}>${param.usageValue}</${parameterPrefix}${param.name}>`).join(`
42240
42359
  `)}
42241
42360
  </${toolNamePrefix}${tool.name}>`;
42242
- var toolInfoExamplesPrompt = (idx, tool, example, toolNamePrefix, parameterPrefix) => `
42243
- ## Example ${idx + 1}: ${example.description}
42361
+ var toolInfoExamplesPrompt = (tool, example, toolNamePrefix, parameterPrefix) => `
42362
+ ## Example: ${example.description}
42244
42363
 
42245
42364
  <${toolNamePrefix}${tool.name}>
42246
- ${example.parameters.map((param) => `<${parameterPrefix}${param.name}>${param.value}</${parameterPrefix}${param.name}>`).join(`
42365
+ ${example.parameters.map((param) => `${renderParameterValue(param.name, param.value, parameterPrefix)}`).join(`
42247
42366
  `)}
42248
42367
  </${toolNamePrefix}${tool.name}>
42249
42368
  `;
@@ -42252,7 +42371,6 @@ var toolUsePrompt = (tools, toolNamePrefix) => {
42252
42371
  return "";
42253
42372
  }
42254
42373
  const parameterPrefix = `${toolNamePrefix}parameter_`;
42255
- let exampleIndex = 0;
42256
42374
  return `
42257
42375
  ====
42258
42376
 
@@ -42270,11 +42388,39 @@ Tool use is formatted using XML-style tags. The tool name is enclosed in opening
42270
42388
  ...
42271
42389
  </${toolNamePrefix}tool_name>
42272
42390
 
42273
- For example:
42391
+ ## Array Parameters
42392
+
42393
+ To create an array of values for a parameter, repeat the parameter tag multiple times:
42394
+
42395
+ <${toolNamePrefix}process_file>
42396
+ <${parameterPrefix}path>test.ts</${parameterPrefix}path>
42397
+ <${parameterPrefix}path>main.ts</${parameterPrefix}path>
42398
+ </${toolNamePrefix}process_file>
42274
42399
 
42275
- <${toolNamePrefix}read_file>
42276
- <${parameterPrefix}path>src/main.js</${parameterPrefix}path>
42277
- </${toolNamePrefix}read_file>
42400
+ ## Nested Object Parameters
42401
+
42402
+ To create nested objects, nest parameter tags within other parameter tags:
42403
+
42404
+ <${toolNamePrefix}example_tool>
42405
+ <${parameterPrefix}key>
42406
+ <${parameterPrefix}key2>value</${parameterPrefix}key2>
42407
+ <${parameterPrefix}key3>value2</${parameterPrefix}key3>
42408
+ </${parameterPrefix}key>
42409
+ </${toolNamePrefix}example_tool>
42410
+
42411
+ You can also combine array parameters with nested objects:
42412
+
42413
+ <${toolNamePrefix}example_tool>
42414
+ <${parameterPrefix}key>
42415
+ <${parameterPrefix}key2>value</${parameterPrefix}key2>
42416
+ <${parameterPrefix}key3>value2</${parameterPrefix}key3>
42417
+ </${parameterPrefix}key>
42418
+ <${parameterPrefix}key>
42419
+ <${parameterPrefix}key2>value3</${parameterPrefix}key2>
42420
+ <${parameterPrefix}key3>value4</${parameterPrefix}key3>
42421
+ <${parameterPrefix}key3>value5</${parameterPrefix}key3>
42422
+ </${parameterPrefix}key>
42423
+ </${toolNamePrefix}example_tool>
42278
42424
 
42279
42425
  Always adhere to this format for the tool use to ensure proper parsing and execution.
42280
42426
 
@@ -42288,7 +42434,7 @@ ${tools.map((tool) => toolInfoPrompt(tool, toolNamePrefix, parameterPrefix)).joi
42288
42434
  ${tools.map((tool) => {
42289
42435
  let promp = "";
42290
42436
  for (const example of tool.examples ?? []) {
42291
- promp += toolInfoExamplesPrompt(exampleIndex++, tool, example, toolNamePrefix, parameterPrefix);
42437
+ promp += toolInfoExamplesPrompt(tool, example, toolNamePrefix, parameterPrefix);
42292
42438
  }
42293
42439
  return promp;
42294
42440
  }).join("")}
@@ -43008,7 +43154,7 @@ You have access to two tools for working with files: **${toolNamePrefix}write_to
43008
43154
 
43009
43155
  ## Important Considerations
43010
43156
 
43011
- - Using ${toolNamePrefix}write_to_file requires providing the files complete final content.
43157
+ - Using ${toolNamePrefix}write_to_file requires providing the file's complete final content.
43012
43158
  - If you only need to make small changes to an existing file, consider using ${toolNamePrefix}replace_in_file instead to avoid unnecessarily rewriting the entire file.
43013
43159
  - While ${toolNamePrefix}write_to_file should not be your default choice, don't hesitate to use it when the situation truly calls for it.
43014
43160
 
@@ -43021,12 +43167,12 @@ You have access to two tools for working with files: **${toolNamePrefix}write_to
43021
43167
  ## When to Use
43022
43168
 
43023
43169
  - Small, localized changes like updating a few lines, function implementations, changing variable names, modifying a section of text, etc.
43024
- - Targeted improvements where only specific portions of the files content needs to be altered.
43170
+ - Targeted improvements where only specific portions of the file's content needs to be altered.
43025
43171
  - Especially useful for long files where much of the file will remain unchanged.
43026
43172
 
43027
43173
  ## Advantages
43028
43174
 
43029
- - More efficient for minor edits, since you dont need to supply the entire file content.
43175
+ - More efficient for minor edits, since you don't need to supply the entire file content.
43030
43176
  - Reduces the chance of errors that can occur when overwriting large files.
43031
43177
 
43032
43178
  # Choosing the Appropriate Tool
@@ -43052,41 +43198,39 @@ var rules = (toolNamePrefix) => `
43052
43198
 
43053
43199
  RULES
43054
43200
 
43055
- - You may use \`cd\` to enter any child directory within the current working directory. For example, \`cd myChildDir\`. But you may never move to a parent directory or any directory outside your current path. For example, do not use \`cd ..\`, \`cd /\`, or any absolute path.
43056
- - Always work with relative path names, and never use absolute paths.
43057
- - When generating code or test or any file that support comments, add a comment on top of the file with a description of the file's purpose and a note that this file is generated by "polka.codes".
43058
- - When generate text file such as README.md, add a footer indicating this file is generated by "polka.codes".
43059
- - Before using the ${toolNamePrefix}execute_command tool, you must first think about the SYSTEM INFORMATION context provided to understand the user's environment and tailor your commands to ensure they are compatible with their system. You must also consider if the command you need to run should be executed in a specific directory outside of the current working directory, and if so prepend with \`cd\`'ing into that directory && then executing the command (as one command). For example, if you needed to run \`npm install\` in a project that's not in the current working directory, you would need to prepend with a \`cd\` i.e. pseudocode for this would be \`cd (path to project) && (command, in this case npm install)\`. However, you can only cd into child directory, but never parent directory or root directory or home directory.
43060
- - When using the ${toolNamePrefix}search_files tool, craft your regex patterns carefully to balance specificity and flexibility. Based on the user's task you may use it to find code patterns, TODO comments, function definitions, or any text-based information across the project. The results include context, so analyze the surrounding code to better understand the matches. Leverage the ${toolNamePrefix}search_files tool in combination with other tools for more comprehensive analysis. For example, use it to find specific code patterns, then use ${toolNamePrefix}read_file to examine the full context of interesting matches before using ${toolNamePrefix}replace_in_file to make informed changes.
43061
- - When creating a new project (such as an app, website, or any software project), organize all new files within a dedicated project directory unless the user specifies otherwise. Use appropriate file paths when creating files, as the ${toolNamePrefix}write_to_file tool will automatically create any necessary directories. Structure the project logically, adhering to best practices for the specific type of project being created. Unless otherwise specified, new projects should be easily run without additional setup, for example most projects can be built in HTML, CSS, and JavaScript - which you can open in a browser.
43062
- - Be sure to consider the type of project (e.g. Python, JavaScript, web application) when determining the appropriate structure and files to include. Also consider what files may be most relevant to accomplishing the task, for example looking at a project's manifest file would help you understand the project's dependencies, which you could incorporate into any code you write.
43063
- - When making changes to code, always consider the context in which the code is being used. Ensure that your changes are compatible with the existing codebase and that they follow the project's coding standards and best practices.
43064
- - **Adhere to any established coding style, linting rules, or naming conventions if they are known or can be inferred from the existing codebase, to maintain consistency.**
43065
- - When you want to modify a file, use the ${toolNamePrefix}replace_in_file or ${toolNamePrefix}write_to_file tool directly with the desired changes. You do not need to display the changes before using the tool.
43066
- - **Do not guess or hallucinate file content that has not been explicitly provided or read. Always read an existing file with \`${toolNamePrefix}read_file\` (or rely on content the user directly provided) before modifying it, unless you are creating a brand-new file.**
43067
- - Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the ${toolNamePrefix}attempt_completion tool to present the result to the user.
43068
- - The user may provide a file's contents directly in their message, in which case you shouldn't use the ${toolNamePrefix}read_file tool to get the file contents again since you already have it.
43069
- - Your goal is to try to accomplish the user's task, NOT engage in a back and forth conversation.
43070
- - NEVER end ${toolNamePrefix}attempt_completion result with a question or request to engage in further conversation! Formulate the end of your result in a way that is final and does not require further input from the user.
43071
- - You are STRICTLY FORBIDDEN from starting your messages with "Great", "Certainly", "Okay", "Sure". You should NOT be conversational in your responses, but rather direct and to the point. For example you should NOT say "Great, I've updated the CSS" but instead something like "I've updated the CSS". It is important you be clear and technical in your messages.
43072
- - When presented with images, utilize your vision capabilities to thoroughly examine them and extract meaningful information. Incorporate these insights into your thought process as you accomplish the user's task.
43073
- - When using the ${toolNamePrefix}replace_in_file tool, you must include complete lines in your SEARCH blocks, not partial lines. The system requires exact line matches and cannot match partial lines. For example, if you want to match a line containing "const x = 5;", your SEARCH block must include the entire line, not just "x = 5" or other fragments.
43074
- - When using the ${toolNamePrefix}replace_in_file tool, if you use multiple SEARCH/REPLACE blocks, list them in the order they appear in the file. For example if you need to make changes to both line 10 and line 50, first include the SEARCH/REPLACE block for line 10, followed by the SEARCH/REPLACE block for line 50.
43075
- - It is critical you wait for the user's response after each tool use, in order to confirm the success of the tool use. For example, if asked to make a todo app, you would create a file, wait for the user's response it was created successfully, then create another file if needed, wait for the user's response it was created successfully, etc.
43076
- - Keep the inline docs up to date if needed.
43201
+ - Work only with relative paths; you may \`cd\` into child directories but never use \`cd ..\`, root, or absolute paths.
43202
+ - When generating code, tests, or other comment-capable files, prepend a comment describing the file's purpose plus “generated by polka.codes”.
43203
+ For text files (e.g. README.md), append a footer with the same notice.
43204
+ - Never describe what changed inside code comments; comments must focus on purpose or usage only.
43205
+ - Before using ${toolNamePrefix}execute_command, consider SYSTEM INFORMATION to ensure commands suit the user's OS. If a command must run in a subdirectory, prepend a single \`cd childDir &&\` segment.
43206
+ - Use ${toolNamePrefix}search_files for broad analysis, then ${toolNamePrefix}read_file to inspect context, and finally ${toolNamePrefix}replace_in_file or ${toolNamePrefix}write_to_file to modify.
43207
+ - Prefer ${toolNamePrefix}replace_in_file for focused edits; choose ${toolNamePrefix}write_to_file for new files or complete rewrites.
43208
+ - When creating a new file, look for existing files with similar content or patterns; if found, read them and use their structure or conventions as a reference.
43209
+ - SEARCH blocks in ${toolNamePrefix}replace_in_file must match whole lines. If multiple blocks are needed, list them in file order.
43210
+ - Do not guess unseen content. Read existing files first unless creating new ones.
43211
+ - Follow existing style, lint, and naming conventions. Ensure all changes compile and pass tests where applicable.
43212
+ - ALWAYS wait for the user's confirmation after each tool call before starting the next step.
43213
+ - The agent must never invoke more than 5 tools in a single response.
43214
+ - Do not end ${toolNamePrefix}attempt_completion output with questions or conversational prompts.
43215
+ - Avoid filler words like “Great”, “Certainly”, “Okay”, “Sure” at the start of responses; be direct and technical.
43216
+ - Keep inline documentation current as you edit.
43077
43217
  `;
43078
43218
  var objectives = (toolNamePrefix) => `
43079
43219
  ====
43080
43220
 
43081
43221
  OBJECTIVE
43082
43222
 
43083
- You accomplish a given task iteratively, breaking it down into clear steps and working through them methodically.
43223
+ You solve the user's task by working in small, verifiable steps.
43084
43224
 
43085
- 1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order.
43086
- 2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go.
43087
- 3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within <thinking></thinking> tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use.
43088
- 4. Once you've completed the user's task, you must use the ${toolNamePrefix}attempt_completion tool to present the result of the task to the user.
43089
- 5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance.`;
43225
+ 1. **Plan** - Parse the task, list clear goals, and order them logically.
43226
+ 2. **Think** - Wrap private reasoning in <thinking></thinking>.
43227
+ Review project context.
43228
+ Select the single best tool for the next goal.
43229
+ Ensure every required parameter is available or can be inferred.
43230
+ 3. **Act** - Invoke one tool per step. Wait for the system's response (and user confirmation where required) before continuing.
43231
+ 4. **Iterate** - Repeat Plan → Think → Act until all goals are complete.
43232
+ 5. **Complete** - Use ${toolNamePrefix}attempt_completion to deliver the final result. Do not invite further discussion unless the user explicitly requests changes.
43233
+ `;
43090
43234
  var fullSystemPrompt4 = (info2, tools, toolNamePrefix, instructions, scripts) => `
43091
43235
  ${basePrompt2}
43092
43236
  ${toolUsePrompt(tools, toolNamePrefix)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polka-codes/cli",
3
- "version": "0.8.3",
3
+ "version": "0.8.5",
4
4
  "license": "AGPL-3.0",
5
5
  "author": "github@polka.codes",
6
6
  "type": "module",