From 6635dd55a0e6b62d27b3c432642d3f8cd95d69ab Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sat, 27 Jun 2026 13:48:01 +0200 Subject: [PATCH 01/37] Add grouped paths --- Cargo.lock | 83 +++++++------------ Cargo.toml | 2 + .../src/components/string_arg.rs | 1 + .../src/components/url_arg.rs | 1 + crates/hypershell-components/src/lib.rs | 1 + .../src/namespaces/handlers.rs | 25 ++++++ .../src/namespaces/mod.rs | 9 ++ .../src/namespaces/prefixes.rs | 64 ++++++++++++++ .../src/namespaces/string_arg_extractor.rs | 15 ++++ .../src/namespaces/url_arg_extractor.rs | 15 ++++ .../hypershell-reqwest-components/src/lib.rs | 1 + .../src/namespaces.rs | 32 +++++++ crates/hypershell-tokio-components/src/lib.rs | 1 + .../src/namespaces.rs | 73 ++++++++++++++++ 14 files changed, 270 insertions(+), 53 deletions(-) create mode 100644 crates/hypershell-components/src/namespaces/handlers.rs create mode 100644 crates/hypershell-components/src/namespaces/mod.rs create mode 100644 crates/hypershell-components/src/namespaces/prefixes.rs create mode 100644 crates/hypershell-components/src/namespaces/string_arg_extractor.rs create mode 100644 crates/hypershell-components/src/namespaces/url_arg_extractor.rs create mode 100644 crates/hypershell-reqwest-components/src/namespaces.rs create mode 100644 crates/hypershell-tokio-components/src/namespaces.rs diff --git a/Cargo.lock b/Cargo.lock index 3c76cde..63fb54e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -101,8 +101,6 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "cgp" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2d437a85e5fff058b478d3ebc21e4eef9732caeea448738e73afa116c1fc30" dependencies = [ "cgp-core", "cgp-extra", @@ -111,27 +109,35 @@ dependencies = [ [[package]] name = "cgp-async-macro" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03ac81c0b822dfe371bb0ff80206a21170860bbd514fcac0daba962ba34e2e35" dependencies = [ "proc-macro2", "quote", "syn", ] +[[package]] +name = "cgp-base" +version = "0.7.0" +dependencies = [ + "cgp-base-types", + "cgp-component", + "cgp-macro", +] + +[[package]] +name = "cgp-base-types" +version = "0.7.0" + [[package]] name = "cgp-component" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39735cd93546a0b4f7183a55172b709c0df893844b41a7117e08583a9da83127" [[package]] name = "cgp-core" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a0ce263d3cbe6b7048c47dcb99f40852e3c8f5639b9e5dd257889868c902a4c" dependencies = [ "cgp-async-macro", + "cgp-base", "cgp-component", "cgp-error", "cgp-field", @@ -142,8 +148,6 @@ dependencies = [ [[package]] name = "cgp-dispatch" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d39760b78371f2c1c497961b00e8dce8c1c8f16edff8fea5e0433e9ef9d55ffa" dependencies = [ "cgp-core", "cgp-handler", @@ -153,10 +157,9 @@ dependencies = [ [[package]] name = "cgp-error" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d3502be41951b84e3ce40d010cc6ae6bbf24870e46037c459870cccdeffb84" dependencies = [ - "cgp-component", + "cgp-base", + "cgp-field", "cgp-macro", "cgp-type", ] @@ -164,8 +167,6 @@ dependencies = [ [[package]] name = "cgp-error-anyhow" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "627349f2e10a8bd4c2b777ce93fca00cfbfd27ad15b3a186964037dc42634e0e" dependencies = [ "anyhow", "cgp-core", @@ -174,8 +175,6 @@ dependencies = [ [[package]] name = "cgp-error-extra" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0b8b5cbf6677a7fb237fd44245222c47f4ee63e7138d84813724a31f0050962" dependencies = [ "cgp-core", ] @@ -183,8 +182,6 @@ dependencies = [ [[package]] name = "cgp-extra" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc0a18aaebc9a6afefe95d6e3e07894816c2708bd6722c419c974884aa0a30ec" dependencies = [ "cgp-core", "cgp-dispatch", @@ -200,8 +197,6 @@ dependencies = [ [[package]] name = "cgp-extra-macro" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83953618e5a9d39f0fdae7d25799ab5c254fa06531441c2c1a5df6535a740a8c" dependencies = [ "cgp-extra-macro-lib", "syn", @@ -210,10 +205,8 @@ dependencies = [ [[package]] name = "cgp-extra-macro-lib" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1800ccf6bd3e3074831b644fc4cdc831d6271d84e68fbd217711c3dfbd85fe42" dependencies = [ - "cgp-macro-lib", + "cgp-macro-core", "proc-macro2", "quote", "syn", @@ -222,9 +215,8 @@ dependencies = [ [[package]] name = "cgp-field" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2412983a507e370aa5d72b8091f9576cf95e58be06bc3233cd91eeb6b6edead" dependencies = [ + "cgp-base-types", "cgp-component", "cgp-type", ] @@ -232,8 +224,6 @@ dependencies = [ [[package]] name = "cgp-field-extra" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e6636e484c14fed64533b5f726ca6186493f53218d3975de1437bc76ec72091" dependencies = [ "cgp-field", ] @@ -241,8 +231,6 @@ dependencies = [ [[package]] name = "cgp-handler" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00a2a8574da65309b8b19ba1268953f7d825748b27a921b4d00baa78b2838a97" dependencies = [ "cgp-core", ] @@ -250,21 +238,27 @@ dependencies = [ [[package]] name = "cgp-macro" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4f6983bcbc2f08555682f093a56787a4b0b02c63871efc923a0a4f72cda4d68" dependencies = [ "cgp-macro-lib", "syn", ] +[[package]] +name = "cgp-macro-core" +version = "0.7.0" +dependencies = [ + "itertools", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "cgp-macro-lib" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12ec3f9ec29691903cdbf1e82ecc4bb29ab108b306a9826b4d85eaecb6d9d508" dependencies = [ + "cgp-macro-core", "itertools", - "prettyplease", "proc-macro2", "quote", "syn", @@ -273,8 +267,6 @@ dependencies = [ [[package]] name = "cgp-monad" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c313da265af036cefe7307f466c7ae9b26377c4d482172da9d8a1217859482f6" dependencies = [ "cgp-core", "cgp-handler", @@ -283,8 +275,6 @@ dependencies = [ [[package]] name = "cgp-run" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b732f6592e4051aa9d43e5ac226c28bb30693c2b92ac1ba7c2a55aa1d757d539" dependencies = [ "cgp-core", ] @@ -292,8 +282,6 @@ dependencies = [ [[package]] name = "cgp-runtime" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45ac97c31acce9ab7d10146c2bd08dbf289c6c533eab1400714dcc9f6c0e85f5" dependencies = [ "cgp-core", ] @@ -301,9 +289,8 @@ dependencies = [ [[package]] name = "cgp-type" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e67030447046e58fd34a8c10d6471eaff67b440ca441cbb01e29211ba29e66da" dependencies = [ + "cgp-base", "cgp-component", "cgp-macro", ] @@ -1142,16 +1129,6 @@ dependencies = [ "zerocopy", ] -[[package]] -name = "prettyplease" -version = "0.2.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "664ec5419c51e34154eec046ebcba56312d5a2fc3b09a06da188e1ad21afadf6" -dependencies = [ - "proc-macro2", - "syn", -] - [[package]] name = "proc-macro2" version = "1.0.95" diff --git a/Cargo.toml b/Cargo.toml index c8f117c..480a3e5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,5 +49,7 @@ hypershell-hash-components = { version = "0.1.0", path = "./crates/hyp hypershell-macro = { version = "0.1.0", path = "./crates/hypershell-macro" } [patch.crates-io] +cgp = { path = "../cgp/crates/main/cgp" } +cgp-error-anyhow = { path = "../cgp/crates/standalone/error/cgp-error-anyhow" } # cgp = { git = "https://github.com/contextgeneric/cgp.git", branch = "v0.7.0" } # cgp-error-anyhow = { git = "https://github.com/contextgeneric/cgp.git", branch = "v0.7.0" } diff --git a/crates/hypershell-components/src/components/string_arg.rs b/crates/hypershell-components/src/components/string_arg.rs index 449ac64..2f95a78 100644 --- a/crates/hypershell-components/src/components/string_arg.rs +++ b/crates/hypershell-components/src/components/string_arg.rs @@ -8,6 +8,7 @@ use cgp::prelude::*; provider: StringArgExtractor, derive_delegate: UseDelegate, }] +#[prefix(@hypershell.core in DefaultNamespace)] pub trait CanExtractStringArg { fn extract_string_arg(&self, _phantom: PhantomData) -> Cow<'_, str>; } diff --git a/crates/hypershell-components/src/components/url_arg.rs b/crates/hypershell-components/src/components/url_arg.rs index 8cb9cee..53a01d0 100644 --- a/crates/hypershell-components/src/components/url_arg.rs +++ b/crates/hypershell-components/src/components/url_arg.rs @@ -12,6 +12,7 @@ pub trait HasUrlType { provider: UrlArgExtractor, derive_delegate: UseDelegate, }] +#[prefix(@hypershell.core in DefaultNamespace)] pub trait CanExtractUrlArg: HasUrlType + HasErrorType { fn extract_url_arg(&self, _phantom: PhantomData) -> Result; } diff --git a/crates/hypershell-components/src/lib.rs b/crates/hypershell-components/src/lib.rs index d63f5a9..cd30b9c 100644 --- a/crates/hypershell-components/src/lib.rs +++ b/crates/hypershell-components/src/lib.rs @@ -4,6 +4,7 @@ extern crate alloc; pub mod components; pub mod dsl; +pub mod namespaces; pub mod presets; pub mod providers; pub mod traits; diff --git a/crates/hypershell-components/src/namespaces/handlers.rs b/crates/hypershell-components/src/namespaces/handlers.rs new file mode 100644 index 0000000..2f18287 --- /dev/null +++ b/crates/hypershell-components/src/namespaces/handlers.rs @@ -0,0 +1,25 @@ +use alloc::boxed::Box; + +use cgp::extra::handler::Promote; +use cgp::prelude::cgp_namespace; + +use crate::dsl::{BytesToString, ConvertTo, Pipe, Use}; +use crate::providers::{ + BoxHandler, Call, DecodeUtf8Bytes, HandleConvert, HandlePipe, + HandleUseProvider, +}; + +cgp_namespace! { + new BaseHandlerImpls { + BytesToString: + DecodeUtf8Bytes, + ConvertTo: + Promote, + Pipe: + HandlePipe, + Use: + HandleUseProvider, + Box: + BoxHandler>, + } +} diff --git a/crates/hypershell-components/src/namespaces/mod.rs b/crates/hypershell-components/src/namespaces/mod.rs new file mode 100644 index 0000000..5a9e201 --- /dev/null +++ b/crates/hypershell-components/src/namespaces/mod.rs @@ -0,0 +1,9 @@ +mod string_arg_extractor; +mod handlers; +mod prefixes; +mod url_arg_extractor; + +pub use string_arg_extractor::*; +pub use handlers::*; +pub use prefixes::*; +pub use url_arg_extractor::*; diff --git a/crates/hypershell-components/src/namespaces/prefixes.rs b/crates/hypershell-components/src/namespaces/prefixes.rs new file mode 100644 index 0000000..5248435 --- /dev/null +++ b/crates/hypershell-components/src/namespaces/prefixes.rs @@ -0,0 +1,64 @@ +use alloc::boxed::Box; + +use cgp::prelude::*; + +use crate::components::{StringArgExtractorComponent, UrlArgExtractorComponent}; +use crate::dsl::{ + BytesToStream, BytesToString, ConvertTo, FieldArg, JoinArgs, Pipe, ReadFile, SimpleExec, SimpleHttpRequest, StaticArg, StreamToBytes, StreamToStdout, StreamToString, StreamingExec, StreamingHttpRequest, Use, WebSocket, WriteFile, +}; + +cgp_namespace! { + new HypershellNamespace: DefaultNamespace { + @cgp.extra.HandlerComponent.{ + Pipe, + Use, + Box, + } => + @hypershell.dsl.handler.core, + + @cgp.extra.HandlerComponent.{ + BytesToString, + ConvertTo, + } => + @hypershell.dsl.handler.convert, + + @cgp.extra.HandlerComponent.{ + StreamToBytes, + StreamToString, + BytesToStream, + StreamToStdout, + } => + @hypershell.dsl.handler.stream, + + @cgp.extra.HandlerComponent.{ + SimpleExec, + StreamingExec, + } => + @hypershell.dsl.handler.cli, + + @cgp.extra.HandlerComponent.{ + ReadFile, + WriteFile, + } => + @hypershell.dsl.handler.file, + + + @cgp.extra.HandlerComponent.{ + SimpleHttpRequest, + StreamingHttpRequest, + } => + @hypershell.dsl.handler.http, + + @cgp.extra.HandlerComponent.{ + WebSocket, + } => + @hypershell.dsl.handler.websocket, + + @hypershell.core.[StringArgExtractorComponent, UrlArgExtractorComponent].{ + StaticArg, + FieldArg, + JoinArgs, + } => + @hypershell.dsl.arg.core, + } +} diff --git a/crates/hypershell-components/src/namespaces/string_arg_extractor.rs b/crates/hypershell-components/src/namespaces/string_arg_extractor.rs new file mode 100644 index 0000000..b480eb8 --- /dev/null +++ b/crates/hypershell-components/src/namespaces/string_arg_extractor.rs @@ -0,0 +1,15 @@ +use cgp::prelude::cgp_namespace; + +use crate::dsl::{FieldArg, JoinArgs, StaticArg}; +use crate::providers::{ExtractFieldArg, ExtractStaticArg, JoinStringArgs}; + +cgp_namespace! { + new BaseStringArgExtractorImpls { + StaticArg: + ExtractStaticArg, + FieldArg: + ExtractFieldArg, + JoinArgs: + JoinStringArgs, + } +} diff --git a/crates/hypershell-components/src/namespaces/url_arg_extractor.rs b/crates/hypershell-components/src/namespaces/url_arg_extractor.rs new file mode 100644 index 0000000..84d1358 --- /dev/null +++ b/crates/hypershell-components/src/namespaces/url_arg_extractor.rs @@ -0,0 +1,15 @@ +use cgp::prelude::cgp_namespace; + +use crate::dsl::{FieldArg, JoinArgs, StaticArg}; +use crate::providers::ExtractStringUrlArg; + + +cgp_namespace! { + new BaseUrlArgExtractorImpls { + [ + StaticArg, + JoinArgs, + FieldArg, + ]: ExtractStringUrlArg, + } +} diff --git a/crates/hypershell-reqwest-components/src/lib.rs b/crates/hypershell-reqwest-components/src/lib.rs index e8d91fa..c461df5 100644 --- a/crates/hypershell-reqwest-components/src/lib.rs +++ b/crates/hypershell-reqwest-components/src/lib.rs @@ -1,4 +1,5 @@ pub mod components; pub mod dsl; +pub mod namespaces; pub mod presets; pub mod providers; diff --git a/crates/hypershell-reqwest-components/src/namespaces.rs b/crates/hypershell-reqwest-components/src/namespaces.rs new file mode 100644 index 0000000..2754d02 --- /dev/null +++ b/crates/hypershell-reqwest-components/src/namespaces.rs @@ -0,0 +1,32 @@ +use cgp::extra::handler::PipeHandlers; +use cgp::prelude::*; +use hypershell_components::dsl::{SimpleHttpRequest, StreamingHttpRequest}; +use hypershell_components::namespaces::BaseHandlerImpls; +use hypershell_tokio_components::namespaces::{ToTokioAsyncReadHandlers, TokioHandlerImpls}; +use hypershell_tokio_components::providers::WrapFuturesAsyncRead; + +use crate::dsl::CoreHttpRequest; +use crate::providers::{ + HandleCoreHttpRequest, HandleSimpleHttpRequest, HandleStreamingHttpRequest, StreamToBody, +}; + +cgp_namespace! { + BaseHandlerImpls { + CoreHttpRequest: + HandleCoreHttpRequest, + } +} + +cgp_namespace! { + new ReqwestHandlerImpls: TokioHandlerImpls { + SimpleHttpRequest: + HandleSimpleHttpRequest, + StreamingHttpRequest: + PipeHandlers, + } +} diff --git a/crates/hypershell-tokio-components/src/lib.rs b/crates/hypershell-tokio-components/src/lib.rs index 8950c34..c92ccf4 100644 --- a/crates/hypershell-tokio-components/src/lib.rs +++ b/crates/hypershell-tokio-components/src/lib.rs @@ -1,5 +1,6 @@ pub mod components; pub mod dsl; +pub mod namespaces; pub mod presets; pub mod providers; pub mod types; diff --git a/crates/hypershell-tokio-components/src/namespaces.rs b/crates/hypershell-tokio-components/src/namespaces.rs new file mode 100644 index 0000000..5268102 --- /dev/null +++ b/crates/hypershell-tokio-components/src/namespaces.rs @@ -0,0 +1,73 @@ +use cgp::extra::handler::{PipeHandlers, UseInputDelegate}; +use cgp::prelude::*; +use hypershell_components::dsl::{ + BytesToStream, ReadFile, SimpleExec, StreamToBytes, StreamToStdout, StreamToString, + StreamingExec, WriteFile, +}; +use hypershell_components::namespaces::BaseHandlerImpls; +use hypershell_components::providers::ReturnInput; + +use crate::dsl::{CoreExec, ToTokioAsyncRead}; +use crate::providers::{ + FuturesToTokioAsyncRead, HandleBytesToTokioAsyncRead, HandleCoreExec, HandleReadFile, + HandleSimpleExec, HandleStreamToStdout, HandleStreamingExec, HandleTokioAsyncReadToBytes, + HandleTokioAsyncReadToString, HandleWriteFile, WrapTokioAsyncRead, +}; +use crate::types::{FuturesAsyncReadStream, TokioAsyncReadStream}; + +cgp_namespace! { + BaseHandlerImpls { + ToTokioAsyncRead: + UseInputDelegate, + CoreExec: + HandleCoreExec, + } +} + +cgp_namespace! { + new TokioHandlerImpls: BaseHandlerImpls { + SimpleExec: + HandleSimpleExec, + StreamingExec: + PipeHandlers, + HandleStreamingExec, + WrapTokioAsyncRead, + ]>, + ReadFile: + PipeHandlers, + WriteFile: + PipeHandlers, + HandleWriteFile, + ]>, + StreamToBytes: + HandleTokioAsyncReadToBytes, + StreamToString: + HandleTokioAsyncReadToString, + BytesToStream: + HandleBytesToTokioAsyncRead, + StreamToStdout: + PipeHandlers, + HandleStreamToStdout, + ]>, + } +} + +delegate_components! { + new ToTokioAsyncReadHandlers { + FuturesAsyncReadStream: + FuturesToTokioAsyncRead, + TokioAsyncReadStream: + ReturnInput, + [ + Vec, + String, + ]: + HandleBytesToTokioAsyncRead, + } +} From 44bb62c4c8e9bf43c285665a1bd29123a123c8f8 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sat, 27 Jun 2026 20:10:31 +0200 Subject: [PATCH 02/37] Trying out prefix delegation --- .../src/components/command_arg.rs | 1 + .../src/namespaces/handlers.rs | 3 +- .../src/namespaces/mod.rs | 4 +- .../src/namespaces/prefixes.rs | 91 ++++++++++++++----- .../src/namespaces/url_arg_extractor.rs | 1 - .../{namespaces.rs => namespaces/handler.rs} | 16 +--- .../src/namespaces/mod.rs | 4 + .../src/namespaces/prefixes.rs | 13 +++ crates/hypershell/src/lib.rs | 1 + crates/hypershell/src/namespaces/handlers.rs | 22 +++++ crates/hypershell/src/namespaces/mod.rs | 3 + 11 files changed, 121 insertions(+), 38 deletions(-) rename crates/hypershell-tokio-components/src/{namespaces.rs => namespaces/handler.rs} (93%) create mode 100644 crates/hypershell-tokio-components/src/namespaces/mod.rs create mode 100644 crates/hypershell-tokio-components/src/namespaces/prefixes.rs create mode 100644 crates/hypershell/src/namespaces/handlers.rs create mode 100644 crates/hypershell/src/namespaces/mod.rs diff --git a/crates/hypershell-components/src/components/command_arg.rs b/crates/hypershell-components/src/components/command_arg.rs index f0f692f..1c73bca 100644 --- a/crates/hypershell-components/src/components/command_arg.rs +++ b/crates/hypershell-components/src/components/command_arg.rs @@ -12,6 +12,7 @@ pub trait HasCommandArgType { provider: CommandArgExtractor, derive_delegate: UseDelegate, }] +#[prefix(@hypershell.core in DefaultNamespace)] pub trait CanExtractCommandArg: HasCommandArgType { fn extract_command_arg(&self, _phantom: PhantomData) -> Self::CommandArg; } diff --git a/crates/hypershell-components/src/namespaces/handlers.rs b/crates/hypershell-components/src/namespaces/handlers.rs index 2f18287..5e36f3f 100644 --- a/crates/hypershell-components/src/namespaces/handlers.rs +++ b/crates/hypershell-components/src/namespaces/handlers.rs @@ -5,8 +5,7 @@ use cgp::prelude::cgp_namespace; use crate::dsl::{BytesToString, ConvertTo, Pipe, Use}; use crate::providers::{ - BoxHandler, Call, DecodeUtf8Bytes, HandleConvert, HandlePipe, - HandleUseProvider, + BoxHandler, Call, DecodeUtf8Bytes, HandleConvert, HandlePipe, HandleUseProvider, }; cgp_namespace! { diff --git a/crates/hypershell-components/src/namespaces/mod.rs b/crates/hypershell-components/src/namespaces/mod.rs index 5a9e201..53fd70f 100644 --- a/crates/hypershell-components/src/namespaces/mod.rs +++ b/crates/hypershell-components/src/namespaces/mod.rs @@ -1,9 +1,9 @@ -mod string_arg_extractor; mod handlers; mod prefixes; +mod string_arg_extractor; mod url_arg_extractor; -pub use string_arg_extractor::*; pub use handlers::*; pub use prefixes::*; +pub use string_arg_extractor::*; pub use url_arg_extractor::*; diff --git a/crates/hypershell-components/src/namespaces/prefixes.rs b/crates/hypershell-components/src/namespaces/prefixes.rs index 5248435..d293f58 100644 --- a/crates/hypershell-components/src/namespaces/prefixes.rs +++ b/crates/hypershell-components/src/namespaces/prefixes.rs @@ -1,64 +1,111 @@ -use alloc::boxed::Box; - +use cgp::core::component::IsDelegateKeyIn; use cgp::prelude::*; -use crate::components::{StringArgExtractorComponent, UrlArgExtractorComponent}; +use crate::components::{ + CommandArgExtractorComponent, StringArgExtractorComponent, UrlArgExtractorComponent, +}; use crate::dsl::{ - BytesToStream, BytesToString, ConvertTo, FieldArg, JoinArgs, Pipe, ReadFile, SimpleExec, SimpleHttpRequest, StaticArg, StreamToBytes, StreamToStdout, StreamToString, StreamingExec, StreamingHttpRequest, Use, WebSocket, WriteFile, + BytesToStream, BytesToString, ConvertTo, FieldArg, JoinArgs, Pipe, ReadFile, SimpleExec, + SimpleHttpRequest, StaticArg, StreamToBytes, StreamToStdout, StreamToString, StreamingExec, + StreamingHttpRequest, UrlEncodeArg, Use, WebSocket, WriteFile, }; cgp_namespace! { new HypershellNamespace: DefaultNamespace { - @cgp.extra.HandlerComponent.{ + @cgp.extra.HandlerComponent.> T: + UseDelegate, + + @cgp.extra.StringArgExtractorComponent.> T: + UseDelegate, + + @cgp.extra.CommandArgExtractorComponent.> T: + UseDelegate, + + @cgp.extra.UrlArgExtractorComponent.> T: + UseDelegate, + } +} + +delegate_components! { + new HypershellHandlers { + [ Pipe, Use, - Box, - } => + ] => @hypershell.dsl.handler.core, - @cgp.extra.HandlerComponent.{ + [ BytesToString, ConvertTo, - } => + ] => @hypershell.dsl.handler.convert, - @cgp.extra.HandlerComponent.{ + [ StreamToBytes, StreamToString, BytesToStream, StreamToStdout, - } => + ] => @hypershell.dsl.handler.stream, - @cgp.extra.HandlerComponent.{ + [ SimpleExec, StreamingExec, - } => + ] => @hypershell.dsl.handler.cli, - @cgp.extra.HandlerComponent.{ + [ ReadFile, WriteFile, - } => + ] => @hypershell.dsl.handler.file, - - @cgp.extra.HandlerComponent.{ + [ SimpleHttpRequest, StreamingHttpRequest, - } => + ] => @hypershell.dsl.handler.http, - @cgp.extra.HandlerComponent.{ + [ WebSocket, - } => + ] => @hypershell.dsl.handler.websocket, - @hypershell.core.[StringArgExtractorComponent, UrlArgExtractorComponent].{ + } +} + +delegate_components! { + new HypershellStringArgExtractors { + [ StaticArg, FieldArg, JoinArgs, - } => + ] => @hypershell.dsl.arg.core, + [ + UrlEncodeArg, + ] => + @hypershell.dsl.arg.url, + } +} + +delegate_components! { + new HypershellCommandArgExtractors { + [ + StaticArg, + FieldArg, + ] => + @hypershell.dsl.arg.core + } +} + +delegate_components! { + new HypershellUrlArgExtractors { + [ + StaticArg, + FieldArg, + JoinArgs, + ] => + @hypershell.dsl.arg.core } } diff --git a/crates/hypershell-components/src/namespaces/url_arg_extractor.rs b/crates/hypershell-components/src/namespaces/url_arg_extractor.rs index 84d1358..05e5d6a 100644 --- a/crates/hypershell-components/src/namespaces/url_arg_extractor.rs +++ b/crates/hypershell-components/src/namespaces/url_arg_extractor.rs @@ -3,7 +3,6 @@ use cgp::prelude::cgp_namespace; use crate::dsl::{FieldArg, JoinArgs, StaticArg}; use crate::providers::ExtractStringUrlArg; - cgp_namespace! { new BaseUrlArgExtractorImpls { [ diff --git a/crates/hypershell-tokio-components/src/namespaces.rs b/crates/hypershell-tokio-components/src/namespaces/handler.rs similarity index 93% rename from crates/hypershell-tokio-components/src/namespaces.rs rename to crates/hypershell-tokio-components/src/namespaces/handler.rs index 5268102..49a44b1 100644 --- a/crates/hypershell-tokio-components/src/namespaces.rs +++ b/crates/hypershell-tokio-components/src/namespaces/handler.rs @@ -4,7 +4,6 @@ use hypershell_components::dsl::{ BytesToStream, ReadFile, SimpleExec, StreamToBytes, StreamToStdout, StreamToString, StreamingExec, WriteFile, }; -use hypershell_components::namespaces::BaseHandlerImpls; use hypershell_components::providers::ReturnInput; use crate::dsl::{CoreExec, ToTokioAsyncRead}; @@ -16,16 +15,7 @@ use crate::providers::{ use crate::types::{FuturesAsyncReadStream, TokioAsyncReadStream}; cgp_namespace! { - BaseHandlerImpls { - ToTokioAsyncRead: - UseInputDelegate, - CoreExec: - HandleCoreExec, - } -} - -cgp_namespace! { - new TokioHandlerImpls: BaseHandlerImpls { + new TokioHandlerImpls { SimpleExec: HandleSimpleExec, StreamingExec: @@ -55,6 +45,10 @@ cgp_namespace! { UseInputDelegate, HandleStreamToStdout, ]>, + ToTokioAsyncRead: + UseInputDelegate, + CoreExec: + HandleCoreExec, } } diff --git a/crates/hypershell-tokio-components/src/namespaces/mod.rs b/crates/hypershell-tokio-components/src/namespaces/mod.rs new file mode 100644 index 0000000..7b85143 --- /dev/null +++ b/crates/hypershell-tokio-components/src/namespaces/mod.rs @@ -0,0 +1,4 @@ +mod handler; +mod prefixes; + +pub use handler::*; diff --git a/crates/hypershell-tokio-components/src/namespaces/prefixes.rs b/crates/hypershell-tokio-components/src/namespaces/prefixes.rs new file mode 100644 index 0000000..c7f7ebe --- /dev/null +++ b/crates/hypershell-tokio-components/src/namespaces/prefixes.rs @@ -0,0 +1,13 @@ +use cgp::prelude::delegate_components; +use hypershell_components::namespaces::HypershellHandlers; + +use crate::dsl::ToTokioAsyncRead; + +delegate_components! { + HypershellHandlers { + [ + ToTokioAsyncRead, + ] => + @hypershell.dsl.handler.tokio, + } +} diff --git a/crates/hypershell/src/lib.rs b/crates/hypershell/src/lib.rs index f6afd29..e8edf64 100644 --- a/crates/hypershell/src/lib.rs +++ b/crates/hypershell/src/lib.rs @@ -1,3 +1,4 @@ pub mod contexts; +pub mod namespaces; pub mod prelude; pub mod presets; diff --git a/crates/hypershell/src/namespaces/handlers.rs b/crates/hypershell/src/namespaces/handlers.rs new file mode 100644 index 0000000..b1fa8d2 --- /dev/null +++ b/crates/hypershell/src/namespaces/handlers.rs @@ -0,0 +1,22 @@ +use cgp::prelude::{HandlerComponent, cgp_namespace}; +use hypershell_components::namespaces::{BaseHandlerImpls, HypershellNamespace}; +use hypershell_tokio_components::namespaces::TokioHandlerImpls; + +cgp_namespace! { + new HypershellDefautHandlers: HypershellNamespace { + for in BaseHandlerImpls { + @hypershell.dsl.handler.core.HandlerComponent.Key: + Value, + } + + for in TokioHandlerImpls { + @hypershell.dsl.handler.[ + cli, + file, + stream, + tokio, + ].HandlerComponent.Key: + Value, + } + } +} diff --git a/crates/hypershell/src/namespaces/mod.rs b/crates/hypershell/src/namespaces/mod.rs new file mode 100644 index 0000000..2ed7b74 --- /dev/null +++ b/crates/hypershell/src/namespaces/mod.rs @@ -0,0 +1,3 @@ +mod handlers; + +pub use handlers::*; From 63ab7a05f2a6f9690e183bd4d715a77363bf59f2 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sat, 27 Jun 2026 20:43:28 +0200 Subject: [PATCH 03/37] Add HandleToFuturesStream and HandleToTokioAsyncRead --- .../src/components/method_arg.rs | 1 + .../src/namespaces/command_arg_extractor.rs | 13 +++++ .../src/namespaces/mod.rs | 2 + .../src/presets/checksum.rs | 4 +- .../src/namespaces.rs | 6 +- .../src/presets.rs | 5 +- .../src/components/update_command.rs | 1 + .../src/namespaces/command_arg.rs | 12 ++++ .../src/namespaces/handler.rs | 28 ++-------- .../src/namespaces/mod.rs | 2 + .../src/namespaces/prefixes.rs | 22 +++++++- .../src/presets.rs | 56 ++++--------------- .../src/providers/async_read.rs | 27 +++++++++ .../src/providers/futures_stream.rs | 29 ++++++++++ .../src/providers/mod.rs | 4 ++ 15 files changed, 134 insertions(+), 78 deletions(-) create mode 100644 crates/hypershell-components/src/namespaces/command_arg_extractor.rs create mode 100644 crates/hypershell-tokio-components/src/namespaces/command_arg.rs create mode 100644 crates/hypershell-tokio-components/src/providers/async_read.rs create mode 100644 crates/hypershell-tokio-components/src/providers/futures_stream.rs diff --git a/crates/hypershell-components/src/components/method_arg.rs b/crates/hypershell-components/src/components/method_arg.rs index 3193a0b..9fb3315 100644 --- a/crates/hypershell-components/src/components/method_arg.rs +++ b/crates/hypershell-components/src/components/method_arg.rs @@ -12,6 +12,7 @@ pub trait HasHttpMethodType { provider: MethodArgExtractor, derive_delegate: UseDelegate, }] +#[prefix(@hypershell.core in DefaultNamespace)] pub trait CanExtractMethodArg: HasHttpMethodType { fn extract_method_arg(&self, _phantom: PhantomData) -> Self::HttpMethod; } diff --git a/crates/hypershell-components/src/namespaces/command_arg_extractor.rs b/crates/hypershell-components/src/namespaces/command_arg_extractor.rs new file mode 100644 index 0000000..7533892 --- /dev/null +++ b/crates/hypershell-components/src/namespaces/command_arg_extractor.rs @@ -0,0 +1,13 @@ +use cgp::prelude::cgp_namespace; + +use crate::dsl::{FieldArg, StaticArg}; +use crate::providers::ExtractStringCommandArg; + +cgp_namespace! { + new BaseCommandArgExtractorImpls { + [ + StaticArg, + FieldArg, + ]: ExtractStringCommandArg, + } +} diff --git a/crates/hypershell-components/src/namespaces/mod.rs b/crates/hypershell-components/src/namespaces/mod.rs index 53fd70f..8a0b0e7 100644 --- a/crates/hypershell-components/src/namespaces/mod.rs +++ b/crates/hypershell-components/src/namespaces/mod.rs @@ -1,8 +1,10 @@ +mod command_arg_extractor; mod handlers; mod prefixes; mod string_arg_extractor; mod url_arg_extractor; +pub use command_arg_extractor::*; pub use handlers::*; pub use prefixes::*; pub use string_arg_extractor::*; diff --git a/crates/hypershell-examples/src/presets/checksum.rs b/crates/hypershell-examples/src/presets/checksum.rs index 0175a1c..315357a 100644 --- a/crates/hypershell-examples/src/presets/checksum.rs +++ b/crates/hypershell-examples/src/presets/checksum.rs @@ -5,7 +5,7 @@ mod preset { use hypershell::presets::HypershellHandlerPreset; use hypershell_hash_components::dsl::{BytesToHex, Checksum}; use hypershell_hash_components::providers::{HandleBytesToHex, HandleStreamChecksum}; - use hypershell_tokio_components::presets::ToFuturesStreamHandlers; + use hypershell_tokio_components::providers::HandleToFuturesStream; cgp_preset! { HypershellChecksumPreset: HypershellPreset { @@ -19,7 +19,7 @@ mod preset { ChecksumHandlerPreset: HypershellHandlerPreset { Checksum: PipeHandlers, BytesToHex: diff --git a/crates/hypershell-reqwest-components/src/namespaces.rs b/crates/hypershell-reqwest-components/src/namespaces.rs index 2754d02..0f1af35 100644 --- a/crates/hypershell-reqwest-components/src/namespaces.rs +++ b/crates/hypershell-reqwest-components/src/namespaces.rs @@ -2,8 +2,8 @@ use cgp::extra::handler::PipeHandlers; use cgp::prelude::*; use hypershell_components::dsl::{SimpleHttpRequest, StreamingHttpRequest}; use hypershell_components::namespaces::BaseHandlerImpls; -use hypershell_tokio_components::namespaces::{ToTokioAsyncReadHandlers, TokioHandlerImpls}; -use hypershell_tokio_components::providers::WrapFuturesAsyncRead; +use hypershell_tokio_components::namespaces::TokioHandlerImpls; +use hypershell_tokio_components::providers::{HandleToTokioAsyncRead, WrapFuturesAsyncRead}; use crate::dsl::CoreHttpRequest; use crate::providers::{ @@ -23,7 +23,7 @@ cgp_namespace! { HandleSimpleHttpRequest, StreamingHttpRequest: PipeHandlers StreamingHttpRequest: PipeHandlers, }] +#[prefix(@hypershell.tokio in DefaultNamespace)] pub trait CanUpdateCommand { fn update_command(&self, _phantom: PhantomData, command: &mut Command); } diff --git a/crates/hypershell-tokio-components/src/namespaces/command_arg.rs b/crates/hypershell-tokio-components/src/namespaces/command_arg.rs new file mode 100644 index 0000000..dada2e3 --- /dev/null +++ b/crates/hypershell-tokio-components/src/namespaces/command_arg.rs @@ -0,0 +1,12 @@ +use cgp::prelude::cgp_namespace; +use hypershell_components::dsl::JoinArgs; +use hypershell_components::namespaces::BaseCommandArgExtractorImpls; + +use crate::providers::JoinExtractArgs; + +cgp_namespace! { + new TokioCommandArgExtractorImpls: BaseCommandArgExtractorImpls { + JoinArgs: + JoinExtractArgs, + } +} diff --git a/crates/hypershell-tokio-components/src/namespaces/handler.rs b/crates/hypershell-tokio-components/src/namespaces/handler.rs index 49a44b1..b597dee 100644 --- a/crates/hypershell-tokio-components/src/namespaces/handler.rs +++ b/crates/hypershell-tokio-components/src/namespaces/handler.rs @@ -4,15 +4,13 @@ use hypershell_components::dsl::{ BytesToStream, ReadFile, SimpleExec, StreamToBytes, StreamToStdout, StreamToString, StreamingExec, WriteFile, }; -use hypershell_components::providers::ReturnInput; use crate::dsl::{CoreExec, ToTokioAsyncRead}; use crate::providers::{ - FuturesToTokioAsyncRead, HandleBytesToTokioAsyncRead, HandleCoreExec, HandleReadFile, - HandleSimpleExec, HandleStreamToStdout, HandleStreamingExec, HandleTokioAsyncReadToBytes, + HandleBytesToTokioAsyncRead, HandleCoreExec, HandleReadFile, HandleSimpleExec, + HandleStreamToStdout, HandleStreamingExec, HandleToTokioAsyncRead, HandleTokioAsyncReadToBytes, HandleTokioAsyncReadToString, HandleWriteFile, WrapTokioAsyncRead, }; -use crate::types::{FuturesAsyncReadStream, TokioAsyncReadStream}; cgp_namespace! { new TokioHandlerImpls { @@ -20,7 +18,7 @@ cgp_namespace! { HandleSimpleExec, StreamingExec: PipeHandlers, + UseInputDelegate, HandleStreamingExec, WrapTokioAsyncRead, ]>, @@ -31,7 +29,7 @@ cgp_namespace! { ]>, WriteFile: PipeHandlers, + UseInputDelegate, HandleWriteFile, ]>, StreamToBytes: @@ -42,26 +40,12 @@ cgp_namespace! { HandleBytesToTokioAsyncRead, StreamToStdout: PipeHandlers, + UseInputDelegate, HandleStreamToStdout, ]>, ToTokioAsyncRead: - UseInputDelegate, + UseInputDelegate, CoreExec: HandleCoreExec, } } - -delegate_components! { - new ToTokioAsyncReadHandlers { - FuturesAsyncReadStream: - FuturesToTokioAsyncRead, - TokioAsyncReadStream: - ReturnInput, - [ - Vec, - String, - ]: - HandleBytesToTokioAsyncRead, - } -} diff --git a/crates/hypershell-tokio-components/src/namespaces/mod.rs b/crates/hypershell-tokio-components/src/namespaces/mod.rs index 7b85143..d01d1e0 100644 --- a/crates/hypershell-tokio-components/src/namespaces/mod.rs +++ b/crates/hypershell-tokio-components/src/namespaces/mod.rs @@ -1,4 +1,6 @@ +mod command_arg; mod handler; mod prefixes; +pub use command_arg::*; pub use handler::*; diff --git a/crates/hypershell-tokio-components/src/namespaces/prefixes.rs b/crates/hypershell-tokio-components/src/namespaces/prefixes.rs index c7f7ebe..1976720 100644 --- a/crates/hypershell-tokio-components/src/namespaces/prefixes.rs +++ b/crates/hypershell-tokio-components/src/namespaces/prefixes.rs @@ -1,13 +1,31 @@ -use cgp::prelude::delegate_components; +use cgp::prelude::{cgp_namespace, delegate_components}; +use hypershell_components::dsl::{FieldArgs, WithArgs}; use hypershell_components::namespaces::HypershellHandlers; -use crate::dsl::ToTokioAsyncRead; +use crate::dsl::{CoreExec, ToTokioAsyncRead}; + +cgp_namespace! { + HypershellNamespace { + + } +} delegate_components! { HypershellHandlers { [ ToTokioAsyncRead, + CoreExec, ] => @hypershell.dsl.handler.tokio, } } + +delegate_components! { + new HypershellCommandUpdaters { + [ + WithArgs, + FieldArgs, + ] => + @hypershell, + } +} diff --git a/crates/hypershell-tokio-components/src/presets.rs b/crates/hypershell-tokio-components/src/presets.rs index 88d088b..acd92a2 100644 --- a/crates/hypershell-tokio-components/src/presets.rs +++ b/crates/hypershell-tokio-components/src/presets.rs @@ -1,11 +1,9 @@ #[cgp::re_export_imports] mod preset { use std::path::PathBuf; - use std::string::String; - use std::vec::Vec; use cgp::core::component::UseDelegate; - use cgp::extra::handler::{HandlerComponent, PipeHandlers, UseInputDelegate}; + use cgp::extra::handler::{HandlerComponent, PipeHandlers}; use cgp::prelude::{cgp_preset, *}; use hypershell_components::components::{ CommandArgExtractorComponent, CommandArgTypeProviderComponent, @@ -14,17 +12,16 @@ mod preset { BytesToStream, FieldArg, FieldArgs, JoinArgs, ReadFile, SimpleExec, StaticArg, StreamToBytes, StreamToStdout, StreamToString, StreamingExec, WithArgs, WriteFile, }; - use hypershell_components::providers::{ExtractStringCommandArg, ReturnInput}; + use hypershell_components::providers::ExtractStringCommandArg; use crate::components::CommandUpdaterComponent; use crate::dsl::{CoreExec, ToTokioAsyncRead}; use crate::providers::{ - AsyncReadToStream, ExtractArgs, ExtractFieldArgs, FuturesToTokioAsyncRead, - HandleBytesToStream, HandleBytesToTokioAsyncRead, HandleCoreExec, HandleReadFile, - HandleSimpleExec, HandleStreamToStdout, HandleStreamingExec, HandleTokioAsyncReadToBytes, - HandleTokioAsyncReadToString, HandleWriteFile, JoinExtractArgs, WrapTokioAsyncRead, + ExtractArgs, ExtractFieldArgs, HandleBytesToTokioAsyncRead, HandleCoreExec, HandleReadFile, + HandleSimpleExec, HandleStreamToStdout, HandleStreamingExec, HandleToTokioAsyncRead, + HandleTokioAsyncReadToBytes, HandleTokioAsyncReadToString, HandleWriteFile, + JoinExtractArgs, WrapTokioAsyncRead, }; - use crate::types::{FuturesAsyncReadStream, TokioAsyncReadStream}; cgp_preset! { HypershellTokioPreset { @@ -46,7 +43,7 @@ mod preset { HandleSimpleExec, StreamingExec: PipeHandlers, @@ -59,7 +56,7 @@ mod preset { ]>, WriteFile: PipeHandlers, StreamToBytes: @@ -70,11 +67,11 @@ mod preset { HandleBytesToTokioAsyncRead, StreamToStdout: PipeHandlers, ToTokioAsyncRead: - ToTokioAsyncReadHandlers::Provider, + HandleToTokioAsyncRead, } } @@ -97,37 +94,4 @@ mod preset { FieldArgs: ExtractFieldArgs, } } - - cgp_preset! { - #[wrap_provider(UseInputDelegate)] - ToTokioAsyncReadHandlers { - FuturesAsyncReadStream: - FuturesToTokioAsyncRead, - TokioAsyncReadStream: - ReturnInput, - [ - Vec, - String, - ]: - HandleBytesToTokioAsyncRead, - } - } - - cgp_preset! { - #[wrap_provider(UseInputDelegate)] - ToFuturesStreamHandlers { - FuturesAsyncReadStream: - PipeHandlers, - TokioAsyncReadStream: - AsyncReadToStream, - [ - Vec, - String, - ]: - HandleBytesToStream, - } - } } diff --git a/crates/hypershell-tokio-components/src/providers/async_read.rs b/crates/hypershell-tokio-components/src/providers/async_read.rs new file mode 100644 index 0000000..82e6f6a --- /dev/null +++ b/crates/hypershell-tokio-components/src/providers/async_read.rs @@ -0,0 +1,27 @@ +use cgp::extra::handler::UseInputDelegate; +use cgp::prelude::{HandlerComponent, delegate_components}; +use hypershell_components::providers::ReturnInput; + +use crate::providers::{FuturesToTokioAsyncRead, HandleBytesToTokioAsyncRead}; +use crate::types::{FuturesAsyncReadStream, TokioAsyncReadStream}; + +delegate_components! { + new HandleToTokioAsyncRead { + HandlerComponent: + UseInputDelegate, + } +} + +delegate_components! { + new ToTokioAsyncReadHandlers { + FuturesAsyncReadStream: + FuturesToTokioAsyncRead, + TokioAsyncReadStream: + ReturnInput, + [ + Vec, + String, + ]: + HandleBytesToTokioAsyncRead, + } +} diff --git a/crates/hypershell-tokio-components/src/providers/futures_stream.rs b/crates/hypershell-tokio-components/src/providers/futures_stream.rs new file mode 100644 index 0000000..27876ae --- /dev/null +++ b/crates/hypershell-tokio-components/src/providers/futures_stream.rs @@ -0,0 +1,29 @@ +use cgp::extra::handler::{PipeHandlers, UseInputDelegate}; +use cgp::prelude::*; + +use crate::providers::{AsyncReadToStream, FuturesToTokioAsyncRead, HandleBytesToStream}; +use crate::types::{FuturesAsyncReadStream, TokioAsyncReadStream}; + +delegate_components! { + new HandleToFuturesStream { + HandlerComponent: + UseInputDelegate, + } +} + +delegate_components! { + new ToFuturesStreamHandlers { + FuturesAsyncReadStream: + PipeHandlers, + TokioAsyncReadStream: + AsyncReadToStream, + [ + Vec, + String, + ]: + HandleBytesToStream, + } +} diff --git a/crates/hypershell-tokio-components/src/providers/mod.rs b/crates/hypershell-tokio-components/src/providers/mod.rs index b7df3ee..5f03c02 100644 --- a/crates/hypershell-tokio-components/src/providers/mod.rs +++ b/crates/hypershell-tokio-components/src/providers/mod.rs @@ -1,5 +1,7 @@ +mod async_read; mod core_exec; mod file; +mod futures_stream; mod join_args; mod line; mod out; @@ -8,8 +10,10 @@ mod stream; mod streaming_exec; mod update_command; +pub use async_read::*; pub use core_exec::*; pub use file::*; +pub use futures_stream::*; pub use join_args::*; pub use line::*; pub use out::*; From be9542bc3ce5fe6b61e931332cf74a4769920969 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sun, 28 Jun 2026 12:56:21 +0200 Subject: [PATCH 04/37] Use new `#[derive_delegate]` attribute --- .../src/components/command_arg.rs | 6 ++---- .../src/components/method_arg.rs | 6 ++---- .../src/components/string_arg.rs | 6 ++---- .../hypershell-components/src/components/url_arg.rs | 6 ++---- .../hypershell-components/src/namespaces/prefixes.rs | 6 +++--- .../src/components/update_builder.rs | 6 ++---- .../src/components/update_command.rs | 6 ++---- .../src/namespaces/prefixes.rs | 12 +++++++----- 8 files changed, 22 insertions(+), 32 deletions(-) diff --git a/crates/hypershell-components/src/components/command_arg.rs b/crates/hypershell-components/src/components/command_arg.rs index 1c73bca..133ca7c 100644 --- a/crates/hypershell-components/src/components/command_arg.rs +++ b/crates/hypershell-components/src/components/command_arg.rs @@ -8,11 +8,9 @@ pub trait HasCommandArgType { type CommandArg; } -#[cgp_component { - provider: CommandArgExtractor, - derive_delegate: UseDelegate, -}] +#[cgp_component(CommandArgExtractor)] #[prefix(@hypershell.core in DefaultNamespace)] +#[derive_delegate(UseDelegate)] pub trait CanExtractCommandArg: HasCommandArgType { fn extract_command_arg(&self, _phantom: PhantomData) -> Self::CommandArg; } diff --git a/crates/hypershell-components/src/components/method_arg.rs b/crates/hypershell-components/src/components/method_arg.rs index 9fb3315..903b9d6 100644 --- a/crates/hypershell-components/src/components/method_arg.rs +++ b/crates/hypershell-components/src/components/method_arg.rs @@ -8,11 +8,9 @@ pub trait HasHttpMethodType { type HttpMethod; } -#[cgp_component { - provider: MethodArgExtractor, - derive_delegate: UseDelegate, -}] +#[cgp_component(MethodArgExtractor)] #[prefix(@hypershell.core in DefaultNamespace)] +#[derive_delegate(UseDelegate)] pub trait CanExtractMethodArg: HasHttpMethodType { fn extract_method_arg(&self, _phantom: PhantomData) -> Self::HttpMethod; } diff --git a/crates/hypershell-components/src/components/string_arg.rs b/crates/hypershell-components/src/components/string_arg.rs index 2f95a78..8fbec53 100644 --- a/crates/hypershell-components/src/components/string_arg.rs +++ b/crates/hypershell-components/src/components/string_arg.rs @@ -4,11 +4,9 @@ use core::marker::PhantomData; use cgp::core::component::UseDelegate; use cgp::prelude::*; -#[cgp_component { - provider: StringArgExtractor, - derive_delegate: UseDelegate, -}] +#[cgp_component(StringArgExtractor)] #[prefix(@hypershell.core in DefaultNamespace)] +#[derive_delegate(UseDelegate)] pub trait CanExtractStringArg { fn extract_string_arg(&self, _phantom: PhantomData) -> Cow<'_, str>; } diff --git a/crates/hypershell-components/src/components/url_arg.rs b/crates/hypershell-components/src/components/url_arg.rs index 53a01d0..ea2bbc5 100644 --- a/crates/hypershell-components/src/components/url_arg.rs +++ b/crates/hypershell-components/src/components/url_arg.rs @@ -8,11 +8,9 @@ pub trait HasUrlType { type Url; } -#[cgp_component { - provider: UrlArgExtractor, - derive_delegate: UseDelegate, -}] +#[cgp_component(UrlArgExtractor)] #[prefix(@hypershell.core in DefaultNamespace)] +#[derive_delegate(UseDelegate)] pub trait CanExtractUrlArg: HasUrlType + HasErrorType { fn extract_url_arg(&self, _phantom: PhantomData) -> Result; } diff --git a/crates/hypershell-components/src/namespaces/prefixes.rs b/crates/hypershell-components/src/namespaces/prefixes.rs index d293f58..b5a6bab 100644 --- a/crates/hypershell-components/src/namespaces/prefixes.rs +++ b/crates/hypershell-components/src/namespaces/prefixes.rs @@ -15,13 +15,13 @@ cgp_namespace! { @cgp.extra.HandlerComponent.> T: UseDelegate, - @cgp.extra.StringArgExtractorComponent.> T: + @hypershell.core.StringArgExtractorComponent.> T: UseDelegate, - @cgp.extra.CommandArgExtractorComponent.> T: + @hypershell.core.CommandArgExtractorComponent.> T: UseDelegate, - @cgp.extra.UrlArgExtractorComponent.> T: + @hypershell.core.UrlArgExtractorComponent.> T: UseDelegate, } } diff --git a/crates/hypershell-reqwest-components/src/components/update_builder.rs b/crates/hypershell-reqwest-components/src/components/update_builder.rs index 5e6e097..d7f1e1e 100644 --- a/crates/hypershell-reqwest-components/src/components/update_builder.rs +++ b/crates/hypershell-reqwest-components/src/components/update_builder.rs @@ -4,10 +4,8 @@ use cgp::core::component::UseDelegate; use cgp::prelude::*; use reqwest::RequestBuilder; -#[cgp_component { - provider: RequestBuilderUpdater, - derive_delegate: UseDelegate, -}] +#[cgp_component(RequestBuilderUpdater)] +#[derive_delegate(UseDelegate)] pub trait CanUpdateRequestBuilder: HasErrorType { fn update_request_builder( &self, diff --git a/crates/hypershell-tokio-components/src/components/update_command.rs b/crates/hypershell-tokio-components/src/components/update_command.rs index 37a26fb..3008400 100644 --- a/crates/hypershell-tokio-components/src/components/update_command.rs +++ b/crates/hypershell-tokio-components/src/components/update_command.rs @@ -4,11 +4,9 @@ use cgp::core::component::UseDelegate; use cgp::prelude::*; use tokio::process::Command; -#[cgp_component { - provider: CommandUpdater, - derive_delegate: UseDelegate, -}] +#[cgp_component(CommandUpdater)] #[prefix(@hypershell.tokio in DefaultNamespace)] +#[derive_delegate(UseDelegate)] pub trait CanUpdateCommand { fn update_command(&self, _phantom: PhantomData, command: &mut Command); } diff --git a/crates/hypershell-tokio-components/src/namespaces/prefixes.rs b/crates/hypershell-tokio-components/src/namespaces/prefixes.rs index 1976720..65acd43 100644 --- a/crates/hypershell-tokio-components/src/namespaces/prefixes.rs +++ b/crates/hypershell-tokio-components/src/namespaces/prefixes.rs @@ -1,12 +1,14 @@ -use cgp::prelude::{cgp_namespace, delegate_components}; +use cgp::prelude::{UseDelegate, cgp_namespace, delegate_components}; use hypershell_components::dsl::{FieldArgs, WithArgs}; -use hypershell_components::namespaces::HypershellHandlers; +use hypershell_components::namespaces::{HypershellHandlers, HypershellNamespace}; +use crate::components::CommandUpdaterComponent; use crate::dsl::{CoreExec, ToTokioAsyncRead}; cgp_namespace! { - HypershellNamespace { - + new TokioNamespace: HypershellNamespace { + @hypershell.tokio.CommandUpdaterComponent: + UseDelegate, } } @@ -26,6 +28,6 @@ delegate_components! { WithArgs, FieldArgs, ] => - @hypershell, + @hypershell.dsl.tokio.command.core, } } From 8b040a9c5d4da98623909c91ad6a726cd2855df3 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sun, 28 Jun 2026 13:22:15 +0200 Subject: [PATCH 05/37] Add combined Hypershell providers --- .../src/providers/combined.rs | 53 +++++++++++ .../src/providers/mod.rs | 2 + .../src/providers/combined.rs | 16 ++++ .../src/providers/mod.rs | 2 + .../src/providers/combined.rs | 61 +++++++++++++ .../src/providers/mod.rs | 2 + .../src/providers/combined.rs | 88 +++++++++++++++++++ .../src/providers/mod.rs | 2 + .../src/providers/combined.rs | 40 +++++++++ .../src/providers/mod.rs | 2 + 10 files changed, 268 insertions(+) create mode 100644 crates/hypershell-components/src/providers/combined.rs create mode 100644 crates/hypershell-json-components/src/providers/combined.rs create mode 100644 crates/hypershell-reqwest-components/src/providers/combined.rs create mode 100644 crates/hypershell-tokio-components/src/providers/combined.rs create mode 100644 crates/hypershell-tungstenite-components/src/providers/combined.rs diff --git a/crates/hypershell-components/src/providers/combined.rs b/crates/hypershell-components/src/providers/combined.rs new file mode 100644 index 0000000..e6b046f --- /dev/null +++ b/crates/hypershell-components/src/providers/combined.rs @@ -0,0 +1,53 @@ +use alloc::boxed::Box; + +use cgp::extra::handler::Promote; +use cgp::prelude::{HandlerComponent, delegate_components}; + +use crate::components::{ + CommandArgExtractorComponent, StringArgExtractorComponent, UrlArgExtractorComponent, +}; +use crate::dsl::{BytesToString, ConvertTo, FieldArg, JoinArgs, Pipe, StaticArg, Use}; +use crate::providers::{ + BoxHandler, Call, DecodeUtf8Bytes, ExtractFieldArg, ExtractStaticArg, ExtractStringCommandArg, + ExtractStringUrlArg, HandleConvert, HandlePipe, HandleUseProvider, JoinStringArgs, +}; + +delegate_components! { + new HypershellBaseProvider { + open { + HandlerComponent, + StringArgExtractorComponent, + CommandArgExtractorComponent, + UrlArgExtractorComponent, + }; + + @HandlerComponent.BytesToString: + DecodeUtf8Bytes, + @HandlerComponent. ConvertTo: + Promote, + @HandlerComponent. Pipe: + HandlePipe, + @HandlerComponent. Use: + HandleUseProvider, + @HandlerComponent. Box: + BoxHandler>, + + @StringArgExtractorComponent. StaticArg: + ExtractStaticArg, + @StringArgExtractorComponent. FieldArg: + ExtractFieldArg, + @StringArgExtractorComponent. JoinArgs: + JoinStringArgs, + + @CommandArgExtractorComponent.[ + StaticArg, + FieldArg, + ]: ExtractStringCommandArg, + + @UrlArgExtractorComponent.[ + StaticArg, + JoinArgs, + FieldArg, + ]: ExtractStringUrlArg, + } +} diff --git a/crates/hypershell-components/src/providers/mod.rs b/crates/hypershell-components/src/providers/mod.rs index 497e5de..71b4110 100644 --- a/crates/hypershell-components/src/providers/mod.rs +++ b/crates/hypershell-components/src/providers/mod.rs @@ -1,5 +1,6 @@ mod box_async; mod call; +mod combined; mod convert; mod method_arg; mod pipe; @@ -10,6 +11,7 @@ mod r#use; pub use box_async::*; pub use call::*; +pub use combined::*; pub use convert::*; pub use method_arg::*; pub use pipe::*; diff --git a/crates/hypershell-json-components/src/providers/combined.rs b/crates/hypershell-json-components/src/providers/combined.rs new file mode 100644 index 0000000..b68ee94 --- /dev/null +++ b/crates/hypershell-json-components/src/providers/combined.rs @@ -0,0 +1,16 @@ +use cgp::prelude::{HandlerComponent, delegate_components}; +use hypershell_components::dsl::{DecodeJson, EncodeJson}; + +use crate::providers::{HandleDecodeJson, HandleEncodeJson}; + +delegate_components! { + new HypershellJsonProvider { + open {HandlerComponent}; + + @HandlerComponent. DecodeJson: + HandleDecodeJson, + + @HandlerComponent.EncodeJson: + HandleEncodeJson, + } +} diff --git a/crates/hypershell-json-components/src/providers/mod.rs b/crates/hypershell-json-components/src/providers/mod.rs index 7298495..1d84097 100644 --- a/crates/hypershell-json-components/src/providers/mod.rs +++ b/crates/hypershell-json-components/src/providers/mod.rs @@ -1,3 +1,5 @@ +mod combined; mod handler; +pub use combined::*; pub use handler::*; diff --git a/crates/hypershell-reqwest-components/src/providers/combined.rs b/crates/hypershell-reqwest-components/src/providers/combined.rs new file mode 100644 index 0000000..afb6efb --- /dev/null +++ b/crates/hypershell-reqwest-components/src/providers/combined.rs @@ -0,0 +1,61 @@ +use cgp::extra::handler::PipeHandlers; +use cgp::prelude::*; +use hypershell_components::components::{ + CommandArgExtractorComponent, MethodArgExtractorComponent, StringArgExtractorComponent, + UrlArgExtractorComponent, +}; +use hypershell_components::dsl::{ + GetMethod, Header, PostMethod, SimpleHttpRequest, StreamingHttpRequest, UrlEncodeArg, + WithHeaders, +}; +use hypershell_tokio_components::providers::{HandleToTokioAsyncRead, WrapFuturesAsyncRead}; + +use crate::components::RequestBuilderUpdaterComponent; +use crate::dsl::CoreHttpRequest; +use crate::providers::{ + ExtractReqwestMethod, HandleCoreHttpRequest, HandleSimpleHttpRequest, + HandleStreamingHttpRequest, StreamToBody, UpdateRequestHeader, UpdateRequestHeaders, + UrlEncodeStringArg, +}; + +delegate_components! { + new HypershellReqwestProvider { + open { + HandlerComponent, + StringArgExtractorComponent, + CommandArgExtractorComponent, + UrlArgExtractorComponent, + MethodArgExtractorComponent, + RequestBuilderUpdaterComponent, + }; + + @HandlerComponent. SimpleHttpRequest: + HandleSimpleHttpRequest, + + @HandlerComponent. StreamingHttpRequest: + PipeHandlers, + + @HandlerComponent. CoreHttpRequest: + HandleCoreHttpRequest, + + @UrlArgExtractorComponent.[ + GetMethod, + PostMethod, + ]: + ExtractReqwestMethod, + + @StringArgExtractorComponent. UrlEncodeArg: + UrlEncodeStringArg, + + @RequestBuilderUpdaterComponent. WithHeaders: + UpdateRequestHeaders, + + @RequestBuilderUpdaterComponent. Header: + UpdateRequestHeader, + } +} diff --git a/crates/hypershell-reqwest-components/src/providers/mod.rs b/crates/hypershell-reqwest-components/src/providers/mod.rs index 4330ab5..75a8466 100644 --- a/crates/hypershell-reqwest-components/src/providers/mod.rs +++ b/crates/hypershell-reqwest-components/src/providers/mod.rs @@ -1,3 +1,4 @@ +mod combined; mod convert; mod core_request; mod headers; @@ -6,6 +7,7 @@ mod simple_request; mod streaming_request; mod url_encode; +pub use combined::*; pub use convert::*; pub use core_request::*; pub use headers::*; diff --git a/crates/hypershell-tokio-components/src/providers/combined.rs b/crates/hypershell-tokio-components/src/providers/combined.rs new file mode 100644 index 0000000..3d557c7 --- /dev/null +++ b/crates/hypershell-tokio-components/src/providers/combined.rs @@ -0,0 +1,88 @@ +use std::path::PathBuf; + +use cgp::extra::handler::PipeHandlers; +use cgp::prelude::*; +use hypershell_components::components::{ + CommandArgExtractorComponent, CommandArgTypeProviderComponent, StringArgExtractorComponent, + UrlArgExtractorComponent, +}; +use hypershell_components::dsl::{ + BytesToStream, FieldArgs, JoinArgs, ReadFile, SimpleExec, StreamToBytes, StreamToStdout, + StreamToString, StreamingExec, WithArgs, WriteFile, +}; + +use crate::components::CommandUpdaterComponent; +use crate::dsl::{CoreExec, ToTokioAsyncRead}; +use crate::providers::{ + ExtractArgs, ExtractFieldArgs, HandleBytesToTokioAsyncRead, HandleCoreExec, HandleReadFile, + HandleSimpleExec, HandleStreamToStdout, HandleStreamingExec, HandleToTokioAsyncRead, + HandleTokioAsyncReadToBytes, HandleTokioAsyncReadToString, HandleWriteFile, JoinExtractArgs, + WrapTokioAsyncRead, +}; + +delegate_components! { + new HypershellTokioProvider { + open { + HandlerComponent, + StringArgExtractorComponent, + CommandArgExtractorComponent, + UrlArgExtractorComponent, + CommandUpdaterComponent, + }; + + CommandArgTypeProviderComponent: + UseType, + + @HandlerComponent. SimpleExec: + HandleSimpleExec, + + @HandlerComponent. StreamingExec: + PipeHandlers, + + @HandlerComponent. CoreExec: + HandleCoreExec, + + @HandlerComponent. ReadFile: + PipeHandlers, + + @HandlerComponent. WriteFile: + PipeHandlers, + + @HandlerComponent.StreamToBytes: + HandleTokioAsyncReadToBytes, + + @HandlerComponent.StreamToString: + HandleTokioAsyncReadToString, + + @HandlerComponent.BytesToStream: + HandleBytesToTokioAsyncRead, + + @HandlerComponent.StreamToStdout: + PipeHandlers, + + @HandlerComponent.ToTokioAsyncRead: + HandleToTokioAsyncRead, + + @CommandArgExtractorComponent. JoinArgs: + JoinExtractArgs, + + @CommandUpdaterComponent. WithArgs: + ExtractArgs, + + @CommandUpdaterComponent. FieldArgs: + ExtractFieldArgs, + } +} diff --git a/crates/hypershell-tokio-components/src/providers/mod.rs b/crates/hypershell-tokio-components/src/providers/mod.rs index 5f03c02..08d9cb8 100644 --- a/crates/hypershell-tokio-components/src/providers/mod.rs +++ b/crates/hypershell-tokio-components/src/providers/mod.rs @@ -1,4 +1,5 @@ mod async_read; +mod combined; mod core_exec; mod file; mod futures_stream; @@ -11,6 +12,7 @@ mod streaming_exec; mod update_command; pub use async_read::*; +pub use combined::*; pub use core_exec::*; pub use file::*; pub use futures_stream::*; diff --git a/crates/hypershell-tungstenite-components/src/providers/combined.rs b/crates/hypershell-tungstenite-components/src/providers/combined.rs new file mode 100644 index 0000000..4e06f7c --- /dev/null +++ b/crates/hypershell-tungstenite-components/src/providers/combined.rs @@ -0,0 +1,40 @@ +use cgp::extra::handler::PipeHandlers; +use cgp::prelude::*; +use hypershell_components::dsl::{BytesToStream, WebSocket}; +use hypershell_components::providers::Call; +use hypershell_tokio_components::providers::{FuturesToTokioAsyncRead, WrapFuturesAsyncRead}; +use hypershell_tokio_components::types::{FuturesAsyncReadStream, TokioAsyncReadStream}; + +use crate::providers::HandleWebsocket; + +delegate_components! { + new HypershellTungsteniteProvider { + open {HandlerComponent}; + + @HandlerComponent + . WebSocket + . FuturesAsyncReadStream: + PipeHandlers, + + @HandlerComponent + . WebSocket + . TokioAsyncReadStream: + PipeHandlers, + + @HandlerComponent + . WebSocket + .Vec: + PipeHandlers, + HandleWebsocket, + WrapFuturesAsyncRead, + ]>, + } +} diff --git a/crates/hypershell-tungstenite-components/src/providers/mod.rs b/crates/hypershell-tungstenite-components/src/providers/mod.rs index 187b841..52d6026 100644 --- a/crates/hypershell-tungstenite-components/src/providers/mod.rs +++ b/crates/hypershell-tungstenite-components/src/providers/mod.rs @@ -1,3 +1,5 @@ +mod combined; mod websocket; +pub use combined::*; pub use websocket::*; From d7897571811c70dbc427ff9c94791c9d7f503e85 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sun, 28 Jun 2026 13:55:53 +0200 Subject: [PATCH 06/37] Add new `HypershellNamespace` with default impls --- .../hypershell-json-components/src/presets.rs | 4 +- .../src/providers/combined.rs | 6 +- .../src/components/client.rs | 1 + .../src/components/update_builder.rs | 1 + crates/hypershell/src/lib.rs | 1 + crates/hypershell/src/namespaces/handlers.rs | 153 +++++++++++++++--- crates/hypershell/src/providers/error.rs | 35 ++++ crates/hypershell/src/providers/mod.rs | 3 + 8 files changed, 181 insertions(+), 23 deletions(-) create mode 100644 crates/hypershell/src/providers/error.rs create mode 100644 crates/hypershell/src/providers/mod.rs diff --git a/crates/hypershell-json-components/src/presets.rs b/crates/hypershell-json-components/src/presets.rs index 140bd06..1cc6f52 100644 --- a/crates/hypershell-json-components/src/presets.rs +++ b/crates/hypershell-json-components/src/presets.rs @@ -17,10 +17,10 @@ mod preset { cgp_preset! { #[wrap_provider(UseDelegate)] JsonHandlerPreset { - DecodeJson: - HandleDecodeJson, EncodeJson: HandleEncodeJson, + DecodeJson: + HandleDecodeJson, } } } diff --git a/crates/hypershell-json-components/src/providers/combined.rs b/crates/hypershell-json-components/src/providers/combined.rs index b68ee94..5eac557 100644 --- a/crates/hypershell-json-components/src/providers/combined.rs +++ b/crates/hypershell-json-components/src/providers/combined.rs @@ -7,10 +7,10 @@ delegate_components! { new HypershellJsonProvider { open {HandlerComponent}; - @HandlerComponent. DecodeJson: - HandleDecodeJson, - @HandlerComponent.EncodeJson: HandleEncodeJson, + + @HandlerComponent. DecodeJson: + HandleDecodeJson, } } diff --git a/crates/hypershell-reqwest-components/src/components/client.rs b/crates/hypershell-reqwest-components/src/components/client.rs index 5f8f16e..cca2a39 100644 --- a/crates/hypershell-reqwest-components/src/components/client.rs +++ b/crates/hypershell-reqwest-components/src/components/client.rs @@ -2,6 +2,7 @@ use cgp::prelude::*; use reqwest::Client; #[cgp_getter] +#[prefix(@hypershell.reqwest in DefaultNamespace)] pub trait HasReqwestClient { fn request_client(&self) -> &Client; } diff --git a/crates/hypershell-reqwest-components/src/components/update_builder.rs b/crates/hypershell-reqwest-components/src/components/update_builder.rs index d7f1e1e..640b3e1 100644 --- a/crates/hypershell-reqwest-components/src/components/update_builder.rs +++ b/crates/hypershell-reqwest-components/src/components/update_builder.rs @@ -6,6 +6,7 @@ use reqwest::RequestBuilder; #[cgp_component(RequestBuilderUpdater)] #[derive_delegate(UseDelegate)] +#[prefix(@hypershell.reqwest in DefaultNamespace)] pub trait CanUpdateRequestBuilder: HasErrorType { fn update_request_builder( &self, diff --git a/crates/hypershell/src/lib.rs b/crates/hypershell/src/lib.rs index e8edf64..4a34c8b 100644 --- a/crates/hypershell/src/lib.rs +++ b/crates/hypershell/src/lib.rs @@ -2,3 +2,4 @@ pub mod contexts; pub mod namespaces; pub mod prelude; pub mod presets; +pub mod providers; diff --git a/crates/hypershell/src/namespaces/handlers.rs b/crates/hypershell/src/namespaces/handlers.rs index b1fa8d2..423fb3e 100644 --- a/crates/hypershell/src/namespaces/handlers.rs +++ b/crates/hypershell/src/namespaces/handlers.rs @@ -1,22 +1,139 @@ -use cgp::prelude::{HandlerComponent, cgp_namespace}; -use hypershell_components::namespaces::{BaseHandlerImpls, HypershellNamespace}; -use hypershell_tokio_components::namespaces::TokioHandlerImpls; +use core::convert::Infallible; +use core::str::Utf8Error; + +use cgp::core::error::{ErrorRaiserComponent, ErrorTypeProviderComponent, ErrorWrapperComponent}; +use cgp::prelude::*; +use cgp_error_anyhow::{DebugAnyhowError, Error, UseAnyhowError}; +use hypershell_components::components::{ + CommandArgExtractorComponent, StringArgExtractorComponent, UrlArgExtractorComponent, +}; +use hypershell_components::dsl::{ + BytesToStream, BytesToString, ConvertTo, DecodeJson, EncodeJson, FieldArg, FieldArgs, + GetMethod, Header, JoinArgs, Pipe, PostMethod, ReadFile, SimpleExec, SimpleHttpRequest, + StaticArg, StreamToBytes, StreamToStdout, StreamToString, StreamingExec, StreamingHttpRequest, + UrlEncodeArg, Use, WithArgs, WithHeaders, WriteFile, +}; +use hypershell_components::providers::HypershellBaseProvider; +use hypershell_json_components::providers::HypershellJsonProvider; +use hypershell_reqwest_components::components::{ + RequestBuilderUpdaterComponent, ReqwestClientGetterComponent, +}; +use hypershell_reqwest_components::dsl::CoreHttpRequest; +use hypershell_reqwest_components::providers::{ErrorResponse, HypershellReqwestProvider}; +use hypershell_tokio_components::components::CommandUpdaterComponent; +use hypershell_tokio_components::dsl::{CoreExec, ToTokioAsyncRead}; +use hypershell_tokio_components::providers::{ExecOutputError, HypershellTokioProvider}; +use reqwest::header::{InvalidHeaderName, InvalidHeaderValue}; +use url::ParseError; + +use crate::providers::HypershellErrorHandler; cgp_namespace! { - new HypershellDefautHandlers: HypershellNamespace { - for in BaseHandlerImpls { - @hypershell.dsl.handler.core.HandlerComponent.Key: - Value, - } - - for in TokioHandlerImpls { - @hypershell.dsl.handler.[ - cli, - file, - stream, - tokio, - ].HandlerComponent.Key: - Value, - } + new HypershellNamespace: DefaultNamespace { + @cgp.core.error.ErrorTypeProviderComponent: + UseAnyhowError, + + @cgp.core.error.ErrorRaiserComponent.[ + Error, + Infallible, + std::io::Error, + Utf8Error, + reqwest::Error, + ParseError, + InvalidHeaderName, + InvalidHeaderValue, + serde_json::Error, + ExecOutputError, + ErrorResponse, + ]: + HypershellErrorHandler, + + @cgp.core.error.ErrorWrapperComponent: + DebugAnyhowError, + + @hypershell.reqwest.ReqwestClientGetterComponent: + UseField, + + @cgp.extra.handler.HandlerComponent.[ + BytesToString, + ConvertTo, + Pipe, + Use, + Box, + ]: + HypershellBaseProvider, + + @cgp.extra.handler.HandlerComponent.[ + SimpleExec, + StreamingExec, + CoreExec, + ReadFile, + WriteFile, + StreamToBytes, + StreamToString, + BytesToStream, + StreamToStdout, + ToTokioAsyncRead, + ]: + HypershellTokioProvider, + + @cgp.extra.handler.HandlerComponent.[ + SimpleHttpRequest, + StreamingHttpRequest, + CoreHttpRequest, + ]: + HypershellReqwestProvider, + + @cgp.extra.handler.HandlerComponent.[ + EncodeJson, + DecodeJson, + ]: + HypershellJsonProvider, + + @hypershell.core.{ + StringArgExtractorComponent.[ + StaticArg, + FieldArg, + JoinArgs, + ], + CommandArgExtractorComponent.[ + StaticArg, + FieldArg, + ], + UrlArgExtractorComponent.[ + StaticArg, + JoinArgs, + FieldArg, + ], + }: + HypershellBaseProvider, + + @hypershell.{ + core.CommandArgExtractorComponent.[ + JoinArgs, + ], + tokio.CommandUpdaterComponent.[ + WithArgs, + FieldArgs, + ], + }: + HypershellTokioProvider, + + @hypershell.{ + core.{ + StringArgExtractorComponent.[ + UrlEncodeArg, + ], + UrlArgExtractorComponent.[ + GetMethod, + PostMethod, + ], + }, + reqwest.RequestBuilderUpdaterComponent.[ + WithHeaders, + Header, + ], + }: + HypershellReqwestProvider, } } diff --git a/crates/hypershell/src/providers/error.rs b/crates/hypershell/src/providers/error.rs new file mode 100644 index 0000000..fcbb990 --- /dev/null +++ b/crates/hypershell/src/providers/error.rs @@ -0,0 +1,35 @@ +use core::convert::Infallible; +use core::str::Utf8Error; + +use cgp::core::error::ErrorRaiserComponent; +use cgp::extra::error::{RaiseInfallible, ReturnError}; +use cgp::prelude::delegate_components; +use cgp_error_anyhow::{DebugAnyhowError, Error, RaiseAnyhowError}; +use hypershell_reqwest_components::providers::ErrorResponse; +use hypershell_tokio_components::providers::ExecOutputError; +use reqwest::header::{InvalidHeaderName, InvalidHeaderValue}; +use url::ParseError; + +delegate_components! { + new HypershellErrorHandler { + open {ErrorRaiserComponent}; + + Error: ReturnError, + Infallible: RaiseInfallible, + [ + std::io::Error, + Utf8Error, + reqwest::Error, + ParseError, + InvalidHeaderName, + InvalidHeaderValue, + serde_json::Error, + ]: + RaiseAnyhowError, + [ + ExecOutputError, + ErrorResponse, + ]: + DebugAnyhowError, + } +} diff --git a/crates/hypershell/src/providers/mod.rs b/crates/hypershell/src/providers/mod.rs new file mode 100644 index 0000000..3925f93 --- /dev/null +++ b/crates/hypershell/src/providers/mod.rs @@ -0,0 +1,3 @@ +mod error; + +pub use error::*; From 2b4f49f86590b26e2fe9613079fde8b1530c86c3 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sun, 28 Jun 2026 14:30:22 +0200 Subject: [PATCH 07/37] Use new namespace in `HypershellHttp` and `HypershellCli` --- .../src/components/command_arg.rs | 1 + .../src/components/method_arg.rs | 1 + .../src/components/url_arg.rs | 1 + .../src/providers/combined.rs | 14 +++++++++++--- crates/hypershell/src/contexts/cli.rs | 9 +++++++-- crates/hypershell/src/contexts/http.rs | 9 +++++++-- crates/hypershell/src/namespaces/handlers.rs | 11 +++++++++-- crates/hypershell/src/providers/error.rs | 11 +++++++---- 8 files changed, 44 insertions(+), 13 deletions(-) diff --git a/crates/hypershell-components/src/components/command_arg.rs b/crates/hypershell-components/src/components/command_arg.rs index 133ca7c..e3de96f 100644 --- a/crates/hypershell-components/src/components/command_arg.rs +++ b/crates/hypershell-components/src/components/command_arg.rs @@ -4,6 +4,7 @@ use cgp::core::component::UseDelegate; use cgp::prelude::*; #[cgp_type] +#[prefix(@hypershell.core in DefaultNamespace)] pub trait HasCommandArgType { type CommandArg; } diff --git a/crates/hypershell-components/src/components/method_arg.rs b/crates/hypershell-components/src/components/method_arg.rs index 903b9d6..5f4b040 100644 --- a/crates/hypershell-components/src/components/method_arg.rs +++ b/crates/hypershell-components/src/components/method_arg.rs @@ -4,6 +4,7 @@ use cgp::core::component::UseDelegate; use cgp::prelude::*; #[cgp_type] +#[prefix(@hypershell.core in DefaultNamespace)] pub trait HasHttpMethodType { type HttpMethod; } diff --git a/crates/hypershell-components/src/components/url_arg.rs b/crates/hypershell-components/src/components/url_arg.rs index ea2bbc5..56b92e9 100644 --- a/crates/hypershell-components/src/components/url_arg.rs +++ b/crates/hypershell-components/src/components/url_arg.rs @@ -4,6 +4,7 @@ use cgp::core::component::UseDelegate; use cgp::prelude::*; #[cgp_type] +#[prefix(@hypershell.core in DefaultNamespace)] pub trait HasUrlType { type Url; } diff --git a/crates/hypershell-reqwest-components/src/providers/combined.rs b/crates/hypershell-reqwest-components/src/providers/combined.rs index afb6efb..8b2b3ef 100644 --- a/crates/hypershell-reqwest-components/src/providers/combined.rs +++ b/crates/hypershell-reqwest-components/src/providers/combined.rs @@ -1,14 +1,16 @@ use cgp::extra::handler::PipeHandlers; use cgp::prelude::*; use hypershell_components::components::{ - CommandArgExtractorComponent, MethodArgExtractorComponent, StringArgExtractorComponent, - UrlArgExtractorComponent, + CommandArgExtractorComponent, HttpMethodTypeProviderComponent, MethodArgExtractorComponent, + StringArgExtractorComponent, UrlArgExtractorComponent, UrlTypeProviderComponent, }; use hypershell_components::dsl::{ GetMethod, Header, PostMethod, SimpleHttpRequest, StreamingHttpRequest, UrlEncodeArg, WithHeaders, }; use hypershell_tokio_components::providers::{HandleToTokioAsyncRead, WrapFuturesAsyncRead}; +use reqwest::Method; +use url::Url; use crate::components::RequestBuilderUpdaterComponent; use crate::dsl::CoreHttpRequest; @@ -29,6 +31,12 @@ delegate_components! { RequestBuilderUpdaterComponent, }; + HttpMethodTypeProviderComponent: + UseType, + + UrlTypeProviderComponent: + UseType, + @HandlerComponent. SimpleHttpRequest: HandleSimpleHttpRequest, @@ -43,7 +51,7 @@ delegate_components! { @HandlerComponent. CoreHttpRequest: HandleCoreHttpRequest, - @UrlArgExtractorComponent.[ + @MethodArgExtractorComponent.[ GetMethod, PostMethod, ]: diff --git a/crates/hypershell/src/contexts/cli.rs b/crates/hypershell/src/contexts/cli.rs index f4f33f7..3367bca 100644 --- a/crates/hypershell/src/contexts/cli.rs +++ b/crates/hypershell/src/contexts/cli.rs @@ -1,6 +1,11 @@ use cgp::prelude::*; -use crate::presets::HypershellPreset; +use crate::namespaces::HypershellNamespace; -#[cgp_inherit(HypershellPreset)] pub struct HypershellCli; + +delegate_components! { + HypershellCli { + namespace HypershellNamespace; + } +} diff --git a/crates/hypershell/src/contexts/http.rs b/crates/hypershell/src/contexts/http.rs index 6ac5404..f0a3bbb 100644 --- a/crates/hypershell/src/contexts/http.rs +++ b/crates/hypershell/src/contexts/http.rs @@ -1,10 +1,15 @@ use cgp::prelude::*; use reqwest::Client; -use crate::presets::HypershellPreset; +use crate::namespaces::HypershellNamespace; -#[cgp_inherit(HypershellPreset)] #[derive(HasField)] pub struct HypershellHttp { pub http_client: Client, } + +delegate_components! { + HypershellHttp { + namespace HypershellNamespace; + } +} diff --git a/crates/hypershell/src/namespaces/handlers.rs b/crates/hypershell/src/namespaces/handlers.rs index 423fb3e..0e6a04d 100644 --- a/crates/hypershell/src/namespaces/handlers.rs +++ b/crates/hypershell/src/namespaces/handlers.rs @@ -5,7 +5,9 @@ use cgp::core::error::{ErrorRaiserComponent, ErrorTypeProviderComponent, ErrorWr use cgp::prelude::*; use cgp_error_anyhow::{DebugAnyhowError, Error, UseAnyhowError}; use hypershell_components::components::{ - CommandArgExtractorComponent, StringArgExtractorComponent, UrlArgExtractorComponent, + CommandArgExtractorComponent, CommandArgTypeProviderComponent, HttpMethodTypeProviderComponent, + MethodArgExtractorComponent, StringArgExtractorComponent, UrlArgExtractorComponent, + UrlTypeProviderComponent, }; use hypershell_components::dsl::{ BytesToStream, BytesToString, ConvertTo, DecodeJson, EncodeJson, FieldArg, FieldArgs, @@ -51,6 +53,9 @@ cgp_namespace! { @cgp.core.error.ErrorWrapperComponent: DebugAnyhowError, + @hypershell.core.CommandArgTypeProviderComponent: + HypershellTokioProvider, + @hypershell.reqwest.ReqwestClientGetterComponent: UseField, @@ -121,10 +126,12 @@ cgp_namespace! { @hypershell.{ core.{ + HttpMethodTypeProviderComponent, + UrlTypeProviderComponent, StringArgExtractorComponent.[ UrlEncodeArg, ], - UrlArgExtractorComponent.[ + MethodArgExtractorComponent.[ GetMethod, PostMethod, ], diff --git a/crates/hypershell/src/providers/error.rs b/crates/hypershell/src/providers/error.rs index fcbb990..e41ef37 100644 --- a/crates/hypershell/src/providers/error.rs +++ b/crates/hypershell/src/providers/error.rs @@ -14,9 +14,11 @@ delegate_components! { new HypershellErrorHandler { open {ErrorRaiserComponent}; - Error: ReturnError, - Infallible: RaiseInfallible, - [ + @ErrorRaiserComponent.Error: ReturnError, + + @ErrorRaiserComponent.Infallible: RaiseInfallible, + + @ErrorRaiserComponent.[ std::io::Error, Utf8Error, reqwest::Error, @@ -26,7 +28,8 @@ delegate_components! { serde_json::Error, ]: RaiseAnyhowError, - [ + + @ErrorRaiserComponent.[ ExecOutputError, ErrorResponse, ]: From 10185e64e46fee231b195ee55c10d213e66ff292 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sun, 28 Jun 2026 14:46:39 +0200 Subject: [PATCH 08/37] Use HypershellNamespace with more examples --- .cargo/config.toml | 2 ++ crates/hypershell-examples/examples/github_issues.rs | 11 ++++++++--- crates/hypershell-examples/examples/hello_name.rs | 8 +++++++- .../hypershell-examples/examples/http_checksum_cli.rs | 8 +++++++- .../examples/http_checksum_client.rs | 8 +++++++- crates/hypershell-examples/examples/nix_manual.rs | 9 +++++++-- crates/hypershell-examples/examples/save_webpage.rs | 8 +++++++- rust-toolchain.toml | 3 +-- 8 files changed, 46 insertions(+), 11 deletions(-) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..a159a79 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +# [build] +# rustflags = ["-Z", "next-solver=globally"] diff --git a/crates/hypershell-examples/examples/github_issues.rs b/crates/hypershell-examples/examples/github_issues.rs index 6198f63..0ad51bc 100644 --- a/crates/hypershell-examples/examples/github_issues.rs +++ b/crates/hypershell-examples/examples/github_issues.rs @@ -25,8 +25,8 @@ // The `main` function sets up the `MyApp` context with the required values, // executes the `Program` using `app.handle`, and prints the fetched issues. +use hypershell::namespaces::HypershellNamespace; use hypershell::prelude::*; -use hypershell::presets::HypershellPreset; use reqwest::Client; use serde::Deserialize; @@ -44,14 +44,13 @@ pub type Program = hypershell! { WithHeaders [ Header< StaticArg<"User-Agent">, - StaticArg<"hypershell">, + StaticArg<"hypershells">, > ], > | DecodeJson> }; -#[cgp_inherit(HypershellPreset)] #[derive(HasField)] pub struct MyApp { pub http_client: Client, @@ -60,6 +59,12 @@ pub struct MyApp { pub github_repo: String, } +delegate_components! { + MyApp { + namespace HypershellNamespace; + } +} + #[derive(Debug, Deserialize)] #[allow(dead_code)] pub struct Issue { diff --git a/crates/hypershell-examples/examples/hello_name.rs b/crates/hypershell-examples/examples/hello_name.rs index 4d68abe..a43c811 100644 --- a/crates/hypershell-examples/examples/hello_name.rs +++ b/crates/hypershell-examples/examples/hello_name.rs @@ -25,6 +25,7 @@ // The `main` function creates an instance of `MyApp`, sets the `name`, and // executes the program. +use hypershell::namespaces::HypershellNamespace; use hypershell::prelude::*; pub type Program = hypershell! { @@ -38,12 +39,17 @@ pub type Program = hypershell! { | StreamToStdout }; -#[cgp_inherit(HypershellPreset)] #[derive(HasField)] pub struct MyApp { pub name: String, } +delegate_components! { + MyApp { + namespace HypershellNamespace; + } +} + #[tokio::main] async fn main() -> Result<(), Error> { let app = MyApp { diff --git a/crates/hypershell-examples/examples/http_checksum_cli.rs b/crates/hypershell-examples/examples/http_checksum_cli.rs index 0b2a568..90e6db2 100644 --- a/crates/hypershell-examples/examples/http_checksum_cli.rs +++ b/crates/hypershell-examples/examples/http_checksum_cli.rs @@ -26,6 +26,7 @@ // // The `main` function initializes `MyApp` with a URL and executes the program. +use hypershell::namespaces::HypershellNamespace; use hypershell::prelude::*; pub type Program = hypershell! { @@ -51,12 +52,17 @@ pub type Program = hypershell! { | StreamToStdout }; -#[cgp_inherit(HypershellPreset)] #[derive(HasField)] pub struct MyApp { pub url: String, } +delegate_components! { + MyApp { + namespace HypershellNamespace; + } +} + #[tokio::main] async fn main() -> Result<(), Error> { let app = MyApp { diff --git a/crates/hypershell-examples/examples/http_checksum_client.rs b/crates/hypershell-examples/examples/http_checksum_client.rs index de23b81..aeea489 100644 --- a/crates/hypershell-examples/examples/http_checksum_client.rs +++ b/crates/hypershell-examples/examples/http_checksum_client.rs @@ -26,6 +26,7 @@ // // The `main` function initializes the `MyApp` context and executes the program. +use hypershell::namespaces::HypershellNamespace; use hypershell::prelude::*; use reqwest::Client; @@ -51,13 +52,18 @@ pub type Program = hypershell! { | StreamToStdout }; -#[cgp_inherit(HypershellPreset)] #[derive(HasField)] pub struct MyApp { pub http_client: Client, pub url: String, } +delegate_components! { + MyApp { + namespace HypershellNamespace; + } +} + #[tokio::main] async fn main() -> Result<(), Error> { let app = MyApp { diff --git a/crates/hypershell-examples/examples/nix_manual.rs b/crates/hypershell-examples/examples/nix_manual.rs index ff7f472..4d93d94 100644 --- a/crates/hypershell-examples/examples/nix_manual.rs +++ b/crates/hypershell-examples/examples/nix_manual.rs @@ -24,8 +24,8 @@ // // The `main` function initializes the `MyApp` context and runs the program. +use hypershell::namespaces::HypershellNamespace; use hypershell::prelude::*; -use hypershell::presets::HypershellPreset; use reqwest::Client; pub type Program = hypershell! { @@ -51,13 +51,18 @@ pub type Program = hypershell! { | StreamToStdout }; -#[cgp_inherit(HypershellPreset)] #[derive(HasField)] pub struct MyApp { pub http_client: Client, pub keyword: String, } +delegate_components! { + MyApp { + namespace HypershellNamespace; + } +} + #[tokio::main] async fn main() -> Result<(), Error> { let app = MyApp { diff --git a/crates/hypershell-examples/examples/save_webpage.rs b/crates/hypershell-examples/examples/save_webpage.rs index 4c0d0b5..d28ea88 100644 --- a/crates/hypershell-examples/examples/save_webpage.rs +++ b/crates/hypershell-examples/examples/save_webpage.rs @@ -19,6 +19,7 @@ // runs the program. A confirmation message is printed to the console upon // completion. +use hypershell::namespaces::HypershellNamespace; use hypershell::prelude::*; use reqwest::Client; @@ -31,7 +32,6 @@ pub type Program = hypershell! { | WriteFile> }; -#[cgp_inherit(HypershellPreset)] #[derive(HasField)] pub struct MyApp { pub http_client: Client, @@ -39,6 +39,12 @@ pub struct MyApp { pub file_path: String, } +delegate_components! { + MyApp { + namespace HypershellNamespace; + } +} + #[tokio::main] async fn main() -> Result<(), Error> { let app = MyApp { diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 71223b6..292fe49 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,2 @@ [toolchain] -channel = "1.93.1" -profile = "default" +channel = "stable" From ac00a65eddc20f0f34214c056795009df8edeede Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sun, 28 Jun 2026 14:52:20 +0200 Subject: [PATCH 09/37] Implement checksum namespace --- .../examples/http_checksum_native.rs | 9 +++++++-- crates/hypershell-examples/src/lib.rs | 1 + .../src/namespaces/checksum.rs | 15 ++++++++++++++ .../hypershell-examples/src/namespaces/mod.rs | 3 +++ .../src/providers/checksum.rs | 20 +++++++++++++++++++ .../hypershell-examples/src/providers/mod.rs | 2 ++ 6 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 crates/hypershell-examples/src/namespaces/checksum.rs create mode 100644 crates/hypershell-examples/src/namespaces/mod.rs create mode 100644 crates/hypershell-examples/src/providers/checksum.rs diff --git a/crates/hypershell-examples/examples/http_checksum_native.rs b/crates/hypershell-examples/examples/http_checksum_native.rs index 5a78768..8314014 100644 --- a/crates/hypershell-examples/examples/http_checksum_native.rs +++ b/crates/hypershell-examples/examples/http_checksum_native.rs @@ -31,7 +31,7 @@ #![recursion_limit = "256"] use hypershell::prelude::*; -use hypershell_examples::presets::HypershellChecksumPreset; +use hypershell_examples::namespaces::HypershellChecksumNamespace; use hypershell_hash_components::dsl::{BytesToHex, Checksum}; use reqwest::Client; use sha2::Sha256; @@ -47,13 +47,18 @@ pub type Program = hypershell! { | StreamToStdout }; -#[cgp_inherit(HypershellChecksumPreset)] #[derive(HasField)] pub struct MyApp { pub http_client: Client, pub url: String, } +delegate_components! { + MyApp { + namespace HypershellChecksumNamespace; + } +} + #[tokio::main] async fn main() -> Result<(), Error> { let app = MyApp { diff --git a/crates/hypershell-examples/src/lib.rs b/crates/hypershell-examples/src/lib.rs index 3efa9e5..8832e08 100644 --- a/crates/hypershell-examples/src/lib.rs +++ b/crates/hypershell-examples/src/lib.rs @@ -1,3 +1,4 @@ pub mod dsl; +pub mod namespaces; pub mod presets; pub mod providers; diff --git a/crates/hypershell-examples/src/namespaces/checksum.rs b/crates/hypershell-examples/src/namespaces/checksum.rs new file mode 100644 index 0000000..e70609e --- /dev/null +++ b/crates/hypershell-examples/src/namespaces/checksum.rs @@ -0,0 +1,15 @@ +use cgp::prelude::{HandlerComponent, cgp_namespace}; +use hypershell::namespaces::HypershellNamespace; +use hypershell_hash_components::dsl::{BytesToHex, Checksum}; + +use crate::providers::HypershellChecksumProvider; + +cgp_namespace! { + new HypershellChecksumNamespace: HypershellNamespace { + @cgp.extra.handler.HandlerComponent.[ + Checksum, + BytesToHex, + ]: + HypershellChecksumProvider, + } +} diff --git a/crates/hypershell-examples/src/namespaces/mod.rs b/crates/hypershell-examples/src/namespaces/mod.rs new file mode 100644 index 0000000..379293d --- /dev/null +++ b/crates/hypershell-examples/src/namespaces/mod.rs @@ -0,0 +1,3 @@ +mod checksum; + +pub use checksum::*; diff --git a/crates/hypershell-examples/src/providers/checksum.rs b/crates/hypershell-examples/src/providers/checksum.rs new file mode 100644 index 0000000..bb07695 --- /dev/null +++ b/crates/hypershell-examples/src/providers/checksum.rs @@ -0,0 +1,20 @@ +use cgp::extra::handler::PipeHandlers; +use cgp::prelude::*; +use hypershell_hash_components::dsl::{BytesToHex, Checksum}; +use hypershell_hash_components::providers::{HandleBytesToHex, HandleStreamChecksum}; +use hypershell_tokio_components::providers::HandleToFuturesStream; + +delegate_components! { + new HypershellChecksumProvider { + open {HandlerComponent}; + + @HandlerComponent. Checksum: + PipeHandlers, + + @HandlerComponent.BytesToHex: + HandleBytesToHex, + } +} diff --git a/crates/hypershell-examples/src/providers/mod.rs b/crates/hypershell-examples/src/providers/mod.rs index 2c8b3f3..44e8568 100644 --- a/crates/hypershell-examples/src/providers/mod.rs +++ b/crates/hypershell-examples/src/providers/mod.rs @@ -1,5 +1,7 @@ +mod checksum; mod compare; mod r#if; +pub use checksum::*; pub use compare::*; pub use r#if::*; From ac7133c04022c5a234b1cc838903b81510d2d42e Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sun, 28 Jun 2026 15:01:02 +0200 Subject: [PATCH 10/37] Remove all use of presets in examples --- .../hypershell-examples/examples/bluesky.rs | 9 +++- .../examples/bluesky_websocket.rs | 42 ++++++------------- .../examples/compare_and_branch.rs | 9 +++- .../examples/parallel_compare.rs | 9 +++- .../src/namespaces/compare.rs | 17 ++++++++ .../hypershell-examples/src/namespaces/mod.rs | 2 + 6 files changed, 52 insertions(+), 36 deletions(-) create mode 100644 crates/hypershell-examples/src/namespaces/compare.rs diff --git a/crates/hypershell-examples/examples/bluesky.rs b/crates/hypershell-examples/examples/bluesky.rs index cd4c2dc..d04245c 100644 --- a/crates/hypershell-examples/examples/bluesky.rs +++ b/crates/hypershell-examples/examples/bluesky.rs @@ -27,8 +27,8 @@ #![recursion_limit = "256"] +use hypershell::namespaces::HypershellNamespace; use hypershell::prelude::*; -use hypershell::presets::HypershellPreset; pub type Program = hypershell! { StreamingExec< @@ -47,12 +47,17 @@ pub type Program = hypershell! { | StreamToStdout }; -#[cgp_inherit(HypershellPreset)] #[derive(HasField)] pub struct MyApp { pub keyword: String, } +delegate_components! { + MyApp { + namespace HypershellNamespace; + } +} + #[tokio::main] async fn main() -> Result<(), Error> { let app = MyApp { diff --git a/crates/hypershell-examples/examples/bluesky_websocket.rs b/crates/hypershell-examples/examples/bluesky_websocket.rs index b0180fe..0927a8f 100644 --- a/crates/hypershell-examples/examples/bluesky_websocket.rs +++ b/crates/hypershell-examples/examples/bluesky_websocket.rs @@ -30,9 +30,14 @@ // An empty input stream is provided to `app.handle` as required by the // handler signature, although it is not used by the `WebSocket` handler. +use cgp::core::error::ErrorRaiserComponent; +use cgp_error_anyhow::RaiseAnyhowError; +use hypershell::namespaces::HypershellNamespace; use hypershell::prelude::*; use hypershell_tokio_components::types::TokioAsyncReadStream; +use hypershell_tungstenite_components::providers::HypershellTungsteniteProvider; use tokio::io::simplex; +use tokio_tungstenite::tungstenite::Error as TungsteniteError; pub type Program = hypershell! { WebSocket< @@ -46,43 +51,20 @@ pub type Program = hypershell! { | StreamToStdout }; -#[cgp_inherit(MyAppPreset)] #[derive(HasField)] pub struct MyApp { pub keyword: String, } -#[cgp::re_export_imports] -mod preset { - use cgp::prelude::*; - use cgp_error_anyhow::RaiseAnyhowError; - use hypershell::presets::{HypershellErrorHandlers, HypershellHandlerPreset, HypershellPreset}; - use hypershell_tungstenite_components::presets::TungsteniteHandlerPreset; - use tokio_tungstenite::tungstenite::Error as TungsteniteError; +delegate_components! { + MyApp { + namespace HypershellNamespace; - cgp_preset! { - MyAppPreset: HypershellPreset { - override ErrorRaiserComponent: - MyErrorHandlers::Provider, - override HandlerComponent: - MyHandlerPreset::Provider, - } - } - - cgp_preset! { - #[wrap_provider(UseDelegate)] - MyErrorHandlers: HypershellErrorHandlers { - TungsteniteError: RaiseAnyhowError, - } - } + @cgp.core.error.ErrorRaiserComponent.TungsteniteError: + RaiseAnyhowError, - cgp_preset! { - #[wrap_provider(UseDelegate)] - MyHandlerPreset: - HypershellHandlerPreset - + TungsteniteHandlerPreset - { - } + @cgp.extra.handler.HandlerComponent. WebSocket: + HypershellTungsteniteProvider, } } diff --git a/crates/hypershell-examples/examples/compare_and_branch.rs b/crates/hypershell-examples/examples/compare_and_branch.rs index 6acc571..6beeb90 100644 --- a/crates/hypershell-examples/examples/compare_and_branch.rs +++ b/crates/hypershell-examples/examples/compare_and_branch.rs @@ -2,7 +2,7 @@ use hypershell::prelude::*; use hypershell_examples::dsl::{Compare, If}; -use hypershell_examples::presets::HypershellComparePreset; +use hypershell_examples::namespaces::HypershellCompareNamespace; use hypershell_hash_components::dsl::{BytesToHex, Checksum}; use reqwest::Client; use sha2::Sha256; @@ -39,7 +39,6 @@ pub type Program = hypershell! { | StreamToStdout }; -#[cgp_inherit(HypershellComparePreset)] #[derive(HasField)] pub struct MyApp { pub http_client: Client, @@ -47,6 +46,12 @@ pub struct MyApp { pub url_b: String, } +delegate_components! { + MyApp { + namespace HypershellCompareNamespace; + } +} + #[tokio::main] async fn main() -> Result<(), Error> { let app = MyApp { diff --git a/crates/hypershell-examples/examples/parallel_compare.rs b/crates/hypershell-examples/examples/parallel_compare.rs index 4f9ccef..1d843e3 100644 --- a/crates/hypershell-examples/examples/parallel_compare.rs +++ b/crates/hypershell-examples/examples/parallel_compare.rs @@ -2,7 +2,7 @@ use hypershell::prelude::*; use hypershell_examples::dsl::Compare; -use hypershell_examples::presets::HypershellComparePreset; +use hypershell_examples::namespaces::HypershellCompareNamespace; use hypershell_hash_components::dsl::{BytesToHex, Checksum}; use reqwest::Client; use sha2::Sha256; @@ -24,7 +24,6 @@ pub type Program = hypershell! { > }; -#[cgp_inherit(HypershellComparePreset)] #[derive(HasField)] pub struct MyApp { pub http_client: Client, @@ -32,6 +31,12 @@ pub struct MyApp { pub url_b: String, } +delegate_components! { + MyApp { + namespace HypershellCompareNamespace; + } +} + #[tokio::main] async fn main() -> Result<(), Error> { let app = MyApp { diff --git a/crates/hypershell-examples/src/namespaces/compare.rs b/crates/hypershell-examples/src/namespaces/compare.rs new file mode 100644 index 0000000..7286f12 --- /dev/null +++ b/crates/hypershell-examples/src/namespaces/compare.rs @@ -0,0 +1,17 @@ +use cgp::prelude::{HandlerComponent, cgp_namespace}; +use hypershell_components::providers::BoxHandler; + +use crate::dsl::{Compare, If}; +use crate::namespaces::HypershellChecksumNamespace; +use crate::providers::{HandleCompare, HandleIf}; + +cgp_namespace! { + new HypershellCompareNamespace: HypershellChecksumNamespace { + // Note: The compare handler is somehow much slower when the future is not boxed + @cgp.extra.handler.HandlerComponent. Compare: + BoxHandler, + + @cgp.extra.handler.HandlerComponent. If: + HandleIf, + } +} diff --git a/crates/hypershell-examples/src/namespaces/mod.rs b/crates/hypershell-examples/src/namespaces/mod.rs index 379293d..dd6de72 100644 --- a/crates/hypershell-examples/src/namespaces/mod.rs +++ b/crates/hypershell-examples/src/namespaces/mod.rs @@ -1,3 +1,5 @@ mod checksum; +mod compare; pub use checksum::*; +pub use compare::*; From e5479687bc99c87cb51f9aa6d4546eb820bc122b Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sun, 28 Jun 2026 15:10:28 +0200 Subject: [PATCH 11/37] Remove old preset constructs --- crates/hypershell-components/src/lib.rs | 2 - .../src/namespaces/command_arg_extractor.rs | 13 -- .../src/namespaces/handlers.rs | 24 ---- .../src/namespaces/mod.rs | 11 -- .../src/namespaces/prefixes.rs | 111 ------------------ .../src/namespaces/string_arg_extractor.rs | 15 --- .../src/namespaces/url_arg_extractor.rs | 14 --- crates/hypershell-components/src/presets.rs | 65 ---------- crates/hypershell-examples/src/lib.rs | 1 - .../src/presets/checksum.rs | 29 ----- .../src/presets/compare.rs | 28 ----- crates/hypershell-examples/src/presets/mod.rs | 5 - .../hypershell-examples/tests/tests/field.rs | 16 ++- .../hypershell-examples/tests/tests/pipe.rs | 9 +- .../hypershell-reqwest-components/src/lib.rs | 2 - .../src/namespaces.rs | 32 ----- .../src/presets.rs | 87 -------------- crates/hypershell-tokio-components/src/lib.rs | 2 - .../src/namespaces/command_arg.rs | 12 -- .../src/namespaces/handler.rs | 51 -------- .../src/namespaces/mod.rs | 6 - .../src/namespaces/prefixes.rs | 33 ------ .../src/presets.rs | 97 --------------- crates/hypershell/src/lib.rs | 1 - crates/hypershell/src/prelude.rs | 1 - crates/hypershell/src/presets.rs | 93 --------------- 26 files changed, 20 insertions(+), 740 deletions(-) delete mode 100644 crates/hypershell-components/src/namespaces/command_arg_extractor.rs delete mode 100644 crates/hypershell-components/src/namespaces/handlers.rs delete mode 100644 crates/hypershell-components/src/namespaces/mod.rs delete mode 100644 crates/hypershell-components/src/namespaces/prefixes.rs delete mode 100644 crates/hypershell-components/src/namespaces/string_arg_extractor.rs delete mode 100644 crates/hypershell-components/src/namespaces/url_arg_extractor.rs delete mode 100644 crates/hypershell-components/src/presets.rs delete mode 100644 crates/hypershell-examples/src/presets/checksum.rs delete mode 100644 crates/hypershell-examples/src/presets/compare.rs delete mode 100644 crates/hypershell-examples/src/presets/mod.rs delete mode 100644 crates/hypershell-reqwest-components/src/namespaces.rs delete mode 100644 crates/hypershell-reqwest-components/src/presets.rs delete mode 100644 crates/hypershell-tokio-components/src/namespaces/command_arg.rs delete mode 100644 crates/hypershell-tokio-components/src/namespaces/handler.rs delete mode 100644 crates/hypershell-tokio-components/src/namespaces/mod.rs delete mode 100644 crates/hypershell-tokio-components/src/namespaces/prefixes.rs delete mode 100644 crates/hypershell-tokio-components/src/presets.rs delete mode 100644 crates/hypershell/src/presets.rs diff --git a/crates/hypershell-components/src/lib.rs b/crates/hypershell-components/src/lib.rs index cd30b9c..067564f 100644 --- a/crates/hypershell-components/src/lib.rs +++ b/crates/hypershell-components/src/lib.rs @@ -4,7 +4,5 @@ extern crate alloc; pub mod components; pub mod dsl; -pub mod namespaces; -pub mod presets; pub mod providers; pub mod traits; diff --git a/crates/hypershell-components/src/namespaces/command_arg_extractor.rs b/crates/hypershell-components/src/namespaces/command_arg_extractor.rs deleted file mode 100644 index 7533892..0000000 --- a/crates/hypershell-components/src/namespaces/command_arg_extractor.rs +++ /dev/null @@ -1,13 +0,0 @@ -use cgp::prelude::cgp_namespace; - -use crate::dsl::{FieldArg, StaticArg}; -use crate::providers::ExtractStringCommandArg; - -cgp_namespace! { - new BaseCommandArgExtractorImpls { - [ - StaticArg, - FieldArg, - ]: ExtractStringCommandArg, - } -} diff --git a/crates/hypershell-components/src/namespaces/handlers.rs b/crates/hypershell-components/src/namespaces/handlers.rs deleted file mode 100644 index 5e36f3f..0000000 --- a/crates/hypershell-components/src/namespaces/handlers.rs +++ /dev/null @@ -1,24 +0,0 @@ -use alloc::boxed::Box; - -use cgp::extra::handler::Promote; -use cgp::prelude::cgp_namespace; - -use crate::dsl::{BytesToString, ConvertTo, Pipe, Use}; -use crate::providers::{ - BoxHandler, Call, DecodeUtf8Bytes, HandleConvert, HandlePipe, HandleUseProvider, -}; - -cgp_namespace! { - new BaseHandlerImpls { - BytesToString: - DecodeUtf8Bytes, - ConvertTo: - Promote, - Pipe: - HandlePipe, - Use: - HandleUseProvider, - Box: - BoxHandler>, - } -} diff --git a/crates/hypershell-components/src/namespaces/mod.rs b/crates/hypershell-components/src/namespaces/mod.rs deleted file mode 100644 index 8a0b0e7..0000000 --- a/crates/hypershell-components/src/namespaces/mod.rs +++ /dev/null @@ -1,11 +0,0 @@ -mod command_arg_extractor; -mod handlers; -mod prefixes; -mod string_arg_extractor; -mod url_arg_extractor; - -pub use command_arg_extractor::*; -pub use handlers::*; -pub use prefixes::*; -pub use string_arg_extractor::*; -pub use url_arg_extractor::*; diff --git a/crates/hypershell-components/src/namespaces/prefixes.rs b/crates/hypershell-components/src/namespaces/prefixes.rs deleted file mode 100644 index b5a6bab..0000000 --- a/crates/hypershell-components/src/namespaces/prefixes.rs +++ /dev/null @@ -1,111 +0,0 @@ -use cgp::core::component::IsDelegateKeyIn; -use cgp::prelude::*; - -use crate::components::{ - CommandArgExtractorComponent, StringArgExtractorComponent, UrlArgExtractorComponent, -}; -use crate::dsl::{ - BytesToStream, BytesToString, ConvertTo, FieldArg, JoinArgs, Pipe, ReadFile, SimpleExec, - SimpleHttpRequest, StaticArg, StreamToBytes, StreamToStdout, StreamToString, StreamingExec, - StreamingHttpRequest, UrlEncodeArg, Use, WebSocket, WriteFile, -}; - -cgp_namespace! { - new HypershellNamespace: DefaultNamespace { - @cgp.extra.HandlerComponent.> T: - UseDelegate, - - @hypershell.core.StringArgExtractorComponent.> T: - UseDelegate, - - @hypershell.core.CommandArgExtractorComponent.> T: - UseDelegate, - - @hypershell.core.UrlArgExtractorComponent.> T: - UseDelegate, - } -} - -delegate_components! { - new HypershellHandlers { - [ - Pipe, - Use, - ] => - @hypershell.dsl.handler.core, - - [ - BytesToString, - ConvertTo, - ] => - @hypershell.dsl.handler.convert, - - [ - StreamToBytes, - StreamToString, - BytesToStream, - StreamToStdout, - ] => - @hypershell.dsl.handler.stream, - - [ - SimpleExec, - StreamingExec, - ] => - @hypershell.dsl.handler.cli, - - [ - ReadFile, - WriteFile, - ] => - @hypershell.dsl.handler.file, - - [ - SimpleHttpRequest, - StreamingHttpRequest, - ] => - @hypershell.dsl.handler.http, - - [ - WebSocket, - ] => - @hypershell.dsl.handler.websocket, - - } -} - -delegate_components! { - new HypershellStringArgExtractors { - [ - StaticArg, - FieldArg, - JoinArgs, - ] => - @hypershell.dsl.arg.core, - [ - UrlEncodeArg, - ] => - @hypershell.dsl.arg.url, - } -} - -delegate_components! { - new HypershellCommandArgExtractors { - [ - StaticArg, - FieldArg, - ] => - @hypershell.dsl.arg.core - } -} - -delegate_components! { - new HypershellUrlArgExtractors { - [ - StaticArg, - FieldArg, - JoinArgs, - ] => - @hypershell.dsl.arg.core - } -} diff --git a/crates/hypershell-components/src/namespaces/string_arg_extractor.rs b/crates/hypershell-components/src/namespaces/string_arg_extractor.rs deleted file mode 100644 index b480eb8..0000000 --- a/crates/hypershell-components/src/namespaces/string_arg_extractor.rs +++ /dev/null @@ -1,15 +0,0 @@ -use cgp::prelude::cgp_namespace; - -use crate::dsl::{FieldArg, JoinArgs, StaticArg}; -use crate::providers::{ExtractFieldArg, ExtractStaticArg, JoinStringArgs}; - -cgp_namespace! { - new BaseStringArgExtractorImpls { - StaticArg: - ExtractStaticArg, - FieldArg: - ExtractFieldArg, - JoinArgs: - JoinStringArgs, - } -} diff --git a/crates/hypershell-components/src/namespaces/url_arg_extractor.rs b/crates/hypershell-components/src/namespaces/url_arg_extractor.rs deleted file mode 100644 index 05e5d6a..0000000 --- a/crates/hypershell-components/src/namespaces/url_arg_extractor.rs +++ /dev/null @@ -1,14 +0,0 @@ -use cgp::prelude::cgp_namespace; - -use crate::dsl::{FieldArg, JoinArgs, StaticArg}; -use crate::providers::ExtractStringUrlArg; - -cgp_namespace! { - new BaseUrlArgExtractorImpls { - [ - StaticArg, - JoinArgs, - FieldArg, - ]: ExtractStringUrlArg, - } -} diff --git a/crates/hypershell-components/src/presets.rs b/crates/hypershell-components/src/presets.rs deleted file mode 100644 index 3c5d71b..0000000 --- a/crates/hypershell-components/src/presets.rs +++ /dev/null @@ -1,65 +0,0 @@ -#[cgp::re_export_imports] -mod preset { - use alloc::boxed::Box; - - use cgp::core::component::UseDelegate; - use cgp::extra::handler::{HandlerComponent, Promote}; - use cgp::prelude::*; - - use crate::components::{StringArgExtractorComponent, UrlArgExtractorComponent}; - use crate::dsl::{BytesToString, ConvertTo, FieldArg, JoinArgs, Pipe, StaticArg, Use}; - use crate::providers::{ - BoxHandler, Call, DecodeUtf8Bytes, ExtractFieldArg, ExtractStaticArg, ExtractStringUrlArg, - HandleConvert, HandlePipe, HandleUseProvider, JoinStringArgs, - }; - - cgp_preset! { - HypershellBasePreset { - HandlerComponent: - BaseHandlerPreset::Provider, - StringArgExtractorComponent: - BaseStringArgExtractorPreset::Provider, - UrlArgExtractorComponent: - UrlArgExtractorPreset::Provider, - } - } - - cgp_preset! { - #[wrap_provider(UseDelegate)] - BaseStringArgExtractorPreset { - StaticArg: - ExtractStaticArg, - FieldArg: - ExtractFieldArg, - JoinArgs: - JoinStringArgs, - } - } - - cgp_preset! { - #[wrap_provider(UseDelegate)] - UrlArgExtractorPreset { - [ - StaticArg, - JoinArgs, - FieldArg, - ]: ExtractStringUrlArg, - } - } - - cgp_preset! { - #[wrap_provider(UseDelegate)] - BaseHandlerPreset { - BytesToString: - DecodeUtf8Bytes, - ConvertTo: - Promote, - Pipe: - HandlePipe, - Use: - HandleUseProvider, - Box: - BoxHandler>, - } - } -} diff --git a/crates/hypershell-examples/src/lib.rs b/crates/hypershell-examples/src/lib.rs index 8832e08..746e6ac 100644 --- a/crates/hypershell-examples/src/lib.rs +++ b/crates/hypershell-examples/src/lib.rs @@ -1,4 +1,3 @@ pub mod dsl; pub mod namespaces; -pub mod presets; pub mod providers; diff --git a/crates/hypershell-examples/src/presets/checksum.rs b/crates/hypershell-examples/src/presets/checksum.rs deleted file mode 100644 index 315357a..0000000 --- a/crates/hypershell-examples/src/presets/checksum.rs +++ /dev/null @@ -1,29 +0,0 @@ -#[cgp::re_export_imports] -mod preset { - use cgp::extra::handler::PipeHandlers; - use hypershell::prelude::*; - use hypershell::presets::HypershellHandlerPreset; - use hypershell_hash_components::dsl::{BytesToHex, Checksum}; - use hypershell_hash_components::providers::{HandleBytesToHex, HandleStreamChecksum}; - use hypershell_tokio_components::providers::HandleToFuturesStream; - - cgp_preset! { - HypershellChecksumPreset: HypershellPreset { - override HandlerComponent: - ChecksumHandlerPreset::Provider, - } - } - - cgp_preset! { - #[wrap_provider(UseDelegate)] - ChecksumHandlerPreset: HypershellHandlerPreset { - Checksum: - PipeHandlers, - BytesToHex: - HandleBytesToHex, - } - } -} diff --git a/crates/hypershell-examples/src/presets/compare.rs b/crates/hypershell-examples/src/presets/compare.rs deleted file mode 100644 index a475a7a..0000000 --- a/crates/hypershell-examples/src/presets/compare.rs +++ /dev/null @@ -1,28 +0,0 @@ -#[cgp::re_export_imports] -mod preset { - use cgp::extra::handler::HandlerComponent; - use hypershell::prelude::*; - use hypershell_components::providers::BoxHandler; - - use crate::dsl::{Compare, If}; - use crate::presets::ChecksumHandlerPreset; - use crate::providers::{HandleCompare, HandleIf}; - - cgp_preset! { - HypershellComparePreset: HypershellPreset { - override HandlerComponent: - CompareHandlerPreset::Provider, - } - } - - cgp_preset! { - #[wrap_provider(UseDelegate)] - CompareHandlerPreset: ChecksumHandlerPreset { - // Note: The compare handler is somehow much slower when the future is not boxed - Compare: - BoxHandler, - If: - HandleIf, - } - } -} diff --git a/crates/hypershell-examples/src/presets/mod.rs b/crates/hypershell-examples/src/presets/mod.rs deleted file mode 100644 index dd6de72..0000000 --- a/crates/hypershell-examples/src/presets/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -mod checksum; -mod compare; - -pub use checksum::*; -pub use compare::*; diff --git a/crates/hypershell-examples/tests/tests/field.rs b/crates/hypershell-examples/tests/tests/field.rs index dd10c1b..25d30c9 100644 --- a/crates/hypershell-examples/tests/tests/field.rs +++ b/crates/hypershell-examples/tests/tests/field.rs @@ -1,14 +1,19 @@ +use hypershell::namespaces::HypershellNamespace; use hypershell::prelude::*; -use hypershell::presets::HypershellPreset; #[tokio::test] async fn test_join_fields() -> Result<(), Error> { - #[cgp_inherit(HypershellPreset)] #[derive(HasField)] pub struct TestApp { pub base_dir: String, } + delegate_components! { + TestApp { + namespace HypershellNamespace; + } + } + pub type Program = hypershell! { SimpleExec< StaticArg<"ls">, @@ -36,12 +41,17 @@ async fn test_join_fields() -> Result<(), Error> { #[tokio::test] async fn test_field_args() -> Result<(), Error> { - #[cgp_inherit(HypershellPreset)] #[derive(HasField)] pub struct TestApp<'a> { pub args: Vec<&'a str>, } + delegate_components! { + <'a> TestApp<'a> { + namespace HypershellNamespace; + } + } + pub type Program = SimpleExec, FieldArgs>; let app = TestApp { diff --git a/crates/hypershell-examples/tests/tests/pipe.rs b/crates/hypershell-examples/tests/tests/pipe.rs index 60a6fa3..5d3d82c 100644 --- a/crates/hypershell-examples/tests/tests/pipe.rs +++ b/crates/hypershell-examples/tests/tests/pipe.rs @@ -1,14 +1,19 @@ +use hypershell::namespaces::HypershellNamespace; use hypershell::prelude::*; -use hypershell::presets::HypershellPreset; #[tokio::test] async fn test_simple_pipe() -> Result<(), Error> { - #[cgp_inherit(HypershellPreset)] #[derive(HasField)] pub struct TestApp { pub base_dir: String, } + delegate_components! { + TestApp { + namespace HypershellNamespace; + } + } + pub type Program = Pipe< Product![ ReadFile< diff --git a/crates/hypershell-reqwest-components/src/lib.rs b/crates/hypershell-reqwest-components/src/lib.rs index c461df5..16dd9c1 100644 --- a/crates/hypershell-reqwest-components/src/lib.rs +++ b/crates/hypershell-reqwest-components/src/lib.rs @@ -1,5 +1,3 @@ pub mod components; pub mod dsl; -pub mod namespaces; -pub mod presets; pub mod providers; diff --git a/crates/hypershell-reqwest-components/src/namespaces.rs b/crates/hypershell-reqwest-components/src/namespaces.rs deleted file mode 100644 index 0f1af35..0000000 --- a/crates/hypershell-reqwest-components/src/namespaces.rs +++ /dev/null @@ -1,32 +0,0 @@ -use cgp::extra::handler::PipeHandlers; -use cgp::prelude::*; -use hypershell_components::dsl::{SimpleHttpRequest, StreamingHttpRequest}; -use hypershell_components::namespaces::BaseHandlerImpls; -use hypershell_tokio_components::namespaces::TokioHandlerImpls; -use hypershell_tokio_components::providers::{HandleToTokioAsyncRead, WrapFuturesAsyncRead}; - -use crate::dsl::CoreHttpRequest; -use crate::providers::{ - HandleCoreHttpRequest, HandleSimpleHttpRequest, HandleStreamingHttpRequest, StreamToBody, -}; - -cgp_namespace! { - BaseHandlerImpls { - CoreHttpRequest: - HandleCoreHttpRequest, - } -} - -cgp_namespace! { - new ReqwestHandlerImpls: TokioHandlerImpls { - SimpleHttpRequest: - HandleSimpleHttpRequest, - StreamingHttpRequest: - PipeHandlers, - } -} diff --git a/crates/hypershell-reqwest-components/src/presets.rs b/crates/hypershell-reqwest-components/src/presets.rs deleted file mode 100644 index d93b5c9..0000000 --- a/crates/hypershell-reqwest-components/src/presets.rs +++ /dev/null @@ -1,87 +0,0 @@ -#[cgp::re_export_imports] -mod preset { - use cgp::core::component::UseDelegate; - use cgp::extra::handler::{HandlerComponent, PipeHandlers}; - use cgp::prelude::{cgp_preset, *}; - use hypershell_components::components::{ - HttpMethodTypeProviderComponent, MethodArgExtractorComponent, StringArgExtractorComponent, - UrlTypeProviderComponent, - }; - use hypershell_components::dsl::{ - GetMethod, Header, PostMethod, SimpleHttpRequest, StreamingHttpRequest, UrlEncodeArg, - WithHeaders, - }; - use hypershell_tokio_components::providers::{HandleToTokioAsyncRead, WrapFuturesAsyncRead}; - use reqwest::{Method, Url}; - - use crate::components::RequestBuilderUpdaterComponent; - use crate::dsl::CoreHttpRequest; - use crate::providers::{ - ExtractReqwestMethod, HandleCoreHttpRequest, HandleSimpleHttpRequest, - HandleStreamingHttpRequest, StreamToBody, UpdateRequestHeader, UpdateRequestHeaders, - UrlEncodeStringArg, - }; - - cgp_preset! { - HypershellReqwestPreset { - HandlerComponent: - ReqwestHandlerPreset::Provider, - HttpMethodTypeProviderComponent: - UseType, - UrlTypeProviderComponent: - UseType, - StringArgExtractorComponent: - ReqwestStringArgExtractorPreset::Provider, - MethodArgExtractorComponent: - MethodArgExtractorPreset::Provider, - RequestBuilderUpdaterComponent: - RequestBuilderUpdaterPreset::Provider, - } - } - - cgp_preset! { - #[wrap_provider(UseDelegate)] - ReqwestHandlerPreset { - SimpleHttpRequest: - HandleSimpleHttpRequest, - StreamingHttpRequest: - PipeHandlers, - CoreHttpRequest: - HandleCoreHttpRequest, - } - } - - cgp_preset! { - #[wrap_provider(UseDelegate)] - MethodArgExtractorPreset { - [ - GetMethod, - PostMethod, - ]: - ExtractReqwestMethod, - } - } - - cgp_preset! { - #[wrap_provider(UseDelegate)] - ReqwestStringArgExtractorPreset { - UrlEncodeArg: - UrlEncodeStringArg, - } - } - - cgp_preset! { - #[wrap_provider(UseDelegate)] - RequestBuilderUpdaterPreset { - WithHeaders: - UpdateRequestHeaders, - Header: - UpdateRequestHeader, - } - } -} diff --git a/crates/hypershell-tokio-components/src/lib.rs b/crates/hypershell-tokio-components/src/lib.rs index c92ccf4..b3fd86a 100644 --- a/crates/hypershell-tokio-components/src/lib.rs +++ b/crates/hypershell-tokio-components/src/lib.rs @@ -1,6 +1,4 @@ pub mod components; pub mod dsl; -pub mod namespaces; -pub mod presets; pub mod providers; pub mod types; diff --git a/crates/hypershell-tokio-components/src/namespaces/command_arg.rs b/crates/hypershell-tokio-components/src/namespaces/command_arg.rs deleted file mode 100644 index dada2e3..0000000 --- a/crates/hypershell-tokio-components/src/namespaces/command_arg.rs +++ /dev/null @@ -1,12 +0,0 @@ -use cgp::prelude::cgp_namespace; -use hypershell_components::dsl::JoinArgs; -use hypershell_components::namespaces::BaseCommandArgExtractorImpls; - -use crate::providers::JoinExtractArgs; - -cgp_namespace! { - new TokioCommandArgExtractorImpls: BaseCommandArgExtractorImpls { - JoinArgs: - JoinExtractArgs, - } -} diff --git a/crates/hypershell-tokio-components/src/namespaces/handler.rs b/crates/hypershell-tokio-components/src/namespaces/handler.rs deleted file mode 100644 index b597dee..0000000 --- a/crates/hypershell-tokio-components/src/namespaces/handler.rs +++ /dev/null @@ -1,51 +0,0 @@ -use cgp::extra::handler::{PipeHandlers, UseInputDelegate}; -use cgp::prelude::*; -use hypershell_components::dsl::{ - BytesToStream, ReadFile, SimpleExec, StreamToBytes, StreamToStdout, StreamToString, - StreamingExec, WriteFile, -}; - -use crate::dsl::{CoreExec, ToTokioAsyncRead}; -use crate::providers::{ - HandleBytesToTokioAsyncRead, HandleCoreExec, HandleReadFile, HandleSimpleExec, - HandleStreamToStdout, HandleStreamingExec, HandleToTokioAsyncRead, HandleTokioAsyncReadToBytes, - HandleTokioAsyncReadToString, HandleWriteFile, WrapTokioAsyncRead, -}; - -cgp_namespace! { - new TokioHandlerImpls { - SimpleExec: - HandleSimpleExec, - StreamingExec: - PipeHandlers, - HandleStreamingExec, - WrapTokioAsyncRead, - ]>, - ReadFile: - PipeHandlers, - WriteFile: - PipeHandlers, - HandleWriteFile, - ]>, - StreamToBytes: - HandleTokioAsyncReadToBytes, - StreamToString: - HandleTokioAsyncReadToString, - BytesToStream: - HandleBytesToTokioAsyncRead, - StreamToStdout: - PipeHandlers, - HandleStreamToStdout, - ]>, - ToTokioAsyncRead: - UseInputDelegate, - CoreExec: - HandleCoreExec, - } -} diff --git a/crates/hypershell-tokio-components/src/namespaces/mod.rs b/crates/hypershell-tokio-components/src/namespaces/mod.rs deleted file mode 100644 index d01d1e0..0000000 --- a/crates/hypershell-tokio-components/src/namespaces/mod.rs +++ /dev/null @@ -1,6 +0,0 @@ -mod command_arg; -mod handler; -mod prefixes; - -pub use command_arg::*; -pub use handler::*; diff --git a/crates/hypershell-tokio-components/src/namespaces/prefixes.rs b/crates/hypershell-tokio-components/src/namespaces/prefixes.rs deleted file mode 100644 index 65acd43..0000000 --- a/crates/hypershell-tokio-components/src/namespaces/prefixes.rs +++ /dev/null @@ -1,33 +0,0 @@ -use cgp::prelude::{UseDelegate, cgp_namespace, delegate_components}; -use hypershell_components::dsl::{FieldArgs, WithArgs}; -use hypershell_components::namespaces::{HypershellHandlers, HypershellNamespace}; - -use crate::components::CommandUpdaterComponent; -use crate::dsl::{CoreExec, ToTokioAsyncRead}; - -cgp_namespace! { - new TokioNamespace: HypershellNamespace { - @hypershell.tokio.CommandUpdaterComponent: - UseDelegate, - } -} - -delegate_components! { - HypershellHandlers { - [ - ToTokioAsyncRead, - CoreExec, - ] => - @hypershell.dsl.handler.tokio, - } -} - -delegate_components! { - new HypershellCommandUpdaters { - [ - WithArgs, - FieldArgs, - ] => - @hypershell.dsl.tokio.command.core, - } -} diff --git a/crates/hypershell-tokio-components/src/presets.rs b/crates/hypershell-tokio-components/src/presets.rs deleted file mode 100644 index acd92a2..0000000 --- a/crates/hypershell-tokio-components/src/presets.rs +++ /dev/null @@ -1,97 +0,0 @@ -#[cgp::re_export_imports] -mod preset { - use std::path::PathBuf; - - use cgp::core::component::UseDelegate; - use cgp::extra::handler::{HandlerComponent, PipeHandlers}; - use cgp::prelude::{cgp_preset, *}; - use hypershell_components::components::{ - CommandArgExtractorComponent, CommandArgTypeProviderComponent, - }; - use hypershell_components::dsl::{ - BytesToStream, FieldArg, FieldArgs, JoinArgs, ReadFile, SimpleExec, StaticArg, - StreamToBytes, StreamToStdout, StreamToString, StreamingExec, WithArgs, WriteFile, - }; - use hypershell_components::providers::ExtractStringCommandArg; - - use crate::components::CommandUpdaterComponent; - use crate::dsl::{CoreExec, ToTokioAsyncRead}; - use crate::providers::{ - ExtractArgs, ExtractFieldArgs, HandleBytesToTokioAsyncRead, HandleCoreExec, HandleReadFile, - HandleSimpleExec, HandleStreamToStdout, HandleStreamingExec, HandleToTokioAsyncRead, - HandleTokioAsyncReadToBytes, HandleTokioAsyncReadToString, HandleWriteFile, - JoinExtractArgs, WrapTokioAsyncRead, - }; - - cgp_preset! { - HypershellTokioPreset { - CommandArgTypeProviderComponent: - UseType, - HandlerComponent: - TokioHandlerPreset::Provider, - CommandArgExtractorComponent: - CommandArgExtractorPreset::Provider, - CommandUpdaterComponent: - CommandUpdaterPreset::Provider, - } - } - - cgp_preset! { - #[wrap_provider(UseDelegate)] - TokioHandlerPreset { - SimpleExec: - HandleSimpleExec, - StreamingExec: - PipeHandlers, - CoreExec: - HandleCoreExec, - ReadFile: - PipeHandlers, - WriteFile: - PipeHandlers, - StreamToBytes: - HandleTokioAsyncReadToBytes, - StreamToString: - HandleTokioAsyncReadToString, - BytesToStream: - HandleBytesToTokioAsyncRead, - StreamToStdout: - PipeHandlers, - ToTokioAsyncRead: - HandleToTokioAsyncRead, - } - } - - cgp_preset! { - #[wrap_provider(UseDelegate)] - CommandArgExtractorPreset { - [ - StaticArg, - FieldArg, - ]: ExtractStringCommandArg, - JoinArgs: - JoinExtractArgs, - } - } - - cgp_preset! { - #[wrap_provider(UseDelegate)] - CommandUpdaterPreset { - WithArgs: ExtractArgs, - FieldArgs: ExtractFieldArgs, - } - } -} diff --git a/crates/hypershell/src/lib.rs b/crates/hypershell/src/lib.rs index 4a34c8b..83ed3e8 100644 --- a/crates/hypershell/src/lib.rs +++ b/crates/hypershell/src/lib.rs @@ -1,5 +1,4 @@ pub mod contexts; pub mod namespaces; pub mod prelude; -pub mod presets; pub mod providers; diff --git a/crates/hypershell/src/prelude.rs b/crates/hypershell/src/prelude.rs index 3cda5ea..0635171 100644 --- a/crates/hypershell/src/prelude.rs +++ b/crates/hypershell/src/prelude.rs @@ -7,4 +7,3 @@ pub use hypershell_components::dsl::*; pub use hypershell_macro::hypershell; pub use crate::contexts::{HypershellCli, HypershellHttp}; -pub use crate::presets::HypershellPreset; diff --git a/crates/hypershell/src/presets.rs b/crates/hypershell/src/presets.rs deleted file mode 100644 index d23d592..0000000 --- a/crates/hypershell/src/presets.rs +++ /dev/null @@ -1,93 +0,0 @@ -#[cgp::re_export_imports] -mod preset { - use core::convert::Infallible; - use core::str::Utf8Error; - use std::io::Error as StdIoError; - - use cgp::core::component::UseDelegate; - use cgp::core::error::{ - ErrorRaiserComponent, ErrorTypeProviderComponent, ErrorWrapperComponent, - }; - use cgp::extra::error::{RaiseInfallible, ReturnError}; - use cgp::prelude::*; - use cgp_error_anyhow::{DebugAnyhowError, Error, RaiseAnyhowError, UseAnyhowError}; - use hypershell_components::presets::{ - BaseHandlerPreset, BaseStringArgExtractorPreset, HypershellBasePreset, - }; - use hypershell_json_components::presets::{HypershellJsonPreset, JsonHandlerPreset}; - use hypershell_reqwest_components::components::ReqwestClientGetterComponent; - use hypershell_reqwest_components::presets::{ - HypershellReqwestPreset, ReqwestHandlerPreset, ReqwestStringArgExtractorPreset, - }; - use hypershell_reqwest_components::providers::ErrorResponse; - use hypershell_tokio_components::presets::{HypershellTokioPreset, TokioHandlerPreset}; - use hypershell_tokio_components::providers::ExecOutputError; - use reqwest::Error as ReqwestError; - use reqwest::header::{InvalidHeaderName, InvalidHeaderValue}; - use serde_json::Error as JsonError; - use url::ParseError; - - cgp_preset! { - HypershellPreset: - HypershellBasePreset - + HypershellTokioPreset - + HypershellReqwestPreset - + HypershellJsonPreset - { - ErrorTypeProviderComponent: - UseAnyhowError, - ErrorRaiserComponent: - HypershellErrorHandlers::Provider, - ErrorWrapperComponent: - DebugAnyhowError, - ReqwestClientGetterComponent: - UseField, - override StringArgExtractorComponent: - HypershellStringArgExtractorPreset::Provider, - override HandlerComponent: - HypershellHandlerPreset::Provider, - } - } - - cgp_preset! { - #[wrap_provider(UseDelegate)] - HypershellErrorHandlers { - Error: ReturnError, - Infallible: RaiseInfallible, - [ - StdIoError, - Utf8Error, - ReqwestError, - ParseError, - InvalidHeaderName, - InvalidHeaderValue, - JsonError, - ]: - RaiseAnyhowError, - [ - ExecOutputError, - ErrorResponse, - ]: - DebugAnyhowError, - } - } - - cgp_preset! { - #[wrap_provider(UseDelegate)] - HypershellHandlerPreset: - BaseHandlerPreset - + TokioHandlerPreset - + ReqwestHandlerPreset - + JsonHandlerPreset - { - } - } - - cgp_preset! { - #[wrap_provider(UseDelegate)] - HypershellStringArgExtractorPreset: - BaseStringArgExtractorPreset - + ReqwestStringArgExtractorPreset - { } - } -} From bacaa9e02d5e2cc5d0335521f7a74de35ded662a Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sun, 28 Jun 2026 15:12:15 +0200 Subject: [PATCH 12/37] Switch to nightly by default --- .cargo/config.toml | 4 +- crates/hypershell-json-components/src/lib.rs | 1 - .../hypershell-json-components/src/presets.rs | 26 ----------- .../src/lib.rs | 1 - .../src/presets.rs | 44 ------------------- rust-toolchain.toml | 2 +- 6 files changed, 3 insertions(+), 75 deletions(-) delete mode 100644 crates/hypershell-json-components/src/presets.rs delete mode 100644 crates/hypershell-tungstenite-components/src/presets.rs diff --git a/.cargo/config.toml b/.cargo/config.toml index a159a79..5204278 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,2 +1,2 @@ -# [build] -# rustflags = ["-Z", "next-solver=globally"] +[build] +rustflags = ["-Z", "next-solver=globally"] diff --git a/crates/hypershell-json-components/src/lib.rs b/crates/hypershell-json-components/src/lib.rs index bf902c4..330260b 100644 --- a/crates/hypershell-json-components/src/lib.rs +++ b/crates/hypershell-json-components/src/lib.rs @@ -2,5 +2,4 @@ extern crate alloc; -pub mod presets; pub mod providers; diff --git a/crates/hypershell-json-components/src/presets.rs b/crates/hypershell-json-components/src/presets.rs deleted file mode 100644 index 1cc6f52..0000000 --- a/crates/hypershell-json-components/src/presets.rs +++ /dev/null @@ -1,26 +0,0 @@ -#[cgp::re_export_imports] -mod preset { - use cgp::core::component::UseDelegate; - use cgp::extra::handler::HandlerComponent; - use cgp::prelude::*; - use hypershell_components::dsl::{DecodeJson, EncodeJson}; - - use crate::providers::{HandleDecodeJson, HandleEncodeJson}; - - cgp_preset! { - HypershellJsonPreset { - HandlerComponent: - JsonHandlerPreset::Provider, - } - } - - cgp_preset! { - #[wrap_provider(UseDelegate)] - JsonHandlerPreset { - EncodeJson: - HandleEncodeJson, - DecodeJson: - HandleDecodeJson, - } - } -} diff --git a/crates/hypershell-tungstenite-components/src/lib.rs b/crates/hypershell-tungstenite-components/src/lib.rs index 95fa82c..9ce92fb 100644 --- a/crates/hypershell-tungstenite-components/src/lib.rs +++ b/crates/hypershell-tungstenite-components/src/lib.rs @@ -1,2 +1 @@ -pub mod presets; pub mod providers; diff --git a/crates/hypershell-tungstenite-components/src/presets.rs b/crates/hypershell-tungstenite-components/src/presets.rs deleted file mode 100644 index 10f78ed..0000000 --- a/crates/hypershell-tungstenite-components/src/presets.rs +++ /dev/null @@ -1,44 +0,0 @@ -#[cgp::re_export_imports] -mod preset { - use std::vec::Vec; - - use cgp::extra::handler::{PipeHandlers, UseInputDelegate}; - use cgp::prelude::*; - use hypershell_components::dsl::{BytesToStream, WebSocket}; - use hypershell_components::providers::Call; - use hypershell_tokio_components::providers::{FuturesToTokioAsyncRead, WrapFuturesAsyncRead}; - use hypershell_tokio_components::types::{FuturesAsyncReadStream, TokioAsyncReadStream}; - - use crate::providers::HandleWebsocket; - - cgp_preset! { - #[wrap_provider(UseDelegate)] - TungsteniteHandlerPreset { - WebSocket: - WebSocketHandlers::Provider, - } - } - - cgp_preset! { - #[wrap_provider(UseInputDelegate)] - WebSocketHandlers { - FuturesAsyncReadStream: - PipeHandlers, - TokioAsyncReadStream: - PipeHandlers, - Vec: - PipeHandlers, - HandleWebsocket, - WrapFuturesAsyncRead, - ]>, - } - } -} diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 292fe49..5d56faf 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "stable" +channel = "nightly" From 8e7c264f3ff2493421e8731e61eb00cb723886a8 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sat, 4 Jul 2026 20:47:47 +0200 Subject: [PATCH 13/37] Update `#[use_type]` separator --- Cargo.lock | 10 +++++++++- .../hypershell-components/src/providers/box_async.rs | 2 +- crates/hypershell-components/src/providers/convert.rs | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 63fb54e..967cc6e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -124,6 +124,14 @@ dependencies = [ "cgp-macro", ] +[[package]] +name = "cgp-base-extra" +version = "0.7.0" +dependencies = [ + "cgp-base", + "cgp-type", +] + [[package]] name = "cgp-base-types" version = "0.7.0" @@ -158,7 +166,7 @@ dependencies = [ name = "cgp-error" version = "0.7.0" dependencies = [ - "cgp-base", + "cgp-base-extra", "cgp-field", "cgp-macro", "cgp-type", diff --git a/crates/hypershell-components/src/providers/box_async.rs b/crates/hypershell-components/src/providers/box_async.rs index 495ffbb..78b495d 100644 --- a/crates/hypershell-components/src/providers/box_async.rs +++ b/crates/hypershell-components/src/providers/box_async.rs @@ -6,7 +6,7 @@ use cgp::extra::handler::{Handler, HandlerComponent}; use cgp::prelude::*; #[cgp_impl(new BoxHandler)] -#[use_type(HasErrorType::Error)] +#[use_type(HasErrorType.Error)] #[use_provider(InHandler: Handler)] impl Handler where diff --git a/crates/hypershell-components/src/providers/convert.rs b/crates/hypershell-components/src/providers/convert.rs index 6a5a104..17546ae 100644 --- a/crates/hypershell-components/src/providers/convert.rs +++ b/crates/hypershell-components/src/providers/convert.rs @@ -22,7 +22,7 @@ where } #[cgp_impl(new DecodeUtf8Bytes)] -#[use_type(HasErrorType::Error)] +#[use_type(HasErrorType.Error)] impl Handler where Self: CanRaiseError + for<'a> CanWrapError>, From 4bdbca795e91564c8b9eb58cce431c1e9afaf3a2 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sun, 5 Jul 2026 13:50:39 +0200 Subject: [PATCH 14/37] Update CGP version --- Cargo.lock | 52 ++++++++++++++++++++++++++-------------------------- Cargo.toml | 4 ++-- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 967cc6e..cb2f8e6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -100,7 +100,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "cgp" -version = "0.7.0" +version = "0.8.0-alpha" dependencies = [ "cgp-core", "cgp-extra", @@ -108,7 +108,7 @@ dependencies = [ [[package]] name = "cgp-async-macro" -version = "0.7.0" +version = "0.8.0-alpha" dependencies = [ "proc-macro2", "quote", @@ -117,7 +117,7 @@ dependencies = [ [[package]] name = "cgp-base" -version = "0.7.0" +version = "0.8.0-alpha" dependencies = [ "cgp-base-types", "cgp-component", @@ -126,7 +126,7 @@ dependencies = [ [[package]] name = "cgp-base-extra" -version = "0.7.0" +version = "0.8.0-alpha" dependencies = [ "cgp-base", "cgp-type", @@ -134,15 +134,15 @@ dependencies = [ [[package]] name = "cgp-base-types" -version = "0.7.0" +version = "0.8.0-alpha" [[package]] name = "cgp-component" -version = "0.7.0" +version = "0.8.0-alpha" [[package]] name = "cgp-core" -version = "0.7.0" +version = "0.8.0-alpha" dependencies = [ "cgp-async-macro", "cgp-base", @@ -155,7 +155,7 @@ dependencies = [ [[package]] name = "cgp-dispatch" -version = "0.7.0" +version = "0.8.0-alpha" dependencies = [ "cgp-core", "cgp-handler", @@ -164,7 +164,7 @@ dependencies = [ [[package]] name = "cgp-error" -version = "0.7.0" +version = "0.8.0-alpha" dependencies = [ "cgp-base-extra", "cgp-field", @@ -174,7 +174,7 @@ dependencies = [ [[package]] name = "cgp-error-anyhow" -version = "0.7.0" +version = "0.8.0-alpha" dependencies = [ "anyhow", "cgp-core", @@ -182,14 +182,14 @@ dependencies = [ [[package]] name = "cgp-error-extra" -version = "0.7.0" +version = "0.8.0-alpha" dependencies = [ "cgp-core", ] [[package]] name = "cgp-extra" -version = "0.7.0" +version = "0.8.0-alpha" dependencies = [ "cgp-core", "cgp-dispatch", @@ -204,7 +204,7 @@ dependencies = [ [[package]] name = "cgp-extra-macro" -version = "0.7.0" +version = "0.8.0-alpha" dependencies = [ "cgp-extra-macro-lib", "syn", @@ -212,7 +212,7 @@ dependencies = [ [[package]] name = "cgp-extra-macro-lib" -version = "0.7.0" +version = "0.8.0-alpha" dependencies = [ "cgp-macro-core", "proc-macro2", @@ -222,7 +222,7 @@ dependencies = [ [[package]] name = "cgp-field" -version = "0.7.0" +version = "0.8.0-alpha" dependencies = [ "cgp-base-types", "cgp-component", @@ -231,21 +231,21 @@ dependencies = [ [[package]] name = "cgp-field-extra" -version = "0.7.0" +version = "0.8.0-alpha" dependencies = [ "cgp-field", ] [[package]] name = "cgp-handler" -version = "0.7.0" +version = "0.8.0-alpha" dependencies = [ "cgp-core", ] [[package]] name = "cgp-macro" -version = "0.7.0" +version = "0.8.0-alpha" dependencies = [ "cgp-macro-lib", "syn", @@ -253,7 +253,7 @@ dependencies = [ [[package]] name = "cgp-macro-core" -version = "0.7.0" +version = "0.8.0-alpha" dependencies = [ "itertools", "proc-macro2", @@ -263,7 +263,7 @@ dependencies = [ [[package]] name = "cgp-macro-lib" -version = "0.7.0" +version = "0.8.0-alpha" dependencies = [ "cgp-macro-core", "itertools", @@ -274,7 +274,7 @@ dependencies = [ [[package]] name = "cgp-monad" -version = "0.7.0" +version = "0.8.0-alpha" dependencies = [ "cgp-core", "cgp-handler", @@ -282,21 +282,21 @@ dependencies = [ [[package]] name = "cgp-run" -version = "0.7.0" +version = "0.8.0-alpha" dependencies = [ "cgp-core", ] [[package]] name = "cgp-runtime" -version = "0.7.0" +version = "0.8.0-alpha" dependencies = [ "cgp-core", ] [[package]] name = "cgp-type" -version = "0.7.0" +version = "0.8.0-alpha" dependencies = [ "cgp-base", "cgp-component", @@ -1475,9 +1475,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.101" +version = "2.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" +checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 480a3e5..02f09e5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,8 +23,8 @@ authors = ["Soares Chen "] keywords = ["cgp"] [workspace.dependencies] -cgp = { version = "0.7.0" } -cgp-error-anyhow = { version = "0.7.0" } +cgp = { version = "0.8.0-alpha" } +cgp-error-anyhow = { version = "0.8.0-alpha" } futures = { version = "0.3.31" } hex = { version = "0.4.3" } itertools = { version = "0.14.0" } From a7c6eac5d2a8076a93e5fc4408fe4b08ddac7875 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Mon, 14 Sep 2026 14:01:33 +0000 Subject: [PATCH 15/37] Remove use of UseInputDelegate --- Cargo.lock | 927 +++++++++--------- crates/hypershell-examples/Cargo.toml | 6 +- crates/hypershell-hash-components/Cargo.toml | 2 - .../src/providers/async_read.rs | 31 +- .../src/providers/futures_stream.rs | 37 +- 5 files changed, 482 insertions(+), 521 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cb2f8e6..e1d8442 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,26 +2,11 @@ # It is not intended for manual editing. version = 4 -[[package]] -name = "addr2line" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler2" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" - [[package]] name = "anyhow" -version = "1.0.98" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" [[package]] name = "atomic-waker" @@ -29,27 +14,6 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" -[[package]] -name = "autocfg" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" - -[[package]] -name = "backtrace" -version = "0.3.75" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002" -dependencies = [ - "addr2line", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", - "windows-targets 0.52.6", -] - [[package]] name = "base64" version = "0.22.1" @@ -58,9 +22,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bitflags" -version = "2.9.1" +version = "2.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" [[package]] name = "block-buffer" @@ -73,30 +37,31 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.17.0" +version = "3.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" [[package]] name = "bytes" -version = "1.10.1" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" [[package]] name = "cc" -version = "1.2.24" +version = "1.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16595d3be041c03b09d08d0858631facccee9221e579704070e6e9e4915d3bc7" +checksum = "a3eb0f42d6c360dc3f8a821f6bf2fdea7f72bfd36b3076eb0e6d1e9e0752fff4" dependencies = [ + "find-msvc-tools", "shlex", ] [[package]] name = "cfg-if" -version = "1.0.0" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "cgp" @@ -112,7 +77,7 @@ version = "0.8.0-alpha" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] @@ -207,7 +172,7 @@ name = "cgp-extra-macro" version = "0.8.0-alpha" dependencies = [ "cgp-extra-macro-lib", - "syn", + "syn 2.0.119", ] [[package]] @@ -217,7 +182,7 @@ dependencies = [ "cgp-macro-core", "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] @@ -248,7 +213,7 @@ name = "cgp-macro" version = "0.8.0-alpha" dependencies = [ "cgp-macro-lib", - "syn", + "syn 2.0.119", ] [[package]] @@ -258,7 +223,7 @@ dependencies = [ "itertools", "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] @@ -269,7 +234,7 @@ dependencies = [ "itertools", "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] @@ -313,12 +278,28 @@ dependencies = [ "libc", ] +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" +[[package]] +name = "core_detect" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48" + [[package]] name = "cpufeatures" version = "0.2.17" @@ -330,9 +311,9 @@ dependencies = [ [[package]] name = "crypto-common" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" dependencies = [ "generic-array", "typenum", @@ -340,9 +321,9 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.9.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476" +checksum = "4583a4551df46e2792f82ceeac45e850d2e2d5debba0b91f102385cda5b11f06" [[package]] name = "digest" @@ -356,28 +337,34 @@ dependencies = [ [[package]] name = "displaydoc" -version = "0.2.5" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 3.0.5", ] [[package]] name = "either" -version = "1.15.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +checksum = "252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34" [[package]] name = "encoding_rs" -version = "0.8.35" +version = "0.8.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +checksum = "7b5ef0006ac9ab233c38522f5ae99cae3625151de8f706cacee1cba4b8e2832a" dependencies = [ "cfg-if", + "core_detect", + "multiversion", + "multiversion_no_op", + "rustversion", + "scopeguard", + "simdutf8", ] [[package]] @@ -388,19 +375,25 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" -version = "0.3.12" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cea14ef9355e3beab063703aa9dab15afd25f0667c341310c1e5274bb1d0da18" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] name = "fastrand" -version = "2.3.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" + +[[package]] +name = "find-msvc-tools" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e0f1c7c3a72c66fd80abe965175f7523475c0489a87d3ff9d6e8c87d87a9d2d" [[package]] name = "fnv" @@ -425,18 +418,18 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" dependencies = [ "percent-encoding", ] [[package]] name = "futures" -version = "0.3.31" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +checksum = "9a31d2a3fbaaeb2af2368bbdd904aa8e812d3c04a1ee10d3171f52d556e5d0a3" dependencies = [ "futures-channel", "futures-core", @@ -449,9 +442,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.31" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" dependencies = [ "futures-core", "futures-sink", @@ -459,15 +452,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.31" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" [[package]] name = "futures-executor" -version = "0.3.31" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +checksum = "031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432" dependencies = [ "futures-core", "futures-task", @@ -476,38 +469,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.31" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" [[package]] name = "futures-macro" -version = "0.3.31" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 3.0.5", ] [[package]] name = "futures-sink" -version = "0.3.31" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" [[package]] name = "futures-task" -version = "0.3.31" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" [[package]] name = "futures-util" -version = "0.3.31" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" dependencies = [ "futures-channel", "futures-core", @@ -517,7 +510,6 @@ dependencies = [ "futures-task", "memchr", "pin-project-lite", - "pin-utils", "slab", ] @@ -533,38 +525,43 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" dependencies = [ "cfg-if", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", ] [[package]] name = "getrandom" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", "libc", - "r-efi", - "wasi 0.14.2+wasi-0.2.4", + "r-efi 5.3.0", + "wasip2", ] [[package]] -name = "gimli" -version = "0.31.1" +name = "getrandom" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", +] [[package]] name = "h2" -version = "0.4.10" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9421a676d1b147b16b82c9225157dc629087ef8ec4d5e2960f9437a90dac0a5" +checksum = "ef8e5e5a340588f4452631496976cf8636d4a7ecf600239fdc27615d2530bc16" dependencies = [ "atomic-waker", "bytes", @@ -581,9 +578,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.3" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" [[package]] name = "hex" @@ -593,20 +590,19 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "http" -version = "1.3.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" dependencies = [ "bytes", - "fnv", "itoa", ] [[package]] name = "http-body" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" dependencies = [ "bytes", "http", @@ -614,9 +610,9 @@ dependencies = [ [[package]] name = "http-body-util" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" dependencies = [ "bytes", "futures-core", @@ -633,13 +629,14 @@ checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" [[package]] name = "hyper" -version = "1.6.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80" +checksum = "27b501faa50e7a26c3d3560ca625132f4078a17771f4810baf70475ae48cbe43" dependencies = [ + "atomic-waker", "bytes", "futures-channel", - "futures-util", + "futures-core", "h2", "http", "http-body", @@ -653,15 +650,14 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.27.6" +version = "0.27.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03a01595e11bdcec50946522c32dde3fc6914743000a68b93000965f2f02406d" +checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f" dependencies = [ "http", "hyper", "hyper-util", "rustls", - "rustls-pki-types", "tokio", "tokio-rustls", "tower-service", @@ -685,22 +681,27 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.12" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9f1e950e0d9d1d3c47184416723cf29c0d1f93bd8cccf37e4beb6b44f31710" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" dependencies = [ + "base64", "bytes", "futures-channel", "futures-util", "http", "http-body", "hyper", + "ipnet", "libc", + "percent-encoding", "pin-project-lite", "socket2", + "system-configuration", "tokio", "tower-service", "tracing", + "windows-registry", ] [[package]] @@ -754,7 +755,6 @@ dependencies = [ "cgp", "futures", "hex", - "hypershell-components", "sha2", ] @@ -817,12 +817,13 @@ dependencies = [ [[package]] name = "icu_collections" -version = "2.0.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" +checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513" dependencies = [ "displaydoc", "potential_utf", + "utf8_iter", "yoke", "zerofrom", "zerovec", @@ -830,9 +831,9 @@ dependencies = [ [[package]] name = "icu_locale_core" -version = "2.0.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" +checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb" dependencies = [ "displaydoc", "litemap", @@ -843,11 +844,10 @@ dependencies = [ [[package]] name = "icu_normalizer" -version = "2.0.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" +checksum = "12f9cf5f235641ed274641dd81c3f28d870e276763d0797aeeab72317b1c646f" dependencies = [ - "displaydoc", "icu_collections", "icu_normalizer_data", "icu_properties", @@ -858,42 +858,39 @@ dependencies = [ [[package]] name = "icu_normalizer_data" -version = "2.0.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" +checksum = "1563da1ed3e0b3bf3d74c9b85917ac9c56464d2f57242270c09c9e752f8021a0" [[package]] name = "icu_properties" -version = "2.0.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" +checksum = "7e7ca276ad3145661a65914e6daf131ca5120cd3dcee8f8f3214b8875184a148" dependencies = [ "displaydoc", "icu_collections", "icu_locale_core", "icu_properties_data", "icu_provider", - "potential_utf", "zerotrie", "zerovec", ] [[package]] name = "icu_properties_data" -version = "2.0.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" +checksum = "e590f038c1464a96894fd6d10127e90a8be4509f56ff7ecef851b15cee0b7caa" [[package]] name = "icu_provider" -version = "2.0.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" +checksum = "d27bbb9d3abbefac45d55f647c9de1d44aafcd1186eb91879afef17c396c3e73" dependencies = [ "displaydoc", "icu_locale_core", - "stable_deref_trait", - "tinystr", "writeable", "yoke", "zerofrom", @@ -903,9 +900,9 @@ dependencies = [ [[package]] name = "idna" -version = "1.0.3" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" dependencies = [ "idna_adapter", "smallvec", @@ -914,9 +911,9 @@ dependencies = [ [[package]] name = "idna_adapter" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" dependencies = [ "icu_normalizer", "icu_properties", @@ -924,9 +921,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.9.0" +version = "2.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" dependencies = [ "equivalent", "hashbrown", @@ -934,9 +931,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.11.0" +version = "2.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" +checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0" [[package]] name = "itertools" @@ -949,49 +946,50 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.15" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" [[package]] name = "js-sys" -version = "0.3.77" +version = "0.3.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" +checksum = "ce57d20d1ea864ce2ac172ab472d409214f4fd359f0b2a2775abdf522e2af99e" dependencies = [ - "once_cell", + "cfg-if", + "futures-util", "wasm-bindgen", ] [[package]] name = "libc" -version = "0.2.172" +version = "0.2.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" +checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2" [[package]] name = "linux-raw-sys" -version = "0.9.4" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" [[package]] name = "litemap" -version = "0.8.0" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" [[package]] name = "log" -version = "0.4.27" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" +checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" [[package]] name = "memchr" -version = "2.7.4" +version = "2.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" [[package]] name = "mime" @@ -1000,30 +998,48 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] -name = "miniz_oxide" -version = "0.8.8" +name = "mio" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a" +checksum = "4b18443e9c262bfe8fa82f51666e2642c53393f7e5c27b3e1aeab922cff5b9d8" dependencies = [ - "adler2", + "libc", + "wasi", + "windows-sys 0.61.2", ] [[package]] -name = "mio" -version = "1.0.3" +name = "multiversion" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" +checksum = "b4ca4bea16ffc3f443cf7d866912118196bfef4c6a1556ca00f9f9b00bb43f7c" dependencies = [ - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.52.0", + "multiversion-macros", +] + +[[package]] +name = "multiversion-macros" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d416831a7317ef4b08bee00b69cbbb9c8763da7959a7026244d6266869f9c83" +dependencies = [ + "proc-macro2", + "quote", + "rustversion", + "syn 3.0.5", ] +[[package]] +name = "multiversion_no_op" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "743fb55ba31b18fb1ecef6bdc9aa2743314978ac084044301a7eee33fb99a20d" + [[package]] name = "native-tls" -version = "0.2.14" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" +checksum = "465500e14ea162429d264d44189adc38b199b62b1c21eea9f69e4b73cb03bbf2" dependencies = [ "libc", "log", @@ -1036,32 +1052,22 @@ dependencies = [ "tempfile", ] -[[package]] -name = "object" -version = "0.36.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" -dependencies = [ - "memchr", -] - [[package]] name = "once_cell" -version = "1.21.3" +version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" [[package]] name = "openssl" -version = "0.10.72" +version = "0.10.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fedfea7d58a1f73118430a55da6a286e7b044961736ce96a16a17068ea25e5da" +checksum = "77823a27f0babb03091cb9ed9ef80af3b39dbc82f97e8fa530374b7dafd87a45" dependencies = [ "bitflags", "cfg-if", "foreign-types", "libc", - "once_cell", "openssl-macros", "openssl-sys", ] @@ -1074,20 +1080,20 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] name = "openssl-probe" -version = "0.1.6" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" +checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" [[package]] name = "openssl-sys" -version = "0.9.108" +version = "0.9.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e145e1651e858e820e4860f7b9c5e169bc1d8ce1c86043be79fa7b7634821847" +checksum = "b47e7e6bb2c38cd930d25a23b40fa52e068c10e85f3e03a7f5ba5aaca5713695" dependencies = [ "cc", "libc", @@ -1097,33 +1103,27 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.3.1" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "pin-project-lite" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" - -[[package]] -name = "pin-utils" -version = "0.1.0" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" [[package]] name = "pkg-config" -version = "0.3.32" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" +checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" [[package]] name = "potential_utf" -version = "0.1.2" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5a7c30837279ca13e7c867e9e40053bc68740f988cb07f7ca6df43cc734b585" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" dependencies = [ "zerovec", ] @@ -1139,33 +1139,39 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.95" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.40" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" dependencies = [ "proc-macro2", ] [[package]] name = "r-efi" -version = "5.2.0" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" [[package]] name = "rand" -version = "0.9.1" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97" +checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" dependencies = [ "rand_chacha", "rand_core", @@ -1183,18 +1189,18 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.9.3" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" dependencies = [ - "getrandom 0.3.3", + "getrandom 0.3.4", ] [[package]] name = "reqwest" -version = "0.12.15" +version = "0.12.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d19c46a6fdd48bc4dab94b6103fccc55d34c67cc0ad04653aad4ea2a07cd7bbb" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" dependencies = [ "base64", "bytes", @@ -1209,31 +1215,28 @@ dependencies = [ "hyper-rustls", "hyper-tls", "hyper-util", - "ipnet", "js-sys", "log", "mime", "native-tls", - "once_cell", "percent-encoding", "pin-project-lite", - "rustls-pemfile", + "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", "sync_wrapper", - "system-configuration", "tokio", "tokio-native-tls", "tokio-util", "tower", + "tower-http", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "wasm-streams", "web-sys", - "windows-registry", ] [[package]] @@ -1244,36 +1247,30 @@ checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", "cfg-if", - "getrandom 0.2.16", + "getrandom 0.2.17", "libc", "untrusted", "windows-sys 0.52.0", ] -[[package]] -name = "rustc-demangle" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" - [[package]] name = "rustix" -version = "1.0.7" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" dependencies = [ "bitflags", "errno", "libc", "linux-raw-sys", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] name = "rustls" -version = "0.23.27" +version = "0.23.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "730944ca083c1c233a75c09f199e973ca499344a2b7ba9e755c457e86fb4a321" +checksum = "6725596c3f2c3a0aef021139e145d4eafe314a6623e4680ca83852b2c67ab2ba" dependencies = [ "once_cell", "rustls-pki-types", @@ -1282,29 +1279,20 @@ dependencies = [ "zeroize", ] -[[package]] -name = "rustls-pemfile" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" -dependencies = [ - "rustls-pki-types", -] - [[package]] name = "rustls-pki-types" -version = "1.12.0" +version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79" +checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" dependencies = [ "zeroize", ] [[package]] name = "rustls-webpki" -version = "0.103.3" +version = "0.103.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a72fe2bcf7a6ac6fd7d0b9e5cb68aeb7d4c0a0271730218b3e92d43b4eb435" +checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2" dependencies = [ "ring", "rustls-pki-types", @@ -1313,33 +1301,39 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" [[package]] name = "ryu" -version = "1.0.20" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" [[package]] name = "schannel" -version = "0.1.27" +version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" +checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + [[package]] name = "security-framework" -version = "2.11.1" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" dependencies = [ "bitflags", - "core-foundation", + "core-foundation 0.10.1", "core-foundation-sys", "libc", "security-framework-sys", @@ -1347,9 +1341,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.14.0" +version = "2.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" dependencies = [ "core-foundation-sys", "libc", @@ -1357,34 +1351,45 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.219" +version = "1.0.229" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.229" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 3.0.5", ] [[package]] name = "serde_json" -version = "1.0.140" +version = "1.0.151" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14" dependencies = [ "itoa", "memchr", - "ryu", "serde", + "serde_core", + "zmij", ] [[package]] @@ -1401,9 +1406,9 @@ dependencies = [ [[package]] name = "sha1" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8" dependencies = [ "cfg-if", "cpufeatures", @@ -1423,49 +1428,53 @@ dependencies = [ [[package]] name = "shlex" -version = "1.3.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" [[package]] name = "signal-hook-registry" -version = "1.4.5" +version = "1.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9203b8055f63a2a00e2f593bb0510367fe707d7ff1e5c872de2f537b339e5410" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" dependencies = [ + "errno", "libc", ] +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + [[package]] name = "slab" -version = "0.4.9" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" [[package]] name = "smallvec" -version = "1.15.0" +version = "1.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" +checksum = "ba467056f1b547ed52077911161fc86985becbc60e8e1857c8a144dab0def891" [[package]] name = "socket2" -version = "0.5.10" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] name = "stable_deref_trait" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "subtle" @@ -1475,9 +1484,20 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.118" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422" +checksum = "12df2e0110f65b775f769bb17ef989067a1d931b2eb822bd4346631eeada89f9" dependencies = [ "proc-macro2", "quote", @@ -1501,17 +1521,17 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] name = "system-configuration" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" +checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b" dependencies = [ "bitflags", - "core-foundation", + "core-foundation 0.9.4", "system-configuration-sys", ] @@ -1527,42 +1547,42 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.20.0" +version = "3.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" dependencies = [ "fastrand", - "getrandom 0.3.3", + "getrandom 0.4.3", "once_cell", "rustix", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] name = "thiserror" -version = "2.0.12" +version = "2.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "2.0.12" +version = "2.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 3.0.5", ] [[package]] name = "tinystr" -version = "0.8.1" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" +checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643" dependencies = [ "displaydoc", "zerovec", @@ -1570,11 +1590,10 @@ dependencies = [ [[package]] name = "tokio" -version = "1.45.0" +version = "1.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2513ca694ef9ede0fb23fe71a4ee4107cb102b9dc1930f6d0fd77aae068ae165" +checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed" dependencies = [ - "backtrace", "bytes", "libc", "mio", @@ -1582,18 +1601,18 @@ dependencies = [ "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] name = "tokio-macros" -version = "2.5.0" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 3.0.5", ] [[package]] @@ -1608,9 +1627,9 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.26.2" +version = "0.26.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e727b36a1a0e8b74c376ac2211e40c2c8af09fb4013c60d910495810f008e9b" +checksum = "b0c85f2c3ef0b1cd58b36682f4b17aaa995f0e5db534d85692b4903abce21f67" dependencies = [ "rustls", "tokio", @@ -1632,23 +1651,24 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.15" +version = "0.7.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66a539a9ad6d5d281510d5bd368c973d636c02dbf8a67300bfb6b950696ad7df" +checksum = "494815d09bf52b5548659851081238f0ca39ff638363907596da739561c62c52" dependencies = [ "bytes", "futures-core", "futures-io", "futures-sink", + "libc", "pin-project-lite", "tokio", ] [[package]] name = "tower" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" dependencies = [ "futures-core", "futures-util", @@ -1659,6 +1679,24 @@ dependencies = [ "tower-service", ] +[[package]] +name = "tower-http" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", + "url", +] + [[package]] name = "tower-layer" version = "0.3.3" @@ -1673,9 +1711,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.41" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ "pin-project-lite", "tracing-core", @@ -1683,9 +1721,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.33" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" dependencies = [ "once_cell", ] @@ -1716,15 +1754,15 @@ dependencies = [ [[package]] name = "typenum" -version = "1.18.0" +version = "1.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" [[package]] name = "unicode-ident" -version = "1.0.18" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" [[package]] name = "untrusted" @@ -1734,13 +1772,14 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.4" +version = "2.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" dependencies = [ "form_urlencoded", "idna", "percent-encoding", + "serde", ] [[package]] @@ -1778,63 +1817,47 @@ dependencies = [ [[package]] name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] -name = "wasi" -version = "0.14.2+wasi-0.2.4" +name = "wasip2" +version = "1.0.4+wasi-0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" dependencies = [ - "wit-bindgen-rt", + "wit-bindgen", ] [[package]] name = "wasm-bindgen" -version = "0.2.100" +version = "0.2.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +checksum = "aecb87a33d3b0c5e3b7aa46336eaf486cffafbd281b195e4c8b80d50df2351bf" dependencies = [ "cfg-if", "once_cell", "rustversion", "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" -dependencies = [ - "bumpalo", - "log", - "proc-macro2", - "quote", - "syn", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.50" +version = "0.4.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" +checksum = "6ef4c5d3d2cdf5c54f4231181768f5510842e350db025faf1f7163b1030ed928" dependencies = [ - "cfg-if", "js-sys", - "once_cell", "wasm-bindgen", - "web-sys", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.100" +version = "0.2.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +checksum = "a690d511e3c1a8b3a55e33511e3c2c00c78415cd23650f32b808627f5696b9ed" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1842,22 +1865,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.100" +version = "0.2.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +checksum = "411e4887f0071ef2d2164a9d5fdf2d20efbef78fccd3a78b0c10a1dc5295e48a" dependencies = [ + "bumpalo", "proc-macro2", "quote", - "syn", - "wasm-bindgen-backend", + "syn 3.0.5", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.100" +version = "0.2.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +checksum = "81941cd78d0c92026c33e5e01312845a4cb1e9af3407f9134b100dd03144103e" dependencies = [ "unicode-ident", ] @@ -1877,9 +1900,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.77" +version = "0.3.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" +checksum = "9fbddc4a036f00ec4f18c83445bd3115cb306a91da554919a099d9222fe4a7f8" dependencies = [ "js-sys", "wasm-bindgen", @@ -1887,35 +1910,35 @@ dependencies = [ [[package]] name = "windows-link" -version = "0.1.1" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" [[package]] name = "windows-registry" -version = "0.4.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4286ad90ddb45071efd1a66dfa43eb02dd0dfbae1545ad6cc3c51cf34d7e8ba3" +checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" dependencies = [ + "windows-link", "windows-result", "windows-strings", - "windows-targets 0.53.0", ] [[package]] name = "windows-result" -version = "0.3.4" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" dependencies = [ "windows-link", ] [[package]] name = "windows-strings" -version = "0.3.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87fa48cc5d406560701792be122a10132491cff9d0aeb23583cc2dcafc847319" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" dependencies = [ "windows-link", ] @@ -1926,16 +1949,16 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.6", + "windows-targets", ] [[package]] name = "windows-sys" -version = "0.59.0" +version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" dependencies = [ - "windows-targets 0.52.6", + "windows-link", ] [[package]] @@ -1944,30 +1967,14 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm 0.52.6", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", -] - -[[package]] -name = "windows-targets" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1e4c7e8ceaaf9cb7d7507c974735728ab453b67ef8f18febdd7c11fe59dca8b" -dependencies = [ - "windows_aarch64_gnullvm 0.53.0", - "windows_aarch64_msvc 0.53.0", - "windows_i686_gnu 0.53.0", - "windows_i686_gnullvm 0.53.0", - "windows_i686_msvc 0.53.0", - "windows_x86_64_gnu 0.53.0", - "windows_x86_64_gnullvm 0.53.0", - "windows_x86_64_msvc 0.53.0", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] [[package]] @@ -1976,84 +1983,42 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" - [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" -[[package]] -name = "windows_aarch64_msvc" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" - [[package]] name = "windows_i686_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" -[[package]] -name = "windows_i686_gnu" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" - [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" -[[package]] -name = "windows_i686_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" - [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" -[[package]] -name = "windows_i686_msvc" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" - [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" -[[package]] -name = "windows_x86_64_gnu" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" - [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" - [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -2061,33 +2026,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] -name = "windows_x86_64_msvc" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" - -[[package]] -name = "wit-bindgen-rt" -version = "0.39.0" +name = "wit-bindgen" +version = "0.57.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" -dependencies = [ - "bitflags", -] +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" [[package]] name = "writeable" -version = "0.6.1" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" [[package]] name = "yoke" -version = "0.8.0" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" +checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" dependencies = [ - "serde", "stable_deref_trait", "yoke-derive", "zerofrom", @@ -2095,68 +2050,68 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.8.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" +checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", "synstructure", ] [[package]] name = "zerocopy" -version = "0.8.25" +version = "0.8.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb" +checksum = "d35102a9f36d089ccae9e4c6802bc118be4487b80aaffc0ab4e0cf5ce92d2873" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.25" +version = "0.8.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" +checksum = "146c01f5ab44258da43cf276c74a2763db2ff3969c9c652c3f2de07041d0b2bc" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] name = "zerofrom" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" dependencies = [ "zerofrom-derive", ] [[package]] name = "zerofrom-derive" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", "synstructure", ] [[package]] name = "zeroize" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e" [[package]] name = "zerotrie" -version = "0.2.2" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" dependencies = [ "displaydoc", "yoke", @@ -2165,9 +2120,9 @@ dependencies = [ [[package]] name = "zerovec" -version = "0.11.2" +version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a05eb080e015ba39cc9e23bbe5e7fb04d5fb040350f99f34e338d5fdd294428" +checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8" dependencies = [ "yoke", "zerofrom", @@ -2176,11 +2131,17 @@ dependencies = [ [[package]] name = "zerovec-derive" -version = "0.11.1" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" +checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 3.0.5", ] + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/crates/hypershell-examples/Cargo.toml b/crates/hypershell-examples/Cargo.toml index 5e59b9e..77e36e8 100644 --- a/crates/hypershell-examples/Cargo.toml +++ b/crates/hypershell-examples/Cargo.toml @@ -14,7 +14,6 @@ hypershell = { workspace = true } hypershell-components = { workspace = true } hypershell-tokio-components = { workspace = true } hypershell-hash-components = { workspace = true } -hypershell-tungstenite-components = { workspace = true } cgp = { workspace = true } cgp-error-anyhow = { workspace = true } @@ -25,4 +24,7 @@ sha2 = { workspace = true } serde = { workspace = true, features = [ "derive" ] } tokio = { workspace = true, features = [ "macros", "rt", "io-std", "rt-multi-thread" ] } tokio-util = { workspace = true, features = [ "compat" ] } -tokio-tungstenite = { workspace = true } + +[dev-dependencies] +hypershell-tungstenite-components = { workspace = true } +tokio-tungstenite = { workspace = true } diff --git a/crates/hypershell-hash-components/Cargo.toml b/crates/hypershell-hash-components/Cargo.toml index 7cdafc7..908adae 100644 --- a/crates/hypershell-hash-components/Cargo.toml +++ b/crates/hypershell-hash-components/Cargo.toml @@ -10,8 +10,6 @@ keywords = { workspace = true } description = "Modular DSL for shellscripting in Rust" [dependencies] -hypershell-components = { workspace = true } - cgp = { workspace = true } futures = { workspace = true } sha2 = { workspace = true } diff --git a/crates/hypershell-tokio-components/src/providers/async_read.rs b/crates/hypershell-tokio-components/src/providers/async_read.rs index 82e6f6a..2892228 100644 --- a/crates/hypershell-tokio-components/src/providers/async_read.rs +++ b/crates/hypershell-tokio-components/src/providers/async_read.rs @@ -1,4 +1,3 @@ -use cgp::extra::handler::UseInputDelegate; use cgp::prelude::{HandlerComponent, delegate_components}; use hypershell_components::providers::ReturnInput; @@ -7,21 +6,21 @@ use crate::types::{FuturesAsyncReadStream, TokioAsyncReadStream}; delegate_components! { new HandleToTokioAsyncRead { - HandlerComponent: - UseInputDelegate, - } -} + open HandlerComponent; -delegate_components! { - new ToTokioAsyncReadHandlers { - FuturesAsyncReadStream: - FuturesToTokioAsyncRead, - TokioAsyncReadStream: - ReturnInput, - [ - Vec, - String, - ]: - HandleBytesToTokioAsyncRead, + @HandlerComponent + . Code + . FuturesAsyncReadStream: + FuturesToTokioAsyncRead, + @HandlerComponent + . Code + . TokioAsyncReadStream: + ReturnInput, + @HandlerComponent + . Code.[ + Vec, + String, + ]: + HandleBytesToTokioAsyncRead, } } diff --git a/crates/hypershell-tokio-components/src/providers/futures_stream.rs b/crates/hypershell-tokio-components/src/providers/futures_stream.rs index 27876ae..e17938a 100644 --- a/crates/hypershell-tokio-components/src/providers/futures_stream.rs +++ b/crates/hypershell-tokio-components/src/providers/futures_stream.rs @@ -1,4 +1,4 @@ -use cgp::extra::handler::{PipeHandlers, UseInputDelegate}; +use cgp::extra::handler::PipeHandlers; use cgp::prelude::*; use crate::providers::{AsyncReadToStream, FuturesToTokioAsyncRead, HandleBytesToStream}; @@ -6,24 +6,25 @@ use crate::types::{FuturesAsyncReadStream, TokioAsyncReadStream}; delegate_components! { new HandleToFuturesStream { - HandlerComponent: - UseInputDelegate, - } -} + open HandlerComponent; -delegate_components! { - new ToFuturesStreamHandlers { - FuturesAsyncReadStream: - PipeHandlers Code + . FuturesAsyncReadStream: + PipeHandlers, + @HandlerComponent + . Code + . TokioAsyncReadStream: AsyncReadToStream, - ]>, - TokioAsyncReadStream: - AsyncReadToStream, - [ - Vec, - String, - ]: - HandleBytesToStream, + @HandlerComponent + . Code + .[ + Vec, + String, + ]: + HandleBytesToStream, } } From d3d17782d67140b89532fc30d3c119acb43d1f09 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sat, 26 Sep 2026 12:49:00 +0000 Subject: [PATCH 16/37] Follow redirects for buffered request bodies, and fix ConvertTo and method routes - Key `StreamingHttpRequest` per input in the reqwest bundle, so a `Vec` or `String` body is sent buffered and follows redirects. - Wire `ConvertTo` as `Promote>`, since `HandleConvert` is a synchronous `Computer`. - Route `PutMethod` and `DeleteMethod` in the bundle and the namespace. - Rewrite five example header comments that described the removed preset system. Co-Authored-By: Claude Opus 5.5 --- .../src/providers/combined.rs | 6 ++++-- .../hypershell-examples/examples/bluesky.rs | 4 ++-- .../examples/bluesky_websocket.rs | 16 ++++++-------- .../examples/github_issues.rs | 6 +++--- .../examples/hello_name.rs | 4 ++-- .../examples/http_checksum_native.rs | 11 ++++------ .../src/providers/combined.rs | 21 ++++++++++++++++--- crates/hypershell/src/namespaces/handlers.rs | 10 +++++---- 8 files changed, 45 insertions(+), 33 deletions(-) diff --git a/crates/hypershell-components/src/providers/combined.rs b/crates/hypershell-components/src/providers/combined.rs index e6b046f..faaa7b2 100644 --- a/crates/hypershell-components/src/providers/combined.rs +++ b/crates/hypershell-components/src/providers/combined.rs @@ -1,6 +1,6 @@ use alloc::boxed::Box; -use cgp::extra::handler::Promote; +use cgp::extra::handler::{Promote, PromoteAsync}; use cgp::prelude::{HandlerComponent, delegate_components}; use crate::components::{ @@ -23,8 +23,10 @@ delegate_components! { @HandlerComponent.BytesToString: DecodeUtf8Bytes, + // `HandleConvert` is a synchronous `Computer`: `PromoteAsync` lifts it to an + // `AsyncComputer`, which `Promote` lifts to a `Handler`. @HandlerComponent. ConvertTo: - Promote, + Promote>, @HandlerComponent. Pipe: HandlePipe, @HandlerComponent. Use: diff --git a/crates/hypershell-examples/examples/bluesky.rs b/crates/hypershell-examples/examples/bluesky.rs index d04245c..5f2a93f 100644 --- a/crates/hypershell-examples/examples/bluesky.rs +++ b/crates/hypershell-examples/examples/bluesky.rs @@ -19,8 +19,8 @@ // on the console. // // The `MyApp` struct defines the context for the program, providing the -// `keyword` for `grep`. It inherits from `HypershellPreset` to get the -// necessary components for running CLI commands. +// `keyword` for `grep`. Its wiring joins `HypershellNamespace` to get the +// providers for running CLI commands. // // The `main` function initializes the `MyApp` context with a keyword and // runs the program. diff --git a/crates/hypershell-examples/examples/bluesky_websocket.rs b/crates/hypershell-examples/examples/bluesky_websocket.rs index 0927a8f..08b5195 100644 --- a/crates/hypershell-examples/examples/bluesky_websocket.rs +++ b/crates/hypershell-examples/examples/bluesky_websocket.rs @@ -15,16 +15,12 @@ // 3. The final filtered output is piped to `StreamToStdout` to be printed // on the console. // -// Since the `WebSocket` handler is not part of the default `HypershellPreset`, -// a custom `MyAppPreset` is defined to extend Hypershell's functionality. -// -// The `MyAppPreset` inherits from `HypershellPreset` and overrides the -// `HandlerComponent` to include handlers from `TungsteniteHandlerPreset`, -// which provides the `WebSocket` handler implementation. It also overrides -// `ErrorRaiserComponent` to handle potential `TungsteniteError`s. -// -// The `MyApp` context is configured to use this custom `MyAppPreset`, -// enabling it to execute the program with the extended capabilities. +// `HypershellNamespace` does not route the `WebSocket` syntax, so the `MyApp` +// context adds two entries beside joining it. One routes `WebSocket` to +// `HypershellTungsteniteProvider`, the bundle from the +// `hypershell-tungstenite-components` extension crate that implements it. The +// other routes `TungsteniteError` to an error raiser, which the WebSocket +// provider requires. // // The `main` function initializes `MyApp` with a keyword and runs the program. // An empty input stream is provided to `app.handle` as required by the diff --git a/crates/hypershell-examples/examples/github_issues.rs b/crates/hypershell-examples/examples/github_issues.rs index 0ad51bc..ea0c795 100644 --- a/crates/hypershell-examples/examples/github_issues.rs +++ b/crates/hypershell-examples/examples/github_issues.rs @@ -18,9 +18,9 @@ // the JSON byte stream into a `Vec`. // // The `MyApp` struct defines the context for running the Hypershell program. -// It uses `#[cgp_inherit]` to inherit the necessary components from -// `HypershellPreset` for executing the program. It also uses `#[derive(HasField)]` -// to expose its fields to be used by `FieldArg` within the program definition. +// Its wiring joins `HypershellNamespace`, which routes the HTTP and JSON syntax +// the program uses. It also uses `#[derive(HasField)]` to expose its fields to be +// used by `FieldArg` within the program definition. // // The `main` function sets up the `MyApp` context with the required values, // executes the `Program` using `app.handle`, and prints the fetched issues. diff --git a/crates/hypershell-examples/examples/hello_name.rs b/crates/hypershell-examples/examples/hello_name.rs index a43c811..2674f92 100644 --- a/crates/hypershell-examples/examples/hello_name.rs +++ b/crates/hypershell-examples/examples/hello_name.rs @@ -18,8 +18,8 @@ // 5. The output is piped to `StreamToStdout`. // // To provide the dynamic `name` argument, a custom `MyApp` context is defined -// with a `name` field. The `#[cgp_inherit]` macro wires it up with the -// `HypershellPreset`, and `#[derive(HasField)]` makes its fields accessible +// with a `name` field. Its wiring joins `HypershellNamespace`, which routes +// every built-in syntax, and `#[derive(HasField)]` makes its fields accessible // to `FieldArg`. // // The `main` function creates an instance of `MyApp`, sets the `name`, and diff --git a/crates/hypershell-examples/examples/http_checksum_native.rs b/crates/hypershell-examples/examples/http_checksum_native.rs index 8314014..2a8ac1a 100644 --- a/crates/hypershell-examples/examples/http_checksum_native.rs +++ b/crates/hypershell-examples/examples/http_checksum_native.rs @@ -18,13 +18,10 @@ // // 4. The final hex string is piped to `StreamToStdout`. // -// Since `Checksum` and `BytesToHex` are not part of the default preset, a -// custom `MyAppPreset` is defined to extend `HypershellPreset`. This new -// preset overrides the `HandlerComponent` to include the providers for the -// new handlers (`HandleStreamChecksum` and `HandleBytesToHex`). -// -// The `MyApp` context is configured to use `MyAppPreset`, enabling it to -// execute the program with the new native handlers. +// `HypershellNamespace` does not route `Checksum` and `BytesToHex`, so the +// `MyApp` context joins `HypershellChecksumNamespace` instead. That namespace +// inherits `HypershellNamespace` and routes the two new syntaxes to +// `HypershellChecksumProvider`, the bundle holding their providers. // // The `main` function initializes the `MyApp` context and executes the program. diff --git a/crates/hypershell-reqwest-components/src/providers/combined.rs b/crates/hypershell-reqwest-components/src/providers/combined.rs index 8b2b3ef..0dc3742 100644 --- a/crates/hypershell-reqwest-components/src/providers/combined.rs +++ b/crates/hypershell-reqwest-components/src/providers/combined.rs @@ -5,10 +5,11 @@ use hypershell_components::components::{ StringArgExtractorComponent, UrlArgExtractorComponent, UrlTypeProviderComponent, }; use hypershell_components::dsl::{ - GetMethod, Header, PostMethod, SimpleHttpRequest, StreamingHttpRequest, UrlEncodeArg, - WithHeaders, + DeleteMethod, GetMethod, Header, PostMethod, PutMethod, SimpleHttpRequest, + StreamingHttpRequest, UrlEncodeArg, WithHeaders, }; use hypershell_tokio_components::providers::{HandleToTokioAsyncRead, WrapFuturesAsyncRead}; +use hypershell_tokio_components::types::{FuturesAsyncReadStream, TokioAsyncReadStream}; use reqwest::Method; use url::Url; @@ -40,7 +41,19 @@ delegate_components! { @HandlerComponent. SimpleHttpRequest: HandleSimpleHttpRequest, - @HandlerComponent. StreamingHttpRequest: + // A byte buffer is sent as a buffered body, which `reqwest` can resend when it follows a + // redirect. A streamed body cannot be resent, so a reader input does not follow one. + @HandlerComponent + . StreamingHttpRequest + .[Vec, String]: + PipeHandlers, + + @HandlerComponent + . StreamingHttpRequest + .[ TokioAsyncReadStream, FuturesAsyncReadStream]: PipeHandlers Date: Sat, 26 Sep 2026 13:07:37 +0000 Subject: [PATCH 17/37] Report a failing streamed command, and raise a failed WebSocket connection `StreamingExec` now returns a `ChildOutputStream` that, when the child's stdout ends, waits for the child and ends with an `io::Error` for a non-success exit (a `ChildExitError` carrying the code and stderr) or for a failure reading its input. It drains stderr in the background, records an input error before closing the child's stdin, and aborts an unfinished stdin feed once the child exits. `HandleWebsocket` raises the `tungstenite::Error` from a failed connection instead of unwrapping it. Co-Authored-By: Claude Opus 5.5 --- .../src/providers/streaming_exec.rs | 30 ++-- .../src/types/child_output.rs | 165 ++++++++++++++++++ .../src/types/mod.rs | 2 + .../src/providers/websocket.rs | 2 +- 4 files changed, 178 insertions(+), 21 deletions(-) create mode 100644 crates/hypershell-tokio-components/src/types/child_output.rs diff --git a/crates/hypershell-tokio-components/src/providers/streaming_exec.rs b/crates/hypershell-tokio-components/src/providers/streaming_exec.rs index 373c392..f5a4e5e 100644 --- a/crates/hypershell-tokio-components/src/providers/streaming_exec.rs +++ b/crates/hypershell-tokio-components/src/providers/streaming_exec.rs @@ -3,12 +3,11 @@ use core::marker::PhantomData; use cgp::extra::handler::{CanHandle, Handler, HandlerComponent}; use cgp::prelude::*; use hypershell_components::dsl::StreamingExec; -use tokio::io::{AsyncRead, Empty, copy, empty}; -use tokio::process::{Child, ChildStdout}; -use tokio::spawn; -use tokio_util::either::Either; +use tokio::io::AsyncRead; +use tokio::process::Child; use crate::dsl::CoreExec; +use crate::types::ChildOutputStream; #[cgp_impl(new HandleStreamingExec)] impl Handler, Input> for Context @@ -17,26 +16,17 @@ where CanHandle, (), Output = Child> + CanRaiseError, Input: Send + Unpin + AsyncRead + 'static, { - type Output = Either; + type Output = ChildOutputStream; async fn handle( context: &Context, _tag: PhantomData>, - mut input: Input, - ) -> Result, Context::Error> { - let mut child = context.handle(PhantomData, ()).await?; + input: Input, + ) -> Result { + let child = context.handle(PhantomData, ()).await?; - if let Some(mut stdin) = child.stdin.take() { - spawn(async move { - let _ = copy(&mut input, &mut stdin).await; - }); - } - - let output = match child.stdout.take() { - Some(stdout) => Either::Left(stdout), - None => Either::Right(empty()), - }; - - Ok(output) + // The stream ends with an error when reading the input failed or the child exits with a + // non-success status, carrying the child's stderr. + Ok(ChildOutputStream::new(child, input)) } } diff --git a/crates/hypershell-tokio-components/src/types/child_output.rs b/crates/hypershell-tokio-components/src/types/child_output.rs new file mode 100644 index 0000000..f8306d4 --- /dev/null +++ b/crates/hypershell-tokio-components/src/types/child_output.rs @@ -0,0 +1,165 @@ +use core::fmt::{self, Debug, Display}; +use core::future::Future; +use core::pin::Pin; +use core::task::{Context, Poll, ready}; +use std::io::{self, ErrorKind}; +use std::process::ExitStatus; +use std::sync::{Arc, Mutex}; + +use tokio::io::{AsyncRead, AsyncReadExt, ReadBuf, copy}; +use tokio::process::{Child, ChildStdout}; +use tokio::spawn; +use tokio::task::JoinHandle; + +/// The standard output of a streamed child process, which reports the child's failure when it ends. +/// +/// Reading passes the child's stdout through, while background tasks feed the input to the child's +/// stdin and drain its stderr, so a child writing a lot to stderr cannot block. At end of file the +/// reader waits for the child to exit. An error reading the input, such as a failure the previous +/// stage reports, ends this stream with that error; otherwise a non-success exit is returned as an +/// [`io::Error`] carrying a [`ChildExitError`]. Either way the stage that reads the stream fails +/// instead of treating truncated output as complete. +pub struct ChildOutputStream { + stdout: Option, + feed: Option>, + input_error: Arc>>, + exit: Option>>, +} + +struct ChildExit { + status: ExitStatus, + stderr: Vec, +} + +/// A streamed child process that exited with a non-success status, with what it wrote to standard +/// error. +pub struct ChildExitError { + pub status: ExitStatus, + pub stderr: Vec, +} + +impl ChildOutputStream { + /// Take the child's pipes, and start the task that copies `input` to its stdin and the task that + /// drains its stderr and waits for it to exit. + pub fn new(mut child: Child, mut input: Input) -> Self + where + Input: AsyncRead + Send + Unpin + 'static, + { + let stdout = child.stdout.take(); + let mut stderr = child.stderr.take(); + let input_error = Arc::new(Mutex::new(None)); + + let feed = child.stdin.take().map(|mut stdin| { + let input_error = input_error.clone(); + spawn(async move { + match copy(&mut input, &mut stdin).await { + // A child that exits before reading all of its input closes the pipe, which is + // not a failure of the input. + Err(e) if e.kind() != ErrorKind::BrokenPipe => { + if let Ok(mut slot) = input_error.lock() { + *slot = Some(e); + } + } + _ => {} + } + // Closing stdin only after recording the error means that a child which exits + // because its input ended can never be observed before the error is. + drop(stdin); + }) + }); + + let exit = spawn(async move { + let mut stderr_bytes = Vec::new(); + if let Some(stderr) = &mut stderr { + stderr.read_to_end(&mut stderr_bytes).await?; + } + + let status = child.wait().await?; + + Ok(ChildExit { + status, + stderr: stderr_bytes, + }) + }); + + Self { + stdout, + feed, + input_error, + exit: Some(exit), + } + } +} + +impl AsyncRead for ChildOutputStream { + fn poll_read( + mut self: Pin<&mut Self>, + cx: &mut Context<'_>, + buf: &mut ReadBuf<'_>, + ) -> Poll> { + if buf.remaining() == 0 { + return Poll::Ready(Ok(())); + } + + if let Some(stdout) = &mut self.stdout { + let filled = buf.filled().len(); + ready!(Pin::new(stdout).poll_read(cx, buf))?; + + if buf.filled().len() > filled { + return Poll::Ready(Ok(())); + } + + // End of file on stdout: the input and the child's exit decide how the stream ends. + self.stdout = None; + } + + if let Some(exit) = &mut self.exit { + let result = ready!(Pin::new(exit).poll(cx)); + self.exit = None; + + let exit = result.map_err(io::Error::other)?; + + // The child has exited, so a feed still running is blocked on input nobody will read. + if let Some(feed) = self.feed.take() { + feed.abort(); + } + + // A failed input is the root cause of whatever the child did with it. + let input_error = self + .input_error + .lock() + .ok() + .and_then(|mut slot| slot.take()); + if let Some(error) = input_error { + return Poll::Ready(Err(error)); + } + + let ChildExit { status, stderr } = exit?; + + if !status.success() { + return Poll::Ready(Err(io::Error::other(ChildExitError { status, stderr }))); + } + } + + Poll::Ready(Ok(())) + } +} + +impl Display for ChildExitError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!( + f, + "child process exited with non-success code {:?}, stderr: {}", + self.status.code(), + String::from_utf8_lossy(&self.stderr), + ) + } +} + +impl Debug for ChildExitError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + Display::fmt(self, f) + } +} + +impl std::error::Error for ChildExitError {} diff --git a/crates/hypershell-tokio-components/src/types/mod.rs b/crates/hypershell-tokio-components/src/types/mod.rs index 276f3ed..c52c1c8 100644 --- a/crates/hypershell-tokio-components/src/types/mod.rs +++ b/crates/hypershell-tokio-components/src/types/mod.rs @@ -1,7 +1,9 @@ +mod child_output; mod futures_async_read; mod futures_stream; mod tokio_async_read; +pub use child_output::*; pub use futures_async_read::*; pub use futures_stream::*; pub use tokio_async_read::*; diff --git a/crates/hypershell-tungstenite-components/src/providers/websocket.rs b/crates/hypershell-tungstenite-components/src/providers/websocket.rs index b0b0f96..3832915 100644 --- a/crates/hypershell-tungstenite-components/src/providers/websocket.rs +++ b/crates/hypershell-tungstenite-components/src/providers/websocket.rs @@ -34,7 +34,7 @@ where .into_client_request() .map_err(Context::raise_error)?; - let (websocket, _) = connect_async(url).await.unwrap(); + let (websocket, _) = connect_async(url).await.map_err(Context::raise_error)?; let (writer, reader) = websocket.split(); spawn(async move { From 702ab23be088a7c219f2b28184324110366c4795 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sat, 26 Sep 2026 15:19:39 +0000 Subject: [PATCH 18/37] Build against cgp main through a git patch Override `cgp` and `cgp-error-anyhow` with the `cgp` repository's `main` branch instead of a local `../cgp` checkout, so the workspace builds from a fresh clone, and lock it at the commit carrying the fixed error backends. The local-path entries stay commented out for testing. Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 24 ++++++++++++++++++++++++ Cargo.toml | 8 ++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e1d8442..7b1dcd0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -66,6 +66,7 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "cgp" version = "0.8.0-alpha" +source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" dependencies = [ "cgp-core", "cgp-extra", @@ -74,6 +75,7 @@ dependencies = [ [[package]] name = "cgp-async-macro" version = "0.8.0-alpha" +source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" dependencies = [ "proc-macro2", "quote", @@ -83,6 +85,7 @@ dependencies = [ [[package]] name = "cgp-base" version = "0.8.0-alpha" +source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" dependencies = [ "cgp-base-types", "cgp-component", @@ -92,6 +95,7 @@ dependencies = [ [[package]] name = "cgp-base-extra" version = "0.8.0-alpha" +source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" dependencies = [ "cgp-base", "cgp-type", @@ -100,14 +104,17 @@ dependencies = [ [[package]] name = "cgp-base-types" version = "0.8.0-alpha" +source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" [[package]] name = "cgp-component" version = "0.8.0-alpha" +source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" [[package]] name = "cgp-core" version = "0.8.0-alpha" +source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" dependencies = [ "cgp-async-macro", "cgp-base", @@ -121,6 +128,7 @@ dependencies = [ [[package]] name = "cgp-dispatch" version = "0.8.0-alpha" +source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" dependencies = [ "cgp-core", "cgp-handler", @@ -130,6 +138,7 @@ dependencies = [ [[package]] name = "cgp-error" version = "0.8.0-alpha" +source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" dependencies = [ "cgp-base-extra", "cgp-field", @@ -140,6 +149,7 @@ dependencies = [ [[package]] name = "cgp-error-anyhow" version = "0.8.0-alpha" +source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" dependencies = [ "anyhow", "cgp-core", @@ -148,6 +158,7 @@ dependencies = [ [[package]] name = "cgp-error-extra" version = "0.8.0-alpha" +source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" dependencies = [ "cgp-core", ] @@ -155,6 +166,7 @@ dependencies = [ [[package]] name = "cgp-extra" version = "0.8.0-alpha" +source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" dependencies = [ "cgp-core", "cgp-dispatch", @@ -170,6 +182,7 @@ dependencies = [ [[package]] name = "cgp-extra-macro" version = "0.8.0-alpha" +source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" dependencies = [ "cgp-extra-macro-lib", "syn 2.0.119", @@ -178,6 +191,7 @@ dependencies = [ [[package]] name = "cgp-extra-macro-lib" version = "0.8.0-alpha" +source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" dependencies = [ "cgp-macro-core", "proc-macro2", @@ -188,6 +202,7 @@ dependencies = [ [[package]] name = "cgp-field" version = "0.8.0-alpha" +source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" dependencies = [ "cgp-base-types", "cgp-component", @@ -197,6 +212,7 @@ dependencies = [ [[package]] name = "cgp-field-extra" version = "0.8.0-alpha" +source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" dependencies = [ "cgp-field", ] @@ -204,6 +220,7 @@ dependencies = [ [[package]] name = "cgp-handler" version = "0.8.0-alpha" +source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" dependencies = [ "cgp-core", ] @@ -211,6 +228,7 @@ dependencies = [ [[package]] name = "cgp-macro" version = "0.8.0-alpha" +source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" dependencies = [ "cgp-macro-lib", "syn 2.0.119", @@ -219,6 +237,7 @@ dependencies = [ [[package]] name = "cgp-macro-core" version = "0.8.0-alpha" +source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" dependencies = [ "itertools", "proc-macro2", @@ -229,6 +248,7 @@ dependencies = [ [[package]] name = "cgp-macro-lib" version = "0.8.0-alpha" +source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" dependencies = [ "cgp-macro-core", "itertools", @@ -240,6 +260,7 @@ dependencies = [ [[package]] name = "cgp-monad" version = "0.8.0-alpha" +source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" dependencies = [ "cgp-core", "cgp-handler", @@ -248,6 +269,7 @@ dependencies = [ [[package]] name = "cgp-run" version = "0.8.0-alpha" +source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" dependencies = [ "cgp-core", ] @@ -255,6 +277,7 @@ dependencies = [ [[package]] name = "cgp-runtime" version = "0.8.0-alpha" +source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" dependencies = [ "cgp-core", ] @@ -262,6 +285,7 @@ dependencies = [ [[package]] name = "cgp-type" version = "0.8.0-alpha" +source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" dependencies = [ "cgp-base", "cgp-component", diff --git a/Cargo.toml b/Cargo.toml index 02f09e5..015db3e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,7 +49,7 @@ hypershell-hash-components = { version = "0.1.0", path = "./crates/hyp hypershell-macro = { version = "0.1.0", path = "./crates/hypershell-macro" } [patch.crates-io] -cgp = { path = "../cgp/crates/main/cgp" } -cgp-error-anyhow = { path = "../cgp/crates/standalone/error/cgp-error-anyhow" } -# cgp = { git = "https://github.com/contextgeneric/cgp.git", branch = "v0.7.0" } -# cgp-error-anyhow = { git = "https://github.com/contextgeneric/cgp.git", branch = "v0.7.0" } +# cgp = { path = "../cgp/crates/main/cgp" } +# cgp-error-anyhow = { path = "../cgp/crates/standalone/error/cgp-error-anyhow" } +cgp = { git = "https://github.com/contextgeneric/cgp.git", branch = "main" } +cgp-error-anyhow = { git = "https://github.com/contextgeneric/cgp.git", branch = "main" } From 7f7e94319218042bdd72a6fa5a5ed7d4b871e9b4 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sat, 26 Sep 2026 15:39:13 +0000 Subject: [PATCH 19/37] Point the repository field at Hypershell's own repository Co-Authored-By: Claude Opus 5.5 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 015db3e..08e17b1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,7 @@ members = [ rust-version = "1.90" edition = "2024" license = "MIT" -repository = "https://github.com/contextgeneric/cgp" +repository = "https://github.com/contextgeneric/hypershell" authors = ["Soares Chen "] keywords = ["cgp"] From 12a9a54463142af1d4ef0ab44c320459d0e1e254 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sat, 7 Nov 2026 21:45:02 +0100 Subject: [PATCH 20/37] Update the README for cgp 0.8.0 and namespaces The install snippet pinned `cgp` 0.4.1 and the crate list advertised the default presets that 0.8.0 removed, so both were wrong for this branch. The snippet now pins 0.8.0 and `reqwest` 0.12, the crate list names the default namespace, and the example list covers all twelve programs. --- README.md | 160 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 99 insertions(+), 61 deletions(-) diff --git a/README.md b/README.md index 2e5ad80..c4634a2 100644 --- a/README.md +++ b/README.md @@ -2,79 +2,117 @@ [![Docs.rs](https://docs.rs/hypershell/badge.svg)](https://docs.rs/hypershell) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/contextgeneric/hypershell/blob/main/LICENSE) -# Hypershell - -Hypershell is a modular, *type-level* domain-specific language (DSL) for writing shell-script-like programs in Rust. It is powered by [context-generic programming (CGP)](https://contextgeneric.dev/), which makes it possible for users to *extend* or *modify* both the language syntax and semantics. - -## Learn More - -This README provides a brief overview of Hypershell. To learn about the concepts behind Hypershell, Context-Generic Programming, and how to create your own extensions, please read the introductory blog post: - -[**Hypershell: A Type-Level DSL for Shell-Scripting in Rust**](https://contextgeneric.dev/blog/hypershell-release/) - -## What is Hypershell? - -Hypershell allows you to define complex command pipelines, similar to shell scripts, but directly within Rust's type system. This approach provides several key benefits: - -- **Type Safety**: Your shell-like programs are checked by the Rust compiler. -- **Performance**: DSL programs are interpreted at compile-time into native Rust code with no runtime overhead. -- **Extensibility**: Seamlessly integrate native Rust functions (like HTTP requests or JSON parsing) with external CLI commands in your pipelines. -- **Modularity**: The language itself is designed to be extended. You can add new syntax and handlers without modifying the core library. - -## Key Features - -- **Type-Level DSL**: Define shell scripts as Rust types. -- **Extensible Syntax and Semantics**: Powered by CGP, allowing for deep customization. -- **Mix CLI and Native Handlers**: Combine external commands like `sha256sum` or `cut` with native Rust logic for HTTP requests, JSON processing, and more. -- **Streaming Pipelines**: Efficiently stream I/O between handlers, just like in a traditional shell. -- **Compile-Time Interpretation**: Your DSL programs are resolved at compile-time, resulting in highly performant native code. - -## Crate Organization - -Hypershell is organized into several crates, each with a specific purpose. This modular structure allows for clear separation of concerns and makes the language easier to extend. - -- [`hypershell`](./crates/hypershell): The main crate that re-exports all the necessary components for using the Hypershell DSL. It defines the default presets and contexts for running Hypershell programs. -- [`hypershell-macro`](./crates/hypershell-macro): Contains the `hypershell!` procedural macro, which provides the shell-like syntax for the DSL. -- [`hypershell-components`](./crates/hypershell-components): Defines the core abstract syntax (e.g., `SimpleExec`, `StreamingExec`) and the fundamental CGP components and traits that form the basis of the DSL. -- [`hypershell-tokio-components`](./crates/hypershell-tokio-components): Provides Tokio-based implementations for executing external CLI commands and handling file I/O. -- [`hypershell-reqwest-components`](./crates/hypershell-reqwest-components): Implements native HTTP handlers (e.g., `SimpleHttpRequest`, `StreamingHttpRequest`) using the `reqwest` crate. -- [`hypershell-json-components`](./crates/hypershell-json-components): Provides handlers for JSON serialization (`EncodeJson`) and deserialization (`DecodeJson`). -- [`hypershell-hash-components`](./crates/hypershell-hash-components): An extension crate that offers native handlers for checksumming (`Checksum`) and hex encoding (`BytesToHex`). -- [`hypershell-tungstenite-components`](./crates/hypershell-tungstenite-components): An extension crate that adds native WebSocket support to Hypershell. -- [`hypershell-examples`](./crates/hypershell-examples): Contains a collection of examples demonstrating various features and use cases of Hypershell. - -## Getting Started - -### Installation +# Hypershell: a type-level DSL for shell scripting in Rust + +**A modular, type-level domain-specific language for writing shell-script-like programs in Rust, +powered by [Context-Generic Programming (CGP)](https://contextgeneric.dev/).** + +CGP makes it possible to extend or modify both the language's syntax and its semantics, so a program +can mix external commands with native Rust handlers and still be checked by the compiler. + +**[Website](https://contextgeneric.dev/) · [Project page](https://contextgeneric.dev/docs/projects/hypershell/) · [CGP quickstart](https://contextgeneric.dev/docs/quickstart) · [Introduction post](https://contextgeneric.dev/blog/hypershell-release/)** + +## What it does + +Hypershell lets you define command pipelines, similar to shell scripts, directly in Rust's type +system. That arrangement brings four properties: + +- **Type safety.** The compiler checks your shell-like programs. +- **Performance.** A DSL program is interpreted at compile time into native Rust code, with no runtime + interpretation. +- **Extensibility.** Native Rust functions, such as HTTP requests or JSON parsing, compose with + external CLI commands in the same pipeline. +- **Modularity.** The language itself is designed to be extended: you can add syntax and handlers + without modifying the core library. + +## Crate organization + +Hypershell is organized into several crates, each with one purpose, so the language is easy to +extend. + +- [`hypershell`](./crates/hypershell): the main crate, which re-exports the components a program + needs and defines the default namespace and contexts for running Hypershell programs. +- [`hypershell-macro`](./crates/hypershell-macro): the `hypershell!` procedural macro, which provides + the shell-like syntax. +- [`hypershell-components`](./crates/hypershell-components): the core abstract syntax, such as + `SimpleExec` and `StreamingExec`, and the CGP components and traits the DSL builds on. +- [`hypershell-tokio-components`](./crates/hypershell-tokio-components): Tokio-based implementations + for executing external CLI commands and handling file I/O. +- [`hypershell-reqwest-components`](./crates/hypershell-reqwest-components): native HTTP handlers, + such as `SimpleHttpRequest` and `StreamingHttpRequest`, built on `reqwest`. +- [`hypershell-json-components`](./crates/hypershell-json-components): handlers for JSON + serialization (`EncodeJson`) and deserialization (`DecodeJson`). +- [`hypershell-hash-components`](./crates/hypershell-hash-components): an extension crate with native + handlers for checksumming (`Checksum`) and hex encoding (`BytesToHex`). +- [`hypershell-tungstenite-components`](./crates/hypershell-tungstenite-components): an extension + crate that adds native WebSocket support. +- [`hypershell-examples`](./crates/hypershell-examples): the examples below. + +## Getting started Add `hypershell` and `cgp` to your `Cargo.toml`: ```toml [dependencies] -cgp = { version = "0.4.1" } +cgp = { version = "0.8.0" } hypershell = { version = "0.1.0" } -# You'll also need tokio for async runtime and reqwest for the example +# The examples also need an async runtime and an HTTP client: tokio = { version = "1", features = ["full"] } -reqwest = "0.11" +reqwest = "0.12" anyhow = "1.0" ``` -### Examples - -The `hypershell-examples` crate contains various examples demonstrating different features and use cases of Hypershell. You can find the full source code for these examples in the [`crates/hypershell-examples/examples/`](./crates/hypershell-examples/examples) directory. +The workspace builds against the `cgp` repository's `main` branch through its `[patch.crates-io]` +section, because it tracks unreleased CGP code. To build against a local `cgp` checkout, switch those +entries to the commented-out paths into `../cgp`. + +## Examples + +The [`hypershell-examples`](./crates/hypershell-examples/examples) crate holds runnable programs, one +per feature. Run one with `cargo run -p hypershell-examples --example `. + +- [`hello.rs`](./crates/hypershell-examples/examples/hello.rs): executes `echo hello world!` through + `SimpleExec`. +- [`hello_name.rs`](./crates/hypershell-examples/examples/hello_name.rs): passes dynamic values to a + shell command with variable parameters (`FieldArg`). +- [`http_checksum_cli.rs`](./crates/hypershell-examples/examples/http_checksum_cli.rs): fetches a URL + with `curl` and pipes the output to `sha256sum` and `cut` through streaming execution. +- [`http_checksum_client.rs`](./crates/hypershell-examples/examples/http_checksum_client.rs): fetches + the URL with Hypershell's native HTTP client, then pipes the response through the same commands. +- [`http_checksum_native.rs`](./crates/hypershell-examples/examples/http_checksum_native.rs): the same + checksum, using the native HTTP client and an extended DSL that adds `Checksum` to the syntax. +- [`rust_playground.rs`](./crates/hypershell-examples/examples/rust_playground.rs): encodes and + decodes JSON, sending a Rust snippet to the Rust Playground API and parsing the response. +- [`github_issues.rs`](./crates/hypershell-examples/examples/github_issues.rs): reads a JSON web API + and processes the result. +- [`nix_manual.rs`](./crates/hypershell-examples/examples/nix_manual.rs): combines a native HTTP + request with external CLI tools. +- [`bluesky.rs`](./crates/hypershell-examples/examples/bluesky.rs): connects to the Bluesky firehose + through `nix-shell` and `websocat`, then filters the stream with `grep`. +- [`bluesky_websocket.rs`](./crates/hypershell-examples/examples/bluesky_websocket.rs): the same + firehose, using native WebSocket handling added to the DSL. +- [`compare_and_branch.rs`](./crates/hypershell-examples/examples/compare_and_branch.rs) and + [`parallel_compare.rs`](./crates/hypershell-examples/examples/parallel_compare.rs): branch and + compare pipelines, using the compare namespace. + +## Learn CGP + +The website is the main documentation for CGP: the +[quickstart](https://contextgeneric.dev/docs/quickstart), the +[tutorials](https://contextgeneric.dev/docs/tutorials/hello), the +[concepts](https://contextgeneric.dev/docs/concepts/), and the +[construct reference](https://contextgeneric.dev/docs/reference/). The +[project page](https://contextgeneric.dev/docs/projects/hypershell/) explains this repository, and +the [CGP knowledge base](https://github.com/contextgeneric/cgp-knowledge-base) records it in depth for +contributors and agents. -Here are a few hand-picked examples with short descriptions: +## Disclaimer -* [`hello.rs`](./crates/hypershell-examples/examples/hello.rs): A basic "hello world" program that executes `echo hello world!` using `SimpleExec`. -* [`hello_name.rs`](./crates/hypershell-examples/examples/hello_name.rs): Demonstrates using variable parameters (`FieldArg`) to pass dynamic values to shell commands. -* [`http_checksum_cli.rs`](./crates/hypershell-examples/examples/http_checksum_cli.rs): Fetches a URL using `curl` and pipes the output to `sha256sum` and `cut` via streaming execution. -* [`http_checksum_client.rs`](./crates/hypershell-examples/examples/http_checksum_client.rs): Fetches a URL using Hypershell's native HTTP client, then pipes the response to `sha256sum` and `cut` via streaming execution. -* [`http_checksum_native.rs`](./crates/hypershell-examples/examples/http_checksum_native.rs): The same checksum functionality, but uses Hypershell's native HTTP client together with an extended version of the DSL that introduces `Checksum` to the language syntax, showcasing the extensibility of the DSL. -* [`rust_playground.rs`](./crates/hypershell-examples/examples/rust_playground.rs): Shows how to encode and decode JSON, sending a Rust code snippet to the Rust Playground API and parsing its response. -* [`bluesky.rs`](./crates/hypershell-examples/examples/bluesky.rs): Connects to the Bluesky social media firehose via `nix-shell` and `websocat`, and then filters the stream using `grep`. -* [`bluesky_websocket.rs`](./crates/hypershell-examples/examples/bluesky_websocket.rs): The same Bluesky firehose example, but extends the DSL with native Websocket handling and using it in the program, showcasing the extensibility of the DSL. +Hypershell is an **experimental** proof of concept that shows what CGP can do. Its purpose is to +demonstrate how CGP builds highly modular DSLs in Rust, not to be a production-ready shell +replacement. -## Disclaimer +## License -Hypershell is an **experimental** proof of concept designed to showcase the capabilities of Context-Generic Programming (CGP). Its primary purpose is to demonstrate how CGP can be used to build highly modular DSLs in Rust, rather than to be a production-ready shell replacement. +Licensed under the MIT license. From c7568bb2c860c7752d95534a3d8bcf5eed46f703 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sat, 7 Nov 2026 22:10:10 +0100 Subject: [PATCH 21/37] Complete the crates' cargo metadata All nine crates shared one description and named no categories or homepage. Each crate now describes what it provides, and the workspace names the project page and the categories the DSL fits. --- Cargo.toml | 2 ++ crates/hypershell-components/Cargo.toml | 4 +++- crates/hypershell-examples/Cargo.toml | 4 +++- crates/hypershell-hash-components/Cargo.toml | 4 +++- crates/hypershell-json-components/Cargo.toml | 4 +++- crates/hypershell-macro/Cargo.toml | 4 +++- crates/hypershell-reqwest-components/Cargo.toml | 4 +++- crates/hypershell-tokio-components/Cargo.toml | 4 +++- crates/hypershell-tungstenite-components/Cargo.toml | 4 +++- crates/hypershell/Cargo.toml | 4 +++- 10 files changed, 29 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 08e17b1..fce7315 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,8 @@ rust-version = "1.90" edition = "2024" license = "MIT" repository = "https://github.com/contextgeneric/hypershell" +homepage = "https://contextgeneric.dev/docs/projects/hypershell/" +categories = ["command-line-interface", "rust-patterns"] authors = ["Soares Chen "] keywords = ["cgp"] diff --git a/crates/hypershell-components/Cargo.toml b/crates/hypershell-components/Cargo.toml index 8e4e083..7149c4b 100644 --- a/crates/hypershell-components/Cargo.toml +++ b/crates/hypershell-components/Cargo.toml @@ -4,10 +4,12 @@ version = "0.1.0" edition = { workspace = true } license = { workspace = true } repository = { workspace = true } +homepage = { workspace = true } +categories = { workspace = true } authors = { workspace = true } rust-version = { workspace = true } keywords = { workspace = true } -description = "Modular DSL for shellscripting in Rust" +description = "The core abstract syntax and CGP components of the Hypershell DSL." [dependencies] cgp = { workspace = true } diff --git a/crates/hypershell-examples/Cargo.toml b/crates/hypershell-examples/Cargo.toml index 77e36e8..949649a 100644 --- a/crates/hypershell-examples/Cargo.toml +++ b/crates/hypershell-examples/Cargo.toml @@ -4,10 +4,12 @@ version = "0.1.0" edition = { workspace = true } license = { workspace = true } repository = { workspace = true } +homepage = { workspace = true } +categories = { workspace = true } authors = { workspace = true } rust-version = { workspace = true } keywords = { workspace = true } -description = "Modular DSL for shellscripting in Rust" +description = "Runnable examples of the Hypershell DSL." [dependencies] hypershell = { workspace = true } diff --git a/crates/hypershell-hash-components/Cargo.toml b/crates/hypershell-hash-components/Cargo.toml index 908adae..634350d 100644 --- a/crates/hypershell-hash-components/Cargo.toml +++ b/crates/hypershell-hash-components/Cargo.toml @@ -4,10 +4,12 @@ version = "0.1.0" edition = { workspace = true } license = { workspace = true } repository = { workspace = true } +homepage = { workspace = true } +categories = { workspace = true } authors = { workspace = true } rust-version = { workspace = true } keywords = { workspace = true } -description = "Modular DSL for shellscripting in Rust" +description = "Checksum and hex-encoding handlers for Hypershell." [dependencies] cgp = { workspace = true } diff --git a/crates/hypershell-json-components/Cargo.toml b/crates/hypershell-json-components/Cargo.toml index 1b8dafa..4944000 100644 --- a/crates/hypershell-json-components/Cargo.toml +++ b/crates/hypershell-json-components/Cargo.toml @@ -4,10 +4,12 @@ version = "0.1.0" edition = { workspace = true } license = { workspace = true } repository = { workspace = true } +homepage = { workspace = true } +categories = { workspace = true } authors = { workspace = true } rust-version = { workspace = true } keywords = { workspace = true } -description = "Modular DSL for shellscripting in Rust" +description = "JSON encoding and decoding handlers for Hypershell." [dependencies] hypershell-components = { workspace = true } diff --git a/crates/hypershell-macro/Cargo.toml b/crates/hypershell-macro/Cargo.toml index 87a65bd..5e539e3 100644 --- a/crates/hypershell-macro/Cargo.toml +++ b/crates/hypershell-macro/Cargo.toml @@ -4,10 +4,12 @@ version = "0.1.0" edition = { workspace = true } license = { workspace = true } repository = { workspace = true } +homepage = { workspace = true } +categories = { workspace = true } authors = { workspace = true } rust-version = { workspace = true } keywords = { workspace = true } -description = "Modular DSL for shellscripting in Rust" +description = "The hypershell! procedural macro for the Hypershell DSL." [lib] proc-macro = true diff --git a/crates/hypershell-reqwest-components/Cargo.toml b/crates/hypershell-reqwest-components/Cargo.toml index dae3d53..24109a6 100644 --- a/crates/hypershell-reqwest-components/Cargo.toml +++ b/crates/hypershell-reqwest-components/Cargo.toml @@ -4,10 +4,12 @@ version = "0.1.0" edition = { workspace = true } license = { workspace = true } repository = { workspace = true } +homepage = { workspace = true } +categories = { workspace = true } authors = { workspace = true } rust-version = { workspace = true } keywords = { workspace = true } -description = "Modular DSL for shellscripting in Rust" +description = "Native HTTP handlers for Hypershell, built on reqwest." [dependencies] hypershell-components = { workspace = true } diff --git a/crates/hypershell-tokio-components/Cargo.toml b/crates/hypershell-tokio-components/Cargo.toml index 0bc4fad..271004b 100644 --- a/crates/hypershell-tokio-components/Cargo.toml +++ b/crates/hypershell-tokio-components/Cargo.toml @@ -4,10 +4,12 @@ version = "0.1.0" edition = { workspace = true } license = { workspace = true } repository = { workspace = true } +homepage = { workspace = true } +categories = { workspace = true } authors = { workspace = true } rust-version = { workspace = true } keywords = { workspace = true } -description = "Modular DSL for shellscripting in Rust" +description = "Tokio-based handlers for executing commands and handling file I/O in Hypershell." [dependencies] hypershell-components = { workspace = true } diff --git a/crates/hypershell-tungstenite-components/Cargo.toml b/crates/hypershell-tungstenite-components/Cargo.toml index 89bf0f7..644f808 100644 --- a/crates/hypershell-tungstenite-components/Cargo.toml +++ b/crates/hypershell-tungstenite-components/Cargo.toml @@ -4,10 +4,12 @@ version = "0.1.0" edition = { workspace = true } license = { workspace = true } repository = { workspace = true } +homepage = { workspace = true } +categories = { workspace = true } authors = { workspace = true } rust-version = { workspace = true } keywords = { workspace = true } -description = "Modular DSL for shellscripting in Rust" +description = "Native WebSocket handlers for Hypershell, built on tokio-tungstenite." [dependencies] hypershell-components = { workspace = true } diff --git a/crates/hypershell/Cargo.toml b/crates/hypershell/Cargo.toml index 0c75c21..fac93d1 100644 --- a/crates/hypershell/Cargo.toml +++ b/crates/hypershell/Cargo.toml @@ -4,10 +4,12 @@ version = "0.1.0" edition = { workspace = true } license = { workspace = true } repository = { workspace = true } +homepage = { workspace = true } +categories = { workspace = true } authors = { workspace = true } rust-version = { workspace = true } keywords = { workspace = true } -description = "Modular DSL for shellscripting in Rust" +description = "A modular, type-level DSL for shell-script-like programs in Rust." [dependencies] hypershell-components = { workspace = true } From 2ada75d49787314f74f04088a11b4596f50aa774 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sun, 8 Nov 2026 00:40:50 +0100 Subject: [PATCH 22/37] Document the component constructs The four components in `hypershell-components` now carry a doc comment, so a reader of the crate docs sees what each type and extractor is for. --- crates/hypershell-components/src/components/command_arg.rs | 2 ++ crates/hypershell-components/src/components/method_arg.rs | 2 ++ crates/hypershell-components/src/components/string_arg.rs | 1 + crates/hypershell-components/src/components/url_arg.rs | 2 ++ 4 files changed, 7 insertions(+) diff --git a/crates/hypershell-components/src/components/command_arg.rs b/crates/hypershell-components/src/components/command_arg.rs index e3de96f..dbaf191 100644 --- a/crates/hypershell-components/src/components/command_arg.rs +++ b/crates/hypershell-components/src/components/command_arg.rs @@ -3,12 +3,14 @@ use core::marker::PhantomData; use cgp::core::component::UseDelegate; use cgp::prelude::*; +/// A context's abstract command-argument type. #[cgp_type] #[prefix(@hypershell.core in DefaultNamespace)] pub trait HasCommandArgType { type CommandArg; } +/// Extracts a command argument from the context. #[cgp_component(CommandArgExtractor)] #[prefix(@hypershell.core in DefaultNamespace)] #[derive_delegate(UseDelegate)] diff --git a/crates/hypershell-components/src/components/method_arg.rs b/crates/hypershell-components/src/components/method_arg.rs index 5f4b040..03471c0 100644 --- a/crates/hypershell-components/src/components/method_arg.rs +++ b/crates/hypershell-components/src/components/method_arg.rs @@ -3,12 +3,14 @@ use core::marker::PhantomData; use cgp::core::component::UseDelegate; use cgp::prelude::*; +/// A context's abstract HTTP-method type. #[cgp_type] #[prefix(@hypershell.core in DefaultNamespace)] pub trait HasHttpMethodType { type HttpMethod; } +/// Extracts an HTTP method from the context. #[cgp_component(MethodArgExtractor)] #[prefix(@hypershell.core in DefaultNamespace)] #[derive_delegate(UseDelegate)] diff --git a/crates/hypershell-components/src/components/string_arg.rs b/crates/hypershell-components/src/components/string_arg.rs index 8fbec53..fdb9400 100644 --- a/crates/hypershell-components/src/components/string_arg.rs +++ b/crates/hypershell-components/src/components/string_arg.rs @@ -4,6 +4,7 @@ use core::marker::PhantomData; use cgp::core::component::UseDelegate; use cgp::prelude::*; +/// Extracts a string argument from the context. #[cgp_component(StringArgExtractor)] #[prefix(@hypershell.core in DefaultNamespace)] #[derive_delegate(UseDelegate)] diff --git a/crates/hypershell-components/src/components/url_arg.rs b/crates/hypershell-components/src/components/url_arg.rs index 56b92e9..586b368 100644 --- a/crates/hypershell-components/src/components/url_arg.rs +++ b/crates/hypershell-components/src/components/url_arg.rs @@ -3,12 +3,14 @@ use core::marker::PhantomData; use cgp::core::component::UseDelegate; use cgp::prelude::*; +/// A context's abstract URL type. #[cgp_type] #[prefix(@hypershell.core in DefaultNamespace)] pub trait HasUrlType { type Url; } +/// Extracts a URL from the context. #[cgp_component(UrlArgExtractor)] #[prefix(@hypershell.core in DefaultNamespace)] #[derive_delegate(UseDelegate)] From f5a3234a49cd8a430edc097ff3f4b9ef000df1c6 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sun, 8 Nov 2026 10:05:41 +0100 Subject: [PATCH 23/37] Document the constructs the language exposes Every component, provider, and provider struct in the crates now carries a doc comment saying what it is for, so the crate docs explain the language's pieces instead of listing them bare. Each line distils the knowledge base's reference entry for the same item, and links the website page that explains the construct where one exists. The tables and namespaces that `delegate_components!` and `cgp_namespace!` declare take their doc from the macro instead: rustdoc ignores a doc comment on a macro invocation, and warnings are denied here. --- .../src/providers/box_async.rs | 2 ++ .../src/providers/call.rs | 1 + .../src/providers/convert.rs | 5 +++++ .../src/providers/method_arg.rs | 2 ++ .../src/providers/return.rs | 2 ++ .../src/providers/string_arg.rs | 10 ++++++++++ .../src/providers/url_arg.rs | 4 ++++ .../hypershell-components/src/providers/use.rs | 2 ++ .../src/providers/compare.rs | 1 + crates/hypershell-examples/src/providers/if.rs | 1 + .../src/providers/bytes_to_hex.rs | 2 ++ .../src/providers/stream_checksum.rs | 2 ++ .../src/providers/handler.rs | 4 ++++ .../src/components/client.rs | 1 + .../src/components/update_builder.rs | 1 + .../src/providers/convert.rs | 1 + .../src/providers/core_request.rs | 2 ++ .../src/providers/headers.rs | 4 ++++ .../src/providers/method_arg.rs | 2 ++ .../src/providers/simple_request.rs | 3 +++ .../src/providers/streaming_request.rs | 2 ++ .../src/providers/url_encode.rs | 2 ++ .../src/components/update_command.rs | 1 + .../src/providers/core_exec.rs | 4 ++++ .../src/providers/file.rs | 4 ++++ .../src/providers/join_args.rs | 2 ++ .../src/providers/line.rs | 2 ++ .../src/providers/out.rs | 2 ++ .../src/providers/simple_exec.rs | 5 +++++ .../src/providers/stream.rs | 18 ++++++++++++++++++ .../src/providers/streaming_exec.rs | 2 ++ .../src/providers/update_command.rs | 4 ++++ .../src/providers/websocket.rs | 2 ++ 33 files changed, 102 insertions(+) diff --git a/crates/hypershell-components/src/providers/box_async.rs b/crates/hypershell-components/src/providers/box_async.rs index 78b495d..d549293 100644 --- a/crates/hypershell-components/src/providers/box_async.rs +++ b/crates/hypershell-components/src/providers/box_async.rs @@ -5,6 +5,8 @@ use core::pin::Pin; use cgp::extra::handler::{Handler, HandlerComponent}; use cgp::prelude::*; +/// Runs a handler with its future boxed, erasing the future's type. See +/// [the abstract syntax page](https://contextgeneric.dev/docs/projects/hypershell/architecture/abstract-syntax). #[cgp_impl(new BoxHandler)] #[use_type(HasErrorType.Error)] #[use_provider(InHandler: Handler)] diff --git a/crates/hypershell-components/src/providers/call.rs b/crates/hypershell-components/src/providers/call.rs index 41c1610..4dde756 100644 --- a/crates/hypershell-components/src/providers/call.rs +++ b/crates/hypershell-components/src/providers/call.rs @@ -3,6 +3,7 @@ use core::marker::PhantomData; use cgp::extra::handler::{CanHandle, Handler, HandlerComponent}; use cgp::prelude::*; +/// Answers for any syntax by handling `InCode` on the context. #[cgp_impl(new Call)] impl Handler where diff --git a/crates/hypershell-components/src/providers/convert.rs b/crates/hypershell-components/src/providers/convert.rs index 17546ae..4b3119f 100644 --- a/crates/hypershell-components/src/providers/convert.rs +++ b/crates/hypershell-components/src/providers/convert.rs @@ -9,6 +9,8 @@ use cgp::prelude::*; use crate::dsl::ConvertTo; +/// Converts its input into the output type with `Into`. See +/// [the abstract syntax page](https://contextgeneric.dev/docs/projects/hypershell/architecture/abstract-syntax). #[cgp_impl(new HandleConvert)] impl Computer, Input> where @@ -21,6 +23,8 @@ where } } +/// Decodes byte input as a UTF-8 string, wrapping the failure with the raw bytes. See +/// [the streams and input dispatch page](https://contextgeneric.dev/docs/projects/hypershell/architecture/streams-and-input-dispatch). #[cgp_impl(new DecodeUtf8Bytes)] #[use_type(HasErrorType.Error)] impl Handler @@ -41,6 +45,7 @@ where } } +/// The detail that records the raw bytes of an input that is not valid UTF-8. pub struct DecodeUtf8InputError<'a> { pub raw_input: &'a [u8], } diff --git a/crates/hypershell-components/src/providers/method_arg.rs b/crates/hypershell-components/src/providers/method_arg.rs index bf9c87e..921724e 100644 --- a/crates/hypershell-components/src/providers/method_arg.rs +++ b/crates/hypershell-components/src/providers/method_arg.rs @@ -5,6 +5,8 @@ use cgp::prelude::*; use crate::components::{HasHttpMethodType, MethodArgExtractor, MethodArgExtractorComponent}; use crate::dsl::FieldArg; +/// Reads the HTTP method from the context field named `Tag`. See +/// [the abstract syntax page](https://contextgeneric.dev/docs/projects/hypershell/architecture/abstract-syntax). #[cgp_impl(new ExtractMethodFieldArg)] impl MethodArgExtractor> for Context where diff --git a/crates/hypershell-components/src/providers/return.rs b/crates/hypershell-components/src/providers/return.rs index a384f8f..ade039e 100644 --- a/crates/hypershell-components/src/providers/return.rs +++ b/crates/hypershell-components/src/providers/return.rs @@ -3,6 +3,8 @@ use core::marker::PhantomData; use cgp::extra::handler::{Handler, HandlerComponent}; use cgp::prelude::*; +/// Returns its input unchanged, for a stage that only passes a value on. See +/// [the streams and input dispatch page](https://contextgeneric.dev/docs/projects/hypershell/architecture/streams-and-input-dispatch). #[cgp_impl(new ReturnInput)] impl Handler for Context where diff --git a/crates/hypershell-components/src/providers/string_arg.rs b/crates/hypershell-components/src/providers/string_arg.rs index 5d20361..9b13c7e 100644 --- a/crates/hypershell-components/src/providers/string_arg.rs +++ b/crates/hypershell-components/src/providers/string_arg.rs @@ -12,6 +12,8 @@ use crate::components::{ }; use crate::dsl::{FieldArg, JoinArgs, StaticArg}; +/// Extracts a command argument by converting the argument's string form with `From`. See +/// [the abstract syntax page](https://contextgeneric.dev/docs/projects/hypershell/architecture/abstract-syntax). #[cgp_impl(new ExtractStringCommandArg)] impl CommandArgExtractor for Context where @@ -23,6 +25,8 @@ where } } +/// Extracts a literal argument by formatting its type's default value with `Display`. See +/// [the abstract syntax page](https://contextgeneric.dev/docs/projects/hypershell/architecture/abstract-syntax). #[cgp_impl(new ExtractStaticArg)] impl StringArgExtractor> for Context where @@ -36,6 +40,8 @@ where } } +/// Extracts the context field named `Tag`, formatted with `Display`. See +/// [the abstract syntax page](https://contextgeneric.dev/docs/projects/hypershell/architecture/abstract-syntax). #[cgp_impl(new ExtractFieldArg)] impl StringArgExtractor> for Context where @@ -46,8 +52,11 @@ where } } +/// Concatenates a `JoinArgs` list into one string, with no separator. See +/// [the abstract syntax page](https://contextgeneric.dev/docs/projects/hypershell/architecture/abstract-syntax). pub struct JoinStringArgs; +/// Extracts the first element of a `JoinArgs` list and appends the rest. #[cgp_impl(JoinStringArgs)] impl StringArgExtractor>> for Context where @@ -69,6 +78,7 @@ where } } +/// Extracts the empty tail of a `JoinArgs` list as an empty string. #[cgp_impl(JoinStringArgs)] impl StringArgExtractor> for Context { fn extract_string_arg( diff --git a/crates/hypershell-components/src/providers/url_arg.rs b/crates/hypershell-components/src/providers/url_arg.rs index 8728290..56a01cf 100644 --- a/crates/hypershell-components/src/providers/url_arg.rs +++ b/crates/hypershell-components/src/providers/url_arg.rs @@ -8,6 +8,8 @@ use crate::components::{ }; use crate::dsl::FieldArg; +/// Parses the argument's string form into the context's URL type. See +/// [the abstract syntax page](https://contextgeneric.dev/docs/projects/hypershell/architecture/abstract-syntax). #[cgp_impl(new ExtractStringUrlArg)] impl UrlArgExtractor for Context where @@ -23,6 +25,8 @@ where } } +/// Reads a pre-parsed URL from the context field named `Tag`. See +/// [the abstract syntax page](https://contextgeneric.dev/docs/projects/hypershell/architecture/abstract-syntax). #[cgp_impl(new ExtractUrlFieldArg)] impl UrlArgExtractor> for Context where diff --git a/crates/hypershell-components/src/providers/use.rs b/crates/hypershell-components/src/providers/use.rs index 91b44d2..43e480f 100644 --- a/crates/hypershell-components/src/providers/use.rs +++ b/crates/hypershell-components/src/providers/use.rs @@ -5,6 +5,8 @@ use cgp::prelude::*; use crate::dsl::Use; +/// Runs the named provider inline instead of the context's wiring for the stage. See +/// [the abstract syntax page](https://contextgeneric.dev/docs/projects/hypershell/architecture/abstract-syntax). #[cgp_impl(new HandleUseProvider)] impl Handler, Input> for Context where diff --git a/crates/hypershell-examples/src/providers/compare.rs b/crates/hypershell-examples/src/providers/compare.rs index 752e946..0adff23 100644 --- a/crates/hypershell-examples/src/providers/compare.rs +++ b/crates/hypershell-examples/src/providers/compare.rs @@ -6,6 +6,7 @@ use hypershell::prelude::CanHandle; use crate::dsl::Compare; +/// Runs two sub-programs on their inputs and reports whether their outputs are equal. #[cgp_impl(new HandleCompare)] impl Handler, (InputA, InputB)> for Context diff --git a/crates/hypershell-examples/src/providers/if.rs b/crates/hypershell-examples/src/providers/if.rs index f4d939b..9f8b70b 100644 --- a/crates/hypershell-examples/src/providers/if.rs +++ b/crates/hypershell-examples/src/providers/if.rs @@ -6,6 +6,7 @@ use hypershell::prelude::CanHandle; use crate::dsl::If; +/// Runs one of two sub-programs on the branch input, chosen by a condition sub-program. #[cgp_impl(new HandleIf)] impl Handler, (InputCond, InputBranch)> for Context diff --git a/crates/hypershell-hash-components/src/providers/bytes_to_hex.rs b/crates/hypershell-hash-components/src/providers/bytes_to_hex.rs index 097d43a..8cf541a 100644 --- a/crates/hypershell-hash-components/src/providers/bytes_to_hex.rs +++ b/crates/hypershell-hash-components/src/providers/bytes_to_hex.rs @@ -3,6 +3,8 @@ use core::marker::PhantomData; use cgp::extra::handler::{Handler, HandlerComponent}; use cgp::prelude::*; +/// Encodes byte-like input as a lowercase hexadecimal string. See +/// [the native checksum example](https://contextgeneric.dev/docs/projects/hypershell/examples/http-checksum-native). #[cgp_impl(new HandleBytesToHex)] impl Handler for Context where diff --git a/crates/hypershell-hash-components/src/providers/stream_checksum.rs b/crates/hypershell-hash-components/src/providers/stream_checksum.rs index 9b9b5fe..195eaff 100644 --- a/crates/hypershell-hash-components/src/providers/stream_checksum.rs +++ b/crates/hypershell-hash-components/src/providers/stream_checksum.rs @@ -8,6 +8,8 @@ use sha2::digest::generic_array::GenericArray; use crate::dsl::Checksum; +/// Folds a stream of byte chunks into a digest with the chosen `sha2` hasher. See +/// [the native checksum example](https://contextgeneric.dev/docs/projects/hypershell/examples/http-checksum-native). #[cgp_impl(new HandleStreamChecksum)] impl Handler, Input> for Context where diff --git a/crates/hypershell-json-components/src/providers/handler.rs b/crates/hypershell-json-components/src/providers/handler.rs index 2b25b0a..93e51c1 100644 --- a/crates/hypershell-json-components/src/providers/handler.rs +++ b/crates/hypershell-json-components/src/providers/handler.rs @@ -7,6 +7,8 @@ use hypershell_components::dsl::DecodeJson; use serde::Serialize; use serde::de::DeserializeOwned; +/// Deserializes byte input into `Output` with `serde_json`. See +/// [the abstract syntax page](https://contextgeneric.dev/docs/projects/hypershell/architecture/abstract-syntax). #[cgp_impl(new HandleDecodeJson)] impl Handler, Input> for Context where @@ -26,6 +28,8 @@ where } } +/// Serializes its input to JSON bytes with `serde_json`. See +/// [the abstract syntax page](https://contextgeneric.dev/docs/projects/hypershell/architecture/abstract-syntax). #[cgp_impl(new HandleEncodeJson)] impl Handler for Context where diff --git a/crates/hypershell-reqwest-components/src/components/client.rs b/crates/hypershell-reqwest-components/src/components/client.rs index cca2a39..36fc594 100644 --- a/crates/hypershell-reqwest-components/src/components/client.rs +++ b/crates/hypershell-reqwest-components/src/components/client.rs @@ -1,6 +1,7 @@ use cgp::prelude::*; use reqwest::Client; +/// Gets the `reqwest` client an HTTP handler sends its requests with. #[cgp_getter] #[prefix(@hypershell.reqwest in DefaultNamespace)] pub trait HasReqwestClient { diff --git a/crates/hypershell-reqwest-components/src/components/update_builder.rs b/crates/hypershell-reqwest-components/src/components/update_builder.rs index 640b3e1..a07fbf0 100644 --- a/crates/hypershell-reqwest-components/src/components/update_builder.rs +++ b/crates/hypershell-reqwest-components/src/components/update_builder.rs @@ -4,6 +4,7 @@ use cgp::core::component::UseDelegate; use cgp::prelude::*; use reqwest::RequestBuilder; +/// Applies a request-parameter syntax to a `reqwest::RequestBuilder`. #[cgp_component(RequestBuilderUpdater)] #[derive_delegate(UseDelegate)] #[prefix(@hypershell.reqwest in DefaultNamespace)] diff --git a/crates/hypershell-reqwest-components/src/providers/convert.rs b/crates/hypershell-reqwest-components/src/providers/convert.rs index 7fdcb47..b84b69e 100644 --- a/crates/hypershell-reqwest-components/src/providers/convert.rs +++ b/crates/hypershell-reqwest-components/src/providers/convert.rs @@ -6,6 +6,7 @@ use reqwest::Body; use tokio::io::AsyncRead; use tokio_util::io::ReaderStream; +/// Converts an async reader into a `reqwest::Body` streamed as it is read. #[cgp_impl(new StreamToBody)] impl Handler for Context where diff --git a/crates/hypershell-reqwest-components/src/providers/core_request.rs b/crates/hypershell-reqwest-components/src/providers/core_request.rs index bbbd5c7..e81c9e5 100644 --- a/crates/hypershell-reqwest-components/src/providers/core_request.rs +++ b/crates/hypershell-reqwest-components/src/providers/core_request.rs @@ -8,6 +8,8 @@ use reqwest::{Body, Method, Response, Url}; use crate::components::{CanUpdateRequestBuilder, HasReqwestClient}; use crate::dsl::CoreHttpRequest; +/// Builds a request from the method, URL, and header syntax, attaches the body, and sends it. See +/// [the abstract syntax page](https://contextgeneric.dev/docs/projects/hypershell/architecture/abstract-syntax). #[cgp_impl(new HandleCoreHttpRequest)] impl Handler, Input> for Context diff --git a/crates/hypershell-reqwest-components/src/providers/headers.rs b/crates/hypershell-reqwest-components/src/providers/headers.rs index 4978cc2..ceac77e 100644 --- a/crates/hypershell-reqwest-components/src/providers/headers.rs +++ b/crates/hypershell-reqwest-components/src/providers/headers.rs @@ -10,6 +10,8 @@ use crate::components::{ CanUpdateRequestBuilder, RequestBuilderUpdater, RequestBuilderUpdaterComponent, }; +/// Sets one header on the request builder from the extracted key and value. See +/// [the abstract syntax page](https://contextgeneric.dev/docs/projects/hypershell/architecture/abstract-syntax). #[cgp_impl(new UpdateRequestHeader)] impl RequestBuilderUpdater> for Context where @@ -34,6 +36,8 @@ where } } +/// Applies each `Header` of a `WithHeaders` list to the request builder in turn. See +/// [the abstract syntax page](https://contextgeneric.dev/docs/projects/hypershell/architecture/abstract-syntax). pub struct UpdateRequestHeaders; #[cgp_impl(UpdateRequestHeaders)] diff --git a/crates/hypershell-reqwest-components/src/providers/method_arg.rs b/crates/hypershell-reqwest-components/src/providers/method_arg.rs index c746f64..249da48 100644 --- a/crates/hypershell-reqwest-components/src/providers/method_arg.rs +++ b/crates/hypershell-reqwest-components/src/providers/method_arg.rs @@ -7,6 +7,8 @@ use hypershell_components::components::{ use hypershell_components::dsl::{DeleteMethod, GetMethod, PostMethod, PutMethod}; use reqwest::Method; +/// Maps an HTTP method marker to the matching `reqwest::Method` constant. See +/// [the abstract syntax page](https://contextgeneric.dev/docs/projects/hypershell/architecture/abstract-syntax). pub struct ExtractReqwestMethod; #[cgp_impl(ExtractReqwestMethod)] diff --git a/crates/hypershell-reqwest-components/src/providers/simple_request.rs b/crates/hypershell-reqwest-components/src/providers/simple_request.rs index 0bac57a..b79c799 100644 --- a/crates/hypershell-reqwest-components/src/providers/simple_request.rs +++ b/crates/hypershell-reqwest-components/src/providers/simple_request.rs @@ -7,11 +7,14 @@ use reqwest::Response; use crate::dsl::CoreHttpRequest; +/// The error raised for a response whose status is not a success. #[derive(Debug)] pub struct ErrorResponse { pub response: Response, } +/// Sends one request with the input as its body and returns the whole response body. See +/// [the abstract syntax page](https://contextgeneric.dev/docs/projects/hypershell/architecture/abstract-syntax). #[cgp_impl(new HandleSimpleHttpRequest)] impl Handler, Input> for Context diff --git a/crates/hypershell-reqwest-components/src/providers/streaming_request.rs b/crates/hypershell-reqwest-components/src/providers/streaming_request.rs index 4c2df6e..4d720b7 100644 --- a/crates/hypershell-reqwest-components/src/providers/streaming_request.rs +++ b/crates/hypershell-reqwest-components/src/providers/streaming_request.rs @@ -10,6 +10,8 @@ use reqwest::Response; use crate::dsl::CoreHttpRequest; use crate::providers::ErrorResponse; +/// Sends one request with the input as its body and returns the response body as a stream. See +/// [the abstract syntax page](https://contextgeneric.dev/docs/projects/hypershell/architecture/abstract-syntax). #[cgp_impl(new HandleStreamingHttpRequest)] impl Handler, Input> for Context diff --git a/crates/hypershell-reqwest-components/src/providers/url_encode.rs b/crates/hypershell-reqwest-components/src/providers/url_encode.rs index 204e988..1df5a21 100644 --- a/crates/hypershell-reqwest-components/src/providers/url_encode.rs +++ b/crates/hypershell-reqwest-components/src/providers/url_encode.rs @@ -8,6 +8,8 @@ use hypershell_components::components::{ use hypershell_components::dsl::UrlEncodeArg; use url::form_urlencoded; +/// Percent-encodes the argument's string form for use in a URL query. See +/// [the abstract syntax page](https://contextgeneric.dev/docs/projects/hypershell/architecture/abstract-syntax). #[cgp_impl(new UrlEncodeStringArg)] impl StringArgExtractor> for Context where diff --git a/crates/hypershell-tokio-components/src/components/update_command.rs b/crates/hypershell-tokio-components/src/components/update_command.rs index 3008400..2b3c2b9 100644 --- a/crates/hypershell-tokio-components/src/components/update_command.rs +++ b/crates/hypershell-tokio-components/src/components/update_command.rs @@ -4,6 +4,7 @@ use cgp::core::component::UseDelegate; use cgp::prelude::*; use tokio::process::Command; +/// Applies an argument-list syntax to a Tokio `Command`. #[cgp_component(CommandUpdater)] #[prefix(@hypershell.tokio in DefaultNamespace)] #[derive_delegate(UseDelegate)] diff --git a/crates/hypershell-tokio-components/src/providers/core_exec.rs b/crates/hypershell-tokio-components/src/providers/core_exec.rs index b6c79a7..01f8240 100644 --- a/crates/hypershell-tokio-components/src/providers/core_exec.rs +++ b/crates/hypershell-tokio-components/src/providers/core_exec.rs @@ -13,6 +13,8 @@ use tokio::process::{Child, Command}; use crate::components::CanUpdateCommand; use crate::dsl::CoreExec; +/// Builds a Tokio `Command` from the path and arguments and spawns it with all three streams piped. See +/// [the abstract syntax page](https://contextgeneric.dev/docs/projects/hypershell/architecture/abstract-syntax). #[cgp_impl(new HandleCoreExec)] impl Handler, ()> for Context where @@ -59,10 +61,12 @@ where } } +/// The detail that formats a failed spawn with the command's program and arguments. pub struct SpawnCommandFailure<'a> { pub command: &'a Command, } +/// The detail that names the program a failed spawn could not find. pub struct CommandNotFound<'a> { pub command: &'a Command, } diff --git a/crates/hypershell-tokio-components/src/providers/file.rs b/crates/hypershell-tokio-components/src/providers/file.rs index e209594..3b3815a 100644 --- a/crates/hypershell-tokio-components/src/providers/file.rs +++ b/crates/hypershell-tokio-components/src/providers/file.rs @@ -8,6 +8,8 @@ use hypershell_components::dsl::{ReadFile, WriteFile}; use tokio::fs::File; use tokio::io::AsyncRead; +/// Opens a file as a Tokio reader. See +/// [the streams and input dispatch page](https://contextgeneric.dev/docs/projects/hypershell/architecture/streams-and-input-dispatch). #[cgp_impl(new HandleReadFile)] impl Handler, ()> for Context where @@ -31,6 +33,8 @@ where } } +/// Creates or truncates a file and copies its input into it. See +/// [the streams and input dispatch page](https://contextgeneric.dev/docs/projects/hypershell/architecture/streams-and-input-dispatch). #[cgp_impl(new HandleWriteFile)] impl Handler, Input> for Context where diff --git a/crates/hypershell-tokio-components/src/providers/join_args.rs b/crates/hypershell-tokio-components/src/providers/join_args.rs index 0f1d438..d36b684 100644 --- a/crates/hypershell-tokio-components/src/providers/join_args.rs +++ b/crates/hypershell-tokio-components/src/providers/join_args.rs @@ -7,6 +7,8 @@ use hypershell_components::components::{ }; use hypershell_components::dsl::JoinArgs; +/// Joins a `JoinArgs` list into one path with `PathBuf::join`, skipping an empty tail. See +/// [the abstract syntax page](https://contextgeneric.dev/docs/projects/hypershell/architecture/abstract-syntax). pub struct JoinExtractArgs; #[cgp_impl(JoinExtractArgs)] diff --git a/crates/hypershell-tokio-components/src/providers/line.rs b/crates/hypershell-tokio-components/src/providers/line.rs index 70ae723..6d0f4f7 100644 --- a/crates/hypershell-tokio-components/src/providers/line.rs +++ b/crates/hypershell-tokio-components/src/providers/line.rs @@ -7,6 +7,8 @@ use hypershell_components::dsl::StreamToLines; use tokio::io::AsyncRead; use tokio_util::codec::{FramedRead, LinesCodec, LinesCodecError}; +/// Reads an async reader as a stream of lines. See +/// [the streams and input dispatch page](https://contextgeneric.dev/docs/projects/hypershell/architecture/streams-and-input-dispatch). #[cgp_impl(new HandleStreamToLines)] impl Handler for Context where diff --git a/crates/hypershell-tokio-components/src/providers/out.rs b/crates/hypershell-tokio-components/src/providers/out.rs index 457facd..4222606 100644 --- a/crates/hypershell-tokio-components/src/providers/out.rs +++ b/crates/hypershell-tokio-components/src/providers/out.rs @@ -5,6 +5,8 @@ use cgp::prelude::*; use hypershell_components::dsl::StreamToStdout; use tokio::io::{AsyncRead, copy}; +/// Copies its input to the program's standard output. See +/// [the streams and input dispatch page](https://contextgeneric.dev/docs/projects/hypershell/architecture/streams-and-input-dispatch). #[cgp_impl(new HandleStreamToStdout)] impl Handler for Context where diff --git a/crates/hypershell-tokio-components/src/providers/simple_exec.rs b/crates/hypershell-tokio-components/src/providers/simple_exec.rs index 899a8a5..90146cc 100644 --- a/crates/hypershell-tokio-components/src/providers/simple_exec.rs +++ b/crates/hypershell-tokio-components/src/providers/simple_exec.rs @@ -10,10 +10,13 @@ use tokio::process::Child; use crate::dsl::CoreExec; +/// The error raised for a command that exits with a non-success status. pub struct ExecOutputError { pub output: Output, } +/// Runs a command to completion, writing its input to standard input and returning standard output. See +/// [the abstract syntax page](https://contextgeneric.dev/docs/projects/hypershell/architecture/abstract-syntax). #[cgp_impl(new HandleSimpleExec)] impl Handler, Input> for Context where @@ -59,6 +62,7 @@ where } } +/// The detail that marks a failed write to a child's standard input. pub struct StdinPipeError; impl Debug for StdinPipeError { @@ -67,6 +71,7 @@ impl Debug for StdinPipeError { } } +/// The detail that marks a failed wait for a child's output. pub struct WaitWithOutputError; impl Debug for WaitWithOutputError { diff --git a/crates/hypershell-tokio-components/src/providers/stream.rs b/crates/hypershell-tokio-components/src/providers/stream.rs index c74b9c5..f243538 100644 --- a/crates/hypershell-tokio-components/src/providers/stream.rs +++ b/crates/hypershell-tokio-components/src/providers/stream.rs @@ -13,6 +13,8 @@ use tokio_util::io::ReaderStream; use crate::types::{FuturesAsyncReadStream, FuturesStream, TokioAsyncReadStream}; +/// Reads a Tokio reader to the end as bytes. See +/// [the streams and input dispatch page](https://contextgeneric.dev/docs/projects/hypershell/architecture/streams-and-input-dispatch). #[cgp_impl(new HandleTokioAsyncReadToBytes)] impl Handler for Context where @@ -37,6 +39,8 @@ where } } +/// Reads a Tokio reader to the end as a UTF-8 string. See +/// [the streams and input dispatch page](https://contextgeneric.dev/docs/projects/hypershell/architecture/streams-and-input-dispatch). #[cgp_impl(new HandleTokioAsyncReadToString)] impl Handler for Context where @@ -61,6 +65,8 @@ where } } +/// Wraps byte input as a Tokio reader. See +/// [the streams and input dispatch page](https://contextgeneric.dev/docs/projects/hypershell/architecture/streams-and-input-dispatch). #[cgp_impl(new HandleBytesToTokioAsyncRead)] impl Handler for Context where @@ -78,6 +84,8 @@ where } } +/// Wraps byte input as a futures stream of one chunk. See +/// [the streams and input dispatch page](https://contextgeneric.dev/docs/projects/hypershell/architecture/streams-and-input-dispatch). #[cgp_impl(new HandleBytesToStream)] impl Handler for Context where @@ -95,6 +103,8 @@ where } } +/// Adapts a futures reader to a Tokio reader. See +/// [the streams and input dispatch page](https://contextgeneric.dev/docs/projects/hypershell/architecture/streams-and-input-dispatch). #[cgp_impl(new FuturesToTokioAsyncRead)] impl Handler for Context where @@ -112,6 +122,8 @@ where } } +/// Adapts a Tokio reader to a futures reader. See +/// [the streams and input dispatch page](https://contextgeneric.dev/docs/projects/hypershell/architecture/streams-and-input-dispatch). #[cgp_impl(new TokioToFuturesAsyncRead)] impl Handler for Context where @@ -129,6 +141,8 @@ where } } +/// Tags a Tokio reader with its wrapper type. See +/// [the streams and input dispatch page](https://contextgeneric.dev/docs/projects/hypershell/architecture/streams-and-input-dispatch). #[cgp_impl(new WrapTokioAsyncRead)] impl Handler for Context where @@ -146,6 +160,8 @@ where } } +/// Tags a futures reader with its wrapper type. See +/// [the streams and input dispatch page](https://contextgeneric.dev/docs/projects/hypershell/architecture/streams-and-input-dispatch). #[cgp_impl(new WrapFuturesAsyncRead)] impl Handler for Context where @@ -163,6 +179,8 @@ where } } +/// Reads a Tokio reader as a futures stream of chunks. See +/// [the streams and input dispatch page](https://contextgeneric.dev/docs/projects/hypershell/architecture/streams-and-input-dispatch). #[cgp_impl(new AsyncReadToStream)] impl Handler for Context where diff --git a/crates/hypershell-tokio-components/src/providers/streaming_exec.rs b/crates/hypershell-tokio-components/src/providers/streaming_exec.rs index f5a4e5e..4d9ca41 100644 --- a/crates/hypershell-tokio-components/src/providers/streaming_exec.rs +++ b/crates/hypershell-tokio-components/src/providers/streaming_exec.rs @@ -9,6 +9,8 @@ use tokio::process::Child; use crate::dsl::CoreExec; use crate::types::ChildOutputStream; +/// Spawns a command and returns its standard output as a stream while its input is copied in. See +/// [the abstract syntax page](https://contextgeneric.dev/docs/projects/hypershell/architecture/abstract-syntax). #[cgp_impl(new HandleStreamingExec)] impl Handler, Input> for Context where diff --git a/crates/hypershell-tokio-components/src/providers/update_command.rs b/crates/hypershell-tokio-components/src/providers/update_command.rs index 93a9a71..d660111 100644 --- a/crates/hypershell-tokio-components/src/providers/update_command.rs +++ b/crates/hypershell-tokio-components/src/providers/update_command.rs @@ -8,6 +8,8 @@ use tokio::process::Command; use crate::components::{CommandUpdater, CommandUpdaterComponent}; +/// Appends each argument of a `WithArgs` list to the command, in order. See +/// [the abstract syntax page](https://contextgeneric.dev/docs/projects/hypershell/architecture/abstract-syntax). pub struct ExtractArgs; #[cgp_impl(ExtractArgs)] @@ -39,6 +41,8 @@ impl CommandUpdater> for Context { } } +/// Appends every item of the context field named `Tag` to the command. See +/// [the abstract syntax page](https://contextgeneric.dev/docs/projects/hypershell/architecture/abstract-syntax). #[cgp_impl(new ExtractFieldArgs)] impl CommandUpdater> for Context where diff --git a/crates/hypershell-tungstenite-components/src/providers/websocket.rs b/crates/hypershell-tungstenite-components/src/providers/websocket.rs index 3832915..e669bca 100644 --- a/crates/hypershell-tungstenite-components/src/providers/websocket.rs +++ b/crates/hypershell-tungstenite-components/src/providers/websocket.rs @@ -14,6 +14,8 @@ use tokio_tungstenite::{connect_async, tungstenite}; use tokio_util::bytes::Bytes; use tokio_util::io::ReaderStream; +/// Connects to a WebSocket server, sends its input as binary messages, and returns the replies. See +/// [the WebSocket example](https://contextgeneric.dev/docs/projects/hypershell/examples/bluesky-websocket). #[cgp_impl(new HandleWebsocket)] impl Handler, Input> for Context where From 5cc532faeac5ec00781ca5792484a8ca49c01340 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sun, 8 Nov 2026 10:28:37 +0100 Subject: [PATCH 24/37] Pin the nightly toolchain to a dated release The channel was the floating `nightly`, so a toolchain update could change how the next-generation trait solver behaves without a commit. The pin names the 2026-11-07 nightly, which builds the workspace, builds the docs with warnings denied, and passes the suite. --- rust-toolchain.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 5d56faf..93ac66a 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,5 @@ +# Pinned to a dated nightly because `.cargo/config.toml` turns on the next-generation +# trait solver with `-Z next-solver=globally`, which only a nightly accepts. Bump this +# deliberately, and run the suite afterwards. [toolchain] -channel = "nightly" +channel = "nightly-2026-11-07" From f33ea941af657f8fc2443b6db9a0c492fa189466 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sun, 8 Nov 2026 12:14:23 +0100 Subject: [PATCH 25/37] Run the workspace's build and test in CI The repository had no workflow, so its build and test ran only on a contributor's machine. Two jobs now run the README's new Building commands on the pinned `nightly-2026-11-07`, which `.cargo/config.toml` needs for `-Z next-solver=globally`. The README listed no test command, so the suite was undocumented even though it ran; the Building section now lists both commands. --- .github/workflows/tests.yml | 50 +++++++++++++++++++++++++++++++++++++ README.md | 12 +++++++++ 2 files changed, 62 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..2d72188 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,50 @@ +name: Tests + +on: + push: + pull_request: {} + +env: + CARGO_INCREMENTAL: 0 + CARGO_TERM_COLOR: always + RUST_BACKTRACE: short + CARGO_NET_RETRY: 10 + RUSTUP_MAX_RETRIES: 10 + +# Cancel in-progress runs when a new commit is pushed to the same PR, branch, or tag. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +# To minimize supply-chain exposure this workflow uses only GitHub's own +# first-party actions. Each job runs a command the README's Building section +# lists, on the nightly `rust-toolchain.toml` pins. +# +# The workspace patches `cgp` to the repository's `main` branch by git URL, and +# the lockfile pins the resolved commit, so the jobs fetch that commit and need +# network access. +jobs: + build: + name: Build + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v4 + - name: Install the pinned nightly + run: rustup toolchain install + - name: Build the workspace and its examples + run: cargo build --workspace --all-targets + + test: + name: Test + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v4 + - name: Install the pinned nightly + run: rustup toolchain install + - name: Test the workspace + run: cargo test --workspace diff --git a/README.md b/README.md index c4634a2..2af5ec8 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,18 @@ The workspace builds against the `cgp` repository's `main` branch through its `[ section, because it tracks unreleased CGP code. To build against a local `cgp` checkout, switch those entries to the commented-out paths into `../cgp`. +## Building + +These are the commands CI runs: + +```sh +cargo build --workspace --all-targets +cargo test --workspace +``` + +The workspace pins `nightly-2026-11-07` in `rust-toolchain.toml`, because `.cargo/config.toml` turns +on the next-generation trait solver with `-Z next-solver=globally`, so `cargo` selects that nightly. + ## Examples The [`hypershell-examples`](./crates/hypershell-examples/examples) crate holds runnable programs, one From f55415a23cc703570af593c12eaec271f0a38c5d Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sun, 8 Nov 2026 12:42:50 +0100 Subject: [PATCH 26/37] Add the tests badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2af5ec8..8da3536 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ ![Crates.io](https://img.shields.io/crates/v/hypershell.svg) [![Docs.rs](https://docs.rs/hypershell/badge.svg)](https://docs.rs/hypershell) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/contextgeneric/hypershell/blob/main/LICENSE) +[![Tests](https://github.com/contextgeneric/hypershell/actions/workflows/tests.yml/badge.svg)](https://github.com/contextgeneric/hypershell/actions/workflows/tests.yml) # Hypershell: a type-level DSL for shell scripting in Rust From dcf3c6aeba81e5e71d3213d6dbb89a6a05ba21ff Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sat, 14 Nov 2026 18:21:20 +0100 Subject: [PATCH 27/37] Export the handler traits and keys from the prelude `cgp::prelude` no longer exports `cgp_handler`'s traits and component keys, and Hypershell's programs are pipelines of handlers, so `hypershell::prelude` exports them itself. The internal crates, which import `cgp::prelude` directly, import the names they use from `cgp::extra::handler`. Co-Authored-By: Claude Opus 5.5 --- crates/hypershell-components/src/providers/combined.rs | 4 ++-- crates/hypershell-examples/src/namespaces/checksum.rs | 3 ++- crates/hypershell-examples/src/namespaces/compare.rs | 3 ++- crates/hypershell-examples/src/providers/checksum.rs | 2 +- crates/hypershell-json-components/src/providers/combined.rs | 3 ++- .../hypershell-reqwest-components/src/providers/combined.rs | 2 +- .../hypershell-tokio-components/src/providers/async_read.rs | 3 ++- .../hypershell-tokio-components/src/providers/combined.rs | 2 +- .../src/providers/futures_stream.rs | 2 +- .../src/providers/combined.rs | 2 +- crates/hypershell/src/namespaces/handlers.rs | 1 + crates/hypershell/src/prelude.rs | 6 +++++- 12 files changed, 21 insertions(+), 12 deletions(-) diff --git a/crates/hypershell-components/src/providers/combined.rs b/crates/hypershell-components/src/providers/combined.rs index faaa7b2..7b7cd9b 100644 --- a/crates/hypershell-components/src/providers/combined.rs +++ b/crates/hypershell-components/src/providers/combined.rs @@ -1,7 +1,7 @@ use alloc::boxed::Box; -use cgp::extra::handler::{Promote, PromoteAsync}; -use cgp::prelude::{HandlerComponent, delegate_components}; +use cgp::extra::handler::{HandlerComponent, Promote, PromoteAsync}; +use cgp::prelude::delegate_components; use crate::components::{ CommandArgExtractorComponent, StringArgExtractorComponent, UrlArgExtractorComponent, diff --git a/crates/hypershell-examples/src/namespaces/checksum.rs b/crates/hypershell-examples/src/namespaces/checksum.rs index e70609e..564be58 100644 --- a/crates/hypershell-examples/src/namespaces/checksum.rs +++ b/crates/hypershell-examples/src/namespaces/checksum.rs @@ -1,4 +1,5 @@ -use cgp::prelude::{HandlerComponent, cgp_namespace}; +use cgp::extra::handler::HandlerComponent; +use cgp::prelude::cgp_namespace; use hypershell::namespaces::HypershellNamespace; use hypershell_hash_components::dsl::{BytesToHex, Checksum}; diff --git a/crates/hypershell-examples/src/namespaces/compare.rs b/crates/hypershell-examples/src/namespaces/compare.rs index 7286f12..207129e 100644 --- a/crates/hypershell-examples/src/namespaces/compare.rs +++ b/crates/hypershell-examples/src/namespaces/compare.rs @@ -1,4 +1,5 @@ -use cgp::prelude::{HandlerComponent, cgp_namespace}; +use cgp::extra::handler::HandlerComponent; +use cgp::prelude::cgp_namespace; use hypershell_components::providers::BoxHandler; use crate::dsl::{Compare, If}; diff --git a/crates/hypershell-examples/src/providers/checksum.rs b/crates/hypershell-examples/src/providers/checksum.rs index bb07695..de9bb94 100644 --- a/crates/hypershell-examples/src/providers/checksum.rs +++ b/crates/hypershell-examples/src/providers/checksum.rs @@ -1,4 +1,4 @@ -use cgp::extra::handler::PipeHandlers; +use cgp::extra::handler::{HandlerComponent, PipeHandlers}; use cgp::prelude::*; use hypershell_hash_components::dsl::{BytesToHex, Checksum}; use hypershell_hash_components::providers::{HandleBytesToHex, HandleStreamChecksum}; diff --git a/crates/hypershell-json-components/src/providers/combined.rs b/crates/hypershell-json-components/src/providers/combined.rs index 5eac557..a72e551 100644 --- a/crates/hypershell-json-components/src/providers/combined.rs +++ b/crates/hypershell-json-components/src/providers/combined.rs @@ -1,4 +1,5 @@ -use cgp::prelude::{HandlerComponent, delegate_components}; +use cgp::extra::handler::HandlerComponent; +use cgp::prelude::delegate_components; use hypershell_components::dsl::{DecodeJson, EncodeJson}; use crate::providers::{HandleDecodeJson, HandleEncodeJson}; diff --git a/crates/hypershell-reqwest-components/src/providers/combined.rs b/crates/hypershell-reqwest-components/src/providers/combined.rs index 0dc3742..be7c164 100644 --- a/crates/hypershell-reqwest-components/src/providers/combined.rs +++ b/crates/hypershell-reqwest-components/src/providers/combined.rs @@ -1,4 +1,4 @@ -use cgp::extra::handler::PipeHandlers; +use cgp::extra::handler::{HandlerComponent, PipeHandlers}; use cgp::prelude::*; use hypershell_components::components::{ CommandArgExtractorComponent, HttpMethodTypeProviderComponent, MethodArgExtractorComponent, diff --git a/crates/hypershell-tokio-components/src/providers/async_read.rs b/crates/hypershell-tokio-components/src/providers/async_read.rs index 2892228..18cb284 100644 --- a/crates/hypershell-tokio-components/src/providers/async_read.rs +++ b/crates/hypershell-tokio-components/src/providers/async_read.rs @@ -1,4 +1,5 @@ -use cgp::prelude::{HandlerComponent, delegate_components}; +use cgp::extra::handler::HandlerComponent; +use cgp::prelude::delegate_components; use hypershell_components::providers::ReturnInput; use crate::providers::{FuturesToTokioAsyncRead, HandleBytesToTokioAsyncRead}; diff --git a/crates/hypershell-tokio-components/src/providers/combined.rs b/crates/hypershell-tokio-components/src/providers/combined.rs index 3d557c7..1767bbd 100644 --- a/crates/hypershell-tokio-components/src/providers/combined.rs +++ b/crates/hypershell-tokio-components/src/providers/combined.rs @@ -1,6 +1,6 @@ use std::path::PathBuf; -use cgp::extra::handler::PipeHandlers; +use cgp::extra::handler::{HandlerComponent, PipeHandlers}; use cgp::prelude::*; use hypershell_components::components::{ CommandArgExtractorComponent, CommandArgTypeProviderComponent, StringArgExtractorComponent, diff --git a/crates/hypershell-tokio-components/src/providers/futures_stream.rs b/crates/hypershell-tokio-components/src/providers/futures_stream.rs index e17938a..83ca875 100644 --- a/crates/hypershell-tokio-components/src/providers/futures_stream.rs +++ b/crates/hypershell-tokio-components/src/providers/futures_stream.rs @@ -1,4 +1,4 @@ -use cgp::extra::handler::PipeHandlers; +use cgp::extra::handler::{HandlerComponent, PipeHandlers}; use cgp::prelude::*; use crate::providers::{AsyncReadToStream, FuturesToTokioAsyncRead, HandleBytesToStream}; diff --git a/crates/hypershell-tungstenite-components/src/providers/combined.rs b/crates/hypershell-tungstenite-components/src/providers/combined.rs index 4e06f7c..6bd2664 100644 --- a/crates/hypershell-tungstenite-components/src/providers/combined.rs +++ b/crates/hypershell-tungstenite-components/src/providers/combined.rs @@ -1,4 +1,4 @@ -use cgp::extra::handler::PipeHandlers; +use cgp::extra::handler::{HandlerComponent, PipeHandlers}; use cgp::prelude::*; use hypershell_components::dsl::{BytesToStream, WebSocket}; use hypershell_components::providers::Call; diff --git a/crates/hypershell/src/namespaces/handlers.rs b/crates/hypershell/src/namespaces/handlers.rs index 66eaa59..fcd79c9 100644 --- a/crates/hypershell/src/namespaces/handlers.rs +++ b/crates/hypershell/src/namespaces/handlers.rs @@ -2,6 +2,7 @@ use core::convert::Infallible; use core::str::Utf8Error; use cgp::core::error::{ErrorRaiserComponent, ErrorTypeProviderComponent, ErrorWrapperComponent}; +use cgp::extra::handler::HandlerComponent; use cgp::prelude::*; use cgp_error_anyhow::{DebugAnyhowError, Error, UseAnyhowError}; use hypershell_components::components::{ diff --git a/crates/hypershell/src/prelude.rs b/crates/hypershell/src/prelude.rs index 0635171..af13fdc 100644 --- a/crates/hypershell/src/prelude.rs +++ b/crates/hypershell/src/prelude.rs @@ -1,6 +1,10 @@ pub use core::marker::PhantomData; -pub use cgp::extra::handler::CanHandle; +pub use cgp::extra::handler::{ + AsyncComputer, AsyncComputerComponent, CanHandle, Computer, ComputerComponent, + ComputerRefComponent, Handler, HandlerComponent, Producer, ProducerComponent, TryComputer, + TryComputerComponent, +}; pub use cgp::prelude::*; pub use cgp_error_anyhow::Error; pub use hypershell_components::dsl::*; From e07e42b47435bcfffca0dafbb0e8076c9b4992ea Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sat, 14 Nov 2026 18:56:03 +0100 Subject: [PATCH 28/37] Import the `cgp_field` names the trimmed prelude no longer exports `cgp::prelude` no longer re-exports `Cons`, `Nil`, `Field`, and the other type-level and field-access names, so the modules that write them import them from `cgp::core::field`. Modules left with no use of the glob drop it. Co-Authored-By: Claude Opus 5.5 --- crates/hypershell-components/src/providers/method_arg.rs | 1 + crates/hypershell-components/src/providers/string_arg.rs | 2 ++ crates/hypershell-components/src/providers/url_arg.rs | 1 + crates/hypershell-components/src/traits/wrap_call.rs | 2 +- crates/hypershell-components/src/traits/wrap_static_arg.rs | 2 +- crates/hypershell-examples/examples/nix_manual.rs | 1 + crates/hypershell-reqwest-components/src/providers/headers.rs | 1 + crates/hypershell-tokio-components/src/providers/join_args.rs | 1 + .../hypershell-tokio-components/src/providers/update_command.rs | 2 ++ crates/hypershell/src/namespaces/handlers.rs | 1 + 10 files changed, 12 insertions(+), 2 deletions(-) diff --git a/crates/hypershell-components/src/providers/method_arg.rs b/crates/hypershell-components/src/providers/method_arg.rs index 921724e..4315bd7 100644 --- a/crates/hypershell-components/src/providers/method_arg.rs +++ b/crates/hypershell-components/src/providers/method_arg.rs @@ -1,5 +1,6 @@ use core::marker::PhantomData; +use cgp::core::field::traits::HasField; use cgp::prelude::*; use crate::components::{HasHttpMethodType, MethodArgExtractor, MethodArgExtractorComponent}; diff --git a/crates/hypershell-components/src/providers/string_arg.rs b/crates/hypershell-components/src/providers/string_arg.rs index 9b13c7e..fc5c53c 100644 --- a/crates/hypershell-components/src/providers/string_arg.rs +++ b/crates/hypershell-components/src/providers/string_arg.rs @@ -4,6 +4,8 @@ use alloc::string::{String, ToString}; use core::fmt::Display; use core::marker::PhantomData; +use cgp::core::field::traits::HasField; +use cgp::core::field::types::{Cons, Nil}; use cgp::prelude::*; use crate::components::{ diff --git a/crates/hypershell-components/src/providers/url_arg.rs b/crates/hypershell-components/src/providers/url_arg.rs index 56a01cf..34d9c69 100644 --- a/crates/hypershell-components/src/providers/url_arg.rs +++ b/crates/hypershell-components/src/providers/url_arg.rs @@ -1,6 +1,7 @@ use core::marker::PhantomData; use core::str::FromStr; +use cgp::core::field::traits::HasField; use cgp::prelude::*; use crate::components::{ diff --git a/crates/hypershell-components/src/traits/wrap_call.rs b/crates/hypershell-components/src/traits/wrap_call.rs index 1e8a756..dd13bcd 100644 --- a/crates/hypershell-components/src/traits/wrap_call.rs +++ b/crates/hypershell-components/src/traits/wrap_call.rs @@ -1,4 +1,4 @@ -use cgp::prelude::*; +use cgp::core::field::types::{Cons, Nil}; use crate::providers::Call; diff --git a/crates/hypershell-components/src/traits/wrap_static_arg.rs b/crates/hypershell-components/src/traits/wrap_static_arg.rs index 8746e86..f4871ec 100644 --- a/crates/hypershell-components/src/traits/wrap_static_arg.rs +++ b/crates/hypershell-components/src/traits/wrap_static_arg.rs @@ -1,4 +1,4 @@ -use cgp::prelude::*; +use cgp::core::field::types::{Cons, Nil}; use crate::dsl::StaticArg; diff --git a/crates/hypershell-examples/examples/nix_manual.rs b/crates/hypershell-examples/examples/nix_manual.rs index 4d93d94..f2fa0c3 100644 --- a/crates/hypershell-examples/examples/nix_manual.rs +++ b/crates/hypershell-examples/examples/nix_manual.rs @@ -24,6 +24,7 @@ // // The `main` function initializes the `MyApp` context and runs the program. +use cgp::core::field::types::Nil; use hypershell::namespaces::HypershellNamespace; use hypershell::prelude::*; use reqwest::Client; diff --git a/crates/hypershell-reqwest-components/src/providers/headers.rs b/crates/hypershell-reqwest-components/src/providers/headers.rs index ceac77e..27fbe8b 100644 --- a/crates/hypershell-reqwest-components/src/providers/headers.rs +++ b/crates/hypershell-reqwest-components/src/providers/headers.rs @@ -1,5 +1,6 @@ use core::marker::PhantomData; +use cgp::core::field::types::{Cons, Nil}; use cgp::prelude::*; use hypershell_components::components::CanExtractStringArg; use hypershell_components::dsl::{Header, WithHeaders}; diff --git a/crates/hypershell-tokio-components/src/providers/join_args.rs b/crates/hypershell-tokio-components/src/providers/join_args.rs index d36b684..0dd93fc 100644 --- a/crates/hypershell-tokio-components/src/providers/join_args.rs +++ b/crates/hypershell-tokio-components/src/providers/join_args.rs @@ -1,6 +1,7 @@ use core::marker::PhantomData; use std::path::PathBuf; +use cgp::core::field::types::{Cons, Nil}; use cgp::prelude::*; use hypershell_components::components::{ CanExtractCommandArg, CommandArgExtractor, CommandArgExtractorComponent, HasCommandArgType, diff --git a/crates/hypershell-tokio-components/src/providers/update_command.rs b/crates/hypershell-tokio-components/src/providers/update_command.rs index d660111..fde924d 100644 --- a/crates/hypershell-tokio-components/src/providers/update_command.rs +++ b/crates/hypershell-tokio-components/src/providers/update_command.rs @@ -1,6 +1,8 @@ use core::marker::PhantomData; use std::ffi::OsStr; +use cgp::core::field::traits::HasField; +use cgp::core::field::types::{Cons, Nil}; use cgp::prelude::*; use hypershell_components::components::CanExtractCommandArg; use hypershell_components::dsl::{FieldArgs, WithArgs}; diff --git a/crates/hypershell/src/namespaces/handlers.rs b/crates/hypershell/src/namespaces/handlers.rs index fcd79c9..ebb915b 100644 --- a/crates/hypershell/src/namespaces/handlers.rs +++ b/crates/hypershell/src/namespaces/handlers.rs @@ -2,6 +2,7 @@ use core::convert::Infallible; use core::str::Utf8Error; use cgp::core::error::{ErrorRaiserComponent, ErrorTypeProviderComponent, ErrorWrapperComponent}; +use cgp::core::field::impls::UseField; use cgp::extra::handler::HandlerComponent; use cgp::prelude::*; use cgp_error_anyhow::{DebugAnyhowError, Error, UseAnyhowError}; From b913a6e5cb7ca4a2eb67d40b3628983760c16d5a Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sat, 14 Nov 2026 20:43:46 +0100 Subject: [PATCH 29/37] Add AGENTS.md with the shared rules for agents The file gives agents the rules every CGP repository shares, sends them to the `/cgp` skill and the knowledge base to learn CGP, points to the knowledge base's section on this project before a change to what it describes, and names the build and test commands CI runs. Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..78459e8 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,39 @@ +# AGENTS.md: Hypershell + +Follow these rules for every change to this repository. Read [README.md](README.md) for what the +project is and how to build it, and the knowledge base's +[sibling-projects.md](https://github.com/contextgeneric/cgp-knowledge-base/blob/main/sibling-projects.md) +for the related repositories. + +## Universal rules + +These rules hold in every CGP repository. The +[knowledge base's AGENTS.md](https://github.com/contextgeneric/cgp-knowledge-base/blob/main/AGENTS.md) +holds their canonical wording: read it first, and change a rule there before updating this block: + +- Learn CGP and its tools from the `/cgp` skill and the knowledge base; never restate them in this + file. +- Prefer the local sibling checkout when reading another project. +- Write a cross-project link as a GitHub URL on `main`. +- Name official release versions only, never a pre-release. +- Commit only when the user explicitly asks, on the current branch. +- Verify a claim against the source before writing it. +- Keep every view of the same truth in sync in the same change. +- Ask the user when a decision is ambiguous. +- Apply point-first writing to internal prose. + +## Task guides + +The knowledge base documents this project, so a change to what it describes starts from its section. +Read it before the task: + +- **Changing code the knowledge base describes:** the project's section, + [projects/hypershell/](https://github.com/contextgeneric/cgp-knowledge-base/blob/main/projects/hypershell/README.md), + and the section's [writing guide](https://github.com/contextgeneric/cgp-knowledge-base/blob/main/projects/writing-guide.md). + +## Checks before committing + +Every commit passes the checks CI runs: + +- Run the build and test commands in [README.md](README.md#building) before committing; + [`.github/workflows/tests.yml`](.github/workflows/tests.yml) runs the same commands. From edbba7c8757c82f14f716242f60cac35681969ea Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sat, 14 Nov 2026 20:47:52 +0100 Subject: [PATCH 30/37] Point to AGENTS.md from the README and to the site's record The README's Building section now sends contributors and agents to AGENTS.md, as the other CGP repositories' READMEs do, and AGENTS.md names the knowledge base's record of the website section that explains this project, which a change to the code it shows must update. Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 6 ++++-- README.md | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 78459e8..a1741e6 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -24,12 +24,14 @@ holds their canonical wording: read it first, and change a rule there before upd ## Task guides -The knowledge base documents this project, so a change to what it describes starts from its section. -Read it before the task: +The knowledge base documents this project and the website explains it, so a change to what either +describes starts from the document that holds it. Read it before the task: - **Changing code the knowledge base describes:** the project's section, [projects/hypershell/](https://github.com/contextgeneric/cgp-knowledge-base/blob/main/projects/hypershell/README.md), and the section's [writing guide](https://github.com/contextgeneric/cgp-knowledge-base/blob/main/projects/writing-guide.md). +- **Changing code a website page explains:** the record of the site's section on it, + [website/projects/hypershell.md](https://github.com/contextgeneric/cgp-knowledge-base/blob/main/website/projects/hypershell.md). ## Checks before committing diff --git a/README.md b/README.md index 8da3536..fb6cbf1 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,8 @@ cargo test --workspace The workspace pins `nightly-2026-11-07` in `rust-toolchain.toml`, because `.cargo/config.toml` turns on the next-generation trait solver with `-Z next-solver=globally`, so `cargo` selects that nightly. +Contributors and agents start from [AGENTS.md](AGENTS.md), which names these checks. + ## Examples The [`hypershell-examples`](./crates/hypershell-examples/examples) crate holds runnable programs, one From e39562574935bc25f3cbf594e0f3a20aa62004e6 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sun, 15 Nov 2026 14:49:58 +0100 Subject: [PATCH 31/37] Write public-facing documents such as READMEs in natural style The universal writing rule now asks for natural writing in documents people outside the project read, such as a repository or crate README, beside point-first writing for internal prose. Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index a1741e6..fe632f2 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -20,7 +20,8 @@ holds their canonical wording: read it first, and change a rule there before upd - Verify a claim against the source before writing it. - Keep every view of the same truth in sync in the same change. - Ask the user when a decision is ambiguous. -- Apply point-first writing to internal prose. +- Apply point-first writing to internal prose, and natural writing to public-facing documents + such as READMEs. ## Task guides From 2afb876f6a52708e7610be8364f5df8a362d9447 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sun, 15 Nov 2026 17:23:33 +0100 Subject: [PATCH 32/37] Make the point-first-writing skill optional in the agent rules The writing rules name the `/point-first-writing` skill, which no CGP repository publishes, so an outside contributor's agent cannot load it. The rules keep the two styles and ask for the skill only when it is available. Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index fe632f2..cb1c1b1 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -21,7 +21,7 @@ holds their canonical wording: read it first, and change a rule there before upd - Keep every view of the same truth in sync in the same change. - Ask the user when a decision is ambiguous. - Apply point-first writing to internal prose, and natural writing to public-facing documents - such as READMEs. + such as READMEs, using the optional `/point-first-writing` skill when it is available. ## Task guides From d479c816317d775fc77099618809a8f102e1da8b Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Mon, 16 Nov 2026 21:03:24 +0100 Subject: [PATCH 33/37] Pin nightly-2026-11-16 for the next-generation solver The workspace moves to the nightly that cargo-cgp pins. The build and the test suite pass on it unchanged. Co-Authored-By: Claude Opus 5.5 --- README.md | 2 +- rust-toolchain.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fb6cbf1..1daf2a8 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ cargo build --workspace --all-targets cargo test --workspace ``` -The workspace pins `nightly-2026-11-07` in `rust-toolchain.toml`, because `.cargo/config.toml` turns +The workspace pins `nightly-2026-11-16` in `rust-toolchain.toml`, because `.cargo/config.toml` turns on the next-generation trait solver with `-Z next-solver=globally`, so `cargo` selects that nightly. Contributors and agents start from [AGENTS.md](AGENTS.md), which names these checks. diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 93ac66a..d5f8e82 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -2,4 +2,4 @@ # trait solver with `-Z next-solver=globally`, which only a nightly accepts. Bump this # deliberately, and run the suite afterwards. [toolchain] -channel = "nightly-2026-11-07" +channel = "nightly-2026-11-16" From 7001cb7b5259d12171d5059e8e701e98b9c4e4d5 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Tue, 17 Nov 2026 15:53:41 +0100 Subject: [PATCH 34/37] Prepare the crates for publishing at 0.2.0-prerelease The workspace takes `cgp` and `cgp-error-anyhow` 0.8.0-prerelease from crates.io instead of patching them to the `cgp` repository's `main` branch, so the tests build against what a published package resolves. `hypershell-examples` sets `publish = false`, so publishing the workspace releases only the eight library crates. Each of them links the workspace `LICENSE`, since cargo does not copy a root file into a member's package, and the keywords name the project's subject. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/tests.yml | 4 - Cargo.lock | 185 +++++++++++------- Cargo.toml | 28 ++- README.md | 4 - crates/hypershell-components/Cargo.toml | 2 +- crates/hypershell-components/LICENSE | 1 + crates/hypershell-examples/Cargo.toml | 3 +- crates/hypershell-hash-components/Cargo.toml | 2 +- crates/hypershell-hash-components/LICENSE | 1 + crates/hypershell-json-components/Cargo.toml | 2 +- crates/hypershell-json-components/LICENSE | 1 + crates/hypershell-macro/Cargo.toml | 2 +- crates/hypershell-macro/LICENSE | 1 + .../hypershell-reqwest-components/Cargo.toml | 2 +- crates/hypershell-reqwest-components/LICENSE | 1 + crates/hypershell-tokio-components/Cargo.toml | 2 +- crates/hypershell-tokio-components/LICENSE | 1 + .../Cargo.toml | 2 +- .../hypershell-tungstenite-components/LICENSE | 1 + crates/hypershell/Cargo.toml | 2 +- crates/hypershell/LICENSE | 1 + 21 files changed, 140 insertions(+), 108 deletions(-) create mode 120000 crates/hypershell-components/LICENSE create mode 120000 crates/hypershell-hash-components/LICENSE create mode 120000 crates/hypershell-json-components/LICENSE create mode 120000 crates/hypershell-macro/LICENSE create mode 120000 crates/hypershell-reqwest-components/LICENSE create mode 120000 crates/hypershell-tokio-components/LICENSE create mode 120000 crates/hypershell-tungstenite-components/LICENSE create mode 120000 crates/hypershell/LICENSE diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2d72188..7e261b8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,10 +22,6 @@ permissions: # To minimize supply-chain exposure this workflow uses only GitHub's own # first-party actions. Each job runs a command the README's Building section # lists, on the nightly `rust-toolchain.toml` pins. -# -# The workspace patches `cgp` to the repository's `main` branch by git URL, and -# the lockfile pins the resolved commit, so the jobs fetch that commit and need -# network access. jobs: build: name: Build diff --git a/Cargo.lock b/Cargo.lock index 7b1dcd0..e95979f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -65,8 +65,9 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "cgp" -version = "0.8.0-alpha" -source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" +version = "0.8.0-prerelease" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11a1e522d5703f91b93bed28ea7f32e8fc9cd368009ec79d479d8831057bf486" dependencies = [ "cgp-core", "cgp-extra", @@ -74,8 +75,9 @@ dependencies = [ [[package]] name = "cgp-async-macro" -version = "0.8.0-alpha" -source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" +version = "0.8.0-prerelease" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0a558018254879bd258fc792230e02467ce6334bb9bab4da864c607ed8f9b10" dependencies = [ "proc-macro2", "quote", @@ -84,8 +86,9 @@ dependencies = [ [[package]] name = "cgp-base" -version = "0.8.0-alpha" -source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" +version = "0.8.0-prerelease" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5cf7328bee1840746c07f9c030bd68275d4f6ec40b814a4d261ccfa34ac339" dependencies = [ "cgp-base-types", "cgp-component", @@ -94,8 +97,9 @@ dependencies = [ [[package]] name = "cgp-base-extra" -version = "0.8.0-alpha" -source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" +version = "0.8.0-prerelease" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8d106c6b531a668525417b4872a8857bde536fd995dec3a8528cefd42112a0" dependencies = [ "cgp-base", "cgp-type", @@ -103,18 +107,21 @@ dependencies = [ [[package]] name = "cgp-base-types" -version = "0.8.0-alpha" -source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" +version = "0.8.0-prerelease" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e78e57e7979b594b60060b3c782523bc7a79375530e7208d4a86e071d2a52a" [[package]] name = "cgp-component" -version = "0.8.0-alpha" -source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" +version = "0.8.0-prerelease" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c072c19f4b33b5a022182d01453560c7d85ec022584cae79216d3d71d466f222" [[package]] name = "cgp-core" -version = "0.8.0-alpha" -source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" +version = "0.8.0-prerelease" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbc72c412587258a9ff4bef94a56e948b4797e6b5727034974eb42e0a037b758" dependencies = [ "cgp-async-macro", "cgp-base", @@ -127,8 +134,9 @@ dependencies = [ [[package]] name = "cgp-dispatch" -version = "0.8.0-alpha" -source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" +version = "0.8.0-prerelease" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e0de36fc324e6d92f3faf58c82c904406287dff24bd91f8e437fcdef7a73a99" dependencies = [ "cgp-core", "cgp-handler", @@ -137,8 +145,9 @@ dependencies = [ [[package]] name = "cgp-error" -version = "0.8.0-alpha" -source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" +version = "0.8.0-prerelease" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "111151912d78e0a4b3ec0ec490649f594fa30460ca5d49f0e1a92b295c4f744f" dependencies = [ "cgp-base-extra", "cgp-field", @@ -148,8 +157,9 @@ dependencies = [ [[package]] name = "cgp-error-anyhow" -version = "0.8.0-alpha" -source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" +version = "0.8.0-prerelease" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "096dc38a3794991b94a8c43803b002d54d92533bf3ffd2cc727799521e11bb94" dependencies = [ "anyhow", "cgp-core", @@ -157,52 +167,35 @@ dependencies = [ [[package]] name = "cgp-error-extra" -version = "0.8.0-alpha" -source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" +version = "0.8.0-prerelease" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23787fb8544c5703a200ee1dfba9028ed31c9b4401c466301baa4023e643545c" dependencies = [ "cgp-core", ] [[package]] name = "cgp-extra" -version = "0.8.0-alpha" -source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" +version = "0.8.0-prerelease" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ec0b63451a9cda55f20d6609d0bb11f27c404eb0fa1490bca61edda2fffd9e3" dependencies = [ "cgp-core", "cgp-dispatch", "cgp-error-extra", - "cgp-extra-macro", "cgp-field-extra", "cgp-handler", + "cgp-macro-extra", "cgp-monad", "cgp-run", "cgp-runtime", ] -[[package]] -name = "cgp-extra-macro" -version = "0.8.0-alpha" -source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" -dependencies = [ - "cgp-extra-macro-lib", - "syn 2.0.119", -] - -[[package]] -name = "cgp-extra-macro-lib" -version = "0.8.0-alpha" -source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" -dependencies = [ - "cgp-macro-core", - "proc-macro2", - "quote", - "syn 2.0.119", -] - [[package]] name = "cgp-field" -version = "0.8.0-alpha" -source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" +version = "0.8.0-prerelease" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b00c9c59793b41ffd708e47bc3502b2acf937e7726479ee4c31f100f344141a" dependencies = [ "cgp-base-types", "cgp-component", @@ -211,24 +204,27 @@ dependencies = [ [[package]] name = "cgp-field-extra" -version = "0.8.0-alpha" -source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" +version = "0.8.0-prerelease" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dba7b001068522891e57fd888a4445f7a87f21ff59035a6d3ce186afc53bc22" dependencies = [ "cgp-field", ] [[package]] name = "cgp-handler" -version = "0.8.0-alpha" -source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" +version = "0.8.0-prerelease" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75ba79f0a6d452c8d82701f0610929968b24106f93af0fa7220185d8e5205f94" dependencies = [ "cgp-core", ] [[package]] name = "cgp-macro" -version = "0.8.0-alpha" -source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" +version = "0.8.0-prerelease" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bf9e6e5b7ea90314383d4597b52e01c46608a06d6198c4acb86348965365508" dependencies = [ "cgp-macro-lib", "syn 2.0.119", @@ -236,8 +232,9 @@ dependencies = [ [[package]] name = "cgp-macro-core" -version = "0.8.0-alpha" -source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" +version = "0.8.0-prerelease" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06f915f1e8ef6ca96d9bec879438fb52591f994c73fdcf312a7414d378a521c0" dependencies = [ "itertools", "proc-macro2", @@ -245,10 +242,46 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "cgp-macro-extra" +version = "0.8.0-prerelease" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4bd0a65d14ce570db728b5f22e9572d85f677b4294585ccbb4753789a584a6c" +dependencies = [ + "cgp-macro-extra-lib", + "syn 2.0.119", +] + +[[package]] +name = "cgp-macro-extra-core" +version = "0.8.0-prerelease" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4f3fe84088755d42efa9b70d193329360f0f394c2634a608a733c2ffd0d6d2b" +dependencies = [ + "cgp-macro-core", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "cgp-macro-extra-lib" +version = "0.8.0-prerelease" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8a1129e1ae8ddc4e7d8d3f3e9ec0b05824387906411f257df091f40172e81cb" +dependencies = [ + "cgp-macro-core", + "cgp-macro-extra-core", + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "cgp-macro-lib" -version = "0.8.0-alpha" -source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" +version = "0.8.0-prerelease" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "373faea91284372b79f2c6a6c514877b66f81479ca3875a4986fb35c38ab59b0" dependencies = [ "cgp-macro-core", "itertools", @@ -259,8 +292,9 @@ dependencies = [ [[package]] name = "cgp-monad" -version = "0.8.0-alpha" -source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" +version = "0.8.0-prerelease" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d5491883b184409e9e29b3605ef4729d151abbf6f369abe95621585e8f6dc39" dependencies = [ "cgp-core", "cgp-handler", @@ -268,24 +302,27 @@ dependencies = [ [[package]] name = "cgp-run" -version = "0.8.0-alpha" -source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" +version = "0.8.0-prerelease" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "270c86da8a3306720eb0492a77d3ad42e9b924a71927d5baa74b28b430f792e0" dependencies = [ "cgp-core", ] [[package]] name = "cgp-runtime" -version = "0.8.0-alpha" -source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" +version = "0.8.0-prerelease" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c31d1735b4cd82a7c4f1f7bda95ea5f2ba992c0693857e837232c8b362d476d" dependencies = [ "cgp-core", ] [[package]] name = "cgp-type" -version = "0.8.0-alpha" -source = "git+https://github.com/contextgeneric/cgp.git?branch=main#adc616cebb1cde0197b3be7e127c8a886d289c48" +version = "0.8.0-prerelease" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c77b0f7c18d5de701c558793d2ca6d1dea8f6289618e795df073d3237aef70ed" dependencies = [ "cgp-base", "cgp-component", @@ -730,7 +767,7 @@ dependencies = [ [[package]] name = "hypershell" -version = "0.1.0" +version = "0.2.0-prerelease" dependencies = [ "cgp", "cgp-error-anyhow", @@ -746,14 +783,14 @@ dependencies = [ [[package]] name = "hypershell-components" -version = "0.1.0" +version = "0.2.0-prerelease" dependencies = [ "cgp", ] [[package]] name = "hypershell-examples" -version = "0.1.0" +version = "0.2.0-prerelease" dependencies = [ "cgp", "cgp-error-anyhow", @@ -774,7 +811,7 @@ dependencies = [ [[package]] name = "hypershell-hash-components" -version = "0.1.0" +version = "0.2.0-prerelease" dependencies = [ "cgp", "futures", @@ -784,7 +821,7 @@ dependencies = [ [[package]] name = "hypershell-json-components" -version = "0.1.0" +version = "0.2.0-prerelease" dependencies = [ "cgp", "hypershell-components", @@ -794,7 +831,7 @@ dependencies = [ [[package]] name = "hypershell-macro" -version = "0.1.0" +version = "0.2.0-prerelease" dependencies = [ "proc-macro2", "quote", @@ -802,7 +839,7 @@ dependencies = [ [[package]] name = "hypershell-reqwest-components" -version = "0.1.0" +version = "0.2.0-prerelease" dependencies = [ "cgp", "futures", @@ -816,7 +853,7 @@ dependencies = [ [[package]] name = "hypershell-tokio-components" -version = "0.1.0" +version = "0.2.0-prerelease" dependencies = [ "cgp", "futures", @@ -828,7 +865,7 @@ dependencies = [ [[package]] name = "hypershell-tungstenite-components" -version = "0.1.0" +version = "0.2.0-prerelease" dependencies = [ "cgp", "futures", diff --git a/Cargo.toml b/Cargo.toml index fce7315..8a1e19f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,11 +22,11 @@ repository = "https://github.com/contextgeneric/hypershell" homepage = "https://contextgeneric.dev/docs/projects/hypershell/" categories = ["command-line-interface", "rust-patterns"] authors = ["Soares Chen "] -keywords = ["cgp"] +keywords = ["cgp", "dsl", "shell", "type-level"] [workspace.dependencies] -cgp = { version = "0.8.0-alpha" } -cgp-error-anyhow = { version = "0.8.0-alpha" } +cgp = { version = "0.8.0-prerelease" } +cgp-error-anyhow = { version = "0.8.0-prerelease" } futures = { version = "0.3.31" } hex = { version = "0.4.3" } itertools = { version = "0.14.0" } @@ -41,17 +41,11 @@ tokio-tungstenite = { version = "0.26.2" } tokio-util = { version = "0.7.15" } url = { version = "2.5.4" } -hypershell = { version = "0.1.0", path = "./crates/hypershell" } -hypershell-components = { version = "0.1.0", path = "./crates/hypershell-components" } -hypershell-json-components = { version = "0.1.0", path = "./crates/hypershell-json-components" } -hypershell-reqwest-components = { version = "0.1.0", path = "./crates/hypershell-reqwest-components" } -hypershell-tokio-components = { version = "0.1.0", path = "./crates/hypershell-tokio-components" } -hypershell-tungstenite-components = { version = "0.1.0", path = "./crates/hypershell-tungstenite-components" } -hypershell-hash-components = { version = "0.1.0", path = "./crates/hypershell-hash-components" } -hypershell-macro = { version = "0.1.0", path = "./crates/hypershell-macro" } - -[patch.crates-io] -# cgp = { path = "../cgp/crates/main/cgp" } -# cgp-error-anyhow = { path = "../cgp/crates/standalone/error/cgp-error-anyhow" } -cgp = { git = "https://github.com/contextgeneric/cgp.git", branch = "main" } -cgp-error-anyhow = { git = "https://github.com/contextgeneric/cgp.git", branch = "main" } +hypershell = { version = "0.2.0-prerelease", path = "./crates/hypershell" } +hypershell-components = { version = "0.2.0-prerelease", path = "./crates/hypershell-components" } +hypershell-json-components = { version = "0.2.0-prerelease", path = "./crates/hypershell-json-components" } +hypershell-reqwest-components = { version = "0.2.0-prerelease", path = "./crates/hypershell-reqwest-components" } +hypershell-tokio-components = { version = "0.2.0-prerelease", path = "./crates/hypershell-tokio-components" } +hypershell-tungstenite-components = { version = "0.2.0-prerelease", path = "./crates/hypershell-tungstenite-components" } +hypershell-hash-components = { version = "0.2.0-prerelease", path = "./crates/hypershell-hash-components" } +hypershell-macro = { version = "0.2.0-prerelease", path = "./crates/hypershell-macro" } diff --git a/README.md b/README.md index 1daf2a8..97fffac 100644 --- a/README.md +++ b/README.md @@ -64,10 +64,6 @@ reqwest = "0.12" anyhow = "1.0" ``` -The workspace builds against the `cgp` repository's `main` branch through its `[patch.crates-io]` -section, because it tracks unreleased CGP code. To build against a local `cgp` checkout, switch those -entries to the commented-out paths into `../cgp`. - ## Building These are the commands CI runs: diff --git a/crates/hypershell-components/Cargo.toml b/crates/hypershell-components/Cargo.toml index 7149c4b..1281447 100644 --- a/crates/hypershell-components/Cargo.toml +++ b/crates/hypershell-components/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hypershell-components" -version = "0.1.0" +version = "0.2.0-prerelease" edition = { workspace = true } license = { workspace = true } repository = { workspace = true } diff --git a/crates/hypershell-components/LICENSE b/crates/hypershell-components/LICENSE new file mode 120000 index 0000000..30cff74 --- /dev/null +++ b/crates/hypershell-components/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/crates/hypershell-examples/Cargo.toml b/crates/hypershell-examples/Cargo.toml index 949649a..09bc1dc 100644 --- a/crates/hypershell-examples/Cargo.toml +++ b/crates/hypershell-examples/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hypershell-examples" -version = "0.1.0" +version = "0.2.0-prerelease" edition = { workspace = true } license = { workspace = true } repository = { workspace = true } @@ -10,6 +10,7 @@ authors = { workspace = true } rust-version = { workspace = true } keywords = { workspace = true } description = "Runnable examples of the Hypershell DSL." +publish = false [dependencies] hypershell = { workspace = true } diff --git a/crates/hypershell-hash-components/Cargo.toml b/crates/hypershell-hash-components/Cargo.toml index 634350d..91b11dc 100644 --- a/crates/hypershell-hash-components/Cargo.toml +++ b/crates/hypershell-hash-components/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hypershell-hash-components" -version = "0.1.0" +version = "0.2.0-prerelease" edition = { workspace = true } license = { workspace = true } repository = { workspace = true } diff --git a/crates/hypershell-hash-components/LICENSE b/crates/hypershell-hash-components/LICENSE new file mode 120000 index 0000000..30cff74 --- /dev/null +++ b/crates/hypershell-hash-components/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/crates/hypershell-json-components/Cargo.toml b/crates/hypershell-json-components/Cargo.toml index 4944000..b1ba4a0 100644 --- a/crates/hypershell-json-components/Cargo.toml +++ b/crates/hypershell-json-components/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hypershell-json-components" -version = "0.1.0" +version = "0.2.0-prerelease" edition = { workspace = true } license = { workspace = true } repository = { workspace = true } diff --git a/crates/hypershell-json-components/LICENSE b/crates/hypershell-json-components/LICENSE new file mode 120000 index 0000000..30cff74 --- /dev/null +++ b/crates/hypershell-json-components/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/crates/hypershell-macro/Cargo.toml b/crates/hypershell-macro/Cargo.toml index 5e539e3..1fe0a6c 100644 --- a/crates/hypershell-macro/Cargo.toml +++ b/crates/hypershell-macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hypershell-macro" -version = "0.1.0" +version = "0.2.0-prerelease" edition = { workspace = true } license = { workspace = true } repository = { workspace = true } diff --git a/crates/hypershell-macro/LICENSE b/crates/hypershell-macro/LICENSE new file mode 120000 index 0000000..30cff74 --- /dev/null +++ b/crates/hypershell-macro/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/crates/hypershell-reqwest-components/Cargo.toml b/crates/hypershell-reqwest-components/Cargo.toml index 24109a6..23cecda 100644 --- a/crates/hypershell-reqwest-components/Cargo.toml +++ b/crates/hypershell-reqwest-components/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hypershell-reqwest-components" -version = "0.1.0" +version = "0.2.0-prerelease" edition = { workspace = true } license = { workspace = true } repository = { workspace = true } diff --git a/crates/hypershell-reqwest-components/LICENSE b/crates/hypershell-reqwest-components/LICENSE new file mode 120000 index 0000000..30cff74 --- /dev/null +++ b/crates/hypershell-reqwest-components/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/crates/hypershell-tokio-components/Cargo.toml b/crates/hypershell-tokio-components/Cargo.toml index 271004b..010b0fc 100644 --- a/crates/hypershell-tokio-components/Cargo.toml +++ b/crates/hypershell-tokio-components/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hypershell-tokio-components" -version = "0.1.0" +version = "0.2.0-prerelease" edition = { workspace = true } license = { workspace = true } repository = { workspace = true } diff --git a/crates/hypershell-tokio-components/LICENSE b/crates/hypershell-tokio-components/LICENSE new file mode 120000 index 0000000..30cff74 --- /dev/null +++ b/crates/hypershell-tokio-components/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/crates/hypershell-tungstenite-components/Cargo.toml b/crates/hypershell-tungstenite-components/Cargo.toml index 644f808..007b786 100644 --- a/crates/hypershell-tungstenite-components/Cargo.toml +++ b/crates/hypershell-tungstenite-components/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hypershell-tungstenite-components" -version = "0.1.0" +version = "0.2.0-prerelease" edition = { workspace = true } license = { workspace = true } repository = { workspace = true } diff --git a/crates/hypershell-tungstenite-components/LICENSE b/crates/hypershell-tungstenite-components/LICENSE new file mode 120000 index 0000000..30cff74 --- /dev/null +++ b/crates/hypershell-tungstenite-components/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/crates/hypershell/Cargo.toml b/crates/hypershell/Cargo.toml index fac93d1..d94c7e5 100644 --- a/crates/hypershell/Cargo.toml +++ b/crates/hypershell/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hypershell" -version = "0.1.0" +version = "0.2.0-prerelease" edition = { workspace = true } license = { workspace = true } repository = { workspace = true } diff --git a/crates/hypershell/LICENSE b/crates/hypershell/LICENSE new file mode 120000 index 0000000..30cff74 --- /dev/null +++ b/crates/hypershell/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file From e11125373e098bd60ee20c0510a25ab72150a4ac Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Tue, 17 Nov 2026 16:05:00 +0100 Subject: [PATCH 35/37] Rewrite the README for a first-time reader The README names Context-Generic Programming beside what Hypershell is, keeps the experimental disclaimer up front, and shows the `hello` program and the one-line context that runs it before the details. It installs the crates from crates.io with `cgp` beside them, since the macro's expansion names it, and says which toolchain a program needs: the library and small programs build on stable Rust, while programs that nest others deeply can need nightly with the new trait solver. The crates.io badge now links its page, the example list gains `save_webpage`, the costs follow the website's project page, and the License section is gone, since the badge and `LICENSE` carry it. Co-Authored-By: Claude Opus 5.5 --- README.md | 235 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 149 insertions(+), 86 deletions(-) diff --git a/README.md b/README.md index 97fffac..d22d286 100644 --- a/README.md +++ b/README.md @@ -1,129 +1,192 @@ -![Crates.io](https://img.shields.io/crates/v/hypershell.svg) +[![Crates.io](https://img.shields.io/crates/v/hypershell.svg)](https://crates.io/crates/hypershell) [![Docs.rs](https://docs.rs/hypershell/badge.svg)](https://docs.rs/hypershell) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/contextgeneric/hypershell/blob/main/LICENSE) [![Tests](https://github.com/contextgeneric/hypershell/actions/workflows/tests.yml/badge.svg)](https://github.com/contextgeneric/hypershell/actions/workflows/tests.yml) -# Hypershell: a type-level DSL for shell scripting in Rust +# Hypershell -**A modular, type-level domain-specific language for writing shell-script-like programs in Rust, -powered by [Context-Generic Programming (CGP)](https://contextgeneric.dev/).** +Hypershell is a small language for writing shell-script-like programs in Rust, built with +[Context-Generic Programming (CGP)](https://contextgeneric.dev/), a language extension for Rust +with pluggable trait implementations at compile-time. A Hypershell program is a Rust *type*, and the +context that runs it is its interpreter: a type whose wiring chooses how each piece of the program +behaves. So both the language's syntax and its meaning can be extended without editing the crates +that define them. -CGP makes it possible to extend or modify both the language's syntax and its semantics, so a program -can mix external commands with native Rust handlers and still be checked by the compiler. +Hypershell is an **experimental** proof of concept. It shows how CGP builds a modular language in +Rust, and it is not meant to replace a shell. -**[Website](https://contextgeneric.dev/) · [Project page](https://contextgeneric.dev/docs/projects/hypershell/) · [CGP quickstart](https://contextgeneric.dev/docs/quickstart) · [Introduction post](https://contextgeneric.dev/blog/hypershell-release/)** +**[Project page](https://contextgeneric.dev/docs/projects/hypershell/) · [Examples](https://contextgeneric.dev/docs/projects/hypershell/examples/) · [CGP quickstart](https://contextgeneric.dev/docs/quickstart) · [Introduction post](https://contextgeneric.dev/blog/hypershell-release/)** -## What it does +## A program that is a type -Hypershell lets you define command pipelines, similar to shell scripts, directly in Rust's type -system. That arrangement brings four properties: +This is the smallest Hypershell program. It runs `echo hello world!` and prints the output: -- **Type safety.** The compiler checks your shell-like programs. -- **Performance.** A DSL program is interpreted at compile time into native Rust code, with no runtime - interpretation. -- **Extensibility.** Native Rust functions, such as HTTP requests or JSON parsing, compose with - external CLI commands in the same pipeline. -- **Modularity.** The language itself is designed to be extended: you can add syntax and handlers - without modifying the core library. +```rust +use hypershell::prelude::*; -## Crate organization +pub type Program = hypershell! { + SimpleExec< + StaticArg<"echo">, + WithStaticArgs["hello", "world!"], + > + | StreamToStdout +}; -Hypershell is organized into several crates, each with one purpose, so the language is easy to -extend. +#[tokio::main] +async fn main() -> Result<(), Error> { + HypershellCli + .handle(PhantomData::, Vec::new()) + .await?; -- [`hypershell`](./crates/hypershell): the main crate, which re-exports the components a program - needs and defines the default namespace and contexts for running Hypershell programs. -- [`hypershell-macro`](./crates/hypershell-macro): the `hypershell!` procedural macro, which provides - the shell-like syntax. -- [`hypershell-components`](./crates/hypershell-components): the core abstract syntax, such as - `SimpleExec` and `StreamingExec`, and the CGP components and traits the DSL builds on. -- [`hypershell-tokio-components`](./crates/hypershell-tokio-components): Tokio-based implementations - for executing external CLI commands and handling file I/O. -- [`hypershell-reqwest-components`](./crates/hypershell-reqwest-components): native HTTP handlers, - such as `SimpleHttpRequest` and `StreamingHttpRequest`, built on `reqwest`. -- [`hypershell-json-components`](./crates/hypershell-json-components): handlers for JSON - serialization (`EncodeJson`) and deserialization (`DecodeJson`). -- [`hypershell-hash-components`](./crates/hypershell-hash-components): an extension crate with native - handlers for checksumming (`Checksum`) and hex encoding (`BytesToHex`). -- [`hypershell-tungstenite-components`](./crates/hypershell-tungstenite-components): an extension - crate that adds native WebSocket support. -- [`hypershell-examples`](./crates/hypershell-examples): the examples below. + Ok(()) +} +``` -## Getting started +`Program` is a type alias, not a value. Each piece of it, such as `SimpleExec` or `StreamToStdout`, +is an empty struct that says nothing about how it runs, and the `hypershell!` macro only rewrites +the shell-like surface into that type: the `|` becomes a pipeline, the brackets a type-level list, +and each string a type-level string. -Add `hypershell` and `cgp` to your `Cargo.toml`: +Running the program is one `handle` call on a context. `HypershellCli` is the context here, and this +is its entire definition: -```toml -[dependencies] -cgp = { version = "0.8.0" } -hypershell = { version = "0.1.0" } +```rust +pub struct HypershellCli; -# The examples also need an async runtime and an HTTP client: -tokio = { version = "1", features = ["full"] } -reqwest = "0.12" -anyhow = "1.0" +delegate_components! { + HypershellCli { + namespace HypershellNamespace; + } +} ``` -## Building +The one line joins `HypershellNamespace`, which routes each piece of syntax to the implementation, +or **provider**, that interprets it. The compiler resolves every choice while it type-checks the +program, so the call compiles to direct calls to those providers, with no interpreter running at run +time. A context of your own can join the same namespace, add fields that a program reads, such as a +URL, or join a namespace that extends the language with new syntax. -These are the commands CI runs: +## Installation -```sh -cargo build --workspace --all-targets -cargo test --workspace +Add `hypershell`, `cgp`, and an async runtime to your `Cargo.toml`: + +```toml +[dependencies] +cgp = "0.8.0" +hypershell = "0.2.0" +tokio = { version = "1", features = ["macros", "rt-multi-thread"] } ``` -The workspace pins `nightly-2026-11-16` in `rust-toolchain.toml`, because `.cargo/config.toml` turns -on the next-generation trait solver with `-Z next-solver=globally`, so `cargo` selects that nightly. +The `hypershell!` macro expects `hypershell::prelude::*` in scope, and its expansion names the `cgp` +crate, so a program's crate depends on both. + +The library crates build on stable Rust, and so does a small program such as the one above. Large +programs can need nightly Rust with the next-generation trait solver. On stable Rust 1.98.1, the +repository's two compare examples, which nest whole programs inside others, grew `rustc` to about +7 GB while type-checking and were stopped; on nightly with `-Z next-solver=globally`, a fresh check +of one of them took about 9 seconds and 460 MB. A crate with programs of that size can copy the +repository's `rust-toolchain.toml` and `.cargo/config.toml`, which select a dated nightly and turn +the solver on. + +## The crates + +Hypershell is split into crates by backend, so a program compiles only the libraries it uses: + +- [`hypershell`](./crates/hypershell): the main crate, with `HypershellNamespace`, the error wiring, + the `HypershellCli` and `HypershellHttp` contexts, and the prelude a program imports. +- [`hypershell-macro`](./crates/hypershell-macro): the `hypershell!` macro, which provides the + shell-like syntax. +- [`hypershell-components`](./crates/hypershell-components): the syntax, such as `SimpleExec` and + `StreamingExec`, and the CGP components and traits the language builds on. +- [`hypershell-tokio-components`](./crates/hypershell-tokio-components): running external commands, + files, and streams, on Tokio. +- [`hypershell-reqwest-components`](./crates/hypershell-reqwest-components): HTTP requests, such as + `SimpleHttpRequest` and `StreamingHttpRequest`, on `reqwest`. +- [`hypershell-json-components`](./crates/hypershell-json-components): JSON encoding with + `EncodeJson` and decoding with `DecodeJson`. +- [`hypershell-hash-components`](./crates/hypershell-hash-components): an extension with native + checksums (`Checksum`) and hex encoding (`BytesToHex`). +- [`hypershell-tungstenite-components`](./crates/hypershell-tungstenite-components): an extension + with native WebSockets. -Contributors and agents start from [AGENTS.md](AGENTS.md), which names these checks. +The two extensions are not part of `HypershellNamespace`, so a program that uses them joins an +extended namespace or wires them on its context, as the examples show. The unpublished +[`hypershell-examples`](./crates/hypershell-examples) crate holds the examples below. ## Examples -The [`hypershell-examples`](./crates/hypershell-examples/examples) crate holds runnable programs, one -per feature. Run one with `cargo run -p hypershell-examples --example `. +Each example is a runnable program, run from the repository's root with +`cargo run -p hypershell-examples --example `. Most need the network and a few common +command-line tools. -- [`hello.rs`](./crates/hypershell-examples/examples/hello.rs): executes `echo hello world!` through +- [`hello.rs`](./crates/hypershell-examples/examples/hello.rs): runs `echo hello world!` through `SimpleExec`. -- [`hello_name.rs`](./crates/hypershell-examples/examples/hello_name.rs): passes dynamic values to a - shell command with variable parameters (`FieldArg`). +- [`hello_name.rs`](./crates/hypershell-examples/examples/hello_name.rs): passes a value from a field + of the context to a shell command with `FieldArg`. - [`http_checksum_cli.rs`](./crates/hypershell-examples/examples/http_checksum_cli.rs): fetches a URL - with `curl` and pipes the output to `sha256sum` and `cut` through streaming execution. + with `curl` and pipes the output to `sha256sum` and `cut` as streaming commands. - [`http_checksum_client.rs`](./crates/hypershell-examples/examples/http_checksum_client.rs): fetches - the URL with Hypershell's native HTTP client, then pipes the response through the same commands. + the URL with the native HTTP client, then pipes the response through the same commands. - [`http_checksum_native.rs`](./crates/hypershell-examples/examples/http_checksum_native.rs): the same - checksum, using the native HTTP client and an extended DSL that adds `Checksum` to the syntax. -- [`rust_playground.rs`](./crates/hypershell-examples/examples/rust_playground.rs): encodes and - decodes JSON, sending a Rust snippet to the Rust Playground API and parsing the response. -- [`github_issues.rs`](./crates/hypershell-examples/examples/github_issues.rs): reads a JSON web API - and processes the result. + checksum in native stages, from a language extended with `Checksum`. - [`nix_manual.rs`](./crates/hypershell-examples/examples/nix_manual.rs): combines a native HTTP - request with external CLI tools. + request with external command-line tools. +- [`save_webpage.rs`](./crates/hypershell-examples/examples/save_webpage.rs): downloads a webpage as a + stream and writes it to a file. +- [`github_issues.rs`](./crates/hypershell-examples/examples/github_issues.rs): calls a JSON web API + and decodes the result into a Rust type. +- [`rust_playground.rs`](./crates/hypershell-examples/examples/rust_playground.rs): sends a Rust + snippet to the Rust Playground API as JSON and decodes the response. - [`bluesky.rs`](./crates/hypershell-examples/examples/bluesky.rs): connects to the Bluesky firehose through `nix-shell` and `websocat`, then filters the stream with `grep`. - [`bluesky_websocket.rs`](./crates/hypershell-examples/examples/bluesky_websocket.rs): the same - firehose, using native WebSocket handling added to the DSL. + firehose, with native WebSockets added to the language. - [`compare_and_branch.rs`](./crates/hypershell-examples/examples/compare_and_branch.rs) and - [`parallel_compare.rs`](./crates/hypershell-examples/examples/parallel_compare.rs): branch and - compare pipelines, using the compare namespace. + [`parallel_compare.rs`](./crates/hypershell-examples/examples/parallel_compare.rs): compare the + outputs of pipelines and branch on the result, with syntax the examples crate adds. + +## Status and costs + +Hypershell is a demonstration, and these are the costs to weigh first: + +- **Large programs need nightly.** As [Installation](#installation) describes, the library and small + programs build on stable Rust, and programs that nest others deeply can need nightly with the new + trait solver. +- **Programs are fixed at compile time.** A program is a type, so it cannot be loaded or changed + while the application runs. Values a program needs at run time, such as a URL, come from fields of + its context. +- **Error messages are long.** A mistake in a program is a compile error, and the compiler's raw + message lists every step it took before it failed. Checking the program with `check_components!` + and reading the error with + [`cargo cgp check`](https://contextgeneric.dev/docs/tooling/cargo-cgp/check) helps: + `cargo cgp check` leads with the root cause for the classes it recognizes, and the tool does not + yet reshape every class. +- **It is lightly tested.** Its value is as a worked example rather than a tool for production, and + the [limitations page](https://contextgeneric.dev/docs/projects/hypershell/limitations) describes + where the design stops and when a shell script or plain Rust fits better. -## Learn CGP +## Building -The website is the main documentation for CGP: the -[quickstart](https://contextgeneric.dev/docs/quickstart), the -[tutorials](https://contextgeneric.dev/docs/tutorials/hello), the -[concepts](https://contextgeneric.dev/docs/concepts/), and the -[construct reference](https://contextgeneric.dev/docs/reference/). The -[project page](https://contextgeneric.dev/docs/projects/hypershell/) explains this repository, and -the [CGP knowledge base](https://github.com/contextgeneric/cgp-knowledge-base) records it in depth for -contributors and agents. +These are the commands CI runs: -## Disclaimer +```sh +cargo build --workspace --all-targets +cargo test --workspace +``` -Hypershell is an **experimental** proof of concept that shows what CGP can do. Its purpose is to -demonstrate how CGP builds highly modular DSLs in Rust, not to be a production-ready shell -replacement. +The workspace pins `nightly-2026-11-16` in `rust-toolchain.toml`, because `.cargo/config.toml` turns +on the next-generation trait solver with `-Z next-solver=globally`, so `cargo` selects that nightly +in the repository. Contributors and agents start from [AGENTS.md](AGENTS.md), which names these +checks. -## License +## Learn more -Licensed under the MIT license. +The [project page](https://contextgeneric.dev/docs/projects/hypershell/) explains Hypershell: its +examples as short tutorials, the design one idea at a time, and guides to writing and debugging a +program. For CGP itself, start with the [quickstart](https://contextgeneric.dev/docs/quickstart), +then the [tutorials](https://contextgeneric.dev/docs/tutorials/hello) and the +[concepts](https://contextgeneric.dev/docs/concepts/), and the +[type-level DSLs](https://contextgeneric.dev/docs/concepts/type-level-dsls) page explains the +technique behind Hypershell with a smaller language. The +[CGP knowledge base](https://github.com/contextgeneric/cgp-knowledge-base) records the project in +depth for contributors and agents. From 890120775c7e20f0ac6467bfe7202f8637841f5a Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Tue, 17 Nov 2026 16:07:32 +0100 Subject: [PATCH 36/37] Give each published crate a README that is its crate doc Each of the eight crates says what it holds and where it fits in the language, links the `hypershell` crate, the website, and the repository, and becomes its crate documentation through `#![doc = include_str!("../README.md")]`, so docs.rs and crates.io show the same page. The `hypershell` README carries the `hello` program, which `cargo test` runs as a doc test with Tokio as a dev-dependency, and says which toolchain a program needs. Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 1 + crates/hypershell-components/README.md | 28 +++++++++ crates/hypershell-components/src/lib.rs | 1 + crates/hypershell-hash-components/README.md | 16 +++++ crates/hypershell-hash-components/src/lib.rs | 1 + crates/hypershell-json-components/README.md | 14 +++++ crates/hypershell-json-components/src/lib.rs | 1 + crates/hypershell-macro/README.md | 14 +++++ crates/hypershell-macro/src/lib.rs | 1 + .../hypershell-reqwest-components/README.md | 24 ++++++++ .../hypershell-reqwest-components/src/lib.rs | 1 + crates/hypershell-tokio-components/README.md | 26 ++++++++ crates/hypershell-tokio-components/src/lib.rs | 1 + .../README.md | 16 +++++ .../src/lib.rs | 1 + crates/hypershell/Cargo.toml | 3 + crates/hypershell/README.md | 61 +++++++++++++++++++ crates/hypershell/src/lib.rs | 1 + 18 files changed, 211 insertions(+) create mode 100644 crates/hypershell-components/README.md create mode 100644 crates/hypershell-hash-components/README.md create mode 100644 crates/hypershell-json-components/README.md create mode 100644 crates/hypershell-macro/README.md create mode 100644 crates/hypershell-reqwest-components/README.md create mode 100644 crates/hypershell-tokio-components/README.md create mode 100644 crates/hypershell-tungstenite-components/README.md create mode 100644 crates/hypershell/README.md diff --git a/Cargo.lock b/Cargo.lock index e95979f..7bcd814 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -778,6 +778,7 @@ dependencies = [ "hypershell-tokio-components", "reqwest", "serde_json", + "tokio", "url", ] diff --git a/crates/hypershell-components/README.md b/crates/hypershell-components/README.md new file mode 100644 index 0000000..488fa2c --- /dev/null +++ b/crates/hypershell-components/README.md @@ -0,0 +1,28 @@ +[![Crates.io](https://img.shields.io/crates/v/hypershell-components.svg)](https://crates.io/crates/hypershell-components) +[![Docs.rs](https://docs.rs/hypershell-components/badge.svg)](https://docs.rs/hypershell-components) + +# hypershell-components: the syntax and components of Hypershell + +`hypershell-components` defines the abstract syntax of [Hypershell](https://docs.rs/hypershell), a small language for shell-script-like programs in Rust built with [Context-Generic Programming (CGP)](https://contextgeneric.dev/), and the CGP components that its +backend crates implement. Every piece of syntax is an empty struct that names an operation without +saying how it runs, so a backend crate can interpret it without this crate depending on any +backend. + +**[hypershell](https://docs.rs/hypershell) · [Project page](https://contextgeneric.dev/docs/projects/hypershell/) · [Repository](https://github.com/contextgeneric/hypershell)** + +The crate is `no_std` and links `alloc`. Its items sit in four modules: + +- **`dsl`:** the syntax a program writes: execution (`SimpleExec`, `StreamingExec`, `WithArgs`, + `WithStaticArgs`, `FieldArgs`), arguments (`StaticArg`, `FieldArg`, `JoinArgs`, + `UrlEncodeArg`), HTTP (`SimpleHttpRequest`, `StreamingHttpRequest`, the method markers, + `WithHeaders`, `Header`, `WebSocket`), streams and files (`StreamToBytes`, `StreamToString`, + `StreamToStdout`, `BytesToStream`, `BytesToString`, `ReadFile`, `WriteFile`), JSON + (`EncodeJson`, `DecodeJson`), and control (`Pipe`, `Use`, `ConvertTo`). +- **`components`:** the components that extract a command, URL, string, or HTTP method from an + argument, and the abstract types they produce. +- **`providers`:** the providers that need no backend, such as `HandlePipe`, `Call`, and the + argument extractors, collected in the `HypershellBaseProvider` bundle. +- **`traits`:** `WrapCall` and `WrapStaticArg`, which map over type-level lists. + +`hypershell::prelude` re-exports the whole `dsl` module. The +[abstract syntax](https://contextgeneric.dev/docs/projects/hypershell/architecture/abstract-syntax) page explains how a program becomes a type. diff --git a/crates/hypershell-components/src/lib.rs b/crates/hypershell-components/src/lib.rs index 067564f..7e787cd 100644 --- a/crates/hypershell-components/src/lib.rs +++ b/crates/hypershell-components/src/lib.rs @@ -1,3 +1,4 @@ +#![doc = include_str!("../README.md")] #![no_std] extern crate alloc; diff --git a/crates/hypershell-hash-components/README.md b/crates/hypershell-hash-components/README.md new file mode 100644 index 0000000..ac44489 --- /dev/null +++ b/crates/hypershell-hash-components/README.md @@ -0,0 +1,16 @@ +[![Crates.io](https://img.shields.io/crates/v/hypershell-hash-components.svg)](https://crates.io/crates/hypershell-hash-components) +[![Docs.rs](https://docs.rs/hypershell-hash-components/badge.svg)](https://docs.rs/hypershell-hash-components) + +# hypershell-hash-components: checksums as a Hypershell extension + +`hypershell-hash-components` extends [Hypershell](https://docs.rs/hypershell), a small language for shell-script-like programs in Rust built with [Context-Generic Programming (CGP)](https://contextgeneric.dev/) with two pieces of syntax and their providers, in a +crate the core language does not depend on. `Checksum` hashes a stream of bytes with any +`Digest` hasher, such as `sha2::Sha256`, through `HandleStreamChecksum`, and `BytesToHex` writes +bytes as hexadecimal, through `HandleBytesToHex`. + +**[hypershell](https://docs.rs/hypershell) · [Project page](https://contextgeneric.dev/docs/projects/hypershell/) · [Repository](https://github.com/contextgeneric/hypershell)** + +`HypershellNamespace` does not route this syntax, so a program that uses it runs on a context that +joins an extended namespace or wires the providers itself. The repository's +[`http_checksum_native`](https://contextgeneric.dev/docs/projects/hypershell/examples/http-checksum-native) example joins a namespace that inherits +the base language and adds `Checksum`, changing one line of its context. diff --git a/crates/hypershell-hash-components/src/lib.rs b/crates/hypershell-hash-components/src/lib.rs index bfb4758..327051f 100644 --- a/crates/hypershell-hash-components/src/lib.rs +++ b/crates/hypershell-hash-components/src/lib.rs @@ -1,2 +1,3 @@ +#![doc = include_str!("../README.md")] pub mod dsl; pub mod providers; diff --git a/crates/hypershell-json-components/README.md b/crates/hypershell-json-components/README.md new file mode 100644 index 0000000..53b94fb --- /dev/null +++ b/crates/hypershell-json-components/README.md @@ -0,0 +1,14 @@ +[![Crates.io](https://img.shields.io/crates/v/hypershell-json-components.svg)](https://crates.io/crates/hypershell-json-components) +[![Docs.rs](https://docs.rs/hypershell-json-components/badge.svg)](https://docs.rs/hypershell-json-components) + +# hypershell-json-components: JSON stages for Hypershell + +`hypershell-json-components` interprets the JSON syntax of [Hypershell](https://docs.rs/hypershell), a small language for shell-script-like programs in Rust built with [Context-Generic Programming (CGP)](https://contextgeneric.dev/), on +[`serde_json`](https://docs.rs/serde_json). `HandleEncodeJson` interprets `EncodeJson`, which +writes a Rust value as JSON bytes, and `HandleDecodeJson` interprets `DecodeJson`, which reads +JSON bytes into a `T`. Both are collected in the `HypershellJsonProvider` bundle. + +**[hypershell](https://docs.rs/hypershell) · [Project page](https://contextgeneric.dev/docs/projects/hypershell/) · [Repository](https://github.com/contextgeneric/hypershell)** + +The crate is `no_std` and links `alloc`, and `HypershellNamespace` routes both stages for every +context that joins it. diff --git a/crates/hypershell-json-components/src/lib.rs b/crates/hypershell-json-components/src/lib.rs index 330260b..2c42535 100644 --- a/crates/hypershell-json-components/src/lib.rs +++ b/crates/hypershell-json-components/src/lib.rs @@ -1,3 +1,4 @@ +#![doc = include_str!("../README.md")] #![no_std] extern crate alloc; diff --git a/crates/hypershell-macro/README.md b/crates/hypershell-macro/README.md new file mode 100644 index 0000000..a21b013 --- /dev/null +++ b/crates/hypershell-macro/README.md @@ -0,0 +1,14 @@ +[![Crates.io](https://img.shields.io/crates/v/hypershell-macro.svg)](https://crates.io/crates/hypershell-macro) +[![Docs.rs](https://docs.rs/hypershell-macro/badge.svg)](https://docs.rs/hypershell-macro) + +# hypershell-macro: the hypershell! macro + +`hypershell-macro` provides the `hypershell!` procedural macro of [Hypershell](https://docs.rs/hypershell), a small language for shell-script-like programs in Rust built with [Context-Generic Programming (CGP)](https://contextgeneric.dev/). The macro rewrites a +shell-like surface into the Rust type that is the program: `|` becomes a `Pipe` of the stages, +a bracketed list becomes a type-level list, and each string literal becomes a type-level string. + +**[hypershell](https://docs.rs/hypershell) · [Project page](https://contextgeneric.dev/docs/projects/hypershell/) · [Repository](https://github.com/contextgeneric/hypershell)** + +A program reaches the macro through `hypershell::prelude`, so it has no reason to depend on this +crate directly. The macro only rewrites tokens and resolves no names, so its expansion expects the +prelude in scope and names the `cgp` crate. diff --git a/crates/hypershell-macro/src/lib.rs b/crates/hypershell-macro/src/lib.rs index 8fea4cd..ffb202c 100644 --- a/crates/hypershell-macro/src/lib.rs +++ b/crates/hypershell-macro/src/lib.rs @@ -1,3 +1,4 @@ +#![doc = include_str!("../README.md")] use proc_macro::TokenStream; use proc_macro2::TokenStream as TokenStream2; diff --git a/crates/hypershell-reqwest-components/README.md b/crates/hypershell-reqwest-components/README.md new file mode 100644 index 0000000..19fb3dd --- /dev/null +++ b/crates/hypershell-reqwest-components/README.md @@ -0,0 +1,24 @@ +[![Crates.io](https://img.shields.io/crates/v/hypershell-reqwest-components.svg)](https://crates.io/crates/hypershell-reqwest-components) +[![Docs.rs](https://docs.rs/hypershell-reqwest-components/badge.svg)](https://docs.rs/hypershell-reqwest-components) + +# hypershell-reqwest-components: HTTP requests on reqwest + +`hypershell-reqwest-components` interprets the HTTP syntax of [Hypershell](https://docs.rs/hypershell), a small language for shell-script-like programs in Rust built with [Context-Generic Programming (CGP)](https://contextgeneric.dev/), on +[`reqwest`](https://docs.rs/reqwest). It sends simple and streaming requests with the method, URL, +and headers a program names, and reports a failed response as an error. + +**[hypershell](https://docs.rs/hypershell) · [Project page](https://contextgeneric.dev/docs/projects/hypershell/) · [Repository](https://github.com/contextgeneric/hypershell)** + +Its items sit in three modules: + +- **`dsl`:** the core request syntax `CoreHttpRequest`. +- **`components`:** `CanUpdateRequestBuilder`, which adds a program's headers to a request, and + `HasReqwestClient`, which reads the HTTP client from the context. +- **`providers`:** the request providers, the method extractor and header updaters, `StreamToBody` + for a streamed request body, and the `ErrorResponse` error, collected in the + `HypershellReqwestProvider` bundle. + +The crate builds on +[`hypershell-tokio-components`](https://docs.rs/hypershell-tokio-components) for its stream +types. `HypershellNamespace` routes its syntax, and the `HypershellHttp` context supplies the +client. diff --git a/crates/hypershell-reqwest-components/src/lib.rs b/crates/hypershell-reqwest-components/src/lib.rs index 16dd9c1..5bd643f 100644 --- a/crates/hypershell-reqwest-components/src/lib.rs +++ b/crates/hypershell-reqwest-components/src/lib.rs @@ -1,3 +1,4 @@ +#![doc = include_str!("../README.md")] pub mod components; pub mod dsl; pub mod providers; diff --git a/crates/hypershell-tokio-components/README.md b/crates/hypershell-tokio-components/README.md new file mode 100644 index 0000000..967348d --- /dev/null +++ b/crates/hypershell-tokio-components/README.md @@ -0,0 +1,26 @@ +[![Crates.io](https://img.shields.io/crates/v/hypershell-tokio-components.svg)](https://crates.io/crates/hypershell-tokio-components) +[![Docs.rs](https://docs.rs/hypershell-tokio-components/badge.svg)](https://docs.rs/hypershell-tokio-components) + +# hypershell-tokio-components: commands, files, and streams on Tokio + +`hypershell-tokio-components` interprets the process, file, and stream syntax of [Hypershell](https://docs.rs/hypershell), a small language for shell-script-like programs in Rust built with [Context-Generic Programming (CGP)](https://contextgeneric.dev/), on +[Tokio](https://tokio.rs/). It runs external commands, simple and streaming, reads and writes files, +writes to standard output, and converts between bytes and the stream types that stages exchange. + +**[hypershell](https://docs.rs/hypershell) · [Project page](https://contextgeneric.dev/docs/projects/hypershell/) · [Repository](https://github.com/contextgeneric/hypershell)** + +Its items sit in four modules: + +- **`dsl`:** the core execution syntax `CoreExec`, and `ToTokioAsyncRead`, which turns a stage's + input into a Tokio reader. +- **`components`:** `CanUpdateCommand`, which adds a program's arguments to a + `tokio::process::Command`. +- **`providers`:** the providers for commands, files, standard output, and the stream adapters, + the input dispatchers that pick an adapter by the type a stage receives, and the execution error + types, collected in the `HypershellTokioProvider` bundle. +- **`types`:** the stream wrappers `TokioAsyncReadStream`, `FuturesAsyncReadStream`, and + `FuturesStream`, and `ChildOutputStream`, a streamed command's output. + +`HypershellNamespace` routes this crate's syntax for every context that joins it. The +[streams and input dispatch](https://contextgeneric.dev/docs/projects/hypershell/architecture/streams-and-input-dispatch) page explains how stages +exchange streams. diff --git a/crates/hypershell-tokio-components/src/lib.rs b/crates/hypershell-tokio-components/src/lib.rs index b3fd86a..2e28c12 100644 --- a/crates/hypershell-tokio-components/src/lib.rs +++ b/crates/hypershell-tokio-components/src/lib.rs @@ -1,3 +1,4 @@ +#![doc = include_str!("../README.md")] pub mod components; pub mod dsl; pub mod providers; diff --git a/crates/hypershell-tungstenite-components/README.md b/crates/hypershell-tungstenite-components/README.md new file mode 100644 index 0000000..c951997 --- /dev/null +++ b/crates/hypershell-tungstenite-components/README.md @@ -0,0 +1,16 @@ +[![Crates.io](https://img.shields.io/crates/v/hypershell-tungstenite-components.svg)](https://crates.io/crates/hypershell-tungstenite-components) +[![Docs.rs](https://docs.rs/hypershell-tungstenite-components/badge.svg)](https://docs.rs/hypershell-tungstenite-components) + +# hypershell-tungstenite-components: WebSockets as a Hypershell extension + +`hypershell-tungstenite-components` interprets the `WebSocket` syntax of [Hypershell](https://docs.rs/hypershell), a small language for shell-script-like programs in Rust built with [Context-Generic Programming (CGP)](https://contextgeneric.dev/), on +[`tokio-tungstenite`](https://docs.rs/tokio-tungstenite). `HandleWebsocket` connects to the URL a +program names, sends the stage's input to the server as binary messages, and passes the replies on +to the next stage as a stream, each text message ending in a newline. The +`HypershellTungsteniteProvider` bundle collects its wiring. + +**[hypershell](https://docs.rs/hypershell) · [Project page](https://contextgeneric.dev/docs/projects/hypershell/) · [Repository](https://github.com/contextgeneric/hypershell)** + +`HypershellNamespace` does not route `WebSocket`, so a program that uses it runs on a context that +wires the bundle. The repository's +[`bluesky_websocket`](https://contextgeneric.dev/docs/projects/hypershell/examples/bluesky-websocket) example wires it onto a single context. diff --git a/crates/hypershell-tungstenite-components/src/lib.rs b/crates/hypershell-tungstenite-components/src/lib.rs index 9ce92fb..ddfc2ea 100644 --- a/crates/hypershell-tungstenite-components/src/lib.rs +++ b/crates/hypershell-tungstenite-components/src/lib.rs @@ -1 +1,2 @@ +#![doc = include_str!("../README.md")] pub mod providers; diff --git a/crates/hypershell/Cargo.toml b/crates/hypershell/Cargo.toml index d94c7e5..f69c4a9 100644 --- a/crates/hypershell/Cargo.toml +++ b/crates/hypershell/Cargo.toml @@ -23,3 +23,6 @@ cgp-error-anyhow = { workspace = true } reqwest = { workspace = true } serde_json = { workspace = true } url = { workspace = true } + +[dev-dependencies] +tokio = { workspace = true, features = [ "macros", "rt-multi-thread" ] } diff --git a/crates/hypershell/README.md b/crates/hypershell/README.md new file mode 100644 index 0000000..7d74215 --- /dev/null +++ b/crates/hypershell/README.md @@ -0,0 +1,61 @@ +[![Crates.io](https://img.shields.io/crates/v/hypershell.svg)](https://crates.io/crates/hypershell) +[![Docs.rs](https://docs.rs/hypershell/badge.svg)](https://docs.rs/hypershell) + +# Hypershell: shell-script-like programs as Rust types + +Hypershell is a small language for writing shell-script-like programs in Rust, built with +[Context-Generic Programming (CGP)](https://contextgeneric.dev/), a language extension for Rust +with pluggable trait implementations at compile-time. A program is a Rust type, and the context +that runs it is its interpreter, so both the language's syntax and its meaning can be extended +without editing its crates. Hypershell is an experimental proof of concept, not a replacement for a +shell. + +**[Project page](https://contextgeneric.dev/docs/projects/hypershell/) · [Examples](https://contextgeneric.dev/docs/projects/hypershell/examples/) · [Repository](https://github.com/contextgeneric/hypershell)** + +This crate is the one a program depends on, beside `cgp` and an async runtime. This program runs +`echo hello world!` and prints the output: + +```rust +use hypershell::prelude::*; + +pub type Program = hypershell! { + SimpleExec< + StaticArg<"echo">, + WithStaticArgs["hello", "world!"], + > + | StreamToStdout +}; + +#[tokio::main] +async fn main() -> Result<(), Error> { + HypershellCli + .handle(PhantomData::, Vec::new()) + .await?; + + Ok(()) +} +``` + +`Program` is a type alias, and `HypershellCli` is a context whose whole wiring is one line that +joins `HypershellNamespace`. The namespace routes each piece of syntax to the provider that +interprets it, and the compiler resolves those choices while it type-checks the program. + +## What the crate holds + +- **`prelude`:** what a program file imports: `cgp::prelude`, `PhantomData`, the handler traits + and keys, the anyhow `Error`, every syntax type of + [`hypershell-components`](https://docs.rs/hypershell-components), the `hypershell!` macro, and + the two contexts. +- **`contexts`:** `HypershellCli`, a context with no fields for programs that run commands and + handle files and streams, and `HypershellHttp`, whose `http_client` field supplies the client + that HTTP requests use. +- **`namespaces`:** `HypershellNamespace`, which assembles the language from the backend crates + and which a context of your own joins. +- **`providers`:** `HypershellErrorHandler`, the error wiring that raises each library's errors into + the context's `anyhow::Error`. + +The `hypershell!` macro expects the prelude in scope, and its expansion names the `cgp` crate, so a +program's crate depends on `cgp` as well. The library and small programs such as this one build on +stable Rust, and programs that nest others deeply can need nightly with the next-generation trait +solver, as the [repository README](https://github.com/contextgeneric/hypershell#installation) +describes. diff --git a/crates/hypershell/src/lib.rs b/crates/hypershell/src/lib.rs index 83ed3e8..3a95bd0 100644 --- a/crates/hypershell/src/lib.rs +++ b/crates/hypershell/src/lib.rs @@ -1,3 +1,4 @@ +#![doc = include_str!("../README.md")] pub mod contexts; pub mod namespaces; pub mod prelude; From 2cc82c4db3eb627b81f24255a0db52afb8a4f8dd Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Tue, 17 Nov 2026 16:11:48 +0100 Subject: [PATCH 37/37] Wrap the crate READMEs and fix a missing comma The crate READMEs wrap at 100 columns without splitting a link or code span, and the hash crate's opening no longer reads as though CGP provides its syntax. Co-Authored-By: Claude Opus 5.5 --- crates/hypershell-components/README.md | 20 ++++++++------- crates/hypershell-hash-components/README.md | 15 ++++++----- crates/hypershell-json-components/README.md | 10 +++++--- crates/hypershell-macro/README.md | 8 +++--- .../hypershell-reqwest-components/README.md | 11 ++++---- crates/hypershell-tokio-components/README.md | 12 +++++---- .../README.md | 7 ++++-- crates/hypershell/README.md | 25 +++++++++---------- 8 files changed, 61 insertions(+), 47 deletions(-) diff --git a/crates/hypershell-components/README.md b/crates/hypershell-components/README.md index 488fa2c..4cf8162 100644 --- a/crates/hypershell-components/README.md +++ b/crates/hypershell-components/README.md @@ -3,21 +3,22 @@ # hypershell-components: the syntax and components of Hypershell -`hypershell-components` defines the abstract syntax of [Hypershell](https://docs.rs/hypershell), a small language for shell-script-like programs in Rust built with [Context-Generic Programming (CGP)](https://contextgeneric.dev/), and the CGP components that its +`hypershell-components` defines the abstract syntax of [Hypershell](https://docs.rs/hypershell), a +small language for shell-script-like programs in Rust built with +[Context-Generic Programming (CGP)](https://contextgeneric.dev/), and the CGP components that its backend crates implement. Every piece of syntax is an empty struct that names an operation without -saying how it runs, so a backend crate can interpret it without this crate depending on any -backend. +saying how it runs, so a backend crate can interpret it without this crate depending on any backend. **[hypershell](https://docs.rs/hypershell) · [Project page](https://contextgeneric.dev/docs/projects/hypershell/) · [Repository](https://github.com/contextgeneric/hypershell)** The crate is `no_std` and links `alloc`. Its items sit in four modules: - **`dsl`:** the syntax a program writes: execution (`SimpleExec`, `StreamingExec`, `WithArgs`, - `WithStaticArgs`, `FieldArgs`), arguments (`StaticArg`, `FieldArg`, `JoinArgs`, - `UrlEncodeArg`), HTTP (`SimpleHttpRequest`, `StreamingHttpRequest`, the method markers, - `WithHeaders`, `Header`, `WebSocket`), streams and files (`StreamToBytes`, `StreamToString`, - `StreamToStdout`, `BytesToStream`, `BytesToString`, `ReadFile`, `WriteFile`), JSON - (`EncodeJson`, `DecodeJson`), and control (`Pipe`, `Use`, `ConvertTo`). + `WithStaticArgs`, `FieldArgs`), arguments (`StaticArg`, `FieldArg`, `JoinArgs`, `UrlEncodeArg`), + HTTP (`SimpleHttpRequest`, `StreamingHttpRequest`, the method markers, `WithHeaders`, `Header`, + `WebSocket`), streams and files (`StreamToBytes`, `StreamToString`, `StreamToStdout`, + `BytesToStream`, `BytesToString`, `ReadFile`, `WriteFile`), JSON (`EncodeJson`, `DecodeJson`), and + control (`Pipe`, `Use`, `ConvertTo`). - **`components`:** the components that extract a command, URL, string, or HTTP method from an argument, and the abstract types they produce. - **`providers`:** the providers that need no backend, such as `HandlePipe`, `Call`, and the @@ -25,4 +26,5 @@ The crate is `no_std` and links `alloc`. Its items sit in four modules: - **`traits`:** `WrapCall` and `WrapStaticArg`, which map over type-level lists. `hypershell::prelude` re-exports the whole `dsl` module. The -[abstract syntax](https://contextgeneric.dev/docs/projects/hypershell/architecture/abstract-syntax) page explains how a program becomes a type. +[abstract syntax](https://contextgeneric.dev/docs/projects/hypershell/architecture/abstract-syntax) +page explains how a program becomes a type. diff --git a/crates/hypershell-hash-components/README.md b/crates/hypershell-hash-components/README.md index ac44489..7e65cb1 100644 --- a/crates/hypershell-hash-components/README.md +++ b/crates/hypershell-hash-components/README.md @@ -3,14 +3,17 @@ # hypershell-hash-components: checksums as a Hypershell extension -`hypershell-hash-components` extends [Hypershell](https://docs.rs/hypershell), a small language for shell-script-like programs in Rust built with [Context-Generic Programming (CGP)](https://contextgeneric.dev/) with two pieces of syntax and their providers, in a -crate the core language does not depend on. `Checksum` hashes a stream of bytes with any -`Digest` hasher, such as `sha2::Sha256`, through `HandleStreamChecksum`, and `BytesToHex` writes -bytes as hexadecimal, through `HandleBytesToHex`. +`hypershell-hash-components` extends [Hypershell](https://docs.rs/hypershell), a small language for +shell-script-like programs in Rust built with +[Context-Generic Programming (CGP)](https://contextgeneric.dev/), with two pieces of syntax and +their providers, in a crate the core language does not depend on. `Checksum` hashes a stream +of bytes with any `Digest` hasher, such as `sha2::Sha256`, through `HandleStreamChecksum`, and +`BytesToHex` writes bytes as hexadecimal, through `HandleBytesToHex`. **[hypershell](https://docs.rs/hypershell) · [Project page](https://contextgeneric.dev/docs/projects/hypershell/) · [Repository](https://github.com/contextgeneric/hypershell)** `HypershellNamespace` does not route this syntax, so a program that uses it runs on a context that joins an extended namespace or wires the providers itself. The repository's -[`http_checksum_native`](https://contextgeneric.dev/docs/projects/hypershell/examples/http-checksum-native) example joins a namespace that inherits -the base language and adds `Checksum`, changing one line of its context. +[`http_checksum_native`](https://contextgeneric.dev/docs/projects/hypershell/examples/http-checksum-native) +example joins a namespace that inherits the base language and adds `Checksum`, changing one line of +its context. diff --git a/crates/hypershell-json-components/README.md b/crates/hypershell-json-components/README.md index 53b94fb..0db874c 100644 --- a/crates/hypershell-json-components/README.md +++ b/crates/hypershell-json-components/README.md @@ -3,10 +3,12 @@ # hypershell-json-components: JSON stages for Hypershell -`hypershell-json-components` interprets the JSON syntax of [Hypershell](https://docs.rs/hypershell), a small language for shell-script-like programs in Rust built with [Context-Generic Programming (CGP)](https://contextgeneric.dev/), on -[`serde_json`](https://docs.rs/serde_json). `HandleEncodeJson` interprets `EncodeJson`, which -writes a Rust value as JSON bytes, and `HandleDecodeJson` interprets `DecodeJson`, which reads -JSON bytes into a `T`. Both are collected in the `HypershellJsonProvider` bundle. +`hypershell-json-components` interprets the JSON syntax of [Hypershell](https://docs.rs/hypershell), +a small language for shell-script-like programs in Rust built with +[Context-Generic Programming (CGP)](https://contextgeneric.dev/), on +[`serde_json`](https://docs.rs/serde_json). `HandleEncodeJson` interprets `EncodeJson`, which writes +a Rust value as JSON bytes, and `HandleDecodeJson` interprets `DecodeJson`, which reads JSON +bytes into a `T`. Both are collected in the `HypershellJsonProvider` bundle. **[hypershell](https://docs.rs/hypershell) · [Project page](https://contextgeneric.dev/docs/projects/hypershell/) · [Repository](https://github.com/contextgeneric/hypershell)** diff --git a/crates/hypershell-macro/README.md b/crates/hypershell-macro/README.md index a21b013..157e6b3 100644 --- a/crates/hypershell-macro/README.md +++ b/crates/hypershell-macro/README.md @@ -3,9 +3,11 @@ # hypershell-macro: the hypershell! macro -`hypershell-macro` provides the `hypershell!` procedural macro of [Hypershell](https://docs.rs/hypershell), a small language for shell-script-like programs in Rust built with [Context-Generic Programming (CGP)](https://contextgeneric.dev/). The macro rewrites a -shell-like surface into the Rust type that is the program: `|` becomes a `Pipe` of the stages, -a bracketed list becomes a type-level list, and each string literal becomes a type-level string. +`hypershell-macro` provides the `hypershell!` procedural macro of +[Hypershell](https://docs.rs/hypershell), a small language for shell-script-like programs in Rust +built with [Context-Generic Programming (CGP)](https://contextgeneric.dev/). The macro rewrites a +shell-like surface into the Rust type that is the program: `|` becomes a `Pipe` of the stages, a +bracketed list becomes a type-level list, and each string literal becomes a type-level string. **[hypershell](https://docs.rs/hypershell) · [Project page](https://contextgeneric.dev/docs/projects/hypershell/) · [Repository](https://github.com/contextgeneric/hypershell)** diff --git a/crates/hypershell-reqwest-components/README.md b/crates/hypershell-reqwest-components/README.md index 19fb3dd..70c8e8c 100644 --- a/crates/hypershell-reqwest-components/README.md +++ b/crates/hypershell-reqwest-components/README.md @@ -3,7 +3,9 @@ # hypershell-reqwest-components: HTTP requests on reqwest -`hypershell-reqwest-components` interprets the HTTP syntax of [Hypershell](https://docs.rs/hypershell), a small language for shell-script-like programs in Rust built with [Context-Generic Programming (CGP)](https://contextgeneric.dev/), on +`hypershell-reqwest-components` interprets the HTTP syntax of +[Hypershell](https://docs.rs/hypershell), a small language for shell-script-like programs in Rust +built with [Context-Generic Programming (CGP)](https://contextgeneric.dev/), on [`reqwest`](https://docs.rs/reqwest). It sends simple and streaming requests with the method, URL, and headers a program names, and reports a failed response as an error. @@ -18,7 +20,6 @@ Its items sit in three modules: for a streamed request body, and the `ErrorResponse` error, collected in the `HypershellReqwestProvider` bundle. -The crate builds on -[`hypershell-tokio-components`](https://docs.rs/hypershell-tokio-components) for its stream -types. `HypershellNamespace` routes its syntax, and the `HypershellHttp` context supplies the -client. +The crate builds on [`hypershell-tokio-components`](https://docs.rs/hypershell-tokio-components) for +its stream types. `HypershellNamespace` routes its syntax, and the `HypershellHttp` context supplies +the client. diff --git a/crates/hypershell-tokio-components/README.md b/crates/hypershell-tokio-components/README.md index 967348d..5f5d8e6 100644 --- a/crates/hypershell-tokio-components/README.md +++ b/crates/hypershell-tokio-components/README.md @@ -3,7 +3,9 @@ # hypershell-tokio-components: commands, files, and streams on Tokio -`hypershell-tokio-components` interprets the process, file, and stream syntax of [Hypershell](https://docs.rs/hypershell), a small language for shell-script-like programs in Rust built with [Context-Generic Programming (CGP)](https://contextgeneric.dev/), on +`hypershell-tokio-components` interprets the process, file, and stream syntax of +[Hypershell](https://docs.rs/hypershell), a small language for shell-script-like programs in Rust +built with [Context-Generic Programming (CGP)](https://contextgeneric.dev/), on [Tokio](https://tokio.rs/). It runs external commands, simple and streaming, reads and writes files, writes to standard output, and converts between bytes and the stream types that stages exchange. @@ -15,12 +17,12 @@ Its items sit in four modules: input into a Tokio reader. - **`components`:** `CanUpdateCommand`, which adds a program's arguments to a `tokio::process::Command`. -- **`providers`:** the providers for commands, files, standard output, and the stream adapters, - the input dispatchers that pick an adapter by the type a stage receives, and the execution error +- **`providers`:** the providers for commands, files, standard output, and the stream adapters, the + input dispatchers that pick an adapter by the type a stage receives, and the execution error types, collected in the `HypershellTokioProvider` bundle. - **`types`:** the stream wrappers `TokioAsyncReadStream`, `FuturesAsyncReadStream`, and `FuturesStream`, and `ChildOutputStream`, a streamed command's output. `HypershellNamespace` routes this crate's syntax for every context that joins it. The -[streams and input dispatch](https://contextgeneric.dev/docs/projects/hypershell/architecture/streams-and-input-dispatch) page explains how stages -exchange streams. +[streams and input dispatch](https://contextgeneric.dev/docs/projects/hypershell/architecture/streams-and-input-dispatch) +page explains how stages exchange streams. diff --git a/crates/hypershell-tungstenite-components/README.md b/crates/hypershell-tungstenite-components/README.md index c951997..23de14d 100644 --- a/crates/hypershell-tungstenite-components/README.md +++ b/crates/hypershell-tungstenite-components/README.md @@ -3,7 +3,9 @@ # hypershell-tungstenite-components: WebSockets as a Hypershell extension -`hypershell-tungstenite-components` interprets the `WebSocket` syntax of [Hypershell](https://docs.rs/hypershell), a small language for shell-script-like programs in Rust built with [Context-Generic Programming (CGP)](https://contextgeneric.dev/), on +`hypershell-tungstenite-components` interprets the `WebSocket` syntax of +[Hypershell](https://docs.rs/hypershell), a small language for shell-script-like programs in Rust +built with [Context-Generic Programming (CGP)](https://contextgeneric.dev/), on [`tokio-tungstenite`](https://docs.rs/tokio-tungstenite). `HandleWebsocket` connects to the URL a program names, sends the stage's input to the server as binary messages, and passes the replies on to the next stage as a stream, each text message ending in a newline. The @@ -13,4 +15,5 @@ to the next stage as a stream, each text message ending in a newline. The `HypershellNamespace` does not route `WebSocket`, so a program that uses it runs on a context that wires the bundle. The repository's -[`bluesky_websocket`](https://contextgeneric.dev/docs/projects/hypershell/examples/bluesky-websocket) example wires it onto a single context. +[`bluesky_websocket`](https://contextgeneric.dev/docs/projects/hypershell/examples/bluesky-websocket) +example wires it onto a single context. diff --git a/crates/hypershell/README.md b/crates/hypershell/README.md index 7d74215..55f1208 100644 --- a/crates/hypershell/README.md +++ b/crates/hypershell/README.md @@ -4,11 +4,10 @@ # Hypershell: shell-script-like programs as Rust types Hypershell is a small language for writing shell-script-like programs in Rust, built with -[Context-Generic Programming (CGP)](https://contextgeneric.dev/), a language extension for Rust -with pluggable trait implementations at compile-time. A program is a Rust type, and the context -that runs it is its interpreter, so both the language's syntax and its meaning can be extended -without editing its crates. Hypershell is an experimental proof of concept, not a replacement for a -shell. +[Context-Generic Programming (CGP)](https://contextgeneric.dev/), a language extension for Rust with +pluggable trait implementations at compile-time. A program is a Rust type, and the context that runs +it is its interpreter, so both the language's syntax and its meaning can be extended without editing +its crates. Hypershell is an experimental proof of concept, not a replacement for a shell. **[Project page](https://contextgeneric.dev/docs/projects/hypershell/) · [Examples](https://contextgeneric.dev/docs/projects/hypershell/examples/) · [Repository](https://github.com/contextgeneric/hypershell)** @@ -42,15 +41,15 @@ interprets it, and the compiler resolves those choices while it type-checks the ## What the crate holds -- **`prelude`:** what a program file imports: `cgp::prelude`, `PhantomData`, the handler traits - and keys, the anyhow `Error`, every syntax type of - [`hypershell-components`](https://docs.rs/hypershell-components), the `hypershell!` macro, and - the two contexts. +- **`prelude`:** what a program file imports: `cgp::prelude`, `PhantomData`, the handler traits and + keys, the anyhow `Error`, every syntax type of + [`hypershell-components`](https://docs.rs/hypershell-components), the `hypershell!` macro, and the + two contexts. - **`contexts`:** `HypershellCli`, a context with no fields for programs that run commands and - handle files and streams, and `HypershellHttp`, whose `http_client` field supplies the client - that HTTP requests use. -- **`namespaces`:** `HypershellNamespace`, which assembles the language from the backend crates - and which a context of your own joins. + handle files and streams, and `HypershellHttp`, whose `http_client` field supplies the client that + HTTP requests use. +- **`namespaces`:** `HypershellNamespace`, which assembles the language from the backend crates and + which a context of your own joins. - **`providers`:** `HypershellErrorHandler`, the error wiring that raises each library's errors into the context's `anyhow::Error`.