Skip to content

Commit cd724e3

Browse files
committed
fix(archview): remove leading slash in WebApi command #308
- Removed the leading slash in the `WebApi` command to ensure consistency. - Added descriptive comments for `CodeView` and `StylingView`. - Removed redundant async function in `SCCWrapper` for simplicity.
1 parent a340b9f commit cd724e3

File tree

2 files changed

+11
-32
lines changed

2 files changed

+11
-32
lines changed

core/src/main/kotlin/cc/unitmesh/devti/bridge/BridgeCommandProvider.kt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,26 @@ sealed class Security(override val name: String) : BridgeCommandProvider {
6868
* ```
6969
*/
7070
sealed class ArchViewCommand(override val name: String) : BridgeCommandProvider {
71-
object WebApi : ArchViewCommand("/webapi")
71+
object WebApi : ArchViewCommand("webapi")
7272

7373
/**
7474
* Aka Module View
7575
*/
7676
object ContainerView : ArchViewCommand("containerView")
77-
7877
/**
7978
* /componentView
8079
*/
8180
object ComponentView : ArchViewCommand("componentView")
82-
object StylingView : ArchViewCommand("stylingView")
81+
82+
/**
83+
* For show code dependency, like UML Class Diagram in Graph.
84+
*/
8385
object CodeView : ArchViewCommand("codeView")
86+
87+
/**
88+
* For frontend Style, like CSS, SCSS, etc.
89+
*/
90+
object StylingView : ArchViewCommand("stylingView")
8491
}
8592

8693
/**

core/src/main/kotlin/cc/unitmesh/devti/bridge/command/SCCWrapper.kt

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package cc.unitmesh.devti.bridge.command
22

3-
import com.intellij.util.io.awaitExit
4-
import kotlinx.coroutines.*
5-
import kotlinx.serialization.Serializable
63
import kotlinx.serialization.SerialName
4+
import kotlinx.serialization.Serializable
75
import kotlinx.serialization.json.Json
86

97
@Serializable
@@ -60,32 +58,6 @@ class SccWrapper(
6058
return parseResult(output)
6159
}
6260

63-
/**
64-
* 异步执行 scc 命令(使用协程)
65-
* @param arguments scc 命令行参数
66-
*/
67-
suspend fun runSccAsync(vararg arguments: String): List<SccResult> =
68-
withContext(Dispatchers.IO) {
69-
val command = buildCommand(arguments)
70-
val process = ProcessBuilder(command)
71-
.redirectErrorStream(true)
72-
.start()
73-
74-
val output = process.inputStream.reader().use { reader ->
75-
reader.readText()
76-
}
77-
78-
val exitCode = withTimeoutOrNull(timeoutSeconds * 1000) {
79-
process.awaitExit()
80-
} ?: throw SccException("scc execution timed out after $timeoutSeconds seconds")
81-
82-
if (exitCode != 0) {
83-
throw SccException("scc exited with code $exitCode. Output: $output")
84-
}
85-
86-
parseResult(output)
87-
}
88-
8961
private fun buildCommand(arguments: Array<out String>): List<String> {
9062
val baseCommand = if (sccPath.contains(" ")) {
9163
listOf("cmd", "/c", sccPath)

0 commit comments

Comments
 (0)