Skip to content

Commit e1d80e4

Browse files
feat(Common/SCM): Add DTO for SCM provider creation
Added the `SourceControlCreateDTO` struct in the Common crate to define the data transfer contract for creating new Source Control providers. This DTO: 1. Implements serialization/deserialization using Serde with PascalCase naming 2. Contains fields for provider ID, label, and repository root URI 3. Uses a custom `URLSerializationHelper` for proper URI handling This DTO enables communication between the Cocoon extension host and Mountain backend when extensions call `vscode.scm.createSourceControl`, directly supporting the SCM workflow implementation. The RootUri field alignment with VS Code's API ensures compatibility with existing extensions while maintaining type safety through the Vine gRPC layer. Refs #347db1e
1 parent 347db1e commit e1d80e4

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//! # SourceControlCreateDTO
2+
//!
3+
//! Defines the DTO for creating a new Source Control provider.
4+
5+
use serde::{Deserialize, Serialize};
6+
use url::Url;
7+
8+
use crate::Utility::Serialization::URLSerializationHelper;
9+
10+
/// A serializable struct sent from the extension host (`Cocoon`) to the main
11+
/// host (`Mountain`) when an extension calls `vscode.scm.createSourceControl`.
12+
#[derive(Serialize, Deserialize, Debug, Clone)]
13+
#[serde(rename_all = "PascalCase")]
14+
pub struct SourceControlCreateDTO {
15+
/// The unique identifier for this source control provider.
16+
pub ID:String,
17+
/// The human-readable label for this provider (e.g., "Git").
18+
pub Label:String,
19+
/// The root URI of the repository this provider is managing.
20+
#[serde(with = "URLSerializationHelper")]
21+
pub RootUri:Url,
22+
}

0 commit comments

Comments
 (0)