= emptyList()
11 | }
12 |
13 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/flow/kanban/Kanban.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.flow.kanban
2 |
3 | import cc.unitmesh.devti.flow.model.SimpleStory
4 |
5 | interface Kanban {
6 | /**
7 | * Retrieves a user story by its ID.
8 | *
9 | * @param storyId The ID of the user story to retrieve.
10 | * @return The user story with the specified ID.
11 | */
12 | fun getStoryById(storyId: String): SimpleStory
13 | }
14 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-exts/ext-database/src/test/resources/create_blog.sql:
--------------------------------------------------------------------------------
1 | -- sample for create blog
2 | CREATE TABLE `blog`
3 | (
4 | `id` int(11) NOT NULL AUTO_INCREMENT,
5 | `title` varchar(255) DEFAULT NULL,
6 | `content` varchar(255) DEFAULT NULL,
7 | `create_time` datetime DEFAULT NULL,
8 | `update_time` datetime DEFAULT NULL,
9 | PRIMARY KEY (`id`)
10 | ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
11 |
--------------------------------------------------------------------------------
/mpp-ui/src/jsMain/kotlin/cc/unitmesh/devins/ui/nano/StatefulNanoRenderer.js.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.ui.nano
2 |
3 | import androidx.compose.ui.graphics.ImageBitmap
4 | import org.jetbrains.compose.resources.decodeToImageBitmap
5 |
6 | /**
7 | * JS implementation of decodeImageBytesToBitmap using Compose Resources.
8 | */
9 | internal actual fun decodeImageBytesToBitmap(bytes: ByteArray): ImageBitmap {
10 | return bytes.decodeToImageBitmap()
11 | }
12 |
--------------------------------------------------------------------------------
/mpp-web/src/main.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { createRoot } from 'react-dom/client';
3 | import { Router } from './Router';
4 | import './index.css';
5 |
6 | const container = document.getElementById('root');
7 | if (container) {
8 | const root = createRoot(container);
9 | root.render(
10 |
11 |
12 |
13 | );
14 | } else {
15 | console.error('Root element not found');
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/llms/custom/SSE.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.llms.custom
2 |
3 | class SSE(val data: String) {
4 | fun toBytes(): ByteArray {
5 | return String.format("data: %s\n\n", this.data).toByteArray()
6 | }
7 |
8 | val isDone: Boolean
9 | get() = DONE_DATA.equals(this.data, ignoreCase = true)
10 |
11 | companion object {
12 | private const val DONE_DATA = "[DONE]"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-exts/devins-lang/src/main/resources/agent/toolExamples/kill-process.devin:
--------------------------------------------------------------------------------
1 | Terminate a running process by its process ID. Supports both graceful termination and force kill options.
2 |
3 | Gracefully terminate a process:
4 | /kill-process:proc_1234567890_1
5 |
6 | Force kill a process:
7 | /kill-process:proc_1234567890_1 --force
8 |
9 | Use /list-processes to find the process ID of the process you want to terminate. Only running processes can be killed.
10 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/intentions/action/test/TestCodeGenRequest.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.intentions.action.test
2 |
3 | import com.intellij.openapi.editor.Editor
4 | import com.intellij.openapi.project.Project
5 | import com.intellij.psi.PsiElement
6 | import com.intellij.psi.PsiFile
7 |
8 | class TestCodeGenRequest(
9 | val file: PsiFile,
10 | val element: PsiElement,
11 | val project: Project,
12 | val editor: Editor?
13 | )
--------------------------------------------------------------------------------
/mpp-ui/src/wasmJsMain/kotlin/cc/unitmesh/devins/ui/nano/StatefulNanoRenderer.wasmJs.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.ui.nano
2 |
3 | import androidx.compose.ui.graphics.ImageBitmap
4 | import org.jetbrains.compose.resources.decodeToImageBitmap
5 |
6 | /**
7 | * WASM implementation of decodeImageBytesToBitmap using Compose Resources.
8 | */
9 | internal actual fun decodeImageBytesToBitmap(bytes: ByteArray): ImageBitmap {
10 | return bytes.decodeToImageBitmap()
11 | }
12 |
13 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/resources/genius/zh/sql/sql-gen-clarify.vm:
--------------------------------------------------------------------------------
1 | 你是一名专业的数据库管理员。根据用户的要求,在列表中为用户选择最佳的表。
2 |
3 | - 用户使用的数据库版本:${context.databaseVersion}
4 | - 用户 schema 名称:${context.schemaName}
5 | - 用户表信息:${context.tableNames}
6 |
7 | 例如:
8 |
9 | - 问题(要求):计算按订阅者类型划分的平均行程长度。// 用户表:trips、users、subscriber_type
10 | - 你应该回答:[trips, subscriber_type]
11 |
12 | ----
13 |
14 | 以下是用户的需求:
15 |
16 | ```markdown
17 | ${context.requirement}
18 | ```
19 |
20 | 请为用户选择最佳的表,只需返回表名的列表,无需解释。
--------------------------------------------------------------------------------
/mpp-core/src/jsMain/kotlin/cc/unitmesh/agent/tool/impl/HttpFetcherFactory.js.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.agent.tool.impl.http
2 |
3 | import cc.unitmesh.agent.tool.impl.HttpFetcher
4 |
5 | /**
6 | * JavaScript implementation - uses native Node.js fetch API
7 | *
8 | * This bypasses Ktor's JS engine limitations in Node.js environment
9 | */
10 | actual object HttpFetcherFactory {
11 | actual fun create(): HttpFetcher {
12 | return NodeFetchHttpFetcher()
13 | }
14 | }
15 |
16 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-lang/javascript/src/main/kotlin/cc/unitmesh/ide/javascript/provider/testing/JestCodeModifier.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.ide.javascript.provider.testing
2 |
3 | import cc.unitmesh.ide.javascript.util.LanguageApplicableUtil
4 | import com.intellij.lang.Language
5 |
6 | class JestCodeModifier : JavaScriptTestCodeModifier() {
7 | override fun isApplicable(language: Language): Boolean {
8 | return LanguageApplicableUtil.isJavaScriptApplicable(language)
9 | }
10 | }
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/resources/genius/zh/practises/refactoring.vm:
--------------------------------------------------------------------------------
1 | 请你这段代码建议适当的重构。
2 | - 提高代码的可读性、质量,使代码更加有组织和易懂。
3 | - 如果代码太长,你需要考虑用更好的方式(诸如概念化)来组织代码。
4 | - 答案应包含重构描述和一个代码片段,展示重构后的结果。
5 | 使用一些众所周知的重构技巧,比如以下列表中的一个:
6 | - 重命名
7 | - 修改签名、声明
8 | - 提取或引入变量、函数、常量、参数、类型参数
9 | - 提取类、接口、超类
10 | - 内联类、函数、变量等
11 | - 移动字段、函数、语句等
12 | - 上移构造函数、字段、方法
13 | - 下移字段、方法
14 |
15 | 请勿生成多个代码片段,尝试将所有更改都整合到一个代码片段中。
16 | 请勿生成包含虚构周围类、方法的代码。不要模拟缺失的依赖项。
17 | 提供的代码已经整合到正确且可编译的代码中,不要在其周围添加额外的类。
18 |
19 | 重构以下代码:
20 |
--------------------------------------------------------------------------------
/xiuper-fs/src/commonMain/sqldelight/cc/unitmesh/xiuper/fs/db/migrations/1.sqm:
--------------------------------------------------------------------------------
1 | -- Migration 1: Add extended attributes support
2 | -- From schema v1 (FsNode only) to v2 (FsNode + FsXattr)
3 |
4 | CREATE TABLE IF NOT EXISTS FsXattr (
5 | path TEXT NOT NULL,
6 | name TEXT NOT NULL,
7 | value BLOB NOT NULL,
8 | PRIMARY KEY (path, name),
9 | FOREIGN KEY (path) REFERENCES FsNode(path) ON DELETE CASCADE
10 | );
11 |
12 | CREATE INDEX IF NOT EXISTS idx_xattr_path ON FsXattr(path);
13 |
--------------------------------------------------------------------------------
/.idea/runConfigurations/Run_Compose_Server.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/mpp-codegraph/src/commonMain/kotlin/cc/unitmesh/codegraph/CodeGraphFactory.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.codegraph
2 |
3 | import cc.unitmesh.codegraph.parser.CodeParser
4 |
5 | /**
6 | * Factory to create platform-specific CodeParser instances.
7 | * This uses expect/actual pattern for platform-specific implementations.
8 | */
9 | expect object CodeGraphFactory {
10 | /**
11 | * Create a platform-specific CodeParser instance
12 | */
13 | fun createParser(): CodeParser
14 | }
15 |
16 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/context/builder/VariableContextBuilder.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.context.builder
2 |
3 | import cc.unitmesh.devti.context.VariableContext
4 | import com.intellij.psi.PsiElement
5 |
6 | interface VariableContextBuilder {
7 | fun getVariableContext(
8 | psiElement: PsiElement,
9 | withMethodContext: Boolean,
10 | withClassContext: Boolean,
11 | gatherUsages: Boolean
12 | ): VariableContext?
13 | }
14 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/resources/prompts/default/update_service_method.vm:
--------------------------------------------------------------------------------
1 | 你是一个资深的后端 CRUD 工程师,根据下面的信息编写 Service 层新方法的代码。要求:
2 |
3 | - 实现 // TODO 声明部分的方法。
4 | - 保证 Service 层的代码简洁易读,不要有冗余代码。
5 | - 你最后返回的代码示例如下:
6 | // TODO: implementation follows methods: {{some method}}
7 | ```java
8 | public {methodReturnType} {methodName}({methodParams}) {
9 | {methodBody}
10 | }
11 | ```
12 |
13 | // current service code
14 | {prefixCode}
15 | // TODO: implementation follows methods: {suffixCode}
16 |
17 |
--------------------------------------------------------------------------------
/mpp-viewer-web/src/jsMain/kotlin/cc/unitmesh/viewer/web/MermaidHtml.js.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.viewer.web
2 |
3 | /**
4 | * JS implementation: Return empty/stub Mermaid HTML
5 | */
6 | actual fun getMermaidHtml(): String {
7 | return """
8 |
9 |
10 |
11 |
12 | Mermaid (Stub)
13 |
14 |
15 | Mermaid not supported in JS
16 |
17 |
18 | """.trimIndent()
19 | }
20 |
--------------------------------------------------------------------------------
/xiuper-fs/src/jvmMain/kotlin/cc/unitmesh/xiuper/fs/db/DatabaseDriverFactory.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.xiuper.fs.db
2 |
3 | import app.cash.sqldelight.db.SqlDriver
4 | import app.cash.sqldelight.driver.jdbc.sqlite.JdbcSqliteDriver
5 |
6 | actual class DatabaseDriverFactory {
7 | actual fun createDriver(): SqlDriver {
8 | // Intentionally use a file-based DB for production; tests should provide their own driver.
9 | return JdbcSqliteDriver("jdbc:sqlite:xiuper-fs.db")
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/compiler/exec/PrintInsCommand.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.language.compiler.exec
2 |
3 | import cc.unitmesh.devti.command.InsCommand
4 | import cc.unitmesh.devti.command.dataprovider.BuiltinCommand
5 |
6 | class PrintInsCommand(private val value: String) : InsCommand {
7 | override val commandName: BuiltinCommand = BuiltinCommand.OPEN
8 |
9 | override suspend fun execute(): String {
10 | return value
11 | }
12 | }
--------------------------------------------------------------------------------
/mpp-ui/src/iosMain/kotlin/cc/unitmesh/devins/db/DatabaseDriverFactory.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.db
2 |
3 | import app.cash.sqldelight.db.SqlDriver
4 | import app.cash.sqldelight.driver.native.NativeSqliteDriver
5 |
6 | /**
7 | * iOS 平台的数据库驱动工厂
8 | */
9 | actual class DatabaseDriverFactory {
10 | actual fun createDriver(): SqlDriver {
11 | return NativeSqliteDriver(
12 | schema = DevInsDatabase.Schema,
13 | name = "autodev.db"
14 | )
15 | }
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/example/prompt/copilot/completion/python-code.md:
--------------------------------------------------------------------------------
1 | Q:
2 | ```python
3 | def foo():
4 | x = 42 + 42
5 | print(x)
6 | # TODO: write me gcd algorithm here
7 | # end of the code completion
8 | return x + x
9 | ```
10 | A:
11 | ```python
12 | def foo():
13 | x = 42 + 42
14 | print(x)
15 | # TODO: write me gcd algorithm here
16 | def gcd(a,b):
17 | while(b):
18 | a,b = b,a%b
19 | return a
20 | # end of the code completion
21 | return x + x
22 | ```
23 | Q:
--------------------------------------------------------------------------------
/mpp-ui/src/commonMain/kotlin/cc/unitmesh/devins/ui/compose/sketch/ScreenshotUtils.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.ui.compose.sketch
2 |
3 | import androidx.compose.ui.graphics.ImageBitmap
4 |
5 | /**
6 | * Encode an ImageBitmap to PNG bytes.
7 | * Platform-specific implementations handle the actual encoding.
8 | *
9 | * @param imageBitmap The ImageBitmap to encode
10 | * @return PNG bytes, or null if encoding fails
11 | */
12 | expect fun encodeImageBitmapToPng(imageBitmap: ImageBitmap): ByteArray?
13 |
14 |
--------------------------------------------------------------------------------
/mpp-web/src/polyfills/ws-polyfill.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * WebSocket polyfill for browser
3 | * The 'ws' package is a Node.js WebSocket library used by ktor-client.
4 | * In browsers, we use the native WebSocket API instead.
5 | */
6 |
7 | // Export browser's native WebSocket as the default
8 | export default typeof window !== 'undefined' ? window.WebSocket : class {};
9 |
10 | // Also provide named export for compatibility
11 | export const WebSocket = typeof window !== 'undefined' ? window.WebSocket : class {};
12 |
13 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/mcp/ui/model/McpMessage.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.mcp.ui.model
2 |
3 | import java.time.LocalDateTime
4 |
5 | enum class MessageType {
6 | REQUEST,
7 | RESPONSE
8 | }
9 |
10 | data class McpMessage(
11 | val type: MessageType,
12 | val method: String,
13 | val timestamp: LocalDateTime,
14 | val duration: Long? = null,
15 | val content: String,
16 | val toolName: String? = null,
17 | val parameters: String? = null
18 | )
19 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/provider/context/ChatCreationContext.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.provider.context
2 |
3 | import cc.unitmesh.devti.gui.chat.message.ChatActionType
4 | import com.intellij.psi.PsiElement
5 | import com.intellij.psi.PsiFile
6 |
7 | data class ChatCreationContext(
8 | val origin: ChatOrigin,
9 | val action: ChatActionType,
10 | val sourceFile: PsiFile?,
11 | val extraItems: List = emptyList(),
12 | val element: PsiElement?
13 | )
--------------------------------------------------------------------------------
/mpp-ui/src/jvmMain/kotlin/cc/unitmesh/devins/ui/compose/agent/FileViewerPanelWrapper.jvm.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.ui.compose.agent
2 |
3 | import androidx.compose.runtime.Composable
4 | import androidx.compose.ui.Modifier
5 |
6 | @Composable
7 | actual fun FileViewerPanelWrapper(
8 | filePath: String,
9 | onClose: () -> Unit,
10 | modifier: Modifier
11 | ) {
12 | FileViewerPanel(
13 | filePath = filePath,
14 | onClose = onClose,
15 | modifier = modifier
16 | )
17 | }
18 |
--------------------------------------------------------------------------------
/mpp-core/src/iosMain/kotlin/cc/unitmesh/agent/tool/impl/http/HttpClientFactory.ios.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.agent.tool.impl.http
2 |
3 | import io.ktor.client.*
4 | import io.ktor.client.engine.darwin.*
5 |
6 | actual object HttpClientFactory {
7 | actual fun create(): HttpClient {
8 | return HttpClient(Darwin) {
9 | engine {
10 | configureRequest {
11 | setAllowsCellularAccess(true)
12 | }
13 | }
14 | }
15 | }
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/mpp-core/src/jvmMain/kotlin/cc/unitmesh/agent/logging/PlatformLogging.jvm.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.agent.logging
2 |
3 | /**
4 | * JVM implementation of platform-specific logging initialization
5 | */
6 | actual fun initializePlatformLogging(config: LoggingConfig) {
7 | JvmLoggingInitializer.initializeLogback(config)
8 | }
9 |
10 | /**
11 | * JVM implementation of platform-specific log directory
12 | */
13 | actual fun getPlatformLogDirectory(): String {
14 | return JvmLoggingInitializer.getLogDirectory()
15 | }
16 |
--------------------------------------------------------------------------------
/mpp-core/src/wasmJsMain/kotlin/cc/unitmesh/agent/database/DatabaseConnection.wasmJs.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.agent.database
2 |
3 | /**
4 | * WASM 平台数据库连接占位符
5 | *
6 | * WASM 平台当前不支持直接的数据库连接。
7 | * 应该通过服务器的 HTTP API 调用来访问数据库。
8 | */
9 | actual fun createDatabaseConnection(config: DatabaseConfig): DatabaseConnection {
10 | throw UnsupportedOperationException(
11 | "Database connections are not supported on WASM platform. " +
12 | "Use the server API to access databases instead."
13 | )
14 | }
15 |
--------------------------------------------------------------------------------
/xiuper-ui/src/main/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/example/prompt/autodev/custom-prompt-dsl.md:
--------------------------------------------------------------------------------
1 | ## Custom Prompt DSL
2 |
3 | ```json
4 | [
5 | {
6 | "title": "转译",
7 | "autoInvoke": true,
8 | "matchRegex": ".*",
9 | "template": "帮我重构下面的代码为 Kotlin 语言,方便于我理解: \n ${SPEC_XXX} ${SELECTION}"
10 | }
11 | ]
12 | ```
13 |
14 | ### IDE Variable
15 |
16 | ```
17 | $SELECTION
18 | ```
19 |
20 | ### SPEC Variable
21 |
22 | ```
23 | $SPEC.xxx
24 | ```
25 |
26 | example: `$SPEC_CONTROLLER`
27 |
28 | ### CODE Context Variable
29 |
30 | `METHOD_INPUT_OUTPUT`
31 |
32 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/ast/shireql/ShireQLFromType.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.language.ast.shireql
2 |
3 | enum class ShireQLFromType(val typeName: String) {
4 | // PSI Query
5 | PsiFile("PsiFile"),
6 | PsiPackage("PsiPackage"),
7 | PsiClass("PsiClass"),
8 | PsiMethod("PsiMethod"),
9 | PsiField("PsiField"),
10 |
11 | // GitQuery
12 | GitCommit("GitCommit"),
13 | GitBranch("GitBranch"),
14 |
15 | // Others
16 | Date("Date"),
17 | }
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/highlight/DevInSyntaxHighlighterFactory.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.language.highlight
2 |
3 | import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory
4 | import com.intellij.openapi.project.Project
5 | import com.intellij.openapi.vfs.VirtualFile
6 |
7 | class DevInSyntaxHighlighterFactory : SyntaxHighlighterFactory() {
8 | override fun getSyntaxHighlighter(project: Project?, virtualFile: VirtualFile?) = DevInSyntaxHighlighter()
9 | }
10 |
--------------------------------------------------------------------------------
/mpp-ui/src/jsMain/kotlin/cc/unitmesh/devins/ui/provider/CopilotModelRefresher.js.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.ui.provider
2 |
3 | import cc.unitmesh.llm.NamedModelConfig
4 |
5 | /**
6 | * JS implementation - GitHub Copilot not supported in browser/Node.js CLI
7 | * (Would need to implement Node.js file system access for CLI mode)
8 | */
9 | actual object CopilotModelRefresher {
10 | actual fun isAvailable(): Boolean = false
11 | actual suspend fun refreshModels(): List = emptyList()
12 | }
13 |
14 |
--------------------------------------------------------------------------------
/mpp-ui/src/jvmMain/kotlin/cc/unitmesh/devins/ui/compose/AutoDevApp.jvm.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.ui.compose
2 |
3 | import androidx.compose.runtime.Composable
4 |
5 | @Composable
6 | actual fun PlatformAutoDevApp(
7 | triggerFileChooser: Boolean,
8 | onFileChooserHandled: () -> Unit,
9 | initialMode: String
10 | ) {
11 | AutoDevApp(
12 | triggerFileChooser = triggerFileChooser,
13 | onFileChooserHandled = onFileChooserHandled,
14 | initialMode = initialMode
15 | )
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/inline/AutoDevInlineChatProvider.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.inline
2 |
3 | import com.intellij.openapi.project.Project
4 |
5 | object AutoDevInlineChatProvider {
6 | var isAdded = false
7 |
8 | fun addListener(project: Project) {
9 | if (isAdded) return
10 | AutoDevGutterHandler.getInstance(project).listen()
11 | }
12 |
13 | fun removeListener(project: Project) {
14 | AutoDevGutterHandler.getInstance(project).dispose()
15 | }
16 | }
--------------------------------------------------------------------------------
/mpp-web/src/Router.tsx:
--------------------------------------------------------------------------------
1 | import React, { useEffect } from 'react';
2 | import { LandingPage } from './LandingPage';
3 |
4 | export const Router: React.FC = () => {
5 | useEffect(() => {
6 | // Redirect /#/app to the actual web.xiuper.com
7 | const hash = window.location.hash;
8 | const normalized = (hash || '').replace(/^#\/?/, '');
9 | if (normalized.startsWith('app')) {
10 | window.location.href = 'https://web.xiuper.com/';
11 | }
12 | }, []);
13 |
14 | return ;
15 | };
16 |
17 |
18 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/settings/coder/AutoDevCoderConfigurableProvider.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.settings.coder
2 |
3 | import com.intellij.openapi.options.Configurable
4 | import com.intellij.openapi.options.ConfigurableProvider
5 | import com.intellij.openapi.project.Project
6 |
7 | class AutoDevCoderConfigurableProvider (private val project: Project) : ConfigurableProvider() {
8 | override fun createConfigurable(): Configurable {
9 | return AutoDevCoderConfigurable(project)
10 | }
11 | }
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/settings/customize/CustomizeConfigurableProvider.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.settings.customize
2 |
3 | import com.intellij.openapi.options.Configurable
4 | import com.intellij.openapi.options.ConfigurableProvider
5 | import com.intellij.openapi.project.Project
6 |
7 | class CustomizeConfigurableProvider (private val project: Project) : ConfigurableProvider() {
8 | override fun createConfigurable(): Configurable {
9 | return CustomizeConfigurable(project)
10 | }
11 | }
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-exts/devins-lang/src/main/resources/fileTemplates/internal/AutoDevAction.devin.ft:
--------------------------------------------------------------------------------
1 | ---
2 | name: "{{name}}"
3 | description: "Here is a description of the action."
4 | interaction: AppendCursor
5 | actionLocation: ContextMenu
6 | ---
7 |
8 | [notes]: For more options, see [the docs](https://ide.unitmesh.cc/local-agent/)
9 |
10 | You are an experienced software development engineer skilled in using Test-Driven Development (TDD) to develop software.
11 | You need to help users write test code based on their requirements.
12 |
--------------------------------------------------------------------------------
/mpp-idea/src/main/resources/messages/AutoDevIdeaBundle.properties:
--------------------------------------------------------------------------------
1 | # AutoDev Compose UI Bundle
2 | toolwindow.name=AutoDev Compose
3 | toolwindow.title=AutoDev Chat
4 |
5 | # Chat UI
6 | chat.placeholder=Start a conversation with your AI Assistant!
7 | chat.input.placeholder=Type your message here...
8 | chat.send=Send
9 | chat.stop=Stop
10 | chat.new=New Conversation
11 |
12 | # Settings
13 | settings.ai.configure=Configure AI Provider
14 | settings.ai.provider=Provider
15 | settings.ai.model=Model
16 | settings.ai.apikey=API Key
17 |
18 |
--------------------------------------------------------------------------------
/mpp-ui/src/commonMain/kotlin/cc/unitmesh/devins/ui/compose/terminal/TerminalDisplay.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.ui.compose.terminal
2 |
3 | import androidx.compose.runtime.Composable
4 | import androidx.compose.ui.Modifier
5 |
6 | /**
7 | * Platform-agnostic terminal output display.
8 | * On JVM: Uses JediTerm for rich terminal rendering
9 | * On other platforms: Falls back to simple text display
10 | */
11 | @Composable
12 | expect fun PlatformTerminalDisplay(
13 | output: String,
14 | modifier: Modifier = Modifier
15 | )
16 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-exts/nanodsl-lang/src/main/kotlin/cc/unitmesh/nanodsl/language/highlight/NanoDSLSyntaxHighlighterFactory.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.nanodsl.language.highlight
2 |
3 | import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory
4 | import com.intellij.openapi.project.Project
5 | import com.intellij.openapi.vfs.VirtualFile
6 |
7 | class NanoDSLSyntaxHighlighterFactory : SyntaxHighlighterFactory() {
8 | override fun getSyntaxHighlighter(project: Project?, virtualFile: VirtualFile?) = NanoDSLSyntaxHighlighter()
9 | }
10 |
11 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-exts/ext-database/src/main/kotlin/cc/unitmesh/database/flow/AutoSqlContext.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.database.flow
2 |
3 | import cc.unitmesh.devti.template.context.TemplateContext
4 |
5 | data class AutoSqlContext(
6 | val requirement: String,
7 | val databaseVersion: String,
8 | val schemaName: String,
9 | val tableNames: List,
10 | /**
11 | * Step 2.
12 | * A list of table names to retrieve the columns from.
13 | */
14 | var tableInfos: List = emptyList(),
15 | ) : TemplateContext
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/custom/variable/CustomResolvedVariableType.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.custom.variable
2 |
3 | enum class CustomResolvedVariableType(@JvmField val description: String) {
4 | SELECTION("Currently selected code fragment with language name"),
5 | METHOD_INPUT_OUTPUT("Method input parameter's class as code snippets"),
6 | SPEC_VARIABLE("Load from spec config, and config to items"),
7 | SIMILAR_CHUNK("Similar code chunk with element's code and recently open code"),
8 | ;
9 | }
10 |
--------------------------------------------------------------------------------
/mpp-ui/src/iosMain/kotlin/cc/unitmesh/devins/ui/nano/StatefulNanoRenderer.ios.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.ui.nano
2 |
3 | import androidx.compose.ui.graphics.ImageBitmap
4 | import androidx.compose.ui.graphics.toComposeImageBitmap
5 | import org.jetbrains.skia.Image
6 |
7 | /**
8 | * iOS implementation of decodeImageBytesToBitmap using Skia.
9 | */
10 | internal actual fun decodeImageBytesToBitmap(bytes: ByteArray): ImageBitmap {
11 | val skiaImage = Image.makeFromEncoded(bytes)
12 | return skiaImage.toComposeImageBitmap()
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/xiuper-ui/src/jvmMain/kotlin/cc/unitmesh/xuiper/prompt/ResourceLoader.jvm.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.xuiper.prompt
2 |
3 | /**
4 | * JVM implementation of ResourceLoader using classloader.
5 | */
6 | actual object ResourceLoader {
7 | actual fun loadResource(path: String): String {
8 | return ResourceLoader::class.java.classLoader
9 | ?.getResourceAsStream(path)
10 | ?.bufferedReader()
11 | ?.readText()
12 | ?: throw IllegalStateException("Cannot load resource: $path")
13 | }
14 | }
15 |
16 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/custom/variable/SelectionVariableResolver.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.custom.variable
2 |
3 | class SelectionVariableResolver(
4 | private val languageName: String,
5 | private val code: String,
6 | ) : VariableResolver {
7 | override val type: CustomResolvedVariableType = CustomResolvedVariableType.SELECTION
8 |
9 | override fun resolve(): String {
10 | return """
11 | |```$languageName
12 | |$code
13 | |```""".trimMargin()
14 | }
15 | }
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/parser/ShireTokenTypeSets.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.language.parser
2 |
3 | import cc.unitmesh.devti.language.psi.DevInTypes
4 | import com.intellij.psi.TokenType
5 | import com.intellij.psi.tree.TokenSet
6 |
7 | object ShireTokenTypeSets {
8 | // DevInTypes.NEWLINE
9 | val WHITESPACES: TokenSet = TokenSet.create(TokenType.WHITE_SPACE)
10 |
11 | val SHIRE_COMMENTS = TokenSet.create(DevInTypes.CONTENT_COMMENTS, DevInTypes.COMMENTS, DevInTypes.BLOCK_COMMENT)
12 | }
13 |
--------------------------------------------------------------------------------
/mpp-ui/src/jsMain/kotlin/cc/unitmesh/devins/ui/Main.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.ui
2 |
3 | import androidx.compose.ui.ExperimentalComposeUiApi
4 | import androidx.compose.ui.window.ComposeViewport
5 | import cc.unitmesh.devins.ui.compose.AutoDevApp
6 | import org.jetbrains.skiko.wasm.onWasmReady
7 |
8 | /**
9 | * Markdown 渲染演示应用 - Web 版本
10 | */
11 | @OptIn(ExperimentalComposeUiApi::class)
12 | @Suppress("DEPRECATION")
13 | fun main() {
14 | onWasmReady {
15 | ComposeViewport {
16 | AutoDevApp()
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/xiuper-ui/src/androidMain/kotlin/cc/unitmesh/xuiper/prompt/ResourceLoader.android.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.xuiper.prompt
2 |
3 | /**
4 | * Android implementation of ResourceLoader using classloader.
5 | */
6 | actual object ResourceLoader {
7 | actual fun loadResource(path: String): String {
8 | return ResourceLoader::class.java.classLoader
9 | ?.getResourceAsStream(path)
10 | ?.bufferedReader()
11 | ?.readText()
12 | ?: throw IllegalStateException("Cannot load resource: $path")
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-exts/ext-terminal/src/main/kotlin/cc/unitmesh/terminal/sketch/TerminalExecutionState.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.terminal.sketch
2 |
3 | /**
4 | * 终端执行命令的状态枚举
5 | */
6 | enum class TerminalExecutionState {
7 | /**
8 | * 准备执行(初始状态)
9 | */
10 | READY,
11 |
12 | /**
13 | * 正在执行中
14 | */
15 | EXECUTING,
16 |
17 | /**
18 | * 执行成功
19 | */
20 | SUCCESS,
21 |
22 | /**
23 | * 执行失败
24 | */
25 | FAILED,
26 |
27 | /**
28 | * 执行被手动终止
29 | */
30 | TERMINATED
31 | }
32 |
--------------------------------------------------------------------------------
/mpp-ui/webpack.config.d/zzzz-wasm-experiments.js:
--------------------------------------------------------------------------------
1 | // Ensure WebAssembly support is enabled for webpack 5 in browser test builds.
2 | // This file is named with "zzzz" so it runs after other injected webpack config snippets.
3 |
4 | // config.experiments = config.experiments || {};
5 | // config.experiments.asyncWebAssembly = true;
6 | //
7 | // config.module = config.module || {};
8 | // config.module.rules = config.module.rules || [];
9 | // config.module.rules.push({
10 | // test: /\.wasm$/,
11 | // type: "webassembly/async"
12 | // });
13 | //
14 | //
15 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-exts/nanodsl-lang/src/main/kotlin/cc/unitmesh/nanodsl/language/NanoDSLFileType.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.nanodsl.language
2 |
3 | import com.intellij.openapi.fileTypes.LanguageFileType
4 | import javax.swing.Icon
5 |
6 | object NanoDSLFileType : LanguageFileType(NanoDSLLanguage) {
7 | override fun getName(): String = "NanoDSL"
8 |
9 | override fun getDescription(): String = "NanoDSL Language File"
10 |
11 | override fun getDefaultExtension(): String = "nanodsl"
12 |
13 | override fun getIcon(): Icon = NanoDSLIcons.DEFAULT
14 | }
15 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/sketch/AutoSketchModeListener.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.sketch
2 |
3 | import com.intellij.util.messages.Topic
4 | import java.util.EventListener
5 |
6 | @FunctionalInterface
7 | interface AutoSketchModeListener : EventListener {
8 | fun start()
9 |
10 | fun done()
11 |
12 | companion object {
13 | @Topic.AppLevel
14 | val TOPIC: Topic =
15 | Topic(AutoSketchModeListener::class.java, Topic.BroadcastDirection.TO_DIRECT_CHILDREN)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/gui/chat/ui/AutoDevInputListener.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.gui.chat.ui
2 |
3 | import com.intellij.openapi.editor.ex.EditorEx
4 | import java.util.*
5 |
6 | enum class AutoDevInputTrigger {
7 | Button,
8 | Key
9 | }
10 |
11 | interface AutoDevInputListener : EventListener {
12 | fun editorAdded(editor: EditorEx) {}
13 | fun onSubmit(component: AutoDevInputSection, trigger: AutoDevInputTrigger) {}
14 | fun onStop(component: AutoDevInputSection) {}
15 | fun manualSend(userInput: String) {}
16 | }
--------------------------------------------------------------------------------
/mpp-ui/src/commonMain/kotlin/cc/unitmesh/devins/ui/compose/AutoDevAppPlatform.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.ui.compose
2 |
3 | import androidx.compose.runtime.Composable
4 |
5 | /**
6 | * 平台特定的 AutoDevApp 入口
7 | *
8 | * 使用 expect/actual 模式支持不同平台的 UI 实现:
9 | * - Android: BottomNavigation + Drawer
10 | * - Desktop: SessionSidebar + TopBar
11 | * - WASM: Minimal UI
12 | */
13 | @Composable
14 | expect fun PlatformAutoDevApp(
15 | triggerFileChooser: Boolean = false,
16 | onFileChooserHandled: () -> Unit = {},
17 | initialMode: String = "auto"
18 | )
19 |
20 |
--------------------------------------------------------------------------------
/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | rootProject.name = "Xiuper"
2 |
3 | enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
4 |
5 | pluginManagement {
6 | repositories {
7 | google()
8 | mavenCentral()
9 | gradlePluginPortal()
10 | }
11 | }
12 |
13 | //include("mpp-linter")
14 | include("mpp-core")
15 | include("mpp-ui")
16 | include("mpp-codegraph")
17 | include("mpp-server")
18 | include("mpp-viewer")
19 | include("mpp-viewer-web")
20 | include("xiuper-ui")
21 | include("xiuper-fs")
22 |
23 | // IDEA plugin as composite build
24 | includeBuild("mpp-idea")
25 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/bridge/provider/DatabaseFunction.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.bridge.provider
2 |
3 | enum class DatabaseFunction(val funName: String) {
4 | Schema("schema"),
5 | Table("table"),
6 | Column("column"),
7 | Query("query")
8 | ;
9 |
10 | companion object {
11 | fun fromString(value: String): DatabaseFunction? {
12 | return entries.firstOrNull { it.funName == value }
13 | }
14 |
15 | fun allFuncNames(): List = entries.map(DatabaseFunction::funName)
16 | }
17 | }
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/inlay/codecomplete/InlayDisposeContext.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.inlay.codecomplete
2 |
3 | enum class InlayDisposeContext {
4 | UserAction,
5 | IdeCompletion,
6 | CaretChange,
7 | SelectionChange,
8 | SettingsChange,
9 | Cycling,
10 | TypingAsSuggested,
11 | Typing,
12 | Applied,
13 | ;
14 |
15 | val isResetLastRequest: Boolean
16 | get() = this == SettingsChange || this == Applied
17 | val isSendRejectedTelemetry: Boolean
18 | get() = this == UserAction
19 | }
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/test/kotlin/cc/unitmesh/devti/custom/variable/CustomVariableTest.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.custom.variable
2 |
3 | import cc.unitmesh.devti.custom.compile.CustomVariable
4 | import junit.framework.TestCase.assertFalse
5 | import junit.framework.TestCase.assertTrue
6 | import org.junit.Test
7 |
8 |
9 | class CustomVariableTest {
10 | @Test
11 | fun should_parse_variable_from_content() {
12 | assertTrue(CustomVariable.hasVariable("解释一下代码:\$selection"))
13 | assertFalse(CustomVariable.hasVariable("解释一下代码:\$selectio"))
14 | }
15 | }
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/DevInIcons.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.language
2 |
3 | import com.intellij.openapi.util.IconLoader
4 | import javax.swing.Icon
5 |
6 | object DevInIcons {
7 | @JvmField
8 | val DEFAULT: Icon = IconLoader.getIcon("/icons/devin.svg", DevInIcons::class.java)
9 | @JvmField
10 | val COMMAND: Icon = IconLoader.getIcon("/icons/devins-command.svg", DevInIcons::class.java)
11 | @JvmField
12 | val Terminal: Icon = IconLoader.getIcon("/icons/terminal.svg", DevInIcons::class.java)
13 | }
14 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-exts/devins-lang/src/test/kotlin/cc/unitmesh/devti/language/compiler/execute/CrawlProcessorTest.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.language.compiler.execute
2 |
3 | import cc.unitmesh.devti.language.processor.CrawlProcessor
4 | import com.intellij.testFramework.fixtures.BasePlatformTestCase
5 |
6 | class CrawlProcessorTest : BasePlatformTestCase() {
7 | fun testShouldParseLink() {
8 | val urls = arrayOf("https://ide.unitmesh.cc/local-agent")
9 | val results = CrawlProcessor.execute(urls)
10 | assertEquals(results.size, 1)
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/xiuper-fs/src/commonMain/kotlin/cc/unitmesh/xiuper/fs/BackendCapabilities.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.xiuper.fs
2 |
3 | /**
4 | * Declares which POSIX-subset operations a backend implements.
5 | *
6 | * Conformance tests use this to decide whether to assert full POSIX semantics
7 | * or only verify that unsupported operations fail with ENOTSUP.
8 | */
9 | data class BackendCapabilities(
10 | val supportsMkdir: Boolean = true,
11 | val supportsDelete: Boolean = true
12 | )
13 |
14 | interface CapabilityAwareBackend {
15 | val capabilities: BackendCapabilities
16 | }
17 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/resources/prompts/default/create_controller.vm:
--------------------------------------------------------------------------------
1 | 你是一个资深的后端 CRUD 工程师,请根据下面的用户故事以及 {controllerName} 的相关信息,编写 Controller 部分的 Java 代码。要求如下:
2 | {spec}
3 | - 只返回修改完的函数代码,不做解释。
4 | - 请确保 service 类的名称与 {controllerName} 相关的 service 类的名称一致。
5 | - 请参考标准的 RESTful API 设计规范,尽量使用标准的 HTTP 方法和状态码。
6 |
7 | ###
8 | // {controllerName} 相关信息如下:
9 | {controllers}
10 | ###
11 |
12 | ###
13 | // 相关 DTO 和 entity 类如下:
14 | {models}
15 |
16 | // 所有 service 类如下,{如果不存在需要的 service 类,请自行创建}
17 | {services}
18 | ###
19 |
20 | 用户故事如下:
21 |
22 | ###
23 | {storyDetail}
24 | ###
25 |
26 |
--------------------------------------------------------------------------------
/mpp-server/src/main/kotlin/cc/unitmesh/server/plugins/Serialization.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.server.plugins
2 |
3 | import io.ktor.http.*
4 | import io.ktor.serialization.kotlinx.json.*
5 | import io.ktor.server.application.*
6 | import io.ktor.server.plugins.contentnegotiation.*
7 | import kotlinx.serialization.json.Json
8 |
9 | fun Application.configureSerialization() {
10 | install(ContentNegotiation) {
11 | json(Json {
12 | prettyPrint = true
13 | isLenient = true
14 | ignoreUnknownKeys = true
15 | })
16 | }
17 | }
18 |
19 |
--------------------------------------------------------------------------------
/mpp-web/README.md:
--------------------------------------------------------------------------------
1 | # xuiper.com Landing (mpp-web)
2 |
3 | 本目录基于现有 `mpp-web`(Vite + React)实现 **`www.xuiper.com` 的 landing page**,并保留原来的 Web UI(用于演示 `mpp-core`):
4 |
5 | - 访问 **Landing**:`/#/`
6 | - 访问 **Web UI**:`/#/app`
7 |
8 | ## 本地开发
9 |
10 | ```bash
11 | cd mpp-web
12 | npm run dev
13 | ```
14 |
15 | ## 构建
16 |
17 | > `npm run build` 会先构建 Kotlin/JS 的 `mpp-core` 产物,再执行 Vite 构建。
18 |
19 | ```bash
20 | cd mpp-web
21 | npm run build
22 | ```
23 |
24 | ## 部署到自定义域名
25 |
26 | - `public/CNAME` 已设置为 `www.xuiper.com`,适用于 GitHub Pages 自定义域名。
27 | - 如果你使用 Vercel/Cloudflare Pages,也可以保留该文件(不影响构建产物)。
--------------------------------------------------------------------------------
/mpp-core/src/jsMain/kotlin/cc/unitmesh/agent/database/DatabaseConnection.js.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.agent.database
2 |
3 | /**
4 | * JS platform database connection placeholder
5 | *
6 | * JS platform does not support direct database connections.
7 | * Use server HTTP API to access databases instead.
8 | */
9 | actual fun createDatabaseConnection(config: DatabaseConfig): DatabaseConnection {
10 | throw UnsupportedOperationException(
11 | "Database connections are not supported on JS platform. " +
12 | "Use the server API to access databases instead."
13 | )
14 | }
15 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/run/runner/ShireRunnerContext.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.language.run.runner
2 |
3 | import cc.unitmesh.devti.language.ast.HobbitHole
4 | import cc.unitmesh.devti.language.compiler.DevInsCompiledResult
5 | import com.intellij.openapi.editor.Editor
6 |
7 | class ShireRunnerContext(
8 | val hole: HobbitHole?,
9 | val editor: Editor?,
10 | val compileResult: DevInsCompiledResult,
11 | val finalPrompt: String = "",
12 | val hasError: Boolean,
13 | val compiledVariables: Map,
14 | )
15 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-exts/ext-terminal/src/main/kotlin/cc/unitmesh/terminal/ShellSuggestContext.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.terminal
2 |
3 | import cc.unitmesh.devti.template.context.TemplateContext
4 | import java.text.SimpleDateFormat
5 | import java.util.*
6 |
7 | data class ShellSuggestContext(
8 | val question: String,
9 | val shellPath: String,
10 | val cwd: String,
11 | // today's date like 20240322
12 | val today: String = SimpleDateFormat("yyyyMMdd").format(Date()),
13 | // operating system name
14 | val os: String = System.getProperty("os.name")
15 | ) : TemplateContext
--------------------------------------------------------------------------------
/mpp-vscode/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "module": "commonjs",
4 | "target": "ES2022",
5 | "lib": ["ES2022"],
6 | "outDir": "dist",
7 | "rootDir": "src",
8 | "strict": true,
9 | "esModuleInterop": true,
10 | "skipLibCheck": true,
11 | "forceConsistentCasingInFileNames": true,
12 | "resolveJsonModule": true,
13 | "declaration": true,
14 | "declarationMap": true,
15 | "sourceMap": true,
16 | "moduleResolution": "node"
17 | },
18 | "include": ["src/**/*"],
19 | "exclude": ["node_modules", "dist", "webview"]
20 | }
21 |
22 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | # Dependabot configuration:
2 | # https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/configuration-options-for-dependency-updates
3 |
4 | version: 2
5 | updates:
6 | # Maintain dependencies for Gradle dependencies
7 | - package-ecosystem: "gradle"
8 | directory: "/"
9 | target-branch: "next"
10 | schedule:
11 | interval: "daily"
12 | # Maintain dependencies for GitHub Actions
13 | - package-ecosystem: "github-actions"
14 | directory: "/"
15 | target-branch: "next"
16 | schedule:
17 | interval: "daily"
18 |
--------------------------------------------------------------------------------
/mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/renderer/nano/components/JewelTypeAliases.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.idea.renderer.nano.components
2 |
3 | import androidx.compose.runtime.Composable
4 | import androidx.compose.ui.Modifier
5 | import cc.unitmesh.xuiper.render.stateful.NanoNodeContext
6 | import cc.unitmesh.xuiper.render.stateful.NanoNodeRenderer
7 |
8 | /**
9 | * Shared type aliases for Jewel nano components.
10 | */
11 | typealias JewelContext = NanoNodeContext Unit>
12 | typealias JewelRenderer = NanoNodeRenderer Unit>
13 |
--------------------------------------------------------------------------------
/mpp-vscode/vitest.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vitest/config';
2 |
3 | export default defineConfig({
4 | test: {
5 | globals: true,
6 | environment: 'node',
7 | include: ['src/**/*.test.ts', 'test/**/*.test.ts'],
8 | exclude: ['node_modules', 'dist'],
9 | coverage: {
10 | provider: 'v8',
11 | reporter: ['text', 'json', 'html'],
12 | include: ['src/**/*.ts'],
13 | exclude: ['src/**/*.test.ts', 'src/**/*.d.ts']
14 | }
15 | },
16 | resolve: {
17 | alias: {
18 | vscode: './test/mocks/vscode.ts'
19 | }
20 | }
21 | });
22 |
23 |
--------------------------------------------------------------------------------
/mpp-vscode/webview/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 | import react from '@vitejs/plugin-react';
3 | import { resolve } from 'path';
4 |
5 | export default defineConfig({
6 | plugins: [react()],
7 | build: {
8 | outDir: '../dist/webview',
9 | emptyOutDir: true,
10 | rollupOptions: {
11 | input: resolve(__dirname, 'index.html'),
12 | output: {
13 | entryFileNames: 'assets/[name].js',
14 | chunkFileNames: 'assets/[name].js',
15 | assetFileNames: 'assets/[name].[ext]'
16 | }
17 | }
18 | },
19 | base: './'
20 | });
21 |
22 |
--------------------------------------------------------------------------------
/xiuper-ui/src/commonMain/kotlin/cc/unitmesh/xuiper/render/theme/NanoDesignSystemSpec.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.xuiper.render.theme
2 |
3 | import kotlinx.serialization.Serializable
4 |
5 | /**
6 | * Platform-independent design system specification.
7 | *
8 | * Contains color tokens for both light and dark modes.
9 | * Platform implementations convert these to their specific color systems.
10 | */
11 | @Serializable
12 | data class NanoDesignSystemSpec(
13 | val id: String,
14 | val displayName: String,
15 | val lightTokens: NanoColorToken,
16 | val darkTokens: NanoColorToken
17 | )
18 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/run/flow/DevInsProcessContext.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.language.run.flow
2 |
3 | import cc.unitmesh.devti.language.compiler.DevInsCompiledResult
4 |
5 | data class DevInsProcessContext(
6 | val scriptPath: String,
7 | val compiledResult: DevInsCompiledResult,
8 | val llmResponse: String,
9 | val ideOutput: String,
10 | val messages: MutableList = mutableListOf(),
11 | var hadReRun: Boolean = false
12 | ) {
13 | // update messages when has Error or Warning
14 | }
--------------------------------------------------------------------------------
/mpp-ios/AutoDevApp/AutoDevApp.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AutoDevApp.swift
3 | // AutoDevApp
4 | //
5 | // AutoDev iOS Application
6 | // Copyright © 2024 Unit Mesh. All rights reserved.
7 | //
8 |
9 | import SwiftUI
10 |
11 | @main
12 | struct AutoDevApp: App {
13 | init() {
14 | print("🚀 AutoDev iOS App starting...")
15 | setupApp()
16 | }
17 |
18 | var body: some Scene {
19 | WindowGroup {
20 | ContentView()
21 | }
22 | }
23 |
24 | private func setupApp() {
25 | // 应用初始化配置
26 | // 例如: 设置日志级别、主题等
27 | }
28 | }
29 |
30 |
--------------------------------------------------------------------------------
/mpp-ui/src/jsMain/kotlin/cc/unitmesh/devins/ui/compose/agent/PlatformMessageTextContainer.js.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.ui.compose.agent
2 |
3 | import androidx.compose.foundation.text.selection.SelectionContainer
4 | import androidx.compose.runtime.Composable
5 | import androidx.compose.ui.Modifier
6 |
7 | /**
8 | * JS 平台实现 - 支持文本选择
9 | */
10 | @Composable
11 | actual fun PlatformMessageTextContainer(
12 | text: String,
13 | modifier: Modifier,
14 | content: @Composable () -> Unit
15 | ) {
16 | SelectionContainer(modifier = modifier) {
17 | content()
18 | }
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/provider/runner/RunnerStatus.kt:
--------------------------------------------------------------------------------
1 | // Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
2 | package cc.unitmesh.devti.provider.runner
3 |
4 | enum class RunnerStatus(val rawStatus: String) {
5 | Unchecked("UNCHECKED"),
6 | Solved("CORRECT"),
7 | Failed("WRONG");
8 |
9 | companion object {
10 | fun String.toCheckStatus(): RunnerStatus = when (this) {
11 | "CORRECT" -> Solved
12 | "WRONG" -> Failed
13 | else -> Unchecked
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/middleware/select/PsiElementStrategy.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.language.middleware.select
2 |
3 | import com.intellij.openapi.editor.Editor
4 | import com.intellij.openapi.project.Project
5 | import com.intellij.openapi.util.TextRange
6 | import com.intellij.psi.PsiElement
7 | import com.intellij.psi.PsiFile
8 |
9 | interface PsiElementStrategy {
10 | fun getElementToAction(project: Project?, editor: Editor?): PsiElement?
11 | fun getElementToAction(project: Project?, psiFile: PsiFile, range: TextRange): PsiElement?
12 | }
13 |
--------------------------------------------------------------------------------
/mpp-ui/src/iosMain/kotlin/cc/unitmesh/devins/ui/compose/agent/PlatformMessageTextContainer.ios.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.ui.compose.agent
2 |
3 | import androidx.compose.foundation.text.selection.SelectionContainer
4 | import androidx.compose.runtime.Composable
5 | import androidx.compose.ui.Modifier
6 |
7 | /**
8 | * iOS 平台实现 - 支持文本选择
9 | */
10 | @Composable
11 | actual fun PlatformMessageTextContainer(
12 | text: String,
13 | modifier: Modifier,
14 | content: @Composable () -> Unit
15 | ) {
16 | SelectionContainer(modifier = modifier) {
17 | content()
18 | }
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/xiuper-ui/src/main/resources/prompts/examples/counter.nanodsl:
--------------------------------------------------------------------------------
1 | component CounterCard:
2 | state:
3 | count: int = 1
4 | price: float = 99.0
5 |
6 | Card:
7 | padding: "lg"
8 | content:
9 | VStack:
10 | Text(content << f"Total: ${state.count * state.price}")
11 |
12 | HStack:
13 | Button("-"):
14 | on_click: state.count -= 1
15 |
16 | Input(value := state.count)
17 |
18 | Button("+"):
19 | on_click: state.count += 1
20 |
21 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/custom/schema/InlayCodePromptsJsonSchemaProviderFactory.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.custom.schema
2 |
3 | import com.intellij.openapi.project.Project
4 | import com.jetbrains.jsonSchema.extension.JsonSchemaFileProvider
5 | import com.jetbrains.jsonSchema.extension.JsonSchemaProviderFactory
6 |
7 | class InlayCodePromptsJsonSchemaProviderFactory: JsonSchemaProviderFactory {
8 | override fun getProviders(project: Project): MutableList {
9 | return mutableListOf(InlayCodeCompletePromptsSchemaFileProvider(project))
10 | }
11 | }
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-exts/devins-lang/src/main/resources/agent/toolExamples/speckit.devin:
--------------------------------------------------------------------------------
1 | # Spec-Kit Commands
2 |
3 | GitHub Spec-Kit provides a structured approach to Spec-Driven Development. These commands help you create specifications, plans, and implementations following the spec-driven methodology.
4 |
5 | ### 1. Constitution - Establish Project Principles
6 |
7 | Create or update project governing principles and development guidelines:
8 |
9 | ```devin
10 | /speckit.constitution Create principles focused on code quality, testing standards, user experience consistency, and performance requirements
11 | ```
12 |
--------------------------------------------------------------------------------
/mpp-ui/src/wasmJsMain/kotlin/cc/unitmesh/devins/ui/compose/agent/PlatformMessageTextContainer.wasmJs.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.ui.compose.agent
2 |
3 | import androidx.compose.foundation.text.selection.SelectionContainer
4 | import androidx.compose.runtime.Composable
5 | import androidx.compose.ui.Modifier
6 |
7 | /**
8 | * JS 平台实现 - 支持文本选择
9 | */
10 | @Composable
11 | actual fun PlatformMessageTextContainer(
12 | text: String,
13 | modifier: Modifier,
14 | content: @Composable () -> Unit
15 | ) {
16 | SelectionContainer(modifier = modifier) {
17 | content()
18 | }
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/actions/chat/ExplainThisAction.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.actions.chat
2 |
3 | import cc.unitmesh.devti.actions.chat.base.ChatCheckForUpdateAction
4 | import cc.unitmesh.devti.gui.chat.message.ChatActionType
5 | import cc.unitmesh.devti.settings.locale.LanguageChangedCallback.presentationText
6 |
7 | class ExplainThisAction() : ChatCheckForUpdateAction() {
8 | init{
9 | presentationText("settings.autodev.rightClick.explain", templatePresentation)
10 | }
11 |
12 | override fun getActionType(): ChatActionType = ChatActionType.EXPLAIN
13 | }
14 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/sketch/ui/MarkdownPreviewSketchProvider.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.sketch.ui
2 |
3 | import com.intellij.openapi.project.Project
4 |
5 | class MarkdownPreviewSketchProvider : LanguageSketchProvider {
6 | /**
7 | * Since Webview had a bad performance, we disable it by default.
8 | */
9 | override fun isSupported(lang: String): Boolean {
10 | return lang.lowercase() == "markdown"
11 | }
12 |
13 | override fun create(project: Project, content: String): ExtensionLangSketch = MarkdownPreviewHighlightSketch(project, content)
14 | }
15 |
--------------------------------------------------------------------------------
/mpp-ui/src/androidMain/kotlin/cc/unitmesh/devins/ui/compose/agent/PlatformMessageTextContainer.android.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.ui.compose.agent
2 |
3 | import androidx.compose.foundation.text.selection.SelectionContainer
4 | import androidx.compose.runtime.Composable
5 | import androidx.compose.ui.Modifier
6 |
7 | /**
8 | * Android 平台实现 - 支持文本选择
9 | */
10 | @Composable
11 | actual fun PlatformMessageTextContainer(
12 | text: String,
13 | modifier: Modifier,
14 | content: @Composable () -> Unit
15 | ) {
16 | SelectionContainer(modifier = modifier) {
17 | content()
18 | }
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/xiuper-fs/src/commonTest/kotlin/cc/unitmesh/xiuper/fs/FsPathTest.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.xiuper.fs
2 |
3 | import kotlin.test.Test
4 | import kotlin.test.assertEquals
5 |
6 | class FsPathTest {
7 | @Test
8 | fun normalizeRemovesDotSegments() {
9 | assertEquals("/a/b", FsPath.normalize("/a/./b"))
10 | assertEquals("/a/b", FsPath.normalize("/a/x/../b"))
11 | assertEquals("/", FsPath.normalize("/../"))
12 | }
13 |
14 | @Test
15 | fun resolveJoinsAndNormalizes() {
16 | val p = FsPath.of("/a").resolve("b/../c")
17 | assertEquals("/a/c", p.value)
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/xiuper-ui/src/commonMain/resources/prompts/examples/counter.nanodsl:
--------------------------------------------------------------------------------
1 | component CounterCard:
2 | state:
3 | count: int = 1
4 | price: float = 99.0
5 |
6 | Card:
7 | padding: "lg"
8 | content:
9 | VStack:
10 | Text(content << f"Total: ${state.count * state.price}")
11 |
12 | HStack:
13 | Button("-"):
14 | on_click: state.count -= 1
15 |
16 | Input(value := state.count)
17 |
18 | Button("+"):
19 | on_click: state.count += 1
20 |
21 |
--------------------------------------------------------------------------------
/mpp-core/src/wasmJsMain/kotlin/cc/unitmesh/devins/document/DocumentRegistry.wasmJs.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.document
2 |
3 | import io.github.oshai.kotlinlogging.KotlinLogging
4 |
5 | private val logger = KotlinLogging.logger {}
6 |
7 | /**
8 | * WASM platform-specific initialization
9 | * Currently only Markdown is supported on WASM platform
10 | */
11 | actual fun platformInitialize() {
12 | logger.info { "Initializing WASM document parsers (Markdown only)" }
13 | // WASM platform only supports Markdown for now
14 | // Markdown parser is already registered in DocumentRegistry init block
15 | }
16 |
17 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/sketch/ui/code/HtmlHighlightSketch.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.sketch.ui.code
2 |
3 | import cc.unitmesh.devti.sketch.ui.ExtensionLangSketch
4 | import com.intellij.lang.html.HTMLLanguage
5 | import com.intellij.openapi.project.Project
6 |
7 | /**
8 | * Before WebView rendering, we use this class to highlight the HTML code.
9 | */
10 | class HtmlHighlightSketch(override val project: Project, override val text: String) :
11 | CodeHighlightSketch(project, text, HTMLLanguage.INSTANCE), ExtensionLangSketch {
12 | override fun getExtensionName(): String = "HTML"
13 | }
--------------------------------------------------------------------------------
/mpp-ui/src/commonMain/kotlin/cc/unitmesh/devins/ui/compose/agent/FileSystemTreeView.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.ui.compose.agent
2 |
3 | import androidx.compose.runtime.Composable
4 | import androidx.compose.ui.Modifier
5 |
6 | /**
7 | * File system tree view - platform-specific implementation
8 | *
9 | * JVM/Android: Uses Bonsai library for rich tree view
10 | * JS: Provides a simplified placeholder (Bonsai doesn't support JS)
11 | */
12 | @Composable
13 | expect fun FileSystemTreeView(
14 | rootPath: String,
15 | onFileClick: (String) -> Unit,
16 | onClose: () -> Unit,
17 | modifier: Modifier
18 | )
19 |
--------------------------------------------------------------------------------
/mpp-ui/src/wasmJsMain/kotlin/cc/unitmesh/devins/ui/compose/AutoDevApp.wasm.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.ui.compose
2 |
3 | import androidx.compose.runtime.Composable
4 |
5 | /**
6 | * WASM 专属的 AutoDevApp 实现
7 | *
8 | * 委托给 commonMain 中的 AutoDevApp 实现
9 | */
10 | @Composable
11 | actual fun PlatformAutoDevApp(
12 | triggerFileChooser: Boolean,
13 | onFileChooserHandled: () -> Unit,
14 | initialMode: String
15 | ) {
16 | AutoDevApp(
17 | triggerFileChooser = triggerFileChooser,
18 | onFileChooserHandled = onFileChooserHandled,
19 | initialMode = initialMode
20 | )
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/mpp-vscode/webview/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "useDefineForClassFields": true,
5 | "lib": ["ES2020", "DOM", "DOM.Iterable"],
6 | "module": "ESNext",
7 | "skipLibCheck": true,
8 | "moduleResolution": "bundler",
9 | "allowImportingTsExtensions": true,
10 | "resolveJsonModule": true,
11 | "isolatedModules": true,
12 | "noEmit": true,
13 | "jsx": "react-jsx",
14 | "strict": true,
15 | "noUnusedLocals": true,
16 | "noUnusedParameters": true,
17 | "noFallthroughCasesInSwitch": true
18 | },
19 | "include": ["src"]
20 | }
21 |
22 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/agent/tool/browse/Browse.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.agent.tool.browse
2 |
3 | import org.jsoup.Jsoup
4 | import org.jsoup.nodes.Document
5 |
6 | class Browse {
7 | companion object {
8 | /**
9 | * Doc for parseHtml
10 | *
11 | * Intellij API: [com.intellij.inspectopedia.extractor.utils.HtmlUtils.cleanupHtml]
12 | */
13 | fun parse(url: String): DocumentContent {
14 | val doc: Document = Jsoup.connect(url).get()
15 | return DocumentCleaner().cleanHtml(doc)
16 | }
17 | }
18 | }
19 |
20 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/resources/genius/zh/sql/sql-gen-design.vm:
--------------------------------------------------------------------------------
1 | 你是一名专业的数据库管理员。
2 | 根据用户的需求和表信息,为用户编写 SQL。
3 |
4 | - 用户使用的数据库版本:${context.databaseVersion}
5 | - 用户架构名称:${context.schemaName}
6 | - 用户表信息:${context.tableInfos}
7 |
8 | 例如:
9 |
10 | - 问题(需求):按订阅者类型计算平均行程长度。
11 | // table `subscriber_type`: average_trip_length: int, subscriber_type: string
12 | - 回答:
13 | ```sql
14 | select average_trip_length from subscriber_type where subscriber_type = 'subscriber'
15 | ```
16 |
17 | ----
18 |
19 | 以下是需求:
20 |
21 | ```markdown
22 | ${context.requirement}
23 | ```
24 | 请使用 Markdown 语法编写您的 SQL,无需解释。
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-exts/devins-lang/src/test/resources/META-INF/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 | cc.unitmesh.devti
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-lang/java/src/main/kotlin/cc/unitmesh/idea/MvcUtil.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.idea
2 |
3 | object MvcUtil {
4 | fun isController(fileName: String, lang: String): Boolean {
5 | return fileName.endsWith("Controller.${lang.lowercase()}")
6 | }
7 |
8 | fun isService(fileName: String, lang: String) =
9 | fileName.endsWith("Service.$${lang.lowercase()}") || fileName.endsWith("ServiceImpl.$${lang.lowercase()}")
10 |
11 | fun isRepository(fileName: String, lang: String) =
12 | fileName.endsWith("Repository.$${lang.lowercase()}") || fileName.endsWith("Repo.$${lang.lowercase()}")
13 | }
14 |
--------------------------------------------------------------------------------
/mpp-ui/src/androidMain/kotlin/cc/unitmesh/devins/ui/nano/StatefulNanoRenderer.android.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.ui.nano
2 |
3 | import android.graphics.BitmapFactory
4 | import androidx.compose.ui.graphics.ImageBitmap
5 | import androidx.compose.ui.graphics.asImageBitmap
6 |
7 | /**
8 | * Android implementation of decodeImageBytesToBitmap.
9 | */
10 | internal actual fun decodeImageBytesToBitmap(bytes: ByteArray): ImageBitmap {
11 | val bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.size)
12 | ?: throw IllegalArgumentException("Failed to decode image bytes")
13 | return bitmap.asImageBitmap()
14 | }
15 |
16 |
--------------------------------------------------------------------------------
/mpp-ui/src/iosMain/kotlin/cc/unitmesh/devins/ui/Main.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.ui
2 |
3 | import androidx.compose.ui.window.ComposeUIViewController
4 | import cc.unitmesh.devins.ui.compose.PlatformAutoDevApp
5 | import platform.UIKit.UIViewController
6 |
7 | /**
8 | * iOS 应用入口点
9 | *
10 | * 这个函数会被 iOS 应用调用来创建 Compose UI 视图控制器
11 | *
12 | * 在 Swift 中使用:
13 | * ```swift
14 | * import AutoDevUI
15 | *
16 | * let viewController = MainKt.MainViewController()
17 | * ```
18 | */
19 | fun MainViewController(): UIViewController {
20 | return ComposeUIViewController {
21 | PlatformAutoDevApp()
22 | }
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/mpp-vscode/.vscodeignore:
--------------------------------------------------------------------------------
1 | # VSCode extension ignore file
2 | # Exclude source files and build artifacts not needed in the packaged extension
3 |
4 | # Source files
5 | src/
6 | webview/src/
7 | webview/node_modules/
8 |
9 | # Build artifacts
10 | *.map
11 | tsconfig.json
12 | .eslintrc.json
13 |
14 | # Development files
15 | .vscode/
16 | node_modules/
17 | .gitignore
18 | .git/
19 |
20 | # Test files
21 | **/__tests__/**
22 | **/*.test.*
23 | **/*.spec.*
24 |
25 | # Documentation (keep README.md)
26 | CHANGELOG.md
27 |
28 | # Exclude parent directories
29 | ../
30 |
31 | # Keep dist and wasm folders
32 | !dist/
33 | !wasm/
34 |
35 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/devins/provider/PsiCapture.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.devins.provider
2 |
3 | import com.intellij.lang.Language
4 | import com.intellij.lang.LanguageExtension
5 |
6 | interface PsiCapture {
7 | fun capture(fileContent: String, type: String): List
8 |
9 | companion object {
10 | private val languageExtension: LanguageExtension =
11 | LanguageExtension("cc.unitmesh.shirePsiCapture")
12 |
13 | fun provide(language: Language): PsiCapture? {
14 | return languageExtension.forLanguage(language)
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-exts/devins-lang/src/test/kotlin/cc/unitmesh/devti/language/completion/dataprovider/BuiltinCommandTest.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.language.completion.dataprovider
2 |
3 | import cc.unitmesh.devti.command.dataprovider.BuiltinCommand
4 | import junit.framework.TestCase.assertEquals
5 | import org.junit.Test
6 |
7 | class BuiltinCommandTest {
8 | @Test
9 | fun shouldEnableGetBuiltinExamples() {
10 | val commandList = BuiltinCommand.all()
11 | val map = commandList.map {
12 | BuiltinCommand.example(it)
13 | }
14 |
15 | assertEquals(commandList.size, map.size)
16 | }
17 | }
--------------------------------------------------------------------------------
/mpp-ios/AutoDevApp/ContentView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ContentView.swift
3 | // AutoDevApp
4 | //
5 | // Main content view for AutoDev iOS App
6 | // Copyright © 2024 Unit Mesh. All rights reserved.
7 | //
8 |
9 | import SwiftUI
10 |
11 | struct ContentView: View {
12 | var body: some View {
13 | ZStack {
14 | // 背景色 - 使用深色背景以匹配 AutoDev 主题
15 | Color.black
16 | .ignoresSafeArea()
17 |
18 | // Compose UI 视图
19 | ComposeView()
20 | .ignoresSafeArea()
21 | }
22 | }
23 | }
24 |
25 | #Preview {
26 | ContentView()
27 | }
28 |
29 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/resources/genius/zh/code/test-gen.vm:
--------------------------------------------------------------------------------
1 | 为以下代码编写单元测试。
2 |
3 | ${context.frameworkContext}
4 |
5 | #if( $context.relatedClasses.length() > 0 )
6 | ${context.relatedClasses}
7 | #end
8 | #if( $context.currentClass.length() > 0 )
9 | 以下是当前类的信息:
10 | ${context.currentClass}
11 | #end
12 | ${context.extContext}
13 | 以下是待测试的源代码:
14 |
15 | ```$context.lang
16 | ${context.imports}
17 | ${context.sourceCode}
18 | ```
19 |
20 | 如果是新文件
21 | #if( $context.isNewFile )
22 | 请包含package和import,在此处使用 Markdown 代码块编写方法测试代码:
23 | #else
24 | 请包含package和import, 在此处使用 Markdown 代码块编写 ${context.testClassName} 测试代码:
25 | #end
26 |
27 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/resources/icons/stop.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-exts/nanodsl-lang/src/main/kotlin/cc/unitmesh/nanodsl/language/psi/NanoDSLFile.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.nanodsl.language.psi
2 |
3 | import cc.unitmesh.nanodsl.language.NanoDSLFileType
4 | import cc.unitmesh.nanodsl.language.NanoDSLLanguage
5 | import com.intellij.extapi.psi.PsiFileBase
6 | import com.intellij.openapi.fileTypes.FileType
7 | import com.intellij.psi.FileViewProvider
8 |
9 | class NanoDSLFile(viewProvider: FileViewProvider) : PsiFileBase(viewProvider, NanoDSLLanguage) {
10 | override fun getFileType(): FileType = NanoDSLFileType
11 |
12 | override fun toString(): String = "NanoDSL File"
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/resources/genius/en/practises/shell-suggest.vm:
--------------------------------------------------------------------------------
1 | Return only the command to be executed as a raw string, no string delimiters
2 | wrapping it, no yapping, no markdown, no fenced code blocks, what you return
3 | will be passed to subprocess.check_output() directly.
4 |
5 | - Today is: ${context.today}, user system is: ${context.os},
6 | - User current directory is: ${context.cwd}, user use is: ${context.shellPath}, according the tool to create the command.
7 |
8 | For example, if the user asks: undo last git commit
9 |
10 | You return only line command: git reset --soft HEAD~1
11 |
12 | User asks: ${context.question}
13 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/resources/genius/zh/practises/code-review.vm:
--------------------------------------------------------------------------------
1 | 你是一位经验丰富的软件开发者,我寻求您的专业知识来审查以下代码:
2 |
3 | - 专注于代码中的关键算法、逻辑流程和设计决策。讨论这些变化如何影响核心功能和代码的整体结构。
4 | - 确定并突出显示这些代码变化可能引入的任何潜在问题或风险。这将帮助审阅人员特别关注可能需要改进或进一步分析的领域。
5 | - 强调与现有代码库的兼容性和一致性的重要性。确保代码符合已建立的标准和实践,以确保代码的统一性和长期可维护性。
6 |
7 | ${context.frameworkContext}
8 |
9 | 如下是变更的结构化表示, + means new method, - means deleted method:
10 |
11 | ${context.structureContext}
12 |
13 | #if($context.stories.isNotEmpty())
14 | 以下用户故事与这些变化相关:
15 | ${context.stories.joinToString("\n")}
16 | #end
17 |
18 | ${context.diffContext}
19 |
20 | 作为您的技术负责人,我只关注关键的代码审查问题。请在此提供关键总结。
21 | 在此处以不超过 5 句话提交您的关键见解:
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/resources/genius/zh/practises/shell-suggest.vm:
--------------------------------------------------------------------------------
1 | Return only the command to be executed as a raw string, no string delimiters
2 | wrapping it, no yapping, no markdown, no fenced code blocks, what you return
3 | will be passed to subprocess.check_output() directly.
4 |
5 | - Today is: ${context.today}, user system is: ${context.os},
6 | - User current directory is: ${context.cwd}, user use is: ${context.shellPath}, according the tool to create the command.
7 |
8 | For example, if the user asks: undo last git commit
9 |
10 | You return only line command: git reset --soft HEAD~1
11 |
12 | User asks: ${context.question}
13 |
--------------------------------------------------------------------------------
/mpp-vscode/webview/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "autodev-webview",
3 | "version": "0.1.0",
4 | "private": true,
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "tsc && vite build",
9 | "preview": "vite preview"
10 | },
11 | "dependencies": {
12 | "react": "^18.2.0",
13 | "react-dom": "^18.2.0",
14 | "react-markdown": "^9.0.1",
15 | "remark-gfm": "^4.0.0"
16 | },
17 | "devDependencies": {
18 | "@types/react": "^18.2.0",
19 | "@types/react-dom": "^18.2.0",
20 | "@vitejs/plugin-react": "^4.2.0",
21 | "typescript": "^5.3.0",
22 | "vite": "^5.0.0"
23 | }
24 | }
25 |
26 |
--------------------------------------------------------------------------------
/mpp-core/src/iosMain/kotlin/cc/unitmesh/agent/database/DatabaseConnection.ios.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.agent.database
2 |
3 | /**
4 | * iOS platform database connection placeholder
5 | *
6 | * iOS should use Core Data or SQLite for local storage,
7 | * not direct remote database connections.
8 | * Use server API when accessing remote databases.
9 | */
10 | actual fun createDatabaseConnection(config: DatabaseConfig): DatabaseConnection {
11 | throw UnsupportedOperationException(
12 | "Direct database connections are not recommended on iOS. " +
13 | "Use Core Data for local storage or connect through server API."
14 | )
15 | }
16 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/settings/locale/LocaleLanguages.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.settings.locale
2 |
3 | @Suppress("unused")
4 | enum class HUMAN_LANGUAGES(val abbr: String, val display: String) {
5 | ENGLISH("en", "English"),
6 | CHINESE("zh", "中文");
7 |
8 | companion object {
9 | private val map: Map = values().map { it.display to it }.toMap()
10 |
11 | fun getAbbrByDispay(display: String): String {
12 | return map.getOrDefault(display, ENGLISH).abbr
13 | }
14 | }
15 | }
16 | val DEFAULT_HUMAN_LANGUAGE = HUMAN_LANGUAGES.ENGLISH.display
17 |
--------------------------------------------------------------------------------
/mpp-ui/src/jsMain/kotlin/cc/unitmesh/devins/ui/compose/AutoDevApp.js.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.ui.compose
2 |
3 | import androidx.compose.runtime.Composable
4 |
5 | /**
6 | * JS 专属的 AutoDevApp 实现
7 | *
8 | * 委托给 commonMain 中的 AutoDevApp 实现
9 | */
10 | @Composable
11 | actual fun PlatformAutoDevApp(
12 | triggerFileChooser: Boolean,
13 | onFileChooserHandled: () -> Unit,
14 | initialMode: String
15 | ) {
16 | // JS 平台使用 commonMain 中的原有实现
17 | AutoDevApp(
18 | triggerFileChooser = triggerFileChooser,
19 | onFileChooserHandled = onFileChooserHandled,
20 | initialMode = initialMode
21 | )
22 | }
23 |
24 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/command/InsCommand.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.command
2 |
3 | import cc.unitmesh.devti.command.dataprovider.BuiltinCommand
4 |
5 | interface InsCommand {
6 | val commandName: BuiltinCommand
7 |
8 | /**
9 | * Check if the command is applicable , especially for the binary command, like ripgrep.
10 | */
11 | fun isApplicable(): Boolean = true
12 |
13 | /**
14 | * Execute the command and return the result.
15 | */
16 | suspend fun execute(): String?
17 | }
18 |
19 | enum class InsCommandStatus {
20 | SUCCESS,
21 | FAILED,
22 | RUNNING
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/context/builder/MethodContextBuilder.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.context.builder
2 |
3 | import cc.unitmesh.devti.context.MethodContext
4 | import com.intellij.psi.PsiElement
5 |
6 | /**
7 | * The MethodContextBuilder interface provides a method for retrieving the method context of a given PsiElement.
8 | * A method context represents the context in which a method is defined or used within a codebase.
9 | * @see MethodContext
10 | */
11 | interface MethodContextBuilder {
12 | fun getMethodContext(psiElement: PsiElement, includeClassContext: Boolean, gatherUsages: Boolean): MethodContext?
13 | }
14 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/prompting/code/TechStack.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.prompting.code
2 |
3 | data class TechStack(
4 | val coreFrameworks: MutableMap = mutableMapOf(),
5 | val testFrameworks: MutableMap = mutableMapOf(),
6 | val deps: MutableMap = mutableMapOf(),
7 | val devDeps: MutableMap = mutableMapOf()
8 | ) {
9 | fun coreFrameworks(): String {
10 | return coreFrameworks.keys.joinToString(", ")
11 | }
12 |
13 | fun testFrameworks(): String {
14 | return testFrameworks.keys.joinToString(", ")
15 | }
16 | }
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/ui.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti
2 |
3 | import com.intellij.ui.dsl.builder.*
4 | import javax.swing.JComponent
5 |
6 | fun Row.fullWidthCell(component: T): Cell {
7 | return cell(component)
8 | .align(Align.FILL)
9 | }
10 |
11 | fun Cell.fullWidth(): Cell {
12 | return this.align(AlignX.FILL)
13 | }
14 |
15 | fun Cell.fullHeight(): Cell {
16 | return this.align(AlignY.FILL)
17 | }
18 |
19 | // align right
20 | fun Cell.alignRight(): Cell {
21 | return this.align(AlignX.RIGHT)
22 | }
23 |
24 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/ast/variable/resolver/base/VariableResolverContext.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.language.ast.variable.resolver.base
2 |
3 | import cc.unitmesh.devti.language.ast.HobbitHole
4 | import com.intellij.openapi.editor.Editor
5 | import com.intellij.openapi.project.Project
6 | import com.intellij.psi.PsiElement
7 | import cc.unitmesh.devti.language.ast.variable.VariableTable
8 |
9 | data class VariableResolverContext(
10 | val myProject: Project,
11 | val editor: Editor,
12 | val hole: HobbitHole?,
13 | val variableTable: VariableTable,
14 | var element: PsiElement?
15 | )
--------------------------------------------------------------------------------
/mpp-ui/src/jsMain/resources/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Markdown Renderer Demo - Web
7 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/xiuper-ui/testcases/expect/03-counter-card.nanodsl:
--------------------------------------------------------------------------------
1 | component CounterCard:
2 | state:
3 | count: int = 1
4 | price: float = 99.0
5 |
6 | Card:
7 | padding: "lg"
8 | content:
9 | VStack:
10 | Text(content << f"Total: ${state.count * state.price}")
11 |
12 | HStack:
13 | Button("-"):
14 | on_click: state.count -= 1
15 |
16 | Input(value := state.count)
17 |
18 | Button("+"):
19 | on_click: state.count += 1
20 |
21 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/vcs/gitignore/InvalidGitIgnorePatternException.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.vcs.gitignore
2 |
3 | /**
4 | * Exception thrown when a gitignore pattern is malformed or cannot be processed.
5 | *
6 | * @param originalPattern the original gitignore pattern that caused the error
7 | * @param message detailed error message
8 | * @param cause the underlying cause of the error, if any
9 | */
10 | class InvalidGitIgnorePatternException(
11 | val originalPattern: String,
12 | message: String,
13 | cause: Throwable? = null
14 | ) : Exception("Invalid gitignore pattern '$originalPattern': $message", cause)
15 |
--------------------------------------------------------------------------------
/mpp-viewer-web/src/commonMain/kotlin/cc/unitmesh/viewer/web/webedit/WebEditAction.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.viewer.web.webedit
2 |
3 | import kotlinx.serialization.Serializable
4 |
5 | /**
6 | * Structured browser action request executed by the injected WebEdit bridge script.
7 | *
8 | * Keep this schema small and stable so LLMs can reliably emit it.
9 | */
10 | @Serializable
11 | data class WebEditAction(
12 | val action: String,
13 | val selector: String? = null,
14 | val text: String? = null,
15 | val clearFirst: Boolean? = null,
16 | val value: String? = null,
17 | val key: String? = null,
18 | val id: String? = null
19 | )
20 |
21 |
22 |
--------------------------------------------------------------------------------
/mpp-core/src/iosMain/kotlin/cc/unitmesh/devins/document/DocumentRegistry.ios.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.document
2 |
3 | import io.github.oshai.kotlinlogging.KotlinLogging
4 |
5 | private val logger = KotlinLogging.logger {}
6 |
7 | /**
8 | * iOS platform-specific initialization
9 | * Currently only Markdown is supported on iOS platform
10 | * TODO: Consider adding iOS-specific document parsers
11 | */
12 | actual fun platformInitialize() {
13 | logger.info { "Initializing iOS document parsers (Markdown only)" }
14 | // iOS platform only supports Markdown for now
15 | // Markdown parser is already registered in DocumentRegistry init block
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/mpp-core/src/jsMain/kotlin/cc/unitmesh/llm/ExecutorFactory.js.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.llm
2 |
3 | import ai.koog.prompt.executor.llms.SingleLLMPromptExecutor
4 | import cc.unitmesh.llm.provider.LLMClientProvider
5 |
6 | /**
7 | * JS implementation: GitHub Copilot not supported
8 | */
9 | internal actual fun tryAutoRegisterGithubCopilot(): LLMClientProvider? = null
10 |
11 | /**
12 | * JS implementation: Blocking executor creation not supported
13 | * Use createAsync() instead for async initialization
14 | */
15 | internal actual fun createExecutorBlocking(
16 | provider: LLMClientProvider,
17 | config: ModelConfig
18 | ): SingleLLMPromptExecutor? = null
19 |
20 |
--------------------------------------------------------------------------------
/mpp-ui/src/commonMain/kotlin/cc/unitmesh/devins/ui/compose/agent/codereview/FileViewerDialog.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.ui.compose.agent.codereview
2 |
3 | import androidx.compose.runtime.Composable
4 |
5 | /**
6 | * File viewer dialog - platform-specific implementation
7 | * Shows file content in a dialog with modern features:
8 | * - Keyboard shortcuts (Esc to close, Ctrl+F/Cmd+F to search, Ctrl+W/Cmd+W to close)
9 | * - Syntax highlighting
10 | * - Line number highlighting
11 | */
12 | @Composable
13 | expect fun FileViewerDialog(
14 | filePath: String,
15 | onClose: () -> Unit,
16 | startLine: Int? = null,
17 | endLine: Int? = null
18 | )
19 |
20 |
--------------------------------------------------------------------------------
/mpp-ui/src/jsMain/typescript/ui/Banner.tsx:
--------------------------------------------------------------------------------
1 | /**
2 | * Banner - Display ASCII art logo
3 | */
4 |
5 | import React from 'react';
6 | import { Box, Text } from 'ink';
7 | import { AUTODEV_LOGO, AUTODEV_TAGLINE } from '../constants/asciiArt.js';
8 | import { semanticInk } from '../design-system/theme-helpers.js';
9 |
10 | export const Banner: React.FC = () => {
11 | return (
12 |
13 |
14 | {AUTODEV_LOGO}
15 |
16 |
17 | {AUTODEV_TAGLINE}
18 |
19 |
20 | );
21 | };
22 |
--------------------------------------------------------------------------------
/example/prompt/autodev/controller-output.md:
--------------------------------------------------------------------------------
1 | # Output
2 |
3 |
4 | ```
5 | @PostMapping("/blog")
6 | public ResponseEntity> createBlog(@RequestBody Blog blog) {
7 | try {
8 | // 验证博客信息是否完整
9 | if (StringUtils.isBlank(blog.getTitle())) {
10 | return ResponseEntity.badRequest().body("请输入博客标题");
11 | }
12 |
13 | // 调用 BlogService 创建博客
14 | Long blogId = blogService.createBlog(blog);
15 |
16 | // 返回博客 id
17 | return ResponseEntity.ok(blogId);
18 | } catch (Exception e) {
19 | // 返回错误信息
20 | return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
21 | .body("创建博客失败,请稍后重试");
22 | }
23 | }
24 | ```
25 |
26 |
--------------------------------------------------------------------------------
/mpp-core/src/androidMain/kotlin/cc/unitmesh/agent/database/DatabaseConnection.android.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.agent.database
2 |
3 | /**
4 | * Android platform database connection placeholder
5 | *
6 | * Android should use Room or other local database frameworks,
7 | * not direct remote database connections.
8 | * Use server API when accessing remote databases.
9 | */
10 | actual fun createDatabaseConnection(config: DatabaseConfig): DatabaseConnection {
11 | throw UnsupportedOperationException(
12 | "Direct database connections are not recommended on Android. " +
13 | "Use Room database for local storage or connect through server API."
14 | )
15 | }
16 |
--------------------------------------------------------------------------------
/mpp-core/src/iosMain/kotlin/cc/unitmesh/llm/ExecutorFactory.ios.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.llm
2 |
3 | import ai.koog.prompt.executor.llms.SingleLLMPromptExecutor
4 | import cc.unitmesh.llm.provider.LLMClientProvider
5 |
6 | /**
7 | * iOS implementation: GitHub Copilot not supported
8 | */
9 | internal actual fun tryAutoRegisterGithubCopilot(): LLMClientProvider? = null
10 |
11 | /**
12 | * iOS implementation: Blocking executor creation not supported
13 | * iOS doesn't support runBlocking, so we return null
14 | */
15 | internal actual fun createExecutorBlocking(
16 | provider: LLMClientProvider,
17 | config: ModelConfig
18 | ): SingleLLMPromptExecutor? = null
19 |
20 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/custom/variable/ClassStructureVariableResolver.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.custom.variable
2 |
3 | import cc.unitmesh.devti.context.ClassContextProvider
4 | import com.intellij.psi.PsiElement
5 |
6 | class ClassStructureVariableResolver(val element: PsiElement) : VariableResolver {
7 | override val type: CustomResolvedVariableType = CustomResolvedVariableType.METHOD_INPUT_OUTPUT
8 |
9 | override fun resolve(): String {
10 | val classContext = ClassContextProvider(false).from(element)
11 | if (classContext.name == null) return ""
12 |
13 | return classContext.format()
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/mpp-core/src/wasmJsMain/kotlin/cc/unitmesh/llm/ExecutorFactory.wasmJs.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.llm
2 |
3 | import ai.koog.prompt.executor.llms.SingleLLMPromptExecutor
4 | import cc.unitmesh.llm.provider.LLMClientProvider
5 |
6 | /**
7 | * WASM implementation: GitHub Copilot not supported
8 | */
9 | internal actual fun tryAutoRegisterGithubCopilot(): LLMClientProvider? = null
10 |
11 | /**
12 | * WASM implementation: Blocking executor creation not supported
13 | * Use createAsync() instead for async initialization
14 | */
15 | internal actual fun createExecutorBlocking(
16 | provider: LLMClientProvider,
17 | config: ModelConfig
18 | ): SingleLLMPromptExecutor? = null
19 |
20 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/command/dataprovider/FileFunc.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.command.dataprovider
2 |
3 | import com.intellij.icons.AllIcons
4 | import javax.swing.Icon
5 |
6 | enum class FileFunc(val funcName: String, val description: String, val icon: Icon) {
7 | Regex("regex", "Read the content of a file by regex", AllIcons.Actions.Regex),
8 |
9 | ;
10 |
11 | companion object {
12 | fun all(): List {
13 | return values().toList()
14 | }
15 |
16 | fun fromString(funcName: String): FileFunc? {
17 | return values().find { it.funcName == funcName }
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/mpp-viewer-web/src/jvmMain/kotlin/cc/unitmesh/viewer/web/automation/TestModels.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.viewer.web.automation
2 |
3 | /**
4 | * Test result data class
5 | */
6 | data class TestResult(
7 | val name: String,
8 | val category: TestCategory,
9 | val passed: Boolean,
10 | val duration: Long,
11 | val message: String = if (passed) "Test completed successfully" else "Test assertion failed"
12 | )
13 |
14 | /**
15 | * Test categories for grouping related tests
16 | */
17 | enum class TestCategory {
18 | BRIDGE_COMMUNICATION,
19 | DOM_INSPECTION,
20 | SHADOW_DOM,
21 | USER_INTERACTION,
22 | MUTATION_OBSERVER,
23 | GENERAL
24 | }
25 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/observer/plan/PlanUpdateListener.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.observer.plan
2 |
3 | import com.intellij.openapi.vcs.changes.Change
4 | import com.intellij.util.messages.Topic
5 | import java.util.*
6 |
7 | @FunctionalInterface
8 | interface PlanUpdateListener: EventListener {
9 | fun onPlanUpdate(items: MutableList)
10 | fun onUpdateChange(changes: MutableList)
11 |
12 | companion object {
13 | @Topic.AppLevel
14 | val TOPIC: Topic = Topic(
15 | PlanUpdateListener::class.java, Topic.BroadcastDirection.TO_DIRECT_CHILDREN
16 | )
17 | }
18 | }
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/resources/genius/zh/page/page-gen-design.vm:
--------------------------------------------------------------------------------
1 | 你是一位专业的前端开发者。
2 | 根据用户的需求和组件信息,为用户编写组件。
3 |
4 | - 用户组件信息:${context.components}
5 |
6 | 例如:
7 |
8 | - 问题(需求):为用户构建一个填写个人信息的表单。
9 | // 组件名称: Form, props: { fields: [{name: 'name', type: 'text'}, {name: 'age', type: 'number'}] }
10 | // 组件名称: Input, props: { name: 'name', type: 'text' }
11 | // : Input, props: { name: 'age', type: 'number' }
12 | - 回答:
13 | ```react
14 |
18 | ```
19 |
20 | ----
21 |
22 | 以下是需求:
23 |
24 | ```markdown
25 | ${context.requirement}
26 | ```
27 |
28 | 请使用 Markdown 语法编写您的代码,无需解释。
29 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-exts/devins-lang/src/main/resources/agent/toolExamples/write-process-input.devin:
--------------------------------------------------------------------------------
1 | Write input data to a running process's stdin. Supports interactive process communication and automation of command-line tools.
2 |
3 | Write input from code block:
4 | /write-process-input:proc_1234567890_1
5 | ```
6 | hello world
7 | ```
8 |
9 | Write input without automatic newline:
10 | /write-process-input:proc_1234567890_1 --no-newline
11 | ```
12 | input without newline
13 | ```
14 |
15 | Write simple text input:
16 | /write-process-input:proc_1234567890_1 simple text input
17 |
18 | Use /list-processes to find the process ID. Only works with running processes that accept stdin input.
19 |
--------------------------------------------------------------------------------
/mpp-core/src/androidMain/kotlin/cc/unitmesh/devins/document/DocumentRegistry.android.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.document
2 |
3 | import io.github.oshai.kotlinlogging.KotlinLogging
4 |
5 | private val logger = KotlinLogging.logger {}
6 |
7 | /**
8 | * Android platform-specific initialization
9 | * Currently only Markdown is supported on Android platform
10 | * TODO: Consider adding Android-specific document parsers
11 | */
12 | actual fun platformInitialize() {
13 | logger.info { "Initializing Android document parsers (Markdown only)" }
14 | // Android platform only supports Markdown for now
15 | // Markdown parser is already registered in DocumentRegistry init block
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/compiler/exec/BrowseInsCommand.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.language.compiler.exec
2 |
3 | import cc.unitmesh.devti.agent.tool.browse.Browse
4 | import cc.unitmesh.devti.command.InsCommand
5 | import cc.unitmesh.devti.command.dataprovider.BuiltinCommand
6 | import com.intellij.openapi.project.Project
7 |
8 | class BrowseInsCommand(val myProject: Project, private val prop: String) : InsCommand {
9 | override val commandName: BuiltinCommand = BuiltinCommand.BROWSE
10 |
11 | override suspend fun execute(): String? {
12 | val parse = Browse.parse(prop)
13 | return parse.body
14 | }
15 | }
16 |
17 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/run/DevInsProcessHandler.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.language.run
2 |
3 | import com.intellij.build.process.BuildProcessHandler
4 | import java.io.OutputStream
5 |
6 | class DevInsProcessHandler(private val myExecutionName: String) : BuildProcessHandler() {
7 | override fun detachIsDefault(): Boolean = false
8 | override fun destroyProcessImpl() = Unit
9 | override fun detachProcessImpl() = notifyProcessTerminated(0)
10 | fun exitWithError() = notifyProcessTerminated(-1)
11 |
12 | override fun getProcessInput(): OutputStream? = null
13 | override fun getExecutionName(): String = myExecutionName
14 | }
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-exts/nanodsl-lang/src/test/resources/testcases/03-counter-card.nanodsl:
--------------------------------------------------------------------------------
1 | component CounterCard:
2 | state:
3 | count: int = 1
4 | price: float = 99.0
5 |
6 | Card:
7 | padding: "lg"
8 | content:
9 | VStack:
10 | Text(content << f"Total: ${state.count * state.price}")
11 |
12 | HStack:
13 | Button("-"):
14 | on_click: state.count -= 1
15 |
16 | Input(value := state.count)
17 |
18 | Button("+"):
19 | on_click: state.count += 1
20 |
21 |
--------------------------------------------------------------------------------
/mpp-ui/src/iosMain/kotlin/cc/unitmesh/devins/ui/platform/ClipboardImageReader.ios.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.ui.platform
2 |
3 | /**
4 | * iOS implementation of ClipboardImageReader.
5 | * TODO: Implement using UIPasteboard for image reading.
6 | */
7 | class IosClipboardImageReader : ClipboardImageReader {
8 | override fun hasImage(): Boolean {
9 | // TODO: Implement using UIPasteboard
10 | return false
11 | }
12 |
13 | override fun readImage(): ClipboardImageData? {
14 | // TODO: Implement using UIPasteboard
15 | return null
16 | }
17 | }
18 |
19 | actual fun createClipboardImageReader(): ClipboardImageReader = IosClipboardImageReader()
20 |
21 |
--------------------------------------------------------------------------------
/mpp-ui/src/jsMain/kotlin/cc/unitmesh/devins/ui/platform/ClipboardImageReader.js.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.ui.platform
2 |
3 | /**
4 | * JS implementation of ClipboardImageReader.
5 | * TODO: Implement using Clipboard API for image reading.
6 | */
7 | class JsClipboardImageReader : ClipboardImageReader {
8 | override fun hasImage(): Boolean {
9 | // TODO: Implement using Clipboard API
10 | return false
11 | }
12 |
13 | override fun readImage(): ClipboardImageData? {
14 | // TODO: Implement using Clipboard API
15 | return null
16 | }
17 | }
18 |
19 | actual fun createClipboardImageReader(): ClipboardImageReader = JsClipboardImageReader()
20 |
21 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/custom/variable/MethodInputOutputVariableResolver.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.custom.variable
2 |
3 | import cc.unitmesh.devti.context.MethodContextProvider
4 | import com.intellij.psi.PsiElement
5 |
6 | class MethodInputOutputVariableResolver(val element: PsiElement) : VariableResolver {
7 | override val type: CustomResolvedVariableType = CustomResolvedVariableType.METHOD_INPUT_OUTPUT
8 |
9 | override fun resolve(): String {
10 | val methodContext = MethodContextProvider(false, false).from(element)
11 | if (methodContext.name == null) return ""
12 |
13 | return methodContext.inputOutputString()
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/devins/provider/vcs/ShireGitCommit.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.devins.provider.vcs
2 |
3 | sealed class GitEntity
4 |
5 | // Base class for models containing commits
6 | sealed class CommitModel(
7 | open val count: Int,
8 | open val commits: List
9 | ) : GitEntity()
10 |
11 | data class ShireGitCommit(
12 | val hash: String,
13 | val authorName: String,
14 | val authorEmail: String,
15 | val authorDate: Long,
16 | val committerName: String,
17 | val committerEmail: String,
18 | val committerDate: Long,
19 | val message: String,
20 | val fullMessage: String
21 | ) : GitEntity()
22 |
23 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/statusbar/AutoDevStatus.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.statusbar
2 |
3 | import cc.unitmesh.devti.AutoDevIcons
4 | import javax.swing.Icon
5 |
6 | enum class AutoDevStatus {
7 | WAITING,
8 | Ready,
9 | InProgress,
10 | Error,
11 | Done;
12 |
13 | val icon: Icon
14 | get() {
15 | return when (this) {
16 | WAITING -> AutoDevIcons.DARK
17 | Ready -> AutoDevIcons.AI_COPILOT
18 | InProgress -> AutoDevIcons.LOADING
19 | Error -> AutoDevIcons.AUTODEV_ERROR
20 | Done -> AutoDevIcons.AI_COPILOT
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/mpp-ui/src/jsMain/kotlin/cc/unitmesh/devins/ui/compose/sketch/MermaidBlockRenderer.js.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.ui.compose.sketch
2 |
3 | import androidx.compose.runtime.Composable
4 | import androidx.compose.ui.graphics.Color
5 |
6 | /**
7 | * JS implementation of PlatformMermaidFullscreenDialog.
8 | * No-op for JS platform as it uses TypeScript/React for rendering.
9 | */
10 | @Composable
11 | actual fun PlatformMermaidFullscreenDialog(
12 | mermaidCode: String,
13 | isDarkTheme: Boolean,
14 | backgroundColor: Color,
15 | onDismiss: () -> Unit
16 | ) {
17 | // No-op for JS platform
18 | // The JS/TypeScript implementation handles Mermaid rendering separately
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/xiuper-ui/src/commonMain/kotlin/cc/unitmesh/xuiper/prompt/ResourceLoader.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.xuiper.prompt
2 |
3 | /**
4 | * Platform-specific resource loader for prompt templates.
5 | *
6 | * On JVM: Uses classloader to load resources from JAR/classpath
7 | * On WasmJs: Returns embedded resource strings or loads from network
8 | */
9 | expect object ResourceLoader {
10 | /**
11 | * Load a resource file as a string.
12 | *
13 | * @param path Resource path (e.g., "prompts/standard.txt")
14 | * @return Resource content as string
15 | * @throws IllegalStateException if resource cannot be loaded
16 | */
17 | fun loadResource(path: String): String
18 | }
19 |
20 |
--------------------------------------------------------------------------------
/mpp-core/src/commonMain/kotlin/cc/unitmesh/devins/llm/SessionStorage.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.llm
2 |
3 | /**
4 | * Session 存储接口
5 | * 使用 expect/actual 模式实现跨平台文件 I/O
6 | *
7 | * 存储位置:~/.autodev/sessions/chat-sessions.json
8 | */
9 | expect object SessionStorage {
10 | /**
11 | * 加载所有本地 sessions
12 | */
13 | suspend fun loadSessions(): List
14 |
15 | /**
16 | * 保存所有本地 sessions
17 | */
18 | suspend fun saveSessions(sessions: List)
19 |
20 | /**
21 | * 获取存储路径
22 | */
23 | fun getStoragePath(): String
24 |
25 | /**
26 | * 检查存储文件是否存在
27 | */
28 | suspend fun exists(): Boolean
29 | }
30 |
31 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/provider/http/HttpClientProvider.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.provider.http
2 |
3 | import com.intellij.openapi.extensions.ExtensionPointName
4 | import com.intellij.openapi.project.Project
5 | import com.intellij.openapi.vfs.VirtualFile
6 |
7 | interface HttpClientProvider {
8 | fun execute(project: Project, virtualFile: VirtualFile, text: String)
9 |
10 | companion object {
11 | private val EP_NAME: ExtensionPointName =
12 | ExtensionPointName("cc.unitmesh.httpClientExecutor")
13 |
14 | fun all(): List {
15 | return EP_NAME.extensionList
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-lang/javascript/src/main/kotlin/cc/unitmesh/ide/javascript/util/JsUtil.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.ide.javascript.util
2 |
3 | import com.intellij.javascript.testing.JSTestRunnerManager
4 | import com.intellij.openapi.application.runReadAction
5 | import com.intellij.psi.PsiFile
6 |
7 | object JsUtil {
8 | fun guessTestFrameworkName(file: PsiFile): String? {
9 | val findPackageDependentProducers =
10 | runReadAction { JSTestRunnerManager.getInstance().findPackageDependentProducers(file) }
11 |
12 | val testRunConfigurationProducer = findPackageDependentProducers.firstOrNull()
13 | return testRunConfigurationProducer?.configurationType?.displayName
14 | }
15 | }
--------------------------------------------------------------------------------
/mpp-server/src/main/kotlin/cc/unitmesh/server/ServerApplication.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.server
2 |
3 | import cc.unitmesh.server.config.ServerConfig
4 | import cc.unitmesh.server.plugins.*
5 | import io.ktor.server.application.*
6 | import io.ktor.server.engine.*
7 | import io.ktor.server.netty.*
8 |
9 | fun main() {
10 | val config = ServerConfig.load()
11 |
12 | embeddedServer(
13 | Netty,
14 | port = config.port,
15 | host = config.host,
16 | module = Application::module
17 | ).start(wait = true)
18 | }
19 |
20 | fun Application.module() {
21 | configureSerialization()
22 | configureCORS()
23 | configureSSE()
24 | configureRouting()
25 | }
26 |
27 |
--------------------------------------------------------------------------------
/xiuper-ui/src/commonMain/kotlin/cc/unitmesh/xuiper/render/theme/NanoThemeFamily.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.xuiper.render.theme
2 |
3 | import kotlinx.serialization.SerialName
4 | import kotlinx.serialization.Serializable
5 |
6 | /**
7 | * Platform-independent theme family identifier.
8 | *
9 | * Used to select between built-in themes or custom seed-based themes.
10 | * Platform implementations (Compose, Jewel, etc.) map these to their specific color systems.
11 | */
12 | @Serializable
13 | enum class NanoThemeFamily {
14 | @SerialName("bank_black_gold")
15 | BANK_BLACK_GOLD,
16 |
17 | @SerialName("travel_airbnb")
18 | TRAVEL_AIRBNB,
19 |
20 | @SerialName("custom")
21 | CUSTOM
22 | }
23 |
--------------------------------------------------------------------------------
/xiuper-ui/src/main/resources/prompts/examples/product-card.nanodsl:
--------------------------------------------------------------------------------
1 | component ProductCard(item: Product):
2 | padding: "md"
3 | shadow: "sm"
4 |
5 | content:
6 | VStack(spacing="sm"):
7 | Image(src=item.image, aspect=16/9, radius="md")
8 |
9 | HStack(align="center", justify="between"):
10 | Text(item.title, style="h3")
11 | if item.is_new:
12 | Badge("New", color="green")
13 |
14 | Text(item.description, style="body", limit=2)
15 |
16 | HStack(spacing="sm"):
17 | Text(f"${item.price}", style="h3")
18 | Button("Add to Cart", intent="primary", icon="cart")
19 |
20 |
--------------------------------------------------------------------------------
/mpp-ui/src/wasmJsMain/kotlin/cc/unitmesh/devins/ui/platform/ClipboardImageReader.wasmJs.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.ui.platform
2 |
3 | /**
4 | * WASM JS implementation of ClipboardImageReader.
5 | * TODO: Implement using Clipboard API for image reading.
6 | */
7 | class WasmJsClipboardImageReader : ClipboardImageReader {
8 | override fun hasImage(): Boolean {
9 | // TODO: Implement using Clipboard API
10 | return false
11 | }
12 |
13 | override fun readImage(): ClipboardImageData? {
14 | // TODO: Implement using Clipboard API
15 | return null
16 | }
17 | }
18 |
19 | actual fun createClipboardImageReader(): ClipboardImageReader = WasmJsClipboardImageReader()
20 |
21 |
--------------------------------------------------------------------------------
/xiuper-ui/src/commonMain/resources/prompts/examples/product-card.nanodsl:
--------------------------------------------------------------------------------
1 | component ProductCard(item: Product):
2 | padding: "md"
3 | shadow: "sm"
4 |
5 | content:
6 | VStack(spacing="sm"):
7 | Image(src=item.image, aspect=16/9, radius="md")
8 |
9 | HStack(align="center", justify="between"):
10 | Text(item.title, style="h3")
11 | if item.is_new:
12 | Badge("New", color="green")
13 |
14 | Text(item.description, style="body", limit=2)
15 |
16 | HStack(spacing="sm"):
17 | Text(f"${item.price}", style="h3")
18 | Button("Add to Cart", intent="primary", icon="cart")
19 |
20 |
--------------------------------------------------------------------------------
/mpp-core/src/jsMain/kotlin/cc/unitmesh/agent/logging/PlatformLogging.js.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.agent.logging
2 |
3 | /**
4 | * JavaScript implementation of platform-specific logging initialization
5 | * JS uses console logging, no file storage needed
6 | */
7 | actual fun initializePlatformLogging(config: LoggingConfig) {
8 | // JavaScript platform uses console logging by default
9 | // No additional configuration needed
10 | }
11 |
12 | /**
13 | * JavaScript implementation of platform-specific log directory
14 | * JS doesn't support file logging, return a placeholder
15 | */
16 | actual fun getPlatformLogDirectory(): String {
17 | return "console-only" // JS platform doesn't support file logging
18 | }
19 |
--------------------------------------------------------------------------------
/mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/tool/impl/http/HttpFetcherFactory.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.agent.tool.impl.http
2 |
3 | import cc.unitmesh.agent.tool.impl.HttpFetcher
4 |
5 | /**
6 | * Platform-specific HttpFetcher factory
7 | *
8 | * This factory creates the appropriate HttpFetcher implementation for each platform:
9 | * - JVM/Android: KtorHttpFetcher with CIO engine
10 | * - JS: NodeFetchHttpFetcher (bypasses Ktor's limitations in Node.js)
11 | */
12 | expect object HttpFetcherFactory {
13 | /**
14 | * Create a platform-appropriate HttpFetcher instance
15 | *
16 | * @return HttpFetcher configured for the current platform
17 | */
18 | fun create(): HttpFetcher
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/mpp-ui/src/commonMain/kotlin/cc/unitmesh/devins/ui/compose/agent/PlatformCodingAgentFactory.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.ui.compose.agent
2 |
3 | import cc.unitmesh.agent.CodingAgent
4 | import cc.unitmesh.agent.config.McpToolConfigService
5 | import cc.unitmesh.agent.render.CodingAgentRenderer
6 | import cc.unitmesh.llm.KoogLLMService
7 |
8 | /**
9 | * Platform-specific factory for creating CodingAgent instances
10 | * with platform-specific file system implementations
11 | */
12 | expect fun createPlatformCodingAgent(
13 | projectPath: String,
14 | llmService: KoogLLMService,
15 | maxIterations: Int,
16 | renderer: CodingAgentRenderer,
17 | mcpToolConfigService: McpToolConfigService
18 | ): CodingAgent
19 |
--------------------------------------------------------------------------------
/mpp-ui/src/jsMain/kotlin/cc/unitmesh/devins/ui/compose/sketch/ScreenshotUtils.js.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.ui.compose.sketch
2 |
3 | import androidx.compose.ui.graphics.ImageBitmap
4 |
5 | /**
6 | * JS implementation of encodeImageBitmapToPng.
7 | * Note: JS platform has limited support for image encoding.
8 | * Returns null as screenshot is not fully supported on JS platform.
9 | */
10 | actual fun encodeImageBitmapToPng(imageBitmap: ImageBitmap): ByteArray? {
11 | // JS platform does not have direct access to Skia or native image encoding
12 | // Screenshot functionality is limited on this platform
13 | println("[ScreenshotUtils] Screenshot not supported on JS platform")
14 | return null
15 | }
16 |
17 |
--------------------------------------------------------------------------------
/render.yaml:
--------------------------------------------------------------------------------
1 | services:
2 | - type: web
3 | name: mpp-server
4 | runtime: docker
5 | dockerfilePath: ./mpp-server/Dockerfile
6 | dockerContext: .
7 | region: singapore
8 | plan: free
9 | numInstances: 1
10 | healthCheckPath: /health
11 | envVars:
12 | - key: SERVER_PORT
13 | value: 8080
14 | - key: SERVER_HOST
15 | value: 0.0.0.0
16 | - key: OPENAI_API_KEY
17 | sync: false # 需要在 Render Dashboard 手动设置
18 | - key: LOG_LEVEL
19 | value: INFO
20 | buildFilter:
21 | paths:
22 | - mpp-server/**
23 | - mpp-core/**
24 | - build.gradle.kts
25 | - settings.gradle.kts
26 | - gradle.properties
27 |
28 |
--------------------------------------------------------------------------------
/xiuper-fs/src/androidMain/kotlin/cc/unitmesh/xiuper/fs/db/DatabaseDriverFactory.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.xiuper.fs.db
2 |
3 | import android.content.Context
4 | import app.cash.sqldelight.db.SqlDriver
5 | import app.cash.sqldelight.driver.android.AndroidSqliteDriver
6 |
7 | actual class DatabaseDriverFactory {
8 | private var context: Context? = null
9 |
10 | fun init(context: Context) {
11 | this.context = context
12 | }
13 |
14 | actual fun createDriver(): SqlDriver {
15 | val context = requireNotNull(context) { "DatabaseDriverFactory.init(context) must be called before createDriver()" }
16 | return AndroidSqliteDriver(XiuperFsDatabase.Schema, context, "xiuper-fs.db")
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/example/prompt/copilot/completion/java-code.md:
--------------------------------------------------------------------------------
1 | Q:
2 | ```java
3 | public void foo() {
4 | int x = 42 + 42;
5 | System.out.println(x);
6 | // TODO: write me gcd algorithm here
7 | // end of the code completion
8 | return x + x;
9 | }
10 | ```
11 | A:
12 | ```java
13 | public void foo() {
14 | int x = 42 + 42;
15 | System.out.println(x);
16 | // TODO: write me gcd algorithm here
17 | int a = 42;
18 | int b = 42;
19 |
20 | while (b != 0) {
21 | int temp = b;
22 | b = a % b;
23 | a = temp;
24 | }
25 |
26 | int gcd = a;
27 | System.out.println("The GCD is: " + gcd);
28 | // end of the code completion
29 | return x + x;
30 | }
31 | ```
32 | Q:
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/AutoDevSnippetFile.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti
2 |
3 | import com.intellij.openapi.vfs.VirtualFile
4 | import com.intellij.testFramework.LightVirtualFile
5 |
6 | object AutoDevSnippetFile {
7 | const val AUTODEV_SNIPPET_NAME = "autodev-snippet-"
8 |
9 | fun isSnippet(file: VirtualFile): Boolean {
10 | if (file !is LightVirtualFile) return false
11 | return file.name.startsWith("autodev-snippet-") || file.name.startsWith("DevIn-") || file.name.startsWith("devIn-")
12 | }
13 |
14 | fun naming(extension: String): String {
15 | val time = System.currentTimeMillis()
16 | return "$AUTODEV_SNIPPET_NAME$time.$extension"
17 | }
18 | }
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-exts/ext-database/README.md:
--------------------------------------------------------------------------------
1 | # Database Extensions
2 |
3 | Doc: [https://plugins.jetbrains.com/docs/intellij/data-grip-extension-point-list.html](https://plugins.jetbrains.com/docs/intellij/data-grip-extension-point-list.html)
4 |
5 | This directory contains extensions that are specific to a database.
6 |
7 | - Generate SQL DDL for a database from a schema
8 |
9 | Or others?
10 |
11 | ## 自然语言 SQL 生成
12 |
13 | 根据数据库表生成 JPA 、 MyBatis 、 Spring Data JDBC 等代码。
14 |
15 | ## Usecases: PL/SQL to Java
16 |
17 | 1. Generate Repository from PL/SQL code
18 | 2. Generate Entity from PL/SQL code
19 | 3. Generate Service from PL/SQL code
20 | - Create test cases for the service
21 | 4. Generate Java code from PL/SQL code
22 |
--------------------------------------------------------------------------------
/mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/tool/impl/http/HttpClientFactory.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.agent.tool.impl.http
2 |
3 | import io.ktor.client.*
4 |
5 | /**
6 | * Platform-specific HttpClient factory using expect/actual pattern
7 | *
8 | * Each platform provides its own optimal HTTP client engine:
9 | * - JVM: CIO engine (fully asynchronous, coroutine-based)
10 | * - JS: JS engine (uses fetch API)
11 | * - Native: Platform-specific engines (Darwin, Curl, WinHttp)
12 | */
13 | expect object HttpClientFactory {
14 | /**
15 | * Create a platform-specific HttpClient instance
16 | *
17 | * @return HttpClient configured for the current platform
18 | */
19 | fun create(): HttpClient
20 | }
21 |
22 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/kotlin/cc/unitmesh/devti/bridge/archview/model/UiComponent.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.bridge.archview.model
2 |
3 | import kotlinx.serialization.Serializable
4 |
5 | @Serializable
6 | data class UiComponent(
7 | val name: String,
8 | val path: String,
9 | val signature: String = "",
10 | val props: List = emptyList(),
11 | val methods: List = emptyList(),
12 | val slots: List = emptyList(),
13 | ) {
14 | fun format(): String {
15 | return """
16 | |<$name/>, path: $path
17 | |props: $props
18 | |methods: $methods
19 | """.trimMargin()
20 | }
21 |
22 | fun simple(): String = "<$name/>, $path"
23 | }
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-core/src/main/resources/icons/check.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/mpp-ui/src/androidMain/kotlin/cc/unitmesh/devins/ui/platform/ClipboardImageReader.android.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.ui.platform
2 |
3 | /**
4 | * Android implementation of ClipboardImageReader.
5 | * TODO: Implement using Android ClipboardManager for image reading.
6 | */
7 | class AndroidClipboardImageReader : ClipboardImageReader {
8 | override fun hasImage(): Boolean {
9 | // TODO: Implement using ClipboardManager
10 | return false
11 | }
12 |
13 | override fun readImage(): ClipboardImageData? {
14 | // TODO: Implement using ClipboardManager
15 | return null
16 | }
17 | }
18 |
19 | actual fun createClipboardImageReader(): ClipboardImageReader = AndroidClipboardImageReader()
20 |
21 |
--------------------------------------------------------------------------------
/xiuper-ui/testcases/expect/02-product-card.nanodsl:
--------------------------------------------------------------------------------
1 | component ProductCard(item: Product):
2 | padding: "md"
3 | shadow: "sm"
4 |
5 | content:
6 | VStack(spacing="sm"):
7 | Image(src=item.image, aspect=16/9, radius="md")
8 |
9 | HStack(align="center", justify="between"):
10 | Text(item.title, style="h3")
11 | if item.is_new:
12 | Badge("New", color="green")
13 |
14 | Text(item.description, style="body", limit=2)
15 |
16 | HStack(spacing="sm"):
17 | Text(f"${item.price}", style="h3")
18 | Button("Add to Cart", intent="primary", icon="cart")
19 |
20 |
--------------------------------------------------------------------------------
/mpp-core/src/wasmJsMain/kotlin/cc/unitmesh/agent/logging/PlatformLogging.wasmJs.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.agent.logging
2 |
3 | /**
4 | * WebAssembly implementation of platform-specific logging initialization
5 | * WASM uses console logging, no file storage available
6 | */
7 | actual fun initializePlatformLogging(config: LoggingConfig) {
8 | // WebAssembly platform uses console logging by default
9 | // No additional configuration needed
10 | }
11 |
12 | /**
13 | * WebAssembly implementation of platform-specific log directory
14 | * WASM doesn't support file logging, return a placeholder
15 | */
16 | actual fun getPlatformLogDirectory(): String {
17 | return "console-only" // WASM platform doesn't support file logging
18 | }
19 |
--------------------------------------------------------------------------------
/mpp-idea/mpp-idea-exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/ast/shireql/variable/frontend/Component.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devti.language.ast.shireql.variable.frontend
2 |
3 | import kotlinx.serialization.Serializable
4 |
5 | /**
6 | * the Design System Component
7 | */
8 | @Serializable
9 | data class Component(
10 | val name: String,
11 | val path: String,
12 | val signature: String = "",
13 | val props: List = emptyList(),
14 | ) {
15 | fun format(): String {
16 | return """
17 | |component name: $name
18 | |component path: $path
19 | |input signature: $signature
20 | |component props: $props
21 | """.trimMargin()
22 | }
23 | }
--------------------------------------------------------------------------------
/mpp-ui/src/commonMain/kotlin/cc/unitmesh/devins/ui/compose/editor/model/EditorModels.kt:
--------------------------------------------------------------------------------
1 | package cc.unitmesh.devins.ui.compose.editor.model
2 |
3 | import androidx.compose.ui.graphics.Color
4 | import androidx.compose.ui.text.SpanStyle
5 |
6 | /**
7 | * 语法高亮样式
8 | * 这是 UI 层特定的类型,保留在此处
9 | */
10 | data class HighlightStyle(
11 | val color: Color,
12 | val bold: Boolean = false,
13 | val italic: Boolean = false
14 | ) {
15 | fun toSpanStyle(): SpanStyle =
16 | SpanStyle(
17 | color = color,
18 | fontWeight = if (bold) androidx.compose.ui.text.font.FontWeight.Bold else null,
19 | fontStyle = if (italic) androidx.compose.ui.text.font.FontStyle.Italic else null
20 | )
21 | }
22 |
--------------------------------------------------------------------------------