@polka-codes/cli 0.5.0 → 0.5.1
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 +86 -13
- 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.5.
|
|
24632
|
+
var version = "0.5.1";
|
|
24633
24633
|
|
|
24634
24634
|
// ../../node_modules/@anthropic-ai/sdk/version.mjs
|
|
24635
24635
|
var VERSION = "0.36.2";
|
|
@@ -34874,8 +34874,80 @@ class MultiAgent {
|
|
|
34874
34874
|
|
|
34875
34875
|
// ../core/src/Agent/index.ts
|
|
34876
34876
|
var allAgents = [architectAgentInfo, coderAgentInfo, analyzerAgentInfo];
|
|
34877
|
+
// ../core/src/AiTool/createNewProject.ts
|
|
34878
|
+
var prompt = `You are an AiTool designed to assist users in creating new projects. Follow these guidelines:
|
|
34879
|
+
|
|
34880
|
+
1. **Gather Information:**
|
|
34881
|
+
- Begin by asking the user for essential project details, including:
|
|
34882
|
+
- Project type (e.g., web, mobile, desktop, etc.)
|
|
34883
|
+
- Desired programming languages
|
|
34884
|
+
- Preferred frameworks or libraries
|
|
34885
|
+
- Build tools and package manager preferences
|
|
34886
|
+
- Testing frameworks and patterns
|
|
34887
|
+
- Code style and linting preferences
|
|
34888
|
+
- Any additional specifications or requirements
|
|
34889
|
+
|
|
34890
|
+
2. **Clarification & Confirmation:**
|
|
34891
|
+
- Do not make any decisions or assumptions on behalf of the user.
|
|
34892
|
+
- Ask clarifying questions if any detail is ambiguous.
|
|
34893
|
+
- Confirm each piece of information with the user before proceeding to the next step.
|
|
34894
|
+
|
|
34895
|
+
3. **Avoid Redundancy:**
|
|
34896
|
+
- Do not repeat questions or details that have already been confirmed.
|
|
34897
|
+
- Keep interactions concise and focused on gathering complete and accurate details.
|
|
34898
|
+
|
|
34899
|
+
4. **Generate Configuration:**
|
|
34900
|
+
- Based on the collected information, generate a .polkacodes.yml configuration file that includes:
|
|
34901
|
+
- scripts section with common development commands (test, format, check, etc.)
|
|
34902
|
+
- rules section reflecting project conventions and tools
|
|
34903
|
+
- excludeFiles section for sensitive and generated files
|
|
34904
|
+
- Example structure:
|
|
34905
|
+
\`\`\`yaml
|
|
34906
|
+
scripts:
|
|
34907
|
+
test:
|
|
34908
|
+
command: "[test-command]"
|
|
34909
|
+
description: "Run tests"
|
|
34910
|
+
format:
|
|
34911
|
+
command: "[format-command]"
|
|
34912
|
+
description: "Format code"
|
|
34913
|
+
check:
|
|
34914
|
+
command: "[check-command]"
|
|
34915
|
+
description: "Check code"
|
|
34916
|
+
|
|
34917
|
+
rules:
|
|
34918
|
+
- "[package-manager-rule]"
|
|
34919
|
+
- "[testing-framework-rule]"
|
|
34920
|
+
- "[code-style-rule]"
|
|
34921
|
+
- "[other-rule]"
|
|
34922
|
+
|
|
34923
|
+
excludeFiles:
|
|
34924
|
+
- ".env"
|
|
34925
|
+
- ".env.*"
|
|
34926
|
+
\`\`\`
|
|
34927
|
+
|
|
34928
|
+
5. **Handover to Coder Agent:**
|
|
34929
|
+
- Once all required information is collected and validated by the user, compile:
|
|
34930
|
+
1. The final project specifications
|
|
34931
|
+
2. The .polkacodes.yml configuration content
|
|
34932
|
+
- Clearly hand over these details to the coder agent, instructing them to:
|
|
34933
|
+
1. Create the new project based on the confirmed specifications
|
|
34934
|
+
2. Include the .polkacodes.yml file in the project root
|
|
34935
|
+
3. Ensure all specified tools and configurations are properly set up`;
|
|
34936
|
+
var createNewProject_default = {
|
|
34937
|
+
name: "createNewProject",
|
|
34938
|
+
description: "Creates a new project",
|
|
34939
|
+
prompt,
|
|
34940
|
+
formatInput: (params) => {
|
|
34941
|
+
return `<project_name>${params}</project_name>`;
|
|
34942
|
+
},
|
|
34943
|
+
parseOutput: (output) => {
|
|
34944
|
+
return output.trim();
|
|
34945
|
+
},
|
|
34946
|
+
agent: "architect"
|
|
34947
|
+
};
|
|
34948
|
+
|
|
34877
34949
|
// ../core/src/AiTool/generateGitCommitMessage.ts
|
|
34878
|
-
var
|
|
34950
|
+
var prompt2 = `
|
|
34879
34951
|
You are an advanced assistant specialized in creating concise and accurate Git commit messages. When you receive:
|
|
34880
34952
|
- A Git diff inside the <tool_input> tag.
|
|
34881
34953
|
- Additional user-supplied context inside the <tool_input_context> tag (if any).
|
|
@@ -34910,7 +34982,7 @@ Follow the same structure for any new input. Never repeat questions; focus on ge
|
|
|
34910
34982
|
var generateGitCommitMessage_default = {
|
|
34911
34983
|
name: "generateGitCommitMessage",
|
|
34912
34984
|
description: "Generates git commit messages from git diff output",
|
|
34913
|
-
prompt,
|
|
34985
|
+
prompt: prompt2,
|
|
34914
34986
|
formatInput: (params) => {
|
|
34915
34987
|
let ret = `<tool_input>
|
|
34916
34988
|
${params.diff}
|
|
@@ -34935,7 +35007,7 @@ ${output}`);
|
|
|
34935
35007
|
};
|
|
34936
35008
|
|
|
34937
35009
|
// ../core/src/AiTool/generateGithubPullRequestDetails.ts
|
|
34938
|
-
var
|
|
35010
|
+
var prompt3 = `
|
|
34939
35011
|
# Generate Github Pull Request Details
|
|
34940
35012
|
|
|
34941
35013
|
You are given:
|
|
@@ -35019,7 +35091,7 @@ Use the above format whenever you receive <tool_input> that may include a branch
|
|
|
35019
35091
|
var generateGithubPullRequestDetails_default = {
|
|
35020
35092
|
name: "generateGithubPullRequestDetails",
|
|
35021
35093
|
description: "Generates a GitHub pull request title and description from git commits",
|
|
35022
|
-
prompt:
|
|
35094
|
+
prompt: prompt3,
|
|
35023
35095
|
formatInput: (params) => {
|
|
35024
35096
|
return `<tool_input>
|
|
35025
35097
|
<tool_input_branch_name>${params.branchName}</tool_input_branch_name>${params.context ? `
|
|
@@ -35052,7 +35124,7 @@ ${output}`);
|
|
|
35052
35124
|
};
|
|
35053
35125
|
|
|
35054
35126
|
// ../core/src/AiTool/generateProjectConfig.ts
|
|
35055
|
-
var
|
|
35127
|
+
var prompt4 = `You are an analyzer agent responsible for examining project files and generating appropriate polkacodes configuration. Your task is to:
|
|
35056
35128
|
|
|
35057
35129
|
1. Read and analyze the provided files using tool_read_file to understand:
|
|
35058
35130
|
- Build tools and package manager (e.g., bun, npm)
|
|
@@ -35119,7 +35191,7 @@ The configuration should accurately reflect the project's structure, tools, and
|
|
|
35119
35191
|
var generateProjectConfig_default = {
|
|
35120
35192
|
name: "generateProjectConfig",
|
|
35121
35193
|
description: "Analyzes project files to generate polkacodes config sections",
|
|
35122
|
-
prompt:
|
|
35194
|
+
prompt: prompt4,
|
|
35123
35195
|
formatInput: (params) => {
|
|
35124
35196
|
return `<tool_input>
|
|
35125
35197
|
${params.join(`
|
|
@@ -35170,6 +35242,7 @@ var makeAgentTool = (definition) => {
|
|
|
35170
35242
|
var generateGitCommitMessage = makeTool(generateGitCommitMessage_default);
|
|
35171
35243
|
var generateGithubPullRequestDetails = makeTool(generateGithubPullRequestDetails_default);
|
|
35172
35244
|
var generateProjectConfig = makeAgentTool(generateProjectConfig_default);
|
|
35245
|
+
var createNewProject = makeAgentTool(createNewProject_default);
|
|
35173
35246
|
// src/Chat.ts
|
|
35174
35247
|
import readline from "node:readline";
|
|
35175
35248
|
|
|
@@ -36232,11 +36305,11 @@ class ScreenManager {
|
|
|
36232
36305
|
render(content, bottomContent = "") {
|
|
36233
36306
|
const promptLine = lastLine(content);
|
|
36234
36307
|
const rawPromptLine = import_strip_ansi.default(promptLine);
|
|
36235
|
-
let
|
|
36308
|
+
let prompt5 = rawPromptLine;
|
|
36236
36309
|
if (this.rl.line.length > 0) {
|
|
36237
|
-
|
|
36310
|
+
prompt5 = prompt5.slice(0, -this.rl.line.length);
|
|
36238
36311
|
}
|
|
36239
|
-
this.rl.setPrompt(
|
|
36312
|
+
this.rl.setPrompt(prompt5);
|
|
36240
36313
|
this.cursorPos = this.rl.getCursorPos();
|
|
36241
36314
|
const width = readlineWidth();
|
|
36242
36315
|
content = breakLines(content, width);
|
|
@@ -36306,7 +36379,7 @@ function getCallSites() {
|
|
|
36306
36379
|
function createPrompt(view) {
|
|
36307
36380
|
const callSites = getCallSites();
|
|
36308
36381
|
const callerFilename = callSites[1]?.getFileName?.();
|
|
36309
|
-
const
|
|
36382
|
+
const prompt5 = (config, context = {}) => {
|
|
36310
36383
|
const { input = process.stdin, signal } = context;
|
|
36311
36384
|
const cleanups = new Set;
|
|
36312
36385
|
const output = new import_mute_stream.default;
|
|
@@ -36367,7 +36440,7 @@ function createPrompt(view) {
|
|
|
36367
36440
|
}).then(() => promise), { cancel });
|
|
36368
36441
|
});
|
|
36369
36442
|
};
|
|
36370
|
-
return
|
|
36443
|
+
return prompt5;
|
|
36371
36444
|
}
|
|
36372
36445
|
// ../../node_modules/@inquirer/core/dist/esm/lib/Separator.js
|
|
36373
36446
|
var import_yoctocolors_cjs2 = __toESM(require_yoctocolors_cjs(), 1);
|
|
@@ -42926,7 +42999,7 @@ async function runTask(taskArg, _options, command) {
|
|
|
42926
42999
|
}
|
|
42927
43000
|
}
|
|
42928
43001
|
const { config, providerConfig, verbose, maxMessageCount, budget } = parseOptions(command.opts());
|
|
42929
|
-
const { provider: provider2, model, apiKey } = providerConfig.
|
|
43002
|
+
const { provider: provider2, model, apiKey } = providerConfig.getConfigForAgent("architect") ?? {};
|
|
42930
43003
|
if (!provider2 || !model) {
|
|
42931
43004
|
console.error("Provider and model must be configured");
|
|
42932
43005
|
process.exit(1);
|