@polka-codes/cli 0.8.4 → 0.8.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.
- package/dist/index.js +38 -32
- 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.
|
|
31553
|
+
var version = "0.8.6";
|
|
31554
31554
|
|
|
31555
31555
|
// ../core/src/AiService/AiServiceBase.ts
|
|
31556
31556
|
class AiServiceBase {
|
|
@@ -40953,6 +40953,14 @@ var getStringArray = (args2, name2, defaultValue) => {
|
|
|
40953
40953
|
if (ret === "") {
|
|
40954
40954
|
return [];
|
|
40955
40955
|
}
|
|
40956
|
+
if (Array.isArray(ret)) {
|
|
40957
|
+
for (const item of ret) {
|
|
40958
|
+
if (typeof item !== "string") {
|
|
40959
|
+
throw new Error(`Invalid argument type: ${name2} ${item}`);
|
|
40960
|
+
}
|
|
40961
|
+
}
|
|
40962
|
+
return ret;
|
|
40963
|
+
}
|
|
40956
40964
|
if (typeof ret !== "string") {
|
|
40957
40965
|
throw new Error(`Invalid argument type: ${name2} ${ret}`);
|
|
40958
40966
|
}
|
|
@@ -43154,7 +43162,7 @@ You have access to two tools for working with files: **${toolNamePrefix}write_to
|
|
|
43154
43162
|
|
|
43155
43163
|
## Important Considerations
|
|
43156
43164
|
|
|
43157
|
-
- Using ${toolNamePrefix}write_to_file requires providing the file
|
|
43165
|
+
- Using ${toolNamePrefix}write_to_file requires providing the file's complete final content.
|
|
43158
43166
|
- 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.
|
|
43159
43167
|
- While ${toolNamePrefix}write_to_file should not be your default choice, don't hesitate to use it when the situation truly calls for it.
|
|
43160
43168
|
|
|
@@ -43167,12 +43175,12 @@ You have access to two tools for working with files: **${toolNamePrefix}write_to
|
|
|
43167
43175
|
## When to Use
|
|
43168
43176
|
|
|
43169
43177
|
- Small, localized changes like updating a few lines, function implementations, changing variable names, modifying a section of text, etc.
|
|
43170
|
-
- Targeted improvements where only specific portions of the file
|
|
43178
|
+
- Targeted improvements where only specific portions of the file's content needs to be altered.
|
|
43171
43179
|
- Especially useful for long files where much of the file will remain unchanged.
|
|
43172
43180
|
|
|
43173
43181
|
## Advantages
|
|
43174
43182
|
|
|
43175
|
-
- More efficient for minor edits, since you don
|
|
43183
|
+
- More efficient for minor edits, since you don't need to supply the entire file content.
|
|
43176
43184
|
- Reduces the chance of errors that can occur when overwriting large files.
|
|
43177
43185
|
|
|
43178
43186
|
# Choosing the Appropriate Tool
|
|
@@ -43198,41 +43206,39 @@ var rules = (toolNamePrefix) => `
|
|
|
43198
43206
|
|
|
43199
43207
|
RULES
|
|
43200
43208
|
|
|
43201
|
-
-
|
|
43202
|
-
-
|
|
43203
|
-
|
|
43204
|
-
-
|
|
43205
|
-
- Before using
|
|
43206
|
-
-
|
|
43207
|
-
-
|
|
43208
|
-
-
|
|
43209
|
-
-
|
|
43210
|
-
-
|
|
43211
|
-
-
|
|
43212
|
-
-
|
|
43213
|
-
-
|
|
43214
|
-
-
|
|
43215
|
-
-
|
|
43216
|
-
-
|
|
43217
|
-
- 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.
|
|
43218
|
-
- 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.
|
|
43219
|
-
- 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.
|
|
43220
|
-
- 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.
|
|
43221
|
-
- 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.
|
|
43222
|
-
- Keep the inline docs up to date if needed.
|
|
43209
|
+
- Work only with relative paths; you may \`cd\` into child directories but never use \`cd ..\`, root, or absolute paths.
|
|
43210
|
+
- When generating code, tests, or other comment-capable files, prepend a comment describing the file's purpose plus “generated by polka.codes”.
|
|
43211
|
+
For text files (e.g. README.md), append a footer with the same notice.
|
|
43212
|
+
- Never describe what changed inside code comments; comments must focus on purpose or usage only.
|
|
43213
|
+
- 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.
|
|
43214
|
+
- 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.
|
|
43215
|
+
- Prefer ${toolNamePrefix}replace_in_file for focused edits; choose ${toolNamePrefix}write_to_file for new files or complete rewrites.
|
|
43216
|
+
- 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.
|
|
43217
|
+
- SEARCH blocks in ${toolNamePrefix}replace_in_file must match whole lines. If multiple blocks are needed, list them in file order.
|
|
43218
|
+
- Do not guess unseen content. Read existing files first unless creating new ones.
|
|
43219
|
+
- Follow existing style, lint, and naming conventions. Ensure all changes compile and pass tests where applicable.
|
|
43220
|
+
- ALWAYS wait for the user's confirmation after each tool call before starting the next step.
|
|
43221
|
+
- The agent must never invoke more than 5 tools in a single response.
|
|
43222
|
+
- Do not end ${toolNamePrefix}attempt_completion output with questions or conversational prompts.
|
|
43223
|
+
- Avoid filler words like “Great”, “Certainly”, “Okay”, “Sure” at the start of responses; be direct and technical.
|
|
43224
|
+
- Keep inline documentation current as you edit.
|
|
43223
43225
|
`;
|
|
43224
43226
|
var objectives = (toolNamePrefix) => `
|
|
43225
43227
|
====
|
|
43226
43228
|
|
|
43227
43229
|
OBJECTIVE
|
|
43228
43230
|
|
|
43229
|
-
You
|
|
43231
|
+
You solve the user's task by working in small, verifiable steps.
|
|
43230
43232
|
|
|
43231
|
-
1.
|
|
43232
|
-
2.
|
|
43233
|
-
|
|
43234
|
-
|
|
43235
|
-
|
|
43233
|
+
1. **Plan** - Parse the task, list clear goals, and order them logically.
|
|
43234
|
+
2. **Think** - Wrap private reasoning in <thinking></thinking>.
|
|
43235
|
+
• Review project context.
|
|
43236
|
+
• Select the single best tool for the next goal.
|
|
43237
|
+
• Ensure every required parameter is available or can be inferred.
|
|
43238
|
+
3. **Act** - Invoke one tool per step. Wait for the system's response (and user confirmation where required) before continuing.
|
|
43239
|
+
4. **Iterate** - Repeat Plan → Think → Act until all goals are complete.
|
|
43240
|
+
5. **Complete** - Use ${toolNamePrefix}attempt_completion to deliver the final result. Do not invite further discussion unless the user explicitly requests changes.
|
|
43241
|
+
`;
|
|
43236
43242
|
var fullSystemPrompt4 = (info2, tools, toolNamePrefix, instructions, scripts) => `
|
|
43237
43243
|
${basePrompt2}
|
|
43238
43244
|
${toolUsePrompt(tools, toolNamePrefix)}
|