Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ serde = "1"
serde_json = "1.0.82"
serde_repr = "0.1"
sha2 = "0.10"
smbcloud-auth = { version = "1.1.0", path = "crates/smbcloud-auth" }
smbcloud-auth-sdk = { version = "1.1.0", path = "crates/smbcloud-auth-sdk" }
smbcloud-deploy = { version = "1.1.0", path = "crates/smbcloud-deploy" }
smbcloud-email-sdk = { version = "1.1.0", path = "crates/smbcloud-email-sdk" }
smbcloud-gresiq-sdk = { version = "1.1.0", path = "crates/smbcloud-gresiq-sdk" }
smbcloud-mail = { version = "1.1.0", path = "crates/smbcloud-mail" }
smbcloud-model = { version = "1.1.0", path = "crates/smbcloud-model" }
smbcloud-network = { version = "1.1.0", path = "crates/smbcloud-network" }
smbcloud-networking = { version = "1.1.0", path = "crates/smbcloud-networking" }
smbcloud-networking-project = { version = "1.1.0", path = "crates/smbcloud-networking-project" }
smbcloud-utils = { version = "1.1.0", path = "crates/smbcloud-utils" }
smbcloud-auth = { version = "1.1.1", path = "crates/smbcloud-auth" }
smbcloud-auth-sdk = { version = "1.1.1", path = "crates/smbcloud-auth-sdk" }
smbcloud-deploy = { version = "1.1.1", path = "crates/smbcloud-deploy" }
smbcloud-email-sdk = { version = "1.1.1", path = "crates/smbcloud-email-sdk" }
smbcloud-gresiq-sdk = { version = "1.1.1", path = "crates/smbcloud-gresiq-sdk" }
smbcloud-mail = { version = "1.1.1", path = "crates/smbcloud-mail" }
smbcloud-model = { version = "1.1.1", path = "crates/smbcloud-model" }
smbcloud-network = { version = "1.1.1", path = "crates/smbcloud-network" }
smbcloud-networking = { version = "1.1.1", path = "crates/smbcloud-networking" }
smbcloud-networking-project = { version = "1.1.1", path = "crates/smbcloud-networking-project" }
smbcloud-utils = { version = "1.1.1", path = "crates/smbcloud-utils" }
spinners = "4.1.0"
strum = "0.27"
strum_macros = "0.27"
Expand All @@ -59,4 +59,4 @@ uniffi = "0.31"
url-builder = "0.1.1"
wiremock = "0.6"
wasm-bindgen = "0.2"
xcrs = { version = "1.1.0", path = "crates/xcrs" }
xcrs = { version = "1.1.1", path = "crates/xcrs" }
2 changes: 1 addition & 1 deletion crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "smbcloud-cli"
version = "1.1.0"
version = "1.1.1"
edition = "2021"
authors = ["Seto Elkahfi <seto@smbcloud.xyz>"]
description = "smbCloud command line interface."
Expand Down
7 changes: 6 additions & 1 deletion crates/cli/src/cli/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use {
crate::{account, cloud_auth, mail, project, tenant},
crate::{account, cloud_auth, mail, project, run, tenant},
clap::{Parser, Subcommand, ValueEnum},
smbcloud_network::environment::Environment,
spinners::Spinner,
Expand Down Expand Up @@ -108,6 +108,11 @@ pub enum Commands {
#[clap(subcommand)]
command: project::cli::Commands,
},
#[clap(about = "Inspect and tag Run runners (admin only).")]
Run {
#[clap(subcommand)]
command: run::Commands,
},
#[clap(about = "Manage your tenants.")]
Tenant {
#[clap(subcommand)]
Expand Down
1 change: 1 addition & 0 deletions crates/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub mod interface;
pub mod mail;
pub mod mcp;
pub mod project;
pub mod run;
mod session_config;
pub mod tenant;
mod token;
Expand Down
2 changes: 2 additions & 0 deletions crates/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use {
},
mail::process::process_mail,
project::{crud_create::process_project_init, process::process_project},
run::process_run,
tenant::process::process_tenant,
},
smbcloud_network::environment::Environment,
Expand Down Expand Up @@ -207,6 +208,7 @@ async fn run(cli: Cli) -> Result<CommandResult> {
Some(Commands::Mail { command }) => process_mail(cli.environment, command).await,
Some(Commands::Auth { command }) => process_cloud_auth(cli.environment, command).await,
Some(Commands::Project { command }) => process_project(cli.environment, command).await,
Some(Commands::Run { command }) => process_run(cli.environment, command).await,
Some(Commands::Tenant { command }) => process_tenant(cli.environment, command).await,
Some(Commands::ControlKit { command }) => process_controlkit(command).await,
Some(Commands::Migrate {}) => process_migrate(cli.environment).await,
Expand Down
54 changes: 49 additions & 5 deletions crates/cli/src/mcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,16 @@ struct TenantUseArgs {
id: String,
}

#[derive(Debug, Deserialize, JsonSchema)]
struct RunRunnerTagsSetArgs {
/// The runner ID, from `run_runners_list`.
id: i64,
/// The complete tag list. It replaces the current one: lower-case letters,
/// digits and hyphens, at most 16. Executor tags the runner reports are
/// kept regardless.
tags: Vec<String>,
}

#[derive(Debug, Deserialize, JsonSchema)]
struct MailAppListArgs {
/// Restrict to mail apps under this project ID. Defaults to the
Expand Down Expand Up @@ -1116,6 +1126,37 @@ impl SmbMcpServer {
json_result(&tenant)
}

#[tool(
description = "List Run runners with status, tags, flags and active job count, as a \
JSON array. Requires an admin user."
)]
async fn run_runners_list(&self) -> Result<CallToolResult, ErrorData> {
let token = self.access_token()?;
let runners = crate::run::list_runners(self.environment, client(), token)
.await
.map_err(to_error_data)?;
json_result(&runners)
}

#[tool(
description = "Replace a Run runner's tags with the given list. Tags decide which \
jobs the runner claims, so any tag not in the list is removed. Read \
the current tags with `run_runners_list` first. Requires an admin \
user. Returns the updated runner as JSON.",
annotations(destructive_hint = true)
)]
async fn run_runner_tags_set(
&self,
Parameters(args): Parameters<RunRunnerTagsSetArgs>,
) -> Result<CallToolResult, ErrorData> {
let token = self.access_token()?;
let runner =
crate::run::set_runner_tags(self.environment, client(), token, args.id, args.tags)
.await
.map_err(to_error_data)?;
json_result(&runner)
}

#[tool(
description = "Delete an organization tenant by ID. This is destructive and \
irreversible — it cascades to every project, Auth app, and Mail \
Expand Down Expand Up @@ -1925,6 +1966,8 @@ mod tests {
"auth_app_new",
"auth_app_update",
"auth_app_delete",
"run_runners_list",
"run_runner_tags_set",
] {
assert!(
names.contains(&cloud_only),
Expand Down Expand Up @@ -2100,15 +2143,16 @@ mod tests {
fn delete_and_overwrite_tools_carry_destructive_hint() {
let tools = SmbMcpServer::cloud_tool_router().list_all();
let mut checked = 0;
for tool in tools
.iter()
.filter(|tool| tool.name.ends_with("_delete") || tool.name == "project_init")
{
for tool in tools.iter().filter(|tool| {
tool.name.ends_with("_delete")
|| tool.name == "project_init"
|| tool.name == "run_runner_tags_set"
}) {
let annotations = tool.annotations.as_ref().expect("annotations");
assert_eq!(annotations.destructive_hint, Some(true), "{}", tool.name);
checked += 1;
}
assert_eq!(checked, 6);
assert_eq!(checked, 7);
}

#[test]
Expand Down
Loading
Loading