docs(partnerctl-support): add KDoc for source build spec and external module manifest models

This commit is contained in:
2026-05-04 17:47:20 +08:00
parent 97bf0618f4
commit 0fdc0038a5
2 changed files with 49 additions and 0 deletions

View File

@@ -15,12 +15,27 @@ fun loadExternalModule(): Set<ModuleManifest> {
return loadModules().filter { !it.withGateway }.toSet() return loadModules().filter { !it.withGateway }.toSet()
} }
/**
* External module manifest loaded from the module registry.
*
* This type models the JSON contract of a registry entry. Paths are stored as strings here because
* manifests are external JSON documents. Runtime code should convert path-like fields to [java.nio.file.Path]
* only when building execution specs.
*/
@Serializable @Serializable
data class ModuleManifest( data class ModuleManifest(
/** Stable module id. Also used as gateway channel name for gateway modules. */
val id: String, val id: String,
/** Human-readable module name. */
val name: String, val name: String,
/** Whether this module can provide a gateway channel. */
val withGateway: Boolean, val withGateway: Boolean,
/** Human-readable module description shown before installation. */
val description: String = "", val description: String = "",
val source: Source, val source: Source,
val install: Install, val install: Install,
val config: Config? = null, val config: Config? = null,
@@ -28,21 +43,34 @@ data class ModuleManifest(
@Serializable @Serializable
data class Source( data class Source(
/** Git repository URL used as the module source. */
val url: String, val url: String,
/** Directory name for the cloned repository under the temporary build directory. */
val sourceDirName: String, val sourceDirName: String,
/** Build command executed with the cloned source root as working directory. */
val buildCommand: List<String>, val buildCommand: List<String>,
/** Directory containing build artifacts, relative to the cloned source root. */
val artifactDirectory: String, val artifactDirectory: String,
/** Glob pattern used inside [artifactDirectory] to select the artifact to install. */
val artifactPattern: String, val artifactPattern: String,
) )
@Serializable @Serializable
data class Install( data class Install(
/** Install target path, relative to Partner home. */
val target: String, val target: String,
) )
@Serializable @Serializable
data class Config( data class Config(
/** Config file target path, relative to Partner home. */
val target: String, val target: String,
/** Interactive fields used to generate the module config object. */
val fields: List<Field> = emptyList(), val fields: List<Field> = emptyList(),
) )

View File

@@ -5,13 +5,34 @@ import java.nio.file.Files
import java.nio.file.Path import java.nio.file.Path
import java.nio.file.StandardCopyOption import java.nio.file.StandardCopyOption
/**
* Runtime specification for building a JVM/Maven project from source and installing one built artifact.
*
* Path semantics:
* - [sourceDirName] is the child directory name created under a temporary build directory.
* - [artifactDirectory] is resolved relative to the cloned source root: tempDir/sourceDirName/artifactDirectory.
* - [installRelativePath] is resolved relative to Partner home: home/installRelativePath.
*/
data class SourceBuildInstallSpec( data class SourceBuildInstallSpec(
/** Display name used in prompt messages. */
val displayName: String, val displayName: String,
/** Git repository URL used by `git clone --depth 1`. */
val repoUrl: String, val repoUrl: String,
/** Directory name for the cloned repository under the temporary build directory. */
val sourceDirName: String, val sourceDirName: String,
/** Build command executed with the cloned source root as working directory. */
val buildCommand: List<String>, val buildCommand: List<String>,
/** Directory containing build artifacts, relative to the cloned source root. */
val artifactDirectory: Path, val artifactDirectory: Path,
/** Selects the artifact to install from the resolved artifact directory. */
val artifactSelector: (Path) -> Path?, val artifactSelector: (Path) -> Path?,
/** Install target path, relative to Partner home. */
val installRelativePath: Path, val installRelativePath: Path,
) )