From 9dc36e5a3950902ed7bca5d702236b551fa19029 Mon Sep 17 00:00:00 2001 From: Phodal Huang Date: Thu, 21 Mar 2024 11:51:44 +0800 Subject: [PATCH] feat(language): add support for file function with dynamic file names #100 - Added support for dynamic file names in the FILE_FUNC command by importing FileFunc and using its values to dynamically generate the description. - Also added new files for various tool examples: write, symbol, rev, file, commit, shell, run, patch, and file-func. --- .../devti/language/dataprovider/BuiltinCommand.kt | 11 ++++++++++- .../main/resources/agent/toolExamples/commit.devin | 5 +++++ .../src/main/resources/agent/toolExamples/file.devin | 1 + .../main/resources/agent/toolExamples/fine-func.devin | 1 + .../src/main/resources/agent/toolExamples/patch.devin | 5 +++++ .../src/main/resources/agent/toolExamples/rev.devin | 1 + .../src/main/resources/agent/toolExamples/run.devin | 1 + .../src/main/resources/agent/toolExamples/shell.devin | 1 + .../main/resources/agent/toolExamples/symbol.devin | 1 + .../src/main/resources/agent/toolExamples/write.devin | 5 +++++ 10 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 exts/devins-lang/src/main/resources/agent/toolExamples/commit.devin create mode 100644 exts/devins-lang/src/main/resources/agent/toolExamples/file.devin create mode 100644 exts/devins-lang/src/main/resources/agent/toolExamples/fine-func.devin create mode 100644 exts/devins-lang/src/main/resources/agent/toolExamples/patch.devin create mode 100644 exts/devins-lang/src/main/resources/agent/toolExamples/rev.devin create mode 100644 exts/devins-lang/src/main/resources/agent/toolExamples/run.devin create mode 100644 exts/devins-lang/src/main/resources/agent/toolExamples/shell.devin create mode 100644 exts/devins-lang/src/main/resources/agent/toolExamples/symbol.devin create mode 100644 exts/devins-lang/src/main/resources/agent/toolExamples/write.devin diff --git a/exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/dataprovider/BuiltinCommand.kt b/exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/dataprovider/BuiltinCommand.kt index 97cff7566f..34cd95021d 100644 --- a/exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/dataprovider/BuiltinCommand.kt +++ b/exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/dataprovider/BuiltinCommand.kt @@ -1,8 +1,11 @@ package cc.unitmesh.devti.language.dataprovider +import cc.unitmesh.devti.language.compiler.model.FileFunc import com.intellij.icons.AllIcons import javax.swing.Icon +val filesFuncNames = FileFunc.values().map { it.funcName } + enum class BuiltinCommand( val commandName: String, val description: String, @@ -25,7 +28,13 @@ enum class BuiltinCommand( RUN("run", "Run the content of a file", AllIcons.Actions.Execute, true, true), SHELL("shell", "Run shell command", AllIcons.Actions.Execute, true, true), COMMIT("commit", "Commit the content of a file", AllIcons.Vcs.CommitNode, false), - FILE_FUNC("file-func", "Read the name of a file", AllIcons.Actions.GroupByFile, true, true), + FILE_FUNC( + "file-func", + "Read the name of a file, support for: " + filesFuncNames.joinToString(","), + AllIcons.Actions.GroupByFile, + true, + true + ), ; companion object { diff --git a/exts/devins-lang/src/main/resources/agent/toolExamples/commit.devin b/exts/devins-lang/src/main/resources/agent/toolExamples/commit.devin new file mode 100644 index 0000000000..288fecc941 --- /dev/null +++ b/exts/devins-lang/src/main/resources/agent/toolExamples/commit.devin @@ -0,0 +1,5 @@ +/commit + +```markdown +[//]: # (follow Conventional Commits, like feat: add 'graphiteWidth' option) +``` diff --git a/exts/devins-lang/src/main/resources/agent/toolExamples/file.devin b/exts/devins-lang/src/main/resources/agent/toolExamples/file.devin new file mode 100644 index 0000000000..e6ee2fd5f3 --- /dev/null +++ b/exts/devins-lang/src/main/resources/agent/toolExamples/file.devin @@ -0,0 +1 @@ +/file:.github/dependabot.yml \ No newline at end of file diff --git a/exts/devins-lang/src/main/resources/agent/toolExamples/fine-func.devin b/exts/devins-lang/src/main/resources/agent/toolExamples/fine-func.devin new file mode 100644 index 0000000000..bd1d50cf7a --- /dev/null +++ b/exts/devins-lang/src/main/resources/agent/toolExamples/fine-func.devin @@ -0,0 +1 @@ +/file-func:regex(".*\.txt") \ No newline at end of file diff --git a/exts/devins-lang/src/main/resources/agent/toolExamples/patch.devin b/exts/devins-lang/src/main/resources/agent/toolExamples/patch.devin new file mode 100644 index 0000000000..eb9d8c2b30 --- /dev/null +++ b/exts/devins-lang/src/main/resources/agent/toolExamples/patch.devin @@ -0,0 +1,5 @@ +/patch + +```patch +// the patch to apply +``` diff --git a/exts/devins-lang/src/main/resources/agent/toolExamples/rev.devin b/exts/devins-lang/src/main/resources/agent/toolExamples/rev.devin new file mode 100644 index 0000000000..3678203f43 --- /dev/null +++ b/exts/devins-lang/src/main/resources/agent/toolExamples/rev.devin @@ -0,0 +1 @@ +/rev:38d23de2 \ No newline at end of file diff --git a/exts/devins-lang/src/main/resources/agent/toolExamples/run.devin b/exts/devins-lang/src/main/resources/agent/toolExamples/run.devin new file mode 100644 index 0000000000..d02c509b90 --- /dev/null +++ b/exts/devins-lang/src/main/resources/agent/toolExamples/run.devin @@ -0,0 +1 @@ +/run:src/main/cc/unitmesh/PythonPromptStrategyTest.kt \ No newline at end of file diff --git a/exts/devins-lang/src/main/resources/agent/toolExamples/shell.devin b/exts/devins-lang/src/main/resources/agent/toolExamples/shell.devin new file mode 100644 index 0000000000..6955ced87e --- /dev/null +++ b/exts/devins-lang/src/main/resources/agent/toolExamples/shell.devin @@ -0,0 +1 @@ +/shell:execute.sh \ No newline at end of file diff --git a/exts/devins-lang/src/main/resources/agent/toolExamples/symbol.devin b/exts/devins-lang/src/main/resources/agent/toolExamples/symbol.devin new file mode 100644 index 0000000000..07836e352f --- /dev/null +++ b/exts/devins-lang/src/main/resources/agent/toolExamples/symbol.devin @@ -0,0 +1 @@ +/symbol:cc.unitmesh.devti.language.psi \ No newline at end of file diff --git a/exts/devins-lang/src/main/resources/agent/toolExamples/write.devin b/exts/devins-lang/src/main/resources/agent/toolExamples/write.devin new file mode 100644 index 0000000000..17f972e0e7 --- /dev/null +++ b/exts/devins-lang/src/main/resources/agent/toolExamples/write.devin @@ -0,0 +1,5 @@ +/write:src/main/kotlin/cc/unitmesh/context/CppFileContextBuilder.kt + +```kotlin +// some code +```