AutoDev Xiuper Documentation

repository·master·Indexed 26 days ago

https://github.com/phodal/auto-dev

An AI-native, multi-agent development platform built on Kotlin Multiplatform. It features specialized agents for coding, research, and artifact generation, including the @xiuper/cli terminal UI. The platform includes MPP CodeGraph for multi-platform code parsing (Java, JS, TS, Python), the DevIns language for AI agent behavior definition, and extensions for database, Android, and HarmonyOS development. Supports deployment across JVM, JS, WASM, and iOS.

Tokens
38.7K
Snippets
97
Records
240
Agent score
89%

What's inside AutoDev Xiuper

  1. Overview of AutoDev Xiuper Agents

    master

    AutoDev Xiuper uses a multi-agent architecture with several specialized top-level agents:

    AgentAreaDescription
    DocumentAgentRequirements / ResearchQuerying documents and generating feature trees.
    CodingAgentDevelopmentWorkspace tools, orchestration, file system, shell, and MCP.
    CodeReviewAgentCode ReviewReviewing code, lint summaries, and generating fixes.
    ChatDBAgentDataNatural-language database interaction via schema linking and SQL generation.
    ArtifactAgentRapid PrototypingGenerating self-contained runnable outputs (HTML, React, Node.js, Python, SVG, Mermaid).
    Web Agent / WebEditWeb InteractionPage inspection and DOM context (Experimental).
  2. Overview of DevIns Lang

    master
    DevIns Lang (Development Intelligence Language) is a specialized language used to define and enhance the behavior of AutoDev AI Agents. It allows developers to craft intricate instructions and segment complex AI tasks into smaller, manageable instructions defined within markdown files. This enables the AI Agent to execute complex workflows with higher intelligence and efficiency.
  3. Use Database Extensions for SQL and Code Generation

    master

    The ext-database directory provides extensions designed for database-specific tasks. Key capabilities include:

    • SQL DDL Generation: Generate SQL Data Definition Language (DDL) for a specific database based on an existing schema.
    • Natural Language SQL Generation: Generate data access code such as JPA, MyBatis, or Spring Data JDBC directly from database tables.
    • PL/SQL to Java Conversion: Automate the migration or translation of PL/SQL logic into Java code. This includes:
      • Generating Repository classes from PL/SQL.
      • Generating Entity classes from PL/SQL.
      • Generating Service classes from PL/SQL (including the creation of corresponding test cases).
      • General generation of Java code from PL/SQL logic.
  4. mpp-viewer Core API components

    master

    The mpp-viewer module provides the following core components for platform-agnostic content display:

    • ViewerType: Enumeration of supported content types.
    • ViewerRequest: Data class used to encapsulate content display requests.
    • ViewerHost: Interface that must be implemented by a platform-specific module to handle the actual rendering.
    • LanguageDetector: Utility for detecting programming languages from file paths.
  5. Available AutoDev advanced Extensions

    master

    The mpp-idea-exts directory contains advanced extensions that provide GenAI-powered capabilities for specific domains. Available extensions include:

    • Database: Build SQL, Oracle, or MySQL databases with GenAI ability.
    • Android: Build Android applications with GenAI ability.
    • HarmonyOS: Build HarmonyOS applications with GenAI ability.
    • Terminal: Integration with the terminal with GenAI ability.
    • HttpClient: Provides HTTP API testing capabilities.
    • DevIns: Build using the DevIns language with GenAI ability.
  6. mpp-viewer-web Architecture and Components

    master

    The mpp-viewer-web implementation consists of three main architectural components:

    • WebViewerHost: An implementation of the ViewerHost interface that facilitates communication with the WebView via JavaScript.
    • ViewerWebView: A Composable WebView component used for displaying content.
    • viewer.html: An embedded HTML file containing the Monaco Editor, enabling offline-capable viewing.

    Supported content types include code, markdown, and images.

  7. Quickstart: Build and Run MPP-Server

    master

    To get the mpp-server up and running, use the Gradle wrapper. You can also configure the server using environment variables like OPENAI_API_KEY and SERVER_PORT.

    Build the project

    ./gradlew :mpp-server:build

    Run the server

    ./gradlew :mpp-server:run

    Or with environment variables:

    export OPENAI_API_KEY="sk-..."
    export SERVER_PORT=8080
    ./gradlew :mpp-server:run
  8. Initialize and upgrade the XiuperFS database

    master

    When initializing the database, follow this logic to handle different schema states:

    1. Fresh Database (user_version == 0): Call XiuperFsDatabase.Schema.create(driver) to create the latest schema directly, then set the user_version to the target version.
    2. Existing Database (currentVersion < targetVersion): Use MigrationRegistry.path(currentVersion, targetVersion) to retrieve the required migration chain. Iterate through the list and call .migrate(driver) on each. If successful, update the user_version to the target version.
    3. Newer Database (currentVersion > targetVersion): Throw an IllegalStateException as the application code is older than the database schema.
    4. Up-to-date (currentVersion == targetVersion): No action required.
    fun createDatabase(driverFactory: DatabaseDriverFactory): XiuperFsDatabase {
        val driver = driverFactory.createDriver()
        
        val currentVersion = getUserVersion(driver)
        val targetVersion = XiuperFsDatabase.Schema.version.toInt()
        
        when {
            currentVersion == 0 -> {
                // Fresh DB: create latest schema directly
                XiuperFsDatabase.Schema.create(driver)
                setUserVersion(driver, targetVersion)
            }
            currentVersion < targetVersion -> {
                // Existing DB: apply migrations
                val migrations = MigrationRegistry.path(currentVersion, targetVersion)
                for (migration in migrations) {
                    try {
                        migration.migrate(driver)
                    } catch (e: Exception) {
                        throw IllegalStateException(
                            "Migration failed: ${migration.description} ($currentVersion → ${migration.toVersion})",
                            e
                        )
                    }
                }
                setUserVersion(driver, targetVersion)
            }
            currentVersion > targetVersion -> {
                // Future DB opened by older code: error or warn
                throw IllegalStateException(
                    "Database version $currentVersion is newer than supported $targetVersion. " +
                    "Please upgrade the application."
                )
            }
            else -> {
                // Already up-to-date
            }
        }
        
        return XiuperFsDatabase(driver)
    }
  9. Update the AutoDev VSCode Extension

    master

    Follow these steps to release a new version of the extension:

    1. Update the version in gradle.properties.
    2. Build and publish mpp-core if changes were made to the core logic.
    3. Update the dependency versions in mpp-vscode/package.json.
    4. Run the build process: npm run build.
    5. Package the extension: vsce package.
    6. Publish the new version: vsce publish or via manual web upload.
  10. Build and run the AutoDev iOS app

    master

    The fastest way to build and run the AutoDev iOS app is using the provided shell script in the mpp-ios directory. This script automates compiling Kotlin Frameworks (mpp-core and mpp-ui), installing CocoaPods dependencies, and resolving Swift Package Manager dependencies (MCP SDK).

    Quickstart commands:

    • Build the .app file: ./build-ios-app.sh --build
    • Build and run on a simulator: ./build-ios-app.sh --run

    Successful builds generate the .app file at: mpp-ios/build/Build/Products/Debug-iphonesimulator/AutoDevApp.app

    cd mpp-ios
    ./build-ios-app.sh --build    # 构建 .app 文件
    ./build-ios-app.sh --run      # 构建并运行到模拟器
  11. Migrate from CommandCompletionProvider to ToolBasedCommandCompletionProvider

    master

    When upgrading from the legacy hard-coded command system to the dynamic tool-based system:

    1. Replace the provider instance: Change CommandCompletionProvider() to ToolBasedCommandCompletionProvider().
    2. Update dependencies: Ensure your project includes the necessary Tool system dependencies.
    3. Verify the migration: Run the full test suite to ensure compatibility.

    Verification Command:

    ./gradlew :mpp-core:allTests