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
25 changes: 1 addition & 24 deletions Cargo.lock

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

3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ members = [
"crates/hm-core",
"crates/hm-plugin-protocol",
"crates/hm-pipeline-ir",
"crates/hm-plugin-cloud",
"crates/hm-dsl-engine",
"crates/hm-render",
"crates/hm-vm",
Expand All @@ -17,7 +16,6 @@ default-members = [
"crates/hm-core",
"crates/hm-plugin-protocol",
"crates/hm-pipeline-ir",
"crates/hm-plugin-cloud",
"crates/hm-dsl-engine",
"crates/hm-render",
"crates/hm-vm",
Expand All @@ -31,7 +29,6 @@ repository = "https://github.com/harmont-dev/harmont-cli"
[workspace.dependencies]
hm-core = { path = "crates/hm-core", version = "0.0.0-dev" }
hm-plugin-protocol = { path = "crates/hm-plugin-protocol", version = "0.0.0-dev" }
hm-plugin-cloud = { path = "crates/hm-plugin-cloud", version = "0.0.0-dev" }
hm-pipeline-ir = { path = "crates/hm-pipeline-ir", version = "0.0.0-dev" }
hm-dsl-engine = { path = "crates/hm-dsl-engine", version = "0.0.0-dev" }
hm-render = { path = "crates/hm-render", version = "0.0.0-dev" }
Expand Down
2 changes: 1 addition & 1 deletion crates/hm-core/src/exec/cloud/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! Cloud execution backend (submit + watch over the SDK).
pub mod watch; // pub: hm-plugin-cloud's `build watch`/`job log` verbs reuse it
pub mod watch; // pub: the CLI's `cloud build watch`/`cloud job log` verbs reuse it

mod backend;
pub use backend::CloudBackend;
36 changes: 0 additions & 36 deletions crates/hm-plugin-cloud/Cargo.toml

This file was deleted.

4 changes: 2 additions & 2 deletions crates/hm-render/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Build-event renderers shared by the `hm` CLI and `hm-plugin-cloud`.
//! Build-event renderers shared across the `hm` CLI's local and cloud paths.
//!
//! This crate owns the output layer: the [`OutputRenderer`] trait, the
//! [`OutputMode`] selection enum, and the concrete renderers
Expand All @@ -15,7 +15,7 @@ use hm_plugin_protocol::BuildEvent;
/// the `NO_COLOR` env convention, and whether stderr is a TTY.
///
/// Single source of truth for the color rule, shared by the `hm` run
/// context and `hm-plugin-cloud`'s render preferences.
/// context and the cloud commands' render preferences.
#[must_use]
pub fn color_enabled(no_color_flag: bool) -> bool {
!no_color_flag && std::env::var_os("NO_COLOR").is_none() && std::io::stderr().is_terminal()
Expand Down
4 changes: 2 additions & 2 deletions crates/hm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ hm-pipeline-ir = { workspace = true }
hm-plugin-protocol = { workspace = true }
hm-common = { workspace = true }
hm-core = { workspace = true }
hm-plugin-cloud = { workspace = true }
harmont-cloud = { workspace = true }
harmont-cloud = { workspace = true }
harmont-cloud-raw = { workspace = true }
hm-vm = { workspace = true, features = ["docker-backend"] }
hm-dsl-engine = { workspace = true }
hm-render = { workspace = true }
Expand Down
3 changes: 1 addition & 2 deletions crates/hm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ hm run --help # full flag reference
## Cloud

`hm cloud <verb>` talks to the hosted Harmont API at `api.harmont.dev`.
Every cloud verb is delivered by the embedded `hm-plugin-cloud` crate
(no separate install step):
Every cloud verb is built into the `hm` binary (no separate install step):

```sh
hm cloud login # browser-loopback OAuth (or --paste to
Expand Down
4 changes: 2 additions & 2 deletions crates/hm/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub enum Command {

/// Interact with the Harmont cloud API.
#[command(subcommand)]
Cloud(hm_plugin_cloud::cli::CloudCommand),
Cloud(crate::commands::cloud::cli::CloudCommand),
}

#[derive(Debug, Clone, Subcommand)]
Expand Down Expand Up @@ -116,7 +116,7 @@ pub async fn dispatch(command: Command, ctx: RunContext<'_>) -> Result<i32> {
Command::Plugin(cmd) => plugin::run(cmd).await.map(|()| 0),
Command::Cloud(cmd) => {
let env = std::env::vars().collect();
hm_plugin_cloud::cli::dispatch_command(cmd, env, app).await
crate::commands::cloud::cli::dispatch_command(cmd, env, app).await
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use anyhow::{Result, bail};
use harmont_cloud::{HarmontClient, HarmontError};
use hm_core::app_ctx::AppCtx;

use crate::settings;
use crate::commands::cloud::settings;

pub(crate) async fn run(
env: &BTreeMap<String, String>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::collections::BTreeMap;
use anyhow::Result;
use hm_core::app_ctx::AppCtx;

use crate::settings;
use crate::commands::cloud::settings;

pub(crate) async fn run(_env: &BTreeMap<String, String>, app: &AppCtx) -> Result<()> {
let (client, _ctx) = settings::client(app).await?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use anyhow::Result;
use clap::Subcommand;
use hm_core::app_ctx::AppCtx;

use crate::{auth, verbs};
use crate::commands::cloud::{auth, verbs};

/// Process exit status for the cloud subcommands.
enum ExitCode {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
//! Cloud client library for the hm CLI.
//!
//! Implements `hm cloud {login,logout,whoami,org,pipeline,build,job,billing,run}`.
//! `hm cloud {login,logout,whoami,org,pipeline,build,job,billing,run}`.

pub mod cli;
pub mod settings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use std::collections::BTreeMap;
use anyhow::Result;
use harmont_cloud::HarmontClient;

use crate::cli::BillingCommand;
use crate::settings;
use crate::commands::cloud::cli::BillingCommand;
use crate::commands::cloud::settings;
use hm_core::app_ctx::AppCtx;

/// Convert an integer cent amount to dollars for display.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use std::collections::BTreeMap;
use anyhow::Result;
use harmont_cloud::HarmontClient;

use crate::cli::BuildCommand;
use crate::settings;
use crate::commands::cloud::cli::BuildCommand;
use crate::commands::cloud::settings;
use hm_core::app_ctx::AppCtx;
use hm_core::exec::cloud::watch::watch_build;

Expand Down Expand Up @@ -61,7 +61,7 @@ async fn watch(client: &HarmontClient, org: &str, pipe: &str, number: i64) -> Re
// Render the live build through the shared `hm-render` renderers (the same
// ones a local `hm run` uses), driven by the `BuildEvent`s `watch_build`
// emits over an mpsc channel.
let prefs = crate::settings::RenderPrefs::detect();
let prefs = crate::commands::cloud::settings::RenderPrefs::detect();
let renderer = hm_render::renderer_for("human", prefs.color, prefs.logs)?;
let (tx, rx) = tokio::sync::mpsc::channel(1024);
let driver = tokio::spawn(hm_render::drive(renderer, rx));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use hm_plugin_protocol::events::{BuildEvent, PlanSummary};
use hm_plugin_protocol::ir::DurationMs;
use uuid::Uuid;

use crate::cli::JobCommand;
use crate::settings;
use crate::commands::cloud::cli::JobCommand;
use crate::commands::cloud::settings;
use hm_core::app_ctx::AppCtx;
use hm_core::exec::cloud::watch::stream_job_logs_as_events;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use hm_core::app_ctx::AppCtx;
use hm_core::config::domain::BackendConfig;
use hm_core::config::user::UserCloudConfig;

use crate::cli::OrgCommand;
use crate::settings;
use crate::commands::cloud::cli::OrgCommand;
use crate::commands::cloud::settings;

pub(crate) async fn run(
_env: &BTreeMap<String, String>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use std::collections::BTreeMap;
use anyhow::Result;
use harmont_cloud::HarmontClient;

use crate::cli::PipelineCommand;
use crate::settings;
use crate::commands::cloud::cli::PipelineCommand;
use crate::commands::cloud::settings;
use hm_core::app_ctx::AppCtx;

pub(crate) async fn run(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use clap::Parser;
use harmont_cloud::builds::NewBuild;
use hm_core::app_ctx::AppCtx;

use crate::settings;
use crate::commands::cloud::settings;

#[derive(Debug, Clone, Parser)]
pub struct RunArgs {
Expand Down Expand Up @@ -74,9 +74,9 @@ pub(crate) async fn run(env: &BTreeMap<String, String>, args: RunArgs, app: &App
if args.no_watch {
return Ok(());
}
crate::verbs::build::run(
crate::commands::cloud::verbs::build::run(
env,
crate::cli::BuildCommand::Watch {
crate::commands::cloud::cli::BuildCommand::Watch {
pipeline: args.pipeline.clone(),
number: build.number,
},
Expand Down
6 changes: 3 additions & 3 deletions crates/hm/src/commands/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,18 +114,18 @@ async fn prompt_cloud_registration(
return Ok(());
}

hm_plugin_cloud::login_interactive(app).await?;
crate::commands::cloud::login_interactive(app).await?;
}

let (client, _ctx) = hm_plugin_cloud::settings::client(app)
let (client, _ctx) = crate::commands::cloud::settings::client(app)
.await
.context("could not build authenticated cloud client")?;

let orgs = client
.raw()
.list_organizations(None, None)
.await
.map_err(hm_plugin_cloud::settings::map_raw)
.map_err(crate::commands::cloud::settings::map_raw)
.context("fetching organizations")?
.into_inner();

Expand Down
1 change: 1 addition & 0 deletions crates/hm/src/commands/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod cache;
pub mod cloud;
pub mod init;
pub mod run;
8 changes: 4 additions & 4 deletions crates/hm/src/commands/run/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,12 +485,12 @@ async fn register_remoteless_pipeline(
.raw()
.create_pipeline(org, &body)
.await
.map_err(hm_plugin_cloud::settings::map_raw)
.map_err(crate::commands::cloud::settings::map_raw)
.with_context(|| format!("registering pipeline '{pipeline_name}' in org {org}"))?;
created.into_inner().slug
}
Err(e) => {
return Err(hm_plugin_cloud::settings::map_raw(e))
return Err(crate::commands::cloud::settings::map_raw(e))
.with_context(|| format!("looking up pipeline '{pipeline_name}' in org {org}"));
}
};
Expand Down Expand Up @@ -554,7 +554,7 @@ async fn resolve_or_create_cloud_pipeline(
Ok(p) => return Ok(Some(p.into_inner().slug)),
Err(e) if e.status().is_some_and(|s| s.as_u16() == 404) => {} // truly absent → create
Err(e) => {
return Err(hm_plugin_cloud::settings::map_raw(e))
return Err(crate::commands::cloud::settings::map_raw(e))
.with_context(|| format!("looking up pipeline '{}' in org {}", ac.name, ac.org));
}
}
Expand Down Expand Up @@ -586,7 +586,7 @@ async fn resolve_or_create_cloud_pipeline(
.raw()
.create_pipeline(&ac.org, &body)
.await
.map_err(hm_plugin_cloud::settings::map_raw)
.map_err(crate::commands::cloud::settings::map_raw)
.with_context(|| format!("creating pipeline '{}' in org {}", ac.name, ac.org))?;
let slug = created.into_inner().slug;
tracing::info!("created pipeline '{slug}' — submitting build");
Expand Down
Loading