@polka-codes/core 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 +80 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9996,8 +9996,80 @@ class MultiAgent {
|
|
|
9996
9996
|
|
|
9997
9997
|
// src/Agent/index.ts
|
|
9998
9998
|
var allAgents = [architectAgentInfo, coderAgentInfo, analyzerAgentInfo];
|
|
9999
|
+
// src/AiTool/createNewProject.ts
|
|
10000
|
+
var prompt = `You are an AiTool designed to assist users in creating new projects. Follow these guidelines:
|
|
10001
|
+
|
|
10002
|
+
1. **Gather Information:**
|
|
10003
|
+
- Begin by asking the user for essential project details, including:
|
|
10004
|
+
- Project type (e.g., web, mobile, desktop, etc.)
|
|
10005
|
+
- Desired programming languages
|
|
10006
|
+
- Preferred frameworks or libraries
|
|
10007
|
+
- Build tools and package manager preferences
|
|
10008
|
+
- Testing frameworks and patterns
|
|
10009
|
+
- Code style and linting preferences
|
|
10010
|
+
- Any additional specifications or requirements
|
|
10011
|
+
|
|
10012
|
+
2. **Clarification & Confirmation:**
|
|
10013
|
+
- Do not make any decisions or assumptions on behalf of the user.
|
|
10014
|
+
- Ask clarifying questions if any detail is ambiguous.
|
|
10015
|
+
- Confirm each piece of information with the user before proceeding to the next step.
|
|
10016
|
+
|
|
10017
|
+
3. **Avoid Redundancy:**
|
|
10018
|
+
- Do not repeat questions or details that have already been confirmed.
|
|
10019
|
+
- Keep interactions concise and focused on gathering complete and accurate details.
|
|
10020
|
+
|
|
10021
|
+
4. **Generate Configuration:**
|
|
10022
|
+
- Based on the collected information, generate a .polkacodes.yml configuration file that includes:
|
|
10023
|
+
- scripts section with common development commands (test, format, check, etc.)
|
|
10024
|
+
- rules section reflecting project conventions and tools
|
|
10025
|
+
- excludeFiles section for sensitive and generated files
|
|
10026
|
+
- Example structure:
|
|
10027
|
+
\`\`\`yaml
|
|
10028
|
+
scripts:
|
|
10029
|
+
test:
|
|
10030
|
+
command: "[test-command]"
|
|
10031
|
+
description: "Run tests"
|
|
10032
|
+
format:
|
|
10033
|
+
command: "[format-command]"
|
|
10034
|
+
description: "Format code"
|
|
10035
|
+
check:
|
|
10036
|
+
command: "[check-command]"
|
|
10037
|
+
description: "Check code"
|
|
10038
|
+
|
|
10039
|
+
rules:
|
|
10040
|
+
- "[package-manager-rule]"
|
|
10041
|
+
- "[testing-framework-rule]"
|
|
10042
|
+
- "[code-style-rule]"
|
|
10043
|
+
- "[other-rule]"
|
|
10044
|
+
|
|
10045
|
+
excludeFiles:
|
|
10046
|
+
- ".env"
|
|
10047
|
+
- ".env.*"
|
|
10048
|
+
\`\`\`
|
|
10049
|
+
|
|
10050
|
+
5. **Handover to Coder Agent:**
|
|
10051
|
+
- Once all required information is collected and validated by the user, compile:
|
|
10052
|
+
1. The final project specifications
|
|
10053
|
+
2. The .polkacodes.yml configuration content
|
|
10054
|
+
- Clearly hand over these details to the coder agent, instructing them to:
|
|
10055
|
+
1. Create the new project based on the confirmed specifications
|
|
10056
|
+
2. Include the .polkacodes.yml file in the project root
|
|
10057
|
+
3. Ensure all specified tools and configurations are properly set up`;
|
|
10058
|
+
var createNewProject_default = {
|
|
10059
|
+
name: "createNewProject",
|
|
10060
|
+
description: "Creates a new project",
|
|
10061
|
+
prompt,
|
|
10062
|
+
formatInput: (params) => {
|
|
10063
|
+
return `<project_name>${params}</project_name>`;
|
|
10064
|
+
},
|
|
10065
|
+
parseOutput: (output) => {
|
|
10066
|
+
return output.trim();
|
|
10067
|
+
},
|
|
10068
|
+
agent: "architect"
|
|
10069
|
+
};
|
|
10070
|
+
|
|
9999
10071
|
// src/AiTool/generateGitCommitMessage.ts
|
|
10000
|
-
var
|
|
10072
|
+
var prompt2 = `
|
|
10001
10073
|
You are an advanced assistant specialized in creating concise and accurate Git commit messages. When you receive:
|
|
10002
10074
|
- A Git diff inside the <tool_input> tag.
|
|
10003
10075
|
- Additional user-supplied context inside the <tool_input_context> tag (if any).
|
|
@@ -10032,7 +10104,7 @@ Follow the same structure for any new input. Never repeat questions; focus on ge
|
|
|
10032
10104
|
var generateGitCommitMessage_default = {
|
|
10033
10105
|
name: "generateGitCommitMessage",
|
|
10034
10106
|
description: "Generates git commit messages from git diff output",
|
|
10035
|
-
prompt,
|
|
10107
|
+
prompt: prompt2,
|
|
10036
10108
|
formatInput: (params) => {
|
|
10037
10109
|
let ret = `<tool_input>
|
|
10038
10110
|
${params.diff}
|
|
@@ -10057,7 +10129,7 @@ ${output}`);
|
|
|
10057
10129
|
};
|
|
10058
10130
|
|
|
10059
10131
|
// src/AiTool/generateGithubPullRequestDetails.ts
|
|
10060
|
-
var
|
|
10132
|
+
var prompt3 = `
|
|
10061
10133
|
# Generate Github Pull Request Details
|
|
10062
10134
|
|
|
10063
10135
|
You are given:
|
|
@@ -10141,7 +10213,7 @@ Use the above format whenever you receive <tool_input> that may include a branch
|
|
|
10141
10213
|
var generateGithubPullRequestDetails_default = {
|
|
10142
10214
|
name: "generateGithubPullRequestDetails",
|
|
10143
10215
|
description: "Generates a GitHub pull request title and description from git commits",
|
|
10144
|
-
prompt:
|
|
10216
|
+
prompt: prompt3,
|
|
10145
10217
|
formatInput: (params) => {
|
|
10146
10218
|
return `<tool_input>
|
|
10147
10219
|
<tool_input_branch_name>${params.branchName}</tool_input_branch_name>${params.context ? `
|
|
@@ -10174,7 +10246,7 @@ ${output}`);
|
|
|
10174
10246
|
};
|
|
10175
10247
|
|
|
10176
10248
|
// src/AiTool/generateProjectConfig.ts
|
|
10177
|
-
var
|
|
10249
|
+
var prompt4 = `You are an analyzer agent responsible for examining project files and generating appropriate polkacodes configuration. Your task is to:
|
|
10178
10250
|
|
|
10179
10251
|
1. Read and analyze the provided files using tool_read_file to understand:
|
|
10180
10252
|
- Build tools and package manager (e.g., bun, npm)
|
|
@@ -10241,7 +10313,7 @@ The configuration should accurately reflect the project's structure, tools, and
|
|
|
10241
10313
|
var generateProjectConfig_default = {
|
|
10242
10314
|
name: "generateProjectConfig",
|
|
10243
10315
|
description: "Analyzes project files to generate polkacodes config sections",
|
|
10244
|
-
prompt:
|
|
10316
|
+
prompt: prompt4,
|
|
10245
10317
|
formatInput: (params) => {
|
|
10246
10318
|
return `<tool_input>
|
|
10247
10319
|
${params.join(`
|
|
@@ -10292,6 +10364,7 @@ var makeAgentTool = (definition) => {
|
|
|
10292
10364
|
var generateGitCommitMessage = makeTool(generateGitCommitMessage_default);
|
|
10293
10365
|
var generateGithubPullRequestDetails = makeTool(generateGithubPullRequestDetails_default);
|
|
10294
10366
|
var generateProjectConfig = makeAgentTool(generateProjectConfig_default);
|
|
10367
|
+
var createNewProject = makeAgentTool(createNewProject_default);
|
|
10295
10368
|
export {
|
|
10296
10369
|
writeToFile_default as writeToFile,
|
|
10297
10370
|
searchFiles_default as searchFiles,
|
|
@@ -10316,6 +10389,7 @@ export {
|
|
|
10316
10389
|
deepSeekModels,
|
|
10317
10390
|
deepSeekDefaultModelId,
|
|
10318
10391
|
createService,
|
|
10392
|
+
createNewProject,
|
|
10319
10393
|
coderAgentInfo,
|
|
10320
10394
|
attemptCompletion_default as attemptCompletion,
|
|
10321
10395
|
askFollowupQuestion_default as askFollowupQuestion,
|