Skip to content

Commit e8d7791

Browse files
committed
refactor(kanban): remove unused code and simplify Kanban interface #332
- Delete unused files: SimpleProjectInfo, StoryConfig, PromptTemplate, and related tests. - Remove FILE_FUNC command and associated logic. - Simplify Kanban interface by removing unused methods: isValidStory, getProjectInfo, getStories, and updateStoryDetail. - Update related implementations (GitLabIssue, GitHubIssue) to reflect interface changes.
1 parent 2715ae1 commit e8d7791

File tree

13 files changed

+1
-359
lines changed

13 files changed

+1
-359
lines changed

core/src/main/kotlin/cc/unitmesh/devti/devin/dataprovider/BuiltinCommand.kt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,6 @@ enum class BuiltinCommand(
6363
true
6464
),
6565
COMMIT("commit", "Do commit with current workspace with some messages.", AllIcons.Vcs.CommitNode, false),
66-
FILE_FUNC(
67-
"file-func",
68-
"Read the name of a file, support for: " + FileFunc.values().joinToString(",") { it.funcName },
69-
AllIcons.Actions.GroupByFile,
70-
true,
71-
true,
72-
enableInSketch = false,
73-
),
7466
BROWSE("browse", "Fetch the content of a given URL.", AllIcons.Toolwindows.WebToolWindow, false, true),
7567
REFACTOR(
7668
"refactor",

core/src/main/kotlin/cc/unitmesh/devti/flow/PromptTemplate.kt

Lines changed: 0 additions & 81 deletions
This file was deleted.
Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,13 @@
11
package cc.unitmesh.devti.flow.kanban
22

3-
import cc.unitmesh.devti.flow.model.SimpleProjectInfo
43
import cc.unitmesh.devti.flow.model.SimpleStory
54

6-
/**
7-
* The Kanban interface represents a kanban board that manages user stories for a project.
8-
* It provides methods to validate stories, retrieve project information, retrieve stories,
9-
* retrieve a story by ID, and update story details.
10-
*/
115
interface Kanban {
12-
/**
13-
* Checks if the given content is a valid story.
14-
*
15-
* @param content The content to be checked.
16-
* @return true if the content contains the keywords "用户故事" or "User Story", false otherwise.
17-
*/
18-
fun isValidStory(content: String): Boolean = content.contains("用户故事") || content.contains("User Story")
19-
20-
/**
21-
* Retrieves the basic information of the project.
22-
*
23-
* @return The SimpleProjectInfo object containing the basic info
24-
*/
25-
fun getProjectInfo(): SimpleProjectInfo
26-
27-
/**
28-
* Retrieves a list of simple stories.
29-
*
30-
* @return a list of SimpleStory objects representing the stories.
31-
*/
32-
fun getStories(): List<SimpleStory>
33-
346
/**
357
* Retrieves a user story by its ID.
368
*
379
* @param storyId The ID of the user story to retrieve.
3810
* @return The user story with the specified ID.
3911
*/
4012
fun getStoryById(storyId: String): SimpleStory
41-
42-
/**
43-
* Updates the detailed information of a user story.
44-
*
45-
* @param simpleStory The user story object containing the updated information.
46-
*/
47-
fun updateStoryDetail(simpleStory: SimpleStory)
4813
}

core/src/main/kotlin/cc/unitmesh/devti/flow/kanban/impl/GitHubIssue.kt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package cc.unitmesh.devti.flow.kanban.impl
22

33
import cc.unitmesh.devti.flow.kanban.Kanban
4-
import cc.unitmesh.devti.flow.model.SimpleProjectInfo
54
import cc.unitmesh.devti.flow.model.SimpleStory
65
import org.kohsuke.github.GitHub
76
import org.kohsuke.github.GitHubBuilder
@@ -29,13 +28,6 @@ class GitHubIssue(var repoUrl: String, val token: String) : Kanban {
2928
return url
3029
}
3130

32-
override fun getProjectInfo(): SimpleProjectInfo {
33-
val repo = gitHub.getRepository(repoUrl)
34-
return SimpleProjectInfo(repo.fullName, repo.name, repo.description ?: "")
35-
}
36-
37-
override fun getStories(): List<SimpleStory> = listOf()
38-
3931
override fun getStoryById(storyId: String): SimpleStory {
4032
val issue = gitHub.getRepository(repoUrl).getIssue(Integer.parseInt(storyId))
4133
if (issue.comments.size == 0) {
@@ -51,10 +43,4 @@ class GitHubIssue(var repoUrl: String, val token: String) : Kanban {
5143

5244
return SimpleStory(issue.number.toString(), issue.title, issue.body)
5345
}
54-
55-
override fun updateStoryDetail(simpleStory: SimpleStory) {
56-
// add comments to issues
57-
val issue = gitHub.getRepository(repoUrl).getIssue(Integer.parseInt(simpleStory.id))
58-
issue.comment(simpleStory.description)
59-
}
6046
}
Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package cc.unitmesh.devti.flow.kanban.impl
22

33
import cc.unitmesh.devti.flow.kanban.Kanban
4-
import cc.unitmesh.devti.flow.model.SimpleProjectInfo
54
import cc.unitmesh.devti.flow.model.SimpleStory
65
import org.gitlab4j.api.GitLabApi
76
import org.gitlab4j.api.models.Issue
@@ -17,24 +16,8 @@ class GitLabIssue(private val apiUrl: String, private val personalAccessToken: S
1716
gitLabApi = GitLabApi(url, userToken)
1817
}
1918

20-
override fun getProjectInfo(): SimpleProjectInfo {
21-
val project = gitLabApi.projectApi.getProject(apiUrl)
22-
return SimpleProjectInfo(project.nameWithNamespace, project.name, project.description ?: "")
23-
}
24-
25-
override fun getStories(): List<SimpleStory> = listOf()
26-
2719
override fun getStoryById(storyId: String): SimpleStory {
2820
val issue: Issue = gitLabApi.issuesApi.getIssue(apiUrl, storyId.toLong())
2921
return SimpleStory(issue.iid.toString(), issue.title, issue.description)
3022
}
31-
32-
33-
override fun updateStoryDetail(simpleStory: SimpleStory) {
34-
// Create a note as a comment on the issue
35-
val issue: Issue = gitLabApi.issuesApi.getIssue(apiUrl, simpleStory.id.toLong())
36-
gitLabApi.notesApi.createIssueNote(apiUrl, issue.iid, simpleStory.description)
37-
}
38-
39-
// Other methods like getStories() and isValidStory() can be implemented as needed
4023
}

core/src/main/kotlin/cc/unitmesh/devti/flow/model/SimpleProjectInfo.kt

Lines changed: 0 additions & 16 deletions
This file was deleted.

core/src/main/kotlin/cc/unitmesh/devti/flow/model/StoryConfig.kt

Lines changed: 0 additions & 14 deletions
This file was deleted.

core/src/test/kotlin/cc/unitmesh/devti/prompt/openai/PromptTemplateTest.kt

Lines changed: 0 additions & 67 deletions
This file was deleted.

exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/compiler/DevInsCompiler.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,6 @@ class DevInsCompiler(
253253
RunInsCommand(myProject, prop)
254254
}
255255

256-
BuiltinCommand.FILE_FUNC -> {
257-
result.isLocalCommand = true
258-
FileFuncInsCommand(myProject, prop)
259-
}
260-
261256
BuiltinCommand.SHELL -> {
262257
result.isLocalCommand = true
263258
val shireCode: String? = lookupNextCode(used)?.codeText()

exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/compiler/exec/FileFuncInsCommand.kt

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)